[
  {
    "path": ".github/workflows/ci.yml",
    "content": "name: Rebuild With New SDK\n\non:\n  push:\n    paths-ignore:\n      - \"**/*.md\"\n      - '**/*.txt'\n  pull_request:\n    paths-ignore:\n      - \"**/*.md\"\n      - '**/*.txt'\n  workflow_dispatch:\n\nconcurrency:\n  group: ${{ github.ref }}-${{ github.event_name  }}\n  cancel-in-progress: true\n\njobs:\n  payload-build:\n    runs-on: ubuntu-latest\n    steps:\n\n    - name: Checkout\n      uses: actions/checkout@v4\n\n    - name: Install dependencies\n      run: |\n        sudo apt update\n        sudo apt install build-essential clang-18 lld-18 xxd yasm nasm\n\n    - name: Install toolchain\n      run: |\n        wget https://github.com/ps5-payload-dev/pacbrew-repo/releases/latest/download/ps5-payload-dev.tar.gz\n        sudo tar xf ps5-payload-dev.tar.gz -C /\n\n    - name: Build Payload\n      run: |\n        export PS5_PAYLOAD_SDK=/opt/ps5-payload-sdk\n        bash ci-ps5-kstuff-ldr.sh\n\n    - name: Upload Payload\n      uses: actions/upload-artifact@v4\n      with:\n        name: Payload\n        path: ./ps5-kstuff-ldr/kstuff.elf\n        if-no-files-found: error\n"
  },
  {
    "path": ".gitmodules",
    "content": "[submodule \"ps5-kstuff/BearSSL\"]\n\tpath = ps5-kstuff/BearSSL\n\turl = https://www.bearssl.org/git/BearSSL\n[submodule \"ps5-kstuff/libtomcrypt\"]\n\tpath = ps5-kstuff/libtomcrypt\n\turl = https://github.com/libtom/libtomcrypt\n"
  },
  {
    "path": "ci-ps5-kstuff-ldr.sh",
    "content": "#!/usr/bin/env bash\n\ngit submodule update --init --recursive || exit 1\ncd ps5-kstuff\nmake\ncd ..\ncd ps5-kstuff-ldr\nmake\n"
  },
  {
    "path": "freebsd-headers/Block.h",
    "content": "/*\n * Block.h\n *\n * Copyright 2008-2010 Apple, Inc. Permission is hereby granted, free of charge,\n * to any person obtaining a copy of this software and associated documentation\n * files (the \"Software\"), to deal in the Software without restriction,\n * including without limitation the rights to use, copy, modify, merge, publish,\n * distribute, sublicense, and/or sell copies of the Software, and to permit\n * persons to whom the Software is furnished to do so, subject to the following\n * conditions:\n * \n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n * \n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n *\n */\n\n#ifndef _BLOCK_H_\n#define _BLOCK_H_\n\n#if !defined(BLOCK_EXPORT)\n#   if defined(__cplusplus)\n#       define BLOCK_EXPORT extern \"C\" \n#   else\n#       define BLOCK_EXPORT extern\n#   endif\n#endif\n\n#if defined(__cplusplus)\nextern \"C\" {\n#endif\n\n/* Create a heap based copy of a Block or simply add a reference to an existing one.\n * This must be paired with Block_release to recover memory, even when running\n * under Objective-C Garbage Collection.\n */\nBLOCK_EXPORT void *_Block_copy(const void *aBlock);\n\n/* Lose the reference, and if heap based and last reference, recover the memory. */\nBLOCK_EXPORT void _Block_release(const void *aBlock);\n\n#if defined(__cplusplus)\n}\n#endif\n\n/* Type correct macros. */\n\n#define Block_copy(...) ((__typeof(__VA_ARGS__))_Block_copy((const void *)(__VA_ARGS__)))\n#define Block_release(...) _Block_release((const void *)(__VA_ARGS__))\n\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/Block_private.h",
    "content": "/*\n * Block_private.h\n *\n * Copyright 2008-2010 Apple, Inc. Permission is hereby granted, free of charge,\n * to any person obtaining a copy of this software and associated documentation\n * files (the \"Software\"), to deal in the Software without restriction,\n * including without limitation the rights to use, copy, modify, merge, publish,\n * distribute, sublicense, and/or sell copies of the Software, and to permit\n * persons to whom the Software is furnished to do so, subject to the following\n * conditions:\n * \n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n * \n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n *\n */\n\n#ifndef _BLOCK_PRIVATE_H_\n#define _BLOCK_PRIVATE_H_\n\n#if !defined(BLOCK_EXPORT)\n#   if defined(__cplusplus)\n#       define BLOCK_EXPORT extern \"C\" \n#   else\n#       define BLOCK_EXPORT extern\n#   endif\n#endif\n\n#ifndef _MSC_VER\n#include <stdbool.h>\n#else\n/* MSVC doesn't have <stdbool.h>. Compensate. */\ntypedef char bool;\n#define true (bool)1\n#define false (bool)0\n#endif\n\n#if defined(__cplusplus)\nextern \"C\" {\n#endif\n\n\nenum {\n    BLOCK_REFCOUNT_MASK =     (0xffff),\n    BLOCK_NEEDS_FREE =        (1 << 24),\n    BLOCK_HAS_COPY_DISPOSE =  (1 << 25),\n    BLOCK_HAS_CTOR =          (1 << 26), /* Helpers have C++ code. */\n    BLOCK_IS_GC =             (1 << 27),\n    BLOCK_IS_GLOBAL =         (1 << 28),\n    BLOCK_HAS_DESCRIPTOR =    (1 << 29)\n};\n\n\n/* Revised new layout. */\nstruct Block_descriptor {\n    unsigned long int reserved;\n    unsigned long int size;\n    void (*copy)(void *dst, void *src);\n    void (*dispose)(void *);\n};\n\n\nstruct Block_layout {\n    void *isa;\n    int flags;\n    int reserved; \n    void (*invoke)(void *, ...);\n    struct Block_descriptor *descriptor;\n    /* Imported variables. */\n};\n\n\nstruct Block_byref {\n    void *isa;\n    struct Block_byref *forwarding;\n    int flags; /* refcount; */\n    int size;\n    void (*byref_keep)(struct Block_byref *dst, struct Block_byref *src);\n    void (*byref_destroy)(struct Block_byref *);\n    /* long shared[0]; */\n};\n\n\nstruct Block_byref_header {\n    void *isa;\n    struct Block_byref *forwarding;\n    int flags;\n    int size;\n};\n\n\n/* Runtime support functions used by compiler when generating copy/dispose helpers. */\n\nenum {\n    /* See function implementation for a more complete description of these fields and combinations */\n    BLOCK_FIELD_IS_OBJECT   =  3,  /* id, NSObject, __attribute__((NSObject)), block, ... */\n    BLOCK_FIELD_IS_BLOCK    =  7,  /* a block variable */\n    BLOCK_FIELD_IS_BYREF    =  8,  /* the on stack structure holding the __block variable */\n    BLOCK_FIELD_IS_WEAK     = 16,  /* declared __weak, only used in byref copy helpers */\n    BLOCK_BYREF_CALLER      = 128  /* called from __block (byref) copy/dispose support routines. */\n};\n\n/* Runtime entry point called by compiler when assigning objects inside copy helper routines */\nBLOCK_EXPORT void _Block_object_assign(void *destAddr, const void *object, const int flags);\n    /* BLOCK_FIELD_IS_BYREF is only used from within block copy helpers */\n\n\n/* runtime entry point called by the compiler when disposing of objects inside dispose helper routine */\nBLOCK_EXPORT void _Block_object_dispose(const void *object, const int flags);\n\n\n\n/* Other support functions */\n\n/* Runtime entry to get total size of a closure */\nBLOCK_EXPORT unsigned long int Block_size(void *block_basic);\n\n\n\n/* the raw data space for runtime classes for blocks */\n/* class+meta used for stack, malloc, and collectable based blocks */\nBLOCK_EXPORT void * _NSConcreteStackBlock[32];\nBLOCK_EXPORT void * _NSConcreteMallocBlock[32];\nBLOCK_EXPORT void * _NSConcreteAutoBlock[32];\nBLOCK_EXPORT void * _NSConcreteFinalizingBlock[32];\nBLOCK_EXPORT void * _NSConcreteGlobalBlock[32];\nBLOCK_EXPORT void * _NSConcreteWeakBlockVariable[32];\n\n\n/* the intercept routines that must be used under GC */\nBLOCK_EXPORT void _Block_use_GC( void *(*alloc)(const unsigned long, const bool isOne, const bool isObject),\n                                  void (*setHasRefcount)(const void *, const bool),\n                                  void (*gc_assign_strong)(void *, void **),\n                                  void (*gc_assign_weak)(const void *, void *),\n                                  void (*gc_memmove)(void *, void *, unsigned long));\n\n/* earlier version, now simply transitional */\nBLOCK_EXPORT void _Block_use_GC5( void *(*alloc)(const unsigned long, const bool isOne, const bool isObject),\n                                  void (*setHasRefcount)(const void *, const bool),\n                                  void (*gc_assign_strong)(void *, void **),\n                                  void (*gc_assign_weak)(const void *, void *));\n\nBLOCK_EXPORT void _Block_use_RR( void (*retain)(const void *),\n                                 void (*release)(const void *));\n\n/* make a collectable GC heap based Block.  Not useful under non-GC. */\nBLOCK_EXPORT void *_Block_copy_collectable(const void *aBlock);\n\n/* thread-unsafe diagnostic */\nBLOCK_EXPORT const char *_Block_dump(const void *block);\n\n\n/* Obsolete */\n\n/* first layout */\nstruct Block_basic {\n    void *isa;\n    int Block_flags;  /* int32_t */\n    int Block_size;  /* XXX should be packed into Block_flags */\n    void (*Block_invoke)(void *);\n    void (*Block_copy)(void *dst, void *src);  /* iff BLOCK_HAS_COPY_DISPOSE */\n    void (*Block_dispose)(void *);             /* iff BLOCK_HAS_COPY_DISPOSE */\n    /* long params[0];  // where const imports, __block storage references, etc. get laid down */\n};\n\n\n#if defined(__cplusplus)\n}\n#endif\n\n\n#endif /* _BLOCK_PRIVATE_H_ */\n"
  },
  {
    "path": "freebsd-headers/FlexLexer.h",
    "content": "// $Header: /home/daffy/u0/vern/flex/RCS/FlexLexer.h,v 1.19 96/05/25 20:43:02 vern Exp $\n// $FreeBSD: release/9.0.0/usr.bin/lex/FlexLexer.h 126841 2004-03-11 10:43:35Z josef $\n\n// FlexLexer.h -- define interfaces for lexical analyzer classes generated\n//\t\t  by flex\n\n// Copyright (c) 1993 The Regents of the University of California.\n// All rights reserved.\n//\n// This code is derived from software contributed to Berkeley by\n// Kent Williams and Tom Epperly.\n//\n// Redistribution and use in source and binary forms are permitted provided\n// that: (1) source distributions retain this entire copyright notice and\n// comment, and (2) distributions including binaries display the following\n// acknowledgement:  ``This product includes software developed by the\n// University of California, Berkeley and its contributors'' in the\n// documentation or other materials provided with the distribution and in\n// all advertising materials mentioning features or use of this software.\n// Neither the name of the University nor the names of its contributors may\n// be used to endorse or promote products derived from this software without\n// specific prior written permission.\n// THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED\n// WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF\n// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.\n\n// This file defines FlexLexer, an abstract class which specifies the\n// external interface provided to flex C++ lexer objects, and yyFlexLexer,\n// which defines a particular lexer class.\n//\n// If you want to create multiple lexer classes, you use the -P flag\n// to rename each yyFlexLexer to some other xxFlexLexer.  You then\n// include <FlexLexer.h> in your other sources once per lexer class:\n//\n//\t#undef yyFlexLexer\n//\t#define yyFlexLexer xxFlexLexer\n//\t#include <FlexLexer.h>\n//\n//\t#undef yyFlexLexer\n//\t#define yyFlexLexer zzFlexLexer\n//\t#include <FlexLexer.h>\n//\t...\n\n#ifndef __FLEX_LEXER_H\n// Never included before - need to define base class.\n#define __FLEX_LEXER_H\n#include <iostream>\n\nextern \"C++\" {\n\nstruct yy_buffer_state;\ntypedef int yy_state_type;\n\nclass FlexLexer {\npublic:\n\tvirtual ~FlexLexer()\t{ }\n\n\tconst char* YYText()\t{ return yytext; }\n\tint YYLeng()\t\t{ return yyleng; }\n\n\tvirtual void\n\t\tyy_switch_to_buffer( struct yy_buffer_state* new_buffer ) = 0;\n\tvirtual struct yy_buffer_state*\n\t\tyy_create_buffer( std::istream* s, int size ) = 0;\n\tvirtual void yy_delete_buffer( struct yy_buffer_state* b ) = 0;\n\tvirtual void yyrestart( std::istream* s ) = 0;\n\n\tvirtual int yylex() = 0;\n\n\t// Call yylex with new input/output sources.\n\tint yylex( std::istream* new_in, std::ostream* new_out = 0 )\n\t\t{\n\t\tswitch_streams( new_in, new_out );\n\t\treturn yylex();\n\t\t}\n\n\t// Switch to new input/output streams.  A nil stream pointer\n\t// indicates \"keep the current one\".\n\tvirtual void switch_streams( std::istream* new_in = 0,\n\t\t\t\t\tstd::ostream* new_out = 0 ) = 0;\n\n\tint lineno() const\t\t{ return yylineno; }\n\n\tint debug() const\t\t{ return yy_flex_debug; }\n\tvoid set_debug( int flag )\t{ yy_flex_debug = flag; }\n\nprotected:\n\tchar* yytext;\n\tint yyleng;\n\tint yylineno;\t\t// only maintained if you use %option yylineno\n\tint yy_flex_debug;\t// only has effect with -d or \"%option debug\"\n};\n\n}\n#endif\n\n#if defined(yyFlexLexer) || ! defined(yyFlexLexerOnce)\n// Either this is the first time through (yyFlexLexerOnce not defined),\n// or this is a repeated include to define a different flavor of\n// yyFlexLexer, as discussed in the flex man page.\n#define yyFlexLexerOnce\n\nclass yyFlexLexer : public FlexLexer {\npublic:\n\t// arg_yyin and arg_yyout default to the cin and cout, but we\n\t// only make that assignment when initializing in yylex().\n\tyyFlexLexer( std::istream* arg_yyin = 0, std::ostream* arg_yyout = 0 );\n\n\tvirtual ~yyFlexLexer();\n\n\tvoid yy_switch_to_buffer( struct yy_buffer_state* new_buffer );\n\tstruct yy_buffer_state* yy_create_buffer( std::istream* s, int size );\n\tvoid yy_delete_buffer( struct yy_buffer_state* b );\n\tvoid yyrestart( std::istream* s );\n\n\tvirtual int yylex();\n\tvirtual void switch_streams( std::istream* new_in, std::ostream* new_out );\n\nprotected:\n\tvirtual int LexerInput( char* buf, int max_size );\n\tvirtual void LexerOutput( const char* buf, int size );\n\tvirtual void LexerError( const char* msg );\n\n\tvoid yyunput( int c, char* buf_ptr );\n\tint yyinput();\n\n\tvoid yy_load_buffer_state();\n\tvoid yy_init_buffer( struct yy_buffer_state* b, std::istream* s );\n\tvoid yy_flush_buffer( struct yy_buffer_state* b );\n\n\tint yy_start_stack_ptr;\n\tint yy_start_stack_depth;\n\tint* yy_start_stack;\n\n\tvoid yy_push_state( int new_state );\n\tvoid yy_pop_state();\n\tint yy_top_state();\n\n\tyy_state_type yy_get_previous_state();\n\tyy_state_type yy_try_NUL_trans( yy_state_type current_state );\n\tint yy_get_next_buffer();\n\n\tstd::istream* yyin;\t// input source for default LexerInput\n\tstd::ostream* yyout;\t// output sink for default LexerOutput\n\n\tstruct yy_buffer_state* yy_current_buffer;\n\n\t// yy_hold_char holds the character lost when yytext is formed.\n\tchar yy_hold_char;\n\n\t// Number of characters read into yy_ch_buf.\n\tint yy_n_chars;\n\n\t// Points to current character in buffer.\n\tchar* yy_c_buf_p;\n\n\tint yy_init;\t\t// whether we need to initialize\n\tint yy_start;\t\t// start state number\n\n\t// Flag which is used to allow yywrap()'s to do buffer switches\n\t// instead of setting up a fresh yyin.  A bit of a hack ...\n\tint yy_did_buffer_switch_on_eof;\n\n\t// The following are not always needed, but may be depending\n\t// on use of certain flex features (like REJECT or yymore()).\n\n\tyy_state_type yy_last_accepting_state;\n\tchar* yy_last_accepting_cpos;\n\n\tyy_state_type* yy_state_buf;\n\tyy_state_type* yy_state_ptr;\n\n\tchar* yy_full_match;\n\tint* yy_full_state;\n\tint yy_full_lp;\n\n\tint yy_lp;\n\tint yy_looking_for_trail_begin;\n\n\tint yy_more_flag;\n\tint yy_more_len;\n\tint yy_more_offset;\n\tint yy_prev_more_offset;\n};\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/_ctype.h",
    "content": "/*\n * Copyright (c) 1989, 1993\n *\tThe Regents of the University of California.  All rights reserved.\n * (c) UNIX System Laboratories, Inc.\n * All or some portions of this file are derived from material licensed\n * to the University of California by American Telephone and Telegraph\n * Co. or Unix System Laboratories, Inc. and are reproduced herein with\n * the permission of UNIX System Laboratories, Inc.\n *\n * This code is derived from software contributed to Berkeley by\n * Paul Borman at Krystal Technologies.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * From @(#)ctype.h\t8.4 (Berkeley) 1/21/94\n * From FreeBSD: src/include/ctype.h,v 1.27 2004/06/23 07:11:39 tjr Exp\n * $FreeBSD: release/9.0.0/include/_ctype.h 203964 2010-02-16 19:39:50Z imp $\n */\n\n#ifndef __CTYPE_H_\n#define\t__CTYPE_H_\n\n#include <sys/cdefs.h>\n#include <sys/_types.h>\n\n#define\t_CTYPE_A\t0x00000100L\t\t/* Alpha */\n#define\t_CTYPE_C\t0x00000200L\t\t/* Control */\n#define\t_CTYPE_D\t0x00000400L\t\t/* Digit */\n#define\t_CTYPE_G\t0x00000800L\t\t/* Graph */\n#define\t_CTYPE_L\t0x00001000L\t\t/* Lower */\n#define\t_CTYPE_P\t0x00002000L\t\t/* Punct */\n#define\t_CTYPE_S\t0x00004000L\t\t/* Space */\n#define\t_CTYPE_U\t0x00008000L\t\t/* Upper */\n#define\t_CTYPE_X\t0x00010000L\t\t/* X digit */\n#define\t_CTYPE_B\t0x00020000L\t\t/* Blank */\n#define\t_CTYPE_R\t0x00040000L\t\t/* Print */\n#define\t_CTYPE_I\t0x00080000L\t\t/* Ideogram */\n#define\t_CTYPE_T\t0x00100000L\t\t/* Special */\n#define\t_CTYPE_Q\t0x00200000L\t\t/* Phonogram */\n#define\t_CTYPE_SW0\t0x20000000L\t\t/* 0 width character */\n#define\t_CTYPE_SW1\t0x40000000L\t\t/* 1 width character */\n#define\t_CTYPE_SW2\t0x80000000L\t\t/* 2 width character */\n#define\t_CTYPE_SW3\t0xc0000000L\t\t/* 3 width character */\n#define\t_CTYPE_SWM\t0xe0000000L\t\t/* Mask for screen width data */\n#define\t_CTYPE_SWS\t30\t\t\t/* Bits to shift to get width */\n\n/* See comments in <sys/_types.h> about __ct_rune_t. */\n__BEGIN_DECLS\nunsigned long\t___runetype(__ct_rune_t) __pure;\n__ct_rune_t\t___tolower(__ct_rune_t) __pure;\n__ct_rune_t\t___toupper(__ct_rune_t) __pure;\n__END_DECLS\n\n/*\n * _EXTERNALIZE_CTYPE_INLINES_ is defined in locale/nomacros.c to tell us\n * to generate code for extern versions of all our inline functions.\n */\n#ifdef _EXTERNALIZE_CTYPE_INLINES_\n#define\t_USE_CTYPE_INLINE_\n#define\tstatic\n#define\t__inline\n#endif\n\nextern int __mb_sb_limit;\n\n/*\n * Use inline functions if we are allowed to and the compiler supports them.\n */\n#if !defined(_DONT_USE_CTYPE_INLINE_) && \\\n    (defined(_USE_CTYPE_INLINE_) || defined(__GNUC__) || defined(__cplusplus))\n\n#include <runetype.h>\n\nstatic __inline int\n__maskrune(__ct_rune_t _c, unsigned long _f)\n{\n\treturn ((_c < 0 || _c >= _CACHED_RUNES) ? ___runetype(_c) :\n\t\t_CurrentRuneLocale->__runetype[_c]) & _f;\n}\n\nstatic __inline int\n__sbmaskrune(__ct_rune_t _c, unsigned long _f)\n{\n\treturn (_c < 0 || _c >= __mb_sb_limit) ? 0 :\n\t       _CurrentRuneLocale->__runetype[_c] & _f;\n}\n\nstatic __inline int\n__istype(__ct_rune_t _c, unsigned long _f)\n{\n\treturn (!!__maskrune(_c, _f));\n}\n\nstatic __inline int\n__sbistype(__ct_rune_t _c, unsigned long _f)\n{\n\treturn (!!__sbmaskrune(_c, _f));\n}\n\nstatic __inline int\n__isctype(__ct_rune_t _c, unsigned long _f)\n{\n\treturn (_c < 0 || _c >= 128) ? 0 :\n\t       !!(_DefaultRuneLocale.__runetype[_c] & _f);\n}\n\nstatic __inline __ct_rune_t\n__toupper(__ct_rune_t _c)\n{\n\treturn (_c < 0 || _c >= _CACHED_RUNES) ? ___toupper(_c) :\n\t       _CurrentRuneLocale->__mapupper[_c];\n}\n\nstatic __inline __ct_rune_t\n__sbtoupper(__ct_rune_t _c)\n{\n\treturn (_c < 0 || _c >= __mb_sb_limit) ? _c :\n\t       _CurrentRuneLocale->__mapupper[_c];\n}\n\nstatic __inline __ct_rune_t\n__tolower(__ct_rune_t _c)\n{\n\treturn (_c < 0 || _c >= _CACHED_RUNES) ? ___tolower(_c) :\n\t       _CurrentRuneLocale->__maplower[_c];\n}\n\nstatic __inline __ct_rune_t\n__sbtolower(__ct_rune_t _c)\n{\n\treturn (_c < 0 || _c >= __mb_sb_limit) ? _c :\n\t       _CurrentRuneLocale->__maplower[_c];\n}\n\nstatic __inline int\n__wcwidth(__ct_rune_t _c)\n{\n\tunsigned int _x;\n\n\tif (_c == 0)\n\t\treturn (0);\n\t_x = (unsigned int)__maskrune(_c, _CTYPE_SWM|_CTYPE_R);\n\tif ((_x & _CTYPE_SWM) != 0)\n\t\treturn ((_x & _CTYPE_SWM) >> _CTYPE_SWS);\n\treturn ((_x & _CTYPE_R) != 0 ? 1 : -1);\n}\n\n#else /* not using inlines */\n\n__BEGIN_DECLS\nint\t\t__maskrune(__ct_rune_t, unsigned long);\nint\t\t__sbmaskrune(__ct_rune_t, unsigned long);\nint\t\t__istype(__ct_rune_t, unsigned long);\nint\t\t__sbistype(__ct_rune_t, unsigned long);\nint\t\t__isctype(__ct_rune_t, unsigned long);\n__ct_rune_t\t__toupper(__ct_rune_t);\n__ct_rune_t\t__sbtoupper(__ct_rune_t);\n__ct_rune_t\t__tolower(__ct_rune_t);\n__ct_rune_t\t__sbtolower(__ct_rune_t);\nint\t\t__wcwidth(__ct_rune_t);\n__END_DECLS\n#endif /* using inlines */\n\n#endif /* !__CTYPE_H_ */\n"
  },
  {
    "path": "freebsd-headers/a.out.h",
    "content": "/*-\n * Copyright (c) 1991, 1993\n *\tThe Regents of the University of California.  All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t@(#)a.out.h\t8.1 (Berkeley) 6/2/93\n * $FreeBSD: release/9.0.0/include/a.out.h 203964 2010-02-16 19:39:50Z imp $\n */\n\n#ifndef\t_AOUT_H_\n#define\t_AOUT_H_\n\n#include <sys/types.h>\n#include <machine/exec.h>\n#include <sys/endian.h>\n#include <sys/imgact_aout.h>\n#include <machine/reloc.h>\n\n#define _AOUT_INCLUDE_\n#include <nlist.h>\n\n#endif /* !_AOUT_H_ */\n"
  },
  {
    "path": "freebsd-headers/alias.h",
    "content": "/* lint -save -library Flexelint comment for external headers */\n\n/*-\n * Copyright (c) 2001 Charles Mott <cm@linktel.net>\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/netinet/libalias/alias.h 223080 2011-06-14 13:35:24Z ae $\n */\n\n/*\n * Alias.h defines the outside world interfaces for the packet aliasing\n * software.\n *\n * This software is placed into the public domain with no restrictions on its\n * distribution.\n */\n\n#ifndef _ALIAS_H_\n#define\t_ALIAS_H_\n\n#include <netinet/in_systm.h>\n#include <netinet/in.h>\n#include <netinet/ip.h>\n\n#define LIBALIAS_BUF_SIZE 128\n#ifdef\t_KERNEL\n/*\n * The kernel version of libalias does not support these features.\n */\n#define\tNO_FW_PUNCH\n#define\tNO_USE_SOCKETS\n#endif\n\n/*\n * The external interface to libalias, the packet aliasing engine.\n *\n * There are two sets of functions:\n *\n * PacketAlias*() the old API which doesn't take an instance pointer\n * and therefore can only have one packet engine at a time.\n *\n * LibAlias*() the new API which takes as first argument a pointer to\n * the instance of the packet aliasing engine.\n *\n * The functions otherwise correspond to each other one for one, except\n * for the LibAliasUnaliasOut()/PacketUnaliasOut() function which were\n * were misnamed in the old API.\n */\n\n/*\n * The instance structure\n */\nstruct libalias;\n\n/*\n * An anonymous structure, a pointer to which is returned from\n * PacketAliasRedirectAddr(), PacketAliasRedirectPort() or\n * PacketAliasRedirectProto(), passed to PacketAliasAddServer(),\n * and freed by PacketAliasRedirectDelete().\n */\nstruct alias_link;\n\n/* Initialization and control functions. */\nstruct libalias *LibAliasInit(struct libalias *);\nvoid\t\tLibAliasSetAddress(struct libalias *, struct in_addr _addr);\nvoid\t\tLibAliasSetFWBase(struct libalias *, unsigned int _base, unsigned int _num);\nvoid\t\tLibAliasSetSkinnyPort(struct libalias *, unsigned int _port);\nunsigned int\n\t\tLibAliasSetMode(struct libalias *, unsigned int _flags, unsigned int _mask);\nvoid\t\tLibAliasUninit(struct libalias *);\n\n/* Packet Handling functions. */\nint\t\tLibAliasIn (struct libalias *, char *_ptr, int _maxpacketsize);\nint\t\tLibAliasOut(struct libalias *, char *_ptr, int _maxpacketsize);\nint\t\tLibAliasOutTry(struct libalias *, char *_ptr, int _maxpacketsize, int _create);\nint\t\tLibAliasUnaliasOut(struct libalias *, char *_ptr, int _maxpacketsize);\n\n/* Port and address redirection functions. */\n\nint\nLibAliasAddServer(struct libalias *, struct alias_link *_lnk,\n    struct in_addr _addr, unsigned short _port);\nstruct alias_link *\nLibAliasRedirectAddr(struct libalias *, struct in_addr _src_addr,\n    struct in_addr _alias_addr);\nint\t\tLibAliasRedirectDynamic(struct libalias *, struct alias_link *_lnk);\nvoid\t\tLibAliasRedirectDelete(struct libalias *, struct alias_link *_lnk);\nstruct alias_link *\nLibAliasRedirectPort(struct libalias *, struct in_addr _src_addr,\n    unsigned short _src_port, struct in_addr _dst_addr,\n    unsigned short _dst_port, struct in_addr _alias_addr,\n    unsigned short _alias_port, unsigned char _proto);\nstruct alias_link *\nLibAliasRedirectProto(struct libalias *, struct in_addr _src_addr,\n    struct in_addr _dst_addr, struct in_addr _alias_addr,\n    unsigned char _proto);\n\n/* Fragment Handling functions. */\nvoid\t\tLibAliasFragmentIn(struct libalias *, char *_ptr, char *_ptr_fragment);\nchar           *LibAliasGetFragment(struct libalias *, char *_ptr);\nint\t\tLibAliasSaveFragment(struct libalias *, char *_ptr);\n\n/* Miscellaneous functions. */\nint\t\tLibAliasCheckNewLink(struct libalias *);\nunsigned short\n\t\tLibAliasInternetChecksum(struct libalias *, unsigned short *_ptr, int _nbytes);\nvoid\t\tLibAliasSetTarget(struct libalias *, struct in_addr _target_addr);\n\n/* Transparent proxying routines. */\nint\t\tLibAliasProxyRule(struct libalias *, const char *_cmd);\n\n/* Module handling API */\nint             LibAliasLoadModule(char *);\nint             LibAliasUnLoadAllModule(void);\nint             LibAliasRefreshModules(void);\n\n/* Mbuf helper function. */\nstruct mbuf    *m_megapullup(struct mbuf *, int);\n\n/*\n * Mode flags and other constants.\n */\n\n\n/* Mode flags, set using PacketAliasSetMode() */\n\n/*\n * If PKT_ALIAS_LOG is set, a message will be printed to /var/log/alias.log\n * every time a link is created or deleted.  This is useful for debugging.\n */\n#define\tPKT_ALIAS_LOG\t\t\t0x01\n\n/*\n * If PKT_ALIAS_DENY_INCOMING is set, then incoming connections (e.g. to ftp,\n * telnet or web servers will be prevented by the aliasing mechanism.\n */\n#define\tPKT_ALIAS_DENY_INCOMING\t\t0x02\n\n/*\n * If PKT_ALIAS_SAME_PORTS is set, packets will be attempted sent from the\n * same port as they originated on.  This allows e.g. rsh to work *99% of the\n * time*, but _not_ 100% (it will be slightly flakey instead of not working\n * at all).  This mode bit is set by PacketAliasInit(), so it is a default\n * mode of operation.\n */\n#define\tPKT_ALIAS_SAME_PORTS\t\t0x04\n\n/*\n * If PKT_ALIAS_USE_SOCKETS is set, then when partially specified links (e.g.\n * destination port and/or address is zero), the packet aliasing engine will\n * attempt to allocate a socket for the aliasing port it chooses.  This will\n * avoid interference with the host machine.  Fully specified links do not\n * require this.  This bit is set after a call to PacketAliasInit(), so it is\n * a default mode of operation.\n */\n#ifndef\tNO_USE_SOCKETS\n#define\tPKT_ALIAS_USE_SOCKETS\t\t0x08\n#endif\n/*-\n * If PKT_ALIAS_UNREGISTERED_ONLY is set, then only packets with\n * unregistered source addresses will be aliased.  Private\n * addresses are those in the following ranges:\n *\n *\t\t10.0.0.0     ->   10.255.255.255\n *\t\t172.16.0.0   ->   172.31.255.255\n *\t\t192.168.0.0  ->   192.168.255.255\n */\n#define\tPKT_ALIAS_UNREGISTERED_ONLY\t0x10\n\n/*\n * If PKT_ALIAS_RESET_ON_ADDR_CHANGE is set, then the table of dynamic\n * aliasing links will be reset whenever PacketAliasSetAddress() changes the\n * default aliasing address.  If the default aliasing address is left\n * unchanged by this function call, then the table of dynamic aliasing links\n * will be left intact.  This bit is set after a call to PacketAliasInit().\n */\n#define\tPKT_ALIAS_RESET_ON_ADDR_CHANGE\t0x20\n\n/*\n * If PKT_ALIAS_PROXY_ONLY is set, then NAT will be disabled and only\n * transparent proxying is performed.\n */\n#define\tPKT_ALIAS_PROXY_ONLY\t\t0x40\n\n/*\n * If PKT_ALIAS_REVERSE is set, the actions of PacketAliasIn() and\n * PacketAliasOut() are reversed.\n */\n#define\tPKT_ALIAS_REVERSE\t\t0x80\n\n#ifndef NO_FW_PUNCH\n/*\n * If PKT_ALIAS_PUNCH_FW is set, active FTP and IRC DCC connections will\n * create a 'hole' in the firewall to allow the transfers to work.  The\n * ipfw rule number that the hole is created with is controlled by\n * PacketAliasSetFWBase().  The hole will be attached to that\n * particular alias_link, so when the link goes away the hole is deleted.\n */\n#define\tPKT_ALIAS_PUNCH_FW\t\t0x100\n#endif\n\n/*\n * If PKT_ALIAS_SKIP_GLOBAL is set, nat instance is not checked for matching\n * states in 'ipfw nat global' rule.\n */\n#define\tPKT_ALIAS_SKIP_GLOBAL\t\t0x200\n\n/* Function return codes. */\n#define\tPKT_ALIAS_ERROR\t\t\t-1\n#define\tPKT_ALIAS_OK\t\t\t1\n#define\tPKT_ALIAS_IGNORED\t\t2\n#define\tPKT_ALIAS_UNRESOLVED_FRAGMENT\t3\n#define\tPKT_ALIAS_FOUND_HEADER_FRAGMENT\t4\n\n#endif\t\t\t\t/* !_ALIAS_H_ */\n\n/* lint -restore */\n"
  },
  {
    "path": "freebsd-headers/altq/altq.h",
    "content": "/*\t$FreeBSD: release/9.0.0/sys/contrib/altq/altq/altq.h 130368 2004-06-12 00:57:20Z mlaier $\t*/\n/*\t$KAME: altq.h,v 1.10 2003/07/10 12:07:47 kjc Exp $\t*/\n\n/*\n * Copyright (C) 1998-2003\n *\tSony Computer Science Laboratories Inc.  All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY SONY CSL AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL SONY CSL OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n */\n#ifndef _ALTQ_ALTQ_H_\n#define\t_ALTQ_ALTQ_H_\n\n#if 0\n/*\n * allow altq-3 (altqd(8) and /dev/altq) to coexist with the new pf-based altq.\n * altq3 is mainly for research experiments. pf-based altq is for daily use.\n */\n#define ALTQ3_COMPAT\t\t/* for compatibility with altq-3 */\n#define ALTQ3_CLFIER_COMPAT\t/* for compatibility with altq-3 classifier */\n#endif\n\n#ifdef ALTQ3_COMPAT\n#include <sys/param.h>\n#include <sys/ioccom.h>\n#include <sys/queue.h>\n#include <netinet/in.h>\n\n#ifndef IFNAMSIZ\n#define\tIFNAMSIZ\t16\n#endif\n#endif /* ALTQ3_COMPAT */\n\n/* altq discipline type */\n#define\tALTQT_NONE\t\t0\t/* reserved */\n#define\tALTQT_CBQ\t\t1\t/* cbq */\n#define\tALTQT_WFQ\t\t2\t/* wfq */\n#define\tALTQT_AFMAP\t\t3\t/* afmap */\n#define\tALTQT_FIFOQ\t\t4\t/* fifoq */\n#define\tALTQT_RED\t\t5\t/* red */\n#define\tALTQT_RIO\t\t6\t/* rio */\n#define\tALTQT_LOCALQ\t\t7\t/* local use */\n#define\tALTQT_HFSC\t\t8\t/* hfsc */\n#define\tALTQT_CDNR\t\t9\t/* traffic conditioner */\n#define\tALTQT_BLUE\t\t10\t/* blue */\n#define\tALTQT_PRIQ\t\t11\t/* priority queue */\n#define\tALTQT_JOBS\t\t12\t/* JoBS */\n#define\tALTQT_MAX\t\t13\t/* should be max discipline type + 1 */\n\n#ifdef ALTQ3_COMPAT\nstruct\taltqreq {\n\tchar\tifname[IFNAMSIZ];\t/* if name, e.g. \"en0\" */\n\tu_long\targ;\t\t\t/* request-specific argument */\n};\n#endif\n\n/* simple token backet meter profile */\nstruct\ttb_profile {\n\tu_int\trate;\t/* rate in bit-per-sec */\n\tu_int\tdepth;\t/* depth in bytes */\n};\n\n#ifdef ALTQ3_COMPAT\nstruct\ttbrreq {\n\tchar\tifname[IFNAMSIZ];\t/* if name, e.g. \"en0\" */\n\tstruct\ttb_profile tb_prof;\t/* token bucket profile */\n};\n\n#ifdef ALTQ3_CLFIER_COMPAT\n/*\n * common network flow info structure\n */\nstruct flowinfo {\n\tu_char\t\tfi_len;\t\t/* total length */\n\tu_char\t\tfi_family;\t/* address family */\n\tu_int8_t\tfi_data[46];\t/* actually longer; address family\n\t\t\t\t\t   specific flow info. */\n};\n\n/*\n * flow info structure for internet protocol family.\n * (currently this is the only protocol family supported)\n */\nstruct flowinfo_in {\n\tu_char\t\tfi_len;\t\t/* sizeof(struct flowinfo_in) */\n\tu_char\t\tfi_family;\t/* AF_INET */\n\tu_int8_t\tfi_proto;\t/* IPPROTO_XXX */\n\tu_int8_t\tfi_tos;\t\t/* type-of-service */\n\tstruct in_addr\tfi_dst;\t\t/* dest address */\n\tstruct in_addr\tfi_src;\t\t/* src address */\n\tu_int16_t\tfi_dport;\t/* dest port */\n\tu_int16_t\tfi_sport;\t/* src port */\n\tu_int32_t\tfi_gpi;\t\t/* generalized port id for ipsec */\n\tu_int8_t\t_pad[28];\t/* make the size equal to\n\t\t\t\t\t   flowinfo_in6 */\n};\n\n#ifdef SIN6_LEN\nstruct flowinfo_in6 {\n\tu_char\t\tfi6_len;\t/* sizeof(struct flowinfo_in6) */\n\tu_char\t\tfi6_family;\t/* AF_INET6 */\n\tu_int8_t\tfi6_proto;\t/* IPPROTO_XXX */\n\tu_int8_t\tfi6_tclass;\t/* traffic class */\n\tu_int32_t\tfi6_flowlabel;\t/* ipv6 flowlabel */\n\tu_int16_t\tfi6_dport;\t/* dest port */\n\tu_int16_t\tfi6_sport;\t/* src port */\n\tu_int32_t\tfi6_gpi;\t/* generalized port id */\n\tstruct in6_addr fi6_dst;\t/* dest address */\n\tstruct in6_addr fi6_src;\t/* src address */\n};\n#endif /* INET6 */\n\n/*\n * flow filters for AF_INET and AF_INET6\n */\nstruct flow_filter {\n\tint\t\t\tff_ruleno;\n\tstruct flowinfo_in\tff_flow;\n\tstruct {\n\t\tstruct in_addr\tmask_dst;\n\t\tstruct in_addr\tmask_src;\n\t\tu_int8_t\tmask_tos;\n\t\tu_int8_t\t_pad[3];\n\t} ff_mask;\n\tu_int8_t _pad2[24];\t/* make the size equal to flow_filter6 */\n};\n\n#ifdef SIN6_LEN\nstruct flow_filter6 {\n\tint\t\t\tff_ruleno;\n\tstruct flowinfo_in6\tff_flow6;\n\tstruct {\n\t\tstruct in6_addr\tmask6_dst;\n\t\tstruct in6_addr\tmask6_src;\n\t\tu_int8_t\tmask6_tclass;\n\t\tu_int8_t\t_pad[3];\n\t} ff_mask6;\n};\n#endif /* INET6 */\n#endif /* ALTQ3_CLFIER_COMPAT */\n#endif /* ALTQ3_COMPAT */\n\n/*\n * generic packet counter\n */\nstruct pktcntr {\n\tu_int64_t\tpackets;\n\tu_int64_t\tbytes;\n};\n\n#define\tPKTCNTR_ADD(cntr, len)\t\\\n\tdo { (cntr)->packets++; (cntr)->bytes += len; } while (/*CONSTCOND*/ 0)\n\n#ifdef ALTQ3_COMPAT\n/*\n * altq related ioctls\n */\n#define\tALTQGTYPE\t_IOWR('q', 0, struct altqreq)\t/* get queue type */\n#if 0\n/*\n * these ioctls are currently discipline-specific but could be shared\n * in the future.\n */\n#define\tALTQATTACH\t_IOW('q', 1, struct altqreq)\t/* attach discipline */\n#define\tALTQDETACH\t_IOW('q', 2, struct altqreq)\t/* detach discipline */\n#define\tALTQENABLE\t_IOW('q', 3, struct altqreq)\t/* enable discipline */\n#define\tALTQDISABLE\t_IOW('q', 4, struct altqreq)\t/* disable discipline*/\n#define\tALTQCLEAR\t_IOW('q', 5, struct altqreq)\t/* (re)initialize */\n#define\tALTQCONFIG\t_IOWR('q', 6, struct altqreq)\t/* set config params */\n#define\tALTQADDCLASS\t_IOWR('q', 7, struct altqreq)\t/* add a class */\n#define\tALTQMODCLASS\t_IOWR('q', 8, struct altqreq)\t/* modify a class */\n#define\tALTQDELCLASS\t_IOWR('q', 9, struct altqreq)\t/* delete a class */\n#define\tALTQADDFILTER\t_IOWR('q', 10, struct altqreq)\t/* add a filter */\n#define\tALTQDELFILTER\t_IOWR('q', 11, struct altqreq)\t/* delete a filter */\n#define\tALTQGETSTATS\t_IOWR('q', 12, struct altqreq)\t/* get statistics */\n#define\tALTQGETCNTR\t_IOWR('q', 13, struct altqreq)\t/* get a pkt counter */\n#endif /* 0 */\n#define\tALTQTBRSET\t_IOW('q', 14, struct tbrreq)\t/* set tb regulator */\n#define\tALTQTBRGET\t_IOWR('q', 15, struct tbrreq)\t/* get tb regulator */\n#endif /* ALTQ3_COMPAT */\n\n#ifdef _KERNEL\n#include <altq/altq_var.h>\n#endif\n\n#endif /* _ALTQ_ALTQ_H_ */\n"
  },
  {
    "path": "freebsd-headers/altq/altq_cbq.h",
    "content": "/*\t$KAME: altq_cbq.h,v 1.12 2003/10/03 05:05:15 kjc Exp $\t*/\n\n/*\n * Copyright (c) Sun Microsystems, Inc. 1993-1998 All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n *\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n *\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * 3. All advertising materials mentioning features or use of this software\n *    must display the following acknowledgement:\n *      This product includes software developed by the SMCC Technology\n *      Development Group at Sun Microsystems, Inc.\n *\n * 4. The name of the Sun Microsystems, Inc nor may not be used to endorse or\n *      promote products derived from this software without specific prior\n *      written permission.\n *\n * SUN MICROSYSTEMS DOES NOT CLAIM MERCHANTABILITY OF THIS SOFTWARE OR THE\n * SUITABILITY OF THIS SOFTWARE FOR ANY PARTICULAR PURPOSE.  The software is\n * provided \"as is\" without express or implied warranty of any kind.\n *\n * These notices must be retained in any copies of any part of this software.\n */\n\n#ifndef _ALTQ_ALTQ_CBQ_H_\n#define\t_ALTQ_ALTQ_CBQ_H_\n\n#include <altq/altq.h>\n#include <altq/altq_rmclass.h>\n#include <altq/altq_red.h>\n#include <altq/altq_rio.h>\n\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\n#define\tNULL_CLASS_HANDLE\t0\n\n/* class flags should be same as class flags in rm_class.h */\n#define\tCBQCLF_RED\t\t0x0001\t/* use RED */\n#define\tCBQCLF_ECN\t\t0x0002  /* use RED/ECN */\n#define\tCBQCLF_RIO\t\t0x0004  /* use RIO */\n#define\tCBQCLF_FLOWVALVE\t0x0008\t/* use flowvalve (aka penalty-box) */\n#define\tCBQCLF_CLEARDSCP\t0x0010  /* clear diffserv codepoint */\n#define\tCBQCLF_BORROW\t\t0x0020  /* borrow from parent */\n\n/* class flags only for root class */\n#define\tCBQCLF_WRR\t\t0x0100\t/* weighted-round robin */\n#define\tCBQCLF_EFFICIENT\t0x0200  /* work-conserving */\n\n/* class flags for special classes */\n#define\tCBQCLF_ROOTCLASS\t0x1000\t/* root class */\n#define\tCBQCLF_DEFCLASS\t\t0x2000\t/* default class */\n#ifdef ALTQ3_COMPAT\n#define\tCBQCLF_CTLCLASS\t\t0x4000\t/* control class */\n#endif\n#define\tCBQCLF_CLASSMASK\t0xf000\t/* class mask */\n\n#define\tCBQ_MAXQSIZE\t\t200\n#define\tCBQ_MAXPRI\t\tRM_MAXPRIO\n\ntypedef struct _cbq_class_stats_ {\n\tu_int32_t\thandle;\n\tu_int\t\tdepth;\n\n\tstruct pktcntr\txmit_cnt;\t/* packets sent in this class */\n\tstruct pktcntr\tdrop_cnt;\t/* dropped packets */\n\tu_int\t\tover;\t\t/* # times went over limit */\n\tu_int\t\tborrows;\t/* # times tried to borrow */\n\tu_int\t\toveractions;\t/* # times invoked overlimit action */\n\tu_int\t\tdelays;\t\t/* # times invoked delay actions */\n\n\t/* other static class parameters useful for debugging */\n\tint\t\tpriority;\n\tint\t\tmaxidle;\n\tint\t\tminidle;\n\tint\t\tofftime;\n\tint\t\tqmax;\n\tint\t\tns_per_byte;\n\tint\t\twrr_allot;\n\n\tint\t\tqcnt;\t\t/* # packets in queue */\n\tint\t\tavgidle;\n\n\t/* red and rio related info */\n\tint\t\tqtype;\n\tstruct redstats\tred[3];\n} class_stats_t;\n\n#ifdef ALTQ3_COMPAT\n/*\n * Define structures associated with IOCTLS for cbq.\n */\n\n/*\n * Define the CBQ interface structure.  This must be included in all\n * IOCTL's such that the CBQ driver may find the appropriate CBQ module\n * associated with the network interface to be affected.\n */\nstruct cbq_interface {\n\tchar\tcbq_ifacename[IFNAMSIZ];\n};\n\ntypedef struct cbq_class_spec {\n\tu_int\t\tpriority;\n\tu_int\t\tnano_sec_per_byte;\n\tu_int\t\tmaxq;\n\tu_int\t\tmaxidle;\n\tint\t\tminidle;\n\tu_int\t\tofftime;\n\tu_int32_t\tparent_class_handle;\n\tu_int32_t\tborrow_class_handle;\n\n\tu_int\t\tpktsize;\n\tint\t\tflags;\n} cbq_class_spec_t;\n\nstruct cbq_add_class {\n\tstruct cbq_interface\tcbq_iface;\n\n\tcbq_class_spec_t\tcbq_class;\n\tu_int32_t\t\tcbq_class_handle;\n};\n\nstruct cbq_delete_class {\n\tstruct cbq_interface\tcbq_iface;\n\tu_int32_t\t\tcbq_class_handle;\n};\n\nstruct cbq_modify_class {\n\tstruct cbq_interface\tcbq_iface;\n\n\tcbq_class_spec_t\tcbq_class;\n\tu_int32_t\t\tcbq_class_handle;\n};\n\nstruct cbq_add_filter {\n\tstruct cbq_interface\t\tcbq_iface;\n\tu_int32_t\t\tcbq_class_handle;\n\tstruct flow_filter\tcbq_filter;\n\n\tu_long\t\t\tcbq_filter_handle;\n};\n\nstruct cbq_delete_filter {\n\tstruct cbq_interface\tcbq_iface;\n\tu_long\t\t\tcbq_filter_handle;\n};\n\n/* number of classes are returned in nclasses field */\nstruct cbq_getstats {\n\tstruct cbq_interface\tiface;\n\tint\t\t\tnclasses;\n\tclass_stats_t\t\t*stats;\n};\n\n/*\n * Define IOCTLs for CBQ.\n */\n#define\tCBQ_IF_ATTACH\t\t_IOW('Q', 1, struct cbq_interface)\n#define\tCBQ_IF_DETACH\t\t_IOW('Q', 2, struct cbq_interface)\n#define\tCBQ_ENABLE\t\t_IOW('Q', 3, struct cbq_interface)\n#define\tCBQ_DISABLE\t\t_IOW('Q', 4, struct cbq_interface)\n#define\tCBQ_CLEAR_HIERARCHY\t_IOW('Q', 5, struct cbq_interface)\n#define\tCBQ_ADD_CLASS\t\t_IOWR('Q', 7, struct cbq_add_class)\n#define\tCBQ_DEL_CLASS\t\t_IOW('Q', 8, struct cbq_delete_class)\n#define\tCBQ_MODIFY_CLASS\t_IOWR('Q', 9, struct cbq_modify_class)\n#define\tCBQ_ADD_FILTER\t\t_IOWR('Q', 10, struct cbq_add_filter)\n#define\tCBQ_DEL_FILTER\t\t_IOW('Q', 11, struct cbq_delete_filter)\n#define\tCBQ_GETSTATS\t\t_IOWR('Q', 12, struct cbq_getstats)\n#endif /* ALTQ3_COMPAT */\n\n#ifdef _KERNEL\n/*\n * Define macros only good for kernel drivers and modules.\n */\n#define\tCBQ_WATCHDOG\t\t(hz / 20)\n#define\tCBQ_TIMEOUT\t\t10\n#define\tCBQ_LS_TIMEOUT\t\t(20 * hz / 1000)\n\n#define\tCBQ_MAX_CLASSES\t256\n\n#ifdef ALTQ3_COMPAT\n#define\tCBQ_MAX_FILTERS 256\n\n#define\tDISABLE\t\t0x00\n#define\tENABLE\t\t0x01\n#endif /* ALTQ3_COMPAT */\n\n/*\n * Define State structures.\n */\ntypedef struct cbqstate {\n#ifdef ALTQ3_COMPAT\n\tstruct cbqstate\t\t*cbq_next;\n#endif\n\tint\t\t\t cbq_qlen;\t/* # of packets in cbq */\n\tstruct rm_class\t\t*cbq_class_tbl[CBQ_MAX_CLASSES];\n\n\tstruct rm_ifdat\t\t ifnp;\n\tstruct callout\t\t cbq_callout;\t/* for timeouts */\n#ifdef ALTQ3_CLFIER_COMPAT\n\tstruct acc_classifier\tcbq_classifier;\n#endif\n} cbq_state_t;\n\n#endif /* _KERNEL */\n\n#ifdef __cplusplus\n}\n#endif\n\n#endif /* !_ALTQ_ALTQ_CBQ_H_ */\n"
  },
  {
    "path": "freebsd-headers/altq/altq_cdnr.h",
    "content": "/*\t$KAME: altq_cdnr.h,v 1.9 2003/07/10 12:07:48 kjc Exp $\t*/\n\n/*\n * Copyright (C) 1999-2002\n *\tSony Computer Science Laboratories Inc.  All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY SONY CSL AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL SONY CSL OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n */\n\n#ifndef _ALTQ_ALTQ_CDNR_H_\n#define\t_ALTQ_ALTQ_CDNR_H_\n\n#include <altq/altq.h>\n\n/*\n * traffic conditioner element types\n */\n#define\tTCETYPE_NONE\t\t0\n#define\tTCETYPE_TOP\t\t1\t/* top level conditioner */\n#define\tTCETYPE_ELEMENT\t\t2\t/* a simple tc element */\n#define\tTCETYPE_TBMETER\t\t3\t/* token bucket meter */\n#define\tTCETYPE_TRTCM\t\t4\t/* (two-rate) three color marker */\n#define\tTCETYPE_TSWTCM\t\t5\t/* time sliding window 3-color maker */\n\n/*\n * traffic conditioner action\n */\nstruct cdnr_block;\n\nstruct tc_action {\n\tint\ttca_code;\t/* e.g., TCACODE_PASS */\n\t/* tca_code dependent variable */\n\tunion {\n\t\tu_long\t\tun_value;\t/* template */\n\t\tu_int8_t\tun_dscp;\t/* diffserv code point */\n\t\tu_long\t\tun_handle;\t/* tc action handle */\n\t\tstruct cdnr_block *un_next;\t/* next tc element block */\n\t} tca_un;\n};\n#define\ttca_value\ttca_un.un_value\n#define\ttca_dscp\ttca_un.un_dscp\n#define\ttca_handle\ttca_un.un_handle\n#define\ttca_next\ttca_un.un_next\n\n#define\tTCACODE_NONE\t0\t/* action is not set */\n#define\tTCACODE_PASS\t1 \t/* pass this packet */\n#define\tTCACODE_DROP\t2\t/* discard this packet */\n#define\tTCACODE_RETURN\t3\t/* do not process this packet */\n#define\tTCACODE_MARK\t4\t/* mark dscp */\n#define\tTCACODE_HANDLE\t5\t/* take action specified by handle */\n#define\tTCACODE_NEXT\t6\t/* take action in the next tc element */\n#define\tTCACODE_MAX\t6\n\n#define\tCDNR_NULL_HANDLE\t0\n\nstruct cdnr_interface {\n\tchar\tcdnr_ifname[IFNAMSIZ];  /* interface name (e.g., fxp0) */\n};\n\n/* simple element operations */\nstruct cdnr_add_element {\n\tstruct cdnr_interface\tiface;\n\tstruct tc_action\taction;\n\n\tu_long\t\t\tcdnr_handle;\t/* return value */\n};\n\nstruct cdnr_delete_element {\n\tstruct cdnr_interface\tiface;\n\tu_long\t\t\tcdnr_handle;\n};\n\n/* token-bucket meter operations */\nstruct cdnr_add_tbmeter {\n\tstruct cdnr_interface\tiface;\n\tstruct tb_profile\tprofile;\n\tstruct tc_action\tin_action;\n\tstruct tc_action\tout_action;\n\n\tu_long\t\t\tcdnr_handle;\t/* return value */\n};\n\nstruct cdnr_modify_tbmeter {\n\tstruct cdnr_interface\tiface;\n\tu_long\t\t\tcdnr_handle;\n\tstruct tb_profile\tprofile;\n};\n\nstruct cdnr_tbmeter_stats {\n\tstruct cdnr_interface\tiface;\n\tu_long\t\t\tcdnr_handle;\n\tstruct pktcntr\t\tin_cnt;\n\tstruct pktcntr\t\tout_cnt;\n};\n\n/* two-rate three-color marker operations */\nstruct cdnr_add_trtcm {\n\tstruct cdnr_interface\tiface;\n\tstruct tb_profile\tcmtd_profile;\t/* profile for committed tb */\n\tstruct tb_profile\tpeak_profile;\t/* profile for peak tb */\n\tstruct tc_action\tgreen_action;\t/* action for green packets */\n\tstruct tc_action\tyellow_action;\t/* action for yellow packets */\n\tstruct tc_action\tred_action;\t/* action for red packets */\n\tint\t\t\tcoloraware;\t/* color-aware/color-blind */\n\n\tu_long\t\t\tcdnr_handle;\t/* return value */\n};\n\nstruct cdnr_modify_trtcm {\n\tstruct cdnr_interface\tiface;\n\tu_long\t\t\tcdnr_handle;\n\tstruct tb_profile\tcmtd_profile;\t/* profile for committed tb */\n\tstruct tb_profile\tpeak_profile;\t/* profile for peak tb */\n\tint\t\t\tcoloraware;\t/* color-aware/color-blind */\n};\n\nstruct cdnr_tcm_stats {\n\tstruct cdnr_interface\tiface;\n\tu_long\t\t\tcdnr_handle;\n\tstruct pktcntr\t\tgreen_cnt;\n\tstruct pktcntr\t\tyellow_cnt;\n\tstruct pktcntr\t\tred_cnt;\n};\n\n/* time sliding window three-color marker operations */\nstruct cdnr_add_tswtcm {\n\tstruct cdnr_interface\tiface;\n\tu_int32_t\t\tcmtd_rate;\t/* committed rate (bits/sec) */\n\tu_int32_t\t\tpeak_rate;\t/* peak rate (bits/sec) */\n\tu_int32_t\t\tavg_interval;\t/* averaging interval (msec) */\n\tstruct tc_action\tgreen_action;\t/* action for green packets */\n\tstruct tc_action\tyellow_action;\t/* action for yellow packets */\n\tstruct tc_action\tred_action;\t/* action for red packets */\n\n\tu_long\t\t\tcdnr_handle;\t/* return value */\n};\n\nstruct cdnr_modify_tswtcm {\n\tstruct cdnr_interface\tiface;\n\tu_long\t\t\tcdnr_handle;\n\tu_int32_t\t\tcmtd_rate;\t/* committed rate (bits/sec) */\n\tu_int32_t\t\tpeak_rate;\t/* peak rate (bits/sec) */\n\tu_int32_t\t\tavg_interval;\t/* averaging interval (msec) */\n};\n\nstruct cdnr_add_filter {\n\tstruct cdnr_interface\tiface;\n\tu_long\t\t\tcdnr_handle;\n#ifdef ALTQ3_CLFIER_COMPAT\n\tstruct flow_filter\tfilter;\n#endif\n\tu_long\t\t\tfilter_handle;\t/* return value */\n};\n\nstruct cdnr_delete_filter {\n\tstruct cdnr_interface\tiface;\n\tu_long\t\t\tfilter_handle;\n};\n\nstruct tce_stats {\n\tu_long\t\t\ttce_handle;\t/* tc element handle */\n\tint\t\t\ttce_type;\t/* e.g., TCETYPE_ELEMENT */\n\tstruct pktcntr\t\ttce_cnts[3];\t/* tcm returns 3 counters */\n};\n\nstruct cdnr_get_stats {\n\tstruct cdnr_interface\tiface;\n\tstruct pktcntr\t\tcnts[TCACODE_MAX+1];\n\n\t/* element stats */\n\tint\t\t\tnskip;\t\t/* skip # of elements */\n\tint\t\t\tnelements;\t/* # of element stats (WR) */\n\tstruct tce_stats\t*tce_stats;\t/* pointer to stats array */\n};\n\n#define\tCDNR_IF_ATTACH\t\t_IOW('Q', 1, struct cdnr_interface)\n#define\tCDNR_IF_DETACH\t\t_IOW('Q', 2, struct cdnr_interface)\n#define\tCDNR_ENABLE\t\t_IOW('Q', 3, struct cdnr_interface)\n#define\tCDNR_DISABLE\t\t_IOW('Q', 4, struct cdnr_interface)\n#define\tCDNR_ADD_FILTER\t\t_IOWR('Q', 10, struct cdnr_add_filter)\n#define\tCDNR_DEL_FILTER\t\t_IOW('Q', 11, struct cdnr_delete_filter)\n#define\tCDNR_GETSTATS\t\t_IOWR('Q', 12, struct cdnr_get_stats)\n#define\tCDNR_ADD_ELEM\t\t_IOWR('Q', 30, struct cdnr_add_element)\n#define\tCDNR_DEL_ELEM\t\t_IOW('Q', 31, struct cdnr_delete_element)\n#define\tCDNR_ADD_TBM\t\t_IOWR('Q', 32, struct cdnr_add_tbmeter)\n#define\tCDNR_MOD_TBM\t\t_IOW('Q', 33, struct cdnr_modify_tbmeter)\n#define\tCDNR_TBM_STATS\t\t_IOWR('Q', 34, struct cdnr_tbmeter_stats)\n#define\tCDNR_ADD_TCM\t\t_IOWR('Q', 35, struct cdnr_add_trtcm)\n#define\tCDNR_MOD_TCM\t\t_IOWR('Q', 36, struct cdnr_modify_trtcm)\n#define\tCDNR_TCM_STATS\t\t_IOWR('Q', 37, struct cdnr_tcm_stats)\n#define\tCDNR_ADD_TSW\t\t_IOWR('Q', 38, struct cdnr_add_tswtcm)\n#define\tCDNR_MOD_TSW\t\t_IOWR('Q', 39, struct cdnr_modify_tswtcm)\n\n#ifndef DSCP_EF\n/* diffserve code points */\n#define\tDSCP_MASK\t0xfc\n#define\tDSCP_CUMASK\t0x03\n#define\tDSCP_EF\t\t0xb8\n#define\tDSCP_AF11\t0x28\n#define\tDSCP_AF12\t0x30\n#define\tDSCP_AF13\t0x38\n#define\tDSCP_AF21\t0x48\n#define\tDSCP_AF22\t0x50\n#define\tDSCP_AF23\t0x58\n#define\tDSCP_AF31\t0x68\n#define\tDSCP_AF32\t0x70\n#define\tDSCP_AF33\t0x78\n#define\tDSCP_AF41\t0x88\n#define\tDSCP_AF42\t0x90\n#define\tDSCP_AF43\t0x98\n#define\tAF_CLASSMASK\t\t0xe0\n#define\tAF_DROPPRECMASK\t\t0x18\n#endif\n\n#ifdef _KERNEL\n\n/*\n * packet information passed to the input function of tc elements\n */\nstruct cdnr_pktinfo {\n\tint\t\tpkt_len;\t/* packet length */\n\tu_int8_t\tpkt_dscp;\t/* diffserv code point */\n};\n\n/*\n * traffic conditioner control block common to all types of tc elements\n */\nstruct cdnr_block {\n\tLIST_ENTRY(cdnr_block)\tcb_next;\n\tint\t\tcb_len;\t\t/* size of this tc element */\n\tint\t\tcb_type;\t/* cdnr block type */\n\tint\t\tcb_ref;\t\t/* reference count of this element */\n\tu_long\t\tcb_handle;\t/* handle of this tc element */\n\tstruct top_cdnr *cb_top;\t/* back pointer to top */\n\tstruct tc_action cb_action;\t/* top level action for this tcb */\n\tstruct tc_action *(*cb_input)(struct cdnr_block *,\n\t\t\t\t      struct cdnr_pktinfo *);\n};\n\n/*\n * top level traffic conditioner structure for an interface\n */\nstruct top_cdnr {\n\tstruct cdnr_block\ttc_block;\n\n\tLIST_ENTRY(top_cdnr)\ttc_next;\n\tstruct ifaltq\t\t*tc_ifq;\n\n\tLIST_HEAD(, cdnr_block) tc_elements;\n#ifdef ALTQ3_CLFIER_COMPAT\n\tstruct acc_classifier\ttc_classifier;\n#endif\n\tstruct pktcntr\t\ttc_cnts[TCACODE_MAX+1];\n};\n\n/* token bucket element */\nstruct tbe {\n\tu_int64_t\trate;\n\tu_int64_t\tdepth;\n\n\tu_int64_t\ttoken;\n\tu_int64_t\tfilluptime;\n\tu_int64_t\tlast;\n};\n\n/* token bucket meter structure */\nstruct tbmeter {\n\tstruct cdnr_block\tcdnrblk;\t/* conditioner block */\n\tstruct tbe\t\ttb;\t\t/* token bucket */\n\tstruct tc_action\tin_action;\t/* actions for IN/OUT */\n\tstruct tc_action\tout_action;\t/* actions for IN/OUT */\n\tstruct pktcntr\t\tin_cnt;\t\t/* statistics for IN/OUT */\n\tstruct pktcntr\t\tout_cnt;\t/* statistics for IN/OUT */\n};\n\n/* two-rate three-color marker structure */\nstruct trtcm {\n\tstruct cdnr_block\tcdnrblk;\t/* conditioner block */\n\tstruct tbe\t\tcmtd_tb;\t/* committed tb profile */\n\tstruct tbe\t\tpeak_tb;\t/* peak tb profile */\n\tstruct tc_action\tgreen_action;\n\tstruct tc_action\tyellow_action;\n\tstruct tc_action\tred_action;\n\tint\t\t\tcoloraware;\n\tu_int8_t\t\tgreen_dscp;\n\tu_int8_t\t\tyellow_dscp;\n\tu_int8_t\t\tred_dscp;\n\tstruct pktcntr\t\tgreen_cnt;\n\tstruct pktcntr\t\tyellow_cnt;\n\tstruct pktcntr\t\tred_cnt;\n};\n\n/* time sliding window three-color marker structure */\nstruct tswtcm {\n\tstruct cdnr_block\tcdnrblk;\t/* conditioner block */\n\n\tu_int32_t\t\tavg_rate;\t/* average rate (bytes/sec) */\n\tu_int64_t\t\tt_front;\t/* timestamp of last update */\n\n\tu_int64_t\t\ttimewin;\t/* average interval */\n\tu_int32_t\t\tcmtd_rate;\t/* committed target rate */\n\tu_int32_t\t\tpeak_rate;\t/* peak target rate */\n\tstruct tc_action\tgreen_action;\n\tstruct tc_action\tyellow_action;\n\tstruct tc_action\tred_action;\n\tu_int8_t\t\tgreen_dscp;\n\tu_int8_t\t\tyellow_dscp;\n\tu_int8_t\t\tred_dscp;\n\tstruct pktcntr\t\tgreen_cnt;\n\tstruct pktcntr\t\tyellow_cnt;\n\tstruct pktcntr\t\tred_cnt;\n};\n\n#endif /* _KERNEL */\n\n#endif /* _ALTQ_ALTQ_CDNR_H_ */\n"
  },
  {
    "path": "freebsd-headers/altq/altq_classq.h",
    "content": "/*\t$KAME: altq_classq.h,v 1.6 2003/01/07 07:33:38 kjc Exp $\t*/\n\n/*\n * Copyright (c) 1991-1997 Regents of the University of California.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. All advertising materials mentioning features or use of this software\n *    must display the following acknowledgement:\n *\tThis product includes software developed by the Network Research\n *\tGroup at Lawrence Berkeley Laboratory.\n * 4. Neither the name of the University nor of the Laboratory may be used\n *    to endorse or promote products derived from this software without\n *    specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n */\n/*\n * class queue definitions extracted from rm_class.h.\n */\n#ifndef _ALTQ_ALTQ_CLASSQ_H_\n#define\t_ALTQ_ALTQ_CLASSQ_H_\n\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\n/*\n * Packet Queue types: RED or DROPHEAD.\n */\n#define\tQ_DROPHEAD\t0x00\n#define\tQ_RED\t\t0x01\n#define\tQ_RIO\t\t0x02\n#define\tQ_DROPTAIL\t0x03\n\n#ifdef _KERNEL\n\n/*\n * Packet Queue structures and macros to manipulate them.\n */\nstruct _class_queue_ {\n\tstruct mbuf\t*tail_;\t/* Tail of packet queue */\n\tint\tqlen_;\t\t/* Queue length (in number of packets) */\n\tint\tqlim_;\t\t/* Queue limit (in number of packets*) */\n\tint\tqtype_;\t\t/* Queue type */\n};\n\ntypedef struct _class_queue_\tclass_queue_t;\n\n#define\tqtype(q)\t(q)->qtype_\t\t/* Get queue type */\n#define\tqlimit(q)\t(q)->qlim_\t\t/* Max packets to be queued */\n#define\tqlen(q)\t\t(q)->qlen_\t\t/* Current queue length. */\n#define\tqtail(q)\t(q)->tail_\t\t/* Tail of the queue */\n#define\tqhead(q)\t((q)->tail_ ? (q)->tail_->m_nextpkt : NULL)\n\n#define\tqempty(q)\t((q)->qlen_ == 0)\t/* Is the queue empty?? */\n#define\tq_is_red(q)\t((q)->qtype_ == Q_RED)\t/* Is the queue a red queue */\n#define\tq_is_rio(q)\t((q)->qtype_ == Q_RIO)\t/* Is the queue a rio queue */\n#define\tq_is_red_or_rio(q)\t((q)->qtype_ == Q_RED || (q)->qtype_ == Q_RIO)\n\n#if !defined(__GNUC__) || defined(ALTQ_DEBUG)\n\nextern void\t\t_addq(class_queue_t *, struct mbuf *);\nextern struct mbuf\t*_getq(class_queue_t *);\nextern struct mbuf\t*_getq_tail(class_queue_t *);\nextern struct mbuf\t*_getq_random(class_queue_t *);\nextern void\t\t_removeq(class_queue_t *, struct mbuf *);\nextern void\t\t_flushq(class_queue_t *);\n\n#else /* __GNUC__ && !ALTQ_DEBUG */\n/*\n * inlined versions\n */\nstatic __inline void\n_addq(class_queue_t *q, struct mbuf *m)\n{\n        struct mbuf *m0;\n\n\tif ((m0 = qtail(q)) != NULL)\n\t\tm->m_nextpkt = m0->m_nextpkt;\n\telse\n\t\tm0 = m;\n\tm0->m_nextpkt = m;\n\tqtail(q) = m;\n\tqlen(q)++;\n}\n\nstatic __inline struct mbuf *\n_getq(class_queue_t *q)\n{\n\tstruct mbuf  *m, *m0;\n\n\tif ((m = qtail(q)) == NULL)\n\t\treturn (NULL);\n\tif ((m0 = m->m_nextpkt) != m)\n\t\tm->m_nextpkt = m0->m_nextpkt;\n\telse\n\t\tqtail(q) = NULL;\n\tqlen(q)--;\n\tm0->m_nextpkt = NULL;\n\treturn (m0);\n}\n\n/* drop a packet at the tail of the queue */\nstatic __inline struct mbuf *\n_getq_tail(class_queue_t *q)\n{\n\tstruct mbuf *m, *m0, *prev;\n\n\tif ((m = m0 = qtail(q)) == NULL)\n\t\treturn NULL;\n\tdo {\n\t\tprev = m0;\n\t\tm0 = m0->m_nextpkt;\n\t} while (m0 != m);\n\tprev->m_nextpkt = m->m_nextpkt;\n\tif (prev == m)\n\t\tqtail(q) = NULL;\n\telse\n\t\tqtail(q) = prev;\n\tqlen(q)--;\n\tm->m_nextpkt = NULL;\n\treturn (m);\n}\n\n/* randomly select a packet in the queue */\nstatic __inline struct mbuf *\n_getq_random(class_queue_t *q)\n{\n\tstruct mbuf *m;\n\tint i, n;\n\n\tif ((m = qtail(q)) == NULL)\n\t\treturn NULL;\n\tif (m->m_nextpkt == m)\n\t\tqtail(q) = NULL;\n\telse {\n\t\tstruct mbuf *prev = NULL;\n\n\t\tn = random() % qlen(q) + 1;\n\t\tfor (i = 0; i < n; i++) {\n\t\t\tprev = m;\n\t\t\tm = m->m_nextpkt;\n\t\t}\n\t\tprev->m_nextpkt = m->m_nextpkt;\n\t\tif (m == qtail(q))\n\t\t\tqtail(q) = prev;\n\t}\n\tqlen(q)--;\n\tm->m_nextpkt = NULL;\n\treturn (m);\n}\n\nstatic __inline void\n_removeq(class_queue_t *q, struct mbuf *m)\n{\n\tstruct mbuf *m0, *prev;\n\n\tm0 = qtail(q);\n\tdo {\n\t\tprev = m0;\n\t\tm0 = m0->m_nextpkt;\n\t} while (m0 != m);\n\tprev->m_nextpkt = m->m_nextpkt;\n\tif (prev == m)\n\t\tqtail(q) = NULL;\n\telse if (qtail(q) == m)\n\t\tqtail(q) = prev;\n\tqlen(q)--;\n}\n\nstatic __inline void\n_flushq(class_queue_t *q)\n{\n\tstruct mbuf *m;\n\n\twhile ((m = _getq(q)) != NULL)\n\t\tm_freem(m);\n}\n\n#endif /* __GNUC__ && !ALTQ_DEBUG */\n\n#endif /* _KERNEL */\n\n#ifdef __cplusplus\n}\n#endif\n\n#endif /* _ALTQ_ALTQ_CLASSQ_H_ */\n"
  },
  {
    "path": "freebsd-headers/altq/altq_hfsc.h",
    "content": "/*\t$KAME: altq_hfsc.h,v 1.12 2003/12/05 05:40:46 kjc Exp $\t*/\n\n/*\n * Copyright (c) 1997-1999 Carnegie Mellon University. All Rights Reserved.\n *\n * Permission to use, copy, modify, and distribute this software and\n * its documentation is hereby granted (including for commercial or\n * for-profit use), provided that both the copyright notice and this\n * permission notice appear in all copies of the software, derivative\n * works, or modified versions, and any portions thereof.\n *\n * THIS SOFTWARE IS EXPERIMENTAL AND IS KNOWN TO HAVE BUGS, SOME OF\n * WHICH MAY HAVE SERIOUS CONSEQUENCES.  CARNEGIE MELLON PROVIDES THIS\n * SOFTWARE IN ITS ``AS IS'' CONDITION, AND ANY EXPRESS OR IMPLIED\n * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES\n * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\n * DISCLAIMED.  IN NO EVENT SHALL CARNEGIE MELLON UNIVERSITY BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\n * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT\n * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR\n * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF\n * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE\n * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH\n * DAMAGE.\n *\n * Carnegie Mellon encourages (but does not require) users of this\n * software to return any improvements or extensions that they make,\n * and to grant Carnegie Mellon the rights to redistribute these\n * changes without encumbrance.\n */\n#ifndef _ALTQ_ALTQ_HFSC_H_\n#define\t_ALTQ_ALTQ_HFSC_H_\n\n#include <altq/altq.h>\n#include <altq/altq_classq.h>\n#include <altq/altq_red.h>\n#include <altq/altq_rio.h>\n\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\nstruct service_curve {\n\tu_int\tm1;\t/* slope of the first segment in bits/sec */\n\tu_int\td;\t/* the x-projection of the first segment in msec */\n\tu_int\tm2;\t/* slope of the second segment in bits/sec */\n};\n\n/* special class handles */\n#define\tHFSC_NULLCLASS_HANDLE\t0\n#define\tHFSC_MAX_CLASSES\t64\n\n/* hfsc class flags */\n#define\tHFCF_RED\t\t0x0001\t/* use RED */\n#define\tHFCF_ECN\t\t0x0002  /* use RED/ECN */\n#define\tHFCF_RIO\t\t0x0004  /* use RIO */\n#define\tHFCF_CLEARDSCP\t\t0x0010  /* clear diffserv codepoint */\n#define\tHFCF_DEFAULTCLASS\t0x1000\t/* default class */\n\n/* service curve types */\n#define\tHFSC_REALTIMESC\t\t1\n#define\tHFSC_LINKSHARINGSC\t2\n#define\tHFSC_UPPERLIMITSC\t4\n#define\tHFSC_DEFAULTSC\t\t(HFSC_REALTIMESC|HFSC_LINKSHARINGSC)\n\nstruct hfsc_classstats {\n\tu_int\t\t\tclass_id;\n\tu_int32_t\t\tclass_handle;\n\tstruct service_curve\trsc;\n\tstruct service_curve\tfsc;\n\tstruct service_curve\tusc;\t/* upper limit service curve */\n\n\tu_int64_t\t\ttotal;\t/* total work in bytes */\n\tu_int64_t\t\tcumul;\t/* cumulative work in bytes\n\t\t\t\t\t   done by real-time criteria */\n\tu_int64_t\t\td;\t\t/* deadline */\n\tu_int64_t\t\te;\t\t/* eligible time */\n\tu_int64_t\t\tvt;\t\t/* virtual time */\n\tu_int64_t\t\tf;\t\t/* fit time for upper-limit */\n\n\t/* info helpful for debugging */\n\tu_int64_t\t\tinitvt;\t\t/* init virtual time */\n\tu_int64_t\t\tvtoff;\t\t/* cl_vt_ipoff */\n\tu_int64_t\t\tcvtmax;\t\t/* cl_maxvt */\n\tu_int64_t\t\tmyf;\t\t/* cl_myf */\n\tu_int64_t\t\tcfmin;\t\t/* cl_mincf */\n\tu_int64_t\t\tcvtmin;\t\t/* cl_mincvt */\n\tu_int64_t\t\tmyfadj;\t\t/* cl_myfadj */\n\tu_int64_t\t\tvtadj;\t\t/* cl_vtadj */\n\tu_int64_t\t\tcur_time;\n\tu_int32_t\t\tmachclk_freq;\n\n\tu_int\t\t\tqlength;\n\tu_int\t\t\tqlimit;\n\tstruct pktcntr\t\txmit_cnt;\n\tstruct pktcntr\t\tdrop_cnt;\n\tu_int\t\t\tperiod;\n\n\tu_int\t\t\tvtperiod;\t/* vt period sequence no */\n\tu_int\t\t\tparentperiod;\t/* parent's vt period seqno */\n\tint\t\t\tnactive;\t/* number of active children */\n\n\t/* red and rio related info */\n\tint\t\t\tqtype;\n\tstruct redstats\t\tred[3];\n};\n\n#ifdef ALTQ3_COMPAT\nstruct hfsc_interface {\n\tchar\thfsc_ifname[IFNAMSIZ];  /* interface name (e.g., fxp0) */\n};\n\nstruct hfsc_attach {\n\tstruct hfsc_interface\tiface;\n\tu_int\t\t\tbandwidth;  /* link bandwidth in bits/sec */\n};\n\nstruct hfsc_add_class {\n\tstruct hfsc_interface\tiface;\n\tu_int32_t\t\tparent_handle;\n\tstruct service_curve\tservice_curve;\n\tint\t\t\tqlimit;\n\tint\t\t\tflags;\n\n\tu_int32_t\t\tclass_handle;  /* return value */\n};\n\nstruct hfsc_delete_class {\n\tstruct hfsc_interface\tiface;\n\tu_int32_t\t\tclass_handle;\n};\n\nstruct hfsc_modify_class {\n\tstruct hfsc_interface\tiface;\n\tu_int32_t\t\tclass_handle;\n\tstruct service_curve\tservice_curve;\n\tint\t\t\tsctype;\n};\n\nstruct hfsc_add_filter {\n\tstruct hfsc_interface\tiface;\n\tu_int32_t\t\tclass_handle;\n\tstruct flow_filter\tfilter;\n\n\tu_long\t\t\tfilter_handle;  /* return value */\n};\n\nstruct hfsc_delete_filter {\n\tstruct hfsc_interface\tiface;\n\tu_long\t\t\tfilter_handle;\n};\n\nstruct hfsc_class_stats {\n\tstruct hfsc_interface\tiface;\n\tint\t\t\tnskip;\t\t/* skip # of classes */\n\tint\t\t\tnclasses;\t/* # of class stats (WR) */\n\tu_int64_t\t\tcur_time;\t/* current time */\n\tu_int32_t\t\tmachclk_freq;\t/* machine clock frequency */\n\tu_int\t\t\thif_classes;\t/* # of classes in the tree */\n\tu_int\t\t\thif_packets;\t/* # of packets in the tree */\n\tstruct hfsc_classstats\t*stats;\t\t/* pointer to stats array */\n};\n\n#define\tHFSC_IF_ATTACH\t\t_IOW('Q', 1, struct hfsc_attach)\n#define\tHFSC_IF_DETACH\t\t_IOW('Q', 2, struct hfsc_interface)\n#define\tHFSC_ENABLE\t\t_IOW('Q', 3, struct hfsc_interface)\n#define\tHFSC_DISABLE\t\t_IOW('Q', 4, struct hfsc_interface)\n#define\tHFSC_CLEAR_HIERARCHY\t_IOW('Q', 5, struct hfsc_interface)\n#define\tHFSC_ADD_CLASS\t\t_IOWR('Q', 7, struct hfsc_add_class)\n#define\tHFSC_DEL_CLASS\t\t_IOW('Q', 8, struct hfsc_delete_class)\n#define\tHFSC_MOD_CLASS\t\t_IOW('Q', 9, struct hfsc_modify_class)\n#define\tHFSC_ADD_FILTER\t\t_IOWR('Q', 10, struct hfsc_add_filter)\n#define\tHFSC_DEL_FILTER\t\t_IOW('Q', 11, struct hfsc_delete_filter)\n#define\tHFSC_GETSTATS\t\t_IOWR('Q', 12, struct hfsc_class_stats)\n#endif /* ALTQ3_COMPAT */\n\n#ifdef _KERNEL\n/*\n * kernel internal service curve representation\n *\tcoordinates are given by 64 bit unsigned integers.\n *\tx-axis: unit is clock count.  for the intel x86 architecture,\n *\t\tthe raw Pentium TSC (Timestamp Counter) value is used.\n *\t\tvirtual time is also calculated in this time scale.\n *\ty-axis: unit is byte.\n *\n *\tthe service curve parameters are converted to the internal\n *\trepresentation.\n *\tthe slope values are scaled to avoid overflow.\n *\tthe inverse slope values as well as the y-projection of the 1st\n *\tsegment are kept in order to to avoid 64-bit divide operations\n *\tthat are expensive on 32-bit architectures.\n *\n *  note: Intel Pentium TSC never wraps around in several thousands of years.\n *\tx-axis doesn't wrap around for 1089 years with 1GHz clock.\n *      y-axis doesn't wrap around for 4358 years with 1Gbps bandwidth.\n */\n\n/* kernel internal representation of a service curve */\nstruct internal_sc {\n\tu_int64_t\tsm1;\t/* scaled slope of the 1st segment */\n\tu_int64_t\tism1;\t/* scaled inverse-slope of the 1st segment */\n\tu_int64_t\tdx;\t/* the x-projection of the 1st segment */\n\tu_int64_t\tdy;\t/* the y-projection of the 1st segment */\n\tu_int64_t\tsm2;\t/* scaled slope of the 2nd segment */\n\tu_int64_t\tism2;\t/* scaled inverse-slope of the 2nd segment */\n};\n\n/* runtime service curve */\nstruct runtime_sc {\n\tu_int64_t\tx;\t/* current starting position on x-axis */\n\tu_int64_t\ty;\t/* current starting position on x-axis */\n\tu_int64_t\tsm1;\t/* scaled slope of the 1st segment */\n\tu_int64_t\tism1;\t/* scaled inverse-slope of the 1st segment */\n\tu_int64_t\tdx;\t/* the x-projection of the 1st segment */\n\tu_int64_t\tdy;\t/* the y-projection of the 1st segment */\n\tu_int64_t\tsm2;\t/* scaled slope of the 2nd segment */\n\tu_int64_t\tism2;\t/* scaled inverse-slope of the 2nd segment */\n};\n\n/* for TAILQ based ellist and actlist implementation */\nstruct hfsc_class;\ntypedef TAILQ_HEAD(_eligible, hfsc_class) ellist_t;\ntypedef TAILQ_ENTRY(hfsc_class) elentry_t;\ntypedef TAILQ_HEAD(_active, hfsc_class) actlist_t;\ntypedef TAILQ_ENTRY(hfsc_class) actentry_t;\n#define\tellist_first(s)\t\tTAILQ_FIRST(s)\n#define\tactlist_first(s)\tTAILQ_FIRST(s)\n#define\tactlist_last(s)\t\tTAILQ_LAST(s, _active)\n\nstruct hfsc_class {\n\tu_int\t\tcl_id;\t\t/* class id (just for debug) */\n\tu_int32_t\tcl_handle;\t/* class handle */\n\tstruct hfsc_if\t*cl_hif;\t/* back pointer to struct hfsc_if */\n\tint\t\tcl_flags;\t/* misc flags */\n\n\tstruct hfsc_class *cl_parent;\t/* parent class */\n\tstruct hfsc_class *cl_siblings;\t/* sibling classes */\n\tstruct hfsc_class *cl_children;\t/* child classes */\n\n\tclass_queue_t\t*cl_q;\t\t/* class queue structure */\n\tstruct red\t*cl_red;\t/* RED state */\n\tstruct altq_pktattr *cl_pktattr; /* saved header used by ECN */\n\n\tu_int64_t\tcl_total;\t/* total work in bytes */\n\tu_int64_t\tcl_cumul;\t/* cumulative work in bytes\n\t\t\t\t\t   done by real-time criteria */\n\tu_int64_t\tcl_d;\t\t/* deadline */\n\tu_int64_t\tcl_e;\t\t/* eligible time */\n\tu_int64_t\tcl_vt;\t\t/* virtual time */\n\tu_int64_t\tcl_f;\t\t/* time when this class will fit for\n\t\t\t\t\t   link-sharing, max(myf, cfmin) */\n\tu_int64_t\tcl_myf;\t\t/* my fit-time (as calculated from this\n\t\t\t\t\t   class's own upperlimit curve) */\n\tu_int64_t\tcl_myfadj;\t/* my fit-time adjustment\n\t\t\t\t\t   (to cancel history dependence) */\n\tu_int64_t\tcl_cfmin;\t/* earliest children's fit-time (used\n\t\t\t\t\t   with cl_myf to obtain cl_f) */\n\tu_int64_t\tcl_cvtmin;\t/* minimal virtual time among the\n\t\t\t\t\t   children fit for link-sharing\n\t\t\t\t\t   (monotonic within a period) */\n\tu_int64_t\tcl_vtadj;\t/* intra-period cumulative vt\n\t\t\t\t\t   adjustment */\n\tu_int64_t\tcl_vtoff;\t/* inter-period cumulative vt offset */\n\tu_int64_t\tcl_cvtmax;\t/* max child's vt in the last period */\n\n\tu_int64_t\tcl_initvt;\t/* init virtual time (for debugging) */\n\n\tstruct internal_sc *cl_rsc;\t/* internal real-time service curve */\n\tstruct internal_sc *cl_fsc;\t/* internal fair service curve */\n\tstruct internal_sc *cl_usc;\t/* internal upperlimit service curve */\n\tstruct runtime_sc  cl_deadline;\t/* deadline curve */\n\tstruct runtime_sc  cl_eligible;\t/* eligible curve */\n\tstruct runtime_sc  cl_virtual;\t/* virtual curve */\n\tstruct runtime_sc  cl_ulimit;\t/* upperlimit curve */\n\n\tu_int\t\tcl_vtperiod;\t/* vt period sequence no */\n\tu_int\t\tcl_parentperiod;  /* parent's vt period seqno */\n\tint\t\tcl_nactive;\t/* number of active children */\n\tactlist_t\t*cl_actc;\t/* active children list */\n\n\tactentry_t\tcl_actlist;\t/* active children list entry */\n\telentry_t\tcl_ellist;\t/* eligible list entry */\n\n\tstruct {\n\t\tstruct pktcntr\txmit_cnt;\n\t\tstruct pktcntr\tdrop_cnt;\n\t\tu_int period;\n\t} cl_stats;\n};\n\n/*\n * hfsc interface state\n */\nstruct hfsc_if {\n\tstruct hfsc_if\t\t*hif_next;\t/* interface state list */\n\tstruct ifaltq\t\t*hif_ifq;\t/* backpointer to ifaltq */\n\tstruct hfsc_class\t*hif_rootclass;\t\t/* root class */\n\tstruct hfsc_class\t*hif_defaultclass;\t/* default class */\n\tstruct hfsc_class\t*hif_class_tbl[HFSC_MAX_CLASSES];\n\tstruct hfsc_class\t*hif_pollcache;\t/* cache for poll operation */\n\n\tu_int\thif_classes;\t\t\t/* # of classes in the tree */\n\tu_int\thif_packets;\t\t\t/* # of packets in the tree */\n\tu_int\thif_classid;\t\t\t/* class id sequence number */\n\n\tellist_t *hif_eligible;\t\t\t/* eligible list */\n\n#ifdef ALTQ3_CLFIER_COMPAT\n\tstruct acc_classifier\thif_classifier;\n#endif\n};\n\n#endif /* _KERNEL */\n\n#ifdef __cplusplus\n}\n#endif\n\n#endif /* _ALTQ_ALTQ_HFSC_H_ */\n"
  },
  {
    "path": "freebsd-headers/altq/altq_priq.h",
    "content": "/*\t$KAME: altq_priq.h,v 1.7 2003/10/03 05:05:15 kjc Exp $\t*/\n/*\n * Copyright (C) 2000-2003\n *\tSony Computer Science Laboratories Inc.  All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY SONY CSL AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL SONY CSL OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n */\n\n#ifndef _ALTQ_ALTQ_PRIQ_H_\n#define\t_ALTQ_ALTQ_PRIQ_H_\n\n#include <altq/altq.h>\n#include <altq/altq_classq.h>\n#include <altq/altq_red.h>\n#include <altq/altq_rio.h>\n\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\n#define\tPRIQ_MAXPRI\t16\t/* upper limit of the number of priorities */\n\n#ifdef ALTQ3_COMPAT\nstruct priq_interface {\n\tchar\tifname[IFNAMSIZ];\t/* interface name (e.g., fxp0) */\n\tu_long\targ;\t\t\t/* request-specific argument */\n};\n\nstruct priq_add_class {\n\tstruct priq_interface\tiface;\n\tint\t\t\tpri;\t/* priority (0 is the lowest) */\n\tint\t\t\tqlimit;\t/* queue size limit */\n\tint\t\t\tflags;\t/* misc flags (see below) */\n\n\tu_int32_t\t\tclass_handle;  /* return value */\n};\n#endif /* ALTQ3_COMPAT */\n\n/* priq class flags */\n#define\tPRCF_RED\t\t0x0001\t/* use RED */\n#define\tPRCF_ECN\t\t0x0002  /* use RED/ECN */\n#define\tPRCF_RIO\t\t0x0004  /* use RIO */\n#define\tPRCF_CLEARDSCP\t\t0x0010  /* clear diffserv codepoint */\n#define\tPRCF_DEFAULTCLASS\t0x1000\t/* default class */\n\n/* special class handles */\n#define\tPRIQ_NULLCLASS_HANDLE\t0\n\n#ifdef ALTQ3_COMPAT\nstruct priq_delete_class {\n\tstruct priq_interface\tiface;\n\tu_int32_t\t\tclass_handle;\n};\n\nstruct priq_modify_class {\n\tstruct priq_interface\tiface;\n\tu_int32_t\t\tclass_handle;\n\tint\t\t\tpri;\n\tint\t\t\tqlimit;\n\tint\t\t\tflags;\n};\n\nstruct priq_add_filter {\n\tstruct priq_interface\tiface;\n\tu_int32_t\t\tclass_handle;\n\tstruct flow_filter\tfilter;\n\n\tu_long\t\t\tfilter_handle;  /* return value */\n};\n\nstruct priq_delete_filter {\n\tstruct priq_interface\tiface;\n\tu_long\t\t\tfilter_handle;\n};\n#endif /* ALTQ3_COMPAT */\n\nstruct priq_classstats {\n\tu_int32_t\t\tclass_handle;\n\n\tu_int\t\t\tqlength;\n\tu_int\t\t\tqlimit;\n\tu_int\t\t\tperiod;\n\tstruct pktcntr\t\txmitcnt;  /* transmitted packet counter */\n\tstruct pktcntr\t\tdropcnt;  /* dropped packet counter */\n\n\t/* red and rio related info */\n\tint\t\t\tqtype;\n\tstruct redstats\t\tred[3];\t/* rio has 3 red stats */\n};\n\n#ifdef ALTQ3_COMPAT\nstruct priq_class_stats {\n\tstruct priq_interface\tiface;\n\tint\t\t\tmaxpri;\t  /* in/out */\n\n\tstruct priq_classstats\t*stats;   /* pointer to stats array */\n};\n\n#define\tPRIQ_IF_ATTACH\t\t_IOW('Q', 1, struct priq_interface)\n#define\tPRIQ_IF_DETACH\t\t_IOW('Q', 2, struct priq_interface)\n#define\tPRIQ_ENABLE\t\t_IOW('Q', 3, struct priq_interface)\n#define\tPRIQ_DISABLE\t\t_IOW('Q', 4, struct priq_interface)\n#define\tPRIQ_CLEAR\t\t_IOW('Q', 5, struct priq_interface)\n#define\tPRIQ_ADD_CLASS\t\t_IOWR('Q', 7, struct priq_add_class)\n#define\tPRIQ_DEL_CLASS\t\t_IOW('Q', 8, struct priq_delete_class)\n#define\tPRIQ_MOD_CLASS\t\t_IOW('Q', 9, struct priq_modify_class)\n#define\tPRIQ_ADD_FILTER\t\t_IOWR('Q', 10, struct priq_add_filter)\n#define\tPRIQ_DEL_FILTER\t\t_IOW('Q', 11, struct priq_delete_filter)\n#define\tPRIQ_GETSTATS\t\t_IOWR('Q', 12, struct priq_class_stats)\n\n#endif /* ALTQ3_COMPAT */\n\n#ifdef _KERNEL\n\nstruct priq_class {\n\tu_int32_t\tcl_handle;\t/* class handle */\n\tclass_queue_t\t*cl_q;\t\t/* class queue structure */\n\tstruct red\t*cl_red;\t/* RED state */\n\tint\t\tcl_pri;\t\t/* priority */\n\tint\t\tcl_flags;\t/* class flags */\n\tstruct priq_if\t*cl_pif;\t/* back pointer to pif */\n\tstruct altq_pktattr *cl_pktattr; /* saved header used by ECN */\n\n\t/* statistics */\n\tu_int\t\tcl_period;\t/* backlog period */\n\tstruct pktcntr  cl_xmitcnt;\t/* transmitted packet counter */\n\tstruct pktcntr  cl_dropcnt;\t/* dropped packet counter */\n};\n\n/*\n * priq interface state\n */\nstruct priq_if {\n\tstruct priq_if\t\t*pif_next;\t/* interface state list */\n\tstruct ifaltq\t\t*pif_ifq;\t/* backpointer to ifaltq */\n\tu_int\t\t\tpif_bandwidth;\t/* link bandwidth in bps */\n\tint\t\t\tpif_maxpri;\t/* max priority in use */\n\tstruct priq_class\t*pif_default;\t/* default class */\n\tstruct priq_class\t*pif_classes[PRIQ_MAXPRI]; /* classes */\n#ifdef ALTQ3_CLFIER_COMPAT\n\tstruct acc_classifier\tpif_classifier;\t/* classifier */\n#endif\n};\n\n#endif /* _KERNEL */\n\n#ifdef __cplusplus\n}\n#endif\n\n#endif /* _ALTQ_ALTQ_PRIQ_H_ */\n"
  },
  {
    "path": "freebsd-headers/altq/altq_red.h",
    "content": "/*\t$KAME: altq_red.h,v 1.8 2003/07/10 12:07:49 kjc Exp $\t*/\n\n/*\n * Copyright (C) 1997-2003\n *\tSony Computer Science Laboratories Inc.  All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY SONY CSL AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL SONY CSL OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n */\n\n#ifndef _ALTQ_ALTQ_RED_H_\n#define\t_ALTQ_ALTQ_RED_H_\n\n#include <altq/altq_classq.h>\n\n#ifdef ALTQ3_COMPAT\nstruct red_interface {\n\tchar\tred_ifname[IFNAMSIZ];\n};\n\nstruct red_stats {\n\tstruct red_interface iface;\n\tint q_len;\n\tint q_avg;\n\n\tstruct pktcntr\txmit_cnt;\n\tstruct pktcntr\tdrop_cnt;\n\tu_int\t\tdrop_forced;\n\tu_int\t\tdrop_unforced;\n\tu_int\t\tmarked_packets;\n\n\t/* static red parameters */\n\tint q_limit;\n\tint weight;\n\tint inv_pmax;\n\tint th_min;\n\tint th_max;\n\n\t/* flowvalve related stuff */\n\tu_int fv_flows;\n\tu_int fv_pass;\n\tu_int fv_predrop;\n\tu_int fv_alloc;\n\tu_int fv_escape;\n};\n\nstruct red_conf {\n\tstruct red_interface iface;\n\tint red_weight;\t\t/* weight for EWMA */\n\tint red_inv_pmax;\t/* inverse of max drop probability */\n\tint red_thmin;\t\t/* red min threshold */\n\tint red_thmax;\t\t/* red max threshold */\n\tint red_limit;\t\t/* max queue length */\n\tint red_pkttime;\t/* average packet time in usec */\n\tint red_flags;\t\t/* see below */\n};\n#endif /* ALTQ3_COMPAT */\n\n/* red flags */\n#define\tREDF_ECN4\t0x01\t/* use packet marking for IPv4 packets */\n#define\tREDF_ECN6\t0x02\t/* use packet marking for IPv6 packets */\n#define\tREDF_ECN\t(REDF_ECN4 | REDF_ECN6)\n#define\tREDF_FLOWVALVE\t0x04\t/* use flowvalve (aka penalty-box) */\n\n/*\n * simpler versions of red parameters and statistics used by other\n * disciplines (e.g., CBQ)\n */\nstruct redparams {\n\tint th_min;\t\t/* red min threshold */\n\tint th_max;\t\t/* red max threshold */\n\tint inv_pmax;\t\t/* inverse of max drop probability */\n};\n\nstruct redstats {\n\tint\t\tq_avg;\n\tstruct pktcntr\txmit_cnt;\n\tstruct pktcntr\tdrop_cnt;\n\tu_int\t\tdrop_forced;\n\tu_int\t\tdrop_unforced;\n\tu_int\t\tmarked_packets;\n};\n\n#ifdef ALTQ3_COMPAT\n/*\n * IOCTLs for RED\n */\n#define\tRED_IF_ATTACH\t\t_IOW('Q', 1, struct red_interface)\n#define\tRED_IF_DETACH\t\t_IOW('Q', 2, struct red_interface)\n#define\tRED_ENABLE\t\t_IOW('Q', 3, struct red_interface)\n#define\tRED_DISABLE\t\t_IOW('Q', 4, struct red_interface)\n#define\tRED_CONFIG\t\t_IOWR('Q', 6, struct red_conf)\n#define\tRED_GETSTATS\t\t_IOWR('Q', 12, struct red_stats)\n#define\tRED_SETDEFAULTS\t\t_IOW('Q', 30, struct redparams)\n#endif /* ALTQ3_COMPAT */\n\n#ifdef _KERNEL\n\n#ifdef ALTQ3_COMPAT\nstruct flowvalve;\n#endif\n\n/* weight table structure for idle time calibration */\nstruct wtab {\n\tstruct wtab\t*w_next;\n\tint\t\t w_weight;\n\tint\t\t w_param_max;\n\tint\t\t w_refcount;\n\tint32_t\t\t w_tab[32];\n};\n\ntypedef struct red {\n\tint\t\tred_pkttime;\t/* average packet time in micro sec\n\t\t\t\t\t   used for idle calibration */\n\tint\t\tred_flags;\t/* red flags */\n\n\t/* red parameters */\n\tint\t\tred_weight;\t/* weight for EWMA */\n\tint\t\tred_inv_pmax;\t/* inverse of max drop probability */\n\tint\t\tred_thmin;\t/* red min threshold */\n\tint\t\tred_thmax;\t/* red max threshold */\n\n\t/* variables for internal use */\n\tint\t\tred_wshift;\t/* log(red_weight) */\n\tint\t\tred_thmin_s;\t/* th_min scaled by avgshift */\n\tint\t\tred_thmax_s;\t/* th_max scaled by avgshift */\n\tint\t\tred_probd;\t/* drop probability denominator */\n\n\tint\t\tred_avg;\t/* queue len avg scaled by avgshift */\n\tint\t\tred_count;\t/* packet count since last dropped/\n\t\t\t\t\t   marked packet */\n\tint\t\tred_idle;\t/* queue was empty */\n\tint\t\tred_old;\t/* avg is above th_min */\n\tstruct wtab\t*red_wtab;\t/* weight table */\n\tstruct timeval\t red_last;\t/* time when the queue becomes idle */\n\n#ifdef ALTQ3_COMPAT\n\tstruct flowvalve *red_flowvalve;\t/* flowvalve state */\n#endif\n\n\tstruct {\n\t\tstruct pktcntr\txmit_cnt;\n\t\tstruct pktcntr\tdrop_cnt;\n\t\tu_int\t\tdrop_forced;\n\t\tu_int\t\tdrop_unforced;\n\t\tu_int\t\tmarked_packets;\n\t} red_stats;\n} red_t;\n\n#ifdef ALTQ3_COMPAT\ntypedef struct red_queue {\n\tstruct red_queue *rq_next;\t/* next red_state in the list */\n\tstruct ifaltq *rq_ifq;\t\t/* backpointer to ifaltq */\n\n\tclass_queue_t *rq_q;\n\n\tred_t *rq_red;\n} red_queue_t;\n#endif /* ALTQ3_COMPAT */\n\n/* red drop types */\n#define\tDTYPE_NODROP\t0\t/* no drop */\n#define\tDTYPE_FORCED\t1\t/* a \"forced\" drop */\n#define\tDTYPE_EARLY\t2\t/* an \"unforced\" (early) drop */\n\nextern red_t\t\t*red_alloc(int, int, int, int, int, int);\nextern void\t\t red_destroy(red_t *);\nextern void\t\t red_getstats(red_t *, struct redstats *);\nextern int\t\t red_addq(red_t *, class_queue_t *, struct mbuf *,\n\t\t\t     struct altq_pktattr *);\nextern struct mbuf\t*red_getq(red_t *, class_queue_t *);\nextern int\t\t drop_early(int, int, int);\nextern int\t\t mark_ecn(struct mbuf *, struct altq_pktattr *, int);\nextern struct wtab\t*wtab_alloc(int);\nextern int\t\t wtab_destroy(struct wtab *);\nextern int32_t\t\t pow_w(struct wtab *, int);\n\n#endif /* _KERNEL */\n\n#endif /* _ALTQ_ALTQ_RED_H_ */\n"
  },
  {
    "path": "freebsd-headers/altq/altq_rio.h",
    "content": "/*\t$KAME: altq_rio.h,v 1.9 2003/07/10 12:07:49 kjc Exp $\t*/\n\n/*\n * Copyright (C) 1998-2003\n *\tSony Computer Science Laboratories Inc.  All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY SONY CSL AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL SONY CSL OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n */\n\n#ifndef _ALTQ_ALTQ_RIO_H_\n#define\t_ALTQ_ALTQ_RIO_H_\n\n#include <altq/altq_classq.h>\n\n/*\n * RIO: RED with IN/OUT bit\n * (extended to support more than 2 drop precedence values)\n */\n#define\tRIO_NDROPPREC\t3\t/* number of drop precedence values */\n\n#ifdef ALTQ3_COMPAT\nstruct rio_interface {\n\tchar\trio_ifname[IFNAMSIZ];\n};\n\nstruct rio_stats {\n\tstruct rio_interface iface;\n\tint q_len[RIO_NDROPPREC];\n\tstruct redstats q_stats[RIO_NDROPPREC];\n\n\t/* static red parameters */\n\tint q_limit;\n\tint weight;\n\tint flags;\n\tstruct redparams q_params[RIO_NDROPPREC];\n};\n\nstruct rio_conf {\n\tstruct rio_interface iface;\n\tstruct redparams q_params[RIO_NDROPPREC];\n\tint rio_weight;\t\t/* weight for EWMA */\n\tint rio_limit;\t\t/* max queue length */\n\tint rio_pkttime;\t/* average packet time in usec */\n\tint rio_flags;\t\t/* see below */\n};\n#endif /* ALTQ3_COMPAT */\n\n/* rio flags */\n#define\tRIOF_ECN4\t0x01\t/* use packet marking for IPv4 packets */\n#define\tRIOF_ECN6\t0x02\t/* use packet marking for IPv6 packets */\n#define\tRIOF_ECN\t(RIOF_ECN4 | RIOF_ECN6)\n#define\tRIOF_CLEARDSCP\t0x200\t/* clear diffserv codepoint */\n\n#ifdef ALTQ3_COMPAT\n/*\n * IOCTLs for RIO\n */\n#define\tRIO_IF_ATTACH\t\t_IOW('Q', 1, struct rio_interface)\n#define\tRIO_IF_DETACH\t\t_IOW('Q', 2, struct rio_interface)\n#define\tRIO_ENABLE\t\t_IOW('Q', 3, struct rio_interface)\n#define\tRIO_DISABLE\t\t_IOW('Q', 4, struct rio_interface)\n#define\tRIO_CONFIG\t\t_IOWR('Q', 6, struct rio_conf)\n#define\tRIO_GETSTATS\t\t_IOWR('Q', 12, struct rio_stats)\n#define\tRIO_SETDEFAULTS\t\t_IOW('Q', 30, struct redparams[RIO_NDROPPREC])\n#endif /* ALTQ3_COMPAT */\n\n#ifdef _KERNEL\n\ntypedef struct rio {\n\t/* per drop precedence structure */\n\tstruct dropprec_state {\n\t\t/* red parameters */\n\t\tint\tinv_pmax;\t/* inverse of max drop probability */\n\t\tint\tth_min;\t\t/* red min threshold */\n\t\tint\tth_max;\t\t/* red max threshold */\n\n\t\t/* variables for internal use */\n\t\tint\tth_min_s;\t/* th_min scaled by avgshift */\n\t\tint\tth_max_s;\t/* th_max scaled by avgshift */\n\t\tint\tprobd;\t\t/* drop probability denominator */\n\n\t\tint\tqlen;\t\t/* queue length */\n\t\tint\tavg;\t\t/* (scaled) queue length average */\n\t\tint\tcount;\t\t/* packet count since the last dropped/\n\t\t\t\t\t   marked packet */\n\t\tint\tidle;\t\t/* queue was empty */\n\t\tint\told;\t\t/* avg is above th_min */\n\t\tstruct timeval\tlast;\t/* timestamp when queue becomes idle */\n\t} rio_precstate[RIO_NDROPPREC];\n\n\tint\t\t rio_wshift;\t/* log(red_weight) */\n\tint\t\t rio_weight;\t/* weight for EWMA */\n\tstruct wtab\t*rio_wtab;\t/* weight table */\n\n\tint\t\t rio_pkttime;\t/* average packet time in micro sec\n\t\t\t\t\t   used for idle calibration */\n\tint\t\t rio_flags;\t/* rio flags */\n\n\tu_int8_t\t rio_codepoint;\t/* codepoint value to tag packets */\n\tu_int8_t\t rio_codepointmask;\t/* codepoint mask bits */\n\n\tstruct redstats q_stats[RIO_NDROPPREC];\t/* statistics */\n} rio_t;\n\n#ifdef ALTQ3_COMPAT\ntypedef struct rio_queue {\n\tstruct rio_queue\t*rq_next;\t/* next red_state in the list */\n\tstruct ifaltq\t\t*rq_ifq;\t/* backpointer to ifaltq */\n\n\tclass_queue_t\t\t*rq_q;\n\n\trio_t\t\t\t*rq_rio;\n} rio_queue_t;\n#endif /* ALTQ3_COMPAT */\n\nextern rio_t\t\t*rio_alloc(int, struct redparams *, int, int);\nextern void\t\t rio_destroy(rio_t *);\nextern void\t\t rio_getstats(rio_t *, struct redstats *);\nextern int\t\t rio_addq(rio_t *, class_queue_t *, struct mbuf *,\n\t\t\t     struct altq_pktattr *);\nextern struct mbuf\t*rio_getq(rio_t *, class_queue_t *);\n\n#endif /* _KERNEL */\n\n#endif /* _ALTQ_ALTQ_RIO_H_ */\n"
  },
  {
    "path": "freebsd-headers/altq/altq_rmclass.h",
    "content": "/*\t$KAME: altq_rmclass.h,v 1.10 2003/08/20 23:30:23 itojun Exp $\t*/\n\n/*\n * Copyright (c) 1991-1997 Regents of the University of California.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. All advertising materials mentioning features or use of this software\n *    must display the following acknowledgement:\n *\tThis product includes software developed by the Network Research\n *\tGroup at Lawrence Berkeley Laboratory.\n * 4. Neither the name of the University nor of the Laboratory may be used\n *    to endorse or promote products derived from this software without\n *    specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n */\n\n#ifndef _ALTQ_ALTQ_RMCLASS_H_\n#define\t_ALTQ_ALTQ_RMCLASS_H_\n\n#include <altq/altq_classq.h>\n\n/* #pragma ident \"@(#)rm_class.h  1.20     97/10/23 SMI\" */\n\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\n#define\tRM_MAXPRIO\t8\t/* Max priority */\n\n#ifdef _KERNEL\n\ntypedef struct mbuf\t\tmbuf_t;\ntypedef struct rm_ifdat\t\trm_ifdat_t;\ntypedef struct rm_class\t\trm_class_t;\n\nstruct red;\n\n/*\n * Macros for dealing with time values.  We assume all times are\n * 'timevals'.  `microtime' is used to get the best available clock\n * resolution.  If `microtime' *doesn't* return a value that's about\n * ten times smaller than the average packet time on the fastest\n * link that will use these routines, a slightly different clock\n * scheme than this one should be used.\n * (Bias due to truncation error in this scheme will overestimate utilization\n * and discriminate against high bandwidth classes.  To remove this bias an\n * integrator needs to be added.  The simplest integrator uses a history of\n * 10 * avg.packet.time / min.tick.time packet completion entries.  This is\n * straight forward to add but we don't want to pay the extra memory\n * traffic to maintain it if it's not necessary (occasionally a vendor\n * accidentally builds a workstation with a decent clock - e.g., Sun & HP).)\n */\n\n#define\tRM_GETTIME(now) microtime(&now)\n\n#define\tTV_LT(a, b) (((a)->tv_sec < (b)->tv_sec) ||  \\\n\t(((a)->tv_usec < (b)->tv_usec) && ((a)->tv_sec <= (b)->tv_sec)))\n\n#define\tTV_DELTA(a, b, delta) { \\\n\tregister int\txxs;\t\\\n\t\t\t\t\t\t\t\\\n\tdelta = (a)->tv_usec - (b)->tv_usec; \\\n\tif ((xxs = (a)->tv_sec - (b)->tv_sec)) { \\\n\t\tswitch (xxs) { \\\n\t\tdefault: \\\n\t\t\t/* if (xxs < 0) \\\n\t\t\t\tprintf(\"rm_class: bogus time values\\n\"); */ \\\n\t\t\tdelta = 0; \\\n\t\t\t/* fall through */ \\\n\t\tcase 2: \\\n\t\t\tdelta += 1000000; \\\n\t\t\t/* fall through */ \\\n\t\tcase 1: \\\n\t\t\tdelta += 1000000; \\\n\t\t\tbreak; \\\n\t\t} \\\n\t} \\\n}\n\n#define\tTV_ADD_DELTA(a, delta, res) { \\\n\tregister int xxus = (a)->tv_usec + (delta); \\\n\t\\\n\t(res)->tv_sec = (a)->tv_sec; \\\n\twhile (xxus >= 1000000) { \\\n\t\t++((res)->tv_sec); \\\n\t\txxus -= 1000000; \\\n\t} \\\n\t(res)->tv_usec = xxus; \\\n}\n\n#define\tRM_TIMEOUT\t2\t/* 1 Clock tick. */\n\n#if 1\n#define\tRM_MAXQUEUED\t1\t/* this isn't used in ALTQ/CBQ */\n#else\n#define\tRM_MAXQUEUED\t16\t/* Max number of packets downstream of CBQ */\n#endif\n#define\tRM_MAXQUEUE\t64\t/* Max queue length */\n#define\tRM_FILTER_GAIN\t5\t/* log2 of gain, e.g., 5 => 31/32 */\n#define\tRM_POWER\t(1 << RM_FILTER_GAIN)\n#define\tRM_MAXDEPTH\t32\n#define\tRM_NS_PER_SEC\t(1000000000)\n\ntypedef struct _rm_class_stats_ {\n\tu_int\t\thandle;\n\tu_int\t\tdepth;\n\n\tstruct pktcntr\txmit_cnt;\t/* packets sent in this class */\n\tstruct pktcntr\tdrop_cnt;\t/* dropped packets */\n\tu_int\t\tover;\t\t/* # times went over limit */\n\tu_int\t\tborrows;\t/* # times tried to borrow */\n\tu_int\t\toveractions;\t/* # times invoked overlimit action */\n\tu_int\t\tdelays;\t\t/* # times invoked delay actions */\n} rm_class_stats_t;\n\n/*\n * CBQ Class state structure\n */\nstruct rm_class {\n\tclass_queue_t\t*q_;\t\t/* Queue of packets */\n\trm_ifdat_t\t*ifdat_;\n\tint\t\tpri_;\t\t/* Class priority. */\n\tint\t\tdepth_;\t\t/* Class depth */\n\tu_int\t\tns_per_byte_;\t/* NanoSeconds per byte. */\n\tu_int\t\tmaxrate_;\t/* Bytes per second for this class. */\n\tu_int\t\tallotment_;\t/* Fraction of link bandwidth. */\n\tu_int\t\tw_allotment_;\t/* Weighted allotment for WRR */\n\tint\t\tbytes_alloc_;\t/* Allocation for round of WRR */\n\n\tint\t\tavgidle_;\n\tint\t\tmaxidle_;\n\tint\t\tminidle_;\n\tint\t\tofftime_;\n\tint\t\tsleeping_;\t/* != 0 if delaying */\n\tint\t\tqthresh_;\t/* Queue threshold for formal link sharing */\n\tint\t\tleaf_;\t\t/* Note whether leaf class or not.*/\n\n\trm_class_t\t*children_;\t/* Children of this class */\n\trm_class_t\t*next_;\t\t/* Next pointer, used if child */\n\n\trm_class_t\t*peer_;\t\t/* Peer class */\n\trm_class_t\t*borrow_;\t/* Borrow class */\n\trm_class_t\t*parent_;\t/* Parent class */\n\n\tvoid\t(*overlimit)(struct rm_class *, struct rm_class *);\n\tvoid\t(*drop)(struct rm_class *);       /* Class drop action. */\n\n\tstruct red\t*red_;\t\t/* RED state pointer */\n\tstruct altq_pktattr *pktattr_;\t/* saved hdr used by RED/ECN */\n\tint\t\tflags_;\n\n\tint\t\tlast_pkttime_;\t/* saved pkt_time */\n\tstruct timeval\tundertime_;\t/* time can next send */\n\tstruct timeval\tlast_;\t\t/* time last packet sent */\n\tstruct timeval\tovertime_;\n\tstruct callout\tcallout_; \t/* for timeout() calls */\n\n\trm_class_stats_t stats_;\t/* Class Statistics */\n};\n\n/*\n * CBQ Interface state\n */\nstruct rm_ifdat {\n\tint\t\tqueued_;\t/* # pkts queued downstream */\n\tint\t\tefficient_;\t/* Link Efficency bit */\n\tint\t\twrr_;\t\t/* Enable Weighted Round-Robin */\n\tu_long\t\tns_per_byte_;\t/* Link byte speed. */\n\tint\t\tmaxqueued_;\t/* Max packets to queue */\n\tint\t\tmaxpkt_;\t/* Max packet size. */\n\tint\t\tqi_;\t\t/* In/out pointers for downstream */\n\tint\t\tqo_;\t\t/* packets */\n\n\t/*\n\t * Active class state and WRR state.\n\t */\n\trm_class_t\t*active_[RM_MAXPRIO];\t/* Active cl's in each pri */\n\tint\t\tna_[RM_MAXPRIO];\t/* # of active cl's in a pri */\n\tint\t\tnum_[RM_MAXPRIO];\t/* # of cl's per pri */\n\tint\t\talloc_[RM_MAXPRIO];\t/* Byte Allocation */\n\tu_long\t\tM_[RM_MAXPRIO];\t\t/* WRR weights. */\n\n\t/*\n\t * Network Interface/Solaris Queue state pointer.\n\t */\n\tstruct ifaltq\t*ifq_;\n\trm_class_t\t*default_;\t/* Default Pkt class, BE */\n\trm_class_t\t*root_;\t\t/* Root Link class. */\n\trm_class_t\t*ctl_;\t\t/* Control Traffic class. */\n\tvoid\t\t(*restart)(struct ifaltq *);\t/* Restart routine. */\n\n\t/*\n\t * Current packet downstream packet state and dynamic state.\n\t */\n\trm_class_t\t*borrowed_[RM_MAXQUEUED]; /* Class borrowed last */\n\trm_class_t\t*class_[RM_MAXQUEUED];\t/* class sending */\n\tint\t\tcurlen_[RM_MAXQUEUED];\t/* Current pktlen */\n\tstruct timeval\tnow_[RM_MAXQUEUED];\t/* Current packet time. */\n\tint\t\tis_overlimit_[RM_MAXQUEUED];/* Current packet time. */\n\n\tint\t\tcutoff_;\t/* Cut-off depth for borrowing */\n\n\tstruct timeval\tifnow_;\t\t/* expected xmit completion time */\n#if 1 /* ALTQ4PPP */\n\tint\t\tmaxiftime_;\t/* max delay inside interface */\n#endif\n        rm_class_t\t*pollcache_;\t/* cached rm_class by poll operation */\n};\n\n/* flags for rmc_init and rmc_newclass */\n/* class flags */\n#define\tRMCF_RED\t\t0x0001\n#define\tRMCF_ECN\t\t0x0002\n#define\tRMCF_RIO\t\t0x0004\n#define\tRMCF_FLOWVALVE\t\t0x0008\t/* use flowvalve (aka penalty-box) */\n#define\tRMCF_CLEARDSCP\t\t0x0010  /* clear diffserv codepoint */\n\n/* flags for rmc_init */\n#define\tRMCF_WRR\t\t0x0100\n#define\tRMCF_EFFICIENT\t\t0x0200\n\n#define\tis_a_parent_class(cl)\t((cl)->children_ != NULL)\n\nextern rm_class_t *rmc_newclass(int, struct rm_ifdat *, u_int,\n\t\t\t\tvoid (*)(struct rm_class *, struct rm_class *),\n\t\t\t\tint, struct rm_class *, struct rm_class *,\n\t\t\t\tu_int, int, u_int, int, int);\nextern void\trmc_delete_class(struct rm_ifdat *, struct rm_class *);\nextern int \trmc_modclass(struct rm_class *, u_int, int,\n\t\t\t     u_int, int, u_int, int);\nextern void\trmc_init(struct ifaltq *, struct rm_ifdat *, u_int,\n\t\t\t void (*)(struct ifaltq *),\n\t\t\t int, int, u_int, int, u_int, int);\nextern int\trmc_queue_packet(struct rm_class *, mbuf_t *);\nextern mbuf_t\t*rmc_dequeue_next(struct rm_ifdat *, int);\nextern void\trmc_update_class_util(struct rm_ifdat *);\nextern void\trmc_delay_action(struct rm_class *, struct rm_class *);\nextern void\trmc_dropall(struct rm_class *);\nextern int\trmc_get_weight(struct rm_ifdat *, int);\n\n#endif /* _KERNEL */\n\n#ifdef __cplusplus\n}\n#endif\n\n#endif /* _ALTQ_ALTQ_RMCLASS_H_ */\n"
  },
  {
    "path": "freebsd-headers/altq/altq_rmclass_debug.h",
    "content": "/*\t$KAME: altq_rmclass_debug.h,v 1.3 2002/11/29 04:36:24 kjc Exp $\t*/\n\n/*\n * Copyright (c) Sun Microsystems, Inc. 1998 All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n *\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n *\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * 3. All advertising materials mentioning features or use of this software\n *    must display the following acknowledgement:\n *      This product includes software developed by the SMCC Technology\n *      Development Group at Sun Microsystems, Inc.\n *\n * 4. The name of the Sun Microsystems, Inc nor may not be used to endorse or\n *      promote products derived from this software without specific prior\n *      written permission.\n *\n * SUN MICROSYSTEMS DOES NOT CLAIM MERCHANTABILITY OF THIS SOFTWARE OR THE\n * SUITABILITY OF THIS SOFTWARE FOR ANY PARTICULAR PURPOSE.  The software is\n * provided \"as is\" without express or implied warranty of any kind.\n *\n * These notices must be retained in any copies of any part of this software.\n */\n\n#ifndef _ALTQ_ALTQ_RMCLASS_DEBUG_H_\n#define\t_ALTQ_ALTQ_RMCLASS_DEBUG_H_\n\n/* #pragma ident\t\"@(#)rm_class_debug.h\t1.7\t98/05/04 SMI\" */\n\n/*\n * Cbq debugging macros\n */\n\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\n#ifdef\tCBQ_TRACE\n#ifndef NCBQTRACE\n#define\tNCBQTRACE (16 * 1024)\n#endif\n\n/*\n * To view the trace output, using adb, type:\n *\tadb -k /dev/ksyms /dev/mem <cr>, then type\n *\tcbqtrace_count/D to get the count, then type\n *\tcbqtrace_buffer,0tcount/Dp4C\" \"Xn\n *\tThis will dump the trace buffer from 0 to count.\n */\n/*\n * in ALTQ, \"call cbqtrace_dump(N)\" from DDB to display 20 events\n * from Nth event in the circular buffer.\n */\n\nstruct cbqtrace {\n\tint count;\n\tint function;\t\t/* address of function */\n\tint trace_action;\t/* descriptive 4 characters */\n\tint object;\t\t/* object operated on */\n};\n\nextern struct cbqtrace cbqtrace_buffer[];\nextern struct cbqtrace *cbqtrace_ptr;\nextern int cbqtrace_count;\n\n#define\tCBQTRACEINIT() {\t\t\t\t\\\n\tif (cbqtrace_ptr == NULL)\t\t\\\n\t\tcbqtrace_ptr = cbqtrace_buffer; \\\n\telse { \\\n\t\tcbqtrace_ptr = cbqtrace_buffer; \\\n\t\tbzero((void *)cbqtrace_ptr, sizeof(cbqtrace_buffer)); \\\n\t\tcbqtrace_count = 0; \\\n\t} \\\n}\n\n#define\tLOCK_TRACE()\tsplimp()\n#define\tUNLOCK_TRACE(x)\tsplx(x)\n\n#define\tCBQTRACE(func, act, obj) {\t\t\\\n\tint __s = LOCK_TRACE();\t\t\t\\\n\tint *_p = &cbqtrace_ptr->count;\t\\\n\t*_p++ = ++cbqtrace_count;\t\t\\\n\t*_p++ = (int)(func);\t\t\t\\\n\t*_p++ = (int)(act);\t\t\t\\\n\t*_p++ = (int)(obj);\t\t\t\\\n\tif ((struct cbqtrace *)(void *)_p >= &cbqtrace_buffer[NCBQTRACE])\\\n\t\tcbqtrace_ptr = cbqtrace_buffer; \\\n\telse\t\t\t\t\t\\\n\t\tcbqtrace_ptr = (struct cbqtrace *)(void *)_p; \\\n\tUNLOCK_TRACE(__s);\t\t\t\\\n\t}\n#else\n\n/* If no tracing, define no-ops */\n#define\tCBQTRACEINIT()\n#define\tCBQTRACE(a, b, c)\n\n#endif\t/* !CBQ_TRACE */\n\n#ifdef __cplusplus\n}\n#endif\n\n#endif\t/* _ALTQ_ALTQ_RMCLASS_DEBUG_H_ */\n"
  },
  {
    "path": "freebsd-headers/altq/altq_var.h",
    "content": "/*\t$FreeBSD: release/9.0.0/sys/contrib/altq/altq/altq_var.h 219457 2011-03-10 18:49:15Z jkim $\t*/\n/*\t$KAME: altq_var.h,v 1.16 2003/10/03 05:05:15 kjc Exp $\t*/\n\n/*\n * Copyright (C) 1998-2003\n *\tSony Computer Science Laboratories Inc.  All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY SONY CSL AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL SONY CSL OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n */\n#ifndef _ALTQ_ALTQ_VAR_H_\n#define\t_ALTQ_ALTQ_VAR_H_\n\n#ifdef _KERNEL\n\n#include <sys/param.h>\n#include <sys/kernel.h>\n#include <sys/queue.h>\n\n#ifdef ALTQ3_CLFIER_COMPAT\n/*\n * filter structure for altq common classifier\n */\nstruct acc_filter {\n\tLIST_ENTRY(acc_filter)\tf_chain;\n\tvoid\t\t\t*f_class;\t/* pointer to the class */\n\tu_long\t\t\tf_handle;\t/* filter id */\n\tu_int32_t\t\tf_fbmask;\t/* filter bitmask */\n\tstruct flow_filter\tf_filter;\t/* filter value */\n};\n\n/*\n * XXX ACC_FILTER_TABLESIZE can't be larger than 2048 unless we fix\n * the handle assignment.\n */\n#define\tACC_FILTER_TABLESIZE\t(256+1)\n#define\tACC_FILTER_MASK\t\t(ACC_FILTER_TABLESIZE - 2)\n#define\tACC_WILDCARD_INDEX\t(ACC_FILTER_TABLESIZE - 1)\n#ifdef __GNUC__\n#define\tACC_GET_HASH_INDEX(addr) \\\n\t({int x = (addr) + ((addr) >> 16); (x + (x >> 8)) & ACC_FILTER_MASK;})\n#else\n#define\tACC_GET_HASH_INDEX(addr) \\\n\t(((addr) + ((addr) >> 8) + ((addr) >> 16) + ((addr) >> 24)) \\\n\t& ACC_FILTER_MASK)\n#endif\n#define\tACC_GET_HINDEX(handle) ((handle) >> 20)\n\n#if (__FreeBSD_version > 500000)\n#define ACC_LOCK_INIT(ac)\tmtx_init(&(ac)->acc_mtx, \"classifier\", MTX_DEF)\n#define ACC_LOCK_DESTROY(ac)\tmtx_destroy(&(ac)->acc_mtx)\n#define ACC_LOCK(ac)\t\tmtx_lock(&(ac)->acc_mtx)\n#define ACC_UNLOCK(ac)\t\tmtx_unlock(&(ac)->acc_mtx)\n#else\n#define ACC_LOCK_INIT(ac)\n#define ACC_LOCK_DESTROY(ac)\n#define ACC_LOCK(ac)\n#define ACC_UNLOCK(ac)\n#endif\n\nstruct acc_classifier {\n\tu_int32_t\t\t\tacc_fbmask;\n\tLIST_HEAD(filt, acc_filter)\tacc_filters[ACC_FILTER_TABLESIZE];\n\n#if (__FreeBSD_version > 500000)\n\tstruct\tmtx acc_mtx;\n#endif\n};\n\n/*\n * flowinfo mask bits used by classifier\n */\n/* for ipv4 */\n#define\tFIMB4_PROTO\t0x0001\n#define\tFIMB4_TOS\t0x0002\n#define\tFIMB4_DADDR\t0x0004\n#define\tFIMB4_SADDR\t0x0008\n#define\tFIMB4_DPORT\t0x0010\n#define\tFIMB4_SPORT\t0x0020\n#define\tFIMB4_GPI\t0x0040\n#define\tFIMB4_ALL\t0x007f\n/* for ipv6 */\n#define\tFIMB6_PROTO\t0x0100\n#define\tFIMB6_TCLASS\t0x0200\n#define\tFIMB6_DADDR\t0x0400\n#define\tFIMB6_SADDR\t0x0800\n#define\tFIMB6_DPORT\t0x1000\n#define\tFIMB6_SPORT\t0x2000\n#define\tFIMB6_GPI\t0x4000\n#define\tFIMB6_FLABEL\t0x8000\n#define\tFIMB6_ALL\t0xff00\n\n#define\tFIMB_ALL\t(FIMB4_ALL|FIMB6_ALL)\n\n#define\tFIMB4_PORTS\t(FIMB4_DPORT|FIMB4_SPORT|FIMB4_GPI)\n#define\tFIMB6_PORTS\t(FIMB6_DPORT|FIMB6_SPORT|FIMB6_GPI)\n#endif /* ALTQ3_CLFIER_COMPAT */\n\n/*\n * machine dependent clock\n * a 64bit high resolution time counter.\n */\nextern int machclk_usepcc;\nextern u_int32_t machclk_freq;\nextern u_int32_t machclk_per_tick;\nextern void init_machclk(void);\nextern u_int64_t read_machclk(void);\n\n/*\n * debug support\n */\n#ifdef ALTQ_DEBUG\n#ifdef __STDC__\n#define\tASSERT(e)\t((e) ? (void)0 : altq_assert(__FILE__, __LINE__, #e))\n#else\t/* PCC */\n#define\tASSERT(e)\t((e) ? (void)0 : altq_assert(__FILE__, __LINE__, \"e\"))\n#endif\n#else\n#define\tASSERT(e)\t((void)0)\n#endif\n\n/*\n * misc stuff for compatibility\n */\n/* ioctl cmd type */\ntypedef u_long ioctlcmd_t;\n\n/*\n * queue macros:\n * the interface of TAILQ_LAST macro changed after the introduction\n * of softupdate. redefine it here to make it work with pre-2.2.7.\n */\n#undef TAILQ_LAST\n#define\tTAILQ_LAST(head, headname) \\\n\t(*(((struct headname *)((head)->tqh_last))->tqh_last))\n\n#ifndef TAILQ_EMPTY\n#define\tTAILQ_EMPTY(head) ((head)->tqh_first == NULL)\n#endif\n#ifndef TAILQ_FOREACH\n#define TAILQ_FOREACH(var, head, field)\t\t\t\t\t\\\n\tfor (var = TAILQ_FIRST(head); var; var = TAILQ_NEXT(var, field))\n#endif\n\n/* macro for timeout/untimeout */\n#if (__FreeBSD_version > 300000) || defined(__NetBSD__)\n/* use callout */\n#include <sys/callout.h>\n\n#if (__FreeBSD_version > 500000)\n#define\tCALLOUT_INIT(c)\t\tcallout_init((c), 0)\n#else\n#define\tCALLOUT_INIT(c)\t\tcallout_init((c))\n#endif\n#define\tCALLOUT_RESET(c,t,f,a)\tcallout_reset((c),(t),(f),(a))\n#define\tCALLOUT_STOP(c)\t\tcallout_stop((c))\n#if !defined(CALLOUT_INITIALIZER) && (__FreeBSD_version < 600000)\n#define\tCALLOUT_INITIALIZER\t{ { { NULL } }, 0, NULL, NULL, 0 }\n#endif\n#elif defined(__OpenBSD__)\n#include <sys/timeout.h>\n/* callout structure as a wrapper of struct timeout */\nstruct callout {\n\tstruct timeout\tc_to;\n};\n#define\tCALLOUT_INIT(c)\t\tdo { bzero((c), sizeof(*(c))); } while (/*CONSTCOND*/ 0)\n#define\tCALLOUT_RESET(c,t,f,a)\tdo { if (!timeout_initialized(&(c)->c_to))  \\\n\t\t\t\t\t timeout_set(&(c)->c_to, (f), (a)); \\\n\t\t\t\t     timeout_add(&(c)->c_to, (t)); } while (/*CONSTCOND*/ 0)\n#define\tCALLOUT_STOP(c)\t\ttimeout_del(&(c)->c_to)\n#define\tCALLOUT_INITIALIZER\t{ { { NULL }, NULL, NULL, 0, 0 } }\n#else\n/* use old-style timeout/untimeout */\n/* dummy callout structure */\nstruct callout {\n\tvoid\t\t*c_arg;\t\t\t/* function argument */\n\tvoid\t\t(*c_func)(void *);\t/* functiuon to call */\n};\n#define\tCALLOUT_INIT(c)\t\tdo { bzero((c), sizeof(*(c))); } while (/*CONSTCOND*/ 0)\n#define\tCALLOUT_RESET(c,t,f,a)\tdo {\t(c)->c_arg = (a);\t\\\n\t\t\t\t\t(c)->c_func = (f);\t\\\n\t\t\t\t\ttimeout((f),(a),(t)); } while (/*CONSTCOND*/ 0)\n#define\tCALLOUT_STOP(c)\t\tuntimeout((c)->c_func,(c)->c_arg)\n#define\tCALLOUT_INITIALIZER\t{ NULL, NULL }\n#endif\n#if !defined(__FreeBSD__)\ntypedef void (timeout_t)(void *);\n#endif\n\n#define\tm_pktlen(m)\t\t((m)->m_pkthdr.len)\n\nstruct ifnet; struct mbuf;\nstruct pf_altq;\n#ifdef ALTQ3_CLFIER_COMPAT\nstruct flowinfo;\n#endif\n\nvoid\t*altq_lookup(char *, int);\n#ifdef ALTQ3_CLFIER_COMPAT\nint\taltq_extractflow(struct mbuf *, int, struct flowinfo *, u_int32_t);\nint\tacc_add_filter(struct acc_classifier *, struct flow_filter *,\n\t    void *, u_long *);\nint\tacc_delete_filter(struct acc_classifier *, u_long);\nint\tacc_discard_filters(struct acc_classifier *, void *, int);\nvoid\t*acc_classify(void *, struct mbuf *, int);\n#endif\nu_int8_t read_dsfield(struct mbuf *, struct altq_pktattr *);\nvoid\twrite_dsfield(struct mbuf *, struct altq_pktattr *, u_int8_t);\nvoid\taltq_assert(const char *, int, const char *);\nint\ttbr_set(struct ifaltq *, struct tb_profile *);\nint\ttbr_get(struct ifaltq *, struct tb_profile *);\n\nint\taltq_pfattach(struct pf_altq *);\nint\taltq_pfdetach(struct pf_altq *);\nint\taltq_add(struct pf_altq *);\nint\taltq_remove(struct pf_altq *);\nint\taltq_add_queue(struct pf_altq *);\nint\taltq_remove_queue(struct pf_altq *);\nint\taltq_getqstats(struct pf_altq *, void *, int *);\n\nint\tcbq_pfattach(struct pf_altq *);\nint\tcbq_add_altq(struct pf_altq *);\nint\tcbq_remove_altq(struct pf_altq *);\nint\tcbq_add_queue(struct pf_altq *);\nint\tcbq_remove_queue(struct pf_altq *);\nint\tcbq_getqstats(struct pf_altq *, void *, int *);\n\nint\tpriq_pfattach(struct pf_altq *);\nint\tpriq_add_altq(struct pf_altq *);\nint\tpriq_remove_altq(struct pf_altq *);\nint\tpriq_add_queue(struct pf_altq *);\nint\tpriq_remove_queue(struct pf_altq *);\nint\tpriq_getqstats(struct pf_altq *, void *, int *);\n\nint\thfsc_pfattach(struct pf_altq *);\nint\thfsc_add_altq(struct pf_altq *);\nint\thfsc_remove_altq(struct pf_altq *);\nint\thfsc_add_queue(struct pf_altq *);\nint\thfsc_remove_queue(struct pf_altq *);\nint\thfsc_getqstats(struct pf_altq *, void *, int *);\n\n#endif /* _KERNEL */\n#endif /* _ALTQ_ALTQ_VAR_H_ */\n"
  },
  {
    "path": "freebsd-headers/altq/altqconf.h",
    "content": "/*\t$OpenBSD: altqconf.h,v 1.1 2001/06/27 05:28:36 kjc Exp $\t*/\n/*\t$NetBSD: altqconf.h,v 1.2 2001/05/30 11:57:16 mrg Exp $\t*/\n\n#if defined(_KERNEL_OPT) || defined(__OpenBSD__)\n\n#if defined(_KERNEL_OPT)\n#include \"opt_altq_enabled.h\"\n#endif\n\n#include <sys/conf.h>\n\n#ifdef ALTQ\n#define\tNALTQ\t1\n#else\n#define\tNALTQ\t0\n#endif\n\ncdev_decl(altq);\n\n#ifdef __OpenBSD__\n#define cdev_altq_init(c,n) { \\\n\tdev_init(c,n,open), dev_init(c,n,close), (dev_type_read((*))) enodev, \\\n\t(dev_type_write((*))) enodev, dev_init(c,n,ioctl), \\\n\t(dev_type_stop((*))) enodev, 0, (dev_type_select((*))) enodev, \\\n\t(dev_type_mmap((*))) enodev }\n#else\n#define\tcdev_altq_init(x,y)\tcdev__oci_init(x,y)\n#endif\n#endif /* defined(_KERNEL_OPT) || defined(__OpenBSD__) */\n"
  },
  {
    "path": "freebsd-headers/altq/if_altq.h",
    "content": "/*\t$FreeBSD: release/9.0.0/sys/contrib/altq/altq/if_altq.h 219457 2011-03-10 18:49:15Z jkim $\t*/\n/*\t$KAME: if_altq.h,v 1.12 2005/04/13 03:44:25 suz Exp $\t*/\n\n/*\n * Copyright (C) 1997-2003\n *\tSony Computer Science Laboratories Inc.  All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY SONY CSL AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL SONY CSL OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n */\n#ifndef _ALTQ_IF_ALTQ_H_\n#define\t_ALTQ_IF_ALTQ_H_\n\n#ifdef __FreeBSD__\n#include <sys/lock.h>\t\t/* XXX */\n#include <sys/mutex.h>\t\t/* XXX */\n#include <sys/event.h>\t\t/* XXX */\n#endif\n\n#ifdef _KERNEL_OPT\n#include <altq/altqconf.h>\n#endif\n\nstruct altq_pktattr; struct tb_regulator; struct top_cdnr;\n\n/*\n * Structure defining a queue for a network interface.\n */\nstruct\tifaltq {\n\t/* fields compatible with struct ifqueue */\n\tstruct\tmbuf *ifq_head;\n\tstruct\tmbuf *ifq_tail;\n\tint\tifq_len;\n\tint\tifq_maxlen;\n\tint\tifq_drops;\n#ifdef __FreeBSD__\n\tstruct\tmtx ifq_mtx;\n#endif\n\n\t/* driver owned queue (used for bulk dequeue and prepend) UNLOCKED */\n\tstruct\tmbuf *ifq_drv_head;\n\tstruct\tmbuf *ifq_drv_tail;\n\tint\tifq_drv_len;\n\tint\tifq_drv_maxlen;\n\n\t/* alternate queueing related fields */\n\tint\taltq_type;\t\t/* discipline type */\n\tint\taltq_flags;\t\t/* flags (e.g. ready, in-use) */\n\tvoid\t*altq_disc;\t\t/* for discipline-specific use */\n\tstruct\tifnet *altq_ifp;\t/* back pointer to interface */\n\n\tint\t(*altq_enqueue)(struct ifaltq *, struct mbuf *,\n\t\t\t\tstruct altq_pktattr *);\n\tstruct\tmbuf *(*altq_dequeue)(struct ifaltq *, int);\n\tint\t(*altq_request)(struct ifaltq *, int, void *);\n\n\t/* classifier fields */\n\tvoid\t*altq_clfier;\t\t/* classifier-specific use */\n\tvoid\t*(*altq_classify)(void *, struct mbuf *, int);\n\n\t/* token bucket regulator */\n\tstruct\ttb_regulator *altq_tbr;\n\n\t/* input traffic conditioner (doesn't belong to the output queue...) */\n\tstruct top_cdnr *altq_cdnr;\n};\n\n\n#ifdef _KERNEL\n\n/*\n * packet attributes used by queueing disciplines.\n * pattr_class is a discipline-dependent scheduling class that is\n * set by a classifier.\n * pattr_hdr and pattr_af may be used by a discipline to access\n * the header within a mbuf.  (e.g. ECN needs to update the CE bit)\n * note that pattr_hdr could be stale after m_pullup, though link\n * layer output routines usually don't use m_pullup.  link-level\n * compression also invalidates these fields.  thus, pattr_hdr needs\n * to be verified when a discipline touches the header.\n */\nstruct altq_pktattr {\n\tvoid\t*pattr_class;\t\t/* sched class set by classifier */\n\tint\tpattr_af;\t\t/* address family */\n\tcaddr_t\tpattr_hdr;\t\t/* saved header position in mbuf */\n};\n\n/*\n * mbuf tag to carry a queue id (and hints for ECN).\n */\nstruct altq_tag {\n\tu_int32_t\tqid;\t\t/* queue id */\n\t/* hints for ecn */\n\tint\t\taf;\t\t/* address family */\n\tvoid\t\t*hdr;\t\t/* saved header position in mbuf */\n};\n\n/*\n * a token-bucket regulator limits the rate that a network driver can\n * dequeue packets from the output queue.\n * modern cards are able to buffer a large amount of packets and dequeue\n * too many packets at a time.  this bursty dequeue behavior makes it\n * impossible to schedule packets by queueing disciplines.\n * a token-bucket is used to control the burst size in a device\n * independent manner.\n */\nstruct tb_regulator {\n\tint64_t\t\ttbr_rate;\t/* (scaled) token bucket rate */\n\tint64_t\t\ttbr_depth;\t/* (scaled) token bucket depth */\n\n\tint64_t\t\ttbr_token;\t/* (scaled) current token */\n\tint64_t\t\ttbr_filluptime;\t/* (scaled) time to fill up bucket */\n\tu_int64_t\ttbr_last;\t/* last time token was updated */\n\n\tint\t\ttbr_lastop;\t/* last dequeue operation type\n\t\t\t\t\t   needed for poll-and-dequeue */\n};\n\n/* if_altqflags */\n#define\tALTQF_READY\t 0x01\t/* driver supports alternate queueing */\n#define\tALTQF_ENABLED\t 0x02\t/* altq is in use */\n#define\tALTQF_CLASSIFY\t 0x04\t/* classify packets */\n#define\tALTQF_CNDTNING\t 0x08\t/* altq traffic conditioning is enabled */\n#define\tALTQF_DRIVER1\t 0x40\t/* driver specific */\n\n/* if_altqflags set internally only: */\n#define\tALTQF_CANTCHANGE \t(ALTQF_READY)\n\n/* altq_dequeue 2nd arg */\n#define\tALTDQ_REMOVE\t\t1\t/* dequeue mbuf from the queue */\n#define\tALTDQ_POLL\t\t2\t/* don't dequeue mbuf from the queue */\n\n/* altq request types (currently only purge is defined) */\n#define\tALTRQ_PURGE\t\t1\t/* purge all packets */\n\n#define\tALTQ_IS_READY(ifq)\t\t((ifq)->altq_flags & ALTQF_READY)\n#define\tALTQ_IS_ENABLED(ifq)\t\t((ifq)->altq_flags & ALTQF_ENABLED)\n#define\tALTQ_NEEDS_CLASSIFY(ifq)\t((ifq)->altq_flags & ALTQF_CLASSIFY)\n#define\tALTQ_IS_CNDTNING(ifq)\t\t((ifq)->altq_flags & ALTQF_CNDTNING)\n\n#define\tALTQ_SET_CNDTNING(ifq)\t\t((ifq)->altq_flags |= ALTQF_CNDTNING)\n#define\tALTQ_CLEAR_CNDTNING(ifq)\t((ifq)->altq_flags &= ~ALTQF_CNDTNING)\n#define\tALTQ_IS_ATTACHED(ifq)\t\t((ifq)->altq_disc != NULL)\n\n#define\tALTQ_ENQUEUE(ifq, m, pa, err)\t\t\t\t\t\\\n\t(err) = (*(ifq)->altq_enqueue)((ifq),(m),(pa))\n#define\tALTQ_DEQUEUE(ifq, m)\t\t\t\t\t\t\\\n\t(m) = (*(ifq)->altq_dequeue)((ifq), ALTDQ_REMOVE)\n#define\tALTQ_POLL(ifq, m)\t\t\t\t\t\t\\\n\t(m) = (*(ifq)->altq_dequeue)((ifq), ALTDQ_POLL)\n#define\tALTQ_PURGE(ifq)\t\t\t\t\t\t\t\\\n\t(void)(*(ifq)->altq_request)((ifq), ALTRQ_PURGE, (void *)0)\n#define\tALTQ_IS_EMPTY(ifq)\t\t((ifq)->ifq_len == 0)\n#define\tTBR_IS_ENABLED(ifq)\t\t((ifq)->altq_tbr != NULL)\n\nextern int altq_attach(struct ifaltq *, int, void *,\n\t\t       int (*)(struct ifaltq *, struct mbuf *,\n\t\t\t       struct altq_pktattr *),\n\t\t       struct mbuf *(*)(struct ifaltq *, int),\n\t\t       int (*)(struct ifaltq *, int, void *),\n\t\t       void *,\n\t\t       void *(*)(void *, struct mbuf *, int));\nextern int altq_detach(struct ifaltq *);\nextern int altq_enable(struct ifaltq *);\nextern int altq_disable(struct ifaltq *);\nextern struct mbuf *(*tbr_dequeue_ptr)(struct ifaltq *, int);\nextern int (*altq_input)(struct mbuf *, int);\n#if 0 /* ALTQ3_CLFIER_COMPAT */\nvoid altq_etherclassify(struct ifaltq *, struct mbuf *, struct altq_pktattr *);\n#endif\n#endif /* _KERNEL */\n\n#endif /* _ALTQ_IF_ALTQ_H_ */\n"
  },
  {
    "path": "freebsd-headers/ar.h",
    "content": "/*-\n * Copyright (c) 1991, 1993\n *\tThe Regents of the University of California.  All rights reserved.\n * (c) UNIX System Laboratories, Inc.\n * All or some portions of this file are derived from material licensed\n * to the University of California by American Telephone and Telegraph\n * Co. or Unix System Laboratories, Inc. and are reproduced herein with\n * the permission of UNIX System Laboratories, Inc.\n *\n * This code is derived from software contributed to Berkeley by\n * Hugh Smith at The University of Guelph.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t@(#)ar.h\t8.2 (Berkeley) 1/21/94\n *\n * $FreeBSD: release/9.0.0/include/ar.h 203964 2010-02-16 19:39:50Z imp $\n */\n\n#ifndef _AR_H_\n#define\t_AR_H_\n\n#include <sys/cdefs.h>\n\n/* Pre-4BSD archives had these magic numbers in them. */\n#define\tOARMAG1\t0177555\n#define\tOARMAG2\t0177545\n\n#define\tARMAG\t\t\"!<arch>\\n\"\t/* ar \"magic number\" */\n#define\tSARMAG\t\t8\t\t/* strlen(ARMAG); */\n\n#define\tAR_EFMT1\t\"#1/\"\t\t/* extended format #1 */\n\nstruct ar_hdr {\n\tchar ar_name[16];\t\t/* name */\n\tchar ar_date[12];\t\t/* modification time */\n\tchar ar_uid[6];\t\t\t/* user id */\n\tchar ar_gid[6];\t\t\t/* group id */\n\tchar ar_mode[8];\t\t/* octal file permissions */\n\tchar ar_size[10];\t\t/* size in bytes */\n#define\tARFMAG\t\"`\\n\"\n\tchar ar_fmag[2];\t\t/* consistency check */\n} __packed;\n\n#endif /* !_AR_H_ */\n"
  },
  {
    "path": "freebsd-headers/archive.h",
    "content": "/*-\n * Copyright (c) 2003-2007 Tim Kientzle\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR\n * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES\n * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,\n * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF\n * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/lib/libarchive/archive.h 224152 2011-07-17 21:27:38Z mm $\n */\n\n#ifndef ARCHIVE_H_INCLUDED\n#define\tARCHIVE_H_INCLUDED\n\n/*\n * Note: archive.h is for use outside of libarchive; the configuration\n * headers (config.h, archive_platform.h, etc.) are purely internal.\n * Do NOT use HAVE_XXX configuration macros to control the behavior of\n * this header!  If you must conditionalize, use predefined compiler and/or\n * platform macros.\n */\n#if defined(__BORLANDC__) && __BORLANDC__ >= 0x560\n# define __LA_STDINT_H <stdint.h>\n#elif !defined(__WATCOMC__) && !defined(_MSC_VER) && !defined(__INTERIX) && !defined(__BORLANDC__)\n# define __LA_STDINT_H <inttypes.h>\n#endif\n\n#include <sys/stat.h>\n#include <sys/types.h>  /* Linux requires this for off_t */\n#ifdef __LA_STDINT_H\n# include __LA_STDINT_H /* int64_t, etc. */\n#endif\n#include <stdio.h> /* For FILE * */\n\n/* Get appropriate definitions of standard POSIX-style types. */\n/* These should match the types used in 'struct stat' */\n#if defined(_WIN32) && !defined(__CYGWIN__)\n#define\t__LA_INT64_T\t__int64\n# if defined(_SSIZE_T_DEFINED)\n#  define\t__LA_SSIZE_T\tssize_t\n# elif defined(_WIN64)\n#  define\t__LA_SSIZE_T\t__int64\n# else\n#  define\t__LA_SSIZE_T\tlong\n# endif\n# if defined(__BORLANDC__)\n#  define\t__LA_UID_T\tuid_t\n#  define\t__LA_GID_T\tgid_t\n# else\n#  define\t__LA_UID_T\tshort\n#  define\t__LA_GID_T\tshort\n# endif\n#else\n#include <unistd.h>  /* ssize_t, uid_t, and gid_t */\n#define\t__LA_INT64_T\tint64_t\n#define\t__LA_SSIZE_T\tssize_t\n#define\t__LA_UID_T\tuid_t\n#define\t__LA_GID_T\tgid_t\n#endif\n\n/*\n * On Windows, define LIBARCHIVE_STATIC if you're building or using a\n * .lib.  The default here assumes you're building a DLL.  Only\n * libarchive source should ever define __LIBARCHIVE_BUILD.\n */\n#if ((defined __WIN32__) || (defined _WIN32) || defined(__CYGWIN__)) && (!defined LIBARCHIVE_STATIC)\n# ifdef __LIBARCHIVE_BUILD\n#  ifdef __GNUC__\n#   define __LA_DECL\t__attribute__((dllexport)) extern\n#  else\n#   define __LA_DECL\t__declspec(dllexport)\n#  endif\n# else\n#  ifdef __GNUC__\n#   define __LA_DECL\t__attribute__((dllimport)) extern\n#  else\n#   define __LA_DECL\t__declspec(dllimport)\n#  endif\n# endif\n#else\n/* Static libraries or non-Windows needs no special declaration. */\n# define __LA_DECL\n#endif\n\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\n/*\n * The version number is provided as both a macro and a function.\n * The macro identifies the installed header; the function identifies\n * the library version (which may not be the same if you're using a\n * dynamically-linked version of the library).  Of course, if the\n * header and library are very different, you should expect some\n * strangeness.  Don't do that.\n */\n\n/*\n * The version number is expressed as a single integer that makes it\n * easy to compare versions at build time: for version a.b.c, the\n * version number is printf(\"%d%03d%03d\",a,b,c).  For example, if you\n * know your application requires version 2.12.108 or later, you can\n * assert that ARCHIVE_VERSION >= 2012108.\n *\n * This single-number format was introduced with libarchive 1.9.0 in\n * the libarchive 1.x family and libarchive 2.2.4 in the libarchive\n * 2.x family.  The following may be useful if you really want to do\n * feature detection for earlier libarchive versions (which defined\n * ARCHIVE_API_VERSION and ARCHIVE_API_FEATURE instead):\n *\n * #ifndef ARCHIVE_VERSION_NUMBER\n * #define ARCHIVE_VERSION_NUMBER\t\\\n *             (ARCHIVE_API_VERSION * 1000000 + ARCHIVE_API_FEATURE * 1000)\n * #endif\n */\n#define\tARCHIVE_VERSION_NUMBER 2008004\n__LA_DECL int\t\tarchive_version_number(void);\n\n/*\n * Textual name/version of the library, useful for version displays.\n */\n#define\tARCHIVE_VERSION_STRING \"libarchive 2.8.4\"\n__LA_DECL const char *\tarchive_version_string(void);\n\n#if ARCHIVE_VERSION_NUMBER < 3000000\n/*\n * Deprecated; these are older names that will be removed in favor of\n * the simpler definitions above.\n */\n#define\tARCHIVE_VERSION_STAMP\tARCHIVE_VERSION_NUMBER\n__LA_DECL int\t\tarchive_version_stamp(void);\n#define\tARCHIVE_LIBRARY_VERSION\tARCHIVE_VERSION_STRING\n__LA_DECL const char *\tarchive_version(void);\n#define\tARCHIVE_API_VERSION\t(ARCHIVE_VERSION_NUMBER / 1000000)\n__LA_DECL int\t\tarchive_api_version(void);\n#define\tARCHIVE_API_FEATURE\t((ARCHIVE_VERSION_NUMBER / 1000) % 1000)\n__LA_DECL int\t\tarchive_api_feature(void);\n#endif\n\n#if ARCHIVE_VERSION_NUMBER < 3000000\n/* This should never have been here in the first place. */\n/* Legacy of old tar assumptions, will be removed in libarchive 3.0. */\n#define\tARCHIVE_BYTES_PER_RECORD\t  512\n#define\tARCHIVE_DEFAULT_BYTES_PER_BLOCK\t10240\n#endif\n\n/* Declare our basic types. */\nstruct archive;\nstruct archive_entry;\n\n/*\n * Error codes: Use archive_errno() and archive_error_string()\n * to retrieve details.  Unless specified otherwise, all functions\n * that return 'int' use these codes.\n */\n#define\tARCHIVE_EOF\t  1\t/* Found end of archive. */\n#define\tARCHIVE_OK\t  0\t/* Operation was successful. */\n#define\tARCHIVE_RETRY\t(-10)\t/* Retry might succeed. */\n#define\tARCHIVE_WARN\t(-20)\t/* Partial success. */\n/* For example, if write_header \"fails\", then you can't push data. */\n#define\tARCHIVE_FAILED\t(-25)\t/* Current operation cannot complete. */\n/* But if write_header is \"fatal,\" then this archive is dead and useless. */\n#define\tARCHIVE_FATAL\t(-30)\t/* No more operations are possible. */\n\n/*\n * As far as possible, archive_errno returns standard platform errno codes.\n * Of course, the details vary by platform, so the actual definitions\n * here are stored in \"archive_platform.h\".  The symbols are listed here\n * for reference; as a rule, clients should not need to know the exact\n * platform-dependent error code.\n */\n/* Unrecognized or invalid file format. */\n/* #define\tARCHIVE_ERRNO_FILE_FORMAT */\n/* Illegal usage of the library. */\n/* #define\tARCHIVE_ERRNO_PROGRAMMER_ERROR */\n/* Unknown or unclassified error. */\n/* #define\tARCHIVE_ERRNO_MISC */\n\n/*\n * Callbacks are invoked to automatically read/skip/write/open/close the\n * archive. You can provide your own for complex tasks (like breaking\n * archives across multiple tapes) or use standard ones built into the\n * library.\n */\n\n/* Returns pointer and size of next block of data from archive. */\ntypedef __LA_SSIZE_T\tarchive_read_callback(struct archive *,\n\t\t\t    void *_client_data, const void **_buffer);\n\n/* Skips at most request bytes from archive and returns the skipped amount */\n#if ARCHIVE_VERSION_NUMBER < 2000000\n/* Libarchive 1.0 used ssize_t for the return, which is only 32 bits\n * on most 32-bit platforms; not large enough. */\ntypedef __LA_SSIZE_T\tarchive_skip_callback(struct archive *,\n\t\t\t    void *_client_data, size_t request);\n#elif ARCHIVE_VERSION_NUMBER < 3000000\n/* Libarchive 2.0 used off_t here, but that is a bad idea on Linux and a\n * few other platforms where off_t varies with build settings. */\ntypedef off_t\t\tarchive_skip_callback(struct archive *,\n\t\t\t    void *_client_data, off_t request);\n#else\n/* Libarchive 3.0 uses int64_t here, which is actually guaranteed to be\n * 64 bits on every platform. */\ntypedef __LA_INT64_T\tarchive_skip_callback(struct archive *,\n\t\t\t    void *_client_data, __LA_INT64_T request);\n#endif\n\n/* Returns size actually written, zero on EOF, -1 on error. */\ntypedef __LA_SSIZE_T\tarchive_write_callback(struct archive *,\n\t\t\t    void *_client_data,\n\t\t\t    const void *_buffer, size_t _length);\n\n#if ARCHIVE_VERSION_NUMBER < 3000000\n/* Open callback is actually never needed; remove it in libarchive 3.0. */\ntypedef int\tarchive_open_callback(struct archive *, void *_client_data);\n#endif\n\ntypedef int\tarchive_close_callback(struct archive *, void *_client_data);\n\n/*\n * Codes for archive_compression.\n */\n#define\tARCHIVE_COMPRESSION_NONE\t0\n#define\tARCHIVE_COMPRESSION_GZIP\t1\n#define\tARCHIVE_COMPRESSION_BZIP2\t2\n#define\tARCHIVE_COMPRESSION_COMPRESS\t3\n#define\tARCHIVE_COMPRESSION_PROGRAM\t4\n#define\tARCHIVE_COMPRESSION_LZMA\t5\n#define\tARCHIVE_COMPRESSION_XZ\t\t6\n#define\tARCHIVE_COMPRESSION_UU\t\t7\n#define\tARCHIVE_COMPRESSION_RPM\t\t8\n\n/*\n * Codes returned by archive_format.\n *\n * Top 16 bits identifies the format family (e.g., \"tar\"); lower\n * 16 bits indicate the variant.  This is updated by read_next_header.\n * Note that the lower 16 bits will often vary from entry to entry.\n * In some cases, this variation occurs as libarchive learns more about\n * the archive (for example, later entries might utilize extensions that\n * weren't necessary earlier in the archive; in this case, libarchive\n * will change the format code to indicate the extended format that\n * was used).  In other cases, it's because different tools have\n * modified the archive and so different parts of the archive\n * actually have slightly different formts.  (Both tar and cpio store\n * format codes in each entry, so it is quite possible for each\n * entry to be in a different format.)\n */\n#define\tARCHIVE_FORMAT_BASE_MASK\t\t0xff0000\n#define\tARCHIVE_FORMAT_CPIO\t\t\t0x10000\n#define\tARCHIVE_FORMAT_CPIO_POSIX\t\t(ARCHIVE_FORMAT_CPIO | 1)\n#define\tARCHIVE_FORMAT_CPIO_BIN_LE\t\t(ARCHIVE_FORMAT_CPIO | 2)\n#define\tARCHIVE_FORMAT_CPIO_BIN_BE\t\t(ARCHIVE_FORMAT_CPIO | 3)\n#define\tARCHIVE_FORMAT_CPIO_SVR4_NOCRC\t\t(ARCHIVE_FORMAT_CPIO | 4)\n#define\tARCHIVE_FORMAT_CPIO_SVR4_CRC\t\t(ARCHIVE_FORMAT_CPIO | 5)\n#define\tARCHIVE_FORMAT_SHAR\t\t\t0x20000\n#define\tARCHIVE_FORMAT_SHAR_BASE\t\t(ARCHIVE_FORMAT_SHAR | 1)\n#define\tARCHIVE_FORMAT_SHAR_DUMP\t\t(ARCHIVE_FORMAT_SHAR | 2)\n#define\tARCHIVE_FORMAT_TAR\t\t\t0x30000\n#define\tARCHIVE_FORMAT_TAR_USTAR\t\t(ARCHIVE_FORMAT_TAR | 1)\n#define\tARCHIVE_FORMAT_TAR_PAX_INTERCHANGE\t(ARCHIVE_FORMAT_TAR | 2)\n#define\tARCHIVE_FORMAT_TAR_PAX_RESTRICTED\t(ARCHIVE_FORMAT_TAR | 3)\n#define\tARCHIVE_FORMAT_TAR_GNUTAR\t\t(ARCHIVE_FORMAT_TAR | 4)\n#define\tARCHIVE_FORMAT_ISO9660\t\t\t0x40000\n#define\tARCHIVE_FORMAT_ISO9660_ROCKRIDGE\t(ARCHIVE_FORMAT_ISO9660 | 1)\n#define\tARCHIVE_FORMAT_ZIP\t\t\t0x50000\n#define\tARCHIVE_FORMAT_EMPTY\t\t\t0x60000\n#define\tARCHIVE_FORMAT_AR\t\t\t0x70000\n#define\tARCHIVE_FORMAT_AR_GNU\t\t\t(ARCHIVE_FORMAT_AR | 1)\n#define\tARCHIVE_FORMAT_AR_BSD\t\t\t(ARCHIVE_FORMAT_AR | 2)\n#define\tARCHIVE_FORMAT_MTREE\t\t\t0x80000\n#define\tARCHIVE_FORMAT_RAW\t\t\t0x90000\n#define\tARCHIVE_FORMAT_XAR\t\t\t0xA0000\n\n/*-\n * Basic outline for reading an archive:\n *   1) Ask archive_read_new for an archive reader object.\n *   2) Update any global properties as appropriate.\n *      In particular, you'll certainly want to call appropriate\n *      archive_read_support_XXX functions.\n *   3) Call archive_read_open_XXX to open the archive\n *   4) Repeatedly call archive_read_next_header to get information about\n *      successive archive entries.  Call archive_read_data to extract\n *      data for entries of interest.\n *   5) Call archive_read_finish to end processing.\n */\n__LA_DECL struct archive\t*archive_read_new(void);\n\n/*\n * The archive_read_support_XXX calls enable auto-detect for this\n * archive handle.  They also link in the necessary support code.\n * For example, if you don't want bzlib linked in, don't invoke\n * support_compression_bzip2().  The \"all\" functions provide the\n * obvious shorthand.\n */\n__LA_DECL int\t\t archive_read_support_compression_all(struct archive *);\n__LA_DECL int\t\t archive_read_support_compression_bzip2(struct archive *);\n__LA_DECL int\t\t archive_read_support_compression_compress(struct archive *);\n__LA_DECL int\t\t archive_read_support_compression_gzip(struct archive *);\n__LA_DECL int\t\t archive_read_support_compression_lzma(struct archive *);\n__LA_DECL int\t\t archive_read_support_compression_none(struct archive *);\n__LA_DECL int\t\t archive_read_support_compression_program(struct archive *,\n\t\t     const char *command);\n__LA_DECL int\t\t archive_read_support_compression_program_signature\n\t\t\t\t(struct archive *, const char *,\n\t\t\t\t    const void * /* match */, size_t);\n\n__LA_DECL int\t\t archive_read_support_compression_rpm(struct archive *);\n__LA_DECL int\t\t archive_read_support_compression_uu(struct archive *);\n__LA_DECL int\t\t archive_read_support_compression_xz(struct archive *);\n\n__LA_DECL int\t\t archive_read_support_format_all(struct archive *);\n__LA_DECL int\t\t archive_read_support_format_ar(struct archive *);\n__LA_DECL int\t\t archive_read_support_format_cpio(struct archive *);\n__LA_DECL int\t\t archive_read_support_format_empty(struct archive *);\n__LA_DECL int\t\t archive_read_support_format_gnutar(struct archive *);\n__LA_DECL int\t\t archive_read_support_format_iso9660(struct archive *);\n__LA_DECL int\t\t archive_read_support_format_mtree(struct archive *);\n__LA_DECL int\t\t archive_read_support_format_raw(struct archive *);\n__LA_DECL int\t\t archive_read_support_format_tar(struct archive *);\n__LA_DECL int\t\t archive_read_support_format_xar(struct archive *);\n__LA_DECL int\t\t archive_read_support_format_zip(struct archive *);\n\n\n/* Open the archive using callbacks for archive I/O. */\n__LA_DECL int\t\t archive_read_open(struct archive *, void *_client_data,\n\t\t     archive_open_callback *, archive_read_callback *,\n\t\t     archive_close_callback *);\n__LA_DECL int\t\t archive_read_open2(struct archive *, void *_client_data,\n\t\t     archive_open_callback *, archive_read_callback *,\n\t\t     archive_skip_callback *, archive_close_callback *);\n\n/*\n * A variety of shortcuts that invoke archive_read_open() with\n * canned callbacks suitable for common situations.  The ones that\n * accept a block size handle tape blocking correctly.\n */\n/* Use this if you know the filename.  Note: NULL indicates stdin. */\n__LA_DECL int\t\t archive_read_open_filename(struct archive *,\n\t\t     const char *_filename, size_t _block_size);\n/* archive_read_open_file() is a deprecated synonym for ..._open_filename(). */\n__LA_DECL int\t\t archive_read_open_file(struct archive *,\n\t\t     const char *_filename, size_t _block_size);\n/* Read an archive that's stored in memory. */\n__LA_DECL int\t\t archive_read_open_memory(struct archive *,\n\t\t     void * buff, size_t size);\n/* A more involved version that is only used for internal testing. */\n__LA_DECL int\t\tarchive_read_open_memory2(struct archive *a, void *buff,\n\t\t     size_t size, size_t read_size);\n/* Read an archive that's already open, using the file descriptor. */\n__LA_DECL int\t\t archive_read_open_fd(struct archive *, int _fd,\n\t\t     size_t _block_size);\n/* Read an archive that's already open, using a FILE *. */\n/* Note: DO NOT use this with tape drives. */\n__LA_DECL int\t\t archive_read_open_FILE(struct archive *, FILE *_file);\n\n/* Parses and returns next entry header. */\n__LA_DECL int\t\t archive_read_next_header(struct archive *,\n\t\t     struct archive_entry **);\n\n/* Parses and returns next entry header using the archive_entry passed in */\n__LA_DECL int\t\t archive_read_next_header2(struct archive *,\n\t\t     struct archive_entry *);\n\n/*\n * Retrieve the byte offset in UNCOMPRESSED data where last-read\n * header started.\n */\n__LA_DECL __LA_INT64_T\t\t archive_read_header_position(struct archive *);\n\n/* Read data from the body of an entry.  Similar to read(2). */\n__LA_DECL __LA_SSIZE_T\t\t archive_read_data(struct archive *,\n\t\t\t\t    void *, size_t);\n\n/*\n * A zero-copy version of archive_read_data that also exposes the file offset\n * of each returned block.  Note that the client has no way to specify\n * the desired size of the block.  The API does guarantee that offsets will\n * be strictly increasing and that returned blocks will not overlap.\n */\n#if ARCHIVE_VERSION_NUMBER < 3000000\n__LA_DECL int\t\t archive_read_data_block(struct archive *a,\n\t\t\t    const void **buff, size_t *size, off_t *offset);\n#else\n__LA_DECL int\t\t archive_read_data_block(struct archive *a,\n\t\t\t    const void **buff, size_t *size,\n\t\t\t    __LA_INT64_T *offset);\n#endif\n\n/*-\n * Some convenience functions that are built on archive_read_data:\n *  'skip': skips entire entry\n *  'into_buffer': writes data into memory buffer that you provide\n *  'into_fd': writes data to specified filedes\n */\n__LA_DECL int\t\t archive_read_data_skip(struct archive *);\n__LA_DECL int\t\t archive_read_data_into_buffer(struct archive *,\n\t\t\t    void *buffer, __LA_SSIZE_T len);\n__LA_DECL int\t\t archive_read_data_into_fd(struct archive *, int fd);\n\n/*\n * Set read options.\n */\n/* Apply option string to the format only. */\n__LA_DECL int\t\tarchive_read_set_format_options(struct archive *_a,\n\t\t\t    const char *s);\n/* Apply option string to the filter only. */\n__LA_DECL int\t\tarchive_read_set_filter_options(struct archive *_a,\n\t\t\t    const char *s);\n/* Apply option string to both the format and the filter. */\n__LA_DECL int\t\tarchive_read_set_options(struct archive *_a,\n\t\t\t    const char *s);\n\n/*-\n * Convenience function to recreate the current entry (whose header\n * has just been read) on disk.\n *\n * This does quite a bit more than just copy data to disk. It also:\n *  - Creates intermediate directories as required.\n *  - Manages directory permissions:  non-writable directories will\n *    be initially created with write permission enabled; when the\n *    archive is closed, dir permissions are edited to the values specified\n *    in the archive.\n *  - Checks hardlinks:  hardlinks will not be extracted unless the\n *    linked-to file was also extracted within the same session. (TODO)\n */\n\n/* The \"flags\" argument selects optional behavior, 'OR' the flags you want. */\n\n/* Default: Do not try to set owner/group. */\n#define\tARCHIVE_EXTRACT_OWNER\t\t\t(0x0001)\n/* Default: Do obey umask, do not restore SUID/SGID/SVTX bits. */\n#define\tARCHIVE_EXTRACT_PERM\t\t\t(0x0002)\n/* Default: Do not restore mtime/atime. */\n#define\tARCHIVE_EXTRACT_TIME\t\t\t(0x0004)\n/* Default: Replace existing files. */\n#define\tARCHIVE_EXTRACT_NO_OVERWRITE \t\t(0x0008)\n/* Default: Try create first, unlink only if create fails with EEXIST. */\n#define\tARCHIVE_EXTRACT_UNLINK\t\t\t(0x0010)\n/* Default: Do not restore ACLs. */\n#define\tARCHIVE_EXTRACT_ACL\t\t\t(0x0020)\n/* Default: Do not restore fflags. */\n#define\tARCHIVE_EXTRACT_FFLAGS\t\t\t(0x0040)\n/* Default: Do not restore xattrs. */\n#define\tARCHIVE_EXTRACT_XATTR \t\t\t(0x0080)\n/* Default: Do not try to guard against extracts redirected by symlinks. */\n/* Note: With ARCHIVE_EXTRACT_UNLINK, will remove any intermediate symlink. */\n#define\tARCHIVE_EXTRACT_SECURE_SYMLINKS\t\t(0x0100)\n/* Default: Do not reject entries with '..' as path elements. */\n#define\tARCHIVE_EXTRACT_SECURE_NODOTDOT\t\t(0x0200)\n/* Default: Create parent directories as needed. */\n#define\tARCHIVE_EXTRACT_NO_AUTODIR\t\t(0x0400)\n/* Default: Overwrite files, even if one on disk is newer. */\n#define\tARCHIVE_EXTRACT_NO_OVERWRITE_NEWER\t(0x0800)\n/* Detect blocks of 0 and write holes instead. */\n#define\tARCHIVE_EXTRACT_SPARSE\t\t\t(0x1000)\n\n__LA_DECL int\t archive_read_extract(struct archive *, struct archive_entry *,\n\t\t     int flags);\n__LA_DECL int\t archive_read_extract2(struct archive *, struct archive_entry *,\n\t\t     struct archive * /* dest */);\n__LA_DECL void\t archive_read_extract_set_progress_callback(struct archive *,\n\t\t     void (*_progress_func)(void *), void *_user_data);\n\n/* Record the dev/ino of a file that will not be written.  This is\n * generally set to the dev/ino of the archive being read. */\n__LA_DECL void\t\tarchive_read_extract_set_skip_file(struct archive *,\n\t\t     dev_t, ino_t);\n\n/* Close the file and release most resources. */\n__LA_DECL int\t\t archive_read_close(struct archive *);\n/* Release all resources and destroy the object. */\n/* Note that archive_read_free will call archive_read_close for you. */\n__LA_DECL int\t\t archive_read_free(struct archive *);\n#if ARCHIVE_VERSION_NUMBER < 4000000\n/* Synonym for archive_read_free() for backwards compatibility. */\n__LA_DECL int\t\t archive_read_finish(struct archive *);\n#endif\n\n/*-\n * To create an archive:\n *   1) Ask archive_write_new for a archive writer object.\n *   2) Set any global properties.  In particular, you should set\n *      the compression and format to use.\n *   3) Call archive_write_open to open the file (most people\n *       will use archive_write_open_file or archive_write_open_fd,\n *       which provide convenient canned I/O callbacks for you).\n *   4) For each entry:\n *      - construct an appropriate struct archive_entry structure\n *      - archive_write_header to write the header\n *      - archive_write_data to write the entry data\n *   5) archive_write_close to close the output\n *   6) archive_write_free to cleanup the writer and release resources\n */\n__LA_DECL struct archive\t*archive_write_new(void);\n__LA_DECL int\t\t archive_write_set_bytes_per_block(struct archive *,\n\t\t     int bytes_per_block);\n__LA_DECL int\t\t archive_write_get_bytes_per_block(struct archive *);\n/* XXX This is badly misnamed; suggestions appreciated. XXX */\n__LA_DECL int\t\t archive_write_set_bytes_in_last_block(struct archive *,\n\t\t     int bytes_in_last_block);\n__LA_DECL int\t\t archive_write_get_bytes_in_last_block(struct archive *);\n\n/* The dev/ino of a file that won't be archived.  This is used\n * to avoid recursively adding an archive to itself. */\n__LA_DECL int\t\t archive_write_set_skip_file(struct archive *, dev_t, ino_t);\n\n__LA_DECL int\t\t archive_write_set_compression_bzip2(struct archive *);\n__LA_DECL int\t\t archive_write_set_compression_compress(struct archive *);\n__LA_DECL int\t\t archive_write_set_compression_gzip(struct archive *);\n__LA_DECL int\t\t archive_write_set_compression_lzma(struct archive *);\n__LA_DECL int\t\t archive_write_set_compression_none(struct archive *);\n__LA_DECL int\t\t archive_write_set_compression_program(struct archive *,\n\t\t     const char *cmd);\n__LA_DECL int\t\t archive_write_set_compression_xz(struct archive *);\n/* A convenience function to set the format based on the code or name. */\n__LA_DECL int\t\t archive_write_set_format(struct archive *, int format_code);\n__LA_DECL int\t\t archive_write_set_format_by_name(struct archive *,\n\t\t     const char *name);\n/* To minimize link pollution, use one or more of the following. */\n__LA_DECL int\t\t archive_write_set_format_ar_bsd(struct archive *);\n__LA_DECL int\t\t archive_write_set_format_ar_svr4(struct archive *);\n__LA_DECL int\t\t archive_write_set_format_cpio(struct archive *);\n__LA_DECL int\t\t archive_write_set_format_cpio_newc(struct archive *);\n__LA_DECL int\t\t archive_write_set_format_mtree(struct archive *);\n/* TODO: int archive_write_set_format_old_tar(struct archive *); */\n__LA_DECL int\t\t archive_write_set_format_pax(struct archive *);\n__LA_DECL int\t\t archive_write_set_format_pax_restricted(struct archive *);\n__LA_DECL int\t\t archive_write_set_format_shar(struct archive *);\n__LA_DECL int\t\t archive_write_set_format_shar_dump(struct archive *);\n__LA_DECL int\t\t archive_write_set_format_ustar(struct archive *);\n__LA_DECL int\t\t archive_write_set_format_zip(struct archive *);\n__LA_DECL int\t\t archive_write_open(struct archive *, void *,\n\t\t     archive_open_callback *, archive_write_callback *,\n\t\t     archive_close_callback *);\n__LA_DECL int\t\t archive_write_open_fd(struct archive *, int _fd);\n__LA_DECL int\t\t archive_write_open_filename(struct archive *, const char *_file);\n/* A deprecated synonym for archive_write_open_filename() */\n__LA_DECL int\t\t archive_write_open_file(struct archive *, const char *_file);\n__LA_DECL int\t\t archive_write_open_FILE(struct archive *, FILE *);\n/* _buffSize is the size of the buffer, _used refers to a variable that\n * will be updated after each write into the buffer. */\n__LA_DECL int\t\t archive_write_open_memory(struct archive *,\n\t\t\tvoid *_buffer, size_t _buffSize, size_t *_used);\n\n/*\n * Note that the library will truncate writes beyond the size provided\n * to archive_write_header or pad if the provided data is short.\n */\n__LA_DECL int\t\t archive_write_header(struct archive *,\n\t\t     struct archive_entry *);\n#if ARCHIVE_VERSION_NUMBER < 2000000\n/* This was erroneously declared to return \"int\" in libarchive 1.x. */\n__LA_DECL int\t\t archive_write_data(struct archive *,\n\t\t\t    const void *, size_t);\n#else\n/* Libarchive 2.0 and later return ssize_t here. */\n__LA_DECL __LA_SSIZE_T\t archive_write_data(struct archive *,\n\t\t\t    const void *, size_t);\n#endif\n\n#if ARCHIVE_VERSION_NUMBER < 3000000\n/* Libarchive 1.x and 2.x use off_t for the argument, but that's not\n * stable on Linux. */\n__LA_DECL __LA_SSIZE_T\t archive_write_data_block(struct archive *,\n\t\t\t\t    const void *, size_t, off_t);\n#else\n/* Libarchive 3.0 uses explicit int64_t to ensure consistent 64-bit support. */\n__LA_DECL __LA_SSIZE_T\t archive_write_data_block(struct archive *,\n\t\t\t\t    const void *, size_t, __LA_INT64_T);\n#endif\n__LA_DECL int\t\t archive_write_finish_entry(struct archive *);\n__LA_DECL int\t\t archive_write_close(struct archive *);\n\n/* This can fail if the archive wasn't already closed, in which case\n * archive_write_free() will implicitly call archive_write_close(). */\n__LA_DECL int\t\t archive_write_free(struct archive *);\n#if ARCHIVE_VERSION_NUMBER < 4000000\n/* Synonym for archive_write_free() for backwards compatibility. */\n__LA_DECL int\t\t archive_write_finish(struct archive *);\n#endif\n\n/*\n * Set write options.\n */\n/* Apply option string to the format only. */\n__LA_DECL int\t\tarchive_write_set_format_options(struct archive *_a,\n\t\t\t    const char *s);\n/* Apply option string to the compressor only. */\n__LA_DECL int\t\tarchive_write_set_compressor_options(struct archive *_a,\n\t\t\t    const char *s);\n/* Apply option string to both the format and the compressor. */\n__LA_DECL int\t\tarchive_write_set_options(struct archive *_a,\n\t\t\t    const char *s);\n\n\n/*-\n * ARCHIVE_WRITE_DISK API\n *\n * To create objects on disk:\n *   1) Ask archive_write_disk_new for a new archive_write_disk object.\n *   2) Set any global properties.  In particular, you probably\n *      want to set the options.\n *   3) For each entry:\n *      - construct an appropriate struct archive_entry structure\n *      - archive_write_header to create the file/dir/etc on disk\n *      - archive_write_data to write the entry data\n *   4) archive_write_free to cleanup the writer and release resources\n *\n * In particular, you can use this in conjunction with archive_read()\n * to pull entries out of an archive and create them on disk.\n */\n__LA_DECL struct archive\t*archive_write_disk_new(void);\n/* This file will not be overwritten. */\n__LA_DECL int\t\t archive_write_disk_set_skip_file(struct archive *,\n\t\t     dev_t, ino_t);\n/* Set flags to control how the next item gets created.\n * This accepts a bitmask of ARCHIVE_EXTRACT_XXX flags defined above. */\n__LA_DECL int\t\t archive_write_disk_set_options(struct archive *,\n\t\t     int flags);\n/*\n * The lookup functions are given uname/uid (or gname/gid) pairs and\n * return a uid (gid) suitable for this system.  These are used for\n * restoring ownership and for setting ACLs.  The default functions\n * are naive, they just return the uid/gid.  These are small, so reasonable\n * for applications that don't need to preserve ownership; they\n * are probably also appropriate for applications that are doing\n * same-system backup and restore.\n */\n/*\n * The \"standard\" lookup functions use common system calls to lookup\n * the uname/gname, falling back to the uid/gid if the names can't be\n * found.  They cache lookups and are reasonably fast, but can be very\n * large, so they are not used unless you ask for them.  In\n * particular, these match the specifications of POSIX \"pax\" and old\n * POSIX \"tar\".\n */\n__LA_DECL int\t archive_write_disk_set_standard_lookup(struct archive *);\n/*\n * If neither the default (naive) nor the standard (big) functions suit\n * your needs, you can write your own and register them.  Be sure to\n * include a cleanup function if you have allocated private data.\n */\n__LA_DECL int\t archive_write_disk_set_group_lookup(struct archive *,\n\t\t\t    void * /* private_data */,\n\t\t\t    __LA_GID_T (*)(void *, const char *, __LA_GID_T),\n\t\t\t    void (* /* cleanup */)(void *));\n__LA_DECL int\t archive_write_disk_set_user_lookup(struct archive *,\n\t\t\t    void * /* private_data */,\n\t\t\t    __LA_UID_T (*)(void *, const char *, __LA_UID_T),\n\t\t\t    void (* /* cleanup */)(void *));\n\n/*\n * ARCHIVE_READ_DISK API\n *\n * This is still evolving and somewhat experimental.\n */\n__LA_DECL struct archive *archive_read_disk_new(void);\n/* The names for symlink modes here correspond to an old BSD\n * command-line argument convention: -L, -P, -H */\n/* Follow all symlinks. */\n__LA_DECL int archive_read_disk_set_symlink_logical(struct archive *);\n/* Follow no symlinks. */\n__LA_DECL int archive_read_disk_set_symlink_physical(struct archive *);\n/* Follow symlink initially, then not. */\n__LA_DECL int archive_read_disk_set_symlink_hybrid(struct archive *);\n/* TODO: Handle Linux stat32/stat64 ugliness. <sigh> */\n__LA_DECL int archive_read_disk_entry_from_file(struct archive *,\n    struct archive_entry *, int /* fd */, const struct stat *);\n/* Look up gname for gid or uname for uid. */\n/* Default implementations are very, very stupid. */\n__LA_DECL const char *archive_read_disk_gname(struct archive *, __LA_GID_T);\n__LA_DECL const char *archive_read_disk_uname(struct archive *, __LA_UID_T);\n/* \"Standard\" implementation uses getpwuid_r, getgrgid_r and caches the\n * results for performance. */\n__LA_DECL int\tarchive_read_disk_set_standard_lookup(struct archive *);\n/* You can install your own lookups if you like. */\n__LA_DECL int\tarchive_read_disk_set_gname_lookup(struct archive *,\n    void * /* private_data */,\n    const char *(* /* lookup_fn */)(void *, __LA_GID_T),\n    void (* /* cleanup_fn */)(void *));\n__LA_DECL int\tarchive_read_disk_set_uname_lookup(struct archive *,\n    void * /* private_data */,\n    const char *(* /* lookup_fn */)(void *, __LA_UID_T),\n    void (* /* cleanup_fn */)(void *));\n\n/*\n * Accessor functions to read/set various information in\n * the struct archive object:\n */\n/* Bytes written after compression or read before decompression. */\n__LA_DECL __LA_INT64_T\t archive_position_compressed(struct archive *);\n/* Bytes written to compressor or read from decompressor. */\n__LA_DECL __LA_INT64_T\t archive_position_uncompressed(struct archive *);\n\n__LA_DECL const char\t*archive_compression_name(struct archive *);\n__LA_DECL int\t\t archive_compression(struct archive *);\n__LA_DECL int\t\t archive_errno(struct archive *);\n__LA_DECL const char\t*archive_error_string(struct archive *);\n__LA_DECL const char\t*archive_format_name(struct archive *);\n__LA_DECL int\t\t archive_format(struct archive *);\n__LA_DECL void\t\t archive_clear_error(struct archive *);\n__LA_DECL void\t\t archive_set_error(struct archive *, int _err,\n\t\t\t    const char *fmt, ...);\n__LA_DECL void\t\t archive_copy_error(struct archive *dest,\n\t\t\t    struct archive *src);\n__LA_DECL int\t\t archive_file_count(struct archive *);\n\n#ifdef __cplusplus\n}\n#endif\n\n/* These are meaningless outside of this header. */\n#undef __LA_DECL\n#undef __LA_GID_T\n#undef __LA_UID_T\n\n/* These need to remain defined because they're used in the\n * callback type definitions.  XXX Fix this.  This is ugly. XXX */\n/* #undef __LA_INT64_T */\n/* #undef __LA_SSIZE_T */\n\n#endif /* !ARCHIVE_H_INCLUDED */\n"
  },
  {
    "path": "freebsd-headers/archive_entry.h",
    "content": "/*-\n * Copyright (c) 2003-2008 Tim Kientzle\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR\n * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES\n * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,\n * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF\n * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/lib/libarchive/archive_entry.h 201096 2009-12-28 02:41:27Z kientzle $\n */\n\n#ifndef ARCHIVE_ENTRY_H_INCLUDED\n#define\tARCHIVE_ENTRY_H_INCLUDED\n\n/*\n * Note: archive_entry.h is for use outside of libarchive; the\n * configuration headers (config.h, archive_platform.h, etc.) are\n * purely internal.  Do NOT use HAVE_XXX configuration macros to\n * control the behavior of this header!  If you must conditionalize,\n * use predefined compiler and/or platform macros.\n */\n\n#include <sys/types.h>\n#include <stddef.h>  /* for wchar_t */\n#include <time.h>\n\n#if defined(_WIN32) && !defined(__CYGWIN__)\n#include <windows.h>\n#endif\n\n/* Get appropriate definitions of standard POSIX-style types. */\n/* These should match the types used in 'struct stat' */\n#if defined(_WIN32) && !defined(__CYGWIN__)\n#define\t__LA_INT64_T\t__int64\n# if defined(__BORLANDC__)\n#  define\t__LA_UID_T\tuid_t\n#  define\t__LA_GID_T\tgid_t\n#  define\t__LA_DEV_T\tdev_t\n#  define\t__LA_MODE_T\tmode_t\n# else\n#  define\t__LA_UID_T\tshort\n#  define\t__LA_GID_T\tshort\n#  define\t__LA_DEV_T\tunsigned int\n#  define\t__LA_MODE_T\tunsigned short\n# endif\n#else\n#include <unistd.h>\n#define\t__LA_INT64_T\tint64_t\n#define\t__LA_UID_T\tuid_t\n#define\t__LA_GID_T\tgid_t\n#define\t__LA_DEV_T\tdev_t\n#define\t__LA_MODE_T\tmode_t\n#endif\n\n/*\n * XXX Is this defined for all Windows compilers?  If so, in what\n * header?  It would be nice to remove the __LA_INO_T indirection and\n * just use plain ino_t everywhere.  Likewise for the other types just\n * above.\n */\n#define\t__LA_INO_T\tino_t\n\n\n/*\n * On Windows, define LIBARCHIVE_STATIC if you're building or using a\n * .lib.  The default here assumes you're building a DLL.  Only\n * libarchive source should ever define __LIBARCHIVE_BUILD.\n */\n#if ((defined __WIN32__) || (defined _WIN32) || defined(__CYGWIN__)) && (!defined LIBARCHIVE_STATIC)\n# ifdef __LIBARCHIVE_BUILD\n#  ifdef __GNUC__\n#   define __LA_DECL\t__attribute__((dllexport)) extern\n#  else\n#   define __LA_DECL\t__declspec(dllexport)\n#  endif\n# else\n#  ifdef __GNUC__\n#   define __LA_DECL\t__attribute__((dllimport)) extern\n#  else\n#   define __LA_DECL\t__declspec(dllimport)\n#  endif\n# endif\n#else\n/* Static libraries on all platforms and shared libraries on non-Windows. */\n# define __LA_DECL\n#endif\n\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\n/*\n * Description of an archive entry.\n *\n * You can think of this as \"struct stat\" with some text fields added in.\n *\n * TODO: Add \"comment\", \"charset\", and possibly other entries that are\n * supported by \"pax interchange\" format.  However, GNU, ustar, cpio,\n * and other variants don't support these features, so they're not an\n * excruciatingly high priority right now.\n *\n * TODO: \"pax interchange\" format allows essentially arbitrary\n * key/value attributes to be attached to any entry.  Supporting\n * such extensions may make this library useful for special\n * applications (e.g., a package manager could attach special\n * package-management attributes to each entry).\n */\nstruct archive_entry;\n\n/*\n * File-type constants.  These are returned from archive_entry_filetype()\n * and passed to archive_entry_set_filetype().\n *\n * These values match S_XXX defines on every platform I've checked,\n * including Windows, AIX, Linux, Solaris, and BSD.  They're\n * (re)defined here because platforms generally don't define the ones\n * they don't support.  For example, Windows doesn't define S_IFLNK or\n * S_IFBLK.  Instead of having a mass of conditional logic and system\n * checks to define any S_XXX values that aren't supported locally,\n * I've just defined a new set of such constants so that\n * libarchive-based applications can manipulate and identify archive\n * entries properly even if the hosting platform can't store them on\n * disk.\n *\n * These values are also used directly within some portable formats,\n * such as cpio.  If you find a platform that varies from these, the\n * correct solution is to leave these alone and translate from these\n * portable values to platform-native values when entries are read from\n * or written to disk.\n */\n#define\tAE_IFMT\t\t0170000\n#define\tAE_IFREG\t0100000\n#define\tAE_IFLNK\t0120000\n#define\tAE_IFSOCK\t0140000\n#define\tAE_IFCHR\t0020000\n#define\tAE_IFBLK\t0060000\n#define\tAE_IFDIR\t0040000\n#define\tAE_IFIFO\t0010000\n\n/*\n * Basic object manipulation\n */\n\n__LA_DECL struct archive_entry\t*archive_entry_clear(struct archive_entry *);\n/* The 'clone' function does a deep copy; all of the strings are copied too. */\n__LA_DECL struct archive_entry\t*archive_entry_clone(struct archive_entry *);\n__LA_DECL void\t\t\t archive_entry_free(struct archive_entry *);\n__LA_DECL struct archive_entry\t*archive_entry_new(void);\n\n/*\n * Retrieve fields from an archive_entry.\n *\n * There are a number of implicit conversions among these fields.  For\n * example, if a regular string field is set and you read the _w wide\n * character field, the entry will implicitly convert narrow-to-wide\n * using the current locale.  Similarly, dev values are automatically\n * updated when you write devmajor or devminor and vice versa.\n *\n * In addition, fields can be \"set\" or \"unset.\"  Unset string fields\n * return NULL, non-string fields have _is_set() functions to test\n * whether they've been set.  You can \"unset\" a string field by\n * assigning NULL; non-string fields have _unset() functions to\n * unset them.\n *\n * Note: There is one ambiguity in the above; string fields will\n * also return NULL when implicit character set conversions fail.\n * This is usually what you want.\n */\n__LA_DECL time_t\t archive_entry_atime(struct archive_entry *);\n__LA_DECL long\t\t archive_entry_atime_nsec(struct archive_entry *);\n__LA_DECL int\t\t archive_entry_atime_is_set(struct archive_entry *);\n__LA_DECL time_t\t archive_entry_birthtime(struct archive_entry *);\n__LA_DECL long\t\t archive_entry_birthtime_nsec(struct archive_entry *);\n__LA_DECL int\t\t archive_entry_birthtime_is_set(struct archive_entry *);\n__LA_DECL time_t\t archive_entry_ctime(struct archive_entry *);\n__LA_DECL long\t\t archive_entry_ctime_nsec(struct archive_entry *);\n__LA_DECL int\t\t archive_entry_ctime_is_set(struct archive_entry *);\n__LA_DECL dev_t\t\t archive_entry_dev(struct archive_entry *);\n__LA_DECL dev_t\t\t archive_entry_devmajor(struct archive_entry *);\n__LA_DECL dev_t\t\t archive_entry_devminor(struct archive_entry *);\n__LA_DECL __LA_MODE_T\t archive_entry_filetype(struct archive_entry *);\n__LA_DECL void\t\t archive_entry_fflags(struct archive_entry *,\n\t\t\t    unsigned long * /* set */,\n\t\t\t    unsigned long * /* clear */);\n__LA_DECL const char\t*archive_entry_fflags_text(struct archive_entry *);\n__LA_DECL __LA_GID_T\t archive_entry_gid(struct archive_entry *);\n__LA_DECL const char\t*archive_entry_gname(struct archive_entry *);\n__LA_DECL const wchar_t\t*archive_entry_gname_w(struct archive_entry *);\n__LA_DECL const char\t*archive_entry_hardlink(struct archive_entry *);\n__LA_DECL const wchar_t\t*archive_entry_hardlink_w(struct archive_entry *);\n__LA_DECL __LA_INO_T\t archive_entry_ino(struct archive_entry *);\n__LA_DECL __LA_INT64_T\t archive_entry_ino64(struct archive_entry *);\n__LA_DECL __LA_MODE_T\t archive_entry_mode(struct archive_entry *);\n__LA_DECL time_t\t archive_entry_mtime(struct archive_entry *);\n__LA_DECL long\t\t archive_entry_mtime_nsec(struct archive_entry *);\n__LA_DECL int\t\t archive_entry_mtime_is_set(struct archive_entry *);\n__LA_DECL unsigned int\t archive_entry_nlink(struct archive_entry *);\n__LA_DECL const char\t*archive_entry_pathname(struct archive_entry *);\n__LA_DECL const wchar_t\t*archive_entry_pathname_w(struct archive_entry *);\n__LA_DECL dev_t\t\t archive_entry_rdev(struct archive_entry *);\n__LA_DECL dev_t\t\t archive_entry_rdevmajor(struct archive_entry *);\n__LA_DECL dev_t\t\t archive_entry_rdevminor(struct archive_entry *);\n__LA_DECL const char\t*archive_entry_sourcepath(struct archive_entry *);\n__LA_DECL __LA_INT64_T\t archive_entry_size(struct archive_entry *);\n__LA_DECL int\t\t archive_entry_size_is_set(struct archive_entry *);\n__LA_DECL const char\t*archive_entry_strmode(struct archive_entry *);\n__LA_DECL const char\t*archive_entry_symlink(struct archive_entry *);\n__LA_DECL const wchar_t\t*archive_entry_symlink_w(struct archive_entry *);\n__LA_DECL __LA_UID_T\t archive_entry_uid(struct archive_entry *);\n__LA_DECL const char\t*archive_entry_uname(struct archive_entry *);\n__LA_DECL const wchar_t\t*archive_entry_uname_w(struct archive_entry *);\n\n/*\n * Set fields in an archive_entry.\n *\n * Note that string 'set' functions do not copy the string, only the pointer.\n * In contrast, 'copy' functions do copy the object pointed to.\n *\n * Note: As of libarchive 2.4, 'set' functions do copy the string and\n * are therefore exact synonyms for the 'copy' versions.  The 'copy'\n * names will be retired in libarchive 3.0.\n */\n\n__LA_DECL void\tarchive_entry_set_atime(struct archive_entry *, time_t, long);\n__LA_DECL void  archive_entry_unset_atime(struct archive_entry *);\n#if defined(_WIN32) && !defined(__CYGWIN__)\n__LA_DECL void archive_entry_copy_bhfi(struct archive_entry *,\n\t\t\t\t\t\t\t\t\t   BY_HANDLE_FILE_INFORMATION *);\n#endif\n__LA_DECL void\tarchive_entry_set_birthtime(struct archive_entry *, time_t, long);\n__LA_DECL void  archive_entry_unset_birthtime(struct archive_entry *);\n__LA_DECL void\tarchive_entry_set_ctime(struct archive_entry *, time_t, long);\n__LA_DECL void  archive_entry_unset_ctime(struct archive_entry *);\n__LA_DECL void\tarchive_entry_set_dev(struct archive_entry *, dev_t);\n__LA_DECL void\tarchive_entry_set_devmajor(struct archive_entry *, dev_t);\n__LA_DECL void\tarchive_entry_set_devminor(struct archive_entry *, dev_t);\n__LA_DECL void\tarchive_entry_set_filetype(struct archive_entry *, unsigned int);\n__LA_DECL void\tarchive_entry_set_fflags(struct archive_entry *,\n\t    unsigned long /* set */, unsigned long /* clear */);\n/* Returns pointer to start of first invalid token, or NULL if none. */\n/* Note that all recognized tokens are processed, regardless. */\n__LA_DECL const char *archive_entry_copy_fflags_text(struct archive_entry *,\n\t    const char *);\n__LA_DECL const wchar_t *archive_entry_copy_fflags_text_w(struct archive_entry *,\n\t    const wchar_t *);\n__LA_DECL void\tarchive_entry_set_gid(struct archive_entry *, __LA_GID_T);\n__LA_DECL void\tarchive_entry_set_gname(struct archive_entry *, const char *);\n__LA_DECL void\tarchive_entry_copy_gname(struct archive_entry *, const char *);\n__LA_DECL void\tarchive_entry_copy_gname_w(struct archive_entry *, const wchar_t *);\n__LA_DECL int\tarchive_entry_update_gname_utf8(struct archive_entry *, const char *);\n__LA_DECL void\tarchive_entry_set_hardlink(struct archive_entry *, const char *);\n__LA_DECL void\tarchive_entry_copy_hardlink(struct archive_entry *, const char *);\n__LA_DECL void\tarchive_entry_copy_hardlink_w(struct archive_entry *, const wchar_t *);\n__LA_DECL int\tarchive_entry_update_hardlink_utf8(struct archive_entry *, const char *);\n#if ARCHIVE_VERSION_NUMBER >= 3000000\n/* Starting with libarchive 3.0, this will be synonym for ino64. */\n__LA_DECL void\tarchive_entry_set_ino(struct archive_entry *, __LA_INT64_T);\n#else\n__LA_DECL void\tarchive_entry_set_ino(struct archive_entry *, unsigned long);\n#endif\n__LA_DECL void\tarchive_entry_set_ino64(struct archive_entry *, __LA_INT64_T);\n__LA_DECL void\tarchive_entry_set_link(struct archive_entry *, const char *);\n__LA_DECL void\tarchive_entry_copy_link(struct archive_entry *, const char *);\n__LA_DECL void\tarchive_entry_copy_link_w(struct archive_entry *, const wchar_t *);\n__LA_DECL int\tarchive_entry_update_link_utf8(struct archive_entry *, const char *);\n__LA_DECL void\tarchive_entry_set_mode(struct archive_entry *, __LA_MODE_T);\n__LA_DECL void\tarchive_entry_set_mtime(struct archive_entry *, time_t, long);\n__LA_DECL void  archive_entry_unset_mtime(struct archive_entry *);\n__LA_DECL void\tarchive_entry_set_nlink(struct archive_entry *, unsigned int);\n__LA_DECL void\tarchive_entry_set_pathname(struct archive_entry *, const char *);\n__LA_DECL void\tarchive_entry_copy_pathname(struct archive_entry *, const char *);\n__LA_DECL void\tarchive_entry_copy_pathname_w(struct archive_entry *, const wchar_t *);\n__LA_DECL int\tarchive_entry_update_pathname_utf8(struct archive_entry *, const char *);\n__LA_DECL void\tarchive_entry_set_perm(struct archive_entry *, __LA_MODE_T);\n__LA_DECL void\tarchive_entry_set_rdev(struct archive_entry *, dev_t);\n__LA_DECL void\tarchive_entry_set_rdevmajor(struct archive_entry *, dev_t);\n__LA_DECL void\tarchive_entry_set_rdevminor(struct archive_entry *, dev_t);\n__LA_DECL void\tarchive_entry_set_size(struct archive_entry *, __LA_INT64_T);\n__LA_DECL void\tarchive_entry_unset_size(struct archive_entry *);\n__LA_DECL void\tarchive_entry_copy_sourcepath(struct archive_entry *, const char *);\n__LA_DECL void\tarchive_entry_set_symlink(struct archive_entry *, const char *);\n__LA_DECL void\tarchive_entry_copy_symlink(struct archive_entry *, const char *);\n__LA_DECL void\tarchive_entry_copy_symlink_w(struct archive_entry *, const wchar_t *);\n__LA_DECL int\tarchive_entry_update_symlink_utf8(struct archive_entry *, const char *);\n__LA_DECL void\tarchive_entry_set_uid(struct archive_entry *, __LA_UID_T);\n__LA_DECL void\tarchive_entry_set_uname(struct archive_entry *, const char *);\n__LA_DECL void\tarchive_entry_copy_uname(struct archive_entry *, const char *);\n__LA_DECL void\tarchive_entry_copy_uname_w(struct archive_entry *, const wchar_t *);\n__LA_DECL int\tarchive_entry_update_uname_utf8(struct archive_entry *, const char *);\n/*\n * Routines to bulk copy fields to/from a platform-native \"struct\n * stat.\"  Libarchive used to just store a struct stat inside of each\n * archive_entry object, but this created issues when trying to\n * manipulate archives on systems different than the ones they were\n * created on.\n *\n * TODO: On Linux, provide both stat32 and stat64 versions of these functions.\n */\n__LA_DECL const struct stat\t*archive_entry_stat(struct archive_entry *);\n__LA_DECL void\tarchive_entry_copy_stat(struct archive_entry *, const struct stat *);\n\n\n/*\n * ACL routines.  This used to simply store and return text-format ACL\n * strings, but that proved insufficient for a number of reasons:\n *   = clients need control over uname/uid and gname/gid mappings\n *   = there are many different ACL text formats\n *   = would like to be able to read/convert archives containing ACLs\n *     on platforms that lack ACL libraries\n *\n *  This last point, in particular, forces me to implement a reasonably\n *  complete set of ACL support routines.\n *\n *  TODO: Extend this to support NFSv4/NTFS permissions.  That should\n *  allow full ACL support on Mac OS, in particular, which uses\n *  POSIX.1e-style interfaces to manipulate NFSv4/NTFS permissions.\n */\n\n/*\n * Permission bits mimic POSIX.1e.  Note that I've not followed POSIX.1e's\n * \"permset\"/\"perm\" abstract type nonsense.  A permset is just a simple\n * bitmap, following long-standing Unix tradition.\n */\n#define\tARCHIVE_ENTRY_ACL_EXECUTE\t1\n#define\tARCHIVE_ENTRY_ACL_WRITE\t\t2\n#define\tARCHIVE_ENTRY_ACL_READ\t\t4\n\n/* We need to be able to specify either or both of these. */\n#define\tARCHIVE_ENTRY_ACL_TYPE_ACCESS\t256\n#define\tARCHIVE_ENTRY_ACL_TYPE_DEFAULT\t512\n\n/* Tag values mimic POSIX.1e */\n#define\tARCHIVE_ENTRY_ACL_USER\t\t10001\t/* Specified user. */\n#define\tARCHIVE_ENTRY_ACL_USER_OBJ \t10002\t/* User who owns the file. */\n#define\tARCHIVE_ENTRY_ACL_GROUP\t\t10003\t/* Specified group. */\n#define\tARCHIVE_ENTRY_ACL_GROUP_OBJ\t10004\t/* Group who owns the file. */\n#define\tARCHIVE_ENTRY_ACL_MASK\t\t10005\t/* Modify group access. */\n#define\tARCHIVE_ENTRY_ACL_OTHER\t\t10006\t/* Public. */\n\n/*\n * Set the ACL by clearing it and adding entries one at a time.\n * Unlike the POSIX.1e ACL routines, you must specify the type\n * (access/default) for each entry.  Internally, the ACL data is just\n * a soup of entries.  API calls here allow you to retrieve just the\n * entries of interest.  This design (which goes against the spirit of\n * POSIX.1e) is useful for handling archive formats that combine\n * default and access information in a single ACL list.\n */\n__LA_DECL void\t archive_entry_acl_clear(struct archive_entry *);\n__LA_DECL void\t archive_entry_acl_add_entry(struct archive_entry *,\n\t    int /* type */, int /* permset */, int /* tag */,\n\t    int /* qual */, const char * /* name */);\n__LA_DECL void\t archive_entry_acl_add_entry_w(struct archive_entry *,\n\t    int /* type */, int /* permset */, int /* tag */,\n\t    int /* qual */, const wchar_t * /* name */);\n\n/*\n * To retrieve the ACL, first \"reset\", then repeatedly ask for the\n * \"next\" entry.  The want_type parameter allows you to request only\n * access entries or only default entries.\n */\n__LA_DECL int\t archive_entry_acl_reset(struct archive_entry *, int /* want_type */);\n__LA_DECL int\t archive_entry_acl_next(struct archive_entry *, int /* want_type */,\n\t    int * /* type */, int * /* permset */, int * /* tag */,\n\t    int * /* qual */, const char ** /* name */);\n__LA_DECL int\t archive_entry_acl_next_w(struct archive_entry *, int /* want_type */,\n\t    int * /* type */, int * /* permset */, int * /* tag */,\n\t    int * /* qual */, const wchar_t ** /* name */);\n\n/*\n * Construct a text-format ACL.  The flags argument is a bitmask that\n * can include any of the following:\n *\n * ARCHIVE_ENTRY_ACL_TYPE_ACCESS - Include access entries.\n * ARCHIVE_ENTRY_ACL_TYPE_DEFAULT - Include default entries.\n * ARCHIVE_ENTRY_ACL_STYLE_EXTRA_ID - Include extra numeric ID field in\n *    each ACL entry.  (As used by 'star'.)\n * ARCHIVE_ENTRY_ACL_STYLE_MARK_DEFAULT - Include \"default:\" before each\n *    default ACL entry.\n */\n#define\tARCHIVE_ENTRY_ACL_STYLE_EXTRA_ID\t1024\n#define\tARCHIVE_ENTRY_ACL_STYLE_MARK_DEFAULT\t2048\n__LA_DECL const wchar_t\t*archive_entry_acl_text_w(struct archive_entry *,\n\t\t    int /* flags */);\n\n/* Return a count of entries matching 'want_type' */\n__LA_DECL int\t archive_entry_acl_count(struct archive_entry *, int /* want_type */);\n\n/*\n * Private ACL parser.  This is private because it handles some\n * very weird formats that clients should not be messing with.\n * Clients should only deal with their platform-native formats.\n * Because of the need to support many formats cleanly, new arguments\n * are likely to get added on a regular basis.  Clients who try to use\n * this interface are likely to be surprised when it changes.\n *\n * You were warned!\n *\n * TODO: Move this declaration out of the public header and into\n * a private header.  Warnings above are silly.\n */\n__LA_DECL int\t\t __archive_entry_acl_parse_w(struct archive_entry *,\n\t\t    const wchar_t *, int /* type */);\n\n/*\n * extended attributes\n */\n\n__LA_DECL void\t archive_entry_xattr_clear(struct archive_entry *);\n__LA_DECL void\t archive_entry_xattr_add_entry(struct archive_entry *,\n\t    const char * /* name */, const void * /* value */,\n\t    size_t /* size */);\n\n/*\n * To retrieve the xattr list, first \"reset\", then repeatedly ask for the\n * \"next\" entry.\n */\n\n__LA_DECL int\tarchive_entry_xattr_count(struct archive_entry *);\n__LA_DECL int\tarchive_entry_xattr_reset(struct archive_entry *);\n__LA_DECL int\tarchive_entry_xattr_next(struct archive_entry *,\n\t    const char ** /* name */, const void ** /* value */, size_t *);\n\n/*\n * Utility to match up hardlinks.\n *\n * The 'struct archive_entry_linkresolver' is a cache of archive entries\n * for files with multiple links.  Here's how to use it:\n *   1. Create a lookup object with archive_entry_linkresolver_new()\n *   2. Tell it the archive format you're using.\n *   3. Hand each archive_entry to archive_entry_linkify().\n *      That function will return 0, 1, or 2 entries that should\n *      be written.\n *   4. Call archive_entry_linkify(resolver, NULL) until\n *      no more entries are returned.\n *   5. Call archive_entry_link_resolver_free(resolver) to free resources.\n *\n * The entries returned have their hardlink and size fields updated\n * appropriately.  If an entry is passed in that does not refer to\n * a file with multiple links, it is returned unchanged.  The intention\n * is that you should be able to simply filter all entries through\n * this machine.\n *\n * To make things more efficient, be sure that each entry has a valid\n * nlinks value.  The hardlink cache uses this to track when all links\n * have been found.  If the nlinks value is zero, it will keep every\n * name in the cache indefinitely, which can use a lot of memory.\n *\n * Note that archive_entry_size() is reset to zero if the file\n * body should not be written to the archive.  Pay attention!\n */\nstruct archive_entry_linkresolver;\n\n/*\n * There are three different strategies for marking hardlinks.\n * The descriptions below name them after the best-known\n * formats that rely on each strategy:\n *\n * \"Old cpio\" is the simplest, it always returns any entry unmodified.\n *    As far as I know, only cpio formats use this.  Old cpio archives\n *    store every link with the full body; the onus is on the dearchiver\n *    to detect and properly link the files as they are restored.\n * \"tar\" is also pretty simple; it caches a copy the first time it sees\n *    any link.  Subsequent appearances are modified to be hardlink\n *    references to the first one without any body.  Used by all tar\n *    formats, although the newest tar formats permit the \"old cpio\" strategy\n *    as well.  This strategy is very simple for the dearchiver,\n *    and reasonably straightforward for the archiver.\n * \"new cpio\" is trickier.  It stores the body only with the last\n *    occurrence.  The complication is that we might not\n *    see every link to a particular file in a single session, so\n *    there's no easy way to know when we've seen the last occurrence.\n *    The solution here is to queue one link until we see the next.\n *    At the end of the session, you can enumerate any remaining\n *    entries by calling archive_entry_linkify(NULL) and store those\n *    bodies.  If you have a file with three links l1, l2, and l3,\n *    you'll get the following behavior if you see all three links:\n *           linkify(l1) => NULL   (the resolver stores l1 internally)\n *           linkify(l2) => l1     (resolver stores l2, you write l1)\n *           linkify(l3) => l2, l3 (all links seen, you can write both).\n *    If you only see l1 and l2, you'll get this behavior:\n *           linkify(l1) => NULL\n *           linkify(l2) => l1\n *           linkify(NULL) => l2   (at end, you retrieve remaining links)\n *    As the name suggests, this strategy is used by newer cpio variants.\n *    It's noticably more complex for the archiver, slightly more complex\n *    for the dearchiver than the tar strategy, but makes it straightforward\n *    to restore a file using any link by simply continuing to scan until\n *    you see a link that is stored with a body.  In contrast, the tar\n *    strategy requires you to rescan the archive from the beginning to\n *    correctly extract an arbitrary link.\n */\n\n__LA_DECL struct archive_entry_linkresolver *archive_entry_linkresolver_new(void);\n__LA_DECL void archive_entry_linkresolver_set_strategy(\n\tstruct archive_entry_linkresolver *, int /* format_code */);\n__LA_DECL void archive_entry_linkresolver_free(struct archive_entry_linkresolver *);\n__LA_DECL void archive_entry_linkify(struct archive_entry_linkresolver *,\n    struct archive_entry **, struct archive_entry **);\n\n#ifdef __cplusplus\n}\n#endif\n\n/* This is meaningless outside of this header. */\n#undef __LA_DECL\n\n#endif /* !ARCHIVE_ENTRY_H_INCLUDED */\n"
  },
  {
    "path": "freebsd-headers/arpa/ftp.h",
    "content": "/*\n * Copyright (c) 1983, 1989, 1993\n *\tThe Regents of the University of California.  All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t@(#)ftp.h\t8.1 (Berkeley) 6/2/93\n *\n * $FreeBSD: release/9.0.0/include/arpa/ftp.h 203965 2010-02-16 19:46:46Z imp $\n */\n\n#ifndef _ARPA_FTP_H_\n#define\t_ARPA_FTP_H_\n\n/* Definitions for FTP; see RFC-765. */\n\n/*\n * Reply codes.\n */\n#define PRELIM\t\t1\t/* positive preliminary */\n#define COMPLETE\t2\t/* positive completion */\n#define CONTINUE\t3\t/* positive intermediate */\n#define TRANSIENT\t4\t/* transient negative completion */\n#define ERROR\t\t5\t/* permanent negative completion */\n\n/*\n * Type codes\n */\n#define\tTYPE_A\t\t1\t/* ASCII */\n#define\tTYPE_E\t\t2\t/* EBCDIC */\n#define\tTYPE_I\t\t3\t/* image */\n#define\tTYPE_L\t\t4\t/* local byte size */\n\n#ifdef FTP_NAMES\nchar *typenames[] =  {\"0\", \"ASCII\", \"EBCDIC\", \"Image\", \"Local\" };\n#endif\n\n/*\n * Form codes\n */\n#define\tFORM_N\t\t1\t/* non-print */\n#define\tFORM_T\t\t2\t/* telnet format effectors */\n#define\tFORM_C\t\t3\t/* carriage control (ASA) */\n#ifdef FTP_NAMES\nchar *formnames[] =  {\"0\", \"Nonprint\", \"Telnet\", \"Carriage-control\" };\n#endif\n\n/*\n * Structure codes\n */\n#define\tSTRU_F\t\t1\t/* file (no record structure) */\n#define\tSTRU_R\t\t2\t/* record structure */\n#define\tSTRU_P\t\t3\t/* page structure */\n#ifdef FTP_NAMES\nchar *strunames[] =  {\"0\", \"File\", \"Record\", \"Page\" };\n#endif\n\n/*\n * Mode types\n */\n#define\tMODE_S\t\t1\t/* stream */\n#define\tMODE_B\t\t2\t/* block */\n#define\tMODE_C\t\t3\t/* compressed */\n#ifdef FTP_NAMES\nchar *modenames[] =  {\"0\", \"Stream\", \"Block\", \"Compressed\" };\n#endif\n\n/*\n * Record Tokens\n */\n#define\tREC_ESC\t\t'\\377'\t/* Record-mode Escape */\n#define\tREC_EOR\t\t'\\001'\t/* Record-mode End-of-Record */\n#define REC_EOF\t\t'\\002'\t/* Record-mode End-of-File */\n\n/*\n * Block Header\n */\n#define\tBLK_EOR\t\t0x80\t/* Block is End-of-Record */\n#define\tBLK_EOF\t\t0x40\t/* Block is End-of-File */\n#define BLK_ERRORS\t0x20\t/* Block is suspected of containing errors */\n#define\tBLK_RESTART\t0x10\t/* Block is Restart Marker */\n\n#define\tBLK_BYTECOUNT\t2\t/* Bytes in this block */\n\n#endif /* !_FTP_H_ */\n"
  },
  {
    "path": "freebsd-headers/arpa/inet.h",
    "content": "/*\n * ++Copyright++ 1983, 1993\n * -\n * Copyright (c) 1983, 1993\n *    The Regents of the University of California.  All rights reserved.\n * \n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n * \n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n * -\n * Portions Copyright (c) 1993 by Digital Equipment Corporation.\n * \n * Permission to use, copy, modify, and distribute this software for any\n * purpose with or without fee is hereby granted, provided that the above\n * copyright notice and this permission notice appear in all copies, and that\n * the name of Digital Equipment Corporation not be used in advertising or\n * publicity pertaining to distribution of the document or software without\n * specific, written prior permission.\n * \n * THE SOFTWARE IS PROVIDED \"AS IS\" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL\n * WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES\n * OF MERCHANTABILITY AND FITNESS.   IN NO EVENT SHALL DIGITAL EQUIPMENT\n * CORPORATION BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL\n * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR\n * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS\n * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS\n * SOFTWARE.\n * -\n * --Copyright--\n */\n\n/*%\n *\t@(#)inet.h\t8.1 (Berkeley) 6/2/93\n *\t$Id: inet.h,v 1.2.18.1 2005/04/27 05:00:50 sra Exp $\n * $FreeBSD: release/9.0.0/include/arpa/inet.h 209715 2010-07-06 03:48:46Z maxim $\n */\n\n#ifndef _ARPA_INET_H_\n#define\t_ARPA_INET_H_\n\n/* External definitions for functions in inet(3). */\n\n#include <sys/cdefs.h>\n#include <sys/_types.h>\n\n/* Required for byteorder(3) functions. */\n#include <machine/endian.h>\n\n#define\tINET_ADDRSTRLEN\t\t16\n#define\tINET6_ADDRSTRLEN\t46\n\n#ifndef _UINT16_T_DECLARED\ntypedef\t__uint16_t\tuint16_t;\n#define\t_UINT16_T_DECLARED\n#endif\n\n#ifndef _UINT32_T_DECLARED\ntypedef\t__uint32_t\tuint32_t;\n#define\t_UINT32_T_DECLARED\n#endif\n\n#ifndef _IN_ADDR_T_DECLARED\ntypedef\tuint32_t\tin_addr_t;\n#define\t_IN_ADDR_T_DECLARED\n#endif\n\n#ifndef _IN_PORT_T_DECLARED\ntypedef\tuint16_t\tin_port_t;\n#define\t_IN_PORT_T_DECLARED\n#endif\n\n#if __BSD_VISIBLE\n#ifndef _SIZE_T_DECLARED\ntypedef\t__size_t\tsize_t;\n#define\t_SIZE_T_DECLARED\n#endif\n#endif\n\n/*\n * XXX socklen_t is used by a POSIX.1-2001 interface, but not required by\n * POSIX.1-2001.\n */\n#ifndef _SOCKLEN_T_DECLARED\ntypedef\t__socklen_t\tsocklen_t;\n#define\t_SOCKLEN_T_DECLARED\n#endif\n\n#ifndef _STRUCT_IN_ADDR_DECLARED\nstruct in_addr {\n\tin_addr_t s_addr;\n};\n#define\t_STRUCT_IN_ADDR_DECLARED\n#endif\n\n/* XXX all new diversions!! argh!! */\n#if __BSD_VISIBLE\n#define\tinet_addr\t\t__inet_addr\n#define\tinet_aton\t\t__inet_aton\n#define\tinet_lnaof\t\t__inet_lnaof\n#define\tinet_makeaddr\t\t__inet_makeaddr\n#define\tinet_neta\t\t__inet_neta\n#define\tinet_netof\t\t__inet_netof\n#define\tinet_network\t\t__inet_network\n#define\tinet_net_ntop\t\t__inet_net_ntop\n#define\tinet_net_pton\t\t__inet_net_pton\n#define\tinet_cidr_ntop\t\t__inet_cidr_ntop\n#define\tinet_cidr_pton\t\t__inet_cidr_pton\n#define\tinet_ntoa\t\t__inet_ntoa\n#define\tinet_ntoa_r\t\t__inet_ntoa_r\n#define\tinet_pton\t\t__inet_pton\n#define\tinet_ntop\t\t__inet_ntop\n#define\tinet_nsap_addr\t\t__inet_nsap_addr\n#define\tinet_nsap_ntoa\t\t__inet_nsap_ntoa\n#endif /* __BSD_VISIBLE */\n\n__BEGIN_DECLS\n#ifndef _BYTEORDER_PROTOTYPED\n#define\t_BYTEORDER_PROTOTYPED\nuint32_t\t htonl(uint32_t);\nuint16_t\t htons(uint16_t);\nuint32_t\t ntohl(uint32_t);\nuint16_t\t ntohs(uint16_t);\n#endif\n\nin_addr_t\t inet_addr(const char *);\n/*const*/ char\t*inet_ntoa(struct in_addr);\nconst char\t*inet_ntop(int, const void * __restrict, char * __restrict,\n\t\t    socklen_t);\nint\t\t inet_pton(int, const char * __restrict, void * __restrict);\n\n#if __BSD_VISIBLE\nint\t\t inet_aton(const char *, struct in_addr *);\nin_addr_t\t inet_lnaof(struct in_addr);\nstruct in_addr\t inet_makeaddr(in_addr_t, in_addr_t);\nchar *\t\t inet_neta(in_addr_t, char *, size_t);\nin_addr_t\t inet_netof(struct in_addr);\nin_addr_t\t inet_network(const char *);\nchar\t\t*inet_net_ntop(int, const void *, int, char *, size_t);\nint\t\t inet_net_pton(int, const char *, void *, size_t);\nchar\t\t*inet_ntoa_r(struct in_addr, char *buf, socklen_t size);\nchar\t\t*inet_cidr_ntop(int, const void *, int, char *, size_t);\nint\t\t inet_cidr_pton(int, const char *, void *, int *);\nunsigned\t inet_nsap_addr(const char *, unsigned char *, int);\nchar\t\t*inet_nsap_ntoa(int, const unsigned char *, char *);\n#endif /* __BSD_VISIBLE */\n__END_DECLS\n\n#ifndef _BYTEORDER_FUNC_DEFINED\n#define\t_BYTEORDER_FUNC_DEFINED\n#define\thtonl(x)\t__htonl(x)\n#define\thtons(x)\t__htons(x)\n#define\tntohl(x)\t__ntohl(x)\n#define\tntohs(x)\t__ntohs(x)\n#endif\n\n#endif /* !_ARPA_INET_H_ */\n\n/*! \\file */\n"
  },
  {
    "path": "freebsd-headers/arpa/nameser.h",
    "content": "/*\n * Copyright (c) 1983, 1989, 1993\n *    The Regents of the University of California.  All rights reserved.\n * \n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n * \n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n */\n\n/*\n * Copyright (c) 2004 by Internet Systems Consortium, Inc. (\"ISC\")\n * Copyright (c) 1996-1999 by Internet Software Consortium.\n *\n * Permission to use, copy, modify, and distribute this software for any\n * purpose with or without fee is hereby granted, provided that the above\n * copyright notice and this permission notice appear in all copies.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\" AND ISC DISCLAIMS ALL WARRANTIES\n * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF\n * MERCHANTABILITY AND FITNESS.  IN NO EVENT SHALL ISC BE LIABLE FOR\n * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES\n * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN\n * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT\n * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.\n */\n\n/*\n *\t$Id: nameser.h,v 1.7.18.2 2008/04/03 23:15:15 marka Exp $\n * $FreeBSD: release/9.0.0/include/arpa/nameser.h 203965 2010-02-16 19:46:46Z imp $\n */\n\n#ifndef _ARPA_NAMESER_H_\n#define _ARPA_NAMESER_H_\n\n/*! \\file */\n\n#define BIND_4_COMPAT\n\n#include <sys/param.h>\n#include <sys/types.h>\n#include <sys/cdefs.h>\n\n/*%\n * Revision information.  This is the release date in YYYYMMDD format.\n * It can change every day so the right thing to do with it is use it\n * in preprocessor commands such as \"#if (__NAMESER > 19931104)\".  Do not\n * compare for equality; rather, use it to determine whether your libbind.a\n * contains a new enough lib/nameser/ to support the feature you need.\n */\n\n#define __NAMESER\t19991006\t/*%< New interface version stamp. */\n/*\n * Define constants based on RFC0883, RFC1034, RFC 1035\n */\n#define NS_PACKETSZ\t512\t/*%< default UDP packet size */\n#define NS_MAXDNAME\t1025\t/*%< maximum domain name */\n#define NS_MAXMSG\t65535\t/*%< maximum message size */\n#define NS_MAXCDNAME\t255\t/*%< maximum compressed domain name */\n#define NS_MAXLABEL\t63\t/*%< maximum length of domain label */\n#define NS_HFIXEDSZ\t12\t/*%< #/bytes of fixed data in header */\n#define NS_QFIXEDSZ\t4\t/*%< #/bytes of fixed data in query */\n#define NS_RRFIXEDSZ\t10\t/*%< #/bytes of fixed data in r record */\n#define NS_INT32SZ\t4\t/*%< #/bytes of data in a u_int32_t */\n#define NS_INT16SZ\t2\t/*%< #/bytes of data in a u_int16_t */\n#define NS_INT8SZ\t1\t/*%< #/bytes of data in a u_int8_t */\n#define NS_INADDRSZ\t4\t/*%< IPv4 T_A */\n#define NS_IN6ADDRSZ\t16\t/*%< IPv6 T_AAAA */\n#define NS_CMPRSFLGS\t0xc0\t/*%< Flag bits indicating name compression. */\n#define NS_DEFAULTPORT\t53\t/*%< For both TCP and UDP. */\n/*\n * These can be expanded with synonyms, just keep ns_parse.c:ns_parserecord()\n * in synch with it.\n */\ntypedef enum __ns_sect {\n\tns_s_qd = 0,\t\t/*%< Query: Question. */\n\tns_s_zn = 0,\t\t/*%< Update: Zone. */\n\tns_s_an = 1,\t\t/*%< Query: Answer. */\n\tns_s_pr = 1,\t\t/*%< Update: Prerequisites. */\n\tns_s_ns = 2,\t\t/*%< Query: Name servers. */\n\tns_s_ud = 2,\t\t/*%< Update: Update. */\n\tns_s_ar = 3,\t\t/*%< Query|Update: Additional records. */\n\tns_s_max = 4\n} ns_sect;\n\n/*%\n * This is a message handle.  It is caller allocated and has no dynamic data.\n * This structure is intended to be opaque to all but ns_parse.c, thus the\n * leading _'s on the member names.  Use the accessor functions, not the _'s.\n */\ntypedef struct __ns_msg {\n\tconst u_char\t*_msg, *_eom;\n\tu_int16_t\t_id, _flags, _counts[ns_s_max];\n\tconst u_char\t*_sections[ns_s_max];\n\tns_sect\t\t_sect;\n\tint\t\t_rrnum;\n\tconst u_char\t*_msg_ptr;\n} ns_msg;\n\n/* Private data structure - do not use from outside library. */\nstruct _ns_flagdata {  int mask, shift;  };\nextern struct _ns_flagdata _ns_flagdata[];\n\n/* Accessor macros - this is part of the public interface. */\n\n#define ns_msg_id(handle) ((handle)._id + 0)\n#define ns_msg_base(handle) ((handle)._msg + 0)\n#define ns_msg_end(handle) ((handle)._eom + 0)\n#define ns_msg_size(handle) ((handle)._eom - (handle)._msg)\n#define ns_msg_count(handle, section) ((handle)._counts[section] + 0)\n\n/*%\n * This is a parsed record.  It is caller allocated and has no dynamic data.\n */\ntypedef\tstruct __ns_rr {\n\tchar\t\tname[NS_MAXDNAME];\n\tu_int16_t\ttype;\n\tu_int16_t\trr_class;\n\tu_int32_t\tttl;\n\tu_int16_t\trdlength;\n\tconst u_char *\trdata;\n} ns_rr;\n\n/* Accessor macros - this is part of the public interface. */\n#define ns_rr_name(rr)\t(((rr).name[0] != '\\0') ? (rr).name : \".\")\n#define ns_rr_type(rr)\t((ns_type)((rr).type + 0))\n#define ns_rr_class(rr)\t((ns_class)((rr).rr_class + 0))\n#define ns_rr_ttl(rr)\t((rr).ttl + 0)\n#define ns_rr_rdlen(rr)\t((rr).rdlength + 0)\n#define ns_rr_rdata(rr)\t((rr).rdata + 0)\n\n/*%\n * These don't have to be in the same order as in the packet flags word,\n * and they can even overlap in some cases, but they will need to be kept\n * in synch with ns_parse.c:ns_flagdata[].\n */\ntypedef enum __ns_flag {\n\tns_f_qr,\t\t/*%< Question/Response. */\n\tns_f_opcode,\t\t/*%< Operation code. */\n\tns_f_aa,\t\t/*%< Authoritative Answer. */\n\tns_f_tc,\t\t/*%< Truncation occurred. */\n\tns_f_rd,\t\t/*%< Recursion Desired. */\n\tns_f_ra,\t\t/*%< Recursion Available. */\n\tns_f_z,\t\t\t/*%< MBZ. */\n\tns_f_ad,\t\t/*%< Authentic Data (DNSSEC). */\n\tns_f_cd,\t\t/*%< Checking Disabled (DNSSEC). */\n\tns_f_rcode,\t\t/*%< Response code. */\n\tns_f_max\n} ns_flag;\n\n/*%\n * Currently defined opcodes.\n */\ntypedef enum __ns_opcode {\n\tns_o_query = 0,\t\t/*%< Standard query. */\n\tns_o_iquery = 1,\t/*%< Inverse query (deprecated/unsupported). */\n\tns_o_status = 2,\t/*%< Name server status query (unsupported). */\n\t\t\t\t/* Opcode 3 is undefined/reserved. */\n\tns_o_notify = 4,\t/*%< Zone change notification. */\n\tns_o_update = 5,\t/*%< Zone update message. */\n\tns_o_max = 6\n} ns_opcode;\n\n/*%\n * Currently defined response codes.\n */\ntypedef\tenum __ns_rcode {\n\tns_r_noerror = 0,\t/*%< No error occurred. */\n\tns_r_formerr = 1,\t/*%< Format error. */\n\tns_r_servfail = 2,\t/*%< Server failure. */\n\tns_r_nxdomain = 3,\t/*%< Name error. */\n\tns_r_notimpl = 4,\t/*%< Unimplemented. */\n\tns_r_refused = 5,\t/*%< Operation refused. */\n\t/* these are for BIND_UPDATE */\n\tns_r_yxdomain = 6,\t/*%< Name exists */\n\tns_r_yxrrset = 7,\t/*%< RRset exists */\n\tns_r_nxrrset = 8,\t/*%< RRset does not exist */\n\tns_r_notauth = 9,\t/*%< Not authoritative for zone */\n\tns_r_notzone = 10,\t/*%< Zone of record different from zone section */\n\tns_r_max = 11,\n\t/* The following are EDNS extended rcodes */\n\tns_r_badvers = 16,\n\t/* The following are TSIG errors */\n\tns_r_badsig = 16,\n\tns_r_badkey = 17,\n\tns_r_badtime = 18\n} ns_rcode;\n\n/* BIND_UPDATE */\ntypedef enum __ns_update_operation {\n\tns_uop_delete = 0,\n\tns_uop_add = 1,\n\tns_uop_max = 2\n} ns_update_operation;\n\n/*%\n * This structure is used for TSIG authenticated messages\n */\nstruct ns_tsig_key {\n        char name[NS_MAXDNAME], alg[NS_MAXDNAME];\n        unsigned char *data;\n        int len;\n};\ntypedef struct ns_tsig_key ns_tsig_key;\n\n/*%\n * This structure is used for TSIG authenticated TCP messages\n */\nstruct ns_tcp_tsig_state {\n\tint counter;\n\tstruct dst_key *key;\n\tvoid *ctx;\n\tunsigned char sig[NS_PACKETSZ];\n\tint siglen;\n};\ntypedef struct ns_tcp_tsig_state ns_tcp_tsig_state;\n\n#define NS_TSIG_FUDGE 300\n#define NS_TSIG_TCP_COUNT 100\n#define NS_TSIG_ALG_HMAC_MD5 \"HMAC-MD5.SIG-ALG.REG.INT\"\n\n#define NS_TSIG_ERROR_NO_TSIG -10\n#define NS_TSIG_ERROR_NO_SPACE -11\n#define NS_TSIG_ERROR_FORMERR -12\n\n/*%\n * Currently defined type values for resources and queries.\n */\ntypedef enum __ns_type {\n\tns_t_invalid = 0,\t/*%< Cookie. */\n\tns_t_a = 1,\t\t/*%< Host address. */\n\tns_t_ns = 2,\t\t/*%< Authoritative server. */\n\tns_t_md = 3,\t\t/*%< Mail destination. */\n\tns_t_mf = 4,\t\t/*%< Mail forwarder. */\n\tns_t_cname = 5,\t\t/*%< Canonical name. */\n\tns_t_soa = 6,\t\t/*%< Start of authority zone. */\n\tns_t_mb = 7,\t\t/*%< Mailbox domain name. */\n\tns_t_mg = 8,\t\t/*%< Mail group member. */\n\tns_t_mr = 9,\t\t/*%< Mail rename name. */\n\tns_t_null = 10,\t\t/*%< Null resource record. */\n\tns_t_wks = 11,\t\t/*%< Well known service. */\n\tns_t_ptr = 12,\t\t/*%< Domain name pointer. */\n\tns_t_hinfo = 13,\t/*%< Host information. */\n\tns_t_minfo = 14,\t/*%< Mailbox information. */\n\tns_t_mx = 15,\t\t/*%< Mail routing information. */\n\tns_t_txt = 16,\t\t/*%< Text strings. */\n\tns_t_rp = 17,\t\t/*%< Responsible person. */\n\tns_t_afsdb = 18,\t/*%< AFS cell database. */\n\tns_t_x25 = 19,\t\t/*%< X_25 calling address. */\n\tns_t_isdn = 20,\t\t/*%< ISDN calling address. */\n\tns_t_rt = 21,\t\t/*%< Router. */\n\tns_t_nsap = 22,\t\t/*%< NSAP address. */\n\tns_t_nsap_ptr = 23,\t/*%< Reverse NSAP lookup (deprecated). */\n\tns_t_sig = 24,\t\t/*%< Security signature. */\n\tns_t_key = 25,\t\t/*%< Security key. */\n\tns_t_px = 26,\t\t/*%< X.400 mail mapping. */\n\tns_t_gpos = 27,\t\t/*%< Geographical position (withdrawn). */\n\tns_t_aaaa = 28,\t\t/*%< Ip6 Address. */\n\tns_t_loc = 29,\t\t/*%< Location Information. */\n\tns_t_nxt = 30,\t\t/*%< Next domain (security). */\n\tns_t_eid = 31,\t\t/*%< Endpoint identifier. */\n\tns_t_nimloc = 32,\t/*%< Nimrod Locator. */\n\tns_t_srv = 33,\t\t/*%< Server Selection. */\n\tns_t_atma = 34,\t\t/*%< ATM Address */\n\tns_t_naptr = 35,\t/*%< Naming Authority PoinTeR */\n\tns_t_kx = 36,\t\t/*%< Key Exchange */\n\tns_t_cert = 37,\t\t/*%< Certification record */\n\tns_t_a6 = 38,\t\t/*%< IPv6 address (deprecates AAAA) */\n\tns_t_dname = 39,\t/*%< Non-terminal DNAME (for IPv6) */\n\tns_t_sink = 40,\t\t/*%< Kitchen sink (experimentatl) */\n\tns_t_opt = 41,\t\t/*%< EDNS0 option (meta-RR) */\n\tns_t_apl = 42,\t\t/*%< Address prefix list (RFC3123) */\n\tns_t_tkey = 249,\t/*%< Transaction key */\n\tns_t_tsig = 250,\t/*%< Transaction signature. */\n\tns_t_ixfr = 251,\t/*%< Incremental zone transfer. */\n\tns_t_axfr = 252,\t/*%< Transfer zone of authority. */\n\tns_t_mailb = 253,\t/*%< Transfer mailbox records. */\n\tns_t_maila = 254,\t/*%< Transfer mail agent records. */\n\tns_t_any = 255,\t\t/*%< Wildcard match. */\n\tns_t_zxfr = 256,\t/*%< BIND-specific, nonstandard. */\n\tns_t_max = 65536\n} ns_type;\n\n/* Exclusively a QTYPE? (not also an RTYPE) */\n#define\tns_t_qt_p(t) (ns_t_xfr_p(t) || (t) == ns_t_any || \\\n\t\t      (t) == ns_t_mailb || (t) == ns_t_maila)\n/* Some kind of meta-RR? (not a QTYPE, but also not an RTYPE) */\n#define\tns_t_mrr_p(t) ((t) == ns_t_tsig || (t) == ns_t_opt)\n/* Exclusively an RTYPE? (not also a QTYPE or a meta-RR) */\n#define ns_t_rr_p(t) (!ns_t_qt_p(t) && !ns_t_mrr_p(t))\n#define ns_t_udp_p(t) ((t) != ns_t_axfr && (t) != ns_t_zxfr)\n#define ns_t_xfr_p(t) ((t) == ns_t_axfr || (t) == ns_t_ixfr || \\\n\t\t       (t) == ns_t_zxfr)\n\n/*%\n * Values for class field\n */\ntypedef enum __ns_class {\n\tns_c_invalid = 0,\t/*%< Cookie. */\n\tns_c_in = 1,\t\t/*%< Internet. */\n\tns_c_2 = 2,\t\t/*%< unallocated/unsupported. */\n\tns_c_chaos = 3,\t\t/*%< MIT Chaos-net. */\n\tns_c_hs = 4,\t\t/*%< MIT Hesiod. */\n\t/* Query class values which do not appear in resource records */\n\tns_c_none = 254,\t/*%< for prereq. sections in update requests */\n\tns_c_any = 255,\t\t/*%< Wildcard match. */\n\tns_c_max = 65536\n} ns_class;\n\n/* DNSSEC constants. */\n\ntypedef enum __ns_key_types {\n\tns_kt_rsa = 1,\t\t/*%< key type RSA/MD5 */\n\tns_kt_dh  = 2,\t\t/*%< Diffie Hellman */\n\tns_kt_dsa = 3,\t\t/*%< Digital Signature Standard (MANDATORY) */\n\tns_kt_private = 254\t/*%< Private key type starts with OID */\n} ns_key_types;\n\ntypedef enum __ns_cert_types {\n\tcert_t_pkix = 1,\t/*%< PKIX (X.509v3) */\n\tcert_t_spki = 2,\t/*%< SPKI */\n\tcert_t_pgp  = 3,\t/*%< PGP */\n\tcert_t_url  = 253,\t/*%< URL private type */\n\tcert_t_oid  = 254\t/*%< OID private type */\n} ns_cert_types;\n\n/* Flags field of the KEY RR rdata. */\n#define\tNS_KEY_TYPEMASK\t\t0xC000\t/*%< Mask for \"type\" bits */\n#define\tNS_KEY_TYPE_AUTH_CONF\t0x0000\t/*%< Key usable for both */\n#define\tNS_KEY_TYPE_CONF_ONLY\t0x8000\t/*%< Key usable for confidentiality */\n#define\tNS_KEY_TYPE_AUTH_ONLY\t0x4000\t/*%< Key usable for authentication */\n#define\tNS_KEY_TYPE_NO_KEY\t0xC000\t/*%< No key usable for either; no key */\n/* The type bits can also be interpreted independently, as single bits: */\n#define\tNS_KEY_NO_AUTH\t\t0x8000\t/*%< Key unusable for authentication */\n#define\tNS_KEY_NO_CONF\t\t0x4000\t/*%< Key unusable for confidentiality */\n#define\tNS_KEY_RESERVED2\t0x2000\t/* Security is *mandatory* if bit=0 */\n#define\tNS_KEY_EXTENDED_FLAGS\t0x1000\t/*%< reserved - must be zero */\n#define\tNS_KEY_RESERVED4\t0x0800  /*%< reserved - must be zero */\n#define\tNS_KEY_RESERVED5\t0x0400  /*%< reserved - must be zero */\n#define\tNS_KEY_NAME_TYPE\t0x0300\t/*%< these bits determine the type */\n#define\tNS_KEY_NAME_USER\t0x0000\t/*%< key is assoc. with user */\n#define\tNS_KEY_NAME_ENTITY\t0x0200\t/*%< key is assoc. with entity eg host */\n#define\tNS_KEY_NAME_ZONE\t0x0100\t/*%< key is zone key */\n#define\tNS_KEY_NAME_RESERVED\t0x0300\t/*%< reserved meaning */\n#define\tNS_KEY_RESERVED8\t0x0080  /*%< reserved - must be zero */\n#define\tNS_KEY_RESERVED9\t0x0040  /*%< reserved - must be zero */\n#define\tNS_KEY_RESERVED10\t0x0020  /*%< reserved - must be zero */\n#define\tNS_KEY_RESERVED11\t0x0010  /*%< reserved - must be zero */\n#define\tNS_KEY_SIGNATORYMASK\t0x000F\t/*%< key can sign RR's of same name */\n#define\tNS_KEY_RESERVED_BITMASK ( NS_KEY_RESERVED2 | \\\n\t\t\t\t  NS_KEY_RESERVED4 | \\\n\t\t\t\t  NS_KEY_RESERVED5 | \\\n\t\t\t\t  NS_KEY_RESERVED8 | \\\n\t\t\t\t  NS_KEY_RESERVED9 | \\\n\t\t\t\t  NS_KEY_RESERVED10 | \\\n\t\t\t\t  NS_KEY_RESERVED11 )\n#define NS_KEY_RESERVED_BITMASK2 0xFFFF /*%< no bits defined here */\n/* The Algorithm field of the KEY and SIG RR's is an integer, {1..254} */\n#define\tNS_ALG_MD5RSA\t\t1\t/*%< MD5 with RSA */\n#define\tNS_ALG_DH               2\t/*%< Diffie Hellman KEY */\n#define\tNS_ALG_DSA              3\t/*%< DSA KEY */\n#define\tNS_ALG_DSS              NS_ALG_DSA\n#define\tNS_ALG_EXPIRE_ONLY\t253\t/*%< No alg, no security */\n#define\tNS_ALG_PRIVATE_OID\t254\t/*%< Key begins with OID giving alg */\n/* Protocol values  */\n/* value 0 is reserved */\n#define NS_KEY_PROT_TLS         1\n#define NS_KEY_PROT_EMAIL       2\n#define NS_KEY_PROT_DNSSEC      3\n#define NS_KEY_PROT_IPSEC       4\n#define NS_KEY_PROT_ANY\t\t255\n\n/* Signatures */\n#define\tNS_MD5RSA_MIN_BITS\t 512\t/*%< Size of a mod or exp in bits */\n#define\tNS_MD5RSA_MAX_BITS\t4096\n\t/* Total of binary mod and exp */\n#define\tNS_MD5RSA_MAX_BYTES\t((NS_MD5RSA_MAX_BITS+7/8)*2+3)\n\t/* Max length of text sig block */\n#define\tNS_MD5RSA_MAX_BASE64\t(((NS_MD5RSA_MAX_BYTES+2)/3)*4)\n#define NS_MD5RSA_MIN_SIZE\t((NS_MD5RSA_MIN_BITS+7)/8)\n#define NS_MD5RSA_MAX_SIZE\t((NS_MD5RSA_MAX_BITS+7)/8)\n\n#define NS_DSA_SIG_SIZE         41\n#define NS_DSA_MIN_SIZE         213\n#define NS_DSA_MAX_BYTES        405\n\n/* Offsets into SIG record rdata to find various values */\n#define\tNS_SIG_TYPE\t0\t/*%< Type flags */\n#define\tNS_SIG_ALG\t2\t/*%< Algorithm */\n#define\tNS_SIG_LABELS\t3\t/*%< How many labels in name */\n#define\tNS_SIG_OTTL\t4\t/*%< Original TTL */\n#define\tNS_SIG_EXPIR\t8\t/*%< Expiration time */\n#define\tNS_SIG_SIGNED\t12\t/*%< Signature time */\n#define\tNS_SIG_FOOT\t16\t/*%< Key footprint */\n#define\tNS_SIG_SIGNER\t18\t/*%< Domain name of who signed it */\n/* How RR types are represented as bit-flags in NXT records */\n#define\tNS_NXT_BITS 8\n#define\tNS_NXT_BIT_SET(  n,p) (p[(n)/NS_NXT_BITS] |=  (0x80>>((n)%NS_NXT_BITS)))\n#define\tNS_NXT_BIT_CLEAR(n,p) (p[(n)/NS_NXT_BITS] &= ~(0x80>>((n)%NS_NXT_BITS)))\n#define\tNS_NXT_BIT_ISSET(n,p) (p[(n)/NS_NXT_BITS] &   (0x80>>((n)%NS_NXT_BITS)))\n#define NS_NXT_MAX 127\n\n/*%\n * EDNS0 extended flags and option codes, host order.\n */\n#define NS_OPT_DNSSEC_OK\t0x8000U\n#define NS_OPT_NSID             3\n\n/*%\n * Inline versions of get/put short/long.  Pointer is advanced.\n */\n#define NS_GET16(s, cp) do { \\\n\tregister const u_char *t_cp = (const u_char *)(cp); \\\n\t(s) = ((u_int16_t)t_cp[0] << 8) \\\n\t    | ((u_int16_t)t_cp[1]) \\\n\t    ; \\\n\t(cp) += NS_INT16SZ; \\\n} while (0)\n\n#define NS_GET32(l, cp) do { \\\n\tregister const u_char *t_cp = (const u_char *)(cp); \\\n\t(l) = ((u_int32_t)t_cp[0] << 24) \\\n\t    | ((u_int32_t)t_cp[1] << 16) \\\n\t    | ((u_int32_t)t_cp[2] << 8) \\\n\t    | ((u_int32_t)t_cp[3]) \\\n\t    ; \\\n\t(cp) += NS_INT32SZ; \\\n} while (0)\n\n#define NS_PUT16(s, cp) do { \\\n\tregister u_int16_t t_s = (u_int16_t)(s); \\\n\tregister u_char *t_cp = (u_char *)(cp); \\\n\t*t_cp++ = t_s >> 8; \\\n\t*t_cp   = t_s; \\\n\t(cp) += NS_INT16SZ; \\\n} while (0)\n\n#define NS_PUT32(l, cp) do { \\\n\tregister u_int32_t t_l = (u_int32_t)(l); \\\n\tregister u_char *t_cp = (u_char *)(cp); \\\n\t*t_cp++ = t_l >> 24; \\\n\t*t_cp++ = t_l >> 16; \\\n\t*t_cp++ = t_l >> 8; \\\n\t*t_cp   = t_l; \\\n\t(cp) += NS_INT32SZ; \\\n} while (0)\n\n/*%\n * ANSI C identifier hiding for bind's lib/nameser.\n */\n#define\tns_msg_getflag\t\t__ns_msg_getflag\n#define ns_get16\t\t__ns_get16\n#define ns_get32\t\t__ns_get32\n#define ns_put16\t\t__ns_put16\n#define ns_put32\t\t__ns_put32\n#define ns_initparse\t\t__ns_initparse\n#define ns_skiprr\t\t__ns_skiprr\n#define ns_parserr\t\t__ns_parserr\n#define\tns_sprintrr\t\t__ns_sprintrr\n#define\tns_sprintrrf\t\t__ns_sprintrrf\n#define\tns_format_ttl\t\t__ns_format_ttl\n#define\tns_parse_ttl\t\t__ns_parse_ttl\n#if 0\n#define ns_datetosecs\t\t__ns_datetosecs\n#endif\n#define\tns_name_ntol\t\t__ns_name_ntol\n#define\tns_name_ntop\t\t__ns_name_ntop\n#define\tns_name_pton\t\t__ns_name_pton\n#define\tns_name_unpack\t\t__ns_name_unpack\n#define\tns_name_pack\t\t__ns_name_pack\n#define\tns_name_compress\t__ns_name_compress\n#define\tns_name_uncompress\t__ns_name_uncompress\n#define\tns_name_skip\t\t__ns_name_skip\n#define\tns_name_rollback\t__ns_name_rollback\n#if 0\n#define\tns_sign\t\t\t__ns_sign\n#define\tns_sign2\t\t__ns_sign2\n#define\tns_sign_tcp\t\t__ns_sign_tcp\n#define\tns_sign_tcp2\t\t__ns_sign_tcp2\n#define\tns_sign_tcp_init\t__ns_sign_tcp_init\n#define ns_find_tsig\t\t__ns_find_tsig\n#define\tns_verify\t\t__ns_verify\n#define\tns_verify_tcp\t\t__ns_verify_tcp\n#define\tns_verify_tcp_init\t__ns_verify_tcp_init\n#endif\n#define\tns_samedomain\t\t__ns_samedomain\n#if 0\n#define\tns_subdomain\t\t__ns_subdomain\n#endif\n#define\tns_makecanon\t\t__ns_makecanon\n#define\tns_samename\t\t__ns_samename\n\n__BEGIN_DECLS\nint\t\tns_msg_getflag(ns_msg, int);\nu_int\t\tns_get16(const u_char *);\nu_long\t\tns_get32(const u_char *);\nvoid\t\tns_put16(u_int, u_char *);\nvoid\t\tns_put32(u_long, u_char *);\nint\t\tns_initparse(const u_char *, int, ns_msg *);\nint\t\tns_skiprr(const u_char *, const u_char *, ns_sect, int);\nint\t\tns_parserr(ns_msg *, ns_sect, int, ns_rr *);\nint\t\tns_sprintrr(const ns_msg *, const ns_rr *,\n\t\t\t    const char *, const char *, char *, size_t);\nint\t\tns_sprintrrf(const u_char *, size_t, const char *,\n\t\t\t     ns_class, ns_type, u_long, const u_char *,\n\t\t\t     size_t, const char *, const char *,\n\t\t\t     char *, size_t);\nint\t\tns_format_ttl(u_long, char *, size_t);\nint\t\tns_parse_ttl(const char *, u_long *);\n#if 0\nu_int32_t\tns_datetosecs(const char *cp, int *errp);\n#endif\nint\t\tns_name_ntol(const u_char *, u_char *, size_t);\nint\t\tns_name_ntop(const u_char *, char *, size_t);\nint\t\tns_name_pton(const char *, u_char *, size_t);\nint\t\tns_name_unpack(const u_char *, const u_char *,\n\t\t\t       const u_char *, u_char *, size_t);\nint\t\tns_name_pack(const u_char *, u_char *, int,\n\t\t\t     const u_char **, const u_char **);\nint\t\tns_name_uncompress(const u_char *, const u_char *,\n\t\t\t\t   const u_char *, char *, size_t);\nint\t\tns_name_compress(const char *, u_char *, size_t,\n\t\t\t\t const u_char **, const u_char **);\nint\t\tns_name_skip(const u_char **, const u_char *);\nvoid\t\tns_name_rollback(const u_char *, const u_char **,\n\t\t\t\t const u_char **);\n#if 0\nint\t\tns_sign(u_char *, int *, int, int, void *,\n\t\t\tconst u_char *, int, u_char *, int *, time_t);\nint\t\tns_sign2(u_char *, int *, int, int, void *,\n\t\t\t const u_char *, int, u_char *, int *, time_t,\n\t\t\t u_char **, u_char **);\nint\t\tns_sign_tcp(u_char *, int *, int, int,\n\t\t\t    ns_tcp_tsig_state *, int);\nint\t\tns_sign_tcp2(u_char *, int *, int, int,\n\t\t\t     ns_tcp_tsig_state *, int,\n\t\t\t     u_char **, u_char **);\nint\t\tns_sign_tcp_init(void *, const u_char *, int,\n\t\t\t\t ns_tcp_tsig_state *);\nu_char\t\t*ns_find_tsig(u_char *, u_char *);\nint\t\tns_verify(u_char *, int *, void *,\n\t\t\t  const u_char *, int, u_char *, int *,\n\t\t\t  time_t *, int);\nint\t\tns_verify_tcp(u_char *, int *, ns_tcp_tsig_state *, int);\nint\t\tns_verify_tcp_init(void *, const u_char *, int,\n\t\t\t\t   ns_tcp_tsig_state *);\n#endif\nint\t\tns_samedomain(const char *, const char *);\n#if 0\nint\t\tns_subdomain(const char *, const char *);\n#endif\nint\t\tns_makecanon(const char *, char *, size_t);\nint\t\tns_samename(const char *, const char *);\n__END_DECLS\n\n#ifdef BIND_4_COMPAT\n#include <arpa/nameser_compat.h>\n#endif\n\n#endif /* !_ARPA_NAMESER_H_ */\n/*! \\file */\n"
  },
  {
    "path": "freebsd-headers/arpa/nameser_compat.h",
    "content": "/* Copyright (c) 1983, 1989\n *    The Regents of the University of California.  All rights reserved.\n * \n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n * \n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n */\n\n/*%\n *      from nameser.h\t8.1 (Berkeley) 6/2/93\n *\t$Id: nameser_compat.h,v 1.5.18.3 2006/05/19 02:36:00 marka Exp $\n * $FreeBSD: release/9.0.0/include/arpa/nameser_compat.h 203965 2010-02-16 19:46:46Z imp $\n */\n\n#ifndef _ARPA_NAMESER_COMPAT_\n#define\t_ARPA_NAMESER_COMPAT_\n\n#define\t__BIND\t\t19950621\t/*%< (DEAD) interface version stamp. */\n\n#include <machine/endian.h>\n\n#if !defined(_BYTE_ORDER) || \\\n    (_BYTE_ORDER != _BIG_ENDIAN && _BYTE_ORDER != _LITTLE_ENDIAN && \\\n    _BYTE_ORDER != _PDP_ENDIAN)\n\t/* you must determine what the correct bit order is for\n\t * your compiler - the next line is an intentional error\n\t * which will force your compiles to bomb until you fix\n\t * the above macros.\n\t */\n#error \"Undefined or invalid _BYTE_ORDER\";\n#endif\n\n/*%\n * Structure for query header.  The order of the fields is machine- and\n * compiler-dependent, depending on the byte/bit order and the layout\n * of bit fields.  We use bit fields only in int variables, as this\n * is all ANSI requires.  This requires a somewhat confusing rearrangement.\n */\n\ntypedef struct {\n\tunsigned\tid :16;\t\t/*%< query identification number */\n#if _BYTE_ORDER == _BIG_ENDIAN\n\t\t\t/* fields in third byte */\n\tunsigned\tqr: 1;\t\t/*%< response flag */\n\tunsigned\topcode: 4;\t/*%< purpose of message */\n\tunsigned\taa: 1;\t\t/*%< authoritive answer */\n\tunsigned\ttc: 1;\t\t/*%< truncated message */\n\tunsigned\trd: 1;\t\t/*%< recursion desired */\n\t\t\t/* fields in fourth byte */\n\tunsigned\tra: 1;\t\t/*%< recursion available */\n\tunsigned\tunused :1;\t/*%< unused bits (MBZ as of 4.9.3a3) */\n\tunsigned\tad: 1;\t\t/*%< authentic data from named */\n\tunsigned\tcd: 1;\t\t/*%< checking disabled by resolver */\n\tunsigned\trcode :4;\t/*%< response code */\n#endif\n#if _BYTE_ORDER == _LITTLE_ENDIAN || _BYTE_ORDER == _PDP_ENDIAN\n\t\t\t/* fields in third byte */\n\tunsigned\trd :1;\t\t/*%< recursion desired */\n\tunsigned\ttc :1;\t\t/*%< truncated message */\n\tunsigned\taa :1;\t\t/*%< authoritive answer */\n\tunsigned\topcode :4;\t/*%< purpose of message */\n\tunsigned\tqr :1;\t\t/*%< response flag */\n\t\t\t/* fields in fourth byte */\n\tunsigned\trcode :4;\t/*%< response code */\n\tunsigned\tcd: 1;\t\t/*%< checking disabled by resolver */\n\tunsigned\tad: 1;\t\t/*%< authentic data from named */\n\tunsigned\tunused :1;\t/*%< unused bits (MBZ as of 4.9.3a3) */\n\tunsigned\tra :1;\t\t/*%< recursion available */\n#endif\n\t\t\t/* remaining bytes */\n\tunsigned\tqdcount :16;\t/*%< number of question entries */\n\tunsigned\tancount :16;\t/*%< number of answer entries */\n\tunsigned\tnscount :16;\t/*%< number of authority entries */\n\tunsigned\tarcount :16;\t/*%< number of resource entries */\n} HEADER;\n\n#define PACKETSZ\tNS_PACKETSZ\n#define MAXDNAME\tNS_MAXDNAME\n#define MAXCDNAME\tNS_MAXCDNAME\n#define MAXLABEL\tNS_MAXLABEL\n#define\tHFIXEDSZ\tNS_HFIXEDSZ\n#define QFIXEDSZ\tNS_QFIXEDSZ\n#define RRFIXEDSZ\tNS_RRFIXEDSZ\n#define\tINT32SZ\t\tNS_INT32SZ\n#define\tINT16SZ\t\tNS_INT16SZ\n#define\tINT8SZ\t\tNS_INT8SZ\n#define\tINADDRSZ\tNS_INADDRSZ\n#define\tIN6ADDRSZ\tNS_IN6ADDRSZ\n#define\tINDIR_MASK\tNS_CMPRSFLGS\n#define NAMESERVER_PORT\tNS_DEFAULTPORT\n\n#define S_ZONE\t\tns_s_zn\n#define S_PREREQ\tns_s_pr\n#define S_UPDATE\tns_s_ud\n#define S_ADDT\t\tns_s_ar\n\n#define QUERY\t\tns_o_query\n#define IQUERY\t\tns_o_iquery\n#define STATUS\t\tns_o_status\n#define\tNS_NOTIFY_OP\tns_o_notify\n#define\tNS_UPDATE_OP\tns_o_update\n\n#define NOERROR\t\tns_r_noerror\n#define FORMERR\t\tns_r_formerr\n#define SERVFAIL\tns_r_servfail\n#define NXDOMAIN\tns_r_nxdomain\n#define NOTIMP\t\tns_r_notimpl\n#define REFUSED\t\tns_r_refused\n#define YXDOMAIN\tns_r_yxdomain\n#define YXRRSET\t\tns_r_yxrrset\n#define NXRRSET\t\tns_r_nxrrset\n#define NOTAUTH\t\tns_r_notauth\n#define NOTZONE\t\tns_r_notzone\n/*#define BADSIG\t\tns_r_badsig*/\n/*#define BADKEY\t\tns_r_badkey*/\n/*#define BADTIME\t\tns_r_badtime*/\n\n\n#define DELETE\t\tns_uop_delete\n#define ADD\t\tns_uop_add\n\n#define T_A\t\tns_t_a\n#define T_NS\t\tns_t_ns\n#define T_MD\t\tns_t_md\n#define T_MF\t\tns_t_mf\n#define T_CNAME\t\tns_t_cname\n#define T_SOA\t\tns_t_soa\n#define T_MB\t\tns_t_mb\n#define T_MG\t\tns_t_mg\n#define T_MR\t\tns_t_mr\n#define T_NULL\t\tns_t_null\n#define T_WKS\t\tns_t_wks\n#define T_PTR\t\tns_t_ptr\n#define T_HINFO\t\tns_t_hinfo\n#define T_MINFO\t\tns_t_minfo\n#define T_MX\t\tns_t_mx\n#define T_TXT\t\tns_t_txt\n#define\tT_RP\t\tns_t_rp\n#define T_AFSDB\t\tns_t_afsdb\n#define T_X25\t\tns_t_x25\n#define T_ISDN\t\tns_t_isdn\n#define T_RT\t\tns_t_rt\n#define T_NSAP\t\tns_t_nsap\n#define T_NSAP_PTR\tns_t_nsap_ptr\n#define\tT_SIG\t\tns_t_sig\n#define\tT_KEY\t\tns_t_key\n#define\tT_PX\t\tns_t_px\n#define\tT_GPOS\t\tns_t_gpos\n#define\tT_AAAA\t\tns_t_aaaa\n#define\tT_LOC\t\tns_t_loc\n#define\tT_NXT\t\tns_t_nxt\n#define\tT_EID\t\tns_t_eid\n#define\tT_NIMLOC\tns_t_nimloc\n#define\tT_SRV\t\tns_t_srv\n#define T_ATMA\t\tns_t_atma\n#define T_NAPTR\t\tns_t_naptr\n#define T_A6\t\tns_t_a6\n#define T_OPT\t\tns_t_opt\n#define\tT_TSIG\t\tns_t_tsig\n#define\tT_IXFR\t\tns_t_ixfr\n#define T_AXFR\t\tns_t_axfr\n#define T_MAILB\t\tns_t_mailb\n#define T_MAILA\t\tns_t_maila\n#define T_ANY\t\tns_t_any\n\n#define C_IN\t\tns_c_in\n#define C_CHAOS\t\tns_c_chaos\n#define C_HS\t\tns_c_hs\n/* BIND_UPDATE */\n#define C_NONE\t\tns_c_none\n#define C_ANY\t\tns_c_any\n\n#define\tGETSHORT\t\tNS_GET16\n#define\tGETLONG\t\t\tNS_GET32\n#define\tPUTSHORT\t\tNS_PUT16\n#define\tPUTLONG\t\t\tNS_PUT32\n\n#endif /* _ARPA_NAMESER_COMPAT_ */\n/*! \\file */\n"
  },
  {
    "path": "freebsd-headers/arpa/telnet.h",
    "content": "/*\n * Copyright (c) 1983, 1993\n *\tThe Regents of the University of California.  All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t@(#)telnet.h\t8.2 (Berkeley) 12/15/93\n * $FreeBSD: release/9.0.0/include/arpa/telnet.h 203965 2010-02-16 19:46:46Z imp $\n */\n\n#ifndef _ARPA_TELNET_H_\n#define\t_ARPA_TELNET_H_\n\n/*\n * Definitions for the TELNET protocol.\n */\n#define\tIAC\t255\t\t/* interpret as command: */\n#define\tDONT\t254\t\t/* you are not to use option */\n#define\tDO\t253\t\t/* please, you use option */\n#define\tWONT\t252\t\t/* I won't use option */\n#define\tWILL\t251\t\t/* I will use option */\n#define\tSB\t250\t\t/* interpret as subnegotiation */\n#define\tGA\t249\t\t/* you may reverse the line */\n#define\tEL\t248\t\t/* erase the current line */\n#define\tEC\t247\t\t/* erase the current character */\n#define\tAYT\t246\t\t/* are you there */\n#define\tAO\t245\t\t/* abort output--but let prog finish */\n#define\tIP\t244\t\t/* interrupt process--permanently */\n#define\tBREAK\t243\t\t/* break */\n#define\tDM\t242\t\t/* data mark--for connect. cleaning */\n#define\tNOP\t241\t\t/* nop */\n#define\tSE\t240\t\t/* end sub negotiation */\n#define EOR     239             /* end of record (transparent mode) */\n#define\tABORT\t238\t\t/* Abort process */\n#define\tSUSP\t237\t\t/* Suspend process */\n#define\txEOF\t236\t\t/* End of file: EOF is already used... */\n\n#define SYNCH\t242\t\t/* for telfunc calls */\n\n#ifdef TELCMDS\nconst char *telcmds[] = {\n\t\"EOF\", \"SUSP\", \"ABORT\", \"EOR\",\n\t\"SE\", \"NOP\", \"DMARK\", \"BRK\", \"IP\", \"AO\", \"AYT\", \"EC\",\n\t\"EL\", \"GA\", \"SB\", \"WILL\", \"WONT\", \"DO\", \"DONT\", \"IAC\",\n\t0\n};\n#else\nextern char *telcmds[];\n#endif\n\n#define\tTELCMD_FIRST\txEOF\n#define\tTELCMD_LAST\tIAC\n#define\tTELCMD_OK(x)\t((unsigned int)(x) <= TELCMD_LAST && \\\n\t\t\t (unsigned int)(x) >= TELCMD_FIRST)\n#define\tTELCMD(x)\ttelcmds[(x)-TELCMD_FIRST]\n\n/* telnet options */\n#define TELOPT_BINARY\t0\t/* 8-bit data path */\n#define TELOPT_ECHO\t1\t/* echo */\n#define\tTELOPT_RCP\t2\t/* prepare to reconnect */\n#define\tTELOPT_SGA\t3\t/* suppress go ahead */\n#define\tTELOPT_NAMS\t4\t/* approximate message size */\n#define\tTELOPT_STATUS\t5\t/* give status */\n#define\tTELOPT_TM\t6\t/* timing mark */\n#define\tTELOPT_RCTE\t7\t/* remote controlled transmission and echo */\n#define TELOPT_NAOL \t8\t/* negotiate about output line width */\n#define TELOPT_NAOP \t9\t/* negotiate about output page size */\n#define TELOPT_NAOCRD\t10\t/* negotiate about CR disposition */\n#define TELOPT_NAOHTS\t11\t/* negotiate about horizontal tabstops */\n#define TELOPT_NAOHTD\t12\t/* negotiate about horizontal tab disposition */\n#define TELOPT_NAOFFD\t13\t/* negotiate about formfeed disposition */\n#define TELOPT_NAOVTS\t14\t/* negotiate about vertical tab stops */\n#define TELOPT_NAOVTD\t15\t/* negotiate about vertical tab disposition */\n#define TELOPT_NAOLFD\t16\t/* negotiate about output LF disposition */\n#define TELOPT_XASCII\t17\t/* extended ascic character set */\n#define\tTELOPT_LOGOUT\t18\t/* force logout */\n#define\tTELOPT_BM\t19\t/* byte macro */\n#define\tTELOPT_DET\t20\t/* data entry terminal */\n#define\tTELOPT_SUPDUP\t21\t/* supdup protocol */\n#define\tTELOPT_SUPDUPOUTPUT 22\t/* supdup output */\n#define\tTELOPT_SNDLOC\t23\t/* send location */\n#define\tTELOPT_TTYPE\t24\t/* terminal type */\n#define\tTELOPT_EOR\t25\t/* end or record */\n#define\tTELOPT_TUID\t26\t/* TACACS user identification */\n#define\tTELOPT_OUTMRK\t27\t/* output marking */\n#define\tTELOPT_TTYLOC\t28\t/* terminal location number */\n#define\tTELOPT_3270REGIME 29\t/* 3270 regime */\n#define\tTELOPT_X3PAD\t30\t/* X.3 PAD */\n#define\tTELOPT_NAWS\t31\t/* window size */\n#define\tTELOPT_TSPEED\t32\t/* terminal speed */\n#define\tTELOPT_LFLOW\t33\t/* remote flow control */\n#define TELOPT_LINEMODE\t34\t/* Linemode option */\n#define TELOPT_XDISPLOC\t35\t/* X Display Location */\n#define TELOPT_OLD_ENVIRON 36\t/* Old - Environment variables */\n#define\tTELOPT_AUTHENTICATION 37/* Authenticate */\n#define\tTELOPT_ENCRYPT\t38\t/* Encryption option */\n#define TELOPT_NEW_ENVIRON 39\t/* New - Environment variables */\n#define\tTELOPT_TN3270E\t40\t/* RFC2355 - TN3270 Enhancements */\n#define\tTELOPT_CHARSET\t42\t/* RFC2066 - Charset */\n#define\tTELOPT_COMPORT\t44\t/* RFC2217 - Com Port Control */\n#define\tTELOPT_KERMIT\t47\t/* RFC2840 - Kermit */\n#define\tTELOPT_EXOPL\t255\t/* extended-options-list */\n\n\n#define\tNTELOPTS\t(1+TELOPT_KERMIT)\n#ifdef TELOPTS\nconst char *telopts[NTELOPTS+1] = {\n\t\"BINARY\", \"ECHO\", \"RCP\", \"SUPPRESS GO AHEAD\", \"NAME\",\n\t\"STATUS\", \"TIMING MARK\", \"RCTE\", \"NAOL\", \"NAOP\",\n\t\"NAOCRD\", \"NAOHTS\", \"NAOHTD\", \"NAOFFD\", \"NAOVTS\",\n\t\"NAOVTD\", \"NAOLFD\", \"EXTEND ASCII\", \"LOGOUT\", \"BYTE MACRO\",\n\t\"DATA ENTRY TERMINAL\", \"SUPDUP\", \"SUPDUP OUTPUT\",\n\t\"SEND LOCATION\", \"TERMINAL TYPE\", \"END OF RECORD\",\n\t\"TACACS UID\", \"OUTPUT MARKING\", \"TTYLOC\",\n\t\"3270 REGIME\", \"X.3 PAD\", \"NAWS\", \"TSPEED\", \"LFLOW\",\n\t\"LINEMODE\", \"XDISPLOC\", \"OLD-ENVIRON\", \"AUTHENTICATION\",\n\t\"ENCRYPT\", \"NEW-ENVIRON\", \"TN3270E\", \"XAUTH\", \"CHARSET\",\n\t\"RSP\", \"COM-PORT\", \"SLE\", \"STARTTLS\", \"KERMIT\",\n\t0\n};\n#define\tTELOPT_FIRST\tTELOPT_BINARY\n#define\tTELOPT_LAST\tTELOPT_KERMIT\n#define\tTELOPT_OK(x)\t((unsigned int)(x) <= TELOPT_LAST)\n#define\tTELOPT(x)\ttelopts[(x)-TELOPT_FIRST]\n#endif\n\n/* sub-option qualifiers */\n#define\tTELQUAL_IS\t0\t/* option is... */\n#define\tTELQUAL_SEND\t1\t/* send option */\n#define\tTELQUAL_INFO\t2\t/* ENVIRON: informational version of IS */\n#define\tTELQUAL_REPLY\t2\t/* AUTHENTICATION: client version of IS */\n#define\tTELQUAL_NAME\t3\t/* AUTHENTICATION: client version of IS */\n\n#define\tLFLOW_OFF\t\t0\t/* Disable remote flow control */\n#define\tLFLOW_ON\t\t1\t/* Enable remote flow control */\n#define\tLFLOW_RESTART_ANY\t2\t/* Restart output on any char */\n#define\tLFLOW_RESTART_XON\t3\t/* Restart output only on XON */\n\n/*\n * LINEMODE suboptions\n */\n\n#define\tLM_MODE\t\t1\n#define\tLM_FORWARDMASK\t2\n#define\tLM_SLC\t\t3\n\n#define\tMODE_EDIT\t0x01\n#define\tMODE_TRAPSIG\t0x02\n#define\tMODE_ACK\t0x04\n#define MODE_SOFT_TAB\t0x08\n#define MODE_LIT_ECHO\t0x10\n\n#define\tMODE_MASK\t0x1f\n\n/* Not part of protocol, but needed to simplify things... */\n#define MODE_FLOW\t\t0x0100\n#define MODE_ECHO\t\t0x0200\n#define MODE_INBIN\t\t0x0400\n#define MODE_OUTBIN\t\t0x0800\n#define MODE_FORCE\t\t0x1000\n\n#define\tSLC_SYNCH\t1\n#define\tSLC_BRK\t\t2\n#define\tSLC_IP\t\t3\n#define\tSLC_AO\t\t4\n#define\tSLC_AYT\t\t5\n#define\tSLC_EOR\t\t6\n#define\tSLC_ABORT\t7\n#define\tSLC_EOF\t\t8\n#define\tSLC_SUSP\t9\n#define\tSLC_EC\t\t10\n#define\tSLC_EL\t\t11\n#define\tSLC_EW\t\t12\n#define\tSLC_RP\t\t13\n#define\tSLC_LNEXT\t14\n#define\tSLC_XON\t\t15\n#define\tSLC_XOFF\t16\n#define\tSLC_FORW1\t17\n#define\tSLC_FORW2\t18\n#define SLC_MCL         19\n#define SLC_MCR         20\n#define SLC_MCWL        21\n#define SLC_MCWR        22\n#define SLC_MCBOL       23\n#define SLC_MCEOL       24\n#define SLC_INSRT       25\n#define SLC_OVER        26\n#define SLC_ECR         27\n#define SLC_EWR         28\n#define SLC_EBOL        29\n#define SLC_EEOL        30\n\n#define\tNSLC\t\t30\n\n/*\n * For backwards compatibility, we define SLC_NAMES to be the\n * list of names if SLC_NAMES is not defined.\n */\n#define\tSLC_NAMELIST\t\"0\", \"SYNCH\", \"BRK\", \"IP\", \"AO\", \"AYT\", \"EOR\",\t\\\n\t\t\t\"ABORT\", \"EOF\", \"SUSP\", \"EC\", \"EL\", \"EW\", \"RP\",\t\\\n\t\t\t\"LNEXT\", \"XON\", \"XOFF\", \"FORW1\", \"FORW2\",\t\\\n\t\t\t\"MCL\", \"MCR\", \"MCWL\", \"MCWR\", \"MCBOL\",\t\t\\\n\t\t\t\"MCEOL\", \"INSRT\", \"OVER\", \"ECR\", \"EWR\",\t\t\\\n\t\t\t\"EBOL\", \"EEOL\",\t\t\t\t\t\\\n\t\t\t0\n\n#ifdef\tSLC_NAMES\nconst char *slc_names[] = {\n\tSLC_NAMELIST\n};\n#else\nextern char *slc_names[];\n#define\tSLC_NAMES SLC_NAMELIST\n#endif\n\n#define\tSLC_NAME_OK(x)\t((unsigned int)(x) <= NSLC)\n#define SLC_NAME(x)\tslc_names[x]\n\n#define\tSLC_NOSUPPORT\t0\n#define\tSLC_CANTCHANGE\t1\n#define\tSLC_VARIABLE\t2\n#define\tSLC_DEFAULT\t3\n#define\tSLC_LEVELBITS\t0x03\n\n#define\tSLC_FUNC\t0\n#define\tSLC_FLAGS\t1\n#define\tSLC_VALUE\t2\n\n#define\tSLC_ACK\t\t0x80\n#define\tSLC_FLUSHIN\t0x40\n#define\tSLC_FLUSHOUT\t0x20\n\n#define\tOLD_ENV_VAR\t1\n#define\tOLD_ENV_VALUE\t0\n#define\tNEW_ENV_VAR\t0\n#define\tNEW_ENV_VALUE\t1\n#define\tENV_ESC\t\t2\n#define ENV_USERVAR\t3\n\n/*\n * AUTHENTICATION suboptions\n */\n\n/*\n * Who is authenticating who ...\n */\n#define\tAUTH_WHO_CLIENT\t\t0\t/* Client authenticating server */\n#define\tAUTH_WHO_SERVER\t\t1\t/* Server authenticating client */\n#define\tAUTH_WHO_MASK\t\t1\n\n/*\n * amount of authentication done\n */\n#define\tAUTH_HOW_ONE_WAY\t0\n#define\tAUTH_HOW_MUTUAL\t\t2\n#define\tAUTH_HOW_MASK\t\t2\n\n#define\tAUTHTYPE_NULL\t\t0\n#define\tAUTHTYPE_KERBEROS_V4\t1\n#define\tAUTHTYPE_KERBEROS_V5\t2\n#define\tAUTHTYPE_SPX\t\t3\n#define\tAUTHTYPE_MINK\t\t4\n#define\tAUTHTYPE_SRA\t\t6\n#define\tAUTHTYPE_CNT\t\t7\n\n#define\tAUTHTYPE_TEST\t\t99\n\n#ifdef\tAUTH_NAMES\nconst char *authtype_names[] = {\n\t\"NULL\", \"KERBEROS_V4\", \"KERBEROS_V5\", \"SPX\", \"MINK\", NULL, \"SRA\",\n\t0\n};\n#else\nextern char *authtype_names[];\n#endif\n\n#define\tAUTHTYPE_NAME_OK(x)\t((unsigned int)(x) < AUTHTYPE_CNT)\n#define\tAUTHTYPE_NAME(x)\tauthtype_names[x]\n\n/*\n * ENCRYPTion suboptions\n */\n#define\tENCRYPT_IS\t\t0\t/* I pick encryption type ... */\n#define\tENCRYPT_SUPPORT\t\t1\t/* I support encryption types ... */\n#define\tENCRYPT_REPLY\t\t2\t/* Initial setup response */\n#define\tENCRYPT_START\t\t3\t/* Am starting to send encrypted */\n#define\tENCRYPT_END\t\t4\t/* Am ending encrypted */\n#define\tENCRYPT_REQSTART\t5\t/* Request you start encrypting */\n#define\tENCRYPT_REQEND\t\t6\t/* Request you end encrypting */\n#define\tENCRYPT_ENC_KEYID\t7\n#define\tENCRYPT_DEC_KEYID\t8\n#define\tENCRYPT_CNT\t\t9\n\n#define\tENCTYPE_ANY\t\t0\n#define\tENCTYPE_DES_CFB64\t1\n#define\tENCTYPE_DES_OFB64\t2\n#define\tENCTYPE_CNT\t\t3\n\n#ifdef\tENCRYPT_NAMES\nconst char *encrypt_names[] = {\n\t\"IS\", \"SUPPORT\", \"REPLY\", \"START\", \"END\",\n\t\"REQUEST-START\", \"REQUEST-END\", \"ENC-KEYID\", \"DEC-KEYID\",\n\t0\n};\nconst char *enctype_names[] = {\n\t\"ANY\", \"DES_CFB64\",  \"DES_OFB64\",\n\t0\n};\n#else\nextern char *encrypt_names[];\nextern char *enctype_names[];\n#endif\n\n\n#define\tENCRYPT_NAME_OK(x)\t((unsigned int)(x) < ENCRYPT_CNT)\n#define\tENCRYPT_NAME(x)\t\tencrypt_names[x]\n\n#define\tENCTYPE_NAME_OK(x)\t((unsigned int)(x) < ENCTYPE_CNT)\n#define\tENCTYPE_NAME(x)\t\tenctype_names[x]\n\n#endif /* !_TELNET_H_ */\n"
  },
  {
    "path": "freebsd-headers/arpa/tftp.h",
    "content": "/*\n * Copyright (c) 1983, 1993\n *\tThe Regents of the University of California.  All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t@(#)tftp.h\t8.1 (Berkeley) 6/2/93\n * $FreeBSD: release/9.0.0/include/arpa/tftp.h 203965 2010-02-16 19:46:46Z imp $\n */\n\n#ifndef _ARPA_TFTP_H_\n#define\t_ARPA_TFTP_H_\n\n/*\n * Trivial File Transfer Protocol (IEN-133)\n */\n#define\tSEGSIZE\t\t512\t\t/* data segment size */\n\n/*\n * Packet types.\n */\n#define\tRRQ\t01\t\t\t/* read request */\n#define\tWRQ\t02\t\t\t/* write request */\n#define\tDATA\t03\t\t\t/* data packet */\n#define\tACK\t04\t\t\t/* acknowledgement */\n#define\tERROR\t05\t\t\t/* error code */\n#define\tOACK\t06\t\t\t/* option acknowledgement */\n\nstruct tftphdr {\n\tunsigned short\tth_opcode;\t\t/* packet type */\n\tunion {\n\t\tunsigned short\ttu_block;\t/* block # */\n\t\tunsigned short\ttu_code;\t/* error code */\n\t\tchar\ttu_stuff[1];\t/* request packet stuff */\n\t} __packed th_u;\n\tchar\tth_data[1];\t\t/* data or error string */\n} __packed;\n\n#define\tth_block\tth_u.tu_block\n#define\tth_code\t\tth_u.tu_code\n#define\tth_stuff\tth_u.tu_stuff\n#define\tth_msg\t\tth_data\n\n/*\n * Error codes.\n */\n#define\tEUNDEF\t\t0\t\t/* not defined */\n#define\tENOTFOUND\t1\t\t/* file not found */\n#define\tEACCESS\t\t2\t\t/* access violation */\n#define\tENOSPACE\t3\t\t/* disk full or allocation exceeded */\n#define\tEBADOP\t\t4\t\t/* illegal TFTP operation */\n#define\tEBADID\t\t5\t\t/* unknown transfer ID */\n#define\tEEXISTS\t\t6\t\t/* file already exists */\n#define\tENOUSER\t\t7\t\t/* no such user */\n#define\tEOPTNEG\t\t8\t\t/* option negotiation failed */\n\n#endif /* !_TFTP_H_ */\n"
  },
  {
    "path": "freebsd-headers/asn1_err.h",
    "content": "/* Generated from /usr/src/kerberos5/lib/libasn1/../../../crypto/heimdal/lib/asn1/asn1_err.et */\n/* $Id: asn1_err.et 21394 2007-07-02 10:14:43Z lha $ */\n\n#ifndef __asn1_err_h__\n#define __asn1_err_h__\n\nstruct et_list;\n\nvoid initialize_asn1_error_table_r(struct et_list **);\n\nvoid initialize_asn1_error_table(void);\n#define init_asn1_err_tbl initialize_asn1_error_table\n\ntypedef enum asn1_error_number{\n\tASN1_BAD_TIMEFORMAT = 1859794432,\n\tASN1_MISSING_FIELD = 1859794433,\n\tASN1_MISPLACED_FIELD = 1859794434,\n\tASN1_TYPE_MISMATCH = 1859794435,\n\tASN1_OVERFLOW = 1859794436,\n\tASN1_OVERRUN = 1859794437,\n\tASN1_BAD_ID = 1859794438,\n\tASN1_BAD_LENGTH = 1859794439,\n\tASN1_BAD_FORMAT = 1859794440,\n\tASN1_PARSE_ERROR = 1859794441,\n\tASN1_EXTRA_DATA = 1859794442,\n\tASN1_BAD_CHARACTER = 1859794443,\n\tASN1_MIN_CONSTRAINT = 1859794444,\n\tASN1_MAX_CONSTRAINT = 1859794445,\n\tASN1_EXACT_CONSTRAINT = 1859794446\n} asn1_error_number;\n\n#define ERROR_TABLE_BASE_asn1 1859794432\n\n#endif /* __asn1_err_h__ */\n"
  },
  {
    "path": "freebsd-headers/assert.h",
    "content": "/*-\n * Copyright (c) 1992, 1993\n *\tThe Regents of the University of California.  All rights reserved.\n * (c) UNIX System Laboratories, Inc.\n * All or some portions of this file are derived from material licensed\n * to the University of California by American Telephone and Telegraph\n * Co. or Unix System Laboratories, Inc. and are reproduced herein with\n * the permission of UNIX System Laboratories, Inc.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t@(#)assert.h\t8.2 (Berkeley) 1/21/94\n * $FreeBSD: release/9.0.0/include/assert.h 217207 2011-01-09 21:39:46Z ed $\n */\n\n#include <sys/cdefs.h>\n\n/*\n * Unlike other ANSI header files, <assert.h> may usefully be included\n * multiple times, with and without NDEBUG defined.\n */\n\n#undef assert\n#undef _assert\n\n#ifdef NDEBUG\n#define\tassert(e)\t((void)0)\n#define\t_assert(e)\t((void)0)\n#else\n#define\t_assert(e)\tassert(e)\n\n#define\tassert(e)\t((e) ? (void)0 : __assert(__func__, __FILE__, \\\n\t\t\t    __LINE__, #e))\n#endif /* NDEBUG */\n\n#ifndef _ASSERT_H_\n#define _ASSERT_H_\n__BEGIN_DECLS\nvoid __assert(const char *, const char *, int, const char *) __dead2;\n__END_DECLS\n#endif /* !_ASSERT_H_ */\n"
  },
  {
    "path": "freebsd-headers/bitstring.h",
    "content": "/*-\n * Copyright (c) 2003 Poul-Henning Kamp\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/include/bitstring.h 116306 2003-06-13 19:40:13Z phk $\n */\n\n#ifndef _BITSTRING_H_\n#define\t_BITSTRING_H_\n\n#include <sys/bitstring.h>\n\n#endif /* _BITSTRING_H_ */\n\n"
  },
  {
    "path": "freebsd-headers/bluetooth.h",
    "content": "/*\n * bluetooth.h\n */\n\n/*-\n * Copyright (c) 2001-2009 Maksim Yevmenkin <m_evmenkin@yahoo.com>\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $Id: bluetooth.h,v 1.5 2003/09/14 23:28:42 max Exp $\n * $FreeBSD: release/9.0.0/lib/libbluetooth/bluetooth.h 213042 2010-09-22 23:41:02Z emax $\n */\n\n#ifndef _BLUETOOTH_H_\n#define _BLUETOOTH_H_\n\n#include <sys/types.h>\n#include <sys/bitstring.h>\n#include <sys/endian.h>\n#include <sys/ioctl.h>\n#include <sys/socket.h>\n#include <sys/uio.h>\n#include <sys/un.h>\n#include <errno.h>\n#include <netdb.h>\n#include <netgraph/ng_message.h>\n#include <netgraph/bluetooth/include/ng_hci.h>\n#include <netgraph/bluetooth/include/ng_l2cap.h>\n#include <netgraph/bluetooth/include/ng_btsocket.h>\n#include <time.h>\n\n__BEGIN_DECLS\n\n/*\n * Linux BlueZ compatibility\n */\n\n#define\tbacmp(ba1, ba2)\tmemcmp((ba1), (ba2), sizeof(bdaddr_t))\n#define\tbacpy(dst, src)\tmemcpy((dst), (src), sizeof(bdaddr_t))\n#define ba2str(ba, str)\tbt_ntoa((ba), (str))\n#define str2ba(str, ba)\t(bt_aton((str), (ba)) == 1? 0 : -1)\n#define htobs(d)\thtole16(d)\n#define htobl(d)\thtole32(d)\n#define btohs(d)\tle16toh(d)\n#define btohl(d)\tle32toh(d)\n\n/*\n * Interface to the outside world\n */\n\nstruct hostent *  bt_gethostbyname    (char const *name);\nstruct hostent *  bt_gethostbyaddr    (char const *addr, int len, int type);\nstruct hostent *  bt_gethostent       (void);\nvoid              bt_sethostent       (int stayopen);\nvoid              bt_endhostent       (void);\n\nstruct protoent * bt_getprotobyname   (char const *name);\nstruct protoent * bt_getprotobynumber (int proto);\nstruct protoent * bt_getprotoent      (void);\nvoid              bt_setprotoent      (int stayopen);\nvoid              bt_endprotoent      (void);\n\nchar const *      bt_ntoa             (bdaddr_t const *ba, char *str);\nint               bt_aton             (char const *str, bdaddr_t *ba);\n\n/* bt_devXXXX() functions (inspired by NetBSD) */\nint               bt_devaddr          (char const *devname, bdaddr_t *addr);\nint               bt_devname          (char *devname, bdaddr_t const *addr);\n\n/* \n * Bluetooth HCI functions\n */\n\n#define\tHCI_DEVMAX\t\t\t32\t\t/* arbitrary */\n#define\tHCI_DEVNAME_SIZE\t\tNG_NODESIZ\n#define\tHCI_DEVFEATURES_SIZE\t\tNG_HCI_FEATURES_SIZE\n\nstruct bt_devinfo\n{\n\tchar\t\tdevname[HCI_DEVNAME_SIZE];\n\n\tuint32_t\tstate;\t\t/* device/implementation specific */\n\n\tbdaddr_t\tbdaddr;\n\tuint16_t\t_reserved0;\n\n\tuint8_t\t\tfeatures[HCI_DEVFEATURES_SIZE];\n\n\t/* buffer info */\n\tuint16_t\t_reserved1;\n\tuint16_t\tcmd_free;\n\tuint16_t\tsco_size;\n\tuint16_t\tsco_pkts;\n\tuint16_t\tsco_free;\n\tuint16_t\tacl_size;\n\tuint16_t\tacl_pkts;\n\tuint16_t\tacl_free;\n\n\t/* stats */\n\tuint32_t\tcmd_sent;\n\tuint32_t\tevnt_recv;\n\tuint32_t\tacl_recv;\n\tuint32_t\tacl_sent;\n\tuint32_t\tsco_recv;\n\tuint32_t\tsco_sent;\n\tuint32_t\tbytes_recv;\n\tuint32_t\tbytes_sent;\n\n\t/* misc/specific */\n\tuint16_t\tlink_policy_info;\n\tuint16_t\tpacket_type_info;\n\tuint16_t\trole_switch_info;\n\tuint16_t\tdebug;\n\n\tuint8_t\t\t_padding[20];\t/* leave space for future additions */\n};\n\nstruct bt_devreq\n{\n\tuint16_t\topcode;\n\tuint8_t\t\tevent;\n\tvoid\t\t*cparam;\n\tsize_t\t\tclen;\n\tvoid\t\t*rparam;\n\tsize_t\t\trlen;\n};\n\nstruct bt_devfilter {\n\tbitstr_t\tbit_decl(packet_mask, 8);\n\tbitstr_t\tbit_decl(event_mask, 256);\n};\n\nstruct bt_devinquiry {\n\tbdaddr_t        bdaddr;\n\tuint8_t         pscan_rep_mode;\n\tuint8_t         pscan_period_mode;\n\tuint8_t         dev_class[3];\n\tuint16_t        clock_offset;\n\tint8_t          rssi;\n\tuint8_t         data[240];\n};\n\ntypedef int\t(bt_devenum_cb_t)(int, struct bt_devinfo const *, void *);\n\nint\t\tbt_devopen (char const *devname);\nint\t\tbt_devclose(int s);\nint\t\tbt_devsend (int s, uint16_t opcode, void *param, size_t plen);\nssize_t\t\tbt_devrecv (int s, void *buf, size_t size, time_t to);\nint\t\tbt_devreq  (int s, struct bt_devreq *r, time_t to);\nint\t\tbt_devfilter(int s, struct bt_devfilter const *newp,\n\t\t\t     struct bt_devfilter *oldp);\nvoid\t\tbt_devfilter_pkt_set(struct bt_devfilter *filter, uint8_t type);\nvoid\t\tbt_devfilter_pkt_clr(struct bt_devfilter *filter, uint8_t type);\nint\t\tbt_devfilter_pkt_tst(struct bt_devfilter const *filter, uint8_t type);\nvoid\t\tbt_devfilter_evt_set(struct bt_devfilter *filter, uint8_t event);\nvoid\t\tbt_devfilter_evt_clr(struct bt_devfilter *filter, uint8_t event);\nint\t\tbt_devfilter_evt_tst(struct bt_devfilter const *filter, uint8_t event);\nint\t\tbt_devinquiry(char const *devname, time_t length, int num_rsp,\n\t\t\t      struct bt_devinquiry **ii);\nint\t\tbt_devinfo (struct bt_devinfo *di);\nint\t\tbt_devenum (bt_devenum_cb_t *cb, void *arg);\n\n/*\n * bdaddr utility functions (from NetBSD)\n */\n\nstatic __inline int\nbdaddr_same(const bdaddr_t *a, const bdaddr_t *b)\n{\n\treturn (a->b[0] == b->b[0] && a->b[1] == b->b[1] &&\n\t\ta->b[2] == b->b[2] && a->b[3] == b->b[3] &&\n\t\ta->b[4] == b->b[4] && a->b[5] == b->b[5]);\n}\n\nstatic __inline int\nbdaddr_any(const bdaddr_t *a)\n{\n\treturn (a->b[0] == 0 && a->b[1] == 0 && a->b[2] == 0 &&\n\t\ta->b[3] == 0 && a->b[4] == 0 && a->b[5] == 0);\n}\n\nstatic __inline void\nbdaddr_copy(bdaddr_t *d, const bdaddr_t *s)\n{\n\td->b[0] = s->b[0];\n\td->b[1] = s->b[1];\n\td->b[2] = s->b[2];\n\td->b[3] = s->b[3];\n\td->b[4] = s->b[4];\n\td->b[5] = s->b[5];\n}\n\n__END_DECLS\n\n#endif /* ndef _BLUETOOTH_H_ */\n\n"
  },
  {
    "path": "freebsd-headers/bsdxml.h",
    "content": "/* Copyright (c) 1998, 1999, 2000 Thai Open Source Software Center Ltd\n   See the file src/contrib/expat/COPYING for copying permission.\n*/\n\n#ifndef Expat_INCLUDED\n#define Expat_INCLUDED 1\n\n\n#include <stdlib.h>\n#include \"bsdxml_external.h\"\n\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\nstruct XML_ParserStruct;\ntypedef struct XML_ParserStruct *XML_Parser;\n\n/* Should this be defined using stdbool.h when C99 is available? */\ntypedef unsigned char XML_Bool;\n#define XML_TRUE   ((XML_Bool) 1)\n#define XML_FALSE  ((XML_Bool) 0)\n\n/* The XML_Status enum gives the possible return values for several\n   API functions.  The preprocessor #defines are included so this\n   stanza can be added to code that still needs to support older\n   versions of Expat 1.95.x:\n\n   #ifndef XML_STATUS_OK\n   #define XML_STATUS_OK    1\n   #define XML_STATUS_ERROR 0\n   #endif\n\n   Otherwise, the #define hackery is quite ugly and would have been\n   dropped.\n*/\nenum XML_Status {\n  XML_STATUS_ERROR = 0,\n#define XML_STATUS_ERROR XML_STATUS_ERROR\n  XML_STATUS_OK = 1,\n#define XML_STATUS_OK XML_STATUS_OK\n  XML_STATUS_SUSPENDED = 2\n#define XML_STATUS_SUSPENDED XML_STATUS_SUSPENDED\n};\n\nenum XML_Error {\n  XML_ERROR_NONE,\n  XML_ERROR_NO_MEMORY,\n  XML_ERROR_SYNTAX,\n  XML_ERROR_NO_ELEMENTS,\n  XML_ERROR_INVALID_TOKEN,\n  XML_ERROR_UNCLOSED_TOKEN,\n  XML_ERROR_PARTIAL_CHAR,\n  XML_ERROR_TAG_MISMATCH,\n  XML_ERROR_DUPLICATE_ATTRIBUTE,\n  XML_ERROR_JUNK_AFTER_DOC_ELEMENT,\n  XML_ERROR_PARAM_ENTITY_REF,\n  XML_ERROR_UNDEFINED_ENTITY,\n  XML_ERROR_RECURSIVE_ENTITY_REF,\n  XML_ERROR_ASYNC_ENTITY,\n  XML_ERROR_BAD_CHAR_REF,\n  XML_ERROR_BINARY_ENTITY_REF,\n  XML_ERROR_ATTRIBUTE_EXTERNAL_ENTITY_REF,\n  XML_ERROR_MISPLACED_XML_PI,\n  XML_ERROR_UNKNOWN_ENCODING,\n  XML_ERROR_INCORRECT_ENCODING,\n  XML_ERROR_UNCLOSED_CDATA_SECTION,\n  XML_ERROR_EXTERNAL_ENTITY_HANDLING,\n  XML_ERROR_NOT_STANDALONE,\n  XML_ERROR_UNEXPECTED_STATE,\n  XML_ERROR_ENTITY_DECLARED_IN_PE,\n  XML_ERROR_FEATURE_REQUIRES_XML_DTD,\n  XML_ERROR_CANT_CHANGE_FEATURE_ONCE_PARSING,\n  /* Added in 1.95.7. */\n  XML_ERROR_UNBOUND_PREFIX,\n  /* Added in 1.95.8. */\n  XML_ERROR_UNDECLARING_PREFIX,\n  XML_ERROR_INCOMPLETE_PE,\n  XML_ERROR_XML_DECL,\n  XML_ERROR_TEXT_DECL,\n  XML_ERROR_PUBLICID,\n  XML_ERROR_SUSPENDED,\n  XML_ERROR_NOT_SUSPENDED,\n  XML_ERROR_ABORTED,\n  XML_ERROR_FINISHED,\n  XML_ERROR_SUSPEND_PE,\n  /* Added in 2.0. */\n  XML_ERROR_RESERVED_PREFIX_XML,\n  XML_ERROR_RESERVED_PREFIX_XMLNS,\n  XML_ERROR_RESERVED_NAMESPACE_URI\n};\n\nenum XML_Content_Type {\n  XML_CTYPE_EMPTY = 1,\n  XML_CTYPE_ANY,\n  XML_CTYPE_MIXED,\n  XML_CTYPE_NAME,\n  XML_CTYPE_CHOICE,\n  XML_CTYPE_SEQ\n};\n\nenum XML_Content_Quant {\n  XML_CQUANT_NONE,\n  XML_CQUANT_OPT,\n  XML_CQUANT_REP,\n  XML_CQUANT_PLUS\n};\n\n/* If type == XML_CTYPE_EMPTY or XML_CTYPE_ANY, then quant will be\n   XML_CQUANT_NONE, and the other fields will be zero or NULL.\n   If type == XML_CTYPE_MIXED, then quant will be NONE or REP and\n   numchildren will contain number of elements that may be mixed in\n   and children point to an array of XML_Content cells that will be\n   all of XML_CTYPE_NAME type with no quantification.\n\n   If type == XML_CTYPE_NAME, then the name points to the name, and\n   the numchildren field will be zero and children will be NULL. The\n   quant fields indicates any quantifiers placed on the name.\n\n   CHOICE and SEQ will have name NULL, the number of children in\n   numchildren and children will point, recursively, to an array\n   of XML_Content cells.\n\n   The EMPTY, ANY, and MIXED types will only occur at top level.\n*/\n\ntypedef struct XML_cp XML_Content;\n\nstruct XML_cp {\n  enum XML_Content_Type         type;\n  enum XML_Content_Quant        quant;\n  XML_Char *                    name;\n  unsigned int                  numchildren;\n  XML_Content *                 children;\n};\n\n\n/* This is called for an element declaration. See above for\n   description of the model argument. It's the caller's responsibility\n   to free model when finished with it.\n*/\ntypedef void (XMLCALL *XML_ElementDeclHandler) (void *userData,\n                                                const XML_Char *name,\n                                                XML_Content *model);\n\nXMLPARSEAPI(void)\nXML_SetElementDeclHandler(XML_Parser parser,\n                          XML_ElementDeclHandler eldecl);\n\n/* The Attlist declaration handler is called for *each* attribute. So\n   a single Attlist declaration with multiple attributes declared will\n   generate multiple calls to this handler. The \"default\" parameter\n   may be NULL in the case of the \"#IMPLIED\" or \"#REQUIRED\"\n   keyword. The \"isrequired\" parameter will be true and the default\n   value will be NULL in the case of \"#REQUIRED\". If \"isrequired\" is\n   true and default is non-NULL, then this is a \"#FIXED\" default.\n*/\ntypedef void (XMLCALL *XML_AttlistDeclHandler) (\n                                    void            *userData,\n                                    const XML_Char  *elname,\n                                    const XML_Char  *attname,\n                                    const XML_Char  *att_type,\n                                    const XML_Char  *dflt,\n                                    int              isrequired);\n\nXMLPARSEAPI(void)\nXML_SetAttlistDeclHandler(XML_Parser parser,\n                          XML_AttlistDeclHandler attdecl);\n\n/* The XML declaration handler is called for *both* XML declarations\n   and text declarations. The way to distinguish is that the version\n   parameter will be NULL for text declarations. The encoding\n   parameter may be NULL for XML declarations. The standalone\n   parameter will be -1, 0, or 1 indicating respectively that there\n   was no standalone parameter in the declaration, that it was given\n   as no, or that it was given as yes.\n*/\ntypedef void (XMLCALL *XML_XmlDeclHandler) (void           *userData,\n                                            const XML_Char *version,\n                                            const XML_Char *encoding,\n                                            int             standalone);\n\nXMLPARSEAPI(void)\nXML_SetXmlDeclHandler(XML_Parser parser,\n                      XML_XmlDeclHandler xmldecl);\n\n\ntypedef struct {\n  void *(*malloc_fcn)(size_t size);\n  void *(*realloc_fcn)(void *ptr, size_t size);\n  void (*free_fcn)(void *ptr);\n} XML_Memory_Handling_Suite;\n\n/* Constructs a new parser; encoding is the encoding specified by the\n   external protocol or NULL if there is none specified.\n*/\nXMLPARSEAPI(XML_Parser)\nXML_ParserCreate(const XML_Char *encoding);\n\n/* Constructs a new parser and namespace processor.  Element type\n   names and attribute names that belong to a namespace will be\n   expanded; unprefixed attribute names are never expanded; unprefixed\n   element type names are expanded only if there is a default\n   namespace. The expanded name is the concatenation of the namespace\n   URI, the namespace separator character, and the local part of the\n   name.  If the namespace separator is '\\0' then the namespace URI\n   and the local part will be concatenated without any separator.\n   It is a programming error to use the separator '\\0' with namespace\n   triplets (see XML_SetReturnNSTriplet).\n*/\nXMLPARSEAPI(XML_Parser)\nXML_ParserCreateNS(const XML_Char *encoding, XML_Char namespaceSeparator);\n\n\n/* Constructs a new parser using the memory management suite referred to\n   by memsuite. If memsuite is NULL, then use the standard library memory\n   suite. If namespaceSeparator is non-NULL it creates a parser with\n   namespace processing as described above. The character pointed at\n   will serve as the namespace separator.\n\n   All further memory operations used for the created parser will come from\n   the given suite.\n*/\nXMLPARSEAPI(XML_Parser)\nXML_ParserCreate_MM(const XML_Char *encoding,\n                    const XML_Memory_Handling_Suite *memsuite,\n                    const XML_Char *namespaceSeparator);\n\n/* Prepare a parser object to be re-used.  This is particularly\n   valuable when memory allocation overhead is disproportionatly high,\n   such as when a large number of small documnents need to be parsed.\n   All handlers are cleared from the parser, except for the\n   unknownEncodingHandler. The parser's external state is re-initialized\n   except for the values of ns and ns_triplets.\n\n   Added in Expat 1.95.3.\n*/\nXMLPARSEAPI(XML_Bool)\nXML_ParserReset(XML_Parser parser, const XML_Char *encoding);\n\n/* atts is array of name/value pairs, terminated by 0;\n   names and values are 0 terminated.\n*/\ntypedef void (XMLCALL *XML_StartElementHandler) (void *userData,\n                                                 const XML_Char *name,\n                                                 const XML_Char **atts);\n\ntypedef void (XMLCALL *XML_EndElementHandler) (void *userData,\n                                               const XML_Char *name);\n\n\n/* s is not 0 terminated. */\ntypedef void (XMLCALL *XML_CharacterDataHandler) (void *userData,\n                                                  const XML_Char *s,\n                                                  int len);\n\n/* target and data are 0 terminated */\ntypedef void (XMLCALL *XML_ProcessingInstructionHandler) (\n                                                void *userData,\n                                                const XML_Char *target,\n                                                const XML_Char *data);\n\n/* data is 0 terminated */\ntypedef void (XMLCALL *XML_CommentHandler) (void *userData,\n                                            const XML_Char *data);\n\ntypedef void (XMLCALL *XML_StartCdataSectionHandler) (void *userData);\ntypedef void (XMLCALL *XML_EndCdataSectionHandler) (void *userData);\n\n/* This is called for any characters in the XML document for which\n   there is no applicable handler.  This includes both characters that\n   are part of markup which is of a kind that is not reported\n   (comments, markup declarations), or characters that are part of a\n   construct which could be reported but for which no handler has been\n   supplied. The characters are passed exactly as they were in the XML\n   document except that they will be encoded in UTF-8 or UTF-16.\n   Line boundaries are not normalized. Note that a byte order mark\n   character is not passed to the default handler. There are no\n   guarantees about how characters are divided between calls to the\n   default handler: for example, a comment might be split between\n   multiple calls.\n*/\ntypedef void (XMLCALL *XML_DefaultHandler) (void *userData,\n                                            const XML_Char *s,\n                                            int len);\n\n/* This is called for the start of the DOCTYPE declaration, before\n   any DTD or internal subset is parsed.\n*/\ntypedef void (XMLCALL *XML_StartDoctypeDeclHandler) (\n                                            void *userData,\n                                            const XML_Char *doctypeName,\n                                            const XML_Char *sysid,\n                                            const XML_Char *pubid,\n                                            int has_internal_subset);\n\n/* This is called for the start of the DOCTYPE declaration when the\n   closing > is encountered, but after processing any external\n   subset.\n*/\ntypedef void (XMLCALL *XML_EndDoctypeDeclHandler)(void *userData);\n\n/* This is called for entity declarations. The is_parameter_entity\n   argument will be non-zero if the entity is a parameter entity, zero\n   otherwise.\n\n   For internal entities (<!ENTITY foo \"bar\">), value will\n   be non-NULL and systemId, publicID, and notationName will be NULL.\n   The value string is NOT nul-terminated; the length is provided in\n   the value_length argument. Since it is legal to have zero-length\n   values, do not use this argument to test for internal entities.\n\n   For external entities, value will be NULL and systemId will be\n   non-NULL. The publicId argument will be NULL unless a public\n   identifier was provided. The notationName argument will have a\n   non-NULL value only for unparsed entity declarations.\n\n   Note that is_parameter_entity can't be changed to XML_Bool, since\n   that would break binary compatibility.\n*/\ntypedef void (XMLCALL *XML_EntityDeclHandler) (\n                              void *userData,\n                              const XML_Char *entityName,\n                              int is_parameter_entity,\n                              const XML_Char *value,\n                              int value_length,\n                              const XML_Char *base,\n                              const XML_Char *systemId,\n                              const XML_Char *publicId,\n                              const XML_Char *notationName);\n\nXMLPARSEAPI(void)\nXML_SetEntityDeclHandler(XML_Parser parser,\n                         XML_EntityDeclHandler handler);\n\n/* OBSOLETE -- OBSOLETE -- OBSOLETE\n   This handler has been superceded by the EntityDeclHandler above.\n   It is provided here for backward compatibility.\n\n   This is called for a declaration of an unparsed (NDATA) entity.\n   The base argument is whatever was set by XML_SetBase. The\n   entityName, systemId and notationName arguments will never be\n   NULL. The other arguments may be.\n*/\ntypedef void (XMLCALL *XML_UnparsedEntityDeclHandler) (\n                                    void *userData,\n                                    const XML_Char *entityName,\n                                    const XML_Char *base,\n                                    const XML_Char *systemId,\n                                    const XML_Char *publicId,\n                                    const XML_Char *notationName);\n\n/* This is called for a declaration of notation.  The base argument is\n   whatever was set by XML_SetBase. The notationName will never be\n   NULL.  The other arguments can be.\n*/\ntypedef void (XMLCALL *XML_NotationDeclHandler) (\n                                    void *userData,\n                                    const XML_Char *notationName,\n                                    const XML_Char *base,\n                                    const XML_Char *systemId,\n                                    const XML_Char *publicId);\n\n/* When namespace processing is enabled, these are called once for\n   each namespace declaration. The call to the start and end element\n   handlers occur between the calls to the start and end namespace\n   declaration handlers. For an xmlns attribute, prefix will be\n   NULL.  For an xmlns=\"\" attribute, uri will be NULL.\n*/\ntypedef void (XMLCALL *XML_StartNamespaceDeclHandler) (\n                                    void *userData,\n                                    const XML_Char *prefix,\n                                    const XML_Char *uri);\n\ntypedef void (XMLCALL *XML_EndNamespaceDeclHandler) (\n                                    void *userData,\n                                    const XML_Char *prefix);\n\n/* This is called if the document is not standalone, that is, it has an\n   external subset or a reference to a parameter entity, but does not\n   have standalone=\"yes\". If this handler returns XML_STATUS_ERROR,\n   then processing will not continue, and the parser will return a\n   XML_ERROR_NOT_STANDALONE error.\n   If parameter entity parsing is enabled, then in addition to the\n   conditions above this handler will only be called if the referenced\n   entity was actually read.\n*/\ntypedef int (XMLCALL *XML_NotStandaloneHandler) (void *userData);\n\n/* This is called for a reference to an external parsed general\n   entity.  The referenced entity is not automatically parsed.  The\n   application can parse it immediately or later using\n   XML_ExternalEntityParserCreate.\n\n   The parser argument is the parser parsing the entity containing the\n   reference; it can be passed as the parser argument to\n   XML_ExternalEntityParserCreate.  The systemId argument is the\n   system identifier as specified in the entity declaration; it will\n   not be NULL.\n\n   The base argument is the system identifier that should be used as\n   the base for resolving systemId if systemId was relative; this is\n   set by XML_SetBase; it may be NULL.\n\n   The publicId argument is the public identifier as specified in the\n   entity declaration, or NULL if none was specified; the whitespace\n   in the public identifier will have been normalized as required by\n   the XML spec.\n\n   The context argument specifies the parsing context in the format\n   expected by the context argument to XML_ExternalEntityParserCreate;\n   context is valid only until the handler returns, so if the\n   referenced entity is to be parsed later, it must be copied.\n   context is NULL only when the entity is a parameter entity.\n\n   The handler should return XML_STATUS_ERROR if processing should not\n   continue because of a fatal error in the handling of the external\n   entity.  In this case the calling parser will return an\n   XML_ERROR_EXTERNAL_ENTITY_HANDLING error.\n\n   Note that unlike other handlers the first argument is the parser,\n   not userData.\n*/\ntypedef int (XMLCALL *XML_ExternalEntityRefHandler) (\n                                    XML_Parser parser,\n                                    const XML_Char *context,\n                                    const XML_Char *base,\n                                    const XML_Char *systemId,\n                                    const XML_Char *publicId);\n\n/* This is called in two situations:\n   1) An entity reference is encountered for which no declaration\n      has been read *and* this is not an error.\n   2) An internal entity reference is read, but not expanded, because\n      XML_SetDefaultHandler has been called.\n   Note: skipped parameter entities in declarations and skipped general\n         entities in attribute values cannot be reported, because\n         the event would be out of sync with the reporting of the\n         declarations or attribute values\n*/\ntypedef void (XMLCALL *XML_SkippedEntityHandler) (\n                                    void *userData,\n                                    const XML_Char *entityName,\n                                    int is_parameter_entity);\n\n/* This structure is filled in by the XML_UnknownEncodingHandler to\n   provide information to the parser about encodings that are unknown\n   to the parser.\n\n   The map[b] member gives information about byte sequences whose\n   first byte is b.\n\n   If map[b] is c where c is >= 0, then b by itself encodes the\n   Unicode scalar value c.\n\n   If map[b] is -1, then the byte sequence is malformed.\n\n   If map[b] is -n, where n >= 2, then b is the first byte of an\n   n-byte sequence that encodes a single Unicode scalar value.\n\n   The data member will be passed as the first argument to the convert\n   function.\n\n   The convert function is used to convert multibyte sequences; s will\n   point to a n-byte sequence where map[(unsigned char)*s] == -n.  The\n   convert function must return the Unicode scalar value represented\n   by this byte sequence or -1 if the byte sequence is malformed.\n\n   The convert function may be NULL if the encoding is a single-byte\n   encoding, that is if map[b] >= -1 for all bytes b.\n\n   When the parser is finished with the encoding, then if release is\n   not NULL, it will call release passing it the data member; once\n   release has been called, the convert function will not be called\n   again.\n\n   Expat places certain restrictions on the encodings that are supported\n   using this mechanism.\n\n   1. Every ASCII character that can appear in a well-formed XML document,\n      other than the characters\n\n      $@\\^`{}~\n\n      must be represented by a single byte, and that byte must be the\n      same byte that represents that character in ASCII.\n\n   2. No character may require more than 4 bytes to encode.\n\n   3. All characters encoded must have Unicode scalar values <=\n      0xFFFF, (i.e., characters that would be encoded by surrogates in\n      UTF-16 are  not allowed).  Note that this restriction doesn't\n      apply to the built-in support for UTF-8 and UTF-16.\n\n   4. No Unicode character may be encoded by more than one distinct\n      sequence of bytes.\n*/\ntypedef struct {\n  int map[256];\n  void *data;\n  int (XMLCALL *convert)(void *data, const char *s);\n  void (XMLCALL *release)(void *data);\n} XML_Encoding;\n\n/* This is called for an encoding that is unknown to the parser.\n\n   The encodingHandlerData argument is that which was passed as the\n   second argument to XML_SetUnknownEncodingHandler.\n\n   The name argument gives the name of the encoding as specified in\n   the encoding declaration.\n\n   If the callback can provide information about the encoding, it must\n   fill in the XML_Encoding structure, and return XML_STATUS_OK.\n   Otherwise it must return XML_STATUS_ERROR.\n\n   If info does not describe a suitable encoding, then the parser will\n   return an XML_UNKNOWN_ENCODING error.\n*/\ntypedef int (XMLCALL *XML_UnknownEncodingHandler) (\n                                    void *encodingHandlerData,\n                                    const XML_Char *name,\n                                    XML_Encoding *info);\n\nXMLPARSEAPI(void)\nXML_SetElementHandler(XML_Parser parser,\n                      XML_StartElementHandler start,\n                      XML_EndElementHandler end);\n\nXMLPARSEAPI(void)\nXML_SetStartElementHandler(XML_Parser parser,\n                           XML_StartElementHandler handler);\n\nXMLPARSEAPI(void)\nXML_SetEndElementHandler(XML_Parser parser,\n                         XML_EndElementHandler handler);\n\nXMLPARSEAPI(void)\nXML_SetCharacterDataHandler(XML_Parser parser,\n                            XML_CharacterDataHandler handler);\n\nXMLPARSEAPI(void)\nXML_SetProcessingInstructionHandler(XML_Parser parser,\n                                    XML_ProcessingInstructionHandler handler);\nXMLPARSEAPI(void)\nXML_SetCommentHandler(XML_Parser parser,\n                      XML_CommentHandler handler);\n\nXMLPARSEAPI(void)\nXML_SetCdataSectionHandler(XML_Parser parser,\n                           XML_StartCdataSectionHandler start,\n                           XML_EndCdataSectionHandler end);\n\nXMLPARSEAPI(void)\nXML_SetStartCdataSectionHandler(XML_Parser parser,\n                                XML_StartCdataSectionHandler start);\n\nXMLPARSEAPI(void)\nXML_SetEndCdataSectionHandler(XML_Parser parser,\n                              XML_EndCdataSectionHandler end);\n\n/* This sets the default handler and also inhibits expansion of\n   internal entities. These entity references will be passed to the\n   default handler, or to the skipped entity handler, if one is set.\n*/\nXMLPARSEAPI(void)\nXML_SetDefaultHandler(XML_Parser parser,\n                      XML_DefaultHandler handler);\n\n/* This sets the default handler but does not inhibit expansion of\n   internal entities.  The entity reference will not be passed to the\n   default handler.\n*/\nXMLPARSEAPI(void)\nXML_SetDefaultHandlerExpand(XML_Parser parser,\n                            XML_DefaultHandler handler);\n\nXMLPARSEAPI(void)\nXML_SetDoctypeDeclHandler(XML_Parser parser,\n                          XML_StartDoctypeDeclHandler start,\n                          XML_EndDoctypeDeclHandler end);\n\nXMLPARSEAPI(void)\nXML_SetStartDoctypeDeclHandler(XML_Parser parser,\n                               XML_StartDoctypeDeclHandler start);\n\nXMLPARSEAPI(void)\nXML_SetEndDoctypeDeclHandler(XML_Parser parser,\n                             XML_EndDoctypeDeclHandler end);\n\nXMLPARSEAPI(void)\nXML_SetUnparsedEntityDeclHandler(XML_Parser parser,\n                                 XML_UnparsedEntityDeclHandler handler);\n\nXMLPARSEAPI(void)\nXML_SetNotationDeclHandler(XML_Parser parser,\n                           XML_NotationDeclHandler handler);\n\nXMLPARSEAPI(void)\nXML_SetNamespaceDeclHandler(XML_Parser parser,\n                            XML_StartNamespaceDeclHandler start,\n                            XML_EndNamespaceDeclHandler end);\n\nXMLPARSEAPI(void)\nXML_SetStartNamespaceDeclHandler(XML_Parser parser,\n                                 XML_StartNamespaceDeclHandler start);\n\nXMLPARSEAPI(void)\nXML_SetEndNamespaceDeclHandler(XML_Parser parser,\n                               XML_EndNamespaceDeclHandler end);\n\nXMLPARSEAPI(void)\nXML_SetNotStandaloneHandler(XML_Parser parser,\n                            XML_NotStandaloneHandler handler);\n\nXMLPARSEAPI(void)\nXML_SetExternalEntityRefHandler(XML_Parser parser,\n                                XML_ExternalEntityRefHandler handler);\n\n/* If a non-NULL value for arg is specified here, then it will be\n   passed as the first argument to the external entity ref handler\n   instead of the parser object.\n*/\nXMLPARSEAPI(void)\nXML_SetExternalEntityRefHandlerArg(XML_Parser parser,\n                                   void *arg);\n\nXMLPARSEAPI(void)\nXML_SetSkippedEntityHandler(XML_Parser parser,\n                            XML_SkippedEntityHandler handler);\n\nXMLPARSEAPI(void)\nXML_SetUnknownEncodingHandler(XML_Parser parser,\n                              XML_UnknownEncodingHandler handler,\n                              void *encodingHandlerData);\n\n/* This can be called within a handler for a start element, end\n   element, processing instruction or character data.  It causes the\n   corresponding markup to be passed to the default handler.\n*/\nXMLPARSEAPI(void)\nXML_DefaultCurrent(XML_Parser parser);\n\n/* If do_nst is non-zero, and namespace processing is in effect, and\n   a name has a prefix (i.e. an explicit namespace qualifier) then\n   that name is returned as a triplet in a single string separated by\n   the separator character specified when the parser was created: URI\n   + sep + local_name + sep + prefix.\n\n   If do_nst is zero, then namespace information is returned in the\n   default manner (URI + sep + local_name) whether or not the name\n   has a prefix.\n\n   Note: Calling XML_SetReturnNSTriplet after XML_Parse or\n     XML_ParseBuffer has no effect.\n*/\n\nXMLPARSEAPI(void)\nXML_SetReturnNSTriplet(XML_Parser parser, int do_nst);\n\n/* This value is passed as the userData argument to callbacks. */\nXMLPARSEAPI(void)\nXML_SetUserData(XML_Parser parser, void *userData);\n\n/* Returns the last value set by XML_SetUserData or NULL. */\n#define XML_GetUserData(parser) (*(void **)(parser))\n\n/* This is equivalent to supplying an encoding argument to\n   XML_ParserCreate. On success XML_SetEncoding returns non-zero,\n   zero otherwise.\n   Note: Calling XML_SetEncoding after XML_Parse or XML_ParseBuffer\n     has no effect and returns XML_STATUS_ERROR.\n*/\nXMLPARSEAPI(enum XML_Status)\nXML_SetEncoding(XML_Parser parser, const XML_Char *encoding);\n\n/* If this function is called, then the parser will be passed as the\n   first argument to callbacks instead of userData.  The userData will\n   still be accessible using XML_GetUserData.\n*/\nXMLPARSEAPI(void)\nXML_UseParserAsHandlerArg(XML_Parser parser);\n\n/* If useDTD == XML_TRUE is passed to this function, then the parser\n   will assume that there is an external subset, even if none is\n   specified in the document. In such a case the parser will call the\n   externalEntityRefHandler with a value of NULL for the systemId\n   argument (the publicId and context arguments will be NULL as well).\n   Note: For the purpose of checking WFC: Entity Declared, passing\n     useDTD == XML_TRUE will make the parser behave as if the document\n     had a DTD with an external subset.\n   Note: If this function is called, then this must be done before\n     the first call to XML_Parse or XML_ParseBuffer, since it will\n     have no effect after that.  Returns\n     XML_ERROR_CANT_CHANGE_FEATURE_ONCE_PARSING.\n   Note: If the document does not have a DOCTYPE declaration at all,\n     then startDoctypeDeclHandler and endDoctypeDeclHandler will not\n     be called, despite an external subset being parsed.\n   Note: If XML_DTD is not defined when Expat is compiled, returns\n     XML_ERROR_FEATURE_REQUIRES_XML_DTD.\n*/\nXMLPARSEAPI(enum XML_Error)\nXML_UseForeignDTD(XML_Parser parser, XML_Bool useDTD);\n\n\n/* Sets the base to be used for resolving relative URIs in system\n   identifiers in declarations.  Resolving relative identifiers is\n   left to the application: this value will be passed through as the\n   base argument to the XML_ExternalEntityRefHandler,\n   XML_NotationDeclHandler and XML_UnparsedEntityDeclHandler. The base\n   argument will be copied.  Returns XML_STATUS_ERROR if out of memory,\n   XML_STATUS_OK otherwise.\n*/\nXMLPARSEAPI(enum XML_Status)\nXML_SetBase(XML_Parser parser, const XML_Char *base);\n\nXMLPARSEAPI(const XML_Char *)\nXML_GetBase(XML_Parser parser);\n\n/* Returns the number of the attribute/value pairs passed in last call\n   to the XML_StartElementHandler that were specified in the start-tag\n   rather than defaulted. Each attribute/value pair counts as 2; thus\n   this correspondds to an index into the atts array passed to the\n   XML_StartElementHandler.\n*/\nXMLPARSEAPI(int)\nXML_GetSpecifiedAttributeCount(XML_Parser parser);\n\n/* Returns the index of the ID attribute passed in the last call to\n   XML_StartElementHandler, or -1 if there is no ID attribute.  Each\n   attribute/value pair counts as 2; thus this correspondds to an\n   index into the atts array passed to the XML_StartElementHandler.\n*/\nXMLPARSEAPI(int)\nXML_GetIdAttributeIndex(XML_Parser parser);\n\n/* Parses some input. Returns XML_STATUS_ERROR if a fatal error is\n   detected.  The last call to XML_Parse must have isFinal true; len\n   may be zero for this call (or any other).\n\n   Though the return values for these functions has always been\n   described as a Boolean value, the implementation, at least for the\n   1.95.x series, has always returned exactly one of the XML_Status\n   values.\n*/\nXMLPARSEAPI(enum XML_Status)\nXML_Parse(XML_Parser parser, const char *s, int len, int isFinal);\n\nXMLPARSEAPI(void *)\nXML_GetBuffer(XML_Parser parser, int len);\n\nXMLPARSEAPI(enum XML_Status)\nXML_ParseBuffer(XML_Parser parser, int len, int isFinal);\n\n/* Stops parsing, causing XML_Parse() or XML_ParseBuffer() to return.\n   Must be called from within a call-back handler, except when aborting\n   (resumable = 0) an already suspended parser. Some call-backs may\n   still follow because they would otherwise get lost. Examples:\n   - endElementHandler() for empty elements when stopped in\n     startElementHandler(), \n   - endNameSpaceDeclHandler() when stopped in endElementHandler(), \n   and possibly others.\n\n   Can be called from most handlers, including DTD related call-backs,\n   except when parsing an external parameter entity and resumable != 0.\n   Returns XML_STATUS_OK when successful, XML_STATUS_ERROR otherwise.\n   Possible error codes: \n   - XML_ERROR_SUSPENDED: when suspending an already suspended parser.\n   - XML_ERROR_FINISHED: when the parser has already finished.\n   - XML_ERROR_SUSPEND_PE: when suspending while parsing an external PE.\n\n   When resumable != 0 (true) then parsing is suspended, that is, \n   XML_Parse() and XML_ParseBuffer() return XML_STATUS_SUSPENDED. \n   Otherwise, parsing is aborted, that is, XML_Parse() and XML_ParseBuffer()\n   return XML_STATUS_ERROR with error code XML_ERROR_ABORTED.\n\n   *Note*:\n   This will be applied to the current parser instance only, that is, if\n   there is a parent parser then it will continue parsing when the\n   externalEntityRefHandler() returns. It is up to the implementation of\n   the externalEntityRefHandler() to call XML_StopParser() on the parent\n   parser (recursively), if one wants to stop parsing altogether.\n\n   When suspended, parsing can be resumed by calling XML_ResumeParser(). \n*/\nXMLPARSEAPI(enum XML_Status)\nXML_StopParser(XML_Parser parser, XML_Bool resumable);\n\n/* Resumes parsing after it has been suspended with XML_StopParser().\n   Must not be called from within a handler call-back. Returns same\n   status codes as XML_Parse() or XML_ParseBuffer().\n   Additional error code XML_ERROR_NOT_SUSPENDED possible.   \n\n   *Note*:\n   This must be called on the most deeply nested child parser instance\n   first, and on its parent parser only after the child parser has finished,\n   to be applied recursively until the document entity's parser is restarted.\n   That is, the parent parser will not resume by itself and it is up to the\n   application to call XML_ResumeParser() on it at the appropriate moment.\n*/\nXMLPARSEAPI(enum XML_Status)\nXML_ResumeParser(XML_Parser parser);\n\nenum XML_Parsing {\n  XML_INITIALIZED,\n  XML_PARSING,\n  XML_FINISHED,\n  XML_SUSPENDED\n};\n\ntypedef struct {\n  enum XML_Parsing parsing;\n  XML_Bool finalBuffer;\n} XML_ParsingStatus;\n\n/* Returns status of parser with respect to being initialized, parsing,\n   finished, or suspended and processing the final buffer.\n   XXX XML_Parse() and XML_ParseBuffer() should return XML_ParsingStatus,\n   XXX with XML_FINISHED_OK or XML_FINISHED_ERROR replacing XML_FINISHED\n*/\nXMLPARSEAPI(void)\nXML_GetParsingStatus(XML_Parser parser, XML_ParsingStatus *status);\n\n/* Creates an XML_Parser object that can parse an external general\n   entity; context is a '\\0'-terminated string specifying the parse\n   context; encoding is a '\\0'-terminated string giving the name of\n   the externally specified encoding, or NULL if there is no\n   externally specified encoding.  The context string consists of a\n   sequence of tokens separated by formfeeds (\\f); a token consisting\n   of a name specifies that the general entity of the name is open; a\n   token of the form prefix=uri specifies the namespace for a\n   particular prefix; a token of the form =uri specifies the default\n   namespace.  This can be called at any point after the first call to\n   an ExternalEntityRefHandler so longer as the parser has not yet\n   been freed.  The new parser is completely independent and may\n   safely be used in a separate thread.  The handlers and userData are\n   initialized from the parser argument.  Returns NULL if out of memory.\n   Otherwise returns a new XML_Parser object.\n*/\nXMLPARSEAPI(XML_Parser)\nXML_ExternalEntityParserCreate(XML_Parser parser,\n                               const XML_Char *context,\n                               const XML_Char *encoding);\n\nenum XML_ParamEntityParsing {\n  XML_PARAM_ENTITY_PARSING_NEVER,\n  XML_PARAM_ENTITY_PARSING_UNLESS_STANDALONE,\n  XML_PARAM_ENTITY_PARSING_ALWAYS\n};\n\n/* Controls parsing of parameter entities (including the external DTD\n   subset). If parsing of parameter entities is enabled, then\n   references to external parameter entities (including the external\n   DTD subset) will be passed to the handler set with\n   XML_SetExternalEntityRefHandler.  The context passed will be 0.\n\n   Unlike external general entities, external parameter entities can\n   only be parsed synchronously.  If the external parameter entity is\n   to be parsed, it must be parsed during the call to the external\n   entity ref handler: the complete sequence of\n   XML_ExternalEntityParserCreate, XML_Parse/XML_ParseBuffer and\n   XML_ParserFree calls must be made during this call.  After\n   XML_ExternalEntityParserCreate has been called to create the parser\n   for the external parameter entity (context must be 0 for this\n   call), it is illegal to make any calls on the old parser until\n   XML_ParserFree has been called on the newly created parser.\n   If the library has been compiled without support for parameter\n   entity parsing (ie without XML_DTD being defined), then\n   XML_SetParamEntityParsing will return 0 if parsing of parameter\n   entities is requested; otherwise it will return non-zero.\n   Note: If XML_SetParamEntityParsing is called after XML_Parse or\n      XML_ParseBuffer, then it has no effect and will always return 0.\n*/\nXMLPARSEAPI(int)\nXML_SetParamEntityParsing(XML_Parser parser,\n                          enum XML_ParamEntityParsing parsing);\n\n/* If XML_Parse or XML_ParseBuffer have returned XML_STATUS_ERROR, then\n   XML_GetErrorCode returns information about the error.\n*/\nXMLPARSEAPI(enum XML_Error)\nXML_GetErrorCode(XML_Parser parser);\n\n/* These functions return information about the current parse\n   location.  They may be called from any callback called to report\n   some parse event; in this case the location is the location of the\n   first of the sequence of characters that generated the event.  When\n   called from callbacks generated by declarations in the document\n   prologue, the location identified isn't as neatly defined, but will\n   be within the relevant markup.  When called outside of the callback\n   functions, the position indicated will be just past the last parse\n   event (regardless of whether there was an associated callback).\n   \n   They may also be called after returning from a call to XML_Parse\n   or XML_ParseBuffer.  If the return value is XML_STATUS_ERROR then\n   the location is the location of the character at which the error\n   was detected; otherwise the location is the location of the last\n   parse event, as described above.\n*/\nXMLPARSEAPI(XML_Size) XML_GetCurrentLineNumber(XML_Parser parser);\nXMLPARSEAPI(XML_Size) XML_GetCurrentColumnNumber(XML_Parser parser);\nXMLPARSEAPI(XML_Index) XML_GetCurrentByteIndex(XML_Parser parser);\n\n/* Return the number of bytes in the current event.\n   Returns 0 if the event is in an internal entity.\n*/\nXMLPARSEAPI(int)\nXML_GetCurrentByteCount(XML_Parser parser);\n\n/* If XML_CONTEXT_BYTES is defined, returns the input buffer, sets\n   the integer pointed to by offset to the offset within this buffer\n   of the current parse position, and sets the integer pointed to by size\n   to the size of this buffer (the number of input bytes). Otherwise\n   returns a NULL pointer. Also returns a NULL pointer if a parse isn't\n   active.\n\n   NOTE: The character pointer returned should not be used outside\n   the handler that makes the call.\n*/\nXMLPARSEAPI(const char *)\nXML_GetInputContext(XML_Parser parser,\n                    int *offset,\n                    int *size);\n\n/* For backwards compatibility with previous versions. */\n#define XML_GetErrorLineNumber   XML_GetCurrentLineNumber\n#define XML_GetErrorColumnNumber XML_GetCurrentColumnNumber\n#define XML_GetErrorByteIndex    XML_GetCurrentByteIndex\n\n/* Frees the content model passed to the element declaration handler */\nXMLPARSEAPI(void)\nXML_FreeContentModel(XML_Parser parser, XML_Content *model);\n\n/* Exposing the memory handling functions used in Expat */\nXMLPARSEAPI(void *)\nXML_MemMalloc(XML_Parser parser, size_t size);\n\nXMLPARSEAPI(void *)\nXML_MemRealloc(XML_Parser parser, void *ptr, size_t size);\n\nXMLPARSEAPI(void)\nXML_MemFree(XML_Parser parser, void *ptr);\n\n/* Frees memory used by the parser. */\nXMLPARSEAPI(void)\nXML_ParserFree(XML_Parser parser);\n\n/* Returns a string describing the error. */\nXMLPARSEAPI(const XML_LChar *)\nXML_ErrorString(enum XML_Error code);\n\n/* Return a string containing the version number of this expat */\nXMLPARSEAPI(const XML_LChar *)\nXML_ExpatVersion(void);\n\ntypedef struct {\n  int major;\n  int minor;\n  int micro;\n} XML_Expat_Version;\n\n/* Return an XML_Expat_Version structure containing numeric version\n   number information for this version of expat.\n*/\nXMLPARSEAPI(XML_Expat_Version)\nXML_ExpatVersionInfo(void);\n\n/* Added in Expat 1.95.5. */\nenum XML_FeatureEnum {\n  XML_FEATURE_END = 0,\n  XML_FEATURE_UNICODE,\n  XML_FEATURE_UNICODE_WCHAR_T,\n  XML_FEATURE_DTD,\n  XML_FEATURE_CONTEXT_BYTES,\n  XML_FEATURE_MIN_SIZE,\n  XML_FEATURE_SIZEOF_XML_CHAR,\n  XML_FEATURE_SIZEOF_XML_LCHAR,\n  XML_FEATURE_NS,\n  XML_FEATURE_LARGE_SIZE\n  /* Additional features must be added to the end of this enum. */\n};\n\ntypedef struct {\n  enum XML_FeatureEnum  feature;\n  const XML_LChar       *name;\n  long int              value;\n} XML_Feature;\n\nXMLPARSEAPI(const XML_Feature *)\nXML_GetFeatureList(void);\n\n\n/* Expat follows the GNU/Linux convention of odd number minor version for\n   beta/development releases and even number minor version for stable\n   releases. Micro is bumped with each release, and set to 0 with each\n   change to major or minor version.\n*/\n#define XML_MAJOR_VERSION 2\n#define XML_MINOR_VERSION 0\n#define XML_MICRO_VERSION 1\n\n#ifdef __cplusplus\n}\n#endif\n\n#endif /* not Expat_INCLUDED */\n"
  },
  {
    "path": "freebsd-headers/bsdxml_external.h",
    "content": "/* Copyright (c) 1998, 1999, 2000 Thai Open Source Software Center Ltd\n   See the file COPYING for copying permission.\n*/\n\n#ifndef Expat_External_INCLUDED\n#define Expat_External_INCLUDED 1\n\n/* External API definitions */\n\n#if defined(_MSC_EXTENSIONS) && !defined(__BEOS__) && !defined(__CYGWIN__)\n#define XML_USE_MSC_EXTENSIONS 1\n#endif\n\n/* Expat tries very hard to make the API boundary very specifically\n   defined.  There are two macros defined to control this boundary;\n   each of these can be defined before including this header to\n   achieve some different behavior, but doing so it not recommended or\n   tested frequently.\n\n   XMLCALL    - The calling convention to use for all calls across the\n                \"library boundary.\"  This will default to cdecl, and\n                try really hard to tell the compiler that's what we\n                want.\n\n   XMLIMPORT  - Whatever magic is needed to note that a function is\n                to be imported from a dynamically loaded library\n                (.dll, .so, or .sl, depending on your platform).\n\n   The XMLCALL macro was added in Expat 1.95.7.  The only one which is\n   expected to be directly useful in client code is XMLCALL.\n\n   Note that on at least some Unix versions, the Expat library must be\n   compiled with the cdecl calling convention as the default since\n   system headers may assume the cdecl convention.\n*/\n#ifndef XMLCALL\n#if defined(_MSC_VER)\n#define XMLCALL __cdecl\n#elif defined(__GNUC__) && defined(__i386) && !defined(__INTEL_COMPILER)\n#define XMLCALL __attribute__((cdecl))\n#else\n/* For any platform which uses this definition and supports more than\n   one calling convention, we need to extend this definition to\n   declare the convention used on that platform, if it's possible to\n   do so.\n\n   If this is the case for your platform, please file a bug report\n   with information on how to identify your platform via the C\n   pre-processor and how to specify the same calling convention as the\n   platform's malloc() implementation.\n*/\n#define XMLCALL\n#endif\n#endif  /* not defined XMLCALL */\n\n\n#if !defined(XML_STATIC) && !defined(XMLIMPORT)\n#ifndef XML_BUILDING_EXPAT\n/* using Expat from an application */\n\n#ifdef XML_USE_MSC_EXTENSIONS\n#define XMLIMPORT __declspec(dllimport)\n#endif\n\n#endif\n#endif  /* not defined XML_STATIC */\n\n\n/* If we didn't define it above, define it away: */\n#ifndef XMLIMPORT\n#define XMLIMPORT\n#endif\n\n\n#define XMLPARSEAPI(type) XMLIMPORT type XMLCALL\n\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\n#ifdef XML_UNICODE_WCHAR_T\n#define XML_UNICODE\n#endif\n\n#ifdef XML_UNICODE     /* Information is UTF-16 encoded. */\n#ifdef XML_UNICODE_WCHAR_T\ntypedef wchar_t XML_Char;\ntypedef wchar_t XML_LChar;\n#else\ntypedef unsigned short XML_Char;\ntypedef char XML_LChar;\n#endif /* XML_UNICODE_WCHAR_T */\n#else                  /* Information is UTF-8 encoded. */\ntypedef char XML_Char;\ntypedef char XML_LChar;\n#endif /* XML_UNICODE */\n\n#ifdef XML_LARGE_SIZE  /* Use large integers for file/stream positions. */\n#if defined(XML_USE_MSC_EXTENSIONS) && _MSC_VER < 1400\ntypedef __int64 XML_Index; \ntypedef unsigned __int64 XML_Size;\n#else\ntypedef long long XML_Index;\ntypedef unsigned long long XML_Size;\n#endif\n#else\ntypedef long XML_Index;\ntypedef unsigned long XML_Size;\n#endif /* XML_LARGE_SIZE */\n\n#ifdef __cplusplus\n}\n#endif\n\n#endif /* not Expat_External_INCLUDED */\n"
  },
  {
    "path": "freebsd-headers/bsm/audit.h",
    "content": "/*-\n * Copyright (c) 2005-2009 Apple Inc.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n *\n * 1.  Redistributions of source code must retain the above copyright\n *     notice, this list of conditions and the following disclaimer.\n * 2.  Redistributions in binary form must reproduce the above copyright\n *     notice, this list of conditions and the following disclaimer in the\n *     documentation and/or other materials provided with the distribution.\n * 3.  Neither the name of Apple Inc. (\"Apple\") nor the names of\n *     its contributors may be used to endorse or promote products derived\n *     from this software without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS \"AS IS\" AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\n * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY\n * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\n * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\n * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF\n * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n *\n * P4: //depot/projects/trustedbsd/openbsm/sys/bsm/audit.h#10\n * $FreeBSD: release/9.0.0/sys/bsm/audit.h 195740 2009-07-17 14:02:20Z rwatson $\n */\n\n#ifndef\t_BSM_AUDIT_H\n#define\t_BSM_AUDIT_H\n\n#include <sys/param.h>\n#include <sys/types.h>\n\n#define\tAUDIT_RECORD_MAGIC\t0x828a0f1b\n#define\tMAX_AUDIT_RECORDS\t20\n#define\tMAXAUDITDATA\t\t(0x8000 - 1)\n#define\tMAX_AUDIT_RECORD_SIZE\tMAXAUDITDATA\n#define\tMIN_AUDIT_FILE_SIZE\t(512 * 1024)\n\n/*\n * Minimum noumber of free blocks on the filesystem containing the audit\n * log necessary to avoid a hard log rotation. DO NOT SET THIS VALUE TO 0\n * as the kernel does an unsigned compare, plus we want to leave a few blocks\n * free so userspace can terminate the log, etc.\n */\n#define\tAUDIT_HARD_LIMIT_FREE_BLOCKS\t4\n\n/*\n * Triggers for the audit daemon.\n */\n#define\tAUDIT_TRIGGER_MIN\t\t1\n#define\tAUDIT_TRIGGER_LOW_SPACE\t\t1\t/* Below low watermark. */\n#define\tAUDIT_TRIGGER_ROTATE_KERNEL\t2\t/* Kernel requests rotate. */\n#define\tAUDIT_TRIGGER_READ_FILE\t\t3\t/* Re-read config file. */\n#define\tAUDIT_TRIGGER_CLOSE_AND_DIE\t4\t/* Terminate audit. */\n#define\tAUDIT_TRIGGER_NO_SPACE\t\t5\t/* Below min free space. */\n#define\tAUDIT_TRIGGER_ROTATE_USER\t6\t/* User requests rotate. */\n#define\tAUDIT_TRIGGER_INITIALIZE\t7\t/* User initialize of auditd. */\n#define\tAUDIT_TRIGGER_EXPIRE_TRAILS\t8\t/* User expiration of trails. */\n#define\tAUDIT_TRIGGER_MAX\t\t8\n\n/*\n * The special device filename (FreeBSD).\n */\n#define\tAUDITDEV_FILENAME\t\"audit\"\n#define\tAUDIT_TRIGGER_FILE\t(\"/dev/\" AUDITDEV_FILENAME)\n\n/*\n * Pre-defined audit IDs\n */\n#define\tAU_DEFAUDITID\t(uid_t)(-1)\n#define\tAU_DEFAUDITSID\t 0\n#define\tAU_ASSIGN_ASID\t-1\n\n/*\n * IPC types.\n */\n#define\tAT_IPC_MSG\t((u_char)1)\t/* Message IPC id. */\n#define\tAT_IPC_SEM\t((u_char)2)\t/* Semaphore IPC id. */\n#define\tAT_IPC_SHM\t((u_char)3)\t/* Shared mem IPC id. */\n\n/*\n * Audit conditions.\n */\n#define\tAUC_UNSET\t\t0\n#define\tAUC_AUDITING\t\t1\n#define\tAUC_NOAUDIT\t\t2\n#define\tAUC_DISABLED\t\t-1\n\n/*\n * auditon(2) commands.\n */\n#define\tA_OLDGETPOLICY\t2\n#define\tA_OLDSETPOLICY\t3\n#define\tA_GETKMASK\t4\n#define\tA_SETKMASK\t5\n#define\tA_OLDGETQCTRL\t6\n#define\tA_OLDSETQCTRL\t7\n#define\tA_GETCWD\t8\n#define\tA_GETCAR\t9\n#define\tA_GETSTAT\t12\n#define\tA_SETSTAT\t13\n#define\tA_SETUMASK\t14\n#define\tA_SETSMASK\t15\n#define\tA_OLDGETCOND\t20\n#define\tA_OLDSETCOND\t21\n#define\tA_GETCLASS\t22\n#define\tA_SETCLASS\t23\n#define\tA_GETPINFO\t24\n#define\tA_SETPMASK\t25\n#define\tA_SETFSIZE\t26\n#define\tA_GETFSIZE\t27\n#define\tA_GETPINFO_ADDR\t28\n#define\tA_GETKAUDIT\t29\n#define\tA_SETKAUDIT\t30\n#define\tA_SENDTRIGGER\t31\n#define\tA_GETSINFO_ADDR\t32\n#define\tA_GETPOLICY\t33\n#define\tA_SETPOLICY\t34\n#define\tA_GETQCTRL\t35\n#define\tA_SETQCTRL\t36\n#define\tA_GETCOND\t37\n#define\tA_SETCOND\t38\n\n/*\n * Audit policy controls.\n */\n#define\tAUDIT_CNT\t0x0001\n#define\tAUDIT_AHLT\t0x0002\n#define\tAUDIT_ARGV\t0x0004\n#define\tAUDIT_ARGE\t0x0008\n#define\tAUDIT_SEQ\t0x0010\n#define\tAUDIT_WINDATA\t0x0020\n#define\tAUDIT_USER\t0x0040\n#define\tAUDIT_GROUP\t0x0080\n#define\tAUDIT_TRAIL\t0x0100\n#define\tAUDIT_PATH\t0x0200\n#define\tAUDIT_SCNT\t0x0400\n#define\tAUDIT_PUBLIC\t0x0800\n#define\tAUDIT_ZONENAME\t0x1000\n#define\tAUDIT_PERZONE\t0x2000\n\n/*\n * Default audit queue control parameters.\n */\n#define\tAQ_HIWATER\t100\n#define\tAQ_MAXHIGH\t10000\n#define\tAQ_LOWATER\t10\n#define\tAQ_BUFSZ\tMAXAUDITDATA\n#define\tAQ_MAXBUFSZ\t1048576\n\n/*\n * Default minimum percentage free space on file system.\n */\n#define\tAU_FS_MINFREE\t20\n\n/*\n * Type definitions used indicating the length of variable length addresses\n * in tokens containing addresses, such as header fields.\n */\n#define\tAU_IPv4\t\t4\n#define\tAU_IPv6\t\t16\n\n__BEGIN_DECLS\n\ntypedef\tuid_t\t\tau_id_t;\ntypedef\tpid_t\t\tau_asid_t;\ntypedef\tu_int16_t\tau_event_t;\ntypedef\tu_int16_t\tau_emod_t;\ntypedef\tu_int32_t\tau_class_t;\ntypedef\tu_int64_t\tau_asflgs_t __attribute__ ((aligned (8)));\n\nstruct au_tid {\n\tdev_t\t\tport;\n\tu_int32_t\tmachine;\n};\ntypedef\tstruct au_tid\tau_tid_t;\n\nstruct au_tid_addr {\n\tdev_t\t\tat_port;\n\tu_int32_t\tat_type;\n\tu_int32_t\tat_addr[4];\n};\ntypedef\tstruct au_tid_addr\tau_tid_addr_t;\n\nstruct au_mask {\n\tunsigned int    am_success;     /* Success bits. */\n\tunsigned int    am_failure;     /* Failure bits. */\n};\ntypedef\tstruct au_mask\tau_mask_t;\n\nstruct auditinfo {\n\tau_id_t\t\tai_auid;\t/* Audit user ID. */\n\tau_mask_t\tai_mask;\t/* Audit masks. */\n\tau_tid_t\tai_termid;\t/* Terminal ID. */\n\tau_asid_t\tai_asid;\t/* Audit session ID. */\n};\ntypedef\tstruct auditinfo\tauditinfo_t;\n\nstruct auditinfo_addr {\n\tau_id_t\t\tai_auid;\t/* Audit user ID. */\n\tau_mask_t\tai_mask;\t/* Audit masks. */\n\tau_tid_addr_t\tai_termid;\t/* Terminal ID. */\n\tau_asid_t\tai_asid;\t/* Audit session ID. */\n\tau_asflgs_t\tai_flags;\t/* Audit session flags. */\n};\ntypedef\tstruct auditinfo_addr\tauditinfo_addr_t;\n\nstruct auditpinfo {\n\tpid_t\t\tap_pid;\t\t/* ID of target process. */\n\tau_id_t\t\tap_auid;\t/* Audit user ID. */\n\tau_mask_t\tap_mask;\t/* Audit masks. */\n\tau_tid_t\tap_termid;\t/* Terminal ID. */\n\tau_asid_t\tap_asid;\t/* Audit session ID. */\n};\ntypedef\tstruct auditpinfo\tauditpinfo_t;\n\nstruct auditpinfo_addr {\n\tpid_t\t\tap_pid;\t\t/* ID of target process. */\n\tau_id_t\t\tap_auid;\t/* Audit user ID. */\n\tau_mask_t\tap_mask;\t/* Audit masks. */\n\tau_tid_addr_t\tap_termid;\t/* Terminal ID. */\n\tau_asid_t\tap_asid;\t/* Audit session ID. */\n\tau_asflgs_t\tap_flags;\t/* Audit session flags. */\n};\ntypedef\tstruct auditpinfo_addr\tauditpinfo_addr_t;\n\nstruct au_session {\n\tauditinfo_addr_t\t*as_aia_p;\t/* Ptr to full audit info. */\n\tau_mask_t\t\t as_mask;\t/* Process Audit Masks. */\n};\ntypedef struct au_session       au_session_t;\n\n/*\n * Contents of token_t are opaque outside of libbsm.\n */\ntypedef\tstruct au_token\ttoken_t;\n\n/*\n * Kernel audit queue control parameters:\n * \t\t\tDefault:\t\tMaximum:\n * \taq_hiwater:\tAQ_HIWATER (100)\tAQ_MAXHIGH (10000) \n * \taq_lowater:\tAQ_LOWATER (10)\t\t<aq_hiwater\n * \taq_bufsz:\tAQ_BUFSZ (32767)\tAQ_MAXBUFSZ (1048576)\n * \taq_delay:\t20\t\t\t20000 (not used) \n */\nstruct au_qctrl {\n\tint\taq_hiwater;\t/* Max # of audit recs in queue when */\n\t\t\t\t/* threads with new ARs get blocked. */ \n\n\tint\taq_lowater;\t/* # of audit recs in queue when */\n\t\t\t\t/* blocked threads get unblocked. */\n\n\tint\taq_bufsz;\t/* Max size of audit record for audit(2). */\n\tint\taq_delay;\t/* Queue delay (not used). */\n\tint\taq_minfree;\t/* Minimum filesystem percent free space. */\n};\ntypedef\tstruct au_qctrl\tau_qctrl_t;\n\n/*\n * Structure for the audit statistics.\n */\nstruct audit_stat {\n\tunsigned int\tas_version;\n\tunsigned int\tas_numevent;\n\tint\t\tas_generated;\n\tint\t\tas_nonattrib;\n\tint\t\tas_kernel;\n\tint\t\tas_audit;\n\tint\t\tas_auditctl;\n\tint\t\tas_enqueue;\n\tint\t\tas_written;\n\tint\t\tas_wblocked;\n\tint\t\tas_rblocked;\n\tint\t\tas_dropped;\n\tint\t\tas_totalsize;\n\tunsigned int\tas_memused;\n};\ntypedef\tstruct audit_stat\tau_stat_t;\n\n/*\n * Structure for the audit file statistics.\n */\nstruct audit_fstat {\n\tu_int64_t\taf_filesz;\n\tu_int64_t\taf_currsz;\n};\ntypedef\tstruct audit_fstat\tau_fstat_t;\n\n/*\n * Audit to event class mapping.\n */\nstruct au_evclass_map {\n\tau_event_t\tec_number;\n\tau_class_t\tec_class;\n};\ntypedef\tstruct au_evclass_map\tau_evclass_map_t;\n\n/*\n * Audit system calls.\n */\n#if !defined(_KERNEL) && !defined(KERNEL)\nint\taudit(const void *, int);\nint\tauditon(int, void *, int);\nint\tauditctl(const char *);\nint\tgetauid(au_id_t *);\nint\tsetauid(const au_id_t *);\nint\tgetaudit(struct auditinfo *);\nint\tsetaudit(const struct auditinfo *);\nint\tgetaudit_addr(struct auditinfo_addr *, int);\nint\tsetaudit_addr(const struct auditinfo_addr *, int);\n\n#ifdef __APPLE_API_PRIVATE\n#include <mach/port.h>\nmach_port_name_t audit_session_self(void);\nau_asid_t\t audit_session_join(mach_port_name_t port);\n#endif /* __APPLE_API_PRIVATE */\n\n#endif /* defined(_KERNEL) || defined(KERNEL) */\n\n__END_DECLS\n\n#endif /* !_BSM_AUDIT_H */\n"
  },
  {
    "path": "freebsd-headers/bsm/audit_domain.h",
    "content": "/*-\n * Copyright (c) 2008 Apple Inc.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1.  Redistributions of source code must retain the above copyright\n *     notice, this list of conditions and the following disclaimer.\n * 2.  Redistributions in binary form must reproduce the above copyright\n *     notice, this list of conditions and the following disclaimer in the\n *     documentation and/or other materials provided with the distribution.\n * 3.  Neither the name of Apple Inc. (\"Apple\") nor the names of\n *     its contributors may be used to endorse or promote products derived\n *     from this software without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS \"AS IS\" AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR\n * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,\n * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING\n * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE. \n *\n * P4: //depot/projects/trustedbsd/openbsm/sys/bsm/audit_domain.h#2\n * $FreeBSD: release/9.0.0/sys/bsm/audit_domain.h 191273 2009-04-19 16:17:13Z rwatson $\n */\n\n#ifndef _BSM_AUDIT_DOMAIN_H_\n#define\t_BSM_AUDIT_DOMAIN_H_\n\n/*\n * BSM protocol domain constants - protocol domains defined in Solaris.\n */\n#define\tBSM_PF_UNSPEC\t\t0\n#define\tBSM_PF_LOCAL\t\t1\n#define\tBSM_PF_INET\t\t2\n#define\tBSM_PF_IMPLINK\t\t3\n#define\tBSM_PF_PUP\t\t4\n#define\tBSM_PF_CHAOS\t\t5\n#define\tBSM_PF_NS\t\t6\n#define\tBSM_PF_NBS\t\t7\t/* Solaris-specific. */\n#define\tBSM_PF_ECMA\t\t8\n#define\tBSM_PF_DATAKIT\t\t9\n#define\tBSM_PF_CCITT\t\t10\n#define\tBSM_PF_SNA\t\t11\n#define\tBSM_PF_DECnet\t\t12\n#define\tBSM_PF_DLI\t\t13\n#define\tBSM_PF_LAT\t\t14\n#define\tBSM_PF_HYLINK\t\t15\n#define\tBSM_PF_APPLETALK\t16\n#define\tBSM_PF_NIT\t\t17\t/* Solaris-specific. */\n#define\tBSM_PF_802\t\t18\t/* Solaris-specific. */\n#define\tBSM_PF_OSI\t\t19\n#define\tBSM_PF_X25\t\t20\t/* Solaris/Linux-specific. */\n#define\tBSM_PF_OSINET\t\t21\t/* Solaris-specific. */\n#define\tBSM_PF_GOSIP\t\t22\t/* Solaris-specific. */\n#define\tBSM_PF_IPX\t\t23\n#define\tBSM_PF_ROUTE\t\t24\n#define\tBSM_PF_LINK\t\t25\n#define\tBSM_PF_INET6\t\t26\n#define\tBSM_PF_KEY\t\t27\n#define\tBSM_PF_NCA\t\t28\t/* Solaris-specific. */\n#define\tBSM_PF_POLICY\t\t29\t/* Solaris-specific. */\n#define\tBSM_PF_INET_OFFLOAD\t30\t/* Solaris-specific. */\n\n/*\n * BSM protocol domain constants - protocol domains not defined in Solaris.\n */\n#define\tBSM_PF_NETBIOS\t\t500\t/* FreeBSD/Darwin-specific. */\n#define\tBSM_PF_ISO\t\t501\t/* FreeBSD/Darwin-specific. */\n#define\tBSM_PF_XTP\t\t502\t/* FreeBSD/Darwin-specific. */\n#define\tBSM_PF_COIP\t\t503\t/* FreeBSD/Darwin-specific. */\n#define\tBSM_PF_CNT\t\t504\t/* FreeBSD/Darwin-specific. */\n#define\tBSM_PF_RTIP\t\t505\t/* FreeBSD/Darwin-specific. */\n#define\tBSM_PF_SIP\t\t506\t/* FreeBSD/Darwin-specific. */\n#define\tBSM_PF_PIP\t\t507\t/* FreeBSD/Darwin-specific. */\n#define\tBSM_PF_ISDN\t\t508\t/* FreeBSD/Darwin-specific. */\n#define\tBSM_PF_E164\t\t509\t/* FreeBSD/Darwin-specific. */\n#define\tBSM_PF_NATM\t\t510\t/* FreeBSD/Darwin-specific. */\n#define\tBSM_PF_ATM\t\t511\t/* FreeBSD/Darwin-specific. */\n#define\tBSM_PF_NETGRAPH\t\t512\t/* FreeBSD/Darwin-specific. */\n#define\tBSM_PF_SLOW\t\t513\t/* FreeBSD-specific. */\n#define\tBSM_PF_SCLUSTER\t\t514\t/* FreeBSD-specific. */\n#define\tBSM_PF_ARP\t\t515\t/* FreeBSD-specific. */\n#define\tBSM_PF_BLUETOOTH\t516\t/* FreeBSD-specific. */\n\t\t\t\t\t/* 517: unallocated. */\n#define\tBSM_PF_AX25\t\t518\t/* Linux-specific. */\n#define\tBSM_PF_ROSE\t\t519\t/* Linux-specific. */\n#define\tBSM_PF_NETBEUI\t\t520\t/* Linux-specific. */\n#define\tBSM_PF_SECURITY\t\t521\t/* Linux-specific. */\n#define\tBSM_PF_PACKET\t\t522\t/* Linux-specific. */\n#define\tBSM_PF_ASH\t\t523\t/* Linux-specific. */\n#define\tBSM_PF_ECONET\t\t524\t/* Linux-specific. */\n#define\tBSM_PF_ATMSVC\t\t525\t/* Linux-specific. */\n#define\tBSM_PF_IRDA\t\t526\t/* Linux-specific. */\n#define\tBSM_PF_PPPOX\t\t527\t/* Linux-specific. */\n#define\tBSM_PF_WANPIPE\t\t528\t/* Linux-specific. */\n#define\tBSM_PF_LLC\t\t529\t/* Linux-specific. */\n#define\tBSM_PF_CAN\t\t530\t/* Linux-specific. */\n#define\tBSM_PF_TIPC\t\t531\t/* Linux-specific. */\n#define\tBSM_PF_IUCV\t\t532\t/* Linux-specific. */\n#define\tBSM_PF_RXRPC\t\t533\t/* Linux-specific. */\n#define\tBSM_PF_PHONET\t\t534\t/* Linux-specific. */\n\n/*\n * Used when there is no mapping from a local to BSM protocol domain.\n */\n#define\tBSM_PF_UNKNOWN\t\t700\t/* OpenBSM-specific. */\n\n#endif /* !_BSM_AUDIT_DOMAIN_H_ */\n"
  },
  {
    "path": "freebsd-headers/bsm/audit_errno.h",
    "content": "/*-\n * Copyright (c) 2008 Apple Inc.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1.  Redistributions of source code must retain the above copyright\n *     notice, this list of conditions and the following disclaimer.\n * 2.  Redistributions in binary form must reproduce the above copyright\n *     notice, this list of conditions and the following disclaimer in the\n *     documentation and/or other materials provided with the distribution.\n * 3.  Neither the name of Apple Inc. (\"Apple\") nor the names of\n *     its contributors may be used to endorse or promote products derived\n *     from this software without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS \"AS IS\" AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR\n * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,\n * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING\n * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE. \n *\n * P4: //depot/projects/trustedbsd/openbsm/sys/bsm/audit_errno.h#5\n * $FreeBSD: release/9.0.0/sys/bsm/audit_errno.h 219128 2011-03-01 13:14:28Z rwatson $\n */\n\n#ifndef _BSM_AUDIT_ERRNO_H_\n#define\t_BSM_AUDIT_ERRNO_H_\n\n/*\n * For the purposes of portable encoding, we convert between local error\n * numbers and Solaris error numbers (as well as some extensions for error\n * numbers that don't exist in Solaris).  Although the first 35 or so\n * constants are the same across all OS's, we don't handle that in any\n * special way.\n *\n * When adding constants here, also add them to bsm_errno.c.\n */\n#define\tBSM_ERRNO_ESUCCESS\t\t0\n#define\tBSM_ERRNO_EPERM\t\t\t1\n#define\tBSM_ERRNO_ENOENT\t\t2\n#define\tBSM_ERRNO_ESRCH\t\t\t3\n#define\tBSM_ERRNO_EINTR\t\t\t4\n#define\tBSM_ERRNO_EIO\t\t\t5\n#define\tBSM_ERRNO_ENXIO\t\t\t6\n#define\tBSM_ERRNO_E2BIG\t\t\t7\n#define\tBSM_ERRNO_ENOEXEC\t\t8\n#define\tBSM_ERRNO_EBADF\t\t\t9\n#define\tBSM_ERRNO_ECHILD\t\t10\n#define\tBSM_ERRNO_EAGAIN\t\t11\n#define\tBSM_ERRNO_ENOMEM\t\t12\n#define\tBSM_ERRNO_EACCES\t\t13\n#define\tBSM_ERRNO_EFAULT\t\t14\n#define\tBSM_ERRNO_ENOTBLK\t\t15\n#define\tBSM_ERRNO_EBUSY\t\t\t16\n#define\tBSM_ERRNO_EEXIST\t\t17\n#define\tBSM_ERRNO_EXDEV\t\t\t18\n#define\tBSM_ERRNO_ENODEV\t\t19\n#define\tBSM_ERRNO_ENOTDIR\t\t20\n#define\tBSM_ERRNO_EISDIR\t\t21\n#define\tBSM_ERRNO_EINVAL\t\t22\n#define\tBSM_ERRNO_ENFILE\t\t23\n#define\tBSM_ERRNO_EMFILE\t\t24\n#define\tBSM_ERRNO_ENOTTY\t\t25\n#define\tBSM_ERRNO_ETXTBSY\t\t26\n#define\tBSM_ERRNO_EFBIG\t\t\t27\n#define\tBSM_ERRNO_ENOSPC\t\t28\n#define\tBSM_ERRNO_ESPIPE\t\t29\n#define\tBSM_ERRNO_EROFS\t\t\t30\n#define\tBSM_ERRNO_EMLINK\t\t31\n#define\tBSM_ERRNO_EPIPE\t\t\t32\n#define\tBSM_ERRNO_EDOM\t\t\t33\n#define\tBSM_ERRNO_ERANGE\t\t34\n#define\tBSM_ERRNO_ENOMSG\t\t35\n#define\tBSM_ERRNO_EIDRM\t\t\t36\n#define\tBSM_ERRNO_ECHRNG\t\t37\t/* Solaris/Linux-specific. */\n#define\tBSM_ERRNO_EL2NSYNC\t\t38\t/* Solaris/Linux-specific. */\n#define\tBSM_ERRNO_EL3HLT\t\t39\t/* Solaris/Linux-specific. */\n#define\tBSM_ERRNO_EL3RST\t\t40\t/* Solaris/Linux-specific. */\n#define\tBSM_ERRNO_ELNRNG\t\t41\t/* Solaris/Linux-specific. */\n#define\tBSM_ERRNO_EUNATCH\t\t42\t/* Solaris/Linux-specific. */\n#define\tBSM_ERRNO_ENOCSI\t\t43\t/* Solaris/Linux-specific. */\n#define\tBSM_ERRNO_EL2HLT\t\t44\t/* Solaris/Linux-specific. */\n#define\tBSM_ERRNO_EDEADLK\t\t45\n#define\tBSM_ERRNO_ENOLCK\t\t46\n#define\tBSM_ERRNO_ECANCELED\t\t47\n#define\tBSM_ERRNO_ENOTSUP\t\t48\n#define\tBSM_ERRNO_EDQUOT\t\t49\n#define\tBSM_ERRNO_EBADE\t\t\t50\t/* Solaris/Linux-specific. */\n#define\tBSM_ERRNO_EBADR\t\t\t51\t/* Solaris/Linux-specific. */\n#define\tBSM_ERRNO_EXFULL\t\t52\t/* Solaris/Linux-specific. */\n#define\tBSM_ERRNO_ENOANO\t\t53\t/* Solaris/Linux-specific. */\n#define\tBSM_ERRNO_EBADRQC\t\t54\t/* Solaris/Linux-specific. */\n#define\tBSM_ERRNO_EBADSLT\t\t55\t/* Solaris/Linux-specific. */\n#define\tBSM_ERRNO_EDEADLOCK\t\t56\t/* Solaris-specific. */\n#define\tBSM_ERRNO_EBFONT\t\t57\t/* Solaris/Linux-specific. */\n#define\tBSM_ERRNO_EOWNERDEAD\t\t58\t/* Solaris/Linux-specific. */\n#define\tBSM_ERRNO_ENOTRECOVERABLE\t59\t/* Solaris/Linux-specific. */\n#define\tBSM_ERRNO_ENOSTR\t\t60\t/* Solaris/Darwin/Linux-specific. */\n#define\tBSM_ERRNO_ENODATA\t\t61\t/* Solaris/Darwin/Linux-specific. */\n#define\tBSM_ERRNO_ETIME\t\t\t62\t/* Solaris/Darwin/Linux-specific. */\n#define\tBSM_ERRNO_ENOSR\t\t\t63\t/* Solaris/Darwin/Linux-specific. */\n#define\tBSM_ERRNO_ENONET\t\t64\t/* Solaris/Linux-specific. */\n#define\tBSM_ERRNO_ENOPKG\t\t65\t/* Solaris/Linux-specific. */\n#define\tBSM_ERRNO_EREMOTE\t\t66\n#define\tBSM_ERRNO_ENOLINK\t\t67\n#define\tBSM_ERRNO_EADV\t\t\t68\t/* Solaris/Linux-specific. */\n#define\tBSM_ERRNO_ESRMNT\t\t69\t/* Solaris/Linux-specific. */\n#define\tBSM_ERRNO_ECOMM\t\t\t70\t/* Solaris/Linux-specific. */\n#define\tBSM_ERRNO_EPROTO\t\t71\n#define\tBSM_ERRNO_ELOCKUNMAPPED\t\t72\t/* Solaris-specific. */\n#define\tBSM_ERRNO_ENOTACTIVE\t\t73\t/* Solaris-specific. */\n#define\tBSM_ERRNO_EMULTIHOP\t\t74\n#define\tBSM_ERRNO_EBADMSG\t\t77\n#define\tBSM_ERRNO_ENAMETOOLONG\t\t78\n#define\tBSM_ERRNO_EOVERFLOW\t\t79\n#define\tBSM_ERRNO_ENOTUNIQ\t\t80\t/* Solaris/Linux-specific. */\n#define\tBSM_ERRNO_EBADFD\t\t81\t/* Solaris/Linux-specific. */\n#define\tBSM_ERRNO_EREMCHG\t\t82\t/* Solaris/Linux-specific. */\n#define\tBSM_ERRNO_ELIBACC\t\t83\t/* Solaris/Linux-specific. */\n#define\tBSM_ERRNO_ELIBBAD\t\t84\t/* Solaris/Linux-specific. */\n#define\tBSM_ERRNO_ELIBSCN\t\t85\t/* Solaris/Linux-specific. */\n#define\tBSM_ERRNO_ELIBMAX\t\t86\t/* Solaris/Linux-specific. */\n#define\tBSM_ERRNO_ELIBEXEC\t\t87\t/* Solaris/Linux-specific. */\n#define\tBSM_ERRNO_EILSEQ\t\t88\n#define\tBSM_ERRNO_ENOSYS\t\t89\n#define\tBSM_ERRNO_ELOOP\t\t\t90\n#define\tBSM_ERRNO_ERESTART\t\t91\n#define\tBSM_ERRNO_ESTRPIPE\t\t92\t/* Solaris/Linux-specific. */\n#define\tBSM_ERRNO_ENOTEMPTY\t\t93\n#define\tBSM_ERRNO_EUSERS\t\t94\n#define\tBSM_ERRNO_ENOTSOCK\t\t95\n#define\tBSM_ERRNO_EDESTADDRREQ\t\t96\n#define\tBSM_ERRNO_EMSGSIZE\t\t97\n#define\tBSM_ERRNO_EPROTOTYPE\t\t98\n#define\tBSM_ERRNO_ENOPROTOOPT\t\t99\n#define\tBSM_ERRNO_EPROTONOSUPPORT\t120\n#define\tBSM_ERRNO_ESOCKTNOSUPPORT\t121\n#define\tBSM_ERRNO_EOPNOTSUPP\t\t122\n#define\tBSM_ERRNO_EPFNOSUPPORT\t\t123\n#define\tBSM_ERRNO_EAFNOSUPPORT\t\t124\n#define\tBSM_ERRNO_EADDRINUSE\t\t125\n#define\tBSM_ERRNO_EADDRNOTAVAIL\t\t126\n#define\tBSM_ERRNO_ENETDOWN\t\t127\n#define\tBSM_ERRNO_ENETUNREACH\t\t128\n#define\tBSM_ERRNO_ENETRESET\t\t129\n#define\tBSM_ERRNO_ECONNABORTED\t\t130\n#define\tBSM_ERRNO_ECONNRESET\t\t131\n#define\tBSM_ERRNO_ENOBUFS\t\t132\n#define\tBSM_ERRNO_EISCONN\t\t133\n#define\tBSM_ERRNO_ENOTCONN\t\t134\n#define\tBSM_ERRNO_ESHUTDOWN\t\t143\n#define\tBSM_ERRNO_ETOOMANYREFS\t\t144\n#define\tBSM_ERRNO_ETIMEDOUT\t\t145\n#define\tBSM_ERRNO_ECONNREFUSED\t\t146\n#define\tBSM_ERRNO_EHOSTDOWN\t\t147\n#define\tBSM_ERRNO_EHOSTUNREACH\t\t148\n#define\tBSM_ERRNO_EALREADY\t\t149\n#define\tBSM_ERRNO_EINPROGRESS\t\t150\n#define\tBSM_ERRNO_ESTALE\t\t151\n\n/*\n * OpenBSM constants for error numbers not defined in Solaris.  In the event\n * that these errors are added to Solaris, we will deprecate the OpenBSM\n * numbers in the same way we do for audit event constants.\n *\n * ELAST doesn't get a constant in the BSM space.\n */\n#define\tBSM_ERRNO_EPROCLIM\t\t190\t/* FreeBSD/Darwin-specific. */\n#define\tBSM_ERRNO_EBADRPC\t\t191\t/* FreeBSD/Darwin-specific. */\n#define\tBSM_ERRNO_ERPCMISMATCH\t\t192\t/* FreeBSD/Darwin-specific. */\n#define\tBSM_ERRNO_EPROGUNAVAIL\t\t193\t/* FreeBSD/Darwin-specific. */\n#define\tBSM_ERRNO_EPROGMISMATCH\t\t194\t/* FreeBSD/Darwin-specific. */\n#define\tBSM_ERRNO_EPROCUNAVAIL\t\t195\t/* FreeBSD/Darwin-specific. */\n#define\tBSM_ERRNO_EFTYPE\t\t196\t/* FreeBSD/Darwin-specific. */\n#define\tBSM_ERRNO_EAUTH\t\t\t197\t/* FreeBSD/Darwin-specific. */\n#define\tBSM_ERRNO_ENEEDAUTH\t\t198\t/* FreeBSD/Darwin-specific. */\n#define\tBSM_ERRNO_ENOATTR\t\t199\t/* FreeBSD/Darwin-specific. */\n#define\tBSM_ERRNO_EDOOFUS\t\t200\t/* FreeBSD-specific. */\n#define\tBSM_ERRNO_EJUSTRETURN\t\t201\t/* FreeBSD-specific. */\n#define\tBSM_ERRNO_ENOIOCTL\t\t202\t/* FreeBSD-specific. */\n#define\tBSM_ERRNO_EDIRIOCTL\t\t203\t/* FreeBSD-specific. */\n#define\tBSM_ERRNO_EPWROFF\t\t204\t/* Darwin-specific. */\n#define\tBSM_ERRNO_EDEVERR\t\t205\t/* Darwin-specific. */\n#define\tBSM_ERRNO_EBADEXEC\t\t206\t/* Darwin-specific. */\n#define\tBSM_ERRNO_EBADARCH\t\t207\t/* Darwin-specific. */\n#define\tBSM_ERRNO_ESHLIBVERS\t\t208\t/* Darwin-specific. */\n#define\tBSM_ERRNO_EBADMACHO\t\t209\t/* Darwin-specific. */\n#define\tBSM_ERRNO_EPOLICY\t\t210\t/* Darwin-specific. */\n#define\tBSM_ERRNO_EDOTDOT\t\t211\t/* Linux-specific. */\n#define\tBSM_ERRNO_EUCLEAN\t\t212\t/* Linux-specific. */\n#define\tBSM_ERRNO_ENOTNAM\t\t213\t/* Linux(Xenix?)-specific. */\n#define\tBSM_ERRNO_ENAVAIL\t\t214\t/* Linux(Xenix?)-specific. */\n#define\tBSM_ERRNO_EISNAM\t\t215\t/* Linux(Xenix?)-specific. */\n#define\tBSM_ERRNO_EREMOTEIO\t\t216\t/* Linux-specific. */\n#define\tBSM_ERRNO_ENOMEDIUM\t\t217\t/* Linux-specific. */\n#define\tBSM_ERRNO_EMEDIUMTYPE\t\t218\t/* Linux-specific. */\n#define\tBSM_ERRNO_ENOKEY\t\t219\t/* Linux-specific. */\n#define\tBSM_ERRNO_EKEYEXPIRED\t\t220\t/* Linux-specific. */\n#define\tBSM_ERRNO_EKEYREVOKED\t\t221\t/* Linux-specific. */\n#define\tBSM_ERRNO_EKEYREJECTED\t\t222\t/* Linux-specific. */\n#define\tBSM_ERRNO_ENOTCAPABLE\t\t223\t/* FreeBSD-specific. */\n#define\tBSM_ERRNO_ECAPMODE\t\t224\t/* FreeBSD-specific. */\n\n/*\n * In the event that OpenBSM doesn't have a file representation of a local\n * error number, use this.\n */\n#define\tBSM_ERRNO_UNKNOWN\t\t250\t/* OpenBSM-specific. */\n\n#endif /* !_BSM_AUDIT_ERRNO_H_ */\n"
  },
  {
    "path": "freebsd-headers/bsm/audit_fcntl.h",
    "content": "/*-\n * Copyright (c) 2009 Apple Inc.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1.  Redistributions of source code must retain the above copyright\n *     notice, this list of conditions and the following disclaimer.\n * 2.  Redistributions in binary form must reproduce the above copyright\n *     notice, this list of conditions and the following disclaimer in the\n *     documentation and/or other materials provided with the distribution.\n * 3.  Neither the name of Apple Inc. (\"Apple\") nor the names of\n *     its contributors may be used to endorse or promote products derived\n *     from this software without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS \"AS IS\" AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR\n * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,\n * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING\n * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE. \n *\n * P4: //depot/projects/trustedbsd/openbsm/sys/bsm/audit_fcntl.h#2\n * $FreeBSD: release/9.0.0/sys/bsm/audit_fcntl.h 191147 2009-04-16 20:17:32Z rwatson $\n */\n\n#ifndef\t_BSM_AUDIT_FCNTL_H_\n#define\t_BSM_AUDIT_FCNTL_H_\n\n/*\n * Shared and Solaris-specific: (0-99).\n */\n#define\tBSM_F_DUPFD\t\t0\n#define\tBSM_F_GETFD\t\t1\n#define\tBSM_F_SETFD\t\t2\n#define\tBSM_F_GETFL\t\t3\n#define\tBSM_F_SETFL\t\t4\n#define\tBSM_F_O_GETLK\t\t5\t/* Solaris-specific. */\n#define\tBSM_F_SETLK\t\t6\n#define\tBSM_F_SETLKW\t\t7\n#define\tBSM_F_CHKFL\t\t8\t/* Solaris-specific. */\n#define\tBSM_F_DUP2FD\t\t9\t/* FreeBSD/Solaris-specific. */\n#define\tBSM_F_ALLOCSP\t\t10\t/* Solaris-specific. */\n#define\tBSM_F_FREESP\t\t11\t/* Solaris-specific. */\n\n#define\tBSM_F_ISSTREAM\t\t13\t/* Solaris-specific. */\n#define\tBSM_F_GETLK\t\t14\t\n#define\tBSM_F_PRIV\t\t15\t/* Solaris-specific. */\n#define\tBSM_F_NPRIV\t\t16\t/* Solaris-specific. */\n#define\tBSM_F_QUOTACTL\t\t17\t/* Solaris-specific. */\n#define\tBSM_F_BLOCKS\t\t18\t/* Solaris-specific. */\n#define\tBSM_F_BLKSIZE\t\t19\t/* Solaris-specific. */\n\n#define\tBSM_F_GETOWN\t\t23\n#define\tBSM_F_SETOWN\t\t24\n#define\tBSM_F_REVOKE\t\t25\t/* Solaris-specific. */\n#define\tBSM_F_HASREMOTELOCKS\t26\t/* Solaris-specific. */\n#define\tBSM_F_FREESP64\t\t27\t/* Solaris-specific. */\n#define\tBSM_F_ALLOCSP64\t\t28\t/* Solaris-specific. */\n\n#define\tBSM_F_GETLK64\t\t33\t/* Solaris-specific. */\n#define\tBSM_F_SETLK64\t\t34\t/* Solaris-specific. */\n#define\tBSM_F_SETLKW64\t\t35\t/* Solaris-specific. */\n\n#define\tBSM_F_SHARE\t\t40\t/* Solaris-specific. */\n#define\tBSM_F_UNSHARE\t\t41 \t/* Solaris-specific. */\n#define\tBSM_F_SETLK_NBMAND\t42\t/* Solaris-specific. */\n#define\tBSM_F_SHARE_NBMAND\t43\t/* Solaris-specific. */\n#define\tBSM_F_SETLK64_NBMAND\t44 \t/* Solaris-specific. */\n#define\tBSM_F_GETXFL\t\t45\t/* Solaris-specific. */\n#define\tBSM_F_BADFD\t\t46\t/* Solaris-specific. */\n\n/*\n * FreeBSD-specific (100-199).\n */\n#define\tBSM_F_OGETLK\t\t107\t/* FreeBSD-specific. */\n#define\tBSM_F_OSETLK\t\t108\t/* FreeBSD-specific. */\n#define\tBSM_F_OSETLKW\t\t109\t/* FreeBSD-specific. */\n\n#define\tBSM_F_SETLK_REMOTE\t114\t/* FreeBSD-specific. */\n\n/*\n * Linux-specific (200-299).\n */\n#define\tBSM_F_SETSIG\t\t210\t/* Linux-specific. */\n#define\tBSM_F_GETSIG\t\t211\t/* Linux-specific. */\n\n/*\n * Darwin-specific (300-399).\n */\n#define\tBSM_F_CHKCLEAN \t\t341\t/* Darwin-specific. */\n#define\tBSM_F_PREALLOCATE\t342\t/* Darwin-specific. */\n#define\tBSM_F_SETSIZE\t\t343\t/* Darwin-specific. */\n#define\tBSM_F_RDADVISE\t\t344\t/* Darwin-specific. */\n#define\tBSM_F_RDAHEAD\t\t345\t/* Darwin-specific. */\n#define\tBSM_F_READBOOTSTRAP\t346\t/* Darwin-specific. */\n#define\tBSM_F_WRITEBOOTSTRAP\t347\t/* Darwin-specific. */\n#define\tBSM_F_NOCACHE\t\t348\t/* Darwin-specific. */\n#define\tBSM_F_LOG2PHYS\t\t349\t/* Darwin-specific. */\n#define\tBSM_F_GETPATH\t\t350\t/* Darwin-specific. */\n#define\tBSM_F_FULLFSYNC\t\t351\t/* Darwin-specific. */\n#define\tBSM_F_PATHPKG_CHECK\t352\t/* Darwin-specific. */\n#define\tBSM_F_FREEZE_FS\t\t353\t/* Darwin-specific. */\n#define\tBSM_F_THAW_FS\t\t354\t/* Darwin-specific. */\n#define\tBSM_F_GLOBAL_NOCACHE\t355\t/* Darwin-specific. */\n#define\tBSM_F_OPENFROM\t\t356\t/* Darwin-specific. */\n#define\tBSM_F_UNLINKFROM\t357\t/* Darwin-specific. */\n#define\tBSM_F_CHECK_OPENEVT\t358\t/* Darwin-specific. */\n#define\tBSM_F_ADDSIGS\t\t359\t/* Darwin-specific. */\n#define\tBSM_F_MARKDEPENDENCY\t360\t/* Darwin-specific. */\n\n/*\n * Darwin file system specific (400-499).\n */\n#define\tBSM_F_FS_SPECIFIC_0\t400\t/* Darwin-fs-specific. */\n#define\tBSM_F_FS_SPECIFIC_1\t401\t/* Darwin-fs-specific. */\n#define\tBSM_F_FS_SPECIFIC_2\t402\t/* Darwin-fs-specific. */\n#define\tBSM_F_FS_SPECIFIC_3\t403\t/* Darwin-fs-specific. */\n#define\tBSM_F_FS_SPECIFIC_4\t404\t/* Darwin-fs-specific. */\n#define\tBSM_F_FS_SPECIFIC_5\t405\t/* Darwin-fs-specific. */\n#define\tBSM_F_FS_SPECIFIC_6\t406\t/* Darwin-fs-specific. */\n#define\tBSM_F_FS_SPECIFIC_7\t407\t/* Darwin-fs-specific. */\n#define\tBSM_F_FS_SPECIFIC_8\t408\t/* Darwin-fs-specific. */\n#define\tBSM_F_FS_SPECIFIC_9\t409\t/* Darwin-fs-specific. */\n#define\tBSM_F_FS_SPECIFIC_10\t410\t/* Darwin-fs-specific. */\n#define\tBSM_F_FS_SPECIFIC_11\t411\t/* Darwin-fs-specific. */\n#define\tBSM_F_FS_SPECIFIC_12\t412\t/* Darwin-fs-specific. */\n#define\tBSM_F_FS_SPECIFIC_13\t413\t/* Darwin-fs-specific. */\n#define\tBSM_F_FS_SPECIFIC_14\t414\t/* Darwin-fs-specific. */\n#define\tBSM_F_FS_SPECIFIC_15\t415\t/* Darwin-fs-specific. */\n\n\n#define\tBSM_F_UNKNOWN\t\t0xFFFF\t\n\n#endif /* !_BSM_AUDIT_FCNTL_H_ */\n"
  },
  {
    "path": "freebsd-headers/bsm/audit_internal.h",
    "content": "/*-\n * Copyright (c) 2005-2008 Apple Inc.\n * Copyright (c) 2005 SPARTA, Inc.\n * All rights reserved.\n *\n * This code was developed in part by Robert N. M. Watson, Senior Principal\n * Scientist, SPARTA, Inc.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n *\n * 1.  Redistributions of source code must retain the above copyright\n *     notice, this list of conditions and the following disclaimer.\n * 2.  Redistributions in binary form must reproduce the above copyright\n *     notice, this list of conditions and the following disclaimer in the\n *     documentation and/or other materials provided with the distribution.\n * 3.  Neither the name of Apple Computer, Inc. (\"Apple\") nor the names of\n *     its contributors may be used to endorse or promote products derived\n *     from this software without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS \"AS IS\" AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\n * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY\n * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\n * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\n * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF\n * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n *\n * P4: //depot/projects/trustedbsd/openbsm/sys/bsm/audit_internal.h#5\n * $FreeBSD: release/9.0.0/sys/bsm/audit_internal.h 187214 2009-01-14 10:44:16Z rwatson $\n */\n\n#ifndef _AUDIT_INTERNAL_H\n#define\t_AUDIT_INTERNAL_H\n\n#if defined(__linux__) && !defined(__unused)\n#define\t__unused\n#endif\n\n/*\n * audit_internal.h contains private interfaces that are shared by user space\n * and the kernel for the purposes of assembling audit records.  Applications\n * should not include this file or use the APIs found within, or it may be\n * broken with future releases of OpenBSM, which may delete, modify, or\n * otherwise break these interfaces or the assumptions they rely on.\n */\nstruct au_token {\n\tu_char\t\t\t*t_data;\n\tsize_t\t\t\t len;\n\tTAILQ_ENTRY(au_token)\t tokens;\n};\n\nstruct au_record {\n\tchar\t\t\t used;\t\t/* Record currently in use? */\n\tint\t\t\t desc;\t\t/* Descriptor for record. */\n\tTAILQ_HEAD(, au_token)\t token_q;\t/* Queue of BSM tokens. */\n\tu_char\t\t\t*data;\n\tsize_t\t\t\t len;\n\tLIST_ENTRY(au_record)\t au_rec_q;\n};\ntypedef\tstruct au_record\tau_record_t;\n\n\n/*\n * We could determined the header and trailer sizes by defining appropriate\n * structures.  We hold off that approach until we have a consistent way of\n * using structures for all tokens.  This is not straightforward since these\n * token structures may contain pointers of whose contents we do not know the\n * size (e.g text tokens).\n */\n#define\tAUDIT_HEADER_EX_SIZE(a)\t((a)->ai_termid.at_type+18+sizeof(u_int32_t))\n#define\tAUDIT_HEADER_SIZE\t18\n#define\tMAX_AUDIT_HEADER_SIZE\t(5*sizeof(u_int32_t)+18)\n#define\tAUDIT_TRAILER_SIZE\t7\n\n/*\n * BSM token streams store fields in big endian byte order, so as to be\n * portable; when encoding and decoding, we must convert byte orders for\n * typed values.\n */\n#define\tADD_U_CHAR(loc, val)\t\t\t\t\t\t\\\n\tdo {\t\t\t\t\t\t\t\t\\\n\t\t*(loc) = (val);\t\t\t\t\t\t\\\n\t\t(loc) += sizeof(u_char);\t\t\t\t\\\n\t} while(0)\n\n\n#define\tADD_U_INT16(loc, val)\t\t\t\t\t\t\\\n\tdo {\t\t\t\t\t\t\t\t\\\n\t\tbe16enc((loc), (val));\t\t\t\t\t\\\n\t\t(loc) += sizeof(u_int16_t);\t\t\t\t\\\n\t} while(0)\n\n#define\tADD_U_INT32(loc, val)\t\t\t\t\t\t\\\n\tdo {\t\t\t\t\t\t\t\t\\\n\t\tbe32enc((loc), (val));\t\t\t\t\t\\\n\t\t(loc) += sizeof(u_int32_t);\t\t\t\t\\\n\t} while(0)\n\n#define\tADD_U_INT64(loc, val)\t\t\t\t\t\t\\\n\tdo {\t\t\t\t\t\t\t\t\\\n\t\tbe64enc((loc), (val));\t\t\t\t\t\\\n\t\t(loc) += sizeof(u_int64_t); \t\t\t\t\\\n\t} while(0)\n\n#define\tADD_MEM(loc, data, size)\t\t\t\t\t\\\n\tdo {\t\t\t\t\t\t\t\t\\\n\t\tmemcpy((loc), (data), (size));\t\t\t\t\\\n\t\t(loc) += size;\t\t\t\t\t\t\\\n\t} while(0)\n\n#define\tADD_STRING(loc, data, size)\tADD_MEM(loc, data, size)\n\n#endif /* !_AUDIT_INTERNAL_H_ */\n"
  },
  {
    "path": "freebsd-headers/bsm/audit_kevents.h",
    "content": "/*-\n * Copyright (c) 2005-2009 Apple Inc.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n *\n * 1.  Redistributions of source code must retain the above copyright\n *     notice, this list of conditions and the following disclaimer.\n * 2.  Redistributions in binary form must reproduce the above copyright\n *     notice, this list of conditions and the following disclaimer in the\n *     documentation and/or other materials provided with the distribution.\n * 3.  Neither the name of Apple Inc. (\"Apple\") nor the names of\n *     its contributors may be used to endorse or promote products derived\n *     from this software without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS \"AS IS\" AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\n * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY\n * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\n * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\n * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF\n * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n *\n * P4: //depot/projects/trustedbsd/openbsm/sys/bsm/audit_kevents.h#7\n * $FreeBSD: release/9.0.0/sys/bsm/audit_kevents.h 197624 2009-09-29 21:25:59Z rwatson $\n */\n\n#ifndef _BSM_AUDIT_KEVENTS_H_\n#define\t_BSM_AUDIT_KEVENTS_H_\n\n/*\n * The reserved event numbers for kernel events are 1...2047 and 43001..44900.\n */\n#define\tAUE_IS_A_KEVENT(e)\t(((e) > 0 && (e) < 2048) || \t\\\n    \t\t\t\t ((e) > 43000 && (e) < 45000))\n\n/*\n * Values marked as AUE_NULL are not required to be audited as per CAPP.\n *\n * Some conflicts exist in the assignment of name to event number mappings\n * between BSM implementations.  In general, we prefer the OpenSolaris\n * definition as we consider Solaris BSM to be authoritative.  _DARWIN_ has\n * been inserted for the Darwin variants.  If necessary, other tags will be\n * added in the future.\n */\n#define\tAUE_NULL\t\t0\n#define\tAUE_EXIT\t\t1\n#define\tAUE_FORK\t\t2\n#define\tAUE_FORKALL\t\tAUE_FORK\t/* Solaris-specific. */\n#define\tAUE_OPEN\t\t3\n#define\tAUE_CREAT\t\t4\n#define\tAUE_LINK\t\t5\n#define\tAUE_UNLINK\t\t6\n#define\tAUE_DELETE\t\tAUE_UNLINK\t/* Darwin-specific. */\n#define\tAUE_EXEC\t\t7\n#define\tAUE_CHDIR\t\t8\n#define\tAUE_MKNOD\t\t9\n#define\tAUE_CHMOD\t\t10\n#define\tAUE_CHOWN\t\t11\n#define\tAUE_UMOUNT\t\t12\n#define\tAUE_JUNK\t\t13\t/* Solaris-specific. */\n#define\tAUE_ACCESS\t\t14\n#define\tAUE_KILL\t\t15\n#define\tAUE_STAT\t\t16\n#define\tAUE_LSTAT\t\t17\n#define\tAUE_ACCT\t\t18\n#define\tAUE_MCTL\t\t19\t/* Solaris-specific. */\n#define\tAUE_REBOOT\t\t20\t/* XXX: Darwin conflict. */\n#define\tAUE_SYMLINK\t\t21\n#define\tAUE_READLINK\t\t22\n#define\tAUE_EXECVE\t\t23\n#define\tAUE_CHROOT\t\t24\n#define\tAUE_VFORK\t\t25\n#define\tAUE_SETGROUPS\t\t26\n#define\tAUE_SETPGRP\t\t27\n#define\tAUE_SWAPON\t\t28\n#define\tAUE_SETHOSTNAME\t\t29\t/* XXX: Darwin conflict. */\n#define\tAUE_FCNTL\t\t30\n#define\tAUE_SETPRIORITY\t\t31\t/* XXX: Darwin conflict. */\n#define\tAUE_CONNECT\t\t32\n#define\tAUE_ACCEPT\t\t33\n#define\tAUE_BIND\t\t34\n#define\tAUE_SETSOCKOPT\t\t35\n#define\tAUE_VTRACE\t\t36\t/* Solaris-specific. */\n#define\tAUE_SETTIMEOFDAY\t37\t/* XXX: Darwin conflict. */\n#define\tAUE_FCHOWN\t\t38\n#define\tAUE_FCHMOD\t\t39\n#define\tAUE_SETREUID\t\t40\n#define\tAUE_SETREGID\t\t41\n#define\tAUE_RENAME\t\t42\n#define\tAUE_TRUNCATE\t\t43\t/* XXX: Darwin conflict. */\n#define\tAUE_FTRUNCATE\t\t44\t/* XXX: Darwin conflict. */\n#define\tAUE_FLOCK\t\t45\t/* XXX: Darwin conflict. */\n#define\tAUE_SHUTDOWN\t\t46\n#define\tAUE_MKDIR\t\t47\n#define\tAUE_RMDIR\t\t48\n#define\tAUE_UTIMES\t\t49\n#define\tAUE_ADJTIME\t\t50\n#define\tAUE_SETRLIMIT\t\t51\n#define\tAUE_KILLPG\t\t52\n#define\tAUE_NFS_SVC\t\t53\t/* XXX: Darwin conflict. */\n#define\tAUE_STATFS\t\t54\n#define\tAUE_FSTATFS\t\t55\n#define\tAUE_UNMOUNT\t\t56\t/* XXX: Darwin conflict. */\n#define\tAUE_ASYNC_DAEMON\t57\n#define\tAUE_NFS_GETFH\t\t58\t/* XXX: Darwin conflict. */\n#define\tAUE_SETDOMAINNAME\t59\n#define\tAUE_QUOTACTL\t\t60\t/* XXX: Darwin conflict. */\n#define\tAUE_EXPORTFS\t\t61\n#define\tAUE_MOUNT\t\t62\n#define\tAUE_SEMSYS\t\t63\n#define\tAUE_MSGSYS\t\t64\n#define\tAUE_SHMSYS\t\t65\n#define\tAUE_BSMSYS\t\t66\t/* Solaris-specific. */\n#define\tAUE_RFSSYS\t\t67\t/* Solaris-specific. */\n#define\tAUE_FCHDIR\t\t68\n#define\tAUE_FCHROOT\t\t69\n#define\tAUE_VPIXSYS\t\t70\t/* Solaris-specific. */\n#define\tAUE_PATHCONF\t\t71\n#define\tAUE_OPEN_R\t\t72\n#define\tAUE_OPEN_RC\t\t73\n#define\tAUE_OPEN_RT\t\t74\n#define\tAUE_OPEN_RTC\t\t75\n#define\tAUE_OPEN_W\t\t76\n#define\tAUE_OPEN_WC\t\t77\n#define\tAUE_OPEN_WT\t\t78\n#define\tAUE_OPEN_WTC\t\t79\n#define\tAUE_OPEN_RW\t\t80\n#define\tAUE_OPEN_RWC\t\t81\n#define\tAUE_OPEN_RWT\t\t82\n#define\tAUE_OPEN_RWTC\t\t83\n#define\tAUE_MSGCTL\t\t84\n#define\tAUE_MSGCTL_RMID\t\t85\n#define\tAUE_MSGCTL_SET\t\t86\n#define\tAUE_MSGCTL_STAT\t\t87\n#define\tAUE_MSGGET\t\t88\n#define\tAUE_MSGRCV\t\t89\n#define\tAUE_MSGSND\t\t90\n#define\tAUE_SHMCTL\t\t91\n#define\tAUE_SHMCTL_RMID\t\t92\n#define\tAUE_SHMCTL_SET\t\t93\n#define\tAUE_SHMCTL_STAT\t\t94\n#define\tAUE_SHMGET\t\t95\n#define\tAUE_SHMAT\t\t96\n#define\tAUE_SHMDT\t\t97\n#define\tAUE_SEMCTL\t\t98\n#define\tAUE_SEMCTL_RMID\t\t99\n#define\tAUE_SEMCTL_SET\t\t100\n#define\tAUE_SEMCTL_STAT\t\t101\n#define\tAUE_SEMCTL_GETNCNT\t102\n#define\tAUE_SEMCTL_GETPID\t103\n#define\tAUE_SEMCTL_GETVAL\t104\n#define\tAUE_SEMCTL_GETALL\t105\n#define\tAUE_SEMCTL_GETZCNT\t106\n#define\tAUE_SEMCTL_SETVAL\t107\n#define\tAUE_SEMCTL_SETALL\t108\n#define\tAUE_SEMGET\t\t109\n#define\tAUE_SEMOP\t\t110\n#define\tAUE_CORE\t\t111\t/* Solaris-specific, currently. */\n#define\tAUE_CLOSE\t\t112\n#define\tAUE_SYSTEMBOOT\t\t113\t/* Solaris-specific. */\n#define\tAUE_ASYNC_DAEMON_EXIT\t114\t/* Solaris-specific. */\n#define\tAUE_NFSSVC_EXIT\t\t115\t/* Solaris-specific. */\n#define\tAUE_WRITEL\t\t128\t/* Solaris-specific. */\n#define\tAUE_WRITEVL\t\t129\t/* Solaris-specific. */\n#define\tAUE_GETAUID\t\t130\n#define\tAUE_SETAUID\t\t131\n#define\tAUE_GETAUDIT\t\t132\n#define\tAUE_SETAUDIT\t\t133\n#define\tAUE_GETUSERAUDIT\t134\t/* Solaris-specific. */\n#define\tAUE_SETUSERAUDIT\t135\t/* Solaris-specific. */\n#define\tAUE_AUDITSVC\t\t136\t/* Solaris-specific. */\n#define\tAUE_AUDITUSER\t\t137\t/* Solaris-specific. */\n#define\tAUE_AUDITON\t\t138\n#define\tAUE_AUDITON_GTERMID\t139\t/* Solaris-specific. */\n#define\tAUE_AUDITON_STERMID\t140\t/* Solaris-specific. */\n#define\tAUE_AUDITON_GPOLICY\t141\n#define\tAUE_AUDITON_SPOLICY\t142\n#define\tAUE_AUDITON_GQCTRL\t145\n#define\tAUE_AUDITON_SQCTRL\t146\n#define\tAUE_GETKERNSTATE\t147\t/* Solaris-specific. */\n#define\tAUE_SETKERNSTATE\t148\t/* Solaris-specific. */\n#define\tAUE_GETPORTAUDIT\t149\t/* Solaris-specific. */\n#define\tAUE_AUDITSTAT\t\t150\t/* Solaris-specific. */\n#define\tAUE_REVOKE\t\t151\n#define\tAUE_MAC\t\t\t152\t/* Solaris-specific. */\n#define\tAUE_ENTERPROM\t\t153\t/* Solaris-specific. */\n#define\tAUE_EXITPROM\t\t154\t/* Solaris-specific. */\n#define\tAUE_IFLOAT\t\t155\t/* Solaris-specific. */\n#define\tAUE_PFLOAT\t\t156\t/* Solaris-specific. */\n#define\tAUE_UPRIV\t\t157\t/* Solaris-specific. */\n#define\tAUE_IOCTL\t\t158\n#define\tAUE_SOCKET\t\t183\n#define\tAUE_SENDTO\t\t184\n#define\tAUE_PIPE\t\t185\n#define\tAUE_SOCKETPAIR\t\t186\t/* XXX: Darwin conflict. */\n#define\tAUE_SEND\t\t187\n#define\tAUE_SENDMSG\t\t188\n#define\tAUE_RECV\t\t189\n#define\tAUE_RECVMSG\t\t190\n#define\tAUE_RECVFROM\t\t191\n#define\tAUE_READ\t\t192\n#define\tAUE_GETDENTS\t\t193\n#define\tAUE_LSEEK\t\t194\n#define\tAUE_WRITE\t\t195\n#define\tAUE_WRITEV\t\t196\n#define\tAUE_NFS\t\t\t197\t/* Solaris-specific. */\n#define\tAUE_READV\t\t198\n#define\tAUE_OSTAT\t\t199\t/* Solaris-specific. */\n#define\tAUE_SETUID\t\t200\t/* XXXRW: Solaris old setuid? */\n#define\tAUE_STIME\t\t201\t/* XXXRW: Solaris old stime? */\n#define\tAUE_UTIME\t\t202\t/* XXXRW: Solaris old utime? */\n#define\tAUE_NICE\t\t203\t/* XXXRW: Solaris old nice? */\n#define\tAUE_OSETPGRP\t\t204\t/* Solaris-specific. */\n#define\tAUE_SETGID\t\t205\n#define\tAUE_READL\t\t206\t/* Solaris-specific. */\n#define\tAUE_READVL\t\t207\t/* Solaris-specific. */\n#define\tAUE_FSTAT\t\t208\n#define\tAUE_DUP2\t\t209\n#define\tAUE_MMAP\t\t210\n#define\tAUE_AUDIT\t\t211\n#define\tAUE_PRIOCNTLSYS\t\t212\t/* Solaris-specific. */\n#define\tAUE_MUNMAP\t\t213\n#define\tAUE_SETEGID\t\t214\n#define\tAUE_SETEUID\t\t215\n#define\tAUE_PUTMSG\t\t216\t/* Solaris-specific. */\n#define\tAUE_GETMSG\t\t217\t/* Solaris-specific. */\n#define\tAUE_PUTPMSG\t\t218\t/* Solaris-specific. */\n#define\tAUE_GETPMSG\t\t219\t/* Solaris-specific. */\n#define\tAUE_AUDITSYS\t\t220\t/* Solaris-specific. */\n#define\tAUE_AUDITON_GETKMASK\t221\n#define\tAUE_AUDITON_SETKMASK\t222\n#define\tAUE_AUDITON_GETCWD\t223\n#define\tAUE_AUDITON_GETCAR\t224\n#define\tAUE_AUDITON_GETSTAT\t225\n#define\tAUE_AUDITON_SETSTAT\t226\n#define\tAUE_AUDITON_SETUMASK\t227\n#define\tAUE_AUDITON_SETSMASK\t228\n#define\tAUE_AUDITON_GETCOND\t229\n#define\tAUE_AUDITON_SETCOND\t230\n#define\tAUE_AUDITON_GETCLASS\t231\n#define\tAUE_AUDITON_SETCLASS\t232\n#define\tAUE_FUSERS\t\t233\t/* Solaris-specific; also UTSSYS? */\n#define\tAUE_STATVFS\t\t234\n#define\tAUE_XSTAT\t\t235\t/* Solaris-specific. */\n#define\tAUE_LXSTAT\t\t236\t/* Solaris-specific. */\n#define\tAUE_LCHOWN\t\t237\n#define\tAUE_MEMCNTL\t\t238\t/* Solaris-specific. */\n#define\tAUE_SYSINFO\t\t239\t/* Solaris-specific. */\n#define\tAUE_XMKNOD\t\t240\t/* Solaris-specific. */\n#define\tAUE_FORK1\t\t241\n#define\tAUE_MODCTL\t\t242\t/* Solaris-specific. */\n#define\tAUE_MODLOAD\t\t243\n#define\tAUE_MODUNLOAD\t\t244\n#define\tAUE_MODCONFIG\t\t245\t/* Solaris-specific. */\n#define\tAUE_MODADDMAJ\t\t246\t/* Solaris-specific. */\n#define\tAUE_SOCKACCEPT\t\t247\t/* Solaris-specific. */\n#define\tAUE_SOCKCONNECT\t\t248\t/* Solaris-specific. */\n#define\tAUE_SOCKSEND\t\t249\t/* Solaris-specific. */\n#define\tAUE_SOCKRECEIVE\t\t250\t/* Solaris-specific. */\n#define\tAUE_ACLSET\t\t251\n#define\tAUE_FACLSET\t\t252\n#define\tAUE_DOORFS\t\t253\t/* Solaris-specific. */\n#define\tAUE_DOORFS_DOOR_CALL\t254\t/* Solaris-specific. */\n#define\tAUE_DOORFS_DOOR_RETURN\t255\t/* Solaris-specific. */\n#define\tAUE_DOORFS_DOOR_CREATE\t256\t/* Solaris-specific. */\n#define\tAUE_DOORFS_DOOR_REVOKE\t257\t/* Solaris-specific. */\n#define\tAUE_DOORFS_DOOR_INFO\t258\t/* Solaris-specific. */\n#define\tAUE_DOORFS_DOOR_CRED\t259\t/* Solaris-specific. */\n#define\tAUE_DOORFS_DOOR_BIND\t260\t/* Solaris-specific. */\n#define\tAUE_DOORFS_DOOR_UNBIND\t261\t/* Solaris-specific. */\n#define\tAUE_P_ONLINE\t\t262\t/* Solaris-specific. */\n#define\tAUE_PROCESSOR_BIND\t263\t/* Solaris-specific. */\n#define\tAUE_INST_SYNC\t\t264\t/* Solaris-specific. */\n#define\tAUE_SOCKCONFIG\t\t265\t/* Solaris-specific. */\n#define\tAUE_SETAUDIT_ADDR\t266\n#define\tAUE_GETAUDIT_ADDR\t267\n#define\tAUE_UMOUNT2\t\t268\t/* Solaris-specific. */\n#define\tAUE_FSAT\t\t269\t/* Solaris-specific. */\n#define\tAUE_OPENAT_R\t\t270\n#define\tAUE_OPENAT_RC\t\t271\n#define\tAUE_OPENAT_RT\t\t272\n#define\tAUE_OPENAT_RTC\t\t273\n#define\tAUE_OPENAT_W\t\t274\n#define\tAUE_OPENAT_WC\t\t275\n#define\tAUE_OPENAT_WT\t\t276\n#define\tAUE_OPENAT_WTC\t\t277\n#define\tAUE_OPENAT_RW\t\t278\n#define\tAUE_OPENAT_RWC\t\t279\n#define\tAUE_OPENAT_RWT\t\t280\n#define\tAUE_OPENAT_RWTC\t\t281\n#define\tAUE_RENAMEAT\t\t282\n#define\tAUE_FSTATAT\t\t283\n#define\tAUE_FCHOWNAT\t\t284\n#define\tAUE_FUTIMESAT\t\t285\n#define\tAUE_UNLINKAT\t\t286\n#define\tAUE_CLOCK_SETTIME\t287\n#define\tAUE_NTP_ADJTIME\t\t288\n#define\tAUE_SETPPRIV\t\t289\t/* Solaris-specific. */\n#define\tAUE_MODDEVPLCY\t\t290\t/* Solaris-specific. */\n#define\tAUE_MODADDPRIV\t\t291\t/* Solaris-specific. */\n#define\tAUE_CRYPTOADM\t\t292\t/* Solaris-specific. */\n#define\tAUE_CONFIGKSSL\t\t293\t/* Solaris-specific. */\n#define\tAUE_BRANDSYS\t\t294\t/* Solaris-specific. */\n#define\tAUE_PF_POLICY_ADDRULE\t295\t/* Solaris-specific. */\n#define\tAUE_PF_POLICY_DELRULE\t296\t/* Solaris-specific. */\n#define\tAUE_PF_POLICY_CLONE\t297\t/* Solaris-specific. */\n#define\tAUE_PF_POLICY_FLIP\t298\t/* Solaris-specific. */\n#define\tAUE_PF_POLICY_FLUSH\t299\t/* Solaris-specific. */\n#define\tAUE_PF_POLICY_ALGS\t300\t/* Solaris-specific. */\n#define\tAUE_PORTFS\t\t301\t/* Solaris-specific. */\n\n/*\n * Events added for Apple Darwin that potentially collide with future Solaris\n * BSM events.  These are assigned AUE_DARWIN prefixes, and are deprecated in\n * new trails.  Systems generating these events should switch to the new\n * identifiers that avoid colliding with the Solaris identifier space.\n */\n#define\tAUE_DARWIN_GETFSSTAT\t301\n#define\tAUE_DARWIN_PTRACE\t302\n#define\tAUE_DARWIN_CHFLAGS\t303\n#define\tAUE_DARWIN_FCHFLAGS\t304\n#define\tAUE_DARWIN_PROFILE\t305\n#define\tAUE_DARWIN_KTRACE\t306\n#define\tAUE_DARWIN_SETLOGIN\t307\n#define\tAUE_DARWIN_REBOOT\t308\n#define\tAUE_DARWIN_REVOKE\t309\n#define\tAUE_DARWIN_UMASK\t310\n#define\tAUE_DARWIN_MPROTECT\t311\n#define\tAUE_DARWIN_SETPRIORITY\t312\n#define\tAUE_DARWIN_SETTIMEOFDAY\t313\n#define\tAUE_DARWIN_FLOCK\t314\n#define\tAUE_DARWIN_MKFIFO\t315\n#define\tAUE_DARWIN_POLL\t\t316\n#define\tAUE_DARWIN_SOCKETPAIR\t317\n#define\tAUE_DARWIN_FUTIMES\t318\n#define\tAUE_DARWIN_SETSID\t319\n#define\tAUE_DARWIN_SETPRIVEXEC\t320\t/* Darwin-specific. */\n#define\tAUE_DARWIN_NFSSVC\t321\n#define\tAUE_DARWIN_GETFH\t322\n#define\tAUE_DARWIN_QUOTACTL\t323\n#define\tAUE_DARWIN_ADDPROFILE\t324\t/* Darwin-specific. */\n#define\tAUE_DARWIN_KDEBUGTRACE\t325\t/* Darwin-specific. */\n#define\tAUE_DARWIN_KDBUGTRACE\tAUE_KDEBUGTRACE\n#define\tAUE_DARWIN_FSTAT\t326\n#define\tAUE_DARWIN_FPATHCONF\t327\n#define\tAUE_DARWIN_GETDIRENTRIES\t328\n#define\tAUE_DARWIN_TRUNCATE\t329\n#define\tAUE_DARWIN_FTRUNCATE\t330\n#define\tAUE_DARWIN_SYSCTL\t331\n#define\tAUE_DARWIN_MLOCK\t332\n#define\tAUE_DARWIN_MUNLOCK\t333\n#define\tAUE_DARWIN_UNDELETE\t334\n#define\tAUE_DARWIN_GETATTRLIST\t335\t/* Darwin-specific. */\n#define\tAUE_DARWIN_SETATTRLIST\t336\t/* Darwin-specific. */\n#define\tAUE_DARWIN_GETDIRENTRIESATTR\t337\t/* Darwin-specific. */\n#define\tAUE_DARWIN_EXCHANGEDATA\t338\t/* Darwin-specific. */\n#define\tAUE_DARWIN_SEARCHFS\t339\t/* Darwin-specific. */\n#define\tAUE_DARWIN_MINHERIT\t340\n#define\tAUE_DARWIN_SEMCONFIG\t341\n#define\tAUE_DARWIN_SEMOPEN\t342\n#define\tAUE_DARWIN_SEMCLOSE\t343\n#define\tAUE_DARWIN_SEMUNLINK\t344\n#define\tAUE_DARWIN_SHMOPEN\t345\n#define\tAUE_DARWIN_SHMUNLINK\t346\n#define\tAUE_DARWIN_LOADSHFILE\t347\t/* Darwin-specific. */\n#define\tAUE_DARWIN_RESETSHFILE\t348\t/* Darwin-specific. */\n#define\tAUE_DARWIN_NEWSYSTEMSHREG\t349\t/* Darwin-specific. */\n#define\tAUE_DARWIN_PTHREADKILL\t350\t/* Darwin-specific. */\n#define\tAUE_DARWIN_PTHREADSIGMASK\t351\t/* Darwin-specific. */\n#define\tAUE_DARWIN_AUDITCTL\t352\n#define\tAUE_DARWIN_RFORK\t353\n#define\tAUE_DARWIN_LCHMOD\t354\n#define\tAUE_DARWIN_SWAPOFF\t355\n#define\tAUE_DARWIN_INITPROCESS\t356\t/* Darwin-specific. */\n#define\tAUE_DARWIN_MAPFD\t357\t/* Darwin-specific. */\n#define\tAUE_DARWIN_TASKFORPID\t358\t/* Darwin-specific. */\n#define\tAUE_DARWIN_PIDFORTASK\t359\t/* Darwin-specific. */\n#define\tAUE_DARWIN_SYSCTL_NONADMIN\t360\n#define\tAUE_DARWIN_COPYFILE\t361\t/* Darwin-specific. */\n\n/*\n * Audit event identifiers added as part of OpenBSM, generally corresponding\n * to events in FreeBSD, Darwin, and Linux that were not present in Solaris.\n * These often duplicate events added to the Solaris set by Darwin, but use\n * event identifiers in a higher range in order to avoid colliding with\n * future Solaris additions.\n *\n * If an event in this section is later added to Solaris, we prefer the\n * Solaris event identifier, and add _OPENBSM_ to the OpenBSM-specific\n * identifier so that old trails can still be processed, but new trails use\n * the Solaris identifier.\n */\n#define\tAUE_GETFSSTAT\t\t43001\n#define\tAUE_PTRACE\t\t43002\n#define\tAUE_CHFLAGS\t\t43003\n#define\tAUE_FCHFLAGS\t\t43004\n#define\tAUE_PROFILE\t\t43005\n#define\tAUE_KTRACE\t\t43006\n#define\tAUE_SETLOGIN\t\t43007\n#define\tAUE_OPENBSM_REVOKE\t43008\t/* Solaris event now preferred. */\n#define\tAUE_UMASK\t\t43009\n#define\tAUE_MPROTECT\t\t43010\n#define\tAUE_MKFIFO\t\t43011\n#define\tAUE_POLL\t\t43012\n#define\tAUE_FUTIMES\t\t43013\n#define\tAUE_SETSID\t\t43014\n#define\tAUE_SETPRIVEXEC\t\t43015\t/* Darwin-specific. */\n#define\tAUE_ADDPROFILE\t\t43016\t/* Darwin-specific. */\n#define\tAUE_KDEBUGTRACE\t\t43017\t/* Darwin-specific. */\n#define\tAUE_KDBUGTRACE\t\tAUE_KDEBUGTRACE\n#define\tAUE_OPENBSM_FSTAT\t43018\t/* Solaris event now preferred. */\n#define\tAUE_FPATHCONF\t\t43019\n#define\tAUE_GETDIRENTRIES\t43020\n#define\tAUE_SYSCTL\t\t43021\n#define\tAUE_MLOCK\t\t43022\n#define\tAUE_MUNLOCK\t\t43023\n#define\tAUE_UNDELETE\t\t43024\n#define\tAUE_GETATTRLIST\t\t43025\t/* Darwin-specific. */\n#define\tAUE_SETATTRLIST\t\t43026\t/* Darwin-specific. */\n#define\tAUE_GETDIRENTRIESATTR\t43027\t/* Darwin-specific. */\n#define\tAUE_EXCHANGEDATA\t43028\t/* Darwin-specific. */\n#define\tAUE_SEARCHFS\t\t43029\t/* Darwin-specific. */\n#define\tAUE_MINHERIT\t\t43030\n#define\tAUE_SEMCONFIG\t\t43031\n#define\tAUE_SEMOPEN\t\t43032\n#define\tAUE_SEMCLOSE\t\t43033\n#define\tAUE_SEMUNLINK\t\t43034\n#define\tAUE_SHMOPEN\t\t43035\n#define\tAUE_SHMUNLINK\t\t43036\n#define\tAUE_LOADSHFILE\t\t43037\t/* Darwin-specific. */\n#define\tAUE_RESETSHFILE\t\t43038\t/* Darwin-specific. */\n#define\tAUE_NEWSYSTEMSHREG\t43039\t/* Darwin-specific. */\n#define\tAUE_PTHREADKILL\t\t43040\t/* Darwin-specific. */\n#define\tAUE_PTHREADSIGMASK\t43041\t/* Darwin-specific. */\n#define\tAUE_AUDITCTL\t\t43042\n#define\tAUE_RFORK\t\t43043\n#define\tAUE_LCHMOD\t\t43044\n#define\tAUE_SWAPOFF\t\t43045\n#define\tAUE_INITPROCESS\t\t43046\t/* Darwin-specific. */\n#define\tAUE_MAPFD\t\t43047\t/* Darwin-specific. */\n#define\tAUE_TASKFORPID\t\t43048\t/* Darwin-specific. */\n#define\tAUE_PIDFORTASK\t\t43049\t/* Darwin-specific. */\n#define\tAUE_SYSCTL_NONADMIN\t43050\n#define\tAUE_COPYFILE\t\t43051\t/* Darwin-specific. */\n\n/*\n * Events added to OpenBSM for FreeBSD and Linux; may also be used by Darwin\n * in the future.\n */\n#define\tAUE_LUTIMES\t\t43052\n#define\tAUE_LCHFLAGS\t\t43053\t/* FreeBSD-specific. */\n#define\tAUE_SENDFILE\t\t43054\t/* BSD/Linux-specific. */\n#define\tAUE_USELIB\t\t43055\t/* Linux-specific. */\n#define\tAUE_GETRESUID\t\t43056\n#define\tAUE_SETRESUID\t\t43057\n#define\tAUE_GETRESGID\t\t43058\n#define\tAUE_SETRESGID\t\t43059\n#define\tAUE_WAIT4\t\t43060\t/* FreeBSD-specific. */\n#define\tAUE_LGETFH\t\t43061\t/* FreeBSD-specific. */\n#define\tAUE_FHSTATFS\t\t43062\t/* FreeBSD-specific. */\n#define\tAUE_FHOPEN\t\t43063\t/* FreeBSD-specific. */\n#define\tAUE_FHSTAT\t\t43064\t/* FreeBSD-specific. */\n#define\tAUE_JAIL\t\t43065\t/* FreeBSD-specific. */\n#define\tAUE_EACCESS\t\t43066\t/* FreeBSD-specific. */\n#define\tAUE_KQUEUE\t\t43067\t/* FreeBSD-specific. */\n#define\tAUE_KEVENT\t\t43068\t/* FreeBSD-specific. */\n#define\tAUE_FSYNC\t\t43069\n#define\tAUE_NMOUNT\t\t43070\t/* FreeBSD-specific. */\n#define\tAUE_BDFLUSH\t\t43071\t/* Linux-specific. */\n#define\tAUE_SETFSUID\t\t43072\t/* Linux-specific. */\n#define\tAUE_SETFSGID\t\t43073\t/* Linux-specific. */\n#define\tAUE_PERSONALITY\t\t43074\t/* Linux-specific. */\n#define\tAUE_SCHED_GETSCHEDULER\t43075\t/* POSIX.1b. */\n#define\tAUE_SCHED_SETSCHEDULER\t43076\t/* POSIX.1b. */\n#define\tAUE_PRCTL\t\t43077\t/* Linux-specific. */\n#define\tAUE_GETCWD\t\t43078\t/* FreeBSD/Linux-specific. */\n#define\tAUE_CAPGET\t\t43079\t/* Linux-specific. */\n#define\tAUE_CAPSET\t\t43080\t/* Linux-specific. */\n#define\tAUE_PIVOT_ROOT\t\t43081\t/* Linux-specific. */\n#define\tAUE_RTPRIO\t\t43082\t/* FreeBSD-specific. */\n#define\tAUE_SCHED_GETPARAM\t43083\t/* POSIX.1b. */\n#define\tAUE_SCHED_SETPARAM\t43084\t/* POSIX.1b. */\n#define\tAUE_SCHED_GET_PRIORITY_MAX\t43085\t/* POSIX.1b. */\n#define\tAUE_SCHED_GET_PRIORITY_MIN\t43086\t/* POSIX.1b. */\n#define\tAUE_SCHED_RR_GET_INTERVAL\t43087\t/* POSIX.1b. */\n#define\tAUE_ACL_GET_FILE\t43088\t/* FreeBSD. */\n#define\tAUE_ACL_SET_FILE\t43089\t/* FreeBSD. */\n#define\tAUE_ACL_GET_FD\t\t43090\t/* FreeBSD. */\n#define\tAUE_ACL_SET_FD\t\t43091\t/* FreeBSD. */\n#define\tAUE_ACL_DELETE_FILE\t43092\t/* FreeBSD. */\n#define\tAUE_ACL_DELETE_FD\t43093\t/* FreeBSD. */\n#define\tAUE_ACL_CHECK_FILE\t43094\t/* FreeBSD. */\n#define\tAUE_ACL_CHECK_FD\t43095\t/* FreeBSD. */\n#define\tAUE_ACL_GET_LINK\t43096\t/* FreeBSD. */\n#define\tAUE_ACL_SET_LINK\t43097\t/* FreeBSD. */\n#define\tAUE_ACL_DELETE_LINK\t43098\t/* FreeBSD. */\n#define\tAUE_ACL_CHECK_LINK\t43099\t/* FreeBSD. */\n#define\tAUE_SYSARCH\t\t43100\t/* FreeBSD. */\n#define\tAUE_EXTATTRCTL\t\t43101\t/* FreeBSD. */\n#define\tAUE_EXTATTR_GET_FILE\t43102\t/* FreeBSD. */\n#define\tAUE_EXTATTR_SET_FILE\t43103\t/* FreeBSD. */\n#define\tAUE_EXTATTR_LIST_FILE\t43104\t/* FreeBSD. */\n#define\tAUE_EXTATTR_DELETE_FILE\t43105\t/* FreeBSD. */\n#define\tAUE_EXTATTR_GET_FD\t43106\t/* FreeBSD. */\n#define\tAUE_EXTATTR_SET_FD\t43107\t/* FreeBSD. */\n#define\tAUE_EXTATTR_LIST_FD\t43108\t/* FreeBSD. */\n#define\tAUE_EXTATTR_DELETE_FD\t43109\t/* FreeBSD. */\n#define\tAUE_EXTATTR_GET_LINK\t43110\t/* FreeBSD. */\n#define\tAUE_EXTATTR_SET_LINK\t43111\t/* FreeBSD. */\n#define\tAUE_EXTATTR_LIST_LINK\t43112\t/* FreeBSD. */\n#define\tAUE_EXTATTR_DELETE_LINK\t43113\t/* FreeBSD. */\n#define\tAUE_KENV\t\t43114\t/* FreeBSD. */\n#define\tAUE_JAIL_ATTACH\t\t43115\t/* FreeBSD. */\n#define\tAUE_SYSCTL_WRITE\t43116\t/* FreeBSD. */\n#define\tAUE_IOPERM\t\t43117\t/* Linux. */\n#define\tAUE_READDIR\t\t43118\t/* Linux. */\n#define\tAUE_IOPL\t\t43119\t/* Linux. */\n#define\tAUE_VM86\t\t43120\t/* Linux. */\n#define\tAUE_MAC_GET_PROC\t43121\t/* FreeBSD/Darwin. */\n#define\tAUE_MAC_SET_PROC\t43122\t/* FreeBSD/Darwin. */\n#define\tAUE_MAC_GET_FD\t\t43123\t/* FreeBSD/Darwin. */\n#define\tAUE_MAC_GET_FILE\t43124\t/* FreeBSD/Darwin. */\n#define\tAUE_MAC_SET_FD\t\t43125\t/* FreeBSD/Darwin. */\n#define\tAUE_MAC_SET_FILE\t43126\t/* FreeBSD/Darwin. */\n#define\tAUE_MAC_SYSCALL\t\t43127\t/* FreeBSD. */\n#define\tAUE_MAC_GET_PID\t\t43128\t/* FreeBSD/Darwin. */\n#define\tAUE_MAC_GET_LINK\t43129\t/* FreeBSD/Darwin. */\n#define\tAUE_MAC_SET_LINK\t43130\t/* FreeBSD/Darwin. */\n#define\tAUE_MAC_EXECVE\t\t43131\t/* FreeBSD/Darwin. */\n#define\tAUE_GETPATH_FROMFD\t43132\t/* FreeBSD. */\n#define\tAUE_GETPATH_FROMADDR\t43133\t/* FreeBSD. */\n#define\tAUE_MQ_OPEN\t\t43134\t/* FreeBSD. */\n#define\tAUE_MQ_SETATTR\t\t43135\t/* FreeBSD. */\n#define\tAUE_MQ_TIMEDRECEIVE\t43136\t/* FreeBSD. */\n#define\tAUE_MQ_TIMEDSEND\t43137\t/* FreeBSD. */\n#define\tAUE_MQ_NOTIFY\t\t43138\t/* FreeBSD. */\n#define\tAUE_MQ_UNLINK\t\t43139\t/* FreeBSD. */\n#define\tAUE_LISTEN\t\t43140\t/* FreeBSD/Darwin/Linux. */\n#define\tAUE_MLOCKALL\t\t43141\t/* FreeBSD. */\n#define\tAUE_MUNLOCKALL\t\t43142\t/* FreeBSD. */\n#define\tAUE_CLOSEFROM\t\t43143\t/* FreeBSD. */\n#define\tAUE_FEXECVE\t\t43144\t/* FreeBSD. */\n#define\tAUE_FACCESSAT\t\t43145\t/* FreeBSD. */\n#define\tAUE_FCHMODAT\t\t43146\t/* FreeBSD. */\n#define\tAUE_LINKAT\t\t43147\t/* FreeBSD. */\n#define\tAUE_MKDIRAT\t\t43148\t/* FreeBSD. */\n#define\tAUE_MKFIFOAT\t\t43149\t/* FreeBSD. */\n#define\tAUE_MKNODAT\t\t43150\t/* FreeBSD. */\n#define\tAUE_READLINKAT\t\t43151\t/* FreeBSD. */\n#define\tAUE_SYMLINKAT\t\t43152\t/* FreeBSD. */\n#define\tAUE_MAC_GETFSSTAT\t43153\t/* Darwin. */\n#define\tAUE_MAC_GET_MOUNT\t43154\t/* Darwin. */\n#define\tAUE_MAC_GET_LCID\t43155\t/* Darwin. */\n#define\tAUE_MAC_GET_LCTX\t43156\t/* Darwin. */\n#define\tAUE_MAC_SET_LCTX\t43157\t/* Darwin. */\n#define\tAUE_MAC_MOUNT\t\t43158\t/* Darwin. */\n#define\tAUE_GETLCID\t\t43159\t/* Darwin. */\n#define\tAUE_SETLCID\t\t43160\t/* Darwin. */\n#define\tAUE_TASKNAMEFORPID\t43161\t/* Darwin. */\n#define\tAUE_ACCESS_EXTENDED\t43162\t/* Darwin. */\n#define\tAUE_CHMOD_EXTENDED\t43163\t/* Darwin. */\n#define\tAUE_FCHMOD_EXTENDED\t43164\t/* Darwin. */\n#define\tAUE_FSTAT_EXTENDED\t43165\t/* Darwin. */\n#define\tAUE_LSTAT_EXTENDED\t43166\t/* Darwin. */\n#define\tAUE_MKDIR_EXTENDED\t43167\t/* Darwin. */\n#define\tAUE_MKFIFO_EXTENDED\t43168\t/* Darwin. */\n#define\tAUE_OPEN_EXTENDED\t43169\t/* Darwin. */\n#define\tAUE_OPEN_EXTENDED_R\t43170\t/* Darwin. */\n#define\tAUE_OPEN_EXTENDED_RC\t43171\t/* Darwin. */\n#define\tAUE_OPEN_EXTENDED_RT\t43172\t/* Darwin. */\n#define\tAUE_OPEN_EXTENDED_RTC\t43173\t/* Darwin. */\n#define\tAUE_OPEN_EXTENDED_W\t43174\t/* Darwin. */\n#define\tAUE_OPEN_EXTENDED_WC\t43175\t/* Darwin. */\n#define\tAUE_OPEN_EXTENDED_WT\t43176\t/* Darwin. */\n#define\tAUE_OPEN_EXTENDED_WTC\t43177\t/* Darwin. */\n#define\tAUE_OPEN_EXTENDED_RW\t43178\t/* Darwin. */\n#define\tAUE_OPEN_EXTENDED_RWC\t43179\t/* Darwin. */\n#define\tAUE_OPEN_EXTENDED_RWT\t43180\t/* Darwin. */\n#define\tAUE_OPEN_EXTENDED_RWTC\t43181\t/* Darwin. */\n#define\tAUE_STAT_EXTENDED\t43182\t/* Darwin. */\n#define\tAUE_UMASK_EXTENDED\t43183\t/* Darwin. */\n#define\tAUE_OPENAT\t\t43184\t/* FreeBSD. */\n#define\tAUE_POSIX_OPENPT\t43185\t/* FreeBSD. */\n#define\tAUE_CAP_NEW\t\t43186\t/* TrustedBSD. */\n#define\tAUE_CAP_GETRIGHTS\t43187\t/* TrustedBSD. */\n#define\tAUE_CAP_ENTER\t\t43188\t/* TrustedBSD. */\n#define\tAUE_CAP_GETMODE\t\t43189\t/* TrustedBSD. */\n#define\tAUE_POSIX_SPAWN\t\t43190\t/* Darwin. */\n#define\tAUE_FSGETPATH\t\t43191\t/* Darwin. */\n#define\tAUE_PREAD\t\t43192\t/* Darwin/FreeBSD. */\n#define\tAUE_PWRITE\t\t43193\t/* Darwin/FreeBSD. */\n#define\tAUE_FSCTL\t\t43194\t/* Darwin. */\n#define\tAUE_FFSCTL\t\t43195\t/* Darwin. */\n#define\tAUE_LPATHCONF\t\t43196\t/* FreeBSD. */\n#define\tAUE_PDFORK\t\t43197\t/* FreeBSD. */\n#define\tAUE_PDKILL\t\t43198\t/* FreeBSD. */\n#define\tAUE_PDGETPID\t\t43199\t/* FreeBSD. */\n#define\tAUE_PDWAIT\t\t43200\t/* FreeBSD. */\n\n/*\n * Darwin BSM uses a number of AUE_O_* definitions, which are aliased to the\n * normal Solaris BSM identifiers.  _O_ refers to it being an old, or compat\n * interface.  In most cases, Darwin has never implemented these system calls\n * but picked up the fields in their system call table from their FreeBSD\n * import.  Happily, these have different names than the AUE_O* definitions\n * in Solaris BSM.\n */\n#define\tAUE_O_CREAT\t\tAUE_OPEN_RWTC\t/* Darwin */\n#define\tAUE_O_EXECVE\t\tAUE_NULL\t/* Darwin */\n#define\tAUE_O_SBREAK\t\tAUE_NULL\t/* Darwin */\n#define\tAUE_O_LSEEK\t\tAUE_NULL\t/* Darwin */\n#define\tAUE_O_MOUNT\t\tAUE_NULL\t/* Darwin */\n#define\tAUE_O_UMOUNT\t\tAUE_NULL\t/* Darwin */\n#define\tAUE_O_STAT\t\tAUE_STAT\t/* Darwin */\n#define\tAUE_O_LSTAT\t\tAUE_LSTAT\t/* Darwin */\n#define\tAUE_O_FSTAT\t\tAUE_FSTAT\t/* Darwin */\n#define\tAUE_O_GETPAGESIZE\tAUE_NULL\t/* Darwin */\n#define\tAUE_O_VREAD\t\tAUE_NULL\t/* Darwin */\n#define\tAUE_O_VWRITE\t\tAUE_NULL\t/* Darwin */\n#define\tAUE_O_MMAP\t\tAUE_MMAP\t/* Darwin */\n#define\tAUE_O_VADVISE\t\tAUE_NULL\t/* Darwin */\n#define\tAUE_O_VHANGUP\t\tAUE_NULL\t/* Darwin */\n#define\tAUE_O_VLIMIT\t\tAUE_NULL\t/* Darwin */\n#define\tAUE_O_WAIT\t\tAUE_NULL\t/* Darwin */\n#define\tAUE_O_GETHOSTNAME\tAUE_NULL\t/* Darwin */\n#define\tAUE_O_SETHOSTNAME\tAUE_SYSCTL\t/* Darwin */\n#define\tAUE_O_GETDOPT\t\tAUE_NULL\t/* Darwin */\n#define\tAUE_O_SETDOPT\t\tAUE_NULL\t/* Darwin */\n#define\tAUE_O_ACCEPT\t\tAUE_NULL\t/* Darwin */\n#define\tAUE_O_SEND\t\tAUE_SENDMSG\t/* Darwin */\n#define\tAUE_O_RECV\t\tAUE_RECVMSG\t/* Darwin */\n#define\tAUE_O_VTIMES\t\tAUE_NULL\t/* Darwin */\n#define\tAUE_O_SIGVEC\t\tAUE_NULL\t/* Darwin */\n#define\tAUE_O_SIGBLOCK\t\tAUE_NULL\t/* Darwin */\n#define\tAUE_O_SIGSETMASK\tAUE_NULL\t/* Darwin */\n#define\tAUE_O_SIGSTACK\t\tAUE_NULL\t/* Darwin */\n#define\tAUE_O_RECVMSG\t\tAUE_RECVMSG\t/* Darwin */\n#define\tAUE_O_SENDMSG\t\tAUE_SENDMSG\t/* Darwin */\n#define\tAUE_O_VTRACE\t\tAUE_NULL\t/* Darwin */\n#define\tAUE_O_RESUBA\t\tAUE_NULL\t/* Darwin */\n#define\tAUE_O_RECVFROM\t\tAUE_RECVFROM\t/* Darwin */\n#define\tAUE_O_SETREUID\t\tAUE_SETREUID\t/* Darwin */\n#define\tAUE_O_SETREGID\t\tAUE_SETREGID\t/* Darwin */\n#define\tAUE_O_GETDIRENTRIES\tAUE_GETDIRENTRIES\t/* Darwin */\n#define\tAUE_O_TRUNCATE\t\tAUE_TRUNCATE\t/* Darwin */\n#define\tAUE_O_FTRUNCATE\t\tAUE_FTRUNCATE\t/* Darwin */\n#define\tAUE_O_GETPEERNAME\tAUE_NULL\t/* Darwin */\n#define\tAUE_O_GETHOSTID\t\tAUE_NULL\t/* Darwin */\n#define\tAUE_O_SETHOSTID\t\tAUE_NULL\t/* Darwin */\n#define\tAUE_O_GETRLIMIT\t\tAUE_NULL\t/* Darwin */\n#define\tAUE_O_SETRLIMIT\t\tAUE_SETRLIMIT\t/* Darwin */\n#define\tAUE_O_KILLPG\t\tAUE_KILL\t/* Darwin */\n#define\tAUE_O_SETQUOTA\t\tAUE_NULL\t/* Darwin */\n#define\tAUE_O_QUOTA\t\tAUE_NULL\t/* Darwin */\n#define\tAUE_O_GETSOCKNAME\tAUE_NULL\t/* Darwin */\n#define\tAUE_O_GETDIREENTRIES\tAUE_GETDIREENTRIES\t/* Darwin */\n#define\tAUE_O_ASYNCDAEMON\tAUE_NULL\t/* Darwin */\n#define\tAUE_O_GETDOMAINNAME\tAUE_NULL\t/* Darwin */\n#define\tAUE_O_SETDOMAINNAME\tAUE_SYSCTL\t/* Darwin */\n#define\tAUE_O_PCFS_MOUNT\tAUE_NULL\t/* Darwin */\n#define\tAUE_O_EXPORTFS\t\tAUE_NULL\t/* Darwin */\n#define\tAUE_O_USTATE\t\tAUE_NULL\t/* Darwin */\n#define\tAUE_O_WAIT3\t\tAUE_NULL\t/* Darwin */\n#define\tAUE_O_RPAUSE\t\tAUE_NULL\t/* Darwin */\n#define\tAUE_O_GETDENTS\t\tAUE_NULL\t/* Darwin */\n\n/*\n * Possible desired future values based on review of BSD/Darwin system calls.\n */\n#define\tAUE_ATGETMSG\t\tAUE_NULL\n#define\tAUE_ATPUTMSG\t\tAUE_NULL\n#define\tAUE_ATSOCKET\t\tAUE_NULL\n#define\tAUE_ATPGETREQ\t\tAUE_NULL\n#define\tAUE_ATPGETRSP\t\tAUE_NULL\n#define\tAUE_ATPSNDREQ\t\tAUE_NULL\n#define\tAUE_ATPSNDRSP\t\tAUE_NULL\n#define\tAUE_BSDTHREADCREATE\tAUE_NULL\n#define\tAUE_BSDTHREADTERMINATE\tAUE_NULL\n#define\tAUE_BSDTHREADREGISTER\tAUE_NULL\n#define\tAUE_CHUD\t\tAUE_NULL\n#define\tAUE_CSOPS\t\tAUE_NULL\n#define\tAUE_DUP\t\t\tAUE_NULL\n#define\tAUE_FDATASYNC\t\tAUE_NULL\n#define\tAUE_FGETATTRLIST\tAUE_NULL\n#define\tAUE_FGETXATTR\t\tAUE_NULL\n#define\tAUE_FLISTXATTR\t\tAUE_NULL\n#define\tAUE_FREMOVEXATTR\tAUE_NULL\n#define\tAUE_FSETATTRLIST\tAUE_NULL\n#define\tAUE_FSETXATTR\t\tAUE_NULL\n#define\tAUE_FSTATFS64\t\tAUE_NULL\n#define\tAUE_FSTATV\t\tAUE_NULL\n#define\tAUE_FSTAT64\t\tAUE_NULL\n#define\tAUE_FSTAT64_EXTENDED\tAUE_NULL\n#define\tAUE_GCCONTROL\t\tAUE_NULL\n#define\tAUE_GETDIRENTRIES64\tAUE_NULL\n#define\tAUE_GETDTABLESIZE\tAUE_NULL\n#define\tAUE_GETEGID\t\tAUE_NULL\n#define\tAUE_GETEUID\t\tAUE_NULL\n#define\tAUE_GETFSSTAT64\t\tAUE_NULL\n#define\tAUE_GETGID\t\tAUE_NULL\n#define\tAUE_GETGROUPS\t\tAUE_NULL\n#define\tAUE_GETITIMER\t\tAUE_NULL\n#define\tAUE_GETLOGIN\t\tAUE_NULL\n#define\tAUE_GETPEERNAME\t\tAUE_NULL\n#define\tAUE_GETPGID\t\tAUE_NULL\n#define\tAUE_GETPGRP\t\tAUE_NULL\n#define\tAUE_GETPID\t\tAUE_NULL\n#define\tAUE_GETPPID\t\tAUE_NULL\n#define\tAUE_GETPRIORITY\t\tAUE_NULL\n#define\tAUE_GETRLIMIT\t\tAUE_NULL\n#define\tAUE_GETRUSAGE\t\tAUE_NULL\n#define\tAUE_GETSGROUPS\t\tAUE_NULL\n#define\tAUE_GETSID\t\tAUE_NULL\n#define\tAUE_GETSOCKNAME\t\tAUE_NULL\n#define\tAUE_GETTIMEOFDAY\tAUE_NULL\n#define\tAUE_GETTID\t\tAUE_NULL\n#define\tAUE_GETUID\t\tAUE_NULL\n#define\tAUE_GETSOCKOPT\t\tAUE_NULL\n#define\tAUE_GETWGROUPS\t\tAUE_NULL\n#define\tAUE_GETXATTR\t\tAUE_NULL\n#define\tAUE_IDENTITYSVC\t\tAUE_NULL\n#define\tAUE_INITGROUPS\t\tAUE_NULL\n#define\tAUE_IOPOLICYSYS\t\tAUE_NULL\n#define\tAUE_ISSETUGID\t\tAUE_NULL\n#define\tAUE_LIOLISTIO\t\tAUE_NULL\n#define\tAUE_LISTXATTR\t\tAUE_NULL\n#define\tAUE_LSTATV\t\tAUE_NULL\n#define\tAUE_LSTAT64\t\tAUE_NULL\n#define\tAUE_LSTAT64_EXTENDED\tAUE_NULL\n#define\tAUE_MADVISE\t\tAUE_NULL\n#define\tAUE_MINCORE\t\tAUE_NULL\n#define\tAUE_MKCOMPLEX\t\tAUE_NULL\n#define\tAUE_MODWATCH\t\tAUE_NULL\n#define\tAUE_MSGCL\t\tAUE_NULL\n#define\tAUE_MSYNC\t\tAUE_NULL\n#define\tAUE_PREADV\t\tAUE_NULL\n#define\tAUE_PROCINFO\t\tAUE_NULL\n#define\tAUE_PTHREADCANCELED\tAUE_NULL\n#define\tAUE_PTHREADCHDIR\tAUE_NULL\n#define\tAUE_PTHREADCONDBROADCAST\tAUE_NULL\n#define\tAUE_PTHREADCONDDESTORY\tAUE_NULL\n#define\tAUE_PTHREADCONDINIT\tAUE_NULL\n#define\tAUE_PTHREADCONDSIGNAL\tAUE_NULL\n#define\tAUE_PTHREADCONDWAIT\tAUE_NULL\n#define\tAUE_PTHREADFCHDIR\tAUE_NULL\n#define\tAUE_PTHREADMARK\t\tAUE_NULL\n#define\tAUE_PTHREADMUTEXDESTROY\tAUE_NULL\n#define\tAUE_PTHREADMUTEXINIT\tAUE_NULL\n#define\tAUE_PTHREADMUTEXTRYLOCK\tAUE_NULL\n#define\tAUE_PTHREADMUTEXUNLOCK\tAUE_NULL\n#define\tAUE_PWRITEV\t\tAUE_NULL\n#define\tAUE_REMOVEXATTR\t\tAUE_NULL\n#define\tAUE_SBRK\t\tAUE_NULL\n#define\tAUE_SELECT\t\tAUE_NULL\n#define\tAUE_SEMDESTROY\t\tAUE_NULL\n#define\tAUE_SEMGETVALUE\t\tAUE_NULL\n#define\tAUE_SEMINIT\t\tAUE_NULL\n#define\tAUE_SEMPOST\t\tAUE_NULL\n#define\tAUE_SEMTRYWAIT\t\tAUE_NULL\n#define\tAUE_SEMWAIT\t\tAUE_NULL\n#define\tAUE_SEMWAITSIGNAL\tAUE_NULL\n#define\tAUE_SETITIMER\t\tAUE_NULL\n#define\tAUE_SETSGROUPS\t\tAUE_NULL\n#define\tAUE_SETTID\t\tAUE_NULL\n#define\tAUE_SETTIDWITHPID\tAUE_NULL\n#define\tAUE_SETWGROUPS\t\tAUE_NULL\n#define\tAUE_SETXATTR\t\tAUE_NULL\n#define\tAUE_SHAREDREGIONCHECK\tAUE_NULL\n#define\tAUE_SHAREDREGIONMAP\tAUE_NULL\n#define\tAUE_SIGACTION\t\tAUE_NULL\n#define\tAUE_SIGALTSTACK\t\tAUE_NULL\n#define\tAUE_SIGPENDING\t\tAUE_NULL\n#define\tAUE_SIGPROCMASK\t\tAUE_NULL\n#define\tAUE_SIGRETURN\t\tAUE_NULL\n#define\tAUE_SIGSUSPEND\t\tAUE_NULL\n#define\tAUE_SIGWAIT\t\tAUE_NULL\n#define\tAUE_SSTK\t\tAUE_NULL\n#define\tAUE_STACKSNAPSHOT\tAUE_NULL\n#define\tAUE_STATFS64\t\tAUE_NULL\n#define\tAUE_STATV\t\tAUE_NULL\n#define\tAUE_STAT64\t\tAUE_NULL\n#define\tAUE_STAT64_EXTENDED\tAUE_NULL\n#define\tAUE_SYNC\t\tAUE_NULL\n#define\tAUE_SYSCALL\t\tAUE_NULL\n#define\tAUE_TABLE\t\tAUE_NULL\n#define\tAUE_VMPRESSUREMONITOR\tAUE_NULL\n#define\tAUE_WAITEVENT\t\tAUE_NULL\n#define\tAUE_WAITID\t\tAUE_NULL\n#define\tAUE_WATCHEVENT\t\tAUE_NULL\n#define\tAUE_WORKQOPEN\t\tAUE_NULL\n#define\tAUE_WORKQOPS\t\tAUE_NULL\n\n#endif /* !_BSM_AUDIT_KEVENTS_H_ */\n"
  },
  {
    "path": "freebsd-headers/bsm/audit_record.h",
    "content": "/*-\n * Copyright (c) 2005-2009 Apple Inc.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n *\n * 1.  Redistributions of source code must retain the above copyright\n *     notice, this list of conditions and the following disclaimer.\n * 2.  Redistributions in binary form must reproduce the above copyright\n *     notice, this list of conditions and the following disclaimer in the\n *     documentation and/or other materials provided with the distribution.\n * 3.  Neither the name of Apple Inc. (\"Apple\") nor the names of\n *     its contributors may be used to endorse or promote products derived\n *     from this software without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS \"AS IS\" AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\n * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY\n * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\n * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\n * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF\n * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n *\n * P4: //depot/projects/trustedbsd/openbsm/sys/bsm/audit_record.h#10\n * $FreeBSD: release/9.0.0/sys/bsm/audit_record.h 191270 2009-04-19 14:53:17Z rwatson $\n */\n\n#ifndef _BSM_AUDIT_RECORD_H_\n#define _BSM_AUDIT_RECORD_H_\n\n#include <sys/time.h>\t\t\t/* struct timeval */\n\n/*\n * Token type identifiers.\n */\n#define\tAUT_INVALID\t\t0x00\n#define\tAUT_OTHER_FILE32\t0x11\n#define\tAUT_OHEADER\t\t0x12\n#define\tAUT_TRAILER\t\t0x13\n#define\tAUT_HEADER32\t\t0x14\n#define\tAUT_HEADER32_EX\t\t0x15\n#define\tAUT_DATA\t\t0x21\n#define\tAUT_IPC\t\t\t0x22\n#define\tAUT_PATH\t\t0x23\n#define\tAUT_SUBJECT32\t\t0x24\n#define\tAUT_XATPATH\t\t0x25\n#define\tAUT_PROCESS32\t\t0x26\n#define\tAUT_RETURN32\t\t0x27\n#define\tAUT_TEXT\t\t0x28\n#define\tAUT_OPAQUE\t\t0x29\n#define\tAUT_IN_ADDR\t\t0x2a\n#define\tAUT_IP\t\t\t0x2b\n#define\tAUT_IPORT\t\t0x2c\n#define\tAUT_ARG32\t\t0x2d\n#define\tAUT_SOCKET\t\t0x2e\n#define\tAUT_SEQ\t\t\t0x2f\n#define\tAUT_ACL\t\t\t0x30\n#define\tAUT_ATTR\t\t0x31\n#define\tAUT_IPC_PERM\t\t0x32\n#define\tAUT_LABEL\t\t0x33\n#define\tAUT_GROUPS\t\t0x34\n#define\tAUT_ACE\t\t\t0x35\n#define\tAUT_PRIV\t\t0x38\n#define\tAUT_UPRIV\t\t0x39\n#define\tAUT_LIAISON\t\t0x3a\n#define\tAUT_NEWGROUPS\t\t0x3b\n#define\tAUT_EXEC_ARGS\t\t0x3c\n#define\tAUT_EXEC_ENV\t\t0x3d\n#define\tAUT_ATTR32\t\t0x3e\n#define\tAUT_UNAUTH\t\t0x3f\n#define\tAUT_XATOM\t\t0x40\n#define\tAUT_XOBJ\t\t0x41\n#define\tAUT_XPROTO\t\t0x42\n#define\tAUT_XSELECT\t\t0x43\n#define\tAUT_XCOLORMAP\t\t0x44\n#define\tAUT_XCURSOR\t\t0x45\n#define\tAUT_XFONT\t\t0x46\n#define\tAUT_XGC\t\t\t0x47\n#define\tAUT_XPIXMAP\t\t0x48\n#define\tAUT_XPROPERTY\t\t0x49\n#define\tAUT_XWINDOW\t\t0x4a\n#define\tAUT_XCLIENT\t\t0x4b\n#define\tAUT_CMD\t\t\t0x51\n#define\tAUT_EXIT\t\t0x52\n#define\tAUT_ZONENAME\t\t0x60\n#define\tAUT_HOST\t\t0x70\n#define\tAUT_ARG64\t\t0x71\n#define\tAUT_RETURN64\t\t0x72\n#define\tAUT_ATTR64\t\t0x73\n#define\tAUT_HEADER64\t\t0x74\n#define\tAUT_SUBJECT64\t\t0x75\n#define\tAUT_PROCESS64\t\t0x77\n#define\tAUT_OTHER_FILE64\t0x78\n#define\tAUT_HEADER64_EX\t\t0x79\n#define\tAUT_SUBJECT32_EX\t0x7a\n#define\tAUT_PROCESS32_EX\t0x7b\n#define\tAUT_SUBJECT64_EX\t0x7c\n#define\tAUT_PROCESS64_EX\t0x7d\n#define\tAUT_IN_ADDR_EX\t\t0x7e\n#define\tAUT_SOCKET_EX\t\t0x7f\n\n/*\n * Pre-64-bit BSM, 32-bit tokens weren't explicitly named as '32'.  We have\n * compatibility defines.\n */\n#define\tAUT_HEADER\t\tAUT_HEADER32\n#define\tAUT_ARG\t\t\tAUT_ARG32\n#define\tAUT_RETURN\t\tAUT_RETURN32\n#define\tAUT_SUBJECT\t\tAUT_SUBJECT32\n#define\tAUT_PROCESS\t\tAUT_PROCESS32\n#define\tAUT_OTHER_FILE\t\tAUT_OTHER_FILE32\n\n/*\n * The values for the following token ids are not defined by BSM.\n *\n * XXXRW: Not sure how to handle these in OpenBSM yet, but I'll give them\n * names more consistent with Sun's BSM.  These originally came from Apple's\n * BSM.\n */\n#define\tAUT_SOCKINET32\t\t0x80\t\t/* XXX */\n#define\tAUT_SOCKINET128\t\t0x81\t\t/* XXX */\n#define\tAUT_SOCKUNIX\t\t0x82\t\t/* XXX */\n\n/* print values for the arbitrary token */\n#define AUP_BINARY      0\n#define AUP_OCTAL       1\n#define AUP_DECIMAL     2\n#define AUP_HEX         3\n#define AUP_STRING      4\n\n/* data-types for the arbitrary token */\n#define AUR_BYTE        0\n#define AUR_CHAR        AUR_BYTE\n#define AUR_SHORT       1\n#define AUR_INT32       2\n#define AUR_INT         AUR_INT32\n#define AUR_INT64       3\n\n/* ... and their sizes */\n#define AUR_BYTE_SIZE       sizeof(u_char)\n#define AUR_CHAR_SIZE       AUR_BYTE_SIZE\n#define AUR_SHORT_SIZE      sizeof(uint16_t)\n#define AUR_INT32_SIZE      sizeof(uint32_t)\n#define AUR_INT_SIZE        AUR_INT32_SIZE\n#define AUR_INT64_SIZE      sizeof(uint64_t)\n\n/* Modifiers for the header token */\n#define PAD_NOTATTR  0x4000   /* nonattributable event */\n#define PAD_FAILURE  0x8000   /* fail audit event */\n\n#define AUDIT_MAX_GROUPS      16\n\n/*\n * A number of BSM versions are floating around and defined.  Here are\n * constants for them.  OpenBSM uses the same token types, etc, used in the\n * Solaris BSM version, but has a separate version number in order to\n * identify a potentially different event identifier name space.\n */\n#define\tAUDIT_HEADER_VERSION_OLDDARWIN\t1\t/* In retrospect, a mistake. */\n#define\tAUDIT_HEADER_VERSION_SOLARIS\t2\n#define\tAUDIT_HEADER_VERSION_TSOL25\t3\n#define\tAUDIT_HEADER_VERSION_TSOL\t4\n#define\tAUDIT_HEADER_VERSION_OPENBSM10\t10\n#define\tAUDIT_HEADER_VERSION_OPENBSM11\t11\n#define\tAUDIT_HEADER_VERSION_OPENBSM\tAUDIT_HEADER_VERSION_OPENBSM11\n\n#define\tAUT_TRAILER_MAGIC\t0xb105\n\n/* BSM library calls */\n\n__BEGIN_DECLS\n\nstruct in_addr;\nstruct in6_addr;\nstruct ip;\nstruct ipc_perm;\nstruct kevent;\nstruct sockaddr;\nstruct sockaddr_in;\nstruct sockaddr_in6;\nstruct sockaddr_un;\n#if defined(_KERNEL) || defined(KERNEL)\nstruct vnode_au_info;\n#endif\n\nint\t au_open(void);\nint\t au_write(int d, token_t *m);\nint\t au_close(int d, int keep, short event);\nint\t au_close_buffer(int d, short event, u_char *buffer, size_t *buflen);\nint\t au_close_token(token_t *tok, u_char *buffer, size_t *buflen);\n\ntoken_t\t*au_to_file(const char *file, struct timeval tm);\n\ntoken_t\t*au_to_header32_tm(int rec_size, au_event_t e_type, au_emod_t e_mod,\n\t    struct timeval tm);\ntoken_t\t*au_to_header32_ex_tm(int rec_size, au_event_t e_type, au_emod_t e_mod,\n\t    struct timeval tm, struct auditinfo_addr *aia);\ntoken_t\t*au_to_header64_tm(int rec_size, au_event_t e_type, au_emod_t e_mod,\n\t    struct timeval tm);\n#if !defined(KERNEL) && !defined(_KERNEL)\ntoken_t\t*au_to_header(int rec_size, au_event_t e_type, au_emod_t e_mod);\ntoken_t\t*au_to_header_ex(int rec_size, au_event_t e_type, au_emod_t e_mod);\ntoken_t\t*au_to_header32(int rec_size, au_event_t e_type, au_emod_t e_mod);\ntoken_t\t*au_to_header64(int rec_size, au_event_t e_type, au_emod_t e_mod);\ntoken_t\t*au_to_header32_ex(int rec_size, au_event_t e_type, au_emod_t e_mod);\n#endif\n\ntoken_t\t*au_to_me(void);\ntoken_t\t*au_to_arg(char n, const char *text, uint32_t v);\ntoken_t\t*au_to_arg32(char n, const char *text, uint32_t v);\ntoken_t\t*au_to_arg64(char n, const char *text, uint64_t v);\n\n#if defined(_KERNEL) || defined(KERNEL)\ntoken_t\t*au_to_attr(struct vnode_au_info *vni);\ntoken_t\t*au_to_attr32(struct vnode_au_info *vni);\ntoken_t\t*au_to_attr64(struct vnode_au_info *vni);\n#endif\n\ntoken_t\t*au_to_data(char unit_print, char unit_type, char unit_count,\n\t    const char *p);\ntoken_t\t*au_to_exit(int retval, int err);\ntoken_t\t*au_to_groups(int *groups);\ntoken_t\t*au_to_newgroups(uint16_t n, gid_t *groups);\ntoken_t\t*au_to_in_addr(struct in_addr *internet_addr);\ntoken_t\t*au_to_in_addr_ex(struct in6_addr *internet_addr);\ntoken_t\t*au_to_ip(struct ip *ip);\ntoken_t\t*au_to_ipc(char type, int id);\ntoken_t\t*au_to_ipc_perm(struct ipc_perm *perm);\ntoken_t\t*au_to_iport(uint16_t iport);\ntoken_t\t*au_to_opaque(const char *data, uint16_t bytes);\ntoken_t\t*au_to_path(const char *path);\ntoken_t\t*au_to_process(au_id_t auid, uid_t euid, gid_t egid, uid_t ruid,\n\t    gid_t rgid, pid_t pid, au_asid_t sid, au_tid_t *tid);\ntoken_t\t*au_to_process32(au_id_t auid, uid_t euid, gid_t egid, uid_t ruid,\n\t    gid_t rgid, pid_t pid, au_asid_t sid, au_tid_t *tid);\ntoken_t\t*au_to_process64(au_id_t auid, uid_t euid, gid_t egid, uid_t ruid,\n\t    gid_t rgid, pid_t pid, au_asid_t sid, au_tid_t *tid);\ntoken_t\t*au_to_process_ex(au_id_t auid, uid_t euid, gid_t egid, uid_t ruid,\n\t    gid_t rgid, pid_t pid, au_asid_t sid, au_tid_addr_t *tid);\ntoken_t\t*au_to_process32_ex(au_id_t auid, uid_t euid, gid_t egid,\n\t    uid_t ruid, gid_t rgid, pid_t pid, au_asid_t sid,\n\t    au_tid_addr_t *tid);\ntoken_t\t*au_to_process64_ex(au_id_t auid, uid_t euid, gid_t egid, uid_t ruid,\n\t    gid_t rgid, pid_t pid, au_asid_t sid, au_tid_addr_t *tid);\ntoken_t\t*au_to_return(char status, uint32_t ret);\ntoken_t\t*au_to_return32(char status, uint32_t ret);\ntoken_t\t*au_to_return64(char status, uint64_t ret);\ntoken_t\t*au_to_seq(long audit_count);\ntoken_t\t*au_to_socket_ex(u_short so_domain, u_short so_type,\n\t    struct sockaddr *sa_local, struct sockaddr *sa_remote);\ntoken_t\t*au_to_sock_inet(struct sockaddr_in *so);\ntoken_t\t*au_to_sock_inet32(struct sockaddr_in *so);\ntoken_t\t*au_to_sock_inet128(struct sockaddr_in6 *so);\ntoken_t\t*au_to_sock_unix(struct sockaddr_un *so);\ntoken_t\t*au_to_subject(au_id_t auid, uid_t euid, gid_t egid, uid_t ruid,\n\t    gid_t rgid, pid_t pid, au_asid_t sid, au_tid_t *tid);\ntoken_t\t*au_to_subject32(au_id_t auid, uid_t euid, gid_t egid, uid_t ruid,\n\t    gid_t rgid, pid_t pid, au_asid_t sid, au_tid_t *tid);\ntoken_t\t*au_to_subject64(au_id_t auid, uid_t euid, gid_t egid, uid_t ruid,\n\t    gid_t rgid, pid_t pid, au_asid_t sid, au_tid_t *tid);\ntoken_t\t*au_to_subject_ex(au_id_t auid, uid_t euid, gid_t egid, uid_t ruid,\n\t    gid_t rgid, pid_t pid, au_asid_t sid, au_tid_addr_t *tid);\ntoken_t\t*au_to_subject32_ex(au_id_t auid, uid_t euid, gid_t egid, uid_t ruid,\n\t    gid_t rgid, pid_t pid, au_asid_t sid, au_tid_addr_t *tid);\ntoken_t\t*au_to_subject64_ex(au_id_t auid, uid_t euid, gid_t egid, uid_t ruid,\n\t    gid_t rgid, pid_t pid, au_asid_t sid, au_tid_addr_t *tid);\n#if defined(_KERNEL) || defined(KERNEL)\ntoken_t\t*au_to_exec_args(char *args, int argc);\ntoken_t\t*au_to_exec_env(char *envs, int envc);\n#else\ntoken_t\t*au_to_exec_args(char **argv);\ntoken_t\t*au_to_exec_env(char **envp);\n#endif\ntoken_t\t*au_to_text(const char *text);\ntoken_t\t*au_to_kevent(struct kevent *kev);\ntoken_t\t*au_to_trailer(int rec_size);\ntoken_t\t*au_to_zonename(const char *zonename);\n\n/*\n * BSM library routines for converting between local and BSM constant spaces.\n */\nint\t au_bsm_to_domain(u_short bsm_domain, int *local_domainp);\nint\t au_bsm_to_errno(u_char bsm_error, int *errorp);\nint\t au_bsm_to_fcntl_cmd(u_short bsm_fcntl_cmd, int *local_fcntl_cmdp);\nint\t au_bsm_to_socket_type(u_short bsm_socket_type,\n\t    int *local_socket_typep);\nu_short\t au_domain_to_bsm(int local_domain);\nu_char\t au_errno_to_bsm(int local_errno);\nu_short\t au_fcntl_cmd_to_bsm(int local_fcntl_command);\nu_short\t au_socket_type_to_bsm(int local_socket_type);\n\n__END_DECLS\n\n#endif /* ! _BSM_AUDIT_RECORD_H_ */\n"
  },
  {
    "path": "freebsd-headers/bsm/audit_socket_type.h",
    "content": "/*-\n * Copyright (c) 2008 Apple Inc.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1.  Redistributions of source code must retain the above copyright\n *     notice, this list of conditions and the following disclaimer.\n * 2.  Redistributions in binary form must reproduce the above copyright\n *     notice, this list of conditions and the following disclaimer in the\n *     documentation and/or other materials provided with the distribution.\n * 3.  Neither the name of Apple Inc. (\"Apple\") nor the names of\n *     its contributors may be used to endorse or promote products derived\n *     from this software without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS \"AS IS\" AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR\n * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,\n * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING\n * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE. \n *\n * P4: //depot/projects/trustedbsd/openbsm/sys/bsm/audit_socket_type.h#1\n * $FreeBSD: release/9.0.0/sys/bsm/audit_socket_type.h 187214 2009-01-14 10:44:16Z rwatson $\n */\n\n#ifndef _BSM_AUDIT_SOCKET_TYPE_H_\n#define\t_BSM_AUDIT_SOCKET_TYPE_H_\n\n/*\n * BSM socket type constants.\n */\n#define\tBSM_SOCK_DGRAM\t\t1\n#define\tBSM_SOCK_STREAM\t\t2\n#define\tBSM_SOCK_RAW\t\t4\n#define\tBSM_SOCK_RDM\t\t5\n#define\tBSM_SOCK_SEQPACKET\t6\n\n#define\tBSM_SOCK_UNKNOWN\t500\n\n#endif /* !_BSM_AUDIT_SOCKET_TYPE_H_ */\n"
  },
  {
    "path": "freebsd-headers/bsm/audit_uevents.h",
    "content": "/*-\n * Copyright (c) 2004-2008 Apple Inc.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1.  Redistributions of source code must retain the above copyright\n *     notice, this list of conditions and the following disclaimer.\n * 2.  Redistributions in binary form must reproduce the above copyright\n *     notice, this list of conditions and the following disclaimer in the\n *     documentation and/or other materials provided with the distribution.\n * 3.  Neither the name of Apple Inc. (\"Apple\") nor the names of\n *     its contributors may be used to endorse or promote products derived\n *     from this software without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS \"AS IS\" AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR\n * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,\n * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING\n * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n *\n * $P4: //depot/projects/trustedbsd/openbsm/bsm/audit_uevents.h#11 $\n */\n\n#ifndef _BSM_AUDIT_UEVENTS_H_\n#define\t_BSM_AUDIT_UEVENTS_H_\n\n/*\n * Solaris userspace events.\n */\n#define\tAUE_at_create\t\t6144\n#define\tAUE_at_delete\t\t6145\n#define\tAUE_at_perm\t\t6146\n#define\tAUE_cron_invoke\t\t6147\n#define\tAUE_crontab_create\t6148\n#define\tAUE_crontab_delete\t6149\n#define\tAUE_crontab_perm\t6150\n#define\tAUE_inetd_connect\t6151\n#define\tAUE_login\t\t6152\n#define\tAUE_logout\t\t6153\n#define\tAUE_telnet\t\t6154\n#define\tAUE_rlogin\t\t6155\n#define\tAUE_mountd_mount\t6156\n#define\tAUE_mountd_umount\t6157\n#define\tAUE_rshd\t\t6158\n#define\tAUE_su\t\t\t6159\n#define\tAUE_halt\t\t6160\n#define\tAUE_reboot\t\t6161\n#define\tAUE_rexecd\t\t6162\n#define\tAUE_passwd\t\t6163\n#define\tAUE_rexd\t\t6164\n#define\tAUE_ftpd\t\t6165\n#define\tAUE_init\t\t6166\n#define\tAUE_uadmin\t\t6167\n#define\tAUE_shutdown\t\t6168\n#define\tAUE_poweroff\t\t6169\n#define\tAUE_crontab_mod\t\t6170\n#define\tAUE_ftpd_logout\t\t6171\n#define\tAUE_ssh\t\t\t6172\n#define\tAUE_role_login\t\t6173\n#define\tAUE_prof_cmd\t\t6180\n#define\tAUE_filesystem_add\t6181\n#define\tAUE_filesystem_delete\t6182\n#define\tAUE_filesystem_modify\t6183\n#define\tAUE_allocate_succ\t6200\n#define\tAUE_allocate_fail\t6201\n#define\tAUE_deallocate_succ\t6202\n#define\tAUE_deallocate_fail\t6203\n#define\tAUE_listdevice_succ\t6205\n#define\tAUE_listdevice_fail\t6206\n#define\tAUE_create_user\t\t6207\n#define\tAUE_modify_user\t\t6208\n#define\tAUE_delete_user\t\t6209\n#define\tAUE_disable_user\t6210\n#define\tAUE_enable_user\t\t6211\n#define\tAUE_newgrp_login\t6212\n#define\tAUE_admin_authentication\t6213\n#define\tAUE_kadmind_auth\t6214\n#define\tAUE_kadmind_unauth\t6215\n#define\tAUE_krb5kdc_as_req\t6216\n#define\tAUE_krb5kdc_tgs_req\t6217\n#define\tAUE_krb5kdc_tgs_req_2ndtktmm\t6218\n#define\tAUE_krb5kdc_tgs_req_alt_tgt\t6219\n\n/*\n * Historic Darwin use of the low event numbering space, which collided with\n * the Solaris event space.  Now obsoleted and new, higher, event numbers\n * assigned to make it easier to interpret Solaris events using the OpenBSM\n * tools.\n */\n#define\tAUE_DARWIN_audit_startup\t6171\n#define\tAUE_DARWIN_audit_shutdown\t6172\n#define\tAUE_DARWIN_sudo\t\t\t6300\n#define\tAUE_DARWIN_modify_password\t6501\n#define\tAUE_DARWIN_create_group\t\t6511\n#define\tAUE_DARWIN_delete_group\t\t6512\n#define\tAUE_DARWIN_modify_group\t\t6513\n#define\tAUE_DARWIN_add_to_group\t\t6514\n#define\tAUE_DARWIN_remove_from_group\t6515\n#define\tAUE_DARWIN_revoke_obj\t\t6521\n#define\tAUE_DARWIN_lw_login\t\t6600\n#define\tAUE_DARWIN_lw_logout\t\t6601\n#define\tAUE_DARWIN_auth_user\t\t7000\n#define\tAUE_DARWIN_ssconn\t\t7001\n#define\tAUE_DARWIN_ssauthorize\t\t7002\n#define\tAUE_DARWIN_ssauthint\t\t7003\n\n/*\n * Historic/third-party appliation allocations of event idenfiers.\n */\n#define\tAUE_openssh\t\t32800\n\n/*\n * OpenBSM-managed application event space.\n */\n#define\tAUE_audit_startup\t45000\t\t/* Darwin-specific. */\n#define\tAUE_audit_shutdown\t45001\t\t/* Darwin-specific. */\n#define\tAUE_modify_password\t45014\t\t/* Darwin-specific. */\n#define\tAUE_create_group\t45015\t\t/* Darwin-specific. */\n#define\tAUE_delete_group\t45016\t\t/* Darwin-specific. */\n#define\tAUE_modify_group\t45017\t\t/* Darwin-specific. */\n#define\tAUE_add_to_group\t45018\t\t/* Darwin-specific. */\n#define\tAUE_remove_from_group\t45019\t\t/* Darwin-specific. */\n#define\tAUE_revoke_obj\t\t45020\t\t/* Darwin-specific. */\n#define\tAUE_lw_login\t\t45021\t\t/* Darwin-specific. */\n#define\tAUE_lw_logout\t\t45022\t\t/* Darwin-specific. */\n#define\tAUE_auth_user\t\t45023\t\t/* Darwin-specific. */\n#define\tAUE_ssconn\t\t45024\t\t/* Darwin-specific. */\n#define\tAUE_ssauthorize\t\t45025\t\t/* Darwin-specific. */\n#define\tAUE_ssauthint\t\t45026\t\t/* Darwin-specific. */\n#define\tAUE_calife\t\t45027\t\t/* OpenBSM-allocated. */\n#define\tAUE_sudo\t\t45028\t\t/* OpenBSM-allocated. */\n#define\tAUE_audit_recovery\t45029\t\t/* OpenBSM-allocated. */\n#define\tAUE_ssauthmech\t\t45030\t\t/* Darwin-specific. */\n\n#endif /* !_BSM_AUDIT_UEVENTS_H_ */\n"
  },
  {
    "path": "freebsd-headers/bsm/libbsm.h",
    "content": "/*-\n * Copyright (c) 2004-2009 Apple Inc.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1.  Redistributions of source code must retain the above copyright\n *     notice, this list of conditions and the following disclaimer.\n * 2.  Redistributions in binary form must reproduce the above copyright\n *     notice, this list of conditions and the following disclaimer in the\n *     documentation and/or other materials provided with the distribution.\n * 3.  Neither the name of Apple Inc. (\"Apple\") nor the names of\n *     its contributors may be used to endorse or promote products derived\n *     from this software without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS \"AS IS\" AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR\n * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,\n * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING\n * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n *\n * $P4: //depot/projects/trustedbsd/openbsm/bsm/libbsm.h#45 $\n */\n\n#ifndef _LIBBSM_H_\n#define\t_LIBBSM_H_\n\n/*\n * NB: definitions, etc., marked with \"OpenSSH compatibility\" were introduced\n * solely to allow OpenSSH to compile; Darwin/Apple code should not use them.\n */\n\n#include <sys/types.h>\n#include <sys/cdefs.h>\n\n#include <inttypes.h>\t\t/* Required for audit.h. */\n#include <time.h>\t\t/* Required for clock_t on Linux. */\n\n#include <bsm/audit.h>\n#include <bsm/audit_record.h>\n\n#include <stdio.h>\n\n#ifdef __APPLE__\n#include <mach/mach.h>\t\t/* audit_token_t */\n#endif\n\n/*\n * Size parsed token vectors for execve(2) arguments and environmental\n * variables.  Note: changing these sizes affects the ABI of the token\n * structure, and as the token structure is often placed in the caller stack,\n * this is undesirable.\n */\n#define\tAUDIT_MAX_ARGS\t128\n#define\tAUDIT_MAX_ENV\t128\n\n/*\n * Arguments to au_preselect(3).\n */\n#define\tAU_PRS_USECACHE\t0\n#define\tAU_PRS_REREAD\t1\n\n#define\tAU_PRS_SUCCESS\t1\n#define\tAU_PRS_FAILURE\t2\n#define\tAU_PRS_BOTH\t(AU_PRS_SUCCESS|AU_PRS_FAILURE)\n\n#define\tAUDIT_EVENT_FILE\t\"/etc/security/audit_event\"\n#define\tAUDIT_CLASS_FILE\t\"/etc/security/audit_class\"\n#define\tAUDIT_CONTROL_FILE\t\"/etc/security/audit_control\"\n#define\tAUDIT_USER_FILE\t\t\"/etc/security/audit_user\"\n\n#define\tDIR_CONTROL_ENTRY\t\t\"dir\"\n#define\tMINFREE_CONTROL_ENTRY\t\t\"minfree\"\n#define\tFILESZ_CONTROL_ENTRY\t\t\"filesz\"\n#define\tFLAGS_CONTROL_ENTRY\t\t\"flags\"\n#define\tNA_CONTROL_ENTRY\t\t\"naflags\"\n#define\tPOLICY_CONTROL_ENTRY\t\t\"policy\"\n#define\tAUDIT_HOST_CONTROL_ENTRY\t\"host\"\n#define\tEXPIRE_AFTER_CONTROL_ENTRY\t\"expire-after\"\n\n#define\tAU_CLASS_NAME_MAX\t8\n#define\tAU_CLASS_DESC_MAX\t72\n#define\tAU_EVENT_NAME_MAX\t30\n#define\tAU_EVENT_DESC_MAX\t50\n#define\tAU_USER_NAME_MAX\t50\n#define\tAU_LINE_MAX\t\t256\n#define\tMAX_AUDITSTRING_LEN\t256\n#define\tBSM_TEXTBUFSZ\t\tMAX_AUDITSTRING_LEN\t/* OpenSSH compatibility */\n\n/*\n * Arguments to au_close(3).\n */\n#define\tAU_TO_NO_WRITE\t\t0\t/* Abandon audit record. */\n#define\tAU_TO_WRITE\t\t1\t/* Commit audit record. */\n\n__BEGIN_DECLS\nstruct au_event_ent {\n\tau_event_t\t ae_number;\n\tchar\t\t*ae_name;\n\tchar\t\t*ae_desc;\n\tau_class_t\t ae_class;\n};\ntypedef struct au_event_ent au_event_ent_t;\n\nstruct au_class_ent {\n\tchar\t\t*ac_name;\n\tau_class_t\t ac_class;\n\tchar\t\t*ac_desc;\n};\ntypedef struct au_class_ent au_class_ent_t;\n\nstruct au_user_ent {\n\tchar\t\t*au_name;\n\tau_mask_t\t au_always;\n\tau_mask_t\t au_never;\n};\ntypedef struct au_user_ent au_user_ent_t;\n__END_DECLS\n\n#define\tADD_TO_MASK(m, c, sel) do {\t\t\t\t\t\\\n\tif (sel & AU_PRS_SUCCESS)\t\t\t\t\t\\\n\t\t(m)->am_success |= c;\t\t\t\t\t\\\n\tif (sel & AU_PRS_FAILURE)\t\t\t\t\t\\\n\t\t(m)->am_failure |= c;\t\t\t\t\t\\\n} while (0)\n\n#define\tSUB_FROM_MASK(m, c, sel) do {\t\t\t\t\t\\\n\tif (sel & AU_PRS_SUCCESS)\t\t\t\t\t\\\n\t\t(m)->am_success &= ((m)->am_success ^ c);\t\t\\\n\tif (sel & AU_PRS_FAILURE)\t\t\t\t\t\\\n\t\t(m)->am_failure &= ((m)->am_failure ^ c);\t\t\\\n} while (0)\n\n#define\tADDMASK(m, v) do {\t\t\t\t\t\t\\\n\t(m)->am_success |= (v)->am_success;\t\t\t\t\\\n\t(m)->am_failure |= (v)->am_failure;\t\t\t\t\\\n} while(0)\n\n#define\tSUBMASK(m, v) do {\t\t\t\t\t\t\\\n\t(m)->am_success &= ((m)->am_success ^ (v)->am_success);\t\t\\\n\t(m)->am_failure &= ((m)->am_failure ^ (v)->am_failure);\t\t\\\n} while(0)\n\n__BEGIN_DECLS\n\ntypedef struct au_tid32 {\n\tu_int32_t\tport;\n\tu_int32_t\taddr;\n} au_tid32_t;\n\ntypedef struct au_tid64 {\n\tu_int64_t\tport;\n\tu_int32_t\taddr;\n} au_tid64_t;\n\ntypedef struct au_tidaddr32 {\n\tu_int32_t\tport;\n\tu_int32_t\ttype;\n\tu_int32_t\taddr[4];\n} au_tidaddr32_t;\n\ntypedef struct au_tidaddr64 {\n\tu_int64_t\tport;\n\tu_int32_t\ttype;\n\tu_int32_t\taddr[4];\n} au_tidaddr64_t;\n\n/*\n * argument #              1 byte\n * argument value          4 bytes/8 bytes (32-bit/64-bit value)\n * text length             2 bytes\n * text                    N bytes + 1 terminating NULL byte\n */\ntypedef struct {\n\tu_char\t\t no;\n\tu_int32_t\t val;\n\tu_int16_t\t len;\n\tchar\t\t*text;\n} au_arg32_t;\n\ntypedef struct {\n\tu_char\t\t no;\n\tu_int64_t\t val;\n\tu_int16_t\t len;\n\tchar\t\t*text;\n} au_arg64_t;\n\n/*\n * how to print            1 byte\n * basic unit              1 byte\n * unit count              1 byte\n * data items              (depends on basic unit)\n */\ntypedef struct {\n\tu_char\t howtopr;\n\tu_char\t bu;\n\tu_char\t uc;\n\tu_char\t*data;\n} au_arb_t;\n\n/*\n * file access mode        4 bytes\n * owner user ID           4 bytes\n * owner group ID          4 bytes\n * file system ID          4 bytes\n * node ID                 8 bytes\n * device                  4 bytes/8 bytes (32-bit/64-bit)\n */\ntypedef struct {\n\tu_int32_t\tmode;\n   \tu_int32_t\tuid;\n\tu_int32_t\tgid;\n\tu_int32_t\tfsid;\n\tu_int64_t\tnid;\n\tu_int32_t\tdev;\n} au_attr32_t;\n\ntypedef struct {\n\tu_int32_t\tmode;\n   \tu_int32_t\tuid;\n\tu_int32_t\tgid;\n\tu_int32_t\tfsid;\n\tu_int64_t\tnid;\n\tu_int64_t\tdev;\n} au_attr64_t;\n\n/*\n * count                   4 bytes\n * text                    count null-terminated string(s)\n */\ntypedef struct {\n\tu_int32_t\t count;\n\tchar\t\t*text[AUDIT_MAX_ARGS];\n} au_execarg_t;\n\n/*\n * count                   4 bytes\n * text                    count null-terminated string(s)\n */\ntypedef struct {\n\tu_int32_t\t count;\n\tchar\t\t*text[AUDIT_MAX_ENV];\n} au_execenv_t;\n\n/*\n * status                  4 bytes\n * return value            4 bytes\n */\ntypedef struct {\n\tu_int32_t\tstatus;\n\tu_int32_t\tret;\n} au_exit_t;\n\n/*\n * seconds of time         4 bytes\n * milliseconds of time    4 bytes\n * file name length        2 bytes\n * file pathname           N bytes + 1 terminating NULL byte\n */\ntypedef struct {\n\tu_int32_t\t s;\n\tu_int32_t\t ms;\n\tu_int16_t\t len;\n\tchar\t\t*name;\n} au_file_t;\n\n\n/*\n * number groups           2 bytes\n * group list              N * 4 bytes\n */\ntypedef struct {\n\tu_int16_t\tno;\n\tu_int32_t\tlist[AUDIT_MAX_GROUPS];\n} au_groups_t;\n\n/*\n * record byte count       4 bytes\n * version #               1 byte    [2]\n * event type              2 bytes\n * event modifier          2 bytes\n * seconds of time         4 bytes/8 bytes (32-bit/64-bit value)\n * milliseconds of time    4 bytes/8 bytes (32-bit/64-bit value)\n */\ntypedef struct {\n\tu_int32_t\tsize;\n\tu_char\t\tversion;\n\tu_int16_t\te_type;\n\tu_int16_t\te_mod;\n\tu_int32_t\ts;\n\tu_int32_t\tms;\n} au_header32_t;\n\n/*\n * record byte count       4 bytes\n * version #               1 byte     [2]\n * event type              2 bytes\n * event modifier          2 bytes\n * address type/length     1 byte (XXX: actually, 4 bytes)\n * machine address         4 bytes/16 bytes (IPv4/IPv6 address)\n * seconds of time         4 bytes/8 bytes  (32/64-bits)\n * nanoseconds of time     4 bytes/8 bytes  (32/64-bits)\n */\ntypedef struct {\n\tu_int32_t\tsize;\n\tu_char\t\tversion;\n\tu_int16_t\te_type;\n\tu_int16_t\te_mod;\n\tu_int32_t\tad_type;\n\tu_int32_t\taddr[4];\n\tu_int32_t\ts;\n\tu_int32_t\tms;\n} au_header32_ex_t;\n\ntypedef struct {\n\tu_int32_t\tsize;\n\tu_char\t\tversion;\n\tu_int16_t\te_type;\n\tu_int16_t\te_mod;\n\tu_int64_t\ts;\n\tu_int64_t\tms;\n} au_header64_t;\n\ntypedef struct {\n\tu_int32_t\tsize;\n\tu_char\t\tversion;\n\tu_int16_t\te_type;\n\tu_int16_t\te_mod;\n\tu_int32_t\tad_type;\n\tu_int32_t\taddr[4];\n\tu_int64_t\ts;\n\tu_int64_t\tms;\n} au_header64_ex_t;\n\n/*\n * internet address        4 bytes\n */\ntypedef struct {\n\tu_int32_t\taddr;\n} au_inaddr_t;\n\n/*\n * type                 4 bytes\n * internet address     16 bytes\n */\ntypedef struct {\n\tu_int32_t\ttype;\n\tu_int32_t\taddr[4];\n} au_inaddr_ex_t;\n\n/*\n * version and ihl         1 byte\n * type of service         1 byte\n * length                  2 bytes\n * id                      2 bytes\n * offset                  2 bytes\n * ttl                     1 byte\n * protocol                1 byte\n * checksum                2 bytes\n * source address          4 bytes\n * destination address     4 bytes\n */\ntypedef struct {\n\tu_char\t\tversion;\n\tu_char\t\ttos;\n\tu_int16_t\tlen;\n\tu_int16_t\tid;\n\tu_int16_t\toffset;\n\tu_char\t\tttl;\n\tu_char\t\tprot;\n\tu_int16_t\tchksm;\n\tu_int32_t\tsrc;\n\tu_int32_t\tdest;\n} au_ip_t;\n\n/*\n * object ID type          1 byte\n * object ID               4 bytes\n */\ntypedef struct {\n\tu_char\t\ttype;\n\tu_int32_t\tid;\n} au_ipc_t;\n\n/*\n * owner user ID           4 bytes\n * owner group ID          4 bytes\n * creator user ID         4 bytes\n * creator group ID        4 bytes\n * access mode             4 bytes\n * slot sequence #         4 bytes\n * key                     4 bytes\n */\ntypedef struct {\n\tu_int32_t\tuid;\n\tu_int32_t\tgid;\n\tu_int32_t\tpuid;\n\tu_int32_t\tpgid;\n\tu_int32_t\tmode;\n\tu_int32_t\tseq;\n\tu_int32_t\tkey;\n} au_ipcperm_t;\n\n/*\n * port IP address         2 bytes\n */\ntypedef struct {\n\tu_int16_t\tport;\n} au_iport_t;\n\n/*\n * length\t\t2 bytes\n * data\t\t\tlength bytes\n */\ntypedef struct {\n\tu_int16_t\t size;\n\tchar\t\t*data;\n} au_opaque_t;\n\n/*\n * path length             2 bytes\n * path                    N bytes + 1 terminating NULL byte\n */\ntypedef struct {\n\tu_int16_t\t len;\n\tchar\t\t*path;\n} au_path_t;\n\n/*\n * audit ID                4 bytes\n * effective user ID       4 bytes\n * effective group ID      4 bytes\n * real user ID            4 bytes\n * real group ID           4 bytes\n * process ID              4 bytes\n * session ID              4 bytes\n * terminal ID\n * port ID               4 bytes/8 bytes (32-bit/64-bit value)\n * machine address       4 bytes\n */\ntypedef struct {\n\tu_int32_t\tauid;\n\tu_int32_t\teuid;\n\tu_int32_t\tegid;\n\tu_int32_t\truid;\n\tu_int32_t\trgid;\n\tu_int32_t\tpid;\n\tu_int32_t\tsid;\n\tau_tid32_t\ttid;\n} au_proc32_t;\n\ntypedef struct {\n\tu_int32_t\tauid;\n\tu_int32_t\teuid;\n\tu_int32_t\tegid;\n\tu_int32_t\truid;\n\tu_int32_t\trgid;\n\tu_int32_t\tpid;\n\tu_int32_t\tsid;\n\tau_tid64_t\ttid;\n} au_proc64_t;\n\n/*\n * audit ID                4 bytes\n * effective user ID       4 bytes\n * effective group ID      4 bytes\n * real user ID            4 bytes\n * real group ID           4 bytes\n * process ID              4 bytes\n * session ID              4 bytes\n * terminal ID\n * port ID               4 bytes/8 bytes (32-bit/64-bit value)\n * type                  4 bytes\n * machine address       16 bytes\n */\ntypedef struct {\n\tu_int32_t\tauid;\n\tu_int32_t\teuid;\n\tu_int32_t\tegid;\n\tu_int32_t\truid;\n\tu_int32_t\trgid;\n\tu_int32_t\tpid;\n\tu_int32_t\tsid;\n\tau_tidaddr32_t\ttid;\n} au_proc32ex_t;\n\ntypedef struct {\n\tu_int32_t\tauid;\n\tu_int32_t\teuid;\n\tu_int32_t\tegid;\n\tu_int32_t\truid;\n\tu_int32_t\trgid;\n\tu_int32_t\tpid;\n\tu_int32_t\tsid;\n\tau_tidaddr64_t\ttid;\n} au_proc64ex_t;\n\n/*\n * error status            1 byte\n * return value            4 bytes/8 bytes (32-bit/64-bit value)\n */\ntypedef struct {\n\tu_char\t\tstatus;\n\tu_int32_t\tret;\n} au_ret32_t;\n\ntypedef struct {\n\tu_char\t\terr;\n\tu_int64_t\tval;\n} au_ret64_t;\n\n/*\n * sequence number         4 bytes\n */\ntypedef struct {\n\tu_int32_t\tseqno;\n} au_seq_t;\n\n/*\n * socket type             2 bytes\n * local port              2 bytes\n * local Internet address  4 bytes\n * remote port             2 bytes\n * remote Internet address 4 bytes\n */\ntypedef struct {\n\tu_int16_t\ttype;\n\tu_int16_t\tl_port;\n\tu_int32_t\tl_addr;\n\tu_int16_t\tr_port;\n\tu_int32_t\tr_addr;\n} au_socket_t;\n\n/*\n * socket type             2 bytes\n * local port              2 bytes\n * address type/length     4 bytes\n * local Internet address  4 bytes/16 bytes (IPv4/IPv6 address)\n * remote port             4 bytes\n * address type/length     4 bytes\n * remote Internet address 4 bytes/16 bytes (IPv4/IPv6 address)\n */\ntypedef struct {\n\tu_int16_t\tdomain;\n\tu_int16_t\ttype;\n\tu_int16_t\tatype;\n\tu_int16_t\tl_port;\n\tu_int32_t\tl_addr[4];\n\tu_int32_t\tr_port;\n\tu_int32_t\tr_addr[4];\n} au_socket_ex32_t;\n\n/*\n * socket family           2 bytes\n * local port              2 bytes\n * socket address          4 bytes/16 bytes (IPv4/IPv6 address)\n */\ntypedef struct {\n\tu_int16_t\tfamily;\n\tu_int16_t\tport;\n\tu_int32_t\taddr[4];\n} au_socketinet_ex32_t;\n\ntypedef struct {\n\tu_int16_t\tfamily;\n\tu_int16_t\tport;\n\tu_int32_t\taddr;\n} au_socketinet32_t;\n\n/*\n * socket family           2 bytes\n * path                    104 bytes\n */\ntypedef struct {\n\tu_int16_t\tfamily;\n\tchar\t\tpath[104];\n} au_socketunix_t;\n\n/*\n * audit ID                4 bytes\n * effective user ID       4 bytes\n * effective group ID      4 bytes\n * real user ID            4 bytes\n * real group ID           4 bytes\n * process ID              4 bytes\n * session ID              4 bytes\n * terminal ID\n * \tport ID               4 bytes/8 bytes (32-bit/64-bit value)\n * \tmachine address       4 bytes\n */\ntypedef struct {\n\tu_int32_t\tauid;\n\tu_int32_t\teuid;\n\tu_int32_t\tegid;\n\tu_int32_t\truid;\n\tu_int32_t\trgid;\n\tu_int32_t\tpid;\n\tu_int32_t\tsid;\n\tau_tid32_t\ttid;\n} au_subject32_t;\n\ntypedef struct {\n\tu_int32_t\tauid;\n\tu_int32_t\teuid;\n\tu_int32_t\tegid;\n\tu_int32_t\truid;\n\tu_int32_t\trgid;\n\tu_int32_t\tpid;\n\tu_int32_t\tsid;\n\tau_tid64_t\ttid;\n} au_subject64_t;\n\n/*\n * audit ID                4 bytes\n * effective user ID       4 bytes\n * effective group ID      4 bytes\n * real user ID            4 bytes\n * real group ID           4 bytes\n * process ID              4 bytes\n * session ID              4 bytes\n * terminal ID\n * port ID               4 bytes/8 bytes (32-bit/64-bit value)\n * type                  4 bytes\n * machine address       16 bytes\n */\ntypedef struct {\n\tu_int32_t\tauid;\n\tu_int32_t\teuid;\n\tu_int32_t\tegid;\n\tu_int32_t\truid;\n\tu_int32_t\trgid;\n\tu_int32_t\tpid;\n\tu_int32_t\tsid;\n\tau_tidaddr32_t\ttid;\n} au_subject32ex_t;\n\ntypedef struct {\n\tu_int32_t\tauid;\n\tu_int32_t\teuid;\n\tu_int32_t\tegid;\n\tu_int32_t\truid;\n\tu_int32_t\trgid;\n\tu_int32_t\tpid;\n\tu_int32_t\tsid;\n\tau_tidaddr64_t\ttid;\n} au_subject64ex_t;\n\n/*\n * text length             2 bytes\n * text                    N bytes + 1 terminating NULL byte\n */\ntypedef struct {\n\tu_int16_t\t len;\n\tchar\t\t*text;\n} au_text_t;\n\n/*\n * zonename length\t2 bytes\n * zonename text\tN bytes + 1 NULL terminator\n */\ntypedef struct {\n\tu_int16_t\t len;\n\tchar\t\t*zonename;\n} au_zonename_t;\n\ntypedef struct {\n\tu_int32_t\tident;\n\tu_int16_t\tfilter;\n\tu_int16_t\tflags;\n\tu_int32_t\tfflags;\n\tu_int32_t\tdata;\n} au_kevent_t;\n\ntypedef struct {\n\tu_int16_t\t length;\n\tchar\t\t*data;\n} au_invalid_t;\n\n/*\n * trailer magic number    2 bytes\n * record byte count       4 bytes\n */\ntypedef struct {\n\tu_int16_t\tmagic;\n\tu_int32_t\tcount;\n} au_trailer_t;\n\nstruct tokenstr {\n\tu_char\t id;\n\tu_char\t*data;\n\tsize_t\t len;\n\tunion {\n\t\tau_arg32_t\t\targ32;\n\t\tau_arg64_t\t\targ64;\n\t\tau_arb_t\t\tarb;\n\t\tau_attr32_t\t\tattr32;\n\t\tau_attr64_t\t\tattr64;\n\t\tau_execarg_t\t\texecarg;\n\t\tau_execenv_t\t\texecenv;\n\t\tau_exit_t\t\texit;\n\t\tau_file_t\t\tfile;\n\t\tau_groups_t\t\tgrps;\n\t\tau_header32_t\t\thdr32;\n\t\tau_header32_ex_t\thdr32_ex;\n\t\tau_header64_t\t\thdr64;\n\t\tau_header64_ex_t\thdr64_ex;\n\t\tau_inaddr_t\t\tinaddr;\n\t\tau_inaddr_ex_t\t\tinaddr_ex;\n\t\tau_ip_t\t\t\tip;\n\t\tau_ipc_t\t\tipc;\n\t\tau_ipcperm_t\t\tipcperm;\n\t\tau_iport_t\t\tiport;\n\t\tau_opaque_t\t\topaque;\n\t\tau_path_t\t\tpath;\n\t\tau_proc32_t\t\tproc32;\n\t\tau_proc32ex_t\t\tproc32_ex;\n\t\tau_proc64_t\t\tproc64;\n\t\tau_proc64ex_t\t\tproc64_ex;\n\t\tau_ret32_t\t\tret32;\n\t\tau_ret64_t\t\tret64;\n\t\tau_seq_t\t\tseq;\n\t\tau_socket_t\t\tsocket;\n\t\tau_socket_ex32_t\tsocket_ex32;\n\t\tau_socketinet_ex32_t\tsockinet_ex32;\n\t\tau_socketunix_t\t\tsockunix;\n\t\tau_subject32_t\t\tsubj32;\n\t\tau_subject32ex_t\tsubj32_ex;\n\t\tau_subject64_t\t\tsubj64;\n\t\tau_subject64ex_t\tsubj64_ex;\n\t\tau_text_t\t\ttext;\n\t\tau_kevent_t\t\tkevent;\n\t\tau_invalid_t\t\tinvalid;\n\t\tau_trailer_t\t\ttrail;\n\t\tau_zonename_t\t\tzonename;\n\t} tt; /* The token is one of the above types */\n};\n\ntypedef struct tokenstr tokenstr_t;\n\nint\t\t\t audit_submit(short au_event, au_id_t auid,\n\t\t\t    char status, int reterr, const char *fmt, ...);\n\n/*\n * Functions relating to querying audit class information.\n */\nvoid\t\t\t setauclass(void);\nvoid\t\t\t endauclass(void);\nstruct au_class_ent\t*getauclassent(void);\nstruct au_class_ent\t*getauclassent_r(au_class_ent_t *class_int);\nstruct au_class_ent\t*getauclassnam(const char *name);\nstruct au_class_ent\t*getauclassnam_r(au_class_ent_t *class_int,\n\t\t\t    const char *name);\nstruct au_class_ent\t*getauclassnum(au_class_t class_number);\nstruct au_class_ent\t*getauclassnum_r(au_class_ent_t *class_int,\n\t\t\t    au_class_t class_number);\n\n/*\n * Functions relating to querying audit control information.\n */\nvoid\t\t\t setac(void);\nvoid\t\t\t endac(void);\nint\t\t\t getacdir(char *name, int len);\nint\t\t\t getacmin(int *min_val);\nint\t\t\t getacfilesz(size_t *size_val);\nint\t\t\t getacflg(char *auditstr, int len);\nint\t\t\t getacna(char *auditstr, int len);\nint\t\t\t getacpol(char *auditstr, size_t len);\nint\t\t\t getachost(char *auditstr, size_t len);\nint\t\t\t getacexpire(int *andflg, time_t *age, size_t *size);\nint\t\t\t getauditflagsbin(char *auditstr, au_mask_t *masks);\nint\t\t\t getauditflagschar(char *auditstr, au_mask_t *masks,\n\t\t\t    int verbose);\nint\t\t\t au_preselect(au_event_t event, au_mask_t *mask_p,\n\t\t\t    int sorf, int flag);\nssize_t\t\t\t au_poltostr(int policy, size_t maxsize, char *buf);\nint\t\t\t au_strtopol(const char *polstr, int *policy);\n\n/*\n * Functions relating to querying audit event information.\n */\nvoid\t\t\t setauevent(void);\nvoid\t\t\t endauevent(void);\nstruct au_event_ent\t*getauevent(void);\nstruct au_event_ent\t*getauevent_r(struct au_event_ent *e);\nstruct au_event_ent\t*getauevnam(const char *name);\nstruct au_event_ent\t*getauevnam_r(struct au_event_ent *e,\n\t\t\t    const char *name);\nstruct au_event_ent\t*getauevnum(au_event_t event_number);\nstruct au_event_ent\t*getauevnum_r(struct au_event_ent *e,\n\t\t\t    au_event_t event_number);\nau_event_t\t\t*getauevnonam(const char *event_name);\nau_event_t\t\t*getauevnonam_r(au_event_t *ev,\n\t\t\t    const char *event_name);\n\n/*\n * Functions relating to querying audit user information.\n */\nvoid\t\t\t setauuser(void);\nvoid\t\t\t endauuser(void);\nstruct au_user_ent\t*getauuserent(void);\nstruct au_user_ent\t*getauuserent_r(struct au_user_ent *u);\nstruct au_user_ent\t*getauusernam(const char *name);\nstruct au_user_ent\t*getauusernam_r(struct au_user_ent *u,\n\t\t\t    const char *name);\nint\t\t\t au_user_mask(char *username, au_mask_t *mask_p);\nint\t\t\t getfauditflags(au_mask_t *usremask,\n\t\t\t    au_mask_t *usrdmask, au_mask_t *lastmask);\n\n/*\n * Functions for reading and printing records and tokens from audit trails.\n */\nint\t\t\t au_read_rec(FILE *fp, u_char **buf);\nint\t\t\t au_fetch_tok(tokenstr_t *tok, u_char *buf, int len);\n//XXX The following interface has different prototype from BSM\nvoid\t\t\t au_print_tok(FILE *outfp, tokenstr_t *tok,\n\t\t\t    char *del, char raw, char sfrm);\nvoid\t\t\t au_print_tok_xml(FILE *outfp, tokenstr_t *tok,\n\t\t\t    char *del, char raw, char sfrm);\n\n/* \n * Functions relating to XML output.\n */\nvoid\t\t\t au_print_xml_header(FILE *outfp);\nvoid\t\t\t au_print_xml_footer(FILE *outfp);\n\n/*\n * BSM library routines for converting between local and BSM constant spaces.\n * (Note: some of these are replicated in audit_record.h for the benefit of\n * the FreeBSD and Mac OS X kernels)\n */\nint\t au_bsm_to_domain(u_short bsm_domain, int *local_domainp);\nint\t au_bsm_to_errno(u_char bsm_error, int *errorp);\nint\t au_bsm_to_fcntl_cmd(u_short bsm_fcntl_cmd, int *local_fcntl_cmdp);\nint\t au_bsm_to_socket_type(u_short bsm_socket_type,\n\t    int *local_socket_typep);\nu_short\t au_domain_to_bsm(int local_domain);\nu_char\t au_errno_to_bsm(int local_errno);\nu_short\t au_fcntl_cmd_to_bsm(int local_fcntl_command); \nu_short\t au_socket_type_to_bsm(int local_socket_type);\n\nconst char\t *au_strerror(u_char bsm_error);\n__END_DECLS\n\n/*\n * The remaining APIs are associated with Apple's BSM implementation, in\n * particular as relates to Mach IPC auditing and triggers passed via Mach\n * IPC.\n */\n#ifdef __APPLE__\n#include <sys/appleapiopts.h>\n\n/**************************************************************************\n **************************************************************************\n ** The following definitions, functions, etc., are NOT officially\n ** supported: they may be changed or removed in the future.  Do not use\n ** them unless you are prepared to cope with that eventuality.\n **************************************************************************\n **************************************************************************/\n\n#ifdef __APPLE_API_PRIVATE\n#define\t__BSM_INTERNAL_NOTIFY_KEY\t\"com.apple.audit.change\"\n#endif /* __APPLE_API_PRIVATE */\n\n/*\n * au_get_state() return values\n * XXX  use AUC_* values directly instead (<bsm/audit.h>); AUDIT_OFF and\n * AUDIT_ON are deprecated and WILL be removed.\n */\n#ifdef __APPLE_API_PRIVATE\n#define\tAUDIT_OFF\tAUC_NOAUDIT\n#define\tAUDIT_ON\tAUC_AUDITING\n#endif /* __APPLE_API_PRIVATE */\n#endif /* !__APPLE__ */\n\n/*\n * Error return codes for audit_set_terminal_id(), audit_write() and its\n * brethren.  We have 255 (not including kAUNoErr) to play with.\n *\n * XXXRW: In Apple's bsm-8, these are marked __APPLE_API_PRIVATE.\n */\nenum {\n\tkAUNoErr\t\t\t= 0,\n\tkAUBadParamErr\t\t\t= -66049,\n\tkAUStatErr,\n\tkAUSysctlErr,\n\tkAUOpenErr,\n\tkAUMakeSubjectTokErr,\n\tkAUWriteSubjectTokErr,\n\tkAUWriteCallerTokErr,\n\tkAUMakeReturnTokErr,\n\tkAUWriteReturnTokErr,\n\tkAUCloseErr,\n\tkAUMakeTextTokErr,\n\tkAULastErr\n};\n\n#ifdef __APPLE__\n/*\n * Error return codes for au_get_state() and/or its private support\n * functions.  These codes are designed to be compatible with the\n * NOTIFY_STATUS_* codes defined in <notify.h> but non-overlapping.\n * Any changes to notify(3) may cause these values to change in future.\n *\n * AU_UNIMPL should never happen unless you've changed your system software\n * without rebooting.  Shame on you.\n */\n#ifdef __APPLE_API_PRIVATE\n#define\tAU_UNIMPL\tNOTIFY_STATUS_FAILED + 1\t/* audit unimplemented */\n#endif /* __APPLE_API_PRIVATE */\n#endif /* !__APPLE__ */\n\n__BEGIN_DECLS\n/*\n * XXX  This prototype should be in audit_record.h\n *\n * au_free_token()\n *\n * @summary - au_free_token() deallocates a token_t created by any of\n * the au_to_*() BSM API functions.\n *\n * The BSM API generally manages deallocation of token_t objects.  However,\n * if au_write() is passed a bad audit descriptor, the token_t * parameter\n * will be left untouched.  In that case, the caller can deallocate the\n * token_t using au_free_token() if desired.  This is, in fact, what\n * audit_write() does, in keeping with the existing memory management model\n * of the BSM API.\n *\n * @param tok - A token_t * generated by one of the au_to_*() BSM API\n * calls.  For convenience, tok may be NULL, in which case\n * au_free_token() returns immediately.\n *\n * XXXRW: In Apple's bsm-8, these are marked __APPLE_API_PRIVATE.\n */\nvoid\tau_free_token(token_t *tok);\n\n/*\n * Lightweight check to determine if auditing is enabled.  If a client\n * wants to use this to govern whether an entire series of audit calls\n * should be made--as in the common case of a caller building a set of\n * tokens, then writing them--it should cache the audit status in a local\n * variable.  This call always returns the current state of auditing.\n *\n * @return - AUC_AUDITING or AUC_NOAUDIT if no error occurred.\n * Otherwise the function can return any of the errno values defined for\n * setaudit(2), or AU_UNIMPL if audit does not appear to be supported by\n * the system.\n *\n * XXXRW: In Apple's bsm-8, these are marked __APPLE_API_PRIVATE.\n */\nint\tau_get_state(void);\n\n/*\n * Initialize the audit notification.  If it has not already been initialized\n * it will automatically on the first call of au_get_state().\n */\nuint32_t\tau_notify_initialize(void);\n\n/*\n * Cancel audit notification and free the resources associated with it.\n * Responsible code that no longer needs to use au_get_state() should call\n * this.\n */\nint\t\tau_notify_terminate(void);\n__END_DECLS\n\n/* OpenSSH compatibility */\nint\tcannot_audit(int);\n\n__BEGIN_DECLS\n/*\n * audit_set_terminal_id()\n *\n * @summary - audit_set_terminal_id() fills in an au_tid_t struct, which is\n * used in audit session initialization by processes like /usr/bin/login.\n *\n * @param tid - A pointer to an au_tid_t struct.\n *\n * @return - kAUNoErr on success; kAUBadParamErr if tid is NULL, kAUStatErr\n * or kAUSysctlErr if one of the underlying system calls fails (a message\n * is sent to the system log in those cases).\n *\n * XXXRW: In Apple's bsm-8, these are marked __APPLE_API_PRIVATE.\n */\nint\taudit_set_terminal_id(au_tid_t *tid);\n\n/*\n * BEGIN au_write() WRAPPERS\n *\n * The following calls all wrap the existing BSM API.  They use the\n * provided subject information, if any, to construct the subject token\n * required for every log message.  They use the provided return/error\n * value(s), if any, to construct the success/failure indication required\n * for every log message.  They only permit one \"miscellaneous\" token,\n * which should contain the event-specific logging information mandated by\n * CAPP.\n *\n * All these calls assume the caller has previously determined that\n * auditing is enabled by calling au_get_state().\n */\n\n/*\n * audit_write()\n *\n * @summary - audit_write() is the basis for the other audit_write_*()\n * calls.  Performs a basic write of an audit record (subject, additional\n * info, success/failure).  Note that this call only permits logging one\n * caller-specified token; clients needing to log more flexibly must use\n * the existing BSM API (au_open(), et al.) directly.\n *\n * Note on memory management: audit_write() guarantees that the token_t *s\n * passed to it will be deallocated whether or not the underlying write to\n * the audit log succeeded.  This addresses an inconsistency in the\n * underlying BSM API in which token_t *s are usually but not always\n * deallocated.\n *\n * @param event_code - The code for the event being logged.  This should\n * be one of the AUE_ values in /usr/include/bsm/audit_uevents.h.\n *\n * @param subject - A token_t * generated by au_to_subject(),\n * au_to_subject32(), au_to_subject64(), or au_to_me().  If no subject is\n * required, subject should be NULL.\n *\n * @param misctok - A token_t * generated by one of the au_to_*() BSM API\n * calls.  This should correspond to the additional information required by\n * CAPP for the event being audited.  If no additional information is\n * required, misctok should be NULL.\n *\n * @param retval - The return value to be logged for this event.  This\n * should be 0 (zero) for success, otherwise the value is event-specific.\n *\n * @param errcode - Any error code associated with the return value (e.g.,\n * errno or h_errno).  If there was no error, errcode should be 0 (zero).\n *\n * @return - The status of the call: 0 (zero) on success, else one of the\n * kAU*Err values defined above.\n *\n * XXXRW: In Apple's bsm-8, these are marked __APPLE_API_PRIVATE.\n */\nint\taudit_write(short event_code, token_t *subject, token_t *misctok,\n\t    char retval, int errcode);\n\n/*\n * audit_write_success()\n *\n * @summary - audit_write_success() records an auditable event that did not\n * encounter an error.  The interface is designed to require as little\n * direct use of the au_to_*() API as possible.  It builds a subject token\n * from the information passed in and uses that to invoke audit_write().\n * A subject, as defined by CAPP, is a process acting on the user's behalf.\n *\n * If the subject information is the same as the current process, use\n * au_write_success_self().\n *\n * @param event_code - The code for the event being logged.  This should\n * be one of the AUE_ values in /usr/include/bsm/audit_uevents.h.\n *\n * @param misctok - A token_t * generated by one of the au_to_*() BSM API\n * calls.  This should correspond to the additional information required by\n * CAPP for the event being audited.  If no additional information is\n * required, misctok should be NULL.\n *\n * @param auid - The subject's audit ID.\n *\n * @param euid - The subject's effective user ID.\n *\n * @param egid - The subject's effective group ID.\n *\n * @param ruid - The subject's real user ID.\n *\n * @param rgid - The subject's real group ID.\n *\n * @param pid - The subject's process ID.\n *\n * @param sid - The subject's session ID.\n *\n * @param tid - The subject's terminal ID.\n *\n * @return - The status of the call: 0 (zero) on success, else one of the\n * kAU*Err values defined above.\n *\n * XXXRW: In Apple's bsm-8, these are marked __APPLE_API_PRIVATE.\n */\nint\taudit_write_success(short event_code, token_t *misctok, au_id_t auid,\n\t    uid_t euid, gid_t egid, uid_t ruid, gid_t rgid, pid_t pid,\n\t    au_asid_t sid, au_tid_t *tid);\n\n/*\n * audit_write_success_self()\n *\n * @summary - Similar to audit_write_success(), but used when the subject\n * (process) is owned and operated by the auditable user him/herself.\n *\n * @param event_code - The code for the event being logged.  This should\n * be one of the AUE_ values in /usr/include/bsm/audit_uevents.h.\n *\n * @param misctok - A token_t * generated by one of the au_to_*() BSM API\n * calls.  This should correspond to the additional information required by\n * CAPP for the event being audited.  If no additional information is\n * required, misctok should be NULL.\n *\n * @return - The status of the call: 0 (zero) on success, else one of the\n * kAU*Err values defined above.\n *\n * XXXRW: In Apple's bsm-8, these are marked __APPLE_API_PRIVATE.\n */\nint\taudit_write_success_self(short event_code, token_t *misctok);\n\n/*\n * audit_write_failure()\n *\n * @summary - audit_write_failure() records an auditable event that\n * encountered an error.  The interface is designed to require as little\n * direct use of the au_to_*() API as possible.  It builds a subject token\n * from the information passed in and uses that to invoke audit_write().\n * A subject, as defined by CAPP, is a process acting on the user's behalf.\n *\n * If the subject information is the same as the current process, use\n * au_write_failure_self().\n *\n * @param event_code - The code for the event being logged.  This should\n * be one of the AUE_ values in /usr/include/bsm/audit_uevents.h.\n *\n * @param errmsg - A text message providing additional information about\n * the event being audited.\n *\n * @param errret - A numerical value providing additional information about\n * the error.  This is intended to store the value of errno or h_errno if\n * it's relevant.  This can be 0 (zero) if no additional information is\n * available.\n *\n * @param auid - The subject's audit ID.\n *\n * @param euid - The subject's effective user ID.\n *\n * @param egid - The subject's effective group ID.\n *\n * @param ruid - The subject's real user ID.\n *\n * @param rgid - The subject's real group ID.\n *\n * @param pid - The subject's process ID.\n *\n * @param sid - The subject's session ID.\n *\n * @param tid - The subject's terminal ID.\n *\n * @return - The status of the call: 0 (zero) on success, else one of the\n * kAU*Err values defined above.\n *\n * XXXRW: In Apple's bsm-8, these are marked __APPLE_API_PRIVATE.\n */\nint\taudit_write_failure(short event_code, char *errmsg, int errret,\n\t    au_id_t auid, uid_t euid, gid_t egid, uid_t ruid, gid_t rgid,\n\t    pid_t pid, au_asid_t sid, au_tid_t *tid);\n\n/*\n * audit_write_failure_self()\n *\n * @summary - Similar to audit_write_failure(), but used when the subject\n * (process) is owned and operated by the auditable user him/herself.\n *\n * @param event_code - The code for the event being logged.  This should\n * be one of the AUE_ values in /usr/include/bsm/audit_uevents.h.\n *\n * @param errmsg - A text message providing additional information about\n * the event being audited.\n *\n * @param errret - A numerical value providing additional information about\n * the error.  This is intended to store the value of errno or h_errno if\n * it's relevant.  This can be 0 (zero) if no additional information is\n * available.\n *\n * @return - The status of the call: 0 (zero) on success, else one of the\n * kAU*Err values defined above.\n *\n * XXXRW: In Apple's bsm-8, these are marked __APPLE_API_PRIVATE.\n */\nint\taudit_write_failure_self(short event_code, char *errmsg, int errret);\n\n/*\n * audit_write_failure_na()\n *\n * @summary - audit_write_failure_na() records errors during login.  Such\n * errors are implicitly non-attributable (i.e., not ascribable to any user).\n *\n * @param event_code - The code for the event being logged.  This should\n * be one of the AUE_ values in /usr/include/bsm/audit_uevents.h.\n *\n * @param errmsg - A text message providing additional information about\n * the event being audited.\n *\n * @param errret - A numerical value providing additional information about\n * the error.  This is intended to store the value of errno or h_errno if\n * it's relevant.  This can be 0 (zero) if no additional information is\n * available.\n *\n * @param euid - The subject's effective user ID.\n *\n * @param egid - The subject's effective group ID.\n *\n * @param pid - The subject's process ID.\n *\n * @param tid - The subject's terminal ID.\n *\n * @return - The status of the call: 0 (zero) on success, else one of the\n * kAU*Err values defined above.\n *\n * XXXRW: In Apple's bsm-8, these are marked __APPLE_API_PRIVATE.\n */\nint\taudit_write_failure_na(short event_code, char *errmsg, int errret,\n\t    uid_t euid, gid_t egid, pid_t pid, au_tid_t *tid);\n\n/* END au_write() WRAPPERS */\n\n#ifdef  __APPLE__\n/*\n * audit_token_to_au32()\n *\n * @summary - Extract information from an audit_token_t, used to identify\n * Mach tasks and senders of Mach messages as subjects to the audit system.\n * audit_tokent_to_au32() is the only method that should be used to parse\n * an audit_token_t, since its internal representation may change over\n * time.  A pointer parameter may be NULL if that information is not\n * needed.\n *\n * @param atoken - the audit token containing the desired information\n *\n * @param auidp - Pointer to a uid_t; on return will be set to the task or\n * sender's audit user ID\n *\n * @param euidp - Pointer to a uid_t; on return will be set to the task or\n * sender's effective user ID\n *\n * @param egidp - Pointer to a gid_t; on return will be set to the task or\n * sender's effective group ID\n *\n * @param ruidp - Pointer to a uid_t; on return will be set to the task or\n * sender's real user ID\n *\n * @param rgidp - Pointer to a gid_t; on return will be set to the task or\n * sender's real group ID\n *\n * @param pidp - Pointer to a pid_t; on return will be set to the task or\n * sender's process ID\n *\n * @param asidp - Pointer to an au_asid_t; on return will be set to the\n * task or sender's audit session ID\n *\n * @param tidp - Pointer to an au_tid_t; on return will be set to the task\n * or sender's terminal ID\n *\n * XXXRW: In Apple's bsm-8, these are marked __APPLE_API_PRIVATE.\n */\nvoid audit_token_to_au32(\n\taudit_token_t\t atoken,\n\tuid_t\t\t*auidp,\n\tuid_t\t\t*euidp,\n\tgid_t\t\t*egidp,\n\tuid_t\t\t*ruidp,\n\tgid_t\t\t*rgidp,\n\tpid_t\t\t*pidp,\n\tau_asid_t\t*asidp,\n\tau_tid_t\t*tidp);\n#endif /* !__APPLE__ */\n\n/*\n * Wrapper functions to auditon(2).\n */\nint audit_get_car(char *path, size_t sz);\nint audit_get_class(au_evclass_map_t *evc_map, size_t sz);\nint audit_set_class(au_evclass_map_t *evc_map, size_t sz);\nint audit_get_cond(int *cond);\nint audit_set_cond(int *cond);\nint audit_get_cwd(char *path, size_t sz);\nint audit_get_fsize(au_fstat_t *fstat, size_t sz);\nint audit_set_fsize(au_fstat_t *fstat, size_t sz);\nint audit_get_kmask(au_mask_t *kmask, size_t sz);\nint audit_set_kmask(au_mask_t *kmask, size_t sz);\nint audit_get_kaudit(auditinfo_addr_t *aia, size_t sz);\nint audit_set_kaudit(auditinfo_addr_t *aia, size_t sz);\nint audit_set_pmask(auditpinfo_t *api, size_t sz);\nint audit_get_pinfo(auditpinfo_t *api, size_t sz);\nint audit_get_pinfo_addr(auditpinfo_addr_t *apia, size_t sz);\nint audit_get_policy(int *policy);\nint audit_set_policy(int *policy);\nint audit_get_qctrl(au_qctrl_t *qctrl, size_t sz);\nint audit_set_qctrl(au_qctrl_t *qctrl, size_t sz);\nint audit_get_sinfo_addr(auditinfo_addr_t *aia, size_t sz);\nint audit_get_stat(au_stat_t *stats, size_t sz);\nint audit_set_stat(au_stat_t *stats, size_t sz);\nint audit_send_trigger(int *trigger);\n\n__END_DECLS\n\n#endif /* !_LIBBSM_H_ */\n"
  },
  {
    "path": "freebsd-headers/bsnmp/asn1.h",
    "content": "/*\n * Copyright (c) 2001-2003\n *\tFraunhofer Institute for Open Communication Systems (FhG Fokus).\n *\tAll rights reserved.\n *\n * Author: Harti Brandt <harti@freebsd.org>\n * \n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * \n * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $Begemot: bsnmp/lib/asn1.h,v 1.20 2005/10/05 16:43:11 brandt_h Exp $\n *\n * ASN.1 for SNMP\n */\n#ifndef asn1_h_\n#define asn1_h_\n\n#include <sys/types.h>\n\nstruct asn_buf {\n\tunion {\n\t\tu_char\t*ptr;\n\t\tconst u_char *cptr;\n\t}\tasn_u;\n\tsize_t\tasn_len;\n};\n#define asn_cptr\tasn_u.cptr\n#define asn_ptr\tasn_u.ptr\n\n/* these restrictions are in the SMI */\n#define ASN_MAXID\t0xffffffff\n#define ASN_MAXOIDLEN\t128\n\n/* the string needed for this (with trailing zero) */\n#define ASN_OIDSTRLEN\t(ASN_MAXOIDLEN * (10 + 1) - 1 + 1)\n\n/* type of subidentifiers */\ntypedef uint32_t asn_subid_t;\n\nstruct asn_oid {\n\tu_int\tlen;\n\tasn_subid_t subs[ASN_MAXOIDLEN];\n};\n\nenum asn_err {\n\t/* conversion was ok */\n\tASN_ERR_OK\t= 0,\n\t/* conversion failed and stopped */\n\tASN_ERR_FAILED\t= 1 | 0x1000,\n\t/* length field bad, value skipped */\n\tASN_ERR_BADLEN\t= 2,\n\t/* out of buffer, stopped */\n\tASN_ERR_EOBUF\t= 3 | 0x1000,\n\t/* length ok, but value is out of range */\n\tASN_ERR_RANGE\t= 4,\n\t/* not the expected tag, stopped */\n\tASN_ERR_TAG\t= 5 | 0x1000,\n};\n#define ASN_ERR_STOPPED(E) (((E) & 0x1000) != 0)\n\n/* type for the length field of encoded values. The length is restricted\n * to 65535, but using uint16_t would give conversion warnings on gcc */\ntypedef uint32_t asn_len_t;\t/* could be also uint16_t */\n\n/* maximal length of a long length field without the length of the length */\n#define ASN_MAXLEN\t65535\n#define ASN_MAXLENLEN\t2\t/* number of bytes in a length */\n\n/* maximum size of an octet string as per SMIv2 */\n#define ASN_MAXOCTETSTRING 65535\n\nextern void (*asn_error)(const struct asn_buf *, const char *, ...);\n\nenum asn_err asn_get_header(struct asn_buf *, u_char *, asn_len_t *);\nenum asn_err asn_put_header(struct asn_buf *, u_char, asn_len_t);\n\nenum asn_err asn_put_temp_header(struct asn_buf *, u_char, u_char **);\nenum asn_err asn_commit_header(struct asn_buf *, u_char *, size_t *);\n\nenum asn_err asn_get_integer_raw(struct asn_buf *, asn_len_t, int32_t *);\nenum asn_err asn_get_integer(struct asn_buf *, int32_t *);\nenum asn_err asn_put_integer(struct asn_buf *, int32_t);\n\nenum asn_err asn_get_octetstring_raw(struct asn_buf *, asn_len_t, u_char *, u_int *);\nenum asn_err asn_get_octetstring(struct asn_buf *, u_char *, u_int *);\nenum asn_err asn_put_octetstring(struct asn_buf *, const u_char *, u_int);\n\nenum asn_err asn_get_null_raw(struct asn_buf *b, asn_len_t);\nenum asn_err asn_get_null(struct asn_buf *);\nenum asn_err asn_put_null(struct asn_buf *);\n\nenum asn_err asn_put_exception(struct asn_buf *, u_int);\n\nenum asn_err asn_get_objid_raw(struct asn_buf *, asn_len_t, struct asn_oid *);\nenum asn_err asn_get_objid(struct asn_buf *, struct asn_oid *);\nenum asn_err asn_put_objid(struct asn_buf *, const struct asn_oid *);\n\nenum asn_err asn_get_sequence(struct asn_buf *, asn_len_t *);\n\nenum asn_err asn_get_ipaddress_raw(struct asn_buf *, asn_len_t, u_char *);\nenum asn_err asn_get_ipaddress(struct asn_buf *, u_char *);\nenum asn_err asn_put_ipaddress(struct asn_buf *, const u_char *);\n\nenum asn_err asn_get_uint32_raw(struct asn_buf *, asn_len_t, uint32_t *);\nenum asn_err asn_put_uint32(struct asn_buf *, u_char, uint32_t);\n\nenum asn_err asn_get_counter64_raw(struct asn_buf *, asn_len_t, uint64_t *);\nenum asn_err asn_put_counter64(struct asn_buf *, uint64_t);\n\nenum asn_err asn_get_timeticks(struct asn_buf *, uint32_t *);\nenum asn_err asn_put_timeticks(struct asn_buf *, uint32_t);\n\nenum asn_err asn_skip(struct asn_buf *, asn_len_t);\nenum asn_err asn_pad(struct asn_buf *, asn_len_t);\n\n/*\n * Utility functions for OIDs\n */\n/* get a sub-OID from the middle of another OID */\nvoid asn_slice_oid(struct asn_oid *, const struct asn_oid *, u_int, u_int);\n\n/* append an OID to another one */\nvoid asn_append_oid(struct asn_oid *, const struct asn_oid *);\n\n/* compare two OIDs */\nint asn_compare_oid(const struct asn_oid *, const struct asn_oid *);\n\n/* check whether the first is a suboid of the second one */\nint asn_is_suboid(const struct asn_oid *, const struct asn_oid *);\n\n/* format an OID into a user buffer of size ASN_OIDSTRLEN */\nchar *asn_oid2str_r(const struct asn_oid *, char *);\n\n/* format an OID into a private static buffer */\nchar *asn_oid2str(const struct asn_oid *);\n\nenum {\n\tASN_TYPE_BOOLEAN\t= 0x01,\n\tASN_TYPE_INTEGER\t= 0x02,\n\tASN_TYPE_BITSTRING\t= 0x03,\n\tASN_TYPE_OCTETSTRING\t= 0x04,\n\tASN_TYPE_NULL\t\t= 0x05,\n\tASN_TYPE_OBJID\t\t= 0x06,\n\tASN_TYPE_SEQUENCE\t= 0x10,\n\n\tASN_TYPE_CONSTRUCTED\t= 0x20,\n\tASN_CLASS_UNIVERSAL\t= 0x00,\n\tASN_CLASS_APPLICATION\t= 0x40,\n\tASN_CLASS_CONTEXT\t= 0x80,\n\tASN_CLASS_PRIVATE\t= 0xc0,\n\tASN_TYPE_MASK\t\t= 0x1f,\n\n\tASN_APP_IPADDRESS\t= 0x00,\n\tASN_APP_COUNTER\t\t= 0x01,\n\tASN_APP_GAUGE\t\t= 0x02,\n\tASN_APP_TIMETICKS\t= 0x03,\n\tASN_APP_OPAQUE\t\t= 0x04,\t/* not implemented */\n\tASN_APP_COUNTER64\t= 0x06,\n\n\tASN_EXCEPT_NOSUCHOBJECT\t= 0x00,\n\tASN_EXCEPT_NOSUCHINSTANCE = 0x01,\n\tASN_EXCEPT_ENDOFMIBVIEW\t= 0x02,\n};\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/bsnmp/bridge_snmp.h",
    "content": "/*-\n * Copyright (c) 2006 Shteryana Shopova <syrinx@FreeBSD.org>\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * Bridge MIB implementation for SNMPd.\n *\n * $FreeBSD: release/9.0.0/usr.sbin/bsnmpd/modules/snmp_bridge/bridge_snmp.h 171791 2007-08-08 19:27:50Z syrinx $\n */\n\n#ifndef\tSNMP_BRIDGE_H\n#define\tSNMP_BRIDGE_H\n\n#define\tSNMP_BRIDGE_ID_LEN\t8\n\ntypedef uint8_t\tport_id[2];\ntypedef u_char\tbridge_id[SNMP_BRIDGE_ID_LEN];\n\n#define\tSNMP_BRIDGE_MAX_PRIORITY\t65535\n\n#define\tSNMP_BRIDGE_MIN_AGE_TIME\t10\n#define\tSNMP_BRIDGE_MAX_AGE_TIME\t1000000\n\n#define\tSNMP_BRIDGE_MIN_TXHC\t\t1\n#define\tSNMP_BRIDGE_MAX_TXHC\t\t10\n\n#define\tSNMP_BRIDGE_MIN_MAGE\t\t600\n#define\tSNMP_BRIDGE_MAX_MAGE\t\t4000\n\n#define\tSNMP_BRIDGE_MIN_HTIME\t\t100\n#define\tSNMP_BRIDGE_MAX_HTIME\t\t1000\n\n#define\tSNMP_BRIDGE_MIN_FDELAY\t\t400\n#define\tSNMP_BRIDGE_MAX_FDELAY\t\t3000\n\n#define\tSNMP_PORT_PATHCOST_OBSOLETE\t65535\n#define\tSNMP_PORT_MIN_PATHCOST\t\t0\n#define\tSNMP_PORT_MAX_PATHCOST\t\t200000000\n#define\tSNMP_PORT_PATHCOST_AUTO\t\t0\n\n#define\tSNMP_BRIDGE_DATA_MAXAGE\t\t10\n#define\tSNMP_BRIDGE_DATA_MAXAGE_MIN\t1\n#define\tSNMP_BRIDGE_DATA_MAXAGE_MAX\t300\n\n/* By default poll kernel data every 5 minutes. */\n#define\tSNMP_BRIDGE_POLL_INTERVAL\t(5 * 60)\n#define\tSNMP_BRIDGE_POLL_INTERVAL_MIN\t1\n#define\tSNMP_BRIDGE_POLL_INTERVAL_MAX\t3600\n\n/* Poll for a topology change once every 30 seconds. */\n#define\tSNMP_BRIDGE_TC_POLL_INTERVAL\t30\n\nstruct bridge_if *bridge_get_default(void);\n\nvoid bridge_set_default(struct bridge_if *bif);\n\nconst char *bridge_get_default_name(void);\n\nint bridge_get_data_maxage(void);\n\n/*\n * Bridge Addresses Table.\n */\nstruct tp_entry {\n\tuint32_t\t\tsysindex;\t/* The bridge if sysindex. */\n\tint32_t\t\t\tport_no;\n\tenum TpFdbStatus\tstatus;\n\tuint8_t\t\t\ttp_addr[ETHER_ADDR_LEN];\n\tuint8_t\t\t\tflags;\n\tTAILQ_ENTRY(tp_entry)\ttp_e;\n};\n\n/*\n * Bridge ports.\n * The bridge port system interface index is used for a\n * port number. Transparent bridging statistics and STP\n * information for a port are also contained here.\n */\nstruct bridge_port {\n\t/* dot1dBase subtree objects. */\n\tuint32_t\tsysindex;\t/* The bridge interface sysindex. */\n\tint32_t\t\tport_no;\t/* The bridge member system index. */\n\tint32_t\t\tif_idx;\t\t/* SNMP ifIndex from mibII. */\n\tint8_t\t\tspan_enable;\t/* Span flag set - private MIB. */\n\tstruct asn_oid\tcircuit;\t/* Unused. */\n\tuint32_t\tdly_ex_drops;\t/* Drops on output. */\n\tuint32_t\tdly_mtu_drops;\t/* MTU exceeded drops. */\n\tint32_t\t\tstatus;\t\t/* The entry status. */\n\tenum TruthValue\tpriv_set;\t/* The private flag. */\n\n\t/* dot1dStp subtree objects. */\n\tint32_t\t\tpath_cost;\n\tint32_t\t\tpriority;\n\tint32_t\t\tdesign_cost;\n\tuint32_t\tfwd_trans;\n\tchar\t\tp_name[IFNAMSIZ]; /* Not in BRIDGE-MIB. */\n\tenum StpPortState\tstate;\n\tenum dot1dStpPortEnable\tenable;\n\tport_id\t\tdesign_port;\n\tbridge_id\tdesign_root;\n\tbridge_id\tdesign_bridge;\n\n\t/* rstpMib extensions. */\n\tint32_t\t\tadmin_path_cost;\n\tenum TruthValue\tproto_migr;\n\tenum TruthValue\tadmin_edge;\n\tenum TruthValue\toper_edge;\n\tenum TruthValue\toper_ptp;\n\tenum StpPortAdminPointToPointType\tadmin_ptp;\n\n\t/* dot1dTp subtree objects. */\n\tint32_t\t\tmax_info;\n\tint32_t\t\tin_frames;\n\tint32_t\t\tout_frames;\n\tint32_t\t\tin_drops;\n\n\tuint8_t\t\tflags;\n\tTAILQ_ENTRY(bridge_port) b_p;\n};\n\n/*\n * A bridge interface.\n * The system interface index of the bridge is not required neither by the\n * standard BRIDGE-MIB nor by the private BEGEMOT-BRIDGE-MIB, but is used\n * as key for looking up the other info for this bridge.\n */\nstruct bridge_if {\n\t/* dot1dBase subtree objects. */\n\tuint32_t\tsysindex;\t/* The system interface index. */\n\tint32_t\t\tnum_ports;\t/* Number of ports. */\n\tenum BaseType\tbr_type;\t/* Bridge type. */\n\tenum RowStatus\tif_status;\t/* Bridge status. */\n\tchar\t\tbif_name[IFNAMSIZ]; /* Bridge interface name. */\n\tstruct ether_addr br_addr;\t/* Bridge address. */\n\tstruct bridge_port *f_bp;\t/* This bridge's first entry\n\t\t\t\t\t * in the base ports TAILQ. */\n\t/* dot1dStp subtree objects. */\n\tint32_t\t\tpriority;\n\tint32_t\t\troot_cost;\n\tint32_t\t\troot_port;\n\tint32_t\t\tmax_age;\t/* Current max age. */\n\tint32_t\t\thello_time;\t/* Current hello time. */\n\tint32_t\t\tfwd_delay;\t/* Current forward delay. */\n\tint32_t\t\thold_time;\n\tint32_t\t\tbridge_max_age;\t/* Configured max age. */\n\tint32_t\t\tbridge_hello_time; /* Configured hello time. */\n\tint32_t\t\tbridge_fwd_delay; /* Configured forward delay. */\n\tint32_t\t\ttx_hold_count;\n\tuint32_t\ttop_changes;\n\tenum dot1dStpVersion\tstp_version;\n\tenum dot1dStpProtocolSpecification prot_spec;\n\tstruct timeval\tlast_tc_time;\n\tbridge_id\tdesign_root;\n\n\t/* dot1dTp subtree objects. */\n\tint32_t\t\tlrnt_drops;\t/* Dropped addresses. */\n\tint32_t\t\tage_time;\t/* Address entry timeout. */\n\tint32_t\t\tnum_addrs;\t/* Current # of addresses in cache. */\n\tint32_t\t\tmax_addrs;\t/* Max # of addresses in cache. */\n\tstruct tp_entry\t *f_tpa;\t/* This bridge's first entry in\n\t\t\t\t\t * the tp addresses TAILQ. */\n\n\ttime_t\t\tentry_age;\n\ttime_t\t\tports_age;\n\ttime_t\t\taddrs_age;\n\tTAILQ_ENTRY(bridge_if) b_if;\n};\n\nvoid bridge_ifs_fini(void);\n\nstruct bridge_if *bridge_if_find_ifs(uint32_t sysindex);\n\nstruct bridge_if *bridge_if_find_ifname(const char *b_name);\n\nconst char *bridge_if_find_name(uint32_t sysindex);\n\nint bridge_compare_sysidx(uint32_t i1, uint32_t i2);\n\nint bridge_attach_newif(struct mibif *ifp);\n\nstruct bridge_if *bridge_first_bif(void);\n\nstruct bridge_if *bridge_next_bif(struct bridge_if *b_pr);\n\nvoid bridge_remove_bif(struct bridge_if *bif);\n\nvoid bridge_update_all_ports(void);\n\nvoid bridge_update_all_addrs(void);\n\nvoid bridge_update_all_ifs(void);\n\nvoid bridge_update_all(void *arg);\n\nvoid bridge_update_tc_time(void *arg);\n\nvoid bridge_ifs_dump(void);\n\n/* Bridge ports. */\nvoid bridge_ports_update_listage(void);\n\nvoid bridge_ports_fini(void);\n\nvoid bridge_members_free(struct bridge_if *bif);\n\nstruct bridge_port *bridge_new_port(struct mibif *mif, struct bridge_if *bif);\n\nvoid bridge_port_remove(struct bridge_port *bp, struct bridge_if *bif);\n\nstruct bridge_port *bridge_port_bif_first(struct bridge_if *bif);\n\nstruct bridge_port *bridge_port_bif_next(struct bridge_port *bp);\n\nstruct bridge_port *bridge_port_find(int32_t if_idx, struct bridge_if *bif);\n\nvoid bridge_port_getinfo_mibif(struct mibif *m_if, struct bridge_port *bp);\n\nint bridge_getinfo_bif_ports(struct bridge_if *bif);\n\nint bridge_update_memif(struct bridge_if *bif);\n\nvoid bridge_ports_dump(struct bridge_if *bif);\n\n/* Bridge addresses. */\nvoid bridge_addrs_update_listage(void);\n\nvoid bridge_addrs_fini(void);\n\nvoid bridge_addrs_free(struct bridge_if *bif);\n\nstruct tp_entry *bridge_new_addrs(uint8_t *mac, struct bridge_if *bif);\n\nvoid bridge_addrs_remove(struct tp_entry *te, struct bridge_if *bif);\n\nstruct tp_entry *bridge_addrs_find(uint8_t *mac, struct bridge_if *bif);\n\nstruct tp_entry *bridge_addrs_bif_first(struct bridge_if *bif);\n\nstruct tp_entry *bridge_addrs_bif_next(struct tp_entry *te);\n\nint bridge_getinfo_bif_addrs(struct bridge_if *bif);\n\nint bridge_update_addrs(struct bridge_if *bif);\n\nvoid bridge_addrs_dump(struct bridge_if *bif);\n\n/* Bridge PF. */\n\nvoid bridge_pf_dump(void);\n\n/* System specific. */\n\n/* Open the socket for the ioctls. */\nint bridge_ioctl_init(void);\n\n/* Load bridge kernel module. */\nint bridge_kmod_load(void);\n\n/* Get the bridge interface information. */\nint bridge_getinfo_bif(struct bridge_if *bif);\n\n/* Get the bridge interface STP parameters. */\nint bridge_get_op_param(struct bridge_if *bif);\n\n/* Set the bridge priority. */\nint bridge_set_priority(struct bridge_if *bif, int32_t priority);\n\n/* Set the bridge max age. */\nint bridge_set_maxage(struct bridge_if *bif, int32_t max_age);\n\n/* Set the bridge hello time.*/\nint bridge_set_hello_time(struct bridge_if *bif, int32_t hello_time);\n\n/* Set the bridge forward delay.*/\nint bridge_set_forward_delay(struct bridge_if *bif, int32_t fwd_delay);\n\n/* Set the bridge address cache max age. */\nint bridge_set_aging_time(struct bridge_if *bif, int32_t age_time);\n\n/* Set the max number of entries in the bridge address cache. */\nint bridge_set_max_cache(struct bridge_if *bif, int32_t max_cache);\n\n/* Set the bridge TX hold count. */\nint bridge_set_tx_hold_count(struct bridge_if *bif, int32_t tx_hc);\n\n/* Set the bridge STP protocol version. */\nint bridge_set_stp_version(struct bridge_if *bif, int32_t stp_proto);\n\n/* Set the bridge interface status to up/down. */\nint bridge_set_if_up(const char* b_name, int8_t up);\n\n/* Create a bridge interface. */\nint bridge_create(const char *b_name);\n\n/* Destroy a bridge interface. */\nint bridge_destroy(const char *b_name);\n\n/* Fetch the bridge mac address. */\nu_char *bridge_get_basemac(const char *bif_name, u_char *mac, size_t mlen);\n\n/* Set a bridge member priority. */\nint bridge_port_set_priority(const char *bif_name, struct bridge_port *bp,\n    int32_t priority);\n\n/* Set a bridge member STP-enabled flag. */\nint bridge_port_set_stp_enable(const char *bif_name, struct bridge_port *bp,\n    uint32_t enable);\n\n/* Set a bridge member STP path cost. */\nint bridge_port_set_path_cost(const char *bif_name, struct bridge_port *bp,\n    int32_t path_cost);\n\n/* Set admin point-to-point link. */\nint bridge_port_set_admin_ptp(const char *bif_name, struct bridge_port *bp,\n    uint32_t admin_ptp);\n\n/* Set admin edge. */\nint bridge_port_set_admin_edge(const char *bif_name, struct bridge_port *bp,\n    uint32_t enable);\n\n/* Set 'private' flag. */\nint bridge_port_set_private(const char *bif_name, struct bridge_port *bp,\n    uint32_t priv_set);\n\n/* Add a bridge member port. */\nint bridge_port_addm(struct bridge_port *bp, const char *b_name);\n\n/* Delete a bridge member port. */\nint bridge_port_delm(struct bridge_port *bp, const char *b_name);\n\n/* Get the current value from the module for bridge PF control. */\nint32_t bridge_get_pfval(uint8_t which);\n\n/* Get/Set a bridge PF control. */\nint32_t bridge_do_pfctl(int32_t bridge_ctl, enum snmp_op op, int32_t *val);\n\n#endif /* SNMP_BRIDGE_H */\n"
  },
  {
    "path": "freebsd-headers/bsnmp/snmp.h",
    "content": "/*\n * Copyright (c) 2001-2003\n *\tFraunhofer Institute for Open Communication Systems (FhG Fokus).\n *\tAll rights reserved.\n *\n * Author: Harti Brandt <harti@freebsd.org>\n * \n * Copyright (c) 2010 The FreeBSD Foundation\n * All rights reserved.\n *\n * Portions of this software were developed by Shteryana Sotirova Shopova\n * under sponsorship from the FreeBSD Foundation.\n *\n * \n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * \n * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $Begemot: bsnmp/lib/snmp.h,v 1.30 2004/08/06 08:46:54 brandt Exp $\n *\n * Header file for SNMP functions.\n */\n#ifndef snmp_h_\n#define snmp_h_\n\n#include <sys/types.h>\n\n#define SNMP_COMMUNITY_MAXLEN\t\t128\n#define SNMP_MAX_BINDINGS\t\t100\n#define\tSNMP_CONTEXT_NAME_SIZ\t\t(32 + 1)\n#define\tSNMP_ENGINE_ID_SIZ\t\t32\n#define\tSNMP_TIME_WINDOW\t\t150\n\nenum snmp_syntax {\n\tSNMP_SYNTAX_NULL\t= 0,\n\tSNMP_SYNTAX_INTEGER,\t\t/* == INTEGER32 */\n\tSNMP_SYNTAX_OCTETSTRING,\n\tSNMP_SYNTAX_OID,\n\tSNMP_SYNTAX_IPADDRESS,\n\tSNMP_SYNTAX_COUNTER,\n\tSNMP_SYNTAX_GAUGE,\t\t/* == UNSIGNED32 */\n\tSNMP_SYNTAX_TIMETICKS,\n\n\t/* v2 additions */\n\tSNMP_SYNTAX_COUNTER64,\n\tSNMP_SYNTAX_NOSUCHOBJECT,\t/* exception */\n\tSNMP_SYNTAX_NOSUCHINSTANCE,\t/* exception */\n\tSNMP_SYNTAX_ENDOFMIBVIEW,\t/* exception */\n};\n\nstruct snmp_value {\n\tstruct asn_oid\t\tvar;\n\tenum snmp_syntax\tsyntax;\n\tunion snmp_values {\n\t  int32_t\t\tinteger;\t/* also integer32 */\n\t  struct {\n\t    u_int\t\tlen;\n\t    u_char\t\t*octets;\n\t  }\t\t\toctetstring;\n\t  struct asn_oid\toid;\n\t  u_char\t\tipaddress[4];\n\t  uint32_t\t\tuint32;\t\t/* also gauge32, counter32,\n\t\t\t\t\t\t   unsigned32, timeticks */\n\t  uint64_t\t\tcounter64;\n\t}\t\t\tv;\n};\n\nenum snmp_version {\n\tSNMP_Verr = 0,\n\tSNMP_V1 = 1,\n\tSNMP_V2c = 2,\n\tSNMP_V3,\n};\n\n#define\tSNMP_MPM_SNMP_V1\t\t0\n#define\tSNMP_MPM_SNMP_V2c\t\t1\n#define\tSNMP_MPM_SNMP_V3\t\t3\n\n#define\tSNMP_ADM_STR32_SIZ\t\t(32 + 1)\n#define\tSNMP_AUTH_KEY_SIZ\t\t40\n#define\tSNMP_PRIV_KEY_SIZ\t\t32\n#define\tSNMP_USM_AUTH_SIZE\t\t12\n#define\tSNMP_USM_PRIV_SIZE\t\t8\n#define\tSNMP_AUTH_HMACMD5_KEY_SIZ\t16\n#define\tSNMP_AUTH_HMACSHA_KEY_SIZ\t20\n#define\tSNMP_PRIV_AES_KEY_SIZ\t\t16\n#define\tSNMP_PRIV_DES_KEY_SIZ\t\t8\n\n\nenum snmp_secmodel {\n\tSNMP_SECMODEL_ANY = 0,\n\tSNMP_SECMODEL_SNMPv1 = 1,\n\tSNMP_SECMODEL_SNMPv2c = 2,\n\tSNMP_SECMODEL_USM = 3,\n\tSNMP_SECMODEL_UNKNOWN\n};\n\nenum snmp_usm_level {\n\tSNMP_noAuthNoPriv = 1,\n\tSNMP_authNoPriv = 2,\n\tSNMP_authPriv = 3\n};\n\nenum snmp_authentication {\n\tSNMP_AUTH_NOAUTH = 0,\n\tSNMP_AUTH_HMAC_MD5,\n\tSNMP_AUTH_HMAC_SHA\n};\n\nenum snmp_privacy {\n\tSNMP_PRIV_NOPRIV = 0,\n\tSNMP_PRIV_DES = 1,\n\tSNMP_PRIV_AES\n};\n\nstruct snmp_engine {\n\tuint8_t\t\t\tengine_id[SNMP_ENGINE_ID_SIZ];\n\tuint32_t\t\tengine_len;\n\tint32_t\t\t\tengine_boots;\n\tint32_t\t\t\tengine_time;\n\tint32_t\t\t\tmax_msg_size;\n};\n\nstruct snmp_user {\n\tchar\t\t\t\tsec_name[SNMP_ADM_STR32_SIZ];\n\tenum snmp_authentication\tauth_proto;\n\tenum snmp_privacy\t\tpriv_proto;\n\tuint8_t\t\t\t\tauth_key[SNMP_AUTH_KEY_SIZ];\n\tuint8_t\t\t\t\tpriv_key[SNMP_PRIV_KEY_SIZ];\n};\n\nstruct snmp_pdu {\n\tchar\t\t\tcommunity[SNMP_COMMUNITY_MAXLEN + 1];\n\tenum snmp_version\tversion;\n\tu_int\t\t\ttype;\n\n\t/* SNMPv3 PDU header fields */\n\tint32_t\t\t\tidentifier;\n\tuint8_t\t\t\tflags;\n\tint32_t\t\t\tsecurity_model;\n\tstruct snmp_engine\tengine;\n\n\t/* Associated USM user parameters */\n\tstruct snmp_user\tuser;\n\tuint8_t\t\t\tmsg_digest[SNMP_USM_AUTH_SIZE];\n\tuint8_t\t\t\tmsg_salt[SNMP_USM_PRIV_SIZE];\n\n\t/*  View-based Access Model */\n\t/* XXX: put in separate structure - conflicts with struct snmp_context */\n\tuint32_t\t\tcontext_engine_len;\n\tuint8_t\t\t\tcontext_engine[SNMP_ENGINE_ID_SIZ];\n\tchar\t\t\tcontext_name[SNMP_CONTEXT_NAME_SIZ];\n\n\t/* trap only */\n\tstruct asn_oid\t\tenterprise;\n\tu_char\t\t\tagent_addr[4];\n\tint32_t\t\t\tgeneric_trap;\n\tint32_t\t\t\tspecific_trap;\n\tuint32_t\t\ttime_stamp;\n\n\t/* others */\n\tint32_t\t\t\trequest_id;\n\tint32_t\t\t\terror_status;\n\tint32_t\t\t\terror_index;\n\n\t/* fixes for encoding */\n\tsize_t\t\t\touter_len;\n\tsize_t\t\t\tscoped_len;\n\tu_char\t\t\t*outer_ptr;\n\tu_char\t\t\t*digest_ptr;\n\tu_char\t\t\t*encrypted_ptr;\n\tu_char\t\t\t*scoped_ptr;\n\tu_char\t\t\t*pdu_ptr;\n\tu_char\t\t\t*vars_ptr;\n\n\n\tstruct snmp_value\tbindings[SNMP_MAX_BINDINGS];\n\tu_int\t\t\tnbindings;\n};\n#define snmp_v1_pdu snmp_pdu\n\n#define SNMP_PDU_GET\t\t0\n#define SNMP_PDU_GETNEXT\t1\n#define SNMP_PDU_RESPONSE\t2\n#define SNMP_PDU_SET\t\t3\n#define SNMP_PDU_TRAP\t\t4\t/* v1 */\n#define SNMP_PDU_GETBULK\t5\t/* v2 */\n#define SNMP_PDU_INFORM\t\t6\t/* v2 */\n#define SNMP_PDU_TRAP2\t\t7\t/* v2 */\n#define SNMP_PDU_REPORT\t\t8\t/* v2 */\n\n#define SNMP_ERR_NOERROR\t0\n#define SNMP_ERR_TOOBIG\t\t1\n#define SNMP_ERR_NOSUCHNAME\t2\t/* v1 */\n#define SNMP_ERR_BADVALUE\t3\t/* v1 */\n#define SNMP_ERR_READONLY\t4\t/* v1 */\n#define SNMP_ERR_GENERR\t\t5\n#define SNMP_ERR_NO_ACCESS\t6\t/* v2 */\n#define SNMP_ERR_WRONG_TYPE\t7\t/* v2 */\n#define SNMP_ERR_WRONG_LENGTH\t8\t/* v2 */\n#define SNMP_ERR_WRONG_ENCODING\t9\t/* v2 */\n#define SNMP_ERR_WRONG_VALUE\t10\t/* v2 */\n#define SNMP_ERR_NO_CREATION\t11\t/* v2 */\n#define SNMP_ERR_INCONS_VALUE\t12\t/* v2 */\n#define SNMP_ERR_RES_UNAVAIL\t13\t/* v2 */\n#define SNMP_ERR_COMMIT_FAILED\t14\t/* v2 */\n#define SNMP_ERR_UNDO_FAILED\t15\t/* v2 */\n#define SNMP_ERR_AUTH_ERR\t16\t/* v2 */\n#define SNMP_ERR_NOT_WRITEABLE\t17\t/* v2 */\n#define SNMP_ERR_INCONS_NAME\t18\t/* v2 */\n\n#define SNMP_TRAP_COLDSTART\t0\n#define SNMP_TRAP_WARMSTART\t1\n#define SNMP_TRAP_LINKDOWN\t2\n#define SNMP_TRAP_LINKUP\t3\n#define SNMP_TRAP_AUTHENTICATION_FAILURE\t4\n#define SNMP_TRAP_EGP_NEIGHBOR_LOSS\t5\n#define SNMP_TRAP_ENTERPRISE\t6\n\nenum snmp_code {\n\tSNMP_CODE_OK = 0,\n\tSNMP_CODE_FAILED,\n\tSNMP_CODE_BADVERS,\n\tSNMP_CODE_BADLEN,\n\tSNMP_CODE_BADENC,\n\tSNMP_CODE_OORANGE,\n\tSNMP_CODE_BADSECLEVEL,\n\tSNMP_CODE_NOTINTIME,\n\tSNMP_CODE_BADUSER,\n\tSNMP_CODE_BADENGINE,\n\tSNMP_CODE_BADDIGEST,\n\tSNMP_CODE_EDECRYPT\n};\n\n#define\tSNMP_MSG_AUTH_FLAG\t\t0x1\n#define\tSNMP_MSG_PRIV_FLAG\t\t0x2\n#define\tSNMP_MSG_REPORT_FLAG\t\t0x4\n#define\tSNMP_MSG_AUTODISCOVER\t\t0x80\n\nvoid snmp_value_free(struct snmp_value *);\nint snmp_value_parse(const char *, enum snmp_syntax, union snmp_values *);\nint snmp_value_copy(struct snmp_value *, const struct snmp_value *);\n\nvoid snmp_pdu_free(struct snmp_pdu *);\nvoid snmp_pdu_init_secparams(struct snmp_pdu *);\nenum snmp_code snmp_pdu_decode(struct asn_buf *b, struct snmp_pdu *pdu, int32_t *);\nenum snmp_code snmp_pdu_decode_header(struct asn_buf *, struct snmp_pdu *);\nenum snmp_code snmp_pdu_decode_scoped(struct asn_buf *, struct snmp_pdu *, int32_t *);\nenum snmp_code snmp_pdu_encode(struct snmp_pdu *, struct asn_buf *);\nenum snmp_code snmp_pdu_decode_secmode(struct asn_buf *, struct snmp_pdu *);\n\nint snmp_pdu_snoop(const struct asn_buf *);\n\nvoid snmp_pdu_dump(const struct snmp_pdu *pdu);\n\nenum snmp_code snmp_passwd_to_keys(struct snmp_user *, char *);\nenum snmp_code snmp_get_local_keys(struct snmp_user *, uint8_t *, uint32_t);\nenum snmp_code snmp_calc_keychange(struct snmp_user *, uint8_t *);\n\nextern void (*snmp_error)(const char *, ...);\nextern void (*snmp_printf)(const char *, ...);\n\n#define TRUTH_MK(F) ((F) ? 1 : 2)\n#define TRUTH_GET(T) (((T) == 1) ? 1 : 0)\n#define TRUTH_OK(T)  ((T) == 1 || (T) == 2)\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/bsnmp/snmp_atm.h",
    "content": "/*\n * Copyright (c) 2001-2002\n *\tFraunhofer Institute for Open Communication Systems (FhG Fokus).\n *\tAll rights reserved.\n * Copyright (c) 2003-2004\n *\tHartmut Brandt\n *\tAll rights reserved.\n *\n * Author: Hartmut Brandt <harti@freebsd.org>\n * \n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * \n * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $Begemot: libunimsg/snmp_atm/snmp_atm.h,v 1.2 2004/08/06 17:30:40 brandt Exp $\n */\n#ifndef _BSNMP_SNMP_ATM_H\n#define _BSNMP_SNMP_ATM_H\n\nenum atmif_notify {\n\tATMIF_NOTIFY_DESTROY,\t/* interface has been destroyed */\n\tATMIF_NOTIFY_CARRIER,\t/* carriere change */\n\tATMIF_NOTIFY_VCC\t/* VCC change */\n};\n\nenum atmif_carrier_state {\n\tATMIF_CARRIER_ON\t= 1,\n\tATMIF_CARRIER_OFF\t= 2,\n\tATMIF_CARRIER_UNKNOWN\t= 3,\n\tATMIF_CARRIER_NONE\t= 4\n};\n\nenum atmif_suni_mode {\n\tATMIF_SUNI_MODE_SONET\t= 1,\n\tATMIF_SUNI_MODE_SDH\t= 2,\n\tATMIF_SUNI_MODE_UNKNOWN\t= 3\n};\n\n/* forward declaration */\nstruct atmif;\ntypedef void (*atmif_event_f)(struct atmif *, enum atmif_notify, uintptr_t,\n    void *);\n\nstruct atmif_mib {\n\tu_int\tversion;\t/* currently 0 */\n\n\tu_int\tdevice;\t\t/* type of hardware (system specific) */\n\tu_int\tserial;\t\t/* card serial number (device specific) */\n\tu_int\thw_version;\t/* card version (device specific) */\n\tu_int\tsw_version;\t/* firmware version (device specific) */\n\tu_int\tmedia;\t\t/* physical media (see MIB) */\n\n\tu_char\tesi[6];\t\t/* end system identifier (MAC) */\n\tu_int\tpcr;\t\t/* supported peak cell rate */\n\tu_int\tvpi_bits;\t/* number of used bits in VPI field */\n\tu_int\tvci_bits;\t/* number of used bits in VCI field */\n\tu_int\tmax_vpcs;\t/* maximum number of VPCs */\n\tu_int\tmax_vccs;\t/* maximum number of VCCs */\n};\n\nstruct atmif {\n\tstruct mibif\t*ifp;\t\t/* common interface data */\n\tstruct atmif_mib *mib;\t\t/* ATM MIB */\n\tenum atmif_carrier_state carrier;\n\tenum atmif_suni_mode mode;\t/* SUNI mode SDH or SONET */\n};\n\n/* find an ATM interface by name */\nstruct atmif *atm_find_if_name(const char *);\n\n/* get the interface from the interface index */\nstruct atmif *atm_find_if(u_int);\n\n/* register for notifications */\nvoid *atm_notify_aif(struct atmif *, const struct lmodule *mod,\n    atmif_event_f, void *);\nvoid atm_unnotify_aif(void *);\n\n/* return the If for a system-specific node number */\nstruct atmif *atm_node2if(u_int);\n\n/* return the node id for the if */\nu_int atm_if2node(struct atmif *);\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/bsnmp/snmp_mibII.h",
    "content": "/*\n * Copyright (c) 2001-2003\n *\tFraunhofer Institute for Open Communication Systems (FhG Fokus).\n *\tAll rights reserved.\n *\n * Author: Harti Brandt <harti@freebsd.org>\n * \n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * \n * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $Begemot: bsnmp/snmp_mibII/snmp_mibII.h,v 1.18 2006/02/14 09:04:19 brandt_h Exp $\n *\n * Implementation of the interfaces and IP groups of MIB-II.\n */\n#ifndef snmp_mibII_h_\n#define snmp_mibII_h_\n\n/* forward declaration */\nstruct mibif;\n\nenum mibif_notify {\n\tMIBIF_NOTIFY_DESTROY\n};\n\ntypedef void (*mibif_notify_f)(struct mibif *, enum mibif_notify, void *);\n\n/*\n * Interfaces. This structure describes one interface as seen in the MIB.\n * Interfaces are indexed by ifindex. This is not the same as the index\n * used by the system because of the rules in RFC-2863 section 3.1.5. This\n * RFC requires, that an ifindex is not to be re-used for ANOTHER dynamically\n * interfaces once the interface was deleted. The system's ifindex is in\n * sysindex. Mapping is via the mapping table below.\n */\nstruct mibif {\n\tTAILQ_ENTRY(mibif) link;\n\tu_int\t\tflags;\n\tu_int\t\tindex;\t\t/* the logical ifindex */\n\tu_int\t\tsysindex;\n\tchar\t\tname[IFNAMSIZ];\n\tchar\t\tdescr[256];\n\tstruct ifmibdata mib;\n\tuint64_t\tmibtick;\n\tvoid\t\t*specmib;\n\tsize_t\t\tspecmiblen;\n\tu_char\t\t*physaddr;\n\tu_int\t\tphysaddrlen;\n\tint\t\thas_connector;\n\tint\t\ttrap_enable;\n\tuint64_t\tcounter_disc;\n\n\t/*\n\t * This is needed to handle interface type specific information\n\t * in sub-modules. It contains a function pointer which handles\n\t * notifications and a data pointer to arbitrary data.\n\t * Should be set via the mibif_notify function.\n\t */\n\tmibif_notify_f\txnotify;\n\tvoid\t\t*xnotify_data;\n\tconst struct lmodule *xnotify_mod;\n\n\t/* to be set by ifType specific modules. This is ifSpecific. */\n\tstruct asn_oid\tspec_oid;\n\n\t/* private data - don't touch */\n\tvoid\t\t*private;\n};\n\n/*\n * Interface IP-address table.\n */\nstruct mibifa {\n\tTAILQ_ENTRY(mibifa) link;\n\tstruct in_addr\tinaddr;\n\tstruct in_addr\tinmask;\n\tstruct in_addr\tinbcast;\n\tstruct asn_oid\tindex;\t\t/* index for table search */\n\tu_int\t\tifindex;\n\tu_int\t\tflags;\n};\n\n/*\n * Interface receive addresses. Interface link-level multicast, broadcast\n * and hardware addresses are handled automatically.\n */\nstruct mibrcvaddr {\n\tTAILQ_ENTRY(mibrcvaddr) link;\n\tstruct asn_oid\tindex;\n\tu_int\t\tifindex;\n\tu_char\t\taddr[ASN_MAXOIDLEN];\n\tsize_t\t\taddrlen;\n\tu_int\t\tflags;\n};\nenum {\n\tMIBRCVADDR_VOLATILE\t= 0x00000001,\n\tMIBRCVADDR_BCAST\t= 0x00000002,\n\tMIBRCVADDR_HW\t\t= 0x00000004,\n};\n\n/* network socket */\nextern int mib_netsock;\n\n/* set an interface name to dynamic mode */\nvoid mib_if_set_dyn(const char *);\n\n/* re-read the systems interface list */\nvoid mib_refresh_iflist(void);\n\n/* find interface by index */\nstruct mibif *mib_find_if(u_int);\nstruct mibif *mib_find_if_sys(u_int);\nstruct mibif *mib_find_if_name(const char *);\n\n/* iterate through all interfaces */\nstruct mibif *mib_first_if(void);\nstruct mibif *mib_next_if(const struct mibif *);\n\n/* register for interface creations */\nint mib_register_newif(int (*)(struct mibif *), const struct lmodule *);\nvoid mib_unregister_newif(const struct lmodule *);\n\n/* get fresh MIB data */\nint mib_fetch_ifmib(struct mibif *);\n\n/* change the ADMIN status of an interface and refresh the MIB */\nint mib_if_admin(struct mibif *, int up);\n\n/* find interface address by address */\nstruct mibifa *mib_find_ifa(struct in_addr);\n\n/* find first/next address for a given interface */\nstruct mibifa *mib_first_ififa(const struct mibif *);\nstruct mibifa *mib_next_ififa(struct mibifa *);\n\n/* create/delete stacking entries */\nint mib_ifstack_create(const struct mibif *lower, const struct mibif *upper);\nvoid mib_ifstack_delete(const struct mibif *lower, const struct mibif *upper);\n\n/* find receive address */\nstruct mibrcvaddr *mib_find_rcvaddr(u_int, const u_char *, size_t);\n\n/* create/delete receive addresses */\nstruct mibrcvaddr *mib_rcvaddr_create(struct mibif *, const u_char *, size_t);\nvoid mib_rcvaddr_delete(struct mibrcvaddr *);\n\n/* register for interface notification */\nvoid *mibif_notify(struct mibif *, const struct lmodule *, mibif_notify_f,\n    void *);\nvoid mibif_unnotify(void *);\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/bsnmp/snmp_netgraph.h",
    "content": "/*\n * Copyright (c) 2001-2003\n *\tFraunhofer Institute for Open Communication Systems (FhG Fokus).\n *\tAll rights reserved.\n *\n * Author: Harti Brandt <harti@freebsd.org>\n *\n * Redistribution of this software and documentation and use in source and\n * binary forms, with or without modification, are permitted provided that\n * the following conditions are met:\n *\n * 1. Redistributions of source code or documentation must retain the above\n *    copyright notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE AND DOCUMENTATION IS PROVIDED BY FRAUNHOFER FOKUS\n * AND ITS CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,\n * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND\n * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL\n * FRAUNHOFER FOKUS OR ITS CONTRIBUTORS  BE LIABLE FOR ANY DIRECT, INDIRECT,\n * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,\n * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF\n * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING\n * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,\n * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/usr.sbin/bsnmpd/modules/snmp_netgraph/snmp_netgraph.h 122405 2003-11-10 09:17:34Z harti $\n *\n * Netgraph interface for SNMPd. Exported stuff.\n */\n#ifndef SNMP_NETGRAPH_H_\n#define SNMP_NETGRAPH_H_\n\n#include <netgraph/ng_message.h>\n\nextern ng_ID_t\tsnmp_node;\nextern u_char *snmp_nodename;\n\ntypedef void ng_cookie_f(const struct ng_mesg *, const char *, ng_ID_t, void *);\ntypedef void ng_hook_f(const char *, const u_char *, size_t, void *);\n\nvoid *ng_register_cookie(const struct lmodule *, u_int32_t cookie,\n    ng_ID_t, ng_cookie_f *, void *);\nvoid ng_unregister_cookie(void *reg);\n\nvoid *ng_register_hook(const struct lmodule *, const char *,\n    ng_hook_f *, void *);\nvoid ng_unregister_hook(void *reg);\n\nvoid ng_unregister_module(const struct lmodule *);\n\nint ng_output(const char *path, u_int cookie, u_int opcode,\n    const void *arg, size_t arglen);\nint ng_output_node(const char *node, u_int cookie, u_int opcode,\n    const void *arg, size_t arglen);\nint ng_output_id(ng_ID_t node, u_int cookie, u_int opcode,\n    const void *arg, size_t arglen);\n\nstruct ng_mesg *ng_dialog(const char *path, u_int cookie, u_int opcode,\n    const void *arg, size_t arglen);\nstruct ng_mesg *ng_dialog_node(const char *node, u_int cookie, u_int opcode,\n    const void *arg, size_t arglen);\nstruct ng_mesg *ng_dialog_id(ng_ID_t id, u_int cookie, u_int opcode,\n    const void *arg, size_t arglen);\n\nint ng_send_data(const char *hook, const void *sndbuf, size_t sndlen);\n\nng_ID_t ng_mkpeer_id(ng_ID_t, const char *name, const char *type,\n    const char *hook, const char *peerhook);\nint ng_connect_node(const char *node, const char *ourhook, const char *peerhook);\nint ng_connect_id(ng_ID_t id, const char *ourhook, const char *peerhook);\nint ng_connect2_id(ng_ID_t id, ng_ID_t peer, const char *ourhook,\n    const char *peerhook);\nint ng_connect2_tee_id(ng_ID_t id, ng_ID_t peer, const char *ourhook,\n    const char *peerhook);\nint ng_rmhook(const char *ourhook);\nint ng_rmhook_id(ng_ID_t, const char *);\nint ng_rmhook_tee_id(ng_ID_t, const char *);\nint ng_shutdown_id(ng_ID_t);\n\nng_ID_t ng_next_node_id(ng_ID_t node, const char *type, const char *hook);\nng_ID_t ng_node_id(const char *path);\nng_ID_t ng_node_id_node(const char *node);\nng_ID_t ng_node_name(ng_ID_t, char *);\nng_ID_t ng_node_type(ng_ID_t, char *);\nint ng_peer_hook_id(ng_ID_t, const char *, char *);\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/bsnmp/snmpagent.h",
    "content": "/*\n * Copyright (c) 2001-2003\n *\tFraunhofer Institute for Open Communication Systems (FhG Fokus).\n *\tAll rights reserved.\n *\n * Author: Harti Brandt <harti@freebsd.org>\n * \n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * \n * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $Begemot: bsnmp/lib/snmpagent.h,v 1.13 2004/08/06 08:46:56 brandt Exp $\n *\n * Header file for SNMP functions. This requires snmp.h to be included.\n */\n#ifndef snmp_agent_h_\n#define snmp_agent_h_\n\nstruct snmp_dependency;\n\nenum snmp_ret {\n\t/* OK, generate a response */\n\tSNMP_RET_OK\t= 0,\n\t/* Error, ignore packet (no response) */\n\tSNMP_RET_IGN\t= 1,\n\t/* Error, generate response from original packet */\n\tSNMP_RET_ERR\t= 2\n};\n\n/* Semi-Opaque object for SET operations */\nstruct snmp_context {\n\tu_int\tvar_index;\n\tstruct snmp_scratch *scratch;\n\tstruct snmp_dependency *dep;\n\tvoid\t*data;\t\t/* user data */\n\tenum snmp_ret code;\t/* return code */\n};\n\nstruct snmp_scratch {\n\tvoid\t\t*ptr1;\n\tvoid\t\t*ptr2;\n\tuint32_t\tint1;\n\tuint32_t\tint2;\n};\n\nenum snmp_depop {\n\tSNMP_DEPOP_COMMIT,\n\tSNMP_DEPOP_ROLLBACK,\n\tSNMP_DEPOP_FINISH\n};\n\ntypedef int (*snmp_depop_t)(struct snmp_context *, struct snmp_dependency *,\n    enum snmp_depop);\n\nstruct snmp_dependency {\n\tstruct asn_oid\tobj;\n\tstruct asn_oid\tidx;\n};\n\n/*\n * The TREE\n */\nenum snmp_node_type {\n\tSNMP_NODE_LEAF = 1,\n\tSNMP_NODE_COLUMN\n};\n\nenum snmp_op {\n\tSNMP_OP_GET \t= 1,\n\tSNMP_OP_GETNEXT,\n\tSNMP_OP_SET,\n\tSNMP_OP_COMMIT,\n\tSNMP_OP_ROLLBACK,\n};\n\ntypedef int (*snmp_op_t)(struct snmp_context *, struct snmp_value *,\n    u_int, u_int, enum snmp_op);\n\nstruct snmp_node {\n\tstruct asn_oid oid;\n\tconst char\t*name;\t\t/* name of the leaf */\n\tenum snmp_node_type type;\t/* type of this node */\n\tenum snmp_syntax syntax;\n\tsnmp_op_t\top;\n\tu_int\t\tflags;\n\tuint32_t\tindex;\t\t/* index data */\n\tvoid\t\t*data;\t\t/* application data */\n\tvoid\t\t*tree_data;\t/* application data */\n};\nextern struct snmp_node *tree;\nextern u_int  tree_size;\n\n#define SNMP_NODE_CANSET\t0x0001\t/* SET allowed */\n\n#define SNMP_INDEXES_MAX\t7\n#define SNMP_INDEX_SHIFT\t4\n#define SNMP_INDEX_MASK\t0xf\n#define SNMP_INDEX_COUNT(V)\t((V) & SNMP_INDEX_MASK)\n#define SNMP_INDEX(V,I) \\\n\t(((V) >> (((I) + 1) * SNMP_INDEX_SHIFT)) & SNMP_INDEX_MASK)\n\nenum {\n\tSNMP_TRACE_GET\t\t= 0x00000001,\n\tSNMP_TRACE_GETNEXT\t= 0x00000002,\n\tSNMP_TRACE_SET\t\t= 0x00000004,\n\tSNMP_TRACE_DEPEND\t= 0x00000008,\n\tSNMP_TRACE_FIND\t\t= 0x00000010,\n};\n/* trace flag for the following functions */\nextern u_int snmp_trace;\n\n/* called to write the trace */\nextern void (*snmp_debug)(const char *fmt, ...);\n\nenum snmp_ret snmp_get(struct snmp_pdu *pdu, struct asn_buf *resp_b,\n    struct snmp_pdu *resp, void *);\nenum snmp_ret snmp_getnext(struct snmp_pdu *pdu, struct asn_buf *resp_b,\n    struct snmp_pdu *resp, void *);\nenum snmp_ret snmp_getbulk(struct snmp_pdu *pdu, struct asn_buf *resp_b,\n    struct snmp_pdu *resp, void *);\nenum snmp_ret snmp_set(struct snmp_pdu *pdu, struct asn_buf *resp_b,\n    struct snmp_pdu *resp, void *);\n\nenum snmp_ret snmp_make_errresp(const struct snmp_pdu *, struct asn_buf *,\n    struct asn_buf *);\n\nstruct snmp_dependency *snmp_dep_lookup(struct snmp_context *,\n    const struct asn_oid *, const struct asn_oid *, size_t, snmp_depop_t);\n\nstruct snmp_context *snmp_init_context(void);\nint snmp_dep_commit(struct snmp_context *);\nint snmp_dep_rollback(struct snmp_context *);\nvoid snmp_dep_finish(struct snmp_context *);\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/bsnmp/snmpclient.h",
    "content": "/*\n * Copyright (c) 2001-2003\n *\tFraunhofer Institute for Open Communication Systems (FhG Fokus).\n *\tAll rights reserved.\n *\n * Author: Harti Brandt <harti@freebsd.org>\n *\t   Kendy Kutzner\n * \n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * \n * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $Begemot: bsnmp/lib/snmpclient.h,v 1.19 2005/05/23 11:10:14 brandt_h Exp $\n */\n#ifndef _BSNMP_SNMPCLIENT_H\n#define _BSNMP_SNMPCLIENT_H\n\n#include <sys/types.h>\n#include <sys/socket.h>\n#include <sys/time.h>\n#include <netinet/in.h>\n#include <stddef.h>\n\n\n#define SNMP_STRERROR_LEN 200\n\n#define SNMP_LOCAL_PATH\t\"/tmp/snmpXXXXXXXXXXXXXX\"\n\n/*\n * transport methods\n */\n#define\tSNMP_TRANS_UDP\t\t0\n#define\tSNMP_TRANS_LOC_DGRAM\t1\n#define\tSNMP_TRANS_LOC_STREAM\t2\n\n/* type of callback function for responses\n * this callback function is responsible for free() any memory associated with\n * any of the PDUs. Therefor it may call snmp_pdu_free() */\ntypedef void (*snmp_send_cb_f)(struct snmp_pdu *, struct snmp_pdu *, void *);\n\n/* type of callback function for timeouts */\ntypedef void (*snmp_timeout_cb_f)(void * );\n\n/* timeout start function */\ntypedef void *(*snmp_timeout_start_f)(struct timeval *timeout,  \n    snmp_timeout_cb_f callback, void *);\n\n/* timeout stop function */\ntypedef void (*snmp_timeout_stop_f)(void *timeout_id);\n\n/*\n * Client context.\n */\nstruct snmp_client {\n\tenum snmp_version\tversion;\n\tint\t\t\ttrans;\t/* which transport to use */\n\n\t/* these two are read-only for the application */\n\tchar\t\t\t*cport;\t/* port number as string */\n\tchar\t\t\t*chost;\t/* host name or IP address as string */\n\n\tchar\t\t\tread_community[SNMP_COMMUNITY_MAXLEN + 1];\n\tchar\t\t\twrite_community[SNMP_COMMUNITY_MAXLEN + 1];\n\n\t/* SNMPv3 specific fields */\n\tint32_t\t\t\tidentifier;\n\tint32_t\t\t\tsecurity_model;\n\tstruct snmp_engine\tengine;\n\tstruct snmp_user\tuser;\n\n\t/* SNMPv3 Access control - VACM*/\n\tuint32_t\t\tclen;\n\tuint8_t\t\t\tcengine[SNMP_ENGINE_ID_SIZ];\n\tchar\t\t\tcname[SNMP_CONTEXT_NAME_SIZ];\n\n\tstruct timeval\t\ttimeout;\n\tu_int\t\t\tretries;\n\n\tint\t\t\tdump_pdus;\n\n\tsize_t\t\t\ttxbuflen;\n\tsize_t\t\t\trxbuflen;\n\n\tint\t\t\tfd;\n\n\tint32_t\t\t\tnext_reqid;\n\tint32_t\t\t\tmax_reqid;\n\tint32_t\t\t\tmin_reqid;\n\n\tchar\t\t\terror[SNMP_STRERROR_LEN];\n\n\tsnmp_timeout_start_f\ttimeout_start;\n\tsnmp_timeout_stop_f\ttimeout_stop;\n\n\tchar\t\t\tlocal_path[sizeof(SNMP_LOCAL_PATH)];\n};\n\n/* the global context */\nextern struct snmp_client snmp_client;\n\n/* initizialies a snmp_client structure */\nvoid snmp_client_init(struct snmp_client *);\n\n/* initialize fields */\nint snmp_client_set_host(struct snmp_client *, const char *);\nint snmp_client_set_port(struct snmp_client *, const char *);\n\n/* open connection to snmp server (hostname or portname can be NULL) */\nint snmp_open(const char *_hostname, const char *_portname,\n    const char *_read_community, const char *_write_community);\n\n/* close connection */\nvoid snmp_close(void);\n\n/* initialize a snmp_pdu structure */\nvoid snmp_pdu_create(struct snmp_pdu *, u_int _op);\n\n/* add pairs of (struct asn_oid *, enum snmp_syntax) to an existing pdu */\nint snmp_add_binding(struct snmp_pdu *, ...);\n\n/* check wheater the answer is valid or not */\nint snmp_pdu_check(const struct snmp_pdu *_req, const struct snmp_pdu *_resp);\n\nint32_t snmp_pdu_send(struct snmp_pdu *_pdu, snmp_send_cb_f _func, void *_arg);\n\n/*  append an index to an oid */\nint snmp_oid_append(struct asn_oid *_oid, const char *_fmt, ...);\n\n/* receive a packet */\nint snmp_receive(int _blocking);\n\n/*\n * This structure is used to describe an SNMP table that is to be fetched.\n * The C-structure that is produced by the fetch function must start with\n * a TAILQ_ENTRY and an u_int64_t.\n */\nstruct snmp_table {\n\t/* base OID of the table */\n\tstruct asn_oid\t\ttable;\n\t/* type OID of the LastChange variable for the table if any */\n\tstruct asn_oid\t\tlast_change;\n\t/* maximum number of iterations if table has changed */\n\tu_int\t\t\tmax_iter;\n\t/* size of the C-structure */\n\tsize_t\t\t\tentry_size;\n\t/* number of index fields */\n\tu_int\t\t\tindex_size;\n\t/* bit mask of required fields */\n\tuint64_t\t\treq_mask;\n\n\t/* indexes and columns to fetch. Ended by a NULL syntax entry */\n\tstruct snmp_table_entry {\n\t    /* the column sub-oid, ignored for index fields */\n\t    asn_subid_t\t\tsubid;\n\t    /* the syntax of the column or index */\n\t    enum snmp_syntax\tsyntax;\n\t    /* offset of the field into the C-structure. For octet strings\n\t     * this points to an u_char * followed by a size_t */\n\t    off_t\t\toffset;\n#if defined(__GNUC__) && __GNUC__ < 3\n\t}\t\t\tentries[0];\n#else\n\t}\t\t\tentries[];\n#endif\n};\n\n/* callback type for table fetch */\ntypedef void (*snmp_table_cb_f)(void *_list, void *_arg, int _res);\n\n/* fetch a table. The argument points to a TAILQ_HEAD */\nint snmp_table_fetch(const struct snmp_table *descr, void *);\nint snmp_table_fetch_async(const struct snmp_table *, void *,\n    snmp_table_cb_f, void *);\n\n/* send a request and wait for the response */\nint snmp_dialog(struct snmp_pdu *_req, struct snmp_pdu *_resp);\n\n/* discover an authorative snmpEngineId */\nint snmp_discover_engine(char *);\n\n/* parse a server specification */\nint snmp_parse_server(struct snmp_client *, const char *);\n\n#endif /* _BSNMP_SNMPCLIENT_H */\n"
  },
  {
    "path": "freebsd-headers/bsnmp/snmpmod.h",
    "content": "/*\n * Copyright (c) 2001-2003\n *\tFraunhofer Institute for Open Communication Systems (FhG Fokus).\n *\tAll rights reserved.\n *\n * Author: Harti Brandt <harti@freebsd.org>\n * \n * Copyright (c) 2010 The FreeBSD Foundation\n * All rights reserved.\n *\n * Portions of this software were developed by Shteryana Sotirova Shopova\n * under sponsorship from the FreeBSD Foundation.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * \n * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $Begemot: bsnmp/snmpd/snmpmod.h,v 1.32 2006/02/14 09:04:20 brandt_h Exp $\n *\n * SNMP daemon data and functions exported to modules.\n */\n#ifndef snmpmod_h_\n#define snmpmod_h_\n\n#include <sys/types.h>\n#include <sys/socket.h>\n#include <net/if.h>\n#include <netinet/in.h>\n#include \"asn1.h\"\n#include \"snmp.h\"\n#include \"snmpagent.h\"\n\n#define MAX_MOD_ARGS\t16\n\n/*\n * These macros help to handle object lists for SNMP tables. They use\n * tail queues to hold the objects in ascending order in the list.\n * ordering can be done either on an integer/unsigned field, an asn_oid\n * or an ordering function.\n */\n#define INSERT_OBJECT_OID_LINK_INDEX(PTR, LIST, LINK, INDEX) do {\t\\\n\t__typeof (PTR) _lelem;\t\t\t\t\t\t\\\n\t\t\t\t\t\t\t\t\t\\\n\tTAILQ_FOREACH(_lelem, (LIST), LINK)\t\t\t\t\\\n\t\tif (asn_compare_oid(&_lelem->INDEX, &(PTR)->INDEX) > 0)\t\\\n\t\t\tbreak;\t\t\t\t\t\t\\\n\tif (_lelem == NULL)\t\t\t\t\t\t\\\n\t\tTAILQ_INSERT_TAIL((LIST), (PTR), LINK);\t\t\t\\\n\telse\t\t\t\t\t\t\t\t\\\n\t\tTAILQ_INSERT_BEFORE(_lelem, (PTR), LINK);\t\t\\\n    } while (0)\n\n#define INSERT_OBJECT_INT_LINK_INDEX(PTR, LIST, LINK, INDEX) do {\t\\\n\t__typeof (PTR) _lelem;\t\t\t\t\t\t\\\n\t\t\t\t\t\t\t\t\t\\\n\tTAILQ_FOREACH(_lelem, (LIST), LINK)\t\t\t\t\\\n\t\tif ((asn_subid_t)_lelem->INDEX > (asn_subid_t)(PTR)->INDEX)\\\n\t\t\tbreak;\t\t\t\t\t\t\\\n\tif (_lelem == NULL)\t\t\t\t\t\t\\\n\t\tTAILQ_INSERT_TAIL((LIST), (PTR), LINK);\t\t\t\\\n\telse\t\t\t\t\t\t\t\t\\\n\t\tTAILQ_INSERT_BEFORE(_lelem, (PTR), LINK);\t\t\\\n    } while (0)\n\n#define\tINSERT_OBJECT_FUNC_LINK(PTR, LIST, LINK, FUNC) do {\t\t\\\n\t__typeof (PTR) _lelem;\t\t\t\t\t\t\\\n\t\t\t\t\t\t\t\t\t\\\n\tTAILQ_FOREACH(_lelem, (LIST), LINK)\t\t\t\t\\\n\t\tif ((FUNC)(_lelem, (PTR)) > 0)\t\t\t\t\\\n\t\t\tbreak;\t\t\t\t\t\t\\\n\tif (_lelem == NULL)\t\t\t\t\t\t\\\n\t\tTAILQ_INSERT_TAIL((LIST), (PTR), LINK);\t\t\t\\\n\telse\t\t\t\t\t\t\t\t\\\n\t\tTAILQ_INSERT_BEFORE(_lelem, (PTR), LINK);\t\t\\\n    } while (0)\n\n#define\tINSERT_OBJECT_FUNC_LINK_REV(PTR, LIST, HEAD, LINK, FUNC) do {\t\\\n\t__typeof (PTR) _lelem;\t\t\t\t\t\t\\\n\t\t\t\t\t\t\t\t\t\\\n\tTAILQ_FOREACH_REVERSE(_lelem, (LIST), HEAD, LINK)\t\t\\\n\t\tif ((FUNC)(_lelem, (PTR)) < 0)\t\t\t\t\\\n\t\t\tbreak;\t\t\t\t\t\t\\\n\tif (_lelem == NULL)\t\t\t\t\t\t\\\n\t\tTAILQ_INSERT_HEAD((LIST), (PTR), LINK);\t\t\t\\\n\telse\t\t\t\t\t\t\t\t\\\n\t\tTAILQ_INSERT_AFTER((LIST), _lelem, (PTR), LINK);\t\\\n    } while (0)\n\n#define FIND_OBJECT_OID_LINK_INDEX(LIST, OID, SUB, LINK, INDEX) ({\t\\\n\t__typeof (TAILQ_FIRST(LIST)) _lelem;\t\t\t\t\\\n\t\t\t\t\t\t\t\t\t\\\n\tTAILQ_FOREACH(_lelem, (LIST), LINK)\t\t\t\t\\\n\t\tif (index_compare(OID, SUB, &_lelem->INDEX) == 0)\t\\\n\t\t\tbreak;\t\t\t\t\t\t\\\n\t(_lelem);\t\t\t\t\t\t\t\\\n    })\n\n#define NEXT_OBJECT_OID_LINK_INDEX(LIST, OID, SUB, LINK, INDEX) ({\t\\\n\t__typeof (TAILQ_FIRST(LIST)) _lelem;\t\t\t\t\\\n\t\t\t\t\t\t\t\t\t\\\n\tTAILQ_FOREACH(_lelem, (LIST), LINK)\t\t\t\t\\\n\t\tif (index_compare(OID, SUB, &_lelem->INDEX) < 0)\t\\\n\t\t\tbreak;\t\t\t\t\t\t\\\n\t(_lelem);\t\t\t\t\t\t\t\\\n    })\n\n#define FIND_OBJECT_INT_LINK_INDEX(LIST, OID, SUB, LINK, INDEX) ({\t\\\n\t__typeof (TAILQ_FIRST(LIST)) _lelem;\t\t\t\t\\\n\t\t\t\t\t\t\t\t\t\\\n\tif ((OID)->len - SUB != 1)\t\t\t\t\t\\\n\t\t_lelem = NULL;\t\t\t\t\t\t\\\n\telse\t\t\t\t\t\t\t\t\\\n\t\tTAILQ_FOREACH(_lelem, (LIST), LINK)\t\t\t\\\n\t\t\tif ((OID)->subs[SUB] == (asn_subid_t)_lelem->INDEX)\\\n\t\t\t\tbreak;\t\t\t\t\t\\\n\t(_lelem);\t\t\t\t\t\t\t\\\n    })\n\n#define NEXT_OBJECT_INT_LINK_INDEX(LIST, OID, SUB, LINK, INDEX) ({\t\\\n\t__typeof (TAILQ_FIRST(LIST)) _lelem;\t\t\t\t\\\n\t\t\t\t\t\t\t\t\t\\\n\tif ((OID)->len - SUB == 0)\t\t\t\t\t\\\n\t\t_lelem = TAILQ_FIRST(LIST);\t\t\t\t\\\n\telse\t\t\t\t\t\t\t\t\\\n\t\tTAILQ_FOREACH(_lelem, (LIST), LINK)\t\t\t\\\n\t\t\tif ((OID)->subs[SUB] < (asn_subid_t)_lelem->INDEX)\\\n\t\t\t\tbreak;\t\t\t\t\t\\\n\t(_lelem);\t\t\t\t\t\t\t\\\n    })\n\n#define FIND_OBJECT_FUNC_LINK(LIST, OID, SUB, LINK, FUNC) ({\t\t\\\n\t__typeof (TAILQ_FIRST(LIST)) _lelem;\t\t\t\t\\\n\t\t\t\t\t\t\t\t\t\\\n\tTAILQ_FOREACH(_lelem, (LIST), LINK)\t\t\t\t\\\n\t\tif ((FUNC)(OID, SUB, _lelem) == 0)\t\t\t\\\n\t\t\tbreak;\t\t\t\t\t\t\\\n\t(_lelem);\t\t\t\t\t\t\t\\\n    })\n\n#define NEXT_OBJECT_FUNC_LINK(LIST, OID, SUB, LINK, FUNC) ({\t\t\\\n\t__typeof (TAILQ_FIRST(LIST)) _lelem;\t\t\t\t\\\n\t\t\t\t\t\t\t\t\t\\\n\tTAILQ_FOREACH(_lelem, (LIST), LINK)\t\t\t\t\\\n\t\tif ((FUNC)(OID, SUB, _lelem) < 0)\t\t\t\\\n\t\t\tbreak;\t\t\t\t\t\t\\\n\t(_lelem);\t\t\t\t\t\t\t\\\n    })\n\n/*\n * Macros for the case where the index field is called 'index'\n */\n#define INSERT_OBJECT_OID_LINK(PTR, LIST, LINK)\t\t\t\t\\\n    INSERT_OBJECT_OID_LINK_INDEX(PTR, LIST, LINK, index)\n\n#define INSERT_OBJECT_INT_LINK(PTR, LIST, LINK) do {\t\t\t\\\n    INSERT_OBJECT_INT_LINK_INDEX(PTR, LIST, LINK, index)\n\n#define FIND_OBJECT_OID_LINK(LIST, OID, SUB, LINK)\t\t\t\\\n    FIND_OBJECT_OID_LINK_INDEX(LIST, OID, SUB, LINK, index)\n\n#define NEXT_OBJECT_OID_LINK(LIST, OID, SUB, LINK)\t\t\t\\\n    NEXT_OBJECT_OID_LINK_INDEX(LIST, OID, SUB, LINK, index)\n\n#define FIND_OBJECT_INT_LINK(LIST, OID, SUB, LINK)\t\t\t\\\n    FIND_OBJECT_INT_LINK_INDEX(LIST, OID, SUB, LINK, index)\n\n#define NEXT_OBJECT_INT_LINK(LIST, OID, SUB, LINK)\t\t\t\\\n    NEXT_OBJECT_INT_LINK_INDEX(LIST, OID, SUB, LINK, index)\n\n/*\n * Macros for the case where the index field is called 'index' and the\n * link field 'link'.\n */\n#define INSERT_OBJECT_OID(PTR, LIST)\t\t\t\t\t\\\n    INSERT_OBJECT_OID_LINK_INDEX(PTR, LIST, link, index)\n\n#define INSERT_OBJECT_INT(PTR, LIST)\t\t\t\t\t\\\n    INSERT_OBJECT_INT_LINK_INDEX(PTR, LIST, link, index)\n\n#define\tINSERT_OBJECT_FUNC_REV(PTR, LIST, HEAD, FUNC)\t\t\t\\\n    INSERT_OBJECT_FUNC_LINK_REV(PTR, LIST, HEAD, link, FUNC)\n\n#define FIND_OBJECT_OID(LIST, OID, SUB)\t\t\t\t\t\\\n    FIND_OBJECT_OID_LINK_INDEX(LIST, OID, SUB, link, index)\n\n#define FIND_OBJECT_INT(LIST, OID, SUB)\t\t\t\t\t\\\n    FIND_OBJECT_INT_LINK_INDEX(LIST, OID, SUB, link, index)\n\n#define\tFIND_OBJECT_FUNC(LIST, OID, SUB, FUNC)\t\t\t\t\\\n    FIND_OBJECT_FUNC_LINK(LIST, OID, SUB, link, FUNC)\n\n#define NEXT_OBJECT_OID(LIST, OID, SUB)\t\t\t\t\t\\\n    NEXT_OBJECT_OID_LINK_INDEX(LIST, OID, SUB, link, index)\n\n#define NEXT_OBJECT_INT(LIST, OID, SUB)\t\t\t\t\t\\\n    NEXT_OBJECT_INT_LINK_INDEX(LIST, OID, SUB, link, index)\n\n#define\tNEXT_OBJECT_FUNC(LIST, OID, SUB, FUNC)\t\t\t\t\\\n    NEXT_OBJECT_FUNC_LINK(LIST, OID, SUB, link, FUNC)\n\nstruct lmodule;\n\n/* The tick when the program was started. This is the absolute time of\n * the start in 100th of a second. */\nextern uint64_t start_tick;\n\n/* The tick when the current packet was received. This is the absolute\n * time in 100th of second. */\nextern uint64_t this_tick;\n\n/* Get the current absolute time in 100th of a second. */\nuint64_t get_ticks(void);\n\n/*\n * Return code for proxy function\n */\nenum snmpd_proxy_err {\n\t/* proxy code will process the PDU */\n\tSNMPD_PROXY_OK,\n\t/* proxy code does not process PDU */\n\tSNMPD_PROXY_REJ,\n\t/* drop this PDU */\n\tSNMPD_PROXY_DROP,\n\t/* drop because of bad community */\n\tSNMPD_PROXY_BADCOMM,\n\t/* drop because of bad community use */\n\tSNMPD_PROXY_BADCOMMUSE\n};\n\n/*\n * Input handling\n */\nenum snmpd_input_err {\n\t/* proceed with packet */\n\tSNMPD_INPUT_OK,\n\t/* fatal error in packet, ignore it */\n\tSNMPD_INPUT_FAILED,\n\t/* value encoding has wrong length in a SET operation */\n\tSNMPD_INPUT_VALBADLEN,\n\t/* value encoding is out of range */\n\tSNMPD_INPUT_VALRANGE,\n\t/* value has bad encoding */\n\tSNMPD_INPUT_VALBADENC,\n\t/* need more data (truncated packet) */\n\tSNMPD_INPUT_TRUNC,\n\t/* unknown community */\n\tSNMPD_INPUT_BAD_COMM,\n};\n\n/*\n * Every loadable module must have one of this structures with\n * the external name 'config'.\n */\nstruct snmp_module {\n\t/* a comment describing what this module implements */\n\tconst char *comment;\n\n\t/* the initialization function */\n\tint (*init)(struct lmodule *, int argc, char *argv[]);\n\n\t/* the finalisation function */\n\tint (*fini)(void);\n\n\t/* the idle function */\n\tvoid (*idle)(void);\n\n\t/* the dump function */\n\tvoid (*dump)(void);\n\n\t/* re-configuration function */\n\tvoid (*config)(void);\n\n\t/* start operation */\n\tvoid (*start)(void);\n\n\t/* proxy a PDU */\n\tenum snmpd_proxy_err (*proxy)(struct snmp_pdu *, void *,\n\t    const struct asn_oid *, const struct sockaddr *, socklen_t,\n\t    enum snmpd_input_err, int32_t, int);\n\n\t/* the tree this module is going to server */\n\tconst struct snmp_node *tree;\n\tu_int tree_size;\n\n\t/* function called, when another module was unloaded/loaded */\n\tvoid (*loading)(const struct lmodule *, int);\n};\n\n/*\n * Stuff exported to modules\n */\n\n/*\n * The system group.\n */\nstruct systemg {\n\tu_char\t\t*descr;\n\tstruct asn_oid\tobject_id;\n\tu_char\t\t*contact;\n\tu_char\t\t*name;\n\tu_char\t\t*location;\n\tu_int32_t\tservices;\n\tu_int32_t\tor_last_change;\n};\nextern struct systemg systemg;\n\n/*\n * Community support.\n *\n * We have 2 fixed communities for SNMP read and write access. Modules\n * can create their communities dynamically. They are deleted automatically\n * if the module is unloaded.\n */\n#define COMM_INITIALIZE\t0\n#define COMM_READ\t1\n#define COMM_WRITE\t2\n\nu_int comm_define(u_int, const char *descr, struct lmodule *, const char *str);\nconst char * comm_string(u_int);\n\n/* community for current packet */\nextern u_int community;\n\n/*\n * SNMP User-based Security Model data. Modified via the snmp_usm(3) module.\n */\nstruct snmpd_usmstat {\n\tuint32_t\tunsupported_seclevels;\n\tuint32_t\tnot_in_time_windows;\n\tuint32_t\tunknown_users;\n\tuint32_t\tunknown_engine_ids;\n\tuint32_t\twrong_digests;\n\tuint32_t\tdecrypt_errors;\n};\n\nextern struct snmpd_usmstat snmpd_usmstats;\nstruct snmpd_usmstat *bsnmpd_get_usm_stats(void);\nvoid bsnmpd_reset_usm_stats(void);\n\nstruct usm_user {\n\tstruct snmp_user\t\tsuser;\n\tuint8_t\t\t\t\tuser_engine_id[SNMP_ENGINE_ID_SIZ];\n\tuint32_t\t\t\tuser_engine_len;\n\tchar\t\t\t\tuser_public[SNMP_ADM_STR32_SIZ];\n\tuint32_t\t\t\tuser_public_len;\n\tint32_t\t\t\t\tstatus;\n\tint32_t\t\t\t\ttype;\n\tSLIST_ENTRY(usm_user)\t\tup;\n};\n\nSLIST_HEAD(usm_userlist, usm_user);\nstruct usm_user *usm_first_user(void);\nstruct usm_user *usm_next_user(struct usm_user *);\nstruct usm_user *usm_find_user(uint8_t *, uint32_t, char *);\nstruct usm_user *usm_new_user(uint8_t *, uint32_t, char *);\nvoid usm_delete_user(struct usm_user *);\nvoid usm_flush_users(void);\n\n/* USM user for current packet */\nextern struct usm_user *usm_user;\n\n/*\n * SNMP View-based Access Control Model data. Modified via the snmp_vacm(3) module.\n */\nstruct vacm_group;\n\nstruct vacm_user {\n\t/* Security user name from USM */\n\tchar\t\t\t\tsecname[SNMP_ADM_STR32_SIZ];\n\tint32_t\t\t\t\tsec_model;\n\t/* Back pointer to user assigned group name */\n\tstruct vacm_group\t\t*group;\n\tint32_t\t\t\t\ttype;\n\tint32_t\t\t\t\tstatus;\n\tSLIST_ENTRY(vacm_user)\t\tvvu;\n\tSLIST_ENTRY(vacm_user)\t\tvvg;\n};\n\nSLIST_HEAD(vacm_userlist, vacm_user);\n\nstruct vacm_group {\n\tchar\t\t\t\tgroupname[SNMP_ADM_STR32_SIZ];\n\tstruct vacm_userlist\t\tgroup_users;\n\tSLIST_ENTRY(vacm_group)\t\tvge;\n};\n\nSLIST_HEAD(vacm_grouplist, vacm_group);\n\nstruct vacm_access {\n\t/* The group name is index, not a column in the table */\n\tstruct vacm_group\t\t*group;\n\tchar\t\t\t\tctx_prefix[SNMP_ADM_STR32_SIZ];\n\tint32_t\t\t\t\tsec_model;\n\tint32_t\t\t\t\tsec_level;\n\tint32_t\t\t\t\tctx_match;\n\tstruct vacm_view\t\t*read_view;\n\tstruct vacm_view\t\t*write_view;\n\tstruct vacm_view\t\t*notify_view;\n\tint32_t\t\t\t\ttype;\n\tint32_t\t\t\t\tstatus;\n\tTAILQ_ENTRY(vacm_access)\tvva;\n};\n\nTAILQ_HEAD(vacm_accesslist, vacm_access);\n\nstruct vacm_view {\n\tchar\t\t\t\tviewname[SNMP_ADM_STR32_SIZ]; /* key */\n\tstruct asn_oid\t\t\tsubtree; /* key */\n\tuint8_t\t\t\t\tmask[16];\n\tuint8_t\t\t\t\texclude;\n\tint32_t\t\t\t\ttype;\n\tint32_t\t\t\t\tstatus;\n\tSLIST_ENTRY(vacm_view)\t\tvvl;\n};\n\nSLIST_HEAD(vacm_viewlist, vacm_view);\n\nstruct vacm_context {\n\t/* The ID of the module that registered this context */\n\tint32_t\t\t\t\tregid;\n\tchar\t\t\t\tctxname[SNMP_ADM_STR32_SIZ];\n\tSLIST_ENTRY(vacm_context)\tvcl;\n};\n\nSLIST_HEAD(vacm_contextlist, vacm_context);\n\nvoid vacm_groups_init(void);\nstruct vacm_user *vacm_first_user(void);\nstruct vacm_user *vacm_next_user(struct vacm_user *);\nstruct vacm_user *vacm_new_user(int32_t, char *);\nint vacm_delete_user(struct vacm_user *);\nint vacm_user_set_group(struct vacm_user *, u_char *, u_int);\nstruct vacm_access *vacm_first_access_rule(void);\nstruct vacm_access *vacm_next_access_rule(struct vacm_access *);\nstruct vacm_access *vacm_new_access_rule(char *, char *, int32_t, int32_t);\nint vacm_delete_access_rule(struct vacm_access *);\nstruct vacm_view *vacm_first_view(void);\nstruct vacm_view *vacm_next_view(struct vacm_view *);\nstruct vacm_view *vacm_new_view(char *, struct asn_oid *);\nint vacm_delete_view(struct vacm_view *);\nstruct vacm_context *vacm_first_context(void);\nstruct vacm_context *vacm_next_context(struct vacm_context *);\nstruct vacm_context *vacm_add_context(char *, int32_t);\nvoid vacm_flush_contexts(int32_t);\n\n/*\n * RFC 3413 SNMP Management Target & Notification MIB\n */\n\nstruct snmpd_target_stats {\n\tuint32_t\t\t\tunavail_contexts;\n\tuint32_t\t\t\tunknown_contexts;\n};\n\n#define\tSNMP_UDP_ADDR_SIZ\t\t6\n#define\tSNMP_TAG_SIZ\t\t\t(255 + 1)\n\nstruct target_address {\n\tchar\t\t\t\tname[SNMP_ADM_STR32_SIZ];\n\tuint8_t\t\t\t\taddress[SNMP_UDP_ADDR_SIZ];\n\tint32_t\t\t\t\ttimeout;\n\tint32_t\t\t\t\tretry;\n\tchar\t\t\t\ttaglist[SNMP_TAG_SIZ];\n\tchar\t\t\t\tparamname[SNMP_ADM_STR32_SIZ];\n\tint32_t\t\t\t\ttype;\n\tint32_t\t\t\t\tsocket;\n\tint32_t\t\t\t\tstatus;\n\tSLIST_ENTRY(target_address)\tta;\n};\n\nSLIST_HEAD(target_addresslist, target_address);\n\nstruct target_param {\n\tchar\t\t\t\tname[SNMP_ADM_STR32_SIZ];\n\tint32_t\t\t\t\tmpmodel;\n\tint32_t\t\t\t\tsec_model;\n\tchar\t\t\t\tsecname[SNMP_ADM_STR32_SIZ];\n\tenum snmp_usm_level\t\tsec_level;\n\tint32_t\t\t\t\ttype;\n\tint32_t\t\t\t\tstatus;\n\tSLIST_ENTRY(target_param)\ttp;\n};\n\nSLIST_HEAD(target_paramlist, target_param);\n\nstruct target_notify {\n\tchar\t\t\t\tname[SNMP_ADM_STR32_SIZ];\n\tchar\t\t\t\ttaglist[SNMP_TAG_SIZ];\n\tint32_t\t\t\t\tnotify_type;\n\tint32_t\t\t\t\ttype;\n\tint32_t\t\t\t\tstatus;\n\tSLIST_ENTRY(target_notify)\ttn;\n};\n\nSLIST_HEAD(target_notifylist, target_notify);\n\nextern struct snmpd_target_stats snmpd_target_stats;\nstruct snmpd_target_stats *bsnmpd_get_target_stats(void);\nstruct target_address *target_first_address(void);\nstruct target_address *target_next_address(struct target_address *);\nstruct target_address *target_new_address(char *);\nint target_activate_address(struct target_address *);\nint target_delete_address(struct target_address *);\nstruct target_param *target_first_param(void);\nstruct target_param *target_next_param(struct target_param *);\nstruct target_param *target_new_param(char *);\nint target_delete_param(struct target_param *);\nstruct target_notify *target_first_notify(void);\nstruct target_notify *target_next_notify(struct target_notify *);\nstruct target_notify *target_new_notify(char *);\nint target_delete_notify (struct target_notify *);\nvoid target_flush_all(void);\n\n/*\n * Well known OIDs\n */\nextern const struct asn_oid oid_zeroDotZero;\n\n/* SNMPv3 Engine Discovery */\nextern const struct asn_oid oid_usmUnknownEngineIDs;\nextern const struct asn_oid oid_usmNotInTimeWindows;\n\n/*\n * Request ID ranges.\n *\n * A module can request a range of request ids and associate them with a\n * type field. All ranges are deleted if a module is unloaded.\n */\nu_int reqid_allocate(int size, struct lmodule *);\nint32_t reqid_next(u_int type);\nint32_t reqid_base(u_int type);\nint reqid_istype(int32_t reqid, u_int type);\nu_int reqid_type(int32_t reqid);\n\n/*\n * Timers.\n */\nvoid *timer_start(u_int, void (*)(void *), void *, struct lmodule *);\nvoid *timer_start_repeat(u_int, u_int, void (*)(void *), void *,\n    struct lmodule *);\nvoid timer_stop(void *);\n\n/*\n * File descriptors\n */\nvoid *fd_select(int, void (*)(int, void *), void *, struct lmodule *);\nvoid fd_deselect(void *);\nvoid fd_suspend(void *);\nint fd_resume(void *);\n\n/*\n * Object resources\n */\nu_int or_register(const struct asn_oid *, const char *, struct lmodule *);\nvoid or_unregister(u_int);\n\n/*\n * Buffers\n */\nvoid *buf_alloc(int tx);\nsize_t buf_size(int tx);\n\n/* decode PDU and find community */\nenum snmpd_input_err snmp_input_start(const u_char *, size_t, const char *,\n    struct snmp_pdu *, int32_t *, size_t *);\n\n/* process the pdu. returns either _OK or _FAILED */\nenum snmpd_input_err snmp_input_finish(struct snmp_pdu *, const u_char *,\n    size_t, u_char *, size_t *, const char *, enum snmpd_input_err, int32_t,\n    void *);\n\nvoid snmp_output(struct snmp_pdu *, u_char *, size_t *, const char *);\nvoid snmp_send_port(void *, const struct asn_oid *, struct snmp_pdu *,\n\tconst struct sockaddr *, socklen_t);\nenum snmp_code snmp_pdu_auth_access(struct snmp_pdu *, int32_t *);\n\n/* sending traps */\nvoid snmp_send_trap(const struct asn_oid *, ...);\n\n/*\n * Action support\n */\nint string_save(struct snmp_value *, struct snmp_context *, ssize_t, u_char **);\nvoid string_commit(struct snmp_context *);\nvoid string_rollback(struct snmp_context *, u_char **);\nint string_get(struct snmp_value *, const u_char *, ssize_t);\nint string_get_max(struct snmp_value *, const u_char *, ssize_t, size_t);\nvoid string_free(struct snmp_context *);\n\nint ip_save(struct snmp_value *, struct snmp_context *, u_char *);\nvoid ip_rollback(struct snmp_context *, u_char *);\nvoid ip_commit(struct snmp_context *);\nint ip_get(struct snmp_value *, u_char *);\n\nint oid_save(struct snmp_value *, struct snmp_context *, struct asn_oid *);\nvoid oid_rollback(struct snmp_context *, struct asn_oid *);\nvoid oid_commit(struct snmp_context *);\nint oid_get(struct snmp_value *, const struct asn_oid *);\n\nint index_decode(const struct asn_oid *oid, u_int sub, u_int code, ...);\nint index_compare(const struct asn_oid *, u_int, const struct asn_oid *);\nint index_compare_off(const struct asn_oid *, u_int, const struct asn_oid *,\n    u_int);\nvoid index_append(struct asn_oid *, u_int, const struct asn_oid *);\nvoid index_append_off(struct asn_oid *, u_int, const struct asn_oid *, u_int);\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/bzlib.h",
    "content": "\n/*-------------------------------------------------------------*/\n/*--- Public header file for the library.                   ---*/\n/*---                                               bzlib.h ---*/\n/*-------------------------------------------------------------*/\n\n/* ------------------------------------------------------------------\n   This file is part of bzip2/libbzip2, a program and library for\n   lossless, block-sorting data compression.\n\n   bzip2/libbzip2 version 1.0.6 of 6 September 2010\n   Copyright (C) 1996-2010 Julian Seward <jseward@bzip.org>\n\n   Please read the WARNING, DISCLAIMER and PATENTS sections in the \n   README file.\n\n   This program is released under the terms of the license contained\n   in the file LICENSE.\n   ------------------------------------------------------------------ */\n\n\n#ifndef _BZLIB_H\n#define _BZLIB_H\n\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\n#define BZ_RUN               0\n#define BZ_FLUSH             1\n#define BZ_FINISH            2\n\n#define BZ_OK                0\n#define BZ_RUN_OK            1\n#define BZ_FLUSH_OK          2\n#define BZ_FINISH_OK         3\n#define BZ_STREAM_END        4\n#define BZ_SEQUENCE_ERROR    (-1)\n#define BZ_PARAM_ERROR       (-2)\n#define BZ_MEM_ERROR         (-3)\n#define BZ_DATA_ERROR        (-4)\n#define BZ_DATA_ERROR_MAGIC  (-5)\n#define BZ_IO_ERROR          (-6)\n#define BZ_UNEXPECTED_EOF    (-7)\n#define BZ_OUTBUFF_FULL      (-8)\n#define BZ_CONFIG_ERROR      (-9)\n\ntypedef \n   struct {\n      char *next_in;\n      unsigned int avail_in;\n      unsigned int total_in_lo32;\n      unsigned int total_in_hi32;\n\n      char *next_out;\n      unsigned int avail_out;\n      unsigned int total_out_lo32;\n      unsigned int total_out_hi32;\n\n      void *state;\n\n      void *(*bzalloc)(void *,int,int);\n      void (*bzfree)(void *,void *);\n      void *opaque;\n   } \n   bz_stream;\n\n\n#ifndef BZ_IMPORT\n#define BZ_EXPORT\n#endif\n\n#ifndef BZ_NO_STDIO\n/* Need a definitition for FILE */\n#include <stdio.h>\n#endif\n\n#ifdef _WIN32\n#   include <windows.h>\n#   ifdef small\n      /* windows.h define small to char */\n#      undef small\n#   endif\n#   ifdef BZ_EXPORT\n#   define BZ_API(func) WINAPI func\n#   define BZ_EXTERN extern\n#   else\n   /* import windows dll dynamically */\n#   define BZ_API(func) (WINAPI * func)\n#   define BZ_EXTERN\n#   endif\n#else\n#   define BZ_API(func) func\n#   define BZ_EXTERN extern\n#endif\n\n\n/*-- Core (low-level) library functions --*/\n\nBZ_EXTERN int BZ_API(BZ2_bzCompressInit) ( \n      bz_stream* strm, \n      int        blockSize100k, \n      int        verbosity, \n      int        workFactor \n   );\n\nBZ_EXTERN int BZ_API(BZ2_bzCompress) ( \n      bz_stream* strm, \n      int action \n   );\n\nBZ_EXTERN int BZ_API(BZ2_bzCompressEnd) ( \n      bz_stream* strm \n   );\n\nBZ_EXTERN int BZ_API(BZ2_bzDecompressInit) ( \n      bz_stream *strm, \n      int       verbosity, \n      int       small\n   );\n\nBZ_EXTERN int BZ_API(BZ2_bzDecompress) ( \n      bz_stream* strm \n   );\n\nBZ_EXTERN int BZ_API(BZ2_bzDecompressEnd) ( \n      bz_stream *strm \n   );\n\n\n\n/*-- High(er) level library functions --*/\n\n#ifndef BZ_NO_STDIO\n#define BZ_MAX_UNUSED 5000\n\ntypedef void BZFILE;\n\nBZ_EXTERN BZFILE* BZ_API(BZ2_bzReadOpen) ( \n      int*  bzerror,   \n      FILE* f, \n      int   verbosity, \n      int   small,\n      void* unused,    \n      int   nUnused \n   );\n\nBZ_EXTERN void BZ_API(BZ2_bzReadClose) ( \n      int*    bzerror, \n      BZFILE* b \n   );\n\nBZ_EXTERN void BZ_API(BZ2_bzReadGetUnused) ( \n      int*    bzerror, \n      BZFILE* b, \n      void**  unused,  \n      int*    nUnused \n   );\n\nBZ_EXTERN int BZ_API(BZ2_bzRead) ( \n      int*    bzerror, \n      BZFILE* b, \n      void*   buf, \n      int     len \n   );\n\nBZ_EXTERN BZFILE* BZ_API(BZ2_bzWriteOpen) ( \n      int*  bzerror,      \n      FILE* f, \n      int   blockSize100k, \n      int   verbosity, \n      int   workFactor \n   );\n\nBZ_EXTERN void BZ_API(BZ2_bzWrite) ( \n      int*    bzerror, \n      BZFILE* b, \n      void*   buf, \n      int     len \n   );\n\nBZ_EXTERN void BZ_API(BZ2_bzWriteClose) ( \n      int*          bzerror, \n      BZFILE*       b, \n      int           abandon, \n      unsigned int* nbytes_in, \n      unsigned int* nbytes_out \n   );\n\nBZ_EXTERN void BZ_API(BZ2_bzWriteClose64) ( \n      int*          bzerror, \n      BZFILE*       b, \n      int           abandon, \n      unsigned int* nbytes_in_lo32, \n      unsigned int* nbytes_in_hi32, \n      unsigned int* nbytes_out_lo32, \n      unsigned int* nbytes_out_hi32\n   );\n#endif\n\n\n/*-- Utility functions --*/\n\nBZ_EXTERN int BZ_API(BZ2_bzBuffToBuffCompress) ( \n      char*         dest, \n      unsigned int* destLen,\n      char*         source, \n      unsigned int  sourceLen,\n      int           blockSize100k, \n      int           verbosity, \n      int           workFactor \n   );\n\nBZ_EXTERN int BZ_API(BZ2_bzBuffToBuffDecompress) ( \n      char*         dest, \n      unsigned int* destLen,\n      char*         source, \n      unsigned int  sourceLen,\n      int           small, \n      int           verbosity \n   );\n\n\n/*--\n   Code contributed by Yoshioka Tsuneo (tsuneo@rr.iij4u.or.jp)\n   to support better zlib compatibility.\n   This code is not _officially_ part of libbzip2 (yet);\n   I haven't tested it, documented it, or considered the\n   threading-safeness of it.\n   If this code breaks, please contact both Yoshioka and me.\n--*/\n\nBZ_EXTERN const char * BZ_API(BZ2_bzlibVersion) (\n      void\n   );\n\n#ifndef BZ_NO_STDIO\nBZ_EXTERN BZFILE * BZ_API(BZ2_bzopen) (\n      const char *path,\n      const char *mode\n   );\n\nBZ_EXTERN BZFILE * BZ_API(BZ2_bzdopen) (\n      int        fd,\n      const char *mode\n   );\n         \nBZ_EXTERN int BZ_API(BZ2_bzread) (\n      BZFILE* b, \n      void* buf, \n      int len \n   );\n\nBZ_EXTERN int BZ_API(BZ2_bzwrite) (\n      BZFILE* b, \n      void*   buf, \n      int     len \n   );\n\nBZ_EXTERN int BZ_API(BZ2_bzflush) (\n      BZFILE* b\n   );\n\nBZ_EXTERN void BZ_API(BZ2_bzclose) (\n      BZFILE* b\n   );\n\nBZ_EXTERN const char * BZ_API(BZ2_bzerror) (\n      BZFILE *b, \n      int    *errnum\n   );\n#endif\n\n#ifdef __cplusplus\n}\n#endif\n\n#endif\n\n/*-------------------------------------------------------------*/\n/*--- end                                           bzlib.h ---*/\n/*-------------------------------------------------------------*/\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/algorithm",
    "content": "// <algorithm> -*- C++ -*-\n\n// Copyright (C) 2001, 2002 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n/*\n *\n * Copyright (c) 1994\n * Hewlett-Packard Company\n *\n * Permission to use, copy, modify, distribute and sell this software\n * and its documentation for any purpose is hereby granted without fee,\n * provided that the above copyright notice appear in all copies and\n * that both that copyright notice and this permission notice appear\n * in supporting documentation.  Hewlett-Packard Company makes no\n * representations about the suitability of this software for any\n * purpose.  It is provided \"as is\" without express or implied warranty.\n *\n *\n * Copyright (c) 1996,1997\n * Silicon Graphics Computer Systems, Inc.\n *\n * Permission to use, copy, modify, distribute and sell this software\n * and its documentation for any purpose is hereby granted without fee,\n * provided that the above copyright notice appear in all copies and\n * that both that copyright notice and this permission notice appear\n * in supporting documentation.  Silicon Graphics makes no\n * representations about the suitability of this software for any\n * purpose.  It is provided \"as is\" without express or implied warranty.\n */\n\n/** @file include/algorithm\n *  This is a Standard C++ Library header.\n */\n\n#ifndef _GLIBCXX_ALGORITHM\n#define _GLIBCXX_ALGORITHM 1\n\n#pragma GCC system_header\n\n#include <bits/stl_algobase.h>\n#include <bits/stl_construct.h>\n#include <bits/stl_uninitialized.h>\n#include <bits/stl_algo.h>\n\n#endif /* _GLIBCXX_ALGORITHM */\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/backward/algo.h",
    "content": "// Backward-compat support -*- C++ -*-\n\n// Copyright (C) 2001 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n/*\n *\n * Copyright (c) 1994\n * Hewlett-Packard Company\n *\n * Permission to use, copy, modify, distribute and sell this software\n * and its documentation for any purpose is hereby granted without fee,\n * provided that the above copyright notice appear in all copies and\n * that both that copyright notice and this permission notice appear\n * in supporting documentation.  Hewlett-Packard Company makes no\n * representations about the suitability of this software for any\n * purpose.  It is provided \"as is\" without express or implied warranty.\n *\n *\n * Copyright (c) 1996,1997\n * Silicon Graphics Computer Systems, Inc.\n *\n * Permission to use, copy, modify, distribute and sell this software\n * and its documentation for any purpose is hereby granted without fee,\n * provided that the above copyright notice appear in all copies and\n * that both that copyright notice and this permission notice appear\n * in supporting documentation.  Silicon Graphics makes no\n * representations about the suitability of this software for any\n * purpose.  It is provided \"as is\" without express or implied warranty.\n */\n\n#ifndef _BACKWARD_ALGO_H\n#define _BACKWARD_ALGO_H 1\n\n#include \"backward_warning.h\"\n#include \"algobase.h\"\n#include \"tempbuf.h\"\n#include \"iterator.h\"\n#include <bits/stl_algo.h>\n#include <bits/stl_numeric.h>\n#include <ext/algorithm>\n#include <ext/numeric>\n\n// Names from <stl_algo.h>\nusing std::for_each;\nusing std::find;\nusing std::find_if;\nusing std::adjacent_find;\nusing std::count;\nusing std::count_if;\nusing std::search;\nusing std::search_n;\nusing std::swap_ranges;\nusing std::transform;\nusing std::replace;\nusing std::replace_if;\nusing std::replace_copy;\nusing std::replace_copy_if;\nusing std::generate;\nusing std::generate_n;\nusing std::remove;\nusing std::remove_if;\nusing std::remove_copy;\nusing std::remove_copy_if;\nusing std::unique;\nusing std::unique_copy;\nusing std::reverse;\nusing std::reverse_copy;\nusing std::rotate;\nusing std::rotate_copy;\nusing std::random_shuffle;\nusing std::partition;\nusing std::stable_partition;\nusing std::sort;\nusing std::stable_sort;\nusing std::partial_sort;\nusing std::partial_sort_copy;\nusing std::nth_element;\nusing std::lower_bound;\nusing std::upper_bound;\nusing std::equal_range;\nusing std::binary_search;\nusing std::merge;\nusing std::inplace_merge;\nusing std::includes;\nusing std::set_union;\nusing std::set_intersection;\nusing std::set_difference;\nusing std::set_symmetric_difference;\nusing std::min_element;\nusing std::max_element;\nusing std::next_permutation;\nusing std::prev_permutation;\nusing std::find_first_of;\nusing std::find_end;\n\n// Names from stl_heap.h\nusing std::push_heap;\nusing std::pop_heap;\nusing std::make_heap;\nusing std::sort_heap;\n\n// Names from stl_numeric.h\nusing std::accumulate;\nusing std::inner_product;\nusing std::partial_sum;\nusing std::adjacent_difference;\n\n// Names from ext/algorithm\nusing __gnu_cxx::random_sample;\nusing __gnu_cxx::random_sample_n;\nusing __gnu_cxx::is_sorted;\nusing __gnu_cxx::is_heap;\nusing __gnu_cxx::count;   // Extension returning void\nusing __gnu_cxx::count_if;   // Extension returning void\n\n// Names from ext/numeric\nusing __gnu_cxx::power;\nusing __gnu_cxx::iota;\n\n#endif /* _BACKWARD_ALGO_H */\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/backward/algobase.h",
    "content": "// Backward-compat support -*- C++ -*-\n\n// Copyright (C) 2001 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n/*\n *\n * Copyright (c) 1994\n * Hewlett-Packard Company\n *\n * Permission to use, copy, modify, distribute and sell this software\n * and its documentation for any purpose is hereby granted without fee,\n * provided that the above copyright notice appear in all copies and\n * that both that copyright notice and this permission notice appear\n * in supporting documentation.  Hewlett-Packard Company makes no\n * representations about the suitability of this software for any\n * purpose.  It is provided \"as is\" without express or implied warranty.\n *\n * Copyright (c) 1996,1997\n * Silicon Graphics Computer Systems, Inc.\n *\n * Permission to use, copy, modify, distribute and sell this software\n * and its documentation for any purpose is hereby granted without fee,\n * provided that the above copyright notice appear in all copies and\n * that both that copyright notice and this permission notice appear\n * in supporting documentation.  Silicon Graphics makes no\n * representations about the suitability of this software for any\n * purpose.  It is provided \"as is\" without express or implied warranty.\n */\n\n#ifndef _BACKWARD_ALGOBASE_H\n#define _BACKWARD_ALGOBASE_H 1\n\n#include \"backward_warning.h\"\n#include \"pair.h\"\n#include \"iterator.h\"\n#include <bits/stl_algobase.h>\n#include <bits/stl_uninitialized.h>\n#include <ext/algorithm>\n#include <ext/memory>\n\n// Names from stl_algobase.h\nusing std::iter_swap;\nusing std::swap;\nusing std::min;\nusing std::max;\nusing std::copy;\nusing std::copy_backward;\nusing std::fill;\nusing std::fill_n;\nusing std::mismatch;\nusing std::equal;\nusing std::lexicographical_compare;\n\n// Names from stl_uninitialized.h\nusing std::uninitialized_copy;\nusing std::uninitialized_fill;\nusing std::uninitialized_fill_n;\n\n// Names from ext/algorithm\nusing __gnu_cxx::copy_n;\nusing __gnu_cxx::lexicographical_compare_3way;\n\n// Names from ext/memory\nusing __gnu_cxx::uninitialized_copy_n;\n\n#endif /* _BACKWARD_ALGOBASE_H */\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/backward/alloc.h",
    "content": "// Backward-compat support -*- C++ -*-\n\n// Copyright (C) 2001, 2003, 2004 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n/*\n * Copyright (c) 1996-1997\n * Silicon Graphics Computer Systems, Inc.\n *\n * Permission to use, copy, modify, distribute and sell this software\n * and its documentation for any purpose is hereby granted without fee,\n * provided that the above copyright notice appear in all copies and\n * that both that copyright notice and this permission notice appear\n * in supporting documentation.  Silicon Graphics makes no\n * representations about the suitability of this software for any\n * purpose.  It is provided \"as is\" without express or implied warranty.\n */\n\n#ifndef _BACKWARD_ALLOC_H\n#define _BACKWARD_ALLOC_H 1\n\n#include \"backward_warning.h\"\n#include <bits/c++config.h>\n#include <bits/allocator.h>\n\nusing std::allocator;\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/backward/backward_warning.h",
    "content": "// Copyright (C) 2001 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n#ifndef _BACKWARD_BACKWARD_WARNING_H\n#define _BACKWARD_BACKWARD_WARNING_H 1\n\n#ifdef __DEPRECATED\n#warning This file includes at least one deprecated or antiquated header. \\\nPlease consider using one of the 32 headers found in section 17.4.1.2 of the \\\nC++ standard. Examples include substituting the <X> header for the <X.h> \\\nheader for C++ includes, or <iostream> instead of the deprecated header \\\n<iostream.h>. To disable this warning use -Wno-deprecated.\n#endif\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/backward/bvector.h",
    "content": "// Backward-compat support -*- C++ -*-\n\n// Copyright (C) 2001, 2004 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n/*\n *\n * Copyright (c) 1994\n * Hewlett-Packard Company\n *\n * Permission to use, copy, modify, distribute and sell this software\n * and its documentation for any purpose is hereby granted without fee,\n * provided that the above copyright notice appear in all copies and\n * that both that copyright notice and this permission notice appear\n * in supporting documentation.  Hewlett-Packard Company makes no\n * representations about the suitability of this software for any\n * purpose.  It is provided \"as is\" without express or implied warranty.\n *\n *\n * Copyright (c) 1996\n * Silicon Graphics Computer Systems, Inc.\n *\n * Permission to use, copy, modify, distribute and sell this software\n * and its documentation for any purpose is hereby granted without fee,\n * provided that the above copyright notice appear in all copies and\n * that both that copyright notice and this permission notice appear\n * in supporting documentation.  Silicon Graphics makes no\n * representations about the suitability of this software for any\n * purpose.  It is provided \"as is\" without express or implied warranty.\n */\n\n#ifndef _BACKWARD_BVECTOR_H\n#define _BACKWARD_BVECTOR_H 1\n\n#include \"backward_warning.h\"\n#include <vector>\n\ntypedef std::vector<bool, std::allocator<bool> > bit_vector;\n\n#endif /* _BACKWARD_BVECTOR_H */\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/backward/complex.h",
    "content": "// Copyright (C) 2000 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n#ifndef _BACKWARD_COMPLEX_H\n#define _BACKWARD_COMPLEX_H 1\n\n#include \"backward_warning.h\"\n#include <complex>\n\nusing std::complex;\ntypedef complex<float>\t\tfloat_complex;\ntypedef complex<double>\t\tdouble_complex;\ntypedef complex<long double>\tlong_double_complex;\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/backward/defalloc.h",
    "content": "// Backward-compat support -*- C++ -*-\n\n// Copyright (C) 2001 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n/*\n *\n * Copyright (c) 1994\n * Hewlett-Packard Company\n *\n * Permission to use, copy, modify, distribute and sell this software\n * and its documentation for any purpose is hereby granted without fee,\n * provided that the above copyright notice appear in all copies and\n * that both that copyright notice and this permission notice appear\n * in supporting documentation.  Hewlett-Packard Company makes no\n * representations about the suitability of this software for any\n * purpose.  It is provided \"as is\" without express or implied warranty.\n *\n */\n\n// Inclusion of this file is DEPRECATED.  This is the original HP\n// default allocator.  It is provided only for backward compatibility.\n// This file WILL BE REMOVED in a future release.\n//\n// DO NOT USE THIS FILE unless you have an old container implementation\n// that requires an allocator with the HP-style interface.\n//\n// Standard-conforming allocators have a very different interface.  The\n// standard default allocator is declared in the header <memory>.\n\n#ifndef _BACKWARD_DEFALLOC_H\n#define _BACKWARD_DEFALLOC_H 1\n\n#include \"backward_warning.h\"\n#include \"new.h\"\n#include <stddef.h>\n#include <stdlib.h>\n#include <limits.h>\n#include \"iostream.h\"\n#include \"algobase.h\"\n\n\ntemplate <class _Tp>\ninline _Tp* allocate(ptrdiff_t __size, _Tp*) {\n    set_new_handler(0);\n    _Tp* __tmp = (_Tp*)(::operator new((size_t)(__size * sizeof(_Tp))));\n    if (__tmp == 0) {\n\tcerr << \"out of memory\" << endl;\n\texit(1);\n    }\n    return __tmp;\n}\n\n\ntemplate <class _Tp>\ninline void deallocate(_Tp* __buffer) {\n    ::operator delete(__buffer);\n}\n\ntemplate <class _Tp>\nclass allocator {\npublic:\n    typedef _Tp value_type;\n    typedef _Tp* pointer;\n    typedef const _Tp* const_pointer;\n    typedef _Tp& reference;\n    typedef const _Tp& const_reference;\n    typedef size_t size_type;\n    typedef ptrdiff_t difference_type;\n    pointer allocate(size_type __n) {\n\treturn ::allocate((difference_type)__n, (pointer)0);\n    }\n    void deallocate(pointer __p) { ::deallocate(__p); }\n    pointer address(reference __x) { return (pointer)&__x; }\n    const_pointer const_address(const_reference __x) {\n\treturn (const_pointer)&__x;\n    }\n    size_type init_page_size() {\n\treturn max(size_type(1), size_type(4096/sizeof(_Tp)));\n    }\n    size_type max_size() const {\n\treturn max(size_type(1), size_type(UINT_MAX/sizeof(_Tp)));\n    }\n};\n\nclass allocator<void> {\npublic:\n    typedef void* pointer;\n};\n\n\n\n#endif /* _BACKWARD_DEFALLOC_H */\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/backward/deque.h",
    "content": "// Backward-compat support -*- C++ -*-\n\n// Copyright (C) 2001 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n/*\n *\n * Copyright (c) 1994\n * Hewlett-Packard Company\n *\n * Permission to use, copy, modify, distribute and sell this software\n * and its documentation for any purpose is hereby granted without fee,\n * provided that the above copyright notice appear in all copies and\n * that both that copyright notice and this permission notice appear\n * in supporting documentation.  Hewlett-Packard Company makes no\n * representations about the suitability of this software for any\n * purpose.  It is provided \"as is\" without express or implied warranty.\n *\n *\n * Copyright (c) 1997\n * Silicon Graphics Computer Systems, Inc.\n *\n * Permission to use, copy, modify, distribute and sell this software\n * and its documentation for any purpose is hereby granted without fee,\n * provided that the above copyright notice appear in all copies and\n * that both that copyright notice and this permission notice appear\n * in supporting documentation.  Silicon Graphics makes no\n * representations about the suitability of this software for any\n * purpose.  It is provided \"as is\" without express or implied warranty.\n */\n\n#ifndef _BACKWARD_DEQUE_H\n#define _BACKWARD_DEQUE_H 1\n\n#include \"backward_warning.h\"\n#include \"algobase.h\"\n#include \"alloc.h\"\n#include <deque>\n\nusing std::deque;\n\n#endif /* _BACKWARD_DEQUE_H */\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/backward/fstream.h",
    "content": "// Copyright (C) 2000, 2001 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n#ifndef _BACKWARD_FSTREAM_H\n#define _BACKWARD_FSTREAM_H 1\n\n#include \"backward_warning.h\"\n#include <fstream>\n\nusing std::filebuf;\nusing std::ifstream;\nusing std::ofstream;\nusing std::fstream;\nusing std::streampos;\n\n#ifdef _GLIBCXX_USE_WCHAR_T\nusing std::wfilebuf;\nusing std::wifstream;\nusing std::wofstream;\nusing std::wfstream;\nusing std::wstreampos;\n#endif\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/backward/function.h",
    "content": "// Backward-compat support -*- C++ -*-\n\n// Copyright (C) 2001 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n/*\n *\n * Copyright (c) 1994\n * Hewlett-Packard Company\n *\n * Permission to use, copy, modify, distribute and sell this software\n * and its documentation for any purpose is hereby granted without fee,\n * provided that the above copyright notice appear in all copies and\n * that both that copyright notice and this permission notice appear\n * in supporting documentation.  Hewlett-Packard Company makes no\n * representations about the suitability of this software for any\n * purpose.  It is provided \"as is\" without express or implied warranty.\n *\n *\n * Copyright (c) 1996,1997\n * Silicon Graphics Computer Systems, Inc.\n *\n * Permission to use, copy, modify, distribute and sell this software\n * and its documentation for any purpose is hereby granted without fee,\n * provided that the above copyright notice appear in all copies and\n * that both that copyright notice and this permission notice appear\n * in supporting documentation.  Silicon Graphics makes no\n * representations about the suitability of this software for any\n * purpose.  It is provided \"as is\" without express or implied warranty.\n */\n\n#ifndef _BACKWARD_FUNCTION_H\n#define _BACKWARD_FUNCTION_H 1\n\n#include \"backward_warning.h\"\n#include <bits/c++config.h>\n#include <stddef.h>\n#include <bits/stl_function.h>\n#include <ext/functional>\n\n// Names from stl_function.h\nusing std::unary_function;\nusing std::binary_function;\nusing std::plus;\nusing std::minus;\nusing std::multiplies;\nusing std::divides;\nusing std::modulus;\nusing std::negate;\nusing std::equal_to;\nusing std::not_equal_to;\nusing std::greater;\nusing std::less;\nusing std::greater_equal;\nusing std::less_equal;\nusing std::logical_and;\nusing std::logical_or;\nusing std::logical_not;\nusing std::unary_negate;\nusing std::binary_negate;\nusing std::not1;\nusing std::not2;\nusing std::binder1st;\nusing std::binder2nd;\nusing std::bind1st;\nusing std::bind2nd;\nusing std::pointer_to_unary_function;\nusing std::pointer_to_binary_function;\nusing std::ptr_fun;\nusing std::mem_fun_t;\nusing std::const_mem_fun_t;\nusing std::mem_fun_ref_t;\nusing std::const_mem_fun_ref_t;\nusing std::mem_fun1_t;\nusing std::const_mem_fun1_t;\nusing std::mem_fun1_ref_t;\nusing std::const_mem_fun1_ref_t;\nusing std::mem_fun;\nusing std::mem_fun_ref;\n\n// Names from ext/functional\nusing __gnu_cxx::identity_element;\nusing __gnu_cxx::unary_compose;\nusing __gnu_cxx::binary_compose;\nusing __gnu_cxx::compose1;\nusing __gnu_cxx::compose2;\nusing __gnu_cxx::identity;\nusing __gnu_cxx::select1st;\nusing __gnu_cxx::select2nd;\nusing __gnu_cxx::project1st;\nusing __gnu_cxx::project2nd;\nusing __gnu_cxx::constant_void_fun;\nusing __gnu_cxx::constant_unary_fun;\nusing __gnu_cxx::constant_binary_fun;\nusing __gnu_cxx::constant0;\nusing __gnu_cxx::constant1;\nusing __gnu_cxx::constant2;\nusing __gnu_cxx::subtractive_rng;\nusing __gnu_cxx::mem_fun1;\nusing __gnu_cxx::mem_fun1_ref;\n\n#endif /* _BACKWARD_FUNCTION_H */\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/backward/hash_map.h",
    "content": "// Backward-compat support -*- C++ -*-\n\n// Copyright (C) 2001 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n/*\n * Copyright (c) 1996\n * Silicon Graphics Computer Systems, Inc.\n *\n * Permission to use, copy, modify, distribute and sell this software\n * and its documentation for any purpose is hereby granted without fee,\n * provided that the above copyright notice appear in all copies and\n * that both that copyright notice and this permission notice appear\n * in supporting documentation.  Silicon Graphics makes no\n * representations about the suitability of this software for any\n * purpose.  It is provided \"as is\" without express or implied warranty.\n *\n *\n * Copyright (c) 1994\n * Hewlett-Packard Company\n *\n * Permission to use, copy, modify, distribute and sell this software\n * and its documentation for any purpose is hereby granted without fee,\n * provided that the above copyright notice appear in all copies and\n * that both that copyright notice and this permission notice appear\n * in supporting documentation.  Hewlett-Packard Company makes no\n * representations about the suitability of this software for any\n * purpose.  It is provided \"as is\" without express or implied warranty.\n *\n */\n\n#ifndef _BACKWARD_HASH_MAP_H\n#define _BACKWARD_HASH_MAP_H 1\n\n#include \"backward_warning.h\"\n#include \"algobase.h\"\n#include <ext/hash_map>\n\nusing __gnu_cxx::hash;\nusing __gnu_cxx::hashtable;\nusing __gnu_cxx::hash_map;\nusing __gnu_cxx::hash_multimap;\n\n#endif /* _BACKWARD_HASH_MAP_H */\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/backward/hash_set.h",
    "content": "// Backward-compat support -*- C++ -*-\n\n// Copyright (C) 2001 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n/*\n * Copyright (c) 1996\n * Silicon Graphics Computer Systems, Inc.\n *\n * Permission to use, copy, modify, distribute and sell this software\n * and its documentation for any purpose is hereby granted without fee,\n * provided that the above copyright notice appear in all copies and\n * that both that copyright notice and this permission notice appear\n * in supporting documentation.  Silicon Graphics makes no\n * representations about the suitability of this software for any\n * purpose.  It is provided \"as is\" without express or implied warranty.\n *\n *\n * Copyright (c) 1994\n * Hewlett-Packard Company\n *\n * Permission to use, copy, modify, distribute and sell this software\n * and its documentation for any purpose is hereby granted without fee,\n * provided that the above copyright notice appear in all copies and\n * that both that copyright notice and this permission notice appear\n * in supporting documentation.  Hewlett-Packard Company makes no\n * representations about the suitability of this software for any\n * purpose.  It is provided \"as is\" without express or implied warranty.\n *\n */\n\n#ifndef _BACKWARD_HASH_SET_H\n#define _BACKWARD_HASH_SET_H 1\n\n#include \"backward_warning.h\"\n#include \"algobase.h\"\n#include <ext/hash_set>\n\nusing __gnu_cxx::hash;\nusing __gnu_cxx::hashtable;\nusing __gnu_cxx::hash_set;\nusing __gnu_cxx::hash_multiset;\n\n#endif /* _BACKWARD_HASH_SET_H */\n\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/backward/hashtable.h",
    "content": "// Backward-compat support -*- C++ -*-\n\n// Copyright (C) 2001 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n/*\n * Copyright (c) 1996,1997\n * Silicon Graphics Computer Systems, Inc.\n *\n * Permission to use, copy, modify, distribute and sell this software\n * and its documentation for any purpose is hereby granted without fee,\n * provided that the above copyright notice appear in all copies and\n * that both that copyright notice and this permission notice appear\n * in supporting documentation.  Silicon Graphics makes no\n * representations about the suitability of this software for any\n * purpose.  It is provided \"as is\" without express or implied warranty.\n *\n *\n * Copyright (c) 1994\n * Hewlett-Packard Company\n *\n * Permission to use, copy, modify, distribute and sell this software\n * and its documentation for any purpose is hereby granted without fee,\n * provided that the above copyright notice appear in all copies and\n * that both that copyright notice and this permission notice appear\n * in supporting documentation.  Hewlett-Packard Company makes no\n * representations about the suitability of this software for any\n * purpose.  It is provided \"as is\" without express or implied warranty.\n *\n */\n\n/* NOTE: This is an internal header file, included by other STL headers.\n *   You should not attempt to use it directly.\n */\n\n#ifndef _BACKWARD_HASHTABLE_H\n#define _BACKWARD_HASHTABLE_H 1\n\n#include \"backward_warning.h\"\n#include <ext/hashtable.h>\n#include \"algo.h\"\n#include \"alloc.h\"\n#include \"vector.h\"\n\nusing __gnu_cxx::hash;\nusing __gnu_cxx::hashtable;\n\n#endif /* _BACKWARD_HASHTABLE_H */\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/backward/heap.h",
    "content": "// Backward-compat support -*- C++ -*-\n\n// Copyright (C) 2001 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n/*\n *\n * Copyright (c) 1994\n * Hewlett-Packard Company\n *\n * Permission to use, copy, modify, distribute and sell this software\n * and its documentation for any purpose is hereby granted without fee,\n * provided that the above copyright notice appear in all copies and\n * that both that copyright notice and this permission notice appear\n * in supporting documentation.  Hewlett-Packard Company makes no\n * representations about the suitability of this software for any\n * purpose.  It is provided \"as is\" without express or implied warranty.\n *\n * Copyright (c) 1997\n * Silicon Graphics Computer Systems, Inc.\n *\n * Permission to use, copy, modify, distribute and sell this software\n * and its documentation for any purpose is hereby granted without fee,\n * provided that the above copyright notice appear in all copies and\n * that both that copyright notice and this permission notice appear\n * in supporting documentation.  Silicon Graphics makes no\n * representations about the suitability of this software for any\n * purpose.  It is provided \"as is\" without express or implied warranty.\n */\n\n#ifndef _BACKWARD_HEAP_H\n#define _BACKWARD_HEAP_H 1\n\n#include \"backward_warning.h\"\n#include <bits/c++config.h>\n#include <bits/stl_heap.h>\n\nusing std::push_heap;\nusing std::pop_heap;\nusing std::make_heap;\nusing std::sort_heap;\n\n#endif /* _BACKWARD_HEAP_H */\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/backward/iomanip.h",
    "content": "// Copyright (C) 2000 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n#ifndef _BACKWARD_IOMANIP_H\n#define _BACKWARD_IOMANIP_H 1\n\n#include \"backward_warning.h\"\n#include \"iostream.h\"\n#include <iomanip>\n\n// These are from <ios> as per [27.4].\nusing std::boolalpha;\nusing std::noboolalpha;\nusing std::showbase;\nusing std::noshowbase;\nusing std::showpoint;\nusing std::noshowpoint;\nusing std::showpos;\nusing std::noshowpos;\nusing std::skipws;\nusing std::noskipws;\nusing std::uppercase;\nusing std::nouppercase;\nusing std::internal;\nusing std::left;\nusing std::right;\nusing std::dec;\nusing std::hex;\nusing std::oct;\nusing std::fixed;\nusing std::scientific;\n\n// These are from <iomanip> as per [27.6].  Manipulators from <istream>\n// and <ostream> (e.g., endl) are made available via <iostream.h>.\nusing std::resetiosflags;\nusing std::setiosflags;\nusing std::setbase;\nusing std::setfill;\nusing std::setprecision;\nusing std::setw;\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/backward/iostream.h",
    "content": "// Copyright (C) 1997-1999, 2000 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n#ifndef _BACKWARD_IOSTREAM_H\n#define _BACKWARD_IOSTREAM_H 1\n\n#include \"backward_warning.h\"\n#include <iostream>\n\nusing std::iostream;\nusing std::ostream;\nusing std::istream;\nusing std::ios;\nusing std::streambuf;\n\nusing std::cout;\nusing std::cin;\nusing std::cerr;\nusing std::clog;\n#ifdef _GLIBCXX_USE_WCHAR_T\nusing std::wcout;\nusing std::wcin;\nusing std::wcerr;\nusing std::wclog;\n#endif\n\nusing std::ws;\nusing std::endl;\nusing std::ends;\nusing std::flush;\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/backward/istream.h",
    "content": "// Copyright (C) 2000 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n#ifndef _BACKWARD_ISTREAM_H\n#define _BACKWARD_ISTREAM_H 1\n\n#include \"backward_warning.h\"\n#include \"iostream.h\"\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/backward/iterator.h",
    "content": "// Backward-compat support -*- C++ -*-\n\n// Copyright (C) 2001, 2004 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n/*\n *\n * Copyright (c) 1994\n * Hewlett-Packard Company\n *\n * Permission to use, copy, modify, distribute and sell this software\n * and its documentation for any purpose is hereby granted without fee,\n * provided that the above copyright notice appear in all copies and\n * that both that copyright notice and this permission notice appear\n * in supporting documentation.  Hewlett-Packard Company makes no\n * representations about the suitability of this software for any\n * purpose.  It is provided \"as is\" without express or implied warranty.\n *\n *\n * Copyright (c) 1996\n * Silicon Graphics Computer Systems, Inc.\n *\n * Permission to use, copy, modify, distribute and sell this software\n * and its documentation for any purpose is hereby granted without fee,\n * provided that the above copyright notice appear in all copies and\n * that both that copyright notice and this permission notice appear\n * in supporting documentation.  Silicon Graphics makes no\n * representations about the suitability of this software for any\n * purpose.  It is provided \"as is\" without express or implied warranty.\n */\n\n#ifndef _BACKWARD_ITERATOR_H\n#define _BACKWARD_ITERATOR_H 1\n\n#include \"backward_warning.h\"\n#include \"function.h\"\n#include <stddef.h>\n#include \"iostream.h\"\n#include <iterator>\n\n#include <bits/stl_construct.h>\n#include <bits/stl_raw_storage_iter.h>\n\n#include <ext/iterator> // For 3-parameter distance extension\n\n// Names from stl_iterator.h\nusing std::input_iterator_tag;\nusing std::output_iterator_tag;\nusing std::forward_iterator_tag;\nusing std::bidirectional_iterator_tag;\nusing std::random_access_iterator_tag;\n\n#if 0\nusing std::iterator;\n#endif\n\n// The base classes input_iterator, output_iterator, forward_iterator,\n// bidirectional_iterator, and random_access_iterator are not part of\n// the C++ standard.  (They have been replaced by struct iterator.)\n// They are included for backward compatibility with the HP STL.\ntemplate<typename _Tp, typename _Distance>\n  struct input_iterator {\n    typedef input_iterator_tag iterator_category;\n    typedef _Tp                value_type;\n    typedef _Distance          difference_type;\n    typedef _Tp*               pointer;\n    typedef _Tp&               reference;\n  };\n\nstruct output_iterator {\n  typedef output_iterator_tag iterator_category;\n  typedef void                value_type;\n  typedef void                difference_type;\n  typedef void                pointer;\n  typedef void                reference;\n};\n\ntemplate<typename _Tp, typename _Distance>\n  struct forward_iterator {\n    typedef forward_iterator_tag iterator_category;\n    typedef _Tp                  value_type;\n    typedef _Distance            difference_type;\n    typedef _Tp*                 pointer;\n    typedef _Tp&                 reference;\n  };\n\ntemplate<typename _Tp, typename _Distance>\n  struct bidirectional_iterator {\n    typedef bidirectional_iterator_tag iterator_category;\n    typedef _Tp                        value_type;\n    typedef _Distance                  difference_type;\n    typedef _Tp*                       pointer;\n    typedef _Tp&                       reference;\n  };\n\ntemplate<typename _Tp, typename _Distance>\n  struct random_access_iterator {\n    typedef random_access_iterator_tag iterator_category;\n    typedef _Tp                        value_type;\n    typedef _Distance                  difference_type;\n    typedef _Tp*                       pointer;\n    typedef _Tp&                       reference;\n  };\n\nusing std::iterator_traits;\n\ntemplate <class _Iter>\n  inline typename iterator_traits<_Iter>::iterator_category\n  iterator_category(const _Iter& __i)\n  { return __iterator_category(__i); }\n\ntemplate <class _Iter>\n  inline typename iterator_traits<_Iter>::difference_type*\n  distance_type(const _Iter&)\n  { return static_cast<typename iterator_traits<_Iter>::difference_type*>(0); }\n\ntemplate<class _Iter>\n  inline typename iterator_traits<_Iter>::value_type*\n  value_type(const _Iter& __i)\n  { return static_cast<typename iterator_traits<_Iter>::value_type*>(0); }\n\nusing std::distance;\nusing __gnu_cxx::distance; // 3-parameter extension\nusing std::advance;\n\nusing std::insert_iterator;\nusing std::front_insert_iterator;\nusing std::back_insert_iterator;\nusing std::inserter;\nusing std::front_inserter;\nusing std::back_inserter;\n\nusing std::reverse_iterator;\n\nusing std::istream_iterator;\nusing std::ostream_iterator;\n\n// Names from stl_construct.h\ntemplate<class _T1, class _T2>\n  inline void\n  construct(_T1* __p, const _T2& __value)\n  { std::_Construct(__p, __value); }\n\ntemplate<class _T1>\n  inline void\n  construct(_T1* __p)\n  { std::_Construct(__p); }\n\ntemplate <class _Tp>\n  inline void\n  destroy(_Tp* __pointer)\n  { std::_Destroy(__pointer); }\n\ntemplate <class _ForwardIterator>\n  inline void\n  destroy(_ForwardIterator __first, _ForwardIterator __last)\n  { std::_Destroy(__first, __last); }\n\n\n// Names from stl_raw_storage_iter.h\nusing std::raw_storage_iterator;\n\n#endif /* _BACKWARD_ITERATOR_H */\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/backward/list.h",
    "content": "// Backward-compat support -*- C++ -*-\n\n// Copyright (C) 2001 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n/*\n *\n * Copyright (c) 1994\n * Hewlett-Packard Company\n *\n * Permission to use, copy, modify, distribute and sell this software\n * and its documentation for any purpose is hereby granted without fee,\n * provided that the above copyright notice appear in all copies and\n * that both that copyright notice and this permission notice appear\n * in supporting documentation.  Hewlett-Packard Company makes no\n * representations about the suitability of this software for any\n * purpose.  It is provided \"as is\" without express or implied warranty.\n *\n *\n * Copyright (c) 1996,1997\n * Silicon Graphics Computer Systems, Inc.\n *\n * Permission to use, copy, modify, distribute and sell this software\n * and its documentation for any purpose is hereby granted without fee,\n * provided that the above copyright notice appear in all copies and\n * that both that copyright notice and this permission notice appear\n * in supporting documentation.  Silicon Graphics makes no\n * representations about the suitability of this software for any\n * purpose.  It is provided \"as is\" without express or implied warranty.\n */\n\n#ifndef _BACKWARD_LIST_H\n#define _BACKWARD_LIST_H 1\n\n#include \"backward_warning.h\"\n#include \"algobase.h\"\n#include \"alloc.h\"\n#include <list>\n\nusing std::list;\n\n#endif /* _BACKWARD_LIST_H */\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/backward/map.h",
    "content": "// Backward-compat support -*- C++ -*-\n\n// Copyright (C) 2001 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n/*\n *\n * Copyright (c) 1994\n * Hewlett-Packard Company\n *\n * Permission to use, copy, modify, distribute and sell this software\n * and its documentation for any purpose is hereby granted without fee,\n * provided that the above copyright notice appear in all copies and\n * that both that copyright notice and this permission notice appear\n * in supporting documentation.  Hewlett-Packard Company makes no\n * representations about the suitability of this software for any\n * purpose.  It is provided \"as is\" without express or implied warranty.\n *\n *\n * Copyright (c) 1996,1997\n * Silicon Graphics Computer Systems, Inc.\n *\n * Permission to use, copy, modify, distribute and sell this software\n * and its documentation for any purpose is hereby granted without fee,\n * provided that the above copyright notice appear in all copies and\n * that both that copyright notice and this permission notice appear\n * in supporting documentation.  Silicon Graphics makes no\n * representations about the suitability of this software for any\n * purpose.  It is provided \"as is\" without express or implied warranty.\n */\n\n#ifndef _BACKWARD_MAP_H\n#define _BACKWARD_MAP_H 1\n\n#include \"backward_warning.h\"\n#include \"tree.h\"\n#include <map>\n\nusing std::map;\n\n#endif /* _BACKWARD_MAP_H */\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/backward/multimap.h",
    "content": "// Backward-compat support -*- C++ -*-\n\n// Copyright (C) 2001 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n/*\n *\n * Copyright (c) 1994\n * Hewlett-Packard Company\n *\n * Permission to use, copy, modify, distribute and sell this software\n * and its documentation for any purpose is hereby granted without fee,\n * provided that the above copyright notice appear in all copies and\n * that both that copyright notice and this permission notice appear\n * in supporting documentation.  Hewlett-Packard Company makes no\n * representations about the suitability of this software for any\n * purpose.  It is provided \"as is\" without express or implied warranty.\n *\n *\n * Copyright (c) 1996,1997\n * Silicon Graphics Computer Systems, Inc.\n *\n * Permission to use, copy, modify, distribute and sell this software\n * and its documentation for any purpose is hereby granted without fee,\n * provided that the above copyright notice appear in all copies and\n * that both that copyright notice and this permission notice appear\n * in supporting documentation.  Silicon Graphics makes no\n * representations about the suitability of this software for any\n * purpose.  It is provided \"as is\" without express or implied warranty.\n */\n\n#ifndef _BACKWARD_MULTIMAP_H\n#define _BACKWARD_MULTIMAP_H 1\n\n#include \"backward_warning.h\"\n#include \"tree.h\"\n#include <map>\n\nusing std::multimap;\n\n#endif /* _BACKWARD_MULTIMAP_H */\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/backward/multiset.h",
    "content": "// Backward-compat support -*- C++ -*-\n\n// Copyright (C) 2001 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n/*\n *\n * Copyright (c) 1994\n * Hewlett-Packard Company\n *\n * Permission to use, copy, modify, distribute and sell this software\n * and its documentation for any purpose is hereby granted without fee,\n * provided that the above copyright notice appear in all copies and\n * that both that copyright notice and this permission notice appear\n * in supporting documentation.  Hewlett-Packard Company makes no\n * representations about the suitability of this software for any\n * purpose.  It is provided \"as is\" without express or implied warranty.\n *\n *\n * Copyright (c) 1996,1997\n * Silicon Graphics Computer Systems, Inc.\n *\n * Permission to use, copy, modify, distribute and sell this software\n * and its documentation for any purpose is hereby granted without fee,\n * provided that the above copyright notice appear in all copies and\n * that both that copyright notice and this permission notice appear\n * in supporting documentation.  Silicon Graphics makes no\n * representations about the suitability of this software for any\n * purpose.  It is provided \"as is\" without express or implied warranty.\n */\n\n#ifndef _BACKWARD_MULTISET_H\n#define _BACKWARD_MULTISET_H 1\n\n#include \"backward_warning.h\"\n#include \"tree.h\"\n#include <set>\n\nusing std::multiset;\n\n#endif /* _BACKWARD_MULTISET_H */\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/backward/new.h",
    "content": "// -*- C++ -*- forwarding header.\n// Copyright (C) 2000 Free Software Foundation\n\n// This file is part of GCC.\n//\n// GCC is free software; you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation; either version 2, or (at your option)\n// any later version.\n//\n// GCC is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with GCC; see the file COPYING.  If not, write to\n// the Free Software Foundation, 51 Franklin Street, Fifth Floor,\n// Boston, MA 02110-1301, USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n#ifndef _BACKWARD_NEW_H\n#define _BACKWARD_NEW_H 1\n\n#include \"backward_warning.h\"\n#include <new>\n\nusing std::bad_alloc;\nusing std::nothrow_t;\nusing std::nothrow;\nusing std::new_handler;\nusing std::set_new_handler;\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/backward/ostream.h",
    "content": "// Copyright (C) 2000 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n#ifndef _BACKWARD_OSTREAM_H\n#define _BACKWARD_OSTREAM_H 1\n\n#include \"backward_warning.h\"\n#include \"iostream.h\"\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/backward/pair.h",
    "content": "// Backward-compat support -*- C++ -*-\n\n// Copyright (C) 2001 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n/*\n *\n * Copyright (c) 1994\n * Hewlett-Packard Company\n *\n * Permission to use, copy, modify, distribute and sell this software\n * and its documentation for any purpose is hereby granted without fee,\n * provided that the above copyright notice appear in all copies and\n * that both that copyright notice and this permission notice appear\n * in supporting documentation.  Hewlett-Packard Company makes no\n * representations about the suitability of this software for any\n * purpose.  It is provided \"as is\" without express or implied warranty.\n *\n *\n * Copyright (c) 1996,1997\n * Silicon Graphics Computer Systems, Inc.\n *\n * Permission to use, copy, modify, distribute and sell this software\n * and its documentation for any purpose is hereby granted without fee,\n * provided that the above copyright notice appear in all copies and\n * that both that copyright notice and this permission notice appear\n * in supporting documentation.  Silicon Graphics makes no\n * representations about the suitability of this software for any\n * purpose.  It is provided \"as is\" without express or implied warranty.\n */\n\n#ifndef _BACKWARD_PAIR_H\n#define _BACKWARD_PAIR_H 1\n\n#include \"backward_warning.h\"\n#include <bits/c++config.h>\n#include <bits/stl_pair.h>\n\nusing std::pair;\nusing std::make_pair;\n\n#endif /* _BACKWARD_PAIR_H */\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/backward/queue.h",
    "content": "// Copyright (C) 2001 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n#ifndef _BACKWARD_QUEUE_H\n#define _BACKWARD_QUEUE_H 1\n\n#include \"backward_warning.h\"\n#include <queue>\n\nusing std::queue;\nusing std::priority_queue;\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/backward/rope.h",
    "content": "// Backward-compat support -*- C++ -*-\n\n// Copyright (C) 2001 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n/*\n * Copyright (c) 1997\n * Silicon Graphics Computer Systems, Inc.\n *\n * Permission to use, copy, modify, distribute and sell this software\n * and its documentation for any purpose is hereby granted without fee,\n * provided that the above copyright notice appear in all copies and\n * that both that copyright notice and this permission notice appear\n * in supporting documentation.  Silicon Graphics makes no\n * representations about the suitability of this software for any\n * purpose.  It is provided \"as is\" without express or implied warranty.\n */\n\n#ifndef _BACKWARD_ROPE_H\n#define _BACKWARD_ROPE_H 1\n\n#include \"backward_warning.h\"\n#include \"hashtable.h\"\n#include <ext/rope>\n\nusing __gnu_cxx::char_producer;\nusing __gnu_cxx::sequence_buffer;\nusing __gnu_cxx::rope;\nusing __gnu_cxx::crope;\nusing __gnu_cxx::wrope;\n\n#endif /* _BACKWARD_ROPE_H */\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/backward/set.h",
    "content": "// Backward-compat support -*- C++ -*-\n\n// Copyright (C) 2001 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n/*\n *\n * Copyright (c) 1994\n * Hewlett-Packard Company\n *\n * Permission to use, copy, modify, distribute and sell this software\n * and its documentation for any purpose is hereby granted without fee,\n * provided that the above copyright notice appear in all copies and\n * that both that copyright notice and this permission notice appear\n * in supporting documentation.  Hewlett-Packard Company makes no\n * representations about the suitability of this software for any\n * purpose.  It is provided \"as is\" without express or implied warranty.\n *\n *\n * Copyright (c) 1996,1997\n * Silicon Graphics Computer Systems, Inc.\n *\n * Permission to use, copy, modify, distribute and sell this software\n * and its documentation for any purpose is hereby granted without fee,\n * provided that the above copyright notice appear in all copies and\n * that both that copyright notice and this permission notice appear\n * in supporting documentation.  Silicon Graphics makes no\n * representations about the suitability of this software for any\n * purpose.  It is provided \"as is\" without express or implied warranty.\n */\n\n#ifndef _BACKWARD_SET_H\n#define _BACKWARD_SET_H 1\n\n#include \"backward_warning.h\"\n#include \"tree.h\"\n#include <set>\n\nusing std::set;\n\n#endif /* _BACKWARD_SET_H */\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/backward/slist.h",
    "content": "// Backward-compat support -*- C++ -*-\n\n// Copyright (C) 2001 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n/*\n * Copyright (c) 1997\n * Silicon Graphics Computer Systems, Inc.\n *\n * Permission to use, copy, modify, distribute and sell this software\n * and its documentation for any purpose is hereby granted without fee,\n * provided that the above copyright notice appear in all copies and\n * that both that copyright notice and this permission notice appear\n * in supporting documentation.  Silicon Graphics makes no\n * representations about the suitability of this software for any\n * purpose.  It is provided \"as is\" without express or implied warranty.\n *\n */\n\n#ifndef _BACKWARD_SLIST_H\n#define _BACKWARD_SLIST_H 1\n\n#include \"backward_warning.h\"\n#include <ext/slist>\n\nusing __gnu_cxx::slist;\n\n#endif /* _BACKWARD_SLIST_H */\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/backward/stack.h",
    "content": "// Backward-compat support -*- C++ -*-\n\n// Copyright (C) 2001 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n/*\n *\n * Copyright (c) 1994\n * Hewlett-Packard Company\n *\n * Permission to use, copy, modify, distribute and sell this software\n * and its documentation for any purpose is hereby granted without fee,\n * provided that the above copyright notice appear in all copies and\n * that both that copyright notice and this permission notice appear\n * in supporting documentation.  Hewlett-Packard Company makes no\n * representations about the suitability of this software for any\n * purpose.  It is provided \"as is\" without express or implied warranty.\n *\n *\n * Copyright (c) 1996,1997\n * Silicon Graphics Computer Systems, Inc.\n *\n * Permission to use, copy, modify, distribute and sell this software\n * and its documentation for any purpose is hereby granted without fee,\n * provided that the above copyright notice appear in all copies and\n * that both that copyright notice and this permission notice appear\n * in supporting documentation.  Silicon Graphics makes no\n * representations about the suitability of this software for any\n * purpose.  It is provided \"as is\" without express or implied warranty.\n */\n\n#ifndef _BACKWARD_STACK_H\n#define _BACKWARD_STACK_H 1\n\n#include \"backward_warning.h\"\n#include \"vector.h\"\n#include \"deque.h\"\n#include \"heap.h\"\n#include \"queue.h\"\n#include <stack>\n\nusing std::stack;\n\n#endif /* _BACKWARD_STACK_H */\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/backward/stream.h",
    "content": "// Copyright (C) 2000 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n#ifndef _BACKWARD_STREAM_H\n#define _BACKWARD_STREAM_H 1\n\n#include \"backward_warning.h\"\n#include \"iostream.h\"\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/backward/streambuf.h",
    "content": "// Copyright (C) 2000 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n#ifndef _BACKWARD_STREAMBUF_H\n#define _BACKWARD_STREAMBUF_H 1\n\n#include \"backward_warning.h\"\n#include <streambuf>\n\nusing std::streambuf;\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/backward/strstream",
    "content": "// Backward-compat support -*- C++ -*-\n\n// Copyright (C) 2001, 2002, 2004, 2005 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n/*\n * Copyright (c) 1998\n * Silicon Graphics Computer Systems, Inc.\n *\n * Permission to use, copy, modify, distribute and sell this software\n * and its documentation for any purpose is hereby granted without fee,\n * provided that the above copyright notice appear in all copies and\n * that both that copyright notice and this permission notice appear\n * in supporting documentation.  Silicon Graphics makes no\n * representations about the suitability of this software for any\n * purpose.  It is provided \"as is\" without express or implied warranty.\n */\n\n// WARNING: The classes defined in this header are DEPRECATED.  This\n// header is defined in section D.7.1 of the C++ standard, and it\n// MAY BE REMOVED in a future standard revision.  You should use the\n// header <sstream> instead.\n\n#ifndef __SGI_STL_STRSTREAM\n#define __SGI_STL_STRSTREAM\n\n#include \"backward_warning.h\"\n#include <iosfwd>\n#include <ios>\n#include <istream>\n#include <ostream>\n#include <string>\n\n_GLIBCXX_BEGIN_NAMESPACE(std)\n\n  // Class strstreambuf, a streambuf class that manages an array of char.\n  // Note that this class is not a template.\n  class strstreambuf : public basic_streambuf<char, char_traits<char> >\n  {\n  public:\n    // Types.\n    typedef char_traits<char>              _Traits;\n    typedef basic_streambuf<char, _Traits> _Base;\n\n  public:\n    // Constructor, destructor\n    explicit strstreambuf(streamsize __initial_capacity = 0);\n    strstreambuf(void* (*__alloc)(size_t), void (*__free)(void*));\n\n    strstreambuf(char* __get, streamsize __n, char* __put = 0);\n    strstreambuf(signed char* __get, streamsize __n, signed char* __put = 0);\n    strstreambuf(unsigned char* __get, streamsize __n, unsigned char* __put=0);\n\n    strstreambuf(const char* __get, streamsize __n);\n    strstreambuf(const signed char* __get, streamsize __n);\n    strstreambuf(const unsigned char* __get, streamsize __n);\n\n    virtual ~strstreambuf();\n\n  public:\n    void freeze(bool = true);\n    char* str();\n    int pcount() const;\n\n  protected:\n    virtual int_type overflow(int_type __c  = _Traits::eof());\n    virtual int_type pbackfail(int_type __c = _Traits::eof());\n    virtual int_type underflow();\n    virtual _Base* setbuf(char* __buf, streamsize __n);\n    virtual pos_type seekoff(off_type __off, ios_base::seekdir __dir,\n\t\t\t     ios_base::openmode __mode\n\t\t\t     = ios_base::in | ios_base::out);\n    virtual pos_type seekpos(pos_type __pos, ios_base::openmode __mode\n\t\t\t     = ios_base::in | ios_base::out);\n\n  private:\n    strstreambuf&\n    operator=(const strstreambuf&);\n\n    strstreambuf(const strstreambuf&);\n\n    // Dynamic allocation, possibly using _M_alloc_fun and _M_free_fun.\n    char* _M_alloc(size_t);\n    void  _M_free(char*);\n\n    // Helper function used in constructors.\n    void _M_setup(char* __get, char* __put, streamsize __n);\n\n  private:\n    // Data members.\n    void* (*_M_alloc_fun)(size_t);\n    void  (*_M_free_fun)(void*);\n\n    bool _M_dynamic  : 1;\n    bool _M_frozen   : 1;\n    bool _M_constant : 1;\n  };\n\n  // Class istrstream, an istream that manages a strstreambuf.\n  class istrstream : public basic_istream<char>\n  {\n  public:\n    explicit istrstream(char*);\n    explicit istrstream(const char*);\n    istrstream(char* , streamsize);\n    istrstream(const char*, streamsize);\n    virtual ~istrstream();\n\n    strstreambuf* rdbuf() const;\n    char* str();\n\n  private:\n    strstreambuf _M_buf;\n  };\n\n  // Class ostrstream\n  class ostrstream : public basic_ostream<char>\n  {\n  public:\n    ostrstream();\n    ostrstream(char*, int, ios_base::openmode = ios_base::out);\n    virtual ~ostrstream();\n\n    strstreambuf* rdbuf() const;\n    void freeze(bool = true);\n    char* str();\n    int pcount() const;\n\n  private:\n    strstreambuf _M_buf;\n  };\n\n  // Class strstream\n  class strstream : public basic_iostream<char>\n  {\n  public:\n    typedef char                        char_type;\n    typedef char_traits<char>::int_type int_type;\n    typedef char_traits<char>::pos_type pos_type;\n    typedef char_traits<char>::off_type off_type;\n\n    strstream();\n    strstream(char*, int, ios_base::openmode = ios_base::in | ios_base::out);\n    virtual ~strstream();\n\n    strstreambuf* rdbuf() const;\n    void freeze(bool = true);\n    int pcount() const;\n    char* str();\n\n  private:\n    strstreambuf _M_buf;\n  };\n\n_GLIBCXX_END_NAMESPACE\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/backward/tempbuf.h",
    "content": "// Backward-compat support -*- C++ -*-\n\n// Copyright (C) 2001, 2005 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n/*\n *\n * Copyright (c) 1994\n * Hewlett-Packard Company\n *\n * Permission to use, copy, modify, distribute and sell this software\n * and its documentation for any purpose is hereby granted without fee,\n * provided that the above copyright notice appear in all copies and\n * that both that copyright notice and this permission notice appear\n * in supporting documentation.  Hewlett-Packard Company makes no\n * representations about the suitability of this software for any\n * purpose.  It is provided \"as is\" without express or implied warranty.\n *\n *\n * Copyright (c) 1996\n * Silicon Graphics Computer Systems, Inc.\n *\n * Permission to use, copy, modify, distribute and sell this software\n * and its documentation for any purpose is hereby granted without fee,\n * provided that the above copyright notice appear in all copies and\n * that both that copyright notice and this permission notice appear\n * in supporting documentation.  Silicon Graphics makes no\n * representations about the suitability of this software for any\n * purpose.  It is provided \"as is\" without express or implied warranty.\n */\n\n#ifndef _BACKWARD_TEMPBUF_H\n#define _BACKWARD_TEMPBUF_H 1\n\n#include \"backward_warning.h\"\n#include \"pair.h\"\n#include \"iterator.h\"\n#include <limits.h>\n#include <stddef.h>\n#include <stdlib.h>\n#include <bits/cpp_type_traits.h>\n#include <bits/stl_construct.h>\n#include <bits/stl_uninitialized.h>\n#include <ext/memory>\n\nusing std::get_temporary_buffer;\nusing std::return_temporary_buffer;\nusing __gnu_cxx::temporary_buffer;\n\n#endif /* _BACKWARD_TEMPBUF_H */\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/backward/tree.h",
    "content": "// Backward-compat support -*- C++ -*-\n\n// Copyright (C) 2001 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n/*\n * Copyright (c) 1997\n * Silicon Graphics Computer Systems, Inc.\n *\n * Permission to use, copy, modify, distribute and sell this software\n * and its documentation for any purpose is hereby granted without fee,\n * provided that the above copyright notice appear in all copies and\n * that both that copyright notice and this permission notice appear\n * in supporting documentation.  Silicon Graphics makes no\n * representations about the suitability of this software for any\n * purpose.  It is provided \"as is\" without express or implied warranty.\n *\n */\n\n#ifndef _BACKWARD_TREE\n#define _BACKWARD_TREE 1\n\n#include \"backward_warning.h\"\n#include <ext/rb_tree>\n\nusing __gnu_cxx::rb_tree;\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/backward/vector.h",
    "content": "// Backward-compat support -*- C++ -*-\n\n// Copyright (C) 2001 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n/*\n *\n * Copyright (c) 1994\n * Hewlett-Packard Company\n *\n * Permission to use, copy, modify, distribute and sell this software\n * and its documentation for any purpose is hereby granted without fee,\n * provided that the above copyright notice appear in all copies and\n * that both that copyright notice and this permission notice appear\n * in supporting documentation.  Hewlett-Packard Company makes no\n * representations about the suitability of this software for any\n * purpose.  It is provided \"as is\" without express or implied warranty.\n *\n *\n * Copyright (c) 1996\n * Silicon Graphics Computer Systems, Inc.\n *\n * Permission to use, copy, modify, distribute and sell this software\n * and its documentation for any purpose is hereby granted without fee,\n * provided that the above copyright notice appear in all copies and\n * that both that copyright notice and this permission notice appear\n * in supporting documentation.  Silicon Graphics makes no\n * representations about the suitability of this software for any\n * purpose.  It is provided \"as is\" without express or implied warranty.\n */\n\n#ifndef _BACKWARD_VECTOR_H\n#define _BACKWARD_VECTOR_H 1\n\n#include \"backward_warning.h\"\n#include \"algobase.h\"\n#include \"alloc.h\"\n#include <vector>\n\nusing std::vector;\n\n#endif /* _BACKWARD_VECTOR_H */\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/bits/allocator.h",
    "content": "// Allocators -*- C++ -*-\n\n// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006\n// Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n/*\n * Copyright (c) 1996-1997\n * Silicon Graphics Computer Systems, Inc.\n *\n * Permission to use, copy, modify, distribute and sell this software\n * and its documentation for any purpose is hereby granted without fee,\n * provided that the above copyright notice appear in all copies and\n * that both that copyright notice and this permission notice appear\n * in supporting documentation.  Silicon Graphics makes no\n * representations about the suitability of this software for any\n * purpose.  It is provided \"as is\" without express or implied warranty.\n */\n\n/** @file allocator.h\n *  This is an internal header file, included by other library headers.\n *  You should not attempt to use it directly.\n */\n\n#ifndef _ALLOCATOR_H\n#define _ALLOCATOR_H 1\n\n// Define the base class to std::allocator.\n#include <bits/c++allocator.h>\n\n#include <bits/cpp_type_traits.h> // for __is_empty\n\n_GLIBCXX_BEGIN_NAMESPACE(std)\n\n  template<typename _Tp>\n    class allocator;\n\n  /// allocator<void> specialization.\n  template<>\n    class allocator<void>\n    {\n    public:\n      typedef size_t      size_type;\n      typedef ptrdiff_t   difference_type;\n      typedef void*       pointer;\n      typedef const void* const_pointer;\n      typedef void        value_type;\n\n      template<typename _Tp1>\n        struct rebind\n        { typedef allocator<_Tp1> other; };\n    };\n\n  /**\n   * @brief  The \"standard\" allocator, as per [20.4].\n   *\n   *  Further details:\n   *  http://gcc.gnu.org/onlinedocs/libstdc++/20_util/allocator.html\n   */\n  template<typename _Tp>\n    class allocator: public __glibcxx_base_allocator<_Tp>\n    {\n   public:\n      typedef size_t     size_type;\n      typedef ptrdiff_t  difference_type;\n      typedef _Tp*       pointer;\n      typedef const _Tp* const_pointer;\n      typedef _Tp&       reference;\n      typedef const _Tp& const_reference;\n      typedef _Tp        value_type;\n\n      template<typename _Tp1>\n        struct rebind\n        { typedef allocator<_Tp1> other; };\n\n      allocator() throw() { }\n\n      allocator(const allocator& __a) throw()\n      : __glibcxx_base_allocator<_Tp>(__a) { }\n\n      template<typename _Tp1>\n        allocator(const allocator<_Tp1>&) throw() { }\n\n      ~allocator() throw() { }\n\n      // Inherit everything else.\n    };\n\n  template<typename _T1, typename _T2>\n    inline bool\n    operator==(const allocator<_T1>&, const allocator<_T2>&)\n    { return true; }\n\n  template<typename _T1, typename _T2>\n    inline bool\n    operator!=(const allocator<_T1>&, const allocator<_T2>&)\n    { return false; }\n\n  // Inhibit implicit instantiations for required instantiations,\n  // which are defined via explicit instantiations elsewhere.\n  // NB: This syntax is a GNU extension.\n#if _GLIBCXX_EXTERN_TEMPLATE\n  extern template class allocator<char>;\n  extern template class allocator<wchar_t>;\n#endif\n\n  // Undefine.\n#undef __glibcxx_base_allocator\n\n  // To implement Option 3 of DR 431.\n  template<typename _Alloc, bool = std::__is_empty<_Alloc>::__value>\n    struct __alloc_swap\n    { static void _S_do_it(_Alloc&, _Alloc&) { } };\n\n  template<typename _Alloc>\n    struct __alloc_swap<_Alloc, false>\n    {\n      static void\n      _S_do_it(_Alloc& __one, _Alloc& __two)\n      {\n\t// Precondition: swappable allocators.\n\tif (__one != __two)\n\t  swap(__one, __two);\n      }\n    };\n\n_GLIBCXX_END_NAMESPACE\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/bits/atomic_word.h",
    "content": "// Low-level type for atomic operations -*- C++ -*-\n\n// Copyright (C) 2004 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n/** @file atomic_word.h\n *  This file is a GNU extension to the Standard C++ Library.\n */\n\n#ifndef _GLIBCXX_ATOMIC_WORD_H\n#define _GLIBCXX_ATOMIC_WORD_H\t1\n\ntypedef int _Atomic_word;\n\n// Define these two macros using the appropriate memory barrier for the target.\n// The commented out versions below are the defaults.\n// See ia64/atomic_word.h for an alternative approach.\n\n// This one prevents loads from being hoisted across the barrier;\n// in other words, this is a Load-Load acquire barrier.\n// This is necessary iff TARGET_RELAXED_ORDERING is defined in tm.h.  \n// #define _GLIBCXX_READ_MEM_BARRIER __asm __volatile (\"\":::\"memory\")\n\n// This one prevents stores from being sunk across the barrier; in other\n// words, a Store-Store release barrier.\n// #define _GLIBCXX_WRITE_MEM_BARRIER __asm __volatile (\"\":::\"memory\")\n\n#endif \n"
  },
  {
    "path": "freebsd-headers/c++/4.2/bits/basic_file.h",
    "content": "// Wrapper of C-language FILE struct -*- C++ -*-\n\n// Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005\n// Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n//\n// ISO C++ 14882: 27.8  File-based streams\n//\n\n/** @file basic_file.h\n *  This is an internal header file, included by other library headers.\n *  You should not attempt to use it directly.\n */\n\n#ifndef _BASIC_FILE_STDIO_H\n#define _BASIC_FILE_STDIO_H 1\n\n#pragma GCC system_header\n\n#include <bits/c++config.h>\n#include <ios>\n\n_GLIBCXX_BEGIN_NAMESPACE(std)\n\n  // Generic declaration.\n  template<typename _CharT>\n    class __basic_file; \n\n  // Specialization.\n  template<>\n    class __basic_file<char>\n    {\n      // Underlying data source/sink.\n      __c_file* \t_M_cfile;\n\n      // True iff we opened _M_cfile, and thus must close it ourselves.\n      bool \t\t_M_cfile_created;\n\n    public:\n      __basic_file(__c_lock* __lock = 0);\n\n      __basic_file* \n      open(const char* __name, ios_base::openmode __mode, int __prot = 0664);\n\n      __basic_file*\n      sys_open(__c_file* __file, ios_base::openmode);\n\n      __basic_file*\n      sys_open(int __fd, ios_base::openmode __mode);\n\n      __basic_file* \n      close(); \n\n      bool \n      is_open() const;\n\n      int \n      fd();\n\n      __c_file*\n      file();\n\n      ~__basic_file();\n\n      streamsize \n      xsputn(const char* __s, streamsize __n);\n\n      streamsize \n      xsputn_2(const char* __s1, streamsize __n1,\n\t       const char* __s2, streamsize __n2);\n\n      streamsize \n      xsgetn(char* __s, streamsize __n);\n\n      streamoff\n      seekoff(streamoff __off, ios_base::seekdir __way);\n\n      int \n      sync();\n\n      streamsize\n      showmanyc();\n    };\n\n_GLIBCXX_END_NAMESPACE\n\n#endif\t\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/bits/basic_ios.h",
    "content": "// Iostreams base classes -*- C++ -*-\n\n// Copyright (C) 1997, 1998, 1999, 2001, 2002, 2003, 2004, 2005\n// Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n/** @file basic_ios.h\n *  This is an internal header file, included by other library headers.\n *  You should not attempt to use it directly.\n */\n\n#ifndef _BASIC_IOS_H\n#define _BASIC_IOS_H 1\n\n#pragma GCC system_header\n\n#include <bits/streambuf_iterator.h>\n#include <bits/localefwd.h>\n#include <bits/locale_classes.h>\n#include <bits/locale_facets.h>\n\n_GLIBCXX_BEGIN_NAMESPACE(std)\n\n  // 27.4.5  Template class basic_ios\n  /**\n   *  @brief  Virtual base class for all stream classes.\n   *\n   *  Most of the member functions called dispatched on stream objects\n   *  (e.g., @c std::cout.foo(bar);) are consolidated in this class.\n  */\n  template<typename _CharT, typename _Traits>\n    class basic_ios : public ios_base\n    {\n    public:\n      //@{\n      /**\n       *  These are standard types.  They permit a standardized way of\n       *  referring to names of (or names dependant on) the template\n       *  parameters, which are specific to the implementation.\n      */\n      typedef _CharT                                 char_type;\n      typedef typename _Traits::int_type             int_type;\n      typedef typename _Traits::pos_type             pos_type;\n      typedef typename _Traits::off_type             off_type;\n      typedef _Traits                                traits_type;\n      //@}\n\n      //@{\n      /**\n       *  @if maint\n       *  These are non-standard types.\n       *  @endif\n      */\n      typedef ctype<_CharT>                          __ctype_type;\n      typedef num_put<_CharT, ostreambuf_iterator<_CharT, _Traits> >\n\t\t\t\t\t\t     __num_put_type;\n      typedef num_get<_CharT, istreambuf_iterator<_CharT, _Traits> >\n\t\t\t\t\t\t     __num_get_type;\n      //@}\n\n      // Data members:\n    protected:\n      basic_ostream<_CharT, _Traits>*                _M_tie;\n      mutable char_type                              _M_fill;\n      mutable bool                                   _M_fill_init;\n      basic_streambuf<_CharT, _Traits>*              _M_streambuf;\n\n      // Cached use_facet<ctype>, which is based on the current locale info.\n      const __ctype_type*                            _M_ctype;\n      // For ostream.\n      const __num_put_type*                          _M_num_put;\n      // For istream.\n      const __num_get_type*                          _M_num_get;\n\n    public:\n      //@{\n      /**\n       *  @brief  The quick-and-easy status check.\n       *\n       *  This allows you to write constructs such as\n       *  \"if (!a_stream) ...\" and \"while (a_stream) ...\"\n      */\n      operator void*() const\n      { return this->fail() ? 0 : const_cast<basic_ios*>(this); }\n\n      bool\n      operator!() const\n      { return this->fail(); }\n      //@}\n\n      /**\n       *  @brief  Returns the error state of the stream buffer.\n       *  @return  A bit pattern (well, isn't everything?)\n       *\n       *  See std::ios_base::iostate for the possible bit values.  Most\n       *  users will call one of the interpreting wrappers, e.g., good().\n      */\n      iostate\n      rdstate() const\n      { return _M_streambuf_state; }\n\n      /**\n       *  @brief  [Re]sets the error state.\n       *  @param  state  The new state flag(s) to set.\n       *\n       *  See std::ios_base::iostate for the possible bit values.  Most\n       *  users will not need to pass an argument.\n      */\n      void\n      clear(iostate __state = goodbit);\n\n      /**\n       *  @brief  Sets additional flags in the error state.\n       *  @param  state  The additional state flag(s) to set.\n       *\n       *  See std::ios_base::iostate for the possible bit values.\n      */\n      void\n      setstate(iostate __state)\n      { this->clear(this->rdstate() | __state); }\n\n      // Flip the internal state on for the proper state bits, then re\n      // throws the propagated exception if bit also set in\n      // exceptions().\n      void\n      _M_setstate(iostate __state)\n      {\n\t// 27.6.1.2.1 Common requirements.\n\t// Turn this on without causing an ios::failure to be thrown.\n\t_M_streambuf_state |= __state;\n\tif (this->exceptions() & __state)\n\t  __throw_exception_again;\n      }\n\n      /**\n       *  @brief  Fast error checking.\n       *  @return  True if no error flags are set.\n       *\n       *  A wrapper around rdstate.\n      */\n      bool\n      good() const\n      { return this->rdstate() == 0; }\n\n      /**\n       *  @brief  Fast error checking.\n       *  @return  True if the eofbit is set.\n       *\n       *  Note that other iostate flags may also be set.\n      */\n      bool\n      eof() const\n      { return (this->rdstate() & eofbit) != 0; }\n\n      /**\n       *  @brief  Fast error checking.\n       *  @return  True if either the badbit or the failbit is set.\n       *\n       *  Checking the badbit in fail() is historical practice.\n       *  Note that other iostate flags may also be set.\n      */\n      bool\n      fail() const\n      { return (this->rdstate() & (badbit | failbit)) != 0; }\n\n      /**\n       *  @brief  Fast error checking.\n       *  @return  True if the badbit is set.\n       *\n       *  Note that other iostate flags may also be set.\n      */\n      bool\n      bad() const\n      { return (this->rdstate() & badbit) != 0; }\n\n      /**\n       *  @brief  Throwing exceptions on errors.\n       *  @return  The current exceptions mask.\n       *\n       *  This changes nothing in the stream.  See the one-argument version\n       *  of exceptions(iostate) for the meaning of the return value.\n      */\n      iostate\n      exceptions() const\n      { return _M_exception; }\n\n      /**\n       *  @brief  Throwing exceptions on errors.\n       *  @param  except  The new exceptions mask.\n       *\n       *  By default, error flags are set silently.  You can set an\n       *  exceptions mask for each stream; if a bit in the mask becomes set\n       *  in the error flags, then an exception of type\n       *  std::ios_base::failure is thrown.\n       *\n       *  If the error flage is already set when the exceptions mask is\n       *  added, the exception is immediately thrown.  Try running the\n       *  following under GCC 3.1 or later:\n       *  @code\n       *  #include <iostream>\n       *  #include <fstream>\n       *  #include <exception>\n       *\n       *  int main()\n       *  {\n       *      std::set_terminate (__gnu_cxx::__verbose_terminate_handler);\n       *\n       *      std::ifstream f (\"/etc/motd\");\n       *\n       *      std::cerr << \"Setting badbit\\n\";\n       *      f.setstate (std::ios_base::badbit);\n       *\n       *      std::cerr << \"Setting exception mask\\n\";\n       *      f.exceptions (std::ios_base::badbit);\n       *  }\n       *  @endcode\n      */\n      void\n      exceptions(iostate __except)\n      {\n        _M_exception = __except;\n        this->clear(_M_streambuf_state);\n      }\n\n      // Constructor/destructor:\n      /**\n       *  @brief  Constructor performs initialization.\n       *\n       *  The parameter is passed by derived streams.\n      */\n      explicit\n      basic_ios(basic_streambuf<_CharT, _Traits>* __sb)\n      : ios_base(), _M_tie(0), _M_fill(), _M_fill_init(false), _M_streambuf(0),\n      _M_ctype(0), _M_num_put(0), _M_num_get(0)\n      { this->init(__sb); }\n\n      /**\n       *  @brief  Empty.\n       *\n       *  The destructor does nothing.  More specifically, it does not\n       *  destroy the streambuf held by rdbuf().\n      */\n      virtual\n      ~basic_ios() { }\n\n      // Members:\n      /**\n       *  @brief  Fetches the current @e tied stream.\n       *  @return  A pointer to the tied stream, or NULL if the stream is\n       *           not tied.\n       *\n       *  A stream may be @e tied (or synchronized) to a second output\n       *  stream.  When this stream performs any I/O, the tied stream is\n       *  first flushed.  For example, @c std::cin is tied to @c std::cout.\n      */\n      basic_ostream<_CharT, _Traits>*\n      tie() const\n      { return _M_tie; }\n\n      /**\n       *  @brief  Ties this stream to an output stream.\n       *  @param  tiestr  The output stream.\n       *  @return  The previously tied output stream, or NULL if the stream\n       *           was not tied.\n       *\n       *  This sets up a new tie; see tie() for more.\n      */\n      basic_ostream<_CharT, _Traits>*\n      tie(basic_ostream<_CharT, _Traits>* __tiestr)\n      {\n        basic_ostream<_CharT, _Traits>* __old = _M_tie;\n        _M_tie = __tiestr;\n        return __old;\n      }\n\n      /**\n       *  @brief  Accessing the underlying buffer.\n       *  @return  The current stream buffer.\n       *\n       *  This does not change the state of the stream.\n      */\n      basic_streambuf<_CharT, _Traits>*\n      rdbuf() const\n      { return _M_streambuf; }\n\n      /**\n       *  @brief  Changing the underlying buffer.\n       *  @param  sb  The new stream buffer.\n       *  @return  The previous stream buffer.\n       *\n       *  Associates a new buffer with the current stream, and clears the\n       *  error state.\n       *\n       *  Due to historical accidents which the LWG refuses to correct, the\n       *  I/O library suffers from a design error:  this function is hidden\n       *  in derived classes by overrides of the zero-argument @c rdbuf(),\n       *  which is non-virtual for hysterical raisins.  As a result, you\n       *  must use explicit qualifications to access this function via any\n       *  derived class.  For example:\n       *\n       *  @code\n       *  std::fstream     foo;         // or some other derived type\n       *  std::streambuf*  p = .....;\n       *\n       *  foo.ios::rdbuf(p);            // ios == basic_ios<char>\n       *  @endcode\n      */\n      basic_streambuf<_CharT, _Traits>*\n      rdbuf(basic_streambuf<_CharT, _Traits>* __sb);\n\n      /**\n       *  @brief  Copies fields of __rhs into this.\n       *  @param  __rhs  The source values for the copies.\n       *  @return  Reference to this object.\n       *\n       *  All fields of __rhs are copied into this object except that rdbuf()\n       *  and rdstate() remain unchanged.  All values in the pword and iword\n       *  arrays are copied.  Before copying, each callback is invoked with\n       *  erase_event.  After copying, each (new) callback is invoked with\n       *  copyfmt_event.  The final step is to copy exceptions().\n      */\n      basic_ios&\n      copyfmt(const basic_ios& __rhs);\n\n      /**\n       *  @brief  Retreives the \"empty\" character.\n       *  @return  The current fill character.\n       *\n       *  It defaults to a space (' ') in the current locale.\n      */\n      char_type\n      fill() const\n      {\n\tif (!_M_fill_init)\n\t  {\n\t    _M_fill = this->widen(' ');\n\t    _M_fill_init = true;\n\t  }\n\treturn _M_fill;\n      }\n\n      /**\n       *  @brief  Sets a new \"empty\" character.\n       *  @param  ch  The new character.\n       *  @return  The previous fill character.\n       *\n       *  The fill character is used to fill out space when P+ characters\n       *  have been requested (e.g., via setw), Q characters are actually\n       *  used, and Q<P.  It defaults to a space (' ') in the current locale.\n      */\n      char_type\n      fill(char_type __ch)\n      {\n\tchar_type __old = this->fill();\n\t_M_fill = __ch;\n\treturn __old;\n      }\n\n      // Locales:\n      /**\n       *  @brief  Moves to a new locale.\n       *  @param  loc  The new locale.\n       *  @return  The previous locale.\n       *\n       *  Calls @c ios_base::imbue(loc), and if a stream buffer is associated\n       *  with this stream, calls that buffer's @c pubimbue(loc).\n       *\n       *  Additional l10n notes are at\n       *  http://gcc.gnu.org/onlinedocs/libstdc++/22_locale/howto.html\n      */\n      locale\n      imbue(const locale& __loc);\n\n      /**\n       *  @brief  Squeezes characters.\n       *  @param  c  The character to narrow.\n       *  @param  dfault  The character to narrow.\n       *  @return  The narrowed character.\n       *\n       *  Maps a character of @c char_type to a character of @c char,\n       *  if possible.\n       *\n       *  Returns the result of\n       *  @code\n       *    std::use_facet<ctype<char_type> >(getloc()).narrow(c,dfault)\n       *  @endcode\n       *\n       *  Additional l10n notes are at\n       *  http://gcc.gnu.org/onlinedocs/libstdc++/22_locale/howto.html\n      */\n      char\n      narrow(char_type __c, char __dfault) const;\n\n      /**\n       *  @brief  Widens characters.\n       *  @param  c  The character to widen.\n       *  @return  The widened character.\n       *\n       *  Maps a character of @c char to a character of @c char_type.\n       *\n       *  Returns the result of\n       *  @code\n       *    std::use_facet<ctype<char_type> >(getloc()).widen(c)\n       *  @endcode\n       *\n       *  Additional l10n notes are at\n       *  http://gcc.gnu.org/onlinedocs/libstdc++/22_locale/howto.html\n      */\n      char_type\n      widen(char __c) const;\n\n    protected:\n      // 27.4.5.1  basic_ios constructors\n      /**\n       *  @brief  Empty.\n       *\n       *  The default constructor does nothing and is not normally\n       *  accessible to users.\n      */\n      basic_ios()\n      : ios_base(), _M_tie(0), _M_fill(char_type()), _M_fill_init(false), \n      _M_streambuf(0), _M_ctype(0), _M_num_put(0), _M_num_get(0)\n      { }\n\n      /**\n       *  @brief  All setup is performed here.\n       *\n       *  This is called from the public constructor.  It is not virtual and\n       *  cannot be redefined.\n      */\n      void\n      init(basic_streambuf<_CharT, _Traits>* __sb);\n\n      void\n      _M_cache_locale(const locale& __loc);\n    };\n\n_GLIBCXX_END_NAMESPACE\n\n#ifndef _GLIBCXX_EXPORT_TEMPLATE\n#include <bits/basic_ios.tcc>\n#endif\n\n#endif /* _BASIC_IOS_H */\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/bits/basic_ios.tcc",
    "content": "// basic_ios member functions -*- C++ -*-\n\n// Copyright (C) 1999, 2001, 2002, 2003, 2004, 2005\n// Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n/** @file basic_ios.tcc\n *  This is an internal header file, included by other library headers.\n *  You should not attempt to use it directly.\n */\n\n#ifndef _BASIC_IOS_TCC\n#define _BASIC_IOS_TCC 1\n\n#pragma GCC system_header\n\n_GLIBCXX_BEGIN_NAMESPACE(std)\n\n  template<typename _CharT, typename _Traits>\n    void\n    basic_ios<_CharT, _Traits>::clear(iostate __state)\n    {\n      if (this->rdbuf())\n\t_M_streambuf_state = __state;\n      else\n\t  _M_streambuf_state = __state | badbit;\n      if (this->exceptions() & this->rdstate())\n\t__throw_ios_failure(__N(\"basic_ios::clear\"));\n    }\n\n  template<typename _CharT, typename _Traits>\n    basic_streambuf<_CharT, _Traits>*\n    basic_ios<_CharT, _Traits>::rdbuf(basic_streambuf<_CharT, _Traits>* __sb)\n    {\n      basic_streambuf<_CharT, _Traits>* __old = _M_streambuf;\n      _M_streambuf = __sb;\n      this->clear();\n      return __old;\n    }\n\n  template<typename _CharT, typename _Traits>\n    basic_ios<_CharT, _Traits>&\n    basic_ios<_CharT, _Traits>::copyfmt(const basic_ios& __rhs)\n    {\n      // _GLIBCXX_RESOLVE_LIB_DEFECTS\n      // 292. effects of a.copyfmt (a)\n      if (this != &__rhs)\n\t{\n\t  // Per 27.1.1, do not call imbue, yet must trash all caches\n\t  // associated with imbue()\n\n\t  // Alloc any new word array first, so if it fails we have \"rollback\".\n\t  _Words* __words = (__rhs._M_word_size <= _S_local_word_size) ?\n\t                     _M_local_word : new _Words[__rhs._M_word_size];\n\n\t  // Bump refs before doing callbacks, for safety.\n\t  _Callback_list* __cb = __rhs._M_callbacks;\n\t  if (__cb)\n\t    __cb->_M_add_reference();\n\t  _M_call_callbacks(erase_event);\n\t  if (_M_word != _M_local_word)\n\t    {\n\t      delete [] _M_word;\n\t      _M_word = 0;\n\t    }\n\t  _M_dispose_callbacks();\n\n\t  // NB: Don't want any added during above.\n\t  _M_callbacks = __cb;\n\t  for (int __i = 0; __i < __rhs._M_word_size; ++__i)\n\t    __words[__i] = __rhs._M_word[__i];\n\t  _M_word = __words;\n\t  _M_word_size = __rhs._M_word_size;\n\n\t  this->flags(__rhs.flags());\n\t  this->width(__rhs.width());\n\t  this->precision(__rhs.precision());\n\t  this->tie(__rhs.tie());\n\t  this->fill(__rhs.fill());\n\t  _M_ios_locale = __rhs.getloc();\n\t  _M_cache_locale(_M_ios_locale);\n\n\t  _M_call_callbacks(copyfmt_event);\n\n\t  // The next is required to be the last assignment.\n\t  this->exceptions(__rhs.exceptions());\n\t}\n      return *this;\n    }\n\n  template<typename _CharT, typename _Traits>\n    char\n    basic_ios<_CharT, _Traits>::narrow(char_type __c, char __dfault) const\n    { return __check_facet(_M_ctype).narrow(__c, __dfault); }\n\n  template<typename _CharT, typename _Traits>\n    _CharT\n    basic_ios<_CharT, _Traits>::widen(char __c) const\n    { return __check_facet(_M_ctype).widen(__c); }\n\n  // Locales:\n  template<typename _CharT, typename _Traits>\n    locale\n    basic_ios<_CharT, _Traits>::imbue(const locale& __loc)\n    {\n      locale __old(this->getloc());\n      ios_base::imbue(__loc);\n      _M_cache_locale(__loc);\n      if (this->rdbuf() != 0)\n\tthis->rdbuf()->pubimbue(__loc);\n      return __old;\n    }\n\n  template<typename _CharT, typename _Traits>\n    void\n    basic_ios<_CharT, _Traits>::init(basic_streambuf<_CharT, _Traits>* __sb)\n    {\n      // NB: This may be called more than once on the same object.\n      ios_base::_M_init();\n\n      // Cache locale data and specific facets used by iostreams.\n      _M_cache_locale(_M_ios_locale);\n\n      // NB: The 27.4.4.1 Postconditions Table specifies requirements\n      // after basic_ios::init() has been called. As part of this,\n      // fill() must return widen(' ') any time after init() has been\n      // called, which needs an imbued ctype facet of char_type to\n      // return without throwing an exception. Unfortunately,\n      // ctype<char_type> is not necessarily a required facet, so\n      // streams with char_type != [char, wchar_t] will not have it by\n      // default. Because of this, the correct value for _M_fill is\n      // constructed on the first call of fill(). That way,\n      // unformatted input and output with non-required basic_ios\n      // instantiations is possible even without imbuing the expected\n      // ctype<char_type> facet.\n      _M_fill = _CharT();\n      _M_fill_init = false;\n\n      _M_tie = 0;\n      _M_exception = goodbit;\n      _M_streambuf = __sb;\n      _M_streambuf_state = __sb ? goodbit : badbit;\n    }\n\n  template<typename _CharT, typename _Traits>\n    void\n    basic_ios<_CharT, _Traits>::_M_cache_locale(const locale& __loc)\n    {\n      if (__builtin_expect(has_facet<__ctype_type>(__loc), true))\n\t_M_ctype = &use_facet<__ctype_type>(__loc);\n      else\n\t_M_ctype = 0;\n\n      if (__builtin_expect(has_facet<__num_put_type>(__loc), true))\n\t_M_num_put = &use_facet<__num_put_type>(__loc);\n      else\n\t_M_num_put = 0;\n\n      if (__builtin_expect(has_facet<__num_get_type>(__loc), true))\n\t_M_num_get = &use_facet<__num_get_type>(__loc);\n      else\n\t_M_num_get = 0;\n    }\n\n  // Inhibit implicit instantiations for required instantiations,\n  // which are defined via explicit instantiations elsewhere.\n  // NB:  This syntax is a GNU extension.\n#if _GLIBCXX_EXTERN_TEMPLATE\n  extern template class basic_ios<char>;\n\n#ifdef _GLIBCXX_USE_WCHAR_T\n  extern template class basic_ios<wchar_t>;\n#endif\n#endif\n\n_GLIBCXX_END_NAMESPACE\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/bits/basic_string.h",
    "content": "// Components for manipulating sequences of characters -*- C++ -*-\n\n// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,\n// 2006, 2007\n// Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n/** @file basic_string.h\n *  This is an internal header file, included by other library headers.\n *  You should not attempt to use it directly.\n */\n\n//\n// ISO C++ 14882: 21 Strings library\n//\n\n#ifndef _BASIC_STRING_H\n#define _BASIC_STRING_H 1\n\n#pragma GCC system_header\n\n#include <ext/atomicity.h>\n#include <debug/debug.h>\n\n_GLIBCXX_BEGIN_NAMESPACE(std)\n\n  /**\n   *  @class basic_string basic_string.h <string>\n   *  @brief  Managing sequences of characters and character-like objects.\n   *\n   *  @ingroup Containers\n   *  @ingroup Sequences\n   *\n   *  Meets the requirements of a <a href=\"tables.html#65\">container</a>, a\n   *  <a href=\"tables.html#66\">reversible container</a>, and a\n   *  <a href=\"tables.html#67\">sequence</a>.  Of the\n   *  <a href=\"tables.html#68\">optional sequence requirements</a>, only\n   *  @c push_back, @c at, and array access are supported.\n   *\n   *  @doctodo\n   *\n   *\n   *  @if maint\n   *  Documentation?  What's that?\n   *  Nathan Myers <ncm@cantrip.org>.\n   *\n   *  A string looks like this:\n   *\n   *  @code\n   *                                        [_Rep]\n   *                                        _M_length\n   *   [basic_string<char_type>]            _M_capacity\n   *   _M_dataplus                          _M_refcount\n   *   _M_p ---------------->               unnamed array of char_type\n   *  @endcode\n   *\n   *  Where the _M_p points to the first character in the string, and\n   *  you cast it to a pointer-to-_Rep and subtract 1 to get a\n   *  pointer to the header.\n   *\n   *  This approach has the enormous advantage that a string object\n   *  requires only one allocation.  All the ugliness is confined\n   *  within a single pair of inline functions, which each compile to\n   *  a single \"add\" instruction: _Rep::_M_data(), and\n   *  string::_M_rep(); and the allocation function which gets a\n   *  block of raw bytes and with room enough and constructs a _Rep\n   *  object at the front.\n   *\n   *  The reason you want _M_data pointing to the character array and\n   *  not the _Rep is so that the debugger can see the string\n   *  contents. (Probably we should add a non-inline member to get\n   *  the _Rep for the debugger to use, so users can check the actual\n   *  string length.)\n   *\n   *  Note that the _Rep object is a POD so that you can have a\n   *  static \"empty string\" _Rep object already \"constructed\" before\n   *  static constructors have run.  The reference-count encoding is\n   *  chosen so that a 0 indicates one reference, so you never try to\n   *  destroy the empty-string _Rep object.\n   *\n   *  All but the last paragraph is considered pretty conventional\n   *  for a C++ string implementation.\n   *  @endif\n  */\n  // 21.3  Template class basic_string\n  template<typename _CharT, typename _Traits, typename _Alloc>\n    class basic_string\n    {\n      typedef typename _Alloc::template rebind<_CharT>::other _CharT_alloc_type;\n\n      // Types:\n    public:\n      typedef _Traits\t\t\t\t\t    traits_type;\n      typedef typename _Traits::char_type\t\t    value_type;\n      typedef _Alloc\t\t\t\t\t    allocator_type;\n      typedef typename _CharT_alloc_type::size_type\t    size_type;\n      typedef typename _CharT_alloc_type::difference_type   difference_type;\n      typedef typename _CharT_alloc_type::reference\t    reference;\n      typedef typename _CharT_alloc_type::const_reference   const_reference;\n      typedef typename _CharT_alloc_type::pointer\t    pointer;\n      typedef typename _CharT_alloc_type::const_pointer\t    const_pointer;\n      typedef __gnu_cxx::__normal_iterator<pointer, basic_string>  iterator;\n      typedef __gnu_cxx::__normal_iterator<const_pointer, basic_string>\n                                                            const_iterator;\n      typedef std::reverse_iterator<const_iterator>\tconst_reverse_iterator;\n      typedef std::reverse_iterator<iterator>\t\t    reverse_iterator;\n\n    private:\n      // _Rep: string representation\n      //   Invariants:\n      //   1. String really contains _M_length + 1 characters: due to 21.3.4\n      //      must be kept null-terminated.\n      //   2. _M_capacity >= _M_length\n      //      Allocated memory is always (_M_capacity + 1) * sizeof(_CharT).\n      //   3. _M_refcount has three states:\n      //      -1: leaked, one reference, no ref-copies allowed, non-const.\n      //       0: one reference, non-const.\n      //     n>0: n + 1 references, operations require a lock, const.\n      //   4. All fields==0 is an empty string, given the extra storage\n      //      beyond-the-end for a null terminator; thus, the shared\n      //      empty string representation needs no constructor.\n\n      struct _Rep_base\n      {\n\tsize_type\t\t_M_length;\n\tsize_type\t\t_M_capacity;\n\t_Atomic_word\t\t_M_refcount;\n      };\n\n      struct _Rep : _Rep_base\n      {\n\t// Types:\n\ttypedef typename _Alloc::template rebind<char>::other _Raw_bytes_alloc;\n\n\t// (Public) Data members:\n\n\t// The maximum number of individual char_type elements of an\n\t// individual string is determined by _S_max_size. This is the\n\t// value that will be returned by max_size().  (Whereas npos\n\t// is the maximum number of bytes the allocator can allocate.)\n\t// If one was to divvy up the theoretical largest size string,\n\t// with a terminating character and m _CharT elements, it'd\n\t// look like this:\n\t// npos = sizeof(_Rep) + (m * sizeof(_CharT)) + sizeof(_CharT)\n\t// Solving for m:\n\t// m = ((npos - sizeof(_Rep))/sizeof(CharT)) - 1\n\t// In addition, this implementation quarters this amount.\n\tstatic const size_type\t_S_max_size;\n\tstatic const _CharT\t_S_terminal;\n\n\t// The following storage is init'd to 0 by the linker, resulting\n        // (carefully) in an empty string with one reference.\n        static size_type _S_empty_rep_storage[];\n\n        static _Rep&\n        _S_empty_rep()\n        { \n\t  // NB: Mild hack to avoid strict-aliasing warnings.  Note that\n\t  // _S_empty_rep_storage is never modified and the punning should\n\t  // be reasonably safe in this case.\n\t  void* __p = reinterpret_cast<void*>(&_S_empty_rep_storage);\n\t  return *reinterpret_cast<_Rep*>(__p);\n\t}\n\n        bool\n\t_M_is_leaked() const\n        { return this->_M_refcount < 0; }\n\n        bool\n\t_M_is_shared() const\n        { return this->_M_refcount > 0; }\n\n        void\n\t_M_set_leaked()\n        { this->_M_refcount = -1; }\n\n        void\n\t_M_set_sharable()\n        { this->_M_refcount = 0; }\n\n\tvoid\n\t_M_set_length_and_sharable(size_type __n)\n\t{ \n\t  this->_M_set_sharable();  // One reference.\n\t  this->_M_length = __n;\n\t  traits_type::assign(this->_M_refdata()[__n], _S_terminal);\n\t  // grrr. (per 21.3.4)\n\t  // You cannot leave those LWG people alone for a second.\n\t}\n\n\t_CharT*\n\t_M_refdata() throw()\n\t{ return reinterpret_cast<_CharT*>(this + 1); }\n\n\t_CharT*\n\t_M_grab(const _Alloc& __alloc1, const _Alloc& __alloc2)\n\t{\n\t  return (!_M_is_leaked() && __alloc1 == __alloc2)\n\t          ? _M_refcopy() : _M_clone(__alloc1);\n\t}\n\n\t// Create & Destroy\n\tstatic _Rep*\n\t_S_create(size_type, size_type, const _Alloc&);\n\n\tvoid\n\t_M_dispose(const _Alloc& __a)\n\t{\n#ifndef _GLIBCXX_FULLY_DYNAMIC_STRING\n\t  if (__builtin_expect(this != &_S_empty_rep(), false))\n#endif\n\t    if (__gnu_cxx::__exchange_and_add_dispatch(&this->_M_refcount,\n\t\t\t\t\t\t       -1) <= 0)\n\t      _M_destroy(__a);\n\t}  // XXX MT\n\n\tvoid\n\t_M_destroy(const _Alloc&) throw();\n\n\t_CharT*\n\t_M_refcopy() throw()\n\t{\n#ifndef _GLIBCXX_FULLY_DYNAMIC_STRING\n\t  if (__builtin_expect(this != &_S_empty_rep(), false))\n#endif\n            __gnu_cxx::__atomic_add_dispatch(&this->_M_refcount, 1);\n\t  return _M_refdata();\n\t}  // XXX MT\n\n\t_CharT*\n\t_M_clone(const _Alloc&, size_type __res = 0);\n      };\n\n      // Use empty-base optimization: http://www.cantrip.org/emptyopt.html\n      struct _Alloc_hider : _Alloc\n      {\n\t_Alloc_hider(_CharT* __dat, const _Alloc& __a)\n\t: _Alloc(__a), _M_p(__dat) { }\n\n\t_CharT* _M_p; // The actual data.\n      };\n\n    public:\n      // Data Members (public):\n      // NB: This is an unsigned type, and thus represents the maximum\n      // size that the allocator can hold.\n      ///  Value returned by various member functions when they fail.\n      static const size_type\tnpos = static_cast<size_type>(-1);\n\n    private:\n      // Data Members (private):\n      mutable _Alloc_hider\t_M_dataplus;\n\n      _CharT*\n      _M_data() const\n      { return  _M_dataplus._M_p; }\n\n      _CharT*\n      _M_data(_CharT* __p)\n      { return (_M_dataplus._M_p = __p); }\n\n      _Rep*\n      _M_rep() const\n      { return &((reinterpret_cast<_Rep*> (_M_data()))[-1]); }\n\n      // For the internal use we have functions similar to `begin'/`end'\n      // but they do not call _M_leak.\n      iterator\n      _M_ibegin() const\n      { return iterator(_M_data()); }\n\n      iterator\n      _M_iend() const\n      { return iterator(_M_data() + this->size()); }\n\n      void\n      _M_leak()    // for use in begin() & non-const op[]\n      {\n\tif (!_M_rep()->_M_is_leaked())\n\t  _M_leak_hard();\n      }\n\n      size_type\n      _M_check(size_type __pos, const char* __s) const\n      {\n\tif (__pos > this->size())\n\t  __throw_out_of_range(__N(__s));\n\treturn __pos;\n      }\n\n      void\n      _M_check_length(size_type __n1, size_type __n2, const char* __s) const\n      {\n\tif (this->max_size() - (this->size() - __n1) < __n2)\n\t  __throw_length_error(__N(__s));\n      }\n\n      // NB: _M_limit doesn't check for a bad __pos value.\n      size_type\n      _M_limit(size_type __pos, size_type __off) const\n      {\n\tconst bool __testoff =  __off < this->size() - __pos;\n\treturn __testoff ? __off : this->size() - __pos;\n      }\n\n      // True if _Rep and source do not overlap.\n      bool\n      _M_disjunct(const _CharT* __s) const\n      {\n\treturn (less<const _CharT*>()(__s, _M_data())\n\t\t|| less<const _CharT*>()(_M_data() + this->size(), __s));\n      }\n\n      // When __n = 1 way faster than the general multichar\n      // traits_type::copy/move/assign.\n      static void\n      _M_copy(_CharT* __d, const _CharT* __s, size_type __n)\n      {\n\tif (__n == 1)\n\t  traits_type::assign(*__d, *__s);\n\telse\n\t  traits_type::copy(__d, __s, __n);\n      }\n\n      static void\n      _M_move(_CharT* __d, const _CharT* __s, size_type __n)\n      {\n\tif (__n == 1)\n\t  traits_type::assign(*__d, *__s);\n\telse\n\t  traits_type::move(__d, __s, __n);\t  \n      }\n\n      static void\n      _M_assign(_CharT* __d, size_type __n, _CharT __c)\n      {\n\tif (__n == 1)\n\t  traits_type::assign(*__d, __c);\n\telse\n\t  traits_type::assign(__d, __n, __c);\t  \n      }\n\n      // _S_copy_chars is a separate template to permit specialization\n      // to optimize for the common case of pointers as iterators.\n      template<class _Iterator>\n        static void\n        _S_copy_chars(_CharT* __p, _Iterator __k1, _Iterator __k2)\n        {\n\t  for (; __k1 != __k2; ++__k1, ++__p)\n\t    traits_type::assign(*__p, *__k1); // These types are off.\n\t}\n\n      static void\n      _S_copy_chars(_CharT* __p, iterator __k1, iterator __k2)\n      { _S_copy_chars(__p, __k1.base(), __k2.base()); }\n\n      static void\n      _S_copy_chars(_CharT* __p, const_iterator __k1, const_iterator __k2)\n      { _S_copy_chars(__p, __k1.base(), __k2.base()); }\n\n      static void\n      _S_copy_chars(_CharT* __p, _CharT* __k1, _CharT* __k2)\n      { _M_copy(__p, __k1, __k2 - __k1); }\n\n      static void\n      _S_copy_chars(_CharT* __p, const _CharT* __k1, const _CharT* __k2)\n      { _M_copy(__p, __k1, __k2 - __k1); }\n\n      void\n      _M_mutate(size_type __pos, size_type __len1, size_type __len2);\n\n      void\n      _M_leak_hard();\n\n      static _Rep&\n      _S_empty_rep()\n      { return _Rep::_S_empty_rep(); }\n\n    public:\n      // Construct/copy/destroy:\n      // NB: We overload ctors in some cases instead of using default\n      // arguments, per 17.4.4.4 para. 2 item 2.\n\n      /**\n       *  @brief  Default constructor creates an empty string.\n       */\n      inline\n      basic_string();\n\n      /**\n       *  @brief  Construct an empty string using allocator @a a.\n       */\n      explicit\n      basic_string(const _Alloc& __a);\n\n      // NB: per LWG issue 42, semantics different from IS:\n      /**\n       *  @brief  Construct string with copy of value of @a str.\n       *  @param  str  Source string.\n       */\n      basic_string(const basic_string& __str);\n      /**\n       *  @brief  Construct string as copy of a substring.\n       *  @param  str  Source string.\n       *  @param  pos  Index of first character to copy from.\n       *  @param  n  Number of characters to copy (default remainder).\n       */\n      basic_string(const basic_string& __str, size_type __pos,\n\t\t   size_type __n = npos);\n      /**\n       *  @brief  Construct string as copy of a substring.\n       *  @param  str  Source string.\n       *  @param  pos  Index of first character to copy from.\n       *  @param  n  Number of characters to copy.\n       *  @param  a  Allocator to use.\n       */\n      basic_string(const basic_string& __str, size_type __pos,\n\t\t   size_type __n, const _Alloc& __a);\n\n      /**\n       *  @brief  Construct string initialized by a character array.\n       *  @param  s  Source character array.\n       *  @param  n  Number of characters to copy.\n       *  @param  a  Allocator to use (default is default allocator).\n       *\n       *  NB: @a s must have at least @a n characters, '\\0' has no special\n       *  meaning.\n       */\n      basic_string(const _CharT* __s, size_type __n,\n\t\t   const _Alloc& __a = _Alloc());\n      /**\n       *  @brief  Construct string as copy of a C string.\n       *  @param  s  Source C string.\n       *  @param  a  Allocator to use (default is default allocator).\n       */\n      basic_string(const _CharT* __s, const _Alloc& __a = _Alloc());\n      /**\n       *  @brief  Construct string as multiple characters.\n       *  @param  n  Number of characters.\n       *  @param  c  Character to use.\n       *  @param  a  Allocator to use (default is default allocator).\n       */\n      basic_string(size_type __n, _CharT __c, const _Alloc& __a = _Alloc());\n\n      /**\n       *  @brief  Construct string as copy of a range.\n       *  @param  beg  Start of range.\n       *  @param  end  End of range.\n       *  @param  a  Allocator to use (default is default allocator).\n       */\n      template<class _InputIterator>\n        basic_string(_InputIterator __beg, _InputIterator __end,\n\t\t     const _Alloc& __a = _Alloc());\n\n      /**\n       *  @brief  Destroy the string instance.\n       */\n      ~basic_string()\n      { _M_rep()->_M_dispose(this->get_allocator()); }\n\n      /**\n       *  @brief  Assign the value of @a str to this string.\n       *  @param  str  Source string.\n       */\n      basic_string&\n      operator=(const basic_string& __str) \n      { return this->assign(__str); }\n\n      /**\n       *  @brief  Copy contents of @a s into this string.\n       *  @param  s  Source null-terminated string.\n       */\n      basic_string&\n      operator=(const _CharT* __s) \n      { return this->assign(__s); }\n\n      /**\n       *  @brief  Set value to string of length 1.\n       *  @param  c  Source character.\n       *\n       *  Assigning to a character makes this string length 1 and\n       *  (*this)[0] == @a c.\n       */\n      basic_string&\n      operator=(_CharT __c) \n      { \n\tthis->assign(1, __c); \n\treturn *this;\n      }\n\n      // Iterators:\n      /**\n       *  Returns a read/write iterator that points to the first character in\n       *  the %string.  Unshares the string.\n       */\n      iterator\n      begin()\n      {\n\t_M_leak();\n\treturn iterator(_M_data());\n      }\n\n      /**\n       *  Returns a read-only (constant) iterator that points to the first\n       *  character in the %string.\n       */\n      const_iterator\n      begin() const\n      { return const_iterator(_M_data()); }\n\n      /**\n       *  Returns a read/write iterator that points one past the last\n       *  character in the %string.  Unshares the string.\n       */\n      iterator\n      end()\n      {\n\t_M_leak();\n\treturn iterator(_M_data() + this->size());\n      }\n\n      /**\n       *  Returns a read-only (constant) iterator that points one past the\n       *  last character in the %string.\n       */\n      const_iterator\n      end() const\n      { return const_iterator(_M_data() + this->size()); }\n\n      /**\n       *  Returns a read/write reverse iterator that points to the last\n       *  character in the %string.  Iteration is done in reverse element\n       *  order.  Unshares the string.\n       */\n      reverse_iterator\n      rbegin()\n      { return reverse_iterator(this->end()); }\n\n      /**\n       *  Returns a read-only (constant) reverse iterator that points\n       *  to the last character in the %string.  Iteration is done in\n       *  reverse element order.\n       */\n      const_reverse_iterator\n      rbegin() const\n      { return const_reverse_iterator(this->end()); }\n\n      /**\n       *  Returns a read/write reverse iterator that points to one before the\n       *  first character in the %string.  Iteration is done in reverse\n       *  element order.  Unshares the string.\n       */\n      reverse_iterator\n      rend()\n      { return reverse_iterator(this->begin()); }\n\n      /**\n       *  Returns a read-only (constant) reverse iterator that points\n       *  to one before the first character in the %string.  Iteration\n       *  is done in reverse element order.\n       */\n      const_reverse_iterator\n      rend() const\n      { return const_reverse_iterator(this->begin()); }\n\n    public:\n      // Capacity:\n      ///  Returns the number of characters in the string, not including any\n      ///  null-termination.\n      size_type\n      size() const\n      { return _M_rep()->_M_length; }\n\n      ///  Returns the number of characters in the string, not including any\n      ///  null-termination.\n      size_type\n      length() const\n      { return _M_rep()->_M_length; }\n\n      /// Returns the size() of the largest possible %string.\n      size_type\n      max_size() const\n      { return _Rep::_S_max_size; }\n\n      /**\n       *  @brief  Resizes the %string to the specified number of characters.\n       *  @param  n  Number of characters the %string should contain.\n       *  @param  c  Character to fill any new elements.\n       *\n       *  This function will %resize the %string to the specified\n       *  number of characters.  If the number is smaller than the\n       *  %string's current size the %string is truncated, otherwise\n       *  the %string is extended and new elements are set to @a c.\n       */\n      void\n      resize(size_type __n, _CharT __c);\n\n      /**\n       *  @brief  Resizes the %string to the specified number of characters.\n       *  @param  n  Number of characters the %string should contain.\n       *\n       *  This function will resize the %string to the specified length.  If\n       *  the new size is smaller than the %string's current size the %string\n       *  is truncated, otherwise the %string is extended and new characters\n       *  are default-constructed.  For basic types such as char, this means\n       *  setting them to 0.\n       */\n      void\n      resize(size_type __n)\n      { this->resize(__n, _CharT()); }\n\n      /**\n       *  Returns the total number of characters that the %string can hold\n       *  before needing to allocate more memory.\n       */\n      size_type\n      capacity() const\n      { return _M_rep()->_M_capacity; }\n\n      /**\n       *  @brief  Attempt to preallocate enough memory for specified number of\n       *          characters.\n       *  @param  res_arg  Number of characters required.\n       *  @throw  std::length_error  If @a res_arg exceeds @c max_size().\n       *\n       *  This function attempts to reserve enough memory for the\n       *  %string to hold the specified number of characters.  If the\n       *  number requested is more than max_size(), length_error is\n       *  thrown.\n       *\n       *  The advantage of this function is that if optimal code is a\n       *  necessity and the user can determine the string length that will be\n       *  required, the user can reserve the memory in %advance, and thus\n       *  prevent a possible reallocation of memory and copying of %string\n       *  data.\n       */\n      void\n      reserve(size_type __res_arg = 0);\n\n      /**\n       *  Erases the string, making it empty.\n       */\n      void\n      clear()\n      { _M_mutate(0, this->size(), 0); }\n\n      /**\n       *  Returns true if the %string is empty.  Equivalent to *this == \"\".\n       */\n      bool\n      empty() const\n      { return this->size() == 0; }\n\n      // Element access:\n      /**\n       *  @brief  Subscript access to the data contained in the %string.\n       *  @param  pos  The index of the character to access.\n       *  @return  Read-only (constant) reference to the character.\n       *\n       *  This operator allows for easy, array-style, data access.\n       *  Note that data access with this operator is unchecked and\n       *  out_of_range lookups are not defined. (For checked lookups\n       *  see at().)\n       */\n      const_reference\n      operator[] (size_type __pos) const\n      {\n\t_GLIBCXX_DEBUG_ASSERT(__pos <= size());\n\treturn _M_data()[__pos];\n      }\n\n      /**\n       *  @brief  Subscript access to the data contained in the %string.\n       *  @param  pos  The index of the character to access.\n       *  @return  Read/write reference to the character.\n       *\n       *  This operator allows for easy, array-style, data access.\n       *  Note that data access with this operator is unchecked and\n       *  out_of_range lookups are not defined. (For checked lookups\n       *  see at().)  Unshares the string.\n       */\n      reference\n      operator[](size_type __pos)\n      {\n        // allow pos == size() as v3 extension:\n\t_GLIBCXX_DEBUG_ASSERT(__pos <= size());\n        // but be strict in pedantic mode:\n\t_GLIBCXX_DEBUG_PEDASSERT(__pos < size());\n\t_M_leak();\n\treturn _M_data()[__pos];\n      }\n\n      /**\n       *  @brief  Provides access to the data contained in the %string.\n       *  @param n The index of the character to access.\n       *  @return  Read-only (const) reference to the character.\n       *  @throw  std::out_of_range  If @a n is an invalid index.\n       *\n       *  This function provides for safer data access.  The parameter is\n       *  first checked that it is in the range of the string.  The function\n       *  throws out_of_range if the check fails.\n       */\n      const_reference\n      at(size_type __n) const\n      {\n\tif (__n >= this->size())\n\t  __throw_out_of_range(__N(\"basic_string::at\"));\n\treturn _M_data()[__n];\n      }\n\n      /**\n       *  @brief  Provides access to the data contained in the %string.\n       *  @param n The index of the character to access.\n       *  @return  Read/write reference to the character.\n       *  @throw  std::out_of_range  If @a n is an invalid index.\n       *\n       *  This function provides for safer data access.  The parameter is\n       *  first checked that it is in the range of the string.  The function\n       *  throws out_of_range if the check fails.  Success results in\n       *  unsharing the string.\n       */\n      reference\n      at(size_type __n)\n      {\n\tif (__n >= size())\n\t  __throw_out_of_range(__N(\"basic_string::at\"));\n\t_M_leak();\n\treturn _M_data()[__n];\n      }\n\n      // Modifiers:\n      /**\n       *  @brief  Append a string to this string.\n       *  @param str  The string to append.\n       *  @return  Reference to this string.\n       */\n      basic_string&\n      operator+=(const basic_string& __str)\n      { return this->append(__str); }\n\n      /**\n       *  @brief  Append a C string.\n       *  @param s  The C string to append.\n       *  @return  Reference to this string.\n       */\n      basic_string&\n      operator+=(const _CharT* __s)\n      { return this->append(__s); }\n\n      /**\n       *  @brief  Append a character.\n       *  @param c  The character to append.\n       *  @return  Reference to this string.\n       */\n      basic_string&\n      operator+=(_CharT __c)\n      { \n\tthis->push_back(__c);\n\treturn *this;\n      }\n\n      /**\n       *  @brief  Append a string to this string.\n       *  @param str  The string to append.\n       *  @return  Reference to this string.\n       */\n      basic_string&\n      append(const basic_string& __str);\n\n      /**\n       *  @brief  Append a substring.\n       *  @param str  The string to append.\n       *  @param pos  Index of the first character of str to append.\n       *  @param n  The number of characters to append.\n       *  @return  Reference to this string.\n       *  @throw  std::out_of_range if @a pos is not a valid index.\n       *\n       *  This function appends @a n characters from @a str starting at @a pos\n       *  to this string.  If @a n is is larger than the number of available\n       *  characters in @a str, the remainder of @a str is appended.\n       */\n      basic_string&\n      append(const basic_string& __str, size_type __pos, size_type __n);\n\n      /**\n       *  @brief  Append a C substring.\n       *  @param s  The C string to append.\n       *  @param n  The number of characters to append.\n       *  @return  Reference to this string.\n       */\n      basic_string&\n      append(const _CharT* __s, size_type __n);\n\n      /**\n       *  @brief  Append a C string.\n       *  @param s  The C string to append.\n       *  @return  Reference to this string.\n       */\n      basic_string&\n      append(const _CharT* __s)\n      {\n\t__glibcxx_requires_string(__s);\n\treturn this->append(__s, traits_type::length(__s));\n      }\n\n      /**\n       *  @brief  Append multiple characters.\n       *  @param n  The number of characters to append.\n       *  @param c  The character to use.\n       *  @return  Reference to this string.\n       *\n       *  Appends n copies of c to this string.\n       */\n      basic_string&\n      append(size_type __n, _CharT __c);\n\n      /**\n       *  @brief  Append a range of characters.\n       *  @param first  Iterator referencing the first character to append.\n       *  @param last  Iterator marking the end of the range.\n       *  @return  Reference to this string.\n       *\n       *  Appends characters in the range [first,last) to this string.\n       */\n      template<class _InputIterator>\n        basic_string&\n        append(_InputIterator __first, _InputIterator __last)\n        { return this->replace(_M_iend(), _M_iend(), __first, __last); }\n\n      /**\n       *  @brief  Append a single character.\n       *  @param c  Character to append.\n       */\n      void\n      push_back(_CharT __c)\n      { \n\tconst size_type __len = 1 + this->size();\n\tif (__len > this->capacity() || _M_rep()->_M_is_shared())\n\t  this->reserve(__len);\n\ttraits_type::assign(_M_data()[this->size()], __c);\n\t_M_rep()->_M_set_length_and_sharable(__len);\n      }\n\n      /**\n       *  @brief  Set value to contents of another string.\n       *  @param  str  Source string to use.\n       *  @return  Reference to this string.\n       */\n      basic_string&\n      assign(const basic_string& __str);\n\n      /**\n       *  @brief  Set value to a substring of a string.\n       *  @param str  The string to use.\n       *  @param pos  Index of the first character of str.\n       *  @param n  Number of characters to use.\n       *  @return  Reference to this string.\n       *  @throw  std::out_of_range if @a pos is not a valid index.\n       *\n       *  This function sets this string to the substring of @a str consisting\n       *  of @a n characters at @a pos.  If @a n is is larger than the number\n       *  of available characters in @a str, the remainder of @a str is used.\n       */\n      basic_string&\n      assign(const basic_string& __str, size_type __pos, size_type __n)\n      { return this->assign(__str._M_data()\n\t\t\t    + __str._M_check(__pos, \"basic_string::assign\"),\n\t\t\t    __str._M_limit(__pos, __n)); }\n\n      /**\n       *  @brief  Set value to a C substring.\n       *  @param s  The C string to use.\n       *  @param n  Number of characters to use.\n       *  @return  Reference to this string.\n       *\n       *  This function sets the value of this string to the first @a n\n       *  characters of @a s.  If @a n is is larger than the number of\n       *  available characters in @a s, the remainder of @a s is used.\n       */\n      basic_string&\n      assign(const _CharT* __s, size_type __n);\n\n      /**\n       *  @brief  Set value to contents of a C string.\n       *  @param s  The C string to use.\n       *  @return  Reference to this string.\n       *\n       *  This function sets the value of this string to the value of @a s.\n       *  The data is copied, so there is no dependence on @a s once the\n       *  function returns.\n       */\n      basic_string&\n      assign(const _CharT* __s)\n      {\n\t__glibcxx_requires_string(__s);\n\treturn this->assign(__s, traits_type::length(__s));\n      }\n\n      /**\n       *  @brief  Set value to multiple characters.\n       *  @param n  Length of the resulting string.\n       *  @param c  The character to use.\n       *  @return  Reference to this string.\n       *\n       *  This function sets the value of this string to @a n copies of\n       *  character @a c.\n       */\n      basic_string&\n      assign(size_type __n, _CharT __c)\n      { return _M_replace_aux(size_type(0), this->size(), __n, __c); }\n\n      /**\n       *  @brief  Set value to a range of characters.\n       *  @param first  Iterator referencing the first character to append.\n       *  @param last  Iterator marking the end of the range.\n       *  @return  Reference to this string.\n       *\n       *  Sets value of string to characters in the range [first,last).\n      */\n      template<class _InputIterator>\n        basic_string&\n        assign(_InputIterator __first, _InputIterator __last)\n        { return this->replace(_M_ibegin(), _M_iend(), __first, __last); }\n\n      /**\n       *  @brief  Insert multiple characters.\n       *  @param p  Iterator referencing location in string to insert at.\n       *  @param n  Number of characters to insert\n       *  @param c  The character to insert.\n       *  @throw  std::length_error  If new length exceeds @c max_size().\n       *\n       *  Inserts @a n copies of character @a c starting at the position\n       *  referenced by iterator @a p.  If adding characters causes the length\n       *  to exceed max_size(), length_error is thrown.  The value of the\n       *  string doesn't change if an error is thrown.\n      */\n      void\n      insert(iterator __p, size_type __n, _CharT __c)\n      {\tthis->replace(__p, __p, __n, __c);  }\n\n      /**\n       *  @brief  Insert a range of characters.\n       *  @param p  Iterator referencing location in string to insert at.\n       *  @param beg  Start of range.\n       *  @param end  End of range.\n       *  @throw  std::length_error  If new length exceeds @c max_size().\n       *\n       *  Inserts characters in range [beg,end).  If adding characters causes\n       *  the length to exceed max_size(), length_error is thrown.  The value\n       *  of the string doesn't change if an error is thrown.\n      */\n      template<class _InputIterator>\n        void\n        insert(iterator __p, _InputIterator __beg, _InputIterator __end)\n        { this->replace(__p, __p, __beg, __end); }\n\n      /**\n       *  @brief  Insert value of a string.\n       *  @param pos1  Iterator referencing location in string to insert at.\n       *  @param str  The string to insert.\n       *  @return  Reference to this string.\n       *  @throw  std::length_error  If new length exceeds @c max_size().\n       *\n       *  Inserts value of @a str starting at @a pos1.  If adding characters\n       *  causes the length to exceed max_size(), length_error is thrown.  The\n       *  value of the string doesn't change if an error is thrown.\n      */\n      basic_string&\n      insert(size_type __pos1, const basic_string& __str)\n      { return this->insert(__pos1, __str, size_type(0), __str.size()); }\n\n      /**\n       *  @brief  Insert a substring.\n       *  @param pos1  Iterator referencing location in string to insert at.\n       *  @param str  The string to insert.\n       *  @param pos2  Start of characters in str to insert.\n       *  @param n  Number of characters to insert.\n       *  @return  Reference to this string.\n       *  @throw  std::length_error  If new length exceeds @c max_size().\n       *  @throw  std::out_of_range  If @a pos1 > size() or\n       *  @a pos2 > @a str.size().\n       *\n       *  Starting at @a pos1, insert @a n character of @a str beginning with\n       *  @a pos2.  If adding characters causes the length to exceed\n       *  max_size(), length_error is thrown.  If @a pos1 is beyond the end of\n       *  this string or @a pos2 is beyond the end of @a str, out_of_range is\n       *  thrown.  The value of the string doesn't change if an error is\n       *  thrown.\n      */\n      basic_string&\n      insert(size_type __pos1, const basic_string& __str,\n\t     size_type __pos2, size_type __n)\n      { return this->insert(__pos1, __str._M_data()\n\t\t\t    + __str._M_check(__pos2, \"basic_string::insert\"),\n\t\t\t    __str._M_limit(__pos2, __n)); }\n\n      /**\n       *  @brief  Insert a C substring.\n       *  @param pos  Iterator referencing location in string to insert at.\n       *  @param s  The C string to insert.\n       *  @param n  The number of characters to insert.\n       *  @return  Reference to this string.\n       *  @throw  std::length_error  If new length exceeds @c max_size().\n       *  @throw  std::out_of_range  If @a pos is beyond the end of this\n       *  string.\n       *\n       *  Inserts the first @a n characters of @a s starting at @a pos.  If\n       *  adding characters causes the length to exceed max_size(),\n       *  length_error is thrown.  If @a pos is beyond end(), out_of_range is\n       *  thrown.  The value of the string doesn't change if an error is\n       *  thrown.\n      */\n      basic_string&\n      insert(size_type __pos, const _CharT* __s, size_type __n);\n\n      /**\n       *  @brief  Insert a C string.\n       *  @param pos  Iterator referencing location in string to insert at.\n       *  @param s  The C string to insert.\n       *  @return  Reference to this string.\n       *  @throw  std::length_error  If new length exceeds @c max_size().\n       *  @throw  std::out_of_range  If @a pos is beyond the end of this\n       *  string.\n       *\n       *  Inserts the first @a n characters of @a s starting at @a pos.  If\n       *  adding characters causes the length to exceed max_size(),\n       *  length_error is thrown.  If @a pos is beyond end(), out_of_range is\n       *  thrown.  The value of the string doesn't change if an error is\n       *  thrown.\n      */\n      basic_string&\n      insert(size_type __pos, const _CharT* __s)\n      {\n\t__glibcxx_requires_string(__s);\n\treturn this->insert(__pos, __s, traits_type::length(__s));\n      }\n\n      /**\n       *  @brief  Insert multiple characters.\n       *  @param pos  Index in string to insert at.\n       *  @param n  Number of characters to insert\n       *  @param c  The character to insert.\n       *  @return  Reference to this string.\n       *  @throw  std::length_error  If new length exceeds @c max_size().\n       *  @throw  std::out_of_range  If @a pos is beyond the end of this\n       *  string.\n       *\n       *  Inserts @a n copies of character @a c starting at index @a pos.  If\n       *  adding characters causes the length to exceed max_size(),\n       *  length_error is thrown.  If @a pos > length(), out_of_range is\n       *  thrown.  The value of the string doesn't change if an error is\n       *  thrown.\n      */\n      basic_string&\n      insert(size_type __pos, size_type __n, _CharT __c)\n      { return _M_replace_aux(_M_check(__pos, \"basic_string::insert\"),\n\t\t\t      size_type(0), __n, __c); }\n\n      /**\n       *  @brief  Insert one character.\n       *  @param p  Iterator referencing position in string to insert at.\n       *  @param c  The character to insert.\n       *  @return  Iterator referencing newly inserted char.\n       *  @throw  std::length_error  If new length exceeds @c max_size().\n       *\n       *  Inserts character @a c at position referenced by @a p.  If adding\n       *  character causes the length to exceed max_size(), length_error is\n       *  thrown.  If @a p is beyond end of string, out_of_range is thrown.\n       *  The value of the string doesn't change if an error is thrown.\n      */\n      iterator\n      insert(iterator __p, _CharT __c)\n      {\n\t_GLIBCXX_DEBUG_PEDASSERT(__p >= _M_ibegin() && __p <= _M_iend());\n\tconst size_type __pos = __p - _M_ibegin();\n\t_M_replace_aux(__pos, size_type(0), size_type(1), __c);\n\t_M_rep()->_M_set_leaked();\n\treturn iterator(_M_data() + __pos);\n      }\n\n      /**\n       *  @brief  Remove characters.\n       *  @param pos  Index of first character to remove (default 0).\n       *  @param n  Number of characters to remove (default remainder).\n       *  @return  Reference to this string.\n       *  @throw  std::out_of_range  If @a pos is beyond the end of this\n       *  string.\n       *\n       *  Removes @a n characters from this string starting at @a pos.  The\n       *  length of the string is reduced by @a n.  If there are < @a n\n       *  characters to remove, the remainder of the string is truncated.  If\n       *  @a p is beyond end of string, out_of_range is thrown.  The value of\n       *  the string doesn't change if an error is thrown.\n      */\n      basic_string&\n      erase(size_type __pos = 0, size_type __n = npos)\n      { \n\t_M_mutate(_M_check(__pos, \"basic_string::erase\"),\n\t\t  _M_limit(__pos, __n), size_type(0));\n\treturn *this;\n      }\n\n      /**\n       *  @brief  Remove one character.\n       *  @param position  Iterator referencing the character to remove.\n       *  @return  iterator referencing same location after removal.\n       *\n       *  Removes the character at @a position from this string. The value\n       *  of the string doesn't change if an error is thrown.\n      */\n      iterator\n      erase(iterator __position)\n      {\n\t_GLIBCXX_DEBUG_PEDASSERT(__position >= _M_ibegin()\n\t\t\t\t && __position < _M_iend());\n\tconst size_type __pos = __position - _M_ibegin();\n\t_M_mutate(__pos, size_type(1), size_type(0));\n\t_M_rep()->_M_set_leaked();\n\treturn iterator(_M_data() + __pos);\n      }\n\n      /**\n       *  @brief  Remove a range of characters.\n       *  @param first  Iterator referencing the first character to remove.\n       *  @param last  Iterator referencing the end of the range.\n       *  @return  Iterator referencing location of first after removal.\n       *\n       *  Removes the characters in the range [first,last) from this string.\n       *  The value of the string doesn't change if an error is thrown.\n      */\n      iterator\n      erase(iterator __first, iterator __last)\n      {\n\t_GLIBCXX_DEBUG_PEDASSERT(__first >= _M_ibegin() && __first <= __last\n\t\t\t\t && __last <= _M_iend());\n        const size_type __pos = __first - _M_ibegin();\n\t_M_mutate(__pos, __last - __first, size_type(0));\n\t_M_rep()->_M_set_leaked();\n\treturn iterator(_M_data() + __pos);\n      }\n\n      /**\n       *  @brief  Replace characters with value from another string.\n       *  @param pos  Index of first character to replace.\n       *  @param n  Number of characters to be replaced.\n       *  @param str  String to insert.\n       *  @return  Reference to this string.\n       *  @throw  std::out_of_range  If @a pos is beyond the end of this\n       *  string.\n       *  @throw  std::length_error  If new length exceeds @c max_size().\n       *\n       *  Removes the characters in the range [pos,pos+n) from this string.\n       *  In place, the value of @a str is inserted.  If @a pos is beyond end\n       *  of string, out_of_range is thrown.  If the length of the result\n       *  exceeds max_size(), length_error is thrown.  The value of the string\n       *  doesn't change if an error is thrown.\n      */\n      basic_string&\n      replace(size_type __pos, size_type __n, const basic_string& __str)\n      { return this->replace(__pos, __n, __str._M_data(), __str.size()); }\n\n      /**\n       *  @brief  Replace characters with value from another string.\n       *  @param pos1  Index of first character to replace.\n       *  @param n1  Number of characters to be replaced.\n       *  @param str  String to insert.\n       *  @param pos2  Index of first character of str to use.\n       *  @param n2  Number of characters from str to use.\n       *  @return  Reference to this string.\n       *  @throw  std::out_of_range  If @a pos1 > size() or @a pos2 >\n       *  str.size().\n       *  @throw  std::length_error  If new length exceeds @c max_size().\n       *\n       *  Removes the characters in the range [pos1,pos1 + n) from this\n       *  string.  In place, the value of @a str is inserted.  If @a pos is\n       *  beyond end of string, out_of_range is thrown.  If the length of the\n       *  result exceeds max_size(), length_error is thrown.  The value of the\n       *  string doesn't change if an error is thrown.\n      */\n      basic_string&\n      replace(size_type __pos1, size_type __n1, const basic_string& __str,\n\t      size_type __pos2, size_type __n2)\n      { return this->replace(__pos1, __n1, __str._M_data()\n\t\t\t     + __str._M_check(__pos2, \"basic_string::replace\"),\n\t\t\t     __str._M_limit(__pos2, __n2)); }\n\n      /**\n       *  @brief  Replace characters with value of a C substring.\n       *  @param pos  Index of first character to replace.\n       *  @param n1  Number of characters to be replaced.\n       *  @param s  C string to insert.\n       *  @param n2  Number of characters from @a s to use.\n       *  @return  Reference to this string.\n       *  @throw  std::out_of_range  If @a pos1 > size().\n       *  @throw  std::length_error  If new length exceeds @c max_size().\n       *\n       *  Removes the characters in the range [pos,pos + n1) from this string.\n       *  In place, the first @a n2 characters of @a s are inserted, or all\n       *  of @a s if @a n2 is too large.  If @a pos is beyond end of string,\n       *  out_of_range is thrown.  If the length of result exceeds max_size(),\n       *  length_error is thrown.  The value of the string doesn't change if\n       *  an error is thrown.\n      */\n      basic_string&\n      replace(size_type __pos, size_type __n1, const _CharT* __s,\n\t      size_type __n2);\n\n      /**\n       *  @brief  Replace characters with value of a C string.\n       *  @param pos  Index of first character to replace.\n       *  @param n1  Number of characters to be replaced.\n       *  @param s  C string to insert.\n       *  @return  Reference to this string.\n       *  @throw  std::out_of_range  If @a pos > size().\n       *  @throw  std::length_error  If new length exceeds @c max_size().\n       *\n       *  Removes the characters in the range [pos,pos + n1) from this string.\n       *  In place, the first @a n characters of @a s are inserted.  If @a\n       *  pos is beyond end of string, out_of_range is thrown.  If the length\n       *  of result exceeds max_size(), length_error is thrown.  The value of\n       *  the string doesn't change if an error is thrown.\n      */\n      basic_string&\n      replace(size_type __pos, size_type __n1, const _CharT* __s)\n      {\n\t__glibcxx_requires_string(__s);\n\treturn this->replace(__pos, __n1, __s, traits_type::length(__s));\n      }\n\n      /**\n       *  @brief  Replace characters with multiple characters.\n       *  @param pos  Index of first character to replace.\n       *  @param n1  Number of characters to be replaced.\n       *  @param n2  Number of characters to insert.\n       *  @param c  Character to insert.\n       *  @return  Reference to this string.\n       *  @throw  std::out_of_range  If @a pos > size().\n       *  @throw  std::length_error  If new length exceeds @c max_size().\n       *\n       *  Removes the characters in the range [pos,pos + n1) from this string.\n       *  In place, @a n2 copies of @a c are inserted.  If @a pos is beyond\n       *  end of string, out_of_range is thrown.  If the length of result\n       *  exceeds max_size(), length_error is thrown.  The value of the string\n       *  doesn't change if an error is thrown.\n      */\n      basic_string&\n      replace(size_type __pos, size_type __n1, size_type __n2, _CharT __c)\n      { return _M_replace_aux(_M_check(__pos, \"basic_string::replace\"),\n\t\t\t      _M_limit(__pos, __n1), __n2, __c); }\n\n      /**\n       *  @brief  Replace range of characters with string.\n       *  @param i1  Iterator referencing start of range to replace.\n       *  @param i2  Iterator referencing end of range to replace.\n       *  @param str  String value to insert.\n       *  @return  Reference to this string.\n       *  @throw  std::length_error  If new length exceeds @c max_size().\n       *\n       *  Removes the characters in the range [i1,i2).  In place, the value of\n       *  @a str is inserted.  If the length of result exceeds max_size(),\n       *  length_error is thrown.  The value of the string doesn't change if\n       *  an error is thrown.\n      */\n      basic_string&\n      replace(iterator __i1, iterator __i2, const basic_string& __str)\n      { return this->replace(__i1, __i2, __str._M_data(), __str.size()); }\n\n      /**\n       *  @brief  Replace range of characters with C substring.\n       *  @param i1  Iterator referencing start of range to replace.\n       *  @param i2  Iterator referencing end of range to replace.\n       *  @param s  C string value to insert.\n       *  @param n  Number of characters from s to insert.\n       *  @return  Reference to this string.\n       *  @throw  std::length_error  If new length exceeds @c max_size().\n       *\n       *  Removes the characters in the range [i1,i2).  In place, the first @a\n       *  n characters of @a s are inserted.  If the length of result exceeds\n       *  max_size(), length_error is thrown.  The value of the string doesn't\n       *  change if an error is thrown.\n      */\n      basic_string&\n      replace(iterator __i1, iterator __i2, const _CharT* __s, size_type __n)\n      {\n\t_GLIBCXX_DEBUG_PEDASSERT(_M_ibegin() <= __i1 && __i1 <= __i2\n\t\t\t\t && __i2 <= _M_iend());\n\treturn this->replace(__i1 - _M_ibegin(), __i2 - __i1, __s, __n);\n      }\n\n      /**\n       *  @brief  Replace range of characters with C string.\n       *  @param i1  Iterator referencing start of range to replace.\n       *  @param i2  Iterator referencing end of range to replace.\n       *  @param s  C string value to insert.\n       *  @return  Reference to this string.\n       *  @throw  std::length_error  If new length exceeds @c max_size().\n       *\n       *  Removes the characters in the range [i1,i2).  In place, the\n       *  characters of @a s are inserted.  If the length of result exceeds\n       *  max_size(), length_error is thrown.  The value of the string doesn't\n       *  change if an error is thrown.\n      */\n      basic_string&\n      replace(iterator __i1, iterator __i2, const _CharT* __s)\n      {\n\t__glibcxx_requires_string(__s);\n\treturn this->replace(__i1, __i2, __s, traits_type::length(__s));\n      }\n\n      /**\n       *  @brief  Replace range of characters with multiple characters\n       *  @param i1  Iterator referencing start of range to replace.\n       *  @param i2  Iterator referencing end of range to replace.\n       *  @param n  Number of characters to insert.\n       *  @param c  Character to insert.\n       *  @return  Reference to this string.\n       *  @throw  std::length_error  If new length exceeds @c max_size().\n       *\n       *  Removes the characters in the range [i1,i2).  In place, @a n copies\n       *  of @a c are inserted.  If the length of result exceeds max_size(),\n       *  length_error is thrown.  The value of the string doesn't change if\n       *  an error is thrown.\n      */\n      basic_string&\n      replace(iterator __i1, iterator __i2, size_type __n, _CharT __c)\n      {\n\t_GLIBCXX_DEBUG_PEDASSERT(_M_ibegin() <= __i1 && __i1 <= __i2\n\t\t\t\t && __i2 <= _M_iend());\n\treturn _M_replace_aux(__i1 - _M_ibegin(), __i2 - __i1, __n, __c);\n      }\n\n      /**\n       *  @brief  Replace range of characters with range.\n       *  @param i1  Iterator referencing start of range to replace.\n       *  @param i2  Iterator referencing end of range to replace.\n       *  @param k1  Iterator referencing start of range to insert.\n       *  @param k2  Iterator referencing end of range to insert.\n       *  @return  Reference to this string.\n       *  @throw  std::length_error  If new length exceeds @c max_size().\n       *\n       *  Removes the characters in the range [i1,i2).  In place, characters\n       *  in the range [k1,k2) are inserted.  If the length of result exceeds\n       *  max_size(), length_error is thrown.  The value of the string doesn't\n       *  change if an error is thrown.\n      */\n      template<class _InputIterator>\n        basic_string&\n        replace(iterator __i1, iterator __i2,\n\t\t_InputIterator __k1, _InputIterator __k2)\n        {\n\t  _GLIBCXX_DEBUG_PEDASSERT(_M_ibegin() <= __i1 && __i1 <= __i2\n\t\t\t\t   && __i2 <= _M_iend());\n\t  __glibcxx_requires_valid_range(__k1, __k2);\n\t  typedef typename std::__is_integer<_InputIterator>::__type _Integral;\n\t  return _M_replace_dispatch(__i1, __i2, __k1, __k2, _Integral());\n\t}\n\n      // Specializations for the common case of pointer and iterator:\n      // useful to avoid the overhead of temporary buffering in _M_replace.\n      basic_string&\n      replace(iterator __i1, iterator __i2, _CharT* __k1, _CharT* __k2)\n      {\n\t_GLIBCXX_DEBUG_PEDASSERT(_M_ibegin() <= __i1 && __i1 <= __i2\n\t\t\t\t && __i2 <= _M_iend());\n\t__glibcxx_requires_valid_range(__k1, __k2);\n\treturn this->replace(__i1 - _M_ibegin(), __i2 - __i1,\n\t\t\t     __k1, __k2 - __k1);\n      }\n\n      basic_string&\n      replace(iterator __i1, iterator __i2,\n\t      const _CharT* __k1, const _CharT* __k2)\n      {\n\t_GLIBCXX_DEBUG_PEDASSERT(_M_ibegin() <= __i1 && __i1 <= __i2\n\t\t\t\t && __i2 <= _M_iend());\n\t__glibcxx_requires_valid_range(__k1, __k2);\n\treturn this->replace(__i1 - _M_ibegin(), __i2 - __i1,\n\t\t\t     __k1, __k2 - __k1);\n      }\n\n      basic_string&\n      replace(iterator __i1, iterator __i2, iterator __k1, iterator __k2)\n      {\n\t_GLIBCXX_DEBUG_PEDASSERT(_M_ibegin() <= __i1 && __i1 <= __i2\n\t\t\t\t && __i2 <= _M_iend());\n\t__glibcxx_requires_valid_range(__k1, __k2);\n\treturn this->replace(__i1 - _M_ibegin(), __i2 - __i1,\n\t\t\t     __k1.base(), __k2 - __k1);\n      }\n\n      basic_string&\n      replace(iterator __i1, iterator __i2,\n\t      const_iterator __k1, const_iterator __k2)\n      {\n\t_GLIBCXX_DEBUG_PEDASSERT(_M_ibegin() <= __i1 && __i1 <= __i2\n\t\t\t\t && __i2 <= _M_iend());\n\t__glibcxx_requires_valid_range(__k1, __k2);\n\treturn this->replace(__i1 - _M_ibegin(), __i2 - __i1,\n\t\t\t     __k1.base(), __k2 - __k1);\n      }\n      \n    private:\n      template<class _Integer>\n\tbasic_string&\n\t_M_replace_dispatch(iterator __i1, iterator __i2, _Integer __n,\n\t\t\t    _Integer __val, __true_type)\n        { return _M_replace_aux(__i1 - _M_ibegin(), __i2 - __i1, __n, __val); }\n\n      template<class _InputIterator>\n\tbasic_string&\n\t_M_replace_dispatch(iterator __i1, iterator __i2, _InputIterator __k1,\n\t\t\t    _InputIterator __k2, __false_type);\n\n      basic_string&\n      _M_replace_aux(size_type __pos1, size_type __n1, size_type __n2,\n\t\t     _CharT __c);\n\n      basic_string&\n      _M_replace_safe(size_type __pos1, size_type __n1, const _CharT* __s,\n\t\t      size_type __n2);\n\n      // _S_construct_aux is used to implement the 21.3.1 para 15 which\n      // requires special behaviour if _InIter is an integral type\n      template<class _InIterator>\n        static _CharT*\n        _S_construct_aux(_InIterator __beg, _InIterator __end,\n\t\t\t const _Alloc& __a, __false_type)\n\t{\n          typedef typename iterator_traits<_InIterator>::iterator_category _Tag;\n          return _S_construct(__beg, __end, __a, _Tag());\n\t}\n\n      template<class _InIterator>\n        static _CharT*\n        _S_construct_aux(_InIterator __beg, _InIterator __end,\n\t\t\t const _Alloc& __a, __true_type)\n\t{ return _S_construct(static_cast<size_type>(__beg),\n\t\t\t      static_cast<value_type>(__end), __a); }\n\n      template<class _InIterator>\n        static _CharT*\n        _S_construct(_InIterator __beg, _InIterator __end, const _Alloc& __a)\n\t{\n\t  typedef typename std::__is_integer<_InIterator>::__type _Integral;\n\t  return _S_construct_aux(__beg, __end, __a, _Integral());\n        }\n\n      // For Input Iterators, used in istreambuf_iterators, etc.\n      template<class _InIterator>\n        static _CharT*\n         _S_construct(_InIterator __beg, _InIterator __end, const _Alloc& __a,\n\t\t      input_iterator_tag);\n\n      // For forward_iterators up to random_access_iterators, used for\n      // string::iterator, _CharT*, etc.\n      template<class _FwdIterator>\n        static _CharT*\n        _S_construct(_FwdIterator __beg, _FwdIterator __end, const _Alloc& __a,\n\t\t     forward_iterator_tag);\n\n      static _CharT*\n      _S_construct(size_type __req, _CharT __c, const _Alloc& __a);\n\n    public:\n\n      /**\n       *  @brief  Copy substring into C string.\n       *  @param s  C string to copy value into.\n       *  @param n  Number of characters to copy.\n       *  @param pos  Index of first character to copy.\n       *  @return  Number of characters actually copied\n       *  @throw  std::out_of_range  If pos > size().\n       *\n       *  Copies up to @a n characters starting at @a pos into the C string @a\n       *  s.  If @a pos is greater than size(), out_of_range is thrown.\n      */\n      size_type\n      copy(_CharT* __s, size_type __n, size_type __pos = 0) const;\n\n      /**\n       *  @brief  Swap contents with another string.\n       *  @param s  String to swap with.\n       *\n       *  Exchanges the contents of this string with that of @a s in constant\n       *  time.\n      */\n      void\n      swap(basic_string& __s);\n\n      // String operations:\n      /**\n       *  @brief  Return const pointer to null-terminated contents.\n       *\n       *  This is a handle to internal data.  Do not modify or dire things may\n       *  happen.\n      */\n      const _CharT*\n      c_str() const\n      { return _M_data(); }\n\n      /**\n       *  @brief  Return const pointer to contents.\n       *\n       *  This is a handle to internal data.  Do not modify or dire things may\n       *  happen.\n      */\n      const _CharT*\n      data() const\n      { return _M_data(); }\n\n      /**\n       *  @brief  Return copy of allocator used to construct this string.\n      */\n      allocator_type\n      get_allocator() const\n      { return _M_dataplus; }\n\n      /**\n       *  @brief  Find position of a C substring.\n       *  @param s  C string to locate.\n       *  @param pos  Index of character to search from.\n       *  @param n  Number of characters from @a s to search for.\n       *  @return  Index of start of first occurrence.\n       *\n       *  Starting from @a pos, searches forward for the first @a n characters\n       *  in @a s within this string.  If found, returns the index where it\n       *  begins.  If not found, returns npos.\n      */\n      size_type\n      find(const _CharT* __s, size_type __pos, size_type __n) const;\n\n      /**\n       *  @brief  Find position of a string.\n       *  @param str  String to locate.\n       *  @param pos  Index of character to search from (default 0).\n       *  @return  Index of start of first occurrence.\n       *\n       *  Starting from @a pos, searches forward for value of @a str within\n       *  this string.  If found, returns the index where it begins.  If not\n       *  found, returns npos.\n      */\n      size_type\n      find(const basic_string& __str, size_type __pos = 0) const\n      { return this->find(__str.data(), __pos, __str.size()); }\n\n      /**\n       *  @brief  Find position of a C string.\n       *  @param s  C string to locate.\n       *  @param pos  Index of character to search from (default 0).\n       *  @return  Index of start of first occurrence.\n       *\n       *  Starting from @a pos, searches forward for the value of @a s within\n       *  this string.  If found, returns the index where it begins.  If not\n       *  found, returns npos.\n      */\n      size_type\n      find(const _CharT* __s, size_type __pos = 0) const\n      {\n\t__glibcxx_requires_string(__s);\n\treturn this->find(__s, __pos, traits_type::length(__s));\n      }\n\n      /**\n       *  @brief  Find position of a character.\n       *  @param c  Character to locate.\n       *  @param pos  Index of character to search from (default 0).\n       *  @return  Index of first occurrence.\n       *\n       *  Starting from @a pos, searches forward for @a c within this string.\n       *  If found, returns the index where it was found.  If not found,\n       *  returns npos.\n      */\n      size_type\n      find(_CharT __c, size_type __pos = 0) const;\n\n      /**\n       *  @brief  Find last position of a string.\n       *  @param str  String to locate.\n       *  @param pos  Index of character to search back from (default end).\n       *  @return  Index of start of last occurrence.\n       *\n       *  Starting from @a pos, searches backward for value of @a str within\n       *  this string.  If found, returns the index where it begins.  If not\n       *  found, returns npos.\n      */\n      size_type\n      rfind(const basic_string& __str, size_type __pos = npos) const\n      { return this->rfind(__str.data(), __pos, __str.size()); }\n\n      /**\n       *  @brief  Find last position of a C substring.\n       *  @param s  C string to locate.\n       *  @param pos  Index of character to search back from.\n       *  @param n  Number of characters from s to search for.\n       *  @return  Index of start of last occurrence.\n       *\n       *  Starting from @a pos, searches backward for the first @a n\n       *  characters in @a s within this string.  If found, returns the index\n       *  where it begins.  If not found, returns npos.\n      */\n      size_type\n      rfind(const _CharT* __s, size_type __pos, size_type __n) const;\n\n      /**\n       *  @brief  Find last position of a C string.\n       *  @param s  C string to locate.\n       *  @param pos  Index of character to start search at (default end).\n       *  @return  Index of start of  last occurrence.\n       *\n       *  Starting from @a pos, searches backward for the value of @a s within\n       *  this string.  If found, returns the index where it begins.  If not\n       *  found, returns npos.\n      */\n      size_type\n      rfind(const _CharT* __s, size_type __pos = npos) const\n      {\n\t__glibcxx_requires_string(__s);\n\treturn this->rfind(__s, __pos, traits_type::length(__s));\n      }\n\n      /**\n       *  @brief  Find last position of a character.\n       *  @param c  Character to locate.\n       *  @param pos  Index of character to search back from (default end).\n       *  @return  Index of last occurrence.\n       *\n       *  Starting from @a pos, searches backward for @a c within this string.\n       *  If found, returns the index where it was found.  If not found,\n       *  returns npos.\n      */\n      size_type\n      rfind(_CharT __c, size_type __pos = npos) const;\n\n      /**\n       *  @brief  Find position of a character of string.\n       *  @param str  String containing characters to locate.\n       *  @param pos  Index of character to search from (default 0).\n       *  @return  Index of first occurrence.\n       *\n       *  Starting from @a pos, searches forward for one of the characters of\n       *  @a str within this string.  If found, returns the index where it was\n       *  found.  If not found, returns npos.\n      */\n      size_type\n      find_first_of(const basic_string& __str, size_type __pos = 0) const\n      { return this->find_first_of(__str.data(), __pos, __str.size()); }\n\n      /**\n       *  @brief  Find position of a character of C substring.\n       *  @param s  String containing characters to locate.\n       *  @param pos  Index of character to search from (default 0).\n       *  @param n  Number of characters from s to search for.\n       *  @return  Index of first occurrence.\n       *\n       *  Starting from @a pos, searches forward for one of the first @a n\n       *  characters of @a s within this string.  If found, returns the index\n       *  where it was found.  If not found, returns npos.\n      */\n      size_type\n      find_first_of(const _CharT* __s, size_type __pos, size_type __n) const;\n\n      /**\n       *  @brief  Find position of a character of C string.\n       *  @param s  String containing characters to locate.\n       *  @param pos  Index of character to search from (default 0).\n       *  @return  Index of first occurrence.\n       *\n       *  Starting from @a pos, searches forward for one of the characters of\n       *  @a s within this string.  If found, returns the index where it was\n       *  found.  If not found, returns npos.\n      */\n      size_type\n      find_first_of(const _CharT* __s, size_type __pos = 0) const\n      {\n\t__glibcxx_requires_string(__s);\n\treturn this->find_first_of(__s, __pos, traits_type::length(__s));\n      }\n\n      /**\n       *  @brief  Find position of a character.\n       *  @param c  Character to locate.\n       *  @param pos  Index of character to search from (default 0).\n       *  @return  Index of first occurrence.\n       *\n       *  Starting from @a pos, searches forward for the character @a c within\n       *  this string.  If found, returns the index where it was found.  If\n       *  not found, returns npos.\n       *\n       *  Note: equivalent to find(c, pos).\n      */\n      size_type\n      find_first_of(_CharT __c, size_type __pos = 0) const\n      { return this->find(__c, __pos); }\n\n      /**\n       *  @brief  Find last position of a character of string.\n       *  @param str  String containing characters to locate.\n       *  @param pos  Index of character to search back from (default end).\n       *  @return  Index of last occurrence.\n       *\n       *  Starting from @a pos, searches backward for one of the characters of\n       *  @a str within this string.  If found, returns the index where it was\n       *  found.  If not found, returns npos.\n      */\n      size_type\n      find_last_of(const basic_string& __str, size_type __pos = npos) const\n      { return this->find_last_of(__str.data(), __pos, __str.size()); }\n\n      /**\n       *  @brief  Find last position of a character of C substring.\n       *  @param s  C string containing characters to locate.\n       *  @param pos  Index of character to search back from (default end).\n       *  @param n  Number of characters from s to search for.\n       *  @return  Index of last occurrence.\n       *\n       *  Starting from @a pos, searches backward for one of the first @a n\n       *  characters of @a s within this string.  If found, returns the index\n       *  where it was found.  If not found, returns npos.\n      */\n      size_type\n      find_last_of(const _CharT* __s, size_type __pos, size_type __n) const;\n\n      /**\n       *  @brief  Find last position of a character of C string.\n       *  @param s  C string containing characters to locate.\n       *  @param pos  Index of character to search back from (default end).\n       *  @return  Index of last occurrence.\n       *\n       *  Starting from @a pos, searches backward for one of the characters of\n       *  @a s within this string.  If found, returns the index where it was\n       *  found.  If not found, returns npos.\n      */\n      size_type\n      find_last_of(const _CharT* __s, size_type __pos = npos) const\n      {\n\t__glibcxx_requires_string(__s);\n\treturn this->find_last_of(__s, __pos, traits_type::length(__s));\n      }\n\n      /**\n       *  @brief  Find last position of a character.\n       *  @param c  Character to locate.\n       *  @param pos  Index of character to search back from (default 0).\n       *  @return  Index of last occurrence.\n       *\n       *  Starting from @a pos, searches backward for @a c within this string.\n       *  If found, returns the index where it was found.  If not found,\n       *  returns npos.\n       *\n       *  Note: equivalent to rfind(c, pos).\n      */\n      size_type\n      find_last_of(_CharT __c, size_type __pos = npos) const\n      { return this->rfind(__c, __pos); }\n\n      /**\n       *  @brief  Find position of a character not in string.\n       *  @param str  String containing characters to avoid.\n       *  @param pos  Index of character to search from (default 0).\n       *  @return  Index of first occurrence.\n       *\n       *  Starting from @a pos, searches forward for a character not contained\n       *  in @a str within this string.  If found, returns the index where it\n       *  was found.  If not found, returns npos.\n      */\n      size_type\n      find_first_not_of(const basic_string& __str, size_type __pos = 0) const\n      { return this->find_first_not_of(__str.data(), __pos, __str.size()); }\n\n      /**\n       *  @brief  Find position of a character not in C substring.\n       *  @param s  C string containing characters to avoid.\n       *  @param pos  Index of character to search from (default 0).\n       *  @param n  Number of characters from s to consider.\n       *  @return  Index of first occurrence.\n       *\n       *  Starting from @a pos, searches forward for a character not contained\n       *  in the first @a n characters of @a s within this string.  If found,\n       *  returns the index where it was found.  If not found, returns npos.\n      */\n      size_type\n      find_first_not_of(const _CharT* __s, size_type __pos,\n\t\t\tsize_type __n) const;\n\n      /**\n       *  @brief  Find position of a character not in C string.\n       *  @param s  C string containing characters to avoid.\n       *  @param pos  Index of character to search from (default 0).\n       *  @return  Index of first occurrence.\n       *\n       *  Starting from @a pos, searches forward for a character not contained\n       *  in @a s within this string.  If found, returns the index where it\n       *  was found.  If not found, returns npos.\n      */\n      size_type\n      find_first_not_of(const _CharT* __s, size_type __pos = 0) const\n      {\n\t__glibcxx_requires_string(__s);\n\treturn this->find_first_not_of(__s, __pos, traits_type::length(__s));\n      }\n\n      /**\n       *  @brief  Find position of a different character.\n       *  @param c  Character to avoid.\n       *  @param pos  Index of character to search from (default 0).\n       *  @return  Index of first occurrence.\n       *\n       *  Starting from @a pos, searches forward for a character other than @a c\n       *  within this string.  If found, returns the index where it was found.\n       *  If not found, returns npos.\n      */\n      size_type\n      find_first_not_of(_CharT __c, size_type __pos = 0) const;\n\n      /**\n       *  @brief  Find last position of a character not in string.\n       *  @param str  String containing characters to avoid.\n       *  @param pos  Index of character to search from (default 0).\n       *  @return  Index of first occurrence.\n       *\n       *  Starting from @a pos, searches backward for a character not\n       *  contained in @a str within this string.  If found, returns the index\n       *  where it was found.  If not found, returns npos.\n      */\n      size_type\n      find_last_not_of(const basic_string& __str, size_type __pos = npos) const\n      { return this->find_last_not_of(__str.data(), __pos, __str.size()); }\n\n      /**\n       *  @brief  Find last position of a character not in C substring.\n       *  @param s  C string containing characters to avoid.\n       *  @param pos  Index of character to search from (default 0).\n       *  @param n  Number of characters from s to consider.\n       *  @return  Index of first occurrence.\n       *\n       *  Starting from @a pos, searches backward for a character not\n       *  contained in the first @a n characters of @a s within this string.\n       *  If found, returns the index where it was found.  If not found,\n       *  returns npos.\n      */\n      size_type\n      find_last_not_of(const _CharT* __s, size_type __pos,\n\t\t       size_type __n) const;\n      /**\n       *  @brief  Find position of a character not in C string.\n       *  @param s  C string containing characters to avoid.\n       *  @param pos  Index of character to search from (default 0).\n       *  @return  Index of first occurrence.\n       *\n       *  Starting from @a pos, searches backward for a character not\n       *  contained in @a s within this string.  If found, returns the index\n       *  where it was found.  If not found, returns npos.\n      */\n      size_type\n      find_last_not_of(const _CharT* __s, size_type __pos = npos) const\n      {\n\t__glibcxx_requires_string(__s);\n\treturn this->find_last_not_of(__s, __pos, traits_type::length(__s));\n      }\n\n      /**\n       *  @brief  Find last position of a different character.\n       *  @param c  Character to avoid.\n       *  @param pos  Index of character to search from (default 0).\n       *  @return  Index of first occurrence.\n       *\n       *  Starting from @a pos, searches backward for a character other than\n       *  @a c within this string.  If found, returns the index where it was\n       *  found.  If not found, returns npos.\n      */\n      size_type\n      find_last_not_of(_CharT __c, size_type __pos = npos) const;\n\n      /**\n       *  @brief  Get a substring.\n       *  @param pos  Index of first character (default 0).\n       *  @param n  Number of characters in substring (default remainder).\n       *  @return  The new string.\n       *  @throw  std::out_of_range  If pos > size().\n       *\n       *  Construct and return a new string using the @a n characters starting\n       *  at @a pos.  If the string is too short, use the remainder of the\n       *  characters.  If @a pos is beyond the end of the string, out_of_range\n       *  is thrown.\n      */\n      basic_string\n      substr(size_type __pos = 0, size_type __n = npos) const\n      { return basic_string(*this,\n\t\t\t    _M_check(__pos, \"basic_string::substr\"), __n); }\n\n      /**\n       *  @brief  Compare to a string.\n       *  @param str  String to compare against.\n       *  @return  Integer < 0, 0, or > 0.\n       *\n       *  Returns an integer < 0 if this string is ordered before @a str, 0 if\n       *  their values are equivalent, or > 0 if this string is ordered after\n       *  @a str.  Determines the effective length rlen of the strings to\n       *  compare as the smallest of size() and str.size().  The function\n       *  then compares the two strings by calling traits::compare(data(),\n       *  str.data(),rlen).  If the result of the comparison is nonzero returns\n       *  it, otherwise the shorter one is ordered first.\n      */\n      int\n      compare(const basic_string& __str) const\n      {\n\tconst size_type __size = this->size();\n\tconst size_type __osize = __str.size();\n\tconst size_type __len = std::min(__size, __osize);\n\n\tint __r = traits_type::compare(_M_data(), __str.data(), __len);\n\tif (!__r)\n\t  __r =  __size - __osize;\n\treturn __r;\n      }\n\n      /**\n       *  @brief  Compare substring to a string.\n       *  @param pos  Index of first character of substring.\n       *  @param n  Number of characters in substring.\n       *  @param str  String to compare against.\n       *  @return  Integer < 0, 0, or > 0.\n       *\n       *  Form the substring of this string from the @a n characters starting\n       *  at @a pos.  Returns an integer < 0 if the substring is ordered\n       *  before @a str, 0 if their values are equivalent, or > 0 if the\n       *  substring is ordered after @a str.  Determines the effective length\n       *  rlen of the strings to compare as the smallest of the length of the\n       *  substring and @a str.size().  The function then compares the two\n       *  strings by calling traits::compare(substring.data(),str.data(),rlen).\n       *  If the result of the comparison is nonzero returns it, otherwise the\n       *  shorter one is ordered first.\n      */\n      int\n      compare(size_type __pos, size_type __n, const basic_string& __str) const;\n\n      /**\n       *  @brief  Compare substring to a substring.\n       *  @param pos1  Index of first character of substring.\n       *  @param n1  Number of characters in substring.\n       *  @param str  String to compare against.\n       *  @param pos2  Index of first character of substring of str.\n       *  @param n2  Number of characters in substring of str.\n       *  @return  Integer < 0, 0, or > 0.\n       *\n       *  Form the substring of this string from the @a n1 characters starting\n       *  at @a pos1.  Form the substring of @a str from the @a n2 characters\n       *  starting at @a pos2.  Returns an integer < 0 if this substring is\n       *  ordered before the substring of @a str, 0 if their values are\n       *  equivalent, or > 0 if this substring is ordered after the substring\n       *  of @a str.  Determines the effective length rlen of the strings\n       *  to compare as the smallest of the lengths of the substrings.  The\n       *  function then compares the two strings by calling\n       *  traits::compare(substring.data(),str.substr(pos2,n2).data(),rlen).\n       *  If the result of the comparison is nonzero returns it, otherwise the\n       *  shorter one is ordered first.\n      */\n      int\n      compare(size_type __pos1, size_type __n1, const basic_string& __str,\n\t      size_type __pos2, size_type __n2) const;\n\n      /**\n       *  @brief  Compare to a C string.\n       *  @param s  C string to compare against.\n       *  @return  Integer < 0, 0, or > 0.\n       *\n       *  Returns an integer < 0 if this string is ordered before @a s, 0 if\n       *  their values are equivalent, or > 0 if this string is ordered after\n       *  @a s.  Determines the effective length rlen of the strings to\n       *  compare as the smallest of size() and the length of a string\n       *  constructed from @a s.  The function then compares the two strings\n       *  by calling traits::compare(data(),s,rlen).  If the result of the\n       *  comparison is nonzero returns it, otherwise the shorter one is\n       *  ordered first.\n      */\n      int\n      compare(const _CharT* __s) const;\n\n      // _GLIBCXX_RESOLVE_LIB_DEFECTS\n      // 5 String::compare specification questionable\n      /**\n       *  @brief  Compare substring to a C string.\n       *  @param pos  Index of first character of substring.\n       *  @param n1  Number of characters in substring.\n       *  @param s  C string to compare against.\n       *  @return  Integer < 0, 0, or > 0.\n       *\n       *  Form the substring of this string from the @a n1 characters starting\n       *  at @a pos.  Returns an integer < 0 if the substring is ordered\n       *  before @a s, 0 if their values are equivalent, or > 0 if the\n       *  substring is ordered after @a s.  Determines the effective length\n       *  rlen of the strings to compare as the smallest of the length of the \n       *  substring and the length of a string constructed from @a s.  The\n       *  function then compares the two string by calling\n       *  traits::compare(substring.data(),s,rlen).  If the result of the\n       *  comparison is nonzero returns it, otherwise the shorter one is\n       *  ordered first.\n      */\n      int\n      compare(size_type __pos, size_type __n1, const _CharT* __s) const;\n\n      /**\n       *  @brief  Compare substring against a character array.\n       *  @param pos1  Index of first character of substring.\n       *  @param n1  Number of characters in substring.\n       *  @param s  character array to compare against.\n       *  @param n2  Number of characters of s.\n       *  @return  Integer < 0, 0, or > 0.\n       *\n       *  Form the substring of this string from the @a n1 characters starting\n       *  at @a pos1.  Form a string from the first @a n2 characters of @a s.\n       *  Returns an integer < 0 if this substring is ordered before the string\n       *  from @a s, 0 if their values are equivalent, or > 0 if this substring\n       *  is ordered after the string from @a s.   Determines the effective\n       *  length rlen of the strings to compare as the smallest of the length\n       *  of the substring and @a n2.  The function then compares the two\n       *  strings by calling traits::compare(substring.data(),s,rlen).  If the\n       *  result of the comparison is nonzero returns it, otherwise the shorter\n       *  one is ordered first.\n       *\n       *  NB: s must have at least n2 characters, '\\0' has no special\n       *  meaning.\n      */\n      int\n      compare(size_type __pos, size_type __n1, const _CharT* __s,\n\t      size_type __n2) const;\n  };\n\n  template<typename _CharT, typename _Traits, typename _Alloc>\n    inline basic_string<_CharT, _Traits, _Alloc>::\n    basic_string()\n#ifndef _GLIBCXX_FULLY_DYNAMIC_STRING\n    : _M_dataplus(_S_empty_rep()._M_refdata(), _Alloc()) { }\n#else\n    : _M_dataplus(_S_construct(size_type(), _CharT(), _Alloc()), _Alloc()) { }\n#endif\n\n  // operator+\n  /**\n   *  @brief  Concatenate two strings.\n   *  @param lhs  First string.\n   *  @param rhs  Last string.\n   *  @return  New string with value of @a lhs followed by @a rhs.\n   */\n  template<typename _CharT, typename _Traits, typename _Alloc>\n    basic_string<_CharT, _Traits, _Alloc>\n    operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs,\n\t      const basic_string<_CharT, _Traits, _Alloc>& __rhs)\n    {\n      basic_string<_CharT, _Traits, _Alloc> __str(__lhs);\n      __str.append(__rhs);\n      return __str;\n    }\n\n  /**\n   *  @brief  Concatenate C string and string.\n   *  @param lhs  First string.\n   *  @param rhs  Last string.\n   *  @return  New string with value of @a lhs followed by @a rhs.\n   */\n  template<typename _CharT, typename _Traits, typename _Alloc>\n    basic_string<_CharT,_Traits,_Alloc>\n    operator+(const _CharT* __lhs,\n\t      const basic_string<_CharT,_Traits,_Alloc>& __rhs);\n\n  /**\n   *  @brief  Concatenate character and string.\n   *  @param lhs  First string.\n   *  @param rhs  Last string.\n   *  @return  New string with @a lhs followed by @a rhs.\n   */\n  template<typename _CharT, typename _Traits, typename _Alloc>\n    basic_string<_CharT,_Traits,_Alloc>\n    operator+(_CharT __lhs, const basic_string<_CharT,_Traits,_Alloc>& __rhs);\n\n  /**\n   *  @brief  Concatenate string and C string.\n   *  @param lhs  First string.\n   *  @param rhs  Last string.\n   *  @return  New string with @a lhs followed by @a rhs.\n   */\n  template<typename _CharT, typename _Traits, typename _Alloc>\n    inline basic_string<_CharT, _Traits, _Alloc>\n    operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs,\n\t     const _CharT* __rhs)\n    {\n      basic_string<_CharT, _Traits, _Alloc> __str(__lhs);\n      __str.append(__rhs);\n      return __str;\n    }\n\n  /**\n   *  @brief  Concatenate string and character.\n   *  @param lhs  First string.\n   *  @param rhs  Last string.\n   *  @return  New string with @a lhs followed by @a rhs.\n   */\n  template<typename _CharT, typename _Traits, typename _Alloc>\n    inline basic_string<_CharT, _Traits, _Alloc>\n    operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs, _CharT __rhs)\n    {\n      typedef basic_string<_CharT, _Traits, _Alloc>\t__string_type;\n      typedef typename __string_type::size_type\t\t__size_type;\n      __string_type __str(__lhs);\n      __str.append(__size_type(1), __rhs);\n      return __str;\n    }\n\n  // operator ==\n  /**\n   *  @brief  Test equivalence of two strings.\n   *  @param lhs  First string.\n   *  @param rhs  Second string.\n   *  @return  True if @a lhs.compare(@a rhs) == 0.  False otherwise.\n   */\n  template<typename _CharT, typename _Traits, typename _Alloc>\n    inline bool\n    operator==(const basic_string<_CharT, _Traits, _Alloc>& __lhs,\n\t       const basic_string<_CharT, _Traits, _Alloc>& __rhs)\n    { return __lhs.compare(__rhs) == 0; }\n\n  /**\n   *  @brief  Test equivalence of C string and string.\n   *  @param lhs  C string.\n   *  @param rhs  String.\n   *  @return  True if @a rhs.compare(@a lhs) == 0.  False otherwise.\n   */\n  template<typename _CharT, typename _Traits, typename _Alloc>\n    inline bool\n    operator==(const _CharT* __lhs,\n\t       const basic_string<_CharT, _Traits, _Alloc>& __rhs)\n    { return __rhs.compare(__lhs) == 0; }\n\n  /**\n   *  @brief  Test equivalence of string and C string.\n   *  @param lhs  String.\n   *  @param rhs  C string.\n   *  @return  True if @a lhs.compare(@a rhs) == 0.  False otherwise.\n   */\n  template<typename _CharT, typename _Traits, typename _Alloc>\n    inline bool\n    operator==(const basic_string<_CharT, _Traits, _Alloc>& __lhs,\n\t       const _CharT* __rhs)\n    { return __lhs.compare(__rhs) == 0; }\n\n  // operator !=\n  /**\n   *  @brief  Test difference of two strings.\n   *  @param lhs  First string.\n   *  @param rhs  Second string.\n   *  @return  True if @a lhs.compare(@a rhs) != 0.  False otherwise.\n   */\n  template<typename _CharT, typename _Traits, typename _Alloc>\n    inline bool\n    operator!=(const basic_string<_CharT, _Traits, _Alloc>& __lhs,\n\t       const basic_string<_CharT, _Traits, _Alloc>& __rhs)\n    { return __rhs.compare(__lhs) != 0; }\n\n  /**\n   *  @brief  Test difference of C string and string.\n   *  @param lhs  C string.\n   *  @param rhs  String.\n   *  @return  True if @a rhs.compare(@a lhs) != 0.  False otherwise.\n   */\n  template<typename _CharT, typename _Traits, typename _Alloc>\n    inline bool\n    operator!=(const _CharT* __lhs,\n\t       const basic_string<_CharT, _Traits, _Alloc>& __rhs)\n    { return __rhs.compare(__lhs) != 0; }\n\n  /**\n   *  @brief  Test difference of string and C string.\n   *  @param lhs  String.\n   *  @param rhs  C string.\n   *  @return  True if @a lhs.compare(@a rhs) != 0.  False otherwise.\n   */\n  template<typename _CharT, typename _Traits, typename _Alloc>\n    inline bool\n    operator!=(const basic_string<_CharT, _Traits, _Alloc>& __lhs,\n\t       const _CharT* __rhs)\n    { return __lhs.compare(__rhs) != 0; }\n\n  // operator <\n  /**\n   *  @brief  Test if string precedes string.\n   *  @param lhs  First string.\n   *  @param rhs  Second string.\n   *  @return  True if @a lhs precedes @a rhs.  False otherwise.\n   */\n  template<typename _CharT, typename _Traits, typename _Alloc>\n    inline bool\n    operator<(const basic_string<_CharT, _Traits, _Alloc>& __lhs,\n\t      const basic_string<_CharT, _Traits, _Alloc>& __rhs)\n    { return __lhs.compare(__rhs) < 0; }\n\n  /**\n   *  @brief  Test if string precedes C string.\n   *  @param lhs  String.\n   *  @param rhs  C string.\n   *  @return  True if @a lhs precedes @a rhs.  False otherwise.\n   */\n  template<typename _CharT, typename _Traits, typename _Alloc>\n    inline bool\n    operator<(const basic_string<_CharT, _Traits, _Alloc>& __lhs,\n\t      const _CharT* __rhs)\n    { return __lhs.compare(__rhs) < 0; }\n\n  /**\n   *  @brief  Test if C string precedes string.\n   *  @param lhs  C string.\n   *  @param rhs  String.\n   *  @return  True if @a lhs precedes @a rhs.  False otherwise.\n   */\n  template<typename _CharT, typename _Traits, typename _Alloc>\n    inline bool\n    operator<(const _CharT* __lhs,\n\t      const basic_string<_CharT, _Traits, _Alloc>& __rhs)\n    { return __rhs.compare(__lhs) > 0; }\n\n  // operator >\n  /**\n   *  @brief  Test if string follows string.\n   *  @param lhs  First string.\n   *  @param rhs  Second string.\n   *  @return  True if @a lhs follows @a rhs.  False otherwise.\n   */\n  template<typename _CharT, typename _Traits, typename _Alloc>\n    inline bool\n    operator>(const basic_string<_CharT, _Traits, _Alloc>& __lhs,\n\t      const basic_string<_CharT, _Traits, _Alloc>& __rhs)\n    { return __lhs.compare(__rhs) > 0; }\n\n  /**\n   *  @brief  Test if string follows C string.\n   *  @param lhs  String.\n   *  @param rhs  C string.\n   *  @return  True if @a lhs follows @a rhs.  False otherwise.\n   */\n  template<typename _CharT, typename _Traits, typename _Alloc>\n    inline bool\n    operator>(const basic_string<_CharT, _Traits, _Alloc>& __lhs,\n\t      const _CharT* __rhs)\n    { return __lhs.compare(__rhs) > 0; }\n\n  /**\n   *  @brief  Test if C string follows string.\n   *  @param lhs  C string.\n   *  @param rhs  String.\n   *  @return  True if @a lhs follows @a rhs.  False otherwise.\n   */\n  template<typename _CharT, typename _Traits, typename _Alloc>\n    inline bool\n    operator>(const _CharT* __lhs,\n\t      const basic_string<_CharT, _Traits, _Alloc>& __rhs)\n    { return __rhs.compare(__lhs) < 0; }\n\n  // operator <=\n  /**\n   *  @brief  Test if string doesn't follow string.\n   *  @param lhs  First string.\n   *  @param rhs  Second string.\n   *  @return  True if @a lhs doesn't follow @a rhs.  False otherwise.\n   */\n  template<typename _CharT, typename _Traits, typename _Alloc>\n    inline bool\n    operator<=(const basic_string<_CharT, _Traits, _Alloc>& __lhs,\n\t       const basic_string<_CharT, _Traits, _Alloc>& __rhs)\n    { return __lhs.compare(__rhs) <= 0; }\n\n  /**\n   *  @brief  Test if string doesn't follow C string.\n   *  @param lhs  String.\n   *  @param rhs  C string.\n   *  @return  True if @a lhs doesn't follow @a rhs.  False otherwise.\n   */\n  template<typename _CharT, typename _Traits, typename _Alloc>\n    inline bool\n    operator<=(const basic_string<_CharT, _Traits, _Alloc>& __lhs,\n\t       const _CharT* __rhs)\n    { return __lhs.compare(__rhs) <= 0; }\n\n  /**\n   *  @brief  Test if C string doesn't follow string.\n   *  @param lhs  C string.\n   *  @param rhs  String.\n   *  @return  True if @a lhs doesn't follow @a rhs.  False otherwise.\n   */\n  template<typename _CharT, typename _Traits, typename _Alloc>\n    inline bool\n    operator<=(const _CharT* __lhs,\n\t       const basic_string<_CharT, _Traits, _Alloc>& __rhs)\n    { return __rhs.compare(__lhs) >= 0; }\n\n  // operator >=\n  /**\n   *  @brief  Test if string doesn't precede string.\n   *  @param lhs  First string.\n   *  @param rhs  Second string.\n   *  @return  True if @a lhs doesn't precede @a rhs.  False otherwise.\n   */\n  template<typename _CharT, typename _Traits, typename _Alloc>\n    inline bool\n    operator>=(const basic_string<_CharT, _Traits, _Alloc>& __lhs,\n\t       const basic_string<_CharT, _Traits, _Alloc>& __rhs)\n    { return __lhs.compare(__rhs) >= 0; }\n\n  /**\n   *  @brief  Test if string doesn't precede C string.\n   *  @param lhs  String.\n   *  @param rhs  C string.\n   *  @return  True if @a lhs doesn't precede @a rhs.  False otherwise.\n   */\n  template<typename _CharT, typename _Traits, typename _Alloc>\n    inline bool\n    operator>=(const basic_string<_CharT, _Traits, _Alloc>& __lhs,\n\t       const _CharT* __rhs)\n    { return __lhs.compare(__rhs) >= 0; }\n\n  /**\n   *  @brief  Test if C string doesn't precede string.\n   *  @param lhs  C string.\n   *  @param rhs  String.\n   *  @return  True if @a lhs doesn't precede @a rhs.  False otherwise.\n   */\n  template<typename _CharT, typename _Traits, typename _Alloc>\n    inline bool\n    operator>=(const _CharT* __lhs,\n\t     const basic_string<_CharT, _Traits, _Alloc>& __rhs)\n    { return __rhs.compare(__lhs) <= 0; }\n\n  /**\n   *  @brief  Swap contents of two strings.\n   *  @param lhs  First string.\n   *  @param rhs  Second string.\n   *\n   *  Exchanges the contents of @a lhs and @a rhs in constant time.\n   */\n  template<typename _CharT, typename _Traits, typename _Alloc>\n    inline void\n    swap(basic_string<_CharT, _Traits, _Alloc>& __lhs,\n\t basic_string<_CharT, _Traits, _Alloc>& __rhs)\n    { __lhs.swap(__rhs); }\n\n  /**\n   *  @brief  Read stream into a string.\n   *  @param is  Input stream.\n   *  @param str  Buffer to store into.\n   *  @return  Reference to the input stream.\n   *\n   *  Stores characters from @a is into @a str until whitespace is found, the\n   *  end of the stream is encountered, or str.max_size() is reached.  If\n   *  is.width() is non-zero, that is the limit on the number of characters\n   *  stored into @a str.  Any previous contents of @a str are erased.\n   */\n  template<typename _CharT, typename _Traits, typename _Alloc>\n    basic_istream<_CharT, _Traits>&\n    operator>>(basic_istream<_CharT, _Traits>& __is,\n\t       basic_string<_CharT, _Traits, _Alloc>& __str);\n\n  template<>\n    basic_istream<char>&\n    operator>>(basic_istream<char>& __is, basic_string<char>& __str);\n\n  /**\n   *  @brief  Write string to a stream.\n   *  @param os  Output stream.\n   *  @param str  String to write out.\n   *  @return  Reference to the output stream.\n   *\n   *  Output characters of @a str into os following the same rules as for\n   *  writing a C string.\n   */\n  template<typename _CharT, typename _Traits, typename _Alloc>\n    inline basic_ostream<_CharT, _Traits>&\n    operator<<(basic_ostream<_CharT, _Traits>& __os,\n\t       const basic_string<_CharT, _Traits, _Alloc>& __str)\n    {\n      // _GLIBCXX_RESOLVE_LIB_DEFECTS\n      // 586. string inserter not a formatted function\n      return __ostream_insert(__os, __str.data(), __str.size());\n    }\n\n  /**\n   *  @brief  Read a line from stream into a string.\n   *  @param is  Input stream.\n   *  @param str  Buffer to store into.\n   *  @param delim  Character marking end of line.\n   *  @return  Reference to the input stream.\n   *\n   *  Stores characters from @a is into @a str until @a delim is found, the\n   *  end of the stream is encountered, or str.max_size() is reached.  If\n   *  is.width() is non-zero, that is the limit on the number of characters\n   *  stored into @a str.  Any previous contents of @a str are erased.  If @a\n   *  delim was encountered, it is extracted but not stored into @a str.\n   */\n  template<typename _CharT, typename _Traits, typename _Alloc>\n    basic_istream<_CharT, _Traits>&\n    getline(basic_istream<_CharT, _Traits>& __is,\n\t    basic_string<_CharT, _Traits, _Alloc>& __str, _CharT __delim);\n\n  /**\n   *  @brief  Read a line from stream into a string.\n   *  @param is  Input stream.\n   *  @param str  Buffer to store into.\n   *  @return  Reference to the input stream.\n   *\n   *  Stores characters from is into @a str until '\\n' is found, the end of\n   *  the stream is encountered, or str.max_size() is reached.  If is.width()\n   *  is non-zero, that is the limit on the number of characters stored into\n   *  @a str.  Any previous contents of @a str are erased.  If end of line was\n   *  encountered, it is extracted but not stored into @a str.\n   */\n  template<typename _CharT, typename _Traits, typename _Alloc>\n    inline basic_istream<_CharT, _Traits>&\n    getline(basic_istream<_CharT, _Traits>& __is,\n\t    basic_string<_CharT, _Traits, _Alloc>& __str)\n    { return getline(__is, __str, __is.widen('\\n')); }\n\n  template<>\n    basic_istream<char>&\n    getline(basic_istream<char>& __in, basic_string<char>& __str,\n\t    char __delim);\n\n#ifdef _GLIBCXX_USE_WCHAR_T\n  template<>\n    basic_istream<wchar_t>&\n    getline(basic_istream<wchar_t>& __in, basic_string<wchar_t>& __str,\n\t    wchar_t __delim);\n#endif  \n\n_GLIBCXX_END_NAMESPACE\n\n#endif /* _BASIC_STRING_H */\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/bits/basic_string.tcc",
    "content": "// Components for manipulating sequences of characters -*- C++ -*-\n\n// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,\n// 2006, 2007\n// Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n/** @file basic_string.tcc\n *  This is an internal header file, included by other library headers.\n *  You should not attempt to use it directly.\n */\n\n//\n// ISO C++ 14882: 21  Strings library\n//\n\n// Written by Jason Merrill based upon the specification by Takanori Adachi\n// in ANSI X3J16/94-0013R2.  Rewritten by Nathan Myers to ISO-14882.\n\n#ifndef _BASIC_STRING_TCC\n#define _BASIC_STRING_TCC 1\n\n#pragma GCC system_header\n\n_GLIBCXX_BEGIN_NAMESPACE(std)\n\n  template<typename _Type>\n    inline bool\n    __is_null_pointer(_Type* __ptr)\n    { return __ptr == 0; }\n\n  template<typename _Type>\n    inline bool\n    __is_null_pointer(_Type)\n    { return false; }\n\n  template<typename _CharT, typename _Traits, typename _Alloc>\n    const typename basic_string<_CharT, _Traits, _Alloc>::size_type\n    basic_string<_CharT, _Traits, _Alloc>::\n    _Rep::_S_max_size = (((npos - sizeof(_Rep_base))/sizeof(_CharT)) - 1) / 4;\n\n  template<typename _CharT, typename _Traits, typename _Alloc>\n    const _CharT\n    basic_string<_CharT, _Traits, _Alloc>::\n    _Rep::_S_terminal = _CharT();\n\n  template<typename _CharT, typename _Traits, typename _Alloc>\n    const typename basic_string<_CharT, _Traits, _Alloc>::size_type\n    basic_string<_CharT, _Traits, _Alloc>::npos;\n\n  // Linker sets _S_empty_rep_storage to all 0s (one reference, empty string)\n  // at static init time (before static ctors are run).\n  template<typename _CharT, typename _Traits, typename _Alloc>\n    typename basic_string<_CharT, _Traits, _Alloc>::size_type\n    basic_string<_CharT, _Traits, _Alloc>::_Rep::_S_empty_rep_storage[\n    (sizeof(_Rep_base) + sizeof(_CharT) + sizeof(size_type) - 1) /\n      sizeof(size_type)];\n\n  // NB: This is the special case for Input Iterators, used in\n  // istreambuf_iterators, etc.\n  // Input Iterators have a cost structure very different from\n  // pointers, calling for a different coding style.\n  template<typename _CharT, typename _Traits, typename _Alloc>\n    template<typename _InIterator>\n      _CharT*\n      basic_string<_CharT, _Traits, _Alloc>::\n      _S_construct(_InIterator __beg, _InIterator __end, const _Alloc& __a,\n\t\t   input_iterator_tag)\n      {\n#ifndef _GLIBCXX_FULLY_DYNAMIC_STRING\n\tif (__beg == __end && __a == _Alloc())\n\t  return _S_empty_rep()._M_refdata();\n#endif\n\t// Avoid reallocation for common case.\n\t_CharT __buf[128];\n\tsize_type __len = 0;\n\twhile (__beg != __end && __len < sizeof(__buf) / sizeof(_CharT))\n\t  {\n\t    __buf[__len++] = *__beg;\n\t    ++__beg;\n\t  }\n\t_Rep* __r = _Rep::_S_create(__len, size_type(0), __a);\n\t_M_copy(__r->_M_refdata(), __buf, __len);\n\ttry\n\t  {\n\t    while (__beg != __end)\n\t      {\n\t\tif (__len == __r->_M_capacity)\n\t\t  {\n\t\t    // Allocate more space.\n\t\t    _Rep* __another = _Rep::_S_create(__len + 1, __len, __a);\n\t\t    _M_copy(__another->_M_refdata(), __r->_M_refdata(), __len);\n\t\t    __r->_M_destroy(__a);\n\t\t    __r = __another;\n\t\t  }\n\t\t__r->_M_refdata()[__len++] = *__beg;\n\t\t++__beg;\n\t      }\n\t  }\n\tcatch(...)\n\t  {\n\t    __r->_M_destroy(__a);\n\t    __throw_exception_again;\n\t  }\n\t__r->_M_set_length_and_sharable(__len);\n\treturn __r->_M_refdata();\n      }\n\n  template<typename _CharT, typename _Traits, typename _Alloc>\n    template <typename _InIterator>\n      _CharT*\n      basic_string<_CharT, _Traits, _Alloc>::\n      _S_construct(_InIterator __beg, _InIterator __end, const _Alloc& __a,\n\t\t   forward_iterator_tag)\n      {\n#ifndef _GLIBCXX_FULLY_DYNAMIC_STRING\n\tif (__beg == __end && __a == _Alloc())\n\t  return _S_empty_rep()._M_refdata();\n#endif\n\t// NB: Not required, but considered best practice.\n\tif (__builtin_expect(__is_null_pointer(__beg) && __beg != __end, 0))\n\t  __throw_logic_error(__N(\"basic_string::_S_construct NULL not valid\"));\n\n\tconst size_type __dnew = static_cast<size_type>(std::distance(__beg,\n\t\t\t\t\t\t\t\t      __end));\n\t// Check for out_of_range and length_error exceptions.\n\t_Rep* __r = _Rep::_S_create(__dnew, size_type(0), __a);\n\ttry\n\t  { _S_copy_chars(__r->_M_refdata(), __beg, __end); }\n\tcatch(...)\n\t  {\n\t    __r->_M_destroy(__a);\n\t    __throw_exception_again;\n\t  }\n\t__r->_M_set_length_and_sharable(__dnew);\n\treturn __r->_M_refdata();\n      }\n\n  template<typename _CharT, typename _Traits, typename _Alloc>\n    _CharT*\n    basic_string<_CharT, _Traits, _Alloc>::\n    _S_construct(size_type __n, _CharT __c, const _Alloc& __a)\n    {\n#ifndef _GLIBCXX_FULLY_DYNAMIC_STRING\n      if (__n == 0 && __a == _Alloc())\n\treturn _S_empty_rep()._M_refdata();\n#endif\n      // Check for out_of_range and length_error exceptions.\n      _Rep* __r = _Rep::_S_create(__n, size_type(0), __a);\n      if (__n)\n\t_M_assign(__r->_M_refdata(), __n, __c);\n\n      __r->_M_set_length_and_sharable(__n);\n      return __r->_M_refdata();\n    }\n\n  template<typename _CharT, typename _Traits, typename _Alloc>\n    basic_string<_CharT, _Traits, _Alloc>::\n    basic_string(const basic_string& __str)\n    : _M_dataplus(__str._M_rep()->_M_grab(_Alloc(__str.get_allocator()),\n\t\t\t\t\t  __str.get_allocator()),\n\t\t  __str.get_allocator())\n    { }\n\n  template<typename _CharT, typename _Traits, typename _Alloc>\n    basic_string<_CharT, _Traits, _Alloc>::\n    basic_string(const _Alloc& __a)\n    : _M_dataplus(_S_construct(size_type(), _CharT(), __a), __a)\n    { }\n\n  template<typename _CharT, typename _Traits, typename _Alloc>\n    basic_string<_CharT, _Traits, _Alloc>::\n    basic_string(const basic_string& __str, size_type __pos, size_type __n)\n    : _M_dataplus(_S_construct(__str._M_data()\n\t\t\t       + __str._M_check(__pos,\n\t\t\t\t\t\t\"basic_string::basic_string\"),\n\t\t\t       __str._M_data() + __str._M_limit(__pos, __n)\n\t\t\t       + __pos, _Alloc()), _Alloc())\n    { }\n\n  template<typename _CharT, typename _Traits, typename _Alloc>\n    basic_string<_CharT, _Traits, _Alloc>::\n    basic_string(const basic_string& __str, size_type __pos,\n\t\t size_type __n, const _Alloc& __a)\n    : _M_dataplus(_S_construct(__str._M_data()\n\t\t\t       + __str._M_check(__pos,\n\t\t\t\t\t\t\"basic_string::basic_string\"),\n\t\t\t       __str._M_data() + __str._M_limit(__pos, __n)\n\t\t\t       + __pos, __a), __a)\n    { }\n\n  // TBD: DPG annotate\n  template<typename _CharT, typename _Traits, typename _Alloc>\n    basic_string<_CharT, _Traits, _Alloc>::\n    basic_string(const _CharT* __s, size_type __n, const _Alloc& __a)\n    : _M_dataplus(_S_construct(__s, __s + __n, __a), __a)\n    { }\n\n  // TBD: DPG annotate\n  template<typename _CharT, typename _Traits, typename _Alloc>\n    basic_string<_CharT, _Traits, _Alloc>::\n    basic_string(const _CharT* __s, const _Alloc& __a)\n    : _M_dataplus(_S_construct(__s, __s ? __s + traits_type::length(__s) :\n\t\t\t       __s + npos, __a), __a)\n    { }\n\n  template<typename _CharT, typename _Traits, typename _Alloc>\n    basic_string<_CharT, _Traits, _Alloc>::\n    basic_string(size_type __n, _CharT __c, const _Alloc& __a)\n    : _M_dataplus(_S_construct(__n, __c, __a), __a)\n    { }\n\n  // TBD: DPG annotate\n  template<typename _CharT, typename _Traits, typename _Alloc>\n    template<typename _InputIterator>\n    basic_string<_CharT, _Traits, _Alloc>::\n    basic_string(_InputIterator __beg, _InputIterator __end, const _Alloc& __a)\n    : _M_dataplus(_S_construct(__beg, __end, __a), __a)\n    { }\n\n  template<typename _CharT, typename _Traits, typename _Alloc>\n    basic_string<_CharT, _Traits, _Alloc>&\n    basic_string<_CharT, _Traits, _Alloc>::\n    assign(const basic_string& __str)\n    {\n      if (_M_rep() != __str._M_rep())\n\t{\n\t  // XXX MT\n\t  const allocator_type __a = this->get_allocator();\n\t  _CharT* __tmp = __str._M_rep()->_M_grab(__a, __str.get_allocator());\n\t  _M_rep()->_M_dispose(__a);\n\t  _M_data(__tmp);\n\t}\n      return *this;\n    }\n\n  template<typename _CharT, typename _Traits, typename _Alloc>\n    basic_string<_CharT, _Traits, _Alloc>&\n    basic_string<_CharT, _Traits, _Alloc>::\n    assign(const _CharT* __s, size_type __n)\n    {\n      __glibcxx_requires_string_len(__s, __n);\n      _M_check_length(this->size(), __n, \"basic_string::assign\");\n      if (_M_disjunct(__s) || _M_rep()->_M_is_shared())\n\treturn _M_replace_safe(size_type(0), this->size(), __s, __n);\n      else\n\t{\n\t  // Work in-place.\n\t  const size_type __pos = __s - _M_data();\n\t  if (__pos >= __n)\n\t    _M_copy(_M_data(), __s, __n);\n\t  else if (__pos)\n\t    _M_move(_M_data(), __s, __n);\n\t  _M_rep()->_M_set_length_and_sharable(__n);\n\t  return *this;\n\t}\n     }\n\n  template<typename _CharT, typename _Traits, typename _Alloc>\n    basic_string<_CharT, _Traits, _Alloc>&\n    basic_string<_CharT, _Traits, _Alloc>::\n    append(size_type __n, _CharT __c)\n    {\n      if (__n)\n\t{\n\t  _M_check_length(size_type(0), __n, \"basic_string::append\");\t  \n\t  const size_type __len = __n + this->size();\n\t  if (__len > this->capacity() || _M_rep()->_M_is_shared())\n\t    this->reserve(__len);\n\t  _M_assign(_M_data() + this->size(), __n, __c);\n\t  _M_rep()->_M_set_length_and_sharable(__len);\n\t}\n      return *this;\n    }\n\n  template<typename _CharT, typename _Traits, typename _Alloc>\n    basic_string<_CharT, _Traits, _Alloc>&\n    basic_string<_CharT, _Traits, _Alloc>::\n    append(const _CharT* __s, size_type __n)\n    {\n      __glibcxx_requires_string_len(__s, __n);\n      if (__n)\n\t{\n\t  _M_check_length(size_type(0), __n, \"basic_string::append\");\n\t  const size_type __len = __n + this->size();\n\t  if (__len > this->capacity() || _M_rep()->_M_is_shared())\n\t    {\n\t      if (_M_disjunct(__s))\n\t\tthis->reserve(__len);\n\t      else\n\t\t{\n\t\t  const size_type __off = __s - _M_data();\n\t\t  this->reserve(__len);\n\t\t  __s = _M_data() + __off;\n\t\t}\n\t    }\n\t  _M_copy(_M_data() + this->size(), __s, __n);\n\t  _M_rep()->_M_set_length_and_sharable(__len);\n\t}\n      return *this;\n    }\n\n  template<typename _CharT, typename _Traits, typename _Alloc>\n    basic_string<_CharT, _Traits, _Alloc>&\n    basic_string<_CharT, _Traits, _Alloc>::\n    append(const basic_string& __str)\n    {\n      const size_type __size = __str.size();\n      if (__size)\n\t{\n\t  const size_type __len = __size + this->size();\n\t  if (__len > this->capacity() || _M_rep()->_M_is_shared())\n\t    this->reserve(__len);\n\t  _M_copy(_M_data() + this->size(), __str._M_data(), __size);\n\t  _M_rep()->_M_set_length_and_sharable(__len);\n\t}\n      return *this;\n    }    \n\n  template<typename _CharT, typename _Traits, typename _Alloc>\n    basic_string<_CharT, _Traits, _Alloc>&\n    basic_string<_CharT, _Traits, _Alloc>::\n    append(const basic_string& __str, size_type __pos, size_type __n)\n    {\n      __str._M_check(__pos, \"basic_string::append\");\n      __n = __str._M_limit(__pos, __n);\n      if (__n)\n\t{\n\t  const size_type __len = __n + this->size();\n\t  if (__len > this->capacity() || _M_rep()->_M_is_shared())\n\t    this->reserve(__len);\n\t  _M_copy(_M_data() + this->size(), __str._M_data() + __pos, __n);\n\t  _M_rep()->_M_set_length_and_sharable(__len);\t  \n\t}\n      return *this;\n    }\n\n   template<typename _CharT, typename _Traits, typename _Alloc>\n     basic_string<_CharT, _Traits, _Alloc>&\n     basic_string<_CharT, _Traits, _Alloc>::\n     insert(size_type __pos, const _CharT* __s, size_type __n)\n     {\n       __glibcxx_requires_string_len(__s, __n);\n       _M_check(__pos, \"basic_string::insert\");\n       _M_check_length(size_type(0), __n, \"basic_string::insert\");\n       if (_M_disjunct(__s) || _M_rep()->_M_is_shared())\n         return _M_replace_safe(__pos, size_type(0), __s, __n);\n       else\n         {\n           // Work in-place.\n           const size_type __off = __s - _M_data();\n           _M_mutate(__pos, 0, __n);\n           __s = _M_data() + __off;\n           _CharT* __p = _M_data() + __pos;\n           if (__s  + __n <= __p)\n             _M_copy(__p, __s, __n);\n           else if (__s >= __p)\n             _M_copy(__p, __s + __n, __n);\n           else\n             {\n\t       const size_type __nleft = __p - __s;\n               _M_copy(__p, __s, __nleft);\n               _M_copy(__p + __nleft, __p + __n, __n - __nleft);\n             }\n           return *this;\n         }\n     }\n\n   template<typename _CharT, typename _Traits, typename _Alloc>\n     basic_string<_CharT, _Traits, _Alloc>&\n     basic_string<_CharT, _Traits, _Alloc>::\n     replace(size_type __pos, size_type __n1, const _CharT* __s,\n\t     size_type __n2)\n     {\n       __glibcxx_requires_string_len(__s, __n2);\n       _M_check(__pos, \"basic_string::replace\");\n       __n1 = _M_limit(__pos, __n1);\n       _M_check_length(__n1, __n2, \"basic_string::replace\");\n       bool __left;\n       if (_M_disjunct(__s) || _M_rep()->_M_is_shared())\n         return _M_replace_safe(__pos, __n1, __s, __n2);\n       else if ((__left = __s + __n2 <= _M_data() + __pos)\n\t\t|| _M_data() + __pos + __n1 <= __s)\n\t {\n\t   // Work in-place: non-overlapping case.\n\t   size_type __off = __s - _M_data();\n\t   __left ? __off : (__off += __n2 - __n1);\n\t   _M_mutate(__pos, __n1, __n2);\n\t   _M_copy(_M_data() + __pos, _M_data() + __off, __n2);\n\t   return *this;\n\t }\n       else\n\t {\n\t   // Todo: overlapping case.\n\t   const basic_string __tmp(__s, __n2);\n\t   return _M_replace_safe(__pos, __n1, __tmp._M_data(), __n2);\n\t }\n     }\n\n  template<typename _CharT, typename _Traits, typename _Alloc>\n    void\n    basic_string<_CharT, _Traits, _Alloc>::_Rep::\n    _M_destroy(const _Alloc& __a) throw ()\n    {\n      const size_type __size = sizeof(_Rep_base) +\n\t                       (this->_M_capacity + 1) * sizeof(_CharT);\n      _Raw_bytes_alloc(__a).deallocate(reinterpret_cast<char*>(this), __size);\n    }\n\n  template<typename _CharT, typename _Traits, typename _Alloc>\n    void\n    basic_string<_CharT, _Traits, _Alloc>::\n    _M_leak_hard()\n    {\n#ifndef _GLIBCXX_FULLY_DYNAMIC_STRING\n      if (_M_rep() == &_S_empty_rep())\n\treturn;\n#endif\n      if (_M_rep()->_M_is_shared())\n\t_M_mutate(0, 0, 0);\n      _M_rep()->_M_set_leaked();\n    }\n\n  template<typename _CharT, typename _Traits, typename _Alloc>\n    void\n    basic_string<_CharT, _Traits, _Alloc>::\n    _M_mutate(size_type __pos, size_type __len1, size_type __len2)\n    {\n      const size_type __old_size = this->size();\n      const size_type __new_size = __old_size + __len2 - __len1;\n      const size_type __how_much = __old_size - __pos - __len1;\n\n      if (__new_size > this->capacity() || _M_rep()->_M_is_shared())\n\t{\n\t  // Must reallocate.\n\t  const allocator_type __a = get_allocator();\n\t  _Rep* __r = _Rep::_S_create(__new_size, this->capacity(), __a);\n\n\t  if (__pos)\n\t    _M_copy(__r->_M_refdata(), _M_data(), __pos);\n\t  if (__how_much)\n\t    _M_copy(__r->_M_refdata() + __pos + __len2,\n\t\t    _M_data() + __pos + __len1, __how_much);\n\n\t  _M_rep()->_M_dispose(__a);\n\t  _M_data(__r->_M_refdata());\n\t}\n      else if (__how_much && __len1 != __len2)\n\t{\n\t  // Work in-place.\n\t  _M_move(_M_data() + __pos + __len2,\n\t\t  _M_data() + __pos + __len1, __how_much);\n\t}\n      _M_rep()->_M_set_length_and_sharable(__new_size);\n    }\n\n  template<typename _CharT, typename _Traits, typename _Alloc>\n    void\n    basic_string<_CharT, _Traits, _Alloc>::\n    reserve(size_type __res)\n    {\n      if (__res != this->capacity() || _M_rep()->_M_is_shared())\n        {\n\t  // Make sure we don't shrink below the current size\n\t  if (__res < this->size())\n\t    __res = this->size();\n\t  const allocator_type __a = get_allocator();\n\t  _CharT* __tmp = _M_rep()->_M_clone(__a, __res - this->size());\n\t  _M_rep()->_M_dispose(__a);\n\t  _M_data(__tmp);\n        }\n    }\n\n  template<typename _CharT, typename _Traits, typename _Alloc>\n    void\n    basic_string<_CharT, _Traits, _Alloc>::\n    swap(basic_string& __s)\n    {\n      if (_M_rep()->_M_is_leaked())\n\t_M_rep()->_M_set_sharable();\n      if (__s._M_rep()->_M_is_leaked())\n\t__s._M_rep()->_M_set_sharable();\n      if (this->get_allocator() == __s.get_allocator())\n\t{\n\t  _CharT* __tmp = _M_data();\n\t  _M_data(__s._M_data());\n\t  __s._M_data(__tmp);\n\t}\n      // The code below can usually be optimized away.\n      else\n\t{\n\t  const basic_string __tmp1(_M_ibegin(), _M_iend(),\n\t\t\t\t    __s.get_allocator());\n\t  const basic_string __tmp2(__s._M_ibegin(), __s._M_iend(),\n\t\t\t\t    this->get_allocator());\n\t  *this = __tmp2;\n\t  __s = __tmp1;\n\t}\n    }\n\n  template<typename _CharT, typename _Traits, typename _Alloc>\n    typename basic_string<_CharT, _Traits, _Alloc>::_Rep*\n    basic_string<_CharT, _Traits, _Alloc>::_Rep::\n    _S_create(size_type __capacity, size_type __old_capacity,\n\t      const _Alloc& __alloc)\n    {\n      // _GLIBCXX_RESOLVE_LIB_DEFECTS\n      // 83.  String::npos vs. string::max_size()\n      if (__capacity > _S_max_size)\n\t__throw_length_error(__N(\"basic_string::_S_create\"));\n\n      // The standard places no restriction on allocating more memory\n      // than is strictly needed within this layer at the moment or as\n      // requested by an explicit application call to reserve().\n\n      // Many malloc implementations perform quite poorly when an\n      // application attempts to allocate memory in a stepwise fashion\n      // growing each allocation size by only 1 char.  Additionally,\n      // it makes little sense to allocate less linear memory than the\n      // natural blocking size of the malloc implementation.\n      // Unfortunately, we would need a somewhat low-level calculation\n      // with tuned parameters to get this perfect for any particular\n      // malloc implementation.  Fortunately, generalizations about\n      // common features seen among implementations seems to suffice.\n\n      // __pagesize need not match the actual VM page size for good\n      // results in practice, thus we pick a common value on the low\n      // side.  __malloc_header_size is an estimate of the amount of\n      // overhead per memory allocation (in practice seen N * sizeof\n      // (void*) where N is 0, 2 or 4).  According to folklore,\n      // picking this value on the high side is better than\n      // low-balling it (especially when this algorithm is used with\n      // malloc implementations that allocate memory blocks rounded up\n      // to a size which is a power of 2).\n      const size_type __pagesize = 4096;\n      const size_type __malloc_header_size = 4 * sizeof(void*);\n\n      // The below implements an exponential growth policy, necessary to\n      // meet amortized linear time requirements of the library: see\n      // http://gcc.gnu.org/ml/libstdc++/2001-07/msg00085.html.\n      // It's active for allocations requiring an amount of memory above\n      // system pagesize. This is consistent with the requirements of the\n      // standard: http://gcc.gnu.org/ml/libstdc++/2001-07/msg00130.html\n      if (__capacity > __old_capacity && __capacity < 2 * __old_capacity)\n\t__capacity = 2 * __old_capacity;\n\n      // NB: Need an array of char_type[__capacity], plus a terminating\n      // null char_type() element, plus enough for the _Rep data structure.\n      // Whew. Seemingly so needy, yet so elemental.\n      size_type __size = (__capacity + 1) * sizeof(_CharT) + sizeof(_Rep);\n\n      const size_type __adj_size = __size + __malloc_header_size;\n      if (__adj_size > __pagesize && __capacity > __old_capacity)\n\t{\n\t  const size_type __extra = __pagesize - __adj_size % __pagesize;\n\t  __capacity += __extra / sizeof(_CharT);\n\t  // Never allocate a string bigger than _S_max_size.\n\t  if (__capacity > _S_max_size)\n\t    __capacity = _S_max_size;\n\t  __size = (__capacity + 1) * sizeof(_CharT) + sizeof(_Rep);\n\t}\n\n      // NB: Might throw, but no worries about a leak, mate: _Rep()\n      // does not throw.\n      void* __place = _Raw_bytes_alloc(__alloc).allocate(__size);\n      _Rep *__p = new (__place) _Rep;\n      __p->_M_capacity = __capacity;\n      // ABI compatibility - 3.4.x set in _S_create both\n      // _M_refcount and _M_length.  All callers of _S_create\n      // in basic_string.tcc then set just _M_length.\n      // In 4.0.x and later both _M_refcount and _M_length\n      // are initialized in the callers, unfortunately we can\n      // have 3.4.x compiled code with _S_create callers inlined\n      // calling 4.0.x+ _S_create.\n      __p->_M_set_sharable();\n      return __p;\n    }\n\n  template<typename _CharT, typename _Traits, typename _Alloc>\n    _CharT*\n    basic_string<_CharT, _Traits, _Alloc>::_Rep::\n    _M_clone(const _Alloc& __alloc, size_type __res)\n    {\n      // Requested capacity of the clone.\n      const size_type __requested_cap = this->_M_length + __res;\n      _Rep* __r = _Rep::_S_create(__requested_cap, this->_M_capacity,\n\t\t\t\t  __alloc);\n      if (this->_M_length)\n\t_M_copy(__r->_M_refdata(), _M_refdata(), this->_M_length);\n\n      __r->_M_set_length_and_sharable(this->_M_length);\n      return __r->_M_refdata();\n    }\n\n  template<typename _CharT, typename _Traits, typename _Alloc>\n    void\n    basic_string<_CharT, _Traits, _Alloc>::\n    resize(size_type __n, _CharT __c)\n    {\n      const size_type __size = this->size();\n      _M_check_length(__size, __n, \"basic_string::resize\");\n      if (__size < __n)\n\tthis->append(__n - __size, __c);\n      else if (__n < __size)\n\tthis->erase(__n);\n      // else nothing (in particular, avoid calling _M_mutate() unnecessarily.)\n    }\n\n  template<typename _CharT, typename _Traits, typename _Alloc>\n    template<typename _InputIterator>\n      basic_string<_CharT, _Traits, _Alloc>&\n      basic_string<_CharT, _Traits, _Alloc>::\n      _M_replace_dispatch(iterator __i1, iterator __i2, _InputIterator __k1,\n\t\t\t  _InputIterator __k2, __false_type)\n      {\n\tconst basic_string __s(__k1, __k2);\n\tconst size_type __n1 = __i2 - __i1;\n\t_M_check_length(__n1, __s.size(), \"basic_string::_M_replace_dispatch\");\n\treturn _M_replace_safe(__i1 - _M_ibegin(), __n1, __s._M_data(),\n\t\t\t       __s.size());\n      }\n\n  template<typename _CharT, typename _Traits, typename _Alloc>\n    basic_string<_CharT, _Traits, _Alloc>&\n    basic_string<_CharT, _Traits, _Alloc>::\n    _M_replace_aux(size_type __pos1, size_type __n1, size_type __n2,\n\t\t   _CharT __c)\n    {\n      _M_check_length(__n1, __n2, \"basic_string::_M_replace_aux\");\n      _M_mutate(__pos1, __n1, __n2);\n      if (__n2)\n\t_M_assign(_M_data() + __pos1, __n2, __c);\n      return *this;\n    }\n\n  template<typename _CharT, typename _Traits, typename _Alloc>\n    basic_string<_CharT, _Traits, _Alloc>&\n    basic_string<_CharT, _Traits, _Alloc>::\n    _M_replace_safe(size_type __pos1, size_type __n1, const _CharT* __s,\n\t\t    size_type __n2)\n    {\n      _M_mutate(__pos1, __n1, __n2);\n      if (__n2)\n\t_M_copy(_M_data() + __pos1, __s, __n2);\n      return *this;\n    }\n   \n  template<typename _CharT, typename _Traits, typename _Alloc>\n    basic_string<_CharT, _Traits, _Alloc>\n    operator+(const _CharT* __lhs,\n\t      const basic_string<_CharT, _Traits, _Alloc>& __rhs)\n    {\n      __glibcxx_requires_string(__lhs);\n      typedef basic_string<_CharT, _Traits, _Alloc> __string_type;\n      typedef typename __string_type::size_type\t  __size_type;\n      const __size_type __len = _Traits::length(__lhs);\n      __string_type __str;\n      __str.reserve(__len + __rhs.size());\n      __str.append(__lhs, __len);\n      __str.append(__rhs);\n      return __str;\n    }\n\n  template<typename _CharT, typename _Traits, typename _Alloc>\n    basic_string<_CharT, _Traits, _Alloc>\n    operator+(_CharT __lhs, const basic_string<_CharT, _Traits, _Alloc>& __rhs)\n    {\n      typedef basic_string<_CharT, _Traits, _Alloc> __string_type;\n      typedef typename __string_type::size_type\t  __size_type;\n      __string_type __str;\n      const __size_type __len = __rhs.size();\n      __str.reserve(__len + 1);\n      __str.append(__size_type(1), __lhs);\n      __str.append(__rhs);\n      return __str;\n    }\n\n  template<typename _CharT, typename _Traits, typename _Alloc>\n    typename basic_string<_CharT, _Traits, _Alloc>::size_type\n    basic_string<_CharT, _Traits, _Alloc>::\n    copy(_CharT* __s, size_type __n, size_type __pos) const\n    {\n      _M_check(__pos, \"basic_string::copy\");\n      __n = _M_limit(__pos, __n);\n      __glibcxx_requires_string_len(__s, __n);\n      if (__n)\n\t_M_copy(__s, _M_data() + __pos, __n);\n      // 21.3.5.7 par 3: do not append null.  (good.)\n      return __n;\n    }\n\n  template<typename _CharT, typename _Traits, typename _Alloc>\n    typename basic_string<_CharT, _Traits, _Alloc>::size_type\n    basic_string<_CharT, _Traits, _Alloc>::\n    find(const _CharT* __s, size_type __pos, size_type __n) const\n    {\n      __glibcxx_requires_string_len(__s, __n);\n      const size_type __size = this->size();\n      const _CharT* __data = _M_data();\n\n      if (__n == 0)\n\treturn __pos <= __size ? __pos : npos;\n\n      if (__n <= __size)\n\t{\n\t  for (; __pos <= __size - __n; ++__pos)\n\t    if (traits_type::eq(__data[__pos], __s[0])\n\t\t&& traits_type::compare(__data + __pos + 1,\n\t\t\t\t\t__s + 1, __n - 1) == 0)\n\t      return __pos;\n\t}\n      return npos;\n    }\n\n  template<typename _CharT, typename _Traits, typename _Alloc>\n    typename basic_string<_CharT, _Traits, _Alloc>::size_type\n    basic_string<_CharT, _Traits, _Alloc>::\n    find(_CharT __c, size_type __pos) const\n    {\n      size_type __ret = npos;\n      const size_type __size = this->size();\n      if (__pos < __size)\n\t{\n\t  const _CharT* __data = _M_data();\n\t  const size_type __n = __size - __pos;\n\t  const _CharT* __p = traits_type::find(__data + __pos, __n, __c);\n\t  if (__p)\n\t    __ret = __p - __data;\n\t}\n      return __ret;\n    }\n\n  template<typename _CharT, typename _Traits, typename _Alloc>\n    typename basic_string<_CharT, _Traits, _Alloc>::size_type\n    basic_string<_CharT, _Traits, _Alloc>::\n    rfind(const _CharT* __s, size_type __pos, size_type __n) const\n    {\n      __glibcxx_requires_string_len(__s, __n);\n      const size_type __size = this->size();\n      if (__n <= __size)\n\t{\n\t  __pos = std::min(size_type(__size - __n), __pos);\n\t  const _CharT* __data = _M_data();\n\t  do\n\t    {\n\t      if (traits_type::compare(__data + __pos, __s, __n) == 0)\n\t\treturn __pos;\n\t    }\n\t  while (__pos-- > 0);\n\t}\n      return npos;\n    }\n\n  template<typename _CharT, typename _Traits, typename _Alloc>\n    typename basic_string<_CharT, _Traits, _Alloc>::size_type\n    basic_string<_CharT, _Traits, _Alloc>::\n    rfind(_CharT __c, size_type __pos) const\n    {\n      size_type __size = this->size();\n      if (__size)\n\t{\n\t  if (--__size > __pos)\n\t    __size = __pos;\n\t  for (++__size; __size-- > 0; )\n\t    if (traits_type::eq(_M_data()[__size], __c))\n\t      return __size;\n\t}\n      return npos;\n    }\n\n  template<typename _CharT, typename _Traits, typename _Alloc>\n    typename basic_string<_CharT, _Traits, _Alloc>::size_type\n    basic_string<_CharT, _Traits, _Alloc>::\n    find_first_of(const _CharT* __s, size_type __pos, size_type __n) const\n    {\n      __glibcxx_requires_string_len(__s, __n);\n      for (; __n && __pos < this->size(); ++__pos)\n\t{\n\t  const _CharT* __p = traits_type::find(__s, __n, _M_data()[__pos]);\n\t  if (__p)\n\t    return __pos;\n\t}\n      return npos;\n    }\n\n  template<typename _CharT, typename _Traits, typename _Alloc>\n    typename basic_string<_CharT, _Traits, _Alloc>::size_type\n    basic_string<_CharT, _Traits, _Alloc>::\n    find_last_of(const _CharT* __s, size_type __pos, size_type __n) const\n    {\n      __glibcxx_requires_string_len(__s, __n);\n      size_type __size = this->size();\n      if (__size && __n)\n\t{\n\t  if (--__size > __pos)\n\t    __size = __pos;\n\t  do\n\t    {\n\t      if (traits_type::find(__s, __n, _M_data()[__size]))\n\t\treturn __size;\n\t    }\n\t  while (__size-- != 0);\n\t}\n      return npos;\n    }\n\n  template<typename _CharT, typename _Traits, typename _Alloc>\n    typename basic_string<_CharT, _Traits, _Alloc>::size_type\n    basic_string<_CharT, _Traits, _Alloc>::\n    find_first_not_of(const _CharT* __s, size_type __pos, size_type __n) const\n    {\n      __glibcxx_requires_string_len(__s, __n);\n      for (; __pos < this->size(); ++__pos)\n\tif (!traits_type::find(__s, __n, _M_data()[__pos]))\n\t  return __pos;\n      return npos;\n    }\n\n  template<typename _CharT, typename _Traits, typename _Alloc>\n    typename basic_string<_CharT, _Traits, _Alloc>::size_type\n    basic_string<_CharT, _Traits, _Alloc>::\n    find_first_not_of(_CharT __c, size_type __pos) const\n    {\n      for (; __pos < this->size(); ++__pos)\n\tif (!traits_type::eq(_M_data()[__pos], __c))\n\t  return __pos;\n      return npos;\n    }\n\n  template<typename _CharT, typename _Traits, typename _Alloc>\n    typename basic_string<_CharT, _Traits, _Alloc>::size_type\n    basic_string<_CharT, _Traits, _Alloc>::\n    find_last_not_of(const _CharT* __s, size_type __pos, size_type __n) const\n    {\n      __glibcxx_requires_string_len(__s, __n);\n      size_type __size = this->size();\n      if (__size)\n\t{\n\t  if (--__size > __pos)\n\t    __size = __pos;\n\t  do\n\t    {\n\t      if (!traits_type::find(__s, __n, _M_data()[__size]))\n\t\treturn __size;\n\t    }\n\t  while (__size--);\n\t}\n      return npos;\n    }\n\n  template<typename _CharT, typename _Traits, typename _Alloc>\n    typename basic_string<_CharT, _Traits, _Alloc>::size_type\n    basic_string<_CharT, _Traits, _Alloc>::\n    find_last_not_of(_CharT __c, size_type __pos) const\n    {\n      size_type __size = this->size();\n      if (__size)\n\t{\n\t  if (--__size > __pos)\n\t    __size = __pos;\n\t  do\n\t    {\n\t      if (!traits_type::eq(_M_data()[__size], __c))\n\t\treturn __size;\n\t    }\n\t  while (__size--);\n\t}\n      return npos;\n    }\n\n  template<typename _CharT, typename _Traits, typename _Alloc>\n    int\n    basic_string<_CharT, _Traits, _Alloc>::\n    compare(size_type __pos, size_type __n, const basic_string& __str) const\n    {\n      _M_check(__pos, \"basic_string::compare\");\n      __n = _M_limit(__pos, __n);\n      const size_type __osize = __str.size();\n      const size_type __len = std::min(__n, __osize);\n      int __r = traits_type::compare(_M_data() + __pos, __str.data(), __len);\n      if (!__r)\n\t__r = __n - __osize;\n      return __r;\n    }\n\n  template<typename _CharT, typename _Traits, typename _Alloc>\n    int\n    basic_string<_CharT, _Traits, _Alloc>::\n    compare(size_type __pos1, size_type __n1, const basic_string& __str,\n\t    size_type __pos2, size_type __n2) const\n    {\n      _M_check(__pos1, \"basic_string::compare\");\n      __str._M_check(__pos2, \"basic_string::compare\");\n      __n1 = _M_limit(__pos1, __n1);\n      __n2 = __str._M_limit(__pos2, __n2);\n      const size_type __len = std::min(__n1, __n2);\n      int __r = traits_type::compare(_M_data() + __pos1,\n\t\t\t\t     __str.data() + __pos2, __len);\n      if (!__r)\n\t__r = __n1 - __n2;\n      return __r;\n    }\n\n  template<typename _CharT, typename _Traits, typename _Alloc>\n    int\n    basic_string<_CharT, _Traits, _Alloc>::\n    compare(const _CharT* __s) const\n    {\n      __glibcxx_requires_string(__s);\n      const size_type __size = this->size();\n      const size_type __osize = traits_type::length(__s);\n      const size_type __len = std::min(__size, __osize);\n      int __r = traits_type::compare(_M_data(), __s, __len);\n      if (!__r)\n\t__r = __size - __osize;\n      return __r;\n    }\n\n  template<typename _CharT, typename _Traits, typename _Alloc>\n    int\n    basic_string <_CharT, _Traits, _Alloc>::\n    compare(size_type __pos, size_type __n1, const _CharT* __s) const\n    {\n      __glibcxx_requires_string(__s);\n      _M_check(__pos, \"basic_string::compare\");\n      __n1 = _M_limit(__pos, __n1);\n      const size_type __osize = traits_type::length(__s);\n      const size_type __len = std::min(__n1, __osize);\n      int __r = traits_type::compare(_M_data() + __pos, __s, __len);\n      if (!__r)\n\t__r = __n1 - __osize;\n      return __r;\n    }\n\n  template<typename _CharT, typename _Traits, typename _Alloc>\n    int\n    basic_string <_CharT, _Traits, _Alloc>::\n    compare(size_type __pos, size_type __n1, const _CharT* __s,\n\t    size_type __n2) const\n    {\n      __glibcxx_requires_string_len(__s, __n2);\n      _M_check(__pos, \"basic_string::compare\");\n      __n1 = _M_limit(__pos, __n1);\n      const size_type __len = std::min(__n1, __n2);\n      int __r = traits_type::compare(_M_data() + __pos, __s, __len);\n      if (!__r)\n\t__r = __n1 - __n2;\n      return __r;\n    }\n\n  // Inhibit implicit instantiations for required instantiations,\n  // which are defined via explicit instantiations elsewhere.\n  // NB: This syntax is a GNU extension.\n#if _GLIBCXX_EXTERN_TEMPLATE\n  extern template class basic_string<char>;\n  extern template\n    basic_istream<char>&\n    operator>>(basic_istream<char>&, string&);\n  extern template\n    basic_ostream<char>&\n    operator<<(basic_ostream<char>&, const string&);\n  extern template\n    basic_istream<char>&\n    getline(basic_istream<char>&, string&, char);\n  extern template\n    basic_istream<char>&\n    getline(basic_istream<char>&, string&);\n\n#ifdef _GLIBCXX_USE_WCHAR_T\n  extern template class basic_string<wchar_t>;\n  extern template\n    basic_istream<wchar_t>&\n    operator>>(basic_istream<wchar_t>&, wstring&);\n  extern template\n    basic_ostream<wchar_t>&\n    operator<<(basic_ostream<wchar_t>&, const wstring&);\n  extern template\n    basic_istream<wchar_t>&\n    getline(basic_istream<wchar_t>&, wstring&, wchar_t);\n  extern template\n    basic_istream<wchar_t>&\n    getline(basic_istream<wchar_t>&, wstring&);\n#endif\n#endif\n\n_GLIBCXX_END_NAMESPACE\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/bits/boost_concept_check.h",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2004, 2005 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n// (C) Copyright Jeremy Siek 2000. Permission to copy, use, modify,\n// sell and distribute this software is granted provided this\n// copyright notice appears in all copies. This software is provided\n// \"as is\" without express or implied warranty, and with no claim as\n// to its suitability for any purpose.\n//\n\n/** @file boost_concept_check.h\n *  This is an internal header file, included by other library headers.\n *  You should not attempt to use it directly.\n */\n\n// GCC Note:  based on version 1.12.0 of the Boost library.\n\n#ifndef _BOOST_CONCEPT_CHECK_H\n#define _BOOST_CONCEPT_CHECK_H 1\n\n#pragma GCC system_header\n\n#include <cstddef>                // for ptrdiff_t, used next\n#include <bits/stl_iterator_base_types.h>    // for traits and tags\n#include <utility>                           // for pair<>\n\n_GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)\n\n#define _IsUnused __attribute__ ((__unused__))\n\n// When the C-C code is in use, we would like this function to do as little\n// as possible at runtime, use as few resources as possible, and hopefully\n// be elided out of existence... hmmm.\ntemplate <class _Concept>\ninline void __function_requires()\n{\n  void (_Concept::*__x)() _IsUnused = &_Concept::__constraints;\n}\n\n// No definition: if this is referenced, there's a problem with\n// the instantiating type not being one of the required integer types.\n// Unfortunately, this results in a link-time error, not a compile-time error.\nvoid __error_type_must_be_an_integer_type();\nvoid __error_type_must_be_an_unsigned_integer_type();\nvoid __error_type_must_be_a_signed_integer_type();\n\n// ??? Should the \"concept_checking*\" structs begin with more than _ ?\n#define _GLIBCXX_CLASS_REQUIRES(_type_var, _ns, _concept) \\\n  typedef void (_ns::_concept <_type_var>::* _func##_type_var##_concept)(); \\\n  template <_func##_type_var##_concept _Tp1> \\\n  struct _concept_checking##_type_var##_concept { }; \\\n  typedef _concept_checking##_type_var##_concept< \\\n    &_ns::_concept <_type_var>::__constraints> \\\n    _concept_checking_typedef##_type_var##_concept\n\n#define _GLIBCXX_CLASS_REQUIRES2(_type_var1, _type_var2, _ns, _concept) \\\n  typedef void (_ns::_concept <_type_var1,_type_var2>::* _func##_type_var1##_type_var2##_concept)(); \\\n  template <_func##_type_var1##_type_var2##_concept _Tp1> \\\n  struct _concept_checking##_type_var1##_type_var2##_concept { }; \\\n  typedef _concept_checking##_type_var1##_type_var2##_concept< \\\n    &_ns::_concept <_type_var1,_type_var2>::__constraints> \\\n    _concept_checking_typedef##_type_var1##_type_var2##_concept\n\n#define _GLIBCXX_CLASS_REQUIRES3(_type_var1, _type_var2, _type_var3, _ns, _concept) \\\n  typedef void (_ns::_concept <_type_var1,_type_var2,_type_var3>::* _func##_type_var1##_type_var2##_type_var3##_concept)(); \\\n  template <_func##_type_var1##_type_var2##_type_var3##_concept _Tp1> \\\n  struct _concept_checking##_type_var1##_type_var2##_type_var3##_concept { }; \\\n  typedef _concept_checking##_type_var1##_type_var2##_type_var3##_concept< \\\n    &_ns::_concept <_type_var1,_type_var2,_type_var3>::__constraints>  \\\n  _concept_checking_typedef##_type_var1##_type_var2##_type_var3##_concept\n\n#define _GLIBCXX_CLASS_REQUIRES4(_type_var1, _type_var2, _type_var3, _type_var4, _ns, _concept) \\\n  typedef void (_ns::_concept <_type_var1,_type_var2,_type_var3,_type_var4>::* _func##_type_var1##_type_var2##_type_var3##_type_var4##_concept)(); \\\n  template <_func##_type_var1##_type_var2##_type_var3##_type_var4##_concept _Tp1> \\\n  struct _concept_checking##_type_var1##_type_var2##_type_var3##_type_var4##_concept { }; \\\n  typedef _concept_checking##_type_var1##_type_var2##_type_var3##_type_var4##_concept< \\\n  &_ns::_concept <_type_var1,_type_var2,_type_var3,_type_var4>::__constraints> \\\n    _concept_checking_typedef##_type_var1##_type_var2##_type_var3##_type_var4##_concept\n\n\ntemplate <class _Tp1, class _Tp2>\nstruct _Aux_require_same { };\n\ntemplate <class _Tp>\nstruct _Aux_require_same<_Tp,_Tp> { typedef _Tp _Type; };\n\n  template <class _Tp1, class _Tp2>\n  struct _SameTypeConcept\n  {\n    void __constraints() {\n      typedef typename _Aux_require_same<_Tp1, _Tp2>::_Type _Required;\n    }\n  };\n\n  template <class _Tp>\n  struct _IntegerConcept {\n    void __constraints() {\n      __error_type_must_be_an_integer_type();\n    }\n  };\n  template <> struct _IntegerConcept<short> { void __constraints() {} };\n  template <> struct _IntegerConcept<unsigned short> { void __constraints(){} };\n  template <> struct _IntegerConcept<int> { void __constraints() {} };\n  template <> struct _IntegerConcept<unsigned int> { void __constraints() {} };\n  template <> struct _IntegerConcept<long> { void __constraints() {} };\n  template <> struct _IntegerConcept<unsigned long> { void __constraints() {} };\n  template <> struct _IntegerConcept<long long> { void __constraints() {} };\n  template <> struct _IntegerConcept<unsigned long long>\n                                                { void __constraints() {} };\n\n  template <class _Tp>\n  struct _SignedIntegerConcept {\n    void __constraints() {\n      __error_type_must_be_a_signed_integer_type();\n    }\n  };\n  template <> struct _SignedIntegerConcept<short> { void __constraints() {} };\n  template <> struct _SignedIntegerConcept<int> { void __constraints() {} };\n  template <> struct _SignedIntegerConcept<long> { void __constraints() {} };\n  template <> struct _SignedIntegerConcept<long long> { void __constraints(){}};\n\n  template <class _Tp>\n  struct _UnsignedIntegerConcept {\n    void __constraints() {\n      __error_type_must_be_an_unsigned_integer_type();\n    }\n  };\n  template <> struct _UnsignedIntegerConcept<unsigned short>\n    { void __constraints() {} };\n  template <> struct _UnsignedIntegerConcept<unsigned int>\n    { void __constraints() {} };\n  template <> struct _UnsignedIntegerConcept<unsigned long>\n    { void __constraints() {} };\n  template <> struct _UnsignedIntegerConcept<unsigned long long>\n    { void __constraints() {} };\n\n  //===========================================================================\n  // Basic Concepts\n\n  template <class _Tp>\n  struct _DefaultConstructibleConcept\n  {\n    void __constraints() {\n      _Tp __a _IsUnused;                // require default constructor\n    }\n  };\n\n  template <class _Tp>\n  struct _AssignableConcept\n  {\n    void __constraints() {\n      __a = __a;                        // require assignment operator\n      __const_constraints(__a);\n    }\n    void __const_constraints(const _Tp& __b) {\n      __a = __b;                   // const required for argument to assignment\n    }\n    _Tp __a;\n    // possibly should be \"Tp* a;\" and then dereference \"a\" in constraint\n    // functions?  present way would require a default ctor, i think...\n  };\n\n  template <class _Tp>\n  struct _CopyConstructibleConcept\n  {\n    void __constraints() {\n      _Tp __a(__b);                     // require copy constructor\n      _Tp* __ptr _IsUnused = &__a;      // require address of operator\n      __const_constraints(__a);\n    }\n    void __const_constraints(const _Tp& __a) {\n      _Tp __c _IsUnused(__a);           // require const copy constructor\n      const _Tp* __ptr _IsUnused = &__a; // require const address of operator\n    }\n    _Tp __b;\n  };\n\n  // The SGI STL version of Assignable requires copy constructor and operator=\n  template <class _Tp>\n  struct _SGIAssignableConcept\n  {\n    void __constraints() {\n      _Tp __b _IsUnused(__a);\n      __a = __a;                        // require assignment operator\n      __const_constraints(__a);\n    }\n    void __const_constraints(const _Tp& __b) {\n      _Tp __c _IsUnused(__b);\n      __a = __b;              // const required for argument to assignment\n    }\n    _Tp __a;\n  };\n\n  template <class _From, class _To>\n  struct _ConvertibleConcept\n  {\n    void __constraints() {\n      _To __y _IsUnused = __x;\n    }\n    _From __x;\n  };\n\n  // The C++ standard requirements for many concepts talk about return\n  // types that must be \"convertible to bool\".  The problem with this\n  // requirement is that it leaves the door open for evil proxies that\n  // define things like operator|| with strange return types.  Two\n  // possible solutions are:\n  // 1) require the return type to be exactly bool\n  // 2) stay with convertible to bool, and also\n  //    specify stuff about all the logical operators.\n  // For now we just test for convertible to bool.\n  template <class _Tp>\n  void __aux_require_boolean_expr(const _Tp& __t) {\n    bool __x _IsUnused = __t;\n  }\n\n// FIXME\n  template <class _Tp>\n  struct _EqualityComparableConcept\n  {\n    void __constraints() {\n      __aux_require_boolean_expr(__a == __b);\n    }\n    _Tp __a, __b;\n  };\n\n  template <class _Tp>\n  struct _LessThanComparableConcept\n  {\n    void __constraints() {\n      __aux_require_boolean_expr(__a < __b);\n    }\n    _Tp __a, __b;\n  };\n\n  // This is equivalent to SGI STL's LessThanComparable.\n  template <class _Tp>\n  struct _ComparableConcept\n  {\n    void __constraints() {\n      __aux_require_boolean_expr(__a < __b);\n      __aux_require_boolean_expr(__a > __b);\n      __aux_require_boolean_expr(__a <= __b);\n      __aux_require_boolean_expr(__a >= __b);\n    }\n    _Tp __a, __b;\n  };\n\n#define _GLIBCXX_DEFINE_BINARY_PREDICATE_OP_CONSTRAINT(_OP,_NAME) \\\n  template <class _First, class _Second> \\\n  struct _NAME { \\\n    void __constraints() { (void)__constraints_(); } \\\n    bool __constraints_() {  \\\n      return  __a _OP __b; \\\n    } \\\n    _First __a; \\\n    _Second __b; \\\n  }\n\n#define _GLIBCXX_DEFINE_BINARY_OPERATOR_CONSTRAINT(_OP,_NAME) \\\n  template <class _Ret, class _First, class _Second> \\\n  struct _NAME { \\\n    void __constraints() { (void)__constraints_(); } \\\n    _Ret __constraints_() {  \\\n      return __a _OP __b; \\\n    } \\\n    _First __a; \\\n    _Second __b; \\\n  }\n\n  _GLIBCXX_DEFINE_BINARY_PREDICATE_OP_CONSTRAINT(==, _EqualOpConcept);\n  _GLIBCXX_DEFINE_BINARY_PREDICATE_OP_CONSTRAINT(!=, _NotEqualOpConcept);\n  _GLIBCXX_DEFINE_BINARY_PREDICATE_OP_CONSTRAINT(<, _LessThanOpConcept);\n  _GLIBCXX_DEFINE_BINARY_PREDICATE_OP_CONSTRAINT(<=, _LessEqualOpConcept);\n  _GLIBCXX_DEFINE_BINARY_PREDICATE_OP_CONSTRAINT(>, _GreaterThanOpConcept);\n  _GLIBCXX_DEFINE_BINARY_PREDICATE_OP_CONSTRAINT(>=, _GreaterEqualOpConcept);\n\n  _GLIBCXX_DEFINE_BINARY_OPERATOR_CONSTRAINT(+, _PlusOpConcept);\n  _GLIBCXX_DEFINE_BINARY_OPERATOR_CONSTRAINT(*, _TimesOpConcept);\n  _GLIBCXX_DEFINE_BINARY_OPERATOR_CONSTRAINT(/, _DivideOpConcept);\n  _GLIBCXX_DEFINE_BINARY_OPERATOR_CONSTRAINT(-, _SubtractOpConcept);\n  _GLIBCXX_DEFINE_BINARY_OPERATOR_CONSTRAINT(%, _ModOpConcept);\n\n#undef _GLIBCXX_DEFINE_BINARY_PREDICATE_OP_CONSTRAINT\n#undef _GLIBCXX_DEFINE_BINARY_OPERATOR_CONSTRAINT\n\n  //===========================================================================\n  // Function Object Concepts\n\n  template <class _Func, class _Return>\n  struct _GeneratorConcept\n  {\n    void __constraints() {\n      const _Return& __r _IsUnused = __f();// require operator() member function\n    }\n    _Func __f;\n  };\n\n\n  template <class _Func>\n  struct _GeneratorConcept<_Func,void>\n  {\n    void __constraints() {\n      __f();                            // require operator() member function\n    }\n    _Func __f;\n  };\n\n  template <class _Func, class _Return, class _Arg>\n  struct _UnaryFunctionConcept\n  {\n    void __constraints() {\n      __r = __f(__arg);                  // require operator()\n    }\n    _Func __f;\n    _Arg __arg;\n    _Return __r;\n  };\n\n  template <class _Func, class _Arg>\n  struct _UnaryFunctionConcept<_Func, void, _Arg> {\n    void __constraints() {\n      __f(__arg);                       // require operator()\n    }\n    _Func __f;\n    _Arg __arg;\n  };\n\n  template <class _Func, class _Return, class _First, class _Second>\n  struct _BinaryFunctionConcept\n  {\n    void __constraints() {\n      __r = __f(__first, __second);     // require operator()\n    }\n    _Func __f;\n    _First __first;\n    _Second __second;\n    _Return __r;\n  };\n\n  template <class _Func, class _First, class _Second>\n  struct _BinaryFunctionConcept<_Func, void, _First, _Second>\n  {\n    void __constraints() {\n      __f(__first, __second);           // require operator()\n    }\n    _Func __f;\n    _First __first;\n    _Second __second;\n  };\n\n  template <class _Func, class _Arg>\n  struct _UnaryPredicateConcept\n  {\n    void __constraints() {\n      __aux_require_boolean_expr(__f(__arg)); // require op() returning bool\n    }\n    _Func __f;\n    _Arg __arg;\n  };\n\n  template <class _Func, class _First, class _Second>\n  struct _BinaryPredicateConcept\n  {\n    void __constraints() {\n      __aux_require_boolean_expr(__f(__a, __b)); // require op() returning bool\n    }\n    _Func __f;\n    _First __a;\n    _Second __b;\n  };\n\n  // use this when functor is used inside a container class like std::set\n  template <class _Func, class _First, class _Second>\n  struct _Const_BinaryPredicateConcept {\n    void __constraints() {\n      __const_constraints(__f);\n    }\n    void __const_constraints(const _Func& __fun) {\n      __function_requires<_BinaryPredicateConcept<_Func, _First, _Second> >();\n      // operator() must be a const member function\n      __aux_require_boolean_expr(__fun(__a, __b));\n    }\n    _Func __f;\n    _First __a;\n    _Second __b;\n  };\n\n  //===========================================================================\n  // Iterator Concepts\n\n  template <class _Tp>\n  struct _TrivialIteratorConcept\n  {\n    void __constraints() {\n//    __function_requires< _DefaultConstructibleConcept<_Tp> >();\n      __function_requires< _AssignableConcept<_Tp> >();\n      __function_requires< _EqualityComparableConcept<_Tp> >();\n//      typedef typename std::iterator_traits<_Tp>::value_type _V;\n      (void)*__i;                       // require dereference operator\n    }\n    _Tp __i;\n  };\n\n  template <class _Tp>\n  struct _Mutable_TrivialIteratorConcept\n  {\n    void __constraints() {\n      __function_requires< _TrivialIteratorConcept<_Tp> >();\n      *__i = *__j;                      // require dereference and assignment\n    }\n    _Tp __i, __j;\n  };\n\n  template <class _Tp>\n  struct _InputIteratorConcept\n  {\n    void __constraints() {\n      __function_requires< _TrivialIteratorConcept<_Tp> >();\n      // require iterator_traits typedef's\n      typedef typename std::iterator_traits<_Tp>::difference_type _Diff;\n//      __function_requires< _SignedIntegerConcept<_Diff> >();\n      typedef typename std::iterator_traits<_Tp>::reference _Ref;\n      typedef typename std::iterator_traits<_Tp>::pointer _Pt;\n      typedef typename std::iterator_traits<_Tp>::iterator_category _Cat;\n      __function_requires< _ConvertibleConcept<\n        typename std::iterator_traits<_Tp>::iterator_category,\n        std::input_iterator_tag> >();\n      ++__i;                            // require preincrement operator\n      __i++;                            // require postincrement operator\n    }\n    _Tp __i;\n  };\n\n  template <class _Tp, class _ValueT>\n  struct _OutputIteratorConcept\n  {\n    void __constraints() {\n      __function_requires< _AssignableConcept<_Tp> >();\n      ++__i;                            // require preincrement operator\n      __i++;                            // require postincrement operator\n      *__i++ = __t;                     // require postincrement and assignment\n    }\n    _Tp __i;\n    _ValueT __t;\n  };\n\n  template <class _Tp>\n  struct _ForwardIteratorConcept\n  {\n    void __constraints() {\n      __function_requires< _InputIteratorConcept<_Tp> >();\n      __function_requires< _DefaultConstructibleConcept<_Tp> >();\n      __function_requires< _ConvertibleConcept<\n        typename std::iterator_traits<_Tp>::iterator_category,\n        std::forward_iterator_tag> >();\n      typedef typename std::iterator_traits<_Tp>::reference _Ref;\n      _Ref __r _IsUnused = *__i;\n    }\n    _Tp __i;\n  };\n\n  template <class _Tp>\n  struct _Mutable_ForwardIteratorConcept\n  {\n    void __constraints() {\n      __function_requires< _ForwardIteratorConcept<_Tp> >();\n      *__i++ = *__i;                    // require postincrement and assignment\n    }\n    _Tp __i;\n  };\n\n  template <class _Tp>\n  struct _BidirectionalIteratorConcept\n  {\n    void __constraints() {\n      __function_requires< _ForwardIteratorConcept<_Tp> >();\n      __function_requires< _ConvertibleConcept<\n        typename std::iterator_traits<_Tp>::iterator_category,\n        std::bidirectional_iterator_tag> >();\n      --__i;                            // require predecrement operator\n      __i--;                            // require postdecrement operator\n    }\n    _Tp __i;\n  };\n\n  template <class _Tp>\n  struct _Mutable_BidirectionalIteratorConcept\n  {\n    void __constraints() {\n      __function_requires< _BidirectionalIteratorConcept<_Tp> >();\n      __function_requires< _Mutable_ForwardIteratorConcept<_Tp> >();\n      *__i-- = *__i;                    // require postdecrement and assignment\n    }\n    _Tp __i;\n  };\n\n\n  template <class _Tp>\n  struct _RandomAccessIteratorConcept\n  {\n    void __constraints() {\n      __function_requires< _BidirectionalIteratorConcept<_Tp> >();\n      __function_requires< _ComparableConcept<_Tp> >();\n      __function_requires< _ConvertibleConcept<\n        typename std::iterator_traits<_Tp>::iterator_category,\n        std::random_access_iterator_tag> >();\n      // ??? We don't use _Ref, are we just checking for \"referenceability\"?\n      typedef typename std::iterator_traits<_Tp>::reference _Ref;\n\n      __i += __n;                       // require assignment addition operator\n      __i = __i + __n; __i = __n + __i; // require addition with difference type\n      __i -= __n;                       // require assignment subtraction op\n      __i = __i - __n;                  // require subtraction with\n                                        //            difference type\n      __n = __i - __j;                  // require difference operator\n      (void)__i[__n];                   // require element access operator\n    }\n    _Tp __a, __b;\n    _Tp __i, __j;\n    typename std::iterator_traits<_Tp>::difference_type __n;\n  };\n\n  template <class _Tp>\n  struct _Mutable_RandomAccessIteratorConcept\n  {\n    void __constraints() {\n      __function_requires< _RandomAccessIteratorConcept<_Tp> >();\n      __function_requires< _Mutable_BidirectionalIteratorConcept<_Tp> >();\n      __i[__n] = *__i;                  // require element access and assignment\n    }\n    _Tp __i;\n    typename std::iterator_traits<_Tp>::difference_type __n;\n  };\n\n  //===========================================================================\n  // Container Concepts\n\n  template <class _Container>\n  struct _ContainerConcept\n  {\n    typedef typename _Container::value_type _Value_type;\n    typedef typename _Container::difference_type _Difference_type;\n    typedef typename _Container::size_type _Size_type;\n    typedef typename _Container::const_reference _Const_reference;\n    typedef typename _Container::const_pointer _Const_pointer;\n    typedef typename _Container::const_iterator _Const_iterator;\n\n    void __constraints() {\n      __function_requires< _InputIteratorConcept<_Const_iterator> >();\n      __function_requires< _AssignableConcept<_Container> >();\n      const _Container __c;\n      __i = __c.begin();\n      __i = __c.end();\n      __n = __c.size();\n      __n = __c.max_size();\n      __b = __c.empty();\n    }\n    bool __b;\n    _Const_iterator __i;\n    _Size_type __n;\n  };\n\n  template <class _Container>\n  struct _Mutable_ContainerConcept\n  {\n    typedef typename _Container::value_type _Value_type;\n    typedef typename _Container::reference _Reference;\n    typedef typename _Container::iterator _Iterator;\n    typedef typename _Container::pointer _Pointer;\n\n    void __constraints() {\n      __function_requires< _ContainerConcept<_Container> >();\n      __function_requires< _AssignableConcept<_Value_type> >();\n      __function_requires< _InputIteratorConcept<_Iterator> >();\n\n      __i = __c.begin();\n      __i = __c.end();\n      __c.swap(__c2);\n    }\n    _Iterator __i;\n    _Container __c, __c2;\n  };\n\n  template <class _ForwardContainer>\n  struct _ForwardContainerConcept\n  {\n    void __constraints() {\n      __function_requires< _ContainerConcept<_ForwardContainer> >();\n      typedef typename _ForwardContainer::const_iterator _Const_iterator;\n      __function_requires< _ForwardIteratorConcept<_Const_iterator> >();\n    }\n  };\n\n  template <class _ForwardContainer>\n  struct _Mutable_ForwardContainerConcept\n  {\n    void __constraints() {\n      __function_requires< _ForwardContainerConcept<_ForwardContainer> >();\n      __function_requires< _Mutable_ContainerConcept<_ForwardContainer> >();\n      typedef typename _ForwardContainer::iterator _Iterator;\n      __function_requires< _Mutable_ForwardIteratorConcept<_Iterator> >();\n    }\n  };\n\n  template <class _ReversibleContainer>\n  struct _ReversibleContainerConcept\n  {\n    typedef typename _ReversibleContainer::const_iterator _Const_iterator;\n    typedef typename _ReversibleContainer::const_reverse_iterator\n      _Const_reverse_iterator;\n\n    void __constraints() {\n      __function_requires< _ForwardContainerConcept<_ReversibleContainer> >();\n      __function_requires< _BidirectionalIteratorConcept<_Const_iterator> >();\n      __function_requires<\n        _BidirectionalIteratorConcept<_Const_reverse_iterator> >();\n\n      const _ReversibleContainer __c;\n      _Const_reverse_iterator __i = __c.rbegin();\n      __i = __c.rend();\n    }\n  };\n\n  template <class _ReversibleContainer>\n  struct _Mutable_ReversibleContainerConcept\n  {\n    typedef typename _ReversibleContainer::iterator _Iterator;\n    typedef typename _ReversibleContainer::reverse_iterator _Reverse_iterator;\n\n    void __constraints() {\n      __function_requires<_ReversibleContainerConcept<_ReversibleContainer> >();\n      __function_requires<\n        _Mutable_ForwardContainerConcept<_ReversibleContainer> >();\n      __function_requires<_Mutable_BidirectionalIteratorConcept<_Iterator> >();\n      __function_requires<\n        _Mutable_BidirectionalIteratorConcept<_Reverse_iterator> >();\n\n      _Reverse_iterator __i = __c.rbegin();\n      __i = __c.rend();\n    }\n    _ReversibleContainer __c;\n  };\n\n  template <class _RandomAccessContainer>\n  struct _RandomAccessContainerConcept\n  {\n    typedef typename _RandomAccessContainer::size_type _Size_type;\n    typedef typename _RandomAccessContainer::const_reference _Const_reference;\n    typedef typename _RandomAccessContainer::const_iterator _Const_iterator;\n    typedef typename _RandomAccessContainer::const_reverse_iterator\n      _Const_reverse_iterator;\n\n    void __constraints() {\n      __function_requires<\n        _ReversibleContainerConcept<_RandomAccessContainer> >();\n      __function_requires< _RandomAccessIteratorConcept<_Const_iterator> >();\n      __function_requires<\n        _RandomAccessIteratorConcept<_Const_reverse_iterator> >();\n\n      const _RandomAccessContainer __c;\n      _Const_reference __r _IsUnused = __c[__n];\n    }\n    _Size_type __n;\n  };\n\n  template <class _RandomAccessContainer>\n  struct _Mutable_RandomAccessContainerConcept\n  {\n    typedef typename _RandomAccessContainer::size_type _Size_type;\n    typedef typename _RandomAccessContainer::reference _Reference;\n    typedef typename _RandomAccessContainer::iterator _Iterator;\n    typedef typename _RandomAccessContainer::reverse_iterator _Reverse_iterator;\n\n    void __constraints() {\n      __function_requires<\n        _RandomAccessContainerConcept<_RandomAccessContainer> >();\n      __function_requires<\n        _Mutable_ReversibleContainerConcept<_RandomAccessContainer> >();\n      __function_requires< _Mutable_RandomAccessIteratorConcept<_Iterator> >();\n      __function_requires<\n        _Mutable_RandomAccessIteratorConcept<_Reverse_iterator> >();\n\n      _Reference __r _IsUnused = __c[__i];\n    }\n    _Size_type __i;\n    _RandomAccessContainer __c;\n  };\n\n  // A Sequence is inherently mutable\n  template <class _Sequence>\n  struct _SequenceConcept\n  {\n    typedef typename _Sequence::reference _Reference;\n    typedef typename _Sequence::const_reference _Const_reference;\n\n    void __constraints() {\n      // Matt Austern's book puts DefaultConstructible here, the C++\n      // standard places it in Container\n      //    function_requires< DefaultConstructible<Sequence> >();\n      __function_requires< _Mutable_ForwardContainerConcept<_Sequence> >();\n      __function_requires< _DefaultConstructibleConcept<_Sequence> >();\n\n      _Sequence\n\t__c _IsUnused(__n, __t),\n        __c2 _IsUnused(__first, __last);\n\n      __c.insert(__p, __t);\n      __c.insert(__p, __n, __t);\n      __c.insert(__p, __first, __last);\n\n      __c.erase(__p);\n      __c.erase(__p, __q);\n\n      _Reference __r _IsUnused = __c.front();\n\n      __const_constraints(__c);\n    }\n    void __const_constraints(const _Sequence& __c) {\n      _Const_reference __r _IsUnused = __c.front();\n    }\n    typename _Sequence::value_type __t;\n    typename _Sequence::size_type __n;\n    typename _Sequence::value_type *__first, *__last;\n    typename _Sequence::iterator __p, __q;\n  };\n\n  template <class _FrontInsertionSequence>\n  struct _FrontInsertionSequenceConcept\n  {\n    void __constraints() {\n      __function_requires< _SequenceConcept<_FrontInsertionSequence> >();\n\n      __c.push_front(__t);\n      __c.pop_front();\n    }\n    _FrontInsertionSequence __c;\n    typename _FrontInsertionSequence::value_type __t;\n  };\n\n  template <class _BackInsertionSequence>\n  struct _BackInsertionSequenceConcept\n  {\n    typedef typename _BackInsertionSequence::reference _Reference;\n    typedef typename _BackInsertionSequence::const_reference _Const_reference;\n\n    void __constraints() {\n      __function_requires< _SequenceConcept<_BackInsertionSequence> >();\n\n      __c.push_back(__t);\n      __c.pop_back();\n      _Reference __r _IsUnused = __c.back();\n    }\n    void __const_constraints(const _BackInsertionSequence& __c) {\n      _Const_reference __r _IsUnused = __c.back();\n    };\n    _BackInsertionSequence __c;\n    typename _BackInsertionSequence::value_type __t;\n  };\n\n  template <class _AssociativeContainer>\n  struct _AssociativeContainerConcept\n  {\n    void __constraints() {\n      __function_requires< _ForwardContainerConcept<_AssociativeContainer> >();\n      __function_requires<\n        _DefaultConstructibleConcept<_AssociativeContainer> >();\n\n      __i = __c.find(__k);\n      __r = __c.equal_range(__k);\n      __c.erase(__k);\n      __c.erase(__i);\n      __c.erase(__r.first, __r.second);\n      __const_constraints(__c);\n    }\n    void __const_constraints(const _AssociativeContainer& __c) {\n      __ci = __c.find(__k);\n      __n = __c.count(__k);\n      __cr = __c.equal_range(__k);\n    }\n    typedef typename _AssociativeContainer::iterator _Iterator;\n    typedef typename _AssociativeContainer::const_iterator _Const_iterator;\n\n    _AssociativeContainer __c;\n    _Iterator __i;\n    std::pair<_Iterator,_Iterator> __r;\n    _Const_iterator __ci;\n    std::pair<_Const_iterator,_Const_iterator> __cr;\n    typename _AssociativeContainer::key_type __k;\n    typename _AssociativeContainer::size_type __n;\n  };\n\n  template <class _UniqueAssociativeContainer>\n  struct _UniqueAssociativeContainerConcept\n  {\n    void __constraints() {\n      __function_requires<\n        _AssociativeContainerConcept<_UniqueAssociativeContainer> >();\n\n      _UniqueAssociativeContainer __c(__first, __last);\n\n      __pos_flag = __c.insert(__t);\n      __c.insert(__first, __last);\n    }\n    std::pair<typename _UniqueAssociativeContainer::iterator, bool> __pos_flag;\n    typename _UniqueAssociativeContainer::value_type __t;\n    typename _UniqueAssociativeContainer::value_type *__first, *__last;\n  };\n\n  template <class _MultipleAssociativeContainer>\n  struct _MultipleAssociativeContainerConcept\n  {\n    void __constraints() {\n      __function_requires<\n        _AssociativeContainerConcept<_MultipleAssociativeContainer> >();\n\n      _MultipleAssociativeContainer __c(__first, __last);\n\n      __pos = __c.insert(__t);\n      __c.insert(__first, __last);\n\n    }\n    typename _MultipleAssociativeContainer::iterator __pos;\n    typename _MultipleAssociativeContainer::value_type __t;\n    typename _MultipleAssociativeContainer::value_type *__first, *__last;\n  };\n\n  template <class _SimpleAssociativeContainer>\n  struct _SimpleAssociativeContainerConcept\n  {\n    void __constraints() {\n      __function_requires<\n        _AssociativeContainerConcept<_SimpleAssociativeContainer> >();\n      typedef typename _SimpleAssociativeContainer::key_type _Key_type;\n      typedef typename _SimpleAssociativeContainer::value_type _Value_type;\n      typedef typename _Aux_require_same<_Key_type, _Value_type>::_Type\n        _Required;\n    }\n  };\n\n  template <class _SimpleAssociativeContainer>\n  struct _PairAssociativeContainerConcept\n  {\n    void __constraints() {\n      __function_requires<\n        _AssociativeContainerConcept<_SimpleAssociativeContainer> >();\n      typedef typename _SimpleAssociativeContainer::key_type _Key_type;\n      typedef typename _SimpleAssociativeContainer::value_type _Value_type;\n      typedef typename _SimpleAssociativeContainer::mapped_type _Mapped_type;\n      typedef std::pair<const _Key_type, _Mapped_type> _Required_value_type;\n      typedef typename _Aux_require_same<_Value_type,\n        _Required_value_type>::_Type _Required;\n    }\n  };\n\n  template <class _SortedAssociativeContainer>\n  struct _SortedAssociativeContainerConcept\n  {\n    void __constraints() {\n      __function_requires<\n        _AssociativeContainerConcept<_SortedAssociativeContainer> >();\n      __function_requires<\n        _ReversibleContainerConcept<_SortedAssociativeContainer> >();\n\n      _SortedAssociativeContainer\n        __c _IsUnused(__kc),\n        __c2 _IsUnused(__first, __last),\n        __c3 _IsUnused(__first, __last, __kc);\n\n      __p = __c.upper_bound(__k);\n      __p = __c.lower_bound(__k);\n      __r = __c.equal_range(__k);\n\n      __c.insert(__p, __t);\n    }\n    void __const_constraints(const _SortedAssociativeContainer& __c) {\n      __kc = __c.key_comp();\n      __vc = __c.value_comp();\n\n      __cp = __c.upper_bound(__k);\n      __cp = __c.lower_bound(__k);\n      __cr = __c.equal_range(__k);\n    }\n    typename _SortedAssociativeContainer::key_compare __kc;\n    typename _SortedAssociativeContainer::value_compare __vc;\n    typename _SortedAssociativeContainer::value_type __t;\n    typename _SortedAssociativeContainer::key_type __k;\n    typedef typename _SortedAssociativeContainer::iterator _Iterator;\n    typedef typename _SortedAssociativeContainer::const_iterator\n      _Const_iterator;\n\n    _Iterator __p;\n    _Const_iterator __cp;\n    std::pair<_Iterator,_Iterator> __r;\n    std::pair<_Const_iterator,_Const_iterator> __cr;\n    typename _SortedAssociativeContainer::value_type *__first, *__last;\n  };\n\n  // HashedAssociativeContainer\n\n_GLIBCXX_END_NAMESPACE\n\n#undef _IsUnused\n\n#endif // _GLIBCXX_BOOST_CONCEPT_CHECK\n\n\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/bits/c++allocator.h",
    "content": "// Base to std::allocator -*- C++ -*-\n\n// Copyright (C) 2004, 2005 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n/** @file c++allocator.h\n *  This is an internal header file, included by other library headers.\n *  You should not attempt to use it directly.\n */\n\n#ifndef _CXX_ALLOCATOR_H\n#define _CXX_ALLOCATOR_H 1\n\n// Define new_allocator as the base class to std::allocator.\n#include <ext/new_allocator.h>\n#define __glibcxx_base_allocator  __gnu_cxx::new_allocator\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/bits/c++config.h",
    "content": "// Predefined symbols and macros -*- C++ -*-\n\n// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,\n// 2006, 2007\n// Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n/** @file c++config.h\n *  This is an internal header file, included by other library headers.\n *  You should not attempt to use it directly.\n */\n\n#ifndef _CXXCONFIG\n#define _CXXCONFIG 1\n\n// Pick up any OS-specific definitions.\n#include <bits/os_defines.h>\n\n// Pick up any CPU-specific definitions.\n#include <bits/cpu_defines.h>\n\n// The current version of the C++ library in compressed ISO date format.\n#define __GLIBCXX__ 20070831 \n\n// Macros for visibility.\n#define _GLIBCXX_HAVE_ATTRIBUTE_VISIBILITY 1\n\n#if _GLIBCXX_HAVE_ATTRIBUTE_VISIBILITY\n#define _GLIBCXX_VISIBILITY(V) __attribute__ ((__visibility__ (#V)))\n#else\n#define _GLIBCXX_VISIBILITY(V) \n#endif\n\n// Macros for controlling various namespace association schemes and modes.\n#ifdef _GLIBCXX_DEBUG\n# define _GLIBCXX_NAMESPACE_ASSOCIATION_DEBUG 1\n#endif\n\n#define _GLIBCXX_NAMESPACE_ASSOCIATION_VERSION 0 \n\n// Macros for namespace scope.\n// _GLIBCXX_BEGIN_NAMESPACE\n// _GLIBCXX_END_NAMESPACE\n// _GLIBCXX_BEGIN_NESTED_NAMESPACE\n// _GLIBCXX_END_NESTED_NAMESPACE\n#if _GLIBCXX_NAMESPACE_ASSOCIATION_VERSION\n# define _GLIBCXX_BEGIN_NESTED_NAMESPACE(X, Y)  namespace X { namespace Y _GLIBCXX_VISIBILITY(default) {\n# define _GLIBCXX_END_NESTED_NAMESPACE } }\n# define _GLIBCXX_BEGIN_NAMESPACE(X) _GLIBCXX_BEGIN_NESTED_NAMESPACE(X, _6)\n# define _GLIBCXX_END_NAMESPACE _GLIBCXX_END_NESTED_NAMESPACE\n#else\n# define _GLIBCXX_BEGIN_NAMESPACE(X) namespace X _GLIBCXX_VISIBILITY(default) { \n# define _GLIBCXX_END_NAMESPACE } \n# if _GLIBCXX_NAMESPACE_ASSOCIATION_DEBUG\n#  define _GLIBCXX_BEGIN_NESTED_NAMESPACE(X, Y) namespace X { namespace Y _GLIBCXX_VISIBILITY(default) {\n#  define _GLIBCXX_END_NESTED_NAMESPACE  } }\n# else\n#  define _GLIBCXX_BEGIN_NESTED_NAMESPACE(X, Y) _GLIBCXX_BEGIN_NAMESPACE(X)\n#  define _GLIBCXX_END_NESTED_NAMESPACE _GLIBCXX_END_NAMESPACE\n# endif\n#endif\n\n// Namespace associations for versioning mode.\n#if _GLIBCXX_NAMESPACE_ASSOCIATION_VERSION\nnamespace std\n{\n  namespace _6 { }\n  using namespace _6 __attribute__ ((strong));\n}\n\n// In addition, other supported namespace configurations.\nnamespace __gnu_cxx \n{ \n  namespace _6 { }\n  using namespace _6 __attribute__ ((strong));\n}\n\nnamespace std\n{\n  namespace tr1 \n  { \n    namespace _6 { }\n    using namespace _6 __attribute__ ((strong));\n  }\n}\n#endif\n\n// Namespace associations for debug mode.\n#if _GLIBCXX_NAMESPACE_ASSOCIATION_DEBUG\nnamespace std\n{ \n  namespace __norm { }\n  namespace __debug { }\n  using namespace __debug __attribute__ ((strong)); \n}\n\nnamespace __gnu_cxx\n{\n  namespace __norm { }\n  namespace __debug { }\n  using namespace __debug __attribute__ ((strong)); \n}\n\n# define _GLIBCXX_STD __norm\n# define _GLIBCXX_EXT __norm\n# define _GLIBCXX_EXTERN_TEMPLATE 0\n# if __NO_INLINE__ && !__GXX_WEAK__\n#  warning debug mode without inlining may fail due to lack of weak symbols\n# endif\n#else\n#if _GLIBCXX_NAMESPACE_ASSOCIATION_VERSION\n# define _GLIBCXX_STD _6\n# define _GLIBCXX_EXT _6\n#else\n# define _GLIBCXX_STD std\n# define _GLIBCXX_EXT __gnu_cxx\n#endif\n#endif\n\n/* Define if compatibility should be provided for -mlong-double-64. */\n#undef _GLIBCXX_LONG_DOUBLE_COMPAT\n\n// XXX GLIBCXX_ABI Deprecated\n// Namespace associations for long double 128 mode.\n_GLIBCXX_BEGIN_NAMESPACE(std)\n#if defined _GLIBCXX_LONG_DOUBLE_COMPAT && defined __LONG_DOUBLE_128__\n# define _GLIBCXX_LDBL_NAMESPACE __gnu_cxx_ldbl128::\n# define _GLIBCXX_BEGIN_LDBL_NAMESPACE namespace __gnu_cxx_ldbl128 {\n# define _GLIBCXX_END_LDBL_NAMESPACE }\n  namespace __gnu_cxx_ldbl128 { }\n  using namespace __gnu_cxx_ldbl128 __attribute__((__strong__));\n#else\n# define _GLIBCXX_LDBL_NAMESPACE\n# define _GLIBCXX_BEGIN_LDBL_NAMESPACE\n# define _GLIBCXX_END_LDBL_NAMESPACE\n#endif\n_GLIBCXX_END_NAMESPACE\n\n\n// Allow use of \"export template.\" This is currently not a feature\n// that g++ supports.\n// #define _GLIBCXX_EXPORT_TEMPLATE 1\n\n// Allow use of the GNU syntax extension, \"extern template.\" This\n// extension is fully documented in the g++ manual, but in a nutshell,\n// it inhibits all implicit instantiations and is used throughout the\n// library to avoid multiple weak definitions for required types that\n// are already explicitly instantiated in the library binary. This\n// substantially reduces the binary size of resulting executables.\n#ifndef _GLIBCXX_EXTERN_TEMPLATE\n# define _GLIBCXX_EXTERN_TEMPLATE 1\n#endif\n\n\n// Certain function definitions that are meant to be overridable from\n// user code are decorated with this macro.  For some targets, this\n// macro causes these definitions to be weak.\n#ifndef _GLIBCXX_WEAK_DEFINITION\n# define _GLIBCXX_WEAK_DEFINITION\n#endif\n\n// The remainder of the prewritten config is automatic; all the\n// user hooks are listed above.\n\n// Create a boolean flag to be used to determine if --fast-math is set.\n#ifdef __FAST_MATH__\n# define _GLIBCXX_FAST_MATH 1\n#else\n# define _GLIBCXX_FAST_MATH 0\n#endif\n\n// This marks string literals in header files to be extracted for eventual\n// translation.  It is primarily used for messages in thrown exceptions; see\n// src/functexcept.cc.  We use __N because the more traditional _N is used\n// for something else under certain OSes (see BADNAMES).\n#define __N(msgid)     (msgid)\n\n// For example, <windows.h> is known to #define min and max as macros...\n#undef min\n#undef max\n\n// End of prewritten config; the discovered settings follow.\n/* $FreeBSD: release/9.0.0/gnu/lib/libstdc++/config.h 219534 2011-03-11 21:24:02Z marius $ */\n#ifndef __ISO_C_VISIBLE\n#include <sys/cdefs.h>\n#endif\n\n/* config.h.  Generated by configure.  */\n/* config.h.in.  Generated from configure.ac by autoheader.  */\n\n/* Define to 1 if you have the `acosf' function. */\n#define _GLIBCXX_HAVE_ACOSF 1\n\n/* Define to 1 if you have the `acosl' function. */\n/* #undef _GLIBCXX_HAVE_ACOSL */\n\n/* Define to 1 if you have the `asinf' function. */\n#define _GLIBCXX_HAVE_ASINF 1\n\n/* Define to 1 if you have the `asinl' function. */\n/* #undef _GLIBCXX_HAVE_ASINL */\n\n/* Define to 1 if you have the `atan2f' function. */\n#define _GLIBCXX_HAVE_ATAN2F 1\n\n/* Define to 1 if you have the `atan2l' function. */\n/* #undef _GLIBCXX_HAVE_ATAN2L */\n\n/* Define to 1 if you have the `atanf' function. */\n#define _GLIBCXX_HAVE_ATANF 1\n\n/* Define to 1 if you have the `atanl' function. */\n/* #undef _GLIBCXX_HAVE_ATANL */\n\n/* Define to 1 if you have the `ceilf' function. */\n#define _GLIBCXX_HAVE_CEILF 1\n\n/* Define to 1 if you have the `ceill' function. */\n#define _GLIBCXX_HAVE_CEILL 1\n\n/* Define to 1 if you have the <complex.h> header file. */\n#define _GLIBCXX_HAVE_COMPLEX_H 1\n\n/* Define to 1 if you have the `copysign' function. */\n#define _GLIBCXX_HAVE_COPYSIGN 1\n\n/* Define to 1 if you have the `copysignf' function. */\n#define _GLIBCXX_HAVE_COPYSIGNF 1\n\n/* Define to 1 if you have the `copysignl' function. */\n#define _GLIBCXX_HAVE_COPYSIGNL 1\n\n/* Define to 1 if you have the `cosf' function. */\n#define _GLIBCXX_HAVE_COSF 1\n\n/* Define to 1 if you have the `coshf' function. */\n#define _GLIBCXX_HAVE_COSHF 1\n\n/* Define to 1 if you have the `coshl' function. */\n/* #undef _GLIBCXX_HAVE_COSHL */\n\n/* Define to 1 if you have the `cosl' function. */\n/* #undef _GLIBCXX_HAVE_COSL */\n\n/* Define to 1 if you have the <endian.h> header file. */\n/* #undef _GLIBCXX_HAVE_ENDIAN_H */\n\n/* Define to 1 if you have the `expf' function. */\n#define _GLIBCXX_HAVE_EXPF 1\n\n/* Define to 1 if you have the `expl' function. */\n/* #undef _GLIBCXX_HAVE_EXPL */\n\n/* Define to 1 if you have the `fabsf' function. */\n#define _GLIBCXX_HAVE_FABSF 1\n\n/* Define to 1 if you have the `fabsl' function. */\n#define _GLIBCXX_HAVE_FABSL 1\n\n/* Define to 1 if you have the <fenv.h> header file. */\n#define _GLIBCXX_HAVE_FENV_H 1\n\n/* Define to 1 if you have the `finite' function. */\n#define _GLIBCXX_HAVE_FINITE 1\n\n/* Define to 1 if you have the `finitef' function. */\n#define _GLIBCXX_HAVE_FINITEF 1\n\n/* Define to 1 if you have the `finitel' function. */\n/* #undef _GLIBCXX_HAVE_FINITEL */\n\n/* Define to 1 if you have the <float.h> header file. */\n#define _GLIBCXX_HAVE_FLOAT_H 1\n\n/* Define to 1 if you have the `floorf' function. */\n#define _GLIBCXX_HAVE_FLOORF 1\n\n/* Define to 1 if you have the `floorl' function. */\n#define _GLIBCXX_HAVE_FLOORL 1\n\n/* Define to 1 if you have the `fmodf' function. */\n#define _GLIBCXX_HAVE_FMODF 1\n\n/* Define to 1 if you have the `fmodl' function. */\n/* #undef _GLIBCXX_HAVE_FMODL */\n\n/* Define to 1 if you have the `fpclass' function. */\n/* #undef _GLIBCXX_HAVE_FPCLASS */\n\n/* Define to 1 if you have the <fp.h> header file. */\n/* #undef _GLIBCXX_HAVE_FP_H */\n\n/* Define to 1 if you have the `frexpf' function. */\n#define _GLIBCXX_HAVE_FREXPF 1\n\n/* Define to 1 if you have the `frexpl' function. */\n#define _GLIBCXX_HAVE_FREXPL 1\n\n/* Define to 1 if you have the <gconv.h> header file. */\n/* #undef _GLIBCXX_HAVE_GCONV_H */\n\n/* Define if _Unwind_GetIPInfo is available. */\n#define _GLIBCXX_HAVE_GETIPINFO 1\n\n/* Define to 1 if you have the `getpagesize' function. */\n#define _GLIBCXX_HAVE_GETPAGESIZE 1\n\n/* Define if gthr-default.h exists (meaning that threading support is\n   enabled). */\n#define _GLIBCXX_HAVE_GTHR_DEFAULT 1\n\n/* Define to 1 if you have the `hypot' function. */\n#define _GLIBCXX_HAVE_HYPOT 1\n\n/* Define to 1 if you have the `hypotf' function. */\n#define _GLIBCXX_HAVE_HYPOTF 1\n\n/* Define to 1 if you have the `hypotl' function. */\n/* #undef _GLIBCXX_HAVE_HYPOTL */\n\n/* Define to 1 if you have the `iconv' function. */\n/* #undef _GLIBCXX_HAVE_ICONV */\n\n/* Define to 1 if you have the `iconv_close' function. */\n/* #undef _GLIBCXX_HAVE_ICONV_CLOSE */\n\n/* Define to 1 if you have the `iconv_open' function. */\n/* #undef _GLIBCXX_HAVE_ICONV_OPEN */\n\n/* Define to 1 if you have the <ieeefp.h> header file. */\n#define _GLIBCXX_HAVE_IEEEFP_H 1\n\n/* Define if int64_t is available in <stdint.h>. */\n#define _GLIBCXX_HAVE_INT64_T 1\n\n/* Define to 1 if you have the <inttypes.h> header file. */\n#define _GLIBCXX_HAVE_INTTYPES_H 1\n\n/* Define to 1 if you have the `isinf' function. */\n#define _GLIBCXX_HAVE_ISINF 1\n\n/* Define to 1 if you have the `isinff' function. */\n/* #undef _GLIBCXX_HAVE_ISINFF */\n\n/* Define to 1 if you have the `isinfl' function. */\n/* #undef _GLIBCXX_HAVE_ISINFL */\n\n/* Define to 1 if you have the `isnan' function. */\n#define _GLIBCXX_HAVE_ISNAN 1\n\n/* Define to 1 if you have the `isnanf' function. */\n#define _GLIBCXX_HAVE_ISNANF 1\n\n/* Define to 1 if you have the `isnanl' function. */\n/* #undef _GLIBCXX_HAVE_ISNANL */\n\n/* Defined if iswblank exists. */\n#define _GLIBCXX_HAVE_ISWBLANK 1\n\n/* Define if LC_MESSAGES is available in <locale.h>. */\n#define _GLIBCXX_HAVE_LC_MESSAGES 1\n\n/* Define to 1 if you have the `ldexpf' function. */\n#define _GLIBCXX_HAVE_LDEXPF 1\n\n/* Define to 1 if you have the `ldexpl' function. */\n#define _GLIBCXX_HAVE_LDEXPL 1\n\n/* Define to 1 if you have the <libintl.h> header file. */\n/* #undef _GLIBCXX_HAVE_LIBINTL_H */\n\n/* Define to 1 if you have the `m' library (-lm). */\n#define _GLIBCXX_HAVE_LIBM 1\n\n/* Only used in build directory testsuite_hooks.h. */\n#define _GLIBCXX_HAVE_LIMIT_AS 1\n\n/* Only used in build directory testsuite_hooks.h. */\n#define _GLIBCXX_HAVE_LIMIT_DATA 1\n\n/* Only used in build directory testsuite_hooks.h. */\n#define _GLIBCXX_HAVE_LIMIT_FSIZE 1\n\n/* Only used in build directory testsuite_hooks.h. */\n#define _GLIBCXX_HAVE_LIMIT_RSS 1\n\n/* Only used in build directory testsuite_hooks.h. */\n#define _GLIBCXX_HAVE_LIMIT_VMEM 1\n\n/* Define to 1 if you have the <locale.h> header file. */\n#define _GLIBCXX_HAVE_LOCALE_H 1\n\n/* Define to 1 if you have the `log10f' function. */\n#define _GLIBCXX_HAVE_LOG10F 1\n\n/* Define to 1 if you have the `log10l' function. */\n/* #undef _GLIBCXX_HAVE_LOG10L */\n\n/* Define to 1 if you have the `logf' function. */\n#define _GLIBCXX_HAVE_LOGF 1\n\n/* Define to 1 if you have the `logl' function. */\n/* #undef _GLIBCXX_HAVE_LOGL */\n\n/* Define to 1 if you have the <machine/endian.h> header file. */\n#define _GLIBCXX_HAVE_MACHINE_ENDIAN_H 1\n\n/* Define to 1 if you have the <machine/param.h> header file. */\n#define _GLIBCXX_HAVE_MACHINE_PARAM_H 1\n\n/* Define if mbstate_t exists in wchar.h. */\n#define _GLIBCXX_HAVE_MBSTATE_T 1\n\n/* Define to 1 if you have the <memory.h> header file. */\n#define _GLIBCXX_HAVE_MEMORY_H 1\n\n/* Define to 1 if you have a working `mmap' system call. */\n#define _GLIBCXX_HAVE_MMAP 1\n\n/* Define to 1 if you have the `modf' function. */\n#define _GLIBCXX_HAVE_MODF 1\n\n/* Define to 1 if you have the `modff' function. */\n#define _GLIBCXX_HAVE_MODFF 1\n\n/* Define to 1 if you have the `modfl' function. */\n#define _GLIBCXX_HAVE_MODFL 1\n\n/* Define to 1 if you have the <nan.h> header file. */\n/* #undef _GLIBCXX_HAVE_NAN_H */\n\n/* Define to 1 if you have the `nl_langinfo' function. */\n#define _GLIBCXX_HAVE_NL_LANGINFO 1\n\n/* Define if poll is available in <poll.h>. */\n#define _GLIBCXX_HAVE_POLL 1\n\n/* Define to 1 if you have the `powf' function. */\n#define _GLIBCXX_HAVE_POWF 1\n\n/* Define to 1 if you have the `powl' function. */\n/* #undef _GLIBCXX_HAVE_POWL */\n\n/* Define to 1 if you have the `qfpclass' function. */\n/* #undef _GLIBCXX_HAVE_QFPCLASS */\n\n/* Define to 1 if you have the `setenv' function. */\n#define _GLIBCXX_HAVE_SETENV 1\n\n/* Define if sigsetjmp is available. */\n#define _GLIBCXX_HAVE_SIGSETJMP 1\n\n/* Define to 1 if you have the `sincos' function. */\n/* #undef _GLIBCXX_HAVE_SINCOS */\n\n/* Define to 1 if you have the `sincosf' function. */\n/* #undef _GLIBCXX_HAVE_SINCOSF */\n\n/* Define to 1 if you have the `sincosl' function. */\n/* #undef _GLIBCXX_HAVE_SINCOSL */\n\n/* Define to 1 if you have the `sinf' function. */\n#define _GLIBCXX_HAVE_SINF 1\n\n/* Define to 1 if you have the `sinhf' function. */\n#define _GLIBCXX_HAVE_SINHF 1\n\n/* Define to 1 if you have the `sinhl' function. */\n/* #undef _GLIBCXX_HAVE_SINHL */\n\n/* Define to 1 if you have the `sinl' function. */\n/* #undef _GLIBCXX_HAVE_SINL */\n\n/* Define to 1 if you have the `sqrtf' function. */\n#define _GLIBCXX_HAVE_SQRTF 1\n\n/* Define to 1 if you have the `sqrtl' function. */\n/* #undef _GLIBCXX_HAVE_SQRTL */\n\n/* Define to 1 if you have the <stdbool.h> header file. */\n#define _GLIBCXX_HAVE_STDBOOL_H 1\n\n/* Define to 1 if you have the <stdint.h> header file. */\n#define _GLIBCXX_HAVE_STDINT_H 1\n\n/* Define to 1 if you have the <stdlib.h> header file. */\n#define _GLIBCXX_HAVE_STDLIB_H 1\n\n/* Define to 1 if you have the <strings.h> header file. */\n#define _GLIBCXX_HAVE_STRINGS_H 1\n\n/* Define to 1 if you have the <string.h> header file. */\n#define _GLIBCXX_HAVE_STRING_H 1\n\n/* Define to 1 if you have the `strtof' function. */\n#define _GLIBCXX_HAVE_STRTOF 1\n\n/* Define to 1 if you have the `strtold' function. */\n#define _GLIBCXX_HAVE_STRTOLD 1\n\n/* Define to 1 if you have the <sys/filio.h> header file. */\n#define _GLIBCXX_HAVE_SYS_FILIO_H 1\n\n/* Define to 1 if you have the <sys/ioctl.h> header file. */\n#define _GLIBCXX_HAVE_SYS_IOCTL_H 1\n\n/* Define to 1 if you have the <sys/ipc.h> header file. */\n#define _GLIBCXX_HAVE_SYS_IPC_H 1\n\n/* Define to 1 if you have the <sys/isa_defs.h> header file. */\n/* #undef _GLIBCXX_HAVE_SYS_ISA_DEFS_H */\n\n/* Define to 1 if you have the <sys/machine.h> header file. */\n/* #undef _GLIBCXX_HAVE_SYS_MACHINE_H */\n\n/* Define to 1 if you have the <sys/param.h> header file. */\n/* #undef _GLIBCXX_HAVE_SYS_PARAM_H */\n\n/* Define to 1 if you have the <sys/resource.h> header file. */\n#define _GLIBCXX_HAVE_SYS_RESOURCE_H 1\n\n/* Define to 1 if you have the <sys/sem.h> header file. */\n#define _GLIBCXX_HAVE_SYS_SEM_H 1\n\n/* Define to 1 if you have the <sys/stat.h> header file. */\n#define _GLIBCXX_HAVE_SYS_STAT_H 1\n\n/* Define to 1 if you have the <sys/time.h> header file. */\n#define _GLIBCXX_HAVE_SYS_TIME_H 1\n\n/* Define to 1 if you have the <sys/types.h> header file. */\n#define _GLIBCXX_HAVE_SYS_TYPES_H 1\n\n/* Define to 1 if you have the <sys/uio.h> header file. */\n#define _GLIBCXX_HAVE_SYS_UIO_H 1\n\n/* Define if S_IFREG is available in <sys/stat.h>. */\n/* #undef _GLIBCXX_HAVE_S_IFREG */\n\n/* Define if S_IFREG is available in <sys/stat.h>. */\n#define _GLIBCXX_HAVE_S_ISREG 1\n\n/* Define to 1 if you have the `tanf' function. */\n#define _GLIBCXX_HAVE_TANF 1\n\n/* Define to 1 if you have the `tanhf' function. */\n#define _GLIBCXX_HAVE_TANHF 1\n\n/* Define to 1 if you have the `tanhl' function. */\n/* #undef _GLIBCXX_HAVE_TANHL */\n\n/* Define to 1 if you have the `tanl' function. */\n/* #undef _GLIBCXX_HAVE_TANL */\n\n/* Define to 1 if the target supports thread-local storage. */\n#if !defined(__arm__) && !defined(__mips__)\n#define _GLIBCXX_HAVE_TLS 1\n#endif\n\n/* Define to 1 if you have the <unistd.h> header file. */\n#define _GLIBCXX_HAVE_UNISTD_H 1\n\n#if __ISO_C_VISIBLE >= 1999\n/* Defined if vfwscanf exists. */\n#define _GLIBCXX_HAVE_VFWSCANF 1\n\n/* Defined if vswscanf exists. */\n#define _GLIBCXX_HAVE_VSWSCANF 1\n\n/* Defined if vwscanf exists. */\n#define _GLIBCXX_HAVE_VWSCANF 1\n#endif /* __ISO_C_VISIBLE >= 1999 */\n\n/* Define to 1 if you have the <wchar.h> header file. */\n#define _GLIBCXX_HAVE_WCHAR_H 1\n\n#if __ISO_C_VISIBLE >= 1999\n/* Defined if wcstof exists. */\n#define _GLIBCXX_HAVE_WCSTOF 1\n#endif /* __ISO_C_VISIBLE >= 1999 */\n\n/* Define to 1 if you have the <wctype.h> header file. */\n#define _GLIBCXX_HAVE_WCTYPE_H 1\n\n/* Define if writev is available in <sys/uio.h>. */\n#define _GLIBCXX_HAVE_WRITEV 1\n\n/* Define to 1 if you have the `_acosf' function. */\n/* #undef _GLIBCXX_HAVE__ACOSF */\n\n/* Define to 1 if you have the `_acosl' function. */\n/* #undef _GLIBCXX_HAVE__ACOSL */\n\n/* Define to 1 if you have the `_asinf' function. */\n/* #undef _GLIBCXX_HAVE__ASINF */\n\n/* Define to 1 if you have the `_asinl' function. */\n/* #undef _GLIBCXX_HAVE__ASINL */\n\n/* Define to 1 if you have the `_atan2f' function. */\n/* #undef _GLIBCXX_HAVE__ATAN2F */\n\n/* Define to 1 if you have the `_atan2l' function. */\n/* #undef _GLIBCXX_HAVE__ATAN2L */\n\n/* Define to 1 if you have the `_atanf' function. */\n/* #undef _GLIBCXX_HAVE__ATANF */\n\n/* Define to 1 if you have the `_atanl' function. */\n/* #undef _GLIBCXX_HAVE__ATANL */\n\n/* Define to 1 if you have the `_ceilf' function. */\n/* #undef _GLIBCXX_HAVE__CEILF */\n\n/* Define to 1 if you have the `_ceill' function. */\n/* #undef _GLIBCXX_HAVE__CEILL */\n\n/* Define to 1 if you have the `_copysign' function. */\n/* #undef _GLIBCXX_HAVE__COPYSIGN */\n\n/* Define to 1 if you have the `_copysignl' function. */\n/* #undef _GLIBCXX_HAVE__COPYSIGNL */\n\n/* Define to 1 if you have the `_cosf' function. */\n/* #undef _GLIBCXX_HAVE__COSF */\n\n/* Define to 1 if you have the `_coshf' function. */\n/* #undef _GLIBCXX_HAVE__COSHF */\n\n/* Define to 1 if you have the `_coshl' function. */\n/* #undef _GLIBCXX_HAVE__COSHL */\n\n/* Define to 1 if you have the `_cosl' function. */\n/* #undef _GLIBCXX_HAVE__COSL */\n\n/* Define to 1 if you have the `_expf' function. */\n/* #undef _GLIBCXX_HAVE__EXPF */\n\n/* Define to 1 if you have the `_expl' function. */\n/* #undef _GLIBCXX_HAVE__EXPL */\n\n/* Define to 1 if you have the `_fabsf' function. */\n/* #undef _GLIBCXX_HAVE__FABSF */\n\n/* Define to 1 if you have the `_fabsl' function. */\n/* #undef _GLIBCXX_HAVE__FABSL */\n\n/* Define to 1 if you have the `_finite' function. */\n/* #undef _GLIBCXX_HAVE__FINITE */\n\n/* Define to 1 if you have the `_finitef' function. */\n/* #undef _GLIBCXX_HAVE__FINITEF */\n\n/* Define to 1 if you have the `_finitel' function. */\n/* #undef _GLIBCXX_HAVE__FINITEL */\n\n/* Define to 1 if you have the `_floorf' function. */\n/* #undef _GLIBCXX_HAVE__FLOORF */\n\n/* Define to 1 if you have the `_floorl' function. */\n/* #undef _GLIBCXX_HAVE__FLOORL */\n\n/* Define to 1 if you have the `_fmodf' function. */\n/* #undef _GLIBCXX_HAVE__FMODF */\n\n/* Define to 1 if you have the `_fmodl' function. */\n/* #undef _GLIBCXX_HAVE__FMODL */\n\n/* Define to 1 if you have the `_fpclass' function. */\n/* #undef _GLIBCXX_HAVE__FPCLASS */\n\n/* Define to 1 if you have the `_frexpf' function. */\n/* #undef _GLIBCXX_HAVE__FREXPF */\n\n/* Define to 1 if you have the `_frexpl' function. */\n/* #undef _GLIBCXX_HAVE__FREXPL */\n\n/* Define to 1 if you have the `_hypot' function. */\n/* #undef _GLIBCXX_HAVE__HYPOT */\n\n/* Define to 1 if you have the `_hypotf' function. */\n/* #undef _GLIBCXX_HAVE__HYPOTF */\n\n/* Define to 1 if you have the `_hypotl' function. */\n/* #undef _GLIBCXX_HAVE__HYPOTL */\n\n/* Define to 1 if you have the `_isinf' function. */\n/* #undef _GLIBCXX_HAVE__ISINF */\n\n/* Define to 1 if you have the `_isinff' function. */\n/* #undef _GLIBCXX_HAVE__ISINFF */\n\n/* Define to 1 if you have the `_isinfl' function. */\n/* #undef _GLIBCXX_HAVE__ISINFL */\n\n/* Define to 1 if you have the `_isnan' function. */\n/* #undef _GLIBCXX_HAVE__ISNAN */\n\n/* Define to 1 if you have the `_isnanf' function. */\n/* #undef _GLIBCXX_HAVE__ISNANF */\n\n/* Define to 1 if you have the `_isnanl' function. */\n/* #undef _GLIBCXX_HAVE__ISNANL */\n\n/* Define to 1 if you have the `_ldexpf' function. */\n/* #undef _GLIBCXX_HAVE__LDEXPF */\n\n/* Define to 1 if you have the `_ldexpl' function. */\n/* #undef _GLIBCXX_HAVE__LDEXPL */\n\n/* Define to 1 if you have the `_log10f' function. */\n/* #undef _GLIBCXX_HAVE__LOG10F */\n\n/* Define to 1 if you have the `_log10l' function. */\n/* #undef _GLIBCXX_HAVE__LOG10L */\n\n/* Define to 1 if you have the `_logf' function. */\n/* #undef _GLIBCXX_HAVE__LOGF */\n\n/* Define to 1 if you have the `_logl' function. */\n/* #undef _GLIBCXX_HAVE__LOGL */\n\n/* Define to 1 if you have the `_modf' function. */\n/* #undef _GLIBCXX_HAVE__MODF */\n\n/* Define to 1 if you have the `_modff' function. */\n/* #undef _GLIBCXX_HAVE__MODFF */\n\n/* Define to 1 if you have the `_modfl' function. */\n/* #undef _GLIBCXX_HAVE__MODFL */\n\n/* Define to 1 if you have the `_powf' function. */\n/* #undef _GLIBCXX_HAVE__POWF */\n\n/* Define to 1 if you have the `_powl' function. */\n/* #undef _GLIBCXX_HAVE__POWL */\n\n/* Define to 1 if you have the `_qfpclass' function. */\n/* #undef _GLIBCXX_HAVE__QFPCLASS */\n\n/* Define to 1 if you have the `_sincos' function. */\n/* #undef _GLIBCXX_HAVE__SINCOS */\n\n/* Define to 1 if you have the `_sincosf' function. */\n/* #undef _GLIBCXX_HAVE__SINCOSF */\n\n/* Define to 1 if you have the `_sincosl' function. */\n/* #undef _GLIBCXX_HAVE__SINCOSL */\n\n/* Define to 1 if you have the `_sinf' function. */\n/* #undef _GLIBCXX_HAVE__SINF */\n\n/* Define to 1 if you have the `_sinhf' function. */\n/* #undef _GLIBCXX_HAVE__SINHF */\n\n/* Define to 1 if you have the `_sinhl' function. */\n/* #undef _GLIBCXX_HAVE__SINHL */\n\n/* Define to 1 if you have the `_sinl' function. */\n/* #undef _GLIBCXX_HAVE__SINL */\n\n/* Define to 1 if you have the `_sqrtf' function. */\n/* #undef _GLIBCXX_HAVE__SQRTF */\n\n/* Define to 1 if you have the `_sqrtl' function. */\n/* #undef _GLIBCXX_HAVE__SQRTL */\n\n/* Define to 1 if you have the `_tanf' function. */\n/* #undef _GLIBCXX_HAVE__TANF */\n\n/* Define to 1 if you have the `_tanhf' function. */\n/* #undef _GLIBCXX_HAVE__TANHF */\n\n/* Define to 1 if you have the `_tanhl' function. */\n/* #undef _GLIBCXX_HAVE__TANHL */\n\n/* Define to 1 if you have the `_tanl' function. */\n/* #undef _GLIBCXX_HAVE__TANL */\n\n/* Define if the compiler/host combination has __builtin_abs. */\n#define _GLIBCXX_HAVE___BUILTIN_ABS 1\n\n/* Define if the compiler/host combination has __builtin_cos. */\n#define _GLIBCXX_HAVE___BUILTIN_COS 1\n\n/* Define if the compiler/host combination has __builtin_cosf. */\n#define _GLIBCXX_HAVE___BUILTIN_COSF 1\n\n/* Define if the compiler/host combination has __builtin_cosl. */\n#define _GLIBCXX_HAVE___BUILTIN_COSL 1\n\n/* Define if the compiler/host combination has __builtin_fabs. */\n#define _GLIBCXX_HAVE___BUILTIN_FABS 1\n\n/* Define if the compiler/host combination has __builtin_fabsf. */\n#define _GLIBCXX_HAVE___BUILTIN_FABSF 1\n\n/* Define if the compiler/host combination has __builtin_fabsl. */\n#define _GLIBCXX_HAVE___BUILTIN_FABSL 1\n\n/* Define if the compiler/host combination has __builtin_labs. */\n#define _GLIBCXX_HAVE___BUILTIN_LABS 1\n\n/* Define if the compiler/host combination has __builtin_sin. */\n#define _GLIBCXX_HAVE___BUILTIN_SIN 1\n\n/* Define if the compiler/host combination has __builtin_sinf. */\n#define _GLIBCXX_HAVE___BUILTIN_SINF 1\n\n/* Define if the compiler/host combination has __builtin_sinl. */\n#define _GLIBCXX_HAVE___BUILTIN_SINL 1\n\n/* Define if the compiler/host combination has __builtin_sqrt. */\n#define _GLIBCXX_HAVE___BUILTIN_SQRT 1\n\n/* Define if the compiler/host combination has __builtin_sqrtf. */\n#define _GLIBCXX_HAVE___BUILTIN_SQRTF 1\n\n/* Define if the compiler/host combination has __builtin_sqrtl. */\n#define _GLIBCXX_HAVE___BUILTIN_SQRTL 1\n\n/* Define to 1 if you have the `__signbit' function. */\n#define _GLIBCXX_HAVE___SIGNBIT 1\n\n/* Define to 1 if you have the `__signbitf' function. */\n#define _GLIBCXX_HAVE___SIGNBITF 1\n\n/* Define to 1 if you have the `__signbitl' function. */\n#define _GLIBCXX_HAVE___SIGNBITL 1\n\n/* Name of package */\n/* #undef _GLIBCXX_PACKAGE */\n\n/* Define to the address where bug reports for this package should be sent. */\n#define _GLIBCXX_PACKAGE_BUGREPORT \"\"\n\n/* Define to the full name of this package. */\n#define _GLIBCXX_PACKAGE_NAME \"package-unused\"\n\n/* Define to the full name and version of this package. */\n#define _GLIBCXX_PACKAGE_STRING \"package-unused version-unused\"\n\n/* Define to the one symbol short name of this package. */\n#define _GLIBCXX_PACKAGE_TARNAME \"libstdc++\"\n\n/* Define to the version of this package. */\n#define _GLIBCXX_PACKAGE__GLIBCXX_VERSION \"version-unused\"\n\n/* Define to 1 if you have the ANSI C header files. */\n#define STDC_HEADERS 1\n\n/* Version number of package */\n/* #undef _GLIBCXX_VERSION */\n\n/* Define if builtin atomic operations are supported on this host. */\n#if defined(__amd64__) || defined(__i386__)\n#define _GLIBCXX_ATOMIC_BUILTINS 1\n#endif\n\n/* Define to use concept checking code from the boost libraries. */\n/* #undef _GLIBCXX_CONCEPT_CHECKS */\n\n/* Define if a fully dynamic basic_string is wanted. */\n/* #undef _GLIBCXX_FULLY_DYNAMIC_STRING */\n\n/* Define to 1 if a full hosted library is built, or 0 if freestanding. */\n#define _GLIBCXX_HOSTED 1\n\n/* Define if compatibility should be provided for -mlong-double-64. */\n/* #undef _GLIBCXX_LONG_DOUBLE_COMPAT */\n\n/* Define if ptrdiff_t is int. */\n#if !defined(__LP64__)\n#define _GLIBCXX_PTRDIFF_T_IS_INT 1\n#endif\n\n/* Define if using setrlimit to set resource limits during \"make check\" */\n#define _GLIBCXX_RES_LIMITS 1\n\n/* Define if size_t is unsigned int. */\n#if !defined(__LP64__)\n#define _GLIBCXX_SIZE_T_IS_UINT 1\n#endif\n\n/* Define if the compiler is configured for setjmp/longjmp exceptions. */\n/* #undef _GLIBCXX_SJLJ_EXCEPTIONS */\n\n/* Define to use symbol versioning in the shared library. */\n#define _GLIBCXX_SYMVER 1\n\n/* Define to use darwin versioning in the shared library. */\n/* #undef _GLIBCXX_SYMVER_DARWIN */\n\n/* Define to use GNU versioning in the shared library. */\n#define _GLIBCXX_SYMVER_GNU 1\n\n/* Define to use GNU namespace versioning in the shared library. */\n/* #undef _GLIBCXX_SYMVER_GNU_NAMESPACE */\n\n/* Define if C99 functions or macros from <wchar.h>, <math.h>, <complex.h>,\n   <stdio.h>, and <stdlib.h> can be used or exposed. */\n/* #undef _GLIBCXX_USE_C99 */\n\n/* Define if C99 functions in <complex.h> should be used in <complex>. Using\n   compiler builtins for these functions requires corresponding C99 library\n   functions to be present. */\n/* #undef _GLIBCXX_USE_C99_COMPLEX */\n\n/* Define if C99 functions in <complex.h> should be used in <tr1/complex>.\n   Using compiler builtins for these functions requires corresponding C99\n   library functions to be present. */\n/* #undef _GLIBCXX_USE_C99_COMPLEX_TR1 */\n\n/* Define if C99 functions in <ctype.h> should be imported in <tr1/cctype> in\n   namespace std::tr1. */\n#define _GLIBCXX_USE_C99_CTYPE_TR1 1\n\n/* Define if C99 functions in <fenv.h> should be imported in <tr1/cfenv> in\n   namespace std::tr1. */\n#define _GLIBCXX_USE_C99_FENV_TR1 1\n\n/* Define if C99 functions in <inttypes.h> should be imported in\n   <tr1/cinttypes> in namespace std::tr1. */\n#define _GLIBCXX_USE_C99_INTTYPES_TR1 1\n\n/* Define if C99 functions or macros in <math.h> should be imported in <cmath>\n   in namespace std. */\n#define _GLIBCXX_USE_C99_MATH 1\n\n/* Define if C99 functions or macros in <math.h> should be imported in\n   <tr1/cmath> in namespace std::tr1. */\n/* #undef _GLIBCXX_USE_C99_MATH_TR1 */\n\n/* Define if C99 types in <stdint.h> should be imported in <tr1/cstdint> in\n   namespace std::tr1. */\n#define _GLIBCXX_USE_C99_STDINT_TR1 1\n\n/* Define if iconv and related functions exist and are usable. */\n#define _GLIBCXX_USE_ICONV 1\n\n/* Define if LFS support is available. */\n/* #undef _GLIBCXX_USE_LFS */\n\n/* Define if code specialized for long long should be used. */\n#define _GLIBCXX_USE_LONG_LONG 1\n\n/* Define if NLS translations are to be used. */\n/* #undef _GLIBCXX_USE_NLS */\n\n/* Define if dev/random and dev/urandom are available for the random_device of\n   TR1 (Chapter 5.1). */\n#define _GLIBCXX_USE_RANDOM_TR1 1\n\n/* Define if code specialized for wchar_t should be used. */\n#define _GLIBCXX_USE_WCHAR_T 1\n\n#if defined (_GLIBCXX_HAVE__ACOSF) && ! defined (_GLIBCXX_HAVE_ACOSF)\n# define _GLIBCXX_HAVE_ACOSF 1\n# define acosf _acosf\n#endif\n\n#if defined (_GLIBCXX_HAVE__ACOSL) && ! defined (_GLIBCXX_HAVE_ACOSL)\n# define _GLIBCXX_HAVE_ACOSL 1\n# define acosl _acosl\n#endif\n\n#if defined (_GLIBCXX_HAVE__ASINF) && ! defined (_GLIBCXX_HAVE_ASINF)\n# define _GLIBCXX_HAVE_ASINF 1\n# define asinf _asinf\n#endif\n\n#if defined (_GLIBCXX_HAVE__ASINL) && ! defined (_GLIBCXX_HAVE_ASINL)\n# define _GLIBCXX_HAVE_ASINL 1\n# define asinl _asinl\n#endif\n\n#if defined (_GLIBCXX_HAVE__ATAN2F) && ! defined (_GLIBCXX_HAVE_ATAN2F)\n# define _GLIBCXX_HAVE_ATAN2F 1\n# define atan2f _atan2f\n#endif\n\n#if defined (_GLIBCXX_HAVE__ATAN2L) && ! defined (_GLIBCXX_HAVE_ATAN2L)\n# define _GLIBCXX_HAVE_ATAN2L 1\n# define atan2l _atan2l\n#endif\n\n#if defined (_GLIBCXX_HAVE__ATANF) && ! defined (_GLIBCXX_HAVE_ATANF)\n# define _GLIBCXX_HAVE_ATANF 1\n# define atanf _atanf\n#endif\n\n#if defined (_GLIBCXX_HAVE__ATANL) && ! defined (_GLIBCXX_HAVE_ATANL)\n# define _GLIBCXX_HAVE_ATANL 1\n# define atanl _atanl\n#endif\n\n#if defined (_GLIBCXX_HAVE__CEILF) && ! defined (_GLIBCXX_HAVE_CEILF)\n# define _GLIBCXX_HAVE_CEILF 1\n# define ceilf _ceilf\n#endif\n\n#if defined (_GLIBCXX_HAVE__CEILL) && ! defined (_GLIBCXX_HAVE_CEILL)\n# define _GLIBCXX_HAVE_CEILL 1\n# define ceill _ceill\n#endif\n\n#if defined (_GLIBCXX_HAVE__COPYSIGN) && ! defined (_GLIBCXX_HAVE_COPYSIGN)\n# define _GLIBCXX_HAVE_COPYSIGN 1\n# define copysign _copysign\n#endif\n\n#if defined (_GLIBCXX_HAVE__COPYSIGNL) && ! defined (_GLIBCXX_HAVE_COPYSIGNL)\n# define _GLIBCXX_HAVE_COPYSIGNL 1\n# define copysignl _copysignl\n#endif\n\n#if defined (_GLIBCXX_HAVE__COSF) && ! defined (_GLIBCXX_HAVE_COSF)\n# define _GLIBCXX_HAVE_COSF 1\n# define cosf _cosf\n#endif\n\n#if defined (_GLIBCXX_HAVE__COSHF) && ! defined (_GLIBCXX_HAVE_COSHF)\n# define _GLIBCXX_HAVE_COSHF 1\n# define coshf _coshf\n#endif\n\n#if defined (_GLIBCXX_HAVE__COSHL) && ! defined (_GLIBCXX_HAVE_COSHL)\n# define _GLIBCXX_HAVE_COSHL 1\n# define coshl _coshl\n#endif\n\n#if defined (_GLIBCXX_HAVE__COSL) && ! defined (_GLIBCXX_HAVE_COSL)\n# define _GLIBCXX_HAVE_COSL 1\n# define cosl _cosl\n#endif\n\n#if defined (_GLIBCXX_HAVE__EXPF) && ! defined (_GLIBCXX_HAVE_EXPF)\n# define _GLIBCXX_HAVE_EXPF 1\n# define expf _expf\n#endif\n\n#if defined (_GLIBCXX_HAVE__EXPL) && ! defined (_GLIBCXX_HAVE_EXPL)\n# define _GLIBCXX_HAVE_EXPL 1\n# define expl _expl\n#endif\n\n#if defined (_GLIBCXX_HAVE__FABSF) && ! defined (_GLIBCXX_HAVE_FABSF)\n# define _GLIBCXX_HAVE_FABSF 1\n# define fabsf _fabsf\n#endif\n\n#if defined (_GLIBCXX_HAVE__FABSL) && ! defined (_GLIBCXX_HAVE_FABSL)\n# define _GLIBCXX_HAVE_FABSL 1\n# define fabsl _fabsl\n#endif\n\n#if defined (_GLIBCXX_HAVE__FINITE) && ! defined (_GLIBCXX_HAVE_FINITE)\n# define _GLIBCXX_HAVE_FINITE 1\n# define finite _finite\n#endif\n\n#if defined (_GLIBCXX_HAVE__FINITEF) && ! defined (_GLIBCXX_HAVE_FINITEF)\n# define _GLIBCXX_HAVE_FINITEF 1\n# define finitef _finitef\n#endif\n\n#if defined (_GLIBCXX_HAVE__FINITEL) && ! defined (_GLIBCXX_HAVE_FINITEL)\n# define _GLIBCXX_HAVE_FINITEL 1\n# define finitel _finitel\n#endif\n\n#if defined (_GLIBCXX_HAVE__FLOORF) && ! defined (_GLIBCXX_HAVE_FLOORF)\n# define _GLIBCXX_HAVE_FLOORF 1\n# define floorf _floorf\n#endif\n\n#if defined (_GLIBCXX_HAVE__FLOORL) && ! defined (_GLIBCXX_HAVE_FLOORL)\n# define _GLIBCXX_HAVE_FLOORL 1\n# define floorl _floorl\n#endif\n\n#if defined (_GLIBCXX_HAVE__FMODF) && ! defined (_GLIBCXX_HAVE_FMODF)\n# define _GLIBCXX_HAVE_FMODF 1\n# define fmodf _fmodf\n#endif\n\n#if defined (_GLIBCXX_HAVE__FMODL) && ! defined (_GLIBCXX_HAVE_FMODL)\n# define _GLIBCXX_HAVE_FMODL 1\n# define fmodl _fmodl\n#endif\n\n#if defined (_GLIBCXX_HAVE__FPCLASS) && ! defined (_GLIBCXX_HAVE_FPCLASS)\n# define _GLIBCXX_HAVE_FPCLASS 1\n# define fpclass _fpclass\n#endif\n\n#if defined (_GLIBCXX_HAVE__FREXPF) && ! defined (_GLIBCXX_HAVE_FREXPF)\n# define _GLIBCXX_HAVE_FREXPF 1\n# define frexpf _frexpf\n#endif\n\n#if defined (_GLIBCXX_HAVE__FREXPL) && ! defined (_GLIBCXX_HAVE_FREXPL)\n# define _GLIBCXX_HAVE_FREXPL 1\n# define frexpl _frexpl\n#endif\n\n#if defined (_GLIBCXX_HAVE__HYPOT) && ! defined (_GLIBCXX_HAVE_HYPOT)\n# define _GLIBCXX_HAVE_HYPOT 1\n# define hypot _hypot\n#endif\n\n#if defined (_GLIBCXX_HAVE__HYPOTF) && ! defined (_GLIBCXX_HAVE_HYPOTF)\n# define _GLIBCXX_HAVE_HYPOTF 1\n# define hypotf _hypotf\n#endif\n\n#if defined (_GLIBCXX_HAVE__HYPOTL) && ! defined (_GLIBCXX_HAVE_HYPOTL)\n# define _GLIBCXX_HAVE_HYPOTL 1\n# define hypotl _hypotl\n#endif\n\n#if defined (_GLIBCXX_HAVE__ISINF) && ! defined (_GLIBCXX_HAVE_ISINF)\n# define _GLIBCXX_HAVE_ISINF 1\n# define isinf _isinf\n#endif\n\n#if defined (_GLIBCXX_HAVE__ISINFF) && ! defined (_GLIBCXX_HAVE_ISINFF)\n# define _GLIBCXX_HAVE_ISINFF 1\n# define isinff _isinff\n#endif\n\n#if defined (_GLIBCXX_HAVE__ISINFL) && ! defined (_GLIBCXX_HAVE_ISINFL)\n# define _GLIBCXX_HAVE_ISINFL 1\n# define isinfl _isinfl\n#endif\n\n#if defined (_GLIBCXX_HAVE__ISNAN) && ! defined (_GLIBCXX_HAVE_ISNAN)\n# define _GLIBCXX_HAVE_ISNAN 1\n# define isnan _isnan\n#endif\n\n#if defined (_GLIBCXX_HAVE__ISNANF) && ! defined (_GLIBCXX_HAVE_ISNANF)\n# define _GLIBCXX_HAVE_ISNANF 1\n# define isnanf _isnanf\n#endif\n\n#if defined (_GLIBCXX_HAVE__ISNANL) && ! defined (_GLIBCXX_HAVE_ISNANL)\n# define _GLIBCXX_HAVE_ISNANL 1\n# define isnanl _isnanl\n#endif\n\n#if defined (_GLIBCXX_HAVE__LDEXPF) && ! defined (_GLIBCXX_HAVE_LDEXPF)\n# define _GLIBCXX_HAVE_LDEXPF 1\n# define ldexpf _ldexpf\n#endif\n\n#if defined (_GLIBCXX_HAVE__LDEXPL) && ! defined (_GLIBCXX_HAVE_LDEXPL)\n# define _GLIBCXX_HAVE_LDEXPL 1\n# define ldexpl _ldexpl\n#endif\n\n#if defined (_GLIBCXX_HAVE__LOG10F) && ! defined (_GLIBCXX_HAVE_LOG10F)\n# define _GLIBCXX_HAVE_LOG10F 1\n# define log10f _log10f\n#endif\n\n#if defined (_GLIBCXX_HAVE__LOG10L) && ! defined (_GLIBCXX_HAVE_LOG10L)\n# define _GLIBCXX_HAVE_LOG10L 1\n# define log10l _log10l\n#endif\n\n#if defined (_GLIBCXX_HAVE__LOGF) && ! defined (_GLIBCXX_HAVE_LOGF)\n# define _GLIBCXX_HAVE_LOGF 1\n# define logf _logf\n#endif\n\n#if defined (_GLIBCXX_HAVE__LOGL) && ! defined (_GLIBCXX_HAVE_LOGL)\n# define _GLIBCXX_HAVE_LOGL 1\n# define logl _logl\n#endif\n\n#if defined (_GLIBCXX_HAVE__MODF) && ! defined (_GLIBCXX_HAVE_MODF)\n# define _GLIBCXX_HAVE_MODF 1\n# define modf _modf\n#endif\n\n#if defined (_GLIBCXX_HAVE__MODFF) && ! defined (_GLIBCXX_HAVE_MODFF)\n# define _GLIBCXX_HAVE_MODFF 1\n# define modff _modff\n#endif\n\n#if defined (_GLIBCXX_HAVE__MODFL) && ! defined (_GLIBCXX_HAVE_MODFL)\n# define _GLIBCXX_HAVE_MODFL 1\n# define modfl _modfl\n#endif\n\n#if defined (_GLIBCXX_HAVE__POWF) && ! defined (_GLIBCXX_HAVE_POWF)\n# define _GLIBCXX_HAVE_POWF 1\n# define powf _powf\n#endif\n\n#if defined (_GLIBCXX_HAVE__POWL) && ! defined (_GLIBCXX_HAVE_POWL)\n# define _GLIBCXX_HAVE_POWL 1\n# define powl _powl\n#endif\n\n#if defined (_GLIBCXX_HAVE__QFPCLASS) && ! defined (_GLIBCXX_HAVE_QFPCLASS)\n# define _GLIBCXX_HAVE_QFPCLASS 1\n# define qfpclass _qfpclass\n#endif\n\n#if defined (_GLIBCXX_HAVE__SINCOS) && ! defined (_GLIBCXX_HAVE_SINCOS)\n# define _GLIBCXX_HAVE_SINCOS 1\n# define sincos _sincos\n#endif\n\n#if defined (_GLIBCXX_HAVE__SINCOSF) && ! defined (_GLIBCXX_HAVE_SINCOSF)\n# define _GLIBCXX_HAVE_SINCOSF 1\n# define sincosf _sincosf\n#endif\n\n#if defined (_GLIBCXX_HAVE__SINCOSL) && ! defined (_GLIBCXX_HAVE_SINCOSL)\n# define _GLIBCXX_HAVE_SINCOSL 1\n# define sincosl _sincosl\n#endif\n\n#if defined (_GLIBCXX_HAVE__SINF) && ! defined (_GLIBCXX_HAVE_SINF)\n# define _GLIBCXX_HAVE_SINF 1\n# define sinf _sinf\n#endif\n\n#if defined (_GLIBCXX_HAVE__SINHF) && ! defined (_GLIBCXX_HAVE_SINHF)\n# define _GLIBCXX_HAVE_SINHF 1\n# define sinhf _sinhf\n#endif\n\n#if defined (_GLIBCXX_HAVE__SINHL) && ! defined (_GLIBCXX_HAVE_SINHL)\n# define _GLIBCXX_HAVE_SINHL 1\n# define sinhl _sinhl\n#endif\n\n#if defined (_GLIBCXX_HAVE__SINL) && ! defined (_GLIBCXX_HAVE_SINL)\n# define _GLIBCXX_HAVE_SINL 1\n# define sinl _sinl\n#endif\n\n#if defined (_GLIBCXX_HAVE__SQRTF) && ! defined (_GLIBCXX_HAVE_SQRTF)\n# define _GLIBCXX_HAVE_SQRTF 1\n# define sqrtf _sqrtf\n#endif\n\n#if defined (_GLIBCXX_HAVE__SQRTL) && ! defined (_GLIBCXX_HAVE_SQRTL)\n# define _GLIBCXX_HAVE_SQRTL 1\n# define sqrtl _sqrtl\n#endif\n\n#if defined (_GLIBCXX_HAVE__STRTOF) && ! defined (_GLIBCXX_HAVE_STRTOF)\n# define _GLIBCXX_HAVE_STRTOF 1\n# define strtof _strtof\n#endif\n\n#if defined (_GLIBCXX_HAVE__STRTOLD) && ! defined (_GLIBCXX_HAVE_STRTOLD)\n# define _GLIBCXX_HAVE_STRTOLD 1\n# define strtold _strtold\n#endif\n\n#if defined (_GLIBCXX_HAVE__TANF) && ! defined (_GLIBCXX_HAVE_TANF)\n# define _GLIBCXX_HAVE_TANF 1\n# define tanf _tanf\n#endif\n\n#if defined (_GLIBCXX_HAVE__TANHF) && ! defined (_GLIBCXX_HAVE_TANHF)\n# define _GLIBCXX_HAVE_TANHF 1\n# define tanhf _tanhf\n#endif\n\n#if defined (_GLIBCXX_HAVE__TANHL) && ! defined (_GLIBCXX_HAVE_TANHL)\n# define _GLIBCXX_HAVE_TANHL 1\n# define tanhl _tanhl\n#endif\n\n#if defined (_GLIBCXX_HAVE__TANL) && ! defined (_GLIBCXX_HAVE_TANL)\n# define _GLIBCXX_HAVE_TANL 1\n# define tanl _tanl\n#endif\n#endif // _CXXCONFIG_\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/bits/c++io.h",
    "content": "// Underlying io library details -*- C++ -*-\n\n// Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006\n// Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n/** @file c++io.h\n *  This is an internal header file, included by other library headers.\n *  You should not attempt to use it directly.\n */\n\n// c_io_stdio.h - Defines for using \"C\" stdio.h\n\n#ifndef _C_IO_STDIO_H\n#define _C_IO_STDIO_H 1\n\n#include <cstdio>\n#include <cstddef>\n#include <bits/gthr.h>\n\n_GLIBCXX_BEGIN_NAMESPACE(std)\n\n  typedef __gthread_mutex_t __c_lock;\n\n  // for basic_file.h\n  typedef FILE __c_file;\n\n_GLIBCXX_END_NAMESPACE\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/bits/c++locale.h",
    "content": "// Wrapper for underlying C-language localization -*- C++ -*-\n\n// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006\n// Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n/** @file c++locale.h\n *  This is an internal header file, included by other library headers.\n *  You should not attempt to use it directly.\n */\n\n//\n// ISO C++ 14882: 22.8  Standard locale categories.\n//\n\n// Written by Benjamin Kosnik <bkoz@redhat.com>\n\n#ifndef _C_LOCALE_H\n#define _C_LOCALE_H 1\n\n#pragma GCC system_header\n\n#include <clocale>\n#include <cstring>   // get std::strlen\n#include <cstdio>    // get std::vsnprintf or std::vsprintf\n#include <cstdarg>\n\n#define _GLIBCXX_NUM_CATEGORIES 0\n\n_GLIBCXX_BEGIN_NAMESPACE(std)\n\n  typedef int*\t\t\t__c_locale;\n\n  // Convert numeric value of type double and long double to string and\n  // return length of string.  If vsnprintf is available use it, otherwise\n  // fall back to the unsafe vsprintf which, in general, can be dangerous\n  // and should be avoided.\n  inline int\n  __convert_from_v(const __c_locale&, char* __out, \n\t\t   const int __size __attribute__((__unused__)),\n\t\t   const char* __fmt, ...)\n  {\n    char* __old = std::setlocale(LC_NUMERIC, NULL);\n    char* __sav = NULL;\n    if (std::strcmp(__old, \"C\"))\n      {\n\t__sav = new char[std::strlen(__old) + 1];\n\tstd::strcpy(__sav, __old);\n\tstd::setlocale(LC_NUMERIC, \"C\");\n      }\n\n    va_list __args;\n    va_start(__args, __fmt);\n\n#ifdef _GLIBCXX_USE_C99\n    const int __ret = std::vsnprintf(__out, __size, __fmt, __args);\n#else\n    const int __ret = std::vsprintf(__out, __fmt, __args);\n#endif\n\n    va_end(__args);\n      \n    if (__sav)\n      {\n\tstd::setlocale(LC_NUMERIC, __sav);\n\tdelete [] __sav;\n      }\n    return __ret;\n  }\n\n_GLIBCXX_END_NAMESPACE\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/bits/c++locale_internal.h",
    "content": "// Locale internal implementation header -*- C++ -*-\n\n// Copyright (C) 2002 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n// The generic locale code doesn't need to do anything here (yet)\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/bits/char_traits.h",
    "content": "// Character Traits for use by standard string and iostream -*- C++ -*-\n\n// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005\n// Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n/** @file char_traits.h\n *  This is an internal header file, included by other library headers.\n *  You should not attempt to use it directly.\n */\n\n//\n// ISO C++ 14882: 21  Strings library\n//\n\n#ifndef _CHAR_TRAITS_H\n#define _CHAR_TRAITS_H 1\n\n#pragma GCC system_header\n\n#include <cstring>            // For memmove, memset, memchr\n#include <bits/stl_algobase.h>// For copy, lexicographical_compare, fill_n\n#include <bits/postypes.h>    // For streampos\n\n_GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)\n\n  /**\n   *  @brief  Mapping from character type to associated types.\n   *\n   *  @note This is an implementation class for the generic version\n   *  of char_traits.  It defines int_type, off_type, pos_type, and\n   *  state_type.  By default these are unsigned long, streamoff,\n   *  streampos, and mbstate_t.  Users who need a different set of\n   *  types, but who don't need to change the definitions of any function\n   *  defined in char_traits, can specialize __gnu_cxx::_Char_types\n   *  while leaving __gnu_cxx::char_traits alone. */\n  template <class _CharT>\n    struct _Char_types\n    {\n      typedef unsigned long   int_type;\n      typedef std::streampos  pos_type;\n      typedef std::streamoff  off_type;\n      typedef std::mbstate_t  state_type;\n    };\n\n\n  /**\n   *  @brief  Base class used to implement std::char_traits.\n   *\n   *  @note For any given actual character type, this definition is\n   *  probably wrong.  (Most of the member functions are likely to be\n   *  right, but the int_type and state_type typedefs, and the eof()\n   *  member function, are likely to be wrong.)  The reason this class\n   *  exists is so users can specialize it.  Classes in namespace std\n   *  may not be specialized for fundamentl types, but classes in\n   *  namespace __gnu_cxx may be.\n   *\n   *  See http://gcc.gnu.org/onlinedocs/libstdc++/21_strings/howto.html#5\n   *  for advice on how to make use of this class for \"unusual\" character\n   *  types. Also, check out include/ext/pod_char_traits.h.  \n   */\n  template<typename _CharT>\n    struct char_traits\n    {\n      typedef _CharT                                    char_type;\n      typedef typename _Char_types<_CharT>::int_type    int_type;\n      typedef typename _Char_types<_CharT>::pos_type    pos_type;\n      typedef typename _Char_types<_CharT>::off_type    off_type;\n      typedef typename _Char_types<_CharT>::state_type  state_type;\n\n      static void\n      assign(char_type& __c1, const char_type& __c2)\n      { __c1 = __c2; }\n\n      static bool\n      eq(const char_type& __c1, const char_type& __c2)\n      { return __c1 == __c2; }\n\n      static bool\n      lt(const char_type& __c1, const char_type& __c2)\n      { return __c1 < __c2; }\n\n      static int\n      compare(const char_type* __s1, const char_type* __s2, std::size_t __n);\n\n      static std::size_t\n      length(const char_type* __s);\n\n      static const char_type*\n      find(const char_type* __s, std::size_t __n, const char_type& __a);\n\n      static char_type*\n      move(char_type* __s1, const char_type* __s2, std::size_t __n);\n\n      static char_type*\n      copy(char_type* __s1, const char_type* __s2, std::size_t __n);\n\n      static char_type*\n      assign(char_type* __s, std::size_t __n, char_type __a);\n\n      static char_type\n      to_char_type(const int_type& __c)\n      { return static_cast<char_type>(__c); }\n\n      static int_type\n      to_int_type(const char_type& __c)\n      { return static_cast<int_type>(__c); }\n\n      static bool\n      eq_int_type(const int_type& __c1, const int_type& __c2)\n      { return __c1 == __c2; }\n\n      static int_type\n      eof()\n      { return static_cast<int_type>(EOF); }\n\n      static int_type\n      not_eof(const int_type& __c)\n      { return !eq_int_type(__c, eof()) ? __c : to_int_type(char_type()); }\n    };\n\n  template<typename _CharT>\n    int\n    char_traits<_CharT>::\n    compare(const char_type* __s1, const char_type* __s2, std::size_t __n)\n    {\n      for (std::size_t __i = 0; __i < __n; ++__i)\n\tif (lt(__s1[__i], __s2[__i]))\n\t  return -1;\n\telse if (lt(__s2[__i], __s1[__i]))\n\t  return 1;\n      return 0;\n    }\n\n  template<typename _CharT>\n    std::size_t\n    char_traits<_CharT>::\n    length(const char_type* __p)\n    {\n      std::size_t __i = 0;\n      while (!eq(__p[__i], char_type()))\n        ++__i;\n      return __i;\n    }\n\n  template<typename _CharT>\n    const typename char_traits<_CharT>::char_type*\n    char_traits<_CharT>::\n    find(const char_type* __s, std::size_t __n, const char_type& __a)\n    {\n      for (std::size_t __i = 0; __i < __n; ++__i)\n        if (eq(__s[__i], __a))\n          return __s + __i;\n      return 0;\n    }\n\n  template<typename _CharT>\n    typename char_traits<_CharT>::char_type*\n    char_traits<_CharT>::\n    move(char_type* __s1, const char_type* __s2, std::size_t __n)\n    {\n      return static_cast<_CharT*>(std::memmove(__s1, __s2,\n\t\t\t\t\t       __n * sizeof(char_type)));\n    }\n\n  template<typename _CharT>\n    typename char_traits<_CharT>::char_type*\n    char_traits<_CharT>::\n    copy(char_type* __s1, const char_type* __s2, std::size_t __n)\n    {\n      std::copy(__s2, __s2 + __n, __s1);\n      return __s1;\n    }\n\n  template<typename _CharT>\n    typename char_traits<_CharT>::char_type*\n    char_traits<_CharT>::\n    assign(char_type* __s, std::size_t __n, char_type __a)\n    {\n      std::fill_n(__s, __n, __a);\n      return __s;\n    }\n\n_GLIBCXX_END_NAMESPACE\n\n_GLIBCXX_BEGIN_NAMESPACE(std)\n\n  // 21.1\n  /**\n   *  @brief  Basis for explicit traits specializations.\n   *\n   *  @note  For any given actual character type, this definition is\n   *  probably wrong.  Since this is just a thin wrapper around\n   *  __gnu_cxx::char_traits, it is possible to achieve a more\n   *  appropriate definition by specializing __gnu_cxx::char_traits.\n   *\n   *  See http://gcc.gnu.org/onlinedocs/libstdc++/21_strings/howto.html#5\n   *  for advice on how to make use of this class for \"unusual\" character\n   *  types. Also, check out include/ext/pod_char_traits.h.\n  */\n  template<class _CharT>\n    struct char_traits : public __gnu_cxx::char_traits<_CharT>\n    { };\n\n\n  /// @brief  21.1.3.1  char_traits specializations\n  template<>\n    struct char_traits<char>\n    {\n      typedef char              char_type;\n      typedef int               int_type;\n      typedef streampos         pos_type;\n      typedef streamoff         off_type;\n      typedef mbstate_t         state_type;\n\n      static void\n      assign(char_type& __c1, const char_type& __c2)\n      { __c1 = __c2; }\n\n      static bool\n      eq(const char_type& __c1, const char_type& __c2)\n      { return __c1 == __c2; }\n\n      static bool\n      lt(const char_type& __c1, const char_type& __c2)\n      { return __c1 < __c2; }\n\n      static int\n      compare(const char_type* __s1, const char_type* __s2, size_t __n)\n      { return memcmp(__s1, __s2, __n); }\n\n      static size_t\n      length(const char_type* __s)\n      { return strlen(__s); }\n\n      static const char_type*\n      find(const char_type* __s, size_t __n, const char_type& __a)\n      { return static_cast<const char_type*>(memchr(__s, __a, __n)); }\n\n      static char_type*\n      move(char_type* __s1, const char_type* __s2, size_t __n)\n      { return static_cast<char_type*>(memmove(__s1, __s2, __n)); }\n\n      static char_type*\n      copy(char_type* __s1, const char_type* __s2, size_t __n)\n      { return static_cast<char_type*>(memcpy(__s1, __s2, __n)); }\n\n      static char_type*\n      assign(char_type* __s, size_t __n, char_type __a)\n      { return static_cast<char_type*>(memset(__s, __a, __n)); }\n\n      static char_type\n      to_char_type(const int_type& __c)\n      { return static_cast<char_type>(__c); }\n\n      // To keep both the byte 0xff and the eof symbol 0xffffffff\n      // from ending up as 0xffffffff.\n      static int_type\n      to_int_type(const char_type& __c)\n      { return static_cast<int_type>(static_cast<unsigned char>(__c)); }\n\n      static bool\n      eq_int_type(const int_type& __c1, const int_type& __c2)\n      { return __c1 == __c2; }\n\n      static int_type\n      eof() { return static_cast<int_type>(EOF); }\n\n      static int_type\n      not_eof(const int_type& __c)\n      { return (__c == eof()) ? 0 : __c; }\n  };\n\n\n#ifdef _GLIBCXX_USE_WCHAR_T\n  /// @brief  21.1.3.2  char_traits specializations\n  template<>\n    struct char_traits<wchar_t>\n    {\n      typedef wchar_t           char_type;\n      typedef wint_t            int_type;\n      typedef streamoff         off_type;\n      typedef wstreampos        pos_type;\n      typedef mbstate_t         state_type;\n\n      static void\n      assign(char_type& __c1, const char_type& __c2)\n      { __c1 = __c2; }\n\n      static bool\n      eq(const char_type& __c1, const char_type& __c2)\n      { return __c1 == __c2; }\n\n      static bool\n      lt(const char_type& __c1, const char_type& __c2)\n      { return __c1 < __c2; }\n\n      static int\n      compare(const char_type* __s1, const char_type* __s2, size_t __n)\n      { return wmemcmp(__s1, __s2, __n); }\n\n      static size_t\n      length(const char_type* __s)\n      { return wcslen(__s); }\n\n      static const char_type*\n      find(const char_type* __s, size_t __n, const char_type& __a)\n      { return wmemchr(__s, __a, __n); }\n\n      static char_type*\n      move(char_type* __s1, const char_type* __s2, size_t __n)\n      { return wmemmove(__s1, __s2, __n); }\n\n      static char_type*\n      copy(char_type* __s1, const char_type* __s2, size_t __n)\n      { return wmemcpy(__s1, __s2, __n); }\n\n      static char_type*\n      assign(char_type* __s, size_t __n, char_type __a)\n      { return wmemset(__s, __a, __n); }\n\n      static char_type\n      to_char_type(const int_type& __c) { return char_type(__c); }\n\n      static int_type\n      to_int_type(const char_type& __c) { return int_type(__c); }\n\n      static bool\n      eq_int_type(const int_type& __c1, const int_type& __c2)\n      { return __c1 == __c2; }\n\n      static int_type\n      eof() { return static_cast<int_type>(WEOF); }\n\n      static int_type\n      not_eof(const int_type& __c)\n      { return eq_int_type(__c, eof()) ? 0 : __c; }\n  };\n#endif //_GLIBCXX_USE_WCHAR_T\n\n_GLIBCXX_END_NAMESPACE\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/bits/cmath.tcc",
    "content": "// -*- C++ -*- C math library.\n\n// Copyright (C) 2000, 2003, 2004, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n// This file was written by Gabriel Dos Reis <gdr@codesourcery.com>\n\n/** @file cmath.tcc\n *  This is a Standard C++ Library file.\n */\n\n#ifndef _GLIBCXX_CMATH_TCC\n#define _GLIBCXX_CMATH_TCC 1\n\n_GLIBCXX_BEGIN_NAMESPACE(std)\n\n  template<typename _Tp>\n    inline _Tp\n    __cmath_power(_Tp __x, unsigned int __n)\n    {\n      _Tp __y = __n % 2 ? __x : 1;\n\n      while (__n >>= 1)\n        {\n          __x = __x * __x;\n          if (__n % 2)\n            __y = __y * __x;\n        }\n\n      return __y;\n    }\n\n_GLIBCXX_END_NAMESPACE\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/bits/codecvt.h",
    "content": "// Locale support (codecvt) -*- C++ -*-\n\n// Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005\n//  Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n/** @file bits/codecvt.h\n *  This is an internal header file, included by other library headers.\n *  You should not attempt to use it directly.\n */\n\n//\n// ISO C++ 14882: 22.2.1.5 Template class codecvt\n//\n\n// Written by Benjamin Kosnik <bkoz@redhat.com>\n\n#ifndef _CODECVT_H\n#define _CODECVT_H 1\n\n#pragma GCC system_header\n\n_GLIBCXX_BEGIN_NAMESPACE(std)\n\n  /// @brief  Empty base class for codecvt facet [22.2.1.5].\n  class codecvt_base\n  {\n  public:\n    enum result\n    {\n      ok,\n      partial,\n      error,\n      noconv\n    };\n  };\n\n  /**\n   *  @brief  Common base for codecvt functions.\n   *\n   *  This template class provides implementations of the public functions\n   *  that forward to the protected virtual functions.\n   *\n   *  This template also provides abstract stubs for the protected virtual\n   *  functions.\n  */\n  template<typename _InternT, typename _ExternT, typename _StateT>\n    class __codecvt_abstract_base\n    : public locale::facet, public codecvt_base\n    {\n    public:\n      // Types:\n      typedef codecvt_base::result\tresult;\n      typedef _InternT\t\t\tintern_type;\n      typedef _ExternT\t\t\textern_type;\n      typedef _StateT\t\t\tstate_type;\n\n      // 22.2.1.5.1 codecvt members\n      /**\n       *  @brief  Convert from internal to external character set.\n       *\n       *  Converts input string of intern_type to output string of\n       *  extern_type.  This is analogous to wcsrtombs.  It does this by\n       *  calling codecvt::do_out.\n       *\n       *  The source and destination character sets are determined by the\n       *  facet's locale, internal and external types.\n       *\n       *  The characters in [from,from_end) are converted and written to\n       *  [to,to_end).  from_next and to_next are set to point to the\n       *  character following the last successfully converted character,\n       *  respectively.  If the result needed no conversion, from_next and\n       *  to_next are not affected.\n       *\n       *  The @a state argument should be intialized if the input is at the\n       *  beginning and carried from a previous call if continuing\n       *  conversion.  There are no guarantees about how @a state is used.\n       *\n       *  The result returned is a member of codecvt_base::result.  If\n       *  all the input is converted, returns codecvt_base::ok.  If no\n       *  conversion is necessary, returns codecvt_base::noconv.  If\n       *  the input ends early or there is insufficient space in the\n       *  output, returns codecvt_base::partial.  Otherwise the\n       *  conversion failed and codecvt_base::error is returned.\n       *\n       *  @param  state  Persistent conversion state data.\n       *  @param  from  Start of input.\n       *  @param  from_end  End of input.\n       *  @param  from_next  Returns start of unconverted data.\n       *  @param  to  Start of output buffer.\n       *  @param  to_end  End of output buffer.\n       *  @param  to_next  Returns start of unused output area.\n       *  @return  codecvt_base::result.\n      */\n      result\n      out(state_type& __state, const intern_type* __from,\n\t  const intern_type* __from_end, const intern_type*& __from_next,\n\t  extern_type* __to, extern_type* __to_end,\n\t  extern_type*& __to_next) const\n      {\n\treturn this->do_out(__state, __from, __from_end, __from_next,\n\t\t\t    __to, __to_end, __to_next);\n      }\n\n      /**\n       *  @brief  Reset conversion state.\n       *\n       *  Writes characters to output that would restore @a state to initial\n       *  conditions.  The idea is that if a partial conversion occurs, then\n       *  the converting the characters written by this function would leave\n       *  the state in initial conditions, rather than partial conversion\n       *  state.  It does this by calling codecvt::do_unshift().\n       *\n       *  For example, if 4 external characters always converted to 1 internal\n       *  character, and input to in() had 6 external characters with state\n       *  saved, this function would write two characters to the output and\n       *  set the state to initialized conditions.\n       *\n       *  The source and destination character sets are determined by the\n       *  facet's locale, internal and external types.\n       *\n       *  The result returned is a member of codecvt_base::result.  If the\n       *  state could be reset and data written, returns codecvt_base::ok.  If\n       *  no conversion is necessary, returns codecvt_base::noconv.  If the\n       *  output has insufficient space, returns codecvt_base::partial.\n       *  Otherwise the reset failed and codecvt_base::error is returned.\n       *\n       *  @param  state  Persistent conversion state data.\n       *  @param  to  Start of output buffer.\n       *  @param  to_end  End of output buffer.\n       *  @param  to_next  Returns start of unused output area.\n       *  @return  codecvt_base::result.\n      */\n      result\n      unshift(state_type& __state, extern_type* __to, extern_type* __to_end,\n\t      extern_type*& __to_next) const\n      { return this->do_unshift(__state, __to,__to_end,__to_next); }\n\n      /**\n       *  @brief  Convert from external to internal character set.\n       *\n       *  Converts input string of extern_type to output string of\n       *  intern_type.  This is analogous to mbsrtowcs.  It does this by\n       *  calling codecvt::do_in.\n       *\n       *  The source and destination character sets are determined by the\n       *  facet's locale, internal and external types.\n       *\n       *  The characters in [from,from_end) are converted and written to\n       *  [to,to_end).  from_next and to_next are set to point to the\n       *  character following the last successfully converted character,\n       *  respectively.  If the result needed no conversion, from_next and\n       *  to_next are not affected.\n       *\n       *  The @a state argument should be intialized if the input is at the\n       *  beginning and carried from a previous call if continuing\n       *  conversion.  There are no guarantees about how @a state is used.\n       *\n       *  The result returned is a member of codecvt_base::result.  If\n       *  all the input is converted, returns codecvt_base::ok.  If no\n       *  conversion is necessary, returns codecvt_base::noconv.  If\n       *  the input ends early or there is insufficient space in the\n       *  output, returns codecvt_base::partial.  Otherwise the\n       *  conversion failed and codecvt_base::error is returned.\n       *\n       *  @param  state  Persistent conversion state data.\n       *  @param  from  Start of input.\n       *  @param  from_end  End of input.\n       *  @param  from_next  Returns start of unconverted data.\n       *  @param  to  Start of output buffer.\n       *  @param  to_end  End of output buffer.\n       *  @param  to_next  Returns start of unused output area.\n       *  @return  codecvt_base::result.\n      */\n      result\n      in(state_type& __state, const extern_type* __from,\n\t const extern_type* __from_end, const extern_type*& __from_next,\n\t intern_type* __to, intern_type* __to_end,\n\t intern_type*& __to_next) const\n      {\n\treturn this->do_in(__state, __from, __from_end, __from_next,\n\t\t\t   __to, __to_end, __to_next);\n      }\n\n      int\n      encoding() const throw()\n      { return this->do_encoding(); }\n\n      bool\n      always_noconv() const throw()\n      { return this->do_always_noconv(); }\n\n      int\n      length(state_type& __state, const extern_type* __from,\n\t     const extern_type* __end, size_t __max) const\n      { return this->do_length(__state, __from, __end, __max); }\n\n      int\n      max_length() const throw()\n      { return this->do_max_length(); }\n\n    protected:\n      explicit\n      __codecvt_abstract_base(size_t __refs = 0) : locale::facet(__refs) { }\n\n      virtual\n      ~__codecvt_abstract_base() { }\n\n      /**\n       *  @brief  Convert from internal to external character set.\n       *\n       *  Converts input string of intern_type to output string of\n       *  extern_type.  This function is a hook for derived classes to change\n       *  the value returned.  @see out for more information.\n      */\n      virtual result\n      do_out(state_type& __state, const intern_type* __from,\n\t     const intern_type* __from_end, const intern_type*& __from_next,\n\t     extern_type* __to, extern_type* __to_end,\n\t     extern_type*& __to_next) const = 0;\n\n      virtual result\n      do_unshift(state_type& __state, extern_type* __to,\n\t\t extern_type* __to_end, extern_type*& __to_next) const = 0;\n\n      virtual result\n      do_in(state_type& __state, const extern_type* __from,\n\t    const extern_type* __from_end, const extern_type*& __from_next,\n\t    intern_type* __to, intern_type* __to_end,\n\t    intern_type*& __to_next) const = 0;\n\n      virtual int\n      do_encoding() const throw() = 0;\n\n      virtual bool\n      do_always_noconv() const throw() = 0;\n\n      virtual int\n      do_length(state_type&, const extern_type* __from,\n\t\tconst extern_type* __end, size_t __max) const = 0;\n\n      virtual int\n      do_max_length() const throw() = 0;\n    };\n\n  /// @brief class codecvt [22.2.1.5].\n  /// NB: Generic, mostly useless implementation.\n  template<typename _InternT, typename _ExternT, typename _StateT>\n    class codecvt\n    : public __codecvt_abstract_base<_InternT, _ExternT, _StateT>\n    {\n    public:\n      // Types:\n      typedef codecvt_base::result\tresult;\n      typedef _InternT\t\t\tintern_type;\n      typedef _ExternT\t\t\textern_type;\n      typedef _StateT\t\t\tstate_type;\n\n    protected:\n      __c_locale\t\t\t_M_c_locale_codecvt;\n\n    public:\n      static locale::id\t\t\tid;\n\n      explicit\n      codecvt(size_t __refs = 0)\n      : __codecvt_abstract_base<_InternT, _ExternT, _StateT> (__refs) { }\n\n      explicit\n      codecvt(__c_locale __cloc, size_t __refs = 0);\n\n    protected:\n      virtual\n      ~codecvt() { }\n\n      virtual result\n      do_out(state_type& __state, const intern_type* __from,\n\t     const intern_type* __from_end, const intern_type*& __from_next,\n\t     extern_type* __to, extern_type* __to_end,\n\t     extern_type*& __to_next) const;\n\n      virtual result\n      do_unshift(state_type& __state, extern_type* __to,\n\t\t extern_type* __to_end, extern_type*& __to_next) const;\n\n      virtual result\n      do_in(state_type& __state, const extern_type* __from,\n\t    const extern_type* __from_end, const extern_type*& __from_next,\n\t    intern_type* __to, intern_type* __to_end,\n\t    intern_type*& __to_next) const;\n\n      virtual int\n      do_encoding() const throw();\n\n      virtual bool\n      do_always_noconv() const throw();\n\n      virtual int\n      do_length(state_type&, const extern_type* __from,\n\t\tconst extern_type* __end, size_t __max) const;\n\n      virtual int\n      do_max_length() const throw();\n    };\n\n  template<typename _InternT, typename _ExternT, typename _StateT>\n    locale::id codecvt<_InternT, _ExternT, _StateT>::id;\n\n  /// @brief class codecvt<char, char, mbstate_t> specialization.\n  template<>\n    class codecvt<char, char, mbstate_t>\n    : public __codecvt_abstract_base<char, char, mbstate_t>\n    {\n    public:\n      // Types:\n      typedef char\t\t\tintern_type;\n      typedef char\t\t\textern_type;\n      typedef mbstate_t\t\t\tstate_type;\n\n    protected:\n      __c_locale\t\t\t_M_c_locale_codecvt;\n\n    public:\n      static locale::id id;\n\n      explicit\n      codecvt(size_t __refs = 0);\n\n      explicit\n      codecvt(__c_locale __cloc, size_t __refs = 0);\n\n    protected:\n      virtual\n      ~codecvt();\n\n      virtual result\n      do_out(state_type& __state, const intern_type* __from,\n\t     const intern_type* __from_end, const intern_type*& __from_next,\n\t     extern_type* __to, extern_type* __to_end,\n\t     extern_type*& __to_next) const;\n\n      virtual result\n      do_unshift(state_type& __state, extern_type* __to,\n\t\t extern_type* __to_end, extern_type*& __to_next) const;\n\n      virtual result\n      do_in(state_type& __state, const extern_type* __from,\n\t    const extern_type* __from_end, const extern_type*& __from_next,\n\t    intern_type* __to, intern_type* __to_end,\n\t    intern_type*& __to_next) const;\n\n      virtual int\n      do_encoding() const throw();\n\n      virtual bool\n      do_always_noconv() const throw();\n\n      virtual int\n      do_length(state_type&, const extern_type* __from,\n\t\tconst extern_type* __end, size_t __max) const;\n\n      virtual int\n      do_max_length() const throw();\n  };\n\n#ifdef _GLIBCXX_USE_WCHAR_T\n  /// @brief  class codecvt<wchar_t, char, mbstate_t> specialization.\n  template<>\n    class codecvt<wchar_t, char, mbstate_t>\n    : public __codecvt_abstract_base<wchar_t, char, mbstate_t>\n    {\n    public:\n      // Types:\n      typedef wchar_t\t\t\tintern_type;\n      typedef char\t\t\textern_type;\n      typedef mbstate_t\t\t\tstate_type;\n\n    protected:\n      __c_locale\t\t\t_M_c_locale_codecvt;\n\n    public:\n      static locale::id\t\t\tid;\n\n      explicit\n      codecvt(size_t __refs = 0);\n\n      explicit\n      codecvt(__c_locale __cloc, size_t __refs = 0);\n\n    protected:\n      virtual\n      ~codecvt();\n\n      virtual result\n      do_out(state_type& __state, const intern_type* __from,\n\t     const intern_type* __from_end, const intern_type*& __from_next,\n\t     extern_type* __to, extern_type* __to_end,\n\t     extern_type*& __to_next) const;\n\n      virtual result\n      do_unshift(state_type& __state,\n\t\t extern_type* __to, extern_type* __to_end,\n\t\t extern_type*& __to_next) const;\n\n      virtual result\n      do_in(state_type& __state,\n\t     const extern_type* __from, const extern_type* __from_end,\n\t     const extern_type*& __from_next,\n\t     intern_type* __to, intern_type* __to_end,\n\t     intern_type*& __to_next) const;\n\n      virtual\n      int do_encoding() const throw();\n\n      virtual\n      bool do_always_noconv() const throw();\n\n      virtual\n      int do_length(state_type&, const extern_type* __from,\n\t\t    const extern_type* __end, size_t __max) const;\n\n      virtual int\n      do_max_length() const throw();\n    };\n#endif //_GLIBCXX_USE_WCHAR_T\n\n  /// @brief class codecvt_byname [22.2.1.6].\n  template<typename _InternT, typename _ExternT, typename _StateT>\n    class codecvt_byname : public codecvt<_InternT, _ExternT, _StateT>\n    {\n    public:\n      explicit\n      codecvt_byname(const char* __s, size_t __refs = 0)\n      : codecvt<_InternT, _ExternT, _StateT>(__refs)\n      {\n\tif (std::strcmp(__s, \"C\") != 0 && std::strcmp(__s, \"POSIX\") != 0)\n\t  {\n\t    this->_S_destroy_c_locale(this->_M_c_locale_codecvt);\n\t    this->_S_create_c_locale(this->_M_c_locale_codecvt, __s);\n\t  }\n      }\n\n    protected:\n      virtual\n      ~codecvt_byname() { }\n    };\n\n_GLIBCXX_END_NAMESPACE\n\n#endif // _CODECVT_H\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/bits/compatibility.h",
    "content": "// Compatibility symbols for previous versions -*- C++ -*-\n\n// Copyright (C) 2005, 2006\n// Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n/** @file compatibility.h\n *  This is an internal header file, included by other library sources.\n *  You should not attempt to use it directly.\n */\n\n// Switch for symbol version macro.\n#ifndef _GLIBCXX_APPLY_SYMVER \n#error must define _GLIBCXX_APPLY_SYMVER before including __FILE__\n#endif\n\n/* gcc-3.4.4\n_ZNSt19istreambuf_iteratorIcSt11char_traitsIcEEppEv\n_ZNSt19istreambuf_iteratorIwSt11char_traitsIwEEppEv\n */\nnamespace \n{\n_GLIBCXX_APPLY_SYMVER(_ZNSt21istreambuf_iteratorXXIcSt11char_traitsIcEEppEv,\n\t\t      _ZNSt19istreambuf_iteratorIcSt11char_traitsIcEEppEv)\n\n#ifdef _GLIBCXX_USE_WCHAR_T\n_GLIBCXX_APPLY_SYMVER(_ZNSt21istreambuf_iteratorXXIwSt11char_traitsIwEEppEv,\n\t\t      _ZNSt19istreambuf_iteratorIwSt11char_traitsIwEEppEv)\n#endif\n} // anonymous namespace\n\n/* gcc-4.0.0\n_ZNSs4_Rep26_M_set_length_and_sharableEj\n_ZNSs7_M_copyEPcPKcj\n_ZNSs7_M_moveEPcPKcj\n_ZNSs9_M_assignEPcjc\n_ZNKSs11_M_disjunctEPKc\n_ZNKSs15_M_check_lengthEjjPKc\n_ZNSbIwSt11char_traitsIwESaIwEE4_Rep26_M_set_length_and_sharableEj\n_ZNSbIwSt11char_traitsIwESaIwEE7_M_copyEPwPKwj\n_ZNSbIwSt11char_traitsIwESaIwEE7_M_moveEPwPKwj\n_ZNSbIwSt11char_traitsIwESaIwEE9_M_assignEPwjw\n_ZNKSbIwSt11char_traitsIwESaIwEE11_M_disjunctEPKw\n_ZNKSbIwSt11char_traitsIwESaIwEE15_M_check_lengthEjjPKc\n\n_ZNKSt13basic_fstreamIcSt11char_traitsIcEE7is_openEv\n_ZNKSt13basic_fstreamIwSt11char_traitsIwEE7is_openEv\n_ZNKSt14basic_ifstreamIcSt11char_traitsIcEE7is_openEv\n_ZNKSt14basic_ifstreamIwSt11char_traitsIwEE7is_openEv\n_ZNKSt14basic_ofstreamIcSt11char_traitsIcEE7is_openEv\n_ZNKSt14basic_ofstreamIwSt11char_traitsIwEE7is_openEv\n\n_ZNSi6ignoreEi\n_ZNSi6ignoreEv\n_ZNSt13basic_istreamIwSt11char_traitsIwEE6ignoreEi\n_ZNSt13basic_istreamIwSt11char_traitsIwEE6ignoreEv\n\n_ZNSt11char_traitsIcE2eqERKcS2_\n_ZNSt11char_traitsIwE2eqERKwS2_\n */\nnamespace \n{\n_GLIBCXX_APPLY_SYMVER(_ZNSt11char_traitsIcE4eqXXERKcS2_,\n\t\t      _ZNSt11char_traitsIcE2eqERKcS2_)\n\n#ifdef _GLIBCXX_SIZE_T_IS_UINT\n_GLIBCXX_APPLY_SYMVER(_ZNSs9_M_copyXXEPcPKcj,\n\t\t      _ZNSs7_M_copyEPcPKcj)\n#else\n_GLIBCXX_APPLY_SYMVER(_ZNSs9_M_copyXXEPcPKcm,\n\t\t      _ZNSs7_M_copyEPcPKcm)\n#endif\n\n#ifdef _GLIBCXX_SIZE_T_IS_UINT\n_GLIBCXX_APPLY_SYMVER(_ZNSs9_M_moveXXEPcPKcj,\n\t\t      _ZNSs7_M_moveEPcPKcj)\n#else\n_GLIBCXX_APPLY_SYMVER(_ZNSs9_M_moveXXEPcPKcm,\n\t\t      _ZNSs7_M_moveEPcPKcm)\n#endif\n\n#ifdef _GLIBCXX_SIZE_T_IS_UINT\n_GLIBCXX_APPLY_SYMVER(_ZNSs11_M_assignXXEPcjc,\n\t\t      _ZNSs9_M_assignEPcjc)\n#else\n_GLIBCXX_APPLY_SYMVER(_ZNSs11_M_assignXXEPcmc,\n\t\t      _ZNSs9_M_assignEPcmc)\n#endif\n\n_GLIBCXX_APPLY_SYMVER(_ZNKSs13_M_disjunctXXEPKc,\n\t\t      _ZNKSs11_M_disjunctEPKc)\n\n#ifdef _GLIBCXX_SIZE_T_IS_UINT\n_GLIBCXX_APPLY_SYMVER(_ZNKSs17_M_check_lengthXXEjjPKc,\n\t\t      _ZNKSs15_M_check_lengthEjjPKc)\n#else\n_GLIBCXX_APPLY_SYMVER(_ZNKSs17_M_check_lengthXXEmmPKc,\n\t\t      _ZNKSs15_M_check_lengthEmmPKc)\n#endif\n\n#ifdef _GLIBCXX_SIZE_T_IS_UINT\n  _GLIBCXX_APPLY_SYMVER(_ZNSs4_Rep28_M_set_length_and_sharableXXEj,\n\t\t\t_ZNSs4_Rep26_M_set_length_and_sharableEj)\n#else\n  _GLIBCXX_APPLY_SYMVER(_ZNSs4_Rep28_M_set_length_and_sharableXXEm,\n\t\t\t_ZNSs4_Rep26_M_set_length_and_sharableEm)\n#endif\n\n_GLIBCXX_APPLY_SYMVER(_ZNSi8ignoreXXEv, _ZNSi6ignoreEv)\n\n#ifdef _GLIBCXX_PTRDIFF_T_IS_INT\n_GLIBCXX_APPLY_SYMVER(_ZNSi8ignoreXXEi, _ZNSi6ignoreEi)\n#else\n_GLIBCXX_APPLY_SYMVER(_ZNSi8ignoreXXEl, _ZNSi6ignoreEl)\n#endif\n\n_GLIBCXX_APPLY_SYMVER(_ZNKSt15basic_fstreamXXIcSt11char_traitsIcEE7is_openEv,\n\t\t      _ZNKSt13basic_fstreamIcSt11char_traitsIcEE7is_openEv)\n\n_GLIBCXX_APPLY_SYMVER(_ZNKSt16basic_ifstreamXXIcSt11char_traitsIcEE7is_openEv,\n\t\t      _ZNKSt14basic_ifstreamIcSt11char_traitsIcEE7is_openEv)\n\n_GLIBCXX_APPLY_SYMVER(_ZNKSt16basic_ofstreamXXIcSt11char_traitsIcEE7is_openEv,\n\t\t      _ZNKSt14basic_ofstreamIcSt11char_traitsIcEE7is_openEv)\n\n  // Support for wchar_t.\n#ifdef _GLIBCXX_USE_WCHAR_T\n_GLIBCXX_APPLY_SYMVER(_ZNSt11char_traitsIwE4eqXXERKwS2_,\n\t\t      _ZNSt11char_traitsIwE2eqERKwS2_)\n\n#ifdef _GLIBCXX_SIZE_T_IS_UINT\n_GLIBCXX_APPLY_SYMVER(_ZNSbIwSt11char_traitsIwESaIwEE9_M_copyXXEPwPKwj,\n\t\t      _ZNSbIwSt11char_traitsIwESaIwEE7_M_copyEPwPKwj)\n#else\n  _GLIBCXX_APPLY_SYMVER(_ZNSbIwSt11char_traitsIwESaIwEE9_M_copyXXEPwPKwm,\n\t\t\t_ZNSbIwSt11char_traitsIwESaIwEE7_M_copyEPwPKwm)\n#endif\n\n#ifdef _GLIBCXX_SIZE_T_IS_UINT\n_GLIBCXX_APPLY_SYMVER(_ZNSbIwSt11char_traitsIwESaIwEE9_M_moveXXEPwPKwj,\n\t\t      _ZNSbIwSt11char_traitsIwESaIwEE7_M_moveEPwPKwj)\n#else\n_GLIBCXX_APPLY_SYMVER(_ZNSbIwSt11char_traitsIwESaIwEE9_M_moveXXEPwPKwm,\n\t\t      _ZNSbIwSt11char_traitsIwESaIwEE7_M_moveEPwPKwm)\n#endif\n\n#ifdef _GLIBCXX_SIZE_T_IS_UINT\n_GLIBCXX_APPLY_SYMVER(_ZNSbIwSt11char_traitsIwESaIwEE11_M_assignXXEPwjw,\n\t\t      _ZNSbIwSt11char_traitsIwESaIwEE9_M_assignEPwjw)\n#else\n_GLIBCXX_APPLY_SYMVER(_ZNSbIwSt11char_traitsIwESaIwEE11_M_assignXXEPwmw,\n\t\t      _ZNSbIwSt11char_traitsIwESaIwEE9_M_assignEPwmw)\n#endif\n\n_GLIBCXX_APPLY_SYMVER(_ZNKSbIwSt11char_traitsIwESaIwEE13_M_disjunctXXEPKw,\n\t\t      _ZNKSbIwSt11char_traitsIwESaIwEE11_M_disjunctEPKw)\n\n#ifdef _GLIBCXX_SIZE_T_IS_UINT\n_GLIBCXX_APPLY_SYMVER(_ZNKSbIwSt11char_traitsIwESaIwEE17_M_check_lengthXXEjjPKc,\n\t\t      _ZNKSbIwSt11char_traitsIwESaIwEE15_M_check_lengthEjjPKc)\n#else\n_GLIBCXX_APPLY_SYMVER(_ZNKSbIwSt11char_traitsIwESaIwEE17_M_check_lengthXXEmmPKc,\n\t\t      _ZNKSbIwSt11char_traitsIwESaIwEE15_M_check_lengthEmmPKc)\n#endif\n\n#ifdef _GLIBCXX_SIZE_T_IS_UINT\n_GLIBCXX_APPLY_SYMVER(_ZNSbIwSt11char_traitsIwESaIwEE4_Rep28_M_set_length_and_sharableXXEj,\n\t\t      _ZNSbIwSt11char_traitsIwESaIwEE4_Rep26_M_set_length_and_sharableEj)\n#else\n_GLIBCXX_APPLY_SYMVER(_ZNSbIwSt11char_traitsIwESaIwEE4_Rep28_M_set_length_and_sharableXXEm,\n\t\t      _ZNSbIwSt11char_traitsIwESaIwEE4_Rep26_M_set_length_and_sharableEm)\n#endif\n\n_GLIBCXX_APPLY_SYMVER(_ZNSt13basic_istreamIwSt11char_traitsIwEE8ignoreXXEv,\n\t\t      _ZNSt13basic_istreamIwSt11char_traitsIwEE6ignoreEv)\n\n#ifdef _GLIBCXX_PTRDIFF_T_IS_INT\n_GLIBCXX_APPLY_SYMVER(_ZNSt13basic_istreamIwSt11char_traitsIwEE8ignoreXXEi,\n\t\t      _ZNSt13basic_istreamIwSt11char_traitsIwEE6ignoreEi)\n#else\n_GLIBCXX_APPLY_SYMVER(_ZNSt13basic_istreamIwSt11char_traitsIwEE8ignoreXXEl,\n\t\t      _ZNSt13basic_istreamIwSt11char_traitsIwEE6ignoreEl)\n#endif\n\n_GLIBCXX_APPLY_SYMVER(_ZNKSt15basic_fstreamXXIwSt11char_traitsIwEE7is_openEv,\n\t\t      _ZNKSt13basic_fstreamIwSt11char_traitsIwEE7is_openEv)\n\n_GLIBCXX_APPLY_SYMVER(_ZNKSt16basic_ifstreamXXIwSt11char_traitsIwEE7is_openEv,\n\t\t      _ZNKSt14basic_ifstreamIwSt11char_traitsIwEE7is_openEv)\n\n_GLIBCXX_APPLY_SYMVER(_ZNKSt16basic_ofstreamXXIwSt11char_traitsIwEE7is_openEv,\n\t\t      _ZNKSt14basic_ofstreamIwSt11char_traitsIwEE7is_openEv)\n#endif\n  } // anonymous namespace\n\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/bits/concept_check.h",
    "content": "// Concept-checking control -*- C++ -*-\n\n// Copyright (C) 2001 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n/** @file concept_check.h\n *  This is an internal header file, included by other library headers.\n *  You should not attempt to use it directly.\n */\n\n#ifndef _CONCEPT_CHECK_H\n#define _CONCEPT_CHECK_H 1\n\n#pragma GCC system_header\n\n#include <bits/c++config.h>\n\n// All places in libstdc++-v3 where these are used, or /might/ be used, or\n// don't need to be used, or perhaps /should/ be used, are commented with\n// \"concept requirements\" (and maybe some more text).  So grep like crazy\n// if you're looking for additional places to use these.\n\n// Concept-checking code is off by default unless users turn it on via\n// configure options or editing c++config.h.\n\n#ifndef _GLIBCXX_CONCEPT_CHECKS\n\n#define __glibcxx_function_requires(...)\n#define __glibcxx_class_requires(_a,_b)\n#define __glibcxx_class_requires2(_a,_b,_c)\n#define __glibcxx_class_requires3(_a,_b,_c,_d)\n#define __glibcxx_class_requires4(_a,_b,_c,_d,_e)\n\n#else // the checks are on\n\n#include <bits/boost_concept_check.h>\n\n// Note that the obvious and elegant approach of\n//\n//#define glibcxx_function_requires(C) boost::function_requires< boost::C >()\n//\n// won't work due to concept templates with more than one parameter, e.g.,\n// BinaryPredicateConcept.  The preprocessor tries to split things up on\n// the commas in the template argument list.  We can't use an inner pair of\n// parenthesis to hide the commas, because \"boost::(Temp<Foo,Bar>)\" isn't\n// a valid instantiation pattern.  Thus, we steal a feature from C99.\n\n#define __glibcxx_function_requires(...)                                 \\\n            __gnu_cxx::__function_requires< __gnu_cxx::__VA_ARGS__ >();\n#define __glibcxx_class_requires(_a,_C)                                  \\\n            _GLIBCXX_CLASS_REQUIRES(_a, __gnu_cxx, _C);\n#define __glibcxx_class_requires2(_a,_b,_C)                              \\\n            _GLIBCXX_CLASS_REQUIRES2(_a, _b, __gnu_cxx, _C);\n#define __glibcxx_class_requires3(_a,_b,_c,_C)                           \\\n            _GLIBCXX_CLASS_REQUIRES3(_a, _b, _c, __gnu_cxx, _C);\n#define __glibcxx_class_requires4(_a,_b,_c,_d,_C)                        \\\n            _GLIBCXX_CLASS_REQUIRES4(_a, _b, _c, _d, __gnu_cxx, _C);\n\n#endif // enable/disable\n\n#endif // _GLIBCXX_CONCEPT_CHECK\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/bits/cpp_type_traits.h",
    "content": "// The  -*- C++ -*- type traits classes for internal use in libstdc++\n\n// Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006\n// Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n/** @file cpp_type_traits.h\n *  This is an internal header file, included by other library headers.\n *  You should not attempt to use it directly.\n */\n\n// Written by Gabriel Dos Reis <dosreis@cmla.ens-cachan.fr>\n\n#ifndef _CPP_TYPE_TRAITS_H\n#define _CPP_TYPE_TRAITS_H 1\n\n#pragma GCC system_header\n\n#include <bits/c++config.h>\n\n//\n// This file provides some compile-time information about various types.\n// These representations were designed, on purpose, to be constant-expressions\n// and not types as found in <bits/type_traits.h>.  In particular, they\n// can be used in control structures and the optimizer hopefully will do\n// the obvious thing.\n//\n// Why integral expressions, and not functions nor types?\n// Firstly, these compile-time entities are used as template-arguments\n// so function return values won't work:  We need compile-time entities.\n// We're left with types and constant  integral expressions.\n// Secondly, from the point of view of ease of use, type-based compile-time\n// information is -not- *that* convenient.  On has to write lots of\n// overloaded functions and to hope that the compiler will select the right\n// one. As a net effect, the overall structure isn't very clear at first\n// glance.\n// Thirdly, partial ordering and overload resolution (of function templates)\n// is highly costly in terms of compiler-resource.  It is a Good Thing to\n// keep these resource consumption as least as possible.\n//\n// See valarray_array.h for a case use.\n//\n// -- Gaby (dosreis@cmla.ens-cachan.fr) 2000-03-06.\n//\n// Update 2005: types are also provided and <bits/type_traits.h> has been\n// removed.\n//\n\n// Forward declaration hack, should really include this from somewhere.\n_GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)\n\n  template<typename _Iterator, typename _Container>\n    class __normal_iterator;\n\n_GLIBCXX_END_NAMESPACE\n\n_GLIBCXX_BEGIN_NAMESPACE(std)\n\nnamespace __detail\n{\n  // NB: g++ can not compile these if declared within the class\n  // __is_pod itself.\n  typedef char __one;\n  typedef char __two[2];\n\n  template<typename _Tp>\n  __one __test_type(int _Tp::*);\n  template<typename _Tp>\n  __two& __test_type(...);\n} // namespace __detail\n\n\n  struct __true_type { };\n  struct __false_type { };\n\n  template<bool>\n    struct __truth_type\n    { typedef __false_type __type; };\n\n  template<>\n    struct __truth_type<true>\n    { typedef __true_type __type; };\n\n  // N.B. The conversions to bool are needed due to the issue\n  // explained in c++/19404.\n  template<class _Sp, class _Tp>\n    struct __traitor\n    {\n      enum { __value = bool(_Sp::__value) || bool(_Tp::__value) };\n      typedef typename __truth_type<__value>::__type __type;\n    };\n\n  // Compare for equality of types.\n  template<typename, typename>\n    struct __are_same\n    {\n      enum { __value = 0 };\n      typedef __false_type __type;\n    };\n\n  template<typename _Tp>\n    struct __are_same<_Tp, _Tp>\n    {\n      enum { __value = 1 };\n      typedef __true_type __type;\n    };\n\n  // Holds if the template-argument is a void type.\n  template<typename _Tp>\n    struct __is_void\n    {\n      enum { __value = 0 };\n      typedef __false_type __type;\n    };\n\n  template<>\n    struct __is_void<void>\n    {\n      enum { __value = 1 };\n      typedef __true_type __type;\n    };\n\n  //\n  // Integer types\n  //\n  template<typename _Tp>\n    struct __is_integer\n    {\n      enum { __value = 0 };\n      typedef __false_type __type;\n    };\n\n  // Thirteen specializations (yes there are eleven standard integer\n  // types; 'long long' and 'unsigned long long' are supported as\n  // extensions)\n  template<>\n    struct __is_integer<bool>\n    {\n      enum { __value = 1 };\n      typedef __true_type __type;\n    };\n\n  template<>\n    struct __is_integer<char>\n    {\n      enum { __value = 1 };\n      typedef __true_type __type;\n    };\n\n  template<>\n    struct __is_integer<signed char>\n    {\n      enum { __value = 1 };\n      typedef __true_type __type;\n    };\n\n  template<>\n    struct __is_integer<unsigned char>\n    {\n      enum { __value = 1 };\n      typedef __true_type __type;\n    };\n\n# ifdef _GLIBCXX_USE_WCHAR_T\n  template<>\n    struct __is_integer<wchar_t>\n    {\n      enum { __value = 1 };\n      typedef __true_type __type;\n    };\n# endif\n\n  template<>\n    struct __is_integer<short>\n    {\n      enum { __value = 1 };\n      typedef __true_type __type;\n    };\n\n  template<>\n    struct __is_integer<unsigned short>\n    {\n      enum { __value = 1 };\n      typedef __true_type __type;\n    };\n\n  template<>\n    struct __is_integer<int>\n    {\n      enum { __value = 1 };\n      typedef __true_type __type;\n    };\n\n  template<>\n    struct __is_integer<unsigned int>\n    {\n      enum { __value = 1 };\n      typedef __true_type __type;\n    };\n\n  template<>\n    struct __is_integer<long>\n    {\n      enum { __value = 1 };\n      typedef __true_type __type;\n    };\n\n  template<>\n    struct __is_integer<unsigned long>\n    {\n      enum { __value = 1 };\n      typedef __true_type __type;\n    };\n\n  template<>\n    struct __is_integer<long long>\n    {\n      enum { __value = 1 };\n      typedef __true_type __type;\n    };\n\n  template<>\n    struct __is_integer<unsigned long long>\n    {\n      enum { __value = 1 };\n      typedef __true_type __type;\n    };\n\n  //\n  // Floating point types\n  //\n  template<typename _Tp>\n    struct __is_floating\n    {\n      enum { __value = 0 };\n      typedef __false_type __type;\n    };\n\n  // three specializations (float, double and 'long double')\n  template<>\n    struct __is_floating<float>\n    {\n      enum { __value = 1 };\n      typedef __true_type __type;\n    };\n\n  template<>\n    struct __is_floating<double>\n    {\n      enum { __value = 1 };\n      typedef __true_type __type;\n    };\n\n  template<>\n    struct __is_floating<long double>\n    {\n      enum { __value = 1 };\n      typedef __true_type __type;\n    };\n\n  //\n  // Pointer types\n  //\n  template<typename _Tp>\n    struct __is_pointer\n    {\n      enum { __value = 0 };\n      typedef __false_type __type;\n    };\n\n  template<typename _Tp>\n    struct __is_pointer<_Tp*>\n    {\n      enum { __value = 1 };\n      typedef __true_type __type;\n    };\n\n  //\n  // Normal iterator type\n  //\n  template<typename _Tp>\n    struct __is_normal_iterator\n    {\n      enum { __value = 0 };\n      typedef __false_type __type;\n    };\n\n  template<typename _Iterator, typename _Container>\n    struct __is_normal_iterator< __gnu_cxx::__normal_iterator<_Iterator,\n\t\t\t\t\t\t\t      _Container> >\n    {\n      enum { __value = 1 };\n      typedef __true_type __type;\n    };\n\n  //\n  // An arithmetic type is an integer type or a floating point type\n  //\n  template<typename _Tp>\n    struct __is_arithmetic\n    : public __traitor<__is_integer<_Tp>, __is_floating<_Tp> >\n    { };\n\n  //\n  // A fundamental type is `void' or and arithmetic type\n  //\n  template<typename _Tp>\n    struct __is_fundamental\n    : public __traitor<__is_void<_Tp>, __is_arithmetic<_Tp> >\n    { };\n\n  //\n  // A scalar type is an arithmetic type or a pointer type\n  // \n  template<typename _Tp>\n    struct __is_scalar\n    : public __traitor<__is_arithmetic<_Tp>, __is_pointer<_Tp> >\n    { };\n\n  // For the immediate use, the following is a good approximation.\n  template<typename _Tp>\n    struct __is_pod\n    {\n      enum\n\t{\n\t  __value = (sizeof(__detail::__test_type<_Tp>(0))\n\t\t     != sizeof(__detail::__one))\n\t};\n    };\n\n  //\n  // A stripped-down version of std::tr1::is_empty\n  //\n  template<typename _Tp>\n    struct __is_empty\n    { \n    private:\n      template<typename>\n        struct __first { };\n      template<typename _Up>\n        struct __second\n        : public _Up { };\n           \n    public:\n      enum\n\t{\n\t  __value = sizeof(__first<_Tp>) == sizeof(__second<_Tp>)\n\t};\n    };\n\n  //\n  // For use in std::copy and std::find overloads for streambuf iterators.\n  //\n  template<typename _Tp>\n    struct __is_char\n    {\n      enum { __value = 0 };\n      typedef __false_type __type;\n    };\n\n  template<>\n    struct __is_char<char>\n    {\n      enum { __value = 1 };\n      typedef __true_type __type;\n    };\n\n#ifdef _GLIBCXX_USE_WCHAR_T\n  template<>\n    struct __is_char<wchar_t>\n    {\n      enum { __value = 1 };\n      typedef __true_type __type;\n    };\n#endif\n\n_GLIBCXX_END_NAMESPACE\n\n#endif //_CPP_TYPE_TRAITS_H\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/bits/cpu_defines.h",
    "content": "// Specific definitions for generic platforms  -*- C++ -*-\n\n// Copyright (C) 2005 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n/** @file cpu_defines.h\n *  This is an internal header file, included by other library headers.\n *  You should not attempt to use it directly.\n */\n\n#ifndef _GLIBCXX_CPU_DEFINES\n#define _GLIBCXX_CPU_DEFINES 1\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/bits/ctype_base.h",
    "content": "// Locale support -*- C++ -*-\n\n// Copyright (C) 2000, 2003 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n//\n// ISO C++ 14882: 22.1  Locales\n//\n  \n// Information as gleaned from /usr/include/ctype.h on FreeBSD 3.4,\n// 4.0 and all versions of the CVS managed file at:\n// :pserver:anoncvs@anoncvs.freebsd.org:/home/ncvs/src/include/ctype.h\n  \n_GLIBCXX_BEGIN_NAMESPACE(std)\n\n  /// @brief  Base class for ctype.\n  struct ctype_base\n  {\n    // Non-standard typedefs.\n    typedef const int* \t\t__to_type;\n\n    // NB: Offsets into ctype<char>::_M_table force a particular size\n    // on the mask type. Because of this, we don't use an enum.\n    typedef unsigned long \tmask;\n#ifdef _CTYPE_S\n    // FreeBSD 4.0 uses this style of define.\n    static const mask upper    \t= _CTYPE_U;\n    static const mask lower \t= _CTYPE_L;\n    static const mask alpha \t= _CTYPE_A;\n    static const mask digit \t= _CTYPE_D;\n    static const mask xdigit \t= _CTYPE_X;\n    static const mask space \t= _CTYPE_S;\n    static const mask print \t= _CTYPE_R;\n    static const mask graph \t= _CTYPE_A | _CTYPE_D | _CTYPE_P;\n    static const mask cntrl \t= _CTYPE_C;\n    static const mask punct \t= _CTYPE_P;\n    static const mask alnum \t= _CTYPE_A | _CTYPE_D;\n#else\n    // Older versions, including Free BSD 3.4, use this style of define.\n    static const mask upper    \t= _U;\n    static const mask lower \t= _L;\n    static const mask alpha \t= _A;\n    static const mask digit \t= _D;\n    static const mask xdigit \t= _X;\n    static const mask space \t= _S;\n    static const mask print \t= _R;\n    static const mask graph \t= _A | _D | _P;\n    static const mask cntrl \t= _C;\n    static const mask punct \t= _P;\n    static const mask alnum \t= _A | _D;\n#endif\n  };\n\n_GLIBCXX_END_NAMESPACE\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/bits/ctype_inline.h",
    "content": "// Locale support -*- C++ -*-\n\n// Copyright (C) 2000, 2003, 2004, 2005 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n/** @file ctype_inline.h\n *  This is an internal header file, included by other library headers.\n *  You should not attempt to use it directly.\n */\n\n//\n// ISO C++ 14882: 22.1  Locales\n//\n  \n// ctype bits to be inlined go here. Non-inlinable (ie virtual do_*)\n// functions go in ctype.cc\n  \n_GLIBCXX_BEGIN_NAMESPACE(std)\n\n  bool\n  ctype<char>::\n  is(mask __m, char __c) const\n  { \n    if (_M_table)\n      return _M_table[static_cast<unsigned char>(__c)] & __m;\n    else\n      return __istype(__c, __m);\n  }\n\n  const char*\n  ctype<char>::\n  is(const char* __low, const char* __high, mask* __vec) const\n  {\n    if (_M_table)\n      while (__low < __high)\n\t*__vec++ = _M_table[static_cast<unsigned char>(*__low++)];\n    else\n      for (;__low < __high; ++__vec, ++__low)\n\t{\n#if defined (_CTYPE_S) || defined (__istype)\n\t  *__vec = __maskrune (*__low, upper | lower | alpha | digit | xdigit\n\t\t\t       | space | print | graph | cntrl | punct | alnum);\n#else\n\t  mask __m = 0;\n\t  if (this->is(upper, *__low)) __m |= upper;\n\t  if (this->is(lower, *__low)) __m |= lower;\n\t  if (this->is(alpha, *__low)) __m |= alpha;\n\t  if (this->is(digit, *__low)) __m |= digit;\n\t  if (this->is(xdigit, *__low)) __m |= xdigit;\n\t  if (this->is(space, *__low)) __m |= space;\n\t  if (this->is(print, *__low)) __m |= print;\n\t  if (this->is(graph, *__low)) __m |= graph;\n\t  if (this->is(cntrl, *__low)) __m |= cntrl;\n\t  if (this->is(punct, *__low)) __m |= punct;\n\t  // Do not include explicit line for alnum mask since it is a\n\t  // pure composite of masks on FreeBSD.\n\t  *__vec = __m;\n#endif\n\t}\n    return __high;\n  }\n\n  const char*\n  ctype<char>::\n  scan_is(mask __m, const char* __low, const char* __high) const\n  {\n    if (_M_table)\n      while (__low < __high\n\t     && !(_M_table[static_cast<unsigned char>(*__low)] & __m))\n\t++__low;\n    else\n      while (__low < __high && !this->is(__m, *__low))\n\t++__low;\n    return __low;\n  }\n\n  const char*\n  ctype<char>::\n  scan_not(mask __m, const char* __low, const char* __high) const\n  {\n    if (_M_table)\n      while (__low < __high\n\t     && (_M_table[static_cast<unsigned char>(*__low)] & __m) != 0)\n\t++__low;\n    else\n      while (__low < __high && this->is(__m, *__low) != 0)\n\t++__low;\n    return __low;\n  }\n\n#ifdef _GLIBCXX_USE_WCHAR_T  \n  inline bool\n  ctype<wchar_t>::\n  do_is(mask __m, wchar_t __c) const\n  {\n    return __istype (__c, __m);\n  }\n\n  inline const wchar_t* \n  ctype<wchar_t>::\n  do_is(const wchar_t* __lo, const wchar_t* __hi, mask* __vec) const\n  {\n    for (; __lo < __hi; ++__vec, ++__lo)\n      *__vec = __maskrune (*__lo, upper | lower | alpha | digit | xdigit\n\t\t\t   | space | print | graph | cntrl | punct | alnum);\n    return __hi;\n  }\n  \n  inline const wchar_t* \n  ctype<wchar_t>::\n  do_scan_is(mask __m, const wchar_t* __lo, const wchar_t* __hi) const\n  {\n    while (__lo < __hi && ! __istype (*__lo, __m))\n      ++__lo;\n    return __lo;\n  }\n\n  inline const wchar_t*\n  ctype<wchar_t>::\n  do_scan_not(mask __m, const char_type* __lo, const char_type* __hi) const\n  {\n    while (__lo < __hi && __istype (*__lo, __m))\n      ++__lo;\n    return __lo;\n  }\n#endif\n\n_GLIBCXX_END_NAMESPACE\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/bits/ctype_noninline.h",
    "content": "// Locale support -*- C++ -*-\n\n// Copyright (C) 2000, 2001, 2002 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n/** @file ctype_noninline.h\n *  This is an internal header file, included by other library headers.\n *  You should not attempt to use it directly.\n */\n\n//\n// ISO C++ 14882: 22.1  Locales\n//\n  \n// Information as gleaned from /usr/include/ctype.h\n  \n  const ctype_base::mask*\n  ctype<char>::classic_table() throw()\n  { return 0; }\n\n  ctype<char>::ctype(__c_locale, const mask* __table, bool __del, \n\t\t     size_t __refs) \n  : facet(__refs), _M_del(__table != 0 && __del), \n  _M_toupper(NULL), _M_tolower(NULL), \n  _M_table(__table ? __table : classic_table()) \n  { \n    memset(_M_widen, 0, sizeof(_M_widen));\n    _M_widen_ok = 0;\n    memset(_M_narrow, 0, sizeof(_M_narrow));\n    _M_narrow_ok = 0;\n  }\n\n  ctype<char>::ctype(const mask* __table, bool __del, size_t __refs) \n  : facet(__refs), _M_del(__table != 0 && __del), \n  _M_toupper(NULL), _M_tolower(NULL), \n  _M_table(__table ? __table : classic_table()) \n  { \n    memset(_M_widen, 0, sizeof(_M_widen));\n    _M_widen_ok = 0;\n    memset(_M_narrow, 0, sizeof(_M_narrow));\n    _M_narrow_ok = 0;\n  }\n\n  char\n  ctype<char>::do_toupper(char __c) const\n  { return ::toupper((int) __c); }\n\n  const char*\n  ctype<char>::do_toupper(char* __low, const char* __high) const\n  {\n    while (__low < __high)\n      {\n\t*__low = ::toupper((int) *__low);\n\t++__low;\n      }\n    return __high;\n  }\n\n  char\n  ctype<char>::do_tolower(char __c) const\n  { return ::tolower((int) __c); }\n\n  const char* \n  ctype<char>::do_tolower(char* __low, const char* __high) const\n  {\n    while (__low < __high)\n      {\n\t*__low = ::tolower((int) *__low);\n\t++__low;\n      }\n    return __high;\n  }\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/bits/cxxabi_tweaks.h",
    "content": "// Control various target specific ABI tweaks.  Generic version.\n\n// Copyright (C) 2004, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n/** @file cxxabi_tweaks.h\n *  The header provides an CPU-variable interface to the C++ ABI.\n */\n\n#ifndef _CXXABI_TWEAKS_H\n#define _CXXABI_TWEAKS_H 1\n\n#ifdef __cplusplus\nnamespace __cxxabiv1\n{\n  extern \"C\" \n  {\n#endif\n\n  // The generic ABI uses the first byte of a 64-bit guard variable.\n#define _GLIBCXX_GUARD_TEST(x) (*(char *) (x) != 0)\n#define _GLIBCXX_GUARD_SET(x) *(char *) (x) = 1\n  __extension__ typedef int __guard __attribute__((mode (__DI__)));\n\n  // __cxa_vec_ctor has void return type.\n  typedef void __cxa_vec_ctor_return_type;\n#define _GLIBCXX_CXA_VEC_CTOR_RETURN(x) return\n  // Constructors and destructors do not return a value.\n  typedef void __cxa_cdtor_return_type;\n\n#ifdef __cplusplus\n  }\n} // namespace __cxxabiv1\n#endif\n\n#endif \n"
  },
  {
    "path": "freebsd-headers/c++/4.2/bits/deque.tcc",
    "content": "// Deque implementation (out of line) -*- C++ -*-\n\n// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007\n// Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n/*\n *\n * Copyright (c) 1994\n * Hewlett-Packard Company\n *\n * Permission to use, copy, modify, distribute and sell this software\n * and its documentation for any purpose is hereby granted without fee,\n * provided that the above copyright notice appear in all copies and\n * that both that copyright notice and this permission notice appear\n * in supporting documentation.  Hewlett-Packard Company makes no\n * representations about the suitability of this software for any\n * purpose.  It is provided \"as is\" without express or implied warranty.\n *\n *\n * Copyright (c) 1997\n * Silicon Graphics Computer Systems, Inc.\n *\n * Permission to use, copy, modify, distribute and sell this software\n * and its documentation for any purpose is hereby granted without fee,\n * provided that the above copyright notice appear in all copies and\n * that both that copyright notice and this permission notice appear\n * in supporting documentation.  Silicon Graphics makes no\n * representations about the suitability of this software for any\n * purpose.  It is provided \"as is\" without express or implied warranty.\n */\n\n/** @file deque.tcc\n *  This is an internal header file, included by other library headers.\n *  You should not attempt to use it directly.\n */\n\n#ifndef _DEQUE_TCC\n#define _DEQUE_TCC 1\n\n_GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD)\n\n  template <typename _Tp, typename _Alloc>\n    deque<_Tp, _Alloc>&\n    deque<_Tp, _Alloc>::\n    operator=(const deque& __x)\n    {\n      const size_type __len = size();\n      if (&__x != this)\n\t{\n\t  if (__len >= __x.size())\n\t    _M_erase_at_end(std::copy(__x.begin(), __x.end(),\n\t\t\t\t      this->_M_impl._M_start));\n\t  else\n\t    {\n\t      const_iterator __mid = __x.begin() + difference_type(__len);\n\t      std::copy(__x.begin(), __mid, this->_M_impl._M_start);\n\t      insert(this->_M_impl._M_finish, __mid, __x.end());\n\t    }\n\t}\n      return *this;\n    }\n\n  template <typename _Tp, typename _Alloc>\n    typename deque<_Tp, _Alloc>::iterator\n    deque<_Tp, _Alloc>::\n    insert(iterator __position, const value_type& __x)\n    {\n      if (__position._M_cur == this->_M_impl._M_start._M_cur)\n\t{\n\t  push_front(__x);\n\t  return this->_M_impl._M_start;\n\t}\n      else if (__position._M_cur == this->_M_impl._M_finish._M_cur)\n\t{\n\t  push_back(__x);\n\t  iterator __tmp = this->_M_impl._M_finish;\n\t  --__tmp;\n\t  return __tmp;\n\t}\n      else\n        return _M_insert_aux(__position, __x);\n    }\n\n  template <typename _Tp, typename _Alloc>\n    typename deque<_Tp, _Alloc>::iterator\n    deque<_Tp, _Alloc>::\n    erase(iterator __position)\n    {\n      iterator __next = __position;\n      ++__next;\n      const difference_type __index = __position - begin();\n      if (static_cast<size_type>(__index) < (size() >> 1))\n\t{\n\t  if (__position != begin())\n\t    std::copy_backward(begin(), __position, __next);\n\t  pop_front();\n\t}\n      else\n\t{\n\t  if (__next != end())\n\t    std::copy(__next, end(), __position);\n\t  pop_back();\n\t}\n      return begin() + __index;\n    }\n\n  template <typename _Tp, typename _Alloc>\n    typename deque<_Tp, _Alloc>::iterator\n    deque<_Tp, _Alloc>::\n    erase(iterator __first, iterator __last)\n    {\n      if (__first == begin() && __last == end())\n\t{\n\t  clear();\n\t  return end();\n\t}\n      else\n\t{\n\t  const difference_type __n = __last - __first;\n\t  const difference_type __elems_before = __first - begin();\n\t  if (static_cast<size_type>(__elems_before) <= (size() - __n) / 2)\n\t    {\n\t      if (__first != begin())\n\t\tstd::copy_backward(begin(), __first, __last);\n\t      _M_erase_at_begin(begin() + __n);\n\t    }\n\t  else\n\t    {\n\t      if (__last != end())\n\t\tstd::copy(__last, end(), __first);\n\t      _M_erase_at_end(end() - __n);\n\t    }\n\t  return begin() + __elems_before;\n\t}\n    }\n\n  template <typename _Tp, class _Alloc>\n    template <typename _InputIterator>\n      void\n      deque<_Tp, _Alloc>::\n      _M_assign_aux(_InputIterator __first, _InputIterator __last,\n\t\t    std::input_iterator_tag)\n      {\n        iterator __cur = begin();\n        for (; __first != __last && __cur != end(); ++__cur, ++__first)\n          *__cur = *__first;\n        if (__first == __last)\n          _M_erase_at_end(__cur);\n        else\n          insert(end(), __first, __last);\n      }\n\n  template <typename _Tp, typename _Alloc>\n    void\n    deque<_Tp, _Alloc>::\n    _M_fill_insert(iterator __pos, size_type __n, const value_type& __x)\n    {\n      if (__pos._M_cur == this->_M_impl._M_start._M_cur)\n\t{\n\t  iterator __new_start = _M_reserve_elements_at_front(__n);\n\t  try\n\t    {\n\t      std::__uninitialized_fill_a(__new_start, this->_M_impl._M_start,\n\t\t\t\t\t  __x, _M_get_Tp_allocator());\n\t      this->_M_impl._M_start = __new_start;\n\t    }\n\t  catch(...)\n\t    {\n\t      _M_destroy_nodes(__new_start._M_node,\n\t\t\t       this->_M_impl._M_start._M_node);\n\t      __throw_exception_again;\n\t    }\n\t}\n      else if (__pos._M_cur == this->_M_impl._M_finish._M_cur)\n\t{\n\t  iterator __new_finish = _M_reserve_elements_at_back(__n);\n\t  try\n\t    {\n\t      std::__uninitialized_fill_a(this->_M_impl._M_finish,\n\t\t\t\t\t  __new_finish, __x,\n\t\t\t\t\t  _M_get_Tp_allocator());\n\t      this->_M_impl._M_finish = __new_finish;\n\t    }\n\t  catch(...)\n\t    {\n\t      _M_destroy_nodes(this->_M_impl._M_finish._M_node + 1,\n\t\t\t       __new_finish._M_node + 1);\n\t      __throw_exception_again;\n\t    }\n\t}\n      else\n        _M_insert_aux(__pos, __n, __x);\n    }\n\n  template <typename _Tp, typename _Alloc>\n    void\n    deque<_Tp, _Alloc>::\n    _M_fill_initialize(const value_type& __value)\n    {\n      _Map_pointer __cur;\n      try\n        {\n          for (__cur = this->_M_impl._M_start._M_node;\n\t       __cur < this->_M_impl._M_finish._M_node;\n\t       ++__cur)\n            std::__uninitialized_fill_a(*__cur, *__cur + _S_buffer_size(),\n\t\t\t\t\t__value, _M_get_Tp_allocator());\n          std::__uninitialized_fill_a(this->_M_impl._M_finish._M_first,\n\t\t\t\t      this->_M_impl._M_finish._M_cur,\n\t\t\t\t      __value, _M_get_Tp_allocator());\n        }\n      catch(...)\n        {\n          std::_Destroy(this->_M_impl._M_start, iterator(*__cur, __cur),\n\t\t\t_M_get_Tp_allocator());\n          __throw_exception_again;\n        }\n    }\n\n  template <typename _Tp, typename _Alloc>\n    template <typename _InputIterator>\n      void\n      deque<_Tp, _Alloc>::\n      _M_range_initialize(_InputIterator __first, _InputIterator __last,\n                          std::input_iterator_tag)\n      {\n        this->_M_initialize_map(0);\n        try\n          {\n            for (; __first != __last; ++__first)\n              push_back(*__first);\n          }\n        catch(...)\n          {\n            clear();\n            __throw_exception_again;\n          }\n      }\n\n  template <typename _Tp, typename _Alloc>\n    template <typename _ForwardIterator>\n      void\n      deque<_Tp, _Alloc>::\n      _M_range_initialize(_ForwardIterator __first, _ForwardIterator __last,\n                          std::forward_iterator_tag)\n      {\n        const size_type __n = std::distance(__first, __last);\n        this->_M_initialize_map(__n);\n\n        _Map_pointer __cur_node;\n        try\n          {\n            for (__cur_node = this->_M_impl._M_start._M_node;\n                 __cur_node < this->_M_impl._M_finish._M_node;\n                 ++__cur_node)\n\t      {\n\t\t_ForwardIterator __mid = __first;\n\t\tstd::advance(__mid, _S_buffer_size());\n\t\tstd::__uninitialized_copy_a(__first, __mid, *__cur_node,\n\t\t\t\t\t    _M_get_Tp_allocator());\n\t\t__first = __mid;\n\t      }\n            std::__uninitialized_copy_a(__first, __last,\n\t\t\t\t\tthis->_M_impl._M_finish._M_first,\n\t\t\t\t\t_M_get_Tp_allocator());\n          }\n        catch(...)\n          {\n            std::_Destroy(this->_M_impl._M_start,\n\t\t\t  iterator(*__cur_node, __cur_node),\n\t\t\t  _M_get_Tp_allocator());\n            __throw_exception_again;\n          }\n      }\n\n  // Called only if _M_impl._M_finish._M_cur == _M_impl._M_finish._M_last - 1.\n  template <typename _Tp, typename _Alloc>\n    void\n    deque<_Tp, _Alloc>::\n    _M_push_back_aux(const value_type& __t)\n    {\n      value_type __t_copy = __t;\n      _M_reserve_map_at_back();\n      *(this->_M_impl._M_finish._M_node + 1) = this->_M_allocate_node();\n      try\n        {\n          this->_M_impl.construct(this->_M_impl._M_finish._M_cur, __t_copy);\n          this->_M_impl._M_finish._M_set_node(this->_M_impl._M_finish._M_node\n\t\t\t\t\t      + 1);\n          this->_M_impl._M_finish._M_cur = this->_M_impl._M_finish._M_first;\n        }\n      catch(...)\n        {\n          _M_deallocate_node(*(this->_M_impl._M_finish._M_node + 1));\n          __throw_exception_again;\n        }\n    }\n\n  // Called only if _M_impl._M_start._M_cur == _M_impl._M_start._M_first.\n  template <typename _Tp, typename _Alloc>\n    void\n    deque<_Tp, _Alloc>::\n    _M_push_front_aux(const value_type& __t)\n    {\n      value_type __t_copy = __t;\n      _M_reserve_map_at_front();\n      *(this->_M_impl._M_start._M_node - 1) = this->_M_allocate_node();\n      try\n        {\n          this->_M_impl._M_start._M_set_node(this->_M_impl._M_start._M_node\n\t\t\t\t\t     - 1);\n          this->_M_impl._M_start._M_cur = this->_M_impl._M_start._M_last - 1;\n          this->_M_impl.construct(this->_M_impl._M_start._M_cur, __t_copy);\n        }\n      catch(...)\n        {\n          ++this->_M_impl._M_start;\n          _M_deallocate_node(*(this->_M_impl._M_start._M_node - 1));\n          __throw_exception_again;\n        }\n    }\n\n  // Called only if _M_impl._M_finish._M_cur == _M_impl._M_finish._M_first.\n  template <typename _Tp, typename _Alloc>\n    void deque<_Tp, _Alloc>::\n    _M_pop_back_aux()\n    {\n      _M_deallocate_node(this->_M_impl._M_finish._M_first);\n      this->_M_impl._M_finish._M_set_node(this->_M_impl._M_finish._M_node - 1);\n      this->_M_impl._M_finish._M_cur = this->_M_impl._M_finish._M_last - 1;\n      this->_M_impl.destroy(this->_M_impl._M_finish._M_cur);\n    }\n\n  // Called only if _M_impl._M_start._M_cur == _M_impl._M_start._M_last - 1.\n  // Note that if the deque has at least one element (a precondition for this\n  // member function), and if\n  //   _M_impl._M_start._M_cur == _M_impl._M_start._M_last,\n  // then the deque must have at least two nodes.\n  template <typename _Tp, typename _Alloc>\n    void deque<_Tp, _Alloc>::\n    _M_pop_front_aux()\n    {\n      this->_M_impl.destroy(this->_M_impl._M_start._M_cur);\n      _M_deallocate_node(this->_M_impl._M_start._M_first);\n      this->_M_impl._M_start._M_set_node(this->_M_impl._M_start._M_node + 1);\n      this->_M_impl._M_start._M_cur = this->_M_impl._M_start._M_first;\n    }\n\n  template <typename _Tp, typename _Alloc>\n    template <typename _InputIterator>\n      void\n      deque<_Tp, _Alloc>::\n      _M_range_insert_aux(iterator __pos,\n                          _InputIterator __first, _InputIterator __last,\n                          std::input_iterator_tag)\n      { std::copy(__first, __last, std::inserter(*this, __pos)); }\n\n  template <typename _Tp, typename _Alloc>\n    template <typename _ForwardIterator>\n      void\n      deque<_Tp, _Alloc>::\n      _M_range_insert_aux(iterator __pos,\n                          _ForwardIterator __first, _ForwardIterator __last,\n                          std::forward_iterator_tag)\n      {\n        const size_type __n = std::distance(__first, __last);\n        if (__pos._M_cur == this->_M_impl._M_start._M_cur)\n\t  {\n\t    iterator __new_start = _M_reserve_elements_at_front(__n);\n\t    try\n\t      {\n\t\tstd::__uninitialized_copy_a(__first, __last, __new_start,\n\t\t\t\t\t    _M_get_Tp_allocator());\n\t\tthis->_M_impl._M_start = __new_start;\n\t      }\n\t    catch(...)\n\t      {\n\t\t_M_destroy_nodes(__new_start._M_node,\n\t\t\t\t this->_M_impl._M_start._M_node);\n\t\t__throw_exception_again;\n\t      }\n\t  }\n        else if (__pos._M_cur == this->_M_impl._M_finish._M_cur)\n\t  {\n\t    iterator __new_finish = _M_reserve_elements_at_back(__n);\n\t    try\n\t      {\n\t\tstd::__uninitialized_copy_a(__first, __last,\n\t\t\t\t\t    this->_M_impl._M_finish,\n\t\t\t\t\t    _M_get_Tp_allocator());\n\t\tthis->_M_impl._M_finish = __new_finish;\n\t      }\n\t    catch(...)\n\t      {\n\t\t_M_destroy_nodes(this->_M_impl._M_finish._M_node + 1,\n\t\t\t\t __new_finish._M_node + 1);\n\t\t__throw_exception_again;\n\t      }\n\t  }\n        else\n          _M_insert_aux(__pos, __first, __last, __n);\n      }\n\n  template <typename _Tp, typename _Alloc>\n    typename deque<_Tp, _Alloc>::iterator\n    deque<_Tp, _Alloc>::\n    _M_insert_aux(iterator __pos, const value_type& __x)\n    {\n      difference_type __index = __pos - this->_M_impl._M_start;\n      value_type __x_copy = __x; // XXX copy\n      if (static_cast<size_type>(__index) < size() / 2)\n\t{\n\t  push_front(front());\n\t  iterator __front1 = this->_M_impl._M_start;\n\t  ++__front1;\n\t  iterator __front2 = __front1;\n\t  ++__front2;\n\t  __pos = this->_M_impl._M_start + __index;\n\t  iterator __pos1 = __pos;\n\t  ++__pos1;\n\t  std::copy(__front2, __pos1, __front1);\n\t}\n      else\n\t{\n\t  push_back(back());\n\t  iterator __back1 = this->_M_impl._M_finish;\n\t  --__back1;\n\t  iterator __back2 = __back1;\n\t  --__back2;\n\t  __pos = this->_M_impl._M_start + __index;\n\t  std::copy_backward(__pos, __back2, __back1);\n\t}\n      *__pos = __x_copy;\n      return __pos;\n    }\n\n  template <typename _Tp, typename _Alloc>\n    void\n    deque<_Tp, _Alloc>::\n    _M_insert_aux(iterator __pos, size_type __n, const value_type& __x)\n    {\n      const difference_type __elems_before = __pos - this->_M_impl._M_start;\n      const size_type __length = this->size();\n      value_type __x_copy = __x;\n      if (__elems_before < difference_type(__length / 2))\n\t{\n\t  iterator __new_start = _M_reserve_elements_at_front(__n);\n\t  iterator __old_start = this->_M_impl._M_start;\n\t  __pos = this->_M_impl._M_start + __elems_before;\n\t  try\n\t    {\n\t      if (__elems_before >= difference_type(__n))\n\t\t{\n\t\t  iterator __start_n = (this->_M_impl._M_start\n\t\t\t\t\t+ difference_type(__n));\n\t\t  std::__uninitialized_copy_a(this->_M_impl._M_start,\n\t\t\t\t\t      __start_n, __new_start,\n\t\t\t\t\t      _M_get_Tp_allocator());\n\t\t  this->_M_impl._M_start = __new_start;\n\t\t  std::copy(__start_n, __pos, __old_start);\n\t\t  std::fill(__pos - difference_type(__n), __pos, __x_copy);\n\t\t}\n\t      else\n\t\t{\n\t\t  std::__uninitialized_copy_fill(this->_M_impl._M_start,\n\t\t\t\t\t\t __pos, __new_start,\n\t\t\t\t\t\t this->_M_impl._M_start,\n\t\t\t\t\t\t __x_copy,\n\t\t\t\t\t\t _M_get_Tp_allocator());\n\t\t  this->_M_impl._M_start = __new_start;\n\t\t  std::fill(__old_start, __pos, __x_copy);\n\t\t}\n\t    }\n\t  catch(...)\n\t    {\n\t      _M_destroy_nodes(__new_start._M_node,\n\t\t\t       this->_M_impl._M_start._M_node);\n\t      __throw_exception_again;\n\t    }\n\t}\n      else\n\t{\n\t  iterator __new_finish = _M_reserve_elements_at_back(__n);\n\t  iterator __old_finish = this->_M_impl._M_finish;\n\t  const difference_type __elems_after =\n\t    difference_type(__length) - __elems_before;\n\t  __pos = this->_M_impl._M_finish - __elems_after;\n\t  try\n\t    {\n\t      if (__elems_after > difference_type(__n))\n\t\t{\n\t\t  iterator __finish_n = (this->_M_impl._M_finish\n\t\t\t\t\t - difference_type(__n));\n\t\t  std::__uninitialized_copy_a(__finish_n,\n\t\t\t\t\t      this->_M_impl._M_finish,\n\t\t\t\t\t      this->_M_impl._M_finish,\n\t\t\t\t\t      _M_get_Tp_allocator());\n\t\t  this->_M_impl._M_finish = __new_finish;\n\t\t  std::copy_backward(__pos, __finish_n, __old_finish);\n\t\t  std::fill(__pos, __pos + difference_type(__n), __x_copy);\n\t\t}\n\t      else\n\t\t{\n\t\t  std::__uninitialized_fill_copy(this->_M_impl._M_finish,\n\t\t\t\t\t\t __pos + difference_type(__n),\n\t\t\t\t\t\t __x_copy, __pos,\n\t\t\t\t\t\t this->_M_impl._M_finish,\n\t\t\t\t\t\t _M_get_Tp_allocator());\n\t\t  this->_M_impl._M_finish = __new_finish;\n\t\t  std::fill(__pos, __old_finish, __x_copy);\n\t\t}\n\t    }\n\t  catch(...)\n\t    {\n\t      _M_destroy_nodes(this->_M_impl._M_finish._M_node + 1,\n\t\t\t       __new_finish._M_node + 1);\n\t      __throw_exception_again;\n\t    }\n\t}\n    }\n\n  template <typename _Tp, typename _Alloc>\n    template <typename _ForwardIterator>\n      void\n      deque<_Tp, _Alloc>::\n      _M_insert_aux(iterator __pos,\n                    _ForwardIterator __first, _ForwardIterator __last,\n                    size_type __n)\n      {\n        const difference_type __elemsbefore = __pos - this->_M_impl._M_start;\n        const size_type __length = size();\n        if (static_cast<size_type>(__elemsbefore) < __length / 2)\n\t  {\n\t    iterator __new_start = _M_reserve_elements_at_front(__n);\n\t    iterator __old_start = this->_M_impl._M_start;\n\t    __pos = this->_M_impl._M_start + __elemsbefore;\n\t    try\n\t      {\n\t\tif (__elemsbefore >= difference_type(__n))\n\t\t  {\n\t\t    iterator __start_n = (this->_M_impl._M_start\n\t\t\t\t\t  + difference_type(__n));\n\t\t    std::__uninitialized_copy_a(this->_M_impl._M_start,\n\t\t\t\t\t\t__start_n, __new_start,\n\t\t\t\t\t\t_M_get_Tp_allocator());\n\t\t    this->_M_impl._M_start = __new_start;\n\t\t    std::copy(__start_n, __pos, __old_start);\n\t\t    std::copy(__first, __last, __pos - difference_type(__n));\n\t\t  }\n\t\telse\n\t\t  {\n\t\t    _ForwardIterator __mid = __first;\n\t\t    std::advance(__mid, difference_type(__n) - __elemsbefore);\n\t\t    std::__uninitialized_copy_copy(this->_M_impl._M_start,\n\t\t\t\t\t\t   __pos, __first, __mid,\n\t\t\t\t\t\t   __new_start,\n\t\t\t\t\t\t   _M_get_Tp_allocator());\n\t\t    this->_M_impl._M_start = __new_start;\n\t\t    std::copy(__mid, __last, __old_start);\n\t\t  }\n\t      }\n\t    catch(...)\n\t      {\n\t\t_M_destroy_nodes(__new_start._M_node,\n\t\t\t\t this->_M_impl._M_start._M_node);\n\t\t__throw_exception_again;\n\t      }\n\t  }\n        else\n        {\n          iterator __new_finish = _M_reserve_elements_at_back(__n);\n          iterator __old_finish = this->_M_impl._M_finish;\n          const difference_type __elemsafter =\n            difference_type(__length) - __elemsbefore;\n          __pos = this->_M_impl._M_finish - __elemsafter;\n          try\n            {\n              if (__elemsafter > difference_type(__n))\n\t\t{\n\t\t  iterator __finish_n = (this->_M_impl._M_finish\n\t\t\t\t\t - difference_type(__n));\n\t\t  std::__uninitialized_copy_a(__finish_n,\n\t\t\t\t\t      this->_M_impl._M_finish,\n\t\t\t\t\t      this->_M_impl._M_finish,\n\t\t\t\t\t      _M_get_Tp_allocator());\n\t\t  this->_M_impl._M_finish = __new_finish;\n\t\t  std::copy_backward(__pos, __finish_n, __old_finish);\n\t\t  std::copy(__first, __last, __pos);\n\t\t}\n              else\n\t\t{\n\t\t  _ForwardIterator __mid = __first;\n\t\t  std::advance(__mid, __elemsafter);\n\t\t  std::__uninitialized_copy_copy(__mid, __last, __pos,\n\t\t\t\t\t\t this->_M_impl._M_finish,\n\t\t\t\t\t\t this->_M_impl._M_finish,\n\t\t\t\t\t\t _M_get_Tp_allocator());\n\t\t  this->_M_impl._M_finish = __new_finish;\n\t\t  std::copy(__first, __mid, __pos);\n\t\t}\n            }\n          catch(...)\n            {\n              _M_destroy_nodes(this->_M_impl._M_finish._M_node + 1,\n\t\t\t       __new_finish._M_node + 1);\n              __throw_exception_again;\n            }\n        }\n      }\n\n   template<typename _Tp, typename _Alloc>\n     void\n     deque<_Tp, _Alloc>::\n     _M_destroy_data_aux(iterator __first, iterator __last)\n     {\n       for (_Map_pointer __node = __first._M_node + 1;\n\t    __node < __last._M_node; ++__node)\n\t std::_Destroy(*__node, *__node + _S_buffer_size(),\n\t\t       _M_get_Tp_allocator());\n\n       if (__first._M_node != __last._M_node)\n\t {\n\t   std::_Destroy(__first._M_cur, __first._M_last,\n\t\t\t _M_get_Tp_allocator());\n\t   std::_Destroy(__last._M_first, __last._M_cur,\n\t\t\t _M_get_Tp_allocator());\n\t }\n       else\n\t std::_Destroy(__first._M_cur, __last._M_cur,\n\t\t       _M_get_Tp_allocator());\n     }\n\n  template <typename _Tp, typename _Alloc>\n    void\n    deque<_Tp, _Alloc>::\n    _M_new_elements_at_front(size_type __new_elems)\n    {\n      if (this->max_size() - this->size() < __new_elems)\n\t__throw_length_error(__N(\"deque::_M_new_elements_at_front\"));\n\n      const size_type __new_nodes = ((__new_elems + _S_buffer_size() - 1)\n\t\t\t\t     / _S_buffer_size());\n      _M_reserve_map_at_front(__new_nodes);\n      size_type __i;\n      try\n        {\n          for (__i = 1; __i <= __new_nodes; ++__i)\n            *(this->_M_impl._M_start._M_node - __i) = this->_M_allocate_node();\n        }\n      catch(...)\n        {\n          for (size_type __j = 1; __j < __i; ++__j)\n            _M_deallocate_node(*(this->_M_impl._M_start._M_node - __j));\n          __throw_exception_again;\n        }\n    }\n\n  template <typename _Tp, typename _Alloc>\n    void\n    deque<_Tp, _Alloc>::\n    _M_new_elements_at_back(size_type __new_elems)\n    {\n      if (this->max_size() - this->size() < __new_elems)\n\t__throw_length_error(__N(\"deque::_M_new_elements_at_back\"));\n\n      const size_type __new_nodes = ((__new_elems + _S_buffer_size() - 1)\n\t\t\t\t     / _S_buffer_size());\n      _M_reserve_map_at_back(__new_nodes);\n      size_type __i;\n      try\n        {\n          for (__i = 1; __i <= __new_nodes; ++__i)\n            *(this->_M_impl._M_finish._M_node + __i) = this->_M_allocate_node();\n        }\n      catch(...)\n        {\n          for (size_type __j = 1; __j < __i; ++__j)\n            _M_deallocate_node(*(this->_M_impl._M_finish._M_node + __j));\n          __throw_exception_again;\n        }\n    }\n\n  template <typename _Tp, typename _Alloc>\n    void\n    deque<_Tp, _Alloc>::\n    _M_reallocate_map(size_type __nodes_to_add, bool __add_at_front)\n    {\n      const size_type __old_num_nodes\n\t= this->_M_impl._M_finish._M_node - this->_M_impl._M_start._M_node + 1;\n      const size_type __new_num_nodes = __old_num_nodes + __nodes_to_add;\n\n      _Map_pointer __new_nstart;\n      if (this->_M_impl._M_map_size > 2 * __new_num_nodes)\n\t{\n\t  __new_nstart = this->_M_impl._M_map + (this->_M_impl._M_map_size\n\t\t\t\t\t - __new_num_nodes) / 2\n\t                 + (__add_at_front ? __nodes_to_add : 0);\n\t  if (__new_nstart < this->_M_impl._M_start._M_node)\n\t    std::copy(this->_M_impl._M_start._M_node,\n\t\t      this->_M_impl._M_finish._M_node + 1,\n\t\t      __new_nstart);\n\t  else\n\t    std::copy_backward(this->_M_impl._M_start._M_node,\n\t\t\t       this->_M_impl._M_finish._M_node + 1,\n\t\t\t       __new_nstart + __old_num_nodes);\n\t}\n      else\n\t{\n\t  size_type __new_map_size = this->_M_impl._M_map_size\n\t                             + std::max(this->_M_impl._M_map_size,\n\t\t\t\t\t\t__nodes_to_add) + 2;\n\n\t  _Map_pointer __new_map = this->_M_allocate_map(__new_map_size);\n\t  __new_nstart = __new_map + (__new_map_size - __new_num_nodes) / 2\n\t                 + (__add_at_front ? __nodes_to_add : 0);\n\t  std::copy(this->_M_impl._M_start._M_node,\n\t\t    this->_M_impl._M_finish._M_node + 1,\n\t\t    __new_nstart);\n\t  _M_deallocate_map(this->_M_impl._M_map, this->_M_impl._M_map_size);\n\n\t  this->_M_impl._M_map = __new_map;\n\t  this->_M_impl._M_map_size = __new_map_size;\n\t}\n\n      this->_M_impl._M_start._M_set_node(__new_nstart);\n      this->_M_impl._M_finish._M_set_node(__new_nstart + __old_num_nodes - 1);\n    }\n\n  // Overload for deque::iterators, exploiting the \"segmented-iterator\n  // optimization\".  NB: leave const_iterators alone!\n  template<typename _Tp>\n    void\n    fill(const _Deque_iterator<_Tp, _Tp&, _Tp*>& __first,\n\t const _Deque_iterator<_Tp, _Tp&, _Tp*>& __last, const _Tp& __value)\n    {\n      typedef typename _Deque_iterator<_Tp, _Tp&, _Tp*>::_Self _Self;\n\n      for (typename _Self::_Map_pointer __node = __first._M_node + 1;\n           __node < __last._M_node; ++__node)\n\tstd::fill(*__node, *__node + _Self::_S_buffer_size(), __value);\n\n      if (__first._M_node != __last._M_node)\n\t{\n\t  std::fill(__first._M_cur, __first._M_last, __value);\n\t  std::fill(__last._M_first, __last._M_cur, __value);\n\t}\n      else\n\tstd::fill(__first._M_cur, __last._M_cur, __value);\n    }\n\n_GLIBCXX_END_NESTED_NAMESPACE\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/bits/fstream.tcc",
    "content": "// File based streams -*- C++ -*-\n\n// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006\n// Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n/** @file fstream.tcc\n *  This is an internal header file, included by other library headers.\n *  You should not attempt to use it directly.\n */\n\n//\n// ISO C++ 14882: 27.8  File-based streams\n//\n\n#ifndef _FSTREAM_TCC\n#define _FSTREAM_TCC 1\n\n#pragma GCC system_header\n\n_GLIBCXX_BEGIN_NAMESPACE(std)\n\n  template<typename _CharT, typename _Traits>\n    void\n    basic_filebuf<_CharT, _Traits>::\n    _M_allocate_internal_buffer()\n    {\n      // Allocate internal buffer only if one doesn't already exist\n      // (either allocated or provided by the user via setbuf).\n      if (!_M_buf_allocated && !_M_buf)\n\t{\n\t  _M_buf = new char_type[_M_buf_size];\n\t  _M_buf_allocated = true;\n\t}\n    }\n\n  template<typename _CharT, typename _Traits>\n    void\n    basic_filebuf<_CharT, _Traits>::\n    _M_destroy_internal_buffer() throw()\n    {\n      if (_M_buf_allocated)\n\t{\n\t  delete [] _M_buf;\n\t  _M_buf = NULL;\n\t  _M_buf_allocated = false;\n\t}\n      delete [] _M_ext_buf;\n      _M_ext_buf = NULL;\n      _M_ext_buf_size = 0;\n      _M_ext_next = NULL;\n      _M_ext_end = NULL;\n    }\n\n  template<typename _CharT, typename _Traits>\n    basic_filebuf<_CharT, _Traits>::\n    basic_filebuf() : __streambuf_type(), _M_lock(), _M_file(&_M_lock),\n    _M_mode(ios_base::openmode(0)), _M_state_beg(), _M_state_cur(),\n    _M_state_last(), _M_buf(NULL), _M_buf_size(BUFSIZ),\n    _M_buf_allocated(false), _M_reading(false), _M_writing(false), _M_pback(), \n    _M_pback_cur_save(0), _M_pback_end_save(0), _M_pback_init(false),\n    _M_codecvt(0), _M_ext_buf(0), _M_ext_buf_size(0), _M_ext_next(0),\n    _M_ext_end(0)\n    {\n      if (has_facet<__codecvt_type>(this->_M_buf_locale))\n\t_M_codecvt = &use_facet<__codecvt_type>(this->_M_buf_locale);\n    }\n\n  template<typename _CharT, typename _Traits>\n    typename basic_filebuf<_CharT, _Traits>::__filebuf_type*\n    basic_filebuf<_CharT, _Traits>::\n    open(const char* __s, ios_base::openmode __mode)\n    {\n      __filebuf_type *__ret = NULL;\n      if (!this->is_open())\n\t{\n\t  _M_file.open(__s, __mode);\n\t  if (this->is_open())\n\t    {\n\t      _M_allocate_internal_buffer();\n\t      _M_mode = __mode;\n\n\t      // Setup initial buffer to 'uncommitted' mode.\n\t      _M_reading = false;\n\t      _M_writing = false;\n\t      _M_set_buffer(-1);\n\n\t      // Reset to initial state.\n\t      _M_state_last = _M_state_cur = _M_state_beg;\n\n\t      // 27.8.1.3,4\n\t      if ((__mode & ios_base::ate)\n\t\t  && this->seekoff(0, ios_base::end, __mode)\n\t\t  == pos_type(off_type(-1)))\n\t\tthis->close();\n\t      else\n\t\t__ret = this;\n\t    }\n\t}\n      return __ret;\n    }\n\n  template<typename _CharT, typename _Traits>\n    typename basic_filebuf<_CharT, _Traits>::__filebuf_type*\n    basic_filebuf<_CharT, _Traits>::\n    close() throw()\n    {\n      __filebuf_type* __ret = NULL;\n      if (this->is_open())\n\t{\n\t  bool __testfail = false;\n\t  try\n\t    {\n\t      if (!_M_terminate_output())\n\t\t__testfail = true;\n\t    }\n\t  catch(...)\n\t    { __testfail = true; }\n\n\t  // NB: Do this here so that re-opened filebufs will be cool...\n\t  _M_mode = ios_base::openmode(0);\n\t  _M_pback_init = false;\n\t  _M_destroy_internal_buffer();\n\t  _M_reading = false;\n\t  _M_writing = false;\n\t  _M_set_buffer(-1);\n\t  _M_state_last = _M_state_cur = _M_state_beg;\n\n\t  if (!_M_file.close())\n\t    __testfail = true;\n\n\t  if (!__testfail)\n\t    __ret = this;\n\t}\n      return __ret;\n    }\n\n  template<typename _CharT, typename _Traits>\n    streamsize\n    basic_filebuf<_CharT, _Traits>::\n    showmanyc()\n    {\n      streamsize __ret = -1;\n      const bool __testin = _M_mode & ios_base::in;\n      if (__testin && this->is_open())\n\t{\n\t  // For a stateful encoding (-1) the pending sequence might be just\n\t  // shift and unshift prefixes with no actual character.\n\t  __ret = this->egptr() - this->gptr();\n\n#if _GLIBCXX_HAVE_DOS_BASED_FILESYSTEM\n\t  // About this workaround, see libstdc++/20806.\n\t  const bool __testbinary = _M_mode & ios_base::binary;\n\t  if (__check_facet(_M_codecvt).encoding() >= 0\n\t      && __testbinary)\n#else\n\t  if (__check_facet(_M_codecvt).encoding() >= 0)\n#endif\n\t    __ret += _M_file.showmanyc() / _M_codecvt->max_length();\n\t}\n      return __ret;\n    }\n\n  template<typename _CharT, typename _Traits>\n    typename basic_filebuf<_CharT, _Traits>::int_type\n    basic_filebuf<_CharT, _Traits>::\n    underflow()\n    {\n      int_type __ret = traits_type::eof();\n      const bool __testin = _M_mode & ios_base::in;\n      if (__testin && !_M_writing)\n\t{\n\t  // Check for pback madness, and if so swich back to the\n\t  // normal buffers and jet outta here before expensive\n\t  // fileops happen...\n\t  _M_destroy_pback();\n\n\t  if (this->gptr() < this->egptr())\n\t    return traits_type::to_int_type(*this->gptr());\n\n\t  // Get and convert input sequence.\n\t  const size_t __buflen = _M_buf_size > 1 ? _M_buf_size - 1 : 1;\n\n\t  // Will be set to true if ::read() returns 0 indicating EOF.\n\t  bool __got_eof = false;\n\t  // Number of internal characters produced.\n\t  streamsize __ilen = 0;\n\t  codecvt_base::result __r = codecvt_base::ok;\n\t  if (__check_facet(_M_codecvt).always_noconv())\n\t    {\n\t      __ilen = _M_file.xsgetn(reinterpret_cast<char*>(this->eback()),\n\t\t\t\t      __buflen);\n\t      if (__ilen == 0)\n\t\t__got_eof = true;\n\t    }\n\t  else\n\t    {\n              // Worst-case number of external bytes.\n\t      // XXX Not done encoding() == -1.\n\t      const int __enc = _M_codecvt->encoding();\n\t      streamsize __blen; // Minimum buffer size.\n\t      streamsize __rlen; // Number of chars to read.\n\t      if (__enc > 0)\n\t\t__blen = __rlen = __buflen * __enc;\n\t      else\n\t\t{\n\t\t  __blen = __buflen + _M_codecvt->max_length() - 1;\n\t\t  __rlen = __buflen;\n\t\t}\n\t      const streamsize __remainder = _M_ext_end - _M_ext_next;\n\t      __rlen = __rlen > __remainder ? __rlen - __remainder : 0;\n\n\t      // An imbue in 'read' mode implies first converting the external\n\t      // chars already present.\n\t      if (_M_reading && this->egptr() == this->eback() && __remainder)\n\t\t__rlen = 0;\n\n\t      // Allocate buffer if necessary and move unconverted\n\t      // bytes to front.\n\t      if (_M_ext_buf_size < __blen)\n\t\t{\n\t\t  char* __buf = new char[__blen];\n\t\t  if (__remainder)\n\t\t    std::memcpy(__buf, _M_ext_next, __remainder);\n\n\t\t  delete [] _M_ext_buf;\n\t\t  _M_ext_buf = __buf;\n\t\t  _M_ext_buf_size = __blen;\n\t\t}\n\t      else if (__remainder)\n\t\tstd::memmove(_M_ext_buf, _M_ext_next, __remainder);\n\n\t      _M_ext_next = _M_ext_buf;\n\t      _M_ext_end = _M_ext_buf + __remainder;\n\t      _M_state_last = _M_state_cur;\n\n\t      do\n\t\t{\n\t\t  if (__rlen > 0)\n\t\t    {\n\t\t      // Sanity check!\n\t\t      // This may fail if the return value of\n\t\t      // codecvt::max_length() is bogus.\n\t\t      if (_M_ext_end - _M_ext_buf + __rlen > _M_ext_buf_size)\n\t\t\t{\n\t\t\t  __throw_ios_failure(__N(\"basic_filebuf::underflow \"\n\t\t\t\t\t      \"codecvt::max_length() \"\n\t\t\t\t\t      \"is not valid\"));\n\t\t\t}\n\t\t      streamsize __elen = _M_file.xsgetn(_M_ext_end, __rlen);\n\t\t      if (__elen == 0)\n\t\t\t__got_eof = true;\n\t\t      else if (__elen == -1)\n\t\t\tbreak;\n\t\t      _M_ext_end += __elen;\n\t\t    }\n\n\t\t  char_type* __iend;\n\t\t  __r = _M_codecvt->in(_M_state_cur, _M_ext_next,\n\t\t\t\t       _M_ext_end, _M_ext_next, this->eback(),\n\t\t\t\t       this->eback() + __buflen, __iend);\n\t\t  if (__r == codecvt_base::noconv)\n\t\t    {\n\t\t      size_t __avail = _M_ext_end - _M_ext_buf;\n\t\t      __ilen = std::min(__avail, __buflen);\n\t\t      traits_type::copy(this->eback(),\n\t\t\t\t\treinterpret_cast<char_type*>(_M_ext_buf), __ilen);\n\t\t      _M_ext_next = _M_ext_buf + __ilen;\n\t\t    }\n\t\t  else\n\t\t    __ilen = __iend - this->eback();\n\n\t\t  // _M_codecvt->in may return error while __ilen > 0: this is\n\t\t  // ok, and actually occurs in case of mixed encodings (e.g.,\n\t\t  // XML files).\n\t\t  if (__r == codecvt_base::error)\n\t\t    break;\n\n\t\t  __rlen = 1;\n\t\t}\n\t      while (__ilen == 0 && !__got_eof);\n\t    }\n\n\t  if (__ilen > 0)\n\t    {\n\t      _M_set_buffer(__ilen);\n\t      _M_reading = true;\n\t      __ret = traits_type::to_int_type(*this->gptr());\n\t    }\n\t  else if (__got_eof)\n\t    {\n\t      // If the actual end of file is reached, set 'uncommitted'\n\t      // mode, thus allowing an immediate write without an\n\t      // intervening seek.\n\t      _M_set_buffer(-1);\n\t      _M_reading = false;\n\t      // However, reaching it while looping on partial means that\n\t      // the file has got an incomplete character.\n\t      if (__r == codecvt_base::partial)\n\t\t__throw_ios_failure(__N(\"basic_filebuf::underflow \"\n\t\t\t\t    \"incomplete character in file\"));\n\t    }\n\t  else if (__r == codecvt_base::error)\n\t    __throw_ios_failure(__N(\"basic_filebuf::underflow \"\n\t\t\t\t\"invalid byte sequence in file\"));\n\t  else\n\t    __throw_ios_failure(__N(\"basic_filebuf::underflow \"\n\t\t\t\t\"error reading the file\"));\n\t}\n      return __ret;\n    }\n\n  template<typename _CharT, typename _Traits>\n    typename basic_filebuf<_CharT, _Traits>::int_type\n    basic_filebuf<_CharT, _Traits>::\n    pbackfail(int_type __i)\n    {\n      int_type __ret = traits_type::eof();\n      const bool __testin = _M_mode & ios_base::in;\n      if (__testin && !_M_writing)\n\t{\n\t  // Remember whether the pback buffer is active, otherwise below\n\t  // we may try to store in it a second char (libstdc++/9761).\n\t  const bool __testpb = _M_pback_init;\n\t  const bool __testeof = traits_type::eq_int_type(__i, __ret);\n\t  int_type __tmp;\n\t  if (this->eback() < this->gptr())\n\t    {\n\t      this->gbump(-1);\n\t      __tmp = traits_type::to_int_type(*this->gptr());\n\t    }\n\t  else if (this->seekoff(-1, ios_base::cur) != pos_type(off_type(-1)))\n\t    {\n\t      __tmp = this->underflow();\n\t      if (traits_type::eq_int_type(__tmp, __ret))\n\t\treturn __ret;\n\t    }\n\t  else\n\t    {\n\t      // At the beginning of the buffer, need to make a\n\t      // putback position available.  But the seek may fail\n\t      // (f.i., at the beginning of a file, see\n\t      // libstdc++/9439) and in that case we return\n\t      // traits_type::eof().\n\t      return __ret;\n\t    }\n\n\t  // Try to put back __i into input sequence in one of three ways.\n\t  // Order these tests done in is unspecified by the standard.\n\t  if (!__testeof && traits_type::eq_int_type(__i, __tmp))\n\t    __ret = __i;\n\t  else if (__testeof)\n\t    __ret = traits_type::not_eof(__i);\n\t  else if (!__testpb)\n\t    {\n\t      _M_create_pback();\n\t      _M_reading = true;\n\t      *this->gptr() = traits_type::to_char_type(__i);\n\t      __ret = __i;\n\t    }\n\t}\n      return __ret;\n    }\n\n  template<typename _CharT, typename _Traits>\n    typename basic_filebuf<_CharT, _Traits>::int_type\n    basic_filebuf<_CharT, _Traits>::\n    overflow(int_type __c)\n    {\n      int_type __ret = traits_type::eof();\n      const bool __testeof = traits_type::eq_int_type(__c, __ret);\n      const bool __testout = _M_mode & ios_base::out;\n      if (__testout && !_M_reading)\n\t{\n\t  if (this->pbase() < this->pptr())\n\t    {\n\t      // If appropriate, append the overflow char.\n\t      if (!__testeof)\n\t\t{\n\t\t  *this->pptr() = traits_type::to_char_type(__c);\n\t\t  this->pbump(1);\n\t\t}\n\n\t      // Convert pending sequence to external representation,\n\t      // and output.\n\t      if (_M_convert_to_external(this->pbase(),\n\t\t\t\t\t this->pptr() - this->pbase()))\n\t\t{\n\t\t  _M_set_buffer(0);\n\t\t  __ret = traits_type::not_eof(__c);\n\t\t}\n\t    }\n\t  else if (_M_buf_size > 1)\n\t    {\n\t      // Overflow in 'uncommitted' mode: set _M_writing, set\n\t      // the buffer to the initial 'write' mode, and put __c\n\t      // into the buffer.\n\t      _M_set_buffer(0);\n\t      _M_writing = true;\n\t      if (!__testeof)\n\t\t{\n\t\t  *this->pptr() = traits_type::to_char_type(__c);\n\t\t  this->pbump(1);\n\t\t}\n\t      __ret = traits_type::not_eof(__c);\n\t    }\n\t  else\n\t    {\n\t      // Unbuffered.\n\t      char_type __conv = traits_type::to_char_type(__c);\n\t      if (__testeof || _M_convert_to_external(&__conv, 1))\n\t\t{\n\t\t  _M_writing = true;\n\t\t  __ret = traits_type::not_eof(__c);\n\t\t}\n\t    }\n\t}\n      return __ret;\n    }\n\n  template<typename _CharT, typename _Traits>\n    bool\n    basic_filebuf<_CharT, _Traits>::\n    _M_convert_to_external(_CharT* __ibuf, streamsize __ilen)\n    {\n      // Sizes of external and pending output.\n      streamsize __elen;\n      streamsize __plen;\n      if (__check_facet(_M_codecvt).always_noconv())\n\t{\n\t  __elen = _M_file.xsputn(reinterpret_cast<char*>(__ibuf), __ilen);\n\t  __plen = __ilen;\n\t}\n      else\n\t{\n\t  // Worst-case number of external bytes needed.\n\t  // XXX Not done encoding() == -1.\n\t  streamsize __blen = __ilen * _M_codecvt->max_length();\n\t  char* __buf = static_cast<char*>(__builtin_alloca(__blen));\n\n\t  char* __bend;\n\t  const char_type* __iend;\n\t  codecvt_base::result __r;\n\t  __r = _M_codecvt->out(_M_state_cur, __ibuf, __ibuf + __ilen,\n\t\t\t\t__iend, __buf, __buf + __blen, __bend);\n\n\t  if (__r == codecvt_base::ok || __r == codecvt_base::partial)\n\t    __blen = __bend - __buf;\n\t  else if (__r == codecvt_base::noconv)\n\t    {\n\t      // Same as the always_noconv case above.\n\t      __buf = reinterpret_cast<char*>(__ibuf);\n\t      __blen = __ilen;\n\t    }\n\t  else\n\t    __throw_ios_failure(__N(\"basic_filebuf::_M_convert_to_external \"\n\t\t\t\t    \"conversion error\"));\n  \n\t  __elen = _M_file.xsputn(__buf, __blen);\n\t  __plen = __blen;\n\n\t  // Try once more for partial conversions.\n\t  if (__r == codecvt_base::partial && __elen == __plen)\n\t    {\n\t      const char_type* __iresume = __iend;\n\t      streamsize __rlen = this->pptr() - __iend;\n\t      __r = _M_codecvt->out(_M_state_cur, __iresume,\n\t\t\t\t    __iresume + __rlen, __iend, __buf,\n\t\t\t\t    __buf + __blen, __bend);\n\t      if (__r != codecvt_base::error)\n\t\t{\n\t\t  __rlen = __bend - __buf;\n\t\t  __elen = _M_file.xsputn(__buf, __rlen);\n\t\t  __plen = __rlen;\n\t\t}\n\t      else\n\t\t__throw_ios_failure(__N(\"basic_filebuf::_M_convert_to_external \"\n\t\t\t\t\t\"conversion error\"));\n\t    }\n\t}\n      return __elen == __plen;\n    }\n\n   template<typename _CharT, typename _Traits>\n     streamsize\n     basic_filebuf<_CharT, _Traits>::\n     xsgetn(_CharT* __s, streamsize __n)\n     {\n       // Clear out pback buffer before going on to the real deal...\n       streamsize __ret = 0;\n       if (_M_pback_init)\n\t {\n\t   if (__n > 0 && this->gptr() == this->eback())\n\t     {\n\t       *__s++ = *this->gptr();\n\t       this->gbump(1);\n\t       __ret = 1;\n\t       --__n;\n\t     }\n\t   _M_destroy_pback();\n\t }\n       \n       // Optimization in the always_noconv() case, to be generalized in the\n       // future: when __n > __buflen we read directly instead of using the\n       // buffer repeatedly.\n       const bool __testin = _M_mode & ios_base::in;\n       const streamsize __buflen = _M_buf_size > 1 ? _M_buf_size - 1 : 1;\n\n       if (__n > __buflen && __check_facet(_M_codecvt).always_noconv()\n\t   && __testin && !_M_writing)\n\t {\n\t   // First, copy the chars already present in the buffer.\n\t   const streamsize __avail = this->egptr() - this->gptr();\n\t   if (__avail != 0)\n\t     {\n\t       if (__avail == 1)\n\t\t *__s = *this->gptr();\n\t       else\n\t\t traits_type::copy(__s, this->gptr(), __avail);\n\t       __s += __avail;\n\t       this->gbump(__avail);\n\t       __ret += __avail;\n\t       __n -= __avail;\n\t     }\n\n\t   // Need to loop in case of short reads (relatively common\n\t   // with pipes).\n\t   streamsize __len;\n\t   for (;;)\n\t     {\n\t       __len = _M_file.xsgetn(reinterpret_cast<char*>(__s),\n\t\t\t\t      __n);\n\t       if (__len == -1)\n\t\t __throw_ios_failure(__N(\"basic_filebuf::xsgetn \"\n\t\t\t\t\t \"error reading the file\"));\n\t       if (__len == 0)\n\t\t break;\n\n\t       __n -= __len;\n\t       __ret += __len;\n\t       if (__n == 0)\n\t\t break;\n\n\t       __s += __len;\n\t     }\n\n\t   if (__n == 0)\n\t     {\n\t       _M_set_buffer(0);\n\t       _M_reading = true;\n\t     }\n\t   else if (__len == 0)\n\t     {\n\t       // If end of file is reached, set 'uncommitted'\n\t       // mode, thus allowing an immediate write without\n\t       // an intervening seek.\n\t       _M_set_buffer(-1);\n\t       _M_reading = false;\n\t     }\n\t }\n       else\n\t __ret += __streambuf_type::xsgetn(__s, __n);\n\n       return __ret;\n     }\n\n   template<typename _CharT, typename _Traits>\n     streamsize\n     basic_filebuf<_CharT, _Traits>::\n     xsputn(const _CharT* __s, streamsize __n)\n     {\n       // Optimization in the always_noconv() case, to be generalized in the\n       // future: when __n is sufficiently large we write directly instead of\n       // using the buffer.\n       streamsize __ret = 0;\n       const bool __testout = _M_mode & ios_base::out;\n       if (__check_facet(_M_codecvt).always_noconv()\n\t   && __testout && !_M_reading)\n\t{\n\t  // Measurement would reveal the best choice.\n\t  const streamsize __chunk = 1ul << 10;\n\t  streamsize __bufavail = this->epptr() - this->pptr();\n\n\t  // Don't mistake 'uncommitted' mode buffered with unbuffered.\n\t  if (!_M_writing && _M_buf_size > 1)\n\t    __bufavail = _M_buf_size - 1;\n\n\t  const streamsize __limit = std::min(__chunk, __bufavail);\n\t  if (__n >= __limit)\n\t    {\n\t      const streamsize __buffill = this->pptr() - this->pbase();\n\t      const char* __buf = reinterpret_cast<const char*>(this->pbase());\n\t      __ret = _M_file.xsputn_2(__buf, __buffill,\n\t\t\t\t       reinterpret_cast<const char*>(__s),\n\t\t\t\t       __n);\n\t      if (__ret == __buffill + __n)\n\t\t{\n\t\t  _M_set_buffer(0);\n\t\t  _M_writing = true;\n\t\t}\n\t      if (__ret > __buffill)\n\t\t__ret -= __buffill;\n\t      else\n\t\t__ret = 0;\n\t    }\n\t  else\n\t    __ret = __streambuf_type::xsputn(__s, __n);\n\t}\n       else\n\t __ret = __streambuf_type::xsputn(__s, __n);\n       return __ret;\n    }\n\n  template<typename _CharT, typename _Traits>\n    typename basic_filebuf<_CharT, _Traits>::__streambuf_type*\n    basic_filebuf<_CharT, _Traits>::\n    setbuf(char_type* __s, streamsize __n)\n    {\n      if (!this->is_open())\n\tif (__s == 0 && __n == 0)\n\t  _M_buf_size = 1;\n\telse if (__s && __n > 0)\n\t  {\n\t    // This is implementation-defined behavior, and assumes that\n\t    // an external char_type array of length __n exists and has\n\t    // been pre-allocated. If this is not the case, things will\n\t    // quickly blow up. When __n > 1, __n - 1 positions will be\n\t    // used for the get area, __n - 1 for the put area and 1\n\t    // position to host the overflow char of a full put area.\n\t    // When __n == 1, 1 position will be used for the get area\n\t    // and 0 for the put area, as in the unbuffered case above.\n\t    _M_buf = __s;\n\t    _M_buf_size = __n;\n\t  }\n      return this;\n    }\n\n\n  // According to 27.8.1.4 p11 - 13, seekoff should ignore the last\n  // argument (of type openmode).\n  template<typename _CharT, typename _Traits>\n    typename basic_filebuf<_CharT, _Traits>::pos_type\n    basic_filebuf<_CharT, _Traits>::\n    seekoff(off_type __off, ios_base::seekdir __way, ios_base::openmode)\n    {\n      int __width = 0;\n      if (_M_codecvt)\n\t__width = _M_codecvt->encoding();\n      if (__width < 0)\n\t__width = 0;\n\n      pos_type __ret =  pos_type(off_type(-1));\n      const bool __testfail = __off != 0 && __width <= 0;\n      if (this->is_open() && !__testfail)\n\t{\n\t  // Ditch any pback buffers to avoid confusion.\n\t  _M_destroy_pback();\n\n\t  // Correct state at destination. Note that this is the correct\n\t  // state for the current position during output, because\n\t  // codecvt::unshift() returns the state to the initial state.\n\t  // This is also the correct state at the end of the file because\n\t  // an unshift sequence should have been written at the end.\n\t  __state_type __state = _M_state_beg;\n\t  off_type __computed_off = __off * __width;\n\t  if (_M_reading && __way == ios_base::cur)\n\t    {\n\t      if (_M_codecvt->always_noconv())\n\t\t__computed_off += this->gptr() - this->egptr();\n\t      else\n\t\t{\n\t\t  // Calculate offset from _M_ext_buf that corresponds\n\t\t  // to gptr(). Note: uses _M_state_last, which\n\t\t  // corresponds to eback().\n\t\t  const int __gptr_off =\n\t\t    _M_codecvt->length(_M_state_last, _M_ext_buf, _M_ext_next,\n\t\t\t\t       this->gptr() - this->eback());\n\t\t  __computed_off += _M_ext_buf + __gptr_off - _M_ext_end;\n\n\t\t  // _M_state_last is modified by codecvt::length() so\n\t\t  // it now corresponds to gptr().\n\t\t  __state = _M_state_last;\n\t\t}\n\t    }\n\t  __ret = _M_seek(__computed_off, __way, __state);\n\t}\n      return __ret;\n    }\n\n  // _GLIBCXX_RESOLVE_LIB_DEFECTS\n  // 171. Strange seekpos() semantics due to joint position\n  // According to the resolution of DR 171, seekpos should ignore the last\n  // argument (of type openmode).\n  template<typename _CharT, typename _Traits>\n    typename basic_filebuf<_CharT, _Traits>::pos_type\n    basic_filebuf<_CharT, _Traits>::\n    seekpos(pos_type __pos, ios_base::openmode)\n    {\n      pos_type __ret =  pos_type(off_type(-1));\n      if (this->is_open())\n\t{\n\t  // Ditch any pback buffers to avoid confusion.\n\t  _M_destroy_pback();\n\t  __ret = _M_seek(off_type(__pos), ios_base::beg, __pos.state());\n\t}\n      return __ret;\n    }\n\n  template<typename _CharT, typename _Traits>\n    typename basic_filebuf<_CharT, _Traits>::pos_type\n    basic_filebuf<_CharT, _Traits>::\n    _M_seek(off_type __off, ios_base::seekdir __way, __state_type __state)\n    {\n      pos_type __ret = pos_type(off_type(-1));\n      if (_M_terminate_output())\n\t{\n\t  // Returns pos_type(off_type(-1)) in case of failure.\n\t  __ret = pos_type(_M_file.seekoff(__off, __way));\n\t  if (__ret != pos_type(off_type(-1)))\n\t    {\n\t      _M_reading = false;\n\t      _M_writing = false;\n\t      _M_ext_next = _M_ext_end = _M_ext_buf;\n\t      _M_set_buffer(-1);\n\t      _M_state_cur = __state;\n\t      __ret.state(_M_state_cur);\n\t    }\n\t}\n      return __ret;\n    }\n\n  template<typename _CharT, typename _Traits>\n    bool\n    basic_filebuf<_CharT, _Traits>::\n    _M_terminate_output()\n    {\n      // Part one: update the output sequence.\n      bool __testvalid = true;\n      if (this->pbase() < this->pptr())\n\t{\n\t  const int_type __tmp = this->overflow();\n\t  if (traits_type::eq_int_type(__tmp, traits_type::eof()))\n\t    __testvalid = false;\n\t}\n\n      // Part two: output unshift sequence.\n      if (_M_writing && !__check_facet(_M_codecvt).always_noconv()\n\t  && __testvalid)\n\t{\n\t  // Note: this value is arbitrary, since there is no way to\n\t  // get the length of the unshift sequence from codecvt,\n\t  // without calling unshift.\n\t  const size_t __blen = 128;\n\t  char __buf[__blen];\n\t  codecvt_base::result __r;\n\t  streamsize __ilen = 0;\n\n\t  do\n\t    {\n\t      char* __next;\n\t      __r = _M_codecvt->unshift(_M_state_cur, __buf,\n\t\t\t\t\t__buf + __blen, __next);\n\t      if (__r == codecvt_base::error)\n\t\t__testvalid = false;\n\t      else if (__r == codecvt_base::ok ||\n\t\t       __r == codecvt_base::partial)\n\t\t{\n\t\t  __ilen = __next - __buf;\n\t\t  if (__ilen > 0)\n\t\t    {\n\t\t      const streamsize __elen = _M_file.xsputn(__buf, __ilen);\n\t\t      if (__elen != __ilen)\n\t\t\t__testvalid = false;\n\t\t    }\n\t\t}\n\t    }\n\t  while (__r == codecvt_base::partial && __ilen > 0 && __testvalid);\n\n\t  if (__testvalid)\n\t    {\n\t      // This second call to overflow() is required by the standard,\n\t      // but it's not clear why it's needed, since the output buffer\n\t      // should be empty by this point (it should have been emptied\n\t      // in the first call to overflow()).\n\t      const int_type __tmp = this->overflow();\n\t      if (traits_type::eq_int_type(__tmp, traits_type::eof()))\n\t\t__testvalid = false;\n\t    }\n\t}\n      return __testvalid;\n    }\n\n  template<typename _CharT, typename _Traits>\n    int\n    basic_filebuf<_CharT, _Traits>::\n    sync()\n    {\n      // Make sure that the internal buffer resyncs its idea of\n      // the file position with the external file.\n      int __ret = 0;\n      if (this->pbase() < this->pptr())\n\t{\n\t  const int_type __tmp = this->overflow();\n\t  if (traits_type::eq_int_type(__tmp, traits_type::eof()))\n\t    __ret = -1;\n\t}\n      return __ret;\n    }\n\n  template<typename _CharT, typename _Traits>\n    void\n    basic_filebuf<_CharT, _Traits>::\n    imbue(const locale& __loc)\n    {\n      bool __testvalid = true;\n\n      const __codecvt_type* _M_codecvt_tmp = 0;\n      if (__builtin_expect(has_facet<__codecvt_type>(__loc), true))\n\t_M_codecvt_tmp = &use_facet<__codecvt_type>(__loc);\n\n      if (this->is_open())\n\t{\n\t  // encoding() == -1 is ok only at the beginning.\n\t  if ((_M_reading || _M_writing)\n\t      && __check_facet(_M_codecvt).encoding() == -1)\n\t    __testvalid = false;\n\t  else\n\t    {\n\t      if (_M_reading)\n\t\t{\n\t\t  if (__check_facet(_M_codecvt).always_noconv())\n\t\t    {\n\t\t      if (_M_codecvt_tmp\n\t\t\t  && !__check_facet(_M_codecvt_tmp).always_noconv())\n\t\t\t__testvalid = this->seekoff(0, ios_base::cur, _M_mode)\n\t\t\t              != pos_type(off_type(-1));\n\t\t    }\n\t\t  else\n\t\t    {\n\t\t      // External position corresponding to gptr().\n\t\t      _M_ext_next = _M_ext_buf\n\t\t\t+ _M_codecvt->length(_M_state_last, _M_ext_buf, _M_ext_next,\n\t\t\t\t\t     this->gptr() - this->eback());\n\t\t      const streamsize __remainder = _M_ext_end - _M_ext_next;\n\t\t      if (__remainder)\n\t\t\tstd::memmove(_M_ext_buf, _M_ext_next, __remainder);\n\n\t\t      _M_ext_next = _M_ext_buf;\n\t\t      _M_ext_end = _M_ext_buf + __remainder;\n\t\t      _M_set_buffer(-1);\n\t\t      _M_state_last = _M_state_cur = _M_state_beg;\n\t\t    }\n\t\t}\n\t      else if (_M_writing && (__testvalid = _M_terminate_output()))\n\t\t_M_set_buffer(-1);\n\t    }\n\t}\n\n      if (__testvalid)\n\t_M_codecvt = _M_codecvt_tmp;\n      else\n\t_M_codecvt = 0;\n    }\n\n  // Inhibit implicit instantiations for required instantiations,\n  // which are defined via explicit instantiations elsewhere.\n  // NB:  This syntax is a GNU extension.\n#if _GLIBCXX_EXTERN_TEMPLATE\n  extern template class basic_filebuf<char>;\n  extern template class basic_ifstream<char>;\n  extern template class basic_ofstream<char>;\n  extern template class basic_fstream<char>;\n\n#ifdef _GLIBCXX_USE_WCHAR_T\n  extern template class basic_filebuf<wchar_t>;\n  extern template class basic_ifstream<wchar_t>;\n  extern template class basic_ofstream<wchar_t>;\n  extern template class basic_fstream<wchar_t>;\n#endif\n#endif\n\n_GLIBCXX_END_NAMESPACE\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/bits/functexcept.h",
    "content": "// Function-Based Exception Support -*- C++ -*-\n\n// Copyright (C) 2001, 2004, 2005 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n/** @file functexcept.h\n *  This header provides support for -fno-exceptions.\n */\n\n//\n// ISO C++ 14882: 19.1  Exception classes\n//\n\n#ifndef _FUNCTEXCEPT_H\n#define _FUNCTEXCEPT_H 1\n\n#include <bits/c++config.h>\n#include <exception_defines.h>\n\n_GLIBCXX_BEGIN_NAMESPACE(std)\n\n  // Helper for exception objects in <except>\n  void\n  __throw_bad_exception(void) __attribute__((__noreturn__));\n\n  // Helper for exception objects in <new>\n  void\n  __throw_bad_alloc(void) __attribute__((__noreturn__));\n\n  // Helper for exception objects in <typeinfo>\n  void\n  __throw_bad_cast(void) __attribute__((__noreturn__));\n\n  void\n  __throw_bad_typeid(void) __attribute__((__noreturn__));\n\n  // Helpers for exception objects in <stdexcept>\n  void\n  __throw_logic_error(const char*) __attribute__((__noreturn__));\n\n  void\n  __throw_domain_error(const char*) __attribute__((__noreturn__));\n\n  void\n  __throw_invalid_argument(const char*) __attribute__((__noreturn__));\n\n  void\n  __throw_length_error(const char*) __attribute__((__noreturn__));\n\n  void\n  __throw_out_of_range(const char*) __attribute__((__noreturn__));\n\n  void\n  __throw_runtime_error(const char*) __attribute__((__noreturn__));\n\n  void\n  __throw_range_error(const char*) __attribute__((__noreturn__));\n\n  void\n  __throw_overflow_error(const char*) __attribute__((__noreturn__));\n\n  void\n  __throw_underflow_error(const char*) __attribute__((__noreturn__));\n\n  // Helpers for exception objects in basic_ios\n  void\n  __throw_ios_failure(const char*) __attribute__((__noreturn__));\n\n_GLIBCXX_END_NAMESPACE\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/bits/gslice.h",
    "content": "// The template and inlines for the -*- C++ -*- gslice class.\n\n// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2004, 2005\n// Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n/** @file gslice.h\n *  This is an internal header file, included by other library headers.\n *  You should not attempt to use it directly.\n */\n\n// Written by Gabriel Dos Reis <Gabriel.Dos-Reis@DPTMaths.ENS-Cachan.Fr>\n\n#ifndef _GSLICE_H\n#define _GSLICE_H 1\n\n#pragma GCC system_header\n\n_GLIBCXX_BEGIN_NAMESPACE(std)\n\n  /**\n   *  @brief  Class defining multi-dimensional subset of an array.\n   *\n   *  The slice class represents a multi-dimensional subset of an array,\n   *  specified by three parameter sets: start offset, size array, and stride\n   *  array.  The start offset is the index of the first element of the array\n   *  that is part of the subset.  The size and stride array describe each\n   *  dimension of the slice.  Size is the number of elements in that\n   *  dimension, and stride is the distance in the array between successive\n   *  elements in that dimension.  Each dimension's size and stride is taken\n   *  to begin at an array element described by the previous dimension.  The\n   *  size array and stride array must be the same size.\n   *\n   *  For example, if you have offset==3, stride[0]==11, size[1]==3,\n   *  stride[1]==3, then slice[0,0]==array[3], slice[0,1]==array[6],\n   *  slice[0,2]==array[9], slice[1,0]==array[14], slice[1,1]==array[17],\n   *  slice[1,2]==array[20].\n   */\n  class gslice\n  {\n  public:\n    ///  Construct an empty slice.\n    gslice ();\n\n    /**\n     *  @brief  Construct a slice.\n     *\n     *  Constructs a slice with as many dimensions as the length of the @a l\n     *  and @a s arrays.\n     *\n     *  @param  o  Offset in array of first element.\n     *  @param  l  Array of dimension lengths.\n     *  @param  s  Array of dimension strides between array elements.\n     */\n    gslice(size_t, const valarray<size_t>&, const valarray<size_t>&);\n\n    // XXX: the IS says the copy-ctor and copy-assignment operators are\n    //      synthetized by the compiler but they are just unsuitable\n    //      for a ref-counted semantic\n    ///  Copy constructor.\n    gslice(const gslice&);\n\n    ///  Destructor.\n    ~gslice();\n\n    // XXX: See the note above.\n    ///  Assignment operator.\n    gslice& operator=(const gslice&);\n\n    ///  Return array offset of first slice element.\n    size_t           start() const;\n\n    ///  Return array of sizes of slice dimensions.\n    valarray<size_t> size() const;\n    \n    ///  Return array of array strides for each dimension.\n    valarray<size_t> stride() const;\n\n  private:\n    struct _Indexer\n    {\n      size_t _M_count;\n      size_t _M_start;\n      valarray<size_t> _M_size;\n      valarray<size_t> _M_stride;\n      valarray<size_t> _M_index; // Linear array of referenced indices\n      _Indexer(size_t, const valarray<size_t>&,\n\t       const valarray<size_t>&);\n      void\n      _M_increment_use()\n      { ++_M_count; }\n      \n      size_t\n      _M_decrement_use()\n      { return --_M_count; }\n    };\n\n    _Indexer* _M_index;\n\n    template<typename _Tp> friend class valarray;\n  };\n\n  inline size_t\n  gslice::start () const\n  { return _M_index ? _M_index->_M_start : 0; }\n\n  inline valarray<size_t>\n  gslice::size () const\n  { return _M_index ? _M_index->_M_size : valarray<size_t>(); }\n\n  inline valarray<size_t>\n  gslice::stride () const\n  { return _M_index ? _M_index->_M_stride : valarray<size_t>(); }\n\n  inline gslice::gslice () : _M_index(0) {}\n\n  inline\n  gslice::gslice(size_t __o, const valarray<size_t>& __l,\n\t\t const valarray<size_t>& __s)\n  : _M_index(new gslice::_Indexer(__o, __l, __s)) {}\n\n  inline\n  gslice::gslice(const gslice& __g) : _M_index(__g._M_index)\n  { if (_M_index) _M_index->_M_increment_use(); }\n\n  inline\n  gslice::~gslice()\n  {\n    if (_M_index && _M_index->_M_decrement_use() == 0)\n      delete _M_index;\n  }\n\n  inline gslice&\n  gslice::operator= (const gslice& __g)\n  {\n    if (__g._M_index)\n      __g._M_index->_M_increment_use();\n    if (_M_index && _M_index->_M_decrement_use() == 0)\n      delete _M_index;\n    _M_index = __g._M_index;\n    return *this;\n  }\n\n_GLIBCXX_END_NAMESPACE\n\n#endif /* _GSLICE_H */\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/bits/gslice_array.h",
    "content": "// The template and inlines for the -*- C++ -*- gslice_array class.\n\n// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2004, 2005\n// Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n/** @file gslice_array.h\n *  This is an internal header file, included by other library headers.\n *  You should not attempt to use it directly.\n */\n\n// Written by Gabriel Dos Reis <Gabriel.Dos-Reis@DPTMaths.ENS-Cachan.Fr>\n\n#ifndef _GSLICE_ARRAY_H\n#define _GSLICE_ARRAY_H 1\n\n#pragma GCC system_header\n\n_GLIBCXX_BEGIN_NAMESPACE(std)\n\n  /**\n   *  @brief  Reference to multi-dimensional subset of an array.\n   *\n   *  A gslice_array is a reference to the actual elements of an array\n   *  specified by a gslice.  The way to get a gslice_array is to call\n   *  operator[](gslice) on a valarray.  The returned gslice_array then\n   *  permits carrying operations out on the referenced subset of elements in\n   *  the original valarray.  For example, operator+=(valarray) will add\n   *  values to the subset of elements in the underlying valarray this\n   *  gslice_array refers to.\n   *\n   *  @param  Tp  Element type.\n   */\n  template<typename _Tp>\n    class gslice_array\n    {\n    public:\n      typedef _Tp value_type;\n\n      // _GLIBCXX_RESOLVE_LIB_DEFECTS\n      // 253. valarray helper functions are almost entirely useless\n\n      ///  Copy constructor.  Both slices refer to the same underlying array.\n      gslice_array(const gslice_array&);\n\n      ///  Assignment operator.  Assigns slice elements to corresponding\n      ///  elements of @a a.\n      gslice_array& operator=(const gslice_array&);\n\n      ///  Assign slice elements to corresponding elements of @a v.\n      void operator=(const valarray<_Tp>&) const;\n      ///  Multiply slice elements by corresponding elements of @a v.\n      void operator*=(const valarray<_Tp>&) const;\n      ///  Divide slice elements by corresponding elements of @a v.\n      void operator/=(const valarray<_Tp>&) const;\n      ///  Modulo slice elements by corresponding elements of @a v.\n      void operator%=(const valarray<_Tp>&) const;\n      ///  Add corresponding elements of @a v to slice elements.\n      void operator+=(const valarray<_Tp>&) const;\n      ///  Subtract corresponding elements of @a v from slice elements.\n      void operator-=(const valarray<_Tp>&) const;\n      ///  Logical xor slice elements with corresponding elements of @a v.\n      void operator^=(const valarray<_Tp>&) const;\n      ///  Logical and slice elements with corresponding elements of @a v.\n      void operator&=(const valarray<_Tp>&) const;\n      ///  Logical or slice elements with corresponding elements of @a v.\n      void operator|=(const valarray<_Tp>&) const;\n      ///  Left shift slice elements by corresponding elements of @a v.\n      void operator<<=(const valarray<_Tp>&) const;\n      ///  Right shift slice elements by corresponding elements of @a v.\n      void operator>>=(const valarray<_Tp>&) const;\n      ///  Assign all slice elements to @a t.\n      void operator=(const _Tp&) const;\n\n      template<class _Dom>\n        void operator=(const _Expr<_Dom, _Tp>&) const;\n      template<class _Dom>\n        void operator*=(const _Expr<_Dom, _Tp>&) const;\n      template<class _Dom>\n        void operator/=(const _Expr<_Dom, _Tp>&) const;\n      template<class _Dom>\n        void operator%=(const _Expr<_Dom, _Tp>&) const;\n      template<class _Dom>\n        void operator+=(const _Expr<_Dom, _Tp>&) const;\n      template<class _Dom>\n        void operator-=(const _Expr<_Dom, _Tp>&) const;\n      template<class _Dom>\n        void operator^=(const _Expr<_Dom, _Tp>&) const;\n      template<class _Dom>\n        void operator&=(const _Expr<_Dom, _Tp>&) const;\n      template<class _Dom>\n        void operator|=(const _Expr<_Dom, _Tp>&) const;\n      template<class _Dom>\n        void operator<<=(const _Expr<_Dom, _Tp>&) const;\n      template<class _Dom>\n        void operator>>=(const _Expr<_Dom, _Tp>&) const;\n\n    private:\n      _Array<_Tp>    _M_array;\n      const valarray<size_t>& _M_index;\n\n      friend class valarray<_Tp>;\n\n      gslice_array(_Array<_Tp>, const valarray<size_t>&);\n\n      // not implemented\n      gslice_array();\n    };\n\n  template<typename _Tp>\n    inline\n    gslice_array<_Tp>::gslice_array(_Array<_Tp> __a,\n\t\t\t\t    const valarray<size_t>& __i)\n    : _M_array(__a), _M_index(__i) {}\n\n  template<typename _Tp>\n    inline\n    gslice_array<_Tp>::gslice_array(const gslice_array<_Tp>& __a)\n    : _M_array(__a._M_array), _M_index(__a._M_index) {}\n\n  template<typename _Tp>\n    inline gslice_array<_Tp>&\n    gslice_array<_Tp>::operator=(const gslice_array<_Tp>& __a)\n    {\n      std::__valarray_copy(_Array<_Tp>(__a._M_array),\n\t\t\t   _Array<size_t>(__a._M_index), _M_index.size(),\n\t\t\t   _M_array, _Array<size_t>(_M_index));\n      return *this;\n    }\n\n  template<typename _Tp>\n    inline void\n    gslice_array<_Tp>::operator=(const _Tp& __t) const\n    {\n      std::__valarray_fill(_M_array, _Array<size_t>(_M_index),\n\t\t\t   _M_index.size(), __t);\n    }\n\n  template<typename _Tp>\n    inline void\n    gslice_array<_Tp>::operator=(const valarray<_Tp>& __v) const\n    {\n      std::__valarray_copy(_Array<_Tp>(__v), __v.size(),\n\t\t\t   _M_array, _Array<size_t>(_M_index));\n    }\n\n  template<typename _Tp>\n    template<class _Dom>\n      inline void\n      gslice_array<_Tp>::operator=(const _Expr<_Dom, _Tp>& __e) const\n      {\n\tstd::__valarray_copy (__e, _M_index.size(), _M_array,\n\t\t\t      _Array<size_t>(_M_index));\n      }\n\n#undef _DEFINE_VALARRAY_OPERATOR\n#define _DEFINE_VALARRAY_OPERATOR(_Op, _Name)\t\t\t\t\\\n  template<typename _Tp>\t\t\t\t\t\t\\\n    inline void\t\t\t\t\t\t\t\t\\\n    gslice_array<_Tp>::operator _Op##=(const valarray<_Tp>& __v) const\t\\\n    {\t\t\t\t\t\t\t\t\t\\\n      _Array_augmented_##_Name(_M_array, _Array<size_t>(_M_index),\t\\\n\t\t\t       _Array<_Tp>(__v), __v.size());\t\t\\\n    }\t\t\t\t\t\t\t\t\t\\\n\t\t\t\t\t\t\t\t\t\\\n  template<typename _Tp>                                                \\\n    template<class _Dom>\t\t\t\t                \\\n      inline void\t\t\t\t\t\t\t\\\n      gslice_array<_Tp>::operator _Op##= (const _Expr<_Dom, _Tp>& __e) const\\\n      {\t\t\t\t\t\t\t\t\t\\\n\t_Array_augmented_##_Name(_M_array, _Array<size_t>(_M_index), __e,\\\n\t\t\t\t _M_index.size());\t\t\t\\\n      }\n\n_DEFINE_VALARRAY_OPERATOR(*, __multiplies)\n_DEFINE_VALARRAY_OPERATOR(/, __divides)\n_DEFINE_VALARRAY_OPERATOR(%, __modulus)\n_DEFINE_VALARRAY_OPERATOR(+, __plus)\n_DEFINE_VALARRAY_OPERATOR(-, __minus)\n_DEFINE_VALARRAY_OPERATOR(^, __bitwise_xor)\n_DEFINE_VALARRAY_OPERATOR(&, __bitwise_and)\n_DEFINE_VALARRAY_OPERATOR(|, __bitwise_or)\n_DEFINE_VALARRAY_OPERATOR(<<, __shift_left)\n_DEFINE_VALARRAY_OPERATOR(>>, __shift_right)\n\n#undef _DEFINE_VALARRAY_OPERATOR\n\n_GLIBCXX_END_NAMESPACE\n\n#endif /* _GSLICE_ARRAY_H */\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/bits/gthr-default.h",
    "content": "/* Threads compatibility routines for libgcc2 and libobjc.  */\n/* Compile this one with gcc.  */\n/* Copyright (C) 1997, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007\n   Free Software Foundation, Inc.\n\nThis file is part of GCC.\n\nGCC is free software; you can redistribute it and/or modify it under\nthe terms of the GNU General Public License as published by the Free\nSoftware Foundation; either version 2, or (at your option) any later\nversion.\n\nGCC is distributed in the hope that it will be useful, but WITHOUT ANY\nWARRANTY; without even the implied warranty of MERCHANTABILITY or\nFITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License\nfor more details.\n\nYou should have received a copy of the GNU General Public License\nalong with GCC; see the file COPYING.  If not, write to the Free\nSoftware Foundation, 51 Franklin Street, Fifth Floor, Boston, MA\n02110-1301, USA.  */\n\n/* As a special exception, if you link this library with other files,\n   some of which are compiled with GCC, to produce an executable,\n   this library does not by itself cause the resulting executable\n   to be covered by the GNU General Public License.\n   This exception does not however invalidate any other reasons why\n   the executable file might be covered by the GNU General Public License.  */\n\n#ifndef _GLIBCXX_GCC_GTHR_POSIX_H\n#define _GLIBCXX_GCC_GTHR_POSIX_H\n\n/* POSIX threads specific definitions.\n   Easy, since the interface is just one-to-one mapping.  */\n\n#define __GTHREADS 1\n\n/* Some implementations of <pthread.h> require this to be defined.  */\n#if !defined(_REENTRANT) && defined(__osf__)\n#define _REENTRANT 1\n#endif\n\n#include <pthread.h>\n#include <unistd.h>\n\ntypedef pthread_key_t __gthread_key_t;\ntypedef pthread_once_t __gthread_once_t;\ntypedef pthread_mutex_t __gthread_mutex_t;\ntypedef pthread_mutex_t __gthread_recursive_mutex_t;\n\n#define __GTHREAD_MUTEX_INIT PTHREAD_MUTEX_INITIALIZER\n#define __GTHREAD_ONCE_INIT PTHREAD_ONCE_INIT\n#if defined(PTHREAD_RECURSIVE_MUTEX_INITIALIZER)\n#define __GTHREAD_RECURSIVE_MUTEX_INIT PTHREAD_RECURSIVE_MUTEX_INITIALIZER\n#elif defined(PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP)\n#define __GTHREAD_RECURSIVE_MUTEX_INIT PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP\n#else\n#define __GTHREAD_RECURSIVE_MUTEX_INIT_FUNCTION __gthread_recursive_mutex_init_function\n#endif\n\n#if __GXX_WEAK__ && _GLIBCXX_GTHREAD_USE_WEAK\n# ifndef __gthrw_pragma\n#  define __gthrw_pragma(pragma)\n# endif\n# define __gthrw2(name,name2,type) \\\n  static __typeof(type) name __attribute__ ((__weakref__(#name2))); \\\n  __gthrw_pragma(weak type)\n# define __gthrw_(name) __gthrw_ ## name\n#else\n# define __gthrw2(name,name2,type)\n# define __gthrw_(name) name\n#endif\n\n/* Typically, __gthrw_foo is a weak reference to symbol foo.  */\n#define __gthrw(name) __gthrw2(__gthrw_ ## name,name,name)\n\n/* On Tru64, /usr/include/pthread.h uses #pragma extern_prefix \"__\" to\n   map a subset of the POSIX pthread API to mangled versions of their\n   names.  */\n#if defined(__osf__) && defined(_PTHREAD_USE_MANGLED_NAMES_)\n#define __gthrw3(name) __gthrw2(__gthrw_ ## name, __ ## name, name)\n__gthrw3(pthread_once)\n__gthrw3(pthread_getspecific)\n__gthrw3(pthread_setspecific)\n__gthrw3(pthread_create)\n__gthrw3(pthread_cancel)\n__gthrw3(pthread_mutex_lock)\n__gthrw3(pthread_mutex_trylock)\n__gthrw3(pthread_mutex_unlock)\n__gthrw3(pthread_mutex_init)\n#else\n__gthrw(pthread_once)\n__gthrw(pthread_getspecific)\n__gthrw(pthread_setspecific)\n__gthrw(pthread_create)\n__gthrw(pthread_cancel)\n__gthrw(pthread_mutex_lock)\n__gthrw(pthread_mutex_trylock)\n__gthrw(pthread_mutex_unlock)\n__gthrw(pthread_mutex_init)\n#endif\n\n__gthrw(pthread_key_create)\n__gthrw(pthread_key_delete)\n__gthrw(pthread_mutexattr_init)\n__gthrw(pthread_mutexattr_settype)\n__gthrw(pthread_mutexattr_destroy)\n\n\n#if defined(_LIBOBJC) || defined(_LIBOBJC_WEAK)\n/* Objective-C.  */\n#if defined(__osf__) && defined(_PTHREAD_USE_MANGLED_NAMES_)\n__gthrw3(pthread_cond_broadcast)\n__gthrw3(pthread_cond_destroy)\n__gthrw3(pthread_cond_init)\n__gthrw3(pthread_cond_signal)\n__gthrw3(pthread_cond_wait)\n__gthrw3(pthread_exit)\n__gthrw3(pthread_mutex_destroy)\n__gthrw3(pthread_self)\n#else\n__gthrw(pthread_cond_broadcast)\n__gthrw(pthread_cond_destroy)\n__gthrw(pthread_cond_init)\n__gthrw(pthread_cond_signal)\n__gthrw(pthread_cond_wait)\n__gthrw(pthread_exit)\n__gthrw(pthread_mutex_destroy)\n__gthrw(pthread_self)\n#endif /* __osf__ && _PTHREAD_USE_MANGLED_NAMES_ */\n#ifdef _POSIX_PRIORITY_SCHEDULING\n#ifdef _POSIX_THREAD_PRIORITY_SCHEDULING\n__gthrw(sched_get_priority_max)\n__gthrw(sched_get_priority_min)\n#endif /* _POSIX_THREAD_PRIORITY_SCHEDULING */\n#endif /* _POSIX_PRIORITY_SCHEDULING */\n__gthrw(sched_yield)\n__gthrw(pthread_attr_destroy)\n__gthrw(pthread_attr_init)\n__gthrw(pthread_attr_setdetachstate)\n#ifdef _POSIX_THREAD_PRIORITY_SCHEDULING\n__gthrw(pthread_getschedparam)\n__gthrw(pthread_setschedparam)\n#endif /* _POSIX_THREAD_PRIORITY_SCHEDULING */\n#endif /* _LIBOBJC || _LIBOBJC_WEAK */\n\n#if __GXX_WEAK__ && _GLIBCXX_GTHREAD_USE_WEAK\n\n/* On Solaris 2.6 up to 9, the libc exposes a POSIX threads interface even if\n   -pthreads is not specified.  The functions are dummies and most return an\n   error value.  However pthread_once returns 0 without invoking the routine\n   it is passed so we cannot pretend that the interface is active if -pthreads\n   is not specified.  On Solaris 2.5.1, the interface is not exposed at all so\n   we need to play the usual game with weak symbols.  On Solaris 10 and up, a\n   working interface is always exposed.  On FreeBSD 6 and later, libc also\n   exposes a dummy POSIX threads interface, similar to what Solaris 2.6 up\n   to 9 does.  FreeBSD >= 700014 even provides a pthread_cancel stub in libc,\n   which means the alternate __gthread_active_p below cannot be used there.  */\n\n#if defined(__FreeBSD__) || (defined(__sun) && defined(__svr4__))\n\nstatic volatile int __gthread_active = -1;\n\nstatic void\n__gthread_trigger (void)\n{\n  __gthread_active = 1;\n}\n\nstatic inline int\n__gthread_active_p (void)\n{\n  static pthread_mutex_t __gthread_active_mutex = PTHREAD_MUTEX_INITIALIZER;\n  static pthread_once_t __gthread_active_once = PTHREAD_ONCE_INIT;\n\n  /* Avoid reading __gthread_active twice on the main code path.  */\n  int __gthread_active_latest_value = __gthread_active;\n\n  /* This test is not protected to avoid taking a lock on the main code\n     path so every update of __gthread_active in a threaded program must\n     be atomic with regard to the result of the test.  */\n  if (__builtin_expect (__gthread_active_latest_value < 0, 0))\n    {\n      if (__gthrw_(pthread_once))\n\t{\n\t  /* If this really is a threaded program, then we must ensure that\n\t     __gthread_active has been set to 1 before exiting this block.  */\n\t  __gthrw_(pthread_mutex_lock) (&__gthread_active_mutex);\n\t  __gthrw_(pthread_once) (&__gthread_active_once, __gthread_trigger);\n\t  __gthrw_(pthread_mutex_unlock) (&__gthread_active_mutex);\n\t}\n\n      /* Make sure we'll never enter this block again.  */\n      if (__gthread_active < 0)\n\t__gthread_active = 0;\n\n      __gthread_active_latest_value = __gthread_active;\n    }\n\n  return __gthread_active_latest_value != 0;\n}\n\n#else /* neither FreeBSD nor Solaris */\n\nstatic inline int\n__gthread_active_p (void)\n{\n  static void *const __gthread_active_ptr \n    = __extension__ (void *) &__gthrw_(pthread_cancel);\n  return __gthread_active_ptr != 0;\n}\n\n#endif /* FreeBSD or Solaris */\n\n#else /* not __GXX_WEAK__ */\n\nstatic inline int\n__gthread_active_p (void)\n{\n  return 1;\n}\n\n#endif /* __GXX_WEAK__ */\n\n#ifdef _LIBOBJC\n\n/* This is the config.h file in libobjc/ */\n#include <config.h>\n\n#ifdef HAVE_SCHED_H\n# include <sched.h>\n#endif\n\n/* Key structure for maintaining thread specific storage */\nstatic pthread_key_t _objc_thread_storage;\nstatic pthread_attr_t _objc_thread_attribs;\n\n/* Thread local storage for a single thread */\nstatic void *thread_local_storage = NULL;\n\n/* Backend initialization functions */\n\n/* Initialize the threads subsystem.  */\nstatic inline int\n__gthread_objc_init_thread_system (void)\n{\n  if (__gthread_active_p ())\n    {\n      /* Initialize the thread storage key.  */\n      if (__gthrw_(pthread_key_create) (&_objc_thread_storage, NULL) == 0)\n\t{\n\t  /* The normal default detach state for threads is\n\t   * PTHREAD_CREATE_JOINABLE which causes threads to not die\n\t   * when you think they should.  */\n\t  if (__gthrw_(pthread_attr_init) (&_objc_thread_attribs) == 0\n\t      && __gthrw_(pthread_attr_setdetachstate) (&_objc_thread_attribs,\n\t\t\t\t\t      PTHREAD_CREATE_DETACHED) == 0)\n\t    return 0;\n\t}\n    }\n\n  return -1;\n}\n\n/* Close the threads subsystem.  */\nstatic inline int\n__gthread_objc_close_thread_system (void)\n{\n  if (__gthread_active_p ()\n      && __gthrw_(pthread_key_delete) (_objc_thread_storage) == 0\n      && __gthrw_(pthread_attr_destroy) (&_objc_thread_attribs) == 0)\n    return 0;\n\n  return -1;\n}\n\n/* Backend thread functions */\n\n/* Create a new thread of execution.  */\nstatic inline objc_thread_t\n__gthread_objc_thread_detach (void (*func)(void *), void *arg)\n{\n  objc_thread_t thread_id;\n  pthread_t new_thread_handle;\n\n  if (!__gthread_active_p ())\n    return NULL;\n\n  if (!(__gthrw_(pthread_create) (&new_thread_handle, NULL, (void *) func, arg)))\n    thread_id = (objc_thread_t) new_thread_handle;\n  else\n    thread_id = NULL;\n\n  return thread_id;\n}\n\n/* Set the current thread's priority.  */\nstatic inline int\n__gthread_objc_thread_set_priority (int priority)\n{\n  if (!__gthread_active_p ())\n    return -1;\n  else\n    {\n#ifdef _POSIX_PRIORITY_SCHEDULING\n#ifdef _POSIX_THREAD_PRIORITY_SCHEDULING\n      pthread_t thread_id = __gthrw_(pthread_self) ();\n      int policy;\n      struct sched_param params;\n      int priority_min, priority_max;\n\n      if (__gthrw_(pthread_getschedparam) (thread_id, &policy, &params) == 0)\n\t{\n\t  if ((priority_max = __gthrw_(sched_get_priority_max) (policy)) == -1)\n\t    return -1;\n\n\t  if ((priority_min = __gthrw_(sched_get_priority_min) (policy)) == -1)\n\t    return -1;\n\n\t  if (priority > priority_max)\n\t    priority = priority_max;\n\t  else if (priority < priority_min)\n\t    priority = priority_min;\n\t  params.sched_priority = priority;\n\n\t  /*\n\t   * The solaris 7 and several other man pages incorrectly state that\n\t   * this should be a pointer to policy but pthread.h is universally\n\t   * at odds with this.\n\t   */\n\t  if (__gthrw_(pthread_setschedparam) (thread_id, policy, &params) == 0)\n\t    return 0;\n\t}\n#endif /* _POSIX_THREAD_PRIORITY_SCHEDULING */\n#endif /* _POSIX_PRIORITY_SCHEDULING */\n      return -1;\n    }\n}\n\n/* Return the current thread's priority.  */\nstatic inline int\n__gthread_objc_thread_get_priority (void)\n{\n#ifdef _POSIX_PRIORITY_SCHEDULING\n#ifdef _POSIX_THREAD_PRIORITY_SCHEDULING\n  if (__gthread_active_p ())\n    {\n      int policy;\n      struct sched_param params;\n\n      if (__gthrw_(pthread_getschedparam) (__gthrw_(pthread_self) (), &policy, &params) == 0)\n\treturn params.sched_priority;\n      else\n\treturn -1;\n    }\n  else\n#endif /* _POSIX_THREAD_PRIORITY_SCHEDULING */\n#endif /* _POSIX_PRIORITY_SCHEDULING */\n    return OBJC_THREAD_INTERACTIVE_PRIORITY;\n}\n\n/* Yield our process time to another thread.  */\nstatic inline void\n__gthread_objc_thread_yield (void)\n{\n  if (__gthread_active_p ())\n    __gthrw_(sched_yield) ();\n}\n\n/* Terminate the current thread.  */\nstatic inline int\n__gthread_objc_thread_exit (void)\n{\n  if (__gthread_active_p ())\n    /* exit the thread */\n    __gthrw_(pthread_exit) (&__objc_thread_exit_status);\n\n  /* Failed if we reached here */\n  return -1;\n}\n\n/* Returns an integer value which uniquely describes a thread.  */\nstatic inline objc_thread_t\n__gthread_objc_thread_id (void)\n{\n  if (__gthread_active_p ())\n    return (objc_thread_t) __gthrw_(pthread_self) ();\n  else\n    return (objc_thread_t) 1;\n}\n\n/* Sets the thread's local storage pointer.  */\nstatic inline int\n__gthread_objc_thread_set_data (void *value)\n{\n  if (__gthread_active_p ())\n    return __gthrw_(pthread_setspecific) (_objc_thread_storage, value);\n  else\n    {\n      thread_local_storage = value;\n      return 0;\n    }\n}\n\n/* Returns the thread's local storage pointer.  */\nstatic inline void *\n__gthread_objc_thread_get_data (void)\n{\n  if (__gthread_active_p ())\n    return __gthrw_(pthread_getspecific) (_objc_thread_storage);\n  else\n    return thread_local_storage;\n}\n\n/* Backend mutex functions */\n\n/* Allocate a mutex.  */\nstatic inline int\n__gthread_objc_mutex_allocate (objc_mutex_t mutex)\n{\n  if (__gthread_active_p ())\n    {\n      mutex->backend = objc_malloc (sizeof (pthread_mutex_t));\n\n      if (__gthrw_(pthread_mutex_init) ((pthread_mutex_t *) mutex->backend, NULL))\n\t{\n\t  objc_free (mutex->backend);\n\t  mutex->backend = NULL;\n\t  return -1;\n\t}\n    }\n\n  return 0;\n}\n\n/* Deallocate a mutex.  */\nstatic inline int\n__gthread_objc_mutex_deallocate (objc_mutex_t mutex)\n{\n  if (__gthread_active_p ())\n    {\n      int count;\n\n      /*\n       * Posix Threads specifically require that the thread be unlocked\n       * for __gthrw_(pthread_mutex_destroy) to work.\n       */\n\n      do\n\t{\n\t  count = __gthrw_(pthread_mutex_unlock) ((pthread_mutex_t *) mutex->backend);\n\t  if (count < 0)\n\t    return -1;\n\t}\n      while (count);\n\n      if (__gthrw_(pthread_mutex_destroy) ((pthread_mutex_t *) mutex->backend))\n\treturn -1;\n\n      objc_free (mutex->backend);\n      mutex->backend = NULL;\n    }\n  return 0;\n}\n\n/* Grab a lock on a mutex.  */\nstatic inline int\n__gthread_objc_mutex_lock (objc_mutex_t mutex)\n{\n  if (__gthread_active_p ()\n      && __gthrw_(pthread_mutex_lock) ((pthread_mutex_t *) mutex->backend) != 0)\n    {\n      return -1;\n    }\n\n  return 0;\n}\n\n/* Try to grab a lock on a mutex.  */\nstatic inline int\n__gthread_objc_mutex_trylock (objc_mutex_t mutex)\n{\n  if (__gthread_active_p ()\n      && __gthrw_(pthread_mutex_trylock) ((pthread_mutex_t *) mutex->backend) != 0)\n    {\n      return -1;\n    }\n\n  return 0;\n}\n\n/* Unlock the mutex */\nstatic inline int\n__gthread_objc_mutex_unlock (objc_mutex_t mutex)\n{\n  if (__gthread_active_p ()\n      && __gthrw_(pthread_mutex_unlock) ((pthread_mutex_t *) mutex->backend) != 0)\n    {\n      return -1;\n    }\n\n  return 0;\n}\n\n/* Backend condition mutex functions */\n\n/* Allocate a condition.  */\nstatic inline int\n__gthread_objc_condition_allocate (objc_condition_t condition)\n{\n  if (__gthread_active_p ())\n    {\n      condition->backend = objc_malloc (sizeof (pthread_cond_t));\n\n      if (__gthrw_(pthread_cond_init) ((pthread_cond_t *) condition->backend, NULL))\n\t{\n\t  objc_free (condition->backend);\n\t  condition->backend = NULL;\n\t  return -1;\n\t}\n    }\n\n  return 0;\n}\n\n/* Deallocate a condition.  */\nstatic inline int\n__gthread_objc_condition_deallocate (objc_condition_t condition)\n{\n  if (__gthread_active_p ())\n    {\n      if (__gthrw_(pthread_cond_destroy) ((pthread_cond_t *) condition->backend))\n\treturn -1;\n\n      objc_free (condition->backend);\n      condition->backend = NULL;\n    }\n  return 0;\n}\n\n/* Wait on the condition */\nstatic inline int\n__gthread_objc_condition_wait (objc_condition_t condition, objc_mutex_t mutex)\n{\n  if (__gthread_active_p ())\n    return __gthrw_(pthread_cond_wait) ((pthread_cond_t *) condition->backend,\n\t\t\t      (pthread_mutex_t *) mutex->backend);\n  else\n    return 0;\n}\n\n/* Wake up all threads waiting on this condition.  */\nstatic inline int\n__gthread_objc_condition_broadcast (objc_condition_t condition)\n{\n  if (__gthread_active_p ())\n    return __gthrw_(pthread_cond_broadcast) ((pthread_cond_t *) condition->backend);\n  else\n    return 0;\n}\n\n/* Wake up one thread waiting on this condition.  */\nstatic inline int\n__gthread_objc_condition_signal (objc_condition_t condition)\n{\n  if (__gthread_active_p ())\n    return __gthrw_(pthread_cond_signal) ((pthread_cond_t *) condition->backend);\n  else\n    return 0;\n}\n\n#else /* _LIBOBJC */\n\nstatic inline int\n__gthread_once (__gthread_once_t *once, void (*func) (void))\n{\n  if (__gthread_active_p ())\n    return __gthrw_(pthread_once) (once, func);\n  else\n    return -1;\n}\n\nstatic inline int\n__gthread_key_create (__gthread_key_t *key, void (*dtor) (void *))\n{\n  return __gthrw_(pthread_key_create) (key, dtor);\n}\n\nstatic inline int\n__gthread_key_delete (__gthread_key_t key)\n{\n  return __gthrw_(pthread_key_delete) (key);\n}\n\nstatic inline void *\n__gthread_getspecific (__gthread_key_t key)\n{\n  return __gthrw_(pthread_getspecific) (key);\n}\n\nstatic inline int\n__gthread_setspecific (__gthread_key_t key, const void *ptr)\n{\n  return __gthrw_(pthread_setspecific) (key, ptr);\n}\n\nstatic inline int\n__gthread_mutex_lock (__gthread_mutex_t *mutex)\n{\n  if (__gthread_active_p ())\n    return __gthrw_(pthread_mutex_lock) (mutex);\n  else\n    return 0;\n}\n\nstatic inline int\n__gthread_mutex_trylock (__gthread_mutex_t *mutex)\n{\n  if (__gthread_active_p ())\n    return __gthrw_(pthread_mutex_trylock) (mutex);\n  else\n    return 0;\n}\n\nstatic inline int\n__gthread_mutex_unlock (__gthread_mutex_t *mutex)\n{\n  if (__gthread_active_p ())\n    return __gthrw_(pthread_mutex_unlock) (mutex);\n  else\n    return 0;\n}\n\n#ifndef PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP\nstatic inline int\n__gthread_recursive_mutex_init_function (__gthread_recursive_mutex_t *mutex)\n{\n  if (__gthread_active_p ())\n    {\n      pthread_mutexattr_t attr;\n      int r;\n\n      r = __gthrw_(pthread_mutexattr_init) (&attr);\n      if (!r)\n\tr = __gthrw_(pthread_mutexattr_settype) (&attr, PTHREAD_MUTEX_RECURSIVE);\n      if (!r)\n\tr = __gthrw_(pthread_mutex_init) (mutex, &attr);\n      if (!r)\n\tr = __gthrw_(pthread_mutexattr_destroy) (&attr);\n      return r;\n    }\n  return 0;\n}\n#endif\n\nstatic inline int\n__gthread_recursive_mutex_lock (__gthread_recursive_mutex_t *mutex)\n{\n  return __gthread_mutex_lock (mutex);\n}\n\nstatic inline int\n__gthread_recursive_mutex_trylock (__gthread_recursive_mutex_t *mutex)\n{\n  return __gthread_mutex_trylock (mutex);\n}\n\nstatic inline int\n__gthread_recursive_mutex_unlock (__gthread_recursive_mutex_t *mutex)\n{\n  return __gthread_mutex_unlock (mutex);\n}\n\n#endif /* _LIBOBJC */\n\n#endif /* ! _GLIBCXX_GCC_GTHR_POSIX_H */\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/bits/gthr-posix.h",
    "content": "/* Threads compatibility routines for libgcc2 and libobjc.  */\n/* Compile this one with gcc.  */\n/* Copyright (C) 1997, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007\n   Free Software Foundation, Inc.\n\nThis file is part of GCC.\n\nGCC is free software; you can redistribute it and/or modify it under\nthe terms of the GNU General Public License as published by the Free\nSoftware Foundation; either version 2, or (at your option) any later\nversion.\n\nGCC is distributed in the hope that it will be useful, but WITHOUT ANY\nWARRANTY; without even the implied warranty of MERCHANTABILITY or\nFITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License\nfor more details.\n\nYou should have received a copy of the GNU General Public License\nalong with GCC; see the file COPYING.  If not, write to the Free\nSoftware Foundation, 51 Franklin Street, Fifth Floor, Boston, MA\n02110-1301, USA.  */\n\n/* As a special exception, if you link this library with other files,\n   some of which are compiled with GCC, to produce an executable,\n   this library does not by itself cause the resulting executable\n   to be covered by the GNU General Public License.\n   This exception does not however invalidate any other reasons why\n   the executable file might be covered by the GNU General Public License.  */\n\n#ifndef _GLIBCXX_GCC_GTHR_POSIX_H\n#define _GLIBCXX_GCC_GTHR_POSIX_H\n\n/* POSIX threads specific definitions.\n   Easy, since the interface is just one-to-one mapping.  */\n\n#define __GTHREADS 1\n\n/* Some implementations of <pthread.h> require this to be defined.  */\n#if !defined(_REENTRANT) && defined(__osf__)\n#define _REENTRANT 1\n#endif\n\n#include <pthread.h>\n#include <unistd.h>\n\ntypedef pthread_key_t __gthread_key_t;\ntypedef pthread_once_t __gthread_once_t;\ntypedef pthread_mutex_t __gthread_mutex_t;\ntypedef pthread_mutex_t __gthread_recursive_mutex_t;\n\n#define __GTHREAD_MUTEX_INIT PTHREAD_MUTEX_INITIALIZER\n#define __GTHREAD_ONCE_INIT PTHREAD_ONCE_INIT\n#if defined(PTHREAD_RECURSIVE_MUTEX_INITIALIZER)\n#define __GTHREAD_RECURSIVE_MUTEX_INIT PTHREAD_RECURSIVE_MUTEX_INITIALIZER\n#elif defined(PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP)\n#define __GTHREAD_RECURSIVE_MUTEX_INIT PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP\n#else\n#define __GTHREAD_RECURSIVE_MUTEX_INIT_FUNCTION __gthread_recursive_mutex_init_function\n#endif\n\n#if __GXX_WEAK__ && _GLIBCXX_GTHREAD_USE_WEAK\n# ifndef __gthrw_pragma\n#  define __gthrw_pragma(pragma)\n# endif\n# define __gthrw2(name,name2,type) \\\n  static __typeof(type) name __attribute__ ((__weakref__(#name2))); \\\n  __gthrw_pragma(weak type)\n# define __gthrw_(name) __gthrw_ ## name\n#else\n# define __gthrw2(name,name2,type)\n# define __gthrw_(name) name\n#endif\n\n/* Typically, __gthrw_foo is a weak reference to symbol foo.  */\n#define __gthrw(name) __gthrw2(__gthrw_ ## name,name,name)\n\n/* On Tru64, /usr/include/pthread.h uses #pragma extern_prefix \"__\" to\n   map a subset of the POSIX pthread API to mangled versions of their\n   names.  */\n#if defined(__osf__) && defined(_PTHREAD_USE_MANGLED_NAMES_)\n#define __gthrw3(name) __gthrw2(__gthrw_ ## name, __ ## name, name)\n__gthrw3(pthread_once)\n__gthrw3(pthread_getspecific)\n__gthrw3(pthread_setspecific)\n__gthrw3(pthread_create)\n__gthrw3(pthread_cancel)\n__gthrw3(pthread_mutex_lock)\n__gthrw3(pthread_mutex_trylock)\n__gthrw3(pthread_mutex_unlock)\n__gthrw3(pthread_mutex_init)\n#else\n__gthrw(pthread_once)\n__gthrw(pthread_getspecific)\n__gthrw(pthread_setspecific)\n__gthrw(pthread_create)\n__gthrw(pthread_cancel)\n__gthrw(pthread_mutex_lock)\n__gthrw(pthread_mutex_trylock)\n__gthrw(pthread_mutex_unlock)\n__gthrw(pthread_mutex_init)\n#endif\n\n__gthrw(pthread_key_create)\n__gthrw(pthread_key_delete)\n__gthrw(pthread_mutexattr_init)\n__gthrw(pthread_mutexattr_settype)\n__gthrw(pthread_mutexattr_destroy)\n\n\n#if defined(_LIBOBJC) || defined(_LIBOBJC_WEAK)\n/* Objective-C.  */\n#if defined(__osf__) && defined(_PTHREAD_USE_MANGLED_NAMES_)\n__gthrw3(pthread_cond_broadcast)\n__gthrw3(pthread_cond_destroy)\n__gthrw3(pthread_cond_init)\n__gthrw3(pthread_cond_signal)\n__gthrw3(pthread_cond_wait)\n__gthrw3(pthread_exit)\n__gthrw3(pthread_mutex_destroy)\n__gthrw3(pthread_self)\n#else\n__gthrw(pthread_cond_broadcast)\n__gthrw(pthread_cond_destroy)\n__gthrw(pthread_cond_init)\n__gthrw(pthread_cond_signal)\n__gthrw(pthread_cond_wait)\n__gthrw(pthread_exit)\n__gthrw(pthread_mutex_destroy)\n__gthrw(pthread_self)\n#endif /* __osf__ && _PTHREAD_USE_MANGLED_NAMES_ */\n#ifdef _POSIX_PRIORITY_SCHEDULING\n#ifdef _POSIX_THREAD_PRIORITY_SCHEDULING\n__gthrw(sched_get_priority_max)\n__gthrw(sched_get_priority_min)\n#endif /* _POSIX_THREAD_PRIORITY_SCHEDULING */\n#endif /* _POSIX_PRIORITY_SCHEDULING */\n__gthrw(sched_yield)\n__gthrw(pthread_attr_destroy)\n__gthrw(pthread_attr_init)\n__gthrw(pthread_attr_setdetachstate)\n#ifdef _POSIX_THREAD_PRIORITY_SCHEDULING\n__gthrw(pthread_getschedparam)\n__gthrw(pthread_setschedparam)\n#endif /* _POSIX_THREAD_PRIORITY_SCHEDULING */\n#endif /* _LIBOBJC || _LIBOBJC_WEAK */\n\n#if __GXX_WEAK__ && _GLIBCXX_GTHREAD_USE_WEAK\n\n/* On Solaris 2.6 up to 9, the libc exposes a POSIX threads interface even if\n   -pthreads is not specified.  The functions are dummies and most return an\n   error value.  However pthread_once returns 0 without invoking the routine\n   it is passed so we cannot pretend that the interface is active if -pthreads\n   is not specified.  On Solaris 2.5.1, the interface is not exposed at all so\n   we need to play the usual game with weak symbols.  On Solaris 10 and up, a\n   working interface is always exposed.  On FreeBSD 6 and later, libc also\n   exposes a dummy POSIX threads interface, similar to what Solaris 2.6 up\n   to 9 does.  FreeBSD >= 700014 even provides a pthread_cancel stub in libc,\n   which means the alternate __gthread_active_p below cannot be used there.  */\n\n#if defined(__FreeBSD__) || (defined(__sun) && defined(__svr4__))\n\nstatic volatile int __gthread_active = -1;\n\nstatic void\n__gthread_trigger (void)\n{\n  __gthread_active = 1;\n}\n\nstatic inline int\n__gthread_active_p (void)\n{\n  static pthread_mutex_t __gthread_active_mutex = PTHREAD_MUTEX_INITIALIZER;\n  static pthread_once_t __gthread_active_once = PTHREAD_ONCE_INIT;\n\n  /* Avoid reading __gthread_active twice on the main code path.  */\n  int __gthread_active_latest_value = __gthread_active;\n\n  /* This test is not protected to avoid taking a lock on the main code\n     path so every update of __gthread_active in a threaded program must\n     be atomic with regard to the result of the test.  */\n  if (__builtin_expect (__gthread_active_latest_value < 0, 0))\n    {\n      if (__gthrw_(pthread_once))\n\t{\n\t  /* If this really is a threaded program, then we must ensure that\n\t     __gthread_active has been set to 1 before exiting this block.  */\n\t  __gthrw_(pthread_mutex_lock) (&__gthread_active_mutex);\n\t  __gthrw_(pthread_once) (&__gthread_active_once, __gthread_trigger);\n\t  __gthrw_(pthread_mutex_unlock) (&__gthread_active_mutex);\n\t}\n\n      /* Make sure we'll never enter this block again.  */\n      if (__gthread_active < 0)\n\t__gthread_active = 0;\n\n      __gthread_active_latest_value = __gthread_active;\n    }\n\n  return __gthread_active_latest_value != 0;\n}\n\n#else /* neither FreeBSD nor Solaris */\n\nstatic inline int\n__gthread_active_p (void)\n{\n  static void *const __gthread_active_ptr \n    = __extension__ (void *) &__gthrw_(pthread_cancel);\n  return __gthread_active_ptr != 0;\n}\n\n#endif /* FreeBSD or Solaris */\n\n#else /* not __GXX_WEAK__ */\n\nstatic inline int\n__gthread_active_p (void)\n{\n  return 1;\n}\n\n#endif /* __GXX_WEAK__ */\n\n#ifdef _LIBOBJC\n\n/* This is the config.h file in libobjc/ */\n#include <config.h>\n\n#ifdef HAVE_SCHED_H\n# include <sched.h>\n#endif\n\n/* Key structure for maintaining thread specific storage */\nstatic pthread_key_t _objc_thread_storage;\nstatic pthread_attr_t _objc_thread_attribs;\n\n/* Thread local storage for a single thread */\nstatic void *thread_local_storage = NULL;\n\n/* Backend initialization functions */\n\n/* Initialize the threads subsystem.  */\nstatic inline int\n__gthread_objc_init_thread_system (void)\n{\n  if (__gthread_active_p ())\n    {\n      /* Initialize the thread storage key.  */\n      if (__gthrw_(pthread_key_create) (&_objc_thread_storage, NULL) == 0)\n\t{\n\t  /* The normal default detach state for threads is\n\t   * PTHREAD_CREATE_JOINABLE which causes threads to not die\n\t   * when you think they should.  */\n\t  if (__gthrw_(pthread_attr_init) (&_objc_thread_attribs) == 0\n\t      && __gthrw_(pthread_attr_setdetachstate) (&_objc_thread_attribs,\n\t\t\t\t\t      PTHREAD_CREATE_DETACHED) == 0)\n\t    return 0;\n\t}\n    }\n\n  return -1;\n}\n\n/* Close the threads subsystem.  */\nstatic inline int\n__gthread_objc_close_thread_system (void)\n{\n  if (__gthread_active_p ()\n      && __gthrw_(pthread_key_delete) (_objc_thread_storage) == 0\n      && __gthrw_(pthread_attr_destroy) (&_objc_thread_attribs) == 0)\n    return 0;\n\n  return -1;\n}\n\n/* Backend thread functions */\n\n/* Create a new thread of execution.  */\nstatic inline objc_thread_t\n__gthread_objc_thread_detach (void (*func)(void *), void *arg)\n{\n  objc_thread_t thread_id;\n  pthread_t new_thread_handle;\n\n  if (!__gthread_active_p ())\n    return NULL;\n\n  if (!(__gthrw_(pthread_create) (&new_thread_handle, NULL, (void *) func, arg)))\n    thread_id = (objc_thread_t) new_thread_handle;\n  else\n    thread_id = NULL;\n\n  return thread_id;\n}\n\n/* Set the current thread's priority.  */\nstatic inline int\n__gthread_objc_thread_set_priority (int priority)\n{\n  if (!__gthread_active_p ())\n    return -1;\n  else\n    {\n#ifdef _POSIX_PRIORITY_SCHEDULING\n#ifdef _POSIX_THREAD_PRIORITY_SCHEDULING\n      pthread_t thread_id = __gthrw_(pthread_self) ();\n      int policy;\n      struct sched_param params;\n      int priority_min, priority_max;\n\n      if (__gthrw_(pthread_getschedparam) (thread_id, &policy, &params) == 0)\n\t{\n\t  if ((priority_max = __gthrw_(sched_get_priority_max) (policy)) == -1)\n\t    return -1;\n\n\t  if ((priority_min = __gthrw_(sched_get_priority_min) (policy)) == -1)\n\t    return -1;\n\n\t  if (priority > priority_max)\n\t    priority = priority_max;\n\t  else if (priority < priority_min)\n\t    priority = priority_min;\n\t  params.sched_priority = priority;\n\n\t  /*\n\t   * The solaris 7 and several other man pages incorrectly state that\n\t   * this should be a pointer to policy but pthread.h is universally\n\t   * at odds with this.\n\t   */\n\t  if (__gthrw_(pthread_setschedparam) (thread_id, policy, &params) == 0)\n\t    return 0;\n\t}\n#endif /* _POSIX_THREAD_PRIORITY_SCHEDULING */\n#endif /* _POSIX_PRIORITY_SCHEDULING */\n      return -1;\n    }\n}\n\n/* Return the current thread's priority.  */\nstatic inline int\n__gthread_objc_thread_get_priority (void)\n{\n#ifdef _POSIX_PRIORITY_SCHEDULING\n#ifdef _POSIX_THREAD_PRIORITY_SCHEDULING\n  if (__gthread_active_p ())\n    {\n      int policy;\n      struct sched_param params;\n\n      if (__gthrw_(pthread_getschedparam) (__gthrw_(pthread_self) (), &policy, &params) == 0)\n\treturn params.sched_priority;\n      else\n\treturn -1;\n    }\n  else\n#endif /* _POSIX_THREAD_PRIORITY_SCHEDULING */\n#endif /* _POSIX_PRIORITY_SCHEDULING */\n    return OBJC_THREAD_INTERACTIVE_PRIORITY;\n}\n\n/* Yield our process time to another thread.  */\nstatic inline void\n__gthread_objc_thread_yield (void)\n{\n  if (__gthread_active_p ())\n    __gthrw_(sched_yield) ();\n}\n\n/* Terminate the current thread.  */\nstatic inline int\n__gthread_objc_thread_exit (void)\n{\n  if (__gthread_active_p ())\n    /* exit the thread */\n    __gthrw_(pthread_exit) (&__objc_thread_exit_status);\n\n  /* Failed if we reached here */\n  return -1;\n}\n\n/* Returns an integer value which uniquely describes a thread.  */\nstatic inline objc_thread_t\n__gthread_objc_thread_id (void)\n{\n  if (__gthread_active_p ())\n    return (objc_thread_t) __gthrw_(pthread_self) ();\n  else\n    return (objc_thread_t) 1;\n}\n\n/* Sets the thread's local storage pointer.  */\nstatic inline int\n__gthread_objc_thread_set_data (void *value)\n{\n  if (__gthread_active_p ())\n    return __gthrw_(pthread_setspecific) (_objc_thread_storage, value);\n  else\n    {\n      thread_local_storage = value;\n      return 0;\n    }\n}\n\n/* Returns the thread's local storage pointer.  */\nstatic inline void *\n__gthread_objc_thread_get_data (void)\n{\n  if (__gthread_active_p ())\n    return __gthrw_(pthread_getspecific) (_objc_thread_storage);\n  else\n    return thread_local_storage;\n}\n\n/* Backend mutex functions */\n\n/* Allocate a mutex.  */\nstatic inline int\n__gthread_objc_mutex_allocate (objc_mutex_t mutex)\n{\n  if (__gthread_active_p ())\n    {\n      mutex->backend = objc_malloc (sizeof (pthread_mutex_t));\n\n      if (__gthrw_(pthread_mutex_init) ((pthread_mutex_t *) mutex->backend, NULL))\n\t{\n\t  objc_free (mutex->backend);\n\t  mutex->backend = NULL;\n\t  return -1;\n\t}\n    }\n\n  return 0;\n}\n\n/* Deallocate a mutex.  */\nstatic inline int\n__gthread_objc_mutex_deallocate (objc_mutex_t mutex)\n{\n  if (__gthread_active_p ())\n    {\n      int count;\n\n      /*\n       * Posix Threads specifically require that the thread be unlocked\n       * for __gthrw_(pthread_mutex_destroy) to work.\n       */\n\n      do\n\t{\n\t  count = __gthrw_(pthread_mutex_unlock) ((pthread_mutex_t *) mutex->backend);\n\t  if (count < 0)\n\t    return -1;\n\t}\n      while (count);\n\n      if (__gthrw_(pthread_mutex_destroy) ((pthread_mutex_t *) mutex->backend))\n\treturn -1;\n\n      objc_free (mutex->backend);\n      mutex->backend = NULL;\n    }\n  return 0;\n}\n\n/* Grab a lock on a mutex.  */\nstatic inline int\n__gthread_objc_mutex_lock (objc_mutex_t mutex)\n{\n  if (__gthread_active_p ()\n      && __gthrw_(pthread_mutex_lock) ((pthread_mutex_t *) mutex->backend) != 0)\n    {\n      return -1;\n    }\n\n  return 0;\n}\n\n/* Try to grab a lock on a mutex.  */\nstatic inline int\n__gthread_objc_mutex_trylock (objc_mutex_t mutex)\n{\n  if (__gthread_active_p ()\n      && __gthrw_(pthread_mutex_trylock) ((pthread_mutex_t *) mutex->backend) != 0)\n    {\n      return -1;\n    }\n\n  return 0;\n}\n\n/* Unlock the mutex */\nstatic inline int\n__gthread_objc_mutex_unlock (objc_mutex_t mutex)\n{\n  if (__gthread_active_p ()\n      && __gthrw_(pthread_mutex_unlock) ((pthread_mutex_t *) mutex->backend) != 0)\n    {\n      return -1;\n    }\n\n  return 0;\n}\n\n/* Backend condition mutex functions */\n\n/* Allocate a condition.  */\nstatic inline int\n__gthread_objc_condition_allocate (objc_condition_t condition)\n{\n  if (__gthread_active_p ())\n    {\n      condition->backend = objc_malloc (sizeof (pthread_cond_t));\n\n      if (__gthrw_(pthread_cond_init) ((pthread_cond_t *) condition->backend, NULL))\n\t{\n\t  objc_free (condition->backend);\n\t  condition->backend = NULL;\n\t  return -1;\n\t}\n    }\n\n  return 0;\n}\n\n/* Deallocate a condition.  */\nstatic inline int\n__gthread_objc_condition_deallocate (objc_condition_t condition)\n{\n  if (__gthread_active_p ())\n    {\n      if (__gthrw_(pthread_cond_destroy) ((pthread_cond_t *) condition->backend))\n\treturn -1;\n\n      objc_free (condition->backend);\n      condition->backend = NULL;\n    }\n  return 0;\n}\n\n/* Wait on the condition */\nstatic inline int\n__gthread_objc_condition_wait (objc_condition_t condition, objc_mutex_t mutex)\n{\n  if (__gthread_active_p ())\n    return __gthrw_(pthread_cond_wait) ((pthread_cond_t *) condition->backend,\n\t\t\t      (pthread_mutex_t *) mutex->backend);\n  else\n    return 0;\n}\n\n/* Wake up all threads waiting on this condition.  */\nstatic inline int\n__gthread_objc_condition_broadcast (objc_condition_t condition)\n{\n  if (__gthread_active_p ())\n    return __gthrw_(pthread_cond_broadcast) ((pthread_cond_t *) condition->backend);\n  else\n    return 0;\n}\n\n/* Wake up one thread waiting on this condition.  */\nstatic inline int\n__gthread_objc_condition_signal (objc_condition_t condition)\n{\n  if (__gthread_active_p ())\n    return __gthrw_(pthread_cond_signal) ((pthread_cond_t *) condition->backend);\n  else\n    return 0;\n}\n\n#else /* _LIBOBJC */\n\nstatic inline int\n__gthread_once (__gthread_once_t *once, void (*func) (void))\n{\n  if (__gthread_active_p ())\n    return __gthrw_(pthread_once) (once, func);\n  else\n    return -1;\n}\n\nstatic inline int\n__gthread_key_create (__gthread_key_t *key, void (*dtor) (void *))\n{\n  return __gthrw_(pthread_key_create) (key, dtor);\n}\n\nstatic inline int\n__gthread_key_delete (__gthread_key_t key)\n{\n  return __gthrw_(pthread_key_delete) (key);\n}\n\nstatic inline void *\n__gthread_getspecific (__gthread_key_t key)\n{\n  return __gthrw_(pthread_getspecific) (key);\n}\n\nstatic inline int\n__gthread_setspecific (__gthread_key_t key, const void *ptr)\n{\n  return __gthrw_(pthread_setspecific) (key, ptr);\n}\n\nstatic inline int\n__gthread_mutex_lock (__gthread_mutex_t *mutex)\n{\n  if (__gthread_active_p ())\n    return __gthrw_(pthread_mutex_lock) (mutex);\n  else\n    return 0;\n}\n\nstatic inline int\n__gthread_mutex_trylock (__gthread_mutex_t *mutex)\n{\n  if (__gthread_active_p ())\n    return __gthrw_(pthread_mutex_trylock) (mutex);\n  else\n    return 0;\n}\n\nstatic inline int\n__gthread_mutex_unlock (__gthread_mutex_t *mutex)\n{\n  if (__gthread_active_p ())\n    return __gthrw_(pthread_mutex_unlock) (mutex);\n  else\n    return 0;\n}\n\n#ifndef PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP\nstatic inline int\n__gthread_recursive_mutex_init_function (__gthread_recursive_mutex_t *mutex)\n{\n  if (__gthread_active_p ())\n    {\n      pthread_mutexattr_t attr;\n      int r;\n\n      r = __gthrw_(pthread_mutexattr_init) (&attr);\n      if (!r)\n\tr = __gthrw_(pthread_mutexattr_settype) (&attr, PTHREAD_MUTEX_RECURSIVE);\n      if (!r)\n\tr = __gthrw_(pthread_mutex_init) (mutex, &attr);\n      if (!r)\n\tr = __gthrw_(pthread_mutexattr_destroy) (&attr);\n      return r;\n    }\n  return 0;\n}\n#endif\n\nstatic inline int\n__gthread_recursive_mutex_lock (__gthread_recursive_mutex_t *mutex)\n{\n  return __gthread_mutex_lock (mutex);\n}\n\nstatic inline int\n__gthread_recursive_mutex_trylock (__gthread_recursive_mutex_t *mutex)\n{\n  return __gthread_mutex_trylock (mutex);\n}\n\nstatic inline int\n__gthread_recursive_mutex_unlock (__gthread_recursive_mutex_t *mutex)\n{\n  return __gthread_mutex_unlock (mutex);\n}\n\n#endif /* _LIBOBJC */\n\n#endif /* ! _GLIBCXX_GCC_GTHR_POSIX_H */\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/bits/gthr-single.h",
    "content": "/* Threads compatibility routines for libgcc2 and libobjc.  */\n/* Compile this one with gcc.  */\n/* Copyright (C) 1997, 1999, 2000, 2004 Free Software Foundation, Inc.\n\nThis file is part of GCC.\n\nGCC is free software; you can redistribute it and/or modify it under\nthe terms of the GNU General Public License as published by the Free\nSoftware Foundation; either version 2, or (at your option) any later\nversion.\n\nGCC is distributed in the hope that it will be useful, but WITHOUT ANY\nWARRANTY; without even the implied warranty of MERCHANTABILITY or\nFITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License\nfor more details.\n\nYou should have received a copy of the GNU General Public License\nalong with GCC; see the file COPYING.  If not, write to the Free\nSoftware Foundation, 51 Franklin Street, Fifth Floor, Boston, MA\n02110-1301, USA.  */\n\n/* As a special exception, if you link this library with other files,\n   some of which are compiled with GCC, to produce an executable,\n   this library does not by itself cause the resulting executable\n   to be covered by the GNU General Public License.\n   This exception does not however invalidate any other reasons why\n   the executable file might be covered by the GNU General Public License.  */\n\n#ifndef _GLIBCXX_GCC_GTHR_SINGLE_H\n#define _GLIBCXX_GCC_GTHR_SINGLE_H\n\n/* Just provide compatibility for mutex handling.  */\n\ntypedef int __gthread_mutex_t;\ntypedef int __gthread_recursive_mutex_t;\n\n#define __GTHREAD_MUTEX_INIT 0\n\n#ifdef __cplusplus\n#define _GLIBCXX_UNUSED(x)\n#else\n#define _GLIBCXX_UNUSED(x) x __attribute__((unused))\n#endif\n\n#ifdef _LIBOBJC\n\n/* Thread local storage for a single thread */\nstatic void *thread_local_storage = NULL;\n\n/* Backend initialization functions */\n\n/* Initialize the threads subsystem.  */\nstatic inline int\n__gthread_objc_init_thread_system (void)\n{\n  /* No thread support available */\n  return -1;\n}\n\n/* Close the threads subsystem.  */\nstatic inline int\n__gthread_objc_close_thread_system (void)\n{\n  /* No thread support available */\n  return -1;\n}\n\n/* Backend thread functions */\n\n/* Create a new thread of execution.  */\nstatic inline objc_thread_t\n__gthread_objc_thread_detach (void (* func)(void *), void * _GLIBCXX_UNUSED(arg))\n{\n  /* No thread support available */\n  return NULL;\n}\n\n/* Set the current thread's priority.  */\nstatic inline int\n__gthread_objc_thread_set_priority (int _GLIBCXX_UNUSED(priority))\n{\n  /* No thread support available */\n  return -1;\n}\n\n/* Return the current thread's priority.  */\nstatic inline int\n__gthread_objc_thread_get_priority (void)\n{\n  return OBJC_THREAD_INTERACTIVE_PRIORITY;\n}\n\n/* Yield our process time to another thread.  */\nstatic inline void\n__gthread_objc_thread_yield (void)\n{\n  return;\n}\n\n/* Terminate the current thread.  */\nstatic inline int\n__gthread_objc_thread_exit (void)\n{\n  /* No thread support available */\n  /* Should we really exit the program */\n  /* exit (&__objc_thread_exit_status); */\n  return -1;\n}\n\n/* Returns an integer value which uniquely describes a thread.  */\nstatic inline objc_thread_t\n__gthread_objc_thread_id (void)\n{\n  /* No thread support, use 1.  */\n  return (objc_thread_t) 1;\n}\n\n/* Sets the thread's local storage pointer.  */\nstatic inline int\n__gthread_objc_thread_set_data (void *value)\n{\n  thread_local_storage = value;\n  return 0;\n}\n\n/* Returns the thread's local storage pointer.  */\nstatic inline void *\n__gthread_objc_thread_get_data (void)\n{\n  return thread_local_storage;\n}\n\n/* Backend mutex functions */\n\n/* Allocate a mutex.  */\nstatic inline int\n__gthread_objc_mutex_allocate (objc_mutex_t _GLIBCXX_UNUSED(mutex))\n{\n  return 0;\n}\n\n/* Deallocate a mutex.  */\nstatic inline int\n__gthread_objc_mutex_deallocate (objc_mutex_t _GLIBCXX_UNUSED(mutex))\n{\n  return 0;\n}\n\n/* Grab a lock on a mutex.  */\nstatic inline int\n__gthread_objc_mutex_lock (objc_mutex_t _GLIBCXX_UNUSED(mutex))\n{\n  /* There can only be one thread, so we always get the lock */\n  return 0;\n}\n\n/* Try to grab a lock on a mutex.  */\nstatic inline int\n__gthread_objc_mutex_trylock (objc_mutex_t _GLIBCXX_UNUSED(mutex))\n{\n  /* There can only be one thread, so we always get the lock */\n  return 0;\n}\n\n/* Unlock the mutex */\nstatic inline int\n__gthread_objc_mutex_unlock (objc_mutex_t _GLIBCXX_UNUSED(mutex))\n{\n  return 0;\n}\n\n/* Backend condition mutex functions */\n\n/* Allocate a condition.  */\nstatic inline int\n__gthread_objc_condition_allocate (objc_condition_t _GLIBCXX_UNUSED(condition))\n{\n  return 0;\n}\n\n/* Deallocate a condition.  */\nstatic inline int\n__gthread_objc_condition_deallocate (objc_condition_t _GLIBCXX_UNUSED(condition))\n{\n  return 0;\n}\n\n/* Wait on the condition */\nstatic inline int\n__gthread_objc_condition_wait (objc_condition_t _GLIBCXX_UNUSED(condition),\n\t\t\t       objc_mutex_t _GLIBCXX_UNUSED(mutex))\n{\n  return 0;\n}\n\n/* Wake up all threads waiting on this condition.  */\nstatic inline int\n__gthread_objc_condition_broadcast (objc_condition_t _GLIBCXX_UNUSED(condition))\n{\n  return 0;\n}\n\n/* Wake up one thread waiting on this condition.  */\nstatic inline int\n__gthread_objc_condition_signal (objc_condition_t _GLIBCXX_UNUSED(condition))\n{\n  return 0;\n}\n\n#else /* _LIBOBJC */\n\nstatic inline int\n__gthread_active_p (void)\n{\n  return 0;\n}\n\nstatic inline int\n__gthread_mutex_lock (__gthread_mutex_t * _GLIBCXX_UNUSED(mutex))\n{\n  return 0;\n}\n\nstatic inline int\n__gthread_mutex_trylock (__gthread_mutex_t * _GLIBCXX_UNUSED(mutex))\n{\n  return 0;\n}\n\nstatic inline int\n__gthread_mutex_unlock (__gthread_mutex_t * _GLIBCXX_UNUSED(mutex))\n{\n  return 0;\n}\n\nstatic inline int\n__gthread_recursive_mutex_lock (__gthread_recursive_mutex_t *mutex)\n{\n  return __gthread_mutex_lock (mutex);\n}\n\nstatic inline int\n__gthread_recursive_mutex_trylock (__gthread_recursive_mutex_t *mutex)\n{\n  return __gthread_mutex_trylock (mutex);\n}\n\nstatic inline int\n__gthread_recursive_mutex_unlock (__gthread_recursive_mutex_t *mutex)\n{\n  return __gthread_mutex_unlock (mutex);\n}\n\n#endif /* _LIBOBJC */\n\n#undef _GLIBCXX_UNUSED\n\n#endif /* ! _GLIBCXX_GCC_GTHR_SINGLE_H */\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/bits/gthr-tpf.h",
    "content": "/* Threads compatibility routines for libgcc2 and libobjc.  */\n/* Compile this one with gcc.  */\n/* Copyright (C) 1997, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007\n   Free Software Foundation, Inc.\n\nThis file is part of GCC.\n\nGCC is free software; you can redistribute it and/or modify it under\nthe terms of the GNU General Public License as published by the Free\nSoftware Foundation; either version 2, or (at your option) any later\nversion.\n\nGCC is distributed in the hope that it will be useful, but WITHOUT ANY\nWARRANTY; without even the implied warranty of MERCHANTABILITY or\nFITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License\nfor more details.\n\nYou should have received a copy of the GNU General Public License\nalong with GCC; see the file COPYING.  If not, write to the Free\nSoftware Foundation, 51 Franklin Street, Fifth Floor, Boston, MA\n02110-1301, USA.  */\n\n/* As a special exception, if you link this library with other files,\n   some of which are compiled with GCC, to produce an executable,\n   this library does not by itself cause the resulting executable\n   to be covered by the GNU General Public License.\n   This exception does not however invalidate any other reasons why\n   the executable file might be covered by the GNU General Public License.  */\n\n#ifndef _GLIBCXX_GCC_GTHR_POSIX_H\n#define _GLIBCXX_GCC_GTHR_POSIX_H\n\n/* POSIX threads specific definitions.\n   Easy, since the interface is just one-to-one mapping.  */\n\n#define __GTHREADS 1\n\n/* Some implementations of <pthread.h> require this to be defined.  */\n#if !defined(_REENTRANT) && defined(__osf__)\n#define _REENTRANT 1\n#endif\n\n#include <pthread.h>\n#include <unistd.h>\n\ntypedef pthread_key_t __gthread_key_t;\ntypedef pthread_once_t __gthread_once_t;\ntypedef pthread_mutex_t __gthread_mutex_t;\ntypedef pthread_mutex_t __gthread_recursive_mutex_t;\n\n#define __GTHREAD_MUTEX_INIT PTHREAD_MUTEX_INITIALIZER\n#define __GTHREAD_ONCE_INIT PTHREAD_ONCE_INIT\n#if defined(PTHREAD_RECURSIVE_MUTEX_INITIALIZER)\n#define __GTHREAD_RECURSIVE_MUTEX_INIT PTHREAD_RECURSIVE_MUTEX_INITIALIZER\n#elif defined(PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP)\n#define __GTHREAD_RECURSIVE_MUTEX_INIT PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP\n#else\n#define __GTHREAD_RECURSIVE_MUTEX_INIT_FUNCTION __gthread_recursive_mutex_init_function\n#endif\n\n#if __GXX_WEAK__ && _GLIBCXX_GTHREAD_USE_WEAK\n# ifndef __gthrw_pragma\n#  define __gthrw_pragma(pragma)\n# endif\n# define __gthrw2(name,name2,type) \\\n  static __typeof(type) name __attribute__ ((__weakref__(#name2))); \\\n  __gthrw_pragma(weak type)\n# define __gthrw_(name) __gthrw_ ## name\n#else\n# define __gthrw2(name,name2,type)\n# define __gthrw_(name) name\n#endif\n\n/* Typically, __gthrw_foo is a weak reference to symbol foo.  */\n#define __gthrw(name) __gthrw2(__gthrw_ ## name,name,name)\n\n/* On Tru64, /usr/include/pthread.h uses #pragma extern_prefix \"__\" to\n   map a subset of the POSIX pthread API to mangled versions of their\n   names.  */\n#if defined(__osf__) && defined(_PTHREAD_USE_MANGLED_NAMES_)\n#define __gthrw3(name) __gthrw2(__gthrw_ ## name, __ ## name, name)\n__gthrw3(pthread_once)\n__gthrw3(pthread_getspecific)\n__gthrw3(pthread_setspecific)\n__gthrw3(pthread_create)\n__gthrw3(pthread_cancel)\n__gthrw3(pthread_mutex_lock)\n__gthrw3(pthread_mutex_trylock)\n__gthrw3(pthread_mutex_unlock)\n__gthrw3(pthread_mutex_init)\n#else\n__gthrw(pthread_once)\n__gthrw(pthread_getspecific)\n__gthrw(pthread_setspecific)\n__gthrw(pthread_create)\n__gthrw(pthread_cancel)\n__gthrw(pthread_mutex_lock)\n__gthrw(pthread_mutex_trylock)\n__gthrw(pthread_mutex_unlock)\n__gthrw(pthread_mutex_init)\n#endif\n\n__gthrw(pthread_key_create)\n__gthrw(pthread_key_delete)\n__gthrw(pthread_mutexattr_init)\n__gthrw(pthread_mutexattr_settype)\n__gthrw(pthread_mutexattr_destroy)\n\n\n#if defined(_LIBOBJC) || defined(_LIBOBJC_WEAK)\n/* Objective-C.  */\n#if defined(__osf__) && defined(_PTHREAD_USE_MANGLED_NAMES_)\n__gthrw3(pthread_cond_broadcast)\n__gthrw3(pthread_cond_destroy)\n__gthrw3(pthread_cond_init)\n__gthrw3(pthread_cond_signal)\n__gthrw3(pthread_cond_wait)\n__gthrw3(pthread_exit)\n__gthrw3(pthread_mutex_destroy)\n__gthrw3(pthread_self)\n#else\n__gthrw(pthread_cond_broadcast)\n__gthrw(pthread_cond_destroy)\n__gthrw(pthread_cond_init)\n__gthrw(pthread_cond_signal)\n__gthrw(pthread_cond_wait)\n__gthrw(pthread_exit)\n__gthrw(pthread_mutex_destroy)\n__gthrw(pthread_self)\n#endif /* __osf__ && _PTHREAD_USE_MANGLED_NAMES_ */\n#ifdef _POSIX_PRIORITY_SCHEDULING\n#ifdef _POSIX_THREAD_PRIORITY_SCHEDULING\n__gthrw(sched_get_priority_max)\n__gthrw(sched_get_priority_min)\n#endif /* _POSIX_THREAD_PRIORITY_SCHEDULING */\n#endif /* _POSIX_PRIORITY_SCHEDULING */\n__gthrw(sched_yield)\n__gthrw(pthread_attr_destroy)\n__gthrw(pthread_attr_init)\n__gthrw(pthread_attr_setdetachstate)\n#ifdef _POSIX_THREAD_PRIORITY_SCHEDULING\n__gthrw(pthread_getschedparam)\n__gthrw(pthread_setschedparam)\n#endif /* _POSIX_THREAD_PRIORITY_SCHEDULING */\n#endif /* _LIBOBJC || _LIBOBJC_WEAK */\n\n#if __GXX_WEAK__ && _GLIBCXX_GTHREAD_USE_WEAK\n\n/* On Solaris 2.6 up to 9, the libc exposes a POSIX threads interface even if\n   -pthreads is not specified.  The functions are dummies and most return an\n   error value.  However pthread_once returns 0 without invoking the routine\n   it is passed so we cannot pretend that the interface is active if -pthreads\n   is not specified.  On Solaris 2.5.1, the interface is not exposed at all so\n   we need to play the usual game with weak symbols.  On Solaris 10 and up, a\n   working interface is always exposed.  On FreeBSD 6 and later, libc also\n   exposes a dummy POSIX threads interface, similar to what Solaris 2.6 up\n   to 9 does.  FreeBSD >= 700014 even provides a pthread_cancel stub in libc,\n   which means the alternate __gthread_active_p below cannot be used there.  */\n\n#if defined(__FreeBSD__) || (defined(__sun) && defined(__svr4__))\n\nstatic volatile int __gthread_active = -1;\n\nstatic void\n__gthread_trigger (void)\n{\n  __gthread_active = 1;\n}\n\nstatic inline int\n__gthread_active_p (void)\n{\n  static pthread_mutex_t __gthread_active_mutex = PTHREAD_MUTEX_INITIALIZER;\n  static pthread_once_t __gthread_active_once = PTHREAD_ONCE_INIT;\n\n  /* Avoid reading __gthread_active twice on the main code path.  */\n  int __gthread_active_latest_value = __gthread_active;\n\n  /* This test is not protected to avoid taking a lock on the main code\n     path so every update of __gthread_active in a threaded program must\n     be atomic with regard to the result of the test.  */\n  if (__builtin_expect (__gthread_active_latest_value < 0, 0))\n    {\n      if (__gthrw_(pthread_once))\n\t{\n\t  /* If this really is a threaded program, then we must ensure that\n\t     __gthread_active has been set to 1 before exiting this block.  */\n\t  __gthrw_(pthread_mutex_lock) (&__gthread_active_mutex);\n\t  __gthrw_(pthread_once) (&__gthread_active_once, __gthread_trigger);\n\t  __gthrw_(pthread_mutex_unlock) (&__gthread_active_mutex);\n\t}\n\n      /* Make sure we'll never enter this block again.  */\n      if (__gthread_active < 0)\n\t__gthread_active = 0;\n\n      __gthread_active_latest_value = __gthread_active;\n    }\n\n  return __gthread_active_latest_value != 0;\n}\n\n#else /* neither FreeBSD nor Solaris */\n\nstatic inline int\n__gthread_active_p (void)\n{\n  static void *const __gthread_active_ptr \n    = __extension__ (void *) &__gthrw_(pthread_cancel);\n  return __gthread_active_ptr != 0;\n}\n\n#endif /* FreeBSD or Solaris */\n\n#else /* not __GXX_WEAK__ */\n\nstatic inline int\n__gthread_active_p (void)\n{\n  return 1;\n}\n\n#endif /* __GXX_WEAK__ */\n\n#ifdef _LIBOBJC\n\n/* This is the config.h file in libobjc/ */\n#include <config.h>\n\n#ifdef HAVE_SCHED_H\n# include <sched.h>\n#endif\n\n/* Key structure for maintaining thread specific storage */\nstatic pthread_key_t _objc_thread_storage;\nstatic pthread_attr_t _objc_thread_attribs;\n\n/* Thread local storage for a single thread */\nstatic void *thread_local_storage = NULL;\n\n/* Backend initialization functions */\n\n/* Initialize the threads subsystem.  */\nstatic inline int\n__gthread_objc_init_thread_system (void)\n{\n  if (__gthread_active_p ())\n    {\n      /* Initialize the thread storage key.  */\n      if (__gthrw_(pthread_key_create) (&_objc_thread_storage, NULL) == 0)\n\t{\n\t  /* The normal default detach state for threads is\n\t   * PTHREAD_CREATE_JOINABLE which causes threads to not die\n\t   * when you think they should.  */\n\t  if (__gthrw_(pthread_attr_init) (&_objc_thread_attribs) == 0\n\t      && __gthrw_(pthread_attr_setdetachstate) (&_objc_thread_attribs,\n\t\t\t\t\t      PTHREAD_CREATE_DETACHED) == 0)\n\t    return 0;\n\t}\n    }\n\n  return -1;\n}\n\n/* Close the threads subsystem.  */\nstatic inline int\n__gthread_objc_close_thread_system (void)\n{\n  if (__gthread_active_p ()\n      && __gthrw_(pthread_key_delete) (_objc_thread_storage) == 0\n      && __gthrw_(pthread_attr_destroy) (&_objc_thread_attribs) == 0)\n    return 0;\n\n  return -1;\n}\n\n/* Backend thread functions */\n\n/* Create a new thread of execution.  */\nstatic inline objc_thread_t\n__gthread_objc_thread_detach (void (*func)(void *), void *arg)\n{\n  objc_thread_t thread_id;\n  pthread_t new_thread_handle;\n\n  if (!__gthread_active_p ())\n    return NULL;\n\n  if (!(__gthrw_(pthread_create) (&new_thread_handle, NULL, (void *) func, arg)))\n    thread_id = (objc_thread_t) new_thread_handle;\n  else\n    thread_id = NULL;\n\n  return thread_id;\n}\n\n/* Set the current thread's priority.  */\nstatic inline int\n__gthread_objc_thread_set_priority (int priority)\n{\n  if (!__gthread_active_p ())\n    return -1;\n  else\n    {\n#ifdef _POSIX_PRIORITY_SCHEDULING\n#ifdef _POSIX_THREAD_PRIORITY_SCHEDULING\n      pthread_t thread_id = __gthrw_(pthread_self) ();\n      int policy;\n      struct sched_param params;\n      int priority_min, priority_max;\n\n      if (__gthrw_(pthread_getschedparam) (thread_id, &policy, &params) == 0)\n\t{\n\t  if ((priority_max = __gthrw_(sched_get_priority_max) (policy)) == -1)\n\t    return -1;\n\n\t  if ((priority_min = __gthrw_(sched_get_priority_min) (policy)) == -1)\n\t    return -1;\n\n\t  if (priority > priority_max)\n\t    priority = priority_max;\n\t  else if (priority < priority_min)\n\t    priority = priority_min;\n\t  params.sched_priority = priority;\n\n\t  /*\n\t   * The solaris 7 and several other man pages incorrectly state that\n\t   * this should be a pointer to policy but pthread.h is universally\n\t   * at odds with this.\n\t   */\n\t  if (__gthrw_(pthread_setschedparam) (thread_id, policy, &params) == 0)\n\t    return 0;\n\t}\n#endif /* _POSIX_THREAD_PRIORITY_SCHEDULING */\n#endif /* _POSIX_PRIORITY_SCHEDULING */\n      return -1;\n    }\n}\n\n/* Return the current thread's priority.  */\nstatic inline int\n__gthread_objc_thread_get_priority (void)\n{\n#ifdef _POSIX_PRIORITY_SCHEDULING\n#ifdef _POSIX_THREAD_PRIORITY_SCHEDULING\n  if (__gthread_active_p ())\n    {\n      int policy;\n      struct sched_param params;\n\n      if (__gthrw_(pthread_getschedparam) (__gthrw_(pthread_self) (), &policy, &params) == 0)\n\treturn params.sched_priority;\n      else\n\treturn -1;\n    }\n  else\n#endif /* _POSIX_THREAD_PRIORITY_SCHEDULING */\n#endif /* _POSIX_PRIORITY_SCHEDULING */\n    return OBJC_THREAD_INTERACTIVE_PRIORITY;\n}\n\n/* Yield our process time to another thread.  */\nstatic inline void\n__gthread_objc_thread_yield (void)\n{\n  if (__gthread_active_p ())\n    __gthrw_(sched_yield) ();\n}\n\n/* Terminate the current thread.  */\nstatic inline int\n__gthread_objc_thread_exit (void)\n{\n  if (__gthread_active_p ())\n    /* exit the thread */\n    __gthrw_(pthread_exit) (&__objc_thread_exit_status);\n\n  /* Failed if we reached here */\n  return -1;\n}\n\n/* Returns an integer value which uniquely describes a thread.  */\nstatic inline objc_thread_t\n__gthread_objc_thread_id (void)\n{\n  if (__gthread_active_p ())\n    return (objc_thread_t) __gthrw_(pthread_self) ();\n  else\n    return (objc_thread_t) 1;\n}\n\n/* Sets the thread's local storage pointer.  */\nstatic inline int\n__gthread_objc_thread_set_data (void *value)\n{\n  if (__gthread_active_p ())\n    return __gthrw_(pthread_setspecific) (_objc_thread_storage, value);\n  else\n    {\n      thread_local_storage = value;\n      return 0;\n    }\n}\n\n/* Returns the thread's local storage pointer.  */\nstatic inline void *\n__gthread_objc_thread_get_data (void)\n{\n  if (__gthread_active_p ())\n    return __gthrw_(pthread_getspecific) (_objc_thread_storage);\n  else\n    return thread_local_storage;\n}\n\n/* Backend mutex functions */\n\n/* Allocate a mutex.  */\nstatic inline int\n__gthread_objc_mutex_allocate (objc_mutex_t mutex)\n{\n  if (__gthread_active_p ())\n    {\n      mutex->backend = objc_malloc (sizeof (pthread_mutex_t));\n\n      if (__gthrw_(pthread_mutex_init) ((pthread_mutex_t *) mutex->backend, NULL))\n\t{\n\t  objc_free (mutex->backend);\n\t  mutex->backend = NULL;\n\t  return -1;\n\t}\n    }\n\n  return 0;\n}\n\n/* Deallocate a mutex.  */\nstatic inline int\n__gthread_objc_mutex_deallocate (objc_mutex_t mutex)\n{\n  if (__gthread_active_p ())\n    {\n      int count;\n\n      /*\n       * Posix Threads specifically require that the thread be unlocked\n       * for __gthrw_(pthread_mutex_destroy) to work.\n       */\n\n      do\n\t{\n\t  count = __gthrw_(pthread_mutex_unlock) ((pthread_mutex_t *) mutex->backend);\n\t  if (count < 0)\n\t    return -1;\n\t}\n      while (count);\n\n      if (__gthrw_(pthread_mutex_destroy) ((pthread_mutex_t *) mutex->backend))\n\treturn -1;\n\n      objc_free (mutex->backend);\n      mutex->backend = NULL;\n    }\n  return 0;\n}\n\n/* Grab a lock on a mutex.  */\nstatic inline int\n__gthread_objc_mutex_lock (objc_mutex_t mutex)\n{\n  if (__gthread_active_p ()\n      && __gthrw_(pthread_mutex_lock) ((pthread_mutex_t *) mutex->backend) != 0)\n    {\n      return -1;\n    }\n\n  return 0;\n}\n\n/* Try to grab a lock on a mutex.  */\nstatic inline int\n__gthread_objc_mutex_trylock (objc_mutex_t mutex)\n{\n  if (__gthread_active_p ()\n      && __gthrw_(pthread_mutex_trylock) ((pthread_mutex_t *) mutex->backend) != 0)\n    {\n      return -1;\n    }\n\n  return 0;\n}\n\n/* Unlock the mutex */\nstatic inline int\n__gthread_objc_mutex_unlock (objc_mutex_t mutex)\n{\n  if (__gthread_active_p ()\n      && __gthrw_(pthread_mutex_unlock) ((pthread_mutex_t *) mutex->backend) != 0)\n    {\n      return -1;\n    }\n\n  return 0;\n}\n\n/* Backend condition mutex functions */\n\n/* Allocate a condition.  */\nstatic inline int\n__gthread_objc_condition_allocate (objc_condition_t condition)\n{\n  if (__gthread_active_p ())\n    {\n      condition->backend = objc_malloc (sizeof (pthread_cond_t));\n\n      if (__gthrw_(pthread_cond_init) ((pthread_cond_t *) condition->backend, NULL))\n\t{\n\t  objc_free (condition->backend);\n\t  condition->backend = NULL;\n\t  return -1;\n\t}\n    }\n\n  return 0;\n}\n\n/* Deallocate a condition.  */\nstatic inline int\n__gthread_objc_condition_deallocate (objc_condition_t condition)\n{\n  if (__gthread_active_p ())\n    {\n      if (__gthrw_(pthread_cond_destroy) ((pthread_cond_t *) condition->backend))\n\treturn -1;\n\n      objc_free (condition->backend);\n      condition->backend = NULL;\n    }\n  return 0;\n}\n\n/* Wait on the condition */\nstatic inline int\n__gthread_objc_condition_wait (objc_condition_t condition, objc_mutex_t mutex)\n{\n  if (__gthread_active_p ())\n    return __gthrw_(pthread_cond_wait) ((pthread_cond_t *) condition->backend,\n\t\t\t      (pthread_mutex_t *) mutex->backend);\n  else\n    return 0;\n}\n\n/* Wake up all threads waiting on this condition.  */\nstatic inline int\n__gthread_objc_condition_broadcast (objc_condition_t condition)\n{\n  if (__gthread_active_p ())\n    return __gthrw_(pthread_cond_broadcast) ((pthread_cond_t *) condition->backend);\n  else\n    return 0;\n}\n\n/* Wake up one thread waiting on this condition.  */\nstatic inline int\n__gthread_objc_condition_signal (objc_condition_t condition)\n{\n  if (__gthread_active_p ())\n    return __gthrw_(pthread_cond_signal) ((pthread_cond_t *) condition->backend);\n  else\n    return 0;\n}\n\n#else /* _LIBOBJC */\n\nstatic inline int\n__gthread_once (__gthread_once_t *once, void (*func) (void))\n{\n  if (__gthread_active_p ())\n    return __gthrw_(pthread_once) (once, func);\n  else\n    return -1;\n}\n\nstatic inline int\n__gthread_key_create (__gthread_key_t *key, void (*dtor) (void *))\n{\n  return __gthrw_(pthread_key_create) (key, dtor);\n}\n\nstatic inline int\n__gthread_key_delete (__gthread_key_t key)\n{\n  return __gthrw_(pthread_key_delete) (key);\n}\n\nstatic inline void *\n__gthread_getspecific (__gthread_key_t key)\n{\n  return __gthrw_(pthread_getspecific) (key);\n}\n\nstatic inline int\n__gthread_setspecific (__gthread_key_t key, const void *ptr)\n{\n  return __gthrw_(pthread_setspecific) (key, ptr);\n}\n\nstatic inline int\n__gthread_mutex_lock (__gthread_mutex_t *mutex)\n{\n  if (__gthread_active_p ())\n    return __gthrw_(pthread_mutex_lock) (mutex);\n  else\n    return 0;\n}\n\nstatic inline int\n__gthread_mutex_trylock (__gthread_mutex_t *mutex)\n{\n  if (__gthread_active_p ())\n    return __gthrw_(pthread_mutex_trylock) (mutex);\n  else\n    return 0;\n}\n\nstatic inline int\n__gthread_mutex_unlock (__gthread_mutex_t *mutex)\n{\n  if (__gthread_active_p ())\n    return __gthrw_(pthread_mutex_unlock) (mutex);\n  else\n    return 0;\n}\n\n#ifndef PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP\nstatic inline int\n__gthread_recursive_mutex_init_function (__gthread_recursive_mutex_t *mutex)\n{\n  if (__gthread_active_p ())\n    {\n      pthread_mutexattr_t attr;\n      int r;\n\n      r = __gthrw_(pthread_mutexattr_init) (&attr);\n      if (!r)\n\tr = __gthrw_(pthread_mutexattr_settype) (&attr, PTHREAD_MUTEX_RECURSIVE);\n      if (!r)\n\tr = __gthrw_(pthread_mutex_init) (mutex, &attr);\n      if (!r)\n\tr = __gthrw_(pthread_mutexattr_destroy) (&attr);\n      return r;\n    }\n  return 0;\n}\n#endif\n\nstatic inline int\n__gthread_recursive_mutex_lock (__gthread_recursive_mutex_t *mutex)\n{\n  return __gthread_mutex_lock (mutex);\n}\n\nstatic inline int\n__gthread_recursive_mutex_trylock (__gthread_recursive_mutex_t *mutex)\n{\n  return __gthread_mutex_trylock (mutex);\n}\n\nstatic inline int\n__gthread_recursive_mutex_unlock (__gthread_recursive_mutex_t *mutex)\n{\n  return __gthread_mutex_unlock (mutex);\n}\n\n#endif /* _LIBOBJC */\n\n#endif /* ! _GLIBCXX_GCC_GTHR_POSIX_H */\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/bits/gthr.h",
    "content": "/* Threads compatibility routines for libgcc2.  */\n/* Compile this one with gcc.  */\n/* Copyright (C) 1997, 1998, 2004 Free Software Foundation, Inc.\n\nThis file is part of GCC.\n\nGCC is free software; you can redistribute it and/or modify it under\nthe terms of the GNU General Public License as published by the Free\nSoftware Foundation; either version 2, or (at your option) any later\nversion.\n\nGCC is distributed in the hope that it will be useful, but WITHOUT ANY\nWARRANTY; without even the implied warranty of MERCHANTABILITY or\nFITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License\nfor more details.\n\nYou should have received a copy of the GNU General Public License\nalong with GCC; see the file COPYING.  If not, write to the Free\nSoftware Foundation, 51 Franklin Street, Fifth Floor, Boston, MA\n02110-1301, USA.  */\n\n/* As a special exception, if you link this library with other files,\n   some of which are compiled with GCC, to produce an executable,\n   this library does not by itself cause the resulting executable\n   to be covered by the GNU General Public License.\n   This exception does not however invalidate any other reasons why\n   the executable file might be covered by the GNU General Public License.  */\n\n#ifndef _GLIBCXX_GCC_GTHR_H\n#define _GLIBCXX_GCC_GTHR_H\n\n#ifndef _GLIBCXX_HIDE_EXPORTS\n#pragma GCC visibility push(default)\n#endif\n\n/* If this file is compiled with threads support, it must\n       #define __GTHREADS 1\n   to indicate that threads support is present.  Also it has define\n   function\n     int __gthread_active_p ()\n   that returns 1 if thread system is active, 0 if not.\n\n   The threads interface must define the following types:\n     __gthread_key_t\n     __gthread_once_t\n     __gthread_mutex_t\n     __gthread_recursive_mutex_t\n\n   The threads interface must define the following macros:\n\n     __GTHREAD_ONCE_INIT\n     \t\tto initialize __gthread_once_t\n     __GTHREAD_MUTEX_INIT\n     \t\tto initialize __gthread_mutex_t to get a fast\n\t\tnon-recursive mutex.\n     __GTHREAD_MUTEX_INIT_FUNCTION\n     \t\tsome systems can't initialize a mutex without a\n\t\tfunction call.  On such systems, define this to a\n\t\tfunction which looks like this:\n\t\t  void __GTHREAD_MUTEX_INIT_FUNCTION (__gthread_mutex_t *)\n\t\tDon't define __GTHREAD_MUTEX_INIT in this case\n     __GTHREAD_RECURSIVE_MUTEX_INIT\n     __GTHREAD_RECURSIVE_MUTEX_INIT_FUNCTION\n     \t\tas above, but for a recursive mutex.\n\n   The threads interface must define the following static functions:\n\n     int __gthread_once (__gthread_once_t *once, void (*func) ())\n\n     int __gthread_key_create (__gthread_key_t *keyp, void (*dtor) (void *))\n     int __gthread_key_delete (__gthread_key_t key)\n\n     void *__gthread_getspecific (__gthread_key_t key)\n     int __gthread_setspecific (__gthread_key_t key, const void *ptr)\n\n     int __gthread_mutex_lock (__gthread_mutex_t *mutex);\n     int __gthread_mutex_trylock (__gthread_mutex_t *mutex);\n     int __gthread_mutex_unlock (__gthread_mutex_t *mutex);\n\n     int __gthread_recursive_mutex_lock (__gthread_recursive_mutex_t *mutex);\n     int __gthread_recursive_mutex_trylock (__gthread_recursive_mutex_t *mutex);\n     int __gthread_recursive_mutex_unlock (__gthread_recursive_mutex_t *mutex);\n\n   All functions returning int should return zero on success or the error\n   number.  If the operation is not supported, -1 is returned.\n\n   Currently supported threads packages are\n     TPF threads with -D__tpf__\n     POSIX/Unix98 threads with -D_PTHREADS\n     POSIX/Unix95 threads with -D_PTHREADS95\n     DCE threads with -D_DCE_THREADS\n     Solaris/UI threads with -D_SOLARIS_THREADS\n*/\n\n/* Check first for thread specific defines.  */\n#if defined (_GLIBCXX___tpf_GLIBCXX___)\n#include <bits/gthr-tpf.h>\n#elif _GLIBCXX__PTHREADS\n#include <bits/gthr-posix.h>\n#elif _GLIBCXX__PTHREADS95\n#include <bits/gthr-posix95.h>\n#elif _GLIBCXX__DCE_THREADS\n#include <bits/gthr-dce.h>\n#elif _GLIBCXX__SOLARIS_THREADS\n#include <bits/gthr-solaris.h>\n\n/* Include GTHREAD_FILE if one is defined.  */\n#elif defined(_GLIBCXX_HAVE_GTHR_DEFAULT)\n#if __GXX_WEAK__\n#ifndef _GLIBCXX_GTHREAD_USE_WEAK\n#define _GLIBCXX_GTHREAD_USE_WEAK 1\n#endif\n#endif\n#include <bits/gthr-default.h>\n\n/* Fallback to single thread definitions.  */\n#else\n#include <bits/gthr-single.h>\n#endif\n\n#ifndef _GLIBCXX_HIDE_EXPORTS\n#pragma GCC visibility pop\n#endif\n\n#endif /* ! _GLIBCXX_GCC_GTHR_H */\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/bits/indirect_array.h",
    "content": "// The template and inlines for the -*- C++ -*- indirect_array class.\n\n// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2004, 2005\n//  Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n/** @file indirect_array.h\n *  This is an internal header file, included by other library headers.\n *  You should not attempt to use it directly.\n */\n\n// Written by Gabriel Dos Reis <Gabriel.Dos-Reis@DPTMaths.ENS-Cachan.Fr>\n\n#ifndef _INDIRECT_ARRAY_H\n#define _INDIRECT_ARRAY_H 1\n\n#pragma GCC system_header\n\n_GLIBCXX_BEGIN_NAMESPACE(std)\n\n  /**\n   *  @brief  Reference to arbitrary subset of an array.\n   *\n   *  An indirect_array is a reference to the actual elements of an array\n   *  specified by an ordered array of indices.  The way to get an\n   *  indirect_array is to call operator[](valarray<size_t>) on a valarray.\n   *  The returned indirect_array then permits carrying operations out on the\n   *  referenced subset of elements in the original valarray.\n   *\n   *  For example, if an indirect_array is obtained using the array (4,2,0) as\n   *  an argument, and then assigned to an array containing (1,2,3), then the\n   *  underlying array will have array[0]==3, array[2]==2, and array[4]==1.\n   *\n   *  @param  Tp  Element type.\n   */\n  template <class _Tp>\n    class indirect_array\n    {\n    public:\n      typedef _Tp value_type;\n\n      // _GLIBCXX_RESOLVE_LIB_DEFECTS\n      // 253. valarray helper functions are almost entirely useless\n\n      ///  Copy constructor.  Both slices refer to the same underlying array.\n      indirect_array(const indirect_array&);\n\n      ///  Assignment operator.  Assigns elements to corresponding elements\n      ///  of @a a.\n      indirect_array& operator=(const indirect_array&);\n\n      ///  Assign slice elements to corresponding elements of @a v.\n      void operator=(const valarray<_Tp>&) const;\n      ///  Multiply slice elements by corresponding elements of @a v.\n      void operator*=(const valarray<_Tp>&) const;\n      ///  Divide slice elements by corresponding elements of @a v.\n      void operator/=(const valarray<_Tp>&) const;\n      ///  Modulo slice elements by corresponding elements of @a v.\n      void operator%=(const valarray<_Tp>&) const;\n      ///  Add corresponding elements of @a v to slice elements.\n      void operator+=(const valarray<_Tp>&) const;\n      ///  Subtract corresponding elements of @a v from slice elements.\n      void operator-=(const valarray<_Tp>&) const;\n      ///  Logical xor slice elements with corresponding elements of @a v.\n      void operator^=(const valarray<_Tp>&) const;\n      ///  Logical and slice elements with corresponding elements of @a v.\n      void operator&=(const valarray<_Tp>&) const;\n      ///  Logical or slice elements with corresponding elements of @a v.\n      void operator|=(const valarray<_Tp>&) const;\n      ///  Left shift slice elements by corresponding elements of @a v.\n      void operator<<=(const valarray<_Tp>&) const;\n      ///  Right shift slice elements by corresponding elements of @a v.\n      void operator>>=(const valarray<_Tp>&) const;\n      ///  Assign all slice elements to @a t.\n      void operator= (const _Tp&) const;\n      //    ~indirect_array();\n\n      template<class _Dom>\n      void operator=(const _Expr<_Dom, _Tp>&) const;\n      template<class _Dom>\n      void operator*=(const _Expr<_Dom, _Tp>&) const;\n      template<class _Dom>\n      void operator/=(const _Expr<_Dom, _Tp>&) const;\n      template<class _Dom>\n      void operator%=(const _Expr<_Dom, _Tp>&) const;\n      template<class _Dom>\n      void operator+=(const _Expr<_Dom, _Tp>&) const;\n      template<class _Dom>\n      void operator-=(const _Expr<_Dom, _Tp>&) const;\n      template<class _Dom>\n      void operator^=(const _Expr<_Dom, _Tp>&) const;\n      template<class _Dom>\n      void operator&=(const _Expr<_Dom, _Tp>&) const;\n      template<class _Dom>\n      void operator|=(const _Expr<_Dom, _Tp>&) const;\n      template<class _Dom>\n      void operator<<=(const _Expr<_Dom, _Tp>&) const;\n      template<class _Dom>\n      void operator>>=(const _Expr<_Dom, _Tp>&) const;\n\n    private:\n      ///  Copy constructor.  Both slices refer to the same underlying array.\n      indirect_array(_Array<_Tp>, size_t, _Array<size_t>);\n\n      friend class valarray<_Tp>;\n      friend class gslice_array<_Tp>;\n\n      const size_t\t _M_sz;\n      const _Array<size_t> _M_index;\n      const _Array<_Tp>\t _M_array;\n\n      // not implemented\n      indirect_array();\n    };\n\n  template<typename _Tp>\n    inline\n    indirect_array<_Tp>::indirect_array(const indirect_array<_Tp>& __a)\n    : _M_sz(__a._M_sz), _M_index(__a._M_index), _M_array(__a._M_array) {}\n\n  template<typename _Tp>\n    inline\n    indirect_array<_Tp>::indirect_array(_Array<_Tp> __a, size_t __s,\n\t\t\t\t\t_Array<size_t> __i)\n    : _M_sz(__s), _M_index(__i), _M_array(__a) {}\n\n  template<typename _Tp>\n    inline indirect_array<_Tp>&\n    indirect_array<_Tp>::operator=(const indirect_array<_Tp>& __a)\n    {\n      std::__valarray_copy(__a._M_array, _M_sz, __a._M_index, _M_array,\n\t\t\t   _M_index);\n      return *this;\n    }\n\n  template<typename _Tp>\n    inline void\n    indirect_array<_Tp>::operator=(const _Tp& __t) const\n    { std::__valarray_fill(_M_array, _M_index, _M_sz, __t); }\n\n  template<typename _Tp>\n    inline void\n    indirect_array<_Tp>::operator=(const valarray<_Tp>& __v) const\n    { std::__valarray_copy(_Array<_Tp>(__v), _M_sz, _M_array, _M_index); }\n\n  template<typename _Tp>\n    template<class _Dom>\n      inline void\n      indirect_array<_Tp>::operator=(const _Expr<_Dom, _Tp>& __e) const\n      { std::__valarray_copy(__e, _M_sz, _M_array, _M_index); }\n\n#undef _DEFINE_VALARRAY_OPERATOR\n#define _DEFINE_VALARRAY_OPERATOR(_Op, _Name)\t\t\t\t\\\n  template<typename _Tp>\t\t\t\t\t\t\\\n    inline void\t\t\t\t\t\t\t\t\\\n    indirect_array<_Tp>::operator _Op##=(const valarray<_Tp>& __v) const\\\n    {\t\t\t\t\t\t\t\t\t\\\n      _Array_augmented_##_Name(_M_array, _M_index, _Array<_Tp>(__v), _M_sz); \\\n    }\t\t\t\t\t\t\t\t\t\\\n\t\t\t\t\t\t\t\t\t\\\n  template<typename _Tp>                                                \\\n    template<class _Dom>\t\t\t\t                \\\n      inline void\t\t\t\t\t\t\t\\\n      indirect_array<_Tp>::operator _Op##=(const _Expr<_Dom,_Tp>& __e) const\\\n      {\t\t\t\t\t\t\t\t\t\\\n\t_Array_augmented_##_Name(_M_array, _M_index, __e, _M_sz);\t\\\n      }\n\n_DEFINE_VALARRAY_OPERATOR(*, __multiplies)\n_DEFINE_VALARRAY_OPERATOR(/, __divides)\n_DEFINE_VALARRAY_OPERATOR(%, __modulus)\n_DEFINE_VALARRAY_OPERATOR(+, __plus)\n_DEFINE_VALARRAY_OPERATOR(-, __minus)\n_DEFINE_VALARRAY_OPERATOR(^, __bitwise_xor)\n_DEFINE_VALARRAY_OPERATOR(&, __bitwise_and)\n_DEFINE_VALARRAY_OPERATOR(|, __bitwise_or)\n_DEFINE_VALARRAY_OPERATOR(<<, __shift_left)\n_DEFINE_VALARRAY_OPERATOR(>>, __shift_right)\n\n#undef _DEFINE_VALARRAY_OPERATOR\n\n_GLIBCXX_END_NAMESPACE\n\n#endif /* _INDIRECT_ARRAY_H */\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/bits/ios_base.h",
    "content": "// Iostreams base classes -*- C++ -*-\n\n// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006\n// Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n/** @file ios_base.h\n *  This is an internal header file, included by other library headers.\n *  You should not attempt to use it directly.\n */\n\n//\n// ISO C++ 14882: 27.4  Iostreams base classes\n//\n\n#ifndef _IOS_BASE_H\n#define _IOS_BASE_H 1\n\n#pragma GCC system_header\n\n#include <ext/atomicity.h>\n#include <bits/localefwd.h>\n#include <bits/locale_classes.h>\n\n_GLIBCXX_BEGIN_NAMESPACE(std)\n\n  // The following definitions of bitmask types are enums, not ints,\n  // as permitted (but not required) in the standard, in order to provide\n  // better type safety in iostream calls.  A side effect is that\n  // expressions involving them are no longer compile-time constants.\n  enum _Ios_Fmtflags \n    { \n      _S_boolalpha \t= 1L << 0,\n      _S_dec \t\t= 1L << 1,\n      _S_fixed \t\t= 1L << 2,\n      _S_hex \t\t= 1L << 3,\n      _S_internal \t= 1L << 4,\n      _S_left \t\t= 1L << 5,\n      _S_oct \t\t= 1L << 6,\n      _S_right \t\t= 1L << 7,\n      _S_scientific \t= 1L << 8,\n      _S_showbase \t= 1L << 9,\n      _S_showpoint \t= 1L << 10,\n      _S_showpos \t= 1L << 11,\n      _S_skipws \t= 1L << 12,\n      _S_unitbuf \t= 1L << 13,\n      _S_uppercase \t= 1L << 14,\n      _S_adjustfield \t= _S_left | _S_right | _S_internal,\n      _S_basefield \t= _S_dec | _S_oct | _S_hex,\n      _S_floatfield \t= _S_scientific | _S_fixed,\n      _S_ios_fmtflags_end = 1L << 16 \n    };\n\n  inline _Ios_Fmtflags\n  operator&(_Ios_Fmtflags __a, _Ios_Fmtflags __b)\n  { return _Ios_Fmtflags(static_cast<int>(__a) & static_cast<int>(__b)); }\n\n  inline _Ios_Fmtflags\n  operator|(_Ios_Fmtflags __a, _Ios_Fmtflags __b)\n  { return _Ios_Fmtflags(static_cast<int>(__a) | static_cast<int>(__b)); }\n\n  inline _Ios_Fmtflags\n  operator^(_Ios_Fmtflags __a, _Ios_Fmtflags __b)\n  { return _Ios_Fmtflags(static_cast<int>(__a) ^ static_cast<int>(__b)); }\n\n  inline _Ios_Fmtflags&\n  operator|=(_Ios_Fmtflags& __a, _Ios_Fmtflags __b)\n  { return __a = __a | __b; }\n\n  inline _Ios_Fmtflags&\n  operator&=(_Ios_Fmtflags& __a, _Ios_Fmtflags __b)\n  { return __a = __a & __b; }\n\n  inline _Ios_Fmtflags&\n  operator^=(_Ios_Fmtflags& __a, _Ios_Fmtflags __b)\n  { return __a = __a ^ __b; }\n\n  inline _Ios_Fmtflags\n  operator~(_Ios_Fmtflags __a)\n  { return _Ios_Fmtflags(~static_cast<int>(__a)); }\n\n\n  enum _Ios_Openmode \n    { \n      _S_app \t\t= 1L << 0,\n      _S_ate \t\t= 1L << 1,\n      _S_bin \t\t= 1L << 2,\n      _S_in \t\t= 1L << 3,\n      _S_out \t\t= 1L << 4,\n      _S_trunc \t\t= 1L << 5,\n      _S_ios_openmode_end = 1L << 16 \n    };\n\n  inline _Ios_Openmode\n  operator&(_Ios_Openmode __a, _Ios_Openmode __b)\n  { return _Ios_Openmode(static_cast<int>(__a) & static_cast<int>(__b)); }\n\n  inline _Ios_Openmode\n  operator|(_Ios_Openmode __a, _Ios_Openmode __b)\n  { return _Ios_Openmode(static_cast<int>(__a) | static_cast<int>(__b)); }\n\n  inline _Ios_Openmode\n  operator^(_Ios_Openmode __a, _Ios_Openmode __b)\n  { return _Ios_Openmode(static_cast<int>(__a) ^ static_cast<int>(__b)); }\n\n  inline _Ios_Openmode&\n  operator|=(_Ios_Openmode& __a, _Ios_Openmode __b)\n  { return __a = __a | __b; }\n\n  inline _Ios_Openmode&\n  operator&=(_Ios_Openmode& __a, _Ios_Openmode __b)\n  { return __a = __a & __b; }\n\n  inline _Ios_Openmode&\n  operator^=(_Ios_Openmode& __a, _Ios_Openmode __b)\n  { return __a = __a ^ __b; }\n\n  inline _Ios_Openmode\n  operator~(_Ios_Openmode __a)\n  { return _Ios_Openmode(~static_cast<int>(__a)); }\n\n\n  enum _Ios_Iostate\n    { \n      _S_goodbit \t\t= 0,\n      _S_badbit \t\t= 1L << 0,\n      _S_eofbit \t\t= 1L << 1,\n      _S_failbit\t\t= 1L << 2,\n      _S_ios_iostate_end = 1L << 16 \n    };\n\n  inline _Ios_Iostate\n  operator&(_Ios_Iostate __a, _Ios_Iostate __b)\n  { return _Ios_Iostate(static_cast<int>(__a) & static_cast<int>(__b)); }\n\n  inline _Ios_Iostate\n  operator|(_Ios_Iostate __a, _Ios_Iostate __b)\n  { return _Ios_Iostate(static_cast<int>(__a) | static_cast<int>(__b)); }\n\n  inline _Ios_Iostate\n  operator^(_Ios_Iostate __a, _Ios_Iostate __b)\n  { return _Ios_Iostate(static_cast<int>(__a) ^ static_cast<int>(__b)); }\n\n  inline _Ios_Iostate&\n  operator|=(_Ios_Iostate& __a, _Ios_Iostate __b)\n  { return __a = __a | __b; }\n\n  inline _Ios_Iostate&\n  operator&=(_Ios_Iostate& __a, _Ios_Iostate __b)\n  { return __a = __a & __b; }\n\n  inline _Ios_Iostate&\n  operator^=(_Ios_Iostate& __a, _Ios_Iostate __b)\n  { return __a = __a ^ __b; }\n\n  inline _Ios_Iostate\n  operator~(_Ios_Iostate __a)\n  { return _Ios_Iostate(~static_cast<int>(__a)); }\n\n  enum _Ios_Seekdir \n    { \n      _S_beg = 0,\n      _S_cur = SEEK_CUR,\n      _S_end = SEEK_END,\n      _S_ios_seekdir_end = 1L << 16 \n    };\n\n  // 27.4.2  Class ios_base\n  /**\n   *  @brief  The base of the I/O class hierarchy.\n   *\n   *  This class defines everything that can be defined about I/O that does\n   *  not depend on the type of characters being input or output.  Most\n   *  people will only see @c ios_base when they need to specify the full\n   *  name of the various I/O flags (e.g., the openmodes).\n  */\n  class ios_base\n  {\n  public:\n\n    // 27.4.2.1.1  Class ios_base::failure\n    /// These are thrown to indicate problems.  Doc me.\n    class failure : public exception\n    {\n    public:\n      // _GLIBCXX_RESOLVE_LIB_DEFECTS\n      // 48.  Use of non-existent exception constructor\n      explicit\n      failure(const string& __str) throw();\n\n      // This declaration is not useless:\n      // http://gcc.gnu.org/onlinedocs/gcc-3.0.2/gcc_6.html#SEC118\n      virtual\n      ~failure() throw();\n\n      virtual const char*\n      what() const throw();\n\n    private:\n      string _M_msg;\n    };\n\n    // 27.4.2.1.2  Type ios_base::fmtflags\n    /**\n     *  @brief This is a bitmask type.\n     *\n     *  @c \"_Ios_Fmtflags\" is implementation-defined, but it is valid to\n     *  perform bitwise operations on these values and expect the Right\n     *  Thing to happen.  Defined objects of type fmtflags are:\n     *  - boolalpha\n     *  - dec\n     *  - fixed\n     *  - hex\n     *  - internal\n     *  - left\n     *  - oct\n     *  - right\n     *  - scientific\n     *  - showbase\n     *  - showpoint\n     *  - showpos\n     *  - skipws\n     *  - unitbuf\n     *  - uppercase\n     *  - adjustfield\n     *  - basefield\n     *  - floatfield\n    */\n    typedef _Ios_Fmtflags fmtflags;\n\n    /// Insert/extract @c bool in alphabetic rather than numeric format.\n    static const fmtflags boolalpha =   _S_boolalpha;\n\n    /// Converts integer input or generates integer output in decimal base.\n    static const fmtflags dec =         _S_dec;\n\n    /// Generate floating-point output in fixed-point notation.\n    static const fmtflags fixed =       _S_fixed;\n\n    /// Converts integer input or generates integer output in hexadecimal base.\n    static const fmtflags hex =         _S_hex;\n\n    /// Adds fill characters at a designated internal point in certain\n    /// generated output, or identical to @c right if no such point is\n    /// designated.\n    static const fmtflags internal =    _S_internal;\n\n    /// Adds fill characters on the right (final positions) of certain\n    /// generated output.  (I.e., the thing you print is flush left.)\n    static const fmtflags left =        _S_left;\n\n    /// Converts integer input or generates integer output in octal base.\n    static const fmtflags oct =         _S_oct;\n\n    /// Adds fill characters on the left (initial positions) of certain\n    /// generated output.  (I.e., the thing you print is flush right.)\n    static const fmtflags right =       _S_right;\n\n    /// Generates floating-point output in scientific notation.\n    static const fmtflags scientific =  _S_scientific;\n\n    /// Generates a prefix indicating the numeric base of generated integer\n    /// output.\n    static const fmtflags showbase =    _S_showbase;\n\n    /// Generates a decimal-point character unconditionally in generated\n    /// floating-point output.\n    static const fmtflags showpoint =   _S_showpoint;\n\n    /// Generates a + sign in non-negative generated numeric output.\n    static const fmtflags showpos =     _S_showpos;\n\n    /// Skips leading white space before certain input operations.\n    static const fmtflags skipws =      _S_skipws;\n\n    /// Flushes output after each output operation.\n    static const fmtflags unitbuf =     _S_unitbuf;\n\n    /// Replaces certain lowercase letters with their uppercase equivalents\n    /// in generated output.\n    static const fmtflags uppercase =   _S_uppercase;\n\n    /// A mask of left|right|internal.  Useful for the 2-arg form of @c setf.\n    static const fmtflags adjustfield = _S_adjustfield;\n\n    /// A mask of dec|oct|hex.  Useful for the 2-arg form of @c setf.\n    static const fmtflags basefield =   _S_basefield;\n\n    /// A mask of scientific|fixed.  Useful for the 2-arg form of @c setf.\n    static const fmtflags floatfield =  _S_floatfield;\n\n    // 27.4.2.1.3  Type ios_base::iostate\n    /**\n     *  @brief This is a bitmask type.\n     *\n     *  @c \"_Ios_Iostate\" is implementation-defined, but it is valid to\n     *  perform bitwise operations on these values and expect the Right\n     *  Thing to happen.  Defined objects of type iostate are:\n     *  - badbit\n     *  - eofbit\n     *  - failbit\n     *  - goodbit\n    */\n    typedef _Ios_Iostate iostate;\n\n    /// Indicates a loss of integrity in an input or output sequence (such\n    /// as an irrecoverable read error from a file).\n    static const iostate badbit =\t_S_badbit;\n\n    /// Indicates that an input operation reached the end of an input sequence.\n    static const iostate eofbit =\t_S_eofbit;\n\n    /// Indicates that an input operation failed to read the expected\n    /// characters, or that an output operation failed to generate the\n    /// desired characters.\n    static const iostate failbit =\t_S_failbit;\n\n    /// Indicates all is well.\n    static const iostate goodbit =\t_S_goodbit;\n\n    // 27.4.2.1.4  Type ios_base::openmode\n    /**\n     *  @brief This is a bitmask type.\n     *\n     *  @c \"_Ios_Openmode\" is implementation-defined, but it is valid to\n     *  perform bitwise operations on these values and expect the Right\n     *  Thing to happen.  Defined objects of type openmode are:\n     *  - app\n     *  - ate\n     *  - binary\n     *  - in\n     *  - out\n     *  - trunc\n    */\n    typedef _Ios_Openmode openmode;\n\n    /// Seek to end before each write.\n    static const openmode app =\t\t_S_app;\n\n    /// Open and seek to end immediately after opening.\n    static const openmode ate =\t\t_S_ate;\n\n    /// Perform input and output in binary mode (as opposed to text mode).\n    /// This is probably not what you think it is; see\n    /// http://gcc.gnu.org/onlinedocs/libstdc++/27_io/howto.html#3 and\n    /// http://gcc.gnu.org/onlinedocs/libstdc++/27_io/howto.html#7 for more.\n    static const openmode binary =\t_S_bin;\n\n    /// Open for input.  Default for @c ifstream and fstream.\n    static const openmode in =\t\t_S_in;\n\n    /// Open for output.  Default for @c ofstream and fstream.\n    static const openmode out =\t\t_S_out;\n\n    /// Open for input.  Default for @c ofstream.\n    static const openmode trunc =\t_S_trunc;\n\n    // 27.4.2.1.5  Type ios_base::seekdir\n    /**\n     *  @brief This is an enumerated type.\n     *\n     *  @c \"_Ios_Seekdir\" is implementation-defined.  Defined values\n     *  of type seekdir are:\n     *  - beg\n     *  - cur, equivalent to @c SEEK_CUR in the C standard library.\n     *  - end, equivalent to @c SEEK_END in the C standard library.\n    */\n    typedef _Ios_Seekdir seekdir;\n\n    /// Request a seek relative to the beginning of the stream.\n    static const seekdir beg =\t\t_S_beg;\n\n    /// Request a seek relative to the current position within the sequence.\n    static const seekdir cur =\t\t_S_cur;\n\n    /// Request a seek relative to the current end of the sequence.\n    static const seekdir end =\t\t_S_end;\n\n    // Annex D.6\n    typedef int io_state;\n    typedef int open_mode;\n    typedef int seek_dir;\n\n    typedef std::streampos streampos;\n    typedef std::streamoff streamoff;\n\n    // Callbacks;\n    /**\n     *  @brief  The set of events that may be passed to an event callback.\n     *\n     *  erase_event is used during ~ios() and copyfmt().  imbue_event is used\n     *  during imbue().  copyfmt_event is used during copyfmt().\n    */\n    enum event\n    {\n      erase_event,\n      imbue_event,\n      copyfmt_event\n    };\n\n    /**\n     *  @brief  The type of an event callback function.\n     *  @param  event  One of the members of the event enum.\n     *  @param  ios_base  Reference to the ios_base object.\n     *  @param  int  The integer provided when the callback was registered.\n     *\n     *  Event callbacks are user defined functions that get called during\n     *  several ios_base and basic_ios functions, specifically imbue(),\n     *  copyfmt(), and ~ios().\n    */\n    typedef void (*event_callback) (event, ios_base&, int);\n\n    /**\n     *  @brief  Add the callback __fn with parameter __index.\n     *  @param  __fn  The function to add.\n     *  @param  __index  The integer to pass to the function when invoked.\n     *\n     *  Registers a function as an event callback with an integer parameter to\n     *  be passed to the function when invoked.  Multiple copies of the\n     *  function are allowed.  If there are multiple callbacks, they are\n     *  invoked in the order they were registered.\n    */\n    void\n    register_callback(event_callback __fn, int __index);\n\n  protected:\n    //@{\n    /**\n     *  @if maint\n     *  ios_base data members (doc me)\n     *  @endif\n    */\n    streamsize\t\t_M_precision;\n    streamsize\t\t_M_width;\n    fmtflags\t\t_M_flags;\n    iostate\t\t_M_exception;\n    iostate\t\t_M_streambuf_state;\n    //@}\n\n    // 27.4.2.6  Members for callbacks\n    // 27.4.2.6  ios_base callbacks\n    struct _Callback_list\n    {\n      // Data Members\n      _Callback_list*\t\t_M_next;\n      ios_base::event_callback\t_M_fn;\n      int\t\t\t_M_index;\n      _Atomic_word\t\t_M_refcount;  // 0 means one reference.\n\n      _Callback_list(ios_base::event_callback __fn, int __index,\n\t\t     _Callback_list* __cb)\n      : _M_next(__cb), _M_fn(__fn), _M_index(__index), _M_refcount(0) { }\n\n      void\n      _M_add_reference() { __gnu_cxx::__atomic_add_dispatch(&_M_refcount, 1); }\n\n      // 0 => OK to delete.\n      int\n      _M_remove_reference() \n      { return __gnu_cxx::__exchange_and_add_dispatch(&_M_refcount, -1); }\n    };\n\n     _Callback_list*\t_M_callbacks;\n\n    void\n    _M_call_callbacks(event __ev) throw();\n\n    void\n    _M_dispose_callbacks(void);\n\n    // 27.4.2.5  Members for iword/pword storage\n    struct _Words\n    {\n      void*\t_M_pword;\n      long\t_M_iword;\n      _Words() : _M_pword(0), _M_iword(0) { }\n    };\n\n    // Only for failed iword/pword calls.\n    _Words\t\t_M_word_zero;\n\n    // Guaranteed storage.\n    // The first 5 iword and pword slots are reserved for internal use.\n    enum { _S_local_word_size = 8 };\n    _Words\t\t_M_local_word[_S_local_word_size];\n\n    // Allocated storage.\n    int\t\t\t_M_word_size;\n    _Words*\t\t_M_word;\n\n    _Words&\n    _M_grow_words(int __index, bool __iword);\n\n    // Members for locale and locale caching.\n    locale\t\t_M_ios_locale;\n\n    void\n    _M_init();\n\n  public:\n\n    // 27.4.2.1.6  Class ios_base::Init\n    // Used to initialize standard streams. In theory, g++ could use\n    // -finit-priority to order this stuff correctly without going\n    // through these machinations.\n    class Init\n    {\n      friend class ios_base;\n    public:\n      Init();\n      ~Init();\n\n    private:\n      static _Atomic_word\t_S_refcount;\n      static bool\t\t_S_synced_with_stdio;\n    };\n\n    // [27.4.2.2] fmtflags state functions\n    /**\n     *  @brief  Access to format flags.\n     *  @return  The format control flags for both input and output.\n    */\n    inline fmtflags\n    flags() const { return _M_flags; }\n\n    /**\n     *  @brief  Setting new format flags all at once.\n     *  @param  fmtfl  The new flags to set.\n     *  @return  The previous format control flags.\n     *\n     *  This function overwrites all the format flags with @a fmtfl.\n    */\n    inline fmtflags\n    flags(fmtflags __fmtfl)\n    {\n      fmtflags __old = _M_flags;\n      _M_flags = __fmtfl;\n      return __old;\n    }\n\n    /**\n     *  @brief  Setting new format flags.\n     *  @param  fmtfl  Additional flags to set.\n     *  @return  The previous format control flags.\n     *\n     *  This function sets additional flags in format control.  Flags that\n     *  were previously set remain set.\n    */\n    inline fmtflags\n    setf(fmtflags __fmtfl)\n    {\n      fmtflags __old = _M_flags;\n      _M_flags |= __fmtfl;\n      return __old;\n    }\n\n    /**\n     *  @brief  Setting new format flags.\n     *  @param  fmtfl  Additional flags to set.\n     *  @param  mask  The flags mask for @a fmtfl.\n     *  @return  The previous format control flags.\n     *\n     *  This function clears @a mask in the format flags, then sets\n     *  @a fmtfl @c & @a mask.  An example mask is @c ios_base::adjustfield.\n    */\n    inline fmtflags\n    setf(fmtflags __fmtfl, fmtflags __mask)\n    {\n      fmtflags __old = _M_flags;\n      _M_flags &= ~__mask;\n      _M_flags |= (__fmtfl & __mask);\n      return __old;\n    }\n\n    /**\n     *  @brief  Clearing format flags.\n     *  @param  mask  The flags to unset.\n     *\n     *  This function clears @a mask in the format flags.\n    */\n    inline void\n    unsetf(fmtflags __mask) { _M_flags &= ~__mask; }\n\n    /**\n     *  @brief  Flags access.\n     *  @return  The precision to generate on certain output operations.\n     *\n     *  @if maint\n     *  Be careful if you try to give a definition of \"precision\" here; see\n     *  DR 189.\n     *  @endif\n    */\n    inline streamsize\n    precision() const { return _M_precision; }\n\n    /**\n     *  @brief  Changing flags.\n     *  @param  prec  The new precision value.\n     *  @return  The previous value of precision().\n    */\n    inline streamsize\n    precision(streamsize __prec)\n    {\n      streamsize __old = _M_precision;\n      _M_precision = __prec;\n      return __old;\n    }\n\n    /**\n     *  @brief  Flags access.\n     *  @return  The minimum field width to generate on output operations.\n     *\n     *  \"Minimum field width\" refers to the number of characters.\n    */\n    inline streamsize\n    width() const { return _M_width; }\n\n    /**\n     *  @brief  Changing flags.\n     *  @param  wide  The new width value.\n     *  @return  The previous value of width().\n    */\n    inline streamsize\n    width(streamsize __wide)\n    {\n      streamsize __old = _M_width;\n      _M_width = __wide;\n      return __old;\n    }\n\n    // [27.4.2.4] ios_base static members\n    /**\n     *  @brief  Interaction with the standard C I/O objects.\n     *  @param  sync  Whether to synchronize or not.\n     *  @return  True if the standard streams were previously synchronized.\n     *\n     *  The synchronization referred to is @e only that between the standard\n     *  C facilities (e.g., stdout) and the standard C++ objects (e.g.,\n     *  cout).  User-declared streams are unaffected.  See\n     *  http://gcc.gnu.org/onlinedocs/libstdc++/27_io/howto.html#8 for more.\n    */\n    static bool\n    sync_with_stdio(bool __sync = true);\n\n    // [27.4.2.3] ios_base locale functions\n    /**\n     *  @brief  Setting a new locale.\n     *  @param  loc  The new locale.\n     *  @return  The previous locale.\n     *\n     *  Sets the new locale for this stream, and then invokes each callback\n     *  with imbue_event.\n    */\n    locale\n    imbue(const locale& __loc);\n\n    /**\n     *  @brief  Locale access\n     *  @return  A copy of the current locale.\n     *\n     *  If @c imbue(loc) has previously been called, then this function\n     *  returns @c loc.  Otherwise, it returns a copy of @c std::locale(),\n     *  the global C++ locale.\n    */\n    inline locale\n    getloc() const { return _M_ios_locale; }\n\n    /**\n     *  @brief  Locale access\n     *  @return  A reference to the current locale.\n     *\n     *  Like getloc above, but returns a reference instead of\n     *  generating a copy.\n    */\n    inline const locale&\n    _M_getloc() const { return _M_ios_locale; }\n\n    // [27.4.2.5] ios_base storage functions\n    /**\n     *  @brief  Access to unique indices.\n     *  @return  An integer different from all previous calls.\n     *\n     *  This function returns a unique integer every time it is called.  It\n     *  can be used for any purpose, but is primarily intended to be a unique\n     *  index for the iword and pword functions.  The expectation is that an\n     *  application calls xalloc in order to obtain an index in the iword and\n     *  pword arrays that can be used without fear of conflict.\n     *\n     *  The implementation maintains a static variable that is incremented and\n     *  returned on each invocation.  xalloc is guaranteed to return an index\n     *  that is safe to use in the iword and pword arrays.\n    */\n    static int\n    xalloc() throw();\n\n    /**\n     *  @brief  Access to integer array.\n     *  @param  __ix  Index into the array.\n     *  @return  A reference to an integer associated with the index.\n     *\n     *  The iword function provides access to an array of integers that can be\n     *  used for any purpose.  The array grows as required to hold the\n     *  supplied index.  All integers in the array are initialized to 0.\n     *\n     *  The implementation reserves several indices.  You should use xalloc to\n     *  obtain an index that is safe to use.  Also note that since the array\n     *  can grow dynamically, it is not safe to hold onto the reference.\n    */\n    inline long&\n    iword(int __ix)\n    {\n      _Words& __word = (__ix < _M_word_size)\n\t\t\t? _M_word[__ix] : _M_grow_words(__ix, true);\n      return __word._M_iword;\n    }\n\n    /**\n     *  @brief  Access to void pointer array.\n     *  @param  __ix  Index into the array.\n     *  @return  A reference to a void* associated with the index.\n     *\n     *  The pword function provides access to an array of pointers that can be\n     *  used for any purpose.  The array grows as required to hold the\n     *  supplied index.  All pointers in the array are initialized to 0.\n     *\n     *  The implementation reserves several indices.  You should use xalloc to\n     *  obtain an index that is safe to use.  Also note that since the array\n     *  can grow dynamically, it is not safe to hold onto the reference.\n    */\n    inline void*&\n    pword(int __ix)\n    {\n      _Words& __word = (__ix < _M_word_size)\n\t\t\t? _M_word[__ix] : _M_grow_words(__ix, false);\n      return __word._M_pword;\n    }\n\n    // Destructor\n    /**\n     *  Invokes each callback with erase_event.  Destroys local storage.\n     *\n     *  Note that the ios_base object for the standard streams never gets\n     *  destroyed.  As a result, any callbacks registered with the standard\n     *  streams will not get invoked with erase_event (unless copyfmt is\n     *  used).\n    */\n    virtual ~ios_base();\n\n  protected:\n    ios_base();\n\n  // _GLIBCXX_RESOLVE_LIB_DEFECTS\n  // 50.  Copy constructor and assignment operator of ios_base\n  private:\n    ios_base(const ios_base&);\n\n    ios_base&\n    operator=(const ios_base&);\n  };\n\n  // [27.4.5.1] fmtflags manipulators\n  /// Calls base.setf(ios_base::boolalpha).\n  inline ios_base&\n  boolalpha(ios_base& __base)\n  {\n    __base.setf(ios_base::boolalpha);\n    return __base;\n  }\n\n  /// Calls base.unsetf(ios_base::boolalpha).\n  inline ios_base&\n  noboolalpha(ios_base& __base)\n  {\n    __base.unsetf(ios_base::boolalpha);\n    return __base;\n  }\n\n  /// Calls base.setf(ios_base::showbase).\n  inline ios_base&\n  showbase(ios_base& __base)\n  {\n    __base.setf(ios_base::showbase);\n    return __base;\n  }\n\n  /// Calls base.unsetf(ios_base::showbase).\n  inline ios_base&\n  noshowbase(ios_base& __base)\n  {\n    __base.unsetf(ios_base::showbase);\n    return __base;\n  }\n\n  /// Calls base.setf(ios_base::showpoint).\n  inline ios_base&\n  showpoint(ios_base& __base)\n  {\n    __base.setf(ios_base::showpoint);\n    return __base;\n  }\n\n  /// Calls base.unsetf(ios_base::showpoint).\n  inline ios_base&\n  noshowpoint(ios_base& __base)\n  {\n    __base.unsetf(ios_base::showpoint);\n    return __base;\n  }\n\n  /// Calls base.setf(ios_base::showpos).\n  inline ios_base&\n  showpos(ios_base& __base)\n  {\n    __base.setf(ios_base::showpos);\n    return __base;\n  }\n\n  /// Calls base.unsetf(ios_base::showpos).\n  inline ios_base&\n  noshowpos(ios_base& __base)\n  {\n    __base.unsetf(ios_base::showpos);\n    return __base;\n  }\n\n  /// Calls base.setf(ios_base::skipws).\n  inline ios_base&\n  skipws(ios_base& __base)\n  {\n    __base.setf(ios_base::skipws);\n    return __base;\n  }\n\n  /// Calls base.unsetf(ios_base::skipws).\n  inline ios_base&\n  noskipws(ios_base& __base)\n  {\n    __base.unsetf(ios_base::skipws);\n    return __base;\n  }\n\n  /// Calls base.setf(ios_base::uppercase).\n  inline ios_base&\n  uppercase(ios_base& __base)\n  {\n    __base.setf(ios_base::uppercase);\n    return __base;\n  }\n\n  /// Calls base.unsetf(ios_base::uppercase).\n  inline ios_base&\n  nouppercase(ios_base& __base)\n  {\n    __base.unsetf(ios_base::uppercase);\n    return __base;\n  }\n\n  /// Calls base.setf(ios_base::unitbuf).\n  inline ios_base&\n  unitbuf(ios_base& __base)\n  {\n     __base.setf(ios_base::unitbuf);\n     return __base;\n  }\n\n  /// Calls base.unsetf(ios_base::unitbuf).\n  inline ios_base&\n  nounitbuf(ios_base& __base)\n  {\n     __base.unsetf(ios_base::unitbuf);\n     return __base;\n  }\n\n  // [27.4.5.2] adjustfield anipulators\n  /// Calls base.setf(ios_base::internal, ios_base::adjustfield).\n  inline ios_base&\n  internal(ios_base& __base)\n  {\n     __base.setf(ios_base::internal, ios_base::adjustfield);\n     return __base;\n  }\n\n  /// Calls base.setf(ios_base::left, ios_base::adjustfield).\n  inline ios_base&\n  left(ios_base& __base)\n  {\n    __base.setf(ios_base::left, ios_base::adjustfield);\n    return __base;\n  }\n\n  /// Calls base.setf(ios_base::right, ios_base::adjustfield).\n  inline ios_base&\n  right(ios_base& __base)\n  {\n    __base.setf(ios_base::right, ios_base::adjustfield);\n    return __base;\n  }\n\n  // [27.4.5.3] basefield anipulators\n  /// Calls base.setf(ios_base::dec, ios_base::basefield).\n  inline ios_base&\n  dec(ios_base& __base)\n  {\n    __base.setf(ios_base::dec, ios_base::basefield);\n    return __base;\n  }\n\n  /// Calls base.setf(ios_base::hex, ios_base::basefield).\n  inline ios_base&\n  hex(ios_base& __base)\n  {\n    __base.setf(ios_base::hex, ios_base::basefield);\n    return __base;\n  }\n\n  /// Calls base.setf(ios_base::oct, ios_base::basefield).\n  inline ios_base&\n  oct(ios_base& __base)\n  {\n    __base.setf(ios_base::oct, ios_base::basefield);\n    return __base;\n  }\n\n  // [27.4.5.4] floatfield anipulators\n  /// Calls base.setf(ios_base::fixed, ios_base::floatfield).\n  inline ios_base&\n  fixed(ios_base& __base)\n  {\n    __base.setf(ios_base::fixed, ios_base::floatfield);\n    return __base;\n  }\n\n  /// Calls base.setf(ios_base::scientific, ios_base::floatfield).\n  inline ios_base&\n  scientific(ios_base& __base)\n  {\n    __base.setf(ios_base::scientific, ios_base::floatfield);\n    return __base;\n  }\n\n_GLIBCXX_END_NAMESPACE\n\n#endif /* _IOS_BASE_H */\n\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/bits/istream.tcc",
    "content": "// istream classes -*- C++ -*-\n\n// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,\n// 2006, 2007\n// Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n/** @file istream.tcc\n *  This is an internal header file, included by other library headers.\n *  You should not attempt to use it directly.\n */\n\n//\n// ISO C++ 14882: 27.6.1  Input streams\n//\n\n#ifndef _ISTREAM_TCC\n#define _ISTREAM_TCC 1\n\n#pragma GCC system_header\n\n#include <locale>\n#include <ostream> // For flush()\n\n_GLIBCXX_BEGIN_NAMESPACE(std)\n\n  template<typename _CharT, typename _Traits>\n    basic_istream<_CharT, _Traits>::sentry::\n    sentry(basic_istream<_CharT, _Traits>& __in, bool __noskip) : _M_ok(false)\n    {\n      ios_base::iostate __err = ios_base::iostate(ios_base::goodbit);\n      if (__in.good())\n\t{\n\t  if (__in.tie())\n\t    __in.tie()->flush();\n\t  if (!__noskip && (__in.flags() & ios_base::skipws))\n\t    {\n\t      const __int_type __eof = traits_type::eof();\n\t      __streambuf_type* __sb = __in.rdbuf();\n\t      __int_type __c = __sb->sgetc();\n\n\t      const __ctype_type& __ct = __check_facet(__in._M_ctype);\n\t      while (!traits_type::eq_int_type(__c, __eof)\n\t\t     && __ct.is(ctype_base::space, \n\t\t\t\ttraits_type::to_char_type(__c)))\n\t\t__c = __sb->snextc();\n\n\t      // _GLIBCXX_RESOLVE_LIB_DEFECTS\n\t      // 195. Should basic_istream::sentry's constructor ever\n\t      // set eofbit?\n\t      if (traits_type::eq_int_type(__c, __eof))\n\t\t__err |= ios_base::eofbit;\n\t    }\n\t}\n\n      if (__in.good() && __err == ios_base::goodbit)\n\t_M_ok = true;\n      else\n\t{\n\t  __err |= ios_base::failbit;\n\t  __in.setstate(__err);\n\t}\n    }\n\n  template<typename _CharT, typename _Traits>\n    template<typename _ValueT>\n      basic_istream<_CharT, _Traits>&\n      basic_istream<_CharT, _Traits>::\n      _M_extract(_ValueT& __v)\n      {\n\tsentry __cerb(*this, false);\n\tif (__cerb)\n\t  {\n\t    ios_base::iostate __err = ios_base::iostate(ios_base::goodbit);\n\t    try\n\t      {\n\t\tconst __num_get_type& __ng = __check_facet(this->_M_num_get);\n\t\t__ng.get(*this, 0, *this, __err, __v);\n\t      }\n\t    catch(...)\n\t      { this->_M_setstate(ios_base::badbit); }\n\t    if (__err)\n\t      this->setstate(__err);\n\t  }\n\treturn *this;\n      }\n\n  template<typename _CharT, typename _Traits>\n    basic_istream<_CharT, _Traits>&\n    basic_istream<_CharT, _Traits>::\n    operator>>(short& __n)\n    {\n      // _GLIBCXX_RESOLVE_LIB_DEFECTS\n      // 118. basic_istream uses nonexistent num_get member functions.\n      long __l;\n      _M_extract(__l);\n      if (!this->fail())\n\t{\n\t  if (numeric_limits<short>::min() <= __l\n\t      && __l <= numeric_limits<short>::max())\n\t    __n = __l;\n\t  else\n\t    this->setstate(ios_base::failbit);\n\t}\n      return *this;\n    }\n    \n  template<typename _CharT, typename _Traits>\n    basic_istream<_CharT, _Traits>&\n    basic_istream<_CharT, _Traits>::\n    operator>>(int& __n)\n    {\n      // _GLIBCXX_RESOLVE_LIB_DEFECTS\n      // 118. basic_istream uses nonexistent num_get member functions.\n      long __l;\n      _M_extract(__l);\n      if (!this->fail())\n\t{\n\t  if (numeric_limits<int>::min() <= __l\n\t      && __l <= numeric_limits<int>::max())\n\t    __n = __l;\n\t  else\n\t    this->setstate(ios_base::failbit);\n\t}\n      return *this;\n    }\n\n  template<typename _CharT, typename _Traits>\n    basic_istream<_CharT, _Traits>&\n    basic_istream<_CharT, _Traits>::\n    operator>>(__streambuf_type* __sbout)\n    {\n      ios_base::iostate __err = ios_base::iostate(ios_base::goodbit);\n      sentry __cerb(*this, false);\n      if (__cerb && __sbout)\n\t{\n\t  try\n\t    {\n\t      bool __ineof;\n\t      if (!__copy_streambufs_eof(this->rdbuf(), __sbout, __ineof))\n\t\t__err |= ios_base::failbit;\n\t      if (__ineof)\n\t\t__err |= ios_base::eofbit;\n\t    }\n\t  catch(...)\n\t    { this->_M_setstate(ios_base::failbit); }\n\t}\n      else if (!__sbout)\n\t__err |= ios_base::failbit;\n      if (__err)\n\tthis->setstate(__err);\n      return *this;\n    }\n\n  template<typename _CharT, typename _Traits>\n    typename basic_istream<_CharT, _Traits>::int_type\n    basic_istream<_CharT, _Traits>::\n    get(void)\n    {\n      const int_type __eof = traits_type::eof();\n      int_type __c = __eof;\n      _M_gcount = 0;\n      ios_base::iostate __err = ios_base::iostate(ios_base::goodbit);\n      sentry __cerb(*this, true);\n      if (__cerb)\n\t{\n\t  try\n\t    {\n\t      __c = this->rdbuf()->sbumpc();\n\t      // 27.6.1.1 paragraph 3\n\t      if (!traits_type::eq_int_type(__c, __eof))\n\t\t_M_gcount = 1;\n\t      else\n\t\t__err |= ios_base::eofbit;\n\t    }\n\t  catch(...)\n\t    { this->_M_setstate(ios_base::badbit); }\n\t}\n      if (!_M_gcount)\n\t__err |= ios_base::failbit;\n      if (__err)\n\tthis->setstate(__err);\n      return __c;\n    }\n\n  template<typename _CharT, typename _Traits>\n    basic_istream<_CharT, _Traits>&\n    basic_istream<_CharT, _Traits>::\n    get(char_type& __c)\n    {\n      _M_gcount = 0;\n      ios_base::iostate __err = ios_base::iostate(ios_base::goodbit);\n      sentry __cerb(*this, true);\n      if (__cerb)\n\t{\n\t  try\n\t    {\n\t      const int_type __cb = this->rdbuf()->sbumpc();\n\t      // 27.6.1.1 paragraph 3\n\t      if (!traits_type::eq_int_type(__cb, traits_type::eof()))\n\t\t{\n\t\t  _M_gcount = 1;\n\t\t  __c = traits_type::to_char_type(__cb);\n\t\t}\n\t      else\n\t\t__err |= ios_base::eofbit;\n\t    }\n\t  catch(...)\n\t    { this->_M_setstate(ios_base::badbit); }\n\t}\n      if (!_M_gcount)\n\t__err |= ios_base::failbit;\n      if (__err)\n\tthis->setstate(__err);\n      return *this;\n    }\n\n  template<typename _CharT, typename _Traits>\n    basic_istream<_CharT, _Traits>&\n    basic_istream<_CharT, _Traits>::\n    get(char_type* __s, streamsize __n, char_type __delim)\n    {\n      _M_gcount = 0;\n      ios_base::iostate __err = ios_base::iostate(ios_base::goodbit);\n      sentry __cerb(*this, true);\n      if (__cerb)\n\t{\n\t  try\n\t    {\n\t      const int_type __idelim = traits_type::to_int_type(__delim);\n\t      const int_type __eof = traits_type::eof();\n\t      __streambuf_type* __sb = this->rdbuf();\n\t      int_type __c = __sb->sgetc();\n\n\t      while (_M_gcount + 1 < __n\n\t\t     && !traits_type::eq_int_type(__c, __eof)\n\t\t     && !traits_type::eq_int_type(__c, __idelim))\n\t\t{\n\t\t  *__s++ = traits_type::to_char_type(__c);\n\t\t  ++_M_gcount;\n\t\t  __c = __sb->snextc();\n\t\t}\n\t      if (traits_type::eq_int_type(__c, __eof))\n\t\t__err |= ios_base::eofbit;\n\t    }\n\t  catch(...)\n\t    { this->_M_setstate(ios_base::badbit); }\n\t}\n      // _GLIBCXX_RESOLVE_LIB_DEFECTS\n      // 243. get and getline when sentry reports failure.\n      if (__n > 0)\n\t*__s = char_type();\n      if (!_M_gcount)\n\t__err |= ios_base::failbit;\n      if (__err)\n\tthis->setstate(__err);\n      return *this;\n    }\n\n  template<typename _CharT, typename _Traits>\n    basic_istream<_CharT, _Traits>&\n    basic_istream<_CharT, _Traits>::\n    get(__streambuf_type& __sb, char_type __delim)\n    {\n      _M_gcount = 0;\n      ios_base::iostate __err = ios_base::iostate(ios_base::goodbit);\n      sentry __cerb(*this, true);\n      if (__cerb)\n\t{\n\t  try\n\t    {\n\t      const int_type __idelim = traits_type::to_int_type(__delim);\n\t      const int_type __eof = traits_type::eof();\n\t      __streambuf_type* __this_sb = this->rdbuf();\n\t      int_type __c = __this_sb->sgetc();\n\t      char_type __c2 = traits_type::to_char_type(__c);\n\n\t      while (!traits_type::eq_int_type(__c, __eof)\n\t\t     && !traits_type::eq_int_type(__c, __idelim)\n\t\t     && !traits_type::eq_int_type(__sb.sputc(__c2), __eof))\n\t\t{\n\t\t  ++_M_gcount;\n\t\t  __c = __this_sb->snextc();\n\t\t  __c2 = traits_type::to_char_type(__c);\n\t\t}\n\t      if (traits_type::eq_int_type(__c, __eof))\n\t\t__err |= ios_base::eofbit;\n\t    }\n\t  catch(...)\n\t    { this->_M_setstate(ios_base::badbit); }\n\t}\n      if (!_M_gcount)\n\t__err |= ios_base::failbit;\n      if (__err)\n\tthis->setstate(__err);\n      return *this;\n    }\n\n  template<typename _CharT, typename _Traits>\n    basic_istream<_CharT, _Traits>&\n    basic_istream<_CharT, _Traits>::\n    getline(char_type* __s, streamsize __n, char_type __delim)\n    {\n      _M_gcount = 0;\n      ios_base::iostate __err = ios_base::iostate(ios_base::goodbit);\n      sentry __cerb(*this, true);\n      if (__cerb)\n        {\n          try\n            {\n              const int_type __idelim = traits_type::to_int_type(__delim);\n              const int_type __eof = traits_type::eof();\n              __streambuf_type* __sb = this->rdbuf();\n              int_type __c = __sb->sgetc();\n\n              while (_M_gcount + 1 < __n\n                     && !traits_type::eq_int_type(__c, __eof)\n                     && !traits_type::eq_int_type(__c, __idelim))\n                {\n                  *__s++ = traits_type::to_char_type(__c);\n                  __c = __sb->snextc();\n                  ++_M_gcount;\n                }\n              if (traits_type::eq_int_type(__c, __eof))\n                __err |= ios_base::eofbit;\n              else\n                {\n                  if (traits_type::eq_int_type(__c, __idelim))\n                    {\n                      __sb->sbumpc();\n                      ++_M_gcount;\n                    }\n                  else\n                    __err |= ios_base::failbit;\n                }\n            }\n          catch(...)\n            { this->_M_setstate(ios_base::badbit); }\n        }\n      // _GLIBCXX_RESOLVE_LIB_DEFECTS\n      // 243. get and getline when sentry reports failure.\n      if (__n > 0)\n\t*__s = char_type();\n      if (!_M_gcount)\n        __err |= ios_base::failbit;\n      if (__err)\n        this->setstate(__err);\n      return *this;\n    }\n\n  // We provide three overloads, since the first two are much simpler\n  // than the general case. Also, the latter two can thus adopt the\n  // same \"batchy\" strategy used by getline above.\n  template<typename _CharT, typename _Traits>\n    basic_istream<_CharT, _Traits>&\n    basic_istream<_CharT, _Traits>::\n    ignore(void)\n    {\n      _M_gcount = 0;\n      sentry __cerb(*this, true);\n      if (__cerb)\n\t{\n\t  ios_base::iostate __err = ios_base::iostate(ios_base::goodbit);\n\t  try\n\t    {\n\t      const int_type __eof = traits_type::eof();\n\t      __streambuf_type* __sb = this->rdbuf();\n\n\t      if (traits_type::eq_int_type(__sb->sbumpc(), __eof))\n\t\t__err |= ios_base::eofbit;\n\t      else\n\t\t_M_gcount = 1;\n\t    }\n\t  catch(...)\n\t    { this->_M_setstate(ios_base::badbit); }\n\t  if (__err)\n\t    this->setstate(__err);\n\t}\n      return *this;\n    }\n\n  template<typename _CharT, typename _Traits>\n    basic_istream<_CharT, _Traits>&\n    basic_istream<_CharT, _Traits>::\n    ignore(streamsize __n)\n    {\n      _M_gcount = 0;\n      sentry __cerb(*this, true);\n      if (__cerb && __n > 0)\n        {\n          ios_base::iostate __err = ios_base::iostate(ios_base::goodbit);\n          try\n            {\n              const int_type __eof = traits_type::eof();\n              __streambuf_type* __sb = this->rdbuf();\n              int_type __c = __sb->sgetc();\n\n\t      // N.B. On LFS-enabled platforms streamsize is still 32 bits\n\t      // wide: if we want to implement the standard mandated behavior\n\t      // for n == max() (see 27.6.1.3/24) we are at risk of signed\n\t      // integer overflow: thus these contortions. Also note that,\n\t      // by definition, when more than 2G chars are actually ignored,\n\t      // _M_gcount (the return value of gcount, that is) cannot be\n\t      // really correct, being unavoidably too small.\n\t      bool __large_ignore = false;\n\t      while (true)\n\t\t{\n\t\t  while (_M_gcount < __n\n\t\t\t && !traits_type::eq_int_type(__c, __eof))\n\t\t    {\n\t\t      ++_M_gcount;\n\t\t      __c = __sb->snextc();\n\t\t    }\n\t\t  if (__n == numeric_limits<streamsize>::max()\n\t\t      && !traits_type::eq_int_type(__c, __eof))\n\t\t    {\n\t\t      _M_gcount = numeric_limits<streamsize>::min();\n\t\t      __large_ignore = true;\n\t\t    }\n\t\t  else\n\t\t    break;\n\t\t}\n\n\t      if (__large_ignore)\n\t\t_M_gcount = numeric_limits<streamsize>::max();\n\n\t      if (traits_type::eq_int_type(__c, __eof))\n                __err |= ios_base::eofbit;\n            }\n          catch(...)\n            { this->_M_setstate(ios_base::badbit); }\n          if (__err)\n            this->setstate(__err);\n        }\n      return *this;\n    }\n\n  template<typename _CharT, typename _Traits>\n    basic_istream<_CharT, _Traits>&\n    basic_istream<_CharT, _Traits>::\n    ignore(streamsize __n, int_type __delim)\n    {\n      _M_gcount = 0;\n      sentry __cerb(*this, true);\n      if (__cerb && __n > 0)\n        {\n          ios_base::iostate __err = ios_base::iostate(ios_base::goodbit);\n          try\n            {\n              const int_type __eof = traits_type::eof();\n              __streambuf_type* __sb = this->rdbuf();\n              int_type __c = __sb->sgetc();\n\n\t      // See comment above.\n\t      bool __large_ignore = false;\n\t      while (true)\n\t\t{\n\t\t  while (_M_gcount < __n\n\t\t\t && !traits_type::eq_int_type(__c, __eof)\n\t\t\t && !traits_type::eq_int_type(__c, __delim))\n\t\t    {\n\t\t      ++_M_gcount;\n\t\t      __c = __sb->snextc();\n\t\t    }\n\t\t  if (__n == numeric_limits<streamsize>::max()\n\t\t      && !traits_type::eq_int_type(__c, __eof)\n\t\t      && !traits_type::eq_int_type(__c, __delim))\n\t\t    {\n\t\t      _M_gcount = numeric_limits<streamsize>::min();\n\t\t      __large_ignore = true;\n\t\t    }\n\t\t  else\n\t\t    break;\n\t\t}\n\n\t      if (__large_ignore)\n\t\t_M_gcount = numeric_limits<streamsize>::max();\n\n              if (traits_type::eq_int_type(__c, __eof))\n                __err |= ios_base::eofbit;\n\t      else if (traits_type::eq_int_type(__c, __delim))\n\t\t{\n\t\t  if (_M_gcount < numeric_limits<streamsize>::max())\n\t\t    ++_M_gcount;\n\t\t  __sb->sbumpc();\n\t\t}\n            }\n          catch(...)\n            { this->_M_setstate(ios_base::badbit); }\n          if (__err)\n            this->setstate(__err);\n        }\n      return *this;\n    }\n\n  template<typename _CharT, typename _Traits>\n    typename basic_istream<_CharT, _Traits>::int_type\n    basic_istream<_CharT, _Traits>::\n    peek(void)\n    {\n      int_type __c = traits_type::eof();\n      _M_gcount = 0;\n      sentry __cerb(*this, true);\n      if (__cerb)\n\t{\n\t  ios_base::iostate __err = ios_base::iostate(ios_base::goodbit);\n\t  try\n\t    {\n\t      __c = this->rdbuf()->sgetc();\n\t      if (traits_type::eq_int_type(__c, traits_type::eof()))\n\t\t__err |= ios_base::eofbit;\n\t    }\n\t  catch(...)\n\t    { this->_M_setstate(ios_base::badbit); }\n\t  if (__err)\n\t    this->setstate(__err);\n\t}\n      return __c;\n    }\n\n  template<typename _CharT, typename _Traits>\n    basic_istream<_CharT, _Traits>&\n    basic_istream<_CharT, _Traits>::\n    read(char_type* __s, streamsize __n)\n    {\n      _M_gcount = 0;\n      sentry __cerb(*this, true);\n      if (__cerb)\n\t{\n\t  ios_base::iostate __err = ios_base::iostate(ios_base::goodbit);\n\t  try\n\t    {\n\t      _M_gcount = this->rdbuf()->sgetn(__s, __n);\n\t      if (_M_gcount != __n)\n\t\t__err |= (ios_base::eofbit | ios_base::failbit);\n\t    }\n\t  catch(...)\n\t    { this->_M_setstate(ios_base::badbit); }\n\t  if (__err)\n\t    this->setstate(__err);\n\t}\n      return *this;\n    }\n\n  template<typename _CharT, typename _Traits>\n    streamsize\n    basic_istream<_CharT, _Traits>::\n    readsome(char_type* __s, streamsize __n)\n    {\n      _M_gcount = 0;\n      sentry __cerb(*this, true);\n      if (__cerb)\n\t{\n\t  ios_base::iostate __err = ios_base::iostate(ios_base::goodbit);\n\t  try\n\t    {\n\t      // Cannot compare int_type with streamsize generically.\n\t      const streamsize __num = this->rdbuf()->in_avail();\n\t      if (__num > 0)\n\t\t_M_gcount = this->rdbuf()->sgetn(__s, std::min(__num, __n));\n\t      else if (__num == -1)\n\t\t__err |= ios_base::eofbit;\n\t    }\n\t  catch(...)\n\t    { this->_M_setstate(ios_base::badbit); }\n\t  if (__err)\n\t    this->setstate(__err);\n\t}\n      return _M_gcount;\n    }\n\n  template<typename _CharT, typename _Traits>\n    basic_istream<_CharT, _Traits>&\n    basic_istream<_CharT, _Traits>::\n    putback(char_type __c)\n    {\n      // _GLIBCXX_RESOLVE_LIB_DEFECTS\n      // 60. What is a formatted input function?\n      _M_gcount = 0;\n      sentry __cerb(*this, true);\n      if (__cerb)\n\t{\n\t  ios_base::iostate __err = ios_base::iostate(ios_base::goodbit);\n\t  try\n\t    {\n\t      const int_type __eof = traits_type::eof();\n\t      __streambuf_type* __sb = this->rdbuf();\n\t      if (!__sb\n\t\t  || traits_type::eq_int_type(__sb->sputbackc(__c), __eof))\n\t\t__err |= ios_base::badbit;\n\t    }\n\t  catch(...)\n\t    { this->_M_setstate(ios_base::badbit); }\n\t  if (__err)\n\t    this->setstate(__err);\n\t}\n      return *this;\n    }\n\n  template<typename _CharT, typename _Traits>\n    basic_istream<_CharT, _Traits>&\n    basic_istream<_CharT, _Traits>::\n    unget(void)\n    {\n      // _GLIBCXX_RESOLVE_LIB_DEFECTS\n      // 60. What is a formatted input function?\n      _M_gcount = 0;\n      sentry __cerb(*this, true);\n      if (__cerb)\n\t{\n\t  ios_base::iostate __err = ios_base::iostate(ios_base::goodbit);\n\t  try\n\t    {\n\t      const int_type __eof = traits_type::eof();\n\t      __streambuf_type* __sb = this->rdbuf();\n\t      if (!__sb\n\t\t  || traits_type::eq_int_type(__sb->sungetc(), __eof))\n\t\t__err |= ios_base::badbit;\n\t    }\n\t  catch(...)\n\t    { this->_M_setstate(ios_base::badbit); }\n\t  if (__err)\n\t    this->setstate(__err);\n\t}\n      return *this;\n    }\n\n  template<typename _CharT, typename _Traits>\n    int\n    basic_istream<_CharT, _Traits>::\n    sync(void)\n    {\n      // _GLIBCXX_RESOLVE_LIB_DEFECTS\n      // DR60.  Do not change _M_gcount.\n      int __ret = -1;\n      sentry __cerb(*this, true);\n      if (__cerb)\n\t{\n\t  ios_base::iostate __err = ios_base::iostate(ios_base::goodbit);\n\t  try\n\t    {\n\t      __streambuf_type* __sb = this->rdbuf();\n\t      if (__sb)\n\t\t{\n\t\t  if (__sb->pubsync() == -1)\n\t\t    __err |= ios_base::badbit;\n\t\t  else\n\t\t    __ret = 0;\n\t\t}\n\t    }\n\t  catch(...)\n\t    { this->_M_setstate(ios_base::badbit); }\n\t  if (__err)\n\t    this->setstate(__err);\n\t}\n      return __ret;\n    }\n\n  template<typename _CharT, typename _Traits>\n    typename basic_istream<_CharT, _Traits>::pos_type\n    basic_istream<_CharT, _Traits>::\n    tellg(void)\n    {\n      // _GLIBCXX_RESOLVE_LIB_DEFECTS\n      // DR60.  Do not change _M_gcount.\n      pos_type __ret = pos_type(-1);\n      try\n\t{\n\t  if (!this->fail())\n\t    __ret = this->rdbuf()->pubseekoff(0, ios_base::cur,\n\t\t\t\t\t      ios_base::in);\n\t}\n      catch(...)\n\t{ this->_M_setstate(ios_base::badbit); }\n      return __ret;\n    }\n\n  template<typename _CharT, typename _Traits>\n    basic_istream<_CharT, _Traits>&\n    basic_istream<_CharT, _Traits>::\n    seekg(pos_type __pos)\n    {\n      // _GLIBCXX_RESOLVE_LIB_DEFECTS\n      // DR60.  Do not change _M_gcount.\n      ios_base::iostate __err = ios_base::iostate(ios_base::goodbit);\n      try\n\t{\n\t  if (!this->fail())\n\t    {\n\t      // 136.  seekp, seekg setting wrong streams?\n\t      const pos_type __p = this->rdbuf()->pubseekpos(__pos,\n\t\t\t\t\t\t\t     ios_base::in);\n\t      \n\t      // 129.  Need error indication from seekp() and seekg()\n\t      if (__p == pos_type(off_type(-1)))\n\t\t__err |= ios_base::failbit;\n\t    }\n\t}\n      catch(...)\n\t{ this->_M_setstate(ios_base::badbit); }\n      if (__err)\n\tthis->setstate(__err);\n      return *this;\n    }\n\n  template<typename _CharT, typename _Traits>\n    basic_istream<_CharT, _Traits>&\n    basic_istream<_CharT, _Traits>::\n    seekg(off_type __off, ios_base::seekdir __dir)\n    {\n      // _GLIBCXX_RESOLVE_LIB_DEFECTS\n      // DR60.  Do not change _M_gcount.\n      ios_base::iostate __err = ios_base::iostate(ios_base::goodbit);\n      try\n\t{\n\t  if (!this->fail())\n\t    {\n\t      // 136.  seekp, seekg setting wrong streams?\n\t      const pos_type __p = this->rdbuf()->pubseekoff(__off, __dir,\n\t\t\t\t\t\t\t     ios_base::in);\n\t      \n\t      // 129.  Need error indication from seekp() and seekg()\n\t      if (__p == pos_type(off_type(-1)))\n\t\t__err |= ios_base::failbit;\n\t    }\n\t}\n      catch(...)\n\t{ this->_M_setstate(ios_base::badbit); }\n      if (__err)\n\tthis->setstate(__err);\n      return *this;\n    }\n\n  // 27.6.1.2.3 Character extraction templates\n  template<typename _CharT, typename _Traits>\n    basic_istream<_CharT, _Traits>&\n    operator>>(basic_istream<_CharT, _Traits>& __in, _CharT& __c)\n    {\n      typedef basic_istream<_CharT, _Traits>\t\t__istream_type;\n      typedef typename __istream_type::int_type         __int_type;\n\n      typename __istream_type::sentry __cerb(__in, false);\n      if (__cerb)\n\t{\n\t  ios_base::iostate __err = ios_base::iostate(ios_base::goodbit);\n\t  try\n\t    {\n\t      const __int_type __cb = __in.rdbuf()->sbumpc();\n\t      if (!_Traits::eq_int_type(__cb, _Traits::eof()))\n\t\t__c = _Traits::to_char_type(__cb);\n\t      else\n\t\t__err |= (ios_base::eofbit | ios_base::failbit);\n\t    }\n\t  catch(...)\n\t    { __in._M_setstate(ios_base::badbit); }\n\t  if (__err)\n\t    __in.setstate(__err);\n\t}\n      return __in;\n    }\n\n  template<typename _CharT, typename _Traits>\n    basic_istream<_CharT, _Traits>&\n    operator>>(basic_istream<_CharT, _Traits>& __in, _CharT* __s)\n    {\n      typedef basic_istream<_CharT, _Traits>\t\t__istream_type;\n      typedef typename __istream_type::__streambuf_type __streambuf_type;\n      typedef typename _Traits::int_type\t\tint_type;\n      typedef _CharT\t\t\t\t\tchar_type;\n      typedef ctype<_CharT>\t\t\t\t__ctype_type;\n\n      streamsize __extracted = 0;\n      ios_base::iostate __err = ios_base::iostate(ios_base::goodbit);\n      typename __istream_type::sentry __cerb(__in, false);\n      if (__cerb)\n\t{\n\t  try\n\t    {\n\t      // Figure out how many characters to extract.\n\t      streamsize __num = __in.width();\n\t      if (__num <= 0)\n\t\t__num = numeric_limits<streamsize>::max();\n\n\t      const __ctype_type& __ct = use_facet<__ctype_type>(__in.getloc());\n\n\t      const int_type __eof = _Traits::eof();\n\t      __streambuf_type* __sb = __in.rdbuf();\n\t      int_type __c = __sb->sgetc();\n\n\t      while (__extracted < __num - 1\n\t\t     && !_Traits::eq_int_type(__c, __eof)\n\t\t     && !__ct.is(ctype_base::space,\n\t\t\t\t _Traits::to_char_type(__c)))\n\t\t{\n\t\t  *__s++ = _Traits::to_char_type(__c);\n\t\t  ++__extracted;\n\t\t  __c = __sb->snextc();\n\t\t}\n\t      if (_Traits::eq_int_type(__c, __eof))\n\t\t__err |= ios_base::eofbit;\n\n\t      // _GLIBCXX_RESOLVE_LIB_DEFECTS\n\t      // 68.  Extractors for char* should store null at end\n\t      *__s = char_type();\n\t      __in.width(0);\n\t    }\n\t  catch(...)\n\t    { __in._M_setstate(ios_base::badbit); }\n\t}\n      if (!__extracted)\n\t__err |= ios_base::failbit;\n      if (__err)\n\t__in.setstate(__err);\n      return __in;\n    }\n\n  // 27.6.1.4 Standard basic_istream manipulators\n  template<typename _CharT, typename _Traits>\n    basic_istream<_CharT,_Traits>&\n    ws(basic_istream<_CharT,_Traits>& __in)\n    {\n      typedef basic_istream<_CharT, _Traits>\t\t__istream_type;\n      typedef typename __istream_type::__streambuf_type __streambuf_type;\n      typedef typename __istream_type::__ctype_type\t__ctype_type;\n      typedef typename __istream_type::int_type\t\t__int_type;\n\n      const __ctype_type& __ct = use_facet<__ctype_type>(__in.getloc());\n      const __int_type __eof = _Traits::eof();\n      __streambuf_type* __sb = __in.rdbuf();\n      __int_type __c = __sb->sgetc();\n\n      while (!_Traits::eq_int_type(__c, __eof)\n\t     && __ct.is(ctype_base::space, _Traits::to_char_type(__c)))\n\t__c = __sb->snextc();\n\n       if (_Traits::eq_int_type(__c, __eof))\n\t __in.setstate(ios_base::eofbit);\n      return __in;\n    }\n\n  // 21.3.7.9 basic_string::getline and operators\n  template<typename _CharT, typename _Traits, typename _Alloc>\n    basic_istream<_CharT, _Traits>&\n    operator>>(basic_istream<_CharT, _Traits>& __in,\n\t       basic_string<_CharT, _Traits, _Alloc>& __str)\n    {\n      typedef basic_istream<_CharT, _Traits>\t\t__istream_type;\n      typedef typename __istream_type::int_type\t\t__int_type;\n      typedef typename __istream_type::__streambuf_type __streambuf_type;\n      typedef typename __istream_type::__ctype_type\t__ctype_type;\n      typedef basic_string<_CharT, _Traits, _Alloc>\t__string_type;\n      typedef typename __string_type::size_type\t\t__size_type;\n\n      __size_type __extracted = 0;\n      ios_base::iostate __err = ios_base::iostate(ios_base::goodbit);\n      typename __istream_type::sentry __cerb(__in, false);\n      if (__cerb)\n\t{\n\t  try\n\t    {\n\t      // Avoid reallocation for common case.\n\t      __str.erase();\n\t      _CharT __buf[128];\n\t      __size_type __len = 0;\t      \n\t      const streamsize __w = __in.width();\n\t      const __size_type __n = __w > 0 ? static_cast<__size_type>(__w)\n\t\t                              : __str.max_size();\n\t      const __ctype_type& __ct = use_facet<__ctype_type>(__in.getloc());\n\t      const __int_type __eof = _Traits::eof();\n\t      __streambuf_type* __sb = __in.rdbuf();\n\t      __int_type __c = __sb->sgetc();\n\n\t      while (__extracted < __n\n\t\t     && !_Traits::eq_int_type(__c, __eof)\n\t\t     && !__ct.is(ctype_base::space, _Traits::to_char_type(__c)))\n\t\t{\n\t\t  if (__len == sizeof(__buf) / sizeof(_CharT))\n\t\t    {\n\t\t      __str.append(__buf, sizeof(__buf) / sizeof(_CharT));\n\t\t      __len = 0;\n\t\t    }\n\t\t  __buf[__len++] = _Traits::to_char_type(__c);\n\t\t  ++__extracted;\n\t\t  __c = __sb->snextc();\n\t\t}\n\t      __str.append(__buf, __len);\n\n\t      if (_Traits::eq_int_type(__c, __eof))\n\t\t__err |= ios_base::eofbit;\n\t      __in.width(0);\n\t    }\n\t  catch(...)\n\t    {\n\t      // _GLIBCXX_RESOLVE_LIB_DEFECTS\n\t      // 91. Description of operator>> and getline() for string<>\n\t      // might cause endless loop\n\t      __in._M_setstate(ios_base::badbit);\n\t    }\n\t}\n      // 211.  operator>>(istream&, string&) doesn't set failbit\n      if (!__extracted)\n\t__err |= ios_base::failbit;\n      if (__err)\n\t__in.setstate(__err);\n      return __in;\n    }\n\n  template<typename _CharT, typename _Traits, typename _Alloc>\n    basic_istream<_CharT, _Traits>&\n    getline(basic_istream<_CharT, _Traits>& __in,\n\t    basic_string<_CharT, _Traits, _Alloc>& __str, _CharT __delim)\n    {\n      typedef basic_istream<_CharT, _Traits>\t\t__istream_type;\n      typedef typename __istream_type::int_type\t\t__int_type;\n      typedef typename __istream_type::__streambuf_type __streambuf_type;\n      typedef typename __istream_type::__ctype_type\t__ctype_type;\n      typedef basic_string<_CharT, _Traits, _Alloc>\t__string_type;\n      typedef typename __string_type::size_type\t\t__size_type;\n\n      __size_type __extracted = 0;\n      const __size_type __n = __str.max_size();\n      ios_base::iostate __err = ios_base::iostate(ios_base::goodbit);\n      typename __istream_type::sentry __cerb(__in, true);\n      if (__cerb)\n\t{\n\t  try\n\t    {\n\t      __str.erase();\n\t      const __int_type __idelim = _Traits::to_int_type(__delim);\n\t      const __int_type __eof = _Traits::eof();\n\t      __streambuf_type* __sb = __in.rdbuf();\n\t      __int_type __c = __sb->sgetc();\n\n\t      while (__extracted < __n\n\t\t     && !_Traits::eq_int_type(__c, __eof)\n\t\t     && !_Traits::eq_int_type(__c, __idelim))\n\t\t{\n\t\t  __str += _Traits::to_char_type(__c);\n\t\t  ++__extracted;\n\t\t  __c = __sb->snextc();\n\t\t}\n\n\t      if (_Traits::eq_int_type(__c, __eof))\n\t\t__err |= ios_base::eofbit;\n\t      else if (_Traits::eq_int_type(__c, __idelim))\n\t\t{\n\t\t  ++__extracted;\t\t  \n\t\t  __sb->sbumpc();\n\t\t}\n\t      else\n\t\t__err |= ios_base::failbit;\n\t    }\n\t  catch(...)\n\t    {\n\t      // _GLIBCXX_RESOLVE_LIB_DEFECTS\n\t      // 91. Description of operator>> and getline() for string<>\n\t      // might cause endless loop\n\t      __in._M_setstate(ios_base::badbit);\n\t    }\n\t}\n      if (!__extracted)\n\t__err |= ios_base::failbit;\n      if (__err)\n\t__in.setstate(__err);\n      return __in;\n    }\n\n  // Inhibit implicit instantiations for required instantiations,\n  // which are defined via explicit instantiations elsewhere.\n  // NB:  This syntax is a GNU extension.\n#if _GLIBCXX_EXTERN_TEMPLATE\n  extern template class basic_istream<char>;\n  extern template istream& ws(istream&);\n  extern template istream& operator>>(istream&, char&);\n  extern template istream& operator>>(istream&, char*);\n  extern template istream& operator>>(istream&, unsigned char&);\n  extern template istream& operator>>(istream&, signed char&);\n  extern template istream& operator>>(istream&, unsigned char*);\n  extern template istream& operator>>(istream&, signed char*);\n\n  extern template istream& istream::_M_extract(unsigned short&);\n  extern template istream& istream::_M_extract(unsigned int&);  \n  extern template istream& istream::_M_extract(long&);\n  extern template istream& istream::_M_extract(unsigned long&);\n  extern template istream& istream::_M_extract(bool&);\n#ifdef _GLIBCXX_USE_LONG_LONG\n  extern template istream& istream::_M_extract(long long&);\n  extern template istream& istream::_M_extract(unsigned long long&);\n#endif\n  extern template istream& istream::_M_extract(float&);\n  extern template istream& istream::_M_extract(double&);\n  extern template istream& istream::_M_extract(long double&);\n  extern template istream& istream::_M_extract(void*&);\n\n  extern template class basic_iostream<char>;\n\n#ifdef _GLIBCXX_USE_WCHAR_T\n  extern template class basic_istream<wchar_t>;\n  extern template wistream& ws(wistream&);\n  extern template wistream& operator>>(wistream&, wchar_t&);\n  extern template wistream& operator>>(wistream&, wchar_t*);\n\n  extern template wistream& wistream::_M_extract(unsigned short&);\n  extern template wistream& wistream::_M_extract(unsigned int&);  \n  extern template wistream& wistream::_M_extract(long&);\n  extern template wistream& wistream::_M_extract(unsigned long&);\n  extern template wistream& wistream::_M_extract(bool&);\n#ifdef _GLIBCXX_USE_LONG_LONG\n  extern template wistream& wistream::_M_extract(long long&);\n  extern template wistream& wistream::_M_extract(unsigned long long&);\n#endif\n  extern template wistream& wistream::_M_extract(float&);\n  extern template wistream& wistream::_M_extract(double&);\n  extern template wistream& wistream::_M_extract(long double&);\n  extern template wistream& wistream::_M_extract(void*&);\n\n  extern template class basic_iostream<wchar_t>;\n#endif\n#endif\n\n_GLIBCXX_END_NAMESPACE\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/bits/list.tcc",
    "content": "// List implementation (out of line) -*- C++ -*-\n\n// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006\n// Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n/*\n *\n * Copyright (c) 1994\n * Hewlett-Packard Company\n *\n * Permission to use, copy, modify, distribute and sell this software\n * and its documentation for any purpose is hereby granted without fee,\n * provided that the above copyright notice appear in all copies and\n * that both that copyright notice and this permission notice appear\n * in supporting documentation.  Hewlett-Packard Company makes no\n * representations about the suitability of this software for any\n * purpose.  It is provided \"as is\" without express or implied warranty.\n *\n *\n * Copyright (c) 1996,1997\n * Silicon Graphics Computer Systems, Inc.\n *\n * Permission to use, copy, modify, distribute and sell this software\n * and its documentation for any purpose is hereby granted without fee,\n * provided that the above copyright notice appear in all copies and\n * that both that copyright notice and this permission notice appear\n * in supporting documentation.  Silicon Graphics makes no\n * representations about the suitability of this software for any\n * purpose.  It is provided \"as is\" without express or implied warranty.\n */\n\n/** @file list.tcc\n *  This is an internal header file, included by other library headers.\n *  You should not attempt to use it directly.\n */\n\n#ifndef _LIST_TCC\n#define _LIST_TCC 1\n\n_GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD)\n\n  template<typename _Tp, typename _Alloc>\n    void\n    _List_base<_Tp, _Alloc>::\n    _M_clear()\n    {\n      typedef _List_node<_Tp>  _Node;\n      _Node* __cur = static_cast<_Node*>(this->_M_impl._M_node._M_next);\n      while (__cur != &this->_M_impl._M_node)\n\t{\n\t  _Node* __tmp = __cur;\n\t  __cur = static_cast<_Node*>(__cur->_M_next);\n\t  _M_get_Tp_allocator().destroy(&__tmp->_M_data);\n\t  _M_put_node(__tmp);\n\t}\n    }\n\n  template<typename _Tp, typename _Alloc>\n    typename list<_Tp, _Alloc>::iterator\n    list<_Tp, _Alloc>::\n    insert(iterator __position, const value_type& __x)\n    {\n      _Node* __tmp = _M_create_node(__x);\n      __tmp->hook(__position._M_node);\n      return iterator(__tmp);\n    }\n\n  template<typename _Tp, typename _Alloc>\n    typename list<_Tp, _Alloc>::iterator\n    list<_Tp, _Alloc>::\n    erase(iterator __position)\n    {\n      iterator __ret = iterator(__position._M_node->_M_next);\n      _M_erase(__position);\n      return __ret;\n    }\n\n  template<typename _Tp, typename _Alloc>\n    void\n    list<_Tp, _Alloc>::\n    resize(size_type __new_size, value_type __x)\n    {\n      iterator __i = begin();\n      size_type __len = 0;\n      for (; __i != end() && __len < __new_size; ++__i, ++__len)\n        ;\n      if (__len == __new_size)\n        erase(__i, end());\n      else                          // __i == end()\n        insert(end(), __new_size - __len, __x);\n    }\n\n  template<typename _Tp, typename _Alloc>\n    list<_Tp, _Alloc>&\n    list<_Tp, _Alloc>::\n    operator=(const list& __x)\n    {\n      if (this != &__x)\n\t{\n\t  iterator __first1 = begin();\n\t  iterator __last1 = end();\n\t  const_iterator __first2 = __x.begin();\n\t  const_iterator __last2 = __x.end();\n\t  for (; __first1 != __last1 && __first2 != __last2;\n\t       ++__first1, ++__first2)\n\t    *__first1 = *__first2;\n\t  if (__first2 == __last2)\n\t    erase(__first1, __last1);\n\t  else\n\t    insert(__last1, __first2, __last2);\n\t}\n      return *this;\n    }\n\n  template<typename _Tp, typename _Alloc>\n    void\n    list<_Tp, _Alloc>::\n    _M_fill_assign(size_type __n, const value_type& __val)\n    {\n      iterator __i = begin();\n      for (; __i != end() && __n > 0; ++__i, --__n)\n        *__i = __val;\n      if (__n > 0)\n        insert(end(), __n, __val);\n      else\n        erase(__i, end());\n    }\n\n  template<typename _Tp, typename _Alloc>\n    template <typename _InputIterator>\n      void\n      list<_Tp, _Alloc>::\n      _M_assign_dispatch(_InputIterator __first2, _InputIterator __last2,\n\t\t\t __false_type)\n      {\n        iterator __first1 = begin();\n        iterator __last1 = end();\n        for (; __first1 != __last1 && __first2 != __last2;\n\t     ++__first1, ++__first2)\n          *__first1 = *__first2;\n        if (__first2 == __last2)\n          erase(__first1, __last1);\n        else\n          insert(__last1, __first2, __last2);\n      }\n\n  template<typename _Tp, typename _Alloc>\n    void\n    list<_Tp, _Alloc>::\n    remove(const value_type& __value)\n    {\n      iterator __first = begin();\n      iterator __last = end();\n      while (__first != __last)\n\t{\n\t  iterator __next = __first;\n\t  ++__next;\n\t  if (*__first == __value)\n\t    _M_erase(__first);\n\t  __first = __next;\n\t}\n    }\n\n  template<typename _Tp, typename _Alloc>\n    void\n    list<_Tp, _Alloc>::\n    unique()\n    {\n      iterator __first = begin();\n      iterator __last = end();\n      if (__first == __last)\n\treturn;\n      iterator __next = __first;\n      while (++__next != __last)\n\t{\n\t  if (*__first == *__next)\n\t    _M_erase(__next);\n\t  else\n\t    __first = __next;\n\t  __next = __first;\n\t}\n    }\n\n  template<typename _Tp, typename _Alloc>\n    void\n    list<_Tp, _Alloc>::\n    merge(list& __x)\n    {\n      // _GLIBCXX_RESOLVE_LIB_DEFECTS\n      // 300. list::merge() specification incomplete\n      if (this != &__x)\n\t{\n\t  _M_check_equal_allocators(__x); \n\n\t  iterator __first1 = begin();\n\t  iterator __last1 = end();\n\t  iterator __first2 = __x.begin();\n\t  iterator __last2 = __x.end();\n\t  while (__first1 != __last1 && __first2 != __last2)\n\t    if (*__first2 < *__first1)\n\t      {\n\t\titerator __next = __first2;\n\t\t_M_transfer(__first1, __first2, ++__next);\n\t\t__first2 = __next;\n\t      }\n\t    else\n\t      ++__first1;\n\t  if (__first2 != __last2)\n\t    _M_transfer(__last1, __first2, __last2);\n\t}\n    }\n\n  template<typename _Tp, typename _Alloc>\n    template <typename _StrictWeakOrdering>\n      void\n      list<_Tp, _Alloc>::\n      merge(list& __x, _StrictWeakOrdering __comp)\n      {\n\t// _GLIBCXX_RESOLVE_LIB_DEFECTS\n\t// 300. list::merge() specification incomplete\n\tif (this != &__x)\n\t  {\n\t    _M_check_equal_allocators(__x);\n\n\t    iterator __first1 = begin();\n\t    iterator __last1 = end();\n\t    iterator __first2 = __x.begin();\n\t    iterator __last2 = __x.end();\n\t    while (__first1 != __last1 && __first2 != __last2)\n\t      if (__comp(*__first2, *__first1))\n\t\t{\n\t\t  iterator __next = __first2;\n\t\t  _M_transfer(__first1, __first2, ++__next);\n\t\t  __first2 = __next;\n\t\t}\n\t      else\n\t\t++__first1;\n\t    if (__first2 != __last2)\n\t      _M_transfer(__last1, __first2, __last2);\n\t  }\n      }\n\n  template<typename _Tp, typename _Alloc>\n    void\n    list<_Tp, _Alloc>::\n    sort()\n    {\n      // Do nothing if the list has length 0 or 1.\n      if (this->_M_impl._M_node._M_next != &this->_M_impl._M_node\n\t  && this->_M_impl._M_node._M_next->_M_next != &this->_M_impl._M_node)\n      {\n        list __carry;\n        list __tmp[64];\n        list * __fill = &__tmp[0];\n        list * __counter;\n\n        do\n\t  {\n\t    __carry.splice(__carry.begin(), *this, begin());\n\n\t    for(__counter = &__tmp[0];\n\t\t__counter != __fill && !__counter->empty();\n\t\t++__counter)\n\t      {\n\t\t__counter->merge(__carry);\n\t\t__carry.swap(*__counter);\n\t      }\n\t    __carry.swap(*__counter);\n\t    if (__counter == __fill)\n\t      ++__fill;\n\t  }\n\twhile ( !empty() );\n\n        for (__counter = &__tmp[1]; __counter != __fill; ++__counter)\n          __counter->merge(*(__counter - 1));\n        swap( *(__fill - 1) );\n      }\n    }\n\n  template<typename _Tp, typename _Alloc>\n    template <typename _Predicate>\n      void\n      list<_Tp, _Alloc>::\n      remove_if(_Predicate __pred)\n      {\n        iterator __first = begin();\n        iterator __last = end();\n        while (__first != __last)\n\t  {\n\t    iterator __next = __first;\n\t    ++__next;\n\t    if (__pred(*__first))\n\t      _M_erase(__first);\n\t    __first = __next;\n\t  }\n      }\n\n  template<typename _Tp, typename _Alloc>\n    template <typename _BinaryPredicate>\n      void\n      list<_Tp, _Alloc>::\n      unique(_BinaryPredicate __binary_pred)\n      {\n        iterator __first = begin();\n        iterator __last = end();\n        if (__first == __last)\n\t  return;\n        iterator __next = __first;\n        while (++__next != __last)\n\t  {\n\t    if (__binary_pred(*__first, *__next))\n\t      _M_erase(__next);\n\t    else\n\t      __first = __next;\n\t    __next = __first;\n\t  }\n      }\n\n  template<typename _Tp, typename _Alloc>\n    template <typename _StrictWeakOrdering>\n      void\n      list<_Tp, _Alloc>::\n      sort(_StrictWeakOrdering __comp)\n      {\n\t// Do nothing if the list has length 0 or 1.\n\tif (this->_M_impl._M_node._M_next != &this->_M_impl._M_node\n\t    && this->_M_impl._M_node._M_next->_M_next != &this->_M_impl._M_node)\n\t  {\n\t    list __carry;\n\t    list __tmp[64];\n\t    list * __fill = &__tmp[0];\n\t    list * __counter;\n\n\t    do\n\t      {\n\t\t__carry.splice(__carry.begin(), *this, begin());\n\n\t\tfor(__counter = &__tmp[0];\n\t\t    __counter != __fill && !__counter->empty();\n\t\t    ++__counter)\n\t\t  {\n\t\t    __counter->merge(__carry, __comp);\n\t\t    __carry.swap(*__counter);\n\t\t  }\n\t\t__carry.swap(*__counter);\n\t\tif (__counter == __fill)\n\t\t  ++__fill;\n\t      }\n\t    while ( !empty() );\n\n\t    for (__counter = &__tmp[1]; __counter != __fill; ++__counter)\n\t      __counter->merge(*(__counter - 1), __comp);\n\t    swap(*(__fill - 1));\n\t  }\n      }\n\n_GLIBCXX_END_NESTED_NAMESPACE\n\n#endif /* _LIST_TCC */\n\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/bits/locale_classes.h",
    "content": "// Locale support -*- C++ -*-\n\n// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006\n// Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n/** @file locale_classes.h\n *  This is an internal header file, included by other library headers.\n *  You should not attempt to use it directly.\n */\n\n//\n// ISO C++ 14882: 22.1  Locales\n//\n\n#ifndef _LOCALE_CLASSES_H\n#define _LOCALE_CLASSES_H 1\n\n#pragma GCC system_header\n\n#include <bits/localefwd.h>\n#include <cstring>\t\t// For strcmp.\n#include <string>\n#include <ext/atomicity.h>\n\n_GLIBCXX_BEGIN_NAMESPACE(std)\n\n  // 22.1.1 Class locale\n  /**\n   *  @brief  Container class for localization functionality.\n   *\n   *  The locale class is first a class wrapper for C library locales.  It is\n   *  also an extensible container for user-defined localization.  A locale is\n   *  a collection of facets that implement various localization features such\n   *  as money, time, and number printing.\n   *\n   *  Constructing C++ locales does not change the C library locale.\n   *\n   *  This library supports efficient construction and copying of locales\n   *  through a reference counting implementation of the locale class.\n  */\n  class locale\n  {\n  public:\n    // Types:\n    /// Definition of locale::category.\n    typedef int\tcategory;\n\n    // Forward decls and friends:\n    class facet;\n    class id;\n    class _Impl;\n\n    friend class facet;\n    friend class _Impl;\n\n    template<typename _Facet>\n      friend bool\n      has_facet(const locale&) throw();\n\n    template<typename _Facet>\n      friend const _Facet&\n      use_facet(const locale&);\n\n    template<typename _Cache>\n      friend struct __use_cache;\n\n    //@{\n    /**\n     *  @brief  Category values.\n     *\n     *  The standard category values are none, ctype, numeric, collate, time,\n     *  monetary, and messages.  They form a bitmask that supports union and\n     *  intersection.  The category all is the union of these values.\n     *\n     *  @if maint\n     *  NB: Order must match _S_facet_categories definition in locale.cc\n     *  @endif\n    */\n    static const category none\t\t= 0;\n    static const category ctype\t\t= 1L << 0;\n    static const category numeric\t= 1L << 1;\n    static const category collate\t= 1L << 2;\n    static const category time\t\t= 1L << 3;\n    static const category monetary\t= 1L << 4;\n    static const category messages\t= 1L << 5;\n    static const category all\t\t= (ctype | numeric | collate |\n\t\t\t\t\t   time  | monetary | messages);\n    //@}\n\n    // Construct/copy/destroy:\n\n    /**\n     *  @brief  Default constructor.\n     *\n     *  Constructs a copy of the global locale.  If no locale has been\n     *  explicitly set, this is the \"C\" locale.\n    */\n    locale() throw();\n\n    /**\n     *  @brief  Copy constructor.\n     *\n     *  Constructs a copy of @a other.\n     *\n     *  @param  other  The locale to copy.\n    */\n    locale(const locale& __other) throw();\n\n    /**\n     *  @brief  Named locale constructor.\n     *\n     *  Constructs a copy of the named C library locale.\n     *\n     *  @param  s  Name of the locale to construct.\n     *  @throw  std::runtime_error if s is null or an undefined locale.\n    */\n    explicit\n    locale(const char* __s);\n\n    /**\n     *  @brief  Construct locale with facets from another locale.\n     *\n     *  Constructs a copy of the locale @a base.  The facets specified by @a\n     *  cat are replaced with those from the locale named by @a s.  If base is\n     *  named, this locale instance will also be named.\n     *\n     *  @param  base  The locale to copy.\n     *  @param  s  Name of the locale to use facets from.\n     *  @param  cat  Set of categories defining the facets to use from s.\n     *  @throw  std::runtime_error if s is null or an undefined locale.\n    */\n    locale(const locale& __base, const char* __s, category __cat);\n\n    /**\n     *  @brief  Construct locale with facets from another locale.\n     *\n     *  Constructs a copy of the locale @a base.  The facets specified by @a\n     *  cat are replaced with those from the locale @a add.  If @a base and @a\n     *  add are named, this locale instance will also be named.\n     *\n     *  @param  base  The locale to copy.\n     *  @param  add  The locale to use facets from.\n     *  @param  cat  Set of categories defining the facets to use from add.\n    */\n    locale(const locale& __base, const locale& __add, category __cat);\n\n    /**\n     *  @brief  Construct locale with another facet.\n     *\n     *  Constructs a copy of the locale @a other.  The facet @f is added to\n     *  @other, replacing an existing facet of type Facet if there is one.  If\n     *  @f is null, this locale is a copy of @a other.\n     *\n     *  @param  other  The locale to copy.\n     *  @param  f  The facet to add in.\n    */\n    template<typename _Facet>\n      locale(const locale& __other, _Facet* __f);\n\n    /// Locale destructor.\n    ~locale() throw();\n\n    /**\n     *  @brief  Assignment operator.\n     *\n     *  Set this locale to be a copy of @a other.\n     *\n     *  @param  other  The locale to copy.\n     *  @return  A reference to this locale.\n    */\n    const locale&\n    operator=(const locale& __other) throw();\n\n    /**\n     *  @brief  Construct locale with another facet.\n     *\n     *  Constructs and returns a new copy of this locale.  Adds or replaces an\n     *  existing facet of type Facet from the locale @a other into the new\n     *  locale.\n     *\n     *  @param  Facet  The facet type to copy from other\n     *  @param  other  The locale to copy from.\n     *  @return  Newly constructed locale.\n     *  @throw  std::runtime_error if other has no facet of type Facet.\n    */\n    template<typename _Facet>\n      locale\n      combine(const locale& __other) const;\n\n    // Locale operations:\n    /**\n     *  @brief  Return locale name.\n     *  @return  Locale name or \"*\" if unnamed.\n    */\n    string\n    name() const;\n\n    /**\n     *  @brief  Locale equality.\n     *\n     *  @param  other  The locale to compare against.\n     *  @return  True if other and this refer to the same locale instance, are\n     *\t\t copies, or have the same name.  False otherwise.\n    */\n    bool\n    operator==(const locale& __other) const throw ();\n\n    /**\n     *  @brief  Locale inequality.\n     *\n     *  @param  other  The locale to compare against.\n     *  @return  ! (*this == other)\n    */\n    inline bool\n    operator!=(const locale& __other) const throw ()\n    { return !(this->operator==(__other));  }\n\n    /**\n     *  @brief  Compare two strings according to collate.\n     *\n     *  Template operator to compare two strings using the compare function of\n     *  the collate facet in this locale.  One use is to provide the locale to\n     *  the sort function.  For example, a vector v of strings could be sorted\n     *  according to locale loc by doing:\n     *  @code\n     *  std::sort(v.begin(), v.end(), loc);\n     *  @endcode\n     *\n     *  @param  s1  First string to compare.\n     *  @param  s2  Second string to compare.\n     *  @return  True if collate<Char> facet compares s1 < s2, else false.\n    */\n    template<typename _Char, typename _Traits, typename _Alloc>\n      bool\n      operator()(const basic_string<_Char, _Traits, _Alloc>& __s1,\n\t\t const basic_string<_Char, _Traits, _Alloc>& __s2) const;\n\n    // Global locale objects:\n    /**\n     *  @brief  Set global locale\n     *\n     *  This function sets the global locale to the argument and returns a\n     *  copy of the previous global locale.  If the argument has a name, it\n     *  will also call std::setlocale(LC_ALL, loc.name()).\n     *\n     *  @param  locale  The new locale to make global.\n     *  @return  Copy of the old global locale.\n    */\n    static locale\n    global(const locale&);\n\n    /**\n     *  @brief  Return reference to the \"C\" locale.\n    */\n    static const locale&\n    classic();\n\n  private:\n    // The (shared) implementation\n    _Impl*\t\t_M_impl;\n\n    // The \"C\" reference locale\n    static _Impl*       _S_classic;\n\n    // Current global locale\n    static _Impl*\t_S_global;\n\n    // Names of underlying locale categories.\n    // NB: locale::global() has to know how to modify all the\n    // underlying categories, not just the ones required by the C++\n    // standard.\n    static const char* const* const _S_categories;\n\n    // Number of standard categories. For C++, these categories are\n    // collate, ctype, monetary, numeric, time, and messages. These\n    // directly correspond to ISO C99 macros LC_COLLATE, LC_CTYPE,\n    // LC_MONETARY, LC_NUMERIC, and LC_TIME. In addition, POSIX (IEEE\n    // 1003.1-2001) specifies LC_MESSAGES.\n    // In addition to the standard categories, the underlying\n    // operating system is allowed to define extra LC_*\n    // macros. For GNU systems, the following are also valid:\n    // LC_PAPER, LC_NAME, LC_ADDRESS, LC_TELEPHONE, LC_MEASUREMENT,\n    // and LC_IDENTIFICATION.\n    enum { _S_categories_size = 6 + _GLIBCXX_NUM_CATEGORIES };\n\n#ifdef __GTHREADS\n    static __gthread_once_t _S_once;\n#endif\n\n    explicit\n    locale(_Impl*) throw();\n\n    static void\n    _S_initialize();\n\n    static void\n    _S_initialize_once();\n\n    static category\n    _S_normalize_category(category);\n\n    void\n    _M_coalesce(const locale& __base, const locale& __add, category __cat);\n  };\n\n\n  // 22.1.1.1.2  Class locale::facet\n  /**\n   *  @brief  Localization functionality base class.\n   *\n   *  The facet class is the base class for a localization feature, such as\n   *  money, time, and number printing.  It provides common support for facets\n   *  and reference management.\n   *\n   *  Facets may not be copied or assigned.\n  */\n  class locale::facet\n  {\n  private:\n    friend class locale;\n    friend class locale::_Impl;\n\n    mutable _Atomic_word\t\t_M_refcount;\n\n    // Contains data from the underlying \"C\" library for the classic locale.\n    static __c_locale                   _S_c_locale;\n\n    // String literal for the name of the classic locale.\n    static const char\t\t\t_S_c_name[2];\n\n#ifdef __GTHREADS\n    static __gthread_once_t\t\t_S_once;\n#endif\n\n    static void\n    _S_initialize_once();\n\n  protected:\n    /**\n     *  @brief  Facet constructor.\n     *\n     *  This is the constructor provided by the standard.  If refs is 0, the\n     *  facet is destroyed when the last referencing locale is destroyed.\n     *  Otherwise the facet will never be destroyed.\n     *\n     *  @param refs  The initial value for reference count.\n    */\n    explicit\n    facet(size_t __refs = 0) throw() : _M_refcount(__refs ? 1 : 0)\n    { }\n\n    /// Facet destructor.\n    virtual\n    ~facet();\n\n    static void\n    _S_create_c_locale(__c_locale& __cloc, const char* __s,\n\t\t       __c_locale __old = 0);\n\n    static __c_locale\n    _S_clone_c_locale(__c_locale& __cloc);\n\n    static void\n    _S_destroy_c_locale(__c_locale& __cloc);\n\n    // Returns data from the underlying \"C\" library data for the\n    // classic locale.\n    static __c_locale\n    _S_get_c_locale();\n\n    static const char*\n    _S_get_c_name();\n\n  private:\n    inline void\n    _M_add_reference() const throw()\n    { __gnu_cxx::__atomic_add_dispatch(&_M_refcount, 1); }\n\n    inline void\n    _M_remove_reference() const throw()\n    {\n      if (__gnu_cxx::__exchange_and_add_dispatch(&_M_refcount, -1) == 1)\n\t{\n\t  try\n\t    { delete this; }\n\t  catch (...)\n\t    { }\n\t}\n    }\n\n    facet(const facet&);  // Not defined.\n\n    facet&\n    operator=(const facet&);  // Not defined.\n  };\n\n\n  // 22.1.1.1.3 Class locale::id\n  /**\n   *  @brief  Facet ID class.\n   *\n   *  The ID class provides facets with an index used to identify them.\n   *  Every facet class must define a public static member locale::id, or be\n   *  derived from a facet that provides this member, otherwise the facet\n   *  cannot be used in a locale.  The locale::id ensures that each class\n   *  type gets a unique identifier.\n  */\n  class locale::id\n  {\n  private:\n    friend class locale;\n    friend class locale::_Impl;\n\n    template<typename _Facet>\n      friend const _Facet&\n      use_facet(const locale&);\n\n    template<typename _Facet>\n      friend bool\n      has_facet(const locale&) throw ();\n\n    // NB: There is no accessor for _M_index because it may be used\n    // before the constructor is run; the effect of calling a member\n    // function (even an inline) would be undefined.\n    mutable size_t\t\t_M_index;\n\n    // Last id number assigned.\n    static _Atomic_word\t\t_S_refcount;\n\n    void\n    operator=(const id&);  // Not defined.\n\n    id(const id&);  // Not defined.\n\n  public:\n    // NB: This class is always a static data member, and thus can be\n    // counted on to be zero-initialized.\n    /// Constructor.\n    id() { }\n\n    size_t\n    _M_id() const;\n  };\n\n\n  // Implementation object for locale.\n  class locale::_Impl\n  {\n  public:\n    // Friends.\n    friend class locale;\n    friend class locale::facet;\n\n    template<typename _Facet>\n      friend bool\n      has_facet(const locale&) throw();\n\n    template<typename _Facet>\n      friend const _Facet&\n      use_facet(const locale&);\n\n    template<typename _Cache>\n      friend struct __use_cache;\n\n  private:\n    // Data Members.\n    _Atomic_word\t\t\t_M_refcount;\n    const facet**\t\t\t_M_facets;\n    size_t\t\t\t\t_M_facets_size;\n    const facet**\t\t\t_M_caches;\n    char**\t\t\t\t_M_names;\n    static const locale::id* const\t_S_id_ctype[];\n    static const locale::id* const\t_S_id_numeric[];\n    static const locale::id* const\t_S_id_collate[];\n    static const locale::id* const\t_S_id_time[];\n    static const locale::id* const\t_S_id_monetary[];\n    static const locale::id* const\t_S_id_messages[];\n    static const locale::id* const* const _S_facet_categories[];\n\n    inline void\n    _M_add_reference() throw()\n    { __gnu_cxx::__atomic_add_dispatch(&_M_refcount, 1); }\n\n    inline void\n    _M_remove_reference() throw()\n    {\n      if (__gnu_cxx::__exchange_and_add_dispatch(&_M_refcount, -1) == 1)\n\t{\n\t  try\n\t    { delete this; }\n\t  catch(...)\n\t    { }\n\t}\n    }\n\n    _Impl(const _Impl&, size_t);\n    _Impl(const char*, size_t);\n    _Impl(size_t) throw();\n\n   ~_Impl() throw();\n\n    _Impl(const _Impl&);  // Not defined.\n\n    void\n    operator=(const _Impl&);  // Not defined.\n\n    inline bool\n    _M_check_same_name()\n    {\n      bool __ret = true;\n      if (_M_names[1])\n\t// We must actually compare all the _M_names: can be all equal!\n\tfor (size_t __i = 0; __ret && __i < _S_categories_size - 1; ++__i)\n\t  __ret = std::strcmp(_M_names[__i], _M_names[__i + 1]) == 0;\n      return __ret;\n    }\n\n    void\n    _M_replace_categories(const _Impl*, category);\n\n    void\n    _M_replace_category(const _Impl*, const locale::id* const*);\n\n    void\n    _M_replace_facet(const _Impl*, const locale::id*);\n\n    void\n    _M_install_facet(const locale::id*, const facet*);\n\n    template<typename _Facet>\n      inline void\n      _M_init_facet(_Facet* __facet)\n      { _M_install_facet(&_Facet::id, __facet); }\n\n    void\n    _M_install_cache(const facet*, size_t);\n  };\n\n  template<typename _Facet>\n    locale::locale(const locale& __other, _Facet* __f)\n    {\n      _M_impl = new _Impl(*__other._M_impl, 1);\n\n      try\n\t{ _M_impl->_M_install_facet(&_Facet::id, __f); }\n      catch(...)\n\t{\n\t  _M_impl->_M_remove_reference();\n\t  __throw_exception_again;\n\t}\n      delete [] _M_impl->_M_names[0];\n      _M_impl->_M_names[0] = 0;   // Unnamed.\n    }\n\n_GLIBCXX_END_NAMESPACE\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/bits/locale_facets.h",
    "content": "// Locale support -*- C++ -*-\n\n// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006\n// Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n/** @file locale_facets.h\n *  This is an internal header file, included by other library headers.\n *  You should not attempt to use it directly.\n */\n\n//\n// ISO C++ 14882: 22.1  Locales\n//\n\n#ifndef _LOCALE_FACETS_H\n#define _LOCALE_FACETS_H 1\n\n#pragma GCC system_header\n\n#include <ctime>\t// For struct tm\n#include <cwctype>\t// For wctype_t\n#include <bits/ctype_base.h>\t\n#include <iosfwd>\n#include <bits/ios_base.h>  // For ios_base, ios_base::iostate\n#include <streambuf>\n#include <bits/cpp_type_traits.h>\n\n_GLIBCXX_BEGIN_NAMESPACE(std)\n\n  // NB: Don't instantiate required wchar_t facets if no wchar_t support.\n#ifdef _GLIBCXX_USE_WCHAR_T\n# define  _GLIBCXX_NUM_FACETS 28\n#else\n# define  _GLIBCXX_NUM_FACETS 14\n#endif\n\n  // Convert string to numeric value of type _Tv and store results.\n  // NB: This is specialized for all required types, there is no\n  // generic definition.\n  template<typename _Tv>\n    void\n    __convert_to_v(const char* __in, _Tv& __out, ios_base::iostate& __err,\n\t\t   const __c_locale& __cloc);\n\n  // Explicit specializations for required types.\n  template<>\n    void\n    __convert_to_v(const char*, float&, ios_base::iostate&,\n\t\t   const __c_locale&);\n\n  template<>\n    void\n    __convert_to_v(const char*, double&, ios_base::iostate&,\n\t\t   const __c_locale&);\n\n  template<>\n    void\n    __convert_to_v(const char*, long double&, ios_base::iostate&,\n\t\t   const __c_locale&);\n\n  // NB: __pad is a struct, rather than a function, so it can be\n  // partially-specialized.\n  template<typename _CharT, typename _Traits>\n    struct __pad\n    {\n      static void\n      _S_pad(ios_base& __io, _CharT __fill, _CharT* __news,\n\t     const _CharT* __olds, const streamsize __newlen,\n\t     const streamsize __oldlen, const bool __num);\n    };\n\n  // Used by both numeric and monetary facets.\n  // Inserts \"group separator\" characters into an array of characters.\n  // It's recursive, one iteration per group.  It moves the characters\n  // in the buffer this way: \"xxxx12345\" -> \"12,345xxx\".  Call this\n  // only with __glen != 0.\n  template<typename _CharT>\n    _CharT*\n    __add_grouping(_CharT* __s, _CharT __sep,\n\t\t   const char* __gbeg, size_t __gsize,\n\t\t   const _CharT* __first, const _CharT* __last);\n\n  // This template permits specializing facet output code for\n  // ostreambuf_iterator.  For ostreambuf_iterator, sputn is\n  // significantly more efficient than incrementing iterators.\n  template<typename _CharT>\n    inline\n    ostreambuf_iterator<_CharT>\n    __write(ostreambuf_iterator<_CharT> __s, const _CharT* __ws, int __len)\n    {\n      __s._M_put(__ws, __len);\n      return __s;\n    }\n\n  // This is the unspecialized form of the template.\n  template<typename _CharT, typename _OutIter>\n    inline\n    _OutIter\n    __write(_OutIter __s, const _CharT* __ws, int __len)\n    {\n      for (int __j = 0; __j < __len; __j++, ++__s)\n\t*__s = __ws[__j];\n      return __s;\n    }\n\n\n  // 22.2.1.1  Template class ctype\n  // Include host and configuration specific ctype enums for ctype_base.\n\n  // Common base for ctype<_CharT>.\n  /**\n   *  @brief  Common base for ctype facet\n   *\n   *  This template class provides implementations of the public functions\n   *  that forward to the protected virtual functions.\n   *\n   *  This template also provides abtract stubs for the protected virtual\n   *  functions.\n  */\n  template<typename _CharT>\n    class __ctype_abstract_base : public locale::facet, public ctype_base\n    {\n    public:\n      // Types:\n      /// Typedef for the template parameter\n      typedef _CharT char_type;\n\n      /**\n       *  @brief  Test char_type classification.\n       *\n       *  This function finds a mask M for @a c and compares it to mask @a m.\n       *  It does so by returning the value of ctype<char_type>::do_is().\n       *\n       *  @param c  The char_type to compare the mask of.\n       *  @param m  The mask to compare against.\n       *  @return  (M & m) != 0.\n      */\n      bool\n      is(mask __m, char_type __c) const\n      { return this->do_is(__m, __c); }\n\n      /**\n       *  @brief  Return a mask array.\n       *\n       *  This function finds the mask for each char_type in the range [lo,hi)\n       *  and successively writes it to vec.  vec must have as many elements\n       *  as the char array.  It does so by returning the value of\n       *  ctype<char_type>::do_is().\n       *\n       *  @param lo  Pointer to start of range.\n       *  @param hi  Pointer to end of range.\n       *  @param vec  Pointer to an array of mask storage.\n       *  @return  @a hi.\n      */\n      const char_type*\n      is(const char_type *__lo, const char_type *__hi, mask *__vec) const\n      { return this->do_is(__lo, __hi, __vec); }\n\n      /**\n       *  @brief  Find char_type matching a mask\n       *\n       *  This function searches for and returns the first char_type c in\n       *  [lo,hi) for which is(m,c) is true.  It does so by returning\n       *  ctype<char_type>::do_scan_is().\n       *\n       *  @param m  The mask to compare against.\n       *  @param lo  Pointer to start of range.\n       *  @param hi  Pointer to end of range.\n       *  @return  Pointer to matching char_type if found, else @a hi.\n      */\n      const char_type*\n      scan_is(mask __m, const char_type* __lo, const char_type* __hi) const\n      { return this->do_scan_is(__m, __lo, __hi); }\n\n      /**\n       *  @brief  Find char_type not matching a mask\n       *\n       *  This function searches for and returns the first char_type c in\n       *  [lo,hi) for which is(m,c) is false.  It does so by returning\n       *  ctype<char_type>::do_scan_not().\n       *\n       *  @param m  The mask to compare against.\n       *  @param lo  Pointer to first char in range.\n       *  @param hi  Pointer to end of range.\n       *  @return  Pointer to non-matching char if found, else @a hi.\n      */\n      const char_type*\n      scan_not(mask __m, const char_type* __lo, const char_type* __hi) const\n      { return this->do_scan_not(__m, __lo, __hi); }\n\n      /**\n       *  @brief  Convert to uppercase.\n       *\n       *  This function converts the argument to uppercase if possible.\n       *  If not possible (for example, '2'), returns the argument.  It does\n       *  so by returning ctype<char_type>::do_toupper().\n       *\n       *  @param c  The char_type to convert.\n       *  @return  The uppercase char_type if convertible, else @a c.\n      */\n      char_type\n      toupper(char_type __c) const\n      { return this->do_toupper(__c); }\n\n      /**\n       *  @brief  Convert array to uppercase.\n       *\n       *  This function converts each char_type in the range [lo,hi) to\n       *  uppercase if possible.  Other elements remain untouched.  It does so\n       *  by returning ctype<char_type>:: do_toupper(lo, hi).\n       *\n       *  @param lo  Pointer to start of range.\n       *  @param hi  Pointer to end of range.\n       *  @return  @a hi.\n      */\n      const char_type*\n      toupper(char_type *__lo, const char_type* __hi) const\n      { return this->do_toupper(__lo, __hi); }\n\n      /**\n       *  @brief  Convert to lowercase.\n       *\n       *  This function converts the argument to lowercase if possible.  If\n       *  not possible (for example, '2'), returns the argument.  It does so\n       *  by returning ctype<char_type>::do_tolower(c).\n       *\n       *  @param c  The char_type to convert.\n       *  @return  The lowercase char_type if convertible, else @a c.\n      */\n      char_type\n      tolower(char_type __c) const\n      { return this->do_tolower(__c); }\n\n      /**\n       *  @brief  Convert array to lowercase.\n       *\n       *  This function converts each char_type in the range [lo,hi) to\n       *  lowercase if possible.  Other elements remain untouched.  It does so\n       *  by returning ctype<char_type>:: do_tolower(lo, hi).\n       *\n       *  @param lo  Pointer to start of range.\n       *  @param hi  Pointer to end of range.\n       *  @return  @a hi.\n      */\n      const char_type*\n      tolower(char_type* __lo, const char_type* __hi) const\n      { return this->do_tolower(__lo, __hi); }\n\n      /**\n       *  @brief  Widen char to char_type\n       *\n       *  This function converts the char argument to char_type using the\n       *  simplest reasonable transformation.  It does so by returning\n       *  ctype<char_type>::do_widen(c).\n       *\n       *  Note: this is not what you want for codepage conversions.  See\n       *  codecvt for that.\n       *\n       *  @param c  The char to convert.\n       *  @return  The converted char_type.\n      */\n      char_type\n      widen(char __c) const\n      { return this->do_widen(__c); }\n\n      /**\n       *  @brief  Widen array to char_type\n       *\n       *  This function converts each char in the input to char_type using the\n       *  simplest reasonable transformation.  It does so by returning\n       *  ctype<char_type>::do_widen(c).\n       *\n       *  Note: this is not what you want for codepage conversions.  See\n       *  codecvt for that.\n       *\n       *  @param lo  Pointer to start of range.\n       *  @param hi  Pointer to end of range.\n       *  @param to  Pointer to the destination array.\n       *  @return  @a hi.\n      */\n      const char*\n      widen(const char* __lo, const char* __hi, char_type* __to) const\n      { return this->do_widen(__lo, __hi, __to); }\n\n      /**\n       *  @brief  Narrow char_type to char\n       *\n       *  This function converts the char_type to char using the simplest\n       *  reasonable transformation.  If the conversion fails, dfault is\n       *  returned instead.  It does so by returning\n       *  ctype<char_type>::do_narrow(c).\n       *\n       *  Note: this is not what you want for codepage conversions.  See\n       *  codecvt for that.\n       *\n       *  @param c  The char_type to convert.\n       *  @param dfault  Char to return if conversion fails.\n       *  @return  The converted char.\n      */\n      char\n      narrow(char_type __c, char __dfault) const\n      { return this->do_narrow(__c, __dfault); }\n\n      /**\n       *  @brief  Narrow array to char array\n       *\n       *  This function converts each char_type in the input to char using the\n       *  simplest reasonable transformation and writes the results to the\n       *  destination array.  For any char_type in the input that cannot be\n       *  converted, @a dfault is used instead.  It does so by returning\n       *  ctype<char_type>::do_narrow(lo, hi, dfault, to).\n       *\n       *  Note: this is not what you want for codepage conversions.  See\n       *  codecvt for that.\n       *\n       *  @param lo  Pointer to start of range.\n       *  @param hi  Pointer to end of range.\n       *  @param dfault  Char to use if conversion fails.\n       *  @param to  Pointer to the destination array.\n       *  @return  @a hi.\n      */\n      const char_type*\n      narrow(const char_type* __lo, const char_type* __hi,\n\t      char __dfault, char *__to) const\n      { return this->do_narrow(__lo, __hi, __dfault, __to); }\n\n    protected:\n      explicit\n      __ctype_abstract_base(size_t __refs = 0): facet(__refs) { }\n\n      virtual\n      ~__ctype_abstract_base() { }\n\n      /**\n       *  @brief  Test char_type classification.\n       *\n       *  This function finds a mask M for @a c and compares it to mask @a m.\n       *\n       *  do_is() is a hook for a derived facet to change the behavior of\n       *  classifying.  do_is() must always return the same result for the\n       *  same input.\n       *\n       *  @param c  The char_type to find the mask of.\n       *  @param m  The mask to compare against.\n       *  @return  (M & m) != 0.\n      */\n      virtual bool\n      do_is(mask __m, char_type __c) const = 0;\n\n      /**\n       *  @brief  Return a mask array.\n       *\n       *  This function finds the mask for each char_type in the range [lo,hi)\n       *  and successively writes it to vec.  vec must have as many elements\n       *  as the input.\n       *\n       *  do_is() is a hook for a derived facet to change the behavior of\n       *  classifying.  do_is() must always return the same result for the\n       *  same input.\n       *\n       *  @param lo  Pointer to start of range.\n       *  @param hi  Pointer to end of range.\n       *  @param vec  Pointer to an array of mask storage.\n       *  @return  @a hi.\n      */\n      virtual const char_type*\n      do_is(const char_type* __lo, const char_type* __hi,\n\t    mask* __vec) const = 0;\n\n      /**\n       *  @brief  Find char_type matching mask\n       *\n       *  This function searches for and returns the first char_type c in\n       *  [lo,hi) for which is(m,c) is true.\n       *\n       *  do_scan_is() is a hook for a derived facet to change the behavior of\n       *  match searching.  do_is() must always return the same result for the\n       *  same input.\n       *\n       *  @param m  The mask to compare against.\n       *  @param lo  Pointer to start of range.\n       *  @param hi  Pointer to end of range.\n       *  @return  Pointer to a matching char_type if found, else @a hi.\n      */\n      virtual const char_type*\n      do_scan_is(mask __m, const char_type* __lo,\n\t\t const char_type* __hi) const = 0;\n\n      /**\n       *  @brief  Find char_type not matching mask\n       *\n       *  This function searches for and returns a pointer to the first\n       *  char_type c of [lo,hi) for which is(m,c) is false.\n       *\n       *  do_scan_is() is a hook for a derived facet to change the behavior of\n       *  match searching.  do_is() must always return the same result for the\n       *  same input.\n       *\n       *  @param m  The mask to compare against.\n       *  @param lo  Pointer to start of range.\n       *  @param hi  Pointer to end of range.\n       *  @return  Pointer to a non-matching char_type if found, else @a hi.\n      */\n      virtual const char_type*\n      do_scan_not(mask __m, const char_type* __lo,\n\t\t  const char_type* __hi) const = 0;\n\n      /**\n       *  @brief  Convert to uppercase.\n       *\n       *  This virtual function converts the char_type argument to uppercase\n       *  if possible.  If not possible (for example, '2'), returns the\n       *  argument.\n       *\n       *  do_toupper() is a hook for a derived facet to change the behavior of\n       *  uppercasing.  do_toupper() must always return the same result for\n       *  the same input.\n       *\n       *  @param c  The char_type to convert.\n       *  @return  The uppercase char_type if convertible, else @a c.\n      */\n      virtual char_type\n      do_toupper(char_type) const = 0;\n\n      /**\n       *  @brief  Convert array to uppercase.\n       *\n       *  This virtual function converts each char_type in the range [lo,hi)\n       *  to uppercase if possible.  Other elements remain untouched.\n       *\n       *  do_toupper() is a hook for a derived facet to change the behavior of\n       *  uppercasing.  do_toupper() must always return the same result for\n       *  the same input.\n       *\n       *  @param lo  Pointer to start of range.\n       *  @param hi  Pointer to end of range.\n       *  @return  @a hi.\n      */\n      virtual const char_type*\n      do_toupper(char_type* __lo, const char_type* __hi) const = 0;\n\n      /**\n       *  @brief  Convert to lowercase.\n       *\n       *  This virtual function converts the argument to lowercase if\n       *  possible.  If not possible (for example, '2'), returns the argument.\n       *\n       *  do_tolower() is a hook for a derived facet to change the behavior of\n       *  lowercasing.  do_tolower() must always return the same result for\n       *  the same input.\n       *\n       *  @param c  The char_type to convert.\n       *  @return  The lowercase char_type if convertible, else @a c.\n      */\n      virtual char_type\n      do_tolower(char_type) const = 0;\n\n      /**\n       *  @brief  Convert array to lowercase.\n       *\n       *  This virtual function converts each char_type in the range [lo,hi)\n       *  to lowercase if possible.  Other elements remain untouched.\n       *\n       *  do_tolower() is a hook for a derived facet to change the behavior of\n       *  lowercasing.  do_tolower() must always return the same result for\n       *  the same input.\n       *\n       *  @param lo  Pointer to start of range.\n       *  @param hi  Pointer to end of range.\n       *  @return  @a hi.\n      */\n      virtual const char_type*\n      do_tolower(char_type* __lo, const char_type* __hi) const = 0;\n\n      /**\n       *  @brief  Widen char\n       *\n       *  This virtual function converts the char to char_type using the\n       *  simplest reasonable transformation.\n       *\n       *  do_widen() is a hook for a derived facet to change the behavior of\n       *  widening.  do_widen() must always return the same result for the\n       *  same input.\n       *\n       *  Note: this is not what you want for codepage conversions.  See\n       *  codecvt for that.\n       *\n       *  @param c  The char to convert.\n       *  @return  The converted char_type\n      */\n      virtual char_type\n      do_widen(char) const = 0;\n\n      /**\n       *  @brief  Widen char array\n       *\n       *  This function converts each char in the input to char_type using the\n       *  simplest reasonable transformation.\n       *\n       *  do_widen() is a hook for a derived facet to change the behavior of\n       *  widening.  do_widen() must always return the same result for the\n       *  same input.\n       *\n       *  Note: this is not what you want for codepage conversions.  See\n       *  codecvt for that.\n       *\n       *  @param lo  Pointer to start range.\n       *  @param hi  Pointer to end of range.\n       *  @param to  Pointer to the destination array.\n       *  @return  @a hi.\n      */\n      virtual const char*\n      do_widen(const char* __lo, const char* __hi,\n\t       char_type* __dest) const = 0;\n\n      /**\n       *  @brief  Narrow char_type to char\n       *\n       *  This virtual function converts the argument to char using the\n       *  simplest reasonable transformation.  If the conversion fails, dfault\n       *  is returned instead.\n       *\n       *  do_narrow() is a hook for a derived facet to change the behavior of\n       *  narrowing.  do_narrow() must always return the same result for the\n       *  same input.\n       *\n       *  Note: this is not what you want for codepage conversions.  See\n       *  codecvt for that.\n       *\n       *  @param c  The char_type to convert.\n       *  @param dfault  Char to return if conversion fails.\n       *  @return  The converted char.\n      */\n      virtual char\n      do_narrow(char_type, char __dfault) const = 0;\n\n      /**\n       *  @brief  Narrow char_type array to char\n       *\n       *  This virtual function converts each char_type in the range [lo,hi) to\n       *  char using the simplest reasonable transformation and writes the\n       *  results to the destination array.  For any element in the input that\n       *  cannot be converted, @a dfault is used instead.\n       *\n       *  do_narrow() is a hook for a derived facet to change the behavior of\n       *  narrowing.  do_narrow() must always return the same result for the\n       *  same input.\n       *\n       *  Note: this is not what you want for codepage conversions.  See\n       *  codecvt for that.\n       *\n       *  @param lo  Pointer to start of range.\n       *  @param hi  Pointer to end of range.\n       *  @param dfault  Char to use if conversion fails.\n       *  @param to  Pointer to the destination array.\n       *  @return  @a hi.\n      */\n      virtual const char_type*\n      do_narrow(const char_type* __lo, const char_type* __hi,\n\t\tchar __dfault, char* __dest) const = 0;\n    };\n\n  // NB: Generic, mostly useless implementation.\n  /**\n   *  @brief  Template ctype facet\n   *\n   *  This template class defines classification and conversion functions for\n   *  character sets.  It wraps <cctype> functionality.  Ctype gets used by\n   *  streams for many I/O operations.\n   *\n   *  This template provides the protected virtual functions the developer\n   *  will have to replace in a derived class or specialization to make a\n   *  working facet.  The public functions that access them are defined in\n   *  __ctype_abstract_base, to allow for implementation flexibility.  See\n   *  ctype<wchar_t> for an example.  The functions are documented in\n   *  __ctype_abstract_base.\n   *\n   *  Note: implementations are provided for all the protected virtual\n   *  functions, but will likely not be useful.\n  */\n  template<typename _CharT>\n    class ctype : public __ctype_abstract_base<_CharT>\n    {\n    public:\n      // Types:\n      typedef _CharT\t\t\tchar_type;\n      typedef typename __ctype_abstract_base<_CharT>::mask mask;\n\n      /// The facet id for ctype<char_type>\n      static locale::id\t\t\tid;\n\n      explicit\n      ctype(size_t __refs = 0) : __ctype_abstract_base<_CharT>(__refs) { }\n\n   protected:\n      virtual\n      ~ctype();\n\n      virtual bool\n      do_is(mask __m, char_type __c) const;\n\n      virtual const char_type*\n      do_is(const char_type* __lo, const char_type* __hi, mask* __vec) const;\n\n      virtual const char_type*\n      do_scan_is(mask __m, const char_type* __lo, const char_type* __hi) const;\n\n      virtual const char_type*\n      do_scan_not(mask __m, const char_type* __lo,\n\t\t  const char_type* __hi) const;\n\n      virtual char_type\n      do_toupper(char_type __c) const;\n\n      virtual const char_type*\n      do_toupper(char_type* __lo, const char_type* __hi) const;\n\n      virtual char_type\n      do_tolower(char_type __c) const;\n\n      virtual const char_type*\n      do_tolower(char_type* __lo, const char_type* __hi) const;\n\n      virtual char_type\n      do_widen(char __c) const;\n\n      virtual const char*\n      do_widen(const char* __lo, const char* __hi, char_type* __dest) const;\n\n      virtual char\n      do_narrow(char_type, char __dfault) const;\n\n      virtual const char_type*\n      do_narrow(const char_type* __lo, const char_type* __hi,\n\t\tchar __dfault, char* __dest) const;\n    };\n\n  template<typename _CharT>\n    locale::id ctype<_CharT>::id;\n\n  // 22.2.1.3  ctype<char> specialization.\n  /**\n   *  @brief  The ctype<char> specialization.\n   *\n   *  This class defines classification and conversion functions for\n   *  the char type.  It gets used by char streams for many I/O\n   *  operations.  The char specialization provides a number of\n   *  optimizations as well.\n  */\n  template<>\n    class ctype<char> : public locale::facet, public ctype_base\n    {\n    public:\n      // Types:\n      /// Typedef for the template parameter char.\n      typedef char\t\tchar_type;\n\n    protected:\n      // Data Members:\n      __c_locale\t\t_M_c_locale_ctype;\n      bool\t\t\t_M_del;\n      __to_type\t\t\t_M_toupper;\n      __to_type\t\t\t_M_tolower;\n      const mask*\t\t_M_table;\n      mutable char\t\t_M_widen_ok;\n      mutable char\t\t_M_widen[1 + static_cast<unsigned char>(-1)];\n      mutable char\t\t_M_narrow[1 + static_cast<unsigned char>(-1)];\n      mutable char\t\t_M_narrow_ok;\t// 0 uninitialized, 1 init,\n\t\t\t\t\t\t// 2 memcpy can't be used\n\n    public:\n      /// The facet id for ctype<char>\n      static locale::id        id;\n      /// The size of the mask table.  It is SCHAR_MAX + 1.\n      static const size_t      table_size = 1 + static_cast<unsigned char>(-1);\n\n      /**\n       *  @brief  Constructor performs initialization.\n       *\n       *  This is the constructor provided by the standard.\n       *\n       *  @param table If non-zero, table is used as the per-char mask.\n       *               Else classic_table() is used.\n       *  @param del   If true, passes ownership of table to this facet.\n       *  @param refs  Passed to the base facet class.\n      */\n      explicit\n      ctype(const mask* __table = 0, bool __del = false, size_t __refs = 0);\n\n      /**\n       *  @brief  Constructor performs static initialization.\n       *\n       *  This constructor is used to construct the initial C locale facet.\n       *\n       *  @param cloc  Handle to C locale data.\n       *  @param table If non-zero, table is used as the per-char mask.\n       *  @param del   If true, passes ownership of table to this facet.\n       *  @param refs  Passed to the base facet class.\n      */\n      explicit\n      ctype(__c_locale __cloc, const mask* __table = 0, bool __del = false,\n\t    size_t __refs = 0);\n\n      /**\n       *  @brief  Test char classification.\n       *\n       *  This function compares the mask table[c] to @a m.\n       *\n       *  @param c  The char to compare the mask of.\n       *  @param m  The mask to compare against.\n       *  @return  True if m & table[c] is true, false otherwise.\n      */\n      inline bool\n      is(mask __m, char __c) const;\n\n      /**\n       *  @brief  Return a mask array.\n       *\n       *  This function finds the mask for each char in the range [lo, hi) and\n       *  successively writes it to vec.  vec must have as many elements as\n       *  the char array.\n       *\n       *  @param lo  Pointer to start of range.\n       *  @param hi  Pointer to end of range.\n       *  @param vec  Pointer to an array of mask storage.\n       *  @return  @a hi.\n      */\n      inline const char*\n      is(const char* __lo, const char* __hi, mask* __vec) const;\n\n      /**\n       *  @brief  Find char matching a mask\n       *\n       *  This function searches for and returns the first char in [lo,hi) for\n       *  which is(m,char) is true.\n       *\n       *  @param m  The mask to compare against.\n       *  @param lo  Pointer to start of range.\n       *  @param hi  Pointer to end of range.\n       *  @return  Pointer to a matching char if found, else @a hi.\n      */\n      inline const char*\n      scan_is(mask __m, const char* __lo, const char* __hi) const;\n\n      /**\n       *  @brief  Find char not matching a mask\n       *\n       *  This function searches for and returns a pointer to the first char\n       *  in [lo,hi) for which is(m,char) is false.\n       *\n       *  @param m  The mask to compare against.\n       *  @param lo  Pointer to start of range.\n       *  @param hi  Pointer to end of range.\n       *  @return  Pointer to a non-matching char if found, else @a hi.\n      */\n      inline const char*\n      scan_not(mask __m, const char* __lo, const char* __hi) const;\n\n      /**\n       *  @brief  Convert to uppercase.\n       *\n       *  This function converts the char argument to uppercase if possible.\n       *  If not possible (for example, '2'), returns the argument.\n       *\n       *  toupper() acts as if it returns ctype<char>::do_toupper(c).\n       *  do_toupper() must always return the same result for the same input.\n       *\n       *  @param c  The char to convert.\n       *  @return  The uppercase char if convertible, else @a c.\n      */\n      char_type\n      toupper(char_type __c) const\n      { return this->do_toupper(__c); }\n\n      /**\n       *  @brief  Convert array to uppercase.\n       *\n       *  This function converts each char in the range [lo,hi) to uppercase\n       *  if possible.  Other chars remain untouched.\n       *\n       *  toupper() acts as if it returns ctype<char>:: do_toupper(lo, hi).\n       *  do_toupper() must always return the same result for the same input.\n       *\n       *  @param lo  Pointer to first char in range.\n       *  @param hi  Pointer to end of range.\n       *  @return  @a hi.\n      */\n      const char_type*\n      toupper(char_type *__lo, const char_type* __hi) const\n      { return this->do_toupper(__lo, __hi); }\n\n      /**\n       *  @brief  Convert to lowercase.\n       *\n       *  This function converts the char argument to lowercase if possible.\n       *  If not possible (for example, '2'), returns the argument.\n       *\n       *  tolower() acts as if it returns ctype<char>::do_tolower(c).\n       *  do_tolower() must always return the same result for the same input.\n       *\n       *  @param c  The char to convert.\n       *  @return  The lowercase char if convertible, else @a c.\n      */\n      char_type\n      tolower(char_type __c) const\n      { return this->do_tolower(__c); }\n\n      /**\n       *  @brief  Convert array to lowercase.\n       *\n       *  This function converts each char in the range [lo,hi) to lowercase\n       *  if possible.  Other chars remain untouched.\n       *\n       *  tolower() acts as if it returns ctype<char>:: do_tolower(lo, hi).\n       *  do_tolower() must always return the same result for the same input.\n       *\n       *  @param lo  Pointer to first char in range.\n       *  @param hi  Pointer to end of range.\n       *  @return  @a hi.\n      */\n      const char_type*\n      tolower(char_type* __lo, const char_type* __hi) const\n      { return this->do_tolower(__lo, __hi); }\n\n      /**\n       *  @brief  Widen char\n       *\n       *  This function converts the char to char_type using the simplest\n       *  reasonable transformation.  For an underived ctype<char> facet, the\n       *  argument will be returned unchanged.\n       *\n       *  This function works as if it returns ctype<char>::do_widen(c).\n       *  do_widen() must always return the same result for the same input.\n       *\n       *  Note: this is not what you want for codepage conversions.  See\n       *  codecvt for that.\n       *\n       *  @param c  The char to convert.\n       *  @return  The converted character.\n      */\n      char_type\n      widen(char __c) const\n      {\n\tif (_M_widen_ok)\n\t  return _M_widen[static_cast<unsigned char>(__c)];\n\tthis->_M_widen_init();\n\treturn this->do_widen(__c);\n      }\n\n      /**\n       *  @brief  Widen char array\n       *\n       *  This function converts each char in the input to char using the\n       *  simplest reasonable transformation.  For an underived ctype<char>\n       *  facet, the argument will be copied unchanged.\n       *\n       *  This function works as if it returns ctype<char>::do_widen(c).\n       *  do_widen() must always return the same result for the same input.\n       *\n       *  Note: this is not what you want for codepage conversions.  See\n       *  codecvt for that.\n       *\n       *  @param lo  Pointer to first char in range.\n       *  @param hi  Pointer to end of range.\n       *  @param to  Pointer to the destination array.\n       *  @return  @a hi.\n      */\n      const char*\n      widen(const char* __lo, const char* __hi, char_type* __to) const\n      {\n\tif (_M_widen_ok == 1)\n\t  {\n\t    memcpy(__to, __lo, __hi - __lo);\n\t    return __hi;\n\t  }\n\tif (!_M_widen_ok)\n\t  _M_widen_init();\n\treturn this->do_widen(__lo, __hi, __to);\n      }\n\n      /**\n       *  @brief  Narrow char\n       *\n       *  This function converts the char to char using the simplest\n       *  reasonable transformation.  If the conversion fails, dfault is\n       *  returned instead.  For an underived ctype<char> facet, @a c\n       *  will be returned unchanged.\n       *\n       *  This function works as if it returns ctype<char>::do_narrow(c).\n       *  do_narrow() must always return the same result for the same input.\n       *\n       *  Note: this is not what you want for codepage conversions.  See\n       *  codecvt for that.\n       *\n       *  @param c  The char to convert.\n       *  @param dfault  Char to return if conversion fails.\n       *  @return  The converted character.\n      */\n      char\n      narrow(char_type __c, char __dfault) const\n      {\n\tif (_M_narrow[static_cast<unsigned char>(__c)])\n\t  return _M_narrow[static_cast<unsigned char>(__c)];\n\tconst char __t = do_narrow(__c, __dfault);\n\tif (__t != __dfault)\n\t  _M_narrow[static_cast<unsigned char>(__c)] = __t;\n\treturn __t;\n      }\n\n      /**\n       *  @brief  Narrow char array\n       *\n       *  This function converts each char in the input to char using the\n       *  simplest reasonable transformation and writes the results to the\n       *  destination array.  For any char in the input that cannot be\n       *  converted, @a dfault is used instead.  For an underived ctype<char>\n       *  facet, the argument will be copied unchanged.\n       *\n       *  This function works as if it returns ctype<char>::do_narrow(lo, hi,\n       *  dfault, to).  do_narrow() must always return the same result for the\n       *  same input.\n       *\n       *  Note: this is not what you want for codepage conversions.  See\n       *  codecvt for that.\n       *\n       *  @param lo  Pointer to start of range.\n       *  @param hi  Pointer to end of range.\n       *  @param dfault  Char to use if conversion fails.\n       *  @param to  Pointer to the destination array.\n       *  @return  @a hi.\n      */\n      const char_type*\n      narrow(const char_type* __lo, const char_type* __hi,\n\t     char __dfault, char *__to) const\n      {\n\tif (__builtin_expect(_M_narrow_ok == 1, true))\n\t  {\n\t    memcpy(__to, __lo, __hi - __lo);\n\t    return __hi;\n\t  }\n\tif (!_M_narrow_ok)\n\t  _M_narrow_init();\n\treturn this->do_narrow(__lo, __hi, __dfault, __to);\n      }\n\n    protected:\n      /// Returns a pointer to the mask table provided to the constructor, or\n      /// the default from classic_table() if none was provided.\n      const mask*\n      table() const throw()\n      { return _M_table; }\n\n      /// Returns a pointer to the C locale mask table.\n      static const mask*\n      classic_table() throw();\n\n      /**\n       *  @brief  Destructor.\n       *\n       *  This function deletes table() if @a del was true in the\n       *  constructor.\n      */\n      virtual\n      ~ctype();\n\n      /**\n       *  @brief  Convert to uppercase.\n       *\n       *  This virtual function converts the char argument to uppercase if\n       *  possible.  If not possible (for example, '2'), returns the argument.\n       *\n       *  do_toupper() is a hook for a derived facet to change the behavior of\n       *  uppercasing.  do_toupper() must always return the same result for\n       *  the same input.\n       *\n       *  @param c  The char to convert.\n       *  @return  The uppercase char if convertible, else @a c.\n      */\n      virtual char_type\n      do_toupper(char_type) const;\n\n      /**\n       *  @brief  Convert array to uppercase.\n       *\n       *  This virtual function converts each char in the range [lo,hi) to\n       *  uppercase if possible.  Other chars remain untouched.\n       *\n       *  do_toupper() is a hook for a derived facet to change the behavior of\n       *  uppercasing.  do_toupper() must always return the same result for\n       *  the same input.\n       *\n       *  @param lo  Pointer to start of range.\n       *  @param hi  Pointer to end of range.\n       *  @return  @a hi.\n      */\n      virtual const char_type*\n      do_toupper(char_type* __lo, const char_type* __hi) const;\n\n      /**\n       *  @brief  Convert to lowercase.\n       *\n       *  This virtual function converts the char argument to lowercase if\n       *  possible.  If not possible (for example, '2'), returns the argument.\n       *\n       *  do_tolower() is a hook for a derived facet to change the behavior of\n       *  lowercasing.  do_tolower() must always return the same result for\n       *  the same input.\n       *\n       *  @param c  The char to convert.\n       *  @return  The lowercase char if convertible, else @a c.\n      */\n      virtual char_type\n      do_tolower(char_type) const;\n\n      /**\n       *  @brief  Convert array to lowercase.\n       *\n       *  This virtual function converts each char in the range [lo,hi) to\n       *  lowercase if possible.  Other chars remain untouched.\n       *\n       *  do_tolower() is a hook for a derived facet to change the behavior of\n       *  lowercasing.  do_tolower() must always return the same result for\n       *  the same input.\n       *\n       *  @param lo  Pointer to first char in range.\n       *  @param hi  Pointer to end of range.\n       *  @return  @a hi.\n      */\n      virtual const char_type*\n      do_tolower(char_type* __lo, const char_type* __hi) const;\n\n      /**\n       *  @brief  Widen char\n       *\n       *  This virtual function converts the char to char using the simplest\n       *  reasonable transformation.  For an underived ctype<char> facet, the\n       *  argument will be returned unchanged.\n       *\n       *  do_widen() is a hook for a derived facet to change the behavior of\n       *  widening.  do_widen() must always return the same result for the\n       *  same input.\n       *\n       *  Note: this is not what you want for codepage conversions.  See\n       *  codecvt for that.\n       *\n       *  @param c  The char to convert.\n       *  @return  The converted character.\n      */\n      virtual char_type\n      do_widen(char __c) const\n      { return __c; }\n\n      /**\n       *  @brief  Widen char array\n       *\n       *  This function converts each char in the range [lo,hi) to char using\n       *  the simplest reasonable transformation.  For an underived\n       *  ctype<char> facet, the argument will be copied unchanged.\n       *\n       *  do_widen() is a hook for a derived facet to change the behavior of\n       *  widening.  do_widen() must always return the same result for the\n       *  same input.\n       *\n       *  Note: this is not what you want for codepage conversions.  See\n       *  codecvt for that.\n       *\n       *  @param lo  Pointer to start of range.\n       *  @param hi  Pointer to end of range.\n       *  @param to  Pointer to the destination array.\n       *  @return  @a hi.\n      */\n      virtual const char*\n      do_widen(const char* __lo, const char* __hi, char_type* __dest) const\n      {\n\tmemcpy(__dest, __lo, __hi - __lo);\n\treturn __hi;\n      }\n\n      /**\n       *  @brief  Narrow char\n       *\n       *  This virtual function converts the char to char using the simplest\n       *  reasonable transformation.  If the conversion fails, dfault is\n       *  returned instead.  For an underived ctype<char> facet, @a c will be\n       *  returned unchanged.\n       *\n       *  do_narrow() is a hook for a derived facet to change the behavior of\n       *  narrowing.  do_narrow() must always return the same result for the\n       *  same input.\n       *\n       *  Note: this is not what you want for codepage conversions.  See\n       *  codecvt for that.\n       *\n       *  @param c  The char to convert.\n       *  @param dfault  Char to return if conversion fails.\n       *  @return  The converted char.\n      */\n      virtual char\n      do_narrow(char_type __c, char) const\n      { return __c; }\n\n      /**\n       *  @brief  Narrow char array to char array\n       *\n       *  This virtual function converts each char in the range [lo,hi) to\n       *  char using the simplest reasonable transformation and writes the\n       *  results to the destination array.  For any char in the input that\n       *  cannot be converted, @a dfault is used instead.  For an underived\n       *  ctype<char> facet, the argument will be copied unchanged.\n       *\n       *  do_narrow() is a hook for a derived facet to change the behavior of\n       *  narrowing.  do_narrow() must always return the same result for the\n       *  same input.\n       *\n       *  Note: this is not what you want for codepage conversions.  See\n       *  codecvt for that.\n       *\n       *  @param lo  Pointer to start of range.\n       *  @param hi  Pointer to end of range.\n       *  @param dfault  Char to use if conversion fails.\n       *  @param to  Pointer to the destination array.\n       *  @return  @a hi.\n      */\n      virtual const char_type*\n      do_narrow(const char_type* __lo, const char_type* __hi,\n\t\tchar, char* __dest) const\n      {\n\tmemcpy(__dest, __lo, __hi - __lo);\n\treturn __hi;\n      }\n\n    private:\n\n      void _M_widen_init() const\n      {\n\tchar __tmp[sizeof(_M_widen)];\n\tfor (size_t __i = 0; __i < sizeof(_M_widen); ++__i)\n\t  __tmp[__i] = __i;\n\tdo_widen(__tmp, __tmp + sizeof(__tmp), _M_widen);\n\n\t_M_widen_ok = 1;\n\t// Set _M_widen_ok to 2 if memcpy can't be used.\n\tif (memcmp(__tmp, _M_widen, sizeof(_M_widen)))\n\t  _M_widen_ok = 2;\n      }\n\n      // Fill in the narrowing cache and flag whether all values are\n      // valid or not.  _M_narrow_ok is set to 2 if memcpy can't\n      // be used.\n      void _M_narrow_init() const\n      {\n\tchar __tmp[sizeof(_M_narrow)];\n\tfor (size_t __i = 0; __i < sizeof(_M_narrow); ++__i)\n\t  __tmp[__i] = __i;\n\tdo_narrow(__tmp, __tmp + sizeof(__tmp), 0, _M_narrow);\n\n\t_M_narrow_ok = 1;\n\tif (memcmp(__tmp, _M_narrow, sizeof(_M_narrow)))\n\t  _M_narrow_ok = 2;\n\telse\n\t  {\n\t    // Deal with the special case of zero: renarrow with a\n\t    // different default and compare.\n\t    char __c;\n\t    do_narrow(__tmp, __tmp + 1, 1, &__c);\n\t    if (__c == 1)\n\t      _M_narrow_ok = 2;\n\t  }\n      }\n    };\n\n  template<>\n    const ctype<char>&\n    use_facet<ctype<char> >(const locale& __loc);\n\n#ifdef _GLIBCXX_USE_WCHAR_T\n  // 22.2.1.3  ctype<wchar_t> specialization\n  /**\n   *  @brief  The ctype<wchar_t> specialization.\n   *\n   *  This class defines classification and conversion functions for the\n   *  wchar_t type.  It gets used by wchar_t streams for many I/O operations.\n   *  The wchar_t specialization provides a number of optimizations as well.\n   *\n   *  ctype<wchar_t> inherits its public methods from\n   *  __ctype_abstract_base<wchar_t>.\n  */\n  template<>\n    class ctype<wchar_t> : public __ctype_abstract_base<wchar_t>\n    {\n    public:\n      // Types:\n      /// Typedef for the template parameter wchar_t.\n      typedef wchar_t\t\tchar_type;\n      typedef wctype_t\t\t__wmask_type;\n\n    protected:\n      __c_locale\t\t_M_c_locale_ctype;\n\n      // Pre-computed narrowed and widened chars.\n      bool                      _M_narrow_ok;\n      char                      _M_narrow[128];\n      wint_t                    _M_widen[1 + static_cast<unsigned char>(-1)];\n\n      // Pre-computed elements for do_is.\n      mask                      _M_bit[16];\n      __wmask_type              _M_wmask[16];\n\n    public:\n      // Data Members:\n      /// The facet id for ctype<wchar_t>\n      static locale::id\t\tid;\n\n      /**\n       *  @brief  Constructor performs initialization.\n       *\n       *  This is the constructor provided by the standard.\n       *\n       *  @param refs  Passed to the base facet class.\n      */\n      explicit\n      ctype(size_t __refs = 0);\n\n      /**\n       *  @brief  Constructor performs static initialization.\n       *\n       *  This constructor is used to construct the initial C locale facet.\n       *\n       *  @param cloc  Handle to C locale data.\n       *  @param refs  Passed to the base facet class.\n      */\n      explicit\n      ctype(__c_locale __cloc, size_t __refs = 0);\n\n    protected:\n      __wmask_type\n      _M_convert_to_wmask(const mask __m) const;\n\n      /// Destructor\n      virtual\n      ~ctype();\n\n      /**\n       *  @brief  Test wchar_t classification.\n       *\n       *  This function finds a mask M for @a c and compares it to mask @a m.\n       *\n       *  do_is() is a hook for a derived facet to change the behavior of\n       *  classifying.  do_is() must always return the same result for the\n       *  same input.\n       *\n       *  @param c  The wchar_t to find the mask of.\n       *  @param m  The mask to compare against.\n       *  @return  (M & m) != 0.\n      */\n      virtual bool\n      do_is(mask __m, char_type __c) const;\n\n      /**\n       *  @brief  Return a mask array.\n       *\n       *  This function finds the mask for each wchar_t in the range [lo,hi)\n       *  and successively writes it to vec.  vec must have as many elements\n       *  as the input.\n       *\n       *  do_is() is a hook for a derived facet to change the behavior of\n       *  classifying.  do_is() must always return the same result for the\n       *  same input.\n       *\n       *  @param lo  Pointer to start of range.\n       *  @param hi  Pointer to end of range.\n       *  @param vec  Pointer to an array of mask storage.\n       *  @return  @a hi.\n      */\n      virtual const char_type*\n      do_is(const char_type* __lo, const char_type* __hi, mask* __vec) const;\n\n      /**\n       *  @brief  Find wchar_t matching mask\n       *\n       *  This function searches for and returns the first wchar_t c in\n       *  [lo,hi) for which is(m,c) is true.\n       *\n       *  do_scan_is() is a hook for a derived facet to change the behavior of\n       *  match searching.  do_is() must always return the same result for the\n       *  same input.\n       *\n       *  @param m  The mask to compare against.\n       *  @param lo  Pointer to start of range.\n       *  @param hi  Pointer to end of range.\n       *  @return  Pointer to a matching wchar_t if found, else @a hi.\n      */\n      virtual const char_type*\n      do_scan_is(mask __m, const char_type* __lo, const char_type* __hi) const;\n\n      /**\n       *  @brief  Find wchar_t not matching mask\n       *\n       *  This function searches for and returns a pointer to the first\n       *  wchar_t c of [lo,hi) for which is(m,c) is false.\n       *\n       *  do_scan_is() is a hook for a derived facet to change the behavior of\n       *  match searching.  do_is() must always return the same result for the\n       *  same input.\n       *\n       *  @param m  The mask to compare against.\n       *  @param lo  Pointer to start of range.\n       *  @param hi  Pointer to end of range.\n       *  @return  Pointer to a non-matching wchar_t if found, else @a hi.\n      */\n      virtual const char_type*\n      do_scan_not(mask __m, const char_type* __lo,\n\t\t  const char_type* __hi) const;\n\n      /**\n       *  @brief  Convert to uppercase.\n       *\n       *  This virtual function converts the wchar_t argument to uppercase if\n       *  possible.  If not possible (for example, '2'), returns the argument.\n       *\n       *  do_toupper() is a hook for a derived facet to change the behavior of\n       *  uppercasing.  do_toupper() must always return the same result for\n       *  the same input.\n       *\n       *  @param c  The wchar_t to convert.\n       *  @return  The uppercase wchar_t if convertible, else @a c.\n      */\n      virtual char_type\n      do_toupper(char_type) const;\n\n      /**\n       *  @brief  Convert array to uppercase.\n       *\n       *  This virtual function converts each wchar_t in the range [lo,hi) to\n       *  uppercase if possible.  Other elements remain untouched.\n       *\n       *  do_toupper() is a hook for a derived facet to change the behavior of\n       *  uppercasing.  do_toupper() must always return the same result for\n       *  the same input.\n       *\n       *  @param lo  Pointer to start of range.\n       *  @param hi  Pointer to end of range.\n       *  @return  @a hi.\n      */\n      virtual const char_type*\n      do_toupper(char_type* __lo, const char_type* __hi) const;\n\n      /**\n       *  @brief  Convert to lowercase.\n       *\n       *  This virtual function converts the argument to lowercase if\n       *  possible.  If not possible (for example, '2'), returns the argument.\n       *\n       *  do_tolower() is a hook for a derived facet to change the behavior of\n       *  lowercasing.  do_tolower() must always return the same result for\n       *  the same input.\n       *\n       *  @param c  The wchar_t to convert.\n       *  @return  The lowercase wchar_t if convertible, else @a c.\n      */\n      virtual char_type\n      do_tolower(char_type) const;\n\n      /**\n       *  @brief  Convert array to lowercase.\n       *\n       *  This virtual function converts each wchar_t in the range [lo,hi) to\n       *  lowercase if possible.  Other elements remain untouched.\n       *\n       *  do_tolower() is a hook for a derived facet to change the behavior of\n       *  lowercasing.  do_tolower() must always return the same result for\n       *  the same input.\n       *\n       *  @param lo  Pointer to start of range.\n       *  @param hi  Pointer to end of range.\n       *  @return  @a hi.\n      */\n      virtual const char_type*\n      do_tolower(char_type* __lo, const char_type* __hi) const;\n\n      /**\n       *  @brief  Widen char to wchar_t\n       *\n       *  This virtual function converts the char to wchar_t using the\n       *  simplest reasonable transformation.  For an underived ctype<wchar_t>\n       *  facet, the argument will be cast to wchar_t.\n       *\n       *  do_widen() is a hook for a derived facet to change the behavior of\n       *  widening.  do_widen() must always return the same result for the\n       *  same input.\n       *\n       *  Note: this is not what you want for codepage conversions.  See\n       *  codecvt for that.\n       *\n       *  @param c  The char to convert.\n       *  @return  The converted wchar_t.\n      */\n      virtual char_type\n      do_widen(char) const;\n\n      /**\n       *  @brief  Widen char array to wchar_t array\n       *\n       *  This function converts each char in the input to wchar_t using the\n       *  simplest reasonable transformation.  For an underived ctype<wchar_t>\n       *  facet, the argument will be copied, casting each element to wchar_t.\n       *\n       *  do_widen() is a hook for a derived facet to change the behavior of\n       *  widening.  do_widen() must always return the same result for the\n       *  same input.\n       *\n       *  Note: this is not what you want for codepage conversions.  See\n       *  codecvt for that.\n       *\n       *  @param lo  Pointer to start range.\n       *  @param hi  Pointer to end of range.\n       *  @param to  Pointer to the destination array.\n       *  @return  @a hi.\n      */\n      virtual const char*\n      do_widen(const char* __lo, const char* __hi, char_type* __dest) const;\n\n      /**\n       *  @brief  Narrow wchar_t to char\n       *\n       *  This virtual function converts the argument to char using\n       *  the simplest reasonable transformation.  If the conversion\n       *  fails, dfault is returned instead.  For an underived\n       *  ctype<wchar_t> facet, @a c will be cast to char and\n       *  returned.\n       *\n       *  do_narrow() is a hook for a derived facet to change the\n       *  behavior of narrowing.  do_narrow() must always return the\n       *  same result for the same input.\n       *\n       *  Note: this is not what you want for codepage conversions.  See\n       *  codecvt for that.\n       *\n       *  @param c  The wchar_t to convert.\n       *  @param dfault  Char to return if conversion fails.\n       *  @return  The converted char.\n      */\n      virtual char\n      do_narrow(char_type, char __dfault) const;\n\n      /**\n       *  @brief  Narrow wchar_t array to char array\n       *\n       *  This virtual function converts each wchar_t in the range [lo,hi) to\n       *  char using the simplest reasonable transformation and writes the\n       *  results to the destination array.  For any wchar_t in the input that\n       *  cannot be converted, @a dfault is used instead.  For an underived\n       *  ctype<wchar_t> facet, the argument will be copied, casting each\n       *  element to char.\n       *\n       *  do_narrow() is a hook for a derived facet to change the behavior of\n       *  narrowing.  do_narrow() must always return the same result for the\n       *  same input.\n       *\n       *  Note: this is not what you want for codepage conversions.  See\n       *  codecvt for that.\n       *\n       *  @param lo  Pointer to start of range.\n       *  @param hi  Pointer to end of range.\n       *  @param dfault  Char to use if conversion fails.\n       *  @param to  Pointer to the destination array.\n       *  @return  @a hi.\n      */\n      virtual const char_type*\n      do_narrow(const char_type* __lo, const char_type* __hi,\n\t\tchar __dfault, char* __dest) const;\n\n      // For use at construction time only.\n      void\n      _M_initialize_ctype();\n    };\n\n  template<>\n    const ctype<wchar_t>&\n    use_facet<ctype<wchar_t> >(const locale& __loc);\n#endif //_GLIBCXX_USE_WCHAR_T\n\n  /// @brief  class ctype_byname [22.2.1.2].\n  template<typename _CharT>\n    class ctype_byname : public ctype<_CharT>\n    {\n    public:\n      typedef _CharT\t\tchar_type;\n\n      explicit\n      ctype_byname(const char* __s, size_t __refs = 0);\n\n    protected:\n      virtual\n      ~ctype_byname() { };\n    };\n\n  /// 22.2.1.4  Class ctype_byname specializations.\n  template<>\n    ctype_byname<char>::ctype_byname(const char*, size_t refs);\n\n  template<>\n    ctype_byname<wchar_t>::ctype_byname(const char*, size_t refs);\n\n_GLIBCXX_END_NAMESPACE\n\n// Include host and configuration specific ctype inlines.\n#include <bits/ctype_inline.h>\n\n// 22.2.1.5  Template class codecvt\n#include <bits/codecvt.h>\n\n_GLIBCXX_BEGIN_NAMESPACE(std)\n\n  // 22.2.2  The numeric category.\n  class __num_base\n  {\n  public:\n    // NB: Code depends on the order of _S_atoms_out elements.\n    // Below are the indices into _S_atoms_out.\n    enum\n      {\n        _S_ominus,\n        _S_oplus,\n        _S_ox,\n        _S_oX,\n        _S_odigits,\n        _S_odigits_end = _S_odigits + 16,\n        _S_oudigits = _S_odigits_end,\n        _S_oudigits_end = _S_oudigits + 16,\n        _S_oe = _S_odigits + 14,  // For scientific notation, 'e'\n        _S_oE = _S_oudigits + 14, // For scientific notation, 'E'\n\t_S_oend = _S_oudigits_end\n      };\n\n    // A list of valid numeric literals for output.  This array\n    // contains chars that will be passed through the current locale's\n    // ctype<_CharT>.widen() and then used to render numbers.\n    // For the standard \"C\" locale, this is\n    // \"-+xX0123456789abcdef0123456789ABCDEF\".\n    static const char* _S_atoms_out;\n\n    // String literal of acceptable (narrow) input, for num_get.\n    // \"-+xX0123456789abcdefABCDEF\"\n    static const char* _S_atoms_in;\n\n    enum\n    {\n      _S_iminus,\n      _S_iplus,\n      _S_ix,\n      _S_iX,\n      _S_izero,\n      _S_ie = _S_izero + 14,\n      _S_iE = _S_izero + 20,\n      _S_iend = 26\n    };\n\n    // num_put\n    // Construct and return valid scanf format for floating point types.\n    static void\n    _S_format_float(const ios_base& __io, char* __fptr, char __mod);\n  };\n\n  template<typename _CharT>\n    struct __numpunct_cache : public locale::facet\n    {\n      const char*\t\t\t_M_grouping;\n      size_t                            _M_grouping_size;\n      bool\t\t\t\t_M_use_grouping;\n      const _CharT*\t\t\t_M_truename;\n      size_t                            _M_truename_size;\n      const _CharT*\t\t\t_M_falsename;\n      size_t                            _M_falsename_size;\n      _CharT\t\t\t\t_M_decimal_point;\n      _CharT\t\t\t\t_M_thousands_sep;\n\n      // A list of valid numeric literals for output: in the standard\n      // \"C\" locale, this is \"-+xX0123456789abcdef0123456789ABCDEF\".\n      // This array contains the chars after having been passed\n      // through the current locale's ctype<_CharT>.widen().\n      _CharT\t\t\t\t_M_atoms_out[__num_base::_S_oend];\n\n      // A list of valid numeric literals for input: in the standard\n      // \"C\" locale, this is \"-+xX0123456789abcdefABCDEF\"\n      // This array contains the chars after having been passed\n      // through the current locale's ctype<_CharT>.widen().\n      _CharT\t\t\t\t_M_atoms_in[__num_base::_S_iend];\n\n      bool\t\t\t\t_M_allocated;\n\n      __numpunct_cache(size_t __refs = 0) : facet(__refs),\n      _M_grouping(NULL), _M_grouping_size(0), _M_use_grouping(false),\n      _M_truename(NULL), _M_truename_size(0), _M_falsename(NULL),\n      _M_falsename_size(0), _M_decimal_point(_CharT()),\n      _M_thousands_sep(_CharT()), _M_allocated(false)\n      { }\n\n      ~__numpunct_cache();\n\n      void\n      _M_cache(const locale& __loc);\n\n    private:\n      __numpunct_cache&\n      operator=(const __numpunct_cache&);\n      \n      explicit\n      __numpunct_cache(const __numpunct_cache&);\n    };\n\n  template<typename _CharT>\n    __numpunct_cache<_CharT>::~__numpunct_cache()\n    {\n      if (_M_allocated)\n\t{\n\t  delete [] _M_grouping;\n\t  delete [] _M_truename;\n\t  delete [] _M_falsename;\n\t}\n    }\n\n  /**\n   *  @brief  Numpunct facet.\n   *\n   *  This facet stores several pieces of information related to printing and\n   *  scanning numbers, such as the decimal point character.  It takes a\n   *  template parameter specifying the char type.  The numpunct facet is\n   *  used by streams for many I/O operations involving numbers.\n   *\n   *  The numpunct template uses protected virtual functions to provide the\n   *  actual results.  The public accessors forward the call to the virtual\n   *  functions.  These virtual functions are hooks for developers to\n   *  implement the behavior they require from a numpunct facet.\n  */\n  template<typename _CharT>\n    class numpunct : public locale::facet\n    {\n    public:\n      // Types:\n      //@{\n      /// Public typedefs\n      typedef _CharT\t\t\tchar_type;\n      typedef basic_string<_CharT>\tstring_type;\n      //@}\n      typedef __numpunct_cache<_CharT>  __cache_type;\n\n    protected:\n      __cache_type*\t\t\t_M_data;\n\n    public:\n      /// Numpunct facet id.\n      static locale::id\t\t\tid;\n\n      /**\n       *  @brief  Numpunct constructor.\n       *\n       *  @param  refs  Refcount to pass to the base class.\n       */\n      explicit\n      numpunct(size_t __refs = 0) : facet(__refs), _M_data(NULL)\n      { _M_initialize_numpunct(); }\n\n      /**\n       *  @brief  Internal constructor.  Not for general use.\n       *\n       *  This is a constructor for use by the library itself to set up the\n       *  predefined locale facets.\n       *\n       *  @param  cache  __numpunct_cache object.\n       *  @param  refs  Refcount to pass to the base class.\n       */\n      explicit\n      numpunct(__cache_type* __cache, size_t __refs = 0)\n      : facet(__refs), _M_data(__cache)\n      { _M_initialize_numpunct(); }\n\n      /**\n       *  @brief  Internal constructor.  Not for general use.\n       *\n       *  This is a constructor for use by the library itself to set up new\n       *  locales.\n       *\n       *  @param  cloc  The \"C\" locale.\n       *  @param  refs  Refcount to pass to the base class.\n       */\n      explicit\n      numpunct(__c_locale __cloc, size_t __refs = 0)\n      : facet(__refs), _M_data(NULL)\n      { _M_initialize_numpunct(__cloc); }\n\n      /**\n       *  @brief  Return decimal point character.\n       *\n       *  This function returns a char_type to use as a decimal point.  It\n       *  does so by returning returning\n       *  numpunct<char_type>::do_decimal_point().\n       *\n       *  @return  @a char_type representing a decimal point.\n      */\n      char_type\n      decimal_point() const\n      { return this->do_decimal_point(); }\n\n      /**\n       *  @brief  Return thousands separator character.\n       *\n       *  This function returns a char_type to use as a thousands\n       *  separator.  It does so by returning returning\n       *  numpunct<char_type>::do_thousands_sep().\n       *\n       *  @return  char_type representing a thousands separator.\n      */\n      char_type\n      thousands_sep() const\n      { return this->do_thousands_sep(); }\n\n      /**\n       *  @brief  Return grouping specification.\n       *\n       *  This function returns a string representing groupings for the\n       *  integer part of a number.  Groupings indicate where thousands\n       *  separators should be inserted in the integer part of a number.\n       *\n       *  Each char in the return string is interpret as an integer\n       *  rather than a character.  These numbers represent the number\n       *  of digits in a group.  The first char in the string\n       *  represents the number of digits in the least significant\n       *  group.  If a char is negative, it indicates an unlimited\n       *  number of digits for the group.  If more chars from the\n       *  string are required to group a number, the last char is used\n       *  repeatedly.\n       *\n       *  For example, if the grouping() returns \"\\003\\002\" and is\n       *  applied to the number 123456789, this corresponds to\n       *  12,34,56,789.  Note that if the string was \"32\", this would\n       *  put more than 50 digits into the least significant group if\n       *  the character set is ASCII.\n       *\n       *  The string is returned by calling\n       *  numpunct<char_type>::do_grouping().\n       *\n       *  @return  string representing grouping specification.\n      */\n      string\n      grouping() const\n      { return this->do_grouping(); }\n\n      /**\n       *  @brief  Return string representation of bool true.\n       *\n       *  This function returns a string_type containing the text\n       *  representation for true bool variables.  It does so by calling\n       *  numpunct<char_type>::do_truename().\n       *\n       *  @return  string_type representing printed form of true.\n      */\n      string_type\n      truename() const\n      { return this->do_truename(); }\n\n      /**\n       *  @brief  Return string representation of bool false.\n       *\n       *  This function returns a string_type containing the text\n       *  representation for false bool variables.  It does so by calling\n       *  numpunct<char_type>::do_falsename().\n       *\n       *  @return  string_type representing printed form of false.\n      */\n      string_type\n      falsename() const\n      { return this->do_falsename(); }\n\n    protected:\n      /// Destructor.\n      virtual\n      ~numpunct();\n\n      /**\n       *  @brief  Return decimal point character.\n       *\n       *  Returns a char_type to use as a decimal point.  This function is a\n       *  hook for derived classes to change the value returned.\n       *\n       *  @return  @a char_type representing a decimal point.\n      */\n      virtual char_type\n      do_decimal_point() const\n      { return _M_data->_M_decimal_point; }\n\n      /**\n       *  @brief  Return thousands separator character.\n       *\n       *  Returns a char_type to use as a thousands separator.  This function\n       *  is a hook for derived classes to change the value returned.\n       *\n       *  @return  @a char_type representing a thousands separator.\n      */\n      virtual char_type\n      do_thousands_sep() const\n      { return _M_data->_M_thousands_sep; }\n\n      /**\n       *  @brief  Return grouping specification.\n       *\n       *  Returns a string representing groupings for the integer part of a\n       *  number.  This function is a hook for derived classes to change the\n       *  value returned.  @see grouping() for details.\n       *\n       *  @return  String representing grouping specification.\n      */\n      virtual string\n      do_grouping() const\n      { return _M_data->_M_grouping; }\n\n      /**\n       *  @brief  Return string representation of bool true.\n       *\n       *  Returns a string_type containing the text representation for true\n       *  bool variables.  This function is a hook for derived classes to\n       *  change the value returned.\n       *\n       *  @return  string_type representing printed form of true.\n      */\n      virtual string_type\n      do_truename() const\n      { return _M_data->_M_truename; }\n\n      /**\n       *  @brief  Return string representation of bool false.\n       *\n       *  Returns a string_type containing the text representation for false\n       *  bool variables.  This function is a hook for derived classes to\n       *  change the value returned.\n       *\n       *  @return  string_type representing printed form of false.\n      */\n      virtual string_type\n      do_falsename() const\n      { return _M_data->_M_falsename; }\n\n      // For use at construction time only.\n      void\n      _M_initialize_numpunct(__c_locale __cloc = NULL);\n    };\n\n  template<typename _CharT>\n    locale::id numpunct<_CharT>::id;\n\n  template<>\n    numpunct<char>::~numpunct();\n\n  template<>\n    void\n    numpunct<char>::_M_initialize_numpunct(__c_locale __cloc);\n\n#ifdef _GLIBCXX_USE_WCHAR_T\n  template<>\n    numpunct<wchar_t>::~numpunct();\n\n  template<>\n    void\n    numpunct<wchar_t>::_M_initialize_numpunct(__c_locale __cloc);\n#endif\n\n  /// @brief  class numpunct_byname [22.2.3.2].\n  template<typename _CharT>\n    class numpunct_byname : public numpunct<_CharT>\n    {\n    public:\n      typedef _CharT\t\t\tchar_type;\n      typedef basic_string<_CharT>\tstring_type;\n\n      explicit\n      numpunct_byname(const char* __s, size_t __refs = 0)\n      : numpunct<_CharT>(__refs)\n      {\n\tif (std::strcmp(__s, \"C\") != 0 && std::strcmp(__s, \"POSIX\") != 0)\n\t  {\n\t    __c_locale __tmp;\n\t    this->_S_create_c_locale(__tmp, __s);\n\t    this->_M_initialize_numpunct(__tmp);\n\t    this->_S_destroy_c_locale(__tmp);\n\t  }\n      }\n\n    protected:\n      virtual\n      ~numpunct_byname() { }\n    };\n\n_GLIBCXX_BEGIN_LDBL_NAMESPACE\n  /**\n   *  @brief  Facet for parsing number strings.\n   *\n   *  This facet encapsulates the code to parse and return a number\n   *  from a string.  It is used by the istream numeric extraction\n   *  operators.\n   *\n   *  The num_get template uses protected virtual functions to provide the\n   *  actual results.  The public accessors forward the call to the virtual\n   *  functions.  These virtual functions are hooks for developers to\n   *  implement the behavior they require from the num_get facet.\n  */\n  template<typename _CharT, typename _InIter>\n    class num_get : public locale::facet\n    {\n    public:\n      // Types:\n      //@{\n      /// Public typedefs\n      typedef _CharT\t\t\tchar_type;\n      typedef _InIter\t\t\titer_type;\n      //@}\n\n      /// Numpunct facet id.\n      static locale::id\t\t\tid;\n\n      /**\n       *  @brief  Constructor performs initialization.\n       *\n       *  This is the constructor provided by the standard.\n       *\n       *  @param refs  Passed to the base facet class.\n      */\n      explicit\n      num_get(size_t __refs = 0) : facet(__refs) { }\n\n      /**\n       *  @brief  Numeric parsing.\n       *\n       *  Parses the input stream into the bool @a v.  It does so by calling\n       *  num_get::do_get().\n       *\n       *  If ios_base::boolalpha is set, attempts to read\n       *  ctype<CharT>::truename() or ctype<CharT>::falsename().  Sets\n       *  @a v to true or false if successful.  Sets err to\n       *  ios_base::failbit if reading the string fails.  Sets err to\n       *  ios_base::eofbit if the stream is emptied.\n       *\n       *  If ios_base::boolalpha is not set, proceeds as with reading a long,\n       *  except if the value is 1, sets @a v to true, if the value is 0, sets\n       *  @a v to false, and otherwise set err to ios_base::failbit.\n       *\n       *  @param  in  Start of input stream.\n       *  @param  end  End of input stream.\n       *  @param  io  Source of locale and flags.\n       *  @param  err  Error flags to set.\n       *  @param  v  Value to format and insert.\n       *  @return  Iterator after reading.\n      */\n      iter_type\n      get(iter_type __in, iter_type __end, ios_base& __io,\n\t  ios_base::iostate& __err, bool& __v) const\n      { return this->do_get(__in, __end, __io, __err, __v); }\n\n      //@{\n      /**\n       *  @brief  Numeric parsing.\n       *\n       *  Parses the input stream into the integral variable @a v.  It does so\n       *  by calling num_get::do_get().\n       *\n       *  Parsing is affected by the flag settings in @a io.\n       *\n       *  The basic parse is affected by the value of io.flags() &\n       *  ios_base::basefield.  If equal to ios_base::oct, parses like the\n       *  scanf %o specifier.  Else if equal to ios_base::hex, parses like %X\n       *  specifier.  Else if basefield equal to 0, parses like the %i\n       *  specifier.  Otherwise, parses like %d for signed and %u for unsigned\n       *  types.  The matching type length modifier is also used.\n       *\n       *  Digit grouping is intrepreted according to numpunct::grouping() and\n       *  numpunct::thousands_sep().  If the pattern of digit groups isn't\n       *  consistent, sets err to ios_base::failbit.\n       *\n       *  If parsing the string yields a valid value for @a v, @a v is set.\n       *  Otherwise, sets err to ios_base::failbit and leaves @a v unaltered.\n       *  Sets err to ios_base::eofbit if the stream is emptied.\n       *\n       *  @param  in  Start of input stream.\n       *  @param  end  End of input stream.\n       *  @param  io  Source of locale and flags.\n       *  @param  err  Error flags to set.\n       *  @param  v  Value to format and insert.\n       *  @return  Iterator after reading.\n      */\n      iter_type\n      get(iter_type __in, iter_type __end, ios_base& __io,\n\t  ios_base::iostate& __err, long& __v) const\n      { return this->do_get(__in, __end, __io, __err, __v); }\n\n      iter_type\n      get(iter_type __in, iter_type __end, ios_base& __io,\n\t  ios_base::iostate& __err, unsigned short& __v) const\n      { return this->do_get(__in, __end, __io, __err, __v); }\n\n      iter_type\n      get(iter_type __in, iter_type __end, ios_base& __io,\n\t  ios_base::iostate& __err, unsigned int& __v)   const\n      { return this->do_get(__in, __end, __io, __err, __v); }\n\n      iter_type\n      get(iter_type __in, iter_type __end, ios_base& __io,\n\t  ios_base::iostate& __err, unsigned long& __v)  const\n      { return this->do_get(__in, __end, __io, __err, __v); }\n\n#ifdef _GLIBCXX_USE_LONG_LONG\n      iter_type\n      get(iter_type __in, iter_type __end, ios_base& __io,\n\t  ios_base::iostate& __err, long long& __v) const\n      { return this->do_get(__in, __end, __io, __err, __v); }\n\n      iter_type\n      get(iter_type __in, iter_type __end, ios_base& __io,\n\t  ios_base::iostate& __err, unsigned long long& __v)  const\n      { return this->do_get(__in, __end, __io, __err, __v); }\n#endif\n      //@}\n\n      //@{\n      /**\n       *  @brief  Numeric parsing.\n       *\n       *  Parses the input stream into the integral variable @a v.  It does so\n       *  by calling num_get::do_get().\n       *\n       *  The input characters are parsed like the scanf %g specifier.  The\n       *  matching type length modifier is also used.\n       *\n       *  The decimal point character used is numpunct::decimal_point().\n       *  Digit grouping is intrepreted according to numpunct::grouping() and\n       *  numpunct::thousands_sep().  If the pattern of digit groups isn't\n       *  consistent, sets err to ios_base::failbit.\n       *\n       *  If parsing the string yields a valid value for @a v, @a v is set.\n       *  Otherwise, sets err to ios_base::failbit and leaves @a v unaltered.\n       *  Sets err to ios_base::eofbit if the stream is emptied.\n       *\n       *  @param  in  Start of input stream.\n       *  @param  end  End of input stream.\n       *  @param  io  Source of locale and flags.\n       *  @param  err  Error flags to set.\n       *  @param  v  Value to format and insert.\n       *  @return  Iterator after reading.\n      */\n      iter_type\n      get(iter_type __in, iter_type __end, ios_base& __io,\n\t  ios_base::iostate& __err, float& __v) const\n      { return this->do_get(__in, __end, __io, __err, __v); }\n\n      iter_type\n      get(iter_type __in, iter_type __end, ios_base& __io,\n\t  ios_base::iostate& __err, double& __v) const\n      { return this->do_get(__in, __end, __io, __err, __v); }\n\n      iter_type\n      get(iter_type __in, iter_type __end, ios_base& __io,\n\t  ios_base::iostate& __err, long double& __v) const\n      { return this->do_get(__in, __end, __io, __err, __v); }\n      //@}\n\n      /**\n       *  @brief  Numeric parsing.\n       *\n       *  Parses the input stream into the pointer variable @a v.  It does so\n       *  by calling num_get::do_get().\n       *\n       *  The input characters are parsed like the scanf %p specifier.\n       *\n       *  Digit grouping is intrepreted according to numpunct::grouping() and\n       *  numpunct::thousands_sep().  If the pattern of digit groups isn't\n       *  consistent, sets err to ios_base::failbit.\n       *\n       *  Note that the digit grouping effect for pointers is a bit ambiguous\n       *  in the standard and shouldn't be relied on.  See DR 344.\n       *\n       *  If parsing the string yields a valid value for @a v, @a v is set.\n       *  Otherwise, sets err to ios_base::failbit and leaves @a v unaltered.\n       *  Sets err to ios_base::eofbit if the stream is emptied.\n       *\n       *  @param  in  Start of input stream.\n       *  @param  end  End of input stream.\n       *  @param  io  Source of locale and flags.\n       *  @param  err  Error flags to set.\n       *  @param  v  Value to format and insert.\n       *  @return  Iterator after reading.\n      */\n      iter_type\n      get(iter_type __in, iter_type __end, ios_base& __io,\n\t  ios_base::iostate& __err, void*& __v) const\n      { return this->do_get(__in, __end, __io, __err, __v); }\n\n    protected:\n      /// Destructor.\n      virtual ~num_get() { }\n\n      iter_type\n      _M_extract_float(iter_type, iter_type, ios_base&, ios_base::iostate&,\n\t\t       string& __xtrc) const;\n\n      template<typename _ValueT>\n        iter_type\n        _M_extract_int(iter_type, iter_type, ios_base&, ios_base::iostate&,\n\t\t       _ValueT& __v) const;\n\n      template<typename _CharT2>\n      typename __gnu_cxx::__enable_if<__is_char<_CharT2>::__value, int>::__type\n        _M_find(const _CharT2*, size_t __len, _CharT2 __c) const\n        {\n\t  int __ret = -1;\n\t  if (__len <= 10)\n\t    {\n\t      if (__c >= _CharT2('0') && __c < _CharT2(_CharT2('0') + __len))\n\t\t__ret = __c - _CharT2('0');\n\t    }\n\t  else\n\t    {\n\t      if (__c >= _CharT2('0') && __c <= _CharT2('9'))\n\t\t__ret = __c - _CharT2('0');\n\t      else if (__c >= _CharT2('a') && __c <= _CharT2('f'))\n\t\t__ret = 10 + (__c - _CharT2('a'));\n\t      else if (__c >= _CharT2('A') && __c <= _CharT2('F'))\n\t\t__ret = 10 + (__c - _CharT2('A'));\n\t    }\n\t  return __ret;\n\t}\n\n      template<typename _CharT2>\n      typename __gnu_cxx::__enable_if<!__is_char<_CharT2>::__value, \n\t\t\t\t      int>::__type\n        _M_find(const _CharT2* __zero, size_t __len, _CharT2 __c) const\n        {\n\t  int __ret = -1;\n\t  const char_type* __q = char_traits<_CharT2>::find(__zero, __len, __c);\n\t  if (__q)\n\t    {\n\t      __ret = __q - __zero;\n\t      if (__ret > 15)\n\t\t__ret -= 6;\n\t    }\n\t  return __ret;\n\t}\n\n      //@{\n      /**\n       *  @brief  Numeric parsing.\n       *\n       *  Parses the input stream into the variable @a v.  This function is a\n       *  hook for derived classes to change the value returned.  @see get()\n       *  for more details.\n       *\n       *  @param  in  Start of input stream.\n       *  @param  end  End of input stream.\n       *  @param  io  Source of locale and flags.\n       *  @param  err  Error flags to set.\n       *  @param  v  Value to format and insert.\n       *  @return  Iterator after reading.\n      */\n      virtual iter_type\n      do_get(iter_type, iter_type, ios_base&, ios_base::iostate&, bool&) const;\n\n\n      virtual iter_type\n      do_get(iter_type, iter_type, ios_base&, ios_base::iostate&, long&) const;\n\n      virtual iter_type\n      do_get(iter_type, iter_type, ios_base&, ios_base::iostate& __err,\n\t      unsigned short&) const;\n\n      virtual iter_type\n      do_get(iter_type, iter_type, ios_base&, ios_base::iostate& __err,\n\t     unsigned int&) const;\n\n      virtual iter_type\n      do_get(iter_type, iter_type, ios_base&, ios_base::iostate& __err,\n\t     unsigned long&) const;\n\n#ifdef _GLIBCXX_USE_LONG_LONG\n      virtual iter_type\n      do_get(iter_type, iter_type, ios_base&, ios_base::iostate& __err,\n\t     long long&) const;\n\n      virtual iter_type\n      do_get(iter_type, iter_type, ios_base&, ios_base::iostate& __err,\n\t     unsigned long long&) const;\n#endif\n\n      virtual iter_type\n      do_get(iter_type, iter_type, ios_base&, ios_base::iostate& __err,\n\t     float&) const;\n\n      virtual iter_type\n      do_get(iter_type, iter_type, ios_base&, ios_base::iostate& __err,\n\t     double&) const;\n\n      // XXX GLIBCXX_ABI Deprecated\n#if defined _GLIBCXX_LONG_DOUBLE_COMPAT && defined __LONG_DOUBLE_128__\n      virtual iter_type\n      __do_get(iter_type, iter_type, ios_base&, ios_base::iostate& __err,\n\t       double&) const;\n#else\n      virtual iter_type\n      do_get(iter_type, iter_type, ios_base&, ios_base::iostate& __err,\n\t     long double&) const;\n#endif\n\n      virtual iter_type\n      do_get(iter_type, iter_type, ios_base&, ios_base::iostate& __err,\n\t     void*&) const;\n\n      // XXX GLIBCXX_ABI Deprecated\n#if defined _GLIBCXX_LONG_DOUBLE_COMPAT && defined __LONG_DOUBLE_128__\n      virtual iter_type\n      do_get(iter_type, iter_type, ios_base&, ios_base::iostate& __err,\n\t     long double&) const;\n#endif\n      //@}\n    };\n\n  template<typename _CharT, typename _InIter>\n    locale::id num_get<_CharT, _InIter>::id;\n\n\n  /**\n   *  @brief  Facet for converting numbers to strings.\n   *\n   *  This facet encapsulates the code to convert a number to a string.  It is\n   *  used by the ostream numeric insertion operators.\n   *\n   *  The num_put template uses protected virtual functions to provide the\n   *  actual results.  The public accessors forward the call to the virtual\n   *  functions.  These virtual functions are hooks for developers to\n   *  implement the behavior they require from the num_put facet.\n  */\n  template<typename _CharT, typename _OutIter>\n    class num_put : public locale::facet\n    {\n    public:\n      // Types:\n      //@{\n      /// Public typedefs\n      typedef _CharT\t\tchar_type;\n      typedef _OutIter\t\titer_type;\n      //@}\n\n      /// Numpunct facet id.\n      static locale::id\t\tid;\n\n      /**\n       *  @brief  Constructor performs initialization.\n       *\n       *  This is the constructor provided by the standard.\n       *\n       *  @param refs  Passed to the base facet class.\n      */\n      explicit\n      num_put(size_t __refs = 0) : facet(__refs) { }\n\n      /**\n       *  @brief  Numeric formatting.\n       *\n       *  Formats the boolean @a v and inserts it into a stream.  It does so\n       *  by calling num_put::do_put().\n       *\n       *  If ios_base::boolalpha is set, writes ctype<CharT>::truename() or\n       *  ctype<CharT>::falsename().  Otherwise formats @a v as an int.\n       *\n       *  @param  s  Stream to write to.\n       *  @param  io  Source of locale and flags.\n       *  @param  fill  Char_type to use for filling.\n       *  @param  v  Value to format and insert.\n       *  @return  Iterator after writing.\n      */\n      iter_type\n      put(iter_type __s, ios_base& __f, char_type __fill, bool __v) const\n      { return this->do_put(__s, __f, __fill, __v); }\n\n      //@{\n      /**\n       *  @brief  Numeric formatting.\n       *\n       *  Formats the integral value @a v and inserts it into a\n       *  stream.  It does so by calling num_put::do_put().\n       *\n       *  Formatting is affected by the flag settings in @a io.\n       *\n       *  The basic format is affected by the value of io.flags() &\n       *  ios_base::basefield.  If equal to ios_base::oct, formats like the\n       *  printf %o specifier.  Else if equal to ios_base::hex, formats like\n       *  %x or %X with ios_base::uppercase unset or set respectively.\n       *  Otherwise, formats like %d, %ld, %lld for signed and %u, %lu, %llu\n       *  for unsigned values.  Note that if both oct and hex are set, neither\n       *  will take effect.\n       *\n       *  If ios_base::showpos is set, '+' is output before positive values.\n       *  If ios_base::showbase is set, '0' precedes octal values (except 0)\n       *  and '0[xX]' precedes hex values.\n       *\n       *  Thousands separators are inserted according to numpunct::grouping()\n       *  and numpunct::thousands_sep().  The decimal point character used is\n       *  numpunct::decimal_point().\n       *\n       *  If io.width() is non-zero, enough @a fill characters are inserted to\n       *  make the result at least that wide.  If\n       *  (io.flags() & ios_base::adjustfield) == ios_base::left, result is\n       *  padded at the end.  If ios_base::internal, then padding occurs\n       *  immediately after either a '+' or '-' or after '0x' or '0X'.\n       *  Otherwise, padding occurs at the beginning.\n       *\n       *  @param  s  Stream to write to.\n       *  @param  io  Source of locale and flags.\n       *  @param  fill  Char_type to use for filling.\n       *  @param  v  Value to format and insert.\n       *  @return  Iterator after writing.\n      */\n      iter_type\n      put(iter_type __s, ios_base& __f, char_type __fill, long __v) const\n      { return this->do_put(__s, __f, __fill, __v); }\n\n      iter_type\n      put(iter_type __s, ios_base& __f, char_type __fill,\n\t  unsigned long __v) const\n      { return this->do_put(__s, __f, __fill, __v); }\n\n#ifdef _GLIBCXX_USE_LONG_LONG\n      iter_type\n      put(iter_type __s, ios_base& __f, char_type __fill, long long __v) const\n      { return this->do_put(__s, __f, __fill, __v); }\n\n      iter_type\n      put(iter_type __s, ios_base& __f, char_type __fill,\n\t  unsigned long long __v) const\n      { return this->do_put(__s, __f, __fill, __v); }\n#endif\n      //@}\n\n      //@{\n      /**\n       *  @brief  Numeric formatting.\n       *\n       *  Formats the floating point value @a v and inserts it into a stream.\n       *  It does so by calling num_put::do_put().\n       *\n       *  Formatting is affected by the flag settings in @a io.\n       *\n       *  The basic format is affected by the value of io.flags() &\n       *  ios_base::floatfield.  If equal to ios_base::fixed, formats like the\n       *  printf %f specifier.  Else if equal to ios_base::scientific, formats\n       *  like %e or %E with ios_base::uppercase unset or set respectively.\n       *  Otherwise, formats like %g or %G depending on uppercase.  Note that\n       *  if both fixed and scientific are set, the effect will also be like\n       *  %g or %G.\n       *\n       *  The output precision is given by io.precision().  This precision is\n       *  capped at numeric_limits::digits10 + 2 (different for double and\n       *  long double).  The default precision is 6.\n       *\n       *  If ios_base::showpos is set, '+' is output before positive values.\n       *  If ios_base::showpoint is set, a decimal point will always be\n       *  output.\n       *\n       *  Thousands separators are inserted according to numpunct::grouping()\n       *  and numpunct::thousands_sep().  The decimal point character used is\n       *  numpunct::decimal_point().\n       *\n       *  If io.width() is non-zero, enough @a fill characters are inserted to\n       *  make the result at least that wide.  If\n       *  (io.flags() & ios_base::adjustfield) == ios_base::left, result is\n       *  padded at the end.  If ios_base::internal, then padding occurs\n       *  immediately after either a '+' or '-' or after '0x' or '0X'.\n       *  Otherwise, padding occurs at the beginning.\n       *\n       *  @param  s  Stream to write to.\n       *  @param  io  Source of locale and flags.\n       *  @param  fill  Char_type to use for filling.\n       *  @param  v  Value to format and insert.\n       *  @return  Iterator after writing.\n      */\n      iter_type\n      put(iter_type __s, ios_base& __f, char_type __fill, double __v) const\n      { return this->do_put(__s, __f, __fill, __v); }\n\n      iter_type\n      put(iter_type __s, ios_base& __f, char_type __fill,\n\t  long double __v) const\n      { return this->do_put(__s, __f, __fill, __v); }\n      //@}\n\n      /**\n       *  @brief  Numeric formatting.\n       *\n       *  Formats the pointer value @a v and inserts it into a stream.  It\n       *  does so by calling num_put::do_put().\n       *\n       *  This function formats @a v as an unsigned long with ios_base::hex\n       *  and ios_base::showbase set.\n       *\n       *  @param  s  Stream to write to.\n       *  @param  io  Source of locale and flags.\n       *  @param  fill  Char_type to use for filling.\n       *  @param  v  Value to format and insert.\n       *  @return  Iterator after writing.\n      */\n      iter_type\n      put(iter_type __s, ios_base& __f, char_type __fill,\n\t  const void* __v) const\n      { return this->do_put(__s, __f, __fill, __v); }\n\n    protected:\n      template<typename _ValueT>\n        iter_type\n        _M_insert_float(iter_type, ios_base& __io, char_type __fill,\n\t\t\tchar __mod, _ValueT __v) const;\n\n      void\n      _M_group_float(const char* __grouping, size_t __grouping_size,\n\t\t     char_type __sep, const char_type* __p, char_type* __new,\n\t\t     char_type* __cs, int& __len) const;\n\n      template<typename _ValueT>\n        iter_type\n        _M_insert_int(iter_type, ios_base& __io, char_type __fill,\n\t\t      _ValueT __v) const;\n\n      void\n      _M_group_int(const char* __grouping, size_t __grouping_size,\n\t\t   char_type __sep, ios_base& __io, char_type* __new,\n\t\t   char_type* __cs, int& __len) const;\n\n      void\n      _M_pad(char_type __fill, streamsize __w, ios_base& __io,\n\t     char_type* __new, const char_type* __cs, int& __len) const;\n\n      /// Destructor.\n      virtual\n      ~num_put() { };\n\n      //@{\n      /**\n       *  @brief  Numeric formatting.\n       *\n       *  These functions do the work of formatting numeric values and\n       *  inserting them into a stream. This function is a hook for derived\n       *  classes to change the value returned.\n       *\n       *  @param  s  Stream to write to.\n       *  @param  io  Source of locale and flags.\n       *  @param  fill  Char_type to use for filling.\n       *  @param  v  Value to format and insert.\n       *  @return  Iterator after writing.\n      */\n      virtual iter_type\n      do_put(iter_type, ios_base&, char_type __fill, bool __v) const;\n\n      virtual iter_type\n      do_put(iter_type, ios_base&, char_type __fill, long __v) const;\n\n      virtual iter_type\n      do_put(iter_type, ios_base&, char_type __fill, unsigned long) const;\n\n#ifdef _GLIBCXX_USE_LONG_LONG\n      virtual iter_type\n      do_put(iter_type, ios_base&, char_type __fill, long long __v) const;\n\n      virtual iter_type\n      do_put(iter_type, ios_base&, char_type __fill, unsigned long long) const;\n#endif\n\n      virtual iter_type\n      do_put(iter_type, ios_base&, char_type __fill, double __v) const;\n\n      // XXX GLIBCXX_ABI Deprecated\n#if defined _GLIBCXX_LONG_DOUBLE_COMPAT && defined __LONG_DOUBLE_128__\n      virtual iter_type\n      __do_put(iter_type, ios_base&, char_type __fill, double __v) const;\n#else\n      virtual iter_type\n      do_put(iter_type, ios_base&, char_type __fill, long double __v) const;\n#endif\n\n      virtual iter_type\n      do_put(iter_type, ios_base&, char_type __fill, const void* __v) const;\n\n      // XXX GLIBCXX_ABI Deprecated\n#if defined _GLIBCXX_LONG_DOUBLE_COMPAT && defined __LONG_DOUBLE_128__\n      virtual iter_type\n      do_put(iter_type, ios_base&, char_type __fill, long double __v) const;\n#endif\n      //@}\n    };\n\n  template <typename _CharT, typename _OutIter>\n    locale::id num_put<_CharT, _OutIter>::id;\n\n_GLIBCXX_END_LDBL_NAMESPACE\n\n  /**\n   *  @brief  Facet for localized string comparison.\n   *\n   *  This facet encapsulates the code to compare strings in a localized\n   *  manner.\n   *\n   *  The collate template uses protected virtual functions to provide\n   *  the actual results.  The public accessors forward the call to\n   *  the virtual functions.  These virtual functions are hooks for\n   *  developers to implement the behavior they require from the\n   *  collate facet.\n  */\n  template<typename _CharT>\n    class collate : public locale::facet\n    {\n    public:\n      // Types:\n      //@{\n      /// Public typedefs\n      typedef _CharT\t\t\tchar_type;\n      typedef basic_string<_CharT>\tstring_type;\n      //@}\n\n    protected:\n      // Underlying \"C\" library locale information saved from\n      // initialization, needed by collate_byname as well.\n      __c_locale\t\t\t_M_c_locale_collate;\n\n    public:\n      /// Numpunct facet id.\n      static locale::id\t\t\tid;\n\n      /**\n       *  @brief  Constructor performs initialization.\n       *\n       *  This is the constructor provided by the standard.\n       *\n       *  @param refs  Passed to the base facet class.\n      */\n      explicit\n      collate(size_t __refs = 0)\n      : facet(__refs), _M_c_locale_collate(_S_get_c_locale())\n      { }\n\n      /**\n       *  @brief  Internal constructor. Not for general use.\n       *\n       *  This is a constructor for use by the library itself to set up new\n       *  locales.\n       *\n       *  @param cloc  The \"C\" locale.\n       *  @param refs  Passed to the base facet class.\n      */\n      explicit\n      collate(__c_locale __cloc, size_t __refs = 0)\n      : facet(__refs), _M_c_locale_collate(_S_clone_c_locale(__cloc))\n      { }\n\n      /**\n       *  @brief  Compare two strings.\n       *\n       *  This function compares two strings and returns the result by calling\n       *  collate::do_compare().\n       *\n       *  @param lo1  Start of string 1.\n       *  @param hi1  End of string 1.\n       *  @param lo2  Start of string 2.\n       *  @param hi2  End of string 2.\n       *  @return  1 if string1 > string2, -1 if string1 < string2, else 0.\n      */\n      int\n      compare(const _CharT* __lo1, const _CharT* __hi1,\n\t      const _CharT* __lo2, const _CharT* __hi2) const\n      { return this->do_compare(__lo1, __hi1, __lo2, __hi2); }\n\n      /**\n       *  @brief  Transform string to comparable form.\n       *\n       *  This function is a wrapper for strxfrm functionality.  It takes the\n       *  input string and returns a modified string that can be directly\n       *  compared to other transformed strings.  In the \"C\" locale, this\n       *  function just returns a copy of the input string.  In some other\n       *  locales, it may replace two chars with one, change a char for\n       *  another, etc.  It does so by returning collate::do_transform().\n       *\n       *  @param lo  Start of string.\n       *  @param hi  End of string.\n       *  @return  Transformed string_type.\n      */\n      string_type\n      transform(const _CharT* __lo, const _CharT* __hi) const\n      { return this->do_transform(__lo, __hi); }\n\n      /**\n       *  @brief  Return hash of a string.\n       *\n       *  This function computes and returns a hash on the input string.  It\n       *  does so by returning collate::do_hash().\n       *\n       *  @param lo  Start of string.\n       *  @param hi  End of string.\n       *  @return  Hash value.\n      */\n      long\n      hash(const _CharT* __lo, const _CharT* __hi) const\n      { return this->do_hash(__lo, __hi); }\n\n      // Used to abstract out _CharT bits in virtual member functions, below.\n      int\n      _M_compare(const _CharT*, const _CharT*) const;\n\n      size_t\n      _M_transform(_CharT*, const _CharT*, size_t) const;\n\n  protected:\n      /// Destructor.\n      virtual\n      ~collate()\n      { _S_destroy_c_locale(_M_c_locale_collate); }\n\n      /**\n       *  @brief  Compare two strings.\n       *\n       *  This function is a hook for derived classes to change the value\n       *  returned.  @see compare().\n       *\n       *  @param lo1  Start of string 1.\n       *  @param hi1  End of string 1.\n       *  @param lo2  Start of string 2.\n       *  @param hi2  End of string 2.\n       *  @return  1 if string1 > string2, -1 if string1 < string2, else 0.\n      */\n      virtual int\n      do_compare(const _CharT* __lo1, const _CharT* __hi1,\n\t\t const _CharT* __lo2, const _CharT* __hi2) const;\n\n      /**\n       *  @brief  Transform string to comparable form.\n       *\n       *  This function is a hook for derived classes to change the value\n       *  returned.\n       *\n       *  @param lo1  Start of string 1.\n       *  @param hi1  End of string 1.\n       *  @param lo2  Start of string 2.\n       *  @param hi2  End of string 2.\n       *  @return  1 if string1 > string2, -1 if string1 < string2, else 0.\n      */\n      virtual string_type\n      do_transform(const _CharT* __lo, const _CharT* __hi) const;\n\n      /**\n       *  @brief  Return hash of a string.\n       *\n       *  This function computes and returns a hash on the input string.  This\n       *  function is a hook for derived classes to change the value returned.\n       *\n       *  @param lo  Start of string.\n       *  @param hi  End of string.\n       *  @return  Hash value.\n      */\n      virtual long\n      do_hash(const _CharT* __lo, const _CharT* __hi) const;\n    };\n\n  template<typename _CharT>\n    locale::id collate<_CharT>::id;\n\n  // Specializations.\n  template<>\n    int\n    collate<char>::_M_compare(const char*, const char*) const;\n\n  template<>\n    size_t\n    collate<char>::_M_transform(char*, const char*, size_t) const;\n\n#ifdef _GLIBCXX_USE_WCHAR_T\n  template<>\n    int\n    collate<wchar_t>::_M_compare(const wchar_t*, const wchar_t*) const;\n\n  template<>\n    size_t\n    collate<wchar_t>::_M_transform(wchar_t*, const wchar_t*, size_t) const;\n#endif\n\n  /// @brief  class collate_byname [22.2.4.2].\n  template<typename _CharT>\n    class collate_byname : public collate<_CharT>\n    {\n    public:\n      //@{\n      /// Public typedefs\n      typedef _CharT               char_type;\n      typedef basic_string<_CharT> string_type;\n      //@}\n\n      explicit\n      collate_byname(const char* __s, size_t __refs = 0)\n      : collate<_CharT>(__refs)\n      {\n\tif (std::strcmp(__s, \"C\") != 0 && std::strcmp(__s, \"POSIX\") != 0)\n\t  {\n\t    this->_S_destroy_c_locale(this->_M_c_locale_collate);\n\t    this->_S_create_c_locale(this->_M_c_locale_collate, __s);\n\t  }\n      }\n\n    protected:\n      virtual\n      ~collate_byname() { }\n    };\n\n\n  /**\n   *  @brief  Time format ordering data.\n   *\n   *  This class provides an enum representing different orderings of day,\n   *  month, and year.\n  */\n  class time_base\n  {\n  public:\n    enum dateorder { no_order, dmy, mdy, ymd, ydm };\n  };\n\n  template<typename _CharT>\n    struct __timepunct_cache : public locale::facet\n    {\n      // List of all known timezones, with GMT first.\n      static const _CharT*\t\t_S_timezones[14];\n\n      const _CharT*\t\t\t_M_date_format;\n      const _CharT*\t\t\t_M_date_era_format;\n      const _CharT*\t\t\t_M_time_format;\n      const _CharT*\t\t\t_M_time_era_format;\n      const _CharT*\t\t\t_M_date_time_format;\n      const _CharT*\t\t\t_M_date_time_era_format;\n      const _CharT*\t\t\t_M_am;\n      const _CharT*\t\t\t_M_pm;\n      const _CharT*\t\t\t_M_am_pm_format;\n\n      // Day names, starting with \"C\"'s Sunday.\n      const _CharT*\t\t\t_M_day1;\n      const _CharT*\t\t\t_M_day2;\n      const _CharT*\t\t\t_M_day3;\n      const _CharT*\t\t\t_M_day4;\n      const _CharT*\t\t\t_M_day5;\n      const _CharT*\t\t\t_M_day6;\n      const _CharT*\t\t\t_M_day7;\n\n      // Abbreviated day names, starting with \"C\"'s Sun.\n      const _CharT*\t\t\t_M_aday1;\n      const _CharT*\t\t\t_M_aday2;\n      const _CharT*\t\t\t_M_aday3;\n      const _CharT*\t\t\t_M_aday4;\n      const _CharT*\t\t\t_M_aday5;\n      const _CharT*\t\t\t_M_aday6;\n      const _CharT*\t\t\t_M_aday7;\n\n      // Month names, starting with \"C\"'s January.\n      const _CharT*\t\t\t_M_month01;\n      const _CharT*\t\t\t_M_month02;\n      const _CharT*\t\t\t_M_month03;\n      const _CharT*\t\t\t_M_month04;\n      const _CharT*\t\t\t_M_month05;\n      const _CharT*\t\t\t_M_month06;\n      const _CharT*\t\t\t_M_month07;\n      const _CharT*\t\t\t_M_month08;\n      const _CharT*\t\t\t_M_month09;\n      const _CharT*\t\t\t_M_month10;\n      const _CharT*\t\t\t_M_month11;\n      const _CharT*\t\t\t_M_month12;\n\n      // Abbreviated month names, starting with \"C\"'s Jan.\n      const _CharT*\t\t\t_M_amonth01;\n      const _CharT*\t\t\t_M_amonth02;\n      const _CharT*\t\t\t_M_amonth03;\n      const _CharT*\t\t\t_M_amonth04;\n      const _CharT*\t\t\t_M_amonth05;\n      const _CharT*\t\t\t_M_amonth06;\n      const _CharT*\t\t\t_M_amonth07;\n      const _CharT*\t\t\t_M_amonth08;\n      const _CharT*\t\t\t_M_amonth09;\n      const _CharT*\t\t\t_M_amonth10;\n      const _CharT*\t\t\t_M_amonth11;\n      const _CharT*\t\t\t_M_amonth12;\n\n      bool\t\t\t\t_M_allocated;\n\n      __timepunct_cache(size_t __refs = 0) : facet(__refs),\n      _M_date_format(NULL), _M_date_era_format(NULL), _M_time_format(NULL),\n      _M_time_era_format(NULL), _M_date_time_format(NULL),\n      _M_date_time_era_format(NULL), _M_am(NULL), _M_pm(NULL),\n      _M_am_pm_format(NULL), _M_day1(NULL), _M_day2(NULL), _M_day3(NULL),\n      _M_day4(NULL), _M_day5(NULL), _M_day6(NULL), _M_day7(NULL),\n      _M_aday1(NULL), _M_aday2(NULL), _M_aday3(NULL), _M_aday4(NULL),\n      _M_aday5(NULL), _M_aday6(NULL), _M_aday7(NULL), _M_month01(NULL),\n      _M_month02(NULL), _M_month03(NULL), _M_month04(NULL), _M_month05(NULL),\n      _M_month06(NULL), _M_month07(NULL), _M_month08(NULL), _M_month09(NULL),\n      _M_month10(NULL), _M_month11(NULL), _M_month12(NULL), _M_amonth01(NULL),\n      _M_amonth02(NULL), _M_amonth03(NULL), _M_amonth04(NULL),\n      _M_amonth05(NULL), _M_amonth06(NULL), _M_amonth07(NULL),\n      _M_amonth08(NULL), _M_amonth09(NULL), _M_amonth10(NULL),\n      _M_amonth11(NULL), _M_amonth12(NULL), _M_allocated(false)\n      { }\n\n      ~__timepunct_cache();\n\n      void\n      _M_cache(const locale& __loc);\n\n    private:\n      __timepunct_cache&\n      operator=(const __timepunct_cache&);\n      \n      explicit\n      __timepunct_cache(const __timepunct_cache&);\n    };\n\n  template<typename _CharT>\n    __timepunct_cache<_CharT>::~__timepunct_cache()\n    {\n      if (_M_allocated)\n\t{\n\t  // Unused.\n\t}\n    }\n\n  // Specializations.\n  template<>\n    const char*\n    __timepunct_cache<char>::_S_timezones[14];\n\n#ifdef _GLIBCXX_USE_WCHAR_T\n  template<>\n    const wchar_t*\n    __timepunct_cache<wchar_t>::_S_timezones[14];\n#endif\n\n  // Generic.\n  template<typename _CharT>\n    const _CharT* __timepunct_cache<_CharT>::_S_timezones[14];\n\n  template<typename _CharT>\n    class __timepunct : public locale::facet\n    {\n    public:\n      // Types:\n      typedef _CharT\t\t\t__char_type;\n      typedef basic_string<_CharT>\t__string_type;\n      typedef __timepunct_cache<_CharT>\t__cache_type;\n\n    protected:\n      __cache_type*\t\t\t_M_data;\n      __c_locale\t\t\t_M_c_locale_timepunct;\n      const char*\t\t\t_M_name_timepunct;\n\n    public:\n      /// Numpunct facet id.\n      static locale::id\t\t\tid;\n\n      explicit\n      __timepunct(size_t __refs = 0);\n\n      explicit\n      __timepunct(__cache_type* __cache, size_t __refs = 0);\n\n      /**\n       *  @brief  Internal constructor. Not for general use.\n       *\n       *  This is a constructor for use by the library itself to set up new\n       *  locales.\n       *\n       *  @param cloc  The \"C\" locale.\n       *  @param s  The name of a locale.\n       *  @param refs  Passed to the base facet class.\n      */\n      explicit\n      __timepunct(__c_locale __cloc, const char* __s, size_t __refs = 0);\n\n      // FIXME: for error checking purposes _M_put should return the return\n      // value of strftime/wcsftime.\n      void\n      _M_put(_CharT* __s, size_t __maxlen, const _CharT* __format,\n\t     const tm* __tm) const;\n\n      void\n      _M_date_formats(const _CharT** __date) const\n      {\n\t// Always have default first.\n\t__date[0] = _M_data->_M_date_format;\n\t__date[1] = _M_data->_M_date_era_format;\n      }\n\n      void\n      _M_time_formats(const _CharT** __time) const\n      {\n\t// Always have default first.\n\t__time[0] = _M_data->_M_time_format;\n\t__time[1] = _M_data->_M_time_era_format;\n      }\n\n      void\n      _M_date_time_formats(const _CharT** __dt) const\n      {\n\t// Always have default first.\n\t__dt[0] = _M_data->_M_date_time_format;\n\t__dt[1] = _M_data->_M_date_time_era_format;\n      }\n\n      void\n      _M_am_pm_format(const _CharT* __ampm) const\n      { __ampm = _M_data->_M_am_pm_format; }\n\n      void\n      _M_am_pm(const _CharT** __ampm) const\n      {\n\t__ampm[0] = _M_data->_M_am;\n\t__ampm[1] = _M_data->_M_pm;\n      }\n\n      void\n      _M_days(const _CharT** __days) const\n      {\n\t__days[0] = _M_data->_M_day1;\n\t__days[1] = _M_data->_M_day2;\n\t__days[2] = _M_data->_M_day3;\n\t__days[3] = _M_data->_M_day4;\n\t__days[4] = _M_data->_M_day5;\n\t__days[5] = _M_data->_M_day6;\n\t__days[6] = _M_data->_M_day7;\n      }\n\n      void\n      _M_days_abbreviated(const _CharT** __days) const\n      {\n\t__days[0] = _M_data->_M_aday1;\n\t__days[1] = _M_data->_M_aday2;\n\t__days[2] = _M_data->_M_aday3;\n\t__days[3] = _M_data->_M_aday4;\n\t__days[4] = _M_data->_M_aday5;\n\t__days[5] = _M_data->_M_aday6;\n\t__days[6] = _M_data->_M_aday7;\n      }\n\n      void\n      _M_months(const _CharT** __months) const\n      {\n\t__months[0] = _M_data->_M_month01;\n\t__months[1] = _M_data->_M_month02;\n\t__months[2] = _M_data->_M_month03;\n\t__months[3] = _M_data->_M_month04;\n\t__months[4] = _M_data->_M_month05;\n\t__months[5] = _M_data->_M_month06;\n\t__months[6] = _M_data->_M_month07;\n\t__months[7] = _M_data->_M_month08;\n\t__months[8] = _M_data->_M_month09;\n\t__months[9] = _M_data->_M_month10;\n\t__months[10] = _M_data->_M_month11;\n\t__months[11] = _M_data->_M_month12;\n      }\n\n      void\n      _M_months_abbreviated(const _CharT** __months) const\n      {\n\t__months[0] = _M_data->_M_amonth01;\n\t__months[1] = _M_data->_M_amonth02;\n\t__months[2] = _M_data->_M_amonth03;\n\t__months[3] = _M_data->_M_amonth04;\n\t__months[4] = _M_data->_M_amonth05;\n\t__months[5] = _M_data->_M_amonth06;\n\t__months[6] = _M_data->_M_amonth07;\n\t__months[7] = _M_data->_M_amonth08;\n\t__months[8] = _M_data->_M_amonth09;\n\t__months[9] = _M_data->_M_amonth10;\n\t__months[10] = _M_data->_M_amonth11;\n\t__months[11] = _M_data->_M_amonth12;\n      }\n\n    protected:\n      virtual\n      ~__timepunct();\n\n      // For use at construction time only.\n      void\n      _M_initialize_timepunct(__c_locale __cloc = NULL);\n    };\n\n  template<typename _CharT>\n    locale::id __timepunct<_CharT>::id;\n\n  // Specializations.\n  template<>\n    void\n    __timepunct<char>::_M_initialize_timepunct(__c_locale __cloc);\n\n  template<>\n    void\n    __timepunct<char>::_M_put(char*, size_t, const char*, const tm*) const;\n\n#ifdef _GLIBCXX_USE_WCHAR_T\n  template<>\n    void\n    __timepunct<wchar_t>::_M_initialize_timepunct(__c_locale __cloc);\n\n  template<>\n    void\n    __timepunct<wchar_t>::_M_put(wchar_t*, size_t, const wchar_t*,\n\t\t\t\t const tm*) const;\n#endif\n\n_GLIBCXX_END_NAMESPACE\n\n  // Include host and configuration specific timepunct functions.\n  #include <bits/time_members.h>\n\n_GLIBCXX_BEGIN_NAMESPACE(std)\n\n  /**\n   *  @brief  Facet for parsing dates and times.\n   *\n   *  This facet encapsulates the code to parse and return a date or\n   *  time from a string.  It is used by the istream numeric\n   *  extraction operators.\n   *\n   *  The time_get template uses protected virtual functions to provide the\n   *  actual results.  The public accessors forward the call to the virtual\n   *  functions.  These virtual functions are hooks for developers to\n   *  implement the behavior they require from the time_get facet.\n  */\n  template<typename _CharT, typename _InIter>\n    class time_get : public locale::facet, public time_base\n    {\n    public:\n      // Types:\n      //@{\n      /// Public typedefs\n      typedef _CharT\t\t\tchar_type;\n      typedef _InIter\t\t\titer_type;\n      //@}\n      typedef basic_string<_CharT>\t__string_type;\n\n      /// Numpunct facet id.\n      static locale::id\t\t\tid;\n\n      /**\n       *  @brief  Constructor performs initialization.\n       *\n       *  This is the constructor provided by the standard.\n       *\n       *  @param refs  Passed to the base facet class.\n      */\n      explicit\n      time_get(size_t __refs = 0)\n      : facet (__refs) { }\n\n      /**\n       *  @brief  Return preferred order of month, day, and year.\n       *\n       *  This function returns an enum from timebase::dateorder giving the\n       *  preferred ordering if the format \"x\" given to time_put::put() only\n       *  uses month, day, and year.  If the format \"x\" for the associated\n       *  locale uses other fields, this function returns\n       *  timebase::dateorder::noorder.\n       *\n       *  NOTE: The library always returns noorder at the moment.\n       *\n       *  @return  A member of timebase::dateorder.\n      */\n      dateorder\n      date_order()  const\n      { return this->do_date_order(); }\n\n      /**\n       *  @brief  Parse input time string.\n       *\n       *  This function parses a time according to the format \"x\" and puts the\n       *  results into a user-supplied struct tm.  The result is returned by\n       *  calling time_get::do_get_time().\n       *\n       *  If there is a valid time string according to format \"x\", @a tm will\n       *  be filled in accordingly and the returned iterator will point to the\n       *  first character beyond the time string.  If an error occurs before\n       *  the end, err |= ios_base::failbit.  If parsing reads all the\n       *  characters, err |= ios_base::eofbit.\n       *\n       *  @param  beg  Start of string to parse.\n       *  @param  end  End of string to parse.\n       *  @param  io  Source of the locale.\n       *  @param  err  Error flags to set.\n       *  @param  tm  Pointer to struct tm to fill in.\n       *  @return  Iterator to first char beyond time string.\n      */\n      iter_type\n      get_time(iter_type __beg, iter_type __end, ios_base& __io,\n\t       ios_base::iostate& __err, tm* __tm)  const\n      { return this->do_get_time(__beg, __end, __io, __err, __tm); }\n\n      /**\n       *  @brief  Parse input date string.\n       *\n       *  This function parses a date according to the format \"X\" and puts the\n       *  results into a user-supplied struct tm.  The result is returned by\n       *  calling time_get::do_get_date().\n       *\n       *  If there is a valid date string according to format \"X\", @a tm will\n       *  be filled in accordingly and the returned iterator will point to the\n       *  first character beyond the date string.  If an error occurs before\n       *  the end, err |= ios_base::failbit.  If parsing reads all the\n       *  characters, err |= ios_base::eofbit.\n       *\n       *  @param  beg  Start of string to parse.\n       *  @param  end  End of string to parse.\n       *  @param  io  Source of the locale.\n       *  @param  err  Error flags to set.\n       *  @param  tm  Pointer to struct tm to fill in.\n       *  @return  Iterator to first char beyond date string.\n      */\n      iter_type\n      get_date(iter_type __beg, iter_type __end, ios_base& __io,\n\t       ios_base::iostate& __err, tm* __tm)  const\n      { return this->do_get_date(__beg, __end, __io, __err, __tm); }\n\n      /**\n       *  @brief  Parse input weekday string.\n       *\n       *  This function parses a weekday name and puts the results into a\n       *  user-supplied struct tm.  The result is returned by calling\n       *  time_get::do_get_weekday().\n       *\n       *  Parsing starts by parsing an abbreviated weekday name.  If a valid\n       *  abbreviation is followed by a character that would lead to the full\n       *  weekday name, parsing continues until the full name is found or an\n       *  error occurs.  Otherwise parsing finishes at the end of the\n       *  abbreviated name.\n       *\n       *  If an error occurs before the end, err |= ios_base::failbit.  If\n       *  parsing reads all the characters, err |= ios_base::eofbit.\n       *\n       *  @param  beg  Start of string to parse.\n       *  @param  end  End of string to parse.\n       *  @param  io  Source of the locale.\n       *  @param  err  Error flags to set.\n       *  @param  tm  Pointer to struct tm to fill in.\n       *  @return  Iterator to first char beyond weekday name.\n      */\n      iter_type\n      get_weekday(iter_type __beg, iter_type __end, ios_base& __io,\n\t\t  ios_base::iostate& __err, tm* __tm) const\n      { return this->do_get_weekday(__beg, __end, __io, __err, __tm); }\n\n      /**\n       *  @brief  Parse input month string.\n       *\n       *  This function parses a month name and puts the results into a\n       *  user-supplied struct tm.  The result is returned by calling\n       *  time_get::do_get_monthname().\n       *\n       *  Parsing starts by parsing an abbreviated month name.  If a valid\n       *  abbreviation is followed by a character that would lead to the full\n       *  month name, parsing continues until the full name is found or an\n       *  error occurs.  Otherwise parsing finishes at the end of the\n       *  abbreviated name.\n       *\n       *  If an error occurs before the end, err |= ios_base::failbit.  If\n       *  parsing reads all the characters, err |=\n       *  ios_base::eofbit.\n       *\n       *  @param  beg  Start of string to parse.\n       *  @param  end  End of string to parse.\n       *  @param  io  Source of the locale.\n       *  @param  err  Error flags to set.\n       *  @param  tm  Pointer to struct tm to fill in.\n       *  @return  Iterator to first char beyond month name.\n      */\n      iter_type\n      get_monthname(iter_type __beg, iter_type __end, ios_base& __io,\n\t\t    ios_base::iostate& __err, tm* __tm) const\n      { return this->do_get_monthname(__beg, __end, __io, __err, __tm); }\n\n      /**\n       *  @brief  Parse input year string.\n       *\n       *  This function reads up to 4 characters to parse a year string and\n       *  puts the results into a user-supplied struct tm.  The result is\n       *  returned by calling time_get::do_get_year().\n       *\n       *  4 consecutive digits are interpreted as a full year.  If there are\n       *  exactly 2 consecutive digits, the library interprets this as the\n       *  number of years since 1900.\n       *\n       *  If an error occurs before the end, err |= ios_base::failbit.  If\n       *  parsing reads all the characters, err |= ios_base::eofbit.\n       *\n       *  @param  beg  Start of string to parse.\n       *  @param  end  End of string to parse.\n       *  @param  io  Source of the locale.\n       *  @param  err  Error flags to set.\n       *  @param  tm  Pointer to struct tm to fill in.\n       *  @return  Iterator to first char beyond year.\n      */\n      iter_type\n      get_year(iter_type __beg, iter_type __end, ios_base& __io,\n\t       ios_base::iostate& __err, tm* __tm) const\n      { return this->do_get_year(__beg, __end, __io, __err, __tm); }\n\n    protected:\n      /// Destructor.\n      virtual\n      ~time_get() { }\n\n      /**\n       *  @brief  Return preferred order of month, day, and year.\n       *\n       *  This function returns an enum from timebase::dateorder giving the\n       *  preferred ordering if the format \"x\" given to time_put::put() only\n       *  uses month, day, and year.  This function is a hook for derived\n       *  classes to change the value returned.\n       *\n       *  @return  A member of timebase::dateorder.\n      */\n      virtual dateorder\n      do_date_order() const;\n\n      /**\n       *  @brief  Parse input time string.\n       *\n       *  This function parses a time according to the format \"x\" and puts the\n       *  results into a user-supplied struct tm.  This function is a hook for\n       *  derived classes to change the value returned.  @see get_time() for\n       *  details.\n       *\n       *  @param  beg  Start of string to parse.\n       *  @param  end  End of string to parse.\n       *  @param  io  Source of the locale.\n       *  @param  err  Error flags to set.\n       *  @param  tm  Pointer to struct tm to fill in.\n       *  @return  Iterator to first char beyond time string.\n      */\n      virtual iter_type\n      do_get_time(iter_type __beg, iter_type __end, ios_base& __io,\n\t\t  ios_base::iostate& __err, tm* __tm) const;\n\n      /**\n       *  @brief  Parse input date string.\n       *\n       *  This function parses a date according to the format \"X\" and puts the\n       *  results into a user-supplied struct tm.  This function is a hook for\n       *  derived classes to change the value returned.  @see get_date() for\n       *  details.\n       *\n       *  @param  beg  Start of string to parse.\n       *  @param  end  End of string to parse.\n       *  @param  io  Source of the locale.\n       *  @param  err  Error flags to set.\n       *  @param  tm  Pointer to struct tm to fill in.\n       *  @return  Iterator to first char beyond date string.\n      */\n      virtual iter_type\n      do_get_date(iter_type __beg, iter_type __end, ios_base& __io,\n\t\t  ios_base::iostate& __err, tm* __tm) const;\n\n      /**\n       *  @brief  Parse input weekday string.\n       *\n       *  This function parses a weekday name and puts the results into a\n       *  user-supplied struct tm.  This function is a hook for derived\n       *  classes to change the value returned.  @see get_weekday() for\n       *  details.\n       *\n       *  @param  beg  Start of string to parse.\n       *  @param  end  End of string to parse.\n       *  @param  io  Source of the locale.\n       *  @param  err  Error flags to set.\n       *  @param  tm  Pointer to struct tm to fill in.\n       *  @return  Iterator to first char beyond weekday name.\n      */\n      virtual iter_type\n      do_get_weekday(iter_type __beg, iter_type __end, ios_base&,\n\t\t     ios_base::iostate& __err, tm* __tm) const;\n\n      /**\n       *  @brief  Parse input month string.\n       *\n       *  This function parses a month name and puts the results into a\n       *  user-supplied struct tm.  This function is a hook for derived\n       *  classes to change the value returned.  @see get_monthname() for\n       *  details.\n       *\n       *  @param  beg  Start of string to parse.\n       *  @param  end  End of string to parse.\n       *  @param  io  Source of the locale.\n       *  @param  err  Error flags to set.\n       *  @param  tm  Pointer to struct tm to fill in.\n       *  @return  Iterator to first char beyond month name.\n      */\n      virtual iter_type\n      do_get_monthname(iter_type __beg, iter_type __end, ios_base&,\n\t\t       ios_base::iostate& __err, tm* __tm) const;\n\n      /**\n       *  @brief  Parse input year string.\n       *\n       *  This function reads up to 4 characters to parse a year string and\n       *  puts the results into a user-supplied struct tm.  This function is a\n       *  hook for derived classes to change the value returned.  @see\n       *  get_year() for details.\n       *\n       *  @param  beg  Start of string to parse.\n       *  @param  end  End of string to parse.\n       *  @param  io  Source of the locale.\n       *  @param  err  Error flags to set.\n       *  @param  tm  Pointer to struct tm to fill in.\n       *  @return  Iterator to first char beyond year.\n      */\n      virtual iter_type\n      do_get_year(iter_type __beg, iter_type __end, ios_base& __io,\n\t\t  ios_base::iostate& __err, tm* __tm) const;\n\n      // Extract numeric component of length __len.\n      iter_type\n      _M_extract_num(iter_type __beg, iter_type __end, int& __member,\n\t\t     int __min, int __max, size_t __len,\n\t\t     ios_base& __io, ios_base::iostate& __err) const;\n\n      // Extract day or month name, or any unique array of string\n      // literals in a const _CharT* array.\n      iter_type\n      _M_extract_name(iter_type __beg, iter_type __end, int& __member,\n\t\t      const _CharT** __names, size_t __indexlen,\n\t\t      ios_base& __io, ios_base::iostate& __err) const;\n\n      // Extract on a component-by-component basis, via __format argument.\n      iter_type\n      _M_extract_via_format(iter_type __beg, iter_type __end, ios_base& __io,\n\t\t\t    ios_base::iostate& __err, tm* __tm,\n\t\t\t    const _CharT* __format) const;\n    };\n\n  template<typename _CharT, typename _InIter>\n    locale::id time_get<_CharT, _InIter>::id;\n\n  /// @brief  class time_get_byname [22.2.5.2].\n  template<typename _CharT, typename _InIter>\n    class time_get_byname : public time_get<_CharT, _InIter>\n    {\n    public:\n      // Types:\n      typedef _CharT\t\t\tchar_type;\n      typedef _InIter\t\t\titer_type;\n\n      explicit\n      time_get_byname(const char*, size_t __refs = 0)\n      : time_get<_CharT, _InIter>(__refs) { }\n\n    protected:\n      virtual\n      ~time_get_byname() { }\n    };\n\n  /**\n   *  @brief  Facet for outputting dates and times.\n   *\n   *  This facet encapsulates the code to format and output dates and times\n   *  according to formats used by strftime().\n   *\n   *  The time_put template uses protected virtual functions to provide the\n   *  actual results.  The public accessors forward the call to the virtual\n   *  functions.  These virtual functions are hooks for developers to\n   *  implement the behavior they require from the time_put facet.\n  */\n  template<typename _CharT, typename _OutIter>\n    class time_put : public locale::facet\n    {\n    public:\n      // Types:\n      //@{\n      /// Public typedefs\n      typedef _CharT\t\t\tchar_type;\n      typedef _OutIter\t\t\titer_type;\n      //@}\n\n      /// Numpunct facet id.\n      static locale::id\t\t\tid;\n\n      /**\n       *  @brief  Constructor performs initialization.\n       *\n       *  This is the constructor provided by the standard.\n       *\n       *  @param refs  Passed to the base facet class.\n      */\n      explicit\n      time_put(size_t __refs = 0)\n      : facet(__refs) { }\n\n      /**\n       *  @brief  Format and output a time or date.\n       *\n       *  This function formats the data in struct tm according to the\n       *  provided format string.  The format string is interpreted as by\n       *  strftime().\n       *\n       *  @param  s  The stream to write to.\n       *  @param  io  Source of locale.\n       *  @param  fill  char_type to use for padding.\n       *  @param  tm  Struct tm with date and time info to format.\n       *  @param  beg  Start of format string.\n       *  @param  end  End of format string.\n       *  @return  Iterator after writing.\n       */\n      iter_type\n      put(iter_type __s, ios_base& __io, char_type __fill, const tm* __tm,\n\t  const _CharT* __beg, const _CharT* __end) const;\n\n      /**\n       *  @brief  Format and output a time or date.\n       *\n       *  This function formats the data in struct tm according to the\n       *  provided format char and optional modifier.  The format and modifier\n       *  are interpreted as by strftime().  It does so by returning\n       *  time_put::do_put().\n       *\n       *  @param  s  The stream to write to.\n       *  @param  io  Source of locale.\n       *  @param  fill  char_type to use for padding.\n       *  @param  tm  Struct tm with date and time info to format.\n       *  @param  format  Format char.\n       *  @param  mod  Optional modifier char.\n       *  @return  Iterator after writing.\n       */\n      iter_type\n      put(iter_type __s, ios_base& __io, char_type __fill,\n\t  const tm* __tm, char __format, char __mod = 0) const\n      { return this->do_put(__s, __io, __fill, __tm, __format, __mod); }\n\n    protected:\n      /// Destructor.\n      virtual\n      ~time_put()\n      { }\n\n      /**\n       *  @brief  Format and output a time or date.\n       *\n       *  This function formats the data in struct tm according to the\n       *  provided format char and optional modifier.  This function is a hook\n       *  for derived classes to change the value returned.  @see put() for\n       *  more details.\n       *\n       *  @param  s  The stream to write to.\n       *  @param  io  Source of locale.\n       *  @param  fill  char_type to use for padding.\n       *  @param  tm  Struct tm with date and time info to format.\n       *  @param  format  Format char.\n       *  @param  mod  Optional modifier char.\n       *  @return  Iterator after writing.\n       */\n      virtual iter_type\n      do_put(iter_type __s, ios_base& __io, char_type __fill, const tm* __tm,\n\t     char __format, char __mod) const;\n    };\n\n  template<typename _CharT, typename _OutIter>\n    locale::id time_put<_CharT, _OutIter>::id;\n\n  /// @brief  class time_put_byname [22.2.5.4].\n  template<typename _CharT, typename _OutIter>\n    class time_put_byname : public time_put<_CharT, _OutIter>\n    {\n    public:\n      // Types:\n      typedef _CharT\t\t\tchar_type;\n      typedef _OutIter\t\t\titer_type;\n\n      explicit\n      time_put_byname(const char*, size_t __refs = 0)\n      : time_put<_CharT, _OutIter>(__refs)\n      { };\n\n    protected:\n      virtual\n      ~time_put_byname() { }\n    };\n\n\n  /**\n   *  @brief  Money format ordering data.\n   *\n   *  This class contains an ordered array of 4 fields to represent the\n   *  pattern for formatting a money amount.  Each field may contain one entry\n   *  from the part enum.  symbol, sign, and value must be present and the\n   *  remaining field must contain either none or space.  @see\n   *  moneypunct::pos_format() and moneypunct::neg_format() for details of how\n   *  these fields are interpreted.\n  */\n  class money_base\n  {\n  public:\n    enum part { none, space, symbol, sign, value };\n    struct pattern { char field[4]; };\n\n    static const pattern _S_default_pattern;\n\n    enum\n    {\n      _S_minus,\n      _S_zero,\n      _S_end = 11\n    };\n\n    // String literal of acceptable (narrow) input/output, for\n    // money_get/money_put. \"-0123456789\"\n    static const char* _S_atoms;\n\n    // Construct and return valid pattern consisting of some combination of:\n    // space none symbol sign value\n    static pattern\n    _S_construct_pattern(char __precedes, char __space, char __posn);\n  };\n\n  template<typename _CharT, bool _Intl>\n    struct __moneypunct_cache : public locale::facet\n    {\n      const char*\t\t\t_M_grouping;\n      size_t                            _M_grouping_size;\n      bool\t\t\t\t_M_use_grouping;\n      _CharT\t\t\t\t_M_decimal_point;\n      _CharT\t\t\t\t_M_thousands_sep;\n      const _CharT*\t\t\t_M_curr_symbol;\n      size_t                            _M_curr_symbol_size;\n      const _CharT*\t\t\t_M_positive_sign;\n      size_t                            _M_positive_sign_size;\n      const _CharT*\t\t\t_M_negative_sign;\n      size_t                            _M_negative_sign_size;\n      int\t\t\t\t_M_frac_digits;\n      money_base::pattern\t\t_M_pos_format;\n      money_base::pattern\t        _M_neg_format;\n\n      // A list of valid numeric literals for input and output: in the standard\n      // \"C\" locale, this is \"-0123456789\". This array contains the chars after\n      // having been passed through the current locale's ctype<_CharT>.widen().\n      _CharT\t\t\t\t_M_atoms[money_base::_S_end];\n\n      bool\t\t\t\t_M_allocated;\n\n      __moneypunct_cache(size_t __refs = 0) : facet(__refs),\n      _M_grouping(NULL), _M_grouping_size(0), _M_use_grouping(false),\n      _M_decimal_point(_CharT()), _M_thousands_sep(_CharT()),\n      _M_curr_symbol(NULL), _M_curr_symbol_size(0),\n      _M_positive_sign(NULL), _M_positive_sign_size(0),\n      _M_negative_sign(NULL), _M_negative_sign_size(0),\n      _M_frac_digits(0),\n      _M_pos_format(money_base::pattern()),\n      _M_neg_format(money_base::pattern()), _M_allocated(false)\n      { }\n\n      ~__moneypunct_cache();\n\n      void\n      _M_cache(const locale& __loc);\n\n    private:\n      __moneypunct_cache&\n      operator=(const __moneypunct_cache&);\n      \n      explicit\n      __moneypunct_cache(const __moneypunct_cache&);\n    };\n\n  template<typename _CharT, bool _Intl>\n    __moneypunct_cache<_CharT, _Intl>::~__moneypunct_cache()\n    {\n      if (_M_allocated)\n\t{\n\t  delete [] _M_grouping;\n\t  delete [] _M_curr_symbol;\n\t  delete [] _M_positive_sign;\n\t  delete [] _M_negative_sign;\n\t}\n    }\n\n  /**\n   *  @brief  Facet for formatting data for money amounts.\n   *\n   *  This facet encapsulates the punctuation, grouping and other formatting\n   *  features of money amount string representations.\n  */\n  template<typename _CharT, bool _Intl>\n    class moneypunct : public locale::facet, public money_base\n    {\n    public:\n      // Types:\n      //@{\n      /// Public typedefs\n      typedef _CharT\t\t\tchar_type;\n      typedef basic_string<_CharT>\tstring_type;\n      //@}\n      typedef __moneypunct_cache<_CharT, _Intl>     __cache_type;\n\n    private:\n      __cache_type*\t\t\t_M_data;\n\n    public:\n      /// This value is provided by the standard, but no reason for its\n      /// existence.\n      static const bool\t\t\tintl = _Intl;\n      /// Numpunct facet id.\n      static locale::id\t\t\tid;\n\n      /**\n       *  @brief  Constructor performs initialization.\n       *\n       *  This is the constructor provided by the standard.\n       *\n       *  @param refs  Passed to the base facet class.\n      */\n      explicit\n      moneypunct(size_t __refs = 0) : facet(__refs), _M_data(NULL)\n      { _M_initialize_moneypunct(); }\n\n      /**\n       *  @brief  Constructor performs initialization.\n       *\n       *  This is an internal constructor.\n       *\n       *  @param cache  Cache for optimization.\n       *  @param refs  Passed to the base facet class.\n      */\n      explicit\n      moneypunct(__cache_type* __cache, size_t __refs = 0)\n      : facet(__refs), _M_data(__cache)\n      { _M_initialize_moneypunct(); }\n\n      /**\n       *  @brief  Internal constructor. Not for general use.\n       *\n       *  This is a constructor for use by the library itself to set up new\n       *  locales.\n       *\n       *  @param cloc  The \"C\" locale.\n       *  @param s  The name of a locale.\n       *  @param refs  Passed to the base facet class.\n      */\n      explicit\n      moneypunct(__c_locale __cloc, const char* __s, size_t __refs = 0)\n      : facet(__refs), _M_data(NULL)\n      { _M_initialize_moneypunct(__cloc, __s); }\n\n      /**\n       *  @brief  Return decimal point character.\n       *\n       *  This function returns a char_type to use as a decimal point.  It\n       *  does so by returning returning\n       *  moneypunct<char_type>::do_decimal_point().\n       *\n       *  @return  @a char_type representing a decimal point.\n      */\n      char_type\n      decimal_point() const\n      { return this->do_decimal_point(); }\n\n      /**\n       *  @brief  Return thousands separator character.\n       *\n       *  This function returns a char_type to use as a thousands\n       *  separator.  It does so by returning returning\n       *  moneypunct<char_type>::do_thousands_sep().\n       *\n       *  @return  char_type representing a thousands separator.\n      */\n      char_type\n      thousands_sep() const\n      { return this->do_thousands_sep(); }\n\n      /**\n       *  @brief  Return grouping specification.\n       *\n       *  This function returns a string representing groupings for the\n       *  integer part of an amount.  Groupings indicate where thousands\n       *  separators should be inserted.\n       *\n       *  Each char in the return string is interpret as an integer rather\n       *  than a character.  These numbers represent the number of digits in a\n       *  group.  The first char in the string represents the number of digits\n       *  in the least significant group.  If a char is negative, it indicates\n       *  an unlimited number of digits for the group.  If more chars from the\n       *  string are required to group a number, the last char is used\n       *  repeatedly.\n       *\n       *  For example, if the grouping() returns \"\\003\\002\" and is applied to\n       *  the number 123456789, this corresponds to 12,34,56,789.  Note that\n       *  if the string was \"32\", this would put more than 50 digits into the\n       *  least significant group if the character set is ASCII.\n       *\n       *  The string is returned by calling\n       *  moneypunct<char_type>::do_grouping().\n       *\n       *  @return  string representing grouping specification.\n      */\n      string\n      grouping() const\n      { return this->do_grouping(); }\n\n      /**\n       *  @brief  Return currency symbol string.\n       *\n       *  This function returns a string_type to use as a currency symbol.  It\n       *  does so by returning returning\n       *  moneypunct<char_type>::do_curr_symbol().\n       *\n       *  @return  @a string_type representing a currency symbol.\n      */\n      string_type\n      curr_symbol() const\n      { return this->do_curr_symbol(); }\n\n      /**\n       *  @brief  Return positive sign string.\n       *\n       *  This function returns a string_type to use as a sign for positive\n       *  amounts.  It does so by returning returning\n       *  moneypunct<char_type>::do_positive_sign().\n       *\n       *  If the return value contains more than one character, the first\n       *  character appears in the position indicated by pos_format() and the\n       *  remainder appear at the end of the formatted string.\n       *\n       *  @return  @a string_type representing a positive sign.\n      */\n      string_type\n      positive_sign() const\n      { return this->do_positive_sign(); }\n\n      /**\n       *  @brief  Return negative sign string.\n       *\n       *  This function returns a string_type to use as a sign for negative\n       *  amounts.  It does so by returning returning\n       *  moneypunct<char_type>::do_negative_sign().\n       *\n       *  If the return value contains more than one character, the first\n       *  character appears in the position indicated by neg_format() and the\n       *  remainder appear at the end of the formatted string.\n       *\n       *  @return  @a string_type representing a negative sign.\n      */\n      string_type\n      negative_sign() const\n      { return this->do_negative_sign(); }\n\n      /**\n       *  @brief  Return number of digits in fraction.\n       *\n       *  This function returns the exact number of digits that make up the\n       *  fractional part of a money amount.  It does so by returning\n       *  returning moneypunct<char_type>::do_frac_digits().\n       *\n       *  The fractional part of a money amount is optional.  But if it is\n       *  present, there must be frac_digits() digits.\n       *\n       *  @return  Number of digits in amount fraction.\n      */\n      int\n      frac_digits() const\n      { return this->do_frac_digits(); }\n\n      //@{\n      /**\n       *  @brief  Return pattern for money values.\n       *\n       *  This function returns a pattern describing the formatting of a\n       *  positive or negative valued money amount.  It does so by returning\n       *  returning moneypunct<char_type>::do_pos_format() or\n       *  moneypunct<char_type>::do_neg_format().\n       *\n       *  The pattern has 4 fields describing the ordering of symbol, sign,\n       *  value, and none or space.  There must be one of each in the pattern.\n       *  The none and space enums may not appear in the first field and space\n       *  may not appear in the final field.\n       *\n       *  The parts of a money string must appear in the order indicated by\n       *  the fields of the pattern.  The symbol field indicates that the\n       *  value of curr_symbol() may be present.  The sign field indicates\n       *  that the value of positive_sign() or negative_sign() must be\n       *  present.  The value field indicates that the absolute value of the\n       *  money amount is present.  none indicates 0 or more whitespace\n       *  characters, except at the end, where it permits no whitespace.\n       *  space indicates that 1 or more whitespace characters must be\n       *  present.\n       *\n       *  For example, for the US locale and pos_format() pattern\n       *  {symbol,sign,value,none}, curr_symbol() == '$' positive_sign() ==\n       *  '+', and value 10.01, and options set to force the symbol, the\n       *  corresponding string is \"$+10.01\".\n       *\n       *  @return  Pattern for money values.\n      */\n      pattern\n      pos_format() const\n      { return this->do_pos_format(); }\n\n      pattern\n      neg_format() const\n      { return this->do_neg_format(); }\n      //@}\n\n    protected:\n      /// Destructor.\n      virtual\n      ~moneypunct();\n\n      /**\n       *  @brief  Return decimal point character.\n       *\n       *  Returns a char_type to use as a decimal point.  This function is a\n       *  hook for derived classes to change the value returned.\n       *\n       *  @return  @a char_type representing a decimal point.\n      */\n      virtual char_type\n      do_decimal_point() const\n      { return _M_data->_M_decimal_point; }\n\n      /**\n       *  @brief  Return thousands separator character.\n       *\n       *  Returns a char_type to use as a thousands separator.  This function\n       *  is a hook for derived classes to change the value returned.\n       *\n       *  @return  @a char_type representing a thousands separator.\n      */\n      virtual char_type\n      do_thousands_sep() const\n      { return _M_data->_M_thousands_sep; }\n\n      /**\n       *  @brief  Return grouping specification.\n       *\n       *  Returns a string representing groupings for the integer part of a\n       *  number.  This function is a hook for derived classes to change the\n       *  value returned.  @see grouping() for details.\n       *\n       *  @return  String representing grouping specification.\n      */\n      virtual string\n      do_grouping() const\n      { return _M_data->_M_grouping; }\n\n      /**\n       *  @brief  Return currency symbol string.\n       *\n       *  This function returns a string_type to use as a currency symbol.\n       *  This function is a hook for derived classes to change the value\n       *  returned.  @see curr_symbol() for details.\n       *\n       *  @return  @a string_type representing a currency symbol.\n      */\n      virtual string_type\n      do_curr_symbol()   const\n      { return _M_data->_M_curr_symbol; }\n\n      /**\n       *  @brief  Return positive sign string.\n       *\n       *  This function returns a string_type to use as a sign for positive\n       *  amounts.  This function is a hook for derived classes to change the\n       *  value returned.  @see positive_sign() for details.\n       *\n       *  @return  @a string_type representing a positive sign.\n      */\n      virtual string_type\n      do_positive_sign() const\n      { return _M_data->_M_positive_sign; }\n\n      /**\n       *  @brief  Return negative sign string.\n       *\n       *  This function returns a string_type to use as a sign for negative\n       *  amounts.  This function is a hook for derived classes to change the\n       *  value returned.  @see negative_sign() for details.\n       *\n       *  @return  @a string_type representing a negative sign.\n      */\n      virtual string_type\n      do_negative_sign() const\n      { return _M_data->_M_negative_sign; }\n\n      /**\n       *  @brief  Return number of digits in fraction.\n       *\n       *  This function returns the exact number of digits that make up the\n       *  fractional part of a money amount.  This function is a hook for\n       *  derived classes to change the value returned.  @see frac_digits()\n       *  for details.\n       *\n       *  @return  Number of digits in amount fraction.\n      */\n      virtual int\n      do_frac_digits() const\n      { return _M_data->_M_frac_digits; }\n\n      /**\n       *  @brief  Return pattern for money values.\n       *\n       *  This function returns a pattern describing the formatting of a\n       *  positive valued money amount.  This function is a hook for derived\n       *  classes to change the value returned.  @see pos_format() for\n       *  details.\n       *\n       *  @return  Pattern for money values.\n      */\n      virtual pattern\n      do_pos_format() const\n      { return _M_data->_M_pos_format; }\n\n      /**\n       *  @brief  Return pattern for money values.\n       *\n       *  This function returns a pattern describing the formatting of a\n       *  negative valued money amount.  This function is a hook for derived\n       *  classes to change the value returned.  @see neg_format() for\n       *  details.\n       *\n       *  @return  Pattern for money values.\n      */\n      virtual pattern\n      do_neg_format() const\n      { return _M_data->_M_neg_format; }\n\n      // For use at construction time only.\n       void\n       _M_initialize_moneypunct(__c_locale __cloc = NULL,\n\t\t\t\tconst char* __name = NULL);\n    };\n\n  template<typename _CharT, bool _Intl>\n    locale::id moneypunct<_CharT, _Intl>::id;\n\n  template<typename _CharT, bool _Intl>\n    const bool moneypunct<_CharT, _Intl>::intl;\n\n  template<>\n    moneypunct<char, true>::~moneypunct();\n\n  template<>\n    moneypunct<char, false>::~moneypunct();\n\n  template<>\n    void\n    moneypunct<char, true>::_M_initialize_moneypunct(__c_locale, const char*);\n\n  template<>\n    void\n    moneypunct<char, false>::_M_initialize_moneypunct(__c_locale, const char*);\n\n#ifdef _GLIBCXX_USE_WCHAR_T\n  template<>\n    moneypunct<wchar_t, true>::~moneypunct();\n\n  template<>\n    moneypunct<wchar_t, false>::~moneypunct();\n\n  template<>\n    void\n    moneypunct<wchar_t, true>::_M_initialize_moneypunct(__c_locale,\n\t\t\t\t\t\t\tconst char*);\n\n  template<>\n    void\n    moneypunct<wchar_t, false>::_M_initialize_moneypunct(__c_locale,\n\t\t\t\t\t\t\t const char*);\n#endif\n\n  /// @brief  class moneypunct_byname [22.2.6.4].\n  template<typename _CharT, bool _Intl>\n    class moneypunct_byname : public moneypunct<_CharT, _Intl>\n    {\n    public:\n      typedef _CharT\t\t\tchar_type;\n      typedef basic_string<_CharT>\tstring_type;\n\n      static const bool intl = _Intl;\n\n      explicit\n      moneypunct_byname(const char* __s, size_t __refs = 0)\n      : moneypunct<_CharT, _Intl>(__refs)\n      {\n\tif (std::strcmp(__s, \"C\") != 0 && std::strcmp(__s, \"POSIX\") != 0)\n\t  {\n\t    __c_locale __tmp;\n\t    this->_S_create_c_locale(__tmp, __s);\n\t    this->_M_initialize_moneypunct(__tmp);\n\t    this->_S_destroy_c_locale(__tmp);\n\t  }\n      }\n\n    protected:\n      virtual\n      ~moneypunct_byname() { }\n    };\n\n  template<typename _CharT, bool _Intl>\n    const bool moneypunct_byname<_CharT, _Intl>::intl;\n\n_GLIBCXX_BEGIN_LDBL_NAMESPACE\n  /**\n   *  @brief  Facet for parsing monetary amounts.\n   *\n   *  This facet encapsulates the code to parse and return a monetary\n   *  amount from a string.\n   *\n   *  The money_get template uses protected virtual functions to\n   *  provide the actual results.  The public accessors forward the\n   *  call to the virtual functions.  These virtual functions are\n   *  hooks for developers to implement the behavior they require from\n   *  the money_get facet.\n  */\n  template<typename _CharT, typename _InIter>\n    class money_get : public locale::facet\n    {\n    public:\n      // Types:\n      //@{\n      /// Public typedefs\n      typedef _CharT\t\t\tchar_type;\n      typedef _InIter\t\t\titer_type;\n      typedef basic_string<_CharT>\tstring_type;\n      //@}\n\n      /// Numpunct facet id.\n      static locale::id\t\t\tid;\n\n      /**\n       *  @brief  Constructor performs initialization.\n       *\n       *  This is the constructor provided by the standard.\n       *\n       *  @param refs  Passed to the base facet class.\n      */\n      explicit\n      money_get(size_t __refs = 0) : facet(__refs) { }\n\n      /**\n       *  @brief  Read and parse a monetary value.\n       *\n       *  This function reads characters from @a s, interprets them as a\n       *  monetary value according to moneypunct and ctype facets retrieved\n       *  from io.getloc(), and returns the result in @a units as an integral\n       *  value moneypunct::frac_digits() * the actual amount.  For example,\n       *  the string $10.01 in a US locale would store 1001 in @a units.\n       *\n       *  Any characters not part of a valid money amount are not consumed.\n       *\n       *  If a money value cannot be parsed from the input stream, sets\n       *  err=(err|io.failbit).  If the stream is consumed before finishing\n       *  parsing,  sets err=(err|io.failbit|io.eofbit).  @a units is\n       *  unchanged if parsing fails.\n       *\n       *  This function works by returning the result of do_get().\n       *\n       *  @param  s  Start of characters to parse.\n       *  @param  end  End of characters to parse.\n       *  @param  intl  Parameter to use_facet<moneypunct<CharT,intl> >.\n       *  @param  io  Source of facets and io state.\n       *  @param  err  Error field to set if parsing fails.\n       *  @param  units  Place to store result of parsing.\n       *  @return  Iterator referencing first character beyond valid money\n       *\t   amount.\n       */\n      iter_type\n      get(iter_type __s, iter_type __end, bool __intl, ios_base& __io,\n\t  ios_base::iostate& __err, long double& __units) const\n      { return this->do_get(__s, __end, __intl, __io, __err, __units); }\n\n      /**\n       *  @brief  Read and parse a monetary value.\n       *\n       *  This function reads characters from @a s, interprets them as a\n       *  monetary value according to moneypunct and ctype facets retrieved\n       *  from io.getloc(), and returns the result in @a digits.  For example,\n       *  the string $10.01 in a US locale would store \"1001\" in @a digits.\n       *\n       *  Any characters not part of a valid money amount are not consumed.\n       *\n       *  If a money value cannot be parsed from the input stream, sets\n       *  err=(err|io.failbit).  If the stream is consumed before finishing\n       *  parsing,  sets err=(err|io.failbit|io.eofbit).\n       *\n       *  This function works by returning the result of do_get().\n       *\n       *  @param  s  Start of characters to parse.\n       *  @param  end  End of characters to parse.\n       *  @param  intl  Parameter to use_facet<moneypunct<CharT,intl> >.\n       *  @param  io  Source of facets and io state.\n       *  @param  err  Error field to set if parsing fails.\n       *  @param  digits  Place to store result of parsing.\n       *  @return  Iterator referencing first character beyond valid money\n       *\t   amount.\n       */\n      iter_type\n      get(iter_type __s, iter_type __end, bool __intl, ios_base& __io,\n\t  ios_base::iostate& __err, string_type& __digits) const\n      { return this->do_get(__s, __end, __intl, __io, __err, __digits); }\n\n    protected:\n      /// Destructor.\n      virtual\n      ~money_get() { }\n\n      /**\n       *  @brief  Read and parse a monetary value.\n       *\n       *  This function reads and parses characters representing a monetary\n       *  value.  This function is a hook for derived classes to change the\n       *  value returned.  @see get() for details.\n       */\n      // XXX GLIBCXX_ABI Deprecated\n#if defined _GLIBCXX_LONG_DOUBLE_COMPAT && defined __LONG_DOUBLE_128__\n      virtual iter_type\n      __do_get(iter_type __s, iter_type __end, bool __intl, ios_base& __io,\n\t       ios_base::iostate& __err, double& __units) const;\n#else\n      virtual iter_type\n      do_get(iter_type __s, iter_type __end, bool __intl, ios_base& __io,\n\t     ios_base::iostate& __err, long double& __units) const;\n#endif\n\n      /**\n       *  @brief  Read and parse a monetary value.\n       *\n       *  This function reads and parses characters representing a monetary\n       *  value.  This function is a hook for derived classes to change the\n       *  value returned.  @see get() for details.\n       */\n      virtual iter_type\n      do_get(iter_type __s, iter_type __end, bool __intl, ios_base& __io,\n\t     ios_base::iostate& __err, string_type& __digits) const;\n\n      // XXX GLIBCXX_ABI Deprecated\n#if defined _GLIBCXX_LONG_DOUBLE_COMPAT && defined __LONG_DOUBLE_128__\n      virtual iter_type\n      do_get(iter_type __s, iter_type __end, bool __intl, ios_base& __io,\n\t     ios_base::iostate& __err, long double& __units) const;\n#endif\n\n      template<bool _Intl>\n        iter_type\n        _M_extract(iter_type __s, iter_type __end, ios_base& __io,\n\t\t   ios_base::iostate& __err, string& __digits) const;     \n    };\n\n  template<typename _CharT, typename _InIter>\n    locale::id money_get<_CharT, _InIter>::id;\n\n  /**\n   *  @brief  Facet for outputting monetary amounts.\n   *\n   *  This facet encapsulates the code to format and output a monetary\n   *  amount.\n   *\n   *  The money_put template uses protected virtual functions to\n   *  provide the actual results.  The public accessors forward the\n   *  call to the virtual functions.  These virtual functions are\n   *  hooks for developers to implement the behavior they require from\n   *  the money_put facet.\n  */\n  template<typename _CharT, typename _OutIter>\n    class money_put : public locale::facet\n    {\n    public:\n      //@{\n      /// Public typedefs\n      typedef _CharT\t\t\tchar_type;\n      typedef _OutIter\t\t\titer_type;\n      typedef basic_string<_CharT>\tstring_type;\n      //@}\n\n      /// Numpunct facet id.\n      static locale::id\t\t\tid;\n\n      /**\n       *  @brief  Constructor performs initialization.\n       *\n       *  This is the constructor provided by the standard.\n       *\n       *  @param refs  Passed to the base facet class.\n      */\n      explicit\n      money_put(size_t __refs = 0) : facet(__refs) { }\n\n      /**\n       *  @brief  Format and output a monetary value.\n       *\n       *  This function formats @a units as a monetary value according to\n       *  moneypunct and ctype facets retrieved from io.getloc(), and writes\n       *  the resulting characters to @a s.  For example, the value 1001 in a\n       *  US locale would write \"$10.01\" to @a s.\n       *\n       *  This function works by returning the result of do_put().\n       *\n       *  @param  s  The stream to write to.\n       *  @param  intl  Parameter to use_facet<moneypunct<CharT,intl> >.\n       *  @param  io  Source of facets and io state.\n       *  @param  fill  char_type to use for padding.\n       *  @param  units  Place to store result of parsing.\n       *  @return  Iterator after writing.\n       */\n      iter_type\n      put(iter_type __s, bool __intl, ios_base& __io,\n\t  char_type __fill, long double __units) const\n      { return this->do_put(__s, __intl, __io, __fill, __units); }\n\n      /**\n       *  @brief  Format and output a monetary value.\n       *\n       *  This function formats @a digits as a monetary value according to\n       *  moneypunct and ctype facets retrieved from io.getloc(), and writes\n       *  the resulting characters to @a s.  For example, the string \"1001\" in\n       *  a US locale would write \"$10.01\" to @a s.\n       *\n       *  This function works by returning the result of do_put().\n       *\n       *  @param  s  The stream to write to.\n       *  @param  intl  Parameter to use_facet<moneypunct<CharT,intl> >.\n       *  @param  io  Source of facets and io state.\n       *  @param  fill  char_type to use for padding.\n       *  @param  units  Place to store result of parsing.\n       *  @return  Iterator after writing.\n       */\n      iter_type\n      put(iter_type __s, bool __intl, ios_base& __io,\n\t  char_type __fill, const string_type& __digits) const\n      { return this->do_put(__s, __intl, __io, __fill, __digits); }\n\n    protected:\n      /// Destructor.\n      virtual\n      ~money_put() { }\n\n      /**\n       *  @brief  Format and output a monetary value.\n       *\n       *  This function formats @a units as a monetary value according to\n       *  moneypunct and ctype facets retrieved from io.getloc(), and writes\n       *  the resulting characters to @a s.  For example, the value 1001 in a\n       *  US locale would write \"$10.01\" to @a s.\n       *\n       *  This function is a hook for derived classes to change the value\n       *  returned.  @see put().\n       *\n       *  @param  s  The stream to write to.\n       *  @param  intl  Parameter to use_facet<moneypunct<CharT,intl> >.\n       *  @param  io  Source of facets and io state.\n       *  @param  fill  char_type to use for padding.\n       *  @param  units  Place to store result of parsing.\n       *  @return  Iterator after writing.\n       */\n      // XXX GLIBCXX_ABI Deprecated\n#if defined _GLIBCXX_LONG_DOUBLE_COMPAT && defined __LONG_DOUBLE_128__\n      virtual iter_type\n      __do_put(iter_type __s, bool __intl, ios_base& __io, char_type __fill,\n\t       double __units) const;\n#else\n      virtual iter_type\n      do_put(iter_type __s, bool __intl, ios_base& __io, char_type __fill,\n\t     long double __units) const;\n#endif\n\n      /**\n       *  @brief  Format and output a monetary value.\n       *\n       *  This function formats @a digits as a monetary value according to\n       *  moneypunct and ctype facets retrieved from io.getloc(), and writes\n       *  the resulting characters to @a s.  For example, the string \"1001\" in\n       *  a US locale would write \"$10.01\" to @a s.\n       *\n       *  This function is a hook for derived classes to change the value\n       *  returned.  @see put().\n       *\n       *  @param  s  The stream to write to.\n       *  @param  intl  Parameter to use_facet<moneypunct<CharT,intl> >.\n       *  @param  io  Source of facets and io state.\n       *  @param  fill  char_type to use for padding.\n       *  @param  units  Place to store result of parsing.\n       *  @return  Iterator after writing.\n       */\n      virtual iter_type\n      do_put(iter_type __s, bool __intl, ios_base& __io, char_type __fill,\n\t     const string_type& __digits) const;\n\n      // XXX GLIBCXX_ABI Deprecated\n#if defined _GLIBCXX_LONG_DOUBLE_COMPAT && defined __LONG_DOUBLE_128__\n      virtual iter_type\n      do_put(iter_type __s, bool __intl, ios_base& __io, char_type __fill,\n\t     long double __units) const;\n#endif\n\n      template<bool _Intl>\n        iter_type\n        _M_insert(iter_type __s, ios_base& __io, char_type __fill,\n\t\t  const string_type& __digits) const;\n    };\n\n  template<typename _CharT, typename _OutIter>\n    locale::id money_put<_CharT, _OutIter>::id;\n\n_GLIBCXX_END_LDBL_NAMESPACE\n\n  /**\n   *  @brief  Messages facet base class providing catalog typedef.\n   */\n  struct messages_base\n  {\n    typedef int catalog;\n  };\n\n  /**\n   *  @brief  Facet for handling message catalogs\n   *\n   *  This facet encapsulates the code to retrieve messages from\n   *  message catalogs.  The only thing defined by the standard for this facet\n   *  is the interface.  All underlying functionality is\n   *  implementation-defined.\n   *\n   *  This library currently implements 3 versions of the message facet.  The\n   *  first version (gnu) is a wrapper around gettext, provided by libintl.\n   *  The second version (ieee) is a wrapper around catgets.  The final\n   *  version (default) does no actual translation.  These implementations are\n   *  only provided for char and wchar_t instantiations.\n   *\n   *  The messages template uses protected virtual functions to\n   *  provide the actual results.  The public accessors forward the\n   *  call to the virtual functions.  These virtual functions are\n   *  hooks for developers to implement the behavior they require from\n   *  the messages facet.\n  */\n  template<typename _CharT>\n    class messages : public locale::facet, public messages_base\n    {\n    public:\n      // Types:\n      //@{\n      /// Public typedefs\n      typedef _CharT\t\t\tchar_type;\n      typedef basic_string<_CharT>\tstring_type;\n      //@}\n\n    protected:\n      // Underlying \"C\" library locale information saved from\n      // initialization, needed by messages_byname as well.\n      __c_locale\t\t\t_M_c_locale_messages;\n      const char*\t\t\t_M_name_messages;\n\n    public:\n      /// Numpunct facet id.\n      static locale::id\t\t\tid;\n\n      /**\n       *  @brief  Constructor performs initialization.\n       *\n       *  This is the constructor provided by the standard.\n       *\n       *  @param refs  Passed to the base facet class.\n      */\n      explicit\n      messages(size_t __refs = 0);\n\n      // Non-standard.\n      /**\n       *  @brief  Internal constructor.  Not for general use.\n       *\n       *  This is a constructor for use by the library itself to set up new\n       *  locales.\n       *\n       *  @param  cloc  The \"C\" locale.\n       *  @param  s  The name of a locale.\n       *  @param  refs  Refcount to pass to the base class.\n       */\n      explicit\n      messages(__c_locale __cloc, const char* __s, size_t __refs = 0);\n\n      /*\n       *  @brief  Open a message catalog.\n       *\n       *  This function opens and returns a handle to a message catalog by\n       *  returning do_open(s, loc).\n       *\n       *  @param  s  The catalog to open.\n       *  @param  loc  Locale to use for character set conversions.\n       *  @return  Handle to the catalog or value < 0 if open fails.\n      */\n      catalog\n      open(const basic_string<char>& __s, const locale& __loc) const\n      { return this->do_open(__s, __loc); }\n\n      // Non-standard and unorthodox, yet effective.\n      /*\n       *  @brief  Open a message catalog.\n       *\n       *  This non-standard function opens and returns a handle to a message\n       *  catalog by returning do_open(s, loc).  The third argument provides a\n       *  message catalog root directory for gnu gettext and is ignored\n       *  otherwise.\n       *\n       *  @param  s  The catalog to open.\n       *  @param  loc  Locale to use for character set conversions.\n       *  @param  dir  Message catalog root directory.\n       *  @return  Handle to the catalog or value < 0 if open fails.\n      */\n      catalog\n      open(const basic_string<char>&, const locale&, const char*) const;\n\n      /*\n       *  @brief  Look up a string in a message catalog.\n       *\n       *  This function retrieves and returns a message from a catalog by\n       *  returning do_get(c, set, msgid, s).\n       *\n       *  For gnu, @a set and @a msgid are ignored.  Returns gettext(s).\n       *  For default, returns s. For ieee, returns catgets(c,set,msgid,s).\n       *\n       *  @param  c  The catalog to access.\n       *  @param  set  Implementation-defined.\n       *  @param  msgid  Implementation-defined.\n       *  @param  s  Default return value if retrieval fails.\n       *  @return  Retrieved message or @a s if get fails.\n      */\n      string_type\n      get(catalog __c, int __set, int __msgid, const string_type& __s) const\n      { return this->do_get(__c, __set, __msgid, __s); }\n\n      /*\n       *  @brief  Close a message catalog.\n       *\n       *  Closes catalog @a c by calling do_close(c).\n       *\n       *  @param  c  The catalog to close.\n      */\n      void\n      close(catalog __c) const\n      { return this->do_close(__c); }\n\n    protected:\n      /// Destructor.\n      virtual\n      ~messages();\n\n      /*\n       *  @brief  Open a message catalog.\n       *\n       *  This function opens and returns a handle to a message catalog in an\n       *  implementation-defined manner.  This function is a hook for derived\n       *  classes to change the value returned.\n       *\n       *  @param  s  The catalog to open.\n       *  @param  loc  Locale to use for character set conversions.\n       *  @return  Handle to the opened catalog, value < 0 if open failed.\n      */\n      virtual catalog\n      do_open(const basic_string<char>&, const locale&) const;\n\n      /*\n       *  @brief  Look up a string in a message catalog.\n       *\n       *  This function retrieves and returns a message from a catalog in an\n       *  implementation-defined manner.  This function is a hook for derived\n       *  classes to change the value returned.\n       *\n       *  For gnu, @a set and @a msgid are ignored.  Returns gettext(s).\n       *  For default, returns s. For ieee, returns catgets(c,set,msgid,s).\n       *\n       *  @param  c  The catalog to access.\n       *  @param  set  Implementation-defined.\n       *  @param  msgid  Implementation-defined.\n       *  @param  s  Default return value if retrieval fails.\n       *  @return  Retrieved message or @a s if get fails.\n      */\n      virtual string_type\n      do_get(catalog, int, int, const string_type& __dfault) const;\n\n      /*\n       *  @brief  Close a message catalog.\n       *\n       *  @param  c  The catalog to close.\n      */\n      virtual void\n      do_close(catalog) const;\n\n      // Returns a locale and codeset-converted string, given a char* message.\n      char*\n      _M_convert_to_char(const string_type& __msg) const\n      {\n\t// XXX\n\treturn reinterpret_cast<char*>(const_cast<_CharT*>(__msg.c_str()));\n      }\n\n      // Returns a locale and codeset-converted string, given a char* message.\n      string_type\n      _M_convert_from_char(char*) const\n      {\n#if 0\n\t// Length of message string without terminating null.\n\tsize_t __len = char_traits<char>::length(__msg) - 1;\n\n\t// \"everybody can easily convert the string using\n\t// mbsrtowcs/wcsrtombs or with iconv()\"\n\n\t// Convert char* to _CharT in locale used to open catalog.\n\t// XXX need additional template parameter on messages class for this..\n\t// typedef typename codecvt<char, _CharT, _StateT> __codecvt_type;\n\ttypedef typename codecvt<char, _CharT, mbstate_t> __codecvt_type;\n\n\t__codecvt_type::state_type __state;\n\t// XXX may need to initialize state.\n\t//initialize_state(__state._M_init());\n\n\tchar* __from_next;\n\t// XXX what size for this string?\n\t_CharT* __to = static_cast<_CharT*>(__builtin_alloca(__len + 1));\n\tconst __codecvt_type& __cvt = use_facet<__codecvt_type>(_M_locale_conv);\n\t__cvt.out(__state, __msg, __msg + __len, __from_next,\n\t\t  __to, __to + __len + 1, __to_next);\n\treturn string_type(__to);\n#endif\n#if 0\n\ttypedef ctype<_CharT> __ctype_type;\n\t// const __ctype_type& __cvt = use_facet<__ctype_type>(_M_locale_msg);\n\tconst __ctype_type& __cvt = use_facet<__ctype_type>(locale());\n\t// XXX Again, proper length of converted string an issue here.\n\t// For now, assume the converted length is not larger.\n\t_CharT* __dest = static_cast<_CharT*>(__builtin_alloca(__len + 1));\n\t__cvt.widen(__msg, __msg + __len, __dest);\n\treturn basic_string<_CharT>(__dest);\n#endif\n\treturn string_type();\n      }\n     };\n\n  template<typename _CharT>\n    locale::id messages<_CharT>::id;\n\n  // Specializations for required instantiations.\n  template<>\n    string\n    messages<char>::do_get(catalog, int, int, const string&) const;\n\n#ifdef _GLIBCXX_USE_WCHAR_T\n  template<>\n    wstring\n    messages<wchar_t>::do_get(catalog, int, int, const wstring&) const;\n#endif\n\n   /// @brief class messages_byname [22.2.7.2].\n   template<typename _CharT>\n    class messages_byname : public messages<_CharT>\n    {\n    public:\n      typedef _CharT\t\t\tchar_type;\n      typedef basic_string<_CharT>\tstring_type;\n\n      explicit\n      messages_byname(const char* __s, size_t __refs = 0);\n\n    protected:\n      virtual\n      ~messages_byname()\n      { }\n    };\n\n_GLIBCXX_END_NAMESPACE\n\n  // Include host and configuration specific messages functions.\n  #include <bits/messages_members.h>\n\n_GLIBCXX_BEGIN_NAMESPACE(std)\n\n  // Subclause convenience interfaces, inlines.\n  // NB: These are inline because, when used in a loop, some compilers\n  // can hoist the body out of the loop; then it's just as fast as the\n  // C is*() function.\n\n  /// Convenience interface to ctype.is(ctype_base::space, __c).\n  template<typename _CharT>\n    inline bool\n    isspace(_CharT __c, const locale& __loc)\n    { return use_facet<ctype<_CharT> >(__loc).is(ctype_base::space, __c); }\n\n  /// Convenience interface to ctype.is(ctype_base::print, __c).\n  template<typename _CharT>\n    inline bool\n    isprint(_CharT __c, const locale& __loc)\n    { return use_facet<ctype<_CharT> >(__loc).is(ctype_base::print, __c); }\n\n  /// Convenience interface to ctype.is(ctype_base::cntrl, __c).\n  template<typename _CharT>\n    inline bool\n    iscntrl(_CharT __c, const locale& __loc)\n    { return use_facet<ctype<_CharT> >(__loc).is(ctype_base::cntrl, __c); }\n\n  /// Convenience interface to ctype.is(ctype_base::upper, __c).\n  template<typename _CharT>\n    inline bool\n    isupper(_CharT __c, const locale& __loc)\n    { return use_facet<ctype<_CharT> >(__loc).is(ctype_base::upper, __c); }\n\n  /// Convenience interface to ctype.is(ctype_base::lower, __c).\n  template<typename _CharT>\n    inline bool \n    islower(_CharT __c, const locale& __loc)\n    { return use_facet<ctype<_CharT> >(__loc).is(ctype_base::lower, __c); }\n\n  /// Convenience interface to ctype.is(ctype_base::alpha, __c).\n  template<typename _CharT>\n    inline bool\n    isalpha(_CharT __c, const locale& __loc)\n    { return use_facet<ctype<_CharT> >(__loc).is(ctype_base::alpha, __c); }\n\n  /// Convenience interface to ctype.is(ctype_base::digit, __c).\n  template<typename _CharT>\n    inline bool\n    isdigit(_CharT __c, const locale& __loc)\n    { return use_facet<ctype<_CharT> >(__loc).is(ctype_base::digit, __c); }\n\n  /// Convenience interface to ctype.is(ctype_base::punct, __c).\n  template<typename _CharT>\n    inline bool\n    ispunct(_CharT __c, const locale& __loc)\n    { return use_facet<ctype<_CharT> >(__loc).is(ctype_base::punct, __c); }\n\n  /// Convenience interface to ctype.is(ctype_base::xdigit, __c).\n  template<typename _CharT>\n    inline bool\n    isxdigit(_CharT __c, const locale& __loc)\n    { return use_facet<ctype<_CharT> >(__loc).is(ctype_base::xdigit, __c); }\n\n  /// Convenience interface to ctype.is(ctype_base::alnum, __c).\n  template<typename _CharT>\n    inline bool\n    isalnum(_CharT __c, const locale& __loc)\n    { return use_facet<ctype<_CharT> >(__loc).is(ctype_base::alnum, __c); }\n\n  /// Convenience interface to ctype.is(ctype_base::graph, __c).\n  template<typename _CharT>\n    inline bool\n    isgraph(_CharT __c, const locale& __loc)\n    { return use_facet<ctype<_CharT> >(__loc).is(ctype_base::graph, __c); }\n\n  /// Convenience interface to ctype.toupper(__c).\n  template<typename _CharT>\n    inline _CharT\n    toupper(_CharT __c, const locale& __loc)\n    { return use_facet<ctype<_CharT> >(__loc).toupper(__c); }\n\n  /// Convenience interface to ctype.tolower(__c).\n  template<typename _CharT>\n    inline _CharT\n    tolower(_CharT __c, const locale& __loc)\n    { return use_facet<ctype<_CharT> >(__loc).tolower(__c); }\n\n_GLIBCXX_END_NAMESPACE\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/bits/locale_facets.tcc",
    "content": "// Locale support -*- C++ -*-\n\n// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006\n// Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n/** @file locale_facets.tcc\n *  This is an internal header file, included by other library headers.\n *  You should not attempt to use it directly.\n */\n\n#ifndef _LOCALE_FACETS_TCC\n#define _LOCALE_FACETS_TCC 1\n\n#pragma GCC system_header\n\n#include <limits>\t\t// For numeric_limits\n#include <typeinfo>\t\t// For bad_cast.\n#include <bits/streambuf_iterator.h>\n#include <ext/type_traits.h>\n\n_GLIBCXX_BEGIN_NAMESPACE(std)\n\n  template<typename _Facet>\n    locale\n    locale::combine(const locale& __other) const\n    {\n      _Impl* __tmp = new _Impl(*_M_impl, 1);\n      try\n\t{\n\t  __tmp->_M_replace_facet(__other._M_impl, &_Facet::id);\n\t}\n      catch(...)\n\t{\n\t  __tmp->_M_remove_reference();\n\t  __throw_exception_again;\n\t}\n      return locale(__tmp);\n    }\n\n  template<typename _CharT, typename _Traits, typename _Alloc>\n    bool\n    locale::operator()(const basic_string<_CharT, _Traits, _Alloc>& __s1,\n                       const basic_string<_CharT, _Traits, _Alloc>& __s2) const\n    {\n      typedef std::collate<_CharT> __collate_type;\n      const __collate_type& __collate = use_facet<__collate_type>(*this);\n      return (__collate.compare(__s1.data(), __s1.data() + __s1.length(),\n\t\t\t\t__s2.data(), __s2.data() + __s2.length()) < 0);\n    }\n\n  /**\n   *  @brief  Test for the presence of a facet.\n   *\n   *  has_facet tests the locale argument for the presence of the facet type\n   *  provided as the template parameter.  Facets derived from the facet\n   *  parameter will also return true.\n   *\n   *  @param  Facet  The facet type to test the presence of.\n   *  @param  locale  The locale to test.\n   *  @return  true if locale contains a facet of type Facet, else false.\n  */\n  template<typename _Facet>\n    inline bool\n    has_facet(const locale& __loc) throw()\n    {\n      const size_t __i = _Facet::id._M_id();\n      const locale::facet** __facets = __loc._M_impl->_M_facets;\n      return (__i < __loc._M_impl->_M_facets_size && __facets[__i]);\n    }\n\n  /**\n   *  @brief  Return a facet.\n   *\n   *  use_facet looks for and returns a reference to a facet of type Facet\n   *  where Facet is the template parameter.  If has_facet(locale) is true,\n   *  there is a suitable facet to return.  It throws std::bad_cast if the\n   *  locale doesn't contain a facet of type Facet.\n   *\n   *  @param  Facet  The facet type to access.\n   *  @param  locale  The locale to use.\n   *  @return  Reference to facet of type Facet.\n   *  @throw  std::bad_cast if locale doesn't contain a facet of type Facet.\n  */\n  template<typename _Facet>\n    inline const _Facet&\n    use_facet(const locale& __loc)\n    {\n      const size_t __i = _Facet::id._M_id();\n      const locale::facet** __facets = __loc._M_impl->_M_facets;\n      if (!(__i < __loc._M_impl->_M_facets_size && __facets[__i]))\n        __throw_bad_cast();\n      return static_cast<const _Facet&>(*__facets[__i]);\n    }\n\n  // Routine to access a cache for the facet.  If the cache didn't\n  // exist before, it gets constructed on the fly.\n  template<typename _Facet>\n    struct __use_cache\n    {\n      const _Facet*\n      operator() (const locale& __loc) const;\n    };\n\n  // Specializations.\n  template<typename _CharT>\n    struct __use_cache<__numpunct_cache<_CharT> >\n    {\n      const __numpunct_cache<_CharT>*\n      operator() (const locale& __loc) const\n      {\n\tconst size_t __i = numpunct<_CharT>::id._M_id();\n\tconst locale::facet** __caches = __loc._M_impl->_M_caches;\n\tif (!__caches[__i])\n\t  {\n\t    __numpunct_cache<_CharT>* __tmp = NULL;\n\t    try\n\t      {\n\t\t__tmp = new __numpunct_cache<_CharT>;\n\t\t__tmp->_M_cache(__loc);\n\t      }\n\t    catch(...)\n\t      {\n\t\tdelete __tmp;\n\t\t__throw_exception_again;\n\t      }\n\t    __loc._M_impl->_M_install_cache(__tmp, __i);\n\t  }\n\treturn static_cast<const __numpunct_cache<_CharT>*>(__caches[__i]);\n      }\n    };\n\n  template<typename _CharT, bool _Intl>\n    struct __use_cache<__moneypunct_cache<_CharT, _Intl> >\n    {\n      const __moneypunct_cache<_CharT, _Intl>*\n      operator() (const locale& __loc) const\n      {\n\tconst size_t __i = moneypunct<_CharT, _Intl>::id._M_id();\n\tconst locale::facet** __caches = __loc._M_impl->_M_caches;\n\tif (!__caches[__i])\n\t  {\n\t    __moneypunct_cache<_CharT, _Intl>* __tmp = NULL;\n\t    try\n\t      {\n\t\t__tmp = new __moneypunct_cache<_CharT, _Intl>;\n\t\t__tmp->_M_cache(__loc);\n\t      }\n\t    catch(...)\n\t      {\n\t\tdelete __tmp;\n\t\t__throw_exception_again;\n\t      }\n\t    __loc._M_impl->_M_install_cache(__tmp, __i);\n\t  }\n\treturn static_cast<\n\t  const __moneypunct_cache<_CharT, _Intl>*>(__caches[__i]);\n      }\n    };\n\n  template<typename _CharT>\n    void\n    __numpunct_cache<_CharT>::_M_cache(const locale& __loc)\n    {\n      _M_allocated = true;\n\n      const numpunct<_CharT>& __np = use_facet<numpunct<_CharT> >(__loc);\n\n      _M_grouping_size = __np.grouping().size();\n      char* __grouping = new char[_M_grouping_size];\n      __np.grouping().copy(__grouping, _M_grouping_size);\n      _M_grouping = __grouping;\n      _M_use_grouping = (_M_grouping_size\n\t\t\t && static_cast<signed char>(__np.grouping()[0]) > 0);\n\n      _M_truename_size = __np.truename().size();\n      _CharT* __truename = new _CharT[_M_truename_size];\n      __np.truename().copy(__truename, _M_truename_size);\n      _M_truename = __truename;\n\n      _M_falsename_size = __np.falsename().size();\n      _CharT* __falsename = new _CharT[_M_falsename_size];\n      __np.falsename().copy(__falsename, _M_falsename_size);\n      _M_falsename = __falsename;\n\n      _M_decimal_point = __np.decimal_point();\n      _M_thousands_sep = __np.thousands_sep();\n\n      const ctype<_CharT>& __ct = use_facet<ctype<_CharT> >(__loc);\n      __ct.widen(__num_base::_S_atoms_out,\n\t\t __num_base::_S_atoms_out + __num_base::_S_oend, _M_atoms_out);\n      __ct.widen(__num_base::_S_atoms_in,\n\t\t __num_base::_S_atoms_in + __num_base::_S_iend, _M_atoms_in);\n    }\n\n  template<typename _CharT, bool _Intl>\n    void\n    __moneypunct_cache<_CharT, _Intl>::_M_cache(const locale& __loc)\n    {\n      _M_allocated = true;\n\n      const moneypunct<_CharT, _Intl>& __mp =\n\tuse_facet<moneypunct<_CharT, _Intl> >(__loc);\n\n      _M_grouping_size = __mp.grouping().size();\n      char* __grouping = new char[_M_grouping_size];\n      __mp.grouping().copy(__grouping, _M_grouping_size);\n      _M_grouping = __grouping;\n      _M_use_grouping = (_M_grouping_size\n\t\t\t && static_cast<signed char>(__mp.grouping()[0]) > 0);\n      \n      _M_decimal_point = __mp.decimal_point();\n      _M_thousands_sep = __mp.thousands_sep();\n      _M_frac_digits = __mp.frac_digits();\n      \n      _M_curr_symbol_size = __mp.curr_symbol().size();\n      _CharT* __curr_symbol = new _CharT[_M_curr_symbol_size];\n      __mp.curr_symbol().copy(__curr_symbol, _M_curr_symbol_size);\n      _M_curr_symbol = __curr_symbol;\n      \n      _M_positive_sign_size = __mp.positive_sign().size();\n      _CharT* __positive_sign = new _CharT[_M_positive_sign_size];\n      __mp.positive_sign().copy(__positive_sign, _M_positive_sign_size);\n      _M_positive_sign = __positive_sign;\n\n      _M_negative_sign_size = __mp.negative_sign().size();\n      _CharT* __negative_sign = new _CharT[_M_negative_sign_size];\n      __mp.negative_sign().copy(__negative_sign, _M_negative_sign_size);\n      _M_negative_sign = __negative_sign;\n      \n      _M_pos_format = __mp.pos_format();\n      _M_neg_format = __mp.neg_format();\n\n      const ctype<_CharT>& __ct = use_facet<ctype<_CharT> >(__loc);\n      __ct.widen(money_base::_S_atoms,\n\t\t money_base::_S_atoms + money_base::_S_end, _M_atoms);\n    }\n\n\n  // Used by both numeric and monetary facets.\n  // Check to make sure that the __grouping_tmp string constructed in\n  // money_get or num_get matches the canonical grouping for a given\n  // locale.\n  // __grouping_tmp is parsed L to R\n  // 1,222,444 == __grouping_tmp of \"\\1\\3\\3\"\n  // __grouping is parsed R to L\n  // 1,222,444 == __grouping of \"\\3\" == \"\\3\\3\\3\"\n  static bool\n  __verify_grouping(const char* __grouping, size_t __grouping_size,\n\t\t    const string& __grouping_tmp);\n\n_GLIBCXX_BEGIN_LDBL_NAMESPACE\n\n  template<typename _CharT, typename _InIter>\n    _InIter\n    num_get<_CharT, _InIter>::\n    _M_extract_float(_InIter __beg, _InIter __end, ios_base& __io,\n\t\t     ios_base::iostate& __err, string& __xtrc) const\n    {\n      typedef char_traits<_CharT>\t\t\t__traits_type;\n      typedef __numpunct_cache<_CharT>                  __cache_type;\n      __use_cache<__cache_type> __uc;\n      const locale& __loc = __io._M_getloc();\n      const __cache_type* __lc = __uc(__loc);\n      const _CharT* __lit = __lc->_M_atoms_in;\n      char_type __c = char_type();\n\n      // True if __beg becomes equal to __end.\n      bool __testeof = __beg == __end;\n\n      // First check for sign.\n      if (!__testeof)\n\t{\n\t  __c = *__beg;\n\t  const bool __plus = __c == __lit[__num_base::_S_iplus];\n\t  if ((__plus || __c == __lit[__num_base::_S_iminus])\n\t      && !(__lc->_M_use_grouping && __c == __lc->_M_thousands_sep)\n\t      && !(__c == __lc->_M_decimal_point))\n\t    {\n\t      __xtrc += __plus ? '+' : '-';\n\t      if (++__beg != __end)\n\t\t__c = *__beg;\n\t      else\n\t\t__testeof = true;\n\t    }\n\t}\n\n      // Next, look for leading zeros.\n      bool __found_mantissa = false;\n      int __sep_pos = 0;\n      while (!__testeof)\n\t{\n\t  if (__lc->_M_use_grouping && __c == __lc->_M_thousands_sep\n\t      || __c == __lc->_M_decimal_point)\n\t    break;\n\t  else if (__c == __lit[__num_base::_S_izero])\n\t    {\n\t      if (!__found_mantissa)\n\t\t{\n\t\t  __xtrc += '0';\n\t\t  __found_mantissa = true;\n\t\t}\n\t      ++__sep_pos;\n\n\t      if (++__beg != __end)\n\t\t__c = *__beg;\n\t      else\n\t\t__testeof = true;\n\t    }\n\t  else\n\t    break;\n\t}\n\n      // Only need acceptable digits for floating point numbers.\n      bool __found_dec = false;\n      bool __found_sci = false;\n      string __found_grouping;\n      if (__lc->_M_use_grouping)\n\t__found_grouping.reserve(32);\n      const char_type* __lit_zero = __lit + __num_base::_S_izero;\n\n      if (!__lc->_M_allocated)\n\t// \"C\" locale\n\twhile (!__testeof)\n\t  {\n\t    const int __digit = _M_find(__lit_zero, 10, __c);\n\t    if (__digit != -1)\n\t      {\n\t\t__xtrc += '0' + __digit;\n\t\t__found_mantissa = true;\n\t      }\n\t    else if (__c == __lc->_M_decimal_point\n\t\t     && !__found_dec && !__found_sci)\n\t      {\n\t\t__xtrc += '.';\n\t\t__found_dec = true;\n\t      }\n\t    else if ((__c == __lit[__num_base::_S_ie] \n\t\t      || __c == __lit[__num_base::_S_iE])\n\t\t     && !__found_sci && __found_mantissa)\n\t      {\n\t\t// Scientific notation.\n\t\t__xtrc += 'e';\n\t\t__found_sci = true;\n\t\t\n\t\t// Remove optional plus or minus sign, if they exist.\n\t\tif (++__beg != __end)\n\t\t  {\n\t\t    __c = *__beg;\n\t\t    const bool __plus = __c == __lit[__num_base::_S_iplus];\n\t\t    if (__plus || __c == __lit[__num_base::_S_iminus])\n\t\t      __xtrc += __plus ? '+' : '-';\n\t\t    else\n\t\t      continue;\n\t\t  }\n\t\telse\n\t\t  {\n\t\t    __testeof = true;\n\t\t    break;\n\t\t  }\n\t      }\n\t    else\n\t      break;\n\n\t    if (++__beg != __end)\n\t      __c = *__beg;\n\t    else\n\t      __testeof = true;\n\t  }\n      else\n\twhile (!__testeof)\n\t  {\n\t    // According to 22.2.2.1.2, p8-9, first look for thousands_sep\n\t    // and decimal_point.\n\t    if (__lc->_M_use_grouping && __c == __lc->_M_thousands_sep)\n\t      {\n\t\tif (!__found_dec && !__found_sci)\n\t\t  {\n\t\t    // NB: Thousands separator at the beginning of a string\n\t\t    // is a no-no, as is two consecutive thousands separators.\n\t\t    if (__sep_pos)\n\t\t      {\n\t\t\t__found_grouping += static_cast<char>(__sep_pos);\n\t\t\t__sep_pos = 0;\n\t\t      }\n\t\t    else\n\t\t      {\n\t\t\t// NB: __convert_to_v will not assign __v and will\n\t\t\t// set the failbit.\n\t\t\t__xtrc.clear();\n\t\t\tbreak;\n\t\t      }\n\t\t  }\n\t\telse\n\t\t  break;\n\t      }\n\t    else if (__c == __lc->_M_decimal_point)\n\t      {\n\t\tif (!__found_dec && !__found_sci)\n\t\t  {\n\t\t    // If no grouping chars are seen, no grouping check\n\t\t    // is applied. Therefore __found_grouping is adjusted\n\t\t    // only if decimal_point comes after some thousands_sep.\n\t\t    if (__found_grouping.size())\n\t\t      __found_grouping += static_cast<char>(__sep_pos);\n\t\t    __xtrc += '.';\n\t\t    __found_dec = true;\n\t\t  }\n\t\telse\n\t\t  break;\n\t      }\n\t    else\n\t      {\n\t\tconst char_type* __q =\n\t\t  __traits_type::find(__lit_zero, 10, __c);\n\t\tif (__q)\n\t\t  {\n\t\t    __xtrc += '0' + (__q - __lit_zero);\n\t\t    __found_mantissa = true;\n\t\t    ++__sep_pos;\n\t\t  }\n\t\telse if ((__c == __lit[__num_base::_S_ie] \n\t\t\t  || __c == __lit[__num_base::_S_iE])\n\t\t\t && !__found_sci && __found_mantissa)\n\t\t  {\n\t\t    // Scientific notation.\n\t\t    if (__found_grouping.size() && !__found_dec)\n\t\t      __found_grouping += static_cast<char>(__sep_pos);\n\t\t    __xtrc += 'e';\n\t\t    __found_sci = true;\n\t\t    \n\t\t    // Remove optional plus or minus sign, if they exist.\n\t\t    if (++__beg != __end)\n\t\t      {\n\t\t\t__c = *__beg;\n\t\t\tconst bool __plus = __c == __lit[__num_base::_S_iplus];\n\t\t\tif ((__plus || __c == __lit[__num_base::_S_iminus])\n\t\t\t    && !(__lc->_M_use_grouping\n\t\t\t\t && __c == __lc->_M_thousands_sep)\n\t\t\t    && !(__c == __lc->_M_decimal_point))\n\t\t      __xtrc += __plus ? '+' : '-';\n\t\t\telse\n\t\t\t  continue;\n\t\t      }\n\t\t    else\n\t\t      {\n\t\t\t__testeof = true;\n\t\t\tbreak;\n\t\t      }\n\t\t  }\n\t\telse\n\t\t  break;\n\t      }\n\t    \n\t    if (++__beg != __end)\n\t      __c = *__beg;\n\t    else\n\t      __testeof = true;\n\t  }\n\n      // Digit grouping is checked. If grouping and found_grouping don't\n      // match, then get very very upset, and set failbit.\n      if (__found_grouping.size())\n        {\n          // Add the ending grouping if a decimal or 'e'/'E' wasn't found.\n\t  if (!__found_dec && !__found_sci)\n\t    __found_grouping += static_cast<char>(__sep_pos);\n\n          if (!std::__verify_grouping(__lc->_M_grouping, \n\t\t\t\t      __lc->_M_grouping_size,\n\t\t\t\t      __found_grouping))\n\t    __err |= ios_base::failbit;\n        }\n\n      // Finish up.\n      if (__testeof)\n        __err |= ios_base::eofbit;\n      return __beg;\n    }\n\n_GLIBCXX_END_LDBL_NAMESPACE\n\n_GLIBCXX_BEGIN_LDBL_NAMESPACE\n\n  template<typename _CharT, typename _InIter>\n    template<typename _ValueT>\n      _InIter\n      num_get<_CharT, _InIter>::\n      _M_extract_int(_InIter __beg, _InIter __end, ios_base& __io,\n\t\t     ios_base::iostate& __err, _ValueT& __v) const\n      {\n        typedef char_traits<_CharT>\t\t\t     __traits_type;\n\tusing __gnu_cxx::__add_unsigned;\n\ttypedef typename __add_unsigned<_ValueT>::__type __unsigned_type;\n\ttypedef __numpunct_cache<_CharT>                     __cache_type;\n\t__use_cache<__cache_type> __uc;\n\tconst locale& __loc = __io._M_getloc();\n\tconst __cache_type* __lc = __uc(__loc);\n\tconst _CharT* __lit = __lc->_M_atoms_in;\n\tchar_type __c = char_type();\n\n\t// NB: Iff __basefield == 0, __base can change based on contents.\n\tconst ios_base::fmtflags __basefield = __io.flags()\n\t                                       & ios_base::basefield;\n\tconst bool __oct = __basefield == ios_base::oct;\n\tint __base = __oct ? 8 : (__basefield == ios_base::hex ? 16 : 10);\n\n\t// True if __beg becomes equal to __end.\n\tbool __testeof = __beg == __end;\n\n\t// First check for sign.\n\tbool __negative = false;\n\tif (!__testeof)\n\t  {\n\t    __c = *__beg;\n\t    if (numeric_limits<_ValueT>::is_signed)\n\t      __negative = __c == __lit[__num_base::_S_iminus];\n\t    if ((__negative || __c == __lit[__num_base::_S_iplus])\n\t\t&& !(__lc->_M_use_grouping && __c == __lc->_M_thousands_sep)\n\t\t&& !(__c == __lc->_M_decimal_point))\n\t      {\n\t\tif (++__beg != __end)\n\t\t  __c = *__beg;\n\t\telse\n\t\t  __testeof = true;\n\t      }\n\t  }\n\n\t// Next, look for leading zeros and check required digits\n\t// for base formats.\n\tbool __found_zero = false;\n\tint __sep_pos = 0;\n\twhile (!__testeof)\n\t  {\n\t    if (__lc->_M_use_grouping && __c == __lc->_M_thousands_sep\n\t\t|| __c == __lc->_M_decimal_point)\n\t      break;\n\t    else if (__c == __lit[__num_base::_S_izero] \n\t\t     && (!__found_zero || __base == 10))\n\t      {\n\t\t__found_zero = true;\n\t\t++__sep_pos;\n\t\tif (__basefield == 0)\n\t\t  __base = 8;\n\t\tif (__base == 8)\n\t\t  __sep_pos = 0;\n\t      }\n\t    else if (__found_zero\n\t\t     && (__c == __lit[__num_base::_S_ix]\n\t\t\t || __c == __lit[__num_base::_S_iX]))\n\t      {\n\t\tif (__basefield == 0)\n\t\t  __base = 16;\n\t\tif (__base == 16)\n\t\t  {\n\t\t    __found_zero = false;\n\t\t    __sep_pos = 0;\n\t\t  }\n\t\telse\n\t\t  break;\n\t      }\n\t    else\n\t      break;\n\n\t    if (++__beg != __end)\n\t      {\n\t\t__c = *__beg;\n\t\tif (!__found_zero)\n\t\t  break;\n\t      }\n\t    else\n\t      __testeof = true;\n\t  }\n\t\n\t// At this point, base is determined. If not hex, only allow\n\t// base digits as valid input.\n\tconst size_t __len = (__base == 16 ? __num_base::_S_iend\n\t\t\t      - __num_base::_S_izero : __base);\n\n\t// Extract.\n\tstring __found_grouping;\n\tif (__lc->_M_use_grouping)\n\t  __found_grouping.reserve(32);\n\tbool __testfail = false;\n\tconst __unsigned_type __max = __negative ?\n\t  -numeric_limits<_ValueT>::min() : numeric_limits<_ValueT>::max();\n\tconst __unsigned_type __smax = __max / __base;\n\t__unsigned_type __result = 0;\n\tint __digit = 0;\n\tconst char_type* __lit_zero = __lit + __num_base::_S_izero;\n\n\tif (!__lc->_M_allocated)\n\t  // \"C\" locale\n\t  while (!__testeof)\n\t    {\n\t      __digit = _M_find(__lit_zero, __len, __c);\n\t      if (__digit == -1)\n\t\tbreak;\n\t      \n\t      if (__result > __smax)\n\t\t__testfail = true;\n\t      else\n\t\t{\n\t\t  __result *= __base;\n\t\t  __testfail |= __result > __max - __digit;\n\t\t  __result += __digit;\n\t\t  ++__sep_pos;\n\t\t}\n\t      \n\t      if (++__beg != __end)\n\t\t__c = *__beg;\n\t      else\n\t\t__testeof = true;\n\t    }\n\telse\n\t  while (!__testeof)\n\t    {\n\t      // According to 22.2.2.1.2, p8-9, first look for thousands_sep\n\t      // and decimal_point.\n\t      if (__lc->_M_use_grouping && __c == __lc->_M_thousands_sep)\n\t\t{\n\t\t  // NB: Thousands separator at the beginning of a string\n\t\t  // is a no-no, as is two consecutive thousands separators.\n\t\t  if (__sep_pos)\n\t\t    {\n\t\t      __found_grouping += static_cast<char>(__sep_pos);\n\t\t      __sep_pos = 0;\n\t\t    }\n\t\t  else\n\t\t    {\n\t\t      __testfail = true;\n\t\t      break;\n\t\t    }\n\t\t}\n\t      else if (__c == __lc->_M_decimal_point)\n\t\tbreak;\n\t      else\n\t\t{\n\t\t  const char_type* __q =\n\t\t    __traits_type::find(__lit_zero, __len, __c);\n\t\t  if (!__q)\n\t\t    break;\n\t\t  \n\t\t  __digit = __q - __lit_zero;\n\t\t  if (__digit > 15)\n\t\t    __digit -= 6;\n\t\t  if (__result > __smax)\n\t\t    __testfail = true;\n\t\t  else\n\t\t    {\n\t\t      __result *= __base;\n\t\t      __testfail |= __result > __max - __digit;\n\t\t      __result += __digit;\n\t\t      ++__sep_pos;\n\t\t    }\n\t\t}\n\t      \n\t      if (++__beg != __end)\n\t\t__c = *__beg;\n\t      else\n\t\t__testeof = true;\n\t    }\n\t\n\t// Digit grouping is checked. If grouping and found_grouping don't\n\t// match, then get very very upset, and set failbit.\n\tif (__found_grouping.size())\n\t  {\n\t    // Add the ending grouping.\n\t    __found_grouping += static_cast<char>(__sep_pos);\n\n\t    if (!std::__verify_grouping(__lc->_M_grouping,\n\t\t\t\t\t__lc->_M_grouping_size,\n\t\t\t\t\t__found_grouping))\n\t      __err |= ios_base::failbit;\n\t  }\n\n\tif (!__testfail && (__sep_pos || __found_zero \n\t\t\t    || __found_grouping.size()))\n\t  __v = __negative ? -__result : __result;\n\telse\n\t  __err |= ios_base::failbit;\n\n\tif (__testeof)\n\t  __err |= ios_base::eofbit;\n\treturn __beg;\n      }\n\n  // _GLIBCXX_RESOLVE_LIB_DEFECTS\n  // 17.  Bad bool parsing\n  template<typename _CharT, typename _InIter>\n    _InIter\n    num_get<_CharT, _InIter>::\n    do_get(iter_type __beg, iter_type __end, ios_base& __io,\n           ios_base::iostate& __err, bool& __v) const\n    {\n      if (!(__io.flags() & ios_base::boolalpha))\n        {\n\t  // Parse bool values as long.\n          // NB: We can't just call do_get(long) here, as it might\n          // refer to a derived class.\n\t  long __l = -1;\n          __beg = _M_extract_int(__beg, __end, __io, __err, __l);\n\t  if (__l == 0 || __l == 1)\n\t    __v = __l;\n\t  else\n            __err |= ios_base::failbit;\n        }\n      else\n        {\n\t  // Parse bool values as alphanumeric.\n\t  typedef __numpunct_cache<_CharT>              __cache_type;\n\t  __use_cache<__cache_type> __uc;\n\t  const locale& __loc = __io._M_getloc();\n\t  const __cache_type* __lc = __uc(__loc);\n\n\t  bool __testf = true;\n\t  bool __testt = true;\n\t  size_t __n;\n\t  bool __testeof = __beg == __end;\n          for (__n = 0; !__testeof; ++__n)\n            {\n\t      const char_type __c = *__beg;\n\n\t      if (__testf)\n\t\tif (__n < __lc->_M_falsename_size)\n\t\t  __testf = __c == __lc->_M_falsename[__n];\n\t\telse\n\t\t  break;\n\n\t      if (__testt)\n\t\tif (__n < __lc->_M_truename_size)\n\t\t  __testt = __c == __lc->_M_truename[__n];\n\t\telse\n\t\t  break;\n\n\t      if (!__testf && !__testt)\n\t\tbreak;\n\t      \n\t      if (++__beg == __end)\n\t\t__testeof = true;\n            }\n\t  if (__testf && __n == __lc->_M_falsename_size)\n\t    __v = 0;\n\t  else if (__testt && __n == __lc->_M_truename_size)\n\t    __v = 1;\n\t  else\n\t    __err |= ios_base::failbit;\n\n          if (__testeof)\n            __err |= ios_base::eofbit;\n        }\n      return __beg;\n    }\n\n  template<typename _CharT, typename _InIter>\n    _InIter\n    num_get<_CharT, _InIter>::\n    do_get(iter_type __beg, iter_type __end, ios_base& __io,\n           ios_base::iostate& __err, long& __v) const\n    { return _M_extract_int(__beg, __end, __io, __err, __v); }\n\n  template<typename _CharT, typename _InIter>\n    _InIter\n    num_get<_CharT, _InIter>::\n    do_get(iter_type __beg, iter_type __end, ios_base& __io,\n           ios_base::iostate& __err, unsigned short& __v) const\n    { return _M_extract_int(__beg, __end, __io, __err, __v); }\n\n  template<typename _CharT, typename _InIter>\n    _InIter\n    num_get<_CharT, _InIter>::\n    do_get(iter_type __beg, iter_type __end, ios_base& __io,\n           ios_base::iostate& __err, unsigned int& __v) const\n    { return _M_extract_int(__beg, __end, __io, __err, __v); }\n\n  template<typename _CharT, typename _InIter>\n    _InIter\n    num_get<_CharT, _InIter>::\n    do_get(iter_type __beg, iter_type __end, ios_base& __io,\n           ios_base::iostate& __err, unsigned long& __v) const\n    { return _M_extract_int(__beg, __end, __io, __err, __v); }\n\n#ifdef _GLIBCXX_USE_LONG_LONG\n  template<typename _CharT, typename _InIter>\n    _InIter\n    num_get<_CharT, _InIter>::\n    do_get(iter_type __beg, iter_type __end, ios_base& __io,\n           ios_base::iostate& __err, long long& __v) const\n    { return _M_extract_int(__beg, __end, __io, __err, __v); }\n\n  template<typename _CharT, typename _InIter>\n    _InIter\n    num_get<_CharT, _InIter>::\n    do_get(iter_type __beg, iter_type __end, ios_base& __io,\n           ios_base::iostate& __err, unsigned long long& __v) const\n    { return _M_extract_int(__beg, __end, __io, __err, __v); }\n#endif\n\n  template<typename _CharT, typename _InIter>\n    _InIter\n    num_get<_CharT, _InIter>::\n    do_get(iter_type __beg, iter_type __end, ios_base& __io,\n\t   ios_base::iostate& __err, float& __v) const\n    {\n      string __xtrc;\n      __xtrc.reserve(32);\n      __beg = _M_extract_float(__beg, __end, __io, __err, __xtrc);\n      std::__convert_to_v(__xtrc.c_str(), __v, __err, _S_get_c_locale());\n      return __beg;\n    }\n\n  template<typename _CharT, typename _InIter>\n    _InIter\n    num_get<_CharT, _InIter>::\n    do_get(iter_type __beg, iter_type __end, ios_base& __io,\n           ios_base::iostate& __err, double& __v) const\n    {\n      string __xtrc;\n      __xtrc.reserve(32);\n      __beg = _M_extract_float(__beg, __end, __io, __err, __xtrc);\n      std::__convert_to_v(__xtrc.c_str(), __v, __err, _S_get_c_locale());\n      return __beg;\n    }\n\n#if defined _GLIBCXX_LONG_DOUBLE_COMPAT && defined __LONG_DOUBLE_128__\n  template<typename _CharT, typename _InIter>\n    _InIter\n    num_get<_CharT, _InIter>::\n    __do_get(iter_type __beg, iter_type __end, ios_base& __io,\n\t     ios_base::iostate& __err, double& __v) const\n    {\n      string __xtrc;\n      __xtrc.reserve(32);\n      __beg = _M_extract_float(__beg, __end, __io, __err, __xtrc);\n      std::__convert_to_v(__xtrc.c_str(), __v, __err, _S_get_c_locale());\n      return __beg;\n    }\n#endif\n\n  template<typename _CharT, typename _InIter>\n    _InIter\n    num_get<_CharT, _InIter>::\n    do_get(iter_type __beg, iter_type __end, ios_base& __io,\n           ios_base::iostate& __err, long double& __v) const\n    {\n      string __xtrc;\n      __xtrc.reserve(32);\n      __beg = _M_extract_float(__beg, __end, __io, __err, __xtrc);\n      std::__convert_to_v(__xtrc.c_str(), __v, __err, _S_get_c_locale());\n      return __beg;\n    }\n\n  template<typename _CharT, typename _InIter>\n    _InIter\n    num_get<_CharT, _InIter>::\n    do_get(iter_type __beg, iter_type __end, ios_base& __io,\n           ios_base::iostate& __err, void*& __v) const\n    {\n      // Prepare for hex formatted input.\n      typedef ios_base::fmtflags        fmtflags;\n      const fmtflags __fmt = __io.flags();\n      __io.flags(__fmt & ~ios_base::basefield | ios_base::hex);\n\n      unsigned long __ul;\n      __beg = _M_extract_int(__beg, __end, __io, __err, __ul);\n\n      // Reset from hex formatted input.\n      __io.flags(__fmt);\n\n      if (!(__err & ios_base::failbit))\n\t__v = reinterpret_cast<void*>(__ul);\n      return __beg;\n    }\n\n  // For use by integer and floating-point types after they have been\n  // converted into a char_type string.\n  template<typename _CharT, typename _OutIter>\n    void\n    num_put<_CharT, _OutIter>::\n    _M_pad(_CharT __fill, streamsize __w, ios_base& __io,\n\t   _CharT* __new, const _CharT* __cs, int& __len) const\n    {\n      // [22.2.2.2.2] Stage 3.\n      // If necessary, pad.\n      __pad<_CharT, char_traits<_CharT> >::_S_pad(__io, __fill, __new, __cs,\n\t\t\t\t\t\t  __w, __len, true);\n      __len = static_cast<int>(__w);\n    }\n\n_GLIBCXX_END_LDBL_NAMESPACE\n\n  template<typename _CharT, typename _ValueT>\n    int\n    __int_to_char(_CharT* __bufend, _ValueT __v, const _CharT* __lit,\n\t\t  ios_base::fmtflags __flags, bool __dec)\n    {\n      _CharT* __buf = __bufend;\n      if (__builtin_expect(__dec, true))\n\t{\n\t  // Decimal.\n\t  do\n\t    {\n\t      *--__buf = __lit[(__v % 10) + __num_base::_S_odigits];\n\t      __v /= 10;\n\t    }\n\t  while (__v != 0);\n\t}\n      else if ((__flags & ios_base::basefield) == ios_base::oct)\n\t{\n\t  // Octal.\n\t  do\n\t    {\n\t      *--__buf = __lit[(__v & 0x7) + __num_base::_S_odigits];\n\t      __v >>= 3;\n\t    }\n\t  while (__v != 0);\n\t}\n      else\n\t{\n\t  // Hex.\n\t  const bool __uppercase = __flags & ios_base::uppercase;\n\t  const int __case_offset = __uppercase ? __num_base::_S_oudigits\n\t                                        : __num_base::_S_odigits;\n\t  do\n\t    {\n\t      *--__buf = __lit[(__v & 0xf) + __case_offset];\n\t      __v >>= 4;\n\t    }\n\t  while (__v != 0);\n\t}\n      return __bufend - __buf;\n    }\n\n_GLIBCXX_BEGIN_LDBL_NAMESPACE\n\n  template<typename _CharT, typename _OutIter>\n    void\n    num_put<_CharT, _OutIter>::\n    _M_group_int(const char* __grouping, size_t __grouping_size, _CharT __sep,\n\t\t ios_base&, _CharT* __new, _CharT* __cs, int& __len) const\n    {\n      _CharT* __p = std::__add_grouping(__new, __sep, __grouping,\n\t\t\t\t\t__grouping_size, __cs, __cs + __len);\n      __len = __p - __new;\n    }\n  \n  template<typename _CharT, typename _OutIter>\n    template<typename _ValueT>\n      _OutIter\n      num_put<_CharT, _OutIter>::\n      _M_insert_int(_OutIter __s, ios_base& __io, _CharT __fill,\n\t\t    _ValueT __v) const\n      {\n\tusing __gnu_cxx::__add_unsigned;\n\ttypedef typename __add_unsigned<_ValueT>::__type __unsigned_type;\n\ttypedef __numpunct_cache<_CharT>\t             __cache_type;\n\t__use_cache<__cache_type> __uc;\n\tconst locale& __loc = __io._M_getloc();\n\tconst __cache_type* __lc = __uc(__loc);\n\tconst _CharT* __lit = __lc->_M_atoms_out;\n\tconst ios_base::fmtflags __flags = __io.flags();\n\n\t// Long enough to hold hex, dec, and octal representations.\n\tconst int __ilen = 5 * sizeof(_ValueT);\n\t_CharT* __cs = static_cast<_CharT*>(__builtin_alloca(sizeof(_CharT)\n\t\t\t\t\t\t\t     * __ilen));\n\n\t// [22.2.2.2.2] Stage 1, numeric conversion to character.\n\t// Result is returned right-justified in the buffer.\n\tconst ios_base::fmtflags __basefield = __flags & ios_base::basefield;\n\tconst bool __dec = (__basefield != ios_base::oct\n\t\t\t    && __basefield != ios_base::hex);\n\tconst __unsigned_type __u = (__v > 0 || !__dec) ? __v : -__v;\n \tint __len = __int_to_char(__cs + __ilen, __u, __lit, __flags, __dec);\n\t__cs += __ilen - __len;\n\n\t// Add grouping, if necessary.\n\tif (__lc->_M_use_grouping)\n\t  {\n\t    // Grouping can add (almost) as many separators as the number\n\t    // of digits + space is reserved for numeric base or sign.\n\t    _CharT* __cs2 = static_cast<_CharT*>(__builtin_alloca(sizeof(_CharT)\n\t\t\t\t\t\t\t\t  * (__len + 1)\n\t\t\t\t\t\t\t\t  * 2));\n\t    _M_group_int(__lc->_M_grouping, __lc->_M_grouping_size,\n\t\t\t __lc->_M_thousands_sep, __io, __cs2 + 2, __cs, __len);\n\t    __cs = __cs2 + 2;\n\t  }\n\n\t// Complete Stage 1, prepend numeric base or sign.\n\tif (__builtin_expect(__dec, true))\n\t  {\n\t    // Decimal.\n\t    if (__v > 0)\n\t      {\n\t\tif (__flags & ios_base::showpos\n\t\t    && numeric_limits<_ValueT>::is_signed)\n\t\t  *--__cs = __lit[__num_base::_S_oplus], ++__len;\n\t      }\n\t    else if (__v)\n\t      *--__cs = __lit[__num_base::_S_ominus], ++__len;\n\t  }\n\telse if (__flags & ios_base::showbase && __v)\n\t  {\n\t    if (__basefield == ios_base::oct)\n\t      *--__cs = __lit[__num_base::_S_odigits], ++__len;\n\t    else\n\t      {\n\t\t// 'x' or 'X'\n\t\tconst bool __uppercase = __flags & ios_base::uppercase;\n\t\t*--__cs = __lit[__num_base::_S_ox + __uppercase];\n\t\t// '0'\n\t\t*--__cs = __lit[__num_base::_S_odigits];\n\t\t__len += 2;\n\t      }\n\t  }\n\n\t// Pad.\n\tconst streamsize __w = __io.width();\n\tif (__w > static_cast<streamsize>(__len))\n\t  {\n\t    _CharT* __cs3 = static_cast<_CharT*>(__builtin_alloca(sizeof(_CharT)\n\t\t\t\t\t\t\t\t  * __w));\n\t    _M_pad(__fill, __w, __io, __cs3, __cs, __len);\n\t    __cs = __cs3;\n\t  }\n\t__io.width(0);\n\n\t// [22.2.2.2.2] Stage 4.\n\t// Write resulting, fully-formatted string to output iterator.\n\treturn std::__write(__s, __cs, __len);\n      }\n\n  template<typename _CharT, typename _OutIter>\n    void\n    num_put<_CharT, _OutIter>::\n    _M_group_float(const char* __grouping, size_t __grouping_size,\n\t\t   _CharT __sep, const _CharT* __p, _CharT* __new,\n\t\t   _CharT* __cs, int& __len) const\n    {\n      // _GLIBCXX_RESOLVE_LIB_DEFECTS\n      // 282. What types does numpunct grouping refer to?\n      // Add grouping, if necessary.\n      const int __declen = __p ? __p - __cs : __len;\n      _CharT* __p2 = std::__add_grouping(__new, __sep, __grouping,\n\t\t\t\t\t __grouping_size,\n\t\t\t\t\t __cs, __cs + __declen);\n\n      // Tack on decimal part.\n      int __newlen = __p2 - __new;\n      if (__p)\n\t{\n\t  char_traits<_CharT>::copy(__p2, __p, __len - __declen);\n\t  __newlen += __len - __declen;\n\t}\n      __len = __newlen;\n    }\n\n  // The following code uses vsnprintf (or vsprintf(), when\n  // _GLIBCXX_USE_C99 is not defined) to convert floating point values\n  // for insertion into a stream.  An optimization would be to replace\n  // them with code that works directly on a wide buffer and then use\n  // __pad to do the padding.  It would be good to replace them anyway\n  // to gain back the efficiency that C++ provides by knowing up front\n  // the type of the values to insert.  Also, sprintf is dangerous\n  // since may lead to accidental buffer overruns.  This\n  // implementation follows the C++ standard fairly directly as\n  // outlined in 22.2.2.2 [lib.locale.num.put]\n  template<typename _CharT, typename _OutIter>\n    template<typename _ValueT>\n      _OutIter\n      num_put<_CharT, _OutIter>::\n      _M_insert_float(_OutIter __s, ios_base& __io, _CharT __fill, char __mod,\n\t\t       _ValueT __v) const\n      {\n\ttypedef __numpunct_cache<_CharT>                __cache_type;\n\t__use_cache<__cache_type> __uc;\n\tconst locale& __loc = __io._M_getloc();\n\tconst __cache_type* __lc = __uc(__loc);\n\n\t// Use default precision if out of range.\n\tconst streamsize __prec = __io.precision() < 0 ? 6 : __io.precision();\n\n\tconst int __max_digits = numeric_limits<_ValueT>::digits10;\n\n\t// [22.2.2.2.2] Stage 1, numeric conversion to character.\n\tint __len;\n\t// Long enough for the max format spec.\n\tchar __fbuf[16];\n\t__num_base::_S_format_float(__io, __fbuf, __mod);\n\n#ifdef _GLIBCXX_USE_C99\n\t// First try a buffer perhaps big enough (most probably sufficient\n\t// for non-ios_base::fixed outputs)\n\tint __cs_size = __max_digits * 3;\n\tchar* __cs = static_cast<char*>(__builtin_alloca(__cs_size));\n\t__len = std::__convert_from_v(_S_get_c_locale(), __cs, __cs_size,\n\t\t\t\t      __fbuf, __prec, __v);\n\n\t// If the buffer was not large enough, try again with the correct size.\n\tif (__len >= __cs_size)\n\t  {\n\t    __cs_size = __len + 1;\n\t    __cs = static_cast<char*>(__builtin_alloca(__cs_size));\n\t    __len = std::__convert_from_v(_S_get_c_locale(), __cs, __cs_size,\n\t\t\t\t\t  __fbuf, __prec, __v);\n\t  }\n#else\n\t// Consider the possibility of long ios_base::fixed outputs\n\tconst bool __fixed = __io.flags() & ios_base::fixed;\n\tconst int __max_exp = numeric_limits<_ValueT>::max_exponent10;\n\n\t// The size of the output string is computed as follows.\n\t// ios_base::fixed outputs may need up to __max_exp + 1 chars\n\t// for the integer part + __prec chars for the fractional part\n\t// + 3 chars for sign, decimal point, '\\0'. On the other hand,\n\t// for non-fixed outputs __max_digits * 2 + __prec chars are\n\t// largely sufficient.\n\tconst int __cs_size = __fixed ? __max_exp + __prec + 4\n\t                              : __max_digits * 2 + __prec;\n\tchar* __cs = static_cast<char*>(__builtin_alloca(__cs_size));\n\t__len = std::__convert_from_v(_S_get_c_locale(), __cs, 0, __fbuf, \n\t\t\t\t      __prec, __v);\n#endif\n\n\t// [22.2.2.2.2] Stage 2, convert to char_type, using correct\n\t// numpunct.decimal_point() values for '.' and adding grouping.\n\tconst ctype<_CharT>& __ctype = use_facet<ctype<_CharT> >(__loc);\n\t\n\t_CharT* __ws = static_cast<_CharT*>(__builtin_alloca(sizeof(_CharT)\n\t\t\t\t\t\t\t     * __len));\n\t__ctype.widen(__cs, __cs + __len, __ws);\n\t\n\t// Replace decimal point.\n\t_CharT* __wp = 0;\n\tconst char* __p = char_traits<char>::find(__cs, __len, '.');\n\tif (__p)\n\t  {\n\t    __wp = __ws + (__p - __cs);\n\t    *__wp = __lc->_M_decimal_point;\n\t  }\n\t\n\t// Add grouping, if necessary.\n\t// N.B. Make sure to not group things like 2e20, i.e., no decimal\n\t// point, scientific notation.\n\tif (__lc->_M_use_grouping\n\t    && (__wp || __len < 3 || (__cs[1] <= '9' && __cs[2] <= '9'\n\t\t\t\t      && __cs[1] >= '0' && __cs[2] >= '0')))\n\t  {\n\t    // Grouping can add (almost) as many separators as the\n\t    // number of digits, but no more.\n\t    _CharT* __ws2 = static_cast<_CharT*>(__builtin_alloca(sizeof(_CharT)\n\t\t\t\t\t\t\t\t  * __len * 2));\n\t    \n\t    streamsize __off = 0;\n\t    if (__cs[0] == '-' || __cs[0] == '+')\n\t      {\n\t\t__off = 1;\n\t\t__ws2[0] = __ws[0];\n\t\t__len -= 1;\n\t      }\n\t    \n\t    _M_group_float(__lc->_M_grouping, __lc->_M_grouping_size,\n\t\t\t   __lc->_M_thousands_sep, __wp, __ws2 + __off,\n\t\t\t   __ws + __off, __len);\n\t    __len += __off;\n\t    \n\t    __ws = __ws2;\n\t  }\n\n\t// Pad.\n\tconst streamsize __w = __io.width();\n\tif (__w > static_cast<streamsize>(__len))\n\t  {\n\t    _CharT* __ws3 = static_cast<_CharT*>(__builtin_alloca(sizeof(_CharT)\n\t\t\t\t\t\t\t\t  * __w));\n\t    _M_pad(__fill, __w, __io, __ws3, __ws, __len);\n\t    __ws = __ws3;\n\t  }\n\t__io.width(0);\n\t\n\t// [22.2.2.2.2] Stage 4.\n\t// Write resulting, fully-formatted string to output iterator.\n\treturn std::__write(__s, __ws, __len);\n      }\n  \n  template<typename _CharT, typename _OutIter>\n    _OutIter\n    num_put<_CharT, _OutIter>::\n    do_put(iter_type __s, ios_base& __io, char_type __fill, bool __v) const\n    {\n      const ios_base::fmtflags __flags = __io.flags();\n      if ((__flags & ios_base::boolalpha) == 0)\n        {\n          const long __l = __v;\n          __s = _M_insert_int(__s, __io, __fill, __l);\n        }\n      else\n        {\n\t  typedef __numpunct_cache<_CharT>              __cache_type;\n\t  __use_cache<__cache_type> __uc;\n\t  const locale& __loc = __io._M_getloc();\n\t  const __cache_type* __lc = __uc(__loc);\n\n\t  const _CharT* __name = __v ? __lc->_M_truename\n\t                             : __lc->_M_falsename;\n\t  int __len = __v ? __lc->_M_truename_size\n\t                  : __lc->_M_falsename_size;\n\n\t  const streamsize __w = __io.width();\n\t  if (__w > static_cast<streamsize>(__len))\n\t    {\n\t      _CharT* __cs\n\t\t= static_cast<_CharT*>(__builtin_alloca(sizeof(_CharT)\n\t\t\t\t\t\t\t* __w));\n\t      _M_pad(__fill, __w, __io, __cs, __name, __len);\n\t      __name = __cs;\n\t    }\n\t  __io.width(0);\n\t  __s = std::__write(__s, __name, __len);\n\t}\n      return __s;\n    }\n\n  template<typename _CharT, typename _OutIter>\n    _OutIter\n    num_put<_CharT, _OutIter>::\n    do_put(iter_type __s, ios_base& __io, char_type __fill, long __v) const\n    { return _M_insert_int(__s, __io, __fill, __v); }\n\n  template<typename _CharT, typename _OutIter>\n    _OutIter\n    num_put<_CharT, _OutIter>::\n    do_put(iter_type __s, ios_base& __io, char_type __fill,\n           unsigned long __v) const\n    { return _M_insert_int(__s, __io, __fill, __v); }\n\n#ifdef _GLIBCXX_USE_LONG_LONG\n  template<typename _CharT, typename _OutIter>\n    _OutIter\n    num_put<_CharT, _OutIter>::\n    do_put(iter_type __s, ios_base& __io, char_type __fill, long long __v) const\n    { return _M_insert_int(__s, __io, __fill, __v); }\n\n  template<typename _CharT, typename _OutIter>\n    _OutIter\n    num_put<_CharT, _OutIter>::\n    do_put(iter_type __s, ios_base& __io, char_type __fill,\n           unsigned long long __v) const\n    { return _M_insert_int(__s, __io, __fill, __v); }\n#endif\n\n  template<typename _CharT, typename _OutIter>\n    _OutIter\n    num_put<_CharT, _OutIter>::\n    do_put(iter_type __s, ios_base& __io, char_type __fill, double __v) const\n    { return _M_insert_float(__s, __io, __fill, char(), __v); }\n\n#if defined _GLIBCXX_LONG_DOUBLE_COMPAT && defined __LONG_DOUBLE_128__\n  template<typename _CharT, typename _OutIter>\n    _OutIter\n    num_put<_CharT, _OutIter>::\n    __do_put(iter_type __s, ios_base& __io, char_type __fill, double __v) const\n    { return _M_insert_float(__s, __io, __fill, char(), __v); }\n#endif\n\n  template<typename _CharT, typename _OutIter>\n    _OutIter\n    num_put<_CharT, _OutIter>::\n    do_put(iter_type __s, ios_base& __io, char_type __fill,\n\t   long double __v) const\n    { return _M_insert_float(__s, __io, __fill, 'L', __v); }\n\n  template<typename _CharT, typename _OutIter>\n    _OutIter\n    num_put<_CharT, _OutIter>::\n    do_put(iter_type __s, ios_base& __io, char_type __fill,\n           const void* __v) const\n    {\n      const ios_base::fmtflags __flags = __io.flags();\n      const ios_base::fmtflags __fmt = ~(ios_base::basefield\n\t\t\t\t\t | ios_base::uppercase\n\t\t\t\t\t | ios_base::internal);\n      __io.flags(__flags & __fmt | (ios_base::hex | ios_base::showbase));\n\n      __s = _M_insert_int(__s, __io, __fill,\n\t\t\t  reinterpret_cast<unsigned long>(__v));\n      __io.flags(__flags);\n      return __s;\n    }\n\n  template<typename _CharT, typename _InIter>\n    template<bool _Intl>\n      _InIter\n      money_get<_CharT, _InIter>::\n      _M_extract(iter_type __beg, iter_type __end, ios_base& __io,\n\t\t ios_base::iostate& __err, string& __units) const\n      {\n\ttypedef char_traits<_CharT>\t\t\t  __traits_type;\n\ttypedef typename string_type::size_type\t          size_type;\t\n\ttypedef money_base::part\t\t\t  part;\n\ttypedef __moneypunct_cache<_CharT, _Intl>         __cache_type;\n\t\n\tconst locale& __loc = __io._M_getloc();\n\tconst ctype<_CharT>& __ctype = use_facet<ctype<_CharT> >(__loc);\n\n\t__use_cache<__cache_type> __uc;\n\tconst __cache_type* __lc = __uc(__loc);\n\tconst char_type* __lit = __lc->_M_atoms;\n\n\t// Deduced sign.\n\tbool __negative = false;\n\t// Sign size.\n\tsize_type __sign_size = 0;\n\t// True if sign is mandatory.\n\tconst bool __mandatory_sign = (__lc->_M_positive_sign_size\n\t\t\t\t       && __lc->_M_negative_sign_size);\n\t// String of grouping info from thousands_sep plucked from __units.\n\tstring __grouping_tmp;\n\tif (__lc->_M_use_grouping)\n\t  __grouping_tmp.reserve(32);\n\t// Last position before the decimal point.\n\tint __last_pos = 0;\n\t// Separator positions, then, possibly, fractional digits.\n\tint __n = 0;\n\t// If input iterator is in a valid state.\n\tbool __testvalid = true;\n\t// Flag marking when a decimal point is found.\n\tbool __testdecfound = false;\n\n\t// The tentative returned string is stored here.\n\tstring __res;\n\t__res.reserve(32);\n\n\tconst char_type* __lit_zero = __lit + money_base::_S_zero;\n\tconst money_base::pattern __p = __lc->_M_neg_format;\n\tfor (int __i = 0; __i < 4 && __testvalid; ++__i)\n\t  {\n\t    const part __which = static_cast<part>(__p.field[__i]);\n\t    switch (__which)\n\t      {\n\t      case money_base::symbol:\n\t\t// According to 22.2.6.1.2, p2, symbol is required\n\t\t// if (__io.flags() & ios_base::showbase), otherwise\n\t\t// is optional and consumed only if other characters\n\t\t// are needed to complete the format.\n\t\tif (__io.flags() & ios_base::showbase || __sign_size > 1\n\t\t    || __i == 0\n\t\t    || (__i == 1 && (__mandatory_sign\n\t\t\t\t     || (static_cast<part>(__p.field[0])\n\t\t\t\t\t == money_base::sign)\n\t\t\t\t     || (static_cast<part>(__p.field[2])\n\t\t\t\t\t == money_base::space)))\n\t\t    || (__i == 2 && ((static_cast<part>(__p.field[3])\n\t\t\t\t      == money_base::value)\n\t\t\t\t     || __mandatory_sign\n\t\t\t\t     && (static_cast<part>(__p.field[3])\n\t\t\t\t\t == money_base::sign))))\n\t\t  {\n\t\t    const size_type __len = __lc->_M_curr_symbol_size;\n\t\t    size_type __j = 0;\n\t\t    for (; __beg != __end && __j < __len\n\t\t\t   && *__beg == __lc->_M_curr_symbol[__j];\n\t\t\t ++__beg, ++__j);\n\t\t    if (__j != __len\n\t\t\t&& (__j || __io.flags() & ios_base::showbase))\n\t\t      __testvalid = false;\n\t\t  }\n\t\tbreak;\n\t      case money_base::sign:\n\t\t// Sign might not exist, or be more than one character long.\n\t\tif (__lc->_M_positive_sign_size && __beg != __end\n\t\t    && *__beg == __lc->_M_positive_sign[0])\n\t\t  {\n\t\t    __sign_size = __lc->_M_positive_sign_size;\n\t\t    ++__beg;\n\t\t  }\n\t\telse if (__lc->_M_negative_sign_size && __beg != __end\n\t\t\t && *__beg == __lc->_M_negative_sign[0])\n\t\t  {\n\t\t    __negative = true;\n\t\t    __sign_size = __lc->_M_negative_sign_size;\n\t\t    ++__beg;\n\t\t  }\n\t\telse if (__lc->_M_positive_sign_size\n\t\t\t && !__lc->_M_negative_sign_size)\n\t\t  // \"... if no sign is detected, the result is given the sign\n\t\t  // that corresponds to the source of the empty string\"\n\t\t  __negative = true;\n\t\telse if (__mandatory_sign)\n\t\t  __testvalid = false;\n\t\tbreak;\n\t      case money_base::value:\n\t\t// Extract digits, remove and stash away the\n\t\t// grouping of found thousands separators.\n\t\tfor (; __beg != __end; ++__beg)\n\t\t  {\n\t\t    const char_type __c = *__beg;\n\t\t    const char_type* __q = __traits_type::find(__lit_zero, \n\t\t\t\t\t\t\t       10, __c);\n\t\t    if (__q != 0)\n\t\t      {\n\t\t\t__res += money_base::_S_atoms[__q - __lit];\n\t\t\t++__n;\n\t\t      }\n\t\t    else if (__c == __lc->_M_decimal_point \n\t\t\t     && !__testdecfound)\n\t\t      {\n\t\t\t__last_pos = __n;\n\t\t\t__n = 0;\n\t\t\t__testdecfound = true;\n\t\t      }\n\t\t    else if (__lc->_M_use_grouping\n\t\t\t     && __c == __lc->_M_thousands_sep\n\t\t\t     && !__testdecfound)\n\t\t      {\n\t\t\tif (__n)\n\t\t\t  {\n\t\t\t    // Mark position for later analysis.\n\t\t\t    __grouping_tmp += static_cast<char>(__n);\n\t\t\t    __n = 0;\n\t\t\t  }\n\t\t\telse\n\t\t\t  {\n\t\t\t    __testvalid = false;\n\t\t\t    break;\n\t\t\t  }\n\t\t      }\n\t\t    else\n\t\t      break;\n\t\t  }\n\t\tif (__res.empty())\n\t\t  __testvalid = false;\n\t\tbreak;\n\t      case money_base::space:\n\t\t// At least one space is required.\n\t\tif (__beg != __end && __ctype.is(ctype_base::space, *__beg))\n\t\t  ++__beg;\n\t\telse\n\t\t  __testvalid = false;\n\t      case money_base::none:\n\t\t// Only if not at the end of the pattern.\n\t\tif (__i != 3)\n\t\t  for (; __beg != __end\n\t\t\t && __ctype.is(ctype_base::space, *__beg); ++__beg);\n\t\tbreak;\n\t      }\n\t  }\n\n\t// Need to get the rest of the sign characters, if they exist.\n\tif (__sign_size > 1 && __testvalid)\n\t  {\n\t    const char_type* __sign = __negative ? __lc->_M_negative_sign\n\t                                         : __lc->_M_positive_sign;\n\t    size_type __i = 1;\n\t    for (; __beg != __end && __i < __sign_size\n\t\t   && *__beg == __sign[__i]; ++__beg, ++__i);\n\t    \n\t    if (__i != __sign_size)\n\t      __testvalid = false;\n\t  }\n\n\tif (__testvalid)\n\t  {\n\t    // Strip leading zeros.\n\t    if (__res.size() > 1)\n\t      {\n\t\tconst size_type __first = __res.find_first_not_of('0');\n\t\tconst bool __only_zeros = __first == string::npos;\n\t\tif (__first)\n\t\t  __res.erase(0, __only_zeros ? __res.size() - 1 : __first);\n\t      }\n\n\t    // 22.2.6.1.2, p4\n\t    if (__negative && __res[0] != '0')\n\t      __res.insert(__res.begin(), '-');\n\t    \n\t    // Test for grouping fidelity.\n\t    if (__grouping_tmp.size())\n\t      {\n\t\t// Add the ending grouping.\n\t\t__grouping_tmp += static_cast<char>(__testdecfound ? __last_pos\n\t\t\t\t\t\t                   : __n);\n\t\tif (!std::__verify_grouping(__lc->_M_grouping,\n\t\t\t\t\t    __lc->_M_grouping_size,\n\t\t\t\t\t    __grouping_tmp))\n\t\t  __err |= ios_base::failbit;\n\t      }\n\t    \n\t    // Iff not enough digits were supplied after the decimal-point.\n\t    if (__testdecfound && __lc->_M_frac_digits > 0\n\t\t&& __n != __lc->_M_frac_digits)\n\t      __testvalid = false;\n\t  }\n\t\n\t// Iff valid sequence is not recognized.\n\tif (!__testvalid)\n\t  __err |= ios_base::failbit;\n\telse\n\t  __units.swap(__res);\n\t\n\t// Iff no more characters are available.\n\tif (__beg == __end)\n\t  __err |= ios_base::eofbit;\n\treturn __beg;\n      }\n\n#if defined _GLIBCXX_LONG_DOUBLE_COMPAT && defined __LONG_DOUBLE_128__\n  template<typename _CharT, typename _InIter>\n    _InIter\n    money_get<_CharT, _InIter>::\n    __do_get(iter_type __beg, iter_type __end, bool __intl, ios_base& __io,\n\t     ios_base::iostate& __err, double& __units) const\n    {\n      string __str;\n      __beg = __intl ? _M_extract<true>(__beg, __end, __io, __err, __str)\n                     : _M_extract<false>(__beg, __end, __io, __err, __str);\n      std::__convert_to_v(__str.c_str(), __units, __err, _S_get_c_locale());\n      return __beg;\n    }\n#endif\n\n  template<typename _CharT, typename _InIter>\n    _InIter\n    money_get<_CharT, _InIter>::\n    do_get(iter_type __beg, iter_type __end, bool __intl, ios_base& __io,\n\t   ios_base::iostate& __err, long double& __units) const\n    {\n      string __str;\n      __beg = __intl ? _M_extract<true>(__beg, __end, __io, __err, __str)\n\t             : _M_extract<false>(__beg, __end, __io, __err, __str);\n      std::__convert_to_v(__str.c_str(), __units, __err, _S_get_c_locale());\n      return __beg;\n    }\n\n  template<typename _CharT, typename _InIter>\n    _InIter\n    money_get<_CharT, _InIter>::\n    do_get(iter_type __beg, iter_type __end, bool __intl, ios_base& __io,\n\t   ios_base::iostate& __err, string_type& __digits) const\n    {\n      typedef typename string::size_type                  size_type;\n\n      const locale& __loc = __io._M_getloc();\n      const ctype<_CharT>& __ctype = use_facet<ctype<_CharT> >(__loc);\n\n      string __str;\n      __beg = __intl ? _M_extract<true>(__beg, __end, __io, __err, __str)\n\t             : _M_extract<false>(__beg, __end, __io, __err, __str);\n      const size_type __len = __str.size();\n      if (__len)\n\t{\n\t  __digits.resize(__len);\n\t  __ctype.widen(__str.data(), __str.data() + __len, &__digits[0]);\n\t}\n      return __beg;\n    }\n\n  template<typename _CharT, typename _OutIter>\n    template<bool _Intl>\n      _OutIter\n      money_put<_CharT, _OutIter>::\n      _M_insert(iter_type __s, ios_base& __io, char_type __fill,\n\t\tconst string_type& __digits) const\n      {\n\ttypedef typename string_type::size_type\t          size_type;\n\ttypedef money_base::part                          part;\n\ttypedef __moneypunct_cache<_CharT, _Intl>         __cache_type;\n      \n\tconst locale& __loc = __io._M_getloc();\n\tconst ctype<_CharT>& __ctype = use_facet<ctype<_CharT> >(__loc);\n\n\t__use_cache<__cache_type> __uc;\n\tconst __cache_type* __lc = __uc(__loc);\n\tconst char_type* __lit = __lc->_M_atoms;\n\n\t// Determine if negative or positive formats are to be used, and\n\t// discard leading negative_sign if it is present.\n\tconst char_type* __beg = __digits.data();\n\n\tmoney_base::pattern __p;\n\tconst char_type* __sign;\n\tsize_type __sign_size;\n\tif (!(*__beg == __lit[money_base::_S_minus]))\n\t  {\n\t    __p = __lc->_M_pos_format;\n\t    __sign = __lc->_M_positive_sign;\n\t    __sign_size = __lc->_M_positive_sign_size;\n\t  }\n\telse\n\t  {\n\t    __p = __lc->_M_neg_format;\n\t    __sign = __lc->_M_negative_sign;\n\t    __sign_size = __lc->_M_negative_sign_size;\n\t    if (__digits.size())\n\t      ++__beg;\n\t  }\n       \n\t// Look for valid numbers in the ctype facet within input digits.\n\tsize_type __len = __ctype.scan_not(ctype_base::digit, __beg,\n\t\t\t\t\t   __beg + __digits.size()) - __beg;\n\tif (__len)\n\t  {\n\t    // Assume valid input, and attempt to format.\n\t    // Break down input numbers into base components, as follows:\n\t    //   final_value = grouped units + (decimal point) + (digits)\n\t    string_type __value;\n\t    __value.reserve(2 * __len);\n\n\t    // Add thousands separators to non-decimal digits, per\n\t    // grouping rules.\n\t    long __paddec = __len - __lc->_M_frac_digits;\n\t    if (__paddec > 0)\n  \t      {\n\t\tif (__lc->_M_frac_digits < 0)\n\t\t  __paddec = __len;\n  \t\tif (__lc->_M_grouping_size)\n  \t\t  {\n\t\t    __value.assign(2 * __paddec, char_type());\n \t\t    _CharT* __vend = \n\t\t      std::__add_grouping(&__value[0], __lc->_M_thousands_sep,\n\t\t\t\t\t  __lc->_M_grouping,\n\t\t\t\t\t  __lc->_M_grouping_size,\n\t\t\t\t\t  __beg, __beg + __paddec);\n\t\t    __value.erase(__vend - &__value[0]);\n  \t\t  }\n  \t\telse\n\t\t  __value.assign(__beg, __paddec);\n\t      }\n\n\t    // Deal with decimal point, decimal digits.\n\t    if (__lc->_M_frac_digits > 0)\n\t      {\n\t\t__value += __lc->_M_decimal_point;\n\t\tif (__paddec >= 0)\n\t\t  __value.append(__beg + __paddec, __lc->_M_frac_digits);\n\t\telse\n\t\t  {\n\t\t    // Have to pad zeros in the decimal position.\n\t\t    __value.append(-__paddec, __lit[money_base::_S_zero]);\n\t\t    __value.append(__beg, __len);\n\t\t  }\n  \t      }\n  \n\t    // Calculate length of resulting string.\n\t    const ios_base::fmtflags __f = __io.flags() \n\t                                   & ios_base::adjustfield;\n\t    __len = __value.size() + __sign_size;\n\t    __len += ((__io.flags() & ios_base::showbase)\n\t\t      ? __lc->_M_curr_symbol_size : 0);\n\n\t    string_type __res;\n\t    __res.reserve(2 * __len);\n\t    \n\t    const size_type __width = static_cast<size_type>(__io.width());  \n\t    const bool __testipad = (__f == ios_base::internal\n\t\t\t\t     && __len < __width);\n\t    // Fit formatted digits into the required pattern.\n\t    for (int __i = 0; __i < 4; ++__i)\n\t      {\n\t\tconst part __which = static_cast<part>(__p.field[__i]);\n\t\tswitch (__which)\n\t\t  {\n\t\t  case money_base::symbol:\n\t\t    if (__io.flags() & ios_base::showbase)\n\t\t      __res.append(__lc->_M_curr_symbol,\n\t\t\t\t   __lc->_M_curr_symbol_size);\n\t\t    break;\n\t\t  case money_base::sign:\n\t\t    // Sign might not exist, or be more than one\n\t\t    // charater long. In that case, add in the rest\n\t\t    // below.\n\t\t    if (__sign_size)\n\t\t      __res += __sign[0];\n\t\t    break;\n\t\t  case money_base::value:\n\t\t    __res += __value;\n\t\t    break;\n\t\t  case money_base::space:\n\t\t    // At least one space is required, but if internal\n\t\t    // formatting is required, an arbitrary number of\n\t\t    // fill spaces will be necessary.\n\t\t    if (__testipad)\n\t\t      __res.append(__width - __len, __fill);\n\t\t    else\n\t\t      __res += __fill;\n\t\t    break;\n\t\t  case money_base::none:\n\t\t    if (__testipad)\n\t\t      __res.append(__width - __len, __fill);\n\t\t    break;\n\t\t  }\n\t      }\n\t    \n\t    // Special case of multi-part sign parts.\n\t    if (__sign_size > 1)\n\t      __res.append(__sign + 1, __sign_size - 1);\n\t    \n\t    // Pad, if still necessary.\n\t    __len = __res.size();\n\t    if (__width > __len)\n\t      {\n\t\tif (__f == ios_base::left)\n\t\t  // After.\n\t\t  __res.append(__width - __len, __fill);\n\t\telse\n\t\t  // Before.\n\t\t  __res.insert(0, __width - __len, __fill);\n\t\t__len = __width;\n\t      }\n\t    \n\t    // Write resulting, fully-formatted string to output iterator.\n\t    __s = std::__write(__s, __res.data(), __len);\n\t  }\n\t__io.width(0);\n\treturn __s;    \n      }\n\n#if defined _GLIBCXX_LONG_DOUBLE_COMPAT && defined __LONG_DOUBLE_128__\n  template<typename _CharT, typename _OutIter>\n    _OutIter\n    money_put<_CharT, _OutIter>::\n    __do_put(iter_type __s, bool __intl, ios_base& __io, char_type __fill,\n\t     double __units) const\n    { return this->do_put(__s, __intl, __io, __fill, (long double) __units); }\n#endif\n\n  template<typename _CharT, typename _OutIter>\n    _OutIter\n    money_put<_CharT, _OutIter>::\n    do_put(iter_type __s, bool __intl, ios_base& __io, char_type __fill,\n\t   long double __units) const\n    {\n      const locale __loc = __io.getloc();\n      const ctype<_CharT>& __ctype = use_facet<ctype<_CharT> >(__loc);\n#ifdef _GLIBCXX_USE_C99\n      // First try a buffer perhaps big enough.\n      int __cs_size = 64;\n      char* __cs = static_cast<char*>(__builtin_alloca(__cs_size));\n      // _GLIBCXX_RESOLVE_LIB_DEFECTS\n      // 328. Bad sprintf format modifier in money_put<>::do_put()\n      int __len = std::__convert_from_v(_S_get_c_locale(), __cs, __cs_size,\n\t\t\t\t\t\"%.*Lf\", 0, __units);\n      // If the buffer was not large enough, try again with the correct size.\n      if (__len >= __cs_size)\n\t{\n\t  __cs_size = __len + 1;\n\t  __cs = static_cast<char*>(__builtin_alloca(__cs_size));\n\t  __len = std::__convert_from_v(_S_get_c_locale(), __cs, __cs_size,\n\t\t\t\t\t\"%.*Lf\", 0, __units);\n\t}\n#else\n      // max_exponent10 + 1 for the integer part, + 2 for sign and '\\0'.\n      const int __cs_size = numeric_limits<long double>::max_exponent10 + 3;\n      char* __cs = static_cast<char*>(__builtin_alloca(__cs_size));\n      int __len = std::__convert_from_v(_S_get_c_locale(), __cs, 0, \"%.*Lf\", \n\t\t\t\t\t0, __units);\n#endif\n      string_type __digits(__len, char_type());\n      __ctype.widen(__cs, __cs + __len, &__digits[0]);\n      return __intl ? _M_insert<true>(__s, __io, __fill, __digits)\n\t            : _M_insert<false>(__s, __io, __fill, __digits);\n    }\n\n  template<typename _CharT, typename _OutIter>\n    _OutIter\n    money_put<_CharT, _OutIter>::\n    do_put(iter_type __s, bool __intl, ios_base& __io, char_type __fill,\n\t   const string_type& __digits) const\n    { return __intl ? _M_insert<true>(__s, __io, __fill, __digits)\n\t            : _M_insert<false>(__s, __io, __fill, __digits); }\n\n_GLIBCXX_END_LDBL_NAMESPACE\n\n  // NB: Not especially useful. Without an ios_base object or some\n  // kind of locale reference, we are left clawing at the air where\n  // the side of the mountain used to be...\n  template<typename _CharT, typename _InIter>\n    time_base::dateorder\n    time_get<_CharT, _InIter>::do_date_order() const\n    { return time_base::no_order; }\n\n  // Expand a strftime format string and parse it.  E.g., do_get_date() may\n  // pass %m/%d/%Y => extracted characters.\n  template<typename _CharT, typename _InIter>\n    _InIter\n    time_get<_CharT, _InIter>::\n    _M_extract_via_format(iter_type __beg, iter_type __end, ios_base& __io,\n\t\t\t  ios_base::iostate& __err, tm* __tm,\n\t\t\t  const _CharT* __format) const\n    {\n      const locale& __loc = __io._M_getloc();\n      const __timepunct<_CharT>& __tp = use_facet<__timepunct<_CharT> >(__loc);\n      const ctype<_CharT>& __ctype = use_facet<ctype<_CharT> >(__loc);\n      const size_t __len = char_traits<_CharT>::length(__format);\n\n      ios_base::iostate __tmperr = ios_base::goodbit;\n      for (size_t __i = 0; __beg != __end && __i < __len && !__tmperr; ++__i)\n\t{\n\t  if (__ctype.narrow(__format[__i], 0) == '%')\n\t    {\n\t      // Verify valid formatting code, attempt to extract.\n\t      char __c = __ctype.narrow(__format[++__i], 0);\n\t      int __mem = 0;\n\t      if (__c == 'E' || __c == 'O')\n\t\t__c = __ctype.narrow(__format[++__i], 0);\n\t      switch (__c)\n\t\t{\n\t\t  const char* __cs;\n\t\t  _CharT __wcs[10];\n\t\tcase 'a':\n\t\t  // Abbreviated weekday name [tm_wday]\n\t\t  const char_type*  __days1[7];\n\t\t  __tp._M_days_abbreviated(__days1);\n\t\t  __beg = _M_extract_name(__beg, __end, __tm->tm_wday, __days1,\n\t\t\t\t\t  7, __io, __tmperr);\n\t\t  break;\n\t\tcase 'A':\n\t\t  // Weekday name [tm_wday].\n\t\t  const char_type*  __days2[7];\n\t\t  __tp._M_days(__days2);\n\t\t  __beg = _M_extract_name(__beg, __end, __tm->tm_wday, __days2,\n\t\t\t\t\t  7, __io, __tmperr);\n\t\t  break;\n\t\tcase 'h':\n\t\tcase 'b':\n\t\t  // Abbreviated month name [tm_mon]\n\t\t  const char_type*  __months1[12];\n\t\t  __tp._M_months_abbreviated(__months1);\n\t\t  __beg = _M_extract_name(__beg, __end, __tm->tm_mon, \n\t\t\t\t\t  __months1, 12, __io, __tmperr);\n\t\t  break;\n\t\tcase 'B':\n\t\t  // Month name [tm_mon].\n\t\t  const char_type*  __months2[12];\n\t\t  __tp._M_months(__months2);\n\t\t  __beg = _M_extract_name(__beg, __end, __tm->tm_mon, \n\t\t\t\t\t  __months2, 12, __io, __tmperr);\n\t\t  break;\n\t\tcase 'c':\n\t\t  // Default time and date representation.\n\t\t  const char_type*  __dt[2];\n\t\t  __tp._M_date_time_formats(__dt);\n\t\t  __beg = _M_extract_via_format(__beg, __end, __io, __tmperr, \n\t\t\t\t\t\t__tm, __dt[0]);\n\t\t  break;\n\t\tcase 'd':\n\t\t  // Day [01, 31]. [tm_mday]\n\t\t  __beg = _M_extract_num(__beg, __end, __tm->tm_mday, 1, 31, 2,\n\t\t\t\t\t __io, __tmperr);\n\t\t  break;\n\t\tcase 'e':\n\t\t  // Day [1, 31], with single digits preceded by\n\t\t  // space. [tm_mday]\n\t\t  if (__ctype.is(ctype_base::space, *__beg))\n\t\t    __beg = _M_extract_num(++__beg, __end, __tm->tm_mday, 1, 9,\n\t\t\t\t\t   1, __io, __tmperr);\n\t\t  else\n\t\t    __beg = _M_extract_num(__beg, __end, __tm->tm_mday, 10, 31,\n\t\t\t\t\t   2, __io, __tmperr);\n\t\t  break;\n\t\tcase 'D':\n\t\t  // Equivalent to %m/%d/%y.[tm_mon, tm_mday, tm_year]\n\t\t  __cs = \"%m/%d/%y\";\n\t\t  __ctype.widen(__cs, __cs + 9, __wcs);\n\t\t  __beg = _M_extract_via_format(__beg, __end, __io, __tmperr, \n\t\t\t\t\t\t__tm, __wcs);\n\t\t  break;\n\t\tcase 'H':\n\t\t  // Hour [00, 23]. [tm_hour]\n\t\t  __beg = _M_extract_num(__beg, __end, __tm->tm_hour, 0, 23, 2,\n\t\t\t\t\t __io, __tmperr);\n\t\t  break;\n\t\tcase 'I':\n\t\t  // Hour [01, 12]. [tm_hour]\n\t\t  __beg = _M_extract_num(__beg, __end, __tm->tm_hour, 1, 12, 2,\n\t\t\t\t\t __io, __tmperr);\n\t\t  break;\n\t\tcase 'm':\n\t\t  // Month [01, 12]. [tm_mon]\n\t\t  __beg = _M_extract_num(__beg, __end, __mem, 1, 12, 2, \n\t\t\t\t\t __io, __tmperr);\n\t\t  if (!__tmperr)\n\t\t    __tm->tm_mon = __mem - 1;\n\t\t  break;\n\t\tcase 'M':\n\t\t  // Minute [00, 59]. [tm_min]\n\t\t  __beg = _M_extract_num(__beg, __end, __tm->tm_min, 0, 59, 2,\n\t\t\t\t\t __io, __tmperr);\n\t\t  break;\n\t\tcase 'n':\n\t\t  if (__ctype.narrow(*__beg, 0) == '\\n')\n\t\t    ++__beg;\n\t\t  else\n\t\t    __tmperr |= ios_base::failbit;\n\t\t  break;\n\t\tcase 'R':\n\t\t  // Equivalent to (%H:%M).\n\t\t  __cs = \"%H:%M\";\n\t\t  __ctype.widen(__cs, __cs + 6, __wcs);\n\t\t  __beg = _M_extract_via_format(__beg, __end, __io, __tmperr, \n\t\t\t\t\t\t__tm, __wcs);\n\t\t  break;\n\t\tcase 'S':\n\t\t  // Seconds. [tm_sec]\n\t\t  // [00, 60] in C99 (one leap-second), [00, 61] in C89.\n#ifdef _GLIBCXX_USE_C99\n\t\t  __beg = _M_extract_num(__beg, __end, __tm->tm_sec, 0, 60, 2,\n#else\n\t\t  __beg = _M_extract_num(__beg, __end, __tm->tm_sec, 0, 61, 2,\n#endif\n\t\t\t\t\t __io, __tmperr);\n\t\t  break;\n\t\tcase 't':\n\t\t  if (__ctype.narrow(*__beg, 0) == '\\t')\n\t\t    ++__beg;\n\t\t  else\n\t\t    __tmperr |= ios_base::failbit;\n\t\t  break;\n\t\tcase 'T':\n\t\t  // Equivalent to (%H:%M:%S).\n\t\t  __cs = \"%H:%M:%S\";\n\t\t  __ctype.widen(__cs, __cs + 9, __wcs);\n\t\t  __beg = _M_extract_via_format(__beg, __end, __io, __tmperr, \n\t\t\t\t\t\t__tm, __wcs);\n\t\t  break;\n\t\tcase 'x':\n\t\t  // Locale's date.\n\t\t  const char_type*  __dates[2];\n\t\t  __tp._M_date_formats(__dates);\n\t\t  __beg = _M_extract_via_format(__beg, __end, __io, __tmperr, \n\t\t\t\t\t\t__tm, __dates[0]);\n\t\t  break;\n\t\tcase 'X':\n\t\t  // Locale's time.\n\t\t  const char_type*  __times[2];\n\t\t  __tp._M_time_formats(__times);\n\t\t  __beg = _M_extract_via_format(__beg, __end, __io, __tmperr, \n\t\t\t\t\t\t__tm, __times[0]);\n\t\t  break;\n\t\tcase 'y':\n\t\tcase 'C': // C99\n\t\t  // Two digit year. [tm_year]\n\t\t  __beg = _M_extract_num(__beg, __end, __tm->tm_year, 0, 99, 2,\n\t\t\t\t\t __io, __tmperr);\n\t\t  break;\n\t\tcase 'Y':\n\t\t  // Year [1900). [tm_year]\n\t\t  __beg = _M_extract_num(__beg, __end, __mem, 0, 9999, 4,\n\t\t\t\t\t __io, __tmperr);\n\t\t  if (!__tmperr)\n\t\t    __tm->tm_year = __mem - 1900;\n\t\t  break;\n\t\tcase 'Z':\n\t\t  // Timezone info.\n\t\t  if (__ctype.is(ctype_base::upper, *__beg))\n\t\t    {\n\t\t      int __tmp;\n\t\t      __beg = _M_extract_name(__beg, __end, __tmp,\n\t\t\t\t       __timepunct_cache<_CharT>::_S_timezones,\n\t\t\t\t\t      14, __io, __tmperr);\n\n\t\t      // GMT requires special effort.\n\t\t      if (__beg != __end && !__tmperr && __tmp == 0\n\t\t\t  && (*__beg == __ctype.widen('-')\n\t\t\t      || *__beg == __ctype.widen('+')))\n\t\t\t{\n\t\t\t  __beg = _M_extract_num(__beg, __end, __tmp, 0, 23, 2,\n\t\t\t\t\t\t __io, __tmperr);\n\t\t\t  __beg = _M_extract_num(__beg, __end, __tmp, 0, 59, 2,\n\t\t\t\t\t\t __io, __tmperr);\n\t\t\t}\n\t\t    }\n\t\t  else\n\t\t    __tmperr |= ios_base::failbit;\n\t\t  break;\n\t\tdefault:\n\t\t  // Not recognized.\n\t\t  __tmperr |= ios_base::failbit;\n\t\t}\n\t    }\n\t  else\n\t    {\n\t      // Verify format and input match, extract and discard.\n\t      if (__format[__i] == *__beg)\n\t\t++__beg;\n\t      else\n\t\t__tmperr |= ios_base::failbit;\n\t    }\n\t}\n\n      if (__tmperr)\n\t__err |= ios_base::failbit;\n  \n      return __beg;\n    }\n\n  template<typename _CharT, typename _InIter>\n    _InIter\n    time_get<_CharT, _InIter>::\n    _M_extract_num(iter_type __beg, iter_type __end, int& __member,\n\t\t   int __min, int __max, size_t __len,\n\t\t   ios_base& __io, ios_base::iostate& __err) const\n    {\n      const locale& __loc = __io._M_getloc();\n      const ctype<_CharT>& __ctype = use_facet<ctype<_CharT> >(__loc);\n\n      // As-is works for __len = 1, 2, 4, the values actually used.\n      int __mult = __len == 2 ? 10 : (__len == 4 ? 1000 : 1);\n\n      ++__min;\n      size_t __i = 0;\n      int __value = 0;\n      for (; __beg != __end && __i < __len; ++__beg, ++__i)\n\t{\n\t  const char __c = __ctype.narrow(*__beg, '*');\n\t  if (__c >= '0' && __c <= '9')\n\t    {\n\t      __value = __value * 10 + (__c - '0');\n\t      const int __valuec = __value * __mult;\n\t      if (__valuec > __max || __valuec + __mult < __min)\n\t\tbreak;\n\t      __mult /= 10;\n\t    }\n\t  else\n\t    break;\n\t}\n      if (__i == __len)\n\t__member = __value;\n      else\n\t__err |= ios_base::failbit;\n\n      return __beg;\n    }\n\n  // Assumptions:\n  // All elements in __names are unique.\n  template<typename _CharT, typename _InIter>\n    _InIter\n    time_get<_CharT, _InIter>::\n    _M_extract_name(iter_type __beg, iter_type __end, int& __member,\n\t\t    const _CharT** __names, size_t __indexlen,\n\t\t    ios_base& __io, ios_base::iostate& __err) const\n    {\n      typedef char_traits<_CharT>\t\t__traits_type;\n      const locale& __loc = __io._M_getloc();\n      const ctype<_CharT>& __ctype = use_facet<ctype<_CharT> >(__loc);\n\n      int* __matches = static_cast<int*>(__builtin_alloca(sizeof(int)\n\t\t\t\t\t\t\t  * __indexlen));\n      size_t __nmatches = 0;\n      size_t __pos = 0;\n      bool __testvalid = true;\n      const char_type* __name;\n\n      // Look for initial matches.\n      // NB: Some of the locale data is in the form of all lowercase\n      // names, and some is in the form of initially-capitalized\n      // names. Look for both.\n      if (__beg != __end)\n\t{\n\t  const char_type __c = *__beg;\n\t  for (size_t __i1 = 0; __i1 < __indexlen; ++__i1)\n\t    if (__c == __names[__i1][0]\n\t\t|| __c == __ctype.toupper(__names[__i1][0]))\n\t      __matches[__nmatches++] = __i1;\n\t}\n\n      while (__nmatches > 1)\n\t{\n\t  // Find smallest matching string.\n\t  size_t __minlen = __traits_type::length(__names[__matches[0]]);\n\t  for (size_t __i2 = 1; __i2 < __nmatches; ++__i2)\n\t    __minlen = std::min(__minlen,\n\t\t\t      __traits_type::length(__names[__matches[__i2]]));\n\t  ++__beg, ++__pos;\n\t  if (__pos < __minlen && __beg != __end)\n\t    for (size_t __i3 = 0; __i3 < __nmatches;)\n\t      {\n\t\t__name = __names[__matches[__i3]];\n\t\tif (!(__name[__pos] == *__beg))\n\t\t  __matches[__i3] = __matches[--__nmatches];\n\t\telse\n\t\t  ++__i3;\n\t      }\n\t  else\n\t    break;\n\t}\n\n      if (__nmatches == 1)\n\t{\n\t  // Make sure found name is completely extracted.\n\t  ++__beg, ++__pos;\n\t  __name = __names[__matches[0]];\n\t  const size_t __len = __traits_type::length(__name);\n\t  while (__pos < __len && __beg != __end && __name[__pos] == *__beg)\n\t    ++__beg, ++__pos;\n\n\t  if (__len == __pos)\n\t    __member = __matches[0];\n\t  else\n\t    __testvalid = false;\n\t}\n      else\n\t__testvalid = false;\n      if (!__testvalid)\n\t__err |= ios_base::failbit;\n\n      return __beg;\n    }\n\n  template<typename _CharT, typename _InIter>\n    _InIter\n    time_get<_CharT, _InIter>::\n    do_get_time(iter_type __beg, iter_type __end, ios_base& __io,\n\t\tios_base::iostate& __err, tm* __tm) const\n    {\n      const locale& __loc = __io._M_getloc();\n      const __timepunct<_CharT>& __tp = use_facet<__timepunct<_CharT> >(__loc);\n      const char_type*  __times[2];\n      __tp._M_time_formats(__times);\n      __beg = _M_extract_via_format(__beg, __end, __io, __err, \n\t\t\t\t    __tm, __times[0]);\n      if (__beg == __end)\n\t__err |= ios_base::eofbit;\n      return __beg;\n    }\n\n  template<typename _CharT, typename _InIter>\n    _InIter\n    time_get<_CharT, _InIter>::\n    do_get_date(iter_type __beg, iter_type __end, ios_base& __io,\n\t\tios_base::iostate& __err, tm* __tm) const\n    {\n      const locale& __loc = __io._M_getloc();\n      const __timepunct<_CharT>& __tp = use_facet<__timepunct<_CharT> >(__loc);\n      const char_type*  __dates[2];\n      __tp._M_date_formats(__dates);\n      __beg = _M_extract_via_format(__beg, __end, __io, __err, \n\t\t\t\t    __tm, __dates[0]);\n      if (__beg == __end)\n\t__err |= ios_base::eofbit;\n      return __beg;\n    }\n\n  template<typename _CharT, typename _InIter>\n    _InIter\n    time_get<_CharT, _InIter>::\n    do_get_weekday(iter_type __beg, iter_type __end, ios_base& __io,\n\t\t   ios_base::iostate& __err, tm* __tm) const\n    {\n      typedef char_traits<_CharT>\t\t__traits_type;\n      const locale& __loc = __io._M_getloc();\n      const __timepunct<_CharT>& __tp = use_facet<__timepunct<_CharT> >(__loc);\n      const ctype<_CharT>& __ctype = use_facet<ctype<_CharT> >(__loc);\n      const char_type*  __days[7];\n      __tp._M_days_abbreviated(__days);\n      int __tmpwday;\n      ios_base::iostate __tmperr = ios_base::goodbit;\n      __beg = _M_extract_name(__beg, __end, __tmpwday, __days, 7,\n\t\t\t      __io, __tmperr);\n\n      // Check to see if non-abbreviated name exists, and extract.\n      // NB: Assumes both _M_days and _M_days_abbreviated organized in\n      // exact same order, first to last, such that the resulting\n      // __days array with the same index points to a day, and that\n      // day's abbreviated form.\n      // NB: Also assumes that an abbreviated name is a subset of the name.\n      if (!__tmperr && __beg != __end)\n\t{\n\t  size_t __pos = __traits_type::length(__days[__tmpwday]);\n\t  __tp._M_days(__days);\n\t  const char_type* __name = __days[__tmpwday];\n\t  if (__name[__pos] == *__beg)\n\t    {\n\t      // Extract the rest of it.\n\t      const size_t __len = __traits_type::length(__name);\n\t      while (__pos < __len && __beg != __end\n\t\t     && __name[__pos] == *__beg)\n\t\t++__beg, ++__pos;\n\t      if (__len != __pos)\n\t\t__tmperr |= ios_base::failbit;\n\t    }\n\t}\n      if (!__tmperr)\n\t__tm->tm_wday = __tmpwday;\n      else\n\t__err |= ios_base::failbit;\n\n      if (__beg == __end)\n\t__err |= ios_base::eofbit;\n      return __beg;\n     }\n\n  template<typename _CharT, typename _InIter>\n    _InIter\n    time_get<_CharT, _InIter>::\n    do_get_monthname(iter_type __beg, iter_type __end,\n                     ios_base& __io, ios_base::iostate& __err, tm* __tm) const\n    {\n      typedef char_traits<_CharT>\t\t__traits_type;\n      const locale& __loc = __io._M_getloc();\n      const __timepunct<_CharT>& __tp = use_facet<__timepunct<_CharT> >(__loc);\n      const ctype<_CharT>& __ctype = use_facet<ctype<_CharT> >(__loc);\n      const char_type*  __months[12];\n      __tp._M_months_abbreviated(__months);\n      int __tmpmon;\n      ios_base::iostate __tmperr = ios_base::goodbit;\n      __beg = _M_extract_name(__beg, __end, __tmpmon, __months, 12, \n\t\t\t      __io, __tmperr);\n\n      // Check to see if non-abbreviated name exists, and extract.\n      // NB: Assumes both _M_months and _M_months_abbreviated organized in\n      // exact same order, first to last, such that the resulting\n      // __months array with the same index points to a month, and that\n      // month's abbreviated form.\n      // NB: Also assumes that an abbreviated name is a subset of the name.\n      if (!__tmperr && __beg != __end)\n\t{\n\t  size_t __pos = __traits_type::length(__months[__tmpmon]);\n\t  __tp._M_months(__months);\n\t  const char_type* __name = __months[__tmpmon];\n\t  if (__name[__pos] == *__beg)\n\t    {\n\t      // Extract the rest of it.\n\t      const size_t __len = __traits_type::length(__name);\n\t      while (__pos < __len && __beg != __end\n\t\t     && __name[__pos] == *__beg)\n\t\t++__beg, ++__pos;\n\t      if (__len != __pos)\n\t\t__tmperr |= ios_base::failbit;\n\t    }\n\t}\n      if (!__tmperr)\n\t__tm->tm_mon = __tmpmon;\n      else\n\t__err |= ios_base::failbit;\n\n      if (__beg == __end)\n\t__err |= ios_base::eofbit;\n      return __beg;\n    }\n\n  template<typename _CharT, typename _InIter>\n    _InIter\n    time_get<_CharT, _InIter>::\n    do_get_year(iter_type __beg, iter_type __end, ios_base& __io,\n\t\tios_base::iostate& __err, tm* __tm) const\n    {\n      const locale& __loc = __io._M_getloc();\n      const ctype<_CharT>& __ctype = use_facet<ctype<_CharT> >(__loc);\n\n      size_t __i = 0;\n      int __value = 0;\n      for (; __beg != __end && __i < 4; ++__beg, ++__i)\n\t{\n\t  const char __c = __ctype.narrow(*__beg, '*');\n\t  if (__c >= '0' && __c <= '9')\n\t    __value = __value * 10 + (__c - '0');\n\t  else\n\t    break;\n\t}\n      if (__i == 2 || __i == 4)\n\t__tm->tm_year = __i == 2 ? __value : __value - 1900;\n      else\n\t__err |= ios_base::failbit;\n\n      if (__beg == __end)\n\t__err |= ios_base::eofbit;\n      return __beg;\n    }\n\n  template<typename _CharT, typename _OutIter>\n    _OutIter\n    time_put<_CharT, _OutIter>::\n    put(iter_type __s, ios_base& __io, char_type __fill, const tm* __tm,\n\tconst _CharT* __beg, const _CharT* __end) const\n    {\n      const locale& __loc = __io._M_getloc();\n      ctype<_CharT> const& __ctype = use_facet<ctype<_CharT> >(__loc);\n      for (; __beg != __end; ++__beg)\n\tif (__ctype.narrow(*__beg, 0) != '%')\n\t  {\n\t    *__s = *__beg;\n\t    ++__s;\n\t  }\n\telse if (++__beg != __end)\n\t  {\n\t    char __format;\n\t    char __mod = 0;\n\t    const char __c = __ctype.narrow(*__beg, 0);\n\t    if (__c != 'E' && __c != 'O')\n\t      __format = __c;\n\t    else if (++__beg != __end)\n\t      {\n\t\t__mod = __c;\n\t\t__format = __ctype.narrow(*__beg, 0);\n\t      }\n\t    else\n\t      break;\n\t    __s = this->do_put(__s, __io, __fill, __tm, __format, __mod);\n\t  }\n\telse\n\t  break;\n      return __s;\n    }\n\n  template<typename _CharT, typename _OutIter>\n    _OutIter\n    time_put<_CharT, _OutIter>::\n    do_put(iter_type __s, ios_base& __io, char_type, const tm* __tm,\n\t   char __format, char __mod) const\n    {\n      const locale& __loc = __io._M_getloc();\n      ctype<_CharT> const& __ctype = use_facet<ctype<_CharT> >(__loc);\n      __timepunct<_CharT> const& __tp = use_facet<__timepunct<_CharT> >(__loc);\n\n      // NB: This size is arbitrary. Should this be a data member,\n      // initialized at construction?\n      const size_t __maxlen = 128;\n      char_type* __res = \n       static_cast<char_type*>(__builtin_alloca(sizeof(char_type) * __maxlen));\n\n      // NB: In IEE 1003.1-200x, and perhaps other locale models, it\n      // is possible that the format character will be longer than one\n      // character. Possibilities include 'E' or 'O' followed by a\n      // format character: if __mod is not the default argument, assume\n      // it's a valid modifier.\n      char_type __fmt[4];\n      __fmt[0] = __ctype.widen('%');\n      if (!__mod)\n\t{\n\t  __fmt[1] = __format;\n\t  __fmt[2] = char_type();\n\t}\n      else\n\t{\n\t  __fmt[1] = __mod;\n\t  __fmt[2] = __format;\n\t  __fmt[3] = char_type();\n\t}\n\n      __tp._M_put(__res, __maxlen, __fmt, __tm);\n\n      // Write resulting, fully-formatted string to output iterator.\n      return std::__write(__s, __res, char_traits<char_type>::length(__res));\n    }\n\n  // Generic version does nothing.\n  template<typename _CharT>\n    int\n    collate<_CharT>::_M_compare(const _CharT*, const _CharT*) const\n    { return 0; }\n\n  // Generic version does nothing.\n  template<typename _CharT>\n    size_t\n    collate<_CharT>::_M_transform(_CharT*, const _CharT*, size_t) const\n    { return 0; }\n\n  template<typename _CharT>\n    int\n    collate<_CharT>::\n    do_compare(const _CharT* __lo1, const _CharT* __hi1,\n\t       const _CharT* __lo2, const _CharT* __hi2) const\n    {\n      // strcoll assumes zero-terminated strings so we make a copy\n      // and then put a zero at the end.\n      const string_type __one(__lo1, __hi1);\n      const string_type __two(__lo2, __hi2);\n\n      const _CharT* __p = __one.c_str();\n      const _CharT* __pend = __one.data() + __one.length();\n      const _CharT* __q = __two.c_str();\n      const _CharT* __qend = __two.data() + __two.length();\n\n      // strcoll stops when it sees a nul character so we break\n      // the strings into zero-terminated substrings and pass those\n      // to strcoll.\n      for (;;)\n\t{\n\t  const int __res = _M_compare(__p, __q);\n\t  if (__res)\n\t    return __res;\n\n\t  __p += char_traits<_CharT>::length(__p);\n\t  __q += char_traits<_CharT>::length(__q);\n\t  if (__p == __pend && __q == __qend)\n\t    return 0;\n\t  else if (__p == __pend)\n\t    return -1;\n\t  else if (__q == __qend)\n\t    return 1;\n\n\t  __p++;\n\t  __q++;\n\t}\n    }\n\n  template<typename _CharT>\n    typename collate<_CharT>::string_type\n    collate<_CharT>::\n    do_transform(const _CharT* __lo, const _CharT* __hi) const\n    {\n      string_type __ret;\n\n      // strxfrm assumes zero-terminated strings so we make a copy\n      const string_type __str(__lo, __hi);\n\n      const _CharT* __p = __str.c_str();\n      const _CharT* __pend = __str.data() + __str.length();\n\n      size_t __len = (__hi - __lo) * 2;\n\n      _CharT* __c = new _CharT[__len];\n\n      try\n\t{\n\t  // strxfrm stops when it sees a nul character so we break\n\t  // the string into zero-terminated substrings and pass those\n\t  // to strxfrm.\n\t  for (;;)\n\t    {\n\t      // First try a buffer perhaps big enough.\n\t      size_t __res = _M_transform(__c, __p, __len);\n\t      // If the buffer was not large enough, try again with the\n\t      // correct size.\n\t      if (__res >= __len)\n\t\t{\n\t\t  __len = __res + 1;\n\t\t  delete [] __c, __c = 0;\n\t\t  __c = new _CharT[__len];\n\t\t  __res = _M_transform(__c, __p, __len);\n\t\t}\n\n\t      __ret.append(__c, __res);\n\t      __p += char_traits<_CharT>::length(__p);\n\t      if (__p == __pend)\n\t\tbreak;\n\n\t      __p++;\n\t      __ret.push_back(_CharT());\n\t    }\n\t}\n      catch(...)\n\t{\n\t  delete [] __c;\n\t  __throw_exception_again;\n\t}\n\n      delete [] __c;\n\n      return __ret;\n    }\n\n  template<typename _CharT>\n    long\n    collate<_CharT>::\n    do_hash(const _CharT* __lo, const _CharT* __hi) const\n    {\n      unsigned long __val = 0;\n      for (; __lo < __hi; ++__lo)\n\t__val = *__lo + ((__val << 7) |\n\t\t       (__val >> (numeric_limits<unsigned long>::digits - 7)));\n      return static_cast<long>(__val);\n    }\n\n  // Construct correctly padded string, as per 22.2.2.2.2\n  // Assumes\n  // __newlen > __oldlen\n  // __news is allocated for __newlen size\n  // Used by both num_put and ostream inserters: if __num,\n  // internal-adjusted objects are padded according to the rules below\n  // concerning 0[xX] and +-, otherwise, exactly as right-adjusted\n  // ones are.\n\n  // NB: Of the two parameters, _CharT can be deduced from the\n  // function arguments. The other (_Traits) has to be explicitly specified.\n  template<typename _CharT, typename _Traits>\n    void\n    __pad<_CharT, _Traits>::_S_pad(ios_base& __io, _CharT __fill,\n\t\t\t\t   _CharT* __news, const _CharT* __olds,\n\t\t\t\t   const streamsize __newlen,\n\t\t\t\t   const streamsize __oldlen, const bool __num)\n    {\n      const size_t __plen = static_cast<size_t>(__newlen - __oldlen);\n      const ios_base::fmtflags __adjust = __io.flags() & ios_base::adjustfield;\n\n      // Padding last.\n      if (__adjust == ios_base::left)\n\t{\n\t  _Traits::copy(__news, const_cast<_CharT*>(__olds), __oldlen);\n\t  _Traits::assign(__news + __oldlen, __plen, __fill);\n\t  return;\n\t}\n\n      size_t __mod = 0;\n      if (__adjust == ios_base::internal && __num)\n\t{\n\t  // Pad after the sign, if there is one.\n\t  // Pad after 0[xX], if there is one.\n\t  // Who came up with these rules, anyway? Jeeze.\n          const locale& __loc = __io._M_getloc();\n\t  const ctype<_CharT>& __ctype = use_facet<ctype<_CharT> >(__loc);\n\n\t  const bool __testsign = (__ctype.widen('-') == __olds[0]\n\t\t\t\t   || __ctype.widen('+') == __olds[0]);\n\t  const bool __testhex = (__ctype.widen('0') == __olds[0]\n\t\t\t\t  && __oldlen > 1\n\t\t\t\t  && (__ctype.widen('x') == __olds[1]\n\t\t\t\t      || __ctype.widen('X') == __olds[1]));\n\t  if (__testhex)\n\t    {\n\t      __news[0] = __olds[0];\n\t      __news[1] = __olds[1];\n\t      __mod = 2;\n\t      __news += 2;\n\t    }\n\t  else if (__testsign)\n\t    {\n\t      __news[0] = __olds[0];\n\t      __mod = 1;\n\t      ++__news;\n\t    }\n\t  // else Padding first.\n\t}\n      _Traits::assign(__news, __plen, __fill);\n      _Traits::copy(__news + __plen, const_cast<_CharT*>(__olds + __mod),\n\t\t    __oldlen - __mod);\n    }\n\n  bool\n  __verify_grouping(const char* __grouping, size_t __grouping_size,\n\t\t    const string& __grouping_tmp)\n  {\n    const size_t __n = __grouping_tmp.size() - 1;\n    const size_t __min = std::min(__n, size_t(__grouping_size - 1));\n    size_t __i = __n;\n    bool __test = true;\n    \n    // Parsed number groupings have to match the\n    // numpunct::grouping string exactly, starting at the\n    // right-most point of the parsed sequence of elements ...\n    for (size_t __j = 0; __j < __min && __test; --__i, ++__j)\n      __test = __grouping_tmp[__i] == __grouping[__j];\n    for (; __i && __test; --__i)\n      __test = __grouping_tmp[__i] == __grouping[__min];\n    // ... but the first parsed grouping can be <= numpunct\n    // grouping (only do the check if the numpunct char is > 0\n    // because <= 0 means any size is ok).\n    if (static_cast<signed char>(__grouping[__min]) > 0)\n      __test &= __grouping_tmp[0] <= __grouping[__min];\n    return __test;\n  }\n\n  template<typename _CharT>\n    _CharT*\n    __add_grouping(_CharT* __s, _CharT __sep,\n\t\t   const char* __gbeg, size_t __gsize,\n\t\t   const _CharT* __first, const _CharT* __last)\n    {\n      size_t __idx = 0;\n      size_t __ctr = 0;\n\n      while (__last - __first > __gbeg[__idx]\n\t     && static_cast<signed char>(__gbeg[__idx]) > 0)\n\t{\n\t  __last -= __gbeg[__idx];\n\t  __idx < __gsize - 1 ? ++__idx : ++__ctr;\n\t}\n\n      while (__first != __last)\n\t*__s++ = *__first++;\n\n      while (__ctr--)\n\t{\n\t  *__s++ = __sep;\t  \n\t  for (char __i = __gbeg[__idx]; __i > 0; --__i)\n\t    *__s++ = *__first++;\n\t}\n\n      while (__idx--)\n\t{\n\t  *__s++ = __sep;\t  \n\t  for (char __i = __gbeg[__idx]; __i > 0; --__i)\n\t    *__s++ = *__first++;\n\t}\n\n      return __s;\n    }\n\n  // Inhibit implicit instantiations for required instantiations,\n  // which are defined via explicit instantiations elsewhere.\n  // NB: This syntax is a GNU extension.\n#if _GLIBCXX_EXTERN_TEMPLATE\n  extern template class moneypunct<char, false>;\n  extern template class moneypunct<char, true>;\n  extern template class moneypunct_byname<char, false>;\n  extern template class moneypunct_byname<char, true>;\n  extern template class _GLIBCXX_LDBL_NAMESPACE money_get<char>;\n  extern template class _GLIBCXX_LDBL_NAMESPACE money_put<char>;\n  extern template class numpunct<char>;\n  extern template class numpunct_byname<char>;\n  extern template class _GLIBCXX_LDBL_NAMESPACE num_get<char>;\n  extern template class _GLIBCXX_LDBL_NAMESPACE num_put<char>;\n  extern template class __timepunct<char>;\n  extern template class time_put<char>;\n  extern template class time_put_byname<char>;\n  extern template class time_get<char>;\n  extern template class time_get_byname<char>;\n  extern template class messages<char>;\n  extern template class messages_byname<char>;\n  extern template class ctype_byname<char>;\n  extern template class codecvt_byname<char, char, mbstate_t>;\n  extern template class collate<char>;\n  extern template class collate_byname<char>;\n\n  extern template\n    const codecvt<char, char, mbstate_t>&\n    use_facet<codecvt<char, char, mbstate_t> >(const locale&);\n\n  extern template\n    const collate<char>&\n    use_facet<collate<char> >(const locale&);\n\n  extern template\n    const numpunct<char>&\n    use_facet<numpunct<char> >(const locale&);\n\n  extern template\n    const num_put<char>&\n    use_facet<num_put<char> >(const locale&);\n\n  extern template\n    const num_get<char>&\n    use_facet<num_get<char> >(const locale&);\n\n  extern template\n    const moneypunct<char, true>&\n    use_facet<moneypunct<char, true> >(const locale&);\n\n  extern template\n    const moneypunct<char, false>&\n    use_facet<moneypunct<char, false> >(const locale&);\n\n  extern template\n    const money_put<char>&\n    use_facet<money_put<char> >(const locale&);\n\n  extern template\n    const money_get<char>&\n    use_facet<money_get<char> >(const locale&);\n\n  extern template\n    const __timepunct<char>&\n    use_facet<__timepunct<char> >(const locale&);\n\n  extern template\n    const time_put<char>&\n    use_facet<time_put<char> >(const locale&);\n\n  extern template\n    const time_get<char>&\n    use_facet<time_get<char> >(const locale&);\n\n  extern template\n    const messages<char>&\n    use_facet<messages<char> >(const locale&);\n\n  extern template\n    bool\n    has_facet<ctype<char> >(const locale&);\n\n  extern template\n    bool\n    has_facet<codecvt<char, char, mbstate_t> >(const locale&);\n\n  extern template\n    bool\n    has_facet<collate<char> >(const locale&);\n\n  extern template\n    bool\n    has_facet<numpunct<char> >(const locale&);\n\n  extern template\n    bool\n    has_facet<num_put<char> >(const locale&);\n\n  extern template\n    bool\n    has_facet<num_get<char> >(const locale&);\n\n  extern template\n    bool\n    has_facet<moneypunct<char> >(const locale&);\n\n  extern template\n    bool\n    has_facet<money_put<char> >(const locale&);\n\n  extern template\n    bool\n    has_facet<money_get<char> >(const locale&);\n\n  extern template\n    bool\n    has_facet<__timepunct<char> >(const locale&);\n\n  extern template\n    bool\n    has_facet<time_put<char> >(const locale&);\n\n  extern template\n    bool\n    has_facet<time_get<char> >(const locale&);\n\n  extern template\n    bool\n    has_facet<messages<char> >(const locale&);\n\n#ifdef _GLIBCXX_USE_WCHAR_T\n  extern template class moneypunct<wchar_t, false>;\n  extern template class moneypunct<wchar_t, true>;\n  extern template class moneypunct_byname<wchar_t, false>;\n  extern template class moneypunct_byname<wchar_t, true>;\n  extern template class _GLIBCXX_LDBL_NAMESPACE money_get<wchar_t>;\n  extern template class _GLIBCXX_LDBL_NAMESPACE money_put<wchar_t>;\n  extern template class numpunct<wchar_t>;\n  extern template class numpunct_byname<wchar_t>;\n  extern template class _GLIBCXX_LDBL_NAMESPACE num_get<wchar_t>;\n  extern template class _GLIBCXX_LDBL_NAMESPACE num_put<wchar_t>;\n  extern template class __timepunct<wchar_t>;\n  extern template class time_put<wchar_t>;\n  extern template class time_put_byname<wchar_t>;\n  extern template class time_get<wchar_t>;\n  extern template class time_get_byname<wchar_t>;\n  extern template class messages<wchar_t>;\n  extern template class messages_byname<wchar_t>;\n  extern template class ctype_byname<wchar_t>;\n  extern template class codecvt_byname<wchar_t, char, mbstate_t>;\n  extern template class collate<wchar_t>;\n  extern template class collate_byname<wchar_t>;\n\n  extern template\n    const codecvt<wchar_t, char, mbstate_t>&\n    use_facet<codecvt<wchar_t, char, mbstate_t> >(locale const&);\n\n  extern template\n    const collate<wchar_t>&\n    use_facet<collate<wchar_t> >(const locale&);\n\n  extern template\n    const numpunct<wchar_t>&\n    use_facet<numpunct<wchar_t> >(const locale&);\n\n  extern template\n    const num_put<wchar_t>&\n    use_facet<num_put<wchar_t> >(const locale&);\n\n  extern template\n    const num_get<wchar_t>&\n    use_facet<num_get<wchar_t> >(const locale&);\n\n  extern template\n    const moneypunct<wchar_t, true>&\n    use_facet<moneypunct<wchar_t, true> >(const locale&);\n\n  extern template\n    const moneypunct<wchar_t, false>&\n    use_facet<moneypunct<wchar_t, false> >(const locale&);\n\n  extern template\n    const money_put<wchar_t>&\n    use_facet<money_put<wchar_t> >(const locale&);\n\n  extern template\n    const money_get<wchar_t>&\n    use_facet<money_get<wchar_t> >(const locale&);\n\n  extern template\n    const __timepunct<wchar_t>&\n    use_facet<__timepunct<wchar_t> >(const locale&);\n\n  extern template\n    const time_put<wchar_t>&\n    use_facet<time_put<wchar_t> >(const locale&);\n\n  extern template\n    const time_get<wchar_t>&\n    use_facet<time_get<wchar_t> >(const locale&);\n\n  extern template\n    const messages<wchar_t>&\n    use_facet<messages<wchar_t> >(const locale&);\n\n extern template\n    bool\n    has_facet<ctype<wchar_t> >(const locale&);\n\n  extern template\n    bool\n    has_facet<codecvt<wchar_t, char, mbstate_t> >(const locale&);\n\n  extern template\n    bool\n    has_facet<collate<wchar_t> >(const locale&);\n\n  extern template\n    bool\n    has_facet<numpunct<wchar_t> >(const locale&);\n\n  extern template\n    bool\n    has_facet<num_put<wchar_t> >(const locale&);\n\n  extern template\n    bool\n    has_facet<num_get<wchar_t> >(const locale&);\n\n  extern template\n    bool\n    has_facet<moneypunct<wchar_t> >(const locale&);\n\n  extern template\n    bool\n    has_facet<money_put<wchar_t> >(const locale&);\n\n  extern template\n    bool\n    has_facet<money_get<wchar_t> >(const locale&);\n\n  extern template\n    bool\n    has_facet<__timepunct<wchar_t> >(const locale&);\n\n  extern template\n    bool\n    has_facet<time_put<wchar_t> >(const locale&);\n\n  extern template\n    bool\n    has_facet<time_get<wchar_t> >(const locale&);\n\n  extern template\n    bool\n    has_facet<messages<wchar_t> >(const locale&);\n#endif\n#endif\n\n_GLIBCXX_END_NAMESPACE\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/bits/localefwd.h",
    "content": "// Locale support -*- C++ -*-\n\n// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2005, 2006\n// Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n/** @file localefwd.h\n *  This is an internal header file, included by other library headers.\n *  You should not attempt to use it directly.\n */\n\n//\n// ISO C++ 14882: 22.1  Locales\n//\n\n#ifndef _LOCALE_FWD_H\n#define _LOCALE_FWD_H 1\n\n#pragma GCC system_header\n\n#include <bits/c++config.h>\n#include <bits/c++locale.h>     // Defines __c_locale, config-specific includes\n#include <iosfwd>\t\t// For ostreambuf_iterator, istreambuf_iterator\n#include <bits/functexcept.h>\n\n_GLIBCXX_BEGIN_NAMESPACE(std)\n\n  // 22.1.1 Locale\n  class locale;\n\n  // 22.1.3 Convenience interfaces\n  template<typename _CharT>\n    inline bool\n    isspace(_CharT, const locale&);\n\n  template<typename _CharT>\n    inline bool\n    isprint(_CharT, const locale&);\n\n  template<typename _CharT>\n    inline bool\n    iscntrl(_CharT, const locale&);\n\n  template<typename _CharT>\n    inline bool\n    isupper(_CharT, const locale&);\n\n  template<typename _CharT>\n    inline bool\n    islower(_CharT, const locale&);\n\n  template<typename _CharT>\n    inline bool\n    isalpha(_CharT, const locale&);\n\n  template<typename _CharT>\n    inline bool\n    isdigit(_CharT, const locale&);\n\n  template<typename _CharT>\n    inline bool\n    ispunct(_CharT, const locale&);\n\n  template<typename _CharT>\n    inline bool\n    isxdigit(_CharT, const locale&);\n\n  template<typename _CharT>\n    inline bool\n    isalnum(_CharT, const locale&);\n\n  template<typename _CharT>\n    inline bool\n    isgraph(_CharT, const locale&);\n\n  template<typename _CharT>\n    inline _CharT\n    toupper(_CharT, const locale&);\n\n  template<typename _CharT>\n    inline _CharT\n    tolower(_CharT, const locale&);\n\n  // 22.2.1 and 22.2.1.3 ctype\n  class ctype_base;\n  template<typename _CharT>\n    class ctype;\n  template<> class ctype<char>;\n#ifdef _GLIBCXX_USE_WCHAR_T\n  template<> class ctype<wchar_t>;\n#endif\n  template<typename _CharT>\n    class ctype_byname;\n  // NB: Specialized for char and wchar_t in locale_facets.h.\n\n  class codecvt_base;\n  class __enc_traits;\n  template<typename _InternT, typename _ExternT, typename _StateT>\n    class codecvt;\n  template<> class codecvt<char, char, mbstate_t>;\n#ifdef _GLIBCXX_USE_WCHAR_T\n  template<> class codecvt<wchar_t, char, mbstate_t>;\n#endif\n  template<typename _InternT, typename _ExternT, typename _StateT>\n    class codecvt_byname;\n\n  // 22.2.2 and 22.2.3 numeric\n_GLIBCXX_BEGIN_LDBL_NAMESPACE\n  template<typename _CharT, typename _InIter = istreambuf_iterator<_CharT> >\n    class num_get;\n  template<typename _CharT, typename _OutIter = ostreambuf_iterator<_CharT> >\n    class num_put;\n_GLIBCXX_END_LDBL_NAMESPACE\n  template<typename _CharT> class numpunct;\n  template<typename _CharT> class numpunct_byname;\n\n  // 22.2.4 collation\n  template<typename _CharT>\n    class collate;\n  template<typename _CharT> class\n    collate_byname;\n\n  // 22.2.5 date and time\n  class time_base;\n  template<typename _CharT, typename _InIter =  istreambuf_iterator<_CharT> >\n    class time_get;\n  template<typename _CharT, typename _InIter =  istreambuf_iterator<_CharT> >\n    class time_get_byname;\n  template<typename _CharT, typename _OutIter = ostreambuf_iterator<_CharT> >\n    class time_put;\n  template<typename _CharT, typename _OutIter = ostreambuf_iterator<_CharT> >\n    class time_put_byname;\n\n  // 22.2.6 money\n  class money_base;\n_GLIBCXX_BEGIN_LDBL_NAMESPACE\n  template<typename _CharT, typename _InIter =  istreambuf_iterator<_CharT> >\n    class money_get;\n  template<typename _CharT, typename _OutIter = ostreambuf_iterator<_CharT> >\n    class money_put;\n_GLIBCXX_END_LDBL_NAMESPACE\n  template<typename _CharT, bool _Intl = false>\n    class moneypunct;\n  template<typename _CharT, bool _Intl = false>\n    class moneypunct_byname;\n\n  // 22.2.7 message retrieval\n  class messages_base;\n  template<typename _CharT>\n    class messages;\n  template<typename _CharT>\n    class messages_byname;\n\n  template<typename _Facet>\n    bool\n    has_facet(const locale& __loc) throw();\n\n  template<typename _Facet>\n    const _Facet&\n    use_facet(const locale& __loc);\n\n  template<typename _Facet>\n    inline const _Facet&\n    __check_facet(const _Facet* __f)\n    {\n      if (!__f)\n\t__throw_bad_cast();\n      return *__f;\n    }\n\n_GLIBCXX_END_NAMESPACE\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/bits/mask_array.h",
    "content": "// The template and inlines for the -*- C++ -*- mask_array class.\n\n// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2004, 2005\n//  Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n/** @file mask_array.h\n *  This is an internal header file, included by other library headers.\n *  You should not attempt to use it directly.\n */\n\n// Written by Gabriel Dos Reis <Gabriel.Dos-Reis@DPTMaths.ENS-Cachan.Fr>\n\n#ifndef _MASK_ARRAY_H\n#define _MASK_ARRAY_H 1\n\n#pragma GCC system_header\n\n_GLIBCXX_BEGIN_NAMESPACE(std)\n\n  /**\n   *  @brief  Reference to selected subset of an array.\n   *\n   *  A mask_array is a reference to the actual elements of an array specified\n   *  by a bitmask in the form of an array of bool.  The way to get a\n   *  mask_array is to call operator[](valarray<bool>) on a valarray.  The\n   *  returned mask_array then permits carrying operations out on the\n   *  referenced subset of elements in the original valarray.\n   *\n   *  For example, if a mask_array is obtained using the array (false, true,\n   *  false, true) as an argument, the mask array has two elements referring\n   *  to array[1] and array[3] in the underlying array.\n   *\n   *  @param  Tp  Element type.\n   */\n  template <class _Tp>\n    class mask_array\n    {\n    public:\n      typedef _Tp value_type;\n\n      // _GLIBCXX_RESOLVE_LIB_DEFECTS\n      // 253. valarray helper functions are almost entirely useless\n\n      ///  Copy constructor.  Both slices refer to the same underlying array.\n      mask_array (const mask_array&);\n      \n      ///  Assignment operator.  Assigns elements to corresponding elements\n      ///  of @a a.\n      mask_array& operator=(const mask_array&);\n\n      void operator=(const valarray<_Tp>&) const;\n      ///  Multiply slice elements by corresponding elements of @a v.\n      void operator*=(const valarray<_Tp>&) const;\n      ///  Divide slice elements by corresponding elements of @a v.\n      void operator/=(const valarray<_Tp>&) const;\n      ///  Modulo slice elements by corresponding elements of @a v.\n      void operator%=(const valarray<_Tp>&) const;\n      ///  Add corresponding elements of @a v to slice elements.\n      void operator+=(const valarray<_Tp>&) const;\n      ///  Subtract corresponding elements of @a v from slice elements.\n      void operator-=(const valarray<_Tp>&) const;\n      ///  Logical xor slice elements with corresponding elements of @a v.\n      void operator^=(const valarray<_Tp>&) const;\n      ///  Logical and slice elements with corresponding elements of @a v.\n      void operator&=(const valarray<_Tp>&) const;\n      ///  Logical or slice elements with corresponding elements of @a v.\n      void operator|=(const valarray<_Tp>&) const;\n      ///  Left shift slice elements by corresponding elements of @a v.\n      void operator<<=(const valarray<_Tp>&) const;\n      ///  Right shift slice elements by corresponding elements of @a v.\n      void operator>>=(const valarray<_Tp>&) const;\n      ///  Assign all slice elements to @a t.\n      void operator=(const _Tp&) const;\n\n        //        ~mask_array ();\n\n      template<class _Dom>\n        void operator=(const _Expr<_Dom,_Tp>&) const;\n      template<class _Dom>\n        void operator*=(const _Expr<_Dom,_Tp>&) const;\n      template<class _Dom>\n        void operator/=(const _Expr<_Dom,_Tp>&) const;\n      template<class _Dom>\n        void operator%=(const _Expr<_Dom,_Tp>&) const;\n      template<class _Dom>\n        void operator+=(const _Expr<_Dom,_Tp>&) const;\n      template<class _Dom>\n        void operator-=(const _Expr<_Dom,_Tp>&) const;\n      template<class _Dom>\n        void operator^=(const _Expr<_Dom,_Tp>&) const;\n      template<class _Dom>\n        void operator&=(const _Expr<_Dom,_Tp>&) const;\n      template<class _Dom>\n        void operator|=(const _Expr<_Dom,_Tp>&) const;\n      template<class _Dom>\n        void operator<<=(const _Expr<_Dom,_Tp>&) const;\n      template<class _Dom>\n        void operator>>=(const _Expr<_Dom,_Tp>&) const;\n\n    private:\n      mask_array(_Array<_Tp>, size_t, _Array<bool>);\n      friend class valarray<_Tp>;\n\n      const size_t       _M_sz;\n      const _Array<bool> _M_mask;\n      const _Array<_Tp>  _M_array;\n\n      // not implemented\n      mask_array();\n    };\n\n  template<typename _Tp>\n    inline mask_array<_Tp>::mask_array(const mask_array<_Tp>& a)\n    : _M_sz(a._M_sz), _M_mask(a._M_mask), _M_array(a._M_array) {}\n\n  template<typename _Tp>\n    inline\n    mask_array<_Tp>::mask_array(_Array<_Tp> __a, size_t __s, _Array<bool> __m)\n    : _M_sz(__s), _M_mask(__m), _M_array(__a) {}\n\n  template<typename _Tp>\n    inline mask_array<_Tp>&\n    mask_array<_Tp>::operator=(const mask_array<_Tp>& __a)\n    {\n      std::__valarray_copy(__a._M_array, __a._M_mask,\n\t\t\t   _M_sz, _M_array, _M_mask);\n      return *this;\n    }\n\n  template<typename _Tp>\n    inline void\n    mask_array<_Tp>::operator=(const _Tp& __t) const\n    { std::__valarray_fill(_M_array, _M_sz, _M_mask, __t); }\n\n  template<typename _Tp>\n    inline void\n    mask_array<_Tp>::operator=(const valarray<_Tp>& __v) const\n    { std::__valarray_copy(_Array<_Tp>(__v), __v.size(), _M_array, _M_mask); }\n\n  template<typename _Tp>\n    template<class _Ex>\n      inline void\n      mask_array<_Tp>::operator=(const _Expr<_Ex, _Tp>& __e) const\n      { std::__valarray_copy(__e, __e.size(), _M_array, _M_mask); }\n\n#undef _DEFINE_VALARRAY_OPERATOR\n#define _DEFINE_VALARRAY_OPERATOR(_Op, _Name)\t\t\t\t\\\n  template<typename _Tp>\t\t\t\t\t\t\\\n    inline void\t\t\t\t\t\t\t\t\\\n    mask_array<_Tp>::operator _Op##=(const valarray<_Tp>& __v) const\t\\\n    {\t\t\t\t\t\t\t\t\t\\\n      _Array_augmented_##_Name(_M_array, _M_mask,\t\t\t\\\n\t\t\t       _Array<_Tp>(__v), __v.size());\t\t\\\n    }\t\t\t\t\t\t\t\t\t\\\n\t\t\t\t\t\t\t\t\t\\\n  template<typename _Tp>                                                \\\n    template<class _Dom>\t\t\t                        \\\n      inline void\t\t\t\t\t\t\t\\\n      mask_array<_Tp>::operator _Op##=(const _Expr<_Dom, _Tp>& __e) const\\\n      {\t\t\t\t\t\t\t\t\t\\\n\t_Array_augmented_##_Name(_M_array, _M_mask, __e, __e.size());   \\\n      }\n\n_DEFINE_VALARRAY_OPERATOR(*, __multiplies)\n_DEFINE_VALARRAY_OPERATOR(/, __divides)\n_DEFINE_VALARRAY_OPERATOR(%, __modulus)\n_DEFINE_VALARRAY_OPERATOR(+, __plus)\n_DEFINE_VALARRAY_OPERATOR(-, __minus)\n_DEFINE_VALARRAY_OPERATOR(^, __bitwise_xor)\n_DEFINE_VALARRAY_OPERATOR(&, __bitwise_and)\n_DEFINE_VALARRAY_OPERATOR(|, __bitwise_or)\n_DEFINE_VALARRAY_OPERATOR(<<, __shift_left)\n_DEFINE_VALARRAY_OPERATOR(>>, __shift_right)\n\n#undef _DEFINE_VALARRAY_OPERATOR\n\n_GLIBCXX_END_NAMESPACE\n\n#endif /* _MASK_ARRAY_H */\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/bits/messages_members.h",
    "content": "// std::messages implementation details, generic version -*- C++ -*-\n\n// Copyright (C) 2001, 2003, 2004 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n/** @file messages_members.h\n *  This is an internal header file, included by other library headers.\n *  You should not attempt to use it directly.\n */\n\n//\n// ISO C++ 14882: 22.2.7.1.2  messages virtual functions\n//\n\n// Written by Benjamin Kosnik <bkoz@redhat.com>\n\n_GLIBCXX_BEGIN_NAMESPACE(std)\n\n  // Non-virtual member functions.\n  template<typename _CharT>\n     messages<_CharT>::messages(size_t __refs)\n     : facet(__refs)\n     { _M_c_locale_messages = _S_get_c_locale(); }\n\n  template<typename _CharT>\n     messages<_CharT>::messages(__c_locale, const char*, size_t __refs) \n     : facet(__refs)\n     { _M_c_locale_messages = _S_get_c_locale(); }\n\n  template<typename _CharT>\n    typename messages<_CharT>::catalog \n    messages<_CharT>::open(const basic_string<char>& __s, const locale& __loc, \n\t\t\t   const char*) const\n    { return this->do_open(__s, __loc); }\n\n  // Virtual member functions.\n  template<typename _CharT>\n    messages<_CharT>::~messages()\n    { _S_destroy_c_locale(_M_c_locale_messages); }\n\n  template<typename _CharT>\n    typename messages<_CharT>::catalog \n    messages<_CharT>::do_open(const basic_string<char>&, const locale&) const\n    { return 0; }\n\n  template<typename _CharT>\n    typename messages<_CharT>::string_type  \n    messages<_CharT>::do_get(catalog, int, int, \n\t\t\t     const string_type& __dfault) const\n    { return __dfault; }\n\n  template<typename _CharT>\n    void    \n    messages<_CharT>::do_close(catalog) const \n    { }\n\n   // messages_byname\n   template<typename _CharT>\n     messages_byname<_CharT>::messages_byname(const char* __s, size_t __refs)\n     : messages<_CharT>(__refs) \n     { \n\tif (std::strcmp(__s, \"C\") != 0 && std::strcmp(__s, \"POSIX\") != 0)\n\t  {\n\t    this->_S_destroy_c_locale(this->_M_c_locale_messages);\n\t    this->_S_create_c_locale(this->_M_c_locale_messages, __s); \n\t  }\n     }\n\n_GLIBCXX_END_NAMESPACE\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/bits/os_defines.h",
    "content": "// Specific definitions for BSD  -*- C++ -*-\n\n// Copyright (C) 2000, 2002 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n\n#ifndef _GLIBCXX_OS_DEFINES\n#define _GLIBCXX_OS_DEFINES 1\n\n// System-specific #define, typedefs, corrections, etc, go here.  This\n// file will come before all others.\n\n#define _GLIBCXX_USE_C99_CHECK 1\n#define _GLIBCXX_USE_C99_DYNAMIC (!(__ISO_C_VISIBLE >= 1999))\n#define _GLIBCXX_USE_C99_LONG_LONG_CHECK 1\n#define _GLIBCXX_USE_C99_LONG_LONG_DYNAMIC (_GLIBCXX_USE_C99_DYNAMIC || !defined __LONG_LONG_SUPPORTED)\n#define _GLIBCXX_USE_C99_FLOAT_TRANSCENDENTALS_CHECK 1\n#define _GLIBCXX_USE_C99_FLOAT_TRANSCENDENTALS_DYNAMIC defined _XOPEN_SOURCE\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/bits/ostream.tcc",
    "content": "// ostream classes -*- C++ -*-\n\n// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,\n// 2006, 2007\n// Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n/** @file ostream.tcc\n *  This is an internal header file, included by other library headers.\n *  You should not attempt to use it directly.\n */\n\n//\n// ISO C++ 14882: 27.6.2  Output streams\n//\n\n#ifndef _OSTREAM_TCC\n#define _OSTREAM_TCC 1\n\n#pragma GCC system_header\n\n#include <locale>\n\n_GLIBCXX_BEGIN_NAMESPACE(std)\n\n  template<typename _CharT, typename _Traits>\n    basic_ostream<_CharT, _Traits>::sentry::\n    sentry(basic_ostream<_CharT, _Traits>& __os)\n    : _M_ok(false), _M_os(__os)\n    {\n      // XXX MT\n      if (__os.tie() && __os.good())\n\t__os.tie()->flush();\n\n      if (__os.good())\n\t_M_ok = true;\n      else\n\t__os.setstate(ios_base::failbit);\n    }\n\n  template<typename _CharT, typename _Traits>\n    template<typename _ValueT>\n      basic_ostream<_CharT, _Traits>&\n      basic_ostream<_CharT, _Traits>::\n      _M_insert(_ValueT __v)\n      {\n\tsentry __cerb(*this);\n\tif (__cerb)\n\t  {\n\t    ios_base::iostate __err = ios_base::iostate(ios_base::goodbit);\n\t    try\n\t      {\n\t\tconst __num_put_type& __np = __check_facet(this->_M_num_put);\n\t\tif (__np.put(*this, *this, this->fill(), __v).failed())\n\t\t  __err |= ios_base::badbit;\n\t      }\n\t    catch(...)\n\t      { this->_M_setstate(ios_base::badbit); }\n\t    if (__err)\n\t      this->setstate(__err);\n\t  }\n\treturn *this;\n      }\n\n  template<typename _CharT, typename _Traits>\n    basic_ostream<_CharT, _Traits>&\n    basic_ostream<_CharT, _Traits>::\n    operator<<(short __n)\n    {\n      // _GLIBCXX_RESOLVE_LIB_DEFECTS\n      // 117. basic_ostream uses nonexistent num_put member functions.\n      const ios_base::fmtflags __fmt = this->flags() & ios_base::basefield;\n      if (__fmt == ios_base::oct || __fmt == ios_base::hex)\n\treturn _M_insert(static_cast<long>(static_cast<unsigned short>(__n)));\n      else\n\treturn _M_insert(static_cast<long>(__n));\n    }\n\n  template<typename _CharT, typename _Traits>\n    basic_ostream<_CharT, _Traits>&\n    basic_ostream<_CharT, _Traits>::\n    operator<<(int __n)\n    {\n      // _GLIBCXX_RESOLVE_LIB_DEFECTS\n      // 117. basic_ostream uses nonexistent num_put member functions.\n      const ios_base::fmtflags __fmt = this->flags() & ios_base::basefield;\n      if (__fmt == ios_base::oct || __fmt == ios_base::hex)\n\treturn _M_insert(static_cast<long>(static_cast<unsigned int>(__n)));\n      else\n\treturn _M_insert(static_cast<long>(__n));\n    }\n  \n  template<typename _CharT, typename _Traits>\n    basic_ostream<_CharT, _Traits>&\n    basic_ostream<_CharT, _Traits>::\n    operator<<(__streambuf_type* __sbin)\n    {\n      ios_base::iostate __err = ios_base::iostate(ios_base::goodbit);\n      sentry __cerb(*this);\n      if (__cerb && __sbin)\n\t{\n\t  try\n\t    {\n\t      if (!__copy_streambufs(__sbin, this->rdbuf()))\n\t\t__err |= ios_base::failbit;\n\t    }\n\t  catch(...)\n\t    { this->_M_setstate(ios_base::failbit); }\n\t}\n      else if (!__sbin)\n\t__err |= ios_base::badbit;\n      if (__err)\n\tthis->setstate(__err);\n      return *this;\n    }\n\n  template<typename _CharT, typename _Traits>\n    basic_ostream<_CharT, _Traits>&\n    basic_ostream<_CharT, _Traits>::\n    put(char_type __c)\n    {\n      // _GLIBCXX_RESOLVE_LIB_DEFECTS\n      // DR 60. What is a formatted input function?\n      // basic_ostream::put(char_type) is an unformatted output function.\n      // DR 63. Exception-handling policy for unformatted output.\n      // Unformatted output functions should catch exceptions thrown\n      // from streambuf members.\n      sentry __cerb(*this);\n      if (__cerb)\n\t{\n\t  ios_base::iostate __err = ios_base::iostate(ios_base::goodbit);\n\t  try\n\t    {\n\t      const int_type __put = this->rdbuf()->sputc(__c);\n\t      if (traits_type::eq_int_type(__put, traits_type::eof()))\n\t\t__err |= ios_base::badbit;\n\t    }\n\t  catch (...)\n\t    { this->_M_setstate(ios_base::badbit); }\n\t  if (__err)\n\t    this->setstate(__err);\n\t}\n      return *this;\n    }\n\n  template<typename _CharT, typename _Traits>\n    basic_ostream<_CharT, _Traits>&\n    basic_ostream<_CharT, _Traits>::\n    write(const _CharT* __s, streamsize __n)\n    {\n      // _GLIBCXX_RESOLVE_LIB_DEFECTS\n      // DR 60. What is a formatted input function?\n      // basic_ostream::write(const char_type*, streamsize) is an\n      // unformatted output function.\n      // DR 63. Exception-handling policy for unformatted output.\n      // Unformatted output functions should catch exceptions thrown\n      // from streambuf members.\n      sentry __cerb(*this);\n      if (__cerb)\n\t{\n\t  try\n\t    { _M_write(__s, __n); }\n\t  catch (...)\n\t    { this->_M_setstate(ios_base::badbit); }\n\t}\n      return *this;\n    }\n\n  template<typename _CharT, typename _Traits>\n    basic_ostream<_CharT, _Traits>&\n    basic_ostream<_CharT, _Traits>::\n    flush()\n    {\n      // _GLIBCXX_RESOLVE_LIB_DEFECTS\n      // DR 60. What is a formatted input function?\n      // basic_ostream::flush() is *not* an unformatted output function.\n      ios_base::iostate __err = ios_base::iostate(ios_base::goodbit);\n      try\n\t{\n\t  if (this->rdbuf() && this->rdbuf()->pubsync() == -1)\n\t    __err |= ios_base::badbit;\n\t}\n      catch(...)\n\t{ this->_M_setstate(ios_base::badbit); }\n      if (__err)\n\tthis->setstate(__err);\n      return *this;\n    }\n\n  template<typename _CharT, typename _Traits>\n    typename basic_ostream<_CharT, _Traits>::pos_type\n    basic_ostream<_CharT, _Traits>::\n    tellp()\n    {\n      pos_type __ret = pos_type(-1);\n      try\n\t{\n\t  if (!this->fail())\n\t    __ret = this->rdbuf()->pubseekoff(0, ios_base::cur, ios_base::out);\n\t}\n      catch(...)\n\t{ this->_M_setstate(ios_base::badbit); }\n      return __ret;\n    }\n\n  template<typename _CharT, typename _Traits>\n    basic_ostream<_CharT, _Traits>&\n    basic_ostream<_CharT, _Traits>::\n    seekp(pos_type __pos)\n    {\n      ios_base::iostate __err = ios_base::iostate(ios_base::goodbit);\n      try\n\t{\n\t  if (!this->fail())\n\t    {\n\t      // _GLIBCXX_RESOLVE_LIB_DEFECTS\n\t      // 136.  seekp, seekg setting wrong streams?\n\t      const pos_type __p = this->rdbuf()->pubseekpos(__pos,\n\t\t\t\t\t\t\t     ios_base::out);\n\n\t      // 129. Need error indication from seekp() and seekg()\n\t      if (__p == pos_type(off_type(-1)))\n\t\t__err |= ios_base::failbit;\n\t    }\n\t}\n      catch(...)\n\t{ this->_M_setstate(ios_base::badbit); }\n      if (__err)\n\tthis->setstate(__err);\n      return *this;\n    }\n\n  template<typename _CharT, typename _Traits>\n    basic_ostream<_CharT, _Traits>&\n    basic_ostream<_CharT, _Traits>::\n    seekp(off_type __off, ios_base::seekdir __dir)\n    {\n      ios_base::iostate __err = ios_base::iostate(ios_base::goodbit);\n      try\n\t{\n\t  if (!this->fail())\n\t    {\n\t      // _GLIBCXX_RESOLVE_LIB_DEFECTS\n\t      // 136.  seekp, seekg setting wrong streams?\n\t      const pos_type __p = this->rdbuf()->pubseekoff(__off, __dir,\n\t\t\t\t\t\t\t     ios_base::out);\n\n\t      // 129. Need error indication from seekp() and seekg()\n\t      if (__p == pos_type(off_type(-1)))\n\t\t__err |= ios_base::failbit;\n\t    }\n\t}\n      catch(...)\n\t{ this->_M_setstate(ios_base::badbit); }\n      if (__err)\n\tthis->setstate(__err);\n      return *this;\n    }\n\n  template<typename _CharT, typename _Traits>\n    basic_ostream<_CharT, _Traits>&\n    operator<<(basic_ostream<_CharT, _Traits>& __out, const char* __s)\n    {\n      if (!__s)\n\t__out.setstate(ios_base::badbit);\n      else\n\t{\n\t  // _GLIBCXX_RESOLVE_LIB_DEFECTS\n\t  // 167.  Improper use of traits_type::length()\n\t  const size_t __clen = char_traits<char>::length(__s);      \n\t  _CharT* __ws = 0;\n\t  try\n\t    { \n\t      __ws = new _CharT[__clen];\n\t      for (size_t  __i = 0; __i < __clen; ++__i)\n\t\t__ws[__i] = __out.widen(__s[__i]);\n\t    }\n\t  catch(...)\n\t    {\n\t      delete [] __ws;\n\t      __out._M_setstate(ios_base::badbit);\n\t      return __out;\n\t    }\n\n\t  try\n\t    {\n\t      __ostream_insert(__out, __ws, __clen);\n\t      delete [] __ws;\n\t    }\n\t  catch(...)\n\t    {\n\t      delete [] __ws;\n\t      __throw_exception_again;\n\t    }\n\t}\n      return __out;\n    }\n\n  // Inhibit implicit instantiations for required instantiations,\n  // which are defined via explicit instantiations elsewhere.\n  // NB:  This syntax is a GNU extension.\n#if _GLIBCXX_EXTERN_TEMPLATE\n  extern template class basic_ostream<char>;\n  extern template ostream& endl(ostream&);\n  extern template ostream& ends(ostream&);\n  extern template ostream& flush(ostream&);\n  extern template ostream& operator<<(ostream&, char);\n  extern template ostream& operator<<(ostream&, unsigned char);\n  extern template ostream& operator<<(ostream&, signed char);\n  extern template ostream& operator<<(ostream&, const char*);\n  extern template ostream& operator<<(ostream&, const unsigned char*);\n  extern template ostream& operator<<(ostream&, const signed char*);\n\n  extern template ostream& ostream::_M_insert(long);\n  extern template ostream& ostream::_M_insert(unsigned long);\n  extern template ostream& ostream::_M_insert(bool);\n#ifdef _GLIBCXX_USE_LONG_LONG\n  extern template ostream& ostream::_M_insert(long long);\n  extern template ostream& ostream::_M_insert(unsigned long long);\n#endif\n  extern template ostream& ostream::_M_insert(double);\n  extern template ostream& ostream::_M_insert(long double);\n  extern template ostream& ostream::_M_insert(const void*);\n\n#ifdef _GLIBCXX_USE_WCHAR_T\n  extern template class basic_ostream<wchar_t>;\n  extern template wostream& endl(wostream&);\n  extern template wostream& ends(wostream&);\n  extern template wostream& flush(wostream&);\n  extern template wostream& operator<<(wostream&, wchar_t);\n  extern template wostream& operator<<(wostream&, char);\n  extern template wostream& operator<<(wostream&, const wchar_t*);\n  extern template wostream& operator<<(wostream&, const char*);\n\n  extern template wostream& wostream::_M_insert(long);\n  extern template wostream& wostream::_M_insert(unsigned long);\n  extern template wostream& wostream::_M_insert(bool);\n#ifdef _GLIBCXX_USE_LONG_LONG\n  extern template wostream& wostream::_M_insert(long long);\n  extern template wostream& wostream::_M_insert(unsigned long long);\n#endif\n  extern template wostream& wostream::_M_insert(double);\n  extern template wostream& wostream::_M_insert(long double);\n  extern template wostream& wostream::_M_insert(const void*);\n#endif\n#endif\n\n_GLIBCXX_END_NAMESPACE\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/bits/ostream_insert.h",
    "content": "// Helpers for ostream inserters -*- C++ -*-\n\n// Copyright (C) 2007 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n/** @file ostream_insert.h\n *  This is an internal header file, included by other library headers.\n *  You should not attempt to use it directly.\n */\n\n#ifndef _OSTREAM_INSERT_H\n#define _OSTREAM_INSERT_H 1\n\n#pragma GCC system_header\n\n#include <iosfwd>\n\n_GLIBCXX_BEGIN_NAMESPACE(std)\n\n  template<typename _CharT, typename _Traits>\n    inline void\n    __ostream_write(basic_ostream<_CharT, _Traits>& __out,\n\t\t    const _CharT* __s, streamsize __n)\n    {\n      typedef basic_ostream<_CharT, _Traits>       __ostream_type;      \n      typedef typename __ostream_type::ios_base    __ios_base;\n\n      const streamsize __put = __out.rdbuf()->sputn(__s, __n);\n      if (__put != __n)\n\t__out.setstate(__ios_base::badbit);\n    }\n\n  template<typename _CharT, typename _Traits>\n    inline void\n    __ostream_fill(basic_ostream<_CharT, _Traits>& __out, streamsize __n)\n    {\n      typedef basic_ostream<_CharT, _Traits>       __ostream_type;      \n      typedef typename __ostream_type::ios_base    __ios_base;\n\n      const _CharT __c = __out.fill();\n      for (; __n > 0; --__n)\n\t{\n\t  const typename _Traits::int_type __put = __out.rdbuf()->sputc(__c);\n\t  if (_Traits::eq_int_type(__put, _Traits::eof()))\n\t    {\n\t      __out.setstate(__ios_base::badbit);\n\t      break;\n\t    }\n\t}\n    }\n\n  template<typename _CharT, typename _Traits>\n    basic_ostream<_CharT, _Traits>&\n    __ostream_insert(basic_ostream<_CharT, _Traits>& __out,\n\t\t     const _CharT* __s, streamsize __n)\n    {\n      typedef basic_ostream<_CharT, _Traits>       __ostream_type;\n      typedef typename __ostream_type::ios_base    __ios_base;\n\n      typename __ostream_type::sentry __cerb(__out);\n      if (__cerb)\n\t{\n\t  try\n\t    {\n\t      const streamsize __w = __out.width();\n\t      if (__w > __n)\n\t\t{\n\t\t  const bool __left = ((__out.flags()\n\t\t\t\t\t& __ios_base::adjustfield)\n\t\t\t\t       == __ios_base::left);\n\t\t  if (!__left)\n\t\t    __ostream_fill(__out, __w - __n);\n\t\t  if (__out.good())\n\t\t    __ostream_write(__out, __s, __n);\n\t\t  if (__left && __out.good())\n\t\t    __ostream_fill(__out, __w - __n);\n\t\t}\n\t      else\n\t\t__ostream_write(__out, __s, __n);\n\t      __out.width(0);\n\t    }\n\t  catch(...)\n\t    { __out._M_setstate(__ios_base::badbit); }\n\t}\n      return __out;\n    }\n\n  // Inhibit implicit instantiations for required instantiations,\n  // which are defined via explicit instantiations elsewhere.\n  // NB:  This syntax is a GNU extension.\n#if _GLIBCXX_EXTERN_TEMPLATE\n  extern template ostream& __ostream_insert(ostream&, const char*, streamsize);\n\n#ifdef _GLIBCXX_USE_WCHAR_T\n  extern template wostream& __ostream_insert(wostream&, const wchar_t*,\n\t\t\t\t\t     streamsize);\n#endif\n#endif\n\n_GLIBCXX_END_NAMESPACE\n\n#endif /* _OSTREAM_INSERT_H */\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/bits/postypes.h",
    "content": "// Position types -*- C++ -*-\n\n// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006\n// Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n/** @file postypes.h\n *  This is an internal header file, included by other library headers.\n *  You should not attempt to use it directly.\n */\n\n//\n// ISO C++ 14882: 27.4.1 - Types\n// ISO C++ 14882: 27.4.3 - Template class fpos\n//\n\n#ifndef _GLIBCXX_POSTYPES_H\n#define _GLIBCXX_POSTYPES_H 1\n\n#pragma GCC system_header\n\n#include <cwchar> // For mbstate_t\n\n#ifdef _GLIBCXX_HAVE_STDINT_H\n#include <stdint.h> // For int64_t\n#endif\n\n_GLIBCXX_BEGIN_NAMESPACE(std)\n\n  // The types streamoff, streampos and wstreampos and the class\n  // template fpos<> are described in clauses 21.1.2, 21.1.3, 27.1.2,\n  // 27.2, 27.4.1, 27.4.3 and D.6. Despite all this verbage, the\n  // behaviour of these types is mostly implementation defined or\n  // unspecified. The behaviour in this implementation is as noted\n  // below.\n\n  /**\n   *  @brief  Type used by fpos, char_traits<char>, and char_traits<wchar_t>.\n   *\n   *  @if maint\n   *  In clauses 21.1.3.1 and 27.4.1 streamoff is described as an\n   *  implementation defined type.\n   *  Note: In versions of GCC up to and including GCC 3.3, streamoff\n   *  was typedef long.\n   *  @endif\n  */  \n#ifdef _GLIBCXX_HAVE_INT64_T\n  typedef int64_t       streamoff;\n#else\n  typedef long long     streamoff;\n#endif\n\n  /// Integral type for I/O operation counts and buffer sizes.\n  typedef ptrdiff_t\tstreamsize; // Signed integral type\n\n  template<typename _StateT>\n    class fpos;\n\n  /**\n   *  @brief  Class representing stream positions.\n   *\n   *  The standard places no requirements upon the template parameter StateT.\n   *  In this implementation StateT must be DefaultConstructible,\n   *  CopyConstructible and Assignable.  The standard only requires that fpos\n   *  should contain a member of type StateT. In this implementation it also\n   *  contains an offset stored as a signed integer.\n   *\n   *  @param  StateT  Type passed to and returned from state().\n   */\n  template<typename _StateT>\n    class fpos\n    {\n    private:\n      streamoff\t                _M_off;\n      _StateT\t\t\t_M_state;\n\n    public:\n      // The standard doesn't require that fpos objects can be default\n      // constructed. This implementation provides a default\n      // constructor that initializes the offset to 0 and default\n      // constructs the state.\n      fpos()\n      : _M_off(0), _M_state() { }\n\n      // The standard requires that fpos objects can be constructed\n      // from streamoff objects using the constructor syntax, and\n      // fails to give any meaningful semantics. In this\n      // implementation implicit conversion is also allowed, and this\n      // constructor stores the streamoff as the offset and default\n      // constructs the state.\n      /// Construct position from offset.\n      fpos(streamoff __off)\n      : _M_off(__off), _M_state() { }\n\n      /// Convert to streamoff.\n      operator streamoff() const { return _M_off; }\n\n      /// Remember the value of @a st.\n      void\n      state(_StateT __st)\n      { _M_state = __st; }\n\n      /// Return the last set value of @a st.\n      _StateT\n      state() const\n      { return _M_state; }\n\n      // The standard requires that this operator must be defined, but\n      // gives no semantics. In this implemenation it just adds it's\n      // argument to the stored offset and returns *this.\n      /// Add offset to this position.\n      fpos&\n      operator+=(streamoff __off)\n      {\n\t_M_off += __off;\n\treturn *this;\n      }\n\n      // The standard requires that this operator must be defined, but\n      // gives no semantics. In this implemenation it just subtracts\n      // it's argument from the stored offset and returns *this.\n      /// Subtract offset from this position.\n      fpos&\n      operator-=(streamoff __off)\n      {\n\t_M_off -= __off;\n\treturn *this;\n      }\n\n      // The standard requires that this operator must be defined, but\n      // defines it's semantics only in terms of operator-. In this\n      // implementation it constructs a copy of *this, adds the\n      // argument to that copy using operator+= and then returns the\n      // copy.\n      /// Add position and offset.\n      fpos\n      operator+(streamoff __off) const\n      {\n\tfpos __pos(*this);\n\t__pos += __off;\n\treturn __pos;\n      }\n\n      // The standard requires that this operator must be defined, but\n      // defines it's semantics only in terms of operator+. In this\n      // implementation it constructs a copy of *this, subtracts the\n      // argument from that copy using operator-= and then returns the\n      // copy.\n      /// Subtract offset from position.\n      fpos\n      operator-(streamoff __off) const\n      {\n\tfpos __pos(*this);\n\t__pos -= __off;\n\treturn __pos;\n      }\n\n      // The standard requires that this operator must be defined, but\n      // defines it's semantics only in terms of operator+. In this\n      // implementation it returns the difference between the offset\n      // stored in *this and in the argument.\n      /// Subtract position to return offset.\n      streamoff\n      operator-(const fpos& __other) const\n      { return _M_off - __other._M_off; }\n    };\n\n  // The standard only requires that operator== must be an\n  // equivalence relation. In this implementation two fpos<StateT>\n  // objects belong to the same equivalence class if the contained\n  // offsets compare equal.\n  /// Test if equivalent to another position.\n  template<typename _StateT>\n    inline bool\n    operator==(const fpos<_StateT>& __lhs, const fpos<_StateT>& __rhs)\n    { return streamoff(__lhs) == streamoff(__rhs); }\n\n  template<typename _StateT>\n    inline bool\n    operator!=(const fpos<_StateT>& __lhs, const fpos<_StateT>& __rhs)\n    { return streamoff(__lhs) != streamoff(__rhs); }\n\n  // Clauses 21.1.3.1 and 21.1.3.2 describe streampos and wstreampos\n  // as implementation defined types, but clause 27.2 requires that\n  // they must both be typedefs for fpos<mbstate_t>\n  /// File position for char streams.\n  typedef fpos<mbstate_t> streampos;\n  /// File position for wchar_t streams.\n  typedef fpos<mbstate_t> wstreampos;\n\n_GLIBCXX_END_NAMESPACE\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/bits/slice_array.h",
    "content": "// The template and inlines for the -*- C++ -*- slice_array class.\n\n// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2004, 2005\n// Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n/** @file slice_array.h\n *  This is an internal header file, included by other library headers.\n *  You should not attempt to use it directly.\n */\n\n// Written by Gabriel Dos Reis <Gabriel.Dos-Reis@DPTMaths.ENS-Cachan.Fr>\n\n#ifndef _SLICE_ARRAY_H\n#define _SLICE_ARRAY_H 1\n\n#pragma GCC system_header\n\n_GLIBCXX_BEGIN_NAMESPACE(std)\n\n  /**\n   *  @brief  Class defining one-dimensional subset of an array.\n   *\n   *  The slice class represents a one-dimensional subset of an array,\n   *  specified by three parameters: start offset, size, and stride.  The\n   *  start offset is the index of the first element of the array that is part\n   *  of the subset.  The size is the total number of elements in the subset.\n   *  Stride is the distance between each successive array element to include\n   *  in the subset.\n   *\n   *  For example, with an array of size 10, and a slice with offset 1, size 3\n   *  and stride 2, the subset consists of array elements 1, 3, and 5.\n   */\n  class slice\n  {\n  public:\n    ///  Construct an empty slice.\n    slice();\n\n    /**\n     *  @brief  Construct a slice.\n     *\n     *  @param  o  Offset in array of first element.\n     *  @param  d  Number of elements in slice.\n     *  @param  s  Stride between array elements.\n     */\n    slice(size_t, size_t, size_t);\n\n    ///  Return array offset of first slice element.\n    size_t start() const;\n    ///  Return size of slice.\n    size_t size() const;\n    ///  Return array stride of slice.\n    size_t stride() const;\n\n  private:\n    size_t _M_off;                      // offset\n    size_t _M_sz;\t\t\t// size\n    size_t _M_st;\t\t\t// stride unit\n  };\n\n  // The default constructor constructor is not required to initialize\n  // data members with any meaningful values, so we choose to do nothing.\n  inline\n  slice::slice() {}\n\n  inline\n  slice::slice(size_t __o, size_t __d, size_t __s)\n  : _M_off(__o), _M_sz(__d), _M_st(__s) {}\n\n  inline size_t\n  slice::start() const\n  { return _M_off; }\n\n  inline size_t\n  slice::size() const\n  { return _M_sz; }\n\n  inline size_t\n  slice::stride() const\n  { return _M_st; }\n\n  /**\n   *  @brief  Reference to one-dimensional subset of an array.\n   *\n   *  A slice_array is a reference to the actual elements of an array\n   *  specified by a slice.  The way to get a slice_array is to call\n   *  operator[](slice) on a valarray.  The returned slice_array then permits\n   *  carrying operations out on the referenced subset of elements in the\n   *  original valarray.  For example, operator+=(valarray) will add values\n   *  to the subset of elements in the underlying valarray this slice_array\n   *  refers to.\n   *\n   *  @param  Tp  Element type.\n   */\n  template<typename _Tp>\n    class slice_array\n    {\n    public:\n      typedef _Tp value_type;\n\n      // _GLIBCXX_RESOLVE_LIB_DEFECTS\n      // 253. valarray helper functions are almost entirely useless\n\n      ///  Copy constructor.  Both slices refer to the same underlying array.\n      slice_array(const slice_array&);\n\n      ///  Assignment operator.  Assigns slice elements to corresponding\n      ///  elements of @a a.\n      slice_array& operator=(const slice_array&);\n\n      ///  Assign slice elements to corresponding elements of @a v.\n      void operator=(const valarray<_Tp>&) const;\n      ///  Multiply slice elements by corresponding elements of @a v.\n      void operator*=(const valarray<_Tp>&) const;\n      ///  Divide slice elements by corresponding elements of @a v.\n      void operator/=(const valarray<_Tp>&) const;\n      ///  Modulo slice elements by corresponding elements of @a v.\n      void operator%=(const valarray<_Tp>&) const;\n      ///  Add corresponding elements of @a v to slice elements.\n      void operator+=(const valarray<_Tp>&) const;\n      ///  Subtract corresponding elements of @a v from slice elements.\n      void operator-=(const valarray<_Tp>&) const;\n      ///  Logical xor slice elements with corresponding elements of @a v.\n      void operator^=(const valarray<_Tp>&) const;\n      ///  Logical and slice elements with corresponding elements of @a v.\n      void operator&=(const valarray<_Tp>&) const;\n      ///  Logical or slice elements with corresponding elements of @a v.\n      void operator|=(const valarray<_Tp>&) const;\n      ///  Left shift slice elements by corresponding elements of @a v.\n      void operator<<=(const valarray<_Tp>&) const;\n      ///  Right shift slice elements by corresponding elements of @a v.\n      void operator>>=(const valarray<_Tp>&) const;\n      ///  Assign all slice elements to @a t.\n      void operator=(const _Tp &) const;\n      //        ~slice_array ();\n\n      template<class _Dom>\n        void operator=(const _Expr<_Dom, _Tp>&) const;\n      template<class _Dom>\n\tvoid operator*=(const _Expr<_Dom, _Tp>&) const;\n      template<class _Dom>\n\tvoid operator/=(const _Expr<_Dom, _Tp>&) const;\n      template<class _Dom>\n\tvoid operator%=(const _Expr<_Dom, _Tp>&) const;\n      template<class _Dom>\n\tvoid operator+=(const _Expr<_Dom, _Tp>&) const;\n      template<class _Dom>\n\tvoid operator-=(const _Expr<_Dom, _Tp>&) const;\n      template<class _Dom>\n\tvoid operator^=(const _Expr<_Dom, _Tp>&) const;\n      template<class _Dom>\n\tvoid operator&=(const _Expr<_Dom, _Tp>&) const;\n      template<class _Dom>\n\tvoid operator|=(const _Expr<_Dom, _Tp>&) const;\n      template<class _Dom>\n\tvoid operator<<=(const _Expr<_Dom, _Tp>&) const;\n      template<class _Dom>\n\tvoid operator>>=(const _Expr<_Dom, _Tp>&) const;\n\n    private:\n      friend class valarray<_Tp>;\n      slice_array(_Array<_Tp>, const slice&);\n\n      const size_t      _M_sz;\n      const size_t      _M_stride;\n      const _Array<_Tp> _M_array;\n\n      // not implemented\n      slice_array();\n    };\n\n  template<typename _Tp>\n    inline\n    slice_array<_Tp>::slice_array(_Array<_Tp> __a, const slice& __s)\n    : _M_sz(__s.size()), _M_stride(__s.stride()),\n      _M_array(__a.begin() + __s.start()) {}\n\n  template<typename _Tp>\n    inline\n    slice_array<_Tp>::slice_array(const slice_array<_Tp>& a)\n    : _M_sz(a._M_sz), _M_stride(a._M_stride), _M_array(a._M_array) {}\n\n  //    template<typename _Tp>\n  //    inline slice_array<_Tp>::~slice_array () {}\n\n  template<typename _Tp>\n    inline slice_array<_Tp>&\n    slice_array<_Tp>::operator=(const slice_array<_Tp>& __a)\n    {\n      std::__valarray_copy(__a._M_array, __a._M_sz, __a._M_stride,\n\t\t\t   _M_array, _M_stride);\n      return *this;\n    }\n\n  template<typename _Tp>\n    inline void\n    slice_array<_Tp>::operator=(const _Tp& __t) const\n    { std::__valarray_fill(_M_array, _M_sz, _M_stride, __t); }\n\n  template<typename _Tp>\n    inline void\n    slice_array<_Tp>::operator=(const valarray<_Tp>& __v) const\n    { std::__valarray_copy(_Array<_Tp>(__v), _M_array, _M_sz, _M_stride); }\n\n  template<typename _Tp>\n  template<class _Dom>\n    inline void\n    slice_array<_Tp>::operator=(const _Expr<_Dom,_Tp>& __e) const\n    { std::__valarray_copy(__e, _M_sz, _M_array, _M_stride); }\n\n#undef _DEFINE_VALARRAY_OPERATOR\n#define _DEFINE_VALARRAY_OPERATOR(_Op,_Name)\t\t\t\t\\\n  template<typename _Tp>\t\t\t\t\t\t\\\n    inline void\t\t\t\t\t\t\t\t\\\n    slice_array<_Tp>::operator _Op##=(const valarray<_Tp>& __v) const\t\\\n    {\t\t\t\t\t\t\t\t\t\\\n      _Array_augmented_##_Name(_M_array, _M_sz, _M_stride, _Array<_Tp>(__v));\\\n    }\t\t\t\t\t\t\t\t\t\\\n\t\t\t\t\t\t\t\t\t\\\n  template<typename _Tp>                                                \\\n    template<class _Dom>\t\t\t\t                \\\n      inline void\t\t\t\t\t\t\t\\\n      slice_array<_Tp>::operator _Op##=(const _Expr<_Dom,_Tp>& __e) const\\\n      {\t\t\t\t\t\t\t\t\t\\\n\t  _Array_augmented_##_Name(_M_array, _M_stride, __e, _M_sz);\t\\\n      }\n\n\n_DEFINE_VALARRAY_OPERATOR(*, __multiplies)\n_DEFINE_VALARRAY_OPERATOR(/, __divides)\n_DEFINE_VALARRAY_OPERATOR(%, __modulus)\n_DEFINE_VALARRAY_OPERATOR(+, __plus)\n_DEFINE_VALARRAY_OPERATOR(-, __minus)\n_DEFINE_VALARRAY_OPERATOR(^, __bitwise_xor)\n_DEFINE_VALARRAY_OPERATOR(&, __bitwise_and)\n_DEFINE_VALARRAY_OPERATOR(|, __bitwise_or)\n_DEFINE_VALARRAY_OPERATOR(<<, __shift_left)\n_DEFINE_VALARRAY_OPERATOR(>>, __shift_right)\n\n#undef _DEFINE_VALARRAY_OPERATOR\n\n_GLIBCXX_END_NAMESPACE\n\n#endif /* _SLICE_ARRAY_H */\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/bits/sstream.tcc",
    "content": "// String based streams -*- C++ -*-\n\n// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006\n// Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n/** @file sstream.tcc\n *  This is an internal header file, included by other library headers.\n *  You should not attempt to use it directly.\n */\n\n//\n// ISO C++ 14882: 27.7  String-based streams\n//\n\n#ifndef _SSTREAM_TCC\n#define _SSTREAM_TCC 1\n\n#pragma GCC system_header\n\n#include <sstream>\n\n_GLIBCXX_BEGIN_NAMESPACE(std)\n\n  template <class _CharT, class _Traits, class _Alloc>\n    typename basic_stringbuf<_CharT, _Traits, _Alloc>::int_type\n    basic_stringbuf<_CharT, _Traits, _Alloc>::\n    pbackfail(int_type __c)\n    {\n      int_type __ret = traits_type::eof();\n      if (this->eback() < this->gptr())\n\t{\n\t  // Try to put back __c into input sequence in one of three ways.\n\t  // Order these tests done in is unspecified by the standard.\n\t  const bool __testeof = traits_type::eq_int_type(__c, __ret);\n\t  if (!__testeof)\n\t    {\n\t      const bool __testeq = traits_type::eq(traits_type::\n\t\t\t\t\t\t    to_char_type(__c),\n\t\t\t\t\t\t    this->gptr()[-1]);\t  \n\t      const bool __testout = this->_M_mode & ios_base::out;\n\t      if (__testeq || __testout)\n\t\t{\n\t\t  this->gbump(-1);\n\t\t  if (!__testeq)\n\t\t    *this->gptr() = traits_type::to_char_type(__c);\n\t\t  __ret = __c;\n\t\t}\n\t    }\n\t  else\n\t    {\n\t      this->gbump(-1);\n\t      __ret = traits_type::not_eof(__c);\n\t    }\n\t}\n      return __ret;\n    }\n\n  template <class _CharT, class _Traits, class _Alloc>\n    typename basic_stringbuf<_CharT, _Traits, _Alloc>::int_type\n    basic_stringbuf<_CharT, _Traits, _Alloc>::\n    overflow(int_type __c)\n    {\n      const bool __testout = this->_M_mode & ios_base::out;\n      if (__builtin_expect(!__testout, false))\n\treturn traits_type::eof();\n\n      const bool __testeof = traits_type::eq_int_type(__c, traits_type::eof());\n      if (__builtin_expect(__testeof, false))\n\treturn traits_type::not_eof(__c);\n\n      const __size_type __capacity = _M_string.capacity();\n      const __size_type __max_size = _M_string.max_size();\n      const bool __testput = this->pptr() < this->epptr();\n      if (__builtin_expect(!__testput && __capacity == __max_size, false))\n\treturn traits_type::eof();\n\n      // Try to append __c into output sequence in one of two ways.\n      // Order these tests done in is unspecified by the standard.\n      const char_type __conv = traits_type::to_char_type(__c);\n      if (!__testput)\n\t{\n\t  // NB: Start ostringstream buffers at 512 chars.  This is an\n\t  // experimental value (pronounced \"arbitrary\" in some of the\n\t  // hipper english-speaking countries), and can be changed to\n\t  // suit particular needs.\n\t  //\n\t  // _GLIBCXX_RESOLVE_LIB_DEFECTS\n\t  // 169. Bad efficiency of overflow() mandated\n\t  // 432. stringbuf::overflow() makes only one write position\n\t  //      available\n\t  const __size_type __opt_len = std::max(__size_type(2 * __capacity),\n\t\t\t\t\t\t __size_type(512));\n\t  const __size_type __len = std::min(__opt_len, __max_size);\n\t  __string_type __tmp;\n\t  __tmp.reserve(__len);\n\t  if (this->pbase())\n\t    __tmp.assign(this->pbase(), this->epptr() - this->pbase());\n\t  __tmp.push_back(__conv);\n\t  _M_string.swap(__tmp);\n\t  _M_sync(const_cast<char_type*>(_M_string.data()),\n\t\t  this->gptr() - this->eback(), this->pptr() - this->pbase());\n\t}\n      else\n\t*this->pptr() = __conv;\n      this->pbump(1);\n      return __c;\n    }\n\n  template <class _CharT, class _Traits, class _Alloc>\n    typename basic_stringbuf<_CharT, _Traits, _Alloc>::int_type\n    basic_stringbuf<_CharT, _Traits, _Alloc>::\n    underflow()\n    {\n      int_type __ret = traits_type::eof();\n      const bool __testin = this->_M_mode & ios_base::in;\n      if (__testin)\n\t{\n\t  // Update egptr() to match the actual string end.\n\t  _M_update_egptr();\n\n\t  if (this->gptr() < this->egptr())\n\t    __ret = traits_type::to_int_type(*this->gptr());\n\t}\n      return __ret;\n    }\n\n  template <class _CharT, class _Traits, class _Alloc>\n    typename basic_stringbuf<_CharT, _Traits, _Alloc>::pos_type\n    basic_stringbuf<_CharT, _Traits, _Alloc>::\n    seekoff(off_type __off, ios_base::seekdir __way, ios_base::openmode __mode)\n    {\n      pos_type __ret =  pos_type(off_type(-1));\n      bool __testin = (ios_base::in & this->_M_mode & __mode) != 0;\n      bool __testout = (ios_base::out & this->_M_mode & __mode) != 0;\n      const bool __testboth = __testin && __testout && __way != ios_base::cur;\n      __testin &= !(__mode & ios_base::out);\n      __testout &= !(__mode & ios_base::in);\n\n      // _GLIBCXX_RESOLVE_LIB_DEFECTS\n      // 453. basic_stringbuf::seekoff need not always fail for an empty stream.\n      const char_type* __beg = __testin ? this->eback() : this->pbase();\n      if ((__beg || !__off) && (__testin || __testout || __testboth))\n\t{\n\t  _M_update_egptr();\n\n\t  off_type __newoffi = __off;\n\t  off_type __newoffo = __newoffi;\n\t  if (__way == ios_base::cur)\n\t    {\n\t      __newoffi += this->gptr() - __beg;\n\t      __newoffo += this->pptr() - __beg;\n\t    }\n\t  else if (__way == ios_base::end)\n\t    __newoffo = __newoffi += this->egptr() - __beg;\n\n\t  if ((__testin || __testboth)\n\t      && __newoffi >= 0\n\t      && this->egptr() - __beg >= __newoffi)\n\t    {\n\t      this->gbump((__beg + __newoffi) - this->gptr());\n\t      __ret = pos_type(__newoffi);\n\t    }\n\t  if ((__testout || __testboth)\n\t      && __newoffo >= 0\n\t      && this->egptr() - __beg >= __newoffo)\n\t    {\n\t      this->pbump((__beg + __newoffo) - this->pptr());\n\t      __ret = pos_type(__newoffo);\n\t    }\n\t}\n      return __ret;\n    }\n\n  template <class _CharT, class _Traits, class _Alloc>\n    typename basic_stringbuf<_CharT, _Traits, _Alloc>::pos_type\n    basic_stringbuf<_CharT, _Traits, _Alloc>::\n    seekpos(pos_type __sp, ios_base::openmode __mode)\n    {\n      pos_type __ret =  pos_type(off_type(-1));\n      const bool __testin = (ios_base::in & this->_M_mode & __mode) != 0;\n      const bool __testout = (ios_base::out & this->_M_mode & __mode) != 0;\n\n      const char_type* __beg = __testin ? this->eback() : this->pbase();\n      if ((__beg || !off_type(__sp)) && (__testin || __testout))\n\t{\n\t  _M_update_egptr();\n\n\t  const off_type __pos(__sp);\n\t  const bool __testpos = (0 <= __pos\n\t\t\t\t  && __pos <= this->egptr() - __beg);\n\t  if (__testpos)\n\t    {\n\t      if (__testin)\n\t\tthis->gbump((__beg + __pos) - this->gptr());\n\t      if (__testout)\n                this->pbump((__beg + __pos) - this->pptr());\n\t      __ret = __sp;\n\t    }\n\t}\n      return __ret;\n    }\n\n  template <class _CharT, class _Traits, class _Alloc>\n    void\n    basic_stringbuf<_CharT, _Traits, _Alloc>::\n    _M_sync(char_type* __base, __size_type __i, __size_type __o)\n    {\n      const bool __testin = _M_mode & ios_base::in;\n      const bool __testout = _M_mode & ios_base::out;\n      char_type* __endg = __base + _M_string.size();\n      char_type* __endp = __base + _M_string.capacity();\n\n      if (__base != _M_string.data())\n\t{\n\t  // setbuf: __i == size of buffer area (_M_string.size() == 0).\n\t  __endg += __i;\n\t  __i = 0;\n\t  __endp = __endg;\n\t}\n\n      if (__testin)\n\tthis->setg(__base, __base + __i, __endg);\n      if (__testout)\n\t{\n\t  this->setp(__base, __endp);\n\t  this->pbump(__o);\n\t  // egptr() always tracks the string end.  When !__testin,\n\t  // for the correct functioning of the streambuf inlines\n\t  // the other get area pointers are identical.\n\t  if (!__testin)\n\t    this->setg(__endg, __endg, __endg);\n\t}\n    }\n\n  // Inhibit implicit instantiations for required instantiations,\n  // which are defined via explicit instantiations elsewhere.\n  // NB:  This syntax is a GNU extension.\n#if _GLIBCXX_EXTERN_TEMPLATE\n  extern template class basic_stringbuf<char>;\n  extern template class basic_istringstream<char>;\n  extern template class basic_ostringstream<char>;\n  extern template class basic_stringstream<char>;\n\n#ifdef _GLIBCXX_USE_WCHAR_T\n  extern template class basic_stringbuf<wchar_t>;\n  extern template class basic_istringstream<wchar_t>;\n  extern template class basic_ostringstream<wchar_t>;\n  extern template class basic_stringstream<wchar_t>;\n#endif\n#endif\n\n_GLIBCXX_END_NAMESPACE\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/bits/stl_algo.h",
    "content": "// Algorithm implementation -*- C++ -*-\n\n// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006\n// Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n/*\n *\n * Copyright (c) 1994\n * Hewlett-Packard Company\n *\n * Permission to use, copy, modify, distribute and sell this software\n * and its documentation for any purpose is hereby granted without fee,\n * provided that the above copyright notice appear in all copies and\n * that both that copyright notice and this permission notice appear\n * in supporting documentation.  Hewlett-Packard Company makes no\n * representations about the suitability of this software for any\n * purpose.  It is provided \"as is\" without express or implied warranty.\n *\n *\n * Copyright (c) 1996\n * Silicon Graphics Computer Systems, Inc.\n *\n * Permission to use, copy, modify, distribute and sell this software\n * and its documentation for any purpose is hereby granted without fee,\n * provided that the above copyright notice appear in all copies and\n * that both that copyright notice and this permission notice appear\n * in supporting documentation.  Silicon Graphics makes no\n * representations about the suitability of this software for any\n * purpose.  It is provided \"as is\" without express or implied warranty.\n */\n\n/** @file stl_algo.h\n *  This is an internal header file, included by other library headers.\n *  You should not attempt to use it directly.\n */\n\n#ifndef _ALGO_H\n#define _ALGO_H 1\n\n#include <bits/stl_heap.h>\n#include <bits/stl_tempbuf.h>     // for _Temporary_buffer\n#include <debug/debug.h>\n\n// See concept_check.h for the __glibcxx_*_requires macros.\n\n_GLIBCXX_BEGIN_NAMESPACE(std)\n\n  /**\n   *  @brief Find the median of three values.\n   *  @param  a  A value.\n   *  @param  b  A value.\n   *  @param  c  A value.\n   *  @return One of @p a, @p b or @p c.\n   *\n   *  If @c {l,m,n} is some convolution of @p {a,b,c} such that @c l<=m<=n\n   *  then the value returned will be @c m.\n   *  This is an SGI extension.\n   *  @ingroup SGIextensions\n  */\n  template<typename _Tp>\n    inline const _Tp&\n    __median(const _Tp& __a, const _Tp& __b, const _Tp& __c)\n    {\n      // concept requirements\n      __glibcxx_function_requires(_LessThanComparableConcept<_Tp>)\n      if (__a < __b)\n\tif (__b < __c)\n\t  return __b;\n\telse if (__a < __c)\n\t  return __c;\n\telse\n\t  return __a;\n      else if (__a < __c)\n\treturn __a;\n      else if (__b < __c)\n\treturn __c;\n      else\n\treturn __b;\n    }\n\n  /**\n   *  @brief Find the median of three values using a predicate for comparison.\n   *  @param  a     A value.\n   *  @param  b     A value.\n   *  @param  c     A value.\n   *  @param  comp  A binary predicate.\n   *  @return One of @p a, @p b or @p c.\n   *\n   *  If @c {l,m,n} is some convolution of @p {a,b,c} such that @p comp(l,m)\n   *  and @p comp(m,n) are both true then the value returned will be @c m.\n   *  This is an SGI extension.\n   *  @ingroup SGIextensions\n  */\n  template<typename _Tp, typename _Compare>\n    inline const _Tp&\n    __median(const _Tp& __a, const _Tp& __b, const _Tp& __c, _Compare __comp)\n    {\n      // concept requirements\n      __glibcxx_function_requires(_BinaryFunctionConcept<_Compare,bool,_Tp,_Tp>)\n      if (__comp(__a, __b))\n\tif (__comp(__b, __c))\n\t  return __b;\n\telse if (__comp(__a, __c))\n\t  return __c;\n\telse\n\t  return __a;\n      else if (__comp(__a, __c))\n\treturn __a;\n      else if (__comp(__b, __c))\n\treturn __c;\n      else\n\treturn __b;\n    }\n\n  /**\n   *  @brief Apply a function to every element of a sequence.\n   *  @param  first  An input iterator.\n   *  @param  last   An input iterator.\n   *  @param  f      A unary function object.\n   *  @return   @p f.\n   *\n   *  Applies the function object @p f to each element in the range\n   *  @p [first,last).  @p f must not modify the order of the sequence.\n   *  If @p f has a return value it is ignored.\n  */\n  template<typename _InputIterator, typename _Function>\n    _Function\n    for_each(_InputIterator __first, _InputIterator __last, _Function __f)\n    {\n      // concept requirements\n      __glibcxx_function_requires(_InputIteratorConcept<_InputIterator>)\n      __glibcxx_requires_valid_range(__first, __last);\n      for ( ; __first != __last; ++__first)\n\t__f(*__first);\n      return __f;\n    }\n\n  /**\n   *  @if maint\n   *  This is an overload used by find() for the Input Iterator case.\n   *  @endif\n  */\n  template<typename _InputIterator, typename _Tp>\n    inline _InputIterator\n    __find(_InputIterator __first, _InputIterator __last,\n\t   const _Tp& __val, input_iterator_tag)\n    {\n      while (__first != __last && !(*__first == __val))\n\t++__first;\n      return __first;\n    }\n\n  /**\n   *  @if maint\n   *  This is an overload used by find_if() for the Input Iterator case.\n   *  @endif\n  */\n  template<typename _InputIterator, typename _Predicate>\n    inline _InputIterator\n    __find_if(_InputIterator __first, _InputIterator __last,\n\t      _Predicate __pred, input_iterator_tag)\n    {\n      while (__first != __last && !__pred(*__first))\n\t++__first;\n      return __first;\n    }\n\n  /**\n   *  @if maint\n   *  This is an overload used by find() for the RAI case.\n   *  @endif\n  */\n  template<typename _RandomAccessIterator, typename _Tp>\n    _RandomAccessIterator\n    __find(_RandomAccessIterator __first, _RandomAccessIterator __last,\n\t   const _Tp& __val, random_access_iterator_tag)\n    {\n      typename iterator_traits<_RandomAccessIterator>::difference_type\n\t__trip_count = (__last - __first) >> 2;\n\n      for ( ; __trip_count > 0 ; --__trip_count)\n\t{\n\t  if (*__first == __val)\n\t    return __first;\n\t  ++__first;\n\n\t  if (*__first == __val)\n\t    return __first;\n\t  ++__first;\n\n\t  if (*__first == __val)\n\t    return __first;\n\t  ++__first;\n\n\t  if (*__first == __val)\n\t    return __first;\n\t  ++__first;\n\t}\n\n      switch (__last - __first)\n\t{\n\tcase 3:\n\t  if (*__first == __val)\n\t    return __first;\n\t  ++__first;\n\tcase 2:\n\t  if (*__first == __val)\n\t    return __first;\n\t  ++__first;\n\tcase 1:\n\t  if (*__first == __val)\n\t    return __first;\n\t  ++__first;\n\tcase 0:\n\tdefault:\n\t  return __last;\n\t}\n    }\n\n  /**\n   *  @if maint\n   *  This is an overload used by find_if() for the RAI case.\n   *  @endif\n  */\n  template<typename _RandomAccessIterator, typename _Predicate>\n    _RandomAccessIterator\n    __find_if(_RandomAccessIterator __first, _RandomAccessIterator __last,\n\t      _Predicate __pred, random_access_iterator_tag)\n    {\n      typename iterator_traits<_RandomAccessIterator>::difference_type\n\t__trip_count = (__last - __first) >> 2;\n\n      for ( ; __trip_count > 0 ; --__trip_count)\n\t{\n\t  if (__pred(*__first))\n\t    return __first;\n\t  ++__first;\n\n\t  if (__pred(*__first))\n\t    return __first;\n\t  ++__first;\n\n\t  if (__pred(*__first))\n\t    return __first;\n\t  ++__first;\n\n\t  if (__pred(*__first))\n\t    return __first;\n\t  ++__first;\n\t}\n\n      switch (__last - __first)\n\t{\n\tcase 3:\n\t  if (__pred(*__first))\n\t    return __first;\n\t  ++__first;\n\tcase 2:\n\t  if (__pred(*__first))\n\t    return __first;\n\t  ++__first;\n\tcase 1:\n\t  if (__pred(*__first))\n\t    return __first;\n\t  ++__first;\n\tcase 0:\n\tdefault:\n\t  return __last;\n\t}\n    }\n\n  /**\n   *  @if maint\n   *  This is an overload of find() for streambuf iterators.\n   *  @endif\n  */\n  template<typename _CharT>\n    typename __gnu_cxx::__enable_if<__is_char<_CharT>::__value,\n\t\t\t\t    istreambuf_iterator<_CharT> >::__type\n    find(istreambuf_iterator<_CharT>, istreambuf_iterator<_CharT>,\n\t const _CharT&);\n\n  /**\n   *  @brief Find the first occurrence of a value in a sequence.\n   *  @param  first  An input iterator.\n   *  @param  last   An input iterator.\n   *  @param  val    The value to find.\n   *  @return   The first iterator @c i in the range @p [first,last)\n   *  such that @c *i == @p val, or @p last if no such iterator exists.\n  */\n  template<typename _InputIterator, typename _Tp>\n    inline _InputIterator\n    find(_InputIterator __first, _InputIterator __last,\n\t const _Tp& __val)\n    {\n      // concept requirements\n      __glibcxx_function_requires(_InputIteratorConcept<_InputIterator>)\n      __glibcxx_function_requires(_EqualOpConcept<\n\t\ttypename iterator_traits<_InputIterator>::value_type, _Tp>)\n      __glibcxx_requires_valid_range(__first, __last);\n      return std::__find(__first, __last, __val,\n\t\t         std::__iterator_category(__first));\n    }\n\n  /**\n   *  @brief Find the first element in a sequence for which a predicate is true.\n   *  @param  first  An input iterator.\n   *  @param  last   An input iterator.\n   *  @param  pred   A predicate.\n   *  @return   The first iterator @c i in the range @p [first,last)\n   *  such that @p pred(*i) is true, or @p last if no such iterator exists.\n  */\n  template<typename _InputIterator, typename _Predicate>\n    inline _InputIterator\n    find_if(_InputIterator __first, _InputIterator __last,\n\t    _Predicate __pred)\n    {\n      // concept requirements\n      __glibcxx_function_requires(_InputIteratorConcept<_InputIterator>)\n      __glibcxx_function_requires(_UnaryPredicateConcept<_Predicate,\n\t      typename iterator_traits<_InputIterator>::value_type>)\n      __glibcxx_requires_valid_range(__first, __last);\n      return std::__find_if(__first, __last, __pred,\n\t\t\t    std::__iterator_category(__first));\n    }\n\n  /**\n   *  @brief Find two adjacent values in a sequence that are equal.\n   *  @param  first  A forward iterator.\n   *  @param  last   A forward iterator.\n   *  @return   The first iterator @c i such that @c i and @c i+1 are both\n   *  valid iterators in @p [first,last) and such that @c *i == @c *(i+1),\n   *  or @p last if no such iterator exists.\n  */\n  template<typename _ForwardIterator>\n    _ForwardIterator\n    adjacent_find(_ForwardIterator __first, _ForwardIterator __last)\n    {\n      // concept requirements\n      __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator>)\n      __glibcxx_function_requires(_EqualityComparableConcept<\n\t    typename iterator_traits<_ForwardIterator>::value_type>)\n      __glibcxx_requires_valid_range(__first, __last);\n      if (__first == __last)\n\treturn __last;\n      _ForwardIterator __next = __first;\n      while(++__next != __last)\n\t{\n\t  if (*__first == *__next)\n\t    return __first;\n\t  __first = __next;\n\t}\n      return __last;\n    }\n\n  /**\n   *  @brief Find two adjacent values in a sequence using a predicate.\n   *  @param  first         A forward iterator.\n   *  @param  last          A forward iterator.\n   *  @param  binary_pred   A binary predicate.\n   *  @return   The first iterator @c i such that @c i and @c i+1 are both\n   *  valid iterators in @p [first,last) and such that\n   *  @p binary_pred(*i,*(i+1)) is true, or @p last if no such iterator\n   *  exists.\n  */\n  template<typename _ForwardIterator, typename _BinaryPredicate>\n    _ForwardIterator\n    adjacent_find(_ForwardIterator __first, _ForwardIterator __last,\n\t\t  _BinaryPredicate __binary_pred)\n    {\n      // concept requirements\n      __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator>)\n      __glibcxx_function_requires(_BinaryPredicateConcept<_BinaryPredicate,\n\t    typename iterator_traits<_ForwardIterator>::value_type,\n\t    typename iterator_traits<_ForwardIterator>::value_type>)\n      __glibcxx_requires_valid_range(__first, __last);\n      if (__first == __last)\n\treturn __last;\n      _ForwardIterator __next = __first;\n      while(++__next != __last)\n\t{\n\t  if (__binary_pred(*__first, *__next))\n\t    return __first;\n\t  __first = __next;\n\t}\n      return __last;\n    }\n\n  /**\n   *  @brief Count the number of copies of a value in a sequence.\n   *  @param  first  An input iterator.\n   *  @param  last   An input iterator.\n   *  @param  value  The value to be counted.\n   *  @return   The number of iterators @c i in the range @p [first,last)\n   *  for which @c *i == @p value\n  */\n  template<typename _InputIterator, typename _Tp>\n    typename iterator_traits<_InputIterator>::difference_type\n    count(_InputIterator __first, _InputIterator __last, const _Tp& __value)\n    {\n      // concept requirements\n      __glibcxx_function_requires(_InputIteratorConcept<_InputIterator>)\n      __glibcxx_function_requires(_EqualOpConcept<\n\ttypename iterator_traits<_InputIterator>::value_type, _Tp>)\n      __glibcxx_requires_valid_range(__first, __last);\n      typename iterator_traits<_InputIterator>::difference_type __n = 0;\n      for ( ; __first != __last; ++__first)\n\tif (*__first == __value)\n\t  ++__n;\n      return __n;\n    }\n\n  /**\n   *  @brief Count the elements of a sequence for which a predicate is true.\n   *  @param  first  An input iterator.\n   *  @param  last   An input iterator.\n   *  @param  pred   A predicate.\n   *  @return   The number of iterators @c i in the range @p [first,last)\n   *  for which @p pred(*i) is true.\n  */\n  template<typename _InputIterator, typename _Predicate>\n    typename iterator_traits<_InputIterator>::difference_type\n    count_if(_InputIterator __first, _InputIterator __last, _Predicate __pred)\n    {\n      // concept requirements\n      __glibcxx_function_requires(_InputIteratorConcept<_InputIterator>)\n      __glibcxx_function_requires(_UnaryPredicateConcept<_Predicate,\n\t    typename iterator_traits<_InputIterator>::value_type>)\n      __glibcxx_requires_valid_range(__first, __last);\n      typename iterator_traits<_InputIterator>::difference_type __n = 0;\n      for ( ; __first != __last; ++__first)\n\tif (__pred(*__first))\n\t  ++__n;\n      return __n;\n    }\n\n  /**\n   *  @brief Search a sequence for a matching sub-sequence.\n   *  @param  first1  A forward iterator.\n   *  @param  last1   A forward iterator.\n   *  @param  first2  A forward iterator.\n   *  @param  last2   A forward iterator.\n   *  @return   The first iterator @c i in the range\n   *  @p [first1,last1-(last2-first2)) such that @c *(i+N) == @p *(first2+N)\n   *  for each @c N in the range @p [0,last2-first2), or @p last1 if no\n   *  such iterator exists.\n   *\n   *  Searches the range @p [first1,last1) for a sub-sequence that compares\n   *  equal value-by-value with the sequence given by @p [first2,last2) and\n   *  returns an iterator to the first element of the sub-sequence, or\n   *  @p last1 if the sub-sequence is not found.\n   *\n   *  Because the sub-sequence must lie completely within the range\n   *  @p [first1,last1) it must start at a position less than\n   *  @p last1-(last2-first2) where @p last2-first2 is the length of the\n   *  sub-sequence.\n   *  This means that the returned iterator @c i will be in the range\n   *  @p [first1,last1-(last2-first2))\n  */\n  template<typename _ForwardIterator1, typename _ForwardIterator2>\n    _ForwardIterator1\n    search(_ForwardIterator1 __first1, _ForwardIterator1 __last1,\n\t   _ForwardIterator2 __first2, _ForwardIterator2 __last2)\n    {\n      // concept requirements\n      __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator1>)\n      __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator2>)\n      __glibcxx_function_requires(_EqualOpConcept<\n\t    typename iterator_traits<_ForwardIterator1>::value_type,\n\t    typename iterator_traits<_ForwardIterator2>::value_type>)\n      __glibcxx_requires_valid_range(__first1, __last1);\n      __glibcxx_requires_valid_range(__first2, __last2);\n      // Test for empty ranges\n      if (__first1 == __last1 || __first2 == __last2)\n\treturn __first1;\n\n      // Test for a pattern of length 1.\n      _ForwardIterator2 __tmp(__first2);\n      ++__tmp;\n      if (__tmp == __last2)\n\treturn std::find(__first1, __last1, *__first2);\n\n      // General case.\n      _ForwardIterator2 __p1, __p;\n      __p1 = __first2; ++__p1;\n      _ForwardIterator1 __current = __first1;\n\n      while (__first1 != __last1)\n\t{\n\t  __first1 = std::find(__first1, __last1, *__first2);\n\t  if (__first1 == __last1)\n\t    return __last1;\n\n\t  __p = __p1;\n\t  __current = __first1;\n\t  if (++__current == __last1)\n\t    return __last1;\n\n\t  while (*__current == *__p)\n\t    {\n\t      if (++__p == __last2)\n\t\treturn __first1;\n\t      if (++__current == __last1)\n\t\treturn __last1;\n\t    }\n\t  ++__first1;\n\t}\n      return __first1;\n    }\n\n  /**\n   *  @brief Search a sequence for a matching sub-sequence using a predicate.\n   *  @param  first1     A forward iterator.\n   *  @param  last1      A forward iterator.\n   *  @param  first2     A forward iterator.\n   *  @param  last2      A forward iterator.\n   *  @param  predicate  A binary predicate.\n   *  @return   The first iterator @c i in the range\n   *  @p [first1,last1-(last2-first2)) such that\n   *  @p predicate(*(i+N),*(first2+N)) is true for each @c N in the range\n   *  @p [0,last2-first2), or @p last1 if no such iterator exists.\n   *\n   *  Searches the range @p [first1,last1) for a sub-sequence that compares\n   *  equal value-by-value with the sequence given by @p [first2,last2),\n   *  using @p predicate to determine equality, and returns an iterator\n   *  to the first element of the sub-sequence, or @p last1 if no such\n   *  iterator exists.\n   *\n   *  @see search(_ForwardIter1, _ForwardIter1, _ForwardIter2, _ForwardIter2)\n  */\n  template<typename _ForwardIterator1, typename _ForwardIterator2,\n\t   typename _BinaryPredicate>\n    _ForwardIterator1\n    search(_ForwardIterator1 __first1, _ForwardIterator1 __last1,\n\t   _ForwardIterator2 __first2, _ForwardIterator2 __last2,\n\t   _BinaryPredicate  __predicate)\n    {\n      // concept requirements\n      __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator1>)\n      __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator2>)\n      __glibcxx_function_requires(_BinaryPredicateConcept<_BinaryPredicate,\n\t    typename iterator_traits<_ForwardIterator1>::value_type,\n\t    typename iterator_traits<_ForwardIterator2>::value_type>)\n      __glibcxx_requires_valid_range(__first1, __last1);\n      __glibcxx_requires_valid_range(__first2, __last2);\n\n      // Test for empty ranges\n      if (__first1 == __last1 || __first2 == __last2)\n\treturn __first1;\n\n      // Test for a pattern of length 1.\n      _ForwardIterator2 __tmp(__first2);\n      ++__tmp;\n      if (__tmp == __last2)\n\t{\n\t  while (__first1 != __last1 && !__predicate(*__first1, *__first2))\n\t    ++__first1;\n\t  return __first1;\n\t}\n\n      // General case.\n      _ForwardIterator2 __p1, __p;\n      __p1 = __first2; ++__p1;\n      _ForwardIterator1 __current = __first1;\n\n      while (__first1 != __last1)\n\t{\n\t  while (__first1 != __last1)\n\t    {\n\t      if (__predicate(*__first1, *__first2))\n\t\tbreak;\n\t      ++__first1;\n\t    }\n\t  while (__first1 != __last1 && !__predicate(*__first1, *__first2))\n\t    ++__first1;\n\t  if (__first1 == __last1)\n\t    return __last1;\n\n\t  __p = __p1;\n\t  __current = __first1;\n\t  if (++__current == __last1)\n\t    return __last1;\n\n\t  while (__predicate(*__current, *__p))\n\t    {\n\t      if (++__p == __last2)\n\t\treturn __first1;\n\t      if (++__current == __last1)\n\t\treturn __last1;\n\t    }\n\t  ++__first1;\n\t}\n      return __first1;\n    }\n\n  /**\n   *  @if maint\n   *  This is an uglified\n   *  search_n(_ForwardIterator, _ForwardIterator, _Integer, const _Tp&)\n   *  overloaded for forward iterators.\n   *  @endif\n  */\n  template<typename _ForwardIterator, typename _Integer, typename _Tp>\n    _ForwardIterator\n    __search_n(_ForwardIterator __first, _ForwardIterator __last,\n\t       _Integer __count, const _Tp& __val,\n\t       std::forward_iterator_tag)\n    {\n      __first = std::find(__first, __last, __val);\n      while (__first != __last)\n\t{\n\t  typename iterator_traits<_ForwardIterator>::difference_type\n\t    __n = __count;\n\t  _ForwardIterator __i = __first;\n\t  ++__i;\n\t  while (__i != __last && __n != 1 && *__i == __val)\n\t    {\n\t      ++__i;\n\t      --__n;\n\t    }\n\t  if (__n == 1)\n\t    return __first;\n\t  if (__i == __last)\n\t    return __last;\n\t  __first = std::find(++__i, __last, __val);\n\t}\n      return __last;\n    }\n\n  /**\n   *  @if maint\n   *  This is an uglified\n   *  search_n(_ForwardIterator, _ForwardIterator, _Integer, const _Tp&)\n   *  overloaded for random access iterators.\n   *  @endif\n  */\n  template<typename _RandomAccessIter, typename _Integer, typename _Tp>\n    _RandomAccessIter\n    __search_n(_RandomAccessIter __first, _RandomAccessIter __last,\n\t       _Integer __count, const _Tp& __val, \n\t       std::random_access_iterator_tag)\n    {\n      \n      typedef typename std::iterator_traits<_RandomAccessIter>::difference_type\n\t_DistanceType;\n\n      _DistanceType __tailSize = __last - __first;\n      const _DistanceType __pattSize = __count;\n\n      if (__tailSize < __pattSize)\n        return __last;\n\n      const _DistanceType __skipOffset = __pattSize - 1;\n      _RandomAccessIter __lookAhead = __first + __skipOffset;\n      __tailSize -= __pattSize;\n\n      while (1) // the main loop...\n\t{\n\t  // __lookAhead here is always pointing to the last element of next \n\t  // possible match.\n\t  while (!(*__lookAhead == __val)) // the skip loop...\n\t    {\n\t      if (__tailSize < __pattSize)\n\t\treturn __last;  // Failure\n\t      __lookAhead += __pattSize;\n\t      __tailSize -= __pattSize;\n\t    }\n\t  _DistanceType __remainder = __skipOffset;\n\t  for (_RandomAccessIter __backTrack = __lookAhead - 1; \n\t       *__backTrack == __val; --__backTrack)\n\t    {\n\t      if (--__remainder == 0)\n\t\treturn (__lookAhead - __skipOffset); // Success\n\t    }\n\t  if (__remainder > __tailSize)\n\t    return __last; // Failure\n\t  __lookAhead += __remainder;\n\t  __tailSize -= __remainder;\n\t}\n    }\n\n  /**\n   *  @brief Search a sequence for a number of consecutive values.\n   *  @param  first  A forward iterator.\n   *  @param  last   A forward iterator.\n   *  @param  count  The number of consecutive values.\n   *  @param  val    The value to find.\n   *  @return   The first iterator @c i in the range @p [first,last-count)\n   *  such that @c *(i+N) == @p val for each @c N in the range @p [0,count),\n   *  or @p last if no such iterator exists.\n   *\n   *  Searches the range @p [first,last) for @p count consecutive elements\n   *  equal to @p val.\n  */\n  template<typename _ForwardIterator, typename _Integer, typename _Tp>\n    _ForwardIterator\n    search_n(_ForwardIterator __first, _ForwardIterator __last,\n\t     _Integer __count, const _Tp& __val)\n    {\n      // concept requirements\n      __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator>)\n      __glibcxx_function_requires(_EqualOpConcept<\n\ttypename iterator_traits<_ForwardIterator>::value_type, _Tp>)\n      __glibcxx_requires_valid_range(__first, __last);\n\n      if (__count <= 0)\n\treturn __first;\n      if (__count == 1)\n\treturn std::find(__first, __last, __val);\n      return std::__search_n(__first, __last, __count, __val,\n\t\t\t     std::__iterator_category(__first));\n    }\n\n  /**\n   *  @if maint\n   *  This is an uglified\n   *  search_n(_ForwardIterator, _ForwardIterator, _Integer, const _Tp&,\n   *\t       _BinaryPredicate)\n   *  overloaded for forward iterators.\n   *  @endif\n  */\n  template<typename _ForwardIterator, typename _Integer, typename _Tp,\n           typename _BinaryPredicate>\n    _ForwardIterator\n    __search_n(_ForwardIterator __first, _ForwardIterator __last,\n\t       _Integer __count, const _Tp& __val,\n\t       _BinaryPredicate __binary_pred, std::forward_iterator_tag)\n    {\n      while (__first != __last && !__binary_pred(*__first, __val))\n        ++__first;\n\n      while (__first != __last)\n\t{\n\t  typename iterator_traits<_ForwardIterator>::difference_type\n\t    __n = __count;\n\t  _ForwardIterator __i = __first;\n\t  ++__i;\n\t  while (__i != __last && __n != 1 && __binary_pred(*__i, __val))\n\t    {\n\t      ++__i;\n\t      --__n;\n\t    }\n\t  if (__n == 1)\n\t    return __first;\n\t  if (__i == __last)\n\t    return __last;\n\t  __first = ++__i;\n\t  while (__first != __last && !__binary_pred(*__first, __val))\n\t    ++__first;\n\t}\n      return __last;\n    }\n\n  /**\n   *  @if maint\n   *  This is an uglified\n   *  search_n(_ForwardIterator, _ForwardIterator, _Integer, const _Tp&,\n   *\t       _BinaryPredicate)\n   *  overloaded for random access iterators.\n   *  @endif\n  */\n  template<typename _RandomAccessIter, typename _Integer, typename _Tp,\n\t   typename _BinaryPredicate>\n    _RandomAccessIter\n    __search_n(_RandomAccessIter __first, _RandomAccessIter __last,\n\t       _Integer __count, const _Tp& __val,\n\t       _BinaryPredicate __binary_pred, std::random_access_iterator_tag)\n    {\n      \n      typedef typename std::iterator_traits<_RandomAccessIter>::difference_type\n\t_DistanceType;\n\n      _DistanceType __tailSize = __last - __first;\n      const _DistanceType __pattSize = __count;\n\n      if (__tailSize < __pattSize)\n        return __last;\n\n      const _DistanceType __skipOffset = __pattSize - 1;\n      _RandomAccessIter __lookAhead = __first + __skipOffset;\n      __tailSize -= __pattSize;\n\n      while (1) // the main loop...\n\t{\n\t  // __lookAhead here is always pointing to the last element of next \n\t  // possible match.\n\t  while (!__binary_pred(*__lookAhead, __val)) // the skip loop...\n\t    {\n\t      if (__tailSize < __pattSize)\n\t\treturn __last;  // Failure\n\t      __lookAhead += __pattSize;\n\t      __tailSize -= __pattSize;\n\t    }\n\t  _DistanceType __remainder = __skipOffset;\n\t  for (_RandomAccessIter __backTrack = __lookAhead - 1; \n\t       __binary_pred(*__backTrack, __val); --__backTrack)\n\t    {\n\t      if (--__remainder == 0)\n\t\treturn (__lookAhead - __skipOffset); // Success\n\t    }\n\t  if (__remainder > __tailSize)\n\t    return __last; // Failure\n\t  __lookAhead += __remainder;\n\t  __tailSize -= __remainder;\n\t}\n    }\n\n  /**\n   *  @brief Search a sequence for a number of consecutive values using a\n   *         predicate.\n   *  @param  first        A forward iterator.\n   *  @param  last         A forward iterator.\n   *  @param  count        The number of consecutive values.\n   *  @param  val          The value to find.\n   *  @param  binary_pred  A binary predicate.\n   *  @return   The first iterator @c i in the range @p [first,last-count)\n   *  such that @p binary_pred(*(i+N),val) is true for each @c N in the\n   *  range @p [0,count), or @p last if no such iterator exists.\n   *\n   *  Searches the range @p [first,last) for @p count consecutive elements\n   *  for which the predicate returns true.\n  */\n  template<typename _ForwardIterator, typename _Integer, typename _Tp,\n           typename _BinaryPredicate>\n    _ForwardIterator\n    search_n(_ForwardIterator __first, _ForwardIterator __last,\n\t     _Integer __count, const _Tp& __val,\n\t     _BinaryPredicate __binary_pred)\n    {\n      // concept requirements\n      __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator>)\n      __glibcxx_function_requires(_BinaryPredicateConcept<_BinaryPredicate,\n\t    typename iterator_traits<_ForwardIterator>::value_type, _Tp>)\n      __glibcxx_requires_valid_range(__first, __last);\n\n      if (__count <= 0)\n\treturn __first;\n      if (__count == 1)\n\t{\n\t  while (__first != __last && !__binary_pred(*__first, __val))\n\t    ++__first;\n\t  return __first;\n\t}\n      return std::__search_n(__first, __last, __count, __val, __binary_pred,\n\t\t\t     std::__iterator_category(__first));\n    }\n\n  /**\n   *  @brief Swap the elements of two sequences.\n   *  @param  first1  A forward iterator.\n   *  @param  last1   A forward iterator.\n   *  @param  first2  A forward iterator.\n   *  @return   An iterator equal to @p first2+(last1-first1).\n   *\n   *  Swaps each element in the range @p [first1,last1) with the\n   *  corresponding element in the range @p [first2,(last1-first1)).\n   *  The ranges must not overlap.\n  */\n  template<typename _ForwardIterator1, typename _ForwardIterator2>\n    _ForwardIterator2\n    swap_ranges(_ForwardIterator1 __first1, _ForwardIterator1 __last1,\n\t\t_ForwardIterator2 __first2)\n    {\n      // concept requirements\n      __glibcxx_function_requires(_Mutable_ForwardIteratorConcept<\n\t\t\t\t  _ForwardIterator1>)\n      __glibcxx_function_requires(_Mutable_ForwardIteratorConcept<\n\t\t\t\t  _ForwardIterator2>)\n      __glibcxx_function_requires(_ConvertibleConcept<\n\t    typename iterator_traits<_ForwardIterator1>::value_type,\n\t    typename iterator_traits<_ForwardIterator2>::value_type>)\n      __glibcxx_function_requires(_ConvertibleConcept<\n\t    typename iterator_traits<_ForwardIterator2>::value_type,\n\t    typename iterator_traits<_ForwardIterator1>::value_type>)\n      __glibcxx_requires_valid_range(__first1, __last1);\n\n      for ( ; __first1 != __last1; ++__first1, ++__first2)\n\tstd::iter_swap(__first1, __first2);\n      return __first2;\n    }\n\n  /**\n   *  @brief Perform an operation on a sequence.\n   *  @param  first     An input iterator.\n   *  @param  last      An input iterator.\n   *  @param  result    An output iterator.\n   *  @param  unary_op  A unary operator.\n   *  @return   An output iterator equal to @p result+(last-first).\n   *\n   *  Applies the operator to each element in the input range and assigns\n   *  the results to successive elements of the output sequence.\n   *  Evaluates @p *(result+N)=unary_op(*(first+N)) for each @c N in the\n   *  range @p [0,last-first).\n   *\n   *  @p unary_op must not alter its argument.\n  */\n  template<typename _InputIterator, typename _OutputIterator,\n\t   typename _UnaryOperation>\n    _OutputIterator\n    transform(_InputIterator __first, _InputIterator __last,\n\t      _OutputIterator __result, _UnaryOperation __unary_op)\n    {\n      // concept requirements\n      __glibcxx_function_requires(_InputIteratorConcept<_InputIterator>)\n      __glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator,\n            // \"the type returned by a _UnaryOperation\"\n            __typeof__(__unary_op(*__first))>)\n      __glibcxx_requires_valid_range(__first, __last);\n\n      for ( ; __first != __last; ++__first, ++__result)\n\t*__result = __unary_op(*__first);\n      return __result;\n    }\n\n  /**\n   *  @brief Perform an operation on corresponding elements of two sequences.\n   *  @param  first1     An input iterator.\n   *  @param  last1      An input iterator.\n   *  @param  first2     An input iterator.\n   *  @param  result     An output iterator.\n   *  @param  binary_op  A binary operator.\n   *  @return   An output iterator equal to @p result+(last-first).\n   *\n   *  Applies the operator to the corresponding elements in the two\n   *  input ranges and assigns the results to successive elements of the\n   *  output sequence.\n   *  Evaluates @p *(result+N)=binary_op(*(first1+N),*(first2+N)) for each\n   *  @c N in the range @p [0,last1-first1).\n   *\n   *  @p binary_op must not alter either of its arguments.\n  */\n  template<typename _InputIterator1, typename _InputIterator2,\n\t   typename _OutputIterator, typename _BinaryOperation>\n    _OutputIterator\n    transform(_InputIterator1 __first1, _InputIterator1 __last1,\n\t      _InputIterator2 __first2, _OutputIterator __result,\n\t      _BinaryOperation __binary_op)\n    {\n      // concept requirements\n      __glibcxx_function_requires(_InputIteratorConcept<_InputIterator1>)\n      __glibcxx_function_requires(_InputIteratorConcept<_InputIterator2>)\n      __glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator,\n            // \"the type returned by a _BinaryOperation\"\n            __typeof__(__binary_op(*__first1,*__first2))>)\n      __glibcxx_requires_valid_range(__first1, __last1);\n\n      for ( ; __first1 != __last1; ++__first1, ++__first2, ++__result)\n\t*__result = __binary_op(*__first1, *__first2);\n      return __result;\n    }\n\n  /**\n   *  @brief Replace each occurrence of one value in a sequence with another\n   *         value.\n   *  @param  first      A forward iterator.\n   *  @param  last       A forward iterator.\n   *  @param  old_value  The value to be replaced.\n   *  @param  new_value  The replacement value.\n   *  @return   replace() returns no value.\n   *\n   *  For each iterator @c i in the range @p [first,last) if @c *i ==\n   *  @p old_value then the assignment @c *i = @p new_value is performed.\n  */\n  template<typename _ForwardIterator, typename _Tp>\n    void\n    replace(_ForwardIterator __first, _ForwardIterator __last,\n\t    const _Tp& __old_value, const _Tp& __new_value)\n    {\n      // concept requirements\n      __glibcxx_function_requires(_Mutable_ForwardIteratorConcept<\n\t\t\t\t  _ForwardIterator>)\n      __glibcxx_function_requires(_EqualOpConcept<\n\t    typename iterator_traits<_ForwardIterator>::value_type, _Tp>)\n      __glibcxx_function_requires(_ConvertibleConcept<_Tp,\n\t    typename iterator_traits<_ForwardIterator>::value_type>)\n      __glibcxx_requires_valid_range(__first, __last);\n\n      for ( ; __first != __last; ++__first)\n\tif (*__first == __old_value)\n\t  *__first = __new_value;\n    }\n\n  /**\n   *  @brief Replace each value in a sequence for which a predicate returns\n   *         true with another value.\n   *  @param  first      A forward iterator.\n   *  @param  last       A forward iterator.\n   *  @param  pred       A predicate.\n   *  @param  new_value  The replacement value.\n   *  @return   replace_if() returns no value.\n   *\n   *  For each iterator @c i in the range @p [first,last) if @p pred(*i)\n   *  is true then the assignment @c *i = @p new_value is performed.\n  */\n  template<typename _ForwardIterator, typename _Predicate, typename _Tp>\n    void\n    replace_if(_ForwardIterator __first, _ForwardIterator __last,\n\t       _Predicate __pred, const _Tp& __new_value)\n    {\n      // concept requirements\n      __glibcxx_function_requires(_Mutable_ForwardIteratorConcept<\n\t\t\t\t  _ForwardIterator>)\n      __glibcxx_function_requires(_ConvertibleConcept<_Tp,\n\t    typename iterator_traits<_ForwardIterator>::value_type>)\n      __glibcxx_function_requires(_UnaryPredicateConcept<_Predicate,\n\t    typename iterator_traits<_ForwardIterator>::value_type>)\n      __glibcxx_requires_valid_range(__first, __last);\n\n      for ( ; __first != __last; ++__first)\n\tif (__pred(*__first))\n\t  *__first = __new_value;\n    }\n\n  /**\n   *  @brief Copy a sequence, replacing each element of one value with another\n   *         value.\n   *  @param  first      An input iterator.\n   *  @param  last       An input iterator.\n   *  @param  result     An output iterator.\n   *  @param  old_value  The value to be replaced.\n   *  @param  new_value  The replacement value.\n   *  @return   The end of the output sequence, @p result+(last-first).\n   *\n   *  Copies each element in the input range @p [first,last) to the\n   *  output range @p [result,result+(last-first)) replacing elements\n   *  equal to @p old_value with @p new_value.\n  */\n  template<typename _InputIterator, typename _OutputIterator, typename _Tp>\n    _OutputIterator\n    replace_copy(_InputIterator __first, _InputIterator __last,\n\t\t _OutputIterator __result,\n\t\t const _Tp& __old_value, const _Tp& __new_value)\n    {\n      // concept requirements\n      __glibcxx_function_requires(_InputIteratorConcept<_InputIterator>)\n      __glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator,\n\t    typename iterator_traits<_InputIterator>::value_type>)\n      __glibcxx_function_requires(_EqualOpConcept<\n\t    typename iterator_traits<_InputIterator>::value_type, _Tp>)\n      __glibcxx_requires_valid_range(__first, __last);\n\n      for ( ; __first != __last; ++__first, ++__result)\n\tif (*__first == __old_value)\n\t  *__result = __new_value;\n\telse\n\t  *__result = *__first;\n      return __result;\n    }\n\n  /**\n   *  @brief Copy a sequence, replacing each value for which a predicate\n   *         returns true with another value.\n   *  @param  first      An input iterator.\n   *  @param  last       An input iterator.\n   *  @param  result     An output iterator.\n   *  @param  pred       A predicate.\n   *  @param  new_value  The replacement value.\n   *  @return   The end of the output sequence, @p result+(last-first).\n   *\n   *  Copies each element in the range @p [first,last) to the range\n   *  @p [result,result+(last-first)) replacing elements for which\n   *  @p pred returns true with @p new_value.\n  */\n  template<typename _InputIterator, typename _OutputIterator,\n\t   typename _Predicate, typename _Tp>\n    _OutputIterator\n    replace_copy_if(_InputIterator __first, _InputIterator __last,\n\t\t    _OutputIterator __result,\n\t\t    _Predicate __pred, const _Tp& __new_value)\n    {\n      // concept requirements\n      __glibcxx_function_requires(_InputIteratorConcept<_InputIterator>)\n      __glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator,\n\t    typename iterator_traits<_InputIterator>::value_type>)\n      __glibcxx_function_requires(_UnaryPredicateConcept<_Predicate,\n\t    typename iterator_traits<_InputIterator>::value_type>)\n      __glibcxx_requires_valid_range(__first, __last);\n\n      for ( ; __first != __last; ++__first, ++__result)\n\tif (__pred(*__first))\n\t  *__result = __new_value;\n\telse\n\t  *__result = *__first;\n      return __result;\n    }\n\n  /**\n   *  @brief Assign the result of a function object to each value in a\n   *         sequence.\n   *  @param  first  A forward iterator.\n   *  @param  last   A forward iterator.\n   *  @param  gen    A function object taking no arguments.\n   *  @return   generate() returns no value.\n   *\n   *  Performs the assignment @c *i = @p gen() for each @c i in the range\n   *  @p [first,last).\n  */\n  template<typename _ForwardIterator, typename _Generator>\n    void\n    generate(_ForwardIterator __first, _ForwardIterator __last,\n\t     _Generator __gen)\n    {\n      // concept requirements\n      __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator>)\n      __glibcxx_function_requires(_GeneratorConcept<_Generator,\n\t    typename iterator_traits<_ForwardIterator>::value_type>)\n      __glibcxx_requires_valid_range(__first, __last);\n\n      for ( ; __first != __last; ++__first)\n\t*__first = __gen();\n    }\n\n  /**\n   *  @brief Assign the result of a function object to each value in a\n   *         sequence.\n   *  @param  first  A forward iterator.\n   *  @param  n      The length of the sequence.\n   *  @param  gen    A function object taking no arguments.\n   *  @return   The end of the sequence, @p first+n\n   *\n   *  Performs the assignment @c *i = @p gen() for each @c i in the range\n   *  @p [first,first+n).\n  */\n  template<typename _OutputIterator, typename _Size, typename _Generator>\n    _OutputIterator\n    generate_n(_OutputIterator __first, _Size __n, _Generator __gen)\n    {\n      // concept requirements\n      __glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator,\n            // \"the type returned by a _Generator\"\n            __typeof__(__gen())>)\n\n      for ( ; __n > 0; --__n, ++__first)\n\t*__first = __gen();\n      return __first;\n    }\n\n  /**\n   *  @brief Copy a sequence, removing elements of a given value.\n   *  @param  first   An input iterator.\n   *  @param  last    An input iterator.\n   *  @param  result  An output iterator.\n   *  @param  value   The value to be removed.\n   *  @return   An iterator designating the end of the resulting sequence.\n   *\n   *  Copies each element in the range @p [first,last) not equal to @p value\n   *  to the range beginning at @p result.\n   *  remove_copy() is stable, so the relative order of elements that are\n   *  copied is unchanged.\n  */\n  template<typename _InputIterator, typename _OutputIterator, typename _Tp>\n    _OutputIterator\n    remove_copy(_InputIterator __first, _InputIterator __last,\n\t\t_OutputIterator __result, const _Tp& __value)\n    {\n      // concept requirements\n      __glibcxx_function_requires(_InputIteratorConcept<_InputIterator>)\n      __glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator,\n\t    typename iterator_traits<_InputIterator>::value_type>)\n      __glibcxx_function_requires(_EqualOpConcept<\n\t    typename iterator_traits<_InputIterator>::value_type, _Tp>)\n      __glibcxx_requires_valid_range(__first, __last);\n\n      for ( ; __first != __last; ++__first)\n\tif (!(*__first == __value))\n\t  {\n\t    *__result = *__first;\n\t    ++__result;\n\t  }\n      return __result;\n    }\n\n  /**\n   *  @brief Copy a sequence, removing elements for which a predicate is true.\n   *  @param  first   An input iterator.\n   *  @param  last    An input iterator.\n   *  @param  result  An output iterator.\n   *  @param  pred    A predicate.\n   *  @return   An iterator designating the end of the resulting sequence.\n   *\n   *  Copies each element in the range @p [first,last) for which\n   *  @p pred returns true to the range beginning at @p result.\n   *\n   *  remove_copy_if() is stable, so the relative order of elements that are\n   *  copied is unchanged.\n  */\n  template<typename _InputIterator, typename _OutputIterator,\n\t   typename _Predicate>\n    _OutputIterator\n    remove_copy_if(_InputIterator __first, _InputIterator __last,\n\t\t   _OutputIterator __result, _Predicate __pred)\n    {\n      // concept requirements\n      __glibcxx_function_requires(_InputIteratorConcept<_InputIterator>)\n      __glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator,\n\t    typename iterator_traits<_InputIterator>::value_type>)\n      __glibcxx_function_requires(_UnaryPredicateConcept<_Predicate,\n\t    typename iterator_traits<_InputIterator>::value_type>)\n      __glibcxx_requires_valid_range(__first, __last);\n\n      for ( ; __first != __last; ++__first)\n\tif (!__pred(*__first))\n\t  {\n\t    *__result = *__first;\n\t    ++__result;\n\t  }\n      return __result;\n    }\n\n  /**\n   *  @brief Remove elements from a sequence.\n   *  @param  first  An input iterator.\n   *  @param  last   An input iterator.\n   *  @param  value  The value to be removed.\n   *  @return   An iterator designating the end of the resulting sequence.\n   *\n   *  All elements equal to @p value are removed from the range\n   *  @p [first,last).\n   *\n   *  remove() is stable, so the relative order of elements that are\n   *  not removed is unchanged.\n   *\n   *  Elements between the end of the resulting sequence and @p last\n   *  are still present, but their value is unspecified.\n  */\n  template<typename _ForwardIterator, typename _Tp>\n    _ForwardIterator\n    remove(_ForwardIterator __first, _ForwardIterator __last,\n\t   const _Tp& __value)\n    {\n      // concept requirements\n      __glibcxx_function_requires(_Mutable_ForwardIteratorConcept<\n\t\t\t\t  _ForwardIterator>)\n      __glibcxx_function_requires(_EqualOpConcept<\n\t    typename iterator_traits<_ForwardIterator>::value_type, _Tp>)\n      __glibcxx_requires_valid_range(__first, __last);\n\n      __first = std::find(__first, __last, __value);\n      _ForwardIterator __i = __first;\n      return __first == __last ? __first\n\t\t\t       : std::remove_copy(++__i, __last,\n\t\t\t\t\t\t  __first, __value);\n    }\n\n  /**\n   *  @brief Remove elements from a sequence using a predicate.\n   *  @param  first  A forward iterator.\n   *  @param  last   A forward iterator.\n   *  @param  pred   A predicate.\n   *  @return   An iterator designating the end of the resulting sequence.\n   *\n   *  All elements for which @p pred returns true are removed from the range\n   *  @p [first,last).\n   *\n   *  remove_if() is stable, so the relative order of elements that are\n   *  not removed is unchanged.\n   *\n   *  Elements between the end of the resulting sequence and @p last\n   *  are still present, but their value is unspecified.\n  */\n  template<typename _ForwardIterator, typename _Predicate>\n    _ForwardIterator\n    remove_if(_ForwardIterator __first, _ForwardIterator __last,\n\t      _Predicate __pred)\n    {\n      // concept requirements\n      __glibcxx_function_requires(_Mutable_ForwardIteratorConcept<\n\t\t\t\t  _ForwardIterator>)\n      __glibcxx_function_requires(_UnaryPredicateConcept<_Predicate,\n\t    typename iterator_traits<_ForwardIterator>::value_type>)\n      __glibcxx_requires_valid_range(__first, __last);\n\n      __first = std::find_if(__first, __last, __pred);\n      _ForwardIterator __i = __first;\n      return __first == __last ? __first\n\t\t\t       : std::remove_copy_if(++__i, __last,\n\t\t\t\t\t\t     __first, __pred);\n    }\n\n  /**\n   *  @if maint\n   *  This is an uglified unique_copy(_InputIterator, _InputIterator,\n   *                                  _OutputIterator)\n   *  overloaded for forward iterators and output iterator as result.\n   *  @endif\n  */\n  template<typename _ForwardIterator, typename _OutputIterator>\n    _OutputIterator\n    __unique_copy(_ForwardIterator __first, _ForwardIterator __last,\n\t\t  _OutputIterator __result,\n\t\t  forward_iterator_tag, output_iterator_tag)\n    {\n      // concept requirements -- taken care of in dispatching function\n      _ForwardIterator __next = __first;\n      *__result = *__first;\n      while (++__next != __last)\n\tif (!(*__first == *__next))\n\t  {\n\t    __first = __next;\n\t    *++__result = *__first;\n\t  }\n      return ++__result;\n    }\n\n  /**\n   *  @if maint\n   *  This is an uglified unique_copy(_InputIterator, _InputIterator,\n   *                                  _OutputIterator)\n   *  overloaded for input iterators and output iterator as result.\n   *  @endif\n  */\n  template<typename _InputIterator, typename _OutputIterator>\n    _OutputIterator\n    __unique_copy(_InputIterator __first, _InputIterator __last,\n\t\t  _OutputIterator __result,\n\t\t  input_iterator_tag, output_iterator_tag)\n    {\n      // concept requirements -- taken care of in dispatching function\n      typename iterator_traits<_InputIterator>::value_type __value = *__first;\n      *__result = __value;\n      while (++__first != __last)\n\tif (!(__value == *__first))\n\t  {\n\t    __value = *__first;\n\t    *++__result = __value;\n\t  }\n      return ++__result;\n    }\n\n  /**\n   *  @if maint\n   *  This is an uglified unique_copy(_InputIterator, _InputIterator,\n   *                                  _OutputIterator)\n   *  overloaded for input iterators and forward iterator as result.\n   *  @endif\n  */\n  template<typename _InputIterator, typename _ForwardIterator>\n    _ForwardIterator\n    __unique_copy(_InputIterator __first, _InputIterator __last,\n\t\t  _ForwardIterator __result,\n\t\t  input_iterator_tag, forward_iterator_tag)\n    {\n      // concept requirements -- taken care of in dispatching function\n      *__result = *__first;\n      while (++__first != __last)\n\tif (!(*__result == *__first))\n\t  *++__result = *__first;\n      return ++__result;\n    }\n\n  /**\n   *  @if maint\n   *  This is an uglified\n   *  unique_copy(_InputIterator, _InputIterator, _OutputIterator,\n   *              _BinaryPredicate)\n   *  overloaded for forward iterators and output iterator as result.\n   *  @endif\n  */\n  template<typename _ForwardIterator, typename _OutputIterator,\n\t   typename _BinaryPredicate>\n    _OutputIterator\n    __unique_copy(_ForwardIterator __first, _ForwardIterator __last,\n\t\t  _OutputIterator __result, _BinaryPredicate __binary_pred,\n\t\t  forward_iterator_tag, output_iterator_tag)\n    {\n      // concept requirements -- iterators already checked\n      __glibcxx_function_requires(_BinaryPredicateConcept<_BinaryPredicate,\n\t  typename iterator_traits<_ForwardIterator>::value_type,\n\t  typename iterator_traits<_ForwardIterator>::value_type>)\n\n      _ForwardIterator __next = __first;\n      *__result = *__first;\n      while (++__next != __last)\n\tif (!__binary_pred(*__first, *__next))\n\t  {\n\t    __first = __next;\n\t    *++__result = *__first;\n\t  }\n      return ++__result;\n    }\n\n  /**\n   *  @if maint\n   *  This is an uglified\n   *  unique_copy(_InputIterator, _InputIterator, _OutputIterator,\n   *              _BinaryPredicate)\n   *  overloaded for input iterators and output iterator as result.\n   *  @endif\n  */\n  template<typename _InputIterator, typename _OutputIterator,\n\t   typename _BinaryPredicate>\n    _OutputIterator\n    __unique_copy(_InputIterator __first, _InputIterator __last,\n\t\t  _OutputIterator __result, _BinaryPredicate __binary_pred,\n\t\t  input_iterator_tag, output_iterator_tag)\n    {\n      // concept requirements -- iterators already checked\n      __glibcxx_function_requires(_BinaryPredicateConcept<_BinaryPredicate,\n\t  typename iterator_traits<_InputIterator>::value_type,\n\t  typename iterator_traits<_InputIterator>::value_type>)\n\n      typename iterator_traits<_InputIterator>::value_type __value = *__first;\n      *__result = __value;\n      while (++__first != __last)\n\tif (!__binary_pred(__value, *__first))\n\t  {\n\t    __value = *__first;\n\t    *++__result = __value;\n\t  }\n      return ++__result;\n    }\n\n  /**\n   *  @if maint\n   *  This is an uglified\n   *  unique_copy(_InputIterator, _InputIterator, _OutputIterator,\n   *              _BinaryPredicate)\n   *  overloaded for input iterators and forward iterator as result.\n   *  @endif\n  */\n  template<typename _InputIterator, typename _ForwardIterator,\n\t   typename _BinaryPredicate>\n    _ForwardIterator\n    __unique_copy(_InputIterator __first, _InputIterator __last,\n\t\t  _ForwardIterator __result, _BinaryPredicate __binary_pred,\n\t\t  input_iterator_tag, forward_iterator_tag)\n    {\n      // concept requirements -- iterators already checked\n      __glibcxx_function_requires(_BinaryPredicateConcept<_BinaryPredicate,\n\t  typename iterator_traits<_ForwardIterator>::value_type,\n\t  typename iterator_traits<_InputIterator>::value_type>)\n\n      *__result = *__first;\n      while (++__first != __last)\n\tif (!__binary_pred(*__result, *__first))\n\t  *++__result = *__first;\n      return ++__result;\n    }\n\n  /**\n   *  @brief Copy a sequence, removing consecutive duplicate values.\n   *  @param  first   An input iterator.\n   *  @param  last    An input iterator.\n   *  @param  result  An output iterator.\n   *  @return   An iterator designating the end of the resulting sequence.\n   *\n   *  Copies each element in the range @p [first,last) to the range\n   *  beginning at @p result, except that only the first element is copied\n   *  from groups of consecutive elements that compare equal.\n   *  unique_copy() is stable, so the relative order of elements that are\n   *  copied is unchanged.\n   *\n   *  @if maint\n   *  _GLIBCXX_RESOLVE_LIB_DEFECTS\n   *  DR 241. Does unique_copy() require CopyConstructible and Assignable?\n   *  \n   *  _GLIBCXX_RESOLVE_LIB_DEFECTS\n   *  DR 538. 241 again: Does unique_copy() require CopyConstructible and \n   *  Assignable?\n   *  @endif\n  */\n  template<typename _InputIterator, typename _OutputIterator>\n    inline _OutputIterator\n    unique_copy(_InputIterator __first, _InputIterator __last,\n\t\t_OutputIterator __result)\n    {\n      // concept requirements\n      __glibcxx_function_requires(_InputIteratorConcept<_InputIterator>)\n      __glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator,\n\t    typename iterator_traits<_InputIterator>::value_type>)\n      __glibcxx_function_requires(_EqualityComparableConcept<\n\t    typename iterator_traits<_InputIterator>::value_type>)\n      __glibcxx_requires_valid_range(__first, __last);\n\n      if (__first == __last)\n\treturn __result;\n      return std::__unique_copy(__first, __last, __result,\n\t\t\t\tstd::__iterator_category(__first),\n\t\t\t\tstd::__iterator_category(__result));\n    }\n\n  /**\n   *  @brief Copy a sequence, removing consecutive values using a predicate.\n   *  @param  first        An input iterator.\n   *  @param  last         An input iterator.\n   *  @param  result       An output iterator.\n   *  @param  binary_pred  A binary predicate.\n   *  @return   An iterator designating the end of the resulting sequence.\n   *\n   *  Copies each element in the range @p [first,last) to the range\n   *  beginning at @p result, except that only the first element is copied\n   *  from groups of consecutive elements for which @p binary_pred returns\n   *  true.\n   *  unique_copy() is stable, so the relative order of elements that are\n   *  copied is unchanged.\n   *\n   *  @if maint\n   *  _GLIBCXX_RESOLVE_LIB_DEFECTS\n   *  DR 241. Does unique_copy() require CopyConstructible and Assignable?\n   *  @endif\n  */\n  template<typename _InputIterator, typename _OutputIterator,\n\t   typename _BinaryPredicate>\n    inline _OutputIterator\n    unique_copy(_InputIterator __first, _InputIterator __last,\n\t\t_OutputIterator __result,\n\t\t_BinaryPredicate __binary_pred)\n    {\n      // concept requirements -- predicates checked later\n      __glibcxx_function_requires(_InputIteratorConcept<_InputIterator>)\n      __glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator,\n\t    typename iterator_traits<_InputIterator>::value_type>)\n      __glibcxx_requires_valid_range(__first, __last);\n\n      if (__first == __last)\n\treturn __result;\n      return std::__unique_copy(__first, __last, __result, __binary_pred,\n\t\t\t\tstd::__iterator_category(__first),\n\t\t\t\tstd::__iterator_category(__result));\n    }\n\n  /**\n   *  @brief Remove consecutive duplicate values from a sequence.\n   *  @param  first  A forward iterator.\n   *  @param  last   A forward iterator.\n   *  @return  An iterator designating the end of the resulting sequence.\n   *\n   *  Removes all but the first element from each group of consecutive\n   *  values that compare equal.\n   *  unique() is stable, so the relative order of elements that are\n   *  not removed is unchanged.\n   *  Elements between the end of the resulting sequence and @p last\n   *  are still present, but their value is unspecified.\n  */\n  template<typename _ForwardIterator>\n    _ForwardIterator\n    unique(_ForwardIterator __first, _ForwardIterator __last)\n    {\n      // concept requirements\n      __glibcxx_function_requires(_Mutable_ForwardIteratorConcept<\n\t\t\t\t  _ForwardIterator>)\n      __glibcxx_function_requires(_EqualityComparableConcept<\n\t\t     typename iterator_traits<_ForwardIterator>::value_type>)\n      __glibcxx_requires_valid_range(__first, __last);\n\n      // Skip the beginning, if already unique.\n      __first = std::adjacent_find(__first, __last);\n      if (__first == __last)\n\treturn __last;\n\n      // Do the real copy work.\n      _ForwardIterator __dest = __first;\n      ++__first;\n      while (++__first != __last)\n\tif (!(*__dest == *__first))\n\t  *++__dest = *__first;\n      return ++__dest;\n    }\n\n  /**\n   *  @brief Remove consecutive values from a sequence using a predicate.\n   *  @param  first        A forward iterator.\n   *  @param  last         A forward iterator.\n   *  @param  binary_pred  A binary predicate.\n   *  @return  An iterator designating the end of the resulting sequence.\n   *\n   *  Removes all but the first element from each group of consecutive\n   *  values for which @p binary_pred returns true.\n   *  unique() is stable, so the relative order of elements that are\n   *  not removed is unchanged.\n   *  Elements between the end of the resulting sequence and @p last\n   *  are still present, but their value is unspecified.\n  */\n  template<typename _ForwardIterator, typename _BinaryPredicate>\n    _ForwardIterator\n    unique(_ForwardIterator __first, _ForwardIterator __last,\n           _BinaryPredicate __binary_pred)\n    {\n      // concept requirements\n      __glibcxx_function_requires(_Mutable_ForwardIteratorConcept<\n\t\t\t\t  _ForwardIterator>)\n      __glibcxx_function_requires(_BinaryPredicateConcept<_BinaryPredicate,\n\t\ttypename iterator_traits<_ForwardIterator>::value_type,\n\t\ttypename iterator_traits<_ForwardIterator>::value_type>)\n      __glibcxx_requires_valid_range(__first, __last);\n\n      // Skip the beginning, if already unique.\n      __first = std::adjacent_find(__first, __last, __binary_pred);\n      if (__first == __last)\n\treturn __last;\n\n      // Do the real copy work.\n      _ForwardIterator __dest = __first;\n      ++__first;\n      while (++__first != __last)\n\tif (!__binary_pred(*__dest, *__first))\n\t  *++__dest = *__first;\n      return ++__dest;\n    }\n\n  /**\n   *  @if maint\n   *  This is an uglified reverse(_BidirectionalIterator,\n   *                              _BidirectionalIterator)\n   *  overloaded for bidirectional iterators.\n   *  @endif\n  */\n  template<typename _BidirectionalIterator>\n    void\n    __reverse(_BidirectionalIterator __first, _BidirectionalIterator __last,\n\t      bidirectional_iterator_tag)\n    {\n      while (true)\n\tif (__first == __last || __first == --__last)\n\t  return;\n\telse\n\t  {\n\t    std::iter_swap(__first, __last);\n\t    ++__first;\n\t  }\n    }\n\n  /**\n   *  @if maint\n   *  This is an uglified reverse(_BidirectionalIterator,\n   *                              _BidirectionalIterator)\n   *  overloaded for random access iterators.\n   *  @endif\n  */\n  template<typename _RandomAccessIterator>\n    void\n    __reverse(_RandomAccessIterator __first, _RandomAccessIterator __last,\n\t      random_access_iterator_tag)\n    {\n      if (__first == __last)\n\treturn;\n      --__last;\n      while (__first < __last)\n\t{\n\t  std::iter_swap(__first, __last);\n\t  ++__first;\n\t  --__last;\n\t}\n    }\n\n  /**\n   *  @brief Reverse a sequence.\n   *  @param  first  A bidirectional iterator.\n   *  @param  last   A bidirectional iterator.\n   *  @return   reverse() returns no value.\n   *\n   *  Reverses the order of the elements in the range @p [first,last),\n   *  so that the first element becomes the last etc.\n   *  For every @c i such that @p 0<=i<=(last-first)/2), @p reverse()\n   *  swaps @p *(first+i) and @p *(last-(i+1))\n  */\n  template<typename _BidirectionalIterator>\n    inline void\n    reverse(_BidirectionalIterator __first, _BidirectionalIterator __last)\n    {\n      // concept requirements\n      __glibcxx_function_requires(_Mutable_BidirectionalIteratorConcept<\n\t\t\t\t  _BidirectionalIterator>)\n      __glibcxx_requires_valid_range(__first, __last);\n      std::__reverse(__first, __last, std::__iterator_category(__first));\n    }\n\n  /**\n   *  @brief Copy a sequence, reversing its elements.\n   *  @param  first   A bidirectional iterator.\n   *  @param  last    A bidirectional iterator.\n   *  @param  result  An output iterator.\n   *  @return  An iterator designating the end of the resulting sequence.\n   *\n   *  Copies the elements in the range @p [first,last) to the range\n   *  @p [result,result+(last-first)) such that the order of the\n   *  elements is reversed.\n   *  For every @c i such that @p 0<=i<=(last-first), @p reverse_copy()\n   *  performs the assignment @p *(result+(last-first)-i) = *(first+i).\n   *  The ranges @p [first,last) and @p [result,result+(last-first))\n   *  must not overlap.\n  */\n  template<typename _BidirectionalIterator, typename _OutputIterator>\n    _OutputIterator\n    reverse_copy(_BidirectionalIterator __first, _BidirectionalIterator __last,\n\t\t\t     _OutputIterator __result)\n    {\n      // concept requirements\n      __glibcxx_function_requires(_BidirectionalIteratorConcept<\n\t\t\t\t  _BidirectionalIterator>)\n      __glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator,\n\t\ttypename iterator_traits<_BidirectionalIterator>::value_type>)\n      __glibcxx_requires_valid_range(__first, __last);\n\n      while (__first != __last)\n\t{\n\t  --__last;\n\t  *__result = *__last;\n\t  ++__result;\n\t}\n      return __result;\n    }\n\n\n  /**\n   *  @if maint\n   *  This is a helper function for the rotate algorithm specialized on RAIs.\n   *  It returns the greatest common divisor of two integer values.\n   *  @endif\n  */\n  template<typename _EuclideanRingElement>\n    _EuclideanRingElement\n    __gcd(_EuclideanRingElement __m, _EuclideanRingElement __n)\n    {\n      while (__n != 0)\n\t{\n\t  _EuclideanRingElement __t = __m % __n;\n\t  __m = __n;\n\t  __n = __t;\n\t}\n      return __m;\n    }\n\n  /**\n   *  @if maint\n   *  This is a helper function for the rotate algorithm.\n   *  @endif\n  */\n  template<typename _ForwardIterator>\n    void\n    __rotate(_ForwardIterator __first,\n\t     _ForwardIterator __middle,\n\t     _ForwardIterator __last,\n\t     forward_iterator_tag)\n    {\n      if (__first == __middle || __last  == __middle)\n\treturn;\n\n      _ForwardIterator __first2 = __middle;\n      do\n\t{\n\t  swap(*__first, *__first2);\n\t  ++__first;\n\t  ++__first2;\n\t  if (__first == __middle)\n\t    __middle = __first2;\n\t}\n      while (__first2 != __last);\n\n      __first2 = __middle;\n\n      while (__first2 != __last)\n\t{\n\t  swap(*__first, *__first2);\n\t  ++__first;\n\t  ++__first2;\n\t  if (__first == __middle)\n\t    __middle = __first2;\n\t  else if (__first2 == __last)\n\t    __first2 = __middle;\n\t}\n    }\n\n  /**\n   *  @if maint\n   *  This is a helper function for the rotate algorithm.\n   *  @endif\n  */\n  template<typename _BidirectionalIterator>\n    void\n    __rotate(_BidirectionalIterator __first,\n\t     _BidirectionalIterator __middle,\n\t     _BidirectionalIterator __last,\n\t      bidirectional_iterator_tag)\n    {\n      // concept requirements\n      __glibcxx_function_requires(_Mutable_BidirectionalIteratorConcept<\n\t\t\t\t  _BidirectionalIterator>)\n\n      if (__first == __middle || __last  == __middle)\n\treturn;\n\n      std::__reverse(__first,  __middle, bidirectional_iterator_tag());\n      std::__reverse(__middle, __last,   bidirectional_iterator_tag());\n\n      while (__first != __middle && __middle != __last)\n\t{\n\t  swap(*__first, *--__last);\n\t  ++__first;\n\t}\n\n      if (__first == __middle)\n\tstd::__reverse(__middle, __last,   bidirectional_iterator_tag());\n      else\n\tstd::__reverse(__first,  __middle, bidirectional_iterator_tag());\n    }\n\n  /**\n   *  @if maint\n   *  This is a helper function for the rotate algorithm.\n   *  @endif\n  */\n  template<typename _RandomAccessIterator>\n    void\n    __rotate(_RandomAccessIterator __first,\n\t     _RandomAccessIterator __middle,\n\t     _RandomAccessIterator __last,\n\t     random_access_iterator_tag)\n    {\n      // concept requirements\n      __glibcxx_function_requires(_Mutable_RandomAccessIteratorConcept<\n\t\t\t\t  _RandomAccessIterator>)\n\n      if (__first == __middle || __last  == __middle)\n\treturn;\n\n      typedef typename iterator_traits<_RandomAccessIterator>::difference_type\n\t_Distance;\n      typedef typename iterator_traits<_RandomAccessIterator>::value_type\n\t_ValueType;\n\n      const _Distance __n = __last   - __first;\n      const _Distance __k = __middle - __first;\n      const _Distance __l = __n - __k;\n\n      if (__k == __l)\n\t{\n\t  std::swap_ranges(__first, __middle, __middle);\n\t  return;\n\t}\n\n      const _Distance __d = __gcd(__n, __k);\n\n      for (_Distance __i = 0; __i < __d; __i++)\n\t{\n\t  _ValueType __tmp = *__first;\n\t  _RandomAccessIterator __p = __first;\n\n\t  if (__k < __l)\n\t    {\n\t      for (_Distance __j = 0; __j < __l / __d; __j++)\n\t\t{\n\t\t  if (__p > __first + __l)\n\t\t    {\n\t\t      *__p = *(__p - __l);\n\t\t      __p -= __l;\n\t\t    }\n\n\t\t  *__p = *(__p + __k);\n\t\t  __p += __k;\n\t\t}\n\t    }\n\t  else\n\t    {\n\t      for (_Distance __j = 0; __j < __k / __d - 1; __j ++)\n\t\t{\n\t\t  if (__p < __last - __k)\n\t\t    {\n\t\t      *__p = *(__p + __k);\n\t\t      __p += __k;\n\t\t    }\n\t\t  *__p = * (__p - __l);\n\t\t  __p -= __l;\n\t\t}\n\t    }\n\n\t  *__p = __tmp;\n\t  ++__first;\n\t}\n    }\n\n  /**\n   *  @brief Rotate the elements of a sequence.\n   *  @param  first   A forward iterator.\n   *  @param  middle  A forward iterator.\n   *  @param  last    A forward iterator.\n   *  @return  Nothing.\n   *\n   *  Rotates the elements of the range @p [first,last) by @p (middle-first)\n   *  positions so that the element at @p middle is moved to @p first, the\n   *  element at @p middle+1 is moved to @first+1 and so on for each element\n   *  in the range @p [first,last).\n   *\n   *  This effectively swaps the ranges @p [first,middle) and\n   *  @p [middle,last).\n   *\n   *  Performs @p *(first+(n+(last-middle))%(last-first))=*(first+n) for\n   *  each @p n in the range @p [0,last-first).\n  */\n  template<typename _ForwardIterator>\n    inline void\n    rotate(_ForwardIterator __first, _ForwardIterator __middle,\n\t   _ForwardIterator __last)\n    {\n      // concept requirements\n      __glibcxx_function_requires(_Mutable_ForwardIteratorConcept<\n\t\t\t\t  _ForwardIterator>)\n      __glibcxx_requires_valid_range(__first, __middle);\n      __glibcxx_requires_valid_range(__middle, __last);\n\n      typedef typename iterator_traits<_ForwardIterator>::iterator_category\n\t_IterType;\n      std::__rotate(__first, __middle, __last, _IterType());\n    }\n\n  /**\n   *  @brief Copy a sequence, rotating its elements.\n   *  @param  first   A forward iterator.\n   *  @param  middle  A forward iterator.\n   *  @param  last    A forward iterator.\n   *  @param  result  An output iterator.\n   *  @return   An iterator designating the end of the resulting sequence.\n   *\n   *  Copies the elements of the range @p [first,last) to the range\n   *  beginning at @result, rotating the copied elements by @p (middle-first)\n   *  positions so that the element at @p middle is moved to @p result, the\n   *  element at @p middle+1 is moved to @result+1 and so on for each element\n   *  in the range @p [first,last).\n   *\n   *  Performs @p *(result+(n+(last-middle))%(last-first))=*(first+n) for\n   *  each @p n in the range @p [0,last-first).\n  */\n  template<typename _ForwardIterator, typename _OutputIterator>\n    _OutputIterator\n    rotate_copy(_ForwardIterator __first, _ForwardIterator __middle,\n                _ForwardIterator __last, _OutputIterator __result)\n    {\n      // concept requirements\n      __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator>)\n      __glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator,\n\t\ttypename iterator_traits<_ForwardIterator>::value_type>)\n      __glibcxx_requires_valid_range(__first, __middle);\n      __glibcxx_requires_valid_range(__middle, __last);\n\n      return std::copy(__first, __middle,\n                       std::copy(__middle, __last, __result));\n    }\n\n  /**\n   *  @brief Randomly shuffle the elements of a sequence.\n   *  @param  first   A forward iterator.\n   *  @param  last    A forward iterator.\n   *  @return  Nothing.\n   *\n   *  Reorder the elements in the range @p [first,last) using a random\n   *  distribution, so that every possible ordering of the sequence is\n   *  equally likely.\n  */\n  template<typename _RandomAccessIterator>\n    inline void\n    random_shuffle(_RandomAccessIterator __first, _RandomAccessIterator __last)\n    {\n      // concept requirements\n      __glibcxx_function_requires(_Mutable_RandomAccessIteratorConcept<\n\t    _RandomAccessIterator>)\n      __glibcxx_requires_valid_range(__first, __last);\n\n      if (__first != __last)\n\tfor (_RandomAccessIterator __i = __first + 1; __i != __last; ++__i)\n\t  std::iter_swap(__i, __first + (std::rand() % ((__i - __first) + 1)));\n    }\n\n  /**\n   *  @brief Shuffle the elements of a sequence using a random number\n   *         generator.\n   *  @param  first   A forward iterator.\n   *  @param  last    A forward iterator.\n   *  @param  rand    The RNG functor or function.\n   *  @return  Nothing.\n   *\n   *  Reorders the elements in the range @p [first,last) using @p rand to\n   *  provide a random distribution. Calling @p rand(N) for a positive\n   *  integer @p N should return a randomly chosen integer from the\n   *  range [0,N).\n  */\n  template<typename _RandomAccessIterator, typename _RandomNumberGenerator>\n    void\n    random_shuffle(_RandomAccessIterator __first, _RandomAccessIterator __last,\n\t\t   _RandomNumberGenerator& __rand)\n    {\n      // concept requirements\n      __glibcxx_function_requires(_Mutable_RandomAccessIteratorConcept<\n\t    _RandomAccessIterator>)\n      __glibcxx_requires_valid_range(__first, __last);\n\n      if (__first == __last)\n\treturn;\n      for (_RandomAccessIterator __i = __first + 1; __i != __last; ++__i)\n\tstd::iter_swap(__i, __first + __rand((__i - __first) + 1));\n    }\n\n\n  /**\n   *  @if maint\n   *  This is a helper function...\n   *  @endif\n  */\n  template<typename _ForwardIterator, typename _Predicate>\n    _ForwardIterator\n    __partition(_ForwardIterator __first, _ForwardIterator __last,\n\t\t_Predicate __pred,\n\t\tforward_iterator_tag)\n    {\n      if (__first == __last)\n\treturn __first;\n\n      while (__pred(*__first))\n\tif (++__first == __last)\n\t  return __first;\n\n      _ForwardIterator __next = __first;\n\n      while (++__next != __last)\n\tif (__pred(*__next))\n\t  {\n\t    swap(*__first, *__next);\n\t    ++__first;\n\t  }\n\n      return __first;\n    }\n\n  /**\n   *  @if maint\n   *  This is a helper function...\n   *  @endif\n  */\n  template<typename _BidirectionalIterator, typename _Predicate>\n    _BidirectionalIterator\n    __partition(_BidirectionalIterator __first, _BidirectionalIterator __last,\n\t\t_Predicate __pred,\n\t\tbidirectional_iterator_tag)\n    {\n      while (true)\n\t{\n\t  while (true)\n\t    if (__first == __last)\n\t      return __first;\n\t    else if (__pred(*__first))\n\t      ++__first;\n\t    else\n\t      break;\n\t  --__last;\n\t  while (true)\n\t    if (__first == __last)\n\t      return __first;\n\t    else if (!__pred(*__last))\n\t      --__last;\n\t    else\n\t      break;\n\t  std::iter_swap(__first, __last);\n\t  ++__first;\n\t}\n    }\n\n  /**\n   *  @brief Move elements for which a predicate is true to the beginning\n   *         of a sequence.\n   *  @param  first   A forward iterator.\n   *  @param  last    A forward iterator.\n   *  @param  pred    A predicate functor.\n   *  @return  An iterator @p middle such that @p pred(i) is true for each\n   *  iterator @p i in the range @p [first,middle) and false for each @p i\n   *  in the range @p [middle,last).\n   *\n   *  @p pred must not modify its operand. @p partition() does not preserve\n   *  the relative ordering of elements in each group, use\n   *  @p stable_partition() if this is needed.\n  */\n  template<typename _ForwardIterator, typename _Predicate>\n    inline _ForwardIterator\n    partition(_ForwardIterator __first, _ForwardIterator __last,\n\t      _Predicate   __pred)\n    {\n      // concept requirements\n      __glibcxx_function_requires(_Mutable_ForwardIteratorConcept<\n\t\t\t\t  _ForwardIterator>)\n      __glibcxx_function_requires(_UnaryPredicateConcept<_Predicate,\n\t    typename iterator_traits<_ForwardIterator>::value_type>)\n      __glibcxx_requires_valid_range(__first, __last);\n\n      return std::__partition(__first, __last, __pred,\n\t\t\t      std::__iterator_category(__first));\n    }\n\n\n  /**\n   *  @if maint\n   *  This is a helper function...\n   *  @endif\n  */\n  template<typename _ForwardIterator, typename _Predicate, typename _Distance>\n    _ForwardIterator\n    __inplace_stable_partition(_ForwardIterator __first,\n\t\t\t       _ForwardIterator __last,\n\t\t\t       _Predicate __pred, _Distance __len)\n    {\n      if (__len == 1)\n\treturn __pred(*__first) ? __last : __first;\n      _ForwardIterator __middle = __first;\n      std::advance(__middle, __len / 2);\n      _ForwardIterator __begin = std::__inplace_stable_partition(__first,\n\t\t\t\t\t\t\t\t __middle,\n\t\t\t\t\t\t\t\t __pred,\n\t\t\t\t\t\t\t\t __len / 2);\n      _ForwardIterator __end = std::__inplace_stable_partition(__middle, __last,\n\t\t\t\t\t\t\t       __pred,\n\t\t\t\t\t\t\t       __len\n\t\t\t\t\t\t\t       - __len / 2);\n      std::rotate(__begin, __middle, __end);\n      std::advance(__begin, std::distance(__middle, __end));\n      return __begin;\n    }\n\n  /**\n   *  @if maint\n   *  This is a helper function...\n   *  @endif\n  */\n  template<typename _ForwardIterator, typename _Pointer, typename _Predicate,\n\t   typename _Distance>\n    _ForwardIterator\n    __stable_partition_adaptive(_ForwardIterator __first,\n\t\t\t\t_ForwardIterator __last,\n\t\t\t\t_Predicate __pred, _Distance __len,\n\t\t\t\t_Pointer __buffer,\n\t\t\t\t_Distance __buffer_size)\n    {\n      if (__len <= __buffer_size)\n\t{\n\t  _ForwardIterator __result1 = __first;\n\t  _Pointer __result2 = __buffer;\n\t  for ( ; __first != __last ; ++__first)\n\t    if (__pred(*__first))\n\t      {\n\t\t*__result1 = *__first;\n\t\t++__result1;\n\t      }\n\t    else\n\t      {\n\t\t*__result2 = *__first;\n\t\t++__result2;\n\t      }\n\t  std::copy(__buffer, __result2, __result1);\n\t  return __result1;\n\t}\n      else\n\t{\n\t  _ForwardIterator __middle = __first;\n\t  std::advance(__middle, __len / 2);\n\t  _ForwardIterator __begin =\n\t    std::__stable_partition_adaptive(__first, __middle, __pred,\n\t\t\t\t\t     __len / 2, __buffer,\n\t\t\t\t\t     __buffer_size);\n\t  _ForwardIterator __end =\n\t    std::__stable_partition_adaptive(__middle, __last, __pred,\n\t\t\t\t\t     __len - __len / 2,\n\t\t\t\t\t     __buffer, __buffer_size);\n\t  std::rotate(__begin, __middle, __end);\n\t  std::advance(__begin, std::distance(__middle, __end));\n\t  return __begin;\n\t}\n    }\n\n  /**\n   *  @brief Move elements for which a predicate is true to the beginning\n   *         of a sequence, preserving relative ordering.\n   *  @param  first   A forward iterator.\n   *  @param  last    A forward iterator.\n   *  @param  pred    A predicate functor.\n   *  @return  An iterator @p middle such that @p pred(i) is true for each\n   *  iterator @p i in the range @p [first,middle) and false for each @p i\n   *  in the range @p [middle,last).\n   *\n   *  Performs the same function as @p partition() with the additional\n   *  guarantee that the relative ordering of elements in each group is\n   *  preserved, so any two elements @p x and @p y in the range\n   *  @p [first,last) such that @p pred(x)==pred(y) will have the same\n   *  relative ordering after calling @p stable_partition().\n  */\n  template<typename _ForwardIterator, typename _Predicate>\n    _ForwardIterator\n    stable_partition(_ForwardIterator __first, _ForwardIterator __last,\n\t\t     _Predicate __pred)\n    {\n      // concept requirements\n      __glibcxx_function_requires(_Mutable_ForwardIteratorConcept<\n\t\t\t\t  _ForwardIterator>)\n      __glibcxx_function_requires(_UnaryPredicateConcept<_Predicate,\n\t    typename iterator_traits<_ForwardIterator>::value_type>)\n      __glibcxx_requires_valid_range(__first, __last);\n\n      if (__first == __last)\n\treturn __first;\n      else\n\t{\n\t  typedef typename iterator_traits<_ForwardIterator>::value_type\n\t    _ValueType;\n\t  typedef typename iterator_traits<_ForwardIterator>::difference_type\n\t    _DistanceType;\n\n\t  _Temporary_buffer<_ForwardIterator, _ValueType> __buf(__first,\n\t\t\t\t\t\t\t\t__last);\n\tif (__buf.size() > 0)\n\t  return\n\t    std::__stable_partition_adaptive(__first, __last, __pred,\n\t\t\t\t\t  _DistanceType(__buf.requested_size()),\n\t\t\t\t\t  __buf.begin(), __buf.size());\n\telse\n\t  return\n\t    std::__inplace_stable_partition(__first, __last, __pred,\n\t\t\t\t\t _DistanceType(__buf.requested_size()));\n\t}\n    }\n\n  /**\n   *  @if maint\n   *  This is a helper function...\n   *  @endif\n  */\n  template<typename _RandomAccessIterator, typename _Tp>\n    _RandomAccessIterator\n    __unguarded_partition(_RandomAccessIterator __first,\n\t\t\t  _RandomAccessIterator __last, _Tp __pivot)\n    {\n      while (true)\n\t{\n\t  while (*__first < __pivot)\n\t    ++__first;\n\t  --__last;\n\t  while (__pivot < *__last)\n\t    --__last;\n\t  if (!(__first < __last))\n\t    return __first;\n\t  std::iter_swap(__first, __last);\n\t  ++__first;\n\t}\n    }\n\n  /**\n   *  @if maint\n   *  This is a helper function...\n   *  @endif\n  */\n  template<typename _RandomAccessIterator, typename _Tp, typename _Compare>\n    _RandomAccessIterator\n    __unguarded_partition(_RandomAccessIterator __first,\n\t\t\t  _RandomAccessIterator __last,\n\t\t\t  _Tp __pivot, _Compare __comp)\n    {\n      while (true)\n\t{\n\t  while (__comp(*__first, __pivot))\n\t    ++__first;\n\t  --__last;\n\t  while (__comp(__pivot, *__last))\n\t    --__last;\n\t  if (!(__first < __last))\n\t    return __first;\n\t  std::iter_swap(__first, __last);\n\t  ++__first;\n\t}\n    }\n\n  /**\n   *  @if maint\n   *  @doctodo\n   *  This controls some aspect of the sort routines.\n   *  @endif\n  */\n  enum { _S_threshold = 16 };\n\n  /**\n   *  @if maint\n   *  This is a helper function for the sort routine.\n   *  @endif\n  */\n  template<typename _RandomAccessIterator, typename _Tp>\n    void\n    __unguarded_linear_insert(_RandomAccessIterator __last, _Tp __val)\n    {\n      _RandomAccessIterator __next = __last;\n      --__next;\n      while (__val < *__next)\n\t{\n\t  *__last = *__next;\n\t  __last = __next;\n\t  --__next;\n\t}\n      *__last = __val;\n    }\n\n  /**\n   *  @if maint\n   *  This is a helper function for the sort routine.\n   *  @endif\n  */\n  template<typename _RandomAccessIterator, typename _Tp, typename _Compare>\n    void\n    __unguarded_linear_insert(_RandomAccessIterator __last, _Tp __val,\n\t\t\t      _Compare __comp)\n    {\n      _RandomAccessIterator __next = __last;\n      --__next;\n      while (__comp(__val, *__next))\n\t{\n\t  *__last = *__next;\n\t  __last = __next;\n\t  --__next;\n\t}\n      *__last = __val;\n    }\n\n  /**\n   *  @if maint\n   *  This is a helper function for the sort routine.\n   *  @endif\n  */\n  template<typename _RandomAccessIterator>\n    void\n    __insertion_sort(_RandomAccessIterator __first,\n\t\t     _RandomAccessIterator __last)\n    {\n      if (__first == __last)\n\treturn;\n\n      for (_RandomAccessIterator __i = __first + 1; __i != __last; ++__i)\n\t{\n\t  typename iterator_traits<_RandomAccessIterator>::value_type\n\t    __val = *__i;\n\t  if (__val < *__first)\n\t    {\n\t      std::copy_backward(__first, __i, __i + 1);\n\t      *__first = __val;\n\t    }\n\t  else\n\t    std::__unguarded_linear_insert(__i, __val);\n\t}\n    }\n\n  /**\n   *  @if maint\n   *  This is a helper function for the sort routine.\n   *  @endif\n  */\n  template<typename _RandomAccessIterator, typename _Compare>\n    void\n    __insertion_sort(_RandomAccessIterator __first,\n\t\t     _RandomAccessIterator __last, _Compare __comp)\n    {\n      if (__first == __last) return;\n\n      for (_RandomAccessIterator __i = __first + 1; __i != __last; ++__i)\n\t{\n\t  typename iterator_traits<_RandomAccessIterator>::value_type\n\t    __val = *__i;\n\t  if (__comp(__val, *__first))\n\t    {\n\t      std::copy_backward(__first, __i, __i + 1);\n\t      *__first = __val;\n\t    }\n\t  else\n\t    std::__unguarded_linear_insert(__i, __val, __comp);\n\t}\n    }\n\n  /**\n   *  @if maint\n   *  This is a helper function for the sort routine.\n   *  @endif\n  */\n  template<typename _RandomAccessIterator>\n    inline void\n    __unguarded_insertion_sort(_RandomAccessIterator __first,\n\t\t\t       _RandomAccessIterator __last)\n    {\n      typedef typename iterator_traits<_RandomAccessIterator>::value_type\n\t_ValueType;\n\n      for (_RandomAccessIterator __i = __first; __i != __last; ++__i)\n\tstd::__unguarded_linear_insert(__i, _ValueType(*__i));\n    }\n\n  /**\n   *  @if maint\n   *  This is a helper function for the sort routine.\n   *  @endif\n  */\n  template<typename _RandomAccessIterator, typename _Compare>\n    inline void\n    __unguarded_insertion_sort(_RandomAccessIterator __first,\n\t\t\t       _RandomAccessIterator __last, _Compare __comp)\n    {\n      typedef typename iterator_traits<_RandomAccessIterator>::value_type\n\t_ValueType;\n\n      for (_RandomAccessIterator __i = __first; __i != __last; ++__i)\n\tstd::__unguarded_linear_insert(__i, _ValueType(*__i), __comp);\n    }\n\n  /**\n   *  @if maint\n   *  This is a helper function for the sort routine.\n   *  @endif\n  */\n  template<typename _RandomAccessIterator>\n    void\n    __final_insertion_sort(_RandomAccessIterator __first,\n\t\t\t   _RandomAccessIterator __last)\n    {\n      if (__last - __first > int(_S_threshold))\n\t{\n\t  std::__insertion_sort(__first, __first + int(_S_threshold));\n\t  std::__unguarded_insertion_sort(__first + int(_S_threshold), __last);\n\t}\n      else\n\tstd::__insertion_sort(__first, __last);\n    }\n\n  /**\n   *  @if maint\n   *  This is a helper function for the sort routine.\n   *  @endif\n  */\n  template<typename _RandomAccessIterator, typename _Compare>\n    void\n    __final_insertion_sort(_RandomAccessIterator __first,\n\t\t\t   _RandomAccessIterator __last, _Compare __comp)\n    {\n      if (__last - __first > int(_S_threshold))\n\t{\n\t  std::__insertion_sort(__first, __first + int(_S_threshold), __comp);\n\t  std::__unguarded_insertion_sort(__first + int(_S_threshold), __last,\n\t\t\t\t\t  __comp);\n\t}\n      else\n\tstd::__insertion_sort(__first, __last, __comp);\n    }\n\n  /**\n   *  @if maint\n   *  This is a helper function for the sort routines.\n   *  @endif\n  */\n  template<typename _RandomAccessIterator>\n    void\n    __heap_select(_RandomAccessIterator __first,\n\t\t  _RandomAccessIterator __middle,\n\t\t  _RandomAccessIterator __last)\n    {\n      typedef typename iterator_traits<_RandomAccessIterator>::value_type\n\t_ValueType;\n\n      std::make_heap(__first, __middle);\n      for (_RandomAccessIterator __i = __middle; __i < __last; ++__i)\n\tif (*__i < *__first)\n\t  std::__pop_heap(__first, __middle, __i, _ValueType(*__i));\n    }\n\n  /**\n   *  @if maint\n   *  This is a helper function for the sort routines.\n   *  @endif\n  */\n  template<typename _RandomAccessIterator, typename _Compare>\n    void\n    __heap_select(_RandomAccessIterator __first,\n\t\t  _RandomAccessIterator __middle,\n\t\t  _RandomAccessIterator __last, _Compare __comp)\n    {\n      typedef typename iterator_traits<_RandomAccessIterator>::value_type\n\t_ValueType;\n\n      std::make_heap(__first, __middle, __comp);\n      for (_RandomAccessIterator __i = __middle; __i < __last; ++__i)\n\tif (__comp(*__i, *__first))\n\t  std::__pop_heap(__first, __middle, __i, _ValueType(*__i), __comp);\n    }\n\n  /**\n   *  @if maint\n   *  This is a helper function for the sort routines.\n   *  @endif\n  */\n  template<typename _Size>\n    inline _Size\n    __lg(_Size __n)\n    {\n      _Size __k;\n      for (__k = 0; __n != 1; __n >>= 1)\n\t++__k;\n      return __k;\n    }\n\n  /**\n   *  @brief Sort the smallest elements of a sequence.\n   *  @param  first   An iterator.\n   *  @param  middle  Another iterator.\n   *  @param  last    Another iterator.\n   *  @return  Nothing.\n   *\n   *  Sorts the smallest @p (middle-first) elements in the range\n   *  @p [first,last) and moves them to the range @p [first,middle). The\n   *  order of the remaining elements in the range @p [middle,last) is\n   *  undefined.\n   *  After the sort if @p i and @j are iterators in the range\n   *  @p [first,middle) such that @i precedes @j and @k is an iterator in\n   *  the range @p [middle,last) then @p *j<*i and @p *k<*i are both false.\n  */\n  template<typename _RandomAccessIterator>\n    inline void\n    partial_sort(_RandomAccessIterator __first,\n\t\t _RandomAccessIterator __middle,\n\t\t _RandomAccessIterator __last)\n    {\n      typedef typename iterator_traits<_RandomAccessIterator>::value_type\n\t_ValueType;\n\n      // concept requirements\n      __glibcxx_function_requires(_Mutable_RandomAccessIteratorConcept<\n\t    _RandomAccessIterator>)\n      __glibcxx_function_requires(_LessThanComparableConcept<_ValueType>)\n      __glibcxx_requires_valid_range(__first, __middle);\n      __glibcxx_requires_valid_range(__middle, __last);\n\n      std::__heap_select(__first, __middle, __last);\n      std::sort_heap(__first, __middle);\n    }\n\n  /**\n   *  @brief Sort the smallest elements of a sequence using a predicate\n   *         for comparison.\n   *  @param  first   An iterator.\n   *  @param  middle  Another iterator.\n   *  @param  last    Another iterator.\n   *  @param  comp    A comparison functor.\n   *  @return  Nothing.\n   *\n   *  Sorts the smallest @p (middle-first) elements in the range\n   *  @p [first,last) and moves them to the range @p [first,middle). The\n   *  order of the remaining elements in the range @p [middle,last) is\n   *  undefined.\n   *  After the sort if @p i and @j are iterators in the range\n   *  @p [first,middle) such that @i precedes @j and @k is an iterator in\n   *  the range @p [middle,last) then @p *comp(j,*i) and @p comp(*k,*i)\n   *  are both false.\n  */\n  template<typename _RandomAccessIterator, typename _Compare>\n    inline void\n    partial_sort(_RandomAccessIterator __first,\n\t\t _RandomAccessIterator __middle,\n\t\t _RandomAccessIterator __last,\n\t\t _Compare __comp)\n    {\n      typedef typename iterator_traits<_RandomAccessIterator>::value_type\n\t_ValueType;\n\n      // concept requirements\n      __glibcxx_function_requires(_Mutable_RandomAccessIteratorConcept<\n\t    _RandomAccessIterator>)\n      __glibcxx_function_requires(_BinaryPredicateConcept<_Compare,\n\t\t\t\t  _ValueType, _ValueType>)\n      __glibcxx_requires_valid_range(__first, __middle);\n      __glibcxx_requires_valid_range(__middle, __last);\n\n      std::__heap_select(__first, __middle, __last, __comp);\n      std::sort_heap(__first, __middle, __comp);\n    }\n\n  /**\n   *  @brief Copy the smallest elements of a sequence.\n   *  @param  first   An iterator.\n   *  @param  last    Another iterator.\n   *  @param  result_first   A random-access iterator.\n   *  @param  result_last    Another random-access iterator.\n   *  @return   An iterator indicating the end of the resulting sequence.\n   *\n   *  Copies and sorts the smallest N values from the range @p [first,last)\n   *  to the range beginning at @p result_first, where the number of\n   *  elements to be copied, @p N, is the smaller of @p (last-first) and\n   *  @p (result_last-result_first).\n   *  After the sort if @p i and @j are iterators in the range\n   *  @p [result_first,result_first+N) such that @i precedes @j then\n   *  @p *j<*i is false.\n   *  The value returned is @p result_first+N.\n  */\n  template<typename _InputIterator, typename _RandomAccessIterator>\n    _RandomAccessIterator\n    partial_sort_copy(_InputIterator __first, _InputIterator __last,\n\t\t      _RandomAccessIterator __result_first,\n\t\t      _RandomAccessIterator __result_last)\n    {\n      typedef typename iterator_traits<_InputIterator>::value_type\n\t_InputValueType;\n      typedef typename iterator_traits<_RandomAccessIterator>::value_type\n\t_OutputValueType;\n      typedef typename iterator_traits<_RandomAccessIterator>::difference_type\n\t_DistanceType;\n\n      // concept requirements\n      __glibcxx_function_requires(_InputIteratorConcept<_InputIterator>)\n      __glibcxx_function_requires(_ConvertibleConcept<_InputValueType,\n\t\t\t\t  _OutputValueType>)\n      __glibcxx_function_requires(_LessThanOpConcept<_InputValueType,\n\t\t\t\t                     _OutputValueType>)\n      __glibcxx_function_requires(_LessThanComparableConcept<_OutputValueType>)\n      __glibcxx_requires_valid_range(__first, __last);\n      __glibcxx_requires_valid_range(__result_first, __result_last);\n\n      if (__result_first == __result_last)\n\treturn __result_last;\n      _RandomAccessIterator __result_real_last = __result_first;\n      while(__first != __last && __result_real_last != __result_last)\n\t{\n\t  *__result_real_last = *__first;\n\t  ++__result_real_last;\n\t  ++__first;\n\t}\n      std::make_heap(__result_first, __result_real_last);\n      while (__first != __last)\n\t{\n\t  if (*__first < *__result_first)\n\t    std::__adjust_heap(__result_first, _DistanceType(0),\n\t\t\t       _DistanceType(__result_real_last\n\t\t\t\t\t     - __result_first),\n\t\t\t       _InputValueType(*__first));\n\t  ++__first;\n\t}\n      std::sort_heap(__result_first, __result_real_last);\n      return __result_real_last;\n    }\n\n  /**\n   *  @brief Copy the smallest elements of a sequence using a predicate for\n   *         comparison.\n   *  @param  first   An input iterator.\n   *  @param  last    Another input iterator.\n   *  @param  result_first   A random-access iterator.\n   *  @param  result_last    Another random-access iterator.\n   *  @param  comp    A comparison functor.\n   *  @return   An iterator indicating the end of the resulting sequence.\n   *\n   *  Copies and sorts the smallest N values from the range @p [first,last)\n   *  to the range beginning at @p result_first, where the number of\n   *  elements to be copied, @p N, is the smaller of @p (last-first) and\n   *  @p (result_last-result_first).\n   *  After the sort if @p i and @j are iterators in the range\n   *  @p [result_first,result_first+N) such that @i precedes @j then\n   *  @p comp(*j,*i) is false.\n   *  The value returned is @p result_first+N.\n  */\n  template<typename _InputIterator, typename _RandomAccessIterator, typename _Compare>\n    _RandomAccessIterator\n    partial_sort_copy(_InputIterator __first, _InputIterator __last,\n\t\t      _RandomAccessIterator __result_first,\n\t\t      _RandomAccessIterator __result_last,\n\t\t      _Compare __comp)\n    {\n      typedef typename iterator_traits<_InputIterator>::value_type\n\t_InputValueType;\n      typedef typename iterator_traits<_RandomAccessIterator>::value_type\n\t_OutputValueType;\n      typedef typename iterator_traits<_RandomAccessIterator>::difference_type\n\t_DistanceType;\n\n      // concept requirements\n      __glibcxx_function_requires(_InputIteratorConcept<_InputIterator>)\n      __glibcxx_function_requires(_Mutable_RandomAccessIteratorConcept<\n\t\t\t\t  _RandomAccessIterator>)\n      __glibcxx_function_requires(_ConvertibleConcept<_InputValueType,\n\t\t\t\t  _OutputValueType>)\n      __glibcxx_function_requires(_BinaryPredicateConcept<_Compare,\n\t\t\t\t  _InputValueType, _OutputValueType>)\n      __glibcxx_function_requires(_BinaryPredicateConcept<_Compare,\n\t\t\t\t  _OutputValueType, _OutputValueType>)\n      __glibcxx_requires_valid_range(__first, __last);\n      __glibcxx_requires_valid_range(__result_first, __result_last);\n\n      if (__result_first == __result_last)\n\treturn __result_last;\n      _RandomAccessIterator __result_real_last = __result_first;\n      while(__first != __last && __result_real_last != __result_last)\n\t{\n\t  *__result_real_last = *__first;\n\t  ++__result_real_last;\n\t  ++__first;\n\t}\n      std::make_heap(__result_first, __result_real_last, __comp);\n      while (__first != __last)\n\t{\n\t  if (__comp(*__first, *__result_first))\n\t    std::__adjust_heap(__result_first, _DistanceType(0),\n\t\t\t       _DistanceType(__result_real_last\n\t\t\t\t\t     - __result_first),\n\t\t\t       _InputValueType(*__first),\n\t\t\t       __comp);\n\t  ++__first;\n\t}\n      std::sort_heap(__result_first, __result_real_last, __comp);\n      return __result_real_last;\n    }\n\n  /**\n   *  @if maint\n   *  This is a helper function for the sort routine.\n   *  @endif\n  */\n  template<typename _RandomAccessIterator, typename _Size>\n    void\n    __introsort_loop(_RandomAccessIterator __first,\n\t\t     _RandomAccessIterator __last,\n\t\t     _Size __depth_limit)\n    {\n      typedef typename iterator_traits<_RandomAccessIterator>::value_type\n\t_ValueType;\n\n      while (__last - __first > int(_S_threshold))\n\t{\n\t  if (__depth_limit == 0)\n\t    {\n\t      std::partial_sort(__first, __last, __last);\n\t      return;\n\t    }\n\t  --__depth_limit;\n\t  _RandomAccessIterator __cut =\n\t    std::__unguarded_partition(__first, __last,\n\t\t\t\t       _ValueType(std::__median(*__first,\n\t\t\t\t\t\t\t\t*(__first\n\t\t\t\t\t\t\t\t  + (__last\n\t\t\t\t\t\t\t\t     - __first)\n\t\t\t\t\t\t\t\t  / 2),\n\t\t\t\t\t\t\t\t*(__last\n\t\t\t\t\t\t\t\t  - 1))));\n\t  std::__introsort_loop(__cut, __last, __depth_limit);\n\t  __last = __cut;\n\t}\n    }\n\n  /**\n   *  @if maint\n   *  This is a helper function for the sort routine.\n   *  @endif\n  */\n  template<typename _RandomAccessIterator, typename _Size, typename _Compare>\n    void\n    __introsort_loop(_RandomAccessIterator __first,\n\t\t     _RandomAccessIterator __last,\n\t\t     _Size __depth_limit, _Compare __comp)\n    {\n      typedef typename iterator_traits<_RandomAccessIterator>::value_type\n\t_ValueType;\n\n      while (__last - __first > int(_S_threshold))\n\t{\n\t  if (__depth_limit == 0)\n\t    {\n\t      std::partial_sort(__first, __last, __last, __comp);\n\t      return;\n\t    }\n\t  --__depth_limit;\n\t  _RandomAccessIterator __cut =\n\t    std::__unguarded_partition(__first, __last,\n\t\t\t\t       _ValueType(std::__median(*__first,\n\t\t\t\t\t\t\t\t*(__first\n\t\t\t\t\t\t\t\t  + (__last\n\t\t\t\t\t\t\t\t     - __first)\n\t\t\t\t\t\t\t\t  / 2),\n\t\t\t\t\t\t\t\t*(__last - 1),\n\t\t\t\t\t\t\t\t__comp)),\n\t\t\t\t       __comp);\n\t  std::__introsort_loop(__cut, __last, __depth_limit, __comp);\n\t  __last = __cut;\n\t}\n    }\n\n  /**\n   *  @brief Sort the elements of a sequence.\n   *  @param  first   An iterator.\n   *  @param  last    Another iterator.\n   *  @return  Nothing.\n   *\n   *  Sorts the elements in the range @p [first,last) in ascending order,\n   *  such that @p *(i+1)<*i is false for each iterator @p i in the range\n   *  @p [first,last-1).\n   *\n   *  The relative ordering of equivalent elements is not preserved, use\n   *  @p stable_sort() if this is needed.\n  */\n  template<typename _RandomAccessIterator>\n    inline void\n    sort(_RandomAccessIterator __first, _RandomAccessIterator __last)\n    {\n      typedef typename iterator_traits<_RandomAccessIterator>::value_type\n\t_ValueType;\n\n      // concept requirements\n      __glibcxx_function_requires(_Mutable_RandomAccessIteratorConcept<\n\t    _RandomAccessIterator>)\n      __glibcxx_function_requires(_LessThanComparableConcept<_ValueType>)\n      __glibcxx_requires_valid_range(__first, __last);\n\n      if (__first != __last)\n\t{\n\t  std::__introsort_loop(__first, __last,\n\t\t\t\tstd::__lg(__last - __first) * 2);\n\t  std::__final_insertion_sort(__first, __last);\n\t}\n    }\n\n  /**\n   *  @brief Sort the elements of a sequence using a predicate for comparison.\n   *  @param  first   An iterator.\n   *  @param  last    Another iterator.\n   *  @param  comp    A comparison functor.\n   *  @return  Nothing.\n   *\n   *  Sorts the elements in the range @p [first,last) in ascending order,\n   *  such that @p comp(*(i+1),*i) is false for every iterator @p i in the\n   *  range @p [first,last-1).\n   *\n   *  The relative ordering of equivalent elements is not preserved, use\n   *  @p stable_sort() if this is needed.\n  */\n  template<typename _RandomAccessIterator, typename _Compare>\n    inline void\n    sort(_RandomAccessIterator __first, _RandomAccessIterator __last,\n\t _Compare __comp)\n    {\n      typedef typename iterator_traits<_RandomAccessIterator>::value_type\n\t_ValueType;\n\n      // concept requirements\n      __glibcxx_function_requires(_Mutable_RandomAccessIteratorConcept<\n\t    _RandomAccessIterator>)\n      __glibcxx_function_requires(_BinaryPredicateConcept<_Compare, _ValueType,\n\t\t\t\t  _ValueType>)\n      __glibcxx_requires_valid_range(__first, __last);\n\n      if (__first != __last)\n\t{\n\t  std::__introsort_loop(__first, __last,\n\t\t\t\tstd::__lg(__last - __first) * 2, __comp);\n\t  std::__final_insertion_sort(__first, __last, __comp);\n\t}\n    }\n\n  /**\n   *  @brief Finds the first position in which @a val could be inserted\n   *         without changing the ordering.\n   *  @param  first   An iterator.\n   *  @param  last    Another iterator.\n   *  @param  val     The search term.\n   *  @return  An iterator pointing to the first element \"not less than\" @a val,\n   *           or end() if every element is less than @a val.\n   *  @ingroup binarysearch\n  */\n  template<typename _ForwardIterator, typename _Tp>\n    _ForwardIterator\n    lower_bound(_ForwardIterator __first, _ForwardIterator __last,\n\t\tconst _Tp& __val)\n    {\n      typedef typename iterator_traits<_ForwardIterator>::value_type\n\t_ValueType;\n      typedef typename iterator_traits<_ForwardIterator>::difference_type\n\t_DistanceType;\n\n      // concept requirements\n      __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator>)\n      __glibcxx_function_requires(_LessThanOpConcept<_ValueType, _Tp>)\n      __glibcxx_requires_partitioned(__first, __last, __val);\n\n      _DistanceType __len = std::distance(__first, __last);\n      _DistanceType __half;\n      _ForwardIterator __middle;\n\n      while (__len > 0)\n\t{\n\t  __half = __len >> 1;\n\t  __middle = __first;\n\t  std::advance(__middle, __half);\n\t  if (*__middle < __val)\n\t    {\n\t      __first = __middle;\n\t      ++__first;\n\t      __len = __len - __half - 1;\n\t    }\n\t  else\n\t    __len = __half;\n\t}\n      return __first;\n    }\n\n  /**\n   *  @brief Finds the first position in which @a val could be inserted\n   *         without changing the ordering.\n   *  @param  first   An iterator.\n   *  @param  last    Another iterator.\n   *  @param  val     The search term.\n   *  @param  comp    A functor to use for comparisons.\n   *  @return  An iterator pointing to the first element \"not less than\" @a val,\n   *           or end() if every element is less than @a val.\n   *  @ingroup binarysearch\n   *\n   *  The comparison function should have the same effects on ordering as\n   *  the function used for the initial sort.\n  */\n  template<typename _ForwardIterator, typename _Tp, typename _Compare>\n    _ForwardIterator\n    lower_bound(_ForwardIterator __first, _ForwardIterator __last,\n\t\tconst _Tp& __val, _Compare __comp)\n    {\n      typedef typename iterator_traits<_ForwardIterator>::value_type\n\t_ValueType;\n      typedef typename iterator_traits<_ForwardIterator>::difference_type\n\t_DistanceType;\n\n      // concept requirements\n      __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator>)\n      __glibcxx_function_requires(_BinaryPredicateConcept<_Compare,\n\t\t\t\t  _ValueType, _Tp>)\n      __glibcxx_requires_partitioned_pred(__first, __last, __val, __comp);\n\n      _DistanceType __len = std::distance(__first, __last);\n      _DistanceType __half;\n      _ForwardIterator __middle;\n\n      while (__len > 0)\n\t{\n\t  __half = __len >> 1;\n\t  __middle = __first;\n\t  std::advance(__middle, __half);\n\t  if (__comp(*__middle, __val))\n\t    {\n\t      __first = __middle;\n\t      ++__first;\n\t      __len = __len - __half - 1;\n\t    }\n\t  else\n\t    __len = __half;\n\t}\n      return __first;\n    }\n\n  /**\n   *  @brief Finds the last position in which @a val could be inserted\n   *         without changing the ordering.\n   *  @param  first   An iterator.\n   *  @param  last    Another iterator.\n   *  @param  val     The search term.\n   *  @return  An iterator pointing to the first element greater than @a val,\n   *           or end() if no elements are greater than @a val.\n   *  @ingroup binarysearch\n  */\n  template<typename _ForwardIterator, typename _Tp>\n    _ForwardIterator\n    upper_bound(_ForwardIterator __first, _ForwardIterator __last,\n\t\tconst _Tp& __val)\n    {\n      typedef typename iterator_traits<_ForwardIterator>::value_type\n\t_ValueType;\n      typedef typename iterator_traits<_ForwardIterator>::difference_type\n\t_DistanceType;\n\n      // concept requirements\n      __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator>)\n      __glibcxx_function_requires(_LessThanOpConcept<_Tp, _ValueType>)\n      __glibcxx_requires_partitioned(__first, __last, __val);\n\n      _DistanceType __len = std::distance(__first, __last);\n      _DistanceType __half;\n      _ForwardIterator __middle;\n\n      while (__len > 0)\n\t{\n\t  __half = __len >> 1;\n\t  __middle = __first;\n\t  std::advance(__middle, __half);\n\t  if (__val < *__middle)\n\t    __len = __half;\n\t  else\n\t    {\n\t      __first = __middle;\n\t      ++__first;\n\t      __len = __len - __half - 1;\n\t    }\n\t}\n      return __first;\n    }\n\n  /**\n   *  @brief Finds the last position in which @a val could be inserted\n   *         without changing the ordering.\n   *  @param  first   An iterator.\n   *  @param  last    Another iterator.\n   *  @param  val     The search term.\n   *  @param  comp    A functor to use for comparisons.\n   *  @return  An iterator pointing to the first element greater than @a val,\n   *           or end() if no elements are greater than @a val.\n   *  @ingroup binarysearch\n   *\n   *  The comparison function should have the same effects on ordering as\n   *  the function used for the initial sort.\n  */\n  template<typename _ForwardIterator, typename _Tp, typename _Compare>\n    _ForwardIterator\n    upper_bound(_ForwardIterator __first, _ForwardIterator __last,\n\t\tconst _Tp& __val, _Compare __comp)\n    {\n      typedef typename iterator_traits<_ForwardIterator>::value_type\n\t_ValueType;\n      typedef typename iterator_traits<_ForwardIterator>::difference_type\n\t_DistanceType;\n\n      // concept requirements\n      __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator>)\n      __glibcxx_function_requires(_BinaryPredicateConcept<_Compare,\n\t\t\t\t  _Tp, _ValueType>)\n      __glibcxx_requires_partitioned_pred(__first, __last, __val, __comp);\n\n      _DistanceType __len = std::distance(__first, __last);\n      _DistanceType __half;\n      _ForwardIterator __middle;\n\n      while (__len > 0)\n\t{\n\t  __half = __len >> 1;\n\t  __middle = __first;\n\t  std::advance(__middle, __half);\n\t  if (__comp(__val, *__middle))\n\t    __len = __half;\n\t  else\n\t    {\n\t      __first = __middle;\n\t      ++__first;\n\t      __len = __len - __half - 1;\n\t    }\n\t}\n      return __first;\n    }\n\n  /**\n   *  @if maint\n   *  This is a helper function for the merge routines.\n   *  @endif\n  */\n  template<typename _BidirectionalIterator, typename _Distance>\n    void\n    __merge_without_buffer(_BidirectionalIterator __first,\n\t\t\t   _BidirectionalIterator __middle,\n\t\t\t   _BidirectionalIterator __last,\n\t\t\t   _Distance __len1, _Distance __len2)\n    {\n      if (__len1 == 0 || __len2 == 0)\n\treturn;\n      if (__len1 + __len2 == 2)\n\t{\n\t  if (*__middle < *__first)\n\t    std::iter_swap(__first, __middle);\n\t  return;\n\t}\n      _BidirectionalIterator __first_cut = __first;\n      _BidirectionalIterator __second_cut = __middle;\n      _Distance __len11 = 0;\n      _Distance __len22 = 0;\n      if (__len1 > __len2)\n\t{\n\t  __len11 = __len1 / 2;\n\t  std::advance(__first_cut, __len11);\n\t  __second_cut = std::lower_bound(__middle, __last, *__first_cut);\n\t  __len22 = std::distance(__middle, __second_cut);\n\t}\n      else\n\t{\n\t  __len22 = __len2 / 2;\n\t  std::advance(__second_cut, __len22);\n\t  __first_cut = std::upper_bound(__first, __middle, *__second_cut);\n\t  __len11 = std::distance(__first, __first_cut);\n\t}\n      std::rotate(__first_cut, __middle, __second_cut);\n      _BidirectionalIterator __new_middle = __first_cut;\n      std::advance(__new_middle, std::distance(__middle, __second_cut));\n      std::__merge_without_buffer(__first, __first_cut, __new_middle,\n\t\t\t\t  __len11, __len22);\n      std::__merge_without_buffer(__new_middle, __second_cut, __last,\n\t\t\t\t  __len1 - __len11, __len2 - __len22);\n    }\n\n  /**\n   *  @if maint\n   *  This is a helper function for the merge routines.\n   *  @endif\n  */\n  template<typename _BidirectionalIterator, typename _Distance,\n\t   typename _Compare>\n    void\n    __merge_without_buffer(_BidirectionalIterator __first,\n                           _BidirectionalIterator __middle,\n\t\t\t   _BidirectionalIterator __last,\n\t\t\t   _Distance __len1, _Distance __len2,\n\t\t\t   _Compare __comp)\n    {\n      if (__len1 == 0 || __len2 == 0)\n\treturn;\n      if (__len1 + __len2 == 2)\n\t{\n\t  if (__comp(*__middle, *__first))\n\t    std::iter_swap(__first, __middle);\n\t  return;\n\t}\n      _BidirectionalIterator __first_cut = __first;\n      _BidirectionalIterator __second_cut = __middle;\n      _Distance __len11 = 0;\n      _Distance __len22 = 0;\n      if (__len1 > __len2)\n\t{\n\t  __len11 = __len1 / 2;\n\t  std::advance(__first_cut, __len11);\n\t  __second_cut = std::lower_bound(__middle, __last, *__first_cut,\n\t\t\t\t\t  __comp);\n\t  __len22 = std::distance(__middle, __second_cut);\n\t}\n      else\n\t{\n\t  __len22 = __len2 / 2;\n\t  std::advance(__second_cut, __len22);\n\t  __first_cut = std::upper_bound(__first, __middle, *__second_cut,\n\t\t\t\t\t __comp);\n\t  __len11 = std::distance(__first, __first_cut);\n\t}\n      std::rotate(__first_cut, __middle, __second_cut);\n      _BidirectionalIterator __new_middle = __first_cut;\n      std::advance(__new_middle, std::distance(__middle, __second_cut));\n      std::__merge_without_buffer(__first, __first_cut, __new_middle,\n\t\t\t\t  __len11, __len22, __comp);\n      std::__merge_without_buffer(__new_middle, __second_cut, __last,\n\t\t\t\t  __len1 - __len11, __len2 - __len22, __comp);\n    }\n\n  /**\n   *  @if maint\n   *  This is a helper function for the stable sorting routines.\n   *  @endif\n  */\n  template<typename _RandomAccessIterator>\n    void\n    __inplace_stable_sort(_RandomAccessIterator __first,\n\t\t\t  _RandomAccessIterator __last)\n    {\n      if (__last - __first < 15)\n\t{\n\t  std::__insertion_sort(__first, __last);\n\t  return;\n\t}\n      _RandomAccessIterator __middle = __first + (__last - __first) / 2;\n      std::__inplace_stable_sort(__first, __middle);\n      std::__inplace_stable_sort(__middle, __last);\n      std::__merge_without_buffer(__first, __middle, __last,\n\t\t\t\t  __middle - __first,\n\t\t\t\t  __last - __middle);\n    }\n\n  /**\n   *  @if maint\n   *  This is a helper function for the stable sorting routines.\n   *  @endif\n  */\n  template<typename _RandomAccessIterator, typename _Compare>\n    void\n    __inplace_stable_sort(_RandomAccessIterator __first,\n\t\t\t  _RandomAccessIterator __last, _Compare __comp)\n    {\n      if (__last - __first < 15)\n\t{\n\t  std::__insertion_sort(__first, __last, __comp);\n\t  return;\n\t}\n      _RandomAccessIterator __middle = __first + (__last - __first) / 2;\n      std::__inplace_stable_sort(__first, __middle, __comp);\n      std::__inplace_stable_sort(__middle, __last, __comp);\n      std::__merge_without_buffer(__first, __middle, __last,\n\t\t\t\t  __middle - __first,\n\t\t\t\t  __last - __middle,\n\t\t\t\t  __comp);\n    }\n\n  /**\n   *  @brief Merges two sorted ranges.\n   *  @param  first1  An iterator.\n   *  @param  first2  Another iterator.\n   *  @param  last1   Another iterator.\n   *  @param  last2   Another iterator.\n   *  @param  result  An iterator pointing to the end of the merged range.\n   *  @return  An iterator pointing to the first element \"not less than\" @a val.\n   *\n   *  Merges the ranges [first1,last1) and [first2,last2) into the sorted range\n   *  [result, result + (last1-first1) + (last2-first2)).  Both input ranges\n   *  must be sorted, and the output range must not overlap with either of\n   *  the input ranges.  The sort is @e stable, that is, for equivalent\n   *  elements in the two ranges, elements from the first range will always\n   *  come before elements from the second.\n  */\n  template<typename _InputIterator1, typename _InputIterator2,\n\t   typename _OutputIterator>\n    _OutputIterator\n    merge(_InputIterator1 __first1, _InputIterator1 __last1,\n\t  _InputIterator2 __first2, _InputIterator2 __last2,\n\t  _OutputIterator __result)\n    {\n      typedef typename iterator_traits<_InputIterator1>::value_type\n\t_ValueType1;\n      typedef typename iterator_traits<_InputIterator2>::value_type\n\t_ValueType2;\n\n      // concept requirements\n      __glibcxx_function_requires(_InputIteratorConcept<_InputIterator1>)\n      __glibcxx_function_requires(_InputIteratorConcept<_InputIterator2>)\n      __glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator,\n\t\t\t\t  _ValueType1>)\n      __glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator,\n\t\t\t\t  _ValueType2>)\n      __glibcxx_function_requires(_LessThanOpConcept<_ValueType2, _ValueType1>)\t\n      __glibcxx_requires_sorted(__first1, __last1);\n      __glibcxx_requires_sorted(__first2, __last2);\n\n      while (__first1 != __last1 && __first2 != __last2)\n\t{\n\t  if (*__first2 < *__first1)\n\t    {\n\t      *__result = *__first2;\n\t      ++__first2;\n\t    }\n\t  else\n\t    {\n\t      *__result = *__first1;\n\t      ++__first1;\n\t    }\n\t  ++__result;\n\t}\n      return std::copy(__first2, __last2, std::copy(__first1, __last1,\n\t\t\t\t\t\t    __result));\n    }\n\n  /**\n   *  @brief Merges two sorted ranges.\n   *  @param  first1  An iterator.\n   *  @param  first2  Another iterator.\n   *  @param  last1   Another iterator.\n   *  @param  last2   Another iterator.\n   *  @param  result  An iterator pointing to the end of the merged range.\n   *  @param  comp    A functor to use for comparisons.\n   *  @return  An iterator pointing to the first element \"not less than\" @a val.\n   *\n   *  Merges the ranges [first1,last1) and [first2,last2) into the sorted range\n   *  [result, result + (last1-first1) + (last2-first2)).  Both input ranges\n   *  must be sorted, and the output range must not overlap with either of\n   *  the input ranges.  The sort is @e stable, that is, for equivalent\n   *  elements in the two ranges, elements from the first range will always\n   *  come before elements from the second.\n   *\n   *  The comparison function should have the same effects on ordering as\n   *  the function used for the initial sort.\n  */\n  template<typename _InputIterator1, typename _InputIterator2,\n\t   typename _OutputIterator, typename _Compare>\n    _OutputIterator\n    merge(_InputIterator1 __first1, _InputIterator1 __last1,\n\t  _InputIterator2 __first2, _InputIterator2 __last2,\n\t  _OutputIterator __result, _Compare __comp)\n    {\n      typedef typename iterator_traits<_InputIterator1>::value_type\n\t_ValueType1;\n      typedef typename iterator_traits<_InputIterator2>::value_type\n\t_ValueType2;\n\n      // concept requirements\n      __glibcxx_function_requires(_InputIteratorConcept<_InputIterator1>)\n      __glibcxx_function_requires(_InputIteratorConcept<_InputIterator2>)\n      __glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator,\n\t\t\t\t  _ValueType1>)\n      __glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator,\n\t\t\t\t  _ValueType2>)\n      __glibcxx_function_requires(_BinaryPredicateConcept<_Compare,\n\t\t\t\t  _ValueType2, _ValueType1>)\n      __glibcxx_requires_sorted_pred(__first1, __last1, __comp);\n      __glibcxx_requires_sorted_pred(__first2, __last2, __comp);\n\n      while (__first1 != __last1 && __first2 != __last2)\n\t{\n\t  if (__comp(*__first2, *__first1))\n\t    {\n\t      *__result = *__first2;\n\t      ++__first2;\n\t    }\n\t  else\n\t    {\n\t      *__result = *__first1;\n\t      ++__first1;\n\t    }\n\t  ++__result;\n\t}\n      return std::copy(__first2, __last2, std::copy(__first1, __last1,\n\t\t\t\t\t\t    __result));\n    }\n\n  template<typename _RandomAccessIterator1, typename _RandomAccessIterator2,\n\t   typename _Distance>\n    void\n    __merge_sort_loop(_RandomAccessIterator1 __first,\n\t\t      _RandomAccessIterator1 __last,\n\t\t      _RandomAccessIterator2 __result,\n\t\t      _Distance __step_size)\n    {\n      const _Distance __two_step = 2 * __step_size;\n\n      while (__last - __first >= __two_step)\n\t{\n\t  __result = std::merge(__first, __first + __step_size,\n\t\t\t\t__first + __step_size, __first + __two_step,\n\t\t\t\t__result);\n\t  __first += __two_step;\n\t}\n\n      __step_size = std::min(_Distance(__last - __first), __step_size);\n      std::merge(__first, __first + __step_size, __first + __step_size, __last,\n\t\t __result);\n    }\n\n  template<typename _RandomAccessIterator1, typename _RandomAccessIterator2,\n\t   typename _Distance, typename _Compare>\n    void\n    __merge_sort_loop(_RandomAccessIterator1 __first,\n\t\t      _RandomAccessIterator1 __last,\n\t\t      _RandomAccessIterator2 __result, _Distance __step_size,\n\t\t      _Compare __comp)\n    {\n      const _Distance __two_step = 2 * __step_size;\n\n      while (__last - __first >= __two_step)\n\t{\n\t  __result = std::merge(__first, __first + __step_size,\n\t\t\t\t__first + __step_size, __first + __two_step,\n\t\t\t\t__result,\n\t\t\t\t__comp);\n\t  __first += __two_step;\n\t}\n      __step_size = std::min(_Distance(__last - __first), __step_size);\n\n      std::merge(__first, __first + __step_size,\n\t\t __first + __step_size, __last,\n\t\t __result,\n\t\t __comp);\n    }\n\n  enum { _S_chunk_size = 7 };\n\n  template<typename _RandomAccessIterator, typename _Distance>\n    void\n    __chunk_insertion_sort(_RandomAccessIterator __first,\n\t\t\t   _RandomAccessIterator __last,\n\t\t\t   _Distance __chunk_size)\n    {\n      while (__last - __first >= __chunk_size)\n\t{\n\t  std::__insertion_sort(__first, __first + __chunk_size);\n\t  __first += __chunk_size;\n\t}\n      std::__insertion_sort(__first, __last);\n    }\n\n  template<typename _RandomAccessIterator, typename _Distance, typename _Compare>\n    void\n    __chunk_insertion_sort(_RandomAccessIterator __first,\n\t\t\t   _RandomAccessIterator __last,\n\t\t\t   _Distance __chunk_size, _Compare __comp)\n    {\n      while (__last - __first >= __chunk_size)\n\t{\n\t  std::__insertion_sort(__first, __first + __chunk_size, __comp);\n\t  __first += __chunk_size;\n\t}\n      std::__insertion_sort(__first, __last, __comp);\n    }\n\n  template<typename _RandomAccessIterator, typename _Pointer>\n    void\n    __merge_sort_with_buffer(_RandomAccessIterator __first,\n\t\t\t     _RandomAccessIterator __last,\n                             _Pointer __buffer)\n    {\n      typedef typename iterator_traits<_RandomAccessIterator>::difference_type\n\t_Distance;\n\n      const _Distance __len = __last - __first;\n      const _Pointer __buffer_last = __buffer + __len;\n\n      _Distance __step_size = _S_chunk_size;\n      std::__chunk_insertion_sort(__first, __last, __step_size);\n\n      while (__step_size < __len)\n\t{\n\t  std::__merge_sort_loop(__first, __last, __buffer, __step_size);\n\t  __step_size *= 2;\n\t  std::__merge_sort_loop(__buffer, __buffer_last, __first, __step_size);\n\t  __step_size *= 2;\n\t}\n    }\n\n  template<typename _RandomAccessIterator, typename _Pointer, typename _Compare>\n    void\n    __merge_sort_with_buffer(_RandomAccessIterator __first,\n\t\t\t     _RandomAccessIterator __last,\n                             _Pointer __buffer, _Compare __comp)\n    {\n      typedef typename iterator_traits<_RandomAccessIterator>::difference_type\n\t_Distance;\n\n      const _Distance __len = __last - __first;\n      const _Pointer __buffer_last = __buffer + __len;\n\n      _Distance __step_size = _S_chunk_size;\n      std::__chunk_insertion_sort(__first, __last, __step_size, __comp);\n\n      while (__step_size < __len)\n\t{\n\t  std::__merge_sort_loop(__first, __last, __buffer,\n\t\t\t\t __step_size, __comp);\n\t  __step_size *= 2;\n\t  std::__merge_sort_loop(__buffer, __buffer_last, __first,\n\t\t\t\t __step_size, __comp);\n\t  __step_size *= 2;\n\t}\n    }\n\n  /**\n   *  @if maint\n   *  This is a helper function for the merge routines.\n   *  @endif\n  */\n  template<typename _BidirectionalIterator1, typename _BidirectionalIterator2,\n\t   typename _BidirectionalIterator3>\n    _BidirectionalIterator3\n    __merge_backward(_BidirectionalIterator1 __first1,\n\t\t     _BidirectionalIterator1 __last1,\n\t\t     _BidirectionalIterator2 __first2,\n\t\t     _BidirectionalIterator2 __last2,\n\t\t     _BidirectionalIterator3 __result)\n    {\n      if (__first1 == __last1)\n\treturn std::copy_backward(__first2, __last2, __result);\n      if (__first2 == __last2)\n\treturn std::copy_backward(__first1, __last1, __result);\n      --__last1;\n      --__last2;\n      while (true)\n\t{\n\t  if (*__last2 < *__last1)\n\t    {\n\t      *--__result = *__last1;\n\t      if (__first1 == __last1)\n\t\treturn std::copy_backward(__first2, ++__last2, __result);\n\t      --__last1;\n\t    }\n\t  else\n\t    {\n\t      *--__result = *__last2;\n\t      if (__first2 == __last2)\n\t\treturn std::copy_backward(__first1, ++__last1, __result);\n\t      --__last2;\n\t    }\n\t}\n    }\n\n  /**\n   *  @if maint\n   *  This is a helper function for the merge routines.\n   *  @endif\n  */\n  template<typename _BidirectionalIterator1, typename _BidirectionalIterator2,\n\t   typename _BidirectionalIterator3, typename _Compare>\n    _BidirectionalIterator3\n    __merge_backward(_BidirectionalIterator1 __first1,\n\t\t     _BidirectionalIterator1 __last1,\n\t\t     _BidirectionalIterator2 __first2,\n\t\t     _BidirectionalIterator2 __last2,\n\t\t     _BidirectionalIterator3 __result,\n\t\t     _Compare __comp)\n    {\n      if (__first1 == __last1)\n\treturn std::copy_backward(__first2, __last2, __result);\n      if (__first2 == __last2)\n\treturn std::copy_backward(__first1, __last1, __result);\n      --__last1;\n      --__last2;\n      while (true)\n\t{\n\t  if (__comp(*__last2, *__last1))\n\t    {\n\t      *--__result = *__last1;\n\t      if (__first1 == __last1)\n\t\treturn std::copy_backward(__first2, ++__last2, __result);\n\t      --__last1;\n\t    }\n\t  else\n\t    {\n\t      *--__result = *__last2;\n\t      if (__first2 == __last2)\n\t\treturn std::copy_backward(__first1, ++__last1, __result);\n\t      --__last2;\n\t    }\n\t}\n    }\n\n  /**\n   *  @if maint\n   *  This is a helper function for the merge routines.\n   *  @endif\n  */\n  template<typename _BidirectionalIterator1, typename _BidirectionalIterator2,\n\t   typename _Distance>\n    _BidirectionalIterator1\n    __rotate_adaptive(_BidirectionalIterator1 __first,\n\t\t      _BidirectionalIterator1 __middle,\n\t\t      _BidirectionalIterator1 __last,\n\t\t      _Distance __len1, _Distance __len2,\n\t\t      _BidirectionalIterator2 __buffer,\n\t\t      _Distance __buffer_size)\n    {\n      _BidirectionalIterator2 __buffer_end;\n      if (__len1 > __len2 && __len2 <= __buffer_size)\n\t{\n\t  __buffer_end = std::copy(__middle, __last, __buffer);\n\t  std::copy_backward(__first, __middle, __last);\n\t  return std::copy(__buffer, __buffer_end, __first);\n\t}\n      else if (__len1 <= __buffer_size)\n\t{\n\t  __buffer_end = std::copy(__first, __middle, __buffer);\n\t  std::copy(__middle, __last, __first);\n\t  return std::copy_backward(__buffer, __buffer_end, __last);\n\t}\n      else\n\t{\n\t  std::rotate(__first, __middle, __last);\n\t  std::advance(__first, std::distance(__middle, __last));\n\t  return __first;\n\t}\n    }\n\n  /**\n   *  @if maint\n   *  This is a helper function for the merge routines.\n   *  @endif\n  */\n  template<typename _BidirectionalIterator, typename _Distance,\n\t   typename _Pointer>\n    void\n    __merge_adaptive(_BidirectionalIterator __first,\n                     _BidirectionalIterator __middle,\n\t\t     _BidirectionalIterator __last,\n\t\t     _Distance __len1, _Distance __len2,\n\t\t     _Pointer __buffer, _Distance __buffer_size)\n    {\n      if (__len1 <= __len2 && __len1 <= __buffer_size)\n\t{\n\t  _Pointer __buffer_end = std::copy(__first, __middle, __buffer);\n\t  std::merge(__buffer, __buffer_end, __middle, __last, __first);\n\t}\n      else if (__len2 <= __buffer_size)\n\t{\n\t  _Pointer __buffer_end = std::copy(__middle, __last, __buffer);\n\t  std::__merge_backward(__first, __middle, __buffer,\n\t\t\t\t__buffer_end, __last);\n\t}\n      else\n\t{\n\t  _BidirectionalIterator __first_cut = __first;\n\t  _BidirectionalIterator __second_cut = __middle;\n\t  _Distance __len11 = 0;\n\t  _Distance __len22 = 0;\n\t  if (__len1 > __len2)\n\t    {\n\t      __len11 = __len1 / 2;\n\t      std::advance(__first_cut, __len11);\n\t      __second_cut = std::lower_bound(__middle, __last,\n\t\t\t\t\t      *__first_cut);\n\t      __len22 = std::distance(__middle, __second_cut);\n\t    }\n\t  else\n\t    {\n\t      __len22 = __len2 / 2;\n\t      std::advance(__second_cut, __len22);\n\t      __first_cut = std::upper_bound(__first, __middle,\n\t\t\t\t\t     *__second_cut);\n\t      __len11 = std::distance(__first, __first_cut);\n\t    }\n\t  _BidirectionalIterator __new_middle =\n\t    std::__rotate_adaptive(__first_cut, __middle, __second_cut,\n\t\t\t\t   __len1 - __len11, __len22, __buffer,\n\t\t\t\t   __buffer_size);\n\t  std::__merge_adaptive(__first, __first_cut, __new_middle, __len11,\n\t\t\t\t__len22, __buffer, __buffer_size);\n\t  std::__merge_adaptive(__new_middle, __second_cut, __last,\n\t\t\t\t__len1 - __len11,\n\t\t\t\t__len2 - __len22, __buffer, __buffer_size);\n\t}\n    }\n\n  /**\n   *  @if maint\n   *  This is a helper function for the merge routines.\n   *  @endif\n  */\n  template<typename _BidirectionalIterator, typename _Distance, typename _Pointer,\n\t   typename _Compare>\n    void\n    __merge_adaptive(_BidirectionalIterator __first,\n                     _BidirectionalIterator __middle,\n\t\t     _BidirectionalIterator __last,\n\t\t     _Distance __len1, _Distance __len2,\n\t\t     _Pointer __buffer, _Distance __buffer_size,\n\t\t     _Compare __comp)\n    {\n      if (__len1 <= __len2 && __len1 <= __buffer_size)\n\t{\n\t  _Pointer __buffer_end = std::copy(__first, __middle, __buffer);\n\t  std::merge(__buffer, __buffer_end, __middle, __last, __first, __comp);\n\t}\n      else if (__len2 <= __buffer_size)\n\t{\n\t  _Pointer __buffer_end = std::copy(__middle, __last, __buffer);\n\t  std::__merge_backward(__first, __middle, __buffer, __buffer_end,\n\t\t\t\t__last, __comp);\n\t}\n      else\n\t{\n\t  _BidirectionalIterator __first_cut = __first;\n\t  _BidirectionalIterator __second_cut = __middle;\n\t  _Distance __len11 = 0;\n\t  _Distance __len22 = 0;\n\t  if (__len1 > __len2)\n\t    {\n\t      __len11 = __len1 / 2;\n\t      std::advance(__first_cut, __len11);\n\t      __second_cut = std::lower_bound(__middle, __last, *__first_cut,\n\t\t\t\t\t      __comp);\n\t      __len22 = std::distance(__middle, __second_cut);\n\t    }\n\t  else\n\t    {\n\t      __len22 = __len2 / 2;\n\t      std::advance(__second_cut, __len22);\n\t      __first_cut = std::upper_bound(__first, __middle, *__second_cut,\n\t\t\t\t\t     __comp);\n\t      __len11 = std::distance(__first, __first_cut);\n\t    }\n\t  _BidirectionalIterator __new_middle =\n\t    std::__rotate_adaptive(__first_cut, __middle, __second_cut,\n\t\t\t\t   __len1 - __len11, __len22, __buffer,\n\t\t\t\t   __buffer_size);\n\t  std::__merge_adaptive(__first, __first_cut, __new_middle, __len11,\n\t\t\t\t__len22, __buffer, __buffer_size, __comp);\n\t  std::__merge_adaptive(__new_middle, __second_cut, __last,\n\t\t\t\t__len1 - __len11,\n\t\t\t\t__len2 - __len22, __buffer,\n\t\t\t\t__buffer_size, __comp);\n\t}\n    }\n\n  /**\n   *  @brief Merges two sorted ranges in place.\n   *  @param  first   An iterator.\n   *  @param  middle  Another iterator.\n   *  @param  last    Another iterator.\n   *  @return  Nothing.\n   *\n   *  Merges two sorted and consecutive ranges, [first,middle) and\n   *  [middle,last), and puts the result in [first,last).  The output will\n   *  be sorted.  The sort is @e stable, that is, for equivalent\n   *  elements in the two ranges, elements from the first range will always\n   *  come before elements from the second.\n   *\n   *  If enough additional memory is available, this takes (last-first)-1\n   *  comparisons.  Otherwise an NlogN algorithm is used, where N is\n   *  distance(first,last).\n  */\n  template<typename _BidirectionalIterator>\n    void\n    inplace_merge(_BidirectionalIterator __first,\n\t\t  _BidirectionalIterator __middle,\n\t\t  _BidirectionalIterator __last)\n    {\n      typedef typename iterator_traits<_BidirectionalIterator>::value_type\n          _ValueType;\n      typedef typename iterator_traits<_BidirectionalIterator>::difference_type\n          _DistanceType;\n\n      // concept requirements\n      __glibcxx_function_requires(_Mutable_BidirectionalIteratorConcept<\n\t    _BidirectionalIterator>)\n      __glibcxx_function_requires(_LessThanComparableConcept<_ValueType>)\n      __glibcxx_requires_sorted(__first, __middle);\n      __glibcxx_requires_sorted(__middle, __last);\n\n      if (__first == __middle || __middle == __last)\n\treturn;\n\n      _DistanceType __len1 = std::distance(__first, __middle);\n      _DistanceType __len2 = std::distance(__middle, __last);\n\n      _Temporary_buffer<_BidirectionalIterator, _ValueType> __buf(__first,\n\t\t\t\t\t\t\t\t  __last);\n      if (__buf.begin() == 0)\n\tstd::__merge_without_buffer(__first, __middle, __last, __len1, __len2);\n      else\n\tstd::__merge_adaptive(__first, __middle, __last, __len1, __len2,\n\t\t\t      __buf.begin(), _DistanceType(__buf.size()));\n    }\n\n  /**\n   *  @brief Merges two sorted ranges in place.\n   *  @param  first   An iterator.\n   *  @param  middle  Another iterator.\n   *  @param  last    Another iterator.\n   *  @param  comp    A functor to use for comparisons.\n   *  @return  Nothing.\n   *\n   *  Merges two sorted and consecutive ranges, [first,middle) and\n   *  [middle,last), and puts the result in [first,last).  The output will\n   *  be sorted.  The sort is @e stable, that is, for equivalent\n   *  elements in the two ranges, elements from the first range will always\n   *  come before elements from the second.\n   *\n   *  If enough additional memory is available, this takes (last-first)-1\n   *  comparisons.  Otherwise an NlogN algorithm is used, where N is\n   *  distance(first,last).\n   *\n   *  The comparison function should have the same effects on ordering as\n   *  the function used for the initial sort.\n  */\n  template<typename _BidirectionalIterator, typename _Compare>\n    void\n    inplace_merge(_BidirectionalIterator __first,\n\t\t  _BidirectionalIterator __middle,\n\t\t  _BidirectionalIterator __last,\n\t\t  _Compare __comp)\n    {\n      typedef typename iterator_traits<_BidirectionalIterator>::value_type\n          _ValueType;\n      typedef typename iterator_traits<_BidirectionalIterator>::difference_type\n          _DistanceType;\n\n      // concept requirements\n      __glibcxx_function_requires(_Mutable_BidirectionalIteratorConcept<\n\t    _BidirectionalIterator>)\n      __glibcxx_function_requires(_BinaryPredicateConcept<_Compare,\n\t    _ValueType, _ValueType>)\n      __glibcxx_requires_sorted_pred(__first, __middle, __comp);\n      __glibcxx_requires_sorted_pred(__middle, __last, __comp);\n\n      if (__first == __middle || __middle == __last)\n\treturn;\n\n      const _DistanceType __len1 = std::distance(__first, __middle);\n      const _DistanceType __len2 = std::distance(__middle, __last);\n\n      _Temporary_buffer<_BidirectionalIterator, _ValueType> __buf(__first,\n\t\t\t\t\t\t\t\t  __last);\n      if (__buf.begin() == 0)\n\tstd::__merge_without_buffer(__first, __middle, __last, __len1,\n\t\t\t\t    __len2, __comp);\n      else\n\tstd::__merge_adaptive(__first, __middle, __last, __len1, __len2,\n\t\t\t      __buf.begin(), _DistanceType(__buf.size()),\n\t\t\t      __comp);\n    }\n\n  template<typename _RandomAccessIterator, typename _Pointer,\n\t   typename _Distance>\n    void\n    __stable_sort_adaptive(_RandomAccessIterator __first,\n\t\t\t   _RandomAccessIterator __last,\n                           _Pointer __buffer, _Distance __buffer_size)\n    {\n      const _Distance __len = (__last - __first + 1) / 2;\n      const _RandomAccessIterator __middle = __first + __len;\n      if (__len > __buffer_size)\n\t{\n\t  std::__stable_sort_adaptive(__first, __middle,\n\t\t\t\t      __buffer, __buffer_size);\n\t  std::__stable_sort_adaptive(__middle, __last,\n\t\t\t\t      __buffer, __buffer_size);\n\t}\n      else\n\t{\n\t  std::__merge_sort_with_buffer(__first, __middle, __buffer);\n\t  std::__merge_sort_with_buffer(__middle, __last, __buffer);\n\t}\n      std::__merge_adaptive(__first, __middle, __last,\n\t\t\t    _Distance(__middle - __first),\n\t\t\t    _Distance(__last - __middle),\n\t\t\t    __buffer, __buffer_size);\n    }\n\n  template<typename _RandomAccessIterator, typename _Pointer,\n\t   typename _Distance, typename _Compare>\n    void\n    __stable_sort_adaptive(_RandomAccessIterator __first,\n\t\t\t   _RandomAccessIterator __last,\n                           _Pointer __buffer, _Distance __buffer_size,\n                           _Compare __comp)\n    {\n      const _Distance __len = (__last - __first + 1) / 2;\n      const _RandomAccessIterator __middle = __first + __len;\n      if (__len > __buffer_size)\n\t{\n\t  std::__stable_sort_adaptive(__first, __middle, __buffer,\n\t\t\t\t      __buffer_size, __comp);\n\t  std::__stable_sort_adaptive(__middle, __last, __buffer,\n\t\t\t\t      __buffer_size, __comp);\n\t}\n      else\n\t{\n\t  std::__merge_sort_with_buffer(__first, __middle, __buffer, __comp);\n\t  std::__merge_sort_with_buffer(__middle, __last, __buffer, __comp);\n\t}\n      std::__merge_adaptive(__first, __middle, __last,\n\t\t\t    _Distance(__middle - __first),\n\t\t\t    _Distance(__last - __middle),\n\t\t\t    __buffer, __buffer_size,\n\t\t\t    __comp);\n    }\n\n  /**\n   *  @brief Sort the elements of a sequence, preserving the relative order\n   *         of equivalent elements.\n   *  @param  first   An iterator.\n   *  @param  last    Another iterator.\n   *  @return  Nothing.\n   *\n   *  Sorts the elements in the range @p [first,last) in ascending order,\n   *  such that @p *(i+1)<*i is false for each iterator @p i in the range\n   *  @p [first,last-1).\n   *\n   *  The relative ordering of equivalent elements is preserved, so any two\n   *  elements @p x and @p y in the range @p [first,last) such that\n   *  @p x<y is false and @p y<x is false will have the same relative\n   *  ordering after calling @p stable_sort().\n  */\n  template<typename _RandomAccessIterator>\n    inline void\n    stable_sort(_RandomAccessIterator __first, _RandomAccessIterator __last)\n    {\n      typedef typename iterator_traits<_RandomAccessIterator>::value_type\n\t_ValueType;\n      typedef typename iterator_traits<_RandomAccessIterator>::difference_type\n\t_DistanceType;\n\n      // concept requirements\n      __glibcxx_function_requires(_Mutable_RandomAccessIteratorConcept<\n\t    _RandomAccessIterator>)\n      __glibcxx_function_requires(_LessThanComparableConcept<_ValueType>)\n      __glibcxx_requires_valid_range(__first, __last);\n\n      _Temporary_buffer<_RandomAccessIterator, _ValueType> __buf(__first,\n\t\t\t\t\t\t\t\t __last);\n      if (__buf.begin() == 0)\n\tstd::__inplace_stable_sort(__first, __last);\n      else\n\tstd::__stable_sort_adaptive(__first, __last, __buf.begin(),\n\t\t\t\t    _DistanceType(__buf.size()));\n    }\n\n  /**\n   *  @brief Sort the elements of a sequence using a predicate for comparison,\n   *         preserving the relative order of equivalent elements.\n   *  @param  first   An iterator.\n   *  @param  last    Another iterator.\n   *  @param  comp    A comparison functor.\n   *  @return  Nothing.\n   *\n   *  Sorts the elements in the range @p [first,last) in ascending order,\n   *  such that @p comp(*(i+1),*i) is false for each iterator @p i in the\n   *  range @p [first,last-1).\n   *\n   *  The relative ordering of equivalent elements is preserved, so any two\n   *  elements @p x and @p y in the range @p [first,last) such that\n   *  @p comp(x,y) is false and @p comp(y,x) is false will have the same\n   *  relative ordering after calling @p stable_sort().\n  */\n  template<typename _RandomAccessIterator, typename _Compare>\n    inline void\n    stable_sort(_RandomAccessIterator __first, _RandomAccessIterator __last,\n\t\t_Compare __comp)\n    {\n      typedef typename iterator_traits<_RandomAccessIterator>::value_type\n\t_ValueType;\n      typedef typename iterator_traits<_RandomAccessIterator>::difference_type\n\t_DistanceType;\n\n      // concept requirements\n      __glibcxx_function_requires(_Mutable_RandomAccessIteratorConcept<\n\t    _RandomAccessIterator>)\n      __glibcxx_function_requires(_BinaryPredicateConcept<_Compare,\n\t\t\t\t  _ValueType,\n\t\t\t\t  _ValueType>)\n      __glibcxx_requires_valid_range(__first, __last);\n\n      _Temporary_buffer<_RandomAccessIterator, _ValueType> __buf(__first,\n\t\t\t\t\t\t\t\t __last);\n      if (__buf.begin() == 0)\n\tstd::__inplace_stable_sort(__first, __last, __comp);\n      else\n\tstd::__stable_sort_adaptive(__first, __last, __buf.begin(),\n\t\t\t\t    _DistanceType(__buf.size()), __comp);\n    }\n\n\n  template<typename _RandomAccessIterator, typename _Size>\n    void\n    __introselect(_RandomAccessIterator __first, _RandomAccessIterator __nth,\n\t\t  _RandomAccessIterator __last, _Size __depth_limit)\n    {\n      typedef typename iterator_traits<_RandomAccessIterator>::value_type\n\t_ValueType;\n\n      while (__last - __first > 3)\n\t{\n\t  if (__depth_limit == 0)\n\t    {\n\t      std::__heap_select(__first, __nth + 1, __last);\n\t      // Place the nth largest element in its final position.\n\t      std::iter_swap(__first, __nth);\n\t      return;\n\t    }\n\t  --__depth_limit;\n\t  _RandomAccessIterator __cut =\n\t    std::__unguarded_partition(__first, __last,\n\t\t\t\t       _ValueType(std::__median(*__first,\n\t\t\t\t\t\t\t\t*(__first\n\t\t\t\t\t\t\t\t  + (__last\n\t\t\t\t\t\t\t\t     - __first)\n\t\t\t\t\t\t\t\t  / 2),\n\t\t\t\t\t\t\t\t*(__last\n\t\t\t\t\t\t\t\t  - 1))));\n\t  if (__cut <= __nth)\n\t    __first = __cut;\n\t  else\n\t    __last = __cut;\n\t}\n      std::__insertion_sort(__first, __last);\n    }\n\n  template<typename _RandomAccessIterator, typename _Size, typename _Compare>\n    void\n    __introselect(_RandomAccessIterator __first, _RandomAccessIterator __nth,\n\t\t  _RandomAccessIterator __last, _Size __depth_limit,\n\t\t  _Compare __comp)\n    {\n      typedef typename iterator_traits<_RandomAccessIterator>::value_type\n\t_ValueType;\n\n      while (__last - __first > 3)\n\t{\n\t  if (__depth_limit == 0)\n\t    {\n\t      std::__heap_select(__first, __nth + 1, __last, __comp);\n\t      // Place the nth largest element in its final position.\n\t      std::iter_swap(__first, __nth);\n\t      return;\n\t    }\n\t  --__depth_limit;\n\t  _RandomAccessIterator __cut =\n\t    std::__unguarded_partition(__first, __last,\n\t\t\t\t       _ValueType(std::__median(*__first,\n\t\t\t\t\t\t\t\t*(__first\n\t\t\t\t\t\t\t\t  + (__last\n\t\t\t\t\t\t\t\t     - __first)\n\t\t\t\t\t\t\t\t  / 2),\n\t\t\t\t\t\t\t\t*(__last - 1),\n\t\t\t\t\t\t\t\t__comp)),\n\t\t\t\t       __comp);\n\t  if (__cut <= __nth)\n\t    __first = __cut;\n\t  else\n\t    __last = __cut;\n\t}\n      std::__insertion_sort(__first, __last, __comp);\n    }\n\n  /**\n   *  @brief Sort a sequence just enough to find a particular position.\n   *  @param  first   An iterator.\n   *  @param  nth     Another iterator.\n   *  @param  last    Another iterator.\n   *  @return  Nothing.\n   *\n   *  Rearranges the elements in the range @p [first,last) so that @p *nth\n   *  is the same element that would have been in that position had the\n   *  whole sequence been sorted.\n   *  whole sequence been sorted. The elements either side of @p *nth are\n   *  not completely sorted, but for any iterator @i in the range\n   *  @p [first,nth) and any iterator @j in the range @p [nth,last) it\n   *  holds that @p *j<*i is false.\n  */\n  template<typename _RandomAccessIterator>\n    inline void\n    nth_element(_RandomAccessIterator __first, _RandomAccessIterator __nth,\n\t\t_RandomAccessIterator __last)\n    {\n      typedef typename iterator_traits<_RandomAccessIterator>::value_type\n\t_ValueType;\n\n      // concept requirements\n      __glibcxx_function_requires(_Mutable_RandomAccessIteratorConcept<\n\t\t\t\t  _RandomAccessIterator>)\n      __glibcxx_function_requires(_LessThanComparableConcept<_ValueType>)\n      __glibcxx_requires_valid_range(__first, __nth);\n      __glibcxx_requires_valid_range(__nth, __last);\n\n      if (__first == __last || __nth == __last)\n\treturn;\n\n      std::__introselect(__first, __nth, __last,\n\t\t\t std::__lg(__last - __first) * 2);\n    }\n\n  /**\n   *  @brief Sort a sequence just enough to find a particular position\n   *         using a predicate for comparison.\n   *  @param  first   An iterator.\n   *  @param  nth     Another iterator.\n   *  @param  last    Another iterator.\n   *  @param  comp    A comparison functor.\n   *  @return  Nothing.\n   *\n   *  Rearranges the elements in the range @p [first,last) so that @p *nth\n   *  is the same element that would have been in that position had the\n   *  whole sequence been sorted. The elements either side of @p *nth are\n   *  not completely sorted, but for any iterator @i in the range\n   *  @p [first,nth) and any iterator @j in the range @p [nth,last) it\n   *  holds that @p comp(*j,*i) is false.\n  */\n  template<typename _RandomAccessIterator, typename _Compare>\n    inline void\n    nth_element(_RandomAccessIterator __first, _RandomAccessIterator __nth,\n\t\t_RandomAccessIterator __last, _Compare __comp)\n    {\n      typedef typename iterator_traits<_RandomAccessIterator>::value_type\n\t_ValueType;\n\n      // concept requirements\n      __glibcxx_function_requires(_Mutable_RandomAccessIteratorConcept<\n\t\t\t\t  _RandomAccessIterator>)\n      __glibcxx_function_requires(_BinaryPredicateConcept<_Compare,\n\t\t\t\t  _ValueType, _ValueType>)\n      __glibcxx_requires_valid_range(__first, __nth);\n      __glibcxx_requires_valid_range(__nth, __last);\n\n      if (__first == __last || __nth == __last)\n\treturn;\n\n      std::__introselect(__first, __nth, __last,\n\t\t\t std::__lg(__last - __first) * 2, __comp);\n    }\n\n  /**\n   *  @brief Finds the largest subrange in which @a val could be inserted\n   *         at any place in it without changing the ordering.\n   *  @param  first   An iterator.\n   *  @param  last    Another iterator.\n   *  @param  val     The search term.\n   *  @return  An pair of iterators defining the subrange.\n   *  @ingroup binarysearch\n   *\n   *  This is equivalent to\n   *  @code\n   *    std::make_pair(lower_bound(first, last, val),\n   *                   upper_bound(first, last, val))\n   *  @endcode\n   *  but does not actually call those functions.\n  */\n  template<typename _ForwardIterator, typename _Tp>\n    pair<_ForwardIterator, _ForwardIterator>\n    equal_range(_ForwardIterator __first, _ForwardIterator __last,\n\t\tconst _Tp& __val)\n    {\n      typedef typename iterator_traits<_ForwardIterator>::value_type\n\t_ValueType;\n      typedef typename iterator_traits<_ForwardIterator>::difference_type\n\t_DistanceType;\n\n      // concept requirements\n      __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator>)\n      __glibcxx_function_requires(_LessThanOpConcept<_ValueType, _Tp>)\n      __glibcxx_function_requires(_LessThanOpConcept<_Tp, _ValueType>)\t\n      __glibcxx_requires_partitioned(__first, __last, __val);\n\n      _DistanceType __len = std::distance(__first, __last);\n      _DistanceType __half;\n      _ForwardIterator __middle, __left, __right;\n\n      while (__len > 0)\n\t{\n\t  __half = __len >> 1;\n\t  __middle = __first;\n\t  std::advance(__middle, __half);\n\t  if (*__middle < __val)\n\t    {\n\t      __first = __middle;\n\t      ++__first;\n\t      __len = __len - __half - 1;\n\t    }\n\t  else if (__val < *__middle)\n\t    __len = __half;\n\t  else\n\t    {\n\t      __left = std::lower_bound(__first, __middle, __val);\n\t      std::advance(__first, __len);\n\t      __right = std::upper_bound(++__middle, __first, __val);\n\t      return pair<_ForwardIterator, _ForwardIterator>(__left, __right);\n\t    }\n\t}\n      return pair<_ForwardIterator, _ForwardIterator>(__first, __first);\n    }\n\n  /**\n   *  @brief Finds the largest subrange in which @a val could be inserted\n   *         at any place in it without changing the ordering.\n   *  @param  first   An iterator.\n   *  @param  last    Another iterator.\n   *  @param  val     The search term.\n   *  @param  comp    A functor to use for comparisons.\n   *  @return  An pair of iterators defining the subrange.\n   *  @ingroup binarysearch\n   *\n   *  This is equivalent to\n   *  @code\n   *    std::make_pair(lower_bound(first, last, val, comp),\n   *                   upper_bound(first, last, val, comp))\n   *  @endcode\n   *  but does not actually call those functions.\n  */\n  template<typename _ForwardIterator, typename _Tp, typename _Compare>\n    pair<_ForwardIterator, _ForwardIterator>\n    equal_range(_ForwardIterator __first, _ForwardIterator __last,\n\t\tconst _Tp& __val,\n\t\t_Compare __comp)\n    {\n      typedef typename iterator_traits<_ForwardIterator>::value_type\n\t_ValueType;\n      typedef typename iterator_traits<_ForwardIterator>::difference_type\n\t_DistanceType;\n\n      // concept requirements\n      __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator>)\n      __glibcxx_function_requires(_BinaryPredicateConcept<_Compare,\n\t\t\t\t  _ValueType, _Tp>)\n      __glibcxx_function_requires(_BinaryPredicateConcept<_Compare,\n\t\t\t\t  _Tp, _ValueType>)\n      __glibcxx_requires_partitioned_pred(__first, __last, __val, __comp);\n\n      _DistanceType __len = std::distance(__first, __last);\n      _DistanceType __half;\n      _ForwardIterator __middle, __left, __right;\n\n      while (__len > 0)\n\t{\n\t  __half = __len >> 1;\n\t  __middle = __first;\n\t  std::advance(__middle, __half);\n\t  if (__comp(*__middle, __val))\n\t    {\n\t      __first = __middle;\n\t      ++__first;\n\t      __len = __len - __half - 1;\n\t    }\n\t  else if (__comp(__val, *__middle))\n\t    __len = __half;\n\t  else\n\t    {\n\t      __left = std::lower_bound(__first, __middle, __val, __comp);\n\t      std::advance(__first, __len);\n\t      __right = std::upper_bound(++__middle, __first, __val, __comp);\n\t      return pair<_ForwardIterator, _ForwardIterator>(__left, __right);\n\t    }\n\t}\n      return pair<_ForwardIterator, _ForwardIterator>(__first, __first);\n    }\n\n  /**\n   *  @brief Determines whether an element exists in a range.\n   *  @param  first   An iterator.\n   *  @param  last    Another iterator.\n   *  @param  val     The search term.\n   *  @return  True if @a val (or its equivelent) is in [@a first,@a last ].\n   *  @ingroup binarysearch\n   *\n   *  Note that this does not actually return an iterator to @a val.  For\n   *  that, use std::find or a container's specialized find member functions.\n  */\n  template<typename _ForwardIterator, typename _Tp>\n    bool\n    binary_search(_ForwardIterator __first, _ForwardIterator __last,\n                  const _Tp& __val)\n    {\n      typedef typename iterator_traits<_ForwardIterator>::value_type\n\t_ValueType;\n\n      // concept requirements\n      __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator>)\n      __glibcxx_function_requires(_LessThanOpConcept<_Tp, _ValueType>)\n      __glibcxx_requires_partitioned(__first, __last, __val);\n\n      _ForwardIterator __i = std::lower_bound(__first, __last, __val);\n      return __i != __last && !(__val < *__i);\n    }\n\n  /**\n   *  @brief Determines whether an element exists in a range.\n   *  @param  first   An iterator.\n   *  @param  last    Another iterator.\n   *  @param  val     The search term.\n   *  @param  comp    A functor to use for comparisons.\n   *  @return  True if @a val (or its equivelent) is in [@a first,@a last ].\n   *  @ingroup binarysearch\n   *\n   *  Note that this does not actually return an iterator to @a val.  For\n   *  that, use std::find or a container's specialized find member functions.\n   *\n   *  The comparison function should have the same effects on ordering as\n   *  the function used for the initial sort.\n  */\n  template<typename _ForwardIterator, typename _Tp, typename _Compare>\n    bool\n    binary_search(_ForwardIterator __first, _ForwardIterator __last,\n                  const _Tp& __val, _Compare __comp)\n    {\n      typedef typename iterator_traits<_ForwardIterator>::value_type\n\t_ValueType;\n\n      // concept requirements\n      __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator>)\n      __glibcxx_function_requires(_BinaryPredicateConcept<_Compare,\n\t\t\t\t  _Tp, _ValueType>)\n      __glibcxx_requires_partitioned_pred(__first, __last, __val, __comp);\n\n      _ForwardIterator __i = std::lower_bound(__first, __last, __val, __comp);\n      return __i != __last && !__comp(__val, *__i);\n    }\n\n  // Set algorithms: includes, set_union, set_intersection, set_difference,\n  // set_symmetric_difference.  All of these algorithms have the precondition\n  // that their input ranges are sorted and the postcondition that their output\n  // ranges are sorted.\n\n  /**\n   *  @brief Determines whether all elements of a sequence exists in a range.\n   *  @param  first1  Start of search range.\n   *  @param  last1   End of search range.\n   *  @param  first2  Start of sequence\n   *  @param  last2   End of sequence.\n   *  @return  True if each element in [first2,last2) is contained in order\n   *  within [first1,last1).  False otherwise.\n   *  @ingroup setoperations\n   *\n   *  This operation expects both [first1,last1) and [first2,last2) to be\n   *  sorted.  Searches for the presence of each element in [first2,last2)\n   *  within [first1,last1).  The iterators over each range only move forward,\n   *  so this is a linear algorithm.  If an element in [first2,last2) is not\n   *  found before the search iterator reaches @a last2, false is returned.\n  */\n  template<typename _InputIterator1, typename _InputIterator2>\n    bool\n    includes(_InputIterator1 __first1, _InputIterator1 __last1,\n\t     _InputIterator2 __first2, _InputIterator2 __last2)\n    {\n      typedef typename iterator_traits<_InputIterator1>::value_type\n\t_ValueType1;\n      typedef typename iterator_traits<_InputIterator2>::value_type\n\t_ValueType2;\n\n      // concept requirements\n      __glibcxx_function_requires(_InputIteratorConcept<_InputIterator1>)\n      __glibcxx_function_requires(_InputIteratorConcept<_InputIterator2>)\n      __glibcxx_function_requires(_LessThanOpConcept<_ValueType1, _ValueType2>)\n      __glibcxx_function_requires(_LessThanOpConcept<_ValueType2, _ValueType1>)\n      __glibcxx_requires_sorted(__first1, __last1);\n      __glibcxx_requires_sorted(__first2, __last2);\n\n      while (__first1 != __last1 && __first2 != __last2)\n\tif (*__first2 < *__first1)\n\t  return false;\n\telse if(*__first1 < *__first2)\n\t  ++__first1;\n\telse\n\t  ++__first1, ++__first2;\n\n      return __first2 == __last2;\n    }\n\n  /**\n   *  @brief Determines whether all elements of a sequence exists in a range\n   *  using comparison.\n   *  @param  first1  Start of search range.\n   *  @param  last1   End of search range.\n   *  @param  first2  Start of sequence\n   *  @param  last2   End of sequence.\n   *  @param  comp    Comparison function to use.\n   *  @return  True if each element in [first2,last2) is contained in order\n   *  within [first1,last1) according to comp.  False otherwise.\n   *  @ingroup setoperations\n   *\n   *  This operation expects both [first1,last1) and [first2,last2) to be\n   *  sorted.  Searches for the presence of each element in [first2,last2)\n   *  within [first1,last1), using comp to decide.  The iterators over each\n   *  range only move forward, so this is a linear algorithm.  If an element\n   *  in [first2,last2) is not found before the search iterator reaches @a\n   *  last2, false is returned.\n  */\n  template<typename _InputIterator1, typename _InputIterator2,\n\t   typename _Compare>\n    bool\n    includes(_InputIterator1 __first1, _InputIterator1 __last1,\n\t     _InputIterator2 __first2, _InputIterator2 __last2, _Compare __comp)\n    {\n      typedef typename iterator_traits<_InputIterator1>::value_type\n\t_ValueType1;\n      typedef typename iterator_traits<_InputIterator2>::value_type\n\t_ValueType2;\n\n      // concept requirements\n      __glibcxx_function_requires(_InputIteratorConcept<_InputIterator1>)\n      __glibcxx_function_requires(_InputIteratorConcept<_InputIterator2>)\n      __glibcxx_function_requires(_BinaryPredicateConcept<_Compare,\n\t\t\t\t  _ValueType1, _ValueType2>)\n      __glibcxx_function_requires(_BinaryPredicateConcept<_Compare,\n\t\t\t\t  _ValueType2, _ValueType1>)\n      __glibcxx_requires_sorted_pred(__first1, __last1, __comp);\n      __glibcxx_requires_sorted_pred(__first2, __last2, __comp);\n\n      while (__first1 != __last1 && __first2 != __last2)\n\tif (__comp(*__first2, *__first1))\n\t  return false;\n\telse if(__comp(*__first1, *__first2))\n\t  ++__first1;\n\telse\n\t  ++__first1, ++__first2;\n\n      return __first2 == __last2;\n    }\n\n  /**\n   *  @brief Return the union of two sorted ranges.\n   *  @param  first1  Start of first range.\n   *  @param  last1   End of first range.\n   *  @param  first2  Start of second range.\n   *  @param  last2   End of second range.\n   *  @return  End of the output range.\n   *  @ingroup setoperations\n   *\n   *  This operation iterates over both ranges, copying elements present in\n   *  each range in order to the output range.  Iterators increment for each\n   *  range.  When the current element of one range is less than the other,\n   *  that element is copied and the iterator advanced.  If an element is\n   *  contained in both ranges, the element from the first range is copied and\n   *  both ranges advance.  The output range may not overlap either input\n   *  range.\n  */\n  template<typename _InputIterator1, typename _InputIterator2,\n\t   typename _OutputIterator>\n    _OutputIterator\n    set_union(_InputIterator1 __first1, _InputIterator1 __last1,\n\t      _InputIterator2 __first2, _InputIterator2 __last2,\n\t      _OutputIterator __result)\n    {\n      typedef typename iterator_traits<_InputIterator1>::value_type\n\t_ValueType1;\n      typedef typename iterator_traits<_InputIterator2>::value_type\n\t_ValueType2;\n\n      // concept requirements\n      __glibcxx_function_requires(_InputIteratorConcept<_InputIterator1>)\n      __glibcxx_function_requires(_InputIteratorConcept<_InputIterator2>)\n      __glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator,\n\t\t\t\t  _ValueType1>)\n      __glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator,\n\t\t\t\t  _ValueType2>)\n      __glibcxx_function_requires(_LessThanOpConcept<_ValueType1, _ValueType2>)\n      __glibcxx_function_requires(_LessThanOpConcept<_ValueType2, _ValueType1>)\n      __glibcxx_requires_sorted(__first1, __last1);\n      __glibcxx_requires_sorted(__first2, __last2);\n\n      while (__first1 != __last1 && __first2 != __last2)\n\t{\n\t  if (*__first1 < *__first2)\n\t    {\n\t      *__result = *__first1;\n\t      ++__first1;\n\t    }\n\t  else if (*__first2 < *__first1)\n\t    {\n\t      *__result = *__first2;\n\t      ++__first2;\n\t    }\n\t  else\n\t    {\n\t      *__result = *__first1;\n\t      ++__first1;\n\t      ++__first2;\n\t    }\n\t  ++__result;\n\t}\n      return std::copy(__first2, __last2, std::copy(__first1, __last1,\n\t\t\t\t\t\t    __result));\n    }\n\n  /**\n   *  @brief Return the union of two sorted ranges using a comparison functor.\n   *  @param  first1  Start of first range.\n   *  @param  last1   End of first range.\n   *  @param  first2  Start of second range.\n   *  @param  last2   End of second range.\n   *  @param  comp    The comparison functor.\n   *  @return  End of the output range.\n   *  @ingroup setoperations\n   *\n   *  This operation iterates over both ranges, copying elements present in\n   *  each range in order to the output range.  Iterators increment for each\n   *  range.  When the current element of one range is less than the other\n   *  according to @a comp, that element is copied and the iterator advanced.\n   *  If an equivalent element according to @a comp is contained in both\n   *  ranges, the element from the first range is copied and both ranges\n   *  advance.  The output range may not overlap either input range.\n  */\n  template<typename _InputIterator1, typename _InputIterator2,\n\t   typename _OutputIterator, typename _Compare>\n    _OutputIterator\n    set_union(_InputIterator1 __first1, _InputIterator1 __last1,\n\t      _InputIterator2 __first2, _InputIterator2 __last2,\n\t      _OutputIterator __result, _Compare __comp)\n    {\n      typedef typename iterator_traits<_InputIterator1>::value_type\n\t_ValueType1;\n      typedef typename iterator_traits<_InputIterator2>::value_type\n\t_ValueType2;\n\n      // concept requirements\n      __glibcxx_function_requires(_InputIteratorConcept<_InputIterator1>)\n      __glibcxx_function_requires(_InputIteratorConcept<_InputIterator2>)\n      __glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator,\n\t\t\t\t  _ValueType1>)\n      __glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator,\n\t\t\t\t  _ValueType2>)\n      __glibcxx_function_requires(_BinaryPredicateConcept<_Compare,\n\t\t\t\t  _ValueType1, _ValueType2>)\n      __glibcxx_function_requires(_BinaryPredicateConcept<_Compare,\n\t\t\t\t  _ValueType2, _ValueType1>)\n      __glibcxx_requires_sorted_pred(__first1, __last1, __comp);\n      __glibcxx_requires_sorted_pred(__first2, __last2, __comp);\n\n      while (__first1 != __last1 && __first2 != __last2)\n\t{\n\t  if (__comp(*__first1, *__first2))\n\t    {\n\t      *__result = *__first1;\n\t      ++__first1;\n\t    }\n\t  else if (__comp(*__first2, *__first1))\n\t    {\n\t      *__result = *__first2;\n\t      ++__first2;\n\t    }\n\t  else\n\t    {\n\t      *__result = *__first1;\n\t      ++__first1;\n\t      ++__first2;\n\t    }\n\t  ++__result;\n\t}\n      return std::copy(__first2, __last2, std::copy(__first1, __last1,\n\t\t\t\t\t\t    __result));\n    }\n\n  /**\n   *  @brief Return the intersection of two sorted ranges.\n   *  @param  first1  Start of first range.\n   *  @param  last1   End of first range.\n   *  @param  first2  Start of second range.\n   *  @param  last2   End of second range.\n   *  @return  End of the output range.\n   *  @ingroup setoperations\n   *\n   *  This operation iterates over both ranges, copying elements present in\n   *  both ranges in order to the output range.  Iterators increment for each\n   *  range.  When the current element of one range is less than the other,\n   *  that iterator advances.  If an element is contained in both ranges, the\n   *  element from the first range is copied and both ranges advance.  The\n   *  output range may not overlap either input range.\n  */\n  template<typename _InputIterator1, typename _InputIterator2,\n\t   typename _OutputIterator>\n    _OutputIterator\n    set_intersection(_InputIterator1 __first1, _InputIterator1 __last1,\n\t\t     _InputIterator2 __first2, _InputIterator2 __last2,\n\t\t     _OutputIterator __result)\n    {\n      typedef typename iterator_traits<_InputIterator1>::value_type\n\t_ValueType1;\n      typedef typename iterator_traits<_InputIterator2>::value_type\n\t_ValueType2;\n\n      // concept requirements\n      __glibcxx_function_requires(_InputIteratorConcept<_InputIterator1>)\n      __glibcxx_function_requires(_InputIteratorConcept<_InputIterator2>)\n      __glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator,\n\t\t\t\t  _ValueType1>)\n      __glibcxx_function_requires(_LessThanOpConcept<_ValueType1, _ValueType2>)\n      __glibcxx_function_requires(_LessThanOpConcept<_ValueType2, _ValueType1>)\n      __glibcxx_requires_sorted(__first1, __last1);\n      __glibcxx_requires_sorted(__first2, __last2);\n\n      while (__first1 != __last1 && __first2 != __last2)\n\tif (*__first1 < *__first2)\n\t  ++__first1;\n\telse if (*__first2 < *__first1)\n\t  ++__first2;\n\telse\n\t  {\n\t    *__result = *__first1;\n\t    ++__first1;\n\t    ++__first2;\n\t    ++__result;\n\t  }\n      return __result;\n    }\n\n  /**\n   *  @brief Return the intersection of two sorted ranges using comparison\n   *  functor.\n   *  @param  first1  Start of first range.\n   *  @param  last1   End of first range.\n   *  @param  first2  Start of second range.\n   *  @param  last2   End of second range.\n   *  @param  comp    The comparison functor.\n   *  @return  End of the output range.\n   *  @ingroup setoperations\n   *\n   *  This operation iterates over both ranges, copying elements present in\n   *  both ranges in order to the output range.  Iterators increment for each\n   *  range.  When the current element of one range is less than the other\n   *  according to @a comp, that iterator advances.  If an element is\n   *  contained in both ranges according to @a comp, the element from the\n   *  first range is copied and both ranges advance.  The output range may not\n   *  overlap either input range.\n  */\n  template<typename _InputIterator1, typename _InputIterator2,\n\t   typename _OutputIterator, typename _Compare>\n    _OutputIterator\n    set_intersection(_InputIterator1 __first1, _InputIterator1 __last1,\n\t\t     _InputIterator2 __first2, _InputIterator2 __last2,\n\t\t     _OutputIterator __result, _Compare __comp)\n    {\n      typedef typename iterator_traits<_InputIterator1>::value_type\n\t_ValueType1;\n      typedef typename iterator_traits<_InputIterator2>::value_type\n\t_ValueType2;\n\n      // concept requirements\n      __glibcxx_function_requires(_InputIteratorConcept<_InputIterator1>)\n      __glibcxx_function_requires(_InputIteratorConcept<_InputIterator2>)\n      __glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator,\n\t\t\t\t  _ValueType1>)\n      __glibcxx_function_requires(_BinaryPredicateConcept<_Compare,\n\t\t\t\t  _ValueType1, _ValueType2>)\n      __glibcxx_function_requires(_BinaryPredicateConcept<_Compare,\n\t\t\t\t  _ValueType2, _ValueType1>)\n      __glibcxx_requires_sorted_pred(__first1, __last1, __comp);\n      __glibcxx_requires_sorted_pred(__first2, __last2, __comp);\n\n      while (__first1 != __last1 && __first2 != __last2)\n\tif (__comp(*__first1, *__first2))\n\t  ++__first1;\n\telse if (__comp(*__first2, *__first1))\n\t  ++__first2;\n\telse\n\t  {\n\t    *__result = *__first1;\n\t    ++__first1;\n\t    ++__first2;\n\t    ++__result;\n\t  }\n      return __result;\n    }\n\n  /**\n   *  @brief Return the difference of two sorted ranges.\n   *  @param  first1  Start of first range.\n   *  @param  last1   End of first range.\n   *  @param  first2  Start of second range.\n   *  @param  last2   End of second range.\n   *  @return  End of the output range.\n   *  @ingroup setoperations\n   *\n   *  This operation iterates over both ranges, copying elements present in\n   *  the first range but not the second in order to the output range.\n   *  Iterators increment for each range.  When the current element of the\n   *  first range is less than the second, that element is copied and the\n   *  iterator advances.  If the current element of the second range is less,\n   *  the iterator advances, but no element is copied.  If an element is\n   *  contained in both ranges, no elements are copied and both ranges\n   *  advance.  The output range may not overlap either input range.\n  */\n  template<typename _InputIterator1, typename _InputIterator2,\n\t   typename _OutputIterator>\n    _OutputIterator\n    set_difference(_InputIterator1 __first1, _InputIterator1 __last1,\n\t\t   _InputIterator2 __first2, _InputIterator2 __last2,\n\t\t   _OutputIterator __result)\n    {\n      typedef typename iterator_traits<_InputIterator1>::value_type\n\t_ValueType1;\n      typedef typename iterator_traits<_InputIterator2>::value_type\n\t_ValueType2;\n\n      // concept requirements\n      __glibcxx_function_requires(_InputIteratorConcept<_InputIterator1>)\n      __glibcxx_function_requires(_InputIteratorConcept<_InputIterator2>)\n      __glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator,\n\t\t\t\t  _ValueType1>)\n      __glibcxx_function_requires(_LessThanOpConcept<_ValueType1, _ValueType2>)\n      __glibcxx_function_requires(_LessThanOpConcept<_ValueType2, _ValueType1>)\t\n      __glibcxx_requires_sorted(__first1, __last1);\n      __glibcxx_requires_sorted(__first2, __last2);\n\n      while (__first1 != __last1 && __first2 != __last2)\n\tif (*__first1 < *__first2)\n\t  {\n\t    *__result = *__first1;\n\t    ++__first1;\n\t    ++__result;\n\t  }\n\telse if (*__first2 < *__first1)\n\t  ++__first2;\n\telse\n\t  {\n\t    ++__first1;\n\t    ++__first2;\n\t  }\n      return std::copy(__first1, __last1, __result);\n    }\n\n  /**\n   *  @brief  Return the difference of two sorted ranges using comparison\n   *  functor.\n   *  @param  first1  Start of first range.\n   *  @param  last1   End of first range.\n   *  @param  first2  Start of second range.\n   *  @param  last2   End of second range.\n   *  @param  comp    The comparison functor.\n   *  @return  End of the output range.\n   *  @ingroup setoperations\n   *\n   *  This operation iterates over both ranges, copying elements present in\n   *  the first range but not the second in order to the output range.\n   *  Iterators increment for each range.  When the current element of the\n   *  first range is less than the second according to @a comp, that element\n   *  is copied and the iterator advances.  If the current element of the\n   *  second range is less, no element is copied and the iterator advances.\n   *  If an element is contained in both ranges according to @a comp, no\n   *  elements are copied and both ranges advance.  The output range may not\n   *  overlap either input range.\n  */\n  template<typename _InputIterator1, typename _InputIterator2,\n\t   typename _OutputIterator, typename _Compare>\n    _OutputIterator\n    set_difference(_InputIterator1 __first1, _InputIterator1 __last1,\n\t\t   _InputIterator2 __first2, _InputIterator2 __last2,\n\t\t   _OutputIterator __result, _Compare __comp)\n    {\n      typedef typename iterator_traits<_InputIterator1>::value_type\n\t_ValueType1;\n      typedef typename iterator_traits<_InputIterator2>::value_type\n\t_ValueType2;\n\n      // concept requirements\n      __glibcxx_function_requires(_InputIteratorConcept<_InputIterator1>)\n      __glibcxx_function_requires(_InputIteratorConcept<_InputIterator2>)\n      __glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator,\n\t\t\t\t  _ValueType1>)\n      __glibcxx_function_requires(_BinaryPredicateConcept<_Compare,\n\t\t\t\t  _ValueType1, _ValueType2>)\n      __glibcxx_function_requires(_BinaryPredicateConcept<_Compare,\n\t\t\t\t  _ValueType2, _ValueType1>)\n      __glibcxx_requires_sorted_pred(__first1, __last1, __comp);\n      __glibcxx_requires_sorted_pred(__first2, __last2, __comp);\n\n      while (__first1 != __last1 && __first2 != __last2)\n\tif (__comp(*__first1, *__first2))\n\t  {\n\t    *__result = *__first1;\n\t    ++__first1;\n\t    ++__result;\n\t  }\n\telse if (__comp(*__first2, *__first1))\n\t  ++__first2;\n\telse\n\t  {\n\t    ++__first1;\n\t    ++__first2;\n\t  }\n      return std::copy(__first1, __last1, __result);\n    }\n\n  /**\n   *  @brief  Return the symmetric difference of two sorted ranges.\n   *  @param  first1  Start of first range.\n   *  @param  last1   End of first range.\n   *  @param  first2  Start of second range.\n   *  @param  last2   End of second range.\n   *  @return  End of the output range.\n   *  @ingroup setoperations\n   *\n   *  This operation iterates over both ranges, copying elements present in\n   *  one range but not the other in order to the output range.  Iterators\n   *  increment for each range.  When the current element of one range is less\n   *  than the other, that element is copied and the iterator advances.  If an\n   *  element is contained in both ranges, no elements are copied and both\n   *  ranges advance.  The output range may not overlap either input range.\n  */\n  template<typename _InputIterator1, typename _InputIterator2,\n\t   typename _OutputIterator>\n    _OutputIterator\n    set_symmetric_difference(_InputIterator1 __first1, _InputIterator1 __last1,\n\t\t\t     _InputIterator2 __first2, _InputIterator2 __last2,\n\t\t\t     _OutputIterator __result)\n    {\n      typedef typename iterator_traits<_InputIterator1>::value_type\n\t_ValueType1;\n      typedef typename iterator_traits<_InputIterator2>::value_type\n\t_ValueType2;\n\n      // concept requirements\n      __glibcxx_function_requires(_InputIteratorConcept<_InputIterator1>)\n      __glibcxx_function_requires(_InputIteratorConcept<_InputIterator2>)\n      __glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator,\n\t\t\t\t  _ValueType1>)\n      __glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator,\n\t\t\t\t  _ValueType2>)\n      __glibcxx_function_requires(_LessThanOpConcept<_ValueType1, _ValueType2>)\n      __glibcxx_function_requires(_LessThanOpConcept<_ValueType2, _ValueType1>)\t\n      __glibcxx_requires_sorted(__first1, __last1);\n      __glibcxx_requires_sorted(__first2, __last2);\n\n      while (__first1 != __last1 && __first2 != __last2)\n\tif (*__first1 < *__first2)\n\t  {\n\t    *__result = *__first1;\n\t    ++__first1;\n\t    ++__result;\n\t  }\n\telse if (*__first2 < *__first1)\n\t  {\n\t    *__result = *__first2;\n\t    ++__first2;\n\t    ++__result;\n\t  }\n\telse\n\t  {\n\t    ++__first1;\n\t    ++__first2;\n\t  }\n      return std::copy(__first2, __last2, std::copy(__first1,\n\t\t\t\t\t\t    __last1, __result));\n    }\n\n  /**\n   *  @brief  Return the symmetric difference of two sorted ranges using\n   *  comparison functor.\n   *  @param  first1  Start of first range.\n   *  @param  last1   End of first range.\n   *  @param  first2  Start of second range.\n   *  @param  last2   End of second range.\n   *  @param  comp    The comparison functor.\n   *  @return  End of the output range.\n   *  @ingroup setoperations\n   *\n   *  This operation iterates over both ranges, copying elements present in\n   *  one range but not the other in order to the output range.  Iterators\n   *  increment for each range.  When the current element of one range is less\n   *  than the other according to @a comp, that element is copied and the\n   *  iterator advances.  If an element is contained in both ranges according\n   *  to @a comp, no elements are copied and both ranges advance.  The output\n   *  range may not overlap either input range.\n  */\n  template<typename _InputIterator1, typename _InputIterator2,\n\t   typename _OutputIterator, typename _Compare>\n    _OutputIterator\n    set_symmetric_difference(_InputIterator1 __first1, _InputIterator1 __last1,\n\t\t\t     _InputIterator2 __first2, _InputIterator2 __last2,\n\t\t\t     _OutputIterator __result,\n\t\t\t     _Compare __comp)\n    {\n      typedef typename iterator_traits<_InputIterator1>::value_type\n\t_ValueType1;\n      typedef typename iterator_traits<_InputIterator2>::value_type\n\t_ValueType2;\n\n      // concept requirements\n      __glibcxx_function_requires(_InputIteratorConcept<_InputIterator1>)\n      __glibcxx_function_requires(_InputIteratorConcept<_InputIterator2>)\n      __glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator,\n\t\t\t\t  _ValueType1>)\n      __glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator,\n\t\t\t\t  _ValueType2>)\n      __glibcxx_function_requires(_BinaryPredicateConcept<_Compare,\n\t\t\t\t  _ValueType1, _ValueType2>)\n      __glibcxx_function_requires(_BinaryPredicateConcept<_Compare,\n\t\t\t\t  _ValueType2, _ValueType1>)\n      __glibcxx_requires_sorted_pred(__first1, __last1, __comp);\n      __glibcxx_requires_sorted_pred(__first2, __last2, __comp);\n\n      while (__first1 != __last1 && __first2 != __last2)\n\tif (__comp(*__first1, *__first2))\n\t  {\n\t    *__result = *__first1;\n\t    ++__first1;\n\t    ++__result;\n\t  }\n\telse if (__comp(*__first2, *__first1))\n\t  {\n\t    *__result = *__first2;\n\t    ++__first2;\n\t    ++__result;\n\t  }\n\telse\n\t  {\n\t    ++__first1;\n\t    ++__first2;\n\t  }\n      return std::copy(__first2, __last2, std::copy(__first1,\n\t\t\t\t\t\t    __last1, __result));\n    }\n\n  // min_element and max_element, with and without an explicitly supplied\n  // comparison function.\n\n  /**\n   *  @brief  Return the maximum element in a range.\n   *  @param  first  Start of range.\n   *  @param  last   End of range.\n   *  @return  Iterator referencing the first instance of the largest value.\n  */\n  template<typename _ForwardIterator>\n    _ForwardIterator\n    max_element(_ForwardIterator __first, _ForwardIterator __last)\n    {\n      // concept requirements\n      __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator>)\n      __glibcxx_function_requires(_LessThanComparableConcept<\n\t    typename iterator_traits<_ForwardIterator>::value_type>)\n      __glibcxx_requires_valid_range(__first, __last);\n\n      if (__first == __last)\n\treturn __first;\n      _ForwardIterator __result = __first;\n      while (++__first != __last)\n\tif (*__result < *__first)\n\t  __result = __first;\n      return __result;\n    }\n\n  /**\n   *  @brief  Return the maximum element in a range using comparison functor.\n   *  @param  first  Start of range.\n   *  @param  last   End of range.\n   *  @param  comp   Comparison functor.\n   *  @return  Iterator referencing the first instance of the largest value\n   *  according to comp.\n  */\n  template<typename _ForwardIterator, typename _Compare>\n    _ForwardIterator\n    max_element(_ForwardIterator __first, _ForwardIterator __last,\n\t\t_Compare __comp)\n    {\n      // concept requirements\n      __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator>)\n      __glibcxx_function_requires(_BinaryPredicateConcept<_Compare,\n\t    typename iterator_traits<_ForwardIterator>::value_type,\n\t    typename iterator_traits<_ForwardIterator>::value_type>)\n      __glibcxx_requires_valid_range(__first, __last);\n\n      if (__first == __last) return __first;\n      _ForwardIterator __result = __first;\n      while (++__first != __last)\n\tif (__comp(*__result, *__first)) __result = __first;\n      return __result;\n    }\n\n  /**\n   *  @brief  Return the minimum element in a range.\n   *  @param  first  Start of range.\n   *  @param  last   End of range.\n   *  @return  Iterator referencing the first instance of the smallest value.\n  */\n  template<typename _ForwardIterator>\n    _ForwardIterator\n    min_element(_ForwardIterator __first, _ForwardIterator __last)\n    {\n      // concept requirements\n      __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator>)\n      __glibcxx_function_requires(_LessThanComparableConcept<\n\t    typename iterator_traits<_ForwardIterator>::value_type>)\n      __glibcxx_requires_valid_range(__first, __last);\n\n      if (__first == __last)\n\treturn __first;\n      _ForwardIterator __result = __first;\n      while (++__first != __last)\n\tif (*__first < *__result)\n\t  __result = __first;\n      return __result;\n    }\n\n  /**\n   *  @brief  Return the minimum element in a range using comparison functor.\n   *  @param  first  Start of range.\n   *  @param  last   End of range.\n   *  @param  comp   Comparison functor.\n   *  @return  Iterator referencing the first instance of the smallest value\n   *  according to comp.\n  */\n  template<typename _ForwardIterator, typename _Compare>\n    _ForwardIterator\n    min_element(_ForwardIterator __first, _ForwardIterator __last,\n\t\t_Compare __comp)\n    {\n      // concept requirements\n      __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator>)\n      __glibcxx_function_requires(_BinaryPredicateConcept<_Compare,\n\t    typename iterator_traits<_ForwardIterator>::value_type,\n\t    typename iterator_traits<_ForwardIterator>::value_type>)\n      __glibcxx_requires_valid_range(__first, __last);\n\n      if (__first == __last)\n\treturn __first;\n      _ForwardIterator __result = __first;\n      while (++__first != __last)\n\tif (__comp(*__first, *__result))\n\t  __result = __first;\n      return __result;\n    }\n\n  // next_permutation and prev_permutation, with and without an explicitly\n  // supplied comparison function.\n\n  /**\n   *  @brief  Permute range into the next \"dictionary\" ordering.\n   *  @param  first  Start of range.\n   *  @param  last   End of range.\n   *  @return  False if wrapped to first permutation, true otherwise.\n   *\n   *  Treats all permutations of the range as a set of \"dictionary\" sorted\n   *  sequences.  Permutes the current sequence into the next one of this set.\n   *  Returns true if there are more sequences to generate.  If the sequence\n   *  is the largest of the set, the smallest is generated and false returned.\n  */\n  template<typename _BidirectionalIterator>\n    bool\n    next_permutation(_BidirectionalIterator __first,\n\t\t     _BidirectionalIterator __last)\n    {\n      // concept requirements\n      __glibcxx_function_requires(_BidirectionalIteratorConcept<\n\t\t\t\t  _BidirectionalIterator>)\n      __glibcxx_function_requires(_LessThanComparableConcept<\n\t    typename iterator_traits<_BidirectionalIterator>::value_type>)\n      __glibcxx_requires_valid_range(__first, __last);\n\n      if (__first == __last)\n\treturn false;\n      _BidirectionalIterator __i = __first;\n      ++__i;\n      if (__i == __last)\n\treturn false;\n      __i = __last;\n      --__i;\n\n      for(;;)\n\t{\n\t  _BidirectionalIterator __ii = __i;\n\t  --__i;\n\t  if (*__i < *__ii)\n\t    {\n\t      _BidirectionalIterator __j = __last;\n\t      while (!(*__i < *--__j))\n\t\t{}\n\t      std::iter_swap(__i, __j);\n\t      std::reverse(__ii, __last);\n\t      return true;\n\t    }\n\t  if (__i == __first)\n\t    {\n\t      std::reverse(__first, __last);\n\t      return false;\n\t    }\n\t}\n    }\n\n  /**\n   *  @brief  Permute range into the next \"dictionary\" ordering using\n   *  comparison functor.\n   *  @param  first  Start of range.\n   *  @param  last   End of range.\n   *  @param  comp\n   *  @return  False if wrapped to first permutation, true otherwise.\n   *\n   *  Treats all permutations of the range [first,last) as a set of\n   *  \"dictionary\" sorted sequences ordered by @a comp.  Permutes the current\n   *  sequence into the next one of this set.  Returns true if there are more\n   *  sequences to generate.  If the sequence is the largest of the set, the\n   *  smallest is generated and false returned.\n  */\n  template<typename _BidirectionalIterator, typename _Compare>\n    bool\n    next_permutation(_BidirectionalIterator __first,\n\t\t     _BidirectionalIterator __last, _Compare __comp)\n    {\n      // concept requirements\n      __glibcxx_function_requires(_BidirectionalIteratorConcept<\n\t\t\t\t  _BidirectionalIterator>)\n      __glibcxx_function_requires(_BinaryPredicateConcept<_Compare,\n\t    typename iterator_traits<_BidirectionalIterator>::value_type,\n\t    typename iterator_traits<_BidirectionalIterator>::value_type>)\n      __glibcxx_requires_valid_range(__first, __last);\n\n      if (__first == __last)\n\treturn false;\n      _BidirectionalIterator __i = __first;\n      ++__i;\n      if (__i == __last)\n\treturn false;\n      __i = __last;\n      --__i;\n\n      for(;;)\n\t{\n\t  _BidirectionalIterator __ii = __i;\n\t  --__i;\n\t  if (__comp(*__i, *__ii))\n\t    {\n\t      _BidirectionalIterator __j = __last;\n\t      while (!__comp(*__i, *--__j))\n\t\t{}\n\t      std::iter_swap(__i, __j);\n\t      std::reverse(__ii, __last);\n\t      return true;\n\t    }\n\t  if (__i == __first)\n\t    {\n\t      std::reverse(__first, __last);\n\t      return false;\n\t    }\n\t}\n    }\n\n  /**\n   *  @brief  Permute range into the previous \"dictionary\" ordering.\n   *  @param  first  Start of range.\n   *  @param  last   End of range.\n   *  @return  False if wrapped to last permutation, true otherwise.\n   *\n   *  Treats all permutations of the range as a set of \"dictionary\" sorted\n   *  sequences.  Permutes the current sequence into the previous one of this\n   *  set.  Returns true if there are more sequences to generate.  If the\n   *  sequence is the smallest of the set, the largest is generated and false\n   *  returned.\n  */\n  template<typename _BidirectionalIterator>\n    bool\n    prev_permutation(_BidirectionalIterator __first,\n\t\t     _BidirectionalIterator __last)\n    {\n      // concept requirements\n      __glibcxx_function_requires(_BidirectionalIteratorConcept<\n\t\t\t\t  _BidirectionalIterator>)\n      __glibcxx_function_requires(_LessThanComparableConcept<\n\t    typename iterator_traits<_BidirectionalIterator>::value_type>)\n      __glibcxx_requires_valid_range(__first, __last);\n\n      if (__first == __last)\n\treturn false;\n      _BidirectionalIterator __i = __first;\n      ++__i;\n      if (__i == __last)\n\treturn false;\n      __i = __last;\n      --__i;\n\n      for(;;)\n\t{\n\t  _BidirectionalIterator __ii = __i;\n\t  --__i;\n\t  if (*__ii < *__i)\n\t    {\n\t      _BidirectionalIterator __j = __last;\n\t      while (!(*--__j < *__i))\n\t\t{}\n\t      std::iter_swap(__i, __j);\n\t      std::reverse(__ii, __last);\n\t      return true;\n\t    }\n\t  if (__i == __first)\n\t    {\n\t      std::reverse(__first, __last);\n\t      return false;\n\t    }\n\t}\n    }\n\n  /**\n   *  @brief  Permute range into the previous \"dictionary\" ordering using\n   *  comparison functor.\n   *  @param  first  Start of range.\n   *  @param  last   End of range.\n   *  @param  comp\n   *  @return  False if wrapped to last permutation, true otherwise.\n   *\n   *  Treats all permutations of the range [first,last) as a set of\n   *  \"dictionary\" sorted sequences ordered by @a comp.  Permutes the current\n   *  sequence into the previous one of this set.  Returns true if there are\n   *  more sequences to generate.  If the sequence is the smallest of the set,\n   *  the largest is generated and false returned.\n  */\n  template<typename _BidirectionalIterator, typename _Compare>\n    bool\n    prev_permutation(_BidirectionalIterator __first,\n\t\t     _BidirectionalIterator __last, _Compare __comp)\n    {\n      // concept requirements\n      __glibcxx_function_requires(_BidirectionalIteratorConcept<\n\t\t\t\t  _BidirectionalIterator>)\n      __glibcxx_function_requires(_BinaryPredicateConcept<_Compare,\n\t    typename iterator_traits<_BidirectionalIterator>::value_type,\n\t    typename iterator_traits<_BidirectionalIterator>::value_type>)\n      __glibcxx_requires_valid_range(__first, __last);\n\n      if (__first == __last)\n\treturn false;\n      _BidirectionalIterator __i = __first;\n      ++__i;\n      if (__i == __last)\n\treturn false;\n      __i = __last;\n      --__i;\n\n      for(;;)\n\t{\n\t  _BidirectionalIterator __ii = __i;\n\t  --__i;\n\t  if (__comp(*__ii, *__i))\n\t    {\n\t      _BidirectionalIterator __j = __last;\n\t      while (!__comp(*--__j, *__i))\n\t\t{}\n\t      std::iter_swap(__i, __j);\n\t      std::reverse(__ii, __last);\n\t      return true;\n\t    }\n\t  if (__i == __first)\n\t    {\n\t      std::reverse(__first, __last);\n\t      return false;\n\t    }\n\t}\n    }\n\n  // find_first_of, with and without an explicitly supplied comparison function.\n\n  /**\n   *  @brief  Find element from a set in a sequence.\n   *  @param  first1  Start of range to search.\n   *  @param  last1   End of range to search.\n   *  @param  first2  Start of match candidates.\n   *  @param  last2   End of match candidates.\n   *  @return   The first iterator @c i in the range\n   *  @p [first1,last1) such that @c *i == @p *(i2) such that i2 is an\n   *  interator in [first2,last2), or @p last1 if no such iterator exists.\n   *\n   *  Searches the range @p [first1,last1) for an element that is equal to\n   *  some element in the range [first2,last2).  If found, returns an iterator\n   *  in the range [first1,last1), otherwise returns @p last1.\n  */\n  template<typename _InputIterator, typename _ForwardIterator>\n    _InputIterator\n    find_first_of(_InputIterator __first1, _InputIterator __last1,\n\t\t  _ForwardIterator __first2, _ForwardIterator __last2)\n    {\n      // concept requirements\n      __glibcxx_function_requires(_InputIteratorConcept<_InputIterator>)\n      __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator>)\n      __glibcxx_function_requires(_EqualOpConcept<\n\t    typename iterator_traits<_InputIterator>::value_type,\n\t    typename iterator_traits<_ForwardIterator>::value_type>)\n      __glibcxx_requires_valid_range(__first1, __last1);\n      __glibcxx_requires_valid_range(__first2, __last2);\n\n      for ( ; __first1 != __last1; ++__first1)\n\tfor (_ForwardIterator __iter = __first2; __iter != __last2; ++__iter)\n\t  if (*__first1 == *__iter)\n\t    return __first1;\n      return __last1;\n    }\n\n  /**\n   *  @brief  Find element from a set in a sequence using a predicate.\n   *  @param  first1  Start of range to search.\n   *  @param  last1   End of range to search.\n   *  @param  first2  Start of match candidates.\n   *  @param  last2   End of match candidates.\n   *  @param  comp    Predicate to use.\n   *  @return   The first iterator @c i in the range\n   *  @p [first1,last1) such that @c comp(*i, @p *(i2)) is true and i2 is an\n   *  interator in [first2,last2), or @p last1 if no such iterator exists.\n   *\n   *  Searches the range @p [first1,last1) for an element that is equal to\n   *  some element in the range [first2,last2).  If found, returns an iterator in\n   *  the range [first1,last1), otherwise returns @p last1.\n  */\n  template<typename _InputIterator, typename _ForwardIterator,\n\t   typename _BinaryPredicate>\n    _InputIterator\n    find_first_of(_InputIterator __first1, _InputIterator __last1,\n\t\t  _ForwardIterator __first2, _ForwardIterator __last2,\n\t\t  _BinaryPredicate __comp)\n    {\n      // concept requirements\n      __glibcxx_function_requires(_InputIteratorConcept<_InputIterator>)\n      __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator>)\n      __glibcxx_function_requires(_BinaryPredicateConcept<_BinaryPredicate,\n\t    typename iterator_traits<_InputIterator>::value_type,\n\t    typename iterator_traits<_ForwardIterator>::value_type>)\n      __glibcxx_requires_valid_range(__first1, __last1);\n      __glibcxx_requires_valid_range(__first2, __last2);\n\n      for ( ; __first1 != __last1; ++__first1)\n\tfor (_ForwardIterator __iter = __first2; __iter != __last2; ++__iter)\n\t  if (__comp(*__first1, *__iter))\n\t    return __first1;\n      return __last1;\n    }\n\n\n  // find_end, with and without an explicitly supplied comparison function.\n  // Search [first2, last2) as a subsequence in [first1, last1), and return\n  // the *last* possible match.  Note that find_end for bidirectional iterators\n  // is much faster than for forward iterators.\n\n  // find_end for forward iterators.\n  template<typename _ForwardIterator1, typename _ForwardIterator2>\n    _ForwardIterator1\n    __find_end(_ForwardIterator1 __first1, _ForwardIterator1 __last1,\n\t       _ForwardIterator2 __first2, _ForwardIterator2 __last2,\n\t       forward_iterator_tag, forward_iterator_tag)\n    {\n      if (__first2 == __last2)\n\treturn __last1;\n      else\n\t{\n\t  _ForwardIterator1 __result = __last1;\n\t  while (1)\n\t    {\n\t      _ForwardIterator1 __new_result\n\t\t= std::search(__first1, __last1, __first2, __last2);\n\t      if (__new_result == __last1)\n\t\treturn __result;\n\t      else\n\t\t{\n\t\t  __result = __new_result;\n\t\t  __first1 = __new_result;\n\t\t  ++__first1;\n\t\t}\n\t    }\n\t}\n    }\n\n  template<typename _ForwardIterator1, typename _ForwardIterator2,\n\t   typename _BinaryPredicate>\n    _ForwardIterator1\n    __find_end(_ForwardIterator1 __first1, _ForwardIterator1 __last1,\n\t       _ForwardIterator2 __first2, _ForwardIterator2 __last2,\n\t       forward_iterator_tag, forward_iterator_tag,\n\t       _BinaryPredicate __comp)\n    {\n      if (__first2 == __last2)\n\treturn __last1;\n      else\n\t{\n\t  _ForwardIterator1 __result = __last1;\n\t  while (1)\n\t    {\n\t      _ForwardIterator1 __new_result\n\t\t= std::search(__first1, __last1, __first2, __last2, __comp);\n\t      if (__new_result == __last1)\n\t\treturn __result;\n\t      else\n\t\t{\n\t\t  __result = __new_result;\n\t\t  __first1 = __new_result;\n\t\t  ++__first1;\n\t\t}\n\t    }\n\t}\n    }\n\n  // find_end for bidirectional iterators.  Requires partial specialization.\n  template<typename _BidirectionalIterator1, typename _BidirectionalIterator2>\n    _BidirectionalIterator1\n    __find_end(_BidirectionalIterator1 __first1,\n\t       _BidirectionalIterator1 __last1,\n\t       _BidirectionalIterator2 __first2,\n\t       _BidirectionalIterator2 __last2,\n\t       bidirectional_iterator_tag, bidirectional_iterator_tag)\n    {\n      // concept requirements\n      __glibcxx_function_requires(_BidirectionalIteratorConcept<\n\t\t\t\t  _BidirectionalIterator1>)\n      __glibcxx_function_requires(_BidirectionalIteratorConcept<\n\t\t\t\t  _BidirectionalIterator2>)\n\n      typedef reverse_iterator<_BidirectionalIterator1> _RevIterator1;\n      typedef reverse_iterator<_BidirectionalIterator2> _RevIterator2;\n\n      _RevIterator1 __rlast1(__first1);\n      _RevIterator2 __rlast2(__first2);\n      _RevIterator1 __rresult = std::search(_RevIterator1(__last1), __rlast1,\n\t\t\t\t\t    _RevIterator2(__last2), __rlast2);\n\n      if (__rresult == __rlast1)\n\treturn __last1;\n      else\n\t{\n\t  _BidirectionalIterator1 __result = __rresult.base();\n\t  std::advance(__result, -std::distance(__first2, __last2));\n\t  return __result;\n\t}\n    }\n\n  template<typename _BidirectionalIterator1, typename _BidirectionalIterator2,\n\t   typename _BinaryPredicate>\n    _BidirectionalIterator1\n    __find_end(_BidirectionalIterator1 __first1,\n\t       _BidirectionalIterator1 __last1,\n\t       _BidirectionalIterator2 __first2,\n\t       _BidirectionalIterator2 __last2,\n\t       bidirectional_iterator_tag, bidirectional_iterator_tag,\n\t       _BinaryPredicate __comp)\n    {\n      // concept requirements\n      __glibcxx_function_requires(_BidirectionalIteratorConcept<\n\t\t\t\t  _BidirectionalIterator1>)\n      __glibcxx_function_requires(_BidirectionalIteratorConcept<\n\t\t\t\t  _BidirectionalIterator2>)\n\n      typedef reverse_iterator<_BidirectionalIterator1> _RevIterator1;\n      typedef reverse_iterator<_BidirectionalIterator2> _RevIterator2;\n\n      _RevIterator1 __rlast1(__first1);\n      _RevIterator2 __rlast2(__first2);\n      _RevIterator1 __rresult = std::search(_RevIterator1(__last1), __rlast1,\n\t\t\t\t\t    _RevIterator2(__last2), __rlast2,\n\t\t\t\t\t    __comp);\n\n      if (__rresult == __rlast1)\n\treturn __last1;\n      else\n\t{\n\t  _BidirectionalIterator1 __result = __rresult.base();\n\t  std::advance(__result, -std::distance(__first2, __last2));\n\t  return __result;\n\t}\n    }\n\n  // Dispatching functions for find_end.\n\n  /**\n   *  @brief  Find last matching subsequence in a sequence.\n   *  @param  first1  Start of range to search.\n   *  @param  last1   End of range to search.\n   *  @param  first2  Start of sequence to match.\n   *  @param  last2   End of sequence to match.\n   *  @return   The last iterator @c i in the range\n   *  @p [first1,last1-(last2-first2)) such that @c *(i+N) == @p *(first2+N)\n   *  for each @c N in the range @p [0,last2-first2), or @p last1 if no\n   *  such iterator exists.\n   *\n   *  Searches the range @p [first1,last1) for a sub-sequence that compares\n   *  equal value-by-value with the sequence given by @p [first2,last2) and\n   *  returns an iterator to the first element of the sub-sequence, or\n   *  @p last1 if the sub-sequence is not found.  The sub-sequence will be the\n   *  last such subsequence contained in [first,last1).\n   *\n   *  Because the sub-sequence must lie completely within the range\n   *  @p [first1,last1) it must start at a position less than\n   *  @p last1-(last2-first2) where @p last2-first2 is the length of the\n   *  sub-sequence.\n   *  This means that the returned iterator @c i will be in the range\n   *  @p [first1,last1-(last2-first2))\n  */\n  template<typename _ForwardIterator1, typename _ForwardIterator2>\n    inline _ForwardIterator1\n    find_end(_ForwardIterator1 __first1, _ForwardIterator1 __last1,\n\t     _ForwardIterator2 __first2, _ForwardIterator2 __last2)\n    {\n      // concept requirements\n      __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator1>)\n      __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator2>)\n      __glibcxx_function_requires(_EqualOpConcept<\n\t    typename iterator_traits<_ForwardIterator1>::value_type,\n\t    typename iterator_traits<_ForwardIterator2>::value_type>)\n      __glibcxx_requires_valid_range(__first1, __last1);\n      __glibcxx_requires_valid_range(__first2, __last2);\n\n      return std::__find_end(__first1, __last1, __first2, __last2,\n\t\t\t     std::__iterator_category(__first1),\n\t\t\t     std::__iterator_category(__first2));\n    }\n\n  /**\n   *  @brief  Find last matching subsequence in a sequence using a predicate.\n   *  @param  first1  Start of range to search.\n   *  @param  last1   End of range to search.\n   *  @param  first2  Start of sequence to match.\n   *  @param  last2   End of sequence to match.\n   *  @param  comp    The predicate to use.\n   *  @return   The last iterator @c i in the range\n   *  @p [first1,last1-(last2-first2)) such that @c predicate(*(i+N), @p\n   *  (first2+N)) is true for each @c N in the range @p [0,last2-first2), or\n   *  @p last1 if no such iterator exists.\n   *\n   *  Searches the range @p [first1,last1) for a sub-sequence that compares\n   *  equal value-by-value with the sequence given by @p [first2,last2) using\n   *  comp as a predicate and returns an iterator to the first element of the\n   *  sub-sequence, or @p last1 if the sub-sequence is not found.  The\n   *  sub-sequence will be the last such subsequence contained in\n   *  [first,last1).\n   *\n   *  Because the sub-sequence must lie completely within the range\n   *  @p [first1,last1) it must start at a position less than\n   *  @p last1-(last2-first2) where @p last2-first2 is the length of the\n   *  sub-sequence.\n   *  This means that the returned iterator @c i will be in the range\n   *  @p [first1,last1-(last2-first2))\n  */\n  template<typename _ForwardIterator1, typename _ForwardIterator2,\n\t   typename _BinaryPredicate>\n    inline _ForwardIterator1\n    find_end(_ForwardIterator1 __first1, _ForwardIterator1 __last1,\n\t     _ForwardIterator2 __first2, _ForwardIterator2 __last2,\n\t     _BinaryPredicate __comp)\n    {\n      // concept requirements\n      __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator1>)\n      __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator2>)\n      __glibcxx_function_requires(_BinaryPredicateConcept<_BinaryPredicate,\n\t    typename iterator_traits<_ForwardIterator1>::value_type,\n\t    typename iterator_traits<_ForwardIterator2>::value_type>)\n      __glibcxx_requires_valid_range(__first1, __last1);\n      __glibcxx_requires_valid_range(__first2, __last2);\n\n      return std::__find_end(__first1, __last1, __first2, __last2,\n\t\t\t     std::__iterator_category(__first1),\n\t\t\t     std::__iterator_category(__first2),\n\t\t\t     __comp);\n    }\n\n_GLIBCXX_END_NAMESPACE\n\n#endif /* _ALGO_H */\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/bits/stl_algobase.h",
    "content": "// Bits and pieces used in algorithms -*- C++ -*-\n\n// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007\n// Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n/*\n *\n * Copyright (c) 1994\n * Hewlett-Packard Company\n *\n * Permission to use, copy, modify, distribute and sell this software\n * and its documentation for any purpose is hereby granted without fee,\n * provided that the above copyright notice appear in all copies and\n * that both that copyright notice and this permission notice appear\n * in supporting documentation.  Hewlett-Packard Company makes no\n * representations about the suitability of this software for any\n * purpose.  It is provided \"as is\" without express or implied warranty.\n *\n *\n * Copyright (c) 1996-1998\n * Silicon Graphics Computer Systems, Inc.\n *\n * Permission to use, copy, modify, distribute and sell this software\n * and its documentation for any purpose is hereby granted without fee,\n * provided that the above copyright notice appear in all copies and\n * that both that copyright notice and this permission notice appear\n * in supporting documentation.  Silicon Graphics makes no\n * representations about the suitability of this software for any\n * purpose.  It is provided \"as is\" without express or implied warranty.\n */\n\n/** @file stl_algobase.h\n *  This is an internal header file, included by other library headers.\n *  You should not attempt to use it directly.\n */\n\n#ifndef _ALGOBASE_H\n#define _ALGOBASE_H 1\n\n#include <bits/c++config.h>\n#include <cstring>\n#include <climits>\n#include <cstdlib>\n#include <cstddef>\n#include <iosfwd>\n#include <bits/stl_pair.h>\n#include <bits/cpp_type_traits.h>\n#include <ext/type_traits.h>\n#include <bits/stl_iterator_base_types.h>\n#include <bits/stl_iterator_base_funcs.h>\n#include <bits/stl_iterator.h>\n#include <bits/concept_check.h>\n#include <debug/debug.h>\n\n_GLIBCXX_BEGIN_NAMESPACE(std)\n\n  /**\n   *  @brief Swaps two values.\n   *  @param  a  A thing of arbitrary type.\n   *  @param  b  Another thing of arbitrary type.\n   *  @return   Nothing.\n   *\n   *  This is the simple classic generic implementation.  It will work on\n   *  any type which has a copy constructor and an assignment operator.\n  */\n  template<typename _Tp>\n    inline void\n    swap(_Tp& __a, _Tp& __b)\n    {\n      // concept requirements\n      __glibcxx_function_requires(_SGIAssignableConcept<_Tp>)\n\n      _Tp __tmp = __a;\n      __a = __b;\n      __b = __tmp;\n    }\n\n  // See http://gcc.gnu.org/ml/libstdc++/2004-08/msg00167.html: in a\n  // nutshell, we are partially implementing the resolution of DR 187,\n  // when it's safe, i.e., the value_types are equal.\n  template<bool _BoolType>\n    struct __iter_swap\n    {\n      template<typename _ForwardIterator1, typename _ForwardIterator2>\n        static void\n        iter_swap(_ForwardIterator1 __a, _ForwardIterator2 __b)\n        {\n          typedef typename iterator_traits<_ForwardIterator1>::value_type\n            _ValueType1;\n          _ValueType1 __tmp = *__a;\n          *__a = *__b;\n          *__b = __tmp; \n\t}\n    };\n\n  template<>\n    struct __iter_swap<true>\n    {\n      template<typename _ForwardIterator1, typename _ForwardIterator2>\n        static void \n        iter_swap(_ForwardIterator1 __a, _ForwardIterator2 __b)\n        {\n          swap(*__a, *__b);\n        }\n    };\n\n  /**\n   *  @brief Swaps the contents of two iterators.\n   *  @param  a  An iterator.\n   *  @param  b  Another iterator.\n   *  @return   Nothing.\n   *\n   *  This function swaps the values pointed to by two iterators, not the\n   *  iterators themselves.\n  */\n  template<typename _ForwardIterator1, typename _ForwardIterator2>\n    inline void\n    iter_swap(_ForwardIterator1 __a, _ForwardIterator2 __b)\n    {\n      typedef typename iterator_traits<_ForwardIterator1>::value_type\n\t_ValueType1;\n      typedef typename iterator_traits<_ForwardIterator2>::value_type\n\t_ValueType2;\n\n      // concept requirements\n      __glibcxx_function_requires(_Mutable_ForwardIteratorConcept<\n\t\t\t\t  _ForwardIterator1>)\n      __glibcxx_function_requires(_Mutable_ForwardIteratorConcept<\n\t\t\t\t  _ForwardIterator2>)\n      __glibcxx_function_requires(_ConvertibleConcept<_ValueType1,\n\t\t\t\t  _ValueType2>)\n      __glibcxx_function_requires(_ConvertibleConcept<_ValueType2,\n\t\t\t\t  _ValueType1>)\n\n      typedef typename iterator_traits<_ForwardIterator1>::reference\n\t_ReferenceType1;\n      typedef typename iterator_traits<_ForwardIterator2>::reference\n\t_ReferenceType2;\n      std::__iter_swap<__are_same<_ValueType1, _ValueType2>::__value &&\n\t__are_same<_ValueType1 &, _ReferenceType1>::__value &&\n\t__are_same<_ValueType2 &, _ReferenceType2>::__value>::\n\titer_swap(__a, __b);\n    }\n\n  /**\n   *  @brief This does what you think it does.\n   *  @param  a  A thing of arbitrary type.\n   *  @param  b  Another thing of arbitrary type.\n   *  @return   The lesser of the parameters.\n   *\n   *  This is the simple classic generic implementation.  It will work on\n   *  temporary expressions, since they are only evaluated once, unlike a\n   *  preprocessor macro.\n  */\n  template<typename _Tp>\n    inline const _Tp&\n    min(const _Tp& __a, const _Tp& __b)\n    {\n      // concept requirements\n      __glibcxx_function_requires(_LessThanComparableConcept<_Tp>)\n      //return __b < __a ? __b : __a;\n      if (__b < __a)\n\treturn __b;\n      return __a;\n    }\n\n  /**\n   *  @brief This does what you think it does.\n   *  @param  a  A thing of arbitrary type.\n   *  @param  b  Another thing of arbitrary type.\n   *  @return   The greater of the parameters.\n   *\n   *  This is the simple classic generic implementation.  It will work on\n   *  temporary expressions, since they are only evaluated once, unlike a\n   *  preprocessor macro.\n  */\n  template<typename _Tp>\n    inline const _Tp&\n    max(const _Tp& __a, const _Tp& __b)\n    {\n      // concept requirements\n      __glibcxx_function_requires(_LessThanComparableConcept<_Tp>)\n      //return  __a < __b ? __b : __a;\n      if (__a < __b)\n\treturn __b;\n      return __a;\n    }\n\n  /**\n   *  @brief This does what you think it does.\n   *  @param  a  A thing of arbitrary type.\n   *  @param  b  Another thing of arbitrary type.\n   *  @param  comp  A @link s20_3_3_comparisons comparison functor@endlink.\n   *  @return   The lesser of the parameters.\n   *\n   *  This will work on temporary expressions, since they are only evaluated\n   *  once, unlike a preprocessor macro.\n  */\n  template<typename _Tp, typename _Compare>\n    inline const _Tp&\n    min(const _Tp& __a, const _Tp& __b, _Compare __comp)\n    {\n      //return __comp(__b, __a) ? __b : __a;\n      if (__comp(__b, __a))\n\treturn __b;\n      return __a;\n    }\n\n  /**\n   *  @brief This does what you think it does.\n   *  @param  a  A thing of arbitrary type.\n   *  @param  b  Another thing of arbitrary type.\n   *  @param  comp  A @link s20_3_3_comparisons comparison functor@endlink.\n   *  @return   The greater of the parameters.\n   *\n   *  This will work on temporary expressions, since they are only evaluated\n   *  once, unlike a preprocessor macro.\n  */\n  template<typename _Tp, typename _Compare>\n    inline const _Tp&\n    max(const _Tp& __a, const _Tp& __b, _Compare __comp)\n    {\n      //return __comp(__a, __b) ? __b : __a;\n      if (__comp(__a, __b))\n\treturn __b;\n      return __a;\n    }\n\n  // All of these auxiliary structs serve two purposes.  (1) Replace\n  // calls to copy with memmove whenever possible.  (Memmove, not memcpy,\n  // because the input and output ranges are permitted to overlap.)\n  // (2) If we're using random access iterators, then write the loop as\n  // a for loop with an explicit count.\n\n  template<bool, typename>\n    struct __copy\n    {\n      template<typename _II, typename _OI>\n        static _OI\n        copy(_II __first, _II __last, _OI __result)\n        {\n\t  for (; __first != __last; ++__result, ++__first)\n\t    *__result = *__first;\n\t  return __result;\n\t}\n    };\n\n  template<bool _BoolType>\n    struct __copy<_BoolType, random_access_iterator_tag>\n    {\n      template<typename _II, typename _OI>\n        static _OI\n        copy(_II __first, _II __last, _OI __result)\n        { \n\t  typedef typename iterator_traits<_II>::difference_type _Distance;\n\t  for(_Distance __n = __last - __first; __n > 0; --__n)\n\t    {\n\t      *__result = *__first;\n\t      ++__first;\n\t      ++__result;\n\t    }\n\t  return __result;\n\t}\n    };\n\n  template<>\n    struct __copy<true, random_access_iterator_tag>\n    {\n      template<typename _Tp>\n        static _Tp*\n        copy(const _Tp* __first, const _Tp* __last, _Tp* __result)\n        { \n\t  std::memmove(__result, __first, sizeof(_Tp) * (__last - __first));\n\t  return __result + (__last - __first);\n\t}\n    };\n\n  template<typename _II, typename _OI>\n    inline _OI\n    __copy_aux(_II __first, _II __last, _OI __result)\n    {\n      typedef typename iterator_traits<_II>::value_type _ValueTypeI;\n      typedef typename iterator_traits<_OI>::value_type _ValueTypeO;\n      typedef typename iterator_traits<_II>::iterator_category _Category;\n      const bool __simple = (__is_scalar<_ValueTypeI>::__value\n\t                     && __is_pointer<_II>::__value\n\t                     && __is_pointer<_OI>::__value\n\t\t\t     && __are_same<_ValueTypeI, _ValueTypeO>::__value);\n\n      return std::__copy<__simple, _Category>::copy(__first, __last, __result);\n    }\n\n  // Helpers for streambuf iterators (either istream or ostream).\n  template<typename _CharT>\n  typename __gnu_cxx::__enable_if<__is_char<_CharT>::__value, \n\t\t\t\t  ostreambuf_iterator<_CharT> >::__type\n    __copy_aux(_CharT*, _CharT*, ostreambuf_iterator<_CharT>);\n\n  template<typename _CharT>\n    typename __gnu_cxx::__enable_if<__is_char<_CharT>::__value, \n\t\t\t\t    ostreambuf_iterator<_CharT> >::__type\n    __copy_aux(const _CharT*, const _CharT*, ostreambuf_iterator<_CharT>);\n\n  template<typename _CharT>\n  typename __gnu_cxx::__enable_if<__is_char<_CharT>::__value, _CharT*>::__type\n    __copy_aux(istreambuf_iterator<_CharT>, istreambuf_iterator<_CharT>,\n\t       _CharT*);\n\n  template<bool, bool>\n    struct __copy_normal\n    {\n      template<typename _II, typename _OI>\n        static _OI\n        __copy_n(_II __first, _II __last, _OI __result)\n        { return std::__copy_aux(__first, __last, __result); }\n    };\n\n  template<>\n    struct __copy_normal<true, false>\n    {\n      template<typename _II, typename _OI>\n        static _OI\n        __copy_n(_II __first, _II __last, _OI __result)\n        { return std::__copy_aux(__first.base(), __last.base(), __result); }\n    };\n\n  template<>\n    struct __copy_normal<false, true>\n    {\n      template<typename _II, typename _OI>\n        static _OI\n        __copy_n(_II __first, _II __last, _OI __result)\n        { return _OI(std::__copy_aux(__first, __last, __result.base())); }\n    };\n\n  template<>\n    struct __copy_normal<true, true>\n    {\n      template<typename _II, typename _OI>\n        static _OI\n        __copy_n(_II __first, _II __last, _OI __result)\n        { return _OI(std::__copy_aux(__first.base(), __last.base(),\n\t\t\t\t     __result.base())); }\n    };\n\n  /**\n   *  @brief Copies the range [first,last) into result.\n   *  @param  first  An input iterator.\n   *  @param  last   An input iterator.\n   *  @param  result An output iterator.\n   *  @return   result + (first - last)\n   *\n   *  This inline function will boil down to a call to @c memmove whenever\n   *  possible.  Failing that, if random access iterators are passed, then the\n   *  loop count will be known (and therefore a candidate for compiler\n   *  optimizations such as unrolling).  Result may not be contained within\n   *  [first,last); the copy_backward function should be used instead.\n   *\n   *  Note that the end of the output range is permitted to be contained\n   *  within [first,last).\n  */\n  template<typename _InputIterator, typename _OutputIterator>\n    inline _OutputIterator\n    copy(_InputIterator __first, _InputIterator __last,\n\t _OutputIterator __result)\n    {\n      // concept requirements\n      __glibcxx_function_requires(_InputIteratorConcept<_InputIterator>)\n      __glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator,\n\t    typename iterator_traits<_InputIterator>::value_type>)\n      __glibcxx_requires_valid_range(__first, __last);\n\n       const bool __in = __is_normal_iterator<_InputIterator>::__value;\n       const bool __out = __is_normal_iterator<_OutputIterator>::__value;\n       return std::__copy_normal<__in, __out>::__copy_n(__first, __last,\n\t\t\t\t\t\t\t__result);\n    }\n\n  // Overload for streambuf iterators.\n  template<typename _CharT>\n    typename __gnu_cxx::__enable_if<__is_char<_CharT>::__value, \n  \t       \t\t\t    ostreambuf_iterator<_CharT> >::__type\n    copy(istreambuf_iterator<_CharT>, istreambuf_iterator<_CharT>,\n\t ostreambuf_iterator<_CharT>);\n\n  template<bool, typename>\n    struct __copy_backward\n    {\n      template<typename _BI1, typename _BI2>\n        static _BI2\n        __copy_b(_BI1 __first, _BI1 __last, _BI2 __result)\n        { \n\t  while (__first != __last)\n\t    *--__result = *--__last;\n\t  return __result;\n\t}\n    };\n\n  template<bool _BoolType>\n    struct __copy_backward<_BoolType, random_access_iterator_tag>\n    {\n      template<typename _BI1, typename _BI2>\n        static _BI2\n        __copy_b(_BI1 __first, _BI1 __last, _BI2 __result)\n        { \n\t  typename iterator_traits<_BI1>::difference_type __n;\n\t  for (__n = __last - __first; __n > 0; --__n)\n\t    *--__result = *--__last;\n\t  return __result;\n\t}\n    };\n\n  template<>\n    struct __copy_backward<true, random_access_iterator_tag>\n    {\n      template<typename _Tp>\n        static _Tp*\n        __copy_b(const _Tp* __first, const _Tp* __last, _Tp* __result)\n        { \n\t  const ptrdiff_t _Num = __last - __first;\n\t  std::memmove(__result - _Num, __first, sizeof(_Tp) * _Num);\n\t  return __result - _Num;\n\t}\n    };\n\n  template<typename _BI1, typename _BI2>\n    inline _BI2\n    __copy_backward_aux(_BI1 __first, _BI1 __last, _BI2 __result)\n    {\n      typedef typename iterator_traits<_BI1>::value_type _ValueType1;\n      typedef typename iterator_traits<_BI2>::value_type _ValueType2;\n      typedef typename iterator_traits<_BI1>::iterator_category _Category;\n      const bool __simple = (__is_scalar<_ValueType1>::__value\n\t                     && __is_pointer<_BI1>::__value\n\t                     && __is_pointer<_BI2>::__value\n\t\t\t     && __are_same<_ValueType1, _ValueType2>::__value);\n\n      return std::__copy_backward<__simple, _Category>::__copy_b(__first,\n\t\t\t\t\t\t\t\t __last,\n\t\t\t\t\t\t\t\t __result);\n    }\n\n  template<bool, bool>\n    struct __copy_backward_normal\n    {\n      template<typename _BI1, typename _BI2>\n        static _BI2\n        __copy_b_n(_BI1 __first, _BI1 __last, _BI2 __result)\n        { return std::__copy_backward_aux(__first, __last, __result); }\n    };\n\n  template<>\n    struct __copy_backward_normal<true, false>\n    {\n      template<typename _BI1, typename _BI2>\n        static _BI2\n        __copy_b_n(_BI1 __first, _BI1 __last, _BI2 __result)\n        { return std::__copy_backward_aux(__first.base(), __last.base(),\n\t\t\t\t\t  __result); }\n    };\n\n  template<>\n    struct __copy_backward_normal<false, true>\n    {\n      template<typename _BI1, typename _BI2>\n        static _BI2\n        __copy_b_n(_BI1 __first, _BI1 __last, _BI2 __result)\n        { return _BI2(std::__copy_backward_aux(__first, __last,\n\t\t\t\t\t       __result.base())); }\n    };\n\n  template<>\n    struct __copy_backward_normal<true, true>\n    {\n      template<typename _BI1, typename _BI2>\n        static _BI2\n        __copy_b_n(_BI1 __first, _BI1 __last, _BI2 __result)\n        { return _BI2(std::__copy_backward_aux(__first.base(), __last.base(),\n\t\t\t\t\t       __result.base())); }\n    };\n\n  /**\n   *  @brief Copies the range [first,last) into result.\n   *  @param  first  A bidirectional iterator.\n   *  @param  last   A bidirectional iterator.\n   *  @param  result A bidirectional iterator.\n   *  @return   result - (first - last)\n   *\n   *  The function has the same effect as copy, but starts at the end of the\n   *  range and works its way to the start, returning the start of the result.\n   *  This inline function will boil down to a call to @c memmove whenever\n   *  possible.  Failing that, if random access iterators are passed, then the\n   *  loop count will be known (and therefore a candidate for compiler\n   *  optimizations such as unrolling).\n   *\n   *  Result may not be in the range [first,last).  Use copy instead.  Note\n   *  that the start of the output range may overlap [first,last).\n  */\n  template <typename _BI1, typename _BI2>\n    inline _BI2\n    copy_backward(_BI1 __first, _BI1 __last, _BI2 __result)\n    {\n      // concept requirements\n      __glibcxx_function_requires(_BidirectionalIteratorConcept<_BI1>)\n      __glibcxx_function_requires(_Mutable_BidirectionalIteratorConcept<_BI2>)\n      __glibcxx_function_requires(_ConvertibleConcept<\n\t    typename iterator_traits<_BI1>::value_type,\n\t    typename iterator_traits<_BI2>::value_type>)\n      __glibcxx_requires_valid_range(__first, __last);\n\n      const bool __bi1 = __is_normal_iterator<_BI1>::__value;\n      const bool __bi2 = __is_normal_iterator<_BI2>::__value;\n      return std::__copy_backward_normal<__bi1, __bi2>::__copy_b_n(__first,\n\t\t\t\t\t\t\t\t   __last,\n\t\t\t\t\t\t\t\t   __result);\n    }\n\n  template<bool>\n    struct __fill\n    {\n      template<typename _ForwardIterator, typename _Tp>\n        static void\n        fill(_ForwardIterator __first, _ForwardIterator __last,\n\t     const _Tp& __value)\n        {\n\t  for (; __first != __last; ++__first)\n\t    *__first = __value;\n\t}\n    };\n\n  template<>\n    struct __fill<true>\n    {\n      template<typename _ForwardIterator, typename _Tp>\n        static void\n        fill(_ForwardIterator __first, _ForwardIterator __last,\n\t     const _Tp& __value)\n        {\n\t  const _Tp __tmp = __value;\n\t  for (; __first != __last; ++__first)\n\t    *__first = __tmp;\n\t}\n    };\n\n  /**\n   *  @brief Fills the range [first,last) with copies of value.\n   *  @param  first  A forward iterator.\n   *  @param  last   A forward iterator.\n   *  @param  value  A reference-to-const of arbitrary type.\n   *  @return   Nothing.\n   *\n   *  This function fills a range with copies of the same value.  For one-byte\n   *  types filling contiguous areas of memory, this becomes an inline call to\n   *  @c memset.\n  */\n  template<typename _ForwardIterator, typename _Tp>\n    void\n    fill(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value)\n    {\n      // concept requirements\n      __glibcxx_function_requires(_Mutable_ForwardIteratorConcept<\n\t\t\t\t  _ForwardIterator>)\n      __glibcxx_requires_valid_range(__first, __last);\n\n      const bool __scalar = __is_scalar<_Tp>::__value;\n      std::__fill<__scalar>::fill(__first, __last, __value);\n    }\n\n  // Specialization: for one-byte types we can use memset.\n  inline void\n  fill(unsigned char* __first, unsigned char* __last, const unsigned char& __c)\n  {\n    __glibcxx_requires_valid_range(__first, __last);\n    const unsigned char __tmp = __c;\n    std::memset(__first, __tmp, __last - __first);\n  }\n\n  inline void\n  fill(signed char* __first, signed char* __last, const signed char& __c)\n  {\n    __glibcxx_requires_valid_range(__first, __last);\n    const signed char __tmp = __c;\n    std::memset(__first, static_cast<unsigned char>(__tmp), __last - __first);\n  }\n\n  inline void\n  fill(char* __first, char* __last, const char& __c)\n  {\n    __glibcxx_requires_valid_range(__first, __last);\n    const char __tmp = __c;\n    std::memset(__first, static_cast<unsigned char>(__tmp), __last - __first);\n  }\n\n  template<bool>\n    struct __fill_n\n    {\n      template<typename _OutputIterator, typename _Size, typename _Tp>\n        static _OutputIterator\n        fill_n(_OutputIterator __first, _Size __n, const _Tp& __value)\n        {\n\t  for (; __n > 0; --__n, ++__first)\n\t    *__first = __value;\n\t  return __first;\n\t}\n    };\n\n  template<>\n    struct __fill_n<true>\n    {\n      template<typename _OutputIterator, typename _Size, typename _Tp>\n        static _OutputIterator\n        fill_n(_OutputIterator __first, _Size __n, const _Tp& __value)\n        {\n\t  const _Tp __tmp = __value;\n\t  for (; __n > 0; --__n, ++__first)\n\t    *__first = __tmp;\n\t  return __first;\t  \n\t}\n    };\n\n  /**\n   *  @brief Fills the range [first,first+n) with copies of value.\n   *  @param  first  An output iterator.\n   *  @param  n      The count of copies to perform.\n   *  @param  value  A reference-to-const of arbitrary type.\n   *  @return   The iterator at first+n.\n   *\n   *  This function fills a range with copies of the same value.  For one-byte\n   *  types filling contiguous areas of memory, this becomes an inline call to\n   *  @c memset.\n  */\n  template<typename _OutputIterator, typename _Size, typename _Tp>\n    _OutputIterator\n    fill_n(_OutputIterator __first, _Size __n, const _Tp& __value)\n    {\n      // concept requirements\n      __glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator, _Tp>)\n\n      const bool __scalar = __is_scalar<_Tp>::__value;\n      return std::__fill_n<__scalar>::fill_n(__first, __n, __value);\n    }\n\n  template<typename _Size>\n    inline unsigned char*\n    fill_n(unsigned char* __first, _Size __n, const unsigned char& __c)\n    {\n      std::fill(__first, __first + __n, __c);\n      return __first + __n;\n    }\n\n  template<typename _Size>\n    inline signed char*\n    fill_n(signed char* __first, _Size __n, const signed char& __c)\n    {\n      std::fill(__first, __first + __n, __c);\n      return __first + __n;\n    }\n\n  template<typename _Size>\n    inline char*\n    fill_n(char* __first, _Size __n, const char& __c)\n    {\n      std::fill(__first, __first + __n, __c);\n      return __first + __n;\n    }\n\n  /**\n   *  @brief Finds the places in ranges which don't match.\n   *  @param  first1  An input iterator.\n   *  @param  last1   An input iterator.\n   *  @param  first2  An input iterator.\n   *  @return   A pair of iterators pointing to the first mismatch.\n   *\n   *  This compares the elements of two ranges using @c == and returns a pair\n   *  of iterators.  The first iterator points into the first range, the\n   *  second iterator points into the second range, and the elements pointed\n   *  to by the iterators are not equal.\n  */\n  template<typename _InputIterator1, typename _InputIterator2>\n    pair<_InputIterator1, _InputIterator2>\n    mismatch(_InputIterator1 __first1, _InputIterator1 __last1,\n\t     _InputIterator2 __first2)\n    {\n      // concept requirements\n      __glibcxx_function_requires(_InputIteratorConcept<_InputIterator1>)\n      __glibcxx_function_requires(_InputIteratorConcept<_InputIterator2>)\n      __glibcxx_function_requires(_EqualOpConcept<\n\t    typename iterator_traits<_InputIterator1>::value_type,\n\t    typename iterator_traits<_InputIterator2>::value_type>)\n      __glibcxx_requires_valid_range(__first1, __last1);\n\n      while (__first1 != __last1 && *__first1 == *__first2)\n        {\n\t  ++__first1;\n\t  ++__first2;\n        }\n      return pair<_InputIterator1, _InputIterator2>(__first1, __first2);\n    }\n\n  /**\n   *  @brief Finds the places in ranges which don't match.\n   *  @param  first1  An input iterator.\n   *  @param  last1   An input iterator.\n   *  @param  first2  An input iterator.\n   *  @param  binary_pred  A binary predicate @link s20_3_1_base functor@endlink.\n   *  @return   A pair of iterators pointing to the first mismatch.\n   *\n   *  This compares the elements of two ranges using the binary_pred\n   *  parameter, and returns a pair\n   *  of iterators.  The first iterator points into the first range, the\n   *  second iterator points into the second range, and the elements pointed\n   *  to by the iterators are not equal.\n  */\n  template<typename _InputIterator1, typename _InputIterator2,\n\t   typename _BinaryPredicate>\n    pair<_InputIterator1, _InputIterator2>\n    mismatch(_InputIterator1 __first1, _InputIterator1 __last1,\n\t     _InputIterator2 __first2, _BinaryPredicate __binary_pred)\n    {\n      // concept requirements\n      __glibcxx_function_requires(_InputIteratorConcept<_InputIterator1>)\n      __glibcxx_function_requires(_InputIteratorConcept<_InputIterator2>)\n      __glibcxx_requires_valid_range(__first1, __last1);\n\n      while (__first1 != __last1 && __binary_pred(*__first1, *__first2))\n        {\n\t  ++__first1;\n\t  ++__first2;\n        }\n      return pair<_InputIterator1, _InputIterator2>(__first1, __first2);\n    }\n\n  /**\n   *  @brief Tests a range for element-wise equality.\n   *  @param  first1  An input iterator.\n   *  @param  last1   An input iterator.\n   *  @param  first2  An input iterator.\n   *  @return   A boolean true or false.\n   *\n   *  This compares the elements of two ranges using @c == and returns true or\n   *  false depending on whether all of the corresponding elements of the\n   *  ranges are equal.\n  */\n  template<typename _InputIterator1, typename _InputIterator2>\n    inline bool\n    equal(_InputIterator1 __first1, _InputIterator1 __last1,\n\t  _InputIterator2 __first2)\n    {\n      // concept requirements\n      __glibcxx_function_requires(_InputIteratorConcept<_InputIterator1>)\n      __glibcxx_function_requires(_InputIteratorConcept<_InputIterator2>)\n      __glibcxx_function_requires(_EqualOpConcept<\n\t    typename iterator_traits<_InputIterator1>::value_type,\n\t    typename iterator_traits<_InputIterator2>::value_type>)\n      __glibcxx_requires_valid_range(__first1, __last1);\n      \n      for (; __first1 != __last1; ++__first1, ++__first2)\n\tif (!(*__first1 == *__first2))\n\t  return false;\n      return true;\n    }\n\n  /**\n   *  @brief Tests a range for element-wise equality.\n   *  @param  first1  An input iterator.\n   *  @param  last1   An input iterator.\n   *  @param  first2  An input iterator.\n   *  @param  binary_pred  A binary predicate @link s20_3_1_base functor@endlink.\n   *  @return   A boolean true or false.\n   *\n   *  This compares the elements of two ranges using the binary_pred\n   *  parameter, and returns true or\n   *  false depending on whether all of the corresponding elements of the\n   *  ranges are equal.\n  */\n  template<typename _InputIterator1, typename _InputIterator2,\n\t   typename _BinaryPredicate>\n    inline bool\n    equal(_InputIterator1 __first1, _InputIterator1 __last1,\n\t  _InputIterator2 __first2,\n\t  _BinaryPredicate __binary_pred)\n    {\n      // concept requirements\n      __glibcxx_function_requires(_InputIteratorConcept<_InputIterator1>)\n      __glibcxx_function_requires(_InputIteratorConcept<_InputIterator2>)\n      __glibcxx_requires_valid_range(__first1, __last1);\n\n      for (; __first1 != __last1; ++__first1, ++__first2)\n\tif (!__binary_pred(*__first1, *__first2))\n\t  return false;\n      return true;\n    }\n\n  /**\n   *  @brief Performs \"dictionary\" comparison on ranges.\n   *  @param  first1  An input iterator.\n   *  @param  last1   An input iterator.\n   *  @param  first2  An input iterator.\n   *  @param  last2   An input iterator.\n   *  @return   A boolean true or false.\n   *\n   *  \"Returns true if the sequence of elements defined by the range\n   *  [first1,last1) is lexicographically less than the sequence of elements\n   *  defined by the range [first2,last2).  Returns false otherwise.\"\n   *  (Quoted from [25.3.8]/1.)  If the iterators are all character pointers,\n   *  then this is an inline call to @c memcmp.\n  */\n  template<typename _InputIterator1, typename _InputIterator2>\n    bool\n    lexicographical_compare(_InputIterator1 __first1, _InputIterator1 __last1,\n\t\t\t    _InputIterator2 __first2, _InputIterator2 __last2)\n    {\n      // concept requirements\n      __glibcxx_function_requires(_InputIteratorConcept<_InputIterator1>)\n      __glibcxx_function_requires(_InputIteratorConcept<_InputIterator2>)\n      __glibcxx_function_requires(_LessThanOpConcept<\n\t    typename iterator_traits<_InputIterator1>::value_type,\n\t    typename iterator_traits<_InputIterator2>::value_type>)\n      __glibcxx_function_requires(_LessThanOpConcept<\n\t    typename iterator_traits<_InputIterator2>::value_type,\n\t    typename iterator_traits<_InputIterator1>::value_type>)\n      __glibcxx_requires_valid_range(__first1, __last1);\n      __glibcxx_requires_valid_range(__first2, __last2);\n\n      for (; __first1 != __last1 && __first2 != __last2;\n\t   ++__first1, ++__first2)\n\t{\n\t  if (*__first1 < *__first2)\n\t    return true;\n\t  if (*__first2 < *__first1)\n\t    return false;\n\t}\n      return __first1 == __last1 && __first2 != __last2;\n    }\n\n  /**\n   *  @brief Performs \"dictionary\" comparison on ranges.\n   *  @param  first1  An input iterator.\n   *  @param  last1   An input iterator.\n   *  @param  first2  An input iterator.\n   *  @param  last2   An input iterator.\n   *  @param  comp  A @link s20_3_3_comparisons comparison functor@endlink.\n   *  @return   A boolean true or false.\n   *\n   *  The same as the four-parameter @c lexigraphical_compare, but uses the\n   *  comp parameter instead of @c <.\n  */\n  template<typename _InputIterator1, typename _InputIterator2,\n\t   typename _Compare>\n    bool\n    lexicographical_compare(_InputIterator1 __first1, _InputIterator1 __last1,\n\t\t\t    _InputIterator2 __first2, _InputIterator2 __last2,\n\t\t\t    _Compare __comp)\n    {\n      // concept requirements\n      __glibcxx_function_requires(_InputIteratorConcept<_InputIterator1>)\n      __glibcxx_function_requires(_InputIteratorConcept<_InputIterator2>)\n      __glibcxx_requires_valid_range(__first1, __last1);\n      __glibcxx_requires_valid_range(__first2, __last2);\n\n      for (; __first1 != __last1 && __first2 != __last2;\n\t   ++__first1, ++__first2)\n\t{\n\t  if (__comp(*__first1, *__first2))\n\t    return true;\n\t  if (__comp(*__first2, *__first1))\n\t    return false;\n\t}\n      return __first1 == __last1 && __first2 != __last2;\n    }\n\n  inline bool\n  lexicographical_compare(const unsigned char* __first1,\n\t\t\t  const unsigned char* __last1,\n\t\t\t  const unsigned char* __first2,\n\t\t\t  const unsigned char* __last2)\n  {\n    __glibcxx_requires_valid_range(__first1, __last1);\n    __glibcxx_requires_valid_range(__first2, __last2);\n\n    const size_t __len1 = __last1 - __first1;\n    const size_t __len2 = __last2 - __first2;\n    const int __result = std::memcmp(__first1, __first2,\n\t\t\t\t     std::min(__len1, __len2));\n    return __result != 0 ? __result < 0 : __len1 < __len2;\n  }\n\n  inline bool\n  lexicographical_compare(const char* __first1, const char* __last1,\n\t\t\t  const char* __first2, const char* __last2)\n  {\n    __glibcxx_requires_valid_range(__first1, __last1);\n    __glibcxx_requires_valid_range(__first2, __last2);\n\n#if CHAR_MAX == SCHAR_MAX\n    return std::lexicographical_compare((const signed char*) __first1,\n\t\t\t\t\t(const signed char*) __last1,\n\t\t\t\t\t(const signed char*) __first2,\n\t\t\t\t\t(const signed char*) __last2);\n#else /* CHAR_MAX == SCHAR_MAX */\n    return std::lexicographical_compare((const unsigned char*) __first1,\n\t\t\t\t\t(const unsigned char*) __last1,\n\t\t\t\t\t(const unsigned char*) __first2,\n\t\t\t\t\t(const unsigned char*) __last2);\n#endif /* CHAR_MAX == SCHAR_MAX */\n  }\n\n_GLIBCXX_END_NAMESPACE\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/bits/stl_bvector.h",
    "content": "// vector<bool> specialization -*- C++ -*-\n\n// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006\n// Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n/*\n *\n * Copyright (c) 1994\n * Hewlett-Packard Company\n *\n * Permission to use, copy, modify, distribute and sell this software\n * and its documentation for any purpose is hereby granted without fee,\n * provided that the above copyright notice appear in all copies and\n * that both that copyright notice and this permission notice appear\n * in supporting documentation.  Hewlett-Packard Company makes no\n * representations about the suitability of this software for any\n * purpose.  It is provided \"as is\" without express or implied warranty.\n *\n *\n * Copyright (c) 1996-1999\n * Silicon Graphics Computer Systems, Inc.\n *\n * Permission to use, copy, modify, distribute and sell this software\n * and its documentation for any purpose is hereby granted without fee,\n * provided that the above copyright notice appear in all copies and\n * that both that copyright notice and this permission notice appear\n * in supporting documentation.  Silicon Graphics makes no\n * representations about the suitability of this software for any\n * purpose.  It is provided \"as is\" without express or implied warranty.\n */\n\n/** @file stl_bvector.h\n *  This is an internal header file, included by other library headers.\n *  You should not attempt to use it directly.\n */\n\n#ifndef _BVECTOR_H\n#define _BVECTOR_H 1\n\n_GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD)\n\n  typedef unsigned long _Bit_type;\n  enum { _S_word_bit = int(CHAR_BIT * sizeof(_Bit_type)) };\n\n  struct _Bit_reference\n  {\n    _Bit_type * _M_p;\n    _Bit_type _M_mask;\n\n    _Bit_reference(_Bit_type * __x, _Bit_type __y)\n    : _M_p(__x), _M_mask(__y) { }\n\n    _Bit_reference() : _M_p(0), _M_mask(0) { }\n\n    operator bool() const\n    { return !!(*_M_p & _M_mask); }\n\n    _Bit_reference&\n    operator=(bool __x)\n    {\n      if (__x)\n\t*_M_p |= _M_mask;\n      else\n\t*_M_p &= ~_M_mask;\n      return *this;\n    }\n\n    _Bit_reference&\n    operator=(const _Bit_reference& __x)\n    { return *this = bool(__x); }\n\n    bool\n    operator==(const _Bit_reference& __x) const\n    { return bool(*this) == bool(__x); }\n\n    bool\n    operator<(const _Bit_reference& __x) const\n    { return !bool(*this) && bool(__x); }\n\n    void\n    flip()\n    { *_M_p ^= _M_mask; }\n  };\n\n  struct _Bit_iterator_base\n  : public std::iterator<std::random_access_iterator_tag, bool>\n  {\n    _Bit_type * _M_p;\n    unsigned int _M_offset;\n\n    _Bit_iterator_base(_Bit_type * __x, unsigned int __y)\n    : _M_p(__x), _M_offset(__y) { }\n\n    void\n    _M_bump_up()\n    {\n      if (_M_offset++ == int(_S_word_bit) - 1)\n\t{\n\t  _M_offset = 0;\n\t  ++_M_p;\n\t}\n    }\n\n    void\n    _M_bump_down()\n    {\n      if (_M_offset-- == 0)\n\t{\n\t  _M_offset = int(_S_word_bit) - 1;\n\t  --_M_p;\n\t}\n    }\n\n    void\n    _M_incr(ptrdiff_t __i)\n    {\n      difference_type __n = __i + _M_offset;\n      _M_p += __n / int(_S_word_bit);\n      __n = __n % int(_S_word_bit);\n      if (__n < 0)\n\t{\n\t  __n += int(_S_word_bit);\n\t  --_M_p;\n\t}\n      _M_offset = static_cast<unsigned int>(__n);\n    }\n\n    bool\n    operator==(const _Bit_iterator_base& __i) const\n    { return _M_p == __i._M_p && _M_offset == __i._M_offset; }\n\n    bool\n    operator<(const _Bit_iterator_base& __i) const\n    {\n      return _M_p < __i._M_p\n\t     || (_M_p == __i._M_p && _M_offset < __i._M_offset);\n    }\n\n    bool\n    operator!=(const _Bit_iterator_base& __i) const\n    { return !(*this == __i); }\n\n    bool\n    operator>(const _Bit_iterator_base& __i) const\n    { return __i < *this; }\n\n    bool\n    operator<=(const _Bit_iterator_base& __i) const\n    { return !(__i < *this); }\n\n    bool\n    operator>=(const _Bit_iterator_base& __i) const\n    { return !(*this < __i); }\n  };\n\n  inline ptrdiff_t\n  operator-(const _Bit_iterator_base& __x, const _Bit_iterator_base& __y)\n  {\n    return (int(_S_word_bit) * (__x._M_p - __y._M_p)\n\t    + __x._M_offset - __y._M_offset);\n  }\n\n  struct _Bit_iterator : public _Bit_iterator_base\n  {\n    typedef _Bit_reference  reference;\n    typedef _Bit_reference* pointer;\n    typedef _Bit_iterator   iterator;\n\n    _Bit_iterator() : _Bit_iterator_base(0, 0) { }\n\n    _Bit_iterator(_Bit_type * __x, unsigned int __y)\n    : _Bit_iterator_base(__x, __y) { }\n\n    reference\n    operator*() const\n    { return reference(_M_p, 1UL << _M_offset); }\n\n    iterator&\n    operator++()\n    {\n      _M_bump_up();\n      return *this;\n    }\n\n    iterator\n    operator++(int)\n    {\n      iterator __tmp = *this;\n      _M_bump_up();\n      return __tmp;\n    }\n\n    iterator&\n    operator--()\n    {\n      _M_bump_down();\n      return *this;\n    }\n\n    iterator\n    operator--(int)\n    {\n      iterator __tmp = *this;\n      _M_bump_down();\n      return __tmp;\n    }\n\n    iterator&\n    operator+=(difference_type __i)\n    {\n      _M_incr(__i);\n      return *this;\n    }\n\n    iterator&\n    operator-=(difference_type __i)\n    {\n      *this += -__i;\n      return *this;\n    }\n\n    iterator\n    operator+(difference_type __i) const\n    {\n      iterator __tmp = *this;\n      return __tmp += __i;\n    }\n\n    iterator\n    operator-(difference_type __i) const\n    {\n      iterator __tmp = *this;\n      return __tmp -= __i;\n    }\n\n    reference\n    operator[](difference_type __i) const\n    { return *(*this + __i); }\n  };\n\n  inline _Bit_iterator\n  operator+(ptrdiff_t __n, const _Bit_iterator& __x)\n  { return __x + __n; }\n\n  struct _Bit_const_iterator : public _Bit_iterator_base\n  {\n    typedef bool                 reference;\n    typedef bool                 const_reference;\n    typedef const bool*          pointer;\n    typedef _Bit_const_iterator  const_iterator;\n\n    _Bit_const_iterator() : _Bit_iterator_base(0, 0) { }\n\n    _Bit_const_iterator(_Bit_type * __x, unsigned int __y)\n    : _Bit_iterator_base(__x, __y) { }\n\n    _Bit_const_iterator(const _Bit_iterator& __x)\n    : _Bit_iterator_base(__x._M_p, __x._M_offset) { }\n\n    const_reference\n    operator*() const\n    { return _Bit_reference(_M_p, 1UL << _M_offset); }\n\n    const_iterator&\n    operator++()\n    {\n      _M_bump_up();\n      return *this;\n    }\n\n    const_iterator\n    operator++(int)\n    {\n      const_iterator __tmp = *this;\n      _M_bump_up();\n      return __tmp;\n    }\n\n    const_iterator&\n    operator--()\n    {\n      _M_bump_down();\n      return *this;\n    }\n\n    const_iterator\n    operator--(int)\n    {\n      const_iterator __tmp = *this;\n      _M_bump_down();\n      return __tmp;\n    }\n\n    const_iterator&\n    operator+=(difference_type __i)\n    {\n      _M_incr(__i);\n      return *this;\n    }\n\n    const_iterator&\n    operator-=(difference_type __i)\n    {\n      *this += -__i;\n      return *this;\n    }\n\n    const_iterator \n    operator+(difference_type __i) const\n    {\n      const_iterator __tmp = *this;\n      return __tmp += __i;\n    }\n\n    const_iterator\n    operator-(difference_type __i) const\n    {\n      const_iterator __tmp = *this;\n      return __tmp -= __i;\n    }\n\n    const_reference\n    operator[](difference_type __i) const\n    { return *(*this + __i); }\n  };\n\n  inline _Bit_const_iterator\n  operator+(ptrdiff_t __n, const _Bit_const_iterator& __x)\n  { return __x + __n; }\n\n  inline void\n  __fill_bvector(_Bit_iterator __first, _Bit_iterator __last, bool __x)\n  {\n    for (; __first != __last; ++__first)\n      *__first = __x;\n  }\n\n  inline void\n  fill(_Bit_iterator __first, _Bit_iterator __last, const bool& __x)\n  {\n    if (__first._M_p != __last._M_p)\n      {\n\tstd::fill(__first._M_p + 1, __last._M_p, __x ? ~0 : 0);\n\t__fill_bvector(__first, _Bit_iterator(__first._M_p + 1, 0), __x);\n\t__fill_bvector(_Bit_iterator(__last._M_p, 0), __last, __x);\n      }\n    else\n      __fill_bvector(__first, __last, __x);\n  }\n\n  template<class _Alloc>\n    struct _Bvector_base\n    {\n      typedef typename _Alloc::template rebind<_Bit_type>::other\n        _Bit_alloc_type;\n      \n      struct _Bvector_impl\n      : public _Bit_alloc_type\n      {\n\t_Bit_iterator \t_M_start;\n\t_Bit_iterator \t_M_finish;\n\t_Bit_type* \t_M_end_of_storage;\n\t_Bvector_impl(const _Bit_alloc_type& __a)\n\t: _Bit_alloc_type(__a), _M_start(), _M_finish(), _M_end_of_storage(0)\n\t{ }\n      };\n\n    public:\n      typedef _Alloc allocator_type;\n\n      _Bit_alloc_type&\n      _M_get_Bit_allocator()\n      { return *static_cast<_Bit_alloc_type*>(&this->_M_impl); }\n\n      const _Bit_alloc_type&\n      _M_get_Bit_allocator() const\n      { return *static_cast<const _Bit_alloc_type*>(&this->_M_impl); }\n\n      allocator_type\n      get_allocator() const\n      { return allocator_type(_M_get_Bit_allocator()); }\n\n      _Bvector_base(const allocator_type& __a) : _M_impl(__a) { }\n\n      ~_Bvector_base()\n      { this->_M_deallocate(); }\n\n    protected:\n      _Bvector_impl _M_impl;\n\n      _Bit_type*\n      _M_allocate(size_t __n)\n      { return _M_impl.allocate((__n + int(_S_word_bit) - 1)\n\t\t\t\t/ int(_S_word_bit)); }\n\n      void\n      _M_deallocate()\n      {\n\tif (_M_impl._M_start._M_p)\n\t  _M_impl.deallocate(_M_impl._M_start._M_p,\n\t\t\t     _M_impl._M_end_of_storage - _M_impl._M_start._M_p);\n      }\n    };\n\n_GLIBCXX_END_NESTED_NAMESPACE\n\n// Declare a partial specialization of vector<T, Alloc>.\n#include <bits/stl_vector.h>\n\n_GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD)\n\n  /**\n   *  @brief  A specialization of vector for booleans which offers fixed time\n   *  access to individual elements in any order.\n   *\n   *  Note that vector<bool> does not actually meet the requirements for being\n   *  a container.  This is because the reference and pointer types are not\n   *  really references and pointers to bool.  See DR96 for details.  @see\n   *  vector for function documentation.\n   *\n   *  @ingroup Containers\n   *  @ingroup Sequences\n   *\n   *  In some terminology a %vector can be described as a dynamic\n   *  C-style array, it offers fast and efficient access to individual\n   *  elements in any order and saves the user from worrying about\n   *  memory and size allocation.  Subscripting ( @c [] ) access is\n   *  also provided as with C-style arrays.\n  */\ntemplate<typename _Alloc>\n  class vector<bool, _Alloc> : protected _Bvector_base<_Alloc>\n  {\n    typedef _Bvector_base<_Alloc>\t\t\t _Base;\n\n  public:\n    typedef bool                                         value_type;\n    typedef size_t                                       size_type;\n    typedef ptrdiff_t                                    difference_type;\n    typedef _Bit_reference                               reference;\n    typedef bool                                         const_reference;\n    typedef _Bit_reference*                              pointer;\n    typedef const bool*                                  const_pointer;\n    typedef _Bit_iterator                                iterator;\n    typedef _Bit_const_iterator                          const_iterator;\n    typedef std::reverse_iterator<const_iterator>        const_reverse_iterator;\n    typedef std::reverse_iterator<iterator>              reverse_iterator;\n    typedef _Alloc                        \t\t allocator_type;\n\n    allocator_type get_allocator() const\n    { return _Base::get_allocator(); }\n\n  protected:\n    using _Base::_M_allocate;\n    using _Base::_M_deallocate;\n    using _Base::_M_get_Bit_allocator;\n\n  public:\n    explicit\n    vector(const allocator_type& __a = allocator_type())\n    : _Base(__a) { }\n\n    explicit\n    vector(size_type __n, const bool& __value = bool(), \n\t   const allocator_type& __a = allocator_type())\n    : _Base(__a)\n    {\n      _M_initialize(__n);\n      std::fill(this->_M_impl._M_start._M_p, this->_M_impl._M_end_of_storage, \n\t\t__value ? ~0 : 0);\n    }\n\n    vector(const vector& __x)\n    : _Base(__x._M_get_Bit_allocator())\n    {\n      _M_initialize(__x.size());\n      _M_copy_aligned(__x.begin(), __x.end(), this->_M_impl._M_start);\n    }\n\n    template<class _InputIterator>\n      vector(_InputIterator __first, _InputIterator __last,\n\t     const allocator_type& __a = allocator_type())\n      : _Base(__a)\n      {\n\ttypedef typename std::__is_integer<_InputIterator>::__type _Integral;\n\t_M_initialize_dispatch(__first, __last, _Integral());\n      }\n\n    ~vector() { }\n\n    vector&\n    operator=(const vector& __x)\n    {\n      if (&__x == this)\n\treturn *this;\n      if (__x.size() > capacity())\n\t{\n\t  this->_M_deallocate();\n\t  _M_initialize(__x.size());\n\t}\n      this->_M_impl._M_finish = _M_copy_aligned(__x.begin(), __x.end(),\n\t\t\t\t\t\tbegin());\n      return *this;\n    }\n\n    // assign(), a generalized assignment member function.  Two\n    // versions: one that takes a count, and one that takes a range.\n    // The range version is a member template, so we dispatch on whether\n    // or not the type is an integer.\n    void\n    assign(size_type __n, const bool& __x)\n    { _M_fill_assign(__n, __x); }\n\n    template<class _InputIterator>\n      void\n      assign(_InputIterator __first, _InputIterator __last)\n      {\n\ttypedef typename std::__is_integer<_InputIterator>::__type _Integral;\n\t_M_assign_dispatch(__first, __last, _Integral());\n      }\n\n    iterator\n    begin()\n    { return this->_M_impl._M_start; }\n\n    const_iterator\n    begin() const\n    { return this->_M_impl._M_start; }\n\n    iterator\n    end()\n    { return this->_M_impl._M_finish; }\n\n    const_iterator\n    end() const\n    { return this->_M_impl._M_finish; }\n\n    reverse_iterator\n    rbegin()\n    { return reverse_iterator(end()); }\n\n    const_reverse_iterator\n    rbegin() const\n    { return const_reverse_iterator(end()); }\n\n    reverse_iterator\n    rend()\n    { return reverse_iterator(begin()); }\n\n    const_reverse_iterator\n    rend() const\n    { return const_reverse_iterator(begin()); }\n\n    size_type\n    size() const\n    { return size_type(end() - begin()); }\n\n    size_type\n    max_size() const\n    {\n      const size_type __asize = _M_get_Bit_allocator().max_size();\n      return (__asize <= size_type(-1) / int(_S_word_bit) ?\n\t      __asize * int(_S_word_bit) : size_type(-1));\n    }\n\n    size_type\n    capacity() const\n    { return size_type(const_iterator(this->_M_impl._M_end_of_storage, 0)\n\t\t       - begin()); }\n\n    bool\n    empty() const\n    { return begin() == end(); }\n\n    reference\n    operator[](size_type __n)\n    {\n      return *iterator(this->_M_impl._M_start._M_p\n\t\t       + __n / int(_S_word_bit), __n % int(_S_word_bit));\n    }\n\n    const_reference\n    operator[](size_type __n) const\n    {\n      return *const_iterator(this->_M_impl._M_start._M_p\n\t\t\t     + __n / int(_S_word_bit), __n % int(_S_word_bit));\n    }\n\n  protected:\n    void\n    _M_range_check(size_type __n) const\n    {\n      if (__n >= this->size())\n        __throw_out_of_range(__N(\"vector<bool>::_M_range_check\"));\n    }\n\n  public:\n    reference\n    at(size_type __n)\n    { _M_range_check(__n); return (*this)[__n]; }\n\n    const_reference\n    at(size_type __n) const\n    { _M_range_check(__n); return (*this)[__n]; }\n\n    void\n    reserve(size_type __n)\n    {\n      if (__n > this->max_size())\n\t__throw_length_error(__N(\"vector::reserve\"));\n      if (this->capacity() < __n)\n\t{\n\t  _Bit_type* __q = this->_M_allocate(__n);\n\t  this->_M_impl._M_finish = _M_copy_aligned(begin(), end(),\n\t\t\t\t\t\t    iterator(__q, 0));\n\t  this->_M_deallocate();\n\t  this->_M_impl._M_start = iterator(__q, 0);\n\t  this->_M_impl._M_end_of_storage = (__q + (__n + int(_S_word_bit) - 1)\n\t\t\t\t\t     / int(_S_word_bit));\n\t}\n    }\n\n    reference\n    front()\n    { return *begin(); }\n\n    const_reference\n    front() const\n    { return *begin(); }\n\n    reference\n    back()\n    { return *(end() - 1); }\n\n    const_reference\n    back() const\n    { return *(end() - 1); }\n\n    // _GLIBCXX_RESOLVE_LIB_DEFECTS\n    // DR 464. Suggestion for new member functions in standard containers.\n    // N.B. DR 464 says nothing about vector<bool> but we need something\n    // here due to the way we are implementing DR 464 in the debug-mode\n    // vector class.\n    void\n    data() { }\n\n    void\n    push_back(bool __x)\n    {\n      if (this->_M_impl._M_finish._M_p != this->_M_impl._M_end_of_storage)\n        *this->_M_impl._M_finish++ = __x;\n      else\n        _M_insert_aux(end(), __x);\n    }\n\n    void\n    swap(vector<bool, _Alloc>& __x)\n    {\n      std::swap(this->_M_impl._M_start, __x._M_impl._M_start);\n      std::swap(this->_M_impl._M_finish, __x._M_impl._M_finish);\n      std::swap(this->_M_impl._M_end_of_storage, \n\t\t__x._M_impl._M_end_of_storage);\n\n      // _GLIBCXX_RESOLVE_LIB_DEFECTS\n      // 431. Swapping containers with unequal allocators.\n      std::__alloc_swap<typename _Base::_Bit_alloc_type>::\n\t_S_do_it(_M_get_Bit_allocator(), __x._M_get_Bit_allocator());\n    }\n\n    // [23.2.5]/1, third-to-last entry in synopsis listing\n    static void\n    swap(reference __x, reference __y)\n    {\n      bool __tmp = __x;\n      __x = __y;\n      __y = __tmp;\n    }\n\n    iterator\n    insert(iterator __position, const bool& __x = bool())\n    {\n      const difference_type __n = __position - begin();\n      if (this->_M_impl._M_finish._M_p != this->_M_impl._M_end_of_storage\n\t  && __position == end())\n        *this->_M_impl._M_finish++ = __x;\n      else\n        _M_insert_aux(__position, __x);\n      return begin() + __n;\n    }\n\n    template<class _InputIterator>\n      void\n      insert(iterator __position,\n\t     _InputIterator __first, _InputIterator __last)\n      {\n\ttypedef typename std::__is_integer<_InputIterator>::__type _Integral;\n\t_M_insert_dispatch(__position, __first, __last, _Integral());\n      }\n\n    void\n    insert(iterator __position, size_type __n, const bool& __x)\n    { _M_fill_insert(__position, __n, __x); }\n\n    void\n    pop_back()\n    { --this->_M_impl._M_finish; }\n\n    iterator\n    erase(iterator __position)\n    {\n      if (__position + 1 != end())\n        std::copy(__position + 1, end(), __position);\n      --this->_M_impl._M_finish;\n      return __position;\n    }\n\n    iterator\n    erase(iterator __first, iterator __last)\n    {\n      _M_erase_at_end(std::copy(__last, end(), __first));\n      return __first;\n    }\n\n    void\n    resize(size_type __new_size, bool __x = bool())\n    {\n      if (__new_size < size())\n        _M_erase_at_end(begin() + difference_type(__new_size));\n      else\n        insert(end(), __new_size - size(), __x);\n    }\n\n    void\n    flip()\n    {\n      for (_Bit_type * __p = this->_M_impl._M_start._M_p;\n\t   __p != this->_M_impl._M_end_of_storage; ++__p)\n        *__p = ~*__p;\n    }\n\n    void\n    clear()\n    { _M_erase_at_end(begin()); }\n\n   \n  protected:\n    // Precondition: __first._M_offset == 0 && __result._M_offset == 0.\n    iterator\n    _M_copy_aligned(const_iterator __first, const_iterator __last,\n\t\t    iterator __result)\n    {\n      _Bit_type* __q = std::copy(__first._M_p, __last._M_p, __result._M_p);\n      return std::copy(const_iterator(__last._M_p, 0), __last,\n\t\t       iterator(__q, 0));\n    }\n\n    void\n    _M_initialize(size_type __n)\n    {\n      _Bit_type* __q = this->_M_allocate(__n);\n      this->_M_impl._M_end_of_storage = (__q\n\t\t\t\t\t + ((__n + int(_S_word_bit) - 1)\n\t\t\t\t\t    / int(_S_word_bit)));\n      this->_M_impl._M_start = iterator(__q, 0);\n      this->_M_impl._M_finish = this->_M_impl._M_start + difference_type(__n);\n    }\n\n    // Check whether it's an integral type.  If so, it's not an iterator.\n    template<class _Integer>\n      void\n      _M_initialize_dispatch(_Integer __n, _Integer __x, __true_type)\n      {\n\t_M_initialize(__n);\n\tstd::fill(this->_M_impl._M_start._M_p, \n\t\t  this->_M_impl._M_end_of_storage, __x ? ~0 : 0);\n      }\n\n    template<class _InputIterator>\n      void \n      _M_initialize_dispatch(_InputIterator __first, _InputIterator __last,\n\t\t\t     __false_type)\n      { _M_initialize_range(__first, __last, \n\t\t\t    std::__iterator_category(__first)); }\n\n    template<class _InputIterator>\n      void\n      _M_initialize_range(_InputIterator __first, _InputIterator __last,\n\t\t\t  std::input_iterator_tag)\n      {\n\tfor (; __first != __last; ++__first)\n\t  push_back(*__first);\n      }\n\n    template<class _ForwardIterator>\n      void\n      _M_initialize_range(_ForwardIterator __first, _ForwardIterator __last,\n\t\t\t  std::forward_iterator_tag)\n      {\n\tconst size_type __n = std::distance(__first, __last);\n\t_M_initialize(__n);\n\tstd::copy(__first, __last, this->_M_impl._M_start);\n      }\n\n    template<class _Integer>\n      void\n      _M_assign_dispatch(_Integer __n, _Integer __val, __true_type)\n      { _M_fill_assign((size_t) __n, (bool) __val); }\n\n    template<class _InputIterator>\n      void\n      _M_assign_dispatch(_InputIterator __first, _InputIterator __last,\n\t\t\t __false_type)\n      { _M_assign_aux(__first, __last, std::__iterator_category(__first)); }\n\n    void\n    _M_fill_assign(size_t __n, bool __x)\n    {\n      if (__n > size())\n\t{\n\t  std::fill(this->_M_impl._M_start._M_p, \n\t\t    this->_M_impl._M_end_of_storage, __x ? ~0 : 0);\n\t  insert(end(), __n - size(), __x);\n\t}\n      else\n\t{\n\t  _M_erase_at_end(begin() + __n);\n\t  std::fill(this->_M_impl._M_start._M_p, \n\t\t    this->_M_impl._M_end_of_storage, __x ? ~0 : 0);\n\t}\n    }\n\n    template<class _InputIterator>\n      void\n      _M_assign_aux(_InputIterator __first, _InputIterator __last,\n\t\t    std::input_iterator_tag)\n      {\n\titerator __cur = begin();\n\tfor (; __first != __last && __cur != end(); ++__cur, ++__first)\n\t  *__cur = *__first;\n\tif (__first == __last)\n\t  _M_erase_at_end(__cur);\n\telse\n\t  insert(end(), __first, __last);\n      }\n    \n    template<class _ForwardIterator>\n      void\n      _M_assign_aux(_ForwardIterator __first, _ForwardIterator __last,\n\t\t    std::forward_iterator_tag)\n      {\n\tconst size_type __len = std::distance(__first, __last);\n\tif (__len < size())\n\t  _M_erase_at_end(std::copy(__first, __last, begin()));\n\telse\n\t  {\n\t    _ForwardIterator __mid = __first;\n\t    std::advance(__mid, size());\n\t    std::copy(__first, __mid, begin());\n\t    insert(end(), __mid, __last);\n\t  }\n      }\n\n    // Check whether it's an integral type.  If so, it's not an iterator.\n    template<class _Integer>\n      void\n      _M_insert_dispatch(iterator __pos, _Integer __n, _Integer __x,\n\t\t\t __true_type)\n      { _M_fill_insert(__pos, __n, __x); }\n\n    template<class _InputIterator>\n      void\n      _M_insert_dispatch(iterator __pos,\n\t\t\t _InputIterator __first, _InputIterator __last,\n\t\t\t __false_type)\n      { _M_insert_range(__pos, __first, __last,\n\t\t\tstd::__iterator_category(__first)); }\n\n    void\n    _M_fill_insert(iterator __position, size_type __n, bool __x)\n    {\n      if (__n == 0)\n\treturn;\n      if (capacity() - size() >= __n)\n\t{\n\t  std::copy_backward(__position, end(),\n\t\t\t     this->_M_impl._M_finish + difference_type(__n));\n\t  std::fill(__position, __position + difference_type(__n), __x);\n\t  this->_M_impl._M_finish += difference_type(__n);\n\t}\n      else\n\t{\n\t  const size_type __len = size() + std::max(size(), __n);\n\t  _Bit_type * __q = this->_M_allocate(__len);\n\t  iterator __i = _M_copy_aligned(begin(), __position,\n\t\t\t\t\t iterator(__q, 0));\n\t  std::fill(__i, __i + difference_type(__n), __x);\n\t  this->_M_impl._M_finish = std::copy(__position, end(),\n\t\t\t\t\t      __i + difference_type(__n));\n\t  this->_M_deallocate();\n\t  this->_M_impl._M_end_of_storage = (__q + ((__len\n\t\t\t\t\t\t     + int(_S_word_bit) - 1)\n\t\t\t\t\t\t    / int(_S_word_bit)));\n\t  this->_M_impl._M_start = iterator(__q, 0);\n\t}\n    }\n\n    template<class _InputIterator>\n      void\n      _M_insert_range(iterator __pos, _InputIterator __first, \n\t\t      _InputIterator __last, std::input_iterator_tag)\n      {\n\tfor (; __first != __last; ++__first)\n\t  {\n\t    __pos = insert(__pos, *__first);\n\t    ++__pos;\n\t  }\n      }\n\n    template<class _ForwardIterator>\n      void\n      _M_insert_range(iterator __position, _ForwardIterator __first, \n\t\t      _ForwardIterator __last, std::forward_iterator_tag)\n      {\n\tif (__first != __last)\n\t  {\n\t    size_type __n = std::distance(__first, __last);\n\t    if (capacity() - size() >= __n)\n\t      {\n\t\tstd::copy_backward(__position, end(),\n\t\t\t\t   this->_M_impl._M_finish\n\t\t\t\t   + difference_type(__n));\n\t\tstd::copy(__first, __last, __position);\n\t\tthis->_M_impl._M_finish += difference_type(__n);\n\t      }\n\t    else\n\t      {\n\t\tconst size_type __len = size() + std::max(size(), __n);\n\t\t_Bit_type * __q = this->_M_allocate(__len);\n\t\titerator __i = _M_copy_aligned(begin(), __position,\n\t\t\t\t\t       iterator(__q, 0));\n\t\t__i = std::copy(__first, __last, __i);\n\t\tthis->_M_impl._M_finish = std::copy(__position, end(), __i);\n\t\tthis->_M_deallocate();\n\t\tthis->_M_impl._M_end_of_storage = (__q\n\t\t\t\t\t\t   + ((__len\n\t\t\t\t\t\t       + int(_S_word_bit) - 1)\n\t\t\t\t\t\t      / int(_S_word_bit)));\n\t\tthis->_M_impl._M_start = iterator(__q, 0);\n\t      }\n\t  }\n      }\n\n    void\n    _M_insert_aux(iterator __position, bool __x)\n    {\n      if (this->_M_impl._M_finish._M_p != this->_M_impl._M_end_of_storage)\n\t{\n\t  std::copy_backward(__position, this->_M_impl._M_finish, \n\t\t\t     this->_M_impl._M_finish + 1);\n\t  *__position = __x;\n\t  ++this->_M_impl._M_finish;\n\t}\n      else\n\t{\n\t  const size_type __len = size() ? 2 * size()\n\t                                 : static_cast<size_type>(_S_word_bit);\n\t  _Bit_type * __q = this->_M_allocate(__len);\n\t  iterator __i = _M_copy_aligned(begin(), __position,\n\t\t\t\t\t iterator(__q, 0));\n\t  *__i++ = __x;\n\t  this->_M_impl._M_finish = std::copy(__position, end(), __i);\n\t  this->_M_deallocate();\n\t  this->_M_impl._M_end_of_storage = (__q + ((__len\n\t\t\t\t\t\t     + int(_S_word_bit) - 1)\n\t\t\t\t\t\t    / int(_S_word_bit)));\n\t  this->_M_impl._M_start = iterator(__q, 0);\n\t}\n    }\n\n    void\n    _M_erase_at_end(iterator __pos)\n    { this->_M_impl._M_finish = __pos; }\n  };\n\n_GLIBCXX_END_NESTED_NAMESPACE\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/bits/stl_construct.h",
    "content": "// nonstandard construct and destroy functions -*- C++ -*-\n\n// Copyright (C) 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n/*\n *\n * Copyright (c) 1994\n * Hewlett-Packard Company\n *\n * Permission to use, copy, modify, distribute and sell this software\n * and its documentation for any purpose is hereby granted without fee,\n * provided that the above copyright notice appear in all copies and\n * that both that copyright notice and this permission notice appear\n * in supporting documentation.  Hewlett-Packard Company makes no\n * representations about the suitability of this software for any\n * purpose.  It is provided \"as is\" without express or implied warranty.\n *\n *\n * Copyright (c) 1996,1997\n * Silicon Graphics Computer Systems, Inc.\n *\n * Permission to use, copy, modify, distribute and sell this software\n * and its documentation for any purpose is hereby granted without fee,\n * provided that the above copyright notice appear in all copies and\n * that both that copyright notice and this permission notice appear\n * in supporting documentation.  Silicon Graphics makes no\n * representations about the suitability of this software for any\n * purpose.  It is provided \"as is\" without express or implied warranty.\n */\n\n/** @file stl_construct.h\n *  This is an internal header file, included by other library headers.\n *  You should not attempt to use it directly.\n */\n\n#ifndef _STL_CONSTRUCT_H\n#define _STL_CONSTRUCT_H 1\n\n#include <bits/cpp_type_traits.h>\n#include <new>\n\n_GLIBCXX_BEGIN_NAMESPACE(std)\n\n  /**\n   * @if maint\n   * Constructs an object in existing memory by invoking an allocated\n   * object's constructor with an initializer.\n   * @endif\n   */\n  template<typename _T1, typename _T2>\n    inline void\n    _Construct(_T1* __p, const _T2& __value)\n    {\n      // _GLIBCXX_RESOLVE_LIB_DEFECTS\n      // 402. wrong new expression in [some_]allocator::construct\n      ::new(static_cast<void*>(__p)) _T1(__value);\n    }\n\n  /**\n   * @if maint\n   * Constructs an object in existing memory by invoking an allocated\n   * object's default constructor (no initializers).\n   * @endif\n   */\n  template<typename _T1>\n    inline void\n    _Construct(_T1* __p)\n    {\n      // _GLIBCXX_RESOLVE_LIB_DEFECTS\n      // 402. wrong new expression in [some_]allocator::construct\n      ::new(static_cast<void*>(__p)) _T1();\n    }\n\n  /**\n   * @if maint\n   * Destroy the object pointed to by a pointer type.\n   * @endif\n   */\n  template<typename _Tp>\n    inline void\n    _Destroy(_Tp* __pointer)\n    { __pointer->~_Tp(); }\n\n  /**\n   * @if maint\n   * Destroy a range of objects with nontrivial destructors.\n   *\n   * This is a helper function used only by _Destroy().\n   * @endif\n   */\n  template<typename _ForwardIterator>\n    inline void\n    __destroy_aux(_ForwardIterator __first, _ForwardIterator __last,\n\t\t  __false_type)\n    {\n      for (; __first != __last; ++__first)\n\tstd::_Destroy(&*__first);\n    }\n\n  /**\n   * @if maint\n   * Destroy a range of objects with trivial destructors.  Since the destructors\n   * are trivial, there's nothing to do and hopefully this function will be\n   * entirely optimized away.\n   *\n   * This is a helper function used only by _Destroy().\n   * @endif\n   */\n  template<typename _ForwardIterator>\n    inline void\n    __destroy_aux(_ForwardIterator, _ForwardIterator, __true_type)\n    { }\n\n  /**\n   * @if maint\n   * Destroy a range of objects.  If the value_type of the object has\n   * a trivial destructor, the compiler should optimize all of this\n   * away, otherwise the objects' destructors must be invoked.\n   * @endif\n   */\n  template<typename _ForwardIterator>\n    inline void\n    _Destroy(_ForwardIterator __first, _ForwardIterator __last)\n    {\n      typedef typename iterator_traits<_ForwardIterator>::value_type\n                       _Value_type;\n      typedef typename std::__is_scalar<_Value_type>::__type\n\t               _Has_trivial_destructor;\n\n      std::__destroy_aux(__first, __last, _Has_trivial_destructor());\n    }\n\n  /**\n   * @if maint\n   * Destroy a range of objects using the supplied allocator.  For\n   * nondefault allocators we do not optimize away invocation of \n   * destroy() even if _Tp has a trivial destructor.\n   * @endif\n   */\n\n  template <typename _Tp> class allocator;\n\n  template<typename _ForwardIterator, typename _Allocator>\n    void\n    _Destroy(_ForwardIterator __first, _ForwardIterator __last,\n\t     _Allocator __alloc)\n    {\n      for (; __first != __last; ++__first)\n\t__alloc.destroy(&*__first);\n    }\n\n  template<typename _ForwardIterator, typename _Tp>\n    inline void\n    _Destroy(_ForwardIterator __first, _ForwardIterator __last,\n\t     allocator<_Tp>)\n    {\n      _Destroy(__first, __last);\n    }\n\n_GLIBCXX_END_NAMESPACE\n\n#endif /* _STL_CONSTRUCT_H */\n\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/bits/stl_deque.h",
    "content": "// Deque implementation -*- C++ -*-\n\n// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006\n// Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n/*\n *\n * Copyright (c) 1994\n * Hewlett-Packard Company\n *\n * Permission to use, copy, modify, distribute and sell this software\n * and its documentation for any purpose is hereby granted without fee,\n * provided that the above copyright notice appear in all copies and\n * that both that copyright notice and this permission notice appear\n * in supporting documentation.  Hewlett-Packard Company makes no\n * representations about the suitability of this software for any\n * purpose.  It is provided \"as is\" without express or implied warranty.\n *\n *\n * Copyright (c) 1997\n * Silicon Graphics Computer Systems, Inc.\n *\n * Permission to use, copy, modify, distribute and sell this software\n * and its documentation for any purpose is hereby granted without fee,\n * provided that the above copyright notice appear in all copies and\n * that both that copyright notice and this permission notice appear\n * in supporting documentation.  Silicon Graphics makes no\n * representations about the suitability of this software for any\n * purpose.  It is provided \"as is\" without express or implied warranty.\n */\n\n/** @file stl_deque.h\n *  This is an internal header file, included by other library headers.\n *  You should not attempt to use it directly.\n */\n\n#ifndef _DEQUE_H\n#define _DEQUE_H 1\n\n#include <bits/concept_check.h>\n#include <bits/stl_iterator_base_types.h>\n#include <bits/stl_iterator_base_funcs.h>\n\n_GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD)\n\n  /**\n   *  @if maint\n   *  @brief This function controls the size of memory nodes.\n   *  @param  size  The size of an element.\n   *  @return   The number (not byte size) of elements per node.\n   *\n   *  This function started off as a compiler kludge from SGI, but seems to\n   *  be a useful wrapper around a repeated constant expression.  The '512' is\n   *  tuneable (and no other code needs to change), but no investigation has\n   *  been done since inheriting the SGI code.\n   *  @endif\n  */\n  inline size_t\n  __deque_buf_size(size_t __size)\n  { return __size < 512 ? size_t(512 / __size) : size_t(1); }\n\n\n  /**\n   *  @brief A deque::iterator.\n   *\n   *  Quite a bit of intelligence here.  Much of the functionality of\n   *  deque is actually passed off to this class.  A deque holds two\n   *  of these internally, marking its valid range.  Access to\n   *  elements is done as offsets of either of those two, relying on\n   *  operator overloading in this class.\n   *\n   *  @if maint\n   *  All the functions are op overloads except for _M_set_node.\n   *  @endif\n  */\n  template<typename _Tp, typename _Ref, typename _Ptr>\n    struct _Deque_iterator\n    {\n      typedef _Deque_iterator<_Tp, _Tp&, _Tp*>             iterator;\n      typedef _Deque_iterator<_Tp, const _Tp&, const _Tp*> const_iterator;\n\n      static size_t _S_buffer_size()\n      { return __deque_buf_size(sizeof(_Tp)); }\n\n      typedef std::random_access_iterator_tag iterator_category;\n      typedef _Tp                             value_type;\n      typedef _Ptr                            pointer;\n      typedef _Ref                            reference;\n      typedef size_t                          size_type;\n      typedef ptrdiff_t                       difference_type;\n      typedef _Tp**                           _Map_pointer;\n      typedef _Deque_iterator                 _Self;\n\n      _Tp* _M_cur;\n      _Tp* _M_first;\n      _Tp* _M_last;\n      _Map_pointer _M_node;\n\n      _Deque_iterator(_Tp* __x, _Map_pointer __y)\n      : _M_cur(__x), _M_first(*__y),\n        _M_last(*__y + _S_buffer_size()), _M_node(__y) {}\n\n      _Deque_iterator() : _M_cur(0), _M_first(0), _M_last(0), _M_node(0) {}\n\n      _Deque_iterator(const iterator& __x)\n      : _M_cur(__x._M_cur), _M_first(__x._M_first),\n        _M_last(__x._M_last), _M_node(__x._M_node) {}\n\n      reference\n      operator*() const\n      { return *_M_cur; }\n\n      pointer\n      operator->() const\n      { return _M_cur; }\n\n      _Self&\n      operator++()\n      {\n\t++_M_cur;\n\tif (_M_cur == _M_last)\n\t  {\n\t    _M_set_node(_M_node + 1);\n\t    _M_cur = _M_first;\n\t  }\n\treturn *this;\n      }\n\n      _Self\n      operator++(int)\n      {\n\t_Self __tmp = *this;\n\t++*this;\n\treturn __tmp;\n      }\n\n      _Self&\n      operator--()\n      {\n\tif (_M_cur == _M_first)\n\t  {\n\t    _M_set_node(_M_node - 1);\n\t    _M_cur = _M_last;\n\t  }\n\t--_M_cur;\n\treturn *this;\n      }\n\n      _Self\n      operator--(int)\n      {\n\t_Self __tmp = *this;\n\t--*this;\n\treturn __tmp;\n      }\n\n      _Self&\n      operator+=(difference_type __n)\n      {\n\tconst difference_type __offset = __n + (_M_cur - _M_first);\n\tif (__offset >= 0 && __offset < difference_type(_S_buffer_size()))\n\t  _M_cur += __n;\n\telse\n\t  {\n\t    const difference_type __node_offset =\n\t      __offset > 0 ? __offset / difference_type(_S_buffer_size())\n\t                   : -difference_type((-__offset - 1)\n\t\t\t\t\t      / _S_buffer_size()) - 1;\n\t    _M_set_node(_M_node + __node_offset);\n\t    _M_cur = _M_first + (__offset - __node_offset\n\t\t\t\t * difference_type(_S_buffer_size()));\n\t  }\n\treturn *this;\n      }\n\n      _Self\n      operator+(difference_type __n) const\n      {\n\t_Self __tmp = *this;\n\treturn __tmp += __n;\n      }\n\n      _Self&\n      operator-=(difference_type __n)\n      { return *this += -__n; }\n\n      _Self\n      operator-(difference_type __n) const\n      {\n\t_Self __tmp = *this;\n\treturn __tmp -= __n;\n      }\n\n      reference\n      operator[](difference_type __n) const\n      { return *(*this + __n); }\n\n      /** @if maint\n       *  Prepares to traverse new_node.  Sets everything except\n       *  _M_cur, which should therefore be set by the caller\n       *  immediately afterwards, based on _M_first and _M_last.\n       *  @endif\n       */\n      void\n      _M_set_node(_Map_pointer __new_node)\n      {\n\t_M_node = __new_node;\n\t_M_first = *__new_node;\n\t_M_last = _M_first + difference_type(_S_buffer_size());\n      }\n    };\n\n  // Note: we also provide overloads whose operands are of the same type in\n  // order to avoid ambiguous overload resolution when std::rel_ops operators\n  // are in scope (for additional details, see libstdc++/3628)\n  template<typename _Tp, typename _Ref, typename _Ptr>\n    inline bool\n    operator==(const _Deque_iterator<_Tp, _Ref, _Ptr>& __x,\n\t       const _Deque_iterator<_Tp, _Ref, _Ptr>& __y)\n    { return __x._M_cur == __y._M_cur; }\n\n  template<typename _Tp, typename _RefL, typename _PtrL,\n\t   typename _RefR, typename _PtrR>\n    inline bool\n    operator==(const _Deque_iterator<_Tp, _RefL, _PtrL>& __x,\n\t       const _Deque_iterator<_Tp, _RefR, _PtrR>& __y)\n    { return __x._M_cur == __y._M_cur; }\n\n  template<typename _Tp, typename _Ref, typename _Ptr>\n    inline bool\n    operator!=(const _Deque_iterator<_Tp, _Ref, _Ptr>& __x,\n\t       const _Deque_iterator<_Tp, _Ref, _Ptr>& __y)\n    { return !(__x == __y); }\n\n  template<typename _Tp, typename _RefL, typename _PtrL,\n\t   typename _RefR, typename _PtrR>\n    inline bool\n    operator!=(const _Deque_iterator<_Tp, _RefL, _PtrL>& __x,\n\t       const _Deque_iterator<_Tp, _RefR, _PtrR>& __y)\n    { return !(__x == __y); }\n\n  template<typename _Tp, typename _Ref, typename _Ptr>\n    inline bool\n    operator<(const _Deque_iterator<_Tp, _Ref, _Ptr>& __x,\n\t      const _Deque_iterator<_Tp, _Ref, _Ptr>& __y)\n    { return (__x._M_node == __y._M_node) ? (__x._M_cur < __y._M_cur)\n                                          : (__x._M_node < __y._M_node); }\n\n  template<typename _Tp, typename _RefL, typename _PtrL,\n\t   typename _RefR, typename _PtrR>\n    inline bool\n    operator<(const _Deque_iterator<_Tp, _RefL, _PtrL>& __x,\n\t      const _Deque_iterator<_Tp, _RefR, _PtrR>& __y)\n    { return (__x._M_node == __y._M_node) ? (__x._M_cur < __y._M_cur)\n\t                                  : (__x._M_node < __y._M_node); }\n\n  template<typename _Tp, typename _Ref, typename _Ptr>\n    inline bool\n    operator>(const _Deque_iterator<_Tp, _Ref, _Ptr>& __x,\n\t      const _Deque_iterator<_Tp, _Ref, _Ptr>& __y)\n    { return __y < __x; }\n\n  template<typename _Tp, typename _RefL, typename _PtrL,\n\t   typename _RefR, typename _PtrR>\n    inline bool\n    operator>(const _Deque_iterator<_Tp, _RefL, _PtrL>& __x,\n\t      const _Deque_iterator<_Tp, _RefR, _PtrR>& __y)\n    { return __y < __x; }\n\n  template<typename _Tp, typename _Ref, typename _Ptr>\n    inline bool\n    operator<=(const _Deque_iterator<_Tp, _Ref, _Ptr>& __x,\n\t       const _Deque_iterator<_Tp, _Ref, _Ptr>& __y)\n    { return !(__y < __x); }\n\n  template<typename _Tp, typename _RefL, typename _PtrL,\n\t   typename _RefR, typename _PtrR>\n    inline bool\n    operator<=(const _Deque_iterator<_Tp, _RefL, _PtrL>& __x,\n\t       const _Deque_iterator<_Tp, _RefR, _PtrR>& __y)\n    { return !(__y < __x); }\n\n  template<typename _Tp, typename _Ref, typename _Ptr>\n    inline bool\n    operator>=(const _Deque_iterator<_Tp, _Ref, _Ptr>& __x,\n\t       const _Deque_iterator<_Tp, _Ref, _Ptr>& __y)\n    { return !(__x < __y); }\n\n  template<typename _Tp, typename _RefL, typename _PtrL,\n\t   typename _RefR, typename _PtrR>\n    inline bool\n    operator>=(const _Deque_iterator<_Tp, _RefL, _PtrL>& __x,\n\t       const _Deque_iterator<_Tp, _RefR, _PtrR>& __y)\n    { return !(__x < __y); }\n\n  // _GLIBCXX_RESOLVE_LIB_DEFECTS\n  // According to the resolution of DR179 not only the various comparison\n  // operators but also operator- must accept mixed iterator/const_iterator\n  // parameters.\n  template<typename _Tp, typename _Ref, typename _Ptr>\n    inline typename _Deque_iterator<_Tp, _Ref, _Ptr>::difference_type\n    operator-(const _Deque_iterator<_Tp, _Ref, _Ptr>& __x,\n\t      const _Deque_iterator<_Tp, _Ref, _Ptr>& __y)\n    {\n      return typename _Deque_iterator<_Tp, _Ref, _Ptr>::difference_type\n\t(_Deque_iterator<_Tp, _Ref, _Ptr>::_S_buffer_size())\n\t* (__x._M_node - __y._M_node - 1) + (__x._M_cur - __x._M_first)\n\t+ (__y._M_last - __y._M_cur);\n    }\n\n  template<typename _Tp, typename _RefL, typename _PtrL,\n\t   typename _RefR, typename _PtrR>\n    inline typename _Deque_iterator<_Tp, _RefL, _PtrL>::difference_type\n    operator-(const _Deque_iterator<_Tp, _RefL, _PtrL>& __x,\n\t      const _Deque_iterator<_Tp, _RefR, _PtrR>& __y)\n    {\n      return typename _Deque_iterator<_Tp, _RefL, _PtrL>::difference_type\n\t(_Deque_iterator<_Tp, _RefL, _PtrL>::_S_buffer_size())\n\t* (__x._M_node - __y._M_node - 1) + (__x._M_cur - __x._M_first)\n\t+ (__y._M_last - __y._M_cur);\n    }\n\n  template<typename _Tp, typename _Ref, typename _Ptr>\n    inline _Deque_iterator<_Tp, _Ref, _Ptr>\n    operator+(ptrdiff_t __n, const _Deque_iterator<_Tp, _Ref, _Ptr>& __x)\n    { return __x + __n; }\n\n  template<typename _Tp>\n    void\n    fill(const _Deque_iterator<_Tp, _Tp&, _Tp*>& __first,\n\t const _Deque_iterator<_Tp, _Tp&, _Tp*>& __last, const _Tp& __value);\n\n  /**\n   *  @if maint\n   *  Deque base class.  This class provides the unified face for %deque's\n   *  allocation.  This class's constructor and destructor allocate and\n   *  deallocate (but do not initialize) storage.  This makes %exception\n   *  safety easier.\n   *\n   *  Nothing in this class ever constructs or destroys an actual Tp element.\n   *  (Deque handles that itself.)  Only/All memory management is performed\n   *  here.\n   *  @endif\n  */\n  template<typename _Tp, typename _Alloc>\n    class _Deque_base\n    {\n    public:\n      typedef _Alloc                  allocator_type;\n\n      allocator_type\n      get_allocator() const\n      { return allocator_type(_M_get_Tp_allocator()); }\n\n      typedef _Deque_iterator<_Tp, _Tp&, _Tp*>             iterator;\n      typedef _Deque_iterator<_Tp, const _Tp&, const _Tp*> const_iterator;\n\n      _Deque_base(const allocator_type& __a, size_t __num_elements)\n      : _M_impl(__a)\n      { _M_initialize_map(__num_elements); }\n\n      _Deque_base(const allocator_type& __a)\n      : _M_impl(__a)\n      { }\n\n      ~_Deque_base();\n\n    protected:\n      //This struct encapsulates the implementation of the std::deque\n      //standard container and at the same time makes use of the EBO\n      //for empty allocators.\n      typedef typename _Alloc::template rebind<_Tp*>::other _Map_alloc_type;\n\n      typedef typename _Alloc::template rebind<_Tp>::other  _Tp_alloc_type;\n\n      struct _Deque_impl\n      : public _Tp_alloc_type\n      {\n\t_Tp** _M_map;\n\tsize_t _M_map_size;\n\titerator _M_start;\n\titerator _M_finish;\n\n\t_Deque_impl(const _Tp_alloc_type& __a)\n\t: _Tp_alloc_type(__a), _M_map(0), _M_map_size(0),\n\t  _M_start(), _M_finish()\n\t{ }\n      };\n\n      _Tp_alloc_type&\n      _M_get_Tp_allocator()\n      { return *static_cast<_Tp_alloc_type*>(&this->_M_impl); }\n\n      const _Tp_alloc_type&\n      _M_get_Tp_allocator() const\n      { return *static_cast<const _Tp_alloc_type*>(&this->_M_impl); }\n\n      _Map_alloc_type\n      _M_get_map_allocator() const\n      { return _Map_alloc_type(_M_get_Tp_allocator()); }\n\n      _Tp*\n      _M_allocate_node()\n      { \n\treturn _M_impl._Tp_alloc_type::allocate(__deque_buf_size(sizeof(_Tp)));\n      }\n\n      void\n      _M_deallocate_node(_Tp* __p)\n      {\n\t_M_impl._Tp_alloc_type::deallocate(__p, __deque_buf_size(sizeof(_Tp)));\n      }\n\n      _Tp**\n      _M_allocate_map(size_t __n)\n      { return _M_get_map_allocator().allocate(__n); }\n\n      void\n      _M_deallocate_map(_Tp** __p, size_t __n)\n      { _M_get_map_allocator().deallocate(__p, __n); }\n\n    protected:\n      void _M_initialize_map(size_t);\n      void _M_create_nodes(_Tp** __nstart, _Tp** __nfinish);\n      void _M_destroy_nodes(_Tp** __nstart, _Tp** __nfinish);\n      enum { _S_initial_map_size = 8 };\n\n      _Deque_impl _M_impl;\n    };\n\n  template<typename _Tp, typename _Alloc>\n    _Deque_base<_Tp, _Alloc>::\n    ~_Deque_base()\n    {\n      if (this->_M_impl._M_map)\n\t{\n\t  _M_destroy_nodes(this->_M_impl._M_start._M_node,\n\t\t\t   this->_M_impl._M_finish._M_node + 1);\n\t  _M_deallocate_map(this->_M_impl._M_map, this->_M_impl._M_map_size);\n\t}\n    }\n\n  /**\n   *  @if maint\n   *  @brief Layout storage.\n   *  @param  num_elements  The count of T's for which to allocate space\n   *                        at first.\n   *  @return   Nothing.\n   *\n   *  The initial underlying memory layout is a bit complicated...\n   *  @endif\n  */\n  template<typename _Tp, typename _Alloc>\n    void\n    _Deque_base<_Tp, _Alloc>::\n    _M_initialize_map(size_t __num_elements)\n    {\n      const size_t __num_nodes = (__num_elements/ __deque_buf_size(sizeof(_Tp))\n\t\t\t\t  + 1);\n\n      this->_M_impl._M_map_size = std::max((size_t) _S_initial_map_size,\n\t\t\t\t\t   size_t(__num_nodes + 2));\n      this->_M_impl._M_map = _M_allocate_map(this->_M_impl._M_map_size);\n\n      // For \"small\" maps (needing less than _M_map_size nodes), allocation\n      // starts in the middle elements and grows outwards.  So nstart may be\n      // the beginning of _M_map, but for small maps it may be as far in as\n      // _M_map+3.\n\n      _Tp** __nstart = (this->_M_impl._M_map\n\t\t\t+ (this->_M_impl._M_map_size - __num_nodes) / 2);\n      _Tp** __nfinish = __nstart + __num_nodes;\n\n      try\n\t{ _M_create_nodes(__nstart, __nfinish); }\n      catch(...)\n\t{\n\t  _M_deallocate_map(this->_M_impl._M_map, this->_M_impl._M_map_size);\n\t  this->_M_impl._M_map = 0;\n\t  this->_M_impl._M_map_size = 0;\n\t  __throw_exception_again;\n\t}\n\n      this->_M_impl._M_start._M_set_node(__nstart);\n      this->_M_impl._M_finish._M_set_node(__nfinish - 1);\n      this->_M_impl._M_start._M_cur = _M_impl._M_start._M_first;\n      this->_M_impl._M_finish._M_cur = (this->_M_impl._M_finish._M_first\n\t\t\t\t\t+ __num_elements\n\t\t\t\t\t% __deque_buf_size(sizeof(_Tp)));\n    }\n\n  template<typename _Tp, typename _Alloc>\n    void\n    _Deque_base<_Tp, _Alloc>::\n    _M_create_nodes(_Tp** __nstart, _Tp** __nfinish)\n    {\n      _Tp** __cur;\n      try\n\t{\n\t  for (__cur = __nstart; __cur < __nfinish; ++__cur)\n\t    *__cur = this->_M_allocate_node();\n\t}\n      catch(...)\n\t{\n\t  _M_destroy_nodes(__nstart, __cur);\n\t  __throw_exception_again;\n\t}\n    }\n\n  template<typename _Tp, typename _Alloc>\n    void\n    _Deque_base<_Tp, _Alloc>::\n    _M_destroy_nodes(_Tp** __nstart, _Tp** __nfinish)\n    {\n      for (_Tp** __n = __nstart; __n < __nfinish; ++__n)\n\t_M_deallocate_node(*__n);\n    }\n\n  /**\n   *  @brief  A standard container using fixed-size memory allocation and\n   *  constant-time manipulation of elements at either end.\n   *\n   *  @ingroup Containers\n   *  @ingroup Sequences\n   *\n   *  Meets the requirements of a <a href=\"tables.html#65\">container</a>, a\n   *  <a href=\"tables.html#66\">reversible container</a>, and a\n   *  <a href=\"tables.html#67\">sequence</a>, including the\n   *  <a href=\"tables.html#68\">optional sequence requirements</a>.\n   *\n   *  In previous HP/SGI versions of deque, there was an extra template\n   *  parameter so users could control the node size.  This extension turned\n   *  out to violate the C++ standard (it can be detected using template\n   *  template parameters), and it was removed.\n   *\n   *  @if maint\n   *  Here's how a deque<Tp> manages memory.  Each deque has 4 members:\n   *\n   *  - Tp**        _M_map\n   *  - size_t      _M_map_size\n   *  - iterator    _M_start, _M_finish\n   *\n   *  map_size is at least 8.  %map is an array of map_size\n   *  pointers-to-\"nodes\".  (The name %map has nothing to do with the\n   *  std::map class, and \"nodes\" should not be confused with\n   *  std::list's usage of \"node\".)\n   *\n   *  A \"node\" has no specific type name as such, but it is referred\n   *  to as \"node\" in this file.  It is a simple array-of-Tp.  If Tp\n   *  is very large, there will be one Tp element per node (i.e., an\n   *  \"array\" of one).  For non-huge Tp's, node size is inversely\n   *  related to Tp size: the larger the Tp, the fewer Tp's will fit\n   *  in a node.  The goal here is to keep the total size of a node\n   *  relatively small and constant over different Tp's, to improve\n   *  allocator efficiency.\n   *\n   *  Not every pointer in the %map array will point to a node.  If\n   *  the initial number of elements in the deque is small, the\n   *  /middle/ %map pointers will be valid, and the ones at the edges\n   *  will be unused.  This same situation will arise as the %map\n   *  grows: available %map pointers, if any, will be on the ends.  As\n   *  new nodes are created, only a subset of the %map's pointers need\n   *  to be copied \"outward\".\n   *\n   *  Class invariants:\n   * - For any nonsingular iterator i:\n   *    - i.node points to a member of the %map array.  (Yes, you read that\n   *      correctly:  i.node does not actually point to a node.)  The member of\n   *      the %map array is what actually points to the node.\n   *    - i.first == *(i.node)    (This points to the node (first Tp element).)\n   *    - i.last  == i.first + node_size\n   *    - i.cur is a pointer in the range [i.first, i.last).  NOTE:\n   *      the implication of this is that i.cur is always a dereferenceable\n   *      pointer, even if i is a past-the-end iterator.\n   * - Start and Finish are always nonsingular iterators.  NOTE: this\n   * means that an empty deque must have one node, a deque with <N\n   * elements (where N is the node buffer size) must have one node, a\n   * deque with N through (2N-1) elements must have two nodes, etc.\n   * - For every node other than start.node and finish.node, every\n   * element in the node is an initialized object.  If start.node ==\n   * finish.node, then [start.cur, finish.cur) are initialized\n   * objects, and the elements outside that range are uninitialized\n   * storage.  Otherwise, [start.cur, start.last) and [finish.first,\n   * finish.cur) are initialized objects, and [start.first, start.cur)\n   * and [finish.cur, finish.last) are uninitialized storage.\n   * - [%map, %map + map_size) is a valid, non-empty range.\n   * - [start.node, finish.node] is a valid range contained within\n   *   [%map, %map + map_size).\n   * - A pointer in the range [%map, %map + map_size) points to an allocated\n   *   node if and only if the pointer is in the range\n   *   [start.node, finish.node].\n   *\n   *  Here's the magic:  nothing in deque is \"aware\" of the discontiguous\n   *  storage!\n   *\n   *  The memory setup and layout occurs in the parent, _Base, and the iterator\n   *  class is entirely responsible for \"leaping\" from one node to the next.\n   *  All the implementation routines for deque itself work only through the\n   *  start and finish iterators.  This keeps the routines simple and sane,\n   *  and we can use other standard algorithms as well.\n   *  @endif\n  */\n  template<typename _Tp, typename _Alloc = std::allocator<_Tp> >\n    class deque : protected _Deque_base<_Tp, _Alloc>\n    {\n      // concept requirements\n      typedef typename _Alloc::value_type        _Alloc_value_type;\n      __glibcxx_class_requires(_Tp, _SGIAssignableConcept)\n      __glibcxx_class_requires2(_Tp, _Alloc_value_type, _SameTypeConcept)\n\n      typedef _Deque_base<_Tp, _Alloc>           _Base;\n      typedef typename _Base::_Tp_alloc_type\t _Tp_alloc_type;\n\n    public:\n      typedef _Tp                                        value_type;\n      typedef typename _Tp_alloc_type::pointer           pointer;\n      typedef typename _Tp_alloc_type::const_pointer     const_pointer;\n      typedef typename _Tp_alloc_type::reference         reference;\n      typedef typename _Tp_alloc_type::const_reference   const_reference;\n      typedef typename _Base::iterator                   iterator;\n      typedef typename _Base::const_iterator             const_iterator;\n      typedef std::reverse_iterator<const_iterator>      const_reverse_iterator;\n      typedef std::reverse_iterator<iterator>            reverse_iterator;\n      typedef size_t                             size_type;\n      typedef ptrdiff_t                          difference_type;\n      typedef _Alloc                             allocator_type;\n\n    protected:\n      typedef pointer*                           _Map_pointer;\n\n      static size_t _S_buffer_size()\n      { return __deque_buf_size(sizeof(_Tp)); }\n\n      // Functions controlling memory layout, and nothing else.\n      using _Base::_M_initialize_map;\n      using _Base::_M_create_nodes;\n      using _Base::_M_destroy_nodes;\n      using _Base::_M_allocate_node;\n      using _Base::_M_deallocate_node;\n      using _Base::_M_allocate_map;\n      using _Base::_M_deallocate_map;\n      using _Base::_M_get_Tp_allocator;\n\n      /** @if maint\n       *  A total of four data members accumulated down the heirarchy.\n       *  May be accessed via _M_impl.*\n       *  @endif\n       */\n      using _Base::_M_impl;\n\n    public:\n      // [23.2.1.1] construct/copy/destroy\n      // (assign() and get_allocator() are also listed in this section)\n      /**\n       *  @brief  Default constructor creates no elements.\n       */\n      explicit\n      deque(const allocator_type& __a = allocator_type())\n      : _Base(__a, 0) {}\n\n      /**\n       *  @brief  Create a %deque with copies of an exemplar element.\n       *  @param  n  The number of elements to initially create.\n       *  @param  value  An element to copy.\n       *\n       *  This constructor fills the %deque with @a n copies of @a value.\n       */\n      explicit\n      deque(size_type __n, const value_type& __value = value_type(),\n\t    const allocator_type& __a = allocator_type())\n      : _Base(__a, __n)\n      { _M_fill_initialize(__value); }\n\n      /**\n       *  @brief  %Deque copy constructor.\n       *  @param  x  A %deque of identical element and allocator types.\n       *\n       *  The newly-created %deque uses a copy of the allocation object used\n       *  by @a x.\n       */\n      deque(const deque& __x)\n      : _Base(__x._M_get_Tp_allocator(), __x.size())\n      { std::__uninitialized_copy_a(__x.begin(), __x.end(), \n\t\t\t\t    this->_M_impl._M_start,\n\t\t\t\t    _M_get_Tp_allocator()); }\n\n      /**\n       *  @brief  Builds a %deque from a range.\n       *  @param  first  An input iterator.\n       *  @param  last  An input iterator.\n       *\n       *  Create a %deque consisting of copies of the elements from [first,\n       *  last).\n       *\n       *  If the iterators are forward, bidirectional, or random-access, then\n       *  this will call the elements' copy constructor N times (where N is\n       *  distance(first,last)) and do no memory reallocation.  But if only\n       *  input iterators are used, then this will do at most 2N calls to the\n       *  copy constructor, and logN memory reallocations.\n       */\n      template<typename _InputIterator>\n        deque(_InputIterator __first, _InputIterator __last,\n\t      const allocator_type& __a = allocator_type())\n\t: _Base(__a)\n        {\n\t  // Check whether it's an integral type.  If so, it's not an iterator.\n\t  typedef typename std::__is_integer<_InputIterator>::__type _Integral;\n\t  _M_initialize_dispatch(__first, __last, _Integral());\n\t}\n\n      /**\n       *  The dtor only erases the elements, and note that if the elements\n       *  themselves are pointers, the pointed-to memory is not touched in any\n       *  way.  Managing the pointer is the user's responsibilty.\n       */\n      ~deque()\n      { _M_destroy_data(begin(), end(), _M_get_Tp_allocator()); }\n\n      /**\n       *  @brief  %Deque assignment operator.\n       *  @param  x  A %deque of identical element and allocator types.\n       *\n       *  All the elements of @a x are copied, but unlike the copy constructor,\n       *  the allocator object is not copied.\n       */\n      deque&\n      operator=(const deque& __x);\n\n      /**\n       *  @brief  Assigns a given value to a %deque.\n       *  @param  n  Number of elements to be assigned.\n       *  @param  val  Value to be assigned.\n       *\n       *  This function fills a %deque with @a n copies of the given\n       *  value.  Note that the assignment completely changes the\n       *  %deque and that the resulting %deque's size is the same as\n       *  the number of elements assigned.  Old data may be lost.\n       */\n      void\n      assign(size_type __n, const value_type& __val)\n      { _M_fill_assign(__n, __val); }\n\n      /**\n       *  @brief  Assigns a range to a %deque.\n       *  @param  first  An input iterator.\n       *  @param  last   An input iterator.\n       *\n       *  This function fills a %deque with copies of the elements in the\n       *  range [first,last).\n       *\n       *  Note that the assignment completely changes the %deque and that the\n       *  resulting %deque's size is the same as the number of elements\n       *  assigned.  Old data may be lost.\n       */\n      template<typename _InputIterator>\n        void\n        assign(_InputIterator __first, _InputIterator __last)\n        {\n\t  typedef typename std::__is_integer<_InputIterator>::__type _Integral;\n\t  _M_assign_dispatch(__first, __last, _Integral());\n\t}\n\n      /// Get a copy of the memory allocation object.\n      allocator_type\n      get_allocator() const\n      { return _Base::get_allocator(); }\n\n      // iterators\n      /**\n       *  Returns a read/write iterator that points to the first element in the\n       *  %deque.  Iteration is done in ordinary element order.\n       */\n      iterator\n      begin()\n      { return this->_M_impl._M_start; }\n\n      /**\n       *  Returns a read-only (constant) iterator that points to the first\n       *  element in the %deque.  Iteration is done in ordinary element order.\n       */\n      const_iterator\n      begin() const\n      { return this->_M_impl._M_start; }\n\n      /**\n       *  Returns a read/write iterator that points one past the last\n       *  element in the %deque.  Iteration is done in ordinary\n       *  element order.\n       */\n      iterator\n      end()\n      { return this->_M_impl._M_finish; }\n\n      /**\n       *  Returns a read-only (constant) iterator that points one past\n       *  the last element in the %deque.  Iteration is done in\n       *  ordinary element order.\n       */\n      const_iterator\n      end() const\n      { return this->_M_impl._M_finish; }\n\n      /**\n       *  Returns a read/write reverse iterator that points to the\n       *  last element in the %deque.  Iteration is done in reverse\n       *  element order.\n       */\n      reverse_iterator\n      rbegin()\n      { return reverse_iterator(this->_M_impl._M_finish); }\n\n      /**\n       *  Returns a read-only (constant) reverse iterator that points\n       *  to the last element in the %deque.  Iteration is done in\n       *  reverse element order.\n       */\n      const_reverse_iterator\n      rbegin() const\n      { return const_reverse_iterator(this->_M_impl._M_finish); }\n\n      /**\n       *  Returns a read/write reverse iterator that points to one\n       *  before the first element in the %deque.  Iteration is done\n       *  in reverse element order.\n       */\n      reverse_iterator\n      rend()\n      { return reverse_iterator(this->_M_impl._M_start); }\n\n      /**\n       *  Returns a read-only (constant) reverse iterator that points\n       *  to one before the first element in the %deque.  Iteration is\n       *  done in reverse element order.\n       */\n      const_reverse_iterator\n      rend() const\n      { return const_reverse_iterator(this->_M_impl._M_start); }\n\n      // [23.2.1.2] capacity\n      /**  Returns the number of elements in the %deque.  */\n      size_type\n      size() const\n      { return this->_M_impl._M_finish - this->_M_impl._M_start; }\n\n      /**  Returns the size() of the largest possible %deque.  */\n      size_type\n      max_size() const\n      { return _M_get_Tp_allocator().max_size(); }\n\n      /**\n       *  @brief  Resizes the %deque to the specified number of elements.\n       *  @param  new_size  Number of elements the %deque should contain.\n       *  @param  x  Data with which new elements should be populated.\n       *\n       *  This function will %resize the %deque to the specified\n       *  number of elements.  If the number is smaller than the\n       *  %deque's current size the %deque is truncated, otherwise the\n       *  %deque is extended and new elements are populated with given\n       *  data.\n       */\n      void\n      resize(size_type __new_size, value_type __x = value_type())\n      {\n\tconst size_type __len = size();\n\tif (__new_size < __len)\n\t  _M_erase_at_end(this->_M_impl._M_start + difference_type(__new_size));\n\telse\n\t  insert(this->_M_impl._M_finish, __new_size - __len, __x);\n      }\n\n      /**\n       *  Returns true if the %deque is empty.  (Thus begin() would\n       *  equal end().)\n       */\n      bool\n      empty() const\n      { return this->_M_impl._M_finish == this->_M_impl._M_start; }\n\n      // element access\n      /**\n       *  @brief Subscript access to the data contained in the %deque.\n       *  @param n The index of the element for which data should be\n       *  accessed.\n       *  @return  Read/write reference to data.\n       *\n       *  This operator allows for easy, array-style, data access.\n       *  Note that data access with this operator is unchecked and\n       *  out_of_range lookups are not defined. (For checked lookups\n       *  see at().)\n       */\n      reference\n      operator[](size_type __n)\n      { return this->_M_impl._M_start[difference_type(__n)]; }\n\n      /**\n       *  @brief Subscript access to the data contained in the %deque.\n       *  @param n The index of the element for which data should be\n       *  accessed.\n       *  @return  Read-only (constant) reference to data.\n       *\n       *  This operator allows for easy, array-style, data access.\n       *  Note that data access with this operator is unchecked and\n       *  out_of_range lookups are not defined. (For checked lookups\n       *  see at().)\n       */\n      const_reference\n      operator[](size_type __n) const\n      { return this->_M_impl._M_start[difference_type(__n)]; }\n\n    protected:\n      /// @if maint Safety check used only from at().  @endif\n      void\n      _M_range_check(size_type __n) const\n      {\n\tif (__n >= this->size())\n\t  __throw_out_of_range(__N(\"deque::_M_range_check\"));\n      }\n\n    public:\n      /**\n       *  @brief  Provides access to the data contained in the %deque.\n       *  @param n The index of the element for which data should be\n       *  accessed.\n       *  @return  Read/write reference to data.\n       *  @throw  std::out_of_range  If @a n is an invalid index.\n       *\n       *  This function provides for safer data access.  The parameter\n       *  is first checked that it is in the range of the deque.  The\n       *  function throws out_of_range if the check fails.\n       */\n      reference\n      at(size_type __n)\n      {\n\t_M_range_check(__n);\n\treturn (*this)[__n];\n      }\n\n      /**\n       *  @brief  Provides access to the data contained in the %deque.\n       *  @param n The index of the element for which data should be\n       *  accessed.\n       *  @return  Read-only (constant) reference to data.\n       *  @throw  std::out_of_range  If @a n is an invalid index.\n       *\n       *  This function provides for safer data access.  The parameter is first\n       *  checked that it is in the range of the deque.  The function throws\n       *  out_of_range if the check fails.\n       */\n      const_reference\n      at(size_type __n) const\n      {\n\t_M_range_check(__n);\n\treturn (*this)[__n];\n      }\n\n      /**\n       *  Returns a read/write reference to the data at the first\n       *  element of the %deque.\n       */\n      reference\n      front()\n      { return *begin(); }\n\n      /**\n       *  Returns a read-only (constant) reference to the data at the first\n       *  element of the %deque.\n       */\n      const_reference\n      front() const\n      { return *begin(); }\n\n      /**\n       *  Returns a read/write reference to the data at the last element of the\n       *  %deque.\n       */\n      reference\n      back()\n      {\n\titerator __tmp = end();\n\t--__tmp;\n\treturn *__tmp;\n      }\n\n      /**\n       *  Returns a read-only (constant) reference to the data at the last\n       *  element of the %deque.\n       */\n      const_reference\n      back() const\n      {\n\tconst_iterator __tmp = end();\n\t--__tmp;\n\treturn *__tmp;\n      }\n\n      // [23.2.1.2] modifiers\n      /**\n       *  @brief  Add data to the front of the %deque.\n       *  @param  x  Data to be added.\n       *\n       *  This is a typical stack operation.  The function creates an\n       *  element at the front of the %deque and assigns the given\n       *  data to it.  Due to the nature of a %deque this operation\n       *  can be done in constant time.\n       */\n      void\n      push_front(const value_type& __x)\n      {\n\tif (this->_M_impl._M_start._M_cur != this->_M_impl._M_start._M_first)\n\t  {\n\t    this->_M_impl.construct(this->_M_impl._M_start._M_cur - 1, __x);\n\t    --this->_M_impl._M_start._M_cur;\n\t  }\n\telse\n\t  _M_push_front_aux(__x);\n      }\n\n      /**\n       *  @brief  Add data to the end of the %deque.\n       *  @param  x  Data to be added.\n       *\n       *  This is a typical stack operation.  The function creates an\n       *  element at the end of the %deque and assigns the given data\n       *  to it.  Due to the nature of a %deque this operation can be\n       *  done in constant time.\n       */\n      void\n      push_back(const value_type& __x)\n      {\n\tif (this->_M_impl._M_finish._M_cur\n\t    != this->_M_impl._M_finish._M_last - 1)\n\t  {\n\t    this->_M_impl.construct(this->_M_impl._M_finish._M_cur, __x);\n\t    ++this->_M_impl._M_finish._M_cur;\n\t  }\n\telse\n\t  _M_push_back_aux(__x);\n      }\n\n      /**\n       *  @brief  Removes first element.\n       *\n       *  This is a typical stack operation.  It shrinks the %deque by one.\n       *\n       *  Note that no data is returned, and if the first element's data is\n       *  needed, it should be retrieved before pop_front() is called.\n       */\n      void\n      pop_front()\n      {\n\tif (this->_M_impl._M_start._M_cur\n\t    != this->_M_impl._M_start._M_last - 1)\n\t  {\n\t    this->_M_impl.destroy(this->_M_impl._M_start._M_cur);\n\t    ++this->_M_impl._M_start._M_cur;\n\t  }\n\telse\n\t  _M_pop_front_aux();\n      }\n\n      /**\n       *  @brief  Removes last element.\n       *\n       *  This is a typical stack operation.  It shrinks the %deque by one.\n       *\n       *  Note that no data is returned, and if the last element's data is\n       *  needed, it should be retrieved before pop_back() is called.\n       */\n      void\n      pop_back()\n      {\n\tif (this->_M_impl._M_finish._M_cur\n\t    != this->_M_impl._M_finish._M_first)\n\t  {\n\t    --this->_M_impl._M_finish._M_cur;\n\t    this->_M_impl.destroy(this->_M_impl._M_finish._M_cur);\n\t  }\n\telse\n\t  _M_pop_back_aux();\n      }\n\n      /**\n       *  @brief  Inserts given value into %deque before specified iterator.\n       *  @param  position  An iterator into the %deque.\n       *  @param  x  Data to be inserted.\n       *  @return  An iterator that points to the inserted data.\n       *\n       *  This function will insert a copy of the given value before the\n       *  specified location.\n       */\n      iterator\n      insert(iterator __position, const value_type& __x);\n\n      /**\n       *  @brief  Inserts a number of copies of given data into the %deque.\n       *  @param  position  An iterator into the %deque.\n       *  @param  n  Number of elements to be inserted.\n       *  @param  x  Data to be inserted.\n       *\n       *  This function will insert a specified number of copies of the given\n       *  data before the location specified by @a position.\n       */\n      void\n      insert(iterator __position, size_type __n, const value_type& __x)\n      { _M_fill_insert(__position, __n, __x); }\n\n      /**\n       *  @brief  Inserts a range into the %deque.\n       *  @param  position  An iterator into the %deque.\n       *  @param  first  An input iterator.\n       *  @param  last   An input iterator.\n       *\n       *  This function will insert copies of the data in the range\n       *  [first,last) into the %deque before the location specified\n       *  by @a pos.  This is known as \"range insert.\"\n       */\n      template<typename _InputIterator>\n        void\n        insert(iterator __position, _InputIterator __first,\n\t       _InputIterator __last)\n        {\n\t  // Check whether it's an integral type.  If so, it's not an iterator.\n\t  typedef typename std::__is_integer<_InputIterator>::__type _Integral;\n\t  _M_insert_dispatch(__position, __first, __last, _Integral());\n\t}\n\n      /**\n       *  @brief  Remove element at given position.\n       *  @param  position  Iterator pointing to element to be erased.\n       *  @return  An iterator pointing to the next element (or end()).\n       *\n       *  This function will erase the element at the given position and thus\n       *  shorten the %deque by one.\n       *\n       *  The user is cautioned that\n       *  this function only erases the element, and that if the element is\n       *  itself a pointer, the pointed-to memory is not touched in any way.\n       *  Managing the pointer is the user's responsibilty.\n       */\n      iterator\n      erase(iterator __position);\n\n      /**\n       *  @brief  Remove a range of elements.\n       *  @param  first  Iterator pointing to the first element to be erased.\n       *  @param  last  Iterator pointing to one past the last element to be\n       *                erased.\n       *  @return  An iterator pointing to the element pointed to by @a last\n       *           prior to erasing (or end()).\n       *\n       *  This function will erase the elements in the range [first,last) and\n       *  shorten the %deque accordingly.\n       *\n       *  The user is cautioned that\n       *  this function only erases the elements, and that if the elements\n       *  themselves are pointers, the pointed-to memory is not touched in any\n       *  way.  Managing the pointer is the user's responsibilty.\n       */\n      iterator\n      erase(iterator __first, iterator __last);\n\n      /**\n       *  @brief  Swaps data with another %deque.\n       *  @param  x  A %deque of the same element and allocator types.\n       *\n       *  This exchanges the elements between two deques in constant time.\n       *  (Four pointers, so it should be quite fast.)\n       *  Note that the global std::swap() function is specialized such that\n       *  std::swap(d1,d2) will feed to this function.\n       */\n      void\n      swap(deque& __x)\n      {\n\tstd::swap(this->_M_impl._M_start, __x._M_impl._M_start);\n\tstd::swap(this->_M_impl._M_finish, __x._M_impl._M_finish);\n\tstd::swap(this->_M_impl._M_map, __x._M_impl._M_map);\n\tstd::swap(this->_M_impl._M_map_size, __x._M_impl._M_map_size);\n\n\t// _GLIBCXX_RESOLVE_LIB_DEFECTS\n\t// 431. Swapping containers with unequal allocators.\n\tstd::__alloc_swap<_Tp_alloc_type>::_S_do_it(_M_get_Tp_allocator(),\n\t\t\t\t\t\t    __x._M_get_Tp_allocator());\n      }\n\n      /**\n       *  Erases all the elements.  Note that this function only erases the\n       *  elements, and that if the elements themselves are pointers, the\n       *  pointed-to memory is not touched in any way.  Managing the pointer is\n       *  the user's responsibilty.\n       */\n      void\n      clear()\n      { _M_erase_at_end(begin()); }\n\n    protected:\n      // Internal constructor functions follow.\n\n      // called by the range constructor to implement [23.1.1]/9\n      template<typename _Integer>\n        void\n        _M_initialize_dispatch(_Integer __n, _Integer __x, __true_type)\n        {\n\t  _M_initialize_map(__n);\n\t  _M_fill_initialize(__x);\n\t}\n\n      // called by the range constructor to implement [23.1.1]/9\n      template<typename _InputIterator>\n        void\n        _M_initialize_dispatch(_InputIterator __first, _InputIterator __last,\n\t\t\t       __false_type)\n        {\n\t  typedef typename std::iterator_traits<_InputIterator>::\n\t    iterator_category _IterCategory;\n\t  _M_range_initialize(__first, __last, _IterCategory());\n\t}\n\n      // called by the second initialize_dispatch above\n      //@{\n      /**\n       *  @if maint\n       *  @brief Fills the deque with whatever is in [first,last).\n       *  @param  first  An input iterator.\n       *  @param  last  An input iterator.\n       *  @return   Nothing.\n       *\n       *  If the iterators are actually forward iterators (or better), then the\n       *  memory layout can be done all at once.  Else we move forward using\n       *  push_back on each value from the iterator.\n       *  @endif\n       */\n      template<typename _InputIterator>\n        void\n        _M_range_initialize(_InputIterator __first, _InputIterator __last,\n\t\t\t    std::input_iterator_tag);\n\n      // called by the second initialize_dispatch above\n      template<typename _ForwardIterator>\n        void\n        _M_range_initialize(_ForwardIterator __first, _ForwardIterator __last,\n\t\t\t    std::forward_iterator_tag);\n      //@}\n\n      /**\n       *  @if maint\n       *  @brief Fills the %deque with copies of value.\n       *  @param  value  Initial value.\n       *  @return   Nothing.\n       *  @pre _M_start and _M_finish have already been initialized,\n       *  but none of the %deque's elements have yet been constructed.\n       *\n       *  This function is called only when the user provides an explicit size\n       *  (with or without an explicit exemplar value).\n       *  @endif\n       */\n      void\n      _M_fill_initialize(const value_type& __value);\n\n      // Internal assign functions follow.  The *_aux functions do the actual\n      // assignment work for the range versions.\n\n      // called by the range assign to implement [23.1.1]/9\n      template<typename _Integer>\n        void\n        _M_assign_dispatch(_Integer __n, _Integer __val, __true_type)\n        {\n\t  _M_fill_assign(static_cast<size_type>(__n),\n\t\t\t static_cast<value_type>(__val));\n\t}\n\n      // called by the range assign to implement [23.1.1]/9\n      template<typename _InputIterator>\n        void\n        _M_assign_dispatch(_InputIterator __first, _InputIterator __last,\n\t\t\t   __false_type)\n        {\n\t  typedef typename std::iterator_traits<_InputIterator>::\n\t    iterator_category _IterCategory;\n\t  _M_assign_aux(__first, __last, _IterCategory());\n\t}\n\n      // called by the second assign_dispatch above\n      template<typename _InputIterator>\n        void\n        _M_assign_aux(_InputIterator __first, _InputIterator __last,\n\t\t      std::input_iterator_tag);\n\n      // called by the second assign_dispatch above\n      template<typename _ForwardIterator>\n        void\n        _M_assign_aux(_ForwardIterator __first, _ForwardIterator __last,\n\t\t      std::forward_iterator_tag)\n        {\n\t  const size_type __len = std::distance(__first, __last);\n\t  if (__len > size())\n\t    {\n\t      _ForwardIterator __mid = __first;\n\t      std::advance(__mid, size());\n\t      std::copy(__first, __mid, begin());\n\t      insert(end(), __mid, __last);\n\t    }\n\t  else\n\t    _M_erase_at_end(std::copy(__first, __last, begin()));\n\t}\n\n      // Called by assign(n,t), and the range assign when it turns out\n      // to be the same thing.\n      void\n      _M_fill_assign(size_type __n, const value_type& __val)\n      {\n\tif (__n > size())\n\t  {\n\t    std::fill(begin(), end(), __val);\n\t    insert(end(), __n - size(), __val);\n\t  }\n\telse\n\t  {\n\t    _M_erase_at_end(begin() + difference_type(__n));\n\t    std::fill(begin(), end(), __val);\n\t  }\n      }\n\n      //@{\n      /**\n       *  @if maint\n       *  @brief Helper functions for push_* and pop_*.\n       *  @endif\n       */\n      void _M_push_back_aux(const value_type&);\n\n      void _M_push_front_aux(const value_type&);\n\n      void _M_pop_back_aux();\n\n      void _M_pop_front_aux();\n      //@}\n\n      // Internal insert functions follow.  The *_aux functions do the actual\n      // insertion work when all shortcuts fail.\n\n      // called by the range insert to implement [23.1.1]/9\n      template<typename _Integer>\n        void\n        _M_insert_dispatch(iterator __pos,\n\t\t\t   _Integer __n, _Integer __x, __true_type)\n        {\n\t  _M_fill_insert(__pos, static_cast<size_type>(__n),\n\t\t\t static_cast<value_type>(__x));\n\t}\n\n      // called by the range insert to implement [23.1.1]/9\n      template<typename _InputIterator>\n        void\n        _M_insert_dispatch(iterator __pos,\n\t\t\t   _InputIterator __first, _InputIterator __last,\n\t\t\t   __false_type)\n        {\n\t  typedef typename std::iterator_traits<_InputIterator>::\n\t    iterator_category _IterCategory;\n          _M_range_insert_aux(__pos, __first, __last, _IterCategory());\n\t}\n\n      // called by the second insert_dispatch above\n      template<typename _InputIterator>\n        void\n        _M_range_insert_aux(iterator __pos, _InputIterator __first,\n\t\t\t    _InputIterator __last, std::input_iterator_tag);\n\n      // called by the second insert_dispatch above\n      template<typename _ForwardIterator>\n        void\n        _M_range_insert_aux(iterator __pos, _ForwardIterator __first,\n\t\t\t    _ForwardIterator __last, std::forward_iterator_tag);\n\n      // Called by insert(p,n,x), and the range insert when it turns out to be\n      // the same thing.  Can use fill functions in optimal situations,\n      // otherwise passes off to insert_aux(p,n,x).\n      void\n      _M_fill_insert(iterator __pos, size_type __n, const value_type& __x);\n\n      // called by insert(p,x)\n      iterator\n      _M_insert_aux(iterator __pos, const value_type& __x);\n\n      // called by insert(p,n,x) via fill_insert\n      void\n      _M_insert_aux(iterator __pos, size_type __n, const value_type& __x);\n\n      // called by range_insert_aux for forward iterators\n      template<typename _ForwardIterator>\n        void\n        _M_insert_aux(iterator __pos,\n\t\t      _ForwardIterator __first, _ForwardIterator __last,\n\t\t      size_type __n);\n\n\n      // Internal erase functions follow.\n\n      void\n      _M_destroy_data_aux(iterator __first, iterator __last);\n\n      void\n      _M_destroy_data_dispatch(iterator, iterator, __true_type) { }\n      \n      void\n      _M_destroy_data_dispatch(iterator __first, iterator __last, __false_type)\n      { _M_destroy_data_aux(__first, __last); }\n\n      // Called by ~deque().\n      // NB: Doesn't deallocate the nodes.\n      template<typename _Alloc1>\n        void\n        _M_destroy_data(iterator __first, iterator __last, const _Alloc1&)\n        { _M_destroy_data_aux(__first, __last); }\n\n      void\n      _M_destroy_data(iterator __first, iterator __last,\n\t\t      const std::allocator<_Tp>&)\n      {\n\ttypedef typename std::__is_scalar<value_type>::__type\n\t  _Has_trivial_destructor;\n\t_M_destroy_data_dispatch(__first, __last, _Has_trivial_destructor());\n      }\n\n      // Called by erase(q1, q2).\n      void\n      _M_erase_at_begin(iterator __pos)\n      {\n\t_M_destroy_data(begin(), __pos, _M_get_Tp_allocator());\n\t_M_destroy_nodes(this->_M_impl._M_start._M_node, __pos._M_node);\n\tthis->_M_impl._M_start = __pos;\n      }\n\n      // Called by erase(q1, q2), resize(), clear(), _M_assign_aux,\n      // _M_fill_assign, operator=.\n      void\n      _M_erase_at_end(iterator __pos)\n      {\n\t_M_destroy_data(__pos, end(), _M_get_Tp_allocator());\n\t_M_destroy_nodes(__pos._M_node + 1,\n\t\t\t this->_M_impl._M_finish._M_node + 1);\n\tthis->_M_impl._M_finish = __pos;\n      }\n\n      //@{\n      /**\n       *  @if maint\n       *  @brief Memory-handling helpers for the previous internal insert\n       *         functions.\n       *  @endif\n       */\n      iterator\n      _M_reserve_elements_at_front(size_type __n)\n      {\n\tconst size_type __vacancies = this->_M_impl._M_start._M_cur\n\t                              - this->_M_impl._M_start._M_first;\n\tif (__n > __vacancies)\n\t  _M_new_elements_at_front(__n - __vacancies);\n\treturn this->_M_impl._M_start - difference_type(__n);\n      }\n\n      iterator\n      _M_reserve_elements_at_back(size_type __n)\n      {\n\tconst size_type __vacancies = (this->_M_impl._M_finish._M_last\n\t\t\t\t       - this->_M_impl._M_finish._M_cur) - 1;\n\tif (__n > __vacancies)\n\t  _M_new_elements_at_back(__n - __vacancies);\n\treturn this->_M_impl._M_finish + difference_type(__n);\n      }\n\n      void\n      _M_new_elements_at_front(size_type __new_elements);\n\n      void\n      _M_new_elements_at_back(size_type __new_elements);\n      //@}\n\n\n      //@{\n      /**\n       *  @if maint\n       *  @brief Memory-handling helpers for the major %map.\n       *\n       *  Makes sure the _M_map has space for new nodes.  Does not\n       *  actually add the nodes.  Can invalidate _M_map pointers.\n       *  (And consequently, %deque iterators.)\n       *  @endif\n       */\n      void\n      _M_reserve_map_at_back(size_type __nodes_to_add = 1)\n      {\n\tif (__nodes_to_add + 1 > this->_M_impl._M_map_size\n\t    - (this->_M_impl._M_finish._M_node - this->_M_impl._M_map))\n\t  _M_reallocate_map(__nodes_to_add, false);\n      }\n\n      void\n      _M_reserve_map_at_front(size_type __nodes_to_add = 1)\n      {\n\tif (__nodes_to_add > size_type(this->_M_impl._M_start._M_node\n\t\t\t\t       - this->_M_impl._M_map))\n\t  _M_reallocate_map(__nodes_to_add, true);\n      }\n\n      void\n      _M_reallocate_map(size_type __nodes_to_add, bool __add_at_front);\n      //@}\n    };\n\n\n  /**\n   *  @brief  Deque equality comparison.\n   *  @param  x  A %deque.\n   *  @param  y  A %deque of the same type as @a x.\n   *  @return  True iff the size and elements of the deques are equal.\n   *\n   *  This is an equivalence relation.  It is linear in the size of the\n   *  deques.  Deques are considered equivalent if their sizes are equal,\n   *  and if corresponding elements compare equal.\n  */\n  template<typename _Tp, typename _Alloc>\n    inline bool\n    operator==(const deque<_Tp, _Alloc>& __x,\n                         const deque<_Tp, _Alloc>& __y)\n    { return __x.size() == __y.size()\n             && std::equal(__x.begin(), __x.end(), __y.begin()); }\n\n  /**\n   *  @brief  Deque ordering relation.\n   *  @param  x  A %deque.\n   *  @param  y  A %deque of the same type as @a x.\n   *  @return  True iff @a x is lexicographically less than @a y.\n   *\n   *  This is a total ordering relation.  It is linear in the size of the\n   *  deques.  The elements must be comparable with @c <.\n   *\n   *  See std::lexicographical_compare() for how the determination is made.\n  */\n  template<typename _Tp, typename _Alloc>\n    inline bool\n    operator<(const deque<_Tp, _Alloc>& __x,\n\t      const deque<_Tp, _Alloc>& __y)\n    { return std::lexicographical_compare(__x.begin(), __x.end(),\n\t\t\t\t\t  __y.begin(), __y.end()); }\n\n  /// Based on operator==\n  template<typename _Tp, typename _Alloc>\n    inline bool\n    operator!=(const deque<_Tp, _Alloc>& __x,\n\t       const deque<_Tp, _Alloc>& __y)\n    { return !(__x == __y); }\n\n  /// Based on operator<\n  template<typename _Tp, typename _Alloc>\n    inline bool\n    operator>(const deque<_Tp, _Alloc>& __x,\n\t      const deque<_Tp, _Alloc>& __y)\n    { return __y < __x; }\n\n  /// Based on operator<\n  template<typename _Tp, typename _Alloc>\n    inline bool\n    operator<=(const deque<_Tp, _Alloc>& __x,\n\t       const deque<_Tp, _Alloc>& __y)\n    { return !(__y < __x); }\n\n  /// Based on operator<\n  template<typename _Tp, typename _Alloc>\n    inline bool\n    operator>=(const deque<_Tp, _Alloc>& __x,\n\t       const deque<_Tp, _Alloc>& __y)\n    { return !(__x < __y); }\n\n  /// See std::deque::swap().\n  template<typename _Tp, typename _Alloc>\n    inline void\n    swap(deque<_Tp,_Alloc>& __x, deque<_Tp,_Alloc>& __y)\n    { __x.swap(__y); }\n\n_GLIBCXX_END_NESTED_NAMESPACE\n\n#endif /* _DEQUE_H */\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/bits/stl_function.h",
    "content": "// Functor implementations -*- C++ -*-\n\n// Copyright (C) 2001, 2002, 2004, 2005 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n/*\n *\n * Copyright (c) 1994\n * Hewlett-Packard Company\n *\n * Permission to use, copy, modify, distribute and sell this software\n * and its documentation for any purpose is hereby granted without fee,\n * provided that the above copyright notice appear in all copies and\n * that both that copyright notice and this permission notice appear\n * in supporting documentation.  Hewlett-Packard Company makes no\n * representations about the suitability of this software for any\n * purpose.  It is provided \"as is\" without express or implied warranty.\n *\n *\n * Copyright (c) 1996-1998\n * Silicon Graphics Computer Systems, Inc.\n *\n * Permission to use, copy, modify, distribute and sell this software\n * and its documentation for any purpose is hereby granted without fee,\n * provided that the above copyright notice appear in all copies and\n * that both that copyright notice and this permission notice appear\n * in supporting documentation.  Silicon Graphics makes no\n * representations about the suitability of this software for any\n * purpose.  It is provided \"as is\" without express or implied warranty.\n */\n\n/** @file stl_function.h\n *  This is an internal header file, included by other library headers.\n *  You should not attempt to use it directly.\n */\n\n#ifndef _FUNCTION_H\n#define _FUNCTION_H 1\n\n_GLIBCXX_BEGIN_NAMESPACE(std)\n\n  // 20.3.1 base classes\n  /** @defgroup s20_3_1_base Functor Base Classes\n   *  Function objects, or @e functors, are objects with an @c operator()\n   *  defined and accessible.  They can be passed as arguments to algorithm\n   *  templates and used in place of a function pointer.  Not only is the\n   *  resulting expressiveness of the library increased, but the generated\n   *  code can be more efficient than what you might write by hand.  When we\n   *  refer to \"functors,\" then, generally we include function pointers in\n   *  the description as well.\n   *\n   *  Often, functors are only created as temporaries passed to algorithm\n   *  calls, rather than being created as named variables.\n   *\n   *  Two examples taken from the standard itself follow.  To perform a\n   *  by-element addition of two vectors @c a and @c b containing @c double,\n   *  and put the result in @c a, use\n   *  \\code\n   *  transform (a.begin(), a.end(), b.begin(), a.begin(), plus<double>());\n   *  \\endcode\n   *  To negate every element in @c a, use\n   *  \\code\n   *  transform(a.begin(), a.end(), a.begin(), negate<double>());\n   *  \\endcode\n   *  The addition and negation functions will be inlined directly.\n   *\n   *  The standard functors are derived from structs named @c unary_function\n   *  and @c binary_function.  These two classes contain nothing but typedefs,\n   *  to aid in generic (template) programming.  If you write your own\n   *  functors, you might consider doing the same.\n   *\n   *  @{\n   */\n  /**\n   *  This is one of the @link s20_3_1_base functor base classes@endlink.\n   */\n  template <class _Arg, class _Result>\n    struct unary_function\n    {\n      typedef _Arg argument_type;   ///< @c argument_type is the type of the\n                                    ///     argument (no surprises here)\n\n      typedef _Result result_type;  ///< @c result_type is the return type\n    };\n\n  /**\n   *  This is one of the @link s20_3_1_base functor base classes@endlink.\n   */\n  template <class _Arg1, class _Arg2, class _Result>\n    struct binary_function\n    {\n      typedef _Arg1 first_argument_type;   ///< the type of the first argument\n                                           ///  (no surprises here)\n\n      typedef _Arg2 second_argument_type;  ///< the type of the second argument\n      typedef _Result result_type;         ///< type of the return type\n    };\n  /** @}  */\n\n  // 20.3.2 arithmetic\n  /** @defgroup s20_3_2_arithmetic Arithmetic Classes\n   *  Because basic math often needs to be done during an algorithm, the library\n   *  provides functors for those operations.  See the documentation for\n   *  @link s20_3_1_base the base classes@endlink for examples of their use.\n   *\n   *  @{\n   */\n  /// One of the @link s20_3_2_arithmetic math functors@endlink.\n  template <class _Tp>\n    struct plus : public binary_function<_Tp, _Tp, _Tp>\n    {\n      _Tp\n      operator()(const _Tp& __x, const _Tp& __y) const\n      { return __x + __y; }\n    };\n\n  /// One of the @link s20_3_2_arithmetic math functors@endlink.\n  template <class _Tp>\n    struct minus : public binary_function<_Tp, _Tp, _Tp>\n    {\n      _Tp\n      operator()(const _Tp& __x, const _Tp& __y) const\n      { return __x - __y; }\n    };\n\n  /// One of the @link s20_3_2_arithmetic math functors@endlink.\n  template <class _Tp>\n    struct multiplies : public binary_function<_Tp, _Tp, _Tp>\n    {\n      _Tp\n      operator()(const _Tp& __x, const _Tp& __y) const\n      { return __x * __y; }\n    };\n\n  /// One of the @link s20_3_2_arithmetic math functors@endlink.\n  template <class _Tp>\n    struct divides : public binary_function<_Tp, _Tp, _Tp>\n    {\n      _Tp\n      operator()(const _Tp& __x, const _Tp& __y) const\n      { return __x / __y; }\n    };\n\n  /// One of the @link s20_3_2_arithmetic math functors@endlink.\n  template <class _Tp>\n    struct modulus : public binary_function<_Tp, _Tp, _Tp>\n    {\n      _Tp\n      operator()(const _Tp& __x, const _Tp& __y) const\n      { return __x % __y; }\n    };\n\n  /// One of the @link s20_3_2_arithmetic math functors@endlink.\n  template <class _Tp>\n    struct negate : public unary_function<_Tp, _Tp>\n    {\n      _Tp\n      operator()(const _Tp& __x) const\n      { return -__x; }\n    };\n  /** @}  */\n\n  // 20.3.3 comparisons\n  /** @defgroup s20_3_3_comparisons Comparison Classes\n   *  The library provides six wrapper functors for all the basic comparisons\n   *  in C++, like @c <.\n   *\n   *  @{\n   */\n  /// One of the @link s20_3_3_comparisons comparison functors@endlink.\n  template <class _Tp>\n    struct equal_to : public binary_function<_Tp, _Tp, bool>\n    {\n      bool\n      operator()(const _Tp& __x, const _Tp& __y) const\n      { return __x == __y; }\n    };\n\n  /// One of the @link s20_3_3_comparisons comparison functors@endlink.\n  template <class _Tp>\n    struct not_equal_to : public binary_function<_Tp, _Tp, bool>\n    {\n      bool\n      operator()(const _Tp& __x, const _Tp& __y) const\n      { return __x != __y; }\n    };\n\n  /// One of the @link s20_3_3_comparisons comparison functors@endlink.\n  template <class _Tp>\n    struct greater : public binary_function<_Tp, _Tp, bool>\n    {\n      bool\n      operator()(const _Tp& __x, const _Tp& __y) const\n      { return __x > __y; }\n    };\n\n  /// One of the @link s20_3_3_comparisons comparison functors@endlink.\n  template <class _Tp>\n    struct less : public binary_function<_Tp, _Tp, bool>\n    {\n      bool\n      operator()(const _Tp& __x, const _Tp& __y) const\n      { return __x < __y; }\n    };\n\n  /// One of the @link s20_3_3_comparisons comparison functors@endlink.\n  template <class _Tp>\n    struct greater_equal : public binary_function<_Tp, _Tp, bool>\n    {\n      bool\n      operator()(const _Tp& __x, const _Tp& __y) const\n      { return __x >= __y; }\n    };\n\n  /// One of the @link s20_3_3_comparisons comparison functors@endlink.\n  template <class _Tp>\n    struct less_equal : public binary_function<_Tp, _Tp, bool>\n    {\n      bool\n      operator()(const _Tp& __x, const _Tp& __y) const\n      { return __x <= __y; }\n    };\n  /** @}  */\n\n  // 20.3.4 logical operations\n  /** @defgroup s20_3_4_logical Boolean Operations Classes\n   *  Here are wrapper functors for Boolean operations:  @c &&, @c ||, and @c !.\n   *\n   *  @{\n   */\n  /// One of the @link s20_3_4_logical Boolean operations functors@endlink.\n  template <class _Tp>\n    struct logical_and : public binary_function<_Tp, _Tp, bool>\n    {\n      bool\n      operator()(const _Tp& __x, const _Tp& __y) const\n      { return __x && __y; }\n    };\n\n  /// One of the @link s20_3_4_logical Boolean operations functors@endlink.\n  template <class _Tp>\n    struct logical_or : public binary_function<_Tp, _Tp, bool>\n    {\n      bool\n      operator()(const _Tp& __x, const _Tp& __y) const\n      { return __x || __y; }\n    };\n\n  /// One of the @link s20_3_4_logical Boolean operations functors@endlink.\n  template <class _Tp>\n    struct logical_not : public unary_function<_Tp, bool>\n    {\n      bool\n      operator()(const _Tp& __x) const\n      { return !__x; }\n    };\n  /** @}  */\n\n  // 20.3.5 negators\n  /** @defgroup s20_3_5_negators Negators\n   *  The functions @c not1 and @c not2 each take a predicate functor\n   *  and return an instance of @c unary_negate or\n   *  @c binary_negate, respectively.  These classes are functors whose\n   *  @c operator() performs the stored predicate function and then returns\n   *  the negation of the result.\n   *\n   *  For example, given a vector of integers and a trivial predicate,\n   *  \\code\n   *  struct IntGreaterThanThree\n   *    : public std::unary_function<int, bool>\n   *  {\n   *      bool operator() (int x) { return x > 3; }\n   *  };\n   *\n   *  std::find_if (v.begin(), v.end(), not1(IntGreaterThanThree()));\n   *  \\endcode\n   *  The call to @c find_if will locate the first index (i) of @c v for which\n   *  \"!(v[i] > 3)\" is true.\n   *\n   *  The not1/unary_negate combination works on predicates taking a single\n   *  argument.  The not2/binary_negate combination works on predicates which\n   *  take two arguments.\n   *\n   *  @{\n   */\n  /// One of the @link s20_3_5_negators negation functors@endlink.\n  template <class _Predicate>\n    class unary_negate\n    : public unary_function<typename _Predicate::argument_type, bool>\n    {\n    protected:\n      _Predicate _M_pred;\n    public:\n      explicit\n      unary_negate(const _Predicate& __x) : _M_pred(__x) {}\n\n      bool\n      operator()(const typename _Predicate::argument_type& __x) const\n      { return !_M_pred(__x); }\n    };\n\n  /// One of the @link s20_3_5_negators negation functors@endlink.\n  template <class _Predicate>\n    inline unary_negate<_Predicate>\n    not1(const _Predicate& __pred)\n    { return unary_negate<_Predicate>(__pred); }\n\n  /// One of the @link s20_3_5_negators negation functors@endlink.\n  template <class _Predicate>\n    class binary_negate\n    : public binary_function<typename _Predicate::first_argument_type,\n\t\t\t     typename _Predicate::second_argument_type,\n\t\t\t     bool>\n    {\n    protected:\n      _Predicate _M_pred;\n    public:\n      explicit\n      binary_negate(const _Predicate& __x)\n      : _M_pred(__x) { }\n\n      bool\n      operator()(const typename _Predicate::first_argument_type& __x,\n\t\t const typename _Predicate::second_argument_type& __y) const\n      { return !_M_pred(__x, __y); }\n    };\n\n  /// One of the @link s20_3_5_negators negation functors@endlink.\n  template <class _Predicate>\n    inline binary_negate<_Predicate>\n    not2(const _Predicate& __pred)\n    { return binary_negate<_Predicate>(__pred); }\n  /** @}  */\n\n  // 20.3.6 binders\n  /** @defgroup s20_3_6_binder Binder Classes\n   *  Binders turn functions/functors with two arguments into functors with\n   *  a single argument, storing an argument to be applied later.  For\n   *  example, a variable @c B of type @c binder1st is constructed from a\n   *  functor @c f and an argument @c x.  Later, B's @c operator() is called\n   *  with a single argument @c y.  The return value is the value of @c f(x,y).\n   *  @c B can be \"called\" with various arguments (y1, y2, ...) and will in\n   *  turn call @c f(x,y1), @c f(x,y2), ...\n   *\n   *  The function @c bind1st is provided to save some typing.  It takes the\n   *  function and an argument as parameters, and returns an instance of\n   *  @c binder1st.\n   *\n   *  The type @c binder2nd and its creator function @c bind2nd do the same\n   *  thing, but the stored argument is passed as the second parameter instead\n   *  of the first, e.g., @c bind2nd(std::minus<float>,1.3) will create a\n   *  functor whose @c operator() accepts a floating-point number, subtracts\n   *  1.3 from it, and returns the result.  (If @c bind1st had been used,\n   *  the functor would perform \"1.3 - x\" instead.\n   *\n   *  Creator-wrapper functions like @c bind1st are intended to be used in\n   *  calling algorithms.  Their return values will be temporary objects.\n   *  (The goal is to not require you to type names like\n   *  @c std::binder1st<std::plus<int>> for declaring a variable to hold the\n   *  return value from @c bind1st(std::plus<int>,5).\n   *\n   *  These become more useful when combined with the composition functions.\n   *\n   *  @{\n   */\n  /// One of the @link s20_3_6_binder binder functors@endlink.\n  template <class _Operation>\n    class binder1st\n    : public unary_function<typename _Operation::second_argument_type,\n\t\t\t    typename _Operation::result_type>\n    {\n    protected:\n      _Operation op;\n      typename _Operation::first_argument_type value;\n    public:\n      binder1st(const _Operation& __x,\n\t\tconst typename _Operation::first_argument_type& __y)\n      : op(__x), value(__y) {}\n\n      typename _Operation::result_type\n      operator()(const typename _Operation::second_argument_type& __x) const\n      { return op(value, __x); }\n\n      // _GLIBCXX_RESOLVE_LIB_DEFECTS\n      // 109.  Missing binders for non-const sequence elements\n      typename _Operation::result_type\n      operator()(typename _Operation::second_argument_type& __x) const\n      { return op(value, __x); }\n    };\n\n  /// One of the @link s20_3_6_binder binder functors@endlink.\n  template <class _Operation, class _Tp>\n    inline binder1st<_Operation>\n    bind1st(const _Operation& __fn, const _Tp& __x)\n    {\n      typedef typename _Operation::first_argument_type _Arg1_type;\n      return binder1st<_Operation>(__fn, _Arg1_type(__x));\n    }\n\n  /// One of the @link s20_3_6_binder binder functors@endlink.\n  template <class _Operation>\n    class binder2nd\n    : public unary_function<typename _Operation::first_argument_type,\n\t\t\t    typename _Operation::result_type>\n    {\n    protected:\n      _Operation op;\n      typename _Operation::second_argument_type value;\n    public:\n      binder2nd(const _Operation& __x,\n\t\tconst typename _Operation::second_argument_type& __y)\n      : op(__x), value(__y) {}\n\n      typename _Operation::result_type\n      operator()(const typename _Operation::first_argument_type& __x) const\n      { return op(__x, value); }\n\n      // _GLIBCXX_RESOLVE_LIB_DEFECTS\n      // 109.  Missing binders for non-const sequence elements\n      typename _Operation::result_type\n      operator()(typename _Operation::first_argument_type& __x) const\n      { return op(__x, value); }\n    };\n\n  /// One of the @link s20_3_6_binder binder functors@endlink.\n  template <class _Operation, class _Tp>\n    inline binder2nd<_Operation>\n    bind2nd(const _Operation& __fn, const _Tp& __x)\n    {\n      typedef typename _Operation::second_argument_type _Arg2_type;\n      return binder2nd<_Operation>(__fn, _Arg2_type(__x));\n    }\n  /** @}  */\n\n  // 20.3.7 adaptors pointers functions\n  /** @defgroup s20_3_7_adaptors Adaptors for pointers to functions\n   *  The advantage of function objects over pointers to functions is that\n   *  the objects in the standard library declare nested typedefs describing\n   *  their argument and result types with uniform names (e.g., @c result_type\n   *  from the base classes @c unary_function and @c binary_function).\n   *  Sometimes those typedefs are required, not just optional.\n   *\n   *  Adaptors are provided to turn pointers to unary (single-argument) and\n   *  binary (double-argument) functions into function objects.  The\n   *  long-winded functor @c pointer_to_unary_function is constructed with a\n   *  function pointer @c f, and its @c operator() called with argument @c x\n   *  returns @c f(x).  The functor @c pointer_to_binary_function does the same\n   *  thing, but with a double-argument @c f and @c operator().\n   *\n   *  The function @c ptr_fun takes a pointer-to-function @c f and constructs\n   *  an instance of the appropriate functor.\n   *\n   *  @{\n   */\n  /// One of the @link s20_3_7_adaptors adaptors for function pointers@endlink.\n  template <class _Arg, class _Result>\n    class pointer_to_unary_function : public unary_function<_Arg, _Result>\n    {\n    protected:\n      _Result (*_M_ptr)(_Arg);\n    public:\n      pointer_to_unary_function() {}\n\n      explicit\n      pointer_to_unary_function(_Result (*__x)(_Arg))\n      : _M_ptr(__x) {}\n\n      _Result\n      operator()(_Arg __x) const\n      { return _M_ptr(__x); }\n    };\n\n  /// One of the @link s20_3_7_adaptors adaptors for function pointers@endlink.\n  template <class _Arg, class _Result>\n    inline pointer_to_unary_function<_Arg, _Result>\n    ptr_fun(_Result (*__x)(_Arg))\n    { return pointer_to_unary_function<_Arg, _Result>(__x); }\n\n  /// One of the @link s20_3_7_adaptors adaptors for function pointers@endlink.\n  template <class _Arg1, class _Arg2, class _Result>\n    class pointer_to_binary_function\n    : public binary_function<_Arg1, _Arg2, _Result>\n    {\n    protected:\n      _Result (*_M_ptr)(_Arg1, _Arg2);\n    public:\n      pointer_to_binary_function() {}\n\n      explicit\n      pointer_to_binary_function(_Result (*__x)(_Arg1, _Arg2))\n      : _M_ptr(__x) {}\n\n      _Result\n      operator()(_Arg1 __x, _Arg2 __y) const\n      { return _M_ptr(__x, __y); }\n    };\n\n  /// One of the @link s20_3_7_adaptors adaptors for function pointers@endlink.\n  template <class _Arg1, class _Arg2, class _Result>\n    inline pointer_to_binary_function<_Arg1, _Arg2, _Result>\n    ptr_fun(_Result (*__x)(_Arg1, _Arg2))\n    { return pointer_to_binary_function<_Arg1, _Arg2, _Result>(__x); }\n  /** @}  */\n\n  template <class _Tp>\n    struct _Identity : public unary_function<_Tp,_Tp>\n    {\n      _Tp&\n      operator()(_Tp& __x) const\n      { return __x; }\n\n      const _Tp&\n      operator()(const _Tp& __x) const\n      { return __x; }\n    };\n\n  template <class _Pair>\n    struct _Select1st : public unary_function<_Pair,\n\t\t\t\t\t      typename _Pair::first_type>\n    {\n      typename _Pair::first_type&\n      operator()(_Pair& __x) const\n      { return __x.first; }\n\n      const typename _Pair::first_type&\n      operator()(const _Pair& __x) const\n      { return __x.first; }\n    };\n\n  template <class _Pair>\n    struct _Select2nd : public unary_function<_Pair,\n\t\t\t\t\t      typename _Pair::second_type>\n    {\n      typename _Pair::second_type&\n      operator()(_Pair& __x) const\n      { return __x.second; }\n\n      const typename _Pair::second_type&\n      operator()(const _Pair& __x) const\n      { return __x.second; }\n    };\n\n  // 20.3.8 adaptors pointers members\n  /** @defgroup s20_3_8_memadaptors Adaptors for pointers to members\n   *  There are a total of 8 = 2^3 function objects in this family.\n   *   (1) Member functions taking no arguments vs member functions taking\n   *        one argument.\n   *   (2) Call through pointer vs call through reference.\n   *   (3) Const vs non-const member function.\n   *\n   *  All of this complexity is in the function objects themselves.  You can\n   *   ignore it by using the helper function mem_fun and mem_fun_ref,\n   *   which create whichever type of adaptor is appropriate.\n   *\n   *  @{\n   */\n  /// One of the @link s20_3_8_memadaptors adaptors for member pointers@endlink.\n  template <class _Ret, class _Tp>\n    class mem_fun_t : public unary_function<_Tp*, _Ret>\n    {\n    public:\n      explicit\n      mem_fun_t(_Ret (_Tp::*__pf)())\n      : _M_f(__pf) {}\n\n      _Ret\n      operator()(_Tp* __p) const\n      { return (__p->*_M_f)(); }\n    private:\n      _Ret (_Tp::*_M_f)();\n    };\n\n  /// One of the @link s20_3_8_memadaptors adaptors for member pointers@endlink.\n  template <class _Ret, class _Tp>\n    class const_mem_fun_t : public unary_function<const _Tp*, _Ret>\n    {\n    public:\n      explicit\n      const_mem_fun_t(_Ret (_Tp::*__pf)() const)\n      : _M_f(__pf) {}\n\n      _Ret\n      operator()(const _Tp* __p) const\n      { return (__p->*_M_f)(); }\n    private:\n      _Ret (_Tp::*_M_f)() const;\n    };\n\n  /// One of the @link s20_3_8_memadaptors adaptors for member pointers@endlink.\n  template <class _Ret, class _Tp>\n    class mem_fun_ref_t : public unary_function<_Tp, _Ret>\n    {\n    public:\n      explicit\n      mem_fun_ref_t(_Ret (_Tp::*__pf)())\n      : _M_f(__pf) {}\n\n      _Ret\n      operator()(_Tp& __r) const\n      { return (__r.*_M_f)(); }\n    private:\n      _Ret (_Tp::*_M_f)();\n  };\n\n  /// One of the @link s20_3_8_memadaptors adaptors for member pointers@endlink.\n  template <class _Ret, class _Tp>\n    class const_mem_fun_ref_t : public unary_function<_Tp, _Ret>\n    {\n    public:\n      explicit\n      const_mem_fun_ref_t(_Ret (_Tp::*__pf)() const)\n      : _M_f(__pf) {}\n\n      _Ret\n      operator()(const _Tp& __r) const\n      { return (__r.*_M_f)(); }\n    private:\n      _Ret (_Tp::*_M_f)() const;\n    };\n\n  /// One of the @link s20_3_8_memadaptors adaptors for member pointers@endlink.\n  template <class _Ret, class _Tp, class _Arg>\n    class mem_fun1_t : public binary_function<_Tp*, _Arg, _Ret>\n    {\n    public:\n      explicit\n      mem_fun1_t(_Ret (_Tp::*__pf)(_Arg))\n      : _M_f(__pf) {}\n\n      _Ret\n      operator()(_Tp* __p, _Arg __x) const\n      { return (__p->*_M_f)(__x); }\n    private:\n      _Ret (_Tp::*_M_f)(_Arg);\n    };\n\n  /// One of the @link s20_3_8_memadaptors adaptors for member pointers@endlink.\n  template <class _Ret, class _Tp, class _Arg>\n    class const_mem_fun1_t : public binary_function<const _Tp*, _Arg, _Ret>\n    {\n    public:\n      explicit\n      const_mem_fun1_t(_Ret (_Tp::*__pf)(_Arg) const)\n      : _M_f(__pf) {}\n\n      _Ret\n      operator()(const _Tp* __p, _Arg __x) const\n      { return (__p->*_M_f)(__x); }\n    private:\n      _Ret (_Tp::*_M_f)(_Arg) const;\n    };\n\n  /// One of the @link s20_3_8_memadaptors adaptors for member pointers@endlink.\n  template <class _Ret, class _Tp, class _Arg>\n    class mem_fun1_ref_t : public binary_function<_Tp, _Arg, _Ret>\n    {\n    public:\n      explicit\n      mem_fun1_ref_t(_Ret (_Tp::*__pf)(_Arg))\n      : _M_f(__pf) {}\n\n      _Ret\n      operator()(_Tp& __r, _Arg __x) const\n      { return (__r.*_M_f)(__x); }\n    private:\n      _Ret (_Tp::*_M_f)(_Arg);\n    };\n\n  /// One of the @link s20_3_8_memadaptors adaptors for member pointers@endlink.\n  template <class _Ret, class _Tp, class _Arg>\n    class const_mem_fun1_ref_t : public binary_function<_Tp, _Arg, _Ret>\n    {\n    public:\n      explicit\n      const_mem_fun1_ref_t(_Ret (_Tp::*__pf)(_Arg) const)\n      : _M_f(__pf) {}\n\n      _Ret\n      operator()(const _Tp& __r, _Arg __x) const\n      { return (__r.*_M_f)(__x); }\n    private:\n      _Ret (_Tp::*_M_f)(_Arg) const;\n    };\n\n  // Mem_fun adaptor helper functions.  There are only two:\n  // mem_fun and mem_fun_ref.\n  template <class _Ret, class _Tp>\n    inline mem_fun_t<_Ret, _Tp>\n    mem_fun(_Ret (_Tp::*__f)())\n    { return mem_fun_t<_Ret, _Tp>(__f); }\n\n  template <class _Ret, class _Tp>\n    inline const_mem_fun_t<_Ret, _Tp>\n    mem_fun(_Ret (_Tp::*__f)() const)\n    { return const_mem_fun_t<_Ret, _Tp>(__f); }\n\n  template <class _Ret, class _Tp>\n    inline mem_fun_ref_t<_Ret, _Tp>\n    mem_fun_ref(_Ret (_Tp::*__f)())\n    { return mem_fun_ref_t<_Ret, _Tp>(__f); }\n\n  template <class _Ret, class _Tp>\n    inline const_mem_fun_ref_t<_Ret, _Tp>\n    mem_fun_ref(_Ret (_Tp::*__f)() const)\n    { return const_mem_fun_ref_t<_Ret, _Tp>(__f); }\n\n  template <class _Ret, class _Tp, class _Arg>\n    inline mem_fun1_t<_Ret, _Tp, _Arg>\n    mem_fun(_Ret (_Tp::*__f)(_Arg))\n    { return mem_fun1_t<_Ret, _Tp, _Arg>(__f); }\n\n  template <class _Ret, class _Tp, class _Arg>\n    inline const_mem_fun1_t<_Ret, _Tp, _Arg>\n    mem_fun(_Ret (_Tp::*__f)(_Arg) const)\n    { return const_mem_fun1_t<_Ret, _Tp, _Arg>(__f); }\n\n  template <class _Ret, class _Tp, class _Arg>\n    inline mem_fun1_ref_t<_Ret, _Tp, _Arg>\n    mem_fun_ref(_Ret (_Tp::*__f)(_Arg))\n    { return mem_fun1_ref_t<_Ret, _Tp, _Arg>(__f); }\n\n  template <class _Ret, class _Tp, class _Arg>\n    inline const_mem_fun1_ref_t<_Ret, _Tp, _Arg>\n    mem_fun_ref(_Ret (_Tp::*__f)(_Arg) const)\n    { return const_mem_fun1_ref_t<_Ret, _Tp, _Arg>(__f); }\n\n  /** @}  */\n\n_GLIBCXX_END_NAMESPACE\n\n#endif /* _FUNCTION_H */\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/bits/stl_heap.h",
    "content": "// Heap implementation -*- C++ -*-\n\n// Copyright (C) 2001, 2004, 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n/*\n *\n * Copyright (c) 1994\n * Hewlett-Packard Company\n *\n * Permission to use, copy, modify, distribute and sell this software\n * and its documentation for any purpose is hereby granted without fee,\n * provided that the above copyright notice appear in all copies and\n * that both that copyright notice and this permission notice appear\n * in supporting documentation.  Hewlett-Packard Company makes no\n * representations about the suitability of this software for any\n * purpose.  It is provided \"as is\" without express or implied warranty.\n *\n * Copyright (c) 1997\n * Silicon Graphics Computer Systems, Inc.\n *\n * Permission to use, copy, modify, distribute and sell this software\n * and its documentation for any purpose is hereby granted without fee,\n * provided that the above copyright notice appear in all copies and\n * that both that copyright notice and this permission notice appear\n * in supporting documentation.  Silicon Graphics makes no\n * representations about the suitability of this software for any\n * purpose.  It is provided \"as is\" without express or implied warranty.\n */\n\n/** @file stl_heap.h\n *  This is an internal header file, included by other library headers.\n *  You should not attempt to use it directly.\n */\n\n#ifndef _STL_HEAP_H\n#define _STL_HEAP_H 1\n\n#include <debug/debug.h>\n\n_GLIBCXX_BEGIN_NAMESPACE(std)\n\n  // is_heap, a predicate testing whether or not a range is\n  // a heap.  This function is an extension, not part of the C++\n  // standard.\n  template<typename _RandomAccessIterator, typename _Distance>\n    bool\n    __is_heap(_RandomAccessIterator __first, _Distance __n)\n    {\n      _Distance __parent = 0;\n      for (_Distance __child = 1; __child < __n; ++__child)\n\t{\n\t  if (__first[__parent] < __first[__child])\n\t    return false;\n\t  if ((__child & 1) == 0)\n\t    ++__parent;\n\t}\n      return true;\n    }\n\n  template<typename _RandomAccessIterator, typename _Distance,\n           typename _StrictWeakOrdering>\n    bool\n    __is_heap(_RandomAccessIterator __first, _StrictWeakOrdering __comp,\n\t      _Distance __n)\n    {\n      _Distance __parent = 0;\n      for (_Distance __child = 1; __child < __n; ++__child)\n\t{\n\t  if (__comp(__first[__parent], __first[__child]))\n\t    return false;\n\t  if ((__child & 1) == 0)\n\t    ++__parent;\n\t}\n      return true;\n    }\n\n  template<typename _RandomAccessIterator>\n    bool\n    __is_heap(_RandomAccessIterator __first, _RandomAccessIterator __last)\n    { return std::__is_heap(__first, std::distance(__first, __last)); }\n\n  template<typename _RandomAccessIterator, typename _StrictWeakOrdering>\n    bool\n    __is_heap(_RandomAccessIterator __first, _RandomAccessIterator __last,\n\t    _StrictWeakOrdering __comp)\n    { return std::__is_heap(__first, __comp, std::distance(__first, __last)); }\n\n  // Heap-manipulation functions: push_heap, pop_heap, make_heap, sort_heap.\n\n  template<typename _RandomAccessIterator, typename _Distance, typename _Tp>\n    void\n    __push_heap(_RandomAccessIterator __first,\n\t\t_Distance __holeIndex, _Distance __topIndex, _Tp __value)\n    {\n      _Distance __parent = (__holeIndex - 1) / 2;\n      while (__holeIndex > __topIndex && *(__first + __parent) < __value)\n\t{\n\t  *(__first + __holeIndex) = *(__first + __parent);\n\t  __holeIndex = __parent;\n\t  __parent = (__holeIndex - 1) / 2;\n\t}\n      *(__first + __holeIndex) = __value;\n    }\n\n  /**\n   *  @brief  Push an element onto a heap.\n   *  @param  first  Start of heap.\n   *  @param  last   End of heap + element.\n   *  @ingroup heap\n   *\n   *  This operation pushes the element at last-1 onto the valid heap over the\n   *  range [first,last-1).  After completion, [first,last) is a valid heap.\n  */\n  template<typename _RandomAccessIterator>\n    inline void\n    push_heap(_RandomAccessIterator __first, _RandomAccessIterator __last)\n    {\n      typedef typename iterator_traits<_RandomAccessIterator>::value_type\n\t  _ValueType;\n      typedef typename iterator_traits<_RandomAccessIterator>::difference_type\n\t  _DistanceType;\n\n      // concept requirements\n      __glibcxx_function_requires(_Mutable_RandomAccessIteratorConcept<\n\t    _RandomAccessIterator>)\n      __glibcxx_function_requires(_LessThanComparableConcept<_ValueType>)\n      __glibcxx_requires_valid_range(__first, __last);\n      //      __glibcxx_requires_heap(__first, __last - 1);\n\n      std::__push_heap(__first, _DistanceType((__last - __first) - 1),\n\t\t       _DistanceType(0), _ValueType(*(__last - 1)));\n    }\n\n  template<typename _RandomAccessIterator, typename _Distance, typename _Tp,\n\t    typename _Compare>\n    void\n    __push_heap(_RandomAccessIterator __first, _Distance __holeIndex,\n\t\t_Distance __topIndex, _Tp __value, _Compare __comp)\n    {\n      _Distance __parent = (__holeIndex - 1) / 2;\n      while (__holeIndex > __topIndex\n\t     && __comp(*(__first + __parent), __value))\n\t{\n\t  *(__first + __holeIndex) = *(__first + __parent);\n\t  __holeIndex = __parent;\n\t  __parent = (__holeIndex - 1) / 2;\n\t}\n      *(__first + __holeIndex) = __value;\n    }\n\n  /**\n   *  @brief  Push an element onto a heap using comparison functor.\n   *  @param  first  Start of heap.\n   *  @param  last   End of heap + element.\n   *  @param  comp   Comparison functor.\n   *  @ingroup heap\n   *\n   *  This operation pushes the element at last-1 onto the valid heap over the\n   *  range [first,last-1).  After completion, [first,last) is a valid heap.\n   *  Compare operations are performed using comp.\n  */\n  template<typename _RandomAccessIterator, typename _Compare>\n    inline void\n    push_heap(_RandomAccessIterator __first, _RandomAccessIterator __last,\n\t      _Compare __comp)\n    {\n      typedef typename iterator_traits<_RandomAccessIterator>::value_type\n\t  _ValueType;\n      typedef typename iterator_traits<_RandomAccessIterator>::difference_type\n\t  _DistanceType;\n\n      // concept requirements\n      __glibcxx_function_requires(_Mutable_RandomAccessIteratorConcept<\n\t    _RandomAccessIterator>)\n      __glibcxx_requires_valid_range(__first, __last);\n      __glibcxx_requires_heap_pred(__first, __last - 1, __comp);\n\n      std::__push_heap(__first, _DistanceType((__last - __first) - 1),\n\t\t       _DistanceType(0), _ValueType(*(__last - 1)), __comp);\n    }\n\n  template<typename _RandomAccessIterator, typename _Distance, typename _Tp>\n    void\n    __adjust_heap(_RandomAccessIterator __first, _Distance __holeIndex,\n\t\t  _Distance __len, _Tp __value)\n    {\n      const _Distance __topIndex = __holeIndex;\n      _Distance __secondChild = 2 * __holeIndex + 2;\n      while (__secondChild < __len)\n\t{\n\t  if (*(__first + __secondChild) < *(__first + (__secondChild - 1)))\n\t    __secondChild--;\n\t  *(__first + __holeIndex) = *(__first + __secondChild);\n\t  __holeIndex = __secondChild;\n\t  __secondChild = 2 * (__secondChild + 1);\n\t}\n      if (__secondChild == __len)\n\t{\n\t  *(__first + __holeIndex) = *(__first + (__secondChild - 1));\n\t  __holeIndex = __secondChild - 1;\n\t}\n      std::__push_heap(__first, __holeIndex, __topIndex, __value);\n    }\n\n  template<typename _RandomAccessIterator, typename _Tp>\n    inline void\n    __pop_heap(_RandomAccessIterator __first, _RandomAccessIterator __last,\n\t       _RandomAccessIterator __result, _Tp __value)\n    {\n      typedef typename iterator_traits<_RandomAccessIterator>::difference_type\n\t_Distance;\n      *__result = *__first;\n      std::__adjust_heap(__first, _Distance(0), _Distance(__last - __first),\n\t\t\t __value);\n    }\n\n  /**\n   *  @brief  Pop an element off a heap.\n   *  @param  first  Start of heap.\n   *  @param  last   End of heap.\n   *  @ingroup heap\n   *\n   *  This operation pops the top of the heap.  The elements first and last-1\n   *  are swapped and [first,last-1) is made into a heap.\n  */\n  template<typename _RandomAccessIterator>\n    inline void\n    pop_heap(_RandomAccessIterator __first, _RandomAccessIterator __last)\n    {\n      typedef typename iterator_traits<_RandomAccessIterator>::value_type\n\t_ValueType;\n\n      // concept requirements\n      __glibcxx_function_requires(_Mutable_RandomAccessIteratorConcept<\n\t    _RandomAccessIterator>)\n      __glibcxx_function_requires(_LessThanComparableConcept<_ValueType>)\n      __glibcxx_requires_valid_range(__first, __last);\n      __glibcxx_requires_heap(__first, __last);\n\n      std::__pop_heap(__first, __last - 1, __last - 1,\n\t\t      _ValueType(*(__last - 1)));\n    }\n\n  template<typename _RandomAccessIterator, typename _Distance,\n\t   typename _Tp, typename _Compare>\n    void\n    __adjust_heap(_RandomAccessIterator __first, _Distance __holeIndex,\n\t\t  _Distance __len, _Tp __value, _Compare __comp)\n    {\n      const _Distance __topIndex = __holeIndex;\n      _Distance __secondChild = 2 * __holeIndex + 2;\n      while (__secondChild < __len)\n\t{\n\t  if (__comp(*(__first + __secondChild),\n\t\t     *(__first + (__secondChild - 1))))\n\t    __secondChild--;\n\t  *(__first + __holeIndex) = *(__first + __secondChild);\n\t  __holeIndex = __secondChild;\n\t  __secondChild = 2 * (__secondChild + 1);\n\t}\n      if (__secondChild == __len)\n\t{\n\t  *(__first + __holeIndex) = *(__first + (__secondChild - 1));\n\t  __holeIndex = __secondChild - 1;\n\t}\n      std::__push_heap(__first, __holeIndex, __topIndex, __value, __comp);\n    }\n\n  template<typename _RandomAccessIterator, typename _Tp, typename _Compare>\n    inline void\n    __pop_heap(_RandomAccessIterator __first, _RandomAccessIterator __last,\n\t       _RandomAccessIterator __result, _Tp __value, _Compare __comp)\n    {\n      typedef typename iterator_traits<_RandomAccessIterator>::difference_type\n\t_Distance;\n      *__result = *__first;\n      std::__adjust_heap(__first, _Distance(0), _Distance(__last - __first),\n\t\t\t __value, __comp);\n    }\n\n  /**\n   *  @brief  Pop an element off a heap using comparison functor.\n   *  @param  first  Start of heap.\n   *  @param  last   End of heap.\n   *  @param  comp   Comparison functor to use.\n   *  @ingroup heap\n   *\n   *  This operation pops the top of the heap.  The elements first and last-1\n   *  are swapped and [first,last-1) is made into a heap.  Comparisons are\n   *  made using comp.\n  */\n  template<typename _RandomAccessIterator, typename _Compare>\n    inline void\n    pop_heap(_RandomAccessIterator __first,\n\t     _RandomAccessIterator __last, _Compare __comp)\n    {\n      // concept requirements\n      __glibcxx_function_requires(_Mutable_RandomAccessIteratorConcept<\n\t    _RandomAccessIterator>)\n      __glibcxx_requires_valid_range(__first, __last);\n      __glibcxx_requires_heap_pred(__first, __last, __comp);\n\n      typedef typename iterator_traits<_RandomAccessIterator>::value_type\n\t_ValueType;\n      std::__pop_heap(__first, __last - 1, __last - 1,\n\t\t      _ValueType(*(__last - 1)), __comp);\n    }\n\n  /**\n   *  @brief  Construct a heap over a range.\n   *  @param  first  Start of heap.\n   *  @param  last   End of heap.\n   *  @ingroup heap\n   *\n   *  This operation makes the elements in [first,last) into a heap.\n  */\n  template<typename _RandomAccessIterator>\n    void\n    make_heap(_RandomAccessIterator __first, _RandomAccessIterator __last)\n    {\n      typedef typename iterator_traits<_RandomAccessIterator>::value_type\n\t  _ValueType;\n      typedef typename iterator_traits<_RandomAccessIterator>::difference_type\n\t  _DistanceType;\n\n      // concept requirements\n      __glibcxx_function_requires(_Mutable_RandomAccessIteratorConcept<\n\t    _RandomAccessIterator>)\n      __glibcxx_function_requires(_LessThanComparableConcept<_ValueType>)\n      __glibcxx_requires_valid_range(__first, __last);\n\n      if (__last - __first < 2)\n\treturn;\n\n      const _DistanceType __len = __last - __first;\n      _DistanceType __parent = (__len - 2) / 2;\n      while (true)\n\t{\n\t  std::__adjust_heap(__first, __parent, __len,\n\t\t\t     _ValueType(*(__first + __parent)));\n\t  if (__parent == 0)\n\t    return;\n\t  __parent--;\n\t}\n    }\n\n  /**\n   *  @brief  Construct a heap over a range using comparison functor.\n   *  @param  first  Start of heap.\n   *  @param  last   End of heap.\n   *  @param  comp   Comparison functor to use.\n   *  @ingroup heap\n   *\n   *  This operation makes the elements in [first,last) into a heap.\n   *  Comparisons are made using comp.\n  */\n  template<typename _RandomAccessIterator, typename _Compare>\n    inline void\n    make_heap(_RandomAccessIterator __first, _RandomAccessIterator __last,\n\t      _Compare __comp)\n    {\n      typedef typename iterator_traits<_RandomAccessIterator>::value_type\n\t  _ValueType;\n      typedef typename iterator_traits<_RandomAccessIterator>::difference_type\n\t  _DistanceType;\n\n      // concept requirements\n      __glibcxx_function_requires(_Mutable_RandomAccessIteratorConcept<\n\t    _RandomAccessIterator>)\n      __glibcxx_requires_valid_range(__first, __last);\n\n      if (__last - __first < 2)\n\treturn;\n\n      const _DistanceType __len = __last - __first;\n      _DistanceType __parent = (__len - 2) / 2;\n      while (true)\n\t{\n\t  std::__adjust_heap(__first, __parent, __len,\n\t\t\t     _ValueType(*(__first + __parent)), __comp);\n\t  if (__parent == 0)\n\t    return;\n\t  __parent--;\n\t}\n    }\n\n  /**\n   *  @brief  Sort a heap.\n   *  @param  first  Start of heap.\n   *  @param  last   End of heap.\n   *  @ingroup heap\n   *\n   *  This operation sorts the valid heap in the range [first,last).\n  */\n  template<typename _RandomAccessIterator>\n    void\n    sort_heap(_RandomAccessIterator __first, _RandomAccessIterator __last)\n    {\n      // concept requirements\n      __glibcxx_function_requires(_Mutable_RandomAccessIteratorConcept<\n\t    _RandomAccessIterator>)\n      __glibcxx_function_requires(_LessThanComparableConcept<\n\t    typename iterator_traits<_RandomAccessIterator>::value_type>)\n      __glibcxx_requires_valid_range(__first, __last);\n      //      __glibcxx_requires_heap(__first, __last);\n\n      while (__last - __first > 1)\n\tstd::pop_heap(__first, _RandomAccessIterator(__last--));\n    }\n\n  /**\n   *  @brief  Sort a heap using comparison functor.\n   *  @param  first  Start of heap.\n   *  @param  last   End of heap.\n   *  @param  comp   Comparison functor to use.\n   *  @ingroup heap\n   *\n   *  This operation sorts the valid heap in the range [first,last).\n   *  Comparisons are made using comp.\n  */\n  template<typename _RandomAccessIterator, typename _Compare>\n    void\n    sort_heap(_RandomAccessIterator __first, _RandomAccessIterator __last,\n\t      _Compare __comp)\n    {\n      // concept requirements\n      __glibcxx_function_requires(_Mutable_RandomAccessIteratorConcept<\n\t    _RandomAccessIterator>)\n      __glibcxx_requires_valid_range(__first, __last);\n      __glibcxx_requires_heap_pred(__first, __last, __comp);\n\n      while (__last - __first > 1)\n\tstd::pop_heap(__first, _RandomAccessIterator(__last--), __comp);\n    }\n\n_GLIBCXX_END_NAMESPACE\n\n#endif /* _STL_HEAP_H */\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/bits/stl_iterator.h",
    "content": "// Iterators -*- C++ -*-\n\n// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006\n// Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n/*\n *\n * Copyright (c) 1994\n * Hewlett-Packard Company\n *\n * Permission to use, copy, modify, distribute and sell this software\n * and its documentation for any purpose is hereby granted without fee,\n * provided that the above copyright notice appear in all copies and\n * that both that copyright notice and this permission notice appear\n * in supporting documentation.  Hewlett-Packard Company makes no\n * representations about the suitability of this software for any\n * purpose.  It is provided \"as is\" without express or implied warranty.\n *\n *\n * Copyright (c) 1996-1998\n * Silicon Graphics Computer Systems, Inc.\n *\n * Permission to use, copy, modify, distribute and sell this software\n * and its documentation for any purpose is hereby granted without fee,\n * provided that the above copyright notice appear in all copies and\n * that both that copyright notice and this permission notice appear\n * in supporting documentation.  Silicon Graphics makes no\n * representations about the suitability of this software for any\n * purpose.  It is provided \"as is\" without express or implied warranty.\n */\n\n/** @file stl_iterator.h\n *  This is an internal header file, included by other library headers.\n *  You should not attempt to use it directly.\n *\n *  This file implements reverse_iterator, back_insert_iterator,\n *  front_insert_iterator, insert_iterator, __normal_iterator, and their\n *  supporting functions and overloaded operators.\n */\n\n#ifndef _ITERATOR_H\n#define _ITERATOR_H 1\n\n#include <bits/cpp_type_traits.h>\n#include <ext/type_traits.h>\n\n_GLIBCXX_BEGIN_NAMESPACE(std)\n\n  // 24.4.1 Reverse iterators\n  /**\n   *  \"Bidirectional and random access iterators have corresponding reverse\n   *  %iterator adaptors that iterate through the data structure in the\n   *  opposite direction.  They have the same signatures as the corresponding\n   *  iterators.  The fundamental relation between a reverse %iterator and its\n   *  corresponding %iterator @c i is established by the identity:\n   *  @code\n   *      &*(reverse_iterator(i)) == &*(i - 1)\n   *  @endcode\n   *\n   *  This mapping is dictated by the fact that while there is always a\n   *  pointer past the end of an array, there might not be a valid pointer\n   *  before the beginning of an array.\" [24.4.1]/1,2\n   *\n   *  Reverse iterators can be tricky and surprising at first.  Their\n   *  semantics make sense, however, and the trickiness is a side effect of\n   *  the requirement that the iterators must be safe.\n  */\n  template<typename _Iterator>\n    class reverse_iterator\n    : public iterator<typename iterator_traits<_Iterator>::iterator_category,\n\t\t      typename iterator_traits<_Iterator>::value_type,\n\t\t      typename iterator_traits<_Iterator>::difference_type,\n\t\t      typename iterator_traits<_Iterator>::pointer,\n                      typename iterator_traits<_Iterator>::reference>\n    {\n    protected:\n      _Iterator current;\n\n    public:\n      typedef _Iterator\t\t\t\t\t       iterator_type;\n      typedef typename iterator_traits<_Iterator>::difference_type\n\t\t\t\t\t\t\t       difference_type;\n      typedef typename iterator_traits<_Iterator>::reference   reference;\n      typedef typename iterator_traits<_Iterator>::pointer     pointer;\n\n    public:\n      /**\n       *  The default constructor default-initializes member @p current.\n       *  If it is a pointer, that means it is zero-initialized.\n      */\n      // _GLIBCXX_RESOLVE_LIB_DEFECTS\n      // 235 No specification of default ctor for reverse_iterator\n      reverse_iterator() : current() { }\n\n      /**\n       *  This %iterator will move in the opposite direction that @p x does.\n      */\n      explicit\n      reverse_iterator(iterator_type __x) : current(__x) { }\n\n      /**\n       *  The copy constructor is normal.\n      */\n      reverse_iterator(const reverse_iterator& __x)\n      : current(__x.current) { }\n\n      /**\n       *  A reverse_iterator across other types can be copied in the normal\n       *  fashion.\n      */\n      template<typename _Iter>\n        reverse_iterator(const reverse_iterator<_Iter>& __x)\n\t: current(__x.base()) { }\n\n      /**\n       *  @return  @c current, the %iterator used for underlying work.\n      */\n      iterator_type\n      base() const\n      { return current; }\n\n      /**\n       *  @return  TODO\n       *\n       *  @doctodo\n      */\n      reference\n      operator*() const\n      {\n\t_Iterator __tmp = current;\n\treturn *--__tmp;\n      }\n\n      /**\n       *  @return  TODO\n       *\n       *  @doctodo\n      */\n      pointer\n      operator->() const\n      { return &(operator*()); }\n\n      /**\n       *  @return  TODO\n       *\n       *  @doctodo\n      */\n      reverse_iterator&\n      operator++()\n      {\n\t--current;\n\treturn *this;\n      }\n\n      /**\n       *  @return  TODO\n       *\n       *  @doctodo\n      */\n      reverse_iterator\n      operator++(int)\n      {\n\treverse_iterator __tmp = *this;\n\t--current;\n\treturn __tmp;\n      }\n\n      /**\n       *  @return  TODO\n       *\n       *  @doctodo\n      */\n      reverse_iterator&\n      operator--()\n      {\n\t++current;\n\treturn *this;\n      }\n\n      /**\n       *  @return  TODO\n       *\n       *  @doctodo\n      */\n      reverse_iterator\n      operator--(int)\n      {\n\treverse_iterator __tmp = *this;\n\t++current;\n\treturn __tmp;\n      }\n\n      /**\n       *  @return  TODO\n       *\n       *  @doctodo\n      */\n      reverse_iterator\n      operator+(difference_type __n) const\n      { return reverse_iterator(current - __n); }\n\n      /**\n       *  @return  TODO\n       *\n       *  @doctodo\n      */\n      reverse_iterator&\n      operator+=(difference_type __n)\n      {\n\tcurrent -= __n;\n\treturn *this;\n      }\n\n      /**\n       *  @return  TODO\n       *\n       *  @doctodo\n      */\n      reverse_iterator\n      operator-(difference_type __n) const\n      { return reverse_iterator(current + __n); }\n\n      /**\n       *  @return  TODO\n       *\n       *  @doctodo\n      */\n      reverse_iterator&\n      operator-=(difference_type __n)\n      {\n\tcurrent += __n;\n\treturn *this;\n      }\n\n      /**\n       *  @return  TODO\n       *\n       *  @doctodo\n      */\n      reference\n      operator[](difference_type __n) const\n      { return *(*this + __n); }\n    };\n\n  //@{\n  /**\n   *  @param  x  A %reverse_iterator.\n   *  @param  y  A %reverse_iterator.\n   *  @return  A simple bool.\n   *\n   *  Reverse iterators forward many operations to their underlying base()\n   *  iterators.  Others are implemented in terms of one another.\n   *\n  */\n  template<typename _Iterator>\n    inline bool\n    operator==(const reverse_iterator<_Iterator>& __x,\n\t       const reverse_iterator<_Iterator>& __y)\n    { return __x.base() == __y.base(); }\n\n  template<typename _Iterator>\n    inline bool\n    operator<(const reverse_iterator<_Iterator>& __x,\n\t      const reverse_iterator<_Iterator>& __y)\n    { return __y.base() < __x.base(); }\n\n  template<typename _Iterator>\n    inline bool\n    operator!=(const reverse_iterator<_Iterator>& __x,\n\t       const reverse_iterator<_Iterator>& __y)\n    { return !(__x == __y); }\n\n  template<typename _Iterator>\n    inline bool\n    operator>(const reverse_iterator<_Iterator>& __x,\n\t      const reverse_iterator<_Iterator>& __y)\n    { return __y < __x; }\n\n  template<typename _Iterator>\n    inline bool\n    operator<=(const reverse_iterator<_Iterator>& __x,\n\t       const reverse_iterator<_Iterator>& __y)\n    { return !(__y < __x); }\n\n  template<typename _Iterator>\n    inline bool\n    operator>=(const reverse_iterator<_Iterator>& __x,\n\t       const reverse_iterator<_Iterator>& __y)\n    { return !(__x < __y); }\n\n  template<typename _Iterator>\n    inline typename reverse_iterator<_Iterator>::difference_type\n    operator-(const reverse_iterator<_Iterator>& __x,\n\t      const reverse_iterator<_Iterator>& __y)\n    { return __y.base() - __x.base(); }\n\n  template<typename _Iterator>\n    inline reverse_iterator<_Iterator>\n    operator+(typename reverse_iterator<_Iterator>::difference_type __n,\n\t      const reverse_iterator<_Iterator>& __x)\n    { return reverse_iterator<_Iterator>(__x.base() - __n); }\n\n  // _GLIBCXX_RESOLVE_LIB_DEFECTS\n  // DR 280. Comparison of reverse_iterator to const reverse_iterator.\n  template<typename _IteratorL, typename _IteratorR>\n    inline bool\n    operator==(const reverse_iterator<_IteratorL>& __x,\n\t       const reverse_iterator<_IteratorR>& __y)\n    { return __x.base() == __y.base(); }\n\n  template<typename _IteratorL, typename _IteratorR>\n    inline bool\n    operator<(const reverse_iterator<_IteratorL>& __x,\n\t      const reverse_iterator<_IteratorR>& __y)\n    { return __y.base() < __x.base(); }\n\n  template<typename _IteratorL, typename _IteratorR>\n    inline bool\n    operator!=(const reverse_iterator<_IteratorL>& __x,\n\t       const reverse_iterator<_IteratorR>& __y)\n    { return !(__x == __y); }\n\n  template<typename _IteratorL, typename _IteratorR>\n    inline bool\n    operator>(const reverse_iterator<_IteratorL>& __x,\n\t      const reverse_iterator<_IteratorR>& __y)\n    { return __y < __x; }\n\n  template<typename _IteratorL, typename _IteratorR>\n    inline bool\n    operator<=(const reverse_iterator<_IteratorL>& __x,\n\t       const reverse_iterator<_IteratorR>& __y)\n    { return !(__y < __x); }\n\n  template<typename _IteratorL, typename _IteratorR>\n    inline bool\n    operator>=(const reverse_iterator<_IteratorL>& __x,\n\t       const reverse_iterator<_IteratorR>& __y)\n    { return !(__x < __y); }\n\n  template<typename _IteratorL, typename _IteratorR>\n    inline typename reverse_iterator<_IteratorL>::difference_type\n    operator-(const reverse_iterator<_IteratorL>& __x,\n\t      const reverse_iterator<_IteratorR>& __y)\n    { return __y.base() - __x.base(); }\n  //@}\n\n  // 24.4.2.2.1 back_insert_iterator\n  /**\n   *  @brief  Turns assignment into insertion.\n   *\n   *  These are output iterators, constructed from a container-of-T.\n   *  Assigning a T to the iterator appends it to the container using\n   *  push_back.\n   *\n   *  Tip:  Using the back_inserter function to create these iterators can\n   *  save typing.\n  */\n  template<typename _Container>\n    class back_insert_iterator\n    : public iterator<output_iterator_tag, void, void, void, void>\n    {\n    protected:\n      _Container* container;\n\n    public:\n      /// A nested typedef for the type of whatever container you used.\n      typedef _Container          container_type;\n\n      /// The only way to create this %iterator is with a container.\n      explicit\n      back_insert_iterator(_Container& __x) : container(&__x) { }\n\n      /**\n       *  @param  value  An instance of whatever type\n       *                 container_type::const_reference is; presumably a\n       *                 reference-to-const T for container<T>.\n       *  @return  This %iterator, for chained operations.\n       *\n       *  This kind of %iterator doesn't really have a \"position\" in the\n       *  container (you can think of the position as being permanently at\n       *  the end, if you like).  Assigning a value to the %iterator will\n       *  always append the value to the end of the container.\n      */\n      back_insert_iterator&\n      operator=(typename _Container::const_reference __value)\n      {\n\tcontainer->push_back(__value);\n\treturn *this;\n      }\n\n      /// Simply returns *this.\n      back_insert_iterator&\n      operator*()\n      { return *this; }\n\n      /// Simply returns *this.  (This %iterator does not \"move\".)\n      back_insert_iterator&\n      operator++()\n      { return *this; }\n\n      /// Simply returns *this.  (This %iterator does not \"move\".)\n      back_insert_iterator\n      operator++(int)\n      { return *this; }\n    };\n\n  /**\n   *  @param  x  A container of arbitrary type.\n   *  @return  An instance of back_insert_iterator working on @p x.\n   *\n   *  This wrapper function helps in creating back_insert_iterator instances.\n   *  Typing the name of the %iterator requires knowing the precise full\n   *  type of the container, which can be tedious and impedes generic\n   *  programming.  Using this function lets you take advantage of automatic\n   *  template parameter deduction, making the compiler match the correct\n   *  types for you.\n  */\n  template<typename _Container>\n    inline back_insert_iterator<_Container>\n    back_inserter(_Container& __x)\n    { return back_insert_iterator<_Container>(__x); }\n\n  /**\n   *  @brief  Turns assignment into insertion.\n   *\n   *  These are output iterators, constructed from a container-of-T.\n   *  Assigning a T to the iterator prepends it to the container using\n   *  push_front.\n   *\n   *  Tip:  Using the front_inserter function to create these iterators can\n   *  save typing.\n  */\n  template<typename _Container>\n    class front_insert_iterator\n    : public iterator<output_iterator_tag, void, void, void, void>\n    {\n    protected:\n      _Container* container;\n\n    public:\n      /// A nested typedef for the type of whatever container you used.\n      typedef _Container          container_type;\n\n      /// The only way to create this %iterator is with a container.\n      explicit front_insert_iterator(_Container& __x) : container(&__x) { }\n\n      /**\n       *  @param  value  An instance of whatever type\n       *                 container_type::const_reference is; presumably a\n       *                 reference-to-const T for container<T>.\n       *  @return  This %iterator, for chained operations.\n       *\n       *  This kind of %iterator doesn't really have a \"position\" in the\n       *  container (you can think of the position as being permanently at\n       *  the front, if you like).  Assigning a value to the %iterator will\n       *  always prepend the value to the front of the container.\n      */\n      front_insert_iterator&\n      operator=(typename _Container::const_reference __value)\n      {\n\tcontainer->push_front(__value);\n\treturn *this;\n      }\n\n      /// Simply returns *this.\n      front_insert_iterator&\n      operator*()\n      { return *this; }\n\n      /// Simply returns *this.  (This %iterator does not \"move\".)\n      front_insert_iterator&\n      operator++()\n      { return *this; }\n\n      /// Simply returns *this.  (This %iterator does not \"move\".)\n      front_insert_iterator\n      operator++(int)\n      { return *this; }\n    };\n\n  /**\n   *  @param  x  A container of arbitrary type.\n   *  @return  An instance of front_insert_iterator working on @p x.\n   *\n   *  This wrapper function helps in creating front_insert_iterator instances.\n   *  Typing the name of the %iterator requires knowing the precise full\n   *  type of the container, which can be tedious and impedes generic\n   *  programming.  Using this function lets you take advantage of automatic\n   *  template parameter deduction, making the compiler match the correct\n   *  types for you.\n  */\n  template<typename _Container>\n    inline front_insert_iterator<_Container>\n    front_inserter(_Container& __x)\n    { return front_insert_iterator<_Container>(__x); }\n\n  /**\n   *  @brief  Turns assignment into insertion.\n   *\n   *  These are output iterators, constructed from a container-of-T.\n   *  Assigning a T to the iterator inserts it in the container at the\n   *  %iterator's position, rather than overwriting the value at that\n   *  position.\n   *\n   *  (Sequences will actually insert a @e copy of the value before the\n   *  %iterator's position.)\n   *\n   *  Tip:  Using the inserter function to create these iterators can\n   *  save typing.\n  */\n  template<typename _Container>\n    class insert_iterator\n    : public iterator<output_iterator_tag, void, void, void, void>\n    {\n    protected:\n      _Container* container;\n      typename _Container::iterator iter;\n\n    public:\n      /// A nested typedef for the type of whatever container you used.\n      typedef _Container          container_type;\n\n      /**\n       *  The only way to create this %iterator is with a container and an\n       *  initial position (a normal %iterator into the container).\n      */\n      insert_iterator(_Container& __x, typename _Container::iterator __i)\n      : container(&__x), iter(__i) {}\n\n      /**\n       *  @param  value  An instance of whatever type\n       *                 container_type::const_reference is; presumably a\n       *                 reference-to-const T for container<T>.\n       *  @return  This %iterator, for chained operations.\n       *\n       *  This kind of %iterator maintains its own position in the\n       *  container.  Assigning a value to the %iterator will insert the\n       *  value into the container at the place before the %iterator.\n       *\n       *  The position is maintained such that subsequent assignments will\n       *  insert values immediately after one another.  For example,\n       *  @code\n       *     // vector v contains A and Z\n       *\n       *     insert_iterator i (v, ++v.begin());\n       *     i = 1;\n       *     i = 2;\n       *     i = 3;\n       *\n       *     // vector v contains A, 1, 2, 3, and Z\n       *  @endcode\n      */\n      insert_iterator&\n      operator=(const typename _Container::const_reference __value)\n      {\n\titer = container->insert(iter, __value);\n\t++iter;\n\treturn *this;\n      }\n\n      /// Simply returns *this.\n      insert_iterator&\n      operator*()\n      { return *this; }\n\n      /// Simply returns *this.  (This %iterator does not \"move\".)\n      insert_iterator&\n      operator++()\n      { return *this; }\n\n      /// Simply returns *this.  (This %iterator does not \"move\".)\n      insert_iterator&\n      operator++(int)\n      { return *this; }\n    };\n\n  /**\n   *  @param  x  A container of arbitrary type.\n   *  @return  An instance of insert_iterator working on @p x.\n   *\n   *  This wrapper function helps in creating insert_iterator instances.\n   *  Typing the name of the %iterator requires knowing the precise full\n   *  type of the container, which can be tedious and impedes generic\n   *  programming.  Using this function lets you take advantage of automatic\n   *  template parameter deduction, making the compiler match the correct\n   *  types for you.\n  */\n  template<typename _Container, typename _Iterator>\n    inline insert_iterator<_Container>\n    inserter(_Container& __x, _Iterator __i)\n    {\n      return insert_iterator<_Container>(__x,\n\t\t\t\t\t typename _Container::iterator(__i));\n    }\n\n_GLIBCXX_END_NAMESPACE\n\n_GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)\n\n  // This iterator adapter is 'normal' in the sense that it does not\n  // change the semantics of any of the operators of its iterator\n  // parameter.  Its primary purpose is to convert an iterator that is\n  // not a class, e.g. a pointer, into an iterator that is a class.\n  // The _Container parameter exists solely so that different containers\n  // using this template can instantiate different types, even if the\n  // _Iterator parameter is the same.\n  using std::iterator_traits;\n  using std::iterator;\n  template<typename _Iterator, typename _Container>\n    class __normal_iterator\n    {\n    protected:\n      _Iterator _M_current;\n\n    public:\n      typedef typename iterator_traits<_Iterator>::iterator_category\n                                                             iterator_category;\n      typedef typename iterator_traits<_Iterator>::value_type  value_type;\n      typedef typename iterator_traits<_Iterator>::difference_type\n                                                             difference_type;\n      typedef typename iterator_traits<_Iterator>::reference reference;\n      typedef typename iterator_traits<_Iterator>::pointer   pointer;\n\n      __normal_iterator() : _M_current(_Iterator()) { }\n\n      explicit\n      __normal_iterator(const _Iterator& __i) : _M_current(__i) { }\n\n      // Allow iterator to const_iterator conversion\n      template<typename _Iter>\n        __normal_iterator(const __normal_iterator<_Iter,\n\t\t\t  typename __enable_if<\n      \t       (std::__are_same<_Iter, typename _Container::pointer>::__value),\n\t\t      _Container>::__type>& __i)\n        : _M_current(__i.base()) { }\n\n      // Forward iterator requirements\n      reference\n      operator*() const\n      { return *_M_current; }\n\n      pointer\n      operator->() const\n      { return _M_current; }\n\n      __normal_iterator&\n      operator++()\n      {\n\t++_M_current;\n\treturn *this;\n      }\n\n      __normal_iterator\n      operator++(int)\n      { return __normal_iterator(_M_current++); }\n\n      // Bidirectional iterator requirements\n      __normal_iterator&\n      operator--()\n      {\n\t--_M_current;\n\treturn *this;\n      }\n\n      __normal_iterator\n      operator--(int)\n      { return __normal_iterator(_M_current--); }\n\n      // Random access iterator requirements\n      reference\n      operator[](const difference_type& __n) const\n      { return _M_current[__n]; }\n\n      __normal_iterator&\n      operator+=(const difference_type& __n)\n      { _M_current += __n; return *this; }\n\n      __normal_iterator\n      operator+(const difference_type& __n) const\n      { return __normal_iterator(_M_current + __n); }\n\n      __normal_iterator&\n      operator-=(const difference_type& __n)\n      { _M_current -= __n; return *this; }\n\n      __normal_iterator\n      operator-(const difference_type& __n) const\n      { return __normal_iterator(_M_current - __n); }\n\n      const _Iterator&\n      base() const\n      { return _M_current; }\n    };\n\n  // Note: In what follows, the left- and right-hand-side iterators are\n  // allowed to vary in types (conceptually in cv-qualification) so that\n  // comparaison between cv-qualified and non-cv-qualified iterators be\n  // valid.  However, the greedy and unfriendly operators in std::rel_ops\n  // will make overload resolution ambiguous (when in scope) if we don't\n  // provide overloads whose operands are of the same type.  Can someone\n  // remind me what generic programming is about? -- Gaby\n\n  // Forward iterator requirements\n  template<typename _IteratorL, typename _IteratorR, typename _Container>\n    inline bool\n    operator==(const __normal_iterator<_IteratorL, _Container>& __lhs,\n\t       const __normal_iterator<_IteratorR, _Container>& __rhs)\n    { return __lhs.base() == __rhs.base(); }\n\n  template<typename _Iterator, typename _Container>\n    inline bool\n    operator==(const __normal_iterator<_Iterator, _Container>& __lhs,\n\t       const __normal_iterator<_Iterator, _Container>& __rhs)\n    { return __lhs.base() == __rhs.base(); }\n\n  template<typename _IteratorL, typename _IteratorR, typename _Container>\n    inline bool\n    operator!=(const __normal_iterator<_IteratorL, _Container>& __lhs,\n\t       const __normal_iterator<_IteratorR, _Container>& __rhs)\n    { return __lhs.base() != __rhs.base(); }\n\n  template<typename _Iterator, typename _Container>\n    inline bool\n    operator!=(const __normal_iterator<_Iterator, _Container>& __lhs,\n\t       const __normal_iterator<_Iterator, _Container>& __rhs)\n    { return __lhs.base() != __rhs.base(); }\n\n  // Random access iterator requirements\n  template<typename _IteratorL, typename _IteratorR, typename _Container>\n    inline bool\n    operator<(const __normal_iterator<_IteratorL, _Container>& __lhs,\n\t      const __normal_iterator<_IteratorR, _Container>& __rhs)\n    { return __lhs.base() < __rhs.base(); }\n\n  template<typename _Iterator, typename _Container>\n    inline bool\n    operator<(const __normal_iterator<_Iterator, _Container>& __lhs,\n\t      const __normal_iterator<_Iterator, _Container>& __rhs)\n    { return __lhs.base() < __rhs.base(); }\n\n  template<typename _IteratorL, typename _IteratorR, typename _Container>\n    inline bool\n    operator>(const __normal_iterator<_IteratorL, _Container>& __lhs,\n\t      const __normal_iterator<_IteratorR, _Container>& __rhs)\n    { return __lhs.base() > __rhs.base(); }\n\n  template<typename _Iterator, typename _Container>\n    inline bool\n    operator>(const __normal_iterator<_Iterator, _Container>& __lhs,\n\t      const __normal_iterator<_Iterator, _Container>& __rhs)\n    { return __lhs.base() > __rhs.base(); }\n\n  template<typename _IteratorL, typename _IteratorR, typename _Container>\n    inline bool\n    operator<=(const __normal_iterator<_IteratorL, _Container>& __lhs,\n\t       const __normal_iterator<_IteratorR, _Container>& __rhs)\n    { return __lhs.base() <= __rhs.base(); }\n\n  template<typename _Iterator, typename _Container>\n    inline bool\n    operator<=(const __normal_iterator<_Iterator, _Container>& __lhs,\n\t       const __normal_iterator<_Iterator, _Container>& __rhs)\n    { return __lhs.base() <= __rhs.base(); }\n\n  template<typename _IteratorL, typename _IteratorR, typename _Container>\n    inline bool\n    operator>=(const __normal_iterator<_IteratorL, _Container>& __lhs,\n\t       const __normal_iterator<_IteratorR, _Container>& __rhs)\n    { return __lhs.base() >= __rhs.base(); }\n\n  template<typename _Iterator, typename _Container>\n    inline bool\n    operator>=(const __normal_iterator<_Iterator, _Container>& __lhs,\n\t       const __normal_iterator<_Iterator, _Container>& __rhs)\n    { return __lhs.base() >= __rhs.base(); }\n\n  // _GLIBCXX_RESOLVE_LIB_DEFECTS\n  // According to the resolution of DR179 not only the various comparison\n  // operators but also operator- must accept mixed iterator/const_iterator\n  // parameters.\n  template<typename _IteratorL, typename _IteratorR, typename _Container>\n    inline typename __normal_iterator<_IteratorL, _Container>::difference_type\n    operator-(const __normal_iterator<_IteratorL, _Container>& __lhs,\n\t      const __normal_iterator<_IteratorR, _Container>& __rhs)\n    { return __lhs.base() - __rhs.base(); }\n\n  template<typename _Iterator, typename _Container>\n    inline typename __normal_iterator<_Iterator, _Container>::difference_type\n    operator-(const __normal_iterator<_Iterator, _Container>& __lhs,\n\t      const __normal_iterator<_Iterator, _Container>& __rhs)\n    { return __lhs.base() - __rhs.base(); }\n\n  template<typename _Iterator, typename _Container>\n    inline __normal_iterator<_Iterator, _Container>\n    operator+(typename __normal_iterator<_Iterator, _Container>::difference_type\n\t      __n, const __normal_iterator<_Iterator, _Container>& __i)\n    { return __normal_iterator<_Iterator, _Container>(__i.base() + __n); }\n\n_GLIBCXX_END_NAMESPACE\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/bits/stl_iterator_base_funcs.h",
    "content": "// Functions used by iterators -*- C++ -*-\n\n// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006\n// Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n/*\n *\n * Copyright (c) 1994\n * Hewlett-Packard Company\n *\n * Permission to use, copy, modify, distribute and sell this software\n * and its documentation for any purpose is hereby granted without fee,\n * provided that the above copyright notice appear in all copies and\n * that both that copyright notice and this permission notice appear\n * in supporting documentation.  Hewlett-Packard Company makes no\n * representations about the suitability of this software for any\n * purpose.  It is provided \"as is\" without express or implied warranty.\n *\n *\n * Copyright (c) 1996-1998\n * Silicon Graphics Computer Systems, Inc.\n *\n * Permission to use, copy, modify, distribute and sell this software\n * and its documentation for any purpose is hereby granted without fee,\n * provided that the above copyright notice appear in all copies and\n * that both that copyright notice and this permission notice appear\n * in supporting documentation.  Silicon Graphics makes no\n * representations about the suitability of this software for any\n * purpose.  It is provided \"as is\" without express or implied warranty.\n */\n\n/** @file stl_iterator_base_funcs.h\n *  This is an internal header file, included by other library headers.\n *  You should not attempt to use it directly.\n *\n *  This file contains all of the general iterator-related utility\n *  functions, such as distance() and advance().\n */\n\n#ifndef _ITERATOR_BASE_FUNCS_H\n#define _ITERATOR_BASE_FUNCS_H 1\n\n#pragma GCC system_header\n#include <bits/concept_check.h>\n\n_GLIBCXX_BEGIN_NAMESPACE(std)\n\n  template<typename _InputIterator>\n    inline typename iterator_traits<_InputIterator>::difference_type\n    __distance(_InputIterator __first, _InputIterator __last,\n               input_iterator_tag)\n    {\n      // concept requirements\n      __glibcxx_function_requires(_InputIteratorConcept<_InputIterator>)\n\n      typename iterator_traits<_InputIterator>::difference_type __n = 0;\n      while (__first != __last)\n\t{\n\t  ++__first;\n\t  ++__n;\n\t}\n      return __n;\n    }\n\n  template<typename _RandomAccessIterator>\n    inline typename iterator_traits<_RandomAccessIterator>::difference_type\n    __distance(_RandomAccessIterator __first, _RandomAccessIterator __last,\n               random_access_iterator_tag)\n    {\n      // concept requirements\n      __glibcxx_function_requires(_RandomAccessIteratorConcept<\n\t\t\t\t  _RandomAccessIterator>)\n      return __last - __first;\n    }\n\n  /**\n   *  @brief A generalization of pointer arithmetic.\n   *  @param  first  An input iterator.\n   *  @param  last  An input iterator.\n   *  @return  The distance between them.\n   *\n   *  Returns @c n such that first + n == last.  This requires that @p last\n   *  must be reachable from @p first.  Note that @c n may be negative.\n   *\n   *  For random access iterators, this uses their @c + and @c - operations\n   *  and are constant time.  For other %iterator classes they are linear time.\n  */\n  template<typename _InputIterator>\n    inline typename iterator_traits<_InputIterator>::difference_type\n    distance(_InputIterator __first, _InputIterator __last)\n    {\n      // concept requirements -- taken care of in __distance\n      return std::__distance(__first, __last,\n\t\t\t     std::__iterator_category(__first));\n    }\n\n  template<typename _InputIterator, typename _Distance>\n    inline void\n    __advance(_InputIterator& __i, _Distance __n, input_iterator_tag)\n    {\n      // concept requirements\n      __glibcxx_function_requires(_InputIteratorConcept<_InputIterator>)\n      while (__n--)\n\t++__i;\n    }\n\n  template<typename _BidirectionalIterator, typename _Distance>\n    inline void\n    __advance(_BidirectionalIterator& __i, _Distance __n,\n\t      bidirectional_iterator_tag)\n    {\n      // concept requirements\n      __glibcxx_function_requires(_BidirectionalIteratorConcept<\n\t\t\t\t  _BidirectionalIterator>)\n      if (__n > 0)\n        while (__n--)\n\t  ++__i;\n      else\n        while (__n++)\n\t  --__i;\n    }\n\n  template<typename _RandomAccessIterator, typename _Distance>\n    inline void\n    __advance(_RandomAccessIterator& __i, _Distance __n,\n              random_access_iterator_tag)\n    {\n      // concept requirements\n      __glibcxx_function_requires(_RandomAccessIteratorConcept<\n\t\t\t\t  _RandomAccessIterator>)\n      __i += __n;\n    }\n\n  /**\n   *  @brief A generalization of pointer arithmetic.\n   *  @param  i  An input iterator.\n   *  @param  n  The \"delta\" by which to change @p i.\n   *  @return  Nothing.\n   *\n   *  This increments @p i by @p n.  For bidirectional and random access\n   *  iterators, @p n may be negative, in which case @p i is decremented.\n   *\n   *  For random access iterators, this uses their @c + and @c - operations\n   *  and are constant time.  For other %iterator classes they are linear time.\n  */\n  template<typename _InputIterator, typename _Distance>\n    inline void\n    advance(_InputIterator& __i, _Distance __n)\n    {\n      // concept requirements -- taken care of in __advance\n      typename iterator_traits<_InputIterator>::difference_type __d = __n;\n      std::__advance(__i, __d, std::__iterator_category(__i));\n    }\n\n_GLIBCXX_END_NAMESPACE\n\n#endif /* _ITERATOR_BASE_FUNCS_H */\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/bits/stl_iterator_base_types.h",
    "content": "// Types used in iterator implementation -*- C++ -*-\n\n// Copyright (C) 2001, 2002, 2004, 2005 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n/*\n *\n * Copyright (c) 1994\n * Hewlett-Packard Company\n *\n * Permission to use, copy, modify, distribute and sell this software\n * and its documentation for any purpose is hereby granted without fee,\n * provided that the above copyright notice appear in all copies and\n * that both that copyright notice and this permission notice appear\n * in supporting documentation.  Hewlett-Packard Company makes no\n * representations about the suitability of this software for any\n * purpose.  It is provided \"as is\" without express or implied warranty.\n *\n *\n * Copyright (c) 1996-1998\n * Silicon Graphics Computer Systems, Inc.\n *\n * Permission to use, copy, modify, distribute and sell this software\n * and its documentation for any purpose is hereby granted without fee,\n * provided that the above copyright notice appear in all copies and\n * that both that copyright notice and this permission notice appear\n * in supporting documentation.  Silicon Graphics makes no\n * representations about the suitability of this software for any\n * purpose.  It is provided \"as is\" without express or implied warranty.\n */\n\n/** @file stl_iterator_base_types.h\n *  This is an internal header file, included by other library headers.\n *  You should not attempt to use it directly.\n *\n *  This file contains all of the general iterator-related utility types,\n *  such as iterator_traits and struct iterator.\n */\n\n#ifndef _ITERATOR_BASE_TYPES_H\n#define _ITERATOR_BASE_TYPES_H 1\n\n#pragma GCC system_header\n\n_GLIBCXX_BEGIN_NAMESPACE(std)\n\n  //@{\n  /**\n   *  @defgroup iterator_tags Iterator Tags\n   *  These are empty types, used to distinguish different iterators.  The\n   *  distinction is not made by what they contain, but simply by what they\n   *  are.  Different underlying algorithms can then be used based on the\n   *  different operations supporetd by different iterator types.\n  */\n  ///  Marking input iterators.\n  struct input_iterator_tag {};\n  ///  Marking output iterators.\n  struct output_iterator_tag {};\n  /// Forward iterators support a superset of input iterator operations.\n  struct forward_iterator_tag : public input_iterator_tag {};\n  /// Bidirectional iterators support a superset of forward iterator\n  /// operations.\n  struct bidirectional_iterator_tag : public forward_iterator_tag {};\n  /// Random-access iterators support a superset of bidirectional iterator\n  /// operations.\n  struct random_access_iterator_tag : public bidirectional_iterator_tag {};\n  //@}\n\n\n  /**\n   *  @brief  Common %iterator class.\n   *\n   *  This class does nothing but define nested typedefs.  %Iterator classes\n   *  can inherit from this class to save some work.  The typedefs are then\n   *  used in specializations and overloading.\n   *\n   *  In particular, there are no default implementations of requirements\n   *  such as @c operator++ and the like.  (How could there be?)\n  */\n  template<typename _Category, typename _Tp, typename _Distance = ptrdiff_t,\n           typename _Pointer = _Tp*, typename _Reference = _Tp&>\n    struct iterator\n    {\n      /// One of the @link iterator_tags tag types@endlink.\n      typedef _Category  iterator_category;\n      /// The type \"pointed to\" by the iterator.\n      typedef _Tp        value_type;\n      /// Distance between iterators is represented as this type.\n      typedef _Distance  difference_type;\n      /// This type represents a pointer-to-value_type.\n      typedef _Pointer   pointer;\n      /// This type represents a reference-to-value_type.\n      typedef _Reference reference;\n    };\n\n  /**\n   *  This class does nothing but define nested typedefs.  The general\n   *  version simply \"forwards\" the nested typedefs from the Iterator\n   *  argument.  Specialized versions for pointers and pointers-to-const\n   *  provide tighter, more correct semantics.\n  */\n  template<typename _Iterator>\n    struct iterator_traits\n    {\n      typedef typename _Iterator::iterator_category iterator_category;\n      typedef typename _Iterator::value_type        value_type;\n      typedef typename _Iterator::difference_type   difference_type;\n      typedef typename _Iterator::pointer           pointer;\n      typedef typename _Iterator::reference         reference;\n    };\n\n  template<typename _Tp>\n    struct iterator_traits<_Tp*>\n    {\n      typedef random_access_iterator_tag iterator_category;\n      typedef _Tp                         value_type;\n      typedef ptrdiff_t                   difference_type;\n      typedef _Tp*                        pointer;\n      typedef _Tp&                        reference;\n    };\n\n  template<typename _Tp>\n    struct iterator_traits<const _Tp*>\n    {\n      typedef random_access_iterator_tag iterator_category;\n      typedef _Tp                         value_type;\n      typedef ptrdiff_t                   difference_type;\n      typedef const _Tp*                  pointer;\n      typedef const _Tp&                  reference;\n    };\n\n  /**\n   *  @if maint\n   *  This function is not a part of the C++ standard but is syntactic\n   *  sugar for internal library use only.\n   *  @endif\n  */\n  template<typename _Iter>\n    inline typename iterator_traits<_Iter>::iterator_category\n    __iterator_category(const _Iter&)\n    { return typename iterator_traits<_Iter>::iterator_category(); }\n\n_GLIBCXX_END_NAMESPACE\n\n#endif /* _ITERATOR_BASE_TYPES_H */\n\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/bits/stl_list.h",
    "content": "// List implementation -*- C++ -*-\n\n// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006\n// Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n/*\n *\n * Copyright (c) 1994\n * Hewlett-Packard Company\n *\n * Permission to use, copy, modify, distribute and sell this software\n * and its documentation for any purpose is hereby granted without fee,\n * provided that the above copyright notice appear in all copies and\n * that both that copyright notice and this permission notice appear\n * in supporting documentation.  Hewlett-Packard Company makes no\n * representations about the suitability of this software for any\n * purpose.  It is provided \"as is\" without express or implied warranty.\n *\n *\n * Copyright (c) 1996,1997\n * Silicon Graphics Computer Systems, Inc.\n *\n * Permission to use, copy, modify, distribute and sell this software\n * and its documentation for any purpose is hereby granted without fee,\n * provided that the above copyright notice appear in all copies and\n * that both that copyright notice and this permission notice appear\n * in supporting documentation.  Silicon Graphics makes no\n * representations about the suitability of this software for any\n * purpose.  It is provided \"as is\" without express or implied warranty.\n */\n\n/** @file stl_list.h\n *  This is an internal header file, included by other library headers.\n *  You should not attempt to use it directly.\n */\n\n#ifndef _LIST_H\n#define _LIST_H 1\n\n#include <bits/concept_check.h>\n\n_GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD)\n\n  // Supporting structures are split into common and templated types; the\n  // latter publicly inherits from the former in an effort to reduce code\n  // duplication.  This results in some \"needless\" static_cast'ing later on,\n  // but it's all safe downcasting.\n\n  /// @if maint Common part of a node in the %list.  @endif\n  struct _List_node_base\n  {\n    _List_node_base* _M_next;   ///< Self-explanatory\n    _List_node_base* _M_prev;   ///< Self-explanatory\n\n    static void\n    swap(_List_node_base& __x, _List_node_base& __y);\n\n    void\n    transfer(_List_node_base * const __first,\n\t     _List_node_base * const __last);\n\n    void\n    reverse();\n\n    void\n    hook(_List_node_base * const __position);\n\n    void\n    unhook();\n  };\n\n  /// @if maint An actual node in the %list.  @endif\n  template<typename _Tp>\n    struct _List_node : public _List_node_base\n    {\n      _Tp _M_data;                ///< User's data.\n    };\n\n  /**\n   *  @brief A list::iterator.\n   *\n   *  @if maint\n   *  All the functions are op overloads.\n   *  @endif\n  */\n  template<typename _Tp>\n    struct _List_iterator\n    {\n      typedef _List_iterator<_Tp>                _Self;\n      typedef _List_node<_Tp>                    _Node;\n\n      typedef ptrdiff_t                          difference_type;\n      typedef std::bidirectional_iterator_tag    iterator_category;\n      typedef _Tp                                value_type;\n      typedef _Tp*                               pointer;\n      typedef _Tp&                               reference;\n\n      _List_iterator()\n      : _M_node() { }\n\n      explicit\n      _List_iterator(_List_node_base* __x)\n      : _M_node(__x) { }\n\n      // Must downcast from List_node_base to _List_node to get to _M_data.\n      reference\n      operator*() const\n      { return static_cast<_Node*>(_M_node)->_M_data; }\n\n      pointer\n      operator->() const\n      { return &static_cast<_Node*>(_M_node)->_M_data; }\n\n      _Self&\n      operator++()\n      {\n\t_M_node = _M_node->_M_next;\n\treturn *this;\n      }\n\n      _Self\n      operator++(int)\n      {\n\t_Self __tmp = *this;\n\t_M_node = _M_node->_M_next;\n\treturn __tmp;\n      }\n\n      _Self&\n      operator--()\n      {\n\t_M_node = _M_node->_M_prev;\n\treturn *this;\n      }\n\n      _Self\n      operator--(int)\n      {\n\t_Self __tmp = *this;\n\t_M_node = _M_node->_M_prev;\n\treturn __tmp;\n      }\n\n      bool\n      operator==(const _Self& __x) const\n      { return _M_node == __x._M_node; }\n\n      bool\n      operator!=(const _Self& __x) const\n      { return _M_node != __x._M_node; }\n\n      // The only member points to the %list element.\n      _List_node_base* _M_node;\n    };\n\n  /**\n   *  @brief A list::const_iterator.\n   *\n   *  @if maint\n   *  All the functions are op overloads.\n   *  @endif\n  */\n  template<typename _Tp>\n    struct _List_const_iterator\n    {\n      typedef _List_const_iterator<_Tp>          _Self;\n      typedef const _List_node<_Tp>              _Node;\n      typedef _List_iterator<_Tp>                iterator;\n\n      typedef ptrdiff_t                          difference_type;\n      typedef std::bidirectional_iterator_tag    iterator_category;\n      typedef _Tp                                value_type;\n      typedef const _Tp*                         pointer;\n      typedef const _Tp&                         reference;\n\n      _List_const_iterator()\n      : _M_node() { }\n\n      explicit\n      _List_const_iterator(const _List_node_base* __x)\n      : _M_node(__x) { }\n\n      _List_const_iterator(const iterator& __x)\n      : _M_node(__x._M_node) { }\n\n      // Must downcast from List_node_base to _List_node to get to\n      // _M_data.\n      reference\n      operator*() const\n      { return static_cast<_Node*>(_M_node)->_M_data; }\n\n      pointer\n      operator->() const\n      { return &static_cast<_Node*>(_M_node)->_M_data; }\n\n      _Self&\n      operator++()\n      {\n\t_M_node = _M_node->_M_next;\n\treturn *this;\n      }\n\n      _Self\n      operator++(int)\n      {\n\t_Self __tmp = *this;\n\t_M_node = _M_node->_M_next;\n\treturn __tmp;\n      }\n\n      _Self&\n      operator--()\n      {\n\t_M_node = _M_node->_M_prev;\n\treturn *this;\n      }\n\n      _Self\n      operator--(int)\n      {\n\t_Self __tmp = *this;\n\t_M_node = _M_node->_M_prev;\n\treturn __tmp;\n      }\n\n      bool\n      operator==(const _Self& __x) const\n      { return _M_node == __x._M_node; }\n\n      bool\n      operator!=(const _Self& __x) const\n      { return _M_node != __x._M_node; }\n\n      // The only member points to the %list element.\n      const _List_node_base* _M_node;\n    };\n\n  template<typename _Val>\n    inline bool\n    operator==(const _List_iterator<_Val>& __x,\n\t       const _List_const_iterator<_Val>& __y)\n    { return __x._M_node == __y._M_node; }\n\n  template<typename _Val>\n    inline bool\n    operator!=(const _List_iterator<_Val>& __x,\n               const _List_const_iterator<_Val>& __y)\n    { return __x._M_node != __y._M_node; }\n\n\n  /**\n   *  @if maint\n   *  See bits/stl_deque.h's _Deque_base for an explanation.\n   *  @endif\n  */\n  template<typename _Tp, typename _Alloc>\n    class _List_base\n    {\n    protected:\n      // NOTA BENE\n      // The stored instance is not actually of \"allocator_type\"'s\n      // type.  Instead we rebind the type to\n      // Allocator<List_node<Tp>>, which according to [20.1.5]/4\n      // should probably be the same.  List_node<Tp> is not the same\n      // size as Tp (it's two pointers larger), and specializations on\n      // Tp may go unused because List_node<Tp> is being bound\n      // instead.\n      //\n      // We put this to the test in the constructors and in\n      // get_allocator, where we use conversions between\n      // allocator_type and _Node_alloc_type. The conversion is\n      // required by table 32 in [20.1.5].\n      typedef typename _Alloc::template rebind<_List_node<_Tp> >::other\n        _Node_alloc_type;\n\n      typedef typename _Alloc::template rebind<_Tp>::other _Tp_alloc_type;\n\n      struct _List_impl \n      : public _Node_alloc_type\n      {\n\t_List_node_base _M_node;\n\n\t_List_impl(const _Node_alloc_type& __a)\n\t: _Node_alloc_type(__a), _M_node()\n\t{ }\n      };\n\n      _List_impl _M_impl;\n\n      _List_node<_Tp>*\n      _M_get_node()\n      { return _M_impl._Node_alloc_type::allocate(1); }\n      \n      void\n      _M_put_node(_List_node<_Tp>* __p)\n      { _M_impl._Node_alloc_type::deallocate(__p, 1); }\n      \n  public:\n      typedef _Alloc allocator_type;\n\n      _Node_alloc_type&\n      _M_get_Node_allocator()\n      { return *static_cast<_Node_alloc_type*>(&this->_M_impl); }\n\n      const _Node_alloc_type&\n      _M_get_Node_allocator() const\n      { return *static_cast<const _Node_alloc_type*>(&this->_M_impl); }\n\n      _Tp_alloc_type\n      _M_get_Tp_allocator() const\n      { return _Tp_alloc_type(_M_get_Node_allocator()); }\n\n      allocator_type\n      get_allocator() const\n      { return allocator_type(_M_get_Node_allocator()); }\n\n      _List_base(const allocator_type& __a)\n      : _M_impl(__a)\n      { _M_init(); }\n\n      // This is what actually destroys the list.\n      ~_List_base()\n      { _M_clear(); }\n\n      void\n      _M_clear();\n\n      void\n      _M_init()\n      {\n        this->_M_impl._M_node._M_next = &this->_M_impl._M_node;\n        this->_M_impl._M_node._M_prev = &this->_M_impl._M_node;\n      }\n    };\n\n  /**\n   *  @brief A standard container with linear time access to elements,\n   *  and fixed time insertion/deletion at any point in the sequence.\n   *\n   *  @ingroup Containers\n   *  @ingroup Sequences\n   *\n   *  Meets the requirements of a <a href=\"tables.html#65\">container</a>, a\n   *  <a href=\"tables.html#66\">reversible container</a>, and a\n   *  <a href=\"tables.html#67\">sequence</a>, including the\n   *  <a href=\"tables.html#68\">optional sequence requirements</a> with the\n   *  %exception of @c at and @c operator[].\n   *\n   *  This is a @e doubly @e linked %list.  Traversal up and down the\n   *  %list requires linear time, but adding and removing elements (or\n   *  @e nodes) is done in constant time, regardless of where the\n   *  change takes place.  Unlike std::vector and std::deque,\n   *  random-access iterators are not provided, so subscripting ( @c\n   *  [] ) access is not allowed.  For algorithms which only need\n   *  sequential access, this lack makes no difference.\n   *\n   *  Also unlike the other standard containers, std::list provides\n   *  specialized algorithms %unique to linked lists, such as\n   *  splicing, sorting, and in-place reversal.\n   *\n   *  @if maint\n   *  A couple points on memory allocation for list<Tp>:\n   *\n   *  First, we never actually allocate a Tp, we allocate\n   *  List_node<Tp>'s and trust [20.1.5]/4 to DTRT.  This is to ensure\n   *  that after elements from %list<X,Alloc1> are spliced into\n   *  %list<X,Alloc2>, destroying the memory of the second %list is a\n   *  valid operation, i.e., Alloc1 giveth and Alloc2 taketh away.\n   *\n   *  Second, a %list conceptually represented as\n   *  @code\n   *    A <---> B <---> C <---> D\n   *  @endcode\n   *  is actually circular; a link exists between A and D.  The %list\n   *  class holds (as its only data member) a private list::iterator\n   *  pointing to @e D, not to @e A!  To get to the head of the %list,\n   *  we start at the tail and move forward by one.  When this member\n   *  iterator's next/previous pointers refer to itself, the %list is\n   *  %empty.  @endif\n  */\n  template<typename _Tp, typename _Alloc = std::allocator<_Tp> >\n    class list : protected _List_base<_Tp, _Alloc>\n    {\n      // concept requirements\n      typedef typename _Alloc::value_type                _Alloc_value_type;\n      __glibcxx_class_requires(_Tp, _SGIAssignableConcept)\n      __glibcxx_class_requires2(_Tp, _Alloc_value_type, _SameTypeConcept)\n\n      typedef _List_base<_Tp, _Alloc>                    _Base;\n      typedef typename _Base::_Tp_alloc_type\t\t _Tp_alloc_type;\n\n    public:\n      typedef _Tp                                        value_type;\n      typedef typename _Tp_alloc_type::pointer           pointer;\n      typedef typename _Tp_alloc_type::const_pointer     const_pointer;\n      typedef typename _Tp_alloc_type::reference         reference;\n      typedef typename _Tp_alloc_type::const_reference   const_reference;\n      typedef _List_iterator<_Tp>                        iterator;\n      typedef _List_const_iterator<_Tp>                  const_iterator;\n      typedef std::reverse_iterator<const_iterator>      const_reverse_iterator;\n      typedef std::reverse_iterator<iterator>            reverse_iterator;\n      typedef size_t                                     size_type;\n      typedef ptrdiff_t                                  difference_type;\n      typedef _Alloc                                     allocator_type;\n\n    protected:\n      // Note that pointers-to-_Node's can be ctor-converted to\n      // iterator types.\n      typedef _List_node<_Tp>\t\t\t\t _Node;\n\n      using _Base::_M_impl;\n      using _Base::_M_put_node;\n      using _Base::_M_get_node;\n      using _Base::_M_get_Tp_allocator;\n      using _Base::_M_get_Node_allocator;\n\n      /**\n       *  @if maint\n       *  @param  x  An instance of user data.\n       *\n       *  Allocates space for a new node and constructs a copy of @a x in it.\n       *  @endif\n       */\n      _Node*\n      _M_create_node(const value_type& __x)\n      {\n\t_Node* __p = this->_M_get_node();\n\ttry\n\t  {\n\t    _M_get_Tp_allocator().construct(&__p->_M_data, __x);\n\t  }\n\tcatch(...)\n\t  {\n\t    _M_put_node(__p);\n\t    __throw_exception_again;\n\t  }\n\treturn __p;\n      }\n\n    public:\n      // [23.2.2.1] construct/copy/destroy\n      // (assign() and get_allocator() are also listed in this section)\n      /**\n       *  @brief  Default constructor creates no elements.\n       */\n      explicit\n      list(const allocator_type& __a = allocator_type())\n      : _Base(__a) { }\n\n      /**\n       *  @brief  Create a %list with copies of an exemplar element.\n       *  @param  n  The number of elements to initially create.\n       *  @param  value  An element to copy.\n       *\n       *  This constructor fills the %list with @a n copies of @a value.\n       */\n      explicit\n      list(size_type __n, const value_type& __value = value_type(),\n\t   const allocator_type& __a = allocator_type())\n      : _Base(__a)\n      { _M_fill_initialize(__n, __value); }\n\n      /**\n       *  @brief  %List copy constructor.\n       *  @param  x  A %list of identical element and allocator types.\n       *\n       *  The newly-created %list uses a copy of the allocation object used\n       *  by @a x.\n       */\n      list(const list& __x)\n      : _Base(__x._M_get_Node_allocator())\n      { _M_initialize_dispatch(__x.begin(), __x.end(), __false_type()); }\n\n      /**\n       *  @brief  Builds a %list from a range.\n       *  @param  first  An input iterator.\n       *  @param  last  An input iterator.\n       *\n       *  Create a %list consisting of copies of the elements from\n       *  [@a first,@a last).  This is linear in N (where N is\n       *  distance(@a first,@a last)).\n       */\n      template<typename _InputIterator>\n        list(_InputIterator __first, _InputIterator __last,\n\t     const allocator_type& __a = allocator_type())\n        : _Base(__a)\n        { \n\t  // Check whether it's an integral type.  If so, it's not an iterator.\n\t  typedef typename std::__is_integer<_InputIterator>::__type _Integral;\n\t  _M_initialize_dispatch(__first, __last, _Integral());\n\t}\n\n      /**\n       *  No explicit dtor needed as the _Base dtor takes care of\n       *  things.  The _Base dtor only erases the elements, and note\n       *  that if the elements themselves are pointers, the pointed-to\n       *  memory is not touched in any way.  Managing the pointer is\n       *  the user's responsibilty.\n       */\n\n      /**\n       *  @brief  %List assignment operator.\n       *  @param  x  A %list of identical element and allocator types.\n       *\n       *  All the elements of @a x are copied, but unlike the copy\n       *  constructor, the allocator object is not copied.\n       */\n      list&\n      operator=(const list& __x);\n\n      /**\n       *  @brief  Assigns a given value to a %list.\n       *  @param  n  Number of elements to be assigned.\n       *  @param  val  Value to be assigned.\n       *\n       *  This function fills a %list with @a n copies of the given\n       *  value.  Note that the assignment completely changes the %list\n       *  and that the resulting %list's size is the same as the number\n       *  of elements assigned.  Old data may be lost.\n       */\n      void\n      assign(size_type __n, const value_type& __val)\n      { _M_fill_assign(__n, __val); }\n\n      /**\n       *  @brief  Assigns a range to a %list.\n       *  @param  first  An input iterator.\n       *  @param  last   An input iterator.\n       *\n       *  This function fills a %list with copies of the elements in the\n       *  range [@a first,@a last).\n       *\n       *  Note that the assignment completely changes the %list and\n       *  that the resulting %list's size is the same as the number of\n       *  elements assigned.  Old data may be lost.\n       */\n      template<typename _InputIterator>\n        void\n        assign(_InputIterator __first, _InputIterator __last)\n        {\n\t  // Check whether it's an integral type.  If so, it's not an iterator.\n\t  typedef typename std::__is_integer<_InputIterator>::__type _Integral;\n\t  _M_assign_dispatch(__first, __last, _Integral());\n\t}\n\n      /// Get a copy of the memory allocation object.\n      allocator_type\n      get_allocator() const\n      { return _Base::get_allocator(); }\n\n      // iterators\n      /**\n       *  Returns a read/write iterator that points to the first element in the\n       *  %list.  Iteration is done in ordinary element order.\n       */\n      iterator\n      begin()\n      { return iterator(this->_M_impl._M_node._M_next); }\n\n      /**\n       *  Returns a read-only (constant) iterator that points to the\n       *  first element in the %list.  Iteration is done in ordinary\n       *  element order.\n       */\n      const_iterator\n      begin() const\n      { return const_iterator(this->_M_impl._M_node._M_next); }\n\n      /**\n       *  Returns a read/write iterator that points one past the last\n       *  element in the %list.  Iteration is done in ordinary element\n       *  order.\n       */\n      iterator\n      end()\n      { return iterator(&this->_M_impl._M_node); }\n\n      /**\n       *  Returns a read-only (constant) iterator that points one past\n       *  the last element in the %list.  Iteration is done in ordinary\n       *  element order.\n       */\n      const_iterator\n      end() const\n      { return const_iterator(&this->_M_impl._M_node); }\n\n      /**\n       *  Returns a read/write reverse iterator that points to the last\n       *  element in the %list.  Iteration is done in reverse element\n       *  order.\n       */\n      reverse_iterator\n      rbegin()\n      { return reverse_iterator(end()); }\n\n      /**\n       *  Returns a read-only (constant) reverse iterator that points to\n       *  the last element in the %list.  Iteration is done in reverse\n       *  element order.\n       */\n      const_reverse_iterator\n      rbegin() const\n      { return const_reverse_iterator(end()); }\n\n      /**\n       *  Returns a read/write reverse iterator that points to one\n       *  before the first element in the %list.  Iteration is done in\n       *  reverse element order.\n       */\n      reverse_iterator\n      rend()\n      { return reverse_iterator(begin()); }\n\n      /**\n       *  Returns a read-only (constant) reverse iterator that points to one\n       *  before the first element in the %list.  Iteration is done in reverse\n       *  element order.\n       */\n      const_reverse_iterator\n      rend() const\n      { return const_reverse_iterator(begin()); }\n\n      // [23.2.2.2] capacity\n      /**\n       *  Returns true if the %list is empty.  (Thus begin() would equal\n       *  end().)\n       */\n      bool\n      empty() const\n      { return this->_M_impl._M_node._M_next == &this->_M_impl._M_node; }\n\n      /**  Returns the number of elements in the %list.  */\n      size_type\n      size() const\n      { return std::distance(begin(), end()); }\n\n      /**  Returns the size() of the largest possible %list.  */\n      size_type\n      max_size() const\n      { return _M_get_Tp_allocator().max_size(); }\n\n      /**\n       *  @brief Resizes the %list to the specified number of elements.\n       *  @param new_size Number of elements the %list should contain.\n       *  @param x Data with which new elements should be populated.\n       *\n       *  This function will %resize the %list to the specified number\n       *  of elements.  If the number is smaller than the %list's\n       *  current size the %list is truncated, otherwise the %list is\n       *  extended and new elements are populated with given data.\n       */\n      void\n      resize(size_type __new_size, value_type __x = value_type());\n\n      // element access\n      /**\n       *  Returns a read/write reference to the data at the first\n       *  element of the %list.\n       */\n      reference\n      front()\n      { return *begin(); }\n\n      /**\n       *  Returns a read-only (constant) reference to the data at the first\n       *  element of the %list.\n       */\n      const_reference\n      front() const\n      { return *begin(); }\n\n      /**\n       *  Returns a read/write reference to the data at the last element\n       *  of the %list.\n       */\n      reference\n      back()\n      { \n\titerator __tmp = end();\n\t--__tmp;\n\treturn *__tmp;\n      }\n\n      /**\n       *  Returns a read-only (constant) reference to the data at the last\n       *  element of the %list.\n       */\n      const_reference\n      back() const\n      { \n\tconst_iterator __tmp = end();\n\t--__tmp;\n\treturn *__tmp;\n      }\n\n      // [23.2.2.3] modifiers\n      /**\n       *  @brief  Add data to the front of the %list.\n       *  @param  x  Data to be added.\n       *\n       *  This is a typical stack operation.  The function creates an\n       *  element at the front of the %list and assigns the given data\n       *  to it.  Due to the nature of a %list this operation can be\n       *  done in constant time, and does not invalidate iterators and\n       *  references.\n       */\n      void\n      push_front(const value_type& __x)\n      { this->_M_insert(begin(), __x); }\n\n      /**\n       *  @brief  Removes first element.\n       *\n       *  This is a typical stack operation.  It shrinks the %list by\n       *  one.  Due to the nature of a %list this operation can be done\n       *  in constant time, and only invalidates iterators/references to\n       *  the element being removed.\n       *\n       *  Note that no data is returned, and if the first element's data\n       *  is needed, it should be retrieved before pop_front() is\n       *  called.\n       */\n      void\n      pop_front()\n      { this->_M_erase(begin()); }\n\n      /**\n       *  @brief  Add data to the end of the %list.\n       *  @param  x  Data to be added.\n       *\n       *  This is a typical stack operation.  The function creates an\n       *  element at the end of the %list and assigns the given data to\n       *  it.  Due to the nature of a %list this operation can be done\n       *  in constant time, and does not invalidate iterators and\n       *  references.\n       */\n      void\n      push_back(const value_type& __x)\n      { this->_M_insert(end(), __x); }\n\n      /**\n       *  @brief  Removes last element.\n       *\n       *  This is a typical stack operation.  It shrinks the %list by\n       *  one.  Due to the nature of a %list this operation can be done\n       *  in constant time, and only invalidates iterators/references to\n       *  the element being removed.\n       *\n       *  Note that no data is returned, and if the last element's data\n       *  is needed, it should be retrieved before pop_back() is called.\n       */\n      void\n      pop_back()\n      { this->_M_erase(iterator(this->_M_impl._M_node._M_prev)); }\n\n      /**\n       *  @brief  Inserts given value into %list before specified iterator.\n       *  @param  position  An iterator into the %list.\n       *  @param  x  Data to be inserted.\n       *  @return  An iterator that points to the inserted data.\n       *\n       *  This function will insert a copy of the given value before\n       *  the specified location.  Due to the nature of a %list this\n       *  operation can be done in constant time, and does not\n       *  invalidate iterators and references.\n       */\n      iterator\n      insert(iterator __position, const value_type& __x);\n\n      /**\n       *  @brief  Inserts a number of copies of given data into the %list.\n       *  @param  position  An iterator into the %list.\n       *  @param  n  Number of elements to be inserted.\n       *  @param  x  Data to be inserted.\n       *\n       *  This function will insert a specified number of copies of the\n       *  given data before the location specified by @a position.\n       *\n       *  This operation is linear in the number of elements inserted and\n       *  does not invalidate iterators and references.\n       */\n      void\n      insert(iterator __position, size_type __n, const value_type& __x)\n      {  \n\tlist __tmp(__n, __x, _M_get_Node_allocator());\n\tsplice(__position, __tmp);\n      }\n\n      /**\n       *  @brief  Inserts a range into the %list.\n       *  @param  position  An iterator into the %list.\n       *  @param  first  An input iterator.\n       *  @param  last   An input iterator.\n       *\n       *  This function will insert copies of the data in the range [@a\n       *  first,@a last) into the %list before the location specified by\n       *  @a position.\n       *\n       *  This operation is linear in the number of elements inserted and\n       *  does not invalidate iterators and references.\n       */\n      template<typename _InputIterator>\n        void\n        insert(iterator __position, _InputIterator __first,\n\t       _InputIterator __last)\n        {\n\t  list __tmp(__first, __last, _M_get_Node_allocator());\n\t  splice(__position, __tmp);\n\t}\n\n      /**\n       *  @brief  Remove element at given position.\n       *  @param  position  Iterator pointing to element to be erased.\n       *  @return  An iterator pointing to the next element (or end()).\n       *\n       *  This function will erase the element at the given position and thus\n       *  shorten the %list by one.\n       *\n       *  Due to the nature of a %list this operation can be done in\n       *  constant time, and only invalidates iterators/references to\n       *  the element being removed.  The user is also cautioned that\n       *  this function only erases the element, and that if the element\n       *  is itself a pointer, the pointed-to memory is not touched in\n       *  any way.  Managing the pointer is the user's responsibilty.\n       */\n      iterator\n      erase(iterator __position);\n\n      /**\n       *  @brief  Remove a range of elements.\n       *  @param  first  Iterator pointing to the first element to be erased.\n       *  @param  last  Iterator pointing to one past the last element to be\n       *                erased.\n       *  @return  An iterator pointing to the element pointed to by @a last\n       *           prior to erasing (or end()).\n       *\n       *  This function will erase the elements in the range @a\n       *  [first,last) and shorten the %list accordingly.\n       *\n       *  This operation is linear time in the size of the range and only\n       *  invalidates iterators/references to the element being removed.\n       *  The user is also cautioned that this function only erases the\n       *  elements, and that if the elements themselves are pointers, the\n       *  pointed-to memory is not touched in any way.  Managing the pointer\n       *  is the user's responsibilty.\n       */\n      iterator\n      erase(iterator __first, iterator __last)\n      {\n\twhile (__first != __last)\n\t  __first = erase(__first);\n\treturn __last;\n      }\n\n      /**\n       *  @brief  Swaps data with another %list.\n       *  @param  x  A %list of the same element and allocator types.\n       *\n       *  This exchanges the elements between two lists in constant\n       *  time.  Note that the global std::swap() function is\n       *  specialized such that std::swap(l1,l2) will feed to this\n       *  function.\n       */\n      void\n      swap(list& __x)\n      {\n\t_List_node_base::swap(this->_M_impl._M_node, __x._M_impl._M_node);\n\n\t// _GLIBCXX_RESOLVE_LIB_DEFECTS\n\t// 431. Swapping containers with unequal allocators.\n\tstd::__alloc_swap<typename _Base::_Node_alloc_type>::\n\t  _S_do_it(_M_get_Node_allocator(), __x._M_get_Node_allocator());\n      }\n\n      /**\n       *  Erases all the elements.  Note that this function only erases\n       *  the elements, and that if the elements themselves are\n       *  pointers, the pointed-to memory is not touched in any way.\n       *  Managing the pointer is the user's responsibilty.\n       */\n      void\n      clear()\n      {\n        _Base::_M_clear();\n        _Base::_M_init();\n      }\n\n      // [23.2.2.4] list operations\n      /**\n       *  @brief  Insert contents of another %list.\n       *  @param  position  Iterator referencing the element to insert before.\n       *  @param  x  Source list.\n       *\n       *  The elements of @a x are inserted in constant time in front of\n       *  the element referenced by @a position.  @a x becomes an empty\n       *  list.\n       *\n       *  Requires this != @a x.\n       */\n      void\n      splice(iterator __position, list& __x)\n      {\n\tif (!__x.empty())\n\t  {\n\t    _M_check_equal_allocators(__x);\n\n\t    this->_M_transfer(__position, __x.begin(), __x.end());\n\t  }\n      }\n\n      /**\n       *  @brief  Insert element from another %list.\n       *  @param  position  Iterator referencing the element to insert before.\n       *  @param  x  Source list.\n       *  @param  i  Iterator referencing the element to move.\n       *\n       *  Removes the element in list @a x referenced by @a i and\n       *  inserts it into the current list before @a position.\n       */\n      void\n      splice(iterator __position, list& __x, iterator __i)\n      {\n\titerator __j = __i;\n\t++__j;\n\tif (__position == __i || __position == __j)\n\t  return;\n\n\tif (this != &__x)\n\t  _M_check_equal_allocators(__x);\n\n\tthis->_M_transfer(__position, __i, __j);\n      }\n\n      /**\n       *  @brief  Insert range from another %list.\n       *  @param  position  Iterator referencing the element to insert before.\n       *  @param  x  Source list.\n       *  @param  first  Iterator referencing the start of range in x.\n       *  @param  last  Iterator referencing the end of range in x.\n       *\n       *  Removes elements in the range [first,last) and inserts them\n       *  before @a position in constant time.\n       *\n       *  Undefined if @a position is in [first,last).\n       */\n      void\n      splice(iterator __position, list& __x, iterator __first, iterator __last)\n      {\n\tif (__first != __last)\n\t  {\n\t    if (this != &__x)\n\t      _M_check_equal_allocators(__x);\n\n\t    this->_M_transfer(__position, __first, __last);\n\t  }\n      }\n\n      /**\n       *  @brief  Remove all elements equal to value.\n       *  @param  value  The value to remove.\n       *\n       *  Removes every element in the list equal to @a value.\n       *  Remaining elements stay in list order.  Note that this\n       *  function only erases the elements, and that if the elements\n       *  themselves are pointers, the pointed-to memory is not\n       *  touched in any way.  Managing the pointer is the user's\n       *  responsibilty.\n       */\n      void\n      remove(const _Tp& __value);\n\n      /**\n       *  @brief  Remove all elements satisfying a predicate.\n       *  @param  Predicate  Unary predicate function or object.\n       *\n       *  Removes every element in the list for which the predicate\n       *  returns true.  Remaining elements stay in list order.  Note\n       *  that this function only erases the elements, and that if the\n       *  elements themselves are pointers, the pointed-to memory is\n       *  not touched in any way.  Managing the pointer is the user's\n       *  responsibilty.\n       */\n      template<typename _Predicate>\n        void\n        remove_if(_Predicate);\n\n      /**\n       *  @brief  Remove consecutive duplicate elements.\n       *\n       *  For each consecutive set of elements with the same value,\n       *  remove all but the first one.  Remaining elements stay in\n       *  list order.  Note that this function only erases the\n       *  elements, and that if the elements themselves are pointers,\n       *  the pointed-to memory is not touched in any way.  Managing\n       *  the pointer is the user's responsibilty.\n       */\n      void\n      unique();\n\n      /**\n       *  @brief  Remove consecutive elements satisfying a predicate.\n       *  @param  BinaryPredicate  Binary predicate function or object.\n       *\n       *  For each consecutive set of elements [first,last) that\n       *  satisfy predicate(first,i) where i is an iterator in\n       *  [first,last), remove all but the first one.  Remaining\n       *  elements stay in list order.  Note that this function only\n       *  erases the elements, and that if the elements themselves are\n       *  pointers, the pointed-to memory is not touched in any way.\n       *  Managing the pointer is the user's responsibilty.\n       */\n      template<typename _BinaryPredicate>\n        void\n        unique(_BinaryPredicate);\n\n      /**\n       *  @brief  Merge sorted lists.\n       *  @param  x  Sorted list to merge.\n       *\n       *  Assumes that both @a x and this list are sorted according to\n       *  operator<().  Merges elements of @a x into this list in\n       *  sorted order, leaving @a x empty when complete.  Elements in\n       *  this list precede elements in @a x that are equal.\n       */\n      void\n      merge(list& __x);\n\n      /**\n       *  @brief  Merge sorted lists according to comparison function.\n       *  @param  x  Sorted list to merge.\n       *  @param StrictWeakOrdering Comparison function definining\n       *  sort order.\n       *\n       *  Assumes that both @a x and this list are sorted according to\n       *  StrictWeakOrdering.  Merges elements of @a x into this list\n       *  in sorted order, leaving @a x empty when complete.  Elements\n       *  in this list precede elements in @a x that are equivalent\n       *  according to StrictWeakOrdering().\n       */\n      template<typename _StrictWeakOrdering>\n        void\n        merge(list&, _StrictWeakOrdering);\n\n      /**\n       *  @brief  Reverse the elements in list.\n       *\n       *  Reverse the order of elements in the list in linear time.\n       */\n      void\n      reverse()\n      { this->_M_impl._M_node.reverse(); }\n\n      /**\n       *  @brief  Sort the elements.\n       *\n       *  Sorts the elements of this list in NlogN time.  Equivalent\n       *  elements remain in list order.\n       */\n      void\n      sort();\n\n      /**\n       *  @brief  Sort the elements according to comparison function.\n       *\n       *  Sorts the elements of this list in NlogN time.  Equivalent\n       *  elements remain in list order.\n       */\n      template<typename _StrictWeakOrdering>\n        void\n        sort(_StrictWeakOrdering);\n\n    protected:\n      // Internal constructor functions follow.\n\n      // Called by the range constructor to implement [23.1.1]/9\n      template<typename _Integer>\n        void\n        _M_initialize_dispatch(_Integer __n, _Integer __x, __true_type)\n        {\n\t  _M_fill_initialize(static_cast<size_type>(__n),\n\t\t\t     static_cast<value_type>(__x));\n\t}\n\n      // Called by the range constructor to implement [23.1.1]/9\n      template<typename _InputIterator>\n        void\n        _M_initialize_dispatch(_InputIterator __first, _InputIterator __last,\n\t\t\t       __false_type)\n        {\n\t  for (; __first != __last; ++__first)\n\t    push_back(*__first);\n\t}\n\n      // Called by list(n,v,a), and the range constructor when it turns out\n      // to be the same thing.\n      void\n      _M_fill_initialize(size_type __n, const value_type& __x)\n      {\n\tfor (; __n > 0; --__n)\n\t  push_back(__x);\n      }\n\n\n      // Internal assign functions follow.\n\n      // Called by the range assign to implement [23.1.1]/9\n      template<typename _Integer>\n        void\n        _M_assign_dispatch(_Integer __n, _Integer __val, __true_type)\n        {\n\t  _M_fill_assign(static_cast<size_type>(__n),\n\t\t\t static_cast<value_type>(__val));\n\t}\n\n      // Called by the range assign to implement [23.1.1]/9\n      template<typename _InputIterator>\n        void\n        _M_assign_dispatch(_InputIterator __first, _InputIterator __last,\n\t\t\t   __false_type);\n\n      // Called by assign(n,t), and the range assign when it turns out\n      // to be the same thing.\n      void\n      _M_fill_assign(size_type __n, const value_type& __val);\n\n\n      // Moves the elements from [first,last) before position.\n      void\n      _M_transfer(iterator __position, iterator __first, iterator __last)\n      { __position._M_node->transfer(__first._M_node, __last._M_node); }\n\n      // Inserts new element at position given and with value given.\n      void\n      _M_insert(iterator __position, const value_type& __x)\n      {\n        _Node* __tmp = _M_create_node(__x);\n        __tmp->hook(__position._M_node);\n      }\n\n      // Erases element at position given.\n      void\n      _M_erase(iterator __position)\n      {\n        __position._M_node->unhook();\n        _Node* __n = static_cast<_Node*>(__position._M_node);\n        _M_get_Tp_allocator().destroy(&__n->_M_data);\n        _M_put_node(__n);\n      }\n\n      // To implement the splice (and merge) bits of N1599.\n      void\n      _M_check_equal_allocators(list& __x)\n      {\n\tif (_M_get_Node_allocator() != __x._M_get_Node_allocator())\n\t  __throw_runtime_error(__N(\"list::_M_check_equal_allocators\"));\n      }\n    };\n\n  /**\n   *  @brief  List equality comparison.\n   *  @param  x  A %list.\n   *  @param  y  A %list of the same type as @a x.\n   *  @return  True iff the size and elements of the lists are equal.\n   *\n   *  This is an equivalence relation.  It is linear in the size of\n   *  the lists.  Lists are considered equivalent if their sizes are\n   *  equal, and if corresponding elements compare equal.\n  */\n  template<typename _Tp, typename _Alloc>\n    inline bool\n    operator==(const list<_Tp, _Alloc>& __x, const list<_Tp, _Alloc>& __y)\n    {\n      typedef typename list<_Tp, _Alloc>::const_iterator const_iterator;\n      const_iterator __end1 = __x.end();\n      const_iterator __end2 = __y.end();\n\n      const_iterator __i1 = __x.begin();\n      const_iterator __i2 = __y.begin();\n      while (__i1 != __end1 && __i2 != __end2 && *__i1 == *__i2)\n\t{\n\t  ++__i1;\n\t  ++__i2;\n\t}\n      return __i1 == __end1 && __i2 == __end2;\n    }\n\n  /**\n   *  @brief  List ordering relation.\n   *  @param  x  A %list.\n   *  @param  y  A %list of the same type as @a x.\n   *  @return  True iff @a x is lexicographically less than @a y.\n   *\n   *  This is a total ordering relation.  It is linear in the size of the\n   *  lists.  The elements must be comparable with @c <.\n   *\n   *  See std::lexicographical_compare() for how the determination is made.\n  */\n  template<typename _Tp, typename _Alloc>\n    inline bool\n    operator<(const list<_Tp, _Alloc>& __x, const list<_Tp, _Alloc>& __y)\n    { return std::lexicographical_compare(__x.begin(), __x.end(),\n\t\t\t\t\t  __y.begin(), __y.end()); }\n\n  /// Based on operator==\n  template<typename _Tp, typename _Alloc>\n    inline bool\n    operator!=(const list<_Tp, _Alloc>& __x, const list<_Tp, _Alloc>& __y)\n    { return !(__x == __y); }\n\n  /// Based on operator<\n  template<typename _Tp, typename _Alloc>\n    inline bool\n    operator>(const list<_Tp, _Alloc>& __x, const list<_Tp, _Alloc>& __y)\n    { return __y < __x; }\n\n  /// Based on operator<\n  template<typename _Tp, typename _Alloc>\n    inline bool\n    operator<=(const list<_Tp, _Alloc>& __x, const list<_Tp, _Alloc>& __y)\n    { return !(__y < __x); }\n\n  /// Based on operator<\n  template<typename _Tp, typename _Alloc>\n    inline bool\n    operator>=(const list<_Tp, _Alloc>& __x, const list<_Tp, _Alloc>& __y)\n    { return !(__x < __y); }\n\n  /// See std::list::swap().\n  template<typename _Tp, typename _Alloc>\n    inline void\n    swap(list<_Tp, _Alloc>& __x, list<_Tp, _Alloc>& __y)\n    { __x.swap(__y); }\n\n_GLIBCXX_END_NESTED_NAMESPACE\n\n#endif /* _LIST_H */\n\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/bits/stl_map.h",
    "content": "// Map implementation -*- C++ -*-\n\n// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007\n// Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n/*\n *\n * Copyright (c) 1994\n * Hewlett-Packard Company\n *\n * Permission to use, copy, modify, distribute and sell this software\n * and its documentation for any purpose is hereby granted without fee,\n * provided that the above copyright notice appear in all copies and\n * that both that copyright notice and this permission notice appear\n * in supporting documentation.  Hewlett-Packard Company makes no\n * representations about the suitability of this software for any\n * purpose.  It is provided \"as is\" without express or implied warranty.\n *\n *\n * Copyright (c) 1996,1997\n * Silicon Graphics Computer Systems, Inc.\n *\n * Permission to use, copy, modify, distribute and sell this software\n * and its documentation for any purpose is hereby granted without fee,\n * provided that the above copyright notice appear in all copies and\n * that both that copyright notice and this permission notice appear\n * in supporting documentation.  Silicon Graphics makes no\n * representations about the suitability of this software for any\n * purpose.  It is provided \"as is\" without express or implied warranty.\n */\n\n/** @file stl_map.h\n *  This is an internal header file, included by other library headers.\n *  You should not attempt to use it directly.\n */\n\n#ifndef _MAP_H\n#define _MAP_H 1\n\n#include <bits/functexcept.h>\n#include <bits/concept_check.h>\n\n_GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD)\n\n  /**\n   *  @brief A standard container made up of (key,value) pairs, which can be\n   *  retrieved based on a key, in logarithmic time.\n   *\n   *  @ingroup Containers\n   *  @ingroup Assoc_containers\n   *\n   *  Meets the requirements of a <a href=\"tables.html#65\">container</a>, a\n   *  <a href=\"tables.html#66\">reversible container</a>, and an\n   *  <a href=\"tables.html#69\">associative container</a> (using unique keys).\n   *  For a @c map<Key,T> the key_type is Key, the mapped_type is T, and the\n   *  value_type is std::pair<const Key,T>.\n   *\n   *  Maps support bidirectional iterators.\n   *\n   *  @if maint\n   *  The private tree data is declared exactly the same way for map and\n   *  multimap; the distinction is made entirely in how the tree functions are\n   *  called (*_unique versus *_equal, same as the standard).\n   *  @endif\n  */\n  template <typename _Key, typename _Tp, typename _Compare = std::less<_Key>,\n            typename _Alloc = std::allocator<std::pair<const _Key, _Tp> > >\n    class map\n    {\n    public:\n      typedef _Key                                          key_type;\n      typedef _Tp                                           mapped_type;\n      typedef std::pair<const _Key, _Tp>                    value_type;\n      typedef _Compare                                      key_compare;\n      typedef _Alloc                                        allocator_type;\n\n    private:\n      // concept requirements\n      typedef typename _Alloc::value_type                   _Alloc_value_type;\n      __glibcxx_class_requires(_Tp, _SGIAssignableConcept)\n      __glibcxx_class_requires4(_Compare, bool, _Key, _Key,\n\t\t\t\t_BinaryFunctionConcept)\n      __glibcxx_class_requires2(value_type, _Alloc_value_type, _SameTypeConcept)\n\n    public:\n      class value_compare\n      : public std::binary_function<value_type, value_type, bool>\n      {\n\tfriend class map<_Key, _Tp, _Compare, _Alloc>;\n      protected:\n\t_Compare comp;\n\n\tvalue_compare(_Compare __c)\n\t: comp(__c) { }\n\n      public:\n\tbool operator()(const value_type& __x, const value_type& __y) const\n\t{ return comp(__x.first, __y.first); }\n      };\n\n    private:\n      /// @if maint  This turns a red-black tree into a [multi]map.  @endif\n      typedef typename _Alloc::template rebind<value_type>::other \n        _Pair_alloc_type;\n\n      typedef _Rb_tree<key_type, value_type, _Select1st<value_type>,\n\t\t       key_compare, _Pair_alloc_type> _Rep_type;\n\n      /// @if maint  The actual tree structure.  @endif\n      _Rep_type _M_t;\n\n    public:\n      // many of these are specified differently in ISO, but the following are\n      // \"functionally equivalent\"\n      typedef typename _Pair_alloc_type::pointer         pointer;\n      typedef typename _Pair_alloc_type::const_pointer   const_pointer;\n      typedef typename _Pair_alloc_type::reference       reference;\n      typedef typename _Pair_alloc_type::const_reference const_reference;\n      typedef typename _Rep_type::iterator               iterator;\n      typedef typename _Rep_type::const_iterator         const_iterator;\n      typedef typename _Rep_type::size_type              size_type;\n      typedef typename _Rep_type::difference_type        difference_type;\n      typedef typename _Rep_type::reverse_iterator       reverse_iterator;\n      typedef typename _Rep_type::const_reverse_iterator const_reverse_iterator;\n\n      // [23.3.1.1] construct/copy/destroy\n      // (get_allocator() is normally listed in this section, but seems to have\n      // been accidentally omitted in the printed standard)\n      /**\n       *  @brief  Default constructor creates no elements.\n       */\n      map()\n      : _M_t(_Compare(), allocator_type()) { }\n\n      // for some reason this was made a separate function\n      /**\n       *  @brief  Default constructor creates no elements.\n       */\n      explicit\n      map(const _Compare& __comp, const allocator_type& __a = allocator_type())\n      : _M_t(__comp, __a) { }\n\n      /**\n       *  @brief  Map copy constructor.\n       *  @param  x  A %map of identical element and allocator types.\n       *\n       *  The newly-created %map uses a copy of the allocation object used\n       *  by @a x.\n       */\n      map(const map& __x)\n      : _M_t(__x._M_t) { }\n\n      /**\n       *  @brief  Builds a %map from a range.\n       *  @param  first  An input iterator.\n       *  @param  last  An input iterator.\n       *\n       *  Create a %map consisting of copies of the elements from [first,last).\n       *  This is linear in N if the range is already sorted, and NlogN\n       *  otherwise (where N is distance(first,last)).\n       */\n      template <typename _InputIterator>\n        map(_InputIterator __first, _InputIterator __last)\n\t: _M_t(_Compare(), allocator_type())\n        { _M_t._M_insert_unique(__first, __last); }\n\n      /**\n       *  @brief  Builds a %map from a range.\n       *  @param  first  An input iterator.\n       *  @param  last  An input iterator.\n       *  @param  comp  A comparison functor.\n       *  @param  a  An allocator object.\n       *\n       *  Create a %map consisting of copies of the elements from [first,last).\n       *  This is linear in N if the range is already sorted, and NlogN\n       *  otherwise (where N is distance(first,last)).\n       */\n      template <typename _InputIterator>\n        map(_InputIterator __first, _InputIterator __last,\n\t    const _Compare& __comp, const allocator_type& __a = allocator_type())\n\t: _M_t(__comp, __a)\n        { _M_t._M_insert_unique(__first, __last); }\n\n      // FIXME There is no dtor declared, but we should have something\n      // generated by Doxygen.  I don't know what tags to add to this\n      // paragraph to make that happen:\n      /**\n       *  The dtor only erases the elements, and note that if the elements\n       *  themselves are pointers, the pointed-to memory is not touched in any\n       *  way.  Managing the pointer is the user's responsibilty.\n       */\n\n      /**\n       *  @brief  Map assignment operator.\n       *  @param  x  A %map of identical element and allocator types.\n       *\n       *  All the elements of @a x are copied, but unlike the copy constructor,\n       *  the allocator object is not copied.\n       */\n      map&\n      operator=(const map& __x)\n      {\n\t_M_t = __x._M_t;\n\treturn *this;\n      }\n\n      /// Get a copy of the memory allocation object.\n      allocator_type\n      get_allocator() const\n      { return _M_t.get_allocator(); }\n\n      // iterators\n      /**\n       *  Returns a read/write iterator that points to the first pair in the\n       *  %map.\n       *  Iteration is done in ascending order according to the keys.\n       */\n      iterator\n      begin()\n      { return _M_t.begin(); }\n\n      /**\n       *  Returns a read-only (constant) iterator that points to the first pair\n       *  in the %map.  Iteration is done in ascending order according to the\n       *  keys.\n       */\n      const_iterator\n      begin() const\n      { return _M_t.begin(); }\n\n      /**\n       *  Returns a read/write iterator that points one past the last\n       *  pair in the %map.  Iteration is done in ascending order\n       *  according to the keys.\n       */\n      iterator\n      end()\n      { return _M_t.end(); }\n\n      /**\n       *  Returns a read-only (constant) iterator that points one past the last\n       *  pair in the %map.  Iteration is done in ascending order according to\n       *  the keys.\n       */\n      const_iterator\n      end() const\n      { return _M_t.end(); }\n\n      /**\n       *  Returns a read/write reverse iterator that points to the last pair in\n       *  the %map.  Iteration is done in descending order according to the\n       *  keys.\n       */\n      reverse_iterator\n      rbegin()\n      { return _M_t.rbegin(); }\n\n      /**\n       *  Returns a read-only (constant) reverse iterator that points to the\n       *  last pair in the %map.  Iteration is done in descending order\n       *  according to the keys.\n       */\n      const_reverse_iterator\n      rbegin() const\n      { return _M_t.rbegin(); }\n\n      /**\n       *  Returns a read/write reverse iterator that points to one before the\n       *  first pair in the %map.  Iteration is done in descending order\n       *  according to the keys.\n       */\n      reverse_iterator\n      rend()\n      { return _M_t.rend(); }\n\n      /**\n       *  Returns a read-only (constant) reverse iterator that points to one\n       *  before the first pair in the %map.  Iteration is done in descending\n       *  order according to the keys.\n       */\n      const_reverse_iterator\n      rend() const\n      { return _M_t.rend(); }\n\n      // capacity\n      /** Returns true if the %map is empty.  (Thus begin() would equal\n       *  end().)\n      */\n      bool\n      empty() const\n      { return _M_t.empty(); }\n\n      /** Returns the size of the %map.  */\n      size_type\n      size() const\n      { return _M_t.size(); }\n\n      /** Returns the maximum size of the %map.  */\n      size_type\n      max_size() const\n      { return _M_t.max_size(); }\n\n      // [23.3.1.2] element access\n      /**\n       *  @brief  Subscript ( @c [] ) access to %map data.\n       *  @param  k  The key for which data should be retrieved.\n       *  @return  A reference to the data of the (key,data) %pair.\n       *\n       *  Allows for easy lookup with the subscript ( @c [] )\n       *  operator.  Returns data associated with the key specified in\n       *  subscript.  If the key does not exist, a pair with that key\n       *  is created using default values, which is then returned.\n       *\n       *  Lookup requires logarithmic time.\n       */\n      mapped_type&\n      operator[](const key_type& __k)\n      {\n\t// concept requirements\n\t__glibcxx_function_requires(_DefaultConstructibleConcept<mapped_type>)\n\n\titerator __i = lower_bound(__k);\n\t// __i->first is greater than or equivalent to __k.\n\tif (__i == end() || key_comp()(__k, (*__i).first))\n          __i = insert(__i, value_type(__k, mapped_type()));\n\treturn (*__i).second;\n      }\n\n      // _GLIBCXX_RESOLVE_LIB_DEFECTS\n      // DR 464. Suggestion for new member functions in standard containers.\n      /**\n       *  @brief  Access to %map data.\n       *  @param  k  The key for which data should be retrieved.\n       *  @return  A reference to the data whose key is equivalent to @a k, if\n       *           such a data is present in the %map.\n       *  @throw  std::out_of_range  If no such data is present.\n       */\n      mapped_type&\n      at(const key_type& __k)\n      {\n\titerator __i = lower_bound(__k);\n\tif (__i == end() || key_comp()(__k, (*__i).first))\n\t  __throw_out_of_range(__N(\"map::at\"));\n\treturn (*__i).second;\n      }\n\n      const mapped_type&\n      at(const key_type& __k) const\n      {\n\tconst_iterator __i = lower_bound(__k);\n\tif (__i == end() || key_comp()(__k, (*__i).first))\n\t  __throw_out_of_range(__N(\"map::at\"));\n\treturn (*__i).second;\n      }\n\n      // modifiers\n      /**\n       *  @brief Attempts to insert a std::pair into the %map.\n\n       *  @param  x  Pair to be inserted (see std::make_pair for easy creation \n       *\t     of pairs).\n\n       *  @return  A pair, of which the first element is an iterator that \n       *           points to the possibly inserted pair, and the second is \n       *           a bool that is true if the pair was actually inserted.\n       *\n       *  This function attempts to insert a (key, value) %pair into the %map.\n       *  A %map relies on unique keys and thus a %pair is only inserted if its\n       *  first element (the key) is not already present in the %map.\n       *\n       *  Insertion requires logarithmic time.\n       */\n      std::pair<iterator, bool>\n      insert(const value_type& __x)\n      { return _M_t._M_insert_unique(__x); }\n\n      /**\n       *  @brief Attempts to insert a std::pair into the %map.\n       *  @param  position  An iterator that serves as a hint as to where the\n       *                    pair should be inserted.\n       *  @param  x  Pair to be inserted (see std::make_pair for easy creation\n       *             of pairs).\n       *  @return  An iterator that points to the element with key of @a x (may\n       *           or may not be the %pair passed in).\n       *\n\n       *  This function is not concerned about whether the insertion\n       *  took place, and thus does not return a boolean like the\n       *  single-argument insert() does.  Note that the first\n       *  parameter is only a hint and can potentially improve the\n       *  performance of the insertion process.  A bad hint would\n       *  cause no gains in efficiency.\n       *\n       *  See\n       *  http://gcc.gnu.org/onlinedocs/libstdc++/23_containers/howto.html#4\n       *  for more on \"hinting\".\n       *\n       *  Insertion requires logarithmic time (if the hint is not taken).\n       */\n      iterator\n      insert(iterator __position, const value_type& __x)\n      { return _M_t._M_insert_unique(__position, __x); }\n\n      /**\n       *  @brief Template function that attemps to insert a range of elements.\n       *  @param  first  Iterator pointing to the start of the range to be\n       *                 inserted.\n       *  @param  last  Iterator pointing to the end of the range.\n       *\n       *  Complexity similar to that of the range constructor.\n       */\n      template <typename _InputIterator>\n        void\n        insert(_InputIterator __first, _InputIterator __last)\n        { _M_t._M_insert_unique(__first, __last); }\n\n      /**\n       *  @brief Erases an element from a %map.\n       *  @param  position  An iterator pointing to the element to be erased.\n       *\n       *  This function erases an element, pointed to by the given\n       *  iterator, from a %map.  Note that this function only erases\n       *  the element, and that if the element is itself a pointer,\n       *  the pointed-to memory is not touched in any way.  Managing\n       *  the pointer is the user's responsibilty.\n       */\n      void\n      erase(iterator __position)\n      { _M_t.erase(__position); }\n\n      /**\n       *  @brief Erases elements according to the provided key.\n       *  @param  x  Key of element to be erased.\n       *  @return  The number of elements erased.\n       *\n       *  This function erases all the elements located by the given key from\n       *  a %map.\n       *  Note that this function only erases the element, and that if\n       *  the element is itself a pointer, the pointed-to memory is not touched\n       *  in any way.  Managing the pointer is the user's responsibilty.\n       */\n      size_type\n      erase(const key_type& __x)\n      { return _M_t.erase(__x); }\n\n      /**\n       *  @brief Erases a [first,last) range of elements from a %map.\n       *  @param  first  Iterator pointing to the start of the range to be\n       *                 erased.\n       *  @param  last  Iterator pointing to the end of the range to be erased.\n       *\n       *  This function erases a sequence of elements from a %map.\n       *  Note that this function only erases the element, and that if\n       *  the element is itself a pointer, the pointed-to memory is not touched\n       *  in any way.  Managing the pointer is the user's responsibilty.\n       */\n      void\n      erase(iterator __first, iterator __last)\n      { _M_t.erase(__first, __last); }\n\n      /**\n       *  @brief  Swaps data with another %map.\n       *  @param  x  A %map of the same element and allocator types.\n       *\n       *  This exchanges the elements between two maps in constant\n       *  time.  (It is only swapping a pointer, an integer, and an\n       *  instance of the @c Compare type (which itself is often\n       *  stateless and empty), so it should be quite fast.)  Note\n       *  that the global std::swap() function is specialized such\n       *  that std::swap(m1,m2) will feed to this function.\n       */\n      void\n      swap(map& __x)\n      { _M_t.swap(__x._M_t); }\n\n      /**\n       *  Erases all elements in a %map.  Note that this function only\n       *  erases the elements, and that if the elements themselves are\n       *  pointers, the pointed-to memory is not touched in any way.\n       *  Managing the pointer is the user's responsibilty.\n       */\n      void\n      clear()\n      { _M_t.clear(); }\n\n      // observers\n      /**\n       *  Returns the key comparison object out of which the %map was\n       *  constructed.\n       */\n      key_compare\n      key_comp() const\n      { return _M_t.key_comp(); }\n\n      /**\n       *  Returns a value comparison object, built from the key comparison\n       *  object out of which the %map was constructed.\n       */\n      value_compare\n      value_comp() const\n      { return value_compare(_M_t.key_comp()); }\n\n      // [23.3.1.3] map operations\n      /**\n       *  @brief Tries to locate an element in a %map.\n       *  @param  x  Key of (key, value) %pair to be located.\n       *  @return  Iterator pointing to sought-after element, or end() if not\n       *           found.\n       *\n       *  This function takes a key and tries to locate the element with which\n       *  the key matches.  If successful the function returns an iterator\n       *  pointing to the sought after %pair.  If unsuccessful it returns the\n       *  past-the-end ( @c end() ) iterator.\n       */\n      iterator\n      find(const key_type& __x)\n      { return _M_t.find(__x); }\n\n      /**\n       *  @brief Tries to locate an element in a %map.\n       *  @param  x  Key of (key, value) %pair to be located.\n       *  @return  Read-only (constant) iterator pointing to sought-after\n       *           element, or end() if not found.\n       *\n       *  This function takes a key and tries to locate the element with which\n       *  the key matches.  If successful the function returns a constant\n       *  iterator pointing to the sought after %pair. If unsuccessful it\n       *  returns the past-the-end ( @c end() ) iterator.\n       */\n      const_iterator\n      find(const key_type& __x) const\n      { return _M_t.find(__x); }\n\n      /**\n       *  @brief  Finds the number of elements with given key.\n       *  @param  x  Key of (key, value) pairs to be located.\n       *  @return  Number of elements with specified key.\n       *\n       *  This function only makes sense for multimaps; for map the result will\n       *  either be 0 (not present) or 1 (present).\n       */\n      size_type\n      count(const key_type& __x) const\n      { return _M_t.find(__x) == _M_t.end() ? 0 : 1; }\n\n      /**\n       *  @brief Finds the beginning of a subsequence matching given key.\n       *  @param  x  Key of (key, value) pair to be located.\n       *  @return  Iterator pointing to first element equal to or greater\n       *           than key, or end().\n       *\n       *  This function returns the first element of a subsequence of elements\n       *  that matches the given key.  If unsuccessful it returns an iterator\n       *  pointing to the first element that has a greater value than given key\n       *  or end() if no such element exists.\n       */\n      iterator\n      lower_bound(const key_type& __x)\n      { return _M_t.lower_bound(__x); }\n\n      /**\n       *  @brief Finds the beginning of a subsequence matching given key.\n       *  @param  x  Key of (key, value) pair to be located.\n       *  @return  Read-only (constant) iterator pointing to first element\n       *           equal to or greater than key, or end().\n       *\n       *  This function returns the first element of a subsequence of elements\n       *  that matches the given key.  If unsuccessful it returns an iterator\n       *  pointing to the first element that has a greater value than given key\n       *  or end() if no such element exists.\n       */\n      const_iterator\n      lower_bound(const key_type& __x) const\n      { return _M_t.lower_bound(__x); }\n\n      /**\n       *  @brief Finds the end of a subsequence matching given key.\n       *  @param  x  Key of (key, value) pair to be located.\n       *  @return Iterator pointing to the first element\n       *          greater than key, or end().\n       */\n      iterator\n      upper_bound(const key_type& __x)\n      { return _M_t.upper_bound(__x); }\n\n      /**\n       *  @brief Finds the end of a subsequence matching given key.\n       *  @param  x  Key of (key, value) pair to be located.\n       *  @return  Read-only (constant) iterator pointing to first iterator\n       *           greater than key, or end().\n       */\n      const_iterator\n      upper_bound(const key_type& __x) const\n      { return _M_t.upper_bound(__x); }\n\n      /**\n       *  @brief Finds a subsequence matching given key.\n       *  @param  x  Key of (key, value) pairs to be located.\n       *  @return  Pair of iterators that possibly points to the subsequence\n       *           matching given key.\n       *\n       *  This function is equivalent to\n       *  @code\n       *    std::make_pair(c.lower_bound(val),\n       *                   c.upper_bound(val))\n       *  @endcode\n       *  (but is faster than making the calls separately).\n       *\n       *  This function probably only makes sense for multimaps.\n       */\n      std::pair<iterator, iterator>\n      equal_range(const key_type& __x)\n      { return _M_t.equal_range(__x); }\n\n      /**\n       *  @brief Finds a subsequence matching given key.\n       *  @param  x  Key of (key, value) pairs to be located.\n       *  @return  Pair of read-only (constant) iterators that possibly points\n       *           to the subsequence matching given key.\n       *\n       *  This function is equivalent to\n       *  @code\n       *    std::make_pair(c.lower_bound(val),\n       *                   c.upper_bound(val))\n       *  @endcode\n       *  (but is faster than making the calls separately).\n       *\n       *  This function probably only makes sense for multimaps.\n       */\n      std::pair<const_iterator, const_iterator>\n      equal_range(const key_type& __x) const\n      { return _M_t.equal_range(__x); }\n\n      template <typename _K1, typename _T1, typename _C1, typename _A1>\n        friend bool\n        operator== (const map<_K1, _T1, _C1, _A1>&,\n\t\t    const map<_K1, _T1, _C1, _A1>&);\n\n      template <typename _K1, typename _T1, typename _C1, typename _A1>\n        friend bool\n        operator< (const map<_K1, _T1, _C1, _A1>&,\n\t\t   const map<_K1, _T1, _C1, _A1>&);\n    };\n\n  /**\n   *  @brief  Map equality comparison.\n   *  @param  x  A %map.\n   *  @param  y  A %map of the same type as @a x.\n   *  @return  True iff the size and elements of the maps are equal.\n   *\n   *  This is an equivalence relation.  It is linear in the size of the\n   *  maps.  Maps are considered equivalent if their sizes are equal,\n   *  and if corresponding elements compare equal.\n  */\n  template <typename _Key, typename _Tp, typename _Compare, typename _Alloc>\n    inline bool\n    operator==(const map<_Key, _Tp, _Compare, _Alloc>& __x,\n               const map<_Key, _Tp, _Compare, _Alloc>& __y)\n    { return __x._M_t == __y._M_t; }\n\n  /**\n   *  @brief  Map ordering relation.\n   *  @param  x  A %map.\n   *  @param  y  A %map of the same type as @a x.\n   *  @return  True iff @a x is lexicographically less than @a y.\n   *\n   *  This is a total ordering relation.  It is linear in the size of the\n   *  maps.  The elements must be comparable with @c <.\n   *\n   *  See std::lexicographical_compare() for how the determination is made.\n  */\n  template <typename _Key, typename _Tp, typename _Compare, typename _Alloc>\n    inline bool\n    operator<(const map<_Key, _Tp, _Compare, _Alloc>& __x,\n              const map<_Key, _Tp, _Compare, _Alloc>& __y)\n    { return __x._M_t < __y._M_t; }\n\n  /// Based on operator==\n  template <typename _Key, typename _Tp, typename _Compare, typename _Alloc>\n    inline bool\n    operator!=(const map<_Key, _Tp, _Compare, _Alloc>& __x,\n               const map<_Key, _Tp, _Compare, _Alloc>& __y)\n    { return !(__x == __y); }\n\n  /// Based on operator<\n  template <typename _Key, typename _Tp, typename _Compare, typename _Alloc>\n    inline bool\n    operator>(const map<_Key, _Tp, _Compare, _Alloc>& __x,\n              const map<_Key, _Tp, _Compare, _Alloc>& __y)\n    { return __y < __x; }\n\n  /// Based on operator<\n  template <typename _Key, typename _Tp, typename _Compare, typename _Alloc>\n    inline bool\n    operator<=(const map<_Key, _Tp, _Compare, _Alloc>& __x,\n               const map<_Key, _Tp, _Compare, _Alloc>& __y)\n    { return !(__y < __x); }\n\n  /// Based on operator<\n  template <typename _Key, typename _Tp, typename _Compare, typename _Alloc>\n    inline bool\n    operator>=(const map<_Key, _Tp, _Compare, _Alloc>& __x,\n               const map<_Key, _Tp, _Compare, _Alloc>& __y)\n    { return !(__x < __y); }\n\n  /// See std::map::swap().\n  template <typename _Key, typename _Tp, typename _Compare, typename _Alloc>\n    inline void\n    swap(map<_Key, _Tp, _Compare, _Alloc>& __x,\n\t map<_Key, _Tp, _Compare, _Alloc>& __y)\n    { __x.swap(__y); }\n\n_GLIBCXX_END_NESTED_NAMESPACE\n\n#endif /* _MAP_H */\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/bits/stl_multimap.h",
    "content": "// Multimap implementation -*- C++ -*-\n\n// Copyright (C) 2001, 2002, 2004, 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n/*\n *\n * Copyright (c) 1994\n * Hewlett-Packard Company\n *\n * Permission to use, copy, modify, distribute and sell this software\n * and its documentation for any purpose is hereby granted without fee,\n * provided that the above copyright notice appear in all copies and\n * that both that copyright notice and this permission notice appear\n * in supporting documentation.  Hewlett-Packard Company makes no\n * representations about the suitability of this software for any\n * purpose.  It is provided \"as is\" without express or implied warranty.\n *\n *\n * Copyright (c) 1996,1997\n * Silicon Graphics Computer Systems, Inc.\n *\n * Permission to use, copy, modify, distribute and sell this software\n * and its documentation for any purpose is hereby granted without fee,\n * provided that the above copyright notice appear in all copies and\n * that both that copyright notice and this permission notice appear\n * in supporting documentation.  Silicon Graphics makes no\n * representations about the suitability of this software for any\n * purpose.  It is provided \"as is\" without express or implied warranty.\n */\n\n/** @file stl_multimap.h\n *  This is an internal header file, included by other library headers.\n *  You should not attempt to use it directly.\n */\n\n#ifndef _MULTIMAP_H\n#define _MULTIMAP_H 1\n\n#include <bits/concept_check.h>\n\n_GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD)\n\n  /**\n   *  @brief A standard container made up of (key,value) pairs, which can be\n   *  retrieved based on a key, in logarithmic time.\n   *\n   *  @ingroup Containers\n   *  @ingroup Assoc_containers\n   *\n   *  Meets the requirements of a <a href=\"tables.html#65\">container</a>, a\n   *  <a href=\"tables.html#66\">reversible container</a>, and an\n   *  <a href=\"tables.html#69\">associative container</a> (using equivalent\n   *  keys).  For a @c multimap<Key,T> the key_type is Key, the mapped_type\n   *  is T, and the value_type is std::pair<const Key,T>.\n   *\n   *  Multimaps support bidirectional iterators.\n   *\n   *  @if maint\n   *  The private tree data is declared exactly the same way for map and\n   *  multimap; the distinction is made entirely in how the tree functions are\n   *  called (*_unique versus *_equal, same as the standard).\n   *  @endif\n  */\n  template <typename _Key, typename _Tp,\n\t    typename _Compare = std::less<_Key>,\n\t    typename _Alloc = std::allocator<std::pair<const _Key, _Tp> > >\n    class multimap\n    {\n    public:\n      typedef _Key                                          key_type;\n      typedef _Tp                                           mapped_type;\n      typedef std::pair<const _Key, _Tp>                    value_type;\n      typedef _Compare                                      key_compare;\n      typedef _Alloc                                        allocator_type;\n\n    private:\n      // concept requirements\n      typedef typename _Alloc::value_type                   _Alloc_value_type;\n      __glibcxx_class_requires(_Tp, _SGIAssignableConcept)\n      __glibcxx_class_requires4(_Compare, bool, _Key, _Key,\n\t\t\t\t_BinaryFunctionConcept)\n      __glibcxx_class_requires2(value_type, _Alloc_value_type, _SameTypeConcept)\t\n\n    public:\n      class value_compare\n      : public std::binary_function<value_type, value_type, bool>\n      {\n\tfriend class multimap<_Key, _Tp, _Compare, _Alloc>;\n      protected:\n\t_Compare comp;\n\n\tvalue_compare(_Compare __c)\n\t: comp(__c) { }\n\n      public:\n\tbool operator()(const value_type& __x, const value_type& __y) const\n\t{ return comp(__x.first, __y.first); }\n      };\n\n    private:\n      /// @if maint  This turns a red-black tree into a [multi]map.  @endif\n      typedef typename _Alloc::template rebind<value_type>::other \n        _Pair_alloc_type;\n\n      typedef _Rb_tree<key_type, value_type, _Select1st<value_type>,\n\t\t       key_compare, _Pair_alloc_type> _Rep_type;\n      /// @if maint  The actual tree structure.  @endif\n      _Rep_type _M_t;\n\n    public:\n      // many of these are specified differently in ISO, but the following are\n      // \"functionally equivalent\"\n      typedef typename _Pair_alloc_type::pointer         pointer;\n      typedef typename _Pair_alloc_type::const_pointer   const_pointer;\n      typedef typename _Pair_alloc_type::reference       reference;\n      typedef typename _Pair_alloc_type::const_reference const_reference;\n      typedef typename _Rep_type::iterator               iterator;\n      typedef typename _Rep_type::const_iterator         const_iterator;\n      typedef typename _Rep_type::size_type              size_type;\n      typedef typename _Rep_type::difference_type        difference_type;\n      typedef typename _Rep_type::reverse_iterator       reverse_iterator;\n      typedef typename _Rep_type::const_reverse_iterator const_reverse_iterator;\n\n      // [23.3.2] construct/copy/destroy\n      // (get_allocator() is also listed in this section)\n      /**\n       *  @brief  Default constructor creates no elements.\n       */\n      multimap()\n      : _M_t(_Compare(), allocator_type()) { }\n\n      // for some reason this was made a separate function\n      /**\n       *  @brief  Default constructor creates no elements.\n       */\n      explicit\n      multimap(const _Compare& __comp,\n\t       const allocator_type& __a = allocator_type())\n      : _M_t(__comp, __a) { }\n\n      /**\n       *  @brief  %Multimap copy constructor.\n       *  @param  x  A %multimap of identical element and allocator types.\n       *\n       *  The newly-created %multimap uses a copy of the allocation object used\n       *  by @a x.\n       */\n      multimap(const multimap& __x)\n      : _M_t(__x._M_t) { }\n\n      /**\n       *  @brief  Builds a %multimap from a range.\n       *  @param  first  An input iterator.\n       *  @param  last  An input iterator.\n       *\n       *  Create a %multimap consisting of copies of the elements from\n       *  [first,last).  This is linear in N if the range is already sorted,\n       *  and NlogN otherwise (where N is distance(first,last)).\n       */\n      template <typename _InputIterator>\n        multimap(_InputIterator __first, _InputIterator __last)\n\t: _M_t(_Compare(), allocator_type())\n        { _M_t._M_insert_equal(__first, __last); }\n\n      /**\n       *  @brief  Builds a %multimap from a range.\n       *  @param  first  An input iterator.\n       *  @param  last  An input iterator.\n       *  @param  comp  A comparison functor.\n       *  @param  a  An allocator object.\n       *\n       *  Create a %multimap consisting of copies of the elements from\n       *  [first,last).  This is linear in N if the range is already sorted,\n       *  and NlogN otherwise (where N is distance(first,last)).\n       */\n      template <typename _InputIterator>\n        multimap(_InputIterator __first, _InputIterator __last,\n\t\t const _Compare& __comp,\n\t\t const allocator_type& __a = allocator_type())\n        : _M_t(__comp, __a)\n        { _M_t._M_insert_equal(__first, __last); }\n\n      // FIXME There is no dtor declared, but we should have something generated\n      // by Doxygen.  I don't know what tags to add to this paragraph to make\n      // that happen:\n      /**\n       *  The dtor only erases the elements, and note that if the elements\n       *  themselves are pointers, the pointed-to memory is not touched in any\n       *  way.  Managing the pointer is the user's responsibilty.\n       */\n\n      /**\n       *  @brief  %Multimap assignment operator.\n       *  @param  x  A %multimap of identical element and allocator types.\n       *\n       *  All the elements of @a x are copied, but unlike the copy constructor,\n       *  the allocator object is not copied.\n       */\n      multimap&\n      operator=(const multimap& __x)\n      {\n\t_M_t = __x._M_t;\n\treturn *this;\n      }\n\n      /// Get a copy of the memory allocation object.\n      allocator_type\n      get_allocator() const\n      { return _M_t.get_allocator(); }\n\n      // iterators\n      /**\n       *  Returns a read/write iterator that points to the first pair in the\n       *  %multimap.  Iteration is done in ascending order according to the\n       *  keys.\n       */\n      iterator\n      begin()\n      { return _M_t.begin(); }\n\n      /**\n       *  Returns a read-only (constant) iterator that points to the first pair\n       *  in the %multimap.  Iteration is done in ascending order according to\n       *  the keys.\n       */\n      const_iterator\n      begin() const\n      { return _M_t.begin(); }\n\n      /**\n       *  Returns a read/write iterator that points one past the last pair in\n       *  the %multimap.  Iteration is done in ascending order according to the\n       *  keys.\n       */\n      iterator\n      end()\n      { return _M_t.end(); }\n\n      /**\n       *  Returns a read-only (constant) iterator that points one past the last\n       *  pair in the %multimap.  Iteration is done in ascending order according\n       *  to the keys.\n       */\n      const_iterator\n      end() const\n      { return _M_t.end(); }\n\n      /**\n       *  Returns a read/write reverse iterator that points to the last pair in\n       *  the %multimap.  Iteration is done in descending order according to the\n       *  keys.\n       */\n      reverse_iterator\n      rbegin()\n      { return _M_t.rbegin(); }\n\n      /**\n       *  Returns a read-only (constant) reverse iterator that points to the\n       *  last pair in the %multimap.  Iteration is done in descending order\n       *  according to the keys.\n       */\n      const_reverse_iterator\n      rbegin() const\n      { return _M_t.rbegin(); }\n\n      /**\n       *  Returns a read/write reverse iterator that points to one before the\n       *  first pair in the %multimap.  Iteration is done in descending order\n       *  according to the keys.\n       */\n      reverse_iterator\n      rend()\n      { return _M_t.rend(); }\n\n      /**\n       *  Returns a read-only (constant) reverse iterator that points to one\n       *  before the first pair in the %multimap.  Iteration is done in\n       *  descending order according to the keys.\n       */\n      const_reverse_iterator\n      rend() const\n      { return _M_t.rend(); }\n\n      // capacity\n      /** Returns true if the %multimap is empty.  */\n      bool\n      empty() const\n      { return _M_t.empty(); }\n\n      /** Returns the size of the %multimap.  */\n      size_type\n      size() const\n      { return _M_t.size(); }\n\n      /** Returns the maximum size of the %multimap.  */\n      size_type\n      max_size() const\n      { return _M_t.max_size(); }\n\n      // modifiers\n      /**\n       *  @brief Inserts a std::pair into the %multimap.\n       *  @param  x  Pair to be inserted (see std::make_pair for easy creation\n       *             of pairs).\n       *  @return An iterator that points to the inserted (key,value) pair.\n       *\n       *  This function inserts a (key, value) pair into the %multimap.\n       *  Contrary to a std::map the %multimap does not rely on unique keys and\n       *  thus multiple pairs with the same key can be inserted.\n       *\n       *  Insertion requires logarithmic time.\n       */\n      iterator\n      insert(const value_type& __x)\n      { return _M_t._M_insert_equal(__x); }\n\n      /**\n       *  @brief Inserts a std::pair into the %multimap.\n       *  @param  position  An iterator that serves as a hint as to where the\n       *                    pair should be inserted.\n       *  @param  x  Pair to be inserted (see std::make_pair for easy creation\n       *             of pairs).\n       *  @return An iterator that points to the inserted (key,value) pair.\n       *\n       *  This function inserts a (key, value) pair into the %multimap.\n       *  Contrary to a std::map the %multimap does not rely on unique keys and\n       *  thus multiple pairs with the same key can be inserted.\n       *  Note that the first parameter is only a hint and can potentially\n       *  improve the performance of the insertion process.  A bad hint would\n       *  cause no gains in efficiency.\n       *\n       *  See http://gcc.gnu.org/onlinedocs/libstdc++/23_containers/howto.html#4\n       *  for more on \"hinting\".\n       *\n       *  Insertion requires logarithmic time (if the hint is not taken).\n       */\n      iterator\n      insert(iterator __position, const value_type& __x)\n      { return _M_t._M_insert_equal(__position, __x); }\n\n      /**\n       *  @brief A template function that attemps to insert a range of elements.\n       *  @param  first  Iterator pointing to the start of the range to be\n       *                 inserted.\n       *  @param  last  Iterator pointing to the end of the range.\n       *\n       *  Complexity similar to that of the range constructor.\n       */\n      template <typename _InputIterator>\n        void\n        insert(_InputIterator __first, _InputIterator __last)\n        { _M_t._M_insert_equal(__first, __last); }\n\n      /**\n       *  @brief Erases an element from a %multimap.\n       *  @param  position  An iterator pointing to the element to be erased.\n       *\n       *  This function erases an element, pointed to by the given iterator,\n       *  from a %multimap.  Note that this function only erases the element,\n       *  and that if the element is itself a pointer, the pointed-to memory is\n       *  not touched in any way.  Managing the pointer is the user's\n       *  responsibilty.\n       */\n      void\n      erase(iterator __position)\n      { _M_t.erase(__position); }\n\n      /**\n       *  @brief Erases elements according to the provided key.\n       *  @param  x  Key of element to be erased.\n       *  @return  The number of elements erased.\n       *\n       *  This function erases all elements located by the given key from a\n       *  %multimap.\n       *  Note that this function only erases the element, and that if\n       *  the element is itself a pointer, the pointed-to memory is not touched\n       *  in any way.  Managing the pointer is the user's responsibilty.\n       */\n      size_type\n      erase(const key_type& __x)\n      { return _M_t.erase(__x); }\n\n      /**\n       *  @brief Erases a [first,last) range of elements from a %multimap.\n       *  @param  first  Iterator pointing to the start of the range to be\n       *                 erased.\n       *  @param  last  Iterator pointing to the end of the range to be erased.\n       *\n       *  This function erases a sequence of elements from a %multimap.\n       *  Note that this function only erases the elements, and that if\n       *  the elements themselves are pointers, the pointed-to memory is not\n       *  touched in any way.  Managing the pointer is the user's responsibilty.\n       */\n      void\n      erase(iterator __first, iterator __last)\n      { _M_t.erase(__first, __last); }\n\n      /**\n       *  @brief  Swaps data with another %multimap.\n       *  @param  x  A %multimap of the same element and allocator types.\n       *\n       *  This exchanges the elements between two multimaps in constant time.\n       *  (It is only swapping a pointer, an integer, and an instance of\n       *  the @c Compare type (which itself is often stateless and empty), so it\n       *  should be quite fast.)\n       *  Note that the global std::swap() function is specialized such that\n       *  std::swap(m1,m2) will feed to this function.\n       */\n      void\n      swap(multimap& __x)\n      { _M_t.swap(__x._M_t); }\n\n      /**\n       *  Erases all elements in a %multimap.  Note that this function only\n       *  erases the elements, and that if the elements themselves are pointers,\n       *  the pointed-to memory is not touched in any way.  Managing the pointer\n       *  is the user's responsibilty.\n       */\n      void\n      clear()\n      { _M_t.clear(); }\n\n      // observers\n      /**\n       *  Returns the key comparison object out of which the %multimap\n       *  was constructed.\n       */\n      key_compare\n      key_comp() const\n      { return _M_t.key_comp(); }\n\n      /**\n       *  Returns a value comparison object, built from the key comparison\n       *  object out of which the %multimap was constructed.\n       */\n      value_compare\n      value_comp() const\n      { return value_compare(_M_t.key_comp()); }\n\n      // multimap operations\n      /**\n       *  @brief Tries to locate an element in a %multimap.\n       *  @param  x  Key of (key, value) pair to be located.\n       *  @return  Iterator pointing to sought-after element,\n       *           or end() if not found.\n       *\n       *  This function takes a key and tries to locate the element with which\n       *  the key matches.  If successful the function returns an iterator\n       *  pointing to the sought after %pair.  If unsuccessful it returns the\n       *  past-the-end ( @c end() ) iterator.\n       */\n      iterator\n      find(const key_type& __x)\n      { return _M_t.find(__x); }\n\n      /**\n       *  @brief Tries to locate an element in a %multimap.\n       *  @param  x  Key of (key, value) pair to be located.\n       *  @return  Read-only (constant) iterator pointing to sought-after\n       *           element, or end() if not found.\n       *\n       *  This function takes a key and tries to locate the element with which\n       *  the key matches.  If successful the function returns a constant\n       *  iterator pointing to the sought after %pair.  If unsuccessful it\n       *  returns the past-the-end ( @c end() ) iterator.\n       */\n      const_iterator\n      find(const key_type& __x) const\n      { return _M_t.find(__x); }\n\n      /**\n       *  @brief Finds the number of elements with given key.\n       *  @param  x  Key of (key, value) pairs to be located.\n       *  @return Number of elements with specified key.\n       */\n      size_type\n      count(const key_type& __x) const\n      { return _M_t.count(__x); }\n\n      /**\n       *  @brief Finds the beginning of a subsequence matching given key.\n       *  @param  x  Key of (key, value) pair to be located.\n       *  @return  Iterator pointing to first element equal to or greater\n       *           than key, or end().\n       *\n       *  This function returns the first element of a subsequence of elements\n       *  that matches the given key.  If unsuccessful it returns an iterator\n       *  pointing to the first element that has a greater value than given key\n       *  or end() if no such element exists.\n       */\n      iterator\n      lower_bound(const key_type& __x)\n      { return _M_t.lower_bound(__x); }\n\n      /**\n       *  @brief Finds the beginning of a subsequence matching given key.\n       *  @param  x  Key of (key, value) pair to be located.\n       *  @return  Read-only (constant) iterator pointing to first element\n       *           equal to or greater than key, or end().\n       *\n       *  This function returns the first element of a subsequence of elements\n       *  that matches the given key.  If unsuccessful the iterator will point\n       *  to the next greatest element or, if no such greater element exists, to\n       *  end().\n       */\n      const_iterator\n      lower_bound(const key_type& __x) const\n      { return _M_t.lower_bound(__x); }\n\n      /**\n       *  @brief Finds the end of a subsequence matching given key.\n       *  @param  x  Key of (key, value) pair to be located.\n       *  @return Iterator pointing to the first element\n       *          greater than key, or end().\n       */\n      iterator\n      upper_bound(const key_type& __x)\n      { return _M_t.upper_bound(__x); }\n\n      /**\n       *  @brief Finds the end of a subsequence matching given key.\n       *  @param  x  Key of (key, value) pair to be located.\n       *  @return  Read-only (constant) iterator pointing to first iterator\n       *           greater than key, or end().\n       */\n      const_iterator\n      upper_bound(const key_type& __x) const\n      { return _M_t.upper_bound(__x); }\n\n      /**\n       *  @brief Finds a subsequence matching given key.\n       *  @param  x  Key of (key, value) pairs to be located.\n       *  @return  Pair of iterators that possibly points to the subsequence\n       *           matching given key.\n       *\n       *  This function is equivalent to\n       *  @code\n       *    std::make_pair(c.lower_bound(val),\n       *                   c.upper_bound(val))\n       *  @endcode\n       *  (but is faster than making the calls separately).\n       */\n      std::pair<iterator, iterator>\n      equal_range(const key_type& __x)\n      { return _M_t.equal_range(__x); }\n\n      /**\n       *  @brief Finds a subsequence matching given key.\n       *  @param  x  Key of (key, value) pairs to be located.\n       *  @return  Pair of read-only (constant) iterators that possibly points\n       *           to the subsequence matching given key.\n       *\n       *  This function is equivalent to\n       *  @code\n       *    std::make_pair(c.lower_bound(val),\n       *                   c.upper_bound(val))\n       *  @endcode\n       *  (but is faster than making the calls separately).\n       */\n      std::pair<const_iterator, const_iterator>\n      equal_range(const key_type& __x) const\n      { return _M_t.equal_range(__x); }\n\n      template <typename _K1, typename _T1, typename _C1, typename _A1>\n        friend bool\n        operator== (const multimap<_K1, _T1, _C1, _A1>&,\n\t\t    const multimap<_K1, _T1, _C1, _A1>&);\n\n      template <typename _K1, typename _T1, typename _C1, typename _A1>\n        friend bool\n        operator< (const multimap<_K1, _T1, _C1, _A1>&,\n\t\t   const multimap<_K1, _T1, _C1, _A1>&);\n  };\n\n  /**\n   *  @brief  Multimap equality comparison.\n   *  @param  x  A %multimap.\n   *  @param  y  A %multimap of the same type as @a x.\n   *  @return  True iff the size and elements of the maps are equal.\n   *\n   *  This is an equivalence relation.  It is linear in the size of the\n   *  multimaps.  Multimaps are considered equivalent if their sizes are equal,\n   *  and if corresponding elements compare equal.\n  */\n  template <typename _Key, typename _Tp, typename _Compare, typename _Alloc>\n    inline bool\n    operator==(const multimap<_Key, _Tp, _Compare, _Alloc>& __x,\n               const multimap<_Key, _Tp, _Compare, _Alloc>& __y)\n    { return __x._M_t == __y._M_t; }\n\n  /**\n   *  @brief  Multimap ordering relation.\n   *  @param  x  A %multimap.\n   *  @param  y  A %multimap of the same type as @a x.\n   *  @return  True iff @a x is lexicographically less than @a y.\n   *\n   *  This is a total ordering relation.  It is linear in the size of the\n   *  multimaps.  The elements must be comparable with @c <.\n   *\n   *  See std::lexicographical_compare() for how the determination is made.\n  */\n  template <typename _Key, typename _Tp, typename _Compare, typename _Alloc>\n    inline bool\n    operator<(const multimap<_Key, _Tp, _Compare, _Alloc>& __x,\n              const multimap<_Key, _Tp, _Compare, _Alloc>& __y)\n    { return __x._M_t < __y._M_t; }\n\n  /// Based on operator==\n  template <typename _Key, typename _Tp, typename _Compare, typename _Alloc>\n    inline bool\n    operator!=(const multimap<_Key, _Tp, _Compare, _Alloc>& __x,\n               const multimap<_Key, _Tp, _Compare, _Alloc>& __y)\n    { return !(__x == __y); }\n\n  /// Based on operator<\n  template <typename _Key, typename _Tp, typename _Compare, typename _Alloc>\n    inline bool\n    operator>(const multimap<_Key, _Tp, _Compare, _Alloc>& __x,\n              const multimap<_Key, _Tp, _Compare, _Alloc>& __y)\n    { return __y < __x; }\n\n  /// Based on operator<\n  template <typename _Key, typename _Tp, typename _Compare, typename _Alloc>\n    inline bool\n    operator<=(const multimap<_Key, _Tp, _Compare, _Alloc>& __x,\n               const multimap<_Key, _Tp, _Compare, _Alloc>& __y)\n    { return !(__y < __x); }\n\n  /// Based on operator<\n  template <typename _Key, typename _Tp, typename _Compare, typename _Alloc>\n    inline bool\n    operator>=(const multimap<_Key, _Tp, _Compare, _Alloc>& __x,\n               const multimap<_Key, _Tp, _Compare, _Alloc>& __y)\n    { return !(__x < __y); }\n\n  /// See std::multimap::swap().\n  template <typename _Key, typename _Tp, typename _Compare, typename _Alloc>\n    inline void\n    swap(multimap<_Key, _Tp, _Compare, _Alloc>& __x,\n         multimap<_Key, _Tp, _Compare, _Alloc>& __y)\n    { __x.swap(__y); }\n\n_GLIBCXX_END_NESTED_NAMESPACE\n\n#endif /* _MULTIMAP_H */\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/bits/stl_multiset.h",
    "content": "// Multiset implementation -*- C++ -*-\n\n// Copyright (C) 2001, 2002, 2004, 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n/*\n *\n * Copyright (c) 1994\n * Hewlett-Packard Company\n *\n * Permission to use, copy, modify, distribute and sell this software\n * and its documentation for any purpose is hereby granted without fee,\n * provided that the above copyright notice appear in all copies and\n * that both that copyright notice and this permission notice appear\n * in supporting documentation.  Hewlett-Packard Company makes no\n * representations about the suitability of this software for any\n * purpose.  It is provided \"as is\" without express or implied warranty.\n *\n *\n * Copyright (c) 1996\n * Silicon Graphics Computer Systems, Inc.\n *\n * Permission to use, copy, modify, distribute and sell this software\n * and its documentation for any purpose is hereby granted without fee,\n * provided that the above copyright notice appear in all copies and\n * that both that copyright notice and this permission notice appear\n * in supporting documentation.  Silicon Graphics makes no\n * representations about the suitability of this software for any\n * purpose.  It is provided \"as is\" without express or implied warranty.\n */\n\n/** @file stl_multiset.h\n *  This is an internal header file, included by other library headers.\n *  You should not attempt to use it directly.\n */\n\n#ifndef _MULTISET_H\n#define _MULTISET_H 1\n\n#include <bits/concept_check.h>\n\n_GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD)\n\n  /**\n   *  @brief A standard container made up of elements, which can be retrieved\n   *  in logarithmic time.\n   *\n   *  @ingroup Containers\n   *  @ingroup Assoc_containers\n   *\n   *  Meets the requirements of a <a href=\"tables.html#65\">container</a>, a\n   *  <a href=\"tables.html#66\">reversible container</a>, and an\n   *  <a href=\"tables.html#69\">associative container</a> (using equivalent\n   *  keys).  For a @c multiset<Key> the key_type and value_type are Key.\n   *\n   *  Multisets support bidirectional iterators.\n   *\n   *  @if maint\n   *  The private tree data is declared exactly the same way for set and\n   *  multiset; the distinction is made entirely in how the tree functions are\n   *  called (*_unique versus *_equal, same as the standard).\n   *  @endif\n  */\n  template <class _Key, class _Compare = std::less<_Key>,\n\t    class _Alloc = std::allocator<_Key> >\n    class multiset\n    {\n      // concept requirements\n      typedef typename _Alloc::value_type                   _Alloc_value_type;\n      __glibcxx_class_requires(_Key, _SGIAssignableConcept)\n      __glibcxx_class_requires4(_Compare, bool, _Key, _Key,\n\t\t\t\t_BinaryFunctionConcept)\n      __glibcxx_class_requires2(_Key, _Alloc_value_type, _SameTypeConcept)\t\n\n    public:\n      // typedefs:\n      typedef _Key     key_type;\n      typedef _Key     value_type;\n      typedef _Compare key_compare;\n      typedef _Compare value_compare;\n      typedef _Alloc   allocator_type;\n\n    private:\n      /// @if maint  This turns a red-black tree into a [multi]set.  @endif\n      typedef typename _Alloc::template rebind<_Key>::other _Key_alloc_type;\n\n      typedef _Rb_tree<key_type, value_type, _Identity<value_type>,\n\t\t       key_compare, _Key_alloc_type> _Rep_type;\n      /// @if maint  The actual tree structure.  @endif\n      _Rep_type _M_t;\n\n    public:\n      typedef typename _Key_alloc_type::pointer             pointer;\n      typedef typename _Key_alloc_type::const_pointer       const_pointer;\n      typedef typename _Key_alloc_type::reference           reference;\n      typedef typename _Key_alloc_type::const_reference     const_reference;\n      // _GLIBCXX_RESOLVE_LIB_DEFECTS\n      // DR 103. set::iterator is required to be modifiable,\n      // but this allows modification of keys.\n      typedef typename _Rep_type::const_iterator            iterator;\n      typedef typename _Rep_type::const_iterator            const_iterator;\n      typedef typename _Rep_type::const_reverse_iterator    reverse_iterator;\n      typedef typename _Rep_type::const_reverse_iterator    const_reverse_iterator;\n      typedef typename _Rep_type::size_type                 size_type;\n      typedef typename _Rep_type::difference_type           difference_type;\n\n      // allocation/deallocation\n\n      /**\n       *  @brief  Default constructor creates no elements.\n       */\n      multiset()\n      : _M_t(_Compare(), allocator_type()) { }\n\n      explicit\n      multiset(const _Compare& __comp,\n\t       const allocator_type& __a = allocator_type())\n      : _M_t(__comp, __a) { }\n\n      /**\n       *  @brief  Builds a %multiset from a range.\n       *  @param  first  An input iterator.\n       *  @param  last  An input iterator.\n       *\n       *  Create a %multiset consisting of copies of the elements from\n       *  [first,last).  This is linear in N if the range is already sorted,\n       *  and NlogN otherwise (where N is distance(first,last)).\n       */\n      template <class _InputIterator>\n        multiset(_InputIterator __first, _InputIterator __last)\n\t: _M_t(_Compare(), allocator_type())\n        { _M_t._M_insert_equal(__first, __last); }\n\n      /**\n       *  @brief  Builds a %multiset from a range.\n       *  @param  first  An input iterator.\n       *  @param  last  An input iterator.\n       *  @param  comp  A comparison functor.\n       *  @param  a  An allocator object.\n       *\n       *  Create a %multiset consisting of copies of the elements from\n       *  [first,last).  This is linear in N if the range is already sorted,\n       *  and NlogN otherwise (where N is distance(first,last)).\n       */\n      template <class _InputIterator>\n        multiset(_InputIterator __first, _InputIterator __last,\n\t\t const _Compare& __comp,\n\t\t const allocator_type& __a = allocator_type())\n\t: _M_t(__comp, __a)\n        { _M_t._M_insert_equal(__first, __last); }\n\n      /**\n       *  @brief  %Multiset copy constructor.\n       *  @param  x  A %multiset of identical element and allocator types.\n       *\n       *  The newly-created %multiset uses a copy of the allocation object used\n       *  by @a x.\n       */\n      multiset(const multiset<_Key,_Compare,_Alloc>& __x)\n      : _M_t(__x._M_t) { }\n\n      /**\n       *  @brief  %Multiset assignment operator.\n       *  @param  x  A %multiset of identical element and allocator types.\n       *\n       *  All the elements of @a x are copied, but unlike the copy constructor,\n       *  the allocator object is not copied.\n       */\n      multiset<_Key,_Compare,_Alloc>&\n      operator=(const multiset<_Key,_Compare,_Alloc>& __x)\n      {\n\t_M_t = __x._M_t;\n\treturn *this;\n      }\n\n      // accessors:\n\n      ///  Returns the comparison object.\n      key_compare\n      key_comp() const\n      { return _M_t.key_comp(); }\n      ///  Returns the comparison object.\n      value_compare\n      value_comp() const\n      { return _M_t.key_comp(); }\n      ///  Returns the memory allocation object.\n      allocator_type\n      get_allocator() const\n      { return _M_t.get_allocator(); }\n\n      /**\n       *  Returns a read/write iterator that points to the first element in the\n       *  %multiset.  Iteration is done in ascending order according to the\n       *  keys.\n       */\n      iterator\n      begin() const\n      { return _M_t.begin(); }\n\n      /**\n       *  Returns a read/write iterator that points one past the last element in\n       *  the %multiset.  Iteration is done in ascending order according to the\n       *  keys.\n       */\n      iterator\n      end() const\n      { return _M_t.end(); }\n\n      /**\n       *  Returns a read/write reverse iterator that points to the last element\n       *  in the %multiset.  Iteration is done in descending order according to\n       *  the keys.\n       */\n      reverse_iterator\n      rbegin() const\n      { return _M_t.rbegin(); }\n\n      /**\n       *  Returns a read/write reverse iterator that points to the last element\n       *  in the %multiset.  Iteration is done in descending order according to\n       *  the keys.\n       */\n      reverse_iterator\n      rend() const\n      { return _M_t.rend(); }\n\n      ///  Returns true if the %set is empty.\n      bool\n      empty() const\n      { return _M_t.empty(); }\n\n      ///  Returns the size of the %set.\n      size_type\n      size() const\n      { return _M_t.size(); }\n\n      ///  Returns the maximum size of the %set.\n      size_type\n      max_size() const\n      { return _M_t.max_size(); }\n\n      /**\n       *  @brief  Swaps data with another %multiset.\n       *  @param  x  A %multiset of the same element and allocator types.\n       *\n       *  This exchanges the elements between two multisets in constant time.\n       *  (It is only swapping a pointer, an integer, and an instance of the @c\n       *  Compare type (which itself is often stateless and empty), so it should\n       *  be quite fast.)\n       *  Note that the global std::swap() function is specialized such that\n       *  std::swap(s1,s2) will feed to this function.\n       */\n      void\n      swap(multiset<_Key, _Compare, _Alloc>& __x)\n      { _M_t.swap(__x._M_t); }\n\n      // insert/erase\n      /**\n       *  @brief Inserts an element into the %multiset.\n       *  @param  x  Element to be inserted.\n       *  @return An iterator that points to the inserted element.\n       *\n       *  This function inserts an element into the %multiset.  Contrary\n       *  to a std::set the %multiset does not rely on unique keys and thus\n       *  multiple copies of the same element can be inserted.\n       *\n       *  Insertion requires logarithmic time.\n       */\n      iterator\n      insert(const value_type& __x)\n      { return _M_t._M_insert_equal(__x); }\n\n      /**\n       *  @brief Inserts an element into the %multiset.\n       *  @param  position  An iterator that serves as a hint as to where the\n       *                    element should be inserted.\n       *  @param  x  Element to be inserted.\n       *  @return An iterator that points to the inserted element.\n       *\n       *  This function inserts an element into the %multiset.  Contrary\n       *  to a std::set the %multiset does not rely on unique keys and thus\n       *  multiple copies of the same element can be inserted.\n       *\n       *  Note that the first parameter is only a hint and can potentially\n       *  improve the performance of the insertion process.  A bad hint would\n       *  cause no gains in efficiency.\n       *\n       *  See http://gcc.gnu.org/onlinedocs/libstdc++/23_containers/howto.html#4\n       *  for more on \"hinting\".\n       *\n       *  Insertion requires logarithmic time (if the hint is not taken).\n       */\n      iterator\n      insert(iterator __position, const value_type& __x)\n      { return _M_t._M_insert_equal(__position, __x); }\n\n      /**\n       *  @brief A template function that attemps to insert a range of elements.\n       *  @param  first  Iterator pointing to the start of the range to be\n       *                 inserted.\n       *  @param  last  Iterator pointing to the end of the range.\n       *\n       *  Complexity similar to that of the range constructor.\n       */\n      template <class _InputIterator>\n        void\n        insert(_InputIterator __first, _InputIterator __last)\n        { _M_t._M_insert_equal(__first, __last); }\n\n      /**\n       *  @brief Erases an element from a %multiset.\n       *  @param  position  An iterator pointing to the element to be erased.\n       *\n       *  This function erases an element, pointed to by the given iterator,\n       *  from a %multiset.  Note that this function only erases the element,\n       *  and that if the element is itself a pointer, the pointed-to memory is\n       *  not touched in any way.  Managing the pointer is the user's\n       *  responsibilty.\n       */\n      void\n      erase(iterator __position)\n      { _M_t.erase(__position); }\n\n      /**\n       *  @brief Erases elements according to the provided key.\n       *  @param  x  Key of element to be erased.\n       *  @return  The number of elements erased.\n       *\n       *  This function erases all elements located by the given key from a\n       *  %multiset.\n       *  Note that this function only erases the element, and that if\n       *  the element is itself a pointer, the pointed-to memory is not touched\n       *  in any way.  Managing the pointer is the user's responsibilty.\n       */\n      size_type\n      erase(const key_type& __x)\n      { return _M_t.erase(__x); }\n\n      /**\n       *  @brief Erases a [first,last) range of elements from a %multiset.\n       *  @param  first  Iterator pointing to the start of the range to be\n       *                 erased.\n       *  @param  last  Iterator pointing to the end of the range to be erased.\n       *\n       *  This function erases a sequence of elements from a %multiset.\n       *  Note that this function only erases the elements, and that if\n       *  the elements themselves are pointers, the pointed-to memory is not\n       *  touched in any way.  Managing the pointer is the user's responsibilty.\n       */\n      void\n      erase(iterator __first, iterator __last)\n      { _M_t.erase(__first, __last); }\n\n      /**\n       *  Erases all elements in a %multiset.  Note that this function only\n       *  erases the elements, and that if the elements themselves are pointers,\n       *  the pointed-to memory is not touched in any way.  Managing the pointer\n       *  is the user's responsibilty.\n       */\n      void\n      clear()\n      { _M_t.clear(); }\n\n      // multiset operations:\n\n      /**\n       *  @brief Finds the number of elements with given key.\n       *  @param  x  Key of elements to be located.\n       *  @return Number of elements with specified key.\n       */\n      size_type\n      count(const key_type& __x) const\n      { return _M_t.count(__x); }\n\n      // _GLIBCXX_RESOLVE_LIB_DEFECTS\n      // 214.  set::find() missing const overload\n      //@{\n      /**\n       *  @brief Tries to locate an element in a %set.\n       *  @param  x  Element to be located.\n       *  @return  Iterator pointing to sought-after element, or end() if not\n       *           found.\n       *\n       *  This function takes a key and tries to locate the element with which\n       *  the key matches.  If successful the function returns an iterator\n       *  pointing to the sought after element.  If unsuccessful it returns the\n       *  past-the-end ( @c end() ) iterator.\n       */\n      iterator\n      find(const key_type& __x)\n      { return _M_t.find(__x); }\n\n      const_iterator\n      find(const key_type& __x) const\n      { return _M_t.find(__x); }\n      //@}\n\n      //@{\n      /**\n       *  @brief Finds the beginning of a subsequence matching given key.\n       *  @param  x  Key to be located.\n       *  @return  Iterator pointing to first element equal to or greater\n       *           than key, or end().\n       *\n       *  This function returns the first element of a subsequence of elements\n       *  that matches the given key.  If unsuccessful it returns an iterator\n       *  pointing to the first element that has a greater value than given key\n       *  or end() if no such element exists.\n       */\n      iterator\n      lower_bound(const key_type& __x)\n      { return _M_t.lower_bound(__x); }\n\n      const_iterator\n      lower_bound(const key_type& __x) const\n      { return _M_t.lower_bound(__x); }\n      //@}\n\n      //@{\n      /**\n       *  @brief Finds the end of a subsequence matching given key.\n       *  @param  x  Key to be located.\n       *  @return Iterator pointing to the first element\n       *          greater than key, or end().\n       */\n      iterator\n      upper_bound(const key_type& __x)\n      { return _M_t.upper_bound(__x); }\n\n      const_iterator\n      upper_bound(const key_type& __x) const\n      { return _M_t.upper_bound(__x); }\n      //@}\n\n      //@{\n      /**\n       *  @brief Finds a subsequence matching given key.\n       *  @param  x  Key to be located.\n       *  @return  Pair of iterators that possibly points to the subsequence\n       *           matching given key.\n       *\n       *  This function is equivalent to\n       *  @code\n       *    std::make_pair(c.lower_bound(val),\n       *                   c.upper_bound(val))\n       *  @endcode\n       *  (but is faster than making the calls separately).\n       *\n       *  This function probably only makes sense for multisets.\n       */\n      std::pair<iterator, iterator>\n      equal_range(const key_type& __x)\n      { return _M_t.equal_range(__x); }\n\n      std::pair<const_iterator, const_iterator>\n      equal_range(const key_type& __x) const\n      { return _M_t.equal_range(__x); }\n\n      template <class _K1, class _C1, class _A1>\n        friend bool\n        operator== (const multiset<_K1, _C1, _A1>&,\n\t\t    const multiset<_K1, _C1, _A1>&);\n\n      template <class _K1, class _C1, class _A1>\n        friend bool\n        operator< (const multiset<_K1, _C1, _A1>&,\n\t\t   const multiset<_K1, _C1, _A1>&);\n    };\n\n  /**\n   *  @brief  Multiset equality comparison.\n   *  @param  x  A %multiset.\n   *  @param  y  A %multiset of the same type as @a x.\n   *  @return  True iff the size and elements of the multisets are equal.\n   *\n   *  This is an equivalence relation.  It is linear in the size of the\n   *  multisets.\n   *  Multisets are considered equivalent if their sizes are equal, and if\n   *  corresponding elements compare equal.\n  */\n  template <class _Key, class _Compare, class _Alloc>\n    inline bool\n    operator==(const multiset<_Key, _Compare, _Alloc>& __x,\n\t       const multiset<_Key, _Compare, _Alloc>& __y)\n    { return __x._M_t == __y._M_t; }\n\n  /**\n   *  @brief  Multiset ordering relation.\n   *  @param  x  A %multiset.\n   *  @param  y  A %multiset of the same type as @a x.\n   *  @return  True iff @a x is lexicographically less than @a y.\n   *\n   *  This is a total ordering relation.  It is linear in the size of the\n   *  maps.  The elements must be comparable with @c <.\n   *\n   *  See std::lexicographical_compare() for how the determination is made.\n  */\n  template <class _Key, class _Compare, class _Alloc>\n    inline bool\n    operator<(const multiset<_Key, _Compare, _Alloc>& __x,\n\t      const multiset<_Key, _Compare, _Alloc>& __y)\n    { return __x._M_t < __y._M_t; }\n\n  ///  Returns !(x == y).\n  template <class _Key, class _Compare, class _Alloc>\n    inline bool\n    operator!=(const multiset<_Key, _Compare, _Alloc>& __x,\n\t       const multiset<_Key, _Compare, _Alloc>& __y)\n    { return !(__x == __y); }\n\n  ///  Returns y < x.\n  template <class _Key, class _Compare, class _Alloc>\n    inline bool\n    operator>(const multiset<_Key,_Compare,_Alloc>& __x,\n\t      const multiset<_Key,_Compare,_Alloc>& __y)\n    { return __y < __x; }\n\n  ///  Returns !(y < x)\n  template <class _Key, class _Compare, class _Alloc>\n    inline bool\n    operator<=(const multiset<_Key, _Compare, _Alloc>& __x,\n\t       const multiset<_Key, _Compare, _Alloc>& __y)\n    { return !(__y < __x); }\n\n  ///  Returns !(x < y)\n  template <class _Key, class _Compare, class _Alloc>\n    inline bool\n    operator>=(const multiset<_Key, _Compare, _Alloc>& __x,\n\t       const multiset<_Key, _Compare, _Alloc>& __y)\n    { return !(__x < __y); }\n\n  /// See std::multiset::swap().\n  template <class _Key, class _Compare, class _Alloc>\n    inline void\n    swap(multiset<_Key, _Compare, _Alloc>& __x,\n\t multiset<_Key, _Compare, _Alloc>& __y)\n    { __x.swap(__y); }\n\n_GLIBCXX_END_NESTED_NAMESPACE\n\n#endif /* _MULTISET_H */\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/bits/stl_numeric.h",
    "content": "// Numeric functions implementation -*- C++ -*-\n\n// Copyright (C) 2001, 2004, 2005 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n/*\n *\n * Copyright (c) 1994\n * Hewlett-Packard Company\n *\n * Permission to use, copy, modify, distribute and sell this software\n * and its documentation for any purpose is hereby granted without fee,\n * provided that the above copyright notice appear in all copies and\n * that both that copyright notice and this permission notice appear\n * in supporting documentation.  Hewlett-Packard Company makes no\n * representations about the suitability of this software for any\n * purpose.  It is provided \"as is\" without express or implied warranty.\n *\n *\n * Copyright (c) 1996,1997\n * Silicon Graphics Computer Systems, Inc.\n *\n * Permission to use, copy, modify, distribute and sell this software\n * and its documentation for any purpose is hereby granted without fee,\n * provided that the above copyright notice appear in all copies and\n * that both that copyright notice and this permission notice appear\n * in supporting documentation.  Silicon Graphics makes no\n * representations about the suitability of this software for any\n * purpose.  It is provided \"as is\" without express or implied warranty.\n */\n\n/** @file stl_numeric.h\n *  This is an internal header file, included by other library headers.\n *  You should not attempt to use it directly.\n */\n\n#ifndef _STL_NUMERIC_H\n#define _STL_NUMERIC_H 1\n\n#include <debug/debug.h>\n\n_GLIBCXX_BEGIN_NAMESPACE(std)\n\n  /**\n   *  @brief  Accumulate values in a range.\n   *\n   *  Accumulates the values in the range [first,last) using operator+().  The\n   *  initial value is @a init.  The values are processed in order.\n   *\n   *  @param  first  Start of range.\n   *  @param  last  End of range.\n   *  @param  init  Starting value to add other values to.\n   *  @return  The final sum.\n   */\n  template<typename _InputIterator, typename _Tp>\n    _Tp\n    accumulate(_InputIterator __first, _InputIterator __last, _Tp __init)\n    {\n      // concept requirements\n      __glibcxx_function_requires(_InputIteratorConcept<_InputIterator>)\n      __glibcxx_requires_valid_range(__first, __last);\n\n      for (; __first != __last; ++__first)\n\t__init = __init + *__first;\n      return __init;\n    }\n\n  /**\n   *  @brief  Accumulate values in a range with operation.\n   *\n   *  Accumulates the values in the range [first,last) using the function\n   *  object @a binary_op.  The initial value is @a init.  The values are\n   *  processed in order.\n   *\n   *  @param  first  Start of range.\n   *  @param  last  End of range.\n   *  @param  init  Starting value to add other values to.\n   *  @param  binary_op  Function object to accumulate with.\n   *  @return  The final sum.\n   */\n  template<typename _InputIterator, typename _Tp, typename _BinaryOperation>\n    _Tp\n    accumulate(_InputIterator __first, _InputIterator __last, _Tp __init,\n\t       _BinaryOperation __binary_op)\n    {\n      // concept requirements\n      __glibcxx_function_requires(_InputIteratorConcept<_InputIterator>)\n      __glibcxx_requires_valid_range(__first, __last);\n\n      for (; __first != __last; ++__first)\n\t__init = __binary_op(__init, *__first);\n      return __init;\n    }\n\n  /**\n   *  @brief  Compute inner product of two ranges.\n   *\n   *  Starting with an initial value of @a init, multiplies successive\n   *  elements from the two ranges and adds each product into the accumulated\n   *  value using operator+().  The values in the ranges are processed in\n   *  order.\n   *\n   *  @param  first1  Start of range 1.\n   *  @param  last1  End of range 1.\n   *  @param  first2  Start of range 2.\n   *  @param  init  Starting value to add other values to.\n   *  @return  The final inner product.\n   */\n  template<typename _InputIterator1, typename _InputIterator2, typename _Tp>\n    _Tp\n    inner_product(_InputIterator1 __first1, _InputIterator1 __last1,\n\t\t  _InputIterator2 __first2, _Tp __init)\n    {\n      // concept requirements\n      __glibcxx_function_requires(_InputIteratorConcept<_InputIterator1>)\n      __glibcxx_function_requires(_InputIteratorConcept<_InputIterator2>)\n      __glibcxx_requires_valid_range(__first1, __last1);\n\n      for (; __first1 != __last1; ++__first1, ++__first2)\n\t__init = __init + (*__first1 * *__first2);\n      return __init;\n    }\n\n  /**\n   *  @brief  Compute inner product of two ranges.\n   *\n   *  Starting with an initial value of @a init, applies @a binary_op2 to\n   *  successive elements from the two ranges and accumulates each result into\n   *  the accumulated value using @a binary_op1.  The values in the ranges are\n   *  processed in order.\n   *\n   *  @param  first1  Start of range 1.\n   *  @param  last1  End of range 1.\n   *  @param  first2  Start of range 2.\n   *  @param  init  Starting value to add other values to.\n   *  @param  binary_op1  Function object to accumulate with.\n   *  @param  binary_op2  Function object to apply to pairs of input values.\n   *  @return  The final inner product.\n   */\n  template<typename _InputIterator1, typename _InputIterator2, typename _Tp,\n\t    typename _BinaryOperation1, typename _BinaryOperation2>\n    _Tp\n    inner_product(_InputIterator1 __first1, _InputIterator1 __last1,\n\t\t  _InputIterator2 __first2, _Tp __init,\n\t\t  _BinaryOperation1 __binary_op1,\n\t\t  _BinaryOperation2 __binary_op2)\n    {\n      // concept requirements\n      __glibcxx_function_requires(_InputIteratorConcept<_InputIterator1>)\n      __glibcxx_function_requires(_InputIteratorConcept<_InputIterator2>)\n      __glibcxx_requires_valid_range(__first1, __last1);\n\n      for (; __first1 != __last1; ++__first1, ++__first2)\n\t__init = __binary_op1(__init, __binary_op2(*__first1, *__first2));\n      return __init;\n    }\n\n  /**\n   *  @brief  Return list of partial sums\n   *\n   *  Accumulates the values in the range [first,last) using operator+().\n   *  As each successive input value is added into the total, that partial sum\n   *  is written to @a result.  Therefore, the first value in result is the\n   *  first value of the input, the second value in result is the sum of the\n   *  first and second input values, and so on.\n   *\n   *  @param  first  Start of input range.\n   *  @param  last  End of input range.\n   *  @param  result  Output to write sums to.\n   *  @return  Iterator pointing just beyond the values written to result.\n   */\n  template<typename _InputIterator, typename _OutputIterator>\n    _OutputIterator\n    partial_sum(_InputIterator __first, _InputIterator __last,\n\t\t_OutputIterator __result)\n    {\n      typedef typename iterator_traits<_InputIterator>::value_type _ValueType;\n\n      // concept requirements\n      __glibcxx_function_requires(_InputIteratorConcept<_InputIterator>)\n      __glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator,\n\t\t\t\t                         _ValueType>)\n      __glibcxx_requires_valid_range(__first, __last);\n\n      if (__first == __last)\n\treturn __result;\n      _ValueType __value = *__first;\n      *__result = __value;\n      while (++__first != __last)\n\t{\n\t  __value = __value + *__first;\n\t  *++__result = __value;\n\t}\n      return ++__result;\n    }\n\n  /**\n   *  @brief  Return list of partial sums\n   *\n   *  Accumulates the values in the range [first,last) using operator+().\n   *  As each successive input value is added into the total, that partial sum\n   *  is written to @a result.  Therefore, the first value in result is the\n   *  first value of the input, the second value in result is the sum of the\n   *  first and second input values, and so on.\n   *\n   *  @param  first  Start of input range.\n   *  @param  last  End of input range.\n   *  @param  result  Output to write sums to.\n   *  @return  Iterator pointing just beyond the values written to result.\n   */\n  template<typename _InputIterator, typename _OutputIterator,\n\t   typename _BinaryOperation>\n    _OutputIterator\n    partial_sum(_InputIterator __first, _InputIterator __last,\n\t\t_OutputIterator __result, _BinaryOperation __binary_op)\n    {\n      typedef typename iterator_traits<_InputIterator>::value_type _ValueType;\n\n      // concept requirements\n      __glibcxx_function_requires(_InputIteratorConcept<_InputIterator>)\n      __glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator,\n\t\t\t\t                         _ValueType>)\n      __glibcxx_requires_valid_range(__first, __last);\n\n      if (__first == __last)\n\treturn __result;\n      _ValueType __value = *__first;\n      *__result = __value;\n      while (++__first != __last)\n\t{\n\t  __value = __binary_op(__value, *__first);\n\t  *++__result = __value;\n\t}\n      return ++__result;\n    }\n\n  /**\n   *  @brief  Return differences between adjacent values.\n   *\n   *  Computes the difference between adjacent values in the range\n   *  [first,last) using operator-() and writes the result to @a result.\n   *\n   *  @param  first  Start of input range.\n   *  @param  last  End of input range.\n   *  @param  result  Output to write sums to.\n   *  @return  Iterator pointing just beyond the values written to result.\n   */\n  template<typename _InputIterator, typename _OutputIterator>\n    _OutputIterator\n    adjacent_difference(_InputIterator __first,\n\t\t\t_InputIterator __last, _OutputIterator __result)\n    {\n      typedef typename iterator_traits<_InputIterator>::value_type _ValueType;\n\n      // concept requirements\n      __glibcxx_function_requires(_InputIteratorConcept<_InputIterator>)\n      __glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator,\n\t\t\t\t                         _ValueType>)\n      __glibcxx_requires_valid_range(__first, __last);\n\n      if (__first == __last)\n\treturn __result;\n      _ValueType __value = *__first;\n      *__result = __value;\n      while (++__first != __last)\n\t{\n\t  _ValueType __tmp = *__first;\n\t  *++__result = __tmp - __value;\n\t  __value = __tmp;\n\t}\n      return ++__result;\n    }\n\n  /**\n   *  @brief  Return differences between adjacent values.\n   *\n   *  Computes the difference between adjacent values in the range\n   *  [first,last) using the function object @a binary_op and writes the\n   *  result to @a result.\n   *\n   *  @param  first  Start of input range.\n   *  @param  last  End of input range.\n   *  @param  result  Output to write sums to.\n   *  @return  Iterator pointing just beyond the values written to result.\n   */\n  template<typename _InputIterator, typename _OutputIterator,\n\t   typename _BinaryOperation>\n    _OutputIterator\n    adjacent_difference(_InputIterator __first, _InputIterator __last,\n\t\t\t_OutputIterator __result, _BinaryOperation __binary_op)\n    {\n      typedef typename iterator_traits<_InputIterator>::value_type _ValueType;\n\n      // concept requirements\n      __glibcxx_function_requires(_InputIteratorConcept<_InputIterator>)\n      __glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator,\n\t\t\t\t                         _ValueType>)\n      __glibcxx_requires_valid_range(__first, __last);\n\n      if (__first == __last)\n\treturn __result;\n      _ValueType __value = *__first;\n      *__result = __value;\n      while (++__first != __last)\n\t{\n\t  _ValueType __tmp = *__first;\n\t  *++__result = __binary_op(__tmp, __value);\n\t  __value = __tmp;\n\t}\n      return ++__result;\n    }\n\n_GLIBCXX_END_NAMESPACE\n\n#endif /* _STL_NUMERIC_H */\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/bits/stl_pair.h",
    "content": "// Pair implementation -*- C++ -*-\n\n// Copyright (C) 2001, 2004, 2005 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n/*\n *\n * Copyright (c) 1994\n * Hewlett-Packard Company\n *\n * Permission to use, copy, modify, distribute and sell this software\n * and its documentation for any purpose is hereby granted without fee,\n * provided that the above copyright notice appear in all copies and\n * that both that copyright notice and this permission notice appear\n * in supporting documentation.  Hewlett-Packard Company makes no\n * representations about the suitability of this software for any\n * purpose.  It is provided \"as is\" without express or implied warranty.\n *\n *\n * Copyright (c) 1996,1997\n * Silicon Graphics Computer Systems, Inc.\n *\n * Permission to use, copy, modify, distribute and sell this software\n * and its documentation for any purpose is hereby granted without fee,\n * provided that the above copyright notice appear in all copies and\n * that both that copyright notice and this permission notice appear\n * in supporting documentation.  Silicon Graphics makes no\n * representations about the suitability of this software for any\n * purpose.  It is provided \"as is\" without express or implied warranty.\n */\n\n/** @file stl_pair.h\n *  This is an internal header file, included by other library headers.\n *  You should not attempt to use it directly.\n */\n\n#ifndef _PAIR_H\n#define _PAIR_H 1\n\n_GLIBCXX_BEGIN_NAMESPACE(std)\n\n  /// pair holds two objects of arbitrary type.\n  template<class _T1, class _T2>\n    struct pair\n    {\n      typedef _T1 first_type;    ///<  @c first_type is the first bound type\n      typedef _T2 second_type;   ///<  @c second_type is the second bound type\n\n      _T1 first;                 ///< @c first is a copy of the first object\n      _T2 second;                ///< @c second is a copy of the second object\n\n      // _GLIBCXX_RESOLVE_LIB_DEFECTS\n      // 265.  std::pair::pair() effects overly restrictive\n      /** The default constructor creates @c first and @c second using their\n       *  respective default constructors.  */\n      pair()\n      : first(), second() { }\n\n      /** Two objects may be passed to a @c pair constructor to be copied.  */\n      pair(const _T1& __a, const _T2& __b)\n      : first(__a), second(__b) { }\n\n      /** There is also a templated copy ctor for the @c pair class itself.  */\n      template<class _U1, class _U2>\n        pair(const pair<_U1, _U2>& __p)\n\t: first(__p.first), second(__p.second) { }\n    };\n\n  /// Two pairs of the same type are equal iff their members are equal.\n  template<class _T1, class _T2>\n    inline bool\n    operator==(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)\n    { return __x.first == __y.first && __x.second == __y.second; }\n\n  /// <http://gcc.gnu.org/onlinedocs/libstdc++/20_util/howto.html#pairlt>\n  template<class _T1, class _T2>\n    inline bool\n    operator<(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)\n    { return __x.first < __y.first\n\t     || (!(__y.first < __x.first) && __x.second < __y.second); }\n\n  /// Uses @c operator== to find the result.\n  template<class _T1, class _T2>\n    inline bool\n    operator!=(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)\n    { return !(__x == __y); }\n\n  /// Uses @c operator< to find the result.\n  template<class _T1, class _T2>\n    inline bool\n    operator>(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)\n    { return __y < __x; }\n\n  /// Uses @c operator< to find the result.\n  template<class _T1, class _T2>\n    inline bool\n    operator<=(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)\n    { return !(__y < __x); }\n\n  /// Uses @c operator< to find the result.\n  template<class _T1, class _T2>\n    inline bool\n    operator>=(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)\n    { return !(__x < __y); }\n\n  /**\n   *  @brief A convenience wrapper for creating a pair from two objects.\n   *  @param  x  The first object.\n   *  @param  y  The second object.\n   *  @return   A newly-constructed pair<> object of the appropriate type.\n   *\n   *  The standard requires that the objects be passed by reference-to-const,\n   *  but LWG issue #181 says they should be passed by const value.  We follow\n   *  the LWG by default.\n   */\n  // _GLIBCXX_RESOLVE_LIB_DEFECTS\n  // 181.  make_pair() unintended behavior\n  template<class _T1, class _T2>\n    inline pair<_T1, _T2>\n    make_pair(_T1 __x, _T2 __y)\n    { return pair<_T1, _T2>(__x, __y); }\n\n_GLIBCXX_END_NAMESPACE\n\n#endif /* _PAIR_H */\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/bits/stl_queue.h",
    "content": "// Queue implementation -*- C++ -*-\n\n// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006\n// Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n/*\n *\n * Copyright (c) 1994\n * Hewlett-Packard Company\n *\n * Permission to use, copy, modify, distribute and sell this software\n * and its documentation for any purpose is hereby granted without fee,\n * provided that the above copyright notice appear in all copies and\n * that both that copyright notice and this permission notice appear\n * in supporting documentation.  Hewlett-Packard Company makes no\n * representations about the suitability of this software for any\n * purpose.  It is provided \"as is\" without express or implied warranty.\n *\n *\n * Copyright (c) 1996,1997\n * Silicon Graphics Computer Systems, Inc.\n *\n * Permission to use, copy, modify, distribute and sell this software\n * and its documentation for any purpose is hereby granted without fee,\n * provided that the above copyright notice appear in all copies and\n * that both that copyright notice and this permission notice appear\n * in supporting documentation.  Silicon Graphics makes no\n * representations about the suitability of this software for any\n * purpose.  It is provided \"as is\" without express or implied warranty.\n */\n\n/** @file stl_queue.h\n *  This is an internal header file, included by other library headers.\n *  You should not attempt to use it directly.\n */\n\n#ifndef _QUEUE_H\n#define _QUEUE_H 1\n\n#include <bits/concept_check.h>\n#include <debug/debug.h>\n\n_GLIBCXX_BEGIN_NAMESPACE(std)\n\n  /**\n   *  @brief  A standard container giving FIFO behavior.\n   *\n   *  @ingroup Containers\n   *  @ingroup Sequences\n   *\n   *  Meets many of the requirements of a\n   *  <a href=\"tables.html#65\">container</a>,\n   *  but does not define anything to do with iterators.  Very few of the\n   *  other standard container interfaces are defined.\n   *\n   *  This is not a true container, but an @e adaptor.  It holds another\n   *  container, and provides a wrapper interface to that container.  The\n   *  wrapper is what enforces strict first-in-first-out %queue behavior.\n   *\n   *  The second template parameter defines the type of the underlying\n   *  sequence/container.  It defaults to std::deque, but it can be any type\n   *  that supports @c front, @c back, @c push_back, and @c pop_front,\n   *  such as std::list or an appropriate user-defined type.\n   *\n   *  Members not found in \"normal\" containers are @c container_type,\n   *  which is a typedef for the second Sequence parameter, and @c push and\n   *  @c pop, which are standard %queue/FIFO operations.\n  */\n  template<typename _Tp, typename _Sequence = deque<_Tp> >\n    class queue\n    {\n      // concept requirements\n      typedef typename _Sequence::value_type _Sequence_value_type;\n      __glibcxx_class_requires(_Tp, _SGIAssignableConcept)\n      __glibcxx_class_requires(_Sequence, _FrontInsertionSequenceConcept)\n      __glibcxx_class_requires(_Sequence, _BackInsertionSequenceConcept)\n      __glibcxx_class_requires2(_Tp, _Sequence_value_type, _SameTypeConcept)\n\n      template<typename _Tp1, typename _Seq1>\n        friend bool\n        operator==(const queue<_Tp1, _Seq1>&, const queue<_Tp1, _Seq1>&);\n\n      template<typename _Tp1, typename _Seq1>\n        friend bool\n        operator<(const queue<_Tp1, _Seq1>&, const queue<_Tp1, _Seq1>&);\n\n    public:\n      typedef typename _Sequence::value_type                value_type;\n      typedef typename _Sequence::reference                 reference;\n      typedef typename _Sequence::const_reference           const_reference;\n      typedef typename _Sequence::size_type                 size_type;\n      typedef          _Sequence                            container_type;\n\n    protected:\n      /**\n       *  'c' is the underlying container.  Maintainers wondering why\n       *  this isn't uglified as per style guidelines should note that\n       *  this name is specified in the standard, [23.2.3.1].  (Why?\n       *  Presumably for the same reason that it's protected instead\n       *  of private: to allow derivation.  But none of the other\n       *  containers allow for derivation.  Odd.)\n       */\n      _Sequence c;\n\n    public:\n      /**\n       *  @brief  Default constructor creates no elements.\n       */\n      explicit\n      queue(const _Sequence& __c = _Sequence()) : c(__c) {}\n\n      /**\n       *  Returns true if the %queue is empty.\n       */\n      bool\n      empty() const\n      { return c.empty(); }\n\n      /**  Returns the number of elements in the %queue.  */\n      size_type\n      size() const\n      { return c.size(); }\n\n      /**\n       *  Returns a read/write reference to the data at the first\n       *  element of the %queue.\n       */\n      reference\n      front()\n      {\n\t__glibcxx_requires_nonempty();\n\treturn c.front();\n      }\n\n      /**\n       *  Returns a read-only (constant) reference to the data at the first\n       *  element of the %queue.\n       */\n      const_reference\n      front() const\n      {\n\t__glibcxx_requires_nonempty();\n\treturn c.front();\n      }\n\n      /**\n       *  Returns a read/write reference to the data at the last\n       *  element of the %queue.\n       */\n      reference\n      back()\n      {\n\t__glibcxx_requires_nonempty();\n\treturn c.back();\n      }\n\n      /**\n       *  Returns a read-only (constant) reference to the data at the last\n       *  element of the %queue.\n       */\n      const_reference\n      back() const\n      {\n\t__glibcxx_requires_nonempty();\n\treturn c.back();\n      }\n\n      /**\n       *  @brief  Add data to the end of the %queue.\n       *  @param  x  Data to be added.\n       *\n       *  This is a typical %queue operation.  The function creates an\n       *  element at the end of the %queue and assigns the given data\n       *  to it.  The time complexity of the operation depends on the\n       *  underlying sequence.\n       */\n      void\n      push(const value_type& __x)\n      { c.push_back(__x); }\n\n      /**\n       *  @brief  Removes first element.\n       *\n       *  This is a typical %queue operation.  It shrinks the %queue by one.\n       *  The time complexity of the operation depends on the underlying\n       *  sequence.\n       *\n       *  Note that no data is returned, and if the first element's\n       *  data is needed, it should be retrieved before pop() is\n       *  called.\n       */\n      void\n      pop()\n      {\n\t__glibcxx_requires_nonempty();\n\tc.pop_front();\n      }\n    };\n\n\n  /**\n   *  @brief  Queue equality comparison.\n   *  @param  x  A %queue.\n   *  @param  y  A %queue of the same type as @a x.\n   *  @return  True iff the size and elements of the queues are equal.\n   *\n   *  This is an equivalence relation.  Complexity and semantics depend on the\n   *  underlying sequence type, but the expected rules are:  this relation is\n   *  linear in the size of the sequences, and queues are considered equivalent\n   *  if their sequences compare equal.\n  */\n  template<typename _Tp, typename _Seq>\n    inline bool\n    operator==(const queue<_Tp, _Seq>& __x, const queue<_Tp, _Seq>& __y)\n    { return __x.c == __y.c; }\n\n  /**\n   *  @brief  Queue ordering relation.\n   *  @param  x  A %queue.\n   *  @param  y  A %queue of the same type as @a x.\n   *  @return  True iff @a x is lexicographically less than @a y.\n   *\n   *  This is an total ordering relation.  Complexity and semantics\n   *  depend on the underlying sequence type, but the expected rules\n   *  are: this relation is linear in the size of the sequences, the\n   *  elements must be comparable with @c <, and\n   *  std::lexicographical_compare() is usually used to make the\n   *  determination.\n  */\n  template<typename _Tp, typename _Seq>\n    inline bool\n    operator<(const queue<_Tp, _Seq>& __x, const queue<_Tp, _Seq>& __y)\n    { return __x.c < __y.c; }\n\n  /// Based on operator==\n  template<typename _Tp, typename _Seq>\n    inline bool\n    operator!=(const queue<_Tp, _Seq>& __x, const queue<_Tp, _Seq>& __y)\n    { return !(__x == __y); }\n\n  /// Based on operator<\n  template<typename _Tp, typename _Seq>\n    inline bool\n    operator>(const queue<_Tp, _Seq>& __x, const queue<_Tp, _Seq>& __y)\n    { return __y < __x; }\n\n  /// Based on operator<\n  template<typename _Tp, typename _Seq>\n    inline bool\n    operator<=(const queue<_Tp, _Seq>& __x, const queue<_Tp, _Seq>& __y)\n    { return !(__y < __x); }\n\n  /// Based on operator<\n  template<typename _Tp, typename _Seq>\n    inline bool\n    operator>=(const queue<_Tp, _Seq>& __x, const queue<_Tp, _Seq>& __y)\n    { return !(__x < __y); }\n\n  /**\n   *  @brief  A standard container automatically sorting its contents.\n   *\n   *  @ingroup Containers\n   *  @ingroup Sequences\n   *\n   *  This is not a true container, but an @e adaptor.  It holds\n   *  another container, and provides a wrapper interface to that\n   *  container.  The wrapper is what enforces priority-based sorting \n   *  and %queue behavior.  Very few of the standard container/sequence\n   *  interface requirements are met (e.g., iterators).\n   *\n   *  The second template parameter defines the type of the underlying\n   *  sequence/container.  It defaults to std::vector, but it can be\n   *  any type that supports @c front(), @c push_back, @c pop_back,\n   *  and random-access iterators, such as std::deque or an\n   *  appropriate user-defined type.\n   *\n   *  The third template parameter supplies the means of making\n   *  priority comparisons.  It defaults to @c less<value_type> but\n   *  can be anything defining a strict weak ordering.\n   *\n   *  Members not found in \"normal\" containers are @c container_type,\n   *  which is a typedef for the second Sequence parameter, and @c\n   *  push, @c pop, and @c top, which are standard %queue operations.\n   *\n   *  @note No equality/comparison operators are provided for\n   *  %priority_queue.\n   *\n   *  @note Sorting of the elements takes place as they are added to,\n   *  and removed from, the %priority_queue using the\n   *  %priority_queue's member functions.  If you access the elements\n   *  by other means, and change their data such that the sorting\n   *  order would be different, the %priority_queue will not re-sort\n   *  the elements for you.  (How could it know to do so?)\n  */\n  template<typename _Tp, typename _Sequence = vector<_Tp>,\n\t   typename _Compare  = less<typename _Sequence::value_type> >\n    class priority_queue\n    {\n      // concept requirements\n      typedef typename _Sequence::value_type _Sequence_value_type;\n      __glibcxx_class_requires(_Tp, _SGIAssignableConcept)\n      __glibcxx_class_requires(_Sequence, _SequenceConcept)\n      __glibcxx_class_requires(_Sequence, _RandomAccessContainerConcept)\n      __glibcxx_class_requires2(_Tp, _Sequence_value_type, _SameTypeConcept)\n      __glibcxx_class_requires4(_Compare, bool, _Tp, _Tp,\n\t\t\t\t_BinaryFunctionConcept)\n\n    public:\n      typedef typename _Sequence::value_type                value_type;\n      typedef typename _Sequence::reference                 reference;\n      typedef typename _Sequence::const_reference           const_reference;\n      typedef typename _Sequence::size_type                 size_type;\n      typedef          _Sequence                            container_type;\n\n    protected:\n      //  See queue::c for notes on these names.\n      _Sequence  c;\n      _Compare   comp;\n\n    public:\n      /**\n       *  @brief  Default constructor creates no elements.\n       */\n      explicit\n      priority_queue(const _Compare& __x = _Compare(),\n\t\t     const _Sequence& __s = _Sequence())\n      : c(__s), comp(__x)\n      { std::make_heap(c.begin(), c.end(), comp); }\n\n      /**\n       *  @brief  Builds a %queue from a range.\n       *  @param  first  An input iterator.\n       *  @param  last  An input iterator.\n       *  @param  x  A comparison functor describing a strict weak ordering.\n       *  @param  s  An initial sequence with which to start.\n       *\n       *  Begins by copying @a s, inserting a copy of the elements\n       *  from @a [first,last) into the copy of @a s, then ordering\n       *  the copy according to @a x.\n       *\n       *  For more information on function objects, see the\n       *  documentation on @link s20_3_1_base functor base\n       *  classes@endlink.\n       */\n      template<typename _InputIterator>\n        priority_queue(_InputIterator __first, _InputIterator __last,\n\t\t       const _Compare& __x = _Compare(),\n\t\t       const _Sequence& __s = _Sequence())\n\t: c(__s), comp(__x)\n        {\n\t  __glibcxx_requires_valid_range(__first, __last);\n\t  c.insert(c.end(), __first, __last);\n\t  std::make_heap(c.begin(), c.end(), comp);\n\t}\n\n      /**\n       *  Returns true if the %queue is empty.\n       */\n      bool\n      empty() const\n      { return c.empty(); }\n\n      /**  Returns the number of elements in the %queue.  */\n      size_type\n      size() const\n      { return c.size(); }\n\n      /**\n       *  Returns a read-only (constant) reference to the data at the first\n       *  element of the %queue.\n       */\n      const_reference\n      top() const\n      {\n\t__glibcxx_requires_nonempty();\n\treturn c.front();\n      }\n\n      /**\n       *  @brief  Add data to the %queue.\n       *  @param  x  Data to be added.\n       *\n       *  This is a typical %queue operation.\n       *  The time complexity of the operation depends on the underlying\n       *  sequence.\n       */\n      void\n      push(const value_type& __x)\n      {\n\tc.push_back(__x);\n\tstd::push_heap(c.begin(), c.end(), comp);\n      }\n\n      /**\n       *  @brief  Removes first element.\n       *\n       *  This is a typical %queue operation.  It shrinks the %queue\n       *  by one.  The time complexity of the operation depends on the\n       *  underlying sequence.\n       *\n       *  Note that no data is returned, and if the first element's\n       *  data is needed, it should be retrieved before pop() is\n       *  called.\n       */\n      void\n      pop()\n      {\n\t__glibcxx_requires_nonempty();\n\tstd::pop_heap(c.begin(), c.end(), comp);\n\tc.pop_back();\n      }\n    };\n\n  // No equality/comparison operators are provided for priority_queue.\n\n_GLIBCXX_END_NAMESPACE\n\n#endif /* _QUEUE_H */\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/bits/stl_raw_storage_iter.h",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2001, 2004, 2005 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n/*\n *\n * Copyright (c) 1994\n * Hewlett-Packard Company\n *\n * Permission to use, copy, modify, distribute and sell this software\n * and its documentation for any purpose is hereby granted without fee,\n * provided that the above copyright notice appear in all copies and\n * that both that copyright notice and this permission notice appear\n * in supporting documentation.  Hewlett-Packard Company makes no\n * representations about the suitability of this software for any\n * purpose.  It is provided \"as is\" without express or implied warranty.\n *\n *\n * Copyright (c) 1996\n * Silicon Graphics Computer Systems, Inc.\n *\n * Permission to use, copy, modify, distribute and sell this software\n * and its documentation for any purpose is hereby granted without fee,\n * provided that the above copyright notice appear in all copies and\n * that both that copyright notice and this permission notice appear\n * in supporting documentation.  Silicon Graphics makes no\n * representations about the suitability of this software for any\n * purpose.  It is provided \"as is\" without express or implied warranty.\n */\n\n/** @file stl_raw_storage_iter.h\n *  This is an internal header file, included by other library headers.\n *  You should not attempt to use it directly.\n */\n\n#ifndef _STL_RAW_STORAGE_ITERATOR_H\n#define _STL_RAW_STORAGE_ITERATOR_H 1\n\n_GLIBCXX_BEGIN_NAMESPACE(std)\n\n  /**\n   *  This iterator class lets algorithms store their results into\n   *  uninitialized memory.\n  */\n  template <class _ForwardIterator, class _Tp>\n    class raw_storage_iterator\n    : public iterator<output_iterator_tag, void, void, void, void>\n    {\n    protected:\n      _ForwardIterator _M_iter;\n\n    public:\n      explicit\n      raw_storage_iterator(_ForwardIterator __x)\n      : _M_iter(__x) {}\n\n      raw_storage_iterator&\n      operator*() { return *this; }\n\n      raw_storage_iterator&\n      operator=(const _Tp& __element)\n      {\n\tstd::_Construct(&*_M_iter, __element);\n\treturn *this;\n      }\n\n      raw_storage_iterator<_ForwardIterator, _Tp>&\n      operator++()\n      {\n\t++_M_iter;\n\treturn *this;\n      }\n\n      raw_storage_iterator<_ForwardIterator, _Tp>\n      operator++(int)\n      {\n\traw_storage_iterator<_ForwardIterator, _Tp> __tmp = *this;\n\t++_M_iter;\n\treturn __tmp;\n      }\n    };\n\n_GLIBCXX_END_NAMESPACE\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/bits/stl_relops.h",
    "content": "// std::rel_ops implementation -*- C++ -*-\n\n// Copyright (C) 2001, 2002, 2004, 2005 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n/*\n *\n * Copyright (c) 1994\n * Hewlett-Packard Company\n *\n * Permission to use, copy, modify, distribute and sell this software\n * and its documentation for any purpose is hereby granted without fee,\n * provided that the above copyright notice appear in all copies and\n * that both that copyright notice and this permission notice appear\n * in supporting documentation.  Hewlett-Packard Company makes no\n * representations about the suitability of this software for any\n * purpose.  It is provided \"as is\" without express or implied warranty.\n *\n * Copyright (c) 1996,1997\n * Silicon Graphics\n *\n * Permission to use, copy, modify, distribute and sell this software\n * and its documentation for any purpose is hereby granted without fee,\n * provided that the above copyright notice appear in all copies and\n * that both that copyright notice and this permission notice appear\n * in supporting documentation.  Silicon Graphics makes no\n * representations about the suitability of this software for any\n * purpose.  It is provided \"as is\" without express or implied warranty.\n *\n */\n\n/** @file stl_relops.h\n *  This is an internal header file, included by other library headers.\n *  You should not attempt to use it directly.\n *\n *  @if maint\n *  Inclusion of this file has been removed from\n *  all of the other STL headers for safety reasons, except std_utility.h.\n *  For more information, see the thread of about twenty messages starting\n *  with http://gcc.gnu.org/ml/libstdc++/2001-01/msg00223.html , or the\n *  FAQ at http://gcc.gnu.org/onlinedocs/libstdc++/faq/index.html#4_4 .\n *\n *  Short summary:  the rel_ops operators should be avoided for the present.\n *  @endif\n */\n\n#ifndef _STL_RELOPS_H\n#define _STL_RELOPS_H 1\n\n_GLIBCXX_BEGIN_NAMESPACE(std)\n\n  namespace rel_ops\n  {\n    /** @namespace std::rel_ops\n     *  @brief  The generated relational operators are sequestered here.\n     */\n\n    /**\n     *  @brief Defines @c != for arbitrary types, in terms of @c ==.\n     *  @param  x  A thing.\n     *  @param  y  Another thing.\n     *  @return   x != y\n     *\n     *  This function uses @c == to determine its result.\n     */\n    template <class _Tp>\n      inline bool\n      operator!=(const _Tp& __x, const _Tp& __y)\n      { return !(__x == __y); }\n\n    /**\n     *  @brief Defines @c > for arbitrary types, in terms of @c <.\n     *  @param  x  A thing.\n     *  @param  y  Another thing.\n     *  @return   x > y\n     *\n     *  This function uses @c < to determine its result.\n     */\n    template <class _Tp>\n      inline bool\n      operator>(const _Tp& __x, const _Tp& __y)\n      { return __y < __x; }\n\n    /**\n     *  @brief Defines @c <= for arbitrary types, in terms of @c <.\n     *  @param  x  A thing.\n     *  @param  y  Another thing.\n     *  @return   x <= y\n     *\n     *  This function uses @c < to determine its result.\n     */\n    template <class _Tp>\n      inline bool\n      operator<=(const _Tp& __x, const _Tp& __y)\n      { return !(__y < __x); }\n\n    /**\n     *  @brief Defines @c >= for arbitrary types, in terms of @c <.\n     *  @param  x  A thing.\n     *  @param  y  Another thing.\n     *  @return   x >= y\n     *\n     *  This function uses @c < to determine its result.\n     */\n    template <class _Tp>\n      inline bool\n      operator>=(const _Tp& __x, const _Tp& __y)\n      { return !(__x < __y); }\n\n  } // namespace rel_ops\n\n_GLIBCXX_END_NAMESPACE\n\n#endif /* _STL_RELOPS_H */\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/bits/stl_set.h",
    "content": "// Set implementation -*- C++ -*-\n\n// Copyright (C) 2001, 2002, 2004, 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n/*\n *\n * Copyright (c) 1994\n * Hewlett-Packard Company\n *\n * Permission to use, copy, modify, distribute and sell this software\n * and its documentation for any purpose is hereby granted without fee,\n * provided that the above copyright notice appear in all copies and\n * that both that copyright notice and this permission notice appear\n * in supporting documentation.  Hewlett-Packard Company makes no\n * representations about the suitability of this software for any\n * purpose.  It is provided \"as is\" without express or implied warranty.\n *\n *\n * Copyright (c) 1996,1997\n * Silicon Graphics Computer Systems, Inc.\n *\n * Permission to use, copy, modify, distribute and sell this software\n * and its documentation for any purpose is hereby granted without fee,\n * provided that the above copyright notice appear in all copies and\n * that both that copyright notice and this permission notice appear\n * in supporting documentation.  Silicon Graphics makes no\n * representations about the suitability of this software for any\n * purpose.  It is provided \"as is\" without express or implied warranty.\n */\n\n/** @file stl_set.h\n *  This is an internal header file, included by other library headers.\n *  You should not attempt to use it directly.\n */\n\n#ifndef _SET_H\n#define _SET_H 1\n\n#include <bits/concept_check.h>\n\n_GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD)\n\n  /**\n   *  @brief A standard container made up of unique keys, which can be\n   *  retrieved in logarithmic time.\n   *\n   *  @ingroup Containers\n   *  @ingroup Assoc_containers\n   *\n   *  Meets the requirements of a <a href=\"tables.html#65\">container</a>, a\n   *  <a href=\"tables.html#66\">reversible container</a>, and an\n   *  <a href=\"tables.html#69\">associative container</a> (using unique keys).\n   *\n   *  Sets support bidirectional iterators.\n   *\n   *  @param  Key  Type of key objects.\n   *  @param  Compare  Comparison function object type, defaults to less<Key>.\n   *  @param  Alloc  Allocator type, defaults to allocator<Key>.\n   *\n   *  @if maint\n   *  The private tree data is declared exactly the same way for set and\n   *  multiset; the distinction is made entirely in how the tree functions are\n   *  called (*_unique versus *_equal, same as the standard).\n   *  @endif\n  */\n  template<class _Key, class _Compare = std::less<_Key>,\n\t   class _Alloc = std::allocator<_Key> >\n    class set\n    {\n      // concept requirements\n      typedef typename _Alloc::value_type                   _Alloc_value_type;\n      __glibcxx_class_requires(_Key, _SGIAssignableConcept)\n      __glibcxx_class_requires4(_Compare, bool, _Key, _Key,\n\t\t\t\t_BinaryFunctionConcept)\n      __glibcxx_class_requires2(_Key, _Alloc_value_type, _SameTypeConcept)\t\n\n    public:\n      // typedefs:\n      //@{\n      /// Public typedefs.\n      typedef _Key     key_type;\n      typedef _Key     value_type;\n      typedef _Compare key_compare;\n      typedef _Compare value_compare;\n      typedef _Alloc   allocator_type;\n      //@}\n\n    private:\n      typedef typename _Alloc::template rebind<_Key>::other _Key_alloc_type;\n\n      typedef _Rb_tree<key_type, value_type, _Identity<value_type>,\n\t\t       key_compare, _Key_alloc_type> _Rep_type;\n      _Rep_type _M_t;  // red-black tree representing set\n\n    public:\n      //@{\n      ///  Iterator-related typedefs.\n      typedef typename _Key_alloc_type::pointer             pointer;\n      typedef typename _Key_alloc_type::const_pointer       const_pointer;\n      typedef typename _Key_alloc_type::reference           reference;\n      typedef typename _Key_alloc_type::const_reference     const_reference;\n      // _GLIBCXX_RESOLVE_LIB_DEFECTS\n      // DR 103. set::iterator is required to be modifiable,\n      // but this allows modification of keys.\n      typedef typename _Rep_type::const_iterator            iterator;\n      typedef typename _Rep_type::const_iterator            const_iterator;\n      typedef typename _Rep_type::const_reverse_iterator    reverse_iterator;\n      typedef typename _Rep_type::const_reverse_iterator    const_reverse_iterator;\n      typedef typename _Rep_type::size_type                 size_type;\n      typedef typename _Rep_type::difference_type           difference_type;\n      //@}\n\n      // allocation/deallocation\n      ///  Default constructor creates no elements.\n      set()\n      : _M_t(_Compare(), allocator_type()) {}\n\n      /**\n       *  @brief  Default constructor creates no elements.\n       *\n       *  @param  comp  Comparator to use.\n       *  @param  a  Allocator to use.\n       */\n      explicit\n      set(const _Compare& __comp,\n\t  const allocator_type& __a = allocator_type())\n      : _M_t(__comp, __a) {}\n\n      /**\n       *  @brief  Builds a %set from a range.\n       *  @param  first  An input iterator.\n       *  @param  last  An input iterator.\n       *\n       *  Create a %set consisting of copies of the elements from [first,last).\n       *  This is linear in N if the range is already sorted, and NlogN\n       *  otherwise (where N is distance(first,last)).\n       */\n      template<class _InputIterator>\n        set(_InputIterator __first, _InputIterator __last)\n        : _M_t(_Compare(), allocator_type())\n        { _M_t._M_insert_unique(__first, __last); }\n\n      /**\n       *  @brief  Builds a %set from a range.\n       *  @param  first  An input iterator.\n       *  @param  last  An input iterator.\n       *  @param  comp  A comparison functor.\n       *  @param  a  An allocator object.\n       *\n       *  Create a %set consisting of copies of the elements from [first,last).\n       *  This is linear in N if the range is already sorted, and NlogN\n       *  otherwise (where N is distance(first,last)).\n       */\n      template<class _InputIterator>\n        set(_InputIterator __first, _InputIterator __last,\n\t    const _Compare& __comp,\n\t    const allocator_type& __a = allocator_type())\n\t: _M_t(__comp, __a)\n        { _M_t._M_insert_unique(__first, __last); }\n\n      /**\n       *  @brief  Set copy constructor.\n       *  @param  x  A %set of identical element and allocator types.\n       *\n       *  The newly-created %set uses a copy of the allocation object used\n       *  by @a x.\n       */\n      set(const set<_Key,_Compare,_Alloc>& __x)\n      : _M_t(__x._M_t) { }\n\n      /**\n       *  @brief  Set assignment operator.\n       *  @param  x  A %set of identical element and allocator types.\n       *\n       *  All the elements of @a x are copied, but unlike the copy constructor,\n       *  the allocator object is not copied.\n       */\n      set<_Key,_Compare,_Alloc>&\n      operator=(const set<_Key, _Compare, _Alloc>& __x)\n      {\n\t_M_t = __x._M_t;\n\treturn *this;\n      }\n\n      // accessors:\n\n      ///  Returns the comparison object with which the %set was constructed.\n      key_compare\n      key_comp() const\n      { return _M_t.key_comp(); }\n      ///  Returns the comparison object with which the %set was constructed.\n      value_compare\n      value_comp() const\n      { return _M_t.key_comp(); }\n      ///  Returns the allocator object with which the %set was constructed.\n      allocator_type\n      get_allocator() const\n      { return _M_t.get_allocator(); }\n\n      /**\n       *  Returns a read/write iterator that points to the first element in the\n       *  %set.  Iteration is done in ascending order according to the keys.\n       */\n      iterator\n      begin() const\n      { return _M_t.begin(); }\n\n      /**\n       *  Returns a read/write iterator that points one past the last element in\n       *  the %set.  Iteration is done in ascending order according to the keys.\n       */\n      iterator\n      end() const\n      { return _M_t.end(); }\n\n      /**\n       *  Returns a read/write reverse iterator that points to the last element\n       *  in the %set.  Iteration is done in descending order according to the\n       *  keys.\n       */\n      reverse_iterator\n      rbegin() const\n      { return _M_t.rbegin(); }\n\n      /**\n       *  Returns a read-only (constant) reverse iterator that points to the\n       *  last pair in the %map.  Iteration is done in descending order\n       *  according to the keys.\n       */\n      reverse_iterator\n      rend() const\n      { return _M_t.rend(); }\n\n      ///  Returns true if the %set is empty.\n      bool\n      empty() const\n      { return _M_t.empty(); }\n\n      ///  Returns the size of the %set.\n      size_type\n      size() const\n      { return _M_t.size(); }\n\n      ///  Returns the maximum size of the %set.\n      size_type\n      max_size() const\n      { return _M_t.max_size(); }\n\n      /**\n       *  @brief  Swaps data with another %set.\n       *  @param  x  A %set of the same element and allocator types.\n       *\n       *  This exchanges the elements between two sets in constant time.\n       *  (It is only swapping a pointer, an integer, and an instance of\n       *  the @c Compare type (which itself is often stateless and empty), so it\n       *  should be quite fast.)\n       *  Note that the global std::swap() function is specialized such that\n       *  std::swap(s1,s2) will feed to this function.\n       */\n      void\n      swap(set<_Key,_Compare,_Alloc>& __x)\n      { _M_t.swap(__x._M_t); }\n\n      // insert/erase\n      /**\n       *  @brief Attempts to insert an element into the %set.\n       *  @param  x  Element to be inserted.\n       *  @return  A pair, of which the first element is an iterator that points\n       *           to the possibly inserted element, and the second is a bool\n       *           that is true if the element was actually inserted.\n       *\n       *  This function attempts to insert an element into the %set.  A %set\n       *  relies on unique keys and thus an element is only inserted if it is\n       *  not already present in the %set.\n       *\n       *  Insertion requires logarithmic time.\n       */\n      std::pair<iterator,bool>\n      insert(const value_type& __x)\n      {\n\tstd::pair<typename _Rep_type::iterator, bool> __p =\n\t  _M_t._M_insert_unique(__x);\n\treturn std::pair<iterator, bool>(__p.first, __p.second);\n      }\n\n      /**\n       *  @brief Attempts to insert an element into the %set.\n       *  @param  position  An iterator that serves as a hint as to where the\n       *                    element should be inserted.\n       *  @param  x  Element to be inserted.\n       *  @return  An iterator that points to the element with key of @a x (may\n       *           or may not be the element passed in).\n       *\n       *  This function is not concerned about whether the insertion took place,\n       *  and thus does not return a boolean like the single-argument insert()\n       *  does.  Note that the first parameter is only a hint and can\n       *  potentially improve the performance of the insertion process.  A bad\n       *  hint would cause no gains in efficiency.\n       *\n       *  See http://gcc.gnu.org/onlinedocs/libstdc++/23_containers/howto.html#4\n       *  for more on \"hinting\".\n       *\n       *  Insertion requires logarithmic time (if the hint is not taken).\n       */\n      iterator\n      insert(iterator __position, const value_type& __x)\n      { return _M_t._M_insert_unique(__position, __x); }\n\n      /**\n       *  @brief A template function that attemps to insert a range of elements.\n       *  @param  first  Iterator pointing to the start of the range to be\n       *                 inserted.\n       *  @param  last  Iterator pointing to the end of the range.\n       *\n       *  Complexity similar to that of the range constructor.\n       */\n      template<class _InputIterator>\n        void\n        insert(_InputIterator __first, _InputIterator __last)\n        { _M_t._M_insert_unique(__first, __last); }\n\n      /**\n       *  @brief Erases an element from a %set.\n       *  @param  position  An iterator pointing to the element to be erased.\n       *\n       *  This function erases an element, pointed to by the given iterator,\n       *  from a %set.  Note that this function only erases the element, and\n       *  that if the element is itself a pointer, the pointed-to memory is not\n       *  touched in any way.  Managing the pointer is the user's responsibilty.\n       */\n      void\n      erase(iterator __position)\n      { _M_t.erase(__position); }\n\n      /**\n       *  @brief Erases elements according to the provided key.\n       *  @param  x  Key of element to be erased.\n       *  @return  The number of elements erased.\n       *\n       *  This function erases all the elements located by the given key from\n       *  a %set.\n       *  Note that this function only erases the element, and that if\n       *  the element is itself a pointer, the pointed-to memory is not touched\n       *  in any way.  Managing the pointer is the user's responsibilty.\n       */\n      size_type\n      erase(const key_type& __x)\n      { return _M_t.erase(__x); }\n\n      /**\n       *  @brief Erases a [first,last) range of elements from a %set.\n       *  @param  first  Iterator pointing to the start of the range to be\n       *                 erased.\n       *  @param  last  Iterator pointing to the end of the range to be erased.\n       *\n       *  This function erases a sequence of elements from a %set.\n       *  Note that this function only erases the element, and that if\n       *  the element is itself a pointer, the pointed-to memory is not touched\n       *  in any way.  Managing the pointer is the user's responsibilty.\n       */\n      void\n      erase(iterator __first, iterator __last)\n      { _M_t.erase(__first, __last); }\n\n      /**\n       *  Erases all elements in a %set.  Note that this function only erases\n       *  the elements, and that if the elements themselves are pointers, the\n       *  pointed-to memory is not touched in any way.  Managing the pointer is\n       *  the user's responsibilty.\n       */\n      void\n      clear()\n      { _M_t.clear(); }\n\n      // set operations:\n\n      /**\n       *  @brief  Finds the number of elements.\n       *  @param  x  Element to located.\n       *  @return  Number of elements with specified key.\n       *\n       *  This function only makes sense for multisets; for set the result will\n       *  either be 0 (not present) or 1 (present).\n       */\n      size_type\n      count(const key_type& __x) const\n      { return _M_t.find(__x) == _M_t.end() ? 0 : 1; }\n\n      // _GLIBCXX_RESOLVE_LIB_DEFECTS\n      // 214.  set::find() missing const overload\n      //@{\n      /**\n       *  @brief Tries to locate an element in a %set.\n       *  @param  x  Element to be located.\n       *  @return  Iterator pointing to sought-after element, or end() if not\n       *           found.\n       *\n       *  This function takes a key and tries to locate the element with which\n       *  the key matches.  If successful the function returns an iterator\n       *  pointing to the sought after element.  If unsuccessful it returns the\n       *  past-the-end ( @c end() ) iterator.\n       */\n      iterator\n      find(const key_type& __x)\n      { return _M_t.find(__x); }\n\n      const_iterator\n      find(const key_type& __x) const\n      { return _M_t.find(__x); }\n      //@}\n\n      //@{\n      /**\n       *  @brief Finds the beginning of a subsequence matching given key.\n       *  @param  x  Key to be located.\n       *  @return  Iterator pointing to first element equal to or greater\n       *           than key, or end().\n       *\n       *  This function returns the first element of a subsequence of elements\n       *  that matches the given key.  If unsuccessful it returns an iterator\n       *  pointing to the first element that has a greater value than given key\n       *  or end() if no such element exists.\n       */\n      iterator\n      lower_bound(const key_type& __x)\n      { return _M_t.lower_bound(__x); }\n\n      const_iterator\n      lower_bound(const key_type& __x) const\n      { return _M_t.lower_bound(__x); }\n      //@}\n\n      //@{\n      /**\n       *  @brief Finds the end of a subsequence matching given key.\n       *  @param  x  Key to be located.\n       *  @return Iterator pointing to the first element\n       *          greater than key, or end().\n       */\n      iterator\n      upper_bound(const key_type& __x)\n      { return _M_t.upper_bound(__x); }\n\n      const_iterator\n      upper_bound(const key_type& __x) const\n      { return _M_t.upper_bound(__x); }\n      //@}\n\n      //@{\n      /**\n       *  @brief Finds a subsequence matching given key.\n       *  @param  x  Key to be located.\n       *  @return  Pair of iterators that possibly points to the subsequence\n       *           matching given key.\n       *\n       *  This function is equivalent to\n       *  @code\n       *    std::make_pair(c.lower_bound(val),\n       *                   c.upper_bound(val))\n       *  @endcode\n       *  (but is faster than making the calls separately).\n       *\n       *  This function probably only makes sense for multisets.\n       */\n      std::pair<iterator, iterator>\n      equal_range(const key_type& __x)\n      { return _M_t.equal_range(__x); }\n\n      std::pair<const_iterator, const_iterator>\n      equal_range(const key_type& __x) const\n      { return _M_t.equal_range(__x); }\n      //@}\n\n      template<class _K1, class _C1, class _A1>\n        friend bool\n        operator== (const set<_K1, _C1, _A1>&, const set<_K1, _C1, _A1>&);\n\n      template<class _K1, class _C1, class _A1>\n        friend bool\n        operator< (const set<_K1, _C1, _A1>&, const set<_K1, _C1, _A1>&);\n    };\n\n\n  /**\n   *  @brief  Set equality comparison.\n   *  @param  x  A %set.\n   *  @param  y  A %set of the same type as @a x.\n   *  @return  True iff the size and elements of the sets are equal.\n   *\n   *  This is an equivalence relation.  It is linear in the size of the sets.\n   *  Sets are considered equivalent if their sizes are equal, and if\n   *  corresponding elements compare equal.\n  */\n  template<class _Key, class _Compare, class _Alloc>\n    inline bool\n    operator==(const set<_Key, _Compare, _Alloc>& __x,\n\t       const set<_Key, _Compare, _Alloc>& __y)\n    { return __x._M_t == __y._M_t; }\n\n  /**\n   *  @brief  Set ordering relation.\n   *  @param  x  A %set.\n   *  @param  y  A %set of the same type as @a x.\n   *  @return  True iff @a x is lexicographically less than @a y.\n   *\n   *  This is a total ordering relation.  It is linear in the size of the\n   *  maps.  The elements must be comparable with @c <.\n   *\n   *  See std::lexicographical_compare() for how the determination is made.\n  */\n  template<class _Key, class _Compare, class _Alloc>\n    inline bool\n    operator<(const set<_Key, _Compare, _Alloc>& __x,\n\t      const set<_Key, _Compare, _Alloc>& __y)\n    { return __x._M_t < __y._M_t; }\n\n  ///  Returns !(x == y).\n  template<class _Key, class _Compare, class _Alloc>\n    inline bool\n    operator!=(const set<_Key, _Compare, _Alloc>& __x,\n\t       const set<_Key, _Compare, _Alloc>& __y)\n    { return !(__x == __y); }\n\n  ///  Returns y < x.\n  template<class _Key, class _Compare, class _Alloc>\n    inline bool\n    operator>(const set<_Key, _Compare, _Alloc>& __x,\n\t      const set<_Key, _Compare, _Alloc>& __y)\n    { return __y < __x; }\n\n  ///  Returns !(y < x)\n  template<class _Key, class _Compare, class _Alloc>\n    inline bool\n    operator<=(const set<_Key, _Compare, _Alloc>& __x,\n\t       const set<_Key, _Compare, _Alloc>& __y)\n    { return !(__y < __x); }\n\n  ///  Returns !(x < y)\n  template<class _Key, class _Compare, class _Alloc>\n    inline bool\n    operator>=(const set<_Key, _Compare, _Alloc>& __x,\n\t       const set<_Key, _Compare, _Alloc>& __y)\n    { return !(__x < __y); }\n\n  /// See std::set::swap().\n  template<class _Key, class _Compare, class _Alloc>\n    inline void\n    swap(set<_Key, _Compare, _Alloc>& __x, set<_Key, _Compare, _Alloc>& __y)\n    { __x.swap(__y); }\n\n_GLIBCXX_END_NESTED_NAMESPACE\n\n#endif /* _SET_H */\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/bits/stl_stack.h",
    "content": "// Stack implementation -*- C++ -*-\n\n// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006\n// Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n/*\n *\n * Copyright (c) 1994\n * Hewlett-Packard Company\n *\n * Permission to use, copy, modify, distribute and sell this software\n * and its documentation for any purpose is hereby granted without fee,\n * provided that the above copyright notice appear in all copies and\n * that both that copyright notice and this permission notice appear\n * in supporting documentation.  Hewlett-Packard Company makes no\n * representations about the suitability of this software for any\n * purpose.  It is provided \"as is\" without express or implied warranty.\n *\n *\n * Copyright (c) 1996,1997\n * Silicon Graphics Computer Systems, Inc.\n *\n * Permission to use, copy, modify, distribute and sell this software\n * and its documentation for any purpose is hereby granted without fee,\n * provided that the above copyright notice appear in all copies and\n * that both that copyright notice and this permission notice appear\n * in supporting documentation.  Silicon Graphics makes no\n * representations about the suitability of this software for any\n * purpose.  It is provided \"as is\" without express or implied warranty.\n */\n\n/** @file stl_stack.h\n *  This is an internal header file, included by other library headers.\n *  You should not attempt to use it directly.\n */\n\n#ifndef _STACK_H\n#define _STACK_H 1\n\n#include <bits/concept_check.h>\n#include <debug/debug.h>\n\n_GLIBCXX_BEGIN_NAMESPACE(std)\n\n  /**\n   *  @brief  A standard container giving FILO behavior.\n   *\n   *  @ingroup Containers\n   *  @ingroup Sequences\n   *\n   *  Meets many of the requirements of a\n   *  <a href=\"tables.html#65\">container</a>,\n   *  but does not define anything to do with iterators.  Very few of the\n   *  other standard container interfaces are defined.\n   *\n   *  This is not a true container, but an @e adaptor.  It holds\n   *  another container, and provides a wrapper interface to that\n   *  container.  The wrapper is what enforces strict\n   *  first-in-last-out %stack behavior.\n   *\n   *  The second template parameter defines the type of the underlying\n   *  sequence/container.  It defaults to std::deque, but it can be\n   *  any type that supports @c back, @c push_back, and @c pop_front,\n   *  such as std::list, std::vector, or an appropriate user-defined\n   *  type.\n   *\n   *  Members not found in \"normal\" containers are @c container_type,\n   *  which is a typedef for the second Sequence parameter, and @c\n   *  push, @c pop, and @c top, which are standard %stack/FILO\n   *  operations.\n  */\n  template<typename _Tp, typename _Sequence = deque<_Tp> >\n    class stack\n    {\n      // concept requirements\n      typedef typename _Sequence::value_type _Sequence_value_type;\n      __glibcxx_class_requires(_Tp, _SGIAssignableConcept)\n      __glibcxx_class_requires(_Sequence, _BackInsertionSequenceConcept)\n      __glibcxx_class_requires2(_Tp, _Sequence_value_type, _SameTypeConcept)\n\n      template<typename _Tp1, typename _Seq1>\n        friend bool\n        operator==(const stack<_Tp1, _Seq1>&, const stack<_Tp1, _Seq1>&);\n\n      template<typename _Tp1, typename _Seq1>\n        friend bool\n        operator<(const stack<_Tp1, _Seq1>&, const stack<_Tp1, _Seq1>&);\n\n    public:\n      typedef typename _Sequence::value_type                value_type;\n      typedef typename _Sequence::reference                 reference;\n      typedef typename _Sequence::const_reference           const_reference;\n      typedef typename _Sequence::size_type                 size_type;\n      typedef          _Sequence                            container_type;\n\n    protected:\n      //  See queue::c for notes on this name.\n      _Sequence c;\n\n    public:\n      // XXX removed old def ctor, added def arg to this one to match 14882\n      /**\n       *  @brief  Default constructor creates no elements.\n       */\n      explicit\n      stack(const _Sequence& __c = _Sequence())\n      : c(__c) { }\n\n      /**\n       *  Returns true if the %stack is empty.\n       */\n      bool\n      empty() const\n      { return c.empty(); }\n\n      /**  Returns the number of elements in the %stack.  */\n      size_type\n      size() const\n      { return c.size(); }\n\n      /**\n       *  Returns a read/write reference to the data at the first\n       *  element of the %stack.\n       */\n      reference\n      top()\n      {\n\t__glibcxx_requires_nonempty();\n\treturn c.back();\n      }\n\n      /**\n       *  Returns a read-only (constant) reference to the data at the first\n       *  element of the %stack.\n       */\n      const_reference\n      top() const\n      {\n\t__glibcxx_requires_nonempty();\n\treturn c.back();\n      }\n\n      /**\n       *  @brief  Add data to the top of the %stack.\n       *  @param  x  Data to be added.\n       *\n       *  This is a typical %stack operation.  The function creates an\n       *  element at the top of the %stack and assigns the given data\n       *  to it.  The time complexity of the operation depends on the\n       *  underlying sequence.\n       */\n      void\n      push(const value_type& __x)\n      { c.push_back(__x); }\n\n      /**\n       *  @brief  Removes first element.\n       *\n       *  This is a typical %stack operation.  It shrinks the %stack\n       *  by one.  The time complexity of the operation depends on the\n       *  underlying sequence.\n       *\n       *  Note that no data is returned, and if the first element's\n       *  data is needed, it should be retrieved before pop() is\n       *  called.\n       */\n      void\n      pop()\n      {\n\t__glibcxx_requires_nonempty();\n\tc.pop_back();\n      }\n    };\n\n  /**\n   *  @brief  Stack equality comparison.\n   *  @param  x  A %stack.\n   *  @param  y  A %stack of the same type as @a x.\n   *  @return  True iff the size and elements of the stacks are equal.\n   *\n   *  This is an equivalence relation.  Complexity and semantics\n   *  depend on the underlying sequence type, but the expected rules\n   *  are: this relation is linear in the size of the sequences, and\n   *  stacks are considered equivalent if their sequences compare\n   *  equal.\n  */\n  template<typename _Tp, typename _Seq>\n    inline bool\n    operator==(const stack<_Tp, _Seq>& __x, const stack<_Tp, _Seq>& __y)\n    { return __x.c == __y.c; }\n\n  /**\n   *  @brief  Stack ordering relation.\n   *  @param  x  A %stack.\n   *  @param  y  A %stack of the same type as @a x.\n   *  @return  True iff @a x is lexicographically less than @a y.\n   *\n   *  This is an total ordering relation.  Complexity and semantics\n   *  depend on the underlying sequence type, but the expected rules\n   *  are: this relation is linear in the size of the sequences, the\n   *  elements must be comparable with @c <, and\n   *  std::lexicographical_compare() is usually used to make the\n   *  determination.\n  */\n  template<typename _Tp, typename _Seq>\n    inline bool\n    operator<(const stack<_Tp, _Seq>& __x, const stack<_Tp, _Seq>& __y)\n    { return __x.c < __y.c; }\n\n  /// Based on operator==\n  template<typename _Tp, typename _Seq>\n    inline bool\n    operator!=(const stack<_Tp, _Seq>& __x, const stack<_Tp, _Seq>& __y)\n    { return !(__x == __y); }\n\n  /// Based on operator<\n  template<typename _Tp, typename _Seq>\n    inline bool\n    operator>(const stack<_Tp, _Seq>& __x, const stack<_Tp, _Seq>& __y)\n    { return __y < __x; }\n\n  /// Based on operator<\n  template<typename _Tp, typename _Seq>\n    inline bool\n    operator<=(const stack<_Tp, _Seq>& __x, const stack<_Tp, _Seq>& __y)\n    { return !(__y < __x); }\n\n  /// Based on operator<\n  template<typename _Tp, typename _Seq>\n    inline bool\n    operator>=(const stack<_Tp, _Seq>& __x, const stack<_Tp, _Seq>& __y)\n    { return !(__x < __y); }\n\n_GLIBCXX_END_NAMESPACE\n\n#endif /* _STACK_H */\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/bits/stl_tempbuf.h",
    "content": "// Temporary buffer implementation -*- C++ -*-\n\n// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006 \n// Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n/*\n *\n * Copyright (c) 1994\n * Hewlett-Packard Company\n *\n * Permission to use, copy, modify, distribute and sell this software\n * and its documentation for any purpose is hereby granted without fee,\n * provided that the above copyright notice appear in all copies and\n * that both that copyright notice and this permission notice appear\n * in supporting documentation.  Hewlett-Packard Company makes no\n * representations about the suitability of this software for any\n * purpose.  It is provided \"as is\" without express or implied warranty.\n *\n *\n * Copyright (c) 1996,1997\n * Silicon Graphics Computer Systems, Inc.\n *\n * Permission to use, copy, modify, distribute and sell this software\n * and its documentation for any purpose is hereby granted without fee,\n * provided that the above copyright notice appear in all copies and\n * that both that copyright notice and this permission notice appear\n * in supporting documentation.  Silicon Graphics makes no\n * representations about the suitability of this software for any\n * purpose.  It is provided \"as is\" without express or implied warranty.\n */\n\n/** @file stl_tempbuf.h\n *  This is an internal header file, included by other library headers.\n *  You should not attempt to use it directly.\n */\n\n#ifndef _TEMPBUF_H\n#define _TEMPBUF_H 1\n\n#include <memory>\n\n_GLIBCXX_BEGIN_NAMESPACE(std)\n\n  /**\n   *  @if maint\n   *  This class is used in two places: stl_algo.h and ext/memory,\n   *  where it is wrapped as the temporary_buffer class.  See\n   *  temporary_buffer docs for more notes.\n   *  @endif\n   */\n  template<typename _ForwardIterator, typename _Tp>\n    class _Temporary_buffer\n    {\n      // concept requirements\n      __glibcxx_class_requires(_ForwardIterator, _ForwardIteratorConcept)\n\n    public:\n      typedef _Tp         value_type;\n      typedef value_type* pointer;\n      typedef pointer     iterator;\n      typedef ptrdiff_t   size_type;\n\n    protected:\n      size_type  _M_original_len;\n      size_type  _M_len;\n      pointer    _M_buffer;\n\n      void\n      _M_initialize_buffer(const _Tp&, __true_type) { }\n\n      void\n      _M_initialize_buffer(const _Tp& __val, __false_type)\n      { std::uninitialized_fill_n(_M_buffer, _M_len, __val); }\n\n    public:\n      /// As per Table mumble.\n      size_type\n      size() const\n      { return _M_len; }\n\n      /// Returns the size requested by the constructor; may be >size().\n      size_type\n      requested_size() const\n      { return _M_original_len; }\n\n      /// As per Table mumble.\n      iterator\n      begin()\n      { return _M_buffer; }\n\n      /// As per Table mumble.\n      iterator\n      end()\n      { return _M_buffer + _M_len; }\n\n      /**\n       * Constructs a temporary buffer of a size somewhere between\n       * zero and the size of the given range.\n       */\n      _Temporary_buffer(_ForwardIterator __first, _ForwardIterator __last);\n\n      ~_Temporary_buffer()\n      {\n\tstd::_Destroy(_M_buffer, _M_buffer + _M_len);\n\tstd::return_temporary_buffer(_M_buffer);\n      }\n\n    private:\n      // Disable copy constructor and assignment operator.\n      _Temporary_buffer(const _Temporary_buffer&);\n\n      void\n      operator=(const _Temporary_buffer&);\n    };\n\n\n  template<typename _ForwardIterator, typename _Tp>\n    _Temporary_buffer<_ForwardIterator, _Tp>::\n    _Temporary_buffer(_ForwardIterator __first, _ForwardIterator __last)\n    : _M_original_len(std::distance(__first, __last)),\n      _M_len(0), _M_buffer(0)\n    {\n      // Workaround for a __type_traits bug in the pre-7.3 compiler.\n      typedef typename std::__is_scalar<_Tp>::__type _Trivial;\n\n      try\n\t{\n\t  pair<pointer, size_type> __p(get_temporary_buffer<\n\t\t\t\t       value_type>(_M_original_len));\n\t  _M_buffer = __p.first;\n\t  _M_len = __p.second;\n\t  if (_M_len > 0)\n\t    _M_initialize_buffer(*__first, _Trivial());\n\t}\n      catch(...)\n\t{\n\t  std::return_temporary_buffer(_M_buffer);\n\t  _M_buffer = 0;\n\t  _M_len = 0;\n\t  __throw_exception_again;\n\t}\n    }\n\n_GLIBCXX_END_NAMESPACE\n\n#endif /* _TEMPBUF_H */\n\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/bits/stl_tree.h",
    "content": "// RB tree implementation -*- C++ -*-\n\n// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006\n// Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n/*\n *\n * Copyright (c) 1996,1997\n * Silicon Graphics Computer Systems, Inc.\n *\n * Permission to use, copy, modify, distribute and sell this software\n * and its documentation for any purpose is hereby granted without fee,\n * provided that the above copyright notice appear in all copies and\n * that both that copyright notice and this permission notice appear\n * in supporting documentation.  Silicon Graphics makes no\n * representations about the suitability of this software for any\n * purpose.  It is provided \"as is\" without express or implied warranty.\n *\n *\n * Copyright (c) 1994\n * Hewlett-Packard Company\n *\n * Permission to use, copy, modify, distribute and sell this software\n * and its documentation for any purpose is hereby granted without fee,\n * provided that the above copyright notice appear in all copies and\n * that both that copyright notice and this permission notice appear\n * in supporting documentation.  Hewlett-Packard Company makes no\n * representations about the suitability of this software for any\n * purpose.  It is provided \"as is\" without express or implied warranty.\n *\n *\n */\n\n/** @file stl_tree.h\n *  This is an internal header file, included by other library headers.\n *  You should not attempt to use it directly.\n */\n\n#ifndef _TREE_H\n#define _TREE_H 1\n\n#include <bits/stl_algobase.h>\n#include <bits/allocator.h>\n#include <bits/stl_construct.h>\n#include <bits/stl_function.h>\n#include <bits/cpp_type_traits.h>\n\n_GLIBCXX_BEGIN_NAMESPACE(std)\n\n  // Red-black tree class, designed for use in implementing STL\n  // associative containers (set, multiset, map, and multimap). The\n  // insertion and deletion algorithms are based on those in Cormen,\n  // Leiserson, and Rivest, Introduction to Algorithms (MIT Press,\n  // 1990), except that\n  //\n  // (1) the header cell is maintained with links not only to the root\n  // but also to the leftmost node of the tree, to enable constant\n  // time begin(), and to the rightmost node of the tree, to enable\n  // linear time performance when used with the generic set algorithms\n  // (set_union, etc.)\n  // \n  // (2) when a node being deleted has two children its successor node\n  // is relinked into its place, rather than copied, so that the only\n  // iterators invalidated are those referring to the deleted node.\n\n  enum _Rb_tree_color { _S_red = false, _S_black = true };\n\n  struct _Rb_tree_node_base\n  {\n    typedef _Rb_tree_node_base* _Base_ptr;\n    typedef const _Rb_tree_node_base* _Const_Base_ptr;\n\n    _Rb_tree_color\t_M_color;\n    _Base_ptr\t\t_M_parent;\n    _Base_ptr\t\t_M_left;\n    _Base_ptr\t\t_M_right;\n\n    static _Base_ptr\n    _S_minimum(_Base_ptr __x)\n    {\n      while (__x->_M_left != 0) __x = __x->_M_left;\n      return __x;\n    }\n\n    static _Const_Base_ptr\n    _S_minimum(_Const_Base_ptr __x)\n    {\n      while (__x->_M_left != 0) __x = __x->_M_left;\n      return __x;\n    }\n\n    static _Base_ptr\n    _S_maximum(_Base_ptr __x)\n    {\n      while (__x->_M_right != 0) __x = __x->_M_right;\n      return __x;\n    }\n\n    static _Const_Base_ptr\n    _S_maximum(_Const_Base_ptr __x)\n    {\n      while (__x->_M_right != 0) __x = __x->_M_right;\n      return __x;\n    }\n  };\n\n  template<typename _Val>\n    struct _Rb_tree_node : public _Rb_tree_node_base\n    {\n      typedef _Rb_tree_node<_Val>* _Link_type;\n      _Val _M_value_field;\n    };\n\n  _Rb_tree_node_base*\n  _Rb_tree_increment(_Rb_tree_node_base* __x);\n\n  const _Rb_tree_node_base*\n  _Rb_tree_increment(const _Rb_tree_node_base* __x);\n\n  _Rb_tree_node_base*\n  _Rb_tree_decrement(_Rb_tree_node_base* __x);\n\n  const _Rb_tree_node_base*\n  _Rb_tree_decrement(const _Rb_tree_node_base* __x);\n\n  template<typename _Tp>\n    struct _Rb_tree_iterator\n    {\n      typedef _Tp  value_type;\n      typedef _Tp& reference;\n      typedef _Tp* pointer;\n\n      typedef bidirectional_iterator_tag iterator_category;\n      typedef ptrdiff_t                  difference_type;\n\n      typedef _Rb_tree_iterator<_Tp>        _Self;\n      typedef _Rb_tree_node_base::_Base_ptr _Base_ptr;\n      typedef _Rb_tree_node<_Tp>*           _Link_type;\n\n      _Rb_tree_iterator()\n      : _M_node() { }\n\n      explicit\n      _Rb_tree_iterator(_Link_type __x)\n      : _M_node(__x) { }\n\n      reference\n      operator*() const\n      { return static_cast<_Link_type>(_M_node)->_M_value_field; }\n\n      pointer\n      operator->() const\n      { return &static_cast<_Link_type>(_M_node)->_M_value_field; }\n\n      _Self&\n      operator++()\n      {\n\t_M_node = _Rb_tree_increment(_M_node);\n\treturn *this;\n      }\n\n      _Self\n      operator++(int)\n      {\n\t_Self __tmp = *this;\n\t_M_node = _Rb_tree_increment(_M_node);\n\treturn __tmp;\n      }\n\n      _Self&\n      operator--()\n      {\n\t_M_node = _Rb_tree_decrement(_M_node);\n\treturn *this;\n      }\n\n      _Self\n      operator--(int)\n      {\n\t_Self __tmp = *this;\n\t_M_node = _Rb_tree_decrement(_M_node);\n\treturn __tmp;\n      }\n\n      bool\n      operator==(const _Self& __x) const\n      { return _M_node == __x._M_node; }\n\n      bool\n      operator!=(const _Self& __x) const\n      { return _M_node != __x._M_node; }\n\n      _Base_ptr _M_node;\n  };\n\n  template<typename _Tp>\n    struct _Rb_tree_const_iterator\n    {\n      typedef _Tp        value_type;\n      typedef const _Tp& reference;\n      typedef const _Tp* pointer;\n\n      typedef _Rb_tree_iterator<_Tp> iterator;\n\n      typedef bidirectional_iterator_tag iterator_category;\n      typedef ptrdiff_t                  difference_type;\n\n      typedef _Rb_tree_const_iterator<_Tp>        _Self;\n      typedef _Rb_tree_node_base::_Const_Base_ptr _Base_ptr;\n      typedef const _Rb_tree_node<_Tp>*           _Link_type;\n\n      _Rb_tree_const_iterator()\n      : _M_node() { }\n\n      explicit\n      _Rb_tree_const_iterator(_Link_type __x)\n      : _M_node(__x) { }\n\n      _Rb_tree_const_iterator(const iterator& __it)\n      : _M_node(__it._M_node) { }\n\n      reference\n      operator*() const\n      { return static_cast<_Link_type>(_M_node)->_M_value_field; }\n\n      pointer\n      operator->() const\n      { return &static_cast<_Link_type>(_M_node)->_M_value_field; }\n\n      _Self&\n      operator++()\n      {\n\t_M_node = _Rb_tree_increment(_M_node);\n\treturn *this;\n      }\n\n      _Self\n      operator++(int)\n      {\n\t_Self __tmp = *this;\n\t_M_node = _Rb_tree_increment(_M_node);\n\treturn __tmp;\n      }\n\n      _Self&\n      operator--()\n      {\n\t_M_node = _Rb_tree_decrement(_M_node);\n\treturn *this;\n      }\n\n      _Self\n      operator--(int)\n      {\n\t_Self __tmp = *this;\n\t_M_node = _Rb_tree_decrement(_M_node);\n\treturn __tmp;\n      }\n\n      bool\n      operator==(const _Self& __x) const\n      { return _M_node == __x._M_node; }\n\n      bool\n      operator!=(const _Self& __x) const\n      { return _M_node != __x._M_node; }\n\n      _Base_ptr _M_node;\n    };\n\n  template<typename _Val>\n    inline bool\n    operator==(const _Rb_tree_iterator<_Val>& __x,\n               const _Rb_tree_const_iterator<_Val>& __y)\n    { return __x._M_node == __y._M_node; }\n\n  template<typename _Val>\n    inline bool\n    operator!=(const _Rb_tree_iterator<_Val>& __x,\n               const _Rb_tree_const_iterator<_Val>& __y)\n    { return __x._M_node != __y._M_node; }\n\n  void\n  _Rb_tree_rotate_left(_Rb_tree_node_base* const __x,\n                       _Rb_tree_node_base*& __root);\n\n  void\n  _Rb_tree_rotate_right(_Rb_tree_node_base* const __x,\n                        _Rb_tree_node_base*& __root);\n\n  void\n  _Rb_tree_insert_and_rebalance(const bool __insert_left,\n                                _Rb_tree_node_base* __x,\n                                _Rb_tree_node_base* __p,\n                                _Rb_tree_node_base& __header);\n\n  _Rb_tree_node_base*\n  _Rb_tree_rebalance_for_erase(_Rb_tree_node_base* const __z,\n\t\t\t       _Rb_tree_node_base& __header);\n\n\n  template<typename _Key, typename _Val, typename _KeyOfValue,\n           typename _Compare, typename _Alloc = allocator<_Val> >\n    class _Rb_tree\n    {\n      typedef typename _Alloc::template rebind<_Rb_tree_node<_Val> >::other\n              _Node_allocator;\n\n    protected:\n      typedef _Rb_tree_node_base* _Base_ptr;\n      typedef const _Rb_tree_node_base* _Const_Base_ptr;\n      typedef _Rb_tree_node<_Val> _Rb_tree_node;\n\n    public:\n      typedef _Key key_type;\n      typedef _Val value_type;\n      typedef value_type* pointer;\n      typedef const value_type* const_pointer;\n      typedef value_type& reference;\n      typedef const value_type& const_reference;\n      typedef _Rb_tree_node* _Link_type;\n      typedef const _Rb_tree_node* _Const_Link_type;\n      typedef size_t size_type;\n      typedef ptrdiff_t difference_type;\n      typedef _Alloc allocator_type;\n\n      _Node_allocator&\n      _M_get_Node_allocator()\n      { return *static_cast<_Node_allocator*>(&this->_M_impl); }\n      \n      const _Node_allocator&\n      _M_get_Node_allocator() const\n      { return *static_cast<const _Node_allocator*>(&this->_M_impl); }\n\n      allocator_type\n      get_allocator() const\n      { return allocator_type(_M_get_Node_allocator()); }\n\n    protected:\n      _Rb_tree_node*\n      _M_get_node()\n      { return _M_impl._Node_allocator::allocate(1); }\n\n      void\n      _M_put_node(_Rb_tree_node* __p)\n      { _M_impl._Node_allocator::deallocate(__p, 1); }\n\n      _Link_type\n      _M_create_node(const value_type& __x)\n      {\n\t_Link_type __tmp = _M_get_node();\n\ttry\n\t  { get_allocator().construct(&__tmp->_M_value_field, __x); }\n\tcatch(...)\n\t  {\n\t    _M_put_node(__tmp);\n\t    __throw_exception_again;\n\t  }\n\treturn __tmp;\n      }\n\n      _Link_type\n      _M_clone_node(_Const_Link_type __x)\n      {\n\t_Link_type __tmp = _M_create_node(__x->_M_value_field);\n\t__tmp->_M_color = __x->_M_color;\n\t__tmp->_M_left = 0;\n\t__tmp->_M_right = 0;\n\treturn __tmp;\n      }\n\n      void\n      _M_destroy_node(_Link_type __p)\n      {\n\tget_allocator().destroy(&__p->_M_value_field);\n\t_M_put_node(__p);\n      }\n\n    protected:\n      template<typename _Key_compare, \n\t       bool _Is_pod_comparator = std::__is_pod<_Key_compare>::__value>\n        struct _Rb_tree_impl : public _Node_allocator\n        {\n\t  _Key_compare\t\t_M_key_compare;\n\t  _Rb_tree_node_base \t_M_header;\n\t  size_type \t\t_M_node_count; // Keeps track of size of tree.\n\n\t  _Rb_tree_impl(const _Node_allocator& __a = _Node_allocator(),\n\t\t\tconst _Key_compare& __comp = _Key_compare())\n\t  : _Node_allocator(__a), _M_key_compare(__comp), _M_header(), \n\t    _M_node_count(0)\n\t  {\n\t    this->_M_header._M_color = _S_red;\n\t    this->_M_header._M_parent = 0;\n\t    this->_M_header._M_left = &this->_M_header;\n\t    this->_M_header._M_right = &this->_M_header;\n\t  }\n\t};\n\n      // Specialization for _Comparison types that are not capable of\n      // being base classes / super classes.\n      template<typename _Key_compare>\n        struct _Rb_tree_impl<_Key_compare, true> : public _Node_allocator \n\t{\n\t  _Key_compare \t\t_M_key_compare;\n\t  _Rb_tree_node_base \t_M_header;\n\t  size_type \t\t_M_node_count; // Keeps track of size of tree.\n\n\t  _Rb_tree_impl(const _Node_allocator& __a = _Node_allocator(),\n\t\t\tconst _Key_compare& __comp = _Key_compare())\n\t  : _Node_allocator(__a), _M_key_compare(__comp), _M_header(),\n\t    _M_node_count(0)\n\t  { \n\t    this->_M_header._M_color = _S_red;\n\t    this->_M_header._M_parent = 0;\n\t    this->_M_header._M_left = &this->_M_header;\n\t    this->_M_header._M_right = &this->_M_header;\n\t  }\n\t};\n\n      _Rb_tree_impl<_Compare> _M_impl;\n\n    protected:\n      _Base_ptr&\n      _M_root()\n      { return this->_M_impl._M_header._M_parent; }\n\n      _Const_Base_ptr\n      _M_root() const\n      { return this->_M_impl._M_header._M_parent; }\n\n      _Base_ptr&\n      _M_leftmost()\n      { return this->_M_impl._M_header._M_left; }\n\n      _Const_Base_ptr\n      _M_leftmost() const\n      { return this->_M_impl._M_header._M_left; }\n\n      _Base_ptr&\n      _M_rightmost()\n      { return this->_M_impl._M_header._M_right; }\n\n      _Const_Base_ptr\n      _M_rightmost() const\n      { return this->_M_impl._M_header._M_right; }\n\n      _Link_type\n      _M_begin()\n      { return static_cast<_Link_type>(this->_M_impl._M_header._M_parent); }\n\n      _Const_Link_type\n      _M_begin() const\n      {\n\treturn static_cast<_Const_Link_type>\n\t  (this->_M_impl._M_header._M_parent);\n      }\n\n      _Link_type\n      _M_end()\n      { return static_cast<_Link_type>(&this->_M_impl._M_header); }\n\n      _Const_Link_type\n      _M_end() const\n      { return static_cast<_Const_Link_type>(&this->_M_impl._M_header); }\n\n      static const_reference\n      _S_value(_Const_Link_type __x)\n      { return __x->_M_value_field; }\n\n      static const _Key&\n      _S_key(_Const_Link_type __x)\n      { return _KeyOfValue()(_S_value(__x)); }\n\n      static _Link_type\n      _S_left(_Base_ptr __x)\n      { return static_cast<_Link_type>(__x->_M_left); }\n\n      static _Const_Link_type\n      _S_left(_Const_Base_ptr __x)\n      { return static_cast<_Const_Link_type>(__x->_M_left); }\n\n      static _Link_type\n      _S_right(_Base_ptr __x)\n      { return static_cast<_Link_type>(__x->_M_right); }\n\n      static _Const_Link_type\n      _S_right(_Const_Base_ptr __x)\n      { return static_cast<_Const_Link_type>(__x->_M_right); }\n\n      static const_reference\n      _S_value(_Const_Base_ptr __x)\n      { return static_cast<_Const_Link_type>(__x)->_M_value_field; }\n\n      static const _Key&\n      _S_key(_Const_Base_ptr __x)\n      { return _KeyOfValue()(_S_value(__x)); }\n\n      static _Base_ptr\n      _S_minimum(_Base_ptr __x)\n      { return _Rb_tree_node_base::_S_minimum(__x); }\n\n      static _Const_Base_ptr\n      _S_minimum(_Const_Base_ptr __x)\n      { return _Rb_tree_node_base::_S_minimum(__x); }\n\n      static _Base_ptr\n      _S_maximum(_Base_ptr __x)\n      { return _Rb_tree_node_base::_S_maximum(__x); }\n\n      static _Const_Base_ptr\n      _S_maximum(_Const_Base_ptr __x)\n      { return _Rb_tree_node_base::_S_maximum(__x); }\n\n    public:\n      typedef _Rb_tree_iterator<value_type>       iterator;\n      typedef _Rb_tree_const_iterator<value_type> const_iterator;\n\n      typedef std::reverse_iterator<iterator>       reverse_iterator;\n      typedef std::reverse_iterator<const_iterator> const_reverse_iterator;\n\n    private:\n      iterator\n      _M_insert(_Base_ptr __x, _Base_ptr __y, const value_type& __v);\n\n      // _GLIBCXX_RESOLVE_LIB_DEFECTS\n      // 233. Insertion hints in associative containers.\n      iterator\n      _M_insert_lower(_Base_ptr __x, _Base_ptr __y, const value_type& __v);\n\n      const_iterator\n      _M_insert(_Const_Base_ptr __x, _Const_Base_ptr __y,\n\t\tconst value_type& __v);\n\n      _Link_type\n      _M_copy(_Const_Link_type __x, _Link_type __p);\n\n      void\n      _M_erase(_Link_type __x);\n\n    public:\n      // allocation/deallocation\n      _Rb_tree()\n      { }\n\n      _Rb_tree(const _Compare& __comp)\n      : _M_impl(allocator_type(), __comp)\n      { }\n\n      _Rb_tree(const _Compare& __comp, const allocator_type& __a)\n      : _M_impl(__a, __comp)\n      { }\n\n      _Rb_tree(const _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>& __x)\n      : _M_impl(__x._M_get_Node_allocator(), __x._M_impl._M_key_compare)\n      {\n\tif (__x._M_root() != 0)\n\t  {\n\t    _M_root() = _M_copy(__x._M_begin(), _M_end());\n\t    _M_leftmost() = _S_minimum(_M_root());\n\t    _M_rightmost() = _S_maximum(_M_root());\n\t    _M_impl._M_node_count = __x._M_impl._M_node_count;\n\t  }\n      }\n\n      ~_Rb_tree()\n      { _M_erase(_M_begin()); }\n\n      _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>&\n      operator=(const _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>& __x);\n\n      // Accessors.\n      _Compare\n      key_comp() const\n      { return _M_impl._M_key_compare; }\n\n      iterator\n      begin()\n      { \n\treturn iterator(static_cast<_Link_type>\n\t\t\t(this->_M_impl._M_header._M_left));\n      }\n\n      const_iterator\n      begin() const\n      { \n\treturn const_iterator(static_cast<_Const_Link_type>\n\t\t\t      (this->_M_impl._M_header._M_left));\n      }\n\n      iterator\n      end()\n      { return iterator(static_cast<_Link_type>(&this->_M_impl._M_header)); }\n\n      const_iterator\n      end() const\n      { \n\treturn const_iterator(static_cast<_Const_Link_type>\n\t\t\t      (&this->_M_impl._M_header));\n      }\n\n      reverse_iterator\n      rbegin()\n      { return reverse_iterator(end()); }\n\n      const_reverse_iterator\n      rbegin() const\n      { return const_reverse_iterator(end()); }\n\n      reverse_iterator\n      rend()\n      { return reverse_iterator(begin()); }\n\n      const_reverse_iterator\n      rend() const\n      { return const_reverse_iterator(begin()); }\n\n      bool\n      empty() const\n      { return _M_impl._M_node_count == 0; }\n\n      size_type\n      size() const\n      { return _M_impl._M_node_count; }\n\n      size_type\n      max_size() const\n      { return get_allocator().max_size(); }\n\n      void\n      swap(_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>& __t);\n\n      // Insert/erase.\n      pair<iterator, bool>\n      _M_insert_unique(const value_type& __x);\n\n      iterator\n      _M_insert_equal(const value_type& __x);\n\n      // _GLIBCXX_RESOLVE_LIB_DEFECTS\n      // 233. Insertion hints in associative containers.\n      iterator\n      _M_insert_equal_lower(const value_type& __x);\n\n      iterator\n      _M_insert_unique(iterator __position, const value_type& __x);\n\n      const_iterator\n      _M_insert_unique(const_iterator __position, const value_type& __x);\n\n      iterator\n      _M_insert_equal(iterator __position, const value_type& __x);\n\n      const_iterator\n      _M_insert_equal(const_iterator __position, const value_type& __x);\n\n      template<typename _InputIterator>\n        void\n        _M_insert_unique(_InputIterator __first, _InputIterator __last);\n\n      template<typename _InputIterator>\n        void\n        _M_insert_equal(_InputIterator __first, _InputIterator __last);\n\n      void\n      erase(iterator __position);\n\n      void\n      erase(const_iterator __position);\n\n      size_type\n      erase(const key_type& __x);\n\n      void\n      erase(iterator __first, iterator __last);\n\n      void\n      erase(const_iterator __first, const_iterator __last);\n\n      void\n      erase(const key_type* __first, const key_type* __last);\n\n      void\n      clear()\n      {\n        _M_erase(_M_begin());\n        _M_leftmost() = _M_end();\n        _M_root() = 0;\n        _M_rightmost() = _M_end();\n        _M_impl._M_node_count = 0;\n      }\n\n      // Set operations.\n      iterator\n      find(const key_type& __x);\n\n      const_iterator\n      find(const key_type& __x) const;\n\n      size_type\n      count(const key_type& __x) const;\n\n      iterator\n      lower_bound(const key_type& __x);\n\n      const_iterator\n      lower_bound(const key_type& __x) const;\n\n      iterator\n      upper_bound(const key_type& __x);\n\n      const_iterator\n      upper_bound(const key_type& __x) const;\n\n      pair<iterator,iterator>\n      equal_range(const key_type& __x);\n\n      pair<const_iterator, const_iterator>\n      equal_range(const key_type& __x) const;\n\n      // Debugging.\n      bool\n      __rb_verify() const;\n    };\n\n  template<typename _Key, typename _Val, typename _KeyOfValue,\n           typename _Compare, typename _Alloc>\n    inline bool\n    operator==(const _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>& __x,\n\t       const _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>& __y)\n    {\n      return __x.size() == __y.size()\n\t     && std::equal(__x.begin(), __x.end(), __y.begin());\n    }\n\n  template<typename _Key, typename _Val, typename _KeyOfValue,\n           typename _Compare, typename _Alloc>\n    inline bool\n    operator<(const _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>& __x,\n\t      const _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>& __y)\n    {\n      return std::lexicographical_compare(__x.begin(), __x.end(), \n\t\t\t\t\t  __y.begin(), __y.end());\n    }\n\n  template<typename _Key, typename _Val, typename _KeyOfValue,\n           typename _Compare, typename _Alloc>\n    inline bool\n    operator!=(const _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>& __x,\n\t       const _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>& __y)\n    { return !(__x == __y); }\n\n  template<typename _Key, typename _Val, typename _KeyOfValue,\n           typename _Compare, typename _Alloc>\n    inline bool\n    operator>(const _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>& __x,\n\t      const _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>& __y)\n    { return __y < __x; }\n\n  template<typename _Key, typename _Val, typename _KeyOfValue,\n           typename _Compare, typename _Alloc>\n    inline bool\n    operator<=(const _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>& __x,\n\t       const _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>& __y)\n    { return !(__y < __x); }\n\n  template<typename _Key, typename _Val, typename _KeyOfValue,\n           typename _Compare, typename _Alloc>\n    inline bool\n    operator>=(const _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>& __x,\n\t       const _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>& __y)\n    { return !(__x < __y); }\n\n  template<typename _Key, typename _Val, typename _KeyOfValue,\n           typename _Compare, typename _Alloc>\n    inline void\n    swap(_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>& __x,\n\t _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>& __y)\n    { __x.swap(__y); }\n\n  template<typename _Key, typename _Val, typename _KeyOfValue,\n           typename _Compare, typename _Alloc>\n    _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>&\n    _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::\n    operator=(const _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>& __x)\n    {\n      if (this != &__x)\n\t{\n\t  // Note that _Key may be a constant type.\n\t  clear();\n\t  _M_impl._M_key_compare = __x._M_impl._M_key_compare;\n\t  if (__x._M_root() != 0)\n\t    {\n\t      _M_root() = _M_copy(__x._M_begin(), _M_end());\n\t      _M_leftmost() = _S_minimum(_M_root());\n\t      _M_rightmost() = _S_maximum(_M_root());\n\t      _M_impl._M_node_count = __x._M_impl._M_node_count;\n\t    }\n\t}\n      return *this;\n    }\n\n  template<typename _Key, typename _Val, typename _KeyOfValue,\n           typename _Compare, typename _Alloc>\n    typename _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::iterator\n    _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::\n    _M_insert(_Base_ptr __x, _Base_ptr __p, const _Val& __v)\n    {\n      bool __insert_left = (__x != 0 || __p == _M_end()\n\t\t\t    || _M_impl._M_key_compare(_KeyOfValue()(__v), \n\t\t\t\t\t\t      _S_key(__p)));\n\n      _Link_type __z = _M_create_node(__v);\n\n      _Rb_tree_insert_and_rebalance(__insert_left, __z, __p,  \n\t\t\t\t    this->_M_impl._M_header);\n      ++_M_impl._M_node_count;\n      return iterator(__z);\n    }\n\n  template<typename _Key, typename _Val, typename _KeyOfValue,\n           typename _Compare, typename _Alloc>\n    typename _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::iterator\n    _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::\n    _M_insert_lower(_Base_ptr __x, _Base_ptr __p, const _Val& __v)\n    {\n      bool __insert_left = (__x != 0 || __p == _M_end()\n\t\t\t    || !_M_impl._M_key_compare(_S_key(__p),\n\t\t\t\t\t\t       _KeyOfValue()(__v)));\n\n      _Link_type __z = _M_create_node(__v);\n\n      _Rb_tree_insert_and_rebalance(__insert_left, __z, __p,  \n\t\t\t\t    this->_M_impl._M_header);\n      ++_M_impl._M_node_count;\n      return iterator(__z);\n    }\n\n  template<typename _Key, typename _Val, typename _KeyOfValue,\n           typename _Compare, typename _Alloc>\n    typename _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::const_iterator\n    _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::\n    _M_insert(_Const_Base_ptr __x, _Const_Base_ptr __p, const _Val& __v)\n    {\n      bool __insert_left = (__x != 0 || __p == _M_end()\n\t\t\t    || _M_impl._M_key_compare(_KeyOfValue()(__v), \n\t\t\t\t\t\t      _S_key(__p)));\n\n      _Link_type __z = _M_create_node(__v);\n\n      _Rb_tree_insert_and_rebalance(__insert_left, __z,\n\t\t\t\t    const_cast<_Base_ptr>(__p),  \n\t\t\t\t    this->_M_impl._M_header);\n      ++_M_impl._M_node_count;\n      return const_iterator(__z);\n    }\n\n  template<typename _Key, typename _Val, typename _KeyOfValue,\n           typename _Compare, typename _Alloc>\n    typename _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::iterator\n    _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::\n    _M_insert_equal(const _Val& __v)\n    {\n      _Link_type __x = _M_begin();\n      _Link_type __y = _M_end();\n      while (__x != 0)\n\t{\n\t  __y = __x;\n\t  __x = _M_impl._M_key_compare(_KeyOfValue()(__v), _S_key(__x)) ?\n\t        _S_left(__x) : _S_right(__x);\n\t}\n      return _M_insert(__x, __y, __v);\n    }\n\n  template<typename _Key, typename _Val, typename _KeyOfValue,\n           typename _Compare, typename _Alloc>\n    typename _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::iterator\n    _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::\n    _M_insert_equal_lower(const _Val& __v)\n    {\n      _Link_type __x = _M_begin();\n      _Link_type __y = _M_end();\n      while (__x != 0)\n\t{\n\t  __y = __x;\n\t  __x = !_M_impl._M_key_compare(_S_key(__x), _KeyOfValue()(__v)) ?\n\t        _S_left(__x) : _S_right(__x);\n\t}\n      return _M_insert_lower(__x, __y, __v);\n    }\n\n  template<typename _Key, typename _Val, typename _KeyOfValue,\n           typename _Compare, typename _Alloc>\n    void\n    _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::\n    swap(_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>& __t)\n    {\n      if (_M_root() == 0)\n\t{\n\t  if (__t._M_root() != 0)\n\t    {\n\t      _M_root() = __t._M_root();\n\t      _M_leftmost() = __t._M_leftmost();\n\t      _M_rightmost() = __t._M_rightmost();\n\t      _M_root()->_M_parent = _M_end();\n\t      \n\t      __t._M_root() = 0;\n\t      __t._M_leftmost() = __t._M_end();\n\t      __t._M_rightmost() = __t._M_end();\n\t    }\n\t}\n      else if (__t._M_root() == 0)\n\t{\n\t  __t._M_root() = _M_root();\n\t  __t._M_leftmost() = _M_leftmost();\n\t  __t._M_rightmost() = _M_rightmost();\n\t  __t._M_root()->_M_parent = __t._M_end();\n\t  \n\t  _M_root() = 0;\n\t  _M_leftmost() = _M_end();\n\t  _M_rightmost() = _M_end();\n\t}\n      else\n\t{\n\t  std::swap(_M_root(),__t._M_root());\n\t  std::swap(_M_leftmost(),__t._M_leftmost());\n\t  std::swap(_M_rightmost(),__t._M_rightmost());\n\t  \n\t  _M_root()->_M_parent = _M_end();\n\t  __t._M_root()->_M_parent = __t._M_end();\n\t}\n      // No need to swap header's color as it does not change.\n      std::swap(this->_M_impl._M_node_count, __t._M_impl._M_node_count);\n      std::swap(this->_M_impl._M_key_compare, __t._M_impl._M_key_compare);\n      \n      // _GLIBCXX_RESOLVE_LIB_DEFECTS\n      // 431. Swapping containers with unequal allocators.\n      std::__alloc_swap<_Node_allocator>::\n\t_S_do_it(_M_get_Node_allocator(), __t._M_get_Node_allocator());\n    }\n\n  template<typename _Key, typename _Val, typename _KeyOfValue,\n           typename _Compare, typename _Alloc>\n    pair<typename _Rb_tree<_Key, _Val, _KeyOfValue,\n\t\t\t   _Compare, _Alloc>::iterator, bool>\n    _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::\n    _M_insert_unique(const _Val& __v)\n    {\n      _Link_type __x = _M_begin();\n      _Link_type __y = _M_end();\n      bool __comp = true;\n      while (__x != 0)\n\t{\n\t  __y = __x;\n\t  __comp = _M_impl._M_key_compare(_KeyOfValue()(__v), _S_key(__x));\n\t  __x = __comp ? _S_left(__x) : _S_right(__x);\n\t}\n      iterator __j = iterator(__y);\n      if (__comp)\n\tif (__j == begin())\n\t  return pair<iterator,bool>(_M_insert(__x, __y, __v), true);\n\telse\n\t  --__j;\n      if (_M_impl._M_key_compare(_S_key(__j._M_node), _KeyOfValue()(__v)))\n\treturn pair<iterator, bool>(_M_insert(__x, __y, __v), true);\n      return pair<iterator, bool>(__j, false);\n    }\n\n  template<typename _Key, typename _Val, typename _KeyOfValue,\n           typename _Compare, typename _Alloc>\n    typename _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::iterator\n    _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::\n    _M_insert_unique(iterator __position, const _Val& __v)\n    {\n      // end()\n      if (__position._M_node == _M_end())\n\t{\n\t  if (size() > 0\n\t      && _M_impl._M_key_compare(_S_key(_M_rightmost()), \n\t\t\t\t\t_KeyOfValue()(__v)))\n\t    return _M_insert(0, _M_rightmost(), __v);\n\t  else\n\t    return _M_insert_unique(__v).first;\n\t}\n      else if (_M_impl._M_key_compare(_KeyOfValue()(__v),\n\t\t\t\t      _S_key(__position._M_node)))\n\t{\n\t  // First, try before...\n\t  iterator __before = __position;\n\t  if (__position._M_node == _M_leftmost()) // begin()\n\t    return _M_insert(_M_leftmost(), _M_leftmost(), __v);\n\t  else if (_M_impl._M_key_compare(_S_key((--__before)._M_node), \n\t\t\t\t\t  _KeyOfValue()(__v)))\n\t    {\n\t      if (_S_right(__before._M_node) == 0)\n\t\treturn _M_insert(0, __before._M_node, __v);\n\t      else\n\t\treturn _M_insert(__position._M_node,\n\t\t\t\t __position._M_node, __v);\n\t    }\n\t  else\n\t    return _M_insert_unique(__v).first;\n\t}\n      else if (_M_impl._M_key_compare(_S_key(__position._M_node),\n\t\t\t\t      _KeyOfValue()(__v)))\n\t{\n\t  // ... then try after.\n\t  iterator __after = __position;\n\t  if (__position._M_node == _M_rightmost())\n\t    return _M_insert(0, _M_rightmost(), __v);\n\t  else if (_M_impl._M_key_compare(_KeyOfValue()(__v),\n\t\t\t\t\t  _S_key((++__after)._M_node)))\n\t    {\n\t      if (_S_right(__position._M_node) == 0)\n\t\treturn _M_insert(0, __position._M_node, __v);\n\t      else\n\t\treturn _M_insert(__after._M_node, __after._M_node, __v);\n\t    }\n\t  else\n\t    return _M_insert_unique(__v).first;\n\t}\n      else\n\treturn __position; // Equivalent keys.\n    }\n\n  template<typename _Key, typename _Val, typename _KeyOfValue,\n           typename _Compare, typename _Alloc>\n    typename _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::const_iterator\n    _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::\n    _M_insert_unique(const_iterator __position, const _Val& __v)\n    {\n      // end()\n      if (__position._M_node == _M_end())\n\t{\n\t  if (size() > 0\n\t      && _M_impl._M_key_compare(_S_key(_M_rightmost()), \n\t\t\t\t\t_KeyOfValue()(__v)))\n\t    return _M_insert(0, _M_rightmost(), __v);\n\t  else\n\t    return const_iterator(_M_insert_unique(__v).first);\n\t}\n      else if (_M_impl._M_key_compare(_KeyOfValue()(__v),\n\t\t\t\t      _S_key(__position._M_node)))\n\t{\n\t  // First, try before...\n\t  const_iterator __before = __position;\n\t  if (__position._M_node == _M_leftmost()) // begin()\n\t    return _M_insert(_M_leftmost(), _M_leftmost(), __v);\n\t  else if (_M_impl._M_key_compare(_S_key((--__before)._M_node), \n\t\t\t\t\t  _KeyOfValue()(__v)))\n\t    {\n\t      if (_S_right(__before._M_node) == 0)\n\t\treturn _M_insert(0, __before._M_node, __v);\n\t      else\n\t\treturn _M_insert(__position._M_node,\n\t\t\t\t __position._M_node, __v);\n\t    }\n\t  else\n\t    return const_iterator(_M_insert_unique(__v).first);\n\t}\n      else if (_M_impl._M_key_compare(_S_key(__position._M_node),\n\t\t\t\t      _KeyOfValue()(__v)))\n\t{\n\t  // ... then try after.\n\t  const_iterator __after = __position;\n\t  if (__position._M_node == _M_rightmost())\n\t    return _M_insert(0, _M_rightmost(), __v);\n\t  else if (_M_impl._M_key_compare(_KeyOfValue()(__v),\n\t\t\t\t\t  _S_key((++__after)._M_node)))\n\t    {\n\t      if (_S_right(__position._M_node) == 0)\n\t\treturn _M_insert(0, __position._M_node, __v);\n\t      else\n\t\treturn _M_insert(__after._M_node, __after._M_node, __v);\n\t    }\n\t  else\n\t    return const_iterator(_M_insert_unique(__v).first);\n\t}\n      else\n\treturn __position; // Equivalent keys.\n    }\n\n  template<typename _Key, typename _Val, typename _KeyOfValue,\n           typename _Compare, typename _Alloc>\n    typename _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::iterator\n    _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::\n    _M_insert_equal(iterator __position, const _Val& __v)\n    {\n      // end()\n      if (__position._M_node == _M_end())\n\t{\n\t  if (size() > 0\n\t      && !_M_impl._M_key_compare(_KeyOfValue()(__v),\n\t\t\t\t\t _S_key(_M_rightmost())))\n\t    return _M_insert(0, _M_rightmost(), __v);\n\t  else\n\t    return _M_insert_equal(__v);\n\t}\n      else if (!_M_impl._M_key_compare(_S_key(__position._M_node),\n\t\t\t\t       _KeyOfValue()(__v)))\n\t{\n\t  // First, try before...\n\t  iterator __before = __position;\n\t  if (__position._M_node == _M_leftmost()) // begin()\n\t    return _M_insert(_M_leftmost(), _M_leftmost(), __v);\n\t  else if (!_M_impl._M_key_compare(_KeyOfValue()(__v),\n\t\t\t\t\t   _S_key((--__before)._M_node)))\n\t    {\n\t      if (_S_right(__before._M_node) == 0)\n\t\treturn _M_insert(0, __before._M_node, __v);\n\t      else\n\t\treturn _M_insert(__position._M_node,\n\t\t\t\t __position._M_node, __v);\n\t    }\n\t  else\n\t    return _M_insert_equal(__v);\n\t}\n      else\n\t{\n\t  // ... then try after.  \n\t  iterator __after = __position;\n\t  if (__position._M_node == _M_rightmost())\n\t    return _M_insert(0, _M_rightmost(), __v);\n\t  else if (!_M_impl._M_key_compare(_S_key((++__after)._M_node),\n\t\t\t\t\t   _KeyOfValue()(__v)))\n\t    {\n\t      if (_S_right(__position._M_node) == 0)\n\t\treturn _M_insert(0, __position._M_node, __v);\n\t      else\n\t\treturn _M_insert(__after._M_node, __after._M_node, __v);\n\t    }\n\t  else\n\t    return _M_insert_equal_lower(__v);\n\t}\n    }\n\n  template<typename _Key, typename _Val, typename _KeyOfValue,\n           typename _Compare, typename _Alloc>\n    typename _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::const_iterator\n    _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::\n    _M_insert_equal(const_iterator __position, const _Val& __v)\n    {\n      // end()\n      if (__position._M_node == _M_end())\n\t{\n\t  if (size() > 0\n\t      && !_M_impl._M_key_compare(_KeyOfValue()(__v),\n\t\t\t\t\t _S_key(_M_rightmost())))\n\t    return _M_insert(0, _M_rightmost(), __v);\n\t  else\n\t    return const_iterator(_M_insert_equal(__v));\n\t}\n      else if (!_M_impl._M_key_compare(_S_key(__position._M_node),\n\t\t\t\t       _KeyOfValue()(__v)))\n\t{\n\t  // First, try before...\n\t  const_iterator __before = __position;\n\t  if (__position._M_node == _M_leftmost()) // begin()\n\t    return _M_insert(_M_leftmost(), _M_leftmost(), __v);\n\t  else if (!_M_impl._M_key_compare(_KeyOfValue()(__v),\n\t\t\t\t\t   _S_key((--__before)._M_node)))\n\t    {\n\t      if (_S_right(__before._M_node) == 0)\n\t\treturn _M_insert(0, __before._M_node, __v);\n\t      else\n\t\treturn _M_insert(__position._M_node,\n\t\t\t\t __position._M_node, __v);\n\t    }\n\t  else\n\t    return const_iterator(_M_insert_equal(__v));\n\t}\n      else\n\t{\n\t  // ... then try after.  \n\t  const_iterator __after = __position;\n\t  if (__position._M_node == _M_rightmost())\n\t    return _M_insert(0, _M_rightmost(), __v);\n\t  else if (!_M_impl._M_key_compare(_S_key((++__after)._M_node),\n\t\t\t\t\t   _KeyOfValue()(__v)))\n\t    {\n\t      if (_S_right(__position._M_node) == 0)\n\t\treturn _M_insert(0, __position._M_node, __v);\n\t      else\n\t\treturn _M_insert(__after._M_node, __after._M_node, __v);\n\t    }\n\t  else\n\t    return const_iterator(_M_insert_equal_lower(__v));\n\t}\n    }\n\n  template<typename _Key, typename _Val, typename _KoV,\n           typename _Cmp, typename _Alloc>\n    template<class _II>\n      void\n      _Rb_tree<_Key, _Val, _KoV, _Cmp, _Alloc>::\n      _M_insert_equal(_II __first, _II __last)\n      {\n\tfor (; __first != __last; ++__first)\n\t  _M_insert_equal(end(), *__first);\n      }\n\n  template<typename _Key, typename _Val, typename _KoV,\n           typename _Cmp, typename _Alloc>\n    template<class _II>\n      void\n      _Rb_tree<_Key, _Val, _KoV, _Cmp, _Alloc>::\n      _M_insert_unique(_II __first, _II __last)\n      {\n\tfor (; __first != __last; ++__first)\n\t  _M_insert_unique(end(), *__first);\n      }\n\n  template<typename _Key, typename _Val, typename _KeyOfValue,\n           typename _Compare, typename _Alloc>\n    inline void\n    _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::\n    erase(iterator __position)\n    {\n      _Link_type __y =\n\tstatic_cast<_Link_type>(_Rb_tree_rebalance_for_erase\n\t\t\t\t(__position._M_node,\n\t\t\t\t this->_M_impl._M_header));\n      _M_destroy_node(__y);\n      --_M_impl._M_node_count;\n    }\n\n  template<typename _Key, typename _Val, typename _KeyOfValue,\n           typename _Compare, typename _Alloc>\n    inline void\n    _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::\n    erase(const_iterator __position)\n    {\n      _Link_type __y =\n\tstatic_cast<_Link_type>(_Rb_tree_rebalance_for_erase\n\t\t\t\t(const_cast<_Base_ptr>(__position._M_node),\n\t\t\t\t this->_M_impl._M_header));\n      _M_destroy_node(__y);\n      --_M_impl._M_node_count;\n    }\n\n  template<typename _Key, typename _Val, typename _KeyOfValue,\n           typename _Compare, typename _Alloc>\n    typename _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::size_type\n    _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::\n    erase(const _Key& __x)\n    {\n      pair<iterator, iterator> __p = equal_range(__x);\n      const size_type __old_size = size();\n      erase(__p.first, __p.second);\n      return __old_size - size();\n    }\n\n  template<typename _Key, typename _Val, typename _KoV,\n           typename _Compare, typename _Alloc>\n    typename _Rb_tree<_Key, _Val, _KoV, _Compare, _Alloc>::_Link_type\n    _Rb_tree<_Key, _Val, _KoV, _Compare, _Alloc>::\n    _M_copy(_Const_Link_type __x, _Link_type __p)\n    {\n      // Structural copy.  __x and __p must be non-null.\n      _Link_type __top = _M_clone_node(__x);\n      __top->_M_parent = __p;\n\n      try\n\t{\n\t  if (__x->_M_right)\n\t    __top->_M_right = _M_copy(_S_right(__x), __top);\n\t  __p = __top;\n\t  __x = _S_left(__x);\n\n\t  while (__x != 0)\n\t    {\n\t      _Link_type __y = _M_clone_node(__x);\n\t      __p->_M_left = __y;\n\t      __y->_M_parent = __p;\n\t      if (__x->_M_right)\n\t\t__y->_M_right = _M_copy(_S_right(__x), __y);\n\t      __p = __y;\n\t      __x = _S_left(__x);\n\t    }\n\t}\n      catch(...)\n\t{\n\t  _M_erase(__top);\n\t  __throw_exception_again;\n\t}\n      return __top;\n    }\n\n  template<typename _Key, typename _Val, typename _KeyOfValue,\n           typename _Compare, typename _Alloc>\n    void\n    _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::\n    _M_erase(_Link_type __x)\n    {\n      // Erase without rebalancing.\n      while (__x != 0)\n\t{\n\t  _M_erase(_S_right(__x));\n\t  _Link_type __y = _S_left(__x);\n\t  _M_destroy_node(__x);\n\t  __x = __y;\n\t}\n    }\n\n  template<typename _Key, typename _Val, typename _KeyOfValue,\n           typename _Compare, typename _Alloc>\n    void\n    _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::\n    erase(iterator __first, iterator __last)\n    {\n      if (__first == begin() && __last == end())\n\tclear();\n      else\n\twhile (__first != __last)\n\t  erase(__first++);\n    }\n\n  template<typename _Key, typename _Val, typename _KeyOfValue,\n           typename _Compare, typename _Alloc>\n    void\n    _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::\n    erase(const_iterator __first, const_iterator __last)\n    {\n      if (__first == begin() && __last == end())\n\tclear();\n      else\n\twhile (__first != __last)\n\t  erase(__first++);\n    }\n\n  template<typename _Key, typename _Val, typename _KeyOfValue,\n           typename _Compare, typename _Alloc>\n    void\n    _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::\n    erase(const _Key* __first, const _Key* __last)\n    {\n      while (__first != __last)\n\terase(*__first++);\n    }\n\n  template<typename _Key, typename _Val, typename _KeyOfValue,\n           typename _Compare, typename _Alloc>\n    typename _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::iterator\n    _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::\n    find(const _Key& __k)\n    {\n      _Link_type __x = _M_begin(); // Current node.\n      _Link_type __y = _M_end(); // Last node which is not less than __k.\n\n      while (__x != 0)\n\tif (!_M_impl._M_key_compare(_S_key(__x), __k))\n\t  __y = __x, __x = _S_left(__x);\n\telse\n\t  __x = _S_right(__x);\n\n      iterator __j = iterator(__y);\n      return (__j == end()\n\t      || _M_impl._M_key_compare(__k,\n\t\t\t\t\t_S_key(__j._M_node))) ? end() : __j;\n    }\n\n  template<typename _Key, typename _Val, typename _KeyOfValue,\n           typename _Compare, typename _Alloc>\n    typename _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::const_iterator\n    _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::\n    find(const _Key& __k) const\n    {\n      _Const_Link_type __x = _M_begin(); // Current node.\n      _Const_Link_type __y = _M_end(); // Last node which is not less than __k.\n\n     while (__x != 0)\n       {\n\t if (!_M_impl._M_key_compare(_S_key(__x), __k))\n\t   __y = __x, __x = _S_left(__x);\n\t else\n\t   __x = _S_right(__x);\n       }\n     const_iterator __j = const_iterator(__y);\n     return (__j == end()\n\t     || _M_impl._M_key_compare(__k, \n\t\t\t\t       _S_key(__j._M_node))) ? end() : __j;\n    }\n\n  template<typename _Key, typename _Val, typename _KeyOfValue,\n           typename _Compare, typename _Alloc>\n    typename _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::size_type\n    _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::\n    count(const _Key& __k) const\n    {\n      pair<const_iterator, const_iterator> __p = equal_range(__k);\n      const size_type __n = std::distance(__p.first, __p.second);\n      return __n;\n    }\n\n  template<typename _Key, typename _Val, typename _KeyOfValue,\n           typename _Compare, typename _Alloc>\n    typename _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::iterator\n    _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::\n    lower_bound(const _Key& __k)\n    {\n      _Link_type __x = _M_begin(); // Current node.\n      _Link_type __y = _M_end(); // Last node which is not less than __k.\n\n      while (__x != 0)\n\tif (!_M_impl._M_key_compare(_S_key(__x), __k))\n\t  __y = __x, __x = _S_left(__x);\n\telse\n\t  __x = _S_right(__x);\n\n      return iterator(__y);\n    }\n\n  template<typename _Key, typename _Val, typename _KeyOfValue,\n           typename _Compare, typename _Alloc>\n    typename _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::const_iterator\n    _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::\n    lower_bound(const _Key& __k) const\n    {\n      _Const_Link_type __x = _M_begin(); // Current node.\n      _Const_Link_type __y = _M_end(); // Last node which is not less than __k.\n\n      while (__x != 0)\n\tif (!_M_impl._M_key_compare(_S_key(__x), __k))\n\t  __y = __x, __x = _S_left(__x);\n\telse\n\t  __x = _S_right(__x);\n\n      return const_iterator(__y);\n    }\n\n  template<typename _Key, typename _Val, typename _KeyOfValue,\n           typename _Compare, typename _Alloc>\n    typename _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::iterator\n    _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::\n    upper_bound(const _Key& __k)\n    {\n      _Link_type __x = _M_begin(); // Current node.\n      _Link_type __y = _M_end(); // Last node which is greater than __k.\n\n      while (__x != 0)\n\tif (_M_impl._M_key_compare(__k, _S_key(__x)))\n\t  __y = __x, __x = _S_left(__x);\n\telse\n\t  __x = _S_right(__x);\n\n      return iterator(__y);\n    }\n\n  template<typename _Key, typename _Val, typename _KeyOfValue,\n           typename _Compare, typename _Alloc>\n    typename _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::const_iterator\n    _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::\n    upper_bound(const _Key& __k) const\n    {\n      _Const_Link_type __x = _M_begin(); // Current node.\n      _Const_Link_type __y = _M_end(); // Last node which is greater than __k.\n\n      while (__x != 0)\n\tif (_M_impl._M_key_compare(__k, _S_key(__x)))\n\t  __y = __x, __x = _S_left(__x);\n\telse\n\t  __x = _S_right(__x);\n\n      return const_iterator(__y);\n    }\n\n  template<typename _Key, typename _Val, typename _KeyOfValue,\n           typename _Compare, typename _Alloc>\n    inline\n    pair<typename _Rb_tree<_Key, _Val, _KeyOfValue,\n\t\t\t   _Compare, _Alloc>::iterator,\n\t typename _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::iterator>\n    _Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::\n    equal_range(const _Key& __k)\n    { return pair<iterator, iterator>(lower_bound(__k), upper_bound(__k)); }\n\n  template<typename _Key, typename _Val, typename _KoV,\n           typename _Compare, typename _Alloc>\n    inline\n    pair<typename _Rb_tree<_Key, _Val, _KoV,\n\t\t\t   _Compare, _Alloc>::const_iterator,\n\t typename _Rb_tree<_Key, _Val, _KoV, _Compare, _Alloc>::const_iterator>\n    _Rb_tree<_Key, _Val, _KoV, _Compare, _Alloc>::\n    equal_range(const _Key& __k) const\n    { return pair<const_iterator, const_iterator>(lower_bound(__k),\n\t\t\t\t\t\t  upper_bound(__k)); }\n\n  unsigned int\n  _Rb_tree_black_count(const _Rb_tree_node_base* __node,\n                       const _Rb_tree_node_base* __root);\n\n  template<typename _Key, typename _Val, typename _KeyOfValue,\n           typename _Compare, typename _Alloc>\n    bool\n    _Rb_tree<_Key,_Val,_KeyOfValue,_Compare,_Alloc>::__rb_verify() const\n    {\n      if (_M_impl._M_node_count == 0 || begin() == end())\n\treturn _M_impl._M_node_count == 0 && begin() == end()\n\t       && this->_M_impl._M_header._M_left == _M_end()\n\t       && this->_M_impl._M_header._M_right == _M_end();\n\n      unsigned int __len = _Rb_tree_black_count(_M_leftmost(), _M_root());\n      for (const_iterator __it = begin(); __it != end(); ++__it)\n\t{\n\t  _Const_Link_type __x = static_cast<_Const_Link_type>(__it._M_node);\n\t  _Const_Link_type __L = _S_left(__x);\n\t  _Const_Link_type __R = _S_right(__x);\n\n\t  if (__x->_M_color == _S_red)\n\t    if ((__L && __L->_M_color == _S_red)\n\t\t|| (__R && __R->_M_color == _S_red))\n\t      return false;\n\n\t  if (__L && _M_impl._M_key_compare(_S_key(__x), _S_key(__L)))\n\t    return false;\n\t  if (__R && _M_impl._M_key_compare(_S_key(__R), _S_key(__x)))\n\t    return false;\n\n\t  if (!__L && !__R && _Rb_tree_black_count(__x, _M_root()) != __len)\n\t    return false;\n\t}\n\n      if (_M_leftmost() != _Rb_tree_node_base::_S_minimum(_M_root()))\n\treturn false;\n      if (_M_rightmost() != _Rb_tree_node_base::_S_maximum(_M_root()))\n\treturn false;\n      return true;\n    }\n\n_GLIBCXX_END_NAMESPACE\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/bits/stl_uninitialized.h",
    "content": "// Raw memory manipulators -*- C++ -*-\n\n// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006\n// Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n/*\n *\n * Copyright (c) 1994\n * Hewlett-Packard Company\n *\n * Permission to use, copy, modify, distribute and sell this software\n * and its documentation for any purpose is hereby granted without fee,\n * provided that the above copyright notice appear in all copies and\n * that both that copyright notice and this permission notice appear\n * in supporting documentation.  Hewlett-Packard Company makes no\n * representations about the suitability of this software for any\n * purpose.  It is provided \"as is\" without express or implied warranty.\n *\n *\n * Copyright (c) 1996,1997\n * Silicon Graphics Computer Systems, Inc.\n *\n * Permission to use, copy, modify, distribute and sell this software\n * and its documentation for any purpose is hereby granted without fee,\n * provided that the above copyright notice appear in all copies and\n * that both that copyright notice and this permission notice appear\n * in supporting documentation.  Silicon Graphics makes no\n * representations about the suitability of this software for any\n * purpose.  It is provided \"as is\" without express or implied warranty.\n */\n\n/** @file stl_uninitialized.h\n *  This is an internal header file, included by other library headers.\n *  You should not attempt to use it directly.\n */\n\n#ifndef _STL_UNINITIALIZED_H\n#define _STL_UNINITIALIZED_H 1\n\n#include <cstring>\n\n_GLIBCXX_BEGIN_NAMESPACE(std)\n\n  // uninitialized_copy\n  template<typename _InputIterator, typename _ForwardIterator>\n    inline _ForwardIterator\n    __uninitialized_copy_aux(_InputIterator __first, _InputIterator __last,\n\t\t\t     _ForwardIterator __result,\n\t\t\t     __true_type)\n    { return std::copy(__first, __last, __result); }\n\n  template<typename _InputIterator, typename _ForwardIterator>\n    inline _ForwardIterator\n    __uninitialized_copy_aux(_InputIterator __first, _InputIterator __last,\n\t\t\t     _ForwardIterator __result,\n\t\t\t     __false_type)\n    {\n      _ForwardIterator __cur = __result;\n      try\n\t{\n\t  for (; __first != __last; ++__first, ++__cur)\n\t    std::_Construct(&*__cur, *__first);\n\t  return __cur;\n\t}\n      catch(...)\n\t{\n\t  std::_Destroy(__result, __cur);\n\t  __throw_exception_again;\n\t}\n    }\n\n  /**\n   *  @brief Copies the range [first,last) into result.\n   *  @param  first  An input iterator.\n   *  @param  last   An input iterator.\n   *  @param  result An output iterator.\n   *  @return   result + (first - last)\n   *\n   *  Like copy(), but does not require an initialized output range.\n  */\n  template<typename _InputIterator, typename _ForwardIterator>\n    inline _ForwardIterator\n    uninitialized_copy(_InputIterator __first, _InputIterator __last,\n\t\t       _ForwardIterator __result)\n    {\n      typedef typename iterator_traits<_ForwardIterator>::value_type _ValueType;\n      typedef typename std::__is_scalar<_ValueType>::__type _Is_POD;\n      return std::__uninitialized_copy_aux(__first, __last, __result,\n\t\t\t\t\t   _Is_POD());\n    }\n\n  inline char*\n  uninitialized_copy(const char* __first, const char* __last, char* __result)\n  {\n    std::memmove(__result, __first, __last - __first);\n    return __result + (__last - __first);\n  }\n\n  inline wchar_t*\n  uninitialized_copy(const wchar_t* __first, const wchar_t* __last,\n\t\t     wchar_t* __result)\n  {\n    std::memmove(__result, __first, sizeof(wchar_t) * (__last - __first));\n    return __result + (__last - __first);\n  }\n\n  // Valid if copy construction is equivalent to assignment, and if the\n  // destructor is trivial.\n  template<typename _ForwardIterator, typename _Tp>\n    inline void\n    __uninitialized_fill_aux(_ForwardIterator __first,\n\t\t\t     _ForwardIterator __last,\n\t\t\t     const _Tp& __x, __true_type)\n    { std::fill(__first, __last, __x); }\n\n  template<typename _ForwardIterator, typename _Tp>\n    void\n    __uninitialized_fill_aux(_ForwardIterator __first, _ForwardIterator __last,\n\t\t\t     const _Tp& __x, __false_type)\n    {\n      _ForwardIterator __cur = __first;\n      try\n\t{\n\t  for (; __cur != __last; ++__cur)\n\t    std::_Construct(&*__cur, __x);\n\t}\n      catch(...)\n\t{\n\t  std::_Destroy(__first, __cur);\n\t  __throw_exception_again;\n\t}\n    }\n\n  /**\n   *  @brief Copies the value x into the range [first,last).\n   *  @param  first  An input iterator.\n   *  @param  last   An input iterator.\n   *  @param  x      The source value.\n   *  @return   Nothing.\n   *\n   *  Like fill(), but does not require an initialized output range.\n  */\n  template<typename _ForwardIterator, typename _Tp>\n    inline void\n    uninitialized_fill(_ForwardIterator __first, _ForwardIterator __last,\n\t\t       const _Tp& __x)\n    {\n      typedef typename iterator_traits<_ForwardIterator>::value_type _ValueType;\n      typedef typename std::__is_scalar<_ValueType>::__type _Is_POD;\n      std::__uninitialized_fill_aux(__first, __last, __x, _Is_POD());\n    }\n\n  // Valid if copy construction is equivalent to assignment, and if the\n  //  destructor is trivial.\n  template<typename _ForwardIterator, typename _Size, typename _Tp>\n    inline void\n    __uninitialized_fill_n_aux(_ForwardIterator __first, _Size __n,\n\t\t\t       const _Tp& __x, __true_type)\n    { std::fill_n(__first, __n, __x); }\n\n  template<typename _ForwardIterator, typename _Size, typename _Tp>\n    void\n    __uninitialized_fill_n_aux(_ForwardIterator __first, _Size __n,\n\t\t\t       const _Tp& __x, __false_type)\n    {\n      _ForwardIterator __cur = __first;\n      try\n\t{\n\t  for (; __n > 0; --__n, ++__cur)\n\t    std::_Construct(&*__cur, __x);\n\t}\n      catch(...)\n\t{\n\t  std::_Destroy(__first, __cur);\n\t  __throw_exception_again;\n\t}\n    }\n\n  /**\n   *  @brief Copies the value x into the range [first,first+n).\n   *  @param  first  An input iterator.\n   *  @param  n      The number of copies to make.\n   *  @param  x      The source value.\n   *  @return   Nothing.\n   *\n   *  Like fill_n(), but does not require an initialized output range.\n  */\n  template<typename _ForwardIterator, typename _Size, typename _Tp>\n    inline void\n    uninitialized_fill_n(_ForwardIterator __first, _Size __n, const _Tp& __x)\n    {\n      typedef typename iterator_traits<_ForwardIterator>::value_type _ValueType;\n      typedef typename std::__is_scalar<_ValueType>::__type _Is_POD;\n      std::__uninitialized_fill_n_aux(__first, __n, __x, _Is_POD());\n    }\n\n  // Extensions: versions of uninitialized_copy, uninitialized_fill,\n  //  and uninitialized_fill_n that take an allocator parameter.\n  //  We dispatch back to the standard versions when we're given the\n  //  default allocator.  For nondefault allocators we do not use \n  //  any of the POD optimizations.\n\n  template<typename _InputIterator, typename _ForwardIterator,\n\t   typename _Allocator>\n    _ForwardIterator\n    __uninitialized_copy_a(_InputIterator __first, _InputIterator __last,\n\t\t\t   _ForwardIterator __result,\n\t\t\t   _Allocator __alloc)\n    {\n      _ForwardIterator __cur = __result;\n      try\n\t{\n\t  for (; __first != __last; ++__first, ++__cur)\n\t    __alloc.construct(&*__cur, *__first);\n\t  return __cur;\n\t}\n      catch(...)\n\t{\n\t  std::_Destroy(__result, __cur, __alloc);\n\t  __throw_exception_again;\n\t}\n    }\n\n  template<typename _InputIterator, typename _ForwardIterator, typename _Tp>\n    inline _ForwardIterator\n    __uninitialized_copy_a(_InputIterator __first, _InputIterator __last,\n\t\t\t   _ForwardIterator __result,\n\t\t\t   allocator<_Tp>)\n    { return std::uninitialized_copy(__first, __last, __result); }\n\n  template<typename _ForwardIterator, typename _Tp, typename _Allocator>\n    void\n    __uninitialized_fill_a(_ForwardIterator __first, _ForwardIterator __last,\n\t\t\t   const _Tp& __x, _Allocator __alloc)\n    {\n      _ForwardIterator __cur = __first;\n      try\n\t{\n\t  for (; __cur != __last; ++__cur)\n\t    __alloc.construct(&*__cur, __x);\n\t}\n      catch(...)\n\t{\n\t  std::_Destroy(__first, __cur, __alloc);\n\t  __throw_exception_again;\n\t}\n    }\n\n  template<typename _ForwardIterator, typename _Tp, typename _Tp2>\n    inline void\n    __uninitialized_fill_a(_ForwardIterator __first, _ForwardIterator __last,\n\t\t\t   const _Tp& __x, allocator<_Tp2>)\n    { std::uninitialized_fill(__first, __last, __x); }\n\n  template<typename _ForwardIterator, typename _Size, typename _Tp,\n\t   typename _Allocator>\n    void\n    __uninitialized_fill_n_a(_ForwardIterator __first, _Size __n, \n\t\t\t     const _Tp& __x,\n\t\t\t     _Allocator __alloc)\n    {\n      _ForwardIterator __cur = __first;\n      try\n\t{\n\t  for (; __n > 0; --__n, ++__cur)\n\t    __alloc.construct(&*__cur, __x);\n\t}\n      catch(...)\n\t{\n\t  std::_Destroy(__first, __cur, __alloc);\n\t  __throw_exception_again;\n\t}\n    }\n\n  template<typename _ForwardIterator, typename _Size, typename _Tp,\n\t   typename _Tp2>\n    inline void\n    __uninitialized_fill_n_a(_ForwardIterator __first, _Size __n, \n\t\t\t     const _Tp& __x,\n\t\t\t     allocator<_Tp2>)\n    { std::uninitialized_fill_n(__first, __n, __x); }\n\n\n  // Extensions: __uninitialized_copy_copy, __uninitialized_copy_fill,\n  // __uninitialized_fill_copy.  All of these algorithms take a user-\n  // supplied allocator, which is used for construction and destruction.\n\n  // __uninitialized_copy_copy\n  // Copies [first1, last1) into [result, result + (last1 - first1)), and\n  //  copies [first2, last2) into\n  //  [result, result + (last1 - first1) + (last2 - first2)).\n\n  template<typename _InputIterator1, typename _InputIterator2,\n\t   typename _ForwardIterator, typename _Allocator>\n    inline _ForwardIterator\n    __uninitialized_copy_copy(_InputIterator1 __first1,\n\t\t\t      _InputIterator1 __last1,\n\t\t\t      _InputIterator2 __first2,\n\t\t\t      _InputIterator2 __last2,\n\t\t\t      _ForwardIterator __result,\n\t\t\t      _Allocator __alloc)\n    {\n      _ForwardIterator __mid = std::__uninitialized_copy_a(__first1, __last1,\n\t\t\t\t\t\t\t   __result,\n\t\t\t\t\t\t\t   __alloc);\n      try\n\t{\n\t  return std::__uninitialized_copy_a(__first2, __last2, __mid, __alloc);\n\t}\n      catch(...)\n\t{\n\t  std::_Destroy(__result, __mid, __alloc);\n\t  __throw_exception_again;\n\t}\n    }\n\n  // __uninitialized_fill_copy\n  // Fills [result, mid) with x, and copies [first, last) into\n  //  [mid, mid + (last - first)).\n  template<typename _ForwardIterator, typename _Tp, typename _InputIterator,\n\t   typename _Allocator>\n    inline _ForwardIterator\n    __uninitialized_fill_copy(_ForwardIterator __result, _ForwardIterator __mid,\n\t\t\t      const _Tp& __x, _InputIterator __first,\n\t\t\t      _InputIterator __last,\n\t\t\t      _Allocator __alloc)\n    {\n      std::__uninitialized_fill_a(__result, __mid, __x, __alloc);\n      try\n\t{\n\t  return std::__uninitialized_copy_a(__first, __last, __mid, __alloc);\n\t}\n      catch(...)\n\t{\n\t  std::_Destroy(__result, __mid, __alloc);\n\t  __throw_exception_again;\n\t}\n    }\n\n  // __uninitialized_copy_fill\n  // Copies [first1, last1) into [first2, first2 + (last1 - first1)), and\n  //  fills [first2 + (last1 - first1), last2) with x.\n  template<typename _InputIterator, typename _ForwardIterator, typename _Tp,\n\t   typename _Allocator>\n    inline void\n    __uninitialized_copy_fill(_InputIterator __first1, _InputIterator __last1,\n\t\t\t      _ForwardIterator __first2,\n\t\t\t      _ForwardIterator __last2, const _Tp& __x,\n\t\t\t      _Allocator __alloc)\n    {\n      _ForwardIterator __mid2 = std::__uninitialized_copy_a(__first1, __last1,\n\t\t\t\t\t\t\t    __first2,\n\t\t\t\t\t\t\t    __alloc);\n      try\n\t{\n\t  std::__uninitialized_fill_a(__mid2, __last2, __x, __alloc);\n\t}\n      catch(...)\n\t{\n\t  std::_Destroy(__first2, __mid2, __alloc);\n\t  __throw_exception_again;\n\t}\n    }\n\n_GLIBCXX_END_NAMESPACE\n\n#endif /* _STL_UNINITIALIZED_H */\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/bits/stl_vector.h",
    "content": "// Vector implementation -*- C++ -*-\n\n// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006\n// Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n/*\n *\n * Copyright (c) 1994\n * Hewlett-Packard Company\n *\n * Permission to use, copy, modify, distribute and sell this software\n * and its documentation for any purpose is hereby granted without fee,\n * provided that the above copyright notice appear in all copies and\n * that both that copyright notice and this permission notice appear\n * in supporting documentation.  Hewlett-Packard Company makes no\n * representations about the suitability of this software for any\n * purpose.  It is provided \"as is\" without express or implied warranty.\n *\n *\n * Copyright (c) 1996\n * Silicon Graphics Computer Systems, Inc.\n *\n * Permission to use, copy, modify, distribute and sell this software\n * and its documentation for any purpose is hereby granted without fee,\n * provided that the above copyright notice appear in all copies and\n * that both that copyright notice and this permission notice appear\n * in supporting documentation.  Silicon Graphics makes no\n * representations about the suitability of this  software for any\n * purpose.  It is provided \"as is\" without express or implied warranty.\n */\n\n/** @file stl_vector.h\n *  This is an internal header file, included by other library headers.\n *  You should not attempt to use it directly.\n */\n\n#ifndef _VECTOR_H\n#define _VECTOR_H 1\n\n#include <bits/stl_iterator_base_funcs.h>\n#include <bits/functexcept.h>\n#include <bits/concept_check.h>\n\n_GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD)\n\n  /**\n   *  @if maint\n   *  See bits/stl_deque.h's _Deque_base for an explanation.\n   *  @endif\n  */\n  template<typename _Tp, typename _Alloc>\n    struct _Vector_base\n    {\n      typedef typename _Alloc::template rebind<_Tp>::other _Tp_alloc_type;\n\n      struct _Vector_impl \n      : public _Tp_alloc_type\n      {\n\t_Tp*           _M_start;\n\t_Tp*           _M_finish;\n\t_Tp*           _M_end_of_storage;\n\t_Vector_impl(_Tp_alloc_type const& __a)\n\t: _Tp_alloc_type(__a), _M_start(0), _M_finish(0), _M_end_of_storage(0)\n\t{ }\n      };\n      \n    public:\n      typedef _Alloc allocator_type;\n\n      _Tp_alloc_type&\n      _M_get_Tp_allocator()\n      { return *static_cast<_Tp_alloc_type*>(&this->_M_impl); }\n\n      const _Tp_alloc_type&\n      _M_get_Tp_allocator() const\n      { return *static_cast<const _Tp_alloc_type*>(&this->_M_impl); }\n\n      allocator_type\n      get_allocator() const\n      { return allocator_type(_M_get_Tp_allocator()); }\n\n      _Vector_base(const allocator_type& __a)\n      : _M_impl(__a)\n      { }\n\n      _Vector_base(size_t __n, const allocator_type& __a)\n      : _M_impl(__a)\n      {\n\tthis->_M_impl._M_start = this->_M_allocate(__n);\n\tthis->_M_impl._M_finish = this->_M_impl._M_start;\n\tthis->_M_impl._M_end_of_storage = this->_M_impl._M_start + __n;\n      }\n\n      ~_Vector_base()\n      { _M_deallocate(this->_M_impl._M_start, this->_M_impl._M_end_of_storage\n\t\t      - this->_M_impl._M_start); }\n\n    public:\n      _Vector_impl _M_impl;\n\n      _Tp*\n      _M_allocate(size_t __n)\n      { return _M_impl.allocate(__n); }\n\n      void\n      _M_deallocate(_Tp* __p, size_t __n)\n      {\n\tif (__p)\n\t  _M_impl.deallocate(__p, __n);\n      }\n    };\n\n\n  /**\n   *  @brief A standard container which offers fixed time access to\n   *  individual elements in any order.\n   *\n   *  @ingroup Containers\n   *  @ingroup Sequences\n   *\n   *  Meets the requirements of a <a href=\"tables.html#65\">container</a>, a\n   *  <a href=\"tables.html#66\">reversible container</a>, and a\n   *  <a href=\"tables.html#67\">sequence</a>, including the\n   *  <a href=\"tables.html#68\">optional sequence requirements</a> with the\n   *  %exception of @c push_front and @c pop_front.\n   *\n   *  In some terminology a %vector can be described as a dynamic\n   *  C-style array, it offers fast and efficient access to individual\n   *  elements in any order and saves the user from worrying about\n   *  memory and size allocation.  Subscripting ( @c [] ) access is\n   *  also provided as with C-style arrays.\n  */\n  template<typename _Tp, typename _Alloc = std::allocator<_Tp> >\n    class vector : protected _Vector_base<_Tp, _Alloc>\n    {\n      // Concept requirements.\n      typedef typename _Alloc::value_type                _Alloc_value_type;\n      __glibcxx_class_requires(_Tp, _SGIAssignableConcept)\n      __glibcxx_class_requires2(_Tp, _Alloc_value_type, _SameTypeConcept)\n      \n      typedef _Vector_base<_Tp, _Alloc>\t\t\t _Base;\n      typedef vector<_Tp, _Alloc>\t\t\t vector_type;\n      typedef typename _Base::_Tp_alloc_type\t\t _Tp_alloc_type;\n\n    public:\n      typedef _Tp\t\t\t\t\t value_type;\n      typedef typename _Tp_alloc_type::pointer           pointer;\n      typedef typename _Tp_alloc_type::const_pointer     const_pointer;\n      typedef typename _Tp_alloc_type::reference         reference;\n      typedef typename _Tp_alloc_type::const_reference   const_reference;\n      typedef __gnu_cxx::__normal_iterator<pointer, vector_type> iterator;\n      typedef __gnu_cxx::__normal_iterator<const_pointer, vector_type>\n      const_iterator;\n      typedef std::reverse_iterator<const_iterator>  const_reverse_iterator;\n      typedef std::reverse_iterator<iterator>\t\t reverse_iterator;\n      typedef size_t\t\t\t\t\t size_type;\n      typedef ptrdiff_t\t\t\t\t\t difference_type;\n      typedef _Alloc                        \t\t allocator_type;\n\n    protected:\n      using _Base::_M_allocate;\n      using _Base::_M_deallocate;\n      using _Base::_M_impl;\n      using _Base::_M_get_Tp_allocator;\n\n    public:\n      // [23.2.4.1] construct/copy/destroy\n      // (assign() and get_allocator() are also listed in this section)\n      /**\n       *  @brief  Default constructor creates no elements.\n       */\n      explicit\n      vector(const allocator_type& __a = allocator_type())\n      : _Base(__a)\n      { }\n\n      /**\n       *  @brief  Create a %vector with copies of an exemplar element.\n       *  @param  n  The number of elements to initially create.\n       *  @param  value  An element to copy.\n       *\n       *  This constructor fills the %vector with @a n copies of @a value.\n       */\n      explicit\n      vector(size_type __n, const value_type& __value = value_type(),\n\t     const allocator_type& __a = allocator_type())\n      : _Base(__n, __a)\n      {\n\tstd::__uninitialized_fill_n_a(this->_M_impl._M_start, __n, __value,\n\t\t\t\t      _M_get_Tp_allocator());\n\tthis->_M_impl._M_finish = this->_M_impl._M_start + __n;\n      }\n\n      /**\n       *  @brief  %Vector copy constructor.\n       *  @param  x  A %vector of identical element and allocator types.\n       *\n       *  The newly-created %vector uses a copy of the allocation\n       *  object used by @a x.  All the elements of @a x are copied,\n       *  but any extra memory in\n       *  @a x (for fast expansion) will not be copied.\n       */\n      vector(const vector& __x)\n      : _Base(__x.size(), __x._M_get_Tp_allocator())\n      { this->_M_impl._M_finish =\n\t  std::__uninitialized_copy_a(__x.begin(), __x.end(),\n\t\t\t\t      this->_M_impl._M_start,\n\t\t\t\t      _M_get_Tp_allocator());\n      }\n\n      /**\n       *  @brief  Builds a %vector from a range.\n       *  @param  first  An input iterator.\n       *  @param  last  An input iterator.\n       *\n       *  Create a %vector consisting of copies of the elements from\n       *  [first,last).\n       *\n       *  If the iterators are forward, bidirectional, or\n       *  random-access, then this will call the elements' copy\n       *  constructor N times (where N is distance(first,last)) and do\n       *  no memory reallocation.  But if only input iterators are\n       *  used, then this will do at most 2N calls to the copy\n       *  constructor, and logN memory reallocations.\n       */\n      template<typename _InputIterator>\n        vector(_InputIterator __first, _InputIterator __last,\n\t       const allocator_type& __a = allocator_type())\n\t: _Base(__a)\n        {\n\t  // Check whether it's an integral type.  If so, it's not an iterator.\n\t  typedef typename std::__is_integer<_InputIterator>::__type _Integral;\n\t  _M_initialize_dispatch(__first, __last, _Integral());\n\t}\n\n      /**\n       *  The dtor only erases the elements, and note that if the\n       *  elements themselves are pointers, the pointed-to memory is\n       *  not touched in any way.  Managing the pointer is the user's\n       *  responsibilty.\n       */\n      ~vector()\n      { std::_Destroy(this->_M_impl._M_start, this->_M_impl._M_finish,\n\t\t      _M_get_Tp_allocator()); }\n\n      /**\n       *  @brief  %Vector assignment operator.\n       *  @param  x  A %vector of identical element and allocator types.\n       *\n       *  All the elements of @a x are copied, but any extra memory in\n       *  @a x (for fast expansion) will not be copied.  Unlike the\n       *  copy constructor, the allocator object is not copied.\n       */\n      vector&\n      operator=(const vector& __x);\n\n      /**\n       *  @brief  Assigns a given value to a %vector.\n       *  @param  n  Number of elements to be assigned.\n       *  @param  val  Value to be assigned.\n       *\n       *  This function fills a %vector with @a n copies of the given\n       *  value.  Note that the assignment completely changes the\n       *  %vector and that the resulting %vector's size is the same as\n       *  the number of elements assigned.  Old data may be lost.\n       */\n      void\n      assign(size_type __n, const value_type& __val)\n      { _M_fill_assign(__n, __val); }\n\n      /**\n       *  @brief  Assigns a range to a %vector.\n       *  @param  first  An input iterator.\n       *  @param  last   An input iterator.\n       *\n       *  This function fills a %vector with copies of the elements in the\n       *  range [first,last).\n       *\n       *  Note that the assignment completely changes the %vector and\n       *  that the resulting %vector's size is the same as the number\n       *  of elements assigned.  Old data may be lost.\n       */\n      template<typename _InputIterator>\n        void\n        assign(_InputIterator __first, _InputIterator __last)\n        {\n\t  // Check whether it's an integral type.  If so, it's not an iterator.\n\t  typedef typename std::__is_integer<_InputIterator>::__type _Integral;\n\t  _M_assign_dispatch(__first, __last, _Integral());\n\t}\n\n      /// Get a copy of the memory allocation object.\n      using _Base::get_allocator;\n\n      // iterators\n      /**\n       *  Returns a read/write iterator that points to the first\n       *  element in the %vector.  Iteration is done in ordinary\n       *  element order.\n       */\n      iterator\n      begin()\n      { return iterator(this->_M_impl._M_start); }\n\n      /**\n       *  Returns a read-only (constant) iterator that points to the\n       *  first element in the %vector.  Iteration is done in ordinary\n       *  element order.\n       */\n      const_iterator\n      begin() const\n      { return const_iterator(this->_M_impl._M_start); }\n\n      /**\n       *  Returns a read/write iterator that points one past the last\n       *  element in the %vector.  Iteration is done in ordinary\n       *  element order.\n       */\n      iterator\n      end()\n      { return iterator(this->_M_impl._M_finish); }\n\n      /**\n       *  Returns a read-only (constant) iterator that points one past\n       *  the last element in the %vector.  Iteration is done in\n       *  ordinary element order.\n       */\n      const_iterator\n      end() const\n      { return const_iterator(this->_M_impl._M_finish); }\n\n      /**\n       *  Returns a read/write reverse iterator that points to the\n       *  last element in the %vector.  Iteration is done in reverse\n       *  element order.\n       */\n      reverse_iterator\n      rbegin()\n      { return reverse_iterator(end()); }\n\n      /**\n       *  Returns a read-only (constant) reverse iterator that points\n       *  to the last element in the %vector.  Iteration is done in\n       *  reverse element order.\n       */\n      const_reverse_iterator\n      rbegin() const\n      { return const_reverse_iterator(end()); }\n\n      /**\n       *  Returns a read/write reverse iterator that points to one\n       *  before the first element in the %vector.  Iteration is done\n       *  in reverse element order.\n       */\n      reverse_iterator\n      rend()\n      { return reverse_iterator(begin()); }\n\n      /**\n       *  Returns a read-only (constant) reverse iterator that points\n       *  to one before the first element in the %vector.  Iteration\n       *  is done in reverse element order.\n       */\n      const_reverse_iterator\n      rend() const\n      { return const_reverse_iterator(begin()); }\n\n      // [23.2.4.2] capacity\n      /**  Returns the number of elements in the %vector.  */\n      size_type\n      size() const\n      { return size_type(this->_M_impl._M_finish - this->_M_impl._M_start); }\n\n      /**  Returns the size() of the largest possible %vector.  */\n      size_type\n      max_size() const\n      { return _M_get_Tp_allocator().max_size(); }\n\n      /**\n       *  @brief  Resizes the %vector to the specified number of elements.\n       *  @param  new_size  Number of elements the %vector should contain.\n       *  @param  x  Data with which new elements should be populated.\n       *\n       *  This function will %resize the %vector to the specified\n       *  number of elements.  If the number is smaller than the\n       *  %vector's current size the %vector is truncated, otherwise\n       *  the %vector is extended and new elements are populated with\n       *  given data.\n       */\n      void\n      resize(size_type __new_size, value_type __x = value_type())\n      {\n\tif (__new_size < size())\n\t  _M_erase_at_end(this->_M_impl._M_start + __new_size);\n\telse\n\t  insert(end(), __new_size - size(), __x);\n      }\n\n      /**\n       *  Returns the total number of elements that the %vector can\n       *  hold before needing to allocate more memory.\n       */\n      size_type\n      capacity() const\n      { return size_type(this->_M_impl._M_end_of_storage\n\t\t\t - this->_M_impl._M_start); }\n\n      /**\n       *  Returns true if the %vector is empty.  (Thus begin() would\n       *  equal end().)\n       */\n      bool\n      empty() const\n      { return begin() == end(); }\n\n      /**\n       *  @brief  Attempt to preallocate enough memory for specified number of\n       *          elements.\n       *  @param  n  Number of elements required.\n       *  @throw  std::length_error  If @a n exceeds @c max_size().\n       *\n       *  This function attempts to reserve enough memory for the\n       *  %vector to hold the specified number of elements.  If the\n       *  number requested is more than max_size(), length_error is\n       *  thrown.\n       *\n       *  The advantage of this function is that if optimal code is a\n       *  necessity and the user can determine the number of elements\n       *  that will be required, the user can reserve the memory in\n       *  %advance, and thus prevent a possible reallocation of memory\n       *  and copying of %vector data.\n       */\n      void\n      reserve(size_type __n);\n\n      // element access\n      /**\n       *  @brief  Subscript access to the data contained in the %vector.\n       *  @param n The index of the element for which data should be\n       *  accessed.\n       *  @return  Read/write reference to data.\n       *\n       *  This operator allows for easy, array-style, data access.\n       *  Note that data access with this operator is unchecked and\n       *  out_of_range lookups are not defined. (For checked lookups\n       *  see at().)\n       */\n      reference\n      operator[](size_type __n)\n      { return *(this->_M_impl._M_start + __n); }\n\n      /**\n       *  @brief  Subscript access to the data contained in the %vector.\n       *  @param n The index of the element for which data should be\n       *  accessed.\n       *  @return  Read-only (constant) reference to data.\n       *\n       *  This operator allows for easy, array-style, data access.\n       *  Note that data access with this operator is unchecked and\n       *  out_of_range lookups are not defined. (For checked lookups\n       *  see at().)\n       */\n      const_reference\n      operator[](size_type __n) const\n      { return *(this->_M_impl._M_start + __n); }\n\n    protected:\n      /// @if maint Safety check used only from at().  @endif\n      void\n      _M_range_check(size_type __n) const\n      {\n\tif (__n >= this->size())\n\t  __throw_out_of_range(__N(\"vector::_M_range_check\"));\n      }\n\n    public:\n      /**\n       *  @brief  Provides access to the data contained in the %vector.\n       *  @param n The index of the element for which data should be\n       *  accessed.\n       *  @return  Read/write reference to data.\n       *  @throw  std::out_of_range  If @a n is an invalid index.\n       *\n       *  This function provides for safer data access.  The parameter\n       *  is first checked that it is in the range of the vector.  The\n       *  function throws out_of_range if the check fails.\n       */\n      reference\n      at(size_type __n)\n      {\n\t_M_range_check(__n);\n\treturn (*this)[__n]; \n      }\n\n      /**\n       *  @brief  Provides access to the data contained in the %vector.\n       *  @param n The index of the element for which data should be\n       *  accessed.\n       *  @return  Read-only (constant) reference to data.\n       *  @throw  std::out_of_range  If @a n is an invalid index.\n       *\n       *  This function provides for safer data access.  The parameter\n       *  is first checked that it is in the range of the vector.  The\n       *  function throws out_of_range if the check fails.\n       */\n      const_reference\n      at(size_type __n) const\n      {\n\t_M_range_check(__n);\n\treturn (*this)[__n];\n      }\n\n      /**\n       *  Returns a read/write reference to the data at the first\n       *  element of the %vector.\n       */\n      reference\n      front()\n      { return *begin(); }\n\n      /**\n       *  Returns a read-only (constant) reference to the data at the first\n       *  element of the %vector.\n       */\n      const_reference\n      front() const\n      { return *begin(); }\n\n      /**\n       *  Returns a read/write reference to the data at the last\n       *  element of the %vector.\n       */\n      reference\n      back()\n      { return *(end() - 1); }\n      \n      /**\n       *  Returns a read-only (constant) reference to the data at the\n       *  last element of the %vector.\n       */\n      const_reference\n      back() const\n      { return *(end() - 1); }\n\n      // _GLIBCXX_RESOLVE_LIB_DEFECTS\n      // DR 464. Suggestion for new member functions in standard containers.\n      // data access\n      /**\n       *   Returns a pointer such that [data(), data() + size()) is a valid\n       *   range.  For a non-empty %vector, data() == &front().\n       */\n      pointer\n      data()\n      { return pointer(this->_M_impl._M_start); }\n\n      const_pointer\n      data() const\n      { return const_pointer(this->_M_impl._M_start); }\n\n      // [23.2.4.3] modifiers\n      /**\n       *  @brief  Add data to the end of the %vector.\n       *  @param  x  Data to be added.\n       *\n       *  This is a typical stack operation.  The function creates an\n       *  element at the end of the %vector and assigns the given data\n       *  to it.  Due to the nature of a %vector this operation can be\n       *  done in constant time if the %vector has preallocated space\n       *  available.\n       */\n      void\n      push_back(const value_type& __x)\n      {\n\tif (this->_M_impl._M_finish != this->_M_impl._M_end_of_storage)\n\t  {\n\t    this->_M_impl.construct(this->_M_impl._M_finish, __x);\n\t    ++this->_M_impl._M_finish;\n\t  }\n\telse\n\t  _M_insert_aux(end(), __x);\n      }\n\n      /**\n       *  @brief  Removes last element.\n       *\n       *  This is a typical stack operation. It shrinks the %vector by one.\n       *\n       *  Note that no data is returned, and if the last element's\n       *  data is needed, it should be retrieved before pop_back() is\n       *  called.\n       */\n      void\n      pop_back()\n      {\n\t--this->_M_impl._M_finish;\n\tthis->_M_impl.destroy(this->_M_impl._M_finish);\n      }\n\n      /**\n       *  @brief  Inserts given value into %vector before specified iterator.\n       *  @param  position  An iterator into the %vector.\n       *  @param  x  Data to be inserted.\n       *  @return  An iterator that points to the inserted data.\n       *\n       *  This function will insert a copy of the given value before\n       *  the specified location.  Note that this kind of operation\n       *  could be expensive for a %vector and if it is frequently\n       *  used the user should consider using std::list.\n       */\n      iterator\n      insert(iterator __position, const value_type& __x);\n\n      /**\n       *  @brief  Inserts a number of copies of given data into the %vector.\n       *  @param  position  An iterator into the %vector.\n       *  @param  n  Number of elements to be inserted.\n       *  @param  x  Data to be inserted.\n       *\n       *  This function will insert a specified number of copies of\n       *  the given data before the location specified by @a position.\n       *\n       *  Note that this kind of operation could be expensive for a\n       *  %vector and if it is frequently used the user should\n       *  consider using std::list.\n       */\n      void\n      insert(iterator __position, size_type __n, const value_type& __x)\n      { _M_fill_insert(__position, __n, __x); }\n\n      /**\n       *  @brief  Inserts a range into the %vector.\n       *  @param  position  An iterator into the %vector.\n       *  @param  first  An input iterator.\n       *  @param  last   An input iterator.\n       *\n       *  This function will insert copies of the data in the range\n       *  [first,last) into the %vector before the location specified\n       *  by @a pos.\n       *\n       *  Note that this kind of operation could be expensive for a\n       *  %vector and if it is frequently used the user should\n       *  consider using std::list.\n       */\n      template<typename _InputIterator>\n        void\n        insert(iterator __position, _InputIterator __first,\n\t       _InputIterator __last)\n        {\n\t  // Check whether it's an integral type.  If so, it's not an iterator.\n\t  typedef typename std::__is_integer<_InputIterator>::__type _Integral;\n\t  _M_insert_dispatch(__position, __first, __last, _Integral());\n\t}\n\n      /**\n       *  @brief  Remove element at given position.\n       *  @param  position  Iterator pointing to element to be erased.\n       *  @return  An iterator pointing to the next element (or end()).\n       *\n       *  This function will erase the element at the given position and thus\n       *  shorten the %vector by one.\n       *\n       *  Note This operation could be expensive and if it is\n       *  frequently used the user should consider using std::list.\n       *  The user is also cautioned that this function only erases\n       *  the element, and that if the element is itself a pointer,\n       *  the pointed-to memory is not touched in any way.  Managing\n       *  the pointer is the user's responsibilty.\n       */\n      iterator\n      erase(iterator __position);\n\n      /**\n       *  @brief  Remove a range of elements.\n       *  @param  first  Iterator pointing to the first element to be erased.\n       *  @param  last  Iterator pointing to one past the last element to be\n       *                erased.\n       *  @return  An iterator pointing to the element pointed to by @a last\n       *           prior to erasing (or end()).\n       *\n       *  This function will erase the elements in the range [first,last) and\n       *  shorten the %vector accordingly.\n       *\n       *  Note This operation could be expensive and if it is\n       *  frequently used the user should consider using std::list.\n       *  The user is also cautioned that this function only erases\n       *  the elements, and that if the elements themselves are\n       *  pointers, the pointed-to memory is not touched in any way.\n       *  Managing the pointer is the user's responsibilty.\n       */\n      iterator\n      erase(iterator __first, iterator __last);\n\n      /**\n       *  @brief  Swaps data with another %vector.\n       *  @param  x  A %vector of the same element and allocator types.\n       *\n       *  This exchanges the elements between two vectors in constant time.\n       *  (Three pointers, so it should be quite fast.)\n       *  Note that the global std::swap() function is specialized such that\n       *  std::swap(v1,v2) will feed to this function.\n       */\n      void\n      swap(vector& __x)\n      {\n\tstd::swap(this->_M_impl._M_start, __x._M_impl._M_start);\n\tstd::swap(this->_M_impl._M_finish, __x._M_impl._M_finish);\n\tstd::swap(this->_M_impl._M_end_of_storage,\n\t\t  __x._M_impl._M_end_of_storage);\n\n\t// _GLIBCXX_RESOLVE_LIB_DEFECTS\n\t// 431. Swapping containers with unequal allocators.\n\tstd::__alloc_swap<_Tp_alloc_type>::_S_do_it(_M_get_Tp_allocator(),\n\t\t\t\t\t\t    __x._M_get_Tp_allocator());\n      }\n\n      /**\n       *  Erases all the elements.  Note that this function only erases the\n       *  elements, and that if the elements themselves are pointers, the\n       *  pointed-to memory is not touched in any way.  Managing the pointer is\n       *  the user's responsibilty.\n       */\n      void\n      clear()\n      { _M_erase_at_end(this->_M_impl._M_start); }\n\n    protected:\n      /**\n       *  @if maint\n       *  Memory expansion handler.  Uses the member allocation function to\n       *  obtain @a n bytes of memory, and then copies [first,last) into it.\n       *  @endif\n       */\n      template<typename _ForwardIterator>\n        pointer\n        _M_allocate_and_copy(size_type __n,\n\t\t\t     _ForwardIterator __first, _ForwardIterator __last)\n        {\n\t  pointer __result = this->_M_allocate(__n);\n\t  try\n\t    {\n\t      std::__uninitialized_copy_a(__first, __last, __result,\n\t\t\t\t\t  _M_get_Tp_allocator());\n\t      return __result;\n\t    }\n\t  catch(...)\n\t    {\n\t      _M_deallocate(__result, __n);\n\t      __throw_exception_again;\n\t    }\n\t}\n\n\n      // Internal constructor functions follow.\n\n      // Called by the range constructor to implement [23.1.1]/9\n      template<typename _Integer>\n        void\n        _M_initialize_dispatch(_Integer __n, _Integer __value, __true_type)\n        {\n\t  this->_M_impl._M_start = _M_allocate(__n);\n\t  this->_M_impl._M_end_of_storage = this->_M_impl._M_start + __n;\n\t  std::__uninitialized_fill_n_a(this->_M_impl._M_start, __n, __value,\n\t\t\t\t\t_M_get_Tp_allocator());\n\t  this->_M_impl._M_finish = this->_M_impl._M_end_of_storage;\n\t}\n\n      // Called by the range constructor to implement [23.1.1]/9\n      template<typename _InputIterator>\n        void\n        _M_initialize_dispatch(_InputIterator __first, _InputIterator __last,\n\t\t\t       __false_type)\n        {\n\t  typedef typename std::iterator_traits<_InputIterator>::\n\t    iterator_category _IterCategory;\n\t  _M_range_initialize(__first, __last, _IterCategory());\n\t}\n\n      // Called by the second initialize_dispatch above\n      template<typename _InputIterator>\n        void\n        _M_range_initialize(_InputIterator __first,\n\t\t\t    _InputIterator __last, std::input_iterator_tag)\n        {\n\t  for (; __first != __last; ++__first)\n\t    push_back(*__first);\n\t}\n\n      // Called by the second initialize_dispatch above\n      template<typename _ForwardIterator>\n        void\n        _M_range_initialize(_ForwardIterator __first,\n\t\t\t    _ForwardIterator __last, std::forward_iterator_tag)\n        {\n\t  const size_type __n = std::distance(__first, __last);\n\t  this->_M_impl._M_start = this->_M_allocate(__n);\n\t  this->_M_impl._M_end_of_storage = this->_M_impl._M_start + __n;\n\t  this->_M_impl._M_finish =\n\t    std::__uninitialized_copy_a(__first, __last,\n\t\t\t\t\tthis->_M_impl._M_start,\n\t\t\t\t\t_M_get_Tp_allocator());\n\t}\n\n\n      // Internal assign functions follow.  The *_aux functions do the actual\n      // assignment work for the range versions.\n\n      // Called by the range assign to implement [23.1.1]/9\n      template<typename _Integer>\n        void\n        _M_assign_dispatch(_Integer __n, _Integer __val, __true_type)\n        {\n\t  _M_fill_assign(static_cast<size_type>(__n),\n\t\t\t static_cast<value_type>(__val));\n\t}\n\n      // Called by the range assign to implement [23.1.1]/9\n      template<typename _InputIterator>\n        void\n        _M_assign_dispatch(_InputIterator __first, _InputIterator __last,\n\t\t\t   __false_type)\n        {\n\t  typedef typename std::iterator_traits<_InputIterator>::\n\t    iterator_category _IterCategory;\n\t  _M_assign_aux(__first, __last, _IterCategory());\n\t}\n\n      // Called by the second assign_dispatch above\n      template<typename _InputIterator>\n        void\n        _M_assign_aux(_InputIterator __first, _InputIterator __last,\n\t\t      std::input_iterator_tag);\n\n      // Called by the second assign_dispatch above\n      template<typename _ForwardIterator>\n        void\n        _M_assign_aux(_ForwardIterator __first, _ForwardIterator __last,\n\t\t      std::forward_iterator_tag);\n\n      // Called by assign(n,t), and the range assign when it turns out\n      // to be the same thing.\n      void\n      _M_fill_assign(size_type __n, const value_type& __val);\n\n\n      // Internal insert functions follow.\n\n      // Called by the range insert to implement [23.1.1]/9\n      template<typename _Integer>\n        void\n        _M_insert_dispatch(iterator __pos, _Integer __n, _Integer __val,\n\t\t\t   __true_type)\n        {\n\t  _M_fill_insert(__pos, static_cast<size_type>(__n),\n\t\t\t static_cast<value_type>(__val));\n\t}\n\n      // Called by the range insert to implement [23.1.1]/9\n      template<typename _InputIterator>\n        void\n        _M_insert_dispatch(iterator __pos, _InputIterator __first,\n\t\t\t   _InputIterator __last, __false_type)\n        {\n\t  typedef typename std::iterator_traits<_InputIterator>::\n\t    iterator_category _IterCategory;\n\t  _M_range_insert(__pos, __first, __last, _IterCategory());\n\t}\n\n      // Called by the second insert_dispatch above\n      template<typename _InputIterator>\n        void\n        _M_range_insert(iterator __pos, _InputIterator __first,\n\t\t\t_InputIterator __last, std::input_iterator_tag);\n\n      // Called by the second insert_dispatch above\n      template<typename _ForwardIterator>\n        void\n        _M_range_insert(iterator __pos, _ForwardIterator __first,\n\t\t\t_ForwardIterator __last, std::forward_iterator_tag);\n\n      // Called by insert(p,n,x), and the range insert when it turns out to be\n      // the same thing.\n      void\n      _M_fill_insert(iterator __pos, size_type __n, const value_type& __x);\n\n      // Called by insert(p,x)\n      void\n      _M_insert_aux(iterator __position, const value_type& __x);\n\n      // Internal erase functions follow.\n\n      // Called by erase(q1,q2), clear(), resize(), _M_fill_assign,\n      // _M_assign_aux.\n      void\n      _M_erase_at_end(pointer __pos)\n      {\n\tstd::_Destroy(__pos, this->_M_impl._M_finish, _M_get_Tp_allocator());\n\tthis->_M_impl._M_finish = __pos;\n      }\n    };\n\n\n  /**\n   *  @brief  Vector equality comparison.\n   *  @param  x  A %vector.\n   *  @param  y  A %vector of the same type as @a x.\n   *  @return  True iff the size and elements of the vectors are equal.\n   *\n   *  This is an equivalence relation.  It is linear in the size of the\n   *  vectors.  Vectors are considered equivalent if their sizes are equal,\n   *  and if corresponding elements compare equal.\n  */\n  template<typename _Tp, typename _Alloc>\n    inline bool\n    operator==(const vector<_Tp, _Alloc>& __x, const vector<_Tp, _Alloc>& __y)\n    { return (__x.size() == __y.size()\n\t      && std::equal(__x.begin(), __x.end(), __y.begin())); }\n\n  /**\n   *  @brief  Vector ordering relation.\n   *  @param  x  A %vector.\n   *  @param  y  A %vector of the same type as @a x.\n   *  @return  True iff @a x is lexicographically less than @a y.\n   *\n   *  This is a total ordering relation.  It is linear in the size of the\n   *  vectors.  The elements must be comparable with @c <.\n   *\n   *  See std::lexicographical_compare() for how the determination is made.\n  */\n  template<typename _Tp, typename _Alloc>\n    inline bool\n    operator<(const vector<_Tp, _Alloc>& __x, const vector<_Tp, _Alloc>& __y)\n    { return std::lexicographical_compare(__x.begin(), __x.end(),\n\t\t\t\t\t  __y.begin(), __y.end()); }\n\n  /// Based on operator==\n  template<typename _Tp, typename _Alloc>\n    inline bool\n    operator!=(const vector<_Tp, _Alloc>& __x, const vector<_Tp, _Alloc>& __y)\n    { return !(__x == __y); }\n\n  /// Based on operator<\n  template<typename _Tp, typename _Alloc>\n    inline bool\n    operator>(const vector<_Tp, _Alloc>& __x, const vector<_Tp, _Alloc>& __y)\n    { return __y < __x; }\n\n  /// Based on operator<\n  template<typename _Tp, typename _Alloc>\n    inline bool\n    operator<=(const vector<_Tp, _Alloc>& __x, const vector<_Tp, _Alloc>& __y)\n    { return !(__y < __x); }\n\n  /// Based on operator<\n  template<typename _Tp, typename _Alloc>\n    inline bool\n    operator>=(const vector<_Tp, _Alloc>& __x, const vector<_Tp, _Alloc>& __y)\n    { return !(__x < __y); }\n\n  /// See std::vector::swap().\n  template<typename _Tp, typename _Alloc>\n    inline void\n    swap(vector<_Tp, _Alloc>& __x, vector<_Tp, _Alloc>& __y)\n    { __x.swap(__y); }\n\n_GLIBCXX_END_NESTED_NAMESPACE\n\n#endif /* _VECTOR_H */\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/bits/stream_iterator.h",
    "content": "// Stream iterators\n\n// Copyright (C) 2001, 2004, 2005 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n/** @file stream_iterator.h\n *  This is an internal header file, included by other library headers.\n *  You should not attempt to use it directly.\n */\n\n#ifndef _STREAM_ITERATOR_H\n#define _STREAM_ITERATOR_H 1\n\n#pragma GCC system_header\n\n#include <debug/debug.h>\n\n_GLIBCXX_BEGIN_NAMESPACE(std)\n\n  /// Provides input iterator semantics for streams.\n  template<typename _Tp, typename _CharT = char,\n           typename _Traits = char_traits<_CharT>, typename _Dist = ptrdiff_t>\n    class istream_iterator\n    : public iterator<input_iterator_tag, _Tp, _Dist, const _Tp*, const _Tp&>\n    {\n    public:\n      typedef _CharT                         char_type;\n      typedef _Traits                        traits_type;\n      typedef basic_istream<_CharT, _Traits> istream_type;\n\n    private:\n      istream_type*\t_M_stream;\n      _Tp\t\t_M_value;\n      bool\t\t_M_ok;\n\n    public:\n      ///  Construct end of input stream iterator.\n      istream_iterator()\n      : _M_stream(0), _M_value(), _M_ok(false) {}\n\n      ///  Construct start of input stream iterator.\n      istream_iterator(istream_type& __s)\n      : _M_stream(&__s)\n      { _M_read(); }\n\n      istream_iterator(const istream_iterator& __obj)\n      : _M_stream(__obj._M_stream), _M_value(__obj._M_value),\n        _M_ok(__obj._M_ok)\n      { }\n\n      const _Tp&\n      operator*() const\n      {\n\t__glibcxx_requires_cond(_M_ok,\n\t\t\t\t_M_message(__gnu_debug::__msg_deref_istream)\n\t\t\t\t._M_iterator(*this));\n\treturn _M_value;\n      }\n\n      const _Tp*\n      operator->() const { return &(operator*()); }\n\n      istream_iterator&\n      operator++()\n      {\n\t__glibcxx_requires_cond(_M_ok,\n\t\t\t\t_M_message(__gnu_debug::__msg_inc_istream)\n\t\t\t\t._M_iterator(*this));\n\t_M_read();\n\treturn *this;\n      }\n\n      istream_iterator\n      operator++(int)\n      {\n\t__glibcxx_requires_cond(_M_ok,\n\t\t\t\t_M_message(__gnu_debug::__msg_inc_istream)\n\t\t\t\t._M_iterator(*this));\n\tistream_iterator __tmp = *this;\n\t_M_read();\n\treturn __tmp;\n      }\n\n      bool\n      _M_equal(const istream_iterator& __x) const\n      { return (_M_ok == __x._M_ok) && (!_M_ok || _M_stream == __x._M_stream); }\n\n    private:\n      void\n      _M_read()\n      {\n\t_M_ok = (_M_stream && *_M_stream) ? true : false;\n\tif (_M_ok)\n\t  {\n\t    *_M_stream >> _M_value;\n\t    _M_ok = *_M_stream ? true : false;\n\t  }\n      }\n    };\n\n  ///  Return true if x and y are both end or not end, or x and y are the same.\n  template<typename _Tp, typename _CharT, typename _Traits, typename _Dist>\n    inline bool\n    operator==(const istream_iterator<_Tp, _CharT, _Traits, _Dist>& __x,\n\t       const istream_iterator<_Tp, _CharT, _Traits, _Dist>& __y)\n    { return __x._M_equal(__y); }\n\n  ///  Return false if x and y are both end or not end, or x and y are the same.\n  template <class _Tp, class _CharT, class _Traits, class _Dist>\n    inline bool\n    operator!=(const istream_iterator<_Tp, _CharT, _Traits, _Dist>& __x,\n\t       const istream_iterator<_Tp, _CharT, _Traits, _Dist>& __y)\n    { return !__x._M_equal(__y); }\n\n  /**\n   *  @brief  Provides output iterator semantics for streams.\n   *\n   *  This class provides an iterator to write to an ostream.  The type Tp is\n   *  the only type written by this iterator and there must be an\n   *  operator<<(Tp) defined.\n   *\n   *  @param  Tp  The type to write to the ostream.\n   *  @param  CharT  The ostream char_type.\n   *  @param  Traits  The ostream char_traits.\n  */\n  template<typename _Tp, typename _CharT = char,\n           typename _Traits = char_traits<_CharT> >\n    class ostream_iterator\n    : public iterator<output_iterator_tag, void, void, void, void>\n    {\n    public:\n      //@{\n      /// Public typedef\n      typedef _CharT                         char_type;\n      typedef _Traits                        traits_type;\n      typedef basic_ostream<_CharT, _Traits> ostream_type;\n      //@}\n\n    private:\n      ostream_type*\t_M_stream;\n      const _CharT*\t_M_string;\n\n    public:\n      /// Construct from an ostream.\n      ostream_iterator(ostream_type& __s) : _M_stream(&__s), _M_string(0) {}\n\n      /**\n       *  Construct from an ostream.\n       *\n       *  The delimiter string @a c is written to the stream after every Tp\n       *  written to the stream.  The delimiter is not copied, and thus must\n       *  not be destroyed while this iterator is in use.\n       *\n       *  @param  s  Underlying ostream to write to.\n       *  @param  c  CharT delimiter string to insert.\n      */\n      ostream_iterator(ostream_type& __s, const _CharT* __c)\n      : _M_stream(&__s), _M_string(__c)  { }\n\n      /// Copy constructor.\n      ostream_iterator(const ostream_iterator& __obj)\n      : _M_stream(__obj._M_stream), _M_string(__obj._M_string)  { }\n\n      /// Writes @a value to underlying ostream using operator<<.  If\n      /// constructed with delimiter string, writes delimiter to ostream.\n      ostream_iterator&\n      operator=(const _Tp& __value)\n      {\n\t__glibcxx_requires_cond(_M_stream != 0,\n\t\t\t\t_M_message(__gnu_debug::__msg_output_ostream)\n\t\t\t\t._M_iterator(*this));\n\t*_M_stream << __value;\n\tif (_M_string) *_M_stream << _M_string;\n\treturn *this;\n      }\n\n      ostream_iterator&\n      operator*()\n      { return *this; }\n\n      ostream_iterator&\n      operator++()\n      { return *this; }\n\n      ostream_iterator&\n      operator++(int)\n      { return *this; }\n    };\n\n_GLIBCXX_END_NAMESPACE\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/bits/streambuf.tcc",
    "content": "// Stream buffer classes -*- C++ -*-\n\n// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006\n// Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n/** @file streambuf.tcc\n *  This is an internal header file, included by other library headers.\n *  You should not attempt to use it directly.\n */\n\n//\n// ISO C++ 14882: 27.5  Stream buffers\n//\n\n#ifndef _STREAMBUF_TCC\n#define _STREAMBUF_TCC 1\n\n#pragma GCC system_header\n\n_GLIBCXX_BEGIN_NAMESPACE(std)\n\n  template<typename _CharT, typename _Traits>\n    streamsize\n    basic_streambuf<_CharT, _Traits>::\n    xsgetn(char_type* __s, streamsize __n)\n    {\n      streamsize __ret = 0;\n      while (__ret < __n)\n\t{\n\t  const streamsize __buf_len = this->egptr() - this->gptr();\n\t  if (__buf_len)\n\t    {\n\t      const streamsize __remaining = __n - __ret;\n\t      const streamsize __len = std::min(__buf_len, __remaining);\n\t      traits_type::copy(__s, this->gptr(), __len);\n\t      __ret += __len;\n\t      __s += __len;\n\t      this->gbump(__len);\n\t    }\n\n\t  if (__ret < __n)\n\t    {\n\t      const int_type __c = this->uflow();\n\t      if (!traits_type::eq_int_type(__c, traits_type::eof()))\n\t\t{\n\t\t  traits_type::assign(*__s++, traits_type::to_char_type(__c));\n\t\t  ++__ret;\n\t\t}\n\t      else\n\t\tbreak;\n\t    }\n\t}\n      return __ret;\n    }\n\n  template<typename _CharT, typename _Traits>\n    streamsize\n    basic_streambuf<_CharT, _Traits>::\n    xsputn(const char_type* __s, streamsize __n)\n    {\n      streamsize __ret = 0;\n      while (__ret < __n)\n\t{\n\t  const streamsize __buf_len = this->epptr() - this->pptr();\n\t  if (__buf_len)\n\t    {\n\t      const streamsize __remaining = __n - __ret;\n\t      const streamsize __len = std::min(__buf_len, __remaining);\n\t      traits_type::copy(this->pptr(), __s, __len);\n\t      __ret += __len;\n\t      __s += __len;\n\t      this->pbump(__len);\n\t    }\n\n\t  if (__ret < __n)\n\t    {\n\t      int_type __c = this->overflow(traits_type::to_int_type(*__s));\n\t      if (!traits_type::eq_int_type(__c, traits_type::eof()))\n\t\t{\n\t\t  ++__ret;\n\t\t  ++__s;\n\t\t}\n\t      else\n\t\tbreak;\n\t    }\n\t}\n      return __ret;\n    }\n\n  // Conceivably, this could be used to implement buffer-to-buffer\n  // copies, if this was ever desired in an un-ambiguous way by the\n  // standard.\n  template<typename _CharT, typename _Traits>\n    streamsize\n    __copy_streambufs_eof(basic_streambuf<_CharT, _Traits>* __sbin,\n\t\t\t  basic_streambuf<_CharT, _Traits>* __sbout,\n\t\t\t  bool& __ineof)\n    {\n      streamsize __ret = 0;\n      __ineof = true;\n      typename _Traits::int_type __c = __sbin->sgetc();\n      while (!_Traits::eq_int_type(__c, _Traits::eof()))\n\t{\n\t  __c = __sbout->sputc(_Traits::to_char_type(__c));\n\t  if (_Traits::eq_int_type(__c, _Traits::eof()))\n\t    {\n\t      __ineof = false;\n\t      break;\n\t    }\n\t  ++__ret;\n\t  __c = __sbin->snextc();\n\t}\n      return __ret;\n    }\n\n  template<typename _CharT, typename _Traits>\n    inline streamsize\n    __copy_streambufs(basic_streambuf<_CharT, _Traits>* __sbin,\n\t\t      basic_streambuf<_CharT, _Traits>* __sbout)\n    {\n      bool __ineof;\n      return __copy_streambufs_eof(__sbin, __sbout, __ineof);\n    }\n\n  // Inhibit implicit instantiations for required instantiations,\n  // which are defined via explicit instantiations elsewhere.\n  // NB:  This syntax is a GNU extension.\n#if _GLIBCXX_EXTERN_TEMPLATE\n  extern template class basic_streambuf<char>;\n  extern template\n    streamsize\n    __copy_streambufs(basic_streambuf<char>*,\n\t\t      basic_streambuf<char>*);\n  extern template\n    streamsize\n    __copy_streambufs_eof(basic_streambuf<char>*,\n\t\t\t  basic_streambuf<char>*, bool&);\n\n#ifdef _GLIBCXX_USE_WCHAR_T\n  extern template class basic_streambuf<wchar_t>;\n  extern template\n    streamsize\n    __copy_streambufs(basic_streambuf<wchar_t>*,\n\t\t      basic_streambuf<wchar_t>*);\n  extern template\n    streamsize\n    __copy_streambufs_eof(basic_streambuf<wchar_t>*,\n\t\t\t  basic_streambuf<wchar_t>*, bool&);\n#endif\n#endif\n\n_GLIBCXX_END_NAMESPACE\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/bits/streambuf_iterator.h",
    "content": "// Streambuf iterators\n\n// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006\n// Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n/** @file streambuf_iterator.h\n *  This is an internal header file, included by other library headers.\n *  You should not attempt to use it directly.\n */\n\n#ifndef _STREAMBUF_ITERATOR_H\n#define _STREAMBUF_ITERATOR_H 1\n\n#pragma GCC system_header\n\n#include <streambuf>\n#include <debug/debug.h>\n\n_GLIBCXX_BEGIN_NAMESPACE(std)\n     \n  // 24.5.3 Template class istreambuf_iterator\n  /// Provides input iterator semantics for streambufs.\n  template<typename _CharT, typename _Traits>\n    class istreambuf_iterator\n    : public iterator<input_iterator_tag, _CharT, typename _Traits::off_type,\n\t\t      _CharT*, _CharT&>\n    {\n    public:\n      // Types:\n      //@{\n      /// Public typedefs\n      typedef _CharT\t\t\t\t\tchar_type;\n      typedef _Traits\t\t\t\t\ttraits_type;\n      typedef typename _Traits::int_type\t\tint_type;\n      typedef basic_streambuf<_CharT, _Traits>\t\tstreambuf_type;\n      typedef basic_istream<_CharT, _Traits>\t\tistream_type;\n      //@}\n\n      template<typename _CharT2>\n\tfriend typename __gnu_cxx::__enable_if<__is_char<_CharT2>::__value,\n\t\t                    ostreambuf_iterator<_CharT2> >::__type\n\tcopy(istreambuf_iterator<_CharT2>, istreambuf_iterator<_CharT2>,\n\t     ostreambuf_iterator<_CharT2>);\n\n      template<typename _CharT2>\n\tfriend typename __gnu_cxx::__enable_if<__is_char<_CharT2>::__value, \n\t\t\t\t\t       _CharT2*>::__type\n\t__copy_aux(istreambuf_iterator<_CharT2>, istreambuf_iterator<_CharT2>,\n\t\t   _CharT2*);\n\n      template<typename _CharT2>\n\tfriend typename __gnu_cxx::__enable_if<__is_char<_CharT2>::__value,\n\t\t\t            istreambuf_iterator<_CharT2> >::__type\n\tfind(istreambuf_iterator<_CharT2>, istreambuf_iterator<_CharT2>,\n\t     const _CharT2&);\n\n    private:\n      // 24.5.3 istreambuf_iterator\n      // p 1\n      // If the end of stream is reached (streambuf_type::sgetc()\n      // returns traits_type::eof()), the iterator becomes equal to\n      // the \"end of stream\" iterator value.\n      // NB: This implementation assumes the \"end of stream\" value\n      // is EOF, or -1.\n      mutable streambuf_type*\t_M_sbuf;\n      mutable int_type\t\t_M_c;\n\n    public:\n      ///  Construct end of input stream iterator.\n      istreambuf_iterator() throw()\n      : _M_sbuf(0), _M_c(traits_type::eof()) { }\n\n      ///  Construct start of input stream iterator.\n      istreambuf_iterator(istream_type& __s) throw()\n      : _M_sbuf(__s.rdbuf()), _M_c(traits_type::eof()) { }\n\n      ///  Construct start of streambuf iterator.\n      istreambuf_iterator(streambuf_type* __s) throw()\n      : _M_sbuf(__s), _M_c(traits_type::eof()) { }\n\n      ///  Return the current character pointed to by iterator.  This returns\n      ///  streambuf.sgetc().  It cannot be assigned.  NB: The result of\n      ///  operator*() on an end of stream is undefined.\n      char_type\n      operator*() const\n      {\n#ifdef _GLIBCXX_DEBUG_PEDANTIC\n\t// Dereferencing a past-the-end istreambuf_iterator is a\n\t// libstdc++ extension\n\t__glibcxx_requires_cond(!_M_at_eof(),\n\t\t\t\t_M_message(__gnu_debug::__msg_deref_istreambuf)\n\t\t\t\t._M_iterator(*this));\n#endif\n\treturn traits_type::to_char_type(_M_get());\n      }\n\n      /// Advance the iterator.  Calls streambuf.sbumpc().\n      istreambuf_iterator&\n      operator++()\n      {\n\t__glibcxx_requires_cond(!_M_at_eof(),\n\t\t\t\t_M_message(__gnu_debug::__msg_inc_istreambuf)\n\t\t\t\t._M_iterator(*this));\n\tif (_M_sbuf)\n\t  {\n\t    _M_sbuf->sbumpc();\n\t    _M_c = traits_type::eof();\n\t  }\n\treturn *this;\n      }\n\n      /// Advance the iterator.  Calls streambuf.sbumpc().\n      istreambuf_iterator\n      operator++(int)\n      {\n\t__glibcxx_requires_cond(!_M_at_eof(),\n\t\t\t\t_M_message(__gnu_debug::__msg_inc_istreambuf)\n\t\t\t\t._M_iterator(*this));\n\n\tistreambuf_iterator __old = *this;\n\tif (_M_sbuf)\n\t  {\n\t    __old._M_c = _M_sbuf->sbumpc();\n\t    _M_c = traits_type::eof();\n\t  }\n\treturn __old;\n      }\n\n      // _GLIBCXX_RESOLVE_LIB_DEFECTS\n      // 110 istreambuf_iterator::equal not const\n      // NB: there is also number 111 (NAD, Future) pending on this function.\n      /// Return true both iterators are end or both are not end.\n      bool\n      equal(const istreambuf_iterator& __b) const\n      {\n\tconst bool __thiseof = _M_at_eof();\n\tconst bool __beof = __b._M_at_eof();\n\treturn (__thiseof && __beof || (!__thiseof && !__beof));\n      }\n\n    private:\n      int_type\n      _M_get() const\n      {\n\tconst int_type __eof = traits_type::eof();\n\tint_type __ret = __eof;\n\tif (_M_sbuf)\n\t  {\n\t    if (!traits_type::eq_int_type(_M_c, __eof))\n\t      __ret = _M_c;\n\t    else if (!traits_type::eq_int_type((__ret = _M_sbuf->sgetc()),\n\t\t\t\t\t       __eof))\n\t      _M_c = __ret;\n\t    else\n\t      _M_sbuf = 0;\n\t  }\n\treturn __ret;\n      }\n\n      bool\n      _M_at_eof() const\n      {\n\tconst int_type __eof = traits_type::eof();\n\treturn traits_type::eq_int_type(_M_get(), __eof);\n      }\n    };\n\n  template<typename _CharT, typename _Traits>\n    inline bool\n    operator==(const istreambuf_iterator<_CharT, _Traits>& __a,\n\t       const istreambuf_iterator<_CharT, _Traits>& __b)\n    { return __a.equal(__b); }\n\n  template<typename _CharT, typename _Traits>\n    inline bool\n    operator!=(const istreambuf_iterator<_CharT, _Traits>& __a,\n\t       const istreambuf_iterator<_CharT, _Traits>& __b)\n    { return !__a.equal(__b); }\n\n  /// Provides output iterator semantics for streambufs.\n  template<typename _CharT, typename _Traits>\n    class ostreambuf_iterator\n    : public iterator<output_iterator_tag, void, void, void, void>\n    {\n    public:\n      // Types:\n      //@{\n      /// Public typedefs\n      typedef _CharT                           char_type;\n      typedef _Traits                          traits_type;\n      typedef basic_streambuf<_CharT, _Traits> streambuf_type;\n      typedef basic_ostream<_CharT, _Traits>   ostream_type;\n      //@}\n\n      template<typename _CharT2>\n\tfriend typename __gnu_cxx::__enable_if<__is_char<_CharT2>::__value,\n\t\t                    ostreambuf_iterator<_CharT2> >::__type\n\tcopy(istreambuf_iterator<_CharT2>, istreambuf_iterator<_CharT2>,\n\t     ostreambuf_iterator<_CharT2>);\n\n    private:\n      streambuf_type*\t_M_sbuf;\n      bool\t\t_M_failed;\n\n    public:\n      ///  Construct output iterator from ostream.\n      ostreambuf_iterator(ostream_type& __s) throw ()\n      : _M_sbuf(__s.rdbuf()), _M_failed(!_M_sbuf) { }\n\n      ///  Construct output iterator from streambuf.\n      ostreambuf_iterator(streambuf_type* __s) throw ()\n      : _M_sbuf(__s), _M_failed(!_M_sbuf) { }\n\n      ///  Write character to streambuf.  Calls streambuf.sputc().\n      ostreambuf_iterator&\n      operator=(_CharT __c)\n      {\n\tif (!_M_failed &&\n\t    _Traits::eq_int_type(_M_sbuf->sputc(__c), _Traits::eof()))\n\t  _M_failed = true;\n\treturn *this;\n      }\n\n      /// Return *this.\n      ostreambuf_iterator&\n      operator*()\n      { return *this; }\n\n      /// Return *this.\n      ostreambuf_iterator&\n      operator++(int)\n      { return *this; }\n\n      /// Return *this.\n      ostreambuf_iterator&\n      operator++()\n      { return *this; }\n\n      /// Return true if previous operator=() failed.\n      bool\n      failed() const throw()\n      { return _M_failed; }\n\n      ostreambuf_iterator&\n      _M_put(const _CharT* __ws, streamsize __len)\n      {\n\tif (__builtin_expect(!_M_failed, true)\n\t    && __builtin_expect(this->_M_sbuf->sputn(__ws, __len) != __len,\n\t\t\t\tfalse))\n\t  _M_failed = true;\n\treturn *this;\n      }\n    };\n\n  // Overloads for streambuf iterators.\n  template<typename _CharT>\n    typename __gnu_cxx::__enable_if<__is_char<_CharT>::__value,\n    \t                 \t    ostreambuf_iterator<_CharT> >::__type\n    copy(istreambuf_iterator<_CharT> __first,\n\t istreambuf_iterator<_CharT> __last,\n\t ostreambuf_iterator<_CharT> __result)\n    {\n      if (__first._M_sbuf && !__last._M_sbuf && !__result._M_failed)\n\t{\n\t  bool __ineof;\n\t  __copy_streambufs_eof(__first._M_sbuf, __result._M_sbuf, __ineof);\n\t  if (!__ineof)\n\t    __result._M_failed = true;\n\t}\n      return __result;\n    }\n\n  template<typename _CharT>\n    typename __gnu_cxx::__enable_if<__is_char<_CharT>::__value, \n    \t\t\t\t    ostreambuf_iterator<_CharT> >::__type\n    __copy_aux(_CharT* __first, _CharT* __last,\n\t       ostreambuf_iterator<_CharT> __result)\n    {\n      const streamsize __num = __last - __first;\n      if (__num > 0)\n\t__result._M_put(__first, __num);\n      return __result;\n    }\n\n  template<typename _CharT>\n    typename __gnu_cxx::__enable_if<__is_char<_CharT>::__value,\n\t\t\t\t    ostreambuf_iterator<_CharT> >::__type\n    __copy_aux(const _CharT* __first, const _CharT* __last,\n\t       ostreambuf_iterator<_CharT> __result)\n    {\n      const streamsize __num = __last - __first;\n      if (__num > 0)\n\t__result._M_put(__first, __num);\n      return __result;\n    }\n\n  template<typename _CharT>\n    typename __gnu_cxx::__enable_if<__is_char<_CharT>::__value, \n    \t\t\t\t    _CharT*>::__type\n    __copy_aux(istreambuf_iterator<_CharT> __first,\n\t       istreambuf_iterator<_CharT> __last, _CharT* __result)\n    {\n      typedef istreambuf_iterator<_CharT>                  __is_iterator_type;\n      typedef typename __is_iterator_type::traits_type     traits_type;\n      typedef typename __is_iterator_type::streambuf_type  streambuf_type;\n      typedef typename traits_type::int_type               int_type;\n\n      if (__first._M_sbuf && !__last._M_sbuf)\n\t{\n\t  streambuf_type* __sb = __first._M_sbuf;\n\t  int_type __c = __sb->sgetc();\n\t  while (!traits_type::eq_int_type(__c, traits_type::eof()))\n\t    {\n\t      const streamsize __n = __sb->egptr() - __sb->gptr();\n\t      if (__n > 1)\n\t\t{\n\t\t  traits_type::copy(__result, __sb->gptr(), __n);\n\t\t  __sb->gbump(__n);\n\t\t  __result += __n;\n\t\t  __c = __sb->underflow();\n\t\t}\n\t      else\n\t\t{\n\t\t  *__result++ = traits_type::to_char_type(__c);\n\t\t  __c = __sb->snextc();\n\t\t}\n\t    }\n\t}\n      return __result;\n    }\n\n  template<typename _CharT>\n    typename __gnu_cxx::__enable_if<__is_char<_CharT>::__value,\n\t\t  \t\t    istreambuf_iterator<_CharT> >::__type\n    find(istreambuf_iterator<_CharT> __first,\n\t istreambuf_iterator<_CharT> __last, const _CharT& __val)\n    {\n      typedef istreambuf_iterator<_CharT>                  __is_iterator_type;\n      typedef typename __is_iterator_type::traits_type     traits_type;\n      typedef typename __is_iterator_type::streambuf_type  streambuf_type;\n      typedef typename traits_type::int_type               int_type;\n\n      if (__first._M_sbuf && !__last._M_sbuf)\n\t{\n\t  const int_type __ival = traits_type::to_int_type(__val);\n\t  streambuf_type* __sb = __first._M_sbuf;\n\t  int_type __c = __sb->sgetc();\n\t  while (!traits_type::eq_int_type(__c, traits_type::eof())\n\t\t && !traits_type::eq_int_type(__c, __ival))\n\t    {\n\t      streamsize __n = __sb->egptr() - __sb->gptr();\n\t      if (__n > 1)\n\t\t{\n\t\t  const _CharT* __p = traits_type::find(__sb->gptr(),\n\t\t\t\t\t\t\t__n, __val);\n\t\t  if (__p)\n\t\t    __n = __p - __sb->gptr();\n\t\t  __sb->gbump(__n);\n\t\t  __c = __sb->sgetc();\n\t\t}\n\t      else\n\t\t__c = __sb->snextc();\n\t    }\n\n\t  if (!traits_type::eq_int_type(__c, traits_type::eof()))\n\t    __first._M_c = __c;\n\t  else\n\t    __first._M_sbuf = 0;\n\t}\n      return __first;\n    }\n\n_GLIBCXX_END_NAMESPACE\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/bits/stringfwd.h",
    "content": "// String support -*- C++ -*-\n\n// Copyright (C) 2001, 2002, 2005 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n/** @file stringfwd.h\n *  This is an internal header file, included by other library headers.\n *  You should not attempt to use it directly.\n */\n\n//\n// ISO C++ 14882: 21 Strings library\n//\n\n#ifndef _STRINGFWD_H\n#define _STRINGFWD_H 1\n\n#pragma GCC system_header\n\n#include <bits/c++config.h>\n\n_GLIBCXX_BEGIN_NAMESPACE(std)\n\n  template<typename _Alloc>\n    class allocator;\n\n  template<class _CharT>\n    struct char_traits;\n\n  template<typename _CharT, typename _Traits = char_traits<_CharT>,\n           typename _Alloc = allocator<_CharT> >\n    class basic_string;\n\n  template<> struct char_traits<char>;\n\n  typedef basic_string<char>    string;\n\n#ifdef _GLIBCXX_USE_WCHAR_T\n  template<> struct char_traits<wchar_t>;\n\n  typedef basic_string<wchar_t> wstring;\n#endif\n\n_GLIBCXX_END_NAMESPACE\n\n#endif\t// _STRINGFWD_H\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/bits/time_members.h",
    "content": "// std::time_get, std::time_put implementation, generic version -*- C++ -*-\n\n// Copyright (C) 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n/** @file time_members.h\n *  This is an internal header file, included by other library headers.\n *  You should not attempt to use it directly.\n */\n\n//\n// ISO C++ 14882: 22.2.5.1.2 - time_get functions\n// ISO C++ 14882: 22.2.5.3.2 - time_put functions\n//\n\n// Written by Benjamin Kosnik <bkoz@redhat.com>\n\n_GLIBCXX_BEGIN_NAMESPACE(std)\n\n  template<typename _CharT>\n    __timepunct<_CharT>::__timepunct(size_t __refs) \n    : facet(__refs), _M_data(NULL)\n    { \n      _M_name_timepunct = _S_get_c_name();\n      _M_initialize_timepunct(); \n    }\n\n  template<typename _CharT>\n    __timepunct<_CharT>::__timepunct(__cache_type* __cache, size_t __refs) \n    : facet(__refs), _M_data(__cache)\n    { \n      _M_name_timepunct = _S_get_c_name();\n      _M_initialize_timepunct(); \n    }\n\n  template<typename _CharT>\n    __timepunct<_CharT>::__timepunct(__c_locale __cloc, const char* __s, \n\t\t\t\t     size_t __refs) \n    : facet(__refs), _M_data(NULL)\n    { \n      const size_t __len = std::strlen(__s) + 1;\n      char* __tmp = new char[__len];\n      std::memcpy(__tmp, __s, __len);\n      _M_name_timepunct = __tmp;\n\n      try\n\t{ _M_initialize_timepunct(__cloc); }\n      catch(...)\n\t{ \n\t  delete [] _M_name_timepunct;\n\t  __throw_exception_again;\n\t}\n    }\n\n  template<typename _CharT>\n    __timepunct<_CharT>::~__timepunct()\n    { \n      if (_M_name_timepunct != _S_get_c_name())\n\tdelete [] _M_name_timepunct;\n      delete _M_data;\n      _S_destroy_c_locale(_M_c_locale_timepunct); \n    }\n\n_GLIBCXX_END_NAMESPACE\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/bits/valarray_after.h",
    "content": "// The template and inlines for the -*- C++ -*- internal _Meta class.\n\n// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005\n// Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n/** @file valarray_after.h\n *  This is an internal header file, included by other library headers.\n *  You should not attempt to use it directly.\n */\n\n// Written by Gabriel Dos Reis <Gabriel.Dos-Reis@cmla.ens-cachan.fr>\n\n#ifndef _VALARRAY_AFTER_H\n#define _VALARRAY_AFTER_H 1\n\n#pragma GCC system_header\n\n_GLIBCXX_BEGIN_NAMESPACE(std)\n\n  //\n  // gslice_array closure.\n  //\n  template<class _Dom>\n    class _GBase\n    {\n    public:\n      typedef typename _Dom::value_type value_type;\n      \n      _GBase (const _Dom& __e, const valarray<size_t>& __i)\n      : _M_expr (__e), _M_index(__i) {}\n      \n      value_type\n      operator[] (size_t __i) const\n      { return _M_expr[_M_index[__i]]; }\n      \n      size_t\n      size () const\n      { return _M_index.size(); }\n\n    private:\n      const _Dom&\t      _M_expr;\n      const valarray<size_t>& _M_index;\n    };\n\n  template<typename _Tp>\n    class _GBase<_Array<_Tp> >\n    {\n    public:\n      typedef _Tp value_type;\n      \n      _GBase (_Array<_Tp> __a, const valarray<size_t>& __i)\n      : _M_array (__a), _M_index(__i) {}\n      \n      value_type\n      operator[] (size_t __i) const\n      { return _M_array._M_data[_M_index[__i]]; }\n      \n      size_t\n      size () const\n      { return _M_index.size(); }\n\n    private:\n      const _Array<_Tp>       _M_array;\n      const valarray<size_t>& _M_index;\n    };\n\n  template<class _Dom>\n    struct _GClos<_Expr, _Dom>\n    : _GBase<_Dom>\n    {\n      typedef _GBase<_Dom> _Base;\n      typedef typename _Base::value_type value_type;\n      \n      _GClos (const _Dom& __e, const valarray<size_t>& __i)\n      : _Base (__e, __i) {}\n    };\n\n  template<typename _Tp>\n    struct _GClos<_ValArray, _Tp>\n    : _GBase<_Array<_Tp> >\n    {\n      typedef _GBase<_Array<_Tp> > _Base;\n      typedef typename _Base::value_type value_type;\n      \n      _GClos (_Array<_Tp> __a, const valarray<size_t>& __i)\n      : _Base (__a, __i) {}\n    };\n\n  //\n  // indirect_array closure\n  //\n  template<class _Dom>\n    class _IBase\n    {\n    public:\n      typedef typename _Dom::value_type value_type;\n\n      _IBase (const _Dom& __e, const valarray<size_t>& __i)\n      : _M_expr (__e), _M_index (__i) {}\n      \n      value_type\n      operator[] (size_t __i) const\n      { return _M_expr[_M_index[__i]]; }\n      \n      size_t\n      size() const\n      { return _M_index.size(); }\n\n    private:\n      const _Dom&\t      _M_expr;\n      const valarray<size_t>& _M_index;\n    };\n\n  template<class _Dom>\n    struct _IClos<_Expr, _Dom>\n    : _IBase<_Dom>\n    {\n      typedef _IBase<_Dom> _Base;\n      typedef typename _Base::value_type value_type;\n      \n      _IClos (const _Dom& __e, const valarray<size_t>& __i)\n      : _Base (__e, __i) {}\n    };\n\n  template<typename _Tp>\n    struct _IClos<_ValArray, _Tp>\n    : _IBase<valarray<_Tp> >\n    {\n      typedef _IBase<valarray<_Tp> > _Base;\n      typedef _Tp value_type;\n      \n      _IClos (const valarray<_Tp>& __a, const valarray<size_t>& __i)\n      : _Base (__a, __i) {}\n    };\n  \n  //\n  // class _Expr\n  //\n  template<class _Clos, typename _Tp>\n    class _Expr\n    {\n    public:\n      typedef _Tp value_type;\n\n      _Expr(const _Clos&);\n\n      const _Clos& operator()() const;\n\n      value_type operator[](size_t) const;\n      valarray<value_type> operator[](slice) const;\n      valarray<value_type> operator[](const gslice&) const;\n      valarray<value_type> operator[](const valarray<bool>&) const;\n      valarray<value_type> operator[](const valarray<size_t>&) const;\n\n      _Expr<_UnClos<__unary_plus, std::_Expr, _Clos>, value_type>\n      operator+() const;\n\n      _Expr<_UnClos<__negate, std::_Expr, _Clos>, value_type>\n      operator-() const;\n\n      _Expr<_UnClos<__bitwise_not, std::_Expr, _Clos>, value_type>\n      operator~() const;\n\n      _Expr<_UnClos<__logical_not, std::_Expr, _Clos>, bool>\n      operator!() const;\n\n      size_t size() const;\n      value_type sum() const;\n\n      valarray<value_type> shift(int) const;\n      valarray<value_type> cshift(int) const;\n\n      value_type min() const;\n      value_type max() const;\n\n      valarray<value_type> apply(value_type (*)(const value_type&)) const;\n      valarray<value_type> apply(value_type (*)(value_type)) const;\n\n    private:\n      const _Clos _M_closure;\n    };\n\n  template<class _Clos, typename _Tp>\n    inline\n    _Expr<_Clos, _Tp>::_Expr(const _Clos& __c) : _M_closure(__c) {}\n\n  template<class _Clos, typename _Tp>\n    inline const _Clos&\n    _Expr<_Clos, _Tp>::operator()() const\n    { return _M_closure; }\n\n  template<class _Clos, typename _Tp>\n    inline _Tp\n    _Expr<_Clos, _Tp>::operator[](size_t __i) const\n    { return _M_closure[__i]; }\n\n  template<class _Clos, typename _Tp>\n    inline valarray<_Tp>\n    _Expr<_Clos, _Tp>::operator[](slice __s) const\n    {\n      valarray<_Tp> __v = valarray<_Tp>(*this)[__s];\n      return __v;\n    }\n\n  template<class _Clos, typename _Tp>\n    inline valarray<_Tp>\n    _Expr<_Clos, _Tp>::operator[](const gslice& __gs) const\n    {\n      valarray<_Tp> __v = valarray<_Tp>(*this)[__gs];\n      return __v;\n    }\n\n  template<class _Clos, typename _Tp>\n    inline valarray<_Tp>\n    _Expr<_Clos, _Tp>::operator[](const valarray<bool>& __m) const\n    {\n      valarray<_Tp> __v = valarray<_Tp>(*this)[__m];\n      return __v;\n    }\n\n  template<class _Clos, typename _Tp>\n    inline valarray<_Tp>\n    _Expr<_Clos, _Tp>::operator[](const valarray<size_t>& __i) const\n    {\n      valarray<_Tp> __v = valarray<_Tp>(*this)[__i];\n      return __v;\n    }\n\n  template<class _Clos, typename _Tp>\n    inline size_t\n    _Expr<_Clos, _Tp>::size() const\n    { return _M_closure.size(); }\n\n  template<class _Clos, typename _Tp>\n    inline valarray<_Tp>\n    _Expr<_Clos, _Tp>::shift(int __n) const\n    {\n      valarray<_Tp> __v = valarray<_Tp>(*this).shift(__n);\n      return __v;\n    }\n\n  template<class _Clos, typename _Tp>\n    inline valarray<_Tp>\n    _Expr<_Clos, _Tp>::cshift(int __n) const\n    {\n      valarray<_Tp> __v = valarray<_Tp>(*this).cshift(__n);\n      return __v;\n    }\n\n  template<class _Clos, typename _Tp>\n    inline valarray<_Tp>\n    _Expr<_Clos, _Tp>::apply(_Tp __f(const _Tp&)) const\n    {\n      valarray<_Tp> __v = valarray<_Tp>(*this).apply(__f);\n      return __v;\n    }\n\n  template<class _Clos, typename _Tp>\n    inline valarray<_Tp>\n    _Expr<_Clos, _Tp>::apply(_Tp __f(_Tp)) const\n    {\n      valarray<_Tp> __v = valarray<_Tp>(*this).apply(__f);\n      return __v;\n    }\n\n  // XXX: replace this with a more robust summation algorithm.\n  template<class _Clos, typename _Tp>\n    inline _Tp\n    _Expr<_Clos, _Tp>::sum() const\n    {\n      size_t __n = _M_closure.size();\n      if (__n == 0)\n\treturn _Tp();\n      else\n\t{\n\t  _Tp __s = _M_closure[--__n];\n\t  while (__n != 0)\n\t    __s += _M_closure[--__n];\n\t  return __s;\n        }\n    }\n\n  template<class _Clos, typename _Tp>\n    inline _Tp\n    _Expr<_Clos, _Tp>::min() const\n    { return __valarray_min(_M_closure); }\n\n  template<class _Clos, typename _Tp>\n    inline _Tp\n    _Expr<_Clos, _Tp>::max() const\n    { return __valarray_max(_M_closure); }\n\n  template<class _Dom, typename _Tp>\n    inline _Expr<_UnClos<__logical_not, _Expr, _Dom>, bool>\n    _Expr<_Dom, _Tp>::operator!() const\n    {\n      typedef _UnClos<__logical_not, std::_Expr, _Dom> _Closure;\n      return _Expr<_Closure, _Tp>(_Closure(this->_M_closure));\n    }\n\n#define _DEFINE_EXPR_UNARY_OPERATOR(_Op, _Name)                           \\\n  template<class _Dom, typename _Tp>                                      \\\n    inline _Expr<_UnClos<_Name, std::_Expr, _Dom>, _Tp>                   \\\n    _Expr<_Dom, _Tp>::operator _Op() const                                \\\n    {                                                                     \\\n      typedef _UnClos<_Name, std::_Expr, _Dom> _Closure;                  \\\n      return _Expr<_Closure, _Tp>(_Closure(this->_M_closure));            \\\n    }\n\n    _DEFINE_EXPR_UNARY_OPERATOR(+, __unary_plus)\n    _DEFINE_EXPR_UNARY_OPERATOR(-, __negate)\n    _DEFINE_EXPR_UNARY_OPERATOR(~, __bitwise_not)\n\n#undef _DEFINE_EXPR_UNARY_OPERATOR\n\n#define _DEFINE_EXPR_BINARY_OPERATOR(_Op, _Name)                        \\\n  template<class _Dom1, class _Dom2>\t\t\t\t\t\\\n    inline _Expr<_BinClos<_Name, _Expr, _Expr, _Dom1, _Dom2>,           \\\n           typename __fun<_Name, typename _Dom1::value_type>::result_type> \\\n    operator _Op(const _Expr<_Dom1, typename _Dom1::value_type>& __v,   \\\n\t         const _Expr<_Dom2, typename _Dom2::value_type>& __w)   \\\n    {                                                                   \\\n      typedef typename _Dom1::value_type _Arg;                          \\\n      typedef typename __fun<_Name, _Arg>::result_type _Value;          \\\n      typedef _BinClos<_Name, _Expr, _Expr, _Dom1, _Dom2> _Closure;     \\\n      return _Expr<_Closure, _Value>(_Closure(__v(), __w()));           \\\n    }                                                                   \\\n                                                                        \\\n  template<class _Dom>                                                  \\\n    inline _Expr<_BinClos<_Name, _Expr, _Constant, _Dom,                \\\n                          typename _Dom::value_type>,                   \\\n             typename __fun<_Name, typename _Dom::value_type>::result_type> \\\n    operator _Op(const _Expr<_Dom, typename _Dom::value_type>& __v,     \\\n                 const typename _Dom::value_type& __t)                  \\\n    {                                                                   \\\n      typedef typename _Dom::value_type _Arg;                           \\\n      typedef typename __fun<_Name, _Arg>::result_type _Value;          \\\n      typedef _BinClos<_Name, _Expr, _Constant, _Dom, _Arg> _Closure;   \\\n      return _Expr<_Closure, _Value>(_Closure(__v(), __t));             \\\n    }                                                                   \\\n                                                                        \\\n  template<class _Dom>                                                  \\\n    inline _Expr<_BinClos<_Name, _Constant, _Expr,                      \\\n                          typename _Dom::value_type, _Dom>,             \\\n             typename __fun<_Name, typename _Dom::value_type>::result_type> \\\n    operator _Op(const typename _Dom::value_type& __t,                  \\\n                 const _Expr<_Dom, typename _Dom::value_type>& __v)     \\\n    {                                                                   \\\n      typedef typename _Dom::value_type _Arg;                           \\\n      typedef typename __fun<_Name, _Arg>::result_type _Value;          \\\n      typedef _BinClos<_Name, _Constant, _Expr, _Arg, _Dom> _Closure;   \\\n      return _Expr<_Closure, _Value>(_Closure(__t, __v()));             \\\n    }                                                                   \\\n                                                                        \\\n  template<class _Dom>                                                  \\\n    inline _Expr<_BinClos<_Name, _Expr, _ValArray,                      \\\n                          _Dom, typename _Dom::value_type>,             \\\n             typename __fun<_Name, typename _Dom::value_type>::result_type> \\\n    operator _Op(const _Expr<_Dom,typename _Dom::value_type>& __e,      \\\n                 const valarray<typename _Dom::value_type>& __v)        \\\n    {                                                                   \\\n      typedef typename _Dom::value_type _Arg;                           \\\n      typedef typename __fun<_Name, _Arg>::result_type _Value;          \\\n      typedef _BinClos<_Name, _Expr, _ValArray, _Dom, _Arg> _Closure;   \\\n      return _Expr<_Closure, _Value>(_Closure(__e(), __v));             \\\n    }                                                                   \\\n                                                                        \\\n  template<class _Dom>                                                  \\\n    inline _Expr<_BinClos<_Name, _ValArray, _Expr,                      \\\n                 typename _Dom::value_type, _Dom>,                      \\\n             typename __fun<_Name, typename _Dom::value_type>::result_type> \\\n    operator _Op(const valarray<typename _Dom::value_type>& __v,        \\\n                 const _Expr<_Dom, typename _Dom::value_type>& __e)     \\\n    {                                                                   \\\n      typedef typename _Dom::value_type _Tp;                            \\\n      typedef typename __fun<_Name, _Tp>::result_type _Value;           \\\n      typedef _BinClos<_Name, _ValArray, _Expr, _Tp, _Dom> _Closure;    \\\n      return _Expr<_Closure, _Value>(_Closure(__v, __e ()));            \\\n    }\n\n    _DEFINE_EXPR_BINARY_OPERATOR(+, __plus)\n    _DEFINE_EXPR_BINARY_OPERATOR(-, __minus)\n    _DEFINE_EXPR_BINARY_OPERATOR(*, __multiplies)\n    _DEFINE_EXPR_BINARY_OPERATOR(/, __divides)\n    _DEFINE_EXPR_BINARY_OPERATOR(%, __modulus)\n    _DEFINE_EXPR_BINARY_OPERATOR(^, __bitwise_xor)\n    _DEFINE_EXPR_BINARY_OPERATOR(&, __bitwise_and)\n    _DEFINE_EXPR_BINARY_OPERATOR(|, __bitwise_or)\n    _DEFINE_EXPR_BINARY_OPERATOR(<<, __shift_left)\n    _DEFINE_EXPR_BINARY_OPERATOR(>>, __shift_right)\n    _DEFINE_EXPR_BINARY_OPERATOR(&&, __logical_and)\n    _DEFINE_EXPR_BINARY_OPERATOR(||, __logical_or)\n    _DEFINE_EXPR_BINARY_OPERATOR(==, __equal_to)\n    _DEFINE_EXPR_BINARY_OPERATOR(!=, __not_equal_to)\n    _DEFINE_EXPR_BINARY_OPERATOR(<, __less)\n    _DEFINE_EXPR_BINARY_OPERATOR(>, __greater)\n    _DEFINE_EXPR_BINARY_OPERATOR(<=, __less_equal)\n    _DEFINE_EXPR_BINARY_OPERATOR(>=, __greater_equal)\n\n#undef _DEFINE_EXPR_BINARY_OPERATOR\n\n#define _DEFINE_EXPR_UNARY_FUNCTION(_Name)                               \\\n  template<class _Dom>                                                   \\\n    inline _Expr<_UnClos<__##_Name, _Expr, _Dom>,                        \\\n                 typename _Dom::value_type>                              \\\n    _Name(const _Expr<_Dom, typename _Dom::value_type>& __e)             \\\n    {                                                                    \\\n      typedef typename _Dom::value_type _Tp;                             \\\n      typedef _UnClos<__##_Name, _Expr, _Dom> _Closure;                  \\\n      return _Expr<_Closure, _Tp>(_Closure(__e()));                      \\\n    }                                                                    \\\n                                                                         \\\n  template<typename _Tp>                                                 \\\n    inline _Expr<_UnClos<__##_Name, _ValArray, _Tp>, _Tp>                \\\n    _Name(const valarray<_Tp>& __v)                                      \\\n    {                                                                    \\\n      typedef _UnClos<__##_Name, _ValArray, _Tp> _Closure;               \\\n      return _Expr<_Closure, _Tp>(_Closure(__v));                        \\\n    }\n\n    _DEFINE_EXPR_UNARY_FUNCTION(abs)\n    _DEFINE_EXPR_UNARY_FUNCTION(cos)\n    _DEFINE_EXPR_UNARY_FUNCTION(acos)\n    _DEFINE_EXPR_UNARY_FUNCTION(cosh)\n    _DEFINE_EXPR_UNARY_FUNCTION(sin)\n    _DEFINE_EXPR_UNARY_FUNCTION(asin)\n    _DEFINE_EXPR_UNARY_FUNCTION(sinh)\n    _DEFINE_EXPR_UNARY_FUNCTION(tan)\n    _DEFINE_EXPR_UNARY_FUNCTION(tanh)\n    _DEFINE_EXPR_UNARY_FUNCTION(atan)\n    _DEFINE_EXPR_UNARY_FUNCTION(exp)\n    _DEFINE_EXPR_UNARY_FUNCTION(log)\n    _DEFINE_EXPR_UNARY_FUNCTION(log10)\n    _DEFINE_EXPR_UNARY_FUNCTION(sqrt)\n\n#undef _DEFINE_EXPR_UNARY_FUNCTION\n\n#define _DEFINE_EXPR_BINARY_FUNCTION(_Fun)                             \\\n  template<class _Dom1, class _Dom2>                                   \\\n    inline _Expr<_BinClos<__##_Fun, _Expr, _Expr, _Dom1, _Dom2>,       \\\n\t\t typename _Dom1::value_type>                           \\\n    _Fun(const _Expr<_Dom1, typename _Dom1::value_type>& __e1,         \\\n\t  const _Expr<_Dom2, typename _Dom2::value_type>& __e2)        \\\n    {                                                                  \\\n      typedef typename _Dom1::value_type _Tp;                          \\\n      typedef _BinClos<__##_Fun, _Expr, _Expr, _Dom1, _Dom2> _Closure; \\\n      return _Expr<_Closure, _Tp>(_Closure(__e1(), __e2()));           \\\n    }                                                                  \\\n                                                                       \\\n  template<class _Dom>                                                 \\\n    inline _Expr<_BinClos<__##_Fun, _Expr, _ValArray, _Dom,            \\\n\t\t\t  typename _Dom::value_type>,                  \\\n\t\t typename _Dom::value_type>                            \\\n    _Fun(const _Expr<_Dom, typename _Dom::value_type>& __e,            \\\n\t const valarray<typename _Dom::value_type>& __v)               \\\n    {                                                                  \\\n      typedef typename _Dom::value_type _Tp;                           \\\n      typedef _BinClos<__##_Fun, _Expr, _ValArray, _Dom, _Tp> _Closure; \\\n      return _Expr<_Closure, _Tp>(_Closure(__e(), __v));               \\\n    }                                                                  \\\n                                                                       \\\n  template<class _Dom>                                                 \\\n    inline _Expr<_BinClos<__##_Fun, _ValArray, _Expr,                  \\\n\t\t\t  typename _Dom::value_type, _Dom>,            \\\n\t\t typename _Dom::value_type>                            \\\n    _Fun(const valarray<typename _Dom::valarray>& __v,                 \\\n\t const _Expr<_Dom, typename _Dom::value_type>& __e)            \\\n    {                                                                  \\\n      typedef typename _Dom::value_type _Tp;                           \\\n      typedef _BinClos<__##_Fun, _ValArray, _Expr, _Tp, _Dom> _Closure; \\\n      return _Expr<_Closure, _Tp>(_Closure(__v, __e()));               \\\n    }                                                                  \\\n                                                                       \\\n  template<class _Dom>                                                 \\\n    inline _Expr<_BinClos<__##_Fun, _Expr, _Constant, _Dom,            \\\n\t\t\t  typename _Dom::value_type>,                  \\\n\t\t typename _Dom::value_type>                            \\\n    _Fun(const _Expr<_Dom, typename _Dom::value_type>& __e,            \\\n\t const typename _Dom::value_type& __t)                         \\\n    {                                                                  \\\n      typedef typename _Dom::value_type _Tp;                           \\\n      typedef _BinClos<__##_Fun, _Expr, _Constant, _Dom, _Tp> _Closure;\\\n      return _Expr<_Closure, _Tp>(_Closure(__e(), __t));               \\\n    }                                                                  \\\n                                                                       \\\n  template<class _Dom>                                                 \\\n    inline _Expr<_BinClos<__##_Fun, _Constant, _Expr,                  \\\n\t\t\t  typename _Dom::value_type, _Dom>,            \\\n\t\t typename _Dom::value_type>                            \\\n    _Fun(const typename _Dom::value_type& __t,                         \\\n\t const _Expr<_Dom, typename _Dom::value_type>& __e)            \\\n    {                                                                  \\\n      typedef typename _Dom::value_type _Tp;                           \\\n      typedef _BinClos<__##_Fun, _Constant, _Expr, _Tp, _Dom> _Closure; \\\n      return _Expr<_Closure, _Tp>(_Closure(__t, __e()));               \\\n    }                                                                  \\\n                                                                       \\\n  template<typename _Tp>                                               \\\n    inline _Expr<_BinClos<__##_Fun, _ValArray, _ValArray, _Tp, _Tp>, _Tp> \\\n    _Fun(const valarray<_Tp>& __v, const valarray<_Tp>& __w)           \\\n    {                                                                  \\\n      typedef _BinClos<__##_Fun, _ValArray, _ValArray, _Tp, _Tp> _Closure; \\\n      return _Expr<_Closure, _Tp>(_Closure(__v, __w));                 \\\n    }                                                                  \\\n                                                                       \\\n  template<typename _Tp>                                               \\\n    inline _Expr<_BinClos<__##_Fun, _ValArray, _Constant, _Tp, _Tp>, _Tp> \\\n    _Fun(const valarray<_Tp>& __v, const _Tp& __t)                     \\\n    {                                                                  \\\n      typedef _BinClos<__##_Fun, _ValArray, _Constant, _Tp, _Tp> _Closure; \\\n      return _Expr<_Closure, _Tp>(_Closure(__v, __t));                 \\\n    }                                                                  \\\n\t\t\t\t\t\t\t\t       \\\n  template<typename _Tp>                                               \\\n    inline _Expr<_BinClos<__##_Fun, _Constant, _ValArray, _Tp, _Tp>, _Tp> \\\n    _Fun(const _Tp& __t, const valarray<_Tp>& __v)                     \\\n    {                                                                  \\\n      typedef _BinClos<__##_Fun, _Constant, _ValArray, _Tp, _Tp> _Closure; \\\n      return _Expr<_Closure, _Tp>(_Closure(__t, __v));                 \\\n    }\n\n_DEFINE_EXPR_BINARY_FUNCTION(atan2)\n_DEFINE_EXPR_BINARY_FUNCTION(pow)\n\n#undef _DEFINE_EXPR_BINARY_FUNCTION\n\n_GLIBCXX_END_NAMESPACE\n\n#endif /* _CPP_VALARRAY_AFTER_H */\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/bits/valarray_array.h",
    "content": "// The template and inlines for the -*- C++ -*- internal _Array helper class.\n\n// Copyright (C) 1997, 1998, 1999, 2000, 2003, 2004, 2005, 2006\n//  Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n/** @file valarray_array.h\n *  This is an internal header file, included by other library headers.\n *  You should not attempt to use it directly.\n */\n\n// Written by Gabriel Dos Reis <Gabriel.Dos-Reis@DPTMaths.ENS-Cachan.Fr>\n\n#ifndef _VALARRAY_ARRAY_H\n#define _VALARRAY_ARRAY_H 1\n\n#pragma GCC system_header\n\n#include <bits/c++config.h>\n#include <bits/cpp_type_traits.h>\n#include <cstdlib>\n#include <cstring>\n#include <new>\n\n_GLIBCXX_BEGIN_NAMESPACE(std)\n\n  //\n  // Helper functions on raw pointers\n  //\n\n  // We get memory by the old fashion way\n  inline void*\n  __valarray_get_memory(size_t __n)\n  { return operator new(__n); }\n\n  template<typename _Tp>\n    inline _Tp*__restrict__\n    __valarray_get_storage(size_t __n)\n    {\n      return static_cast<_Tp*__restrict__>\n\t(std::__valarray_get_memory(__n * sizeof(_Tp)));\n    }\n\n  // Return memory to the system\n  inline void\n  __valarray_release_memory(void* __p)\n  { operator delete(__p); }\n\n  // Turn a raw-memory into an array of _Tp filled with _Tp()\n  // This is required in 'valarray<T> v(n);'\n  template<typename _Tp, bool>\n    struct _Array_default_ctor\n    {\n      // Please note that this isn't exception safe.  But\n      // valarrays aren't required to be exception safe.\n      inline static void\n      _S_do_it(_Tp* __restrict__ __b, _Tp* __restrict__ __e)\n      {\n\twhile (__b != __e)\n\t  new(__b++) _Tp();\n      }\n    };\n\n  template<typename _Tp>\n    struct _Array_default_ctor<_Tp, true>\n    {\n      // For fundamental types, it suffices to say 'memset()'\n      inline static void\n      _S_do_it(_Tp* __restrict__ __b, _Tp* __restrict__ __e)\n      { std::memset(__b, 0, (__e - __b) * sizeof(_Tp)); }\n    };\n\n  template<typename _Tp>\n    inline void\n    __valarray_default_construct(_Tp* __restrict__ __b, _Tp* __restrict__ __e)\n    {\n      _Array_default_ctor<_Tp, __is_pod<_Tp>::__value>::_S_do_it(__b, __e);\n    }\n\n  // Turn a raw-memory into an array of _Tp filled with __t\n  // This is the required in valarray<T> v(n, t).  Also\n  // used in valarray<>::resize().\n  template<typename _Tp, bool>\n    struct _Array_init_ctor\n    {\n      // Please note that this isn't exception safe.  But\n      // valarrays aren't required to be exception safe.\n      inline static void\n      _S_do_it(_Tp* __restrict__ __b, _Tp* __restrict__ __e, const _Tp __t)\n      {\n\twhile (__b != __e)\n\t  new(__b++) _Tp(__t);\n      }\n    };\n\n  template<typename _Tp>\n    struct _Array_init_ctor<_Tp, true>\n    {\n      inline static void\n      _S_do_it(_Tp* __restrict__ __b, _Tp* __restrict__ __e,  const _Tp __t)\n      {\n\twhile (__b != __e)\n\t  *__b++ = __t;\n      }\n    };\n\n  template<typename _Tp>\n    inline void\n    __valarray_fill_construct(_Tp* __restrict__ __b, _Tp* __restrict__ __e,\n\t\t\t      const _Tp __t)\n    {\n      _Array_init_ctor<_Tp, __is_pod<_Tp>::__value>::_S_do_it(__b, __e, __t);\n    }\n\n  //\n  // copy-construct raw array [__o, *) from plain array [__b, __e)\n  // We can't just say 'memcpy()'\n  //\n  template<typename _Tp, bool>\n    struct _Array_copy_ctor\n    {\n      // Please note that this isn't exception safe.  But\n      // valarrays aren't required to be exception safe.\n      inline static void\n      _S_do_it(const _Tp* __restrict__ __b, const _Tp* __restrict__ __e,\n\t       _Tp* __restrict__ __o)\n      {\n\twhile (__b != __e)\n\t  new(__o++) _Tp(*__b++);\n      }\n    };\n\n  template<typename _Tp>\n    struct _Array_copy_ctor<_Tp, true>\n    {\n      inline static void\n      _S_do_it(const _Tp* __restrict__ __b, const _Tp* __restrict__ __e,\n\t       _Tp* __restrict__ __o)\n      { std::memcpy(__o, __b, (__e - __b)*sizeof(_Tp)); }\n    };\n\n  template<typename _Tp>\n    inline void\n    __valarray_copy_construct(const _Tp* __restrict__ __b,\n\t\t\t      const _Tp* __restrict__ __e,\n\t\t\t      _Tp* __restrict__ __o)\n    {\n      _Array_copy_ctor<_Tp, __is_pod<_Tp>::__value>::_S_do_it(__b, __e, __o);\n    }\n\n  // copy-construct raw array [__o, *) from strided array __a[<__n : __s>]\n  template<typename _Tp>\n    inline void\n    __valarray_copy_construct (const _Tp* __restrict__ __a, size_t __n,\n\t\t\t       size_t __s, _Tp* __restrict__ __o)\n    {\n      if (__is_pod<_Tp>::__value)\n\twhile (__n--)\n\t  {\n\t    *__o++ = *__a;\n\t    __a += __s;\n\t  }\n      else\n\twhile (__n--)\n\t  {\n\t    new(__o++) _Tp(*__a);\n\t    __a += __s;\n\t  }\n    }\n\n  // copy-construct raw array [__o, *) from indexed array __a[__i[<__n>]]\n  template<typename _Tp>\n    inline void\n    __valarray_copy_construct (const _Tp* __restrict__ __a,\n\t\t\t       const size_t* __restrict__ __i,\n\t\t\t       _Tp* __restrict__ __o, size_t __n)\n    {\n      if (__is_pod<_Tp>::__value)\n\twhile (__n--)\n\t  *__o++ = __a[*__i++];\n      else\n\twhile (__n--)\n\t  new (__o++) _Tp(__a[*__i++]);\n    }\n\n  // Do the necessary cleanup when we're done with arrays.\n  template<typename _Tp>\n    inline void\n    __valarray_destroy_elements(_Tp* __restrict__ __b, _Tp* __restrict__ __e)\n    {\n      if (!__is_pod<_Tp>::__value)\n\twhile (__b != __e)\n\t  {\n\t    __b->~_Tp();\n\t    ++__b;\n\t  }\n    }\n\n  // Fill a plain array __a[<__n>] with __t\n  template<typename _Tp>\n    inline void\n    __valarray_fill(_Tp* __restrict__ __a, size_t __n, const _Tp& __t)\n    {\n      while (__n--)\n\t*__a++ = __t;\n    }\n  \n  // fill strided array __a[<__n-1 : __s>] with __t\n  template<typename _Tp>\n    inline void\n    __valarray_fill(_Tp* __restrict__ __a, size_t __n,\n\t\t    size_t __s, const _Tp& __t)\n    { \n      for (size_t __i = 0; __i < __n; ++__i, __a += __s)\n\t*__a = __t;\n    }\n\n  // fill indir   ect array __a[__i[<__n>]] with __i\n  template<typename _Tp>\n    inline void\n    __valarray_fill(_Tp* __restrict__ __a, const size_t* __restrict__ __i,\n\t\t    size_t __n, const _Tp& __t)\n    {\n      for (size_t __j = 0; __j < __n; ++__j, ++__i)\n\t__a[*__i] = __t;\n    }\n  \n  // copy plain array __a[<__n>] in __b[<__n>]\n  // For non-fundamental types, it is wrong to say 'memcpy()'\n  template<typename _Tp, bool>\n    struct _Array_copier\n    {\n      inline static void\n      _S_do_it(const _Tp* __restrict__ __a, size_t __n, _Tp* __restrict__ __b)\n      {\n\twhile(__n--)\n\t  *__b++ = *__a++;\n      }\n    };\n\n  template<typename _Tp>\n    struct _Array_copier<_Tp, true>\n    {\n      inline static void\n      _S_do_it(const _Tp* __restrict__ __a, size_t __n, _Tp* __restrict__ __b)\n      { std::memcpy (__b, __a, __n * sizeof (_Tp)); }\n    };\n\n  // Copy a plain array __a[<__n>] into a play array __b[<>]\n  template<typename _Tp>\n    inline void\n    __valarray_copy(const _Tp* __restrict__ __a, size_t __n,\n\t\t    _Tp* __restrict__ __b)\n    {\n      _Array_copier<_Tp, __is_pod<_Tp>::__value>::_S_do_it(__a, __n, __b);\n    }\n\n  // Copy strided array __a[<__n : __s>] in plain __b[<__n>]\n  template<typename _Tp>\n    inline void\n    __valarray_copy(const _Tp* __restrict__ __a, size_t __n, size_t __s,\n\t\t    _Tp* __restrict__ __b)\n    {\n      for (size_t __i = 0; __i < __n; ++__i, ++__b, __a += __s)\n\t*__b = *__a;\n    }\n\n  // Copy a plain array  __a[<__n>] into a strided array __b[<__n : __s>]\n  template<typename _Tp>\n    inline void\n    __valarray_copy(const _Tp* __restrict__ __a, _Tp* __restrict__ __b,\n\t\t    size_t __n, size_t __s)\n    {\n      for (size_t __i = 0; __i < __n; ++__i, ++__a, __b += __s)\n\t*__b = *__a;\n    }\n\n  // Copy strided array __src[<__n : __s1>] into another\n  // strided array __dst[< : __s2>].  Their sizes must match.\n  template<typename _Tp>\n    inline void\n    __valarray_copy(const _Tp* __restrict__ __src, size_t __n, size_t __s1,\n\t\t    _Tp* __restrict__ __dst, size_t __s2)\n    {\n      for (size_t __i = 0; __i < __n; ++__i)\n\t__dst[__i * __s2] = __src[__i * __s1];\n    }\n\n  // Copy an indexed array __a[__i[<__n>]] in plain array __b[<__n>]\n  template<typename _Tp>\n    inline void\n    __valarray_copy(const _Tp* __restrict__ __a,\n\t\t    const size_t* __restrict__ __i,\n\t\t    _Tp* __restrict__ __b, size_t __n)\n    {\n      for (size_t __j = 0; __j < __n; ++__j, ++__b, ++__i)\n\t*__b = __a[*__i];\n    }\n\n  // Copy a plain array __a[<__n>] in an indexed array __b[__i[<__n>]]\n  template<typename _Tp>\n    inline void\n    __valarray_copy(const _Tp* __restrict__ __a, size_t __n,\n\t\t    _Tp* __restrict__ __b, const size_t* __restrict__ __i)\n    {\n      for (size_t __j = 0; __j < __n; ++__j, ++__a, ++__i)\n\t__b[*__i] = *__a;\n    }\n\n  // Copy the __n first elements of an indexed array __src[<__i>] into\n  // another indexed array __dst[<__j>].\n  template<typename _Tp>\n    inline void\n    __valarray_copy(const _Tp* __restrict__ __src, size_t __n,\n\t\t    const size_t* __restrict__ __i,\n\t\t    _Tp* __restrict__ __dst, const size_t* __restrict__ __j)\n    {\n      for (size_t __k = 0; __k < __n; ++__k)\n\t__dst[*__j++] = __src[*__i++];\n    }\n\n  //\n  // Compute the sum of elements in range [__f, __l)\n  // This is a naive algorithm.  It suffers from cancelling.\n  // In the future try to specialize\n  // for _Tp = float, double, long double using a more accurate\n  // algorithm.\n  //\n  template<typename _Tp>\n    inline _Tp\n    __valarray_sum(const _Tp* __restrict__ __f, const _Tp* __restrict__ __l)\n    {\n      _Tp __r = _Tp();\n      while (__f != __l)\n\t__r += *__f++;\n      return __r;\n    }\n\n  // Compute the product of all elements in range [__f, __l)\n  template<typename _Tp>\n    inline _Tp\n    __valarray_product(const _Tp* __restrict__ __f,\n\t\t       const _Tp* __restrict__ __l)\n    {\n      _Tp __r = _Tp(1);\n      while (__f != __l)\n\t__r = __r * *__f++;\n      return __r;\n    }\n\n  // Compute the min/max of an array-expression\n  template<typename _Ta>\n    inline typename _Ta::value_type\n    __valarray_min(const _Ta& __a)\n    {\n      size_t __s = __a.size();\n      typedef typename _Ta::value_type _Value_type;\n      _Value_type __r = __s == 0 ? _Value_type() : __a[0];\n      for (size_t __i = 1; __i < __s; ++__i)\n\t{\n\t  _Value_type __t = __a[__i];\n\t  if (__t < __r)\n\t    __r = __t;\n\t}\n      return __r;\n    }\n\n  template<typename _Ta>\n    inline typename _Ta::value_type\n    __valarray_max(const _Ta& __a)\n    {\n      size_t __s = __a.size();\n      typedef typename _Ta::value_type _Value_type;\n      _Value_type __r = __s == 0 ? _Value_type() : __a[0];\n      for (size_t __i = 1; __i < __s; ++__i)\n\t{\n\t  _Value_type __t = __a[__i];\n\t  if (__t > __r)\n\t    __r = __t;\n\t}\n      return __r;\n    }\n\n  //\n  // Helper class _Array, first layer of valarray abstraction.\n  // All operations on valarray should be forwarded to this class\n  // whenever possible. -- gdr\n  //\n\n  template<typename _Tp>\n    struct _Array\n    {\n      explicit _Array(size_t);\n      explicit _Array(_Tp* const __restrict__);\n      explicit _Array(const valarray<_Tp>&);\n      _Array(const _Tp* __restrict__, size_t);\n      \n      _Tp* begin() const;\n      \n      _Tp* const __restrict__ _M_data;\n    };\n\n\n  // Copy-construct plain array __b[<__n>] from indexed array __a[__i[<__n>]]\n  template<typename _Tp>\n    inline void\n    __valarray_copy_construct(_Array<_Tp> __a, _Array<size_t> __i,\n\t\t\t      _Array<_Tp> __b, size_t __n)\n    { std::__valarray_copy_construct(__a._M_data, __i._M_data,\n\t\t\t\t     __b._M_data, __n); }\n\n  // Copy-construct plain array __b[<__n>] from strided array __a[<__n : __s>]\n  template<typename _Tp>\n    inline void\n    __valarray_copy_construct(_Array<_Tp> __a, size_t __n, size_t __s,\n\t\t\t      _Array<_Tp> __b)\n    { std::__valarray_copy_construct(__a._M_data, __n, __s, __b._M_data); }\n\n  template<typename _Tp>\n    inline void\n    __valarray_fill (_Array<_Tp> __a, size_t __n, const _Tp& __t)\n    { std::__valarray_fill(__a._M_data, __n, __t); }\n\n  template<typename _Tp>\n    inline void\n    __valarray_fill(_Array<_Tp> __a, size_t __n, size_t __s, const _Tp& __t)\n    { std::__valarray_fill(__a._M_data, __n, __s, __t); }\n\n  template<typename _Tp>\n    inline void\n    __valarray_fill(_Array<_Tp> __a, _Array<size_t> __i,\n\t\t    size_t __n, const _Tp& __t)\n    { std::__valarray_fill(__a._M_data, __i._M_data, __n, __t); }\n\n  // Copy a plain array __a[<__n>] into a play array __b[<>]\n  template<typename _Tp>\n    inline void\n    __valarray_copy(_Array<_Tp> __a, size_t __n, _Array<_Tp> __b)\n    { std::__valarray_copy(__a._M_data, __n, __b._M_data); }\n\n  // Copy strided array __a[<__n : __s>] in plain __b[<__n>]\n  template<typename _Tp>\n    inline void\n    __valarray_copy(_Array<_Tp> __a, size_t __n, size_t __s, _Array<_Tp> __b)\n    { std::__valarray_copy(__a._M_data, __n, __s, __b._M_data); }\n\n  // Copy a plain array  __a[<__n>] into a strided array __b[<__n : __s>]\n  template<typename _Tp>\n    inline void\n    __valarray_copy(_Array<_Tp> __a, _Array<_Tp> __b, size_t __n, size_t __s)\n    { __valarray_copy(__a._M_data, __b._M_data, __n, __s); }\n\n  // Copy strided array __src[<__n : __s1>] into another\n  // strided array __dst[< : __s2>].  Their sizes must match.\n  template<typename _Tp>\n    inline void\n    __valarray_copy(_Array<_Tp> __a, size_t __n, size_t __s1,\n                    _Array<_Tp> __b, size_t __s2)\n    { std::__valarray_copy(__a._M_data, __n, __s1, __b._M_data, __s2); }\n\n  // Copy an indexed array __a[__i[<__n>]] in plain array __b[<__n>]\n  template<typename _Tp>\n    inline void\n    __valarray_copy(_Array<_Tp> __a, _Array<size_t> __i,\n\t\t    _Array<_Tp> __b, size_t __n)\n    { std::__valarray_copy(__a._M_data, __i._M_data, __b._M_data, __n); }\n\n  // Copy a plain array __a[<__n>] in an indexed array __b[__i[<__n>]]\n  template<typename _Tp>\n    inline void\n    __valarray_copy(_Array<_Tp> __a, size_t __n, _Array<_Tp> __b,\n\t\t    _Array<size_t> __i)\n    { std::__valarray_copy(__a._M_data, __n, __b._M_data, __i._M_data); }\n\n  // Copy the __n first elements of an indexed array __src[<__i>] into\n  // another indexed array __dst[<__j>].\n  template<typename _Tp>\n    inline void\n    __valarray_copy(_Array<_Tp> __src, size_t __n, _Array<size_t> __i,\n                    _Array<_Tp> __dst, _Array<size_t> __j)\n    {\n      std::__valarray_copy(__src._M_data, __n, __i._M_data,\n\t\t    __dst._M_data, __j._M_data);\n    }\n\n  template<typename _Tp>\n    inline\n    _Array<_Tp>::_Array(size_t __n)\n    : _M_data(__valarray_get_storage<_Tp>(__n))\n    { std::__valarray_default_construct(_M_data, _M_data + __n); }\n\n  template<typename _Tp>\n    inline\n    _Array<_Tp>::_Array(_Tp* const __restrict__ __p)\n    : _M_data (__p) {}\n\n  template<typename _Tp>\n    inline\n    _Array<_Tp>::_Array(const valarray<_Tp>& __v)\n    : _M_data (__v._M_data) {}\n\n  template<typename _Tp>\n    inline\n    _Array<_Tp>::_Array(const _Tp* __restrict__ __b, size_t __s)\n    : _M_data(__valarray_get_storage<_Tp>(__s))\n    { std::__valarray_copy_construct(__b, __s, _M_data); }\n\n  template<typename _Tp>\n    inline _Tp*\n    _Array<_Tp>::begin () const\n    { return _M_data; }\n\n#define _DEFINE_ARRAY_FUNCTION(_Op, _Name)\t\t\t\t\\\n  template<typename _Tp>\t\t        \t\t\t\\\n    inline void\t\t\t\t\t\t\t\t\\\n    _Array_augmented_##_Name(_Array<_Tp> __a, size_t __n, const _Tp& __t) \\\n    {\t\t\t\t\t\t\t\t\t\\\n      for (_Tp* __p = __a._M_data; __p < __a._M_data + __n; ++__p)\t\\\n        *__p _Op##= __t;\t\t\t\t\t\t\\\n    }\t\t\t\t\t\t\t\t\t\\\n\t\t\t\t\t\t\t\t\t\\\n  template<typename _Tp>\t\t\t\t\t\t\\\n    inline void\t\t\t\t\t\t\t\t\\\n    _Array_augmented_##_Name(_Array<_Tp> __a, size_t __n, _Array<_Tp> __b) \\\n    {\t\t\t\t\t\t\t\t\t\\\n      _Tp* __p = __a._M_data;\t\t\t\t\t\t\\\n      for (_Tp* __q = __b._M_data; __q < __b._M_data + __n; ++__p, ++__q) \\\n        *__p _Op##= *__q;\t\t\t\t\t\t\\\n    }\t\t\t\t\t\t\t\t\t\\\n\t\t\t\t\t\t\t\t\t\\\n  template<typename _Tp, class _Dom>\t\t\t\t\t\\\n    void\t\t\t\t\t\t\t\t\\\n    _Array_augmented_##_Name(_Array<_Tp> __a,\t        \t\t\\\n                             const _Expr<_Dom, _Tp>& __e, size_t __n)\t\\\n    {\t\t\t\t\t\t\t\t\t\\\n      _Tp* __p(__a._M_data);\t\t\t\t\t\t\\\n      for (size_t __i = 0; __i < __n; ++__i, ++__p)                     \\\n        *__p _Op##= __e[__i];                                          \t\\\n    }\t\t\t\t\t\t\t\t\t\\\n\t\t\t\t\t\t\t\t\t\\\n  template<typename _Tp>\t\t\t\t\t\t\\\n    inline void\t\t\t\t\t\t\t\t\\\n    _Array_augmented_##_Name(_Array<_Tp> __a, size_t __n, size_t __s,\t\\\n\t                     _Array<_Tp> __b)\t\t\t\t\\\n    {\t\t\t\t\t\t\t\t\t\\\n      _Tp* __q(__b._M_data);\t\t\t\t\t\t\\\n      for (_Tp* __p = __a._M_data; __p < __a._M_data + __s * __n;       \\\n\t   __p += __s, ++__q)                                           \\\n        *__p _Op##= *__q;\t\t\t\t\t\t\\\n    }\t\t\t\t\t\t\t\t\t\\\n\t\t\t\t\t\t\t\t\t\\\n  template<typename _Tp>\t\t\t\t\t\t\\\n    inline void\t\t\t\t\t\t\t\t\\\n    _Array_augmented_##_Name(_Array<_Tp> __a, _Array<_Tp> __b,\t\t\\\n\t\t             size_t __n, size_t __s)\t\t\t\\\n    {\t\t\t\t\t\t\t\t\t\\\n      _Tp* __q(__b._M_data);\t\t\t\t\t\t\\\n      for (_Tp* __p = __a._M_data; __p < __a._M_data + __n;             \\\n\t   ++__p, __q += __s)                                           \\\n        *__p _Op##= *__q;\t\t\t\t\t\t\\\n    }\t\t\t\t\t\t\t\t\t\\\n\t\t\t\t\t\t\t\t\t\\\n  template<typename _Tp, class _Dom>\t\t\t\t\t\\\n    void\t\t\t\t\t\t\t\t\\\n    _Array_augmented_##_Name(_Array<_Tp> __a, size_t __s,\t\t\\\n                             const _Expr<_Dom, _Tp>& __e, size_t __n)\t\\\n    {\t\t\t\t\t\t\t\t\t\\\n      _Tp* __p(__a._M_data);\t\t\t\t\t\t\\\n      for (size_t __i = 0; __i < __n; ++__i, __p += __s)                \\\n        *__p _Op##= __e[__i];                                          \t\\\n    }\t\t\t\t\t\t\t\t\t\\\n\t\t\t\t\t\t\t\t\t\\\n  template<typename _Tp>\t\t\t\t\t\t\\\n    inline void\t\t\t\t\t\t\t\t\\\n    _Array_augmented_##_Name(_Array<_Tp> __a, _Array<size_t> __i,\t\\\n                             _Array<_Tp> __b, size_t __n)\t\t\\\n    {\t\t\t\t\t\t\t\t\t\\\n      _Tp* __q(__b._M_data);\t\t\t\t\t\t\\\n      for (size_t* __j = __i._M_data; __j < __i._M_data + __n;          \\\n           ++__j, ++__q)                                                \\\n        __a._M_data[*__j] _Op##= *__q;\t\t\t\t\t\\\n    }\t\t\t\t\t\t\t\t\t\\\n\t\t\t\t\t\t\t\t\t\\\n  template<typename _Tp>\t\t\t\t\t\t\\\n    inline void\t\t\t\t\t        \t\t\\\n    _Array_augmented_##_Name(_Array<_Tp> __a, size_t __n,\t\t\\\n                             _Array<_Tp> __b, _Array<size_t> __i)\t\\\n    {\t\t\t\t\t\t\t\t\t\\\n      _Tp* __p(__a._M_data);\t\t\t\t\t\t\\\n      for (size_t* __j = __i._M_data; __j<__i._M_data + __n;            \\\n\t   ++__j, ++__p)                                                \\\n        *__p _Op##= __b._M_data[*__j];\t\t\t\t\t\\\n    }\t\t\t\t\t\t\t\t\t\\\n\t\t\t\t\t\t\t\t\t\\\n  template<typename _Tp, class _Dom>\t\t\t\t\t\\\n    void\t\t\t\t\t\t\t\t\\\n    _Array_augmented_##_Name(_Array<_Tp> __a, _Array<size_t> __i,\t\\\n                             const _Expr<_Dom, _Tp>& __e, size_t __n)\t\\\n    {\t\t\t\t\t\t\t\t\t\\\n      size_t* __j(__i._M_data);\t        \t\t\t\t\\\n      for (size_t __k = 0; __k<__n; ++__k, ++__j)\t\t\t\\\n        __a._M_data[*__j] _Op##= __e[__k];\t\t\t\t\\\n    }\t\t\t\t\t\t\t\t\t\\\n\t\t\t\t\t\t\t\t\t\\\n  template<typename _Tp>\t\t\t\t\t\t\\\n    void\t\t\t\t\t\t\t\t\\\n    _Array_augmented_##_Name(_Array<_Tp> __a, _Array<bool> __m,         \\\n                             _Array<_Tp> __b, size_t __n)\t\t\\\n    {\t\t\t\t\t\t\t\t\t\\\n      bool* __ok(__m._M_data);\t\t\t\t\t\t\\\n      _Tp* __p(__a._M_data);\t\t\t\t\t\t\\\n      for (_Tp* __q = __b._M_data; __q < __b._M_data + __n;             \\\n\t   ++__q, ++__ok, ++__p)                                        \\\n        {                                                               \\\n          while (! *__ok)                                               \\\n            {\t\t\t\t\t\t        \t\\\n              ++__ok;\t\t\t\t\t\t\t\\\n              ++__p;\t\t\t\t\t\t\t\\\n            }\t\t\t\t\t\t\t\t\\\n          *__p _Op##= *__q;\t\t\t\t\t\t\\\n        }\t\t\t\t\t\t\t\t\\\n    }\t\t\t\t\t\t\t\t\t\\\n\t\t\t\t\t\t\t\t\t\\\n  template<typename _Tp>\t\t\t\t\t\t\\\n    void\t\t\t\t\t\t\t\t\\\n    _Array_augmented_##_Name(_Array<_Tp> __a, size_t __n,\t\t\\\n                             _Array<_Tp> __b, _Array<bool> __m)   \t\\\n    {\t\t\t\t\t\t\t\t\t\\\n      bool* __ok(__m._M_data);\t\t\t\t\t\t\\\n      _Tp* __q(__b._M_data);\t\t\t\t\t\t\\\n      for (_Tp* __p = __a._M_data; __p < __a._M_data + __n;             \\\n\t   ++__p, ++__ok, ++__q)                                        \\\n        {                                                               \\\n          while (! *__ok)                                               \\\n            {\t\t\t\t\t        \t\t\\\n              ++__ok;\t\t\t\t\t\t\t\\\n              ++__q;\t\t\t\t\t\t\t\\\n            }\t\t\t\t\t\t\t\t\\\n          *__p _Op##= *__q;\t\t\t\t\t\t\\\n        }\t\t\t\t\t\t\t\t\\\n    }\t\t\t\t\t\t\t\t\t\\\n\t\t\t\t\t\t\t\t\t\\\n  template<typename _Tp, class _Dom>\t\t\t\t\t\\\n    void\t\t\t\t\t\t\t\t\\\n    _Array_augmented_##_Name(_Array<_Tp> __a, _Array<bool> __m,  \t\\\n                             const _Expr<_Dom, _Tp>& __e, size_t __n)\t\\\n    {\t\t\t\t\t\t\t\t\t\\\n      bool* __ok(__m._M_data);\t\t\t\t\t\t\\\n      _Tp* __p(__a._M_data);\t\t\t\t\t\t\\\n      for (size_t __i = 0; __i < __n; ++__i, ++__ok, ++__p)             \\\n        {\t                                           \t\t\\\n          while (! *__ok)                                               \\\n            {\t\t         \t\t\t\t\t\\\n\t      ++__ok;\t\t\t\t\t\t\t\\\n              ++__p;\t\t\t\t\t\t\t\\\n            }\t\t\t\t\t\t\t\t\\\n          *__p _Op##= __e[__i];\t\t\t\t\t\t\\\n        }\t\t\t\t\t\t\t\t\\\n    }\n\n   _DEFINE_ARRAY_FUNCTION(+, __plus)\n   _DEFINE_ARRAY_FUNCTION(-, __minus)\n   _DEFINE_ARRAY_FUNCTION(*, __multiplies)\n   _DEFINE_ARRAY_FUNCTION(/, __divides)\n   _DEFINE_ARRAY_FUNCTION(%, __modulus)\n   _DEFINE_ARRAY_FUNCTION(^, __bitwise_xor)\n   _DEFINE_ARRAY_FUNCTION(|, __bitwise_or)\n   _DEFINE_ARRAY_FUNCTION(&, __bitwise_and)\n   _DEFINE_ARRAY_FUNCTION(<<, __shift_left)\n   _DEFINE_ARRAY_FUNCTION(>>, __shift_right)\n\n#undef _DEFINE_ARRAY_FUNCTION\n\n_GLIBCXX_END_NAMESPACE\n\n#ifndef _GLIBCXX_EXPORT_TEMPLATE\n# include <bits/valarray_array.tcc>\n#endif\n\n#endif /* _ARRAY_H */\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/bits/valarray_array.tcc",
    "content": "// The template and inlines for the -*- C++ -*- internal _Array helper class.\n\n// Copyright (C) 1997, 1998, 1999, 2003, 2005 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n/** @file valarray_array.tcc\n *  This is an internal header file, included by other library headers.\n *  You should not attempt to use it directly.\n */\n\n// Written by Gabriel Dos Reis <Gabriel.Dos-Reis@DPTMaths.ENS-Cachan.Fr>\n\n#ifndef _VALARRAY_ARRAY_TCC\n#define _VALARRAY_ARRAY_TCC 1\n\n_GLIBCXX_BEGIN_NAMESPACE(std)\n\n  template<typename _Tp>\n    void\n    __valarray_fill(_Array<_Tp> __a, size_t __n, _Array<bool> __m,\n\t\t    const _Tp& __t)\n    {\n      _Tp* __p = __a._M_data;\n      bool* __ok (__m._M_data);\n      for (size_t __i=0; __i < __n; ++__i, ++__ok, ++__p)\n\t{\n\t  while (!*__ok)\n\t  {\n\t    ++__ok;\n\t    ++__p;\n\t  }\n\t  *__p = __t;\n\t}\n    }\n\n  // Copy n elements of a into consecutive elements of b.  When m is\n  // false, the corresponding element of a is skipped.  m must contain\n  // at least n true elements.  a must contain at least n elements and\n  // enough elements to match up with m through the nth true element\n  // of m.  I.e.  if n is 10, m has 15 elements with 5 false followed\n  // by 10 true, a must have 15 elements.\n  template<typename _Tp>\n    void\n    __valarray_copy(_Array<_Tp> __a, _Array<bool> __m, _Array<_Tp> __b,\n\t\t    size_t __n)\n    {\n      _Tp* __p (__a._M_data);\n      bool* __ok (__m._M_data);\n      for (_Tp* __q = __b._M_data; __q < __b._M_data + __n;\n\t   ++__q, ++__ok, ++__p)\n\t{\n\t  while (! *__ok)\n\t    {\n\t      ++__ok;\n\t      ++__p;\n\t    }\n\t  *__q = *__p;\n\t}\n    }\n\n  // Copy n consecutive elements from a into elements of b.  Elements\n  // of b are skipped if the corresponding element of m is false.  m\n  // must contain at least n true elements.  b must have at least as\n  // many elements as the index of the nth true element of m.  I.e. if\n  // m has 15 elements with 5 false followed by 10 true, b must have\n  // at least 15 elements.\n  template<typename _Tp>\n    void\n    __valarray_copy(_Array<_Tp> __a, size_t __n, _Array<_Tp> __b,\n\t\t    _Array<bool> __m)\n    {\n      _Tp* __q (__b._M_data);\n      bool* __ok (__m._M_data);\n      for (_Tp* __p = __a._M_data; __p < __a._M_data+__n;\n\t   ++__p, ++__ok, ++__q)\n\t{\n\t  while (! *__ok)\n\t    {\n\t      ++__ok;\n\t      ++__q;\n\t    }\n\t  *__q = *__p;\n\t}\n    }\n\n  // Copy n elements from a into elements of b.  Elements of a are\n  // skipped if the corresponding element of m is false.  Elements of\n  // b are skipped if the corresponding element of k is false.  m and\n  // k must contain at least n true elements.  a and b must have at\n  // least as many elements as the index of the nth true element of m.\n  template<typename _Tp>\n    void\n    __valarray_copy(_Array<_Tp> __a, _Array<bool> __m, size_t __n,\n\t\t    _Array<_Tp> __b, _Array<bool> __k)\n    {\n      _Tp* __p (__a._M_data);\n      _Tp* __q (__b._M_data);\n      bool* __srcok (__m._M_data);\n      bool* __dstok (__k._M_data);\n      for (size_t __i = 0; __i < __n;\n\t   ++__srcok, ++__p, ++__dstok, ++__q, ++__i)\n\t{\n\t  while (! *__srcok)\n\t    {\n\t      ++__srcok;\n\t      ++__p;\n\t    }\n\t  while (! *__dstok) \n\t    {\n\t      ++__dstok;\n\t      ++__q;\n\t    }\n\t  *__q = *__p;\n\t}\n    }\n\n  // Copy n consecutive elements of e into consecutive elements of a.\n  // I.e. a[i] = e[i].\n  template<typename _Tp, class _Dom>\n    void\n    __valarray_copy(const _Expr<_Dom, _Tp>& __e, size_t __n, _Array<_Tp> __a)\n    {\n      _Tp* __p (__a._M_data);\n      for (size_t __i = 0; __i < __n; ++__i, ++__p)\n\t*__p = __e[__i];\n    }\n\n  // Copy n consecutive elements of e into elements of a using stride\n  // s.  I.e., a[0] = e[0], a[s] = e[1], a[2*s] = e[2].\n  template<typename _Tp, class _Dom>\n    void\n    __valarray_copy(const _Expr<_Dom, _Tp>& __e, size_t __n,\n\t\t     _Array<_Tp> __a, size_t __s)\n    {\n      _Tp* __p (__a._M_data);\n      for (size_t __i = 0; __i < __n; ++__i, __p += __s)\n\t*__p = __e[__i];\n    }\n\n  // Copy n consecutive elements of e into elements of a indexed by\n  // contents of i.  I.e., a[i[0]] = e[0].\n  template<typename _Tp, class _Dom>\n    void\n    __valarray_copy(const _Expr<_Dom, _Tp>& __e, size_t __n,\n\t\t    _Array<_Tp> __a, _Array<size_t> __i)\n    {\n      size_t* __j (__i._M_data);\n      for (size_t __k = 0; __k < __n; ++__k, ++__j)\n\t__a._M_data[*__j] = __e[__k];\n    }\n\n  // Copy n elements of e indexed by contents of f into elements of a\n  // indexed by contents of i.  I.e., a[i[0]] = e[f[0]].\n  template<typename _Tp>\n    void\n    __valarray_copy(_Array<_Tp> __e, _Array<size_t> __f,\n\t\t    size_t __n, \n\t\t    _Array<_Tp> __a, _Array<size_t> __i)\n    {\n      size_t* __g (__f._M_data);\n      size_t* __j (__i._M_data);\n      for (size_t __k = 0; __k < __n; ++__k, ++__j, ++__g) \n\t__a._M_data[*__j] = __e._M_data[*__g];\n    }\n\n  // Copy n consecutive elements of e into elements of a.  Elements of\n  // a are skipped if the corresponding element of m is false.  m must\n  // have at least n true elements and a must have at least as many\n  // elements as the index of the nth true element of m.  I.e. if m\n  // has 5 false followed by 10 true elements and n == 10, a must have\n  // at least 15 elements.\n  template<typename _Tp, class _Dom>\n    void\n    __valarray_copy(const _Expr<_Dom, _Tp>& __e, size_t __n,\n\t\t    _Array<_Tp> __a, _Array<bool> __m)\n    {\n      bool* __ok (__m._M_data);\n      _Tp* __p (__a._M_data);\n      for (size_t __i = 0; __i < __n; ++__i, ++__ok, ++__p)\n\t{\n\t  while (! *__ok)\n\t    {\n\t      ++__ok;\n\t      ++__p;\n\t    }\n\t  *__p = __e[__i];\n\t}\n    }\n\n\n  template<typename _Tp, class _Dom>\n    void\n    __valarray_copy_construct(const _Expr<_Dom, _Tp>& __e, size_t __n,\n\t\t\t      _Array<_Tp> __a)\n    {\n      _Tp* __p (__a._M_data);\n      for (size_t __i = 0; __i < __n; ++__i, ++__p)\n\tnew (__p) _Tp(__e[__i]);\n    }\n\n\n  template<typename _Tp>\n    void\n    __valarray_copy_construct(_Array<_Tp> __a, _Array<bool> __m,\n\t\t\t      _Array<_Tp> __b, size_t __n)\n    {\n      _Tp* __p (__a._M_data);\n      bool* __ok (__m._M_data);\n      for (_Tp* __q = __b._M_data; __q < __b._M_data+__n; ++__q, ++__ok, ++__p)\n\t{\n\t  while (! *__ok)\n\t    {\n\t      ++__ok;\n\t      ++__p;\n\t    }\n\t  new (__q) _Tp(*__p);\n\t}\n    }\n\n_GLIBCXX_END_NAMESPACE\n\n#endif /* _VALARRAY_ARRAY_TCC */\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/bits/valarray_before.h",
    "content": "// The template and inlines for the -*- C++ -*- internal _Meta class.\n\n// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006\n// Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n/** @file valarray_before.h\n *  This is an internal header file, included by other library headers.\n *  You should not attempt to use it directly.\n */\n\n// Written by Gabriel Dos Reis <Gabriel.Dos-Reis@cmla.ens-cachan.fr>\n\n#ifndef _VALARRAY_BEFORE_H\n#define _VALARRAY_BEFORE_H 1\n\n#pragma GCC system_header\n\n#include <bits/slice_array.h>\n\n_GLIBCXX_BEGIN_NAMESPACE(std)\n\n  //\n  // Implementing a loosened valarray return value is tricky.\n  // First we need to meet 26.3.1/3: we should not add more than\n  // two levels of template nesting. Therefore we resort to template\n  // template to \"flatten\" loosened return value types.\n  // At some point we use partial specialization to remove one level\n  // template nesting due to _Expr<>\n  //\n\n  // This class is NOT defined. It doesn't need to.\n  template<typename _Tp1, typename _Tp2> class _Constant;\n\n  // Implementations of unary functions applied to valarray<>s.\n  // I use hard-coded object functions here instead of a generic\n  // approach like pointers to function:\n  //    1) correctness: some functions take references, others values.\n  //       we can't deduce the correct type afterwards.\n  //    2) efficiency -- object functions can be easily inlined\n  //    3) be Koenig-lookup-friendly\n\n  struct __abs\n  {\n    template<typename _Tp>\n      _Tp operator()(const _Tp& __t) const\n      { return abs(__t); }\n  };\n\n  struct __cos\n  {\n    template<typename _Tp>\n      _Tp operator()(const _Tp& __t) const\n      { return cos(__t); }\n  };\n\n  struct __acos\n  {\n    template<typename _Tp>\n      _Tp operator()(const _Tp& __t) const\n      { return acos(__t); }\n  };\n\n  struct __cosh\n  {\n    template<typename _Tp>\n      _Tp operator()(const _Tp& __t) const\n      { return cosh(__t); }\n  };\n\n  struct __sin\n  {\n    template<typename _Tp>\n      _Tp operator()(const _Tp& __t) const\n      { return sin(__t); }\n  };\n\n  struct __asin\n  {\n    template<typename _Tp>\n      _Tp operator()(const _Tp& __t) const\n      { return asin(__t); }\n  };\n\n  struct __sinh\n  {\n    template<typename _Tp>\n      _Tp operator()(const _Tp& __t) const\n      { return sinh(__t); }\n  };\n\n  struct __tan\n  {\n    template<typename _Tp>\n      _Tp operator()(const _Tp& __t) const\n      { return tan(__t); }\n  };\n\n  struct __atan\n  {\n    template<typename _Tp>\n      _Tp operator()(const _Tp& __t) const\n      { return atan(__t); }\n  };\n\n  struct __tanh\n  {\n    template<typename _Tp>\n      _Tp operator()(const _Tp& __t) const\n      { return tanh(__t); }\n  };\n\n  struct __exp\n  {\n    template<typename _Tp>\n      _Tp operator()(const _Tp& __t) const\n      { return exp(__t); }\n  };\n\n  struct __log\n  {\n    template<typename _Tp>\n      _Tp operator()(const _Tp& __t) const\n      { return log(__t); }\n  };\n\n  struct __log10\n  {\n    template<typename _Tp>\n      _Tp operator()(const _Tp& __t) const\n      { return log10(__t); }\n  };\n\n  struct __sqrt\n  {\n    template<typename _Tp>\n      _Tp operator()(const _Tp& __t) const\n      { return sqrt(__t); }\n  };\n\n  // In the past, we used to tailor operator applications semantics\n  // to the specialization of standard function objects (i.e. plus<>, etc.)\n  // That is incorrect.  Therefore we provide our own surrogates.\n\n  struct __unary_plus\n  {\n    template<typename _Tp>\n      _Tp operator()(const _Tp& __t) const\n      { return +__t; }\n  };\n\n  struct __negate\n  {\n    template<typename _Tp>\n      _Tp operator()(const _Tp& __t) const\n      { return -__t; }\n  };\n\n  struct __bitwise_not\n  {\n    template<typename _Tp>\n      _Tp operator()(const _Tp& __t) const\n      { return ~__t; }\n  };\n\n  struct __plus\n  {\n    template<typename _Tp>\n      _Tp operator()(const _Tp& __x, const _Tp& __y) const\n      { return __x + __y; }\n  };\n\n  struct __minus\n  {\n    template<typename _Tp>\n      _Tp operator()(const _Tp& __x, const _Tp& __y) const\n      { return __x - __y; }\n  };\n\n  struct __multiplies\n  {\n    template<typename _Tp>\n      _Tp operator()(const _Tp& __x, const _Tp& __y) const\n      { return __x * __y; }\n  };\n\n  struct __divides\n  {\n    template<typename _Tp>\n      _Tp operator()(const _Tp& __x, const _Tp& __y) const\n      { return __x / __y; }\n  };\n\n  struct __modulus\n  {\n    template<typename _Tp>\n      _Tp operator()(const _Tp& __x, const _Tp& __y) const\n      { return __x % __y; }\n  };\n\n  struct __bitwise_xor\n  {\n    template<typename _Tp>\n      _Tp operator()(const _Tp& __x, const _Tp& __y) const\n      { return __x ^ __y; }\n  };\n\n  struct __bitwise_and\n  {\n    template<typename _Tp>\n      _Tp operator()(const _Tp& __x, const _Tp& __y) const\n      { return __x & __y; }\n  };\n\n  struct __bitwise_or\n  {\n    template<typename _Tp>\n      _Tp operator()(const _Tp& __x, const _Tp& __y) const\n      { return __x | __y; }\n  };\n\n  struct __shift_left\n  {\n    template<typename _Tp>\n      _Tp operator()(const _Tp& __x, const _Tp& __y) const\n      { return __x << __y; }\n  };\n\n  struct __shift_right\n  {\n    template<typename _Tp>\n      _Tp operator()(const _Tp& __x, const _Tp& __y) const\n      { return __x >> __y; }\n  };\n\n  struct __logical_and\n  {\n    template<typename _Tp>\n      bool operator()(const _Tp& __x, const _Tp& __y) const\n      { return __x && __y; }\n  };\n\n  struct __logical_or\n  {\n    template<typename _Tp>\n      bool operator()(const _Tp& __x, const _Tp& __y) const\n      { return __x || __y; }\n  };\n\n  struct __logical_not\n  {\n    template<typename _Tp>\n      bool operator()(const _Tp& __x) const { return !__x; }\n  };\n\n  struct __equal_to\n  {\n    template<typename _Tp>\n      bool operator()(const _Tp& __x, const _Tp& __y) const\n      { return __x == __y; }\n  };\n\n  struct __not_equal_to\n  {\n    template<typename _Tp>\n      bool operator()(const _Tp& __x, const _Tp& __y) const\n      { return __x != __y; }\n  };\n\n  struct __less\n  {\n    template<typename _Tp>\n      bool operator()(const _Tp& __x, const _Tp& __y) const\n      { return __x < __y; }\n  };\n\n  struct __greater\n  {\n    template<typename _Tp>\n      bool operator()(const _Tp& __x, const _Tp& __y) const\n      { return __x > __y; }\n  };\n\n  struct __less_equal\n  {\n    template<typename _Tp>\n      bool operator()(const _Tp& __x, const _Tp& __y) const\n      { return __x <= __y; }\n  };\n\n  struct __greater_equal\n  {\n    template<typename _Tp>\n      bool operator()(const _Tp& __x, const _Tp& __y) const\n      { return __x >= __y; }\n  };\n\n  // The few binary functions we miss.\n  struct __atan2\n  {\n    template<typename _Tp>\n      _Tp operator()(const _Tp& __x, const _Tp& __y) const\n      { return atan2(__x, __y); }\n  };\n\n  struct __pow\n  {\n    template<typename _Tp>\n      _Tp operator()(const _Tp& __x, const _Tp& __y) const\n      { return pow(__x, __y); }\n  };\n\n\n  // We need these bits in order to recover the return type of\n  // some functions/operators now that we're no longer using\n  // function templates.\n  template<typename, typename _Tp>\n    struct __fun\n    {\n      typedef _Tp result_type;\n    };\n\n  // several specializations for relational operators.\n  template<typename _Tp>\n    struct __fun<__logical_not, _Tp>\n    {\n      typedef bool result_type;\n    };\n\n  template<typename _Tp>\n    struct __fun<__logical_and, _Tp>\n    {\n      typedef bool result_type;\n    };\n\n  template<typename _Tp>\n    struct __fun<__logical_or, _Tp>\n    {\n      typedef bool result_type;\n    };\n\n  template<typename _Tp>\n    struct __fun<__less, _Tp>\n    {\n      typedef bool result_type;\n    };\n\n  template<typename _Tp>\n    struct __fun<__greater, _Tp>\n    {\n      typedef bool result_type;\n    };\n\n  template<typename _Tp>\n    struct __fun<__less_equal, _Tp>\n    {\n      typedef bool result_type;\n    };\n\n  template<typename _Tp>\n    struct __fun<__greater_equal, _Tp>\n    {\n      typedef bool result_type;\n    };\n\n  template<typename _Tp>\n    struct __fun<__equal_to, _Tp>\n    {\n      typedef bool result_type;\n    };\n\n  template<typename _Tp>\n    struct __fun<__not_equal_to, _Tp>\n    {\n      typedef bool result_type;\n    };\n\n  //\n  // Apply function taking a value/const reference closure\n  //\n\n  template<typename _Dom, typename _Arg>\n    class _FunBase\n    {\n    public:\n      typedef typename _Dom::value_type value_type;\n\n      _FunBase(const _Dom& __e, value_type __f(_Arg))\n      : _M_expr(__e), _M_func(__f) {}\n\n      value_type operator[](size_t __i) const\n      { return _M_func (_M_expr[__i]); }\n\n      size_t size() const { return _M_expr.size ();}\n\n    private:\n      const _Dom& _M_expr;\n      value_type (*_M_func)(_Arg);\n    };\n\n  template<class _Dom>\n    struct _ValFunClos<_Expr,_Dom> : _FunBase<_Dom, typename _Dom::value_type>\n    {\n      typedef _FunBase<_Dom, typename _Dom::value_type> _Base;\n      typedef typename _Base::value_type value_type;\n      typedef value_type _Tp;\n\n      _ValFunClos(const _Dom& __e, _Tp __f(_Tp)) : _Base(__e, __f) {}\n    };\n\n  template<typename _Tp>\n    struct _ValFunClos<_ValArray,_Tp> : _FunBase<valarray<_Tp>, _Tp>\n    {\n      typedef _FunBase<valarray<_Tp>, _Tp> _Base;\n      typedef _Tp value_type;\n\n      _ValFunClos(const valarray<_Tp>& __v, _Tp __f(_Tp)) : _Base(__v, __f) {}\n    };\n\n  template<class _Dom>\n    struct _RefFunClos<_Expr, _Dom>\n    : _FunBase<_Dom, const typename _Dom::value_type&>\n    {\n      typedef _FunBase<_Dom, const typename _Dom::value_type&> _Base;\n      typedef typename _Base::value_type value_type;\n      typedef value_type _Tp;\n\n      _RefFunClos(const _Dom& __e, _Tp __f(const _Tp&))\n      : _Base(__e, __f) {}\n    };\n\n  template<typename _Tp>\n    struct _RefFunClos<_ValArray, _Tp>\n    : _FunBase<valarray<_Tp>, const _Tp&>\n    {\n      typedef _FunBase<valarray<_Tp>, const _Tp&> _Base;\n      typedef _Tp value_type;\n\n      _RefFunClos(const valarray<_Tp>& __v, _Tp __f(const _Tp&))\n      : _Base(__v, __f) {}\n    };\n\n  //\n  // Unary expression closure.\n  //\n\n  template<class _Oper, class _Arg>\n    class _UnBase\n    {\n    public:\n      typedef typename _Arg::value_type _Vt;\n      typedef typename __fun<_Oper, _Vt>::result_type value_type;\n\n      _UnBase(const _Arg& __e) : _M_expr(__e) {}\n\n      value_type operator[](size_t __i) const\n      { return _Oper()(_M_expr[__i]); }\n\n      size_t size() const { return _M_expr.size(); }\n      \n    private:\n      const _Arg& _M_expr;\n    };\n\n  template<class _Oper, class _Dom>\n    struct _UnClos<_Oper, _Expr, _Dom>\n    : _UnBase<_Oper, _Dom>\n    {\n      typedef _Dom _Arg;\n      typedef _UnBase<_Oper, _Dom> _Base;\n      typedef typename _Base::value_type value_type;\n\n      _UnClos(const _Arg& __e) : _Base(__e) {}\n    };\n\n  template<class _Oper, typename _Tp>\n    struct _UnClos<_Oper, _ValArray, _Tp>\n    : _UnBase<_Oper, valarray<_Tp> >\n    {\n      typedef valarray<_Tp> _Arg;\n      typedef _UnBase<_Oper, valarray<_Tp> > _Base;\n      typedef typename _Base::value_type value_type;\n\n      _UnClos(const _Arg& __e) : _Base(__e) {}\n    };\n\n\n  //\n  // Binary expression closure.\n  //\n\n  template<class _Oper, class _FirstArg, class _SecondArg>\n    class _BinBase\n    {\n    public:\n      typedef typename _FirstArg::value_type _Vt;\n      typedef typename __fun<_Oper, _Vt>::result_type value_type;\n\n      _BinBase(const _FirstArg& __e1, const _SecondArg& __e2)\n      : _M_expr1(__e1), _M_expr2(__e2) {}\n\n      value_type operator[](size_t __i) const\n      { return _Oper()(_M_expr1[__i], _M_expr2[__i]); }\n\n      size_t size() const { return _M_expr1.size(); }\n\n    private:\n      const _FirstArg& _M_expr1;\n      const _SecondArg& _M_expr2;\n    };\n\n\n  template<class _Oper, class _Clos>\n    class _BinBase2\n    {\n    public:\n      typedef typename _Clos::value_type _Vt;\n      typedef typename __fun<_Oper, _Vt>::result_type value_type;\n\n      _BinBase2(const _Clos& __e, const _Vt& __t)\n      : _M_expr1(__e), _M_expr2(__t) {}\n\n      value_type operator[](size_t __i) const\n      { return _Oper()(_M_expr1[__i], _M_expr2); }\n\n      size_t size() const { return _M_expr1.size(); }\n\n    private:\n      const _Clos& _M_expr1;\n      const _Vt& _M_expr2;\n    };\n\n  template<class _Oper, class _Clos>\n    class _BinBase1\n    {\n    public:\n      typedef typename _Clos::value_type _Vt;\n      typedef typename __fun<_Oper, _Vt>::result_type value_type;\n\n      _BinBase1(const _Vt& __t, const _Clos& __e)\n      : _M_expr1(__t), _M_expr2(__e) {}\n\n      value_type operator[](size_t __i) const\n      { return _Oper()(_M_expr1, _M_expr2[__i]); }\n\n      size_t size() const { return _M_expr2.size(); }\n\n    private:\n      const _Vt& _M_expr1;\n      const _Clos& _M_expr2;\n    };\n\n  template<class _Oper, class _Dom1, class _Dom2>\n    struct _BinClos<_Oper, _Expr, _Expr, _Dom1, _Dom2>\n    : _BinBase<_Oper, _Dom1, _Dom2>\n    {\n      typedef _BinBase<_Oper, _Dom1, _Dom2> _Base;\n      typedef typename _Base::value_type value_type;\n\n      _BinClos(const _Dom1& __e1, const _Dom2& __e2) : _Base(__e1, __e2) {}\n    };\n\n  template<class _Oper, typename _Tp>\n    struct _BinClos<_Oper,_ValArray, _ValArray, _Tp, _Tp>\n    : _BinBase<_Oper, valarray<_Tp>, valarray<_Tp> >\n    {\n      typedef _BinBase<_Oper, valarray<_Tp>, valarray<_Tp> > _Base;\n      typedef typename _Base::value_type value_type;\n\n      _BinClos(const valarray<_Tp>& __v, const valarray<_Tp>& __w)\n      : _Base(__v, __w) {}\n    };\n\n  template<class _Oper, class _Dom>\n    struct _BinClos<_Oper, _Expr, _ValArray, _Dom, typename _Dom::value_type>\n    : _BinBase<_Oper, _Dom, valarray<typename _Dom::value_type> >\n    {\n      typedef typename _Dom::value_type _Tp;\n      typedef _BinBase<_Oper,_Dom,valarray<_Tp> > _Base;\n      typedef typename _Base::value_type value_type;\n\n      _BinClos(const _Dom& __e1, const valarray<_Tp>& __e2)\n      : _Base(__e1, __e2) {}\n    };\n\n  template<class _Oper, class _Dom>\n    struct _BinClos<_Oper, _ValArray, _Expr, typename _Dom::value_type, _Dom>\n    : _BinBase<_Oper, valarray<typename _Dom::value_type>,_Dom>\n    {\n      typedef typename _Dom::value_type _Tp;\n      typedef _BinBase<_Oper, valarray<_Tp>, _Dom> _Base;\n      typedef typename _Base::value_type value_type;\n\n      _BinClos(const valarray<_Tp>& __e1, const _Dom& __e2)\n      : _Base(__e1, __e2) {}\n    };\n\n  template<class _Oper, class _Dom>\n    struct _BinClos<_Oper, _Expr, _Constant, _Dom, typename _Dom::value_type>\n    : _BinBase2<_Oper, _Dom>\n    {\n      typedef typename _Dom::value_type _Tp;\n      typedef _BinBase2<_Oper,_Dom> _Base;\n      typedef typename _Base::value_type value_type;\n\n      _BinClos(const _Dom& __e1, const _Tp& __e2) : _Base(__e1, __e2) {}\n    };\n\n  template<class _Oper, class _Dom>\n    struct _BinClos<_Oper, _Constant, _Expr, typename _Dom::value_type, _Dom>\n    : _BinBase1<_Oper, _Dom>\n    {\n      typedef typename _Dom::value_type _Tp;\n      typedef _BinBase1<_Oper, _Dom> _Base;\n      typedef typename _Base::value_type value_type;\n\n      _BinClos(const _Tp& __e1, const _Dom& __e2) : _Base(__e1, __e2) {}\n    };\n\n  template<class _Oper, typename _Tp>\n    struct _BinClos<_Oper, _ValArray, _Constant, _Tp, _Tp>\n    : _BinBase2<_Oper, valarray<_Tp> >\n    {\n      typedef _BinBase2<_Oper,valarray<_Tp> > _Base;\n      typedef typename _Base::value_type value_type;\n\n      _BinClos(const valarray<_Tp>& __v, const _Tp& __t) : _Base(__v, __t) {}\n    };\n\n  template<class _Oper, typename _Tp>\n    struct _BinClos<_Oper, _Constant, _ValArray, _Tp, _Tp>\n    : _BinBase1<_Oper, valarray<_Tp> >\n    {\n      typedef _BinBase1<_Oper, valarray<_Tp> > _Base;\n      typedef typename _Base::value_type value_type;\n\n      _BinClos(const _Tp& __t, const valarray<_Tp>& __v) : _Base(__t, __v) {}\n    };\n\n    //\n    // slice_array closure.\n    //\n  template<typename _Dom> \n    class _SBase\n    {\n    public:\n      typedef typename _Dom::value_type value_type;\n      \n      _SBase (const _Dom& __e, const slice& __s)\n      : _M_expr (__e), _M_slice (__s) {}\n        \n      value_type\n      operator[] (size_t __i) const\n      { return _M_expr[_M_slice.start () + __i * _M_slice.stride ()]; }\n        \n      size_t\n      size() const\n      { return _M_slice.size (); }\n\n    private:\n      const _Dom& _M_expr;\n      const slice& _M_slice;\n    };\n\n  template<typename _Tp>\n    class _SBase<_Array<_Tp> >\n    {\n    public:\n      typedef _Tp value_type;\n      \n      _SBase (_Array<_Tp> __a, const slice& __s)\n      : _M_array (__a._M_data+__s.start()), _M_size (__s.size()),\n\t_M_stride (__s.stride()) {}\n        \n      value_type\n      operator[] (size_t __i) const\n      { return _M_array._M_data[__i * _M_stride]; }\n      \n      size_t\n      size() const\n      { return _M_size; }\n\n    private:\n      const _Array<_Tp> _M_array;\n      const size_t _M_size;\n      const size_t _M_stride;\n    };\n\n  template<class _Dom>\n    struct _SClos<_Expr, _Dom>\n    : _SBase<_Dom>\n    {\n      typedef _SBase<_Dom> _Base;\n      typedef typename _Base::value_type value_type;\n      \n      _SClos (const _Dom& __e, const slice& __s) : _Base (__e, __s) {}\n    };\n\n  template<typename _Tp>\n    struct _SClos<_ValArray, _Tp>\n    : _SBase<_Array<_Tp> >\n    {\n      typedef  _SBase<_Array<_Tp> > _Base;\n      typedef _Tp value_type;\n      \n      _SClos (_Array<_Tp> __a, const slice& __s) : _Base (__a, __s) {}\n    };\n\n_GLIBCXX_END_NAMESPACE\n\n#endif /* _CPP_VALARRAY_BEFORE_H */\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/bits/vector.tcc",
    "content": "// Vector implementation (out of line) -*- C++ -*-\n\n// Copyright (C) 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n/*\n *\n * Copyright (c) 1994\n * Hewlett-Packard Company\n *\n * Permission to use, copy, modify, distribute and sell this software\n * and its documentation for any purpose is hereby granted without fee,\n * provided that the above copyright notice appear in all copies and\n * that both that copyright notice and this permission notice appear\n * in supporting documentation.  Hewlett-Packard Company makes no\n * representations about the suitability of this software for any\n * purpose.  It is provided \"as is\" without express or implied warranty.\n *\n *\n * Copyright (c) 1996\n * Silicon Graphics Computer Systems, Inc.\n *\n * Permission to use, copy, modify, distribute and sell this software\n * and its documentation for any purpose is hereby granted without fee,\n * provided that the above copyright notice appear in all copies and\n * that both that copyright notice and this permission notice appear\n * in supporting documentation.  Silicon Graphics makes no\n * representations about the suitability of this  software for any\n * purpose.  It is provided \"as is\" without express or implied warranty.\n */\n\n/** @file vector.tcc\n *  This is an internal header file, included by other library headers.\n *  You should not attempt to use it directly.\n */\n\n#ifndef _VECTOR_TCC\n#define _VECTOR_TCC 1\n\n_GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD)\n\n  template<typename _Tp, typename _Alloc>\n    void\n    vector<_Tp, _Alloc>::\n    reserve(size_type __n)\n    {\n      if (__n > this->max_size())\n\t__throw_length_error(__N(\"vector::reserve\"));\n      if (this->capacity() < __n)\n\t{\n\t  const size_type __old_size = size();\n\t  pointer __tmp = _M_allocate_and_copy(__n, this->_M_impl._M_start,\n\t\t\t\t\t       this->_M_impl._M_finish);\n\t  std::_Destroy(this->_M_impl._M_start, this->_M_impl._M_finish,\n\t\t\t_M_get_Tp_allocator());\n\t  _M_deallocate(this->_M_impl._M_start,\n\t\t\tthis->_M_impl._M_end_of_storage\n\t\t\t- this->_M_impl._M_start);\n\t  this->_M_impl._M_start = __tmp;\n\t  this->_M_impl._M_finish = __tmp + __old_size;\n\t  this->_M_impl._M_end_of_storage = this->_M_impl._M_start + __n;\n\t}\n    }\n\n  template<typename _Tp, typename _Alloc>\n    typename vector<_Tp, _Alloc>::iterator\n    vector<_Tp, _Alloc>::\n    insert(iterator __position, const value_type& __x)\n    {\n      const size_type __n = __position - begin();\n      if (this->_M_impl._M_finish != this->_M_impl._M_end_of_storage\n\t  && __position == end())\n\t{\n\t  this->_M_impl.construct(this->_M_impl._M_finish, __x);\n\t  ++this->_M_impl._M_finish;\n\t}\n      else\n        _M_insert_aux(__position, __x);\n      return iterator(this->_M_impl._M_start + __n);\n    }\n\n  template<typename _Tp, typename _Alloc>\n    typename vector<_Tp, _Alloc>::iterator\n    vector<_Tp, _Alloc>::\n    erase(iterator __position)\n    {\n      if (__position + 1 != end())\n        std::copy(__position + 1, end(), __position);\n      --this->_M_impl._M_finish;\n      this->_M_impl.destroy(this->_M_impl._M_finish);\n      return __position;\n    }\n\n  template<typename _Tp, typename _Alloc>\n    typename vector<_Tp, _Alloc>::iterator\n    vector<_Tp, _Alloc>::\n    erase(iterator __first, iterator __last)\n    {\n      if (__last != end())\n\tstd::copy(__last, end(), __first);\n      _M_erase_at_end(__first.base() + (end() - __last));\n      return __first;\n    }\n\n  template<typename _Tp, typename _Alloc>\n    vector<_Tp, _Alloc>&\n    vector<_Tp, _Alloc>::\n    operator=(const vector<_Tp, _Alloc>& __x)\n    {\n      if (&__x != this)\n\t{\n\t  const size_type __xlen = __x.size();\n\t  if (__xlen > capacity())\n\t    {\n\t      pointer __tmp = _M_allocate_and_copy(__xlen, __x.begin(),\n\t\t\t\t\t\t   __x.end());\n\t      std::_Destroy(this->_M_impl._M_start, this->_M_impl._M_finish,\n\t\t\t    _M_get_Tp_allocator());\n\t      _M_deallocate(this->_M_impl._M_start,\n\t\t\t    this->_M_impl._M_end_of_storage\n\t\t\t    - this->_M_impl._M_start);\n\t      this->_M_impl._M_start = __tmp;\n\t      this->_M_impl._M_end_of_storage = this->_M_impl._M_start + __xlen;\n\t    }\n\t  else if (size() >= __xlen)\n\t    {\n\t      std::_Destroy(std::copy(__x.begin(), __x.end(), begin()),\n\t\t\t    end(), _M_get_Tp_allocator());\n\t    }\n\t  else\n\t    {\n\t      std::copy(__x._M_impl._M_start, __x._M_impl._M_start + size(),\n\t\t\tthis->_M_impl._M_start);\n\t      std::__uninitialized_copy_a(__x._M_impl._M_start + size(),\n\t\t\t\t\t  __x._M_impl._M_finish,\n\t\t\t\t\t  this->_M_impl._M_finish,\n\t\t\t\t\t  _M_get_Tp_allocator());\n\t    }\n\t  this->_M_impl._M_finish = this->_M_impl._M_start + __xlen;\n\t}\n      return *this;\n    }\n\n  template<typename _Tp, typename _Alloc>\n    void\n    vector<_Tp, _Alloc>::\n    _M_fill_assign(size_t __n, const value_type& __val)\n    {\n      if (__n > capacity())\n\t{\n\t  vector __tmp(__n, __val, _M_get_Tp_allocator());\n\t  __tmp.swap(*this);\n\t}\n      else if (__n > size())\n\t{\n\t  std::fill(begin(), end(), __val);\n\t  std::__uninitialized_fill_n_a(this->_M_impl._M_finish,\n\t\t\t\t\t__n - size(), __val,\n\t\t\t\t\t_M_get_Tp_allocator());\n\t  this->_M_impl._M_finish += __n - size();\n\t}\n      else\n        _M_erase_at_end(std::fill_n(this->_M_impl._M_start, __n, __val));\n    }\n\n  template<typename _Tp, typename _Alloc>\n    template<typename _InputIterator>\n      void\n      vector<_Tp, _Alloc>::\n      _M_assign_aux(_InputIterator __first, _InputIterator __last,\n\t\t    std::input_iterator_tag)\n      {\n\tpointer __cur(this->_M_impl._M_start);\n\tfor (; __first != __last && __cur != this->_M_impl._M_finish;\n\t     ++__cur, ++__first)\n\t  *__cur = *__first;\n\tif (__first == __last)\n\t  _M_erase_at_end(__cur);\n\telse\n\t  insert(end(), __first, __last);\n      }\n\n  template<typename _Tp, typename _Alloc>\n    template<typename _ForwardIterator>\n      void\n      vector<_Tp, _Alloc>::\n      _M_assign_aux(_ForwardIterator __first, _ForwardIterator __last,\n\t\t    std::forward_iterator_tag)\n      {\n\tconst size_type __len = std::distance(__first, __last);\n\n\tif (__len > capacity())\n\t  {\n\t    pointer __tmp(_M_allocate_and_copy(__len, __first, __last));\n\t    std::_Destroy(this->_M_impl._M_start, this->_M_impl._M_finish,\n\t\t\t  _M_get_Tp_allocator());\n\t    _M_deallocate(this->_M_impl._M_start,\n\t\t\t  this->_M_impl._M_end_of_storage\n\t\t\t  - this->_M_impl._M_start);\n\t    this->_M_impl._M_start = __tmp;\n\t    this->_M_impl._M_finish = this->_M_impl._M_start + __len;\n\t    this->_M_impl._M_end_of_storage = this->_M_impl._M_finish;\n\t  }\n\telse if (size() >= __len)\n\t  _M_erase_at_end(std::copy(__first, __last, this->_M_impl._M_start));\n\telse\n\t  {\n\t    _ForwardIterator __mid = __first;\n\t    std::advance(__mid, size());\n\t    std::copy(__first, __mid, this->_M_impl._M_start);\n\t    this->_M_impl._M_finish =\n\t      std::__uninitialized_copy_a(__mid, __last,\n\t\t\t\t\t  this->_M_impl._M_finish,\n\t\t\t\t\t  _M_get_Tp_allocator());\n\t  }\n      }\n\n  template<typename _Tp, typename _Alloc>\n    void\n    vector<_Tp, _Alloc>::\n    _M_insert_aux(iterator __position, const _Tp& __x)\n    {\n      if (this->_M_impl._M_finish != this->_M_impl._M_end_of_storage)\n\t{\n\t  this->_M_impl.construct(this->_M_impl._M_finish,\n\t\t\t\t  *(this->_M_impl._M_finish - 1));\n\t  ++this->_M_impl._M_finish;\n\t  _Tp __x_copy = __x;\n\t  std::copy_backward(__position.base(),\n\t\t\t     this->_M_impl._M_finish - 2,\n\t\t\t     this->_M_impl._M_finish - 1);\n\t  *__position = __x_copy;\n\t}\n      else\n\t{\n\t  const size_type __old_size = size();\n\t  if (__old_size == this->max_size())\n\t    __throw_length_error(__N(\"vector::_M_insert_aux\"));\n\n\t  // When sizeof(value_type) == 1 and __old_size > size_type(-1)/2\n\t  // __len overflows: if we don't notice and _M_allocate doesn't\n\t  // throw we crash badly later.\n\t  size_type __len = __old_size != 0 ? 2 * __old_size : 1;\t  \n\t  if (__len < __old_size)\n\t    __len = this->max_size();\n\n\t  pointer __new_start(this->_M_allocate(__len));\n\t  pointer __new_finish(__new_start);\n\t  try\n\t    {\n\t      __new_finish =\n\t\tstd::__uninitialized_copy_a(this->_M_impl._M_start,\n\t\t\t\t\t    __position.base(), __new_start,\n\t\t\t\t\t    _M_get_Tp_allocator());\n\t      this->_M_impl.construct(__new_finish, __x);\n\t      ++__new_finish;\n\t      __new_finish =\n\t\tstd::__uninitialized_copy_a(__position.base(),\n\t\t\t\t\t    this->_M_impl._M_finish,\n\t\t\t\t\t    __new_finish,\n\t\t\t\t\t    _M_get_Tp_allocator());\n\t    }\n\t  catch(...)\n\t    {\n\t      std::_Destroy(__new_start, __new_finish, _M_get_Tp_allocator());\n\t      _M_deallocate(__new_start, __len);\n\t      __throw_exception_again;\n\t    }\n\t  std::_Destroy(this->_M_impl._M_start, this->_M_impl._M_finish,\n\t\t\t_M_get_Tp_allocator());\n\t  _M_deallocate(this->_M_impl._M_start,\n\t\t\tthis->_M_impl._M_end_of_storage\n\t\t\t- this->_M_impl._M_start);\n\t  this->_M_impl._M_start = __new_start;\n\t  this->_M_impl._M_finish = __new_finish;\n\t  this->_M_impl._M_end_of_storage = __new_start + __len;\n\t}\n    }\n\n  template<typename _Tp, typename _Alloc>\n    void\n    vector<_Tp, _Alloc>::\n    _M_fill_insert(iterator __position, size_type __n, const value_type& __x)\n    {\n      if (__n != 0)\n\t{\n\t  if (size_type(this->_M_impl._M_end_of_storage\n\t\t\t- this->_M_impl._M_finish) >= __n)\n\t    {\n\t      value_type __x_copy = __x;\n\t      const size_type __elems_after = end() - __position;\n\t      pointer __old_finish(this->_M_impl._M_finish);\n\t      if (__elems_after > __n)\n\t\t{\n\t\t  std::__uninitialized_copy_a(this->_M_impl._M_finish - __n,\n\t\t\t\t\t      this->_M_impl._M_finish,\n\t\t\t\t\t      this->_M_impl._M_finish,\n\t\t\t\t\t      _M_get_Tp_allocator());\n\t\t  this->_M_impl._M_finish += __n;\n\t\t  std::copy_backward(__position.base(), __old_finish - __n,\n\t\t\t\t     __old_finish);\n\t\t  std::fill(__position.base(), __position.base() + __n,\n\t\t\t    __x_copy);\n\t\t}\n\t      else\n\t\t{\n\t\t  std::__uninitialized_fill_n_a(this->_M_impl._M_finish,\n\t\t\t\t\t\t__n - __elems_after,\n\t\t\t\t\t\t__x_copy,\n\t\t\t\t\t\t_M_get_Tp_allocator());\n\t\t  this->_M_impl._M_finish += __n - __elems_after;\n\t\t  std::__uninitialized_copy_a(__position.base(), __old_finish,\n\t\t\t\t\t      this->_M_impl._M_finish,\n\t\t\t\t\t      _M_get_Tp_allocator());\n\t\t  this->_M_impl._M_finish += __elems_after;\n\t\t  std::fill(__position.base(), __old_finish, __x_copy);\n\t\t}\n\t    }\n\t  else\n\t    {\n\t      const size_type __old_size = size();\n\t      if (this->max_size() - __old_size < __n)\n\t\t__throw_length_error(__N(\"vector::_M_fill_insert\"));\n\t      \n\t      // See _M_insert_aux above.\n\t      size_type __len = __old_size + std::max(__old_size, __n);\n\t      if (__len < __old_size)\n\t\t__len = this->max_size();\n\n\t      pointer __new_start(this->_M_allocate(__len));\n\t      pointer __new_finish(__new_start);\n\t      try\n\t\t{\n\t\t  __new_finish =\n\t\t    std::__uninitialized_copy_a(this->_M_impl._M_start,\n\t\t\t\t\t\t__position.base(),\n\t\t\t\t\t\t__new_start,\n\t\t\t\t\t\t_M_get_Tp_allocator());\n\t\t  std::__uninitialized_fill_n_a(__new_finish, __n, __x,\n\t\t\t\t\t\t_M_get_Tp_allocator());\n\t\t  __new_finish += __n;\n\t\t  __new_finish =\n\t\t    std::__uninitialized_copy_a(__position.base(),\n\t\t\t\t\t\tthis->_M_impl._M_finish,\n\t\t\t\t\t\t__new_finish,\n\t\t\t\t\t\t_M_get_Tp_allocator());\n\t\t}\n\t      catch(...)\n\t\t{\n\t\t  std::_Destroy(__new_start, __new_finish,\n\t\t\t\t_M_get_Tp_allocator());\n\t\t  _M_deallocate(__new_start, __len);\n\t\t  __throw_exception_again;\n\t\t}\n\t      std::_Destroy(this->_M_impl._M_start, this->_M_impl._M_finish,\n\t\t\t    _M_get_Tp_allocator());\n\t      _M_deallocate(this->_M_impl._M_start,\n\t\t\t    this->_M_impl._M_end_of_storage\n\t\t\t    - this->_M_impl._M_start);\n\t      this->_M_impl._M_start = __new_start;\n\t      this->_M_impl._M_finish = __new_finish;\n\t      this->_M_impl._M_end_of_storage = __new_start + __len;\n\t    }\n\t}\n    }\n\n  template<typename _Tp, typename _Alloc> template<typename _InputIterator>\n    void\n    vector<_Tp, _Alloc>::\n    _M_range_insert(iterator __pos, _InputIterator __first,\n\t\t    _InputIterator __last, std::input_iterator_tag)\n    {\n      for (; __first != __last; ++__first)\n\t{\n\t  __pos = insert(__pos, *__first);\n\t  ++__pos;\n\t}\n    }\n\n  template<typename _Tp, typename _Alloc>\n    template<typename _ForwardIterator>\n      void\n      vector<_Tp, _Alloc>::\n      _M_range_insert(iterator __position, _ForwardIterator __first,\n\t\t      _ForwardIterator __last, std::forward_iterator_tag)\n      {\n\tif (__first != __last)\n\t  {\n\t    const size_type __n = std::distance(__first, __last);\n\t    if (size_type(this->_M_impl._M_end_of_storage\n\t\t\t  - this->_M_impl._M_finish) >= __n)\n\t      {\n\t\tconst size_type __elems_after = end() - __position;\n\t\tpointer __old_finish(this->_M_impl._M_finish);\n\t\tif (__elems_after > __n)\n\t\t  {\n\t\t    std::__uninitialized_copy_a(this->_M_impl._M_finish - __n,\n\t\t\t\t\t\tthis->_M_impl._M_finish,\n\t\t\t\t\t\tthis->_M_impl._M_finish,\n\t\t\t\t\t\t_M_get_Tp_allocator());\n\t\t    this->_M_impl._M_finish += __n;\n\t\t    std::copy_backward(__position.base(), __old_finish - __n,\n\t\t\t\t       __old_finish);\n\t\t    std::copy(__first, __last, __position);\n\t\t  }\n\t\telse\n\t\t  {\n\t\t    _ForwardIterator __mid = __first;\n\t\t    std::advance(__mid, __elems_after);\n\t\t    std::__uninitialized_copy_a(__mid, __last,\n\t\t\t\t\t\tthis->_M_impl._M_finish,\n\t\t\t\t\t\t_M_get_Tp_allocator());\n\t\t    this->_M_impl._M_finish += __n - __elems_after;\n\t\t    std::__uninitialized_copy_a(__position.base(),\n\t\t\t\t\t\t__old_finish,\n\t\t\t\t\t\tthis->_M_impl._M_finish,\n\t\t\t\t\t\t_M_get_Tp_allocator());\n\t\t    this->_M_impl._M_finish += __elems_after;\n\t\t    std::copy(__first, __mid, __position);\n\t\t  }\n\t      }\n\t    else\n\t      {\n\t\tconst size_type __old_size = size();\n\t\tif (this->max_size() - __old_size < __n)\n\t\t  __throw_length_error(__N(\"vector::_M_range_insert\"));\t\n\n\t\t// See _M_insert_aux above.\n\t\tsize_type __len = __old_size + std::max(__old_size, __n);\n\t\tif (__len < __old_size)\n\t\t  __len = this->max_size();\n\n\t\tpointer __new_start(this->_M_allocate(__len));\n\t\tpointer __new_finish(__new_start);\n\t\ttry\n\t\t  {\n\t\t    __new_finish =\n\t\t      std::__uninitialized_copy_a(this->_M_impl._M_start,\n\t\t\t\t\t\t  __position.base(),\n\t\t\t\t\t\t  __new_start,\n\t\t\t\t\t\t  _M_get_Tp_allocator());\n\t\t    __new_finish =\n\t\t      std::__uninitialized_copy_a(__first, __last, __new_finish,\n\t\t\t\t\t\t  _M_get_Tp_allocator());\n\t\t    __new_finish =\n\t\t      std::__uninitialized_copy_a(__position.base(),\n\t\t\t\t\t\t  this->_M_impl._M_finish,\n\t\t\t\t\t\t  __new_finish,\n\t\t\t\t\t\t  _M_get_Tp_allocator());\n\t\t  }\n\t\tcatch(...)\n\t\t  {\n\t\t    std::_Destroy(__new_start, __new_finish,\n\t\t\t\t  _M_get_Tp_allocator());\n\t\t    _M_deallocate(__new_start, __len);\n\t\t    __throw_exception_again;\n\t\t  }\n\t\tstd::_Destroy(this->_M_impl._M_start, this->_M_impl._M_finish,\n\t\t\t      _M_get_Tp_allocator());\n\t\t_M_deallocate(this->_M_impl._M_start,\n\t\t\t      this->_M_impl._M_end_of_storage\n\t\t\t      - this->_M_impl._M_start);\n\t\tthis->_M_impl._M_start = __new_start;\n\t\tthis->_M_impl._M_finish = __new_finish;\n\t\tthis->_M_impl._M_end_of_storage = __new_start + __len;\n\t      }\n\t  }\n      }\n\n_GLIBCXX_END_NESTED_NAMESPACE\n\n#endif /* _VECTOR_TCC */\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/bitset",
    "content": "// <bitset> -*- C++ -*-\n\n// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006\n// Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n/*\n * Copyright (c) 1998\n * Silicon Graphics Computer Systems, Inc.\n *\n * Permission to use, copy, modify, distribute and sell this software\n * and its documentation for any purpose is hereby granted without fee,\n * provided that the above copyright notice appear in all copies and\n * that both that copyright notice and this permission notice appear\n * in supporting documentation.  Silicon Graphics makes no\n * representations about the suitability of this software for any\n * purpose.  It is provided \"as is\" without express or implied warranty.\n */\n\n/** @file include/bitset\n *  This is a Standard C++ Library header.\n */\n\n#ifndef _GLIBCXX_BITSET\n#define _GLIBCXX_BITSET 1\n\n#pragma GCC system_header\n\n#include <cstddef>     // For size_t\n#include <cstring>     // For memset\n#include <limits>      // For numeric_limits\n#include <string>\n#include <bits/functexcept.h>   // For invalid_argument, out_of_range,\n                                // overflow_error\n#include <ostream>     // For ostream (operator<<)\n#include <istream>     // For istream (operator>>)\n\n#define _GLIBCXX_BITSET_BITS_PER_WORD  numeric_limits<unsigned long>::digits\n#define _GLIBCXX_BITSET_WORDS(__n) \\\n ((__n) < 1 ? 0 : ((__n) + _GLIBCXX_BITSET_BITS_PER_WORD - 1) \\\n                  / _GLIBCXX_BITSET_BITS_PER_WORD)\n\n_GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD)\n\n  /**\n   *  @if maint\n   *  Base class, general case.  It is a class inveriant that _Nw will be\n   *  nonnegative.\n   *\n   *  See documentation for bitset.\n   *  @endif\n  */\n  template<size_t _Nw>\n    struct _Base_bitset\n    {\n      typedef unsigned long _WordT;\n\n      /// 0 is the least significant word.\n      _WordT \t\t_M_w[_Nw];\n\n      _Base_bitset()\n      { _M_do_reset(); }\n\n      _Base_bitset(unsigned long __val)\n      {\n\t_M_do_reset();\n\t_M_w[0] = __val;\n      }\n\n      static size_t\n      _S_whichword(size_t __pos )\n      { return __pos / _GLIBCXX_BITSET_BITS_PER_WORD; }\n\n      static size_t\n      _S_whichbyte(size_t __pos )\n      { return (__pos % _GLIBCXX_BITSET_BITS_PER_WORD) / __CHAR_BIT__; }\n\n      static size_t\n      _S_whichbit(size_t __pos )\n      { return __pos % _GLIBCXX_BITSET_BITS_PER_WORD; }\n\n      static _WordT\n      _S_maskbit(size_t __pos )\n      { return (static_cast<_WordT>(1)) << _S_whichbit(__pos); }\n\n      _WordT&\n      _M_getword(size_t __pos)\n      { return _M_w[_S_whichword(__pos)]; }\n\n      _WordT\n      _M_getword(size_t __pos) const\n      { return _M_w[_S_whichword(__pos)]; }\n\n      _WordT&\n      _M_hiword()\n      { return _M_w[_Nw - 1]; }\n\n      _WordT\n      _M_hiword() const\n      { return _M_w[_Nw - 1]; }\n\n      void\n      _M_do_and(const _Base_bitset<_Nw>& __x)\n      {\n\tfor (size_t __i = 0; __i < _Nw; __i++)\n\t  _M_w[__i] &= __x._M_w[__i];\n      }\n\n      void\n      _M_do_or(const _Base_bitset<_Nw>& __x)\n      {\n\tfor (size_t __i = 0; __i < _Nw; __i++)\n\t  _M_w[__i] |= __x._M_w[__i];\n      }\n\n      void\n      _M_do_xor(const _Base_bitset<_Nw>& __x)\n      {\n\tfor (size_t __i = 0; __i < _Nw; __i++)\n\t  _M_w[__i] ^= __x._M_w[__i];\n      }\n\n      void\n      _M_do_left_shift(size_t __shift);\n\n      void\n      _M_do_right_shift(size_t __shift);\n\n      void\n      _M_do_flip()\n      {\n\tfor (size_t __i = 0; __i < _Nw; __i++)\n\t  _M_w[__i] = ~_M_w[__i];\n      }\n\n      void\n      _M_do_set()\n      {\n\tfor (size_t __i = 0; __i < _Nw; __i++)\n\t  _M_w[__i] = ~static_cast<_WordT>(0);\n      }\n\n      void\n      _M_do_reset()\n      { std::memset(_M_w, 0, _Nw * sizeof(_WordT)); }\n\n      bool\n      _M_is_equal(const _Base_bitset<_Nw>& __x) const\n      {\n\tfor (size_t __i = 0; __i < _Nw; ++__i)\n\t  {\n\t    if (_M_w[__i] != __x._M_w[__i])\n\t      return false;\n\t  }\n\treturn true;\n      }\n\n      bool\n      _M_is_any() const\n      {\n\tfor (size_t __i = 0; __i < _Nw; __i++)\n\t  {\n\t    if (_M_w[__i] != static_cast<_WordT>(0))\n\t      return true;\n\t  }\n\treturn false;\n      }\n\n      size_t\n      _M_do_count() const\n      {\n\tsize_t __result = 0;\n\tfor (size_t __i = 0; __i < _Nw; __i++)\n\t  __result += __builtin_popcountl(_M_w[__i]);\n\treturn __result;\n      }\n\n      unsigned long\n      _M_do_to_ulong() const;\n\n      // find first \"on\" bit\n      size_t\n      _M_do_find_first(size_t __not_found) const;\n\n      // find the next \"on\" bit that follows \"prev\"\n      size_t\n      _M_do_find_next(size_t __prev, size_t __not_found) const;\n    };\n\n  // Definitions of non-inline functions from _Base_bitset.\n  template<size_t _Nw>\n    void\n    _Base_bitset<_Nw>::_M_do_left_shift(size_t __shift)\n    {\n      if (__builtin_expect(__shift != 0, 1))\n\t{\n\t  const size_t __wshift = __shift / _GLIBCXX_BITSET_BITS_PER_WORD;\n\t  const size_t __offset = __shift % _GLIBCXX_BITSET_BITS_PER_WORD;\n\n\t  if (__offset == 0)\n\t    for (size_t __n = _Nw - 1; __n >= __wshift; --__n)\n\t      _M_w[__n] = _M_w[__n - __wshift];\n\t  else\n\t    {\n\t      const size_t __sub_offset = (_GLIBCXX_BITSET_BITS_PER_WORD \n\t\t\t\t\t   - __offset);\n\t      for (size_t __n = _Nw - 1; __n > __wshift; --__n)\n\t\t_M_w[__n] = ((_M_w[__n - __wshift] << __offset)\n\t\t\t     | (_M_w[__n - __wshift - 1] >> __sub_offset));\n\t      _M_w[__wshift] = _M_w[0] << __offset;\n\t    }\n\n\t  std::fill(_M_w + 0, _M_w + __wshift, static_cast<_WordT>(0));\n\t}\n    }\n\n  template<size_t _Nw>\n    void\n    _Base_bitset<_Nw>::_M_do_right_shift(size_t __shift)\n    {\n      if (__builtin_expect(__shift != 0, 1))\n\t{\n\t  const size_t __wshift = __shift / _GLIBCXX_BITSET_BITS_PER_WORD;\n\t  const size_t __offset = __shift % _GLIBCXX_BITSET_BITS_PER_WORD;\n\t  const size_t __limit = _Nw - __wshift - 1;\n\n\t  if (__offset == 0)\n\t    for (size_t __n = 0; __n <= __limit; ++__n)\n\t      _M_w[__n] = _M_w[__n + __wshift];\n\t  else\n\t    {\n\t      const size_t __sub_offset = (_GLIBCXX_BITSET_BITS_PER_WORD\n\t\t\t\t\t   - __offset);\n\t      for (size_t __n = 0; __n < __limit; ++__n)\n\t\t_M_w[__n] = ((_M_w[__n + __wshift] >> __offset)\n\t\t\t     | (_M_w[__n + __wshift + 1] << __sub_offset));\n\t      _M_w[__limit] = _M_w[_Nw-1] >> __offset;\n\t    }\n\t  \n\t  std::fill(_M_w + __limit + 1, _M_w + _Nw, static_cast<_WordT>(0));\n\t}\n    }\n\n  template<size_t _Nw>\n    unsigned long\n    _Base_bitset<_Nw>::_M_do_to_ulong() const\n    {\n      for (size_t __i = 1; __i < _Nw; ++__i)\n\tif (_M_w[__i])\n\t  __throw_overflow_error(__N(\"_Base_bitset::_M_do_to_ulong\"));\n      return _M_w[0];\n    }\n\n  template<size_t _Nw>\n    size_t\n    _Base_bitset<_Nw>::_M_do_find_first(size_t __not_found) const\n    {\n      for (size_t __i = 0; __i < _Nw; __i++)\n\t{\n\t  _WordT __thisword = _M_w[__i];\n\t  if (__thisword != static_cast<_WordT>(0))\n\t    return (__i * _GLIBCXX_BITSET_BITS_PER_WORD\n\t\t    + __builtin_ctzl(__thisword));\n\t}\n      // not found, so return an indication of failure.\n      return __not_found;\n    }\n\n  template<size_t _Nw>\n    size_t\n    _Base_bitset<_Nw>::_M_do_find_next(size_t __prev, size_t __not_found) const\n    {\n      // make bound inclusive\n      ++__prev;\n\n      // check out of bounds\n      if (__prev >= _Nw * _GLIBCXX_BITSET_BITS_PER_WORD)\n\treturn __not_found;\n\n      // search first word\n      size_t __i = _S_whichword(__prev);\n      _WordT __thisword = _M_w[__i];\n\n      // mask off bits below bound\n      __thisword &= (~static_cast<_WordT>(0)) << _S_whichbit(__prev);\n\n      if (__thisword != static_cast<_WordT>(0))\n\treturn (__i * _GLIBCXX_BITSET_BITS_PER_WORD\n\t\t+ __builtin_ctzl(__thisword));\n\n      // check subsequent words\n      __i++;\n      for (; __i < _Nw; __i++)\n\t{\n\t  __thisword = _M_w[__i];\n\t  if (__thisword != static_cast<_WordT>(0))\n\t    return (__i * _GLIBCXX_BITSET_BITS_PER_WORD\n\t\t    + __builtin_ctzl(__thisword));\n\t}\n      // not found, so return an indication of failure.\n      return __not_found;\n    } // end _M_do_find_next\n\n  /**\n   *  @if maint\n   *  Base class, specialization for a single word.\n   *\n   *  See documentation for bitset.\n   *  @endif\n  */\n  template<>\n    struct _Base_bitset<1>\n    {\n      typedef unsigned long _WordT;\n      _WordT _M_w;\n\n      _Base_bitset(void)\n      : _M_w(0)\n      { }\n\n      _Base_bitset(unsigned long __val)\n      : _M_w(__val)\n      { }\n\n      static size_t\n      _S_whichword(size_t __pos )\n      { return __pos / _GLIBCXX_BITSET_BITS_PER_WORD; }\n\n      static size_t\n      _S_whichbyte(size_t __pos )\n      { return (__pos % _GLIBCXX_BITSET_BITS_PER_WORD) / __CHAR_BIT__; }\n\n      static size_t\n      _S_whichbit(size_t __pos )\n      {  return __pos % _GLIBCXX_BITSET_BITS_PER_WORD; }\n\n      static _WordT\n      _S_maskbit(size_t __pos )\n      { return (static_cast<_WordT>(1)) << _S_whichbit(__pos); }\n\n      _WordT&\n      _M_getword(size_t)\n      { return _M_w; }\n\n      _WordT\n      _M_getword(size_t) const\n      { return _M_w; }\n\n      _WordT&\n      _M_hiword()\n      { return _M_w; }\n\n      _WordT\n      _M_hiword() const\n      { return _M_w; }\n\n      void\n      _M_do_and(const _Base_bitset<1>& __x)\n      { _M_w &= __x._M_w; }\n\n      void\n      _M_do_or(const _Base_bitset<1>& __x)\n      { _M_w |= __x._M_w; }\n\n      void\n      _M_do_xor(const _Base_bitset<1>& __x)\n      { _M_w ^= __x._M_w; }\n\n      void\n      _M_do_left_shift(size_t __shift)\n      { _M_w <<= __shift; }\n\n      void\n      _M_do_right_shift(size_t __shift)\n      { _M_w >>= __shift; }\n\n      void\n      _M_do_flip()\n      { _M_w = ~_M_w; }\n\n      void\n      _M_do_set()\n      { _M_w = ~static_cast<_WordT>(0); }\n\n      void\n      _M_do_reset()\n      { _M_w = 0; }\n\n      bool\n      _M_is_equal(const _Base_bitset<1>& __x) const\n      { return _M_w == __x._M_w; }\n\n      bool\n      _M_is_any() const\n      { return _M_w != 0; }\n\n      size_t\n      _M_do_count() const\n      { return __builtin_popcountl(_M_w); }\n\n      unsigned long\n      _M_do_to_ulong() const\n      { return _M_w; }\n\n      size_t\n      _M_do_find_first(size_t __not_found) const\n      {\n        if (_M_w != 0)\n          return __builtin_ctzl(_M_w);\n        else\n          return __not_found;\n      }\n\n      // find the next \"on\" bit that follows \"prev\"\n      size_t\n      _M_do_find_next(size_t __prev, size_t __not_found) const\n      {\n\t++__prev;\n\tif (__prev >= ((size_t) _GLIBCXX_BITSET_BITS_PER_WORD))\n\t  return __not_found;\n\n\t_WordT __x = _M_w >> __prev;\n\tif (__x != 0)\n\t  return __builtin_ctzl(__x) + __prev;\n\telse\n\t  return __not_found;\n      }\n    };\n\n  /**\n   *  @if maint\n   *  Base class, specialization for no storage (zero-length %bitset).\n   *\n   *  See documentation for bitset.\n   *  @endif\n  */\n  template<>\n    struct _Base_bitset<0>\n    {\n      typedef unsigned long _WordT;\n\n      _Base_bitset()\n      { }\n\n      _Base_bitset(unsigned long)\n      { }\n\n      static size_t\n      _S_whichword(size_t __pos )\n      { return __pos / _GLIBCXX_BITSET_BITS_PER_WORD; }\n\n      static size_t\n      _S_whichbyte(size_t __pos )\n      { return (__pos % _GLIBCXX_BITSET_BITS_PER_WORD) / __CHAR_BIT__; }\n\n      static size_t\n      _S_whichbit(size_t __pos )\n      {  return __pos % _GLIBCXX_BITSET_BITS_PER_WORD; }\n\n      static _WordT\n      _S_maskbit(size_t __pos )\n      { return (static_cast<_WordT>(1)) << _S_whichbit(__pos); }\n\n      // This would normally give access to the data.  The bounds-checking\n      // in the bitset class will prevent the user from getting this far,\n      // but (1) it must still return an lvalue to compile, and (2) the\n      // user might call _Unchecked_set directly, in which case this /needs/\n      // to fail.  Let's not penalize zero-length users unless they actually\n      // make an unchecked call; all the memory ugliness is therefore\n      // localized to this single should-never-get-this-far function.\n      _WordT&\n      _M_getword(size_t) const\n      { \n\t__throw_out_of_range(__N(\"_Base_bitset::_M_getword\")); \n\treturn *new _WordT; \n      }\n\n      _WordT\n      _M_hiword() const\n      { return 0; }\n\n      void\n      _M_do_and(const _Base_bitset<0>&)\n      { }\n\n      void\n      _M_do_or(const _Base_bitset<0>&)\n      { }\n\n      void\n      _M_do_xor(const _Base_bitset<0>&)\n      { }\n\n      void\n      _M_do_left_shift(size_t)\n      { }\n\n      void\n      _M_do_right_shift(size_t)\n      { }\n\n      void\n      _M_do_flip()\n      { }\n\n      void\n      _M_do_set()\n      { }\n\n      void\n      _M_do_reset()\n      { }\n\n      // Are all empty bitsets equal to each other?  Are they equal to\n      // themselves?  How to compare a thing which has no state?  What is\n      // the sound of one zero-length bitset clapping?\n      bool\n      _M_is_equal(const _Base_bitset<0>&) const\n      { return true; }\n\n      bool\n      _M_is_any() const\n      { return false; }\n\n      size_t\n      _M_do_count() const\n      { return 0; }\n\n      unsigned long\n      _M_do_to_ulong() const\n      { return 0; }\n\n      // Normally \"not found\" is the size, but that could also be\n      // misinterpreted as an index in this corner case.  Oh well.\n      size_t\n      _M_do_find_first(size_t) const\n      { return 0; }\n\n      size_t\n      _M_do_find_next(size_t, size_t) const\n      { return 0; }\n    };\n\n\n  // Helper class to zero out the unused high-order bits in the highest word.\n  template<size_t _Extrabits>\n    struct _Sanitize\n    {\n      static void _S_do_sanitize(unsigned long& __val)\n      { __val &= ~((~static_cast<unsigned long>(0)) << _Extrabits); }\n    };\n\n  template<>\n    struct _Sanitize<0>\n    { static void _S_do_sanitize(unsigned long) {} };\n\n  /**\n   *  @brief  The %bitset class represents a @e fixed-size sequence of bits.\n   *\n   *  @ingroup Containers\n   *\n   *  (Note that %bitset does @e not meet the formal requirements of a\n   *  <a href=\"tables.html#65\">container</a>.  Mainly, it lacks iterators.)\n   *\n   *  The template argument, @a Nb, may be any non-negative number,\n   *  specifying the number of bits (e.g., \"0\", \"12\", \"1024*1024\").\n   *\n   *  In the general unoptimized case, storage is allocated in word-sized\n   *  blocks.  Let B be the number of bits in a word, then (Nb+(B-1))/B\n   *  words will be used for storage.  B - Nb%B bits are unused.  (They are\n   *  the high-order bits in the highest word.)  It is a class invariant\n   *  that those unused bits are always zero.\n   *\n   *  If you think of %bitset as \"a simple array of bits,\" be aware that\n   *  your mental picture is reversed:  a %bitset behaves the same way as\n   *  bits in integers do, with the bit at index 0 in the \"least significant\n   *  / right-hand\" position, and the bit at index Nb-1 in the \"most\n   *  significant / left-hand\" position.  Thus, unlike other containers, a\n   *  %bitset's index \"counts from right to left,\" to put it very loosely.\n   *\n   *  This behavior is preserved when translating to and from strings.  For\n   *  example, the first line of the following program probably prints\n   *  \"b('a') is 0001100001\" on a modern ASCII system.\n   *\n   *  @code\n   *     #include <bitset>\n   *     #include <iostream>\n   *     #include <sstream>\n   *\n   *     using namespace std;\n   *\n   *     int main()\n   *     {\n   *         long         a = 'a';\n   *         bitset<10>   b(a);\n   *\n   *         cout << \"b('a') is \" << b << endl;\n   *\n   *         ostringstream s;\n   *         s << b;\n   *         string  str = s.str();\n   *         cout << \"index 3 in the string is \" << str[3] << \" but\\n\"\n   *              << \"index 3 in the bitset is \" << b[3] << endl;\n   *     }\n   *  @endcode\n   *\n   *  Also see http://gcc.gnu.org/onlinedocs/libstdc++/ext/sgiexts.html#ch23\n   *  for a description of extensions.\n   *\n   *  @if maint\n   *  Most of the actual code isn't contained in %bitset<> itself, but in the\n   *  base class _Base_bitset.  The base class works with whole words, not with\n   *  individual bits.  This allows us to specialize _Base_bitset for the\n   *  important special case where the %bitset is only a single word.\n   *\n   *  Extra confusion can result due to the fact that the storage for\n   *  _Base_bitset @e is a regular array, and is indexed as such.  This is\n   *  carefully encapsulated.\n   *  @endif\n  */\n  template<size_t _Nb>\n    class bitset\n    : private _Base_bitset<_GLIBCXX_BITSET_WORDS(_Nb)>\n    {\n    private:\n      typedef _Base_bitset<_GLIBCXX_BITSET_WORDS(_Nb)> _Base;\n      typedef unsigned long _WordT;\n\n      void\n\t_M_do_sanitize()\n\t{\n\t  _Sanitize<_Nb % _GLIBCXX_BITSET_BITS_PER_WORD>::\n\t    _S_do_sanitize(this->_M_hiword());\n\t}\n\n    public:\n      /**\n       *  This encapsulates the concept of a single bit.  An instance of this\n       *  class is a proxy for an actual bit; this way the individual bit\n       *  operations are done as faster word-size bitwise instructions.\n       *\n       *  Most users will never need to use this class directly; conversions\n       *  to and from bool are automatic and should be transparent.  Overloaded\n       *  operators help to preserve the illusion.\n       *\n       *  (On a typical system, this \"bit %reference\" is 64 times the size of\n       *  an actual bit.  Ha.)\n       */\n      class reference\n      {\n\tfriend class bitset;\n\n\t_WordT *_M_wp;\n\tsize_t _M_bpos;\n\t\n\t// left undefined\n\treference();\n\t\n      public:\n\treference(bitset& __b, size_t __pos)\n\t{\n\t  _M_wp = &__b._M_getword(__pos);\n\t  _M_bpos = _Base::_S_whichbit(__pos);\n\t}\n\n\t~reference()\n\t{ }\n\n\t// For b[i] = __x;\n\treference&\n\toperator=(bool __x)\n\t{\n\t  if (__x)\n\t    *_M_wp |= _Base::_S_maskbit(_M_bpos);\n\t  else\n\t    *_M_wp &= ~_Base::_S_maskbit(_M_bpos);\n\t  return *this;\n\t}\n\n\t// For b[i] = b[__j];\n\treference&\n\toperator=(const reference& __j)\n\t{\n\t  if ((*(__j._M_wp) & _Base::_S_maskbit(__j._M_bpos)))\n\t    *_M_wp |= _Base::_S_maskbit(_M_bpos);\n\t  else\n\t    *_M_wp &= ~_Base::_S_maskbit(_M_bpos);\n\t  return *this;\n\t}\n\n\t// Flips the bit\n\tbool\n\toperator~() const\n\t{ return (*(_M_wp) & _Base::_S_maskbit(_M_bpos)) == 0; }\n\n\t// For __x = b[i];\n\toperator bool() const\n\t{ return (*(_M_wp) & _Base::_S_maskbit(_M_bpos)) != 0; }\n\n\t// For b[i].flip();\n\treference&\n\tflip()\n\t{\n\t  *_M_wp ^= _Base::_S_maskbit(_M_bpos);\n\t  return *this;\n\t}\n      };\n      friend class reference;\n\n      // 23.3.5.1 constructors:\n      /// All bits set to zero.\n      bitset()\n      { }\n\n      /// Initial bits bitwise-copied from a single word (others set to zero).\n      bitset(unsigned long __val)\n      : _Base(__val)\n      { _M_do_sanitize(); }\n\n      /**\n       *  @brief  Use a subset of a string.\n       *  @param  s  A string of '0' and '1' characters.\n       *  @param  position  Index of the first character in @a s to use;\n       *                    defaults to zero.\n       *  @throw  std::out_of_range  If @a pos is bigger the size of @a s.\n       *  @throw  std::invalid_argument  If a character appears in the string\n       *                                 which is neither '0' nor '1'.\n       */\n      template<class _CharT, class _Traits, class _Alloc>\n\texplicit\n\tbitset(const std::basic_string<_CharT, _Traits, _Alloc>& __s,\n\t       size_t __position = 0)\n\t: _Base()\n\t{\n\t  if (__position > __s.size())\n\t    __throw_out_of_range(__N(\"bitset::bitset initial position \"\n\t\t\t\t     \"not valid\"));\n\t  _M_copy_from_string(__s, __position,\n\t\t\t      std::basic_string<_CharT, _Traits, _Alloc>::npos);\n\t}\n\n      /**\n       *  @brief  Use a subset of a string.\n       *  @param  s  A string of '0' and '1' characters.\n       *  @param  position  Index of the first character in @a s to use.\n       *  @param  n    The number of characters to copy.\n       *  @throw  std::out_of_range  If @a pos is bigger the size of @a s.\n       *  @throw  std::invalid_argument  If a character appears in the string\n       *                                 which is neither '0' nor '1'.\n       */\n      template<class _CharT, class _Traits, class _Alloc>\n\tbitset(const std::basic_string<_CharT, _Traits, _Alloc>& __s,\n\t       size_t __position, size_t __n)\n\t: _Base()\n\t{\n\t  if (__position > __s.size())\n\t    __throw_out_of_range(__N(\"bitset::bitset initial position \"\n\t\t\t\t     \"not valid\"));\n\t  _M_copy_from_string(__s, __position, __n);\n\t}\n      \n      // 23.3.5.2 bitset operations:\n      //@{\n      /**\n       *  @brief  Operations on bitsets.\n       *  @param  rhs  A same-sized bitset.\n       *\n       *  These should be self-explanatory.\n       */\n      bitset<_Nb>&\n      operator&=(const bitset<_Nb>& __rhs)\n      {\n\tthis->_M_do_and(__rhs);\n\treturn *this;\n      }\n\n      bitset<_Nb>&\n      operator|=(const bitset<_Nb>& __rhs)\n      {\n\tthis->_M_do_or(__rhs);\n\treturn *this;\n      }\n\n      bitset<_Nb>&\n      operator^=(const bitset<_Nb>& __rhs)\n      {\n\tthis->_M_do_xor(__rhs);\n\treturn *this;\n      }\n      //@}\n      \n      //@{\n      /**\n       *  @brief  Operations on bitsets.\n       *  @param  position  The number of places to shift.\n       *\n       *  These should be self-explanatory.\n       */\n      bitset<_Nb>&\n      operator<<=(size_t __position)\n      {\n\tif (__builtin_expect(__position < _Nb, 1))\n\t  {\n\t    this->_M_do_left_shift(__position);\n\t    this->_M_do_sanitize();\n\t  }\n\telse\n\t  this->_M_do_reset();\n\treturn *this;\n      }\n\n      bitset<_Nb>&\n      operator>>=(size_t __position)\n      {\n\tif (__builtin_expect(__position < _Nb, 1))\n\t  {\n\t    this->_M_do_right_shift(__position);\n\t    this->_M_do_sanitize();\n\t  }\n\telse\n\t  this->_M_do_reset();\n\treturn *this;\n      }\n      //@}\n      \n      //@{\n      /**\n       *  These versions of single-bit set, reset, flip, and test are\n       *  extensions from the SGI version.  They do no range checking.\n       *  @ingroup SGIextensions\n       */\n      bitset<_Nb>&\n      _Unchecked_set(size_t __pos)\n      {\n\tthis->_M_getword(__pos) |= _Base::_S_maskbit(__pos);\n\treturn *this;\n      }\n\n      bitset<_Nb>&\n      _Unchecked_set(size_t __pos, int __val)\n      {\n\tif (__val)\n\t  this->_M_getword(__pos) |= _Base::_S_maskbit(__pos);\n\telse\n\t  this->_M_getword(__pos) &= ~_Base::_S_maskbit(__pos);\n\treturn *this;\n      }\n\n      bitset<_Nb>&\n      _Unchecked_reset(size_t __pos)\n      {\n\tthis->_M_getword(__pos) &= ~_Base::_S_maskbit(__pos);\n\treturn *this;\n      }\n\n      bitset<_Nb>&\n      _Unchecked_flip(size_t __pos)\n      {\n\tthis->_M_getword(__pos) ^= _Base::_S_maskbit(__pos);\n\treturn *this;\n      }\n\n      bool\n      _Unchecked_test(size_t __pos) const\n      { return ((this->_M_getword(__pos) & _Base::_S_maskbit(__pos))\n\t\t!= static_cast<_WordT>(0)); }\n      //@}\n      \n      // Set, reset, and flip.\n      /**\n       *  @brief Sets every bit to true.\n       */\n      bitset<_Nb>&\n      set()\n      {\n\tthis->_M_do_set();\n\tthis->_M_do_sanitize();\n\treturn *this;\n      }\n\n      /**\n       *  @brief Sets a given bit to a particular value.\n       *  @param  position  The index of the bit.\n       *  @param  val  Either true or false, defaults to true.\n       *  @throw  std::out_of_range  If @a pos is bigger the size of the %set.\n       */\n      bitset<_Nb>&\n      set(size_t __position, bool __val = true)\n      {\n\tif (__position >= _Nb)\n\t  __throw_out_of_range(__N(\"bitset::set\"));\n\treturn _Unchecked_set(__position, __val);\n      }\n\n      /**\n       *  @brief Sets every bit to false.\n       */\n      bitset<_Nb>&\n      reset()\n      {\n\tthis->_M_do_reset();\n\treturn *this;\n      }\n\n      /**\n       *  @brief Sets a given bit to false.\n       *  @param  position  The index of the bit.\n       *  @throw  std::out_of_range  If @a pos is bigger the size of the %set.\n       *\n       *  Same as writing @c set(pos,false).\n       */\n      bitset<_Nb>&\n      reset(size_t __position)\n      {\n\tif (__position >= _Nb)\n\t  __throw_out_of_range(__N(\"bitset::reset\"));\n\treturn _Unchecked_reset(__position);\n      }\n      \n      /**\n       *  @brief Toggles every bit to its opposite value.\n       */\n      bitset<_Nb>&\n      flip()\n      {\n\tthis->_M_do_flip();\n\tthis->_M_do_sanitize();\n\treturn *this;\n      }\n\n      /**\n       *  @brief Toggles a given bit to its opposite value.\n       *  @param  position  The index of the bit.\n       *  @throw  std::out_of_range  If @a pos is bigger the size of the %set.\n       */\n      bitset<_Nb>&\n      flip(size_t __position)\n      {\n\tif (__position >= _Nb)\n\t  __throw_out_of_range(__N(\"bitset::flip\"));\n\treturn _Unchecked_flip(__position);\n      }\n      \n      /// See the no-argument flip().\n      bitset<_Nb>\n      operator~() const\n      { return bitset<_Nb>(*this).flip(); }\n\n      //@{\n      /**\n       *  @brief  Array-indexing support.\n       *  @param  position  Index into the %bitset.\n       *  @return  A bool for a 'const %bitset'.  For non-const bitsets, an\n       *           instance of the reference proxy class.\n       *  @note  These operators do no range checking and throw no exceptions,\n       *         as required by DR 11 to the standard.\n       *\n       *  @if maint\n       *  _GLIBCXX_RESOLVE_LIB_DEFECTS Note that this implementation already\n       *  resolves DR 11 (items 1 and 2), but does not do the range-checking\n       *  required by that DR's resolution.  -pme\n       *  The DR has since been changed:  range-checking is a precondition\n       *  (users' responsibility), and these functions must not throw.  -pme\n       *  @endif\n       */\n      reference\n      operator[](size_t __position)\n      { return reference(*this,__position); }\n\n      bool\n      operator[](size_t __position) const\n      { return _Unchecked_test(__position); }\n      //@}\n      \n      /**\n       *  @brief Retuns a numerical interpretation of the %bitset.\n       *  @return  The integral equivalent of the bits.\n       *  @throw  std::overflow_error  If there are too many bits to be\n       *                               represented in an @c unsigned @c long.\n       */\n      unsigned long\n      to_ulong() const\n      { return this->_M_do_to_ulong(); }\n\n      /**\n       *  @brief Retuns a character interpretation of the %bitset.\n       *  @return  The string equivalent of the bits.\n       *\n       *  Note the ordering of the bits:  decreasing character positions\n       *  correspond to increasing bit positions (see the main class notes for\n       *  an example).\n       */\n      template<class _CharT, class _Traits, class _Alloc>\n\tstd::basic_string<_CharT, _Traits, _Alloc>\n\tto_string() const\n\t{\n\t  std::basic_string<_CharT, _Traits, _Alloc> __result;\n\t  _M_copy_to_string(__result);\n\t  return __result;\n\t}\n\n      // _GLIBCXX_RESOLVE_LIB_DEFECTS\n      // 434. bitset::to_string() hard to use.\n      template<class _CharT, class _Traits>\n\tstd::basic_string<_CharT, _Traits, std::allocator<_CharT> >\n\tto_string() const\n\t{ return to_string<_CharT, _Traits, std::allocator<_CharT> >(); }\n\n      template<class _CharT>\n\tstd::basic_string<_CharT, std::char_traits<_CharT>,\n\t                  std::allocator<_CharT> >\n\tto_string() const\n\t{\n\t  return to_string<_CharT, std::char_traits<_CharT>,\n\t                   std::allocator<_CharT> >();\n\t}\n\n      std::basic_string<char, std::char_traits<char>, std::allocator<char> >\n      to_string() const\n      {\n\treturn to_string<char, std::char_traits<char>,\n\t                 std::allocator<char> >();\n      }\n\n      // Helper functions for string operations.\n      template<class _CharT, class _Traits, class _Alloc>\n\tvoid\n\t_M_copy_from_string(const std::basic_string<_CharT,\n\t\t\t    _Traits, _Alloc>& __s,\n\t\t\t    size_t, size_t);\n\n      template<class _CharT, class _Traits, class _Alloc>\n\tvoid\n\t_M_copy_to_string(std::basic_string<_CharT, _Traits, _Alloc>&) const;\n\n      /// Returns the number of bits which are set.\n      size_t\n      count() const\n      { return this->_M_do_count(); }\n\n      /// Returns the total number of bits.\n      size_t\n      size() const\n      { return _Nb; }\n\n      //@{\n      /// These comparisons for equality/inequality are, well, @e bitwise.\n      bool\n      operator==(const bitset<_Nb>& __rhs) const\n      { return this->_M_is_equal(__rhs); }\n\n      bool\n      operator!=(const bitset<_Nb>& __rhs) const\n      { return !this->_M_is_equal(__rhs); }\n      //@}\n      \n      /**\n       *  @brief Tests the value of a bit.\n       *  @param  position  The index of a bit.\n       *  @return  The value at @a pos.\n       *  @throw  std::out_of_range  If @a pos is bigger the size of the %set.\n       */\n      bool\n      test(size_t __position) const\n      {\n\tif (__position >= _Nb)\n\t  __throw_out_of_range(__N(\"bitset::test\"));\n\treturn _Unchecked_test(__position);\n      }\n      \n      /**\n       *  @brief Tests whether any of the bits are on.\n       *  @return  True if at least one bit is set.\n       */\n      bool\n      any() const\n      { return this->_M_is_any(); }\n\n      /**\n       *  @brief Tests whether any of the bits are on.\n       *  @return  True if none of the bits are set.\n       */\n      bool\n      none() const\n      { return !this->_M_is_any(); }\n\n      //@{\n      /// Self-explanatory.\n      bitset<_Nb>\n      operator<<(size_t __position) const\n      { return bitset<_Nb>(*this) <<= __position; }\n\n      bitset<_Nb>\n      operator>>(size_t __position) const\n      { return bitset<_Nb>(*this) >>= __position; }\n      //@}\n      \n      /**\n       *  @brief  Finds the index of the first \"on\" bit.\n       *  @return  The index of the first bit set, or size() if not found.\n       *  @ingroup SGIextensions\n       *  @sa  _Find_next\n       */\n      size_t\n      _Find_first() const\n      { return this->_M_do_find_first(_Nb); }\n\n      /**\n       *  @brief  Finds the index of the next \"on\" bit after prev.\n       *  @return  The index of the next bit set, or size() if not found.\n       *  @param  prev  Where to start searching.\n       *  @ingroup SGIextensions\n       *  @sa  _Find_first\n       */\n      size_t\n      _Find_next(size_t __prev ) const\n      { return this->_M_do_find_next(__prev, _Nb); }\n    };\n\n  // Definitions of non-inline member functions.\n  template<size_t _Nb>\n    template<class _CharT, class _Traits, class _Alloc>\n      void\n      bitset<_Nb>::\n      _M_copy_from_string(const std::basic_string<_CharT, _Traits,\n\t\t\t  _Alloc>& __s, size_t __pos, size_t __n)\n      {\n\treset();\n\tconst size_t __nbits = std::min(_Nb, std::min(__n, __s.size() - __pos));\n\tfor (size_t __i = __nbits; __i > 0; --__i)\n\t  {\n\t    switch(__s[__pos + __nbits - __i])\n\t      {\n\t      case '0':\n\t\tbreak;\n\t      case '1':\n\t\t_Unchecked_set(__i - 1);\n\t\tbreak;\n\t      default:\n\t\t__throw_invalid_argument(__N(\"bitset::_M_copy_from_string\"));\n\t      }\n\t  }\n      }\n\n  template<size_t _Nb>\n    template<class _CharT, class _Traits, class _Alloc>\n      void\n      bitset<_Nb>::\n      _M_copy_to_string(std::basic_string<_CharT, _Traits, _Alloc>& __s) const\n      {\n\t__s.assign(_Nb, '0');\n\tfor (size_t __i = _Nb; __i > 0; --__i)\n\t  if (_Unchecked_test(__i - 1))\n\t    __s[_Nb - __i] = '1';\n      }\n\n  // 23.3.5.3 bitset operations:\n  //@{\n  /**\n   *  @brief  Global bitwise operations on bitsets.\n   *  @param  x  A bitset.\n   *  @param  y  A bitset of the same size as @a x.\n   *  @return  A new bitset.\n   *\n   *  These should be self-explanatory.\n  */\n  template<size_t _Nb>\n    inline bitset<_Nb>\n    operator&(const bitset<_Nb>& __x, const bitset<_Nb>& __y)\n    {\n      bitset<_Nb> __result(__x);\n      __result &= __y;\n      return __result;\n    }\n\n  template<size_t _Nb>\n    inline bitset<_Nb>\n    operator|(const bitset<_Nb>& __x, const bitset<_Nb>& __y)\n    {\n      bitset<_Nb> __result(__x);\n      __result |= __y;\n      return __result;\n    }\n\n  template <size_t _Nb>\n    inline bitset<_Nb>\n    operator^(const bitset<_Nb>& __x, const bitset<_Nb>& __y)\n    {\n      bitset<_Nb> __result(__x);\n      __result ^= __y;\n      return __result;\n    }\n  //@}\n\n  //@{\n  /**\n   *  @brief Global I/O operators for bitsets.\n   *\n   *  Direct I/O between streams and bitsets is supported.  Output is\n   *  straightforward.  Input will skip whitespace, only accept '0' and '1'\n   *  characters, and will only extract as many digits as the %bitset will\n   *  hold.\n  */\n  template<class _CharT, class _Traits, size_t _Nb>\n    std::basic_istream<_CharT, _Traits>&\n    operator>>(std::basic_istream<_CharT, _Traits>& __is, bitset<_Nb>& __x)\n    {\n      typedef typename _Traits::char_type char_type;\n      std::basic_string<_CharT, _Traits> __tmp;\n      __tmp.reserve(_Nb);\n\n      std::ios_base::iostate __state = std::ios_base::goodbit;\n      typename std::basic_istream<_CharT, _Traits>::sentry __sentry(__is);\n      if (__sentry)\n\t{\n\t  try\n\t    {\n\t      basic_streambuf<_CharT, _Traits>* __buf = __is.rdbuf();\n\t      // _GLIBCXX_RESOLVE_LIB_DEFECTS\n\t      // 303. Bitset input operator underspecified\n\t      const char_type __zero = __is.widen('0');\n\t      const char_type __one = __is.widen('1');\n\t      for (size_t __i = _Nb; __i > 0; --__i)\n\t\t{\n\t\t  static typename _Traits::int_type __eof = _Traits::eof();\n\t\t  \n\t\t  typename _Traits::int_type __c1 = __buf->sbumpc();\n\t\t  if (_Traits::eq_int_type(__c1, __eof))\n\t\t    {\n\t\t      __state |= std::ios_base::eofbit;\n\t\t      break;\n\t\t    }\n\t\t  else\n\t\t    {\n\t\t      const char_type __c2 = _Traits::to_char_type(__c1);\n\t\t      if (__c2 == __zero)\n\t\t\t__tmp.push_back('0');\n\t\t      else if (__c2 == __one)\n\t\t\t__tmp.push_back('1');\n\t\t      else if (_Traits::eq_int_type(__buf->sputbackc(__c2),\n\t\t\t\t\t\t    __eof))\n\t\t\t{\n\t\t\t  __state |= std::ios_base::failbit;\n\t\t\t  break;\n\t\t\t}\n\t\t    }\n\t\t}\n\t    }\n\t  catch(...)\n\t    { __is._M_setstate(std::ios_base::badbit); }\n\t}\n\n      if (__tmp.empty() && _Nb)\n\t__state |= std::ios_base::failbit;\n      else\n\t__x._M_copy_from_string(__tmp, static_cast<size_t>(0), _Nb);\n      if (__state)\n\t__is.setstate(__state);\n      return __is;\n    }\n\n  template <class _CharT, class _Traits, size_t _Nb>\n    std::basic_ostream<_CharT, _Traits>&\n    operator<<(std::basic_ostream<_CharT, _Traits>& __os,\n\t       const bitset<_Nb>& __x)\n    {\n      std::basic_string<_CharT, _Traits> __tmp;\n      __x._M_copy_to_string(__tmp);\n      return __os << __tmp;\n    }\n\n  // Specializations for zero-sized bitsets, to avoid \"unsigned comparison\n  // with zero\" warnings.\n  template<>\n    inline bitset<0>&\n    bitset<0>::\n    set(size_t, bool)\n    {\n      __throw_out_of_range(__N(\"bitset::set\"));\n      return *this;\n    }\n      \n  template<>\n    inline bitset<0>&\n    bitset<0>::\n    reset(size_t)\n    {\n      __throw_out_of_range(__N(\"bitset::reset\"));\n      return *this;\n    }\n      \n  template<>\n    inline bitset<0>&\n    bitset<0>::\n    flip(size_t)\n    {\n      __throw_out_of_range(__N(\"bitset::flip\"));\n      return *this;\n    }\n      \n  template<>\n    inline bool\n    bitset<0>::\n    test(size_t) const\n    {\n      __throw_out_of_range(__N(\"bitset::test\"));\n      return false;\n    }\n  //@}\n\n_GLIBCXX_END_NESTED_NAMESPACE\n\n#undef _GLIBCXX_BITSET_WORDS\n#undef _GLIBCXX_BITSET_BITS_PER_WORD\n\n#ifdef _GLIBCXX_DEBUG\n# include <debug/bitset>\n#endif\n\n#endif /* _GLIBCXX_BITSET */\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/cassert",
    "content": "// -*- C++ -*- forwarding header.\n\n// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005\n// Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n/** @file cassert\n *  This is a Standard C++ Library file.  You should @c #include this file\n *  in your programs, rather than any of the \"*.h\" implementation files.\n *\n *  This is the C++ version of the Standard C Library header @c assert.h,\n *  and its contents are (mostly) the same as that header, but are all\n *  contained in the namespace @c std (except for names which are defined\n *  as macros in C).\n */\n\n//\n// ISO C++ 14882: 19.2  Assertions\n//\n\n// No include guards on this header...\n\n#pragma GCC system_header\n\n#include <assert.h>\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/cctype",
    "content": "// -*- C++ -*- forwarding header.\n\n// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005\n// Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n/** @file include/cctype\n *  This is a Standard C++ Library file.  You should @c #include this file\n *  in your programs, rather than any of the \"*.h\" implementation files.\n *\n *  This is the C++ version of the Standard C Library header @c ctype.h,\n *  and its contents are (mostly) the same as that header, but are all\n *  contained in the namespace @c std (except for names which are defined\n *  as macros in C).\n */\n\n//\n// ISO C++ 14882: <ccytpe>\n//\n\n#ifndef _GLIBCXX_CCTYPE\n#define _GLIBCXX_CCTYPE 1\n\n#pragma GCC system_header\n\n#include <bits/c++config.h>\n#include <ctype.h>\n\n// Get rid of those macros defined in <ctype.h> in lieu of real functions.\n#undef isalnum\n#undef isalpha\n#undef iscntrl\n#undef isdigit\n#undef isgraph\n#undef islower\n#undef isprint\n#undef ispunct\n#undef isspace\n#undef isupper\n#undef isxdigit\n#undef tolower\n#undef toupper\n\n_GLIBCXX_BEGIN_NAMESPACE(std)\n\n  using ::isalnum;\n  using ::isalpha;\n  using ::iscntrl;\n  using ::isdigit;\n  using ::isgraph;\n  using ::islower;\n  using ::isprint;\n  using ::ispunct;\n  using ::isspace;\n  using ::isupper;\n  using ::isxdigit;\n  using ::tolower;\n  using ::toupper;\n\n_GLIBCXX_END_NAMESPACE\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/cerrno",
    "content": "// The -*- C++ -*- forwarding header.\n\n// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005\n// Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n/** @file cerrno\n *  This is a Standard C++ Library file.  You should @c #include this file\n *  in your programs, rather than any of the \"*.h\" implementation files.\n *\n *  This is the C++ version of the Standard C Library header @c errno.h,\n *  and its contents are (mostly) the same as that header, but are all\n *  contained in the namespace @c std (except for names which are defined\n *  as macros in C).\n */\n\n//\n// ISO C++ 14882: 19.3  Error numbers\n//\n\n#ifndef _GLIBCXX_CERRNO\n#define _GLIBCXX_CERRNO 1\n\n#pragma GCC system_header\n\n#include <errno.h>\n\n// Adhere to section 17.4.1.2 clause 5 of ISO 14882:1998\n#ifndef errno\n#define errno errno\n#endif\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/cfloat",
    "content": "// -*- C++ -*- forwarding header.\n\n// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005\n// Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n/** @file include/cfloat\n *  This is a Standard C++ Library file.  You should @c #include this file\n *  in your programs, rather than any of the \"*.h\" implementation files.\n *\n *  This is the C++ version of the Standard C Library header @c float.h,\n *  and its contents are (mostly) the same as that header, but are all\n *  contained in the namespace @c std (except for names which are defined\n *  as macros in C).\n */\n\n//\n// ISO C++ 14882: 18.2.2  Implementation properties: C library\n//\n\n#ifndef _GLIBCXX_CFLOAT\n#define _GLIBCXX_CFLOAT 1\n\n#pragma GCC system_header\n\n#include <float.h>\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ciso646",
    "content": "// -*- C++ -*- forwarding header.\n\n// Copyright (C) 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n/** @file ciso646\n *  This is a Standard C++ Library file.  You should @c #include this file\n *  in your programs, rather than any of the \"*.h\" implementation files.\n *\n *  This is the C++ version of the Standard C Library header @c iso646.h,\n *  and its contents are (mostly) the same as that header, but are all\n *  contained in the namespace @c std (except for names which are defined\n *  as macros in C).\n */\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/climits",
    "content": "// -*- C++ -*- forwarding header.\n\n// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005\n// Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n/** @file include/climits\n *  This is a Standard C++ Library file.  You should @c #include this file\n *  in your programs, rather than any of the \"*.h\" implementation files.\n *\n *  This is the C++ version of the Standard C Library header @c limits.h,\n *  and its contents are (mostly) the same as that header, but are all\n *  contained in the namespace @c std (except for names which are defined\n *  as macros in C).\n */\n\n//\n// ISO C++ 14882: 18.2.2  Implementation properties: C library\n//\n\n#ifndef _GLIBCXX_CLIMITS\n#define _GLIBCXX_CLIMITS 1\n\n#pragma GCC system_header\n\n#include <limits.h>\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/clocale",
    "content": "// -*- C++ -*- forwarding header.\n\n// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005\n// Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n/** @file clocale\n *  This is a Standard C++ Library file.  You should @c #include this file\n *  in your programs, rather than any of the \"*.h\" implementation files.\n *\n *  This is the C++ version of the Standard C Library header @c locale.h,\n *  and its contents are (mostly) the same as that header, but are all\n *  contained in the namespace @c std (except for names which are defined\n *  as macros in C).\n */\n\n//\n// ISO C++ 14882: 18.2.2  Implementation properties: C library\n//\n\n#ifndef _GLIBCXX_CLOCALE\n#define _GLIBCXX_CLOCALE 1\n\n#pragma GCC system_header\n\n#include <bits/c++config.h>\n#include <locale.h>\n\n// Get rid of those macros defined in <locale.h> in lieu of real functions.\n#undef setlocale\n#undef localeconv\n\n_GLIBCXX_BEGIN_NAMESPACE(std)\n\n  using ::lconv;\n  using ::setlocale;\n  using ::localeconv;\n\n_GLIBCXX_END_NAMESPACE\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/cmath",
    "content": "// -*- C++ -*- C forwarding header.\n\n// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006\n// Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n/** @file include/cmath\n *  This is a Standard C++ Library file.  You should @c #include this file\n *  in your programs, rather than any of the \"*.h\" implementation files.\n *\n *  This is the C++ version of the Standard C Library header @c math.h,\n *  and its contents are (mostly) the same as that header, but are all\n *  contained in the namespace @c std (except for names which are defined\n *  as macros in C).\n */\n\n//\n// ISO C++ 14882: 26.5  C library\n//\n\n#ifndef _GLIBCXX_CMATH\n#define _GLIBCXX_CMATH 1\n\n#pragma GCC system_header\n\n#include <bits/c++config.h>\n#include <bits/cpp_type_traits.h>\n#include <ext/type_traits.h>\n\n#include <math.h>\n\n// Get rid of those macros defined in <math.h> in lieu of real functions.\n#undef abs\n#undef div\n#undef acos\n#undef asin\n#undef atan\n#undef atan2\n#undef ceil\n#undef cos\n#undef cosh\n#undef exp\n#undef fabs\n#undef floor\n#undef fmod\n#undef frexp\n#undef ldexp\n#undef log\n#undef log10\n#undef modf\n#undef pow\n#undef sin\n#undef sinh\n#undef sqrt\n#undef tan\n#undef tanh\n\n_GLIBCXX_BEGIN_NAMESPACE(std)\n\n  // Forward declaration of a helper function.  This really should be\n  // an `exported' forward declaration.\n  template<typename _Tp> _Tp __cmath_power(_Tp, unsigned int);\n\n  inline double\n  abs(double __x)\n  { return __builtin_fabs(__x); }\n\n  inline float\n  abs(float __x)\n  { return __builtin_fabsf(__x); }\n\n  inline long double\n  abs(long double __x)\n  { return __builtin_fabsl(__x); }\n\n  using ::acos;\n\n  inline float\n  acos(float __x)\n  { return __builtin_acosf(__x); }\n\n  inline long double\n  acos(long double __x)\n  { return __builtin_acosl(__x); }\n\n  template<typename _Tp>\n    inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, \n\t\t\t\t\t   double>::__type\n    acos(_Tp __x)\n    { return __builtin_acos(__x); }\n\n  using ::asin;\n\n  inline float\n  asin(float __x)\n  { return __builtin_asinf(__x); }\n\n  inline long double\n  asin(long double __x)\n  { return __builtin_asinl(__x); }\n\n  template<typename _Tp>\n  inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value,\n\t\t\t\t\t double>::__type\n    asin(_Tp __x)\n    { return __builtin_asin(__x); }\n\n  using ::atan;\n\n  inline float\n  atan(float __x)\n  { return __builtin_atanf(__x); }\n\n  inline long double\n  atan(long double __x)\n  { return __builtin_atanl(__x); }\n\n  template<typename _Tp>\n  inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, \n\t\t\t\t\t double>::__type\n    atan(_Tp __x)\n    { return __builtin_atan(__x); }\n\n  using ::atan2;\n\n  inline float\n  atan2(float __y, float __x)\n  { return __builtin_atan2f(__y, __x); }\n\n  inline long double\n  atan2(long double __y, long double __x)\n  { return __builtin_atan2l(__y, __x); }\n\n  template<typename _Tp, typename _Up>\n    inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value\n    \t\t\t\t\t   && __is_integer<_Up>::__value, \n\t\t\t\t\t   double>::__type\n    atan2(_Tp __y, _Up __x)\n    { return __builtin_atan2(__y, __x); }\n\n  using ::ceil;\n\n  inline float\n  ceil(float __x)\n  { return __builtin_ceilf(__x); }\n\n  inline long double\n  ceil(long double __x)\n  { return __builtin_ceill(__x); }\n\n  template<typename _Tp>\n    inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, \n\t\t\t\t\t   double>::__type\n    ceil(_Tp __x)\n    { return __builtin_ceil(__x); }\n\n  using ::cos;\n\n  inline float\n  cos(float __x)\n  { return __builtin_cosf(__x); }\n\n  inline long double\n  cos(long double __x)\n  { return __builtin_cosl(__x); }\n\n  template<typename _Tp>\n    inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, \n\t\t\t\t\t   double>::__type\n    cos(_Tp __x)\n    { return __builtin_cos(__x); }\n\n  using ::cosh;\n\n  inline float\n  cosh(float __x)\n  { return __builtin_coshf(__x); }\n\n  inline long double\n  cosh(long double __x)\n  { return __builtin_coshl(__x); }\n\n  template<typename _Tp>\n    inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, \n\t\t\t\t\t   double>::__type\n    cosh(_Tp __x)\n    { return __builtin_cosh(__x); }\n\n  using ::exp;\n\n  inline float\n  exp(float __x)\n  { return __builtin_expf(__x); }\n\n  inline long double\n  exp(long double __x)\n  { return __builtin_expl(__x); }\n\n  template<typename _Tp>\n    inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, \n\t\t\t\t\t   double>::__type\n    exp(_Tp __x)\n    { return __builtin_exp(__x); }\n\n  using ::fabs;\n\n  inline float\n  fabs(float __x)\n  { return __builtin_fabsf(__x); }\n\n  inline long double\n  fabs(long double __x)\n  { return __builtin_fabsl(__x); }\n\n  template<typename _Tp>\n    inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, \n\t\t\t\t\t   double>::__type\n    fabs(_Tp __x)\n    { return __builtin_fabs(__x); }\n\n  using ::floor;\n\n  inline float\n  floor(float __x)\n  { return __builtin_floorf(__x); }\n\n  inline long double\n  floor(long double __x)\n  { return __builtin_floorl(__x); }\n\n  template<typename _Tp>\n    inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, \n\t\t\t\t\t   double>::__type\n    floor(_Tp __x)\n    { return __builtin_floor(__x); }\n\n  using ::fmod;\n\n  inline float\n  fmod(float __x, float __y)\n  { return __builtin_fmodf(__x, __y); }\n\n  inline long double\n  fmod(long double __x, long double __y)\n  { return __builtin_fmodl(__x, __y); }\n\n  using ::frexp;\n\n  inline float\n  frexp(float __x, int* __exp)\n  { return __builtin_frexpf(__x, __exp); }\n\n  inline long double\n  frexp(long double __x, int* __exp)\n  { return __builtin_frexpl(__x, __exp); }\n\n  template<typename _Tp>\n    inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, \n\t\t\t\t\t   double>::__type\n    frexp(_Tp __x, int* __exp)\n    { return __builtin_frexp(__x, __exp); }\n\n  using ::ldexp;\n\n  inline float\n  ldexp(float __x, int __exp)\n  { return __builtin_ldexpf(__x, __exp); }\n\n  inline long double\n  ldexp(long double __x, int __exp)\n  { return __builtin_ldexpl(__x, __exp); }\n\n  template<typename _Tp>\n    inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, \n\t\t\t\t\t   double>::__type\n  ldexp(_Tp __x, int __exp)\n  { return __builtin_ldexp(__x, __exp); }\n\n  using ::log;\n\n  inline float\n  log(float __x)\n  { return __builtin_logf(__x); }\n\n  inline long double\n  log(long double __x)\n  { return __builtin_logl(__x); }\n\n  template<typename _Tp>\n    inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, \n\t\t\t\t\t   double>::__type\n    log(_Tp __x)\n    { return __builtin_log(__x); }\n\n  using ::log10;\n\n  inline float\n  log10(float __x)\n  { return __builtin_log10f(__x); }\n\n  inline long double\n  log10(long double __x)\n  { return __builtin_log10l(__x); }\n\n  template<typename _Tp>\n    inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, \n\t\t\t\t\t   double>::__type\n    log10(_Tp __x)\n    { return __builtin_log10(__x); }\n\n  using ::modf;\n\n  inline float\n  modf(float __x, float* __iptr)\n  { return __builtin_modff(__x, __iptr); }\n\n  inline long double\n  modf(long double __x, long double* __iptr)\n  { return __builtin_modfl(__x, __iptr); }\n\n  template<typename _Tp>\n    inline _Tp\n    __pow_helper(_Tp __x, int __n)\n    {\n      return __n < 0\n        ? _Tp(1)/__cmath_power(__x, -__n)\n        : __cmath_power(__x, __n);\n    }\n\n  using ::pow;\n\n  inline float\n  pow(float __x, float __y)\n  { return __builtin_powf(__x, __y); }\n\n  inline long double\n  pow(long double __x, long double __y)\n  { return __builtin_powl(__x, __y); }\n\n  inline double\n  pow(double __x, int __i)\n  { return __builtin_powi(__x, __i); }\n\n  inline float\n  pow(float __x, int __n)\n  { return __builtin_powif(__x, __n); }\n\n  inline long double\n  pow(long double __x, int __n)\n  { return __builtin_powil(__x, __n); }\n\n  using ::sin;\n\n  inline float\n  sin(float __x)\n  { return __builtin_sinf(__x); }\n\n  inline long double\n  sin(long double __x)\n  { return __builtin_sinl(__x); }\n\n  template<typename _Tp>\n    inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, \n\t\t\t\t\t   double>::__type\n    sin(_Tp __x)\n    { return __builtin_sin(__x); }\n\n  using ::sinh;\n\n  inline float\n  sinh(float __x)\n  { return __builtin_sinhf(__x); }\n\n  inline long double\n  sinh(long double __x)\n  { return __builtin_sinhl(__x); }\n\n  template<typename _Tp>\n    inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, \n\t\t\t\t\t   double>::__type\n    sinh(_Tp __x)\n    { return __builtin_sinh(__x); }\n\n  using ::sqrt;\n\n  inline float\n  sqrt(float __x)\n  { return __builtin_sqrtf(__x); }\n\n  inline long double\n  sqrt(long double __x)\n  { return __builtin_sqrtl(__x); }\n\n  template<typename _Tp>\n    inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, \n\t\t\t\t\t   double>::__type\n    sqrt(_Tp __x)\n    { return __builtin_sqrt(__x); }\n\n  using ::tan;\n\n  inline float\n  tan(float __x)\n  { return __builtin_tanf(__x); }\n\n  inline long double\n  tan(long double __x)\n  { return __builtin_tanl(__x); }\n\n  template<typename _Tp>\n    inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, \n\t\t\t\t\t   double>::__type\n    tan(_Tp __x)\n    { return __builtin_tan(__x); }\n\n  using ::tanh;\n\n  inline float\n  tanh(float __x)\n  { return __builtin_tanhf(__x); }\n\n  inline long double\n  tanh(long double __x)\n  { return __builtin_tanhl(__x); }\n\n  template<typename _Tp>\n    inline typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, \n\t\t\t\t\t   double>::__type\n    tanh(_Tp __x)\n    { return __builtin_tanh(__x); }\n\n_GLIBCXX_END_NAMESPACE\n\n#if _GLIBCXX_USE_C99_MATH\n#if !_GLIBCXX_USE_C99_FP_MACROS_DYNAMIC\n// These are possible macros imported from C99-land. For strict\n// conformance, remove possible C99-injected names from the global\n// namespace, and sequester them in the __gnu_cxx extension namespace.\n\n_GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)\n\n  template<typename _Tp>\n    inline int\n    __capture_fpclassify(_Tp __f) { return fpclassify(__f); }\n\n  template<typename _Tp>\n    inline int\n    __capture_isfinite(_Tp __f) { return isfinite(__f); }\n\n  template<typename _Tp>\n    inline int\n    __capture_isinf(_Tp __f) { return isinf(__f); }\n\n  template<typename _Tp>\n    inline int\n    __capture_isnan(_Tp __f) { return isnan(__f); }\n\n  template<typename _Tp>\n    inline int\n    __capture_isnormal(_Tp __f) { return isnormal(__f); }\n\n  template<typename _Tp>\n    inline int\n    __capture_signbit(_Tp __f) { return signbit(__f); }\n\n  template<typename _Tp>\n    inline int\n    __capture_isgreater(_Tp __f1, _Tp __f2)\n    { return isgreater(__f1, __f2); }\n\n  template<typename _Tp>\n    inline int\n    __capture_isgreaterequal(_Tp __f1, _Tp __f2)\n    { return isgreaterequal(__f1, __f2); }\n\n  template<typename _Tp>\n    inline int\n    __capture_isless(_Tp __f1, _Tp __f2) { return isless(__f1, __f2); }\n\n  template<typename _Tp>\n    inline int\n    __capture_islessequal(_Tp __f1, _Tp __f2)\n    { return islessequal(__f1, __f2); }\n\n  template<typename _Tp>\n    inline int\n    __capture_islessgreater(_Tp __f1, _Tp __f2)\n    { return islessgreater(__f1, __f2); }\n\n  template<typename _Tp>\n    inline int\n    __capture_isunordered(_Tp __f1, _Tp __f2)\n    { return isunordered(__f1, __f2); }\n\n_GLIBCXX_END_NAMESPACE\n\n// Only undefine the C99 FP macros, if actually captured for namespace movement\n#undef fpclassify\n#undef isfinite\n#undef isinf\n#undef isnan\n#undef isnormal\n#undef signbit\n#undef isgreater\n#undef isgreaterequal\n#undef isless\n#undef islessequal\n#undef islessgreater\n#undef isunordered\n\n_GLIBCXX_BEGIN_NAMESPACE(std)\n\n  template<typename _Tp>\n    inline int\n    fpclassify(_Tp __f) { return ::__gnu_cxx::__capture_fpclassify(__f); }\n\n  template<typename _Tp>\n    inline int\n    isfinite(_Tp __f) { return ::__gnu_cxx::__capture_isfinite(__f); }\n\n  template<typename _Tp>\n    inline int\n    isinf(_Tp __f) { return ::__gnu_cxx::__capture_isinf(__f); }\n\n  template<typename _Tp>\n    inline int\n    isnan(_Tp __f) { return ::__gnu_cxx::__capture_isnan(__f); }\n\n  template<typename _Tp>\n    inline int\n    isnormal(_Tp __f) { return ::__gnu_cxx::__capture_isnormal(__f); }\n\n  template<typename _Tp>\n    inline int\n    signbit(_Tp __f) { return ::__gnu_cxx::__capture_signbit(__f); }\n\n  template<typename _Tp>\n    inline int\n    isgreater(_Tp __f1, _Tp __f2)\n    { return ::__gnu_cxx::__capture_isgreater(__f1, __f2); }\n\n  template<typename _Tp>\n    inline int\n    isgreaterequal(_Tp __f1, _Tp __f2)\n    { return ::__gnu_cxx::__capture_isgreaterequal(__f1, __f2); }\n\n  template<typename _Tp>\n    inline int\n    isless(_Tp __f1, _Tp __f2)\n    { return ::__gnu_cxx::__capture_isless(__f1, __f2); }\n\n  template<typename _Tp>\n    inline int\n    islessequal(_Tp __f1, _Tp __f2)\n    { return ::__gnu_cxx::__capture_islessequal(__f1, __f2); }\n\n  template<typename _Tp>\n    inline int\n    islessgreater(_Tp __f1, _Tp __f2)\n    { return ::__gnu_cxx::__capture_islessgreater(__f1, __f2); }\n\n  template<typename _Tp>\n    inline int\n    isunordered(_Tp __f1, _Tp __f2)\n    { return ::__gnu_cxx::__capture_isunordered(__f1, __f2); }\n\n_GLIBCXX_END_NAMESPACE\n\n#endif /* _GLIBCXX_USE_C99_FP_MACROS_DYNAMIC */\n#endif\n\n#ifndef _GLIBCXX_EXPORT_TEMPLATE\n# include <bits/cmath.tcc>\n#endif\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/complex",
    "content": "// The template and inlines for the -*- C++ -*- complex number classes.\n\n// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005\n// Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n/** @file complex\n *  This is a Standard C++ Library header.\n */\n\n//\n// ISO C++ 14882: 26.2  Complex Numbers\n// Note: this is not a conforming implementation.\n// Initially implemented by Ulrich Drepper <drepper@cygnus.com>\n// Improved by Gabriel Dos Reis <dosreis@cmla.ens-cachan.fr>\n//\n\n#ifndef _GLIBCXX_COMPLEX\n#define _GLIBCXX_COMPLEX 1\n\n#pragma GCC system_header\n\n#include <bits/c++config.h>\n#include <bits/cpp_type_traits.h>\n#include <cmath>\n#include <sstream>\n\n_GLIBCXX_BEGIN_NAMESPACE(std)\n\n  // Forward declarations.\n  template<typename _Tp> class complex;\n  template<> class complex<float>;\n  template<> class complex<double>;\n  template<> class complex<long double>;\n\n  ///  Return magnitude of @a z.\n  template<typename _Tp> _Tp abs(const complex<_Tp>&);\n  ///  Return phase angle of @a z.\n  template<typename _Tp> _Tp arg(const complex<_Tp>&);\n  ///  Return @a z magnitude squared.\n  template<typename _Tp> _Tp norm(const complex<_Tp>&);\n\n  ///  Return complex conjugate of @a z.\n  template<typename _Tp> complex<_Tp> conj(const complex<_Tp>&);\n  ///  Return complex with magnitude @a rho and angle @a theta.\n  template<typename _Tp> complex<_Tp> polar(const _Tp&, const _Tp& = 0);\n\n  // Transcendentals:\n  /// Return complex cosine of @a z.\n  template<typename _Tp> complex<_Tp> cos(const complex<_Tp>&);\n  /// Return complex hyperbolic cosine of @a z.\n  template<typename _Tp> complex<_Tp> cosh(const complex<_Tp>&);\n  /// Return complex base e exponential of @a z.\n  template<typename _Tp> complex<_Tp> exp(const complex<_Tp>&);\n  /// Return complex natural logarithm of @a z.\n  template<typename _Tp> complex<_Tp> log(const complex<_Tp>&);\n  /// Return complex base 10 logarithm of @a z.\n  template<typename _Tp> complex<_Tp> log10(const complex<_Tp>&);\n  /// Return complex cosine of @a z.\n  template<typename _Tp> complex<_Tp> pow(const complex<_Tp>&, int);\n  /// Return @a x to the @a y'th power.\n  template<typename _Tp> complex<_Tp> pow(const complex<_Tp>&, const _Tp&);\n  /// Return @a x to the @a y'th power.\n  template<typename _Tp> complex<_Tp> pow(const complex<_Tp>&, \n                                          const complex<_Tp>&);\n  /// Return @a x to the @a y'th power.\n  template<typename _Tp> complex<_Tp> pow(const _Tp&, const complex<_Tp>&);\n  /// Return complex sine of @a z.\n  template<typename _Tp> complex<_Tp> sin(const complex<_Tp>&);\n  /// Return complex hyperbolic sine of @a z.\n  template<typename _Tp> complex<_Tp> sinh(const complex<_Tp>&);\n  /// Return complex square root of @a z.\n  template<typename _Tp> complex<_Tp> sqrt(const complex<_Tp>&);\n  /// Return complex tangent of @a z.\n  template<typename _Tp> complex<_Tp> tan(const complex<_Tp>&);\n  /// Return complex hyperbolic tangent of @a z.\n  template<typename _Tp> complex<_Tp> tanh(const complex<_Tp>&);\n  //@}\n    \n    \n  // 26.2.2  Primary template class complex\n  /**\n   *  Template to represent complex numbers.\n   *\n   *  Specializations for float, double, and long double are part of the\n   *  library.  Results with any other type are not guaranteed.\n   *\n   *  @param  Tp  Type of real and imaginary values.\n  */\n  template<typename _Tp>\n    struct complex\n    {\n      /// Value typedef.\n      typedef _Tp value_type;\n      \n      ///  Default constructor.  First parameter is x, second parameter is y.\n      ///  Unspecified parameters default to 0.\n      complex(const _Tp& = _Tp(), const _Tp & = _Tp());\n\n      // Lets the compiler synthesize the copy constructor   \n      // complex (const complex<_Tp>&);\n      ///  Copy constructor.\n      template<typename _Up>\n        complex(const complex<_Up>&);\n\n      ///  Return real part of complex number.\n      _Tp& real(); \n      ///  Return real part of complex number.\n      const _Tp& real() const;\n      ///  Return imaginary part of complex number.\n      _Tp& imag();\n      ///  Return imaginary part of complex number.\n      const _Tp& imag() const;\n\n      /// Assign this complex number to scalar @a t.\n      complex<_Tp>& operator=(const _Tp&);\n      /// Add @a t to this complex number.\n      complex<_Tp>& operator+=(const _Tp&);\n      /// Subtract @a t from this complex number.\n      complex<_Tp>& operator-=(const _Tp&);\n      /// Multiply this complex number by @a t.\n      complex<_Tp>& operator*=(const _Tp&);\n      /// Divide this complex number by @a t.\n      complex<_Tp>& operator/=(const _Tp&);\n\n      // Lets the compiler synthesize the\n      // copy and assignment operator\n      // complex<_Tp>& operator= (const complex<_Tp>&);\n      /// Assign this complex number to complex @a z.\n      template<typename _Up>\n        complex<_Tp>& operator=(const complex<_Up>&);\n      /// Add @a z to this complex number.\n      template<typename _Up>\n        complex<_Tp>& operator+=(const complex<_Up>&);\n      /// Subtract @a z from this complex number.\n      template<typename _Up>\n        complex<_Tp>& operator-=(const complex<_Up>&);\n      /// Multiply this complex number by @a z.\n      template<typename _Up>\n        complex<_Tp>& operator*=(const complex<_Up>&);\n      /// Divide this complex number by @a z.\n      template<typename _Up>\n        complex<_Tp>& operator/=(const complex<_Up>&);\n\n      const complex& __rep() const;\n\n    private:\n      _Tp _M_real;\n      _Tp _M_imag;\n    };\n\n  template<typename _Tp>\n    inline _Tp&\n    complex<_Tp>::real() { return _M_real; }\n\n  template<typename _Tp>\n    inline const _Tp&\n    complex<_Tp>::real() const { return _M_real; }\n\n  template<typename _Tp>\n    inline _Tp&\n    complex<_Tp>::imag() { return _M_imag; }\n\n  template<typename _Tp>\n    inline const _Tp&\n    complex<_Tp>::imag() const { return _M_imag; }\n\n  template<typename _Tp>\n    inline \n    complex<_Tp>::complex(const _Tp& __r, const _Tp& __i)\n    : _M_real(__r), _M_imag(__i) { }\n\n  template<typename _Tp>\n    template<typename _Up>\n    inline \n    complex<_Tp>::complex(const complex<_Up>& __z)\n    : _M_real(__z.real()), _M_imag(__z.imag()) { }\n        \n  template<typename _Tp>\n    complex<_Tp>&\n    complex<_Tp>::operator=(const _Tp& __t)\n    {\n     _M_real = __t;\n     _M_imag = _Tp();\n     return *this;\n    } \n\n  // 26.2.5/1\n  template<typename _Tp>\n    inline complex<_Tp>&\n    complex<_Tp>::operator+=(const _Tp& __t)\n    {\n      _M_real += __t;\n      return *this;\n    }\n\n  // 26.2.5/3\n  template<typename _Tp>\n    inline complex<_Tp>&\n    complex<_Tp>::operator-=(const _Tp& __t)\n    {\n      _M_real -= __t;\n      return *this;\n    }\n\n  // 26.2.5/5\n  template<typename _Tp>\n    complex<_Tp>&\n    complex<_Tp>::operator*=(const _Tp& __t)\n    {\n      _M_real *= __t;\n      _M_imag *= __t;\n      return *this;\n    }\n\n  // 26.2.5/7\n  template<typename _Tp>\n    complex<_Tp>&\n    complex<_Tp>::operator/=(const _Tp& __t)\n    {\n      _M_real /= __t;\n      _M_imag /= __t;\n      return *this;\n    }\n\n  template<typename _Tp>\n    template<typename _Up>\n    complex<_Tp>&\n    complex<_Tp>::operator=(const complex<_Up>& __z)\n    {\n      _M_real = __z.real();\n      _M_imag = __z.imag();\n      return *this;\n    }\n\n  // 26.2.5/9\n  template<typename _Tp>\n    template<typename _Up>\n    complex<_Tp>&\n    complex<_Tp>::operator+=(const complex<_Up>& __z)\n    {\n      _M_real += __z.real();\n      _M_imag += __z.imag();\n      return *this;\n    }\n\n  // 26.2.5/11\n  template<typename _Tp>\n    template<typename _Up>\n    complex<_Tp>&\n    complex<_Tp>::operator-=(const complex<_Up>& __z)\n    {\n      _M_real -= __z.real();\n      _M_imag -= __z.imag();\n      return *this;\n    }\n\n  // 26.2.5/13\n  // XXX: This is a grammar school implementation.\n  template<typename _Tp>\n    template<typename _Up>\n    complex<_Tp>&\n    complex<_Tp>::operator*=(const complex<_Up>& __z)\n    {\n      const _Tp __r = _M_real * __z.real() - _M_imag * __z.imag();\n      _M_imag = _M_real * __z.imag() + _M_imag * __z.real();\n      _M_real = __r;\n      return *this;\n    }\n\n  // 26.2.5/15\n  // XXX: This is a grammar school implementation.\n  template<typename _Tp>\n    template<typename _Up>\n    complex<_Tp>&\n    complex<_Tp>::operator/=(const complex<_Up>& __z)\n    {\n      const _Tp __r =  _M_real * __z.real() + _M_imag * __z.imag();\n      const _Tp __n = std::norm(__z);\n      _M_imag = (_M_imag * __z.real() - _M_real * __z.imag()) / __n;\n      _M_real = __r / __n;\n      return *this;\n    }\n\n  template<typename _Tp>\n    inline const complex<_Tp>&\n    complex<_Tp>::__rep() const { return *this; }\n    \n  // Operators:\n  //@{\n  ///  Return new complex value @a x plus @a y.\n  template<typename _Tp>\n    inline complex<_Tp>\n    operator+(const complex<_Tp>& __x, const complex<_Tp>& __y)\n    {\n      complex<_Tp> __r = __x;\n      __r += __y;\n      return __r;\n    }\n\n  template<typename _Tp>\n    inline complex<_Tp>\n    operator+(const complex<_Tp>& __x, const _Tp& __y)\n    {\n      complex<_Tp> __r = __x;\n      __r.real() += __y;\n      return __r;\n    }\n\n  template<typename _Tp>\n    inline complex<_Tp>\n    operator+(const _Tp& __x, const complex<_Tp>& __y)\n    {\n      complex<_Tp> __r = __y;\n      __r.real() += __x;\n      return __r;\n    }\n  //@}\n\n  //@{\n  ///  Return new complex value @a x minus @a y.\n  template<typename _Tp>\n    inline complex<_Tp>\n    operator-(const complex<_Tp>& __x, const complex<_Tp>& __y)\n    {\n      complex<_Tp> __r = __x;\n      __r -= __y;\n      return __r;\n    }\n    \n  template<typename _Tp>\n    inline complex<_Tp>\n    operator-(const complex<_Tp>& __x, const _Tp& __y)\n    {\n      complex<_Tp> __r = __x;\n      __r.real() -= __y;\n      return __r;\n    }\n\n  template<typename _Tp>\n    inline complex<_Tp>\n    operator-(const _Tp& __x, const complex<_Tp>& __y)\n    {\n      complex<_Tp> __r(__x, -__y.imag());\n      __r.real() -= __y.real();\n      return __r;\n    }\n  //@}\n\n  //@{\n  ///  Return new complex value @a x times @a y.\n  template<typename _Tp>\n    inline complex<_Tp>\n    operator*(const complex<_Tp>& __x, const complex<_Tp>& __y)\n    {\n      complex<_Tp> __r = __x;\n      __r *= __y;\n      return __r;\n    }\n\n  template<typename _Tp>\n    inline complex<_Tp>\n    operator*(const complex<_Tp>& __x, const _Tp& __y)\n    {\n      complex<_Tp> __r = __x;\n      __r *= __y;\n      return __r;\n    }\n\n  template<typename _Tp>\n    inline complex<_Tp>\n    operator*(const _Tp& __x, const complex<_Tp>& __y)\n    {\n      complex<_Tp> __r = __y;\n      __r *= __x;\n      return __r;\n    }\n  //@}\n\n  //@{\n  ///  Return new complex value @a x divided by @a y.\n  template<typename _Tp>\n    inline complex<_Tp>\n    operator/(const complex<_Tp>& __x, const complex<_Tp>& __y)\n    {\n      complex<_Tp> __r = __x;\n      __r /= __y;\n      return __r;\n    }\n    \n  template<typename _Tp>\n    inline complex<_Tp>\n    operator/(const complex<_Tp>& __x, const _Tp& __y)\n    {\n      complex<_Tp> __r = __x;\n      __r /= __y;\n      return __r;\n    }\n\n  template<typename _Tp>\n    inline complex<_Tp>\n    operator/(const _Tp& __x, const complex<_Tp>& __y)\n    {\n      complex<_Tp> __r = __x;\n      __r /= __y;\n      return __r;\n    }\n  //@}\n\n  ///  Return @a x.\n  template<typename _Tp>\n    inline complex<_Tp>\n    operator+(const complex<_Tp>& __x)\n    { return __x; }\n\n  ///  Return complex negation of @a x.\n  template<typename _Tp>\n    inline complex<_Tp>\n    operator-(const complex<_Tp>& __x)\n    {  return complex<_Tp>(-__x.real(), -__x.imag()); }\n\n  //@{\n  ///  Return true if @a x is equal to @a y.\n  template<typename _Tp>\n    inline bool\n    operator==(const complex<_Tp>& __x, const complex<_Tp>& __y)\n    { return __x.real() == __y.real() && __x.imag() == __y.imag(); }\n\n  template<typename _Tp>\n    inline bool\n    operator==(const complex<_Tp>& __x, const _Tp& __y)\n    { return __x.real() == __y && __x.imag() == _Tp(); }\n\n  template<typename _Tp>\n    inline bool\n    operator==(const _Tp& __x, const complex<_Tp>& __y)\n    { return __x == __y.real() && _Tp() == __y.imag(); }\n  //@}\n\n  //@{\n  ///  Return false if @a x is equal to @a y.\n  template<typename _Tp>\n    inline bool\n    operator!=(const complex<_Tp>& __x, const complex<_Tp>& __y)\n    { return __x.real() != __y.real() || __x.imag() != __y.imag(); }\n\n  template<typename _Tp>\n    inline bool\n    operator!=(const complex<_Tp>& __x, const _Tp& __y)\n    { return __x.real() != __y || __x.imag() != _Tp(); }\n\n  template<typename _Tp>\n    inline bool\n    operator!=(const _Tp& __x, const complex<_Tp>& __y)\n    { return __x != __y.real() || _Tp() != __y.imag(); }\n  //@}\n\n  ///  Extraction operator for complex values.\n  template<typename _Tp, typename _CharT, class _Traits>\n    basic_istream<_CharT, _Traits>&\n    operator>>(basic_istream<_CharT, _Traits>& __is, complex<_Tp>& __x)\n    {\n      _Tp __re_x, __im_x;\n      _CharT __ch;\n      __is >> __ch;\n      if (__ch == '(') \n\t{\n\t  __is >> __re_x >> __ch;\n\t  if (__ch == ',') \n\t    {\n\t      __is >> __im_x >> __ch;\n\t      if (__ch == ')') \n\t\t__x = complex<_Tp>(__re_x, __im_x);\n\t      else\n\t\t__is.setstate(ios_base::failbit);\n\t    }\n\t  else if (__ch == ')') \n\t    __x = __re_x;\n\t  else\n\t    __is.setstate(ios_base::failbit);\n\t}\n      else \n\t{\n\t  __is.putback(__ch);\n\t  __is >> __re_x;\n\t  __x = __re_x;\n\t}\n      return __is;\n    }\n\n  ///  Insertion operator for complex values.\n  template<typename _Tp, typename _CharT, class _Traits>\n    basic_ostream<_CharT, _Traits>&\n    operator<<(basic_ostream<_CharT, _Traits>& __os, const complex<_Tp>& __x)\n    {\n      basic_ostringstream<_CharT, _Traits> __s;\n      __s.flags(__os.flags());\n      __s.imbue(__os.getloc());\n      __s.precision(__os.precision());\n      __s << '(' << __x.real() << ',' << __x.imag() << ')';\n      return __os << __s.str();\n    }\n\n  // Values\n  template<typename _Tp>\n    inline _Tp&\n    real(complex<_Tp>& __z)\n    { return __z.real(); }\n    \n  template<typename _Tp>\n    inline const _Tp&\n    real(const complex<_Tp>& __z)\n    { return __z.real(); }\n    \n  template<typename _Tp>\n    inline _Tp&\n    imag(complex<_Tp>& __z)\n    { return __z.imag(); }\n    \n  template<typename _Tp>\n    inline const _Tp&\n    imag(const complex<_Tp>& __z)\n    { return __z.imag(); }\n\n  // 26.2.7/3 abs(__z):  Returns the magnitude of __z.\n  template<typename _Tp>\n    inline _Tp\n    __complex_abs(const complex<_Tp>& __z)\n    {\n      _Tp __x = __z.real();\n      _Tp __y = __z.imag();\n      const _Tp __s = std::max(abs(__x), abs(__y));\n      if (__s == _Tp())  // well ...\n        return __s;\n      __x /= __s; \n      __y /= __s;\n      return __s * sqrt(__x * __x + __y * __y);\n    }\n\n#if _GLIBCXX_USE_C99_COMPLEX\n  inline float\n  __complex_abs(__complex__ float __z) { return __builtin_cabsf(__z); }\n\n  inline double\n  __complex_abs(__complex__ double __z) { return __builtin_cabs(__z); }\n\n  inline long double\n  __complex_abs(const __complex__ long double& __z)\n  { return __builtin_cabsl(__z); }\n\n  template<typename _Tp>\n    inline _Tp\n    abs(const complex<_Tp>& __z) { return __complex_abs(__z.__rep()); }\n#else\n  template<typename _Tp>\n    inline _Tp\n    abs(const complex<_Tp>& __z) { return __complex_abs(__z); }\n#endif  \n\n\n  // 26.2.7/4: arg(__z): Returns the phase angle of __z.\n  template<typename _Tp>\n    inline _Tp\n    __complex_arg(const complex<_Tp>& __z)\n    { return  atan2(__z.imag(), __z.real()); }\n\n#if _GLIBCXX_USE_C99_COMPLEX\n  inline float\n  __complex_arg(__complex__ float __z) { return __builtin_cargf(__z); }\n\n  inline double\n  __complex_arg(__complex__ double __z) { return __builtin_carg(__z); }\n\n  inline long double\n  __complex_arg(const __complex__ long double& __z)\n  { return __builtin_cargl(__z); }\n\n  template<typename _Tp>\n    inline _Tp\n    arg(const complex<_Tp>& __z) { return __complex_arg(__z.__rep()); }\n#else\n  template<typename _Tp>\n    inline _Tp\n    arg(const complex<_Tp>& __z) { return __complex_arg(__z); }\n#endif\n\n  // 26.2.7/5: norm(__z) returns the squared magintude of __z.\n  //     As defined, norm() is -not- a norm is the common mathematical\n  //     sens used in numerics.  The helper class _Norm_helper<> tries to\n  //     distinguish between builtin floating point and the rest, so as\n  //     to deliver an answer as close as possible to the real value.\n  template<bool>\n    struct _Norm_helper\n    {\n      template<typename _Tp>\n        static inline _Tp _S_do_it(const complex<_Tp>& __z)\n        {\n          const _Tp __x = __z.real();\n          const _Tp __y = __z.imag();\n          return __x * __x + __y * __y;\n        }\n    };\n\n  template<>\n    struct _Norm_helper<true>\n    {\n      template<typename _Tp>\n        static inline _Tp _S_do_it(const complex<_Tp>& __z)\n        {\n          _Tp __res = std::abs(__z);\n          return __res * __res;\n        }\n    };\n  \n  template<typename _Tp>\n    inline _Tp\n    norm(const complex<_Tp>& __z)\n    {\n      return _Norm_helper<__is_floating<_Tp>::__value \n\t&& !_GLIBCXX_FAST_MATH>::_S_do_it(__z);\n    }\n\n  template<typename _Tp>\n    inline complex<_Tp>\n    polar(const _Tp& __rho, const _Tp& __theta)\n    { return complex<_Tp>(__rho * cos(__theta), __rho * sin(__theta)); }\n\n  template<typename _Tp>\n    inline complex<_Tp>\n    conj(const complex<_Tp>& __z)\n    { return complex<_Tp>(__z.real(), -__z.imag()); }\n  \n  // Transcendentals\n\n  // 26.2.8/1 cos(__z):  Returns the cosine of __z.\n  template<typename _Tp>\n    inline complex<_Tp>\n    __complex_cos(const complex<_Tp>& __z)\n    {\n      const _Tp __x = __z.real();\n      const _Tp __y = __z.imag();\n      return complex<_Tp>(cos(__x) * cosh(__y), -sin(__x) * sinh(__y));\n    }\n\n#if _GLIBCXX_USE_C99_COMPLEX\n  inline __complex__ float\n  __complex_cos(__complex__ float __z) { return __builtin_ccosf(__z); }\n\n  inline __complex__ double\n  __complex_cos(__complex__ double __z) { return __builtin_ccos(__z); }\n\n  inline __complex__ long double\n  __complex_cos(const __complex__ long double& __z)\n  { return __builtin_ccosl(__z); }\n\n  template<typename _Tp>\n    inline complex<_Tp>\n    cos(const complex<_Tp>& __z) { return __complex_cos(__z.__rep()); }\n#else\n  template<typename _Tp>\n    inline complex<_Tp>\n    cos(const complex<_Tp>& __z) { return __complex_cos(__z); }\n#endif\n\n  // 26.2.8/2 cosh(__z): Returns the hyperbolic cosine of __z.\n  template<typename _Tp>\n    inline complex<_Tp>\n    __complex_cosh(const complex<_Tp>& __z)\n    {\n      const _Tp __x = __z.real();\n      const _Tp __y = __z.imag();\n      return complex<_Tp>(cosh(__x) * cos(__y), sinh(__x) * sin(__y));\n    }\n\n#if _GLIBCXX_USE_C99_COMPLEX\n  inline __complex__ float\n  __complex_cosh(__complex__ float __z) { return __builtin_ccoshf(__z); }\n\n  inline __complex__ double\n  __complex_cosh(__complex__ double __z) { return __builtin_ccosh(__z); }\n\n  inline __complex__ long double\n  __complex_cosh(const __complex__ long double& __z)\n  { return __builtin_ccoshl(__z); }\n\n  template<typename _Tp>\n    inline complex<_Tp>\n    cosh(const complex<_Tp>& __z) { return __complex_cosh(__z.__rep()); }\n#else\n  template<typename _Tp>\n    inline complex<_Tp>\n    cosh(const complex<_Tp>& __z) { return __complex_cosh(__z); }\n#endif\n\n  // 26.2.8/3 exp(__z): Returns the complex base e exponential of x\n  template<typename _Tp>\n    inline complex<_Tp>\n    __complex_exp(const complex<_Tp>& __z)\n    { return std::polar(exp(__z.real()), __z.imag()); }\n\n#if _GLIBCXX_USE_C99_COMPLEX\n  inline __complex__ float\n  __complex_exp(__complex__ float __z) { return __builtin_cexpf(__z); }\n\n  inline __complex__ double\n  __complex_exp(__complex__ double __z) { return __builtin_cexp(__z); }\n\n  inline __complex__ long double\n  __complex_exp(const __complex__ long double& __z)\n  { return __builtin_cexpl(__z); }\n\n  template<typename _Tp>\n    inline complex<_Tp>\n    exp(const complex<_Tp>& __z) { return __complex_exp(__z.__rep()); }\n#else\n  template<typename _Tp>\n    inline complex<_Tp>\n    exp(const complex<_Tp>& __z) { return __complex_exp(__z); }\n#endif\n\n  // 26.2.8/5 log(__z): Reurns the natural complex logaritm of __z.\n  //                    The branch cut is along the negative axis.\n  template<typename _Tp>\n    inline complex<_Tp>\n    __complex_log(const complex<_Tp>& __z)\n    { return complex<_Tp>(log(std::abs(__z)), std::arg(__z)); }\n\n#if _GLIBCXX_USE_C99_COMPLEX\n  inline __complex__ float\n  __complex_log(__complex__ float __z) { return __builtin_clogf(__z); }\n\n  inline __complex__ double\n  __complex_log(__complex__ double __z) { return __builtin_clog(__z); }\n\n  inline __complex__ long double\n  __complex_log(const __complex__ long double& __z)\n  { return __builtin_clogl(__z); }\n\n  template<typename _Tp>\n    inline complex<_Tp>\n    log(const complex<_Tp>& __z) { return __complex_log(__z.__rep()); }\n#else\n  template<typename _Tp>\n    inline complex<_Tp>\n    log(const complex<_Tp>& __z) { return __complex_log(__z); }\n#endif\n\n  template<typename _Tp>\n    inline complex<_Tp>\n    log10(const complex<_Tp>& __z)\n    { return std::log(__z) / log(_Tp(10.0)); }\n\n  // 26.2.8/10 sin(__z): Returns the sine of __z.\n  template<typename _Tp>\n    inline complex<_Tp>\n    __complex_sin(const complex<_Tp>& __z)\n    {\n      const _Tp __x = __z.real();\n      const _Tp __y = __z.imag();\n      return complex<_Tp>(sin(__x) * cosh(__y), cos(__x) * sinh(__y)); \n    }\n\n#if _GLIBCXX_USE_C99_COMPLEX\n  inline __complex__ float\n  __complex_sin(__complex__ float __z) { return __builtin_csinf(__z); }\n\n  inline __complex__ double\n  __complex_sin(__complex__ double __z) { return __builtin_csin(__z); }\n\n  inline __complex__ long double\n  __complex_sin(const __complex__ long double& __z)\n  { return __builtin_csinl(__z); }\n\n  template<typename _Tp>\n    inline complex<_Tp>\n    sin(const complex<_Tp>& __z) { return __complex_sin(__z.__rep()); }\n#else\n  template<typename _Tp>\n    inline complex<_Tp>\n    sin(const complex<_Tp>& __z) { return __complex_sin(__z); }\n#endif\n\n  // 26.2.8/11 sinh(__z): Returns the hyperbolic sine of __z.\n  template<typename _Tp>\n    inline complex<_Tp>\n    __complex_sinh(const complex<_Tp>& __z)\n    {\n      const _Tp __x = __z.real();\n      const _Tp  __y = __z.imag();\n      return complex<_Tp>(sinh(__x) * cos(__y), cosh(__x) * sin(__y));\n    }\n\n#if _GLIBCXX_USE_C99_COMPLEX\n  inline __complex__ float\n  __complex_sinh(__complex__ float __z) { return __builtin_csinhf(__z); }      \n\n  inline __complex__ double\n  __complex_sinh(__complex__ double __z) { return __builtin_csinh(__z); }      \n\n  inline __complex__ long double\n  __complex_sinh(const __complex__ long double& __z)\n  { return __builtin_csinhl(__z); }      \n\n  template<typename _Tp>\n    inline complex<_Tp>\n    sinh(const complex<_Tp>& __z) { return __complex_sinh(__z.__rep()); }\n#else\n  template<typename _Tp>\n    inline complex<_Tp>\n    sinh(const complex<_Tp>& __z) { return __complex_sinh(__z); }\n#endif\n\n  // 26.2.8/13 sqrt(__z): Returns the complex square root of __z.\n  //                     The branch cut is on the negative axis.\n  template<typename _Tp>\n    complex<_Tp>\n    __complex_sqrt(const complex<_Tp>& __z)\n    {\n      _Tp __x = __z.real();\n      _Tp __y = __z.imag();\n\n      if (__x == _Tp())\n        {\n          _Tp __t = sqrt(abs(__y) / 2);\n          return complex<_Tp>(__t, __y < _Tp() ? -__t : __t);\n        }\n      else\n        {\n          _Tp __t = sqrt(2 * (std::abs(__z) + abs(__x)));\n          _Tp __u = __t / 2;\n          return __x > _Tp()\n            ? complex<_Tp>(__u, __y / __t)\n            : complex<_Tp>(abs(__y) / __t, __y < _Tp() ? -__u : __u);\n        }\n    }\n\n#if _GLIBCXX_USE_C99_COMPLEX\n  inline __complex__ float\n  __complex_sqrt(__complex__ float __z) { return __builtin_csqrtf(__z); }\n\n  inline __complex__ double\n  __complex_sqrt(__complex__ double __z) { return __builtin_csqrt(__z); }\n\n  inline __complex__ long double\n  __complex_sqrt(const __complex__ long double& __z)\n  { return __builtin_csqrtl(__z); }\n\n  template<typename _Tp>\n    inline complex<_Tp>\n    sqrt(const complex<_Tp>& __z) { return __complex_sqrt(__z.__rep()); }\n#else\n  template<typename _Tp>\n    inline complex<_Tp>\n    sqrt(const complex<_Tp>& __z) { return __complex_sqrt(__z); }\n#endif\n\n  // 26.2.8/14 tan(__z):  Return the complex tangent of __z.\n  \n  template<typename _Tp>\n    inline complex<_Tp>\n    __complex_tan(const complex<_Tp>& __z)\n    { return std::sin(__z) / std::cos(__z); }\n\n#if _GLIBCXX_USE_C99_COMPLEX\n  inline __complex__ float\n  __complex_tan(__complex__ float __z) { return __builtin_ctanf(__z); }\n\n  inline __complex__ double\n  __complex_tan(__complex__ double __z) { return __builtin_ctan(__z); }\n\n  inline __complex__ long double\n  __complex_tan(const __complex__ long double& __z)\n  { return __builtin_ctanl(__z); }\n\n  template<typename _Tp>\n    inline complex<_Tp>\n    tan(const complex<_Tp>& __z) { return __complex_tan(__z.__rep()); }\n#else\n  template<typename _Tp>\n    inline complex<_Tp>\n    tan(const complex<_Tp>& __z) { return __complex_tan(__z); }\n#endif\n\n\n  // 26.2.8/15 tanh(__z):  Returns the hyperbolic tangent of __z.\n  \n  template<typename _Tp>\n    inline complex<_Tp>\n    __complex_tanh(const complex<_Tp>& __z)\n    { return std::sinh(__z) / std::cosh(__z); }\n\n#if _GLIBCXX_USE_C99_COMPLEX\n  inline __complex__ float\n  __complex_tanh(__complex__ float __z) { return __builtin_ctanhf(__z); }\n\n  inline __complex__ double\n  __complex_tanh(__complex__ double __z) { return __builtin_ctanh(__z); }\n\n  inline __complex__ long double\n  __complex_tanh(const __complex__ long double& __z)\n  { return __builtin_ctanhl(__z); }\n\n  template<typename _Tp>\n    inline complex<_Tp>\n    tanh(const complex<_Tp>& __z) { return __complex_tanh(__z.__rep()); }\n#else\n  template<typename _Tp>\n    inline complex<_Tp>\n    tanh(const complex<_Tp>& __z) { return __complex_tanh(__z); }\n#endif\n\n\n  // 26.2.8/9  pow(__x, __y): Returns the complex power base of __x\n  //                          raised to the __y-th power.  The branch\n  //                          cut is on the negative axis.\n  template<typename _Tp>\n    inline complex<_Tp>\n    pow(const complex<_Tp>& __z, int __n)\n    { return std::__pow_helper(__z, __n); }\n\n  template<typename _Tp>\n    complex<_Tp>\n    pow(const complex<_Tp>& __x, const _Tp& __y)\n    {\n#ifndef _GLIBCXX_USE_C99_COMPLEX\n      if (__x == _Tp())\n\treturn _Tp();\n#endif\n      if (__x.imag() == _Tp() && __x.real() > _Tp())\n        return pow(__x.real(), __y);\n\n      complex<_Tp> __t = std::log(__x);\n      return std::polar(exp(__y * __t.real()), __y * __t.imag());\n    }\n\n  template<typename _Tp>\n    inline complex<_Tp>\n    __complex_pow(const complex<_Tp>& __x, const complex<_Tp>& __y)\n    { return __x == _Tp() ? _Tp() : std::exp(__y * std::log(__x)); }\n\n#if _GLIBCXX_USE_C99_COMPLEX\n  inline __complex__ float\n  __complex_pow(__complex__ float __x, __complex__ float __y)\n  { return __builtin_cpowf(__x, __y); }\n\n  inline __complex__ double\n  __complex_pow(__complex__ double __x, __complex__ double __y)\n  { return __builtin_cpow(__x, __y); }\n\n  inline __complex__ long double\n  __complex_pow(const __complex__ long double& __x,\n\t\tconst __complex__ long double& __y)\n  { return __builtin_cpowl(__x, __y); }\n\n  template<typename _Tp>\n    inline complex<_Tp>\n    pow(const complex<_Tp>& __x, const complex<_Tp>& __y)\n    { return __complex_pow(__x.__rep(), __y.__rep()); }\n#else\n  template<typename _Tp>\n    inline complex<_Tp>\n    pow(const complex<_Tp>& __x, const complex<_Tp>& __y)\n    { return __complex_pow(__x, __y); }\n#endif\n\n  template<typename _Tp>\n    inline complex<_Tp>\n    pow(const _Tp& __x, const complex<_Tp>& __y)\n    {\n      return __x > _Tp() ? std::polar(pow(__x, __y.real()),\n\t\t\t\t      __y.imag() * log(__x))\n\t                 : std::pow(complex<_Tp>(__x, _Tp()), __y);\n    }\n\n  // 26.2.3  complex specializations\n  // complex<float> specialization\n  template<>\n    struct complex<float>\n    {\n      typedef float value_type;\n      typedef __complex__ float _ComplexT;\n\n      complex(_ComplexT __z) : _M_value(__z) { }\n\n      complex(float = 0.0f, float = 0.0f);\n\n      explicit complex(const complex<double>&);\n      explicit complex(const complex<long double>&);\n\n      float& real();\n      const float& real() const;\n      float& imag();\n      const float& imag() const;\n\n      complex<float>& operator=(float);\n      complex<float>& operator+=(float);\n      complex<float>& operator-=(float);\n      complex<float>& operator*=(float);\n      complex<float>& operator/=(float);\n\n      // Let's the compiler synthetize the copy and assignment\n      // operator.  It always does a pretty good job.\n      // complex& operator= (const complex&);\n      template<typename _Tp>\n        complex<float>&operator=(const complex<_Tp>&);\n      template<typename _Tp>\n        complex<float>& operator+=(const complex<_Tp>&);\n      template<class _Tp>\n        complex<float>& operator-=(const complex<_Tp>&);\n      template<class _Tp>\n        complex<float>& operator*=(const complex<_Tp>&);\n      template<class _Tp>\n        complex<float>&operator/=(const complex<_Tp>&);\n\n      const _ComplexT& __rep() const { return _M_value; }\n\n    private:\n      _ComplexT _M_value;\n    };\n\n  inline float&\n  complex<float>::real()\n  { return __real__ _M_value; }\n\n  inline const float&\n  complex<float>::real() const\n  { return __real__ _M_value; }\n\n  inline float&\n  complex<float>::imag()\n  { return __imag__ _M_value; }\n\n  inline const float&\n  complex<float>::imag() const\n  { return __imag__ _M_value; }\n\n  inline\n  complex<float>::complex(float r, float i)\n  {\n    __real__ _M_value = r;\n    __imag__ _M_value = i;\n  }\n\n  inline complex<float>&\n  complex<float>::operator=(float __f)\n  {\n    __real__ _M_value = __f;\n    __imag__ _M_value = 0.0f;\n    return *this;\n  }\n\n  inline complex<float>&\n  complex<float>::operator+=(float __f)\n  {\n    __real__ _M_value += __f;\n    return *this;\n  }\n\n  inline complex<float>&\n  complex<float>::operator-=(float __f)\n  {\n    __real__ _M_value -= __f;\n    return *this;\n  }\n\n  inline complex<float>&\n  complex<float>::operator*=(float __f)\n  {\n    _M_value *= __f;\n    return *this;\n  }\n\n  inline complex<float>&\n  complex<float>::operator/=(float __f)\n  {\n    _M_value /= __f;\n    return *this;\n  }\n\n  template<typename _Tp>\n  inline complex<float>&\n  complex<float>::operator=(const complex<_Tp>& __z)\n  {\n    __real__ _M_value = __z.real();\n    __imag__ _M_value = __z.imag();\n    return *this;\n  }\n\n  template<typename _Tp>\n  inline complex<float>&\n  complex<float>::operator+=(const complex<_Tp>& __z)\n  {\n    __real__ _M_value += __z.real();\n    __imag__ _M_value += __z.imag();\n    return *this;\n  }\n    \n  template<typename _Tp>\n    inline complex<float>&\n    complex<float>::operator-=(const complex<_Tp>& __z)\n    {\n     __real__ _M_value -= __z.real();\n     __imag__ _M_value -= __z.imag();\n     return *this;\n    } \n\n  template<typename _Tp>\n    inline complex<float>&\n    complex<float>::operator*=(const complex<_Tp>& __z)\n    {\n      _ComplexT __t;\n      __real__ __t = __z.real();\n      __imag__ __t = __z.imag();\n      _M_value *= __t;\n      return *this;\n    }\n\n  template<typename _Tp>\n    inline complex<float>&\n    complex<float>::operator/=(const complex<_Tp>& __z)\n    {\n      _ComplexT __t;\n      __real__ __t = __z.real();\n      __imag__ __t = __z.imag();\n      _M_value /= __t;\n      return *this;\n    }\n\n  // 26.2.3  complex specializations\n  // complex<double> specialization\n  template<>\n    struct complex<double>\n    {\n      typedef double value_type;\n      typedef __complex__ double _ComplexT;\n\n      complex(_ComplexT __z) : _M_value(__z) { }\n\n      complex(double = 0.0, double = 0.0);\n\n      complex(const complex<float>&);\n      explicit complex(const complex<long double>&);\n\n      double& real();\n      const double& real() const;\n      double& imag();\n      const double& imag() const;\n\n      complex<double>& operator=(double);\n      complex<double>& operator+=(double);\n      complex<double>& operator-=(double);\n      complex<double>& operator*=(double);\n      complex<double>& operator/=(double);\n\n      // The compiler will synthetize this, efficiently.\n      // complex& operator= (const complex&);\n      template<typename _Tp>\n        complex<double>& operator=(const complex<_Tp>&);\n      template<typename _Tp>\n        complex<double>& operator+=(const complex<_Tp>&);\n      template<typename _Tp>\n        complex<double>& operator-=(const complex<_Tp>&);\n      template<typename _Tp>\n        complex<double>& operator*=(const complex<_Tp>&);\n      template<typename _Tp>\n        complex<double>& operator/=(const complex<_Tp>&);\n\n      const _ComplexT& __rep() const { return _M_value; }\n\n    private:\n      _ComplexT _M_value;\n    };\n\n  inline double&\n  complex<double>::real()\n  { return __real__ _M_value; }\n\n  inline const double&\n  complex<double>::real() const\n  { return __real__ _M_value; }\n\n  inline double&\n  complex<double>::imag()\n  { return __imag__ _M_value; }\n\n  inline const double&\n  complex<double>::imag() const\n  { return __imag__ _M_value; }\n\n  inline\n  complex<double>::complex(double __r, double __i)\n  {\n    __real__ _M_value = __r;\n    __imag__ _M_value = __i;\n  }\n\n  inline complex<double>&\n  complex<double>::operator=(double __d)\n  {\n    __real__ _M_value = __d;\n    __imag__ _M_value = 0.0;\n    return *this;\n  }\n\n  inline complex<double>&\n  complex<double>::operator+=(double __d)\n  {\n    __real__ _M_value += __d;\n    return *this;\n  }\n\n  inline complex<double>&\n  complex<double>::operator-=(double __d)\n  {\n    __real__ _M_value -= __d;\n    return *this;\n  }\n\n  inline complex<double>&\n  complex<double>::operator*=(double __d)\n  {\n    _M_value *= __d;\n    return *this;\n  }\n\n  inline complex<double>&\n  complex<double>::operator/=(double __d)\n  {\n    _M_value /= __d;\n    return *this;\n  }\n\n  template<typename _Tp>\n    inline complex<double>&\n    complex<double>::operator=(const complex<_Tp>& __z)\n    {\n      __real__ _M_value = __z.real();\n      __imag__ _M_value = __z.imag();\n      return *this;\n    }\n    \n  template<typename _Tp>\n    inline complex<double>&\n    complex<double>::operator+=(const complex<_Tp>& __z)\n    {\n      __real__ _M_value += __z.real();\n      __imag__ _M_value += __z.imag();\n      return *this;\n    }\n\n  template<typename _Tp>\n    inline complex<double>&\n    complex<double>::operator-=(const complex<_Tp>& __z)\n    {\n      __real__ _M_value -= __z.real();\n      __imag__ _M_value -= __z.imag();\n      return *this;\n    }\n\n  template<typename _Tp>\n    inline complex<double>&\n    complex<double>::operator*=(const complex<_Tp>& __z)\n    {\n      _ComplexT __t;\n      __real__ __t = __z.real();\n      __imag__ __t = __z.imag();\n      _M_value *= __t;\n      return *this;\n    }\n\n  template<typename _Tp>\n    inline complex<double>&\n    complex<double>::operator/=(const complex<_Tp>& __z)\n    {\n      _ComplexT __t;\n      __real__ __t = __z.real();\n      __imag__ __t = __z.imag();\n      _M_value /= __t;\n      return *this;\n    }\n\n  // 26.2.3  complex specializations\n  // complex<long double> specialization\n  template<>\n    struct complex<long double>\n    {\n      typedef long double value_type;\n      typedef __complex__ long double _ComplexT;\n\n      complex(_ComplexT __z) : _M_value(__z) { }\n\n      complex(long double = 0.0L, long double = 0.0L);\n\n      complex(const complex<float>&);\n      complex(const complex<double>&);\n\n      long double& real();\n      const long double& real() const;\n      long double& imag();\n      const long double& imag() const;\n\n      complex<long double>& operator= (long double);\n      complex<long double>& operator+= (long double);\n      complex<long double>& operator-= (long double);\n      complex<long double>& operator*= (long double);\n      complex<long double>& operator/= (long double);\n\n      // The compiler knows how to do this efficiently\n      // complex& operator= (const complex&);\n      template<typename _Tp>\n        complex<long double>& operator=(const complex<_Tp>&);\n      template<typename _Tp>\n        complex<long double>& operator+=(const complex<_Tp>&);\n      template<typename _Tp>\n        complex<long double>& operator-=(const complex<_Tp>&);\n      template<typename _Tp>\n        complex<long double>& operator*=(const complex<_Tp>&);\n      template<typename _Tp>\n        complex<long double>& operator/=(const complex<_Tp>&);\n\n      const _ComplexT& __rep() const { return _M_value; }\n\n    private:\n      _ComplexT _M_value;\n    };\n\n  inline\n  complex<long double>::complex(long double __r, long double __i)\n  {\n    __real__ _M_value = __r;\n    __imag__ _M_value = __i;\n  }\n\n  inline long double&\n  complex<long double>::real()\n  { return __real__ _M_value; }\n\n  inline const long double&\n  complex<long double>::real() const\n  { return __real__ _M_value; }\n\n  inline long double&\n  complex<long double>::imag()\n  { return __imag__ _M_value; }\n\n  inline const long double&\n  complex<long double>::imag() const\n  { return __imag__ _M_value; }\n\n  inline complex<long double>&   \n  complex<long double>::operator=(long double __r)\n  {\n    __real__ _M_value = __r;\n    __imag__ _M_value = 0.0L;\n    return *this;\n  }\n\n  inline complex<long double>&\n  complex<long double>::operator+=(long double __r)\n  {\n    __real__ _M_value += __r;\n    return *this;\n  }\n\n  inline complex<long double>&\n  complex<long double>::operator-=(long double __r)\n  {\n    __real__ _M_value -= __r;\n    return *this;\n  }\n\n  inline complex<long double>&\n  complex<long double>::operator*=(long double __r)\n  {\n    _M_value *= __r;\n    return *this;\n  }\n\n  inline complex<long double>&\n  complex<long double>::operator/=(long double __r)\n  {\n    _M_value /= __r;\n    return *this;\n  }\n\n  template<typename _Tp>\n    inline complex<long double>&\n    complex<long double>::operator=(const complex<_Tp>& __z)\n    {\n      __real__ _M_value = __z.real();\n      __imag__ _M_value = __z.imag();\n      return *this;\n    }\n\n  template<typename _Tp>\n    inline complex<long double>&\n    complex<long double>::operator+=(const complex<_Tp>& __z)\n    {\n      __real__ _M_value += __z.real();\n      __imag__ _M_value += __z.imag();\n      return *this;\n    }\n\n  template<typename _Tp>\n    inline complex<long double>&\n    complex<long double>::operator-=(const complex<_Tp>& __z)\n    {\n      __real__ _M_value -= __z.real();\n      __imag__ _M_value -= __z.imag();\n      return *this;\n    }\n    \n  template<typename _Tp>\n    inline complex<long double>&\n    complex<long double>::operator*=(const complex<_Tp>& __z)\n    {\n      _ComplexT __t;\n      __real__ __t = __z.real();\n      __imag__ __t = __z.imag();\n      _M_value *= __t;\n      return *this;\n    }\n\n  template<typename _Tp>\n    inline complex<long double>&\n    complex<long double>::operator/=(const complex<_Tp>& __z)\n    {\n      _ComplexT __t;\n      __real__ __t = __z.real();\n      __imag__ __t = __z.imag();\n      _M_value /= __t;\n      return *this;\n    }\n\n  // These bits have to be at the end of this file, so that the\n  // specializations have all been defined.\n  // ??? No, they have to be there because of compiler limitation at\n  // inlining.  It suffices that class specializations be defined.\n  inline\n  complex<float>::complex(const complex<double>& __z)\n  : _M_value(__z.__rep()) { }\n\n  inline\n  complex<float>::complex(const complex<long double>& __z)\n  : _M_value(__z.__rep()) { }\n\n  inline\n  complex<double>::complex(const complex<float>& __z) \n  : _M_value(__z.__rep()) { }\n\n  inline\n  complex<double>::complex(const complex<long double>& __z)\n    : _M_value(__z.__rep()) { }\n\n  inline\n  complex<long double>::complex(const complex<float>& __z)\n  : _M_value(__z.__rep()) { }\n\n  inline\n  complex<long double>::complex(const complex<double>& __z)\n  : _M_value(__z.__rep()) { }\n\n_GLIBCXX_END_NAMESPACE\n\n#endif\t/* _GLIBCXX_COMPLEX */\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/csetjmp",
    "content": "// -*- C++ -*- forwarding header.\n\n// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005\n// Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n/** @file csetjmp\n *  This is a Standard C++ Library file.  You should @c #include this file\n *  in your programs, rather than any of the \"*.h\" implementation files.\n *\n *  This is the C++ version of the Standard C Library header @c setjmp.h,\n *  and its contents are (mostly) the same as that header, but are all\n *  contained in the namespace @c std (except for names which are defined\n *  as macros in C).\n */\n\n//\n// ISO C++ 14882: 20.4.6  C library\n//\n\n#ifndef _GLIBCXX_CSETJMP\n#define _GLIBCXX_CSETJMP 1\n\n#pragma GCC system_header\n\n#include <bits/c++config.h>\n#include <setjmp.h>\n\n// Get rid of those macros defined in <setjmp.h> in lieu of real functions.\n#undef longjmp\n\n// Adhere to section 17.4.1.2 clause 5 of ISO 14882:1998\n#ifndef setjmp\n#define setjmp(env) setjmp (env)\n#endif\n\n_GLIBCXX_BEGIN_NAMESPACE(std)\n\n  using ::jmp_buf;\n  using ::longjmp;\n\n_GLIBCXX_END_NAMESPACE\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/csignal",
    "content": "// -*- C++ -*- forwarding header.\n\n// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005\n// Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n/** @file csignal\n *  This is a Standard C++ Library file.  You should @c #include this file\n *  in your programs, rather than any of the \"*.h\" implementation files.\n *\n *  This is the C++ version of the Standard C Library header @c signal.h,\n *  and its contents are (mostly) the same as that header, but are all\n *  contained in the namespace @c std (except for names which are defined\n *  as macros in C).\n */\n\n//\n// ISO C++ 14882: 20.4.6  C library\n//\n\n#ifndef _GLIBCXX_CSIGNAL\n#define _GLIBCXX_CSIGNAL 1\n\n#pragma GCC system_header\n\n#include <bits/c++config.h>\n#include <signal.h>\n\n// Get rid of those macros defined in <signal.h> in lieu of real functions.\n#undef raise\n\n_GLIBCXX_BEGIN_NAMESPACE(std)\n\n  using ::sig_atomic_t;\n  using ::signal;\n  using ::raise;\n\n_GLIBCXX_END_NAMESPACE\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/cstdarg",
    "content": "// -*- C++ -*- forwarding header.\n\n// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005\n// Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n/** @file include/cstdarg\n *  This is a Standard C++ Library file.  You should @c #include this file\n *  in your programs, rather than any of the \"*.h\" implementation files.\n *\n *  This is the C++ version of the Standard C Library header @c stdarg.h,\n *  and its contents are (mostly) the same as that header, but are all\n *  contained in the namespace @c std (except for names which are defined\n *  as macros in C).\n */\n\n//\n// ISO C++ 14882: 20.4.6  C library\n//\n\n#ifndef _GLIBCXX_CSTDARG\n#define _GLIBCXX_CSTDARG 1\n\n#pragma GCC system_header\n\n#include <bits/c++config.h>\n#include <stdarg.h>\n\n// Adhere to section 17.4.1.2 clause 5 of ISO 14882:1998\n#ifndef va_end\n#define va_end(ap) va_end (ap)\n#endif\n\n_GLIBCXX_BEGIN_NAMESPACE(std)\n\n  using ::va_list;\n\n_GLIBCXX_END_NAMESPACE\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/cstddef",
    "content": "// -*- C++ -*- forwarding header.\n\n// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005\n// Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n/** @file cstddef\n *  This is a Standard C++ Library file.  You should @c #include this file\n *  in your programs, rather than any of the \"*.h\" implementation files.\n *\n *  This is the C++ version of the Standard C Library header @c stddef.h,\n *  and its contents are (mostly) the same as that header, but are all\n *  contained in the namespace @c std (except for names which are defined\n *  as macros in C).\n */\n\n//\n// ISO C++ 14882: 18.1  Types\n//\n\n#ifndef _GLIBCXX_CSTDDEF\n#define _GLIBCXX_CSTDDEF 1\n\n#pragma GCC system_header\n\n#include <bits/c++config.h>\n#include <stddef.h>\n\n_GLIBCXX_BEGIN_NAMESPACE(std)\n\n  using ::ptrdiff_t;\n  using ::size_t;\n\n_GLIBCXX_END_NAMESPACE\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/cstdio",
    "content": "// -*- C++ -*- forwarding header.\n\n// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005\n// Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n/** @file include/cstdio\n *  This is a Standard C++ Library file.  You should @c #include this file\n *  in your programs, rather than any of the \"*.h\" implementation files.\n *\n *  This is the C++ version of the Standard C Library header @c stdio.h,\n *  and its contents are (mostly) the same as that header, but are all\n *  contained in the namespace @c std (except for names which are defined\n *  as macros in C).\n */\n\n//\n// ISO C++ 14882: 27.8.2  C Library files\n//\n\n#ifndef _GLIBCXX_CSTDIO\n#define _GLIBCXX_CSTDIO 1\n\n#pragma GCC system_header\n\n#include <bits/c++config.h>\n#include <cstddef>\n\n#include <stdio.h>\n\n// Get rid of those macros defined in <stdio.h> in lieu of real functions.\n#undef clearerr\n#undef fclose\n#undef feof\n#undef ferror\n#undef fflush\n#undef fgetc\n#undef fgetpos\n#undef fgets\n#undef fopen\n#undef fprintf\n#undef fputc\n#undef fputs\n#undef fread\n#undef freopen\n#undef fscanf\n#undef fseek\n#undef fsetpos\n#undef ftell\n#undef fwrite\n#undef getc\n#undef getchar\n#undef gets\n#undef perror\n#undef printf\n#undef putc\n#undef putchar\n#undef puts\n#undef remove\n#undef rename\n#undef rewind\n#undef scanf\n#undef setbuf\n#undef setvbuf\n#undef sprintf\n#undef sscanf\n#undef tmpfile\n#undef tmpnam\n#undef ungetc\n#undef vfprintf\n#undef vprintf\n#undef vsprintf\n\n_GLIBCXX_BEGIN_NAMESPACE(std)\n\n  using ::FILE;\n  using ::fpos_t;\n\n  using ::clearerr;\n  using ::fclose;\n  using ::feof;\n  using ::ferror;\n  using ::fflush;\n  using ::fgetc;\n  using ::fgetpos;\n  using ::fgets;\n  using ::fopen;\n  using ::fprintf;\n  using ::fputc;\n  using ::fputs;\n  using ::fread;\n  using ::freopen;\n  using ::fscanf;\n  using ::fseek;\n  using ::fsetpos;\n  using ::ftell;\n  using ::fwrite;\n  using ::getc;\n  using ::getchar;\n  using ::gets;\n  using ::perror;\n  using ::printf;\n  using ::putc;\n  using ::putchar;\n  using ::puts;\n  using ::remove;\n  using ::rename;\n  using ::rewind;\n  using ::scanf;\n  using ::setbuf;\n  using ::setvbuf;\n  using ::sprintf;\n  using ::sscanf;\n  using ::tmpfile;\n  using ::tmpnam;\n  using ::ungetc;\n  using ::vfprintf;\n  using ::vprintf;\n  using ::vsprintf;\n\n_GLIBCXX_END_NAMESPACE\n\n#if _GLIBCXX_USE_C99\n\n#undef snprintf\n#undef vfscanf\n#undef vscanf\n#undef vsnprintf\n#undef vsscanf\n\n_GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)\n\n#if _GLIBCXX_USE_C99_CHECK || _GLIBCXX_USE_C99_DYNAMIC\n  extern \"C\" int\n  (snprintf)(char * restrict, size_t, const char * restrict, ...);\n  extern \"C\" int\n  (vfscanf)(FILE * restrict, const char * restrict, __gnuc_va_list);\n  extern \"C\" int (vscanf)(const char * restrict, __gnuc_va_list);\n  extern \"C\" int\n  (vsnprintf)(char * restrict, size_t, const char * restrict, __gnuc_va_list);\n  extern \"C\" int\n  (vsscanf)(const char * restrict, const char * restrict, __gnuc_va_list);\n#endif\n\n#if !_GLIBCXX_USE_C99_DYNAMIC\n  using ::snprintf;\n  using ::vfscanf;\n  using ::vscanf;\n  using ::vsnprintf;\n  using ::vsscanf;\n#endif\n\n_GLIBCXX_END_NAMESPACE\n\n_GLIBCXX_BEGIN_NAMESPACE(std)\n\n  using ::__gnu_cxx::snprintf;\n  using ::__gnu_cxx::vfscanf;\n  using ::__gnu_cxx::vscanf;\n  using ::__gnu_cxx::vsnprintf;\n  using ::__gnu_cxx::vsscanf;\n\n_GLIBCXX_END_NAMESPACE\n\n#endif\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/cstdlib",
    "content": "// -*- C++ -*- forwarding header.\n\n// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005\n// Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n/** @file include/cstdlib\n *  This is a Standard C++ Library file.  You should @c #include this file\n *  in your programs, rather than any of the \"*.h\" implementation files.\n *\n *  This is the C++ version of the Standard C Library header @c stdlib.h,\n *  and its contents are (mostly) the same as that header, but are all\n *  contained in the namespace @c std (except for names which are defined\n *  as macros in C).\n */\n\n//\n// ISO C++ 14882: 20.4.6  C library\n//\n\n#ifndef _GLIBCXX_CSTDLIB\n#define _GLIBCXX_CSTDLIB 1\n\n#pragma GCC system_header\n\n#include <bits/c++config.h>\n#include <cstddef>\n\n#if !_GLIBCXX_HOSTED\n// The C standard does not require a freestanding implementation to\n// provide <stdlib.h>.  However, the C++ standard does still require\n// <cstdlib> -- but only the functionality mentioned in\n// [lib.support.start.term].\n\n#define EXIT_SUCCESS 0\n#define EXIT_FAILURE 1\n\n_GLIBCXX_BEGIN_NAMESPACE(std)\n\n  extern \"C\" void abort(void);\n  extern \"C\" int atexit(void (*)());\n  extern \"C\" void exit(int);\n\n_GLIBCXX_END_NAMESPACE\n\n#else\n\n#include <stdlib.h>\n\n// Get rid of those macros defined in <stdlib.h> in lieu of real functions.\n#undef abort\n#undef abs\n#undef atexit\n#undef atof\n#undef atoi\n#undef atol\n#undef bsearch\n#undef calloc\n#undef div\n#undef exit\n#undef free\n#undef getenv\n#undef labs\n#undef ldiv\n#undef malloc\n#undef mblen\n#undef mbstowcs\n#undef mbtowc\n#undef qsort\n#undef rand\n#undef realloc\n#undef srand\n#undef strtod\n#undef strtol\n#undef strtoul\n#undef system\n#undef wcstombs\n#undef wctomb\n\n_GLIBCXX_BEGIN_NAMESPACE(std)\n\n  using ::div_t;\n  using ::ldiv_t;\n\n  using ::abort;\n  using ::abs;\n  using ::atexit;\n  using ::atof;\n  using ::atoi;\n  using ::atol;\n  using ::bsearch;\n  using ::calloc;\n  using ::div;\n  using ::exit;\n  using ::free;\n  using ::getenv;\n  using ::labs;\n  using ::ldiv;\n  using ::malloc;\n#ifdef _GLIBCXX_HAVE_MBSTATE_T\n  using ::mblen;\n  using ::mbstowcs;\n  using ::mbtowc;\n#endif // _GLIBCXX_HAVE_MBSTATE_T\n  using ::qsort;\n  using ::rand;\n  using ::realloc;\n  using ::srand;\n  using ::strtod;\n  using ::strtol;\n  using ::strtoul;\n  using ::system;\n#ifdef _GLIBCXX_USE_WCHAR_T\n  using ::wcstombs;\n  using ::wctomb;\n#endif // _GLIBCXX_USE_WCHAR_T\n\n  inline long\n  abs(long __i) { return labs(__i); }\n\n  inline ldiv_t\n  div(long __i, long __j) { return ldiv(__i, __j); }\n\n_GLIBCXX_END_NAMESPACE\n\n#if _GLIBCXX_USE_C99\n\n#undef _Exit\n#undef llabs\n#undef lldiv\n#undef atoll\n#undef strtoll\n#undef strtoull\n#undef strtof\n#undef strtold\n\n_GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)\n\n#if !_GLIBCXX_USE_C99_LONG_LONG_DYNAMIC\n  using ::lldiv_t;\n#endif\n#if _GLIBCXX_USE_C99_CHECK || _GLIBCXX_USE_C99_DYNAMIC\n  extern \"C\" void (_Exit)(int);\n#endif\n#if !_GLIBCXX_USE_C99_DYNAMIC\n  using ::_Exit;\n#endif\n\n  inline long long\n  abs(long long __x) { return __x >= 0 ? __x : -__x; }\n\n#if !_GLIBCXX_USE_C99_LONG_LONG_DYNAMIC\n  using ::llabs;\n\n  inline lldiv_t\n  div(long long __n, long long __d)\n  { lldiv_t __q; __q.quot = __n / __d; __q.rem = __n % __d; return __q; }\n\n  using ::lldiv;\n#endif\n\n#if _GLIBCXX_USE_C99_LONG_LONG_CHECK || _GLIBCXX_USE_C99_LONG_LONG_DYNAMIC\n  extern \"C\" long long int (atoll)(const char *);\n  extern \"C\" long long int\n    (strtoll)(const char * restrict, char ** restrict, int);\n  extern \"C\" unsigned long long int\n    (strtoull)(const char * restrict, char ** restrict, int);\n#endif\n#if !_GLIBCXX_USE_C99_LONG_LONG_DYNAMIC\n  using ::atoll;\n  using ::strtoll;\n  using ::strtoull;\n#endif\n  using ::strtof;\n  using ::strtold;\n\n_GLIBCXX_END_NAMESPACE\n\n_GLIBCXX_BEGIN_NAMESPACE(std)\n\n#if !_GLIBCXX_USE_C99_LONG_LONG_DYNAMIC\n  using ::__gnu_cxx::lldiv_t;\n#endif\n  using ::__gnu_cxx::_Exit;\n  using ::__gnu_cxx::abs;\n#if !_GLIBCXX_USE_C99_LONG_LONG_DYNAMIC\n  using ::__gnu_cxx::llabs;\n  using ::__gnu_cxx::div;\n  using ::__gnu_cxx::lldiv;\n#endif\n  using ::__gnu_cxx::atoll;\n  using ::__gnu_cxx::strtof;\n  using ::__gnu_cxx::strtoll;\n  using ::__gnu_cxx::strtoull;\n  using ::__gnu_cxx::strtold;\n\n_GLIBCXX_END_NAMESPACE\n\n#endif // _GLIBCXX_USE_C99\n\n#endif // !_GLIBCXX_HOSTED\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/cstring",
    "content": "// -*- C++ -*- forwarding header.\n\n// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005\n// Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n/** @file cstring\n *  This is a Standard C++ Library file.  You should @c #include this file\n *  in your programs, rather than any of the \"*.h\" implementation files.\n *\n *  This is the C++ version of the Standard C Library header @c string.h,\n *  and its contents are (mostly) the same as that header, but are all\n *  contained in the namespace @c std (except for names which are defined\n *  as macros in C).\n */\n\n//\n// ISO C++ 14882: 20.4.6  C library\n//\n\n#ifndef _GLIBCXX_CSTRING\n#define _GLIBCXX_CSTRING 1\n\n#pragma GCC system_header\n\n#include <bits/c++config.h>\n#include <cstddef>\n#include <string.h>\n\n// Get rid of those macros defined in <string.h> in lieu of real functions.\n#undef memcpy\n#undef memmove\n#undef strcpy\n#undef strncpy\n#undef strcat\n#undef strncat\n#undef memcmp\n#undef strcmp\n#undef strcoll\n#undef strncmp\n#undef strxfrm\n#undef memchr\n#undef strchr\n#undef strcspn\n#undef strpbrk\n#undef strrchr\n#undef strspn\n#undef strstr\n#undef strtok\n#undef memset\n#undef strerror\n#undef strlen\n\n_GLIBCXX_BEGIN_NAMESPACE(std)\n\n  using ::memcpy;\n  using ::memmove;\n  using ::strcpy;\n  using ::strncpy;\n  using ::strcat;\n  using ::strncat;\n  using ::memcmp;\n  using ::strcmp;\n  using ::strcoll;\n  using ::strncmp;\n  using ::strxfrm;\n  using ::strcspn;\n  using ::strspn;\n  using ::strtok;\n  using ::memset;\n  using ::strerror;\n  using ::strlen;\n\n  using ::memchr;\n\n  inline void*\n  memchr(void* __p, int __c, size_t __n)\n  { return memchr(const_cast<const void*>(__p), __c, __n); }\n\n  using ::strchr;\n\n  inline char*\n  strchr(char* __s1, int __n)\n  { return __builtin_strchr(const_cast<const char*>(__s1), __n); }\n\n  using ::strpbrk;\n\n  inline char*\n  strpbrk(char* __s1, const char* __s2)\n  { return __builtin_strpbrk(const_cast<const char*>(__s1), __s2); }\n\n  using ::strrchr;\n\n  inline char*\n  strrchr(char* __s1, int __n)\n  { return __builtin_strrchr(const_cast<const char*>(__s1), __n); }\n\n  using ::strstr;\n\n  inline char*\n  strstr(char* __s1, const char* __s2)\n  { return __builtin_strstr(const_cast<const char*>(__s1), __s2); }\n\n_GLIBCXX_END_NAMESPACE\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ctime",
    "content": "// -*- C++ -*- forwarding header.\n\n// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005\n// Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n/** @file include/ctime\n *  This is a Standard C++ Library file.  You should @c #include this file\n *  in your programs, rather than any of the \"*.h\" implementation files.\n *\n *  This is the C++ version of the Standard C Library header @c time.h,\n *  and its contents are (mostly) the same as that header, but are all\n *  contained in the namespace @c std (except for names which are defined\n *  as macros in C).\n */\n\n//\n// ISO C++ 14882: 20.5  Date and time\n//\n\n#ifndef _GLIBCXX_CTIME\n#define _GLIBCXX_CTIME 1\n\n#pragma GCC system_header\n\n#include <cstddef>\n#include <time.h>\n\n// Get rid of those macros defined in <time.h> in lieu of real functions.\n#undef clock\n#undef difftime\n#undef mktime\n#undef time\n#undef asctime\n#undef ctime\n#undef gmtime\n#undef localtime\n#undef strftime\n\n_GLIBCXX_BEGIN_NAMESPACE(std)\n\n  using ::clock_t;\n  using ::time_t;\n  using ::tm;\n\n  using ::clock;\n  using ::difftime;\n  using ::mktime;\n  using ::time;\n  using ::asctime;\n  using ::ctime;\n  using ::gmtime;\n  using ::localtime;\n  using ::strftime;\n\n_GLIBCXX_END_NAMESPACE\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/cwchar",
    "content": "// -*- C++ -*- forwarding header.\n\n// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005\n// Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n/** @file include/cwchar\n *  This is a Standard C++ Library file.  You should @c #include this file\n *  in your programs, rather than any of the \"*.h\" implementation files.\n *\n *  This is the C++ version of the Standard C Library header @c wchar.h,\n *  and its contents are (mostly) the same as that header, but are all\n *  contained in the namespace @c std (except for names which are defined\n *  as macros in C).\n */\n\n//\n// ISO C++ 14882: 21.4\n//\n\n#ifndef _GLIBCXX_CWCHAR\n#define _GLIBCXX_CWCHAR 1\n\n#pragma GCC system_header\n\n#include <bits/c++config.h>\n#include <cstddef>\n#include <ctime>\n\n#if _GLIBCXX_HAVE_WCHAR_H\n#include <wchar.h>\n#endif\n\n// Need to do a bit of trickery here with mbstate_t as char_traits\n// assumes it is in wchar.h, regardless of wchar_t specializations.\n#ifndef _GLIBCXX_HAVE_MBSTATE_T\nextern \"C\"\n{\n  typedef struct\n  {\n    int __fill[6];\n  } mbstate_t;\n}\n#endif\n\n_GLIBCXX_BEGIN_NAMESPACE(std)\n\n  using ::mbstate_t;\n\n_GLIBCXX_END_NAMESPACE\n\n// Get rid of those macros defined in <wchar.h> in lieu of real functions.\n#undef btowc\n#undef fgetwc\n#undef fgetws\n#undef fputwc\n#undef fputws\n#undef fwide\n#undef fwprintf\n#undef fwscanf\n#undef getwc\n#undef getwchar\n#undef mbrlen\n#undef mbrtowc\n#undef mbsinit\n#undef mbsrtowcs\n#undef putwc\n#undef putwchar\n#undef swprintf\n#undef swscanf\n#undef ungetwc\n#undef vfwprintf\n#if _GLIBCXX_HAVE_VFWSCANF\n# undef vfwscanf\n#endif\n#undef vswprintf\n#if _GLIBCXX_HAVE_VSWSCANF\n# undef vswscanf\n#endif\n#undef vwprintf\n#if _GLIBCXX_HAVE_VWSCANF\n# undef vwscanf\n#endif\n#undef wcrtomb\n#undef wcscat\n#undef wcschr\n#undef wcscmp\n#undef wcscoll\n#undef wcscpy\n#undef wcscspn\n#undef wcsftime\n#undef wcslen\n#undef wcsncat\n#undef wcsncmp\n#undef wcsncpy\n#undef wcspbrk\n#undef wcsrchr\n#undef wcsrtombs\n#undef wcsspn\n#undef wcsstr\n#undef wcstod\n#if _GLIBCXX_HAVE_WCSTOF\n# undef wcstof\n#endif\n#undef wcstok\n#undef wcstol\n#undef wcstoul\n#undef wcsxfrm\n#undef wctob\n#undef wmemchr\n#undef wmemcmp\n#undef wmemcpy\n#undef wmemmove\n#undef wmemset\n#undef wprintf\n#undef wscanf\n\n#if _GLIBCXX_USE_WCHAR_T\n\n_GLIBCXX_BEGIN_NAMESPACE(std)\n\n  using ::wint_t;\n\n  using ::btowc;\n  using ::fgetwc;\n  using ::fgetws;\n  using ::fputwc;\n  using ::fputws;\n  using ::fwide;\n  using ::fwprintf;\n  using ::fwscanf;\n  using ::getwc;\n  using ::getwchar;\n  using ::mbrlen;\n  using ::mbrtowc;\n  using ::mbsinit;\n  using ::mbsrtowcs;\n  using ::putwc;\n  using ::putwchar;\n  using ::swprintf;\n  using ::swscanf;\n  using ::ungetwc;\n  using ::vfwprintf;\n#if _GLIBCXX_HAVE_VFWSCANF\n  using ::vfwscanf;\n#endif\n  using ::vswprintf;\n#if _GLIBCXX_HAVE_VSWSCANF\n  using ::vswscanf;\n#endif\n  using ::vwprintf;\n#if _GLIBCXX_HAVE_VWSCANF\n  using ::vwscanf;\n#endif\n  using ::wcrtomb;\n  using ::wcscat;\n  using ::wcscmp;\n  using ::wcscoll;\n  using ::wcscpy;\n  using ::wcscspn;\n  using ::wcsftime;\n  using ::wcslen;\n  using ::wcsncat;\n  using ::wcsncmp;\n  using ::wcsncpy;\n  using ::wcsrtombs;\n  using ::wcsspn;\n  using ::wcstod;\n#if _GLIBCXX_HAVE_WCSTOF\n  using ::wcstof;\n#endif\n  using ::wcstok;\n  using ::wcstol;\n  using ::wcstoul;\n  using ::wcsxfrm;\n  using ::wctob;\n  using ::wmemcmp;\n  using ::wmemcpy;\n  using ::wmemmove;\n  using ::wmemset;\n  using ::wprintf;\n  using ::wscanf;\n\n  using ::wcschr;\n\n  inline wchar_t*\n  wcschr(wchar_t* __p, wchar_t __c)\n  { return wcschr(const_cast<const wchar_t*>(__p), __c); }\n\n  using ::wcspbrk;\n\n  inline wchar_t*\n  wcspbrk(wchar_t* __s1, const wchar_t* __s2)\n  { return wcspbrk(const_cast<const wchar_t*>(__s1), __s2); }\n\n  using ::wcsrchr;\n\n  inline wchar_t*\n  wcsrchr(wchar_t* __p, wchar_t __c)\n  { return wcsrchr(const_cast<const wchar_t*>(__p), __c); }\n\n  using ::wcsstr;\n\n  inline wchar_t*\n  wcsstr(wchar_t* __s1, const wchar_t* __s2)\n  { return wcsstr(const_cast<const wchar_t*>(__s1), __s2); }\n\n  using ::wmemchr;\n\n  inline wchar_t*\n  wmemchr(wchar_t* __p, wchar_t __c, size_t __n)\n  { return wmemchr(const_cast<const wchar_t*>(__p), __c, __n); }\n\n_GLIBCXX_END_NAMESPACE\n\n#if _GLIBCXX_USE_C99\n\n#undef wcstold\n#undef wcstoll\n#undef wcstoull\n\n_GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)\n\n#if _GLIBCXX_USE_C99_CHECK || _GLIBCXX_USE_C99_DYNAMIC\n  extern \"C\" long double\n    (wcstold)(const wchar_t * restrict, wchar_t ** restrict);\n#endif\n#if !_GLIBCXX_USE_C99_DYNAMIC\n  using ::wcstold;\n#endif\n#if _GLIBCXX_USE_C99_LONG_LONG_CHECK || _GLIBCXX_USE_C99_LONG_LONG_DYNAMIC\n  extern \"C\" long long int\n    (wcstoll)(const wchar_t * restrict, wchar_t ** restrict, int);\n  extern \"C\" unsigned long long int\n    (wcstoull)(const wchar_t * restrict, wchar_t ** restrict, int);\n#endif\n#if !_GLIBCXX_USE_C99_LONG_LONG_DYNAMIC\n  using ::wcstoll;\n  using ::wcstoull;\n#endif\n\n_GLIBCXX_END_NAMESPACE\n\n_GLIBCXX_BEGIN_NAMESPACE(std)\n\n  using ::__gnu_cxx::wcstold;\n  using ::__gnu_cxx::wcstoll;\n  using ::__gnu_cxx::wcstoull;\n\n_GLIBCXX_END_NAMESPACE\n\n#endif\n\n#endif //_GLIBCXX_USE_WCHAR_T\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/cwctype",
    "content": "// -*- C++ -*- forwarding header.\n\n// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005\n// Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n/** @file include/cwctype\n *  This is a Standard C++ Library file.  You should @c #include this file\n *  in your programs, rather than any of the \"*.h\" implementation files.\n *\n *  This is the C++ version of the Standard C Library header @c wctype.h,\n *  and its contents are (mostly) the same as that header, but are all\n *  contained in the namespace @c std (except for names which are defined\n *  as macros in C).\n */\n\n//\n// ISO C++ 14882: <cwctype>\n//\n\n#ifndef _GLIBCXX_CWCTYPE\n#define _GLIBCXX_CWCTYPE 1\n\n#pragma GCC system_header\n\n#include <bits/c++config.h>\n\n#if _GLIBCXX_HAVE_WCTYPE_H\n#include <wctype.h>\n#endif\n\n// Get rid of those macros defined in <wctype.h> in lieu of real functions.\n#undef iswalnum\n#undef iswalpha\n#if _GLIBCXX_HAVE_ISWBLANK\n# undef iswblank\n#endif\n#undef iswcntrl\n#undef iswctype\n#undef iswdigit\n#undef iswgraph\n#undef iswlower\n#undef iswprint\n#undef iswpunct\n#undef iswspace\n#undef iswupper\n#undef iswxdigit\n#undef towctrans\n#undef towlower\n#undef towupper\n#undef wctrans\n#undef wctype\n\n#if _GLIBCXX_USE_WCHAR_T\n\n_GLIBCXX_BEGIN_NAMESPACE(std)\n\n  using ::wint_t;\t  // cwchar\n\n  using ::wctype_t;\n  using ::wctrans_t;\n\n  using ::iswalnum;\n  using ::iswalpha;\n#if _GLIBCXX_HAVE_ISWBLANK\n  using ::iswblank;\n#endif\n  using ::iswcntrl;\n  using ::iswctype;\n  using ::iswdigit;\n  using ::iswgraph;\n  using ::iswlower;\n  using ::iswprint;\n  using ::iswpunct;\n  using ::iswspace;\n  using ::iswupper;\n  using ::iswxdigit;\n  using ::towctrans;\n  using ::towlower;\n  using ::towupper;\n  using ::wctrans;\n  using ::wctype;\n\n_GLIBCXX_END_NAMESPACE\n\n#endif //_GLIBCXX_USE_WCHAR_T\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/cxxabi.h",
    "content": "// new abi support -*- C++ -*-\n  \n// Copyright (C) 2000, 2002, 2003, 2004, 2006 Free Software Foundation, Inc.\n//\n// This file is part of GCC.\n//\n// GCC is free software; you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation; either version 2, or (at your option)\n// any later version.\n// \n// GCC is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n// \n// You should have received a copy of the GNU General Public License\n// along with GCC; see the file COPYING.  If not, write to\n// the Free Software Foundation, 51 Franklin Street, Fifth Floor,\n// Boston, MA 02110-1301, USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n// Written by Nathan Sidwell, Codesourcery LLC, <nathan@codesourcery.com>\n \n/* This file declares the new abi entry points into the runtime. It is not\n   normally necessary for user programs to include this header, or use the\n   entry points directly. However, this header is available should that be\n   needed.\n   \n   Some of the entry points are intended for both C and C++, thus this header\n   is includable from both C and C++. Though the C++ specific parts are not\n   available in C, naturally enough.  */\n\n/** @file cxxabi.h\n *  The header provides an interface to the C++ ABI.\n */\n\n#ifndef _CXXABI_H\n#define _CXXABI_H 1\n\n#pragma GCC visibility push(default)\n\n#include <stddef.h>\n#include <bits/cxxabi_tweaks.h>\n \n#ifdef __cplusplus\nnamespace __cxxabiv1\n{  \n  extern \"C\" \n  {\n#endif\n\n  typedef __cxa_cdtor_return_type (*__cxa_cdtor_type)(void *);\n\n  // Allocate array.\n  void* \n  __cxa_vec_new(size_t __element_count, size_t __element_size, \n\t\tsize_t __padding_size, __cxa_cdtor_type constructor,\n\t\t__cxa_cdtor_type destructor);\n\n  void*\n  __cxa_vec_new2(size_t __element_count, size_t __element_size,\n\t\t size_t __padding_size, __cxa_cdtor_type constructor,\n\t\t __cxa_cdtor_type destructor, void *(*__alloc) (size_t), \n\t\t void (*__dealloc) (void*));\n\n  void*\n  __cxa_vec_new3(size_t __element_count, size_t __element_size,\n\t\t size_t __padding_size, __cxa_cdtor_type constructor,\n\t\t __cxa_cdtor_type destructor, void *(*__alloc) (size_t), \n\t\t void (*__dealloc) (void*, size_t));\n\n  // Construct array.\n  __cxa_vec_ctor_return_type\n  __cxa_vec_ctor(void* __array_address, size_t __element_count,\n\t\t size_t __element_size, __cxa_cdtor_type constructor,\n\t\t __cxa_cdtor_type destructor);\n\n  __cxa_vec_ctor_return_type\n  __cxa_vec_cctor(void* dest_array, void* src_array, size_t element_count, \n\t\t  size_t element_size, \n\t\t  __cxa_cdtor_return_type (*constructor) (void*, void*), \n\t\t  __cxa_cdtor_type destructor);\n \n  // Destruct array.\n  void \n  __cxa_vec_dtor(void* __array_address, size_t __element_count,\n\t\t size_t __element_size, __cxa_cdtor_type destructor);\n  \n  void \n  __cxa_vec_cleanup(void* __array_address, size_t __element_count,\n\t\t    size_t __element_size, __cxa_cdtor_type destructor);\n  \n  // Destruct and release array.\n  void \n  __cxa_vec_delete(void* __array_address, size_t __element_size,\n\t\t   size_t __padding_size, __cxa_cdtor_type destructor);\n\n  void \n  __cxa_vec_delete2(void* __array_address, size_t __element_size,\n\t\t    size_t __padding_size, __cxa_cdtor_type destructor,\n\t\t    void (*__dealloc) (void*));\n                  \n  void \n  __cxa_vec_delete3(void* __array_address, size_t __element_size,\n\t\t    size_t __padding_size, __cxa_cdtor_type destructor,\n\t\t    void (*__dealloc) (void*, size_t));\n\n  int \n  __cxa_guard_acquire(__guard*);\n\n  void \n  __cxa_guard_release(__guard*);\n\n  void \n  __cxa_guard_abort(__guard*);\n\n  // Pure virtual functions.\n  void\n  __cxa_pure_virtual(void);\n\n  // Exception handling.\n  void\n  __cxa_bad_cast();\n\n  void\n  __cxa_bad_typeid();\n\n  // DSO destruction.\n  int\n  __cxa_atexit(void (*)(void*), void*, void*);\n\n  int\n  __cxa_finalize(void*);\n\n  // Demangling routines. \n  char*\n  __cxa_demangle(const char* __mangled_name, char* __output_buffer,\n\t\t size_t* __length, int* __status);\n#ifdef __cplusplus\n  }\n} // namespace __cxxabiv1\n#endif\n\n#ifdef __cplusplus\n\n#include <typeinfo>\n\nnamespace __cxxabiv1\n{\n  // Type information for int, float etc.\n  class __fundamental_type_info : public std::type_info\n  {\n  public:\n    explicit \n    __fundamental_type_info(const char* __n) : std::type_info(__n) { }\n\n    virtual \n    ~__fundamental_type_info();\n  };\n\n  // Type information for array objects.\n  class __array_type_info : public std::type_info\n  {\n  public:\n    explicit \n    __array_type_info(const char* __n) : std::type_info(__n) { }\n\n    virtual \n    ~__array_type_info();\n  };\n\n  // Type information for functions (both member and non-member).\n  class __function_type_info : public std::type_info\n  {\n  public:\n    explicit \n    __function_type_info(const char* __n) : std::type_info(__n) { }\n\n    virtual \n    ~__function_type_info();\n\n  protected:\n    // Implementation defined member function.\n    virtual bool \n    __is_function_p() const;\n  };\n\n  // Type information for enumerations.\n  class __enum_type_info : public std::type_info\n  {\n  public:\n    explicit \n    __enum_type_info(const char* __n) : std::type_info(__n) { }\n\n    virtual \n    ~__enum_type_info();\n  };\n\n  // Common type information for simple pointers and pointers to member.\n  class __pbase_type_info : public std::type_info\n  {\n  public:\n    unsigned int \t\t__flags; // Qualification of the target object.\n    const std::type_info* \t__pointee; // Type of pointed to object.\n\n    explicit \n    __pbase_type_info(const char* __n, int __quals, \n\t\t      const std::type_info* __type)\n    : std::type_info(__n), __flags(__quals), __pointee(__type)\n    { }\n    \n    virtual \n    ~__pbase_type_info();\n\n    // Implementation defined type.\n    enum __masks \n      {\n\t__const_mask = 0x1,\n\t__volatile_mask = 0x2,\n\t__restrict_mask = 0x4,\n\t__incomplete_mask = 0x8,\n\t__incomplete_class_mask = 0x10\n      };\n\n  protected:\n    __pbase_type_info(const __pbase_type_info&);\n\n    __pbase_type_info&\n    operator=(const __pbase_type_info&);\n\n    // Implementation defined member functions.\n    virtual bool \n    __do_catch(const std::type_info* __thr_type, void** __thr_obj, \n\t       unsigned int __outer) const;\n\n    inline virtual bool \n    __pointer_catch(const __pbase_type_info* __thr_type, void** __thr_obj,\n\t\t    unsigned __outer) const;\n  };\n\n  // Type information for simple pointers.\n  class __pointer_type_info : public __pbase_type_info\n  {\n  public:\n    explicit \n    __pointer_type_info(const char* __n, int __quals, \n\t\t\tconst std::type_info* __type)\n    : __pbase_type_info (__n, __quals, __type) { }\n\n\n    virtual \n    ~__pointer_type_info();\n\n  protected:\n    // Implementation defined member functions.\n    virtual bool \n    __is_pointer_p() const;\n\n    virtual bool \n    __pointer_catch(const __pbase_type_info* __thr_type, void** __thr_obj, \n\t\t    unsigned __outer) const;\n  };\n\n  class __class_type_info;\n\n  // Type information for a pointer to member variable.\n  class __pointer_to_member_type_info : public __pbase_type_info\n  {\n  public:\n    __class_type_info* __context;   // Class of the member.\n\n    explicit \n    __pointer_to_member_type_info(const char* __n, int __quals,\n\t\t\t\t  const std::type_info* __type, \n\t\t\t\t  __class_type_info* __klass)\n    : __pbase_type_info(__n, __quals, __type), __context(__klass) { }\n\n    virtual \n    ~__pointer_to_member_type_info();\n\n  protected:\n    __pointer_to_member_type_info(const __pointer_to_member_type_info&);\n\n    __pointer_to_member_type_info&\n    operator=(const __pointer_to_member_type_info&);\n\n    // Implementation defined member function.\n    virtual bool \n    __pointer_catch(const __pbase_type_info* __thr_type, void** __thr_obj,\n\t\t    unsigned __outer) const;\n  };\n\n  // Helper class for __vmi_class_type.\n  class __base_class_type_info\n  {\n  public:\n    const __class_type_info* \t__base_type;  // Base class type.\n    long \t\t\t__offset_flags;  // Offset and info.\n\n    enum __offset_flags_masks \n      {\n\t__virtual_mask = 0x1,\n\t__public_mask = 0x2,\n\t__hwm_bit = 2,\n\t__offset_shift = 8          // Bits to shift offset.\n      };\n  \n    // Implementation defined member functions.\n    bool \n    __is_virtual_p() const\n    { return __offset_flags & __virtual_mask; }\n\n    bool \n    __is_public_p() const\n    { return __offset_flags & __public_mask; }\n\n    ptrdiff_t \n    __offset() const\n    { \n      // This shift, being of a signed type, is implementation\n      // defined. GCC implements such shifts as arithmetic, which is\n      // what we want.\n      return static_cast<ptrdiff_t>(__offset_flags) >> __offset_shift;\n    }\n  };\n\n  // Type information for a class.\n  class __class_type_info : public std::type_info\n  {\n  public:\n    explicit \n    __class_type_info (const char *__n) : type_info(__n) { }\n\n    virtual \n    ~__class_type_info ();\n\n    // Implementation defined types.\n    // The type sub_kind tells us about how a base object is contained\n    // within a derived object. We often do this lazily, hence the\n    // UNKNOWN value. At other times we may use NOT_CONTAINED to mean\n    // not publicly contained.\n    enum __sub_kind\n      {\n\t// We have no idea.\n\t__unknown = 0, \n\n\t// Not contained within us (in some circumstances this might\n\t// mean not contained publicly)\n\t__not_contained, \n\n\t// Contained ambiguously.\n\t__contained_ambig, \n    \n\t// Via a virtual path.\n\t__contained_virtual_mask = __base_class_type_info::__virtual_mask, \n\n\t// Via a public path.\n\t__contained_public_mask = __base_class_type_info::__public_mask,   \n\n\t// Contained within us.\n\t__contained_mask = 1 << __base_class_type_info::__hwm_bit,\n    \n\t__contained_private = __contained_mask,\n\t__contained_public = __contained_mask | __contained_public_mask\n      };\n\n    struct __upcast_result;\n    struct __dyncast_result;\n\n  protected:\n    // Implementation defined member functions.\n    virtual bool \n    __do_upcast(const __class_type_info* __dst_type, void**__obj_ptr) const;\n\n    virtual bool \n    __do_catch(const type_info* __thr_type, void** __thr_obj, \n\t       unsigned __outer) const;\n\n  public:\n    // Helper for upcast. See if DST is us, or one of our bases. \n    // Return false if not found, true if found. \n    virtual bool \n    __do_upcast(const __class_type_info* __dst, const void* __obj,\n\t\t__upcast_result& __restrict __result) const;\n\n    // Indicate whether SRC_PTR of type SRC_TYPE is contained publicly\n    // within OBJ_PTR. OBJ_PTR points to a base object of our type,\n    // which is the destination type. SRC2DST indicates how SRC\n    // objects might be contained within this type.  If SRC_PTR is one\n    // of our SRC_TYPE bases, indicate the virtuality. Returns\n    // not_contained for non containment or private containment.\n    inline __sub_kind \n    __find_public_src(ptrdiff_t __src2dst, const void* __obj_ptr,\n\t\t      const __class_type_info* __src_type, \n\t\t      const void* __src_ptr) const;\n\n    // Helper for dynamic cast. ACCESS_PATH gives the access from the\n    // most derived object to this base. DST_TYPE indicates the\n    // desired type we want. OBJ_PTR points to a base of our type\n    // within the complete object. SRC_TYPE indicates the static type\n    // started from and SRC_PTR points to that base within the most\n    // derived object. Fill in RESULT with what we find. Return true\n    // if we have located an ambiguous match.\n    virtual bool \n    __do_dyncast(ptrdiff_t __src2dst, __sub_kind __access_path,\n\t\t const __class_type_info* __dst_type, const void* __obj_ptr, \n\t\t const __class_type_info* __src_type, const void* __src_ptr, \n\t\t __dyncast_result& __result) const;\n    \n    // Helper for find_public_subobj. SRC2DST indicates how SRC_TYPE\n    // bases are inherited by the type started from -- which is not\n    // necessarily the current type. The current type will be a base\n    // of the destination type.  OBJ_PTR points to the current base.\n    virtual __sub_kind \n    __do_find_public_src(ptrdiff_t __src2dst, const void* __obj_ptr,\n\t\t\t const __class_type_info* __src_type,\n\t\t\t const void* __src_ptr) const;\n  };\n\n  // Type information for a class with a single non-virtual base.\n  class __si_class_type_info : public __class_type_info\n  {\n  public:\n    const __class_type_info* __base_type;\n\n    explicit \n    __si_class_type_info(const char *__n, const __class_type_info *__base)\n    : __class_type_info(__n), __base_type(__base) { }\n\n    virtual \n    ~__si_class_type_info();\n\n  protected:\n    __si_class_type_info(const __si_class_type_info&);\n\n    __si_class_type_info&\n    operator=(const __si_class_type_info&);\n\n    // Implementation defined member functions.\n    virtual bool \n    __do_dyncast(ptrdiff_t __src2dst, __sub_kind __access_path,\n\t\t const __class_type_info* __dst_type, const void* __obj_ptr,\n\t\t const __class_type_info* __src_type, const void* __src_ptr,\n\t\t __dyncast_result& __result) const;\n\n    virtual __sub_kind \n    __do_find_public_src(ptrdiff_t __src2dst, const void* __obj_ptr,\n\t\t\t const __class_type_info* __src_type,\n\t\t\t const void* __sub_ptr) const;\n\n    virtual bool \n    __do_upcast(const __class_type_info*__dst, const void*__obj,\n\t\t__upcast_result& __restrict __result) const;\n  };\n\n  // Type information for a class with multiple and/or virtual bases.\n  class __vmi_class_type_info : public __class_type_info \n  {\n  public:\n    unsigned int \t\t__flags;  // Details about the class hierarchy.\n    unsigned int \t\t__base_count;  // Number of direct bases.\n\n    // The array of bases uses the trailing array struct hack so this\n    // class is not constructable with a normal constructor. It is\n    // internally generated by the compiler.\n    __base_class_type_info \t__base_info[1];  // Array of bases.\n\n    explicit \n    __vmi_class_type_info(const char* __n, int ___flags)\n    : __class_type_info(__n), __flags(___flags), __base_count(0) { }\n\n    virtual \n    ~__vmi_class_type_info();\n\n    // Implementation defined types.\n    enum __flags_masks \n      {\n\t__non_diamond_repeat_mask = 0x1, // Distinct instance of repeated base.\n\t__diamond_shaped_mask = 0x2, // Diamond shaped multiple inheritance.\n\t__flags_unknown_mask = 0x10\n      };\n\n  protected:\n    // Implementation defined member functions.\n    virtual bool \n    __do_dyncast(ptrdiff_t __src2dst, __sub_kind __access_path,\n\t\t const __class_type_info* __dst_type, const void* __obj_ptr,\n\t\t const __class_type_info* __src_type, const void* __src_ptr,\n\t\t __dyncast_result& __result) const;\n\n    virtual __sub_kind \n    __do_find_public_src(ptrdiff_t __src2dst, const void* __obj_ptr, \n\t\t\t const __class_type_info* __src_type,\n\t\t\t const void* __src_ptr) const;\n    \n    virtual bool \n    __do_upcast(const __class_type_info* __dst, const void* __obj,\n\t\t__upcast_result& __restrict __result) const;\n  };\n\n  // Dynamic cast runtime.\n  // src2dst has the following possible values\n  //  >-1: src_type is a unique public non-virtual base of dst_type\n  //       dst_ptr + src2dst == src_ptr\n  //   -1: unspecified relationship\n  //   -2: src_type is not a public base of dst_type\n  //   -3: src_type is a multiple public non-virtual base of dst_type\n  extern \"C\" void*\n  __dynamic_cast(const void* __src_ptr, // Starting object.\n\t\t const __class_type_info* __src_type, // Static type of object.\n\t\t const __class_type_info* __dst_type, // Desired target type.\n\t\t ptrdiff_t __src2dst); // How src and dst are related.\n\n\n  // Returns the type_info for the currently handled exception [15.3/8], or\n  // null if there is none.\n  extern \"C\" std::type_info*\n  __cxa_current_exception_type();\n} // namespace __cxxabiv1\n\n// User programs should use the alias `abi'. \nnamespace abi = __cxxabiv1;\n\n#endif // __cplusplus\n\n#pragma GCC visibility pop\n\n#endif // __CXXABI_H \n"
  },
  {
    "path": "freebsd-headers/c++/4.2/debug/bitset",
    "content": "// Debugging bitset implementation -*- C++ -*-\n\n// Copyright (C) 2003, 2004, 2005\n// Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n/** @file debug/bitset\n *  This file is a GNU debug extension to the Standard C++ Library.\n */\n\n#ifndef _GLIBCXX_DEBUG_BITSET\n#define _GLIBCXX_DEBUG_BITSET\n\n#include <bitset>\n#include <debug/safe_sequence.h>\n#include <debug/safe_iterator.h>\n\nnamespace std\n{\nnamespace __debug\n{\n  template<size_t _Nb>\n    class bitset\n    : public _GLIBCXX_STD::bitset<_Nb>, \n      public __gnu_debug::_Safe_sequence_base\n    {\n      typedef _GLIBCXX_STD::bitset<_Nb> _Base;\n      typedef __gnu_debug::_Safe_sequence_base  _Safe_base;\n\n    public:\n      // bit reference:\n      class reference\n      : private _Base::reference, public __gnu_debug::_Safe_iterator_base\n      {\n\ttypedef typename _Base::reference _Base_ref;\n\n\tfriend class bitset;\n\treference();\n\n\treference(const _Base_ref& __base, bitset* __seq)\n\t: _Base_ref(__base), _Safe_iterator_base(__seq, false)\n\t{ }\n\n      public:\n\treference(const reference& __x)\n\t: _Base_ref(__x), _Safe_iterator_base(__x, false)\n\t{ }\n\n\treference&\n\toperator=(bool __x)\n\t{\n\t  _GLIBCXX_DEBUG_VERIFY(! this->_M_singular(),\n\t\t\t      _M_message(__gnu_debug::__msg_bad_bitset_write)\n\t\t\t\t._M_iterator(*this));\n\t  *static_cast<_Base_ref*>(this) = __x;\n\t  return *this;\n\t}\n\n\treference&\n\toperator=(const reference& __x)\n\t{\n\t  _GLIBCXX_DEBUG_VERIFY(! __x._M_singular(),\n\t\t\t       _M_message(__gnu_debug::__msg_bad_bitset_read)\n\t\t\t\t._M_iterator(__x));\n\t  _GLIBCXX_DEBUG_VERIFY(! this->_M_singular(),\n\t\t\t      _M_message(__gnu_debug::__msg_bad_bitset_write)\n\t\t\t\t._M_iterator(*this));\n\t  *static_cast<_Base_ref*>(this) = __x;\n\t  return *this;\n\t}\n\n\tbool\n\toperator~() const\n\t{\n\t  _GLIBCXX_DEBUG_VERIFY(! this->_M_singular(),\n\t\t\t       _M_message(__gnu_debug::__msg_bad_bitset_read)\n\t\t\t\t._M_iterator(*this));\n\t  return ~(*static_cast<const _Base_ref*>(this));\n\t}\n\n\toperator bool() const\n\t{\n\t  _GLIBCXX_DEBUG_VERIFY(! this->_M_singular(),\n\t\t\t      _M_message(__gnu_debug::__msg_bad_bitset_read)\n\t\t\t\t._M_iterator(*this));\n\t  return *static_cast<const _Base_ref*>(this);\n\t}\n\n\treference&\n\tflip()\n\t{\n\t  _GLIBCXX_DEBUG_VERIFY(! this->_M_singular(),\n\t\t\t      _M_message(__gnu_debug::__msg_bad_bitset_flip)\n\t\t\t\t._M_iterator(*this));\n\t  _Base_ref::flip();\n\t  return *this;\n\t}\n      };\n\n      // 23.3.5.1 constructors:\n      bitset() : _Base() { }\n\n      bitset(unsigned long __val) : _Base(__val) { }\n\n      template<typename _CharT, typename _Traits, typename _Allocator>\n        explicit\n        bitset(const std::basic_string<_CharT,_Traits,_Allocator>& __str,\n\t       typename std::basic_string<_CharT,_Traits,_Allocator>::size_type\n\t       __pos = 0,\n\t       typename std::basic_string<_CharT,_Traits,_Allocator>::size_type\n\t       __n = (std::basic_string<_CharT,_Traits,_Allocator>::npos))\n\t: _Base(__str, __pos, __n) { }\n\n      bitset(const _Base& __x) : _Base(__x), _Safe_base() { }\n\n      // 23.3.5.2 bitset operations:\n      bitset<_Nb>&\n      operator&=(const bitset<_Nb>& __rhs)\n      {\n\t_M_base() &= __rhs;\n\treturn *this;\n      }\n\n      bitset<_Nb>&\n      operator|=(const bitset<_Nb>& __rhs)\n      {\n\t_M_base() |= __rhs;\n\treturn *this;\n      }\n\n      bitset<_Nb>&\n      operator^=(const bitset<_Nb>& __rhs)\n      {\n\t_M_base() ^= __rhs;\n\treturn *this;\n      }\n\n      bitset<_Nb>&\n      operator<<=(size_t __pos)\n      {\n\t_M_base() <<= __pos;\n\treturn *this;\n      }\n\n      bitset<_Nb>&\n      operator>>=(size_t __pos)\n      {\n\t_M_base() >>= __pos;\n\treturn *this;\n      }\n\n      bitset<_Nb>&\n      set()\n      {\n\t_Base::set();\n\treturn *this;\n      }\n\n      // _GLIBCXX_RESOLVE_LIB_DEFECTS\n      // 186. bitset::set() second parameter should be bool\n      bitset<_Nb>&\n      set(size_t __pos, bool __val = true)\n      {\n\t_Base::set(__pos, __val);\n\treturn *this;\n      }\n\n      bitset<_Nb>&\n      reset()\n      {\n\t_Base::reset();\n\treturn *this;\n      }\n\n      bitset<_Nb>&\n      reset(size_t __pos)\n      {\n\t_Base::reset(__pos);\n\treturn *this;\n      }\n\n      bitset<_Nb> operator~() const { return bitset(~_M_base()); }\n\n      bitset<_Nb>&\n      flip()\n      {\n\t_Base::flip();\n\treturn *this;\n      }\n\n      bitset<_Nb>&\n      flip(size_t __pos)\n      {\n\t_Base::flip(__pos);\n\treturn *this;\n      }\n\n      // element access:\n      // _GLIBCXX_RESOLVE_LIB_DEFECTS\n      // 11. Bitset minor problems\n      reference\n      operator[](size_t __pos)\n      {\n\t__glibcxx_check_subscript(__pos);\n\treturn reference(_M_base()[__pos], this);\n      }\n\n      // _GLIBCXX_RESOLVE_LIB_DEFECTS\n      // 11. Bitset minor problems\n      bool\n      operator[](size_t __pos) const\n      {\n\t__glibcxx_check_subscript(__pos);\n\treturn _M_base()[__pos];\n      }\n\n      using _Base::to_ulong;\n\n      template <typename _CharT, typename _Traits, typename _Allocator>\n        std::basic_string<_CharT, _Traits, _Allocator>\n        to_string() const\n        { return _M_base().template to_string<_CharT, _Traits, _Allocator>(); }\n\n      // _GLIBCXX_RESOLVE_LIB_DEFECTS\n      // 434. bitset::to_string() hard to use.\n      template<typename _CharT, typename _Traits>\n        std::basic_string<_CharT, _Traits, std::allocator<_CharT> >\n        to_string() const\n        { return to_string<_CharT, _Traits, std::allocator<_CharT> >(); }\n\n      template<typename _CharT>\n        std::basic_string<_CharT, std::char_traits<_CharT>,\n                          std::allocator<_CharT> >\n        to_string() const\n        {\n          return to_string<_CharT, std::char_traits<_CharT>,\n                           std::allocator<_CharT> >();\n        }\n\n      std::basic_string<char, std::char_traits<char>, std::allocator<char> >\n        to_string() const\n        {\n          return to_string<char,std::char_traits<char>,std::allocator<char> >();\n        }\n\n      using _Base::count;\n      using _Base::size;\n\n      bool\n      operator==(const bitset<_Nb>& __rhs) const\n      { return _M_base() == __rhs; }\n\n      bool\n      operator!=(const bitset<_Nb>& __rhs) const\n      { return _M_base() != __rhs; }\n\n      using _Base::test;\n      using _Base::any;\n      using _Base::none;\n\n      bitset<_Nb>\n      operator<<(size_t __pos) const\n      { return bitset<_Nb>(_M_base() << __pos); }\n\n      bitset<_Nb>\n      operator>>(size_t __pos) const\n      { return bitset<_Nb>(_M_base() >> __pos); }\n\n      _Base&\n      _M_base() { return *this; }\n\n      const _Base&\n      _M_base() const { return *this; }\n    };\n\n  template<size_t _Nb>\n    bitset<_Nb>\n    operator&(const bitset<_Nb>& __x, const bitset<_Nb>& __y)\n    { return bitset<_Nb>(__x) &= __y; }\n\n  template<size_t _Nb>\n    bitset<_Nb>\n    operator|(const bitset<_Nb>& __x, const bitset<_Nb>& __y)\n    { return bitset<_Nb>(__x) |= __y; }\n\n  template<size_t _Nb>\n    bitset<_Nb>\n    operator^(const bitset<_Nb>& __x, const bitset<_Nb>& __y)\n    { return bitset<_Nb>(__x) ^= __y; }\n\n  template<typename _CharT, typename _Traits, size_t _Nb>\n    std::basic_istream<_CharT, _Traits>&\n    operator>>(std::basic_istream<_CharT, _Traits>& __is, bitset<_Nb>& __x)\n    { return __is >> __x._M_base(); }\n\n  template<typename _CharT, typename _Traits, size_t _Nb>\n    std::basic_ostream<_CharT, _Traits>&\n    operator<<(std::basic_ostream<_CharT, _Traits>& __os,\n\t       const bitset<_Nb>& __x)\n    { return __os << __x._M_base(); }\n} // namespace __debug\n} // namespace std\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/debug/debug.h",
    "content": "// Debugging support implementation -*- C++ -*-\n\n// Copyright (C) 2003, 2005, 2006\n// Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n/** @file debug/debug.h\n *  This file is a GNU debug extension to the Standard C++ Library.\n */\n\n#ifndef _GLIBCXX_DEBUG_MACRO_SWITCH_H\n#define _GLIBCXX_DEBUG_MACRO_SWITCH_H 1\n\n/** Macros and namespaces used by the implementation outside of debug\n *  wrappers to verify certain properties. The __glibcxx_requires_xxx\n *  macros are merely wrappers around the __glibcxx_check_xxx wrappers\n *  when we are compiling with debug mode, but disappear when we are\n *  in release mode so that there is no checking performed in, e.g.,\n *  the standard library algorithms.\n*/\n\n// Debug mode namespaces.\nnamespace std \n{ \n  namespace __debug { } \n}\n\nnamespace __gnu_cxx\n{ \n  namespace __debug { };\n}\n\nnamespace __gnu_debug\n{\n  using namespace std::__debug;\n  using namespace __gnu_cxx::__debug;\n}\n\n#ifndef _GLIBCXX_DEBUG\n\n# define _GLIBCXX_DEBUG_ASSERT(_Condition)\n# define _GLIBCXX_DEBUG_PEDASSERT(_Condition)\n# define _GLIBCXX_DEBUG_ONLY(_Statement) ;\n# define __glibcxx_requires_cond(_Cond,_Msg)\n# define __glibcxx_requires_valid_range(_First,_Last)\n# define __glibcxx_requires_sorted(_First,_Last)\n# define __glibcxx_requires_sorted_pred(_First,_Last,_Pred)\n# define __glibcxx_requires_partitioned(_First,_Last,_Value)\n# define __glibcxx_requires_partitioned_pred(_First,_Last,_Value,_Pred)\n# define __glibcxx_requires_heap(_First,_Last)\n# define __glibcxx_requires_heap_pred(_First,_Last,_Pred)\n# define __glibcxx_requires_nonempty()\n# define __glibcxx_requires_string(_String)\n# define __glibcxx_requires_string_len(_String,_Len)\n# define __glibcxx_requires_subscript(_N)\n\n#else\n\n# include <cstdlib>\n# include <cstdio>\n# include <debug/macros.h>\n\nnamespace std\n{\n  namespace __debug\n  { \n    // Avoid the use of assert, because we're trying to keep the <cassert>\n    // include out of the mix.\n    inline void\n    __replacement_assert(const char* __file, int __line, \n\t\t\t const char* __function, const char* __condition)\n    {\n      printf(\"%s:%d: %s: Assertion '%s' failed.\\n\", __file, __line,\n\t     __function, __condition);\n      abort();\n    }\n  } // namespace __debug\n} // namespace std\n\n#define _GLIBCXX_DEBUG_ASSERT(_Condition)                                   \\\n  do \t\t\t\t\t\t\t\t\t    \\\n  {\t\t\t\t\t\t\t\t\t    \\\n    if (! (_Condition))                                                     \\\n      std::__debug::__replacement_assert(__FILE__, __LINE__,\t\t    \\\n\t\t\t\t\t __PRETTY_FUNCTION__, #_Condition); \\\n  } while (false)\n\n#ifdef _GLIBCXX_DEBUG_PEDANTIC\n# define _GLIBCXX_DEBUG_PEDASSERT(_Condition) _GLIBCXX_DEBUG_ASSERT(_Condition)\n#else\n# define _GLIBCXX_DEBUG_PEDASSERT(_Condition)\n#endif\n# define _GLIBCXX_DEBUG_ONLY(_Statement) _Statement\n\n# define __glibcxx_requires_cond(_Cond,_Msg) _GLIBCXX_DEBUG_VERIFY(_Cond,_Msg)\n# define __glibcxx_requires_valid_range(_First,_Last) \\\n     __glibcxx_check_valid_range(_First,_Last)\n# define __glibcxx_requires_sorted(_First,_Last) \\\n     __glibcxx_check_sorted(_First,_Last)\n# define __glibcxx_requires_sorted_pred(_First,_Last,_Pred) \\\n     __glibcxx_check_sorted_pred(_First,_Last,_Pred)\n# define __glibcxx_requires_partitioned(_First,_Last,_Value)\t\\\n     __glibcxx_check_partitioned(_First,_Last,_Value)\n# define __glibcxx_requires_partitioned_pred(_First,_Last,_Value,_Pred) \\\n     __glibcxx_check_partitioned_pred(_First,_Last,_Value,_Pred)\n# define __glibcxx_requires_heap(_First,_Last) \\\n     __glibcxx_check_heap(_First,_Last)\n# define __glibcxx_requires_heap_pred(_First,_Last,_Pred) \\\n     __glibcxx_check_heap_pred(_First,_Last,_Pred)\n# define __glibcxx_requires_nonempty() __glibcxx_check_nonempty()\n# define __glibcxx_requires_string(_String) __glibcxx_check_string(_String)\n# define __glibcxx_requires_string_len(_String,_Len)\t\\\n     __glibcxx_check_string_len(_String,_Len)\n# define __glibcxx_requires_subscript(_N) __glibcxx_check_subscript(_N)\n\n# include <debug/functions.h>\n# include <debug/formatter.h>\n\n#endif\n\n#endif // _GLIBCXX_DEBUG_MACRO_SWITCH_H\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/debug/deque",
    "content": "// Debugging deque implementation -*- C++ -*-\n\n// Copyright (C) 2003, 2004, 2005\n// Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n/** @file debug/deque\n *  This file is a GNU debug extension to the Standard C++ Library.\n */\n\n#ifndef _GLIBCXX_DEBUG_DEQUE\n#define _GLIBCXX_DEBUG_DEQUE 1\n\n#include <deque>\n#include <debug/safe_sequence.h>\n#include <debug/safe_iterator.h>\n\nnamespace std\n{\nnamespace __debug\n{\n  template<typename _Tp, typename _Allocator = std::allocator<_Tp> >\n    class deque\n    : public _GLIBCXX_STD::deque<_Tp, _Allocator>,\n      public __gnu_debug::_Safe_sequence<deque<_Tp, _Allocator> >\n    {\n      typedef  _GLIBCXX_STD::deque<_Tp, _Allocator> _Base;\n      typedef __gnu_debug::_Safe_sequence<deque> _Safe_base;\n\n    public:\n      typedef typename _Base::reference             reference;\n      typedef typename _Base::const_reference       const_reference;\n\n      typedef __gnu_debug::_Safe_iterator<typename _Base::iterator,deque>\n\t\t\t\t\t\t    iterator;\n      typedef __gnu_debug::_Safe_iterator<typename _Base::const_iterator,deque>\n\t\t\t\t\t\t     const_iterator;\n\n      typedef typename _Base::size_type             size_type;\n      typedef typename _Base::difference_type       difference_type;\n\n      typedef _Tp\t\t\t\t    value_type;\n      typedef _Allocator\t\t\t    allocator_type;\n      typedef typename _Base::pointer               pointer;\n      typedef typename _Base::const_pointer         const_pointer;\n      typedef std::reverse_iterator<iterator>       reverse_iterator;\n      typedef std::reverse_iterator<const_iterator> const_reverse_iterator;\n\n      // 23.2.1.1 construct/copy/destroy:\n      explicit deque(const _Allocator& __a = _Allocator())\n      : _Base(__a) { }\n\n      explicit deque(size_type __n, const _Tp& __value = _Tp(),\n\t\t     const _Allocator& __a = _Allocator())\n      : _Base(__n, __value, __a) { }\n\n      template<class _InputIterator>\n        deque(_InputIterator __first, _InputIterator __last,\n\t      const _Allocator& __a = _Allocator())\n\t: _Base(__gnu_debug::__check_valid_range(__first, __last), __last, __a)\n        { }\n\n      deque(const deque<_Tp,_Allocator>& __x) : _Base(__x), _Safe_base() { }\n\n      deque(const _Base& __x) : _Base(__x), _Safe_base() { }\n\n      ~deque() { }\n\n      deque<_Tp,_Allocator>&\n      operator=(const deque<_Tp,_Allocator>& __x)\n      {\n\t*static_cast<_Base*>(this) = __x;\n\tthis->_M_invalidate_all();\n\treturn *this;\n      }\n\n      template<class _InputIterator>\n        void\n        assign(_InputIterator __first, _InputIterator __last)\n        {\n\t  __glibcxx_check_valid_range(__first, __last);\n\t  _Base::assign(__first, __last);\n\t  this->_M_invalidate_all();\n\t}\n\n      void\n      assign(size_type __n, const _Tp& __t)\n      {\n\t_Base::assign(__n, __t);\n\tthis->_M_invalidate_all();\n      }\n\n      using _Base::get_allocator;\n\n      // iterators:\n      iterator\n      begin()\n      { return iterator(_Base::begin(), this); }\n\n      const_iterator\n      begin() const\n      { return const_iterator(_Base::begin(), this); }\n\n      iterator\n      end()\n      { return iterator(_Base::end(), this); }\n\n      const_iterator\n      end() const\n      { return const_iterator(_Base::end(), this); }\n\n      reverse_iterator\n      rbegin()\n      { return reverse_iterator(end()); }\n\n      const_reverse_iterator\n      rbegin() const\n      { return const_reverse_iterator(end()); }\n\n      reverse_iterator\n      rend()\n      { return reverse_iterator(begin()); }\n\n      const_reverse_iterator\n      rend() const\n      { return const_reverse_iterator(begin()); }\n\n      // 23.2.1.2 capacity:\n      using _Base::size;\n      using _Base::max_size;\n\n      void\n      resize(size_type __sz, _Tp __c = _Tp())\n      {\n\ttypedef typename _Base::const_iterator _Base_const_iterator;\n\ttypedef __gnu_debug::_After_nth_from<_Base_const_iterator> _After_nth;\n\n\tbool __invalidate_all = __sz > this->size();\n\tif (__sz < this->size())\n\t  this->_M_invalidate_if(_After_nth(__sz, _M_base().begin()));\n\n\t_Base::resize(__sz, __c);\n\n\tif (__invalidate_all)\n\t  this->_M_invalidate_all();\n      }\n\n      using _Base::empty;\n\n      // element access:\n      reference\n      operator[](size_type __n)\n      {\n\t__glibcxx_check_subscript(__n);\n\treturn _M_base()[__n];\n      }\n\n      const_reference\n      operator[](size_type __n) const\n      {\n\t__glibcxx_check_subscript(__n);\n\treturn _M_base()[__n];\n      }\n\n      using _Base::at;\n\n      reference\n      front()\n      {\n\t__glibcxx_check_nonempty();\n\treturn _Base::front();\n      }\n\n      const_reference\n      front() const\n      {\n\t__glibcxx_check_nonempty();\n\treturn _Base::front();\n      }\n\n      reference\n      back()\n      {\n\t__glibcxx_check_nonempty();\n\treturn _Base::back();\n      }\n\n      const_reference\n      back() const\n      {\n\t__glibcxx_check_nonempty();\n\treturn _Base::back();\n      }\n\n      // 23.2.1.3 modifiers:\n      void\n      push_front(const _Tp& __x)\n      {\n\t_Base::push_front(__x);\n\tthis->_M_invalidate_all();\n      }\n\n      void\n      push_back(const _Tp& __x)\n      {\n\t_Base::push_back(__x);\n\tthis->_M_invalidate_all();\n      }\n\n      iterator\n      insert(iterator __position, const _Tp& __x)\n      {\n\t__glibcxx_check_insert(__position);\n\ttypename _Base::iterator __res = _Base::insert(__position.base(), __x);\n\tthis->_M_invalidate_all();\n\treturn iterator(__res, this);\n      }\n\n      void\n      insert(iterator __position, size_type __n, const _Tp& __x)\n      {\n\t__glibcxx_check_insert(__position);\n\t_Base::insert(__position.base(), __n, __x);\n\tthis->_M_invalidate_all();\n      }\n\n      template<class _InputIterator>\n        void\n        insert(iterator __position,\n\t       _InputIterator __first, _InputIterator __last)\n        {\n\t  __glibcxx_check_insert_range(__position, __first, __last);\n\t  _Base::insert(__position.base(), __first, __last);\n\t  this->_M_invalidate_all();\n\t}\n\n      void\n      pop_front()\n      {\n\t__glibcxx_check_nonempty();\n\titerator __victim = begin();\n\t__victim._M_invalidate();\n\t_Base::pop_front();\n      }\n\n      void\n      pop_back()\n      {\n\t__glibcxx_check_nonempty();\n\titerator __victim = end();\n\t--__victim;\n\t__victim._M_invalidate();\n\t_Base::pop_back();\n      }\n\n      iterator\n      erase(iterator __position)\n      {\n\t__glibcxx_check_erase(__position);\n\tif (__position == begin() || __position == end()-1)\n\t  {\n\t    __position._M_invalidate();\n\t    return iterator(_Base::erase(__position.base()), this);\n\t  }\n\telse\n\t  {\n\t    typename _Base::iterator __res = _Base::erase(__position.base());\n\t    this->_M_invalidate_all();\n\t    return iterator(__res, this);\n\t  }\n      }\n\n      iterator\n      erase(iterator __first, iterator __last)\n      {\n\t// _GLIBCXX_RESOLVE_LIB_DEFECTS\n\t// 151. can't currently clear() empty container\n\t__glibcxx_check_erase_range(__first, __last);\n        if (__first == begin() || __last == end())\n\t  {\n\t    this->_M_detach_singular();\n\t    for (iterator __position = __first; __position != __last; )\n\t      {\n\t\titerator __victim = __position++;\n\t\t__victim._M_invalidate();\n\t      }\n\t    try\n\t      {\n\t\treturn iterator(_Base::erase(__first.base(), __last.base()),\n\t\t\t\tthis);\n\t      }\n\t    catch (...)\n\t      {\n\t\tthis->_M_revalidate_singular();\n\t\t__throw_exception_again;\n\t      }\n\t  }\n\telse\n\t  {\n\t    typename _Base::iterator __res = _Base::erase(__first.base(),\n\t\t\t\t\t\t\t  __last.base());\n\t    this->_M_invalidate_all();\n\t    return iterator(__res, this);\n\t  }\n      }\n\n      void\n      swap(deque<_Tp,_Allocator>& __x)\n      {\n\t_Base::swap(__x);\n\tthis->_M_swap(__x);\n      }\n\n      void\n      clear()\n      {\n\t_Base::clear();\n\tthis->_M_invalidate_all();\n      }\n\n      _Base&\n      _M_base()       { return *this; }\n\n      const _Base&\n      _M_base() const { return *this; }\n    };\n\n  template<typename _Tp, typename _Alloc>\n    inline bool\n    operator==(const deque<_Tp, _Alloc>& __lhs,\n\t       const deque<_Tp, _Alloc>& __rhs)\n    { return __lhs._M_base() == __rhs._M_base(); }\n\n  template<typename _Tp, typename _Alloc>\n    inline bool\n    operator!=(const deque<_Tp, _Alloc>& __lhs,\n\t       const deque<_Tp, _Alloc>& __rhs)\n    { return __lhs._M_base() != __rhs._M_base(); }\n\n  template<typename _Tp, typename _Alloc>\n    inline bool\n    operator<(const deque<_Tp, _Alloc>& __lhs, const deque<_Tp, _Alloc>& __rhs)\n    { return __lhs._M_base() < __rhs._M_base(); }\n\n  template<typename _Tp, typename _Alloc>\n    inline bool\n    operator<=(const deque<_Tp, _Alloc>& __lhs,\n\t       const deque<_Tp, _Alloc>& __rhs)\n    { return __lhs._M_base() <= __rhs._M_base(); }\n\n  template<typename _Tp, typename _Alloc>\n    inline bool\n    operator>=(const deque<_Tp, _Alloc>& __lhs,\n\t       const deque<_Tp, _Alloc>& __rhs)\n    { return __lhs._M_base() >= __rhs._M_base(); }\n\n  template<typename _Tp, typename _Alloc>\n    inline bool\n    operator>(const deque<_Tp, _Alloc>& __lhs, const deque<_Tp, _Alloc>& __rhs)\n    { return __lhs._M_base() > __rhs._M_base(); }\n\n  template<typename _Tp, typename _Alloc>\n    inline void\n    swap(deque<_Tp, _Alloc>& __lhs, deque<_Tp, _Alloc>& __rhs)\n    { __lhs.swap(__rhs); }\n} // namespace __debug\n} // namespace std\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/debug/formatter.h",
    "content": "// Debug-mode error formatting implementation -*- C++ -*-\n\n// Copyright (C) 2003, 2004, 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n/** @file debug/formatter.h\n *  This file is a GNU debug extension to the Standard C++ Library.\n */\n\n#ifndef _GLIBCXX_DEBUG_FORMATTER_H\n#define _GLIBCXX_DEBUG_FORMATTER_H 1\n\n#include <typeinfo>\n#include <debug/debug.h>\n\nnamespace __gnu_debug\n{\n  using std::type_info;\n\n  /** Determine if the two types are the same. */\n  template<typename _Type1, typename _Type2>\n    struct __is_same\n    {\n      static const bool value = false;\n    };\n\n  template<typename _Type>\n    struct __is_same<_Type, _Type>\n    {\n      static const bool value = true;\n    };\n\n  template<bool> struct __truth { };\n\n  class _Safe_sequence_base;\n\n  template<typename _Iterator, typename _Sequence>\n    class _Safe_iterator;\n\n  template<typename _Sequence>\n    class _Safe_sequence;\n\n  enum _Debug_msg_id\n  {\n    // General checks\n    __msg_valid_range,\n    __msg_insert_singular,\n    __msg_insert_different,\n    __msg_erase_bad,\n    __msg_erase_different,\n    __msg_subscript_oob,\n    __msg_empty,\n    __msg_unpartitioned,\n    __msg_unpartitioned_pred,\n    __msg_unsorted,\n    __msg_unsorted_pred,\n    __msg_not_heap,\n    __msg_not_heap_pred,\n    // std::bitset checks\n    __msg_bad_bitset_write,\n    __msg_bad_bitset_read,\n    __msg_bad_bitset_flip,\n    // std::list checks\n    __msg_self_splice,\n    __msg_splice_alloc,\n    __msg_splice_bad,\n    __msg_splice_other,\n    __msg_splice_overlap,\n    // iterator checks\n    __msg_init_singular,\n    __msg_init_copy_singular,\n    __msg_init_const_singular,\n    __msg_copy_singular,\n    __msg_bad_deref,\n    __msg_bad_inc,\n    __msg_bad_dec,\n    __msg_iter_subscript_oob,\n    __msg_advance_oob,\n    __msg_retreat_oob,\n    __msg_iter_compare_bad,\n    __msg_compare_different,\n    __msg_iter_order_bad,\n    __msg_order_different,\n    __msg_distance_bad,\n    __msg_distance_different,\n    // istream_iterator\n    __msg_deref_istream,\n    __msg_inc_istream,\n    // ostream_iterator\n    __msg_output_ostream,\n    // istreambuf_iterator\n    __msg_deref_istreambuf,\n    __msg_inc_istreambuf\n  };\n\n  class _Error_formatter\n  {\n    /// Whether an iterator is constant, mutable, or unknown\n    enum _Constness\n    {\n      __unknown_constness,\n      __const_iterator,\n      __mutable_iterator,\n      __last_constness\n    };\n\n    // The state of the iterator (fine-grained), if we know it.\n    enum _Iterator_state\n    {\n      __unknown_state,\n      __singular,      // singular, may still be attached to a sequence\n      __begin,         // dereferenceable, and at the beginning\n      __middle,        // dereferenceable, not at the beginning\n      __end,           // past-the-end, may be at beginning if sequence empty\n      __last_state\n    };\n\n    // Tags denoting the type of parameter for construction\n    struct _Is_iterator { };\n    struct _Is_sequence { };\n\n    // A parameter that may be referenced by an error message\n    struct _Parameter\n    {\n      enum\n      {\n\t__unused_param,\n\t__iterator,\n\t__sequence,\n\t__integer,\n\t__string\n      } _M_kind;\n\n      union\n      {\n\t// When _M_kind == __iterator\n\tstruct\n\t{\n\t  const char*      _M_name;\n\t  const void*      _M_address;\n\t  const type_info* _M_type;\n\t  _Constness       _M_constness;\n\t  _Iterator_state  _M_state;\n\t  const void*      _M_sequence;\n\t  const type_info* _M_seq_type;\n\t} _M_iterator;\n\n\t// When _M_kind == __sequence\n\tstruct\n\t{\n\t  const char*      _M_name;\n\t  const void*      _M_address;\n\t  const type_info* _M_type;\n\t} _M_sequence;\n\n\t// When _M_kind == __integer\n\tstruct\n\t{\n\t  const char* _M_name;\n\t  long        _M_value;\n\t} _M_integer;\n\n\t// When _M_kind == __string\n\tstruct\n\t{\n\t  const char* _M_name;\n\t  const char* _M_value;\n\t} _M_string;\n      } _M_variant;\n\n      _Parameter() : _M_kind(__unused_param), _M_variant() { }\n\n      _Parameter(long __value, const char* __name) \n      : _M_kind(__integer), _M_variant()\n      {\n\t_M_variant._M_integer._M_name = __name;\n\t_M_variant._M_integer._M_value = __value;\n      }\n\n      _Parameter(const char* __value, const char* __name) \n      : _M_kind(__string), _M_variant()\n      {\n\t_M_variant._M_string._M_name = __name;\n\t_M_variant._M_string._M_value = __value;\n      }\n\n      template<typename _Iterator, typename _Sequence>\n        _Parameter(const _Safe_iterator<_Iterator, _Sequence>& __it,\n\t\t   const char* __name, _Is_iterator)\n\t: _M_kind(__iterator),  _M_variant()\n        {\n\t  _M_variant._M_iterator._M_name = __name;\n\t  _M_variant._M_iterator._M_address = &__it;\n\t  _M_variant._M_iterator._M_type = &typeid(__it);\n\t  _M_variant._M_iterator._M_constness =\n\t    __is_same<_Safe_iterator<_Iterator, _Sequence>,\n\t                         typename _Sequence::iterator>::\n\t      value? __mutable_iterator : __const_iterator;\n\t  _M_variant._M_iterator._M_sequence = __it._M_get_sequence();\n\t  _M_variant._M_iterator._M_seq_type = &typeid(_Sequence);\n\n\t  if (__it._M_singular())\n\t    _M_variant._M_iterator._M_state = __singular;\n\t  else\n\t    {\n\t      bool __is_begin = __it._M_is_begin();\n\t      bool __is_end = __it._M_is_end();\n\t      if (__is_end)\n\t\t_M_variant._M_iterator._M_state = __end;\n\t      else if (__is_begin)\n\t\t_M_variant._M_iterator._M_state = __begin;\n\t      else\n\t\t_M_variant._M_iterator._M_state = __middle;\n\t    }\n\t}\n\n      template<typename _Type>\n        _Parameter(const _Type*& __it, const char* __name, _Is_iterator)\n        : _M_kind(__iterator), _M_variant()\n        {\n\t  _M_variant._M_iterator._M_name = __name;\n\t  _M_variant._M_iterator._M_address = &__it;\n\t  _M_variant._M_iterator._M_type = &typeid(__it);\n\t  _M_variant._M_iterator._M_constness = __mutable_iterator;\n\t  _M_variant._M_iterator._M_state = __it? __unknown_state : __singular;\n\t  _M_variant._M_iterator._M_sequence = 0;\n\t  _M_variant._M_iterator._M_seq_type = 0;\n\t}\n\n      template<typename _Type>\n        _Parameter(_Type*& __it, const char* __name, _Is_iterator)\n        : _M_kind(__iterator), _M_variant()\n        {\n\t  _M_variant._M_iterator._M_name = __name;\n\t  _M_variant._M_iterator._M_address = &__it;\n\t  _M_variant._M_iterator._M_type = &typeid(__it);\n\t  _M_variant._M_iterator._M_constness = __const_iterator;\n\t  _M_variant._M_iterator._M_state = __it? __unknown_state : __singular;\n\t  _M_variant._M_iterator._M_sequence = 0;\n\t  _M_variant._M_iterator._M_seq_type = 0;\n\t}\n\n      template<typename _Iterator>\n        _Parameter(const _Iterator& __it, const char* __name, _Is_iterator)\n        : _M_kind(__iterator), _M_variant()\n        {\n\t  _M_variant._M_iterator._M_name = __name;\n\t  _M_variant._M_iterator._M_address = &__it;\n\t  _M_variant._M_iterator._M_type = &typeid(__it);\n\t  _M_variant._M_iterator._M_constness = __unknown_constness;\n\t  _M_variant._M_iterator._M_state =\n\t    __gnu_debug::__check_singular(__it)? __singular : __unknown_state;\n\t  _M_variant._M_iterator._M_sequence = 0;\n\t  _M_variant._M_iterator._M_seq_type = 0;\n\t}\n\n      template<typename _Sequence>\n        _Parameter(const _Safe_sequence<_Sequence>& __seq,\n\t\t   const char* __name, _Is_sequence)\n        : _M_kind(__sequence), _M_variant()\n        {\n\t  _M_variant._M_sequence._M_name = __name;\n\t  _M_variant._M_sequence._M_address =\n\t    static_cast<const _Sequence*>(&__seq);\n\t  _M_variant._M_sequence._M_type = &typeid(_Sequence);\n\t}\n\n      template<typename _Sequence>\n        _Parameter(const _Sequence& __seq, const char* __name, _Is_sequence)\n        : _M_kind(__sequence), _M_variant()\n        {\n\t  _M_variant._M_sequence._M_name = __name;\n\t  _M_variant._M_sequence._M_address = &__seq;\n\t  _M_variant._M_sequence._M_type = &typeid(_Sequence);\n\t}\n\n      void\n      _M_print_field(const _Error_formatter* __formatter,\n\t\t     const char* __name) const;\n\n      void\n      _M_print_description(const _Error_formatter* __formatter) const;\n    };\n\n    friend struct _Parameter;\n\n  public:\n    template<typename _Iterator>\n      const _Error_formatter&\n      _M_iterator(const _Iterator& __it, const char* __name = 0)  const\n      {\n\tif (_M_num_parameters < size_t(__max_parameters))\n\t  _M_parameters[_M_num_parameters++] = _Parameter(__it, __name,\n\t\t\t\t\t\t\t  _Is_iterator());\n\treturn *this;\n      }\n\n    const _Error_formatter&\n    _M_integer(long __value, const char* __name = 0) const\n    {\n      if (_M_num_parameters < size_t(__max_parameters))\n\t_M_parameters[_M_num_parameters++] = _Parameter(__value, __name);\n      return *this;\n    }\n\n    const _Error_formatter&\n    _M_string(const char* __value, const char* __name = 0) const\n    {\n      if (_M_num_parameters < size_t(__max_parameters))\n\t_M_parameters[_M_num_parameters++] = _Parameter(__value, __name);\n      return *this;\n    }\n\n    template<typename _Sequence>\n      const _Error_formatter&\n      _M_sequence(const _Sequence& __seq, const char* __name = 0) const\n      {\n\tif (_M_num_parameters < size_t(__max_parameters))\n\t  _M_parameters[_M_num_parameters++] = _Parameter(__seq, __name,\n\t\t\t\t\t\t\t  _Is_sequence());\n\treturn *this;\n      }\n\n    const _Error_formatter&\n    _M_message(const char* __text) const\n    { _M_text = __text; return *this; }\n\n    const _Error_formatter&\n    _M_message(_Debug_msg_id __id) const;\n\n    void\n    _M_error() const;\n\n  private:\n    _Error_formatter(const char* __file, size_t __line)\n    : _M_file(__file), _M_line(__line), _M_num_parameters(0), _M_text(0),\n      _M_max_length(78), _M_column(1), _M_first_line(true), _M_wordwrap(false)\n    { }\n\n    template<typename _Tp>\n      void\n      _M_format_word(char*, int, const char*, _Tp) const;\n\n    void\n    _M_print_word(const char* __word) const;\n\n    void\n    _M_print_string(const char* __string) const;\n\n    enum { __max_parameters = 9 };\n\n    const char*         _M_file;\n    size_t              _M_line;\n    mutable _Parameter  _M_parameters[__max_parameters];\n    mutable size_t      _M_num_parameters;\n    mutable const char* _M_text;\n    mutable size_t      _M_max_length;\n    enum { _M_indent = 4 } ;\n    mutable size_t      _M_column;\n    mutable bool        _M_first_line;\n    mutable bool        _M_wordwrap;\n\n  public:\n    static _Error_formatter\n    _M_at(const char* __file, size_t __line)\n    { return _Error_formatter(__file, __line); }\n  };\n} // namespace __gnu_debug\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/debug/functions.h",
    "content": "// Debugging support implementation -*- C++ -*-\n\n// Copyright (C) 2003, 2005, 2006\n// Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n/** @file debug/functions.h\n *  This file is a GNU debug extension to the Standard C++ Library.\n */\n\n#ifndef _GLIBCXX_DEBUG_FUNCTIONS_H\n#define _GLIBCXX_DEBUG_FUNCTIONS_H 1\n\n#include <bits/c++config.h>\n#include <stddef.h>                       // for ptrdiff_t\n#include <bits/stl_iterator_base_types.h> // for iterator_traits, categories\n#include <bits/cpp_type_traits.h>         // for __is_integer\n\nnamespace __gnu_debug\n{\n  template<typename _Iterator, typename _Sequence>\n    class _Safe_iterator;\n\n  // An arbitrary iterator pointer is not singular.\n  inline bool\n  __check_singular_aux(const void*) { return false; }\n\n  // We may have an iterator that derives from _Safe_iterator_base but isn't\n  // a _Safe_iterator.\n  template<typename _Iterator>\n    inline bool\n    __check_singular(_Iterator& __x)\n    { return __check_singular_aux(&__x); }\n\n  /** Non-NULL pointers are nonsingular. */\n  template<typename _Tp>\n    inline bool\n    __check_singular(const _Tp* __ptr)\n    { return __ptr == 0; }\n\n  /** Safe iterators know if they are singular. */\n  template<typename _Iterator, typename _Sequence>\n    inline bool\n    __check_singular(const _Safe_iterator<_Iterator, _Sequence>& __x)\n    { return __x._M_singular(); }\n\n  /** Assume that some arbitrary iterator is dereferenceable, because we\n      can't prove that it isn't. */\n  template<typename _Iterator>\n    inline bool\n    __check_dereferenceable(_Iterator&)\n    { return true; }\n\n  /** Non-NULL pointers are dereferenceable. */\n  template<typename _Tp>\n    inline bool\n    __check_dereferenceable(const _Tp* __ptr)\n    { return __ptr; }\n\n  /** Safe iterators know if they are singular. */\n  template<typename _Iterator, typename _Sequence>\n    inline bool\n    __check_dereferenceable(const _Safe_iterator<_Iterator, _Sequence>& __x)\n    { return __x._M_dereferenceable(); }\n\n  /** If the distance between two random access iterators is\n   *  nonnegative, assume the range is valid.\n  */\n  template<typename _RandomAccessIterator>\n    inline bool\n    __valid_range_aux2(const _RandomAccessIterator& __first,\n\t\t       const _RandomAccessIterator& __last,\n\t\t       std::random_access_iterator_tag)\n    { return __last - __first >= 0; }\n\n  /** Can't test for a valid range with input iterators, because\n   *  iteration may be destructive. So we just assume that the range\n   *  is valid.\n  */\n  template<typename _InputIterator>\n    inline bool\n    __valid_range_aux2(const _InputIterator&, const _InputIterator&,\n\t\t       std::input_iterator_tag)\n    { return true; }\n\n  /** We say that integral types for a valid range, and defer to other\n   *  routines to realize what to do with integral types instead of\n   *  iterators.\n  */\n  template<typename _Integral>\n    inline bool\n    __valid_range_aux(const _Integral&, const _Integral&, std::__true_type)\n    { return true; }\n\n  /** We have iterators, so figure out what kind of iterators that are\n   *  to see if we can check the range ahead of time.\n  */\n  template<typename _InputIterator>\n    inline bool\n    __valid_range_aux(const _InputIterator& __first,\n\t\t      const _InputIterator& __last, std::__false_type)\n  {\n    typedef typename std::iterator_traits<_InputIterator>::iterator_category\n      _Category;\n    return __valid_range_aux2(__first, __last, _Category());\n  }\n\n  /** Don't know what these iterators are, or if they are even\n   *  iterators (we may get an integral type for InputIterator), so\n   *  see if they are integral and pass them on to the next phase\n   *  otherwise.\n  */\n  template<typename _InputIterator>\n    inline bool\n    __valid_range(const _InputIterator& __first, const _InputIterator& __last)\n    {\n      typedef typename std::__is_integer<_InputIterator>::__type _Integral;\n      return __valid_range_aux(__first, __last, _Integral());\n    }\n\n  /** Safe iterators know how to check if they form a valid range. */\n  template<typename _Iterator, typename _Sequence>\n    inline bool\n    __valid_range(const _Safe_iterator<_Iterator, _Sequence>& __first,\n\t\t  const _Safe_iterator<_Iterator, _Sequence>& __last)\n    { return __first._M_valid_range(__last); }\n\n  /* Checks that [first, last) is a valid range, and then returns\n   * __first. This routine is useful when we can't use a separate\n   * assertion statement because, e.g., we are in a constructor.\n  */\n  template<typename _InputIterator>\n    inline _InputIterator\n    __check_valid_range(const _InputIterator& __first,\n\t\t\tconst _InputIterator& __last\n\t\t\t__attribute__((__unused__)))\n    {\n      _GLIBCXX_DEBUG_ASSERT(__valid_range(__first, __last));\n      return __first;\n    }\n\n  /** Checks that __s is non-NULL or __n == 0, and then returns __s. */\n  template<typename _CharT, typename _Integer>\n    inline const _CharT*\n    __check_string(const _CharT* __s,\n\t\t   const _Integer& __n __attribute__((__unused__)))\n    {\n#ifdef _GLIBCXX_DEBUG_PEDANTIC\n      _GLIBCXX_DEBUG_ASSERT(__s != 0 || __n == 0);\n#endif\n      return __s;\n    }\n\n  /** Checks that __s is non-NULL and then returns __s. */\n  template<typename _CharT>\n    inline const _CharT*\n    __check_string(const _CharT* __s)\n    {\n#ifdef _GLIBCXX_DEBUG_PEDANTIC\n      _GLIBCXX_DEBUG_ASSERT(__s != 0);\n#endif\n      return __s;\n    }\n\n  // Can't check if an input iterator sequence is sorted, because we\n  // can't step through the sequence.\n  template<typename _InputIterator>\n    inline bool\n    __check_sorted_aux(const _InputIterator&, const _InputIterator&,\n                       std::input_iterator_tag)\n    { return true; }\n\n  // Can verify if a forward iterator sequence is in fact sorted using\n  // std::__is_sorted\n  template<typename _ForwardIterator>\n    inline bool\n    __check_sorted_aux(_ForwardIterator __first, _ForwardIterator __last,\n                       std::forward_iterator_tag)\n    {\n      if (__first == __last)\n        return true;\n\n      _ForwardIterator __next = __first;\n      for (++__next; __next != __last; __first = __next, ++__next) {\n        if (*__next < *__first)\n          return false;\n      }\n\n      return true;\n    }\n\n  // Can't check if an input iterator sequence is sorted, because we can't step\n  // through the sequence.\n  template<typename _InputIterator, typename _Predicate>\n    inline bool\n    __check_sorted_aux(const _InputIterator&, const _InputIterator&,\n                       _Predicate, std::input_iterator_tag)\n    { return true; }\n\n  // Can verify if a forward iterator sequence is in fact sorted using\n  // std::__is_sorted\n  template<typename _ForwardIterator, typename _Predicate>\n    inline bool\n    __check_sorted_aux(_ForwardIterator __first, _ForwardIterator __last,\n                       _Predicate __pred, std::forward_iterator_tag)\n    {\n      if (__first == __last)\n        return true;\n\n      _ForwardIterator __next = __first;\n      for (++__next; __next != __last; __first = __next, ++__next) {\n        if (__pred(*__next, *__first))\n          return false;\n      }\n\n      return true;\n    }\n\n  // Determine if a sequence is sorted.\n  template<typename _InputIterator>\n    inline bool\n    __check_sorted(const _InputIterator& __first, const _InputIterator& __last)\n    {\n      typedef typename std::iterator_traits<_InputIterator>::iterator_category\n        _Category;\n      return __check_sorted_aux(__first, __last, _Category());\n    }\n\n  template<typename _InputIterator, typename _Predicate>\n    inline bool\n    __check_sorted(const _InputIterator& __first, const _InputIterator& __last,\n                   _Predicate __pred)\n    {\n      typedef typename std::iterator_traits<_InputIterator>::iterator_category\n        _Category;\n      return __check_sorted_aux(__first, __last, __pred,\n\t\t\t\t\t     _Category());\n    }\n\n  // _GLIBCXX_RESOLVE_LIB_DEFECTS\n  // 270. Binary search requirements overly strict\n  // Determine if a sequence is partitioned w.r.t. this element.\n  template<typename _ForwardIterator, typename _Tp>\n    inline bool\n    __check_partitioned(_ForwardIterator __first, _ForwardIterator __last,\n\t\t\tconst _Tp& __value)\n    {\n      while (__first != __last && *__first < __value)\n\t++__first;\n      while (__first != __last && !(*__first < __value))\n\t++__first;\n      return __first == __last;\n    }\n\n  // Determine if a sequence is partitioned w.r.t. this element.\n  template<typename _ForwardIterator, typename _Tp, typename _Pred>\n    inline bool\n    __check_partitioned(_ForwardIterator __first, _ForwardIterator __last,\n\t\t\tconst _Tp& __value, _Pred __pred)\n    {\n      while (__first != __last && __pred(*__first, __value))\n\t++__first;\n      while (__first != __last && !__pred(*__first, __value))\n\t++__first;\n      return __first == __last;\n    }\n} // namespace __gnu_debug\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/debug/hash_map",
    "content": "// Debugging hash_map/hash_multimap implementation -*- C++ -*-\n\n// Copyright (C) 2003, 2005\n// Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n/** @file debug/hash_map\n *  This file is a GNU debug extension to the Standard C++ Library.\n */\n\n#ifndef _GLIBCXX_DEBUG_HASH_MAP\n#define _GLIBCXX_DEBUG_HASH_MAP 1\n\n#include <ext/hash_map>\n#include <debug/hash_map.h>\n#include <debug/hash_multimap.h>\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/debug/hash_map.h",
    "content": "// Debugging hash_map implementation -*- C++ -*-\n\n// Copyright (C) 2003, 2005, 2006\n// Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n/** @file debug/hash_map.h\n *  This file is a GNU debug extension to the Standard C++ Library.\n */\n\n#ifndef _GLIBCXX_DEBUG_HASH_MAP_H\n#define _GLIBCXX_DEBUG_HASH_MAP_H 1\n\n#include <debug/safe_sequence.h>\n#include <debug/safe_iterator.h>\n\nnamespace __gnu_cxx\n{\nnamespace __debug\n{\n  template<typename _Value, typename _Tp,\n\t   typename _HashFcn  = __gnu_cxx::hash<_Value>,\n\t   typename _EqualKey = std::equal_to<_Value>,\n\t   typename _Alloc = std::allocator<_Value> >\n    class hash_map\n    : public _GLIBCXX_EXT::hash_map<_Value, _Tp, _HashFcn, _EqualKey, _Alloc>,\n      public __gnu_debug::_Safe_sequence<hash_map<_Value, _Tp, _HashFcn,\n\t\t\t\t\t\t _EqualKey, _Alloc> >\n    {\n      typedef _GLIBCXX_EXT::hash_map<_Value, _Tp, _HashFcn, _EqualKey, _Alloc>\n      \t\t\t\t\t\t\t_Base;\n      typedef __gnu_debug::_Safe_sequence<hash_map> \t_Safe_base;\n\n    public:\n      typedef typename _Base::key_type        key_type;\n      typedef typename _Base::data_type       data_type;\n      typedef typename _Base::mapped_type     mapped_type;\n      typedef typename _Base::value_type      value_type;\n      typedef typename _Base::hasher          hasher;\n      typedef typename _Base::key_equal       key_equal;\n      typedef typename _Base::size_type       size_type;\n      typedef typename _Base::difference_type difference_type;\n      typedef typename _Base::pointer         pointer;\n      typedef typename _Base::const_pointer   const_pointer;\n      typedef typename _Base::reference       reference;\n      typedef typename _Base::const_reference const_reference;\n\n      typedef __gnu_debug::_Safe_iterator<typename _Base::iterator, hash_map>\n\t\t\t\t\t      iterator;\n      typedef __gnu_debug::_Safe_iterator<typename _Base::const_iterator,\n\t\t\t\t\t  hash_map>\n\t\t\t\t\t      const_iterator;\n\n      typedef typename _Base::allocator_type  allocator_type;\n\n      using _Base::hash_funct;\n      using _Base::key_eq;\n      using _Base::get_allocator;\n\n      hash_map() { }\n\n      explicit hash_map(size_type __n) : _Base(__n) { }\n\n      hash_map(size_type __n, const hasher& __hf) : _Base(__n, __hf) { }\n\n      hash_map(size_type __n, const hasher& __hf, const key_equal& __eql,\n\t       const allocator_type& __a = allocator_type())\n      : _Base(__n, __hf, __eql, __a) { }\n\n      template<typename _InputIterator>\n        hash_map(_InputIterator __f, _InputIterator __l)\n        : _Base(__gnu_debug::__check_valid_range(__f, __l), __l) { }\n\n      template<typename _InputIterator>\n        hash_map(_InputIterator __f, _InputIterator __l, size_type __n)\n\t: _Base(__gnu_debug::__check_valid_range(__f, __l), __l, __n) { }\n\n      template<typename _InputIterator>\n        hash_map(_InputIterator __f, _InputIterator __l, size_type __n,\n\t\t const hasher& __hf)\n        : _Base(__gnu_debug::__check_valid_range(__f, __l), __l, __n, __hf) { }\n\n      template<typename _InputIterator>\n        hash_map(_InputIterator __f, _InputIterator __l, size_type __n,\n\t\t const hasher& __hf, const key_equal& __eql,\n\t\t const allocator_type& __a = allocator_type())\n\t: _Base(__gnu_debug::__check_valid_range(__f, __l), __l, __n, __hf,\n\t\t__eql, __a) { }\n\n      hash_map(const _Base& __x) : _Base(__x), _Safe_base() { }\n\n      using _Base::size;\n      using _Base::max_size;\n      using _Base::empty;\n\n      void\n      swap(hash_map& __x)\n      {\n\t_Base::swap(__x);\n\tthis->_M_swap(__x);\n      }\n\n      iterator\n      begin() { return iterator(_Base::begin(), this); }\n\n      iterator\n      end() { return iterator(_Base::end(),   this); }\n\n      const_iterator\n      begin() const\n      { return const_iterator(_Base::begin(), this); }\n\n      const_iterator\n      end() const\n      { return const_iterator(_Base::end(),   this); }\n\n      std::pair<iterator, bool>\n      insert(const value_type& __obj)\n      {\n\tstd::pair<typename _Base::iterator, bool> __res = _Base::insert(__obj);\n\treturn std::make_pair(iterator(__res.first, this), __res.second);\n      }\n\n      void\n      insert(const value_type* __first, const value_type* __last)\n      {\n\t__glibcxx_check_valid_range(__first, __last);\n\t_Base::insert(__first, __last);\n      }\n\n     template<typename _InputIterator>\n        void\n        insert(_InputIterator __first, _InputIterator __last)\n        {\n\t  __glibcxx_check_valid_range(__first, __last);\n\t  _Base::insert(__first.base(), __last.base());\n\t}\n\n\n      std::pair<iterator, bool>\n      insert_noresize(const value_type& __obj)\n      {\n\tstd::pair<typename _Base::iterator, bool> __res =\n\t                                        _Base::insert_noresize(__obj);\n\treturn std::make_pair(iterator(__res.first, this), __res.second);\n      }\n\n      iterator\n      find(const key_type& __key)\n      { return iterator(_Base::find(__key), this); }\n\n      const_iterator\n      find(const key_type& __key) const\n      { return const_iterator(_Base::find(__key), this); }\n\n      using _Base::operator[];\n      using _Base::count;\n\n      std::pair<iterator, iterator>\n      equal_range(const key_type& __key)\n      {\n\ttypedef typename _Base::iterator _Base_iterator;\n\tstd::pair<_Base_iterator, _Base_iterator> __res =\n\t                  _Base::equal_range(__key);\n\treturn std::make_pair(iterator(__res.first, this),\n\t\t\t      iterator(__res.second, this));\n      }\n\n      std::pair<const_iterator, const_iterator>\n      equal_range(const key_type& __key) const\n      {\n\ttypedef typename _Base::const_iterator _Base_iterator;\n\tstd::pair<_Base_iterator, _Base_iterator> __res =\n\t_Base::equal_range(__key);\n\treturn std::make_pair(const_iterator(__res.first, this),\n\t\t\t      const_iterator(__res.second, this));\n      }\n\n      size_type\n      erase(const key_type& __key)\n      {\n\titerator __victim(_Base::find(__key), this);\n\tif (__victim != end())\n\t  return this->erase(__victim), 1;\n\telse\n\t  return 0;\n      }\n\n      void\n      erase(iterator __it)\n      {\n\t__glibcxx_check_erase(__it);\n\t__it._M_invalidate();\n\t_Base::erase(__it.base());\n      }\n\n      void\n      erase(iterator __first, iterator __last)\n      {\n\t__glibcxx_check_erase_range(__first, __last);\n\tfor (iterator __tmp = __first; __tmp != __last;)\n\t{\n\t  iterator __victim = __tmp++;\n\t  __victim._M_invalidate();\n\t}\n\t_Base::erase(__first.base(), __last.base());\n      }\n\n      void\n      clear()\n      {\n\t_Base::clear();\n\tthis->_M_invalidate_all();\n      }\n\n      using _Base::resize;\n      using _Base::bucket_count;\n      using _Base::max_bucket_count;\n      using _Base::elems_in_bucket;\n\n      _Base&\n      _M_base()       { return *this; }\n\n      const _Base&\n      _M_base() const { return *this; }\n\n    private:\n      void\n      _M_invalidate_all()\n      {\n\ttypedef typename _Base::const_iterator _Base_const_iterator;\n\ttypedef __gnu_debug::_Not_equal_to<_Base_const_iterator> _Not_equal;\n\tthis->_M_invalidate_if(_Not_equal(_M_base().end()));\n      }\n    };\n\n  template<typename _Value, typename _Tp, typename _HashFcn,\n\t   typename _EqualKey, typename _Alloc>\n    inline bool\n    operator==(const hash_map<_Value, _Tp, _HashFcn, _EqualKey, _Alloc>& __x,\n\t       const hash_map<_Value, _Tp, _HashFcn, _EqualKey, _Alloc>& __y)\n    { return __x._M_base() == __y._M_base(); }\n\n  template<typename _Value, typename _Tp, typename _HashFcn,\n\t   typename _EqualKey, typename _Alloc>\n    inline bool\n    operator!=(const hash_map<_Value, _Tp, _HashFcn, _EqualKey, _Alloc>& __x,\n\t       const hash_map<_Value, _Tp, _HashFcn, _EqualKey, _Alloc>& __y)\n    { return __x._M_base() != __y._M_base(); }\n\n  template<typename _Value, typename _Tp, typename _HashFcn,\n\t   typename _EqualKey, typename _Alloc>\n    inline void\n    swap(hash_map<_Value, _Tp, _HashFcn, _EqualKey, _Alloc>& __x,\n\t hash_map<_Value, _Tp, _HashFcn, _EqualKey, _Alloc>& __y)\n    { __x.swap(__y); }\n} // namespace __debug\n} // namespace __gnu_cxx\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/debug/hash_multimap.h",
    "content": "// Debugging hash_multimap implementation -*- C++ -*-\n\n// Copyright (C) 2003, 2005, 2006\n// Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n/** @file debug/hash_multimap.h\n *  This file is a GNU debug extension to the Standard C++ Library.\n */\n\n#ifndef _GLIBCXX_DEBUG_HASH_MULTIMAP_H\n#define _GLIBCXX_DEBUG_HASH_MULTIMAP_H 1\n\n#include <debug/safe_sequence.h>\n#include <debug/safe_iterator.h>\n\nnamespace __gnu_cxx\n{\nnamespace __debug\n{\n  template<typename _Value, typename _Tp,\n\t   typename _HashFcn  = __gnu_cxx::hash<_Value>,\n\t   typename _EqualKey = std::equal_to<_Value>,\n\t   typename _Alloc =  std::allocator<_Value> >\n    class hash_multimap\n    : public _GLIBCXX_EXT::hash_multimap<_Value,_Tp,_HashFcn,_EqualKey,_Alloc>,\n      public __gnu_debug::_Safe_sequence<hash_multimap<_Value, _Tp, _HashFcn,\n\t\t\t\t\t\t       _EqualKey, _Alloc> >\n    {\n      typedef _GLIBCXX_EXT::hash_multimap<_Value,_Tp,_HashFcn,_EqualKey,_Alloc>\n\t\t\t\t\t\t\t_Base;\n      typedef __gnu_debug::_Safe_sequence<hash_multimap> _Safe_base;\n\n  public:\n      typedef typename _Base::key_type\t\t\tkey_type;\n      typedef typename _Base::data_type\t\t\tdata_type;\n      typedef typename _Base::mapped_type\t\tmapped_type;\n      typedef typename _Base::value_type\t\tvalue_type;\n      typedef typename _Base::hasher\t\t\thasher;\n      typedef typename _Base::key_equal\t\t\tkey_equal;\n      typedef typename _Base::size_type\t\t\tsize_type;\n      typedef typename _Base::difference_type\t\tdifference_type;\n      typedef typename _Base::pointer\t\t\tpointer;\n      typedef typename _Base::const_pointer\t\tconst_pointer;\n      typedef typename _Base::reference\t\t\treference;\n      typedef typename _Base::const_reference\t\tconst_reference;\n\n      typedef __gnu_debug::_Safe_iterator<typename _Base::iterator,\n\t\t\t\t\t  hash_multimap> iterator;\n      typedef __gnu_debug::_Safe_iterator<typename _Base::const_iterator,\n\t\t\t\t\t  hash_multimap> const_iterator;\n\n      typedef typename _Base::allocator_type              allocator_type;\n\n      using _Base::hash_funct;\n      using _Base::key_eq;\n      using _Base::get_allocator;\n\n      hash_multimap() { }\n\n      explicit hash_multimap(size_type __n) : _Base(__n) { }\n\n      hash_multimap(size_type __n, const hasher& __hf) : _Base(__n, __hf) { }\n\n      hash_multimap(size_type __n, const hasher& __hf, const key_equal& __eql,\n\t\t    const allocator_type& __a = allocator_type())\n      : _Base(__n, __hf, __eql, __a) { }\n\n      template<typename _InputIterator>\n        hash_multimap(_InputIterator __f, _InputIterator __l)\n\t: _Base(__gnu_debug::__check_valid_range(__f, __l), __l) { }\n\n      template<typename _InputIterator>\n        hash_multimap(_InputIterator __f, _InputIterator __l, size_type __n)\n        : _Base(__gnu_debug::__check_valid_range(__f, __l), __l, __n) { }\n\n      template<typename _InputIterator>\n        hash_multimap(_InputIterator __f, _InputIterator __l, size_type __n,\n\t\t      const hasher& __hf)\n\t: _Base(__gnu_debug::__check_valid_range(__f, __l), __l, __n, __hf) { }\n\n      template<typename _InputIterator>\n        hash_multimap(_InputIterator __f, _InputIterator __l, size_type __n,\n\t\t      const hasher& __hf, const key_equal& __eql,\n\t\t      const allocator_type& __a = allocator_type())\n\t: _Base(__gnu_debug::__check_valid_range(__f, __l), __l, __n, __hf,\n\t\t__eql, __a) { }\n\n      using _Base::size;\n      using _Base::max_size;\n      using _Base::empty;\n\n      void\n      swap(hash_multimap& __x)\n      {\n\t_Base::swap(__x);\n\tthis->_M_swap(__x);\n      }\n\n      iterator\n      begin() { return iterator(_Base::begin(), this); }\n\n      iterator\n      end()   { return iterator(_Base::end(),   this); }\n\n      const_iterator\n      begin() const\n      { return const_iterator(_Base::begin(), this); }\n\n      const_iterator\n      end() const\n      { return const_iterator(_Base::end(),   this); }\n\n      iterator\n      insert(const value_type& __obj)\n      { return iterator(_Base::insert(__obj), this); }\n\n      template <typename _InputIterator>\n        void\n        insert(_InputIterator __first, _InputIterator __last)\n        {\n\t  __glibcxx_check_valid_range(__first, __last);\n\t  _Base::insert(__first.base(), __last.base());\n\t}\n\n      iterator\n      insert_noresize(const value_type& __obj)\n      { return iterator(_Base::insert_noresize(__obj), this); }\n\n      iterator\n      find(const key_type& __key)\n      { return iterator(_Base::find(__key), this); }\n\n      const_iterator\n      find(const key_type& __key) const\n      { return const_iterator(_Base::find(__key), this); }\n\n      using _Base::count;\n\n      std::pair<iterator, iterator>\n      equal_range(const key_type& __key)\n      {\n\ttypedef typename _Base::iterator _Base_iterator;\n\tstd::pair<_Base_iterator, _Base_iterator> __res =\n\t                                             _Base::equal_range(__key);\n\treturn std::make_pair(iterator(__res.first, this),\n\t\t\t      iterator(__res.second, this));\n      }\n\n      std::pair<const_iterator, const_iterator>\n      equal_range(const key_type& __key) const\n      {\n\ttypedef typename _Base::const_iterator _Base_iterator;\n\tstd::pair<_Base_iterator, _Base_iterator> __res =\n        _Base::equal_range(__key);\n\treturn std::make_pair(const_iterator(__res.first, this),\n\t\t\t      const_iterator(__res.second, this));\n      }\n\n      size_type\n      erase(const key_type& __key)\n      {\n\tstd::pair<iterator, iterator> __victims = this->equal_range(__key);\n\tstd::size_t __num_victims = 0;\n\twhile (__victims.first != __victims.second)\n\t{\n\t  this->erase(__victims.first++);\n\t  ++__num_victims;\n\t}\n\treturn __num_victims;\n      }\n\n      void\n      erase(iterator __it)\n      {\n\t__glibcxx_check_erase(__it);\n\t__it._M_invalidate();\n\t_Base::erase(__it.base());\n      }\n\n      void\n      erase(iterator __first, iterator __last)\n      {\n\t__glibcxx_check_erase_range(__first, __last);\n\tfor (iterator __tmp = __first; __tmp != __last;)\n\t{\n\t  iterator __victim = __tmp++;\n\t  __victim._M_invalidate();\n\t}\n\t_Base::erase(__first.base(), __last.base());\n      }\n\n      void\n      clear()\n      {\n\t_Base::clear();\n\tthis->_M_invalidate_all();\n      }\n\n      using _Base::resize;\n      using _Base::bucket_count;\n      using _Base::max_bucket_count;\n      using _Base::elems_in_bucket;\n\n      _Base&\n      _M_base()       { return *this; }\n\n      const _Base&\n      _M_base() const { return *this; }\n\n    private:\n      void\n      _M_invalidate_all()\n      {\n\ttypedef typename _Base::const_iterator _Base_const_iterator;\n\ttypedef __gnu_debug::_Not_equal_to<_Base_const_iterator> _Not_equal;\n\tthis->_M_invalidate_if(_Not_equal(_M_base().end()));\n      }\n    };\n\n  template<typename _Value, typename _Tp, typename _HashFcn,\n\t   typename _EqualKey, typename _Alloc>\n    inline bool\n    operator==(const hash_multimap<_Value,_Tp,_HashFcn,_EqualKey,_Alloc>& __x,\n\t       const hash_multimap<_Value,_Tp,_HashFcn,_EqualKey,_Alloc>& __y)\n    { return __x._M_base() == __y._M_base(); }\n\n  template<typename _Value, typename _Tp, typename _HashFcn,\n\t   typename _EqualKey, typename _Alloc>\n    inline bool\n    operator!=(const hash_multimap<_Value,_Tp,_HashFcn,_EqualKey,_Alloc>& __x,\n\t       const hash_multimap<_Value,_Tp,_HashFcn,_EqualKey,_Alloc>& __y)\n    { return __x._M_base() != __y._M_base(); }\n\n  template<typename _Value, typename _Tp, typename _HashFcn,\n\t   typename _EqualKey, typename _Alloc>\n    inline void\n    swap(hash_multimap<_Value, _Tp, _HashFcn, _EqualKey, _Alloc>& __x,\n\t hash_multimap<_Value, _Tp, _HashFcn, _EqualKey, _Alloc>& __y)\n    { __x.swap(__y); }\n} // namespace __debug\n} // namespace __gnu_cxx\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/debug/hash_multiset.h",
    "content": "// Debugging hash_multiset implementation -*- C++ -*-\n\n// Copyright (C) 2003, 2005, 2006\n// Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n/** @file debug/hash_multiset.h\n *  This file is a GNU debug extension to the Standard C++ Library.\n */\n\n#ifndef _GLIBCXX_DEBUG_HASH_MULTISET_H\n#define _GLIBCXX_DEBUG_HASH_MULTISET_H 1\n\n#include <debug/safe_sequence.h>\n#include <debug/safe_iterator.h>\n\nnamespace __gnu_cxx\n{\nnamespace __debug\n{\n  template<typename _Value,\n\t   typename _HashFcn  = __gnu_cxx::hash<_Value>,\n\t   typename _EqualKey = std::equal_to<_Value>,\n\t   typename _Alloc =  std::allocator<_Value> >\n    class hash_multiset\n    : public _GLIBCXX_EXT::hash_multiset<_Value, _HashFcn, _EqualKey, _Alloc>,\n      public __gnu_debug::_Safe_sequence<hash_multiset<_Value, _HashFcn,\n\t\t\t\t\t\t       _EqualKey, _Alloc> >\n    {\n      typedef _GLIBCXX_EXT:: hash_multiset<_Value,_HashFcn, _EqualKey,_Alloc>\n\t\t\t\t\t\t\t_Base;\n      typedef __gnu_debug::_Safe_sequence<hash_multiset> _Safe_base;\n\n  public:\n    typedef typename _Base::key_type\t\t\tkey_type;\n    typedef typename _Base::value_type\t\t\tvalue_type;\n    typedef typename _Base::hasher\t\t\thasher;\n    typedef typename _Base::key_equal\t\t\tkey_equal;\n    typedef typename _Base::size_type\t\t\tsize_type;\n    typedef typename _Base::difference_type\t\tdifference_type;\n    typedef typename _Base::pointer\t\t\tpointer;\n    typedef typename _Base::const_pointer\t\tconst_pointer;\n    typedef typename _Base::reference\t\t\treference;\n    typedef typename _Base::const_reference\t\tconst_reference;\n\n    typedef __gnu_debug::_Safe_iterator<typename _Base::iterator,\n\t\t\t\t\t hash_multiset> iterator;\n    typedef __gnu_debug::_Safe_iterator<typename _Base::const_iterator,\n\t\t\t\t\t hash_multiset> const_iterator;\n\n    typedef typename _Base::allocator_type              allocator_type;\n\n    using _Base::hash_funct;\n    using _Base::key_eq;\n    using _Base::get_allocator;\n\n    hash_multiset() { }\n\n    explicit hash_multiset(size_type __n) : _Base(__n) { }\n\n    hash_multiset(size_type __n, const hasher& __hf) : _Base(__n, __hf) { }\n\n    hash_multiset(size_type __n, const hasher& __hf, const key_equal& __eql,\n\t\t  const allocator_type& __a = allocator_type())\n    : _Base(__n, __hf, __eql, __a)\n    { }\n\n    template<typename _InputIterator>\n      hash_multiset(_InputIterator __f, _InputIterator __l)\n      : _Base(__gnu_debug::__check_valid_range(__f, __l), __l)\n      { }\n\n    template<typename _InputIterator>\n      hash_multiset(_InputIterator __f, _InputIterator __l, size_type __n)\n      : _Base(__gnu_debug::__check_valid_range(__f, __l), __l, __n)\n      { }\n\n    template<typename _InputIterator>\n      hash_multiset(_InputIterator __f, _InputIterator __l, size_type __n,\n\t\t    const hasher& __hf)\n      : _Base(__gnu_debug::__check_valid_range(__f, __l), __l, __n, __hf)\n      { }\n\n    template<typename _InputIterator>\n      hash_multiset(_InputIterator __f, _InputIterator __l, size_type __n,\n\t\t    const hasher& __hf, const key_equal& __eql,\n\t\t    const allocator_type& __a = allocator_type())\n      : _Base(__gnu_debug::__check_valid_range(__f, __l), __l, __n, __hf,\n\t      __eql, __a)\n      { }\n\n    hash_multiset(const _Base& __x) : _Base(__x), _Safe_base() { }\n\n    using _Base::size;\n    using _Base::max_size;\n    using _Base::empty;\n\n    void\n    swap(hash_multiset& __x)\n    {\n      _Base::swap(__x);\n      this->_M_swap(__x);\n    }\n\n    iterator begin() const { return iterator(_Base::begin(), this); }\n    iterator end() const   { return iterator(_Base::end(),   this); }\n\n    iterator\n    insert(const value_type& __obj)\n    { return iterator(_Base::insert(__obj), this); }\n\n    template <typename _InputIterator>\n      void\n      insert(_InputIterator __first, _InputIterator __last)\n      {\n\t__glibcxx_check_valid_range(__first, __last);\n\t_Base::insert(__first.base(), __last.base());\n      }\n\n\n    iterator\n    insert_noresize(const value_type& __obj)\n    { return iterator(_Base::insert_noresize(__obj), this); }\n\n    iterator\n    find(const key_type& __key) const\n    { return iterator(_Base::find(__key), this); }\n\n    using _Base::count;\n\n    std::pair<iterator, iterator>\n    equal_range(const key_type& __key) const\n    {\n      typedef typename _Base::iterator _Base_iterator;\n      std::pair<_Base_iterator, _Base_iterator> __res =\n\t_Base::equal_range(__key);\n      return std::make_pair(iterator(__res.first, this),\n\t\t\t    iterator(__res.second, this));\n    }\n\n    size_type\n    erase(const key_type& __key)\n    {\n      size_type __count = 0;\n      std::pair<iterator, iterator> __victims = this->equal_range(__key);\n      while (__victims.first != __victims.second)\n\t{\n\t  this->erase(__victims++);\n\t  ++__count;\n\t}\n      return __count;\n    }\n\n    void\n    erase(iterator __it)\n    {\n      __glibcxx_check_erase(__it);\n      __it._M_invalidate();\n      _Base::erase(__it.base());\n    }\n\n    void\n    erase(iterator __first, iterator __last)\n    {\n      __glibcxx_check_erase_range(__first, __last);\n      for (iterator __tmp = __first; __tmp != __last;)\n\t{\n\t  iterator __victim = __tmp++;\n\t  __victim._M_invalidate();\n\t}\n      _Base::erase(__first.base(), __last.base());\n    }\n\n    void\n    clear()\n    {\n      _Base::clear();\n      this->_M_invalidate_all();\n    }\n\n    using _Base::resize;\n    using _Base::bucket_count;\n    using _Base::max_bucket_count;\n    using _Base::elems_in_bucket;\n\n    _Base&       _M_base()       { return *this; }\n    const _Base& _M_base() const { return *this; }\n\n  private:\n    void\n    _M_invalidate_all()\n    {\n      typedef typename _Base::const_iterator _Base_const_iterator;\n      typedef __gnu_debug::_Not_equal_to<_Base_const_iterator> _Not_equal;\n      this->_M_invalidate_if(_Not_equal(_M_base().end()));\n    }\n  };\n\ntemplate<typename _Value, typename _HashFcn, typename _EqualKey, typename _Alloc>\n  inline bool\n  operator==(const hash_multiset<_Value, _HashFcn, _EqualKey, _Alloc>& __x,\n\t     const hash_multiset<_Value, _HashFcn, _EqualKey, _Alloc>& __y)\n  { return __x._M_base() == __y._M_base(); }\n\ntemplate<typename _Value, typename _HashFcn, typename _EqualKey, typename _Alloc>\n  inline bool\n  operator!=(const hash_multiset<_Value, _HashFcn, _EqualKey, _Alloc>& __x,\n\t     const hash_multiset<_Value, _HashFcn, _EqualKey, _Alloc>& __y)\n  { return __x._M_base() != __y._M_base(); }\n\ntemplate<typename _Value, typename _HashFcn, typename _EqualKey, typename _Alloc>\n  inline void\n  swap(hash_multiset<_Value, _HashFcn, _EqualKey, _Alloc>& __x,\n       hash_multiset<_Value, _HashFcn, _EqualKey, _Alloc>& __y)\n  { __x.swap(__y); }\n} // namespace __debug\n} // namespace __gnu_cxx\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/debug/hash_set",
    "content": "// Debugging hash_set/hash_multiset implementation -*- C++ -*-\n\n// Copyright (C) 2003, 2005\n// Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n/** @file debug/hash_set\n *  This file is a GNU debug extension to the Standard C++ Library.\n */\n\n#ifndef _GLIBCXX_DEBUG_HASH_SET\n#define _GLIBCXX_DEBUG_HASH_SET 1\n\n#include <ext/hash_set>\n#include <debug/hash_set.h>\n#include <debug/hash_multiset.h>\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/debug/hash_set.h",
    "content": "// Debugging hash_set implementation -*- C++ -*-\n\n// Copyright (C) 2003, 2005, 2006\n// Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n/** @file debug/hash_set.h\n *  This file is a GNU debug extension to the Standard C++ Library.\n */\n\n#ifndef _GLIBCXX_DEBUG_HASH_SET_H\n#define _GLIBCXX_DEBUG_HASH_SET_H 1\n\n#include <debug/safe_sequence.h>\n#include <debug/safe_iterator.h>\n\nnamespace __gnu_cxx\n{\nnamespace __debug\n{\n  template<typename _Value,\n\t   typename _HashFcn  = __gnu_cxx::hash<_Value>,\n\t   typename _EqualKey = std::equal_to<_Value>,\n\t   typename _Alloc =  std::allocator<_Value> >\n    class hash_set\n    : public _GLIBCXX_EXT::hash_set<_Value, _HashFcn, _EqualKey,_Alloc>,\n      public __gnu_debug::_Safe_sequence<hash_set<_Value, _HashFcn, _EqualKey,\n\t\t\t\t\t\t  _Alloc> >\n    {\n      typedef _GLIBCXX_EXT::hash_set<_Value, _HashFcn, _EqualKey,_Alloc> _Base;\n      typedef __gnu_debug::_Safe_sequence<hash_set> _Safe_base;\n\n    public:\n      typedef typename _Base::key_type        key_type;\n      typedef typename _Base::value_type      value_type;\n      typedef typename _Base::hasher          hasher;\n      typedef typename _Base::key_equal       key_equal;\n      typedef typename _Base::size_type       size_type;\n      typedef typename _Base::difference_type difference_type;\n      typedef typename _Base::pointer         pointer;\n      typedef typename _Base::const_pointer   const_pointer;\n      typedef typename _Base::reference       reference;\n      typedef typename _Base::const_reference const_reference;\n\n      typedef __gnu_debug::_Safe_iterator<typename _Base::iterator, hash_set>\n                                              iterator;\n      typedef __gnu_debug::_Safe_iterator<typename _Base::const_iterator,\n\t\t\t\t\t  hash_set>\n                                              const_iterator;\n\n      typedef typename _Base::allocator_type allocator_type;\n\n      using _Base::hash_funct;\n      using _Base::key_eq;\n      using _Base::get_allocator;\n\n      hash_set() { }\n\n      explicit hash_set(size_type __n) : _Base(__n) { }\n\n      hash_set(size_type __n, const hasher& __hf) : _Base(__n, __hf) { }\n\n      hash_set(size_type __n, const hasher& __hf, const key_equal& __eql,\n\t       const allocator_type& __a = allocator_type())\n      : _Base(__n, __hf, __eql, __a) { }\n\n      template<typename _InputIterator>\n        hash_set(_InputIterator __f, _InputIterator __l)\n        : _Base(__gnu_debug::__check_valid_range(__f, __l), __l) { }\n\n      template<typename _InputIterator>\n        hash_set(_InputIterator __f, _InputIterator __l, size_type __n)\n\t: _Base(__gnu_debug::__check_valid_range(__f, __l), __l, __n) { }\n\n      template<typename _InputIterator>\n        hash_set(_InputIterator __f, _InputIterator __l, size_type __n,\n\t\t const hasher& __hf)\n\t: _Base(__gnu_debug::__check_valid_range(__f, __l), __l, __n, __hf) { }\n\n      template<typename _InputIterator>\n        hash_set(_InputIterator __f, _InputIterator __l, size_type __n,\n\t\t const hasher& __hf, const key_equal& __eql,\n\t\t const allocator_type& __a = allocator_type())\n\t: _Base(__gnu_debug::__check_valid_range(__f, __l), __l, __n, __hf,\n\t\t__eql, __a) { }\n\n      hash_set(const _Base& __x) : _Base(__x), _Safe_base() { }\n\n      using _Base::size;\n      using _Base::max_size;\n      using _Base::empty;\n\n      void\n      swap(hash_set& __x)\n      {\n\t_Base::swap(__x);\n\tthis->_M_swap(__x);\n      }\n\n      iterator\n      begin() const { return iterator(_Base::begin(), this); }\n\n      iterator\n      end() const   { return iterator(_Base::end(),   this); }\n\n      std::pair<iterator, bool>\n      insert(const value_type& __obj)\n      {\n\tstd::pair<typename _Base::iterator, bool> __res =\n        _Base::insert(__obj);\n\treturn std::make_pair(iterator(__res.first, this), __res.second);\n      }\n\n      void\n      insert(const value_type* __first, const value_type* __last)\n      {\n\t__glibcxx_check_valid_range(__first, __last);\n\t_Base::insert(__first, __last);\n      }\n\n      template<typename _InputIterator>\n        void\n        insert(_InputIterator __first, _InputIterator __last)\n        {\n\t  __glibcxx_check_valid_range(__first, __last);\n\t  _Base::insert(__first.base(), __last.base());\n\t}\n\n\n      std::pair<iterator, bool>\n      insert_noresize(const value_type& __obj)\n      {\n\tstd::pair<typename _Base::iterator, bool> __res =\n        _Base::insert_noresize(__obj);\n\treturn std::make_pair(iterator(__res.first, this), __res.second);\n      }\n\n      iterator\n      find(const key_type& __key) const\n      { return iterator(_Base::find(__key), this); }\n\n      using _Base::count;\n\n      std::pair<iterator, iterator>\n      equal_range(const key_type& __key) const\n      {\n\ttypedef typename _Base::iterator _Base_iterator;\n\tstd::pair<_Base_iterator, _Base_iterator> __res =\n\t  _Base::equal_range(__key);\n\treturn std::make_pair(iterator(__res.first, this),\n\t\t\t      iterator(__res.second, this));\n      }\n\n      size_type\n      erase(const key_type& __key)\n      {\n\titerator __victim(_Base::find(__key), this);\n\tif (__victim != end())\n\t  return this->erase(__victim), 1;\n\telse\n\t  return 0;\n      }\n\n      void\n      erase(iterator __it)\n      {\n\t__glibcxx_check_erase(__it);\n\t__it._M_invalidate();\n\t_Base::erase(__it.base());\n      }\n\n      void\n      erase(iterator __first, iterator __last)\n      {\n\t__glibcxx_check_erase_range(__first, __last);\n\tfor (iterator __tmp = __first; __tmp != __last;)\n\t{\n\t  iterator __victim = __tmp++;\n\t  __victim._M_invalidate();\n\t}\n\t_Base::erase(__first.base(), __last.base());\n      }\n\n      void\n      clear()\n      {\n\t_Base::clear();\n\tthis->_M_invalidate_all();\n      }\n\n      using _Base::resize;\n      using _Base::bucket_count;\n      using _Base::max_bucket_count;\n      using _Base::elems_in_bucket;\n\n      _Base&\n      _M_base()       { return *this; }\n\n      const _Base&\n      _M_base() const { return *this; }\n\n    private:\n      void\n      _M_invalidate_all()\n      {\n\ttypedef typename _Base::const_iterator _Base_const_iterator;\n\ttypedef __gnu_debug::_Not_equal_to<_Base_const_iterator> _Not_equal;\n\tthis->_M_invalidate_if(_Not_equal(_M_base().end()));\n      }\n    };\n\n  template<typename _Value, typename _HashFcn, typename _EqualKey,\n\t   typename _Alloc>\n    inline bool\n    operator==(const hash_set<_Value, _HashFcn, _EqualKey, _Alloc>& __x,\n\t       const hash_set<_Value, _HashFcn, _EqualKey, _Alloc>& __y)\n    { return __x._M_base() == __y._M_base(); }\n\n  template<typename _Value, typename _HashFcn, typename _EqualKey,\n\t   typename _Alloc>\n    inline bool\n    operator!=(const hash_set<_Value, _HashFcn, _EqualKey, _Alloc>& __x,\n\t       const hash_set<_Value, _HashFcn, _EqualKey, _Alloc>& __y)\n    { return __x._M_base() != __y._M_base(); }\n\n  template<typename _Value, typename _HashFcn, typename _EqualKey,\n\t   typename _Alloc>\n    inline void\n    swap(hash_set<_Value, _HashFcn, _EqualKey, _Alloc>& __x,\n\t hash_set<_Value, _HashFcn, _EqualKey, _Alloc>& __y)\n    { __x.swap(__y); }\n} // namespace __debug\n} // namespace __gnu_cxx\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/debug/list",
    "content": "// Debugging list implementation -*- C++ -*-\n\n// Copyright (C) 2003, 2004, 2005, 2006\n// Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n// Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n/** @file debug/list\n *  This file is a GNU debug extension to the Standard C++ Library.\n */\n\n#ifndef _GLIBCXX_DEBUG_LIST\n#define _GLIBCXX_DEBUG_LIST 1\n\n#include <list>\n#include <bits/stl_algo.h>\n#include <debug/safe_sequence.h>\n#include <debug/safe_iterator.h>\n\nnamespace std\n{\nnamespace __debug\n{\n  template<typename _Tp, typename _Allocator = std::allocator<_Tp> >\n    class list\n    : public _GLIBCXX_STD::list<_Tp, _Allocator>,\n      public __gnu_debug::_Safe_sequence<list<_Tp, _Allocator> >\n    {\n      typedef _GLIBCXX_STD::list<_Tp, _Allocator> _Base;\n      typedef __gnu_debug::_Safe_sequence<list>  _Safe_base;\n\n    public:\n      typedef typename _Base::reference             reference;\n      typedef typename _Base::const_reference       const_reference;\n\n      typedef __gnu_debug::_Safe_iterator<typename _Base::iterator, list>\n\t\t\t\t\t\t    iterator;\n      typedef __gnu_debug::_Safe_iterator<typename _Base::const_iterator, list>\n\t\t\t\t\t\t    const_iterator;\n\n      typedef typename _Base::size_type             size_type;\n      typedef typename _Base::difference_type       difference_type;\n\n      typedef _Tp\t\t\t\t    value_type;\n      typedef _Allocator\t\t\t    allocator_type;\n      typedef typename _Base::pointer               pointer;\n      typedef typename _Base::const_pointer         const_pointer;\n      typedef std::reverse_iterator<iterator>       reverse_iterator;\n      typedef std::reverse_iterator<const_iterator> const_reverse_iterator;\n\n      // 23.2.2.1 construct/copy/destroy:\n      explicit list(const _Allocator& __a = _Allocator())\n      : _Base(__a) { }\n\n      explicit list(size_type __n, const _Tp& __value = _Tp(),\n\t\t    const _Allocator& __a = _Allocator())\n      : _Base(__n, __value, __a) { }\n\n      template<class _InputIterator>\n      list(_InputIterator __first, _InputIterator __last,\n\t   const _Allocator& __a = _Allocator())\n      : _Base(__gnu_debug::__check_valid_range(__first, __last), __last, __a)\n      { }\n\n\n      list(const list& __x) : _Base(__x), _Safe_base() { }\n\n      list(const _Base& __x) : _Base(__x), _Safe_base() { }\n\n      ~list() { }\n\n      list&\n      operator=(const list& __x)\n      {\n\tstatic_cast<_Base&>(*this) = __x;\n\tthis->_M_invalidate_all();\n\treturn *this;\n      }\n\n      template<class _InputIterator>\n        void\n        assign(_InputIterator __first, _InputIterator __last)\n        {\n\t  __glibcxx_check_valid_range(__first, __last);\n\t  _Base::assign(__first, __last);\n\t  this->_M_invalidate_all();\n\t}\n\n      void\n      assign(size_type __n, const _Tp& __t)\n      {\n\t_Base::assign(__n, __t);\n\tthis->_M_invalidate_all();\n      }\n\n      using _Base::get_allocator;\n\n      // iterators:\n      iterator\n      begin()\n      { return iterator(_Base::begin(), this); }\n\n      const_iterator\n      begin() const\n      { return const_iterator(_Base::begin(), this); }\n\n      iterator\n      end()\n      { return iterator(_Base::end(), this); }\n\n      const_iterator\n      end() const\n      { return const_iterator(_Base::end(), this); }\n\n      reverse_iterator\n      rbegin()\n      { return reverse_iterator(end()); }\n\n      const_reverse_iterator\n      rbegin() const\n      { return const_reverse_iterator(end()); }\n\n      reverse_iterator\n      rend()\n      { return reverse_iterator(begin()); }\n\n      const_reverse_iterator\n      rend() const\n      { return const_reverse_iterator(begin()); }\n\n      // 23.2.2.2 capacity:\n      using _Base::empty;\n      using _Base::size;\n      using _Base::max_size;\n\n      void\n      resize(size_type __sz, _Tp __c = _Tp())\n      {\n\tthis->_M_detach_singular();\n\n\t// if __sz < size(), invalidate all iterators in [begin+__sz, end())\n\titerator __victim = begin();\n\titerator __end = end();\n\tfor (size_type __i = __sz; __victim != __end && __i > 0; --__i)\n\t  ++__victim;\n\n\twhile (__victim != __end)\n\t  {\n\t    iterator __real_victim = __victim++;\n\t    __real_victim._M_invalidate();\n\t  }\n\n\ttry\n\t  {\n\t    _Base::resize(__sz, __c);\n\t  }\n\tcatch(...)\n\t  {\n\t    this->_M_revalidate_singular();\n\t    __throw_exception_again;\n\t  }\n      }\n\n      // element access:\n      reference\n      front()\n      {\n\t__glibcxx_check_nonempty();\n\treturn _Base::front();\n      }\n\n      const_reference\n      front() const\n      {\n\t__glibcxx_check_nonempty();\n\treturn _Base::front();\n      }\n\n      reference\n      back()\n      {\n\t__glibcxx_check_nonempty();\n\treturn _Base::back();\n      }\n\n      const_reference\n      back() const\n      {\n\t__glibcxx_check_nonempty();\n\treturn _Base::back();\n      }\n\n      // 23.2.2.3 modifiers:\n      using _Base::push_front;\n\n      void\n      pop_front()\n      {\n\t__glibcxx_check_nonempty();\n\titerator __victim = begin();\n\t__victim._M_invalidate();\n\t_Base::pop_front();\n      }\n\n      using _Base::push_back;\n\n      void\n      pop_back()\n      {\n\t__glibcxx_check_nonempty();\n\titerator __victim = end();\n\t--__victim;\n\t__victim._M_invalidate();\n\t_Base::pop_back();\n      }\n\n      iterator\n      insert(iterator __position, const _Tp& __x)\n      {\n\t__glibcxx_check_insert(__position);\n\treturn iterator(_Base::insert(__position.base(), __x), this);\n      }\n\n      void\n      insert(iterator __position, size_type __n, const _Tp& __x)\n      {\n\t__glibcxx_check_insert(__position);\n\t_Base::insert(__position.base(), __n, __x);\n      }\n\n      template<class _InputIterator>\n        void\n        insert(iterator __position, _InputIterator __first,\n\t       _InputIterator __last)\n        {\n\t  __glibcxx_check_insert_range(__position, __first, __last);\n\t  _Base::insert(__position.base(), __first, __last);\n\t}\n\n      iterator\n      erase(iterator __position)\n      {\n\t__glibcxx_check_erase(__position);\n\t__position._M_invalidate();\n\treturn iterator(_Base::erase(__position.base()), this);\n      }\n\n      iterator\n      erase(iterator __position, iterator __last)\n      {\n\t// _GLIBCXX_RESOLVE_LIB_DEFECTS\n\t// 151. can't currently clear() empty container\n\t__glibcxx_check_erase_range(__position, __last);\n\tfor (iterator __victim = __position; __victim != __last; )\n\t  {\n\t    iterator __old = __victim;\n\t    ++__victim;\n\t    __old._M_invalidate();\n\t  }\n\treturn iterator(_Base::erase(__position.base(), __last.base()), this);\n      }\n\n      void\n      swap(list& __x)\n      {\n\t_Base::swap(__x);\n\tthis->_M_swap(__x);\n      }\n\n      void\n      clear()\n      {\n\t_Base::clear();\n\tthis->_M_invalidate_all();\n      }\n\n      // 23.2.2.4 list operations:\n      void\n      splice(iterator __position, list& __x)\n      {\n\t_GLIBCXX_DEBUG_VERIFY(&__x != this,\n\t\t\t      _M_message(__gnu_debug::__msg_self_splice)\n\t\t\t      ._M_sequence(*this, \"this\"));\n\tthis->splice(__position, __x, __x.begin(), __x.end());\n      }\n\n      void\n      splice(iterator __position, list& __x, iterator __i)\n      {\n\t__glibcxx_check_insert(__position);\n\n\t// We used to perform the splice_alloc check:  not anymore, redundant\n\t// after implementing the relevant bits of N1599.\n\n\t_GLIBCXX_DEBUG_VERIFY(__i._M_dereferenceable(),\n\t\t\t      _M_message(__gnu_debug::__msg_splice_bad)\n\t\t\t      ._M_iterator(__i, \"__i\"));\n\t_GLIBCXX_DEBUG_VERIFY(__i._M_attached_to(&__x),\n\t\t\t      _M_message(__gnu_debug::__msg_splice_other)\n\t\t\t     ._M_iterator(__i, \"__i\")._M_sequence(__x, \"__x\"));\n\n\t// _GLIBCXX_RESOLVE_LIB_DEFECTS\n\t// 250. splicing invalidates iterators\n\tthis->_M_transfer_iter(__i);\n\t_Base::splice(__position.base(), __x._M_base(), __i.base());\n      }\n\n      void\n      splice(iterator __position, list& __x, iterator __first, iterator __last)\n      {\n\t__glibcxx_check_insert(__position);\n\t__glibcxx_check_valid_range(__first, __last);\n\t_GLIBCXX_DEBUG_VERIFY(__first._M_attached_to(&__x),\n\t\t\t      _M_message(__gnu_debug::__msg_splice_other)\n\t\t\t      ._M_sequence(__x, \"x\")\n\t\t\t      ._M_iterator(__first, \"first\"));\n\n\t// We used to perform the splice_alloc check:  not anymore, redundant\n\t// after implementing the relevant bits of N1599.\n\n\tfor (iterator __tmp = __first; __tmp != __last; )\n\t  {\n\t    _GLIBCXX_DEBUG_VERIFY(&__x != this || __tmp != __position,\n\t\t\t\t_M_message(__gnu_debug::__msg_splice_overlap)\n\t\t\t\t  ._M_iterator(__tmp, \"position\")\n\t\t\t\t  ._M_iterator(__first, \"first\")\n\t\t\t\t  ._M_iterator(__last, \"last\"));\n\t    iterator __victim = __tmp++;\n\t    // _GLIBCXX_RESOLVE_LIB_DEFECTS\n\t    // 250. splicing invalidates iterators\n\t    this->_M_transfer_iter(__victim);\n\t  }\n\n\t_Base::splice(__position.base(), __x._M_base(), __first.base(),\n\t\t      __last.base());\n      }\n\n      void\n      remove(const _Tp& __value)\n      {\n\tfor (iterator __x = begin(); __x.base() != _Base::end(); )\n\t  {\n\t    if (*__x == __value)\n\t      __x = erase(__x);\n\t    else\n\t      ++__x;\n\t  }\n      }\n\n      template<class _Predicate>\n        void\n        remove_if(_Predicate __pred)\n        {\n\t  for (iterator __x = begin(); __x.base() != _Base::end(); )\n\t    {\n\t      if (__pred(*__x))\n\t\t__x = erase(__x);\n\t      else\n\t\t++__x;\n\t    }\n\t}\n\n      void\n      unique()\n      {\n\titerator __first = begin();\n\titerator __last = end();\n\tif (__first == __last)\n\t  return;\n\titerator __next = __first;\n\twhile (++__next != __last)\n\t  {\n\t    if (*__first == *__next)\n\t      erase(__next);\n\t    else\n\t      __first = __next;\n\t    __next = __first;\n\t  }\n      }\n\n      template<class _BinaryPredicate>\n        void\n        unique(_BinaryPredicate __binary_pred)\n        {\n\t  iterator __first = begin();\n\t  iterator __last = end();\n\t  if (__first == __last)\n\t    return;\n\t  iterator __next = __first;\n\t  while (++__next != __last)\n\t    {\n\t      if (__binary_pred(*__first, *__next))\n\t\terase(__next);\n\t      else\n\t\t__first = __next;\n\t      __next = __first;\n\t    }\n\t}\n\n      void\n      merge(list& __x)\n      {\n\t__glibcxx_check_sorted(_Base::begin(), _Base::end());\n\t__glibcxx_check_sorted(__x.begin().base(), __x.end().base());\n\tfor (iterator __tmp = __x.begin(); __tmp != __x.end(); )\n\t  {\n\t    iterator __victim = __tmp++;\n\t    __victim._M_attach(&__x);\n\t  }\n\t_Base::merge(__x._M_base());\n      }\n\n      template<class _Compare>\n        void\n        merge(list& __x, _Compare __comp)\n        {\n\t  __glibcxx_check_sorted_pred(_Base::begin(), _Base::end(), __comp);\n\t  __glibcxx_check_sorted_pred(__x.begin().base(), __x.end().base(),\n\t\t\t\t      __comp);\n\t  for (iterator __tmp = __x.begin(); __tmp != __x.end(); )\n\t    {\n\t      iterator __victim = __tmp++;\n\t      __victim._M_attach(&__x);\n\t    }\n\t  _Base::merge(__x._M_base(), __comp);\n\t}\n\n      void\n      sort() { _Base::sort(); }\n\n      template<typename _StrictWeakOrdering>\n        void\n        sort(_StrictWeakOrdering __pred) { _Base::sort(__pred); }\n\n      using _Base::reverse;\n\n      _Base&\n      _M_base()       { return *this; }\n\n      const _Base&\n      _M_base() const { return *this; }\n\n    private:\n      void\n      _M_invalidate_all()\n      {\n\ttypedef typename _Base::const_iterator _Base_const_iterator;\n\ttypedef __gnu_debug::_Not_equal_to<_Base_const_iterator> _Not_equal;\n\tthis->_M_invalidate_if(_Not_equal(_M_base().end()));\n      }\n    };\n\n  template<typename _Tp, typename _Alloc>\n    inline bool\n    operator==(const list<_Tp, _Alloc>& __lhs, const list<_Tp, _Alloc>& __rhs)\n    { return __lhs._M_base() == __rhs._M_base(); }\n\n  template<typename _Tp, typename _Alloc>\n    inline bool\n    operator!=(const list<_Tp, _Alloc>& __lhs, const list<_Tp, _Alloc>& __rhs)\n    { return __lhs._M_base() != __rhs._M_base(); }\n\n  template<typename _Tp, typename _Alloc>\n    inline bool\n    operator<(const list<_Tp, _Alloc>& __lhs, const list<_Tp, _Alloc>& __rhs)\n    { return __lhs._M_base() < __rhs._M_base(); }\n\n  template<typename _Tp, typename _Alloc>\n    inline bool\n    operator<=(const list<_Tp, _Alloc>& __lhs, const list<_Tp, _Alloc>& __rhs)\n    { return __lhs._M_base() <= __rhs._M_base(); }\n\n  template<typename _Tp, typename _Alloc>\n    inline bool\n    operator>=(const list<_Tp, _Alloc>& __lhs, const list<_Tp, _Alloc>& __rhs)\n    { return __lhs._M_base() >= __rhs._M_base(); }\n\n  template<typename _Tp, typename _Alloc>\n    inline bool\n    operator>(const list<_Tp, _Alloc>& __lhs, const list<_Tp, _Alloc>& __rhs)\n    { return __lhs._M_base() > __rhs._M_base(); }\n\n  template<typename _Tp, typename _Alloc>\n    inline void\n    swap(list<_Tp, _Alloc>& __lhs, list<_Tp, _Alloc>& __rhs)\n    { __lhs.swap(__rhs); }\n} // namespace __debug\n} // namespace std\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/debug/macros.h",
    "content": "// Debugging support implementation -*- C++ -*-\n\n// Copyright (C) 2003, 2005, 2006\n// Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n/** @file debug/macros.h\n *  This file is a GNU debug extension to the Standard C++ Library.\n */\n\n#ifndef _GLIBCXX_DEBUG_MACROS_H\n#define _GLIBCXX_DEBUG_MACROS_H 1\n\n/**\n * Macros used by the implementation to verify certain\n * properties. These macros may only be used directly by the debug\n * wrappers. Note that these are macros (instead of the more obviously\n * \"correct\" choice of making them functions) because we need line and\n * file information at the call site, to minimize the distance between\n * the user error and where the error is reported.\n *\n */\n#define _GLIBCXX_DEBUG_VERIFY(_Condition,_ErrorMessage)\t\t        \\\n  do \t\t\t\t\t\t\t\t\t\\\n  {\t\t\t\t\t\t\t\t\t\\\n    if (! (_Condition))\t\t\t\t\t\t\t\\\n      __gnu_debug::_Error_formatter::_M_at(__FILE__, __LINE__)\t        \\\n\t  ._ErrorMessage._M_error();\t\t\t\t\t\\\n  } while (false)\n\n// Verify that [_First, _Last) forms a valid iterator range.\n#define __glibcxx_check_valid_range(_First,_Last)\t\t\t\\\n_GLIBCXX_DEBUG_VERIFY(__gnu_debug::__valid_range(_First, _Last),\t\\\n\t\t      _M_message(__gnu_debug::__msg_valid_range)\t\\\n\t\t      ._M_iterator(_First, #_First)\t\t\t\\\n\t\t      ._M_iterator(_Last, #_Last))\n\n/** Verify that we can insert into *this with the iterator _Position.\n *  Insertion into a container at a specific position requires that\n *  the iterator be nonsingular (i.e., either dereferenceable or\n *  past-the-end) and that it reference the sequence we are inserting\n *  into. Note that this macro is only valid when the container is a\n *  _Safe_sequence and the iterator is a _Safe_iterator.\n*/\n#define __glibcxx_check_insert(_Position)\t\t\t\t\\\n_GLIBCXX_DEBUG_VERIFY(!_Position._M_singular(),\t\t\t\t\\\n\t\t      _M_message(__gnu_debug::__msg_insert_singular) \\\n\t\t      ._M_sequence(*this, \"this\")\t\t\t\\\n\t\t      ._M_iterator(_Position, #_Position));\t\t\\\n_GLIBCXX_DEBUG_VERIFY(_Position._M_attached_to(this),\t\t\t\\\n\t\t      _M_message(__gnu_debug::__msg_insert_different) \\\n\t\t      ._M_sequence(*this, \"this\")\t\t\t\\\n\t\t      ._M_iterator(_Position, #_Position))\n\n/** Verify that we can insert the values in the iterator range\n *  [_First, _Last) into *this with the iterator _Position.  Insertion\n *  into a container at a specific position requires that the iterator\n *  be nonsingular (i.e., either dereferenceable or past-the-end),\n *  that it reference the sequence we are inserting into, and that the\n *  iterator range [_First, Last) is a valid (possibly empty)\n *  range. Note that this macro is only valid when the container is a\n *  _Safe_sequence and the iterator is a _Safe_iterator.\n *\n *  @tbd We would like to be able to check for noninterference of\n *  _Position and the range [_First, _Last), but that can't (in\n *  general) be done.\n*/\n#define __glibcxx_check_insert_range(_Position,_First,_Last)\t\t\\\n__glibcxx_check_valid_range(_First,_Last);\t\t\t\t\\\n_GLIBCXX_DEBUG_VERIFY(!_Position._M_singular(),\t\t\t\t\\\n\t\t      _M_message(__gnu_debug::__msg_insert_singular)    \\\n                      ._M_sequence(*this, \"this\")\t\t\t\\\n\t\t      ._M_iterator(_Position, #_Position));\t\t\\\n_GLIBCXX_DEBUG_VERIFY(_Position._M_attached_to(this),\t\t\t\\\n\t\t      _M_message(__gnu_debug::__msg_insert_different)   \\\n\t\t      ._M_sequence(*this, \"this\")\t\t\t\\\n\t\t      ._M_iterator(_Position, #_Position))\n\n/** Verify that we can erase the element referenced by the iterator\n * _Position. We can erase the element if the _Position iterator is\n * dereferenceable and references this sequence.\n*/\n#define __glibcxx_check_erase(_Position)\t\t\t\t\\\n_GLIBCXX_DEBUG_VERIFY(_Position._M_dereferenceable(),\t\t\t\\\n\t\t      _M_message(__gnu_debug::__msg_erase_bad)\t        \\\n                      ._M_sequence(*this, \"this\")\t\t\t\\\n\t\t      ._M_iterator(_Position, #_Position));\t\t\\\n_GLIBCXX_DEBUG_VERIFY(_Position._M_attached_to(this),\t\t\t\\\n\t\t      _M_message(__gnu_debug::__msg_erase_different)    \\\n\t\t      ._M_sequence(*this, \"this\")\t\t\t\\\n\t\t      ._M_iterator(_Position, #_Position))\n\n/** Verify that we can erase the elements in the iterator range\n *  [_First, _Last). We can erase the elements if [_First, _Last) is a\n *  valid iterator range within this sequence.\n*/\n#define __glibcxx_check_erase_range(_First,_Last)\t\t\t\\\n__glibcxx_check_valid_range(_First,_Last);\t\t\t\t\\\n_GLIBCXX_DEBUG_VERIFY(_First._M_attached_to(this),\t\t\t\\\n\t\t      _M_message(__gnu_debug::__msg_erase_different)    \\\n                      ._M_sequence(*this, \"this\")\t\t\t\\\n\t\t      ._M_iterator(_First, #_First)\t\t\t\\\n\t\t      ._M_iterator(_Last, #_Last))\n\n// Verify that the subscript _N is less than the container's size.\n#define __glibcxx_check_subscript(_N)\t\t\t\t\t\\\n_GLIBCXX_DEBUG_VERIFY(_N < this->size(),\t\t\t\t\\\n\t\t      _M_message(__gnu_debug::__msg_subscript_oob)      \\\n                      ._M_sequence(*this, \"this\")\t\t\t\\\n\t\t      ._M_integer(_N, #_N)\t\t\t\t\\\n\t\t      ._M_integer(this->size(), \"size\"))\n\n// Verify that the container is nonempty\n#define __glibcxx_check_nonempty()\t\t\t\t\t\\\n_GLIBCXX_DEBUG_VERIFY(! this->empty(),\t\t\t\t\t\\\n\t\t      _M_message(__gnu_debug::__msg_empty)\t        \\\n                      ._M_sequence(*this, \"this\"))\n\n// Verify that the < operator for elements in the sequence is a\n// StrictWeakOrdering by checking that it is irreflexive.\n#define __glibcxx_check_strict_weak_ordering(_First,_Last)\t\\\n_GLIBCXX_DEBUG_ASSERT(_First == _Last || !(*_First < *_First))\n\n// Verify that the predicate is StrictWeakOrdering by checking that it\n// is irreflexive.\n#define __glibcxx_check_strict_weak_ordering_pred(_First,_Last,_Pred)\t\\\n_GLIBCXX_DEBUG_ASSERT(_First == _Last || !_Pred(*_First, *_First))\n\n\n// Verify that the iterator range [_First, _Last) is sorted\n#define __glibcxx_check_sorted(_First,_Last)\t\t\t\t\\\n__glibcxx_check_valid_range(_First,_Last);\t\t\t\t\\\n__glibcxx_check_strict_weak_ordering(_First,_Last);\t\t\t\\\n_GLIBCXX_DEBUG_VERIFY(__gnu_debug::__check_sorted(_First, _Last),\t\\\n\t\t      _M_message(__gnu_debug::__msg_unsorted)\t        \\\n                      ._M_iterator(_First, #_First)\t\t\t\\\n\t\t      ._M_iterator(_Last, #_Last))\n\n/** Verify that the iterator range [_First, _Last) is sorted by the\n    predicate _Pred. */\n#define __glibcxx_check_sorted_pred(_First,_Last,_Pred)\t\t\t\\\n__glibcxx_check_valid_range(_First,_Last);\t\t\t\t\\\n__glibcxx_check_strict_weak_ordering_pred(_First,_Last,_Pred);\t        \\\n_GLIBCXX_DEBUG_VERIFY(__gnu_debug::__check_sorted(_First, _Last, _Pred), \\\n\t\t      _M_message(__gnu_debug::__msg_unsorted_pred)      \\\n                      ._M_iterator(_First, #_First)\t\t\t\\\n\t\t      ._M_iterator(_Last, #_Last)\t\t\t\\\n\t\t      ._M_string(#_Pred))\n\n/** Verify that the iterator range [_First, _Last) is partitioned\n    w.r.t. the value _Value. */\n#define __glibcxx_check_partitioned(_First,_Last,_Value)\t\t\\\n__glibcxx_check_valid_range(_First,_Last);\t\t\t\t\\\n_GLIBCXX_DEBUG_VERIFY(__gnu_debug::__check_partitioned(_First, _Last,   \\\n\t\t\t\t\t\t\t    _Value),\t\\\n\t\t      _M_message(__gnu_debug::__msg_unpartitioned)      \\\n\t\t      ._M_iterator(_First, #_First)\t\t\t\\\n\t\t      ._M_iterator(_Last, #_Last)\t\t\t\\\n\t\t      ._M_string(#_Value))\n\n/** Verify that the iterator range [_First, _Last) is partitioned\n    w.r.t. the value _Value and predicate _Pred. */\n#define __glibcxx_check_partitioned_pred(_First,_Last,_Value,_Pred)\t\\\n__glibcxx_check_valid_range(_First,_Last);\t\t\t\t\\\n_GLIBCXX_DEBUG_VERIFY(__gnu_debug::__check_partitioned(_First, _Last,   \\\n\t\t\t\t\t\t\t _Value, _Pred), \\\n\t\t      _M_message(__gnu_debug::__msg_unpartitioned_pred) \\\n\t\t      ._M_iterator(_First, #_First)\t\t\t\\\n\t\t      ._M_iterator(_Last, #_Last)\t\t\t\\\n\t\t      ._M_string(#_Pred)\t\t\t\t\\\n                      ._M_string(#_Value))\n\n// Verify that the iterator range [_First, _Last) is a heap\n#define __glibcxx_check_heap(_First,_Last)\t\t\t\t\\\n__glibcxx_check_valid_range(_First,_Last);\t\t\t\t\\\n_GLIBCXX_DEBUG_VERIFY(std::__is_heap(_First, _Last),\t\t        \\\n\t\t      _M_message(__gnu_debug::__msg_not_heap)\t        \\\n\t\t      ._M_iterator(_First, #_First)\t\t\t\\\n\t\t      ._M_iterator(_Last, #_Last))\n\n/** Verify that the iterator range [_First, _Last) is a heap\n    w.r.t. the predicate _Pred. */\n#define __glibcxx_check_heap_pred(_First,_Last,_Pred)\t\t\t\\\n__glibcxx_check_valid_range(_First,_Last);\t\t\t\t\\\n_GLIBCXX_DEBUG_VERIFY(std::__is_heap(_First, _Last, _Pred),\t\t\\\n\t\t      _M_message(__gnu_debug::__msg_not_heap_pred)      \\\n                      ._M_iterator(_First, #_First)\t\t\t\\\n\t\t      ._M_iterator(_Last, #_Last)\t\t\t\\\n\t\t      ._M_string(#_Pred))\n\n#ifdef _GLIBCXX_DEBUG_PEDANTIC\n#  define __glibcxx_check_string(_String) _GLIBCXX_DEBUG_ASSERT(_String != 0)\n#  define __glibcxx_check_string_len(_String,_Len) \\\n       _GLIBCXX_DEBUG_ASSERT(_String != 0 || _Len == 0)\n#else\n#  define __glibcxx_check_string(_String)\n#  define __glibcxx_check_string_len(_String,_Len)\n#endif\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/debug/map",
    "content": "// Debugging map/multimap implementation -*- C++ -*-\n\n// Copyright (C) 2003, 2006\n// Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n/** @file debug/map\n *  This file is a GNU debug extension to the Standard C++ Library.\n */\n\n#ifndef _GLIBCXX_DEBUG_MAP\n#define _GLIBCXX_DEBUG_MAP 1\n\n#include <map>\n#include <debug/map.h>\n#include <debug/multimap.h>\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/debug/map.h",
    "content": "// Debugging map implementation -*- C++ -*-\n\n// Copyright (C) 2003, 2004, 2005\n// Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n/** @file debug/map.h\n *  This file is a GNU debug extension to the Standard C++ Library.\n */\n\n#ifndef _GLIBCXX_DEBUG_MAP_H\n#define _GLIBCXX_DEBUG_MAP_H 1\n\n#include <debug/safe_sequence.h>\n#include <debug/safe_iterator.h>\n#include <utility>\n\nnamespace std\n{\nnamespace __debug\n{\n  template<typename _Key, typename _Tp, typename _Compare = std::less<_Key>,\n\t   typename _Allocator = std::allocator<std::pair<const _Key, _Tp> > >\n    class map\n    : public _GLIBCXX_STD::map<_Key, _Tp, _Compare, _Allocator>,\n      public __gnu_debug::_Safe_sequence<map<_Key, _Tp, _Compare, _Allocator> >\n    {\n      typedef _GLIBCXX_STD::map<_Key, _Tp, _Compare, _Allocator> _Base;\n      typedef __gnu_debug::_Safe_sequence<map> _Safe_base;\n\n    public:\n      // types:\n      typedef _Key                                  key_type;\n      typedef _Tp                                   mapped_type;\n      typedef std::pair<const _Key, _Tp>            value_type;\n      typedef _Compare                              key_compare;\n      typedef _Allocator                            allocator_type;\n      typedef typename _Base::reference             reference;\n      typedef typename _Base::const_reference       const_reference;\n\n      typedef __gnu_debug::_Safe_iterator<typename _Base::iterator, map>\n                                                    iterator;\n      typedef __gnu_debug::_Safe_iterator<typename _Base::const_iterator, map>\n                                                    const_iterator;\n\n      typedef typename _Base::size_type             size_type;\n      typedef typename _Base::difference_type       difference_type;\n      typedef typename _Base::pointer               pointer;\n      typedef typename _Base::const_pointer         const_pointer;\n      typedef std::reverse_iterator<iterator>       reverse_iterator;\n      typedef std::reverse_iterator<const_iterator> const_reverse_iterator;\n\n      using _Base::value_compare;\n\n      // 23.3.1.1 construct/copy/destroy:\n      explicit map(const _Compare& __comp = _Compare(),\n\t\t   const _Allocator& __a = _Allocator())\n      : _Base(__comp, __a) { }\n\n      template<typename _InputIterator>\n        map(_InputIterator __first, _InputIterator __last,\n\t    const _Compare& __comp = _Compare(),\n\t    const _Allocator& __a = _Allocator())\n\t: _Base(__gnu_debug::__check_valid_range(__first, __last), __last,\n\t\t__comp, __a), _Safe_base() { }\n\n      map(const map<_Key,_Tp,_Compare,_Allocator>& __x)\n      : _Base(__x), _Safe_base() { }\n\n      map(const _Base& __x) : _Base(__x), _Safe_base() { }\n\n      ~map() { }\n\n      map<_Key,_Tp,_Compare,_Allocator>&\n      operator=(const map<_Key,_Tp,_Compare,_Allocator>& __x)\n      {\n\t*static_cast<_Base*>(this) = __x;\n\tthis->_M_invalidate_all();\n\treturn *this;\n      }\n\n      // _GLIBCXX_RESOLVE_LIB_DEFECTS\n      // 133. map missing get_allocator()\n      using _Base::get_allocator;\n\n      // iterators:\n      iterator \n      begin()\n      { return iterator(_Base::begin(), this); }\n\n      const_iterator\n      begin() const\n      { return const_iterator(_Base::begin(), this); }\n\n      iterator\n      end()\n      { return iterator(_Base::end(), this); }\n\n      const_iterator\n      end() const\n      { return const_iterator(_Base::end(), this); }\n\n      reverse_iterator\n      rbegin()\n      { return reverse_iterator(end()); }\n\n      const_reverse_iterator\n      rbegin() const\n      { return const_reverse_iterator(end()); }\n\n      reverse_iterator\n      rend()\n      { return reverse_iterator(begin()); }\n\n      const_reverse_iterator\n      rend() const\n      { return const_reverse_iterator(begin()); }\n\n      // capacity:\n      using _Base::empty;\n      using _Base::size;\n      using _Base::max_size;\n\n      // 23.3.1.2 element access:\n      using _Base::operator[];\n\n      // _GLIBCXX_RESOLVE_LIB_DEFECTS\n      // DR 464. Suggestion for new member functions in standard containers.\n      using _Base::at;\n\n      // modifiers:\n      std::pair<iterator, bool>\n      insert(const value_type& __x)\n      {\n\ttypedef typename _Base::iterator _Base_iterator;\n\tstd::pair<_Base_iterator, bool> __res = _Base::insert(__x);\n\treturn std::pair<iterator, bool>(iterator(__res.first, this),\n\t\t\t\t\t __res.second);\n      }\n\n      iterator\n      insert(iterator __position, const value_type& __x)\n      {\n\t__glibcxx_check_insert(__position);\n\treturn iterator(_Base::insert(__position.base(), __x), this);\n      }\n\n      template<typename _InputIterator>\n        void\n        insert(_InputIterator __first, _InputIterator __last)\n        {\n\t  __glibcxx_check_valid_range(__first, __last);\n\t  _Base::insert(__first, __last);\n\t}\n\n      void\n      erase(iterator __position)\n      {\n\t__glibcxx_check_erase(__position);\n\t__position._M_invalidate();\n\t_Base::erase(__position.base());\n      }\n\n      size_type\n      erase(const key_type& __x)\n      {\n\titerator __victim = find(__x);\n\tif (__victim == end())\n\t  return 0;\n\telse\n\t{\n\t  __victim._M_invalidate();\n\t  _Base::erase(__victim.base());\n\t  return 1;\n\t}\n      }\n\n      void\n      erase(iterator __first, iterator __last)\n      {\n\t// _GLIBCXX_RESOLVE_LIB_DEFECTS\n\t// 151. can't currently clear() empty container\n\t__glibcxx_check_erase_range(__first, __last);\n\twhile (__first != __last)\n\t  this->erase(__first++);\n      }\n\n      void\n      swap(map<_Key,_Tp,_Compare,_Allocator>& __x)\n      {\n\t_Base::swap(__x);\n\tthis->_M_swap(__x);\n      }\n\n      void\n      clear()\n      { this->erase(begin(), end()); }\n\n      // observers:\n      using _Base::key_comp;\n      using _Base::value_comp;\n\n      // 23.3.1.3 map operations:\n      iterator\n      find(const key_type& __x)\n      { return iterator(_Base::find(__x), this); }\n\n      const_iterator\n      find(const key_type& __x) const\n      { return const_iterator(_Base::find(__x), this); }\n\n      using _Base::count;\n\n      iterator\n      lower_bound(const key_type& __x)\n      { return iterator(_Base::lower_bound(__x), this); }\n\n      const_iterator\n      lower_bound(const key_type& __x) const\n      { return const_iterator(_Base::lower_bound(__x), this); }\n\n      iterator\n      upper_bound(const key_type& __x)\n      { return iterator(_Base::upper_bound(__x), this); }\n\n      const_iterator\n      upper_bound(const key_type& __x) const\n      { return const_iterator(_Base::upper_bound(__x), this); }\n\n      std::pair<iterator,iterator>\n      equal_range(const key_type& __x)\n      {\n\ttypedef typename _Base::iterator _Base_iterator;\n\tstd::pair<_Base_iterator, _Base_iterator> __res =\n\t_Base::equal_range(__x);\n\treturn std::make_pair(iterator(__res.first, this),\n\t\t\t      iterator(__res.second, this));\n      }\n\n      std::pair<const_iterator,const_iterator>\n      equal_range(const key_type& __x) const\n      {\n\ttypedef typename _Base::const_iterator _Base_const_iterator;\n\tstd::pair<_Base_const_iterator, _Base_const_iterator> __res =\n\t_Base::equal_range(__x);\n\treturn std::make_pair(const_iterator(__res.first, this),\n\t\t\t      const_iterator(__res.second, this));\n      }\n\n      _Base& \n      _M_base() { return *this; }\n\n      const _Base&\n      _M_base() const { return *this; }\n\n    private:\n      void\n      _M_invalidate_all()\n      {\n\ttypedef typename _Base::const_iterator _Base_const_iterator;\n\ttypedef __gnu_debug::_Not_equal_to<_Base_const_iterator> _Not_equal;\n\tthis->_M_invalidate_if(_Not_equal(_M_base().end()));\n      }\n    };\n\n  template<typename _Key,typename _Tp,typename _Compare,typename _Allocator>\n    inline bool\n    operator==(const map<_Key,_Tp,_Compare,_Allocator>& __lhs,\n\t       const map<_Key,_Tp,_Compare,_Allocator>& __rhs)\n    { return __lhs._M_base() == __rhs._M_base(); }\n\n  template<typename _Key,typename _Tp,typename _Compare,typename _Allocator>\n    inline bool\n    operator!=(const map<_Key,_Tp,_Compare,_Allocator>& __lhs,\n\t       const map<_Key,_Tp,_Compare,_Allocator>& __rhs)\n    { return __lhs._M_base() != __rhs._M_base(); }\n\n  template<typename _Key,typename _Tp,typename _Compare,typename _Allocator>\n    inline bool\n    operator<(const map<_Key,_Tp,_Compare,_Allocator>& __lhs,\n\t      const map<_Key,_Tp,_Compare,_Allocator>& __rhs)\n    { return __lhs._M_base() < __rhs._M_base(); }\n\n  template<typename _Key,typename _Tp,typename _Compare,typename _Allocator>\n    inline bool\n    operator<=(const map<_Key,_Tp,_Compare,_Allocator>& __lhs,\n\t       const map<_Key,_Tp,_Compare,_Allocator>& __rhs)\n    { return __lhs._M_base() <= __rhs._M_base(); }\n\n  template<typename _Key,typename _Tp,typename _Compare,typename _Allocator>\n    inline bool\n    operator>=(const map<_Key,_Tp,_Compare,_Allocator>& __lhs,\n\t       const map<_Key,_Tp,_Compare,_Allocator>& __rhs)\n    { return __lhs._M_base() >= __rhs._M_base(); }\n\n  template<typename _Key,typename _Tp,typename _Compare,typename _Allocator>\n    inline bool\n    operator>(const map<_Key,_Tp,_Compare,_Allocator>& __lhs,\n\t      const map<_Key,_Tp,_Compare,_Allocator>& __rhs)\n    { return __lhs._M_base() > __rhs._M_base(); }\n\n  template<typename _Key,typename _Tp,typename _Compare,typename _Allocator>\n    inline void\n    swap(map<_Key,_Tp,_Compare,_Allocator>& __lhs,\n\t map<_Key,_Tp,_Compare,_Allocator>& __rhs)\n    { __lhs.swap(__rhs); }\n} // namespace __debug\n} // namespace std\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/debug/multimap.h",
    "content": "// Debugging multimap implementation -*- C++ -*-\n\n// Copyright (C) 2003, 2004, 2005\n// Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n/** @file debug/multimap.h\n *  This file is a GNU debug extension to the Standard C++ Library.\n */\n\n#ifndef _GLIBCXX_DEBUG_MULTIMAP_H\n#define _GLIBCXX_DEBUG_MULTIMAP_H 1\n\n#include <debug/safe_sequence.h>\n#include <debug/safe_iterator.h>\n#include <utility>\n\nnamespace std\n{\nnamespace __debug\n{\n  template<typename _Key, typename _Tp, typename _Compare = std::less<_Key>,\n\t   typename _Allocator = std::allocator<std::pair<const _Key, _Tp> > >\n    class multimap\n    : public _GLIBCXX_STD::multimap<_Key, _Tp, _Compare, _Allocator>,\n    public __gnu_debug::_Safe_sequence<multimap<_Key,_Tp,_Compare,_Allocator> >\n    {\n      typedef _GLIBCXX_STD::multimap<_Key, _Tp, _Compare, _Allocator> _Base;\n      typedef __gnu_debug::_Safe_sequence<multimap> _Safe_base;\n\n    public:\n      // types:\n      typedef _Key\t\t\t\t     key_type;\n      typedef _Tp\t\t\t\t     mapped_type;\n      typedef std::pair<const _Key, _Tp>             value_type;\n      typedef _Compare                               key_compare;\n      typedef _Allocator                             allocator_type;\n      typedef typename _Base::reference              reference;\n      typedef typename _Base::const_reference        const_reference;\n\n      typedef __gnu_debug::_Safe_iterator<typename _Base::iterator, multimap>\n                                                     iterator;\n      typedef __gnu_debug::_Safe_iterator<typename _Base::const_iterator,\n                                           multimap> const_iterator;\n\n      typedef typename _Base::size_type              size_type;\n      typedef typename _Base::difference_type        difference_type;\n      typedef typename _Base::pointer                pointer;\n      typedef typename _Base::const_pointer          const_pointer;\n      typedef std::reverse_iterator<iterator>        reverse_iterator;\n      typedef std::reverse_iterator<const_iterator>  const_reverse_iterator;\n\n      using _Base::value_compare;\n\n      // 23.3.1.1 construct/copy/destroy:\n      explicit multimap(const _Compare& __comp = _Compare(),\n\t\t\tconst _Allocator& __a = _Allocator())\n      : _Base(__comp, __a) { }\n\n      template<typename _InputIterator>\n      multimap(_InputIterator __first, _InputIterator __last,\n\t       const _Compare& __comp = _Compare(),\n\t       const _Allocator& __a = _Allocator())\n      : _Base(__gnu_debug::__check_valid_range(__first, __last), __last,\n\t      __comp, __a) { }\n\n      multimap(const multimap<_Key,_Tp,_Compare,_Allocator>& __x)\n      : _Base(__x), _Safe_base() { }\n\n      multimap(const _Base& __x) : _Base(__x), _Safe_base() { }\n\n      ~multimap() { }\n\n      multimap<_Key,_Tp,_Compare,_Allocator>&\n      operator=(const multimap<_Key,_Tp,_Compare,_Allocator>& __x)\n      {\n\t*static_cast<_Base*>(this) = __x;\n\tthis->_M_invalidate_all();\n\treturn *this;\n      }\n\n      using _Base::get_allocator;\n\n      // iterators:\n      iterator\n      begin()\n      { return iterator(_Base::begin(), this); }\n\n      const_iterator\n      begin() const\n      { return const_iterator(_Base::begin(), this); }\n\n      iterator\n      end()\n      { return iterator(_Base::end(), this); }\n\n      const_iterator\n      end() const\n      { return const_iterator(_Base::end(), this); }\n\n      reverse_iterator\n      rbegin()\n      { return reverse_iterator(end()); }\n\n      const_reverse_iterator\n      rbegin() const\n      { return const_reverse_iterator(end()); }\n\n      reverse_iterator\n      rend()\n      { return reverse_iterator(begin()); }\n\n      const_reverse_iterator\n      rend() const\n      { return const_reverse_iterator(begin()); }\n\n      // capacity:\n      using _Base::empty;\n      using _Base::size;\n      using _Base::max_size;\n\n      // modifiers:\n      iterator\n      insert(const value_type& __x)\n      { return iterator(_Base::insert(__x), this); }\n\n      iterator\n      insert(iterator __position, const value_type& __x)\n      {\n\t__glibcxx_check_insert(__position);\n\treturn iterator(_Base::insert(__position.base(), __x), this);\n      }\n\n      template<typename _InputIterator>\n        void\n        insert(_InputIterator __first, _InputIterator __last)\n        {\n\t  __glibcxx_check_valid_range(__first, __last);\n\t  _Base::insert(__first, __last);\n\t}\n\n      void\n      erase(iterator __position)\n      {\n\t__glibcxx_check_erase(__position);\n\t__position._M_invalidate();\n\t_Base::erase(__position.base());\n      }\n\n      size_type\n      erase(const key_type& __x)\n      {\n\tstd::pair<iterator, iterator> __victims = this->equal_range(__x);\n\tsize_type __count = 0;\n\twhile (__victims.first != __victims.second)\n\t{\n\t  iterator __victim = __victims.first++;\n\t  __victim._M_invalidate();\n\t  _Base::erase(__victim.base());\n\t  ++__count;\n\t}\n\treturn __count;\n      }\n\n      void\n      erase(iterator __first, iterator __last)\n      {\n\t// _GLIBCXX_RESOLVE_LIB_DEFECTS\n\t// 151. can't currently clear() empty container\n\t__glibcxx_check_erase_range(__first, __last);\n\twhile (__first != __last)\n\tthis->erase(__first++);\n      }\n\n      void\n      swap(multimap<_Key,_Tp,_Compare,_Allocator>& __x)\n      {\n\t_Base::swap(__x);\n\tthis->_M_swap(__x);\n      }\n\n      void\n      clear()\n      { this->erase(begin(), end()); }\n\n      // observers:\n      using _Base::key_comp;\n      using _Base::value_comp;\n\n      // 23.3.1.3 multimap operations:\n      iterator\n      find(const key_type& __x)\n      { return iterator(_Base::find(__x), this); }\n\n      const_iterator\n      find(const key_type& __x) const\n      { return const_iterator(_Base::find(__x), this); }\n\n      using _Base::count;\n\n      iterator\n      lower_bound(const key_type& __x)\n      { return iterator(_Base::lower_bound(__x), this); }\n\n      const_iterator\n      lower_bound(const key_type& __x) const\n      { return const_iterator(_Base::lower_bound(__x), this); }\n\n      iterator\n      upper_bound(const key_type& __x)\n      { return iterator(_Base::upper_bound(__x), this); }\n\n      const_iterator\n      upper_bound(const key_type& __x) const\n      { return const_iterator(_Base::upper_bound(__x), this); }\n\n      std::pair<iterator,iterator>\n      equal_range(const key_type& __x)\n      {\n\ttypedef typename _Base::iterator _Base_iterator;\n\tstd::pair<_Base_iterator, _Base_iterator> __res =\n\t_Base::equal_range(__x);\n\treturn std::make_pair(iterator(__res.first, this),\n\t\t\t      iterator(__res.second, this));\n      }\n\n      std::pair<const_iterator,const_iterator>\n      equal_range(const key_type& __x) const\n      {\n\ttypedef typename _Base::const_iterator _Base_const_iterator;\n\tstd::pair<_Base_const_iterator, _Base_const_iterator> __res =\n\t_Base::equal_range(__x);\n\treturn std::make_pair(const_iterator(__res.first, this),\n\t\t\t      const_iterator(__res.second, this));\n      }\n\n      _Base&\n      _M_base() { return *this; }\n\n      const _Base&\n      _M_base() const { return *this; }\n\n    private:\n      void\n      _M_invalidate_all()\n      {\n\ttypedef typename _Base::const_iterator _Base_const_iterator;\n\ttypedef __gnu_debug::_Not_equal_to<_Base_const_iterator> _Not_equal;\n\tthis->_M_invalidate_if(_Not_equal(_M_base().end()));\n      }\n    };\n\n  template<typename _Key,typename _Tp,typename _Compare,typename _Allocator>\n    inline bool\n    operator==(const multimap<_Key,_Tp,_Compare,_Allocator>& __lhs,\n\t       const multimap<_Key,_Tp,_Compare,_Allocator>& __rhs)\n    { return __lhs._M_base() == __rhs._M_base(); }\n\n  template<typename _Key,typename _Tp,typename _Compare,typename _Allocator>\n    inline bool\n    operator!=(const multimap<_Key,_Tp,_Compare,_Allocator>& __lhs,\n\t       const multimap<_Key,_Tp,_Compare,_Allocator>& __rhs)\n    { return __lhs._M_base() != __rhs._M_base(); }\n\n  template<typename _Key,typename _Tp,typename _Compare,typename _Allocator>\n    inline bool\n    operator<(const multimap<_Key,_Tp,_Compare,_Allocator>& __lhs,\n\t      const multimap<_Key,_Tp,_Compare,_Allocator>& __rhs)\n    { return __lhs._M_base() < __rhs._M_base(); }\n\n  template<typename _Key,typename _Tp,typename _Compare,typename _Allocator>\n    inline bool\n    operator<=(const multimap<_Key,_Tp,_Compare,_Allocator>& __lhs,\n\t       const multimap<_Key,_Tp,_Compare,_Allocator>& __rhs)\n    { return __lhs._M_base() <= __rhs._M_base(); }\n\n  template<typename _Key,typename _Tp,typename _Compare,typename _Allocator>\n    inline bool\n    operator>=(const multimap<_Key,_Tp,_Compare,_Allocator>& __lhs,\n\t       const multimap<_Key,_Tp,_Compare,_Allocator>& __rhs)\n    { return __lhs._M_base() >= __rhs._M_base(); }\n\n  template<typename _Key,typename _Tp,typename _Compare,typename _Allocator>\n    inline bool\n    operator>(const multimap<_Key,_Tp,_Compare,_Allocator>& __lhs,\n\t      const multimap<_Key,_Tp,_Compare,_Allocator>& __rhs)\n    { return __lhs._M_base() > __rhs._M_base(); }\n\n  template<typename _Key,typename _Tp,typename _Compare,typename _Allocator>\n    inline void\n    swap(multimap<_Key,_Tp,_Compare,_Allocator>& __lhs,\n\t multimap<_Key,_Tp,_Compare,_Allocator>& __rhs)\n    { __lhs.swap(__rhs); }\n} // namespace __debug\n} // namespace std\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/debug/multiset.h",
    "content": "// Debugging multiset implementation -*- C++ -*-\n\n// Copyright (C) 2003, 2004, 2005\n// Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n/** @file debug/multiset.h\n *  This file is a GNU debug extension to the Standard C++ Library.\n */\n\n#ifndef _GLIBCXX_DEBUG_MULTISET_H\n#define _GLIBCXX_DEBUG_MULTISET_H 1\n\n#include <debug/safe_sequence.h>\n#include <debug/safe_iterator.h>\n#include <utility>\n\nnamespace std\n{\nnamespace __debug\n{\n  template<typename _Key, typename _Compare = std::less<_Key>,\n\t   typename _Allocator = std::allocator<_Key> >\n    class multiset\n    : public _GLIBCXX_STD::multiset<_Key, _Compare, _Allocator>,\n      public __gnu_debug::_Safe_sequence<multiset<_Key, _Compare, _Allocator> >\n    {\n      typedef _GLIBCXX_STD::multiset<_Key, _Compare, _Allocator> _Base;\n      typedef __gnu_debug::_Safe_sequence<multiset> _Safe_base;\n\n    public:\n      // types:\n      typedef _Key\t\t\t\t     key_type;\n      typedef _Key\t\t\t\t     value_type;\n      typedef _Compare\t\t\t\t     key_compare;\n      typedef _Compare\t\t\t\t     value_compare;\n      typedef _Allocator\t\t\t     allocator_type;\n      typedef typename _Base::reference\t             reference;\n      typedef typename _Base::const_reference        const_reference;\n\n      typedef __gnu_debug::_Safe_iterator<typename _Base::iterator, multiset>\n      iterator;\n      typedef __gnu_debug::_Safe_iterator<typename _Base::const_iterator,\n\t\t\t\t\t  multiset> const_iterator;\n\n      typedef typename _Base::size_type              size_type;\n      typedef typename _Base::difference_type        difference_type;\n      typedef typename _Base::pointer                pointer;\n      typedef typename _Base::const_pointer          const_pointer;\n      typedef std::reverse_iterator<iterator>        reverse_iterator;\n      typedef std::reverse_iterator<const_iterator>  const_reverse_iterator;\n\n      // 23.3.3.1 construct/copy/destroy:\n      explicit multiset(const _Compare& __comp = _Compare(),\n\t\t\tconst _Allocator& __a = _Allocator())\n      : _Base(__comp, __a) { }\n\n      template<typename _InputIterator>\n        multiset(_InputIterator __first, _InputIterator __last,\n\t\t const _Compare& __comp = _Compare(),\n\t\t const _Allocator& __a = _Allocator())\n\t: _Base(__gnu_debug::__check_valid_range(__first, __last), __last,\n\t\t__comp, __a) { }\n\n      multiset(const multiset<_Key,_Compare,_Allocator>& __x)\n      : _Base(__x), _Safe_base() { }\n\n      multiset(const _Base& __x) : _Base(__x), _Safe_base() { }\n\n      ~multiset() { }\n\n      multiset<_Key,_Compare,_Allocator>&\n      operator=(const multiset<_Key,_Compare,_Allocator>& __x)\n      {\n\t*static_cast<_Base*>(this) = __x;\n\tthis->_M_invalidate_all();\n\treturn *this;\n      }\n\n      using _Base::get_allocator;\n\n      // iterators:\n      iterator\n      begin()\n      { return iterator(_Base::begin(), this); }\n\n      const_iterator\n      begin() const\n      { return const_iterator(_Base::begin(), this); }\n\n      iterator\n      end()\n      { return iterator(_Base::end(), this); }\n\n      const_iterator\n      end() const\n      { return const_iterator(_Base::end(), this); }\n\n      reverse_iterator\n      rbegin()\n      { return reverse_iterator(end()); }\n\n      const_reverse_iterator\n      rbegin() const\n      { return const_reverse_iterator(end()); }\n\n      reverse_iterator\n      rend()\n      { return reverse_iterator(begin()); }\n\n      const_reverse_iterator\n      rend() const\n      { return const_reverse_iterator(begin()); }\n\n      // capacity:\n      using _Base::empty;\n      using _Base::size;\n      using _Base::max_size;\n\n      // modifiers:\n      iterator\n      insert(const value_type& __x)\n      { return iterator(_Base::insert(__x), this); }\n\n      iterator\n      insert(iterator __position, const value_type& __x)\n      {\n\t__glibcxx_check_insert(__position);\n\treturn iterator(_Base::insert(__position.base(), __x), this);\n      }\n\n      template<typename _InputIterator>\n      void\n      insert(_InputIterator __first, _InputIterator __last)\n      {\n\t__glibcxx_check_valid_range(__first, __last);\n\t_Base::insert(__first, __last);\n      }\n\n      void\n      erase(iterator __position)\n      {\n\t__glibcxx_check_erase(__position);\n\t__position._M_invalidate();\n\t_Base::erase(__position.base());\n      }\n\n      size_type\n      erase(const key_type& __x)\n      {\n\tstd::pair<iterator, iterator> __victims = this->equal_range(__x);\n\tsize_type __count = 0;\n\twhile (__victims.first != __victims.second)\n\t{\n\t  iterator __victim = __victims.first++;\n\t  __victim._M_invalidate();\n\t  _Base::erase(__victim.base());\n\t  ++__count;\n\t}\n\treturn __count;\n      }\n\n      void\n      erase(iterator __first, iterator __last)\n      {\n\t// _GLIBCXX_RESOLVE_LIB_DEFECTS\n\t// 151. can't currently clear() empty container\n\t__glibcxx_check_erase_range(__first, __last);\n\twhile (__first != __last)\n\tthis->erase(__first++);\n      }\n\n      void\n      swap(multiset<_Key,_Compare,_Allocator>& __x)\n      {\n\t_Base::swap(__x);\n\tthis->_M_swap(__x);\n      }\n\n      void\n      clear()\n      { this->erase(begin(), end()); }\n\n      // observers:\n      using _Base::key_comp;\n      using _Base::value_comp;\n\n      // multiset operations:\n      iterator\n      find(const key_type& __x)\n      { return iterator(_Base::find(__x), this); }\n\n      // _GLIBCXX_RESOLVE_LIB_DEFECTS\n      // 214. set::find() missing const overload\n      const_iterator\n      find(const key_type& __x) const\n      { return const_iterator(_Base::find(__x), this); }\n\n      using _Base::count;\n\n      iterator\n      lower_bound(const key_type& __x)\n      { return iterator(_Base::lower_bound(__x), this); }\n\n      // _GLIBCXX_RESOLVE_LIB_DEFECTS\n      // 214. set::find() missing const overload\n      const_iterator\n      lower_bound(const key_type& __x) const\n      { return const_iterator(_Base::lower_bound(__x), this); }\n\n      iterator\n      upper_bound(const key_type& __x)\n      { return iterator(_Base::upper_bound(__x), this); }\n\n      // _GLIBCXX_RESOLVE_LIB_DEFECTS\n      // 214. set::find() missing const overload\n      const_iterator\n      upper_bound(const key_type& __x) const\n      { return const_iterator(_Base::upper_bound(__x), this); }\n\n      std::pair<iterator,iterator>\n      equal_range(const key_type& __x)\n      {\n\ttypedef typename _Base::iterator _Base_iterator;\n\tstd::pair<_Base_iterator, _Base_iterator> __res =\n        _Base::equal_range(__x);\n\treturn std::make_pair(iterator(__res.first, this),\n\t\t\t      iterator(__res.second, this));\n      }\n\n      // _GLIBCXX_RESOLVE_LIB_DEFECTS\n      // 214. set::find() missing const overload\n      std::pair<const_iterator,const_iterator>\n      equal_range(const key_type& __x) const\n      {\n\ttypedef typename _Base::const_iterator _Base_iterator;\n\tstd::pair<_Base_iterator, _Base_iterator> __res =\n        _Base::equal_range(__x);\n\treturn std::make_pair(const_iterator(__res.first, this),\n\t\t\t      const_iterator(__res.second, this));\n      }\n\n      _Base&\n      _M_base() { return *this; }\n\n      const _Base&\n      _M_base() const { return *this; }\n\n    private:\n      void\n      _M_invalidate_all()\n      {\n\ttypedef typename _Base::const_iterator _Base_const_iterator;\n\ttypedef __gnu_debug::_Not_equal_to<_Base_const_iterator> _Not_equal;\n\tthis->_M_invalidate_if(_Not_equal(_M_base().end()));\n      }\n    };\n\n  template<typename _Key, typename _Compare, typename _Allocator>\n    inline bool\n    operator==(const multiset<_Key,_Compare,_Allocator>& __lhs,\n\t       const multiset<_Key,_Compare,_Allocator>& __rhs)\n    { return __lhs._M_base() == __rhs._M_base(); }\n\n  template<typename _Key, typename _Compare, typename _Allocator>\n    inline bool\n    operator!=(const multiset<_Key,_Compare,_Allocator>& __lhs,\n\t       const multiset<_Key,_Compare,_Allocator>& __rhs)\n    { return __lhs._M_base() != __rhs._M_base(); }\n\n  template<typename _Key, typename _Compare, typename _Allocator>\n    inline bool\n    operator<(const multiset<_Key,_Compare,_Allocator>& __lhs,\n\t      const multiset<_Key,_Compare,_Allocator>& __rhs)\n    { return __lhs._M_base() < __rhs._M_base(); }\n\n  template<typename _Key, typename _Compare, typename _Allocator>\n    inline bool\n    operator<=(const multiset<_Key,_Compare,_Allocator>& __lhs,\n\t       const multiset<_Key,_Compare,_Allocator>& __rhs)\n    { return __lhs._M_base() <= __rhs._M_base(); }\n\n  template<typename _Key, typename _Compare, typename _Allocator>\n    inline bool\n    operator>=(const multiset<_Key,_Compare,_Allocator>& __lhs,\n\t       const multiset<_Key,_Compare,_Allocator>& __rhs)\n    { return __lhs._M_base() >= __rhs._M_base(); }\n\n  template<typename _Key, typename _Compare, typename _Allocator>\n    inline bool\n    operator>(const multiset<_Key,_Compare,_Allocator>& __lhs,\n\t      const multiset<_Key,_Compare,_Allocator>& __rhs)\n    { return __lhs._M_base() > __rhs._M_base(); }\n\n  template<typename _Key, typename _Compare, typename _Allocator>\n    void\n    swap(multiset<_Key,_Compare,_Allocator>& __x,\n\t multiset<_Key,_Compare,_Allocator>& __y)\n    { return __x.swap(__y); }\n} // namespace __debug\n} // namespace std\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/debug/safe_base.h",
    "content": "// Safe sequence/iterator base implementation  -*- C++ -*-\n\n// Copyright (C) 2003, 2004, 2005, 2006\n// Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n/** @file debug/safe_base.h\n *  This file is a GNU debug extension to the Standard C++ Library.\n */\n\n#ifndef _GLIBCXX_DEBUG_SAFE_BASE_H\n#define _GLIBCXX_DEBUG_SAFE_BASE_H 1\n\n#include <ext/concurrence.h>\n\nnamespace __gnu_debug\n{\n  class _Safe_sequence_base;\n\n  /** \\brief Basic functionality for a \"safe\" iterator.\n   *\n   *  The %_Safe_iterator_base base class implements the functionality\n   *  of a safe iterator that is not specific to a particular iterator\n   *  type. It contains a pointer back to the sequence it references\n   *  along with iterator version information and pointers to form a\n   *  doubly-linked list of iterators referenced by the container.\n   *\n   *  This class must not perform any operations that can throw an\n   *  exception, or the exception guarantees of derived iterators will\n   *  be broken.\n   */\n  class _Safe_iterator_base\n  {\n  public:\n    /** The sequence this iterator references; may be NULL to indicate\n\ta singular iterator. */\n    _Safe_sequence_base* _M_sequence;\n\n    /** The version number of this iterator. The sentinel value 0 is\n     *  used to indicate an invalidated iterator (i.e., one that is\n     *  singular because of an operation on the container). This\n     *  version number must equal the version number in the sequence\n     *  referenced by _M_sequence for the iterator to be\n     *  non-singular.\n     */\n    unsigned int         _M_version;\n\n    /** Pointer to the previous iterator in the sequence's list of\n\titerators. Only valid when _M_sequence != NULL. */\n    _Safe_iterator_base* _M_prior;\n\n    /** Pointer to the next iterator in the sequence's list of\n\titerators. Only valid when _M_sequence != NULL. */\n    _Safe_iterator_base* _M_next;\n\n  protected:\n    /** Initializes the iterator and makes it singular. */\n    _Safe_iterator_base()\n    : _M_sequence(0), _M_version(0), _M_prior(0), _M_next(0)\n    { }\n\n    /** Initialize the iterator to reference the sequence pointed to\n     *  by @p__seq. @p __constant is true when we are initializing a\n     *  constant iterator, and false if it is a mutable iterator. Note\n     *  that @p __seq may be NULL, in which case the iterator will be\n     *  singular. Otherwise, the iterator will reference @p __seq and\n     *  be nonsingular.\n     */\n    _Safe_iterator_base(const _Safe_sequence_base* __seq, bool __constant)\n    : _M_sequence(0), _M_version(0), _M_prior(0), _M_next(0)\n    { this->_M_attach(const_cast<_Safe_sequence_base*>(__seq), __constant); }\n\n    /** Initializes the iterator to reference the same sequence that\n\t@p __x does. @p __constant is true if this is a constant\n\titerator, and false if it is mutable. */\n    _Safe_iterator_base(const _Safe_iterator_base& __x, bool __constant)\n    : _M_sequence(0), _M_version(0), _M_prior(0), _M_next(0)\n    { this->_M_attach(__x._M_sequence, __constant); }\n\n    _Safe_iterator_base&\n    operator=(const _Safe_iterator_base&);\n\n    explicit\n    _Safe_iterator_base(const _Safe_iterator_base&);\n\n    ~_Safe_iterator_base() { this->_M_detach(); }\n\n    /** For use in _Safe_iterator. */\n    __gnu_cxx::__mutex& _M_get_mutex();\n\n  public:\n    /** Attaches this iterator to the given sequence, detaching it\n     *\tfrom whatever sequence it was attached to originally. If the\n     *\tnew sequence is the NULL pointer, the iterator is left\n     *\tunattached.\n     */\n    void _M_attach(_Safe_sequence_base* __seq, bool __constant);\n\n    /** Likewise, but not thread-safe. */\n    void _M_attach_single(_Safe_sequence_base* __seq, bool __constant);\n\n    /** Detach the iterator for whatever sequence it is attached to,\n     *\tif any.\n    */\n    void _M_detach();\n\n    /** Likewise, but not thread-safe. */\n    void _M_detach_single();\n\n    /** Determines if we are attached to the given sequence. */\n    bool _M_attached_to(const _Safe_sequence_base* __seq) const\n    { return _M_sequence == __seq; }\n\n    /** Is this iterator singular? */\n    bool _M_singular() const;\n\n    /** Can we compare this iterator to the given iterator @p __x?\n\tReturns true if both iterators are nonsingular and reference\n\tthe same sequence. */\n    bool _M_can_compare(const _Safe_iterator_base& __x) const;\n  };\n\n  /**\n   * @brief Base class that supports tracking of iterators that\n   * reference a sequence.\n   *\n   * The %_Safe_sequence_base class provides basic support for\n   * tracking iterators into a sequence. Sequences that track\n   * iterators must derived from %_Safe_sequence_base publicly, so\n   * that safe iterators (which inherit _Safe_iterator_base) can\n   * attach to them. This class contains two linked lists of\n   * iterators, one for constant iterators and one for mutable\n   * iterators, and a version number that allows very fast\n   * invalidation of all iterators that reference the container.\n   *\n   * This class must ensure that no operation on it may throw an\n   * exception, otherwise \"safe\" sequences may fail to provide the\n   * exception-safety guarantees required by the C++ standard.\n   */\n  class _Safe_sequence_base\n  {\n  public:\n    /// The list of mutable iterators that reference this container\n    _Safe_iterator_base* _M_iterators;\n\n    /// The list of constant iterators that reference this container\n    _Safe_iterator_base* _M_const_iterators;\n\n    /// The container version number. This number may never be 0.\n    mutable unsigned int _M_version;\n\n  protected:\n    // Initialize with a version number of 1 and no iterators\n    _Safe_sequence_base()\n    : _M_iterators(0), _M_const_iterators(0), _M_version(1)\n    { }\n\n    /** Notify all iterators that reference this sequence that the\n\tsequence is being destroyed. */\n    ~_Safe_sequence_base()\n    { this->_M_detach_all(); }\n\n    /** Detach all iterators, leaving them singular. */\n    void\n    _M_detach_all();\n\n    /** Detach all singular iterators.\n     *  @post for all iterators i attached to this sequence,\n     *   i->_M_version == _M_version.\n     */\n    void\n    _M_detach_singular();\n\n    /** Revalidates all attached singular iterators.  This method may\n     *  be used to validate iterators that were invalidated before\n     *  (but for some reasion, such as an exception, need to become\n     *  valid again).\n     */\n    void\n    _M_revalidate_singular();\n\n    /** Swap this sequence with the given sequence. This operation\n     *  also swaps ownership of the iterators, so that when the\n     *  operation is complete all iterators that originally referenced\n     *  one container now reference the other container.\n     */\n    void\n    _M_swap(_Safe_sequence_base& __x);\n\n    /** For use in _Safe_sequence. */\n    __gnu_cxx::__mutex& _M_get_mutex();\n\n  public:\n    /** Invalidates all iterators. */\n    void\n    _M_invalidate_all() const\n    { if (++_M_version == 0) _M_version = 1; }\n  };\n} // namespace __gnu_debug\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/debug/safe_iterator.h",
    "content": "// Safe iterator implementation  -*- C++ -*-\n\n// Copyright (C) 2003, 2004, 2005, 2006\n// Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n/** @file debug/safe_iterator.h\n *  This file is a GNU debug extension to the Standard C++ Library.\n */\n\n#ifndef _GLIBCXX_DEBUG_SAFE_ITERATOR_H\n#define _GLIBCXX_DEBUG_SAFE_ITERATOR_H 1\n\n#include <debug/debug.h>\n#include <debug/macros.h>\n#include <debug/functions.h>\n#include <debug/formatter.h>\n#include <debug/safe_base.h>\n#include <bits/stl_pair.h>\n#include <ext/type_traits.h>\n\nnamespace __gnu_debug\n{\n  /** Iterators that derive from _Safe_iterator_base but that aren't\n   *  _Safe_iterators can be determined singular or non-singular via\n   *  _Safe_iterator_base.\n   */\n  inline bool \n  __check_singular_aux(const _Safe_iterator_base* __x)\n  { return __x->_M_singular(); }\n\n  /** \\brief Safe iterator wrapper.\n   *\n   *  The class template %_Safe_iterator is a wrapper around an\n   *  iterator that tracks the iterator's movement among sequences and\n   *  checks that operations performed on the \"safe\" iterator are\n   *  legal. In additional to the basic iterator operations (which are\n   *  validated, and then passed to the underlying iterator),\n   *  %_Safe_iterator has member functions for iterator invalidation,\n   *  attaching/detaching the iterator from sequences, and querying\n   *  the iterator's state.\n   */\n  template<typename _Iterator, typename _Sequence>\n    class _Safe_iterator : public _Safe_iterator_base\n    {\n      typedef _Safe_iterator _Self;\n\n      /** The precision to which we can calculate the distance between\n       *  two iterators.\n       */\n      enum _Distance_precision\n\t{\n\t  __dp_equality, //< Can compare iterator equality, only\n\t  __dp_sign,     //< Can determine equality and ordering\n\t  __dp_exact     //< Can determine distance precisely\n\t};\n\n      /// The underlying iterator\n      _Iterator _M_current;\n\n      /// Determine if this is a constant iterator.\n      bool\n      _M_constant() const\n      {\n\ttypedef typename _Sequence::const_iterator const_iterator;\n\treturn __is_same<const_iterator, _Safe_iterator>::value;\n      }\n\n      typedef std::iterator_traits<_Iterator> _Traits;\n\n    public:\n      typedef _Iterator                           _Base_iterator;\n      typedef typename _Traits::iterator_category iterator_category;\n      typedef typename _Traits::value_type        value_type;\n      typedef typename _Traits::difference_type   difference_type;\n      typedef typename _Traits::reference         reference;\n      typedef typename _Traits::pointer           pointer;\n\n      /// @post the iterator is singular and unattached\n      _Safe_iterator() : _M_current() { }\n\n      /**\n       * @brief Safe iterator construction from an unsafe iterator and\n       * its sequence.\n       *\n       * @pre @p seq is not NULL\n       * @post this is not singular\n       */\n      _Safe_iterator(const _Iterator& __i, const _Sequence* __seq)\n      : _Safe_iterator_base(__seq, _M_constant()), _M_current(__i)\n      {\n\t_GLIBCXX_DEBUG_VERIFY(! this->_M_singular(),\n\t\t\t      _M_message(__msg_init_singular)\n\t\t\t      ._M_iterator(*this, \"this\"));\n      }\n\n      /**\n       * @brief Copy construction.\n       * @pre @p x is not singular\n       */\n      _Safe_iterator(const _Safe_iterator& __x)\n      : _Safe_iterator_base(__x, _M_constant()), _M_current(__x._M_current)\n      {\n\t_GLIBCXX_DEBUG_VERIFY(!__x._M_singular(),\n\t\t\t      _M_message(__msg_init_copy_singular)\n\t\t\t      ._M_iterator(*this, \"this\")\n\t\t\t      ._M_iterator(__x, \"other\"));\n      }\n\n      /**\n       *  @brief Converting constructor from a mutable iterator to a\n       *  constant iterator.\n       *\n       *  @pre @p x is not singular\n      */\n      template<typename _MutableIterator>\n        _Safe_iterator(\n          const _Safe_iterator<_MutableIterator,\n          typename __gnu_cxx::__enable_if<(std::__are_same<_MutableIterator,\n                      typename _Sequence::iterator::_Base_iterator>::__value),\n                   _Sequence>::__type>& __x)\n\t: _Safe_iterator_base(__x, _M_constant()), _M_current(__x.base())\n        {\n\t  _GLIBCXX_DEBUG_VERIFY(!__x._M_singular(),\n\t\t\t\t_M_message(__msg_init_const_singular)\n\t\t\t\t._M_iterator(*this, \"this\")\n\t\t\t\t._M_iterator(__x, \"other\"));\n\t}\n\n      /**\n       * @brief Copy assignment.\n       * @pre @p x is not singular\n       */\n      _Safe_iterator&\n      operator=(const _Safe_iterator& __x)\n      {\n\t_GLIBCXX_DEBUG_VERIFY(!__x._M_singular(),\n\t\t\t      _M_message(__msg_copy_singular)\n\t\t\t      ._M_iterator(*this, \"this\")\n\t\t\t      ._M_iterator(__x, \"other\"));\n\t_M_current = __x._M_current;\n\tthis->_M_attach(static_cast<_Sequence*>(__x._M_sequence));\n\treturn *this;\n      }\n\n      /**\n       *  @brief Iterator dereference.\n       *  @pre iterator is dereferenceable\n       */\n      reference\n      operator*() const\n      {\n\n\t_GLIBCXX_DEBUG_VERIFY(this->_M_dereferenceable(),\n\t\t\t      _M_message(__msg_bad_deref)\n\t\t\t      ._M_iterator(*this, \"this\"));\n\treturn *_M_current;\n      }\n\n      /**\n       *  @brief Iterator dereference.\n       *  @pre iterator is dereferenceable\n       *  @todo Make this correct w.r.t. iterators that return proxies\n       *  @todo Use addressof() instead of & operator\n       */\n      pointer\n      operator->() const\n      {\n\t_GLIBCXX_DEBUG_VERIFY(this->_M_dereferenceable(),\n\t\t\t      _M_message(__msg_bad_deref)\n\t\t\t      ._M_iterator(*this, \"this\"));\n\treturn &*_M_current;\n      }\n\n      // ------ Input iterator requirements ------\n      /**\n       *  @brief Iterator preincrement\n       *  @pre iterator is incrementable\n       */\n      _Safe_iterator&\n      operator++()\n      {\n\t_GLIBCXX_DEBUG_VERIFY(this->_M_incrementable(),\n\t\t\t      _M_message(__msg_bad_inc)\n\t\t\t      ._M_iterator(*this, \"this\"));\n\t++_M_current;\n\treturn *this;\n      }\n\n      /**\n       *  @brief Iterator postincrement\n       *  @pre iterator is incrementable\n       */\n      _Safe_iterator\n      operator++(int)\n      {\n\t_GLIBCXX_DEBUG_VERIFY(this->_M_incrementable(),\n\t\t\t      _M_message(__msg_bad_inc)\n\t\t\t      ._M_iterator(*this, \"this\"));\n\t_Safe_iterator __tmp(*this);\n\t++_M_current;\n\treturn __tmp;\n      }\n\n      // ------ Bidirectional iterator requirements ------\n      /**\n       *  @brief Iterator predecrement\n       *  @pre iterator is decrementable\n       */\n      _Safe_iterator&\n      operator--()\n      {\n\t_GLIBCXX_DEBUG_VERIFY(this->_M_decrementable(),\n\t\t\t      _M_message(__msg_bad_dec)\n\t\t\t      ._M_iterator(*this, \"this\"));\n\t--_M_current;\n\treturn *this;\n      }\n\n      /**\n       *  @brief Iterator postdecrement\n       *  @pre iterator is decrementable\n       */\n      _Safe_iterator\n      operator--(int)\n      {\n\t_GLIBCXX_DEBUG_VERIFY(this->_M_decrementable(),\n\t\t\t      _M_message(__msg_bad_dec)\n\t\t\t      ._M_iterator(*this, \"this\"));\n\t_Safe_iterator __tmp(*this);\n\t--_M_current;\n\treturn __tmp;\n      }\n\n      // ------ Random access iterator requirements ------\n      reference\n      operator[](const difference_type& __n) const\n      {\n\t_GLIBCXX_DEBUG_VERIFY(this->_M_can_advance(__n)\n\t\t\t      && this->_M_can_advance(__n+1),\n\t\t\t      _M_message(__msg_iter_subscript_oob)\n\t\t\t      ._M_iterator(*this)._M_integer(__n));\n\n\treturn _M_current[__n];\n      }\n\n      _Safe_iterator&\n      operator+=(const difference_type& __n)\n      {\n\t_GLIBCXX_DEBUG_VERIFY(this->_M_can_advance(__n),\n\t\t\t      _M_message(__msg_advance_oob)\n\t\t\t      ._M_iterator(*this)._M_integer(__n));\n\t_M_current += __n;\n\treturn *this;\n      }\n\n      _Safe_iterator\n      operator+(const difference_type& __n) const\n      {\n\t_Safe_iterator __tmp(*this);\n\t__tmp += __n;\n\treturn __tmp;\n      }\n\n      _Safe_iterator&\n      operator-=(const difference_type& __n)\n      {\n\t_GLIBCXX_DEBUG_VERIFY(this->_M_can_advance(-__n),\n\t\t\t      _M_message(__msg_retreat_oob)\n\t\t\t      ._M_iterator(*this)._M_integer(__n));\n\t_M_current += -__n;\n\treturn *this;\n      }\n\n      _Safe_iterator\n      operator-(const difference_type& __n) const\n      {\n\t_Safe_iterator __tmp(*this);\n\t__tmp -= __n;\n\treturn __tmp;\n      }\n\n      // ------ Utilities ------\n      /**\n       * @brief Return the underlying iterator\n       */\n      _Iterator\n      base() const { return _M_current; }\n\n      /**\n       * @brief Conversion to underlying non-debug iterator to allow\n       * better interaction with non-debug containers.\n       */\n      operator _Iterator() const { return _M_current; }\n\n      /** Attach iterator to the given sequence. */\n      void\n      _M_attach(const _Sequence* __seq)\n      {\n\t_Safe_iterator_base::_M_attach(const_cast<_Sequence*>(__seq),\n\t\t\t\t       _M_constant());\n      }\n\n      /** Likewise, but not thread-safe. */\n      void\n      _M_attach_single(const _Sequence* __seq)\n      {\n\t_Safe_iterator_base::_M_attach_single(const_cast<_Sequence*>(__seq),\n\t\t\t\t\t      _M_constant());\n      }\n\n      /** Invalidate the iterator, making it singular. */\n      void\n      _M_invalidate();\n\n      /** Likewise, but not thread-safe. */\n      void\n      _M_invalidate_single();\n\n      /// Is the iterator dereferenceable?\n      bool\n      _M_dereferenceable() const\n      { return !this->_M_singular() && !_M_is_end(); }\n\n      /// Is the iterator incrementable?\n      bool\n      _M_incrementable() const { return this->_M_dereferenceable(); }\n\n      // Is the iterator decrementable?\n      bool\n      _M_decrementable() const { return !_M_singular() && !_M_is_begin(); }\n\n      // Can we advance the iterator @p __n steps (@p __n may be negative)\n      bool\n      _M_can_advance(const difference_type& __n) const;\n\n      // Is the iterator range [*this, __rhs) valid?\n      template<typename _Other>\n        bool\n        _M_valid_range(const _Safe_iterator<_Other, _Sequence>& __rhs) const;\n\n      // The sequence this iterator references.\n      const _Sequence*\n      _M_get_sequence() const\n      { return static_cast<const _Sequence*>(_M_sequence); }\n\n    /** Determine the distance between two iterators with some known\n     *\tprecision.\n    */\n    template<typename _Iterator1, typename _Iterator2>\n      static std::pair<difference_type, _Distance_precision>\n      _M_get_distance(const _Iterator1& __lhs, const _Iterator2& __rhs)\n      {\n        typedef typename std::iterator_traits<_Iterator1>::iterator_category\n\t  _Category;\n        return _M_get_distance(__lhs, __rhs, _Category());\n      }\n\n    template<typename _Iterator1, typename _Iterator2>\n      static std::pair<difference_type, _Distance_precision>\n      _M_get_distance(const _Iterator1& __lhs, const _Iterator2& __rhs,\n\t\t      std::random_access_iterator_tag)\n      {\n        return std::make_pair(__rhs.base() - __lhs.base(), __dp_exact);\n      }\n\n    template<typename _Iterator1, typename _Iterator2>\n      static std::pair<difference_type, _Distance_precision>\n      _M_get_distance(const _Iterator1& __lhs, const _Iterator2& __rhs,\n\t\t    std::forward_iterator_tag)\n      {\n        return std::make_pair(__lhs.base() == __rhs.base()? 0 : 1,\n\t\t\t      __dp_equality);\n      }\n\n      /// Is this iterator equal to the sequence's begin() iterator?\n      bool _M_is_begin() const\n      {\treturn *this == static_cast<const _Sequence*>(_M_sequence)->begin(); }\n\n      /// Is this iterator equal to the sequence's end() iterator?\n      bool _M_is_end() const\n      {\treturn *this == static_cast<const _Sequence*>(_M_sequence)->end(); }\n    };\n\n  template<typename _IteratorL, typename _IteratorR, typename _Sequence>\n    inline bool\n    operator==(const _Safe_iterator<_IteratorL, _Sequence>& __lhs,\n\t       const _Safe_iterator<_IteratorR, _Sequence>& __rhs)\n    {\n      _GLIBCXX_DEBUG_VERIFY(! __lhs._M_singular() && ! __rhs._M_singular(),\n\t\t\t    _M_message(__msg_iter_compare_bad)\n\t\t\t    ._M_iterator(__lhs, \"lhs\")\n\t\t\t    ._M_iterator(__rhs, \"rhs\"));\n      _GLIBCXX_DEBUG_VERIFY(__lhs._M_can_compare(__rhs),\n\t\t\t    _M_message(__msg_compare_different)\n\t\t\t    ._M_iterator(__lhs, \"lhs\")\n\t\t\t    ._M_iterator(__rhs, \"rhs\"));\n      return __lhs.base() == __rhs.base();\n    }\n\n  template<typename _Iterator, typename _Sequence>\n    inline bool\n    operator==(const _Safe_iterator<_Iterator, _Sequence>& __lhs,\n               const _Safe_iterator<_Iterator, _Sequence>& __rhs)\n    {\n      _GLIBCXX_DEBUG_VERIFY(! __lhs._M_singular() && ! __rhs._M_singular(),\n\t\t\t    _M_message(__msg_iter_compare_bad)\n\t\t\t    ._M_iterator(__lhs, \"lhs\")\n\t\t\t    ._M_iterator(__rhs, \"rhs\"));\n      _GLIBCXX_DEBUG_VERIFY(__lhs._M_can_compare(__rhs),\n\t\t\t    _M_message(__msg_compare_different)\n\t\t\t    ._M_iterator(__lhs, \"lhs\")\n\t\t\t    ._M_iterator(__rhs, \"rhs\"));\n      return __lhs.base() == __rhs.base();\n    }\n\n  template<typename _IteratorL, typename _IteratorR, typename _Sequence>\n    inline bool\n    operator!=(const _Safe_iterator<_IteratorL, _Sequence>& __lhs,\n\t       const _Safe_iterator<_IteratorR, _Sequence>& __rhs)\n    {\n      _GLIBCXX_DEBUG_VERIFY(! __lhs._M_singular() && ! __rhs._M_singular(),\n\t\t\t    _M_message(__msg_iter_compare_bad)\n\t\t\t    ._M_iterator(__lhs, \"lhs\")\n\t\t\t    ._M_iterator(__rhs, \"rhs\"));\n      _GLIBCXX_DEBUG_VERIFY(__lhs._M_can_compare(__rhs),\n\t\t\t    _M_message(__msg_compare_different)\n\t\t\t    ._M_iterator(__lhs, \"lhs\")\n\t\t\t    ._M_iterator(__rhs, \"rhs\"));\n      return __lhs.base() != __rhs.base();\n    }\n\n  template<typename _Iterator, typename _Sequence>\n    inline bool\n    operator!=(const _Safe_iterator<_Iterator, _Sequence>& __lhs,\n               const _Safe_iterator<_Iterator, _Sequence>& __rhs)\n    {\n      _GLIBCXX_DEBUG_VERIFY(! __lhs._M_singular() && ! __rhs._M_singular(),\n\t\t\t    _M_message(__msg_iter_compare_bad)\n\t\t\t    ._M_iterator(__lhs, \"lhs\")\n\t\t\t    ._M_iterator(__rhs, \"rhs\"));\n      _GLIBCXX_DEBUG_VERIFY(__lhs._M_can_compare(__rhs),\n\t\t\t    _M_message(__msg_compare_different)\n\t\t\t    ._M_iterator(__lhs, \"lhs\")\n\t\t\t    ._M_iterator(__rhs, \"rhs\"));\n      return __lhs.base() != __rhs.base();\n    }\n\n  template<typename _IteratorL, typename _IteratorR, typename _Sequence>\n    inline bool\n    operator<(const _Safe_iterator<_IteratorL, _Sequence>& __lhs,\n\t      const _Safe_iterator<_IteratorR, _Sequence>& __rhs)\n    {\n      _GLIBCXX_DEBUG_VERIFY(! __lhs._M_singular() && ! __rhs._M_singular(),\n\t\t\t    _M_message(__msg_iter_order_bad)\n\t\t\t    ._M_iterator(__lhs, \"lhs\")\n\t\t\t    ._M_iterator(__rhs, \"rhs\"));\n      _GLIBCXX_DEBUG_VERIFY(__lhs._M_can_compare(__rhs),\n\t\t\t    _M_message(__msg_order_different)\n\t\t\t    ._M_iterator(__lhs, \"lhs\")\n\t\t\t    ._M_iterator(__rhs, \"rhs\"));\n      return __lhs.base() < __rhs.base();\n    }\n\n  template<typename _Iterator, typename _Sequence>\n    inline bool\n    operator<(const _Safe_iterator<_Iterator, _Sequence>& __lhs,\n\t      const _Safe_iterator<_Iterator, _Sequence>& __rhs)\n    {\n      _GLIBCXX_DEBUG_VERIFY(! __lhs._M_singular() && ! __rhs._M_singular(),\n\t\t\t    _M_message(__msg_iter_order_bad)\n\t\t\t    ._M_iterator(__lhs, \"lhs\")\n\t\t\t    ._M_iterator(__rhs, \"rhs\"));\n      _GLIBCXX_DEBUG_VERIFY(__lhs._M_can_compare(__rhs),\n\t\t\t    _M_message(__msg_order_different)\n\t\t\t    ._M_iterator(__lhs, \"lhs\")\n\t\t\t    ._M_iterator(__rhs, \"rhs\"));\n      return __lhs.base() < __rhs.base();\n    }\n\n  template<typename _IteratorL, typename _IteratorR, typename _Sequence>\n    inline bool\n    operator<=(const _Safe_iterator<_IteratorL, _Sequence>& __lhs,\n\t       const _Safe_iterator<_IteratorR, _Sequence>& __rhs)\n    {\n      _GLIBCXX_DEBUG_VERIFY(! __lhs._M_singular() && ! __rhs._M_singular(),\n\t\t\t    _M_message(__msg_iter_order_bad)\n\t\t\t    ._M_iterator(__lhs, \"lhs\")\n\t\t\t    ._M_iterator(__rhs, \"rhs\"));\n      _GLIBCXX_DEBUG_VERIFY(__lhs._M_can_compare(__rhs),\n\t\t\t    _M_message(__msg_order_different)\n\t\t\t    ._M_iterator(__lhs, \"lhs\")\n\t\t\t    ._M_iterator(__rhs, \"rhs\"));\n      return __lhs.base() <= __rhs.base();\n    }\n\n  template<typename _Iterator, typename _Sequence>\n    inline bool\n    operator<=(const _Safe_iterator<_Iterator, _Sequence>& __lhs,\n               const _Safe_iterator<_Iterator, _Sequence>& __rhs)\n    {\n      _GLIBCXX_DEBUG_VERIFY(! __lhs._M_singular() && ! __rhs._M_singular(),\n\t\t\t    _M_message(__msg_iter_order_bad)\n\t\t\t    ._M_iterator(__lhs, \"lhs\")\n\t\t\t    ._M_iterator(__rhs, \"rhs\"));\n      _GLIBCXX_DEBUG_VERIFY(__lhs._M_can_compare(__rhs),\n\t\t\t    _M_message(__msg_order_different)\n\t\t\t    ._M_iterator(__lhs, \"lhs\")\n\t\t\t    ._M_iterator(__rhs, \"rhs\"));\n      return __lhs.base() <= __rhs.base();\n    }\n\n  template<typename _IteratorL, typename _IteratorR, typename _Sequence>\n    inline bool\n    operator>(const _Safe_iterator<_IteratorL, _Sequence>& __lhs,\n\t      const _Safe_iterator<_IteratorR, _Sequence>& __rhs)\n    {\n      _GLIBCXX_DEBUG_VERIFY(! __lhs._M_singular() && ! __rhs._M_singular(),\n\t\t\t    _M_message(__msg_iter_order_bad)\n\t\t\t    ._M_iterator(__lhs, \"lhs\")\n\t\t\t    ._M_iterator(__rhs, \"rhs\"));\n      _GLIBCXX_DEBUG_VERIFY(__lhs._M_can_compare(__rhs),\n\t\t\t    _M_message(__msg_order_different)\n\t\t\t    ._M_iterator(__lhs, \"lhs\")\n\t\t\t    ._M_iterator(__rhs, \"rhs\"));\n      return __lhs.base() > __rhs.base();\n    }\n\n  template<typename _Iterator, typename _Sequence>\n    inline bool\n    operator>(const _Safe_iterator<_Iterator, _Sequence>& __lhs,\n\t      const _Safe_iterator<_Iterator, _Sequence>& __rhs)\n    {\n      _GLIBCXX_DEBUG_VERIFY(! __lhs._M_singular() && ! __rhs._M_singular(),\n\t\t\t    _M_message(__msg_iter_order_bad)\n\t\t\t    ._M_iterator(__lhs, \"lhs\")\n\t\t\t    ._M_iterator(__rhs, \"rhs\"));\n      _GLIBCXX_DEBUG_VERIFY(__lhs._M_can_compare(__rhs),\n\t\t\t    _M_message(__msg_order_different)\n\t\t\t    ._M_iterator(__lhs, \"lhs\")\n\t\t\t    ._M_iterator(__rhs, \"rhs\"));\n      return __lhs.base() > __rhs.base();\n    }\n\n  template<typename _IteratorL, typename _IteratorR, typename _Sequence>\n    inline bool\n    operator>=(const _Safe_iterator<_IteratorL, _Sequence>& __lhs,\n\t       const _Safe_iterator<_IteratorR, _Sequence>& __rhs)\n    {\n      _GLIBCXX_DEBUG_VERIFY(! __lhs._M_singular() && ! __rhs._M_singular(),\n\t\t\t    _M_message(__msg_iter_order_bad)\n\t\t\t    ._M_iterator(__lhs, \"lhs\")\n\t\t\t    ._M_iterator(__rhs, \"rhs\"));\n      _GLIBCXX_DEBUG_VERIFY(__lhs._M_can_compare(__rhs),\n\t\t\t    _M_message(__msg_order_different)\n\t\t\t    ._M_iterator(__lhs, \"lhs\")\n\t\t\t    ._M_iterator(__rhs, \"rhs\"));\n      return __lhs.base() >= __rhs.base();\n    }\n\n  template<typename _Iterator, typename _Sequence>\n    inline bool\n    operator>=(const _Safe_iterator<_Iterator, _Sequence>& __lhs,\n               const _Safe_iterator<_Iterator, _Sequence>& __rhs)\n    {\n      _GLIBCXX_DEBUG_VERIFY(! __lhs._M_singular() && ! __rhs._M_singular(),\n\t\t\t    _M_message(__msg_iter_order_bad)\n\t\t\t    ._M_iterator(__lhs, \"lhs\")\n\t\t\t    ._M_iterator(__rhs, \"rhs\"));\n      _GLIBCXX_DEBUG_VERIFY(__lhs._M_can_compare(__rhs),\n\t\t\t    _M_message(__msg_order_different)\n\t\t\t    ._M_iterator(__lhs, \"lhs\")\n\t\t\t    ._M_iterator(__rhs, \"rhs\"));\n      return __lhs.base() >= __rhs.base();\n    }\n\n  // _GLIBCXX_RESOLVE_LIB_DEFECTS\n  // According to the resolution of DR179 not only the various comparison\n  // operators but also operator- must accept mixed iterator/const_iterator\n  // parameters.\n  template<typename _IteratorL, typename _IteratorR, typename _Sequence>\n    inline typename _Safe_iterator<_IteratorL, _Sequence>::difference_type\n    operator-(const _Safe_iterator<_IteratorL, _Sequence>& __lhs,\n\t      const _Safe_iterator<_IteratorR, _Sequence>& __rhs)\n    {\n      _GLIBCXX_DEBUG_VERIFY(! __lhs._M_singular() && ! __rhs._M_singular(),\n\t\t\t    _M_message(__msg_distance_bad)\n\t\t\t    ._M_iterator(__lhs, \"lhs\")\n\t\t\t    ._M_iterator(__rhs, \"rhs\"));\n      _GLIBCXX_DEBUG_VERIFY(__lhs._M_can_compare(__rhs),\n\t\t\t    _M_message(__msg_distance_different)\n\t\t\t    ._M_iterator(__lhs, \"lhs\")\n\t\t\t    ._M_iterator(__rhs, \"rhs\"));\n      return __lhs.base() - __rhs.base();\n    }\n\n   template<typename _Iterator, typename _Sequence>\n     inline typename _Safe_iterator<_Iterator, _Sequence>::difference_type\n     operator-(const _Safe_iterator<_Iterator, _Sequence>& __lhs,\n\t       const _Safe_iterator<_Iterator, _Sequence>& __rhs)\n     {\n       _GLIBCXX_DEBUG_VERIFY(! __lhs._M_singular() && ! __rhs._M_singular(),\n\t\t\t     _M_message(__msg_distance_bad)\n\t\t\t     ._M_iterator(__lhs, \"lhs\")\n\t\t\t     ._M_iterator(__rhs, \"rhs\"));\n       _GLIBCXX_DEBUG_VERIFY(__lhs._M_can_compare(__rhs),\n\t\t\t     _M_message(__msg_distance_different)\n\t\t\t     ._M_iterator(__lhs, \"lhs\")\n\t\t\t     ._M_iterator(__rhs, \"rhs\"));\n       return __lhs.base() - __rhs.base();\n     }\n\n  template<typename _Iterator, typename _Sequence>\n    inline _Safe_iterator<_Iterator, _Sequence>\n    operator+(typename _Safe_iterator<_Iterator,_Sequence>::difference_type __n,\n\t      const _Safe_iterator<_Iterator, _Sequence>& __i)\n    { return __i + __n; }\n} // namespace __gnu_debug\n\n#ifndef _GLIBCXX_EXPORT_TEMPLATE\n#  include <debug/safe_iterator.tcc>\n#endif\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/debug/safe_iterator.tcc",
    "content": "// Debugging iterator implementation (out of line) -*- C++ -*-\n\n// Copyright (C) 2003, 2004, 2005, 2006\n// Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n/** @file debug/safe_iterator.tcc\n *  This file is a GNU debug extension to the Standard C++ Library.\n */\n\n#ifndef _GLIBCXX_DEBUG_SAFE_ITERATOR_TCC\n#define _GLIBCXX_DEBUG_SAFE_ITERATOR_TCC 1\n\nnamespace __gnu_debug\n{\n  template<typename _Iterator, typename _Sequence>\n    bool\n    _Safe_iterator<_Iterator, _Sequence>::\n    _M_can_advance(const difference_type& __n) const\n    {\n      typedef typename _Sequence::const_iterator const_iterator;\n\n      if (this->_M_singular())\n\treturn false;\n      if (__n == 0)\n\treturn true;\n      if (__n < 0)\n\t{\n\t  const_iterator __begin =\n\t    static_cast<const _Sequence*>(_M_sequence)->begin();\n\t  std::pair<difference_type, _Distance_precision> __dist =\n\t    this->_M_get_distance(__begin, *this);\n\t  bool __ok =  (__dist.second == __dp_exact && __dist.first >= -__n\n\t\t\t|| __dist.second != __dp_exact && __dist.first > 0);\n\t  return __ok;\n\t}\n      else\n\t{\n\t  const_iterator __end =\n\t    static_cast<const _Sequence*>(_M_sequence)->end();\n\t  std::pair<difference_type, _Distance_precision> __dist =\n\t    this->_M_get_distance(*this, __end);\n\t  bool __ok = (__dist.second == __dp_exact && __dist.first >= __n\n\t\t       || __dist.second != __dp_exact && __dist.first > 0);\n\t  return __ok;\n\t}\n    }\n\n  template<typename _Iterator, typename _Sequence>\n    template<typename _Other>\n      bool\n      _Safe_iterator<_Iterator, _Sequence>::\n      _M_valid_range(const _Safe_iterator<_Other, _Sequence>& __rhs) const\n      {\n\tif (!_M_can_compare(__rhs))\n\t  return false;\n\n\t/* Determine if we can order the iterators without the help of\n\t   the container */\n\tstd::pair<difference_type, _Distance_precision> __dist =\n\t  this->_M_get_distance(*this, __rhs);\n\tswitch (__dist.second) {\n\tcase __dp_equality:\n\t  if (__dist.first == 0)\n\t    return true;\n\t  break;\n\n\tcase __dp_sign:\n\tcase __dp_exact:\n\t  return __dist.first >= 0;\n\t}\n\n\t/* We can only test for equality, but check if one of the\n\t   iterators is at an extreme. */\n\tif (_M_is_begin() || __rhs._M_is_end())\n\t  return true;\n\telse if (_M_is_end() || __rhs._M_is_begin())\n\t  return false;\n\n\t// Assume that this is a valid range; we can't check anything else\n\treturn true;\n      }\n\n  template<typename _Iterator, typename _Sequence>\n    void\n    _Safe_iterator<_Iterator, _Sequence>::\n    _M_invalidate()\n    {\n      __gnu_cxx::__scoped_lock sentry(this->_M_get_mutex());\n      _M_invalidate_single();\n    }\n\n  template<typename _Iterator, typename _Sequence>\n    void\n    _Safe_iterator<_Iterator, _Sequence>::\n    _M_invalidate_single()\n    {\n      typedef typename _Sequence::iterator iterator;\n      typedef typename _Sequence::const_iterator const_iterator;\n\n      if (!this->_M_singular())\n\t{\n\t  for (_Safe_iterator_base* __iter = _M_sequence->_M_iterators;\n\t       __iter; __iter = __iter->_M_next)\n\t    {\n\t      iterator* __victim = static_cast<iterator*>(__iter);\n\t      if (this->base() == __victim->base())\n\t\t__victim->_M_version = 0;\n\t    }\n\n\t  for (_Safe_iterator_base* __iter2 = _M_sequence->_M_const_iterators;\n\t       __iter2; __iter2 = __iter2->_M_next)\n\t    {\n\t      const_iterator* __victim = static_cast<const_iterator*>(__iter2);\n\t      if (__victim->base() == this->base())\n\t\t__victim->_M_version = 0;\n\t    }\n\t  _M_version = 0;\n\t}\n    }\n} // namespace __gnu_debug\n\n#endif\n\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/debug/safe_sequence.h",
    "content": "// Safe sequence implementation  -*- C++ -*-\n\n// Copyright (C) 2003, 2004, 2005, 2006\n// Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n/** @file debug/safe_sequence.h\n *  This file is a GNU debug extension to the Standard C++ Library.\n */\n\n#ifndef _GLIBCXX_DEBUG_SAFE_SEQUENCE_H\n#define _GLIBCXX_DEBUG_SAFE_SEQUENCE_H 1\n\n#include <debug/debug.h>\n#include <debug/macros.h>\n#include <debug/functions.h>\n#include <debug/safe_base.h>\n\nnamespace __gnu_debug\n{\n  template<typename _Iterator, typename _Sequence>\n    class _Safe_iterator;\n\n  /** A simple function object that returns true if the passed-in\n   *  value is not equal to the stored value. It saves typing over\n   *  using both bind1st and not_equal.\n   */\n  template<typename _Type>\n    class _Not_equal_to\n    {\n      _Type __value;\n\n    public:\n      explicit _Not_equal_to(const _Type& __v) : __value(__v) { }\n\n      bool\n      operator()(const _Type& __x) const\n      { return __value != __x; }\n    };\n\n  /** A function object that returns true when the given random access\n      iterator is at least @c n steps away from the given iterator. */\n  template<typename _Iterator>\n    class _After_nth_from\n    {\n      typedef typename std::iterator_traits<_Iterator>::difference_type\n      difference_type;\n\n      _Iterator _M_base;\n      difference_type _M_n;\n\n    public:\n      _After_nth_from(const difference_type& __n, const _Iterator& __base)\n      : _M_base(__base), _M_n(__n) { }\n\n      bool\n      operator()(const _Iterator& __x) const\n      { return __x - _M_base >= _M_n; }\n    };\n\n  /**\n   * @brief Base class for constructing a \"safe\" sequence type that\n   * tracks iterators that reference it.\n   *\n   * The class template %_Safe_sequence simplifies the construction of\n   * \"safe\" sequences that track the iterators that reference the\n   * sequence, so that the iterators are notified of changes in the\n   * sequence that may affect their operation, e.g., if the container\n   * invalidates its iterators or is destructed. This class template\n   * may only be used by deriving from it and passing the name of the\n   * derived class as its template parameter via the curiously\n   * recurring template pattern. The derived class must have @c\n   * iterator and @const_iterator types that are instantiations of\n   * class template _Safe_iterator for this sequence. Iterators will\n   * then be tracked automatically.\n   */\n  template<typename _Sequence>\n    class _Safe_sequence : public _Safe_sequence_base\n    {\n    public:\n      /** Invalidates all iterators @c x that reference this sequence,\n\t  are not singular, and for which @c pred(x) returns @c\n\t  true. The user of this routine should be careful not to make\n\t  copies of the iterators passed to @p pred, as the copies may\n\t  interfere with the invalidation. */\n      template<typename _Predicate>\n        void\n        _M_invalidate_if(_Predicate __pred);\n\n      /** Transfers all iterators that reference this memory location\n\t  to this sequence from whatever sequence they are attached\n\t  to. */\n      template<typename _Iterator>\n        void\n        _M_transfer_iter(const _Safe_iterator<_Iterator, _Sequence>& __x);\n    };\n\n  template<typename _Sequence>\n    template<typename _Predicate>\n      void\n      _Safe_sequence<_Sequence>::\n      _M_invalidate_if(_Predicate __pred)\n      {\n        typedef typename _Sequence::iterator iterator;\n        typedef typename _Sequence::const_iterator const_iterator;\n\n\t__gnu_cxx::__scoped_lock sentry(this->_M_get_mutex());\n        for (_Safe_iterator_base* __iter = _M_iterators; __iter;)\n\t  {\n\t    iterator* __victim = static_cast<iterator*>(__iter);\n\t    __iter = __iter->_M_next;\n\t    if (!__victim->_M_singular())\n\t      {\n\t\tif (__pred(__victim->base()))\n\t\t  __victim->_M_invalidate_single();\n\t      }\n\t  }\n\n        for (_Safe_iterator_base* __iter2 = _M_const_iterators; __iter2;)\n\t  {\n\t    const_iterator* __victim = static_cast<const_iterator*>(__iter2);\n\t    __iter2 = __iter2->_M_next;\n\t    if (!__victim->_M_singular())\n\t      {\n\t\tif (__pred(__victim->base()))\n\t\t  __victim->_M_invalidate_single();\n\t      }\n\t  }\n      }\n\n  template<typename _Sequence>\n    template<typename _Iterator>\n      void\n      _Safe_sequence<_Sequence>::\n      _M_transfer_iter(const _Safe_iterator<_Iterator, _Sequence>& __x)\n      {\n\t_Safe_sequence_base* __from = __x._M_sequence;\n\tif (!__from)\n\t  return;\n\n        typedef typename _Sequence::iterator iterator;\n        typedef typename _Sequence::const_iterator const_iterator;\n\n\t__gnu_cxx::__scoped_lock sentry(this->_M_get_mutex());\n        for (_Safe_iterator_base* __iter = __from->_M_iterators; __iter;)\n\t  {\n\t    iterator* __victim = static_cast<iterator*>(__iter);\n\t    __iter = __iter->_M_next;\n\t    if (!__victim->_M_singular() && __victim->base() == __x.base())\n\t      __victim->_M_attach_single(static_cast<_Sequence*>(this));\n\t  }\n\n        for (_Safe_iterator_base* __iter2 = __from->_M_const_iterators; \n\t     __iter2;)\n\t  {\n\t    const_iterator* __victim = static_cast<const_iterator*>(__iter2);\n\t    __iter2 = __iter2->_M_next;\n\t    if (!__victim->_M_singular() && __victim->base() == __x.base())\n\t      __victim->_M_attach_single(static_cast<_Sequence*>(this));\n\t  }\n      }\n} // namespace __gnu_debug\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/debug/set",
    "content": "// Debugging set/multiset implementation -*- C++ -*-\n\n// Copyright (C) 2003\n// Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n/** @file debug/set\n *  This file is a GNU debug extension to the Standard C++ Library.\n */\n\n#ifndef _GLIBCXX_DEBUG_SET\n#define _GLIBCXX_DEBUG_SET 1\n\n#include <set>\n#include <debug/set.h>\n#include <debug/multiset.h>\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/debug/set.h",
    "content": "// Debugging set implementation -*- C++ -*-\n\n// Copyright (C) 2003, 2004, 2005\n// Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n/** @file debug/set.h\n *  This file is a GNU debug extension to the Standard C++ Library.\n */\n\n#ifndef _GLIBCXX_DEBUG_SET_H\n#define _GLIBCXX_DEBUG_SET_H 1\n\n#include <debug/safe_sequence.h>\n#include <debug/safe_iterator.h>\n#include <utility>\n\nnamespace std \n{\nnamespace __debug\n{\n  template<typename _Key, typename _Compare = std::less<_Key>,\n\t   typename _Allocator = std::allocator<_Key> >\n    class set\n    : public _GLIBCXX_STD::set<_Key,_Compare,_Allocator>,\n      public __gnu_debug::_Safe_sequence<set<_Key, _Compare, _Allocator> >\n    {\n      typedef _GLIBCXX_STD::set<_Key,_Compare,_Allocator> _Base;\n      typedef __gnu_debug::_Safe_sequence<set> _Safe_base;\n\n    public:\n      // types:\n      typedef _Key\t\t\t\t    key_type;\n      typedef _Key\t\t\t\t    value_type;\n      typedef _Compare\t\t\t\t    key_compare;\n      typedef _Compare\t\t\t\t    value_compare;\n      typedef _Allocator\t\t\t    allocator_type;\n      typedef typename _Base::reference             reference;\n      typedef typename _Base::const_reference       const_reference;\n\n      typedef __gnu_debug::_Safe_iterator<typename _Base::iterator, set>\n                                                    iterator;\n      typedef __gnu_debug::_Safe_iterator<typename _Base::const_iterator, set>\n                                                    const_iterator;\n\n      typedef typename _Base::size_type             size_type;\n      typedef typename _Base::difference_type       difference_type;\n      typedef typename _Base::pointer               pointer;\n      typedef typename _Base::const_pointer         const_pointer;\n      typedef std::reverse_iterator<iterator>       reverse_iterator;\n      typedef std::reverse_iterator<const_iterator> const_reverse_iterator;\n\n      // 23.3.3.1 construct/copy/destroy:\n      explicit set(const _Compare& __comp = _Compare(),\n\t\t   const _Allocator& __a = _Allocator())\n      : _Base(__comp, __a) { }\n\n      template<typename _InputIterator>\n        set(_InputIterator __first, _InputIterator __last,\n\t    const _Compare& __comp = _Compare(),\n\t    const _Allocator& __a = _Allocator())\n\t: _Base(__gnu_debug::__check_valid_range(__first, __last), __last,\n\t\t__comp, __a) { }\n\n      set(const set<_Key,_Compare,_Allocator>& __x)\n      : _Base(__x), _Safe_base() { }\n\n      set(const _Base& __x) : _Base(__x), _Safe_base() { }\n\n      ~set() { }\n\n      set<_Key,_Compare,_Allocator>&\n      operator=(const set<_Key,_Compare,_Allocator>& __x)\n      {\n\t*static_cast<_Base*>(this) = __x;\n\tthis->_M_invalidate_all();\n\treturn *this;\n      }\n\n      using _Base::get_allocator;\n\n      // iterators:\n      iterator\n      begin()\n      { return iterator(_Base::begin(), this); }\n\n      const_iterator\n      begin() const\n      { return const_iterator(_Base::begin(), this); }\n\n      iterator\n      end()\n      { return iterator(_Base::end(), this); }\n\n      const_iterator\n      end() const\n      { return const_iterator(_Base::end(), this); }\n\n      reverse_iterator\n      rbegin()\n      { return reverse_iterator(end()); }\n\n      const_reverse_iterator\n      rbegin() const\n      { return const_reverse_iterator(end()); }\n\n      reverse_iterator\n      rend()\n      { return reverse_iterator(begin()); }\n\n      const_reverse_iterator\n      rend() const\n      { return const_reverse_iterator(begin()); }\n\n      // capacity:\n      using _Base::empty;\n      using _Base::size;\n      using _Base::max_size;\n\n      // modifiers:\n      std::pair<iterator, bool>\n      insert(const value_type& __x)\n      {\n\ttypedef typename _Base::iterator _Base_iterator;\n\tstd::pair<_Base_iterator, bool> __res = _Base::insert(__x);\n\treturn std::pair<iterator, bool>(iterator(__res.first, this),\n\t\t\t\t\t __res.second);\n      }\n\n      iterator\n      insert(iterator __position, const value_type& __x)\n      {\n\t__glibcxx_check_insert(__position);\n\treturn iterator(_Base::insert(__position.base(), __x), this);\n      }\n\n      template <typename _InputIterator>\n        void\n        insert(_InputIterator __first, _InputIterator __last)\n        {\n\t  __glibcxx_check_valid_range(__first, __last);\n\t  _Base::insert(__first, __last);\n\t}\n\n      void\n      erase(iterator __position)\n      {\n\t__glibcxx_check_erase(__position);\n\t__position._M_invalidate();\n\t_Base::erase(__position.base());\n      }\n\n      size_type\n      erase(const key_type& __x)\n      {\n\titerator __victim = find(__x);\n\tif (__victim == end())\n          return 0;\n\telse\n        {\n\t  __victim._M_invalidate();\n\t  _Base::erase(__victim.base());\n\t  return 1;\n        }\n      }\n\n      void\n      erase(iterator __first, iterator __last)\n      {\n\t// _GLIBCXX_RESOLVE_LIB_DEFECTS\n\t// 151. can't currently clear() empty container\n\t__glibcxx_check_erase_range(__first, __last);\n\n\twhile (__first != __last)\n        this->erase(__first++);\n      }\n\n      void\n      swap(set<_Key,_Compare,_Allocator>& __x)\n      {\n\t_Base::swap(__x);\n\tthis->_M_swap(__x);\n      }\n\n      void\n      clear()\n      { this->erase(begin(), end()); }\n\n      // observers:\n      using _Base::key_comp;\n      using _Base::value_comp;\n\n      // set operations:\n      iterator\n      find(const key_type& __x)\n      { return iterator(_Base::find(__x), this); }\n\n      // _GLIBCXX_RESOLVE_LIB_DEFECTS\n      // 214. set::find() missing const overload\n      const_iterator\n      find(const key_type& __x) const\n      { return const_iterator(_Base::find(__x), this); }\n\n      using _Base::count;\n\n      iterator\n      lower_bound(const key_type& __x)\n      { return iterator(_Base::lower_bound(__x), this); }\n\n      // _GLIBCXX_RESOLVE_LIB_DEFECTS\n      // 214. set::find() missing const overload\n      const_iterator\n      lower_bound(const key_type& __x) const\n      { return const_iterator(_Base::lower_bound(__x), this); }\n\n      iterator\n      upper_bound(const key_type& __x)\n      { return iterator(_Base::upper_bound(__x), this); }\n\n      // _GLIBCXX_RESOLVE_LIB_DEFECTS\n      // 214. set::find() missing const overload\n      const_iterator\n      upper_bound(const key_type& __x) const\n      { return const_iterator(_Base::upper_bound(__x), this); }\n\n      std::pair<iterator,iterator>\n      equal_range(const key_type& __x)\n      {\n\ttypedef typename _Base::iterator _Base_iterator;\n\tstd::pair<_Base_iterator, _Base_iterator> __res =\n        _Base::equal_range(__x);\n\treturn std::make_pair(iterator(__res.first, this),\n\t\t\t      iterator(__res.second, this));\n      }\n\n      // _GLIBCXX_RESOLVE_LIB_DEFECTS\n      // 214. set::find() missing const overload\n      std::pair<const_iterator,const_iterator>\n      equal_range(const key_type& __x) const\n      {\n\ttypedef typename _Base::const_iterator _Base_iterator;\n\tstd::pair<_Base_iterator, _Base_iterator> __res =\n        _Base::equal_range(__x);\n\treturn std::make_pair(const_iterator(__res.first, this),\n\t\t\t      const_iterator(__res.second, this));\n      }\n\n      _Base&\n      _M_base() { return *this; }\n\n      const _Base&\n      _M_base() const { return *this; }\n\n    private:\n      void\n      _M_invalidate_all()\n      {\n\ttypedef typename _Base::const_iterator _Base_const_iterator;\n\ttypedef __gnu_debug::_Not_equal_to<_Base_const_iterator> _Not_equal;\n\tthis->_M_invalidate_if(_Not_equal(_M_base().end()));\n      }\n    };\n\n  template<typename _Key, typename _Compare, typename _Allocator>\n    inline bool\n    operator==(const set<_Key,_Compare,_Allocator>& __lhs,\n\t       const set<_Key,_Compare,_Allocator>& __rhs)\n    { return __lhs._M_base() == __rhs._M_base(); }\n\n  template<typename _Key, typename _Compare, typename _Allocator>\n    inline bool\n    operator!=(const set<_Key,_Compare,_Allocator>& __lhs,\n\t       const set<_Key,_Compare,_Allocator>& __rhs)\n    { return __lhs._M_base() != __rhs._M_base(); }\n\n  template<typename _Key, typename _Compare, typename _Allocator>\n    inline bool\n    operator<(const set<_Key,_Compare,_Allocator>& __lhs,\n\t      const set<_Key,_Compare,_Allocator>& __rhs)\n    { return __lhs._M_base() < __rhs._M_base(); }\n\n  template<typename _Key, typename _Compare, typename _Allocator>\n    inline bool\n    operator<=(const set<_Key,_Compare,_Allocator>& __lhs,\n\t       const set<_Key,_Compare,_Allocator>& __rhs)\n    { return __lhs._M_base() <= __rhs._M_base(); }\n\n  template<typename _Key, typename _Compare, typename _Allocator>\n    inline bool\n    operator>=(const set<_Key,_Compare,_Allocator>& __lhs,\n\t       const set<_Key,_Compare,_Allocator>& __rhs)\n    { return __lhs._M_base() >= __rhs._M_base(); }\n\n  template<typename _Key, typename _Compare, typename _Allocator>\n    inline bool\n    operator>(const set<_Key,_Compare,_Allocator>& __lhs,\n\t      const set<_Key,_Compare,_Allocator>& __rhs)\n    { return __lhs._M_base() > __rhs._M_base(); }\n\n  template<typename _Key, typename _Compare, typename _Allocator>\n    void\n    swap(set<_Key,_Compare,_Allocator>& __x,\n\t set<_Key,_Compare,_Allocator>& __y)\n    { return __x.swap(__y); }\n} // namespace __debug\n} // namespace std\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/debug/string",
    "content": "// Debugging string implementation -*- C++ -*-\n\n// Copyright (C) 2003, 2005, 2006\n// Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n/** @file debug/string\n *  This file is a GNU debug extension to the Standard C++ Library.\n */\n\n#ifndef _GLIBCXX_DEBUG_STRING\n#define _GLIBCXX_DEBUG_STRING 1\n\n#include <string>\n#include <debug/safe_sequence.h>\n#include <debug/safe_iterator.h>\n\nnamespace __gnu_debug\n{\n  template<typename _CharT, typename _Traits = std::char_traits<_CharT>,\n            typename _Allocator = std::allocator<_CharT> >\n    class basic_string\n    : public std::basic_string<_CharT, _Traits, _Allocator>,\n      public __gnu_debug::_Safe_sequence<basic_string<_CharT, _Traits,\n\t\t\t\t\t\t      _Allocator> >\n    {\n      typedef std::basic_string<_CharT, _Traits, _Allocator> _Base;\n      typedef __gnu_debug::_Safe_sequence<basic_string>     _Safe_base;\n\n  public:\n    // types:\n    typedef _Traits\t\t\t\t       traits_type;\n    typedef typename _Traits::char_type\t\t       value_type;\n    typedef _Allocator\t\t\t\t       allocator_type;\n    typedef typename _Base::size_type                  size_type;\n    typedef typename _Base::difference_type            difference_type;\n    typedef typename _Base::reference                  reference;\n    typedef typename _Base::const_reference            const_reference;\n    typedef typename _Base::pointer                    pointer;\n    typedef typename _Base::const_pointer              const_pointer;\n\n    typedef __gnu_debug::_Safe_iterator<typename _Base::iterator, basic_string>\n                                                       iterator;\n    typedef __gnu_debug::_Safe_iterator<typename _Base::const_iterator,\n                                         basic_string> const_iterator;\n\n    typedef std::reverse_iterator<iterator>            reverse_iterator;\n    typedef std::reverse_iterator<const_iterator>      const_reverse_iterator;\n\n    using _Base::npos;\n\n    // 21.3.1 construct/copy/destroy:\n    explicit basic_string(const _Allocator& __a = _Allocator())\n    : _Base(__a)\n    { }\n\n    // Provides conversion from a release-mode string to a debug-mode string\n    basic_string(const _Base& __base) : _Base(__base), _Safe_base() { }\n\n    // _GLIBCXX_RESOLVE_LIB_DEFECTS\n    // 42. string ctors specify wrong default allocator\n    basic_string(const basic_string& __str)\n    : _Base(__str, 0, _Base::npos, __str.get_allocator()), _Safe_base()\n    { }\n\n    // _GLIBCXX_RESOLVE_LIB_DEFECTS\n    // 42. string ctors specify wrong default allocator\n    basic_string(const basic_string& __str, size_type __pos,\n\t\t   size_type __n = _Base::npos,\n\t\t   const _Allocator& __a = _Allocator())\n    : _Base(__str, __pos, __n, __a)\n    { }\n\n    basic_string(const _CharT* __s, size_type __n,\n\t\t   const _Allocator& __a = _Allocator())\n    : _Base(__gnu_debug::__check_string(__s, __n), __n, __a)\n    { }\n\n    basic_string(const _CharT* __s, const _Allocator& __a = _Allocator())\n    : _Base(__gnu_debug::__check_string(__s), __a)\n    { this->assign(__s); }\n\n    basic_string(size_type __n, _CharT __c,\n\t\t   const _Allocator& __a = _Allocator())\n    : _Base(__n, __c, __a)\n    { }\n\n    template<typename _InputIterator>\n      basic_string(_InputIterator __begin, _InputIterator __end,\n\t\t     const _Allocator& __a = _Allocator())\n      : _Base(__gnu_debug::__check_valid_range(__begin, __end), __end, __a)\n      { }\n\n    ~basic_string() { }\n\n    basic_string&\n    operator=(const basic_string& __str)\n    {\n      *static_cast<_Base*>(this) = __str;\n      this->_M_invalidate_all();\n      return *this;\n    }\n\n    basic_string&\n    operator=(const _CharT* __s)\n    {\n      __glibcxx_check_string(__s);\n      *static_cast<_Base*>(this) = __s;\n      this->_M_invalidate_all();\n      return *this;\n    }\n\n    basic_string&\n    operator=(_CharT __c)\n    {\n      *static_cast<_Base*>(this) = __c;\n      this->_M_invalidate_all();\n      return *this;\n    }\n\n    // 21.3.2 iterators:\n    iterator\n    begin()\n    { return iterator(_Base::begin(), this); }\n\n    const_iterator\n    begin() const\n    { return const_iterator(_Base::begin(), this); }\n\n    iterator\n    end()\n    { return iterator(_Base::end(), this); }\n\n    const_iterator\n    end() const\n    { return const_iterator(_Base::end(), this); }\n\n    reverse_iterator\n    rbegin()\n    { return reverse_iterator(end()); }\n\n    const_reverse_iterator\n    rbegin() const\n    { return const_reverse_iterator(end()); }\n\n    reverse_iterator\n    rend()\n    { return reverse_iterator(begin()); }\n\n    const_reverse_iterator\n    rend() const\n    { return const_reverse_iterator(begin()); }\n\n    // 21.3.3 capacity:\n    using _Base::size;\n    using _Base::length;\n    using _Base::max_size;\n\n    void\n    resize(size_type __n, _CharT __c)\n    {\n      _Base::resize(__n, __c);\n      this->_M_invalidate_all();\n    }\n\n    void\n    resize(size_type __n)\n    { this->resize(__n, _CharT()); }\n\n    using _Base::capacity;\n    using _Base::reserve;\n\n    void\n    clear()\n    {\n      _Base::clear();\n      this->_M_invalidate_all();\n    }\n\n    using _Base::empty;\n\n    // 21.3.4 element access:\n    const_reference\n    operator[](size_type __pos) const\n    {\n      _GLIBCXX_DEBUG_VERIFY(__pos <= this->size(),\n\t\t\t    _M_message(__gnu_debug::__msg_subscript_oob)\n\t\t\t    ._M_sequence(*this, \"this\")\n\t\t\t    ._M_integer(__pos, \"__pos\")\n\t\t\t    ._M_integer(this->size(), \"size\"));\n      return _M_base()[__pos];\n    }\n\n    reference\n    operator[](size_type __pos)\n    {\n#ifdef _GLIBCXX_DEBUG_PEDANTIC\n      __glibcxx_check_subscript(__pos);\n#else\n      // as an extension v3 allows s[s.size()] when s is non-const.\n      _GLIBCXX_DEBUG_VERIFY(__pos <= this->size(),\n\t\t\t    _M_message(__gnu_debug::__msg_subscript_oob)\n\t\t\t    ._M_sequence(*this, \"this\")\n\t\t\t    ._M_integer(__pos, \"__pos\")\n\t\t\t    ._M_integer(this->size(), \"size\"));\n#endif\n      return _M_base()[__pos];\n    }\n\n    using _Base::at;\n\n    // 21.3.5 modifiers:\n    basic_string&\n    operator+=(const basic_string& __str)\n    {\n      _M_base() += __str;\n      this->_M_invalidate_all();\n      return *this;\n    }\n\n    basic_string&\n    operator+=(const _CharT* __s)\n    {\n      __glibcxx_check_string(__s);\n      _M_base() += __s;\n      this->_M_invalidate_all();\n      return *this;\n    }\n\n    basic_string&\n    operator+=(_CharT __c)\n    {\n      _M_base() += __c;\n      this->_M_invalidate_all();\n      return *this;\n    }\n\n    basic_string&\n    append(const basic_string& __str)\n    {\n      _Base::append(__str);\n      this->_M_invalidate_all();\n      return *this;\n    }\n\n    basic_string&\n    append(const basic_string& __str, size_type __pos, size_type __n)\n    {\n      _Base::append(__str, __pos, __n);\n      this->_M_invalidate_all();\n      return *this;\n    }\n\n    basic_string&\n    append(const _CharT* __s, size_type __n)\n    {\n      __glibcxx_check_string_len(__s, __n);\n      _Base::append(__s, __n);\n      this->_M_invalidate_all();\n      return *this;\n    }\n\n    basic_string&\n    append(const _CharT* __s)\n    {\n      __glibcxx_check_string(__s);\n      _Base::append(__s);\n      this->_M_invalidate_all();\n      return *this;\n    }\n\n    basic_string&\n    append(size_type __n, _CharT __c)\n    {\n      _Base::append(__n, __c);\n      this->_M_invalidate_all();\n      return *this;\n    }\n\n    template<typename _InputIterator>\n      basic_string&\n      append(_InputIterator __first, _InputIterator __last)\n      {\n\t__glibcxx_check_valid_range(__first, __last);\n\t_Base::append(__first, __last);\n\tthis->_M_invalidate_all();\n\treturn *this;\n      }\n\n    // _GLIBCXX_RESOLVE_LIB_DEFECTS\n    // 7. string clause minor problems\n    void\n    push_back(_CharT __c)\n    {\n      _Base::push_back(__c);\n      this->_M_invalidate_all();\n    }\n\n    basic_string&\n    assign(const basic_string& __x)\n    {\n      _Base::assign(__x);\n      this->_M_invalidate_all();\n      return *this;\n    }\n\n    basic_string&\n    assign(const basic_string& __str, size_type __pos, size_type __n)\n    {\n      _Base::assign(__str, __pos, __n);\n      this->_M_invalidate_all();\n      return *this;\n    }\n\n    basic_string&\n    assign(const _CharT* __s, size_type __n)\n    {\n      __glibcxx_check_string_len(__s, __n);\n      _Base::assign(__s, __n);\n      this->_M_invalidate_all();\n      return *this;\n    }\n\n    basic_string&\n    assign(const _CharT* __s)\n    {\n      __glibcxx_check_string(__s);\n      _Base::assign(__s);\n      this->_M_invalidate_all();\n      return *this;\n    }\n\n    basic_string&\n    assign(size_type __n, _CharT __c)\n    {\n      _Base::assign(__n, __c);\n      this->_M_invalidate_all();\n      return *this;\n    }\n\n    template<typename _InputIterator>\n      basic_string&\n      assign(_InputIterator __first, _InputIterator __last)\n      {\n\t__glibcxx_check_valid_range(__first, __last);\n\t_Base::assign(__first, __last);\n\tthis->_M_invalidate_all();\n\treturn *this;\n      }\n\n    basic_string&\n    insert(size_type __pos1, const basic_string& __str)\n    {\n      _Base::insert(__pos1, __str);\n      this->_M_invalidate_all();\n      return *this;\n    }\n\n    basic_string&\n    insert(size_type __pos1, const basic_string& __str,\n\t   size_type __pos2, size_type __n)\n    {\n      _Base::insert(__pos1, __str, __pos2, __n);\n      this->_M_invalidate_all();\n      return *this;\n    }\n\n    basic_string&\n    insert(size_type __pos, const _CharT* __s, size_type __n)\n    {\n      __glibcxx_check_string(__s);\n      _Base::insert(__pos, __s, __n);\n      this->_M_invalidate_all();\n      return *this;\n    }\n\n    basic_string&\n    insert(size_type __pos, const _CharT* __s)\n    {\n      __glibcxx_check_string(__s);\n      _Base::insert(__pos, __s);\n      this->_M_invalidate_all();\n      return *this;\n    }\n\n    basic_string&\n    insert(size_type __pos, size_type __n, _CharT __c)\n    {\n      _Base::insert(__pos, __n, __c);\n      this->_M_invalidate_all();\n      return *this;\n    }\n\n    iterator\n    insert(iterator __p, _CharT __c)\n    {\n      __glibcxx_check_insert(__p);\n      typename _Base::iterator __res = _Base::insert(__p.base(), __c);\n      this->_M_invalidate_all();\n      return iterator(__res, this);\n    }\n\n    void\n    insert(iterator __p, size_type __n, _CharT __c)\n    {\n      __glibcxx_check_insert(__p);\n      _Base::insert(__p.base(), __n, __c);\n      this->_M_invalidate_all();\n    }\n\n    template<typename _InputIterator>\n      void\n      insert(iterator __p, _InputIterator __first, _InputIterator __last)\n      {\n\t__glibcxx_check_insert_range(__p, __first, __last);\n\t_Base::insert(__p.base(), __first, __last);\n\tthis->_M_invalidate_all();\n      }\n\n    basic_string&\n    erase(size_type __pos = 0, size_type __n = _Base::npos)\n    {\n      _Base::erase(__pos, __n);\n      this->_M_invalidate_all();\n      return *this;\n    }\n\n    iterator\n    erase(iterator __position)\n    {\n      __glibcxx_check_erase(__position);\n      typename _Base::iterator __res = _Base::erase(__position.base());\n      this->_M_invalidate_all();\n      return iterator(__res, this);\n    }\n\n    iterator\n    erase(iterator __first, iterator __last)\n    {\n      // _GLIBCXX_RESOLVE_LIB_DEFECTS\n      // 151. can't currently clear() empty container\n      __glibcxx_check_erase_range(__first, __last);\n      typename _Base::iterator __res = _Base::erase(__first.base(),\n\t\t\t\t\t\t       __last.base());\n      this->_M_invalidate_all();\n      return iterator(__res, this);\n    }\n\n    basic_string&\n    replace(size_type __pos1, size_type __n1, const basic_string& __str)\n    {\n      _Base::replace(__pos1, __n1, __str);\n      this->_M_invalidate_all();\n      return *this;\n    }\n\n    basic_string&\n    replace(size_type __pos1, size_type __n1, const basic_string& __str,\n\t    size_type __pos2, size_type __n2)\n    {\n      _Base::replace(__pos1, __n1, __str, __pos2, __n2);\n      this->_M_invalidate_all();\n      return *this;\n    }\n\n    basic_string&\n    replace(size_type __pos, size_type __n1, const _CharT* __s,\n\t    size_type __n2)\n    {\n      __glibcxx_check_string_len(__s, __n2);\n      _Base::replace(__pos, __n1, __s, __n2);\n      this->_M_invalidate_all();\n      return *this;\n    }\n\n    basic_string&\n    replace(size_type __pos, size_type __n1, const _CharT* __s)\n    {\n      __glibcxx_check_string(__s);\n      _Base::replace(__pos, __n1, __s);\n      this->_M_invalidate_all();\n      return *this;\n    }\n\n    basic_string&\n    replace(size_type __pos, size_type __n1, size_type __n2, _CharT __c)\n    {\n      _Base::replace(__pos, __n1, __n2, __c);\n      this->_M_invalidate_all();\n      return *this;\n    }\n\n    basic_string&\n    replace(iterator __i1, iterator __i2, const basic_string& __str)\n    {\n      __glibcxx_check_erase_range(__i1, __i2);\n      _Base::replace(__i1.base(), __i2.base(), __str);\n      this->_M_invalidate_all();\n      return *this;\n    }\n\n    basic_string&\n    replace(iterator __i1, iterator __i2, const _CharT* __s, size_type __n)\n    {\n      __glibcxx_check_erase_range(__i1, __i2);\n      __glibcxx_check_string_len(__s, __n);\n      _Base::replace(__i1.base(), __i2.base(), __s, __n);\n      this->_M_invalidate_all();\n      return *this;\n    }\n\n    basic_string&\n    replace(iterator __i1, iterator __i2, const _CharT* __s)\n    {\n      __glibcxx_check_erase_range(__i1, __i2);\n      __glibcxx_check_string(__s);\n      _Base::replace(__i1.base(), __i2.base(), __s);\n      this->_M_invalidate_all();\n      return *this;\n    }\n\n    basic_string&\n    replace(iterator __i1, iterator __i2, size_type __n, _CharT __c)\n    {\n      __glibcxx_check_erase_range(__i1, __i2);\n      _Base::replace(__i1.base(), __i2.base(), __n, __c);\n      this->_M_invalidate_all();\n      return *this;\n    }\n\n    template<typename _InputIterator>\n      basic_string&\n      replace(iterator __i1, iterator __i2,\n\t      _InputIterator __j1, _InputIterator __j2)\n      {\n\t__glibcxx_check_erase_range(__i1, __i2);\n\t__glibcxx_check_valid_range(__j1, __j2);\n\t_Base::replace(__i1.base(), __i2.base(), __j1, __j2);\n\tthis->_M_invalidate_all();\n\treturn *this;\n      }\n\n    size_type\n    copy(_CharT* __s, size_type __n, size_type __pos = 0) const\n    {\n      __glibcxx_check_string_len(__s, __n);\n      return _Base::copy(__s, __n, __pos);\n    }\n\n    void\n    swap(basic_string<_CharT,_Traits,_Allocator>& __x)\n    {\n      _Base::swap(__x);\n      this->_M_swap(__x);\n      this->_M_invalidate_all();\n      __x._M_invalidate_all();\n    }\n\n    // 21.3.6 string operations:\n    const _CharT*\n    c_str() const\n    {\n      const _CharT* __res = _Base::c_str();\n      this->_M_invalidate_all();\n      return __res;\n    }\n\n    const _CharT*\n    data() const\n    {\n      const _CharT* __res = _Base::data();\n      this->_M_invalidate_all();\n      return __res;\n    }\n\n    using _Base::get_allocator;\n\n    size_type\n    find(const basic_string& __str, size_type __pos = 0) const\n    { return _Base::find(__str, __pos); }\n\n    size_type\n    find(const _CharT* __s, size_type __pos, size_type __n) const\n    {\n      __glibcxx_check_string(__s);\n      return _Base::find(__s, __pos, __n);\n    }\n\n    size_type\n    find(const _CharT* __s, size_type __pos = 0) const\n    {\n      __glibcxx_check_string(__s);\n      return _Base::find(__s, __pos);\n    }\n\n    size_type\n    find(_CharT __c, size_type __pos = 0) const\n    { return _Base::find(__c, __pos); }\n\n    size_type\n    rfind(const basic_string& __str, size_type __pos = _Base::npos) const\n    { return _Base::rfind(__str, __pos); }\n\n    size_type\n    rfind(const _CharT* __s, size_type __pos, size_type __n) const\n    {\n      __glibcxx_check_string_len(__s, __n);\n      return _Base::rfind(__s, __pos, __n);\n    }\n\n    size_type\n    rfind(const _CharT* __s, size_type __pos = _Base::npos) const\n    {\n      __glibcxx_check_string(__s);\n      return _Base::rfind(__s, __pos);\n    }\n\n    size_type\n    rfind(_CharT __c, size_type __pos = _Base::npos) const\n    { return _Base::rfind(__c, __pos); }\n\n    size_type\n    find_first_of(const basic_string& __str, size_type __pos = 0) const\n    { return _Base::find_first_of(__str, __pos); }\n\n    size_type\n    find_first_of(const _CharT* __s, size_type __pos, size_type __n) const\n    {\n      __glibcxx_check_string(__s);\n      return _Base::find_first_of(__s, __pos, __n);\n    }\n\n    size_type\n    find_first_of(const _CharT* __s, size_type __pos = 0) const\n    {\n      __glibcxx_check_string(__s);\n      return _Base::find_first_of(__s, __pos);\n    }\n\n    size_type\n    find_first_of(_CharT __c, size_type __pos = 0) const\n    { return _Base::find_first_of(__c, __pos); }\n\n    size_type\n    find_last_of(const basic_string& __str, \n\t\t size_type __pos = _Base::npos) const\n    { return _Base::find_last_of(__str, __pos); }\n\n    size_type\n    find_last_of(const _CharT* __s, size_type __pos, size_type __n) const\n    {\n      __glibcxx_check_string(__s);\n      return _Base::find_last_of(__s, __pos, __n);\n    }\n\n    size_type\n    find_last_of(const _CharT* __s, size_type __pos = _Base::npos) const\n    {\n      __glibcxx_check_string(__s);\n      return _Base::find_last_of(__s, __pos);\n    }\n\n    size_type\n    find_last_of(_CharT __c, size_type __pos = _Base::npos) const\n    { return _Base::find_last_of(__c, __pos); }\n\n    size_type\n    find_first_not_of(const basic_string& __str, size_type __pos = 0) const\n    { return _Base::find_first_not_of(__str, __pos); }\n\n    size_type\n    find_first_not_of(const _CharT* __s, size_type __pos, size_type __n) const\n    {\n      __glibcxx_check_string_len(__s, __n);\n      return _Base::find_first_not_of(__s, __pos, __n);\n    }\n\n    size_type\n    find_first_not_of(const _CharT* __s, size_type __pos = 0) const\n    {\n      __glibcxx_check_string(__s);\n      return _Base::find_first_not_of(__s, __pos);\n    }\n\n    size_type\n    find_first_not_of(_CharT __c, size_type __pos = 0) const\n    { return _Base::find_first_not_of(__c, __pos); }\n\n    size_type\n    find_last_not_of(const basic_string& __str,\n\t\t\t\t  size_type __pos = _Base::npos) const\n    { return _Base::find_last_not_of(__str, __pos); }\n\n    size_type\n    find_last_not_of(const _CharT* __s, size_type __pos, size_type __n) const\n    {\n      __glibcxx_check_string(__s);\n      return _Base::find_last_not_of(__s, __pos, __n);\n    }\n\n    size_type\n    find_last_not_of(const _CharT* __s, size_type __pos = _Base::npos) const\n    {\n      __glibcxx_check_string(__s);\n      return _Base::find_last_not_of(__s, __pos);\n    }\n\n    size_type\n    find_last_not_of(_CharT __c, size_type __pos = _Base::npos) const\n    { return _Base::find_last_not_of(__c, __pos); }\n\n    basic_string\n    substr(size_type __pos = 0, size_type __n = _Base::npos) const\n    { return basic_string(_Base::substr(__pos, __n)); }\n\n    int\n    compare(const basic_string& __str) const\n    { return _Base::compare(__str); }\n\n    int\n    compare(size_type __pos1, size_type __n1,\n\t\t  const basic_string& __str) const\n    { return _Base::compare(__pos1, __n1, __str); }\n\n    int\n    compare(size_type __pos1, size_type __n1, const basic_string& __str,\n\t      size_type __pos2, size_type __n2) const\n    { return _Base::compare(__pos1, __n1, __str, __pos2, __n2); }\n\n    int\n    compare(const _CharT* __s) const\n    {\n      __glibcxx_check_string(__s);\n      return _Base::compare(__s);\n    }\n\n    //  _GLIBCXX_RESOLVE_LIB_DEFECTS\n    //  5. string::compare specification questionable\n    int\n    compare(size_type __pos1, size_type __n1, const _CharT* __s) const\n    {\n      __glibcxx_check_string(__s);\n      return _Base::compare(__pos1, __n1, __s);\n    }\n\n    //  _GLIBCXX_RESOLVE_LIB_DEFECTS\n    //  5. string::compare specification questionable\n    int\n    compare(size_type __pos1, size_type __n1,const _CharT* __s,\n\t      size_type __n2) const\n    {\n      __glibcxx_check_string_len(__s, __n2);\n      return _Base::compare(__pos1, __n1, __s, __n2);\n    }\n\n    _Base&\n    _M_base() { return *this; }\n\n    const _Base&\n    _M_base() const { return *this; }\n\n    using _Safe_base::_M_invalidate_all;\n  };\n\n  template<typename _CharT, typename _Traits, typename _Allocator>\n    inline basic_string<_CharT,_Traits,_Allocator>\n    operator+(const basic_string<_CharT,_Traits,_Allocator>& __lhs,\n\t      const basic_string<_CharT,_Traits,_Allocator>& __rhs)\n    { return basic_string<_CharT,_Traits,_Allocator>(__lhs) += __rhs; }\n\n  template<typename _CharT, typename _Traits, typename _Allocator>\n    inline basic_string<_CharT,_Traits,_Allocator>\n    operator+(const _CharT* __lhs,\n\t      const basic_string<_CharT,_Traits,_Allocator>& __rhs)\n    {\n      __glibcxx_check_string(__lhs);\n      return basic_string<_CharT,_Traits,_Allocator>(__lhs) += __rhs;\n    }\n\n  template<typename _CharT, typename _Traits, typename _Allocator>\n    inline basic_string<_CharT,_Traits,_Allocator>\n    operator+(_CharT __lhs,\n\t      const basic_string<_CharT,_Traits,_Allocator>& __rhs)\n    { return basic_string<_CharT,_Traits,_Allocator>(1, __lhs) += __rhs; }\n\n  template<typename _CharT, typename _Traits, typename _Allocator>\n    inline basic_string<_CharT,_Traits,_Allocator>\n    operator+(const basic_string<_CharT,_Traits,_Allocator>& __lhs,\n\t      const _CharT* __rhs)\n    {\n      __glibcxx_check_string(__rhs);\n      return basic_string<_CharT,_Traits,_Allocator>(__lhs) += __rhs;\n    }\n\n  template<typename _CharT, typename _Traits, typename _Allocator>\n    inline basic_string<_CharT,_Traits,_Allocator>\n    operator+(const basic_string<_CharT,_Traits,_Allocator>& __lhs,\n\t      _CharT __rhs)\n    { return basic_string<_CharT,_Traits,_Allocator>(__lhs) += __rhs; }\n\n  template<typename _CharT, typename _Traits, typename _Allocator>\n    inline bool\n    operator==(const basic_string<_CharT,_Traits,_Allocator>& __lhs,\n\t       const basic_string<_CharT,_Traits,_Allocator>& __rhs)\n    { return __lhs._M_base() == __rhs._M_base(); }\n\n  template<typename _CharT, typename _Traits, typename _Allocator>\n    inline bool\n    operator==(const _CharT* __lhs,\n\t       const basic_string<_CharT,_Traits,_Allocator>& __rhs)\n    {\n      __glibcxx_check_string(__lhs);\n      return __lhs == __rhs._M_base();\n    }\n\n  template<typename _CharT, typename _Traits, typename _Allocator>\n    inline bool\n    operator==(const basic_string<_CharT,_Traits,_Allocator>& __lhs,\n\t       const _CharT* __rhs)\n    {\n      __glibcxx_check_string(__rhs);\n      return __lhs._M_base() == __rhs;\n    }\n\n  template<typename _CharT, typename _Traits, typename _Allocator>\n    inline bool\n    operator!=(const basic_string<_CharT,_Traits,_Allocator>& __lhs,\n\t       const basic_string<_CharT,_Traits,_Allocator>& __rhs)\n    { return __lhs._M_base() != __rhs._M_base(); }\n\n  template<typename _CharT, typename _Traits, typename _Allocator>\n    inline bool\n    operator!=(const _CharT* __lhs,\n\t       const basic_string<_CharT,_Traits,_Allocator>& __rhs)\n    {\n      __glibcxx_check_string(__lhs);\n      return __lhs != __rhs._M_base();\n    }\n\n  template<typename _CharT, typename _Traits, typename _Allocator>\n    inline bool\n    operator!=(const basic_string<_CharT,_Traits,_Allocator>& __lhs,\n\t       const _CharT* __rhs)\n    {\n      __glibcxx_check_string(__rhs);\n      return __lhs._M_base() != __rhs;\n    }\n\n  template<typename _CharT, typename _Traits, typename _Allocator>\n    inline bool\n    operator<(const basic_string<_CharT,_Traits,_Allocator>& __lhs,\n\t      const basic_string<_CharT,_Traits,_Allocator>& __rhs)\n    { return __lhs._M_base() < __rhs._M_base(); }\n\n  template<typename _CharT, typename _Traits, typename _Allocator>\n    inline bool\n    operator<(const _CharT* __lhs,\n\t      const basic_string<_CharT,_Traits,_Allocator>& __rhs)\n    {\n      __glibcxx_check_string(__lhs);\n      return __lhs < __rhs._M_base();\n    }\n\n  template<typename _CharT, typename _Traits, typename _Allocator>\n    inline bool\n    operator<(const basic_string<_CharT,_Traits,_Allocator>& __lhs,\n\t      const _CharT* __rhs)\n    {\n      __glibcxx_check_string(__rhs);\n      return __lhs._M_base() < __rhs;\n    }\n\n  template<typename _CharT, typename _Traits, typename _Allocator>\n    inline bool\n    operator<=(const basic_string<_CharT,_Traits,_Allocator>& __lhs,\n\t       const basic_string<_CharT,_Traits,_Allocator>& __rhs)\n    { return __lhs._M_base() <= __rhs._M_base(); }\n\n  template<typename _CharT, typename _Traits, typename _Allocator>\n    inline bool\n    operator<=(const _CharT* __lhs,\n\t       const basic_string<_CharT,_Traits,_Allocator>& __rhs)\n    {\n      __glibcxx_check_string(__lhs);\n      return __lhs <= __rhs._M_base();\n    }\n\n  template<typename _CharT, typename _Traits, typename _Allocator>\n    inline bool\n    operator<=(const basic_string<_CharT,_Traits,_Allocator>& __lhs,\n\t       const _CharT* __rhs)\n    {\n      __glibcxx_check_string(__rhs);\n      return __lhs._M_base() <= __rhs;\n    }\n\n  template<typename _CharT, typename _Traits, typename _Allocator>\n    inline bool\n    operator>=(const basic_string<_CharT,_Traits,_Allocator>& __lhs,\n\t       const basic_string<_CharT,_Traits,_Allocator>& __rhs)\n    { return __lhs._M_base() >= __rhs._M_base(); }\n\n  template<typename _CharT, typename _Traits, typename _Allocator>\n    inline bool\n    operator>=(const _CharT* __lhs,\n\t       const basic_string<_CharT,_Traits,_Allocator>& __rhs)\n    {\n      __glibcxx_check_string(__lhs);\n      return __lhs >= __rhs._M_base();\n    }\n\n  template<typename _CharT, typename _Traits, typename _Allocator>\n    inline bool\n    operator>=(const basic_string<_CharT,_Traits,_Allocator>& __lhs,\n\t       const _CharT* __rhs)\n    {\n      __glibcxx_check_string(__rhs);\n      return __lhs._M_base() >= __rhs;\n    }\n\n  template<typename _CharT, typename _Traits, typename _Allocator>\n    inline bool\n    operator>(const basic_string<_CharT,_Traits,_Allocator>& __lhs,\n\t      const basic_string<_CharT,_Traits,_Allocator>& __rhs)\n    { return __lhs._M_base() > __rhs._M_base(); }\n\n  template<typename _CharT, typename _Traits, typename _Allocator>\n    inline bool\n    operator>(const _CharT* __lhs,\n\t      const basic_string<_CharT,_Traits,_Allocator>& __rhs)\n    {\n      __glibcxx_check_string(__lhs);\n      return __lhs > __rhs._M_base();\n    }\n\n  template<typename _CharT, typename _Traits, typename _Allocator>\n    inline bool\n    operator>(const basic_string<_CharT,_Traits,_Allocator>& __lhs,\n\t      const _CharT* __rhs)\n    {\n      __glibcxx_check_string(__rhs);\n      return __lhs._M_base() > __rhs;\n    }\n\n  // 21.3.7.8:\n  template<typename _CharT, typename _Traits, typename _Allocator>\n    inline void\n    swap(basic_string<_CharT,_Traits,_Allocator>& __lhs,\n\t basic_string<_CharT,_Traits,_Allocator>& __rhs)\n    { __lhs.swap(__rhs); }\n\n  template<typename _CharT, typename _Traits, typename _Allocator>\n    std::basic_ostream<_CharT, _Traits>&\n    operator<<(std::basic_ostream<_CharT, _Traits>& __os,\n\t       const basic_string<_CharT, _Traits, _Allocator>& __str)\n    { return __os << __str._M_base(); }\n\n  template<typename _CharT, typename _Traits, typename _Allocator>\n    std::basic_istream<_CharT,_Traits>&\n    operator>>(std::basic_istream<_CharT,_Traits>& __is,\n\t       basic_string<_CharT,_Traits,_Allocator>& __str)\n    {\n      std::basic_istream<_CharT,_Traits>& __res = __is >> __str._M_base();\n      __str._M_invalidate_all();\n      return __res;\n    }\n\n  template<typename _CharT, typename _Traits, typename _Allocator>\n    std::basic_istream<_CharT,_Traits>&\n    getline(std::basic_istream<_CharT,_Traits>& __is,\n\t    basic_string<_CharT,_Traits,_Allocator>& __str, _CharT __delim)\n    {\n      std::basic_istream<_CharT,_Traits>& __res = getline(__is,\n\t\t\t\t\t\t\t  __str._M_base(),\n\t\t\t\t\t\t\t__delim);\n      __str._M_invalidate_all();\n      return __res;\n    }\n\n  template<typename _CharT, typename _Traits, typename _Allocator>\n    std::basic_istream<_CharT,_Traits>&\n    getline(std::basic_istream<_CharT,_Traits>& __is,\n\t    basic_string<_CharT,_Traits,_Allocator>& __str)\n    {\n      std::basic_istream<_CharT,_Traits>& __res = getline(__is,\n\t\t\t\t\t\t\t  __str._M_base());\n      __str._M_invalidate_all();\n      return __res;\n    }\n\n  typedef basic_string<char>    string;\n\n#ifdef _GLIBCXX_USE_WCHAR_T\n  typedef basic_string<wchar_t> wstring;\n#endif\n\n} // namespace __gnu_debug\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/debug/vector",
    "content": "// Debugging vector implementation -*- C++ -*-\n\n// Copyright (C) 2003, 2004, 2005\n// Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n/** @file debug/vector\n *  This file is a GNU debug extension to the Standard C++ Library.\n */\n\n#ifndef _GLIBCXX_DEBUG_VECTOR\n#define _GLIBCXX_DEBUG_VECTOR 1\n\n#include <vector>\n#include <utility>\n#include <debug/safe_sequence.h>\n#include <debug/safe_iterator.h>\n\nnamespace std\n{\nnamespace __debug\n{\n  template<typename _Tp,\n\t   typename _Allocator = std::allocator<_Tp> >\n    class vector\n    : public _GLIBCXX_STD::vector<_Tp, _Allocator>,\n      public __gnu_debug::_Safe_sequence<vector<_Tp, _Allocator> >\n    {\n      typedef _GLIBCXX_STD::vector<_Tp, _Allocator> _Base;\n      typedef __gnu_debug::_Safe_sequence<vector>              _Safe_base;\n\n      typedef typename _Base::const_iterator _Base_const_iterator;\n      typedef __gnu_debug::_After_nth_from<_Base_const_iterator> _After_nth;\n\n    public:\n      typedef typename _Base::reference             reference;\n      typedef typename _Base::const_reference       const_reference;\n\n      typedef __gnu_debug::_Safe_iterator<typename _Base::iterator,vector>\n      iterator;\n      typedef __gnu_debug::_Safe_iterator<typename _Base::const_iterator,vector>\n      const_iterator;\n\n      typedef typename _Base::size_type             size_type;\n      typedef typename _Base::difference_type       difference_type;\n\n      typedef _Tp\t\t\t\t    value_type;\n      typedef _Allocator\t\t\t    allocator_type;\n      typedef typename _Base::pointer               pointer;\n      typedef typename _Base::const_pointer         const_pointer;\n      typedef std::reverse_iterator<iterator>       reverse_iterator;\n      typedef std::reverse_iterator<const_iterator> const_reverse_iterator;\n\n      // 23.2.4.1 construct/copy/destroy:\n      explicit vector(const _Allocator& __a = _Allocator())\n      : _Base(__a), _M_guaranteed_capacity(0) { }\n\n      explicit vector(size_type __n, const _Tp& __value = _Tp(),\n\t\t      const _Allocator& __a = _Allocator())\n      : _Base(__n, __value, __a), _M_guaranteed_capacity(__n) { }\n\n      template<class _InputIterator>\n        vector(_InputIterator __first, _InputIterator __last,\n\t       const _Allocator& __a = _Allocator())\n\t: _Base(__gnu_debug::__check_valid_range(__first, __last),\n\t\t__last, __a),\n\t  _M_guaranteed_capacity(0)\n        { _M_update_guaranteed_capacity(); }\n\n      vector(const vector<_Tp,_Allocator>& __x)\n      : _Base(__x), _Safe_base(), _M_guaranteed_capacity(__x.size()) { }\n\n      /// Construction from a release-mode vector\n      vector(const _Base& __x)\n      : _Base(__x), _Safe_base(), _M_guaranteed_capacity(__x.size()) { }\n\n      ~vector() { }\n\n      vector<_Tp,_Allocator>&\n      operator=(const vector<_Tp,_Allocator>& __x)\n      {\n\tstatic_cast<_Base&>(*this) = __x;\n\tthis->_M_invalidate_all();\n\t_M_update_guaranteed_capacity();\n\treturn *this;\n      }\n\n      template<typename _InputIterator>\n        void\n        assign(_InputIterator __first, _InputIterator __last)\n        {\n\t  __glibcxx_check_valid_range(__first, __last);\n\t  _Base::assign(__first, __last);\n\t  this->_M_invalidate_all();\n\t  _M_update_guaranteed_capacity();\n\t}\n\n      void\n      assign(size_type __n, const _Tp& __u)\n      {\n\t_Base::assign(__n, __u);\n\tthis->_M_invalidate_all();\n\t_M_update_guaranteed_capacity();\n      }\n\n      using _Base::get_allocator;\n\n      // iterators:\n      iterator\n      begin()\n      { return iterator(_Base::begin(), this); }\n\n      const_iterator\n      begin() const\n      { return const_iterator(_Base::begin(), this); }\n\n      iterator\n      end()\n      { return iterator(_Base::end(), this); }\n\n      const_iterator\n      end() const\n      { return const_iterator(_Base::end(), this); }\n\n      reverse_iterator\n      rbegin()\n      { return reverse_iterator(end()); }\n\n      const_reverse_iterator\n      rbegin() const\n      { return const_reverse_iterator(end()); }\n\n      reverse_iterator\n      rend()\n      { return reverse_iterator(begin()); }\n\n      const_reverse_iterator\n      rend() const\n      { return const_reverse_iterator(begin()); }\n\n      // 23.2.4.2 capacity:\n      using _Base::size;\n      using _Base::max_size;\n\n      void\n      resize(size_type __sz, _Tp __c = _Tp())\n      {\n\tbool __realloc = _M_requires_reallocation(__sz);\n\tif (__sz < this->size())\n\t  this->_M_invalidate_if(_After_nth(__sz, _M_base().begin()));\n\t_Base::resize(__sz, __c);\n\tif (__realloc)\n\t  this->_M_invalidate_all();\n      }\n\n      using _Base::capacity;\n      using _Base::empty;\n\n      void\n      reserve(size_type __n)\n      {\n\tbool __realloc = _M_requires_reallocation(__n);\n\t_Base::reserve(__n);\n\tif (__n > _M_guaranteed_capacity)\n\t  _M_guaranteed_capacity = __n;\n\tif (__realloc)\n\t  this->_M_invalidate_all();\n      }\n\n      // element access:\n      reference\n      operator[](size_type __n)\n      {\n\t__glibcxx_check_subscript(__n);\n\treturn _M_base()[__n];\n      }\n\n      const_reference\n      operator[](size_type __n) const\n      {\n\t__glibcxx_check_subscript(__n);\n\treturn _M_base()[__n];\n      }\n\n      using _Base::at;\n\n      reference\n      front()\n      {\n\t__glibcxx_check_nonempty();\n\treturn _Base::front();\n      }\n\n      const_reference\n      front() const\n      {\n\t__glibcxx_check_nonempty();\n\treturn _Base::front();\n      }\n\n      reference\n      back()\n      {\n\t__glibcxx_check_nonempty();\n\treturn _Base::back();\n      }\n\n      const_reference\n      back() const\n      {\n\t__glibcxx_check_nonempty();\n\treturn _Base::back();\n      }\n\n      // _GLIBCXX_RESOLVE_LIB_DEFECTS\n      // DR 464. Suggestion for new member functions in standard containers.\n      using _Base::data;\n\n      // 23.2.4.3 modifiers:\n      void\n      push_back(const _Tp& __x)\n      {\n\tbool __realloc = _M_requires_reallocation(this->size() + 1);\n\t_Base::push_back(__x);\n\tif (__realloc)\n\t  this->_M_invalidate_all();\n\t_M_update_guaranteed_capacity();\n      }\n\n      void\n      pop_back()\n      {\n\t__glibcxx_check_nonempty();\n\titerator __victim = end() - 1;\n\t__victim._M_invalidate();\n\t_Base::pop_back();\n      }\n\n      iterator\n      insert(iterator __position, const _Tp& __x)\n      {\n\t__glibcxx_check_insert(__position);\n\tbool __realloc = _M_requires_reallocation(this->size() + 1);\n\tdifference_type __offset = __position - begin();\n\ttypename _Base::iterator __res = _Base::insert(__position.base(),__x);\n\tif (__realloc)\n\t  this->_M_invalidate_all();\n\telse\n\t  this->_M_invalidate_if(_After_nth(__offset, _M_base().begin()));\n\t_M_update_guaranteed_capacity();\n\treturn iterator(__res, this);\n      }\n\n      void\n      insert(iterator __position, size_type __n, const _Tp& __x)\n      {\n\t__glibcxx_check_insert(__position);\n\tbool __realloc = _M_requires_reallocation(this->size() + __n);\n\tdifference_type __offset = __position - begin();\n\t_Base::insert(__position.base(), __n, __x);\n\tif (__realloc)\n\t  this->_M_invalidate_all();\n\telse\n\t  this->_M_invalidate_if(_After_nth(__offset, _M_base().begin()));\n\t_M_update_guaranteed_capacity();\n      }\n\n      template<class _InputIterator>\n        void\n        insert(iterator __position,\n\t       _InputIterator __first, _InputIterator __last)\n        {\n\t  __glibcxx_check_insert_range(__position, __first, __last);\n\n\t  /* Hard to guess if invalidation will occur, because __last\n\t     - __first can't be calculated in all cases, so we just\n\t     punt here by checking if it did occur. */\n\t  typename _Base::iterator __old_begin = _M_base().begin();\n\t  difference_type __offset = __position - begin();\n\t  _Base::insert(__position.base(), __first, __last);\n\n\t  if (_M_base().begin() != __old_begin)\n\t    this->_M_invalidate_all();\n\t  else\n\t    this->_M_invalidate_if(_After_nth(__offset, _M_base().begin()));\n\t  _M_update_guaranteed_capacity();\n\t}\n\n      iterator\n      erase(iterator __position)\n      {\n\t__glibcxx_check_erase(__position);\n\tdifference_type __offset = __position - begin();\n\ttypename _Base::iterator __res = _Base::erase(__position.base());\n\tthis->_M_invalidate_if(_After_nth(__offset, _M_base().begin()));\n\treturn iterator(__res, this);\n      }\n\n      iterator\n      erase(iterator __first, iterator __last)\n      {\n\t// _GLIBCXX_RESOLVE_LIB_DEFECTS\n\t// 151. can't currently clear() empty container\n\t__glibcxx_check_erase_range(__first, __last);\n\n\tdifference_type __offset = __first - begin();\n\ttypename _Base::iterator __res = _Base::erase(__first.base(),\n\t\t\t\t\t\t\t __last.base());\n\tthis->_M_invalidate_if(_After_nth(__offset, _M_base().begin()));\n\treturn iterator(__res, this);\n      }\n\n      void\n      swap(vector<_Tp,_Allocator>& __x)\n      {\n\t_Base::swap(__x);\n\tthis->_M_swap(__x);\n        std::swap(_M_guaranteed_capacity, __x._M_guaranteed_capacity);\n      }\n\n      void\n      clear()\n      {\n\t_Base::clear();\n\tthis->_M_invalidate_all();\n        _M_guaranteed_capacity = 0;\n      }\n\n      _Base&\n      _M_base() { return *this; }\n\n      const _Base&\n      _M_base() const { return *this; }\n\n    private:\n      size_type _M_guaranteed_capacity;\n\n      bool\n      _M_requires_reallocation(size_type __elements)\n      {\n#ifdef _GLIBCXX_DEBUG_PEDANTIC\n\treturn __elements > this->capacity();\n#else\n\treturn __elements > _M_guaranteed_capacity;\n#endif\n      }\n\n      void\n      _M_update_guaranteed_capacity()\n      {\n\tif (this->size() > _M_guaranteed_capacity)\n\t  _M_guaranteed_capacity = this->size();\n      }\n    };\n\n  template<typename _Tp, typename _Alloc>\n    inline bool\n    operator==(const vector<_Tp, _Alloc>& __lhs,\n\t       const vector<_Tp, _Alloc>& __rhs)\n    { return __lhs._M_base() == __rhs._M_base(); }\n\n  template<typename _Tp, typename _Alloc>\n    inline bool\n    operator!=(const vector<_Tp, _Alloc>& __lhs,\n\t       const vector<_Tp, _Alloc>& __rhs)\n    { return __lhs._M_base() != __rhs._M_base(); }\n\n  template<typename _Tp, typename _Alloc>\n    inline bool\n    operator<(const vector<_Tp, _Alloc>& __lhs,\n\t      const vector<_Tp, _Alloc>& __rhs)\n    { return __lhs._M_base() < __rhs._M_base(); }\n\n  template<typename _Tp, typename _Alloc>\n    inline bool\n    operator<=(const vector<_Tp, _Alloc>& __lhs,\n\t       const vector<_Tp, _Alloc>& __rhs)\n    { return __lhs._M_base() <= __rhs._M_base(); }\n\n  template<typename _Tp, typename _Alloc>\n    inline bool\n    operator>=(const vector<_Tp, _Alloc>& __lhs,\n\t       const vector<_Tp, _Alloc>& __rhs)\n    { return __lhs._M_base() >= __rhs._M_base(); }\n\n  template<typename _Tp, typename _Alloc>\n    inline bool\n    operator>(const vector<_Tp, _Alloc>& __lhs,\n\t      const vector<_Tp, _Alloc>& __rhs)\n    { return __lhs._M_base() > __rhs._M_base(); }\n\n  template<typename _Tp, typename _Alloc>\n    inline void\n    swap(vector<_Tp, _Alloc>& __lhs, vector<_Tp, _Alloc>& __rhs)\n    { __lhs.swap(__rhs); }\n} // namespace __debug\n} // namespace std\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/deque",
    "content": "// <deque> -*- C++ -*-\n\n// Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n/*\n *\n * Copyright (c) 1994\n * Hewlett-Packard Company\n *\n * Permission to use, copy, modify, distribute and sell this software\n * and its documentation for any purpose is hereby granted without fee,\n * provided that the above copyright notice appear in all copies and\n * that both that copyright notice and this permission notice appear\n * in supporting documentation.  Hewlett-Packard Company makes no\n * representations about the suitability of this software for any\n * purpose.  It is provided \"as is\" without express or implied warranty.\n *\n *\n * Copyright (c) 1997\n * Silicon Graphics Computer Systems, Inc.\n *\n * Permission to use, copy, modify, distribute and sell this software\n * and its documentation for any purpose is hereby granted without fee,\n * provided that the above copyright notice appear in all copies and\n * that both that copyright notice and this permission notice appear\n * in supporting documentation.  Silicon Graphics makes no\n * representations about the suitability of this software for any\n * purpose.  It is provided \"as is\" without express or implied warranty.\n */\n\n/** @file include/deque\n *  This is a Standard C++ Library header.\n */\n\n#ifndef _GLIBCXX_DEQUE\n#define _GLIBCXX_DEQUE 1\n\n#pragma GCC system_header\n\n#include <bits/functexcept.h>\n#include <bits/stl_algobase.h>\n#include <bits/allocator.h>\n#include <bits/stl_construct.h>\n#include <bits/stl_uninitialized.h>\n#include <bits/stl_deque.h>\n\n#ifndef _GLIBCXX_EXPORT_TEMPLATE\n# include <bits/deque.tcc>\n#endif\n\n#ifdef _GLIBCXX_DEBUG\n# include <debug/deque>\n#endif\n\n#endif /* _GLIBCXX_DEQUE */\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/exception",
    "content": "// Exception Handling support header for -*- C++ -*-\n\n// Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003,\n// 2004, 2005, 2006, 2007\n// Free Software Foundation\n//\n// This file is part of GCC.\n//\n// GCC is free software; you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation; either version 2, or (at your option)\n// any later version.\n// \n// GCC is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n// \n// You should have received a copy of the GNU General Public License\n// along with GCC; see the file COPYING.  If not, write to\n// the Free Software Foundation, 51 Franklin Street, Fifth Floor,\n// Boston, MA 02110-1301, USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n/** @file exception\n *  This is a Standard C++ Library header.\n */\n\n#ifndef __EXCEPTION__\n#define __EXCEPTION__\n\n#pragma GCC visibility push(default)\n\n#include <bits/c++config.h>\n\nextern \"C++\" {\n\nnamespace std \n{\n  /**\n   *  @brief Base class for all library exceptions.\n   *\n   *  This is the base class for all exceptions thrown by the standard\n   *  library, and by certain language expressions.  You are free to derive\n   *  your own %exception classes, or use a different hierarchy, or to\n   *  throw non-class data (e.g., fundamental types).\n   */\n  class exception \n  {\n  public:\n    exception() throw() { }\n    virtual ~exception() throw();\n\n    /** Returns a C-style character string describing the general cause\n     *  of the current error.  */\n    virtual const char* what() const throw();\n  };\n\n  /** If an %exception is thrown which is not listed in a function's\n   *  %exception specification, one of these may be thrown.  */\n  class bad_exception : public exception \n  {\n  public:\n    bad_exception() throw() { }\n\n    // This declaration is not useless:\n    // http://gcc.gnu.org/onlinedocs/gcc-3.0.2/gcc_6.html#SEC118\n    virtual ~bad_exception() throw();\n\n    // See comment in eh_exception.cc.\n    virtual const char* what() const throw();\n  };\n\n  /// If you write a replacement %terminate handler, it must be of this type.\n  typedef void (*terminate_handler) ();\n\n  /// If you write a replacement %unexpected handler, it must be of this type.\n  typedef void (*unexpected_handler) ();\n\n  /// Takes a new handler function as an argument, returns the old function.\n  terminate_handler set_terminate(terminate_handler) throw();\n\n  /** The runtime will call this function if %exception handling must be\n   *  abandoned for any reason.  It can also be called by the user.  */\n  void terminate() __attribute__ ((__noreturn__));\n\n  /// Takes a new handler function as an argument, returns the old function.\n  unexpected_handler set_unexpected(unexpected_handler) throw();\n\n  /** The runtime will call this function if an %exception is thrown which\n   *  violates the function's %exception specification.  */\n  void unexpected() __attribute__ ((__noreturn__));\n\n  /** [18.6.4]/1:  \"Returns true after completing evaluation of a\n   *  throw-expression until either completing initialization of the\n   *  exception-declaration in the matching handler or entering @c unexpected()\n   *  due to the throw; or after entering @c terminate() for any reason\n   *  other than an explicit call to @c terminate().  [Note: This includes\n   *  stack unwinding [15.2].  end note]\"\n   *\n   *  2:  \"When @c uncaught_exception() is true, throwing an %exception can\n   *  result in a call of @c terminate() (15.5.1).\"\n   */\n  bool uncaught_exception() throw();\n} // namespace std\n\n_GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)\n\n  /** A replacement for the standard terminate_handler which prints more\n      information about the terminating exception (if any) on stderr.  Call\n      @code\n        std::set_terminate (__gnu_cxx::__verbose_terminate_handler)\n      @endcode\n      to use.  For more info, see\n      http://gcc.gnu.org/onlinedocs/libstdc++/19_diagnostics/howto.html#4\n\n      In 3.4 and later, this is on by default.\n  */\n  void __verbose_terminate_handler ();\n\n_GLIBCXX_END_NAMESPACE\n  \n} // extern \"C++\"\n\n#pragma GCC visibility pop\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/exception_defines.h",
    "content": "// -fno-exceptions Support -*- C++ -*-\n\n// Copyright (C) 2001, 2003 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n//\n// ISO C++ 14882: 19.1  Exception classes\n//\n\n/** @file exception_defines.h\n *  This is a Standard C++ Library header.\n */\n\n#ifndef _EXCEPTION_DEFINES_H\n#define _EXCEPTION_DEFINES_H 1\n\n#ifndef __EXCEPTIONS\n// Iff -fno-exceptions, transform error handling code to work without it.\n# define try      if (true)\n# define catch(X) if (false)\n# define __throw_exception_again\n#else\n// Else proceed normally.\n# define __throw_exception_again throw\n#endif\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/algorithm",
    "content": "// Algorithm extensions -*- C++ -*-\n\n// Copyright (C) 2001, 2002, 2004, 2005 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n/*\n *\n * Copyright (c) 1994\n * Hewlett-Packard Company\n *\n * Permission to use, copy, modify, distribute and sell this software\n * and its documentation for any purpose is hereby granted without fee,\n * provided that the above copyright notice appear in all copies and\n * that both that copyright notice and this permission notice appear\n * in supporting documentation.  Hewlett-Packard Company makes no\n * representations about the suitability of this software for any\n * purpose.  It is provided \"as is\" without express or implied warranty.\n *\n *\n * Copyright (c) 1996\n * Silicon Graphics Computer Systems, Inc.\n *\n * Permission to use, copy, modify, distribute and sell this software\n * and its documentation for any purpose is hereby granted without fee,\n * provided that the above copyright notice appear in all copies and\n * that both that copyright notice and this permission notice appear\n * in supporting documentation.  Silicon Graphics makes no\n * representations about the suitability of this software for any\n * purpose.  It is provided \"as is\" without express or implied warranty.\n */\n\n/** @file ext/algorithm\n *  This file is a GNU extension to the Standard C++ Library (possibly\n *  containing extensions from the HP/SGI STL subset).\n */\n\n#ifndef _EXT_ALGORITHM\n#define _EXT_ALGORITHM 1\n\n#pragma GCC system_header\n\n#include <algorithm>\n\n_GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)\n\n  using std::ptrdiff_t;\n  using std::min;\n  using std::pair;\n  using std::input_iterator_tag;\n  using std::random_access_iterator_tag;\n  using std::iterator_traits;\n\n  //--------------------------------------------------\n  // copy_n (not part of the C++ standard)\n\n  template<typename _InputIterator, typename _Size, typename _OutputIterator>\n    pair<_InputIterator, _OutputIterator>\n    __copy_n(_InputIterator __first, _Size __count,\n\t     _OutputIterator __result,\n\t     input_iterator_tag)\n    {\n      for ( ; __count > 0; --__count)\n\t{\n\t  *__result = *__first;\n\t  ++__first;\n\t  ++__result;\n\t}\n      return pair<_InputIterator, _OutputIterator>(__first, __result);\n    }\n\n  template<typename _RAIterator, typename _Size, typename _OutputIterator>\n    inline pair<_RAIterator, _OutputIterator>\n    __copy_n(_RAIterator __first, _Size __count,\n\t     _OutputIterator __result,\n\t     random_access_iterator_tag)\n    {\n      _RAIterator __last = __first + __count;\n      return pair<_RAIterator, _OutputIterator>(__last, std::copy(__first,\n\t\t\t\t\t\t\t\t  __last,\n\t\t\t\t\t\t\t\t  __result));\n    }\n\n  /**\n   *  @brief Copies the range [first,first+count) into [result,result+count).\n   *  @param  first  An input iterator.\n   *  @param  count  The number of elements to copy.\n   *  @param  result An output iterator.\n   *  @return   A std::pair composed of first+count and result+count.\n   *\n   *  This is an SGI extension.\n   *  This inline function will boil down to a call to @c memmove whenever\n   *  possible.  Failing that, if random access iterators are passed, then the\n   *  loop count will be known (and therefore a candidate for compiler\n   *  optimizations such as unrolling).\n   *  @ingroup SGIextensions\n  */\n  template<typename _InputIterator, typename _Size, typename _OutputIterator>\n    inline pair<_InputIterator, _OutputIterator>\n    copy_n(_InputIterator __first, _Size __count, _OutputIterator __result)\n    {\n      // concept requirements\n      __glibcxx_function_requires(_InputIteratorConcept<_InputIterator>)\n      __glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator,\n\t    typename iterator_traits<_InputIterator>::value_type>)\n\n      return __copy_n(__first, __count, __result,\n\t\t      std::__iterator_category(__first));\n    }\n\n  template<typename _InputIterator1, typename _InputIterator2>\n    int\n    __lexicographical_compare_3way(_InputIterator1 __first1,\n\t\t\t\t   _InputIterator1 __last1,\n\t\t\t\t   _InputIterator2 __first2,\n\t\t\t\t   _InputIterator2 __last2)\n    {\n      while (__first1 != __last1 && __first2 != __last2)\n\t{\n\t  if (*__first1 < *__first2)\n\t    return -1;\n\t  if (*__first2 < *__first1)\n\t    return 1;\n\t  ++__first1;\n\t  ++__first2;\n\t}\n      if (__first2 == __last2)\n\treturn !(__first1 == __last1);\n      else\n\treturn -1;\n    }\n\n  inline int\n  __lexicographical_compare_3way(const unsigned char* __first1,\n\t\t\t\t const unsigned char* __last1,\n\t\t\t\t const unsigned char* __first2,\n\t\t\t\t const unsigned char* __last2)\n  {\n    const ptrdiff_t __len1 = __last1 - __first1;\n    const ptrdiff_t __len2 = __last2 - __first2;\n    const int __result = std::memcmp(__first1, __first2, min(__len1, __len2));\n    return __result != 0 ? __result\n\t\t\t : (__len1 == __len2 ? 0 : (__len1 < __len2 ? -1 : 1));\n  }\n\n  inline int\n  __lexicographical_compare_3way(const char* __first1, const char* __last1,\n\t\t\t\t const char* __first2, const char* __last2)\n  {\n#if CHAR_MAX == SCHAR_MAX\n    return __lexicographical_compare_3way((const signed char*) __first1,\n\t\t\t\t\t  (const signed char*) __last1,\n\t\t\t\t\t  (const signed char*) __first2,\n\t\t\t\t\t  (const signed char*) __last2);\n#else\n    return __lexicographical_compare_3way((const unsigned char*) __first1,\n\t\t\t\t\t  (const unsigned char*) __last1,\n\t\t\t\t\t  (const unsigned char*) __first2,\n\t\t\t\t\t  (const unsigned char*) __last2);\n#endif\n  }\n\n  /**\n   *  @brief @c memcmp on steroids.\n   *  @param  first1  An input iterator.\n   *  @param  last1   An input iterator.\n   *  @param  first2  An input iterator.\n   *  @param  last2   An input iterator.\n   *  @return   An int, as with @c memcmp.\n   *\n   *  The return value will be less than zero if the first range is\n   *  \"lexigraphically less than\" the second, greater than zero if the second\n   *  range is \"lexigraphically less than\" the first, and zero otherwise.\n   *  This is an SGI extension.\n   *  @ingroup SGIextensions\n  */\n  template<typename _InputIterator1, typename _InputIterator2>\n    int\n    lexicographical_compare_3way(_InputIterator1 __first1,\n\t\t\t\t _InputIterator1 __last1,\n\t\t\t\t _InputIterator2 __first2,\n\t\t\t\t _InputIterator2 __last2)\n    {\n      // concept requirements\n      __glibcxx_function_requires(_InputIteratorConcept<_InputIterator1>)\n      __glibcxx_function_requires(_InputIteratorConcept<_InputIterator2>)\n      __glibcxx_function_requires(_LessThanComparableConcept<\n\t    typename iterator_traits<_InputIterator1>::value_type>)\n      __glibcxx_function_requires(_LessThanComparableConcept<\n\t    typename iterator_traits<_InputIterator2>::value_type>)\n      __glibcxx_requires_valid_range(__first1, __last1);\n      __glibcxx_requires_valid_range(__first2, __last2);\n\n      return __lexicographical_compare_3way(__first1, __last1, __first2,\n\t\t\t\t\t    __last2);\n    }\n\n  // count and count_if: this version, whose return type is void, was present\n  // in the HP STL, and is retained as an extension for backward compatibility.\n  template<typename _InputIterator, typename _Tp, typename _Size>\n    void\n    count(_InputIterator __first, _InputIterator __last,\n\t  const _Tp& __value,\n\t  _Size& __n)\n    {\n      // concept requirements\n      __glibcxx_function_requires(_InputIteratorConcept<_InputIterator>)\n      __glibcxx_function_requires(_EqualityComparableConcept<\n\t    typename iterator_traits<_InputIterator>::value_type >)\n      __glibcxx_function_requires(_EqualityComparableConcept<_Tp>)\n      __glibcxx_requires_valid_range(__first, __last);\n\n      for ( ; __first != __last; ++__first)\n\tif (*__first == __value)\n\t  ++__n;\n    }\n\n  template<typename _InputIterator, typename _Predicate, typename _Size>\n    void\n    count_if(_InputIterator __first, _InputIterator __last,\n\t     _Predicate __pred,\n\t     _Size& __n)\n    {\n      // concept requirements\n      __glibcxx_function_requires(_InputIteratorConcept<_InputIterator>)\n      __glibcxx_function_requires(_UnaryPredicateConcept<_Predicate,\n\t    typename iterator_traits<_InputIterator>::value_type>)\n      __glibcxx_requires_valid_range(__first, __last);\n\n      for ( ; __first != __last; ++__first)\n\tif (__pred(*__first))\n\t  ++__n;\n    }\n\n  // random_sample and random_sample_n (extensions, not part of the standard).\n\n  /**\n   *  This is an SGI extension.\n   *  @ingroup SGIextensions\n   *  @doctodo\n  */\n  template<typename _ForwardIterator, typename _OutputIterator,\n\t   typename _Distance>\n    _OutputIterator\n    random_sample_n(_ForwardIterator __first, _ForwardIterator __last,\n                    _OutputIterator __out, const _Distance __n)\n    {\n      // concept requirements\n      __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator>)\n      __glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator,\n\t\ttypename iterator_traits<_ForwardIterator>::value_type>)\n      __glibcxx_requires_valid_range(__first, __last);\n\n      _Distance __remaining = std::distance(__first, __last);\n      _Distance __m = min(__n, __remaining);\n\n      while (__m > 0)\n\t{\n\t  if ((std::rand() % __remaining) < __m)\n\t    {\n\t      *__out = *__first;\n\t      ++__out;\n\t      --__m;\n\t    }\n\t  --__remaining;\n\t  ++__first;\n\t}\n      return __out;\n    }\n\n  /**\n   *  This is an SGI extension.\n   *  @ingroup SGIextensions\n   *  @doctodo\n  */\n  template<typename _ForwardIterator, typename _OutputIterator,\n\t   typename _Distance, typename _RandomNumberGenerator>\n    _OutputIterator\n    random_sample_n(_ForwardIterator __first, _ForwardIterator __last,\n                   _OutputIterator __out, const _Distance __n,\n\t\t   _RandomNumberGenerator& __rand)\n    {\n      // concept requirements\n      __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator>)\n      __glibcxx_function_requires(_OutputIteratorConcept<_OutputIterator,\n\t\ttypename iterator_traits<_ForwardIterator>::value_type>)\n      __glibcxx_function_requires(_UnaryFunctionConcept<\n\t\t_RandomNumberGenerator, _Distance, _Distance>)\n      __glibcxx_requires_valid_range(__first, __last);\n\n      _Distance __remaining = std::distance(__first, __last);\n      _Distance __m = min(__n, __remaining);\n\n      while (__m > 0)\n\t{\n\t  if (__rand(__remaining) < __m)\n\t    {\n\t      *__out = *__first;\n\t      ++__out;\n\t      --__m;\n\t    }\n\t  --__remaining;\n\t  ++__first;\n\t}\n      return __out;\n    }\n\n  template<typename _InputIterator, typename _RandomAccessIterator,\n\t   typename _Distance>\n    _RandomAccessIterator\n    __random_sample(_InputIterator __first, _InputIterator __last,\n\t\t    _RandomAccessIterator __out,\n\t\t    const _Distance __n)\n    {\n      _Distance __m = 0;\n      _Distance __t = __n;\n      for ( ; __first != __last && __m < __n; ++__m, ++__first)\n\t__out[__m] = *__first;\n\n      while (__first != __last)\n\t{\n\t  ++__t;\n\t  _Distance __M = std::rand() % (__t);\n\t  if (__M < __n)\n\t    __out[__M] = *__first;\n\t  ++__first;\n\t}\n      return __out + __m;\n    }\n\n  template<typename _InputIterator, typename _RandomAccessIterator,\n\t   typename _RandomNumberGenerator, typename _Distance>\n    _RandomAccessIterator\n    __random_sample(_InputIterator __first, _InputIterator __last,\n\t\t    _RandomAccessIterator __out,\n\t\t    _RandomNumberGenerator& __rand,\n\t\t    const _Distance __n)\n    {\n      // concept requirements\n      __glibcxx_function_requires(_UnaryFunctionConcept<\n\t    _RandomNumberGenerator, _Distance, _Distance>)\n\n      _Distance __m = 0;\n      _Distance __t = __n;\n      for ( ; __first != __last && __m < __n; ++__m, ++__first)\n\t__out[__m] = *__first;\n\n      while (__first != __last)\n\t{\n\t  ++__t;\n\t  _Distance __M = __rand(__t);\n\t  if (__M < __n)\n\t    __out[__M] = *__first;\n\t  ++__first;\n\t}\n      return __out + __m;\n    }\n\n  /**\n   *  This is an SGI extension.\n   *  @ingroup SGIextensions\n   *  @doctodo\n  */\n  template<typename _InputIterator, typename _RandomAccessIterator>\n    inline _RandomAccessIterator\n    random_sample(_InputIterator __first, _InputIterator __last,\n\t\t  _RandomAccessIterator __out_first,\n\t\t  _RandomAccessIterator __out_last)\n    {\n      // concept requirements\n      __glibcxx_function_requires(_InputIteratorConcept<_InputIterator>)\n      __glibcxx_function_requires(_Mutable_RandomAccessIteratorConcept<\n\t    _RandomAccessIterator>)\n      __glibcxx_requires_valid_range(__first, __last);\n      __glibcxx_requires_valid_range(__out_first, __out_last);\n\n      return __random_sample(__first, __last,\n\t\t\t     __out_first, __out_last - __out_first);\n    }\n\n  /**\n   *  This is an SGI extension.\n   *  @ingroup SGIextensions\n   *  @doctodo\n  */\n  template<typename _InputIterator, typename _RandomAccessIterator,\n\t   typename _RandomNumberGenerator>\n    inline _RandomAccessIterator\n    random_sample(_InputIterator __first, _InputIterator __last,\n\t\t  _RandomAccessIterator __out_first,\n\t\t  _RandomAccessIterator __out_last,\n\t\t  _RandomNumberGenerator& __rand)\n    {\n      // concept requirements\n      __glibcxx_function_requires(_InputIteratorConcept<_InputIterator>)\n      __glibcxx_function_requires(_Mutable_RandomAccessIteratorConcept<\n\t    _RandomAccessIterator>)\n      __glibcxx_requires_valid_range(__first, __last);\n      __glibcxx_requires_valid_range(__out_first, __out_last);\n\n      return __random_sample(__first, __last,\n\t\t\t     __out_first, __rand,\n\t\t\t     __out_last - __out_first);\n    }\n\n  /**\n   *  This is an SGI extension.\n   *  @ingroup SGIextensions\n   *  @doctodo\n  */\n  template<typename _RandomAccessIterator>\n    inline bool\n    is_heap(_RandomAccessIterator __first, _RandomAccessIterator __last)\n    {\n      // concept requirements\n      __glibcxx_function_requires(_RandomAccessIteratorConcept<\n\t\t\t\t  _RandomAccessIterator>)\n      __glibcxx_function_requires(_LessThanComparableConcept<\n\t    typename iterator_traits<_RandomAccessIterator>::value_type>)\n      __glibcxx_requires_valid_range(__first, __last);\n\n      return std::__is_heap(__first, __last - __first);\n    }\n\n  /**\n   *  This is an SGI extension.\n   *  @ingroup SGIextensions\n   *  @doctodo\n  */\n  template<typename _RandomAccessIterator, typename _StrictWeakOrdering>\n    inline bool\n    is_heap(_RandomAccessIterator __first, _RandomAccessIterator __last,\n\t    _StrictWeakOrdering __comp)\n    {\n      // concept requirements\n      __glibcxx_function_requires(_RandomAccessIteratorConcept<\n\t\t\t\t  _RandomAccessIterator>)\n      __glibcxx_function_requires(_BinaryPredicateConcept<_StrictWeakOrdering,\n\t    typename iterator_traits<_RandomAccessIterator>::value_type,\n\t    typename iterator_traits<_RandomAccessIterator>::value_type>)\n      __glibcxx_requires_valid_range(__first, __last);\n\n      return std::__is_heap(__first, __comp, __last - __first);\n    }\n\n  // is_sorted, a predicated testing whether a range is sorted in\n  // nondescending order.  This is an extension, not part of the C++\n  // standard.\n\n  /**\n   *  This is an SGI extension.\n   *  @ingroup SGIextensions\n   *  @doctodo\n  */\n  template<typename _ForwardIterator>\n    bool\n    is_sorted(_ForwardIterator __first, _ForwardIterator __last)\n    {\n      // concept requirements\n      __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator>)\n      __glibcxx_function_requires(_LessThanComparableConcept<\n\t    typename iterator_traits<_ForwardIterator>::value_type>)\n      __glibcxx_requires_valid_range(__first, __last);\n\n      if (__first == __last)\n\treturn true;\n\n      _ForwardIterator __next = __first;\n      for (++__next; __next != __last; __first = __next, ++__next)\n\tif (*__next < *__first)\n\t  return false;\n      return true;\n    }\n\n  /**\n   *  This is an SGI extension.\n   *  @ingroup SGIextensions\n   *  @doctodo\n  */\n  template<typename _ForwardIterator, typename _StrictWeakOrdering>\n    bool\n    is_sorted(_ForwardIterator __first, _ForwardIterator __last,\n\t      _StrictWeakOrdering __comp)\n    {\n      // concept requirements\n      __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator>)\n      __glibcxx_function_requires(_BinaryPredicateConcept<_StrictWeakOrdering,\n\t    typename iterator_traits<_ForwardIterator>::value_type,\n\t    typename iterator_traits<_ForwardIterator>::value_type>)\n      __glibcxx_requires_valid_range(__first, __last);\n\n      if (__first == __last)\n\treturn true;\n\n      _ForwardIterator __next = __first;\n      for (++__next; __next != __last; __first = __next, ++__next)\n\tif (__comp(*__next, *__first))\n\t  return false;\n      return true;\n    }\n\n_GLIBCXX_END_NAMESPACE\n\n#endif /* _EXT_ALGORITHM */\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/array_allocator.h",
    "content": "// array allocator -*- C++ -*-\n\n// Copyright (C) 2004, 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n/** @file ext/array_allocator.h\n *  This file is a GNU extension to the Standard C++ Library.\n */\n\n#ifndef _ARRAY_ALLOCATOR_H\n#define _ARRAY_ALLOCATOR_H 1\n\n#include <cstddef>\n#include <new>\n#include <bits/functexcept.h>\n#include <tr1/array>\n\n_GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)\n\n using std::size_t;\n using std::ptrdiff_t;\n\n  /// @brief  Base class.\n template<typename _Tp>\n    class array_allocator_base\n    {\n    public:\n      typedef size_t     \tsize_type;\n      typedef ptrdiff_t  \tdifference_type;\n      typedef _Tp*       \tpointer;\n      typedef const _Tp* \tconst_pointer;\n      typedef _Tp&       \treference;\n      typedef const _Tp&\tconst_reference;\n      typedef _Tp        \tvalue_type;\n\n      pointer\n      address(reference __x) const { return &__x; }\n\n      const_pointer\n      address(const_reference __x) const { return &__x; }\n\n      void\n      deallocate(pointer, size_type)\n      { \n\t// Does nothing.\n      }\n\n      size_type\n      max_size() const throw() \n      { return size_t(-1) / sizeof(_Tp); }\n\n      // _GLIBCXX_RESOLVE_LIB_DEFECTS\n      // 402. wrong new expression in [some_] allocator::construct\n      void \n      construct(pointer __p, const _Tp& __val) \n      { ::new(__p) value_type(__val); }\n\n      void \n      destroy(pointer __p) { __p->~_Tp(); }\n    };  \n\n  /**\n   *  @brief  An allocator that uses previously allocated memory.\n   *  This memory can be externally, globally, or otherwise allocated.\n   */\n  template<typename _Tp, typename _Array = std::tr1::array<_Tp, 1> >\n    class array_allocator : public array_allocator_base<_Tp>\n    {\n    public:\n      typedef size_t     \tsize_type;\n      typedef ptrdiff_t  \tdifference_type;\n      typedef _Tp*       \tpointer;\n      typedef const _Tp* \tconst_pointer;\n      typedef _Tp&       \treference;\n      typedef const _Tp& \tconst_reference;\n      typedef _Tp        \tvalue_type;\n      typedef _Array\t\tarray_type;\n\n    private:\n      array_type* \t_M_array;\n      size_type \t_M_used;\n\n    public:\n     template<typename _Tp1, typename _Array1 = _Array>\n        struct rebind\n        { typedef array_allocator<_Tp1, _Array1> other; };\n\n      array_allocator(array_type* __array = NULL) throw() \n      : _M_array(__array), _M_used(size_type()) { }\n\n      array_allocator(const array_allocator& __o)  throw() \n      : _M_array(__o._M_array), _M_used(__o._M_used) { }\n\n      template<typename _Tp1, typename _Array1>\n        array_allocator(const array_allocator<_Tp1, _Array1>&) throw()\n\t: _M_array(NULL), _M_used(size_type()) { }\n\n      ~array_allocator() throw() { }\n\n      pointer\n      allocate(size_type __n, const void* = 0)\n      {\n\tif (_M_array == 0 || _M_used + __n > _M_array->size())\n\t  std::__throw_bad_alloc();\n\tpointer __ret = _M_array->begin() + _M_used;\n\t_M_used += __n;\n\treturn __ret;\n      }\n    };\n\n  template<typename _Tp, typename _Array>\n    inline bool\n    operator==(const array_allocator<_Tp, _Array>&,\n\t       const array_allocator<_Tp, _Array>&)\n    { return true; }\n  \n  template<typename _Tp, typename _Array>\n    inline bool\n    operator!=(const array_allocator<_Tp, _Array>&, \n\t       const array_allocator<_Tp, _Array>&)\n    { return false; }\n\n_GLIBCXX_END_NAMESPACE\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/atomicity.h",
    "content": "// Support for atomic operations -*- C++ -*-\n\n// Copyright (C) 2004, 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n/** @file atomicity.h\n *  This is an internal header file, included by other library headers.\n *  You should not attempt to use it directly.\n */\n\n#ifndef _GLIBCXX_ATOMICITY_H\n#define _GLIBCXX_ATOMICITY_H\t1\n\n#include <bits/c++config.h>\n#include <bits/gthr.h>\n#include <bits/atomic_word.h>\n\n_GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)\n\n  // Functions for portable atomic access.\n  // To abstract locking primatives across all thread policies, use:\n  // __exchange_and_add_dispatch\n  // __atomic_add_dispatch\n#ifdef _GLIBCXX_ATOMIC_BUILTINS\n  static inline _Atomic_word \n  __exchange_and_add(volatile _Atomic_word* __mem, int __val)\n  { return __sync_fetch_and_add(__mem, __val); }\n\n  static inline void\n  __atomic_add(volatile _Atomic_word* __mem, int __val)\n  { __sync_fetch_and_add(__mem, __val); }\n#else\n  _Atomic_word\n  __attribute__ ((__unused__))\n  __exchange_and_add(volatile _Atomic_word*, int);\n\n  void\n  __attribute__ ((__unused__))\n  __atomic_add(volatile _Atomic_word*, int);\n#endif\n\n  static inline _Atomic_word\n  __exchange_and_add_single(_Atomic_word* __mem, int __val)\n  {\n    _Atomic_word __result = *__mem;\n    *__mem += __val;\n    return __result;\n  }\n\n  static inline void\n  __atomic_add_single(_Atomic_word* __mem, int __val)\n  { *__mem += __val; }\n\n  static inline _Atomic_word\n  __attribute__ ((__unused__))\n  __exchange_and_add_dispatch(_Atomic_word* __mem, int __val)\n  {\n#ifdef __GTHREADS\n    if (__gthread_active_p())\n      return __exchange_and_add(__mem, __val);\n    else\n      return __exchange_and_add_single(__mem, __val);\n#else\n    return __exchange_and_add_single(__mem, __val);\n#endif\n  }\n\n  static inline void\n  __attribute__ ((__unused__))\n  __atomic_add_dispatch(_Atomic_word* __mem, int __val)\n  {\n#ifdef __GTHREADS\n    if (__gthread_active_p())\n      __atomic_add(__mem, __val);\n    else\n      __atomic_add_single(__mem, __val);\n#else\n    __atomic_add_single(__mem, __val);\n#endif\n  }\n\n_GLIBCXX_END_NAMESPACE\n\n// Even if the CPU doesn't need a memory barrier, we need to ensure\n// that the compiler doesn't reorder memory accesses across the\n// barriers.\n#ifndef _GLIBCXX_READ_MEM_BARRIER\n#define _GLIBCXX_READ_MEM_BARRIER __asm __volatile (\"\":::\"memory\")\n#endif\n#ifndef _GLIBCXX_WRITE_MEM_BARRIER\n#define _GLIBCXX_WRITE_MEM_BARRIER __asm __volatile (\"\":::\"memory\")\n#endif\n\n#endif \n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/bitmap_allocator.h",
    "content": "// Bitmap Allocator. -*- C++ -*-\n\n// Copyright (C) 2004, 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n/** @file ext/bitmap_allocator.h\n *  This file is a GNU extension to the Standard C++ Library.\n */\n\n#ifndef _BITMAP_ALLOCATOR_H\n#define _BITMAP_ALLOCATOR_H 1\n\n#include <cstddef> // For std::size_t, and ptrdiff_t.\n#include <bits/functexcept.h> // For __throw_bad_alloc().\n#include <utility> // For std::pair.\n#include <functional> // For greater_equal, and less_equal.\n#include <new> // For operator new.\n#include <debug/debug.h> // _GLIBCXX_DEBUG_ASSERT\n#include <ext/concurrence.h>\n\n\n/** @brief The constant in the expression below is the alignment\n * required in bytes.\n */\n#define _BALLOC_ALIGN_BYTES 8\n\n_GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)\n\n  using std::size_t;\n  using std::ptrdiff_t;\n\n  namespace __detail\n  {\n    /** @class  __mini_vector bitmap_allocator.h bitmap_allocator.h\n     *\n     *  @brief  __mini_vector<> is a stripped down version of the\n     *  full-fledged std::vector<>.\n     *\n     *  It is to be used only for built-in types or PODs. Notable\n     *  differences are:\n     * \n     *  @detail\n     *  1. Not all accessor functions are present.\n     *  2. Used ONLY for PODs.\n     *  3. No Allocator template argument. Uses ::operator new() to get\n     *  memory, and ::operator delete() to free it.\n     *  Caveat: The dtor does NOT free the memory allocated, so this a\n     *  memory-leaking vector!\n     */\n    template<typename _Tp>\n      class __mini_vector\n      {\n\t__mini_vector(const __mini_vector&);\n\t__mini_vector& operator=(const __mini_vector&);\n\n      public:\n\ttypedef _Tp value_type;\n\ttypedef _Tp* pointer;\n\ttypedef _Tp& reference;\n\ttypedef const _Tp& const_reference;\n\ttypedef size_t size_type;\n\ttypedef ptrdiff_t difference_type;\n\ttypedef pointer iterator;\n\n      private:\n\tpointer _M_start;\n\tpointer _M_finish;\n\tpointer _M_end_of_storage;\n\n\tsize_type\n\t_M_space_left() const throw()\n\t{ return _M_end_of_storage - _M_finish; }\n\n\tpointer\n\tallocate(size_type __n)\n\t{ return static_cast<pointer>(::operator new(__n * sizeof(_Tp))); }\n\n\tvoid\n\tdeallocate(pointer __p, size_type)\n\t{ ::operator delete(__p); }\n\n      public:\n\t// Members used: size(), push_back(), pop_back(),\n\t// insert(iterator, const_reference), erase(iterator),\n\t// begin(), end(), back(), operator[].\n\n\t__mini_vector() : _M_start(0), _M_finish(0), \n\t\t\t  _M_end_of_storage(0)\n\t{ }\n\n#if 0\n\t~__mini_vector()\n\t{\n\t  if (this->_M_start)\n\t    {\n\t      this->deallocate(this->_M_start, this->_M_end_of_storage \n\t\t\t       - this->_M_start);\n\t    }\n\t}\n#endif\n\n\tsize_type\n\tsize() const throw()\n\t{ return _M_finish - _M_start; }\n\n\titerator\n\tbegin() const throw()\n\t{ return this->_M_start; }\n\n\titerator\n\tend() const throw()\n\t{ return this->_M_finish; }\n\n\treference\n\tback() const throw()\n\t{ return *(this->end() - 1); }\n\n\treference\n\toperator[](const size_type __pos) const throw()\n\t{ return this->_M_start[__pos]; }\n\n\tvoid\n\tinsert(iterator __pos, const_reference __x);\n\n\tvoid\n\tpush_back(const_reference __x)\n\t{\n\t  if (this->_M_space_left())\n\t    {\n\t      *this->end() = __x;\n\t      ++this->_M_finish;\n\t    }\n\t  else\n\t    this->insert(this->end(), __x);\n\t}\n\n\tvoid\n\tpop_back() throw()\n\t{ --this->_M_finish; }\n\n\tvoid\n\terase(iterator __pos) throw();\n\n\tvoid\n\tclear() throw()\n\t{ this->_M_finish = this->_M_start; }\n      };\n\n    // Out of line function definitions.\n    template<typename _Tp>\n      void __mini_vector<_Tp>::\n      insert(iterator __pos, const_reference __x)\n      {\n\tif (this->_M_space_left())\n\t  {\n\t    size_type __to_move = this->_M_finish - __pos;\n\t    iterator __dest = this->end();\n\t    iterator __src = this->end() - 1;\n\n\t    ++this->_M_finish;\n\t    while (__to_move)\n\t      {\n\t\t*__dest = *__src;\n\t\t--__dest; --__src; --__to_move;\n\t      }\n\t    *__pos = __x;\n\t  }\n\telse\n\t  {\n\t    size_type __new_size = this->size() ? this->size() * 2 : 1;\n\t    iterator __new_start = this->allocate(__new_size);\n\t    iterator __first = this->begin();\n\t    iterator __start = __new_start;\n\t    while (__first != __pos)\n\t      {\n\t\t*__start = *__first;\n\t\t++__start; ++__first;\n\t      }\n\t    *__start = __x;\n\t    ++__start;\n\t    while (__first != this->end())\n\t      {\n\t\t*__start = *__first;\n\t\t++__start; ++__first;\n\t      }\n\t    if (this->_M_start)\n\t      this->deallocate(this->_M_start, this->size());\n\n\t    this->_M_start = __new_start;\n\t    this->_M_finish = __start;\n\t    this->_M_end_of_storage = this->_M_start + __new_size;\n\t  }\n      }\n\n    template<typename _Tp>\n      void __mini_vector<_Tp>::\n      erase(iterator __pos) throw()\n      {\n\twhile (__pos + 1 != this->end())\n\t  {\n\t    *__pos = __pos[1];\n\t    ++__pos;\n\t  }\n\t--this->_M_finish;\n      }\n\n\n    template<typename _Tp>\n      struct __mv_iter_traits\n      {\n\ttypedef typename _Tp::value_type value_type;\n\ttypedef typename _Tp::difference_type difference_type;\n      };\n\n    template<typename _Tp>\n      struct __mv_iter_traits<_Tp*>\n      {\n\ttypedef _Tp value_type;\n\ttypedef ptrdiff_t difference_type;\n      };\n\n    enum \n      { \n\tbits_per_byte = 8,\n\tbits_per_block = sizeof(size_t) * size_t(bits_per_byte) \n      };\n\n    template<typename _ForwardIterator, typename _Tp, typename _Compare>\n      _ForwardIterator\n      __lower_bound(_ForwardIterator __first, _ForwardIterator __last,\n\t\t    const _Tp& __val, _Compare __comp)\n      {\n\ttypedef typename __mv_iter_traits<_ForwardIterator>::value_type\n\t  _ValueType;\n\ttypedef typename __mv_iter_traits<_ForwardIterator>::difference_type\n\t  _DistanceType;\n\n\t_DistanceType __len = __last - __first;\n\t_DistanceType __half;\n\t_ForwardIterator __middle;\n\n\twhile (__len > 0)\n\t  {\n\t    __half = __len >> 1;\n\t    __middle = __first;\n\t    __middle += __half;\n\t    if (__comp(*__middle, __val))\n\t      {\n\t\t__first = __middle;\n\t\t++__first;\n\t\t__len = __len - __half - 1;\n\t      }\n\t    else\n\t      __len = __half;\n\t  }\n\treturn __first;\n      }\n\n    template<typename _InputIterator, typename _Predicate>\n      inline _InputIterator\n      __find_if(_InputIterator __first, _InputIterator __last, _Predicate __p)\n      {\n\twhile (__first != __last && !__p(*__first))\n\t  ++__first;\n\treturn __first;\n      }\n\n    /** @brief The number of Blocks pointed to by the address pair\n     *  passed to the function.\n     */\n    template<typename _AddrPair>\n      inline size_t\n      __num_blocks(_AddrPair __ap)\n      { return (__ap.second - __ap.first) + 1; }\n\n    /** @brief The number of Bit-maps pointed to by the address pair\n     *  passed to the function.\n     */\n    template<typename _AddrPair>\n      inline size_t\n      __num_bitmaps(_AddrPair __ap)\n      { return __num_blocks(__ap) / size_t(bits_per_block); }\n\n    // _Tp should be a pointer type.\n    template<typename _Tp>\n      class _Inclusive_between \n      : public std::unary_function<typename std::pair<_Tp, _Tp>, bool>\n      {\n\ttypedef _Tp pointer;\n\tpointer _M_ptr_value;\n\ttypedef typename std::pair<_Tp, _Tp> _Block_pair;\n\t\n      public:\n\t_Inclusive_between(pointer __ptr) : _M_ptr_value(__ptr) \n\t{ }\n\t\n\tbool \n\toperator()(_Block_pair __bp) const throw()\n\t{\n\t  if (std::less_equal<pointer>()(_M_ptr_value, __bp.second) \n\t      && std::greater_equal<pointer>()(_M_ptr_value, __bp.first))\n\t    return true;\n\t  else\n\t    return false;\n\t}\n      };\n  \n    // Used to pass a Functor to functions by reference.\n    template<typename _Functor>\n      class _Functor_Ref \n      : public std::unary_function<typename _Functor::argument_type, \n\t\t\t\t   typename _Functor::result_type>\n      {\n\t_Functor& _M_fref;\n\t\n      public:\n\ttypedef typename _Functor::argument_type argument_type;\n\ttypedef typename _Functor::result_type result_type;\n\n\t_Functor_Ref(_Functor& __fref) : _M_fref(__fref) \n\t{ }\n\n\tresult_type \n\toperator()(argument_type __arg) \n\t{ return _M_fref(__arg); }\n      };\n\n    /** @class  _Ffit_finder bitmap_allocator.h bitmap_allocator.h\n     *\n     *  @brief  The class which acts as a predicate for applying the\n     *  first-fit memory allocation policy for the bitmap allocator.\n     */\n    // _Tp should be a pointer type, and _Alloc is the Allocator for\n    // the vector.\n    template<typename _Tp>\n      class _Ffit_finder \n      : public std::unary_function<typename std::pair<_Tp, _Tp>, bool>\n      {\n\ttypedef typename std::pair<_Tp, _Tp> _Block_pair;\n\ttypedef typename __detail::__mini_vector<_Block_pair> _BPVector;\n\ttypedef typename _BPVector::difference_type _Counter_type;\n\n\tsize_t* _M_pbitmap;\n\t_Counter_type _M_data_offset;\n\n      public:\n\t_Ffit_finder() : _M_pbitmap(0), _M_data_offset(0)\n\t{ }\n\n\tbool \n\toperator()(_Block_pair __bp) throw()\n\t{\n\t  // Set the _rover to the last physical location bitmap,\n\t  // which is the bitmap which belongs to the first free\n\t  // block. Thus, the bitmaps are in exact reverse order of\n\t  // the actual memory layout. So, we count down the bimaps,\n\t  // which is the same as moving up the memory.\n\n\t  // If the used count stored at the start of the Bit Map headers\n\t  // is equal to the number of Objects that the current Block can\n\t  // store, then there is definitely no space for another single\n\t  // object, so just return false.\n\t  _Counter_type __diff = \n\t    __gnu_cxx::__detail::__num_bitmaps(__bp);\n\n\t  if (*(reinterpret_cast<size_t*>\n\t\t(__bp.first) - (__diff + 1))\n\t      == __gnu_cxx::__detail::__num_blocks(__bp))\n\t    return false;\n\n\t  size_t* __rover = reinterpret_cast<size_t*>(__bp.first) - 1;\n\n\t  for (_Counter_type __i = 0; __i < __diff; ++__i)\n\t    {\n\t      _M_data_offset = __i;\n\t      if (*__rover)\n\t\t{\n\t\t  _M_pbitmap = __rover;\n\t\t  return true;\n\t\t}\n\t      --__rover;\n\t    }\n\t  return false;\n\t}\n\n    \n\tsize_t*\n\t_M_get() const throw()\n\t{ return _M_pbitmap; }\n\n\t_Counter_type\n\t_M_offset() const throw()\n\t{ return _M_data_offset * size_t(bits_per_block); }\n      };\n\n\n    /** @class  _Bitmap_counter bitmap_allocator.h bitmap_allocator.h\n     *\n     *  @brief  The bitmap counter which acts as the bitmap\n     *  manipulator, and manages the bit-manipulation functions and\n     *  the searching and identification functions on the bit-map.\n     */\n    // _Tp should be a pointer type.\n    template<typename _Tp>\n      class _Bitmap_counter\n      {\n\ttypedef typename __detail::__mini_vector<typename std::pair<_Tp, _Tp> >\n\t_BPVector;\n\ttypedef typename _BPVector::size_type _Index_type;\n\ttypedef _Tp pointer;\n    \n\t_BPVector& _M_vbp;\n\tsize_t* _M_curr_bmap;\n\tsize_t* _M_last_bmap_in_block;\n\t_Index_type _M_curr_index;\n    \n      public:\n\t// Use the 2nd parameter with care. Make sure that such an\n\t// entry exists in the vector before passing that particular\n\t// index to this ctor.\n\t_Bitmap_counter(_BPVector& Rvbp, long __index = -1) : _M_vbp(Rvbp)\n\t{ this->_M_reset(__index); }\n    \n\tvoid \n\t_M_reset(long __index = -1) throw()\n\t{\n\t  if (__index == -1)\n\t    {\n\t      _M_curr_bmap = 0;\n\t      _M_curr_index = static_cast<_Index_type>(-1);\n\t      return;\n\t    }\n\n\t  _M_curr_index = __index;\n\t  _M_curr_bmap = reinterpret_cast<size_t*>\n\t    (_M_vbp[_M_curr_index].first) - 1;\n\t  \n\t  _GLIBCXX_DEBUG_ASSERT(__index <= (long)_M_vbp.size() - 1);\n\t\n\t  _M_last_bmap_in_block = _M_curr_bmap\n\t    - ((_M_vbp[_M_curr_index].second \n\t\t- _M_vbp[_M_curr_index].first + 1) \n\t       / size_t(bits_per_block) - 1);\n\t}\n    \n\t// Dangerous Function! Use with extreme care. Pass to this\n\t// function ONLY those values that are known to be correct,\n\t// otherwise this will mess up big time.\n\tvoid\n\t_M_set_internal_bitmap(size_t* __new_internal_marker) throw()\n\t{ _M_curr_bmap = __new_internal_marker; }\n    \n\tbool\n\t_M_finished() const throw()\n\t{ return(_M_curr_bmap == 0); }\n    \n\t_Bitmap_counter&\n\toperator++() throw()\n\t{\n\t  if (_M_curr_bmap == _M_last_bmap_in_block)\n\t    {\n\t      if (++_M_curr_index == _M_vbp.size())\n\t\t_M_curr_bmap = 0;\n\t      else\n\t\tthis->_M_reset(_M_curr_index);\n\t    }\n\t  else\n\t    --_M_curr_bmap;\n\t  return *this;\n\t}\n    \n\tsize_t*\n\t_M_get() const throw()\n\t{ return _M_curr_bmap; }\n    \n\tpointer \n\t_M_base() const throw()\n\t{ return _M_vbp[_M_curr_index].first; }\n\n\t_Index_type\n\t_M_offset() const throw()\n\t{\n\t  return size_t(bits_per_block)\n\t    * ((reinterpret_cast<size_t*>(this->_M_base()) \n\t\t- _M_curr_bmap) - 1);\n\t}\n    \n\t_Index_type\n\t_M_where() const throw()\n\t{ return _M_curr_index; }\n      };\n\n    /** @brief  Mark a memory address as allocated by re-setting the\n     *  corresponding bit in the bit-map.\n     */\n    inline void \n    __bit_allocate(size_t* __pbmap, size_t __pos) throw()\n    {\n      size_t __mask = 1 << __pos;\n      __mask = ~__mask;\n      *__pbmap &= __mask;\n    }\n  \n    /** @brief  Mark a memory address as free by setting the\n     *  corresponding bit in the bit-map.\n     */\n    inline void \n    __bit_free(size_t* __pbmap, size_t __pos) throw()\n    {\n      size_t __mask = 1 << __pos;\n      *__pbmap |= __mask;\n    }\n  } // namespace __detail\n\n  /** @brief  Generic Version of the bsf instruction.\n   */\n  inline size_t \n  _Bit_scan_forward(size_t __num)\n  { return static_cast<size_t>(__builtin_ctzl(__num)); }\n\n  /** @class  free_list bitmap_allocator.h bitmap_allocator.h\n   *\n   *  @brief  The free list class for managing chunks of memory to be\n   *  given to and returned by the bitmap_allocator.\n   */\n  class free_list\n  {\n  public:\n    typedef size_t* \t\t\t\tvalue_type;\n    typedef __detail::__mini_vector<value_type> vector_type;\n    typedef vector_type::iterator \t\titerator;\n    typedef __mutex\t\t\t\t__mutex_type;\n\n  private:\n    struct _LT_pointer_compare\n    {\n      bool\n      operator()(const size_t* __pui, \n\t\t const size_t __cui) const throw()\n      { return *__pui < __cui; }\n    };\n\n#if defined __GTHREADS\n    __mutex_type&\n    _M_get_mutex()\n    {\n      static __mutex_type _S_mutex;\n      return _S_mutex;\n    }\n#endif\n\n    vector_type&\n    _M_get_free_list()\n    {\n      static vector_type _S_free_list;\n      return _S_free_list;\n    }\n\n    /** @brief  Performs validation of memory based on their size.\n     *\n     *  @param  __addr The pointer to the memory block to be\n     *  validated.\n     *\n     *  @detail  Validates the memory block passed to this function and\n     *  appropriately performs the action of managing the free list of\n     *  blocks by adding this block to the free list or deleting this\n     *  or larger blocks from the free list.\n     */\n    void\n    _M_validate(size_t* __addr) throw()\n    {\n      vector_type& __free_list = _M_get_free_list();\n      const vector_type::size_type __max_size = 64;\n      if (__free_list.size() >= __max_size)\n\t{\n\t  // Ok, the threshold value has been reached.  We determine\n\t  // which block to remove from the list of free blocks.\n\t  if (*__addr >= *__free_list.back())\n\t    {\n\t      // Ok, the new block is greater than or equal to the\n\t      // last block in the list of free blocks. We just free\n\t      // the new block.\n\t      ::operator delete(static_cast<void*>(__addr));\n\t      return;\n\t    }\n\t  else\n\t    {\n\t      // Deallocate the last block in the list of free lists,\n\t      // and insert the new one in it's correct position.\n\t      ::operator delete(static_cast<void*>(__free_list.back()));\n\t      __free_list.pop_back();\n\t    }\n\t}\n\t  \n      // Just add the block to the list of free lists unconditionally.\n      iterator __temp = __gnu_cxx::__detail::__lower_bound\n\t(__free_list.begin(), __free_list.end(), \n\t *__addr, _LT_pointer_compare());\n\n      // We may insert the new free list before _temp;\n      __free_list.insert(__temp, __addr);\n    }\n\n    /** @brief  Decides whether the wastage of memory is acceptable for\n     *  the current memory request and returns accordingly.\n     *\n     *  @param __block_size The size of the block available in the free\n     *  list.\n     *\n     *  @param __required_size The required size of the memory block.\n     *\n     *  @return true if the wastage incurred is acceptable, else returns\n     *  false.\n     */\n    bool \n    _M_should_i_give(size_t __block_size, \n\t\t     size_t __required_size) throw()\n    {\n      const size_t __max_wastage_percentage = 36;\n      if (__block_size >= __required_size && \n\t  (((__block_size - __required_size) * 100 / __block_size)\n\t   < __max_wastage_percentage))\n\treturn true;\n      else\n\treturn false;\n    }\n\n  public:\n    /** @brief This function returns the block of memory to the\n     *  internal free list.\n     *\n     *  @param  __addr The pointer to the memory block that was given\n     *  by a call to the _M_get function.\n     */\n    inline void \n    _M_insert(size_t* __addr) throw()\n    {\n#if defined __GTHREADS\n      __gnu_cxx::__scoped_lock __bfl_lock(_M_get_mutex());\n#endif\n      // Call _M_validate to decide what should be done with\n      // this particular free list.\n      this->_M_validate(reinterpret_cast<size_t*>(__addr) - 1);\n      // See discussion as to why this is 1!\n    }\n    \n    /** @brief  This function gets a block of memory of the specified\n     *  size from the free list.\n     *\n     *  @param  __sz The size in bytes of the memory required.\n     *\n     *  @return  A pointer to the new memory block of size at least\n     *  equal to that requested.\n     */\n    size_t*\n    _M_get(size_t __sz) throw(std::bad_alloc);\n\n    /** @brief  This function just clears the internal Free List, and\n     *  gives back all the memory to the OS.\n     */\n    void \n    _M_clear();\n  };\n\n\n  // Forward declare the class.\n  template<typename _Tp> \n    class bitmap_allocator;\n\n  // Specialize for void:\n  template<>\n    class bitmap_allocator<void>\n    {\n    public:\n      typedef void*       pointer;\n      typedef const void* const_pointer;\n\n      // Reference-to-void members are impossible.\n      typedef void  value_type;\n      template<typename _Tp1>\n        struct rebind\n\t{\n\t  typedef bitmap_allocator<_Tp1> other;\n\t};\n    };\n\n  template<typename _Tp>\n    class bitmap_allocator : private free_list\n    {\n    public:\n      typedef size_t    \t\tsize_type;\n      typedef ptrdiff_t \t\tdifference_type;\n      typedef _Tp*        \t\tpointer;\n      typedef const _Tp*  \t\tconst_pointer;\n      typedef _Tp&        \t\treference;\n      typedef const _Tp&  \t\tconst_reference;\n      typedef _Tp         \t\tvalue_type;\n      typedef free_list::__mutex_type \t__mutex_type;\n\n      template<typename _Tp1>\n        struct rebind\n\t{\n\t  typedef bitmap_allocator<_Tp1> other;\n\t};\n\n    private:\n      template<size_t _BSize, size_t _AlignSize>\n        struct aligned_size\n\t{\n\t  enum\n\t    { \n\t      modulus = _BSize % _AlignSize,\n\t      value = _BSize + (modulus ? _AlignSize - (modulus) : 0)\n\t    };\n\t};\n\n      struct _Alloc_block\n      {\n\tchar __M_unused[aligned_size<sizeof(value_type),\n\t\t\t_BALLOC_ALIGN_BYTES>::value];\n      };\n\n\n      typedef typename std::pair<_Alloc_block*, _Alloc_block*> _Block_pair;\n\n      typedef typename \n      __detail::__mini_vector<_Block_pair> _BPVector;\n\n#if defined _GLIBCXX_DEBUG\n      // Complexity: O(lg(N)). Where, N is the number of block of size\n      // sizeof(value_type).\n      void \n      _S_check_for_free_blocks() throw()\n      {\n\ttypedef typename \n\t  __gnu_cxx::__detail::_Ffit_finder<_Alloc_block*> _FFF;\n\t_FFF __fff;\n\ttypedef typename _BPVector::iterator _BPiter;\n\t_BPiter __bpi = \n\t  __gnu_cxx::__detail::__find_if\n\t  (_S_mem_blocks.begin(), _S_mem_blocks.end(), \n\t   __gnu_cxx::__detail::_Functor_Ref<_FFF>(__fff));\n\n\t_GLIBCXX_DEBUG_ASSERT(__bpi == _S_mem_blocks.end());\n      }\n#endif\n\n      /** @brief  Responsible for exponentially growing the internal\n       *  memory pool.\n       *\n       *  @throw  std::bad_alloc. If memory can not be allocated.\n       *\n       *  @detail  Complexity: O(1), but internally depends upon the\n       *  complexity of the function free_list::_M_get. The part where\n       *  the bitmap headers are written has complexity: O(X),where X\n       *  is the number of blocks of size sizeof(value_type) within\n       *  the newly acquired block. Having a tight bound.\n       */\n      void \n      _S_refill_pool() throw(std::bad_alloc)\n      {\n#if defined _GLIBCXX_DEBUG\n\t_S_check_for_free_blocks();\n#endif\n\n\tconst size_t __num_bitmaps = (_S_block_size\n\t\t\t\t      / size_t(__detail::bits_per_block));\n\tconst size_t __size_to_allocate = sizeof(size_t) \n\t  + _S_block_size * sizeof(_Alloc_block) \n\t  + __num_bitmaps * sizeof(size_t);\n\n\tsize_t* __temp = \n\t  reinterpret_cast<size_t*>\n\t  (this->_M_get(__size_to_allocate));\n\t*__temp = 0;\n\t++__temp;\n\n\t// The Header information goes at the Beginning of the Block.\n\t_Block_pair __bp = \n\t  std::make_pair(reinterpret_cast<_Alloc_block*>\n\t\t\t (__temp + __num_bitmaps), \n\t\t\t reinterpret_cast<_Alloc_block*>\n\t\t\t (__temp + __num_bitmaps) \n\t\t\t + _S_block_size - 1);\n\t\n\t// Fill the Vector with this information.\n\t_S_mem_blocks.push_back(__bp);\n\n\tsize_t __bit_mask = 0; // 0 Indicates all Allocated.\n\t__bit_mask = ~__bit_mask; // 1 Indicates all Free.\n\n\tfor (size_t __i = 0; __i < __num_bitmaps; ++__i)\n\t  __temp[__i] = __bit_mask;\n\n\t_S_block_size *= 2;\n      }\n\n\n      static _BPVector _S_mem_blocks;\n      static size_t _S_block_size;\n      static __gnu_cxx::__detail::\n      _Bitmap_counter<_Alloc_block*> _S_last_request;\n      static typename _BPVector::size_type _S_last_dealloc_index;\n#if defined __GTHREADS\n      static __mutex_type _S_mut;\n#endif\n\n    public:\n\n      /** @brief  Allocates memory for a single object of size\n       *  sizeof(_Tp).\n       *\n       *  @throw  std::bad_alloc. If memory can not be allocated.\n       *\n       *  @detail  Complexity: Worst case complexity is O(N), but that\n       *  is hardly ever hit. If and when this particular case is\n       *  encountered, the next few cases are guaranteed to have a\n       *  worst case complexity of O(1)!  That's why this function\n       *  performs very well on average. You can consider this\n       *  function to have a complexity referred to commonly as:\n       *  Amortized Constant time.\n       */\n      pointer \n      _M_allocate_single_object() throw(std::bad_alloc)\n      {\n#if defined __GTHREADS\n\t__gnu_cxx::__scoped_lock __bit_lock(_S_mut);\n#endif\n\n\t// The algorithm is something like this: The last_request\n\t// variable points to the last accessed Bit Map. When such a\n\t// condition occurs, we try to find a free block in the\n\t// current bitmap, or succeeding bitmaps until the last bitmap\n\t// is reached. If no free block turns up, we resort to First\n\t// Fit method.\n\n\t// WARNING: Do not re-order the condition in the while\n\t// statement below, because it relies on C++'s short-circuit\n\t// evaluation. The return from _S_last_request->_M_get() will\n\t// NOT be dereference able if _S_last_request->_M_finished()\n\t// returns true. This would inevitably lead to a NULL pointer\n\t// dereference if tinkered with.\n\twhile (_S_last_request._M_finished() == false\n\t       && (*(_S_last_request._M_get()) == 0))\n\t  {\n\t    _S_last_request.operator++();\n\t  }\n\n\tif (__builtin_expect(_S_last_request._M_finished() == true, false))\n\t  {\n\t    // Fall Back to First Fit algorithm.\n\t    typedef typename \n\t      __gnu_cxx::__detail::_Ffit_finder<_Alloc_block*> _FFF;\n\t    _FFF __fff;\n\t    typedef typename _BPVector::iterator _BPiter;\n\t    _BPiter __bpi = \n\t      __gnu_cxx::__detail::__find_if\n\t      (_S_mem_blocks.begin(), _S_mem_blocks.end(), \n\t       __gnu_cxx::__detail::_Functor_Ref<_FFF>(__fff));\n\n\t    if (__bpi != _S_mem_blocks.end())\n\t      {\n\t\t// Search was successful. Ok, now mark the first bit from\n\t\t// the right as 0, meaning Allocated. This bit is obtained\n\t\t// by calling _M_get() on __fff.\n\t\tsize_t __nz_bit = _Bit_scan_forward(*__fff._M_get());\n\t\t__detail::__bit_allocate(__fff._M_get(), __nz_bit);\n\n\t\t_S_last_request._M_reset(__bpi - _S_mem_blocks.begin());\n\n\t\t// Now, get the address of the bit we marked as allocated.\n\t\tpointer __ret = reinterpret_cast<pointer>\n\t\t  (__bpi->first + __fff._M_offset() + __nz_bit);\n\t\tsize_t* __puse_count = \n\t\t  reinterpret_cast<size_t*>\n\t\t  (__bpi->first) \n\t\t  - (__gnu_cxx::__detail::__num_bitmaps(*__bpi) + 1);\n\t\t\n\t\t++(*__puse_count);\n\t\treturn __ret;\n\t      }\n\t    else\n\t      {\n\t\t// Search was unsuccessful. We Add more memory to the\n\t\t// pool by calling _S_refill_pool().\n\t\t_S_refill_pool();\n\n\t\t// _M_Reset the _S_last_request structure to the first\n\t\t// free block's bit map.\n\t\t_S_last_request._M_reset(_S_mem_blocks.size() - 1);\n\n\t\t// Now, mark that bit as allocated.\n\t      }\n\t  }\n\n\t// _S_last_request holds a pointer to a valid bit map, that\n\t// points to a free block in memory.\n\tsize_t __nz_bit = _Bit_scan_forward(*_S_last_request._M_get());\n\t__detail::__bit_allocate(_S_last_request._M_get(), __nz_bit);\n\n\tpointer __ret = reinterpret_cast<pointer>\n\t  (_S_last_request._M_base() + _S_last_request._M_offset() + __nz_bit);\n\n\tsize_t* __puse_count = reinterpret_cast<size_t*>\n\t  (_S_mem_blocks[_S_last_request._M_where()].first)\n\t  - (__gnu_cxx::__detail::\n\t     __num_bitmaps(_S_mem_blocks[_S_last_request._M_where()]) + 1);\n\n\t++(*__puse_count);\n\treturn __ret;\n      }\n\n      /** @brief  Deallocates memory that belongs to a single object of\n       *  size sizeof(_Tp).\n       *\n       *  @detail  Complexity: O(lg(N)), but the worst case is not hit\n       *  often!  This is because containers usually deallocate memory\n       *  close to each other and this case is handled in O(1) time by\n       *  the deallocate function.\n       */\n      void \n      _M_deallocate_single_object(pointer __p) throw()\n      {\n#if defined __GTHREADS\n\t__gnu_cxx::__scoped_lock __bit_lock(_S_mut);\n#endif\n\t_Alloc_block* __real_p = reinterpret_cast<_Alloc_block*>(__p);\n\n\ttypedef typename _BPVector::iterator _Iterator;\n\ttypedef typename _BPVector::difference_type _Difference_type;\n\n\t_Difference_type __diff;\n\tlong __displacement;\n\n\t_GLIBCXX_DEBUG_ASSERT(_S_last_dealloc_index >= 0);\n\n\t\n\tif (__gnu_cxx::__detail::_Inclusive_between<_Alloc_block*>\n\t    (__real_p) (_S_mem_blocks[_S_last_dealloc_index]))\n\t  {\n\t    _GLIBCXX_DEBUG_ASSERT(_S_last_dealloc_index\n\t\t\t\t  <= _S_mem_blocks.size() - 1);\n\n\t    // Initial Assumption was correct!\n\t    __diff = _S_last_dealloc_index;\n\t    __displacement = __real_p - _S_mem_blocks[__diff].first;\n\t  }\n\telse\n\t  {\n\t    _Iterator _iter = __gnu_cxx::__detail::\n\t      __find_if(_S_mem_blocks.begin(), \n\t\t\t_S_mem_blocks.end(), \n\t\t\t__gnu_cxx::__detail::\n\t\t\t_Inclusive_between<_Alloc_block*>(__real_p));\n\n\t    _GLIBCXX_DEBUG_ASSERT(_iter != _S_mem_blocks.end());\n\n\t    __diff = _iter - _S_mem_blocks.begin();\n\t    __displacement = __real_p - _S_mem_blocks[__diff].first;\n\t    _S_last_dealloc_index = __diff;\n\t  }\n\n\t// Get the position of the iterator that has been found.\n\tconst size_t __rotate = (__displacement\n\t\t\t\t % size_t(__detail::bits_per_block));\n\tsize_t* __bitmapC = \n\t  reinterpret_cast<size_t*>\n\t  (_S_mem_blocks[__diff].first) - 1;\n\t__bitmapC -= (__displacement / size_t(__detail::bits_per_block));\n      \n\t__detail::__bit_free(__bitmapC, __rotate);\n\tsize_t* __puse_count = reinterpret_cast<size_t*>\n\t  (_S_mem_blocks[__diff].first)\n\t  - (__gnu_cxx::__detail::__num_bitmaps(_S_mem_blocks[__diff]) + 1);\n\t\n\t_GLIBCXX_DEBUG_ASSERT(*__puse_count != 0);\n\n\t--(*__puse_count);\n\n\tif (__builtin_expect(*__puse_count == 0, false))\n\t  {\n\t    _S_block_size /= 2;\n\t  \n\t    // We can safely remove this block.\n\t    // _Block_pair __bp = _S_mem_blocks[__diff];\n\t    this->_M_insert(__puse_count);\n\t    _S_mem_blocks.erase(_S_mem_blocks.begin() + __diff);\n\n\t    // Reset the _S_last_request variable to reflect the\n\t    // erased block. We do this to protect future requests\n\t    // after the last block has been removed from a particular\n\t    // memory Chunk, which in turn has been returned to the\n\t    // free list, and hence had been erased from the vector,\n\t    // so the size of the vector gets reduced by 1.\n\t    if ((_Difference_type)_S_last_request._M_where() >= __diff--)\n\t      _S_last_request._M_reset(__diff); \n\n\t    // If the Index into the vector of the region of memory\n\t    // that might hold the next address that will be passed to\n\t    // deallocated may have been invalidated due to the above\n\t    // erase procedure being called on the vector, hence we\n\t    // try to restore this invariant too.\n\t    if (_S_last_dealloc_index >= _S_mem_blocks.size())\n\t      {\n\t\t_S_last_dealloc_index =(__diff != -1 ? __diff : 0);\n\t\t_GLIBCXX_DEBUG_ASSERT(_S_last_dealloc_index >= 0);\n\t      }\n\t  }\n      }\n\n    public:\n      bitmap_allocator() throw()\n      { }\n\n      bitmap_allocator(const bitmap_allocator&)\n      { }\n\n      template<typename _Tp1>\n        bitmap_allocator(const bitmap_allocator<_Tp1>&) throw()\n        { }\n\n      ~bitmap_allocator() throw()\n      { }\n\n      pointer \n      allocate(size_type __n)\n      {\n\tif (__builtin_expect(__n > this->max_size(), false))\n\t  std::__throw_bad_alloc();\n\n\tif (__builtin_expect(__n == 1, true))\n\t  return this->_M_allocate_single_object();\n\telse\n\t  { \n\t    const size_type __b = __n * sizeof(value_type);\n\t    return reinterpret_cast<pointer>(::operator new(__b));\n\t  }\n      }\n\n      pointer \n      allocate(size_type __n, typename bitmap_allocator<void>::const_pointer)\n      { return allocate(__n); }\n\n      void \n      deallocate(pointer __p, size_type __n) throw()\n      {\n\tif (__builtin_expect(__p != 0, true))\n\t  {\n\t    if (__builtin_expect(__n == 1, true))\n\t      this->_M_deallocate_single_object(__p);\n\t    else\n\t      ::operator delete(__p);\n\t  }\n      }\n\n      pointer \n      address(reference __r) const\n      { return &__r; }\n\n      const_pointer \n      address(const_reference __r) const\n      { return &__r; }\n\n      size_type \n      max_size() const throw()\n      { return size_type(-1) / sizeof(value_type); }\n\n      void \n      construct(pointer __p, const_reference __data)\n      { ::new(__p) value_type(__data); }\n\n      void \n      destroy(pointer __p)\n      { __p->~value_type(); }\n    };\n\n  template<typename _Tp1, typename _Tp2>\n    bool \n    operator==(const bitmap_allocator<_Tp1>&, \n\t       const bitmap_allocator<_Tp2>&) throw()\n    { return true; }\n  \n  template<typename _Tp1, typename _Tp2>\n    bool \n    operator!=(const bitmap_allocator<_Tp1>&, \n\t       const bitmap_allocator<_Tp2>&) throw() \n  { return false; }\n\n  // Static member definitions.\n  template<typename _Tp>\n    typename bitmap_allocator<_Tp>::_BPVector\n    bitmap_allocator<_Tp>::_S_mem_blocks;\n\n  template<typename _Tp>\n    size_t bitmap_allocator<_Tp>::_S_block_size = \n    2 * size_t(__detail::bits_per_block);\n\n  template<typename _Tp>\n    typename __gnu_cxx::bitmap_allocator<_Tp>::_BPVector::size_type \n    bitmap_allocator<_Tp>::_S_last_dealloc_index = 0;\n\n  template<typename _Tp>\n    __gnu_cxx::__detail::_Bitmap_counter \n  <typename bitmap_allocator<_Tp>::_Alloc_block*>\n    bitmap_allocator<_Tp>::_S_last_request(_S_mem_blocks);\n\n#if defined __GTHREADS\n  template<typename _Tp>\n    typename bitmap_allocator<_Tp>::__mutex_type\n    bitmap_allocator<_Tp>::_S_mut;\n#endif\n\n_GLIBCXX_END_NAMESPACE\n\n#endif \n\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/codecvt_specializations.h",
    "content": "// Locale support (codecvt) -*- C++ -*-\n\n// Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006\n//  Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n//\n// ISO C++ 14882: 22.2.1.5 Template class codecvt\n//\n\n// Written by Benjamin Kosnik <bkoz@redhat.com>\n\n/** @file ext/codecvt_specializations.h\n *  This file is a GNU extension to the Standard C++ Library.\n */\n\n#ifndef _EXT_CODECVT_SPECIALIZATIONS_H\n#define _EXT_CODECVT_SPECIALIZATIONS_H 1\n\n#include <bits/c++config.h>\n\n#ifdef _GLIBCXX_USE_ICONV\n\n#include <locale>\n#include <iconv.h>\n\n  // XXX\n  // Define this here so codecvt.cc can have _S_max_size definition.\n#define _GLIBCXX_USE_ENCODING_STATE 1\n\n_GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)\n\n  /// @brief  Extension to use icov for dealing with character encodings.\n  // This includes conversions and comparisons between various character\n  // sets.  This object encapsulates data that may need to be shared between\n  // char_traits, codecvt and ctype.\n  class encoding_state\n  {\n  public:\n    // Types: \n    // NB: A conversion descriptor subsumes and enhances the\n    // functionality of a simple state type such as mbstate_t.\n    typedef iconv_t\tdescriptor_type;\n    \n  protected:\n    // Name of internal character set encoding.\n    std::string\t       \t_M_int_enc;\n\n    // Name of external character set encoding.\n    std::string  \t_M_ext_enc;\n\n    // Conversion descriptor between external encoding to internal encoding.\n    descriptor_type\t_M_in_desc;\n\n    // Conversion descriptor between internal encoding to external encoding.\n    descriptor_type\t_M_out_desc;\n\n    // The byte-order marker for the external encoding, if necessary.\n    int\t\t\t_M_ext_bom;\n\n    // The byte-order marker for the internal encoding, if necessary.\n    int\t\t\t_M_int_bom;\n\n    // Number of external bytes needed to construct one complete\n    // character in the internal encoding.\n    // NB: -1 indicates variable, or stateful, encodings.\n    int \t\t_M_bytes;\n\n  public:\n    explicit \n    encoding_state() \n    : _M_in_desc(0), _M_out_desc(0), _M_ext_bom(0), _M_int_bom(0), _M_bytes(0)\n    { }\n\n    explicit \n    encoding_state(const char* __int, const char* __ext, \n\t\t   int __ibom = 0, int __ebom = 0, int __bytes = 1)\n    : _M_int_enc(__int), _M_ext_enc(__ext), _M_in_desc(0), _M_out_desc(0), \n      _M_ext_bom(__ebom), _M_int_bom(__ibom), _M_bytes(__bytes)\n    { init(); }\n\n    // 21.1.2 traits typedefs\n    // p4\n    // typedef STATE_T state_type\n    // requires: state_type shall meet the requirements of\n    // CopyConstructible types (20.1.3)\n    // NB: This does not preseve the actual state of the conversion\n    // descriptor member, but it does duplicate the encoding\n    // information.\n    encoding_state(const encoding_state& __obj) : _M_in_desc(0), _M_out_desc(0)\n    { construct(__obj); }\n\n    // Need assignment operator as well.\n    encoding_state&\n    operator=(const encoding_state& __obj)\n    {\n      construct(__obj);\n      return *this;\n    }\n\n    ~encoding_state()\n    { destroy(); } \n\n    bool\n    good() const throw()\n    { \n      const descriptor_type __err = reinterpret_cast<iconv_t>(-1);\n      bool __test = _M_in_desc && _M_in_desc != __err; \n      __test &=  _M_out_desc && _M_out_desc != __err;\n      return __test;\n    }\n    \n    int\n    character_ratio() const\n    { return _M_bytes; }\n\n    const std::string\n    internal_encoding() const\n    { return _M_int_enc; }\n\n    int \n    internal_bom() const\n    { return _M_int_bom; }\n\n    const std::string\n    external_encoding() const\n    { return _M_ext_enc; }\n\n    int \n    external_bom() const\n    { return _M_ext_bom; }\n\n    const descriptor_type&\n    in_descriptor() const\n    { return _M_in_desc; }\n\n    const descriptor_type&\n    out_descriptor() const\n    { return _M_out_desc; }\n\n  protected:\n    void\n    init()\n    {\n      const descriptor_type __err = reinterpret_cast<iconv_t>(-1);\n      const bool __have_encodings = _M_int_enc.size() && _M_ext_enc.size();\n      if (!_M_in_desc && __have_encodings)\n\t{\n\t  _M_in_desc = iconv_open(_M_int_enc.c_str(), _M_ext_enc.c_str());\n\t  if (_M_in_desc == __err)\n\t    std::__throw_runtime_error(__N(\"encoding_state::_M_init \"\n\t\t\t\t    \"creating iconv input descriptor failed\"));\n\t}\n      if (!_M_out_desc && __have_encodings)\n\t{\n\t  _M_out_desc = iconv_open(_M_ext_enc.c_str(), _M_int_enc.c_str());\n\t  if (_M_out_desc == __err)\n\t    std::__throw_runtime_error(__N(\"encoding_state::_M_init \"\n\t\t\t\t  \"creating iconv output descriptor failed\"));\n\t}\n    }\n\n    void\n    construct(const encoding_state& __obj)\n    {\n      destroy();\n      _M_int_enc = __obj._M_int_enc;\n      _M_ext_enc = __obj._M_ext_enc;\n      _M_ext_bom = __obj._M_ext_bom;\n      _M_int_bom = __obj._M_int_bom;\n      _M_bytes = __obj._M_bytes;\n      init();\n    }\n\n    void\n    destroy() throw()\n    {\n      const descriptor_type __err = reinterpret_cast<iconv_t>(-1);\n      if (_M_in_desc && _M_in_desc != __err) \n\t{\n\t  iconv_close(_M_in_desc);\n\t  _M_in_desc = 0;\n\t}\n      if (_M_out_desc && _M_out_desc != __err) \n\t{\n\t  iconv_close(_M_out_desc);\n\t  _M_out_desc = 0;\n\t}\n    }\n  };\n\n  /// @brief  encoding_char_traits.\n  // Custom traits type with encoding_state for the state type, and the\n  // associated fpos<encoding_state> for the position type, all other\n  // bits equivalent to the required char_traits instantiations.\n  template<typename _CharT>\n    struct encoding_char_traits : public std::char_traits<_CharT>\n    {\n      typedef encoding_state\t\t\t\tstate_type;\n      typedef typename std::fpos<state_type>\t\tpos_type;\n    };\n\n_GLIBCXX_END_NAMESPACE\n\n\n_GLIBCXX_BEGIN_NAMESPACE(std)\n\n  using __gnu_cxx::encoding_state;\n\n  /// @brief  codecvt<InternT, _ExternT, encoding_state> specialization.\n  // This partial specialization takes advantage of iconv to provide\n  // code conversions between a large number of character encodings.\n  template<typename _InternT, typename _ExternT>\n    class codecvt<_InternT, _ExternT, encoding_state>\n    : public __codecvt_abstract_base<_InternT, _ExternT, encoding_state>\n    {\n    public:      \n      // Types:\n      typedef codecvt_base::result\t\t\tresult;\n      typedef _InternT \t\t\t\t\tintern_type;\n      typedef _ExternT \t\t\t\t\textern_type;\n      typedef __gnu_cxx::encoding_state \t\tstate_type;\n      typedef state_type::descriptor_type \t\tdescriptor_type;\n\n      // Data Members:\n      static locale::id \t\tid;\n\n      explicit \n      codecvt(size_t __refs = 0)\n      : __codecvt_abstract_base<intern_type, extern_type, state_type>(__refs)\n      { }\n\n      explicit \n      codecvt(state_type& __enc, size_t __refs = 0)\n      : __codecvt_abstract_base<intern_type, extern_type, state_type>(__refs)\n      { }\n\n     protected:\n      virtual \n      ~codecvt() { }\n\n      virtual result\n      do_out(state_type& __state, const intern_type* __from, \n\t     const intern_type* __from_end, const intern_type*& __from_next,\n\t     extern_type* __to, extern_type* __to_end,\n\t     extern_type*& __to_next) const;\n\n      virtual result\n      do_unshift(state_type& __state, extern_type* __to, \n\t\t extern_type* __to_end, extern_type*& __to_next) const;\n\n      virtual result\n      do_in(state_type& __state, const extern_type* __from, \n\t    const extern_type* __from_end, const extern_type*& __from_next,\n\t    intern_type* __to, intern_type* __to_end, \n\t    intern_type*& __to_next) const;\n\n      virtual int \n      do_encoding() const throw();\n\n      virtual bool \n      do_always_noconv() const throw();\n\n      virtual int \n      do_length(state_type&, const extern_type* __from, \n\t\tconst extern_type* __end, size_t __max) const;\n\n      virtual int \n      do_max_length() const throw();\n    };\n\n  template<typename _InternT, typename _ExternT>\n    locale::id \n    codecvt<_InternT, _ExternT, encoding_state>::id;\n\n  // This adaptor works around the signature problems of the second\n  // argument to iconv():  SUSv2 and others use 'const char**', but glibc 2.2\n  // uses 'char**', which matches the POSIX 1003.1-2001 standard.\n  // Using this adaptor, g++ will do the work for us.\n  template<typename _Tp>\n    inline size_t\n    __iconv_adaptor(size_t(*__func)(iconv_t, _Tp, size_t*, char**, size_t*),\n                    iconv_t __cd, char** __inbuf, size_t* __inbytes,\n                    char** __outbuf, size_t* __outbytes)\n    { return __func(__cd, (_Tp)__inbuf, __inbytes, __outbuf, __outbytes); }\n\n  template<typename _InternT, typename _ExternT>\n    codecvt_base::result\n    codecvt<_InternT, _ExternT, encoding_state>::\n    do_out(state_type& __state, const intern_type* __from, \n\t   const intern_type* __from_end, const intern_type*& __from_next,\n\t   extern_type* __to, extern_type* __to_end,\n\t   extern_type*& __to_next) const\n    {\n      result __ret = codecvt_base::error;\n      if (__state.good())\n\t{\n\t  const descriptor_type& __desc = __state.out_descriptor();\n\t  const size_t __fmultiple = sizeof(intern_type);\n\t  size_t __fbytes = __fmultiple * (__from_end - __from);\n\t  const size_t __tmultiple = sizeof(extern_type);\n\t  size_t __tbytes = __tmultiple * (__to_end - __to); \n\t  \n\t  // Argument list for iconv specifies a byte sequence. Thus,\n\t  // all to/from arrays must be brutally casted to char*.\n\t  char* __cto = reinterpret_cast<char*>(__to);\n\t  char* __cfrom;\n\t  size_t __conv;\n\n\t  // Some encodings need a byte order marker as the first item\n\t  // in the byte stream, to designate endian-ness. The default\n\t  // value for the byte order marker is NULL, so if this is\n\t  // the case, it's not necessary and we can just go on our\n\t  // merry way.\n\t  int __int_bom = __state.internal_bom();\n\t  if (__int_bom)\n\t    {\t  \n\t      size_t __size = __from_end - __from;\n\t      intern_type* __cfixed = static_cast<intern_type*>\n\t\t(__builtin_alloca(sizeof(intern_type) * (__size + 1)));\n\t      __cfixed[0] = static_cast<intern_type>(__int_bom);\n\t      char_traits<intern_type>::copy(__cfixed + 1, __from, __size);\n\t      __cfrom = reinterpret_cast<char*>(__cfixed);\n\t      __conv = __iconv_adaptor(iconv, __desc, &__cfrom,\n                                        &__fbytes, &__cto, &__tbytes); \n\t    }\n\t  else\n\t    {\n\t      intern_type* __cfixed = const_cast<intern_type*>(__from);\n\t      __cfrom = reinterpret_cast<char*>(__cfixed);\n\t      __conv = __iconv_adaptor(iconv, __desc, &__cfrom, &__fbytes, \n\t\t\t\t       &__cto, &__tbytes); \n\t    }\n\n\t  if (__conv != size_t(-1))\n\t    {\n\t      __from_next = reinterpret_cast<const intern_type*>(__cfrom);\n\t      __to_next = reinterpret_cast<extern_type*>(__cto);\n\t      __ret = codecvt_base::ok;\n\t    }\n\t  else \n\t    {\n\t      if (__fbytes < __fmultiple * (__from_end - __from))\n\t\t{\n\t\t  __from_next = reinterpret_cast<const intern_type*>(__cfrom);\n\t\t  __to_next = reinterpret_cast<extern_type*>(__cto);\n\t\t  __ret = codecvt_base::partial;\n\t\t}\n\t      else\n\t\t__ret = codecvt_base::error;\n\t    }\n\t}\n      return __ret; \n    }\n\n  template<typename _InternT, typename _ExternT>\n    codecvt_base::result\n    codecvt<_InternT, _ExternT, encoding_state>::\n    do_unshift(state_type& __state, extern_type* __to, \n\t       extern_type* __to_end, extern_type*& __to_next) const\n    {\n      result __ret = codecvt_base::error;\n      if (__state.good())\n\t{\n\t  const descriptor_type& __desc = __state.in_descriptor();\n\t  const size_t __tmultiple = sizeof(intern_type);\n\t  size_t __tlen = __tmultiple * (__to_end - __to); \n\t  \n\t  // Argument list for iconv specifies a byte sequence. Thus,\n\t  // all to/from arrays must be brutally casted to char*.\n\t  char* __cto = reinterpret_cast<char*>(__to);\n\t  size_t __conv = __iconv_adaptor(iconv,__desc, NULL, NULL,\n                                          &__cto, &__tlen); \n\t  \n\t  if (__conv != size_t(-1))\n\t    {\n\t      __to_next = reinterpret_cast<extern_type*>(__cto);\n\t      if (__tlen == __tmultiple * (__to_end - __to))\n\t\t__ret = codecvt_base::noconv;\n\t      else if (__tlen == 0)\n\t\t__ret = codecvt_base::ok;\n\t      else\n\t\t__ret = codecvt_base::partial;\n\t    }\n\t  else \n\t    __ret = codecvt_base::error;\n\t}\n      return __ret; \n    }\n   \n  template<typename _InternT, typename _ExternT>\n    codecvt_base::result\n    codecvt<_InternT, _ExternT, encoding_state>::\n    do_in(state_type& __state, const extern_type* __from, \n\t  const extern_type* __from_end, const extern_type*& __from_next,\n\t  intern_type* __to, intern_type* __to_end, \n\t  intern_type*& __to_next) const\n    { \n      result __ret = codecvt_base::error;\n      if (__state.good())\n\t{\n\t  const descriptor_type& __desc = __state.in_descriptor();\n\t  const size_t __fmultiple = sizeof(extern_type);\n\t  size_t __flen = __fmultiple * (__from_end - __from);\n\t  const size_t __tmultiple = sizeof(intern_type);\n\t  size_t __tlen = __tmultiple * (__to_end - __to); \n\t  \n\t  // Argument list for iconv specifies a byte sequence. Thus,\n\t  // all to/from arrays must be brutally casted to char*.\n\t  char* __cto = reinterpret_cast<char*>(__to);\n\t  char* __cfrom;\n\t  size_t __conv;\n\n\t  // Some encodings need a byte order marker as the first item\n\t  // in the byte stream, to designate endian-ness. The default\n\t  // value for the byte order marker is NULL, so if this is\n\t  // the case, it's not necessary and we can just go on our\n\t  // merry way.\n\t  int __ext_bom = __state.external_bom();\n\t  if (__ext_bom)\n\t    {\t  \n\t      size_t __size = __from_end - __from;\n\t      extern_type* __cfixed =  static_cast<extern_type*>\n\t\t(__builtin_alloca(sizeof(extern_type) * (__size + 1)));\n\t      __cfixed[0] = static_cast<extern_type>(__ext_bom);\n\t      char_traits<extern_type>::copy(__cfixed + 1, __from, __size);\n\t      __cfrom = reinterpret_cast<char*>(__cfixed);\n\t      __conv = __iconv_adaptor(iconv, __desc, &__cfrom,\n                                       &__flen, &__cto, &__tlen); \n\t    }\n\t  else\n\t    {\n\t      extern_type* __cfixed = const_cast<extern_type*>(__from);\n\t      __cfrom = reinterpret_cast<char*>(__cfixed);\n\t      __conv = __iconv_adaptor(iconv, __desc, &__cfrom,\n                                       &__flen, &__cto, &__tlen); \n\t    }\n\n\t  \n\t  if (__conv != size_t(-1))\n\t    {\n\t      __from_next = reinterpret_cast<const extern_type*>(__cfrom);\n\t      __to_next = reinterpret_cast<intern_type*>(__cto);\n\t      __ret = codecvt_base::ok;\n\t    }\n\t  else \n\t    {\n\t      if (__flen < static_cast<size_t>(__from_end - __from))\n\t\t{\n\t\t  __from_next = reinterpret_cast<const extern_type*>(__cfrom);\n\t\t  __to_next = reinterpret_cast<intern_type*>(__cto);\n\t\t  __ret = codecvt_base::partial;\n\t\t}\n\t      else\n\t\t__ret = codecvt_base::error;\n\t    }\n\t}\n      return __ret; \n    }\n  \n  template<typename _InternT, typename _ExternT>\n    int \n    codecvt<_InternT, _ExternT, encoding_state>::\n    do_encoding() const throw()\n    {\n      int __ret = 0;\n      if (sizeof(_ExternT) <= sizeof(_InternT))\n\t__ret = sizeof(_InternT) / sizeof(_ExternT);\n      return __ret; \n    }\n  \n  template<typename _InternT, typename _ExternT>\n    bool \n    codecvt<_InternT, _ExternT, encoding_state>::\n    do_always_noconv() const throw()\n    { return false; }\n  \n  template<typename _InternT, typename _ExternT>\n    int \n    codecvt<_InternT, _ExternT, encoding_state>::\n    do_length(state_type&, const extern_type* __from, \n\t      const extern_type* __end, size_t __max) const\n    { return std::min(__max, static_cast<size_t>(__end - __from)); }\n\n  // _GLIBCXX_RESOLVE_LIB_DEFECTS\n  // 74.  Garbled text for codecvt::do_max_length\n  template<typename _InternT, typename _ExternT>\n    int \n    codecvt<_InternT, _ExternT, encoding_state>::\n    do_max_length() const throw()\n    { return 1; }\n\n_GLIBCXX_END_NAMESPACE\n\n#endif\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/concurrence.h",
    "content": "// Support for concurrent programing -*- C++ -*-\n\n// Copyright (C) 2003, 2004, 2005, 2006\n// Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n/** @file concurrence.h\n *  This is an internal header file, included by other library headers.\n *  You should not attempt to use it directly.\n */\n\n#ifndef _CONCURRENCE_H\n#define _CONCURRENCE_H 1\n\n#include <cstdlib>\n#include <exception>\n#include <bits/gthr.h> \n#include <bits/functexcept.h>\n\n_GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)\n\n  // Available locking policies:\n  // _S_single    single-threaded code that doesn't need to be locked.\n  // _S_mutex     multi-threaded code that requires additional support\n  //              from gthr.h or abstraction layers in concurrance.h.\n  // _S_atomic    multi-threaded code using atomic operations.\n  enum _Lock_policy { _S_single, _S_mutex, _S_atomic }; \n\n  // Compile time constant that indicates prefered locking policy in\n  // the current configuration.\n  static const _Lock_policy __default_lock_policy = \n#ifdef __GTHREADS\n  // NB: This macro doesn't actually exist yet in the compiler, but is\n  // set somewhat haphazardly at configure time.\n#ifdef _GLIBCXX_ATOMIC_BUILTINS\n  _S_atomic;\n#else\n  _S_mutex;\n#endif\n#else\n  _S_single;\n#endif\n  \n  // NB: As this is used in libsupc++, need to only depend on\n  // exception. No stdexception classes, no use of std::string.\n  class __concurrence_lock_error : public std::exception\n  {\n  public:\n    virtual char const*\n    what() const throw()\n    { return \"__gnu_cxx::__concurrence_lock_error\"; }\n  };\n\n  class __concurrence_unlock_error : public std::exception\n  {\n  public:\n    virtual char const*\n    what() const throw()\n    { return \"__gnu_cxx::__concurrence_unlock_error\"; }\n  };\n\n  // Substitute for concurrence_error object in the case of -fno-exceptions.\n  inline void\n  __throw_concurrence_lock_error()\n  {\n#if __EXCEPTIONS\n    throw __concurrence_lock_error();\n#else\n    std::abort();\n#endif\n  }\n\n  inline void\n  __throw_concurrence_unlock_error()\n  {\n#if __EXCEPTIONS\n    throw __concurrence_unlock_error();\n#else\n    std::abort();\n#endif\n  }\n\n  class __mutex \n  {\n  private:\n    __gthread_mutex_t _M_mutex;\n\n    __mutex(const __mutex&);\n    __mutex& operator=(const __mutex&);\n\n  public:\n    __mutex() \n    { \n#if __GTHREADS\n      if (__gthread_active_p())\n\t{\n#if defined __GTHREAD_MUTEX_INIT\n\t  __gthread_mutex_t __tmp = __GTHREAD_MUTEX_INIT;\n\t  _M_mutex = __tmp;\n#else\n\t  __GTHREAD_MUTEX_INIT_FUNCTION(&_M_mutex); \n#endif\n\t}\n#endif \n    }\n\n    void lock()\n    {\n#if __GTHREADS\n      if (__gthread_active_p())\n\t{\n\t  if (__gthread_mutex_lock(&_M_mutex) != 0)\n\t    __throw_concurrence_lock_error();\n\t}\n#endif\n    }\n    \n    void unlock()\n    {\n#if __GTHREADS\n      if (__gthread_active_p())\n\t{\n\t  if (__gthread_mutex_unlock(&_M_mutex) != 0)\n\t    __throw_concurrence_unlock_error();\n\t}\n#endif\n    }\n  };\n\n  class __recursive_mutex \n  {\n  private:\n    __gthread_recursive_mutex_t _M_mutex;\n\n    __recursive_mutex(const __recursive_mutex&);\n    __recursive_mutex& operator=(const __recursive_mutex&);\n\n  public:\n    __recursive_mutex() \n    { \n#if __GTHREADS\n      if (__gthread_active_p())\n\t{\n#if defined __GTHREAD_RECURSIVE_MUTEX_INIT\n\t  __gthread_recursive_mutex_t __tmp = __GTHREAD_RECURSIVE_MUTEX_INIT;\n\t  _M_mutex = __tmp;\n#else\n\t  __GTHREAD_RECURSIVE_MUTEX_INIT_FUNCTION(&_M_mutex); \n#endif\n\t}\n#endif \n    }\n\n    void lock()\n    { \n#if __GTHREADS\n      if (__gthread_active_p())\n\t{\n\t  if (__gthread_recursive_mutex_lock(&_M_mutex) != 0)\n\t    __throw_concurrence_lock_error();\n\t}\n#endif\n    }\n    \n    void unlock()\n    { \n#if __GTHREADS\n      if (__gthread_active_p())\n\t{\n\t  if (__gthread_recursive_mutex_unlock(&_M_mutex) != 0)\n\t    __throw_concurrence_unlock_error();\n\t}\n#endif\n    }\n  };\n\n  /// @brief  Scoped lock idiom.\n  // Acquire the mutex here with a constructor call, then release with\n  // the destructor call in accordance with RAII style.\n  class __scoped_lock\n  {\n  public:\n    typedef __mutex __mutex_type;\n\n  private:\n    __mutex_type& _M_device;\n\n    __scoped_lock(const __scoped_lock&);\n    __scoped_lock& operator=(const __scoped_lock&);\n\n  public:\n    explicit __scoped_lock(__mutex_type& __name) : _M_device(__name)\n    { _M_device.lock(); }\n\n    ~__scoped_lock() throw()\n    { _M_device.unlock(); }\n  };\n\n_GLIBCXX_END_NAMESPACE\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/debug_allocator.h",
    "content": "// Allocators -*- C++ -*-\n\n// Copyright (C) 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n/*\n * Copyright (c) 1996-1997\n * Silicon Graphics Computer Systems, Inc.\n *\n * Permission to use, copy, modify, distribute and sell this software\n * and its documentation for any purpose is hereby granted without fee,\n * provided that the above copyright notice appear in all copies and\n * that both that copyright notice and this permission notice appear\n * in supporting documentation.  Silicon Graphics makes no\n * representations about the suitability of this software for any\n * purpose.  It is provided \"as is\" without express or implied warranty.\n */\n\n/** @file ext/debug_allocator.h\n *  This file is a GNU extension to the Standard C++ Library.\n *  You should only include this header if you are using GCC 3 or later.\n */\n\n#ifndef _DEBUG_ALLOCATOR_H\n#define _DEBUG_ALLOCATOR_H 1\n\n#include <stdexcept>\n\n_GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)\n\n  using std::size_t;\n\n  /**\n   *  @brief  A meta-allocator with debugging bits, as per [20.4].\n   *\n   *  This is precisely the allocator defined in the C++ Standard. \n   *    - all allocation calls operator new\n   *    - all deallocation calls operator delete\n   */\n  template<typename _Alloc>\n    class debug_allocator\n    {\n    public:\n      typedef typename _Alloc::size_type       \tsize_type;\n      typedef typename _Alloc::difference_type\tdifference_type;\n      typedef typename _Alloc::pointer       \tpointer;\n      typedef typename _Alloc::const_pointer    const_pointer;\n      typedef typename _Alloc::reference       \treference;\n      typedef typename _Alloc::const_reference  const_reference;\n      typedef typename _Alloc::value_type       value_type;\n\n    private:\n      // _M_extra is the number of objects that correspond to the\n      // extra space where debug information is stored.\n      size_type \t\t_M_extra;\n      \n      _Alloc\t\t\t_M_allocator;\n\n    public:\n      debug_allocator()\n      {\n\tconst size_t __obj_size = sizeof(value_type);\n\t_M_extra = (sizeof(size_type) + __obj_size - 1) / __obj_size; \n      }\n      \n      pointer\n      allocate(size_type __n)\n      {\n        pointer __res = _M_allocator.allocate(__n + _M_extra);      \n\tsize_type* __ps = reinterpret_cast<size_type*>(__res);\n\t*__ps = __n;\n        return __res + _M_extra;\n      }\n\n      pointer\n      allocate(size_type __n, const void* __hint)\n      {\n        pointer __res = _M_allocator.allocate(__n + _M_extra, __hint);\n\tsize_type* __ps = reinterpret_cast<size_type*>(__res);\n\t*__ps = __n;\n        return __res + _M_extra;\n      }\n\n      void\n      deallocate(pointer __p, size_type __n)\n      {\n\tif (__p)\n\t  {\n\t    pointer __real_p = __p - _M_extra;\n\t    if (*reinterpret_cast<size_type*>(__real_p) != __n)\n\t      {\n\t\tthrow std::runtime_error(\"debug_allocator::deallocate\"\n\t\t\t\t\t \" wrong size\");\n\t      }\n\t    _M_allocator.deallocate(__real_p, __n + _M_extra);\n\t  }\n\telse\n\t  throw std::runtime_error(\"debug_allocator::deallocate null pointer\");\n      }\n    };\n\n_GLIBCXX_END_NAMESPACE\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/functional",
    "content": "// Functional extensions -*- C++ -*-\n\n// Copyright (C) 2002, 2004, 2005 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n/*\n *\n * Copyright (c) 1994\n * Hewlett-Packard Company\n *\n * Permission to use, copy, modify, distribute and sell this software\n * and its documentation for any purpose is hereby granted without fee,\n * provided that the above copyright notice appear in all copies and\n * that both that copyright notice and this permission notice appear\n * in supporting documentation.  Hewlett-Packard Company makes no\n * representations about the suitability of this software for any\n * purpose.  It is provided \"as is\" without express or implied warranty.\n *\n *\n * Copyright (c) 1996\n * Silicon Graphics Computer Systems, Inc.\n *\n * Permission to use, copy, modify, distribute and sell this software\n * and its documentation for any purpose is hereby granted without fee,\n * provided that the above copyright notice appear in all copies and\n * that both that copyright notice and this permission notice appear\n * in supporting documentation.  Silicon Graphics makes no\n * representations about the suitability of this software for any\n * purpose.  It is provided \"as is\" without express or implied warranty.\n */\n\n/** @file ext/functional\n *  This file is a GNU extension to the Standard C++ Library (possibly\n *  containing extensions from the HP/SGI STL subset).\n */\n\n#ifndef _EXT_FUNCTIONAL\n#define _EXT_FUNCTIONAL 1\n\n#pragma GCC system_header\n\n#include <functional>\n\n_GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)\n\n  using std::size_t;\n  using std::unary_function;\n  using std::binary_function;\n  using std::mem_fun1_t;\n  using std::const_mem_fun1_t;\n  using std::mem_fun1_ref_t;\n  using std::const_mem_fun1_ref_t;\n\n  /** The @c identity_element functions are not part of the C++\n   *  standard; SGI provided them as an extension.  Its argument is an\n   *  operation, and its return value is the identity element for that\n   *  operation.  It is overloaded for addition and multiplication,\n   *  and you can overload it for your own nefarious operations.\n   *\n   *  @addtogroup SGIextensions\n   *  @{\n   */\n  /// An \\link SGIextensions SGI extension \\endlink.\n  template <class _Tp>\n    inline _Tp\n    identity_element(std::plus<_Tp>)\n    { return _Tp(0); }\n\n  /// An \\link SGIextensions SGI extension \\endlink.\n  template <class _Tp>\n    inline _Tp\n    identity_element(std::multiplies<_Tp>)\n    { return _Tp(1); }\n  /** @}  */\n  \n  /** As an extension to the binders, SGI provided composition functors and\n   *  wrapper functions to aid in their creation.  The @c unary_compose\n   *  functor is constructed from two functions/functors, @c f and @c g.\n   *  Calling @c operator() with a single argument @c x returns @c f(g(x)).\n   *  The function @c compose1 takes the two functions and constructs a\n   *  @c unary_compose variable for you.\n   *\n   *  @c binary_compose is constructed from three functors, @c f, @c g1,\n   *  and @c g2.  Its @c operator() returns @c f(g1(x),g2(x)).  The function\n   *  @compose2 takes f, g1, and g2, and constructs the @c binary_compose\n   *  instance for you.  For example, if @c f returns an int, then\n   *  \\code\n   *  int answer = (compose2(f,g1,g2))(x);\n   *  \\endcode\n   *  is equivalent to\n   *  \\code\n   *  int temp1 = g1(x);\n   *  int temp2 = g2(x);\n   *  int answer = f(temp1,temp2);\n   *  \\endcode\n   *  But the first form is more compact, and can be passed around as a\n   *  functor to other algorithms.\n   *\n   *  @addtogroup SGIextensions\n   *  @{\n   */\n  /// An \\link SGIextensions SGI extension \\endlink.\n  template <class _Operation1, class _Operation2>\n    class unary_compose\n    : public unary_function<typename _Operation2::argument_type,\n\t\t\t    typename _Operation1::result_type>\n    {\n    protected:\n      _Operation1 _M_fn1;\n      _Operation2 _M_fn2;\n\n    public:\n      unary_compose(const _Operation1& __x, const _Operation2& __y)\n      : _M_fn1(__x), _M_fn2(__y) {}\n\n      typename _Operation1::result_type\n      operator()(const typename _Operation2::argument_type& __x) const\n      { return _M_fn1(_M_fn2(__x)); }\n    };\n\n  /// An \\link SGIextensions SGI extension \\endlink.\n  template <class _Operation1, class _Operation2>\n    inline unary_compose<_Operation1, _Operation2>\n    compose1(const _Operation1& __fn1, const _Operation2& __fn2)\n    { return unary_compose<_Operation1,_Operation2>(__fn1, __fn2); }\n\n  /// An \\link SGIextensions SGI extension \\endlink.\n  template <class _Operation1, class _Operation2, class _Operation3>\n    class binary_compose\n    : public unary_function<typename _Operation2::argument_type,\n\t\t\t    typename _Operation1::result_type>\n    {\n    protected:\n      _Operation1 _M_fn1;\n      _Operation2 _M_fn2;\n      _Operation3 _M_fn3;\n      \n    public:\n      binary_compose(const _Operation1& __x, const _Operation2& __y,\n\t\t     const _Operation3& __z)\n      : _M_fn1(__x), _M_fn2(__y), _M_fn3(__z) { }\n\n      typename _Operation1::result_type\n      operator()(const typename _Operation2::argument_type& __x) const\n      { return _M_fn1(_M_fn2(__x), _M_fn3(__x)); }\n    };\n\n  /// An \\link SGIextensions SGI extension \\endlink.\n  template <class _Operation1, class _Operation2, class _Operation3>\n    inline binary_compose<_Operation1, _Operation2, _Operation3>\n    compose2(const _Operation1& __fn1, const _Operation2& __fn2,\n\t     const _Operation3& __fn3)\n    { return binary_compose<_Operation1, _Operation2, _Operation3>\n\t(__fn1, __fn2, __fn3); }\n  /** @}  */\n\n  /** As an extension, SGI provided a functor called @c identity.  When a\n   *  functor is required but no operations are desired, this can be used as a\n   *  pass-through.  Its @c operator() returns its argument unchanged.\n   *\n   *  @addtogroup SGIextensions\n   */\n  template <class _Tp>\n    struct identity : public std::_Identity<_Tp> {};\n\n  /** @c select1st and @c select2nd are extensions provided by SGI.  Their\n   *  @c operator()s\n   *  take a @c std::pair as an argument, and return either the first member\n   *  or the second member, respectively.  They can be used (especially with\n   *  the composition functors) to \"strip\" data from a sequence before\n   *  performing the remainder of an algorithm.\n   *\n   *  @addtogroup SGIextensions\n   *  @{\n   */\n  /// An \\link SGIextensions SGI extension \\endlink.\n  template <class _Pair>\n    struct select1st : public std::_Select1st<_Pair> {};\n\n  /// An \\link SGIextensions SGI extension \\endlink.\n  template <class _Pair>\n    struct select2nd : public std::_Select2nd<_Pair> {};\n  /** @}  */\n\n  // extension documented next\n  template <class _Arg1, class _Arg2>\n    struct _Project1st : public binary_function<_Arg1, _Arg2, _Arg1>\n    {\n      _Arg1\n      operator()(const _Arg1& __x, const _Arg2&) const\n      { return __x; }\n    };\n\n  template <class _Arg1, class _Arg2>\n    struct _Project2nd : public binary_function<_Arg1, _Arg2, _Arg2>\n    {\n      _Arg2\n      operator()(const _Arg1&, const _Arg2& __y) const\n      { return __y; }\n    };\n\n  /** The @c operator() of the @c project1st functor takes two arbitrary\n   *  arguments and returns the first one, while @c project2nd returns the\n   *  second one.  They are extensions provided by SGI.\n   *\n   *  @addtogroup SGIextensions\n   *  @{\n   */\n\n  /// An \\link SGIextensions SGI extension \\endlink.\n  template <class _Arg1, class _Arg2>\n    struct project1st : public _Project1st<_Arg1, _Arg2> {};\n\n  /// An \\link SGIextensions SGI extension \\endlink.\n  template <class _Arg1, class _Arg2>\n    struct project2nd : public _Project2nd<_Arg1, _Arg2> {};\n  /** @}  */\n\n  // extension documented next\n  template <class _Result>\n    struct _Constant_void_fun\n    {\n      typedef _Result result_type;\n      result_type _M_val;\n\n      _Constant_void_fun(const result_type& __v) : _M_val(__v) {}\n\n      const result_type&\n      operator()() const\n      { return _M_val; }\n    };\n\n  template <class _Result, class _Argument>\n    struct _Constant_unary_fun\n    {\n      typedef _Argument argument_type;\n      typedef  _Result  result_type;\n      result_type _M_val;\n      \n      _Constant_unary_fun(const result_type& __v) : _M_val(__v) {}\n\n      const result_type&\n      operator()(const _Argument&) const\n      { return _M_val; }\n    };\n\n  template <class _Result, class _Arg1, class _Arg2>\n    struct _Constant_binary_fun\n    {\n      typedef  _Arg1   first_argument_type;\n      typedef  _Arg2   second_argument_type;\n      typedef  _Result result_type;\n      _Result _M_val;\n\n      _Constant_binary_fun(const _Result& __v) : _M_val(__v) {}\n      \n      const result_type&\n      operator()(const _Arg1&, const _Arg2&) const\n      { return _M_val; }\n    };\n\n  /** These three functors are each constructed from a single arbitrary\n   *  variable/value.  Later, their @c operator()s completely ignore any\n   *  arguments passed, and return the stored value.\n   *  - @c constant_void_fun's @c operator() takes no arguments\n   *  - @c constant_unary_fun's @c operator() takes one argument (ignored)\n   *  - @c constant_binary_fun's @c operator() takes two arguments (ignored)\n   *\n   *  The helper creator functions @c constant0, @c constant1, and\n   *  @c constant2 each take a \"result\" argument and construct variables of\n   *  the appropriate functor type.\n   *\n   *  @addtogroup SGIextensions\n   *  @{\n   */\n  /// An \\link SGIextensions SGI extension \\endlink.\n  template <class _Result>\n    struct constant_void_fun\n    : public _Constant_void_fun<_Result>\n    {\n      constant_void_fun(const _Result& __v)\n      : _Constant_void_fun<_Result>(__v) {}\n    };\n\n  /// An \\link SGIextensions SGI extension \\endlink.\n  template <class _Result, class _Argument = _Result>\n    struct constant_unary_fun : public _Constant_unary_fun<_Result, _Argument>\n    {\n      constant_unary_fun(const _Result& __v)\n      : _Constant_unary_fun<_Result, _Argument>(__v) {}\n    };\n\n  /// An \\link SGIextensions SGI extension \\endlink.\n  template <class _Result, class _Arg1 = _Result, class _Arg2 = _Arg1>\n    struct constant_binary_fun\n    : public _Constant_binary_fun<_Result, _Arg1, _Arg2>\n    {\n      constant_binary_fun(const _Result& __v)\n      : _Constant_binary_fun<_Result, _Arg1, _Arg2>(__v) {}\n    };\n\n  /// An \\link SGIextensions SGI extension \\endlink.\n  template <class _Result>\n    inline constant_void_fun<_Result>\n    constant0(const _Result& __val)\n    { return constant_void_fun<_Result>(__val); }\n\n  /// An \\link SGIextensions SGI extension \\endlink.\n  template <class _Result>\n    inline constant_unary_fun<_Result, _Result>\n    constant1(const _Result& __val)\n    { return constant_unary_fun<_Result, _Result>(__val); }\n\n  /// An \\link SGIextensions SGI extension \\endlink.\n  template <class _Result>\n    inline constant_binary_fun<_Result,_Result,_Result>\n    constant2(const _Result& __val)\n    { return constant_binary_fun<_Result, _Result, _Result>(__val); }\n  /** @}  */\n\n  /** The @c subtractive_rng class is documented on\n   *  <a href=\"http://www.sgi.com/tech/stl/\">SGI's site</a>.\n   *  Note that this code assumes that @c int is 32 bits.\n   *\n   *  @ingroup SGIextensions\n   */\n  class subtractive_rng\n  : public unary_function<unsigned int, unsigned int>\n  {\n  private:\n    unsigned int _M_table[55];\n    size_t _M_index1;\n    size_t _M_index2;\n\n  public:\n    /// Returns a number less than the argument.\n    unsigned int\n    operator()(unsigned int __limit)\n    {\n      _M_index1 = (_M_index1 + 1) % 55;\n      _M_index2 = (_M_index2 + 1) % 55;\n      _M_table[_M_index1] = _M_table[_M_index1] - _M_table[_M_index2];\n      return _M_table[_M_index1] % __limit;\n    }\n\n    void\n    _M_initialize(unsigned int __seed)\n    {\n      unsigned int __k = 1;\n      _M_table[54] = __seed;\n      size_t __i;\n      for (__i = 0; __i < 54; __i++)\n\t{\n\t  size_t __ii = (21 * (__i + 1) % 55) - 1;\n\t  _M_table[__ii] = __k;\n\t  __k = __seed - __k;\n\t  __seed = _M_table[__ii];\n\t}\n      for (int __loop = 0; __loop < 4; __loop++)\n\t{\n\t  for (__i = 0; __i < 55; __i++)\n            _M_table[__i] = _M_table[__i] - _M_table[(1 + __i + 30) % 55];\n\t}\n      _M_index1 = 0;\n      _M_index2 = 31;\n    }\n\n    /// Ctor allowing you to initialize the seed.\n    subtractive_rng(unsigned int __seed)\n    { _M_initialize(__seed); }\n\n    /// Default ctor; initializes its state with some number you don't see.\n    subtractive_rng()\n    { _M_initialize(161803398u); }\n  };\n\n  // Mem_fun adaptor helper functions mem_fun1 and mem_fun1_ref,\n  // provided for backward compatibility, they are no longer part of\n  // the C++ standard.\n  \n  template <class _Ret, class _Tp, class _Arg>\n    inline mem_fun1_t<_Ret, _Tp, _Arg>\n    mem_fun1(_Ret (_Tp::*__f)(_Arg))\n    { return mem_fun1_t<_Ret, _Tp, _Arg>(__f); }\n\n  template <class _Ret, class _Tp, class _Arg>\n    inline const_mem_fun1_t<_Ret, _Tp, _Arg>\n    mem_fun1(_Ret (_Tp::*__f)(_Arg) const)\n    { return const_mem_fun1_t<_Ret, _Tp, _Arg>(__f); }\n\n  template <class _Ret, class _Tp, class _Arg>\n    inline mem_fun1_ref_t<_Ret, _Tp, _Arg>\n    mem_fun1_ref(_Ret (_Tp::*__f)(_Arg))\n    { return mem_fun1_ref_t<_Ret, _Tp, _Arg>(__f); }\n\n  template <class _Ret, class _Tp, class _Arg>\n    inline const_mem_fun1_ref_t<_Ret, _Tp, _Arg>\n    mem_fun1_ref(_Ret (_Tp::*__f)(_Arg) const)\n    { return const_mem_fun1_ref_t<_Ret, _Tp, _Arg>(__f); }\n\n_GLIBCXX_END_NAMESPACE\n\n#endif\n\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/hash_fun.h",
    "content": "// 'struct hash' from SGI -*- C++ -*-\n\n// Copyright (C) 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n/*\n * Copyright (c) 1996-1998\n * Silicon Graphics Computer Systems, Inc.\n *\n * Permission to use, copy, modify, distribute and sell this software\n * and its documentation for any purpose is hereby granted without fee,\n * provided that the above copyright notice appear in all copies and\n * that both that copyright notice and this permission notice appear\n * in supporting documentation.  Silicon Graphics makes no\n * representations about the suitability of this software for any\n * purpose.  It is provided \"as is\" without express or implied warranty.\n *\n *\n * Copyright (c) 1994\n * Hewlett-Packard Company\n *\n * Permission to use, copy, modify, distribute and sell this software\n * and its documentation for any purpose is hereby granted without fee,\n * provided that the above copyright notice appear in all copies and\n * that both that copyright notice and this permission notice appear\n * in supporting documentation.  Hewlett-Packard Company makes no\n * representations about the suitability of this software for any\n * purpose.  It is provided \"as is\" without express or implied warranty.\n *\n */\n\n/** @file ext/hash_fun.h\n *  This file is a GNU extension to the Standard C++ Library (possibly\n *  containing extensions from the HP/SGI STL subset).\n */\n\n#ifndef _HASH_FUN_H\n#define _HASH_FUN_H 1\n\n#include <cstddef>\n\n_GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)\n\n  using std::size_t;\n\n  template<class _Key>\n    struct hash { };\n\n  inline size_t\n  __stl_hash_string(const char* __s)\n  {\n    unsigned long __h = 0;\n    for ( ; *__s; ++__s)\n      __h = 5 * __h + *__s;\n    return size_t(__h);\n  }\n\n  template<>\n    struct hash<char*>\n    {\n      size_t\n      operator()(const char* __s) const\n      { return __stl_hash_string(__s); }\n    };\n\n  template<>\n    struct hash<const char*>\n    {\n      size_t\n      operator()(const char* __s) const\n      { return __stl_hash_string(__s); }\n    };\n\n  template<>\n    struct hash<char>\n    { \n      size_t\n      operator()(char __x) const\n      { return __x; }\n    };\n\n  template<>\n    struct hash<unsigned char>\n    { \n      size_t\n      operator()(unsigned char __x) const\n      { return __x; }\n    };\n\n  template<>\n    struct hash<signed char>\n    {\n      size_t\n      operator()(unsigned char __x) const\n      { return __x; }\n    };\n\n  template<>\n    struct hash<short>\n    {\n      size_t\n      operator()(short __x) const\n      { return __x; }\n    };\n\n  template<>\n    struct hash<unsigned short>\n    {\n      size_t\n      operator()(unsigned short __x) const\n      { return __x; }\n    };\n\n  template<>\n    struct hash<int>\n    { \n      size_t \n      operator()(int __x) const \n      { return __x; }\n    };\n\n  template<>\n    struct hash<unsigned int>\n    { \n      size_t\n      operator()(unsigned int __x) const\n      { return __x; }\n    };\n\n  template<>\n    struct hash<long>\n    {\n      size_t\n      operator()(long __x) const\n      { return __x; }\n    };\n\n  template<>\n    struct hash<unsigned long>\n    {\n      size_t\n      operator()(unsigned long __x) const\n      { return __x; }\n    };\n\n_GLIBCXX_END_NAMESPACE\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/hash_map",
    "content": "// Hashing map implementation -*- C++ -*-\n\n// Copyright (C) 2001, 2002, 2004, 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n/*\n * Copyright (c) 1996\n * Silicon Graphics Computer Systems, Inc.\n *\n * Permission to use, copy, modify, distribute and sell this software\n * and its documentation for any purpose is hereby granted without fee,\n * provided that the above copyright notice appear in all copies and\n * that both that copyright notice and this permission notice appear\n * in supporting documentation.  Silicon Graphics makes no\n * representations about the suitability of this software for any\n * purpose.  It is provided \"as is\" without express or implied warranty.\n *\n *\n * Copyright (c) 1994\n * Hewlett-Packard Company\n *\n * Permission to use, copy, modify, distribute and sell this software\n * and its documentation for any purpose is hereby granted without fee,\n * provided that the above copyright notice appear in all copies and\n * that both that copyright notice and this permission notice appear\n * in supporting documentation.  Hewlett-Packard Company makes no\n * representations about the suitability of this software for any\n * purpose.  It is provided \"as is\" without express or implied warranty.\n *\n */\n\n/** @file ext/hash_map\n *  This file is a GNU extension to the Standard C++ Library (possibly\n *  containing extensions from the HP/SGI STL subset).\n */\n\n#ifndef _HASH_MAP\n#define _HASH_MAP 1\n\n#include <bits/c++config.h>\n#include <ext/hashtable.h>\n#include <bits/concept_check.h>\n\n_GLIBCXX_BEGIN_NESTED_NAMESPACE(__gnu_cxx, _GLIBCXX_EXT)\n\n  using std::equal_to;\n  using std::allocator;\n  using std::pair;\n  using std::_Select1st;\n\n  /**\n   *  This is an SGI extension.\n   *  @ingroup SGIextensions\n   *  @doctodo\n   */\n  template<class _Key, class _Tp, class _HashFn = hash<_Key>,\n\t   class _EqualKey = equal_to<_Key>, class _Alloc = allocator<_Tp> >\n    class hash_map\n    {\n    private:\n      typedef hashtable<pair<const _Key, _Tp>,_Key, _HashFn,\n\t\t\t_Select1st<pair<const _Key, _Tp> >,\n\t\t\t_EqualKey, _Alloc> _Ht;\n\n      _Ht _M_ht;\n\n    public:\n      typedef typename _Ht::key_type key_type;\n      typedef _Tp data_type;\n      typedef _Tp mapped_type;\n      typedef typename _Ht::value_type value_type;\n      typedef typename _Ht::hasher hasher;\n      typedef typename _Ht::key_equal key_equal;\n      \n      typedef typename _Ht::size_type size_type;\n      typedef typename _Ht::difference_type difference_type;\n      typedef typename _Ht::pointer pointer;\n      typedef typename _Ht::const_pointer const_pointer;\n      typedef typename _Ht::reference reference;\n      typedef typename _Ht::const_reference const_reference;\n      \n      typedef typename _Ht::iterator iterator;\n      typedef typename _Ht::const_iterator const_iterator;\n      \n      typedef typename _Ht::allocator_type allocator_type;\n      \n      hasher\n      hash_funct() const\n      { return _M_ht.hash_funct(); }\n\n      key_equal\n      key_eq() const\n      { return _M_ht.key_eq(); }\n\n      allocator_type\n      get_allocator() const\n      { return _M_ht.get_allocator(); }\n\n    public:\n      hash_map()\n      : _M_ht(100, hasher(), key_equal(), allocator_type()) {}\n  \n      explicit\n      hash_map(size_type __n)\n      : _M_ht(__n, hasher(), key_equal(), allocator_type()) {}\n\n      hash_map(size_type __n, const hasher& __hf)\n      : _M_ht(__n, __hf, key_equal(), allocator_type()) {}\n\n      hash_map(size_type __n, const hasher& __hf, const key_equal& __eql,\n\t       const allocator_type& __a = allocator_type())\n      : _M_ht(__n, __hf, __eql, __a) {}\n\n      template<class _InputIterator>\n        hash_map(_InputIterator __f, _InputIterator __l)\n\t: _M_ht(100, hasher(), key_equal(), allocator_type())\n        { _M_ht.insert_unique(__f, __l); }\n\n      template<class _InputIterator>\n        hash_map(_InputIterator __f, _InputIterator __l, size_type __n)\n\t: _M_ht(__n, hasher(), key_equal(), allocator_type())\n        { _M_ht.insert_unique(__f, __l); }\n\n      template<class _InputIterator>\n        hash_map(_InputIterator __f, _InputIterator __l, size_type __n,\n\t\t const hasher& __hf)\n\t: _M_ht(__n, __hf, key_equal(), allocator_type())\n        { _M_ht.insert_unique(__f, __l); }\n\n      template<class _InputIterator>\n        hash_map(_InputIterator __f, _InputIterator __l, size_type __n,\n\t\t const hasher& __hf, const key_equal& __eql,\n\t\t const allocator_type& __a = allocator_type())\n\t: _M_ht(__n, __hf, __eql, __a)\n        { _M_ht.insert_unique(__f, __l); }\n\n    public:\n      size_type\n      size() const\n      { return _M_ht.size(); }\n      \n      size_type\n      max_size() const\n      { return _M_ht.max_size(); }\n      \n      bool\n      empty() const\n      { return _M_ht.empty(); }\n  \n      void\n      swap(hash_map& __hs)\n      { _M_ht.swap(__hs._M_ht); }\n\n      template<class _K1, class _T1, class _HF, class _EqK, class _Al>\n        friend bool\n        operator== (const hash_map<_K1, _T1, _HF, _EqK, _Al>&,\n\t\t    const hash_map<_K1, _T1, _HF, _EqK, _Al>&);\n\n      iterator\n      begin()\n      { return _M_ht.begin(); }\n\n      iterator\n      end()\n      { return _M_ht.end(); }\n\n      const_iterator\n      begin() const\n      { return _M_ht.begin(); }\n\n      const_iterator\n      end() const\n      { return _M_ht.end(); }\n\n    public:\n      pair<iterator, bool>\n      insert(const value_type& __obj)\n      { return _M_ht.insert_unique(__obj); }\n\n      template<class _InputIterator>\n        void\n        insert(_InputIterator __f, _InputIterator __l)\n        { _M_ht.insert_unique(__f, __l); }\n\n      pair<iterator, bool>\n      insert_noresize(const value_type& __obj)\n      { return _M_ht.insert_unique_noresize(__obj); }\n\n      iterator\n      find(const key_type& __key)\n      { return _M_ht.find(__key); }\n\n      const_iterator\n      find(const key_type& __key) const\n      { return _M_ht.find(__key); }\n\n      _Tp&\n      operator[](const key_type& __key)\n      { return _M_ht.find_or_insert(value_type(__key, _Tp())).second; }\n\n      size_type\n      count(const key_type& __key) const\n      { return _M_ht.count(__key); }\n\n      pair<iterator, iterator>\n      equal_range(const key_type& __key)\n      { return _M_ht.equal_range(__key); }\n\n      pair<const_iterator, const_iterator>\n      equal_range(const key_type& __key) const\n      { return _M_ht.equal_range(__key); }\n\n      size_type\n      erase(const key_type& __key)\n      {return _M_ht.erase(__key); }\n\n      void\n      erase(iterator __it)\n      { _M_ht.erase(__it); }\n\n      void\n      erase(iterator __f, iterator __l)\n      { _M_ht.erase(__f, __l); }\n\n      void\n      clear()\n      { _M_ht.clear(); }\n\n      void\n      resize(size_type __hint)\n      { _M_ht.resize(__hint); }\n\n      size_type\n      bucket_count() const\n      { return _M_ht.bucket_count(); }\n\n      size_type\n      max_bucket_count() const\n      { return _M_ht.max_bucket_count(); }\n\n      size_type\n      elems_in_bucket(size_type __n) const\n      { return _M_ht.elems_in_bucket(__n); }\n    };\n\n  template<class _Key, class _Tp, class _HashFn, class _EqlKey, class _Alloc>\n    inline bool\n    operator==(const hash_map<_Key, _Tp, _HashFn, _EqlKey, _Alloc>& __hm1,\n\t       const hash_map<_Key, _Tp, _HashFn, _EqlKey, _Alloc>& __hm2)\n    { return __hm1._M_ht == __hm2._M_ht; }\n\n  template<class _Key, class _Tp, class _HashFn, class _EqlKey, class _Alloc>\n    inline bool\n    operator!=(const hash_map<_Key, _Tp, _HashFn, _EqlKey, _Alloc>& __hm1,\n\t       const hash_map<_Key, _Tp, _HashFn, _EqlKey, _Alloc>& __hm2)\n    { return !(__hm1 == __hm2); }\n\n  template<class _Key, class _Tp, class _HashFn, class _EqlKey, class _Alloc>\n    inline void\n    swap(hash_map<_Key, _Tp, _HashFn, _EqlKey, _Alloc>& __hm1,\n\t hash_map<_Key, _Tp, _HashFn, _EqlKey, _Alloc>& __hm2)\n    { __hm1.swap(__hm2); }\n\n\n  /**\n   *  This is an SGI extension.\n   *  @ingroup SGIextensions\n   *  @doctodo\n   */\n  template<class _Key, class _Tp,\n\t   class _HashFn = hash<_Key>,\n\t   class _EqualKey = equal_to<_Key>,\n\t   class _Alloc = allocator<_Tp> >\n    class hash_multimap\n    {\n      // concept requirements\n      __glibcxx_class_requires(_Key, _SGIAssignableConcept)\n      __glibcxx_class_requires(_Tp, _SGIAssignableConcept)\n      __glibcxx_class_requires3(_HashFn, size_t, _Key, _UnaryFunctionConcept)\n      __glibcxx_class_requires3(_EqualKey, _Key, _Key, _BinaryPredicateConcept)\n\t\n    private:\n      typedef hashtable<pair<const _Key, _Tp>, _Key, _HashFn,\n\t\t\t_Select1st<pair<const _Key, _Tp> >, _EqualKey, _Alloc>\n          _Ht;\n\n      _Ht _M_ht;\n\n    public:\n      typedef typename _Ht::key_type key_type;\n      typedef _Tp data_type;\n      typedef _Tp mapped_type;\n      typedef typename _Ht::value_type value_type;\n      typedef typename _Ht::hasher hasher;\n      typedef typename _Ht::key_equal key_equal;\n      \n      typedef typename _Ht::size_type size_type;\n      typedef typename _Ht::difference_type difference_type;\n      typedef typename _Ht::pointer pointer;\n      typedef typename _Ht::const_pointer const_pointer;\n      typedef typename _Ht::reference reference;\n      typedef typename _Ht::const_reference const_reference;\n      \n      typedef typename _Ht::iterator iterator;\n      typedef typename _Ht::const_iterator const_iterator;\n      \n      typedef typename _Ht::allocator_type allocator_type;\n      \n      hasher\n      hash_funct() const\n      { return _M_ht.hash_funct(); }\n\n      key_equal\n      key_eq() const\n      { return _M_ht.key_eq(); }\n\n      allocator_type\n      get_allocator() const\n      { return _M_ht.get_allocator(); }\n\n    public:\n      hash_multimap()\n      : _M_ht(100, hasher(), key_equal(), allocator_type()) {}\n\n      explicit\n      hash_multimap(size_type __n)\n      : _M_ht(__n, hasher(), key_equal(), allocator_type()) {}\n\n      hash_multimap(size_type __n, const hasher& __hf)\n      : _M_ht(__n, __hf, key_equal(), allocator_type()) {}\n\n      hash_multimap(size_type __n, const hasher& __hf, const key_equal& __eql,\n\t\t    const allocator_type& __a = allocator_type())\n      : _M_ht(__n, __hf, __eql, __a) {}\n\n      template<class _InputIterator>\n        hash_multimap(_InputIterator __f, _InputIterator __l)\n\t: _M_ht(100, hasher(), key_equal(), allocator_type())\n        { _M_ht.insert_equal(__f, __l); }\n\n      template<class _InputIterator>\n        hash_multimap(_InputIterator __f, _InputIterator __l, size_type __n)\n\t: _M_ht(__n, hasher(), key_equal(), allocator_type())\n        { _M_ht.insert_equal(__f, __l); }\n\n      template<class _InputIterator>\n        hash_multimap(_InputIterator __f, _InputIterator __l, size_type __n,\n\t\t      const hasher& __hf)\n\t: _M_ht(__n, __hf, key_equal(), allocator_type())\n        { _M_ht.insert_equal(__f, __l); }\n\n      template<class _InputIterator>\n        hash_multimap(_InputIterator __f, _InputIterator __l, size_type __n,\n\t\t      const hasher& __hf, const key_equal& __eql,\n\t\t      const allocator_type& __a = allocator_type())\n\t: _M_ht(__n, __hf, __eql, __a)\n        { _M_ht.insert_equal(__f, __l); }\n\n    public:\n      size_type\n      size() const\n      { return _M_ht.size(); }\n\n      size_type\n      max_size() const\n      { return _M_ht.max_size(); }\n\n      bool\n      empty() const\n      { return _M_ht.empty(); }\n\n      void\n      swap(hash_multimap& __hs)\n      { _M_ht.swap(__hs._M_ht); }\n\n      template<class _K1, class _T1, class _HF, class _EqK, class _Al>\n        friend bool\n        operator==(const hash_multimap<_K1, _T1, _HF, _EqK, _Al>&,\n\t\t   const hash_multimap<_K1, _T1, _HF, _EqK, _Al>&);\n\n      iterator\n      begin()\n      { return _M_ht.begin(); }\n\n      iterator\n      end()\n      { return _M_ht.end(); }\n\n      const_iterator\n      begin() const\n      { return _M_ht.begin(); }\n\n      const_iterator\n      end() const\n      { return _M_ht.end(); }\n\n    public:\n      iterator\n      insert(const value_type& __obj)\n      { return _M_ht.insert_equal(__obj); }\n\n      template<class _InputIterator>\n        void\n        insert(_InputIterator __f, _InputIterator __l)\n        { _M_ht.insert_equal(__f,__l); }\n\n      iterator\n      insert_noresize(const value_type& __obj)\n      { return _M_ht.insert_equal_noresize(__obj); }\n\n      iterator\n      find(const key_type& __key)\n      { return _M_ht.find(__key); }\n\n      const_iterator\n      find(const key_type& __key) const\n      { return _M_ht.find(__key); }\n\n      size_type\n      count(const key_type& __key) const\n      { return _M_ht.count(__key); }\n\n      pair<iterator, iterator>\n      equal_range(const key_type& __key)\n      { return _M_ht.equal_range(__key); }\n\n      pair<const_iterator, const_iterator>\n      equal_range(const key_type& __key) const\n      { return _M_ht.equal_range(__key); }\n\n      size_type\n      erase(const key_type& __key)\n      { return _M_ht.erase(__key); }\n\n      void\n      erase(iterator __it)\n      { _M_ht.erase(__it); }\n\n      void\n      erase(iterator __f, iterator __l)\n      { _M_ht.erase(__f, __l); }\n\n      void\n      clear()\n      { _M_ht.clear(); }\n\n    public:\n      void\n      resize(size_type __hint)\n      { _M_ht.resize(__hint); }\n\n      size_type\n      bucket_count() const\n      { return _M_ht.bucket_count(); }\n\n      size_type\n      max_bucket_count() const\n      { return _M_ht.max_bucket_count(); }\n      \n      size_type\n      elems_in_bucket(size_type __n) const\n      { return _M_ht.elems_in_bucket(__n); }\n    };\n\n  template<class _Key, class _Tp, class _HF, class _EqKey, class _Alloc>\n    inline bool\n    operator==(const hash_multimap<_Key, _Tp, _HF, _EqKey, _Alloc>& __hm1,\n\t       const hash_multimap<_Key, _Tp, _HF, _EqKey, _Alloc>& __hm2)\n    { return __hm1._M_ht == __hm2._M_ht; }\n\n  template<class _Key, class _Tp, class _HF, class _EqKey, class _Alloc>\n    inline bool\n    operator!=(const hash_multimap<_Key, _Tp, _HF, _EqKey, _Alloc>& __hm1,\n\t       const hash_multimap<_Key, _Tp, _HF, _EqKey, _Alloc>& __hm2)\n    { return !(__hm1 == __hm2); }\n\n  template<class _Key, class _Tp, class _HashFn, class _EqlKey, class _Alloc>\n    inline void\n    swap(hash_multimap<_Key, _Tp, _HashFn, _EqlKey, _Alloc>& __hm1,\n\t hash_multimap<_Key, _Tp, _HashFn, _EqlKey, _Alloc>& __hm2)\n    { __hm1.swap(__hm2); }\n\n_GLIBCXX_END_NESTED_NAMESPACE\n\n#ifdef _GLIBCXX_DEBUG\n# include <debug/hash_map>\n#endif\n\n_GLIBCXX_BEGIN_NAMESPACE(std)\n\n  // Specialization of insert_iterator so that it will work for hash_map\n  // and hash_multimap.\n  template<class _Key, class _Tp, class _HashFn,  class _EqKey, class _Alloc>\n    class insert_iterator<__gnu_cxx::hash_map<_Key, _Tp, _HashFn, \n\t\t\t\t\t      _EqKey, _Alloc> >\n    {\n    protected:\n      typedef __gnu_cxx::hash_map<_Key, _Tp, _HashFn, _EqKey, _Alloc>\n        _Container;\n      _Container* container;\n\n    public:\n      typedef _Container          container_type;\n      typedef output_iterator_tag iterator_category;\n      typedef void                value_type;\n      typedef void                difference_type;\n      typedef void                pointer;\n      typedef void                reference;\n      \n      insert_iterator(_Container& __x)\n      : container(&__x) {}\n\n      insert_iterator(_Container& __x, typename _Container::iterator)\n      : container(&__x) {}\n\n      insert_iterator<_Container>&\n      operator=(const typename _Container::value_type& __value)\n      {\n\tcontainer->insert(__value);\n\treturn *this;\n      }\n\n      insert_iterator<_Container>&\n      operator*()\n      { return *this; }\n\n      insert_iterator<_Container>&\n      operator++() { return *this; }\n\n      insert_iterator<_Container>&\n      operator++(int)\n      { return *this; }\n    };\n\n  template<class _Key, class _Tp, class _HashFn,  class _EqKey, class _Alloc>\n    class insert_iterator<__gnu_cxx::hash_multimap<_Key, _Tp, _HashFn,\n\t\t\t\t\t\t   _EqKey, _Alloc> >\n    {\n    protected:\n      typedef __gnu_cxx::hash_multimap<_Key, _Tp, _HashFn, _EqKey, _Alloc>\n        _Container;\n      _Container* container;\n      typename _Container::iterator iter;\n\n    public:\n      typedef _Container          container_type;\n      typedef output_iterator_tag iterator_category;\n      typedef void                value_type;\n      typedef void                difference_type;\n      typedef void                pointer;\n      typedef void                reference;\n\n      insert_iterator(_Container& __x)\n      : container(&__x) {}\n\n      insert_iterator(_Container& __x, typename _Container::iterator)\n      : container(&__x) {}\n\n      insert_iterator<_Container>&\n      operator=(const typename _Container::value_type& __value)\n      {\n\tcontainer->insert(__value);\n\treturn *this;\n      }\n\n      insert_iterator<_Container>&\n      operator*()\n      { return *this; }\n\n      insert_iterator<_Container>&\n      operator++()\n      { return *this; }\n\n      insert_iterator<_Container>&\n      operator++(int)\n      { return *this; }\n    };\n\n_GLIBCXX_END_NAMESPACE\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/hash_set",
    "content": "// Hashing set implementation -*- C++ -*-\n\n// Copyright (C) 2001, 2002, 2004, 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n/*\n * Copyright (c) 1996\n * Silicon Graphics Computer Systems, Inc.\n *\n * Permission to use, copy, modify, distribute and sell this software\n * and its documentation for any purpose is hereby granted without fee,\n * provided that the above copyright notice appear in all copies and\n * that both that copyright notice and this permission notice appear\n * in supporting documentation.  Silicon Graphics makes no\n * representations about the suitability of this software for any\n * purpose.  It is provided \"as is\" without express or implied warranty.\n *\n *\n * Copyright (c) 1994\n * Hewlett-Packard Company\n *\n * Permission to use, copy, modify, distribute and sell this software\n * and its documentation for any purpose is hereby granted without fee,\n * provided that the above copyright notice appear in all copies and\n * that both that copyright notice and this permission notice appear\n * in supporting documentation.  Hewlett-Packard Company makes no\n * representations about the suitability of this software for any\n * purpose.  It is provided \"as is\" without express or implied warranty.\n *\n */\n\n/** @file ext/hash_set\n *  This file is a GNU extension to the Standard C++ Library (possibly\n *  containing extensions from the HP/SGI STL subset).\n */\n\n#ifndef _HASH_SET\n#define _HASH_SET 1\n\n#include <bits/c++config.h>\n#include <ext/hashtable.h>\n#include <bits/concept_check.h>\n\n_GLIBCXX_BEGIN_NESTED_NAMESPACE(__gnu_cxx, _GLIBCXX_EXT)\n\n  using std::equal_to;\n  using std::allocator;\n  using std::pair;\n  using std::_Identity;\n\n  /**\n   *  This is an SGI extension.\n   *  @ingroup SGIextensions\n   *  @doctodo\n   */\n  template<class _Value, class _HashFcn  = hash<_Value>,\n\t   class _EqualKey = equal_to<_Value>,\n\t   class _Alloc = allocator<_Value> >\n    class hash_set\n    {\n      // concept requirements\n      __glibcxx_class_requires(_Value, _SGIAssignableConcept)\n      __glibcxx_class_requires3(_HashFcn, size_t, _Value, _UnaryFunctionConcept)\n      __glibcxx_class_requires3(_EqualKey, _Value, _Value, _BinaryPredicateConcept)\n\n    private:\n      typedef hashtable<_Value, _Value, _HashFcn, _Identity<_Value>,\n\t\t\t_EqualKey, _Alloc> _Ht;\n      _Ht _M_ht;\n\n    public:\n      typedef typename _Ht::key_type key_type;\n      typedef typename _Ht::value_type value_type;\n      typedef typename _Ht::hasher hasher;\n      typedef typename _Ht::key_equal key_equal;\n      \n      typedef typename _Ht::size_type size_type;\n      typedef typename _Ht::difference_type difference_type;\n      typedef typename _Alloc::pointer pointer;\n      typedef typename _Alloc::const_pointer const_pointer;\n      typedef typename _Alloc::reference reference;\n      typedef typename _Alloc::const_reference const_reference;\n      \n      typedef typename _Ht::const_iterator iterator;\n      typedef typename _Ht::const_iterator const_iterator;\n      \n      typedef typename _Ht::allocator_type allocator_type;\n      \n      hasher\n      hash_funct() const\n      { return _M_ht.hash_funct(); }\n\n      key_equal\n      key_eq() const\n      { return _M_ht.key_eq(); }\n\n      allocator_type\n      get_allocator() const\n      { return _M_ht.get_allocator(); }\n\n    public:\n      hash_set()\n      : _M_ht(100, hasher(), key_equal(), allocator_type()) {}\n\n      explicit\n      hash_set(size_type __n)\n      : _M_ht(__n, hasher(), key_equal(), allocator_type()) {}\n\n      hash_set(size_type __n, const hasher& __hf)\n      : _M_ht(__n, __hf, key_equal(), allocator_type()) {}\n\n      hash_set(size_type __n, const hasher& __hf, const key_equal& __eql,\n\t       const allocator_type& __a = allocator_type())\n      : _M_ht(__n, __hf, __eql, __a) {}\n\n      template<class _InputIterator>\n        hash_set(_InputIterator __f, _InputIterator __l)\n\t: _M_ht(100, hasher(), key_equal(), allocator_type())\n        { _M_ht.insert_unique(__f, __l); }\n\n      template<class _InputIterator>\n        hash_set(_InputIterator __f, _InputIterator __l, size_type __n)\n\t: _M_ht(__n, hasher(), key_equal(), allocator_type())\n        { _M_ht.insert_unique(__f, __l); }\n\n      template<class _InputIterator>\n        hash_set(_InputIterator __f, _InputIterator __l, size_type __n,\n\t\t const hasher& __hf)\n\t: _M_ht(__n, __hf, key_equal(), allocator_type())\n        { _M_ht.insert_unique(__f, __l); }\n\n      template<class _InputIterator>\n        hash_set(_InputIterator __f, _InputIterator __l, size_type __n,\n\t\t const hasher& __hf, const key_equal& __eql,\n\t\t const allocator_type& __a = allocator_type())\n\t: _M_ht(__n, __hf, __eql, __a)\n        { _M_ht.insert_unique(__f, __l); }\n\n    public:\n      size_type\n      size() const\n      { return _M_ht.size(); }\n\n      size_type\n      max_size() const\n      { return _M_ht.max_size(); }\n      \n      bool\n      empty() const\n      { return _M_ht.empty(); }\n      \n      void\n      swap(hash_set& __hs)\n      { _M_ht.swap(__hs._M_ht); }\n\n      template<class _Val, class _HF, class _EqK, class _Al>\n        friend bool\n        operator==(const hash_set<_Val, _HF, _EqK, _Al>&,\n\t\t   const hash_set<_Val, _HF, _EqK, _Al>&);\n\n      iterator\n      begin() const\n      { return _M_ht.begin(); }\n      \n      iterator\n      end() const\n      { return _M_ht.end(); }\n\n    public:\n      pair<iterator, bool>\n      insert(const value_type& __obj)\n      {\n\tpair<typename _Ht::iterator, bool> __p = _M_ht.insert_unique(__obj);\n\treturn pair<iterator,bool>(__p.first, __p.second);\n      }\n\n      template<class _InputIterator>\n        void\n        insert(_InputIterator __f, _InputIterator __l)\n        { _M_ht.insert_unique(__f, __l); }\n\n      pair<iterator, bool>\n      insert_noresize(const value_type& __obj)\n      {\n\tpair<typename _Ht::iterator, bool> __p\n\t  = _M_ht.insert_unique_noresize(__obj);\n\treturn pair<iterator, bool>(__p.first, __p.second);\n      }\n\n      iterator\n      find(const key_type& __key) const\n      { return _M_ht.find(__key); }\n\n      size_type\n      count(const key_type& __key) const\n      { return _M_ht.count(__key); }\n\n      pair<iterator, iterator>\n      equal_range(const key_type& __key) const\n      { return _M_ht.equal_range(__key); }\n\n      size_type\n      erase(const key_type& __key)\n      {return _M_ht.erase(__key); }\n      \n      void\n      erase(iterator __it)\n      { _M_ht.erase(__it); }\n      \n      void\n      erase(iterator __f, iterator __l)\n      { _M_ht.erase(__f, __l); }\n      \n      void\n      clear()\n      { _M_ht.clear(); }\n\n    public:\n      void\n      resize(size_type __hint)\n      { _M_ht.resize(__hint); }\n      \n      size_type\n      bucket_count() const\n      { return _M_ht.bucket_count(); }\n      \n      size_type\n      max_bucket_count() const\n      { return _M_ht.max_bucket_count(); }\n      \n      size_type\n      elems_in_bucket(size_type __n) const\n      { return _M_ht.elems_in_bucket(__n); }\n    };\n\n  template<class _Value, class _HashFcn, class _EqualKey, class _Alloc>\n    inline bool\n    operator==(const hash_set<_Value, _HashFcn, _EqualKey, _Alloc>& __hs1,\n\t       const hash_set<_Value, _HashFcn, _EqualKey, _Alloc>& __hs2)\n    { return __hs1._M_ht == __hs2._M_ht; }\n\n  template<class _Value, class _HashFcn, class _EqualKey, class _Alloc>\n    inline bool\n    operator!=(const hash_set<_Value, _HashFcn, _EqualKey, _Alloc>& __hs1,\n\t       const hash_set<_Value, _HashFcn, _EqualKey, _Alloc>& __hs2)\n    { return !(__hs1 == __hs2); }\n\n  template<class _Val, class _HashFcn, class _EqualKey, class _Alloc>\n    inline void\n    swap(hash_set<_Val, _HashFcn, _EqualKey, _Alloc>& __hs1,\n\t hash_set<_Val, _HashFcn, _EqualKey, _Alloc>& __hs2)\n    { __hs1.swap(__hs2); }\n\n\n  /**\n   *  This is an SGI extension.\n   *  @ingroup SGIextensions\n   *  @doctodo\n   */\n  template<class _Value,\n\t   class _HashFcn = hash<_Value>,\n\t   class _EqualKey = equal_to<_Value>,\n\t   class _Alloc = allocator<_Value> >\n    class hash_multiset\n    {\n      // concept requirements\n      __glibcxx_class_requires(_Value, _SGIAssignableConcept)\n      __glibcxx_class_requires3(_HashFcn, size_t, _Value, _UnaryFunctionConcept)\n      __glibcxx_class_requires3(_EqualKey, _Value, _Value, _BinaryPredicateConcept)\n\n    private:\n      typedef hashtable<_Value, _Value, _HashFcn, _Identity<_Value>,\n\t\t\t_EqualKey, _Alloc> _Ht;\n      _Ht _M_ht;\n\n    public:\n      typedef typename _Ht::key_type key_type;\n      typedef typename _Ht::value_type value_type;\n      typedef typename _Ht::hasher hasher;\n      typedef typename _Ht::key_equal key_equal;\n      \n      typedef typename _Ht::size_type size_type;\n      typedef typename _Ht::difference_type difference_type;\n      typedef typename _Alloc::pointer pointer;\n      typedef typename _Alloc::const_pointer const_pointer;\n      typedef typename _Alloc::reference reference;\n      typedef typename _Alloc::const_reference const_reference;\n\n      typedef typename _Ht::const_iterator iterator;\n      typedef typename _Ht::const_iterator const_iterator;\n      \n      typedef typename _Ht::allocator_type allocator_type;\n      \n      hasher\n      hash_funct() const\n      { return _M_ht.hash_funct(); }\n      \n      key_equal\n      key_eq() const\n      { return _M_ht.key_eq(); }\n      \n      allocator_type\n      get_allocator() const\n      { return _M_ht.get_allocator(); }\n\n    public:\n      hash_multiset()\n      : _M_ht(100, hasher(), key_equal(), allocator_type()) {}\n\n      explicit\n      hash_multiset(size_type __n)\n      : _M_ht(__n, hasher(), key_equal(), allocator_type()) {}\n\n      hash_multiset(size_type __n, const hasher& __hf)\n      : _M_ht(__n, __hf, key_equal(), allocator_type()) {}\n      \n      hash_multiset(size_type __n, const hasher& __hf, const key_equal& __eql,\n\t\t    const allocator_type& __a = allocator_type())\n      : _M_ht(__n, __hf, __eql, __a) {}\n\n      template<class _InputIterator>\n        hash_multiset(_InputIterator __f, _InputIterator __l)\n\t: _M_ht(100, hasher(), key_equal(), allocator_type())\n        { _M_ht.insert_equal(__f, __l); }\n\n      template<class _InputIterator>\n        hash_multiset(_InputIterator __f, _InputIterator __l, size_type __n)\n\t: _M_ht(__n, hasher(), key_equal(), allocator_type())\n        { _M_ht.insert_equal(__f, __l); }\n\n      template<class _InputIterator>\n        hash_multiset(_InputIterator __f, _InputIterator __l, size_type __n,\n\t\t      const hasher& __hf)\n\t: _M_ht(__n, __hf, key_equal(), allocator_type())\n        { _M_ht.insert_equal(__f, __l); }\n\n      template<class _InputIterator>\n        hash_multiset(_InputIterator __f, _InputIterator __l, size_type __n,\n\t\t      const hasher& __hf, const key_equal& __eql,\n\t\t      const allocator_type& __a = allocator_type())\n\t: _M_ht(__n, __hf, __eql, __a)\n        { _M_ht.insert_equal(__f, __l); }\n\n    public:\n      size_type\n      size() const\n      { return _M_ht.size(); }\n\n      size_type\n      max_size() const\n      { return _M_ht.max_size(); }\n\n      bool\n      empty() const\n      { return _M_ht.empty(); }\n\n      void\n      swap(hash_multiset& hs)\n      { _M_ht.swap(hs._M_ht); }\n\n      template<class _Val, class _HF, class _EqK, class _Al>\n        friend bool\n        operator==(const hash_multiset<_Val, _HF, _EqK, _Al>&,\n\t\t   const hash_multiset<_Val, _HF, _EqK, _Al>&);\n\n      iterator\n      begin() const\n      { return _M_ht.begin(); }\n      \n      iterator\n      end() const\n      { return _M_ht.end(); }\n\n    public:\n      iterator\n      insert(const value_type& __obj)\n      { return _M_ht.insert_equal(__obj); }\n  \n      template<class _InputIterator>\n        void\n        insert(_InputIterator __f, _InputIterator __l)\n        { _M_ht.insert_equal(__f,__l); }\n  \n      iterator\n      insert_noresize(const value_type& __obj)\n      { return _M_ht.insert_equal_noresize(__obj); }\n\n      iterator\n      find(const key_type& __key) const\n      { return _M_ht.find(__key); }\n\n      size_type\n      count(const key_type& __key) const\n      { return _M_ht.count(__key); }\n\n      pair<iterator, iterator>\n      equal_range(const key_type& __key) const\n      { return _M_ht.equal_range(__key); }\n\n      size_type\n      erase(const key_type& __key)\n      { return _M_ht.erase(__key); }\n  \n      void\n      erase(iterator __it)\n      { _M_ht.erase(__it); }\n  \n      void\n      erase(iterator __f, iterator __l)\n      { _M_ht.erase(__f, __l); }\n  \n      void\n      clear()\n      { _M_ht.clear(); }\n\n    public:\n      void\n      resize(size_type __hint)\n      { _M_ht.resize(__hint); }\n  \n      size_type\n      bucket_count() const\n      { return _M_ht.bucket_count(); }\n\n      size_type\n      max_bucket_count() const\n      { return _M_ht.max_bucket_count(); }\n\n      size_type\n      elems_in_bucket(size_type __n) const\n      { return _M_ht.elems_in_bucket(__n); }\n    };\n\n  template<class _Val, class _HashFcn, class _EqualKey, class _Alloc>\n    inline bool\n    operator==(const hash_multiset<_Val, _HashFcn, _EqualKey, _Alloc>& __hs1,\n\t       const hash_multiset<_Val, _HashFcn, _EqualKey, _Alloc>& __hs2)\n    { return __hs1._M_ht == __hs2._M_ht; }\n\n  template<class _Val, class _HashFcn, class _EqualKey, class _Alloc>\n    inline bool\n    operator!=(const hash_multiset<_Val, _HashFcn, _EqualKey, _Alloc>& __hs1,\n\t       const hash_multiset<_Val, _HashFcn, _EqualKey, _Alloc>& __hs2)\n    { return !(__hs1 == __hs2); }\n\n  template<class _Val, class _HashFcn, class _EqualKey, class _Alloc>\n    inline void\n    swap(hash_multiset<_Val, _HashFcn, _EqualKey, _Alloc>& __hs1,\n\t hash_multiset<_Val, _HashFcn, _EqualKey, _Alloc>& __hs2)\n    { __hs1.swap(__hs2); }\n\n_GLIBCXX_END_NESTED_NAMESPACE\n\n#ifdef _GLIBCXX_DEBUG\n# include <debug/hash_set>\n#endif\n\n_GLIBCXX_BEGIN_NAMESPACE(std)\n\n  // Specialization of insert_iterator so that it will work for hash_set\n  // and hash_multiset.\n  template<class _Value, class _HashFcn, class _EqualKey, class _Alloc>\n    class insert_iterator<__gnu_cxx::hash_set<_Value, _HashFcn,\n\t\t\t\t\t      _EqualKey, _Alloc> >\n    {\n    protected:\n      typedef __gnu_cxx::hash_set<_Value, _HashFcn, _EqualKey, _Alloc>\n        _Container;\n      _Container* container;\n\n    public:\n      typedef _Container          container_type;\n      typedef output_iterator_tag iterator_category;\n      typedef void                value_type;\n      typedef void                difference_type;\n      typedef void                pointer;\n      typedef void                reference;\n\n      insert_iterator(_Container& __x)\n      : container(&__x) {}\n      \n      insert_iterator(_Container& __x, typename _Container::iterator)\n      : container(&__x) {}\n\n      insert_iterator<_Container>&\n      operator=(const typename _Container::value_type& __value)\n      {\n\tcontainer->insert(__value);\n\treturn *this;\n      }\n\n      insert_iterator<_Container>&\n      operator*()\n      { return *this; }\n      \n      insert_iterator<_Container>&\n      operator++()\n      { return *this; }\n      \n      insert_iterator<_Container>&\n      operator++(int)\n      { return *this; }\n    };\n\n  template<class _Value, class _HashFcn, class _EqualKey, class _Alloc>\n    class insert_iterator<__gnu_cxx::hash_multiset<_Value, _HashFcn,\n\t\t\t\t\t\t   _EqualKey, _Alloc> >\n    {\n    protected:\n      typedef __gnu_cxx::hash_multiset<_Value, _HashFcn, _EqualKey, _Alloc>\n        _Container;\n      _Container* container;\n      typename _Container::iterator iter;\n\n    public:\n      typedef _Container          container_type;\n      typedef output_iterator_tag iterator_category;\n      typedef void                value_type;\n      typedef void                difference_type;\n      typedef void                pointer;\n      typedef void                reference;\n      \n      insert_iterator(_Container& __x)\n      : container(&__x) {}\n      \n      insert_iterator(_Container& __x, typename _Container::iterator)\n      : container(&__x) {}\n\n      insert_iterator<_Container>&\n      operator=(const typename _Container::value_type& __value)\n      {\n\tcontainer->insert(__value);\n\treturn *this;\n      }\n\n      insert_iterator<_Container>&\n      operator*()\n      { return *this; }\n\n      insert_iterator<_Container>&\n      operator++()\n      { return *this; }\n\n      insert_iterator<_Container>&\n      operator++(int) { return *this; }\n    };\n\n_GLIBCXX_END_NAMESPACE\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/hashtable.h",
    "content": "// Hashtable implementation used by containers -*- C++ -*-\n\n// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006\n// Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n/*\n * Copyright (c) 1996,1997\n * Silicon Graphics Computer Systems, Inc.\n *\n * Permission to use, copy, modify, distribute and sell this software\n * and its documentation for any purpose is hereby granted without fee,\n * provided that the above copyright notice appear in all copies and\n * that both that copyright notice and this permission notice appear\n * in supporting documentation.  Silicon Graphics makes no\n * representations about the suitability of this software for any\n * purpose.  It is provided \"as is\" without express or implied warranty.\n *\n *\n * Copyright (c) 1994\n * Hewlett-Packard Company\n *\n * Permission to use, copy, modify, distribute and sell this software\n * and its documentation for any purpose is hereby granted without fee,\n * provided that the above copyright notice appear in all copies and\n * that both that copyright notice and this permission notice appear\n * in supporting documentation.  Hewlett-Packard Company makes no\n * representations about the suitability of this software for any\n * purpose.  It is provided \"as is\" without express or implied warranty.\n *\n */\n\n/** @file ext/hashtable.h\n *  This file is a GNU extension to the Standard C++ Library (possibly\n *  containing extensions from the HP/SGI STL subset).\n */\n\n#ifndef _HASHTABLE_H\n#define _HASHTABLE_H 1\n\n// Hashtable class, used to implement the hashed associative containers\n// hash_set, hash_map, hash_multiset, and hash_multimap.\n\n#include <vector>\n#include <iterator>\n#include <bits/stl_algo.h>\n#include <bits/stl_function.h>\n#include <ext/hash_fun.h>\n\n_GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)\n\n  using std::size_t;\n  using std::ptrdiff_t;\n  using std::forward_iterator_tag;\n  using std::input_iterator_tag;\n  using std::_Construct;\n  using std::_Destroy;\n  using std::distance;\n  using std::vector;\n  using std::pair;\n  using std::__iterator_category;\n\n  template<class _Val>\n    struct _Hashtable_node\n    {\n      _Hashtable_node* _M_next;\n      _Val _M_val;\n    };\n\n  template<class _Val, class _Key, class _HashFcn, class _ExtractKey, \n\t   class _EqualKey, class _Alloc = std::allocator<_Val> >\n    class hashtable;\n\n  template<class _Val, class _Key, class _HashFcn,\n\t   class _ExtractKey, class _EqualKey, class _Alloc>\n    struct _Hashtable_iterator;\n\n  template<class _Val, class _Key, class _HashFcn,\n\t   class _ExtractKey, class _EqualKey, class _Alloc>\n    struct _Hashtable_const_iterator;\n\n  template<class _Val, class _Key, class _HashFcn,\n\t   class _ExtractKey, class _EqualKey, class _Alloc>\n    struct _Hashtable_iterator\n    {\n      typedef hashtable<_Val, _Key, _HashFcn, _ExtractKey, _EqualKey, _Alloc>\n        _Hashtable;\n      typedef _Hashtable_iterator<_Val, _Key, _HashFcn,\n\t\t\t\t  _ExtractKey, _EqualKey, _Alloc>\n        iterator;\n      typedef _Hashtable_const_iterator<_Val, _Key, _HashFcn,\n\t\t\t\t\t_ExtractKey, _EqualKey, _Alloc>\n        const_iterator;\n      typedef _Hashtable_node<_Val> _Node;\n      typedef forward_iterator_tag iterator_category;\n      typedef _Val value_type;\n      typedef ptrdiff_t difference_type;\n      typedef size_t size_type;\n      typedef _Val& reference;\n      typedef _Val* pointer;\n      \n      _Node* _M_cur;\n      _Hashtable* _M_ht;\n\n      _Hashtable_iterator(_Node* __n, _Hashtable* __tab)\n      : _M_cur(__n), _M_ht(__tab) { }\n\n      _Hashtable_iterator() { }\n\n      reference\n      operator*() const\n      { return _M_cur->_M_val; }\n\n      pointer\n      operator->() const\n      { return &(operator*()); }\n\n      iterator&\n      operator++();\n\n      iterator\n      operator++(int);\n\n      bool\n      operator==(const iterator& __it) const\n      { return _M_cur == __it._M_cur; }\n\n      bool\n      operator!=(const iterator& __it) const\n      { return _M_cur != __it._M_cur; }\n    };\n\n  template<class _Val, class _Key, class _HashFcn,\n\t   class _ExtractKey, class _EqualKey, class _Alloc>\n    struct _Hashtable_const_iterator\n    {\n      typedef hashtable<_Val, _Key, _HashFcn, _ExtractKey, _EqualKey, _Alloc>\n        _Hashtable;\n      typedef _Hashtable_iterator<_Val,_Key,_HashFcn,\n\t\t\t\t  _ExtractKey,_EqualKey,_Alloc>\n        iterator;\n      typedef _Hashtable_const_iterator<_Val, _Key, _HashFcn,\n\t\t\t\t\t_ExtractKey, _EqualKey, _Alloc>\n        const_iterator;\n      typedef _Hashtable_node<_Val> _Node;\n\n      typedef forward_iterator_tag iterator_category;\n      typedef _Val value_type;\n      typedef ptrdiff_t difference_type;\n      typedef size_t size_type;\n      typedef const _Val& reference;\n      typedef const _Val* pointer;\n      \n      const _Node* _M_cur;\n      const _Hashtable* _M_ht;\n\n      _Hashtable_const_iterator(const _Node* __n, const _Hashtable* __tab)\n      : _M_cur(__n), _M_ht(__tab) { }\n\n      _Hashtable_const_iterator() { }\n\n      _Hashtable_const_iterator(const iterator& __it)\n      : _M_cur(__it._M_cur), _M_ht(__it._M_ht) { }\n\n      reference\n      operator*() const\n      { return _M_cur->_M_val; }\n\n      pointer\n      operator->() const\n      { return &(operator*()); }\n\n      const_iterator&\n      operator++();\n\n      const_iterator\n      operator++(int);\n\n      bool\n      operator==(const const_iterator& __it) const\n      { return _M_cur == __it._M_cur; }\n\n      bool\n      operator!=(const const_iterator& __it) const\n      { return _M_cur != __it._M_cur; }\n    };\n\n  // Note: assumes long is at least 32 bits.\n  enum { _S_num_primes = 28 };\n\n  static const unsigned long __stl_prime_list[_S_num_primes] =\n    {\n      53ul,         97ul,         193ul,       389ul,       769ul,\n      1543ul,       3079ul,       6151ul,      12289ul,     24593ul,\n      49157ul,      98317ul,      196613ul,    393241ul,    786433ul,\n      1572869ul,    3145739ul,    6291469ul,   12582917ul,  25165843ul,\n      50331653ul,   100663319ul,  201326611ul, 402653189ul, 805306457ul,\n      1610612741ul, 3221225473ul, 4294967291ul\n    };\n\n  inline unsigned long\n  __stl_next_prime(unsigned long __n)\n  {\n    const unsigned long* __first = __stl_prime_list;\n    const unsigned long* __last = __stl_prime_list + (int)_S_num_primes;\n    const unsigned long* pos = std::lower_bound(__first, __last, __n);\n    return pos == __last ? *(__last - 1) : *pos;\n  }\n\n  // Forward declaration of operator==.  \n  template<class _Val, class _Key, class _HF, class _Ex,\n\t   class _Eq, class _All>\n    class hashtable;\n\n  template<class _Val, class _Key, class _HF, class _Ex,\n\t   class _Eq, class _All>\n    bool\n    operator==(const hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>& __ht1,\n\t       const hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>& __ht2);\n\n  // Hashtables handle allocators a bit differently than other\n  // containers do.  If we're using standard-conforming allocators, then\n  // a hashtable unconditionally has a member variable to hold its\n  // allocator, even if it so happens that all instances of the\n  // allocator type are identical.  This is because, for hashtables,\n  // this extra storage is negligible.  Additionally, a base class\n  // wouldn't serve any other purposes; it wouldn't, for example,\n  // simplify the exception-handling code.  \n  template<class _Val, class _Key, class _HashFcn,\n\t   class _ExtractKey, class _EqualKey, class _Alloc>\n    class hashtable\n    {\n    public:\n      typedef _Key key_type;\n      typedef _Val value_type;\n      typedef _HashFcn hasher;\n      typedef _EqualKey key_equal;\n\n      typedef size_t            size_type;\n      typedef ptrdiff_t         difference_type;\n      typedef value_type*       pointer;\n      typedef const value_type* const_pointer;\n      typedef value_type&       reference;\n      typedef const value_type& const_reference;\n\n      hasher\n      hash_funct() const\n      { return _M_hash; }\n\n      key_equal\n      key_eq() const\n      { return _M_equals; }\n\n    private:\n      typedef _Hashtable_node<_Val> _Node;\n\n    public:\n      typedef typename _Alloc::template rebind<value_type>::other allocator_type;\n      allocator_type\n      get_allocator() const\n      { return _M_node_allocator; }\n\n    private:\n      typedef typename _Alloc::template rebind<_Node>::other _Node_Alloc;\n      typedef typename _Alloc::template rebind<_Node*>::other _Nodeptr_Alloc;\n      typedef vector<_Node*, _Nodeptr_Alloc> _Vector_type;\n\n      _Node_Alloc _M_node_allocator;\n\n      _Node*\n      _M_get_node()\n      { return _M_node_allocator.allocate(1); }\n\n      void\n      _M_put_node(_Node* __p)\n      { _M_node_allocator.deallocate(__p, 1); }\n\n    private:\n      hasher                _M_hash;\n      key_equal             _M_equals;\n      _ExtractKey           _M_get_key;\n      _Vector_type          _M_buckets;\n      size_type             _M_num_elements;\n      \n    public:\n      typedef _Hashtable_iterator<_Val, _Key, _HashFcn, _ExtractKey,\n\t\t\t\t  _EqualKey, _Alloc>\n        iterator;\n      typedef _Hashtable_const_iterator<_Val, _Key, _HashFcn, _ExtractKey,\n\t\t\t\t\t_EqualKey, _Alloc>\n        const_iterator;\n\n      friend struct\n      _Hashtable_iterator<_Val, _Key, _HashFcn, _ExtractKey, _EqualKey, _Alloc>;\n\n      friend struct\n      _Hashtable_const_iterator<_Val, _Key, _HashFcn, _ExtractKey,\n\t\t\t\t_EqualKey, _Alloc>;\n\n    public:\n      hashtable(size_type __n, const _HashFcn& __hf,\n\t\tconst _EqualKey& __eql, const _ExtractKey& __ext,\n\t\tconst allocator_type& __a = allocator_type())\n      : _M_node_allocator(__a), _M_hash(__hf), _M_equals(__eql),\n\t_M_get_key(__ext), _M_buckets(__a), _M_num_elements(0)\n      { _M_initialize_buckets(__n); }\n\n      hashtable(size_type __n, const _HashFcn& __hf,\n\t\tconst _EqualKey& __eql,\n\t\tconst allocator_type& __a = allocator_type())\n      : _M_node_allocator(__a), _M_hash(__hf), _M_equals(__eql),\n\t_M_get_key(_ExtractKey()), _M_buckets(__a), _M_num_elements(0)\n      { _M_initialize_buckets(__n); }\n\n      hashtable(const hashtable& __ht)\n      : _M_node_allocator(__ht.get_allocator()), _M_hash(__ht._M_hash),\n      _M_equals(__ht._M_equals), _M_get_key(__ht._M_get_key),\n      _M_buckets(__ht.get_allocator()), _M_num_elements(0)\n      { _M_copy_from(__ht); }\n\n      hashtable&\n      operator= (const hashtable& __ht)\n      {\n\tif (&__ht != this)\n\t  {\n\t    clear();\n\t    _M_hash = __ht._M_hash;\n\t    _M_equals = __ht._M_equals;\n\t    _M_get_key = __ht._M_get_key;\n\t    _M_copy_from(__ht);\n\t  }\n\treturn *this;\n      }\n\n      ~hashtable()\n      { clear(); }\n\n      size_type\n      size() const\n      { return _M_num_elements; }\n\n      size_type\n      max_size() const\n      { return size_type(-1); }\n\n      bool\n      empty() const\n      { return size() == 0; }\n\n      void\n      swap(hashtable& __ht)\n      {\n\tstd::swap(_M_hash, __ht._M_hash);\n\tstd::swap(_M_equals, __ht._M_equals);\n\tstd::swap(_M_get_key, __ht._M_get_key);\n\t_M_buckets.swap(__ht._M_buckets);\n\tstd::swap(_M_num_elements, __ht._M_num_elements);\n      }\n\n      iterator\n      begin()\n      {\n\tfor (size_type __n = 0; __n < _M_buckets.size(); ++__n)\n\t  if (_M_buckets[__n])\n\t    return iterator(_M_buckets[__n], this);\n\treturn end();\n      }\n\n      iterator\n      end()\n      { return iterator(0, this); }\n\n      const_iterator\n      begin() const\n      {\n\tfor (size_type __n = 0; __n < _M_buckets.size(); ++__n)\n\t  if (_M_buckets[__n])\n\t    return const_iterator(_M_buckets[__n], this);\n\treturn end();\n      }\n\n      const_iterator\n      end() const\n      { return const_iterator(0, this); }\n\n      template<class _Vl, class _Ky, class _HF, class _Ex, class _Eq,\n\t\tclass _Al>\n        friend bool\n        operator==(const hashtable<_Vl, _Ky, _HF, _Ex, _Eq, _Al>&,\n\t\t   const hashtable<_Vl, _Ky, _HF, _Ex, _Eq, _Al>&);\n\n    public:\n      size_type\n      bucket_count() const\n      { return _M_buckets.size(); }\n\n      size_type\n      max_bucket_count() const\n      { return __stl_prime_list[(int)_S_num_primes - 1]; }\n\n      size_type\n      elems_in_bucket(size_type __bucket) const\n      {\n\tsize_type __result = 0;\n\tfor (_Node* __n = _M_buckets[__bucket]; __n; __n = __n->_M_next)\n\t  __result += 1;\n\treturn __result;\n      }\n\n      pair<iterator, bool>\n      insert_unique(const value_type& __obj)\n      {\n\tresize(_M_num_elements + 1);\n\treturn insert_unique_noresize(__obj);\n      }\n\n      iterator\n      insert_equal(const value_type& __obj)\n      {\n\tresize(_M_num_elements + 1);\n\treturn insert_equal_noresize(__obj);\n      }\n\n      pair<iterator, bool>\n      insert_unique_noresize(const value_type& __obj);\n\n      iterator\n      insert_equal_noresize(const value_type& __obj);\n\n      template<class _InputIterator>\n        void\n        insert_unique(_InputIterator __f, _InputIterator __l)\n        { insert_unique(__f, __l, __iterator_category(__f)); }\n\n      template<class _InputIterator>\n        void\n        insert_equal(_InputIterator __f, _InputIterator __l)\n        { insert_equal(__f, __l, __iterator_category(__f)); }\n\n      template<class _InputIterator>\n        void\n        insert_unique(_InputIterator __f, _InputIterator __l,\n\t\t      input_iterator_tag)\n        {\n\t  for ( ; __f != __l; ++__f)\n\t    insert_unique(*__f);\n\t}\n\n      template<class _InputIterator>\n        void\n        insert_equal(_InputIterator __f, _InputIterator __l,\n\t\t     input_iterator_tag)\n        {\n\t  for ( ; __f != __l; ++__f)\n\t    insert_equal(*__f);\n\t}\n\n      template<class _ForwardIterator>\n        void\n        insert_unique(_ForwardIterator __f, _ForwardIterator __l,\n\t\t      forward_iterator_tag)\n        {\n\t  size_type __n = distance(__f, __l);\n\t  resize(_M_num_elements + __n);\n\t  for ( ; __n > 0; --__n, ++__f)\n\t    insert_unique_noresize(*__f);\n\t}\n\n      template<class _ForwardIterator>\n        void\n        insert_equal(_ForwardIterator __f, _ForwardIterator __l,\n\t\t     forward_iterator_tag)\n        {\n\t  size_type __n = distance(__f, __l);\n\t  resize(_M_num_elements + __n);\n\t  for ( ; __n > 0; --__n, ++__f)\n\t    insert_equal_noresize(*__f);\n\t}\n\n      reference\n      find_or_insert(const value_type& __obj);\n\n      iterator\n      find(const key_type& __key)\n      {\n\tsize_type __n = _M_bkt_num_key(__key);\n\t_Node* __first;\n\tfor (__first = _M_buckets[__n];\n\t     __first && !_M_equals(_M_get_key(__first->_M_val), __key);\n\t     __first = __first->_M_next)\n\t  { }\n\treturn iterator(__first, this);\n      }\n\n      const_iterator\n      find(const key_type& __key) const\n      {\n\tsize_type __n = _M_bkt_num_key(__key);\n\tconst _Node* __first;\n\tfor (__first = _M_buckets[__n];\n\t     __first && !_M_equals(_M_get_key(__first->_M_val), __key);\n\t     __first = __first->_M_next)\n\t  { }\n\treturn const_iterator(__first, this);\n      }\n\n      size_type\n      count(const key_type& __key) const\n      {\n\tconst size_type __n = _M_bkt_num_key(__key);\n\tsize_type __result = 0;\n\t\n\tfor (const _Node* __cur = _M_buckets[__n]; __cur;\n\t     __cur = __cur->_M_next)\n\t  if (_M_equals(_M_get_key(__cur->_M_val), __key))\n\t    ++__result;\n\treturn __result;\n      }\n\n      pair<iterator, iterator>\n      equal_range(const key_type& __key);\n\n      pair<const_iterator, const_iterator>\n      equal_range(const key_type& __key) const;\n\n      size_type\n      erase(const key_type& __key);\n      \n      void\n      erase(const iterator& __it);\n\n      void\n      erase(iterator __first, iterator __last);\n\n      void\n      erase(const const_iterator& __it);\n\n      void\n      erase(const_iterator __first, const_iterator __last);\n\n      void\n      resize(size_type __num_elements_hint);\n\n      void\n      clear();\n\n    private:\n      size_type\n      _M_next_size(size_type __n) const\n      { return __stl_next_prime(__n); }\n\n      void\n      _M_initialize_buckets(size_type __n)\n      {\n\tconst size_type __n_buckets = _M_next_size(__n);\n\t_M_buckets.reserve(__n_buckets);\n\t_M_buckets.insert(_M_buckets.end(), __n_buckets, (_Node*) 0);\n\t_M_num_elements = 0;\n      }\n\n      size_type\n      _M_bkt_num_key(const key_type& __key) const\n      { return _M_bkt_num_key(__key, _M_buckets.size()); }\n\n      size_type\n      _M_bkt_num(const value_type& __obj) const\n      { return _M_bkt_num_key(_M_get_key(__obj)); }\n\n      size_type\n      _M_bkt_num_key(const key_type& __key, size_t __n) const\n      { return _M_hash(__key) % __n; }\n\n      size_type\n      _M_bkt_num(const value_type& __obj, size_t __n) const\n      { return _M_bkt_num_key(_M_get_key(__obj), __n); }\n\n      _Node*\n      _M_new_node(const value_type& __obj)\n      {\n\t_Node* __n = _M_get_node();\n\t__n->_M_next = 0;\n\ttry\n\t  {\n\t    this->get_allocator().construct(&__n->_M_val, __obj);\n\t    return __n;\n\t  }\n\tcatch(...)\n\t  {\n\t    _M_put_node(__n);\n\t    __throw_exception_again;\n\t  }\n      }\n\n      void\n      _M_delete_node(_Node* __n)\n      {\n\tthis->get_allocator().destroy(&__n->_M_val);\n\t_M_put_node(__n);\n      }\n      \n      void\n      _M_erase_bucket(const size_type __n, _Node* __first, _Node* __last);\n\n      void\n      _M_erase_bucket(const size_type __n, _Node* __last);\n\n      void\n      _M_copy_from(const hashtable& __ht);\n    };\n\n  template<class _Val, class _Key, class _HF, class _ExK, class _EqK,\n\t    class _All>\n    _Hashtable_iterator<_Val, _Key, _HF, _ExK, _EqK, _All>&\n    _Hashtable_iterator<_Val, _Key, _HF, _ExK, _EqK, _All>::\n    operator++()\n    {\n      const _Node* __old = _M_cur;\n      _M_cur = _M_cur->_M_next;\n      if (!_M_cur)\n\t{\n\t  size_type __bucket = _M_ht->_M_bkt_num(__old->_M_val);\n\t  while (!_M_cur && ++__bucket < _M_ht->_M_buckets.size())\n\t    _M_cur = _M_ht->_M_buckets[__bucket];\n\t}\n      return *this;\n    }\n\n  template<class _Val, class _Key, class _HF, class _ExK, class _EqK,\n\t    class _All>\n    inline _Hashtable_iterator<_Val, _Key, _HF, _ExK, _EqK, _All>\n    _Hashtable_iterator<_Val, _Key, _HF, _ExK, _EqK, _All>::\n    operator++(int)\n    {\n      iterator __tmp = *this;\n      ++*this;\n      return __tmp;\n    }\n\n  template<class _Val, class _Key, class _HF, class _ExK, class _EqK,\n\t    class _All>\n    _Hashtable_const_iterator<_Val, _Key, _HF, _ExK, _EqK, _All>&\n    _Hashtable_const_iterator<_Val, _Key, _HF, _ExK, _EqK, _All>::\n    operator++()\n    {\n      const _Node* __old = _M_cur;\n      _M_cur = _M_cur->_M_next;\n      if (!_M_cur)\n\t{\n\t  size_type __bucket = _M_ht->_M_bkt_num(__old->_M_val);\n\t  while (!_M_cur && ++__bucket < _M_ht->_M_buckets.size())\n\t    _M_cur = _M_ht->_M_buckets[__bucket];\n\t}\n      return *this;\n    }\n\n  template<class _Val, class _Key, class _HF, class _ExK, class _EqK,\n\t    class _All>\n    inline _Hashtable_const_iterator<_Val, _Key, _HF, _ExK, _EqK, _All>\n    _Hashtable_const_iterator<_Val, _Key, _HF, _ExK, _EqK, _All>::\n    operator++(int)\n    {\n      const_iterator __tmp = *this;\n      ++*this;\n      return __tmp;\n    }\n\n  template<class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All>\n    bool\n    operator==(const hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>& __ht1,\n\t       const hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>& __ht2)\n    {\n      typedef typename hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>::_Node _Node;\n\n      if (__ht1._M_buckets.size() != __ht2._M_buckets.size())\n\treturn false;\n\n      for (size_t __n = 0; __n < __ht1._M_buckets.size(); ++__n)\n\t{\n\t  _Node* __cur1 = __ht1._M_buckets[__n];\n\t  _Node* __cur2 = __ht2._M_buckets[__n];\n\t  // Check same length of lists\n\t  for (; __cur1 && __cur2;\n\t       __cur1 = __cur1->_M_next, __cur2 = __cur2->_M_next)\n\t    { } \n\t  if (__cur1 || __cur2)\n\t    return false;\n\t  // Now check one's elements are in the other\n\t  for (__cur1 = __ht1._M_buckets[__n] ; __cur1;\n\t       __cur1 = __cur1->_M_next)\n\t    {\n\t      bool _found__cur1 = false;\n\t      for (__cur2 = __ht2._M_buckets[__n];\n\t\t   __cur2; __cur2 = __cur2->_M_next)\n\t\t{\n\t\t  if (__cur1->_M_val == __cur2->_M_val)\n\t\t    {\n\t\t      _found__cur1 = true;\n\t\t      break;\n\t\t    }\n\t\t}\n\t      if (!_found__cur1)\n\t\treturn false;\n\t    }\n\t}\n      return true;\n    }\n\n  template<class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All>\n    inline bool\n    operator!=(const hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>& __ht1,\n\t       const hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>& __ht2)\n    { return !(__ht1 == __ht2); }\n\n  template<class _Val, class _Key, class _HF, class _Extract, class _EqKey,\n\t    class _All>\n    inline void\n    swap(hashtable<_Val, _Key, _HF, _Extract, _EqKey, _All>& __ht1,\n\t hashtable<_Val, _Key, _HF, _Extract, _EqKey, _All>& __ht2)\n    { __ht1.swap(__ht2); }\n\n  template<class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All>\n    pair<typename hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>::iterator, bool>\n    hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>::\n    insert_unique_noresize(const value_type& __obj)\n    {\n      const size_type __n = _M_bkt_num(__obj);\n      _Node* __first = _M_buckets[__n];\n      \n      for (_Node* __cur = __first; __cur; __cur = __cur->_M_next)\n\tif (_M_equals(_M_get_key(__cur->_M_val), _M_get_key(__obj)))\n\t  return pair<iterator, bool>(iterator(__cur, this), false);\n      \n      _Node* __tmp = _M_new_node(__obj);\n      __tmp->_M_next = __first;\n      _M_buckets[__n] = __tmp;\n      ++_M_num_elements;\n      return pair<iterator, bool>(iterator(__tmp, this), true);\n    }\n\n  template<class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All>\n    typename hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>::iterator\n    hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>::\n    insert_equal_noresize(const value_type& __obj)\n    {\n      const size_type __n = _M_bkt_num(__obj);\n      _Node* __first = _M_buckets[__n];\n      \n      for (_Node* __cur = __first; __cur; __cur = __cur->_M_next)\n\tif (_M_equals(_M_get_key(__cur->_M_val), _M_get_key(__obj)))\n\t  {\n\t    _Node* __tmp = _M_new_node(__obj);\n\t    __tmp->_M_next = __cur->_M_next;\n\t    __cur->_M_next = __tmp;\n\t    ++_M_num_elements;\n\t    return iterator(__tmp, this);\n\t  }\n\n      _Node* __tmp = _M_new_node(__obj);\n      __tmp->_M_next = __first;\n      _M_buckets[__n] = __tmp;\n      ++_M_num_elements;\n      return iterator(__tmp, this);\n    }\n\n  template<class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All>\n    typename hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>::reference\n    hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>::\n    find_or_insert(const value_type& __obj)\n    {\n      resize(_M_num_elements + 1);\n\n      size_type __n = _M_bkt_num(__obj);\n      _Node* __first = _M_buckets[__n];\n      \n      for (_Node* __cur = __first; __cur; __cur = __cur->_M_next)\n\tif (_M_equals(_M_get_key(__cur->_M_val), _M_get_key(__obj)))\n\t  return __cur->_M_val;\n      \n      _Node* __tmp = _M_new_node(__obj);\n      __tmp->_M_next = __first;\n      _M_buckets[__n] = __tmp;\n      ++_M_num_elements;\n      return __tmp->_M_val;\n    }\n\n  template<class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All>\n    pair<typename hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>::iterator,\n\t typename hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>::iterator>\n    hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>::\n    equal_range(const key_type& __key)\n    {\n      typedef pair<iterator, iterator> _Pii;\n      const size_type __n = _M_bkt_num_key(__key);\n\n      for (_Node* __first = _M_buckets[__n]; __first;\n\t   __first = __first->_M_next)\n\tif (_M_equals(_M_get_key(__first->_M_val), __key))\n\t  {\n\t    for (_Node* __cur = __first->_M_next; __cur;\n\t\t __cur = __cur->_M_next)\n\t      if (!_M_equals(_M_get_key(__cur->_M_val), __key))\n\t\treturn _Pii(iterator(__first, this), iterator(__cur, this));\n\t    for (size_type __m = __n + 1; __m < _M_buckets.size(); ++__m)\n\t      if (_M_buckets[__m])\n\t\treturn _Pii(iterator(__first, this),\n\t\t\t    iterator(_M_buckets[__m], this));\n\t    return _Pii(iterator(__first, this), end());\n\t  }\n      return _Pii(end(), end());\n    }\n\n  template<class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All>\n    pair<typename hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>::const_iterator,\n\t typename hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>::const_iterator>\n    hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>::\n    equal_range(const key_type& __key) const\n    {\n      typedef pair<const_iterator, const_iterator> _Pii;\n      const size_type __n = _M_bkt_num_key(__key);\n\n      for (const _Node* __first = _M_buckets[__n]; __first;\n\t   __first = __first->_M_next)\n\t{\n\t  if (_M_equals(_M_get_key(__first->_M_val), __key))\n\t    {\n\t      for (const _Node* __cur = __first->_M_next; __cur;\n\t\t   __cur = __cur->_M_next)\n\t\tif (!_M_equals(_M_get_key(__cur->_M_val), __key))\n\t\t  return _Pii(const_iterator(__first, this),\n\t\t\t      const_iterator(__cur, this));\n\t      for (size_type __m = __n + 1; __m < _M_buckets.size(); ++__m)\n\t\tif (_M_buckets[__m])\n\t\t  return _Pii(const_iterator(__first, this),\n\t\t\t      const_iterator(_M_buckets[__m], this));\n\t      return _Pii(const_iterator(__first, this), end());\n\t    }\n\t}\n      return _Pii(end(), end());\n    }\n\n  template<class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All>\n    typename hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>::size_type\n    hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>::\n    erase(const key_type& __key)\n    {\n      const size_type __n = _M_bkt_num_key(__key);\n      _Node* __first = _M_buckets[__n];\n      size_type __erased = 0;\n      \n      if (__first)\n\t{\n\t  _Node* __cur = __first;\n\t  _Node* __next = __cur->_M_next;\n\t  while (__next)\n\t    {\n\t      if (_M_equals(_M_get_key(__next->_M_val), __key))\n\t\t{\n\t\t  __cur->_M_next = __next->_M_next;\n\t\t  _M_delete_node(__next);\n\t\t  __next = __cur->_M_next;\n\t\t  ++__erased;\n\t\t  --_M_num_elements;\n\t\t}\n\t      else\n\t\t{\n\t\t  __cur = __next;\n\t\t  __next = __cur->_M_next;\n\t\t}\n\t    }\n\t  if (_M_equals(_M_get_key(__first->_M_val), __key))\n\t    {\n\t      _M_buckets[__n] = __first->_M_next;\n\t      _M_delete_node(__first);\n\t      ++__erased;\n\t      --_M_num_elements;\n\t    }\n\t}\n      return __erased;\n    }\n\n  template<class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All>\n    void hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>::\n    erase(const iterator& __it)\n    {\n      _Node* __p = __it._M_cur;\n      if (__p)\n\t{\n\t  const size_type __n = _M_bkt_num(__p->_M_val);\n\t  _Node* __cur = _M_buckets[__n];\n\t  \n\t  if (__cur == __p)\n\t    {\n\t      _M_buckets[__n] = __cur->_M_next;\n\t      _M_delete_node(__cur);\n\t      --_M_num_elements;\n\t    }\n\t  else\n\t    {\n\t      _Node* __next = __cur->_M_next;\n\t      while (__next)\n\t\t{\n\t\t  if (__next == __p)\n\t\t    {\n\t\t      __cur->_M_next = __next->_M_next;\n\t\t      _M_delete_node(__next);\n\t\t      --_M_num_elements;\n\t\t      break;\n\t\t    }\n\t\t  else\n\t\t    {\n\t\t      __cur = __next;\n\t\t      __next = __cur->_M_next;\n\t\t    }\n\t\t}\n\t    }\n\t}\n    }\n\n  template<class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All>\n    void\n    hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>::\n    erase(iterator __first, iterator __last)\n    {\n      size_type __f_bucket = __first._M_cur ? _M_bkt_num(__first._M_cur->_M_val)\n\t                                    : _M_buckets.size();\n\n      size_type __l_bucket = __last._M_cur ? _M_bkt_num(__last._M_cur->_M_val)\n\t                                   : _M_buckets.size();\n\n      if (__first._M_cur == __last._M_cur)\n\treturn;\n      else if (__f_bucket == __l_bucket)\n\t_M_erase_bucket(__f_bucket, __first._M_cur, __last._M_cur);\n      else\n\t{\n\t  _M_erase_bucket(__f_bucket, __first._M_cur, 0);\n\t  for (size_type __n = __f_bucket + 1; __n < __l_bucket; ++__n)\n\t    _M_erase_bucket(__n, 0);\n\t  if (__l_bucket != _M_buckets.size())\n\t    _M_erase_bucket(__l_bucket, __last._M_cur);\n\t}\n    }\n\n  template<class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All>\n    inline void\n    hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>::\n    erase(const_iterator __first, const_iterator __last)\n    {\n      erase(iterator(const_cast<_Node*>(__first._M_cur),\n\t\t     const_cast<hashtable*>(__first._M_ht)),\n\t    iterator(const_cast<_Node*>(__last._M_cur),\n\t\t     const_cast<hashtable*>(__last._M_ht)));\n    }\n\n  template<class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All>\n    inline void\n    hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>::\n    erase(const const_iterator& __it)\n    { erase(iterator(const_cast<_Node*>(__it._M_cur),\n\t\t     const_cast<hashtable*>(__it._M_ht))); }\n\n  template<class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All>\n    void\n    hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>::\n    resize(size_type __num_elements_hint)\n    {\n      const size_type __old_n = _M_buckets.size();\n      if (__num_elements_hint > __old_n)\n\t{\n\t  const size_type __n = _M_next_size(__num_elements_hint);\n\t  if (__n > __old_n)\n\t    {\n\t      _Vector_type __tmp(__n, (_Node*)(0), _M_buckets.get_allocator());\n\t      try\n\t\t{\n\t\t  for (size_type __bucket = 0; __bucket < __old_n; ++__bucket)\n\t\t    {\n\t\t      _Node* __first = _M_buckets[__bucket];\n\t\t      while (__first)\n\t\t\t{\n\t\t\t  size_type __new_bucket = _M_bkt_num(__first->_M_val,\n\t\t\t\t\t\t\t      __n);\n\t\t\t  _M_buckets[__bucket] = __first->_M_next;\n\t\t\t  __first->_M_next = __tmp[__new_bucket];\n\t\t\t  __tmp[__new_bucket] = __first;\n\t\t\t  __first = _M_buckets[__bucket];\n\t\t\t}\n\t\t    }\n\t\t  _M_buckets.swap(__tmp);\n\t\t}\n\t      catch(...)\n\t\t{\n\t\t  for (size_type __bucket = 0; __bucket < __tmp.size();\n\t\t       ++__bucket)\n\t\t    {\n\t\t      while (__tmp[__bucket])\n\t\t\t{\n\t\t\t  _Node* __next = __tmp[__bucket]->_M_next;\n\t\t\t  _M_delete_node(__tmp[__bucket]);\n\t\t\t  __tmp[__bucket] = __next;\n\t\t\t}\n\t\t    }\n\t\t  __throw_exception_again;\n\t\t}\n\t    }\n\t}\n    }\n\n  template<class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All>\n    void\n    hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>::\n    _M_erase_bucket(const size_type __n, _Node* __first, _Node* __last)\n    {\n      _Node* __cur = _M_buckets[__n];\n      if (__cur == __first)\n\t_M_erase_bucket(__n, __last);\n      else\n\t{\n\t  _Node* __next;\n\t  for (__next = __cur->_M_next;\n\t       __next != __first;\n\t       __cur = __next, __next = __cur->_M_next)\n\t    ;\n\t  while (__next != __last)\n\t    {\n\t      __cur->_M_next = __next->_M_next;\n\t      _M_delete_node(__next);\n\t      __next = __cur->_M_next;\n\t      --_M_num_elements;\n\t    }\n\t}\n    }\n\n  template<class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All>\n    void\n    hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>::\n    _M_erase_bucket(const size_type __n, _Node* __last)\n    {\n      _Node* __cur = _M_buckets[__n];\n      while (__cur != __last)\n\t{\n\t  _Node* __next = __cur->_M_next;\n\t  _M_delete_node(__cur);\n\t  __cur = __next;\n\t  _M_buckets[__n] = __cur;\n\t  --_M_num_elements;\n\t}\n    }\n\n  template<class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All>\n    void\n    hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>::\n    clear()\n    {\n      for (size_type __i = 0; __i < _M_buckets.size(); ++__i)\n\t{\n\t  _Node* __cur = _M_buckets[__i];\n\t  while (__cur != 0)\n\t    {\n\t      _Node* __next = __cur->_M_next;\n\t      _M_delete_node(__cur);\n\t      __cur = __next;\n\t    }\n\t  _M_buckets[__i] = 0;\n\t}\n      _M_num_elements = 0;\n    }\n\n  template<class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All>\n    void\n    hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>::\n    _M_copy_from(const hashtable& __ht)\n    {\n      _M_buckets.clear();\n      _M_buckets.reserve(__ht._M_buckets.size());\n      _M_buckets.insert(_M_buckets.end(), __ht._M_buckets.size(), (_Node*) 0);\n      try\n\t{\n\t  for (size_type __i = 0; __i < __ht._M_buckets.size(); ++__i) {\n\t    const _Node* __cur = __ht._M_buckets[__i];\n\t    if (__cur)\n\t      {\n\t\t_Node* __local_copy = _M_new_node(__cur->_M_val);\n\t\t_M_buckets[__i] = __local_copy;\n\t\t\n\t\tfor (_Node* __next = __cur->_M_next;\n\t\t     __next;\n\t\t     __cur = __next, __next = __cur->_M_next)\n\t\t  {\n\t\t    __local_copy->_M_next = _M_new_node(__next->_M_val);\n\t\t    __local_copy = __local_copy->_M_next;\n\t\t  }\n\t      }\n\t  }\n\t  _M_num_elements = __ht._M_num_elements;\n\t}\n      catch(...)\n\t{\n\t  clear();\n\t  __throw_exception_again;\n\t}\n    }\n\n_GLIBCXX_END_NAMESPACE\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/iterator",
    "content": "// HP/SGI iterator extensions -*- C++ -*-\n\n// Copyright (C) 2001, 2002, 2004, 2005 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n/*\n *\n * Copyright (c) 1994\n * Hewlett-Packard Company\n *\n * Permission to use, copy, modify, distribute and sell this software\n * and its documentation for any purpose is hereby granted without fee,\n * provided that the above copyright notice appear in all copies and\n * that both that copyright notice and this permission notice appear\n * in supporting documentation.  Hewlett-Packard Company makes no\n * representations about the suitability of this software for any\n * purpose.  It is provided \"as is\" without express or implied warranty.\n *\n *\n * Copyright (c) 1996-1998\n * Silicon Graphics Computer Systems, Inc.\n *\n * Permission to use, copy, modify, distribute and sell this software\n * and its documentation for any purpose is hereby granted without fee,\n * provided that the above copyright notice appear in all copies and\n * that both that copyright notice and this permission notice appear\n * in supporting documentation.  Silicon Graphics makes no\n * representations about the suitability of this software for any\n * purpose.  It is provided \"as is\" without express or implied warranty.\n */\n\n/** @file ext/iterator\n *  This file is a GNU extension to the Standard C++ Library (possibly\n *  containing extensions from the HP/SGI STL subset).\n */\n\n#ifndef _EXT_ITERATOR\n#define _EXT_ITERATOR 1\n\n#pragma GCC system_header\n\n#include <bits/concept_check.h>\n#include <iterator>\n\n_GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)\n\n  // There are two signatures for distance.  In addition to the one\n  // taking two iterators and returning a result, there is another\n  // taking two iterators and a reference-to-result variable, and\n  // returning nothing.  The latter seems to be an SGI extension.\n  // -- pedwards\n  template<typename _InputIterator, typename _Distance>\n    inline void\n    __distance(_InputIterator __first, _InputIterator __last,\n\t       _Distance& __n, std::input_iterator_tag)\n    {\n      // concept requirements\n      __glibcxx_function_requires(_InputIteratorConcept<_InputIterator>)\n      while (__first != __last)\n\t{\n\t  ++__first;\n\t  ++__n;\n\t}\n    }\n\n  template<typename _RandomAccessIterator, typename _Distance>\n    inline void\n    __distance(_RandomAccessIterator __first, _RandomAccessIterator __last,\n\t       _Distance& __n, std::random_access_iterator_tag)\n    {\n      // concept requirements\n      __glibcxx_function_requires(_RandomAccessIteratorConcept<\n\t\t\t\t  _RandomAccessIterator>)\n      __n += __last - __first;\n    }\n\n  /**\n   *  This is an SGI extension.\n   *  @ingroup SGIextensions\n   *  @doctodo\n  */\n  template<typename _InputIterator, typename _Distance>\n    inline void\n    distance(_InputIterator __first, _InputIterator __last,\n             _Distance& __n)\n    {\n      // concept requirements -- taken care of in __distance\n      __distance(__first, __last, __n, std::__iterator_category(__first));\n    }\n\n_GLIBCXX_END_NAMESPACE\n\n#endif\n\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/malloc_allocator.h",
    "content": "// Allocator that wraps \"C\" malloc -*- C++ -*-\n\n// Copyright (C) 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n/** @file ext/malloc_allocator.h\n *  This file is a GNU extension to the Standard C++ Library.\n */\n\n#ifndef _MALLOC_ALLOCATOR_H\n#define _MALLOC_ALLOCATOR_H 1\n\n#include <cstdlib>\n#include <new>\n#include <bits/functexcept.h>\n\n_GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)\n\n  using std::size_t;\n  using std::ptrdiff_t;\n\n  /**\n   *  @brief  An allocator that uses malloc.\n   *\n   *  This is precisely the allocator defined in the C++ Standard. \n   *    - all allocation calls malloc\n   *    - all deallocation calls free\n   */\n  template<typename _Tp>\n    class malloc_allocator\n    {\n    public:\n      typedef size_t     size_type;\n      typedef ptrdiff_t  difference_type;\n      typedef _Tp*       pointer;\n      typedef const _Tp* const_pointer;\n      typedef _Tp&       reference;\n      typedef const _Tp& const_reference;\n      typedef _Tp        value_type;\n\n      template<typename _Tp1>\n        struct rebind\n        { typedef malloc_allocator<_Tp1> other; };\n\n      malloc_allocator() throw() { }\n\n      malloc_allocator(const malloc_allocator&) throw() { }\n\n      template<typename _Tp1>\n        malloc_allocator(const malloc_allocator<_Tp1>&) throw() { }\n\n      ~malloc_allocator() throw() { }\n\n      pointer\n      address(reference __x) const { return &__x; }\n\n      const_pointer\n      address(const_reference __x) const { return &__x; }\n\n      // NB: __n is permitted to be 0.  The C++ standard says nothing\n      // about what the return value is when __n == 0.\n      pointer\n      allocate(size_type __n, const void* = 0)\n      {\n\tif (__builtin_expect(__n > this->max_size(), false))\n\t  std::__throw_bad_alloc();\n\n\tpointer __ret = static_cast<_Tp*>(malloc(__n * sizeof(_Tp)));\n\tif (!__ret)\n\t  std::__throw_bad_alloc();\n\treturn __ret;\n      }\n\n      // __p is not permitted to be a null pointer.\n      void\n      deallocate(pointer __p, size_type)\n      { free(static_cast<void*>(__p)); }\n\n      size_type\n      max_size() const throw() \n      { return size_t(-1) / sizeof(_Tp); }\n\n      // _GLIBCXX_RESOLVE_LIB_DEFECTS\n      // 402. wrong new expression in [some_] allocator::construct\n      void \n      construct(pointer __p, const _Tp& __val) \n      { ::new(__p) value_type(__val); }\n\n      void \n      destroy(pointer __p) { __p->~_Tp(); }\n    };\n\n  template<typename _Tp>\n    inline bool\n    operator==(const malloc_allocator<_Tp>&, const malloc_allocator<_Tp>&)\n    { return true; }\n  \n  template<typename _Tp>\n    inline bool\n    operator!=(const malloc_allocator<_Tp>&, const malloc_allocator<_Tp>&)\n    { return false; }\n\n_GLIBCXX_END_NAMESPACE\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/memory",
    "content": "// Memory extensions -*- C++ -*-\n\n// Copyright (C) 2002, 2004, 2005 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n/*\n *\n * Copyright (c) 1994\n * Hewlett-Packard Company\n *\n * Permission to use, copy, modify, distribute and sell this software\n * and its documentation for any purpose is hereby granted without fee,\n * provided that the above copyright notice appear in all copies and\n * that both that copyright notice and this permission notice appear\n * in supporting documentation.  Hewlett-Packard Company makes no\n * representations about the suitability of this software for any\n * purpose.  It is provided \"as is\" without express or implied warranty.\n *\n *\n * Copyright (c) 1996\n * Silicon Graphics Computer Systems, Inc.\n *\n * Permission to use, copy, modify, distribute and sell this software\n * and its documentation for any purpose is hereby granted without fee,\n * provided that the above copyright notice appear in all copies and\n * that both that copyright notice and this permission notice appear\n * in supporting documentation.  Silicon Graphics makes no\n * representations about the suitability of this software for any\n * purpose.  It is provided \"as is\" without express or implied warranty.\n */\n\n/** @file ext/memory\n *  This file is a GNU extension to the Standard C++ Library (possibly\n *  containing extensions from the HP/SGI STL subset).\n */\n\n#ifndef _EXT_MEMORY\n#define _EXT_MEMORY 1\n\n#pragma GCC system_header\n\n#include <memory>\n#include <bits/stl_tempbuf.h>\n\n_GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)\n\n  using std::ptrdiff_t;\n  using std::pair;\n  using std::__iterator_category;\n  using std::_Temporary_buffer;\n\n  template<typename _InputIter, typename _Size, typename _ForwardIter>\n    pair<_InputIter, _ForwardIter>\n    __uninitialized_copy_n(_InputIter __first, _Size __count,\n\t\t\t   _ForwardIter __result, std::input_iterator_tag)\n    {\n      _ForwardIter __cur = __result;\n      try\n\t{\n\t  for (; __count > 0 ; --__count, ++__first, ++__cur)\n\t    std::_Construct(&*__cur, *__first);\n\t  return pair<_InputIter, _ForwardIter>(__first, __cur);\n\t}\n      catch(...)\n\t{\n\t  std::_Destroy(__result, __cur);\n\t  __throw_exception_again;\n\t}\n    }\n\n  template<typename _RandomAccessIter, typename _Size, typename _ForwardIter>\n    inline pair<_RandomAccessIter, _ForwardIter>\n    __uninitialized_copy_n(_RandomAccessIter __first, _Size __count,\n\t\t\t   _ForwardIter __result,\n\t\t\t   std::random_access_iterator_tag)\n    {\n      _RandomAccessIter __last = __first + __count;\n      return (pair<_RandomAccessIter, _ForwardIter>\n\t      (__last, std::uninitialized_copy(__first, __last, __result)));\n    }\n\n  template<typename _InputIter, typename _Size, typename _ForwardIter>\n    inline pair<_InputIter, _ForwardIter>\n    __uninitialized_copy_n(_InputIter __first, _Size __count,\n\t\t\t _ForwardIter __result)\n    { return __uninitialized_copy_n(__first, __count, __result,\n\t\t\t\t    __iterator_category(__first)); }\n\n  /**\n   *  @brief Copies the range [first,last) into result.\n   *  @param  first  An input iterator.\n   *  @param  last   An input iterator.\n   *  @param  result An output iterator.\n   *  @return   result + (first - last)\n   *  @ingroup SGIextensions\n   *\n   *  Like copy(), but does not require an initialized output range.\n  */\n  template<typename _InputIter, typename _Size, typename _ForwardIter>\n    inline pair<_InputIter, _ForwardIter>\n    uninitialized_copy_n(_InputIter __first, _Size __count,\n\t\t\t _ForwardIter __result)\n    { return __uninitialized_copy_n(__first, __count, __result,\n\t\t\t\t    __iterator_category(__first)); }\n\n\n  // An alternative version of uninitialized_copy_n that constructs\n  // and destroys objects with a user-provided allocator.\n  template<typename _InputIter, typename _Size, typename _ForwardIter,\n           typename _Allocator>\n    pair<_InputIter, _ForwardIter>\n    __uninitialized_copy_n_a(_InputIter __first, _Size __count,\n\t\t\t     _ForwardIter __result,\n\t\t\t     _Allocator __alloc)\n    {\n      _ForwardIter __cur = __result;\n      try\n\t{\n\t  for (; __count > 0 ; --__count, ++__first, ++__cur)\n\t    __alloc.construct(&*__cur, *__first);\n\t  return pair<_InputIter, _ForwardIter>(__first, __cur);\n\t}\n      catch(...)\n\t{\n\t  std::_Destroy(__result, __cur, __alloc);\n\t  __throw_exception_again;\n\t}\n    }\n\n  template<typename _InputIter, typename _Size, typename _ForwardIter,\n           typename _Tp>\n    inline pair<_InputIter, _ForwardIter>\n    __uninitialized_copy_n_a(_InputIter __first, _Size __count,\n\t\t\t     _ForwardIter __result,\n\t\t\t     std::allocator<_Tp>)\n    {\n      return uninitialized_copy_n(__first, __count, __result);\n    }\n\n  /**\n   *  This class provides similar behavior and semantics of the standard\n   *  functions get_temporary_buffer() and return_temporary_buffer(), but\n   *  encapsulated in a type vaguely resembling a standard container.\n   *\n   *  By default, a temporary_buffer<Iter> stores space for objects of\n   *  whatever type the Iter iterator points to.  It is constructed from a\n   *  typical [first,last) range, and provides the begin(), end(), size()\n   *  functions, as well as requested_size().  For non-trivial types, copies\n   *  of *first will be used to initialize the storage.\n   *\n   *  @c malloc is used to obtain underlying storage.\n   *\n   *  Like get_temporary_buffer(), not all the requested memory may be\n   *  available.  Ideally, the created buffer will be large enough to hold a\n   *  copy of [first,last), but if size() is less than requested_size(),\n   *  then this didn't happen.\n   *\n   *  @ingroup SGIextensions\n  */\n  template <class _ForwardIterator, class _Tp\n\t    = typename std::iterator_traits<_ForwardIterator>::value_type >\n    struct temporary_buffer : public _Temporary_buffer<_ForwardIterator, _Tp>\n    {\n      /// Requests storage large enough to hold a copy of [first,last).\n      temporary_buffer(_ForwardIterator __first, _ForwardIterator __last)\n      : _Temporary_buffer<_ForwardIterator, _Tp>(__first, __last) { }\n      \n      /// Destroys objects and frees storage.\n      ~temporary_buffer() { }\n    };\n\n_GLIBCXX_END_NAMESPACE\n\n#endif\n\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/mt_allocator.h",
    "content": "// MT-optimized allocator -*- C++ -*-\n\n// Copyright (C) 2003, 2004, 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n/** @file ext/mt_allocator.h\n *  This file is a GNU extension to the Standard C++ Library.\n */\n\n#ifndef _MT_ALLOCATOR_H\n#define _MT_ALLOCATOR_H 1\n\n#include <new>\n#include <cstdlib>\n#include <bits/functexcept.h>\n#include <ext/atomicity.h>\n\n_GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)\n\n  using std::size_t;\n  using std::ptrdiff_t;\n\n  typedef void (*__destroy_handler)(void*);\n\n  /// @brief  Base class for pool object.\n  struct __pool_base\n  {\n    // Using short int as type for the binmap implies we are never\n    // caching blocks larger than 32768 with this allocator.\n    typedef unsigned short int _Binmap_type;\n\n    // Variables used to configure the behavior of the allocator,\n    // assigned and explained in detail below.\n    struct _Tune\n     {\n      // Compile time constants for the default _Tune values.\n      enum { _S_align = 8 };\n      enum { _S_max_bytes = 128 };\n      enum { _S_min_bin = 8 };\n      enum { _S_chunk_size = 4096 - 4 * sizeof(void*) };\n      enum { _S_max_threads = 4096 };\n      enum { _S_freelist_headroom = 10 };\n\n      // Alignment needed.\n      // NB: In any case must be >= sizeof(_Block_record), that\n      // is 4 on 32 bit machines and 8 on 64 bit machines.\n      size_t\t_M_align;\n      \n      // Allocation requests (after round-up to power of 2) below\n      // this value will be handled by the allocator. A raw new/\n      // call will be used for requests larger than this value.\n      // NB: Must be much smaller than _M_chunk_size and in any\n      // case <= 32768.\n      size_t\t_M_max_bytes; \n\n      // Size in bytes of the smallest bin.\n      // NB: Must be a power of 2 and >= _M_align (and of course\n      // much smaller than _M_max_bytes).\n      size_t\t_M_min_bin;\n\n      // In order to avoid fragmenting and minimize the number of\n      // new() calls we always request new memory using this\n      // value. Based on previous discussions on the libstdc++\n      // mailing list we have choosen the value below.\n      // See http://gcc.gnu.org/ml/libstdc++/2001-07/msg00077.html\n      // NB: At least one order of magnitude > _M_max_bytes. \n      size_t\t_M_chunk_size;\n\n      // The maximum number of supported threads. For\n      // single-threaded operation, use one. Maximum values will\n      // vary depending on details of the underlying system. (For\n      // instance, Linux 2.4.18 reports 4070 in\n      // /proc/sys/kernel/threads-max, while Linux 2.6.6 reports\n      // 65534)\n      size_t \t_M_max_threads;\n\n      // Each time a deallocation occurs in a threaded application\n      // we make sure that there are no more than\n      // _M_freelist_headroom % of used memory on the freelist. If\n      // the number of additional records is more than\n      // _M_freelist_headroom % of the freelist, we move these\n      // records back to the global pool.\n      size_t \t_M_freelist_headroom;\n      \n      // Set to true forces all allocations to use new().\n      bool \t_M_force_new; \n      \n      explicit\n      _Tune()\n      : _M_align(_S_align), _M_max_bytes(_S_max_bytes), _M_min_bin(_S_min_bin),\n      _M_chunk_size(_S_chunk_size), _M_max_threads(_S_max_threads), \n      _M_freelist_headroom(_S_freelist_headroom), \n      _M_force_new(std::getenv(\"GLIBCXX_FORCE_NEW\") ? true : false)\n      { }\n\n      explicit\n      _Tune(size_t __align, size_t __maxb, size_t __minbin, size_t __chunk, \n\t    size_t __maxthreads, size_t __headroom, bool __force) \n      : _M_align(__align), _M_max_bytes(__maxb), _M_min_bin(__minbin),\n      _M_chunk_size(__chunk), _M_max_threads(__maxthreads),\n      _M_freelist_headroom(__headroom), _M_force_new(__force)\n      { }\n    };\n    \n    struct _Block_address\n    {\n      void* \t\t\t_M_initial;\n      _Block_address* \t\t_M_next;\n    };\n    \n    const _Tune&\n    _M_get_options() const\n    { return _M_options; }\n\n    void\n    _M_set_options(_Tune __t)\n    { \n      if (!_M_init)\n\t_M_options = __t;\n    }\n\n    bool\n    _M_check_threshold(size_t __bytes)\n    { return __bytes > _M_options._M_max_bytes || _M_options._M_force_new; }\n\n    size_t\n    _M_get_binmap(size_t __bytes)\n    { return _M_binmap[__bytes]; }\n\n    const size_t\n    _M_get_align()\n    { return _M_options._M_align; }\n\n    explicit \n    __pool_base() \n    : _M_options(_Tune()), _M_binmap(NULL), _M_init(false) { }\n\n    explicit \n    __pool_base(const _Tune& __options)\n    : _M_options(__options), _M_binmap(NULL), _M_init(false) { }\n\n  private:\n    explicit \n    __pool_base(const __pool_base&);\n\n    __pool_base&\n    operator=(const __pool_base&);\n\n  protected:\n    // Configuration options.\n    _Tune \t       \t\t_M_options;\n    \n    _Binmap_type* \t\t_M_binmap;\n\n    // Configuration of the pool object via _M_options can happen\n    // after construction but before initialization. After\n    // initialization is complete, this variable is set to true.\n    bool \t\t\t_M_init;\n  };\n\n\n  /**\n   *  @brief  Data describing the underlying memory pool, parameterized on\n   *  threading support.\n   */\n  template<bool _Thread>\n    class __pool;\n\n  /// Specialization for single thread.\n  template<>\n    class __pool<false> : public __pool_base\n    {\n    public:\n      union _Block_record\n      {\n\t// Points to the block_record of the next free block.\n\t_Block_record* \t\t\t_M_next;\n      };\n\n      struct _Bin_record\n      {\n\t// An \"array\" of pointers to the first free block.\n\t_Block_record**\t\t\t_M_first;\n\n\t// A list of the initial addresses of all allocated blocks.\n\t_Block_address*\t\t     \t_M_address;\n      };\n      \n      void\n      _M_initialize_once()\n      {\n\tif (__builtin_expect(_M_init == false, false))\n\t  _M_initialize();\n      }\n\n      void\n      _M_destroy() throw();\n\n      char* \n      _M_reserve_block(size_t __bytes, const size_t __thread_id);\n    \n      void\n      _M_reclaim_block(char* __p, size_t __bytes);\n    \n      size_t \n      _M_get_thread_id() { return 0; }\n      \n      const _Bin_record&\n      _M_get_bin(size_t __which)\n      { return _M_bin[__which]; }\n      \n      void\n      _M_adjust_freelist(const _Bin_record&, _Block_record*, size_t)\n      { }\n\n      explicit __pool() \n      : _M_bin(NULL), _M_bin_size(1) { }\n\n      explicit __pool(const __pool_base::_Tune& __tune) \n      : __pool_base(__tune), _M_bin(NULL), _M_bin_size(1) { }\n\n    private:\n      // An \"array\" of bin_records each of which represents a specific\n      // power of 2 size. Memory to this \"array\" is allocated in\n      // _M_initialize().\n      _Bin_record*\t\t _M_bin;\n      \n      // Actual value calculated in _M_initialize().\n      size_t \t       \t     \t_M_bin_size;     \n\n      void\n      _M_initialize();\n  };\n \n#ifdef __GTHREADS\n  /// Specialization for thread enabled, via gthreads.h.\n  template<>\n    class __pool<true> : public __pool_base\n    {\n    public:\n      // Each requesting thread is assigned an id ranging from 1 to\n      // _S_max_threads. Thread id 0 is used as a global memory pool.\n      // In order to get constant performance on the thread assignment\n      // routine, we keep a list of free ids. When a thread first\n      // requests memory we remove the first record in this list and\n      // stores the address in a __gthread_key. When initializing the\n      // __gthread_key we specify a destructor. When this destructor\n      // (i.e. the thread dies) is called, we return the thread id to\n      // the front of this list.\n      struct _Thread_record\n      {\n\t// Points to next free thread id record. NULL if last record in list.\n\t_Thread_record*\t\t\t_M_next;\n\t\n\t// Thread id ranging from 1 to _S_max_threads.\n\tsize_t                          _M_id;\n      };\n      \n      union _Block_record\n      {\n\t// Points to the block_record of the next free block.\n\t_Block_record*\t\t\t_M_next;\n\t\n\t// The thread id of the thread which has requested this block.\n\tsize_t                          _M_thread_id;\n      };\n      \n      struct _Bin_record\n      {\n\t// An \"array\" of pointers to the first free block for each\n\t// thread id. Memory to this \"array\" is allocated in\n\t// _S_initialize() for _S_max_threads + global pool 0.\n\t_Block_record**\t\t\t_M_first;\n\t\n\t// A list of the initial addresses of all allocated blocks.\n\t_Block_address*\t\t     \t_M_address;\n\n\t// An \"array\" of counters used to keep track of the amount of\n\t// blocks that are on the freelist/used for each thread id.\n\t// - Note that the second part of the allocated _M_used \"array\"\n\t//   actually hosts (atomic) counters of reclaimed blocks:  in\n\t//   _M_reserve_block and in _M_reclaim_block those numbers are\n\t//   subtracted from the first ones to obtain the actual size\n\t//   of the \"working set\" of the given thread.\n\t// - Memory to these \"arrays\" is allocated in _S_initialize()\n\t//   for _S_max_threads + global pool 0.\n\tsize_t*\t\t\t\t_M_free;\n\tsize_t*\t\t\t        _M_used;\n\t\n\t// Each bin has its own mutex which is used to ensure data\n\t// integrity while changing \"ownership\" on a block.  The mutex\n\t// is initialized in _S_initialize().\n\t__gthread_mutex_t*              _M_mutex;\n      };\n      \n      // XXX GLIBCXX_ABI Deprecated\n      void\n      _M_initialize(__destroy_handler);\n\n      void\n      _M_initialize_once()\n      {\n\tif (__builtin_expect(_M_init == false, false))\n\t  _M_initialize();\n      }\n\n      void\n      _M_destroy() throw();\n\n      char* \n      _M_reserve_block(size_t __bytes, const size_t __thread_id);\n    \n      void\n      _M_reclaim_block(char* __p, size_t __bytes);\n    \n      const _Bin_record&\n      _M_get_bin(size_t __which)\n      { return _M_bin[__which]; }\n      \n      void\n      _M_adjust_freelist(const _Bin_record& __bin, _Block_record* __block, \n\t\t\t size_t __thread_id)\n      {\n\tif (__gthread_active_p())\n\t  {\n\t    __block->_M_thread_id = __thread_id;\n\t    --__bin._M_free[__thread_id];\n\t    ++__bin._M_used[__thread_id];\n\t  }\n      }\n\n      // XXX GLIBCXX_ABI Deprecated\n      void \n      _M_destroy_thread_key(void*);\n\n      size_t \n      _M_get_thread_id();\n\n      explicit __pool() \n      : _M_bin(NULL), _M_bin_size(1), _M_thread_freelist(NULL) \n      { }\n\n      explicit __pool(const __pool_base::_Tune& __tune) \n      : __pool_base(__tune), _M_bin(NULL), _M_bin_size(1), \n      _M_thread_freelist(NULL) \n      { }\n\n    private:\n      // An \"array\" of bin_records each of which represents a specific\n      // power of 2 size. Memory to this \"array\" is allocated in\n      // _M_initialize().\n      _Bin_record*\t\t_M_bin;\n\n      // Actual value calculated in _M_initialize().\n      size_t \t       \t     \t_M_bin_size;\n\n      _Thread_record* \t\t_M_thread_freelist;\n      void*\t\t\t_M_thread_freelist_initial;\n\n      void\n      _M_initialize();\n    };\n#endif\n\n  template<template <bool> class _PoolTp, bool _Thread>\n    struct __common_pool\n    {\n      typedef _PoolTp<_Thread> \t\tpool_type;\n      \n      static pool_type&\n      _S_get_pool()\n      { \n\tstatic pool_type _S_pool;\n\treturn _S_pool;\n      }\n    };\n\n  template<template <bool> class _PoolTp, bool _Thread>\n    struct __common_pool_base;\n\n  template<template <bool> class _PoolTp>\n    struct __common_pool_base<_PoolTp, false> \n    : public __common_pool<_PoolTp, false>\n    {\n      using  __common_pool<_PoolTp, false>::_S_get_pool;\n\n      static void\n      _S_initialize_once()\n      {\n\tstatic bool __init;\n\tif (__builtin_expect(__init == false, false))\n\t  {\n\t    _S_get_pool()._M_initialize_once(); \n\t    __init = true;\n\t  }\n      }\n    };\n\n#ifdef __GTHREADS\n  template<template <bool> class _PoolTp>\n    struct __common_pool_base<_PoolTp, true>\n    : public __common_pool<_PoolTp, true>\n    {\n      using  __common_pool<_PoolTp, true>::_S_get_pool;\n      \n      static void\n      _S_initialize() \n      { _S_get_pool()._M_initialize_once(); }\n\n      static void\n      _S_initialize_once()\n      { \n\tstatic bool __init;\n\tif (__builtin_expect(__init == false, false))\n\t  {\n\t    if (__gthread_active_p())\n\t      {\n\t\t// On some platforms, __gthread_once_t is an aggregate.\n\t\tstatic __gthread_once_t __once = __GTHREAD_ONCE_INIT;\n\t\t__gthread_once(&__once, _S_initialize);\n\t      }\n\n\t    // Double check initialization. May be necessary on some\n\t    // systems for proper construction when not compiling with\n\t    // thread flags.\n\t    _S_get_pool()._M_initialize_once(); \n\t    __init = true;\n\t  }\n      }\n    };\n#endif\n\n  /// @brief  Policy for shared __pool objects.\n  template<template <bool> class _PoolTp, bool _Thread>\n    struct __common_pool_policy : public __common_pool_base<_PoolTp, _Thread>\n    {\n      template<typename _Tp1, template <bool> class _PoolTp1 = _PoolTp, \n\t       bool _Thread1 = _Thread>\n        struct _M_rebind\n        { typedef __common_pool_policy<_PoolTp1, _Thread1> other; };\n\n      using  __common_pool_base<_PoolTp, _Thread>::_S_get_pool;\n      using  __common_pool_base<_PoolTp, _Thread>::_S_initialize_once;\n  };\n \n\n  template<typename _Tp, template <bool> class _PoolTp, bool _Thread>\n    struct __per_type_pool\n    {\n      typedef _Tp \t\t\tvalue_type;\n      typedef _PoolTp<_Thread> \t\tpool_type;\n      \n      static pool_type&\n      _S_get_pool()\n      { \n\t// Sane defaults for the _PoolTp.\n\ttypedef typename pool_type::_Block_record _Block_record;\n\tconst static size_t __a = (__alignof__(_Tp) >= sizeof(_Block_record)\n\t\t\t\t   ? __alignof__(_Tp) : sizeof(_Block_record));\n\n\ttypedef typename __pool_base::_Tune _Tune;\n\tstatic _Tune _S_tune(__a, sizeof(_Tp) * 64,\n\t\t\t     sizeof(_Tp) * 2 >= __a ? sizeof(_Tp) * 2 : __a,\n\t\t\t     sizeof(_Tp) * size_t(_Tune::_S_chunk_size),\n\t\t\t     _Tune::_S_max_threads,\n\t\t\t     _Tune::_S_freelist_headroom,\n\t\t\t     std::getenv(\"GLIBCXX_FORCE_NEW\") ? true : false);\n\tstatic pool_type _S_pool(_S_tune);\n\treturn _S_pool;\n      }\n    };\n\n  template<typename _Tp, template <bool> class _PoolTp, bool _Thread>\n    struct __per_type_pool_base;\n\n  template<typename _Tp, template <bool> class _PoolTp>\n    struct __per_type_pool_base<_Tp, _PoolTp, false> \n    : public __per_type_pool<_Tp, _PoolTp, false> \n    {\n      using  __per_type_pool<_Tp, _PoolTp, false>::_S_get_pool;\n\n      static void\n      _S_initialize_once()\n      {\n\tstatic bool __init;\n\tif (__builtin_expect(__init == false, false))\n\t  {\n\t    _S_get_pool()._M_initialize_once(); \n\t    __init = true;\n\t  }\n      }\n    };\n\n #ifdef __GTHREADS\n template<typename _Tp, template <bool> class _PoolTp>\n    struct __per_type_pool_base<_Tp, _PoolTp, true> \n    : public __per_type_pool<_Tp, _PoolTp, true> \n    {\n      using  __per_type_pool<_Tp, _PoolTp, true>::_S_get_pool;\n\n      static void\n      _S_initialize() \n      { _S_get_pool()._M_initialize_once(); }\n\n      static void\n      _S_initialize_once()\n      { \n\tstatic bool __init;\n\tif (__builtin_expect(__init == false, false))\n\t  {\n\t    if (__gthread_active_p())\n\t      {\n\t\t// On some platforms, __gthread_once_t is an aggregate.\n\t\tstatic __gthread_once_t __once = __GTHREAD_ONCE_INIT;\n\t\t__gthread_once(&__once, _S_initialize);\n\t      }\n\n\t    // Double check initialization. May be necessary on some\n\t    // systems for proper construction when not compiling with\n\t    // thread flags.\n\t    _S_get_pool()._M_initialize_once(); \n\t    __init = true;\n\t  }\n      }\n    };\n#endif\n\n  /// @brief  Policy for individual __pool objects.\n  template<typename _Tp, template <bool> class _PoolTp, bool _Thread>\n    struct __per_type_pool_policy \n    : public __per_type_pool_base<_Tp, _PoolTp, _Thread>\n    {\n      template<typename _Tp1, template <bool> class _PoolTp1 = _PoolTp, \n\t       bool _Thread1 = _Thread>\n        struct _M_rebind\n        { typedef __per_type_pool_policy<_Tp1, _PoolTp1, _Thread1> other; };\n\n      using  __per_type_pool_base<_Tp, _PoolTp, _Thread>::_S_get_pool;\n      using  __per_type_pool_base<_Tp, _PoolTp, _Thread>::_S_initialize_once;\n  };\n\n\n  /// @brief  Base class for _Tp dependent member functions.\n  template<typename _Tp>\n    class __mt_alloc_base \n    {\n    public:\n      typedef size_t                    size_type;\n      typedef ptrdiff_t                 difference_type;\n      typedef _Tp*                      pointer;\n      typedef const _Tp*                const_pointer;\n      typedef _Tp&                      reference;\n      typedef const _Tp&                const_reference;\n      typedef _Tp                       value_type;\n\n      pointer\n      address(reference __x) const\n      { return &__x; }\n\n      const_pointer\n      address(const_reference __x) const\n      { return &__x; }\n\n      size_type\n      max_size() const throw() \n      { return size_t(-1) / sizeof(_Tp); }\n\n      // _GLIBCXX_RESOLVE_LIB_DEFECTS\n      // 402. wrong new expression in [some_] allocator::construct\n      void \n      construct(pointer __p, const _Tp& __val) \n      { ::new(__p) _Tp(__val); }\n\n      void \n      destroy(pointer __p) { __p->~_Tp(); }\n    };\n\n#ifdef __GTHREADS\n#define __thread_default true\n#else\n#define __thread_default false\n#endif\n\n  /**\n   *  @brief  This is a fixed size (power of 2) allocator which - when\n   *  compiled with thread support - will maintain one freelist per\n   *  size per thread plus a \"global\" one. Steps are taken to limit\n   *  the per thread freelist sizes (by returning excess back to\n   *  the \"global\" list).\n   *\n   *  Further details:\n   *  http://gcc.gnu.org/onlinedocs/libstdc++/ext/mt_allocator.html\n   */\n  template<typename _Tp, \n\t   typename _Poolp = __common_pool_policy<__pool, __thread_default> >\n    class __mt_alloc : public __mt_alloc_base<_Tp>\n    {\n    public:\n      typedef size_t                    \tsize_type;\n      typedef ptrdiff_t                 \tdifference_type;\n      typedef _Tp*                      \tpointer;\n      typedef const _Tp*                \tconst_pointer;\n      typedef _Tp&                      \treference;\n      typedef const _Tp&                \tconst_reference;\n      typedef _Tp                       \tvalue_type;\n      typedef _Poolp      \t\t\t__policy_type;\n      typedef typename _Poolp::pool_type\t__pool_type;\n\n      template<typename _Tp1, typename _Poolp1 = _Poolp>\n        struct rebind\n        { \n\t  typedef typename _Poolp1::template _M_rebind<_Tp1>::other pol_type;\n\t  typedef __mt_alloc<_Tp1, pol_type> other;\n\t};\n\n      __mt_alloc() throw() { }\n\n      __mt_alloc(const __mt_alloc&) throw() { }\n\n      template<typename _Tp1, typename _Poolp1>\n        __mt_alloc(const __mt_alloc<_Tp1, _Poolp1>&) throw() { }\n\n      ~__mt_alloc() throw() { }\n\n      pointer\n      allocate(size_type __n, const void* = 0);\n\n      void\n      deallocate(pointer __p, size_type __n);\n\n      const __pool_base::_Tune\n      _M_get_options()\n      { \n\t// Return a copy, not a reference, for external consumption.\n\treturn __policy_type::_S_get_pool()._M_get_options();\n      }\n      \n      void\n      _M_set_options(__pool_base::_Tune __t)\n      { __policy_type::_S_get_pool()._M_set_options(__t); }\n    };\n\n  template<typename _Tp, typename _Poolp>\n    typename __mt_alloc<_Tp, _Poolp>::pointer\n    __mt_alloc<_Tp, _Poolp>::\n    allocate(size_type __n, const void*)\n    {\n      if (__builtin_expect(__n > this->max_size(), false))\n\tstd::__throw_bad_alloc();\n\n      __policy_type::_S_initialize_once();\n\n      // Requests larger than _M_max_bytes are handled by operator\n      // new/delete directly.\n      __pool_type& __pool = __policy_type::_S_get_pool();\n      const size_t __bytes = __n * sizeof(_Tp);\n      if (__pool._M_check_threshold(__bytes))\n\t{\n\t  void* __ret = ::operator new(__bytes);\n\t  return static_cast<_Tp*>(__ret);\n\t}\n      \n      // Round up to power of 2 and figure out which bin to use.\n      const size_t __which = __pool._M_get_binmap(__bytes);\n      const size_t __thread_id = __pool._M_get_thread_id();\n      \n      // Find out if we have blocks on our freelist.  If so, go ahead\n      // and use them directly without having to lock anything.\n      char* __c;\n      typedef typename __pool_type::_Bin_record _Bin_record;\n      const _Bin_record& __bin = __pool._M_get_bin(__which);\n      if (__bin._M_first[__thread_id])\n\t{\n\t  // Already reserved.\n\t  typedef typename __pool_type::_Block_record _Block_record;\n\t  _Block_record* __block = __bin._M_first[__thread_id];\n\t  __bin._M_first[__thread_id] = __block->_M_next;\n\t  \n\t  __pool._M_adjust_freelist(__bin, __block, __thread_id);\n\t  __c = reinterpret_cast<char*>(__block) + __pool._M_get_align();\n\t}\n      else\n\t{\n\t  // Null, reserve.\n\t  __c = __pool._M_reserve_block(__bytes, __thread_id);\n\t}\n      return static_cast<_Tp*>(static_cast<void*>(__c));\n    }\n  \n  template<typename _Tp, typename _Poolp>\n    void\n    __mt_alloc<_Tp, _Poolp>::\n    deallocate(pointer __p, size_type __n)\n    {\n      if (__builtin_expect(__p != 0, true))\n\t{\n\t  // Requests larger than _M_max_bytes are handled by\n\t  // operators new/delete directly.\n\t  __pool_type& __pool = __policy_type::_S_get_pool();\n\t  const size_t __bytes = __n * sizeof(_Tp);\n\t  if (__pool._M_check_threshold(__bytes))\n\t    ::operator delete(__p);\n\t  else\n\t    __pool._M_reclaim_block(reinterpret_cast<char*>(__p), __bytes);\n\t}\n    }\n  \n  template<typename _Tp, typename _Poolp>\n    inline bool\n    operator==(const __mt_alloc<_Tp, _Poolp>&, const __mt_alloc<_Tp, _Poolp>&)\n    { return true; }\n  \n  template<typename _Tp, typename _Poolp>\n    inline bool\n    operator!=(const __mt_alloc<_Tp, _Poolp>&, const __mt_alloc<_Tp, _Poolp>&)\n    { return false; }\n\n#undef __thread_default\n\n_GLIBCXX_END_NAMESPACE\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/new_allocator.h",
    "content": "// Allocator that wraps operator new -*- C++ -*-\n\n// Copyright (C) 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n/** @file ext/new_allocator.h\n *  This file is a GNU extension to the Standard C++ Library.\n */\n\n#ifndef _NEW_ALLOCATOR_H\n#define _NEW_ALLOCATOR_H 1\n\n#include <new>\n#include <bits/functexcept.h>\n\n_GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)\n\n  using std::size_t;\n  using std::ptrdiff_t;\n\n  /**\n   *  @brief  An allocator that uses global new, as per [20.4].\n   *\n   *  This is precisely the allocator defined in the C++ Standard. \n   *    - all allocation calls operator new\n   *    - all deallocation calls operator delete\n   */\n  template<typename _Tp>\n    class new_allocator\n    {\n    public:\n      typedef size_t     size_type;\n      typedef ptrdiff_t  difference_type;\n      typedef _Tp*       pointer;\n      typedef const _Tp* const_pointer;\n      typedef _Tp&       reference;\n      typedef const _Tp& const_reference;\n      typedef _Tp        value_type;\n\n      template<typename _Tp1>\n        struct rebind\n        { typedef new_allocator<_Tp1> other; };\n\n      new_allocator() throw() { }\n\n      new_allocator(const new_allocator&) throw() { }\n\n      template<typename _Tp1>\n        new_allocator(const new_allocator<_Tp1>&) throw() { }\n\n      ~new_allocator() throw() { }\n\n      pointer\n      address(reference __x) const { return &__x; }\n\n      const_pointer\n      address(const_reference __x) const { return &__x; }\n\n      // NB: __n is permitted to be 0.  The C++ standard says nothing\n      // about what the return value is when __n == 0.\n      pointer\n      allocate(size_type __n, const void* = 0)\n      { \n\tif (__builtin_expect(__n > this->max_size(), false))\n\t  std::__throw_bad_alloc();\n\n\treturn static_cast<_Tp*>(::operator new(__n * sizeof(_Tp)));\n      }\n\n      // __p is not permitted to be a null pointer.\n      void\n      deallocate(pointer __p, size_type)\n      { ::operator delete(__p); }\n\n      size_type\n      max_size() const throw() \n      { return size_t(-1) / sizeof(_Tp); }\n\n      // _GLIBCXX_RESOLVE_LIB_DEFECTS\n      // 402. wrong new expression in [some_] allocator::construct\n      void \n      construct(pointer __p, const _Tp& __val) \n      { ::new(__p) _Tp(__val); }\n\n      void \n      destroy(pointer __p) { __p->~_Tp(); }\n    };\n\n  template<typename _Tp>\n    inline bool\n    operator==(const new_allocator<_Tp>&, const new_allocator<_Tp>&)\n    { return true; }\n  \n  template<typename _Tp>\n    inline bool\n    operator!=(const new_allocator<_Tp>&, const new_allocator<_Tp>&)\n    { return false; }\n\n_GLIBCXX_END_NAMESPACE\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/numeric",
    "content": "// Numeric extensions -*- C++ -*-\n\n// Copyright (C) 2002, 2004, 2005 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n/*\n *\n * Copyright (c) 1994\n * Hewlett-Packard Company\n *\n * Permission to use, copy, modify, distribute and sell this software\n * and its documentation for any purpose is hereby granted without fee,\n * provided that the above copyright notice appear in all copies and\n * that both that copyright notice and this permission notice appear\n * in supporting documentation.  Hewlett-Packard Company makes no\n * representations about the suitability of this software for any\n * purpose.  It is provided \"as is\" without express or implied warranty.\n *\n *\n * Copyright (c) 1996\n * Silicon Graphics Computer Systems, Inc.\n *\n * Permission to use, copy, modify, distribute and sell this software\n * and its documentation for any purpose is hereby granted without fee,\n * provided that the above copyright notice appear in all copies and\n * that both that copyright notice and this permission notice appear\n * in supporting documentation.  Silicon Graphics makes no\n * representations about the suitability of this software for any\n * purpose.  It is provided \"as is\" without express or implied warranty.\n */\n\n/** @file ext/numeric\n *  This file is a GNU extension to the Standard C++ Library (possibly\n *  containing extensions from the HP/SGI STL subset). \n */\n\n#ifndef _EXT_NUMERIC\n#define _EXT_NUMERIC 1\n\n#pragma GCC system_header\n\n#include <bits/concept_check.h>\n#include <numeric>\n\n#include <ext/functional> // For identity_element\n\n_GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)\n\n  // Returns __x ** __n, where __n >= 0.  _Note that \"multiplication\"\n  // is required to be associative, but not necessarily commutative.\n  template<typename _Tp, typename _Integer, typename _MonoidOperation>\n    _Tp\n    __power(_Tp __x, _Integer __n, _MonoidOperation __monoid_op)\n    {\n      if (__n == 0)\n\treturn identity_element(__monoid_op);\n      else\n\t{\n\t  while ((__n & 1) == 0)\n\t    {\n\t      __n >>= 1;\n\t      __x = __monoid_op(__x, __x);\n\t    }\n\n\t  _Tp __result = __x;\n\t  __n >>= 1;\n\t  while (__n != 0)\n\t    {\n\t      __x = __monoid_op(__x, __x);\n\t      if ((__n & 1) != 0)\n\t\t__result = __monoid_op(__result, __x);\n\t      __n >>= 1;\n\t    }\n\t  return __result;\n\t}\n    }\n\n  template<typename _Tp, typename _Integer>\n    inline _Tp\n    __power(_Tp __x, _Integer __n)\n    { return __power(__x, __n, std::multiplies<_Tp>()); }\n\n  /**\n   *  This is an SGI extension.\n   *  @ingroup SGIextensions\n   *  @doctodo\n  */\n  // Alias for the internal name __power.  Note that power is an extension,\n  // not part of the C++ standard.\n  template<typename _Tp, typename _Integer, typename _MonoidOperation>\n    inline _Tp\n    power(_Tp __x, _Integer __n, _MonoidOperation __monoid_op)\n    { return __power(__x, __n, __monoid_op); }\n\n  /**\n   *  This is an SGI extension.\n   *  @ingroup SGIextensions\n   *  @doctodo\n  */\n  template<typename _Tp, typename _Integer>\n    inline _Tp\n    power(_Tp __x, _Integer __n)\n    { return __power(__x, __n); }\n\n  /**\n   *  This is an SGI extension.\n   *  @ingroup SGIextensions\n   *  @doctodo\n  */\n  // iota is not part of the C++ standard.  It is an extension.\n  template<typename _ForwardIter, typename _Tp>\n    void\n    iota(_ForwardIter __first, _ForwardIter __last, _Tp __value)\n    {\n      // concept requirements\n      __glibcxx_function_requires(_Mutable_ForwardIteratorConcept<_ForwardIter>)\n      __glibcxx_function_requires(_ConvertibleConcept<_Tp,\n\t    typename std::iterator_traits<_ForwardIter>::value_type>)\n\n      while (__first != __last)\n\t*__first++ = __value++;\n    }\n\n_GLIBCXX_END_NAMESPACE\n\n#endif\n\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/numeric_traits.h",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2007 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n/** @file ext/numeric_traits.h\n *  This file is a GNU extension to the Standard C++ Library.\n */\n\n#ifndef _EXT_NUMERIC_TRAITS\n#define _EXT_NUMERIC_TRAITS 1\n\n#pragma GCC system_header\n\n#include <limits>\n#include <bits/cpp_type_traits.h>\n#include <ext/type_traits.h>\n\n_GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)\n\n  // Compile time constants for builtin types.\n  // Sadly std::numeric_limits member functions cannot be used for this.\n#define __glibcxx_signed(_Tp) ((_Tp)(-1) < 0)\n#define __glibcxx_digits(_Tp) \\\n  (sizeof(_Tp) * __CHAR_BIT__ - __glibcxx_signed(_Tp))\n\n#define __glibcxx_min(_Tp) \\\n  (__glibcxx_signed(_Tp) ? (_Tp)1 << __glibcxx_digits(_Tp) : (_Tp)0)\n\n#define __glibcxx_max(_Tp) \\\n  (__glibcxx_signed(_Tp) ? \\\n   (((((_Tp)1 << (__glibcxx_digits(_Tp) - 1)) - 1) << 1) + 1) : ~(_Tp)0)\n\n  template<typename _Value>\n    struct __numeric_traits_integer\n    {\n      // Only integers for initialization of member constant.\n      static const _Value __min = __glibcxx_min(_Value);\n      static const _Value __max = __glibcxx_max(_Value);\n    };\n\n  template<typename _Value>\n    const _Value __numeric_traits_integer<_Value>::__min;\n\n  template<typename _Value>\n    const _Value __numeric_traits_integer<_Value>::__max;\n\n  template<typename _Value>\n    struct __numeric_traits_floating\n    {\n      // Only floating point types. See N1822. \n      static const int __max_digits10 =\n\t2 + std::numeric_limits<_Value>::digits * 3010/10000;\n    };\n\n  template<typename _Value>\n    const int __numeric_traits_floating<_Value>::__max_digits10;\n\n  template<typename _Value>\n    struct __numeric_traits\n    : public __conditional_type<std::__is_integer<_Value>::__value,\n\t\t\t\t__numeric_traits_integer<_Value>,\n\t\t\t\t__numeric_traits_floating<_Value> >::__type\n    { };\n\n_GLIBCXX_END_NAMESPACE\n\n#undef __glibcxx_signed\n#undef __glibcxx_min\n#undef __glibcxx_max\n#undef __glibcxx_digits\n\n#endif \n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/assoc_container.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file assoc_container.hpp\n * Contains associative containers.\n */\n\n#ifndef PB_DS_ASSOC_CNTNR_HPP\n#define PB_DS_ASSOC_CNTNR_HPP\n\n#include <ext/typelist.h>\n#include <ext/pb_ds/tag_and_trait.hpp>\n#include <ext/pb_ds/detail/standard_policies.hpp>\n#include <ext/pb_ds/detail/container_base_dispatch.hpp>\n#include <ext/pb_ds/detail/basic_tree_policy/traits.hpp>\n\nnamespace pb_ds\n{\n#define PB_DS_BASE_C_DEC \\\n  detail::container_base_dispatch<Key, Mapped, Tag, Policy_Tl, Allocator>::type\n\n  // An abstract basic associative container.\n  template<typename Key, \n\t   typename Mapped, \n\t   typename Tag, \n\t   typename Policy_Tl, \n\t   typename Allocator>\n  class container_base : public PB_DS_BASE_C_DEC\n  {\n  private:\n    typedef typename PB_DS_BASE_C_DEC \t\t\tbase_type;\n\n  public:\n    typedef Tag \t\t\t\t\tcontainer_category;\n    typedef Allocator \t\t\t\t\tallocator;\n    typedef typename allocator::size_type \t\tsize_type;\n    typedef typename allocator::difference_type \tdifference_type;\n\n    // key_type\n    typedef typename allocator::template rebind<Key>::other::value_type key_type;\n    typedef typename allocator::template rebind<key_type>::other key_rebind;\n    typedef typename key_rebind::reference \t\tkey_reference;\n    typedef typename key_rebind::const_reference \tconst_key_reference;\n    typedef typename key_rebind::pointer \t\tkey_pointer;\n    typedef typename key_rebind::const_pointer \t\tconst_key_pointer;\n\n    // mapped_type\n    typedef Mapped \t\t\t\t\tmapped_type;\n    typedef typename allocator::template rebind<mapped_type>::other mapped_rebind;\n    typedef typename mapped_rebind::reference \t\tmapped_reference;\n    typedef typename mapped_rebind::const_reference\tconst_mapped_reference;\n    typedef typename mapped_rebind::pointer \t\tmapped_pointer;\n    typedef typename mapped_rebind::const_pointer \tconst_mapped_pointer;\n\n    // value_type\n    typedef typename base_type::value_type \t\tvalue_type;\n    typedef typename allocator::template rebind<value_type>::other value_rebind;\n    typedef typename value_rebind::reference\t\treference;\n    typedef typename value_rebind::const_reference \tconst_reference;\n    typedef typename value_rebind::pointer \t\tpointer;\n    typedef typename value_rebind::const_pointer \tconst_pointer;\n\n    // iterators\n    typedef typename base_type::iterator \t\titerator;\n    typedef typename base_type::const_iterator \t\tconst_iterator;\n    typedef typename base_type::point_iterator \t\tpoint_iterator;\n    typedef typename base_type::const_point_iterator \tconst_point_iterator;\n\n    virtual\n    ~container_base() { }\n\n  protected:\n#define PB_DS_CLASS_NAME \t\tcontainer_base\n#include <ext/pb_ds/detail/constructors_destructor_fn_imps.hpp>\n#undef PB_DS_CLASS_NAME\n  };\n\n#undef PB_DS_BASE_C_DEC\n\n\n#define PB_DS_BASE_C_DEC \\\n  container_base<Key, Mapped, Tag, typename __gnu_cxx::typelist::append< \\\n  typename __gnu_cxx::typelist::create4<Hash_Fn, Eq_Fn, Resize_Policy, detail::integral_constant<int, Store_Hash> >::type, Policy_TL>::type, Allocator>\n\n  // An abstract basic hash-based associative container.\n  template<typename Key,\n\t   typename Mapped,\n\t   typename Hash_Fn,\n\t   typename Eq_Fn,\n\t   typename Resize_Policy,\n\t   bool Store_Hash,\n\t   typename Tag,\n\t   typename Policy_TL,\n\t   typename Allocator>\n  class basic_hash_table : public PB_DS_BASE_C_DEC\n  {\n  private:\n    typedef PB_DS_BASE_C_DEC base_type;\n\n  public:\n    virtual\n    ~basic_hash_table() { }\n\n  protected:\n#define PB_DS_CLASS_NAME basic_hash_table\n#include <ext/pb_ds/detail/constructors_destructor_fn_imps.hpp>\n#undef PB_DS_CLASS_NAME\n\n  private:\n    basic_hash_table& \n    operator=(const base_type&);\n  };\n\n#undef PB_DS_BASE_C_DEC\n\n\n#define PB_DS_BASE_C_DEC \\\n  basic_hash_table<Key, Mapped,\tHash_Fn, Eq_Fn, Resize_Policy, Store_Hash, \\\n\t\t   cc_hash_tag,\t\\\n\t  typename __gnu_cxx::typelist::create1<Comb_Hash_Fn>::type, Allocator>\n\n  // A concrete collision-chaining hash-based associative container.\n  template<typename Key,\n\t   typename Mapped,\n\t   typename Hash_Fn = typename detail::default_hash_fn<Key>::type,\n\t   typename Eq_Fn = typename detail::default_eq_fn<Key>::type,\n\t   typename Comb_Hash_Fn = detail::default_comb_hash_fn::type,\n\t   typename Resize_Policy = typename detail::default_resize_policy<Comb_Hash_Fn>::type,\n\t   bool Store_Hash = detail::default_store_hash,\n\t   typename Allocator = std::allocator<char> >\n  class cc_hash_table :  public PB_DS_BASE_C_DEC\n  {\n  private:\n    typedef PB_DS_BASE_C_DEC \tbase_type;\n\n  public:\n    typedef Hash_Fn \t\thash_fn;\n    typedef Eq_Fn \t\teq_fn;\n    typedef Resize_Policy \tresize_policy;\n    typedef Comb_Hash_Fn \tcomb_hash_fn;\n\n    // Default constructor.\n    cc_hash_table() { }\n\n    // Constructor taking some policy objects. r_hash_fn will be\n    // copied by the Hash_Fn object of the container object.\n    cc_hash_table(const hash_fn& h) \n    : base_type(h) { }\n\n    // Constructor taking some policy objects. r_hash_fn will be\n    // copied by the hash_fn object of the container object, and\n    // r_eq_fn will be copied by the eq_fn object of the container\n    // object.\n    cc_hash_table(const hash_fn& h, const eq_fn& e)\n    : base_type(h, e) { }\n\n    // Constructor taking some policy objects. r_hash_fn will be\n    // copied by the hash_fn object of the container object, r_eq_fn\n    // will be copied by the eq_fn object of the container object, and\n    // r_comb_hash_fn will be copied by the comb_hash_fn object of the\n    // container object.\n    cc_hash_table(const hash_fn& h, const eq_fn& e, const comb_hash_fn& ch)\n    : base_type(h, e, ch) { }\n\n    // Constructor taking some policy objects. r_hash_fn will be\n    // copied by the hash_fn object of the container object, r_eq_fn\n    // will be copied by the eq_fn object of the container object,\n    // r_comb_hash_fn will be copied by the comb_hash_fn object of the\n    // container object, and r_resize_policy will be copied by the\n    // resize_policy object of the container object.\n    cc_hash_table(const hash_fn& h, const eq_fn& e, const comb_hash_fn& ch, \n\t\t  const resize_policy& rp)    \n    : base_type(h, e, ch, rp) { }\n\n    // Constructor taking __iterators to a range of value_types. The\n    // value_types between first_it and last_it will be inserted into\n    // the container object.\n    template<typename It>\n    cc_hash_table(It first, It last)\n    { base_type::copy_from_range(first, last); }\n\n    // Constructor taking __iterators to a range of value_types and\n    // some policy objects. The value_types between first_it and\n    // last_it will be inserted into the container object.\n    template<typename It>\n    cc_hash_table(It first, It last, const hash_fn& h)\n    : base_type(h)\n    { copy_from_range(first, last); }\n\n    // Constructor taking __iterators to a range of value_types and\n    // some policy objects The value_types between first_it and\n    // last_it will be inserted into the container object. r_hash_fn\n    // will be copied by the hash_fn object of the container object,\n    // and r_eq_fn will be copied by the eq_fn object of the container\n    // object.\n    template<typename It>\n    cc_hash_table(It first, It last, const hash_fn& h, const eq_fn& e)\n    : base_type(h, e)\n    { copy_from_range(first, last); }\n\n    // Constructor taking __iterators to a range of value_types and\n    // some policy objects The value_types between first_it and\n    // last_it will be inserted into the container object. r_hash_fn\n    // will be copied by the hash_fn object of the container object,\n    // r_eq_fn will be copied by the eq_fn object of the container\n    // object, and r_comb_hash_fn will be copied by the comb_hash_fn\n    // object of the container object.\n    template<typename It>\n    cc_hash_table(It first, It last, const hash_fn& h, const eq_fn& e,\n\t\t  const comb_hash_fn& ch)\n    : base_type(h, e, ch)\n    { copy_from_range(first, last); }\n\n    // Constructor taking __iterators to a range of value_types and\n    // some policy objects The value_types between first_it and\n    // last_it will be inserted into the container object. r_hash_fn\n    // will be copied by the hash_fn object of the container object,\n    // r_eq_fn will be copied by the eq_fn object of the container\n    // object, r_comb_hash_fn will be copied by the comb_hash_fn\n    // object of the container object, and r_resize_policy will be\n    // copied by the resize_policy object of the container object.\n    template<typename It>\n    cc_hash_table(It first, It last, const hash_fn& h, const eq_fn& e, \n\t\t  const comb_hash_fn& ch, const resize_policy& rp)\n    : base_type(h, e, ch, rp)\n    { copy_from_range(first, last); }\n\n    cc_hash_table(const cc_hash_table& other)\n    : base_type((const base_type&)other)\n    { }\n\n    virtual\n    ~cc_hash_table() { }\n\n    cc_hash_table& \n    operator=(const cc_hash_table& other)\n    {\n      if (this != &other)\n\t{\n\t  cc_hash_table tmp(other);\n\t  swap(tmp);\n\t}\n      return *this;\n    }\n\n    void\n    swap(cc_hash_table& other)\n    { base_type::swap(other); }\n  };\n\n#undef PB_DS_BASE_C_DEC\n\n\n#define PB_DS_BASE_C_DEC \\\n  basic_hash_table<Key, Mapped,\tHash_Fn, Eq_Fn, Resize_Policy, Store_Hash, \\\n\t\t   gp_hash_tag, \\\n\t\t   typename __gnu_cxx::typelist::create2<Comb_Probe_Fn, Probe_Fn>::type, Allocator>\n\n  // A concrete general-probing hash-based associative container.\n  template<typename Key,\n\t   typename Mapped,\n\t   typename Hash_Fn = typename detail::default_hash_fn<Key>::type,\n\t   typename Eq_Fn = typename detail::default_eq_fn<Key>::type,\n\t   typename Comb_Probe_Fn = detail::default_comb_hash_fn::type,\n\t   typename Probe_Fn = typename detail::default_probe_fn<Comb_Probe_Fn>::type,\n\t   typename Resize_Policy = typename detail::default_resize_policy<Comb_Probe_Fn>::type,\n\t   bool Store_Hash = detail::default_store_hash,\n\t   typename Allocator = std::allocator<char> >\n  class gp_hash_table : public PB_DS_BASE_C_DEC\n  {\n  private:\n    typedef PB_DS_BASE_C_DEC \tbase_type;\n\n  public:\n    typedef Hash_Fn \t\thash_fn;\n    typedef Eq_Fn \t\teq_fn;\n    typedef Comb_Probe_Fn\tcomb_probe_fn;\n    typedef Probe_Fn \t\tprobe_fn;\n    typedef Resize_Policy \tresize_policy;\n\n    // Default constructor.\n    gp_hash_table() { }\n\n    // Constructor taking some policy objects. r_hash_fn will be\n    // copied by the hash_fn object of the container object.\n    gp_hash_table(const hash_fn& h)\n    : base_type(h) { }\n\n    // Constructor taking some policy objects. r_hash_fn will be\n    // copied by the hash_fn object of the container object, and\n    // r_eq_fn will be copied by the eq_fn object of the container\n    // object.\n    gp_hash_table(const hash_fn& h, const eq_fn& e)\n    : base_type(h, e) { }\n\n    // Constructor taking some policy objects. r_hash_fn will be\n    // copied by the hash_fn object of the container object, r_eq_fn\n    // will be copied by the eq_fn object of the container object, and\n    // r_comb_probe_fn will be copied by the comb_probe_fn object of\n    // the container object.\n    gp_hash_table(const hash_fn& h, const eq_fn& e, const comb_probe_fn& cp)\n    : base_type(h, e, cp) { }\n\n    // Constructor taking some policy objects. r_hash_fn will be\n    // copied by the hash_fn object of the container object, r_eq_fn\n    // will be copied by the eq_fn object of the container object,\n    // r_comb_probe_fn will be copied by the comb_probe_fn object of\n    // the container object, and r_probe_fn will be copied by the\n    // probe_fn object of the container object.\n    gp_hash_table(const hash_fn& h, const eq_fn& e, const comb_probe_fn& cp, \n\t\t  const probe_fn& p)\n    : base_type(h, e, cp, p) { }\n\n    // Constructor taking some policy objects. r_hash_fn will be\n    // copied by the hash_fn object of the container object, r_eq_fn\n    // will be copied by the eq_fn object of the container object,\n    // r_comb_probe_fn will be copied by the comb_probe_fn object of\n    // the container object, r_probe_fn will be copied by the probe_fn\n    // object of the container object, and r_resize_policy will be\n    // copied by the Resize_Policy object of the container object.\n    gp_hash_table(const hash_fn& h, const eq_fn& e, const comb_probe_fn& cp, \n\t\t  const probe_fn& p, const resize_policy& rp)\n    : base_type(h, e, cp, p, rp) { }\n\n    // Constructor taking __iterators to a range of value_types. The\n    // value_types between first_it and last_it will be inserted into\n    // the container object.\n    template<typename It>\n    gp_hash_table(It first, It last)\n    { base_type::copy_from_range(first, last); }\n\n    // Constructor taking __iterators to a range of value_types and\n    // some policy objects. The value_types between first_it and\n    // last_it will be inserted into the container object. r_hash_fn\n    // will be copied by the hash_fn object of the container object.\n    template<typename It>\n    gp_hash_table(It first, It last, const hash_fn& h)\n    : base_type(h)\n    { base_type::copy_from_range(first, last); }\n\n    // Constructor taking __iterators to a range of value_types and\n    // some policy objects. The value_types between first_it and\n    // last_it will be inserted into the container object. r_hash_fn\n    // will be copied by the hash_fn object of the container object,\n    // and r_eq_fn will be copied by the eq_fn object of the container\n    // object.\n    template<typename It>\n    gp_hash_table(It first, It last, const hash_fn& h, const eq_fn& e)\n    : base_type(h, e)\n    { base_type::copy_from_range(first, last); }\n\n    // Constructor taking __iterators to a range of value_types and\n    // some policy objects. The value_types between first_it and\n    // last_it will be inserted into the container object. r_hash_fn\n    // will be copied by the hash_fn object of the container object,\n    // r_eq_fn will be copied by the eq_fn object of the container\n    // object, and r_comb_probe_fn will be copied by the comb_probe_fn\n    // object of the container object.\n    template<typename It>\n    gp_hash_table(It first, It last, const hash_fn& h, const eq_fn& e, \n\t\t  const comb_probe_fn& cp)\n    : base_type(h, e, cp)\n    { base_type::copy_from_range(first, last); }\n\n    // Constructor taking __iterators to a range of value_types and\n    // some policy objects. The value_types between first_it and\n    // last_it will be inserted into the container object. r_hash_fn\n    // will be copied by the hash_fn object of the container object,\n    // r_eq_fn will be copied by the eq_fn object of the container\n    // object, r_comb_probe_fn will be copied by the comb_probe_fn\n    // object of the container object, and r_probe_fn will be copied\n    // by the probe_fn object of the container object.\n    template<typename It>\n    gp_hash_table(It first, It last, const hash_fn& h, const eq_fn& e, \n\t\t  const comb_probe_fn& cp, const probe_fn& p)\n    : base_type(h, e, cp, p)\n    { base_type::copy_from_range(first, last); }\n\n    // Constructor taking __iterators to a range of value_types and\n    // some policy objects. The value_types between first_it and\n    // last_it will be inserted into the container object. r_hash_fn\n    // will be copied by the hash_fn object of the container object,\n    // r_eq_fn will be copied by the eq_fn object of the container\n    // object, r_comb_probe_fn will be copied by the comb_probe_fn\n    // object of the container object, r_probe_fn will be copied by\n    // the probe_fn object of the container object, and\n    // r_resize_policy will be copied by the resize_policy object of\n    // the container object.\n    template<typename It>\n    gp_hash_table(It first, It last, const hash_fn& h, const eq_fn& e, \n\t\t  const comb_probe_fn& cp, const probe_fn& p, \n\t\t  const resize_policy& rp)\n    : base_type(h, e, cp, p, rp)\n    { base_type::copy_from_range(first, last); }\n\n    gp_hash_table(const gp_hash_table& other)\n    : base_type((const base_type&)other)\n    { }\n\n    virtual\n    ~gp_hash_table() { }\n\n    gp_hash_table& \n    operator=(const gp_hash_table& other)\n    {\n      if (this != &other)\n\t{\n\t  gp_hash_table tmp(other);\n\t  swap(tmp);\n\t}\n      return *this;\n    }\n\n    void\n    swap(gp_hash_table& other)\n    { base_type::swap(other); }\n  };\n\n#undef PB_DS_BASE_C_DEC\n\n\n#define PB_DS_BASE_C_DEC \\\n  container_base<Key, Mapped, Tag, Policy_Tl, Allocator>\n\n  // An abstract basic tree-like (tree, trie) associative container.\n  template<typename Key, typename Mapped, typename Tag, \n\t   typename Node_Update, typename Policy_Tl, typename Allocator>\n  class basic_tree : public PB_DS_BASE_C_DEC\n  {\n  private:\n    typedef PB_DS_BASE_C_DEC \tbase_type;\n\n  public:\n    typedef Node_Update \tnode_update;\n\n    virtual\n    ~basic_tree() { }\n\n  protected:\n#define PB_DS_CLASS_NAME \t\tbasic_tree\n#include <ext/pb_ds/detail/constructors_destructor_fn_imps.hpp>\n#undef PB_DS_CLASS_NAME\n  };\n\n#undef PB_DS_BASE_C_DEC\n\n\n#define PB_DS_TREE_NODE_AND_IT_TRAITS_C_DEC \\\n  detail::tree_traits<Key, Mapped,Cmp_Fn,Node_Update,Tag, Allocator>\n\n#define PB_DS_BASE_C_DEC \\\n  basic_tree<Key,Mapped,Tag,typename PB_DS_TREE_NODE_AND_IT_TRAITS_C_DEC::node_update, \\\n\t     typename __gnu_cxx::typelist::create2<Cmp_Fn, PB_DS_TREE_NODE_AND_IT_TRAITS_C_DEC >::type, Allocator>\n\n  // A concrete basic tree-based associative container.\n  template<typename Key, typename Mapped, typename Cmp_Fn = std::less<Key>,\n\t   typename Tag = rb_tree_tag,\n\t   template<typename Const_Node_Iterator, typename Node_Iterator, typename Cmp_Fn_, typename Allocator_>\n  class Node_Update = pb_ds::null_tree_node_update,\n\t   typename Allocator = std::allocator<char> >\n  class tree : public PB_DS_BASE_C_DEC\n  {\n  private:\n    typedef PB_DS_BASE_C_DEC \tbase_type;\n\n  public:\n    // Comparison functor type.\n    typedef Cmp_Fn \t\tcmp_fn;\n\n    tree() { }\n\n    // Constructor taking some policy objects. r_cmp_fn will be copied\n    // by the Cmp_Fn object of the container object.\n    tree(const cmp_fn& c)\n    : base_type(c) { }\n\n    // Constructor taking __iterators to a range of value_types. The\n    // value_types between first_it and last_it will be inserted into\n    // the container object.\n    template<typename It>\n    tree(It first, It last)\n    { base_type::copy_from_range(first, last); }\n\n    // Constructor taking __iterators to a range of value_types and\n    // some policy objects The value_types between first_it and\n    // last_it will be inserted into the container object. r_cmp_fn\n    // will be copied by the cmp_fn object of the container object.\n    template<typename It>\n    tree(It first, It last, const cmp_fn& c)\n      : base_type(c)\n    { base_type::copy_from_range(first, last); }\n\n    tree(const tree& other)\n    : base_type((const base_type&)other) { }\n\n    virtual\n    ~tree() { }\n\n    tree& \n    operator=(const tree& other)\n    {\n      if (this != &other)\n\t{\n\t  tree tmp(other);\n\t  swap(tmp);\n\t}\n      return *this;\n    }\n\n    void\n    swap(tree& other)\n    { base_type::swap(other); }\n  };\n\n#undef PB_DS_BASE_C_DEC\n#undef PB_DS_TREE_NODE_AND_IT_TRAITS_C_DEC\n\n\n#define PB_DS_TRIE_NODE_AND_ITS_TRAITS \\\n  detail::trie_traits<Key,Mapped,E_Access_Traits,Node_Update,Tag,Allocator>\n\n#define PB_DS_BASE_C_DEC \\\n  basic_tree<Key,Mapped,Tag, typename PB_DS_TRIE_NODE_AND_ITS_TRAITS::node_update, \\\n\t     typename __gnu_cxx::typelist::create2<E_Access_Traits, PB_DS_TRIE_NODE_AND_ITS_TRAITS >::type, Allocator>\n\n  // A concrete basic trie-based associative container.\n  template<typename Key,\n\t   typename Mapped,\n\t   typename E_Access_Traits = typename detail::default_trie_e_access_traits<Key>::type,\n\t   typename Tag = pat_trie_tag,\n\t   template<typename Const_Node_Iterator,\n\t\t    typename Node_Iterator,\n\t\t    typename E_Access_Traits_,\n\t\t    typename Allocator_>\n  class Node_Update = null_trie_node_update,\n\t   typename Allocator = std::allocator<char> >\n  class trie : public PB_DS_BASE_C_DEC\n  {\n  private:\n    typedef PB_DS_BASE_C_DEC base_type;\n\n  public:\n    // Element access traits type.\n    typedef E_Access_Traits e_access_traits;\n\n    trie() { }\n\n    // Constructor taking some policy objects. r_e_access_traits will\n    // be copied by the E_Access_Traits object of the container\n    // object.\n    trie(const e_access_traits& t)\n    : base_type(t) { }\n\n    // Constructor taking __iterators to a range of value_types. The\n    // value_types between first_it and last_it will be inserted into\n    // the container object.\n    template<typename It>\n    trie(It first, It last)\n    { base_type::copy_from_range(first, last); }\n\n    // Constructor taking __iterators to a range of value_types and\n    // some policy objects. The value_types between first_it and\n    // last_it will be inserted into the container object.\n    template<typename It>\n    trie(It first, It last, const e_access_traits& t)\n    : base_type(t)\n    { base_type::copy_from_range(first, last); }\n\n    trie(const trie& other)\n    : base_type((const base_type&)other) { }\n\n    virtual\n    ~trie() { }\n\n    trie& \n    operator=(const trie& other)\n    {\n      if (this != &other)\n\t{\n\t  trie tmp(other);\n\t  swap(tmp);\n\t}\n      return *this;\n    }\n\n    void\n    swap(trie& other)\n    { base_type::swap(other); }\n  };\n\n#undef PB_DS_BASE_C_DEC\n#undef PB_DS_TRIE_NODE_AND_ITS_TRAITS\n\n\n#define PB_DS_BASE_C_DEC \\\n  container_base<Key, Mapped, list_update_tag, \\\n\t\t typename __gnu_cxx::typelist::create2<Eq_Fn, Update_Policy>::type, Allocator>\n\n  // A list-update based associative container.\n  template<typename Key,\n\t   typename Mapped,\n\t   class Eq_Fn = typename detail::default_eq_fn<Key>::type,\n\t   class Update_Policy = detail::default_update_policy::type,\n\t   class Allocator = std::allocator<char> >\n  class list_update : public PB_DS_BASE_C_DEC\n  {\n  private:\n    typedef PB_DS_BASE_C_DEC \tbase_type;\n\n  public:\n    typedef Eq_Fn \t\teq_fn;\n    typedef Update_Policy \tupdate_policy;\n    typedef Allocator \t\tallocator;\n\n    list_update() { }\n\n    // Constructor taking __iterators to a range of value_types. The\n    // value_types between first_it and last_it will be inserted into\n    // the container object.\n    template<typename It>\n    list_update(It first, It last)\n    { base_type::copy_from_range(first, last); }\n\n    list_update(const list_update& other)\n    : base_type((const base_type&)other) { }\n\n    virtual\n    ~list_update() { }\n\n    list_update& \n    operator=(const list_update& other)\n    {\n      if (this !=& other)\n\t{\n\t  list_update tmp(other);\n\t  swap(tmp);\n\t}\n      return *this;\n    }\n\n    void\n    swap(list_update& other)\n    { base_type::swap(other); }\n  };\n\n#undef PB_DS_BASE_C_DEC\n\n} // namespace pb_ds\n\n#endif \n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/detail/basic_tree_policy/basic_tree_policy_base.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file basic_tree_policy_base.hpp\n * Contains a base class for tree_like policies.\n */\n\n#ifndef PB_DS_TREE_LIKE_POLICY_BASE_HPP\n#define PB_DS_TREE_LIKE_POLICY_BASE_HPP\n\nnamespace pb_ds\n{\n  namespace detail\n  {\n\n#define PB_DS_CLASS_C_DEC\t\t\t\t\t\t\\\n    basic_tree_policy_base<\t\t\t\t\t\t\\\n\t\t\t\t\t\t\tConst_Node_Iterator, \\\n\t\t\t\t\t\t\tNode_Iterator,\t\\\n\t\t\t\t\t\t\tAllocator>\n\n    template<typename Const_Node_Iterator,\n\t     typename Node_Iterator,\n\t     typename Allocator>\n    struct basic_tree_policy_base\n    {\n    protected:\n      typedef typename Node_Iterator::value_type it_type;\n\n      typedef typename std::iterator_traits< it_type>::value_type value_type;\n\n      typedef typename value_type::first_type key_type;\n\n      typedef\n      typename Allocator::template rebind<\n\ttypename remove_const<\n\tkey_type>::type>::other::const_reference\n      const_key_reference;\n\n      typedef\n      typename Allocator::template rebind<\n\ttypename remove_const<\n\tvalue_type>::type>::other::const_reference\n      const_reference;\n\n      typedef\n      typename Allocator::template rebind<\n\ttypename remove_const<\n\tvalue_type>::type>::other::reference\n      reference;\n\n      typedef\n      typename Allocator::template rebind<\n\ttypename remove_const<\n\tvalue_type>::type>::other::const_pointer\n      const_pointer;\n\n      static inline const_key_reference\n      extract_key(const_reference r_val)\n      {\n\treturn (r_val.first);\n      }\n\n      virtual it_type\n      end() = 0;\n\n      it_type\n      end_iterator() const\n      {\n\treturn (const_cast<PB_DS_CLASS_C_DEC* >(this)->end());\n      }\n\n      virtual\n      ~basic_tree_policy_base()\n      { }\n    };\n\n    template<typename Const_Node_Iterator, typename Allocator>\n    struct basic_tree_policy_base<\n      Const_Node_Iterator,\n      Const_Node_Iterator,\n      Allocator>\n    {\n    protected:\n      typedef typename Const_Node_Iterator::value_type it_type;\n\n      typedef typename std::iterator_traits< it_type>::value_type value_type;\n\n      typedef value_type key_type;\n\n      typedef\n      typename Allocator::template rebind<\n\ttypename remove_const<\n\tkey_type>::type>::other::const_reference\n      const_key_reference;\n\n      typedef\n      typename Allocator::template rebind<\n\ttypename remove_const<\n\tvalue_type>::type>::other::const_reference\n      const_reference;\n\n      typedef\n      typename Allocator::template rebind<\n\ttypename remove_const<\n\tvalue_type>::type>::other::reference\n      reference;\n\n      typedef\n      typename Allocator::template rebind<\n\ttypename remove_const<\n\tvalue_type>::type>::other::const_pointer\n      const_pointer;\n\n      static inline const_key_reference\n      extract_key(const_reference r_val)\n      {\n\treturn (r_val);\n      }\n\n      virtual it_type\n      end() const = 0;\n\n      it_type\n      end_iterator() const\n      {\n\treturn (end());\n      }\n\n      virtual\n      ~basic_tree_policy_base()\n      { }\n    };\n\n#undef PB_DS_CLASS_C_DEC\n\n  } // namespace detail\n} // namespace pb_ds\n\n#endif // #ifndef PB_DS_TREE_LIKE_POLICY_BASE_HPP\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/detail/basic_tree_policy/null_node_metadata.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file null_node_metadata.hpp\n * Contains an implementation class for tree-like classes.\n */\n\n#ifndef PB_DS_NULL_NODE_METADATA_HPP\n#define PB_DS_NULL_NODE_METADATA_HPP\n\n#include <ext/pb_ds/detail/types_traits.hpp>\n\nnamespace pb_ds\n{\n  namespace detail\n  {\n    template<typename Key, class Data, class Allocator>\n    struct dumconst_node_iterator\n    {\n    private:\n      typedef typename types_traits<Key, Data, Allocator, false>::pointer const_iterator;\n\n    public:\n      typedef const_iterator value_type;\n      typedef const_iterator const_reference;\n      typedef const_reference reference;\n    };\n\n    struct null_node_metadata\n    { };\n  } // namespace detail\n} // namespace pb_ds\n\n#endif \n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/detail/basic_tree_policy/traits.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file traits.hpp\n * Contains an implementation class for tree-like classes.\n */\n\n#ifndef PB_DS_NODE_AND_IT_TRAITS_HPP\n#define PB_DS_NODE_AND_IT_TRAITS_HPP\n\n#include <ext/pb_ds/detail/types_traits.hpp>\n#include <ext/pb_ds/detail/bin_search_tree_/traits.hpp>\n#include <ext/pb_ds/detail/tree_policy/node_metadata_selector.hpp>\n#include <ext/pb_ds/detail/trie_policy/node_metadata_selector.hpp>\n\nnamespace pb_ds\n{\n  namespace detail\n  {    \n    template<typename Key,\n\t     typename Data,\n\t     class Cmp_Fn,\n\t     template<typename Const_Node_Iterator,\n\t\t      class Node_Iterator,\n\t\t      class Cmp_Fn_,\n\t\t      class Allocator>\n    class Node_Update,\n\t     class Tag,\n\t     class Allocator>\n    struct tree_traits;\n\n    template<typename Key,\n\t     typename Data,\n\t     class E_Access_Traits,\n\t     template<typename Const_Node_Iterator,\n\t\t      class Node_Iterator,\n\t\t      class E_Access_Traits_,\n\t\t      class Allocator>\n    class Node_Update,\n\t     class Tag,\n\t     class Allocator>\n    struct trie_traits;\n\n  } // namespace detail\n} // namespace pb_ds\n\n#include <ext/pb_ds/detail/rb_tree_map_/traits.hpp>\n#include <ext/pb_ds/detail/splay_tree_/traits.hpp>\n#include <ext/pb_ds/detail/ov_tree_map_/traits.hpp>\n#include <ext/pb_ds/detail/pat_trie_/traits.hpp>\n\n#endif // #ifndef PB_DS_NODE_AND_IT_TRAITS_HPP\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/detail/basic_types.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file basic_types.hpp\n * Contains basic types used by containers.\n */\n\n#ifndef PB_DS_BASIC_TYPES_HPP\n#define PB_DS_BASIC_TYPES_HPP\n\n#include <algorithm>\n#include <utility>\n#include <ext/pb_ds/tag_and_trait.hpp>\n#include <ext/pb_ds/detail/type_utils.hpp>\n\nnamespace pb_ds\n{\n  namespace detail\n  {\n    template<typename Key, typename Mapped, typename Allocator, bool Store_Hash>\n    struct value_type_base;\n\n    /**\n     * Specialization of value_type_base for the case where the hash value\n     * is not stored alongside each value.\n     **/\n    template<typename Key, typename Mapped, typename Allocator>\n    struct value_type_base<Key, Mapped, Allocator, false>\n    {\n      typedef typename Allocator::template rebind<Mapped>::other mapped_type_allocator;\n      typedef typename mapped_type_allocator::value_type mapped_type;\n      typedef typename mapped_type_allocator::pointer mapped_pointer;\n      typedef typename mapped_type_allocator::const_pointer const_mapped_pointer;\n      typedef typename mapped_type_allocator::reference mapped_reference;\n      typedef typename mapped_type_allocator::const_reference const_mapped_reference;\n\n      typedef typename Allocator::template rebind<std::pair<const Key, Mapped> >::other value_type_allocator;\n      typedef typename value_type_allocator::value_type value_type;\n      typedef typename value_type_allocator::pointer pointer;\n      typedef typename value_type_allocator::const_pointer const_pointer;\n      typedef typename value_type_allocator::reference reference;\n      typedef typename value_type_allocator::const_reference const_reference;\n\n      struct stored_value_type\n      {\n\tvalue_type m_value;\n      };\n    };\n\n    /**\n     * Specialization of value_type_base for the case where the hash value\n     * is stored alongside each value.\n     **/\n    template<typename Key, typename Mapped, typename Allocator>\n    struct value_type_base<Key, Mapped, Allocator, true>\n    {\n      typedef typename Allocator::template rebind<Mapped>::other mapped_type_allocator;\n      typedef typename mapped_type_allocator::value_type mapped_type;\n      typedef typename mapped_type_allocator::pointer mapped_pointer;\n      typedef typename mapped_type_allocator::const_pointer const_mapped_pointer;\n      typedef typename mapped_type_allocator::reference mapped_reference;\n      typedef typename mapped_type_allocator::const_reference const_mapped_reference;\n\n      typedef typename Allocator::template rebind<std::pair<const Key, Mapped> >::other value_type_allocator;\n      typedef typename value_type_allocator::value_type value_type;\n      typedef typename value_type_allocator::pointer pointer;\n      typedef typename value_type_allocator::const_pointer const_pointer;\n      typedef typename value_type_allocator::reference reference;\n      typedef typename value_type_allocator::const_reference const_reference;\n\n      struct stored_value_type\n      {\n\tvalue_type m_value;\n\ttypename Allocator::size_type m_hash;\n      };\n    };\n\n#define PB_DS_CLASS_T_DEC \\\n    template<typename Key, typename Allocator>\n\n#define PB_DS_CLASS_C_DEC \\\n    value_type_base<Key, null_mapped_type, Allocator, false>\n\n    /**\n     * Specialization of value_type_base for the case where the hash value\n     * is not stored alongside each value.\n     **/\n    template<typename Key, typename Allocator>\n    struct value_type_base<Key, null_mapped_type, Allocator, false>\n    {\n      typedef typename Allocator::template rebind<null_mapped_type>::other mapped_type_allocator;\n      typedef typename mapped_type_allocator::value_type mapped_type;\n      typedef typename mapped_type_allocator::pointer mapped_pointer;\n      typedef typename mapped_type_allocator::const_pointer const_mapped_pointer;\n      typedef typename mapped_type_allocator::reference mapped_reference;\n      typedef typename mapped_type_allocator::const_reference const_mapped_reference;\n\n      typedef Key value_type;\n\n      typedef typename Allocator::template rebind<value_type>::other value_type_allocator;\n      typedef typename value_type_allocator::pointer pointer;\n      typedef typename value_type_allocator::const_pointer const_pointer;\n      typedef typename value_type_allocator::reference reference;\n      typedef typename value_type_allocator::const_reference const_reference;\n\n      struct stored_value_type\n      {\n\tvalue_type m_value;\n      };\n\n      static null_mapped_type s_null_mapped;\n    };\n\n    PB_DS_CLASS_T_DEC\n    null_mapped_type PB_DS_CLASS_C_DEC::s_null_mapped;\n\n#undef PB_DS_CLASS_T_DEC\n#undef PB_DS_CLASS_C_DEC\n\n#define PB_DS_CLASS_T_DEC \\\n    template<typename Key, typename Allocator>\n\n#define PB_DS_CLASS_C_DEC \\\n    value_type_base<Key, null_mapped_type, Allocator, true>\n\n    /**\n     * Specialization of value_type_base for the case where the hash value\n     * is stored alongside each value.\n     **/\n    template<typename Key, typename Allocator>\n    struct value_type_base<Key, null_mapped_type, Allocator, true>\n    {\n      typedef typename Allocator::template rebind<null_mapped_type>::other mapped_type_allocator;\n      typedef typename mapped_type_allocator::value_type mapped_type;\n      typedef typename mapped_type_allocator::pointer mapped_pointer;\n      typedef typename mapped_type_allocator::const_pointer const_mapped_pointer;\n      typedef typename mapped_type_allocator::reference mapped_reference;\n      typedef typename mapped_type_allocator::const_reference const_mapped_reference;\n\n      typedef Key value_type;\n\n      typedef typename Allocator::template rebind<value_type>::other value_type_allocator;\n      typedef typename value_type_allocator::pointer pointer;\n      typedef typename value_type_allocator::const_pointer const_pointer;\n      typedef typename value_type_allocator::reference reference;\n      typedef typename value_type_allocator::const_reference const_reference;\n\n      struct stored_value_type\n      {\n\tvalue_type m_value;\n\ttypename Allocator::size_type m_hash;\n      };\n\n      static null_mapped_type s_null_mapped;\n    };\n\n    PB_DS_CLASS_T_DEC\n    null_mapped_type PB_DS_CLASS_C_DEC::s_null_mapped;\n\n#undef PB_DS_CLASS_T_DEC\n#undef PB_DS_CLASS_C_DEC\n\n    template<typename Key, typename Mapped>\n    struct no_throw_copies\n    {\n      typedef integral_constant<int, is_simple<Key>::value && is_simple<Mapped>::value> indicator;\n    };\n\n    template<typename Key>\n    struct no_throw_copies<Key, null_mapped_type>\n    {\n      typedef integral_constant<int, is_simple<Key>::value> indicator;\n    };\n  } // namespace detail\n} // namespace pb_ds\n\n#endif \n\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/detail/bin_search_tree_/bin_search_tree_.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file bin_search_tree_.hpp\n * Contains an implementation class for bin_search_tree_.\n */\n/*\n * This implementation uses an idea from the SGI STL (using a \"header\" node\n *    which is needed for efficient iteration).\n */\n\n#include <ext/pb_ds/exception.hpp>\n#include <ext/pb_ds/detail/eq_fn/eq_by_less.hpp>\n#include <ext/pb_ds/detail/types_traits.hpp>\n#include <ext/pb_ds/detail/map_debug_base.hpp>\n#include <ext/pb_ds/tree_policy.hpp>\n#include <ext/pb_ds/detail/cond_dealtor.hpp>\n#include <ext/pb_ds/detail/type_utils.hpp>\n#include <ext/pb_ds/detail/tree_trace_base.hpp>\n#include <utility>\n#include <functional>\n#include <debug/debug.h>\n\nnamespace pb_ds\n{\n  namespace detail\n  {\n\n#define PB_DS_CLASS_T_DEC\t\t\t\t\t\t\\\n    template<typename Key, typename Mapped, class Cmp_Fn,\t\t\\\n\t     class Node_And_It_Traits, class Allocator>\n\n#ifdef PB_DS_DATA_TRUE_INDICATOR\n#define PB_DS_CLASS_NAME\t\t\t\\\n    bin_search_tree_data_\n#endif \n\n#ifdef PB_DS_DATA_FALSE_INDICATOR\n#define PB_DS_CLASS_NAME\t\t\t\\\n    bin_search_tree_no_data_\n#endif \n\n#define PB_DS_CLASS_C_DEC\t\t\t\t\t\t\\\n    PB_DS_CLASS_NAME<\t\t\t\t\t\t\t\\\n\t\t\t\t\t\tKey,\t\t\t\\\n\t\t\t\t\t\tMapped,\t\t\t\\\n\t\t\t\t\t\tCmp_Fn,\t\t\t\\\n\t\t\t\t\t\tNode_And_It_Traits,\t\\\n\t\t\t\t\t\tAllocator>\n\n#define PB_DS_TYPES_TRAITS_C_DEC\t\t\t\t\\\n    types_traits<\t\t\t\t\\\n\t\t\t\t\t\tKey,\t\t\\\n\t\t\t\t\t\tMapped,\t\t\\\n\t\t\t\t\t\tAllocator,\t\\\n\t\t\t\t\t\tfalse>\n\n#ifdef _GLIBCXX_DEBUG\n#define PB_DS_MAP_DEBUG_BASE_C_DEC\t\t\t\t\t\\\n    map_debug_base<Key,\teq_by_less<Key, Cmp_Fn>, \\\n\t      typename Allocator::template rebind<Key>::other::const_reference>\n#endif \n\n#ifdef PB_DS_DATA_TRUE_INDICATOR\n#define PB_DS_V2F(X) (X).first\n#define PB_DS_V2S(X) (X).second\n#define PB_DS_EP2VP(X)& ((X)->m_value)\n#endif \n\n#ifdef PB_DS_DATA_FALSE_INDICATOR\n#define PB_DS_V2F(X) (X)\n#define PB_DS_V2S(X) Mapped_Data()\n#define PB_DS_EP2VP(X)& ((X)->m_value.first)\n#endif \n\n#ifdef PB_DS_TREE_TRACE\n#define PB_DS_TREE_TRACE_BASE_C_DEC\t\t\t\t\t\\\n    tree_trace_base<\t\t\t\t\t\t\t\\\n\t\t\t\t\t\t\t\t\ttypename Node_And_It_Traits::const_node_iterator, \\\n\t\t\t\t\t\t\t\t\ttypename Node_And_It_Traits::node_iterator, \\\n\t\t\t\t\t\t\t\t\tCmp_Fn,\t\\\n\t\t\t\t\t\t\t\t\ttrue, \\\n\t\t\t\t\t\t\t\t\tAllocator>\n#endif \n\n    /**\n     * class description = \"8i|\\|4ree $34rc|-| 7r33 74813.\">\n     **/\n    template<typename Key,\n\t     typename Mapped,\n\t     class Cmp_Fn,\n\t     class Node_And_It_Traits,\n\t     class Allocator>\n    class PB_DS_CLASS_NAME :\n#ifdef _GLIBCXX_DEBUG\n      public PB_DS_MAP_DEBUG_BASE_C_DEC,\n#endif \n#ifdef PB_DS_TREE_TRACE\n      public PB_DS_TREE_TRACE_BASE_C_DEC,\n#endif \n      public Cmp_Fn,\n      public PB_DS_TYPES_TRAITS_C_DEC,\n      public Node_And_It_Traits::node_update\n    {\n\n    protected:\n      typedef\n      typename Allocator::template rebind<\n      typename Node_And_It_Traits::node>::other\n      node_allocator;\n\n      typedef typename node_allocator::value_type node;\n\n      typedef typename node_allocator::pointer node_pointer;\n\n      typedef PB_DS_TYPES_TRAITS_C_DEC traits_base;\n\n      typedef\n      typename Node_And_It_Traits::null_node_update_pointer\n      null_node_update_pointer;\n\n    private:\n      typedef cond_dealtor< node, Allocator> cond_dealtor_t;\n\n#ifdef _GLIBCXX_DEBUG\n      typedef PB_DS_MAP_DEBUG_BASE_C_DEC map_debug_base;\n#endif \n\n    public:\n\n      typedef typename Allocator::size_type size_type;\n\n      typedef typename Allocator::difference_type difference_type;\n\n      typedef typename PB_DS_TYPES_TRAITS_C_DEC::key_type key_type;\n\n      typedef typename PB_DS_TYPES_TRAITS_C_DEC::key_pointer key_pointer;\n\n      typedef\n      typename PB_DS_TYPES_TRAITS_C_DEC::const_key_pointer\n      const_key_pointer;\n\n      typedef typename PB_DS_TYPES_TRAITS_C_DEC::key_reference key_reference;\n\n      typedef\n      typename PB_DS_TYPES_TRAITS_C_DEC::const_key_reference\n      const_key_reference;\n\n#ifdef PB_DS_DATA_TRUE_INDICATOR\n      typedef typename PB_DS_TYPES_TRAITS_C_DEC::mapped_type mapped_type;\n\n      typedef\n      typename PB_DS_TYPES_TRAITS_C_DEC::mapped_pointer\n      mapped_pointer;\n\n      typedef\n      typename PB_DS_TYPES_TRAITS_C_DEC::const_mapped_pointer\n      const_mapped_pointer;\n\n      typedef\n      typename PB_DS_TYPES_TRAITS_C_DEC::mapped_reference\n      mapped_reference;\n\n      typedef\n      typename PB_DS_TYPES_TRAITS_C_DEC::const_mapped_reference\n      const_mapped_reference;\n#endif \n\n      typedef typename PB_DS_TYPES_TRAITS_C_DEC::value_type value_type;\n\n      typedef typename PB_DS_TYPES_TRAITS_C_DEC::pointer pointer;\n\n      typedef typename PB_DS_TYPES_TRAITS_C_DEC::const_pointer const_pointer;\n\n      typedef typename PB_DS_TYPES_TRAITS_C_DEC::reference reference;\n\n      typedef\n      typename PB_DS_TYPES_TRAITS_C_DEC::const_reference\n      const_reference;\n\n      typedef\n      typename Node_And_It_Traits::const_point_iterator\n      const_point_iterator;\n\n      typedef const_point_iterator const_iterator;\n\n      typedef typename Node_And_It_Traits::point_iterator point_iterator;\n\n      typedef point_iterator iterator;\n\n      typedef\n      typename Node_And_It_Traits::const_reverse_iterator\n      const_reverse_iterator;\n\n      typedef typename Node_And_It_Traits::reverse_iterator reverse_iterator;\n\n      typedef\n      typename Node_And_It_Traits::const_node_iterator\n      const_node_iterator;\n\n      typedef typename Node_And_It_Traits::node_iterator node_iterator;\n\n      typedef Cmp_Fn cmp_fn;\n\n      typedef Allocator allocator;\n\n      typedef typename Node_And_It_Traits::node_update node_update;\n\n    public:\n\n      PB_DS_CLASS_NAME();\n\n      PB_DS_CLASS_NAME(const Cmp_Fn& r_cmp_fn);\n\n      PB_DS_CLASS_NAME(const Cmp_Fn& r_cmp_fn, const node_update& r_update);\n\n      PB_DS_CLASS_NAME(const PB_DS_CLASS_C_DEC& other);\n\n      void\n      swap(PB_DS_CLASS_C_DEC& other);\n\n      ~PB_DS_CLASS_NAME();\n\n      inline bool\n      empty() const;\n\n      inline size_type\n      size() const;\n\n      inline size_type\n      max_size() const;\n\n      Cmp_Fn& \n      get_cmp_fn();\n\n      const Cmp_Fn& \n      get_cmp_fn() const;\n\n      inline point_iterator\n      lower_bound(const_key_reference r_key);\n\n      inline const_point_iterator\n      lower_bound(const_key_reference r_key) const;\n\n      inline point_iterator\n      upper_bound(const_key_reference r_key);\n\n      inline const_point_iterator\n      upper_bound(const_key_reference r_key) const;\n\n      inline point_iterator\n      find(const_key_reference r_key);\n\n      inline const_point_iterator\n      find(const_key_reference r_key) const;\n\n      inline iterator\n      begin();\n\n      inline const_iterator\n      begin() const;\n\n      inline iterator\n      end();\n\n      inline const_iterator\n      end() const;\n\n      inline reverse_iterator\n      rbegin();\n\n      inline const_reverse_iterator\n      rbegin() const;\n\n      inline reverse_iterator\n      rend();\n\n      inline const_reverse_iterator\n      rend() const;\n\n      inline const_node_iterator\n      node_begin() const;\n\n      inline node_iterator\n      node_begin();\n\n      inline const_node_iterator\n      node_end() const;\n\n      inline node_iterator\n      node_end();\n\n      void\n      clear();\n\n    protected:\n\n      void\n      value_swap(PB_DS_CLASS_C_DEC& other);\n\n      void\n      initialize_min_max();\n\n      inline iterator\n      insert_imp_empty(const_reference r_value);\n\n      inline iterator\n      insert_leaf_new(const_reference r_value, node_pointer p_nd, bool left_nd);\n\n      inline node_pointer\n      get_new_node_for_leaf_insert(const_reference r_val, false_type);\n\n      inline node_pointer\n      get_new_node_for_leaf_insert(const_reference r_val, true_type);\n\n      inline void\n      actual_erase_node(node_pointer p_nd);\n\n      inline std::pair<node_pointer, bool>\n      erase(node_pointer p_nd);\n\n      inline void\n      update_min_max_for_erased_node(node_pointer p_nd);\n\n      static void\n      clear_imp(node_pointer p_nd);\n\n      inline std::pair<\n\tpoint_iterator,\n\tbool>\n      insert_leaf(const_reference r_value);\n\n      inline void\n      rotate_left(node_pointer p_x);\n\n      inline void\n      rotate_right(node_pointer p_y);\n\n      inline void\n      rotate_parent(node_pointer p_nd);\n\n      inline void\n      apply_update(node_pointer p_nd, null_node_update_pointer);\n\n      template<typename Node_Update_>\n      inline void\n      apply_update(node_pointer p_nd, Node_Update_* p_update);\n\n      inline void\n      update_to_top(node_pointer p_nd, null_node_update_pointer);\n\n      template<typename Node_Update_>\n      inline void\n      update_to_top(node_pointer p_nd, Node_Update_* p_update);\n\n      bool\n      join_prep(PB_DS_CLASS_C_DEC& other);\n\n      void\n      join_finish(PB_DS_CLASS_C_DEC& other);\n\n      bool\n      split_prep(const_key_reference r_key, PB_DS_CLASS_C_DEC& other);\n\n      void\n      split_finish(PB_DS_CLASS_C_DEC& other);\n\n      size_type\n      recursive_count(node_pointer p_nd) const;\n\n#ifdef _GLIBCXX_DEBUG\n      void\n      assert_valid() const;\n\n      void\n      structure_only_assert_valid() const;\n\n      void\n      assert_node_consistent(const node_pointer p_nd) const;\n#endif \n\n    private:\n#ifdef _GLIBCXX_DEBUG\n      void\n      assert_iterators() const;\n\n      void\n      assert_consistent_with_debug_base() const;\n\n      void\n      assert_node_consistent_with_left(const node_pointer p_nd) const;\n\n      void\n      assert_node_consistent_with_right(const node_pointer p_nd) const;\n\n      void\n      assert_consistent_with_debug_base(const node_pointer p_nd) const;\n\n      void\n      assert_min() const;\n\n      void\n      assert_min_imp(const node_pointer p_nd) const;\n\n      void\n      assert_max() const;\n\n      void\n      assert_max_imp(const node_pointer p_nd) const;\n\n      void\n      assert_size() const;\n\n      typedef std::pair< const_pointer, const_pointer> node_consistent_t;\n\n      node_consistent_t\n      assert_node_consistent_(const node_pointer p_nd) const;\n#endif \n\n      void\n      initialize();\n\n      node_pointer\n      recursive_copy_node(const node_pointer p_nd);\n\n    protected:\n      node_pointer m_p_head;\n\n      size_type m_size;\n\n      static node_allocator s_node_allocator;\n    };\n\n#include <ext/pb_ds/detail/bin_search_tree_/constructors_destructor_fn_imps.hpp>\n#include <ext/pb_ds/detail/bin_search_tree_/iterators_fn_imps.hpp>\n#include <ext/pb_ds/detail/bin_search_tree_/debug_fn_imps.hpp>\n#include <ext/pb_ds/detail/bin_search_tree_/insert_fn_imps.hpp>\n#include <ext/pb_ds/detail/bin_search_tree_/erase_fn_imps.hpp>\n#include <ext/pb_ds/detail/bin_search_tree_/find_fn_imps.hpp>\n#include <ext/pb_ds/detail/bin_search_tree_/info_fn_imps.hpp>\n#include <ext/pb_ds/detail/bin_search_tree_/split_join_fn_imps.hpp>\n#include <ext/pb_ds/detail/bin_search_tree_/rotate_fn_imps.hpp>\n#include <ext/pb_ds/detail/bin_search_tree_/policy_access_fn_imps.hpp>\n\n#undef PB_DS_CLASS_C_DEC\n\n#undef PB_DS_CLASS_T_DEC\n\n#undef PB_DS_CLASS_NAME\n\n#undef PB_DS_TYPES_TRAITS_C_DEC\n\n#undef PB_DS_MAP_DEBUG_BASE_C_DEC\n\n#ifdef PB_DS_TREE_TRACE\n#undef PB_DS_TREE_TRACE_BASE_C_DEC\n#endif \n\n#undef PB_DS_V2F\n#undef PB_DS_EP2VP\n#undef PB_DS_V2S\n\n  } // namespace detail\n} // namespace pb_ds\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/detail/bin_search_tree_/cond_dtor_entry_dealtor.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file cond_dtor_entry_dealtor.hpp\n * Contains a binary tree container conditional deallocator\n */\n\nclass bin_search_tree_cond_dtor_entry_dealtor_\n{\npublic:\n  inline\n  bin_search_tree_cond_dtor_entry_dealtor_(node_pointer p_nd) : m_p_nd(p_nd),\n\t\t\t\t\t\t\t\tm_no_action_dtor(false)\n  { }\n\n  inline void\n  set_no_action_dtor()\n  {\n    m_no_action_dtor = true;\n  }\n\n  inline\n  ~bin_search_tree_cond_dtor_entry_dealtor_()\n  {\n    if (m_no_action_dtor)\n      return;\n\n    typename Allocator::template rebind<Node>::other().\n      deallocate(m_p_nd, 1);\n  }\n\nprotected:\n  node_pointer m_p_nd;\n\n  bool m_no_action_dtor;\n};\n\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/detail/bin_search_tree_/cond_key_dtor_entry_dealtor.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file cond_key_dtor_entry_dealtor.hpp\n * Contains a binary tree container conditional deallocator\n */\n\nclass bin_seach_tree_cond_key_dtor_entry_dealtor_\n{\npublic:\n  inline\n  bin_seach_tree_cond_key_dtor_entry_dealtor_(node_pointer p_nd) : m_p_nd(p_nd),\n\t\t\t\t\t\t\t\t   m_no_action_dtor(false),\n\t\t\t\t\t\t\t\t   m_key_destruct(false)\n  { }\n\n  inline void\n  set_no_action_dtor()\n  {\n    m_no_action_dtor = true;\n  }\n\n  inline void\n  set_key_destruct()\n  {\n    m_key_destruct = true;\n  }\n\n  inline\n  ~bin_seach_tree_cond_key_dtor_entry_dealtor_()\n  {\n    if (m_no_action_dtor)\n      return;\n\n    if (m_key_destruct)\n      m_p_nd->m_value.first.~Key();\n\n    bin_tree_base::s_alloc.deallocate(m_p_nd, 1);\n  }\n\nprotected:\n  node_pointer m_p_nd;\n\n  bool m_no_action_dtor;\n\n  bool m_key_destruct;\n};\n\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/detail/bin_search_tree_/constructors_destructor_fn_imps.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file constructors_destructor_fn_imps.hpp\n * Contains an implementation class for bin_search_tree_.\n */\n\nPB_DS_CLASS_T_DEC\ntypename PB_DS_CLASS_C_DEC::node_allocator\nPB_DS_CLASS_C_DEC::s_node_allocator;\n\nPB_DS_CLASS_T_DEC\nPB_DS_CLASS_C_DEC::\nPB_DS_CLASS_NAME() : m_p_head(s_node_allocator.allocate(1)), m_size(0)\n{\n  initialize();\n  _GLIBCXX_DEBUG_ONLY(structure_only_assert_valid();)\n}\n\nPB_DS_CLASS_T_DEC\nPB_DS_CLASS_C_DEC::\nPB_DS_CLASS_NAME(const Cmp_Fn& r_cmp_fn) :\n  Cmp_Fn(r_cmp_fn), m_p_head(s_node_allocator.allocate(1)), m_size(0)\n{\n  initialize();\n  _GLIBCXX_DEBUG_ONLY(structure_only_assert_valid();)\n}\n\nPB_DS_CLASS_T_DEC\nPB_DS_CLASS_C_DEC::\nPB_DS_CLASS_NAME(const Cmp_Fn& r_cmp_fn, const node_update& r_node_update) :\n  Cmp_Fn(r_cmp_fn),\n  node_update(r_node_update),\n  m_p_head(s_node_allocator.allocate(1)),\n  m_size(0)\n{\n  initialize();\n  _GLIBCXX_DEBUG_ONLY(structure_only_assert_valid();)\n}\n\nPB_DS_CLASS_T_DEC\nPB_DS_CLASS_C_DEC::\nPB_DS_CLASS_NAME(const PB_DS_CLASS_C_DEC& other) :\n#ifdef _GLIBCXX_DEBUG\n  map_debug_base(other),\n#endif \n#ifdef PB_DS_TREE_TRACE\n  PB_DS_TREE_TRACE_BASE_C_DEC(other),\n#endif \n  Cmp_Fn(other),\n  node_update(other),\n  m_p_head(s_node_allocator.allocate(1)),\n  m_size(0)\n{\n  initialize();\n  m_size = other.m_size;\n  _GLIBCXX_DEBUG_ONLY(other.structure_only_assert_valid();)\n\n    try\n      {\n        m_p_head->m_p_parent = recursive_copy_node(other.m_p_head->m_p_parent);\n        if (m_p_head->m_p_parent != NULL)\n\t  m_p_head->m_p_parent->m_p_parent = m_p_head;\n        m_size = other.m_size;\n        initialize_min_max();\n      }\n    catch(...)\n      {\n        _GLIBCXX_DEBUG_ONLY(map_debug_base::clear();)\n\ts_node_allocator.deallocate(m_p_head, 1);\n        __throw_exception_again;\n      }\n  _GLIBCXX_DEBUG_ONLY(structure_only_assert_valid();)\n}\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nswap(PB_DS_CLASS_C_DEC& other)\n{\n  _GLIBCXX_DEBUG_ONLY(structure_only_assert_valid();)\n  _GLIBCXX_DEBUG_ONLY(other.structure_only_assert_valid();)\n  value_swap(other);\n  std::swap((Cmp_Fn& )(*this), (Cmp_Fn& )other);\n  _GLIBCXX_DEBUG_ONLY(structure_only_assert_valid();)\n  _GLIBCXX_DEBUG_ONLY(other.structure_only_assert_valid();)\n}\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nvalue_swap(PB_DS_CLASS_C_DEC& other)\n{\n  _GLIBCXX_DEBUG_ONLY(map_debug_base::swap(other);)\n  std::swap(m_p_head, other.m_p_head);\n  std::swap(m_size, other.m_size);\n}\n\nPB_DS_CLASS_T_DEC\nPB_DS_CLASS_C_DEC::\n~PB_DS_CLASS_NAME()\n{\n  clear();\n  s_node_allocator.deallocate(m_p_head, 1);\n}\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\ninitialize()\n{\n  m_p_head->m_p_parent = NULL;\n  m_p_head->m_p_left = m_p_head;\n  m_p_head->m_p_right = m_p_head;\n  m_size = 0;\n}\n\nPB_DS_CLASS_T_DEC\ntypename PB_DS_CLASS_C_DEC::node_pointer\nPB_DS_CLASS_C_DEC::\nrecursive_copy_node(const node_pointer p_nd)\n{\n  if (p_nd == NULL)\n    return (NULL);\n\n  node_pointer p_ret = s_node_allocator.allocate(1);\n  try\n    {\n      new (p_ret) node(*p_nd);\n    }\n  catch(...)\n    {\n      s_node_allocator.deallocate(p_ret, 1);\n      __throw_exception_again;\n    }\n\n  p_ret->m_p_left = p_ret->m_p_right = NULL;\n\n  try\n    {\n      p_ret->m_p_left = recursive_copy_node(p_nd->m_p_left);\n      p_ret->m_p_right = recursive_copy_node(p_nd->m_p_right);\n    }\n  catch(...)\n    {\n      clear_imp(p_ret);\n      __throw_exception_again;\n    }\n\n  if (p_ret->m_p_left != NULL)\n    p_ret->m_p_left->m_p_parent = p_ret;\n\n  if (p_ret->m_p_right != NULL)\n    p_ret->m_p_right->m_p_parent = p_ret;\n\n  _GLIBCXX_DEBUG_ONLY(assert_node_consistent(p_ret);)\n  return p_ret;\n}\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\ninitialize_min_max()\n{\n  if (m_p_head->m_p_parent == NULL)\n    {\n      m_p_head->m_p_left = m_p_head->m_p_right = m_p_head;\n      return;\n    }\n\n  {\n    node_pointer p_min = m_p_head->m_p_parent;\n    while (p_min->m_p_left != NULL)\n      p_min = p_min->m_p_left;\n    m_p_head->m_p_left = p_min;\n  }\n\n  {\n    node_pointer p_max = m_p_head->m_p_parent;\n    while (p_max->m_p_right != NULL)\n      p_max = p_max->m_p_right;\n    m_p_head->m_p_right = p_max;\n  }\n}\n\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/detail/bin_search_tree_/debug_fn_imps.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file debug_fn_imps.hpp\n * Contains an implementation class for bin_search_tree_.\n */\n\n#ifdef _GLIBCXX_DEBUG\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nassert_valid() const\n{\n  structure_only_assert_valid();\n  assert_consistent_with_debug_base();\n  assert_size();\n  assert_iterators();\n  if (m_p_head->m_p_parent == NULL)\n    {\n      _GLIBCXX_DEBUG_ASSERT(m_size == 0);\n    }\n  else\n    {\n      _GLIBCXX_DEBUG_ASSERT(m_size > 0);\n    }\n}\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nstructure_only_assert_valid() const\n{\n  _GLIBCXX_DEBUG_ASSERT(m_p_head != NULL);\n  if (m_p_head->m_p_parent == NULL)\n    {\n      _GLIBCXX_DEBUG_ASSERT(m_p_head->m_p_left == m_p_head);\n      _GLIBCXX_DEBUG_ASSERT(m_p_head->m_p_right == m_p_head);\n    }\n  else\n    {\n      _GLIBCXX_DEBUG_ASSERT(m_p_head->m_p_parent->m_p_parent == m_p_head);\n      _GLIBCXX_DEBUG_ASSERT(m_p_head->m_p_left != m_p_head);\n      _GLIBCXX_DEBUG_ASSERT(m_p_head->m_p_right != m_p_head);\n    }\n\n  if (m_p_head->m_p_parent != NULL)\n    assert_node_consistent(m_p_head->m_p_parent);\n  assert_min();\n  assert_max();\n}\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nassert_node_consistent(const node_pointer p_nd) const\n{\n  assert_node_consistent_(p_nd);\n}\n\nPB_DS_CLASS_T_DEC\ntypename PB_DS_CLASS_C_DEC::node_consistent_t\nPB_DS_CLASS_C_DEC::\nassert_node_consistent_(const node_pointer p_nd) const\n{\n  if (p_nd == NULL)\n    return (std::make_pair((const_pointer)NULL,(const_pointer)NULL));\n\n  assert_node_consistent_with_left(p_nd);\n  assert_node_consistent_with_right(p_nd);\n\n  const std::pair<const_pointer, const_pointer>\n    l_range = assert_node_consistent_(p_nd->m_p_left);\n\n  if (l_range.second != NULL)\n    _GLIBCXX_DEBUG_ASSERT(Cmp_Fn::operator()(PB_DS_V2F(*l_range.second),\n\t\t\t\t\t     PB_DS_V2F(p_nd->m_value)));\n\n  const std::pair<const_pointer, const_pointer>\n    r_range = assert_node_consistent_(p_nd->m_p_right);\n\n  if (r_range.first != NULL)\n    _GLIBCXX_DEBUG_ASSERT(Cmp_Fn::operator()(PB_DS_V2F(p_nd->m_value),\n\t\t\t\t\t     PB_DS_V2F(*r_range.first)));\n\n  return (std::make_pair((l_range.first != NULL)? l_range.first :& p_nd->m_value,(r_range.second != NULL)? r_range.second :& p_nd->m_value));\n}\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nassert_node_consistent_with_left(const node_pointer p_nd) const\n{\n  if (p_nd->m_p_left == NULL)\n    return;\n  _GLIBCXX_DEBUG_ASSERT(p_nd->m_p_left->m_p_parent == p_nd);\n  _GLIBCXX_DEBUG_ASSERT(!Cmp_Fn::operator()(PB_DS_V2F(p_nd->m_value),\n\t\t\t\t\t    PB_DS_V2F(p_nd->m_p_left->m_value)));\n}\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nassert_node_consistent_with_right(const node_pointer p_nd) const\n{\n  if (p_nd->m_p_right == NULL)\n    return;\n  _GLIBCXX_DEBUG_ASSERT(p_nd->m_p_right->m_p_parent == p_nd);\n  _GLIBCXX_DEBUG_ASSERT(!Cmp_Fn::operator()(PB_DS_V2F(p_nd->m_p_right->m_value),\n\t\t\t\t       PB_DS_V2F(p_nd->m_value)));\n}\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nassert_min() const\n{\n  assert_min_imp(m_p_head->m_p_parent);\n}\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nassert_min_imp(const node_pointer p_nd) const\n{\n  if (p_nd == NULL)\n    {\n      _GLIBCXX_DEBUG_ASSERT(m_p_head->m_p_left == m_p_head);\n      return;\n    }\n\n  if (p_nd->m_p_left == NULL)\n    {\n      _GLIBCXX_DEBUG_ASSERT(p_nd == m_p_head->m_p_left);\n      return;\n    }\n  assert_min_imp(p_nd->m_p_left);\n}\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nassert_max() const\n{\n  assert_max_imp(m_p_head->m_p_parent);\n}\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nassert_max_imp(const node_pointer p_nd) const\n{\n  if (p_nd == NULL)\n    {\n      _GLIBCXX_DEBUG_ASSERT(m_p_head->m_p_right == m_p_head);\n      return;\n    }\n\n  if (p_nd->m_p_right == NULL)\n    {\n      _GLIBCXX_DEBUG_ASSERT(p_nd == m_p_head->m_p_right);\n      return;\n    }\n\n  assert_max_imp(p_nd->m_p_right);\n}\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nassert_iterators() const\n{\n  size_type iterated_num = 0;\n  const_iterator prev_it = end();\n  for (const_iterator it = begin(); it != end(); ++it)\n    {\n      ++iterated_num;\n      _GLIBCXX_DEBUG_ASSERT(lower_bound(PB_DS_V2F(*it)).m_p_nd == it.m_p_nd);\n      const_iterator upper_bound_it = upper_bound(PB_DS_V2F(*it));\n      --upper_bound_it;\n      _GLIBCXX_DEBUG_ASSERT(upper_bound_it.m_p_nd == it.m_p_nd);\n\n      if (prev_it != end())\n\t_GLIBCXX_DEBUG_ASSERT(Cmp_Fn::operator()(PB_DS_V2F(*prev_it),\n\t\t\t\t\t\t PB_DS_V2F(*it)));\n      prev_it = it;\n    }\n\n  _GLIBCXX_DEBUG_ASSERT(iterated_num == m_size);\n  size_type reverse_iterated_num = 0;\n  const_reverse_iterator reverse_prev_it = rend();\n  for (const_reverse_iterator reverse_it = rbegin(); reverse_it != rend();\n       ++reverse_it)\n    {\n      ++reverse_iterated_num;\n      _GLIBCXX_DEBUG_ASSERT(lower_bound(\n\t\t\t\t   PB_DS_V2F(*reverse_it)).m_p_nd == reverse_it.m_p_nd);\n\n      const_iterator upper_bound_it = upper_bound(PB_DS_V2F(*reverse_it));\n      --upper_bound_it;\n      _GLIBCXX_DEBUG_ASSERT(upper_bound_it.m_p_nd == reverse_it.m_p_nd);\n      if (reverse_prev_it != rend())\n\t_GLIBCXX_DEBUG_ASSERT(!Cmp_Fn::operator()(PB_DS_V2F(*reverse_prev_it),\n\t\t\t\t\t\t  PB_DS_V2F(*reverse_it)));\n      reverse_prev_it = reverse_it;\n    }\n  _GLIBCXX_DEBUG_ASSERT(reverse_iterated_num == m_size);\n}\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nassert_consistent_with_debug_base() const\n{\n  map_debug_base::check_size(m_size);\n  assert_consistent_with_debug_base(m_p_head->m_p_parent);\n}\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nassert_consistent_with_debug_base(const node_pointer p_nd) const\n{\n  if (p_nd == NULL)\n    return;\n  map_debug_base::check_key_exists(PB_DS_V2F(p_nd->m_value));\n  assert_consistent_with_debug_base(p_nd->m_p_left);\n  assert_consistent_with_debug_base(p_nd->m_p_right);\n}\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nassert_size() const\n{\n  _GLIBCXX_DEBUG_ASSERT(recursive_count(m_p_head->m_p_parent) == m_size);\n}\n\n#endif \n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/detail/bin_search_tree_/erase_fn_imps.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file erase_fn_imps.hpp\n * Contains an implementation class for bin_search_tree_.\n */\n\nPB_DS_CLASS_T_DEC\ninline void\nPB_DS_CLASS_C_DEC::\nactual_erase_node(node_pointer p_z)\n{\n  _GLIBCXX_DEBUG_ASSERT(m_size > 0);\n  --m_size;\n\n  _GLIBCXX_DEBUG_ONLY(erase_existing(PB_DS_V2F(p_z->m_value)));\n\n  p_z->~node();\n\n  s_node_allocator.deallocate(p_z, 1);\n}\n\nPB_DS_CLASS_T_DEC\ninline void\nPB_DS_CLASS_C_DEC::\nupdate_min_max_for_erased_node(node_pointer p_z)\n{\n  if (m_size == 1)\n    {\n      m_p_head->m_p_left = m_p_head->m_p_right = m_p_head;\n\n      return;\n    }\n\n  if (m_p_head->m_p_left == p_z)\n    {\n      iterator it(p_z);\n\n      ++it;\n\n      m_p_head->m_p_left = it.m_p_nd;\n    }\n  else if (m_p_head->m_p_right == p_z)\n    {\n      iterator it(p_z);\n\n      --it;\n\n      m_p_head->m_p_right = it.m_p_nd;\n    }\n}\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nclear()\n{\n  _GLIBCXX_DEBUG_ONLY(structure_only_assert_valid();)\n\n    clear_imp(m_p_head->m_p_parent);\n\n  m_size = 0;\n\n  initialize();\n\n  _GLIBCXX_DEBUG_ONLY(map_debug_base::clear();)\n\n    _GLIBCXX_DEBUG_ONLY(structure_only_assert_valid();)\n    }\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nclear_imp(node_pointer p_nd)\n{\n  if (p_nd == NULL)\n    return;\n\n  clear_imp(p_nd->m_p_left);\n\n  clear_imp(p_nd->m_p_right);\n\n  p_nd->~node();\n\n  s_node_allocator.deallocate(p_nd, 1);\n}\n\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/detail/bin_search_tree_/find_fn_imps.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file find_fn_imps.hpp\n * Contains an implementation class for bin_search_tree_.\n */\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::const_point_iterator\nPB_DS_CLASS_C_DEC::\nlower_bound(const_key_reference r_key) const\n{\n  node_pointer p_pot = m_p_head;\n  node_pointer p_nd = m_p_head->m_p_parent;\n\n  while (p_nd != NULL)\n    if (Cmp_Fn::operator()(\n\t\t\t   PB_DS_V2F(p_nd->m_value),\n\t\t\t   r_key))\n      p_nd = p_nd->m_p_right;\n    else\n      {\n\tp_pot = p_nd;\n\n\tp_nd = p_nd->m_p_left;\n      }\n\n  return (iterator(p_pot));\n}\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::point_iterator\nPB_DS_CLASS_C_DEC::\nlower_bound(const_key_reference r_key)\n{\n  node_pointer p_pot = m_p_head;\n  node_pointer p_nd = m_p_head->m_p_parent;\n\n  while (p_nd != NULL)\n    if (Cmp_Fn::operator()(\n\t\t\t   PB_DS_V2F(p_nd->m_value),\n\t\t\t   r_key))\n      p_nd = p_nd->m_p_right;\n    else\n      {\n\tp_pot = p_nd;\n\n\tp_nd = p_nd->m_p_left;\n      }\n\n  return (iterator(p_pot));\n}\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::const_point_iterator\nPB_DS_CLASS_C_DEC::\nupper_bound(const_key_reference r_key) const\n{\n  node_pointer p_pot = m_p_head;\n  node_pointer p_nd = m_p_head->m_p_parent;\n\n  while (p_nd != NULL)\n    if (Cmp_Fn::operator()(r_key,\n\t\t\t   PB_DS_V2F(p_nd->m_value)))\n      {\n\tp_pot = p_nd,\n\n\t  p_nd = p_nd->m_p_left;\n      }\n    else\n      p_nd = p_nd->m_p_right;\n\n  return (const_iterator(p_pot));\n}\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::point_iterator\nPB_DS_CLASS_C_DEC::\nupper_bound(const_key_reference r_key)\n{\n  node_pointer p_pot = m_p_head;\n  node_pointer p_nd = m_p_head->m_p_parent;\n\n  while (p_nd != NULL)\n    if (Cmp_Fn::operator()(r_key,\n\t\t\t   PB_DS_V2F(p_nd->m_value)))\n      {\n\tp_pot = p_nd,\n\n\t  p_nd = p_nd->m_p_left;\n      }\n    else\n      p_nd = p_nd->m_p_right;\n\n  return (point_iterator(p_pot));\n}\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::point_iterator\nPB_DS_CLASS_C_DEC::\nfind(const_key_reference r_key)\n{\n  _GLIBCXX_DEBUG_ONLY(structure_only_assert_valid();)\n\n    node_pointer p_pot = m_p_head;\n  node_pointer p_nd = m_p_head->m_p_parent;\n\n  while (p_nd != NULL)\n    if (!Cmp_Fn::operator()(PB_DS_V2F(p_nd->m_value), r_key))\n      {\n\tp_pot = p_nd;\n\n\tp_nd = p_nd->m_p_left;\n      }\n    else\n      p_nd = p_nd->m_p_right;\n\n  return point_iterator((p_pot != m_p_head&&  Cmp_Fn::operator()(\n\t\t\t\t\t\t\t\t r_key,\n\t\t\t\t\t\t\t\t PB_DS_V2F(p_pot->m_value)))?\n\t\t\tm_p_head : p_pot);\n}\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::const_point_iterator\nPB_DS_CLASS_C_DEC::\nfind(const_key_reference r_key) const\n{\n  _GLIBCXX_DEBUG_ONLY(structure_only_assert_valid();)\n\n    node_pointer p_pot = m_p_head;\n  node_pointer p_nd = m_p_head->m_p_parent;\n\n  while (p_nd != NULL)\n    if (!Cmp_Fn::operator()(PB_DS_V2F(p_nd->m_value), r_key))\n      {\n\tp_pot = p_nd;\n\n\tp_nd = p_nd->m_p_left;\n      }\n    else\n      p_nd = p_nd->m_p_right;\n\n  return const_point_iterator((p_pot != m_p_head&&  Cmp_Fn::operator()(\n\t\t\t\t\t\t\t\t       r_key,\n\t\t\t\t\t\t\t\t       PB_DS_V2F(p_pot->m_value)))?\n\t\t\t      m_p_head : p_pot);\n}\n\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/detail/bin_search_tree_/info_fn_imps.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file info_fn_imps.hpp\n * Contains an implementation class for bin_search_tree_.\n */\n\nPB_DS_CLASS_T_DEC\ninline bool\nPB_DS_CLASS_C_DEC::\nempty() const\n{\n  return (m_size == 0);\n}\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::size_type\nPB_DS_CLASS_C_DEC::\nsize() const\n{\n  return (m_size);\n}\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::size_type\nPB_DS_CLASS_C_DEC::\nmax_size() const\n{\n  return (s_node_allocator.max_size());\n}\n\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/detail/bin_search_tree_/insert_fn_imps.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file insert_fn_imps.hpp\n * Contains an implementation class for bin_search_tree_.\n */\n\nPB_DS_CLASS_T_DEC\ninline std::pair<typename PB_DS_CLASS_C_DEC::point_iterator, bool>\nPB_DS_CLASS_C_DEC::\ninsert_leaf(const_reference r_value)\n{\n  _GLIBCXX_DEBUG_ONLY(structure_only_assert_valid();)\n\n    if (m_size == 0)\n      return (std::make_pair(\n\t\t\t     insert_imp_empty(r_value),\n\t\t\t     true));\n\n  node_pointer p_nd = m_p_head->m_p_parent;\n  node_pointer p_pot = m_p_head;\n\n  while (p_nd != NULL)\n    if (!Cmp_Fn::operator()(\n\t\t\t    PB_DS_V2F(p_nd->m_value),\n\t\t\t    PB_DS_V2F(r_value)))\n      {\n\tp_pot = p_nd;\n\n\tp_nd = p_nd->m_p_left;\n      }\n    else\n      p_nd = p_nd->m_p_right;\n\n  if (p_pot == m_p_head)\n    return (std::make_pair(\n\t\t\t   insert_leaf_new(r_value,  m_p_head->m_p_right, false),\n\t\t\t   true));\n\n  if (!Cmp_Fn::operator()(\n\t\t\t  PB_DS_V2F(r_value),\n\t\t\t  PB_DS_V2F(p_pot->m_value)))\n    {\n      _GLIBCXX_DEBUG_ONLY(structure_only_assert_valid();)\n\n        _GLIBCXX_DEBUG_ONLY(map_debug_base::check_key_exists(\n\t\t\t\t\t\t\tPB_DS_V2F(r_value)));\n\n      return (std::make_pair(p_pot, false));\n    }\n\n  _GLIBCXX_DEBUG_ONLY(map_debug_base::check_key_does_not_exist(\n\t\t\t\t\t\t\t  PB_DS_V2F(r_value)));\n\n  p_nd = p_pot->m_p_left;\n  if (p_nd == NULL)\n    return (std::make_pair(\n\t\t\t   insert_leaf_new(r_value, p_pot, true),\n\t\t\t   true));\n\n  while (p_nd->m_p_right != NULL)\n    p_nd = p_nd->m_p_right;\n\n  return (std::make_pair(\n\t\t\t insert_leaf_new(r_value, p_nd, false),\n\t\t\t true));\n}\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::iterator\nPB_DS_CLASS_C_DEC::\ninsert_leaf_new(const_reference r_value, node_pointer p_nd, bool left_nd)\n{\n  node_pointer p_new_nd =\n    get_new_node_for_leaf_insert(            r_value, traits_base::m_no_throw_copies_indicator);\n\n  if (left_nd)\n    {\n      _GLIBCXX_DEBUG_ASSERT(p_nd->m_p_left == NULL);\n      _GLIBCXX_DEBUG_ASSERT(Cmp_Fn::operator()(\n\t\t\t\t\t  PB_DS_V2F(r_value),\n\t\t\t\t\t  PB_DS_V2F(p_nd->m_value)));\n\n      p_nd->m_p_left = p_new_nd;\n\n      if (m_p_head->m_p_left == p_nd)\n\tm_p_head->m_p_left = p_new_nd;\n    }\n  else\n    {\n      _GLIBCXX_DEBUG_ASSERT(p_nd->m_p_right == NULL);\n      _GLIBCXX_DEBUG_ASSERT(Cmp_Fn::operator()(\n\t\t\t\t\t  PB_DS_V2F(p_nd->m_value),\n\t\t\t\t\t  PB_DS_V2F(r_value)));\n\n      p_nd->m_p_right = p_new_nd;\n\n      if (m_p_head->m_p_right == p_nd)\n\tm_p_head->m_p_right = p_new_nd;\n    }\n\n  p_new_nd->m_p_parent = p_nd;\n\n  p_new_nd->m_p_left = p_new_nd->m_p_right = NULL;\n\n  _GLIBCXX_DEBUG_ONLY(assert_node_consistent(p_nd));\n\n  update_to_top(p_new_nd, (node_update* )this);\n\n  _GLIBCXX_DEBUG_ONLY(map_debug_base::insert_new(\n\t\t\t\t\t    PB_DS_V2F(r_value)));\n\n  return (iterator(p_new_nd));\n}\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::iterator\nPB_DS_CLASS_C_DEC::\ninsert_imp_empty(const_reference r_value)\n{\n  node_pointer p_new_node =\n    get_new_node_for_leaf_insert(        r_value, traits_base::m_no_throw_copies_indicator);\n\n  m_p_head->m_p_left = m_p_head->m_p_right =\n    m_p_head->m_p_parent = p_new_node;\n\n  p_new_node->m_p_parent = m_p_head;\n\n  p_new_node->m_p_left = p_new_node->m_p_right = NULL;\n\n  _GLIBCXX_DEBUG_ONLY(map_debug_base::insert_new(\n\t\t\t\t\t    PB_DS_V2F(r_value)));\n\n  update_to_top(m_p_head->m_p_parent, (node_update* )this);\n\n  return (iterator(p_new_node));\n}\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::node_pointer\nPB_DS_CLASS_C_DEC::\nget_new_node_for_leaf_insert(const_reference r_val, false_type)\n{\n  node_pointer p_new_nd = s_node_allocator.allocate(1);\n\n  cond_dealtor_t cond(p_new_nd);\n\n  new (const_cast<void* >(\n\t\t\t  static_cast<const void* >(&p_new_nd->m_value)))\n    typename node::value_type(r_val);\n\n  cond.set_no_action();\n\n  p_new_nd->m_p_left = p_new_nd->m_p_right = NULL;\n\n  ++m_size;\n\n  return (p_new_nd);\n}\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::node_pointer\nPB_DS_CLASS_C_DEC::\nget_new_node_for_leaf_insert(const_reference r_val, true_type)\n{\n  node_pointer p_new_nd = s_node_allocator.allocate(1);\n\n  new (const_cast<void* >(\n\t\t\t  static_cast<const void* >(&p_new_nd->m_value)))\n    typename node::value_type(r_val);\n\n  p_new_nd->m_p_left = p_new_nd->m_p_right = NULL;\n\n  ++m_size;\n\n  return (p_new_nd);\n}\n\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/detail/bin_search_tree_/iterators_fn_imps.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file iterators_fn_imps.hpp\n * Contains an implementation class for bin_search_tree_.\n */\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::iterator\nPB_DS_CLASS_C_DEC::\nbegin()\n{\n  return (iterator(m_p_head->m_p_left));\n}\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::const_iterator\nPB_DS_CLASS_C_DEC::\nbegin() const\n{\n  return (const_iterator(m_p_head->m_p_left));\n}\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::iterator\nPB_DS_CLASS_C_DEC::\nend()\n{\n  return (iterator(m_p_head));\n}\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::const_iterator\nPB_DS_CLASS_C_DEC::\nend() const\n{\n  return (const_iterator(m_p_head));\n}\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::const_reverse_iterator\nPB_DS_CLASS_C_DEC::\nrbegin() const\n{\n  return (const_reverse_iterator(m_p_head->m_p_right));\n}\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::reverse_iterator\nPB_DS_CLASS_C_DEC::\nrbegin()\n{\n  return (reverse_iterator(m_p_head->m_p_right));\n}\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::reverse_iterator\nPB_DS_CLASS_C_DEC::\nrend()\n{\n  return (reverse_iterator(m_p_head));\n}\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::const_reverse_iterator\nPB_DS_CLASS_C_DEC::\nrend() const\n{\n  return (const_reverse_iterator(m_p_head));\n}\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::const_node_iterator\nPB_DS_CLASS_C_DEC::\nnode_begin() const\n{\n  return (const_node_iterator(m_p_head->m_p_parent));\n}\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::node_iterator\nPB_DS_CLASS_C_DEC::\nnode_begin()\n{\n  return (node_iterator(m_p_head->m_p_parent));\n}\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::const_node_iterator\nPB_DS_CLASS_C_DEC::\nnode_end() const\n{\n  return (const_node_iterator(NULL));\n}\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::node_iterator\nPB_DS_CLASS_C_DEC::\nnode_end()\n{\n  return (node_iterator(NULL));\n}\n\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/detail/bin_search_tree_/node_iterators.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file node_iterators.hpp\n * Contains an implementation class for bin_search_tree_.\n */\n\n#ifndef PB_DS_BIN_SEARCH_TREE_NODE_ITERATORS_HPP\n#define PB_DS_BIN_SEARCH_TREE_NODE_ITERATORS_HPP\n\n#include <ext/pb_ds/tag_and_trait.hpp>\n\nnamespace pb_ds\n{\n  namespace detail\n  {\n\n#define PB_DS_TREE_CONST_NODE_ITERATOR_CLASS_C_DEC\t\t\t\\\n    bin_search_tree_const_node_it_<\t\t\t\t\t\\\n\t\t\t\t\t\t\tNode,\t\t\\\n\t\t\t\t\t\t\tConst_Iterator,\t\\\n\t\t\t\t\t\t\tIterator,\t\\\n\t\t\t\t\t\t\tAllocator>\n\n    // Const node iterator.\n    template<typename Node,\n\t     class Const_Iterator,\n\t     class Iterator,\n\t     class Allocator>\n    class bin_search_tree_const_node_it_\n    {\n    private:\n\n    private:\n      typedef\n      typename Allocator::template rebind<\n      Node>::other::pointer\n      node_pointer;\n\n    public:\n\n      // Category.\n      typedef trivial_iterator_tag iterator_category;\n\n      // Difference type.\n      typedef trivial_iterator_difference_type difference_type;\n\n      // __Iterator's value type.\n      typedef Const_Iterator value_type;\n\n      // __Iterator's reference type.\n      typedef Const_Iterator reference;\n\n      // __Iterator's __const reference type.\n      typedef Const_Iterator const_reference;\n\n      // Metadata type.\n      typedef typename Node::metadata_type metadata_type;\n\n      // Const metadata reference type.\n      typedef\n      typename Allocator::template rebind<\n\tmetadata_type>::other::const_reference\n      const_metadata_reference;\n\n    public:\n\n      // Default constructor.\n      /*\n\tinline\n\tbin_search_tree_const_node_it_()\n      */\n\n      inline\n      bin_search_tree_const_node_it_(const node_pointer p_nd = NULL) : m_p_nd(const_cast<node_pointer>(p_nd))\n      { }\n\n      // Access.\n      inline const_reference\n      operator*() const\n      {\n\treturn (Const_Iterator(m_p_nd));\n      }\n\n      // Metadata access.\n      inline const_metadata_reference\n      get_metadata() const\n      {\n\treturn (m_p_nd->get_metadata());\n      }\n\n      // Returns the __const node iterator associated with the left node.\n      inline PB_DS_TREE_CONST_NODE_ITERATOR_CLASS_C_DEC\n      get_l_child() const\n      {\n\treturn (PB_DS_TREE_CONST_NODE_ITERATOR_CLASS_C_DEC(m_p_nd->m_p_left));\n      }\n\n      // Returns the __const node iterator associated with the right node.\n      inline PB_DS_TREE_CONST_NODE_ITERATOR_CLASS_C_DEC\n      get_r_child() const\n      {\n\treturn (PB_DS_TREE_CONST_NODE_ITERATOR_CLASS_C_DEC(m_p_nd->m_p_right));\n      }\n\n      // Compares to a different iterator object.\n      inline bool\n      operator==(const PB_DS_TREE_CONST_NODE_ITERATOR_CLASS_C_DEC& other) const\n      {\n\treturn (m_p_nd == other.m_p_nd);\n      }\n\n      // Compares (negatively) to a different iterator object.\n      inline bool\n      operator!=(const PB_DS_TREE_CONST_NODE_ITERATOR_CLASS_C_DEC& other) const\n      {\n\treturn (m_p_nd != other.m_p_nd);\n      }\n\n    public:\n      node_pointer m_p_nd;\n    };\n\n#define PB_DS_TREE_NODE_ITERATOR_CLASS_C_DEC\t\t\t\\\n    bin_search_tree_node_it_<\t\t\t\t\t\\\n\t\t\t\t\t\tNode,\t\t\\\n\t\t\t\t\t\tConst_Iterator, \\\n\t\t\t\t\t\tIterator,\t\\\n\t\t\t\t\t\tAllocator>\n\n    // Node iterator.\n    template<typename Node,\n\t     class Const_Iterator,\n\t     class Iterator,\n\t     class Allocator>\n    class bin_search_tree_node_it_ : \n      public PB_DS_TREE_CONST_NODE_ITERATOR_CLASS_C_DEC\n\n    {\n\n    private:\n      typedef\n      typename Allocator::template rebind<\n      Node>::other::pointer\n      node_pointer;\n\n    public:\n\n      // __Iterator's value type.\n      typedef Iterator value_type;\n\n      // __Iterator's reference type.\n      typedef Iterator reference;\n\n      // __Iterator's __const reference type.\n      typedef Iterator const_reference;\n\n    public:\n\n      // Default constructor.\n      /*\n\tinline\n\tbin_search_tree_node_it_();\n      */\n\n      inline\n      bin_search_tree_node_it_(const node_pointer p_nd = NULL) : PB_DS_TREE_CONST_NODE_ITERATOR_CLASS_C_DEC(\n\t\t\t\t\t\t\t\t\t\t\t\t\t    const_cast<node_pointer>(p_nd))\n      { }\n\n      // Access.\n      inline Iterator\n      operator*() const\n      {\n\treturn (Iterator(PB_DS_TREE_CONST_NODE_ITERATOR_CLASS_C_DEC::m_p_nd));\n      }\n\n      // Returns the node iterator associated with the left node.\n      inline PB_DS_TREE_NODE_ITERATOR_CLASS_C_DEC\n      get_l_child() const\n      {\n\treturn (PB_DS_TREE_NODE_ITERATOR_CLASS_C_DEC(\n\t\t\t\t\t\t     PB_DS_TREE_CONST_NODE_ITERATOR_CLASS_C_DEC::m_p_nd->m_p_left));\n      }\n\n      // Returns the node iterator associated with the right node.\n      inline PB_DS_TREE_NODE_ITERATOR_CLASS_C_DEC\n      get_r_child() const\n      {\n\treturn (PB_DS_TREE_NODE_ITERATOR_CLASS_C_DEC(\n\t\t\t\t\t\t     PB_DS_TREE_CONST_NODE_ITERATOR_CLASS_C_DEC::m_p_nd->m_p_right));\n      }\n\n    };\n\n#undef PB_DS_TREE_CONST_NODE_ITERATOR_CLASS_C_DEC\n\n#undef PB_DS_TREE_NODE_ITERATOR_CLASS_C_DEC\n\n  } // namespace detail\n} // namespace pb_ds\n\n#endif // #ifndef PB_DS_BIN_SEARCH_TREE_NODE_ITERATORS_HPP\n\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/detail/bin_search_tree_/point_iterators.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file point_iterators.hpp\n * Contains an implementation class for bin_search_tree_.\n */\n\n#ifndef PB_DS_BIN_SEARCH_TREE_FIND_ITERATORS_HPP\n#define PB_DS_BIN_SEARCH_TREE_FIND_ITERATORS_HPP\n\n#include <ext/pb_ds/tag_and_trait.hpp>\n#include <debug/debug.h>\n\nnamespace pb_ds\n{\n  namespace detail\n  {\n\n#define PB_DS_TREE_CONST_IT_C_DEC\t\t\t\t\t\\\n    bin_search_tree_const_it_<\t\t\t\t\t\t\\\n\t\t\t\t\t\tNode_Pointer,\t\t\\\n\t\t\t\t\t\tValue_Type,\t\t\\\n\t\t\t\t\t\tPointer,\t\t\\\n\t\t\t\t\t\tConst_Pointer,\t\t\\\n\t\t\t\t\t\tReference,\t\t\\\n\t\t\t\t\t\tConst_Reference,\t\\\n\t\t\t\t\t\tIs_Forward_Iterator,\t\\\n\t\t\t\t\t\tAllocator>\n\n#define PB_DS_TREE_CONST_ODIR_IT_C_DEC\t\t\t\t\t\\\n    bin_search_tree_const_it_<\t\t\t\t\t\t\\\n\t\t\t\t\t\tNode_Pointer,\t\t\\\n\t\t\t\t\t\tValue_Type,\t\t\\\n\t\t\t\t\t\tPointer,\t\t\\\n\t\t\t\t\t\tConst_Pointer,\t\t\\\n\t\t\t\t\t\tReference,\t\t\\\n\t\t\t\t\t\tConst_Reference,\t\\\n\t\t\t\t\t\t!Is_Forward_Iterator,\t\\\n\t\t\t\t\t\tAllocator>\n\n#define PB_DS_TREE_IT_C_DEC\t\t\t\t\t\t\\\n    bin_search_tree_it_<\t\t\t\t\t\t\\\n\t\t\t\t\t\tNode_Pointer,\t\t\\\n\t\t\t\t\t\tValue_Type,\t\t\\\n\t\t\t\t\t\tPointer,\t\t\\\n\t\t\t\t\t\tConst_Pointer,\t\t\\\n\t\t\t\t\t\tReference,\t\t\\\n\t\t\t\t\t\tConst_Reference,\t\\\n\t\t\t\t\t\tIs_Forward_Iterator,\t\\\n\t\t\t\t\t\tAllocator>\n\n#define PB_DS_TREE_ODIR_IT_C_DEC\t\t\t\t\t\\\n    bin_search_tree_it_<\t\t\t\t\t\t\\\n\t\t\t\t\t\t\tNode_Pointer,\t\\\n\t\t\t\t\t\t\tValue_Type,\t\\\n\t\t\t\t\t\t\tPointer,\t\\\n\t\t\t\t\t\t\tConst_Pointer,\t\\\n\t\t\t\t\t\t\tReference,\t\\\n\t\t\t\t\t\t\tConst_Reference, \\\n\t\t\t\t\t\t\t!Is_Forward_Iterator, \\\n\t\t\t\t\t\t\tAllocator>\n\n    // Const iterator.\n    template<typename Node_Pointer,\n\t     typename Value_Type,\n\t     typename Pointer,\n\t     typename Const_Pointer,\n\t     typename Reference,\n\t     typename Const_Reference,\n\t     bool Is_Forward_Iterator,\n\t     class Allocator>\n    class bin_search_tree_const_it_\n    {\n\n    public:\n\n      typedef std::bidirectional_iterator_tag iterator_category;\n\n      typedef typename Allocator::difference_type difference_type;\n\n      typedef Value_Type value_type;\n\n      typedef Pointer pointer;\n\n      typedef Const_Pointer const_pointer;\n\n      typedef Reference reference;\n\n      typedef Const_Reference const_reference;\n\n    public:\n\n      inline\n      bin_search_tree_const_it_(const Node_Pointer p_nd = NULL) \n      : m_p_nd(const_cast<Node_Pointer>(p_nd))\n      { }\n\n      inline\n      bin_search_tree_const_it_(const PB_DS_TREE_CONST_ODIR_IT_C_DEC& other) \n      : m_p_nd(other.m_p_nd)\n      { }\n\n      inline\n      PB_DS_TREE_CONST_IT_C_DEC& \n      operator=(const PB_DS_TREE_CONST_IT_C_DEC& other)\n      {\n\tm_p_nd = other.m_p_nd;\n\treturn *this;\n      }\n\n      inline\n      PB_DS_TREE_CONST_IT_C_DEC& \n      operator=(const PB_DS_TREE_CONST_ODIR_IT_C_DEC& other)\n      {\n\tm_p_nd = other.m_p_nd;\n\treturn *this;\n      }\n\n      inline const_pointer\n      operator->() const\n      {\n\t_GLIBCXX_DEBUG_ASSERT(m_p_nd != NULL);\n\treturn &m_p_nd->m_value;\n      }\n\n      inline const_reference\n      operator*() const\n      {\n\t_GLIBCXX_DEBUG_ASSERT(m_p_nd != NULL);\n\treturn m_p_nd->m_value;\n      }\n\n      inline bool\n      operator==(const PB_DS_TREE_CONST_IT_C_DEC & other) const\n      { return m_p_nd == other.m_p_nd; }\n\n      inline bool\n      operator==(const PB_DS_TREE_CONST_ODIR_IT_C_DEC & other) const\n      { return m_p_nd == other.m_p_nd; }\n\n      inline bool\n      operator!=(const PB_DS_TREE_CONST_IT_C_DEC& other) const\n      { return m_p_nd != other.m_p_nd; }\n\n      inline bool\n      operator!=(const PB_DS_TREE_CONST_ODIR_IT_C_DEC& other) const\n      { return m_p_nd != other.m_p_nd; }\n\n      inline PB_DS_TREE_CONST_IT_C_DEC& \n      operator++()\n      {\n\t_GLIBCXX_DEBUG_ASSERT(m_p_nd != NULL);\n\tinc(integral_constant<int,Is_Forward_Iterator>());\n\treturn *this;\n      }\n\n      inline PB_DS_TREE_CONST_IT_C_DEC\n      operator++(int)\n      {\n\tPB_DS_TREE_CONST_IT_C_DEC ret_it(m_p_nd);\n\toperator++();\n\treturn ret_it;\n      }\n\n      inline PB_DS_TREE_CONST_IT_C_DEC& \n      operator--()\n      {\n\tdec(integral_constant<int,Is_Forward_Iterator>());\n\treturn *this;\n      }\n\n      inline PB_DS_TREE_CONST_IT_C_DEC\n      operator--(int)\n      {\n\tPB_DS_TREE_CONST_IT_C_DEC ret_it(m_p_nd);\n\toperator--();\n\treturn ret_it;\n      }\n\n    protected:\n      inline void\n      inc(false_type)\n      { dec(true_type()); }\n\n      void\n      inc(true_type)\n      {\n\tif (m_p_nd->special()&& \n\t    m_p_nd->m_p_parent->m_p_parent == m_p_nd)\n\t  {\n\t    m_p_nd = m_p_nd->m_p_left;\n\t    return;\n\t  }\n\n\tif (m_p_nd->m_p_right != NULL)\n\t  {\n\t    m_p_nd = m_p_nd->m_p_right;\n\t    while (m_p_nd->m_p_left != NULL)\n\t      m_p_nd = m_p_nd->m_p_left;\n\t    return;\n\t  }\n\n\tNode_Pointer p_y = m_p_nd->m_p_parent;\n\twhile (m_p_nd == p_y->m_p_right)\n\t  {\n\t    m_p_nd = p_y;\n\t    p_y = p_y->m_p_parent;\n\t  }\n\n\tif (m_p_nd->m_p_right != p_y)\n\t  m_p_nd = p_y;\n      }\n\n      inline void\n      dec(false_type)\n      { inc(true_type()); }\n\n      void\n      dec(true_type)\n      {\n\tif (m_p_nd->special() && m_p_nd->m_p_parent->m_p_parent == m_p_nd)\n\t  {\n\t    m_p_nd = m_p_nd->m_p_right;\n\t    return;\n\t  }\n\n\tif (m_p_nd->m_p_left != NULL)\n\t  {\n\t    Node_Pointer p_y = m_p_nd->m_p_left;\n\t    while (p_y->m_p_right != NULL)\n\t      p_y = p_y->m_p_right;\n\t    m_p_nd = p_y;\n\t    return;\n\t  }\n\n\tNode_Pointer p_y = m_p_nd->m_p_parent;\n\twhile (m_p_nd == p_y->m_p_left)\n\t  {\n\t    m_p_nd = p_y;\n\t    p_y = p_y->m_p_parent;\n\t  }\n\tif (m_p_nd->m_p_left != p_y)\n\t  m_p_nd = p_y;\n      }\n\n    public:\n      Node_Pointer m_p_nd;\n    };\n\n    // Iterator.\n    template<typename Node_Pointer,\n\t     typename Value_Type,\n\t     typename Pointer,\n\t     typename Const_Pointer,\n\t     typename Reference,\n\t     typename Const_Reference,\n\t     bool Is_Forward_Iterator,\n\t     class Allocator>\n    class bin_search_tree_it_ : \n      public PB_DS_TREE_CONST_IT_C_DEC\n\n    {\n\n    public:\n\n      inline\n      bin_search_tree_it_(const Node_Pointer p_nd = NULL) \n      : PB_DS_TREE_CONST_IT_C_DEC((Node_Pointer)p_nd)\n      { }\n\n      inline\n      bin_search_tree_it_(const PB_DS_TREE_ODIR_IT_C_DEC& other) \n      : PB_DS_TREE_CONST_IT_C_DEC(other.m_p_nd)\n      { }\n\n      inline\n      PB_DS_TREE_IT_C_DEC& \n      operator=(const PB_DS_TREE_IT_C_DEC& other)\n      {\n\tbase_it_type::m_p_nd = other.m_p_nd;\n\treturn *this;\n      }\n\n      inline\n      PB_DS_TREE_IT_C_DEC& \n      operator=(const PB_DS_TREE_ODIR_IT_C_DEC& other)\n      {\n\tbase_it_type::m_p_nd = other.m_p_nd;\n\treturn *this;\n      }\n\n      inline typename PB_DS_TREE_CONST_IT_C_DEC::pointer\n      operator->() const\n      {\n\t_GLIBCXX_DEBUG_ASSERT(base_it_type::m_p_nd != NULL);\n\treturn &base_it_type::m_p_nd->m_value;\n      }\n\n      inline typename PB_DS_TREE_CONST_IT_C_DEC::reference\n      operator*() const\n      {\n\t_GLIBCXX_DEBUG_ASSERT(base_it_type::m_p_nd != NULL);\n\treturn base_it_type::m_p_nd->m_value;\n      }\n\n      inline PB_DS_TREE_IT_C_DEC& \n      operator++()\n      {\n\tPB_DS_TREE_CONST_IT_C_DEC:: operator++();\n\treturn *this;\n      }\n\n      inline PB_DS_TREE_IT_C_DEC\n      operator++(int)\n      {\n\tPB_DS_TREE_IT_C_DEC ret_it(base_it_type::m_p_nd);\n\toperator++();\n\treturn ret_it;\n      }\n\n      inline PB_DS_TREE_IT_C_DEC& \n      operator--()\n      {\n\tPB_DS_TREE_CONST_IT_C_DEC:: operator--();\n\treturn *this;\n      }\n\n      inline PB_DS_TREE_IT_C_DEC\n      operator--(int)\n      {\n\tPB_DS_TREE_IT_C_DEC ret_it(base_it_type::m_p_nd);\n\toperator--();\n\treturn ret_it;\n      }\n\n    protected:\n      typedef PB_DS_TREE_CONST_IT_C_DEC base_it_type;\n    };\n\n#undef PB_DS_TREE_CONST_IT_C_DEC\n#undef PB_DS_TREE_CONST_ODIR_IT_C_DEC\n#undef PB_DS_TREE_IT_C_DEC\n#undef PB_DS_TREE_ODIR_IT_C_DEC\n\n  } // namespace detail\n} // namespace pb_ds\n\n#endif \n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/detail/bin_search_tree_/policy_access_fn_imps.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file policy_access_fn_imps.hpp\n * Contains an implementation class for bin_search_tree_.\n */\n\nPB_DS_CLASS_T_DEC\nCmp_Fn& \nPB_DS_CLASS_C_DEC::\nget_cmp_fn()\n{\n  return (*this);\n}\n\nPB_DS_CLASS_T_DEC\nconst Cmp_Fn& \nPB_DS_CLASS_C_DEC::\nget_cmp_fn() const\n{\n  return (*this);\n}\n\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/detail/bin_search_tree_/r_erase_fn_imps.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file r_erase_fn_imps.hpp\n * Contains an implementation class for bin_search_tree_.\n */\n\nPB_DS_CLASS_T_DEC\ninline void\nPB_DS_CLASS_C_DEC::\nactual_erase_node(node_pointer p_z)\n{\n  _GLIBCXX_DEBUG_ASSERT(m_size > 0);\n  --m_size;\n\n  _GLIBCXX_DEBUG_ONLY(erase_existing(PB_DS_V2F(p_z->m_value)));\n\n  p_z->~node();\n\n  s_node_allocator.deallocate(p_z, 1);\n}\n\nPB_DS_CLASS_T_DEC\ninline void\nPB_DS_CLASS_C_DEC::\nupdate_min_max_for_erased_node(node_pointer p_z)\n{\n  if (m_size == 1)\n    {\n      m_p_head->m_p_left = m_p_head->m_p_right = m_p_head;\n\n      return;\n    }\n\n  if (m_p_head->m_p_left == p_z)\n    {\n      iterator it(p_z);\n\n      ++it;\n\n      m_p_head->m_p_left = it.m_p_nd;\n    }\n  else if (m_p_head->m_p_right == p_z)\n    {\n      iterator it(p_z);\n\n      --it;\n\n      m_p_head->m_p_right = it.m_p_nd;\n    }\n}\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nclear()\n{\n  _GLIBCXX_DEBUG_ONLY(structure_only_assert_valid();)\n\n    clear_imp(m_p_head->m_p_parent);\n\n  m_size = 0;\n\n  initialize();\n\n  _GLIBCXX_DEBUG_ONLY(map_debug_base::clear();)\n\n    _GLIBCXX_DEBUG_ONLY(structure_only_assert_valid();)\n    }\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nclear_imp(node_pointer p_nd)\n{\n  if (p_nd == NULL)\n    return;\n\n  clear_imp(p_nd->m_p_left);\n\n  clear_imp(p_nd->m_p_right);\n\n  p_nd->~Node();\n\n  s_node_allocator.deallocate(p_nd, 1);\n}\n\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/detail/bin_search_tree_/rotate_fn_imps.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file rotate_fn_imps.hpp\n * Contains imps for rotating nodes.\n */\n\nPB_DS_CLASS_T_DEC\ninline void\nPB_DS_CLASS_C_DEC::\nrotate_left(node_pointer p_x)\n{\n  node_pointer p_y = p_x->m_p_right;\n\n  p_x->m_p_right = p_y->m_p_left;\n\n  if (p_y->m_p_left != NULL)\n    p_y->m_p_left->m_p_parent = p_x;\n\n  p_y->m_p_parent = p_x->m_p_parent;\n\n  if (p_x == m_p_head->m_p_parent)\n    m_p_head->m_p_parent = p_y;\n  else if (p_x == p_x->m_p_parent->m_p_left)\n    p_x->m_p_parent->m_p_left = p_y;\n  else\n    p_x->m_p_parent->m_p_right = p_y;\n\n  p_y->m_p_left = p_x;\n  p_x->m_p_parent = p_y;\n\n  _GLIBCXX_DEBUG_ONLY(assert_node_consistent(p_x);)\n    _GLIBCXX_DEBUG_ONLY(assert_node_consistent(p_y);)\n\n    apply_update(p_x, (node_update* )this);\n  apply_update(p_x->m_p_parent, (node_update* )this);\n}\n\nPB_DS_CLASS_T_DEC\ninline void\nPB_DS_CLASS_C_DEC::\nrotate_right(node_pointer p_x)\n{\n  node_pointer p_y = p_x->m_p_left;\n\n  p_x->m_p_left = p_y->m_p_right;\n\n  if (p_y->m_p_right != NULL)\n    p_y->m_p_right->m_p_parent = p_x;\n\n  p_y->m_p_parent = p_x->m_p_parent;\n\n  if (p_x == m_p_head->m_p_parent)\n    m_p_head->m_p_parent = p_y;\n  else if (p_x == p_x->m_p_parent->m_p_right)\n    p_x->m_p_parent->m_p_right = p_y;\n  else\n    p_x->m_p_parent->m_p_left = p_y;\n\n  p_y->m_p_right = p_x;\n  p_x->m_p_parent = p_y;\n\n  _GLIBCXX_DEBUG_ONLY(assert_node_consistent(p_x);)\n    _GLIBCXX_DEBUG_ONLY(assert_node_consistent(p_y);)\n\n    apply_update(p_x, (node_update* )this);\n  apply_update(p_x->m_p_parent, (node_update* )this);\n}\n\nPB_DS_CLASS_T_DEC\ninline void\nPB_DS_CLASS_C_DEC::\nrotate_parent(node_pointer p_nd)\n{\n  node_pointer p_parent = p_nd->m_p_parent;\n\n  if (p_nd == p_parent->m_p_left)\n    rotate_right(p_parent);\n  else\n    rotate_left(p_parent);\n\n  _GLIBCXX_DEBUG_ASSERT(p_parent->m_p_parent = p_nd);\n  _GLIBCXX_DEBUG_ASSERT(p_nd->m_p_left == p_parent ||\n\t\t   p_nd->m_p_right == p_parent);\n}\n\nPB_DS_CLASS_T_DEC\ninline void\nPB_DS_CLASS_C_DEC::\napply_update(node_pointer /*p_nd*/, null_node_update_pointer /*p_update*/)\n{ }\n\nPB_DS_CLASS_T_DEC\ntemplate<typename Node_Update_>\ninline void\nPB_DS_CLASS_C_DEC::\napply_update(node_pointer p_nd, Node_Update_*  /*p_update*/)\n{\n  node_update::operator()(\n\t\t\t   node_iterator(p_nd),\n\t\t\t   const_node_iterator(static_cast<node_pointer>(NULL)));\n}\n\nPB_DS_CLASS_T_DEC\ntemplate<typename Node_Update_>\ninline void\nPB_DS_CLASS_C_DEC::\nupdate_to_top(node_pointer p_nd, Node_Update_* p_update)\n{\n  while (p_nd != m_p_head)\n    {\n      apply_update(p_nd, p_update);\n\n      p_nd = p_nd->m_p_parent;\n    }\n}\n\nPB_DS_CLASS_T_DEC\ninline void\nPB_DS_CLASS_C_DEC::\nupdate_to_top(node_pointer /*p_nd*/, null_node_update_pointer /*p_update*/)\n{ }\n\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/detail/bin_search_tree_/split_join_fn_imps.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file split_join_fn_imps.hpp\n * Contains an implementation class for bin_search_tree_.\n */\n\nPB_DS_CLASS_T_DEC\nbool\nPB_DS_CLASS_C_DEC::\njoin_prep(PB_DS_CLASS_C_DEC& other)\n{\n  _GLIBCXX_DEBUG_ONLY(assert_valid();)\n  _GLIBCXX_DEBUG_ONLY(other.assert_valid();)\n  if (other.m_size == 0)\n    return false;\n\n  if (m_size == 0)\n    {\n      value_swap(other);\n      return false;\n    }\n\n  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));\n\n  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));\n\n  if (!greater && !lesser)\n    __throw_join_error();\n\n  if (lesser)\n    value_swap(other);\n\n  m_size += other.m_size;\n  _GLIBCXX_DEBUG_ONLY(map_debug_base::join(other);)\n  return true;\n}\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\njoin_finish(PB_DS_CLASS_C_DEC& other)\n{\n  initialize_min_max();\n  other.initialize();\n}\n\nPB_DS_CLASS_T_DEC\nbool\nPB_DS_CLASS_C_DEC::\nsplit_prep(const_key_reference r_key, PB_DS_CLASS_C_DEC& other)\n{\n  _GLIBCXX_DEBUG_ONLY(assert_valid();)\n  _GLIBCXX_DEBUG_ONLY(other.assert_valid();)\n  other.clear();\n\n  if (m_size == 0)\n    {\n      _GLIBCXX_DEBUG_ONLY(assert_valid();)\n      _GLIBCXX_DEBUG_ONLY(other.assert_valid();)\n      return false;\n    }\n\n  if (Cmp_Fn::operator()(r_key, PB_DS_V2F(m_p_head->m_p_left->m_value)))\n    {\n      value_swap(other);\n      _GLIBCXX_DEBUG_ONLY(assert_valid();)\n      _GLIBCXX_DEBUG_ONLY(other.assert_valid();)\n      return false;\n    }\n\n  if (!Cmp_Fn::operator()(r_key, PB_DS_V2F(m_p_head->m_p_right->m_value)))\n    {\n      _GLIBCXX_DEBUG_ONLY(assert_valid();)\n      _GLIBCXX_DEBUG_ONLY(other.assert_valid();)\n      return false;\n    }\n\n  if (m_size == 1)\n    {\n      value_swap(other);\n      _GLIBCXX_DEBUG_ONLY(assert_valid();)\n      _GLIBCXX_DEBUG_ONLY(other.assert_valid();)\n      return false;\n    }\n\n  _GLIBCXX_DEBUG_ONLY(map_debug_base::split(r_key,(Cmp_Fn& )(*this), other);)\n  return true;\n}\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nsplit_finish(PB_DS_CLASS_C_DEC& other)\n{\n  other.initialize_min_max();\n  other.m_size = std::distance(other.begin(), other.end());\n  m_size -= other.m_size;\n  initialize_min_max();\n  _GLIBCXX_DEBUG_ONLY(assert_valid();)\n  _GLIBCXX_DEBUG_ONLY(other.assert_valid();)\n}\n\nPB_DS_CLASS_T_DEC\ntypename PB_DS_CLASS_C_DEC::size_type\nPB_DS_CLASS_C_DEC::\nrecursive_count(node_pointer p) const\n{\n  if (p == NULL)\n    return 0;\n  return 1 + recursive_count(p->m_p_left) + recursive_count(p->m_p_right);\n}\n\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/detail/bin_search_tree_/traits.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file traits.hpp\n * Contains an implementation for bin_search_tree_.\n */\n\n#ifndef PB_DS_BIN_SEARCH_TREE_NODE_AND_IT_TRAITS_HPP\n#define PB_DS_BIN_SEARCH_TREE_NODE_AND_IT_TRAITS_HPP\n\n#include <ext/pb_ds/detail/bin_search_tree_/point_iterators.hpp>\n#include <ext/pb_ds/detail/bin_search_tree_/node_iterators.hpp>\n\nnamespace pb_ds\n{\n  namespace detail\n  {\n\n    template<typename Key,\n\t     typename Mapped,\n\t     class Cmp_Fn,\n\t     template<typename Const_Node_Iterator,\n\t\t      class Node_Iterator,\n\t\t      class Cmp_Fn,\n\t\t      class Allocator>\n    class Node_Update,\n\t     class Node,\n\t     class Allocator>\n    struct bin_search_tree_traits\n    {\n    private:\n      typedef\n      types_traits<\n      Key,\n      Mapped,\n      Allocator,\n      false>\n      type_traits;\n\n    public:\n      typedef Node node;\n\n      typedef\n      bin_search_tree_const_it_<\n\ttypename Allocator::template rebind<\n\tnode>::other::pointer,\n\ttypename type_traits::value_type,\n\ttypename type_traits::pointer,\n\ttypename type_traits::const_pointer,\n\ttypename type_traits::reference,\n\ttypename type_traits::const_reference,\n\ttrue,\n\tAllocator>\n      const_point_iterator;\n\n      typedef\n      bin_search_tree_it_<\n\ttypename Allocator::template rebind<\n\tnode>::other::pointer,\n\ttypename type_traits::value_type,\n\ttypename type_traits::pointer,\n\ttypename type_traits::const_pointer,\n\ttypename type_traits::reference,\n\ttypename type_traits::const_reference,\n\ttrue,\n\tAllocator>\n      point_iterator;\n\n      typedef\n      bin_search_tree_const_it_<\n\ttypename Allocator::template rebind<\n\tnode>::other::pointer,\n\ttypename type_traits::value_type,\n\ttypename type_traits::pointer,\n\ttypename type_traits::const_pointer,\n\ttypename type_traits::reference,\n\ttypename type_traits::const_reference,\n\tfalse,\n\tAllocator>\n      const_reverse_iterator;\n\n      typedef\n      bin_search_tree_it_<\n\ttypename Allocator::template rebind<\n\tnode>::other::pointer,\n\ttypename type_traits::value_type,\n\ttypename type_traits::pointer,\n\ttypename type_traits::const_pointer,\n\ttypename type_traits::reference,\n\ttypename type_traits::const_reference,\n\tfalse,\n\tAllocator>\n      reverse_iterator;\n\n      typedef\n      bin_search_tree_const_node_it_<\n\tNode,\n\tconst_point_iterator,\n\tpoint_iterator,\n\tAllocator>\n      const_node_iterator;\n\n      typedef\n      bin_search_tree_node_it_<\n\tNode,\n\tconst_point_iterator,\n\tpoint_iterator,\n\tAllocator>\n      node_iterator;\n\n      typedef\n      Node_Update<\n\tconst_node_iterator,\n\tnode_iterator,\n\tCmp_Fn,\n\tAllocator>\n      node_update;\n\n      typedef\n      pb_ds::null_tree_node_update<\n\tconst_node_iterator,\n\tnode_iterator,\n\tCmp_Fn,\n\tAllocator>* \n      null_node_update_pointer;\n    };\n\n    template<typename Key,\n\t     class Cmp_Fn,\n\t     template<typename Const_Node_Iterator,\n\t\t      class Node_Iterator,\n\t\t      class Cmp_Fn,\n\t\t      class Allocator>\n    class Node_Update,\n\t     class Node,\n\t     class Allocator>\n    struct bin_search_tree_traits<\n      Key,\n      null_mapped_type,\n      Cmp_Fn,\n      Node_Update,\n      Node,\n      Allocator>\n    {\n    private:\n      typedef\n      types_traits<\n      Key,\n      null_mapped_type,\n      Allocator,\n      false>\n      type_traits;\n\n    public:\n      typedef Node node;\n\n      typedef\n      bin_search_tree_const_it_<\n\ttypename Allocator::template rebind<\n\tnode>::other::pointer,\n\ttypename type_traits::value_type,\n\ttypename type_traits::pointer,\n\ttypename type_traits::const_pointer,\n\ttypename type_traits::reference,\n\ttypename type_traits::const_reference,\n\ttrue,\n\tAllocator>\n      const_point_iterator;\n\n      typedef const_point_iterator point_iterator;\n\n      typedef\n      bin_search_tree_const_it_<\n\ttypename Allocator::template rebind<\n\tnode>::other::pointer,\n\ttypename type_traits::value_type,\n\ttypename type_traits::pointer,\n\ttypename type_traits::const_pointer,\n\ttypename type_traits::reference,\n\ttypename type_traits::const_reference,\n\tfalse,\n\tAllocator>\n      const_reverse_iterator;\n\n      typedef const_reverse_iterator reverse_iterator;\n\n      typedef\n      bin_search_tree_const_node_it_<\n\tNode,\n\tconst_point_iterator,\n\tpoint_iterator,\n\tAllocator>\n      const_node_iterator;\n\n      typedef const_node_iterator node_iterator;\n\n      typedef\n      Node_Update<\n\tconst_node_iterator,\n\tnode_iterator,\n\tCmp_Fn,\n\tAllocator>\n      node_update;\n\n      typedef\n      pb_ds::null_tree_node_update<\n\tconst_node_iterator,\n\tnode_iterator,\n\tCmp_Fn,\n\tAllocator>* \n      null_node_update_pointer;\n    };\n\n  } // namespace detail\n} // namespace pb_ds\n\n#endif // #ifndef PB_DS_BIN_SEARCH_TREE_NODE_AND_IT_TRAITS_HPP\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/detail/binary_heap_/binary_heap_.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file binary_heap_.hpp\n * Contains an implementation class for a binary heap.\n */\n\n#ifndef PB_DS_BINARY_HEAP_HPP\n#define PB_DS_BINARY_HEAP_HPP\n\n/*\n * Based on CLRS.\n */\n\n#include <queue>\n#include <algorithm>\n#include <ext/pb_ds/detail/cond_dealtor.hpp>\n#include <ext/pb_ds/detail/cond_dealtor.hpp>\n#include <ext/pb_ds/detail/type_utils.hpp>\n#include <ext/pb_ds/detail/binary_heap_/entry_cmp.hpp>\n#include <ext/pb_ds/detail/binary_heap_/entry_pred.hpp>\n#include <ext/pb_ds/detail/binary_heap_/resize_policy.hpp>\n#include <ext/pb_ds/detail/binary_heap_/const_point_iterator.hpp>\n#include <ext/pb_ds/detail/binary_heap_/const_iterator.hpp>\n#ifdef PB_DS_BINARY_HEAP_TRACE_\n#include <iostream>\n#endif\n#include <ext/pb_ds/detail/type_utils.hpp>\n#include <debug/debug.h>\n\nnamespace pb_ds\n{\n  namespace detail\n  {\n#define PB_DS_CLASS_T_DEC \\\n    template<typename Value_Type, class Cmp_Fn, class Allocator>\n\n#define PB_DS_CLASS_C_DEC \\\n    binary_heap_<Value_Type, Cmp_Fn, Allocator>\n\n#define PB_DS_ENTRY_CMP_DEC \\\n    entry_cmp<Value_Type, Cmp_Fn, is_simple<Value_Type>::value, Allocator>::type\n\n#define PB_DS_RESIZE_POLICY_DEC\t\\\n    resize_policy<typename Allocator::size_type>\n\n    /**\n     * class description = \"Base class for some types of h3ap$\">\n     **/\n    template<typename Value_Type, class Cmp_Fn, class Allocator>\n    class binary_heap_ : public PB_DS_ENTRY_CMP_DEC,\n\t\t\t public PB_DS_RESIZE_POLICY_DEC\n    {\n\n    private:\n      enum\n\t{\n\t  simple_value = is_simple<Value_Type>::value\n\t};\n\n      typedef integral_constant<int, simple_value> no_throw_copies_t;\n\n      typedef\n      typename Allocator::template rebind<\n\tValue_Type>::other\n      value_allocator;\n\n      typedef\n      typename __conditional_type<\n\tsimple_value,\n\tValue_Type,\n\ttypename value_allocator::pointer>::__type\n      entry;\n\n      typedef\n      typename Allocator::template rebind<\n\tentry>::other\n      entry_allocator;\n\n      typedef typename entry_allocator::pointer entry_pointer;\n\n      typedef typename PB_DS_ENTRY_CMP_DEC entry_cmp;\n\n      typedef PB_DS_RESIZE_POLICY_DEC resize_policy;\n\n      typedef\n      cond_dealtor<\n\tValue_Type,\n\tAllocator>\n      cond_dealtor_t;\n\n    public:\n\n      typedef typename Allocator::size_type size_type;\n\n      typedef typename Allocator::difference_type difference_type;\n\n      typedef Value_Type value_type;\n\n      typedef\n      typename Allocator::template rebind<\n\tvalue_type>::other::pointer\n      pointer;\n\n      typedef\n      typename Allocator::template rebind<\n\tvalue_type>::other::const_pointer\n      const_pointer;\n\n      typedef\n      typename Allocator::template rebind<\n\tvalue_type>::other::reference\n      reference;\n\n      typedef\n      typename Allocator::template rebind<\n\tvalue_type>::other::const_reference\n      const_reference;\n\n      typedef\n      binary_heap_const_point_iterator_<\n\tvalue_type,\n\tentry,\n\tsimple_value,\n\tAllocator>\n      const_point_iterator;\n\n      typedef const_point_iterator point_iterator;\n\n      typedef\n      binary_heap_const_iterator_<\n\tvalue_type,\n\tentry,\n\tsimple_value,\n\tAllocator>\n      const_iterator;\n\n      typedef const_iterator iterator;\n\n      typedef Cmp_Fn cmp_fn;\n\n      typedef Allocator allocator;\n\n    public:\n\n      binary_heap_();\n\n      binary_heap_(const Cmp_Fn& r_cmp_fn);\n\n      binary_heap_(const PB_DS_CLASS_C_DEC& other);\n\n      void\n      swap(PB_DS_CLASS_C_DEC& other);\n\n      ~binary_heap_();\n\n      inline bool\n      empty() const;\n\n      inline size_type\n      size() const;\n\n      inline size_type\n      max_size() const;\n\n      Cmp_Fn& \n      get_cmp_fn();\n\n      const Cmp_Fn& \n      get_cmp_fn() const;\n\n      inline point_iterator\n      push(const_reference r_val);\n\n      void\n      modify(point_iterator it, const_reference r_new_val);\n\n      inline const_reference\n      top() const;\n\n      inline void\n      pop();\n\n      inline void\n      erase(point_iterator it);\n\n      template<typename Pred>\n      typename PB_DS_CLASS_C_DEC::size_type\n      erase_if(Pred pred);\n\n      inline static void\n      erase_at(entry_pointer a_entries, size_type size, false_type);\n\n      inline static void\n      erase_at(entry_pointer a_entries, size_type size, true_type);\n\n      inline iterator\n      begin();\n\n      inline const_iterator\n      begin() const;\n\n      inline iterator\n      end();\n\n      inline const_iterator\n      end() const;\n\n      void\n      clear();\n\n      template<typename Pred>\n      void\n      split(Pred pred, PB_DS_CLASS_C_DEC& other);\n\n      void\n      join(PB_DS_CLASS_C_DEC& other);\n\n#ifdef PB_DS_BINARY_HEAP_TRACE_\n      void\n      trace() const;\n#endif \n\n    protected:\n\n      template<typename It>\n      void\n      copy_from_range(It first_it, It last_it);\n\n    private:\n\n      void\n      value_swap(PB_DS_CLASS_C_DEC& other);\n\n      inline void\n      insert_value(const_reference r_val, false_type);\n\n      inline void\n      insert_value(value_type val, true_type);\n\n      inline void\n      insert_entry(entry e);\n\n      inline void\n      resize_for_insert_if_needed();\n\n      inline void\n      swap_value_imp(entry_pointer p_e, value_type new_val, true_type);\n\n      inline void\n      swap_value_imp(entry_pointer p_e, const_reference r_new_val, false_type);\n\n      void\n      fix(entry_pointer p_e);\n\n      inline const_reference\n      top_imp(true_type) const;\n\n      inline const_reference\n      top_imp(false_type) const;\n\n      inline static size_type\n      left_child(size_type i);\n\n      inline static size_type\n      right_child(size_type i);\n\n      inline static size_type\n      parent(size_type i);\n\n      inline void\n      resize_for_erase_if_needed();\n\n      template<typename Pred>\n      size_type\n      partition(Pred pred);\n\n#ifdef _GLIBCXX_DEBUG\n      void\n      assert_valid() const;\n#endif \n\n#ifdef PB_DS_BINARY_HEAP_TRACE_\n      void\n      trace_entry(const entry& r_e, false_type) const;\n\n      void\n      trace_entry(const entry& r_e, true_type) const;\n#endif \n\n    private:\n      static entry_allocator s_entry_allocator;\n\n      static value_allocator s_value_allocator;\n\n      static no_throw_copies_t s_no_throw_copies_ind;\n\n      size_type m_size;\n\n      size_type m_actual_size;\n\n      entry_pointer m_a_entries;\n    };\n\n#include <ext/pb_ds/detail/binary_heap_/insert_fn_imps.hpp>\n#include <ext/pb_ds/detail/binary_heap_/constructors_destructor_fn_imps.hpp>\n#include <ext/pb_ds/detail/binary_heap_/iterators_fn_imps.hpp>\n#include <ext/pb_ds/detail/binary_heap_/debug_fn_imps.hpp>\n#include <ext/pb_ds/detail/binary_heap_/trace_fn_imps.hpp>\n#include <ext/pb_ds/detail/binary_heap_/erase_fn_imps.hpp>\n#include <ext/pb_ds/detail/binary_heap_/info_fn_imps.hpp>\n#include <ext/pb_ds/detail/binary_heap_/find_fn_imps.hpp>\n#include <ext/pb_ds/detail/binary_heap_/split_join_fn_imps.hpp>\n#include <ext/pb_ds/detail/binary_heap_/policy_access_fn_imps.hpp>\n\n#undef PB_DS_CLASS_C_DEC\n#undef PB_DS_CLASS_T_DEC\n#undef PB_DS_ENTRY_CMP_DEC\n#undef PB_DS_RESIZE_POLICY_DEC\n\n  } // namespace detail\n} // namespace pb_ds\n\n#endif \n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/detail/binary_heap_/const_iterator.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file const_iterator.hpp\n * Contains an iterator class returned by the table's const find and insert\n *     methods.\n */\n\n#ifndef PB_DS_BINARY_HEAP_CONST_ITERATOR_HPP\n#define PB_DS_BINARY_HEAP_CONST_ITERATOR_HPP\n\n#include <ext/pb_ds/detail/binary_heap_/const_point_iterator.hpp>\n#include <debug/debug.h>\n\nnamespace pb_ds\n{\n  namespace detail\n  {\n\n#define PB_DS_CLASS_C_DEC \\\n    binary_heap_const_iterator_<Value_Type, Entry, Simple, Allocator>\n\n#define PB_DS_BASE_C_DEC \\\n    binary_heap_const_point_iterator_<Value_Type, Entry, Simple, Allocator>\n\n    // Const point-type iterator.\n    template<typename Value_Type,\n\t     typename Entry,\n\t     bool Simple,\n\t     class Allocator>\n    class binary_heap_const_iterator_ : public PB_DS_BASE_C_DEC\n    {\n\n    private:\n      typedef typename PB_DS_BASE_C_DEC::entry_pointer entry_pointer;\n\n      typedef PB_DS_BASE_C_DEC base_type;\n\n    public:\n\n      // Category.\n      typedef std::forward_iterator_tag iterator_category;\n\n      // Difference type.\n      typedef typename Allocator::difference_type difference_type;\n\n      // Iterator's value type.\n      typedef typename base_type::value_type value_type;\n\n      // Iterator's pointer type.\n      typedef typename base_type::pointer pointer;\n\n      // Iterator's const pointer type.\n      typedef typename base_type::const_pointer const_pointer;\n\n      // Iterator's reference type.\n      typedef typename base_type::reference reference;\n\n      // Iterator's const reference type.\n      typedef typename base_type::const_reference const_reference;\n\n    public:\n\n      inline\n      binary_heap_const_iterator_(entry_pointer p_e) : base_type(p_e)\n      { }\n\n      // Default constructor.\n      inline\n      binary_heap_const_iterator_()\n      { }\n\n      // Copy constructor.\n      inline\n      binary_heap_const_iterator_(const PB_DS_CLASS_C_DEC& other) : base_type(other)\n      { }\n\n      // Compares content to a different iterator object.\n      inline bool\n      operator==(const PB_DS_CLASS_C_DEC& other) const\n      {\n\treturn base_type::m_p_e == other.m_p_e;\n      }\n\n      // Compares content (negatively) to a different iterator object.\n      inline bool\n      operator!=(const PB_DS_CLASS_C_DEC& other) const\n      {\n\treturn base_type::m_p_e != other.m_p_e;\n      }\n\n      inline PB_DS_CLASS_C_DEC& \n      operator++()\n      {\n\t_GLIBCXX_DEBUG_ASSERT(base_type::m_p_e != NULL);\n\tinc();\n\treturn *this;\n      }\n\n      inline PB_DS_CLASS_C_DEC\n      operator++(int)\n      {\n\tPB_DS_CLASS_C_DEC ret_it(base_type::m_p_e);\n\toperator++();\n\treturn ret_it;\n      }\n\n    private:\n      void\n      inc()\n      { ++base_type::m_p_e; }\n    };\n\n#undef PB_DS_CLASS_C_DEC\n#undef PB_DS_BASE_C_DEC\n  } // namespace detail\n} // namespace pb_ds\n\n#endif \n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/detail/binary_heap_/const_point_iterator.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file const_point_iterator.hpp\n * Contains an iterator class returned by the table's const find and insert\n *     methods.\n */\n\n#ifndef PB_DS_BINARY_HEAP_CONST_FIND_ITERATOR_HPP\n#define PB_DS_BINARY_HEAP_CONST_FIND_ITERATOR_HPP\n\n#include <ext/pb_ds/tag_and_trait.hpp>\n#include <debug/debug.h>\n\nnamespace pb_ds\n{\n  namespace detail\n  {\n    // Const point-type iterator.\n    template<typename Value_Type, typename Entry, bool Simple, \n\t     typename Allocator>\n    class binary_heap_const_point_iterator_\n    {\n    protected:\n      typedef typename Allocator::template rebind<Entry>::other::pointer entry_pointer;\n\n    public:\n      // Category.\n      typedef trivial_iterator_tag iterator_category;\n\n      // Difference type.\n      typedef trivial_iterator_difference_type difference_type;\n\n      // Iterator's value type.\n      typedef Value_Type value_type;\n\n      // Iterator's pointer type.\n      typedef typename Allocator::template rebind<value_type>::other::pointer\n      pointer;\n\n      // Iterator's const pointer type.\n      typedef\n      typename Allocator::template rebind<value_type>::other::const_pointer\n      const_pointer;\n\n      // Iterator's reference type.\n      typedef\n      typename Allocator::template rebind<value_type>::other::reference\n      reference;\n\n      // Iterator's const reference type.\n      typedef\n      typename Allocator::template rebind<value_type>::other::const_reference\n      const_reference;\n\n      inline\n      binary_heap_const_point_iterator_(entry_pointer p_e) : m_p_e(p_e)\n      { }\n\n      // Default constructor.\n      inline\n      binary_heap_const_point_iterator_() : m_p_e(NULL) { }\n\n      // Copy constructor.\n      inline\n      binary_heap_const_point_iterator_(const binary_heap_const_point_iterator_& other)\n      : m_p_e(other.m_p_e)\n      { }\n\n      // Access.\n      inline const_pointer\n      operator->() const\n      {\n\t_GLIBCXX_DEBUG_ASSERT(m_p_e != NULL);\n\treturn to_ptr(integral_constant<int, Simple>());\n      }\n\n      // Access.\n      inline const_reference\n      operator*() const\n      {\n\t_GLIBCXX_DEBUG_ASSERT(m_p_e != NULL);\n\treturn *to_ptr(integral_constant<int, Simple>());\n      }\n\n      // Compares content to a different iterator object.\n      inline bool\n      operator==(const binary_heap_const_point_iterator_& other) const\n      { return m_p_e == other.m_p_e; }\n\n      // Compares content (negatively) to a different iterator object.\n      inline bool\n      operator!=(const binary_heap_const_point_iterator_& other) const\n      { return m_p_e != other.m_p_e; }\n\n    private:\n      inline const_pointer\n      to_ptr(true_type) const\n      { return m_p_e; }\n\n      inline const_pointer\n      to_ptr(false_type) const\n      { return *m_p_e; }\n\n    public:\n      entry_pointer m_p_e;\n    };\n  } // namespace detail\n} // namespace pb_ds\n\n#endif \n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/detail/binary_heap_/constructors_destructor_fn_imps.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file constructors_destructor_fn_imps.hpp\n * Contains an implementation class for binary_heap_.\n */\n\nPB_DS_CLASS_T_DEC\ntypename PB_DS_CLASS_C_DEC::entry_allocator\nPB_DS_CLASS_C_DEC::s_entry_allocator;\n\nPB_DS_CLASS_T_DEC\ntypename PB_DS_CLASS_C_DEC::value_allocator\nPB_DS_CLASS_C_DEC::s_value_allocator;\n\nPB_DS_CLASS_T_DEC\ntypename PB_DS_CLASS_C_DEC::no_throw_copies_t\nPB_DS_CLASS_C_DEC::s_no_throw_copies_ind;\n\nPB_DS_CLASS_T_DEC\ntemplate<typename It>\nvoid\nPB_DS_CLASS_C_DEC::\ncopy_from_range(It first_it, It last_it)\n{\n  while (first_it != last_it)\n    {\n      insert_value(*first_it, s_no_throw_copies_ind);\n      ++first_it;\n    }\n\n  std::make_heap(m_a_entries, m_a_entries + m_size, static_cast<entry_cmp& >(*this));\n\n  _GLIBCXX_DEBUG_ONLY(assert_valid();)\n}\n\nPB_DS_CLASS_T_DEC\nPB_DS_CLASS_C_DEC::\nbinary_heap_() :\n  m_size(0),\n  m_actual_size(resize_policy::min_size),\n  m_a_entries(s_entry_allocator.allocate(m_actual_size))\n{\n  _GLIBCXX_DEBUG_ONLY(assert_valid();)\n}\n\nPB_DS_CLASS_T_DEC\nPB_DS_CLASS_C_DEC::\nbinary_heap_(const Cmp_Fn& r_cmp_fn) :\n  entry_cmp(r_cmp_fn),\n  m_size(0),\n  m_actual_size(resize_policy::min_size),\n  m_a_entries(s_entry_allocator.allocate(m_actual_size))\n{\n  _GLIBCXX_DEBUG_ONLY(assert_valid();)\n}\n\nPB_DS_CLASS_T_DEC\nPB_DS_CLASS_C_DEC::\nbinary_heap_(const PB_DS_CLASS_C_DEC& other) :\n  entry_cmp(other),\n  resize_policy(other),\n  m_size(0),\n  m_actual_size(other.m_actual_size),\n  m_a_entries(s_entry_allocator.allocate(m_actual_size))\n{\n  _GLIBCXX_DEBUG_ONLY(other.assert_valid();)\n  _GLIBCXX_DEBUG_ASSERT(m_a_entries != other.m_a_entries);\n\n  const_iterator first_it = other.begin();\n  const_iterator last_it = other.end();\n\n  try\n    {\n      while (first_it != last_it)\n        {\n\t  insert_value(*first_it, s_no_throw_copies_ind);\n\t  ++first_it;\n        }\n    }\n  catch(...)\n    {\n      for (size_type i = 0; i < m_size; ++i)\n\terase_at(m_a_entries, i, s_no_throw_copies_ind);\n\n      s_entry_allocator.deallocate(m_a_entries, m_actual_size);\n      __throw_exception_again;\n    }\n  _GLIBCXX_DEBUG_ONLY(assert_valid();)\n}\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nswap(PB_DS_CLASS_C_DEC& other)\n{\n  _GLIBCXX_DEBUG_ONLY(assert_valid();)\n  _GLIBCXX_DEBUG_ONLY(other.assert_valid();)\n  _GLIBCXX_DEBUG_ASSERT(m_a_entries != other.m_a_entries);\n\n  value_swap(other);\n  std::swap((entry_cmp& )(*this), (entry_cmp& )other);\n  _GLIBCXX_DEBUG_ONLY(assert_valid();)\n  _GLIBCXX_DEBUG_ONLY(other.assert_valid();)\n}\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nvalue_swap(PB_DS_CLASS_C_DEC& other)\n{\n  std::swap(m_a_entries, other.m_a_entries);\n  std::swap(m_size, other.m_size);\n  std::swap(m_actual_size, other.m_actual_size);\n  static_cast<resize_policy*>(this)->swap(other);\n}\n\nPB_DS_CLASS_T_DEC\nPB_DS_CLASS_C_DEC::\n~binary_heap_()\n{\n  for (size_type i = 0; i < m_size; ++i)\n    erase_at(m_a_entries, i, s_no_throw_copies_ind);\n  s_entry_allocator.deallocate(m_a_entries, m_actual_size);\n}\n\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/detail/binary_heap_/debug_fn_imps.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file debug_fn_imps.hpp\n * Contains an implementation class for a binary_heap.\n */\n\n#ifdef _GLIBCXX_DEBUG\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nassert_valid() const\n{\n#ifdef PB_DS_REGRESSION\n  s_entry_allocator.check_allocated(m_a_entries, m_actual_size);\n#endif \n\n  resize_policy::assert_valid();\n  _GLIBCXX_DEBUG_ASSERT(m_size <= m_actual_size);\n  for (size_type i = 0; i < m_size; ++i)\n    {\n#ifdef PB_DS_REGRESSION\n      s_value_allocator.check_allocated(m_a_entries[i], 1);\n#endif \n\n      if (left_child(i) < m_size)\n\t_GLIBCXX_DEBUG_ASSERT(!entry_cmp::operator()(m_a_entries[i], m_a_entries[left_child(i)]));\n\n      _GLIBCXX_DEBUG_ASSERT(parent(left_child(i)) == i);\n\n      if (right_child(i) < m_size)\n\t_GLIBCXX_DEBUG_ASSERT(!entry_cmp::operator()(m_a_entries[i], m_a_entries[right_child(i)]));\n\n      _GLIBCXX_DEBUG_ASSERT(parent(right_child(i)) == i);\n    }\n}\n\n#endif \n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/detail/binary_heap_/entry_cmp.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file entry_cmp.hpp\n * Contains an implementation class for a binary_heap.\n */\n\n#ifndef PB_DS_BINARY_HEAP_ENTRY_CMP_HPP\n#define PB_DS_BINARY_HEAP_ENTRY_CMP_HPP\n\nnamespace pb_ds\n{\n  namespace detail\n  {\n\n    template<typename Value_Type,\n\t     class Cmp_Fn,\n\t     bool No_Throw,\n\t     class Allocator>\n    struct entry_cmp\n    {\n      typedef Cmp_Fn type;\n    };\n\n    template<typename Value_Type, class Cmp_Fn, class Allocator>\n    struct entry_cmp<\n      Value_Type,\n      Cmp_Fn,\n      false,\n      Allocator>\n    {\n    public:\n      typedef\n      typename Allocator::template rebind<\n      Value_Type>::other::const_pointer\n      entry;\n\n      struct type : public Cmp_Fn\n      {\n      public:\n\tinline\n\ttype()\n\t{ }\n\n\tinline\n\ttype(const Cmp_Fn& other) : Cmp_Fn(other)\n\t{ }\n\n\tinline bool\n\toperator()(entry p_lhs,  entry p_rhs) const\n\t{\n\t  return Cmp_Fn::operator()(*p_lhs, * p_rhs);\n\t}\n      };\n    };\n\n  } // namespace detail\n} // namespace pb_ds\n\n#endif // #ifndef PB_DS_BINARY_HEAP_ENTRY_CMP_HPP\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/detail/binary_heap_/entry_pred.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file entry_pred.hpp\n * Contains an implementation class for a binary_heap.\n */\n\n#ifndef PB_DS_BINARY_HEAP_ENTRY_PRED_HPP\n#define PB_DS_BINARY_HEAP_ENTRY_PRED_HPP\n\nnamespace pb_ds\n{\n  namespace detail\n  {\n\n    template<typename Value_Type,\n\t     class Pred,\n\t     bool No_Throw,\n\t     class Allocator>\n    struct entry_pred\n    {\n      typedef Pred type;\n    };\n\n    template<typename Value_Type, class Pred, class Allocator>\n    struct entry_pred<\n      Value_Type,\n      Pred,\n      false,\n      Allocator>\n    {\n    public:\n      typedef\n      typename Allocator::template rebind<\n      Value_Type>::other::const_pointer\n      entry;\n\n      struct type : public Pred\n      {\n      public:\n\tinline\n\ttype()\n\t{ }\n\n\tinline\n\ttype(const Pred& other) : Pred(other)\n\t{ }\n\n\tinline bool\n\toperator()(entry p_v) const\n\t{\n\t  return Pred::operator()(*p_v);\n\t}\n      };\n    };\n\n  } // namespace detail\n} // namespace pb_ds\n\n#endif // #ifndef PB_DS_BINARY_HEAP_ENTRY_PRED_HPP\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/detail/binary_heap_/erase_fn_imps.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file erase_fn_imps.hpp\n * Contains an implementation class for a binary_heap.\n */\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nclear()\n{\n  for (size_type i = 0; i < m_size; ++i)\n    erase_at(m_a_entries, i, s_no_throw_copies_ind);\n\n  try\n    {\n      const size_type actual_size = resize_policy::get_new_size_for_arbitrary(0);\n\n      entry_pointer a_entries = s_entry_allocator.allocate(actual_size);\n\n      resize_policy::notify_arbitrary(actual_size);\n\n      s_entry_allocator.deallocate(m_a_entries, m_actual_size);\n\n      m_actual_size = actual_size;\n\n      m_a_entries = a_entries;\n    }\n  catch(...)\n    { }\n\n  m_size = 0;\n\n  _GLIBCXX_DEBUG_ONLY(assert_valid();)\n    }\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nerase_at(entry_pointer a_entries, size_type i, false_type)\n{\n  a_entries[i]->~value_type();\n\n  s_value_allocator.deallocate(a_entries[i], 1);\n}\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nerase_at(entry_pointer, size_type, true_type)\n{ }\n\nPB_DS_CLASS_T_DEC\ninline void\nPB_DS_CLASS_C_DEC::\npop()\n{\n  _GLIBCXX_DEBUG_ONLY(assert_valid();)\n    _GLIBCXX_DEBUG_ASSERT(!empty());\n\n  erase_at(m_a_entries, 0, s_no_throw_copies_ind);\n\n  std::pop_heap(m_a_entries, m_a_entries + m_size, static_cast<entry_cmp& >(*this));\n\n  resize_for_erase_if_needed();\n\n  _GLIBCXX_DEBUG_ASSERT(m_size > 0);\n  --m_size;\n\n  _GLIBCXX_DEBUG_ONLY(assert_valid();)\n    }\n\nPB_DS_CLASS_T_DEC\ntemplate<typename Pred>\ntypename PB_DS_CLASS_C_DEC::size_type\nPB_DS_CLASS_C_DEC::\nerase_if(Pred pred)\n{\n  _GLIBCXX_DEBUG_ONLY(assert_valid();)\n\n    typedef\n    typename entry_pred<\n    value_type,\n    Pred,\n    simple_value,\n    Allocator>::type\n    pred_t;\n\n  const size_type left = partition(pred_t(pred));\n\n  _GLIBCXX_DEBUG_ASSERT(m_size >= left);\n\n  const size_type ersd = m_size - left;\n\n  for (size_type i = left; i < m_size; ++i)\n    erase_at(m_a_entries, i, s_no_throw_copies_ind);\n\n  try\n    {\n      const size_type actual_size =\n\tresize_policy::get_new_size_for_arbitrary(left);\n\n      entry_pointer a_entries = s_entry_allocator.allocate(actual_size);\n\n      std::copy(m_a_entries, m_a_entries + left, a_entries);\n\n      s_entry_allocator.deallocate(m_a_entries, m_actual_size);\n\n      m_actual_size = actual_size;\n\n      resize_policy::notify_arbitrary(m_actual_size);\n    }\n  catch(...)\n    { };\n\n  m_size = left;\n\n  std::make_heap(m_a_entries, m_a_entries + m_size, static_cast<entry_cmp& >(*this));\n\n  _GLIBCXX_DEBUG_ONLY(assert_valid();)\n\n    return ersd;\n}\n\nPB_DS_CLASS_T_DEC\ninline void\nPB_DS_CLASS_C_DEC::\nerase(point_iterator it)\n{\n  _GLIBCXX_DEBUG_ONLY(assert_valid();)\n    _GLIBCXX_DEBUG_ASSERT(!empty());\n\n  const size_type fix_pos = it.m_p_e - m_a_entries;\n\n  std::swap(*it.m_p_e, m_a_entries[m_size - 1]);\n\n  erase_at(m_a_entries, m_size - 1, s_no_throw_copies_ind);\n\n  resize_for_erase_if_needed();\n\n  _GLIBCXX_DEBUG_ASSERT(m_size > 0);\n  --m_size;\n\n  _GLIBCXX_DEBUG_ASSERT(fix_pos <= m_size);\n\n  if (fix_pos != m_size)\n    fix(m_a_entries + fix_pos);\n\n  _GLIBCXX_DEBUG_ONLY(assert_valid();)\n    }\n\nPB_DS_CLASS_T_DEC\ninline void\nPB_DS_CLASS_C_DEC::\nresize_for_erase_if_needed()\n{\n  if (!resize_policy::resize_needed_for_shrink(m_size))\n    return;\n\n  try\n    {\n      const size_type new_actual_size =\n\tresize_policy::get_new_size_for_shrink();\n\n      entry_pointer a_new_entries = s_entry_allocator.allocate(new_actual_size);\n\n      resize_policy::notify_shrink_resize();\n\n      _GLIBCXX_DEBUG_ASSERT(m_size > 0);\n      std::copy(m_a_entries, m_a_entries + m_size - 1, a_new_entries);\n\n      s_entry_allocator.deallocate(m_a_entries, m_actual_size);\n\n      m_actual_size = new_actual_size;\n\n      m_a_entries = a_new_entries;\n    }\n  catch(...)\n    { }\n}\n\nPB_DS_CLASS_T_DEC\ntemplate<typename Pred>\ntypename PB_DS_CLASS_C_DEC::size_type\nPB_DS_CLASS_C_DEC::\npartition(Pred pred)\n{\n  size_type left = 0;\n  size_type right = m_size - 1;\n\n  while (right + 1 != left)\n    {\n      _GLIBCXX_DEBUG_ASSERT(left <= m_size);\n\n      if (!pred(m_a_entries[left]))\n\t++left;\n      else if (pred(m_a_entries[right]))\n\t--right;\n      else\n        {\n\t  _GLIBCXX_DEBUG_ASSERT(left < right);\n\n\t  std::swap(m_a_entries[left], m_a_entries[right]);\n\n\t  ++left;\n\t  --right;\n        }\n    }\n\n  return left;\n}\n\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/detail/binary_heap_/find_fn_imps.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file find_fn_imps.hpp\n * Contains an implementation class for a binary_heap.\n */\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::const_reference\nPB_DS_CLASS_C_DEC::\ntop() const\n{\n  _GLIBCXX_DEBUG_ONLY(assert_valid();)\n    _GLIBCXX_DEBUG_ASSERT(!empty());\n\n  return top_imp(s_no_throw_copies_ind);\n}\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::const_reference\nPB_DS_CLASS_C_DEC::\ntop_imp(true_type) const\n{\n  return* m_a_entries;\n}\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::const_reference\nPB_DS_CLASS_C_DEC::\ntop_imp(false_type) const\n{\n  return** m_a_entries;\n}\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::size_type\nPB_DS_CLASS_C_DEC::\nleft_child(size_type i)\n{\n  return i*  2 + 1;\n}\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::size_type\nPB_DS_CLASS_C_DEC::\nright_child(size_type i)\n{\n  return i*  2 + 2;\n}\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::size_type\nPB_DS_CLASS_C_DEC::\nparent(size_type i)\n{\n  return (i - 1) / 2;\n}\n\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/detail/binary_heap_/info_fn_imps.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file info_fn_imps.hpp\n * Contains an implementation class for a binary_heap.\n */\n\nPB_DS_CLASS_T_DEC\ninline bool\nPB_DS_CLASS_C_DEC::\nempty() const\n{\n  return (m_size == 0);\n}\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::size_type\nPB_DS_CLASS_C_DEC::\nsize() const\n{\n  return (m_size);\n}\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::size_type\nPB_DS_CLASS_C_DEC::\nmax_size() const\n{\n  return (s_entry_allocator.max_size());\n}\n\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/detail/binary_heap_/insert_fn_imps.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file insert_fn_imps.hpp\n * Contains an implementation class for a binary_heap.\n */\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::point_iterator\nPB_DS_CLASS_C_DEC::\npush(const_reference r_val)\n{\n  _GLIBCXX_DEBUG_ONLY(assert_valid();)\n\n    insert_value(r_val, s_no_throw_copies_ind);\n\n  std::push_heap(m_a_entries, m_a_entries + m_size, static_cast<entry_cmp& >(*this));\n\n  _GLIBCXX_DEBUG_ONLY(assert_valid();)\n\n    return point_iterator(m_a_entries);\n}\n\nPB_DS_CLASS_T_DEC\ninline void\nPB_DS_CLASS_C_DEC::\ninsert_value(value_type val, true_type)\n{\n  resize_for_insert_if_needed();\n\n  m_a_entries[m_size++] = val;\n}\n\nPB_DS_CLASS_T_DEC\ninline void\nPB_DS_CLASS_C_DEC::\ninsert_value(const_reference r_val, false_type)\n{\n  resize_for_insert_if_needed();\n\n  pointer p_new = s_value_allocator.allocate(1);\n\n  cond_dealtor_t cond(p_new);\n\n  new (p_new) value_type(r_val);\n\n  cond.set_no_action();\n\n  m_a_entries[m_size++] = p_new;\n}\n\nPB_DS_CLASS_T_DEC\ninline void\nPB_DS_CLASS_C_DEC::\ninsert_entry(entry e)\n{\n  resize_for_insert_if_needed();\n\n  m_a_entries[m_size++] = e;\n}\n\nPB_DS_CLASS_T_DEC\ninline void\nPB_DS_CLASS_C_DEC::\nresize_for_insert_if_needed()\n{\n  if (!resize_policy::resize_needed_for_grow(m_size))\n    {\n      _GLIBCXX_DEBUG_ASSERT(m_size < m_actual_size);\n\n      return;\n    }\n\n  const size_type new_actual_size =\n    resize_policy::get_new_size_for_grow();\n\n  entry_pointer a_new_entries = s_entry_allocator.allocate(new_actual_size);\n\n  resize_policy::notify_grow_resize();\n\n  std::copy(m_a_entries, m_a_entries + m_size, a_new_entries);\n\n  s_entry_allocator.deallocate(m_a_entries, m_actual_size);\n\n  m_actual_size = new_actual_size;\n\n  m_a_entries = a_new_entries;\n}\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nmodify(point_iterator it, const_reference r_new_val)\n{\n  _GLIBCXX_DEBUG_ONLY(assert_valid();)\n\n    swap_value_imp(it.m_p_e, r_new_val, s_no_throw_copies_ind);\n\n  fix(it.m_p_e);\n\n  _GLIBCXX_DEBUG_ONLY(assert_valid();)\n    }\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nfix(entry_pointer p_e)\n{\n  size_type i = p_e - m_a_entries;\n\n  if (i > 0&&  entry_cmp::operator()(m_a_entries[parent(i)], m_a_entries[i]))\n    {\n      size_type parent_i = parent(i);\n\n      while (i > 0&&  entry_cmp::operator()(m_a_entries[parent_i], m_a_entries[i]))\n        {\n\t  std::swap(m_a_entries[i], m_a_entries[parent_i]);\n\n\t  i = parent_i;\n\n\t  parent_i = parent(i);\n        }\n\n      _GLIBCXX_DEBUG_ONLY(assert_valid();)\n\n        return;\n    }\n\n  while (i < m_size)\n    {\n      const size_type left_child_i = left_child(i);\n      const size_type right_child_i = right_child(i);\n\n      _GLIBCXX_DEBUG_ASSERT(right_child_i > left_child_i);\n\n      const bool smaller_than_left_child =\n\tleft_child_i < m_size&& \n\tentry_cmp::operator()(m_a_entries[i], m_a_entries[left_child_i]);\n\n      const bool smaller_than_right_child =\n\tright_child_i < m_size&& \n\tentry_cmp::operator()(m_a_entries[i], m_a_entries[right_child_i]);\n\n      const bool swap_with_r_child = smaller_than_right_child&& (!smaller_than_left_child ||\n\t\t\t\t\t\t\t\t entry_cmp::operator()(m_a_entries[left_child_i], m_a_entries[right_child_i]));\n\n      const bool swap_with_l_child = !swap_with_r_child&&  smaller_than_left_child;\n\n      if (swap_with_l_child)\n        {\n\t  std::swap(m_a_entries[i], m_a_entries[left_child_i]);\n\n\t  i = left_child_i;\n        }\n      else if (swap_with_r_child)\n        {\n\t  std::swap(m_a_entries[i], m_a_entries[right_child_i]);\n\n\t  i = right_child_i;\n        }\n      else\n\ti = m_size;\n    }\n}\n\nPB_DS_CLASS_T_DEC\ninline void\nPB_DS_CLASS_C_DEC::\nswap_value_imp(entry_pointer p_e, value_type new_val, true_type)\n{\n  * p_e = new_val;\n}\n\nPB_DS_CLASS_T_DEC\ninline void\nPB_DS_CLASS_C_DEC::\nswap_value_imp(entry_pointer p_e, const_reference r_new_val, false_type)\n{\n  value_type tmp(r_new_val);\n  (*p_e)->swap(tmp);\n}\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/detail/binary_heap_/iterators_fn_imps.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file iterators_fn_imps.hpp\n * Contains an implementation class for a binary_heap.\n */\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::iterator\nPB_DS_CLASS_C_DEC::\nbegin()\n{\n  return (iterator(m_a_entries));\n}\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::const_iterator\nPB_DS_CLASS_C_DEC::\nbegin() const\n{\n  return (const_iterator(m_a_entries));\n}\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::iterator\nPB_DS_CLASS_C_DEC::\nend()\n{\n  return (iterator(m_a_entries + m_size));\n}\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::const_iterator\nPB_DS_CLASS_C_DEC::\nend() const\n{\n  return (const_iterator(m_a_entries + m_size));\n}\n\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/detail/binary_heap_/policy_access_fn_imps.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file policy_access_fn_imps.hpp\n * Contains an implementation class for a binary_heap.\n */\n\nPB_DS_CLASS_T_DEC\nCmp_Fn& \nPB_DS_CLASS_C_DEC::\nget_cmp_fn()\n{\n  return (*this);\n}\n\nPB_DS_CLASS_T_DEC\nconst Cmp_Fn& \nPB_DS_CLASS_C_DEC::\nget_cmp_fn() const\n{\n  return (*this);\n}\n\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/detail/binary_heap_/resize_policy.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file resize_policy.hpp\n * Contains an implementation class for a binary_heap.\n */\n\n#ifndef PB_DS_BINARY_HEAP_RESIZE_POLICY_HPP\n#define PB_DS_BINARY_HEAP_RESIZE_POLICY_HPP\n\n#include <debug/debug.h>\n\nnamespace pb_ds\n{\n  namespace detail\n  {\n\n#define PB_DS_CLASS_T_DEC template<typename Size_Type>\n\n#define PB_DS_CLASS_C_DEC resize_policy<Size_Type>\n\n    template<typename Size_Type>\n    class resize_policy\n    {\n    public:\n      typedef Size_Type size_type;\n\n      enum\n\t{\n\t  min_size = 16\n\t};\n\n    public:\n      inline\n      resize_policy();\n\n      inline void\n      swap(PB_DS_CLASS_C_DEC& other);\n\n      inline bool\n      resize_needed_for_grow(size_type size) const;\n\n      inline bool\n      resize_needed_for_shrink(size_type size) const;\n\n      inline bool\n      grow_needed(size_type size) const;\n\n      inline bool\n      shrink_needed(size_type size) const;\n\n      inline size_type\n      get_new_size_for_grow() const;\n\n      inline size_type\n      get_new_size_for_shrink() const;\n\n      size_type\n      get_new_size_for_arbitrary(size_type size) const;\n\n      inline void\n      notify_grow_resize();\n\n      inline void\n      notify_shrink_resize();\n\n      void\n      notify_arbitrary(size_type actual_size);\n\n#ifdef _GLIBCXX_DEBUG\n      void\n      assert_valid() const;\n#endif \n\n#ifdef PB_DS_BINARY_HEAP_TRACE_\n      void\n      trace() const;\n#endif \n\n    private:\n      enum\n\t{\n\t  ratio = 8,\n\t  factor = 2\n\t};\n\n    private:\n      size_type m_next_shrink_size;\n      size_type m_next_grow_size;\n    };\n\n    PB_DS_CLASS_T_DEC\n    inline\n    PB_DS_CLASS_C_DEC::\n    resize_policy() :\n      m_next_shrink_size(0),\n      m_next_grow_size(min_size)\n    { _GLIBCXX_DEBUG_ONLY(assert_valid();) }\n\n    PB_DS_CLASS_T_DEC\n    inline void\n    PB_DS_CLASS_C_DEC::\n    swap(PB_DS_CLASS_C_DEC& other)\n    {\n      std::swap(m_next_shrink_size, other.m_next_shrink_size);\n      std::swap(m_next_grow_size, other.m_next_grow_size);\n    }\n\n    PB_DS_CLASS_T_DEC\n    inline bool\n    PB_DS_CLASS_C_DEC::\n    resize_needed_for_grow(size_type size) const\n    {\n      _GLIBCXX_DEBUG_ASSERT(size <= m_next_grow_size);\n      return size == m_next_grow_size;\n    }\n\n    PB_DS_CLASS_T_DEC\n    inline bool\n    PB_DS_CLASS_C_DEC::\n    resize_needed_for_shrink(size_type size) const\n    {\n      _GLIBCXX_DEBUG_ASSERT(size <= m_next_grow_size);\n      return size == m_next_shrink_size;\n    }\n\n    PB_DS_CLASS_T_DEC\n    inline typename PB_DS_CLASS_C_DEC::size_type\n    PB_DS_CLASS_C_DEC::\n    get_new_size_for_grow() const\n    { return m_next_grow_size*  factor; }\n\n    PB_DS_CLASS_T_DEC\n    inline typename PB_DS_CLASS_C_DEC::size_type\n    PB_DS_CLASS_C_DEC::\n    get_new_size_for_shrink() const\n    {\n      const size_type half_size = m_next_grow_size / factor;\n      return std::max(static_cast<size_type>(min_size), half_size);\n    }\n\n    PB_DS_CLASS_T_DEC\n    inline typename PB_DS_CLASS_C_DEC::size_type\n    PB_DS_CLASS_C_DEC::\n    get_new_size_for_arbitrary(size_type size) const\n    {\n      size_type ret = min_size;\n      while (ret < size)\n\tret *= factor;\n      return ret;\n    }\n\n    PB_DS_CLASS_T_DEC\n    inline void\n    PB_DS_CLASS_C_DEC::\n    notify_grow_resize()\n    {\n      _GLIBCXX_DEBUG_ONLY(assert_valid();)\n      _GLIBCXX_DEBUG_ASSERT(m_next_grow_size >= min_size);\n      m_next_grow_size *= factor;\n      m_next_shrink_size = m_next_grow_size / ratio;\n      _GLIBCXX_DEBUG_ONLY(assert_valid();)\n    }\n\n    PB_DS_CLASS_T_DEC\n    inline void\n    PB_DS_CLASS_C_DEC::\n    notify_shrink_resize()\n    {\n      _GLIBCXX_DEBUG_ONLY(assert_valid();)\n      m_next_shrink_size /= factor;\n      if (m_next_shrink_size == 1)\n\tm_next_shrink_size = 0;\n\n      m_next_grow_size =\n\tstd::max(m_next_grow_size / factor, static_cast<size_type>(min_size));\n      _GLIBCXX_DEBUG_ONLY(assert_valid();)\n    }\n\n    PB_DS_CLASS_T_DEC\n    inline void\n    PB_DS_CLASS_C_DEC::\n    notify_arbitrary(size_type actual_size)\n    {\n      m_next_grow_size = actual_size;\n      m_next_shrink_size = m_next_grow_size / ratio;\n      _GLIBCXX_DEBUG_ONLY(assert_valid();)\n    }\n\n#ifdef _GLIBCXX_DEBUG\n    PB_DS_CLASS_T_DEC\n    void\n    PB_DS_CLASS_C_DEC::\n    assert_valid() const\n    {\n      _GLIBCXX_DEBUG_ASSERT(m_next_shrink_size == 0 ||\n\t\t       m_next_shrink_size*  ratio == m_next_grow_size);\n\n      _GLIBCXX_DEBUG_ASSERT(m_next_grow_size >= min_size);\n    }\n#endif \n\n#ifdef PB_DS_BINARY_HEAP_TRACE_\n    PB_DS_CLASS_T_DEC\n    void\n    PB_DS_CLASS_C_DEC::\n    trace() const\n    {\n      std::cerr << \"shrink = \" << m_next_shrink_size <<\n\t\" grow = \" << m_next_grow_size << std::endl;\n    }\n#endif \n\n#undef PB_DS_CLASS_T_DEC\n#undef PB_DS_CLASS_C_DEC\n\n} // namespace detail\n} // namespace pb_ds\n\n#endif \n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/detail/binary_heap_/split_join_fn_imps.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file split_join_fn_imps.hpp\n * Contains an implementation class for a binary_heap.\n */\n\nPB_DS_CLASS_T_DEC\ntemplate<typename Pred>\nvoid\nPB_DS_CLASS_C_DEC::\nsplit(Pred pred, PB_DS_CLASS_C_DEC& other)\n{\n  _GLIBCXX_DEBUG_ONLY(assert_valid();)\n\n    typedef\n    typename entry_pred<\n    value_type,\n    Pred,\n    simple_value,\n    Allocator>::type\n    pred_t;\n\n  const size_type left = partition(pred_t(pred));\n\n  _GLIBCXX_DEBUG_ASSERT(m_size >= left);\n\n  const size_type ersd = m_size - left;\n\n  _GLIBCXX_DEBUG_ASSERT(m_size >= ersd);\n\n  const size_type actual_size =\n    resize_policy::get_new_size_for_arbitrary(left);\n\n  const size_type other_actual_size =\n    other.get_new_size_for_arbitrary(ersd);\n\n  entry_pointer a_entries = NULL;\n  entry_pointer a_other_entries = NULL;\n\n  try\n    {\n      a_entries = s_entry_allocator.allocate(actual_size);\n\n      a_other_entries = s_entry_allocator.allocate(other_actual_size);\n    }\n  catch(...)\n    {\n      if (a_entries != NULL)\n\ts_entry_allocator.deallocate(a_entries, actual_size);\n\n      if (a_other_entries != NULL)\n\ts_entry_allocator.deallocate(a_other_entries, other_actual_size);\n\n      __throw_exception_again;\n    };\n\n  for (size_type i = 0; i < other.m_size; ++i)\n    erase_at(other.m_a_entries, i, s_no_throw_copies_ind);\n\n  _GLIBCXX_DEBUG_ASSERT(actual_size >= left);\n  std::copy(m_a_entries, m_a_entries + left, a_entries);\n  std::copy(m_a_entries + left, m_a_entries + m_size, a_other_entries);\n\n  s_entry_allocator.deallocate(m_a_entries, m_actual_size);\n  s_entry_allocator.deallocate(other.m_a_entries, other.m_actual_size);\n\n  m_actual_size = actual_size;\n  other.m_actual_size = other_actual_size;\n\n  m_size = left;\n  other.m_size = ersd;\n\n  m_a_entries = a_entries;\n  other.m_a_entries = a_other_entries;\n\n  std::make_heap(m_a_entries, m_a_entries + m_size, static_cast<entry_cmp& >(*this));\n  std::make_heap(other.m_a_entries, other.m_a_entries + other.m_size, static_cast<entry_cmp& >(other));\n\n  resize_policy::notify_arbitrary(m_actual_size);\n  other.notify_arbitrary(other.m_actual_size);\n\n  _GLIBCXX_DEBUG_ONLY(assert_valid();)\n    _GLIBCXX_DEBUG_ONLY(other.assert_valid();)\n    }\n\nPB_DS_CLASS_T_DEC\ninline void\nPB_DS_CLASS_C_DEC::\njoin(PB_DS_CLASS_C_DEC& other)\n{\n  _GLIBCXX_DEBUG_ONLY(assert_valid();)\n  _GLIBCXX_DEBUG_ONLY(other.assert_valid();)\n\n  const size_type len = m_size + other.m_size;\n  const size_type actual_size = resize_policy::get_new_size_for_arbitrary(len);\n\n  entry_pointer a_entries = NULL;\n  entry_pointer a_other_entries = NULL;\n\n  try\n    {\n      a_entries = s_entry_allocator.allocate(actual_size);\n      a_other_entries = s_entry_allocator.allocate(resize_policy::min_size);\n    }\n  catch(...)\n    {\n      if (a_entries != NULL)\n\ts_entry_allocator.deallocate(a_entries, actual_size);\n\n      if (a_other_entries != NULL)\n\ts_entry_allocator.deallocate(a_other_entries, resize_policy::min_size);\n\n      __throw_exception_again;\n    }\n\n  std::copy(m_a_entries, m_a_entries + m_size, a_entries);\n  std::copy(other.m_a_entries, other.m_a_entries + other.m_size, a_entries + m_size);\n\n  s_entry_allocator.deallocate(m_a_entries, m_actual_size);\n  m_a_entries = a_entries;\n  m_size = len;\n  m_actual_size = actual_size;\n\n  resize_policy::notify_arbitrary(actual_size);\n\n  std::make_heap(m_a_entries, m_a_entries + m_size, static_cast<entry_cmp& >(*this));\n\n  s_entry_allocator.deallocate(other.m_a_entries, other.m_actual_size);\n  other.m_a_entries = a_other_entries;\n  other.m_size = 0;\n  other.m_actual_size = resize_policy::min_size;\n\n  other.notify_arbitrary(resize_policy::min_size);\n\n  _GLIBCXX_DEBUG_ONLY(assert_valid();)\n  _GLIBCXX_DEBUG_ONLY(other.assert_valid();)\n}\n\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/detail/binary_heap_/trace_fn_imps.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file trace_fn_imps.hpp\n * Contains an implementation class for a binary_heap.\n */\n\n#ifdef PB_DS_BINARY_HEAP_TRACE_\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\ntrace() const\n{\n  std::cerr << this << std::endl;\n\n  std::cerr << m_a_entries << std::endl;\n\n  for (size_type i = 0; i < m_size; ++i)\n    trace_entry(m_a_entries[i], s_no_throw_copies_ind);\n\n  std::cerr << std::endl;\n\n  std::cerr << \"size = \" << m_size << \" \" << \"actual_size = \" << m_actual_size << std::endl;\n\n  resize_policy::trace();\n}\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\ntrace_entry(const entry& r_e, false_type) const\n{\n  std::cout << r_e << \" \" <<* r_e << std::endl;\n}\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\ntrace_entry(const entry& r_e, true_type) const\n{\n  std::cout << r_e << std::endl;\n}\n\n#endif // #ifdef PB_DS_BINARY_HEAP_TRACE_\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/detail/binomial_heap_/binomial_heap_.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file binomial_heap_.hpp\n * Contains an implementation class for a binomial heap.\n */\n\n/*\n * Binomial heap.\n * Vuillemin J is the mastah.\n * Modified from CLRS.\n */\n\n#include <debug/debug.h>\n#include <ext/pb_ds/detail/cond_dealtor.hpp>\n#include <ext/pb_ds/detail/type_utils.hpp>\n#include <ext/pb_ds/detail/binomial_heap_base_/binomial_heap_base_.hpp>\n\nnamespace pb_ds\n{\n  namespace detail\n  {\n\n#define PB_DS_CLASS_T_DEC \\\n    template<typename Value_Type, class Cmp_Fn, class Allocator>\n\n#define PB_DS_CLASS_C_DEC \\\n    binomial_heap_<Value_Type, Cmp_Fn, Allocator>\n\n#define PB_DS_BASE_C_DEC \\\n    binomial_heap_base_<Value_Type, Cmp_Fn, Allocator>\n\n    /**\n     * class description = \"8y|\\|0|\\/|i41 h34p 74813\">\n     **/\n    template<typename Value_Type, class Cmp_Fn, class Allocator>\n    class binomial_heap_ : public PB_DS_BASE_C_DEC\n    {\n    private:\n      typedef PB_DS_BASE_C_DEC base_type;\n      typedef typename base_type::node_pointer node_pointer;\n      typedef typename base_type::const_node_pointer const_node_pointer;\n\n    public:\n      typedef Value_Type value_type;\n      typedef typename Allocator::size_type size_type;\n      typedef typename Allocator::difference_type difference_type;\n      typedef typename base_type::pointer pointer;\n      typedef typename base_type::const_pointer const_pointer;\n      typedef typename base_type::reference reference;\n      typedef typename base_type::const_reference const_reference;\n      typedef typename base_type::const_point_iterator const_point_iterator;\n      typedef typename base_type::point_iterator point_iterator;\n      typedef typename base_type::const_iterator const_iterator;\n      typedef typename base_type::iterator iterator;\n      typedef typename base_type::cmp_fn cmp_fn;\n      typedef typename base_type::allocator allocator;\n\n      binomial_heap_();\n\n      binomial_heap_(const Cmp_Fn& r_cmp_fn);\n\n      binomial_heap_(const PB_DS_CLASS_C_DEC& other);\n\n      ~binomial_heap_();\n\n    protected:\n#ifdef _GLIBCXX_DEBUG\n      void\n      assert_valid() const;\n#endif \n    };\n\n#include <ext/pb_ds/detail/binomial_heap_/constructors_destructor_fn_imps.hpp>\n#include <ext/pb_ds/detail/binomial_heap_/debug_fn_imps.hpp>\n\n#undef PB_DS_CLASS_C_DEC\n\n#undef PB_DS_CLASS_T_DEC\n\n#undef PB_DS_BASE_C_DEC\n  } // namespace detail\n} // namespace pb_ds\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/detail/binomial_heap_/constructors_destructor_fn_imps.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file constructors_destructor_fn_imps.hpp\n * Contains an implementation for binomial_heap_.\n */\n\nPB_DS_CLASS_T_DEC\nPB_DS_CLASS_C_DEC::\nbinomial_heap_()\n{ _GLIBCXX_DEBUG_ONLY(assert_valid();) }\n\nPB_DS_CLASS_T_DEC\nPB_DS_CLASS_C_DEC::\nbinomial_heap_(const Cmp_Fn& r_cmp_fn) :\n  PB_DS_BASE_C_DEC(r_cmp_fn)\n{ _GLIBCXX_DEBUG_ONLY(assert_valid();) }\n\nPB_DS_CLASS_T_DEC\nPB_DS_CLASS_C_DEC::\nbinomial_heap_(const PB_DS_CLASS_C_DEC& other) :\n  PB_DS_BASE_C_DEC(other)\n{ _GLIBCXX_DEBUG_ONLY(assert_valid();) }\n\nPB_DS_CLASS_T_DEC\nPB_DS_CLASS_C_DEC::\n~binomial_heap_() { }\n\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/detail/binomial_heap_/debug_fn_imps.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file debug_fn_imps.hpp\n * Contains an implementation for binomial_heap_.\n */\n\n#ifdef _GLIBCXX_DEBUG\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nassert_valid() const\n{ base_type::assert_valid(true); }\n\n#endif \n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/detail/binomial_heap_base_/binomial_heap_base_.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file binomial_heap_base_.hpp\n * Contains an implementation class for a base of binomial heaps.\n */\n\n#ifndef PB_DS_BINOMIAL_HEAP_BASE_HPP\n#define PB_DS_BINOMIAL_HEAP_BASE_HPP\n\n/*\n * Binomial heap base.\n * Vuillemin J is the mastah.\n * Modified from CLRS.\n */\n\n#include <debug/debug.h>\n#include <ext/pb_ds/detail/cond_dealtor.hpp>\n#include <ext/pb_ds/detail/type_utils.hpp>\n#include <ext/pb_ds/detail/left_child_next_sibling_heap_/left_child_next_sibling_heap_.hpp>\n#include <ext/pb_ds/detail/left_child_next_sibling_heap_/null_metadata.hpp>\n\nnamespace pb_ds\n{\n  namespace detail\n  {\n\n#define PB_DS_CLASS_T_DEC \\\n    template<typename Value_Type, class Cmp_Fn, class Allocator>\n\n#define PB_DS_CLASS_C_DEC \\\n    binomial_heap_base_<Value_Type, Cmp_Fn, Allocator>\n\n#ifdef _GLIBCXX_DEBUG\n#define PB_DS_BASE_C_DEC \\\n    left_child_next_sibling_heap_<Value_Type, Cmp_Fn, \\\n\t\t\t\t  typename Allocator::size_type, \\\n\t\t\t\t  Allocator, false>\n#else \n#define PB_DS_BASE_C_DEC \\\n    left_child_next_sibling_heap_<Value_Type, Cmp_Fn,\t\\\n\t\t\t\ttypename Allocator::size_type, Allocator>\n#endif \n\n    /**\n     * class description = \"8y|\\|0|\\/|i41 h34p 74813\">\n     **/\n    template<typename Value_Type, class Cmp_Fn, class Allocator>\n    class binomial_heap_base_ : public PB_DS_BASE_C_DEC\n    {\n\n    private:\n      typedef PB_DS_BASE_C_DEC base_type;\n\n    protected:\n      typedef typename base_type::node node;\n\n      typedef typename base_type::node_pointer node_pointer;\n\n      typedef typename base_type::const_node_pointer const_node_pointer;\n\n    public:\n\n      typedef typename Allocator::size_type size_type;\n\n      typedef typename Allocator::difference_type difference_type;\n\n      typedef Value_Type value_type;\n\n      typedef\n      typename Allocator::template rebind<\n\tvalue_type>::other::pointer\n      pointer;\n\n      typedef\n      typename Allocator::template rebind<\n\tvalue_type>::other::const_pointer\n      const_pointer;\n\n      typedef\n      typename Allocator::template rebind<\n\tvalue_type>::other::reference\n      reference;\n\n      typedef\n      typename Allocator::template rebind<\n\tvalue_type>::other::const_reference\n      const_reference;\n\n      typedef\n      typename PB_DS_BASE_C_DEC::const_point_iterator\n      const_point_iterator;\n\n      typedef typename PB_DS_BASE_C_DEC::point_iterator point_iterator;\n\n      typedef typename PB_DS_BASE_C_DEC::const_iterator const_iterator;\n\n      typedef typename PB_DS_BASE_C_DEC::iterator iterator;\n\n      typedef Cmp_Fn cmp_fn;\n\n      typedef Allocator allocator;\n\n    public:\n\n      inline point_iterator\n      push(const_reference r_val);\n\n      void\n      modify(point_iterator it, const_reference r_new_val);\n\n      inline const_reference\n      top() const;\n\n      void\n      pop();\n\n      void\n      erase(point_iterator it);\n\n      inline void\n      clear();\n\n      template<typename Pred>\n      size_type\n      erase_if(Pred pred);\n\n      template<typename Pred>\n      void\n      split(Pred pred, PB_DS_CLASS_C_DEC& other);\n\n      void\n      join(PB_DS_CLASS_C_DEC& other);\n\n    protected:\n\n      binomial_heap_base_();\n\n      binomial_heap_base_(const Cmp_Fn& r_cmp_fn);\n\n      binomial_heap_base_(const PB_DS_CLASS_C_DEC& other);\n\n      void\n      swap(PB_DS_CLASS_C_DEC& other);\n\n      ~binomial_heap_base_();\n\n      template<typename It>\n      void\n      copy_from_range(It first_it, It last_it);\n\n      inline void\n      find_max();\n\n#ifdef _GLIBCXX_DEBUG\n      void\n      assert_valid(bool strictly_binomial) const;\n\n      void\n      assert_max() const;\n#endif \n\n    private:\n\n      inline node_pointer\n      fix(node_pointer p_nd) const;\n\n      inline void\n      insert_node(node_pointer p_nd);\n\n      inline void\n      remove_parentless_node(node_pointer p_nd);\n\n      inline node_pointer\n      join(node_pointer p_lhs, node_pointer p_rhs) const;\n\n#ifdef _GLIBCXX_DEBUG\n      void\n      assert_node_consistent(const_node_pointer, bool, bool) const;\n#endif\n\n    protected:\n      node_pointer m_p_max;\n    };\n\n#include <ext/pb_ds/detail/binomial_heap_base_/constructors_destructor_fn_imps.hpp>\n#include <ext/pb_ds/detail/binomial_heap_base_/debug_fn_imps.hpp>\n#include <ext/pb_ds/detail/binomial_heap_base_/find_fn_imps.hpp>\n#include <ext/pb_ds/detail/binomial_heap_base_/insert_fn_imps.hpp>\n#include <ext/pb_ds/detail/binomial_heap_base_/erase_fn_imps.hpp>\n#include <ext/pb_ds/detail/binomial_heap_base_/split_join_fn_imps.hpp>\n\n#undef PB_DS_CLASS_C_DEC\n#undef PB_DS_CLASS_T_DEC\n#undef PB_DS_BASE_C_DEC\n\n\n  } // namespace detail\n} // namespace pb_ds\n\n#endif \n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/detail/binomial_heap_base_/constructors_destructor_fn_imps.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file constructors_destructor_fn_imps.hpp\n * Contains an implementation class for a base of binomial heaps.\n */\n\nPB_DS_CLASS_T_DEC\ntemplate<typename It>\nvoid\nPB_DS_CLASS_C_DEC::\ncopy_from_range(It first_it, It last_it)\n{\n  while (first_it != last_it)\n    push(*(first_it++));\n\n  _GLIBCXX_DEBUG_ONLY(assert_valid(false);)\n    }\n\nPB_DS_CLASS_T_DEC\nPB_DS_CLASS_C_DEC::\nbinomial_heap_base_() :\n  m_p_max(NULL)\n{\n  _GLIBCXX_DEBUG_ONLY(assert_valid(false);)\n    }\n\nPB_DS_CLASS_T_DEC\nPB_DS_CLASS_C_DEC::\nbinomial_heap_base_(const Cmp_Fn& r_cmp_fn) :\n  PB_DS_BASE_C_DEC(r_cmp_fn),\n  m_p_max(NULL)\n{\n  _GLIBCXX_DEBUG_ONLY(assert_valid(false);)\n    }\n\nPB_DS_CLASS_T_DEC\nPB_DS_CLASS_C_DEC::\nbinomial_heap_base_(const PB_DS_CLASS_C_DEC& other) :\n  PB_DS_BASE_C_DEC(other),\n  m_p_max(NULL)\n{\n  _GLIBCXX_DEBUG_ONLY(assert_valid(false);)\n    }\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nswap(PB_DS_CLASS_C_DEC& other)\n{\n  _GLIBCXX_DEBUG_ONLY(assert_valid(false);)\n\n    base_type::swap(other);\n\n  std::swap(m_p_max, other.m_p_max);\n\n  _GLIBCXX_DEBUG_ONLY(assert_valid(false);)\n    }\n\nPB_DS_CLASS_T_DEC\nPB_DS_CLASS_C_DEC::\n~binomial_heap_base_()\n{ }\n\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/detail/binomial_heap_base_/debug_fn_imps.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file debug_fn_imps.hpp\n * Contains an implementation class for a base of binomial heaps.\n */\n\n#ifdef _GLIBCXX_DEBUG\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nassert_valid(bool strictly_binomial) const\n{\n  base_type::assert_valid();\n  assert_node_consistent(base_type::m_p_root, strictly_binomial, true);\n  assert_max();\n}\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nassert_max() const\n{\n  if (m_p_max == NULL)\n    return;\n  _GLIBCXX_DEBUG_ASSERT(base_type::parent(m_p_max) == NULL);\n  for (const_iterator it = base_type::begin(); it != base_type::end(); ++it)\n    _GLIBCXX_DEBUG_ASSERT(!Cmp_Fn::operator()(m_p_max->m_value, it.m_p_nd->m_value));\n}\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nassert_node_consistent(const_node_pointer p_nd, bool strictly_binomial, bool increasing) const\n{\n  _GLIBCXX_DEBUG_ASSERT(increasing || strictly_binomial);\n  base_type::assert_node_consistent(p_nd, false);\n  if (p_nd == NULL)\n    return;\n  _GLIBCXX_DEBUG_ASSERT(p_nd->m_metadata == base_type::degree(p_nd));\n  _GLIBCXX_DEBUG_ASSERT(base_type::size_under_node(p_nd) ==\n\t\t   static_cast<size_type>(1 << p_nd->m_metadata));\n  assert_node_consistent(p_nd->m_p_next_sibling, strictly_binomial, increasing);\n  assert_node_consistent(p_nd->m_p_l_child, true, false);\n  if (p_nd->m_p_next_sibling != NULL)\n    if (increasing)\n      {\n\tif (strictly_binomial)\n\t  _GLIBCXX_DEBUG_ASSERT(p_nd->m_metadata < p_nd->m_p_next_sibling->m_metadata);\n\telse\n\t  _GLIBCXX_DEBUG_ASSERT(p_nd->m_metadata <= p_nd->m_p_next_sibling->m_metadata);\n      }\n    else\n      _GLIBCXX_DEBUG_ASSERT(p_nd->m_metadata > p_nd->m_p_next_sibling->m_metadata);\n}\n\n#endif \n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/detail/binomial_heap_base_/erase_fn_imps.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file erase_fn_imps.hpp\n * Contains an implementation class for a base of binomial heaps.\n */\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\npop()\n{\n  _GLIBCXX_DEBUG_ONLY(assert_valid(true);)\n    _GLIBCXX_DEBUG_ASSERT(!base_type::empty());\n\n  if (m_p_max == NULL)\n    find_max();\n\n  _GLIBCXX_DEBUG_ASSERT(m_p_max != NULL);\n\n  node_pointer p_nd = m_p_max;\n\n  remove_parentless_node(m_p_max);\n\n  base_type::actual_erase_node(p_nd);\n\n  m_p_max = NULL;\n\n  _GLIBCXX_DEBUG_ONLY(assert_valid(true);)\n    }\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nremove_parentless_node(node_pointer p_nd)\n{\n  _GLIBCXX_DEBUG_ASSERT(p_nd != NULL);\n  _GLIBCXX_DEBUG_ASSERT(base_type::parent(p_nd) == NULL);\n\n  node_pointer p_cur_root = p_nd == base_type::m_p_root?\n    p_nd->m_p_next_sibling :\n    base_type::m_p_root;\n\n  if (p_cur_root != NULL)\n    p_cur_root->m_p_prev_or_parent = NULL;\n\n  if (p_nd->m_p_prev_or_parent != NULL)\n    p_nd->m_p_prev_or_parent->m_p_next_sibling = p_nd->m_p_next_sibling;\n\n  if (p_nd->m_p_next_sibling != NULL)\n    p_nd->m_p_next_sibling->m_p_prev_or_parent = p_nd->m_p_prev_or_parent;\n\n  node_pointer p_child = p_nd->m_p_l_child;\n\n  if (p_child != NULL)\n    {\n      p_child->m_p_prev_or_parent = NULL;\n\n      while (p_child->m_p_next_sibling != NULL)\n\tp_child = p_child->m_p_next_sibling;\n    }\n\n  m_p_max = NULL;\n\n  base_type::m_p_root = join(p_cur_root, p_child);\n}\n\nPB_DS_CLASS_T_DEC\ninline void\nPB_DS_CLASS_C_DEC::\nclear()\n{\n  base_type::clear();\n\n  m_p_max = NULL;\n}\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nerase(point_iterator it)\n{\n  _GLIBCXX_DEBUG_ONLY(assert_valid(true);)\n    _GLIBCXX_DEBUG_ASSERT(!base_type::empty());\n\n  base_type::bubble_to_top(it.m_p_nd);\n\n  remove_parentless_node(it.m_p_nd);\n\n  base_type::actual_erase_node(it.m_p_nd);\n\n  m_p_max = NULL;\n\n  _GLIBCXX_DEBUG_ONLY(assert_valid(true);)\n    }\n\nPB_DS_CLASS_T_DEC\ntemplate<typename Pred>\ntypename PB_DS_CLASS_C_DEC::size_type\nPB_DS_CLASS_C_DEC::\nerase_if(Pred pred)\n{\n  _GLIBCXX_DEBUG_ONLY(assert_valid(true);)\n\n    if (base_type::empty())\n      {\n        _GLIBCXX_DEBUG_ONLY(assert_valid(true);)\n\n\t  return 0;\n      }\n\n  base_type::to_linked_list();\n\n  node_pointer p_out = base_type::prune(pred);\n\n  size_type ersd = 0;\n\n  while (p_out != NULL)\n    {\n      ++ersd;\n\n      node_pointer p_next = p_out->m_p_next_sibling;\n\n      base_type::actual_erase_node(p_out);\n\n      p_out = p_next;\n    }\n\n  node_pointer p_cur = base_type::m_p_root;\n\n  base_type::m_p_root = NULL;\n\n  while (p_cur != NULL)\n    {\n      node_pointer p_next = p_cur->m_p_next_sibling;\n\n      p_cur->m_p_l_child = p_cur->m_p_prev_or_parent = NULL;\n\n      p_cur->m_metadata = 0;\n\n      p_cur->m_p_next_sibling = base_type::m_p_root;\n\n      if (base_type::m_p_root != NULL)\n\tbase_type::m_p_root->m_p_prev_or_parent = p_cur;\n\n      base_type::m_p_root = p_cur;\n\n      base_type::m_p_root = fix(base_type::m_p_root);\n\n      p_cur = p_next;\n    }\n\n  m_p_max = NULL;\n\n  _GLIBCXX_DEBUG_ONLY(assert_valid(true);)\n\n    return ersd;\n}\n\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/detail/binomial_heap_base_/find_fn_imps.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file find_fn_imps.hpp\n * Contains an implementation class for a base of binomial heaps.\n */\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::const_reference\nPB_DS_CLASS_C_DEC::\ntop() const\n{\n  _GLIBCXX_DEBUG_ONLY(assert_valid(false);)\n    _GLIBCXX_DEBUG_ASSERT(!base_type::empty());\n\n  if (m_p_max == NULL)\n    const_cast<PB_DS_CLASS_C_DEC* >(this)->find_max();\n\n  _GLIBCXX_DEBUG_ASSERT(m_p_max != NULL);\n  return m_p_max->m_value;\n}\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nfind_max()\n{\n  node_pointer p_cur = base_type::m_p_root;\n\n  m_p_max = p_cur;\n\n  while (p_cur != NULL)\n    {\n      if (Cmp_Fn::operator()(m_p_max->m_value, p_cur->m_value))\n\tm_p_max = p_cur;\n\n      p_cur = p_cur->m_p_next_sibling;\n    }\n}\n\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/detail/binomial_heap_base_/insert_fn_imps.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file insert_fn_imps.hpp\n * Contains an implementation class for a base of binomial heaps.\n */\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::point_iterator\nPB_DS_CLASS_C_DEC::\npush(const_reference r_val)\n{\n  _GLIBCXX_DEBUG_ONLY(assert_valid(true);)\n\n    node_pointer p_nd = base_type::get_new_node_for_insert(r_val);\n\n  insert_node(p_nd);\n\n  m_p_max = NULL;\n\n  _GLIBCXX_DEBUG_ONLY(assert_valid(true);)\n\n    return point_iterator(p_nd);\n}\n\nPB_DS_CLASS_T_DEC\ninline void\nPB_DS_CLASS_C_DEC::\ninsert_node(node_pointer p_nd)\n{\n  if (base_type::m_p_root == NULL)\n    {\n      p_nd->m_p_next_sibling = p_nd->m_p_prev_or_parent =\n\tp_nd->m_p_l_child = NULL;\n\n      p_nd->m_metadata = 0;\n\n      base_type::m_p_root = p_nd;\n\n      return;\n    }\n\n  if (base_type::m_p_root->m_metadata > 0)\n    {\n      p_nd->m_p_prev_or_parent = p_nd->m_p_l_child = NULL;\n\n      p_nd->m_p_next_sibling = base_type::m_p_root;\n\n      base_type::m_p_root->m_p_prev_or_parent = p_nd;\n\n      base_type::m_p_root = p_nd;\n\n      p_nd->m_metadata = 0;\n\n      return;\n    }\n\n  if (Cmp_Fn::operator()(base_type::m_p_root->m_value, p_nd->m_value))\n    {\n      p_nd->m_p_next_sibling = base_type::m_p_root->m_p_next_sibling;\n\n      p_nd->m_p_prev_or_parent = NULL;\n\n      p_nd->m_metadata = 1;\n\n      p_nd->m_p_l_child = base_type::m_p_root;\n\n      base_type::m_p_root->m_p_prev_or_parent = p_nd;\n\n      base_type::m_p_root->m_p_next_sibling = NULL;\n\n      base_type::m_p_root = p_nd;\n    }\n  else\n    {\n      p_nd->m_p_next_sibling = NULL;\n\n      p_nd->m_p_l_child = NULL;\n\n      p_nd->m_p_prev_or_parent = base_type::m_p_root;\n\n      p_nd->m_metadata = 0;\n\n      _GLIBCXX_DEBUG_ASSERT(base_type::m_p_root->m_p_l_child == 0);\n      base_type::m_p_root->m_p_l_child = p_nd;\n\n      base_type::m_p_root->m_metadata = 1;\n    }\n\n  base_type::m_p_root = fix(base_type::m_p_root);\n}\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::node_pointer\nPB_DS_CLASS_C_DEC::\nfix(node_pointer p_nd) const\n{\n  while (p_nd->m_p_next_sibling != NULL&& \n\t p_nd->m_metadata == p_nd->m_p_next_sibling->m_metadata)\n    {\n      node_pointer p_next = p_nd->m_p_next_sibling;\n\n      if (Cmp_Fn::operator()(p_nd->m_value, p_next->m_value))\n        {\n\t  p_next->m_p_prev_or_parent =\n\t    p_nd->m_p_prev_or_parent;\n\n\t  if (p_nd->m_p_prev_or_parent != NULL)\n\t    p_nd->m_p_prev_or_parent->m_p_next_sibling = p_next;\n\n\t  base_type::make_child_of(p_nd, p_next);\n\n\t  ++p_next->m_metadata;\n\n\t  p_nd = p_next;\n        }\n      else\n        {\n\t  p_nd->m_p_next_sibling = p_next->m_p_next_sibling;\n\n\t  if (p_nd->m_p_next_sibling != NULL)\n\t    p_next->m_p_next_sibling = NULL;\n\n\t  base_type::make_child_of(p_next, p_nd);\n\n\t  ++p_nd->m_metadata;\n        }\n    }\n\n  if (p_nd->m_p_next_sibling != NULL)\n    p_nd->m_p_next_sibling->m_p_prev_or_parent = p_nd;\n\n  return p_nd;\n}\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nmodify(point_iterator it, const_reference r_new_val)\n{\n  _GLIBCXX_DEBUG_ONLY(assert_valid(true);)\n    node_pointer p_nd = it.m_p_nd;\n\n  _GLIBCXX_DEBUG_ASSERT(p_nd != NULL);\n  _GLIBCXX_DEBUG_ONLY(base_type::assert_node_consistent(p_nd, false);)\n\n    const bool bubble_up = Cmp_Fn::operator()(p_nd->m_value, r_new_val);\n\n  p_nd->m_value = r_new_val;\n\n  if (bubble_up)\n    {\n      node_pointer p_parent = base_type::parent(p_nd);\n\n      while (p_parent != NULL&& \n\t     Cmp_Fn::operator()(p_parent->m_value, p_nd->m_value))\n        {\n\t  base_type::swap_with_parent(p_nd, p_parent);\n\n\t  p_parent = base_type::parent(p_nd);\n        }\n\n      if (p_nd->m_p_prev_or_parent == NULL)\n\tbase_type::m_p_root = p_nd;\n\n      m_p_max = NULL;\n\n      _GLIBCXX_DEBUG_ONLY(assert_valid(true);)\n\n        return;\n    }\n\n  base_type::bubble_to_top(p_nd);\n\n  remove_parentless_node(p_nd);\n\n  insert_node(p_nd);\n\n  m_p_max = NULL;\n\n  _GLIBCXX_DEBUG_ONLY(assert_valid(true);)\n    }\n\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/detail/binomial_heap_base_/split_join_fn_imps.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file split_join_fn_imps.hpp\n * Contains an implementation class for a base of binomial heaps.\n */\n\nPB_DS_CLASS_T_DEC\ntemplate<typename Pred>\nvoid\nPB_DS_CLASS_C_DEC::\nsplit(Pred pred, PB_DS_CLASS_C_DEC& other)\n{\n  _GLIBCXX_DEBUG_ONLY(assert_valid(true);)\n    _GLIBCXX_DEBUG_ONLY(other.assert_valid(true);)\n\n    other.clear();\n\n  if (base_type::empty())\n    {\n      _GLIBCXX_DEBUG_ONLY(assert_valid(true);)\n        _GLIBCXX_DEBUG_ONLY(other.assert_valid(true);)\n\n        return;\n    }\n\n  base_type::to_linked_list();\n\n  node_pointer p_out = base_type::prune(pred);\n\n  while (p_out != NULL)\n    {\n      _GLIBCXX_DEBUG_ASSERT(base_type::m_size > 0);\n      --base_type::m_size;\n\n      ++other.m_size;\n\n      node_pointer p_next = p_out->m_p_next_sibling;\n\n      p_out->m_p_l_child = p_out->m_p_prev_or_parent = NULL;\n\n      p_out->m_metadata = 0;\n\n      p_out->m_p_next_sibling = other.m_p_root;\n\n      if (other.m_p_root != NULL)\n\tother.m_p_root->m_p_prev_or_parent = p_out;\n\n      other.m_p_root = p_out;\n\n      other.m_p_root = other.fix(other.m_p_root);\n\n      p_out = p_next;\n    }\n\n  _GLIBCXX_DEBUG_ONLY(other.assert_valid(true);)\n\n    node_pointer p_cur = base_type::m_p_root;\n\n  base_type::m_p_root = NULL;\n\n  while (p_cur != NULL)\n    {\n      node_pointer p_next = p_cur->m_p_next_sibling;\n\n      p_cur->m_p_l_child = p_cur->m_p_prev_or_parent = NULL;\n\n      p_cur->m_metadata = 0;\n\n      p_cur->m_p_next_sibling = base_type::m_p_root;\n\n      if (base_type::m_p_root != NULL)\n\tbase_type::m_p_root->m_p_prev_or_parent = p_cur;\n\n      base_type::m_p_root = p_cur;\n\n      base_type::m_p_root = fix(base_type::m_p_root);\n\n      p_cur = p_next;\n    }\n\n  m_p_max = NULL;\n\n  _GLIBCXX_DEBUG_ONLY(assert_valid(true);)\n    _GLIBCXX_DEBUG_ONLY(other.assert_valid(true);)\n    }\n\nPB_DS_CLASS_T_DEC\ninline void\nPB_DS_CLASS_C_DEC::\njoin(PB_DS_CLASS_C_DEC& other)\n{\n  _GLIBCXX_DEBUG_ONLY(assert_valid(true);)\n    _GLIBCXX_DEBUG_ONLY(other.assert_valid(true);)\n\n    node_pointer p_other = other.m_p_root;\n\n  if (p_other != NULL)\n    do\n      {\n\tnode_pointer p_next = p_other->m_p_next_sibling;\n\n\tstd::swap(p_other->m_p_next_sibling, p_other->m_p_prev_or_parent);\n\n\tp_other = p_next;\n      }\n    while (p_other != NULL);\n\n  base_type::m_p_root = join(base_type::m_p_root, other.m_p_root);\n  base_type::m_size += other.m_size;\n  m_p_max = NULL;\n\n  other.m_p_root = NULL;\n  other.m_size = 0;\n  other.m_p_max = NULL;\n\n  _GLIBCXX_DEBUG_ONLY(assert_valid(true);)\n    _GLIBCXX_DEBUG_ONLY(other.assert_valid(true);)\n    }\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::node_pointer\nPB_DS_CLASS_C_DEC::\njoin(node_pointer p_lhs, node_pointer p_rhs) const\n{\n  node_pointer p_ret = NULL;\n\n  node_pointer p_cur = NULL;\n\n  while (p_lhs != NULL || p_rhs != NULL)\n    {\n      if (p_rhs == NULL)\n        {\n\t  if (p_cur == NULL)\n\t    p_ret = p_cur = p_lhs;\n\t  else\n            {\n\t      p_cur->m_p_next_sibling = p_lhs;\n\n\t      p_lhs->m_p_prev_or_parent = p_cur;\n            }\n\n\t  p_cur = p_lhs = NULL;\n        }\n      else if (p_lhs == NULL || p_rhs->m_metadata < p_lhs->m_metadata)\n        {\n\t  if (p_cur == NULL)\n            {\n\t      p_ret = p_cur = p_rhs;\n\n\t      p_rhs = p_rhs->m_p_prev_or_parent;\n            }\n\t  else\n            {\n\t      p_cur->m_p_next_sibling = p_rhs;\n\n\t      p_rhs = p_rhs->m_p_prev_or_parent;\n\n\t      p_cur->m_p_next_sibling->m_p_prev_or_parent = p_cur;\n\n\t      p_cur = p_cur->m_p_next_sibling;\n            }\n        }\n      else if (p_lhs->m_metadata < p_rhs->m_metadata)\n        {\n\t  if (p_cur == NULL)\n\t    p_ret = p_cur = p_lhs;\n\t  else\n            {\n\t      p_cur->m_p_next_sibling = p_lhs;\n\n\t      p_lhs->m_p_prev_or_parent = p_cur;\n\n\t      p_cur = p_cur->m_p_next_sibling;\n            }\n\n\t  p_lhs = p_cur->m_p_next_sibling;\n        }\n      else\n        {\n\t  node_pointer p_next_rhs = p_rhs->m_p_prev_or_parent;\n\n\t  p_rhs->m_p_next_sibling = p_lhs;\n\n\t  p_lhs = fix(p_rhs);\n\n\t  p_rhs = p_next_rhs;\n        }\n    }\n\n  if (p_cur != NULL)\n    p_cur->m_p_next_sibling = NULL;\n\n  if (p_ret != NULL)\n    p_ret->m_p_prev_or_parent = NULL;\n\n  return p_ret;\n}\n\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/detail/cc_hash_table_map_/cc_ht_map_.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file cc_ht_map_.hpp\n * Contains an implementation class for cc_ht_map_.\n */\n\n#include <utility>\n#include <iterator>\n#include <ext/pb_ds/detail/cond_dealtor.hpp>\n#include <ext/pb_ds/tag_and_trait.hpp>\n#include <ext/pb_ds/detail/hash_fn/ranged_hash_fn.hpp>\n#include <ext/pb_ds/detail/types_traits.hpp>\n#include <ext/pb_ds/exception.hpp>\n#include <ext/pb_ds/detail/eq_fn/hash_eq_fn.hpp>\n#ifdef _GLIBCXX_DEBUG\n#include <ext/pb_ds/detail/map_debug_base.hpp>\n#endif \n#ifdef PB_DS_HT_MAP_TRACE_\n#include <iostream>\n#endif \n#include <debug/debug.h>\n\nnamespace pb_ds\n{\n  namespace detail\n  {\n\n#define PB_DS_CLASS_T_DEC \\\n    template<typename Key, typename Mapped, typename Hash_Fn, \\\n\t     typename Eq_Fn, typename Allocator, bool Store_Hash, \\\n\t     typename Comb_Hash_Fn, typename Resize_Policy>\n\n#ifdef PB_DS_DATA_TRUE_INDICATOR\n#define PB_DS_CLASS_NAME cc_ht_map_data_\n#endif \n\n#ifdef PB_DS_DATA_FALSE_INDICATOR\n#define PB_DS_CLASS_NAME cc_ht_map_no_data_\n#endif \n\n#define PB_DS_CLASS_C_DEC \\\n    PB_DS_CLASS_NAME<Key, Mapped, Hash_Fn, Eq_Fn, Allocator,\t\\\n\t\t     Store_Hash, Comb_Hash_Fn, Resize_Policy>\n\n#define PB_DS_HASH_EQ_FN_C_DEC \\\n    hash_eq_fn<Key, Eq_Fn, Allocator, Store_Hash>\n\n#define PB_DS_RANGED_HASH_FN_C_DEC \\\n    ranged_hash_fn<Key,\tHash_Fn, Allocator, Comb_Hash_Fn, Store_Hash>\n\n#define PB_DS_TYPES_TRAITS_C_DEC \\\n    types_traits<Key, Mapped, Allocator, Store_Hash>\n\n#ifdef _GLIBCXX_DEBUG\n#define PB_DS_MAP_DEBUG_BASE_C_DEC \\\n    map_debug_base<Key,\tEq_Fn, typename Allocator::template rebind<Key>::other::const_reference>\n#endif \n\n#ifdef PB_DS_DATA_TRUE_INDICATOR\n#define PB_DS_V2F(X) (X).first\n#define PB_DS_V2S(X) (X).second\n#endif \n\n#ifdef PB_DS_DATA_FALSE_INDICATOR\n#define PB_DS_V2F(X) (X)\n#define PB_DS_V2S(X) Mapped_Data()\n#endif \n\n#define PB_DS_STATIC_ASSERT(UNIQUE, E) \\\n    typedef static_assert_dumclass<sizeof(static_assert<(bool)(E)>)> \\\n    UNIQUE##static_assert_type\n\n    // <011i$i0|\\|-<|-|4i|\\|i|\\|g |-|4$|-| 74813.\n    template<typename Key,\n\t     typename Mapped,\n\t     typename Hash_Fn,\n\t     typename Eq_Fn,\n\t     typename Allocator,\n\t     bool Store_Hash,\n\t     typename Comb_Hash_Fn,\n\t     typename Resize_Policy >\n    class PB_DS_CLASS_NAME:\n#ifdef _GLIBCXX_DEBUG\n      protected PB_DS_MAP_DEBUG_BASE_C_DEC,\n#endif \n      public PB_DS_HASH_EQ_FN_C_DEC,\n      public Resize_Policy,\n      public PB_DS_RANGED_HASH_FN_C_DEC,\n      public PB_DS_TYPES_TRAITS_C_DEC\n    {\n    private:\n      typedef PB_DS_TYPES_TRAITS_C_DEC traits_base;\n      typedef typename traits_base::comp_hash comp_hash;\n      typedef typename traits_base::value_type value_type_;\n      typedef typename traits_base::pointer pointer_;\n      typedef typename traits_base::const_pointer const_pointer_;\n      typedef typename traits_base::reference reference_;\n      typedef typename traits_base::const_reference const_reference_;\n\n      struct entry : public traits_base::stored_value_type\n      {\n\ttypename Allocator::template rebind<entry>::other::pointer m_p_next;\n      };\n\n      typedef cond_dealtor<entry, Allocator> cond_dealtor_t;\n\n      typedef typename Allocator::template rebind<entry>::other entry_allocator;\n      typedef typename entry_allocator::pointer entry_pointer;\n      typedef typename entry_allocator::const_pointer const_entry_pointer;\n      typedef typename entry_allocator::reference entry_reference;\n      typedef typename entry_allocator::const_reference const_entry_reference;\n\n      typedef typename Allocator::template rebind<entry_pointer>::other entry_pointer_allocator;\n      typedef typename entry_pointer_allocator::pointer entry_pointer_array;\n\n      typedef PB_DS_RANGED_HASH_FN_C_DEC ranged_hash_fn_base;\n      typedef PB_DS_HASH_EQ_FN_C_DEC hash_eq_fn_base;\n      typedef Resize_Policy resize_base;\n\n#ifdef _GLIBCXX_DEBUG\n      typedef PB_DS_MAP_DEBUG_BASE_C_DEC map_debug_base;\n#endif \n\n#define PB_DS_GEN_POS std::pair<entry_pointer, typename Allocator::size_type>\n\n#include <ext/pb_ds/detail/unordered_iterator/const_point_iterator.hpp>\n#include <ext/pb_ds/detail/unordered_iterator/point_iterator.hpp>\n#include <ext/pb_ds/detail/unordered_iterator/const_iterator.hpp>\n#include <ext/pb_ds/detail/unordered_iterator/iterator.hpp>\n\n#undef PB_DS_GEN_POS\n\n    public:\n      typedef Allocator allocator;\n      typedef typename Allocator::size_type size_type;\n      typedef typename Allocator::difference_type difference_type;\n      typedef Hash_Fn hash_fn;\n      typedef Eq_Fn eq_fn;\n      typedef Comb_Hash_Fn comb_hash_fn;\n      typedef Resize_Policy resize_policy;\n\n      enum\n\t{\n\t  store_hash = Store_Hash\n\t};\n\n      typedef typename traits_base::key_type key_type;\n      typedef typename traits_base::key_pointer key_pointer;\n      typedef typename traits_base::const_key_pointer const_key_pointer;\n      typedef typename traits_base::key_reference key_reference;\n      typedef typename traits_base::const_key_reference const_key_reference;\n      typedef typename traits_base::mapped_type mapped_type;\n      typedef typename traits_base::mapped_pointer mapped_pointer;\n      typedef typename traits_base::const_mapped_pointer const_mapped_pointer;\n      typedef typename traits_base::mapped_reference mapped_reference;\n      typedef typename traits_base::const_mapped_reference const_mapped_reference;\n      typedef typename traits_base::value_type value_type;\n      typedef typename traits_base::pointer pointer;\n      typedef typename traits_base::const_pointer const_pointer;\n      typedef typename traits_base::reference reference;\n      typedef typename traits_base::const_reference const_reference;\n\n#ifdef PB_DS_DATA_TRUE_INDICATOR\n      typedef point_iterator_ point_iterator;\n#endif \n\n#ifdef PB_DS_DATA_FALSE_INDICATOR\n      typedef const_point_iterator_ point_iterator;\n#endif \n\n      typedef const_point_iterator_ const_point_iterator;\n\n#ifdef PB_DS_DATA_TRUE_INDICATOR\n      typedef iterator_ iterator;\n#endif \n\n#ifdef PB_DS_DATA_FALSE_INDICATOR\n      typedef const_iterator_ iterator;\n#endif \n\n      typedef const_iterator_ const_iterator;\n\n      PB_DS_CLASS_NAME();\n\n      PB_DS_CLASS_NAME(const Hash_Fn&);\n\n      PB_DS_CLASS_NAME(const Hash_Fn&, const Eq_Fn&);\n\n      PB_DS_CLASS_NAME(const Hash_Fn&, const Eq_Fn&, const Comb_Hash_Fn&);\n\n      PB_DS_CLASS_NAME(const Hash_Fn&, const Eq_Fn&, const Comb_Hash_Fn&, \n\t\t       const Resize_Policy&);\n\n      PB_DS_CLASS_NAME(const PB_DS_CLASS_C_DEC&);\n\n      virtual\n      ~PB_DS_CLASS_NAME();\n\n      void\n      swap(PB_DS_CLASS_C_DEC&);\n\n      template<typename It>\n      void\n      copy_from_range(It, It);\n\n      void\n      initialize();\n\n      inline size_type\n      size() const;\n\n      inline size_type\n      max_size() const;\n\n      inline bool\n      empty() const;\n\n      Hash_Fn& \n      get_hash_fn();\n\n      const Hash_Fn& \n      get_hash_fn() const;\n\n      Eq_Fn& \n      get_eq_fn();\n\n      const Eq_Fn& \n      get_eq_fn() const;\n\n      Comb_Hash_Fn& \n      get_comb_hash_fn();\n\n      const Comb_Hash_Fn& \n      get_comb_hash_fn() const;\n\n      Resize_Policy& \n      get_resize_policy();\n\n      const Resize_Policy& \n      get_resize_policy() const;\n\n      inline std::pair<point_iterator, bool>\n      insert(const_reference r_val)\n      { return insert_imp(r_val, traits_base::m_store_extra_indicator); }\n\n      inline mapped_reference\n      operator[](const_key_reference r_key)\n      {\n#ifdef PB_DS_DATA_TRUE_INDICATOR\n\treturn (subscript_imp(r_key, traits_base::m_store_extra_indicator));\n#else \n\tinsert(r_key);\n\treturn traits_base::s_null_mapped;\n#endif \n      }\n\n      inline point_iterator\n      find(const_key_reference);\n\n      inline const_point_iterator\n      find(const_key_reference) const;\n\n      inline point_iterator\n      find_end();\n\n      inline const_point_iterator\n      find_end() const;\n\n      inline bool\n      erase(const_key_reference);\n\n      template<typename Pred>\n      inline size_type\n      erase_if(Pred);\n\n      void\n      clear();\n\n      inline iterator\n      begin();\n\n      inline const_iterator\n      begin() const;\n\n      inline iterator\n      end();\n\n      inline const_iterator\n      end() const;\n\n#ifdef _GLIBCXX_DEBUG\n      void\n      assert_valid() const;\n#endif \n\n#ifdef PB_DS_HT_MAP_TRACE_\n      void\n      trace() const;\n#endif \n\n    private:\n      void\n      deallocate_all();\n\n      inline bool\n      do_resize_if_needed();\n\n      inline void\n      do_resize_if_needed_no_throw();\n\n      void\n      resize_imp(size_type new_size);\n\n      void\n      do_resize(size_type new_size);\n\n      void\n      resize_imp_no_exceptions(size_type, entry_pointer_array, size_type);\n\n      inline entry_pointer\n      resize_imp_no_exceptions_reassign_pointer(entry_pointer, entry_pointer_array, false_type);\n\n      inline entry_pointer\n      resize_imp_no_exceptions_reassign_pointer(entry_pointer, entry_pointer_array, true_type);\n\n      void\n      deallocate_links_in_list(entry_pointer);\n\n      inline entry_pointer\n      get_entry(const_reference, false_type);\n\n      inline entry_pointer\n      get_entry(const_reference, true_type);\n\n      inline void\n      rels_entry(entry_pointer);\n\n#ifdef PB_DS_DATA_TRUE_INDICATOR\n      inline mapped_reference\n      subscript_imp(const_key_reference r_key, false_type)\n      {\n\t_GLIBCXX_DEBUG_ONLY(assert_valid();)\n        const size_type pos = ranged_hash_fn_base::operator()(r_key);\n\tentry_pointer p_e = m_entries[pos];\n\tresize_base::notify_insert_search_start();\n\n\twhile (p_e != NULL \n\t       && !hash_eq_fn_base::operator()(p_e->m_value.first, r_key))\n\t  {\n\t    resize_base::notify_insert_search_collision();\n\t    p_e = p_e->m_p_next;\n\t  }\n\n\tresize_base::notify_insert_search_end();\n\tif (p_e != NULL)\n\t  {\n\t    _GLIBCXX_DEBUG_ONLY(map_debug_base::check_key_exists(r_key);)\n\t    return (p_e->m_value.second);\n\t  }\n\n\t_GLIBCXX_DEBUG_ONLY(map_debug_base::check_key_does_not_exist(r_key);)\n\treturn insert_new_imp(value_type(r_key, mapped_type()), pos)->second;\n      }\n\n      inline mapped_reference\n      subscript_imp(const_key_reference r_key, true_type)\n      {\n\t_GLIBCXX_DEBUG_ONLY(assert_valid();)\n\tcomp_hash pos_hash_pair = ranged_hash_fn_base::operator()(r_key);\n\tentry_pointer p_e = m_entries[pos_hash_pair.first];\n\tresize_base::notify_insert_search_start();\n\twhile (p_e != NULL && \n\t       !hash_eq_fn_base::operator()(p_e->m_value.first, p_e->m_hash, r_key, pos_hash_pair.second))\n\t  {\n\t    resize_base::notify_insert_search_collision();\n\t    p_e = p_e->m_p_next;\n\t  }\n\n\tresize_base::notify_insert_search_end();\n\tif (p_e != NULL)\n\t  {\n\t    _GLIBCXX_DEBUG_ONLY(map_debug_base::check_key_exists(r_key);)\n\t    return p_e->m_value.second;\n\t  }\n\n\t_GLIBCXX_DEBUG_ONLY(map_debug_base::check_key_does_not_exist(r_key);)\n\treturn insert_new_imp(value_type(r_key, mapped_type()), \n\t\t\t      pos_hash_pair)->second;\n      }\n#endif \n\n      inline std::pair<point_iterator, bool>\n      insert_imp(const_reference, false_type);\n\n      inline std::pair<point_iterator, bool>\n      insert_imp(const_reference, true_type);\n\n      inline pointer\n      insert_new_imp(const_reference r_val, size_type pos)\n      {\n\tif (do_resize_if_needed())\n\t  pos = ranged_hash_fn_base::operator()(PB_DS_V2F(r_val));\n\n\t// Following lines might throw an exception.\n\tentry_pointer p_e = get_entry(r_val, traits_base::m_no_throw_copies_indicator);\n\n\t// At this point no exceptions can be thrown.\n\tp_e->m_p_next = m_entries[pos];\n\tm_entries[pos] = p_e;\n\tresize_base::notify_inserted(++m_num_used_e);\n\n\t_GLIBCXX_DEBUG_ONLY(map_debug_base::insert_new(PB_DS_V2F(r_val));)\n\t_GLIBCXX_DEBUG_ONLY(assert_valid();)\n\treturn &p_e->m_value;\n      }\n\n      inline pointer\n      insert_new_imp(const_reference r_val, comp_hash& r_pos_hash_pair)\n      {\n\t// Following lines might throw an exception.\n\tif (do_resize_if_needed())\n\t  r_pos_hash_pair = ranged_hash_fn_base::operator()(PB_DS_V2F(r_val));\n\n\tentry_pointer p_e = get_entry(r_val, traits_base::m_no_throw_copies_indicator);\n\n\t// At this point no exceptions can be thrown.\n\tp_e->m_hash = r_pos_hash_pair.second;\n\tp_e->m_p_next = m_entries[r_pos_hash_pair.first];\n\tm_entries[r_pos_hash_pair.first] = p_e;\n\tresize_base::notify_inserted(++m_num_used_e);\n\t_GLIBCXX_DEBUG_ONLY(map_debug_base::insert_new(PB_DS_V2F(r_val));)\n\t_GLIBCXX_DEBUG_ONLY(assert_valid();)\n\treturn &p_e->m_value;\n      }\n\n      inline pointer\n      find_key_pointer(const_key_reference r_key, false_type)\n      {\n\tentry_pointer p_e = m_entries[ranged_hash_fn_base::operator()(r_key)];\n\tresize_base::notify_find_search_start();\n\twhile (p_e != NULL && \n\t       !hash_eq_fn_base::operator()(PB_DS_V2F(p_e->m_value), r_key))\n\t  {\n\t    resize_base::notify_find_search_collision();\n\t    p_e = p_e->m_p_next;\n\t  }\n\n\tresize_base::notify_find_search_end();\n\n#ifdef _GLIBCXX_DEBUG\n\tif (p_e == NULL)\n\t  map_debug_base::check_key_does_not_exist(r_key);\n\telse\n\t  map_debug_base::check_key_exists(r_key);\n#endif \n\treturn &p_e->m_value;\n      }\n\n      inline pointer\n      find_key_pointer(const_key_reference r_key, true_type)\n      {\n\tcomp_hash pos_hash_pair = ranged_hash_fn_base::operator()(r_key);\n\tentry_pointer p_e = m_entries[pos_hash_pair.first];\n\tresize_base::notify_find_search_start();\n\twhile (p_e != NULL && \n\t       !hash_eq_fn_base::operator()(PB_DS_V2F(p_e->m_value),\n\t\t\t\t\t    p_e->m_hash,\n\t\t\t\t\t    r_key, pos_hash_pair.second))\n\t  {\n\t    resize_base::notify_find_search_collision();\n\t    p_e = p_e->m_p_next;\n\t  }\n\n\tresize_base::notify_find_search_end();\n\n#ifdef _GLIBCXX_DEBUG\n\tif (p_e == NULL)\n\t  map_debug_base::check_key_does_not_exist(r_key);\n\telse\n\t  map_debug_base::check_key_exists(r_key);\n#endif \n\treturn &p_e->m_value;\n      }\n\n      inline bool\n      erase_in_pos_imp(const_key_reference, size_type);\n\n      inline bool\n      erase_in_pos_imp(const_key_reference, const comp_hash&);\n\n      inline void\n      erase_entry_pointer(entry_pointer&);\n\n#ifdef PB_DS_DATA_TRUE_INDICATOR\n      void\n      inc_it_state(pointer& r_p_value, \n\t\t   std::pair<entry_pointer, size_type>& r_pos) const\n      {\n\tinc_it_state((const_mapped_pointer& )r_p_value, r_pos);\n      }\n#endif \n\n      void\n      inc_it_state(const_pointer& r_p_value, \n\t\t   std::pair<entry_pointer, size_type>& r_pos) const\n      {\n\t_GLIBCXX_DEBUG_ASSERT(r_p_value != NULL);\n\tr_pos.first = r_pos.first->m_p_next;\n\tif (r_pos.first != NULL)\n\t  {\n\t    r_p_value = &r_pos.first->m_value;\n\t    return;\n\t  }\n\n\tfor (++r_pos.second; r_pos.second < m_num_e; ++r_pos.second)\n\t  if (m_entries[r_pos.second] != NULL)\n\t    {\n\t      r_pos.first = m_entries[r_pos.second];\n\t      r_p_value = &r_pos.first->m_value;\n\t      return;\n\t    }\n\tr_p_value = NULL;\n      }\n\n      void\n      get_start_it_state(pointer& r_p_value, \n\t\t\t std::pair<entry_pointer, size_type>& r_pos) const\n      {\n\tfor (r_pos.second = 0; r_pos.second < m_num_e; ++r_pos.second)\n\t  if (m_entries[r_pos.second] != NULL)\n\t    {\n\t      r_pos.first = m_entries[r_pos.second];\n\t      r_p_value = &r_pos.first->m_value;\n\t      return;\n\t    }\n\tr_p_value = NULL;\n      }\n\n#ifdef _GLIBCXX_DEBUG\n      void\n      assert_entry_pointer_array_valid(const entry_pointer_array) const;\n\n      void\n      assert_entry_pointer_valid(const entry_pointer, true_type) const;\n\n      void\n      assert_entry_pointer_valid(const entry_pointer, false_type) const;\n#endif \n\n#ifdef PB_DS_HT_MAP_TRACE_\n      void\n      trace_list(const_entry_pointer) const;\n#endif \n\n    private:\n#ifdef PB_DS_DATA_TRUE_INDICATOR\n      friend class iterator_;\n#endif \n\n      friend class const_iterator_;\n\n      static entry_allocator \t\ts_entry_allocator;\n      static entry_pointer_allocator \ts_entry_pointer_allocator;\n      static iterator \t\t\ts_end_it;\n      static const_iterator \t\ts_const_end_it;\n      static point_iterator \t\ts_find_end_it;\n      static const_point_iterator \ts_const_find_end_it;\n\n      size_type \t\t\tm_num_e;\n      size_type \t\t\tm_num_used_e;\n      entry_pointer_array \t\tm_entries;\n\n      enum\n\t{\n\t  store_hash_ok = !Store_Hash \n\t                  || !is_same<Hash_Fn, pb_ds::null_hash_fn>::value\n\t};\n\n      PB_DS_STATIC_ASSERT(sth, store_hash_ok);\n    };\n\n#include <ext/pb_ds/detail/cc_hash_table_map_/constructor_destructor_fn_imps.hpp>\n#include <ext/pb_ds/detail/cc_hash_table_map_/entry_list_fn_imps.hpp>\n#include <ext/pb_ds/detail/cc_hash_table_map_/find_fn_imps.hpp>\n#include <ext/pb_ds/detail/cc_hash_table_map_/resize_fn_imps.hpp>\n#include <ext/pb_ds/detail/cc_hash_table_map_/debug_fn_imps.hpp>\n#include <ext/pb_ds/detail/cc_hash_table_map_/size_fn_imps.hpp>\n#include <ext/pb_ds/detail/cc_hash_table_map_/policy_access_fn_imps.hpp>\n#include <ext/pb_ds/detail/cc_hash_table_map_/erase_fn_imps.hpp>\n#include <ext/pb_ds/detail/cc_hash_table_map_/iterators_fn_imps.hpp>\n#include <ext/pb_ds/detail/cc_hash_table_map_/insert_fn_imps.hpp>\n#include <ext/pb_ds/detail/cc_hash_table_map_/trace_fn_imps.hpp>\n\n#undef PB_DS_CLASS_T_DEC\n#undef PB_DS_CLASS_C_DEC\n#undef PB_DS_HASH_EQ_FN_C_DEC\n#undef PB_DS_RANGED_HASH_FN_C_DEC\n#undef PB_DS_TYPES_TRAITS_C_DEC\n#undef PB_DS_MAP_DEBUG_BASE_C_DEC\n#undef PB_DS_CLASS_NAME\n#undef PB_DS_V2F\n#undef PB_DS_V2S\n#undef PB_DS_STATIC_ASSERT\n\n  } // namespace detail\n} // namespace pb_ds\n\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/detail/cc_hash_table_map_/cmp_fn_imps.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file cmp_fn_imps.hpp\n * Contains implementations of cc_ht_map_'s entire container comparison related\n *    functions.\n */\n\nPB_DS_CLASS_T_DEC\ntemplate<typename Other_HT_Map_Type>\nbool\nPB_DS_CLASS_C_DEC::\noperator==(const Other_HT_Map_Type& other) const\n{ return cmp_with_other(other); }\n\nPB_DS_CLASS_T_DEC\ntemplate<typename Other_Map_Type>\nbool\nPB_DS_CLASS_C_DEC::\ncmp_with_other(const Other_Map_Type& other) const\n{\n  if (size() != other.size())\n    return false;\n\n  for (typename Other_Map_Type::const_iterator it = other.begin();\n       it != other.end(); ++it)\n    {\n      const_key_reference r_key = const_key_reference(PB_DS_V2F(*it));\n\n      const_mapped_pointer p_mapped_value =\n\tconst_cast<PB_DS_CLASS_C_DEC& >(*this).\n\tfind_key_pointer(r_key, traits_base::m_store_hash_indicator);\n\n      if (p_mapped_value == NULL)\n\treturn false;\n\n#ifdef PB_DS_DATA_TRUE_INDICATOR\n      if (p_mapped_value->second != it->second)\n\treturn false;\n#endif\n    }\n  return true;\n}\n\nPB_DS_CLASS_T_DEC\ntemplate<typename Other_HT_Map_Type>\nbool\nPB_DS_CLASS_C_DEC::\noperator!=(const Other_HT_Map_Type& other) const\n{ return !operator==(other); }\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/detail/cc_hash_table_map_/cond_key_dtor_entry_dealtor.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file cond_key_dtor_entry_dealtor.hpp\n * Contains a conditional key destructor, used for exception handling.\n */\n\nnamespace pb_ds\n{\n  namespace detail\n  {\n\n#define PB_DS_CLASS_T_DEC template<typename HT_Map>\n#define PB_DS_CLASS_C_DEC PB_DS_CKDED_CLASS_NAME<HT_Map>\n\n    /**\n     * A conditional key destructor, used for exception handling.\n     **/\n    template<typename HT_Map>\n    class PB_DS_CKDED_CLASS_NAME\n    {\n    public:\n      typedef typename HT_Map::entry entry;\n      typedef typename HT_Map::entry_allocator entry_allocator;\n      typedef typename HT_Map::key_type key_type;\n\n      inline\n      PB_DS_CKDED_CLASS_NAME(entry_allocator* p_a, entry* p_e);\n\n      inline\n      ~PB_DS_CKDED_CLASS_NAME();\n\n      inline void\n      set_key_destruct();\n\n      inline void\n      set_no_action_destructor();\n\n    protected:\n      entry_allocator* const m_p_a;\n      entry* const m_p_e;\n\n      bool m_key_destruct;\n      bool m_no_action_destructor;\n    };\n\n    PB_DS_CLASS_T_DEC\n    inline\n    PB_DS_CLASS_C_DEC::\n    PB_DS_CKDED_CLASS_NAME(entry_allocator* p_a, entry* p_e) \n    : m_p_a(p_a), m_p_e(p_e), m_key_destruct(false), \n      m_no_action_destructor(false)\n    { }\n\n    PB_DS_CLASS_T_DEC\n    inline void\n    PB_DS_CLASS_C_DEC::\n    set_key_destruct()\n    { m_key_destruct = true; }\n\n    PB_DS_CLASS_T_DEC\n    inline void\n    PB_DS_CLASS_C_DEC::\n    set_no_action_destructor()\n    { m_no_action_destructor = true; }\n\n    PB_DS_CLASS_T_DEC\n    inline\n    PB_DS_CLASS_C_DEC::\n    ~PB_DS_CKDED_CLASS_NAME()\n    {\n      if (m_no_action_destructor)\n\treturn;\n      if (m_key_destruct)\n\tm_p_e->m_value.first.~key_type();\n      m_p_a->deallocate(m_p_e, 1);\n    }\n\n#undef PB_DS_CLASS_T_DEC\n#undef PB_DS_CLASS_C_DEC\n\n  } // namespace detail\n} // namespace pb_ds\n\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/detail/cc_hash_table_map_/constructor_destructor_fn_imps.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file constructor_destructor_fn_imps.hpp\n * Contains implementations of cc_ht_map_'s constructors, destructor,\n *    and related functions.\n */\n\nPB_DS_CLASS_T_DEC\ntypename PB_DS_CLASS_C_DEC::entry_allocator\nPB_DS_CLASS_C_DEC::s_entry_allocator;\n\nPB_DS_CLASS_T_DEC\ntypename PB_DS_CLASS_C_DEC::entry_pointer_allocator\nPB_DS_CLASS_C_DEC::s_entry_pointer_allocator;\n\nPB_DS_CLASS_T_DEC\ntemplate<typename It>\nvoid\nPB_DS_CLASS_C_DEC::\ncopy_from_range(It first_it, It last_it)\n{\n  while (first_it != last_it)\n    insert(*(first_it++));\n}\n\nPB_DS_CLASS_T_DEC\nPB_DS_CLASS_C_DEC::\nPB_DS_CLASS_NAME() :\n  ranged_hash_fn_base(resize_base::get_nearest_larger_size(1)),\n  m_num_e(resize_base::get_nearest_larger_size(1)), m_num_used_e(0),\n  m_entries(s_entry_pointer_allocator.allocate(m_num_e))\n{\n  initialize();\n  _GLIBCXX_DEBUG_ONLY(PB_DS_CLASS_C_DEC::assert_valid();)\n}\n\nPB_DS_CLASS_T_DEC\nPB_DS_CLASS_C_DEC::\nPB_DS_CLASS_NAME(const Hash_Fn& r_hash_fn) :\n  ranged_hash_fn_base(resize_base::get_nearest_larger_size(1), r_hash_fn),\n  m_num_e(resize_base::get_nearest_larger_size(1)), m_num_used_e(0),\n  m_entries(s_entry_pointer_allocator.allocate(m_num_e))\n{\n  initialize();\n  _GLIBCXX_DEBUG_ONLY(PB_DS_CLASS_C_DEC::assert_valid();)\n}\n\nPB_DS_CLASS_T_DEC\nPB_DS_CLASS_C_DEC::\nPB_DS_CLASS_NAME(const Hash_Fn& r_hash_fn, const Eq_Fn& r_eq_fn) :\n  PB_DS_HASH_EQ_FN_C_DEC(r_eq_fn),\n  ranged_hash_fn_base(resize_base::get_nearest_larger_size(1), r_hash_fn),\n  m_num_e(resize_base::get_nearest_larger_size(1)), m_num_used_e(0),\n  m_entries(s_entry_pointer_allocator.allocate(m_num_e))\n{\n  std::fill(m_entries, m_entries + m_num_e, (entry_pointer)NULL);\n  Resize_Policy::notify_cleared();\n  ranged_hash_fn_base::notify_resized(m_num_e);\n  _GLIBCXX_DEBUG_ONLY(PB_DS_CLASS_C_DEC::assert_valid();)\n}\n\nPB_DS_CLASS_T_DEC\nPB_DS_CLASS_C_DEC::\nPB_DS_CLASS_NAME(const Hash_Fn& r_hash_fn, const Eq_Fn& r_eq_fn, const Comb_Hash_Fn& r_comb_hash_fn) :\n  PB_DS_HASH_EQ_FN_C_DEC(r_eq_fn),\n  ranged_hash_fn_base(resize_base::get_nearest_larger_size(1),\n\t\t      r_hash_fn, r_comb_hash_fn),\n  m_num_e(resize_base::get_nearest_larger_size(1)), m_num_used_e(0),\n  m_entries(s_entry_pointer_allocator.allocate(m_num_e))\n{\n  initialize();\n  _GLIBCXX_DEBUG_ONLY(PB_DS_CLASS_C_DEC::assert_valid();)\n}\n\nPB_DS_CLASS_T_DEC\nPB_DS_CLASS_C_DEC::\nPB_DS_CLASS_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) :\n  PB_DS_HASH_EQ_FN_C_DEC(r_eq_fn),\n  Resize_Policy(r_resize_policy),\n  ranged_hash_fn_base(resize_base::get_nearest_larger_size(1),\n\t\t      r_hash_fn, r_comb_hash_fn),\n  m_num_e(resize_base::get_nearest_larger_size(1)), m_num_used_e(0),\n  m_entries(s_entry_pointer_allocator.allocate(m_num_e))\n{\n  initialize();\n  _GLIBCXX_DEBUG_ONLY(PB_DS_CLASS_C_DEC::assert_valid();)\n}\n\nPB_DS_CLASS_T_DEC\nPB_DS_CLASS_C_DEC::\nPB_DS_CLASS_NAME(const PB_DS_CLASS_C_DEC& other) :\n#ifdef _GLIBCXX_DEBUG\n  map_debug_base(other),\n#endif \n  PB_DS_HASH_EQ_FN_C_DEC(other),\n  resize_base(other), ranged_hash_fn_base(other),\n  m_num_e(resize_base::get_nearest_larger_size(1)), m_num_used_e(0),\n  m_entries(m_entries = s_entry_pointer_allocator.allocate(m_num_e))\n{\n  initialize();\n  _GLIBCXX_DEBUG_ONLY(PB_DS_CLASS_C_DEC::assert_valid();)\n    try\n      {\n        copy_from_range(other.begin(), other.end());\n      }\n    catch(...)\n      {\n        deallocate_all();\n        __throw_exception_again;\n      }\n  _GLIBCXX_DEBUG_ONLY(PB_DS_CLASS_C_DEC::assert_valid();)\n}\n\nPB_DS_CLASS_T_DEC\nPB_DS_CLASS_C_DEC::\n~PB_DS_CLASS_NAME()\n{ deallocate_all(); }\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nswap(PB_DS_CLASS_C_DEC& other)\n{\n  _GLIBCXX_DEBUG_ONLY(assert_valid());\n  _GLIBCXX_DEBUG_ONLY(other.assert_valid());\n\n  std::swap(m_entries, other.m_entries);\n  std::swap(m_num_e, other.m_num_e);\n  std::swap(m_num_used_e, other.m_num_used_e);\n  ranged_hash_fn_base::swap(other);\n  hash_eq_fn_base::swap(other);\n  resize_base::swap(other);\n\n  _GLIBCXX_DEBUG_ONLY(map_debug_base::swap(other));\n  _GLIBCXX_DEBUG_ONLY(assert_valid());\n  _GLIBCXX_DEBUG_ONLY(other.assert_valid());\n}\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\ndeallocate_all()\n{\n  clear();\n  s_entry_pointer_allocator.deallocate(m_entries, m_num_e);\n}\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\ninitialize()\n{\n  std::fill(m_entries, m_entries + m_num_e, entry_pointer(NULL));\n  Resize_Policy::notify_resized(m_num_e);\n  Resize_Policy::notify_cleared();\n  ranged_hash_fn_base::notify_resized(m_num_e);\n}\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/detail/cc_hash_table_map_/constructor_destructor_no_store_hash_fn_imps.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file constructor_destructor_no_store_hash_fn_imps.hpp\n * Contains implementations of cc_ht_map_'s constructors, destructor,\n *    and related functions.\n */\n\nPB_DS_CLASS_T_DEC\ninline void\nPB_DS_CLASS_C_DEC::\nconstructor_insert_new_imp(const_mapped_reference r_val, size_type pos, \n\t\t\t   false_type)\n{\n  // Following lines might throw an exception.\n  entry_pointer p = get_entry(r_val, traits_base::s_no_throw_copies_indicator);\n\n  // At this point no exceptions can be thrown.\n  p->m_p_next = m_entries[pos];\n  m_entries[pos] = p;\n  _GLIBCXX_DEBUG_ONLY(map_debug_base::insert_new(r_key);)\n}\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/detail/cc_hash_table_map_/constructor_destructor_store_hash_fn_imps.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file constructor_destructor_store_hash_fn_imps.hpp\n * Contains implementations of cc_ht_map_'s constructors, destructor,\n *    and related functions.\n */\n\nPB_DS_CLASS_T_DEC\ninline void\nPB_DS_CLASS_C_DEC::\nconstructor_insert_new_imp(const_reference r_val, size_type pos, true_type)\n{\n  // Following lines might throw an exception.\n  entry_pointer p = get_entry(r_val, traits_base::s_no_throw_copies_indicator);\n\n  // At this point no exceptions can be thrown.\n  p->m_p_next = m_entries[pos];\n  p->m_hash = ranged_hash_fn_base::operator()((const_key_reference)(PB_DS_V2F(p->m_value))).second;\n\n  m_entries[pos] = p;\n  _GLIBCXX_DEBUG_ONLY(map_debug_base::insert_new(r_key);)\n}\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/detail/cc_hash_table_map_/debug_fn_imps.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file debug_fn_imps.hpp\n * Contains implementations of cc_ht_map_'s debug-mode functions.\n */\n\n#ifdef _GLIBCXX_DEBUG\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nassert_valid() const\n{\n  map_debug_base::check_size(m_num_used_e);\n  assert_entry_pointer_array_valid(m_entries);\n}\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nassert_entry_pointer_array_valid(const entry_pointer_array a_p_entries) const\n{\n  size_type iterated_num_used_e = 0;\n  for (size_type pos = 0; pos < m_num_e; ++pos)\n    {\n      entry_pointer p_e = a_p_entries[pos];\n      while (p_e != NULL)\n        {\n\t  ++iterated_num_used_e;\n\t  assert_entry_pointer_valid(p_e, traits_base::m_store_hash_indicator);\n\t  p_e = p_e->m_p_next;\n        }\n    }\n  _GLIBCXX_DEBUG_ASSERT(iterated_num_used_e == m_num_used_e);\n}\n\n#include <ext/pb_ds/detail/cc_hash_table_map_/debug_store_hash_fn_imps.hpp>\n#include <ext/pb_ds/detail/cc_hash_table_map_/debug_no_store_hash_fn_imps.hpp>\n\n#endif \n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/detail/cc_hash_table_map_/debug_no_store_hash_fn_imps.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file debug_no_store_hash_fn_imps.hpp\n * Contains implementations of cc_ht_map_'s debug-mode functions.\n */\n\n#ifdef _GLIBCXX_DEBUG\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nassert_entry_pointer_valid(const entry_pointer p, false_type) const\n{ map_debug_base::check_key_exists(PB_DS_V2F(p->m_value)); }\n\n#endif \n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/detail/cc_hash_table_map_/debug_store_hash_fn_imps.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file debug_store_hash_fn_imps.hpp\n * Contains implementations of cc_ht_map_'s debug-mode functions.\n */\n\n#ifdef _GLIBCXX_DEBUG\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nassert_entry_pointer_valid(const entry_pointer p_e, true_type) const\n{\n  map_debug_base::check_key_exists(PB_DS_V2F(p_e->m_value));\n  comp_hash pos_hash_pair = ranged_hash_fn_base::operator()(PB_DS_V2F(p_e->m_value));\n  _GLIBCXX_DEBUG_ASSERT(p_e->m_hash == pos_hash_pair.second);\n}\n\n#endif \n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/detail/cc_hash_table_map_/entry_list_fn_imps.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file entry_list_fn_imps.hpp\n * Contains implementations of cc_ht_map_'s entry-list related functions.\n */\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\ndeallocate_links_in_list(entry_pointer p_e)\n{\n  while (p_e != NULL)\n    {\n      entry_pointer p_dealloc_e = p_e;\n      p_e = p_e->m_p_next;\n      s_entry_allocator.deallocate(p_dealloc_e, 1);\n    }\n}\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::entry_pointer\nPB_DS_CLASS_C_DEC::\nget_entry(const_reference r_val, true_type)\n{\n  // Following line might throw an exception.\n  entry_pointer p_e = s_entry_allocator.allocate(1);\n\n  // Following lines* cannot* throw an exception.\n  new (&p_e->m_value) value_type(r_val);\n  return p_e;\n}\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::entry_pointer\nPB_DS_CLASS_C_DEC::\nget_entry(const_reference r_val, false_type)\n{\n  // Following line might throw an exception.\n  entry_pointer p_e = s_entry_allocator.allocate(1);\n  cond_dealtor_t cond(p_e);\n\n  // Following lines might throw an exception.\n  new (&p_e->m_value) value_type(r_val);\n  cond.set_no_action();\n  return p_e;\n}\n\nPB_DS_CLASS_T_DEC\ninline void\nPB_DS_CLASS_C_DEC::\nrels_entry(entry_pointer p_e)\n{\n  // The following lines cannot throw exceptions (unless if key-data dtors do).\n  p_e->m_value.~value_type();\n  s_entry_allocator.deallocate(p_e, 1);\n}\n\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/detail/cc_hash_table_map_/erase_fn_imps.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file erase_fn_imps.hpp\n * Contains implementations of cc_ht_map_'s erase related functions.\n */\n\nPB_DS_CLASS_T_DEC\ninline void\nPB_DS_CLASS_C_DEC::\nerase_entry_pointer(entry_pointer& r_p_e)\n{\n  _GLIBCXX_DEBUG_ONLY(map_debug_base::erase_existing(PB_DS_V2F(r_p_e->m_value)));\n\n  entry_pointer p_e = r_p_e;\n  r_p_e = r_p_e->m_p_next;\n  rels_entry(p_e);\n  _GLIBCXX_DEBUG_ASSERT(m_num_used_e > 0);\n  resize_base::notify_erased(--m_num_used_e);\n}\n\nPB_DS_CLASS_T_DEC\ntemplate<typename Pred>\ninline typename PB_DS_CLASS_C_DEC::size_type\nPB_DS_CLASS_C_DEC::\nerase_if(Pred pred)\n{\n  size_type num_ersd = 0;\n  for (size_type pos = 0; pos < m_num_e; ++pos)\n    {\n      while (m_entries[pos] != NULL && pred(m_entries[pos]->m_value))\n        {\n\t  ++num_ersd;\n\t  entry_pointer p_next_e = m_entries[pos]->m_p_next;\n\t  erase_entry_pointer(m_entries[pos]);\n\t  m_entries[pos] = p_next_e;\n        }\n\n      entry_pointer p_e = m_entries[pos];\n      while (p_e != NULL && p_e->m_p_next != NULL)\n        {\n\t  if (pred(p_e->m_p_next->m_value))\n            {\n\t      ++num_ersd;\n\t      erase_entry_pointer(p_e->m_p_next);\n            }\n\t  else\n\t    p_e = p_e->m_p_next;\n        }\n    }\n\n  do_resize_if_needed_no_throw();\n  return num_ersd;\n}\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nclear()\n{\n  for (size_type pos = 0; pos < m_num_e; ++pos)\n    while (m_entries[pos] != NULL)\n      erase_entry_pointer(m_entries[pos]);\n  do_resize_if_needed_no_throw();\n  resize_base::notify_cleared();\n}\n\n#include <ext/pb_ds/detail/cc_hash_table_map_/erase_no_store_hash_fn_imps.hpp>\n#include <ext/pb_ds/detail/cc_hash_table_map_/erase_store_hash_fn_imps.hpp>\n\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/detail/cc_hash_table_map_/erase_no_store_hash_fn_imps.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file erase_no_store_hash_fn_imps.hpp\n * Contains implementations of cc_ht_map_'s erase related functions,\n * when the hash value is not stored.\n */\n\nPB_DS_CLASS_T_DEC\ninline bool\nPB_DS_CLASS_C_DEC::\nerase(const_key_reference r_key)\n{\n  _GLIBCXX_DEBUG_ONLY(assert_valid();)\n  return erase_in_pos_imp(r_key, ranged_hash_fn_base::operator()(r_key));\n}\n\nPB_DS_CLASS_T_DEC\ninline bool\nPB_DS_CLASS_C_DEC::\nerase_in_pos_imp(const_key_reference r_key, size_type pos)\n{\n  _GLIBCXX_DEBUG_ONLY(assert_valid();)\n  entry_pointer p_e = m_entries[pos];\n  resize_base::notify_erase_search_start();\n  if (p_e == NULL)\n    {\n      resize_base::notify_erase_search_end();\n      _GLIBCXX_DEBUG_ONLY(map_debug_base::check_key_does_not_exist(r_key);)\n      _GLIBCXX_DEBUG_ONLY(assert_valid();)\n      return false;\n    }\n\n  if (hash_eq_fn_base::operator()(PB_DS_V2F(p_e->m_value), r_key))\n    {\n      resize_base::notify_erase_search_end();\n      _GLIBCXX_DEBUG_ONLY(map_debug_base:: check_key_exists(r_key);)\n      erase_entry_pointer(m_entries[pos]);\n      do_resize_if_needed_no_throw();\n      _GLIBCXX_DEBUG_ONLY(assert_valid();)\n      return true;\n    }\n\n  while (true)\n    {\n      entry_pointer p_next_e = p_e->m_p_next;\n      if (p_next_e == NULL)\n        {\n\t  resize_base::notify_erase_search_end();\n\t  _GLIBCXX_DEBUG_ONLY(map_debug_base::check_key_does_not_exist(r_key);)\n          _GLIBCXX_DEBUG_ONLY(assert_valid();)\n          return false;\n        }\n\n      if (hash_eq_fn_base::operator()(PB_DS_V2F(p_next_e->m_value), r_key))\n        {\n\t  resize_base::notify_erase_search_end();\n\t  _GLIBCXX_DEBUG_ONLY(map_debug_base::check_key_exists(r_key);)\n          erase_entry_pointer(p_e->m_p_next);\n\t  do_resize_if_needed_no_throw();\n\t  _GLIBCXX_DEBUG_ONLY(assert_valid();)\n          return true;\n        }\n      resize_base::notify_erase_search_collision();\n      p_e = p_next_e;\n    }\n}\n\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/detail/cc_hash_table_map_/erase_store_hash_fn_imps.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file erase_store_hash_fn_imps.hpp\n * Contains implementations of cc_ht_map_'s erase related functions,\n * when the hash value is stored.\n */\n\nPB_DS_CLASS_T_DEC\ninline bool\nPB_DS_CLASS_C_DEC::\nerase_in_pos_imp(const_key_reference r_key, const comp_hash& r_pos_hash_pair)\n{\n  _GLIBCXX_DEBUG_ONLY(assert_valid();)\n  entry_pointer p_e = m_entries[r_pos_hash_pair.first];\n  resize_base::notify_erase_search_start();\n  if (p_e == NULL)\n    {\n      resize_base::notify_erase_search_end();\n      _GLIBCXX_DEBUG_ONLY(map_debug_base:: check_key_does_not_exist(r_key);)\n      _GLIBCXX_DEBUG_ONLY(assert_valid();)\n      return false;\n    }\n\n  if (hash_eq_fn_base::operator()(PB_DS_V2F(p_e->m_value), p_e->m_hash,\n\t\t\t\t  r_key, r_pos_hash_pair.second))\n    {\n      resize_base::notify_erase_search_end();\n      _GLIBCXX_DEBUG_ONLY(map_debug_base::check_key_exists(r_key);)\n      erase_entry_pointer(m_entries[r_pos_hash_pair.first]);\n      do_resize_if_needed_no_throw();\n      _GLIBCXX_DEBUG_ONLY(assert_valid();)\n      return true;\n    }\n\n  while (true)\n    {\n      entry_pointer p_next_e = p_e->m_p_next;\n      if (p_next_e == NULL)\n        {\n\t  resize_base::notify_erase_search_end();\n\t  _GLIBCXX_DEBUG_ONLY(map_debug_base::check_key_does_not_exist(r_key);)\n          _GLIBCXX_DEBUG_ONLY(assert_valid();)\n          return false;\n        }\n\n      if (hash_eq_fn_base::operator()(PB_DS_V2F(p_next_e->m_value),\n\t\t\t\t      p_next_e->m_hash, r_key,\n\t\t\t\t      r_pos_hash_pair.second))\n        {\n\t  resize_base::notify_erase_search_end();\n\t  _GLIBCXX_DEBUG_ONLY(map_debug_base::check_key_exists(r_key);)\n          erase_entry_pointer(p_e->m_p_next);\n\t  do_resize_if_needed_no_throw();\n\t  _GLIBCXX_DEBUG_ONLY(assert_valid();)\n          return true;\n        }\n      resize_base::notify_erase_search_collision();\n      p_e = p_next_e;\n    }\n}\n\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/detail/cc_hash_table_map_/find_fn_imps.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file find_fn_imps.hpp\n * Contains implementations of cc_ht_map_'s find related functions.\n */\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::point_iterator\nPB_DS_CLASS_C_DEC::\nfind(const_key_reference r_key)\n{\n  _GLIBCXX_DEBUG_ONLY(assert_valid();)\n  return find_key_pointer(r_key, traits_base::m_store_extra_indicator);\n}\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::const_point_iterator\nPB_DS_CLASS_C_DEC::\nfind(const_key_reference r_key) const\n{\n  _GLIBCXX_DEBUG_ONLY(assert_valid();)\n  return const_cast<PB_DS_CLASS_C_DEC& >(*this).find_key_pointer(r_key, \n\t\t\t\t\ttraits_base::m_store_extra_indicator);\n}\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::point_iterator\nPB_DS_CLASS_C_DEC::\nfind_end()\n{ return NULL; }\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::const_point_iterator\nPB_DS_CLASS_C_DEC::\nfind_end() const\n{ return NULL; }\n\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/detail/cc_hash_table_map_/find_store_hash_fn_imps.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file find_store_hash_fn_imps.hpp\n * Contains implementations of cc_ht_map_'s find related functions,\n * when the hash value is stored.\n */\n\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/detail/cc_hash_table_map_/info_fn_imps.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file info_fn_imps.hpp\n * Contains implementations of cc_ht_map_'s entire container info related\n * functions.\n */\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::size_type\nPB_DS_CLASS_C_DEC::\nsize() const\n{ return m_num_used_e; }\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::size_type\nPB_DS_CLASS_C_DEC::\nmax_size() const\n{ return m_entry_allocator.max_size(); }\n\nPB_DS_CLASS_T_DEC\ninline bool\nPB_DS_CLASS_C_DEC::\nempty() const\n{ return (size() == 0); }\n\nPB_DS_CLASS_T_DEC\ntemplate<typename Other_HT_Map_Type>\nbool\nPB_DS_CLASS_C_DEC::\noperator==(const Other_HT_Map_Type& other) const\n{ return cmp_with_other(other); }\n\nPB_DS_CLASS_T_DEC\ntemplate<typename Other_Map_Type>\nbool\nPB_DS_CLASS_C_DEC::\ncmp_with_other(const Other_Map_Type& other) const\n{\n  if (size() != other.size())\n    return false;\n\n  for (typename Other_Map_Type::const_iterator it = other.begin();\n       it != other.end(); ++it)\n    {\n      const_key_reference r_key =(const_key_reference)PB_DS_V2F(*it);\n      const_mapped_pointer p_mapped_value =\n\tconst_cast<PB_DS_CLASS_C_DEC& >(*this).\n\tfind_key_pointer(r_key, traits_base::m_store_hash_indicator);\n\n      if (p_mapped_value == NULL)\n\treturn false;\n\n#ifdef PB_DS_DATA_TRUE_INDICATOR\n      if (p_mapped_value->second != it->second)\n\treturn false;\n#endif \n    }\n  return true;\n}\n\nPB_DS_CLASS_T_DEC\ntemplate<typename Other_HT_Map_Type>\nbool\nPB_DS_CLASS_C_DEC::\noperator!=(const Other_HT_Map_Type& other) const\n{ return !operator==(other); }\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/detail/cc_hash_table_map_/insert_fn_imps.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file insert_fn_imps.hpp\n * Contains implementations of cc_ht_map_'s insert related functions.\n */\n\n#include <ext/pb_ds/detail/cc_hash_table_map_/insert_no_store_hash_fn_imps.hpp>\n#include <ext/pb_ds/detail/cc_hash_table_map_/insert_store_hash_fn_imps.hpp>\n\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/detail/cc_hash_table_map_/insert_no_store_hash_fn_imps.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file insert_no_store_hash_fn_imps.hpp\n * Contains implementations of cc_ht_map_'s insert related functions,\n * when the hash value is not stored.\n */\n\nPB_DS_CLASS_T_DEC\ninline std::pair<typename PB_DS_CLASS_C_DEC::point_iterator, bool>\nPB_DS_CLASS_C_DEC::\ninsert_imp(const_reference r_val, false_type)\n{\n  _GLIBCXX_DEBUG_ONLY(assert_valid();)\n  const_key_reference r_key = PB_DS_V2F(r_val);\n  const size_type pos = ranged_hash_fn_base::operator()(r_key);\n  entry_pointer p_e = m_entries[pos];\n  resize_base::notify_insert_search_start();\n\n  while (p_e != NULL && !hash_eq_fn_base::operator()(PB_DS_V2F(p_e->m_value), \n\t\t\t\t\t\t     r_key))\n    {\n      resize_base::notify_insert_search_collision();\n      p_e = p_e->m_p_next;\n    }\n\n  resize_base::notify_insert_search_end();\n  if (p_e != NULL)\n    {\n      _GLIBCXX_DEBUG_ONLY(map_debug_base::check_key_exists(r_key);)\n      return std::make_pair(&p_e->m_value, false);\n    }\n\n  _GLIBCXX_DEBUG_ONLY(map_debug_base::check_key_does_not_exist(r_key);)\n  return std::make_pair(insert_new_imp(r_val, pos), true);\n}\n\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/detail/cc_hash_table_map_/insert_store_hash_fn_imps.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file insert_store_hash_fn_imps.hpp\n * Contains implementations of cc_ht_map_'s insert related functions,\n * when the hash value is stored.\n */\n\nPB_DS_CLASS_T_DEC\ninline std::pair<typename PB_DS_CLASS_C_DEC::point_iterator, bool>\nPB_DS_CLASS_C_DEC::\ninsert_imp(const_reference r_val, true_type)\n{\n  _GLIBCXX_DEBUG_ONLY(assert_valid();)\n  const_key_reference key = PB_DS_V2F(r_val);\n  comp_hash pos_hash_pair = ranged_hash_fn_base::operator()(key);\n  entry_pointer p_e = m_entries[pos_hash_pair.first];\n  resize_base::notify_insert_search_start();\n\n  while (p_e != NULL && !hash_eq_fn_base::operator()(PB_DS_V2F(p_e->m_value),\n\t\t\t\t\t\t     p_e->m_hash,\n\t\t\t\t\t\t    key, pos_hash_pair.second))\n    {\n      resize_base::notify_insert_search_collision();\n      p_e = p_e->m_p_next;\n    }\n\n  resize_base::notify_insert_search_end();\n  if (p_e != NULL)\n    {\n      _GLIBCXX_DEBUG_ONLY(map_debug_base::check_key_exists(key);)\n      return std::make_pair(&p_e->m_value, false);\n    }\n\n  _GLIBCXX_DEBUG_ONLY(map_debug_base::check_key_does_not_exist(key);)\n  return std::make_pair(insert_new_imp(r_val, pos_hash_pair), true);\n}\n\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/detail/cc_hash_table_map_/iterators_fn_imps.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file iterators_fn_imps.hpp\n * Contains implementations of cc_ht_map_'s iterators related functions, e.g.,\n * begin().\n */\n\nPB_DS_CLASS_T_DEC\ntypename PB_DS_CLASS_C_DEC::iterator\nPB_DS_CLASS_C_DEC::s_end_it;\n\nPB_DS_CLASS_T_DEC\ntypename PB_DS_CLASS_C_DEC::const_iterator\nPB_DS_CLASS_C_DEC::s_const_end_it;\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::iterator\nPB_DS_CLASS_C_DEC::\nbegin()\n{\n  pointer p_value;\n  std::pair<entry_pointer, size_type> pos;\n  get_start_it_state(p_value, pos);\n  return iterator(p_value, pos, this);\n}\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::iterator\nPB_DS_CLASS_C_DEC::\nend()\n{ return s_end_it; }\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::const_iterator\nPB_DS_CLASS_C_DEC::\nbegin() const\n{\n  pointer p_value;\n  std::pair<entry_pointer, size_type> pos;\n  get_start_it_state(p_value, pos);\n  return const_iterator(p_value, pos, this);\n}\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::const_iterator\nPB_DS_CLASS_C_DEC::\nend() const\n{ return s_const_end_it; }\n\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/detail/cc_hash_table_map_/policy_access_fn_imps.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file policy_access_fn_imps.hpp\n * Contains implementations of cc_ht_map_'s policy access\n *    functions.\n */\n\nPB_DS_CLASS_T_DEC\nHash_Fn& \nPB_DS_CLASS_C_DEC::\nget_hash_fn()\n{ return *this; }\n\nPB_DS_CLASS_T_DEC\nconst Hash_Fn& \nPB_DS_CLASS_C_DEC::\nget_hash_fn() const\n{ return *this; }\n\nPB_DS_CLASS_T_DEC\nEq_Fn& \nPB_DS_CLASS_C_DEC::\nget_eq_fn()\n{ return *this; }\n\nPB_DS_CLASS_T_DEC\nconst Eq_Fn& \nPB_DS_CLASS_C_DEC::\nget_eq_fn() const\n{ return *this; }\n\nPB_DS_CLASS_T_DEC\nComb_Hash_Fn& \nPB_DS_CLASS_C_DEC::\nget_comb_hash_fn()\n{ return *this; }\n\nPB_DS_CLASS_T_DEC\nconst Comb_Hash_Fn& \nPB_DS_CLASS_C_DEC::\nget_comb_hash_fn() const\n{ return *this; }\n\nPB_DS_CLASS_T_DEC\nResize_Policy& \nPB_DS_CLASS_C_DEC::\nget_resize_policy()\n{ return *this; }\n\nPB_DS_CLASS_T_DEC\nconst Resize_Policy& \nPB_DS_CLASS_C_DEC::\nget_resize_policy() const\n{ return *this; }\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/detail/cc_hash_table_map_/resize_fn_imps.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file resize_fn_imps.hpp\n * Contains implementations of cc_ht_map_'s resize related functions.\n */\n\nPB_DS_CLASS_T_DEC\ninline bool\nPB_DS_CLASS_C_DEC::\ndo_resize_if_needed()\n{\n  if (!resize_base::is_resize_needed())\n    return false;\n  resize_imp(resize_base::get_new_size(m_num_e, m_num_used_e));\n  return true;\n}\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\ndo_resize(size_type len)\n{ resize_imp(resize_base::get_nearest_larger_size(len)); }\n\nPB_DS_CLASS_T_DEC\ninline void\nPB_DS_CLASS_C_DEC::\ndo_resize_if_needed_no_throw()\n{\n  if (!resize_base::is_resize_needed())\n    return;\n\n  try\n    {\n      resize_imp(resize_base::get_new_size(m_num_e, m_num_used_e));\n    }\n  catch(...)\n    { }\n\n  _GLIBCXX_DEBUG_ONLY(assert_valid();)\n}\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nresize_imp(size_type new_size)\n{\n  _GLIBCXX_DEBUG_ONLY(assert_valid();)\n  if (new_size == m_num_e)\n    return;\n\n  const size_type old_size = m_num_e;\n  entry_pointer_array a_p_entries_resized;\n\n  // Following line might throw an exception.\n  ranged_hash_fn_base::notify_resized(new_size);\n\n  try\n    {\n      // Following line might throw an exception.\n      a_p_entries_resized = s_entry_pointer_allocator.allocate(new_size);\n      m_num_e = new_size;\n    }\n  catch(...)\n    {\n      ranged_hash_fn_base::notify_resized(old_size);\n      __throw_exception_again;\n    }\n\n  // At this point no exceptions can be thrown.\n  resize_imp_no_exceptions(new_size, a_p_entries_resized, old_size);\n  Resize_Policy::notify_resized(new_size);\n  _GLIBCXX_DEBUG_ONLY(assert_valid();)\n}\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nresize_imp_no_exceptions(size_type new_size, entry_pointer_array a_p_entries_resized, size_type old_size)\n{\n  std::fill(a_p_entries_resized, a_p_entries_resized + m_num_e,\n\t    entry_pointer(NULL));\n\n  for (size_type pos = 0; pos < old_size; ++pos)\n    {\n      entry_pointer p_e = m_entries[pos];\n      while (p_e != NULL)\n\tp_e = resize_imp_no_exceptions_reassign_pointer(p_e, a_p_entries_resized,  traits_base::m_store_extra_indicator);\n    }\n\n  m_num_e = new_size;\n  _GLIBCXX_DEBUG_ONLY(assert_entry_pointer_array_valid(a_p_entries_resized);)\n  s_entry_pointer_allocator.deallocate(m_entries, old_size);\n  m_entries = a_p_entries_resized;\n  _GLIBCXX_DEBUG_ONLY(assert_valid();)\n}\n\n#include <ext/pb_ds/detail/cc_hash_table_map_/resize_no_store_hash_fn_imps.hpp>\n#include <ext/pb_ds/detail/cc_hash_table_map_/resize_store_hash_fn_imps.hpp>\n\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/detail/cc_hash_table_map_/resize_no_store_hash_fn_imps.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file resize_no_store_hash_fn_imps.hpp\n * Contains implementations of cc_ht_map_'s resize related functions, when the\n *    hash value is not stored.\n */\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::entry_pointer\nPB_DS_CLASS_C_DEC::\nresize_imp_no_exceptions_reassign_pointer(entry_pointer p_e, entry_pointer_array a_p_entries_resized, false_type)\n{\n  const size_type hash_pos =\n    ranged_hash_fn_base::operator()(PB_DS_V2F(p_e->m_value));\n\n  entry_pointer const p_next_e = p_e->m_p_next;\n  p_e->m_p_next = a_p_entries_resized[hash_pos];\n  a_p_entries_resized[hash_pos] = p_e;\n  return p_next_e;\n}\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/detail/cc_hash_table_map_/resize_store_hash_fn_imps.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file resize_store_hash_fn_imps.hpp\n * Contains implementations of cc_ht_map_'s resize related functions, when the\n *    hash value is stored.\n */\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::entry_pointer\nPB_DS_CLASS_C_DEC::\nresize_imp_no_exceptions_reassign_pointer(entry_pointer p_e, entry_pointer_array a_p_entries_resized, true_type)\n{\n  const comp_hash pos_hash_pair =\n    ranged_hash_fn_base::operator()(PB_DS_V2F(p_e->m_value), p_e->m_hash);\n\n  entry_pointer const p_next_e = p_e->m_p_next;\n  p_e->m_p_next = a_p_entries_resized[pos_hash_pair.first];\n  a_p_entries_resized[pos_hash_pair.first] = p_e;\n  return p_next_e;\n}\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/detail/cc_hash_table_map_/size_fn_imps.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file size_fn_imps.hpp\n * Contains implementations of cc_ht_map_'s entire container size related\n *    functions.\n */\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::size_type\nPB_DS_CLASS_C_DEC::\nsize() const\n{ return m_num_used_e; }\n\nPB_DS_CLASS_T_DEC\ninline bool\nPB_DS_CLASS_C_DEC::\nempty() const\n{ return (size() == 0); }\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::size_type\nPB_DS_CLASS_C_DEC::\nmax_size() const\n{ return s_entry_allocator.max_size(); }\n\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/detail/cc_hash_table_map_/standard_policies.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file standard_policies.hpp\n * Contains standard policies for cc_ht_map types.\n */\n\n#ifndef PB_DS_CC_HT_MAP_STANDARD_POLICIES_HPP\n#define PB_DS_CC_HT_MAP_STANDARD_POLICIES_HPP\n\n#include <ext/pb_ds/detail/standard_policies.hpp>\n\n#endif // #ifndef PB_DS_CC_HT_MAP_STANDARD_POLICIES_HPP\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/detail/cc_hash_table_map_/trace_fn_imps.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file trace_fn_imps.hpp\n * Contains implementations of cc_ht_map_'s trace-mode functions.\n */\n\n#ifdef PB_DS_HT_MAP_TRACE_\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\ntrace() const\n{\n  std::cerr << static_cast<unsigned long>(m_num_e) << \" \" \n\t    << static_cast<unsigned long>(m_num_used_e) << std::endl;\n\n  for (size_type i = 0; i < m_num_e; ++i)\n    {\n      std::cerr << static_cast<unsigned long>(i) << \" \";\n      trace_list(m_entries[i]);\n      std::cerr << std::endl;\n    }\n}\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\ntrace_list(const_entry_pointer p_l) const\n{\n  size_type iterated_num_used_e = 0;\n  while (p_l != NULL)\n    {\n      std::cerr << PB_DS_V2F(p_l->m_value) << \" \";\n      p_l = p_l->m_p_next;\n    }\n}\n\n#endif \n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/detail/cond_dealtor.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file cond_dealtor.hpp\n * Contains a conditional deallocator.\n */\n\n#ifndef PB_DS_COND_DEALTOR_HPP\n#define PB_DS_COND_DEALTOR_HPP\n\nnamespace pb_ds\n{\n\n  namespace detail\n  {\n\n#define PB_DS_COND_DEALTOR_CLASS_T_DEC\t\t\\\n    template<typename Entry, class Allocator>\n\n#define PB_DS_COND_DEALTOR_CLASS_C_DEC\t\t\t\t\\\n    cond_dealtor<\t\t\t\t\t\t\\\n\t\t\t\t\t\tEntry,\t\t\\\n\t\t\t\t\t\tAllocator>\n\n    template<typename Entry, class Allocator>\n    class cond_dealtor\n    {\n    public:\n      typedef\n      typename Allocator::template rebind<Entry>::other\n      entry_allocator;\n\n      typedef typename entry_allocator::pointer entry_pointer;\n\n    public:\n      inline\n      cond_dealtor(entry_pointer p_e);\n\n      inline\n      ~cond_dealtor();\n\n      inline void\n      set_no_action();\n\n    private:\n      entry_pointer m_p_e;\n\n      bool m_no_action_destructor;\n\n      static entry_allocator s_alloc;\n    };\n\n    PB_DS_COND_DEALTOR_CLASS_T_DEC\n    typename PB_DS_COND_DEALTOR_CLASS_C_DEC::entry_allocator\n    PB_DS_COND_DEALTOR_CLASS_C_DEC::s_alloc;\n\n    PB_DS_COND_DEALTOR_CLASS_T_DEC\n    inline\n    PB_DS_COND_DEALTOR_CLASS_C_DEC::\n    cond_dealtor(entry_pointer p_e) :\n      m_p_e(p_e),\n      m_no_action_destructor(false)\n    { }\n\n    PB_DS_COND_DEALTOR_CLASS_T_DEC\n    inline void\n    PB_DS_COND_DEALTOR_CLASS_C_DEC::\n    set_no_action()\n    {\n      m_no_action_destructor = true;\n    }\n\n    PB_DS_COND_DEALTOR_CLASS_T_DEC\n    inline\n    PB_DS_COND_DEALTOR_CLASS_C_DEC::\n    ~cond_dealtor()\n    {\n      if (m_no_action_destructor)\n        return;\n\n      s_alloc.deallocate(m_p_e, 1);\n    }\n\n#undef PB_DS_COND_DEALTOR_CLASS_T_DEC\n#undef PB_DS_COND_DEALTOR_CLASS_C_DEC\n\n  } // namespace detail\n\n} // namespace pb_ds\n\n#endif // #ifndef PB_DS_COND_DEALTOR_HPP\n\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/detail/constructors_destructor_fn_imps.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file constructors_destructor_fn_imps.hpp\n * Contains constructors_destructor_fn_imps applicable to different containers.\n */\n\ninline\nPB_DS_CLASS_NAME()\n{ }\n\ninline\nPB_DS_CLASS_NAME(const PB_DS_CLASS_NAME& other) \n: base_type((const base_type&)other)\n{ }\n\ntemplate<typename T0>\ninline\nPB_DS_CLASS_NAME(T0 t0) : base_type(t0)\n{ }\n\ntemplate<typename T0, typename T1>\ninline\nPB_DS_CLASS_NAME(T0 t0, T1 t1) : base_type(t0, t1)\n{ }\n\ntemplate<typename T0, typename T1, typename T2>\ninline\nPB_DS_CLASS_NAME(T0 t0, T1 t1, T2 t2) : base_type(t0, t1, t2)\n{ }\n\ntemplate<typename T0, typename T1, typename T2, typename T3>\ninline\nPB_DS_CLASS_NAME(T0 t0, T1 t1, T2 t2, T3 t3) \n: base_type(t0, t1, t2, t3)\n{ }\n\ntemplate<typename T0, typename T1, typename T2, typename T3, typename T4>\ninline\nPB_DS_CLASS_NAME(T0 t0, T1 t1, T2 t2, T3 t3, T4 t4) \n: base_type(t0, t1, t2, t3, t4)\n{ }\n\ntemplate<typename T0, typename T1, typename T2, typename T3, typename T4,\n\t typename T5>\ninline\nPB_DS_CLASS_NAME(T0 t0, T1 t1, T2 t2, T3 t3, T4 t4, T5 t5) \n: base_type(t0, t1, t2, t3, t4, t5)\n{ }\n\ntemplate<typename T0, typename T1, typename T2, typename T3, typename T4,\n\t typename T5, typename T6>\ninline\nPB_DS_CLASS_NAME(T0 t0, T1 t1, T2 t2, T3 t3, T4 t4, T5 t5, T6 t6) \n: base_type(t0, t1, t2, t3, t4, t5, t6)\n{ }\n\ntemplate<typename T0, typename T1, typename T2, typename T3, typename T4,\n\t typename T5, typename T6, typename T7>\ninline\nPB_DS_CLASS_NAME(T0 t0, T1 t1, T2 t2, T3 t3, T4 t4, T5 t5, T6 t6, T7 t7) \n: base_type(t0, t1, t2, t3, t4, t5, t6, t7)\n{ }\n\ntemplate<typename T0, typename T1, typename T2, typename T3, typename T4,\n\t typename T5, typename T6, typename T7, typename T8>\ninline\nPB_DS_CLASS_NAME(T0 t0, T1 t1, T2 t2, T3 t3, T4 t4, T5 t5, T6 t6, T7 t7, T8 t8)\n: base_type(t0, t1, t2, t3, t4, t5, t6, t7, t8)\n{ }\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/detail/container_base_dispatch.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file container_base_dispatch.hpp\n * Contains an associative container dispatching base.\n */\n\n#ifndef PB_DS_ASSOC_CNTNR_BASE_DS_DISPATCHER_HPP\n#define PB_DS_ASSOC_CNTNR_BASE_DS_DISPATCHER_HPP\n\n#include <ext/typelist.h>\n\n#define PB_DS_DATA_TRUE_INDICATOR\n#include <ext/pb_ds/detail/list_update_map_/lu_map_.hpp>\n#undef PB_DS_DATA_TRUE_INDICATOR\n\n#define PB_DS_DATA_FALSE_INDICATOR\n#include <ext/pb_ds/detail/list_update_map_/lu_map_.hpp>\n#undef PB_DS_DATA_FALSE_INDICATOR\n\n#define PB_DS_DATA_TRUE_INDICATOR\n#include <ext/pb_ds/detail/rb_tree_map_/rb_tree_.hpp>\n#undef PB_DS_DATA_TRUE_INDICATOR\n\n#define PB_DS_DATA_FALSE_INDICATOR\n#include <ext/pb_ds/detail/rb_tree_map_/rb_tree_.hpp>\n#undef PB_DS_DATA_FALSE_INDICATOR\n\n#define PB_DS_DATA_TRUE_INDICATOR\n#include <ext/pb_ds/detail/splay_tree_/splay_tree_.hpp>\n#undef PB_DS_DATA_TRUE_INDICATOR\n\n#define PB_DS_DATA_FALSE_INDICATOR\n#include <ext/pb_ds/detail/splay_tree_/splay_tree_.hpp>\n#undef PB_DS_DATA_FALSE_INDICATOR\n\n#define PB_DS_DATA_TRUE_INDICATOR\n#include <ext/pb_ds/detail/ov_tree_map_/ov_tree_map_.hpp>\n#undef PB_DS_DATA_TRUE_INDICATOR\n\n#define PB_DS_DATA_FALSE_INDICATOR\n#include <ext/pb_ds/detail/ov_tree_map_/ov_tree_map_.hpp>\n#undef PB_DS_DATA_FALSE_INDICATOR\n\n#define PB_DS_DATA_TRUE_INDICATOR\n#include <ext/pb_ds/detail/cc_hash_table_map_/cc_ht_map_.hpp>\n#undef PB_DS_DATA_TRUE_INDICATOR\n\n#define PB_DS_DATA_FALSE_INDICATOR\n#include <ext/pb_ds/detail/cc_hash_table_map_/cc_ht_map_.hpp>\n#undef PB_DS_DATA_FALSE_INDICATOR\n\n#define PB_DS_DATA_TRUE_INDICATOR\n#include <ext/pb_ds/detail/gp_hash_table_map_/gp_ht_map_.hpp>\n#undef PB_DS_DATA_TRUE_INDICATOR\n\n#define PB_DS_DATA_FALSE_INDICATOR\n#include <ext/pb_ds/detail/gp_hash_table_map_/gp_ht_map_.hpp>\n#undef PB_DS_DATA_FALSE_INDICATOR\n\n#define PB_DS_DATA_TRUE_INDICATOR\n#include <ext/pb_ds/detail/pat_trie_/pat_trie_.hpp>\n#undef PB_DS_DATA_TRUE_INDICATOR\n\n#define PB_DS_DATA_FALSE_INDICATOR\n#include <ext/pb_ds/detail/pat_trie_/pat_trie_.hpp>\n#undef PB_DS_DATA_FALSE_INDICATOR\n\nnamespace pb_ds\n{\nnamespace detail\n{\n  // Primary template.\n  template<typename Key, typename Mapped, typename Data_Structure_Taq,\n\t   typename Policy_Tl, typename Alloc>\n    struct container_base_dispatch;\n\n  template<typename Key, typename Mapped, typename Policy_Tl, typename Alloc>\n    struct container_base_dispatch<Key, Mapped, list_update_tag, \n\t\t\t\t   Policy_Tl, Alloc>\n    {\n    private:\n      typedef __gnu_cxx::typelist::at_index<Policy_Tl, 0>\tat0;\n      typedef typename at0::type\t\t\t    \tat0t;\n      typedef __gnu_cxx::typelist::at_index<Policy_Tl, 1> \tat1;\n      typedef typename at1::type\t\t\t    \tat1t;\n      \n    public:\n      typedef lu_map_data_<Key, Mapped, at0t, Alloc, at1t>\ttype;\n    };\n\n  template<typename Key, typename Policy_Tl, typename Alloc>\n    struct container_base_dispatch<Key, null_mapped_type, list_update_tag,\n\t\t\t\t   Policy_Tl, Alloc>\n    {\n    private:\n      typedef __gnu_cxx::typelist::at_index<Policy_Tl, 0>\tat0;\n      typedef typename at0::type\t\t\t    \tat0t;\n      typedef __gnu_cxx::typelist::at_index<Policy_Tl, 1> \tat1;\n      typedef typename at1::type\t\t\t    \tat1t;\n\n    public:\n      typedef lu_map_no_data_<Key, null_mapped_type, at0t, Alloc, at1t> type;\n    };\n\n  template<typename Key, typename Mapped, typename Policy_Tl, typename Alloc>\n    struct container_base_dispatch<Key, Mapped, pat_trie_tag, Policy_Tl, Alloc>\n    {\n    private:\n      typedef __gnu_cxx::typelist::at_index<Policy_Tl, 1> \tat1;\n      typedef typename at1::type\t\t\t    \tat1t;\n\n    public:\n      typedef pat_trie_data_<Key, Mapped, at1t, Alloc> \t\ttype;\n    };\n\n  template<typename Key, typename Policy_Tl, typename Alloc>\n    struct container_base_dispatch<Key, null_mapped_type, pat_trie_tag,\n\t\t\t\t   Policy_Tl, Alloc>\n    {\n    private:\n      typedef __gnu_cxx::typelist::at_index<Policy_Tl, 1> \tat1;\n      typedef typename at1::type\t\t\t    \tat1t;\n\n    public:\n      typedef pat_trie_no_data_<Key, null_mapped_type, at1t, Alloc> type;\n    };\n\n  template<typename Key, typename Mapped, typename Policy_Tl, typename Alloc>\n    struct container_base_dispatch<Key, Mapped, rb_tree_tag, Policy_Tl, Alloc>\n    {\n    private:\n      typedef __gnu_cxx::typelist::at_index<Policy_Tl, 0>\tat0;\n      typedef typename at0::type\t\t\t    \tat0t;\n      typedef __gnu_cxx::typelist::at_index<Policy_Tl, 1> \tat1;\n      typedef typename at1::type\t\t\t    \tat1t;\n\n    public:\n      typedef rb_tree_data_<Key, Mapped, at0t, at1t, Alloc> \ttype;\n    };\n\n  template<typename Key, typename Policy_Tl, typename Alloc>\n    struct container_base_dispatch<Key, null_mapped_type, rb_tree_tag,\n\t\t\t\t   Policy_Tl, Alloc>\n    {\n    private:\n      typedef __gnu_cxx::typelist::at_index<Policy_Tl, 0>\tat0;\n      typedef typename at0::type\t\t\t    \tat0t;\n      typedef __gnu_cxx::typelist::at_index<Policy_Tl, 1> \tat1;\n      typedef typename at1::type\t\t\t    \tat1t;\n\n    public:\n      typedef rb_tree_no_data_<Key, null_mapped_type, at0t, at1t, Alloc> type;\n    };\n\n  template<typename Key, typename Mapped, typename Policy_Tl, typename Alloc>\n    struct container_base_dispatch<Key, Mapped, splay_tree_tag, \n\t\t\t\t   Policy_Tl, Alloc>\n    {\n    private:\n      typedef __gnu_cxx::typelist::at_index<Policy_Tl, 0>\tat0;\n      typedef typename at0::type\t\t\t    \tat0t;\n      typedef __gnu_cxx::typelist::at_index<Policy_Tl, 1> \tat1;\n      typedef typename at1::type\t\t\t    \tat1t;\n\n    public:\n      typedef splay_tree_data_<Key, Mapped, at0t, at1t, Alloc> \ttype;\n    };\n\n  template<typename Key, typename Policy_Tl, typename Alloc>\n    struct container_base_dispatch<Key, null_mapped_type, splay_tree_tag,\n\t\t\t\t   Policy_Tl, Alloc>\n    {\n    private:\n      typedef __gnu_cxx::typelist::at_index<Policy_Tl, 0>\tat0;\n      typedef typename at0::type\t\t\t    \tat0t;\n      typedef __gnu_cxx::typelist::at_index<Policy_Tl, 1> \tat1;\n      typedef typename at1::type\t\t\t    \tat1t;\n\n    public:\n      typedef splay_tree_no_data_<Key, null_mapped_type, at0t, at1t, Alloc> type;\n  };\n\n  template<typename Key, typename Mapped, typename Policy_Tl, typename Alloc>\n    struct container_base_dispatch<Key, Mapped, ov_tree_tag, Policy_Tl, Alloc>\n    {\n    private:\n      typedef __gnu_cxx::typelist::at_index<Policy_Tl, 0>\tat0;\n      typedef typename at0::type\t\t\t    \tat0t;\n      typedef __gnu_cxx::typelist::at_index<Policy_Tl, 1> \tat1;\n      typedef typename at1::type\t\t\t    \tat1t;\n\n    public:\n      typedef ov_tree_data_<Key, Mapped, at0t, at1t, Alloc> \ttype;\n  };\n\n  template<typename Key, typename Policy_Tl, typename Alloc>\n    struct container_base_dispatch<Key, null_mapped_type, ov_tree_tag,\n\t\t\t\t   Policy_Tl, Alloc>\n    {\n    private:\n      typedef __gnu_cxx::typelist::at_index<Policy_Tl, 0>\tat0;\n      typedef typename at0::type\t\t\t    \tat0t;\n      typedef __gnu_cxx::typelist::at_index<Policy_Tl, 1> \tat1;\n      typedef typename at1::type\t\t\t    \tat1t;\n\n    public:\n      typedef ov_tree_no_data_<Key, null_mapped_type, at0t, at1t, Alloc> type;\n  };\n\n  template<typename Key, typename Mapped, typename Policy_Tl, typename Alloc>\n    struct container_base_dispatch<Key, Mapped, cc_hash_tag, Policy_Tl, Alloc>\n    {\n    private:\n      typedef __gnu_cxx::typelist::at_index<Policy_Tl, 0>\tat0;\n      typedef typename at0::type\t\t\t    \tat0t;\n      typedef __gnu_cxx::typelist::at_index<Policy_Tl, 1> \tat1;\n      typedef typename at1::type\t\t\t    \tat1t;\n      typedef __gnu_cxx::typelist::at_index<Policy_Tl, 2>\tat2;\n      typedef typename at2::type\t\t\t    \tat2t;\n      typedef __gnu_cxx::typelist::at_index<Policy_Tl, 3>\tat3;\n      typedef typename at3::type\t\t\t\tat3t;\n      typedef __gnu_cxx::typelist::at_index<Policy_Tl, 4> \tat4;\n      typedef typename at4::type\t\t\t    \tat4t;\n\n    public:\n      typedef cc_ht_map_data_<Key, Mapped, at0t, at1t, Alloc, at3t::value, \n\t\t\t      at4t, at2t> \t\t\ttype;\n  };\n\n  template<typename Key, typename Policy_Tl, typename Alloc>\n    struct container_base_dispatch<Key, null_mapped_type, cc_hash_tag, \n\t\t\t\t   Policy_Tl, Alloc>\n    {\n    private:\n      typedef __gnu_cxx::typelist::at_index<Policy_Tl, 0>\tat0;\n      typedef typename at0::type\t\t\t    \tat0t;\n      typedef __gnu_cxx::typelist::at_index<Policy_Tl, 1> \tat1;\n      typedef typename at1::type\t\t\t    \tat1t;\n      typedef __gnu_cxx::typelist::at_index<Policy_Tl, 2>\tat2;\n      typedef typename at2::type\t\t\t    \tat2t;\n      typedef __gnu_cxx::typelist::at_index<Policy_Tl, 3>\tat3;\n      typedef typename at3::type\t\t\t\tat3t;\n      typedef __gnu_cxx::typelist::at_index<Policy_Tl, 4> \tat4;\n      typedef typename at4::type\t\t\t    \tat4t;\n\n    public:\n      typedef cc_ht_map_no_data_<Key, null_mapped_type, at0t, at1t, Alloc, \n\t\t\t\t at3t::value, at4t, at2t>    \ttype;\n  };\n\n  template<typename Key, typename Mapped, typename Policy_Tl, typename Alloc>\n    struct container_base_dispatch<Key, Mapped, gp_hash_tag, Policy_Tl, Alloc>\n    {\n    private:\n      typedef __gnu_cxx::typelist::at_index<Policy_Tl, 0>\tat0;\n      typedef typename at0::type\t\t\t    \tat0t;\n      typedef __gnu_cxx::typelist::at_index<Policy_Tl, 1> \tat1;\n      typedef typename at1::type\t\t\t    \tat1t;\n      typedef __gnu_cxx::typelist::at_index<Policy_Tl, 2>\tat2;\n      typedef typename at2::type\t\t\t    \tat2t;\n      typedef __gnu_cxx::typelist::at_index<Policy_Tl, 3>\tat3;\n      typedef typename at3::type\t\t\t\tat3t;\n      typedef __gnu_cxx::typelist::at_index<Policy_Tl, 4> \tat4;\n      typedef typename at4::type\t\t\t    \tat4t;\n      typedef __gnu_cxx::typelist::at_index<Policy_Tl, 5> \tat5;\n      typedef typename at5::type\t\t\t    \tat5t;\n\n    public:\n      typedef gp_ht_map_data_<Key, Mapped, at0t, at1t, Alloc, at3t::value, \n\t\t\t      at4t, at5t, at2t> \t\ttype;\n  };\n\n  template<typename Key, typename Policy_Tl, typename Alloc>\n    struct container_base_dispatch<Key, null_mapped_type, gp_hash_tag,\n\t\t\t\t   Policy_Tl, Alloc>\n    {\n    private:\n      typedef __gnu_cxx::typelist::at_index<Policy_Tl, 0>\tat0;\n      typedef typename at0::type\t\t\t    \tat0t;\n      typedef __gnu_cxx::typelist::at_index<Policy_Tl, 1> \tat1;\n      typedef typename at1::type\t\t\t    \tat1t;\n      typedef __gnu_cxx::typelist::at_index<Policy_Tl, 2>\tat2;\n      typedef typename at2::type\t\t\t    \tat2t;\n      typedef __gnu_cxx::typelist::at_index<Policy_Tl, 3>\tat3;\n      typedef typename at3::type\t\t\t\tat3t;\n      typedef __gnu_cxx::typelist::at_index<Policy_Tl, 4> \tat4;\n      typedef typename at4::type\t\t\t    \tat4t;\n      typedef __gnu_cxx::typelist::at_index<Policy_Tl, 5> \tat5;\n      typedef typename at5::type\t\t\t    \tat5t;\n\n    public:\n      typedef gp_ht_map_no_data_<Key, null_mapped_type, at0t, at1t, Alloc,\n\t\t\t\t at3t::value, at4t, at5t, at2t>\ttype;\n  };\n} // namespace detail\n} // namespace pb_ds\n\n#endif \n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/detail/eq_fn/eq_by_less.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file eq_by_less.hpp\n * Contains an equivalence function.\n */\n\n#ifndef PB_DS_EQ_BY_LESS_HPP\n#define PB_DS_EQ_BY_LESS_HPP\n\n#include <utility>\n#include <functional>\n#include <vector>\n#include <assert.h>\n#include <ext/pb_ds/detail/types_traits.hpp>\n\nnamespace pb_ds\n{\n  namespace detail\n  {\n    template<typename Key, class Cmp_Fn>\n    struct eq_by_less : private Cmp_Fn\n    {\n      bool\n      operator()(const Key& r_lhs, const Key& r_rhs) const\n      {\n\tconst bool l = Cmp_Fn::operator()(r_lhs, r_rhs);\n\tconst bool g = Cmp_Fn::operator()(r_rhs, r_lhs);\n\treturn !(l || g);\n      }\n    };\n  } // namespace detail\n} // namespace pb_ds\n\n#endif // #ifndef PB_DS_EQ_BY_LESS_HPP\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/detail/eq_fn/hash_eq_fn.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file hash_eq_fn.hpp\n * Contains 2 eqivalence functions, one employing a hash value,\n *    and one ignoring it.\n */\n\n#ifndef PB_DS_HASH_EQ_FN_HPP\n#define PB_DS_HASH_EQ_FN_HPP\n\n#include <utility>\n#include <debug/debug.h>\n\nnamespace pb_ds\n{\n  namespace detail\n  {\n    template<typename Key, class Eq_Fn, class Allocator, bool Store_Hash>\n    struct hash_eq_fn;\n\n#define PB_DS_CLASS_T_DEC \\\n    template<typename Key, class Eq_Fn, class Allocator>\n\n#define PB_DS_CLASS_C_DEC \\\n    hash_eq_fn<Key, Eq_Fn, Allocator, false>\n\n    /**\n     * Specialization 1- The client requests that hash values not be stored.\n     **/\n    template<typename Key, class Eq_Fn, class Allocator>\n    struct hash_eq_fn<Key, Eq_Fn, Allocator, false> : public Eq_Fn\n    {\n      typedef Eq_Fn eq_fn_base;\n\n      typedef typename Allocator::template rebind<Key>::other key_allocator;\n\n      typedef typename key_allocator::const_reference const_key_reference;\n\n      hash_eq_fn();\n\n      hash_eq_fn(const Eq_Fn& r_eq_fn);\n\n      inline bool\n      operator()(const_key_reference r_lhs_key, const_key_reference r_rhs_key) const;\n\n      inline void\n      swap(const PB_DS_CLASS_C_DEC& other);\n    };\n\n    PB_DS_CLASS_T_DEC\n    PB_DS_CLASS_C_DEC::\n    hash_eq_fn()\n    { }\n\n    PB_DS_CLASS_T_DEC\n    inline void\n    PB_DS_CLASS_C_DEC::\n    swap(const PB_DS_CLASS_C_DEC& other)\n    { std::swap((Eq_Fn& )(*this), (Eq_Fn& )other); }\n\n    PB_DS_CLASS_T_DEC\n    PB_DS_CLASS_C_DEC::\n    hash_eq_fn(const Eq_Fn& r_eq_fn) :\n      Eq_Fn(r_eq_fn)\n    { }\n\n    PB_DS_CLASS_T_DEC\n    inline bool\n    PB_DS_CLASS_C_DEC::\n    operator()(const_key_reference r_lhs_key, const_key_reference r_rhs_key) const\n    { return (eq_fn_base::operator()(r_lhs_key, r_rhs_key)); }\n\n#undef PB_DS_CLASS_T_DEC\n#undef PB_DS_CLASS_C_DEC\n\n#define PB_DS_CLASS_T_DEC \\\n    template<typename Key, class Eq_Fn, class Allocator>\n\n#define PB_DS_CLASS_C_DEC \\\n    hash_eq_fn<Key, Eq_Fn, Allocator, true>\n\n    /**\n     * Specialization 2- The client requests that hash values be stored.\n     **/\n    template<typename Key, class Eq_Fn, class Allocator>\n    struct hash_eq_fn<Key, Eq_Fn, Allocator, true> :\n      public Eq_Fn\n    {\n      typedef typename Allocator::size_type size_type;\n\n      typedef Eq_Fn eq_fn_base;\n\n      typedef typename Allocator::template rebind<Key>::other key_allocator;\n\n      typedef typename key_allocator::const_reference const_key_reference;\n\n      hash_eq_fn();\n\n      hash_eq_fn(const Eq_Fn& r_eq_fn);\n\n      inline bool\n      operator()(const_key_reference r_lhs_key, size_type lhs_hash, \n\t\t const_key_reference r_rhs_key, size_type rhs_hash) const;\n\n      inline void\n      swap(const PB_DS_CLASS_C_DEC& other);\n    };\n\n    PB_DS_CLASS_T_DEC\n    PB_DS_CLASS_C_DEC::\n    hash_eq_fn()\n    { }\n\n    PB_DS_CLASS_T_DEC\n    PB_DS_CLASS_C_DEC::\n    hash_eq_fn(const Eq_Fn& r_eq_fn) :\n      Eq_Fn(r_eq_fn)\n    { }\n\n    PB_DS_CLASS_T_DEC\n    inline bool\n    PB_DS_CLASS_C_DEC::\n    operator()(const_key_reference r_lhs_key, size_type lhs_hash, \n\t       const_key_reference r_rhs_key, size_type rhs_hash) const\n    {\n      _GLIBCXX_DEBUG_ASSERT(!eq_fn_base::operator()(r_lhs_key, r_rhs_key) \n\t\t            || lhs_hash == rhs_hash);\n\n      return (lhs_hash == rhs_hash && \n\t      eq_fn_base::operator()(r_lhs_key, r_rhs_key));\n    }\n\n    PB_DS_CLASS_T_DEC\n    inline void\n    PB_DS_CLASS_C_DEC::\n    swap(const PB_DS_CLASS_C_DEC& other)\n    { std::swap((Eq_Fn& )(*this), (Eq_Fn& )(other)); }\n\n#undef PB_DS_CLASS_T_DEC\n#undef PB_DS_CLASS_C_DEC\n\n  } // namespace detail\n} // namespace pb_ds\n\n#endif \n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/detail/gp_hash_table_map_/constructor_destructor_fn_imps.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file constructor_destructor_fn_imps.hpp\n * Contains implementations of gp_ht_map_'s constructors, destructor,\n *    and related functions.\n */\n\nPB_DS_CLASS_T_DEC\ntypename PB_DS_CLASS_C_DEC::entry_allocator\nPB_DS_CLASS_C_DEC::s_entry_allocator;\n\nPB_DS_CLASS_T_DEC\ntemplate<typename It>\nvoid\nPB_DS_CLASS_C_DEC::\ncopy_from_range(It first_it, It last_it)\n{\n  while (first_it != last_it)\n    insert(*(first_it++));\n}\n\nPB_DS_CLASS_T_DEC\nPB_DS_CLASS_C_DEC::\nPB_DS_CLASS_NAME() \n: ranged_probe_fn_base(resize_base::get_nearest_larger_size(1)),\n  m_num_e(resize_base::get_nearest_larger_size(1)), m_num_used_e(0),\n  m_entries(s_entry_allocator.allocate(m_num_e))\n{\n  initialize();\n  _GLIBCXX_DEBUG_ONLY(PB_DS_CLASS_C_DEC::assert_valid();)\n}\n\nPB_DS_CLASS_T_DEC\nPB_DS_CLASS_C_DEC::\nPB_DS_CLASS_NAME(const Hash_Fn& r_hash_fn)    \n: ranged_probe_fn_base(resize_base::get_nearest_larger_size(1), r_hash_fn),\n  m_num_e(resize_base::get_nearest_larger_size(1)), m_num_used_e(0),\n  m_entries(s_entry_allocator.allocate(m_num_e))\n{\n  initialize();\n  _GLIBCXX_DEBUG_ONLY(PB_DS_CLASS_C_DEC::assert_valid();)\n}\n\nPB_DS_CLASS_T_DEC\nPB_DS_CLASS_C_DEC::\nPB_DS_CLASS_NAME(const Hash_Fn& r_hash_fn, const Eq_Fn& r_eq_fn) \n: hash_eq_fn_base(r_eq_fn),\n  ranged_probe_fn_base(resize_base::get_nearest_larger_size(1), r_hash_fn),\n  m_num_e(resize_base::get_nearest_larger_size(1)), m_num_used_e(0),\n  m_entries(s_entry_allocator.allocate(m_num_e))\n{\n  initialize();\n  _GLIBCXX_DEBUG_ONLY(PB_DS_CLASS_C_DEC::assert_valid();)\n}\n\nPB_DS_CLASS_T_DEC\nPB_DS_CLASS_C_DEC::\nPB_DS_CLASS_NAME(const Hash_Fn& r_hash_fn, const Eq_Fn& r_eq_fn, \n\t\t const Comb_Probe_Fn& r_comb_hash_fn) \n: hash_eq_fn_base(r_eq_fn),\n  ranged_probe_fn_base(resize_base::get_nearest_larger_size(1),\n\t\t       r_hash_fn, r_comb_hash_fn),\n  m_num_e(resize_base::get_nearest_larger_size(1)), m_num_used_e(0),\n  m_entries(s_entry_allocator.allocate(m_num_e))\n{\n  initialize();\n  _GLIBCXX_DEBUG_ONLY(PB_DS_CLASS_C_DEC::assert_valid();)\n}\n\nPB_DS_CLASS_T_DEC\nPB_DS_CLASS_C_DEC::\nPB_DS_CLASS_NAME(const Hash_Fn& r_hash_fn, const Eq_Fn& r_eq_fn, \n\t\t const Comb_Probe_Fn& comb_hash_fn, const Probe_Fn& prober) \n: hash_eq_fn_base(r_eq_fn),\n  ranged_probe_fn_base(resize_base::get_nearest_larger_size(1),\n\t\t       r_hash_fn, comb_hash_fn, prober),\n  m_num_e(resize_base::get_nearest_larger_size(1)), m_num_used_e(0),\n  m_entries(s_entry_allocator.allocate(m_num_e))\n{\n  initialize();\n  _GLIBCXX_DEBUG_ONLY(PB_DS_CLASS_C_DEC::assert_valid();)\n}\n\nPB_DS_CLASS_T_DEC\nPB_DS_CLASS_C_DEC::\nPB_DS_CLASS_NAME(const Hash_Fn& r_hash_fn, const Eq_Fn& r_eq_fn, \n\t\t const Comb_Probe_Fn& comb_hash_fn, const Probe_Fn& prober, \n\t\t const Resize_Policy& r_resize_policy) \n: hash_eq_fn_base(r_eq_fn), resize_base(r_resize_policy),\n  ranged_probe_fn_base(resize_base::get_nearest_larger_size(1),\n\t\t       r_hash_fn, comb_hash_fn, prober),\n  m_num_e(resize_base::get_nearest_larger_size(1)), m_num_used_e(0),\n  m_entries(s_entry_allocator.allocate(m_num_e))\n{\n  initialize();\n  _GLIBCXX_DEBUG_ONLY(PB_DS_CLASS_C_DEC::assert_valid();)\n}\n\nPB_DS_CLASS_T_DEC\nPB_DS_CLASS_C_DEC::\nPB_DS_CLASS_NAME(const PB_DS_CLASS_C_DEC& other) :\n#ifdef _GLIBCXX_DEBUG\n  map_debug_base(other),\n#endif \n  hash_eq_fn_base(other),\n  resize_base(other),\n  ranged_probe_fn_base(other),\n  m_num_e(other.m_num_e),\n  m_num_used_e(other.m_num_used_e),\n  m_entries(s_entry_allocator.allocate(m_num_e))\n{\n  for (size_type i = 0; i < m_num_e; ++i)\n    m_entries[i].m_stat = (entry_status)empty_entry_status;\n\n  try\n    {\n      for (size_type i = 0; i < m_num_e; ++i)\n        {\n\t  m_entries[i].m_stat = other.m_entries[i].m_stat;\n\t  if (m_entries[i].m_stat == valid_entry_status)\n\t    new (m_entries + i) entry(other.m_entries[i]);\n        }\n    }\n  catch(...)\n    {\n      deallocate_all();\n      __throw_exception_again;\n    }\n  _GLIBCXX_DEBUG_ONLY(PB_DS_CLASS_C_DEC::assert_valid();)\n}\n\nPB_DS_CLASS_T_DEC\nPB_DS_CLASS_C_DEC::\n~PB_DS_CLASS_NAME()\n{ deallocate_all(); }\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nswap(PB_DS_CLASS_C_DEC& other)\n{\n  _GLIBCXX_DEBUG_ONLY(assert_valid());\n  _GLIBCXX_DEBUG_ONLY(other.assert_valid());\n  std::swap(m_num_e, other.m_num_e);\n  std::swap(m_num_used_e, other.m_num_used_e);\n  std::swap(m_entries, other.m_entries);\n  ranged_probe_fn_base::swap(other);\n  hash_eq_fn_base::swap(other);\n  resize_base::swap(other);\n  _GLIBCXX_DEBUG_ONLY(map_debug_base::swap(other));\n  _GLIBCXX_DEBUG_ONLY(assert_valid());\n  _GLIBCXX_DEBUG_ONLY(other.assert_valid());\n}\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\ndeallocate_all()\n{\n  clear();\n  erase_all_valid_entries(m_entries, m_num_e);\n  s_entry_allocator.deallocate(m_entries, m_num_e);\n}\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nerase_all_valid_entries(entry_array a_entries_resized, size_type len)\n{\n  for (size_type pos = 0; pos < len; ++pos)\n    {\n      entry_pointer p_e = &a_entries_resized[pos];\n      if (p_e->m_stat == valid_entry_status)\n\tp_e->m_value.~value_type();\n    }\n}\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\ninitialize()\n{\n  Resize_Policy::notify_resized(m_num_e);\n  Resize_Policy::notify_cleared();\n  ranged_probe_fn_base::notify_resized(m_num_e);\n  for (size_type i = 0; i < m_num_e; ++i)\n    m_entries[i].m_stat = empty_entry_status;\n}\n\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/detail/gp_hash_table_map_/constructor_destructor_no_store_hash_fn_imps.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file constructor_destructor_no_store_hash_fn_imps.hpp\n * Contains implementations of gp_ht_map_'s constructors, destructor,\n *    and related functions.\n */\n\nPB_DS_CLASS_T_DEC\ninline void\nPB_DS_CLASS_C_DEC::\nconstructor_insert_new_imp(const_mapped_reference r_val, size_type pos, \n\t\t\t   false_type)\n{\n  _GLIBCXX_DEBUG_ASSERT(m_entries[pos].m_stat != valid_entry_status)k;\n  entry* const p_e = m_entries + pos;\n  new (&p_e->m_value) mapped_value_type(r_val);\n  p_e->m_stat = valid_entry_status;\n  _GLIBCXX_DEBUG_ONLY(map_debug_base::insert_new(p_e->m_value.first);)\n}\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/detail/gp_hash_table_map_/constructor_destructor_store_hash_fn_imps.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file constructor_destructor_store_hash_fn_imps.hpp\n * Contains implementations of gp_ht_map_'s constructors, destructor,\n * and related functions.\n */\n\nPB_DS_CLASS_T_DEC\ninline void\nPB_DS_CLASS_C_DEC::\nconstructor_insert_new_imp(const_mapped_reference r_val, size_type pos, \n\t\t\t   true_type)\n{\n  _GLIBCXX_DEBUG_ASSERT(m_entries[pos].m_stat != valid_entry_status);\n  entry* const p_e = m_entries + pos;\n  new (&p_e->m_value) mapped_value_type(r_val);\n  p_e->m_hash = ranged_probe_fn_base::operator()(PB_DS_V2F(r_val)).second;\n  p_e->m_stat = valid_entry_status;\n  _GLIBCXX_DEBUG_ONLY(map_debug_base::insert_new(p_e->m_value.first);)\n}\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/detail/gp_hash_table_map_/debug_fn_imps.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file debug_fn_imps.hpp\n * Contains implementations of gp_ht_map_'s debug-mode functions.\n */\n\n#ifdef _GLIBCXX_DEBUG\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nassert_valid() const\n{\n  map_debug_base::check_size(m_num_used_e);\n  assert_entry_array_valid(m_entries, traits_base::m_store_extra_indicator);\n}\n\n#include <ext/pb_ds/detail/gp_hash_table_map_/debug_no_store_hash_fn_imps.hpp>\n#include <ext/pb_ds/detail/gp_hash_table_map_/debug_store_hash_fn_imps.hpp>\n\n#endif \n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/detail/gp_hash_table_map_/debug_no_store_hash_fn_imps.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file debug_no_store_hash_fn_imps.hpp\n * Contains implementations of gp_ht_map_'s debug-mode functions.\n */\n\n#ifdef _GLIBCXX_DEBUG\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nassert_entry_array_valid(const entry_array a_entries, false_type) const\n{\n  size_type iterated_num_used_e = 0;\n  for (size_type pos = 0; pos < m_num_e; ++pos)\n    {\n      const_entry_pointer p_e = &a_entries[pos];\n      switch(p_e->m_stat)\n        {\n        case empty_entry_status:\n        case erased_entry_status:\n\t  break;\n        case valid_entry_status:\n\t  {\n\t    const_key_reference r_key = PB_DS_V2F(p_e->m_value);\n\t    map_debug_base::check_key_exists(r_key);\n\t    ++iterated_num_used_e;\n\t    break;\n\t  }\n        default:\n\t  _GLIBCXX_DEBUG_ASSERT(0);\n        };\n    }\n  _GLIBCXX_DEBUG_ASSERT(iterated_num_used_e == m_num_used_e);\n}\n\n#endif \n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/detail/gp_hash_table_map_/debug_store_hash_fn_imps.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file debug_store_hash_fn_imps.hpp\n * Contains implementations of gp_ht_map_'s debug-mode functions.\n */\n\n#ifdef _GLIBCXX_DEBUG\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nassert_entry_array_valid(const entry_array a_entries, true_type) const\n{\n  size_type iterated_num_used_e = 0;\n\n  for (size_type pos = 0; pos < m_num_e; ++pos)\n    {\n      const_entry_pointer p_e =& a_entries[pos];\n      switch(p_e->m_stat)\n        {\n        case empty_entry_status:\n        case erased_entry_status:\n\t  break;\n        case valid_entry_status:\n\t  {\n\t    const_key_reference r_key = PB_DS_V2F(p_e->m_value);\n\t    map_debug_base::check_key_exists(r_key);\n\n\t    const comp_hash pos_hash_pair = ranged_probe_fn_base::operator()(r_key);\n\n\t    _GLIBCXX_DEBUG_ASSERT(p_e->m_hash == pos_hash_pair.second);\n\t    ++iterated_num_used_e;\n\t    break;\n\t  }\n        default:\n\t  _GLIBCXX_DEBUG_ASSERT(0);\n        };\n    }\n\n  _GLIBCXX_DEBUG_ASSERT(iterated_num_used_e == m_num_used_e);\n}\n\n#endif \n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/detail/gp_hash_table_map_/erase_fn_imps.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file erase_fn_imps.hpp\n * Contains implementations of gp_ht_map_'s erase related functions.\n */\n\nPB_DS_CLASS_T_DEC\ninline void\nPB_DS_CLASS_C_DEC::\nerase_entry(entry_pointer p_e)\n{\n  _GLIBCXX_DEBUG_ASSERT(p_e->m_stat = valid_entry_status);\n  _GLIBCXX_DEBUG_ONLY(map_debug_base::erase_existing(PB_DS_V2F(p_e->m_value));)\n  p_e->m_value.~value_type();\n  p_e->m_stat = erased_entry_status;\n  _GLIBCXX_DEBUG_ASSERT(m_num_used_e > 0);\n  resize_base::notify_erased(--m_num_used_e);\n}\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nclear()\n{\n  for (size_type pos = 0; pos < m_num_e; ++pos)\n    {\n      entry_pointer p_e = &m_entries[pos];\n      if (p_e->m_stat == valid_entry_status)\n\terase_entry(p_e);\n    }\n  do_resize_if_needed_no_throw();\n  resize_base::notify_cleared();\n}\n\nPB_DS_CLASS_T_DEC\ntemplate<typename Pred>\ninline typename PB_DS_CLASS_C_DEC::size_type\nPB_DS_CLASS_C_DEC::\nerase_if(Pred pred)\n{\n  _GLIBCXX_DEBUG_ONLY(PB_DS_CLASS_C_DEC::assert_valid();)\n  size_type num_ersd = 0;\n  for (size_type pos = 0; pos < m_num_e; ++pos)\n    {\n      entry_pointer p_e = &m_entries[pos];\n      if (p_e->m_stat == valid_entry_status)\n\tif (pred(p_e->m_value))\n\t  {\n\t    ++num_ersd;\n\t    erase_entry(p_e);\n\t  }\n    }\n\n  do_resize_if_needed_no_throw();\n  _GLIBCXX_DEBUG_ONLY(PB_DS_CLASS_C_DEC::assert_valid();)\n  return num_ersd;\n}\n\nPB_DS_CLASS_T_DEC\ninline bool\nPB_DS_CLASS_C_DEC::\nerase(const_key_reference r_key)\n{ return erase_imp(r_key, traits_base::m_store_extra_indicator); }\n\n#include <ext/pb_ds/detail/gp_hash_table_map_/erase_no_store_hash_fn_imps.hpp>\n#include <ext/pb_ds/detail/gp_hash_table_map_/erase_store_hash_fn_imps.hpp>\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/detail/gp_hash_table_map_/erase_no_store_hash_fn_imps.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file erase_no_store_hash_fn_imps.hpp\n * Contains implementations of gp_ht_map_'s erase related functions,\n * when the hash value is not stored.\n */\n\nPB_DS_CLASS_T_DEC\ninline bool\nPB_DS_CLASS_C_DEC::\nerase_imp(const_key_reference r_key,  false_type)\n{\n  _GLIBCXX_DEBUG_ONLY(PB_DS_CLASS_C_DEC::assert_valid();)\n  size_type hash = ranged_probe_fn_base::operator()(r_key);\n  size_type i;\n  resize_base::notify_erase_search_start();\n\n  for (i = 0; i < m_num_e; ++i)\n    {\n      const size_type pos = ranged_probe_fn_base::operator()(r_key,  hash, i);\n      entry* const p_e = m_entries + pos;\n      switch(p_e->m_stat)\n        {\n        case empty_entry_status:\n\t  {\n\t    resize_base::notify_erase_search_end();\n\t    _GLIBCXX_DEBUG_ONLY(map_debug_base::check_key_does_not_exist(\n\t\t\t\t\t\t\t\t    r_key));\n\t    return false;\n\t  }\n\t  break;\n        case valid_entry_status:\n\t  if (hash_eq_fn_base::operator()(PB_DS_V2F(p_e->m_value), r_key))\n            {\n\t      resize_base::notify_erase_search_end();\n\t      erase_entry(p_e);\n\t      do_resize_if_needed_no_throw();\n\t      return true;\n            }\n\t  break;\n        case erased_entry_status:\n\t  break;\n        default:\n\t  _GLIBCXX_DEBUG_ASSERT(0);\n        };\n      resize_base::notify_erase_search_collision();\n    }\n  resize_base::notify_erase_search_end();\n  return false;\n}\n\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/detail/gp_hash_table_map_/erase_store_hash_fn_imps.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file erase_store_hash_fn_imps.hpp\n * Contains implementations of gp_ht_map_'s erase related functions,\n * when the hash value is stored.\n */\n\nPB_DS_CLASS_T_DEC\ninline bool\nPB_DS_CLASS_C_DEC::\nerase_imp(const_key_reference r_key, true_type)\n{\n  const comp_hash pos_hash_pair = ranged_probe_fn_base::operator()(r_key);\n  size_type i;\n  resize_base::notify_erase_search_start();\n  for (i = 0; i < m_num_e; ++i)\n    {\n      const size_type pos = ranged_probe_fn_base::operator()(r_key, pos_hash_pair.second, i);\n\n      entry* const p_e = m_entries + pos;\n      switch(p_e->m_stat)\n        {\n        case empty_entry_status:\n\t  {\n\t    resize_base::notify_erase_search_end();\n\t    _GLIBCXX_DEBUG_ONLY(map_debug_base::check_key_does_not_exist(\n\t\t\t\t\t\t\t\t    r_key));\n\t    return false;\n\t  }\n\t  break;\n        case valid_entry_status:\n\t  if (hash_eq_fn_base::operator()(PB_DS_V2F(p_e->m_value), p_e->m_hash,\n\t\t\t\t\t  r_key, pos_hash_pair.second))\n            {\n\t      resize_base::notify_erase_search_end();\n\t      erase_entry(p_e);\n\t      do_resize_if_needed_no_throw();\n\t      return true;\n            }\n\t  break;\n        case erased_entry_status:\n\t  break;\n        default:\n\t  _GLIBCXX_DEBUG_ASSERT(0);\n        };\n\n      resize_base::notify_erase_search_collision();\n    }\n  resize_base::notify_erase_search_end();\n  return false;\n}\n\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/detail/gp_hash_table_map_/find_fn_imps.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file find_fn_imps.hpp\n * Contains implementations of gp_ht_map_'s find related functions.\n */\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::point_iterator\nPB_DS_CLASS_C_DEC::\nfind(const_key_reference r_key)\n{\n  _GLIBCXX_DEBUG_ONLY(assert_valid();)\n   return find_key_pointer(r_key, traits_base::m_store_extra_indicator);\n}\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::const_point_iterator\nPB_DS_CLASS_C_DEC::\nfind(const_key_reference r_key) const\n{\n  _GLIBCXX_DEBUG_ONLY(assert_valid();)\n  return const_cast<PB_DS_CLASS_C_DEC&>(*this).find_key_pointer(r_key, traits_base::m_store_extra_indicator);\n}\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::point_iterator\nPB_DS_CLASS_C_DEC::\nfind_end()\n{ return NULL; }\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::const_point_iterator\nPB_DS_CLASS_C_DEC::\nfind_end() const\n{ return NULL; }\n\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/detail/gp_hash_table_map_/find_no_store_hash_fn_imps.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file find_no_store_hash_fn_imps.hpp\n * Contains implementations of gp_ht_map_'s find related functions,\n * when the hash value is not stored.\n */\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::pointer\nPB_DS_CLASS_C_DEC::\nfind_key_pointer(const_key_reference r_key, false_type)\n\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/detail/gp_hash_table_map_/find_store_hash_fn_imps.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file find_store_hash_fn_imps.hpp\n * Contains implementations of gp_ht_map_'s insert related functions,\n * when the hash value is stored.\n */\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/detail/gp_hash_table_map_/gp_ht_map_.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file gp_ht_map_.hpp\n * Contains an implementation class for gp_ht_map_.\n */\n\n#include <ext/pb_ds/tag_and_trait.hpp>\n#include <ext/pb_ds/detail/hash_fn/ranged_probe_fn.hpp>\n#include <ext/pb_ds/detail/types_traits.hpp>\n#include <ext/pb_ds/exception.hpp>\n#include <ext/pb_ds/detail/eq_fn/hash_eq_fn.hpp>\n#include <utility>\n#ifdef PB_DS_HT_MAP_TRACE_\n#include <iostream>\n#endif \n#ifdef _GLIBCXX_DEBUG\n#include <ext/pb_ds/detail/map_debug_base.hpp>\n#endif\n#include <debug/debug.h>\n\nnamespace pb_ds\n{\n  namespace detail\n  {\n#define PB_DS_CLASS_T_DEC \\\n    template<typename Key, typename Mapped, typename Hash_Fn, typename Eq_Fn, \\\n\t     typename Allocator, bool Store_Hash, typename Comb_Probe_Fn, \\\n\t     typename Probe_Fn,\ttypename Resize_Policy>\n\n#ifdef PB_DS_DATA_TRUE_INDICATOR\n#define PB_DS_CLASS_NAME gp_ht_map_data_\n#endif\n\n#ifdef PB_DS_DATA_FALSE_INDICATOR\n#define PB_DS_CLASS_NAME gp_ht_map_no_data_\n#endif \n\n#define PB_DS_CLASS_C_DEC \\\n    PB_DS_CLASS_NAME<Key, Mapped, Hash_Fn, Eq_Fn, Allocator,\t\\\n\t\t     Store_Hash, Comb_Probe_Fn, Probe_Fn, Resize_Policy>\n\n#define PB_DS_HASH_EQ_FN_C_DEC \\\n    hash_eq_fn<Key, Eq_Fn, Allocator, Store_Hash>\n\n#define PB_DS_RANGED_PROBE_FN_C_DEC \\\n    ranged_probe_fn<Key, Hash_Fn, Allocator, Comb_Probe_Fn, Probe_Fn, Store_Hash>\n\n#define PB_DS_TYPES_TRAITS_C_DEC \\\n    types_traits<Key, Mapped, Allocator, Store_Hash>\n\n#ifdef _GLIBCXX_DEBUG\n#define PB_DS_MAP_DEBUG_BASE_C_DEC \\\n    map_debug_base<Key, Eq_Fn, typename Allocator::template rebind<Key>::other::const_reference>\n#endif \n\n#ifdef PB_DS_DATA_TRUE_INDICATOR\n#define PB_DS_V2F(X) (X).first\n#define PB_DS_V2S(X) (X).second\n#endif \n\n#ifdef PB_DS_DATA_FALSE_INDICATOR\n#define PB_DS_V2F(X) (X)\n#define PB_DS_V2S(X) Mapped()\n#endif \n\n#define PB_DS_STATIC_ASSERT(UNIQUE, E) \\\n    typedef static_assert_dumclass<sizeof(static_assert<(bool)(E)>)> \\\n    UNIQUE##static_assert_type\n\n    template<typename Key,\n\t     typename Mapped,\n\t     typename Hash_Fn,\n\t     typename Eq_Fn,\n\t     typename Allocator,\n\t     bool Store_Hash,\n\t     typename Comb_Probe_Fn,\n\t     typename Probe_Fn,\n\t     typename Resize_Policy>\n    class PB_DS_CLASS_NAME :\n#ifdef _GLIBCXX_DEBUG\n      protected PB_DS_MAP_DEBUG_BASE_C_DEC,\n#endif \n      public PB_DS_HASH_EQ_FN_C_DEC,\n      public Resize_Policy,\n      public PB_DS_RANGED_PROBE_FN_C_DEC,\n      public PB_DS_TYPES_TRAITS_C_DEC\n    {\n    private:\n      typedef PB_DS_TYPES_TRAITS_C_DEC traits_base;\n      typedef typename traits_base::value_type value_type_;\n      typedef typename traits_base::pointer pointer_;\n      typedef typename traits_base::const_pointer const_pointer_;\n      typedef typename traits_base::reference reference_;\n      typedef typename traits_base::const_reference const_reference_;\n      typedef typename traits_base::comp_hash comp_hash;\n\n      enum entry_status\n\t{\n\t  empty_entry_status,\n\t  valid_entry_status,\n\t  erased_entry_status\n\t} __attribute__ ((packed));\n\n      struct entry : public traits_base::stored_value_type\n      {\n\tentry_status m_stat;\n      };\n\n      typedef typename Allocator::template rebind<entry>::other entry_allocator;\n      typedef typename entry_allocator::pointer entry_pointer;\n      typedef typename entry_allocator::const_pointer const_entry_pointer;\n      typedef typename entry_allocator::reference entry_reference;\n      typedef typename entry_allocator::const_reference const_entry_reference;\n      typedef typename entry_allocator::pointer entry_array;\n\n      typedef PB_DS_RANGED_PROBE_FN_C_DEC ranged_probe_fn_base;\n\n#ifdef _GLIBCXX_DEBUG\n      typedef PB_DS_MAP_DEBUG_BASE_C_DEC map_debug_base;\n#endif \n\n      typedef PB_DS_HASH_EQ_FN_C_DEC hash_eq_fn_base;\n      typedef Resize_Policy resize_base;\n\n#define PB_DS_GEN_POS typename Allocator::size_type\n\n#include <ext/pb_ds/detail/unordered_iterator/const_point_iterator.hpp>\n#include <ext/pb_ds/detail/unordered_iterator/point_iterator.hpp>\n#include <ext/pb_ds/detail/unordered_iterator/const_iterator.hpp>\n#include <ext/pb_ds/detail/unordered_iterator/iterator.hpp>\n\n#undef PB_DS_GEN_POS\n\n    public:\n      typedef Allocator allocator;\n      typedef typename Allocator::size_type size_type;\n      typedef typename Allocator::difference_type difference_type;\n      typedef Hash_Fn hash_fn;\n      typedef Eq_Fn eq_fn;\n      typedef Probe_Fn probe_fn;\n      typedef Comb_Probe_Fn comb_probe_fn;\n      typedef Resize_Policy resize_policy;\n\n      enum\n\t{\n\t  store_hash = Store_Hash\n\t};\n\n      typedef typename traits_base::key_type key_type;\n      typedef typename traits_base::key_pointer key_pointer;\n      typedef typename traits_base::const_key_pointer const_key_pointer;\n      typedef typename traits_base::key_reference key_reference;\n      typedef typename traits_base::const_key_reference const_key_reference;\n      typedef typename traits_base::mapped_type mapped_type;\n      typedef typename traits_base::mapped_pointer mapped_pointer;\n      typedef typename traits_base::const_mapped_pointer const_mapped_pointer;\n      typedef typename traits_base::mapped_reference mapped_reference;\n      typedef typename traits_base::const_mapped_reference const_mapped_reference;\n      typedef typename traits_base::value_type value_type;\n      typedef typename traits_base::pointer pointer;\n      typedef typename traits_base::const_pointer const_pointer;\n      typedef typename traits_base::reference reference;\n      typedef typename traits_base::const_reference const_reference;\n\n#ifdef PB_DS_DATA_TRUE_INDICATOR\n      typedef point_iterator_ point_iterator;\n#endif \n\n#ifdef PB_DS_DATA_FALSE_INDICATOR\n      typedef const_point_iterator_ point_iterator;\n#endif \n\n      typedef const_point_iterator_ const_point_iterator;\n\n#ifdef PB_DS_DATA_TRUE_INDICATOR\n      typedef iterator_ iterator;\n#endif \n\n#ifdef PB_DS_DATA_FALSE_INDICATOR\n      typedef const_iterator_ iterator;\n#endif \n\n      typedef const_iterator_ const_iterator;\n\n      PB_DS_CLASS_NAME();\n\n      PB_DS_CLASS_NAME(const PB_DS_CLASS_C_DEC&);\n\n      PB_DS_CLASS_NAME(const Hash_Fn&);\n\n      PB_DS_CLASS_NAME(const Hash_Fn&, const Eq_Fn&);\n\n      PB_DS_CLASS_NAME(const Hash_Fn&, const Eq_Fn&, const Comb_Probe_Fn&);\n\n      PB_DS_CLASS_NAME(const Hash_Fn&, const Eq_Fn&, const Comb_Probe_Fn&, \n\t\t       const Probe_Fn&);\n\n      PB_DS_CLASS_NAME(const Hash_Fn&, const Eq_Fn&, const Comb_Probe_Fn&, \n\t\t       const Probe_Fn&, const Resize_Policy&);\n\n      template<typename It>\n      void\n      copy_from_range(It first_it, It last_it);\n\n      virtual\n      ~PB_DS_CLASS_NAME();\n\n      void\n      swap(PB_DS_CLASS_C_DEC& other);\n\n      inline size_type\n      size() const;\n\n      inline size_type\n      max_size() const;\n\n      inline bool\n      empty() const;\n\n      Hash_Fn& \n      get_hash_fn();\n\n      const Hash_Fn& \n      get_hash_fn() const;\n\n      Eq_Fn& \n      get_eq_fn();\n\n      const Eq_Fn& \n      get_eq_fn() const;\n\n      Probe_Fn& \n      get_probe_fn();\n\n      const Probe_Fn& \n      get_probe_fn() const;\n\n      Comb_Probe_Fn& \n      get_comb_probe_fn();\n\n      const Comb_Probe_Fn& \n      get_comb_probe_fn() const;\n\n      Resize_Policy& \n      get_resize_policy();\n\n      const Resize_Policy& \n      get_resize_policy() const;\n\n      inline std::pair<point_iterator, bool>\n      insert(const_reference r_val)\n      {\n\t_GLIBCXX_DEBUG_ONLY(PB_DS_CLASS_C_DEC::assert_valid();)\n        return insert_imp(r_val, traits_base::m_store_extra_indicator);\n      }\n\n      inline mapped_reference\n      operator[](const_key_reference r_key)\n      {\n#ifdef PB_DS_DATA_TRUE_INDICATOR\n\treturn subscript_imp(r_key, traits_base::m_store_extra_indicator);\n#else \n\tinsert(r_key);\n        return traits_base::s_null_mapped;\n#endif\n      }\n\n      inline point_iterator\n      find(const_key_reference r_key);\n\n      inline const_point_iterator\n      find(const_key_reference r_key) const;\n\n      inline point_iterator\n      find_end();\n\n      inline const_point_iterator\n      find_end() const;\n\n      inline bool\n      erase(const_key_reference r_key);\n\n      template<typename Pred>\n      inline size_type\n      erase_if(Pred prd);\n\n      void\n      clear();\n\n      inline iterator\n      begin();\n\n      inline const_iterator\n      begin() const;\n\n      inline iterator\n      end();\n\n      inline const_iterator\n      end() const;\n\n#ifdef _GLIBCXX_DEBUG\n      void\n      assert_valid() const;\n#endif \n\n#ifdef PB_DS_HT_MAP_TRACE_\n      void\n      trace() const;\n#endif \n\n    private:\n#ifdef PB_DS_DATA_TRUE_INDICATOR\n      friend class iterator_;\n#endif \n\n      friend class const_iterator_;\n\n      void\n      deallocate_all();\n\n      void\n      initialize();\n\n      void\n      erase_all_valid_entries(entry_array, size_type);\n\n      inline bool\n      do_resize_if_needed();\n\n      inline void\n      do_resize_if_needed_no_throw();\n\n      void\n      resize_imp(size_type);\n\n      virtual void\n      do_resize(size_type);\n\n      void\n      resize_imp(entry_array, size_type);\n\n      inline void\n      resize_imp_reassign(entry_pointer, entry_array, false_type);\n\n      inline void\n      resize_imp_reassign(entry_pointer, entry_array, true_type);\n\n      inline size_type\n      find_ins_pos(const_key_reference, false_type);\n\n      inline comp_hash\n      find_ins_pos(const_key_reference, true_type);\n\n      inline std::pair<point_iterator, bool>\n      insert_imp(const_reference, false_type);\n\n      inline std::pair<point_iterator, bool>\n      insert_imp(const_reference, true_type);\n\n      inline pointer\n      insert_new_imp(const_reference r_val, size_type pos)\n      {\n\t_GLIBCXX_DEBUG_ASSERT(m_entries[pos].m_stat != valid_entry_status);\n\n\tif (do_resize_if_needed())\n\t  pos = find_ins_pos(PB_DS_V2F(r_val),\n\t\t\t     traits_base::m_store_extra_indicator);\n\n\t_GLIBCXX_DEBUG_ASSERT(m_entries[pos].m_stat != valid_entry_status);\n\n\tentry* const p_e = m_entries + pos;\n\tnew (&p_e->m_value) value_type(r_val);\n\tp_e->m_stat = valid_entry_status;\n\tresize_base::notify_inserted(++m_num_used_e);\n\n\t_GLIBCXX_DEBUG_ONLY(map_debug_base::insert_new(PB_DS_V2F(p_e->m_value));)\n\n\t_GLIBCXX_DEBUG_ONLY(assert_valid();)\n\treturn &p_e->m_value;\n      }\n\n      inline pointer\n      insert_new_imp(const_reference r_val, comp_hash& r_pos_hash_pair)\n      {\n\t_GLIBCXX_DEBUG_ASSERT(m_entries[r_pos_hash_pair.first].m_stat !=\n\t\t\t valid_entry_status);\n\n\tif (do_resize_if_needed())\n\t  r_pos_hash_pair = find_ins_pos(PB_DS_V2F(r_val),\n\t\t\t\t\t traits_base::m_store_extra_indicator);\n\n\t_GLIBCXX_DEBUG_ASSERT(m_entries[r_pos_hash_pair.first].m_stat !=\n\t\t\t      valid_entry_status);\n\n\tentry* const p_e = m_entries + r_pos_hash_pair.first;\n\tnew (&p_e->m_value) value_type(r_val);\n\tp_e->m_hash = r_pos_hash_pair.second;\n\tp_e->m_stat = valid_entry_status;\n\n\tresize_base::notify_inserted(++m_num_used_e);\n\n\t_GLIBCXX_DEBUG_ONLY(map_debug_base::insert_new(PB_DS_V2F(p_e->m_value));)\n\n\t_GLIBCXX_DEBUG_ONLY(assert_valid();)\n\treturn &p_e->m_value;\n      }\n\n#ifdef PB_DS_DATA_TRUE_INDICATOR\n      inline mapped_reference\n      subscript_imp(const_key_reference key, false_type)\n      {\n\t_GLIBCXX_DEBUG_ONLY(assert_valid();)\n\n\tconst size_type pos = find_ins_pos(key, \n\t\t\t\t\t traits_base::m_store_extra_indicator);\n\n\tentry_pointer p_e = &m_entries[pos];\n\tif (p_e->m_stat != valid_entry_status)\n\t  return insert_new_imp(value_type(key, mapped_type()), pos)->second;\n\n\t_GLIBCXX_DEBUG_ONLY(map_debug_base::check_key_exists(key);)\t  \n\treturn p_e->m_value.second;\n      }\n\n      inline mapped_reference\n      subscript_imp(const_key_reference key, true_type)\n      {\n\t_GLIBCXX_DEBUG_ONLY(assert_valid();)\n\n\tcomp_hash pos_hash_pair =\n\t  find_ins_pos(key, traits_base::m_store_extra_indicator);\n\n\tif (m_entries[pos_hash_pair.first].m_stat != valid_entry_status)\n\t  return insert_new_imp(value_type(key, mapped_type()),\n\t\t\t\t pos_hash_pair)->second;\n\n\t_GLIBCXX_DEBUG_ONLY(map_debug_base::check_key_exists(key));\n\treturn (m_entries + pos_hash_pair.first)->m_value.second;\n      }\n#endif\n\n      inline pointer\n      find_key_pointer(const_key_reference key, false_type)\n      {\n\tconst size_type hash = ranged_probe_fn_base::operator()(key);\n\tsize_type i;\n\tresize_base::notify_find_search_start();\n\n\t// Loop until entry is found or until all possible entries accessed.\n\tfor (i = 0; i < m_num_e; ++i)\n\t  {\n\t    const size_type pos = ranged_probe_fn_base::operator()(key, hash, i);\n\n\t    entry* const p_e = m_entries + pos;\n\t    switch (p_e->m_stat)\n\t      {\n\t      case empty_entry_status:\n\t\t{\n\t\t  resize_base::notify_find_search_end();\n\t\t  _GLIBCXX_DEBUG_ONLY(map_debug_base::check_key_does_not_exist(key);)\n\n\t\t    return NULL;\n\t\t}\n\t\tbreak;\n\t      case valid_entry_status:\n\t\tif (hash_eq_fn_base::operator()(PB_DS_V2F(p_e->m_value), key))\n\t\t  {\n\t\t    resize_base::notify_find_search_end();\n\t\t    _GLIBCXX_DEBUG_ONLY(map_debug_base::check_key_exists(key);)\n\n\t\t    return pointer(&p_e->m_value);\n\t\t  }\n\t\tbreak;\n\t      case erased_entry_status:\n\t\tbreak;\n\t      default:\n\t\t_GLIBCXX_DEBUG_ASSERT(0);\n\t      };\n\n\t    resize_base::notify_find_search_collision();\n\t  }\n\n\t_GLIBCXX_DEBUG_ONLY(map_debug_base::check_key_does_not_exist(key);)\n\tresize_base::notify_find_search_end();\n\treturn NULL;\n      }\n\n      inline pointer\n      find_key_pointer(const_key_reference key, true_type)\n      {\n\tcomp_hash pos_hash_pair = ranged_probe_fn_base::operator()(key);\n\tsize_type i;\n\tresize_base::notify_find_search_start();\n\n\t// Loop until entry is found or until all possible entries accessed.\n\tfor (i = 0; i < m_num_e; ++i)\n\t  {\n\t    const size_type pos =\n\t      ranged_probe_fn_base::operator()(key, pos_hash_pair.second, i);\n\n\t    entry* const p_e = m_entries + pos;\n\n\t    switch(p_e->m_stat)\n\t      {\n\t      case empty_entry_status:\n\t\t{\n\t\t  resize_base::notify_find_search_end();\n\t\t  _GLIBCXX_DEBUG_ONLY(map_debug_base::check_key_does_not_exist(key);)\n\n\t\t  return NULL;\n\t\t}\n\t\tbreak;\n\t      case valid_entry_status:\n\t\tif (hash_eq_fn_base::operator()(PB_DS_V2F(p_e->m_value),\n\t\t\t\t\t\tp_e->m_hash,\n\t\t\t\t\t\tkey, pos_hash_pair.second))\n\t\t  {\n\t\t    resize_base::notify_find_search_end();\n\t\t    _GLIBCXX_DEBUG_ONLY(map_debug_base::check_key_exists(key);)\n\t\t    return pointer(&p_e->m_value);\n\t\t  }\n\t\tbreak;\n\t      case erased_entry_status:\n\t\tbreak;\n\t      default:\n\t\t_GLIBCXX_DEBUG_ASSERT(0);\n\t      };\n\n\t    resize_base::notify_find_search_collision();\n\t  }\n\n\t_GLIBCXX_DEBUG_ONLY(map_debug_base::check_key_does_not_exist(key);)\n\tresize_base::notify_find_search_end();\n\treturn NULL;\n      }\n\n      inline bool\n      erase_imp(const_key_reference, true_type);\n\n      inline bool\n      erase_imp(const_key_reference, false_type);\n\n      inline void\n      erase_entry(entry_pointer p_e);\n\n#ifdef PB_DS_DATA_TRUE_INDICATOR\n      void\n      inc_it_state(pointer& r_p_value, size_type& r_pos) const\n      { inc_it_state((const_mapped_pointer& )r_p_value, r_pos); }\n#endif \n\n      void\n      inc_it_state(const_pointer& r_p_value, size_type& r_pos) const\n      {\n\t_GLIBCXX_DEBUG_ASSERT(r_p_value != NULL);\n\tfor (++r_pos; r_pos < m_num_e; ++r_pos)\n\t  {\n\t    const_entry_pointer p_e =& m_entries[r_pos];\n\t    if (p_e->m_stat == valid_entry_status)\n\t      {\n\t\tr_p_value =& p_e->m_value;\n\t\treturn;\n\t      }\n\t  }\n\tr_p_value = NULL;\n      }\n\n      void\n      get_start_it_state(const_pointer& r_p_value, size_type& r_pos) const\n      {\n\tfor (r_pos = 0; r_pos < m_num_e; ++r_pos)\n\t  {\n\t    const_entry_pointer p_e = &m_entries[r_pos];\n\t    if (p_e->m_stat == valid_entry_status)\n\t      {\n\t\tr_p_value = &p_e->m_value;\n\t\treturn;\n\t      }\n\t  }\n\tr_p_value = NULL;\n      }\n\n      void\n      get_start_it_state(pointer& r_p_value, size_type& r_pos)\n      {\n\tfor (r_pos = 0; r_pos < m_num_e; ++r_pos)\n\t  {\n\t    entry_pointer p_e = &m_entries[r_pos];\n\t    if (p_e->m_stat == valid_entry_status)\n\t      {\n\t\tr_p_value = &p_e->m_value;\n\t\treturn;\n\t      }\n\t  }\n\tr_p_value = NULL;\n      }\n\n#ifdef _GLIBCXX_DEBUG\n      void\n      assert_entry_array_valid(const entry_array, false_type) const;\n\n      void\n      assert_entry_array_valid(const entry_array, true_type) const;\n#endif \n\n      static entry_allocator \ts_entry_allocator;\n      static iterator \t\ts_end_it;\n      static const_iterator \ts_const_end_it;\n\n      size_type \t\tm_num_e;\n      size_type \t\tm_num_used_e;\n      entry_pointer \t\tm_entries;\n\n      enum\n\t{\n\t  store_hash_ok = !Store_Hash \n\t                  || !is_same<Hash_Fn, pb_ds::null_hash_fn>::value\n\t};\n\n      PB_DS_STATIC_ASSERT(sth, store_hash_ok);\n    };\n\n#include <ext/pb_ds/detail/gp_hash_table_map_/constructor_destructor_fn_imps.hpp>\n#include <ext/pb_ds/detail/gp_hash_table_map_/find_fn_imps.hpp>\n#include <ext/pb_ds/detail/gp_hash_table_map_/resize_fn_imps.hpp>\n#include <ext/pb_ds/detail/gp_hash_table_map_/debug_fn_imps.hpp>\n#include <ext/pb_ds/detail/gp_hash_table_map_/info_fn_imps.hpp>\n#include <ext/pb_ds/detail/gp_hash_table_map_/policy_access_fn_imps.hpp>\n#include <ext/pb_ds/detail/gp_hash_table_map_/erase_fn_imps.hpp>\n#include <ext/pb_ds/detail/gp_hash_table_map_/iterator_fn_imps.hpp>\n#include <ext/pb_ds/detail/gp_hash_table_map_/insert_fn_imps.hpp>\n#include <ext/pb_ds/detail/gp_hash_table_map_/trace_fn_imps.hpp>\n\n#undef PB_DS_CLASS_T_DEC\n#undef PB_DS_CLASS_C_DEC\n#undef PB_DS_HASH_EQ_FN_C_DEC\n#undef PB_DS_RANGED_PROBE_FN_C_DEC\n#undef PB_DS_TYPES_TRAITS_C_DEC\n#undef PB_DS_MAP_DEBUG_BASE_C_DEC\n#undef PB_DS_CLASS_NAME\n#undef PB_DS_V2F\n#undef PB_DS_V2S\n#undef PB_DS_STATIC_ASSERT\n\n  } // namespace detail\n} // namespace pb_ds\n\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/detail/gp_hash_table_map_/info_fn_imps.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file info_fn_imps.hpp\n * Contains implementations of gp_ht_map_'s entire container info related\n *    functions.\n */\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::size_type\nPB_DS_CLASS_C_DEC::\nsize() const\n{ return m_num_used_e; }\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::size_type\nPB_DS_CLASS_C_DEC::\nmax_size() const\n{ return s_entry_allocator.max_size(); }\n\nPB_DS_CLASS_T_DEC\ninline bool\nPB_DS_CLASS_C_DEC::\nempty() const\n{ return (size() == 0); }\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/detail/gp_hash_table_map_/insert_fn_imps.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file insert_fn_imps.hpp\n * Contains implementations of gp_ht_map_'s insert related functions.\n */\n\n#include <ext/pb_ds/detail/gp_hash_table_map_/insert_no_store_hash_fn_imps.hpp>\n#include <ext/pb_ds/detail/gp_hash_table_map_/insert_store_hash_fn_imps.hpp>\n\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/detail/gp_hash_table_map_/insert_no_store_hash_fn_imps.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file insert_no_store_hash_fn_imps.hpp\n * Contains implementations of gp_ht_map_'s insert related functions,\n * when the hash value is not stored.\n */\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::size_type\nPB_DS_CLASS_C_DEC::\nfind_ins_pos(const_key_reference r_key, false_type)\n{\n  size_type hash = ranged_probe_fn_base::operator()(r_key);\n  size_type i;\n\n  /* The insertion position is initted to a non-legal value to indicate\n   *     that it has not been initted yet.\n   */\n  size_type ins_pos = m_num_e;\n  resize_base::notify_insert_search_start();\n  for (i = 0; i < m_num_e; ++i)\n    {\n      const size_type pos = ranged_probe_fn_base::operator()(r_key, hash, i);\n      _GLIBCXX_DEBUG_ASSERT(pos < m_num_e);\n      entry* const p_e = m_entries + pos;\n      switch(p_e->m_stat)\n        {\n        case empty_entry_status:\n\t  {\n            resize_base::notify_insert_search_end();\n            _GLIBCXX_DEBUG_ONLY(map_debug_base::check_key_does_not_exist(r_key);)\n\t    return (ins_pos == m_num_e) ? pos : ins_pos;\n\t  }\n\t  break;\n        case erased_entry_status:\n\t  if (ins_pos == m_num_e)\n\t    ins_pos = pos;\n\t  break;\n        case valid_entry_status:\n\t  if (hash_eq_fn_base::operator()(PB_DS_V2F(p_e->m_value), r_key))\n            {\n\t      resize_base::notify_insert_search_end();\n\t      _GLIBCXX_DEBUG_ONLY(map_debug_base::check_key_exists(r_key);)\n                return pos;\n            }\n\t  break;\n        default:\n\t  _GLIBCXX_DEBUG_ASSERT(0);\n        };\n\n      resize_base::notify_insert_search_collision();\n    }\n  resize_base::notify_insert_search_end();\n  if (ins_pos == m_num_e)\n    __throw_insert_error();\n  return ins_pos;\n}\n\nPB_DS_CLASS_T_DEC\ninline std::pair<typename PB_DS_CLASS_C_DEC::point_iterator, bool>\nPB_DS_CLASS_C_DEC::\ninsert_imp(const_reference r_val, false_type)\n{\n  const_key_reference r_key = PB_DS_V2F(r_val);\n  const size_type pos = find_ins_pos(r_key, \n\t\t\t\t     traits_base::m_store_extra_indicator);\n\n  if (m_entries[pos].m_stat == valid_entry_status)\n    {\n      _GLIBCXX_DEBUG_ONLY(map_debug_base::check_key_exists(r_key);)\n      return std::make_pair(&(m_entries + pos)->m_value, false);\n    }\n\n  _GLIBCXX_DEBUG_ONLY(map_debug_base::check_key_does_not_exist(r_key));\n  return std::make_pair(insert_new_imp(r_val, pos), true);\n}\n\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/detail/gp_hash_table_map_/insert_store_hash_fn_imps.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file insert_store_hash_fn_imps.hpp\n * Contains implementations of gp_ht_map_'s find related functions,\n * when the hash value is stored.\n */\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::comp_hash\nPB_DS_CLASS_C_DEC::\nfind_ins_pos(const_key_reference r_key, true_type)\n{\n  _GLIBCXX_DEBUG_ONLY(PB_DS_CLASS_C_DEC::assert_valid();)\n  comp_hash pos_hash_pair = ranged_probe_fn_base::operator()(r_key);\n\n  size_type i;\n\n  /* The insertion position is initted to a non-legal value to indicate\n   *     that it has not been initted yet.\n   */\n  size_type ins_pos = m_num_e;\n  resize_base::notify_insert_search_start();\n  for (i = 0; i < m_num_e; ++i)\n    {\n      const size_type pos = ranged_probe_fn_base::operator()(r_key, pos_hash_pair.second, i);\n\n      entry* const p_e = m_entries + pos;\n      switch(p_e->m_stat)\n        {\n        case empty_entry_status:\n\t  {\n            resize_base::notify_insert_search_end();\n            _GLIBCXX_DEBUG_ONLY(map_debug_base::check_key_does_not_exist(r_key);)\n\n\t    return ((ins_pos == m_num_e) ?\n\t\t     std::make_pair(pos, pos_hash_pair.second) :\n\t\t     std::make_pair(ins_pos, pos_hash_pair.second));\n\t  }\n\t  break;\n        case erased_entry_status:\n\t  if (ins_pos == m_num_e)\n\t    ins_pos = pos;\n\t  break;\n        case valid_entry_status:\n\t  if (hash_eq_fn_base::operator()(PB_DS_V2F(p_e->m_value), p_e->m_hash,\n\t\t\t\t\t  r_key, pos_hash_pair.second))\n            {\n\t      resize_base::notify_insert_search_end();\n\t      _GLIBCXX_DEBUG_ONLY(map_debug_base::check_key_exists(r_key);)\n              return std::make_pair(pos, pos_hash_pair.second);\n            }\n\t  break;\n        default:\n\t  _GLIBCXX_DEBUG_ASSERT(0);\n        };\n      resize_base::notify_insert_search_collision();\n    }\n  resize_base::notify_insert_search_end();\n  if (ins_pos == m_num_e)\n    __throw_insert_error();\n  return std::make_pair(ins_pos, pos_hash_pair.second);\n}\n\nPB_DS_CLASS_T_DEC\ninline std::pair<typename PB_DS_CLASS_C_DEC::point_iterator, bool>\nPB_DS_CLASS_C_DEC::\ninsert_imp(const_reference r_val, true_type)\n{\n  const_key_reference r_key = PB_DS_V2F(r_val);\n  comp_hash pos_hash_pair = find_ins_pos(r_key, \n\t\t\t\t\t traits_base::m_store_extra_indicator);\n\n  _GLIBCXX_DEBUG_ASSERT(pos_hash_pair.first < m_num_e);\n  entry_pointer p_e =& m_entries[pos_hash_pair.first];\n  if (p_e->m_stat == valid_entry_status)\n    {\n      _GLIBCXX_DEBUG_ONLY(map_debug_base::check_key_exists(r_key));\n      return std::make_pair(&p_e->m_value, false);\n    }\n\n  _GLIBCXX_DEBUG_ONLY(map_debug_base::check_key_does_not_exist(r_key));\n  return std::make_pair(insert_new_imp(r_val, pos_hash_pair), true);\n}\n\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/detail/gp_hash_table_map_/iterator_fn_imps.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file iterator_fn_imps.hpp\n * Contains implementations of gp_ht_map_'s iterators related functions, e.g.,\n *    begin().\n */\n\nPB_DS_CLASS_T_DEC\ntypename PB_DS_CLASS_C_DEC::iterator\nPB_DS_CLASS_C_DEC::s_end_it;\n\nPB_DS_CLASS_T_DEC\ntypename PB_DS_CLASS_C_DEC::const_iterator\nPB_DS_CLASS_C_DEC::s_const_end_it;\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::iterator\nPB_DS_CLASS_C_DEC::\nbegin()\n{\n  pointer_ p_value;\n  size_type pos;\n  get_start_it_state(p_value, pos);\n  return iterator(p_value, pos, this);\n}\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::iterator\nPB_DS_CLASS_C_DEC::\nend()\n{ return s_end_it; }\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::const_iterator\nPB_DS_CLASS_C_DEC::\nbegin() const\n{\n  const_pointer_ p_value;\n  size_type pos;\n  get_start_it_state(p_value, pos);\n  return const_iterator(p_value, pos, this);\n}\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::const_iterator\nPB_DS_CLASS_C_DEC::\nend() const\n{ return s_const_end_it; }\n\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/detail/gp_hash_table_map_/policy_access_fn_imps.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file policy_access_fn_imps.hpp\n * Contains implementations of gp_ht_map_'s policy agpess\n *    functions.\n */\n\nPB_DS_CLASS_T_DEC\nHash_Fn& \nPB_DS_CLASS_C_DEC::\nget_hash_fn()\n{ return *this; }\n\nPB_DS_CLASS_T_DEC\nconst Hash_Fn& \nPB_DS_CLASS_C_DEC::\nget_hash_fn() const\n{ return *this; }\n\nPB_DS_CLASS_T_DEC\nEq_Fn& \nPB_DS_CLASS_C_DEC::\nget_eq_fn()\n{ return *this; }\n\nPB_DS_CLASS_T_DEC\nconst Eq_Fn& \nPB_DS_CLASS_C_DEC::\nget_eq_fn() const\n{ return *this; }\n\nPB_DS_CLASS_T_DEC\nProbe_Fn& \nPB_DS_CLASS_C_DEC::\nget_probe_fn()\n{ return *this; }\n\nPB_DS_CLASS_T_DEC\nconst Probe_Fn& \nPB_DS_CLASS_C_DEC::\nget_probe_fn() const\n{ return *this; }\n\nPB_DS_CLASS_T_DEC\nComb_Probe_Fn& \nPB_DS_CLASS_C_DEC::\nget_comb_probe_fn()\n{ return *this; }\n\nPB_DS_CLASS_T_DEC\nconst Comb_Probe_Fn& \nPB_DS_CLASS_C_DEC::\nget_comb_probe_fn() const\n{ return *this; }\n\nPB_DS_CLASS_T_DEC\nResize_Policy& \nPB_DS_CLASS_C_DEC::\nget_resize_policy()\n{ return *this; }\n\nPB_DS_CLASS_T_DEC\nconst Resize_Policy& \nPB_DS_CLASS_C_DEC::\nget_resize_policy() const\n{ return *this; }\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/detail/gp_hash_table_map_/resize_fn_imps.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file resize_fn_imps.hpp\n * Contains implementations of gp_ht_map_'s resize related functions.\n */\n\nPB_DS_CLASS_T_DEC\ninline bool\nPB_DS_CLASS_C_DEC::\ndo_resize_if_needed()\n{\n  if (!resize_base::is_resize_needed())\n    return false;\n  resize_imp(resize_base::get_new_size(m_num_e, m_num_used_e));\n  return true;\n}\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\ndo_resize(size_type n)\n{ resize_imp(resize_base::get_nearest_larger_size(n)); }\n\nPB_DS_CLASS_T_DEC\ninline void\nPB_DS_CLASS_C_DEC::\ndo_resize_if_needed_no_throw()\n{\n  if (!resize_base::is_resize_needed())\n    return;\n\n  try\n    {\n      resize_imp(resize_base::get_new_size(m_num_e, m_num_used_e));\n    }\n  catch(...)\n    { }\n\n  _GLIBCXX_DEBUG_ONLY(assert_valid();)\n}\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nresize_imp(size_type new_size)\n{\n#ifdef PB_DS_REGRESSION\n  typename Allocator::group_throw_prob_adjustor adjust(m_num_e);\n#endif \n\n  if (new_size == m_num_e)\n    return;\n\n  _GLIBCXX_DEBUG_ONLY(assert_valid();)\n  const size_type old_size = m_num_e;\n  entry_array a_entries_resized = NULL;\n\n  // Following line might throw an exception.\n  a_entries_resized = s_entry_allocator.allocate(new_size);\n\n  ranged_probe_fn_base::notify_resized(new_size);\n  m_num_e = new_size;\n\n  for (size_type i = 0; i < m_num_e; ++i)\n    a_entries_resized[i].m_stat = empty_entry_status;\n\n  try\n    {\n      resize_imp(a_entries_resized, old_size);\n    }\n  catch(...)\n    {\n      erase_all_valid_entries(a_entries_resized, new_size);\n      m_num_e = old_size;\n      s_entry_allocator.deallocate(a_entries_resized, new_size);\n      ranged_probe_fn_base::notify_resized(old_size);\n      __throw_exception_again;\n    }\n\n  // At this point no exceptions can be thrown.\n  _GLIBCXX_DEBUG_ONLY(assert_entry_array_valid(a_entries_resized, traits_base::m_store_extra_indicator);)\n\n  Resize_Policy::notify_resized(new_size);\n  erase_all_valid_entries(m_entries, old_size);\n  s_entry_allocator.deallocate(m_entries, old_size);\n  m_entries = a_entries_resized;\n  _GLIBCXX_DEBUG_ONLY(assert_valid();)\n}\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nresize_imp(entry_array a_entries_resized, size_type old_size)\n{\n  for (size_type pos = 0; pos < old_size; ++pos)\n    if (m_entries[pos].m_stat == valid_entry_status)\n      resize_imp_reassign(m_entries + pos, a_entries_resized, \n\t\t\t  traits_base::m_store_extra_indicator);\n}\n\n#include <ext/pb_ds/detail/gp_hash_table_map_/resize_no_store_hash_fn_imps.hpp>\n#include <ext/pb_ds/detail/gp_hash_table_map_/resize_store_hash_fn_imps.hpp>\n\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/detail/gp_hash_table_map_/resize_no_store_hash_fn_imps.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file resize_no_store_hash_fn_imps.hpp\n * Contains implementations of gp_ht_map_'s resize related functions, when the\n *    hash value is not stored.\n */\n\nPB_DS_CLASS_T_DEC\ninline void\nPB_DS_CLASS_C_DEC::\nresize_imp_reassign(entry_pointer p_e, entry_array a_entries_resized, \n\t\t    false_type)\n{\n  const_key_reference r_key = PB_DS_V2F(p_e->m_value);\n  size_type hash = ranged_probe_fn_base::operator()(r_key);\n  size_type i;\n  for (i = 0; i < m_num_e; ++i)\n    {\n      const size_type pos = ranged_probe_fn_base::operator()(r_key, hash, i);\n      entry_pointer p_new_e = a_entries_resized + pos;\n      switch(p_new_e->m_stat)\n        {\n        case empty_entry_status:\n\t  new (&p_new_e->m_value) value_type(p_e->m_value);\n\t  p_new_e->m_stat = valid_entry_status;\n\t  return;\n        case erased_entry_status:\n\t  _GLIBCXX_DEBUG_ASSERT(0);\n\t  break;\n        case valid_entry_status:\n\t  break;\n        default:\n\t  _GLIBCXX_DEBUG_ASSERT(0);\n        };\n    }\n  __throw_insert_error();\n}\n\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/detail/gp_hash_table_map_/resize_store_hash_fn_imps.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file resize_store_hash_fn_imps.hpp\n * Contains implementations of gp_ht_map_'s resize related functions, when the\n *    hash value is stored.\n */\n\nPB_DS_CLASS_T_DEC\ninline void\nPB_DS_CLASS_C_DEC::\nresize_imp_reassign(entry_pointer p_e, entry_array a_entries_resized, \n\t\t    true_type)\n{\n  const_key_reference r_key = PB_DS_V2F(p_e->m_value);\n  size_type hash = ranged_probe_fn_base::operator()(r_key, p_e->m_hash);\n\n  size_type i;\n  for (i = 0; i < m_num_e; ++i)\n    {\n      const size_type pos = ranged_probe_fn_base::operator()(r_key, hash, i);\n      entry_pointer p_new_e = a_entries_resized + pos;\n      switch(p_new_e->m_stat)\n        {\n        case empty_entry_status:\n\t  new (&p_new_e->m_value) value_type(p_e->m_value);\n\t  p_new_e->m_hash = hash;\n\t  p_new_e->m_stat = valid_entry_status;\n\t  return;\n        case erased_entry_status:\n\t  _GLIBCXX_DEBUG_ASSERT(0);\n\t  break;\n        case valid_entry_status:\n\t  break;\n        default:\n\t  _GLIBCXX_DEBUG_ASSERT(0);\n        };\n    }\n  __throw_insert_error();\n}\n\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/detail/gp_hash_table_map_/standard_policies.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file standard_policies.hpp\n * Contains standard policies for gp_ht_map types.\n */\n\n#ifndef PB_DS_GP_HT_MAP_STANDARD_POLICIES_HPP\n#define PB_DS_GP_HT_MAP_STANDARD_POLICIES_HPP\n\n#include <ext/pb_ds/detail/standard_policies.hpp>\n#include <ext/pb_ds/ht_load_check_resize_trigger.hpp>\n#include <ext/pb_ds/linear_probe_fn.hpp>\n#include <ext/pb_ds/quadratic_probe_fn.hpp>\n\nnamespace pb_ds\n{\n  namespace detail\n  {\n    template<typename Comb_Probe_Fn>\n    struct default_probe_fn\n    {\n    private:\n      typedef typename Comb_Probe_Fn::size_type size_type;\n\n    public:\n      typedef\n      typename __conditional_type<\n      is_same<\n      pb_ds::direct_mask_range_hashing<size_t>,\n      Comb_Probe_Fn>::value,\n      pb_ds::linear_probe_fn<size_type>,\n      pb_ds::quadratic_probe_fn<size_type> >::__type\n      type;\n    };\n\n  } // namespace detail\n} // namespace pb_ds\n\n#endif \n\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/detail/gp_hash_table_map_/trace_fn_imps.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file trace_fn_imps.hpp\n * Contains implementations of gp_ht_map_'s trace-mode functions.\n */\n\n#ifdef PB_DS_HT_MAP_TRACE_\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\ntrace() const\n{\n  std::cerr << static_cast<unsigned long>(m_num_e) << \" \" <<\n    static_cast<unsigned long>(m_num_used_e) << std::endl;\n\n  for (size_type i = 0; i < m_num_e; ++i)\n    {\n      std::cerr << static_cast<unsigned long>(i) << \" \";\n\n      switch(m_entries[i].m_stat)\n        {\n\tcase empty_entry_status:\n\t  std::cerr << \"<empty>\";\n\t  break;\n\tcase erased_entry_status:\n\t  std::cerr << \"<erased>\";\n\t  break;\n\tcase valid_entry_status:\n\t  std::cerr << PB_DS_V2F(m_entries[i].m_value);\n\t  break;\n\tdefault:\n\t  _GLIBCXX_DEBUG_ASSERT(0);\n\t};\n\n      std::cerr << std::endl;\n    }\n}\n\n#endif // #ifdef PB_DS_HT_MAP_TRACE_\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/detail/hash_fn/direct_mask_range_hashing_imp.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file direct_mask_range_hashing_imp.hpp\n * Contains a range-hashing policy implementation\n */\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nswap(PB_DS_CLASS_C_DEC& other)\n{ mask_based_base::swap(other); }\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nnotify_resized(size_type size)\n{ mask_based_base::notify_resized(size); }\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::size_type\nPB_DS_CLASS_C_DEC::\noperator()(size_type hash) const\n{ return mask_based_base::range_hash(hash); }\n\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/detail/hash_fn/direct_mod_range_hashing_imp.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file direct_mod_range_hashing_imp.hpp\n * Contains a range-hashing policy implementation\n */\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nswap(PB_DS_CLASS_C_DEC& other)\n{ mod_based_base::swap(other); }\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nnotify_resized(size_type n)\n{ mod_based_base::notify_resized(n); }\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::size_type\nPB_DS_CLASS_C_DEC::\noperator()(size_type hash) const\n{ return mod_based_base::range_hash(hash); }\n\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/detail/hash_fn/linear_probe_fn_imp.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file linear_probe_fn_imp.hpp\n * Contains a probe policy implementation\n */\n\nPB_DS_CLASS_T_DEC\ninline void\nPB_DS_CLASS_C_DEC::\nswap(PB_DS_CLASS_C_DEC& other)\n{ }\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::size_type\nPB_DS_CLASS_C_DEC::\noperator()(size_type i) const\n{\n  return (i);\n}\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/detail/hash_fn/mask_based_range_hashing.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file mask_based_range_hashing.hpp\n * Contains a range hashing policy base.\n */\n\n#ifndef PB_DS_MASK_BASED_RANGE_HASHING_HPP\n#define PB_DS_MASK_BASED_RANGE_HASHING_HPP\n\nnamespace pb_ds\n{\n  namespace detail\n  {\n#define PB_DS_CLASS_T_DEC template<typename Size_Type>\n#define PB_DS_CLASS_C_DEC mask_based_range_hashing<Size_Type>\n\n    template<typename Size_Type>\n    class mask_based_range_hashing\n    {\n    protected:\n      typedef Size_Type size_type;\n\n      void\n      swap(mask_based_range_hashing& other)\n      { std::swap(m_mask, other.m_mask); }\n\n      void\n      notify_resized(size_type size);\n\n      inline size_type\n      range_hash(size_type hash) const\n      { return size_type(hash & m_mask); }\n\n    private:\n      size_type \t\tm_mask;\n      const static size_type \ts_num_bits_in_size_type;\n      const static size_type \ts_highest_bit_1;\n    };\n\n    PB_DS_CLASS_T_DEC\n    const typename PB_DS_CLASS_C_DEC::size_type\n    PB_DS_CLASS_C_DEC::s_num_bits_in_size_type =\n      sizeof(typename PB_DS_CLASS_C_DEC::size_type) << 3;\n\n    PB_DS_CLASS_T_DEC\n    const typename PB_DS_CLASS_C_DEC::size_type PB_DS_CLASS_C_DEC::s_highest_bit_1 = static_cast<typename PB_DS_CLASS_C_DEC::size_type>(1) << (s_num_bits_in_size_type - 1);\n\n \n    PB_DS_CLASS_T_DEC\n    void\n    PB_DS_CLASS_C_DEC::\n    notify_resized(size_type size)\n    {\n      size_type i = 0;\n      while (size ^ s_highest_bit_1)\n\t{\n\t  size <<= 1;\n\t  ++i;\n\t}\n\n      m_mask = 1;\n      i += 2;\n      while (i++ < s_num_bits_in_size_type)\n        m_mask = (m_mask << 1) ^ 1;\n    }\n\n#undef PB_DS_CLASS_T_DEC\n#undef PB_DS_CLASS_C_DEC\n\n  } // namespace detail\n} // namespace pb_ds\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/detail/hash_fn/mod_based_range_hashing.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file mod_based_range_hashing.hpp\n * Contains a range hashing policy base.\n */\n\n#ifndef PB_DS_MOD_BASED_RANGE_HASHING_HPP\n#define PB_DS_MOD_BASED_RANGE_HASHING_HPP\n\nnamespace pb_ds\n{\n\n  namespace detail\n  {\n\n#define PB_DS_CLASS_T_DEC\t\t\t\\\n    template<typename Size_Type>\n\n#define PB_DS_CLASS_C_DEC\t\t\t\t\t\\\n    mod_based_range_hashing<\t\t\t\t\t\\\n\t\t\t\t\t\tSize_Type>\n\n    template<typename Size_Type>\n    class mod_based_range_hashing\n    {\n    protected:\n      typedef Size_Type size_type;\n\n    protected:\n      void\n      swap(PB_DS_CLASS_C_DEC& other);\n\n      void\n      notify_resized(size_type size);\n\n      inline size_type\n      range_hash(size_type hash) const;\n\n    private:\n      size_type m_size;\n    };\n\n    PB_DS_CLASS_T_DEC\n    void\n    PB_DS_CLASS_C_DEC::\n    swap(PB_DS_CLASS_C_DEC& other)\n    {\n      std::swap(m_size, other.m_size);\n    }\n\n    PB_DS_CLASS_T_DEC\n    void\n    PB_DS_CLASS_C_DEC::\n    notify_resized(size_type size)\n    {\n      m_size = size;\n    }\n\n    PB_DS_CLASS_T_DEC\n    inline typename PB_DS_CLASS_C_DEC::size_type\n    PB_DS_CLASS_C_DEC::\n    range_hash(size_type hash) const\n    {\n      return (hash % m_size);\n    }\n\n#undef PB_DS_CLASS_T_DEC\n#undef PB_DS_CLASS_C_DEC\n\n  } // namespace detail\n\n} // namespace pb_ds\n\n#endif // #ifndef PB_DS_MOD_BASED_RANGE_HASHING_HPP\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/detail/hash_fn/probe_fn_base.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file probe_fn_base.hpp\n * Contains a probe policy base.\n */\n\n#ifndef PB_DS_PROBE_FN_BASE_HPP\n#define PB_DS_PROBE_FN_BASE_HPP\n\n#include <functional>\n\nnamespace pb_ds\n{\n  namespace detail\n  {\n    template<typename Allocator>\n    class probe_fn_base\n    {\n    protected:\n      ~probe_fn_base() { }\n    };\n} // namespace detail\n} // namespace pb_ds\n\n#endif \n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/detail/hash_fn/quadratic_probe_fn_imp.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file quadratic_probe_fn_imp.hpp\n * Contains a probe policy implementation\n */\n\nPB_DS_CLASS_T_DEC\ninline void\nPB_DS_CLASS_C_DEC::\nswap(PB_DS_CLASS_C_DEC& other)\n{ }\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::size_type\nPB_DS_CLASS_C_DEC::\noperator()(size_type i) const\n{\n  return (i*  i);\n}\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/detail/hash_fn/ranged_hash_fn.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file ranged_hash_fn.hpp\n * Contains a unified ranged hash functor, allowing the hash tables\n * to deal with a single class for ranged hashing.\n */\n\n#ifndef PB_DS_RANGED_HASH_FN_HPP\n#define PB_DS_RANGED_HASH_FN_HPP\n\n#include <ext/pb_ds/detail/basic_types.hpp>\n#include <utility>\n#include <debug/debug.h>\n\nnamespace pb_ds\n{\n  namespace detail\n  {\n    template<typename Key, typename Hash_Fn, typename Allocator, \n\t     typename Comb_Hash_Fn, bool Store_Hash>\n    class ranged_hash_fn;\n\n#define PB_DS_CLASS_T_DEC \\\n    template<typename Key, typename Hash_Fn, typename Allocator, \\\n\t     typename Comb_Hash_Fn>\n\n#define PB_DS_CLASS_C_DEC \\\n    ranged_hash_fn<Key,\tHash_Fn, Allocator, Comb_Hash_Fn, false>\n\n    /**\n     * Specialization 1\n     * The client supplies a hash function and a ranged hash function,\n     * and requests that hash values not be stored.\n     **/\n    template<typename Key, typename Hash_Fn, typename Allocator, \n\t     typename Comb_Hash_Fn>\n    class ranged_hash_fn< Key, Hash_Fn, Allocator, Comb_Hash_Fn, false> \n    : public Hash_Fn, public Comb_Hash_Fn\n    {\n    protected:\n      typedef typename Allocator::size_type size_type;\n      typedef Hash_Fn hash_fn_base;\n      typedef Comb_Hash_Fn comb_hash_fn_base;\n      typedef typename Allocator::template rebind< Key>::other key_allocator;\n      typedef typename key_allocator::const_reference const_key_reference;\n\n      ranged_hash_fn(size_type);\n\n      ranged_hash_fn(size_type, const Hash_Fn&);\n\n      ranged_hash_fn(size_type, const Hash_Fn&, const Comb_Hash_Fn&);\n\n      void\n      swap(PB_DS_CLASS_C_DEC&);\n\n      void\n      notify_resized(size_type);\n\n      inline size_type\n      operator()(const_key_reference) const;\n    };\n\n    PB_DS_CLASS_T_DEC\n    PB_DS_CLASS_C_DEC::\n    ranged_hash_fn(size_type size)\n    { Comb_Hash_Fn::notify_resized(size); }\n\n    PB_DS_CLASS_T_DEC\n    PB_DS_CLASS_C_DEC::\n    ranged_hash_fn(size_type size, const Hash_Fn& r_hash_fn) \n    : Hash_Fn(r_hash_fn)\n    { Comb_Hash_Fn::notify_resized(size); }\n\n    PB_DS_CLASS_T_DEC\n    PB_DS_CLASS_C_DEC::\n    ranged_hash_fn(size_type size, const Hash_Fn& r_hash_fn, \n\t\t   const Comb_Hash_Fn& r_comb_hash_fn) \n    : Hash_Fn(r_hash_fn), Comb_Hash_Fn(r_comb_hash_fn)\n    { comb_hash_fn_base::notify_resized(size); }\n\n    PB_DS_CLASS_T_DEC\n    void\n    PB_DS_CLASS_C_DEC::\n    swap(PB_DS_CLASS_C_DEC& other)\n    {\n      comb_hash_fn_base::swap(other);\n      std::swap((Hash_Fn& )(*this), (Hash_Fn& )other);\n    }\n\n    PB_DS_CLASS_T_DEC\n    void\n    PB_DS_CLASS_C_DEC::\n    notify_resized(size_type size)\n    { comb_hash_fn_base::notify_resized(size); }\n\n    PB_DS_CLASS_T_DEC\n    inline typename PB_DS_CLASS_C_DEC::size_type\n    PB_DS_CLASS_C_DEC::\n    operator()(const_key_reference r_key) const\n    { return (comb_hash_fn_base::operator()(hash_fn_base::operator()(r_key)));}\n\n#undef PB_DS_CLASS_T_DEC\n#undef PB_DS_CLASS_C_DEC\n\n#define PB_DS_CLASS_T_DEC \\\n    template<typename Key, typename Hash_Fn, typename Allocator, \\\n\t     typename Comb_Hash_Fn>\n\n#define PB_DS_CLASS_C_DEC \\\n    ranged_hash_fn<Key,Hash_Fn,\tAllocator, Comb_Hash_Fn, true>\n\n    /**\n     * Specialization 2\n     * The client supplies a hash function and a ranged hash function,\n     * and requests that hash values be stored.\n     **/\n    template<typename Key, typename Hash_Fn, typename Allocator,\n\t     typename Comb_Hash_Fn>\n    class ranged_hash_fn<Key, Hash_Fn, Allocator, Comb_Hash_Fn, true> \n    : public Hash_Fn, public Comb_Hash_Fn\n    {\n    protected:\n      typedef typename Allocator::size_type size_type;\n      typedef std::pair<size_type, size_type> comp_hash;\n      typedef Hash_Fn hash_fn_base;\n      typedef Comb_Hash_Fn comb_hash_fn_base;\n      typedef typename Allocator::template rebind<Key>::other key_allocator;\n      typedef typename key_allocator::const_reference const_key_reference;\n\n      ranged_hash_fn(size_type);\n\n      ranged_hash_fn(size_type, const Hash_Fn&);\n\n      ranged_hash_fn(size_type, const Hash_Fn&, const Comb_Hash_Fn&);\n\n      void\n      swap(PB_DS_CLASS_C_DEC&);\n\n      void\n      notify_resized(size_type);\n\n      inline comp_hash\n      operator()(const_key_reference) const;\n\n      inline comp_hash\n      operator()(const_key_reference, size_type) const;\n    };\n\n    PB_DS_CLASS_T_DEC\n    PB_DS_CLASS_C_DEC::\n    ranged_hash_fn(size_type size)\n    { Comb_Hash_Fn::notify_resized(size); }\n\n    PB_DS_CLASS_T_DEC\n    PB_DS_CLASS_C_DEC::\n    ranged_hash_fn(size_type size, const Hash_Fn& r_hash_fn) :\n      Hash_Fn(r_hash_fn)\n    { Comb_Hash_Fn::notify_resized(size); }\n\n    PB_DS_CLASS_T_DEC\n    PB_DS_CLASS_C_DEC::\n    ranged_hash_fn(size_type size, const Hash_Fn& r_hash_fn, \n\t\t   const Comb_Hash_Fn& r_comb_hash_fn) \n    : Hash_Fn(r_hash_fn), Comb_Hash_Fn(r_comb_hash_fn)\n    { comb_hash_fn_base::notify_resized(size); }\n\n    PB_DS_CLASS_T_DEC\n    void\n    PB_DS_CLASS_C_DEC::\n    swap(PB_DS_CLASS_C_DEC& other)\n    {\n      comb_hash_fn_base::swap(other);\n      std::swap((Hash_Fn& )(*this), (Hash_Fn& )other);\n    }\n\n    PB_DS_CLASS_T_DEC\n    void\n    PB_DS_CLASS_C_DEC::\n    notify_resized(size_type size)\n    { comb_hash_fn_base::notify_resized(size); }\n\n    PB_DS_CLASS_T_DEC\n    inline typename PB_DS_CLASS_C_DEC::comp_hash\n    PB_DS_CLASS_C_DEC::\n    operator()(const_key_reference r_key) const\n    {\n      const size_type hash = hash_fn_base::operator()(r_key);\n      return std::make_pair(comb_hash_fn_base::operator()(hash), hash);\n    }\n\n    PB_DS_CLASS_T_DEC\n    inline typename PB_DS_CLASS_C_DEC::comp_hash\n    PB_DS_CLASS_C_DEC::\n    operator()\n#ifdef _GLIBCXX_DEBUG\n      (const_key_reference r_key, size_type hash) const\n#else \n      (const_key_reference /*r_key*/, size_type hash) const\n#endif\n    {\n      _GLIBCXX_DEBUG_ASSERT(hash == hash_fn_base::operator()(r_key));\n      return std::make_pair(comb_hash_fn_base::operator()(hash), hash);\n    }\n\n#undef PB_DS_CLASS_T_DEC\n#undef PB_DS_CLASS_C_DEC\n\n#define PB_DS_CLASS_T_DEC \\\n    template<typename Key, typename Allocator, typename Comb_Hash_Fn>\n\n#define PB_DS_CLASS_C_DEC \\\n    ranged_hash_fn<Key,\tnull_hash_fn, Allocator, Comb_Hash_Fn, false>\n\n    /**\n     * Specialization 3\n     * The client does not supply a hash function (by specifying\n     * null_hash_fn as the Hash_Fn parameter), and requests that hash\n     * values not be stored.\n     **/\n    template<typename Key, typename Allocator, typename Comb_Hash_Fn>\n    class ranged_hash_fn<Key, null_hash_fn, Allocator, Comb_Hash_Fn, false> \n    : public null_hash_fn, public Comb_Hash_Fn\n    {\n    protected:\n      typedef typename Allocator::size_type size_type;\n      typedef Comb_Hash_Fn comb_hash_fn_base;\n\n      ranged_hash_fn(size_type);\n\n      ranged_hash_fn(size_type, const Comb_Hash_Fn&);\n\n      ranged_hash_fn(size_type, const null_hash_fn&, const Comb_Hash_Fn&);\n\n      void\n      swap(PB_DS_CLASS_C_DEC&);\n    };\n\n    PB_DS_CLASS_T_DEC\n    PB_DS_CLASS_C_DEC::\n    ranged_hash_fn(size_type size)\n    { Comb_Hash_Fn::notify_resized(size); }\n\n    PB_DS_CLASS_T_DEC\n    PB_DS_CLASS_C_DEC::\n    ranged_hash_fn(size_type size, const Comb_Hash_Fn& r_comb_hash_fn) :\n      Comb_Hash_Fn(r_comb_hash_fn)\n    { }\n\n    PB_DS_CLASS_T_DEC\n    PB_DS_CLASS_C_DEC::\n    ranged_hash_fn(size_type size, const null_hash_fn& r_null_hash_fn, \n\t\t   const Comb_Hash_Fn& r_comb_hash_fn) \n    : Comb_Hash_Fn(r_comb_hash_fn)\n    { }\n\n    PB_DS_CLASS_T_DEC\n    void\n    PB_DS_CLASS_C_DEC::\n    swap(PB_DS_CLASS_C_DEC& other)\n    { comb_hash_fn_base::swap(other); }\n\n#undef PB_DS_CLASS_T_DEC\n#undef PB_DS_CLASS_C_DEC\n\n#define PB_DS_CLASS_T_DEC \\\n    template<typename Key, typename Allocator, typename Comb_Hash_Fn>\n\n#define PB_DS_CLASS_C_DEC \\\n    ranged_hash_fn<Key,\tnull_hash_fn, Allocator, Comb_Hash_Fn, true>\n\n    /**\n     * Specialization 4\n     * The client does not supply a hash function (by specifying\n     * null_hash_fn as the Hash_Fn parameter), and requests that hash\n     * values be stored.\n     **/\n    template<typename Key, typename Allocator, typename Comb_Hash_Fn>\n    class ranged_hash_fn<Key, null_hash_fn, Allocator, Comb_Hash_Fn, true> \n    : public null_hash_fn, public Comb_Hash_Fn\n    {\n    protected:\n      typedef typename Allocator::size_type size_type;\n      typedef Comb_Hash_Fn comb_hash_fn_base;\n\n      ranged_hash_fn(size_type);\n\n      ranged_hash_fn(size_type, const Comb_Hash_Fn&);\n\n      ranged_hash_fn(size_type, const null_hash_fn&, const Comb_Hash_Fn&);\n\n      void\n      swap(PB_DS_CLASS_C_DEC&);\n    };\n\n    PB_DS_CLASS_T_DEC\n    PB_DS_CLASS_C_DEC::\n    ranged_hash_fn(size_type size)\n    { Comb_Hash_Fn::notify_resized(size); }\n\n    PB_DS_CLASS_T_DEC\n    PB_DS_CLASS_C_DEC::\n    ranged_hash_fn(size_type size, const Comb_Hash_Fn& r_comb_hash_fn) \n    : Comb_Hash_Fn(r_comb_hash_fn)\n    { }\n\n    PB_DS_CLASS_T_DEC\n    PB_DS_CLASS_C_DEC::\n    ranged_hash_fn(size_type size, const null_hash_fn& r_null_hash_fn, \n\t\t   const Comb_Hash_Fn& r_comb_hash_fn) \n    : Comb_Hash_Fn(r_comb_hash_fn)\n    { }\n\n    PB_DS_CLASS_T_DEC\n    void\n    PB_DS_CLASS_C_DEC::\n    swap(PB_DS_CLASS_C_DEC& other)\n    { comb_hash_fn_base::swap(other); }\n\n#undef PB_DS_CLASS_T_DEC\n#undef PB_DS_CLASS_C_DEC\n\n  } // namespace detail\n} // namespace pb_ds\n\n#endif \n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/detail/hash_fn/ranged_probe_fn.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file ranged_probe_fn.hpp\n * Contains a unified ranged probe functor, allowing the probe tables to deal with\n *    a single class for ranged probeing.\n */\n\n#ifndef PB_DS_RANGED_PROBE_FN_HPP\n#define PB_DS_RANGED_PROBE_FN_HPP\n\n#include <ext/pb_ds/detail/basic_types.hpp>\n#include <utility>\n#include <debug/debug.h>\n\nnamespace pb_ds\n{\n  namespace detail\n  {\n    template<typename Key, typename Hash_Fn, typename Allocator,\n\t     typename Comb_Probe_Fn, typename Probe_Fn, bool Store_Hash>\n    class ranged_probe_fn;\n\n#define PB_DS_CLASS_T_DEC \\\n    template<typename Key, typename Hash_Fn, typename Allocator, \\\n\t     typename Comb_Probe_Fn, typename Probe_Fn>\n\n#define PB_DS_CLASS_C_DEC \\\n    ranged_probe_fn<Key, Hash_Fn, Allocator, Comb_Probe_Fn, Probe_Fn, false>\n\n    /**\n     * Specialization 1     \n     * The client supplies a probe function and a ranged probe\n     * function, and requests that hash values not be stored.\n     **/\n    template<typename Key, typename Hash_Fn, typename Allocator,\n\t     typename Comb_Probe_Fn, typename Probe_Fn>\n    class ranged_probe_fn<Key, Hash_Fn, Allocator, Comb_Probe_Fn,\n\t\t\t  Probe_Fn, false> \n    : public Hash_Fn, public Comb_Probe_Fn, public Probe_Fn\n    {\n    protected:\n      typedef typename Allocator::size_type size_type;\n      typedef Comb_Probe_Fn comb_probe_fn_base;\n      typedef Hash_Fn hash_fn_base;\n      typedef Probe_Fn probe_fn_base;\n      typedef typename Allocator::template rebind<Key>::other key_allocator;\n      typedef typename key_allocator::const_reference const_key_reference;\n\n      ranged_probe_fn(size_type);\n\n      ranged_probe_fn(size_type, const Hash_Fn&);\n\n      ranged_probe_fn(size_type, const Hash_Fn&, const Comb_Probe_Fn&);\n\n      ranged_probe_fn(size_type, const Hash_Fn&, const Comb_Probe_Fn&, \n\t\t      const Probe_Fn&);\n\n      void\n      swap(PB_DS_CLASS_C_DEC&);\n\n      void\n      notify_resized(size_type);\n\n      inline size_type\n      operator()(const_key_reference) const;\n\n      inline size_type\n      operator()(const_key_reference, size_type, size_type) const;\n    };\n\n    PB_DS_CLASS_T_DEC\n    PB_DS_CLASS_C_DEC::\n    ranged_probe_fn(size_type size)\n    { Comb_Probe_Fn::notify_resized(size); }\n\n    PB_DS_CLASS_T_DEC\n    PB_DS_CLASS_C_DEC::\n    ranged_probe_fn(size_type size, const Hash_Fn& r_hash_fn) \n    : Hash_Fn(r_hash_fn)\n    { Comb_Probe_Fn::notify_resized(size); }\n\n    PB_DS_CLASS_T_DEC\n    PB_DS_CLASS_C_DEC::\n    ranged_probe_fn(size_type size, const Hash_Fn& r_hash_fn, \n\t\t    const Comb_Probe_Fn& r_comb_probe_fn) \n    : Hash_Fn(r_hash_fn), Comb_Probe_Fn(r_comb_probe_fn)\n    { comb_probe_fn_base::notify_resized(size); }\n\n    PB_DS_CLASS_T_DEC\n    PB_DS_CLASS_C_DEC::\n    ranged_probe_fn(size_type size, const Hash_Fn& r_hash_fn, \n\t\t    const Comb_Probe_Fn& r_comb_probe_fn, \n\t\t    const Probe_Fn& r_probe_fn) \n    : Hash_Fn(r_hash_fn), Comb_Probe_Fn(r_comb_probe_fn), Probe_Fn(r_probe_fn)\n    { comb_probe_fn_base::notify_resized(size); }\n\n    PB_DS_CLASS_T_DEC\n    void\n    PB_DS_CLASS_C_DEC::\n    swap(PB_DS_CLASS_C_DEC& other)\n    {\n      comb_probe_fn_base::swap(other);\n      std::swap((Hash_Fn& )(*this), (Hash_Fn&)other);\n    }\n\n    PB_DS_CLASS_T_DEC\n    void\n    PB_DS_CLASS_C_DEC::\n    notify_resized(size_type size)\n    { comb_probe_fn_base::notify_resized(size); }\n\n    PB_DS_CLASS_T_DEC\n    inline typename PB_DS_CLASS_C_DEC::size_type\n    PB_DS_CLASS_C_DEC::\n    operator()(const_key_reference r_key) const\n    { return comb_probe_fn_base::operator()(hash_fn_base::operator()(r_key)); }\n\n    PB_DS_CLASS_T_DEC\n    inline typename PB_DS_CLASS_C_DEC::size_type\n    PB_DS_CLASS_C_DEC::\n    operator()(const_key_reference, size_type hash, size_type i) const\n    {\n      return comb_probe_fn_base::operator()(hash + probe_fn_base::operator()(i));\n    }\n\n#undef PB_DS_CLASS_T_DEC\n#undef PB_DS_CLASS_C_DEC\n\n#define PB_DS_CLASS_T_DEC \\\n    template<typename Key, typename Hash_Fn, typename Allocator, \\\n\t     typename Comb_Probe_Fn, typename Probe_Fn>\n\n#define PB_DS_CLASS_C_DEC \\\n    ranged_probe_fn<Key, Hash_Fn, Allocator, Comb_Probe_Fn, Probe_Fn, true>\n\n    /**\n     * Specialization 2- The client supplies a probe function and a ranged\n     *    probe function, and requests that hash values not be stored.\n     **/\n    template<typename Key, typename Hash_Fn, typename Allocator,\n\t     typename Comb_Probe_Fn, typename Probe_Fn>\n    class ranged_probe_fn<Key, Hash_Fn, Allocator, Comb_Probe_Fn, \n\t\t\t  Probe_Fn, true> \n    : public Hash_Fn, public Comb_Probe_Fn, public Probe_Fn\n    {\n    protected:\n      typedef typename Allocator::size_type size_type;\n      typedef std::pair<size_type, size_type> comp_hash;\n      typedef Comb_Probe_Fn comb_probe_fn_base;\n      typedef Hash_Fn hash_fn_base;\n      typedef Probe_Fn probe_fn_base;\n      typedef typename Allocator::template rebind<Key>::other key_allocator;\n      typedef typename key_allocator::const_reference const_key_reference;\n\n      ranged_probe_fn(size_type);\n\n      ranged_probe_fn(size_type, const Hash_Fn&);\n\n      ranged_probe_fn(size_type, const Hash_Fn&, \n\t\t      const Comb_Probe_Fn&);\n\n      ranged_probe_fn(size_type, const Hash_Fn&, const Comb_Probe_Fn&, \n\t\t      const Probe_Fn&);\n\n      void\n      swap(PB_DS_CLASS_C_DEC&);\n\n      void\n      notify_resized(size_type);\n\n      inline comp_hash\n      operator()(const_key_reference) const;\n\n      inline size_type\n      operator()(const_key_reference, size_type, size_type) const;\n\n      inline size_type\n      operator()(const_key_reference, size_type) const;\n    };\n\n    PB_DS_CLASS_T_DEC\n    PB_DS_CLASS_C_DEC::\n    ranged_probe_fn(size_type size)\n    { Comb_Probe_Fn::notify_resized(size); }\n\n    PB_DS_CLASS_T_DEC\n    PB_DS_CLASS_C_DEC::\n    ranged_probe_fn(size_type size, const Hash_Fn& r_hash_fn) \n    : Hash_Fn(r_hash_fn)\n    { Comb_Probe_Fn::notify_resized(size); }\n\n    PB_DS_CLASS_T_DEC\n    PB_DS_CLASS_C_DEC::\n    ranged_probe_fn(size_type size, const Hash_Fn& r_hash_fn, \n\t\t    const Comb_Probe_Fn& r_comb_probe_fn) \n    : Hash_Fn(r_hash_fn), Comb_Probe_Fn(r_comb_probe_fn)\n    { comb_probe_fn_base::notify_resized(size); }\n\n    PB_DS_CLASS_T_DEC\n    PB_DS_CLASS_C_DEC::\n    ranged_probe_fn(size_type size, const Hash_Fn& r_hash_fn, \n\t\t    const Comb_Probe_Fn& r_comb_probe_fn, \n\t\t    const Probe_Fn& r_probe_fn) \n    : Hash_Fn(r_hash_fn), Comb_Probe_Fn(r_comb_probe_fn), Probe_Fn(r_probe_fn)\n    { comb_probe_fn_base::notify_resized(size); }\n\n    PB_DS_CLASS_T_DEC\n    void\n    PB_DS_CLASS_C_DEC::\n    swap(PB_DS_CLASS_C_DEC& other)\n    {\n      comb_probe_fn_base::swap(other);\n      std::swap((Hash_Fn& )(*this), (Hash_Fn& )other);\n    }\n\n    PB_DS_CLASS_T_DEC\n    void\n    PB_DS_CLASS_C_DEC::\n    notify_resized(size_type size)\n    { comb_probe_fn_base::notify_resized(size); }\n\n    PB_DS_CLASS_T_DEC\n    inline typename PB_DS_CLASS_C_DEC::comp_hash\n    PB_DS_CLASS_C_DEC::\n    operator()(const_key_reference r_key) const\n    {\n      const size_type hash = hash_fn_base::operator()(r_key);\n      return std::make_pair(comb_probe_fn_base::operator()(hash), hash);\n    }\n\n    PB_DS_CLASS_T_DEC\n    inline typename PB_DS_CLASS_C_DEC::size_type\n    PB_DS_CLASS_C_DEC::\n    operator()(const_key_reference, size_type hash, size_type i) const\n    {\n      return comb_probe_fn_base::operator()(hash + probe_fn_base::operator()(i));\n    }\n\n    PB_DS_CLASS_T_DEC\n    inline typename PB_DS_CLASS_C_DEC::size_type\n    PB_DS_CLASS_C_DEC::\n    operator()\n#ifdef _GLIBCXX_DEBUG\n      (const_key_reference r_key, size_type hash) const\n#else \n      (const_key_reference /*r_key*/, size_type hash) const\n#endif \n    {\n      _GLIBCXX_DEBUG_ASSERT(hash == hash_fn_base::operator()(r_key));\n      return hash;\n    }\n\n#undef PB_DS_CLASS_T_DEC\n#undef PB_DS_CLASS_C_DEC\n\n    /**\n     * Specialization 3 and 4\n     * The client does not supply a hash function or probe function,\n     * and requests that hash values not be stored.\n     **/\n    template<typename Key, typename Allocator, typename Comb_Probe_Fn>\n    class ranged_probe_fn<Key, null_hash_fn, Allocator, Comb_Probe_Fn, \n\t\t\t  null_probe_fn, false> \n    : public Comb_Probe_Fn, public null_hash_fn, public null_probe_fn\n    {\n    protected:\n      typedef typename Allocator::size_type size_type;\n      typedef Comb_Probe_Fn comb_probe_fn_base;\n      typedef typename Allocator::template rebind<Key>::other key_allocator;\n      typedef typename key_allocator::const_reference const_key_reference;\n\n      ranged_probe_fn(size_type size)\n      { Comb_Probe_Fn::notify_resized(size); }\n\n      ranged_probe_fn(size_type, const Comb_Probe_Fn& r_comb_probe_fn)\n      : Comb_Probe_Fn(r_comb_probe_fn)\n      { }\n\n      ranged_probe_fn(size_type, const null_hash_fn&, \n\t\t      const Comb_Probe_Fn& r_comb_probe_fn, \n\t\t      const null_probe_fn&)\n      : Comb_Probe_Fn(r_comb_probe_fn)\n      { }\n\n      void\n      swap(ranged_probe_fn& other)\n      { comb_probe_fn_base::swap(other); }\n    };\n  } // namespace detail\n} // namespace pb_ds\n\n#endif\n\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/detail/hash_fn/sample_probe_fn.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file sample_probe_fn.hpp\n * Contains a sample probe policy.\n */\n\n#ifndef PB_DS_SAMPLE_PROBE_FN_HPP\n#define PB_DS_SAMPLE_PROBE_FN_HPP\n\n// A sample probe policy.\nclass sample_probe_fn\n{\n\npublic:\n\n  // Size type.\n  typedef size_t size_type;\n\npublic:\n\n  // Default constructor.\n  sample_probe_fn();\n\n  // Copy constructor.\n  sample_probe_fn(const sample_probe_fn& other);\n\n  // Swaps content.\n  inline void\n  swap(sample_probe_fn& other);\n\nprotected:\n\n  // Returns the i-th offset from the hash value of some key r_key.\n  inline size_type\n  operator()(const_key_reference r_key, size_type i) const;\n\n};\n\n#endif // #ifndef PB_DS_SAMPLE_PROBE_FN_HPP\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/detail/hash_fn/sample_range_hashing.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file sample_range_hashing.hpp\n * Contains a range hashing policy.\n */\n\n#ifndef PB_DS_SAMPLE_RANGE_HASHING_HPP\n#define PB_DS_SAMPLE_RANGE_HASHING_HPP\n\n// A sample range-hashing functor.\nclass sample_range_hashing\n{\n\npublic:\n\n  // Size type.\n  typedef size_t size_type;\n\npublic:\n\n  // Default constructor.\n  sample_range_hashing();\n\n  // Copy constructor.\n  sample_range_hashing(const sample_range_hashing& other);\n\n  // Swaps content.\n  inline void\n  swap(sample_range_hashing& other);\n\nprotected:\n\n  // Notifies the policy object that the container's __size has changed to size.\n  void\n  notify_resized(size_type size);\n\n  // Transforms the __hash value hash into a ranged-hash value.\n  inline size_type\n  operator()(size_type hash) const;\n\n};\n\n#endif // #ifndef PB_DS_SAMPLE_RANGE_HASHING_HPP\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/detail/hash_fn/sample_ranged_hash_fn.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file sample_ranged_hash_fn.hpp\n * Contains a ranged hash policy.\n */\n\n#ifndef PB_DS_SAMPLE_RANGED_HASH_FN_HPP\n#define PB_DS_SAMPLE_RANGED_HASH_FN_HPP\n\n// A sample ranged-hash functor.\nclass sample_ranged_hash_fn\n{\n\npublic:\n\n  // Size type.\n  typedef size_t size_type;\n\npublic:\n\n  // Default constructor.\n  sample_ranged_hash_fn();\n\n  // Copy constructor.\n  sample_ranged_hash_fn(const sample_ranged_hash_fn& other);\n\n  // Swaps content.\n  inline void\n  swap(sample_ranged_hash_fn& other);\n\nprotected:\n\n  // Notifies the policy object that the container's __size has changed to size.\n  void\n  notify_resized(size_type size);\n\n  // Transforms r_key into a position within the table.\n  inline size_type\n  operator()(const_key_reference r_key) const;\n\n};\n\n#endif // #ifndef PB_DS_SAMPLE_RANGED_HASH_FN_HPP\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/detail/hash_fn/sample_ranged_probe_fn.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file sample_ranged_probe_fn.hpp\n * Contains a ranged probe policy.\n */\n\n#ifndef PB_DS_SAMPLE_RANGED_PROBE_FN_HPP\n#define PB_DS_SAMPLE_RANGED_PROBE_FN_HPP\n\n// A sample ranged-probe functor.\nclass sample_ranged_probe_fn\n{\n\npublic:\n\n  // Size type.\n  typedef size_t size_type;\n\npublic:\n\n  // Default constructor.\n  sample_ranged_probe_fn();\n\n  // Copy constructor.\n  sample_ranged_probe_fn(const sample_ranged_probe_fn& other);\n\n  // Swaps content.\n  inline void\n  swap(sample_ranged_probe_fn& other);\n\nprotected:\n\n  // Notifies the policy object that the container's __size has changed to size.\n  void\n  notify_resized(size_type size);\n\n  // 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.\n  inline size_type\n  operator()(const_key_reference r_key, size_t hash, size_type i) const;\n\n};\n\n#endif // #ifndef PB_DS_SAMPLE_RANGED_PROBE_FN_HPP\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/detail/left_child_next_sibling_heap_/const_iterator.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file const_iterator.hpp\n * Contains an iterator class returned by the table's const find and insert\n *     methods.\n */\n\n#ifndef PB_DS_LEFT_CHILD_NEXT_SIBLING_HEAP_CONST_ITERATOR_HPP\n#define PB_DS_LEFT_CHILD_NEXT_SIBLING_HEAP_CONST_ITERATOR_HPP\n\n#include <ext/pb_ds/detail/left_child_next_sibling_heap_/const_point_iterator.hpp>\n#include <debug/debug.h>\n\nnamespace pb_ds\n{\n  namespace detail\n  {\n\n#define PB_DS_CLASS_C_DEC\t\t\t\t\t\t\\\n    left_child_next_sibling_heap_const_iterator_<Node, Allocator>\n\n#define PB_DS_BASE_C_DEC\t\t\t\t\t\t\\\n    left_child_next_sibling_heap_node_const_point_iterator_<Node, Allocator>\n\n    // Const point-type iterator.\n    template<typename Node, class Allocator>\n    class left_child_next_sibling_heap_const_iterator_ : public PB_DS_BASE_C_DEC\n    {\n\n    private:\n      typedef typename PB_DS_BASE_C_DEC::node_pointer node_pointer;\n\n      typedef PB_DS_BASE_C_DEC base_type;\n\n    public:\n\n      // Category.\n      typedef std::forward_iterator_tag iterator_category;\n\n      // Difference type.\n      typedef typename Allocator::difference_type difference_type;\n\n      // Iterator's value type.\n      typedef typename base_type::value_type value_type;\n\n      // Iterator's pointer type.\n      typedef typename base_type::pointer pointer;\n\n      // Iterator's const pointer type.\n      typedef typename base_type::const_pointer const_pointer;\n\n      // Iterator's reference type.\n      typedef typename base_type::reference reference;\n\n      // Iterator's const reference type.\n      typedef typename base_type::const_reference const_reference;\n\n    public:\n\n      inline\n      left_child_next_sibling_heap_const_iterator_(node_pointer p_nd) : base_type(p_nd)\n      { }\n\n      // Default constructor.\n      inline\n      left_child_next_sibling_heap_const_iterator_()\n      { }\n\n      // Copy constructor.\n      inline\n      left_child_next_sibling_heap_const_iterator_(const PB_DS_CLASS_C_DEC& other) : base_type(other)\n      { }\n\n      // Compares content to a different iterator object.\n      inline bool\n      operator==(const PB_DS_CLASS_C_DEC& other) const\n      { return (base_type::m_p_nd == other.m_p_nd); }\n\n      // Compares content (negatively) to a different iterator object.\n      inline bool\n      operator!=(const PB_DS_CLASS_C_DEC& other) const\n      { return (base_type::m_p_nd != other.m_p_nd); }\n\n      inline PB_DS_CLASS_C_DEC& \n      operator++()\n      {\n\t_GLIBCXX_DEBUG_ASSERT(base_type::m_p_nd != NULL);\n\tinc();\n\treturn (*this);\n      }\n\n      inline PB_DS_CLASS_C_DEC\n      operator++(int)\n      {\n\tPB_DS_CLASS_C_DEC ret_it(base_type::m_p_nd);\n\toperator++();\n\treturn (ret_it);\n      }\n\n    private:\n      void\n      inc()\n      {\n\tif (base_type::m_p_nd->m_p_next_sibling != NULL)\n\t  {\n\t    base_type::m_p_nd = base_type::m_p_nd->m_p_next_sibling;\n\t    while (base_type::m_p_nd->m_p_l_child != NULL)\n\t      base_type::m_p_nd = base_type::m_p_nd->m_p_l_child;\n\t    return;\n\t  }\n\n\twhile (true)\n\t  {\n\t    node_pointer p_next = base_type::m_p_nd;\n\t    base_type::m_p_nd = base_type::m_p_nd->m_p_prev_or_parent;\n\t    if (base_type::m_p_nd == NULL || base_type::m_p_nd->m_p_l_child == p_next)\n\t      return;\n\t  }\n      }\n    };\n\n#undef PB_DS_CLASS_C_DEC\n#undef PB_DS_BASE_C_DEC\n\n  } // namespace detail\n} // namespace pb_ds\n\n#endif \n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/detail/left_child_next_sibling_heap_/const_point_iterator.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file const_point_iterator.hpp\n * Contains an iterator class returned by the table's const find and insert\n *     methods.\n */\n\n#ifndef PB_DS_LEFT_CHILD_NEXT_SIBLING_HEAP_CONST_FIND_ITERATOR_HPP\n#define PB_DS_LEFT_CHILD_NEXT_SIBLING_HEAP_CONST_FIND_ITERATOR_HPP\n\n#include <ext/pb_ds/tag_and_trait.hpp>\n#include <debug/debug.h>\n\nnamespace pb_ds\n{\n  namespace detail\n  {\n\n#define PB_DS_CLASS_T_DEC\t\t\t\\\n    template<typename Node, class Allocator>\n\n#define PB_DS_CLASS_C_DEC \\\n    left_child_next_sibling_heap_node_const_point_iterator_<Node, Allocator>\n\n    // Const point-type iterator.\n    template<typename Node, class Allocator>\n    class left_child_next_sibling_heap_node_const_point_iterator_\n    {\n\n    protected:\n      typedef typename Allocator::template rebind<Node>::other::pointer node_pointer;\n\n    public:\n\n      // Category.\n      typedef trivial_iterator_tag iterator_category;\n\n      // Difference type.\n      typedef trivial_iterator_difference_type difference_type;\n\n      // Iterator's value type.\n      typedef typename Node::value_type value_type;\n\n      // Iterator's pointer type.\n      typedef\n      typename Allocator::template rebind<\n\tvalue_type>::other::pointer\n      pointer;\n\n      // Iterator's const pointer type.\n      typedef\n      typename Allocator::template rebind<\n\tvalue_type>::other::const_pointer\n      const_pointer;\n\n      // Iterator's reference type.\n      typedef\n      typename Allocator::template rebind<\n\tvalue_type>::other::reference\n      reference;\n\n      // Iterator's const reference type.\n      typedef\n      typename Allocator::template rebind<\n\tvalue_type>::other::const_reference\n      const_reference;\n\n    public:\n\n      inline\n      left_child_next_sibling_heap_node_const_point_iterator_(node_pointer p_nd) : m_p_nd(p_nd)\n      { }\n\n      // Default constructor.\n      inline\n      left_child_next_sibling_heap_node_const_point_iterator_() : m_p_nd(NULL)\n      { }\n\n      // Copy constructor.\n      inline\n      left_child_next_sibling_heap_node_const_point_iterator_(const PB_DS_CLASS_C_DEC& other) : m_p_nd(other.m_p_nd)\n      { }\n\n      // Access.\n      inline const_pointer\n      operator->() const\n      {\n\t_GLIBCXX_DEBUG_ASSERT(m_p_nd != NULL);\n\treturn &m_p_nd->m_value;\n      }\n\n      // Access.\n      inline const_reference\n      operator*() const\n      {\n\t_GLIBCXX_DEBUG_ASSERT(m_p_nd != NULL);\n\treturn m_p_nd->m_value;\n      }\n\n      // Compares content to a different iterator object.\n      inline bool\n      operator==(const PB_DS_CLASS_C_DEC& other) const\n      { return m_p_nd == other.m_p_nd; }\n\n      // Compares content (negatively) to a different iterator object.\n      inline bool\n      operator!=(const PB_DS_CLASS_C_DEC& other) const\n      { return m_p_nd != other.m_p_nd; }\n\n    public:\n      node_pointer m_p_nd;\n    };\n\n#undef PB_DS_CLASS_T_DEC\n#undef PB_DS_CLASS_C_DEC\n\n  } // namespace detail\n} // namespace pb_ds\n\n#endif \n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/detail/left_child_next_sibling_heap_/constructors_destructor_fn_imps.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file constructors_destructor_fn_imps.hpp\n * Contains an implementation class for left_child_next_sibling_heap_.\n */\n\nPB_DS_CLASS_T_DEC\ntypename PB_DS_CLASS_C_DEC::node_allocator\nPB_DS_CLASS_C_DEC::s_node_allocator;\n\nPB_DS_CLASS_T_DEC\ntypename PB_DS_CLASS_C_DEC::no_throw_copies_t\nPB_DS_CLASS_C_DEC::s_no_throw_copies_ind;\n\nPB_DS_CLASS_T_DEC\nPB_DS_CLASS_C_DEC::\nleft_child_next_sibling_heap_() :\n  m_p_root(NULL),\n  m_size(0)\n{\n  _GLIBCXX_DEBUG_ONLY(assert_valid();)\n}\n\nPB_DS_CLASS_T_DEC\nPB_DS_CLASS_C_DEC::\nleft_child_next_sibling_heap_(const Cmp_Fn& r_cmp_fn) :\n  Cmp_Fn(r_cmp_fn),\n  m_p_root(NULL),\n  m_size(0)\n{\n  _GLIBCXX_DEBUG_ONLY(assert_valid();)\n}\n\nPB_DS_CLASS_T_DEC\nPB_DS_CLASS_C_DEC::\nleft_child_next_sibling_heap_(const PB_DS_CLASS_C_DEC& other) \n: Cmp_Fn(other), m_p_root(NULL), m_size(0)\n{\n  m_size = other.m_size;\n  _GLIBCXX_DEBUG_ONLY(other.assert_valid();)\n  m_p_root = recursive_copy_node(other.m_p_root);\n  m_size = other.m_size;\n  _GLIBCXX_DEBUG_ONLY(assert_valid();)\n}\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nswap(PB_DS_CLASS_C_DEC& other)\n{\n  _GLIBCXX_DEBUG_ONLY(assert_valid();)\n  _GLIBCXX_DEBUG_ONLY(other.assert_valid();)\n  value_swap(other);\n  std::swap((Cmp_Fn& )(*this), (Cmp_Fn& )other);\n  _GLIBCXX_DEBUG_ONLY(assert_valid();)\n  _GLIBCXX_DEBUG_ONLY(other.assert_valid();)\n}\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nvalue_swap(PB_DS_CLASS_C_DEC& other)\n{\n  std::swap(m_p_root, other.m_p_root);\n  std::swap(m_size, other.m_size);\n}\n\nPB_DS_CLASS_T_DEC\nPB_DS_CLASS_C_DEC::\n~left_child_next_sibling_heap_()\n{\n  clear();\n}\n\nPB_DS_CLASS_T_DEC\ntypename PB_DS_CLASS_C_DEC::node_pointer\nPB_DS_CLASS_C_DEC::\nrecursive_copy_node(const_node_pointer p_nd)\n{\n  if (p_nd == NULL)\n    return (NULL);\n\n  node_pointer p_ret = s_node_allocator.allocate(1);\n\n  try\n    {\n      new (p_ret) node(*p_nd);\n    }\n  catch(...)\n    {\n      s_node_allocator.deallocate(p_ret, 1);\n      __throw_exception_again;\n    }\n\n  p_ret->m_p_l_child = p_ret->m_p_next_sibling =\n    p_ret->m_p_prev_or_parent = NULL;\n\n  try\n    {\n      p_ret->m_p_l_child = recursive_copy_node(p_nd->m_p_l_child);\n      p_ret->m_p_next_sibling = recursive_copy_node(p_nd->m_p_next_sibling);\n    }\n  catch(...)\n    {\n      clear_imp(p_ret);\n      __throw_exception_again;\n    }\n\n  if (p_ret->m_p_l_child != NULL)\n    p_ret->m_p_l_child->m_p_prev_or_parent = p_ret;\n\n  if (p_ret->m_p_next_sibling != NULL)\n    p_ret->m_p_next_sibling->m_p_prev_or_parent =\n      p_nd->m_p_next_sibling->m_p_prev_or_parent == p_nd ? p_ret : NULL;\n\n  return p_ret;\n}\n\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/detail/left_child_next_sibling_heap_/debug_fn_imps.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file debug_fn_imps.hpp\n * Contains an implementation class for left_child_next_sibling_heap_.\n */\n\n#ifdef _GLIBCXX_DEBUG\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nassert_valid() const\n{\n  _GLIBCXX_DEBUG_ASSERT(m_p_root == NULL || m_p_root->m_p_prev_or_parent == NULL);\n\n  if (m_p_root != NULL)\n    assert_node_consistent(m_p_root, Single_Link_Roots);\n  assert_size();\n  assert_iterators();\n}\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nassert_node_consistent(const_node_pointer p_nd, bool single_link) const\n{\n  if (p_nd == NULL)\n    return;\n\n  assert_node_consistent(p_nd->m_p_l_child, false);\n  assert_node_consistent(p_nd->m_p_next_sibling, single_link);\n\n  if (single_link)\n    _GLIBCXX_DEBUG_ASSERT(p_nd->m_p_prev_or_parent == NULL);\n  else if (p_nd->m_p_next_sibling != NULL)\n    _GLIBCXX_DEBUG_ASSERT(p_nd->m_p_next_sibling->m_p_prev_or_parent == p_nd);\n\n  if (p_nd->m_p_l_child == NULL)\n    return;\n\n  const_node_pointer p_child = p_nd->m_p_l_child;\n  while (p_child != NULL)\n    {\n      const_node_pointer p_next_child = p_child->m_p_next_sibling;\n      _GLIBCXX_DEBUG_ASSERT(!Cmp_Fn::operator()(p_nd->m_value, p_child->m_value));\n      p_child = p_next_child;\n    }\n  _GLIBCXX_DEBUG_ASSERT(p_nd->m_p_l_child->m_p_prev_or_parent == p_nd);\n}\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nassert_iterators() const\n{\n  const size_type calc_size = std::distance(begin(), end());\n  if (calc_size == size())\n    return;\n  _GLIBCXX_DEBUG_ASSERT(0);\n}\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nassert_size() const\n{\n  if (size_from_node(m_p_root) == m_size)\n    return;\n  _GLIBCXX_DEBUG_ASSERT(0);\n}\n\nPB_DS_CLASS_T_DEC\ntypename PB_DS_CLASS_C_DEC::size_type\nPB_DS_CLASS_C_DEC::\nsize_under_node(const_node_pointer p_nd)\n{ return 1 + size_from_node(p_nd->m_p_l_child); }\n\nPB_DS_CLASS_T_DEC\ntypename PB_DS_CLASS_C_DEC::size_type\nPB_DS_CLASS_C_DEC::\nsize_from_node(const_node_pointer p_nd)\n{\n  size_type ret = 0;\n  while (p_nd != NULL)\n    {\n      ret += 1 + size_from_node(p_nd->m_p_l_child);\n      p_nd = p_nd->m_p_next_sibling;\n    }\n  return ret;\n}\n\nPB_DS_CLASS_T_DEC\ntypename PB_DS_CLASS_C_DEC::size_type\nPB_DS_CLASS_C_DEC::\ndegree(const_node_pointer p_nd)\n{\n  size_type ret = 0;\n  const_node_pointer p_child = p_nd->m_p_l_child;\n  while (p_child != NULL)\n    {\n      ++ret;\n      p_child = p_child->m_p_next_sibling;\n    }\n  return ret;\n}\n\n#endif \n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/detail/left_child_next_sibling_heap_/erase_fn_imps.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file erase_fn_imps.hpp\n * Contains an implementation class for left_child_next_sibling_heap_.\n */\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nclear()\n{\n  clear_imp(m_p_root);\n  _GLIBCXX_DEBUG_ASSERT(m_size == 0);\n  m_p_root = NULL;\n}\n\nPB_DS_CLASS_T_DEC\ninline void\nPB_DS_CLASS_C_DEC::\nactual_erase_node(node_pointer p_nd)\n{\n  _GLIBCXX_DEBUG_ASSERT(m_size > 0);\n  --m_size;\n  p_nd->~node();\n  s_node_allocator.deallocate(p_nd, 1);\n}\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nclear_imp(node_pointer p_nd)\n{\n  while (p_nd != NULL)\n    {\n      clear_imp(p_nd->m_p_l_child);\n      node_pointer p_next = p_nd->m_p_next_sibling;\n      actual_erase_node(p_nd);\n      p_nd = p_next;\n    }\n}\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nto_linked_list()\n{\n  _GLIBCXX_DEBUG_ONLY(assert_valid();)\n  node_pointer p_cur = m_p_root;\n  while (p_cur != NULL)\n    if (p_cur->m_p_l_child != NULL)\n      {\n\tnode_pointer p_child_next = p_cur->m_p_l_child->m_p_next_sibling;\n\tp_cur->m_p_l_child->m_p_next_sibling = p_cur->m_p_next_sibling;\n\tp_cur->m_p_next_sibling = p_cur->m_p_l_child;\n\tp_cur->m_p_l_child = p_child_next;\n      }\n    else\n      p_cur = p_cur->m_p_next_sibling;\n\n#ifdef _GLIBCXX_DEBUG\n  const_node_pointer p_counter = m_p_root;\n  size_type count = 0;\n  while (p_counter != NULL)\n    {\n      ++count;\n      _GLIBCXX_DEBUG_ASSERT(p_counter->m_p_l_child == NULL);\n      p_counter = p_counter->m_p_next_sibling;\n    }\n  _GLIBCXX_DEBUG_ASSERT(count == m_size);\n#endif \n}\n\nPB_DS_CLASS_T_DEC\ntemplate<typename Pred>\ntypename PB_DS_CLASS_C_DEC::node_pointer\nPB_DS_CLASS_C_DEC::\nprune(Pred pred)\n{\n  node_pointer p_cur = m_p_root;\n  m_p_root = NULL;\n  node_pointer p_out = NULL;\n  while (p_cur != NULL)\n    {\n      node_pointer p_next = p_cur->m_p_next_sibling;\n      if (pred(p_cur->m_value))\n        {\n\t  p_cur->m_p_next_sibling = p_out;\n\t  if (p_out != NULL)\n\t    p_out->m_p_prev_or_parent = p_cur;\n\t  p_out = p_cur;\n        }\n      else\n        {\n\t  p_cur->m_p_next_sibling = m_p_root;\n\t  if (m_p_root != NULL)\n\t    m_p_root->m_p_prev_or_parent = p_cur;\n\t  m_p_root = p_cur;\n        }\n      p_cur = p_next;\n    }\n  return p_out;\n}\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nbubble_to_top(node_pointer p_nd)\n{\n  node_pointer p_parent = parent(p_nd);\n  while (p_parent != NULL)\n    {\n      swap_with_parent(p_nd, p_parent);\n      p_parent = parent(p_nd);\n    }\n}\n\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/detail/left_child_next_sibling_heap_/info_fn_imps.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file info_fn_imps.hpp\n * Contains an implementation class for left_child_next_sibling_heap_.\n */\n\nPB_DS_CLASS_T_DEC\ninline bool\nPB_DS_CLASS_C_DEC::\nempty() const\n{\n  return (m_size == 0);\n}\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::size_type\nPB_DS_CLASS_C_DEC::\nsize() const\n{\n  return (m_size);\n}\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::size_type\nPB_DS_CLASS_C_DEC::\nmax_size() const\n{\n  return (s_node_allocator.max_size());\n}\n\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/detail/left_child_next_sibling_heap_/insert_fn_imps.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file insert_fn_imps.hpp\n * Contains an implementation class for left_child_next_sibling_heap_.\n */\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::node_pointer\nPB_DS_CLASS_C_DEC::\nget_new_node_for_insert(const_reference r_val)\n{\n  return get_new_node_for_insert(r_val, s_no_throw_copies_ind);\n}\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::node_pointer\nPB_DS_CLASS_C_DEC::\nget_new_node_for_insert(const_reference r_val, false_type)\n{\n  node_pointer p_new_nd = s_node_allocator.allocate(1);\n\n  cond_dealtor_t cond(p_new_nd);\n\n  new (const_cast<void* >(\n\t\t\t  static_cast<const void* >(&p_new_nd->m_value)))\n    typename node::value_type(r_val);\n\n  cond.set_no_action();\n\n  ++m_size;\n\n  return (p_new_nd);\n}\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::node_pointer\nPB_DS_CLASS_C_DEC::\nget_new_node_for_insert(const_reference r_val, true_type)\n{\n  node_pointer p_new_nd = s_node_allocator.allocate(1);\n\n  new (const_cast<void* >(\n\t\t\t  static_cast<const void* >(&p_new_nd->m_value)))\n    typename node::value_type(r_val);\n\n  ++m_size;\n\n  return (p_new_nd);\n}\n\nPB_DS_CLASS_T_DEC\ninline void\nPB_DS_CLASS_C_DEC::\nmake_child_of(node_pointer p_nd, node_pointer p_new_parent)\n{\n  _GLIBCXX_DEBUG_ASSERT(p_nd != NULL);\n  _GLIBCXX_DEBUG_ASSERT(p_new_parent != NULL);\n\n  p_nd->m_p_next_sibling = p_new_parent->m_p_l_child;\n\n  if (p_new_parent->m_p_l_child != NULL)\n    p_new_parent->m_p_l_child->m_p_prev_or_parent = p_nd;\n\n  p_nd->m_p_prev_or_parent = p_new_parent;\n\n  p_new_parent->m_p_l_child = p_nd;\n}\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::node_pointer\nPB_DS_CLASS_C_DEC::\nparent(node_pointer p_nd)\n{\n  while (true)\n    {\n      node_pointer p_pot = p_nd->m_p_prev_or_parent;\n\n      if (p_pot == NULL || p_pot->m_p_l_child == p_nd)\n\treturn p_pot;\n\n      p_nd = p_pot;\n    }\n}\n\nPB_DS_CLASS_T_DEC\ninline void\nPB_DS_CLASS_C_DEC::\nswap_with_parent(node_pointer p_nd, node_pointer p_parent)\n{\n  if (p_parent == m_p_root)\n    m_p_root = p_nd;\n\n  _GLIBCXX_DEBUG_ASSERT(p_nd != NULL);\n  _GLIBCXX_DEBUG_ASSERT(p_parent != NULL);\n  _GLIBCXX_DEBUG_ASSERT(parent(p_nd) == p_parent);\n\n  const bool nd_direct_child = p_parent->m_p_l_child == p_nd;\n  const bool parent_root = p_parent->m_p_prev_or_parent == NULL;\n  const bool parent_direct_child =\n    !parent_root&&  p_parent->m_p_prev_or_parent->m_p_l_child == p_parent;\n\n  std::swap(p_parent->m_p_prev_or_parent, p_nd->m_p_prev_or_parent);\n  std::swap(p_parent->m_p_next_sibling, p_nd->m_p_next_sibling);\n  std::swap(p_parent->m_p_l_child, p_nd->m_p_l_child);\n  std::swap(p_parent->m_metadata, p_nd->m_metadata);\n\n  _GLIBCXX_DEBUG_ASSERT(p_nd->m_p_l_child != NULL);\n  _GLIBCXX_DEBUG_ASSERT(p_parent->m_p_prev_or_parent != NULL);\n\n  if (p_nd->m_p_next_sibling != NULL)\n    p_nd->m_p_next_sibling->m_p_prev_or_parent = p_nd;\n\n  if (p_parent->m_p_next_sibling != NULL)\n    p_parent->m_p_next_sibling->m_p_prev_or_parent = p_parent;\n\n  if (p_parent->m_p_l_child != NULL)\n    p_parent->m_p_l_child->m_p_prev_or_parent = p_parent;\n\n  if (parent_direct_child)\n    p_nd->m_p_prev_or_parent->m_p_l_child = p_nd;\n  else if (!parent_root)\n    p_nd->m_p_prev_or_parent->m_p_next_sibling = p_nd;\n\n  if (!nd_direct_child)\n    {\n      p_nd->m_p_l_child->m_p_prev_or_parent = p_nd;\n\n      p_parent->m_p_prev_or_parent->m_p_next_sibling = p_parent;\n    }\n  else\n    {\n      _GLIBCXX_DEBUG_ASSERT(p_nd->m_p_l_child == p_nd);\n      _GLIBCXX_DEBUG_ASSERT(p_parent->m_p_prev_or_parent == p_parent);\n\n      p_nd->m_p_l_child = p_parent;\n      p_parent->m_p_prev_or_parent = p_nd;\n    }\n\n  _GLIBCXX_DEBUG_ASSERT(parent(p_parent) == p_nd);\n}\n\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/detail/left_child_next_sibling_heap_/iterators_fn_imps.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file iterators_fn_imps.hpp\n * Contains an implementation class for left_child_next_sibling_heap_.\n */\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::iterator\nPB_DS_CLASS_C_DEC::\nbegin()\n{\n  node_pointer p_nd = m_p_root;\n\n  if (p_nd == NULL)\n    return (iterator(NULL));\n\n  while (p_nd->m_p_l_child != NULL)\n    p_nd = p_nd->m_p_l_child;\n\n  return (iterator(p_nd));\n}\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::const_iterator\nPB_DS_CLASS_C_DEC::\nbegin() const\n{\n  node_pointer p_nd = m_p_root;\n\n  if (p_nd == NULL)\n    return (const_iterator(NULL));\n\n  while (p_nd->m_p_l_child != NULL)\n    p_nd = p_nd->m_p_l_child;\n\n  return (const_iterator(p_nd));\n}\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::iterator\nPB_DS_CLASS_C_DEC::\nend()\n{\n  return (iterator(NULL));\n}\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::const_iterator\nPB_DS_CLASS_C_DEC::\nend() const\n{\n  return (const_iterator(NULL));\n}\n\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/detail/left_child_next_sibling_heap_/left_child_next_sibling_heap_.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file left_child_next_sibling_heap_.hpp\n * Contains an implementation class for a basic heap.\n */\n\n#ifndef PB_DS_LEFT_CHILD_NEXT_SIBLING_HEAP_HPP\n#define PB_DS_LEFT_CHILD_NEXT_SIBLING_HEAP_HPP\n\n/*\n * Based on CLRS.\n */\n\n#include <iterator>\n#include <ext/pb_ds/detail/cond_dealtor.hpp>\n#include <ext/pb_ds/detail/type_utils.hpp>\n#include <ext/pb_ds/detail/left_child_next_sibling_heap_/node.hpp>\n#include <ext/pb_ds/detail/left_child_next_sibling_heap_/const_point_iterator.hpp>\n#include <ext/pb_ds/detail/left_child_next_sibling_heap_/const_iterator.hpp>\n#ifdef PB_DS_LC_NS_HEAP_TRACE_\n#include <iostream>\n#endif \n#include <debug/debug.h>\n\nnamespace pb_ds\n{\n  namespace detail\n  {\n\n#ifdef _GLIBCXX_DEBUG\n#define PB_DS_CLASS_T_DEC\t\t\t\t\t\t\\\n    template<\t\t\t\t\t\t\t\t\\\n\t\t\t\t\t\ttypename Value_Type,\t\\\n\t\t\t\t\t\tclass Cmp_Fn,\t\t\\\n\t\t\t\t\t\ttypename Node_Metadata,\t\\\n\t\t\t\t\t\tclass Allocator,\t\\\n\t\t\t\t\t\tbool Single_Link_Roots>\n#else \n#define PB_DS_CLASS_T_DEC\t\t\t\t\t\t\\\n    template<\t\t\t\t\t\t\t\t\\\n\t\t\t\t\t\ttypename Value_Type,\t\\\n\t\t\t\t\t\tclass Cmp_Fn,\t\t\\\n\t\t\t\t\t\ttypename Node_Metadata,\t\\\n\t\t\t\t\t\tclass Allocator>\n#endif \n\n#ifdef _GLIBCXX_DEBUG\n#define PB_DS_CLASS_C_DEC\t\t\t\t\t\t\\\n    left_child_next_sibling_heap_<\t\t\t\t\t\\\n\t\t\t\t\t\t\tValue_Type,\t\\\n\t\t\t\t\t\t\tCmp_Fn,\t\t\\\n\t\t\t\t\t\t\tNode_Metadata,\t\\\n\t\t\t\t\t\t\tAllocator,\t\\\n\t\t\t\t\t\t\tSingle_Link_Roots>\n#else \n#define PB_DS_CLASS_C_DEC\t\t\t\t\t\t\\\n    left_child_next_sibling_heap_<\t\t\t\t\t\\\n\t\t\t\t\t\t\tValue_Type,\t\\\n\t\t\t\t\t\t\tCmp_Fn,\t\t\\\n\t\t\t\t\t\t\tNode_Metadata,\t\\\n\t\t\t\t\t\t\tAllocator>\n#endif \n\n    /**\n     * class description = \"Base class for some types of h3ap$\">\n     **/\n#ifdef _GLIBCXX_DEBUG\n    template<typename Value_Type,\n\t     class Cmp_Fn,\n\t     typename Node_Metadata,\n\t     class Allocator,\n\t     bool Single_Link_Roots>\n#else \n    template<typename Value_Type,\n\t     class Cmp_Fn,\n\t     typename Node_Metadata,\n\t     class Allocator>\n#endif \n    class left_child_next_sibling_heap_ : public Cmp_Fn\n    {\n\n    protected:\n      typedef\n      typename Allocator::template rebind<\n      left_child_next_sibling_heap_node_<\n      Value_Type,\n      Node_Metadata,\n      Allocator> >::other\n      node_allocator;\n\n      typedef typename node_allocator::value_type node;\n\n      typedef typename node_allocator::pointer node_pointer;\n\n      typedef typename node_allocator::const_pointer const_node_pointer;\n\n      typedef Node_Metadata node_metadata;\n\n      typedef std::pair< node_pointer, node_pointer> node_pointer_pair;\n\n    private:\n      typedef cond_dealtor< node, Allocator> cond_dealtor_t;\n\n      enum\n\t{\n\t  simple_value = is_simple<Value_Type>::value\n\t};\n\n      typedef integral_constant<int, simple_value> no_throw_copies_t;\n\n    public:\n\n      typedef typename Allocator::size_type size_type;\n\n      typedef typename Allocator::difference_type difference_type;\n\n      typedef Value_Type value_type;\n\n      typedef\n      typename Allocator::template rebind<\n\tvalue_type>::other::pointer\n      pointer;\n\n      typedef\n      typename Allocator::template rebind<\n\tvalue_type>::other::const_pointer\n      const_pointer;\n\n      typedef\n      typename Allocator::template rebind<\n\tvalue_type>::other::reference\n      reference;\n\n      typedef\n      typename Allocator::template rebind<\n\tvalue_type>::other::const_reference\n      const_reference;\n\n      typedef\n      left_child_next_sibling_heap_node_const_point_iterator_<\n\tnode,\n\tAllocator>\n      const_point_iterator;\n\n      typedef const_point_iterator point_iterator;\n\n      typedef\n      left_child_next_sibling_heap_const_iterator_<\n\tnode,\n\tAllocator>\n      const_iterator;\n\n      typedef const_iterator iterator;\n\n      typedef Cmp_Fn cmp_fn;\n\n      typedef Allocator allocator;\n\n    public:\n\n      left_child_next_sibling_heap_();\n\n      left_child_next_sibling_heap_(const Cmp_Fn& r_cmp_fn);\n\n      left_child_next_sibling_heap_(const PB_DS_CLASS_C_DEC& other);\n\n      void\n      swap(PB_DS_CLASS_C_DEC& other);\n\n      ~left_child_next_sibling_heap_();\n\n      inline bool\n      empty() const;\n\n      inline size_type\n      size() const;\n\n      inline size_type\n      max_size() const;\n\n      Cmp_Fn& \n      get_cmp_fn();\n\n      const Cmp_Fn& \n      get_cmp_fn() const;\n\n      inline iterator\n      begin();\n\n      inline const_iterator\n      begin() const;\n\n      inline iterator\n      end();\n\n      inline const_iterator\n      end() const;\n\n      void\n      clear();\n\n#ifdef PB_DS_LC_NS_HEAP_TRACE_\n      void\n      trace() const;\n#endif \n\n    protected:\n\n      inline node_pointer\n      get_new_node_for_insert(const_reference r_val);\n\n      inline static void\n      make_child_of(node_pointer p_nd, node_pointer p_new_parent);\n\n      void\n      value_swap(PB_DS_CLASS_C_DEC& other);\n\n      inline static node_pointer\n      parent(node_pointer p_nd);\n\n      inline void\n      swap_with_parent(node_pointer p_nd, node_pointer p_parent);\n\n      void\n      bubble_to_top(node_pointer p_nd);\n\n      inline void\n      actual_erase_node(node_pointer p_nd);\n\n      void\n      clear_imp(node_pointer p_nd);\n\n      void\n      to_linked_list();\n\n      template<typename Pred>\n      node_pointer\n      prune(Pred pred);\n\n#ifdef _GLIBCXX_DEBUG\n      void\n      assert_valid() const;\n\n      void\n      assert_node_consistent(const_node_pointer p_nd, bool single_link) const;\n\n      static size_type\n      size_under_node(const_node_pointer p_nd);\n\n      static size_type\n      degree(const_node_pointer p_nd);\n#endif \n\n#ifdef PB_DS_LC_NS_HEAP_TRACE_\n      static void\n      trace_node(const_node_pointer, size_type level);\n#endif \n\n    protected:\n      node_pointer m_p_root;\n\n      size_type m_size;\n\n    private:\n#ifdef _GLIBCXX_DEBUG\n      void\n      assert_iterators() const;\n\n      void\n      assert_size() const;\n\n      static size_type\n      size_from_node(const_node_pointer p_nd);\n#endif \n\n      node_pointer\n      recursive_copy_node(const_node_pointer p_nd);\n\n      inline node_pointer\n      get_new_node_for_insert(const_reference r_val, false_type);\n\n      inline node_pointer\n      get_new_node_for_insert(const_reference r_val, true_type);\n\n#ifdef PB_DS_LC_NS_HEAP_TRACE_\n      template<typename Metadata_>\n      static void\n      trace_node_metadata(const_node_pointer p_nd, type_to_type<Metadata_>);\n\n      static void\n      trace_node_metadata(const_node_pointer, type_to_type<null_left_child_next_sibling_heap_node_metadata>);\n#endif \n\n    private:\n      static node_allocator s_node_allocator;\n\n      static no_throw_copies_t s_no_throw_copies_ind;\n    };\n\n#include <ext/pb_ds/detail/left_child_next_sibling_heap_/constructors_destructor_fn_imps.hpp>\n#include <ext/pb_ds/detail/left_child_next_sibling_heap_/iterators_fn_imps.hpp>\n#include <ext/pb_ds/detail/left_child_next_sibling_heap_/debug_fn_imps.hpp>\n#include <ext/pb_ds/detail/left_child_next_sibling_heap_/trace_fn_imps.hpp>\n#include <ext/pb_ds/detail/left_child_next_sibling_heap_/insert_fn_imps.hpp>\n#include <ext/pb_ds/detail/left_child_next_sibling_heap_/erase_fn_imps.hpp>\n#include <ext/pb_ds/detail/left_child_next_sibling_heap_/info_fn_imps.hpp>\n#include <ext/pb_ds/detail/left_child_next_sibling_heap_/policy_access_fn_imps.hpp>\n\n#undef PB_DS_CLASS_C_DEC\n#undef PB_DS_CLASS_T_DEC\n\n  } // namespace detail\n} // namespace pb_ds\n\n#endif \n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/detail/left_child_next_sibling_heap_/node.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file node.hpp\n * Contains an implementation struct for this type of heap's node.\n */\n\n#ifndef PB_DS_LEFT_CHILD_NEXT_SIBLING_HEAP_NODE_HPP\n#define PB_DS_LEFT_CHILD_NEXT_SIBLING_HEAP_NODE_HPP\n\n#include <ext/pb_ds/detail/left_child_next_sibling_heap_/null_metadata.hpp>\n\nnamespace pb_ds\n{\n  namespace detail\n  {\n\n    template<typename Value_Type, typename Metadata_Type, class Allocator>\n    struct left_child_next_sibling_heap_node_\n    {\n    private:\n      typedef\n      left_child_next_sibling_heap_node_<\n      Value_Type,\n      Metadata_Type,\n      Allocator>\n      this_type;\n\n    public:\n      typedef typename Allocator::size_type size_type;\n\n      typedef\n      typename Allocator::template rebind<\n\tthis_type>::other::pointer\n      node_pointer;\n\n      typedef Value_Type value_type;\n\n      typedef Metadata_Type metadata_type;\n\n    public:\n      value_type m_value;\n\n      metadata_type m_metadata;\n\n      node_pointer m_p_l_child;\n\n      node_pointer m_p_next_sibling;\n\n      node_pointer m_p_prev_or_parent;\n    };\n\n    template<typename Value_Type, class Allocator>\n    struct left_child_next_sibling_heap_node_<\n      Value_Type,\n      null_left_child_next_sibling_heap_node_metadata,\n      Allocator>\n    {\n    private:\n      typedef\n      left_child_next_sibling_heap_node_<\n      Value_Type,\n      null_left_child_next_sibling_heap_node_metadata,\n      Allocator>\n      this_type;\n\n    public:\n      typedef typename Allocator::size_type size_type;\n\n      typedef\n      typename Allocator::template rebind<\n\tthis_type>::other::pointer\n      node_pointer;\n\n      typedef Value_Type value_type;\n\n    public:\n      value_type m_value;\n\n      node_pointer m_p_l_child;\n\n      node_pointer m_p_next_sibling;\n\n      node_pointer m_p_prev_or_parent;\n    };\n\n  } // namespace detail\n} // namespace pb_ds\n\n#endif // #ifndef PB_DS_LEFT_CHILD_NEXT_SIBLING_HEAP_NODE_HPP\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/detail/left_child_next_sibling_heap_/null_metadata.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file null_metadata.hpp\n * Contains an implementation struct for this type of heap's node.\n */\n\n#ifndef PB_DS_LEFT_CHILD_NEXT_SIBLING_HEAP_NULL_METADATA_HPP\n#define PB_DS_LEFT_CHILD_NEXT_SIBLING_HEAP_NULL_METADATA_HPP\n\n#include <ext/pb_ds/detail/left_child_next_sibling_heap_/null_metadata.hpp>\n\nnamespace pb_ds\n{\n  namespace detail\n  {\n\n    struct null_left_child_next_sibling_heap_node_metadata\n    { };\n\n  } // namespace detail\n} // namespace pb_ds\n\n#endif // #ifndef PB_DS_LEFT_CHILD_NEXT_SIBLING_HEAP_NULL_METADATA_HPP\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/detail/left_child_next_sibling_heap_/policy_access_fn_imps.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file policy_access_fn_imps.hpp\n * Contains an implementation class for left_child_next_sibling_heap_.\n */\n\nPB_DS_CLASS_T_DEC\nCmp_Fn& \nPB_DS_CLASS_C_DEC::\nget_cmp_fn()\n{\n  return (*this);\n}\n\nPB_DS_CLASS_T_DEC\nconst Cmp_Fn& \nPB_DS_CLASS_C_DEC::\nget_cmp_fn() const\n{\n  return (*this);\n}\n\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/detail/left_child_next_sibling_heap_/trace_fn_imps.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file trace_fn_imps.hpp\n * Contains an implementation class for left_child_next_sibling_heap_.\n */\n\n#ifdef PB_DS_LC_NS_HEAP_TRACE_\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\ntrace() const\n{\n  std::cerr << std::endl;\n\n  trace_node(m_p_root, 0);\n\n  std::cerr << std::endl;\n}\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\ntrace_node(const_node_pointer p_nd, size_type level)\n{\n  while (p_nd != NULL)\n    {\n      for (size_type i = 0; i < level; ++i)\n\tstd::cerr << ' ';\n\n      std::cerr << p_nd <<\n\t\" prev = \" << p_nd->m_p_prev_or_parent <<\n\t\" next \" << p_nd->m_p_next_sibling <<\n\t\" left = \" << p_nd->m_p_l_child << \" \";\n\n      trace_node_metadata(p_nd, type_to_type<node_metadata>());\n\n      std::cerr << p_nd->m_value << std::endl;\n\n      trace_node(p_nd->m_p_l_child, level + 1);\n\n      p_nd = p_nd->m_p_next_sibling;\n    }\n}\n\nPB_DS_CLASS_T_DEC\ntemplate<typename Metadata_>\nvoid\nPB_DS_CLASS_C_DEC::\ntrace_node_metadata(const_node_pointer p_nd, type_to_type<Metadata_>)\n{\n  std::cerr << \"(\" << p_nd->m_metadata << \") \";\n}\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\ntrace_node_metadata(const_node_pointer, type_to_type<null_left_child_next_sibling_heap_node_metadata>)\n{ }\n\n#endif // #ifdef PB_DS_LC_NS_HEAP_TRACE_\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/detail/list_update_map_/constructor_destructor_fn_imps.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file constructor_destructor_fn_imps.hpp\n * Contains implementations of PB_DS_CLASS_NAME.\n */\n\nPB_DS_CLASS_T_DEC\ntypename PB_DS_CLASS_C_DEC::entry_allocator\nPB_DS_CLASS_C_DEC::s_entry_allocator;\n\nPB_DS_CLASS_T_DEC\nEq_Fn PB_DS_CLASS_C_DEC::s_eq_fn;\n\nPB_DS_CLASS_T_DEC\nnull_lu_metadata PB_DS_CLASS_C_DEC::s_null_lu_metadata;\n\nPB_DS_CLASS_T_DEC\nUpdate_Policy PB_DS_CLASS_C_DEC::s_update_policy;\n\nPB_DS_CLASS_T_DEC\ntype_to_type<\n  typename PB_DS_CLASS_C_DEC::update_metadata> PB_DS_CLASS_C_DEC::s_metadata_type_indicator;\n\nPB_DS_CLASS_T_DEC\ntemplate<typename It>\nvoid\nPB_DS_CLASS_C_DEC::\ncopy_from_range(It first_it, It last_it)\n{\n  while (first_it != last_it)\n    insert(*(first_it++));\n}\n\nPB_DS_CLASS_T_DEC\nPB_DS_CLASS_C_DEC::\nPB_DS_CLASS_NAME() : m_p_l(NULL)\n{ _GLIBCXX_DEBUG_ONLY(assert_valid();) }\n\nPB_DS_CLASS_T_DEC\ntemplate<typename It>\nPB_DS_CLASS_C_DEC::\nPB_DS_CLASS_NAME(It first_it, It last_it) : m_p_l(NULL)\n{\n  copy_from_range(first_it, last_it);\n  _GLIBCXX_DEBUG_ONLY(assert_valid(););\n}\n\nPB_DS_CLASS_T_DEC\nPB_DS_CLASS_C_DEC::\nPB_DS_CLASS_NAME(const PB_DS_CLASS_C_DEC& other) : \n#ifdef _GLIBCXX_DEBUG\n  map_debug_base(),\n#endif\nm_p_l(NULL)\n{\n  try\n    {\n      for (const_iterator it = other.begin(); it != other.end(); ++it)\n        {\n\t  entry_pointer p_l = allocate_new_entry(*it, \n\t\t\tPB_DS_TYPES_TRAITS_C_DEC::m_no_throw_copies_indicator);\n\n\t  p_l->m_p_next = m_p_l;\n\t  m_p_l = p_l;\n        }\n    }\n  catch(...)\n    {\n      deallocate_all();\n      __throw_exception_again;\n    }\n  _GLIBCXX_DEBUG_ONLY(assert_valid();)\n}\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nswap(PB_DS_CLASS_C_DEC& other)\n{\n  _GLIBCXX_DEBUG_ONLY(assert_valid();)\n  _GLIBCXX_DEBUG_ONLY(other.assert_valid();)\n  _GLIBCXX_DEBUG_ONLY(map_debug_base::swap(other);)\n  std::swap(m_p_l, other.m_p_l);\n  _GLIBCXX_DEBUG_ONLY(assert_valid();)\n  _GLIBCXX_DEBUG_ONLY(other.assert_valid();)\n}\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\ndeallocate_all()\n{\n  entry_pointer p_l = m_p_l;\n  while (p_l != NULL)\n    {\n      entry_pointer p_next_l = p_l->m_p_next;\n      actual_erase_entry(p_l);\n      p_l = p_next_l;\n    }\n  m_p_l = NULL;\n}\n\nPB_DS_CLASS_T_DEC\nPB_DS_CLASS_C_DEC::\n~PB_DS_CLASS_NAME()\n{ deallocate_all(); }\n\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/detail/list_update_map_/debug_fn_imps.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file debug_fn_imps.hpp\n * Contains implementations of cc_ht_map_'s debug-mode functions.\n */\n\n#ifdef _GLIBCXX_DEBUG\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nassert_valid() const\n{\n  size_type calc_size = 0;\n  for (const_iterator it = begin(); it != end(); ++it)\n    {\n      map_debug_base::check_key_exists(PB_DS_V2F(*it));\n      ++calc_size;\n    }\n  map_debug_base::check_size(calc_size);\n}\n\n#endif \n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/detail/list_update_map_/entry_metadata_base.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file entry_metadata_base.hpp\n * Contains an implementation for a list update map.\n */\n\n#ifndef PB_DS_LU_MAP_ENTRY_METADATA_BASE_HPP\n#define PB_DS_LU_MAP_ENTRY_METADATA_BASE_HPP\n\nnamespace pb_ds\n{\n  namespace detail\n  {\n    template<typename Metadata>\n    struct lu_map_entry_metadata_base\n    {\n      Metadata m_update_metadata;\n    };\n    \n    template<>\n    struct lu_map_entry_metadata_base<null_lu_metadata>\n    { };  \n  } // namespace detail\n} // namespace pb_ds\n\n#endif \n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/detail/list_update_map_/erase_fn_imps.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file erase_fn_imps.hpp\n * Contains implementations of lu_map_.\n */\n\nPB_DS_CLASS_T_DEC\ninline bool\nPB_DS_CLASS_C_DEC::\nerase(const_key_reference r_key)\n{\n  _GLIBCXX_DEBUG_ONLY(PB_DS_CLASS_C_DEC::assert_valid();)\n  if (m_p_l == NULL)\n    return false;\n\n  if (s_eq_fn(r_key, PB_DS_V2F(m_p_l->m_value)))\n    {\n      entry_pointer p_next = m_p_l->m_p_next;\n      actual_erase_entry(m_p_l);\n      m_p_l = p_next;\n      return true;\n    }\n\n  entry_pointer p_l = m_p_l;\n  while (p_l->m_p_next != NULL)\n    if (s_eq_fn(r_key, PB_DS_V2F(p_l->m_p_next->m_value)))\n      {\n\terase_next(p_l);\n\treturn true;\n      }\n    else\n      p_l = p_l->m_p_next;\n  return false;\n}\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nclear()\n{\n  deallocate_all();\n}\n\nPB_DS_CLASS_T_DEC\ntemplate<typename Pred>\ninline typename PB_DS_CLASS_C_DEC::size_type\nPB_DS_CLASS_C_DEC::\nerase_if(Pred pred)\n{\n  _GLIBCXX_DEBUG_ONLY(PB_DS_CLASS_C_DEC::assert_valid();)\n  size_type num_ersd = 0;\n  while (m_p_l != NULL && pred(m_p_l->m_value))\n    {\n      entry_pointer p_next = m_p_l->m_p_next;\n      ++num_ersd;\n      actual_erase_entry(m_p_l);\n      m_p_l = p_next;\n    }\n\n  if (m_p_l == NULL)\n    return num_ersd;\n\n  entry_pointer p_l = m_p_l;\n  while (p_l->m_p_next != NULL)\n    {\n      if (pred(p_l->m_p_next->m_value))\n        {\n\t  ++num_ersd;\n\t  erase_next(p_l);\n        }\n      else\n\tp_l = p_l->m_p_next;\n    }\n\n  _GLIBCXX_DEBUG_ONLY(PB_DS_CLASS_C_DEC::assert_valid();)\n  return num_ersd;\n}\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nerase_next(entry_pointer p_l)\n{\n  _GLIBCXX_DEBUG_ASSERT(p_l != NULL);\n  _GLIBCXX_DEBUG_ASSERT(p_l != m_p_l);\n  _GLIBCXX_DEBUG_ASSERT(p_l->m_p_next != NULL);\n  entry_pointer p_next_l = p_l->m_p_next->m_p_next;\n  actual_erase_entry(p_l->m_p_next);\n  p_l->m_p_next = p_next_l;\n}\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nactual_erase_entry(entry_pointer p_l)\n{\n  _GLIBCXX_DEBUG_ONLY(map_debug_base::erase_existing(PB_DS_V2F(p_l->m_value));)\n  p_l->~entry();\n  s_entry_allocator.deallocate(p_l, 1);\n}\n\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/detail/list_update_map_/find_fn_imps.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file find_fn_imps.hpp\n * Contains implementations of lu_map_.\n */\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::entry_pointer\nPB_DS_CLASS_C_DEC::\nfind_imp(const_key_reference r_key) const\n{\n  if (m_p_l == NULL)\n    return NULL;\n  if (s_eq_fn(r_key, PB_DS_V2F(m_p_l->m_value)))\n    {\n      apply_update(m_p_l, s_metadata_type_indicator);\n      _GLIBCXX_DEBUG_ONLY(map_debug_base::check_key_exists(r_key);)\n      return m_p_l;\n    }\n\n  entry_pointer p_l = m_p_l;\n  while (p_l->m_p_next != NULL)\n    {\n      entry_pointer p_next = p_l->m_p_next;\n      if (s_eq_fn(r_key, PB_DS_V2F(p_next->m_value)))\n        {\n\t  if (apply_update(p_next, s_metadata_type_indicator))\n            {\n\t      p_l->m_p_next = p_next->m_p_next;\n\t      p_next->m_p_next = m_p_l;\n\t      m_p_l = p_next;\n\t      return m_p_l;\n            }\n\t  return p_next;\n        }\n      else\n\tp_l = p_next;\n    }\n\n  _GLIBCXX_DEBUG_ONLY(map_debug_base::check_key_does_not_exist(r_key);)\n  return NULL;\n}\n\nPB_DS_CLASS_T_DEC\ntemplate<typename Metadata>\ninline bool\nPB_DS_CLASS_C_DEC::\napply_update(entry_pointer p_l, type_to_type<Metadata>)\n{ return s_update_policy(p_l->m_update_metadata); }\n\nPB_DS_CLASS_T_DEC\ninline bool\nPB_DS_CLASS_C_DEC::\napply_update(entry_pointer, type_to_type<null_lu_metadata>)\n{ return s_update_policy(s_null_lu_metadata); }\n\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/detail/list_update_map_/info_fn_imps.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file info_fn_imps.hpp\n * Contains implementations of lu_map_.\n */\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::size_type\nPB_DS_CLASS_C_DEC::\nsize() const\n{ return std::distance(begin(), end()); }\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::size_type\nPB_DS_CLASS_C_DEC::\nmax_size() const\n{ return s_entry_allocator.max_size(); }\n\nPB_DS_CLASS_T_DEC\ninline bool\nPB_DS_CLASS_C_DEC::\nempty() const\n{ return (m_p_l == NULL); }\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/detail/list_update_map_/insert_fn_imps.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file insert_fn_imps.hpp\n * Contains implementations of lu_map_.\n */\n\nPB_DS_CLASS_T_DEC\ninline std::pair<\n  typename PB_DS_CLASS_C_DEC::point_iterator,\n  bool>\nPB_DS_CLASS_C_DEC::\ninsert(const_reference r_val)\n{\n  _GLIBCXX_DEBUG_ONLY(assert_valid();)\n  entry_pointer p_l = find_imp(PB_DS_V2F(r_val));\n\n  if (p_l != NULL)\n    {\n      _GLIBCXX_DEBUG_ONLY(map_debug_base::check_key_exists(PB_DS_V2F(r_val));)\n      return std::make_pair(point_iterator(&p_l->m_value), false);\n    }\n\n  _GLIBCXX_DEBUG_ONLY(map_debug_base::check_key_does_not_exist(PB_DS_V2F(r_val));)\n\n  p_l = allocate_new_entry(r_val, traits_base::m_no_throw_copies_indicator);\n  p_l->m_p_next = m_p_l;\n  m_p_l = p_l;\n  _GLIBCXX_DEBUG_ONLY(assert_valid();)\n  return std::make_pair(point_iterator(&p_l->m_value), true);\n}\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::entry_pointer\nPB_DS_CLASS_C_DEC::\nallocate_new_entry(const_reference r_val, false_type)\n{\n  entry_pointer p_l = s_entry_allocator.allocate(1);\n  cond_dealtor_t cond(p_l);\n  new (const_cast<void* >(static_cast<const void* >(&p_l->m_value)))\n    value_type(r_val);\n\n  cond.set_no_action();\n  _GLIBCXX_DEBUG_ONLY(map_debug_base::insert_new(PB_DS_V2F(r_val));)\n  init_entry_metadata(p_l, s_metadata_type_indicator);\n  return p_l;\n}\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::entry_pointer\nPB_DS_CLASS_C_DEC::\nallocate_new_entry(const_reference    r_val, true_type)\n{\n  entry_pointer p_l = s_entry_allocator.allocate(1);\n  new (&p_l->m_value) value_type(r_val);\n  _GLIBCXX_DEBUG_ONLY(map_debug_base::insert_new(PB_DS_V2F(r_val));)\n  init_entry_metadata(p_l, s_metadata_type_indicator);\n  return p_l;\n}\n\nPB_DS_CLASS_T_DEC\ntemplate<typename Metadata>\ninline void\nPB_DS_CLASS_C_DEC::\ninit_entry_metadata(entry_pointer p_l, type_to_type<Metadata>)\n{ new (&p_l->m_update_metadata) Metadata(s_update_policy()); }\n\nPB_DS_CLASS_T_DEC\ninline void\nPB_DS_CLASS_C_DEC::\ninit_entry_metadata(entry_pointer, type_to_type<null_lu_metadata>)\n{ }\n\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/detail/list_update_map_/iterators_fn_imps.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file iterators_fn_imps.hpp\n * Contains implementations of lu_map_.\n */\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::iterator\nPB_DS_CLASS_C_DEC::\nbegin()\n{\n  if (m_p_l == NULL)\n    {\n      _GLIBCXX_DEBUG_ASSERT(empty());\n      return end();\n    }\n  return iterator(&m_p_l->m_value, m_p_l, this);\n}\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::const_iterator\nPB_DS_CLASS_C_DEC::\nbegin() const\n{\n  if (m_p_l == NULL)\n    {\n      _GLIBCXX_DEBUG_ASSERT(empty());\n      return end();\n    }\n  return iterator(&m_p_l->m_value, m_p_l, const_cast<PB_DS_CLASS_C_DEC* >(this));\n}\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::iterator\nPB_DS_CLASS_C_DEC::\nend()\n{ return iterator(NULL, NULL, this); }\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::const_iterator\nPB_DS_CLASS_C_DEC::\nend() const\n{\n  return const_iterator(NULL, NULL, const_cast<PB_DS_CLASS_C_DEC* const>(this));\n}\n\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/detail/list_update_map_/lu_map_.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file lu_map_.hpp\n * Contains a list update map.\n */\n\n#include <utility>\n#include <iterator>\n#include <ext/pb_ds/detail/cond_dealtor.hpp>\n#include <ext/pb_ds/tag_and_trait.hpp>\n#include <ext/pb_ds/detail/types_traits.hpp>\n#include <ext/pb_ds/detail/list_update_map_/entry_metadata_base.hpp>\n#include <ext/pb_ds/exception.hpp>\n#ifdef _GLIBCXX_DEBUG\n#include <ext/pb_ds/detail/map_debug_base.hpp>\n#endif \n#ifdef PB_DS_LU_MAP_TRACE_\n#include <iostream>\n#endif \n#include <debug/debug.h>\n\nnamespace pb_ds\n{\n  namespace detail\n  {\n#define PB_DS_CLASS_T_DEC \\\n    template<typename Key, typename Mapped, class Eq_Fn, \\\n\t     class Allocator, class Update_Policy>\n\n#ifdef PB_DS_DATA_TRUE_INDICATOR\n#define PB_DS_CLASS_NAME lu_map_data_\n#endif \n\n#ifdef PB_DS_DATA_FALSE_INDICATOR\n#define PB_DS_CLASS_NAME lu_map_no_data_\n#endif \n\n#define PB_DS_CLASS_C_DEC \\\n    PB_DS_CLASS_NAME<Key, Mapped, Eq_Fn, Allocator, Update_Policy>\n\n#define PB_DS_TYPES_TRAITS_C_DEC \\\n    types_traits<Key, Mapped, Allocator, false>\n\n#ifdef _GLIBCXX_DEBUG\n#define PB_DS_MAP_DEBUG_BASE_C_DEC \\\n    map_debug_base<Key, Eq_Fn, \\\n\t      typename Allocator::template rebind<Key>::other::const_reference>\n#endif \n\n#ifdef PB_DS_DATA_TRUE_INDICATOR\n#define PB_DS_V2F(X) (X).first\n#define PB_DS_V2S(X) (X).second\n#define PB_DS_EP2VP(X)& ((X)->m_value)\n#endif \n\n#ifdef PB_DS_DATA_FALSE_INDICATOR\n#define PB_DS_V2F(X) (X)\n#define PB_DS_V2S(X) Mapped_Data()\n#define PB_DS_EP2VP(X)& ((X)->m_value.first)\n#endif \n\n    /* Skip to the lu, my darling. */\n    // list-based (with updates) associative container.\n    template<typename Key,\n\t     typename Mapped,\n\t     class Eq_Fn,\n\t     class Allocator,\n\t     class Update_Policy>\n    class PB_DS_CLASS_NAME :\n#ifdef _GLIBCXX_DEBUG\n      protected PB_DS_MAP_DEBUG_BASE_C_DEC,\n#endif \n      public PB_DS_TYPES_TRAITS_C_DEC\n    {\n    private:\n      typedef PB_DS_TYPES_TRAITS_C_DEC traits_base;\n\n      struct entry \n     : public lu_map_entry_metadata_base<typename Update_Policy::metadata_type>\n      {\n\ttypename traits_base::value_type m_value;\n\ttypename Allocator::template rebind<entry>::other::pointer m_p_next;\n      };\n\n      typedef typename Allocator::template rebind<entry>::other entry_allocator;\n      typedef typename entry_allocator::pointer entry_pointer;\n      typedef typename entry_allocator::const_pointer const_entry_pointer;\n      typedef typename entry_allocator::reference entry_reference;\n      typedef typename entry_allocator::const_reference const_entry_reference;\n\n      typedef typename Allocator::template rebind<entry_pointer>::other entry_pointer_allocator;\n      typedef typename entry_pointer_allocator::pointer entry_pointer_array;\n\n      typedef typename traits_base::value_type value_type_;\n      typedef typename traits_base::pointer pointer_;\n      typedef typename traits_base::const_pointer const_pointer_;\n      typedef typename traits_base::reference reference_;\n      typedef typename traits_base::const_reference const_reference_;\n\n#define PB_DS_GEN_POS entry_pointer\n\n#include <ext/pb_ds/detail/unordered_iterator/const_point_iterator.hpp>\n#include <ext/pb_ds/detail/unordered_iterator/point_iterator.hpp>\n#include <ext/pb_ds/detail/unordered_iterator/const_iterator.hpp>\n#include <ext/pb_ds/detail/unordered_iterator/iterator.hpp>\n\n#undef PB_DS_GEN_POS\n\n\n#ifdef _GLIBCXX_DEBUG\n      typedef PB_DS_MAP_DEBUG_BASE_C_DEC map_debug_base;\n#endif \n\n      typedef cond_dealtor<entry, Allocator> cond_dealtor_t;\n\n    public:\n      typedef Allocator allocator;\n      typedef typename Allocator::size_type size_type;\n      typedef typename Allocator::difference_type difference_type;\n      typedef Eq_Fn eq_fn;\n      typedef Update_Policy update_policy;\n      typedef typename Update_Policy::metadata_type update_metadata;\n      typedef typename traits_base::key_type key_type;\n      typedef typename traits_base::key_pointer key_pointer;\n      typedef typename traits_base::const_key_pointer const_key_pointer;\n      typedef typename traits_base::key_reference key_reference;\n      typedef typename traits_base::const_key_reference const_key_reference;\n      typedef typename traits_base::mapped_type mapped_type;\n      typedef typename traits_base::mapped_pointer mapped_pointer;\n      typedef typename traits_base::const_mapped_pointer const_mapped_pointer;\n      typedef typename traits_base::mapped_reference mapped_reference;\n      typedef typename traits_base::const_mapped_reference const_mapped_reference;\n      typedef typename traits_base::value_type value_type;\n      typedef typename traits_base::pointer pointer;\n      typedef typename traits_base::const_pointer const_pointer;\n      typedef typename traits_base::reference reference;\n      typedef typename traits_base::const_reference const_reference;\n\n#ifdef PB_DS_DATA_TRUE_INDICATOR\n      typedef point_iterator_ point_iterator;\n#endif \n\n#ifdef PB_DS_DATA_FALSE_INDICATOR\n      typedef const_point_iterator_ point_iterator;\n#endif \n\n      typedef const_point_iterator_ const_point_iterator;\n\n#ifdef PB_DS_DATA_TRUE_INDICATOR\n      typedef iterator_ iterator;\n#endif \n\n#ifdef PB_DS_DATA_FALSE_INDICATOR\n      typedef const_iterator_ iterator;\n#endif \n\n      typedef const_iterator_ const_iterator;\n\n    public:\n      PB_DS_CLASS_NAME();\n\n      PB_DS_CLASS_NAME(const PB_DS_CLASS_C_DEC&);\n\n      virtual\n      ~PB_DS_CLASS_NAME();\n\n      template<typename It>\n      PB_DS_CLASS_NAME(It first_it, It last_it);\n\n      void\n      swap(PB_DS_CLASS_C_DEC&);\n\n      inline size_type\n      size() const;\n\n      inline size_type\n      max_size() const;\n\n      inline bool\n      empty() const;\n\n      inline mapped_reference\n      operator[](const_key_reference r_key)\n      {\n#ifdef PB_DS_DATA_TRUE_INDICATOR\n\t_GLIBCXX_DEBUG_ONLY(assert_valid();)\n\treturn insert(std::make_pair(r_key, mapped_type())).first->second;\n#else \n\tinsert(r_key);\n\treturn traits_base::s_null_mapped;\n#endif \n      }\n\n      inline std::pair<point_iterator, bool>\n      insert(const_reference);\n\n      inline point_iterator\n      find(const_key_reference r_key)\n      {\n\t_GLIBCXX_DEBUG_ONLY(assert_valid();)\n\tentry_pointer p_e = find_imp(r_key);\n\treturn point_iterator(p_e == NULL ? NULL: &p_e->m_value);\n      }\n\n      inline const_point_iterator\n      find(const_key_reference r_key) const\n      {\n\t_GLIBCXX_DEBUG_ONLY(assert_valid();)\n\tentry_pointer p_e = find_imp(r_key);\n\treturn const_point_iterator(p_e == NULL ? NULL: &p_e->m_value);\n      }\n\n      inline bool\n      erase(const_key_reference);\n\n      template<typename Pred>\n      inline size_type\n      erase_if(Pred);\n\n      void\n      clear();\n\n      inline iterator\n      begin();\n\n      inline const_iterator\n      begin() const;\n\n      inline iterator\n      end();\n\n      inline const_iterator\n      end() const;\n\n#ifdef _GLIBCXX_DEBUG\n      void\n      assert_valid() const;\n#endif \n\n#ifdef PB_DS_LU_MAP_TRACE_\n      void\n      trace() const;\n#endif\n\n    protected:\n\n      template<typename It>\n      void\n      copy_from_range(It, It);\n\n    private:\n#ifdef PB_DS_DATA_TRUE_INDICATOR\n      friend class iterator_;\n#endif \n\n      friend class const_iterator_;\n\n      inline entry_pointer\n      allocate_new_entry(const_reference, false_type);\n\n      inline entry_pointer\n      allocate_new_entry(const_reference, true_type);\n\n      template<typename Metadata>\n      inline static void\n      init_entry_metadata(entry_pointer, type_to_type<Metadata>);\n\n      inline static void\n      init_entry_metadata(entry_pointer, type_to_type<null_lu_metadata>);\n\n      void\n      deallocate_all();\n\n      void\n      erase_next(entry_pointer);\n\n      void\n      actual_erase_entry(entry_pointer);\n\n      void\n      inc_it_state(const_pointer& r_p_value, entry_pointer& r_pos) const\n      {\n\tr_pos = r_pos->m_p_next;\n\tr_p_value = (r_pos == NULL) ? NULL : &r_pos->m_value;\n      }\n\n      template<typename Metadata>\n      inline static bool\n      apply_update(entry_pointer, type_to_type<Metadata>);\n\n      inline static bool\n      apply_update(entry_pointer, type_to_type<null_lu_metadata>);\n\n      inline entry_pointer\n      find_imp(const_key_reference) const;\n\n      static entry_allocator s_entry_allocator;\n      static Eq_Fn s_eq_fn;\n      static Update_Policy s_update_policy;\n      static type_to_type<update_metadata> s_metadata_type_indicator;\n      static null_lu_metadata s_null_lu_metadata;\n\n      mutable entry_pointer m_p_l;\n    };\n\n#include <ext/pb_ds/detail/list_update_map_/constructor_destructor_fn_imps.hpp>\n#include <ext/pb_ds/detail/list_update_map_/info_fn_imps.hpp>\n#include <ext/pb_ds/detail/list_update_map_/debug_fn_imps.hpp>\n#include <ext/pb_ds/detail/list_update_map_/iterators_fn_imps.hpp>\n#include <ext/pb_ds/detail/list_update_map_/erase_fn_imps.hpp>\n#include <ext/pb_ds/detail/list_update_map_/find_fn_imps.hpp>\n#include <ext/pb_ds/detail/list_update_map_/insert_fn_imps.hpp>\n#include <ext/pb_ds/detail/list_update_map_/trace_fn_imps.hpp>\n\n#undef PB_DS_CLASS_T_DEC\n#undef PB_DS_CLASS_C_DEC\n#undef  PB_DS_TYPES_TRAITS_C_DEC\n#undef PB_DS_MAP_DEBUG_BASE_C_DEC\n#undef PB_DS_CLASS_NAME\n#undef PB_DS_V2F\n#undef PB_DS_EP2VP\n#undef PB_DS_V2S\n\n  } // namespace detail\n} // namespace pb_ds\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/detail/list_update_map_/trace_fn_imps.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file trace_fn_imps.hpp\n * Contains implementations of lu_map_.\n */\n\n#ifdef PB_DS_LU_MAP_TRACE_\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\ntrace() const\n{\n  std::cerr << m_p_l << std::endl << std::endl;\n  const_entry_pointer p_l = m_p_l;\n  while (p_l != NULL)\n    {\n      std::cerr << PB_DS_V2F(p_l->m_value) << std::endl;\n      p_l = p_l->m_p_next;\n    }\n  std::cerr << std::endl;\n}\n\n#endif \n\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/detail/list_update_policy/counter_lu_metadata.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file counter_lu_metadata.hpp\n * Contains implementation of a lu counter policy's metadata.\n */\n\nnamespace pb_ds\n{\n  namespace detail\n  {\n    template<typename Size_Type>\n    class counter_lu_policy_base;\n\n    // A list-update metadata type that moves elements to the front of\n    // the list based on the counter algorithm.\n    template<typename Size_Type = size_t>\n    class counter_lu_metadata\n    {\n    public:\n      typedef Size_Type size_type;\n\n    private:\n      counter_lu_metadata(size_type init_count) : m_count(init_count)\n      { }\n\n      friend class counter_lu_policy_base<size_type>;\n\n      mutable size_type m_count;\n    };\n\n    template<typename Size_Type>\n    class counter_lu_policy_base\n    {\n    protected:\n      typedef Size_Type size_type;\n\n      counter_lu_metadata<size_type>\n      operator()(size_type max_size) const\n      { return counter_lu_metadata<Size_Type>(rand() % max_size); }\n\n      template<typename Metadata_Reference>\n      bool\n      operator()(Metadata_Reference r_data, size_type m_max_count) const\n      {\n\tif (++r_data.m_count != m_max_count)\n\t  return false;\n\tr_data.m_count = 0;\n\treturn true;\n      }\n    };\n  } // namespace detail\n} // namespace pb_ds\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/detail/list_update_policy/counter_lu_policy_imp.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file counter_lu_policy_imp.hpp\n * Contains a lu counter policy implementation.\n */\n\nPB_DS_CLASS_T_DEC\ndetail::counter_lu_metadata<typename Allocator::size_type>\nPB_DS_CLASS_C_DEC::\noperator()() const\n{ return (base_type::operator()(max_count)); }\n\nPB_DS_CLASS_T_DEC\nbool\nPB_DS_CLASS_C_DEC::\noperator()(metadata_reference r_data) const\n{ return (base_type::operator()(r_data, max_count)); }\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/detail/list_update_policy/mtf_lu_policy_imp.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file mtf_lu_policy_imp.hpp\n * Contains a move-to-front policy implementation.\n */\n\nPB_DS_CLASS_T_DEC\nnull_lu_metadata PB_DS_CLASS_C_DEC::s_metadata;\n\nPB_DS_CLASS_T_DEC\ntypename PB_DS_CLASS_C_DEC::metadata_type\nPB_DS_CLASS_C_DEC::\noperator()() const\n{ return s_metadata; }\n\nPB_DS_CLASS_T_DEC\ninline bool\nPB_DS_CLASS_C_DEC::\noperator()(metadata_reference /*r_data*/) const\n{ return true; }\n\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/detail/list_update_policy/sample_update_policy.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file sample_update_policy.hpp\n * Contains a sample policy for list update containers.\n */\n\n#ifndef PB_DS_SAMPLE_UPDATE_POLICY_HPP\n#define PB_DS_SAMPLE_UPDATE_POLICY_HPP\n\n// A sample list-update policy.\nstruct sample_update_policy\n{\n  // Default constructor.\n  sample_update_policy();\n\n  // Copy constructor.\n  sample_update_policy(const sample_update_policy&);\n\n  // Swaps content.\n  inline void\n  swap(sample_update_policy& other);\n\nprotected:\n  // Metadata on which this functor operates.\n  typedef some_metadata_type metadata_type;\n\n  // Creates a metadata object.\n  metadata_type\n  operator()() const;\n\n  // Decides whether a metadata object should be moved to the front of\n  // the list. A list-update based containers object will call this\n  // method to decide whether to move a node to the front of the\n  // list. The method shoule return true if the node should be moved\n  // to the front of the list.\n  bool\n  operator()(metadata_reference) const;\n};\n\n#endif \n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/detail/map_debug_base.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n \n/**\n * @file map_debug_base.hpp\n * Contains a debug-mode base for all maps.\n */\n\n#ifndef PB_DS_MAP_DEBUG_BASE_HPP\n#define PB_DS_MAP_DEBUG_BASE_HPP\n\n#ifdef _GLIBCXX_DEBUG\n\n#include <list>\n#include <utility>\n#include <ext/throw_allocator.h>\n#include <debug/debug.h>\n\nnamespace pb_ds\n{\n  namespace detail\n  {\n\n#define PB_DS_CLASS_T_DEC \\\n    template<typename Key, class Eq_Fn, typename Const_Key_Reference>\n\n#define PB_DS_CLASS_C_DEC \\\n    map_debug_base<Key, Eq_Fn, Const_Key_Reference>\n\n    template<typename Key, class Eq_Fn, typename Const_Key_Reference>\n    class map_debug_base\n    {\n    private:\n      typedef typename std::allocator< Key> key_allocator;\n\n      typedef typename key_allocator::size_type size_type;\n\n      typedef Const_Key_Reference const_key_reference;\n\n    protected:\n      map_debug_base();\n\n      map_debug_base(const PB_DS_CLASS_C_DEC& other);\n\n      ~map_debug_base();\n\n      inline void\n      insert_new(const_key_reference r_key);\n\n      inline void\n      erase_existing(const_key_reference r_key);\n\n      void\n      clear();\n\n      inline void\n      check_key_exists(const_key_reference r_key) const;\n\n      inline void\n      check_key_does_not_exist(const_key_reference r_key) const;\n\n      inline void\n      check_size(size_type size) const;\n\n      void\n      swap(PB_DS_CLASS_C_DEC& other);\n\n      template<typename Cmp_Fn>\n      void\n      split(const_key_reference, Cmp_Fn, PB_DS_CLASS_C_DEC&);\n\n      void\n      join(PB_DS_CLASS_C_DEC& other);\n\n    private:\n      typedef std::list< Key> \t\t\tkey_set;\n      typedef typename key_set::iterator \tkey_set_iterator;\n      typedef typename key_set::const_iterator \tconst_key_set_iterator;\n\n#ifdef _GLIBCXX_DEBUG\n      void\n      assert_valid() const;\n#endif \n\n      const_key_set_iterator\n      find(const_key_reference r_key) const;\n\n      key_set_iterator\n      find(const_key_reference r_key);\n\n      key_set \tm_key_set;\n      Eq_Fn \tm_eq;\n    };\n\n    PB_DS_CLASS_T_DEC\n    PB_DS_CLASS_C_DEC::\n    map_debug_base()\n    { _GLIBCXX_DEBUG_ONLY(assert_valid();) }\n\n    PB_DS_CLASS_T_DEC\n    PB_DS_CLASS_C_DEC::\n    map_debug_base(const PB_DS_CLASS_C_DEC& other) : m_key_set(other.m_key_set)\n    { _GLIBCXX_DEBUG_ONLY(assert_valid();) }\n\n    PB_DS_CLASS_T_DEC\n    PB_DS_CLASS_C_DEC::\n    ~map_debug_base()\n    { _GLIBCXX_DEBUG_ONLY(assert_valid();) }\n\n    PB_DS_CLASS_T_DEC\n    inline void\n    PB_DS_CLASS_C_DEC::\n    insert_new(const_key_reference r_key)\n    {\n      _GLIBCXX_DEBUG_ONLY(assert_valid();)\n      __gnu_cxx::throw_allocator<char> alloc;\n      const double orig_throw_prob = alloc.get_throw_prob();\n      alloc.set_throw_prob(0);\n      if (find(r_key) != m_key_set.end())\n\t{\n\t  std::cerr << \"insert_new \" << r_key << std::endl;\n\t  abort();\n\t}\n\n      try\n\t{\n\t  m_key_set.push_back(r_key);\n\t}\n      catch(...)\n\t{\n\t  std::cerr << \"insert_new 1\" << r_key << std::endl;\n\t  abort();\n\t}\n      alloc.set_throw_prob(orig_throw_prob);\n      _GLIBCXX_DEBUG_ONLY(assert_valid();)\n    }\n\n    PB_DS_CLASS_T_DEC\n    inline void\n    PB_DS_CLASS_C_DEC::\n    erase_existing(const_key_reference r_key)\n    {\n      _GLIBCXX_DEBUG_ONLY(assert_valid();)\n      key_set_iterator it = find(r_key);\n      if (it == m_key_set.end())\n\t{\n\t  std::cerr << \"erase_existing \" << r_key << std::endl;\n\t  abort();\n\t}\n      m_key_set.erase(it);\n      _GLIBCXX_DEBUG_ONLY(assert_valid();)\n    }\n\n    PB_DS_CLASS_T_DEC\n    void\n    PB_DS_CLASS_C_DEC::\n    clear()\n    {\n      _GLIBCXX_DEBUG_ONLY(assert_valid();)\n      m_key_set.clear();\n      _GLIBCXX_DEBUG_ONLY(assert_valid();)\n    }\n\n    PB_DS_CLASS_T_DEC\n    inline void\n    PB_DS_CLASS_C_DEC::\n    check_key_exists(const_key_reference r_key) const\n    {\n      _GLIBCXX_DEBUG_ONLY(assert_valid();)\n      if (find(r_key) == m_key_set.end())\n        {\n          std::cerr << \"check_key_exists \" << r_key << std::endl;\n          abort();\n        }\n      _GLIBCXX_DEBUG_ONLY(assert_valid();)\n    }\n\n    PB_DS_CLASS_T_DEC\n    inline void\n    PB_DS_CLASS_C_DEC::\n    check_key_does_not_exist(const_key_reference r_key) const\n    {\n      _GLIBCXX_DEBUG_ONLY(assert_valid();)\n      if (find(r_key) != m_key_set.end())\n        {\n\t  std::cerr << \"check_key_does_not_exist \" << r_key << std::endl;\n          abort();\n        }\n    }\n\n    PB_DS_CLASS_T_DEC\n    inline void\n    PB_DS_CLASS_C_DEC::\n    check_size(size_type size) const\n    {\n      _GLIBCXX_DEBUG_ONLY(assert_valid();)\n      const size_type key_set_size = m_key_set.size();\n      if (size != key_set_size)\n\t{\n\t  std::cerr << \"check_size \" << size \n\t\t    << \" \" << key_set_size << std::endl;\n\t  abort();\n\t}\n      _GLIBCXX_DEBUG_ONLY(assert_valid();)\n     }\n\n    PB_DS_CLASS_T_DEC\n    void\n    PB_DS_CLASS_C_DEC::\n    swap(PB_DS_CLASS_C_DEC& other)\n    {\n      _GLIBCXX_DEBUG_ONLY(assert_valid();)\n      m_key_set.swap(other.m_key_set);\n      _GLIBCXX_DEBUG_ONLY(assert_valid();)\n    }\n\n    PB_DS_CLASS_T_DEC\n    typename PB_DS_CLASS_C_DEC::const_key_set_iterator\n    PB_DS_CLASS_C_DEC::\n    find(const_key_reference r_key) const\n    {\n      _GLIBCXX_DEBUG_ONLY(assert_valid();)\n      typedef const_key_set_iterator iterator_type;\n      for (iterator_type it = m_key_set.begin(); it != m_key_set.end(); ++it)\n\tif (m_eq(*it, r_key))\n          return it;\n      return m_key_set.end();\n    }\n\n    PB_DS_CLASS_T_DEC\n    typename PB_DS_CLASS_C_DEC::key_set_iterator\n    PB_DS_CLASS_C_DEC::\n    find(const_key_reference r_key)\n    {\n      _GLIBCXX_DEBUG_ONLY(assert_valid();)\n      key_set_iterator it = m_key_set.begin();\n      while (it != m_key_set.end())\n\t{\n\t  if (m_eq(*it, r_key))\n            return it;\n\t  ++it;\n\t}\n      return it;\n      _GLIBCXX_DEBUG_ONLY(assert_valid();)\n     }\n\n#ifdef _GLIBCXX_DEBUG\n    PB_DS_CLASS_T_DEC\n    void\n    PB_DS_CLASS_C_DEC::\n    assert_valid() const\n    {\n      const_key_set_iterator prime_it = m_key_set.begin();\n      while (prime_it != m_key_set.end())\n\t{\n\t  const_key_set_iterator sec_it = prime_it;\n\t  ++sec_it;\n\t  while (sec_it != m_key_set.end())\n\t    {\n\t      _GLIBCXX_DEBUG_ASSERT(!m_eq(*sec_it, *prime_it));\n\t      _GLIBCXX_DEBUG_ASSERT(!m_eq(*prime_it, *sec_it));\n\t      ++sec_it;\n\t    }\n\t  ++prime_it;\n\t}\n    }\n#endif \n\n    PB_DS_CLASS_T_DEC\n    template<typename Cmp_Fn>\n    void\n    PB_DS_CLASS_C_DEC::\n    split(const_key_reference r_key, Cmp_Fn cmp_fn, PB_DS_CLASS_C_DEC& other)\n    {\n      __gnu_cxx::throw_allocator<char> alloc;\n      const double orig_throw_prob = alloc.get_throw_prob();\n      alloc.set_throw_prob(0);\n      other.clear();\n      key_set_iterator it = m_key_set.begin();\n      while (it != m_key_set.end())\n        if (cmp_fn(r_key, * it))\n\t  {\n            other.insert_new(*it);\n            it = m_key_set.erase(it);\n\t  }\n        else\n\t  ++it;\n      alloc.set_throw_prob(orig_throw_prob);\n    }\n\n    PB_DS_CLASS_T_DEC\n    void\n    PB_DS_CLASS_C_DEC::\n    join(PB_DS_CLASS_C_DEC& other)\n    {\n      __gnu_cxx::throw_allocator<char> alloc;\n      const double orig_throw_prob = alloc.get_throw_prob();\n      alloc.set_throw_prob(0);\n      key_set_iterator it = other.m_key_set.begin();\n      while (it != other.m_key_set.end())\n\t{\n\t  insert_new(*it);\n\t  it = other.m_key_set.erase(it);\n\t}\n      _GLIBCXX_DEBUG_ASSERT(other.m_key_set.empty());\n      alloc.set_throw_prob(orig_throw_prob);\n    }\n\n#undef PB_DS_CLASS_T_DEC\n#undef PB_DS_CLASS_C_DEC\n\n} // namespace detail\n} // namespace pb_ds\n\n#endif \n\n#endif \n\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/detail/ov_tree_map_/cond_dtor.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file cond_dtor.hpp\n * Contains a conditional destructor\n */\n\ntemplate<typename Size_Type>\nclass cond_dtor\n{\npublic:\n  cond_dtor(value_vector a_vec, iterator& r_last_it, Size_Type total_size) \n  : m_a_vec(a_vec), m_r_last_it(r_last_it), m_max_size(total_size),\n    m_no_action(false)\n  { }\n\n  ~cond_dtor()\n  {\n    if (m_no_action)\n      return;\n    iterator it = m_a_vec;\n    while (it != m_r_last_it)\n      {\n\tit->~value_type();\n\t++it;\n      }\n\n    if (m_max_size > 0)\n      value_allocator().deallocate(m_a_vec, m_max_size);\n  }\n\n  inline void\n  set_no_action()\n  { m_no_action = true; }\n\nprotected:\n  value_vector m_a_vec;\n  iterator& m_r_last_it;\n  const Size_Type m_max_size;\n  bool m_no_action;\n};\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/detail/ov_tree_map_/constructors_destructor_fn_imps.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file constructors_destructor_fn_imps.hpp\n * Contains an implementation class for ov_tree_.\n */\n\nPB_DS_CLASS_T_DEC\ntypename PB_DS_CLASS_C_DEC::value_allocator\nPB_DS_CLASS_C_DEC::s_value_alloc;\n\nPB_DS_CLASS_T_DEC\ntypename PB_DS_CLASS_C_DEC::metadata_allocator\nPB_DS_CLASS_C_DEC::s_metadata_alloc;\n\nPB_DS_CLASS_T_DEC\nPB_DS_CLASS_C_DEC::\nPB_DS_OV_TREE_CLASS_NAME() :\n  m_a_values(NULL),\n  m_a_metadata(NULL),\n  m_end_it(NULL),\n  m_size(0)\n{ _GLIBCXX_DEBUG_ONLY(PB_DS_CLASS_C_DEC::assert_valid();) }\n\nPB_DS_CLASS_T_DEC\nPB_DS_CLASS_C_DEC::\nPB_DS_OV_TREE_CLASS_NAME(const Cmp_Fn& r_cmp_fn) :\n  cmp_fn_base(r_cmp_fn),\n  m_a_values(NULL),\n  m_a_metadata(NULL),\n  m_end_it(NULL),\n  m_size(0)\n{ _GLIBCXX_DEBUG_ONLY(PB_DS_CLASS_C_DEC::assert_valid();) }\n\nPB_DS_CLASS_T_DEC\nPB_DS_CLASS_C_DEC::\nPB_DS_OV_TREE_CLASS_NAME(const Cmp_Fn& r_cmp_fn, const node_update& r_node_update) :\n  cmp_fn_base(r_cmp_fn),\n  node_update(r_node_update),\n  m_a_values(NULL),\n  m_a_metadata(NULL),\n  m_end_it(NULL),\n  m_size(0)\n{ _GLIBCXX_DEBUG_ONLY(PB_DS_CLASS_C_DEC::assert_valid();) }\n\nPB_DS_CLASS_T_DEC\nPB_DS_CLASS_C_DEC::\nPB_DS_OV_TREE_CLASS_NAME(const PB_DS_CLASS_C_DEC& other) :\n#ifdef _GLIBCXX_DEBUG\n  map_debug_base(other),\n#endif \n#ifdef PB_DS_TREE_TRACE\n  PB_DS_TREE_TRACE_BASE_C_DEC(other),\n#endif \n  cmp_fn_base(other),\n  node_update(other),\n  m_a_values(NULL),\n  m_a_metadata(NULL),\n  m_end_it(NULL),\n  m_size(0)\n{\n  copy_from_ordered_range(other.begin(), other.end());\n  _GLIBCXX_DEBUG_ONLY(PB_DS_CLASS_C_DEC::assert_valid();)\n}\n\nPB_DS_CLASS_T_DEC\ntemplate<typename It>\ninline void\nPB_DS_CLASS_C_DEC::\ncopy_from_range(It first_it, It last_it)\n{\n#ifdef PB_DS_DATA_TRUE_INDICATOR\n  typedef\n    std::map<\n    key_type,\n    mapped_type,\n    Cmp_Fn,\n    typename Allocator::template rebind<\n    value_type>::other>\n    map_type;\n#else \n  typedef\n    std::set<\n    key_type,\n    Cmp_Fn,\n    typename Allocator::template rebind<\n    Key>::other>\n    map_type;\n#endif \n\n  map_type m(first_it, last_it);\n  copy_from_ordered_range(m.begin(), m.end());\n}\n\nPB_DS_CLASS_T_DEC\ntemplate<typename It>\nvoid\nPB_DS_CLASS_C_DEC::\ncopy_from_ordered_range(It first_it, It last_it)\n{\n  const size_type len = std::distance(first_it, last_it);\n  if (len == 0)\n    return;\n\n  value_vector a_values = s_value_alloc.allocate(len);\n  iterator target_it = a_values;\n  It source_it = first_it;\n  It source_end_it = last_it;\n\n  cond_dtor<size_type> cd(a_values, target_it, len);\n  while (source_it != source_end_it)\n    {\n      new (const_cast<void* >(static_cast<const void* >(target_it)))\n\tvalue_type(*source_it++);\n\n      ++target_it;\n    }\n\n  reallocate_metadata((node_update* )this, len);\n  cd.set_no_action();\n  m_a_values = a_values;\n  m_size = len;\n  m_end_it = m_a_values + m_size;\n  update(PB_DS_node_begin_imp(), (node_update* )this);\n\n#ifdef _GLIBCXX_DEBUG\n  const_iterator dbg_it = m_a_values;\n  while (dbg_it != m_end_it)\n    {\n      map_debug_base::insert_new(PB_DS_V2F(*dbg_it));\n      dbg_it++;\n    }\n  PB_DS_CLASS_C_DEC::assert_valid();\n#endif \n}\n\nPB_DS_CLASS_T_DEC\ntemplate<typename It>\nvoid\nPB_DS_CLASS_C_DEC::\ncopy_from_ordered_range(It first_it, It last_it, It other_first_it, \n\t\t\tIt other_last_it)\n{\n  clear();\n  const size_type len = std::distance(first_it, last_it) \n    \t\t         + std::distance(other_first_it, other_last_it);\n\n  value_vector a_values = s_value_alloc.allocate(len);\n\n  iterator target_it = a_values;\n  It source_it = first_it;\n  It source_end_it = last_it;\n\n  cond_dtor<size_type> cd(a_values, target_it, len);\n  while (source_it != source_end_it)\n    {\n      new (const_cast<void* >(static_cast<const void* >(target_it)))\n\tvalue_type(*source_it++);\n      ++target_it;\n    }\n\n  source_it = other_first_it;\n  source_end_it = other_last_it;\n\n  while (source_it != source_end_it)\n    {\n      new (const_cast<void* >(static_cast<const void* >(target_it)))\n\tvalue_type(*source_it++);\n      ++target_it;\n    }\n\n  reallocate_metadata((node_update* )this, len);\n  cd.set_no_action();\n  m_a_values = a_values;\n  m_size = len;\n  m_end_it = m_a_values + m_size;\n  update(PB_DS_node_begin_imp(), (node_update* )this);\n\n#ifdef _GLIBCXX_DEBUG\n  const_iterator dbg_it = m_a_values;\n  while (dbg_it != m_end_it)\n    {\n      map_debug_base::insert_new(PB_DS_V2F(*dbg_it));\n      dbg_it++;\n    }\n  PB_DS_CLASS_C_DEC::assert_valid();\n#endif \n}\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nswap(PB_DS_CLASS_C_DEC& other)\n{\n  _GLIBCXX_DEBUG_ONLY(assert_valid();)\n  value_swap(other);\n  std::swap((Cmp_Fn& )(*this), (Cmp_Fn& )other);\n  _GLIBCXX_DEBUG_ONLY(assert_valid();)\n}\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nvalue_swap(PB_DS_CLASS_C_DEC& other)\n{\n  std::swap(m_a_values, other.m_a_values);\n  std::swap(m_a_metadata, other.m_a_metadata);\n  std::swap(m_size, other.m_size);\n  std::swap(m_end_it, other.m_end_it);\n  _GLIBCXX_DEBUG_ONLY(map_debug_base::swap(other);)\n}\n\nPB_DS_CLASS_T_DEC\nPB_DS_CLASS_C_DEC::\n~PB_DS_OV_TREE_CLASS_NAME()\n{\n  _GLIBCXX_DEBUG_ONLY(assert_valid();)\n  cond_dtor<size_type> cd(m_a_values, m_end_it, m_size);\n  reallocate_metadata((node_update* )this, 0);\n}\n\nPB_DS_CLASS_T_DEC\ninline void\nPB_DS_CLASS_C_DEC::\nupdate(node_iterator /*it*/, null_node_update_pointer)\n{ }\n\nPB_DS_CLASS_T_DEC\ntemplate<typename Node_Update>\nvoid\nPB_DS_CLASS_C_DEC::\nupdate(node_iterator nd_it, Node_Update* p_update)\n{\n  const_node_iterator end_it = PB_DS_node_end_imp();\n  if (nd_it == end_it)\n    return;\n  update(nd_it.get_l_child(), p_update);\n  update(nd_it.get_r_child(), p_update);\n  node_update::operator()(nd_it, end_it);\n}\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/detail/ov_tree_map_/debug_fn_imps.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file debug_fn_imps.hpp\n * Contains an implementation class for ov_tree_.\n */\n\n#ifdef _GLIBCXX_DEBUG\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nassert_valid() const\n{\n  std::cout << \"av1\" << std::endl;\n\n  if (m_a_values == NULL || m_end_it == NULL || m_size == 0)\n    _GLIBCXX_DEBUG_ASSERT(m_a_values == NULL &&  m_end_it == NULL && m_size == 0);\n\n  std::cout << \"av2\" << std::endl;\n  assert_iterators();\n  std::cout << \"av3\" << std::endl;\n}\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nassert_iterators() const\n{\n  map_debug_base::check_size(m_size);\n  size_type iterated_num = 0;\n  const_iterator prev_it = end();\n  _GLIBCXX_DEBUG_ASSERT( m_end_it == m_a_values + m_size);\n  for (const_iterator it = begin(); it != end(); ++it)\n    {\n      ++iterated_num;\n      _GLIBCXX_DEBUG_ONLY(map_debug_base::check_key_exists(PB_DS_V2F(*it));)\n      _GLIBCXX_DEBUG_ASSERT(lower_bound(PB_DS_V2F(*it)) == it);\n      const_iterator upper_bound_it = upper_bound(PB_DS_V2F(*it));\n      --upper_bound_it;\n      _GLIBCXX_DEBUG_ASSERT(upper_bound_it == it);\n      if (prev_it != end())\n\t_GLIBCXX_DEBUG_ASSERT(Cmp_Fn::operator()(PB_DS_V2F(*prev_it),\n\t\t\t\t\t\t PB_DS_V2F(*it)));\n      prev_it = it;\n    }\n  _GLIBCXX_DEBUG_ASSERT(iterated_num == m_size);\n}\n\n#endif \n\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/detail/ov_tree_map_/erase_fn_imps.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file erase_fn_imps.hpp\n * Contains an implementation class for ov_tree_.\n */\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nclear()\n{\n  _GLIBCXX_DEBUG_ONLY(assert_valid();)\n  if (m_size == 0)\n    {\n      _GLIBCXX_DEBUG_ONLY(assert_valid();)\n      return;\n    }\n  else\n    {\n      reallocate_metadata((node_update* )this, 0);\n      cond_dtor<size_type> cd(m_a_values, m_end_it, m_size);\n    }\n\n  _GLIBCXX_DEBUG_ONLY(map_debug_base::clear();)\n  m_a_values = NULL;\n  m_size = 0;\n  m_end_it = m_a_values;\n  _GLIBCXX_DEBUG_ONLY(assert_valid();)\n}\n\nPB_DS_CLASS_T_DEC\ntemplate<typename Pred>\ninline typename PB_DS_CLASS_C_DEC::size_type\nPB_DS_CLASS_C_DEC::\nerase_if(Pred pred)\n{\n  _GLIBCXX_DEBUG_ONLY(assert_valid();)\n\n#ifdef PB_DS_REGRESSION\n    typename Allocator::group_throw_prob_adjustor adjust(m_size);\n#endif \n\n  size_type new_size = 0;\n  size_type num_val_ersd = 0;\n  iterator source_it = m_a_values;\n  for (source_it = begin(); source_it != m_end_it; ++source_it)\n    if (!pred(*source_it))\n      ++new_size;\n    else\n      ++num_val_ersd;\n\n  if (new_size == 0)\n    {\n      clear();\n      return num_val_ersd;\n    }\n\n  value_vector a_new_values = s_value_alloc.allocate(new_size);\n  iterator target_it = a_new_values;\n  cond_dtor<size_type> cd(a_new_values, target_it, new_size);\n  _GLIBCXX_DEBUG_ONLY(map_debug_base::clear());\n  for (source_it = begin(); source_it != m_end_it; ++source_it)\n    {\n      if (!pred(*source_it))\n        {\n\t  new (const_cast<void*>(static_cast<const void* >(target_it)))\n\t    value_type(*source_it);\n\n\t  _GLIBCXX_DEBUG_ONLY(map_debug_base::insert_new(PB_DS_V2F(*source_it)));\n\t  ++target_it;\n        }\n    }\n\n  reallocate_metadata((node_update* )this, new_size);\n  cd.set_no_action();\n\n  {\n    cond_dtor<size_type> cd1(m_a_values, m_end_it, m_size);\n  }\n\n  m_a_values = a_new_values;\n  m_size = new_size;\n  m_end_it = target_it;\n  update(node_begin(), (node_update* )this);\n  _GLIBCXX_DEBUG_ONLY(assert_valid();)\n  return num_val_ersd;\n}\n\nPB_DS_CLASS_T_DEC\ntemplate<typename It>\nIt\nPB_DS_CLASS_C_DEC::\nerase_imp(It it)\n{\n  _GLIBCXX_DEBUG_ONLY(assert_valid();)\n  if (it == end())\n    return end();\n\n  _GLIBCXX_DEBUG_ONLY(PB_DS_CLASS_C_DEC::check_key_exists(PB_DS_V2F(*it));)\n\n#ifdef PB_DS_REGRESSION\n    typename Allocator::group_throw_prob_adjustor adjust(m_size);\n#endif \n\n  _GLIBCXX_DEBUG_ASSERT(m_size > 0);\n  value_vector a_values = s_value_alloc.allocate(m_size - 1);\n  iterator source_it = begin();\n  iterator source_end_it = end();\n  iterator target_it = a_values;\n  iterator ret_it = end();\n\n  cond_dtor<size_type> cd(a_values, target_it, m_size - 1);\n\n  _GLIBCXX_DEBUG_ONLY(size_type cnt = 0;)\n\n  while (source_it != source_end_it)\n    {\n      if (source_it != it)\n\t{\n          _GLIBCXX_DEBUG_ONLY(++cnt;)\n\t  _GLIBCXX_DEBUG_ASSERT(cnt != m_size);\n          new (const_cast<void* >(static_cast<const void* >(target_it)))\n\t      value_type(*source_it);\n\n          ++target_it;\n\t}\n      else\n\tret_it = target_it;\n    ++source_it;\n    }\n\n  _GLIBCXX_DEBUG_ASSERT(m_size > 0);\n  reallocate_metadata((node_update* )this, m_size - 1);\n  cd.set_no_action();\n  _GLIBCXX_DEBUG_ONLY(PB_DS_CLASS_C_DEC::erase_existing(PB_DS_V2F(*it));)\n  {\n    cond_dtor<size_type> cd1(m_a_values, m_end_it, m_size);\n  }\n\n  m_a_values = a_values;\n  --m_size;\n  m_end_it = m_a_values + m_size;\n  update(node_begin(), (node_update* )this);\n  _GLIBCXX_DEBUG_ONLY(assert_valid();)\n  return It(ret_it);\n}\n\nPB_DS_CLASS_T_DEC\nbool\nPB_DS_CLASS_C_DEC::\nerase(const_key_reference r_key)\n{\n  point_iterator it = find(r_key);\n  if (it == end())\n    return false;\n  erase(it);\n  return true;\n}\n\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/detail/ov_tree_map_/info_fn_imps.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file info_fn_imps.hpp\n * Contains an implementation class for ov_tree_.\n */\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::size_type\nPB_DS_CLASS_C_DEC::\nsize() const\n{\n  _GLIBCXX_DEBUG_ONLY(assert_valid();)\n  return m_size;\n}\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::size_type\nPB_DS_CLASS_C_DEC::\nmax_size() const\n{ return s_value_alloc.max_size(); }\n\nPB_DS_CLASS_T_DEC\ninline bool\nPB_DS_CLASS_C_DEC::\nempty() const\n{ return size() == 0; }\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/detail/ov_tree_map_/insert_fn_imps.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file insert_fn_imps.hpp\n * Contains an implementation class for ov_tree_.\n */\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nreallocate_metadata(null_node_update_pointer, size_type)\n{ }\n\nPB_DS_CLASS_T_DEC\ntemplate<typename Node_Update_>\nvoid\nPB_DS_CLASS_C_DEC::\nreallocate_metadata(Node_Update_* , size_type new_size)\n{\n  metadata_pointer a_new_metadata_vec =(new_size == 0) ? NULL : s_metadata_alloc.allocate(new_size);\n\n  if (m_a_metadata != NULL)\n    {\n      for (size_type i = 0; i < m_size; ++i)\n\tm_a_metadata[i].~metadata_type();\n      s_metadata_alloc.deallocate(m_a_metadata, m_size);\n    }\n  std::swap(m_a_metadata, a_new_metadata_vec);\n}\n\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/detail/ov_tree_map_/iterators_fn_imps.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file iterators_fn_imps.hpp\n * Contains an implementation class for ov_tree_.\n */\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::const_node_iterator\nPB_DS_CLASS_C_DEC::\nnode_begin() const\n{ return PB_DS_node_begin_imp(); }\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::const_node_iterator\nPB_DS_CLASS_C_DEC::\nnode_end() const\n{ return PB_DS_node_end_imp(); }\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::node_iterator\nPB_DS_CLASS_C_DEC::\nnode_begin()\n{ return PB_DS_node_begin_imp(); }\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::node_iterator\nPB_DS_CLASS_C_DEC::\nnode_end()\n{ return PB_DS_node_end_imp(); }\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::const_node_iterator\nPB_DS_CLASS_C_DEC::\nPB_DS_node_begin_imp() const\n{\n  return const_node_iterator(const_cast<pointer>(mid_pointer(begin(), end())),\n\t\t\t      const_cast<pointer>(begin()),\n\t\t\t      const_cast<pointer>(end()),(m_a_metadata == NULL)?\n\t\t\t      NULL :\n\t\t\t      mid_pointer(m_a_metadata, m_a_metadata + m_size));\n}\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::const_node_iterator\nPB_DS_CLASS_C_DEC::\nPB_DS_node_end_imp() const\n{\n  return const_node_iterator(end(), end(), end(),\n\t\t     (m_a_metadata == NULL) ? NULL : m_a_metadata + m_size);\n}\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::node_iterator\nPB_DS_CLASS_C_DEC::\nPB_DS_node_begin_imp()\n{\n  return node_iterator(mid_pointer(begin(), end()), begin(), end(),\n\t\t       (m_a_metadata == NULL) ? NULL : mid_pointer(m_a_metadata, m_a_metadata + m_size));\n}\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::node_iterator\nPB_DS_CLASS_C_DEC::\nPB_DS_node_end_imp()\n{\n  return node_iterator(end(), end(),\n\t\t  end(),(m_a_metadata == NULL) ? NULL : m_a_metadata + m_size);\n}\n\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/detail/ov_tree_map_/node_iterators.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file node_iterators.hpp\n * Contains an implementation class for ov_tree_.\n */\n\n#ifndef PB_DS_OV_TREE_NODE_ITERATORS_HPP\n#define PB_DS_OV_TREE_NODE_ITERATORS_HPP\n\n#include <ext/pb_ds/tag_and_trait.hpp>\n#include <ext/pb_ds/detail/type_utils.hpp>\n#include <debug/debug.h>\n\nnamespace pb_ds\n{\n  namespace detail\n  {\n#define PB_DS_STATIC_ASSERT(UNIQUE, E)\t\t\t\t\t\\\n    typedef\t\t\t\t\t\t\t\t\\\n    static_assert_dumclass<sizeof(static_assert<(bool)(E)>)> \\\n    UNIQUE##static_assert_type\n\n#define PB_DS_OV_TREE_CONST_NODE_ITERATOR_C_DEC\t\t\t\\\n    ov_tree_node_const_it_<Value_Type, Metadata_Type, Allocator>\n\n    // Const node reference.\n    template<typename Value_Type, typename Metadata_Type, class Allocator>\n    class ov_tree_node_const_it_\n    {\n\n    protected:\n      typedef\n      typename Allocator::template rebind<\n      Value_Type>::other::pointer\n      pointer;\n\n      typedef\n      typename Allocator::template rebind<\n\tValue_Type>::other::const_pointer\n      const_pointer;\n\n      typedef\n      typename Allocator::template rebind<\n\tMetadata_Type>::other::const_pointer\n      const_metadata_pointer;\n\n      typedef PB_DS_OV_TREE_CONST_NODE_ITERATOR_C_DEC this_type;\n\n    protected:\n\n      template<typename Ptr>\n      inline static Ptr\n      mid_pointer(Ptr p_begin, Ptr p_end)\n      {\n\t_GLIBCXX_DEBUG_ASSERT(p_end >= p_begin);\n\treturn (p_begin + (p_end - p_begin) / 2);\n      }\n\n    public:\n\n      typedef trivial_iterator_tag iterator_category;\n\n      typedef trivial_iterator_difference_type difference_type;\n\n      typedef\n      typename Allocator::template rebind<\n\tValue_Type>::other::const_pointer\n      value_type;\n\n      typedef\n      typename Allocator::template rebind<\n\ttypename remove_const<\n\tValue_Type>::type>::other::const_pointer\n      reference;\n\n      typedef\n      typename Allocator::template rebind<\n\ttypename remove_const<\n\tValue_Type>::type>::other::const_pointer\n      const_reference;\n\n      typedef Metadata_Type metadata_type;\n\n      typedef\n      typename Allocator::template rebind<\n\tmetadata_type>::other::const_reference\n      const_metadata_reference;\n\n    public:\n      inline\n      ov_tree_node_const_it_(const_pointer p_nd = NULL,  const_pointer p_begin_nd = NULL,  const_pointer p_end_nd = NULL,  const_metadata_pointer p_metadata = NULL) : 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)\n      { }\n\n      inline const_reference\n      operator*() const\n      { return m_p_value; }\n\n      inline const_metadata_reference\n      get_metadata() const\n      {\n\tenum\n\t  {\n\t    has_metadata = !is_same<Metadata_Type, null_node_metadata>::value\n\t  };\n\n\tPB_DS_STATIC_ASSERT(should_have_metadata, has_metadata);\n\t_GLIBCXX_DEBUG_ASSERT(m_p_metadata != NULL);\n\treturn *m_p_metadata;\n      }\n\n      inline this_type\n      get_l_child() const\n      {\n\tif (m_p_begin_value == m_p_value)\n\t  return (this_type(m_p_begin_value, m_p_begin_value, m_p_begin_value));\n\n\tconst_metadata_pointer p_begin_metadata =\n\t  m_p_metadata - (m_p_value - m_p_begin_value);\n\n\treturn (this_type(mid_pointer(m_p_begin_value, m_p_value),\n\t\t\t  m_p_begin_value,\n\t\t\t  m_p_value,\n\t\t\t  mid_pointer(p_begin_metadata, m_p_metadata)));\n      }\n\n      inline this_type\n      get_r_child() const\n      {\n\tif (m_p_value == m_p_end_value)\n\t  return (this_type(m_p_end_value,  m_p_end_value,  m_p_end_value));\n\n\tconst_metadata_pointer p_end_metadata =\n\t  m_p_metadata + (m_p_end_value - m_p_value);\n\n\treturn (this_type(mid_pointer(m_p_value + 1, m_p_end_value),\n\t\t\t  m_p_value + 1,\n\t\t\t  m_p_end_value,(m_p_metadata == NULL) ?\n\t\t\t  NULL : mid_pointer(m_p_metadata + 1, p_end_metadata)));\n      }\n\n      inline bool\n      operator==(const this_type& other) const\n      {\n\tconst bool is_end = m_p_begin_value == m_p_end_value;\n\tconst bool is_other_end = other.m_p_begin_value == other.m_p_end_value;\n\n\tif (is_end)\n\t  return (is_other_end);\n\n\tif (is_other_end)\n\t  return (is_end);\n\n\treturn m_p_value == other.m_p_value;\n      }\n\n      inline bool\n      operator!=(const this_type& other) const\n      { return !operator==(other); }\n\n    public:\n      pointer m_p_value;\n      pointer m_p_begin_value;\n      pointer m_p_end_value;\n\n      const_metadata_pointer m_p_metadata;\n    };\n\n#define PB_DS_OV_TREE_NODE_ITERATOR_C_DEC\t\t\t\\\n    ov_tree_node_it_<Value_Type, Metadata_Type, Allocator>\n\n    // Node reference.\n    template<typename Value_Type, typename Metadata_Type, class Allocator>\n    class ov_tree_node_it_ : public PB_DS_OV_TREE_CONST_NODE_ITERATOR_C_DEC\n    {\n\n    private:\n      typedef PB_DS_OV_TREE_NODE_ITERATOR_C_DEC this_type;\n\n      typedef PB_DS_OV_TREE_CONST_NODE_ITERATOR_C_DEC base_type;\n\n      typedef typename base_type::pointer pointer;\n\n      typedef typename base_type::const_pointer const_pointer;\n\n      typedef\n      typename base_type::const_metadata_pointer\n      const_metadata_pointer;\n\n    public:\n\n      typedef trivial_iterator_tag iterator_category;\n\n      typedef trivial_iterator_difference_type difference_type;\n\n      typedef\n      typename Allocator::template rebind<\n\tValue_Type>::other::pointer\n      value_type;\n\n      typedef\n      typename Allocator::template rebind<\n\ttypename remove_const<\n\tValue_Type>::type>::other::pointer\n      reference;\n\n      typedef\n      typename Allocator::template rebind<\n\ttypename remove_const<\n\tValue_Type>::type>::other::pointer\n      const_reference;\n\n    public:\n      inline\n      ov_tree_node_it_(const_pointer p_nd = NULL,  const_pointer p_begin_nd = NULL,  const_pointer p_end_nd = NULL,  const_metadata_pointer p_metadata = NULL) : base_type(                p_nd,  p_begin_nd,  p_end_nd,  p_metadata)\n      { }\n\n      // Access.\n      inline reference\n      operator*() const\n      { return reference(base_type::m_p_value); }\n\n      // Returns the node reference associated with the left node.\n      inline ov_tree_node_it_\n      get_l_child() const\n      {\n\tif (base_type::m_p_begin_value == base_type::m_p_value)\n\t  return (this_type(base_type::m_p_begin_value,  base_type::m_p_begin_value,  base_type::m_p_begin_value));\n\n\tconst_metadata_pointer p_begin_metadata =\n\t  base_type::m_p_metadata - (base_type::m_p_value - base_type::m_p_begin_value);\n\n\treturn (this_type(base_type::mid_pointer(base_type::m_p_begin_value, base_type::m_p_value),\n\t\t\t  base_type::m_p_begin_value,\n\t\t\t  base_type::m_p_value,\n\t\t\t  base_type::mid_pointer(p_begin_metadata, base_type::m_p_metadata)));\n      }\n\n      // Returns the node reference associated with the right node.\n      inline ov_tree_node_it_\n      get_r_child() const\n      {\n\tif (base_type::m_p_value == base_type::m_p_end_value)\n\t  return (this_type(base_type::m_p_end_value,  base_type::m_p_end_value,  base_type::m_p_end_value));\n\n\tconst_metadata_pointer p_end_metadata =\n\t  base_type::m_p_metadata + (base_type::m_p_end_value - base_type::m_p_value);\n\n\treturn (this_type(base_type::mid_pointer(base_type::m_p_value + 1, base_type::m_p_end_value),\n\t\t\t  base_type::m_p_value + 1,\n\t\t\t  base_type::m_p_end_value,(base_type::m_p_metadata == NULL)?\n\t\t\t  NULL : base_type::mid_pointer(base_type::m_p_metadata + 1, p_end_metadata)));\n      }\n\n    };\n\n#undef PB_DS_OV_TREE_NODE_ITERATOR_C_DEC\n#undef PB_DS_OV_TREE_CONST_NODE_ITERATOR_C_DEC\n#undef PB_DS_STATIC_ASSERT\n\n} // namespace detail\n} // namespace pb_ds\n\n#endif \n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/detail/ov_tree_map_/ov_tree_map_.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file ov_tree_map_.hpp\n * Contains an implementation class for ov_tree_.\n */\n\n#include <map>\n#include <set>\n#include <ext/pb_ds/tree_policy.hpp>\n#include <ext/pb_ds/detail/eq_fn/eq_by_less.hpp>\n#include <ext/pb_ds/detail/types_traits.hpp>\n#include <ext/pb_ds/detail/map_debug_base.hpp>\n#include <ext/pb_ds/detail/type_utils.hpp>\n#include <ext/pb_ds/exception.hpp>\n#include <ext/pb_ds/detail/tree_trace_base.hpp>\n#include <utility>\n#include <functional>\n#include <algorithm>\n#include <vector>\n#include <assert.h>\n#include <debug/debug.h>\n\nnamespace pb_ds\n{\n  namespace detail\n  {\n#define PB_DS_CLASS_T_DEC \\\n    template<typename Key, typename Mapped, class Cmp_Fn, \\\n\t     class Node_And_It_Traits, class Allocator>\n\n#ifdef PB_DS_DATA_TRUE_INDICATOR\n#define PB_DS_OV_TREE_CLASS_NAME ov_tree_data_\n#endif \n\n#ifdef PB_DS_DATA_FALSE_INDICATOR\n#define PB_DS_OV_TREE_CLASS_NAME ov_tree_no_data_\n#endif \n\n#ifdef PB_DS_DATA_TRUE_INDICATOR\n#define PB_DS_CONST_NODE_ITERATOR_NAME ov_tree_const_node_iterator_data_\n#else \n#define PB_DS_CONST_NODE_ITERATOR_NAME ov_tree_const_node_iterator_no_data_\n#endif \n\n#define PB_DS_CLASS_C_DEC \\\n   PB_DS_OV_TREE_CLASS_NAME<Key, Mapped, Cmp_Fn, Node_And_It_Traits, Allocator>\n\n#define PB_DS_TYPES_TRAITS_C_DEC \\\n    types_traits<Key, Mapped, Allocator, false>\n\n#ifdef _GLIBCXX_DEBUG\n#define PB_DS_MAP_DEBUG_BASE_C_DEC \\\n    map_debug_base<Key, eq_by_less<Key, Cmp_Fn>, \\\n       \ttypename Allocator::template rebind<Key>::other::const_reference>\n#endif \n\n#ifdef PB_DS_DATA_TRUE_INDICATOR\n#define PB_DS_V2F(X) (X).first\n#define PB_DS_V2S(X) (X).second\n#define PB_DS_EP2VP(X)& ((X)->m_value)\n#endif \n\n#ifdef PB_DS_DATA_FALSE_INDICATOR\n#define PB_DS_V2F(X) (X)\n#define PB_DS_V2S(X) Mapped_Data()\n#define PB_DS_EP2VP(X)& ((X)->m_value.first)\n#endif \n\n#ifdef PB_DS_TREE_TRACE\n#define PB_DS_TREE_TRACE_BASE_C_DEC \\\n    tree_trace_base<typename Node_And_It_Traits::const_node_iterator, \\\n\t\t    typename Node_And_It_Traits::node_iterator, \\\n\t\t    Cmp_Fn, false, Allocator>\n#endif \n\n    // Ordered-vector tree associative-container.\n    template<typename Key, typename Mapped, class Cmp_Fn,\n\t     class Node_And_It_Traits, class Allocator>\n    class PB_DS_OV_TREE_CLASS_NAME :\n#ifdef _GLIBCXX_DEBUG\n      protected PB_DS_MAP_DEBUG_BASE_C_DEC,\n#endif \n#ifdef PB_DS_TREE_TRACE\n      public PB_DS_TREE_TRACE_BASE_C_DEC,\n#endif \n      public Cmp_Fn,\n      public Node_And_It_Traits::node_update,\n      public PB_DS_TYPES_TRAITS_C_DEC\n    {\n    private:\n      typedef PB_DS_TYPES_TRAITS_C_DEC traits_base;\n\n      typedef typename remove_const<typename traits_base::value_type>::type non_const_value_type;\n\n      typedef typename Allocator::template rebind<non_const_value_type>::other value_allocator;\n      typedef typename value_allocator::pointer value_vector;\n\n\n      typedef Cmp_Fn cmp_fn_base;\n\n#ifdef _GLIBCXX_DEBUG\n      typedef PB_DS_MAP_DEBUG_BASE_C_DEC map_debug_base;\n#endif \n\n      typedef typename traits_base::pointer mapped_pointer_;\n      typedef typename traits_base::const_pointer const_mapped_pointer_;\n\n      typedef typename Node_And_It_Traits::metadata_type metadata_type;\n\n      typedef typename Allocator::template rebind<metadata_type>::other metadata_allocator;\n      typedef typename metadata_allocator::pointer metadata_pointer;\n      typedef typename metadata_allocator::const_reference const_metadata_reference;\n      typedef typename metadata_allocator::reference metadata_reference;\n\n      typedef\n      typename Node_And_It_Traits::null_node_update_pointer\n      null_node_update_pointer;\n\n    public:\n\n      typedef Allocator allocator;\n      typedef typename Allocator::size_type size_type;\n      typedef typename Allocator::difference_type difference_type;\n\n      typedef Cmp_Fn cmp_fn;\n\n      typedef typename Node_And_It_Traits::node_update node_update;\n\n      typedef typename traits_base::key_type key_type;\n      typedef typename traits_base::key_pointer key_pointer;\n      typedef typename traits_base::const_key_pointer const_key_pointer;\n      typedef typename traits_base::key_reference key_reference;\n      typedef typename traits_base::const_key_reference const_key_reference;\n      typedef typename traits_base::mapped_type mapped_type;\n      typedef typename traits_base::mapped_pointer mapped_pointer;\n      typedef typename traits_base::const_mapped_pointer const_mapped_pointer;\n      typedef typename traits_base::mapped_reference mapped_reference;\n      typedef typename traits_base::const_mapped_reference const_mapped_reference;\n      typedef typename traits_base::value_type value_type;\n      typedef typename traits_base::pointer pointer;\n      typedef typename traits_base::const_pointer const_pointer;\n      typedef typename traits_base::reference reference;\n      typedef typename traits_base::const_reference const_reference;\n\n      typedef const_pointer const_point_iterator;\n\n#ifdef PB_DS_DATA_TRUE_INDICATOR\n      typedef pointer point_iterator;\n#else \n      typedef const_point_iterator point_iterator;\n#endif \n\n      typedef const_point_iterator const_iterator;\n\n      typedef point_iterator iterator;\n\n#include <ext/pb_ds/detail/ov_tree_map_/cond_dtor.hpp>\n\n      typedef\n      typename Node_And_It_Traits::const_node_iterator\n      const_node_iterator;\n\n      typedef typename Node_And_It_Traits::node_iterator node_iterator;\n\n    public:\n\n      PB_DS_OV_TREE_CLASS_NAME();\n\n      PB_DS_OV_TREE_CLASS_NAME(const Cmp_Fn&);\n\n      PB_DS_OV_TREE_CLASS_NAME(const Cmp_Fn&, const node_update&);\n\n      PB_DS_OV_TREE_CLASS_NAME(const PB_DS_CLASS_C_DEC&);\n\n      ~PB_DS_OV_TREE_CLASS_NAME();\n\n      void\n      swap(PB_DS_CLASS_C_DEC&);\n\n      template<typename It>\n      void\n      copy_from_range(It, It);\n\n      inline size_type\n      max_size() const;\n\n      inline bool\n      empty() const;\n\n      inline size_type\n      size() const;\n\n      Cmp_Fn& \n      get_cmp_fn();\n\n      const Cmp_Fn& \n      get_cmp_fn() const;\n\n      inline mapped_reference\n      operator[](const_key_reference r_key)\n      {\n#ifdef PB_DS_DATA_TRUE_INDICATOR\n\t_GLIBCXX_DEBUG_ONLY(assert_valid();)\n\tpoint_iterator it = lower_bound(r_key);\n\tif (it != end() && !Cmp_Fn::operator()(r_key, PB_DS_V2F(*it)))\n\t  {\n\t    _GLIBCXX_DEBUG_ONLY(map_debug_base::check_key_exists(r_key));\n\t    _GLIBCXX_DEBUG_ONLY(assert_valid();)\n\t     return it->second;\n\t  }\n\n\t_GLIBCXX_DEBUG_ONLY(assert_valid();)\n\treturn (insert_new_val(it, std::make_pair(r_key, mapped_type()))->second);\n#else \n\tinsert(r_key);\n\treturn traits_base::s_null_mapped;\n#endif \n      }\n\n      inline std::pair<point_iterator, bool>\n      insert(const_reference r_value)\n      {\n\t_GLIBCXX_DEBUG_ONLY(assert_valid();)\n\tconst_key_reference r_key = PB_DS_V2F(r_value);\n\tpoint_iterator it = lower_bound(r_key);\n\n\tif (it != end()&&  !Cmp_Fn::operator()(r_key, PB_DS_V2F(*it)))\n\t  {\n\t    _GLIBCXX_DEBUG_ONLY(assert_valid();)\n\t    _GLIBCXX_DEBUG_ONLY(map_debug_base::check_key_exists(r_key));\n\t    return std::make_pair(it, false);\n\t  }\n\n\t_GLIBCXX_DEBUG_ONLY(assert_valid();)\n\treturn std::make_pair(insert_new_val(it, r_value), true);\n      }\n\n      inline point_iterator\n      lower_bound(const_key_reference r_key)\n      {\n\tpointer it = m_a_values;\n\tpointer e_it = m_a_values + m_size;\n\twhile (it != e_it)\n\t  {\n\t    pointer mid_it = it + ((e_it - it) >> 1);\n\t    if (cmp_fn_base::operator()(PB_DS_V2F(*mid_it), r_key))\n\t      it = ++mid_it;\n\t    else\n\t      e_it = mid_it;\n\t  }\n\treturn it;\n      }\n\n      inline const_point_iterator\n      lower_bound(const_key_reference r_key) const\n      { return const_cast<PB_DS_CLASS_C_DEC& >(*this).lower_bound(r_key); }\n\n      inline point_iterator\n      upper_bound(const_key_reference r_key)\n      {\n\titerator pot_it = lower_bound(r_key);\n\tif (pot_it != end()&&  !Cmp_Fn::operator()(r_key, PB_DS_V2F(*pot_it)))\n\t  {\n\t    _GLIBCXX_DEBUG_ONLY(map_debug_base::check_key_exists(r_key));\n\t    return ++pot_it;\n\t  }\n\n\t_GLIBCXX_DEBUG_ONLY(map_debug_base::check_key_does_not_exist(r_key));\n\treturn pot_it;\n      }\n\n      inline const_point_iterator\n      upper_bound(const_key_reference r_key) const\n      { return const_cast<PB_DS_CLASS_C_DEC&>(*this).upper_bound(r_key); }\n\n      inline point_iterator\n      find(const_key_reference r_key)\n      {\n\t_GLIBCXX_DEBUG_ONLY(assert_valid();)\n\titerator pot_it = lower_bound(r_key);\n\tif (pot_it != end() && !Cmp_Fn::operator()(r_key, PB_DS_V2F(*pot_it)))\n\t  {\n\t    _GLIBCXX_DEBUG_ONLY(map_debug_base::check_key_exists(r_key));\n\t    return pot_it;\n\t  }\n\n\t_GLIBCXX_DEBUG_ONLY(map_debug_base::check_key_does_not_exist(r_key));\n\treturn end();\n      }\n\n      inline const_point_iterator\n      find(const_key_reference r_key) const\n      { return (const_cast<PB_DS_CLASS_C_DEC& >(*this).find(r_key)); }\n\n      bool\n      erase(const_key_reference);\n\n      template<typename Pred>\n      inline size_type\n      erase_if(Pred);\n\n      inline iterator\n      erase(iterator it)\n      { return erase_imp<iterator>(it); }\n\n      void\n      clear();\n\n      void\n      join(PB_DS_CLASS_C_DEC&);\n\n      void\n      split(const_key_reference, PB_DS_CLASS_C_DEC&);\n\n      inline iterator\n      begin()\n      { return m_a_values; }\n\n      inline const_iterator\n      begin() const\n      { return m_a_values; }\n\n      inline iterator\n      end()\n      { return m_end_it; }\n\n      inline const_iterator\n      end() const\n      { return m_end_it; }\n\n      inline const_node_iterator\n      node_begin() const;\n\n      inline const_node_iterator\n      node_end() const;\n\n      inline node_iterator\n      node_begin();\n\n      inline node_iterator\n      node_end();\n\n    private:\n\n      inline void\n      update(node_iterator /*it*/, null_node_update_pointer);\n\n      template<typename Node_Update>\n      void\n      update(node_iterator, Node_Update*);\n\n      void\n      reallocate_metadata(null_node_update_pointer, size_type);\n\n      template<typename Node_Update_>\n      void\n      reallocate_metadata(Node_Update_*, size_type);\n\n      template<typename It>\n      void\n      copy_from_ordered_range(It, It);\n\n      void\n      value_swap(PB_DS_CLASS_C_DEC&);\n\n      template<typename It>\n      void\n      copy_from_ordered_range(It, It, It, It);\n\n      template<typename Ptr>\n      inline static Ptr\n      mid_pointer(Ptr p_begin, Ptr p_end)\n      {\n\t_GLIBCXX_DEBUG_ASSERT(p_end >= p_begin);\n\treturn (p_begin + (p_end - p_begin) / 2);\n      }\n\n      inline iterator\n      insert_new_val(iterator it, const_reference r_value)\n      {\n\t_GLIBCXX_DEBUG_ONLY(assert_valid();)\n#ifdef PB_DS_REGRESSION\n\t  typename Allocator::group_throw_prob_adjustor adjust(m_size);\n#endif \n\n\t_GLIBCXX_DEBUG_ONLY(map_debug_base::check_key_does_not_exist(PB_DS_V2F(r_value)));\n\n\tvalue_vector a_values = s_value_alloc.allocate(m_size + 1);\n\n\titerator source_it = begin();\n\titerator source_end_it = end();\n\titerator target_it = a_values;\n\titerator ret_it;\n\n\tcond_dtor<size_type> cd(a_values, target_it, m_size + 1);\n\twhile (source_it != it)\n\t  {\n\t    new (const_cast<void* >(static_cast<const void* >(target_it)))\n\t      value_type(*source_it++);\n\t    ++target_it;\n\t  }\n\n\tnew (const_cast<void* >(static_cast<const void* >(ret_it = target_it)))\n\t  value_type(r_value);\n\t++target_it;\n\n\twhile (source_it != source_end_it)\n\t  {\n\t    new (const_cast<void* >(static_cast<const void* >(target_it)))\n\t      value_type(*source_it++);\n\t    ++target_it;\n\t  }\n\n\treallocate_metadata((node_update* )this, m_size + 1);\n\tcd.set_no_action();\n\tif (m_size != 0)\n\t  {\n\t    cond_dtor<size_type> cd1(m_a_values, m_end_it, m_size);\n\t  }\n\n\t++m_size;\n\tm_a_values = a_values;\n\tm_end_it = m_a_values + m_size;\n\t_GLIBCXX_DEBUG_ONLY(map_debug_base::insert_new(PB_DS_V2F(r_value)));\n\tupdate(node_begin(), (node_update* )this);\n\t_GLIBCXX_DEBUG_ONLY(PB_DS_CLASS_C_DEC::assert_valid();)\n\treturn ret_it;\n      }\n\n#ifdef _GLIBCXX_DEBUG\n      void\n      assert_valid() const;\n\n      void\n      assert_iterators() const;\n#endif \n\n      template<typename It>\n      It\n      erase_imp(It it);\n\n      inline const_node_iterator\n      PB_DS_node_begin_imp() const;\n\n      inline const_node_iterator\n      PB_DS_node_end_imp() const;\n\n      inline node_iterator\n      PB_DS_node_begin_imp();\n\n      inline node_iterator\n      PB_DS_node_end_imp();\n\n    private:\n      static value_allocator s_value_alloc;\n      static metadata_allocator s_metadata_alloc;\n\n      value_vector m_a_values;\n      metadata_pointer m_a_metadata;\n      iterator m_end_it;\n      size_type m_size;\n    };\n\n#include <ext/pb_ds/detail/ov_tree_map_/constructors_destructor_fn_imps.hpp>\n#include <ext/pb_ds/detail/ov_tree_map_/iterators_fn_imps.hpp>\n#include <ext/pb_ds/detail/ov_tree_map_/debug_fn_imps.hpp>\n#include <ext/pb_ds/detail/ov_tree_map_/erase_fn_imps.hpp>\n#include <ext/pb_ds/detail/ov_tree_map_/insert_fn_imps.hpp>\n#include <ext/pb_ds/detail/ov_tree_map_/info_fn_imps.hpp>\n#include <ext/pb_ds/detail/ov_tree_map_/split_join_fn_imps.hpp>\n#include <ext/pb_ds/detail/bin_search_tree_/policy_access_fn_imps.hpp>\n\n#undef PB_DS_CLASS_C_DEC\n#undef PB_DS_CLASS_T_DEC\n#undef PB_DS_OV_TREE_CLASS_NAME\n#undef PB_DS_TYPES_TRAITS_C_DEC\n#undef PB_DS_MAP_DEBUG_BASE_C_DEC\n#ifdef PB_DS_TREE_TRACE\n#undef PB_DS_TREE_TRACE_BASE_C_DEC\n#endif \n\n#undef PB_DS_V2F\n#undef PB_DS_EP2VP\n#undef PB_DS_V2S\n#undef PB_DS_CONST_NODE_ITERATOR_NAME\n\n  } // namespace detail\n} // namespace pb_ds\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/detail/ov_tree_map_/policy_access_fn_imps.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file policy_access_fn_imps.hpp\n * Contains an implementation class for bin_search_tree_.\n */\n\nPB_DS_CLASS_T_DEC\nCmp_Fn& \nPB_DS_CLASS_C_DEC::\nget_cmp_fn()\n{ return *this; }\n\nPB_DS_CLASS_T_DEC\nconst Cmp_Fn& \nPB_DS_CLASS_C_DEC::\nget_cmp_fn() const\n{ return *this; }\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/detail/ov_tree_map_/split_join_fn_imps.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file split_join_fn_imps.hpp\n * Contains an implementation class for ov_tree_.\n */\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nsplit(const_key_reference r_key, PB_DS_CLASS_C_DEC& other)\n{\n  _GLIBCXX_DEBUG_ONLY(assert_valid();)\n  _GLIBCXX_DEBUG_ONLY(other.assert_valid();)\n\n  if (m_size == 0)\n    {\n      other.clear();\n      _GLIBCXX_DEBUG_ONLY(assert_valid();)\n      _GLIBCXX_DEBUG_ONLY(other.assert_valid();)\n      return;\n    }\n\n  if (Cmp_Fn::operator()(r_key, PB_DS_V2F(*begin())))\n    {\n      value_swap(other);\n      _GLIBCXX_DEBUG_ONLY(assert_valid();)\n      _GLIBCXX_DEBUG_ONLY(other.assert_valid();)\n      return;\n    }\n\n  if (!Cmp_Fn::operator()(r_key, PB_DS_V2F(*(end() - 1))))\n    {\n      _GLIBCXX_DEBUG_ONLY(assert_valid();)\n      _GLIBCXX_DEBUG_ONLY(other.assert_valid();)\n      return;\n    }\n\n  if (m_size == 1)\n    {\n      value_swap(other);\n      _GLIBCXX_DEBUG_ONLY(assert_valid();)\n      _GLIBCXX_DEBUG_ONLY(other.assert_valid();)\n      return;\n    }\n\n  _GLIBCXX_DEBUG_ONLY(map_debug_base::join(other);)\n  iterator it = upper_bound(r_key);\n  PB_DS_CLASS_C_DEC new_other(other, other);\n  new_other.copy_from_ordered_range(it, end());\n  PB_DS_CLASS_C_DEC new_this(*this, * this);\n  new_this.copy_from_ordered_range(begin(), it);\n\n  // No exceptions from this point.\n  _GLIBCXX_DEBUG_ONLY(map_debug_base::split(r_key,(Cmp_Fn& )(*this), other);)\n  other.update(other.node_begin(), (node_update* )(&other));\n  update(node_begin(), (node_update* )this);\n  other.value_swap(new_other);\n  value_swap(new_this);\n  _GLIBCXX_DEBUG_ONLY(assert_valid();)\n  _GLIBCXX_DEBUG_ONLY(other.assert_valid();)\n}\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\njoin(PB_DS_CLASS_C_DEC& other)\n{\n  _GLIBCXX_DEBUG_ONLY(assert_valid();)\n  _GLIBCXX_DEBUG_ONLY(other.assert_valid();)\n  if (other.m_size == 0)\n    return;\n\n  if (m_size == 0)\n    {\n      value_swap(other);\n      return;\n    }\n\n  const bool greater = Cmp_Fn::operator()(PB_DS_V2F(*(end() - 1)),\n\t\t\t\t\t  PB_DS_V2F(*other.begin()));\n\n  const bool lesser = Cmp_Fn::operator()(PB_DS_V2F(*(other.end() - 1)),\n\t\t\t\t\t PB_DS_V2F(*begin()));\n\n  if (!greater && !lesser)\n    __throw_join_error();\n\n  PB_DS_CLASS_C_DEC new_this(*this, *this);\n\n  if (greater)\n    new_this.copy_from_ordered_range(begin(), end(), \n\t\t\t\t     other.begin(), other.end());\n  else\n    new_this.copy_from_ordered_range(other.begin(), other.end(),\n\t\t\t\t     begin(), end());\n\n  // No exceptions from this point.\n  _GLIBCXX_DEBUG_ONLY(map_debug_base::join(other);)\n  value_swap(new_this);\n  other.clear();\n  _GLIBCXX_DEBUG_ONLY(assert_valid();)\n  _GLIBCXX_DEBUG_ONLY(other.assert_valid();)\n}\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/detail/ov_tree_map_/traits.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file traits.hpp\n * Contains an implementation class for ov_tree_.\n */\n\n#ifndef PB_DS_OV_TREE_NODE_AND_IT_TRAITS_HPP\n#define PB_DS_OV_TREE_NODE_AND_IT_TRAITS_HPP\n\n#include <ext/pb_ds/detail/ov_tree_map_/node_iterators.hpp>\n\nnamespace pb_ds\n{\n  namespace detail\n  {\n\n    template<typename Key,\n\t     typename Mapped,\n\t     class Cmp_Fn,\n\t     template<typename Const_Node_Iterator,\n\t\t      class Node_Iterator,\n\t\t      class Cmp_Fn_,\n\t\t      class Allocator_>\n    class Node_Update,\n\t     class Allocator>\n    struct tree_traits<\n      Key,\n      Mapped,\n      Cmp_Fn,\n      Node_Update,\n      ov_tree_tag,\n      Allocator>\n    {\n    private:\n      typedef\n      typename types_traits<\n      Key,\n      Mapped,\n      Allocator,\n      false>::value_type\n      value_type;\n\n    public:\n      typedef\n      typename tree_node_metadata_selector<\n      Key,\n      Mapped,\n      Cmp_Fn,\n      Node_Update,\n      Allocator>::type\n      metadata_type;\n\n      typedef\n      ov_tree_node_const_it_<\n\tvalue_type,\n\tmetadata_type,\n\tAllocator>\n      const_node_iterator;\n\n      typedef\n      ov_tree_node_it_<\n\tvalue_type,\n\tmetadata_type,\n\tAllocator>\n      node_iterator;\n\n      typedef\n      Node_Update<\n\tconst_node_iterator,\n\tnode_iterator,\n\tCmp_Fn,\n\tAllocator>\n      node_update;\n\n      typedef\n      pb_ds::null_tree_node_update<\n\tconst_node_iterator,\n\tnode_iterator,\n\tCmp_Fn,\n\tAllocator>* \n      null_node_update_pointer;\n    };\n\n    template<typename Key,\n\t     class Cmp_Fn,\n\t     template<typename Const_Node_Iterator,\n\t\t      class Node_Iterator,\n\t\t      class Cmp_Fn_,\n\t\t      class Allocator_>\n    class Node_Update,\n\t     class Allocator>\n    struct tree_traits<\n      Key,\n      null_mapped_type,\n      Cmp_Fn,\n      Node_Update,\n      ov_tree_tag,\n      Allocator>\n    {\n    private:\n      typedef\n      typename types_traits<\n      Key,\n      null_mapped_type,\n      Allocator,\n      false>::value_type\n      value_type;\n\n    public:\n      typedef\n      typename tree_node_metadata_selector<\n      Key,\n      null_mapped_type,\n      Cmp_Fn,\n      Node_Update,\n      Allocator>::type\n      metadata_type;\n\n      typedef\n      ov_tree_node_const_it_<\n\tvalue_type,\n\tmetadata_type,\n\tAllocator>\n      const_node_iterator;\n\n      typedef const_node_iterator node_iterator;\n\n      typedef\n      Node_Update<\n\tconst_node_iterator,\n\tconst_node_iterator,\n\tCmp_Fn,\n\tAllocator>\n      node_update;\n\n      typedef\n      pb_ds::null_tree_node_update<\n\tconst_node_iterator,\n\tnode_iterator,\n\tCmp_Fn,\n\tAllocator>* \n      null_node_update_pointer;\n    };\n\n  } // namespace detail\n} // namespace pb_ds\n\n#endif // #ifndef PB_DS_OV_TREE_NODE_AND_IT_TRAITS_HPP\n\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/detail/pairing_heap_/constructors_destructor_fn_imps.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file constructors_destructor_fn_imps.hpp\n * Contains an implementation class for a pairing heap.\n */\n\nPB_DS_CLASS_T_DEC\ntemplate<typename It>\nvoid\nPB_DS_CLASS_C_DEC::\ncopy_from_range(It first_it, It last_it)\n{\n  while (first_it != last_it)\n    push(*(first_it++));\n\n  _GLIBCXX_DEBUG_ONLY(assert_valid();)\n    }\n\nPB_DS_CLASS_T_DEC\nPB_DS_CLASS_C_DEC::\npairing_heap_()\n{\n  _GLIBCXX_DEBUG_ONLY(assert_valid();)\n    }\n\nPB_DS_CLASS_T_DEC\nPB_DS_CLASS_C_DEC::\npairing_heap_(const Cmp_Fn& r_cmp_fn) :\n  PB_DS_BASE_C_DEC(r_cmp_fn)\n{\n  _GLIBCXX_DEBUG_ONLY(assert_valid();)\n    }\n\nPB_DS_CLASS_T_DEC\nPB_DS_CLASS_C_DEC::\npairing_heap_(const PB_DS_CLASS_C_DEC& other) :\n  PB_DS_BASE_C_DEC(other)\n{\n  _GLIBCXX_DEBUG_ONLY(assert_valid();)\n    }\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nswap(PB_DS_CLASS_C_DEC& other)\n{\n  _GLIBCXX_DEBUG_ONLY(assert_valid();)\n\n    PB_DS_BASE_C_DEC::swap(other);\n\n  _GLIBCXX_DEBUG_ONLY(assert_valid();)\n    }\n\nPB_DS_CLASS_T_DEC\nPB_DS_CLASS_C_DEC::\n~pairing_heap_()\n{ }\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/detail/pairing_heap_/debug_fn_imps.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file debug_fn_imps.hpp\n * Contains an implementation class for a pairing heap.\n */\n\n#ifdef _GLIBCXX_DEBUG\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nassert_valid() const\n{\n  _GLIBCXX_DEBUG_ASSERT(base_type::m_p_root == NULL \n\t\t        || base_type::m_p_root->m_p_next_sibling == NULL);\n  base_type::assert_valid();\n}\n\n#endif \n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/detail/pairing_heap_/erase_fn_imps.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file erase_fn_imps.hpp\n * Contains an implementation class for a pairing heap.\n */\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\npop()\n{\n  _GLIBCXX_DEBUG_ONLY(assert_valid();)\n  _GLIBCXX_DEBUG_ASSERT(!base_type::empty());\n\n  node_pointer p_new_root = join_node_children(base_type::m_p_root);\n  _GLIBCXX_DEBUG_ONLY(assert_node_consistent(p_new_root, false);)\n  if (p_new_root != NULL)\n    p_new_root->m_p_prev_or_parent = NULL;\n\n  base_type::actual_erase_node(base_type::m_p_root);\n  base_type::m_p_root = p_new_root;\n  _GLIBCXX_DEBUG_ONLY(assert_valid();)\n}\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nerase(point_iterator it)\n{\n  _GLIBCXX_DEBUG_ONLY(assert_valid();)\n  _GLIBCXX_DEBUG_ASSERT(!base_type::empty());\n  remove_node(it.m_p_nd);\n  base_type::actual_erase_node(it.m_p_nd);\n  _GLIBCXX_DEBUG_ONLY(assert_valid();)\n}\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nremove_node(node_pointer p_nd)\n{\n  _GLIBCXX_DEBUG_ONLY(assert_valid();)\n  _GLIBCXX_DEBUG_ASSERT(!base_type::empty());\n  node_pointer p_new_child = join_node_children(p_nd);\n\n#ifdef _GLIBCXX_DEBUG\n  if (p_new_child != NULL)\n    base_type::assert_node_consistent(p_new_child, false);\n#endif \n\n  if (p_nd == base_type::m_p_root)\n    {\n      if (p_new_child != NULL)\n\tp_new_child->m_p_prev_or_parent = NULL;\n      base_type::m_p_root = p_new_child;\n      _GLIBCXX_DEBUG_ONLY(base_type::assert_node_consistent(base_type::m_p_root, false);)\n      return;\n    }\n\n  _GLIBCXX_DEBUG_ASSERT(p_nd->m_p_prev_or_parent != NULL);\n  if (p_nd->m_p_prev_or_parent->m_p_l_child == p_nd)\n    {\n      if (p_new_child != NULL)\n        {\n\t  p_new_child->m_p_prev_or_parent = p_nd->m_p_prev_or_parent;\n\t  p_new_child->m_p_next_sibling = p_nd->m_p_next_sibling;\n\t  if (p_new_child->m_p_next_sibling != NULL)\n\t    p_new_child->m_p_next_sibling->m_p_prev_or_parent = p_new_child;\n\t  p_nd->m_p_prev_or_parent->m_p_l_child = p_new_child;\n\t  _GLIBCXX_DEBUG_ONLY(base_type::assert_node_consistent(p_nd->m_p_prev_or_parent, false);)\n          return;\n        }\n\n      p_nd->m_p_prev_or_parent->m_p_l_child = p_nd->m_p_next_sibling;\n      if (p_nd->m_p_next_sibling != NULL)\n\tp_nd->m_p_next_sibling->m_p_prev_or_parent = p_nd->m_p_prev_or_parent;\n      _GLIBCXX_DEBUG_ONLY(base_type::assert_node_consistent(p_nd->m_p_prev_or_parent, false);)\n      return;\n    }\n\n  if (p_new_child != NULL)\n    {\n      p_new_child->m_p_prev_or_parent = p_nd->m_p_prev_or_parent;\n      p_new_child->m_p_next_sibling = p_nd->m_p_next_sibling;\n      if (p_new_child->m_p_next_sibling != NULL)\n\tp_new_child->m_p_next_sibling->m_p_prev_or_parent = p_new_child;\n      p_new_child->m_p_prev_or_parent->m_p_next_sibling = p_new_child;\n      _GLIBCXX_DEBUG_ONLY(base_type::assert_node_consistent(p_nd->m_p_prev_or_parent, false);)\n      return;\n    }\n\n  p_nd->m_p_prev_or_parent->m_p_next_sibling = p_nd->m_p_next_sibling;\n  if (p_nd->m_p_next_sibling != NULL)\n    p_nd->m_p_next_sibling->m_p_prev_or_parent = p_nd->m_p_prev_or_parent;\n  _GLIBCXX_DEBUG_ONLY(base_type::assert_node_consistent(p_nd->m_p_prev_or_parent, false);)\n}\n\nPB_DS_CLASS_T_DEC\ntypename PB_DS_CLASS_C_DEC::node_pointer\nPB_DS_CLASS_C_DEC::\njoin_node_children(node_pointer p_nd)\n{\n  _GLIBCXX_DEBUG_ASSERT(p_nd != NULL);\n  node_pointer p_ret = p_nd->m_p_l_child;\n  if (p_ret == NULL)\n    return NULL;\n  while (p_ret->m_p_next_sibling != NULL)\n    p_ret = forward_join(p_ret, p_ret->m_p_next_sibling);\n  while (p_ret->m_p_prev_or_parent != p_nd)\n    p_ret = back_join(p_ret->m_p_prev_or_parent, p_ret);\n  _GLIBCXX_DEBUG_ONLY(assert_node_consistent(p_ret, false);)\n  return p_ret;\n}\n\nPB_DS_CLASS_T_DEC\ntypename PB_DS_CLASS_C_DEC::node_pointer\nPB_DS_CLASS_C_DEC::\nforward_join(node_pointer p_nd, node_pointer p_next)\n{\n  _GLIBCXX_DEBUG_ASSERT(p_nd != NULL);\n  _GLIBCXX_DEBUG_ASSERT(p_nd->m_p_next_sibling == p_next);\n  if (Cmp_Fn::operator()(p_nd->m_value, p_next->m_value))\n    {\n      p_next->m_p_prev_or_parent = p_nd->m_p_prev_or_parent;\n      base_type::make_child_of(p_nd, p_next);\n      return p_next->m_p_next_sibling == NULL \n\t? p_next : p_next->m_p_next_sibling;\n    }\n\n  if (p_next->m_p_next_sibling != NULL)\n    {\n      p_next->m_p_next_sibling->m_p_prev_or_parent = p_nd;\n      p_nd->m_p_next_sibling = p_next->m_p_next_sibling;\n      base_type::make_child_of(p_next, p_nd);\n      return p_nd->m_p_next_sibling;\n    }\n\n  p_nd->m_p_next_sibling = NULL;\n  base_type::make_child_of(p_next, p_nd);\n  _GLIBCXX_DEBUG_ONLY(base_type::assert_node_consistent(p_nd, false));\n  return p_nd;\n}\n\nPB_DS_CLASS_T_DEC\ntypename PB_DS_CLASS_C_DEC::node_pointer\nPB_DS_CLASS_C_DEC::\nback_join(node_pointer p_nd, node_pointer p_next)\n{\n  _GLIBCXX_DEBUG_ASSERT(p_nd != NULL);\n  _GLIBCXX_DEBUG_ASSERT(p_next->m_p_next_sibling == NULL);\n\n  if (Cmp_Fn::operator()(p_nd->m_value, p_next->m_value))\n    {\n      p_next->m_p_prev_or_parent = p_nd->m_p_prev_or_parent;\n      base_type::make_child_of(p_nd, p_next);\n      _GLIBCXX_DEBUG_ONLY(base_type::assert_node_consistent(p_next, false));\n      return p_next;\n    }\n\n  p_nd->m_p_next_sibling = NULL;\n  base_type::make_child_of(p_next, p_nd);\n  _GLIBCXX_DEBUG_ONLY(base_type::assert_node_consistent(p_nd, false));\n  return p_nd;\n}\n\nPB_DS_CLASS_T_DEC\ntemplate<typename Pred>\ntypename PB_DS_CLASS_C_DEC::size_type\nPB_DS_CLASS_C_DEC::\nerase_if(Pred pred)\n{\n  _GLIBCXX_DEBUG_ONLY(assert_valid();)\n    if (base_type::empty())\n      {\n        _GLIBCXX_DEBUG_ONLY(assert_valid();)\n\treturn 0;\n      }\n  base_type::to_linked_list();\n  node_pointer p_out = base_type::prune(pred);\n  size_type ersd = 0;\n  while (p_out != NULL)\n    {\n      ++ersd;\n      node_pointer p_next = p_out->m_p_next_sibling;\n      base_type::actual_erase_node(p_out);\n      p_out = p_next;\n    }\n\n  node_pointer p_cur = base_type::m_p_root;\n  base_type::m_p_root = NULL;\n  while (p_cur != NULL)\n    {\n      node_pointer p_next = p_cur->m_p_next_sibling;\n      p_cur->m_p_l_child = p_cur->m_p_next_sibling = p_cur->m_p_prev_or_parent = NULL;\n\n      push_imp(p_cur);\n      p_cur = p_next;\n    }\n  _GLIBCXX_DEBUG_ONLY(assert_valid();)\n  return ersd;\n}\n\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/detail/pairing_heap_/find_fn_imps.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file find_fn_imps.hpp\n * Contains an implementation class for a pairing heap.\n */\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::const_reference\nPB_DS_CLASS_C_DEC::\ntop() const\n{\n  _GLIBCXX_DEBUG_ONLY(assert_valid();)\n    _GLIBCXX_DEBUG_ASSERT(!base_type::empty());\n\n  return base_type::m_p_root->m_value;\n}\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/detail/pairing_heap_/insert_fn_imps.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file insert_fn_imps.hpp\n * Contains an implementation class for a pairing heap.\n */\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::point_iterator\nPB_DS_CLASS_C_DEC::\npush(const_reference r_val)\n{\n  _GLIBCXX_DEBUG_ONLY(assert_valid();)\n\n    node_pointer p_new_nd = base_type::get_new_node_for_insert(r_val);\n\n  push_imp(p_new_nd);\n\n  _GLIBCXX_DEBUG_ONLY(assert_valid();)\n\n    return point_iterator(p_new_nd);\n}\n\nPB_DS_CLASS_T_DEC\ninline void\nPB_DS_CLASS_C_DEC::\npush_imp(node_pointer p_nd)\n{\n  p_nd->m_p_l_child = NULL;\n\n  if (base_type::m_p_root == NULL)\n    {\n      p_nd->m_p_next_sibling = p_nd->m_p_prev_or_parent = NULL;\n\n      base_type::m_p_root = p_nd;\n    }\n  else if (Cmp_Fn::operator()(base_type::m_p_root->m_value, p_nd->m_value))\n    {\n      p_nd->m_p_next_sibling = p_nd->m_p_prev_or_parent = NULL;\n\n      base_type::make_child_of(base_type::m_p_root, p_nd);\n      _GLIBCXX_DEBUG_ONLY(base_type::assert_node_consistent(p_nd, false));\n\n      base_type::m_p_root = p_nd;\n    }\n  else\n    {\n      base_type::make_child_of(p_nd, base_type::m_p_root);\n      _GLIBCXX_DEBUG_ONLY(base_type::assert_node_consistent(base_type::m_p_root, false));\n    }\n}\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nmodify(point_iterator it, const_reference r_new_val)\n{\n  _GLIBCXX_DEBUG_ONLY(assert_valid();)\n\n    remove_node(it.m_p_nd);\n\n  it.m_p_nd->m_value = r_new_val;\n\n  push_imp(it.m_p_nd);\n\n  _GLIBCXX_DEBUG_ONLY(assert_valid();)\n    }\n\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/detail/pairing_heap_/pairing_heap_.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file pairing_heap_.hpp\n * Contains an implementation class for a pairing heap.\n */\n\n/*\n * Pairing heap:\n * Michael L. Fredman, Robert Sedgewick, Daniel Dominic Sleator,\n *    and Robert Endre Tarjan, The Pairing Heap:\n *    A New Form of Self-Adjusting Heap, Algorithmica, 1(1):111-129, 1986.\n */\n\n#include <ext/pb_ds/detail/cond_dealtor.hpp>\n#include <ext/pb_ds/detail/type_utils.hpp>\n#include <ext/pb_ds/detail/left_child_next_sibling_heap_/left_child_next_sibling_heap_.hpp>\n#include <ext/pb_ds/detail/left_child_next_sibling_heap_/null_metadata.hpp>\n#include <debug/debug.h>\n\nnamespace pb_ds\n{\n  namespace detail\n  {\n\n#define PB_DS_CLASS_T_DEC \\\n    template<typename Value_Type, class Cmp_Fn, class Allocator>\n\n#define PB_DS_CLASS_C_DEC \\\n    pairing_heap_<Value_Type, Cmp_Fn, Allocator>\n\n#ifdef _GLIBCXX_DEBUG\n#define PB_DS_BASE_C_DEC \\\n    left_child_next_sibling_heap_<\t\t\t\\\n\t\t\t\t\t\t\t\t\tValue_Type, \\\n\t\t\t\t\t\t\t\t\tCmp_Fn,\t\\\n\t\t\t\t\t\t\t\t\tnull_left_child_next_sibling_heap_node_metadata, \\\n\t\t\t\t\t\t\t\t\tAllocator, \\\n\t\t\t\t\t\t\t\t\tfalse>\n#else \n#define PB_DS_BASE_C_DEC\t\t\t\t\t\t\\\n    left_child_next_sibling_heap_<\t\t\t\\\n\t\t\t\t\t\t\t\t\tValue_Type, \\\n\t\t\t\t\t\t\t\t\tCmp_Fn,\t\\\n\t\t\t\t\t\t\t\t\tnull_left_child_next_sibling_heap_node_metadata, \\\n\t\t\t\t\t\t\t\t\tAllocator>\n#endif \n\n    /**\n     * class description = \"P4ri|\\|g h3ap$\">\n     **/\n    template<typename Value_Type, class Cmp_Fn, class Allocator>\n    class pairing_heap_ : public PB_DS_BASE_C_DEC\n    {\n\n    private:\n      typedef PB_DS_BASE_C_DEC base_type;\n\n      typedef typename base_type::node_pointer node_pointer;\n\n    public:\n\n      typedef typename Allocator::size_type size_type;\n\n      typedef typename Allocator::difference_type difference_type;\n\n      typedef Value_Type value_type;\n\n      typedef\n      typename Allocator::template rebind<\n\tvalue_type>::other::pointer\n      pointer;\n\n      typedef\n      typename Allocator::template rebind<\n\tvalue_type>::other::const_pointer\n      const_pointer;\n\n      typedef\n      typename Allocator::template rebind<\n\tvalue_type>::other::reference\n      reference;\n\n      typedef\n      typename Allocator::template rebind<\n\tvalue_type>::other::const_reference\n      const_reference;\n\n      typedef\n      typename PB_DS_BASE_C_DEC::const_point_iterator\n      const_point_iterator;\n\n      typedef typename PB_DS_BASE_C_DEC::point_iterator point_iterator;\n\n      typedef typename PB_DS_BASE_C_DEC::const_iterator const_iterator;\n\n      typedef typename PB_DS_BASE_C_DEC::iterator iterator;\n\n      typedef Cmp_Fn cmp_fn;\n\n      typedef Allocator allocator;\n\n\n      pairing_heap_();\n\n      pairing_heap_(const Cmp_Fn& r_cmp_fn);\n\n      pairing_heap_(const PB_DS_CLASS_C_DEC& other);\n\n      void\n      swap(PB_DS_CLASS_C_DEC& other);\n\n      ~pairing_heap_();\n\n      inline point_iterator\n      push(const_reference r_val);\n\n      void\n      modify(point_iterator it, const_reference r_new_val);\n\n      inline const_reference\n      top() const;\n\n      void\n      pop();\n\n      void\n      erase(point_iterator it);\n\n      template<typename Pred>\n      size_type\n      erase_if(Pred pred);\n\n      template<typename Pred>\n      void\n      split(Pred pred, PB_DS_CLASS_C_DEC& other);\n\n      void\n      join(PB_DS_CLASS_C_DEC& other);\n\n    protected:\n\n      template<typename It>\n      void\n      copy_from_range(It first_it, It last_it);\n\n#ifdef _GLIBCXX_DEBUG\n      void\n      assert_valid() const;\n#endif\n\n    private:\n\n      inline void\n      push_imp(node_pointer p_nd);\n\n      node_pointer\n      join_node_children(node_pointer p_nd);\n\n      node_pointer\n      forward_join(node_pointer p_nd, node_pointer p_next);\n\n      node_pointer\n      back_join(node_pointer p_nd, node_pointer p_next);\n\n      void\n      remove_node(node_pointer p_nd);\n\n    };\n\n#include <ext/pb_ds/detail/pairing_heap_/constructors_destructor_fn_imps.hpp>\n#include <ext/pb_ds/detail/pairing_heap_/debug_fn_imps.hpp>\n#include <ext/pb_ds/detail/pairing_heap_/find_fn_imps.hpp>\n#include <ext/pb_ds/detail/pairing_heap_/insert_fn_imps.hpp>\n#include <ext/pb_ds/detail/pairing_heap_/erase_fn_imps.hpp>\n#include <ext/pb_ds/detail/pairing_heap_/split_join_fn_imps.hpp>\n\n#undef PB_DS_CLASS_C_DEC\n#undef PB_DS_CLASS_T_DEC\n#undef PB_DS_BASE_C_DEC\n\n  } // namespace detail\n} // namespace pb_ds\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/detail/pairing_heap_/split_join_fn_imps.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file split_join_fn_imps.hpp\n * Contains an implementation class for a pairing heap.\n */\n\nPB_DS_CLASS_T_DEC\ntemplate<typename Pred>\nvoid\nPB_DS_CLASS_C_DEC::\nsplit(Pred pred, PB_DS_CLASS_C_DEC& other)\n{\n  _GLIBCXX_DEBUG_ONLY(assert_valid();)\n    _GLIBCXX_DEBUG_ONLY(other.assert_valid();)\n\n    other.clear();\n\n  if (base_type::empty())\n    {\n      _GLIBCXX_DEBUG_ONLY(assert_valid();)\n        _GLIBCXX_DEBUG_ONLY(other.assert_valid();)\n\n        return;\n    }\n\n  base_type::to_linked_list();\n\n  node_pointer p_out = base_type::prune(pred);\n\n  while (p_out != NULL)\n    {\n      _GLIBCXX_DEBUG_ASSERT(base_type::m_size > 0);\n      --base_type::m_size;\n\n      ++other.m_size;\n\n      node_pointer p_next = p_out->m_p_next_sibling;\n\n      p_out->m_p_l_child = p_out->m_p_next_sibling = p_out->m_p_prev_or_parent = NULL;\n\n      other.push_imp(p_out);\n\n      p_out = p_next;\n    }\n\n  _GLIBCXX_DEBUG_ONLY(other.assert_valid();)\n\n    node_pointer p_cur = base_type::m_p_root;\n\n  base_type::m_p_root = NULL;\n\n  while (p_cur != NULL)\n    {\n      node_pointer p_next = p_cur->m_p_next_sibling;\n\n      p_cur->m_p_l_child = p_cur->m_p_next_sibling = p_cur->m_p_prev_or_parent = NULL;\n\n      push_imp(p_cur);\n\n      p_cur = p_next;\n    }\n\n  _GLIBCXX_DEBUG_ONLY(assert_valid();)\n    _GLIBCXX_DEBUG_ONLY(other.assert_valid();)\n    }\n\nPB_DS_CLASS_T_DEC\ninline void\nPB_DS_CLASS_C_DEC::\njoin(PB_DS_CLASS_C_DEC& other)\n{\n  _GLIBCXX_DEBUG_ONLY(assert_valid();)\n    _GLIBCXX_DEBUG_ONLY(other.assert_valid();)\n\n    if (other.m_p_root == NULL)\n      {\n        _GLIBCXX_DEBUG_ONLY(assert_valid();)\n\t  _GLIBCXX_DEBUG_ONLY(other.assert_valid();)\n\n\t  return;\n      }\n\n  if (base_type::m_p_root == NULL)\n    base_type::m_p_root = other.m_p_root;\n  else if (Cmp_Fn::operator()(base_type::m_p_root->m_value, other.m_p_root->m_value))\n    {\n      base_type::make_child_of(base_type::m_p_root, other.m_p_root);\n      _GLIBCXX_DEBUG_ONLY(base_type::assert_node_consistent(other.m_p_root, false));\n\n      base_type::m_p_root = other.m_p_root;\n    }\n  else\n    {\n      base_type::make_child_of(other.m_p_root, base_type::m_p_root);\n      _GLIBCXX_DEBUG_ONLY(base_type::assert_node_consistent(base_type::m_p_root, false));\n    }\n\n  base_type::m_size += other.m_size;\n\n  other.m_p_root = NULL;\n  other.m_size = 0;\n\n  _GLIBCXX_DEBUG_ONLY(assert_valid();)\n    _GLIBCXX_DEBUG_ONLY(other.assert_valid();)\n    }\n\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/detail/pat_trie_/child_iterator.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file child_iterator.hpp\n * Contains a iterator for a patricia tree.\n */\n\nstruct iterator : public const_iterator\n{\npublic:\n  typedef std::forward_iterator_tag iterator_category;\n  typedef typename Allocator::difference_type difference_type;\n  typedef node_pointer value_type;\n  typedef node_pointer_pointer pointer;\n  typedef node_pointer_reference reference;\n\n  inline\n  iterator(node_pointer_pointer p_p_cur = NULL,  \n\t   node_pointer_pointer p_p_end = NULL) \n  : const_iterator(p_p_cur, p_p_end)\n  { }\n\n  inline bool\n  operator==(const iterator& other) const\n  { return const_iterator::m_p_p_cur == other.m_p_p_cur; }\n\n  inline bool\n  operator!=(const iterator& other) const\n  { return const_iterator::m_p_p_cur != other.m_p_p_cur; }\n\n  inline iterator& \n  operator++()\n  {\n    const_iterator::operator++();\n    return *this;\n  }\n\n  inline iterator\n  operator++(int)\n  {\n    iterator ret_it(*this);\n    operator++();\n    return ret_it;\n  }\n\n  node_pointer_pointer\n  operator->()\n  {\n    _GLIBCXX_DEBUG_ONLY(const_iterator::assert_referencible();)\n    return const_iterator::m_p_p_cur;\n  }\n\n  node_pointer\n  operator*()\n  {\n    _GLIBCXX_DEBUG_ONLY(const_iterator::assert_referencible();)\n    return *const_iterator::m_p_p_cur;\n  }\n};\n\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/detail/pat_trie_/cond_dtor_entry_dealtor.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file cond_dtor_entry_dealtor.hpp\n * Contains a binary tree container conditional deallocator\n */\n\nclass cond_dealtor\n{\npublic:\n  inline\n  cond_dealtor(leaf_pointer p_nd) : m_p_nd(p_nd),\n\t\t\t\t    m_no_action_dtor(false),\n\t\t\t\t    m_call_destructor(false)\n  { }\n\n  inline void\n  set_no_action_dtor()\n  {\n    m_no_action_dtor = true;\n  }\n\n  inline void\n  set_call_destructor()\n  {\n    m_call_destructor = true;\n  }\n\n  inline\n  ~cond_dealtor()\n  {\n    if (m_no_action_dtor)\n      return;\n\n    if (m_call_destructor)\n      m_p_nd->~leaf();\n\n    s_leaf_allocator.deallocate(m_p_nd, 1);\n  }\n\nprotected:\n  leaf_pointer m_p_nd;\n  bool m_no_action_dtor;\n  bool m_call_destructor;\n};\n\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/detail/pat_trie_/const_child_iterator.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file const_child_iterator.hpp\n * Contains a const_iterator for a patricia tree.\n */\n\nstruct const_iterator\n{\npublic:\n  typedef std::forward_iterator_tag iterator_category;\n\n  typedef typename Allocator::difference_type difference_type;\n\n  typedef node_pointer value_type;\n\n  typedef node_pointer_pointer pointer;\n\n  typedef node_pointer_reference reference;\n\npublic:\n  inline\n  const_iterator(node_pointer_pointer p_p_cur = NULL,  \n\t\t node_pointer_pointer p_p_end = NULL) \n  : m_p_p_cur(p_p_cur), m_p_p_end(p_p_end)\n  { }\n\n  inline bool\n  operator==(const const_iterator& other) const\n  { return m_p_p_cur == other.m_p_p_cur; }\n\n  inline bool\n  operator!=(const const_iterator& other) const\n  { return m_p_p_cur != other.m_p_p_cur; }\n\n  inline const_iterator& \n  operator++()\n  {\n    do\n      ++m_p_p_cur;\n    while (m_p_p_cur != m_p_p_end&& * m_p_p_cur == NULL);\n    return *this;\n  }\n\n  inline const_iterator\n  operator++(int)\n  {\n    const_iterator ret_it(*this);\n    operator++();\n    return ret_it;\n  }\n\n  const node_pointer_pointer\n  operator->() const\n  {\n    _GLIBCXX_DEBUG_ONLY(assert_referencible();)\n    return (m_p_p_cur);\n  }\n\n  const_node_pointer\n  operator*() const\n  {\n    _GLIBCXX_DEBUG_ONLY(assert_referencible();)\n    return (*m_p_p_cur);\n  }\n\nprotected:\n#ifdef _GLIBCXX_DEBUG\n  void\n  assert_referencible() const\n  { _GLIBCXX_DEBUG_ASSERT(m_p_p_cur != m_p_p_end&& * m_p_p_cur != NULL); }\n#endif \n\npublic:\n  node_pointer_pointer m_p_p_cur;\n  node_pointer_pointer m_p_p_end;\n};\n\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/detail/pat_trie_/constructors_destructor_fn_imps.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file constructors_destructor_fn_imps.hpp\n * Contains an implementation class for bin_search_tree_.\n */\n\nPB_DS_CLASS_T_DEC\ntypename PB_DS_CLASS_C_DEC::head_allocator\nPB_DS_CLASS_C_DEC::s_head_allocator;\n\nPB_DS_CLASS_T_DEC\ntypename PB_DS_CLASS_C_DEC::internal_node_allocator\nPB_DS_CLASS_C_DEC::s_internal_node_allocator;\n\nPB_DS_CLASS_T_DEC\ntypename PB_DS_CLASS_C_DEC::leaf_allocator\nPB_DS_CLASS_C_DEC::s_leaf_allocator;\n\nPB_DS_CLASS_T_DEC\nPB_DS_CLASS_C_DEC::\nPB_DS_CLASS_NAME() :\n  m_p_head(s_head_allocator.allocate(1)),\n  m_size(0)\n{\n  initialize();\n  _GLIBCXX_DEBUG_ONLY(assert_valid();)\n}\n\nPB_DS_CLASS_T_DEC\nPB_DS_CLASS_C_DEC::\nPB_DS_CLASS_NAME(const e_access_traits& r_e_access_traits) :\n  synth_e_access_traits(r_e_access_traits),\n  m_p_head(s_head_allocator.allocate(1)),\n  m_size(0)\n{\n  initialize();\n  _GLIBCXX_DEBUG_ONLY(assert_valid();)\n}\n\nPB_DS_CLASS_T_DEC\nPB_DS_CLASS_C_DEC::\nPB_DS_CLASS_NAME(const PB_DS_CLASS_C_DEC& other) :\n#ifdef _GLIBCXX_DEBUG\n  map_debug_base(other),\n#endif \n  synth_e_access_traits(other),\n  node_update(other),\n  m_p_head(s_head_allocator.allocate(1)),\n  m_size(0)\n{\n  initialize();\n  m_size = other.m_size;\n  _GLIBCXX_DEBUG_ONLY(other.assert_valid();)\n    if (other.m_p_head->m_p_parent == NULL)\n      {\n        _GLIBCXX_DEBUG_ONLY(assert_valid();)\n        return;\n      }\n  try\n    {\n      m_p_head->m_p_parent = recursive_copy_node(other.m_p_head->m_p_parent);\n    }\n  catch(...)\n    {\n      s_head_allocator.deallocate(m_p_head, 1);\n      __throw_exception_again;\n    }\n\n  m_p_head->m_p_min = leftmost_descendant(m_p_head->m_p_parent);\n  m_p_head->m_p_max = rightmost_descendant(m_p_head->m_p_parent);\n  m_p_head->m_p_parent->m_p_parent = m_p_head;\n  _GLIBCXX_DEBUG_ONLY(assert_valid();)\n}\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nswap(PB_DS_CLASS_C_DEC& other)\n{\n  _GLIBCXX_DEBUG_ONLY(assert_valid();)\n  _GLIBCXX_DEBUG_ONLY(other.assert_valid();)\n  value_swap(other);\n  std::swap((e_access_traits& )(*this), (e_access_traits& )other);\n  _GLIBCXX_DEBUG_ONLY(assert_valid();)\n  _GLIBCXX_DEBUG_ONLY(other.assert_valid();)\n}\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nvalue_swap(PB_DS_CLASS_C_DEC& other)\n{\n  _GLIBCXX_DEBUG_ONLY(map_debug_base::swap(other);)\n  std::swap(m_p_head, other.m_p_head);\n  std::swap(m_size, other.m_size);\n}\n\nPB_DS_CLASS_T_DEC\nPB_DS_CLASS_C_DEC::\n~PB_DS_CLASS_NAME()\n{\n  clear();\n  s_head_allocator.deallocate(m_p_head, 1);\n}\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\ninitialize()\n{\n  new (m_p_head) head();\n  m_p_head->m_p_parent = NULL;\n  m_p_head->m_p_min = m_p_head;\n  m_p_head->m_p_max = m_p_head;\n  m_size = 0;\n}\n\nPB_DS_CLASS_T_DEC\ntemplate<typename It>\nvoid\nPB_DS_CLASS_C_DEC::\ncopy_from_range(It first_it, It last_it)\n{\n  while (first_it != last_it)\n    insert(*(first_it++));\n}\n\nPB_DS_CLASS_T_DEC\ntypename PB_DS_CLASS_C_DEC::node_pointer\nPB_DS_CLASS_C_DEC::\nrecursive_copy_node(const_node_pointer p_other_nd)\n{\n  _GLIBCXX_DEBUG_ASSERT(p_other_nd != NULL);\n  if (p_other_nd->m_type == pat_trie_leaf_node_type)\n    {\n      const_leaf_pointer p_other_leaf = static_cast<const_leaf_pointer>(p_other_nd);\n\n      leaf_pointer p_new_lf = s_leaf_allocator.allocate(1);\n      cond_dealtor cond(p_new_lf);\n      new (p_new_lf) leaf(p_other_leaf->value());\n      apply_update(p_new_lf, (node_update* )this);\n      cond.set_no_action_dtor();\n      return (p_new_lf);\n    }\n\n  _GLIBCXX_DEBUG_ASSERT(p_other_nd->m_type == pat_trie_internal_node_type);\n  node_pointer a_p_children[internal_node::arr_size];\n  size_type child_i = 0;\n  const_internal_node_pointer p_other_internal_nd =\n    static_cast<const_internal_node_pointer>(p_other_nd);\n\n  typename internal_node::const_iterator child_it =\n    p_other_internal_nd->begin();\n\n  internal_node_pointer p_ret;\n  try\n    {\n      while (child_it != p_other_internal_nd->end())\n\ta_p_children[child_i++] = recursive_copy_node(*(child_it++));\n      p_ret = s_internal_node_allocator.allocate(1);\n    }\n  catch(...)\n    {\n      while (child_i-- > 0)\n\tclear_imp(a_p_children[child_i]);\n      __throw_exception_again;\n    }\n\n  new (p_ret) internal_node(p_other_internal_nd->get_e_ind(),\n\t\t\t    pref_begin(a_p_children[0]));\n\n  --child_i;\n  _GLIBCXX_DEBUG_ASSERT(child_i > 1);\n  do\n    p_ret->add_child(a_p_children[child_i], pref_begin(a_p_children[child_i]),\n\t\t     pref_end(a_p_children[child_i]), this);\n  while (child_i-- > 0);\n  apply_update(p_ret, (node_update* )this);\n  return p_ret;\n}\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/detail/pat_trie_/debug_fn_imps.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file debug_fn_imps.hpp\n * Contains an implementation class for pat_trie_.\n */\n\n#ifdef _GLIBCXX_DEBUG\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nassert_valid() const\n{\n  if (m_p_head->m_p_parent != NULL)\n    m_p_head->m_p_parent->assert_valid(this);\n  assert_iterators();\n  assert_reverse_iterators();\n  if (m_p_head->m_p_parent == NULL)\n    {\n      _GLIBCXX_DEBUG_ASSERT(m_p_head->m_p_min == m_p_head);\n      _GLIBCXX_DEBUG_ASSERT(m_p_head->m_p_max == m_p_head);\n      _GLIBCXX_DEBUG_ASSERT(empty());\n      return;\n    }\n\n  _GLIBCXX_DEBUG_ASSERT(m_p_head->m_p_min->m_type == pat_trie_leaf_node_type);\n  _GLIBCXX_DEBUG_ASSERT(m_p_head->m_p_max->m_type == pat_trie_leaf_node_type);\n  _GLIBCXX_DEBUG_ASSERT(!empty());\n}\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nassert_iterators() const\n{\n  size_type calc_size = 0;\n  for (const_iterator it = begin(); it != end(); ++it)\n    {\n      ++calc_size;\n      map_debug_base::check_key_exists(PB_DS_V2F(*it));\n      _GLIBCXX_DEBUG_ASSERT(lower_bound(PB_DS_V2F(*it)) == it);\n      _GLIBCXX_DEBUG_ASSERT(--upper_bound(PB_DS_V2F(*it)) == it);\n    }\n  _GLIBCXX_DEBUG_ASSERT(calc_size == m_size);\n}\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nassert_reverse_iterators() const\n{\n  size_type calc_size = 0;\n  for (const_reverse_iterator it = rbegin(); it != rend(); ++it)\n    {\n      ++calc_size;\n      const_node_pointer p_nd =\n\tconst_cast<PB_DS_CLASS_C_DEC* >(this)->find_imp(PB_DS_V2F(*it));\n      _GLIBCXX_DEBUG_ASSERT(p_nd == it.m_p_nd);\n    }\n  _GLIBCXX_DEBUG_ASSERT(calc_size == m_size);\n}\n\nPB_DS_CLASS_T_DEC\ntypename PB_DS_CLASS_C_DEC::size_type\nPB_DS_CLASS_C_DEC::\nrecursive_count_leafs(const_node_pointer p_nd)\n{\n  if (p_nd == NULL)\n    return (0);\n  if (p_nd->m_type == pat_trie_leaf_node_type)\n    return (1);\n  _GLIBCXX_DEBUG_ASSERT(p_nd->m_type == pat_trie_internal_node_type);\n  size_type ret = 0;\n  for (typename internal_node::const_iterator it =\n\t static_cast<const_internal_node_pointer>(p_nd)->begin();\n       it != static_cast<const_internal_node_pointer>(p_nd)->end();\n       ++it)\n    ret += recursive_count_leafs(*it);\n  return ret;\n}\n\n#endif \n\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/detail/pat_trie_/erase_fn_imps.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file erase_fn_imps.hpp\n * Contains an implementation class for bin_search_tree_.\n */\n\nPB_DS_CLASS_T_DEC\ninline bool\nPB_DS_CLASS_C_DEC::\nerase(const_key_reference r_key)\n{\n  node_pointer p_nd = find_imp(r_key);\n  if (p_nd == NULL || p_nd->m_type == pat_trie_internal_node_type)\n    {\n      _GLIBCXX_DEBUG_ONLY(map_debug_base::check_key_does_not_exist(r_key));\n      return false;\n    }\n\n  _GLIBCXX_DEBUG_ASSERT(p_nd->m_type == pat_trie_leaf_node_type);\n  if (!synth_e_access_traits::equal_keys(PB_DS_V2F(reinterpret_cast<leaf_pointer>(p_nd)->value()), r_key))\n    {\n      _GLIBCXX_DEBUG_ONLY(map_debug_base::check_key_does_not_exist(r_key));\n      return false;\n    }\n\n  _GLIBCXX_DEBUG_ONLY(map_debug_base::check_key_exists(r_key));\n  erase_leaf(static_cast<leaf_pointer>(p_nd));\n  _GLIBCXX_DEBUG_ONLY(assert_valid();)\n  return true;\n}\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nerase_fixup(internal_node_pointer p_nd)\n{\n  _GLIBCXX_DEBUG_ASSERT(std::distance(p_nd->begin(), p_nd->end()) >= 1);\n  if (std::distance(p_nd->begin(), p_nd->end()) == 1)\n    {\n      node_pointer p_parent = p_nd->m_p_parent;\n      if (p_parent == m_p_head)\n\tm_p_head->m_p_parent =* p_nd->begin();\n      else\n        {\n\t  _GLIBCXX_DEBUG_ASSERT(p_parent->m_type == pat_trie_internal_node_type);\n\t  node_pointer p_new_child =* p_nd->begin();\n\t  static_cast<internal_node_pointer>(p_parent)->replace_child(\n\t\t\t\t\t\t\t\t      p_new_child,\n\t\t\t\t\t\t\t\t      pref_begin(p_new_child),\n\t\t\t\t\t\t\t\t      pref_end(p_new_child),\n\t\t\t\t\t\t\t\t      this);\n        }\n      (*p_nd->begin())->m_p_parent = p_nd->m_p_parent;\n      p_nd->~internal_node();\n      s_internal_node_allocator.deallocate(p_nd, 1);\n\n      if (p_parent == m_p_head)\n\treturn;\n\n      _GLIBCXX_DEBUG_ASSERT(p_parent->m_type == pat_trie_internal_node_type);\n      p_nd = static_cast<internal_node_pointer>(p_parent);\n    }\n\n  while (true)\n    {\n      _GLIBCXX_DEBUG_ASSERT(std::distance(p_nd->begin(), p_nd->end()) > 1);\n      p_nd->update_prefixes(this);\n      apply_update(p_nd, (node_update* )this);\n      _GLIBCXX_DEBUG_ONLY(p_nd->assert_valid(this);)\n      if (p_nd->m_p_parent->m_type == pat_trie_head_node_type)\n        return;\n\n      _GLIBCXX_DEBUG_ASSERT(p_nd->m_p_parent->m_type ==\n\t\t       pat_trie_internal_node_type);\n\n      p_nd = static_cast<internal_node_pointer>(p_nd->m_p_parent);\n    }\n}\n\nPB_DS_CLASS_T_DEC\ninline void\nPB_DS_CLASS_C_DEC::\nactual_erase_leaf(leaf_pointer p_l)\n{\n  _GLIBCXX_DEBUG_ASSERT(m_size > 0);\n  --m_size;\n  _GLIBCXX_DEBUG_ONLY(erase_existing(PB_DS_V2F(p_l->value())));\n  p_l->~leaf();\n  s_leaf_allocator.deallocate(p_l, 1);\n}\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nclear()\n{\n  _GLIBCXX_DEBUG_ONLY(assert_valid();)\n  if (empty())\n    return;\n\n  clear_imp(m_p_head->m_p_parent);\n  m_size = 0;\n  initialize();\n  _GLIBCXX_DEBUG_ONLY(map_debug_base::clear();)\n  _GLIBCXX_DEBUG_ONLY(assert_valid();)\n}\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nclear_imp(node_pointer p_nd)\n{\n  if (p_nd->m_type == pat_trie_internal_node_type)\n    {\n      _GLIBCXX_DEBUG_ASSERT(p_nd->m_type == pat_trie_internal_node_type);\n      for (typename internal_node::iterator it =\n\t     static_cast<internal_node_pointer>(p_nd)->begin();\n\t   it != static_cast<internal_node_pointer>(p_nd)->end();\n\t   ++it)\n        {\n\t  node_pointer p_child =* it;\n\t  clear_imp(p_child);\n        }\n      s_internal_node_allocator.deallocate(static_cast<internal_node_pointer>(p_nd), 1);\n      return;\n    }\n\n  _GLIBCXX_DEBUG_ASSERT(p_nd->m_type == pat_trie_leaf_node_type);\n  static_cast<leaf_pointer>(p_nd)->~leaf();\n  s_leaf_allocator.deallocate(static_cast<leaf_pointer>(p_nd), 1);\n}\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::const_iterator\nPB_DS_CLASS_C_DEC::\nerase(const_iterator it)\n{\n  _GLIBCXX_DEBUG_ONLY(assert_valid());\n\n  if (it == end())\n    return it;\n\n  const_iterator ret_it = it;\n  ++ret_it;\n  _GLIBCXX_DEBUG_ASSERT(it.m_p_nd->m_type == pat_trie_leaf_node_type);\n  erase_leaf(static_cast<leaf_pointer>(it.m_p_nd));\n  _GLIBCXX_DEBUG_ONLY(assert_valid());\n  return ret_it;\n}\n\n#ifdef PB_DS_DATA_TRUE_INDICATOR\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::iterator\nPB_DS_CLASS_C_DEC::\nerase(iterator it)\n{\n  _GLIBCXX_DEBUG_ONLY(assert_valid());\n\n  if (it == end())\n    return it;\n  iterator ret_it = it;\n  ++ret_it;\n  _GLIBCXX_DEBUG_ASSERT(it.m_p_nd->m_type == pat_trie_leaf_node_type);\n  erase_leaf(static_cast<leaf_pointer>(it.m_p_nd));\n  _GLIBCXX_DEBUG_ONLY(assert_valid());\n  return ret_it;\n}\n#endif // #ifdef PB_DS_DATA_TRUE_INDICATOR\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::const_reverse_iterator\nPB_DS_CLASS_C_DEC::\nerase(const_reverse_iterator it)\n{\n  _GLIBCXX_DEBUG_ONLY(assert_valid());\n\n  if (it.m_p_nd == m_p_head)\n    return it;\n  const_reverse_iterator ret_it = it;\n  ++ret_it;\n\n  _GLIBCXX_DEBUG_ASSERT(it.m_p_nd->m_type == pat_trie_leaf_node_type);\n  erase_leaf(static_cast<leaf_pointer>(it.m_p_nd));\n  _GLIBCXX_DEBUG_ONLY(assert_valid());\n  return ret_it;\n}\n\n#ifdef PB_DS_DATA_TRUE_INDICATOR\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::reverse_iterator\nPB_DS_CLASS_C_DEC::\nerase(reverse_iterator it)\n{\n  _GLIBCXX_DEBUG_ONLY(assert_valid());\n\n  if (it.m_p_nd == m_p_head)\n    return it;\n  reverse_iterator ret_it = it;\n  ++ret_it;\n\n  _GLIBCXX_DEBUG_ASSERT(it.m_p_nd->m_type == pat_trie_leaf_node_type);\n  erase_leaf(static_cast<leaf_pointer>(it.m_p_nd));\n  _GLIBCXX_DEBUG_ONLY(assert_valid());\n  return ret_it;\n}\n#endif // #ifdef PB_DS_DATA_TRUE_INDICATOR\n\nPB_DS_CLASS_T_DEC\ntemplate<typename Pred>\ninline typename PB_DS_CLASS_C_DEC::size_type\nPB_DS_CLASS_C_DEC::\nerase_if(Pred pred)\n{\n  size_type num_ersd = 0;\n  _GLIBCXX_DEBUG_ONLY(assert_valid();)\n\n  iterator it = begin();\n  while (it != end())\n    {\n      _GLIBCXX_DEBUG_ONLY(assert_valid();)\n        if (pred(*it))\n\t  {\n            ++num_ersd;\n            it = erase(it);\n\t  }\n        else\n\t  ++it;\n    }\n\n  _GLIBCXX_DEBUG_ONLY(assert_valid();)\n  return num_ersd;\n}\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nerase_leaf(leaf_pointer p_l)\n{\n  update_min_max_for_erased_leaf(p_l);\n  if (p_l->m_p_parent->m_type == pat_trie_head_node_type)\n    {\n      _GLIBCXX_DEBUG_ASSERT(size() == 1);\n      clear();\n      return;\n    }\n\n  _GLIBCXX_DEBUG_ASSERT(size() > 1);\n  _GLIBCXX_DEBUG_ASSERT(p_l->m_p_parent->m_type ==\n\t\t   pat_trie_internal_node_type);\n\n  internal_node_pointer p_parent =\n    static_cast<internal_node_pointer>(p_l->m_p_parent);\n\n  p_parent->remove_child(p_l);\n  erase_fixup(p_parent);\n  actual_erase_leaf(p_l);\n}\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nupdate_min_max_for_erased_leaf(leaf_pointer p_l)\n{\n  if (m_size == 1)\n    {\n      m_p_head->m_p_min = m_p_head;\n      m_p_head->m_p_max = m_p_head;\n      return;\n    }\n\n  if (p_l == static_cast<const_leaf_pointer>(m_p_head->m_p_min))\n    {\n      iterator it(p_l);\n      ++it;\n      m_p_head->m_p_min = it.m_p_nd;\n      return;\n    }\n\n  if (p_l == static_cast<const_leaf_pointer>(m_p_head->m_p_max))\n    {\n      iterator it(p_l);\n      --it;\n      m_p_head->m_p_max = it.m_p_nd;\n    }\n}\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/detail/pat_trie_/find_fn_imps.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file find_fn_imps.hpp\n * Contains an implementation class for bin_search_tree_.\n */\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::point_iterator\nPB_DS_CLASS_C_DEC::\nfind(const_key_reference r_key)\n{\n  _GLIBCXX_DEBUG_ONLY(assert_valid();)\n  node_pointer p_nd = find_imp(r_key);\n\n  if (p_nd == NULL || p_nd->m_type != pat_trie_leaf_node_type)\n    {\n      _GLIBCXX_DEBUG_ONLY(map_debug_base::check_key_does_not_exist(r_key);)\n      return end();\n    }\n\n  if (synth_e_access_traits::equal_keys(PB_DS_V2F(static_cast<leaf_pointer>(p_nd)->value()), r_key))\n    {\n      _GLIBCXX_DEBUG_ONLY(map_debug_base::check_key_exists(r_key));\n      return iterator(p_nd);\n    }\n\n  _GLIBCXX_DEBUG_ONLY(map_debug_base::check_key_does_not_exist(r_key);)\n  return end();\n}\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::const_point_iterator\nPB_DS_CLASS_C_DEC::\nfind(const_key_reference r_key) const\n{\n  _GLIBCXX_DEBUG_ONLY(assert_valid();)\n\n  const_node_pointer p_nd = const_cast<PB_DS_CLASS_C_DEC* >(this)->find_imp(r_key);\n\n  if (p_nd == NULL || p_nd->m_type != pat_trie_leaf_node_type)\n    {\n      _GLIBCXX_DEBUG_ONLY(map_debug_base::check_key_does_not_exist(r_key);)\n      return end();\n    }\n\n  if (synth_e_access_traits::equal_keys(PB_DS_V2F(static_cast<const_leaf_pointer>(p_nd)->value()), r_key))\n    {\n      _GLIBCXX_DEBUG_ONLY(map_debug_base::check_key_exists(r_key));\n      return const_iterator(const_cast<node_pointer>(p_nd));\n    }\n\n  _GLIBCXX_DEBUG_ONLY(map_debug_base::check_key_does_not_exist(r_key);)\n  return end();\n}\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::node_pointer\nPB_DS_CLASS_C_DEC::\nfind_imp(const_key_reference r_key)\n{\n  if (empty())\n    return (NULL);\n\n  typename synth_e_access_traits::const_iterator b_it =\n    synth_e_access_traits::begin(r_key);\n  typename synth_e_access_traits::const_iterator e_it =\n    synth_e_access_traits::end(r_key);\n\n  node_pointer p_nd = m_p_head->m_p_parent;\n  _GLIBCXX_DEBUG_ASSERT(p_nd != NULL);\n\n  while (p_nd->m_type != pat_trie_leaf_node_type)\n    {\n      _GLIBCXX_DEBUG_ASSERT(p_nd->m_type == pat_trie_internal_node_type);\n      node_pointer p_next_nd = static_cast<internal_node_pointer>(p_nd)->get_child_node(b_it,  e_it,  this);\n\n      if (p_next_nd == NULL)\n\treturn p_nd;\n      p_nd = p_next_nd;\n    }\n  return p_nd;\n}\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::node_pointer\nPB_DS_CLASS_C_DEC::\nlower_bound_imp(const_key_reference r_key)\n{\n  if (empty())\n    return (m_p_head);\n\n  node_pointer p_nd = m_p_head->m_p_parent;\n  _GLIBCXX_DEBUG_ASSERT(p_nd != NULL);\n\n  typename PB_DS_CLASS_C_DEC::const_e_iterator b_it =\n    synth_e_access_traits::begin(r_key);\n\n  typename PB_DS_CLASS_C_DEC::const_e_iterator e_it =\n    synth_e_access_traits::end(r_key);\n\n  size_type checked_ind = 0;\n  while (true)\n    {\n      if (p_nd->m_type == pat_trie_leaf_node_type)\n        {\n\t  if (!synth_e_access_traits::cmp_keys(PB_DS_V2F(static_cast<const_leaf_pointer>(p_nd)->value()), r_key))\n\t    return p_nd;\n\t  iterator it(p_nd);\n\t  ++it;\n\t  return it.m_p_nd;\n        }\n\n      _GLIBCXX_DEBUG_ASSERT(p_nd->m_type == pat_trie_internal_node_type);\n      const size_type new_checked_ind =\n\tstatic_cast<internal_node_pointer>(p_nd)->get_e_ind();\n\n      p_nd =\n\tstatic_cast<internal_node_pointer>(p_nd)->get_lower_bound_child_node(                b_it, e_it, checked_ind, this);\n      checked_ind = new_checked_ind;\n    }\n}\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::point_iterator\nPB_DS_CLASS_C_DEC::\nlower_bound(const_key_reference r_key)\n{ return point_iterator(lower_bound_imp(r_key)); }\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::const_point_iterator\nPB_DS_CLASS_C_DEC::\nlower_bound(const_key_reference r_key) const\n{\n  return const_point_iterator(const_cast<PB_DS_CLASS_C_DEC* >(this)->lower_bound_imp(r_key));\n}\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::point_iterator\nPB_DS_CLASS_C_DEC::\nupper_bound(const_key_reference r_key)\n{\n  point_iterator l_bound_it = lower_bound(r_key);\n\n  _GLIBCXX_DEBUG_ASSERT(l_bound_it == end() ||\n\t\t   !synth_e_access_traits::cmp_keys(PB_DS_V2F(*l_bound_it),\n\t\t\t\t\t\t    r_key));\n\n  if (l_bound_it == end() ||\n      synth_e_access_traits::cmp_keys(r_key, PB_DS_V2F(*l_bound_it)))\n    return l_bound_it;\n\n  return ++l_bound_it;\n}\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::const_point_iterator\nPB_DS_CLASS_C_DEC::\nupper_bound(const_key_reference r_key) const\n{\n  const_point_iterator l_bound_it = lower_bound(r_key);\n\n  _GLIBCXX_DEBUG_ASSERT(l_bound_it == end() ||\n\t\t   !synth_e_access_traits::cmp_keys(PB_DS_V2F(*l_bound_it),\n\t\t\t\t\t\t    r_key));\n\n  if (l_bound_it == end() ||\n      synth_e_access_traits::cmp_keys(r_key, PB_DS_V2F(*l_bound_it)))\n    return l_bound_it;\n  return ++l_bound_it;\n}\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::const_e_iterator\nPB_DS_CLASS_C_DEC::\npref_begin(const_node_pointer p_nd)\n{\n  if (p_nd->m_type == pat_trie_leaf_node_type)\n    return (synth_e_access_traits::begin(PB_DS_V2F(static_cast<const_leaf_pointer>(p_nd)->value())));\n\n  _GLIBCXX_DEBUG_ASSERT(p_nd->m_type == pat_trie_internal_node_type);\n  return static_cast<const_internal_node_pointer>(p_nd)->pref_b_it();\n}\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::const_e_iterator\nPB_DS_CLASS_C_DEC::\npref_end(const_node_pointer p_nd)\n{\n  if (p_nd->m_type == pat_trie_leaf_node_type)\n    return (synth_e_access_traits::end(PB_DS_V2F(static_cast<const_leaf_pointer>(p_nd)->value())));\n\n  _GLIBCXX_DEBUG_ASSERT(p_nd->m_type == pat_trie_internal_node_type);\n  return static_cast<const_internal_node_pointer>(p_nd)->pref_e_it();\n}\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::const_leaf_pointer\nPB_DS_CLASS_C_DEC::\nleftmost_descendant(const_node_pointer p_nd)\n{\n  if (p_nd->m_type == pat_trie_leaf_node_type)\n    return static_cast<const_leaf_pointer>(p_nd);\n  return static_cast<const_internal_node_pointer>(p_nd)->leftmost_descendant();\n}\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::leaf_pointer\nPB_DS_CLASS_C_DEC::\nleftmost_descendant(node_pointer p_nd)\n{\n  if (p_nd->m_type == pat_trie_leaf_node_type)\n    return static_cast<leaf_pointer>(p_nd);\n  return static_cast<internal_node_pointer>(p_nd)->leftmost_descendant();\n}\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::const_leaf_pointer\nPB_DS_CLASS_C_DEC::\nrightmost_descendant(const_node_pointer p_nd)\n{\n  if (p_nd->m_type == pat_trie_leaf_node_type)\n    return static_cast<const_leaf_pointer>(p_nd);\n  return static_cast<const_internal_node_pointer>(p_nd)->rightmost_descendant();\n}\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::leaf_pointer\nPB_DS_CLASS_C_DEC::\nrightmost_descendant(node_pointer p_nd)\n{\n  if (p_nd->m_type == pat_trie_leaf_node_type)\n    return static_cast<leaf_pointer>(p_nd);\n  return static_cast<internal_node_pointer>(p_nd)->rightmost_descendant();\n}\n\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/detail/pat_trie_/head.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file head.hpp\n * Contains a leaf for a patricia tree.\n */\n\n#ifndef PB_DS_PAT_TRIE_IHEAD_HPP\n#define PB_DS_PAT_TRIE_IHEAD_HPP\n\n#include <ext/pb_ds/detail/pat_trie_/node_base.hpp>\n#include <debug/debug.h>\n\nnamespace pb_ds\n{\n  namespace detail\n  {\n#define PB_DS_CLASS_T_DEC \\\n    template<typename Type_Traits, typename E_Access_Traits,\t\\\n\t      typename Metadata, typename Allocator>\n\n#define PB_DS_CLASS_C_DEC \\\n    pat_trie_head<Type_Traits, E_Access_Traits,\tMetadata, Allocator>\n\n#define PB_DS_BASE_C_DEC \\\n    pat_trie_node_base<Type_Traits, E_Access_Traits, Metadata, Allocator>\n\n    template<typename Type_Traits,\n\t     typename E_Access_Traits,\n\t     typename Metadata,\n\t     typename Allocator>\n    struct pat_trie_head : public PB_DS_BASE_C_DEC\n    {\n    private:\n      typedef E_Access_Traits e_access_traits;\n\n      typedef\n      typename Allocator::template rebind<\n\te_access_traits>::other::const_pointer\n      const_e_access_traits_pointer;\n\n      typedef\n      typename Allocator::template rebind<\n\tPB_DS_BASE_C_DEC>::other::pointer\n      node_pointer;\n\n#ifdef _GLIBCXX_DEBUG\n      typedef\n      typename PB_DS_BASE_C_DEC::subtree_debug_info\n      subtree_debug_info;\n#endif \n\n    public:\n      pat_trie_head();\n\n#ifdef _GLIBCXX_DEBUG\n      virtual subtree_debug_info\n      assert_valid_imp(const_e_access_traits_pointer p_traits) const;\n#endif \n\n    public:\n      node_pointer m_p_min;\n\n      node_pointer m_p_max;\n    };\n\n    PB_DS_CLASS_T_DEC\n    PB_DS_CLASS_C_DEC::\n    pat_trie_head() : PB_DS_BASE_C_DEC(pat_trie_head_node_type)\n    { }\n\n#ifdef _GLIBCXX_DEBUG\n    PB_DS_CLASS_T_DEC\n    typename PB_DS_CLASS_C_DEC::subtree_debug_info\n    PB_DS_CLASS_C_DEC::\n    assert_valid_imp(const_e_access_traits_pointer /*p_traits*/) const\n    {\n      _GLIBCXX_DEBUG_ASSERT(false);\n      return subtree_debug_info();\n    }\n#endif \n\n#undef PB_DS_CLASS_T_DEC\n#undef PB_DS_CLASS_C_DEC\n#undef PB_DS_BASE_C_DEC\n\n  } // namespace detail\n} // namespace pb_ds\n\n#endif\n\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/detail/pat_trie_/info_fn_imps.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file info_fn_imps.hpp\n * Contains an implementation class for bin_search_tree_.\n */\n\nPB_DS_CLASS_T_DEC\ninline bool\nPB_DS_CLASS_C_DEC::\nempty() const\n{ return (m_size == 0); }\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::size_type\nPB_DS_CLASS_C_DEC::\nsize() const\n{ return m_size; }\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::size_type\nPB_DS_CLASS_C_DEC::\nmax_size() const\n{ return s_internal_node_allocator.max_size(); }\n\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/detail/pat_trie_/insert_join_fn_imps.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file insert_join_fn_imps.hpp\n * Contains an implementation class for bin_search_tree_.\n */\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\njoin(PB_DS_CLASS_C_DEC& other)\n{\n  _GLIBCXX_DEBUG_ONLY(assert_valid(););\n  _GLIBCXX_DEBUG_ONLY(other.assert_valid(););\n  split_join_branch_bag bag;\n  if (!join_prep(other, bag))\n    {\n      _GLIBCXX_DEBUG_ONLY(assert_valid(););\n      _GLIBCXX_DEBUG_ONLY(other.assert_valid(););\n      return;\n    }\n\n  m_p_head->m_p_parent = rec_join(m_p_head->m_p_parent, \n\t\t\t\t  other.m_p_head->m_p_parent, 0, bag);\n\n  m_p_head->m_p_parent->m_p_parent = m_p_head;\n  m_size += other.m_size;\n  other.initialize();\n  _GLIBCXX_DEBUG_ONLY(other.assert_valid(););\n  m_p_head->m_p_min = leftmost_descendant(m_p_head->m_p_parent);\n  m_p_head->m_p_max = rightmost_descendant(m_p_head->m_p_parent);\n  _GLIBCXX_DEBUG_ONLY(assert_valid(););\n}\n\nPB_DS_CLASS_T_DEC\nbool\nPB_DS_CLASS_C_DEC::\njoin_prep(PB_DS_CLASS_C_DEC& other, split_join_branch_bag& r_bag)\n{\n  _GLIBCXX_DEBUG_ONLY(assert_valid();)\n  _GLIBCXX_DEBUG_ONLY(other.assert_valid();)\n  if (other.m_size == 0)\n    return false;\n\n  if (m_size == 0)\n    {\n      value_swap(other);\n      return false;\n    }\n\n  const bool greater = synth_e_access_traits::cmp_keys(PB_DS_V2F(static_cast<const_leaf_pointer>(\n\t\t\t\t\t\t\t\t\t\t\t\t m_p_head->m_p_max)->value()),PB_DS_V2F(static_cast<const_leaf_pointer>(\n\t\t\t\t\t\t\t\t\t\t\t\t other.m_p_head->m_p_min)->value()));\n\n  const bool lesser = synth_e_access_traits::cmp_keys(PB_DS_V2F(static_cast<const_leaf_pointer>(\n\t\t\t\t\t\t\t\t\t\t\t\tother.m_p_head->m_p_max)->value()),PB_DS_V2F(static_cast<const_leaf_pointer>(m_p_head->m_p_min)->value()));\n\n  if (!greater && !lesser)\n    __throw_join_error();\n\n  rec_join_prep(m_p_head->m_p_parent, other.m_p_head->m_p_parent, r_bag);\n  _GLIBCXX_DEBUG_ONLY(map_debug_base::join(other);)\n  return true;\n}\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nrec_join_prep(const_node_pointer p_l, const_node_pointer p_r, split_join_branch_bag& r_bag)\n{\n  if (p_l->m_type == pat_trie_leaf_node_type)\n    {\n      if (p_r->m_type == pat_trie_leaf_node_type)\n        {\n\t  rec_join_prep(static_cast<const_leaf_pointer>(p_l),\n\t\t\tstatic_cast<const_leaf_pointer>(p_r), r_bag);\n\t  return;\n        }\n\n      _GLIBCXX_DEBUG_ASSERT(p_r->m_type == pat_trie_internal_node_type);\n      rec_join_prep(static_cast<const_leaf_pointer>(p_l),\n\t\t    static_cast<const_internal_node_pointer>(p_r), r_bag);\n      return;\n    }\n\n  _GLIBCXX_DEBUG_ASSERT(p_l->m_type == pat_trie_internal_node_type);\n  if (p_r->m_type == pat_trie_leaf_node_type)\n    {\n      rec_join_prep(static_cast<const_internal_node_pointer>(p_l),\n\t\t    static_cast<const_leaf_pointer>(p_r), r_bag);\n      return;\n    }\n\n  _GLIBCXX_DEBUG_ASSERT(p_r->m_type == pat_trie_internal_node_type);\n\n  rec_join_prep(static_cast<const_internal_node_pointer>(p_l),\n\t\tstatic_cast<const_internal_node_pointer>(p_r), r_bag);\n}\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nrec_join_prep(const_leaf_pointer /*p_l*/, const_leaf_pointer /*p_r*/, \n\t      split_join_branch_bag& r_bag)\n{ r_bag.add_branch(); }\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nrec_join_prep(const_leaf_pointer /*p_l*/, const_internal_node_pointer /*p_r*/, \n\t      split_join_branch_bag& r_bag)\n{ r_bag.add_branch(); }\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nrec_join_prep(const_internal_node_pointer /*p_l*/, const_leaf_pointer /*p_r*/, \n\t      split_join_branch_bag& r_bag)\n{ r_bag.add_branch(); }\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nrec_join_prep(const_internal_node_pointer p_l, const_internal_node_pointer p_r,\n\t      split_join_branch_bag& r_bag)\n{\n  if (p_l->get_e_ind() == p_r->get_e_ind() && \n      synth_e_access_traits::equal_prefixes(p_l->pref_b_it(), p_l->pref_e_it(),\n\t\t\t\t\t    p_r->pref_b_it(), p_r->pref_e_it()))\n    {\n      for (typename internal_node::const_iterator it = p_r->begin();\n\t   it != p_r->end(); ++ it)\n        {\n\t  const_node_pointer p_l_join_child = p_l->get_join_child(*it, this);\n\t  if (p_l_join_child != NULL)\n\t    rec_join_prep(p_l_join_child, * it, r_bag);\n        }\n      return;\n    }\n\n  if (p_r->get_e_ind() < p_l->get_e_ind() && \n      p_r->should_be_mine(p_l->pref_b_it(), p_l->pref_e_it(), 0, this))\n    {\n      const_node_pointer p_r_join_child = p_r->get_join_child(p_l, this);\n      if (p_r_join_child != NULL)\n\trec_join_prep(p_r_join_child, p_l, r_bag);\n      return;\n    }\n\n  if (p_r->get_e_ind() < p_l->get_e_ind() && \n      p_r->should_be_mine(p_l->pref_b_it(), p_l->pref_e_it(), 0, this))\n    {\n      const_node_pointer p_r_join_child = p_r->get_join_child(p_l, this);\n      if (p_r_join_child != NULL)\n\trec_join_prep(p_r_join_child, p_l, r_bag);\n      return;\n    }\n  r_bag.add_branch();\n}\n\nPB_DS_CLASS_T_DEC\ntypename PB_DS_CLASS_C_DEC::node_pointer\nPB_DS_CLASS_C_DEC::\nrec_join(node_pointer p_l, node_pointer p_r, size_type checked_ind, split_join_branch_bag& r_bag)\n{\n  _GLIBCXX_DEBUG_ASSERT(p_r != NULL);\n  if (p_l == NULL)\n    {\n      apply_update(p_r, (node_update* )this);\n      return (p_r);\n    }\n\n  if (p_l->m_type == pat_trie_leaf_node_type)\n    {\n      if (p_r->m_type == pat_trie_leaf_node_type)\n        {\n\t  node_pointer p_ret = rec_join(static_cast<leaf_pointer>(p_l),\n\t\t\t\t\tstatic_cast<leaf_pointer>(p_r), r_bag);\n\t  apply_update(p_ret, (node_update* )this);\n\t  return p_ret;\n        }\n\n      _GLIBCXX_DEBUG_ASSERT(p_r->m_type == pat_trie_internal_node_type);\n      node_pointer p_ret = rec_join(static_cast<leaf_pointer>(p_l),\n\t\t\t\t    static_cast<internal_node_pointer>(p_r),\n\t\t\t\t    checked_ind, r_bag);\n      apply_update(p_ret, (node_update* )this);\n      return p_ret;\n    }\n\n  _GLIBCXX_DEBUG_ASSERT(p_l->m_type == pat_trie_internal_node_type);\n  if (p_r->m_type == pat_trie_leaf_node_type)\n    {\n      node_pointer p_ret = rec_join(static_cast<internal_node_pointer>(p_l),\n\t\t\t\t    static_cast<leaf_pointer>(p_r),\n\t\t\t\t    checked_ind, r_bag);\n      apply_update(p_ret, (node_update* )this);\n      return p_ret;\n    }\n\n  _GLIBCXX_DEBUG_ASSERT(p_r->m_type == pat_trie_internal_node_type);\n  node_pointer p_ret = rec_join(static_cast<internal_node_pointer>(p_l),\n\t\t\t\tstatic_cast<internal_node_pointer>(p_r), \n\t\t\t\tr_bag);\n\n  apply_update(p_ret, (node_update* )this);\n  return p_ret;\n}\n\nPB_DS_CLASS_T_DEC\ntypename PB_DS_CLASS_C_DEC::node_pointer\nPB_DS_CLASS_C_DEC::\nrec_join(leaf_pointer p_l, leaf_pointer p_r, split_join_branch_bag& r_bag)\n{\n  _GLIBCXX_DEBUG_ASSERT(p_r != NULL);\n  if (p_l == NULL)\n    return (p_r);\n  node_pointer p_ret = insert_branch(p_l, p_r, r_bag);\n  _GLIBCXX_DEBUG_ASSERT(recursive_count_leafs(p_ret) == 2);\n  return p_ret;\n}\n\nPB_DS_CLASS_T_DEC\ntypename PB_DS_CLASS_C_DEC::node_pointer\nPB_DS_CLASS_C_DEC::\nrec_join(leaf_pointer p_l, internal_node_pointer p_r, size_type checked_ind, \n\t split_join_branch_bag& r_bag)\n{\n#ifdef _GLIBCXX_DEBUG\n  const size_type lhs_leafs = recursive_count_leafs(p_l);\n  const size_type rhs_leafs = recursive_count_leafs(p_r);\n#endif \n\n  _GLIBCXX_DEBUG_ASSERT(p_r != NULL);\n  node_pointer p_ret = rec_join(p_r, p_l, checked_ind, r_bag);\n  _GLIBCXX_DEBUG_ASSERT(recursive_count_leafs(p_ret) == lhs_leafs + rhs_leafs);\n  return p_ret;\n}\n\nPB_DS_CLASS_T_DEC\ntypename PB_DS_CLASS_C_DEC::node_pointer\nPB_DS_CLASS_C_DEC::\nrec_join(internal_node_pointer p_l, leaf_pointer p_r, size_type checked_ind, split_join_branch_bag& r_bag)\n{\n  _GLIBCXX_DEBUG_ASSERT(p_l != NULL);\n  _GLIBCXX_DEBUG_ASSERT(p_r != NULL);\n\n#ifdef _GLIBCXX_DEBUG\n  const size_type lhs_leafs = recursive_count_leafs(p_l);\n  const size_type rhs_leafs = recursive_count_leafs(p_r);\n#endif \n\n  if (!p_l->should_be_mine(pref_begin(p_r), pref_end(p_r), checked_ind, this))\n    {\n      node_pointer p_ret = insert_branch(p_l, p_r, r_bag);\n      _GLIBCXX_DEBUG_ONLY(p_ret->assert_valid(this);)\n      _GLIBCXX_DEBUG_ASSERT(recursive_count_leafs(p_ret) ==\n       \t\t            lhs_leafs + rhs_leafs);\n      return p_ret;\n    }\n\n  node_pointer p_pot_child = p_l->add_child(p_r, pref_begin(p_r),\n\t\t\t\t\t    pref_end(p_r), this);\n  if (p_pot_child != p_r)\n    {\n      node_pointer p_new_child = rec_join(p_pot_child, p_r, p_l->get_e_ind(),\n\t\t\t\t\t  r_bag);\n\n      p_l->replace_child(p_new_child, pref_begin(p_new_child),\n\t\t\t pref_end(p_new_child), this);\n    }\n\n  _GLIBCXX_DEBUG_ONLY(p_l->assert_valid(this));\n  _GLIBCXX_DEBUG_ASSERT(recursive_count_leafs(p_l) == lhs_leafs + rhs_leafs);\n  return p_l;\n}\n\nPB_DS_CLASS_T_DEC\ntypename PB_DS_CLASS_C_DEC::node_pointer\nPB_DS_CLASS_C_DEC::\nrec_join(internal_node_pointer p_l, internal_node_pointer p_r, split_join_branch_bag& r_bag)\n{\n  _GLIBCXX_DEBUG_ASSERT(p_l != NULL);\n  _GLIBCXX_DEBUG_ASSERT(p_r != NULL);\n\n#ifdef _GLIBCXX_DEBUG\n  const size_type lhs_leafs = recursive_count_leafs(p_l);\n  const size_type rhs_leafs = recursive_count_leafs(p_r);\n#endif \n\n  if (p_l->get_e_ind() == p_r->get_e_ind() && \n      synth_e_access_traits::equal_prefixes(p_l->pref_b_it(), p_l->pref_e_it(),\n\t\t\t\t\t    p_r->pref_b_it(), p_r->pref_e_it()))\n    {\n      for (typename internal_node::iterator it = p_r->begin();\n\t   it != p_r->end(); ++ it)\n        {\n\t  node_pointer p_new_child = rec_join(p_l->get_join_child(*it, this),\n\t\t\t\t\t      * it, 0, r_bag);\n\t  p_l->replace_child(p_new_child, pref_begin(p_new_child),\n\t\t\t     pref_end(p_new_child), this);\n        }\n\n      p_r->~internal_node();\n      s_internal_node_allocator.deallocate(p_r, 1);\n      _GLIBCXX_DEBUG_ONLY(p_l->assert_valid(this);)\n      _GLIBCXX_DEBUG_ASSERT(recursive_count_leafs(p_l) == lhs_leafs + rhs_leafs);\n      return p_l;\n    }\n\n  if (p_l->get_e_ind() < p_r->get_e_ind() && \n      p_l->should_be_mine(p_r->pref_b_it(), p_r->pref_e_it(), 0, this))\n    {\n      node_pointer p_new_child = rec_join(p_l->get_join_child(p_r, this),\n\t\t\t\t\t  p_r, 0, r_bag);\n      p_l->replace_child(p_new_child, pref_begin(p_new_child),\n\t\t\t pref_end(p_new_child), this);\n      _GLIBCXX_DEBUG_ONLY(p_l->assert_valid(this);)\n      return p_l;\n    }\n\n  if (p_r->get_e_ind() < p_l->get_e_ind() && \n      p_r->should_be_mine(p_l->pref_b_it(), p_l->pref_e_it(), 0, this))\n    {\n      node_pointer p_new_child = rec_join(p_r->get_join_child(p_l, this), p_l,\n\t\t\t\t\t  0, r_bag);\n\n      p_r->replace_child(p_new_child, pref_begin(p_new_child), \n\t\t\t pref_end(p_new_child), this);\n\n      _GLIBCXX_DEBUG_ONLY(p_r->assert_valid(this);)\n      _GLIBCXX_DEBUG_ASSERT(recursive_count_leafs(p_r) == lhs_leafs + rhs_leafs);\n      return p_r;\n    }\n\n  node_pointer p_ret = insert_branch(p_l, p_r, r_bag);\n  _GLIBCXX_DEBUG_ONLY(p_ret->assert_valid(this);)\n  _GLIBCXX_DEBUG_ASSERT(recursive_count_leafs(p_ret) == lhs_leafs + rhs_leafs);\n  return p_ret;\n}\n\nPB_DS_CLASS_T_DEC\ninline std::pair<typename PB_DS_CLASS_C_DEC::iterator, bool>\nPB_DS_CLASS_C_DEC::\ninsert(const_reference r_val)\n{\n  node_pointer p_lf = find_imp(PB_DS_V2F(r_val));\n  if (p_lf != NULL && p_lf->m_type == pat_trie_leaf_node_type && \n      synth_e_access_traits::equal_keys(PB_DS_V2F(static_cast<leaf_pointer>(p_lf)->value()), PB_DS_V2F(r_val)))\n    {\n      _GLIBCXX_DEBUG_ONLY(map_debug_base::check_key_exists(PB_DS_V2F(r_val)));\n      _GLIBCXX_DEBUG_ONLY(assert_valid();)\n      return std::make_pair(iterator(p_lf), false);\n    }\n\n  _GLIBCXX_DEBUG_ONLY(map_debug_base::check_key_does_not_exist(PB_DS_V2F(r_val)));\n\n  leaf_pointer p_new_lf = s_leaf_allocator.allocate(1);\n  cond_dealtor cond(p_new_lf);\n\n  new (p_new_lf) leaf(r_val);\n  apply_update(p_new_lf, (node_update* )this);\n  cond.set_call_destructor();\n  split_join_branch_bag bag;\n  bag.add_branch();\n  m_p_head->m_p_parent = rec_join(m_p_head->m_p_parent, p_new_lf, 0, bag);\n  m_p_head->m_p_parent->m_p_parent = m_p_head;\n  cond.set_no_action_dtor();\n  ++m_size;\n  update_min_max_for_inserted_leaf(p_new_lf);\n  _GLIBCXX_DEBUG_ONLY(map_debug_base::insert_new(PB_DS_V2F(r_val));)   \n  _GLIBCXX_DEBUG_ONLY(assert_valid();)\n  return std::make_pair(point_iterator(p_new_lf), true);\n}\n\nPB_DS_CLASS_T_DEC\ntypename PB_DS_CLASS_C_DEC::size_type\nPB_DS_CLASS_C_DEC::\nkeys_diff_ind(typename e_access_traits::const_iterator b_l, typename e_access_traits::const_iterator e_l, typename e_access_traits::const_iterator b_r, typename e_access_traits::const_iterator e_r)\n{\n  size_type diff_pos = 0;\n  while (b_l != e_l)\n    {\n      if (b_r == e_r)\n\treturn (diff_pos);\n      if (e_access_traits::e_pos(*b_l) != e_access_traits::e_pos(*b_r))\n\treturn (diff_pos);\n      ++b_l;\n      ++b_r;\n      ++diff_pos;\n    }\n  _GLIBCXX_DEBUG_ASSERT(b_r != e_r);\n  return diff_pos;\n}\n\nPB_DS_CLASS_T_DEC\ntypename PB_DS_CLASS_C_DEC::internal_node_pointer\nPB_DS_CLASS_C_DEC::\ninsert_branch(node_pointer p_l, node_pointer p_r, split_join_branch_bag& r_bag)\n{\n  typename synth_e_access_traits::const_iterator left_b_it = pref_begin(p_l);\n  typename synth_e_access_traits::const_iterator left_e_it = pref_end(p_l);\n  typename synth_e_access_traits::const_iterator right_b_it = pref_begin(p_r);\n  typename synth_e_access_traits::const_iterator right_e_it = pref_end(p_r);\n\n  const size_type diff_ind = keys_diff_ind(left_b_it, left_e_it, \n\t\t\t\t\t   right_b_it, right_e_it);\n\n  internal_node_pointer p_new_nd = r_bag.get_branch();\n  new (p_new_nd) internal_node(diff_ind, left_b_it);\n  p_new_nd->add_child(p_l, left_b_it, left_e_it, this);\n  p_new_nd->add_child(p_r, right_b_it, right_e_it, this);\n  p_l->m_p_parent = p_new_nd;\n  p_r->m_p_parent = p_new_nd;\n  _GLIBCXX_DEBUG_ONLY(p_new_nd->assert_valid(this);)\n  return (p_new_nd);\n}\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nupdate_min_max_for_inserted_leaf(leaf_pointer p_new_lf)\n{\n  if (m_p_head->m_p_min == m_p_head ||\n      synth_e_access_traits::cmp_keys(PB_DS_V2F(p_new_lf->value()),\n\t\t\t\t      PB_DS_V2F(static_cast<const_leaf_pointer>(m_p_head->m_p_min)->value())))\n    m_p_head->m_p_min = p_new_lf;\n\n  if (m_p_head->m_p_max == m_p_head ||\n      synth_e_access_traits::cmp_keys(PB_DS_V2F(static_cast<const_leaf_pointer>(m_p_head->m_p_max)->value()), PB_DS_V2F(p_new_lf->value())))\n    m_p_head->m_p_max = p_new_lf;\n}\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/detail/pat_trie_/internal_node.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file internal_node.hpp\n * Contains an internal PB_DS_BASE_C_DEC for a patricia tree.\n */\n\n#ifndef PB_DS_PAT_TRIE_INTERNAL_NODE_HPP\n#define PB_DS_PAT_TRIE_INTERNAL_NODE_HPP\n\n#include <debug/debug.h>\n\nnamespace pb_ds\n{\n  namespace detail\n  {\n#define PB_DS_CLASS_T_DEC \\\n    template<typename Type_Traits, typename E_Access_Traits,  \\\n\t     typename Metadata, typename Allocator>\n\n#define PB_DS_CLASS_C_DEC \\\n    pat_trie_internal_node<Type_Traits, E_Access_Traits, Metadata, Allocator>\n\n#define PB_DS_BASE_C_DEC \\\n    pat_trie_node_base<Type_Traits, E_Access_Traits, Metadata, Allocator>\n\n#define PB_DS_LEAF_C_DEC \\\n    pat_trie_leaf<Type_Traits, E_Access_Traits, Metadata, Allocator>\n\n#define PB_DS_STATIC_ASSERT(UNIQUE, E) \\\n    typedef static_assert_dumclass<sizeof(static_assert<(bool)(E)>)> UNIQUE##static_assert_type\n\n    template<typename Type_Traits,\n\t     typename E_Access_Traits,\n\t     typename Metadata,\n\t     typename Allocator>\n    struct pat_trie_internal_node : public PB_DS_BASE_C_DEC\n    {\n    private:\n      typedef PB_DS_BASE_C_DEC \t\t\tbase_type;\n      typedef Type_Traits \t\t\ttype_traits;\n      typedef typename type_traits::value_type \tvalue_type;\n      typedef typename Allocator::size_type \tsize_type;\n\n      typedef E_Access_Traits e_access_traits;\n      typedef typename e_access_traits::const_iterator const_e_iterator;\n      typedef typename Allocator::template rebind<e_access_traits>::other access_rebind;\n      typedef typename access_rebind::const_pointer const_e_access_traits_pointer;\n\n      typedef typename Allocator::template rebind<base_type>::other base_rebind;\n      typedef typename base_rebind::pointer node_pointer;\n      typedef typename base_rebind::const_pointer const_node_pointer;\n\n      typedef PB_DS_LEAF_C_DEC leaf;\n      typedef typename Allocator::template rebind<leaf>::other leaf_rebind;\n      typedef typename leaf_rebind::pointer leaf_pointer;\n      typedef typename leaf_rebind::const_pointer const_leaf_pointer;\n\n      typedef typename Allocator::template rebind<pat_trie_internal_node>::other internal_node_rebind;\n      typedef typename internal_node_rebind::pointer internal_node_pointer;\n      typedef typename internal_node_rebind::const_pointer const_internal_node_pointer;\n\n#ifdef _GLIBCXX_DEBUG\n      typedef typename base_type::subtree_debug_info subtree_debug_info;\n\n      virtual subtree_debug_info\n      assert_valid_imp(const_e_access_traits_pointer) const;\n#endif \n\n      inline size_type\n      get_pref_pos(const_e_iterator, const_e_iterator, \n\t\t   const_e_access_traits_pointer) const;\n\n    public:\n      typedef typename Allocator::template rebind<node_pointer>::other node_pointer_rebind;\n      typedef typename node_pointer_rebind::pointer node_pointer_pointer;\n      typedef typename node_pointer_rebind::reference node_pointer_reference;\n\n      enum\n\t{\n\t  arr_size = E_Access_Traits::max_size + 1\n\t};\n      PB_DS_STATIC_ASSERT(min_arr_size, arr_size >= 2);\n\n#include <ext/pb_ds/detail/pat_trie_/const_child_iterator.hpp>\n#include <ext/pb_ds/detail/pat_trie_/child_iterator.hpp>\n\n      pat_trie_internal_node(size_type, const const_e_iterator);\n\n      void\n      update_prefixes(const_e_access_traits_pointer);\n\n      const_iterator\n      begin() const;\n\n      iterator\n      begin();\n\n      const_iterator\n      end() const;\n\n      iterator\n      end();\n\n      inline node_pointer\n      get_child_node(const_e_iterator, const_e_iterator, \n\t\t     const_e_access_traits_pointer);\n\n      inline const_node_pointer\n      get_child_node(const_e_iterator, const_e_iterator, \n\t\t     const_e_access_traits_pointer) const;\n\n      inline iterator\n      get_child_it(const_e_iterator, const_e_iterator, \n\t\t   const_e_access_traits_pointer);\n\n      inline node_pointer\n      get_lower_bound_child_node(const_e_iterator, const_e_iterator, \n\t\t\t\t size_type, const_e_access_traits_pointer);\n\n      inline node_pointer\n      add_child(node_pointer, const_e_iterator, const_e_iterator, \n\t\tconst_e_access_traits_pointer);\n\n      inline const_node_pointer\n      get_join_child(const_node_pointer, const_e_access_traits_pointer) const;\n\n      inline node_pointer\n      get_join_child(node_pointer, const_e_access_traits_pointer);\n\n      void\n      remove_child(node_pointer p_nd);\n\n      iterator\n      remove_child(iterator it);\n\n      void\n      replace_child(node_pointer, const_e_iterator, const_e_iterator, \n\t\t    const_e_access_traits_pointer);\n\n      inline const_e_iterator\n      pref_b_it() const;\n\n      inline const_e_iterator\n      pref_e_it() const;\n\n      inline size_type\n      get_e_ind() const;\n\n      bool\n      should_be_mine(const_e_iterator, const_e_iterator, size_type, \n\t\t     const_e_access_traits_pointer) const;\n\n      leaf_pointer\n      leftmost_descendant();\n\n      const_leaf_pointer\n      leftmost_descendant() const;\n\n      leaf_pointer\n      rightmost_descendant();\n\n      const_leaf_pointer\n      rightmost_descendant() const;\n\n#ifdef _GLIBCXX_DEBUG\n      size_type\n      e_ind() const;\n#endif \n\n    private:\n      pat_trie_internal_node(const pat_trie_internal_node&);\n\n      size_type\n      get_begin_pos() const;\n\n      const size_type m_e_ind;\n      const_e_iterator m_pref_b_it;\n      const_e_iterator m_pref_e_it;\n      node_pointer m_a_p_children[arr_size];\n      static leaf_rebind s_leaf_alloc;\n      static internal_node_rebind s_internal_node_alloc;\n    };\n\n    PB_DS_CLASS_T_DEC\n    typename PB_DS_CLASS_C_DEC::leaf_rebind\n    PB_DS_CLASS_C_DEC::s_leaf_alloc;\n\n    PB_DS_CLASS_T_DEC\n    typename PB_DS_CLASS_C_DEC::internal_node_rebind\n    PB_DS_CLASS_C_DEC::s_internal_node_alloc;\n\n    PB_DS_CLASS_T_DEC\n    inline typename PB_DS_CLASS_C_DEC::size_type\n    PB_DS_CLASS_C_DEC::\n    get_pref_pos(const_e_iterator b_it, const_e_iterator e_it, \n\t\t const_e_access_traits_pointer p_traits) const\n    {\n      if (static_cast<size_t>(std::distance(b_it, e_it)) <= m_e_ind)\n\treturn 0;\n      std::advance(b_it, m_e_ind);\n      return 1 + p_traits->e_pos(*b_it);\n    }\n\n    PB_DS_CLASS_T_DEC\n    PB_DS_CLASS_C_DEC::\n    pat_trie_internal_node(size_type len, const const_e_iterator it) :\n      PB_DS_BASE_C_DEC(pat_trie_internal_node_type),\n      m_e_ind(len), m_pref_b_it(it), m_pref_e_it(it)\n    {\n      std::advance(m_pref_e_it, m_e_ind);\n      std::fill(m_a_p_children, m_a_p_children + arr_size,\n\t\tstatic_cast<node_pointer>(NULL));\n    }\n\n    PB_DS_CLASS_T_DEC\n    void\n    PB_DS_CLASS_C_DEC::\n    update_prefixes(const_e_access_traits_pointer p_traits)\n    {\n      node_pointer p_first = *begin();\n      if (p_first->m_type == pat_trie_leaf_node_type)\n\t{\n\t  const_leaf_pointer p = static_cast<const_leaf_pointer>(p_first);\n\t  m_pref_b_it = p_traits->begin(e_access_traits::extract_key(p->value()));\n\t}\n      else\n\t{\n\t  _GLIBCXX_DEBUG_ASSERT(p_first->m_type == pat_trie_internal_node_type);\n\t  m_pref_b_it = static_cast<internal_node_pointer>(p_first)->pref_b_it();\n\t}\n      m_pref_e_it = m_pref_b_it;\n      std::advance(m_pref_e_it, m_e_ind);\n    }\n\n    PB_DS_CLASS_T_DEC\n    typename PB_DS_CLASS_C_DEC::const_iterator\n    PB_DS_CLASS_C_DEC::\n    begin() const\n    {\n      typedef node_pointer_pointer pointer_type;\n      pointer_type p = const_cast<pointer_type>(m_a_p_children);\n      return const_iterator(p + get_begin_pos(), p + arr_size);\n    }\n\n    PB_DS_CLASS_T_DEC\n    typename PB_DS_CLASS_C_DEC::iterator\n    PB_DS_CLASS_C_DEC::\n    begin()\n    {\n      return iterator(m_a_p_children + get_begin_pos(), \n\t\t      m_a_p_children + arr_size);\n    }\n\n    PB_DS_CLASS_T_DEC\n    typename PB_DS_CLASS_C_DEC::const_iterator\n    PB_DS_CLASS_C_DEC::\n    end() const\n    {\n      typedef node_pointer_pointer pointer_type;\n      pointer_type p = const_cast<pointer_type>(m_a_p_children) + arr_size;\n      return const_iterator(p, p);\n    }\n\n    PB_DS_CLASS_T_DEC\n    typename PB_DS_CLASS_C_DEC::iterator\n    PB_DS_CLASS_C_DEC::\n    end()\n    { return iterator(m_a_p_children + arr_size, m_a_p_children + arr_size); }\n\n    PB_DS_CLASS_T_DEC\n    inline typename PB_DS_CLASS_C_DEC::node_pointer\n    PB_DS_CLASS_C_DEC::\n    get_child_node(const_e_iterator b_it, const_e_iterator e_it, \n\t\t   const_e_access_traits_pointer p_traits)\n    {\n      const size_type i = get_pref_pos(b_it, e_it, p_traits);\n      _GLIBCXX_DEBUG_ASSERT(i < arr_size);\n      return m_a_p_children[i];\n    }\n\n    PB_DS_CLASS_T_DEC\n    inline typename PB_DS_CLASS_C_DEC::iterator\n    PB_DS_CLASS_C_DEC::\n    get_child_it(const_e_iterator b_it, const_e_iterator e_it, \n\t\t const_e_access_traits_pointer p_traits)\n    {\n      const size_type i = get_pref_pos(b_it, e_it, p_traits);\n      _GLIBCXX_DEBUG_ASSERT(i < arr_size);\n      _GLIBCXX_DEBUG_ASSERT(m_a_p_children[i] != NULL);\n      return iterator(m_a_p_children + i, m_a_p_children + i);\n    }\n\n    PB_DS_CLASS_T_DEC\n    inline typename PB_DS_CLASS_C_DEC::const_node_pointer\n    PB_DS_CLASS_C_DEC::\n    get_child_node(const_e_iterator b_it, const_e_iterator e_it, \n\t\t   const_e_access_traits_pointer p_traits) const\n    { return const_cast<node_pointer>(get_child_node(b_it, e_it, p_traits)); }\n\n    PB_DS_CLASS_T_DEC\n    typename PB_DS_CLASS_C_DEC::node_pointer\n    PB_DS_CLASS_C_DEC::\n    get_lower_bound_child_node(const_e_iterator b_it, const_e_iterator e_it, \n\t\t\t       size_type checked_ind, \n\t\t\t       const_e_access_traits_pointer p_traits)\n    {\n      if (!should_be_mine(b_it, e_it, checked_ind, p_traits))\n\t{\n\t  if (p_traits->cmp_prefixes(b_it, e_it, m_pref_b_it, m_pref_e_it, true))\n\t    return leftmost_descendant();\n\t  return rightmost_descendant();\n\t}\n\n      size_type i = get_pref_pos(b_it, e_it, p_traits);\n      _GLIBCXX_DEBUG_ASSERT(i < arr_size);\n\n      if (m_a_p_children[i] != NULL)\n\treturn m_a_p_children[i];\n\n      while (++i < arr_size)\n\tif (m_a_p_children[i] != NULL)\n\t  {\n\t    if (m_a_p_children[i]->m_type == pat_trie_leaf_node_type)\n\t      return m_a_p_children[i];\n\n\t    _GLIBCXX_DEBUG_ASSERT(m_a_p_children[i]->m_type == pat_trie_internal_node_type);\n\n\t    return static_cast<internal_node_pointer>(m_a_p_children[i])->leftmost_descendant();\n\t  }\n\n      return rightmost_descendant();\n    }\n\n    PB_DS_CLASS_T_DEC\n    inline typename PB_DS_CLASS_C_DEC::node_pointer\n    PB_DS_CLASS_C_DEC::\n    add_child(node_pointer p_nd, const_e_iterator b_it, const_e_iterator e_it, \n\t      const_e_access_traits_pointer p_traits)\n    {\n      const size_type i = get_pref_pos(b_it, e_it, p_traits);\n      _GLIBCXX_DEBUG_ASSERT(i < arr_size);\n      if (m_a_p_children[i] == NULL)\n\t{\n\t  m_a_p_children[i] = p_nd;\n\t  p_nd->m_p_parent = this;\n\t  return p_nd;\n\t}\n      return m_a_p_children[i];\n    }\n\n    PB_DS_CLASS_T_DEC\n    typename PB_DS_CLASS_C_DEC::const_node_pointer\n    PB_DS_CLASS_C_DEC::\n    get_join_child(const_node_pointer p_nd, const_e_access_traits_pointer p_traits) const\n    {\n      node_pointer p = const_cast<node_pointer>(p_nd);\n      return const_cast<internal_node_pointer>(this)->get_join_child(p, p_traits);\n    }\n\n    PB_DS_CLASS_T_DEC\n    typename PB_DS_CLASS_C_DEC::node_pointer\n    PB_DS_CLASS_C_DEC::\n    get_join_child(node_pointer p_nd, const_e_access_traits_pointer p_traits)\n    {\n      size_type i;\n      const_e_iterator b_it;\n      const_e_iterator e_it;\n      if (p_nd->m_type == pat_trie_leaf_node_type)\n\t{\n\t  typename Type_Traits::const_key_reference r_key =\n\t    e_access_traits::extract_key(static_cast<const_leaf_pointer>(p_nd)->value());\n\n\t  b_it = p_traits->begin(r_key);\n\t  e_it = p_traits->end(r_key);\n\t}\n      else\n\t{\n\t  b_it = static_cast<internal_node_pointer>(p_nd)->pref_b_it();\n\t  e_it = static_cast<internal_node_pointer>(p_nd)->pref_e_it();\n\t}\n      i = get_pref_pos(b_it, e_it, p_traits);\n      _GLIBCXX_DEBUG_ASSERT(i < arr_size);\n      return m_a_p_children[i];\n    }\n\n    PB_DS_CLASS_T_DEC\n    void\n    PB_DS_CLASS_C_DEC::\n    remove_child(node_pointer p_nd)\n    {\n      size_type i = 0;\n      for (; i < arr_size; ++i)\n\tif (m_a_p_children[i] == p_nd)\n\t  {\n\t    m_a_p_children[i] = NULL;\n\t    return;\n\t  }\n      _GLIBCXX_DEBUG_ASSERT(i != arr_size);\n    }\n\n    PB_DS_CLASS_T_DEC\n    typename PB_DS_CLASS_C_DEC::iterator\n    PB_DS_CLASS_C_DEC::\n    remove_child(iterator it)\n    {\n      iterator ret = it;\n      ++ret;\n      * it.m_p_p_cur = NULL;\n      return ret;\n    }\n\n    PB_DS_CLASS_T_DEC\n    void\n    PB_DS_CLASS_C_DEC::\n    replace_child(node_pointer p_nd, const_e_iterator b_it, \n\t\t  const_e_iterator e_it, \n\t\t  const_e_access_traits_pointer p_traits)\n    {\n      const size_type i = get_pref_pos(b_it, e_it, p_traits);\n      _GLIBCXX_DEBUG_ASSERT(i < arr_size);\n      m_a_p_children[i] = p_nd;\n      p_nd->m_p_parent = this;\n    }\n\n    PB_DS_CLASS_T_DEC\n    inline typename PB_DS_CLASS_C_DEC::const_e_iterator\n    PB_DS_CLASS_C_DEC::\n    pref_b_it() const\n    { return m_pref_b_it; }\n\n    PB_DS_CLASS_T_DEC\n    inline typename PB_DS_CLASS_C_DEC::const_e_iterator\n    PB_DS_CLASS_C_DEC::\n    pref_e_it() const\n    { return m_pref_e_it; }\n\n    PB_DS_CLASS_T_DEC\n    inline typename PB_DS_CLASS_C_DEC::size_type\n    PB_DS_CLASS_C_DEC::\n    get_e_ind() const\n    { return m_e_ind; }\n\n    PB_DS_CLASS_T_DEC\n    bool\n    PB_DS_CLASS_C_DEC::\n    should_be_mine(const_e_iterator b_it, const_e_iterator e_it, \n\t\t   size_type checked_ind, \n\t\t   const_e_access_traits_pointer p_traits) const\n    {\n      if (m_e_ind == 0)\n\treturn true;\n\n      const size_type num_es = std::distance(b_it, e_it);\n      if (num_es < m_e_ind)\n\treturn false;\n\n      const_e_iterator key_b_it = b_it;\n      std::advance(key_b_it, checked_ind);\n      const_e_iterator key_e_it = b_it;\n      std::advance(key_e_it, m_e_ind);\n\n      const_e_iterator value_b_it = m_pref_b_it;\n      std::advance(value_b_it, checked_ind);\n      const_e_iterator value_e_it = m_pref_b_it;\n      std::advance(value_e_it, m_e_ind);\n\n      return p_traits->equal_prefixes(key_b_it, key_e_it, value_b_it, \n\t\t\t\t      value_e_it);\n    }\n\n    PB_DS_CLASS_T_DEC\n    typename PB_DS_CLASS_C_DEC::leaf_pointer\n    PB_DS_CLASS_C_DEC::\n    leftmost_descendant()\n    {\n      node_pointer p_pot =* begin();\n      if (p_pot->m_type == pat_trie_leaf_node_type)\n\treturn (static_cast<leaf_pointer>(p_pot));\n      _GLIBCXX_DEBUG_ASSERT(p_pot->m_type == pat_trie_internal_node_type);\n      return static_cast<internal_node_pointer>(p_pot)->leftmost_descendant();\n    }\n\n    PB_DS_CLASS_T_DEC\n    typename PB_DS_CLASS_C_DEC::const_leaf_pointer\n    PB_DS_CLASS_C_DEC::\n    leftmost_descendant() const\n    {\n      return const_cast<internal_node_pointer>(this)->leftmost_descendant();\n    }\n\n    PB_DS_CLASS_T_DEC\n    typename PB_DS_CLASS_C_DEC::leaf_pointer\n    PB_DS_CLASS_C_DEC::\n    rightmost_descendant()\n    {\n      const size_type num_children = std::distance(begin(), end());\n      _GLIBCXX_DEBUG_ASSERT(num_children >= 2);\n\n      iterator it = begin();\n      std::advance(it, num_children - 1);\n      node_pointer p_pot =* it;\n      if (p_pot->m_type == pat_trie_leaf_node_type)\n\treturn static_cast<leaf_pointer>(p_pot);\n      _GLIBCXX_DEBUG_ASSERT(p_pot->m_type == pat_trie_internal_node_type);\n      return static_cast<internal_node_pointer>(p_pot)->rightmost_descendant();\n    }\n\n    PB_DS_CLASS_T_DEC\n    typename PB_DS_CLASS_C_DEC::const_leaf_pointer\n    PB_DS_CLASS_C_DEC::\n    rightmost_descendant() const\n    {\n      return const_cast<internal_node_pointer>(this)->rightmost_descendant();\n    }\n\n#ifdef _GLIBCXX_DEBUG\n    PB_DS_CLASS_T_DEC\n    typename PB_DS_CLASS_C_DEC::size_type\n    PB_DS_CLASS_C_DEC::\n    e_ind() const\n    { return m_e_ind; }\n#endif \n\n    PB_DS_CLASS_T_DEC\n    typename PB_DS_CLASS_C_DEC::size_type\n    PB_DS_CLASS_C_DEC::\n    get_begin_pos() const\n    {\n      size_type i;\n      for (i = 0; i < arr_size && m_a_p_children[i] == NULL; ++i)\n\t;\n      return i;\n    }\n\n#ifdef _GLIBCXX_DEBUG\n    PB_DS_CLASS_T_DEC\n    typename PB_DS_CLASS_C_DEC::subtree_debug_info\n    PB_DS_CLASS_C_DEC::\n    assert_valid_imp(const_e_access_traits_pointer p_traits) const\n    {\n      _GLIBCXX_DEBUG_ASSERT(base_type::m_type == pat_trie_internal_node_type);\n      _GLIBCXX_DEBUG_ASSERT(static_cast<size_type>(std::distance(pref_b_it(), pref_e_it())) == m_e_ind);\n      _GLIBCXX_DEBUG_ASSERT(std::distance(begin(), end()) >= 2);\n\n      for (typename pat_trie_internal_node::const_iterator it = begin();\n\t   it != end(); ++it)\n\t{\n\t  const_node_pointer p_nd =* it;\n\t  _GLIBCXX_DEBUG_ASSERT(p_nd->m_p_parent == this);\n\t  subtree_debug_info child_ret = p_nd->assert_valid_imp(p_traits);\n\n\t  _GLIBCXX_DEBUG_ASSERT(static_cast<size_type>(std::distance(child_ret.first, child_ret.second)) >= m_e_ind);\n\t  _GLIBCXX_DEBUG_ASSERT(should_be_mine(child_ret.first, child_ret.second, 0, p_traits));\n\t  _GLIBCXX_DEBUG_ASSERT(get_pref_pos(child_ret.first, child_ret.second, p_traits) == static_cast<size_type>(it.m_p_p_cur - m_a_p_children));\n\t}\n      return std::make_pair(pref_b_it(), pref_e_it());\n    }\n#endif \n\n#undef PB_DS_CLASS_T_DEC\n#undef PB_DS_CLASS_C_DEC\n#undef PB_DS_BASE_C_DEC\n#undef PB_DS_LEAF_C_DEC\n#undef PB_DS_STATIC_ASSERT\n\n  } // namespace detail\n} // namespace pb_ds\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/detail/pat_trie_/iterators_fn_imps.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file iterators_fn_imps.hpp\n * Contains an implementation class for bin_search_tree_.\n */\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::iterator\nPB_DS_CLASS_C_DEC::\nbegin()\n{ return iterator(m_p_head->m_p_min); }\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::const_iterator\nPB_DS_CLASS_C_DEC::\nbegin() const\n{ return const_iterator(m_p_head->m_p_min); }\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::iterator\nPB_DS_CLASS_C_DEC::\nend()\n{ return iterator(m_p_head); }\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::const_iterator\nPB_DS_CLASS_C_DEC::\nend() const\n{ return const_iterator(m_p_head); }\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::const_reverse_iterator\nPB_DS_CLASS_C_DEC::\nrbegin() const\n{\n  if (empty())\n    return rend();\n  return --end();\n}\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::reverse_iterator\nPB_DS_CLASS_C_DEC::\nrbegin()\n{\n  if (empty())\n    return rend();\n  return --end();\n}\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::reverse_iterator\nPB_DS_CLASS_C_DEC::\nrend()\n{ return reverse_iterator(m_p_head); }\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::const_reverse_iterator\nPB_DS_CLASS_C_DEC::\nrend() const\n{ return const_reverse_iterator(m_p_head); }\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::const_node_iterator\nPB_DS_CLASS_C_DEC::\nnode_begin() const\n{ return const_node_iterator(m_p_head->m_p_parent, this); }\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::node_iterator\nPB_DS_CLASS_C_DEC::\nnode_begin()\n{ return node_iterator(m_p_head->m_p_parent, this); }\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::const_node_iterator\nPB_DS_CLASS_C_DEC::\nnode_end() const\n{ return const_node_iterator(NULL, this); }\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::node_iterator\nPB_DS_CLASS_C_DEC::\nnode_end()\n{ return node_iterator(NULL, this); }\n\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/detail/pat_trie_/leaf.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file leaf.hpp\n * Contains a pat_trie_leaf for a patricia tree.\n */\n\n#ifndef PB_DS_PAT_TRIE_LEAF_HPP\n#define PB_DS_PAT_TRIE_LEAF_HPP\n\n#include <debug/debug.h>\n\nnamespace pb_ds\n{\n  namespace detail\n  {\n\n#define PB_DS_CLASS_T_DEC\t\t\t\t\t\t\\\n    template<\t\t\t\t\t\t\t\t\\\n\t\t\t\t\t\tclass Type_Traits,\t\\\n\t\t\t\t\t\tclass E_Access_Traits,\t\\\n\t\t\t\t\t\tclass Metadata,\t\t\\\n\t\t\t\t\t\tclass Allocator>\n\n#define PB_DS_CLASS_C_DEC\t\t\t\t\t\t\\\n    pat_trie_leaf<\t\t\t\t\t\t\t\\\n\t\t\t\t\t\tType_Traits,\t\t\\\n\t\t\t\t\t\tE_Access_Traits,\t\\\n\t\t\t\t\t\tMetadata,\t\t\\\n\t\t\t\t\t\tAllocator>\n\n#define PB_DS_BASE_C_DEC\t\t\t\t\t\\\n    pat_trie_node_base<\t\t\t\t\t\t\\\n\t\t\t\t\tType_Traits,\t\t\\\n\t\t\t\t\tE_Access_Traits,\t\\\n\t\t\t\t\tMetadata,\t\t\\\n\t\t\t\t\tAllocator>\n\n#define PB_DS_PAT_TRIE_SUBTREE_DEBUG_INFO_C_DEC\t\t\t\t\\\n    pat_trie_subtree_debug_info<\t\t\t\t\t\\\n\t\t\t\t\t\t\tType_Traits,\t\\\n\t\t\t\t\t\t\tE_Access_Traits, \\\n\t\t\t\t\t\t\tAllocator>\n\n    template<typename Type_Traits,\n\t     class E_Access_Traits,\n\t     class Metadata,\n\t     class Allocator>\n    struct pat_trie_leaf : public PB_DS_BASE_C_DEC\n    {\n    private:\n      typedef typename Type_Traits::value_type value_type;\n\n      typedef typename Type_Traits::const_reference const_reference;\n\n      typedef typename Type_Traits::reference reference;\n\n      typedef\n      typename Allocator::template rebind<\n\tE_Access_Traits>::other::const_pointer\n      const_e_access_traits_pointer;\n\n#ifdef _GLIBCXX_DEBUG\n      typedef\n      typename PB_DS_BASE_C_DEC::subtree_debug_info\n      subtree_debug_info;\n#endif \n\n      typedef PB_DS_BASE_C_DEC base_type;\n\n    public:\n      pat_trie_leaf(const_reference r_val);\n\n      inline reference\n      value();\n\n      inline const_reference\n      value() const;\n\n#ifdef _GLIBCXX_DEBUG\n      virtual subtree_debug_info\n      assert_valid_imp(const_e_access_traits_pointer p_traits) const;\n\n      virtual\n      ~pat_trie_leaf();\n#endif \n\n    private:\n      pat_trie_leaf(const PB_DS_CLASS_C_DEC& other);\n\n      value_type m_value;\n    };\n\n    PB_DS_CLASS_T_DEC\n    PB_DS_CLASS_C_DEC::\n    pat_trie_leaf(const_reference r_val) :\n    PB_DS_BASE_C_DEC(pat_trie_leaf_node_type), m_value(r_val)\n    { }\n\n    PB_DS_CLASS_T_DEC\n    inline typename PB_DS_CLASS_C_DEC::reference\n    PB_DS_CLASS_C_DEC::\n    value()\n    { return m_value; }\n\n    PB_DS_CLASS_T_DEC\n    inline typename PB_DS_CLASS_C_DEC::const_reference\n    PB_DS_CLASS_C_DEC::\n    value() const\n    { return m_value; }\n\n#ifdef _GLIBCXX_DEBUG\n    PB_DS_CLASS_T_DEC\n    typename PB_DS_CLASS_C_DEC::subtree_debug_info\n    PB_DS_CLASS_C_DEC::\n    assert_valid_imp(const_e_access_traits_pointer p_traits) const\n    {\n      _GLIBCXX_DEBUG_ASSERT(base_type::m_type == pat_trie_leaf_node_type);\n      subtree_debug_info ret;\n      const_reference r_val = value();\n      return std::make_pair(p_traits->begin(p_traits->extract_key(r_val)),\n\t\t\t     p_traits->end(p_traits->extract_key(r_val)));\n    }\n\n    PB_DS_CLASS_T_DEC\n    PB_DS_CLASS_C_DEC::\n    ~pat_trie_leaf() { }\n#endif \n\n#undef PB_DS_CLASS_T_DEC\n#undef PB_DS_CLASS_C_DEC\n#undef PB_DS_BASE_C_DEC\n#undef PB_DS_PAT_TRIE_SUBTREE_DEBUG_INFO_C_DEC\n\n  } // namespace detail\n} // namespace pb_ds\n\n#endif \n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/detail/pat_trie_/node_base.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file node_base.hpp\n * Contains a pat_trie_node_base base for a patricia tree.\n */\n\n#ifndef PB_DS_PAT_TRIE_NODE_BASE_HPP\n#define PB_DS_PAT_TRIE_NODE_BASE_HPP\n\n#include <ext/pb_ds/detail/pat_trie_/node_metadata_base.hpp>\n\nnamespace pb_ds\n{\n  namespace detail\n  {\n#define PB_DS_CLASS_T_DEC \\\n    template<typename Type_Traits, typename E_Access_Traits,\t\\\n\t     typename Metadata,\ttypename Allocator>\n\n#define PB_DS_CLASS_C_DEC \\\n    pat_trie_node_base<Type_Traits, E_Access_Traits, Metadata, Allocator>\n\n#define PB_DS_PAT_TRIE_SUBTREE_DEBUG_INFO_C_DEC\t\\\n    pat_trie_subtree_debug_info<Type_Traits, E_Access_Traits, Allocator>\n\n    enum pat_trie_node_type\n      {\n\tpat_trie_internal_node_type,\n\tpat_trie_leaf_node_type,\n\tpat_trie_head_node_type\n      };\n\n    template<typename Type_Traits,\n\t     typename E_Access_Traits,\n\t     typename Metadata,\n\t     typename Allocator>\n    struct pat_trie_node_base : public pat_trie_node_metadata_base<\n      Metadata,\n      Allocator>\n    {\n    public:\n      typedef\n      typename Allocator::template rebind<\n      pat_trie_node_base>::other::pointer\n      node_pointer;\n\n      typedef\n      typename Allocator::template rebind<\n\tE_Access_Traits>::other::const_pointer\n      const_e_access_traits_pointer;\n\n#ifdef _GLIBCXX_DEBUG\n      typedef\n      std::pair<\n\ttypename E_Access_Traits::const_iterator,\n\ttypename E_Access_Traits::const_iterator>\n      subtree_debug_info;\n#endif \n\n      pat_trie_node_base(pat_trie_node_type type);\n\n#ifdef _GLIBCXX_DEBUG\n      void\n      assert_valid(const_e_access_traits_pointer p_traits) const;\n\n      virtual subtree_debug_info\n      assert_valid_imp(const_e_access_traits_pointer p_traits) const = 0;\n#endif \n\n      node_pointer m_p_parent;\n      const pat_trie_node_type m_type;\n    };\n\n    PB_DS_CLASS_T_DEC\n    PB_DS_CLASS_C_DEC::\n    pat_trie_node_base(pat_trie_node_type type) : m_type(type)\n    { }\n\n#ifdef _GLIBCXX_DEBUG\n    PB_DS_CLASS_T_DEC\n    void\n    PB_DS_CLASS_C_DEC::\n    assert_valid(const_e_access_traits_pointer p_traits) const\n    { assert_valid_imp(p_traits); }\n#endif \n\n#undef PB_DS_CLASS_T_DEC\n#undef PB_DS_CLASS_C_DEC\n#undef PB_DS_PAT_TRIE_SUBTREE_DEBUG_INFO_C_DEC\n\n  } // namespace detail\n} // namespace pb_ds\n\n#endif \n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/detail/pat_trie_/node_iterators.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file node_iterators.hpp\n * Contains an implementation class for pat_trie_.\n */\n\n#ifndef PB_DS_PAT_TRIE_NODE_ITERATORS_HPP\n#define PB_DS_PAT_TRIE_NODE_ITERATORS_HPP\n\n#include <debug/debug.h>\n\nnamespace pb_ds\n{\n  namespace detail\n  {\n\n#define PB_DS_PAT_TRIE_CONST_NODE_ITERATOR_C_DEC\t\t\t\\\n    pat_trie_const_node_it_<\t\t\t\t\t\t\\\n\t\t\t\t\t\t\tNode,\t\t\\\n\t\t\t\t\t\t\tLeaf,\t\t\\\n\t\t\t\t\t\t\tHead,\t\t\\\n\t\t\t\t\t\t\tInternal_Node,\t\\\n\t\t\t\t\t\t\tConst_Iterator,\t\\\n\t\t\t\t\t\t\tIterator,\t\\\n\t\t\t\t\t\t\tE_Access_Traits, \\\n\t\t\t\t\t\t\tAllocator>\n\n#define PB_DS_PAT_TRIE_NODE_ITERATOR_C_DEC\t\t\t\\\n    pat_trie_node_it_<\t\t\t\t\t\t\\\n\t\t\t\t\tNode,\t\t\t\\\n\t\t\t\t\tLeaf,\t\t\t\\\n\t\t\t\t\tHead,\t\t\t\\\n\t\t\t\t\tInternal_Node,\t\t\\\n\t\t\t\t\tConst_Iterator,\t\t\\\n\t\t\t\t\tIterator,\t\t\\\n\t\t\t\t\tE_Access_Traits,\t\\\n\t\t\t\t\tAllocator>\n\n    // Const node iterator.\n    template<typename Node,\n\t     class Leaf,\n\t     class Head,\n\t     class Internal_Node,\n\t     class Const_Iterator,\n\t     class Iterator,\n\t     class E_Access_Traits,\n\t     class Allocator>\n    class pat_trie_const_node_it_\n    {\n    protected:\n      typedef\n      typename Allocator::template rebind<\n      Node>::other::pointer\n      node_pointer;\n\n      typedef\n      typename Allocator::template rebind<\n\tLeaf>::other::const_pointer\n      const_leaf_pointer;\n\n      typedef\n      typename Allocator::template rebind<\n\tLeaf>::other::pointer\n      leaf_pointer;\n\n      typedef\n      typename Allocator::template rebind<\n\tInternal_Node>::other::pointer\n      internal_node_pointer;\n\n      typedef\n      typename Allocator::template rebind<\n\tInternal_Node>::other::const_pointer\n      const_internal_node_pointer;\n\n      typedef\n      typename Allocator::template rebind<\n\tE_Access_Traits>::other::const_pointer\n      const_e_access_traits_pointer;\n\n    private:\n      inline typename E_Access_Traits::const_iterator\n      pref_begin() const\n      {\n\tif (m_p_nd->m_type == pat_trie_leaf_node_type)\n\t  return (m_p_traits->begin(\n\t\t\t\t    m_p_traits->extract_key(\n\t\t\t\t\t\t\t    static_cast<const_leaf_pointer>(m_p_nd)->value())));\n\n\t_GLIBCXX_DEBUG_ASSERT(m_p_nd->m_type == pat_trie_internal_node_type);\n\n\treturn (static_cast<const_internal_node_pointer>(m_p_nd)->pref_b_it());\n      }\n\n      inline typename E_Access_Traits::const_iterator\n      pref_end() const\n      {\n\tif (m_p_nd->m_type == pat_trie_leaf_node_type)\n\t  return (m_p_traits->end(\n\t\t\t\t  m_p_traits->extract_key(\n\t\t\t\t\t\t\t  static_cast<const_leaf_pointer>(m_p_nd)->value())));\n\n\t_GLIBCXX_DEBUG_ASSERT(m_p_nd->m_type == pat_trie_internal_node_type);\n\n\treturn (static_cast<const_internal_node_pointer>(m_p_nd)->pref_e_it());\n      }\n\n    public:\n\n      // Size type.\n      typedef typename Allocator::size_type size_type;\n\n      // Category.\n      typedef trivial_iterator_tag iterator_category;\n\n      // Difference type.\n      typedef trivial_iterator_difference_type difference_type;\n\n      // __Iterator's value type.\n      typedef Const_Iterator value_type;\n\n      // __Iterator's reference type.\n      typedef value_type reference;\n\n      // __Iterator's __const reference type.\n      typedef value_type const_reference;\n\n      // Element access traits.\n      typedef E_Access_Traits e_access_traits;\n\n      // A key's element __const iterator.\n      typedef typename e_access_traits::const_iterator const_e_iterator;\n\n      // Metadata type.\n      typedef typename Node::metadata_type metadata_type;\n\n      // Const metadata reference type.\n      typedef\n      typename Allocator::template rebind<\n\tmetadata_type>::other::const_reference\n      const_metadata_reference;\n\n      // Default constructor.\n      /*\n\tinline\n\tpat_trie_const_node_it_()\n      */\n      inline\n      pat_trie_const_node_it_(node_pointer p_nd = NULL,  \n\t\t\t      const_e_access_traits_pointer p_traits = NULL) \n      : m_p_nd(const_cast<node_pointer>(p_nd)), m_p_traits(p_traits)\n      { }\n\n      // Subtree valid prefix.\n      inline std::pair<const_e_iterator, const_e_iterator>\n      valid_prefix() const\n      { return std::make_pair(pref_begin(), pref_end()); }\n\n      // Const access; returns the __const iterator* associated with\n      // the current leaf.\n      inline const_reference\n      operator*() const\n      {\n\t_GLIBCXX_DEBUG_ASSERT(num_children() == 0);\n\treturn Const_Iterator(m_p_nd);\n      }\n\n      // Metadata access.\n      inline const_metadata_reference\n      get_metadata() const\n      { return m_p_nd->get_metadata(); }\n\n      // Returns the number of children in the corresponding node.\n      inline size_type\n      num_children() const\n      {\n\tif (m_p_nd->m_type == pat_trie_leaf_node_type)\n\t  return 0;\n\t_GLIBCXX_DEBUG_ASSERT(m_p_nd->m_type == pat_trie_internal_node_type);\n\treturn std::distance(static_cast<internal_node_pointer>(m_p_nd)->begin(),  static_cast<internal_node_pointer>(m_p_nd)->end());\n      }\n\n      // Returns a __const node __iterator to the corresponding node's\n      // i-th child.\n      PB_DS_PAT_TRIE_CONST_NODE_ITERATOR_C_DEC\n      get_child(size_type i) const\n      {\n\t_GLIBCXX_DEBUG_ASSERT(m_p_nd->m_type == pat_trie_internal_node_type);\n\ttypename Internal_Node::iterator it =\n\t  static_cast<internal_node_pointer>(m_p_nd)->begin();\n\n\tstd::advance(it, i);\n\treturn PB_DS_PAT_TRIE_CONST_NODE_ITERATOR_C_DEC(*it, m_p_traits);\n      }\n\n      // Compares content to a different iterator object.\n      inline bool\n      operator==(const PB_DS_PAT_TRIE_CONST_NODE_ITERATOR_C_DEC& other) const\n      { return (m_p_nd == other.m_p_nd); }\n\n      // Compares content (negatively) to a different iterator object.\n      inline bool\n      operator!=(const PB_DS_PAT_TRIE_CONST_NODE_ITERATOR_C_DEC& other) const\n      { return m_p_nd != other.m_p_nd; }\n\n    private:\n\n      friend class PB_DS_CLASS_C_DEC;\n\n    public:\n      node_pointer m_p_nd;\n\n      const_e_access_traits_pointer m_p_traits;\n    };\n\n    // Node iterator.\n    template<typename Node,\n\t     class Leaf,\n\t     class Head,\n\t     class Internal_Node,\n\t     class Const_Iterator,\n\t     class Iterator,\n\t     class E_Access_Traits,\n\t     class Allocator>\n    class pat_trie_node_it_ : \n      public PB_DS_PAT_TRIE_CONST_NODE_ITERATOR_C_DEC\n\n    {\n    private:\n      typedef\n      typename Allocator::template rebind<\n      Node>::other::pointer\n      node_pointer;\n\n      typedef Iterator iterator;\n\n      typedef PB_DS_PAT_TRIE_CONST_NODE_ITERATOR_C_DEC base_type;\n\n      typedef\n      typename base_type::const_e_access_traits_pointer\n      const_e_access_traits_pointer;\n\n      typedef typename base_type::internal_node_pointer internal_node_pointer;\n\n    public:\n\n      // Size type.\n      typedef\n      typename PB_DS_PAT_TRIE_CONST_NODE_ITERATOR_C_DEC::size_type\n      size_type;\n\n      // __Iterator's value type.\n      typedef Iterator value_type;\n\n      // __Iterator's reference type.\n      typedef value_type reference;\n\n      // __Iterator's __const reference type.\n      typedef value_type const_reference;\n\n      // Default constructor.\n      /*\n\tinline\n\tpat_trie_node_it_() ;\n      */\n\n      inline\n      pat_trie_node_it_(node_pointer p_nd = NULL,  const_e_access_traits_pointer p_traits = NULL) : base_type(p_nd, p_traits)\n      { }\n\n      // Access; returns the iterator*  associated with the current leaf.\n      inline reference\n      operator*() const\n      {\n\t_GLIBCXX_DEBUG_ASSERT(base_type::num_children() == 0);\n\treturn Iterator(base_type::m_p_nd);\n\n      }\n\n      // Returns a node __iterator to the corresponding node's i-th child.\n      PB_DS_PAT_TRIE_NODE_ITERATOR_C_DEC\n      get_child(size_type i) const\n      {\n\t_GLIBCXX_DEBUG_ASSERT(base_type::m_p_nd->m_type == pat_trie_internal_node_type);\n\n\ttypename Internal_Node::iterator it =\n\t  static_cast<internal_node_pointer>(base_type::m_p_nd)->begin();\n\n\tstd::advance(it, i);\n\treturn PB_DS_PAT_TRIE_NODE_ITERATOR_C_DEC(*it, base_type::m_p_traits);\n      }\n\n    private:\n      friend class PB_DS_CLASS_C_DEC;\n    };\n\n#undef PB_DS_PAT_TRIE_CONST_NODE_ITERATOR_C_DEC\n#undef PB_DS_PAT_TRIE_NODE_ITERATOR_C_DEC\n\n  } // namespace detail\n} // namespace pb_ds\n\n#endif \n\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/detail/pat_trie_/node_metadata_base.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file node_metadata_base.hpp\n * Contains an internal PB_DS_BASE_C_DEC for a patricia tree.\n */\n\n#ifndef PB_DS_PAT_TRIE_NODE_METADATA_BASE_HPP\n#define PB_DS_PAT_TRIE_NODE_METADATA_BASE_HPP\n\n#include <ext/pb_ds/detail/basic_tree_policy/null_node_metadata.hpp>\n\nnamespace pb_ds\n{\n  namespace detail\n  {\n\n    template<typename Metadata, class Allocator>\n    struct pat_trie_node_metadata_base\n    {\n    public:\n      typedef Metadata metadata_type;\n\n      typedef\n      typename Allocator::template rebind<\n\tmetadata_type>::other::const_reference\n      const_metadata_reference;\n\n    public:\n      inline const_metadata_reference\n      get_metadata() const\n      {\n\treturn (m_metadata);\n      }\n\n    public:\n      metadata_type m_metadata;\n    };\n\n    template<typename Allocator>\n    struct pat_trie_node_metadata_base<\n      null_node_metadata,\n      Allocator>\n    {\n    public:\n      typedef null_node_metadata metadata_type;\n    };\n\n  } // namespace detail\n} // namespace pb_ds\n\n#endif // #ifndef PB_DS_PAT_TRIE_NODE_BASE_HPP\n\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/detail/pat_trie_/pat_trie_.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file pat_trie_.hpp\n * Contains an implementation class for a patricia tree.\n */\n\n/**\n * This implementation loosely borrows ideas from:\n * 1) \"Fast Mergeable Integer Maps\", Okasaki, Gill 1998\n * 2) \"Ptset: Sets of integers implemented as Patricia trees\",\n *    Jean-Christophe Filliatr, 2000\n **/\n\n#include <ext/pb_ds/detail/pat_trie_/synth_e_access_traits.hpp>\n#include <ext/pb_ds/detail/pat_trie_/node_base.hpp>\n#include <ext/pb_ds/exception.hpp>\n#include <ext/pb_ds/tag_and_trait.hpp>\n#include <ext/pb_ds/detail/eq_fn/eq_by_less.hpp>\n#include <ext/pb_ds/detail/types_traits.hpp>\n#include <ext/pb_ds/tree_policy.hpp>\n#include <ext/pb_ds/detail/cond_dealtor.hpp>\n#include <ext/pb_ds/detail/type_utils.hpp>\n#include <iterator>\n#include <utility>\n#include <algorithm>\n#include <functional>\n#include <assert.h>\n#include <list>\n#ifdef _GLIBCXX_DEBUG\n#include <ext/pb_ds/detail/map_debug_base.hpp>\n#endif \n#include <debug/debug.h>\n\nnamespace pb_ds\n{\n  namespace detail\n  {\n#define PB_DS_CLASS_T_DEC \\\n    template<typename Key, typename Mapped, typename Node_And_It_Traits, \\\n\t     typename Allocator>\n\n#ifdef PB_DS_DATA_TRUE_INDICATOR\n#define PB_DS_CLASS_NAME pat_trie_data_\n#endif \n\n#ifdef PB_DS_DATA_FALSE_INDICATOR\n#define PB_DS_CLASS_NAME pat_trie_no_data_\n#endif \n\n#define PB_DS_CLASS_C_DEC \\\n    PB_DS_CLASS_NAME<Key, Mapped, Node_And_It_Traits, Allocator>\n\n#define PB_DS_TYPES_TRAITS_C_DEC \\\n    types_traits<Key, Mapped, Allocator, false>\n\n#ifdef _GLIBCXX_DEBUG\n#define PB_DS_MAP_DEBUG_BASE_C_DEC \\\n    map_debug_base<Key,\teq_by_less<Key, \\\n\t\t\tstd::less<Key> >, typename Allocator::template rebind<Key>::other::const_reference>\n#endif \n\n#ifdef PB_DS_DATA_TRUE_INDICATOR\n#define PB_DS_V2F(X) (X).first\n#define PB_DS_V2S(X) (X).second\n#define PB_DS_EP2VP(X)& ((X)->m_value)\n#endif \n\n#ifdef PB_DS_DATA_FALSE_INDICATOR\n#define PB_DS_V2F(X) (X)\n#define PB_DS_V2S(X) Mapped_Data()\n#define PB_DS_EP2VP(X)& ((X)->m_value.first)\n#endif \n\n#define PB_DS_STATIC_ASSERT(UNIQUE, E)\t\\\n    typedef static_assert_dumclass<sizeof(static_assert<(bool)(E)>)> \\\n    UNIQUE##static_assert_type\n\n    /**\n     * class description = PATRICIA trie implementation.\">\n     **/\n    template<typename Key,\n\t     typename Mapped,\n\t     typename Node_And_It_Traits,\n\t     typename Allocator>\n    class PB_DS_CLASS_NAME :\n#ifdef _GLIBCXX_DEBUG\n      public PB_DS_MAP_DEBUG_BASE_C_DEC,\n#endif \n      public Node_And_It_Traits::synth_e_access_traits,\n      public Node_And_It_Traits::node_update,\n      public PB_DS_TYPES_TRAITS_C_DEC\n    {\n    private:\n      typedef PB_DS_TYPES_TRAITS_C_DEC traits_base;\n\n      typedef typename Node_And_It_Traits::synth_e_access_traits synth_e_access_traits;\n      typedef typename Allocator::template rebind<synth_e_access_traits>::other::const_pointer const_e_access_traits_pointer;\n      typedef typename synth_e_access_traits::const_iterator const_e_iterator;\n\n      typedef typename Node_And_It_Traits::node node;\n      typedef typename Allocator::template rebind<node>::other::const_pointer const_node_pointer;\n\n      typedef typename Allocator::template rebind<node>::other::pointer node_pointer;\n\n      typedef typename Node_And_It_Traits::head head;\n      typedef typename Allocator::template rebind<head>::other head_allocator;\n      typedef typename head_allocator::pointer head_pointer;\n\n      typedef typename Node_And_It_Traits::leaf leaf;\n      typedef typename Allocator::template rebind<leaf>::other leaf_allocator;\n      typedef typename leaf_allocator::const_pointer const_leaf_pointer;\n      typedef typename leaf_allocator::pointer leaf_pointer;\n\n      typedef typename Node_And_It_Traits::internal_node internal_node;\n      typedef typename Allocator::template rebind<internal_node>::other internal_node_allocator;\n      typedef typename internal_node_allocator::const_pointer const_internal_node_pointer;\n      typedef typename internal_node_allocator::pointer internal_node_pointer;\n\n#include <ext/pb_ds/detail/pat_trie_/cond_dtor_entry_dealtor.hpp>\n\n#ifdef _GLIBCXX_DEBUG\n      typedef PB_DS_MAP_DEBUG_BASE_C_DEC map_debug_base;\n#endif \n\n#include <ext/pb_ds/detail/pat_trie_/split_join_branch_bag.hpp>\n\n      typedef typename Node_And_It_Traits::null_node_update_pointer null_node_update_pointer;\n\n    public:\n      typedef pat_trie_tag container_category;\n      typedef Allocator allocator;\n      typedef typename Allocator::size_type size_type;\n      typedef typename Allocator::difference_type difference_type;\n\n      typedef typename traits_base::key_type key_type;\n      typedef typename traits_base::key_pointer key_pointer;\n      typedef typename traits_base::const_key_pointer const_key_pointer;\n      typedef typename traits_base::key_reference key_reference;\n      typedef typename traits_base::const_key_reference const_key_reference;\n      typedef typename traits_base::mapped_type mapped_type;\n      typedef typename traits_base::mapped_pointer mapped_pointer;\n      typedef typename traits_base::const_mapped_pointer const_mapped_pointer;\n      typedef typename traits_base::mapped_reference mapped_reference;\n      typedef typename traits_base::const_mapped_reference const_mapped_reference;\n      typedef typename traits_base::value_type value_type;\n      typedef typename traits_base::pointer pointer;\n      typedef typename traits_base::const_pointer const_pointer;\n      typedef typename traits_base::reference reference;\n      typedef typename traits_base::const_reference const_reference;\n\n      typedef typename Node_And_It_Traits::const_iterator const_point_iterator;\n      typedef typename Node_And_It_Traits::iterator point_iterator;\n      typedef const_point_iterator const_iterator;\n      typedef point_iterator iterator;\n\n      typedef typename Node_And_It_Traits::const_reverse_iterator const_reverse_iterator;\n      typedef typename Node_And_It_Traits::reverse_iterator reverse_iterator;\n      typedef typename Node_And_It_Traits::const_node_iterator const_node_iterator;\n      typedef typename Node_And_It_Traits::node_iterator node_iterator;\n      typedef typename Node_And_It_Traits::e_access_traits e_access_traits;\n      typedef typename Node_And_It_Traits::node_update node_update;\n\n      PB_DS_CLASS_NAME();\n\n      PB_DS_CLASS_NAME(const e_access_traits&);\n\n      PB_DS_CLASS_NAME(const PB_DS_CLASS_C_DEC&);\n\n      void\n      swap(PB_DS_CLASS_C_DEC&);\n\n      ~PB_DS_CLASS_NAME();\n\n      inline bool\n      empty() const;\n\n      inline size_type\n      size() const;\n\n      inline size_type\n      max_size() const;\n\n      e_access_traits& \n      get_e_access_traits();\n\n      const e_access_traits& \n      get_e_access_traits() const;\n\n      node_update& \n      get_node_update();\n\n      const node_update& \n      get_node_update() const;\n\n      inline std::pair<point_iterator, bool>\n      insert(const_reference);\n\n      inline mapped_reference\n      operator[](const_key_reference r_key)\n      {\n#ifdef PB_DS_DATA_TRUE_INDICATOR\n\treturn insert(std::make_pair(r_key, mapped_type())).first->second;\n#else \n\tinsert(r_key);\n\treturn traits_base::s_null_mapped;\n#endif \n      }\n\n      inline point_iterator\n      find(const_key_reference);\n\n      inline const_point_iterator\n      find(const_key_reference) const;\n\n      inline point_iterator\n      lower_bound(const_key_reference);\n\n      inline const_point_iterator\n      lower_bound(const_key_reference) const;\n\n      inline point_iterator\n      upper_bound(const_key_reference);\n\n      inline const_point_iterator\n      upper_bound(const_key_reference) const;\n\n      void\n      clear();\n\n      inline bool\n      erase(const_key_reference);\n\n      inline const_iterator\n      erase(const_iterator);\n\n#ifdef PB_DS_DATA_TRUE_INDICATOR\n      inline iterator\n      erase(iterator);\n#endif \n\n      inline const_reverse_iterator\n      erase(const_reverse_iterator);\n\n#ifdef PB_DS_DATA_TRUE_INDICATOR\n      inline reverse_iterator\n      erase(reverse_iterator);\n#endif \n\n      template<typename Pred>\n      inline size_type\n      erase_if(Pred);\n\n      void\n      join(PB_DS_CLASS_C_DEC&);\n\n      void\n      split(const_key_reference, PB_DS_CLASS_C_DEC&);\n\n      inline iterator\n      begin();\n\n      inline const_iterator\n      begin() const;\n\n      inline iterator\n      end();\n\n      inline const_iterator\n      end() const;\n\n      inline reverse_iterator\n      rbegin();\n\n      inline const_reverse_iterator\n      rbegin() const;\n\n      inline reverse_iterator\n      rend();\n\n      inline const_reverse_iterator\n      rend() const;\n\n      inline const_node_iterator\n      node_begin() const;\n\n      inline node_iterator\n      node_begin();\n\n      inline const_node_iterator\n      node_end() const;\n\n      inline node_iterator\n      node_end();\n\n#ifdef PB_DS_PAT_TRIE_TRACE_\n      void\n      trace() const;\n#endif \n\n    protected:\n\n      template<typename It>\n      void\n      copy_from_range(It, It);\n\n      void\n      value_swap(PB_DS_CLASS_C_DEC&);\n\n      node_pointer\n      recursive_copy_node(const_node_pointer);\n\n    private:\n\n      void\n      initialize();\n\n      inline void\n      apply_update(node_pointer, null_node_update_pointer);\n\n      template<typename Node_Update_>\n      inline void\n      apply_update(node_pointer, Node_Update_*);\n\n      bool\n      join_prep(PB_DS_CLASS_C_DEC&, split_join_branch_bag&);\n\n      void\n      rec_join_prep(const_node_pointer, const_node_pointer, \n\t\t    split_join_branch_bag&);\n\n      void\n      rec_join_prep(const_leaf_pointer, const_leaf_pointer, \n\t\t    split_join_branch_bag&);\n\n      void\n      rec_join_prep(const_leaf_pointer, const_internal_node_pointer, \n\t\t    split_join_branch_bag&);\n\n      void\n      rec_join_prep(const_internal_node_pointer, const_leaf_pointer, \n\t\t    split_join_branch_bag&);\n\n      void\n      rec_join_prep(const_internal_node_pointer, const_internal_node_pointer, \n\t\t    split_join_branch_bag&);\n\n      node_pointer\n      rec_join(node_pointer, node_pointer, size_type, split_join_branch_bag&);\n\n      node_pointer\n      rec_join(leaf_pointer, leaf_pointer, split_join_branch_bag&);\n\n      node_pointer\n      rec_join(leaf_pointer, internal_node_pointer, size_type, \n\t       split_join_branch_bag&);\n\n      node_pointer\n      rec_join(internal_node_pointer, leaf_pointer, size_type, \n\t       split_join_branch_bag&);\n\n      node_pointer\n      rec_join(internal_node_pointer, internal_node_pointer, \n\t       split_join_branch_bag&);\n\n      size_type\n      keys_diff_ind(typename e_access_traits::const_iterator, typename e_access_traits::const_iterator, typename e_access_traits::const_iterator, typename e_access_traits::const_iterator);\n\n      internal_node_pointer\n      insert_branch(node_pointer, node_pointer, split_join_branch_bag&);\n\n      void\n      update_min_max_for_inserted_leaf(leaf_pointer);\n\n      void\n      erase_leaf(leaf_pointer);\n\n      inline void\n      actual_erase_leaf(leaf_pointer);\n\n      void\n      clear_imp(node_pointer);\n\n      void\n      erase_fixup(internal_node_pointer);\n\n      void\n      update_min_max_for_erased_leaf(leaf_pointer);\n\n      static inline const_e_iterator\n      pref_begin(const_node_pointer);\n\n      static inline const_e_iterator\n      pref_end(const_node_pointer);\n\n      inline node_pointer\n      find_imp(const_key_reference);\n\n      inline node_pointer\n      lower_bound_imp(const_key_reference);\n\n      inline node_pointer\n      upper_bound_imp(const_key_reference);\n\n      inline static const_leaf_pointer\n      leftmost_descendant(const_node_pointer);\n\n      inline static leaf_pointer\n      leftmost_descendant(node_pointer);\n\n      inline static const_leaf_pointer\n      rightmost_descendant(const_node_pointer);\n\n      inline static leaf_pointer\n      rightmost_descendant(node_pointer);\n\n#ifdef _GLIBCXX_DEBUG\n      void\n      assert_valid() const;\n\n      void\n      assert_iterators() const;\n\n      void\n      assert_reverse_iterators() const;\n\n      static size_type\n      recursive_count_leafs(const_node_pointer);\n#endif \n\n#ifdef PB_DS_PAT_TRIE_TRACE_\n      static void\n      trace_node(const_node_pointer, size_type);\n\n      template<typename Metadata_>\n      static void\n      trace_node_metadata(const_node_pointer, type_to_type<Metadata_>);\n\n      static void\n      trace_node_metadata(const_node_pointer, type_to_type<null_node_metadata>);\n#endif \n\n      leaf_pointer\n      split_prep(const_key_reference, PB_DS_CLASS_C_DEC&, \n\t\t split_join_branch_bag&);\n\n      node_pointer\n      rec_split(node_pointer, const_e_iterator, const_e_iterator, \n\t\tPB_DS_CLASS_C_DEC&, split_join_branch_bag&);\n\n      void\n      split_insert_branch(size_type, const_e_iterator, \n\t\t\t  typename internal_node::iterator, \n\t\t\t  size_type, split_join_branch_bag&);\n\n      static head_allocator s_head_allocator;\n      static internal_node_allocator s_internal_node_allocator;\n      static leaf_allocator s_leaf_allocator;\n\n      head_pointer m_p_head;\n      size_type m_size;\n    };\n\n#include <ext/pb_ds/detail/pat_trie_/constructors_destructor_fn_imps.hpp>\n#include <ext/pb_ds/detail/pat_trie_/iterators_fn_imps.hpp>\n#include <ext/pb_ds/detail/pat_trie_/insert_join_fn_imps.hpp>\n#include <ext/pb_ds/detail/pat_trie_/erase_fn_imps.hpp>\n#include <ext/pb_ds/detail/pat_trie_/find_fn_imps.hpp>\n#include <ext/pb_ds/detail/pat_trie_/info_fn_imps.hpp>\n#include <ext/pb_ds/detail/pat_trie_/policy_access_fn_imps.hpp>\n#include <ext/pb_ds/detail/pat_trie_/split_fn_imps.hpp>\n#include <ext/pb_ds/detail/pat_trie_/debug_fn_imps.hpp>\n#include <ext/pb_ds/detail/pat_trie_/trace_fn_imps.hpp>\n#include <ext/pb_ds/detail/pat_trie_/update_fn_imps.hpp>\n\n#undef PB_DS_CLASS_C_DEC\n#undef PB_DS_CLASS_T_DEC\n#undef PB_DS_CLASS_NAME\n#undef PB_DS_TYPES_TRAITS_C_DEC\n#undef PB_DS_MAP_DEBUG_BASE_C_DEC\n#undef PB_DS_V2F\n#undef PB_DS_EP2VP\n#undef PB_DS_V2S\n#undef PB_DS_STATIC_ASSERT\n\n  } // namespace detail\n} // namespace pb_ds\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/detail/pat_trie_/point_iterators.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file point_iterators.hpp\n * Contains an implementation class for bin_search_tree_.\n */\n\n#ifndef PB_DS_PAT_TRIE_FIND_ITERATORS_HPP\n#define PB_DS_PAT_TRIE_FIND_ITERATORS_HPP\n\n#include <debug/debug.h>\n\nnamespace pb_ds\n{\n  namespace detail\n  {\n\n#define PB_DS_CONST_IT_C_DEC\t\t\t\t\t\\\n    pat_trie_const_it_<\t\t\t\t\t\t\\\n\t\t\t\t\tType_Traits,\t\t\\\n\t\t\t\t\tNode,\t\t\t\\\n\t\t\t\t\tLeaf,\t\t\t\\\n\t\t\t\t\tHead,\t\t\t\\\n\t\t\t\t\tInternal_Node,\t\t\\\n\t\t\t\t\tIs_Forward_Iterator,\t\\\n\t\t\t\t\tAllocator>\n\n#define PB_DS_CONST_ODIR_IT_C_DEC\t\t\t\t\\\n    pat_trie_const_it_<\t\t\t\t\t\t\\\n\t\t\t\t\tType_Traits,\t\t\\\n\t\t\t\t\tNode,\t\t\t\\\n\t\t\t\t\tLeaf,\t\t\t\\\n\t\t\t\t\tHead,\t\t\t\\\n\t\t\t\t\tInternal_Node,\t\t\\\n\t\t\t\t\t!Is_Forward_Iterator,\t\\\n\t\t\t\t\tAllocator>\n\n#define PB_DS_IT_C_DEC\t\t\t\t\t\t\t\\\n    pat_trie_it_<\t\t\t\t\t\t\t\\\n\t\t\t\t\t\tType_Traits,\t\t\\\n\t\t\t\t\t\tNode,\t\t\t\\\n\t\t\t\t\t\tLeaf,\t\t\t\\\n\t\t\t\t\t\tHead,\t\t\t\\\n\t\t\t\t\t\tInternal_Node,\t\t\\\n\t\t\t\t\t\tIs_Forward_Iterator,\t\\\n\t\t\t\t\t\tAllocator>\n\n#define PB_DS_ODIR_IT_C_DEC\t\t\t\t\t\t\\\n    pat_trie_it_<\t\t\t\t\t\t\t\\\n\t\t\t\t\t\tType_Traits,\t\t\\\n\t\t\t\t\t\tNode,\t\t\t\\\n\t\t\t\t\t\tLeaf,\t\t\t\\\n\t\t\t\t\t\tHead,\t\t\t\\\n\t\t\t\t\t\tInternal_Node,\t\t\\\n\t\t\t\t\t\t!Is_Forward_Iterator,\t\\\n\t\t\t\t\t\tAllocator>\n\n\n    // Const iterator.\n    template<typename Type_Traits,\n\t     class Node,\n\t     class Leaf,\n\t     class Head,\n\t     class Internal_Node,\n\t     bool Is_Forward_Iterator,\n\t     class Allocator>\n    class pat_trie_const_it_\n    {\n\n    private:\n      typedef\n      typename Allocator::template rebind<\n      Node>::other::pointer\n      node_pointer;\n\n      typedef\n      typename Allocator::template rebind<\n\tLeaf>::other::const_pointer\n      const_leaf_pointer;\n\n      typedef\n      typename Allocator::template rebind<\n\tLeaf>::other::pointer\n      leaf_pointer;\n\n      typedef\n      typename Allocator::template rebind<\n\tHead>::other::pointer\n      head_pointer;\n\n      typedef\n      typename Allocator::template rebind<\n\tInternal_Node>::other::pointer\n      internal_node_pointer;\n\n    public:\n\n      typedef std::bidirectional_iterator_tag iterator_category;\n\n      typedef typename Allocator::difference_type difference_type;\n\n      typedef typename Type_Traits::value_type value_type;\n\n      typedef typename Type_Traits::pointer pointer;\n\n      typedef typename Type_Traits::const_pointer const_pointer;\n\n      typedef typename Type_Traits::reference reference;\n\n      typedef typename Type_Traits::const_reference const_reference;\n\n    public:\n\n      inline\n      pat_trie_const_it_(node_pointer p_nd = NULL) : m_p_nd(p_nd)\n      { }\n\n      inline\n      pat_trie_const_it_(const PB_DS_CONST_ODIR_IT_C_DEC& other) \n      : m_p_nd(other.m_p_nd)\n      { }\n\n      inline\n      PB_DS_CONST_IT_C_DEC& \n      operator=(const PB_DS_CONST_IT_C_DEC& other)\n      {\n\tm_p_nd = other.m_p_nd;\n\treturn *this;\n      }\n\n      inline\n      PB_DS_CONST_IT_C_DEC& \n      operator=(const PB_DS_CONST_ODIR_IT_C_DEC& other)\n      {\n\tm_p_nd = other.m_p_nd;\n\treturn *this;\n      }\n\n      inline const_pointer\n      operator->() const\n      {\n\t_GLIBCXX_DEBUG_ASSERT(m_p_nd->m_type == pat_trie_leaf_node_type);\n\treturn &static_cast<leaf_pointer>(m_p_nd)->value();\n      }\n\n      inline const_reference\n      operator*() const\n      {\n\t_GLIBCXX_DEBUG_ASSERT(m_p_nd->m_type == pat_trie_leaf_node_type);\n\treturn static_cast<leaf_pointer>(m_p_nd)->value();\n      }\n\n      inline bool\n      operator==(const PB_DS_CONST_IT_C_DEC& other) const\n      { return (m_p_nd == other.m_p_nd); }\n\n      inline bool\n      operator==(const PB_DS_CONST_ODIR_IT_C_DEC& other) const\n      { return (m_p_nd == other.m_p_nd); }\n\n      inline bool\n      operator!=(const PB_DS_CONST_IT_C_DEC& other) const\n      { return (m_p_nd != other.m_p_nd); }\n\n      inline bool\n      operator!=(const PB_DS_CONST_ODIR_IT_C_DEC& other) const\n      { return (m_p_nd != other.m_p_nd); }\n\n      inline PB_DS_CONST_IT_C_DEC& \n      operator++()\n      {\n\tinc(integral_constant<int,Is_Forward_Iterator>());\n\treturn *this;\n      }\n\n      inline PB_DS_CONST_IT_C_DEC\n      operator++(int)\n      {\n\tPB_DS_CONST_IT_C_DEC ret_it(m_p_nd);\n\toperator++();\n\treturn ret_it;\n      }\n\n      inline PB_DS_CONST_IT_C_DEC& \n      operator--()\n      {\n\tdec(integral_constant<int,Is_Forward_Iterator>());\n\treturn *this;\n      }\n\n      inline PB_DS_CONST_IT_C_DEC\n      operator--(int)\n      {\n\tPB_DS_CONST_IT_C_DEC ret_it(m_p_nd);\n\toperator--();\n\treturn ret_it;\n      }\n\n    protected:\n      inline void\n      inc(false_type)\n      { dec(true_type()); }\n\n      void\n      inc(true_type)\n      {\n\tif (m_p_nd->m_type == pat_trie_head_node_type)\n\t  {\n\t    m_p_nd = static_cast<head_pointer>(m_p_nd)->m_p_min;\n\t    return;\n\t  }\n\n\tnode_pointer p_y = m_p_nd->m_p_parent;\n\twhile (p_y->m_type != pat_trie_head_node_type && \n\t       get_larger_sibling(m_p_nd) == NULL)\n\t  {\n\t    m_p_nd = p_y;\n\t    p_y = p_y->m_p_parent;\n\t  }\n\n\tif (p_y->m_type == pat_trie_head_node_type)\n\t  {\n\t    m_p_nd = p_y;\n\t    return;\n\t  }\n\tm_p_nd = leftmost_descendant(get_larger_sibling(m_p_nd));\n      }\n\n      inline void\n      dec(false_type)\n      { inc(true_type()); }\n\n      void\n      dec(true_type)\n      {\n\tif (m_p_nd->m_type == pat_trie_head_node_type)\n\t  {\n\t    m_p_nd = static_cast<head_pointer>(m_p_nd)->m_p_max;\n\t    return;\n\t  }\n\n\tnode_pointer p_y = m_p_nd->m_p_parent;\n\twhile (p_y->m_type != pat_trie_head_node_type && \n\t       get_smaller_sibling(m_p_nd) == NULL)\n\t  {\n\t    m_p_nd = p_y;\n\t    p_y = p_y->m_p_parent;\n\t  }\n\n\tif (p_y->m_type == pat_trie_head_node_type)\n\t  {\n\t    m_p_nd = p_y;\n\t    return;\n\t  }\n\tm_p_nd = rightmost_descendant(get_smaller_sibling(m_p_nd));\n      }\n\n      inline static node_pointer\n      get_larger_sibling(node_pointer p_nd)\n      {\n\tinternal_node_pointer p_parent =\n\t  static_cast<internal_node_pointer>(p_nd->m_p_parent);\n\n\ttypename Internal_Node::iterator it = p_parent->begin();\n\twhile (*it != p_nd)\n\t  ++it;\n\n\ttypename Internal_Node::iterator next_it = it;\n\t++next_it;\n\treturn ((next_it == p_parent->end())? NULL :* next_it);\n      }\n\n      inline static node_pointer\n      get_smaller_sibling(node_pointer p_nd)\n      {\n\tinternal_node_pointer p_parent =\n\t  static_cast<internal_node_pointer>(p_nd->m_p_parent);\n\n\ttypename Internal_Node::iterator it = p_parent->begin();\n\n\tif (*it == p_nd)\n\t  return (NULL);\n\ttypename Internal_Node::iterator prev_it;\n\tdo\n\t  {\n\t    prev_it = it;\n\t    ++it;\n\t    if (*it == p_nd)\n\t      return (*prev_it);\n\t  }\n\twhile (true);\n\n\t_GLIBCXX_DEBUG_ASSERT(false);\n\treturn (NULL);\n      }\n\n      inline static leaf_pointer\n      leftmost_descendant(node_pointer p_nd)\n      {\n\tif (p_nd->m_type == pat_trie_leaf_node_type)\n\t  return static_cast<leaf_pointer>(p_nd);\n\treturn static_cast<internal_node_pointer>(p_nd)->leftmost_descendant();\n      }\n\n      inline static leaf_pointer\n      rightmost_descendant(node_pointer p_nd)\n      {\n\tif (p_nd->m_type == pat_trie_leaf_node_type)\n\t  return static_cast<leaf_pointer>(p_nd);\n\treturn static_cast<internal_node_pointer>(p_nd)->rightmost_descendant();\n      }\n\n    public:\n      node_pointer m_p_nd;\n    };\n\n    // Iterator.\n    template<typename Type_Traits,\n\t     class Node,\n\t     class Leaf,\n\t     class Head,\n\t     class Internal_Node,\n\t     bool Is_Forward_Iterator,\n\t     class Allocator>\n    class pat_trie_it_ : \n      public PB_DS_CONST_IT_C_DEC\n\n    {\n    private:\n      typedef\n      typename Allocator::template rebind<\n      Node>::other::pointer\n      node_pointer;\n\n      typedef\n      typename Allocator::template rebind<\n\tLeaf>::other::const_pointer\n      const_leaf_pointer;\n\n      typedef\n      typename Allocator::template rebind<\n\tLeaf>::other::pointer\n      leaf_pointer;\n\n      typedef\n      typename Allocator::template rebind<\n\tHead>::other::pointer\n      head_pointer;\n\n      typedef\n      typename Allocator::template rebind<\n\tInternal_Node>::other::pointer\n      internal_node_pointer;\n\n    public:\n      typedef typename Type_Traits::value_type value_type;\n\n      typedef typename Type_Traits::const_pointer const_pointer;\n\n      typedef typename Type_Traits::pointer pointer;\n\n      typedef typename Type_Traits::const_reference const_reference;\n\n      typedef typename Type_Traits::reference reference;\n\n      inline\n      pat_trie_it_(node_pointer p_nd = NULL) : PB_DS_CONST_IT_C_DEC((node_pointer)p_nd)\n      { }\n\n      inline\n      pat_trie_it_(const PB_DS_ODIR_IT_C_DEC& other) : PB_DS_CONST_IT_C_DEC(other.m_p_nd)\n      { }\n\n      inline\n      PB_DS_IT_C_DEC& \n      operator=(const PB_DS_IT_C_DEC& other)\n      {\n\tbase_it_type::m_p_nd = other.m_p_nd;\n\treturn *this;\n      }\n\n      inline\n      PB_DS_IT_C_DEC& \n      operator=(const PB_DS_ODIR_IT_C_DEC& other)\n      {\n\tbase_it_type::m_p_nd = other.m_p_nd;\n\treturn *this;\n      }\n\n      inline pointer\n      operator->() const\n      {\n\t_GLIBCXX_DEBUG_ASSERT(base_it_type::m_p_nd->m_type == pat_trie_leaf_node_type);\n\n\treturn &static_cast<leaf_pointer>(base_it_type::m_p_nd)->value();\n      }\n\n      inline reference\n      operator*() const\n      {\n\t_GLIBCXX_DEBUG_ASSERT(base_it_type::m_p_nd->m_type == pat_trie_leaf_node_type);\n\treturn static_cast<leaf_pointer>(base_it_type::m_p_nd)->value();\n      }\n\n      inline PB_DS_IT_C_DEC& \n      operator++()\n      {\n\tPB_DS_CONST_IT_C_DEC::\n\t  operator++();\n\treturn *this;\n      }\n\n      inline PB_DS_IT_C_DEC\n      operator++(int)\n      {\n\tPB_DS_IT_C_DEC ret_it(base_it_type::m_p_nd);\n\toperator++();\n\treturn ret_it;\n      }\n\n      inline PB_DS_IT_C_DEC& \n      operator--()\n      {\n\tPB_DS_CONST_IT_C_DEC::operator--();\n\treturn *this;\n      }\n\n      inline PB_DS_IT_C_DEC\n      operator--(int)\n      {\n\tPB_DS_IT_C_DEC ret_it(base_it_type::m_p_nd);\n\toperator--();\n\treturn ret_it;\n      }\n\n    protected:\n      typedef PB_DS_CONST_IT_C_DEC base_it_type;\n\n      friend class PB_DS_CLASS_C_DEC;\n    };\n\n#undef PB_DS_CONST_IT_C_DEC\n#undef PB_DS_CONST_ODIR_IT_C_DEC\n#undef PB_DS_IT_C_DEC\n#undef PB_DS_ODIR_IT_C_DEC\n\n  } // namespace detail\n} // namespace pb_ds\n\n#endif \n\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/detail/pat_trie_/policy_access_fn_imps.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file policy_access_fn_imps.hpp\n * Contains an implementation class for bin_search_tree_.\n */\n\nPB_DS_CLASS_T_DEC\ntypename PB_DS_CLASS_C_DEC::e_access_traits& \nPB_DS_CLASS_C_DEC::\nget_e_access_traits()\n{ return *this; }\n\nPB_DS_CLASS_T_DEC\nconst typename PB_DS_CLASS_C_DEC::e_access_traits& \nPB_DS_CLASS_C_DEC::\nget_e_access_traits() const\n{ return *this; }\n\nPB_DS_CLASS_T_DEC\ntypename PB_DS_CLASS_C_DEC::node_update& \nPB_DS_CLASS_C_DEC::\nget_node_update()\n{ return *this; }\n\nPB_DS_CLASS_T_DEC\nconst typename PB_DS_CLASS_C_DEC::node_update& \nPB_DS_CLASS_C_DEC::\nget_node_update() const\n{ return *this; }\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/detail/pat_trie_/r_erase_fn_imps.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file r_erase_fn_imps.hpp\n * Contains an implementation class for bin_search_tree_.\n */\n\nPB_DS_CLASS_T_DEC\ninline void\nPB_DS_CLASS_C_DEC::\nactual_erase_node(node_pointer p_z)\n{\n  _GLIBCXX_DEBUG_ASSERT(m_size > 0);\n  --m_size;\n  _GLIBCXX_DEBUG_ONLY(erase_existing(PB_DS_V2F(p_z->m_value)));\n  p_z->~node();\n  s_node_allocator.deallocate(p_z, 1);\n}\n\nPB_DS_CLASS_T_DEC\ninline void\nPB_DS_CLASS_C_DEC::\nupdate_min_max_for_erased_node(node_pointer p_z)\n{\n  if (m_size == 1)\n    {\n      m_p_head->m_p_left = m_p_head->m_p_right = m_p_head;\n      return;\n    }\n\n  if (m_p_head->m_p_left == p_z)\n    {\n      iterator it(p_z);\n      ++it;\n      m_p_head->m_p_left = it.m_p_nd;\n    }\n  else if (m_p_head->m_p_right == p_z)\n    {\n      iterator it(p_z);\n      --it;\n      m_p_head->m_p_right = it.m_p_nd;\n    }\n}\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nclear()\n{\n  _GLIBCXX_DEBUG_ONLY(assert_valid(true, true);)\n  clear_imp(m_p_head->m_p_parent);\n  m_size = 0;\n  initialize();\n  _GLIBCXX_DEBUG_ONLY(map_debug_base::clear();)\n  _GLIBCXX_DEBUG_ONLY(assert_valid(true, true);)\n}\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nclear_imp(node_pointer p_nd)\n{\n  if (p_nd == NULL)\n    return;\n  clear_imp(p_nd->m_p_left);\n  clear_imp(p_nd->m_p_right);\n  p_nd->~Node();\n  s_node_allocator.deallocate(p_nd, 1);\n}\n\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/detail/pat_trie_/rotate_fn_imps.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file rotate_fn_imps.hpp\n * Contains imps for rotating nodes.\n */\n\nPB_DS_CLASS_T_DEC\ninline void\nPB_DS_CLASS_C_DEC::\nrotate_left(node_pointer p_x)\n{\n  node_pointer p_y = p_x->m_p_right;\n  p_x->m_p_right = p_y->m_p_left;\n\n  if (p_y->m_p_left != NULL)\n    p_y->m_p_left->m_p_parent = p_x;\n\n  p_y->m_p_parent = p_x->m_p_parent;\n  if (p_x == m_p_head->m_p_parent)\n    m_p_head->m_p_parent = p_y;\n  else if (p_x == p_x->m_p_parent->m_p_left)\n    p_x->m_p_parent->m_p_left = p_y;\n  else\n    p_x->m_p_parent->m_p_right = p_y;\n\n  p_y->m_p_left = p_x;\n  p_x->m_p_parent = p_y;\n\n  _GLIBCXX_DEBUG_ONLY(assert_node_consistent(p_x);)\n  _GLIBCXX_DEBUG_ONLY(assert_node_consistent(p_y);)\n\n  apply_update(p_x, (Node_Update* )this);\n  apply_update(p_x->m_p_parent, (Node_Update* )this);\n}\n\nPB_DS_CLASS_T_DEC\ninline void\nPB_DS_CLASS_C_DEC::\nrotate_right(node_pointer p_x)\n{\n  node_pointer p_y = p_x->m_p_left;\n  p_x->m_p_left = p_y->m_p_right;\n\n  if (p_y->m_p_right != NULL)\n    p_y->m_p_right->m_p_parent = p_x;\n\n  p_y->m_p_parent = p_x->m_p_parent;\n  if (p_x == m_p_head->m_p_parent)\n    m_p_head->m_p_parent = p_y;\n  else if (p_x == p_x->m_p_parent->m_p_right)\n    p_x->m_p_parent->m_p_right = p_y;\n  else\n    p_x->m_p_parent->m_p_left = p_y;\n\n  p_y->m_p_right = p_x;\n  p_x->m_p_parent = p_y;\n\n  _GLIBCXX_DEBUG_ONLY(assert_node_consistent(p_x);)\n  _GLIBCXX_DEBUG_ONLY(assert_node_consistent(p_y);)\n\n  apply_update(p_x, (Node_Update* )this);\n  apply_update(p_x->m_p_parent, (Node_Update* )this);\n}\n\nPB_DS_CLASS_T_DEC\ninline void\nPB_DS_CLASS_C_DEC::\nrotate_parent(node_pointer p_nd)\n{\n  node_pointer p_parent = p_nd->m_p_parent;\n  if (p_nd == p_parent->m_p_left)\n    rotate_right(p_parent);\n  else\n    rotate_left(p_parent);\n  _GLIBCXX_DEBUG_ASSERT(p_parent->m_p_parent = p_nd);\n  _GLIBCXX_DEBUG_ASSERT(p_nd->m_p_left == p_parent || p_nd->m_p_right == p_parent);\n}\n\nPB_DS_CLASS_T_DEC\ninline void\nPB_DS_CLASS_C_DEC::\napply_update(node_pointer /*p_nd*/, pb_ds::null_node_update*  /*p_update*/)\n{ }\n\nPB_DS_CLASS_T_DEC\ntemplate<typename Node_Update_>\ninline void\nPB_DS_CLASS_C_DEC::\napply_update(node_pointer p_nd, Node_Update_* p_update)\n{\n  p_update->operator()(& PB_DS_V2F(p_nd->m_value),(p_nd->m_p_left == NULL) ?\n\t\t\tNULL :\n\t\t\t& PB_DS_V2F(p_nd->m_p_left->m_value),(p_nd->m_p_right == NULL) ?\n\t\t\tNULL :\n\t\t\t& PB_DS_V2F(p_nd->m_p_right->m_value));\n}\n\nPB_DS_CLASS_T_DEC\ntemplate<typename Node_Update_>\ninline void\nPB_DS_CLASS_C_DEC::\nupdate_to_top(node_pointer p_nd, Node_Update_* p_update)\n{\n  while (p_nd != m_p_head)\n    {\n      apply_update(p_nd, p_update);\n      p_nd = p_nd->m_p_parent;\n    }\n}\n\nPB_DS_CLASS_T_DEC\ninline void\nPB_DS_CLASS_C_DEC::\nupdate_to_top(node_pointer /*p_nd*/, pb_ds::null_node_update*  /*p_update*/)\n{ }\n\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/detail/pat_trie_/split_fn_imps.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file split_fn_imps.hpp\n * Contains an implementation class for bin_search_tree_.\n */\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nsplit(const_key_reference r_key, PB_DS_CLASS_C_DEC& other)\n{\n  _GLIBCXX_DEBUG_ONLY(assert_valid(););\n  _GLIBCXX_DEBUG_ONLY(other.assert_valid(););\n  split_join_branch_bag bag;\n  leaf_pointer p_split_lf = split_prep(r_key, other, bag);\n  if (p_split_lf == NULL)\n    {\n      _GLIBCXX_DEBUG_ASSERT(bag.empty());\n      _GLIBCXX_DEBUG_ONLY(assert_valid();)\n      _GLIBCXX_DEBUG_ONLY(other.assert_valid();)\n      return;\n    }\n\n  _GLIBCXX_DEBUG_ASSERT(!bag.empty());\n  other.clear();\n  m_p_head->m_p_parent = rec_split(m_p_head->m_p_parent,\n\t\t\t\t   pref_begin(p_split_lf),\n\t\t\t\t   pref_end(p_split_lf),\n\t\t\t\t   other,\n\t\t\t\t   bag);\n\n  m_p_head->m_p_parent->m_p_parent = m_p_head;\n\n  other.m_p_head->m_p_max = m_p_head->m_p_max;\n  m_p_head->m_p_max = rightmost_descendant(m_p_head->m_p_parent);\n  other.m_p_head->m_p_min =\n    other.leftmost_descendant(other.m_p_head->m_p_parent);\n\n  other.m_size = std::distance(other.PB_DS_CLASS_C_DEC::begin(),\n\t\t\t       other.PB_DS_CLASS_C_DEC::end());\n  m_size -= other.m_size;\n  _GLIBCXX_DEBUG_ONLY(assert_valid(););\n  _GLIBCXX_DEBUG_ONLY(other.assert_valid(););\n}\n\nPB_DS_CLASS_T_DEC\ntypename PB_DS_CLASS_C_DEC::leaf_pointer\nPB_DS_CLASS_C_DEC::\nsplit_prep(const_key_reference r_key, PB_DS_CLASS_C_DEC& other, split_join_branch_bag& r_bag)\n{\n  _GLIBCXX_DEBUG_ASSERT(r_bag.empty());\n  if (m_size == 0)\n    {\n      other.clear();\n      _GLIBCXX_DEBUG_ONLY(assert_valid(););\n      _GLIBCXX_DEBUG_ONLY(other.assert_valid(););\n      return (NULL);\n    }\n\n  if (synth_e_access_traits::cmp_keys(r_key,\n\t\t\t\t      PB_DS_V2F(static_cast<const_leaf_pointer>(m_p_head->m_p_min)->value())))\n    {\n      other.clear();\n      value_swap(other);\n      _GLIBCXX_DEBUG_ONLY(assert_valid(););\n      _GLIBCXX_DEBUG_ONLY(other.assert_valid(););\n      return (NULL);\n    }\n\n  if (!synth_e_access_traits::cmp_keys(r_key,\n\t\t\t\t       PB_DS_V2F(static_cast<const_leaf_pointer>(m_p_head->m_p_max)->value())))\n    {\n      _GLIBCXX_DEBUG_ONLY(assert_valid(););\n      _GLIBCXX_DEBUG_ONLY(other.assert_valid(););\n      return (NULL);\n    }\n\n  iterator it = lower_bound(r_key);\n\n  if (!synth_e_access_traits::equal_keys(PB_DS_V2F(*it), r_key))\n    --it;\n\n  node_pointer p_nd = it.m_p_nd;\n  _GLIBCXX_DEBUG_ASSERT(p_nd->m_type == pat_trie_leaf_node_type);\n  leaf_pointer p_ret_l = static_cast<leaf_pointer>(p_nd);\n  while (p_nd->m_type != pat_trie_head_node_type)\n    {\n      r_bag.add_branch();\n      p_nd = p_nd->m_p_parent;\n    }\n  _GLIBCXX_DEBUG_ONLY(map_debug_base::split(r_key,(synth_e_access_traits& )(*this), other);)\n\n  return (p_ret_l);\n}\n\nPB_DS_CLASS_T_DEC\ntypename PB_DS_CLASS_C_DEC::node_pointer\nPB_DS_CLASS_C_DEC::\nrec_split(node_pointer p_nd, const_e_iterator b_it, const_e_iterator e_it, PB_DS_CLASS_C_DEC& other, split_join_branch_bag& r_bag)\n{\n  if (p_nd->m_type == pat_trie_leaf_node_type)\n    {\n      _GLIBCXX_DEBUG_ASSERT(other.m_p_head->m_p_parent == NULL);\n      return (p_nd);\n    }\n\n  _GLIBCXX_DEBUG_ASSERT(p_nd->m_type == pat_trie_internal_node_type);\n  internal_node_pointer p_internal_nd = static_cast<internal_node_pointer>(p_nd);\n\n  node_pointer p_child_ret = rec_split(p_internal_nd->get_child_node(b_it, e_it, this), b_it, e_it, other, r_bag);\n\n  _GLIBCXX_DEBUG_ONLY(p_child_ret->assert_valid(this);)\n  p_internal_nd->replace_child(p_child_ret, b_it, e_it, this);\n  apply_update(p_internal_nd, (node_update* )this);\n\n  typename internal_node::iterator child_it  =\n    p_internal_nd->get_child_it(b_it, e_it, this);\n\n  const size_type lhs_num_children =\n    std::distance(p_internal_nd->begin(), child_it) + 1;\n\n  _GLIBCXX_DEBUG_ASSERT(lhs_num_children > 0);\n\n  size_type rhs_num_children =\n    std::distance(p_internal_nd->begin(), p_internal_nd->end()) -\n    lhs_num_children;\n\n  if (rhs_num_children == 0)\n    {\n      apply_update(p_internal_nd, (node_update* )this);\n      return (p_internal_nd);\n    }\n\n  ++child_it;\n  other.split_insert_branch(p_internal_nd->get_e_ind(),\n\t\t\t    b_it, child_it, rhs_num_children, r_bag);\n\n  child_it = p_internal_nd->get_child_it(b_it, e_it, this);\n  ++child_it;\n  while (rhs_num_children != 0)\n    {\n      child_it = p_internal_nd->remove_child(child_it);\n      --rhs_num_children;\n    }\n\n  apply_update(p_internal_nd, (node_update* )this);\n  _GLIBCXX_DEBUG_ASSERT(std::distance(p_internal_nd->begin(),\n\t\t\t\t      p_internal_nd->end()) >= 1);\n\n  if (std::distance(p_internal_nd->begin(), p_internal_nd->end()) > 1)\n    {\n      p_internal_nd->update_prefixes(this);\n      _GLIBCXX_DEBUG_ONLY(p_internal_nd->assert_valid(this);)\n      apply_update(p_internal_nd, (node_update* )this);\n      return (p_internal_nd);\n    }\n\n  node_pointer p_ret =* p_internal_nd->begin();\n  p_internal_nd->~internal_node();\n  s_internal_node_allocator.deallocate(p_internal_nd, 1);\n  apply_update(p_ret, (node_update* )this);\n  return (p_ret);\n}\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nsplit_insert_branch(size_type e_ind, const_e_iterator b_it, typename internal_node::iterator child_b_it, size_type num_children, split_join_branch_bag& r_bag)\n{\n#ifdef _GLIBCXX_DEBUG\n  if (m_p_head->m_p_parent != NULL)\n    m_p_head->m_p_parent->assert_valid(this);\n#endif \n\n  const size_type total_num_children =((m_p_head->m_p_parent == NULL)? 0 : 1) + num_children;\n\n  if (total_num_children == 0)\n    {\n      _GLIBCXX_DEBUG_ASSERT(m_p_head->m_p_parent == NULL);\n      return;\n    }\n\n  if (total_num_children == 1)\n    {\n      if (m_p_head->m_p_parent != NULL)\n        {\n\t  _GLIBCXX_DEBUG_ONLY(m_p_head->m_p_parent->assert_valid(this);)\n          return;\n        }\n\n      _GLIBCXX_DEBUG_ASSERT(m_p_head->m_p_parent == NULL);\n      m_p_head->m_p_parent =* child_b_it;\n      m_p_head->m_p_parent->m_p_parent = m_p_head;\n      apply_update(m_p_head->m_p_parent, (node_update* )this);\n      _GLIBCXX_DEBUG_ONLY(m_p_head->m_p_parent->assert_valid(this);)\n      return;\n    }\n\n  _GLIBCXX_DEBUG_ASSERT(total_num_children > 1);\n  internal_node_pointer p_new_root = r_bag.get_branch();\n  new (p_new_root) internal_node(e_ind, b_it);\n  size_type num_inserted = 0;\n  while (num_inserted++ < num_children)\n    {\n      _GLIBCXX_DEBUG_ONLY((*child_b_it)->assert_valid(this);)\n        p_new_root->add_child(*child_b_it, pref_begin(*child_b_it),\n\t\t\t      pref_end(*child_b_it), this);\n      ++child_b_it;\n    }\n\n  if (m_p_head->m_p_parent != NULL)\n    p_new_root->add_child(m_p_head->m_p_parent, \n\t\t\t  pref_begin(m_p_head->m_p_parent),\n\t\t\t  pref_end(m_p_head->m_p_parent), this);\n\n  m_p_head->m_p_parent = p_new_root;\n  p_new_root->m_p_parent = m_p_head;\n  apply_update(m_p_head->m_p_parent, (node_update* )this);\n  _GLIBCXX_DEBUG_ONLY(m_p_head->m_p_parent->assert_valid(this);)\n}\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/detail/pat_trie_/split_join_branch_bag.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file split_join_branch_bag.hpp\n * Contains an implementation class for pat_trie_.\n */\n\nclass split_join_branch_bag\n{\nprivate:\n  typedef\n  std::list<\n  internal_node_pointer,\n  typename Allocator::template rebind<\n  internal_node_pointer>::other>\n  bag_t;\n\npublic:\n\n  void\n  add_branch()\n  {\n    internal_node_pointer p_nd = s_internal_node_allocator.allocate(1);\n    try\n      {\n\tm_bag.push_back(p_nd);\n      }\n    catch(...)\n      {\n\ts_internal_node_allocator.deallocate(p_nd, 1);\n\t__throw_exception_again;\n      }\n  }\n\n  internal_node_pointer\n  get_branch()\n  {\n    _GLIBCXX_DEBUG_ASSERT(!m_bag.empty());\n    internal_node_pointer p_nd =* m_bag.begin();\n    m_bag.pop_front();\n    return p_nd;\n  }\n\n  ~split_join_branch_bag()\n  {\n    while (!m_bag.empty())\n      {\n\tinternal_node_pointer p_nd =* m_bag.begin();\n\ts_internal_node_allocator.deallocate(p_nd, 1);\n\tm_bag.pop_front();\n      }\n  }\n\n  inline bool\n  empty() const\n  { return m_bag.empty(); }\n\nprivate:\n  bag_t m_bag;\n};\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/detail/pat_trie_/synth_e_access_traits.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file synth_e_access_traits.hpp\n * Contains an implementation class for a patricia tree.\n */\n\n#ifndef PB_DS_SYNTH_E_ACCESS_TRAITS_HPP\n#define PB_DS_SYNTH_E_ACCESS_TRAITS_HPP\n\n#include <ext/pb_ds/detail/type_utils.hpp>\n\nnamespace pb_ds\n{\n  namespace detail\n  {\n\n#define PB_DS_SYNTH_E_ACCESS_TRAITS_T_DEC\t\t\t\t\\\n    template<typename Type_Traits, bool Set, class E_Access_Traits>\n\n#define PB_DS_SYNTH_E_ACCESS_TRAITS_C_DEC\t\t\t\t\\\n    synth_e_access_traits<\t\t\t\t\t\t\\\n\t\t\t\t\t\tType_Traits,\t\t\\\n\t\t\t\t\t\tSet,\t\t\t\\\n\t\t\t\t\t\tE_Access_Traits>\n\n    template<typename Type_Traits, bool Set, class E_Access_Traits>\n    struct synth_e_access_traits : public E_Access_Traits\n    {\n\n    private:\n      typedef E_Access_Traits base_type;\n\n      typedef Type_Traits type_traits;\n\n      typedef typename type_traits::const_key_reference const_key_reference;\n\n      typedef typename type_traits::const_reference const_reference;\n\n    public:\n      synth_e_access_traits();\n\n      synth_e_access_traits(const E_Access_Traits& r_traits);\n\n      inline bool\n      equal_prefixes(typename base_type::const_iterator b_l, typename base_type::const_iterator e_l, typename base_type::const_iterator b_r, typename base_type::const_iterator e_r, bool compare_after = true) const;\n\n      bool\n      equal_keys(const_key_reference r_lhs_key, const_key_reference r_rhs_key) const;\n\n      bool\n      cmp_prefixes(typename base_type::const_iterator b_l, typename base_type::const_iterator e_l, typename base_type::const_iterator b_r, typename base_type::const_iterator e_r, bool compare_after = false) const;\n\n      bool\n      cmp_keys(const_key_reference r_lhs_key, const_key_reference r_rhs_key) const;\n\n      inline static const_key_reference\n      extract_key(const_reference r_val);\n\n#ifdef _GLIBCXX_DEBUG\n      bool\n      operator()(const_key_reference r_lhs, const_key_reference r_rhs);\n#endif\n\n    private:\n      inline static const_key_reference\n      extract_key(const_reference r_val, true_type);\n\n      inline static const_key_reference\n      extract_key(const_reference r_val, false_type);\n\n    private:\n      static integral_constant<int,Set> s_set_ind;\n    };\n\n    PB_DS_SYNTH_E_ACCESS_TRAITS_T_DEC\n    integral_constant<int,Set>\n    PB_DS_SYNTH_E_ACCESS_TRAITS_C_DEC::s_set_ind;\n\n    PB_DS_SYNTH_E_ACCESS_TRAITS_T_DEC\n    PB_DS_SYNTH_E_ACCESS_TRAITS_C_DEC::\n    synth_e_access_traits()\n    { }\n\n    PB_DS_SYNTH_E_ACCESS_TRAITS_T_DEC\n    PB_DS_SYNTH_E_ACCESS_TRAITS_C_DEC::\n    synth_e_access_traits(const E_Access_Traits& r_traits) :\n      E_Access_Traits(r_traits)\n    { }\n\n    PB_DS_SYNTH_E_ACCESS_TRAITS_T_DEC\n    inline bool\n    PB_DS_SYNTH_E_ACCESS_TRAITS_C_DEC::\n    equal_prefixes(typename base_type::const_iterator b_l, typename base_type::const_iterator e_l, typename base_type::const_iterator b_r, typename base_type::const_iterator e_r, bool compare_after /*= false */) const\n    {\n      while (b_l != e_l)\n\t{\n\t  if (b_r == e_r)\n\t    return (false);\n\t  if (base_type::e_pos(*b_l) != base_type::e_pos(*b_r))\n\t    return (false);\n\t  ++b_l;\n\t  ++b_r;\n\t}\n      return (!compare_after || b_r == e_r);\n    }\n\n    PB_DS_SYNTH_E_ACCESS_TRAITS_T_DEC\n    bool\n    PB_DS_SYNTH_E_ACCESS_TRAITS_C_DEC::\n    equal_keys(const_key_reference r_lhs_key, const_key_reference r_rhs_key) const\n    {\n      return (equal_prefixes(base_type::begin(r_lhs_key),\n\t\t\t     base_type::end(r_lhs_key),\n\t\t\t     base_type::begin(r_rhs_key),\n\t\t\t     base_type::end(r_rhs_key),\n\t\t\t     true));\n    }\n\n    PB_DS_SYNTH_E_ACCESS_TRAITS_T_DEC\n    bool\n    PB_DS_SYNTH_E_ACCESS_TRAITS_C_DEC::\n    cmp_prefixes(typename base_type::const_iterator b_l, typename base_type::const_iterator e_l, typename base_type::const_iterator b_r, typename base_type::const_iterator e_r, bool compare_after /* = false*/) const\n    {\n      while (b_l != e_l)\n\t{\n\t  if (b_r == e_r)\n\t    return (false);\n\t  const typename base_type::size_type l_pos =\n\t    base_type::e_pos(*b_l);\n\t  const typename base_type::size_type r_pos =\n\t    base_type::e_pos(*b_r);\n\t  if (l_pos != r_pos)\n\t    return (l_pos < r_pos);\n\t  ++b_l;\n\t  ++b_r;\n\t}\n\n      if (!compare_after)\n\treturn (false);\n      return (b_r != e_r);\n    }\n\n    PB_DS_SYNTH_E_ACCESS_TRAITS_T_DEC\n    bool\n    PB_DS_SYNTH_E_ACCESS_TRAITS_C_DEC::\n    cmp_keys(const_key_reference r_lhs_key, const_key_reference r_rhs_key) const\n    {\n      return (cmp_prefixes(base_type::begin(r_lhs_key),\n\t\t\t   base_type::end(r_lhs_key),\n\t\t\t   base_type::begin(r_rhs_key),\n\t\t\t   base_type::end(r_rhs_key),\n\t\t\t   true));\n    }\n\n    PB_DS_SYNTH_E_ACCESS_TRAITS_T_DEC\n    inline typename PB_DS_SYNTH_E_ACCESS_TRAITS_C_DEC::const_key_reference\n    PB_DS_SYNTH_E_ACCESS_TRAITS_C_DEC::\n    extract_key(const_reference r_val)\n    {\n      return (extract_key(r_val, s_set_ind));\n    }\n\n    PB_DS_SYNTH_E_ACCESS_TRAITS_T_DEC\n    inline typename PB_DS_SYNTH_E_ACCESS_TRAITS_C_DEC::const_key_reference\n    PB_DS_SYNTH_E_ACCESS_TRAITS_C_DEC::\n    extract_key(const_reference r_val, true_type)\n    {\n      return (r_val);\n    }\n\n    PB_DS_SYNTH_E_ACCESS_TRAITS_T_DEC\n    inline typename PB_DS_SYNTH_E_ACCESS_TRAITS_C_DEC::const_key_reference\n    PB_DS_SYNTH_E_ACCESS_TRAITS_C_DEC::\n    extract_key(const_reference r_val, false_type)\n    {\n      return (r_val.first);\n    }\n\n#ifdef _GLIBCXX_DEBUG\n    PB_DS_SYNTH_E_ACCESS_TRAITS_T_DEC\n    bool\n    PB_DS_SYNTH_E_ACCESS_TRAITS_C_DEC::\n    operator()(const_key_reference r_lhs, const_key_reference r_rhs)\n    {\n      return (cmp_keys(r_lhs, r_rhs));\n    }\n#endif \n\n#undef PB_DS_SYNTH_E_ACCESS_TRAITS_T_DEC\n#undef PB_DS_SYNTH_E_ACCESS_TRAITS_C_DEC\n\n  } // namespace detail\n} // namespace pb_ds\n\n#endif \n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/detail/pat_trie_/trace_fn_imps.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file trace_fn_imps.hpp\n * Contains an implementation class for pat_trie_.\n */\n\n#ifdef PB_DS_PAT_TRIE_TRACE_\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\ntrace() const\n{\n  std::cerr << std::endl;\n  if (m_p_head->m_p_parent == NULL)\n    return;\n  trace_node(m_p_head->m_p_parent, 0);\n  std::cerr << std::endl;\n}\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\ntrace_node(const_node_pointer p_nd, size_type level)\n{\n  for (size_type i = 0; i < level; ++i)\n    std::cerr << ' ';\n  std::cerr << p_nd << \" \";\n  std::cerr << ((p_nd->m_type == pat_trie_leaf_node_type) ? \"l \" : \"i \");\n\n  trace_node_metadata(p_nd, type_to_type<typename node::metadata_type>());\n  typename e_access_traits::const_iterator el_it = pref_begin(p_nd);\n  while (el_it != pref_end(p_nd))\n    {\n      std::cerr <<* el_it;\n      ++el_it;\n    }\n\n  if (p_nd->m_type == pat_trie_leaf_node_type)\n    {\n      std::cerr << std::endl;\n      return;\n    }\n\n  const_internal_node_pointer p_internal =\n    static_cast<const_internal_node_pointer>(p_nd);\n\n  std::cerr << \" \" <<\n    static_cast<unsigned long>(p_internal->get_e_ind()) << std::endl;\n\n  const size_type num_children = std::distance(p_internal->begin(),\n\t\t\t\t\t       p_internal->end());\n\n  for (size_type child_i = 0; child_i < num_children; ++child_i)\n    {\n      typename internal_node::const_iterator child_it =\n\tp_internal->begin();\n      std::advance(child_it, num_children - child_i - 1);\n      trace_node(*child_it, level + 1);\n    }\n}\n\nPB_DS_CLASS_T_DEC\ntemplate<typename Metadata_>\nvoid\nPB_DS_CLASS_C_DEC::\ntrace_node_metadata(const_node_pointer p_nd, type_to_type<Metadata_>)\n{\n  std::cerr << \"(\" << static_cast<unsigned long>(p_nd->get_metadata()) << \") \";\n}\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\ntrace_node_metadata(const_node_pointer, type_to_type<null_node_metadata>)\n{ }\n\n#endif \n\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/detail/pat_trie_/traits.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file traits.hpp\n * Contains an implementation class for pat_trie_.\n */\n\n#ifndef PB_DS_PAT_TRIE_NODE_AND_IT_TRAITS_HPP\n#define PB_DS_PAT_TRIE_NODE_AND_IT_TRAITS_HPP\n\n#include <ext/pb_ds/detail/pat_trie_/node_base.hpp>\n#include <ext/pb_ds/detail/pat_trie_/head.hpp>\n#include <ext/pb_ds/detail/pat_trie_/leaf.hpp>\n#include <ext/pb_ds/detail/pat_trie_/internal_node.hpp>\n#include <ext/pb_ds/detail/pat_trie_/point_iterators.hpp>\n#include <ext/pb_ds/detail/pat_trie_/node_iterators.hpp>\n#include <ext/pb_ds/detail/pat_trie_/synth_e_access_traits.hpp>\n\nnamespace pb_ds\n{\n  namespace detail\n  {\n\n    template<typename Key,\n\t     typename Mapped,\n\t     class E_Access_Traits,\n\t     template<typename Const_Node_Iterator,\n\t\t      class Node_Iterator,\n\t\t      class Cmp_Fn_,\n\t\t      class Allocator_>\n    class Node_Update,\n\t     class Allocator>\n    struct trie_traits<\n      Key,\n      Mapped,\n      E_Access_Traits,\n      Node_Update,\n      pat_trie_tag,\n      Allocator>\n    {\n    private:\n      typedef types_traits< Key, Mapped, Allocator, false> type_traits;\n\n    public:\n      typedef\n      typename trie_node_metadata_selector<\n      Key,\n      Mapped,\n      E_Access_Traits,\n      Node_Update,\n      Allocator>::type\n      metadata_type;\n\n      typedef E_Access_Traits e_access_traits;\n\n      typedef\n      synth_e_access_traits<\n\ttype_traits,\n\tfalse,\n\te_access_traits>\n      synth_e_access_traits;\n\n      typedef\n      pat_trie_node_base<\n\ttype_traits,\n\tsynth_e_access_traits,\n\tmetadata_type,\n\tAllocator>\n      node;\n\n      typedef\n      pat_trie_leaf<\n\ttype_traits,\n\tsynth_e_access_traits,\n\tmetadata_type,\n\tAllocator>\n      leaf;\n\n      typedef\n      pat_trie_head<\n\ttype_traits,\n\tsynth_e_access_traits,\n\tmetadata_type,\n\tAllocator>\n      head;\n\n      typedef\n      pat_trie_internal_node<\n\ttype_traits,\n\tsynth_e_access_traits,\n\tmetadata_type,\n\tAllocator>\n      internal_node;\n\n      typedef\n      pat_trie_const_it_<\n\ttype_traits,\n\tnode,\n\tleaf,\n\thead,\n\tinternal_node,\n\ttrue,\n\tAllocator>\n      const_iterator;\n\n      typedef\n      pat_trie_it_<\n\ttype_traits,\n\tnode,\n\tleaf,\n\thead,\n\tinternal_node,\n\ttrue,\n\tAllocator>\n      iterator;\n\n      typedef\n      pat_trie_const_it_<\n\ttype_traits,\n\tnode,\n\tleaf,\n\thead,\n\tinternal_node,\n\tfalse,\n\tAllocator>\n      const_reverse_iterator;\n\n      typedef\n      pat_trie_it_<\n\ttype_traits,\n\tnode,\n\tleaf,\n\thead,\n\tinternal_node,\n\tfalse,\n\tAllocator>\n      reverse_iterator;\n\n      typedef\n      pat_trie_const_node_it_<\n\tnode,\n\tleaf,\n\thead,\n\tinternal_node,\n\tconst_iterator,\n\titerator,\n\tsynth_e_access_traits,\n\tAllocator>\n      const_node_iterator;\n\n      typedef\n      pat_trie_node_it_<\n\tnode,\n\tleaf,\n\thead,\n\tinternal_node,\n\tconst_iterator,\n\titerator,\n\tsynth_e_access_traits,\n\tAllocator>\n      node_iterator;\n\n      typedef\n      Node_Update<\n\tconst_node_iterator,\n\tnode_iterator,\n\tE_Access_Traits,\n\tAllocator>\n      node_update;\n\n      typedef\n      pb_ds::null_trie_node_update<\n\tconst_node_iterator,\n\tnode_iterator,\n\tE_Access_Traits,\n\tAllocator>* \n      null_node_update_pointer;\n    };\n\n    template<typename Key,\n\t     class E_Access_Traits,\n\t     template<typename Const_Node_Iterator,\n\t\t      class Node_Iterator,\n\t\t      class Cmp_Fn_,\n\t\t      class Allocator_>\n    class Node_Update,\n\t     class Allocator>\n    struct trie_traits<\n      Key,\n      null_mapped_type,\n      E_Access_Traits,\n      Node_Update,\n      pat_trie_tag,\n      Allocator>\n    {\n    private:\n      typedef\n      types_traits<\n      Key,\n      null_mapped_type,\n      Allocator,\n      false>\n      type_traits;\n\n    public:\n      typedef\n      typename trie_node_metadata_selector<\n      Key,\n      null_mapped_type,\n      E_Access_Traits,\n      Node_Update,\n      Allocator>::type\n      metadata_type;\n\n      typedef E_Access_Traits e_access_traits;\n\n      typedef\n      synth_e_access_traits<\n\ttype_traits,\n\ttrue,\n\te_access_traits>\n      synth_e_access_traits;\n\n      typedef\n      pat_trie_node_base<\n\ttype_traits,\n\tsynth_e_access_traits,\n\tmetadata_type,\n\tAllocator>\n      node;\n\n      typedef\n      pat_trie_leaf<\n\ttype_traits,\n\tsynth_e_access_traits,\n\tmetadata_type,\n\tAllocator>\n      leaf;\n\n      typedef\n      pat_trie_head<\n\ttype_traits,\n\tsynth_e_access_traits,\n\tmetadata_type,\n\tAllocator>\n      head;\n\n      typedef\n      pat_trie_internal_node<\n\ttype_traits,\n\tsynth_e_access_traits,\n\tmetadata_type,\n\tAllocator>\n      internal_node;\n\n      typedef\n      pat_trie_const_it_<\n\ttype_traits,\n\tnode,\n\tleaf,\n\thead,\n\tinternal_node,\n\ttrue,\n\tAllocator>\n      const_iterator;\n\n      typedef const_iterator iterator;\n\n      typedef\n      pat_trie_const_it_<\n\ttype_traits,\n\tnode,\n\tleaf,\n\thead,\n\tinternal_node,\n\tfalse,\n\tAllocator>\n      const_reverse_iterator;\n\n      typedef const_reverse_iterator reverse_iterator;\n\n      typedef\n      pat_trie_const_node_it_<\n\tnode,\n\tleaf,\n\thead,\n\tinternal_node,\n\tconst_iterator,\n\titerator,\n\tsynth_e_access_traits,\n\tAllocator>\n      const_node_iterator;\n\n      typedef const_node_iterator node_iterator;\n\n      typedef\n      Node_Update<\n\tconst_node_iterator,\n\tnode_iterator,\n\tE_Access_Traits,\n\tAllocator>\n      node_update;\n\n      typedef\n      pb_ds::null_trie_node_update<\n\tconst_node_iterator,\n\tconst_node_iterator,\n\tE_Access_Traits,\n\tAllocator>* \n      null_node_update_pointer;\n    };\n\n  } // namespace detail\n} // namespace pb_ds\n\n#endif // #ifndef PB_DS_PAT_TRIE_NODE_AND_IT_TRAITS_HPP\n\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/detail/pat_trie_/update_fn_imps.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file update_fn_imps.hpp\n * Contains an implementation class for pat_trie_.\n */\n\nPB_DS_CLASS_T_DEC\ninline void\nPB_DS_CLASS_C_DEC::\napply_update(node_pointer /*p_nd*/, null_node_update_pointer)\n{ }\n\nPB_DS_CLASS_T_DEC\ntemplate<typename Node_Update_>\ninline void\nPB_DS_CLASS_C_DEC::\napply_update(node_pointer p_nd, Node_Update_*  /*p_update*/)\n{\n  Node_Update_::operator()(node_iterator(p_nd, this),\n\t\t\t   const_node_iterator(NULL, this));\n}\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/detail/priority_queue_base_dispatch.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file priority_queue_base_dispatch.hpp\n * Contains an pqiative container dispatching base.\n */\n\n#ifndef PB_DS_PRIORITY_QUEUE_BASE_DS_DISPATCHER_HPP\n#define PB_DS_PRIORITY_QUEUE_BASE_DS_DISPATCHER_HPP\n\n#include <ext/pb_ds/detail/pairing_heap_/pairing_heap_.hpp>\n#include <ext/pb_ds/detail/binomial_heap_/binomial_heap_.hpp>\n#include <ext/pb_ds/detail/rc_binomial_heap_/rc_binomial_heap_.hpp>\n#include <ext/pb_ds/detail/binary_heap_/binary_heap_.hpp>\n#include <ext/pb_ds/detail/thin_heap_/thin_heap_.hpp>\n\nnamespace pb_ds\n{\n    namespace detail\n    {\n\n      template<typename Value_Type, typename Cmp_Fn, typename Tag, typename Allocator>\n      struct priority_queue_base_dispatch;\n\n      template<typename Value_Type, typename Cmp_Fn, typename Allocator>\n      struct priority_queue_base_dispatch<Value_Type, Cmp_Fn, pairing_heap_tag, Allocator>\n      {\n\ttypedef pairing_heap_< Value_Type, Cmp_Fn, Allocator> type;\n      };\n\n      template<typename Value_Type, typename Cmp_Fn, typename Allocator>\n      struct priority_queue_base_dispatch<Value_Type, Cmp_Fn, binomial_heap_tag, Allocator>\n      {\n\ttypedef binomial_heap_< Value_Type, Cmp_Fn, Allocator> type;\n      };\n\n      template<typename Value_Type, typename Cmp_Fn, typename Allocator>\n      struct priority_queue_base_dispatch<Value_Type, Cmp_Fn, rc_binomial_heap_tag, Allocator>\n      {\n\ttypedef rc_binomial_heap_< Value_Type, Cmp_Fn, Allocator> type;\n      };\n\n      template<typename Value_Type, typename Cmp_Fn, typename Allocator>\n      struct priority_queue_base_dispatch<Value_Type, Cmp_Fn, binary_heap_tag, Allocator>\n      {\n\ttypedef binary_heap_< Value_Type, Cmp_Fn, Allocator> type;\n      };\n\n      template<typename Value_Type, typename Cmp_Fn, typename Allocator>\n      struct priority_queue_base_dispatch<Value_Type, Cmp_Fn, thin_heap_tag, Allocator>\n      {\n\ttypedef thin_heap_< Value_Type, Cmp_Fn, Allocator> type;\n      };\n\n    } // namespace detail\n} // namespace pb_ds\n\n#endif // #ifndef PB_DS_PRIORITY_QUEUE_BASE_DS_DISPATCHER_HPP\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/detail/rb_tree_map_/constructors_destructor_fn_imps.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file constructors_destructor_fn_imps.hpp\n * Contains an implementation for rb_tree_.\n */\n\nPB_DS_CLASS_T_DEC\ntemplate<typename It>\nvoid\nPB_DS_CLASS_C_DEC::\ncopy_from_range(It first_it, It last_it)\n{\n  while (first_it != last_it)\n    insert(*(first_it++));\n}\n\nPB_DS_CLASS_T_DEC\nPB_DS_CLASS_C_DEC::\nPB_DS_CLASS_NAME()\n{\n  initialize();\n  _GLIBCXX_DEBUG_ONLY(assert_valid();)\n}\n\nPB_DS_CLASS_T_DEC\nPB_DS_CLASS_C_DEC::\nPB_DS_CLASS_NAME(const Cmp_Fn& r_cmp_fn) :\n  base_type(r_cmp_fn)\n{\n  initialize();\n  _GLIBCXX_DEBUG_ONLY(assert_valid();)\n}\n\nPB_DS_CLASS_T_DEC\nPB_DS_CLASS_C_DEC::\nPB_DS_CLASS_NAME(const Cmp_Fn& r_cmp_fn, const node_update& r_node_update) :\n  base_type(r_cmp_fn, r_node_update)\n{\n  initialize();\n  _GLIBCXX_DEBUG_ONLY(assert_valid();)\n}\n\nPB_DS_CLASS_T_DEC\nPB_DS_CLASS_C_DEC::\nPB_DS_CLASS_NAME(const PB_DS_CLASS_C_DEC& other) :\n  base_type(other)\n{\n  initialize();\n  _GLIBCXX_DEBUG_ONLY(assert_valid();)\n}\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nswap(PB_DS_CLASS_C_DEC& other)\n{\n  _GLIBCXX_DEBUG_ONLY(assert_valid();)\n  base_type::swap(other);\n  _GLIBCXX_DEBUG_ONLY(assert_valid();)\n}\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\ninitialize()\n{ base_type::m_p_head->m_red = true; }\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/detail/rb_tree_map_/debug_fn_imps.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file debug_fn_imps.hpp\n * Contains an implementation for rb_tree_.\n */\n\n#ifdef _GLIBCXX_DEBUG\n\nPB_DS_CLASS_T_DEC\ntypename PB_DS_CLASS_C_DEC::size_type\nPB_DS_CLASS_C_DEC::\nassert_node_consistent(const node_pointer p_nd) const\n{\n  if (p_nd == NULL)\n    return 1;\n\n  const size_type l_height = assert_node_consistent(p_nd->m_p_left);\n  const size_type r_height = assert_node_consistent(p_nd->m_p_right);\n  if (p_nd->m_red)\n    {\n      _GLIBCXX_DEBUG_ASSERT(is_effectively_black(p_nd->m_p_left));\n      _GLIBCXX_DEBUG_ASSERT(is_effectively_black(p_nd->m_p_right));\n    }\n  _GLIBCXX_DEBUG_ASSERT(l_height == r_height);\n  return (p_nd->m_red ? 0 : 1) + l_height;\n}\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nassert_valid() const\n{\n  base_type::assert_valid();\n  const node_pointer p_head = base_type::m_p_head;\n  _GLIBCXX_DEBUG_ASSERT(p_head->m_red);\n  if (p_head->m_p_parent != NULL)\n    {\n      _GLIBCXX_DEBUG_ASSERT(!p_head->m_p_parent->m_red);\n      assert_node_consistent(p_head->m_p_parent);\n    }\n}\n\n#endif \n\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/detail/rb_tree_map_/erase_fn_imps.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file erase_fn_imps.hpp\n * Contains an implementation for rb_tree_.\n */\n\nPB_DS_CLASS_T_DEC\ninline bool\nPB_DS_CLASS_C_DEC::\nerase(const_key_reference r_key)\n{\n  point_iterator it = find(r_key);\n  if (it == base_type::end())\n    return false;\n  erase(it);\n  return true;\n}\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::iterator\nPB_DS_CLASS_C_DEC::\nerase(iterator it)\n{\n  _GLIBCXX_DEBUG_ONLY(assert_valid());\n  if (it == base_type::end())\n    return it;\n\n  iterator ret_it = it;\n  ++ret_it;\n  erase_node(it.m_p_nd);\n  _GLIBCXX_DEBUG_ONLY(assert_valid());\n  return ret_it;\n}\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::reverse_iterator\nPB_DS_CLASS_C_DEC::\nerase(reverse_iterator it)\n{\n  _GLIBCXX_DEBUG_ONLY(assert_valid());\n  if (it.m_p_nd == base_type::m_p_head)\n    return it;\n\n  reverse_iterator ret_it = it;\n  ++ret_it;\n  erase_node(it.m_p_nd);\n  _GLIBCXX_DEBUG_ONLY(assert_valid());\n  return ret_it;\n}\n\nPB_DS_CLASS_T_DEC\ntemplate<typename Pred>\ninline typename PB_DS_CLASS_C_DEC::size_type\nPB_DS_CLASS_C_DEC::\nerase_if(Pred pred)\n{\n  _GLIBCXX_DEBUG_ONLY(assert_valid();)\n  size_type num_ersd = 0;\n  iterator it = base_type::begin();\n  while (it != base_type::end())\n    {\n      if (pred(*it))\n        {\n\t  ++num_ersd;\n\t  it = erase(it);\n        }\n      else\n\t++it;\n    }\n\n  _GLIBCXX_DEBUG_ONLY(assert_valid();)\n  return num_ersd;\n}\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nerase_node(node_pointer p_nd)\n{\n  remove_node(p_nd);\n  base_type::actual_erase_node(p_nd);\n  _GLIBCXX_DEBUG_ONLY(assert_valid());\n}\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nremove_node(node_pointer p_z)\n{\n  update_min_max_for_erased_node(p_z);\n  node_pointer p_y = p_z;\n  node_pointer p_x = NULL;\n  node_pointer p_new_x_parent = NULL;\n\n  if (p_y->m_p_left == NULL)\n    p_x = p_y->m_p_right;\n  else if (p_y->m_p_right == NULL)\n    p_x = p_y->m_p_left;\n  else\n    {\n      p_y = p_y->m_p_right;\n      while (p_y->m_p_left != NULL)\n\tp_y = p_y->m_p_left;\n      p_x = p_y->m_p_right;\n    }\n\n  if (p_y == p_z)\n    {\n      p_new_x_parent = p_y->m_p_parent;\n      if (p_x != NULL)\n\tp_x->m_p_parent = p_y->m_p_parent;\n\n      if (base_type::m_p_head->m_p_parent == p_z)\n\tbase_type::m_p_head->m_p_parent = p_x;\n      else if (p_z->m_p_parent->m_p_left == p_z)\n        {\n\t  p_y->m_p_left = p_z->m_p_parent;\n\t  p_z->m_p_parent->m_p_left = p_x;\n        }\n      else\n        {\n\t  p_y->m_p_left = NULL;\n\t  p_z->m_p_parent->m_p_right = p_x;\n        }\n    }\n  else\n    {\n      p_z->m_p_left->m_p_parent = p_y;\n      p_y->m_p_left = p_z->m_p_left;\n      if (p_y != p_z->m_p_right)\n        {\n\t  p_new_x_parent = p_y->m_p_parent;\n\t  if (p_x != NULL)\n\t    p_x->m_p_parent = p_y->m_p_parent;\n\t  p_y->m_p_parent->m_p_left = p_x;\n\t  p_y->m_p_right = p_z->m_p_right;\n\t  p_z->m_p_right->m_p_parent = p_y;\n        }\n      else\n\tp_new_x_parent = p_y;\n\n      if (base_type::m_p_head->m_p_parent == p_z)\n\tbase_type::m_p_head->m_p_parent = p_y;\n      else if (p_z->m_p_parent->m_p_left == p_z)\n\tp_z->m_p_parent->m_p_left = p_y;\n      else\n\tp_z->m_p_parent->m_p_right = p_y;\n\n      p_y->m_p_parent = p_z->m_p_parent;\n      std::swap(p_y->m_red, p_z->m_red);\n      p_y = p_z;\n    }\n\n  update_to_top(p_new_x_parent, (node_update* )this);\n\n  if (p_y->m_red)\n    return;\n\n  remove_fixup(p_x, p_new_x_parent);\n}\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nremove_fixup(node_pointer p_x, node_pointer p_new_x_parent)\n{\n  _GLIBCXX_DEBUG_ASSERT(p_x == NULL || p_x->m_p_parent == p_new_x_parent);\n\n  while (p_x != base_type::m_p_head->m_p_parent && is_effectively_black(p_x))\n    if (p_x == p_new_x_parent->m_p_left)\n      {\n\tnode_pointer p_w = p_new_x_parent->m_p_right;\n\tif (p_w->m_red)\n\t  {\n\t    p_w->m_red = false;\n\t    p_new_x_parent->m_red = true;\n\t    base_type::rotate_left(p_new_x_parent);\n\t    p_w = p_new_x_parent->m_p_right;\n\t  }\n\n\tif (is_effectively_black(p_w->m_p_left) \n\t    && is_effectively_black(p_w->m_p_right))\n\t  {\n\t    p_w->m_red = true;\n\t    p_x = p_new_x_parent;\n\t    p_new_x_parent = p_new_x_parent->m_p_parent;\n\t  }\n\telse\n\t  {\n\t    if (is_effectively_black(p_w->m_p_right))\n\t      {\n\t\tif (p_w->m_p_left != NULL)\n\t\t  p_w->m_p_left->m_red = false;\n\n\t\tp_w->m_red = true;\n\t\tbase_type::rotate_right(p_w);\n\t\tp_w = p_new_x_parent->m_p_right;\n\t      }\n\n\t    p_w->m_red = p_new_x_parent->m_red;\n\t    p_new_x_parent->m_red = false;\n\n\t    if (p_w->m_p_right != NULL)\n\t      p_w->m_p_right->m_red = false;\n\n\t    base_type::rotate_left(p_new_x_parent);\n\t    update_to_top(p_new_x_parent, (node_update* )this);\n\t    break;\n\t  }\n      }\n    else\n      {\n\tnode_pointer p_w = p_new_x_parent->m_p_left;\n\tif (p_w->m_red == true)\n\t  {\n\t    p_w->m_red = false;\n\t    p_new_x_parent->m_red = true;\n\t    base_type::rotate_right(p_new_x_parent);\n\t    p_w = p_new_x_parent->m_p_left;\n\t  }\n\n\tif (is_effectively_black(p_w->m_p_right) \n\t    && is_effectively_black(p_w->m_p_left))\n\t  {\n\t    p_w->m_red = true;\n\t    p_x = p_new_x_parent;\n\t    p_new_x_parent = p_new_x_parent->m_p_parent;\n\t  }\n\telse\n\t  {\n\t    if (is_effectively_black(p_w->m_p_left))\n\t      {\n\t\tif (p_w->m_p_right != NULL)\n\t\t  p_w->m_p_right->m_red = false;\n\n\t\tp_w->m_red = true;\n\t\tbase_type::rotate_left(p_w);\n\t\tp_w = p_new_x_parent->m_p_left;\n\t      }\n\n\t    p_w->m_red = p_new_x_parent->m_red;\n\t    p_new_x_parent->m_red = false;\n\n\t    if (p_w->m_p_left != NULL)\n\t      p_w->m_p_left->m_red = false;\n\n\t    base_type::rotate_right(p_new_x_parent);\n\t    update_to_top(p_new_x_parent, (node_update* )this);\n\t    break;\n\t  }\n      }\n\n  if (p_x != NULL)\n    p_x->m_red = false;\n}\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/detail/rb_tree_map_/find_fn_imps.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file find_fn_imps.hpp\n * Contains an implementation for rb_tree_.\n */\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/detail/rb_tree_map_/info_fn_imps.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file info_fn_imps.hpp\n * Contains an implementation for rb_tree_.\n */\n\nPB_DS_CLASS_T_DEC\ninline bool\nPB_DS_CLASS_C_DEC::\nis_effectively_black(const node_pointer p_nd)\n{ return (p_nd == NULL || !p_nd->m_red); }\n\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/detail/rb_tree_map_/insert_fn_imps.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file insert_fn_imps.hpp\n * Contains an implementation for rb_tree_.\n */\n\nPB_DS_CLASS_T_DEC\ninline std::pair<typename PB_DS_CLASS_C_DEC::point_iterator, bool>\nPB_DS_CLASS_C_DEC::\ninsert(const_reference r_value)\n{\n  _GLIBCXX_DEBUG_ONLY(assert_valid();)\n  std::pair<point_iterator, bool> ins_pair = base_type::insert_leaf(r_value);\n  if (ins_pair.second == true)\n    {\n      ins_pair.first.m_p_nd->m_red = true;\n      _GLIBCXX_DEBUG_ONLY(this->structure_only_assert_valid();)\n      insert_fixup(ins_pair.first.m_p_nd);\n    }\n\n  _GLIBCXX_DEBUG_ONLY(assert_valid();)\n  return ins_pair;\n}\n\nPB_DS_CLASS_T_DEC\ninline void\nPB_DS_CLASS_C_DEC::\ninsert_fixup(node_pointer p_nd)\n{\n  _GLIBCXX_DEBUG_ASSERT(p_nd->m_red == true);\n  while (p_nd != base_type::m_p_head->m_p_parent && p_nd->m_p_parent->m_red)\n    {\n      if (p_nd->m_p_parent == p_nd->m_p_parent->m_p_parent->m_p_left)\n        {\n\t  node_pointer p_y = p_nd->m_p_parent->m_p_parent->m_p_right;\n\t  if (p_y != NULL && p_y->m_red)\n            {\n\t      p_nd->m_p_parent->m_red = false;\n\t      p_y->m_red = false;\n\t      p_nd->m_p_parent->m_p_parent->m_red = true;\n\t      p_nd = p_nd->m_p_parent->m_p_parent;\n            }\n\t  else\n            {\n\t      if (p_nd == p_nd->m_p_parent->m_p_right)\n                {\n\t\t  p_nd = p_nd->m_p_parent;\n\t\t  base_type::rotate_left(p_nd);\n                }\n\t      p_nd->m_p_parent->m_red = false;\n\t      p_nd->m_p_parent->m_p_parent->m_red = true;\n\t      base_type::rotate_right(p_nd->m_p_parent->m_p_parent);\n            }\n        }\n      else\n        {\n\t  node_pointer p_y = p_nd->m_p_parent->m_p_parent->m_p_left;\n\t  if (p_y != NULL && p_y->m_red)\n            {\n\t      p_nd->m_p_parent->m_red = false;\n\t      p_y->m_red = false;\n\t      p_nd->m_p_parent->m_p_parent->m_red = true;\n\t      p_nd = p_nd->m_p_parent->m_p_parent;\n            }\n\t  else\n            {\n\t      if (p_nd == p_nd->m_p_parent->m_p_left)\n                {\n\t\t  p_nd = p_nd->m_p_parent;\n\t\t  base_type::rotate_right(p_nd);\n                }\n\t      p_nd->m_p_parent->m_red = false;\n\t      p_nd->m_p_parent->m_p_parent->m_red = true;\n\t      base_type::rotate_left(p_nd->m_p_parent->m_p_parent);\n            }\n        }\n    }\n\n  base_type::update_to_top(p_nd, (node_update* )this);\n  base_type::m_p_head->m_p_parent->m_red = false;\n}\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/detail/rb_tree_map_/node.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file node.hpp\n * Contains an implementation for rb_tree_.\n */\n\n#ifndef PB_DS_RB_TREE_NODE_HPP\n#define PB_DS_RB_TREE_NODE_HPP\n\n#include <ext/pb_ds/detail/basic_tree_policy/null_node_metadata.hpp>\n\nnamespace pb_ds\n{\n  namespace detail\n  {\n    template<typename Value_Type, class Metadata, class Allocator>\n    struct rb_tree_node_\n    {\n    public:\n      typedef Value_Type value_type;\n      typedef Metadata metadata_type;\n\n      typedef\n      typename Allocator::template rebind<\n      rb_tree_node_<\n      Value_Type,\n      Metadata,\n      Allocator> >::other::pointer\n      node_pointer;\n\n      typedef\n      typename Allocator::template rebind<\n\tmetadata_type>::other::reference\n      metadata_reference;\n\n      typedef\n      typename Allocator::template rebind<\n\tmetadata_type>::other::const_reference\n      const_metadata_reference;\n\n      inline bool\n      special() const\n      { return m_red; }\n\n      inline const_metadata_reference\n      get_metadata() const\n      { return m_metadata; }\n\n      inline metadata_reference\n      get_metadata()\n      { return m_metadata; }\n\n#ifdef PB_DS_BIN_SEARCH_TREE_TRACE_\n      void\n      trace() const\n      {\n\tstd::cout << PB_DS_V2F(m_value) <<(m_red? \" <r> \" : \" <b> \") \n\t\t  << \"(\" << m_metadata << \")\";\n      }\n#endif\n\n      node_pointer m_p_left;\n      node_pointer m_p_right;\n      node_pointer m_p_parent;\n      value_type m_value;\n      bool m_red;\n      metadata_type m_metadata;\n    };\n\n    template<typename Value_Type, class Allocator>\n    struct rb_tree_node_<Value_Type, null_node_metadata, Allocator>\n    {\n    public:\n      typedef Value_Type value_type;\n      typedef null_node_metadata metadata_type;\n\n      typedef\n      typename Allocator::template rebind<\n      rb_tree_node_<\n      Value_Type,\n      null_node_metadata,\n      Allocator> >::other::pointer\n      node_pointer;\n\n      inline bool\n      special() const\n      { return m_red; }\n\n#ifdef PB_DS_BIN_SEARCH_TREE_TRACE_\n      void\n      trace() const\n      { std::cout << PB_DS_V2F(m_value) <<(m_red? \" <r> \" : \" <b> \"); }\n#endif \n\n      node_pointer m_p_left;\n      node_pointer m_p_right;\n      node_pointer m_p_parent;\n      value_type m_value;\n      bool m_red;\n    };\n  } // namespace detail\n} // namespace pb_ds\n\n#endif \n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/detail/rb_tree_map_/rb_tree_.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file rb_tree_.hpp\n * Contains an implementation for rb_tree_.\n */\n/*\n * This implementation uses an idea from the SGI STL (using a \"header\" node\n *    which is needed for efficient iteration).\n */\n\n#ifdef PB_DS_DATA_TRUE_INDICATOR\n#ifndef PB_DS_BIN_SEARCH_TREE_HPP__DATA_TRUE_INDICATOR\n#define PB_DS_BIN_SEARCH_TREE_HPP__DATA_TRUE_INDICATOR\n#include <ext/pb_ds/detail/bin_search_tree_/bin_search_tree_.hpp>\n#endif \n#endif \n\n#ifdef PB_DS_DATA_FALSE_INDICATOR\n#ifndef PB_DS_BIN_SEARCH_TREE_HPP__DATA_FALSE_INDICATOR\n#define PB_DS_BIN_SEARCH_TREE_HPP__DATA_FALSE_INDICATOR\n#include <ext/pb_ds/detail/bin_search_tree_/bin_search_tree_.hpp>\n#endif \n#endif \n\n#include <ext/pb_ds/detail/standard_policies.hpp>\n#include <ext/pb_ds/detail/basic_types.hpp>\n#include <utility>\n#include <vector>\n#include <assert.h>\n#include <debug/debug.h>\n\nnamespace pb_ds\n{\n  namespace detail\n  {\n#define PB_DS_CLASS_T_DEC \\\n    template<typename Key, typename Mapped, typename Cmp_Fn, \\\n\t     typename Node_And_It_Traits, typename Allocator>\n\n#ifdef PB_DS_DATA_TRUE_INDICATOR\n#define PB_DS_CLASS_NAME rb_tree_data_\n#endif \n\n#ifdef PB_DS_DATA_TRUE_INDICATOR\n#define PB_DS_BASE_CLASS_NAME bin_search_tree_data_\n#endif \n\n#ifdef PB_DS_DATA_FALSE_INDICATOR\n#define PB_DS_CLASS_NAME rb_tree_no_data_\n#endif \n\n#ifdef PB_DS_DATA_FALSE_INDICATOR\n#define PB_DS_BASE_CLASS_NAME bin_search_tree_no_data_\n#endif \n\n#define PB_DS_CLASS_C_DEC \\\n    PB_DS_CLASS_NAME<Key, Mapped, Cmp_Fn, Node_And_It_Traits, Allocator>\n\n#define PB_DS_BASE_C_DEC \\\n    PB_DS_BASE_CLASS_NAME<Key, Mapped, Cmp_Fn, Node_And_It_Traits, Allocator>\n\n#ifdef PB_DS_DATA_TRUE_INDICATOR\n#define PB_DS_V2F(X) (X).first\n#define PB_DS_V2S(X) (X).second\n#define PB_DS_EP2VP(X)& ((X)->m_value)\n#endif \n\n#ifdef PB_DS_DATA_FALSE_INDICATOR\n#define PB_DS_V2F(X) (X)\n#define PB_DS_V2S(X) Mapped_Data()\n#define PB_DS_EP2VP(X)& ((X)->m_value.first)\n#endif \n\n    template<typename Key,\n\t     typename Mapped,\n\t     typename Cmp_Fn,\n\t     typename Node_And_It_Traits,\n\t     typename Allocator>\n    class PB_DS_CLASS_NAME : public PB_DS_BASE_C_DEC\n    {\n    private:\n      typedef PB_DS_BASE_C_DEC base_type;\n      typedef typename base_type::node_pointer node_pointer;\n\n    public:\n      typedef Cmp_Fn cmp_fn;\n      typedef Allocator allocator;\n      typedef typename Allocator::size_type size_type;\n      typedef typename Allocator::difference_type difference_type;\n      typedef typename base_type::key_type key_type;\n      typedef typename base_type::key_pointer key_pointer;\n      typedef typename base_type::const_key_pointer const_key_pointer;\n      typedef typename base_type::key_reference key_reference;\n      typedef typename base_type::const_key_reference const_key_reference;\n      typedef typename base_type::mapped_type mapped_type;\n      typedef typename base_type::mapped_pointer mapped_pointer;\n      typedef typename base_type::const_mapped_pointer const_mapped_pointer;\n      typedef typename base_type::mapped_reference mapped_reference;\n      typedef typename base_type::const_mapped_reference const_mapped_reference;\n      typedef typename base_type::value_type value_type;\n      typedef typename base_type::pointer pointer;\n      typedef typename base_type::const_pointer const_pointer;\n      typedef typename base_type::reference reference;\n      typedef typename base_type::const_reference const_reference;\n      typedef typename base_type::point_iterator point_iterator;\n      typedef typename base_type::const_iterator const_point_iterator;\n      typedef typename base_type::iterator iterator;\n      typedef typename base_type::const_iterator const_iterator;\n      typedef typename base_type::reverse_iterator reverse_iterator;\n      typedef typename base_type::const_reverse_iterator const_reverse_iterator;\n      typedef typename base_type::node_update node_update;\n\n\n      PB_DS_CLASS_NAME();\n\n      PB_DS_CLASS_NAME(const Cmp_Fn&);\n\n      PB_DS_CLASS_NAME(const Cmp_Fn&, const node_update&);\n\n      PB_DS_CLASS_NAME(const PB_DS_CLASS_C_DEC&);\n\n      void\n      swap(PB_DS_CLASS_C_DEC&);\n\n      template<typename It>\n      void\n      copy_from_range(It, It);\n\n      inline std::pair<point_iterator, bool>\n      insert(const_reference);\n\n      inline mapped_reference\n      operator[](const_key_reference r_key)\n      {\n#ifdef PB_DS_DATA_TRUE_INDICATOR\n\t_GLIBCXX_DEBUG_ONLY(assert_valid();)\n\tstd::pair<point_iterator, bool> ins_pair =\n\tbase_type::insert_leaf(value_type(r_key, mapped_type()));\n\n\tif (ins_pair.second == true)\n\t  {\n\t    ins_pair.first.m_p_nd->m_red = true;\n\t    _GLIBCXX_DEBUG_ONLY(this->structure_only_assert_valid();)\n\t    insert_fixup(ins_pair.first.m_p_nd);\n\t  }\n\t_GLIBCXX_DEBUG_ONLY(assert_valid();)\n\treturn ins_pair.first.m_p_nd->m_value.second;\n#else \n\tinsert(r_key);\n\treturn base_type::s_null_mapped;\n#endif \n      }\n\n      inline bool\n      erase(const_key_reference);\n\n      inline iterator\n      erase(iterator);\n\n      inline reverse_iterator\n      erase(reverse_iterator);\n\n      template<typename Pred>\n      inline size_type\n      erase_if(Pred);\n\n      void\n      join(PB_DS_CLASS_C_DEC&);\n\n      void\n      split(const_key_reference, PB_DS_CLASS_C_DEC&);\n\n    protected:\n\n    private:\n\n#ifdef _GLIBCXX_DEBUG\n      void\n      assert_valid() const;\n\n      size_type\n      assert_node_consistent(const node_pointer) const;\n#endif \n\n      inline static bool\n      is_effectively_black(const node_pointer);\n\n      void\n      initialize();\n\n      void\n      insert_fixup(node_pointer);\n\n      void\n      erase_node(node_pointer);\n\n      void\n      remove_node(node_pointer);\n\n      void\n      remove_fixup(node_pointer, node_pointer);\n\n      void\n      split_imp(node_pointer, PB_DS_CLASS_C_DEC&);\n\n      inline node_pointer\n      split_min();\n\n      std::pair<node_pointer, node_pointer>\n      split_min_imp();\n\n      void\n      join_imp(node_pointer, node_pointer);\n\n      std::pair<node_pointer, node_pointer>\n      find_join_pos_right(node_pointer, size_type, size_type);\n\n      std::pair<node_pointer, node_pointer>\n      find_join_pos_left(node_pointer, size_type, size_type);\n\n      inline size_type\n      black_height(node_pointer);\n\n      void\n      split_at_node(node_pointer, PB_DS_CLASS_C_DEC&);\n    };\n\n#include <ext/pb_ds/detail/rb_tree_map_/constructors_destructor_fn_imps.hpp>\n#include <ext/pb_ds/detail/rb_tree_map_/insert_fn_imps.hpp>\n#include <ext/pb_ds/detail/rb_tree_map_/erase_fn_imps.hpp>\n#include <ext/pb_ds/detail/rb_tree_map_/debug_fn_imps.hpp>\n#include <ext/pb_ds/detail/rb_tree_map_/split_join_fn_imps.hpp>\n#include <ext/pb_ds/detail/rb_tree_map_/info_fn_imps.hpp>\n\n#undef PB_DS_CLASS_T_DEC\n#undef PB_DS_CLASS_C_DEC\n#undef PB_DS_CLASS_NAME\n#undef PB_DS_BASE_CLASS_NAME\n#undef PB_DS_BASE_C_DEC\n#undef PB_DS_V2F\n#undef PB_DS_EP2VP\n#undef PB_DS_V2S\n\n  } // namespace detail\n} // namespace pb_ds\n\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/detail/rb_tree_map_/split_join_fn_imps.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file split_join_fn_imps.hpp\n * Contains an implementation for rb_tree_.\n */\n\nPB_DS_CLASS_T_DEC\ninline void\nPB_DS_CLASS_C_DEC::\njoin(PB_DS_CLASS_C_DEC& other)\n{\n  _GLIBCXX_DEBUG_ONLY(assert_valid();)\n  _GLIBCXX_DEBUG_ONLY(other.assert_valid();)\n  _GLIBCXX_DEBUG_ONLY(other.base_type::assert_valid();)\n  if (base_type::join_prep(other) == false)\n    {\n      _GLIBCXX_DEBUG_ONLY(assert_valid();)\n      _GLIBCXX_DEBUG_ONLY(other.assert_valid();)\n      return;\n    }\n\n  const node_pointer p_x = other.split_min();\n  join_imp(p_x, other.m_p_head->m_p_parent);\n  base_type::join_finish(other);\n  _GLIBCXX_DEBUG_ONLY(assert_valid();)\n  _GLIBCXX_DEBUG_ONLY(base_type::assert_valid();)\n  _GLIBCXX_DEBUG_ONLY(other.assert_valid();)\n  _GLIBCXX_DEBUG_ONLY(other.base_type::assert_valid();)\n }\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\njoin_imp(node_pointer p_x, node_pointer p_r)\n{\n  _GLIBCXX_DEBUG_ASSERT(p_x != NULL);\n  if (p_r != NULL)\n    p_r->m_red = false;\n\n  const size_type h = black_height(base_type::m_p_head->m_p_parent);\n  const size_type other_h = black_height(p_r);\n  node_pointer p_x_l;\n  node_pointer p_x_r;\n  std::pair<node_pointer, node_pointer> join_pos;\n  const bool right_join = h >= other_h;\n  if (right_join)\n    {\n      join_pos = find_join_pos_right(base_type::m_p_head->m_p_parent, \n\t\t\t\t     h, other_h);\n      p_x_l = join_pos.first;\n      p_x_r = p_r;\n    }\n  else\n    {\n      p_x_l = base_type::m_p_head->m_p_parent;\n      base_type::m_p_head->m_p_parent = p_r;\n      if (p_r != NULL)\n\tp_r->m_p_parent = base_type::m_p_head;\n\n      join_pos = find_join_pos_left(base_type::m_p_head->m_p_parent, \n\t\t\t\t    h, other_h);\n      p_x_r = join_pos.first;\n    }\n\n  node_pointer p_parent = join_pos.second;\n  if (p_parent == base_type::m_p_head)\n    {\n      base_type::m_p_head->m_p_parent = p_x;\n      p_x->m_p_parent = base_type::m_p_head;\n    }\n  else\n    {\n      p_x->m_p_parent = p_parent;\n      if (right_join)\n\tp_x->m_p_parent->m_p_right = p_x;\n      else\n\tp_x->m_p_parent->m_p_left = p_x;\n    }\n\n  p_x->m_p_left = p_x_l;\n  if (p_x_l != NULL)\n    p_x_l->m_p_parent = p_x;\n\n  p_x->m_p_right = p_x_r;\n  if (p_x_r != NULL)\n    p_x_r->m_p_parent = p_x;\n\n  p_x->m_red = true;\n\n  base_type::initialize_min_max();\n  _GLIBCXX_DEBUG_ONLY(base_type::structure_only_assert_valid();)\n  base_type::update_to_top(p_x, (node_update* )this);\n  insert_fixup(p_x);\n  _GLIBCXX_DEBUG_ONLY(base_type::structure_only_assert_valid());\n}\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::node_pointer\nPB_DS_CLASS_C_DEC::\nsplit_min()\n{\n  node_pointer p_min = base_type::m_p_head->m_p_left;\n\n#ifdef _GLIBCXX_DEBUG\n  const node_pointer p_head = base_type::m_p_head;\n  _GLIBCXX_DEBUG_ASSERT(p_min != p_head);\n#endif \n\n  remove_node(p_min);\n  return p_min;\n}\n\nPB_DS_CLASS_T_DEC\nstd::pair<\n  typename PB_DS_CLASS_C_DEC::node_pointer,\n  typename PB_DS_CLASS_C_DEC::node_pointer>\nPB_DS_CLASS_C_DEC::\nfind_join_pos_right(node_pointer p_l, size_type h_l, size_type h_r)\n{\n  _GLIBCXX_DEBUG_ASSERT(h_l >= h_r);\n\n  if (base_type::m_p_head->m_p_parent == NULL)\n    return (std::make_pair((node_pointer)NULL, base_type::m_p_head));\n\n  node_pointer p_l_parent = base_type::m_p_head;\n  while (h_l > h_r)\n    {\n      if (p_l->m_red == false)\n        {\n\t  _GLIBCXX_DEBUG_ASSERT(h_l > 0);\n\t  --h_l;\n        }\n\n      p_l_parent = p_l;\n      p_l = p_l->m_p_right;\n    }\n\n  if (!is_effectively_black(p_l))\n    {\n      p_l_parent = p_l;\n      p_l = p_l->m_p_right;\n    }\n\n  _GLIBCXX_DEBUG_ASSERT(is_effectively_black(p_l));\n  _GLIBCXX_DEBUG_ASSERT(black_height(p_l) == h_r);\n  _GLIBCXX_DEBUG_ASSERT(p_l == NULL || p_l->m_p_parent == p_l_parent);\n  return std::make_pair(p_l, p_l_parent);\n}\n\nPB_DS_CLASS_T_DEC\nstd::pair<\n  typename PB_DS_CLASS_C_DEC::node_pointer,\n  typename PB_DS_CLASS_C_DEC::node_pointer>\nPB_DS_CLASS_C_DEC::\nfind_join_pos_left(node_pointer p_r, size_type h_l, size_type h_r)\n{\n  _GLIBCXX_DEBUG_ASSERT(h_r > h_l);\n  if (base_type::m_p_head->m_p_parent == NULL)\n    return (std::make_pair((node_pointer)NULL,\n\t\t\t   base_type::m_p_head));\n  node_pointer p_r_parent = base_type::m_p_head;\n  while (h_r > h_l)\n    {\n      if (p_r->m_red == false)\n        {\n\t  _GLIBCXX_DEBUG_ASSERT(h_r > 0);\n\t  --h_r;\n        }\n\n      p_r_parent = p_r;\n      p_r = p_r->m_p_left;\n    }\n\n  if (!is_effectively_black(p_r))\n    {\n      p_r_parent = p_r;\n      p_r = p_r->m_p_left;\n    }\n\n  _GLIBCXX_DEBUG_ASSERT(is_effectively_black(p_r));\n  _GLIBCXX_DEBUG_ASSERT(black_height(p_r) == h_l);\n  _GLIBCXX_DEBUG_ASSERT(p_r == NULL || p_r->m_p_parent == p_r_parent);\n  return std::make_pair(p_r, p_r_parent);\n}\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::size_type\nPB_DS_CLASS_C_DEC::\nblack_height(node_pointer p_nd)\n{\n  size_type h = 1;\n  while (p_nd != NULL)\n    {\n      if (p_nd->m_red == false)\n\t++h;\n      p_nd = p_nd->m_p_left;\n    }\n  return h;\n}\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nsplit(const_key_reference r_key, PB_DS_CLASS_C_DEC& other)\n{\n  _GLIBCXX_DEBUG_ONLY(assert_valid());\n  _GLIBCXX_DEBUG_ONLY(base_type::assert_valid();)\n\n    _GLIBCXX_DEBUG_ONLY(other.assert_valid());\n  _GLIBCXX_DEBUG_ONLY(other.base_type::assert_valid();)\n\n    if (base_type::split_prep(r_key, other) == false)\n      {\n        _GLIBCXX_DEBUG_ONLY(assert_valid());\n        _GLIBCXX_DEBUG_ONLY(other.assert_valid());\n        return;\n      }\n\n  _GLIBCXX_DEBUG_ONLY(base_type::structure_only_assert_valid();)\n  _GLIBCXX_DEBUG_ONLY(other.base_type::structure_only_assert_valid();)\n  node_pointer p_nd = upper_bound(r_key).m_p_nd;\n  do\n    {\n      node_pointer p_next_nd = p_nd->m_p_parent;\n      if (Cmp_Fn::operator()(r_key, PB_DS_V2F(p_nd->m_value)))\n\tsplit_at_node(p_nd, other);\n\n      _GLIBCXX_DEBUG_ONLY(base_type::structure_only_assert_valid();)\n      _GLIBCXX_DEBUG_ONLY(other.base_type::structure_only_assert_valid();)\n      p_nd = p_next_nd;\n    }\n  while (p_nd != base_type::m_p_head);\n\n  base_type::split_finish(other);\n  _GLIBCXX_DEBUG_ONLY(assert_valid();)\n  _GLIBCXX_DEBUG_ONLY(assert_valid();)\n}\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nsplit_at_node(node_pointer p_nd, PB_DS_CLASS_C_DEC& other)\n{\n  _GLIBCXX_DEBUG_ASSERT(p_nd != NULL);\n\n  node_pointer p_l = p_nd->m_p_left;\n  node_pointer p_r = p_nd->m_p_right;\n  node_pointer p_parent = p_nd->m_p_parent;\n  if (p_parent == base_type::m_p_head)\n    {\n      base_type::m_p_head->m_p_parent = p_l;\n      if (p_l != NULL)\n        {\n\t  p_l->m_p_parent = base_type::m_p_head;\n\t  p_l->m_red = false;\n        }\n    }\n  else\n    {\n      if (p_parent->m_p_left == p_nd)\n\tp_parent->m_p_left = p_l;\n      else\n\tp_parent->m_p_right = p_l;\n\n      if (p_l != NULL)\n\tp_l->m_p_parent = p_parent;\n\n      update_to_top(p_parent, (node_update* )this);\n\n      if (!p_nd->m_red)\n\tremove_fixup(p_l, p_parent);\n    }\n\n  base_type::initialize_min_max();\n  other.join_imp(p_nd, p_r);\n  _GLIBCXX_DEBUG_ONLY(base_type::structure_only_assert_valid());\n  _GLIBCXX_DEBUG_ONLY(other.base_type::structure_only_assert_valid());\n}\n\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/detail/rb_tree_map_/traits.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file traits.hpp\n * Contains an implementation for rb_tree_.\n */\n\n#ifndef PB_DS_RB_TREE_NODE_AND_IT_TRAITS_HPP\n#define PB_DS_RB_TREE_NODE_AND_IT_TRAITS_HPP\n\n#include <ext/pb_ds/detail/rb_tree_map_/node.hpp>\n\nnamespace pb_ds\n{\n  namespace detail\n  {\n    template<typename Key,\n\t     typename Mapped,\n\t     typename Cmp_Fn,\n\t     template<typename Const_Node_Iterator,\n\t\t      class Node_Iterator,\n\t\t      class Cmp_Fn_,\n\t\t      class Allocator_>\n    class Node_Update,\n\t     typename Allocator>\n    struct tree_traits<\n      Key,\n      Mapped,\n      Cmp_Fn,\n      Node_Update,\n      rb_tree_tag,\n      Allocator> : public bin_search_tree_traits<\n      Key,\n      Mapped,\n      Cmp_Fn,\n      Node_Update,\n      rb_tree_node_<\n      typename types_traits<\n      Key,\n      Mapped,\n      Allocator,\n      false>::value_type,\n      typename tree_node_metadata_selector<\n      Key,\n      Mapped,\n      Cmp_Fn,\n      Node_Update,\n      Allocator>::type,\n      Allocator>,\n      Allocator>\n    { };\n\n    template<typename Key,\n\t     class Cmp_Fn,\n\t     template<typename Const_Node_Iterator,\n\t\t      class Node_Iterator,\n\t\t      class Cmp_Fn_,\n\t\t      class Allocator_>\n    class Node_Update,\n\t     class Allocator>\n    struct tree_traits<\n      Key,\n      null_mapped_type,\n      Cmp_Fn,\n      Node_Update,\n      rb_tree_tag,\n      Allocator> : public bin_search_tree_traits<\n      Key,\n      null_mapped_type,\n      Cmp_Fn,\n      Node_Update,\n      rb_tree_node_<\n      typename types_traits<\n      Key,\n      null_mapped_type,\n      Allocator,\n      false>::value_type,\n      typename tree_node_metadata_selector<\n      Key,\n      null_mapped_type,\n      Cmp_Fn,\n      Node_Update,\n      Allocator>::type,\n      Allocator>,\n      Allocator>\n    { };\n\n  } // namespace detail\n} // namespace pb_ds\n\n#endif \n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/detail/rc_binomial_heap_/constructors_destructor_fn_imps.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file constructors_destructor_fn_imps.hpp\n * Contains an implementation for rc_binomial_heap_.\n */\n\nPB_DS_CLASS_T_DEC\nPB_DS_CLASS_C_DEC::\nrc_binomial_heap_()\n{\n  _GLIBCXX_DEBUG_ONLY(assert_valid();)\n    }\n\nPB_DS_CLASS_T_DEC\nPB_DS_CLASS_C_DEC::\nrc_binomial_heap_(const Cmp_Fn& r_cmp_fn) :\n  PB_DS_BASE_C_DEC(r_cmp_fn)\n{\n  _GLIBCXX_DEBUG_ONLY(assert_valid();)\n    }\n\nPB_DS_CLASS_T_DEC\nPB_DS_CLASS_C_DEC::\nrc_binomial_heap_(const PB_DS_CLASS_C_DEC& other) :\n  PB_DS_BASE_C_DEC(other)\n{\n  make_binomial_heap();\n\n  base_type::find_max();\n\n  _GLIBCXX_DEBUG_ONLY(assert_valid();)\n    }\n\nPB_DS_CLASS_T_DEC\nPB_DS_CLASS_C_DEC::\n~rc_binomial_heap_()\n{ }\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nswap(PB_DS_CLASS_C_DEC& other)\n{\n  _GLIBCXX_DEBUG_ONLY(assert_valid();)\n    _GLIBCXX_DEBUG_ONLY(other.assert_valid();)\n\n    base_type::swap(other);\n\n  m_rc.swap(other.m_rc);\n\n  _GLIBCXX_DEBUG_ONLY(assert_valid();)\n    _GLIBCXX_DEBUG_ONLY(other.assert_valid();)\n    }\n\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/detail/rc_binomial_heap_/debug_fn_imps.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file debug_fn_imps.hpp\n * Contains an implementation for rc_binomial_heap_.\n */\n\n#ifdef _GLIBCXX_DEBUG\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nassert_valid() const\n{\n  base_type::assert_valid(false);\n  if (!base_type::empty())\n    {\n      _GLIBCXX_DEBUG_ASSERT(base_type::m_p_max != NULL);\n      base_type::assert_max();\n    }\n\n  m_rc.assert_valid();\n\n  if (m_rc.empty())\n    {\n      base_type::assert_valid(true);\n      _GLIBCXX_DEBUG_ASSERT(next_2_pointer(base_type::m_p_root) == NULL);\n      return;\n    }\n\n  const_node_pointer p_nd = next_2_pointer(base_type::m_p_root);\n  typename rc_t::const_iterator it = m_rc.end();\n  --it;\n\n  while (p_nd != NULL)\n    {\n      _GLIBCXX_DEBUG_ASSERT(*it == p_nd);\n      const_node_pointer p_next = p_nd->m_p_next_sibling;\n      _GLIBCXX_DEBUG_ASSERT(p_next != NULL);\n      _GLIBCXX_DEBUG_ASSERT(p_nd->m_metadata == p_next->m_metadata);\n      _GLIBCXX_DEBUG_ASSERT(p_next->m_p_next_sibling == NULL ||\n\t\t       p_next->m_metadata < p_next->m_p_next_sibling->m_metadata);\n\n      --it;\n      p_nd = next_2_pointer(next_after_0_pointer(p_nd));\n    }\n  _GLIBCXX_DEBUG_ASSERT(it + 1 == m_rc.begin());\n}\n\nPB_DS_CLASS_T_DEC\ntypename PB_DS_CLASS_C_DEC::const_node_pointer\nPB_DS_CLASS_C_DEC::\nnext_2_pointer(const_node_pointer p_nd)\n{\n  if (p_nd == NULL)\n    return NULL;\n\n  node_pointer p_next = p_nd->m_p_next_sibling;\n\n  if (p_next == NULL)\n    return NULL;\n\n  if (p_nd->m_metadata == p_next->m_metadata)\n    return p_nd;\n\n  return next_2_pointer(p_next);\n}\n\nPB_DS_CLASS_T_DEC\ntypename PB_DS_CLASS_C_DEC::const_node_pointer\nPB_DS_CLASS_C_DEC::\nnext_after_0_pointer(const_node_pointer p_nd)\n{\n  if (p_nd == NULL)\n    return NULL;\n\n  node_pointer p_next = p_nd->m_p_next_sibling;\n\n  if (p_next == NULL)\n    return NULL;\n\n  if (p_nd->m_metadata < p_next->m_metadata)\n    return p_next;\n\n  return next_after_0_pointer(p_next);\n}\n\n#endif \n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/detail/rc_binomial_heap_/erase_fn_imps.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file erase_fn_imps.hpp\n * Contains an implementation for rc_binomial_heap_.\n */\n\nPB_DS_CLASS_T_DEC\ninline void\nPB_DS_CLASS_C_DEC::\npop()\n{\n  make_binomial_heap();\n  _GLIBCXX_DEBUG_ASSERT(!base_type::empty());\n  base_type::pop();\n  base_type::find_max();\n}\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nclear()\n{\n  base_type::clear();\n  m_rc.clear();\n}\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nmake_binomial_heap()\n{\n  node_pointer p_nd = base_type::m_p_root;\n  while (p_nd != NULL)\n    {\n      node_pointer p_next = p_nd->m_p_next_sibling;\n      if (p_next == NULL)\n\tp_nd = p_next;\n      else if (p_nd->m_metadata == p_next->m_metadata)\n\tp_nd = link_with_next_sibling(p_nd);\n      else if (p_nd->m_metadata < p_next->m_metadata)\n\tp_nd = p_next;\n#ifdef _GLIBCXX_DEBUG\n      else\n\t_GLIBCXX_DEBUG_ASSERT(0);\n#endif \n    }\n\n  m_rc.clear();\n}\n\nPB_DS_CLASS_T_DEC\ntemplate<typename Pred>\ntypename PB_DS_CLASS_C_DEC::size_type\nPB_DS_CLASS_C_DEC::\nerase_if(Pred pred)\n{\n  make_binomial_heap();\n  const size_type ersd = base_type::erase_if(pred);\n  base_type::find_max();\n  _GLIBCXX_DEBUG_ONLY(assert_valid();)\n  return ersd;\n}\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nerase(point_iterator it)\n{\n  make_binomial_heap();\n  base_type::erase(it);\n  base_type::find_max();\n}\n\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/detail/rc_binomial_heap_/insert_fn_imps.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file insert_fn_imps.hpp\n * Contains an implementation for rc_binomial_heap_.\n */\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::point_iterator\nPB_DS_CLASS_C_DEC::\npush(const_reference r_val)\n{\n  _GLIBCXX_DEBUG_ONLY(assert_valid();)\n\n    make_0_exposed();\n\n  _GLIBCXX_DEBUG_ONLY(assert_valid();)\n\n    node_pointer p_nd = base_type::get_new_node_for_insert(r_val);\n\n  p_nd->m_p_l_child = p_nd->m_p_prev_or_parent = NULL;\n  p_nd->m_metadata = 0;\n\n  if (base_type::m_p_max == NULL || Cmp_Fn::operator()(base_type::m_p_max->m_value, r_val))\n    base_type::m_p_max = p_nd;\n\n  p_nd->m_p_next_sibling = base_type::m_p_root;\n\n  if (base_type::m_p_root != NULL)\n    base_type::m_p_root->m_p_prev_or_parent = p_nd;\n\n  base_type::m_p_root = p_nd;\n\n  if (p_nd->m_p_next_sibling != NULL&&  p_nd->m_p_next_sibling->m_metadata == 0)\n    m_rc.push(p_nd);\n\n  _GLIBCXX_DEBUG_ONLY(assert_valid();)\n\n    return point_iterator(p_nd);\n}\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nmodify(point_iterator it, const_reference r_new_val)\n{\n  _GLIBCXX_DEBUG_ONLY(assert_valid();)\n\n    make_binomial_heap();\n\n  base_type::modify(it, r_new_val);\n\n  base_type::find_max();\n\n  _GLIBCXX_DEBUG_ONLY(assert_valid();)\n    }\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::node_pointer\nPB_DS_CLASS_C_DEC::\nlink_with_next_sibling(node_pointer p_nd)\n{\n  node_pointer p_next = p_nd->m_p_next_sibling;\n\n  _GLIBCXX_DEBUG_ASSERT(p_next != NULL);\n  _GLIBCXX_DEBUG_ASSERT(p_next->m_p_prev_or_parent == p_nd);\n\n  if (Cmp_Fn::operator()(p_nd->m_value, p_next->m_value))\n    {\n      p_next->m_p_prev_or_parent = p_nd->m_p_prev_or_parent;\n\n      if (p_next->m_p_prev_or_parent == NULL)\n\tbase_type::m_p_root = p_next;\n      else\n\tp_next->m_p_prev_or_parent->m_p_next_sibling = p_next;\n\n      if (base_type::m_p_max == p_nd)\n\tbase_type::m_p_max = p_next;\n\n      base_type::make_child_of(p_nd, p_next);\n\n      ++p_next->m_metadata;\n\n      return p_next;\n    }\n\n  p_nd->m_p_next_sibling = p_next->m_p_next_sibling;\n\n  if (p_nd->m_p_next_sibling != NULL)\n    p_nd->m_p_next_sibling->m_p_prev_or_parent = p_nd;\n\n  if (base_type::m_p_max == p_next)\n    base_type::m_p_max = p_nd;\n\n  base_type::make_child_of(p_next, p_nd);\n\n  ++p_nd->m_metadata;\n\n  return p_nd;\n}\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nmake_0_exposed()\n{\n  if (m_rc.empty())\n    return;\n\n  node_pointer p_nd = m_rc.top();\n\n  m_rc.pop();\n\n  _GLIBCXX_DEBUG_ASSERT(p_nd->m_p_next_sibling != NULL);\n  _GLIBCXX_DEBUG_ASSERT(p_nd->m_metadata == p_nd->m_p_next_sibling->m_metadata);\n\n  node_pointer p_res = link_with_next_sibling(p_nd);\n\n  if (p_res->m_p_next_sibling != NULL&&  p_res->m_metadata == p_res->m_p_next_sibling->m_metadata)\n    m_rc.push(p_res);\n}\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/detail/rc_binomial_heap_/rc.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file rc.hpp\n * Contains a redundant (binary counter).\n */\n\n#ifndef PB_DS_RC_HPP\n#define PB_DS_RC_HPP\n\nnamespace pb_ds\n{\n  namespace detail\n  {\n\n#define PB_DS_CLASS_T_DEC \\\n    template<typename Node, class Allocator>\n\n#define PB_DS_CLASS_C_DEC \\\n    rc<Node, Allocator>\n\n    template<typename Node, class Allocator>\n    class rc\n    {\n    private:\n      typedef Allocator allocator;\n\n      typedef typename allocator::size_type size_type;\n\n      typedef Node node;\n\n      typedef\n      typename allocator::template rebind<\n\tnode>::other::pointer\n      node_pointer;\n\n      typedef\n      typename allocator::template rebind<\n\tnode_pointer>::other::pointer\n      entry_pointer;\n\n      typedef\n      typename allocator::template rebind<\n\tnode_pointer>::other::const_pointer\n      const_entry_pointer;\n\n      enum\n\t{\n\t  max_entries = sizeof(size_type) << 3\n\t};\n\n    public:\n      typedef node_pointer entry;\n\n      typedef const_entry_pointer const_iterator;\n\n    public:\n      rc();\n\n      rc(const PB_DS_CLASS_C_DEC& other);\n\n      inline void\n      swap(PB_DS_CLASS_C_DEC& other);\n\n      inline void\n      push(entry p_nd);\n\n      inline node_pointer\n      top() const;\n\n      inline void\n      pop();\n\n      inline bool\n      empty() const;\n\n      inline size_type\n      size() const;\n\n      void\n      clear();\n\n      const const_iterator\n      begin() const;\n\n      const const_iterator\n      end() const;\n\n#ifdef _GLIBCXX_DEBUG\n      void\n      assert_valid() const;\n#endif \n\n#ifdef PB_DS_RC_BINOMIAL_HEAP_TRACE_\n      void\n      trace() const;\n#endif \n\n    private:\n      node_pointer m_a_entries[max_entries];\n\n      size_type m_over_top;\n    };\n\n    PB_DS_CLASS_T_DEC\n    PB_DS_CLASS_C_DEC::\n    rc() : m_over_top(0)\n    { _GLIBCXX_DEBUG_ONLY(assert_valid();) }\n\n    PB_DS_CLASS_T_DEC\n    PB_DS_CLASS_C_DEC::\n    rc(const PB_DS_CLASS_C_DEC& other) : m_over_top(0)\n    { _GLIBCXX_DEBUG_ONLY(assert_valid();) }\n\n    PB_DS_CLASS_T_DEC\n    inline void\n    PB_DS_CLASS_C_DEC::\n    swap(PB_DS_CLASS_C_DEC& other)\n    {\n      _GLIBCXX_DEBUG_ONLY(assert_valid();)\n      _GLIBCXX_DEBUG_ONLY(other.assert_valid();)\n\n      const size_type over_top = std::max(m_over_top, other.m_over_top);\n\n      for (size_type i = 0; i < over_top; ++i)\n\tstd::swap(m_a_entries[i], other.m_a_entries[i]);\n\n      std::swap(m_over_top, other.m_over_top);\n      _GLIBCXX_DEBUG_ONLY(assert_valid();)\n      _GLIBCXX_DEBUG_ONLY(other.assert_valid();)\n     }\n\n    PB_DS_CLASS_T_DEC\n    inline void\n    PB_DS_CLASS_C_DEC::\n    push(entry p_nd)\n    {\n      _GLIBCXX_DEBUG_ONLY(assert_valid();)\n      _GLIBCXX_DEBUG_ASSERT(m_over_top < max_entries);\n      m_a_entries[m_over_top++] = p_nd;\n      _GLIBCXX_DEBUG_ONLY(assert_valid();)\n    }\n\n    PB_DS_CLASS_T_DEC\n    inline void\n    PB_DS_CLASS_C_DEC::\n    pop()\n    {\n      _GLIBCXX_DEBUG_ONLY(assert_valid();)\n      _GLIBCXX_DEBUG_ASSERT(!empty());\n      --m_over_top;\n      _GLIBCXX_DEBUG_ONLY(assert_valid();)\n    }\n\n    PB_DS_CLASS_T_DEC\n    inline typename PB_DS_CLASS_C_DEC::node_pointer\n    PB_DS_CLASS_C_DEC::\n    top() const\n    {\n      _GLIBCXX_DEBUG_ONLY(assert_valid();)\n      _GLIBCXX_DEBUG_ASSERT(!empty());\n      return *(m_a_entries + m_over_top - 1);\n    }\n\n    PB_DS_CLASS_T_DEC\n    inline bool\n    PB_DS_CLASS_C_DEC::\n    empty() const\n    {\n      _GLIBCXX_DEBUG_ONLY(assert_valid();)\n      return m_over_top == 0;\n    }\n\n    PB_DS_CLASS_T_DEC\n    inline typename PB_DS_CLASS_C_DEC::size_type\n    PB_DS_CLASS_C_DEC::\n    size() const\n    { return m_over_top; }\n\n    PB_DS_CLASS_T_DEC\n    void\n    PB_DS_CLASS_C_DEC::\n    clear()\n    {\n      _GLIBCXX_DEBUG_ONLY(assert_valid();)\n      m_over_top = 0;\n      _GLIBCXX_DEBUG_ONLY(assert_valid();)\n    }\n\n    PB_DS_CLASS_T_DEC\n    const typename PB_DS_CLASS_C_DEC::const_iterator\n    PB_DS_CLASS_C_DEC::\n    begin() const\n    { return& m_a_entries[0]; }\n\n    PB_DS_CLASS_T_DEC\n    const typename PB_DS_CLASS_C_DEC::const_iterator\n    PB_DS_CLASS_C_DEC::\n    end() const\n    { return& m_a_entries[m_over_top]; }\n\n#ifdef _GLIBCXX_DEBUG\n    PB_DS_CLASS_T_DEC\n    void\n    PB_DS_CLASS_C_DEC::\n    assert_valid() const\n    { _GLIBCXX_DEBUG_ASSERT(m_over_top < max_entries); }\n#endif \n\n#ifdef PB_DS_RC_BINOMIAL_HEAP_TRACE_\n    PB_DS_CLASS_T_DEC\n    void\n    PB_DS_CLASS_C_DEC::\n    trace() const\n    {\n      std::cout << \"rc\" << std::endl;\n      for (size_type i = 0; i < m_over_top; ++i)\n\tstd::cerr << m_a_entries[i] << std::endl;\n      std::cout << std::endl;\n    }\n#endif \n\n#undef PB_DS_CLASS_T_DEC\n#undef PB_DS_CLASS_C_DEC\n\n} // namespace detail\n} // namespace pb_ds\n\n#endif \n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/detail/rc_binomial_heap_/rc_binomial_heap_.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file rc_binomial_heap_.hpp\n * Contains an implementation for rc_binomial_heap_.\n */\n\n/*\n * Redundant-counter binomial heap.\n */\n\n#include <ext/pb_ds/detail/cond_dealtor.hpp>\n#include <ext/pb_ds/detail/type_utils.hpp>\n#include <ext/pb_ds/detail/binomial_heap_base_/binomial_heap_base_.hpp>\n#include <ext/pb_ds/detail/rc_binomial_heap_/rc.hpp>\n#include <debug/debug.h>\n\nnamespace pb_ds\n{\n  namespace detail\n  {\n#define PB_DS_CLASS_T_DEC \\\n    template<typename Value_Type, class Cmp_Fn, class Allocator>\n\n#define PB_DS_CLASS_C_DEC \\\n    rc_binomial_heap_<Value_Type, Cmp_Fn, Allocator>\n\n#define PB_DS_BASE_C_DEC \\\n    binomial_heap_base_<Value_Type, Cmp_Fn, Allocator>\n\n#define PB_DS_RC_C_DEC \\\n    rc<typename PB_DS_BASE_C_DEC::node, Allocator>\n\n    /**\n     * class description = \"8y|\\|0|\\/|i41 h34p 74813\">\n     **/\n    template<typename Value_Type, class Cmp_Fn, class Allocator>\n    class rc_binomial_heap_ : public PB_DS_BASE_C_DEC\n    {\n\n    private:\n      typedef PB_DS_BASE_C_DEC base_type;\n\n      typedef typename base_type::node_pointer node_pointer;\n\n      typedef typename base_type::const_node_pointer const_node_pointer;\n\n      typedef PB_DS_RC_C_DEC rc_t;\n\n    public:\n\n      typedef typename Allocator::size_type size_type;\n\n      typedef typename Allocator::difference_type difference_type;\n\n      typedef Value_Type value_type;\n\n      typedef typename base_type::pointer pointer;\n\n      typedef typename base_type::const_pointer const_pointer;\n\n      typedef typename base_type::reference reference;\n\n      typedef typename base_type::const_reference const_reference;\n\n      typedef typename base_type::const_point_iterator const_point_iterator;\n\n      typedef typename base_type::point_iterator point_iterator;\n\n      typedef typename base_type::const_iterator const_iterator;\n\n      typedef typename base_type::iterator iterator;\n\n      typedef typename base_type::cmp_fn cmp_fn;\n\n      typedef typename base_type::allocator allocator;\n\n    public:\n\n      rc_binomial_heap_();\n\n      rc_binomial_heap_(const Cmp_Fn& r_cmp_fn);\n\n      rc_binomial_heap_(const PB_DS_CLASS_C_DEC& other);\n\n      ~rc_binomial_heap_();\n\n      void\n      swap(PB_DS_CLASS_C_DEC& other);\n\n      inline point_iterator\n      push(const_reference r_val);\n\n      void\n      modify(point_iterator it, const_reference r_new_val);\n\n      inline void\n      pop();\n\n      void\n      erase(point_iterator it);\n\n      inline void\n      clear();\n\n      template<typename Pred>\n      size_type\n      erase_if(Pred pred);\n\n      template<typename Pred>\n      void\n      split(Pred pred, PB_DS_CLASS_C_DEC& other);\n\n      void\n      join(PB_DS_CLASS_C_DEC& other);\n\n#ifdef _GLIBCXX_DEBUG\n      void\n      assert_valid() const;\n#endif \n\n#ifdef PB_DS_RC_BINOMIAL_HEAP_TRACE_\n      void\n      trace() const;\n#endif \n\n    private:\n\n      inline node_pointer\n      link_with_next_sibling(node_pointer p_nd);\n\n      void\n      make_0_exposed();\n\n      void\n      make_binomial_heap();\n\n#ifdef _GLIBCXX_DEBUG\n      static const_node_pointer\n      next_2_pointer(const_node_pointer p_nd);\n\n      static const_node_pointer\n      next_after_0_pointer(const_node_pointer p_nd);\n#endif \n\n    private:\n      rc_t m_rc;\n    };\n\n#include <ext/pb_ds/detail/rc_binomial_heap_/constructors_destructor_fn_imps.hpp>\n#include <ext/pb_ds/detail/rc_binomial_heap_/debug_fn_imps.hpp>\n#include <ext/pb_ds/detail/rc_binomial_heap_/erase_fn_imps.hpp>\n#include <ext/pb_ds/detail/rc_binomial_heap_/trace_fn_imps.hpp>\n#include <ext/pb_ds/detail/rc_binomial_heap_/insert_fn_imps.hpp>\n#include <ext/pb_ds/detail/rc_binomial_heap_/split_join_fn_imps.hpp>\n\n#undef PB_DS_CLASS_C_DEC\n\n#undef PB_DS_CLASS_T_DEC\n\n#undef PB_DS_BASE_C_DEC\n\n#undef PB_DS_RC_C_DEC\n  } // namespace detail\n} // namespace pb_ds\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/detail/rc_binomial_heap_/split_join_fn_imps.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file split_join_fn_imps.hpp\n * Contains an implementation for rc_binomial_heap_.\n */\n\nPB_DS_CLASS_T_DEC\ntemplate<typename Pred>\nvoid\nPB_DS_CLASS_C_DEC::\nsplit(Pred pred, PB_DS_CLASS_C_DEC& other)\n{\n  _GLIBCXX_DEBUG_ONLY(assert_valid();)\n    _GLIBCXX_DEBUG_ONLY(other.assert_valid();)\n\n    make_binomial_heap();\n  other.make_binomial_heap();\n\n  base_type::split(pred, other);\n\n  base_type::find_max();\n  other.find_max();\n\n  _GLIBCXX_DEBUG_ONLY(assert_valid();)\n    _GLIBCXX_DEBUG_ONLY(other.assert_valid();)\n    }\n\nPB_DS_CLASS_T_DEC\ninline void\nPB_DS_CLASS_C_DEC::\njoin(PB_DS_CLASS_C_DEC& other)\n{\n  _GLIBCXX_DEBUG_ONLY(assert_valid();)\n    _GLIBCXX_DEBUG_ONLY(other.assert_valid();)\n\n    make_binomial_heap();\n  other.make_binomial_heap();\n\n  base_type::join(other);\n\n  base_type::find_max();\n  other.find_max();\n\n  _GLIBCXX_DEBUG_ONLY(assert_valid();)\n    _GLIBCXX_DEBUG_ONLY(other.assert_valid();)\n    }\n\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/detail/rc_binomial_heap_/trace_fn_imps.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file trace_fn_imps.hpp\n * Contains an implementation for rc_binomial_heap_.\n */\n\n#ifdef PB_DS_RC_BINOMIAL_HEAP_TRACE_\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\ntrace() const\n{\n  base_type::trace();\n\n  m_rc.trace();\n}\n\n#endif // #ifdef PB_DS_RC_BINOMIAL_HEAP_TRACE_\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/detail/resize_policy/cc_hash_max_collision_check_resize_trigger_imp.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file cc_hash_max_collision_check_resize_trigger_imp.hpp\n * Contains a resize trigger implementation.\n */\n\n#define PB_DS_STATIC_ASSERT(UNIQUE, E) \\\n  typedef detail::static_assert_dumclass<sizeof(detail::static_assert<(bool)(E)>)> UNIQUE##static_assert_type\n\nPB_DS_CLASS_T_DEC\nPB_DS_CLASS_C_DEC::\ncc_hash_max_collision_check_resize_trigger(float load) :\n  m_load(load),\n  m_size(0),\n  m_num_col(0),\n  m_max_col(0),\n  m_resize_needed(false)\n{ }\n\nPB_DS_CLASS_T_DEC\ninline void\nPB_DS_CLASS_C_DEC::\nnotify_find_search_start()\n{ }\n\nPB_DS_CLASS_T_DEC\ninline void\nPB_DS_CLASS_C_DEC::\nnotify_find_search_collision()\n{ }\n\nPB_DS_CLASS_T_DEC\ninline void\nPB_DS_CLASS_C_DEC::\nnotify_find_search_end()\n{ }\n\nPB_DS_CLASS_T_DEC\ninline void\nPB_DS_CLASS_C_DEC::\nnotify_insert_search_start()\n{ m_num_col = 0; }\n\nPB_DS_CLASS_T_DEC\ninline void\nPB_DS_CLASS_C_DEC::\nnotify_insert_search_collision()\n{ ++m_num_col; }\n\nPB_DS_CLASS_T_DEC\ninline void\nPB_DS_CLASS_C_DEC::\nnotify_insert_search_end()\n{ calc_resize_needed(); }\n\nPB_DS_CLASS_T_DEC\ninline void\nPB_DS_CLASS_C_DEC::\nnotify_erase_search_start()\n{ }\n\nPB_DS_CLASS_T_DEC\ninline void\nPB_DS_CLASS_C_DEC::\nnotify_erase_search_collision()\n{ }\n\nPB_DS_CLASS_T_DEC\ninline void\nPB_DS_CLASS_C_DEC::\nnotify_erase_search_end()\n{ }\n\nPB_DS_CLASS_T_DEC\ninline void\nPB_DS_CLASS_C_DEC::\nnotify_inserted(size_type)\n{ }\n\nPB_DS_CLASS_T_DEC\ninline void\nPB_DS_CLASS_C_DEC::\nnotify_erased(size_type)\n{ m_resize_needed = true; }\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nnotify_cleared()\n{ m_resize_needed = false; }\n\nPB_DS_CLASS_T_DEC\ninline bool\nPB_DS_CLASS_C_DEC::\nis_resize_needed() const\n{ return m_resize_needed; }\n\nPB_DS_CLASS_T_DEC\ninline bool\nPB_DS_CLASS_C_DEC::\nis_grow_needed(size_type /*size*/, size_type /*num_used_e*/) const\n{ return m_num_col >= m_max_col; }\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nnotify_resized(size_type new_size)\n{\n  m_size = new_size;\n\n#ifdef PB_DS_HT_MAP_RESIZE_TRACE_\n  std::cerr << \"chmccrt::notify_resized \" \n\t    << static_cast<unsigned long>(new_size) << std::endl;\n#endif \n\n  calc_max_num_coll();\n  calc_resize_needed();\n  m_num_col = 0;\n}\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\ncalc_max_num_coll()\n{\n  // max_col <-- \\sqrt{2 load \\ln( 2 m \\ln( m ) ) }\n  const double ln_arg = 2 * m_size * ::log(double(m_size));\n  m_max_col = size_type(::ceil(::sqrt(2 * m_load * ::log(ln_arg))));\n\n#ifdef PB_DS_HT_MAP_RESIZE_TRACE_\n  std::cerr << \"chmccrt::calc_max_num_coll \" \n\t    << static_cast<unsigned long>(m_size) <<    \"    \" \n\t    << static_cast<unsigned long>(m_max_col) << std::endl;\n#endif \n}\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nnotify_externally_resized(size_type new_size)\n{ notify_resized(new_size); }\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nswap(PB_DS_CLASS_C_DEC& other)\n{\n  std::swap(m_load, other.m_load);\n  std::swap(m_size, other.m_size);\n  std::swap(m_num_col, other.m_num_col);\n  std::swap(m_max_col, other.m_max_col);\n  std::swap(m_resize_needed, other.m_resize_needed);\n}\n\nPB_DS_CLASS_T_DEC\ninline float\nPB_DS_CLASS_C_DEC::\nget_load() const\n{\n  PB_DS_STATIC_ASSERT(access, external_load_access);\n  return m_load;\n}\n\nPB_DS_CLASS_T_DEC\ninline void\nPB_DS_CLASS_C_DEC::\ncalc_resize_needed()\n{ m_resize_needed = m_resize_needed || m_num_col >= m_max_col; }\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nset_load(float load)\n{\n  PB_DS_STATIC_ASSERT(access, external_load_access);\n  m_load = load;\n  calc_max_num_coll();\n  calc_resize_needed();\n}\n\n#undef PB_DS_STATIC_ASSERT\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/detail/resize_policy/hash_exponential_size_policy_imp.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file hash_exponential_size_policy_imp.hpp\n * Contains a resize size policy implementation.\n */\n\nPB_DS_CLASS_T_DEC\nPB_DS_CLASS_C_DEC::\nhash_exponential_size_policy(size_type start_size, size_type grow_factor) :\n  m_start_size(start_size),\n  m_grow_factor(grow_factor)\n{ }\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nswap(PB_DS_CLASS_C_DEC& other)\n{\n  std::swap(m_start_size, other.m_start_size);\n  std::swap(m_grow_factor, other.m_grow_factor);\n}\n\nPB_DS_CLASS_T_DEC\ntypename PB_DS_CLASS_C_DEC::size_type\nPB_DS_CLASS_C_DEC::\nget_nearest_larger_size(size_type size) const\n{\n  size_type ret = m_start_size;\n  while (ret <= size)\n    {\n      const size_type next_ret = ret*  m_grow_factor;\n      if (next_ret < ret)\n\t__throw_insert_error();\n      ret = next_ret;\n    }\n  return ret;\n}\n\nPB_DS_CLASS_T_DEC\ntypename PB_DS_CLASS_C_DEC::size_type\nPB_DS_CLASS_C_DEC::\nget_nearest_smaller_size(size_type size) const\n{\n  size_type ret = m_start_size;\n  while (true)\n    {\n      const size_type next_ret = ret*  m_grow_factor;\n      if (next_ret < ret)\n\t__throw_resize_error();\n      if (next_ret >= size)\n\treturn (ret);\n      ret = next_ret;\n    }\n  return ret;\n}\n\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/detail/resize_policy/hash_load_check_resize_trigger_imp.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file hash_load_check_resize_trigger_imp.hpp\n * Contains a resize trigger implementation.\n */\n\n#define PB_DS_STATIC_ASSERT(UNIQUE, E)  \\\n  typedef detail::static_assert_dumclass<sizeof(detail::static_assert<bool(E)>)> UNIQUE##static_assert_type\n\nPB_DS_CLASS_T_DEC\nPB_DS_CLASS_C_DEC::\nhash_load_check_resize_trigger(float load_min, float load_max) \n: m_load_min(load_min), m_load_max(load_max), m_next_shrink_size(0),\n  m_next_grow_size(0), m_resize_needed(false)\n{ _GLIBCXX_DEBUG_ONLY(assert_valid();) }\n\nPB_DS_CLASS_T_DEC\ninline void\nPB_DS_CLASS_C_DEC::\nnotify_find_search_start()\n{ _GLIBCXX_DEBUG_ONLY(assert_valid();) }\n\nPB_DS_CLASS_T_DEC\ninline void\nPB_DS_CLASS_C_DEC::\nnotify_find_search_collision()\n{ _GLIBCXX_DEBUG_ONLY(assert_valid();) }\n\nPB_DS_CLASS_T_DEC\ninline void\nPB_DS_CLASS_C_DEC::\nnotify_find_search_end()\n{ _GLIBCXX_DEBUG_ONLY(assert_valid();) }\n\nPB_DS_CLASS_T_DEC\ninline void\nPB_DS_CLASS_C_DEC::\nnotify_insert_search_start()\n{ _GLIBCXX_DEBUG_ONLY(assert_valid();) }\n\nPB_DS_CLASS_T_DEC\ninline void\nPB_DS_CLASS_C_DEC::\nnotify_insert_search_collision()\n{ _GLIBCXX_DEBUG_ONLY(assert_valid();) }\n\nPB_DS_CLASS_T_DEC\ninline void\nPB_DS_CLASS_C_DEC::\nnotify_insert_search_end()\n{ _GLIBCXX_DEBUG_ONLY(assert_valid();) }\n\nPB_DS_CLASS_T_DEC\ninline void\nPB_DS_CLASS_C_DEC::\nnotify_erase_search_start()\n{ _GLIBCXX_DEBUG_ONLY(assert_valid();) }\n\nPB_DS_CLASS_T_DEC\ninline void\nPB_DS_CLASS_C_DEC::\nnotify_erase_search_collision()\n{ _GLIBCXX_DEBUG_ONLY(assert_valid();) }\n\nPB_DS_CLASS_T_DEC\ninline void\nPB_DS_CLASS_C_DEC::\nnotify_erase_search_end()\n{ _GLIBCXX_DEBUG_ONLY(assert_valid();) }\n\nPB_DS_CLASS_T_DEC\ninline void\nPB_DS_CLASS_C_DEC::\nnotify_inserted(size_type num_entries)\n{\n  m_resize_needed = (num_entries >= m_next_grow_size);\n  size_base::set_size(num_entries);\n  _GLIBCXX_DEBUG_ONLY(assert_valid();)\n}\n\nPB_DS_CLASS_T_DEC\ninline void\nPB_DS_CLASS_C_DEC::\nnotify_erased(size_type num_entries)\n{\n  size_base::set_size(num_entries);\n  m_resize_needed = num_entries <= m_next_shrink_size;\n  _GLIBCXX_DEBUG_ONLY(assert_valid();)\n}\n\nPB_DS_CLASS_T_DEC\ninline bool\nPB_DS_CLASS_C_DEC::\nis_resize_needed() const\n{\n  _GLIBCXX_DEBUG_ONLY(assert_valid();)\n  return m_resize_needed;\n}\n\nPB_DS_CLASS_T_DEC\ninline bool\nPB_DS_CLASS_C_DEC::\nis_grow_needed(size_type /*size*/, size_type num_entries) const\n{\n  _GLIBCXX_DEBUG_ASSERT(m_resize_needed);\n  return num_entries >= m_next_grow_size;\n}\n\nPB_DS_CLASS_T_DEC\nPB_DS_CLASS_C_DEC::\n~hash_load_check_resize_trigger() { }\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nnotify_resized(size_type new_size)\n{\n  m_resize_needed = false;\n  m_next_grow_size = size_type(m_load_max * new_size - 1);\n  m_next_shrink_size = size_type(m_load_min * new_size);\n\n#ifdef PB_DS_HT_MAP_RESIZE_TRACE_\n  std::cerr << \"hlcrt::notify_resized \" <<\n    static_cast<unsigned long>(new_size) << \"    \" <<\n    static_cast<unsigned long>(m_load_min) << \"    \" <<\n    static_cast<unsigned long>(m_load_max) << \"    \" <<\n    static_cast<unsigned long>(m_next_shrink_size) << \" \" <<\n    static_cast<unsigned long>(m_next_grow_size) << \"    \" << std::endl;\n#endif \n\n  _GLIBCXX_DEBUG_ONLY(assert_valid();)\n}\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nnotify_externally_resized(size_type new_size)\n{\n  m_resize_needed = false;\n  size_type new_grow_size = size_type(m_load_max * new_size - 1);\n  size_type new_shrink_size = size_type(m_load_min * new_size );\n  if (new_grow_size >= m_next_grow_size)\n    {\n      _GLIBCXX_DEBUG_ASSERT(new_shrink_size > m_next_shrink_size);\n      m_next_grow_size = new_grow_size;\n      _GLIBCXX_DEBUG_ONLY(assert_valid();)\n\n#ifdef PB_DS_HT_MAP_RESIZE_TRACE_\n\tstd::cerr << \"hlcrt::notify_externally_resized1 \" <<\n        static_cast<unsigned long>(new_size) << \"    \" <<\n        static_cast<unsigned long>(m_load_min) << \"    \" <<\n        static_cast<unsigned long>(m_load_max) << \"    \" <<\n        static_cast<unsigned long>(m_next_shrink_size) << \" \" <<\n        static_cast<unsigned long>(m_next_grow_size) << \"    \" << std::endl;\n#endif \n      return;\n    }\n\n  _GLIBCXX_DEBUG_ASSERT(new_shrink_size <= m_next_shrink_size);\n  m_next_shrink_size = new_shrink_size;\n\n#ifdef PB_DS_HT_MAP_RESIZE_TRACE_\n  std::cerr << \"hlcrt::notify_externally_resized2 \" <<\n    static_cast<unsigned long>(new_size) << \"    \" <<\n    static_cast<unsigned long>(m_load_min) << \"    \" <<\n    static_cast<unsigned long>(m_load_max) << \"    \" <<\n    static_cast<unsigned long>(m_next_shrink_size) << \" \" <<\n    static_cast<unsigned long>(m_next_grow_size) << \"    \" << std::endl;\n#endif \n\n  _GLIBCXX_DEBUG_ONLY(assert_valid();)\n}\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nnotify_cleared()\n{\n  _GLIBCXX_DEBUG_ONLY(assert_valid();)\n  size_base::set_size(0);\n  m_resize_needed = (0 < m_next_shrink_size);\n  _GLIBCXX_DEBUG_ONLY(assert_valid();)\n}\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nswap(PB_DS_CLASS_C_DEC& other)\n{\n  _GLIBCXX_DEBUG_ONLY(assert_valid();)\n  _GLIBCXX_DEBUG_ONLY(other.assert_valid();)\n    \n  size_base::swap(other);\n  std::swap(m_load_min, other.m_load_min);\n  std::swap(m_load_max, other.m_load_max);\n  std::swap(m_resize_needed, other.m_resize_needed);\n  std::swap(m_next_grow_size, other.m_next_grow_size);\n  std::swap(m_next_shrink_size, other.m_next_shrink_size);\n\n  _GLIBCXX_DEBUG_ONLY(assert_valid();)\n  _GLIBCXX_DEBUG_ONLY(other.assert_valid();)\n}\n\nPB_DS_CLASS_T_DEC\ninline std::pair<float, float>\nPB_DS_CLASS_C_DEC::\nget_loads() const\n{\n  PB_DS_STATIC_ASSERT(access, external_load_access);\n  return std::make_pair(m_load_min, m_load_max);\n}\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nset_loads(std::pair<float, float> load_pair)\n{\n  PB_DS_STATIC_ASSERT(access, external_load_access);\n  const float old_load_min = m_load_min;\n  const float old_load_max = m_load_max;\n  const size_type old_next_shrink_size = m_next_shrink_size;\n  const size_type old_next_grow_size = m_next_grow_size;\n  const bool old_resize_needed = m_resize_needed;\n\n  try\n    {\n      m_load_min = load_pair.first;\n      m_load_max = load_pair.second;\n      do_resize(static_cast<size_type>(size_base::get_size() / ((m_load_min + m_load_max) / 2)));\n    }\n  catch (...)\n    {\n      m_load_min = old_load_min;\n      m_load_max = old_load_max;\n      m_next_shrink_size = old_next_shrink_size;\n      m_next_grow_size = old_next_grow_size;\n      m_resize_needed = old_resize_needed;\n      __throw_exception_again;\n    }\n}\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\ndo_resize(size_type)\n{ abort(); }\n\n#ifdef _GLIBCXX_DEBUG\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nassert_valid() const\n{\n  _GLIBCXX_DEBUG_ASSERT(m_load_max > m_load_min);\n  _GLIBCXX_DEBUG_ASSERT(m_next_grow_size >= m_next_shrink_size);\n}\n#endif \n\n#undef PB_DS_STATIC_ASSERT\n\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/detail/resize_policy/hash_load_check_resize_trigger_size_base.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file hash_load_check_resize_trigger_size_base.hpp\n * Contains an base holding size for some resize policies.\n */\n\n#ifndef PB_DS_HASH_LOAD_CHECK_RESIZE_TRIGGER_SIZE_BASE_HPP\n#define PB_DS_HASH_LOAD_CHECK_RESIZE_TRIGGER_SIZE_BASE_HPP\n\nnamespace pb_ds\n{\n  namespace detail\n  {\n    // Primary template.\n    template<typename Size_Type, bool Hold_Size>\n    class hash_load_check_resize_trigger_size_base;\n\n    // Specializations.\n    template<typename Size_Type>\n    class hash_load_check_resize_trigger_size_base<Size_Type, true>\n    {\n    protected:\n      typedef Size_Type size_type;\n\n      hash_load_check_resize_trigger_size_base(): m_size(0)\n      { }\n\n      inline void\n      swap(hash_load_check_resize_trigger_size_base& other)\n      { std::swap(m_size, other.m_size); }\n\n      inline void\n      set_size(size_type size)\n      { m_size = size; }\n\n      inline size_type\n      get_size() const\n      { return m_size; }\n\n    private:\n      size_type m_size;\n    };\n\n    template<typename Size_Type>\n    class hash_load_check_resize_trigger_size_base<Size_Type, false>\n    {\n    protected:\n      typedef Size_Type size_type;\n\n    protected:\n      inline void\n      swap(hash_load_check_resize_trigger_size_base& other) { }\n\n      inline void\n      set_size(size_type size) { }\n    };\n  } // namespace detail\n} // namespace pb_ds\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/detail/resize_policy/hash_prime_size_policy_imp.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file hash_prime_size_policy_imp.hpp\n * Contains a resize size policy implementation.\n */\n\nnamespace detail\n{\n  enum\n    {\n      num_distinct_sizes_32_bit = 30,\n      num_distinct_sizes_64_bit = 62,\n      num_distinct_sizes = sizeof(std::size_t) != 8 ? \n            num_distinct_sizes_32_bit : num_distinct_sizes_64_bit,\t\n    };\n\n  // Originally taken from the SGI implementation; acknowledged in the docs.\n  // Further modified (for 64 bits) from tr1's hashtable.\n  static const std::size_t g_a_sizes[num_distinct_sizes_64_bit] =\n    {\n      /* 0     */              5ul,\n      /* 1     */              11ul, \n      /* 2     */              23ul, \n      /* 3     */              47ul, \n      /* 4     */              97ul, \n      /* 5     */              199ul, \n      /* 6     */              409ul, \n      /* 7     */              823ul, \n      /* 8     */              1741ul, \n      /* 9     */              3469ul, \n      /* 10    */              6949ul, \n      /* 11    */              14033ul, \n      /* 12    */              28411ul, \n      /* 13    */              57557ul, \n      /* 14    */              116731ul, \n      /* 15    */              236897ul,\n      /* 16    */              480881ul, \n      /* 17    */              976369ul,\n      /* 18    */              1982627ul, \n      /* 19    */              4026031ul,\n      /* 20    */              8175383ul, \n      /* 21    */              16601593ul, \n      /* 22    */              33712729ul,\n      /* 23    */              68460391ul, \n      /* 24    */              139022417ul, \n      /* 25    */              282312799ul, \n      /* 26    */              573292817ul, \n      /* 27    */              1164186217ul,\n      /* 28    */              2364114217ul, \n      /* 29    */              4294967291ul,\n      /* 30    */ (std::size_t)8589934583ull,\n      /* 31    */ (std::size_t)17179869143ull,\n      /* 32    */ (std::size_t)34359738337ull,\n      /* 33    */ (std::size_t)68719476731ull,\n      /* 34    */ (std::size_t)137438953447ull,\n      /* 35    */ (std::size_t)274877906899ull,\n      /* 36    */ (std::size_t)549755813881ull,\n      /* 37    */ (std::size_t)1099511627689ull,\n      /* 38    */ (std::size_t)2199023255531ull,\n      /* 39    */ (std::size_t)4398046511093ull,\n      /* 40    */ (std::size_t)8796093022151ull,\n      /* 41    */ (std::size_t)17592186044399ull,\n      /* 42    */ (std::size_t)35184372088777ull,\n      /* 43    */ (std::size_t)70368744177643ull,\n      /* 44    */ (std::size_t)140737488355213ull,\n      /* 45    */ (std::size_t)281474976710597ull,\n      /* 46    */ (std::size_t)562949953421231ull, \n      /* 47    */ (std::size_t)1125899906842597ull,\n      /* 48    */ (std::size_t)2251799813685119ull, \n      /* 49    */ (std::size_t)4503599627370449ull,\n      /* 50    */ (std::size_t)9007199254740881ull, \n      /* 51    */ (std::size_t)18014398509481951ull,\n      /* 52    */ (std::size_t)36028797018963913ull, \n      /* 53    */ (std::size_t)72057594037927931ull,\n      /* 54    */ (std::size_t)144115188075855859ull,\n      /* 55    */ (std::size_t)288230376151711717ull,\n      /* 56    */ (std::size_t)576460752303423433ull,\n      /* 57    */ (std::size_t)1152921504606846883ull,\n      /* 58    */ (std::size_t)2305843009213693951ull,\n      /* 59    */ (std::size_t)4611686018427387847ull,\n      /* 60    */ (std::size_t)9223372036854775783ull,\n      /* 61    */ (std::size_t)18446744073709551557ull,\n    };\n\n} // namespace detail\n\nPB_DS_CLASS_T_DEC\ninline\nPB_DS_CLASS_C_DEC::\nhash_prime_size_policy(size_type n) : m_start_size(n)\n{ m_start_size = get_nearest_larger_size(n); }\n\nPB_DS_CLASS_T_DEC\ninline void\nPB_DS_CLASS_C_DEC::\nswap(PB_DS_CLASS_C_DEC& other)\n{ std::swap(m_start_size, other.m_start_size); }\n\nPB_DS_CLASS_T_DEC\ninline PB_DS_CLASS_C_DEC::size_type\nPB_DS_CLASS_C_DEC::\nget_nearest_larger_size(size_type n) const\n{\n  const std::size_t* const p_upper = std::upper_bound(detail::g_a_sizes, \n\t\t     detail::g_a_sizes + detail::num_distinct_sizes, n);\n\n  if (p_upper == detail::g_a_sizes + detail::num_distinct_sizes)\n    __throw_resize_error();\n  return *p_upper;\n}\n\nPB_DS_CLASS_T_DEC\ninline PB_DS_CLASS_C_DEC::size_type\nPB_DS_CLASS_C_DEC::\nget_nearest_smaller_size(size_type n) const\n{\n  const size_t* p_lower = std::lower_bound(detail::g_a_sizes, \n\t\t       detail::g_a_sizes + detail::num_distinct_sizes, n);\n\n  if (*p_lower >= n &&  p_lower != detail::g_a_sizes)\n    --p_lower;\n  if (*p_lower < m_start_size)\n    return m_start_size;\n  return *p_lower;\n}\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/detail/resize_policy/hash_standard_resize_policy_imp.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file hash_standard_resize_policy_imp.hpp\n * Contains a resize policy implementation.\n */\n\n#define PB_DS_STATIC_ASSERT(UNIQUE, E) \\\n  typedef detail::static_assert_dumclass<sizeof(detail::static_assert<(bool)(E)>)> UNIQUE##static_assert_type\n\nPB_DS_CLASS_T_DEC\nPB_DS_CLASS_C_DEC::\nhash_standard_resize_policy() \n: m_size(Size_Policy::get_nearest_larger_size(1))\n{ trigger_policy_base::notify_externally_resized(m_size); }\n\nPB_DS_CLASS_T_DEC\nPB_DS_CLASS_C_DEC::\nhash_standard_resize_policy(const Size_Policy& r_size_policy) \n: Size_Policy(r_size_policy), m_size(Size_Policy::get_nearest_larger_size(1))\n{ trigger_policy_base::notify_externally_resized(m_size); }\n\nPB_DS_CLASS_T_DEC\nPB_DS_CLASS_C_DEC::\nhash_standard_resize_policy(const Size_Policy& r_size_policy, \n\t\t\t    const Trigger_Policy& r_trigger_policy) \n: Size_Policy(r_size_policy), Trigger_Policy(r_trigger_policy),\n  m_size(Size_Policy::get_nearest_larger_size(1))\n{ trigger_policy_base::notify_externally_resized(m_size); }\n\nPB_DS_CLASS_T_DEC\nPB_DS_CLASS_C_DEC::\n~hash_standard_resize_policy()\n{ }\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nswap(PB_DS_CLASS_C_DEC& other)\n{\n  trigger_policy_base::swap(other);\n  size_policy_base::swap(other);\n  std::swap(m_size, other.m_size);\n}\n\nPB_DS_CLASS_T_DEC\ninline void\nPB_DS_CLASS_C_DEC::\nnotify_find_search_start()\n{ trigger_policy_base::notify_find_search_start(); }\n\nPB_DS_CLASS_T_DEC\ninline void\nPB_DS_CLASS_C_DEC::\nnotify_find_search_collision()\n{ trigger_policy_base::notify_find_search_collision(); }\n\nPB_DS_CLASS_T_DEC\ninline void\nPB_DS_CLASS_C_DEC::\nnotify_find_search_end()\n{ trigger_policy_base::notify_find_search_end(); }\n\nPB_DS_CLASS_T_DEC\ninline void\nPB_DS_CLASS_C_DEC::\nnotify_insert_search_start()\n{ trigger_policy_base::notify_insert_search_start(); }\n\nPB_DS_CLASS_T_DEC\ninline void\nPB_DS_CLASS_C_DEC::\nnotify_insert_search_collision()\n{ trigger_policy_base::notify_insert_search_collision(); }\n\nPB_DS_CLASS_T_DEC\ninline void\nPB_DS_CLASS_C_DEC::\nnotify_insert_search_end()\n{ trigger_policy_base::notify_insert_search_end(); }\n\nPB_DS_CLASS_T_DEC\ninline void\nPB_DS_CLASS_C_DEC::\nnotify_erase_search_start()\n{ trigger_policy_base::notify_erase_search_start(); }\n\nPB_DS_CLASS_T_DEC\ninline void\nPB_DS_CLASS_C_DEC::\nnotify_erase_search_collision()\n{ trigger_policy_base::notify_erase_search_collision(); }\n\nPB_DS_CLASS_T_DEC\ninline void\nPB_DS_CLASS_C_DEC::\nnotify_erase_search_end()\n{ trigger_policy_base::notify_erase_search_end(); }\n\nPB_DS_CLASS_T_DEC\ninline void\nPB_DS_CLASS_C_DEC::\nnotify_inserted(size_type num_e)\n{ trigger_policy_base::notify_inserted(num_e); }\n\nPB_DS_CLASS_T_DEC\ninline void\nPB_DS_CLASS_C_DEC::\nnotify_erased(size_type num_e)\n{ trigger_policy_base::notify_erased(num_e); }\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nnotify_cleared()\n{ trigger_policy_base::notify_cleared(); }\n\nPB_DS_CLASS_T_DEC\ninline bool\nPB_DS_CLASS_C_DEC::\nis_resize_needed() const\n{ return trigger_policy_base::is_resize_needed(); }\n\nPB_DS_CLASS_T_DEC\ntypename PB_DS_CLASS_C_DEC::size_type\nPB_DS_CLASS_C_DEC::\nget_new_size(size_type size, size_type num_used_e) const\n{\n  if (trigger_policy_base::is_grow_needed(size, num_used_e))\n    return size_policy_base::get_nearest_larger_size(size);\n  return size_policy_base::get_nearest_smaller_size(size);\n}\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nnotify_resized(size_type new_size)\n{\n  trigger_policy_base::notify_resized(new_size);\n  m_size = new_size;\n}\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::size_type\nPB_DS_CLASS_C_DEC::\nget_actual_size() const\n{\n  PB_DS_STATIC_ASSERT(access, external_size_access);\n  return m_size;\n}\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nresize(size_type new_size)\n{\n  PB_DS_STATIC_ASSERT(access, external_size_access);\n  size_type actual_size = size_policy_base::get_nearest_larger_size(1);\n  while (actual_size < new_size)\n    {\n      const size_type pot = size_policy_base::get_nearest_larger_size(actual_size);\n\n      if (pot == actual_size && pot < new_size)\n\t__throw_resize_error();\n      actual_size = pot;\n    }\n\n  if (actual_size > 0)\n    --actual_size;\n\n  const size_type old_size = m_size;\n  try\n    {\n      do_resize(actual_size - 1);\n    }\n  catch(insert_error& )\n    {\n      m_size = old_size;\n      __throw_resize_error();\n    }\n  catch(...)\n    {\n      m_size = old_size;\n      __throw_exception_again;\n    }\n}\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\ndo_resize(size_type)\n{\n  // Do nothing\n}\n\nPB_DS_CLASS_T_DEC\nTrigger_Policy& \nPB_DS_CLASS_C_DEC::\nget_trigger_policy()\n{ return *this; }\n\nPB_DS_CLASS_T_DEC\nconst Trigger_Policy& \nPB_DS_CLASS_C_DEC::\nget_trigger_policy() const\n{ return *this; }\n\nPB_DS_CLASS_T_DEC\nSize_Policy& \nPB_DS_CLASS_C_DEC::\nget_size_policy()\n{ return *this; }\n\nPB_DS_CLASS_T_DEC\nconst Size_Policy& \nPB_DS_CLASS_C_DEC::\nget_size_policy() const\n{ return *this; }\n\n#undef PB_DS_STATIC_ASSERT\n\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/detail/resize_policy/sample_resize_policy.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file sample_resize_policy.hpp\n * Contains a sample resize policy for hash tables.\n */\n\n#ifndef PB_DS_SAMPLE_RESIZE_POLICY_HPP\n#define PB_DS_SAMPLE_RESIZE_POLICY_HPP\n\n// A sample resize policy.\nclass sample_resize_policy\n{\npublic:\n\n  // Size type.\n  typedef size_t size_type;\n\n  // Default constructor.\n  sample_resize_policy();\n\n  // Copy constructor.\n  sample_range_hashing(const sample_resize_policy& other);\n\n  // Swaps content.\n  inline void\n  swap(sample_resize_policy& other);\n\nprotected:\n\n  // Notifies a search started.\n  inline void\n  notify_insert_search_start();\n\n  // Notifies a search encountered a collision.\n  inline void\n  notify_insert_search_collision();\n\n  // Notifies a search ended.\n  inline void\n  notify_insert_search_end();\n\n  // Notifies a search started.\n  inline void\n  notify_find_search_start();\n\n  // Notifies a search encountered a collision.\n  inline void\n  notify_find_search_collision();\n\n  // Notifies a search ended.\n  inline void\n  notify_find_search_end();\n\n  // Notifies a search started.\n  inline void\n  notify_erase_search_start();\n\n  // Notifies a search encountered a collision.\n  inline void\n  notify_erase_search_collision();\n\n  // Notifies a search ended.\n  inline void\n  notify_erase_search_end();\n\n  // Notifies an element was inserted.\n  inline void\n  notify_inserted(size_type num_e);\n\n  // Notifies an element was erased.\n  inline void\n  notify_erased(size_type num_e);\n\n  // Notifies the table was cleared.\n  void\n  notify_cleared();\n\n  // Notifies the table was resized to new_size.\n  void\n  notify_resized(size_type new_size);\n\n  // Queries whether a resize is needed.\n  inline bool\n  is_resize_needed() const;\n\n  // Queries what the new size should be.\n  size_type\n  get_new_size(size_type size, size_type num_used_e) const;\n};\n\n#endif \n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/detail/resize_policy/sample_resize_trigger.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file sample_resize_trigger.hpp\n * Contains a sample resize trigger policy class.\n */\n\n#ifndef PB_DS_SAMPLE_RESIZE_TRIGGER_HPP\n#define PB_DS_SAMPLE_RESIZE_TRIGGER_HPP\n\n// A sample resize trigger policy.\nclass sample_resize_trigger\n{\npublic:\n\n  // Size type.\n  typedef size_t size_type;\n\n  // Default constructor.\n  sample_resize_trigger();\n\n  // Copy constructor.\n  sample_range_hashing(const sample_resize_trigger& other);\n\n  // Swaps content.\n  inline void\n  swap(sample_resize_trigger& other);\n\nprotected:\n\n  // Notifies a search started.\n  inline void\n  notify_insert_search_start();\n\n  // Notifies a search encountered a collision.\n  inline void\n  notify_insert_search_collision();\n\n  // Notifies a search ended.\n  inline void\n  notify_insert_search_end();\n\n  // Notifies a search started.\n  inline void\n  notify_find_search_start();\n\n  // Notifies a search encountered a collision.\n  inline void\n  notify_find_search_collision();\n\n  // Notifies a search ended.\n  inline void\n  notify_find_search_end();\n\n  // Notifies a search started.\n  inline void\n  notify_erase_search_start();\n\n  // Notifies a search encountered a collision.\n  inline void\n  notify_erase_search_collision();\n\n  // Notifies a search ended.\n  inline void\n  notify_erase_search_end();\n\n  // Notifies an element was inserted. the total number of entries in\n  // the table is num_entries.\n  inline void\n  notify_inserted(size_type num_entries);\n\n  // Notifies an element was erased.\n  inline void\n  notify_erased(size_type num_entries);\n\n  // Notifies the table was cleared.\n  void\n  notify_cleared();\n\n  // Notifies the table was resized as a result of this object's\n  // signifying that a resize is needed.\n  void\n  notify_resized(size_type new_size);\n\n  // Notifies the table was resized externally.\n  void\n  notify_externally_resized(size_type new_size);\n\n  // Queries whether a resize is needed.\n  inline bool\n  is_resize_needed() const;\n\n  // Queries whether a grow is needed.\n  inline bool\n  is_grow_needed(size_type size, size_type num_entries) const;\n\nprivate:\n\n  // Resizes to new_size.\n  virtual void\n  do_resize(size_type new_size);\n};\n\n} // namespace pb_ds\n\n#endif \n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/detail/resize_policy/sample_size_policy.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file sample_size_policy.hpp\n * Contains a sample size resize-policy.\n */\n\n#ifndef PB_DS_SAMPLE_SIZE_POLICY_HPP\n#define PB_DS_SAMPLE_SIZE_POLICY_HPP\n\n// A sample size policy.\nclass sample_size_policy\n{\npublic:\n\n  // Size type.\n  typedef size_t size_type;\n\n  // Default constructor.\n  sample_size_policy();\n\n  // Copy constructor.\n  sample_range_hashing(const sample_size_policy& other);\n\n  // Swaps content.\n  inline void\n  swap(sample_size_policy& other);\n\nprotected:\n\n  // Given a __size size, returns a __size that is larger.\n  inline size_type\n  get_nearest_larger_size(size_type size) const;\n\n  // Given a __size size, returns a __size that is smaller.\n  inline size_type\n  get_nearest_smaller_size(size_type size) const;\n};\n\n#endif \n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/detail/splay_tree_/constructors_destructor_fn_imps.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file constructors_destructor_fn_imps.hpp\n * Contains an implementation class for splay_tree_.\n */\n\nPB_DS_CLASS_T_DEC\ntemplate<typename It>\nvoid\nPB_DS_CLASS_C_DEC::\ncopy_from_range(It first_it, It last_it)\n{\n  while (first_it != last_it)\n    insert(*(first_it++));\n}\n\nPB_DS_CLASS_T_DEC\nPB_DS_CLASS_C_DEC::\nPB_DS_CLASS_NAME()\n{\n  initialize();\n  _GLIBCXX_DEBUG_ONLY(assert_valid();)\n}\n\nPB_DS_CLASS_T_DEC\nPB_DS_CLASS_C_DEC::\nPB_DS_CLASS_NAME(const Cmp_Fn& r_cmp_fn) :\n  base_type(r_cmp_fn)\n{\n  initialize();\n  _GLIBCXX_DEBUG_ONLY(assert_valid();)\n}\n\nPB_DS_CLASS_T_DEC\nPB_DS_CLASS_C_DEC::\nPB_DS_CLASS_NAME(const Cmp_Fn& r_cmp_fn, const node_update& r_node_update) :\n  base_type(r_cmp_fn, r_node_update)\n{\n  initialize();\n  _GLIBCXX_DEBUG_ONLY(assert_valid();)\n}\n\nPB_DS_CLASS_T_DEC\nPB_DS_CLASS_C_DEC::\nPB_DS_CLASS_NAME(const PB_DS_CLASS_C_DEC& other) :\n  base_type(other)\n{\n  initialize();\n  _GLIBCXX_DEBUG_ONLY(assert_valid();)\n}\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nswap(PB_DS_CLASS_C_DEC& other)\n{\n  _GLIBCXX_DEBUG_ONLY(assert_valid();)\n  _GLIBCXX_DEBUG_ONLY(other.assert_valid();)\n  base_type::swap(other);\n  _GLIBCXX_DEBUG_ONLY(assert_valid();)\n  _GLIBCXX_DEBUG_ONLY(other.assert_valid();)\n}\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\ninitialize()\n{ base_type::m_p_head->m_special = true; }\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/detail/splay_tree_/debug_fn_imps.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file debug_fn_imps.hpp\n * Contains an implementation class for splay_tree_.\n */\n\n#ifdef _GLIBCXX_DEBUG\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nassert_valid() const\n{\n  base_type::assert_valid();\n  const node_pointer p_head = base_type::m_p_head;\n  assert_special_imp(p_head);\n}\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nassert_special_imp(const node_pointer p_nd) const\n{\n  if (p_nd == NULL)\n    return;\n\n  if (p_nd == base_type::m_p_head)\n    {\n      _GLIBCXX_DEBUG_ASSERT(p_nd->m_special);\n      assert_special_imp(p_nd->m_p_parent);\n      return;\n    }\n\n  _GLIBCXX_DEBUG_ASSERT(!p_nd->m_special);\n  assert_special_imp(p_nd->m_p_left);\n  assert_special_imp(p_nd->m_p_right);\n}\n\n#endif \n\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/detail/splay_tree_/erase_fn_imps.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file erase_fn_imps.hpp\n * Contains an implementation class for splay_tree_.\n */\n\nPB_DS_CLASS_T_DEC\ninline bool\nPB_DS_CLASS_C_DEC::\nerase(const_key_reference r_key)\n{\n  point_iterator it = find(r_key);\n  if (it == base_type::end())\n    return false;\n  erase(it);\n  return true;\n}\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::iterator\nPB_DS_CLASS_C_DEC::\nerase(iterator it)\n{\n  _GLIBCXX_DEBUG_ONLY(assert_valid());\n  if (it == base_type::end())\n    return it;\n  iterator ret_it = it;\n  ++ret_it;\n  erase_node(it.m_p_nd);\n  _GLIBCXX_DEBUG_ONLY(assert_valid());\n  return ret_it;\n}\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::reverse_iterator\nPB_DS_CLASS_C_DEC::\nerase(reverse_iterator it)\n{\n  _GLIBCXX_DEBUG_ONLY(assert_valid());\n  if (it.m_p_nd == base_type::m_p_head)\n    return (it);\n  reverse_iterator ret_it = it;\n  ++ret_it;\n  erase_node(it.m_p_nd);\n  _GLIBCXX_DEBUG_ONLY(assert_valid());\n  return ret_it;\n}\n\nPB_DS_CLASS_T_DEC\ntemplate<typename Pred>\ninline typename PB_DS_CLASS_C_DEC::size_type\nPB_DS_CLASS_C_DEC::\nerase_if(Pred pred)\n{\n  _GLIBCXX_DEBUG_ONLY(assert_valid();)\n  size_type num_ersd = 0;\n  iterator it = base_type::begin();\n  while (it != base_type::end())\n    {\n      if (pred(*it))\n        {\n\t  ++num_ersd;\n\t  it = erase(it);\n        }\n      else\n\t++it;\n    }\n  _GLIBCXX_DEBUG_ONLY(assert_valid();)\n  return num_ersd;\n}\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nerase_node(node_pointer p_nd)\n{\n  _GLIBCXX_DEBUG_ASSERT(p_nd != NULL);\n  splay(p_nd);\n\n  _GLIBCXX_DEBUG_ONLY(assert_valid();)\n  _GLIBCXX_DEBUG_ASSERT(p_nd == this->m_p_head->m_p_parent);\n\n  node_pointer p_l = p_nd->m_p_left;\n  node_pointer p_r = p_nd->m_p_right;\n\n  base_type::update_min_max_for_erased_node(p_nd);\n  base_type::actual_erase_node(p_nd);\n  if (p_r == NULL)\n    {\n      base_type::m_p_head->m_p_parent = p_l;\n      if (p_l != NULL)\n\tp_l->m_p_parent = base_type::m_p_head;\n      _GLIBCXX_DEBUG_ONLY(assert_valid();)\n      return;\n    }\n\n  node_pointer p_target_r = leftmost(p_r);\n  _GLIBCXX_DEBUG_ASSERT(p_target_r != NULL);\n  p_r->m_p_parent = base_type::m_p_head;\n  base_type::m_p_head->m_p_parent = p_r;\n  splay(p_target_r);\n\n  _GLIBCXX_DEBUG_ONLY(p_target_r->m_p_left = NULL);\n  _GLIBCXX_DEBUG_ASSERT(p_target_r->m_p_parent == this->m_p_head);\n  _GLIBCXX_DEBUG_ASSERT(this->m_p_head->m_p_parent == p_target_r);\n\n  p_target_r->m_p_left = p_l;\n  if (p_l != NULL)\n    p_l->m_p_parent = p_target_r;\n  _GLIBCXX_DEBUG_ONLY(assert_valid();)\n  apply_update(p_target_r, (node_update* )this);\n}\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::node_pointer\nPB_DS_CLASS_C_DEC::\nleftmost(node_pointer p_nd)\n{\n  _GLIBCXX_DEBUG_ASSERT(p_nd != NULL);\n  while (p_nd->m_p_left != NULL)\n    p_nd = p_nd->m_p_left;\n  return p_nd;\n}\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/detail/splay_tree_/find_fn_imps.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file find_fn_imps.hpp\n * Contains an implementation class for splay_tree_.\n */\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::point_iterator\nPB_DS_CLASS_C_DEC::\nfind(const_key_reference r_key)\n{\n  node_pointer p_found = find_imp(r_key);\n  if (p_found != base_type::m_p_head)\n    splay(p_found);\n  return point_iterator(p_found);\n}\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::const_point_iterator\nPB_DS_CLASS_C_DEC::\nfind(const_key_reference r_key) const\n{\n  const node_pointer p_found = find_imp(r_key);\n  if (p_found != base_type::m_p_head)\n    const_cast<PB_DS_CLASS_C_DEC* >(this)->splay(p_found);\n  return point_iterator(p_found);\n}\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::node_pointer\nPB_DS_CLASS_C_DEC::\nfind_imp(const_key_reference r_key)\n{\n  _GLIBCXX_DEBUG_ONLY(base_type::structure_only_assert_valid();)\n  node_pointer p_nd = base_type::m_p_head->m_p_parent;\n  while (p_nd != NULL)\n    if (!Cmp_Fn::operator()(PB_DS_V2F(p_nd->m_value), r_key))\n      {\n\tif (!Cmp_Fn::operator()(r_key, PB_DS_V2F(p_nd->m_value)))\n\t  return p_nd;\n\tp_nd = p_nd->m_p_left;\n      }\n    else\n      p_nd = p_nd->m_p_right;\n  return base_type::m_p_head;\n}\n\nPB_DS_CLASS_T_DEC\ninline const typename PB_DS_CLASS_C_DEC::node_pointer\nPB_DS_CLASS_C_DEC::\nfind_imp(const_key_reference r_key) const\n{\n  _GLIBCXX_DEBUG_ONLY(assert_valid();)\n  node_pointer p_nd = base_type::m_p_head->m_p_parent;\n  while (p_nd != NULL)\n    if (!Cmp_Fn::operator()(PB_DS_V2F(p_nd->m_value), r_key))\n      {\n\tif (!Cmp_Fn::operator()(r_key, PB_DS_V2F(p_nd->m_value)))\n\t  return p_nd;\n\tp_nd = p_nd->m_p_left;\n      }\n    else\n      p_nd = p_nd->m_p_right;\n  return base_type::m_p_head;\n}\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/detail/splay_tree_/info_fn_imps.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file info_fn_imps.hpp\n * Contains an implementation.\n */\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/detail/splay_tree_/insert_fn_imps.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file insert_fn_imps.hpp\n * Contains an implementation class for splay_tree_.\n */\n\nPB_DS_CLASS_T_DEC\ninline std::pair<typename PB_DS_CLASS_C_DEC::point_iterator, bool>\nPB_DS_CLASS_C_DEC::\ninsert(const_reference r_value)\n{\n  _GLIBCXX_DEBUG_ONLY(assert_valid();)\n  std::pair<point_iterator, bool> ins_pair = insert_leaf_imp(r_value);\n  ins_pair.first.m_p_nd->m_special = false;\n  _GLIBCXX_DEBUG_ONLY(assert_valid());\n  splay(ins_pair.first.m_p_nd);\n  _GLIBCXX_DEBUG_ONLY(assert_valid());\n  return ins_pair;\n}\n\nPB_DS_CLASS_T_DEC\ninline std::pair<typename PB_DS_CLASS_C_DEC::point_iterator, bool>\nPB_DS_CLASS_C_DEC::\ninsert_leaf_imp(const_reference r_value)\n{\n  _GLIBCXX_DEBUG_ONLY(base_type::structure_only_assert_valid();)\n  if (base_type::m_size == 0)\n    return std::make_pair(base_type::insert_imp_empty(r_value), true);\n\n  node_pointer p_nd = base_type::m_p_head->m_p_parent;\n  node_pointer p_pot = base_type::m_p_head;\n\n  while (p_nd != NULL)\n    if (!Cmp_Fn::operator()(PB_DS_V2F(p_nd->m_value), PB_DS_V2F(r_value)))\n      {\n\tif (!Cmp_Fn::operator()(PB_DS_V2F(r_value), PB_DS_V2F(p_nd->m_value)))\n\t  {\n\t    return std::make_pair(point_iterator(p_nd), false);\n\t  }\n\tp_pot = p_nd;\n\tp_nd = p_nd->m_p_left;\n      }\n    else\n      p_nd = p_nd->m_p_right;\n\n  if (p_pot == base_type::m_p_head)\n    return std::make_pair(base_type::insert_leaf_new(r_value, base_type::m_p_head->m_p_right, false), true);\n\n  _GLIBCXX_DEBUG_ONLY(base_type::check_key_does_not_exist(PB_DS_V2F(r_value)));\n\n  p_nd = p_pot->m_p_left;\n  if (p_nd == NULL)\n    return (std::make_pair(base_type::insert_leaf_new(r_value, p_pot, true), true));\n\n  while (p_nd->m_p_right != NULL)\n    p_nd = p_nd->m_p_right;\n\n  return std::make_pair(insert_leaf_new(r_value, p_nd, false), true);\n}\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/detail/splay_tree_/node.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file node.hpp\n * Contains an implementation struct for splay_tree_'s node.\n */\n\n#ifndef PB_DS_SPLAY_TREE_NODE_HPP\n#define PB_DS_SPLAY_TREE_NODE_HPP\n\nnamespace pb_ds\n{\n  namespace detail\n  {\n    template<typename Value_Type, class Metadata, class Allocator>\n    struct splay_tree_node_\n    {\n    public:\n      typedef Value_Type value_type;\n      typedef Metadata metadata_type;\n\n      typedef\n      typename Allocator::template rebind<\n      splay_tree_node_<Value_Type, Metadata, Allocator> >::other::pointer\n      node_pointer;\n\n      typedef\n      typename Allocator::template rebind<metadata_type>::other::reference\n      metadata_reference;\n\n      typedef\n      typename Allocator::template rebind<metadata_type>::other::const_reference\n      const_metadata_reference;\n\n#ifdef PB_DS_BIN_SEARCH_TREE_TRACE_\n      void\n      trace() const\n      { std::cout << PB_DS_V2F(m_value) << \"(\" << m_metadata << \")\"; }\n#endif\n\n      inline bool\n      special() const\n      { return m_special; }\n\n      inline const_metadata_reference\n      get_metadata() const\n      { return m_metadata; }\n\n      inline metadata_reference\n      get_metadata()\n      { return m_metadata; }\n\n      value_type m_value;\n      bool m_special;\n      node_pointer m_p_left;\n      node_pointer m_p_right;\n      node_pointer m_p_parent;\n      metadata_type m_metadata;\n    };\n\n    template<typename Value_Type, typename Allocator>\n    struct splay_tree_node_<Value_Type, null_node_metadata, Allocator>\n    {\n    public:\n      typedef Value_Type value_type;\n      typedef null_node_metadata metadata_type;\n\n      typedef\n      typename Allocator::template rebind<\n      splay_tree_node_<Value_Type, null_node_metadata, Allocator> >::other::pointer\n      node_pointer;\n\n      inline bool\n      special() const\n      { return m_special; }\n\n#ifdef PB_DS_BIN_SEARCH_TREE_TRACE_\n      void\n      trace() const\n      { std::cout << PB_DS_V2F(m_value); }\n#endif \n\n      node_pointer m_p_left;\n      node_pointer m_p_right;\n      node_pointer m_p_parent;\n      value_type m_value;\n      bool m_special;\n    };\n  } // namespace detail\n} // namespace pb_ds\n\n#endif \n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/detail/splay_tree_/splay_fn_imps.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file splay_fn_imps.hpp\n * Contains an implementation class for splay_tree_.\n */\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nsplay(node_pointer p_nd)\n{\n  while (p_nd->m_p_parent != base_type::m_p_head)\n    {\n#ifdef _GLIBCXX_DEBUG\n      {\n\tnode_pointer p_head = base_type::m_p_head;\n\tassert_special_imp(p_head);\n      }\n#endif\n\n      _GLIBCXX_DEBUG_ONLY(base_type::assert_node_consistent(p_nd);)\n\n        if (p_nd->m_p_parent->m_p_parent == base_type::m_p_head)\n\t  {\n            base_type::rotate_parent(p_nd);\n            _GLIBCXX_DEBUG_ASSERT(p_nd == this->m_p_head->m_p_parent);\n\t  }\n        else\n\t  {\n            const node_pointer p_parent = p_nd->m_p_parent;\n            const node_pointer p_grandparent = p_parent->m_p_parent;\n\n#ifdef _GLIBCXX_DEBUG\n            const size_type total =\n\t      base_type::recursive_count(p_grandparent);\n            _GLIBCXX_DEBUG_ASSERT(total >= 3);\n#endif \n\n            if (p_parent->m_p_left == p_nd && \n\t\tp_grandparent->m_p_right == p_parent)\n\t      splay_zig_zag_left(p_nd, p_parent, p_grandparent);\n            else if (p_parent->m_p_right == p_nd && \n\t\t     p_grandparent->m_p_left == p_parent)\n\t      splay_zig_zag_right(p_nd, p_parent, p_grandparent);\n            else if (p_parent->m_p_left == p_nd && \n\t\t     p_grandparent->m_p_left == p_parent)\n\t      splay_zig_zig_left(p_nd, p_parent, p_grandparent);\n            else\n\t      splay_zig_zig_right(p_nd, p_parent, p_grandparent);\n            _GLIBCXX_DEBUG_ASSERT(total ==this->recursive_count(p_nd));\n\t  }\n\n      _GLIBCXX_DEBUG_ONLY(base_type::assert_node_consistent(p_nd);)\n  }\n}\n\nPB_DS_CLASS_T_DEC\ninline void\nPB_DS_CLASS_C_DEC::\nsplay_zig_zag_left(node_pointer p_nd, node_pointer p_parent, \n\t\t   node_pointer p_grandparent)\n{\n  _GLIBCXX_DEBUG_ASSERT(p_parent == p_nd->m_p_parent);\n  _GLIBCXX_DEBUG_ASSERT(p_grandparent == p_parent->m_p_parent);\n\n  _GLIBCXX_DEBUG_ONLY(base_type::assert_node_consistent(p_grandparent);)\n\n  _GLIBCXX_DEBUG_ASSERT(p_parent->m_p_left == p_nd && \n\t\t        p_grandparent->m_p_right == p_parent);\n\n  splay_zz_start(p_nd, p_parent, p_grandparent);\n\n  node_pointer p_b = p_nd->m_p_right;\n  node_pointer p_c = p_nd->m_p_left;\n\n  p_nd->m_p_right = p_parent;\n  p_parent->m_p_parent = p_nd;\n\n  p_nd->m_p_left = p_grandparent;\n  p_grandparent->m_p_parent = p_nd;\n\n  p_parent->m_p_left = p_b;\n  if (p_b != NULL)\n    p_b->m_p_parent = p_parent;\n\n  p_grandparent->m_p_right = p_c;\n  if (p_c != NULL)\n    p_c->m_p_parent = p_grandparent;\n\n  splay_zz_end(p_nd, p_parent, p_grandparent);\n}\n\nPB_DS_CLASS_T_DEC\ninline void\nPB_DS_CLASS_C_DEC::\nsplay_zig_zag_right(node_pointer p_nd, node_pointer p_parent, \n\t\t    node_pointer p_grandparent)\n{\n  _GLIBCXX_DEBUG_ASSERT(p_parent == p_nd->m_p_parent);\n  _GLIBCXX_DEBUG_ASSERT(p_grandparent == p_parent->m_p_parent);\n\n  _GLIBCXX_DEBUG_ONLY(base_type::assert_node_consistent(p_grandparent);)\n\n  _GLIBCXX_DEBUG_ASSERT(p_parent->m_p_right == p_nd && \n\t  \t        p_grandparent->m_p_left == p_parent);\n\n  splay_zz_start(p_nd, p_parent, p_grandparent);\n\n  node_pointer p_b = p_nd->m_p_left;\n  node_pointer p_c = p_nd->m_p_right;\n\n  p_nd->m_p_left = p_parent;\n  p_parent->m_p_parent = p_nd;\n\n  p_nd->m_p_right = p_grandparent;\n  p_grandparent->m_p_parent = p_nd;\n\n  p_parent->m_p_right = p_b;\n  if (p_b != NULL)\n    p_b->m_p_parent = p_parent;\n\n  p_grandparent->m_p_left = p_c;\n  if (p_c != NULL)\n    p_c->m_p_parent = p_grandparent;\n\n  splay_zz_end(p_nd, p_parent, p_grandparent);\n}\n\nPB_DS_CLASS_T_DEC\ninline void\nPB_DS_CLASS_C_DEC::\nsplay_zig_zig_left(node_pointer p_nd, node_pointer p_parent, \n\t\t   node_pointer p_grandparent)\n{\n  _GLIBCXX_DEBUG_ASSERT(p_parent == p_nd->m_p_parent);\n  _GLIBCXX_DEBUG_ASSERT(p_grandparent == p_parent->m_p_parent);\n\n  _GLIBCXX_DEBUG_ONLY(base_type::assert_node_consistent(p_grandparent);)\n\n  _GLIBCXX_DEBUG_ASSERT(p_parent->m_p_left == p_nd && \n\t\t     p_nd->m_p_parent->m_p_parent->m_p_left == p_nd->m_p_parent);\n\n  splay_zz_start(p_nd, p_parent, p_grandparent);\n\n  node_pointer p_b = p_nd->m_p_right;\n  node_pointer p_c = p_parent->m_p_right;\n\n  p_nd->m_p_right = p_parent;\n  p_parent->m_p_parent = p_nd;\n\n  p_parent->m_p_right = p_grandparent;\n  p_grandparent->m_p_parent = p_parent;\n\n  p_parent->m_p_left = p_b;\n  if (p_b != NULL)\n    p_b->m_p_parent = p_parent;\n\n  p_grandparent->m_p_left = p_c;\n  if (p_c != NULL)\n    p_c->m_p_parent = p_grandparent;\n\n  splay_zz_end(p_nd, p_parent, p_grandparent);\n}\n\nPB_DS_CLASS_T_DEC\ninline void\nPB_DS_CLASS_C_DEC::\nsplay_zig_zig_right(node_pointer p_nd, node_pointer p_parent, \n\t\t    node_pointer p_grandparent)\n{\n  _GLIBCXX_DEBUG_ASSERT(p_parent == p_nd->m_p_parent);\n  _GLIBCXX_DEBUG_ASSERT(p_grandparent == p_parent->m_p_parent);\n  _GLIBCXX_DEBUG_ONLY(base_type::assert_node_consistent(p_grandparent);)\n  _GLIBCXX_DEBUG_ASSERT(p_parent->m_p_right == p_nd && \n\t          p_nd->m_p_parent->m_p_parent->m_p_right == p_nd->m_p_parent);\n\n  splay_zz_start(p_nd, p_parent, p_grandparent);\n\n  node_pointer p_b = p_nd->m_p_left;\n  node_pointer p_c = p_parent->m_p_left;\n\n  p_nd->m_p_left = p_parent;\n  p_parent->m_p_parent = p_nd;\n\n  p_parent->m_p_left = p_grandparent;\n  p_grandparent->m_p_parent = p_parent;\n\n  p_parent->m_p_right = p_b;\n  if (p_b != NULL)\n    p_b->m_p_parent = p_parent;\n\n  p_grandparent->m_p_right = p_c;\n  if (p_c != NULL)\n    p_c->m_p_parent = p_grandparent;\n\n  base_type::update_to_top(p_grandparent, (node_update* )this);\n  splay_zz_end(p_nd, p_parent, p_grandparent);\n}\n\nPB_DS_CLASS_T_DEC\ninline void\nPB_DS_CLASS_C_DEC::\nsplay_zz_start(node_pointer p_nd,\n#ifdef _GLIBCXX_DEBUG\n\t       node_pointer p_parent,\n#else \n\t       node_pointer /*p_parent*/,\n#endif\n\t       node_pointer p_grandparent)\n{\n  _GLIBCXX_DEBUG_ASSERT(p_nd != NULL);\n  _GLIBCXX_DEBUG_ASSERT(p_parent != NULL);\n  _GLIBCXX_DEBUG_ASSERT(p_grandparent != NULL);\n\n  const bool grandparent_head = p_grandparent->m_p_parent == base_type::m_p_head;\n\n  if (grandparent_head)\n    {\n      base_type::m_p_head->m_p_parent = base_type::m_p_head->m_p_parent;\n      p_nd->m_p_parent = base_type::m_p_head;\n      return;\n    }\n\n  node_pointer p_greatgrandparent = p_grandparent->m_p_parent;\n\n  p_nd->m_p_parent = p_greatgrandparent;\n\n  if (p_grandparent == p_greatgrandparent->m_p_left)\n    p_greatgrandparent->m_p_left = p_nd;\n  else\n    p_greatgrandparent->m_p_right = p_nd;\n}\n\nPB_DS_CLASS_T_DEC\ninline void\nPB_DS_CLASS_C_DEC::\nsplay_zz_end(node_pointer p_nd, node_pointer p_parent, \n\t     node_pointer p_grandparent)\n{\n  if (p_nd->m_p_parent == base_type::m_p_head)\n    base_type::m_p_head->m_p_parent = p_nd;\n\n  apply_update(p_grandparent, (node_update* )this);\n  apply_update(p_parent, (node_update* )this);\n  apply_update(p_nd, (node_update* )this);\n\n  _GLIBCXX_DEBUG_ONLY(base_type::assert_node_consistent(p_nd);)\n}\n\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/detail/splay_tree_/splay_tree_.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file splay_tree_.hpp\n * Contains an implementation class for splay_tree_.\n */\n/*\n * This implementation uses an idea from the SGI STL (using a \"header\" node\n *    which is needed for efficient iteration). Following is the SGI STL\n *    copyright.\n *\n * Copyright (c) 1996,1997\n * Silicon Graphics Computer Systems, Inc.\n *\n * Permission to use, copy, modify, distribute and sell this software\n * and its documentation for any purpose is hereby granted without fee,\n * provided that the above copyright notice appear in all copies and\n * that both that copyright notice and this permission notice appear\n * in supporting documentation.    Silicon Graphics makes no\n * representations about the suitability of this software for any\n * purpose.    It is provided \"as is\" without express or implied warranty.\n *\n *\n * Copyright (c) 1994\n * Hewlett-Packard Company\n *\n * Permission to use, copy, modify, distribute and sell this software\n * and its documentation for any purpose is hereby granted without fee,\n * provided that the above copyright notice appear in all copies and\n * that both that copyright notice and this permission notice appear\n * in supporting documentation.    Hewlett-Packard Company makes no\n * representations about the suitability of this software for any\n * purpose.    It is provided \"as is\" without express or implied warranty.\n *\n *\n */\n\n#ifdef PB_DS_DATA_TRUE_INDICATOR\n#ifndef PB_DS_BIN_SEARCH_TREE_HPP__DATA_TRUE_INDICATOR\n#define PB_DS_BIN_SEARCH_TREE_HPP__DATA_TRUE_INDICATOR\n#include <ext/pb_ds/detail/bin_search_tree_/bin_search_tree_.hpp>\n#endif \n#endif \n\n#ifdef PB_DS_DATA_FALSE_INDICATOR\n#ifndef PB_DS_BIN_SEARCH_TREE_HPP__DATA_FALSE_INDICATOR\n#define PB_DS_BIN_SEARCH_TREE_HPP__DATA_FALSE_INDICATOR\n#include <ext/pb_ds/detail/bin_search_tree_/bin_search_tree_.hpp>\n#endif \n#endif \n\n#include <utility>\n#include <vector>\n#include <assert.h>\n#include <debug/debug.h>\n\nnamespace pb_ds\n{\n  namespace detail\n  {\n#define PB_DS_CLASS_T_DEC \\\n    template<typename Key, typename Mapped, typename Cmp_Fn, \\\n\t     typename Node_And_It_Traits, typename Allocator>\n\n#ifdef PB_DS_DATA_TRUE_INDICATOR\n#define PB_DS_CLASS_NAME splay_tree_data_\n#endif \n\n#ifdef PB_DS_DATA_FALSE_INDICATOR\n#define PB_DS_CLASS_NAME splay_tree_no_data_\n#endif \n\n#ifdef PB_DS_DATA_TRUE_INDICATOR\n#define PB_DS_BASE_CLASS_NAME bin_search_tree_data_\n#endif \n\n#ifdef PB_DS_DATA_FALSE_INDICATOR\n#define PB_DS_BASE_CLASS_NAME bin_search_tree_no_data_\n#endif \n\n#define PB_DS_CLASS_C_DEC \\\n    PB_DS_CLASS_NAME<Key, Mapped, Cmp_Fn, Node_And_It_Traits, Allocator>\n\n#define PB_DS_BASE_C_DEC \\\n    PB_DS_BASE_CLASS_NAME<Key, Mapped, Cmp_Fn, Node_And_It_Traits, Allocator>\n\n#ifdef PB_DS_DATA_TRUE_INDICATOR\n#define PB_DS_V2F(X) (X).first\n#define PB_DS_V2S(X) (X).second\n#define PB_DS_EP2VP(X)& ((X)->m_value)\n#endif \n\n#ifdef PB_DS_DATA_FALSE_INDICATOR\n#define PB_DS_V2F(X) (X)\n#define PB_DS_V2S(X) Mapped_Data()\n#define PB_DS_EP2VP(X)& ((X)->m_value.first)\n#endif \n\n    // $p14y 7r33 7481.\n    template<typename Key, typename Mapped, typename Cmp_Fn,\n\t     typename Node_And_It_Traits, typename Allocator>\n    class PB_DS_CLASS_NAME : public PB_DS_BASE_C_DEC\n    {\n    private:\n      typedef PB_DS_BASE_C_DEC base_type;\n      typedef typename base_type::node_pointer node_pointer;\n\n    public:\n      typedef Allocator allocator;\n      typedef typename Allocator::size_type size_type;\n      typedef typename Allocator::difference_type difference_type;\n      typedef Cmp_Fn cmp_fn;\n      typedef typename base_type::key_type key_type;\n      typedef typename base_type::key_pointer key_pointer;\n      typedef typename base_type::const_key_pointer const_key_pointer;\n      typedef typename base_type::key_reference key_reference;\n      typedef typename base_type::const_key_reference const_key_reference;\n      typedef typename base_type::mapped_type mapped_type;\n      typedef typename base_type::mapped_pointer mapped_pointer;\n      typedef typename base_type::const_mapped_pointer const_mapped_pointer;\n      typedef typename base_type::mapped_reference mapped_reference;\n      typedef typename base_type::const_mapped_reference const_mapped_reference;\n      typedef typename base_type::value_type value_type;\n      typedef typename base_type::pointer pointer;\n      typedef typename base_type::const_pointer const_pointer;\n      typedef typename base_type::reference reference;\n      typedef typename base_type::const_reference const_reference;\n      typedef typename base_type::point_iterator point_iterator;\n      typedef typename base_type::const_iterator const_point_iterator;\n      typedef typename base_type::iterator iterator;\n      typedef typename base_type::const_iterator const_iterator;\n      typedef typename base_type::reverse_iterator reverse_iterator;\n      typedef typename base_type::const_reverse_iterator const_reverse_iterator;\n      typedef typename base_type::node_update node_update;\n\n      PB_DS_CLASS_NAME();\n\n      PB_DS_CLASS_NAME(const Cmp_Fn&);\n\n      PB_DS_CLASS_NAME(const Cmp_Fn&, const node_update&);\n\n      PB_DS_CLASS_NAME(const PB_DS_CLASS_C_DEC&);\n\n      void\n      swap(PB_DS_CLASS_C_DEC&);\n\n      template<typename It>\n      void\n      copy_from_range(It, It);\n\n      void\n      initialize();\n\n      inline std::pair<point_iterator, bool>\n      insert(const_reference r_value);\n\n      inline mapped_reference\n      operator[](const_key_reference r_key)\n      {\n#ifdef PB_DS_DATA_TRUE_INDICATOR\n\t_GLIBCXX_DEBUG_ONLY(PB_DS_CLASS_C_DEC::assert_valid();)\n\tstd::pair<point_iterator, bool> ins_pair =\n\t  insert_leaf_imp(value_type(r_key, mapped_type()));\n\n\tins_pair.first.m_p_nd->m_special = false;\n\t_GLIBCXX_DEBUG_ONLY(base_type::assert_valid());\n\tsplay(ins_pair.first.m_p_nd);\n\t_GLIBCXX_DEBUG_ONLY(PB_DS_CLASS_C_DEC::assert_valid();)\n\treturn ins_pair.first.m_p_nd->m_value.second;\n#else \n\tinsert(r_key);\n\treturn base_type::s_null_mapped;\n#endif\n      }\n\n      inline point_iterator\n      find(const_key_reference);\n\n      inline const_point_iterator\n      find(const_key_reference) const;\n\n      inline bool\n      erase(const_key_reference);\n\n      inline iterator\n      erase(iterator it);\n\n      inline reverse_iterator\n      erase(reverse_iterator);\n\n      template<typename Pred>\n      inline size_type\n      erase_if(Pred);\n\n      void\n      join(PB_DS_CLASS_C_DEC&);\n\n      void\n      split(const_key_reference, PB_DS_CLASS_C_DEC&);\n\n    private:\n      inline std::pair<point_iterator, bool>\n      insert_leaf_imp(const_reference);\n\n      inline node_pointer\n      find_imp(const_key_reference);\n\n      inline const node_pointer\n      find_imp(const_key_reference) const;\n\n#ifdef _GLIBCXX_DEBUG\n      void\n      assert_valid() const;\n\n      void\n      assert_special_imp(const node_pointer) const;\n#endif \n\n      void\n      splay(node_pointer);\n\n      inline void\n      splay_zig_zag_left(node_pointer, node_pointer, node_pointer);\n\n      inline void\n      splay_zig_zag_right(node_pointer, node_pointer, node_pointer);\n\n      inline void\n      splay_zig_zig_left(node_pointer, node_pointer, node_pointer);\n\n      inline void\n      splay_zig_zig_right(node_pointer, node_pointer, node_pointer);\n\n      inline void\n      splay_zz_start(node_pointer, node_pointer, node_pointer);\n\n      inline void\n      splay_zz_end(node_pointer, node_pointer, node_pointer);\n\n      inline node_pointer\n      leftmost(node_pointer);\n\n      void\n      erase_node(node_pointer);\n    };\n\n#include <ext/pb_ds/detail/splay_tree_/constructors_destructor_fn_imps.hpp>\n#include <ext/pb_ds/detail/splay_tree_/insert_fn_imps.hpp>\n#include <ext/pb_ds/detail/splay_tree_/splay_fn_imps.hpp>\n#include <ext/pb_ds/detail/splay_tree_/erase_fn_imps.hpp>\n#include <ext/pb_ds/detail/splay_tree_/find_fn_imps.hpp>\n#include <ext/pb_ds/detail/splay_tree_/debug_fn_imps.hpp>\n#include <ext/pb_ds/detail/splay_tree_/split_join_fn_imps.hpp>\n\n#undef PB_DS_CLASS_T_DEC\n#undef PB_DS_CLASS_C_DEC\n#undef PB_DS_CLASS_NAME\n#undef PB_DS_BASE_CLASS_NAME\n#undef PB_DS_BASE_C_DEC\n#undef PB_DS_V2F\n#undef PB_DS_EP2VP\n#undef PB_DS_V2S\n  } // namespace detail\n} // namespace pb_ds\n\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/detail/splay_tree_/split_join_fn_imps.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file split_join_fn_imps.hpp\n * Contains an implementation class for splay_tree_.\n */\n\nPB_DS_CLASS_T_DEC\ninline void\nPB_DS_CLASS_C_DEC::\njoin(PB_DS_CLASS_C_DEC& other)\n{\n  _GLIBCXX_DEBUG_ONLY(assert_valid();)\n  _GLIBCXX_DEBUG_ONLY(other.assert_valid();)\n  if (base_type::join_prep(other) == false)\n    {\n      _GLIBCXX_DEBUG_ONLY(assert_valid();)\n      _GLIBCXX_DEBUG_ONLY(other.assert_valid();)\n      return;\n    }\n\n  node_pointer p_target_r = other.leftmost(other.m_p_head);\n  _GLIBCXX_DEBUG_ASSERT(p_target_r != NULL);\n  other.splay(p_target_r);\n\n  _GLIBCXX_DEBUG_ASSERT(p_target_r == other.m_p_head->m_p_parent);\n  _GLIBCXX_DEBUG_ASSERT(p_target_r->m_p_left == NULL);\n\n  p_target_r->m_p_left = base_type::m_p_head->m_p_parent;\n\n  _GLIBCXX_DEBUG_ASSERT(p_target_r->m_p_left != NULL);\n  p_target_r->m_p_left->m_p_parent = p_target_r;\n\n  base_type::m_p_head->m_p_parent = p_target_r;\n  p_target_r->m_p_parent = base_type::m_p_head;\n  apply_update(p_target_r, (node_update* )this);\n\n  base_type::join_finish(other);\n\n  _GLIBCXX_DEBUG_ONLY(assert_valid();)\n  _GLIBCXX_DEBUG_ONLY(other.assert_valid();)\n}\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nsplit(const_key_reference r_key, PB_DS_CLASS_C_DEC& other)\n{\n  _GLIBCXX_DEBUG_ONLY(assert_valid());\n  _GLIBCXX_DEBUG_ONLY(other.assert_valid());\n\n  if (base_type::split_prep(r_key, other) == false)\n    {\n      _GLIBCXX_DEBUG_ONLY(assert_valid());\n      _GLIBCXX_DEBUG_ONLY(other.assert_valid());\n      return;\n    }\n\n  node_pointer p_upper_bound = upper_bound(r_key).m_p_nd;\n  _GLIBCXX_DEBUG_ASSERT(p_upper_bound != NULL);\n\n  splay(p_upper_bound);\n  _GLIBCXX_DEBUG_ASSERT(p_upper_bound->m_p_parent == this->m_p_head);\n\n  node_pointer p_new_root = p_upper_bound->m_p_left;\n  _GLIBCXX_DEBUG_ASSERT(p_new_root != NULL);\n\n  base_type::m_p_head->m_p_parent = p_new_root;\n  p_new_root->m_p_parent = base_type::m_p_head;\n  other.m_p_head->m_p_parent = p_upper_bound;\n  p_upper_bound->m_p_parent = other.m_p_head;\n  p_upper_bound->m_p_left = NULL;\n  apply_update(p_upper_bound, (node_update* )this);\n  base_type::split_finish(other);\n\n  _GLIBCXX_DEBUG_ONLY(assert_valid());\n  _GLIBCXX_DEBUG_ONLY(other.assert_valid());\n}\n\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/detail/splay_tree_/traits.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file traits.hpp\n * Contains an implementation for splay_tree_.\n */\n\n#ifndef PB_DS_SPLAY_TREE_NODE_AND_IT_TRAITS_HPP\n#define PB_DS_SPLAY_TREE_NODE_AND_IT_TRAITS_HPP\n\n#include <ext/pb_ds/detail/splay_tree_/node.hpp>\n\nnamespace pb_ds\n{\n  namespace detail\n  {\n\n    template<typename Key,\n\t     typename Mapped,\n\t     class Cmp_Fn,\n\t     template<typename Const_Node_Iterator,\n\t\t      class Node_Iterator,\n\t\t      class Cmp_Fn_,\n\t\t      class Allocator_>\n    class Node_Update,\n\t     class Allocator>\n    struct tree_traits<\n      Key,\n      Mapped,\n      Cmp_Fn,\n      Node_Update,\n      splay_tree_tag,\n      Allocator> : public bin_search_tree_traits<\n      Key,\n      Mapped,\n      Cmp_Fn,\n      Node_Update,\n      splay_tree_node_<\n      typename types_traits<\n      Key,\n      Mapped,\n      Allocator,\n      false>::value_type,\n      typename tree_node_metadata_selector<\n      Key,\n      Mapped,\n      Cmp_Fn,\n      Node_Update,\n      Allocator>::type,\n      Allocator>,\n      Allocator>\n    { };\n\n    template<typename Key,\n\t     class Cmp_Fn,\n\t     template<typename Const_Node_Iterator,\n\t\t      class Node_Iterator,\n\t\t      class Cmp_Fn_,\n\t\t      class Allocator_>\n             class Node_Update,\n\t     class Allocator>\n    struct tree_traits<Key, null_mapped_type, Cmp_Fn, Node_Update,\n\t\t       splay_tree_tag, Allocator> \n    : public bin_search_tree_traits<Key, null_mapped_type, Cmp_Fn,\n\t\t\t\t    Node_Update, \n\t   splay_tree_node_<typename types_traits<Key, null_mapped_type, Allocator, false>::value_type,\n\t\t\t    typename tree_node_metadata_selector<\n      Key,\n      null_mapped_type,\n      Cmp_Fn,\n      Node_Update,\n      Allocator>::type,\n      Allocator>,\n      Allocator>\n    { };\n\n  } // namespace detail\n} // namespace pb_ds\n\n#endif // #ifndef PB_DS_SPLAY_TREE_NODE_AND_IT_TRAITS_HPP\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/detail/standard_policies.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file standard_policies.hpp\n * Contains standard policies for containers.\n */\n\n#ifndef PB_DS_STANDARD_POLICIES_HPP\n#define PB_DS_STANDARD_POLICIES_HPP\n\n#include <memory>\n#include <ext/pb_ds/hash_policy.hpp>\n#include <ext/pb_ds/list_update_policy.hpp>\n#include <ext/pb_ds/tree_policy.hpp>\n#include <ext/pb_ds/detail/basic_tree_policy/null_node_metadata.hpp>\n#include <ext/pb_ds/trie_policy.hpp>\n#include <ext/pb_ds/tag_and_trait.hpp>\n#include <ext/hash_map>\n\nnamespace pb_ds\n{\n  namespace detail\n  {\n    template<typename Key>\n    struct default_hash_fn\n    {\n      typedef __gnu_cxx::hash< Key> type;\n    };\n\n    template<typename Key>\n    struct default_eq_fn\n    {\n      typedef std::equal_to< Key> type;\n    };\n\n    enum\n      {\n\tdefault_store_hash = false\n      };\n\n    struct default_comb_hash_fn\n    {\n      typedef pb_ds::direct_mask_range_hashing<> type;\n    };\n\n    template<typename Comb_Hash_Fn>\n    struct default_resize_policy\n    {\n    private:\n      typedef typename Comb_Hash_Fn::size_type size_type;\n\n      typedef\n      typename __conditional_type<\n\tis_same<\n\tpb_ds::direct_mask_range_hashing<\n\tsize_type>,\n\tComb_Hash_Fn>::value,\n\tpb_ds::hash_exponential_size_policy<\n\tsize_type>,\n\tpb_ds::hash_prime_size_policy>::__type\n      size_policy_type;\n\n    public:\n      typedef\n      pb_ds::hash_standard_resize_policy<\n      size_policy_type,\n      pb_ds::hash_load_check_resize_trigger<\n      false,\n      size_type>,\n      false,\n      size_type>\n      type;\n    };\n\n    struct default_update_policy\n    {\n      typedef pb_ds::move_to_front_lu_policy<> type;\n    };\n\n    template<typename Comb_Probe_Fn>\n    struct default_probe_fn\n    {\n    private:\n      typedef typename Comb_Probe_Fn::size_type size_type;\n\n    public:\n      typedef\n      typename __conditional_type<\n      is_same<\n      pb_ds::direct_mask_range_hashing<size_t>,\n      Comb_Probe_Fn>::value,\n      pb_ds::linear_probe_fn<\n      size_type>,\n      pb_ds::quadratic_probe_fn<\n      size_type> >::__type\n      type;\n    };\n\n    template<typename Key>\n    struct default_trie_e_access_traits;\n\n    template<typename Char, class Char_Traits>\n    struct default_trie_e_access_traits<\n      std::basic_string<\n      Char,\n      Char_Traits,\n      std::allocator<\n      char> > >\n    {\n      typedef\n      pb_ds::string_trie_e_access_traits<\n\tstd::basic_string<\n\tChar,\n\tChar_Traits,\n\tstd::allocator<\n\tchar> > >\n      type;\n    };\n\n  } // namespace detail\n} // namespace pb_ds\n\n#endif // #ifndef PB_DS_STANDARD_POLICIES_HPP\n\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/detail/thin_heap_/constructors_destructor_fn_imps.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file constructors_destructor_fn_imps.hpp\n * Contains an implementation for thin_heap_.\n */\n\nPB_DS_CLASS_T_DEC\ntemplate<typename It>\nvoid\nPB_DS_CLASS_C_DEC::\ncopy_from_range(It first_it, It last_it)\n{\n  while (first_it != last_it)\n    push(*(first_it++));\n  _GLIBCXX_DEBUG_ONLY(assert_valid();)\n}\n\nPB_DS_CLASS_T_DEC\nPB_DS_CLASS_C_DEC::\nthin_heap_() :\n  m_p_max(NULL)\n{\n  initialize();\n  _GLIBCXX_DEBUG_ONLY(assert_valid();)\n}\n\nPB_DS_CLASS_T_DEC\nPB_DS_CLASS_C_DEC::\nthin_heap_(const Cmp_Fn& r_cmp_fn) :\n  PB_DS_BASE_C_DEC(r_cmp_fn),\n  m_p_max(NULL)\n{\n  initialize();\n  _GLIBCXX_DEBUG_ONLY(assert_valid();)\n}\n\nPB_DS_CLASS_T_DEC\nPB_DS_CLASS_C_DEC::\nthin_heap_(const PB_DS_CLASS_C_DEC& other) :\n  PB_DS_BASE_C_DEC(other)\n{\n  initialize();\n  m_p_max = base_type::m_p_root;\n  for (node_pointer p_nd = base_type::m_p_root; p_nd != NULL; p_nd = p_nd->m_p_next_sibling)\n    if (Cmp_Fn::operator()(m_p_max->m_value, p_nd->m_value))\n      m_p_max = p_nd;\n\n  _GLIBCXX_DEBUG_ONLY(assert_valid();)\n}\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nswap(PB_DS_CLASS_C_DEC& other)\n{\n  _GLIBCXX_DEBUG_ONLY(assert_valid();)\n  base_type::swap(other);\n  std::swap(m_p_max, other.m_p_max);\n  _GLIBCXX_DEBUG_ONLY(assert_valid();)\n}\n\nPB_DS_CLASS_T_DEC\nPB_DS_CLASS_C_DEC::\n~thin_heap_()\n{ }\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\ninitialize()\n{ std::fill(m_a_aux, m_a_aux + max_rank, static_cast<node_pointer>(NULL)); }\n\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/detail/thin_heap_/debug_fn_imps.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file debug_fn_imps.hpp\n * Contains an implementation for thin_heap_.\n */\n\n#ifdef _GLIBCXX_DEBUG\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nassert_valid() const\n{\n  base_type::assert_valid();\n  assert_node_consistent(base_type::m_p_root, true);\n  assert_max();\n  assert_aux_null();\n}\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nassert_aux_null() const\n{\n  for (size_type i = 0; i < max_rank; ++i)\n    _GLIBCXX_DEBUG_ASSERT(m_a_aux[i] == NULL);\n}\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nassert_max() const\n{\n  if (m_p_max == NULL)\n    {\n      _GLIBCXX_DEBUG_ASSERT(base_type::empty());\n      return;\n    }\n\n  _GLIBCXX_DEBUG_ASSERT(!base_type::empty());\n  _GLIBCXX_DEBUG_ASSERT(base_type::parent(m_p_max) == NULL);\n  _GLIBCXX_DEBUG_ASSERT(m_p_max->m_p_prev_or_parent == NULL);\n  for (const_iterator it = base_type::begin(); it != base_type::end(); ++it)\n    _GLIBCXX_DEBUG_ASSERT(!Cmp_Fn::operator()(m_p_max->m_value, it.m_p_nd->m_value));\n}\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nassert_node_consistent(const_node_pointer p_nd, bool root) const\n{\n  base_type::assert_node_consistent(p_nd, root);\n  if (p_nd == NULL)\n    return;\n\n  assert_node_consistent(p_nd->m_p_next_sibling, root);\n  assert_node_consistent(p_nd->m_p_l_child, false);\n  if (!root)\n    {\n      if (p_nd->m_metadata == 0)\n\t_GLIBCXX_DEBUG_ASSERT(p_nd->m_p_next_sibling == NULL);\n      else\n\t_GLIBCXX_DEBUG_ASSERT(p_nd->m_metadata == p_nd->m_p_next_sibling->m_metadata + 1);\n    }\n\n  if (p_nd->m_p_l_child != NULL)\n    _GLIBCXX_DEBUG_ASSERT(p_nd->m_p_l_child->m_metadata + 1 == base_type::degree(p_nd));\n\n  const bool unmarked_valid =(p_nd->m_p_l_child == NULL&&  p_nd->m_metadata == 0) ||(p_nd->m_p_l_child != NULL&&  p_nd->m_metadata == p_nd->m_p_l_child->m_metadata + 1);\n\n  const bool marked_valid =(p_nd->m_p_l_child == NULL&&  p_nd->m_metadata == 1) ||(p_nd->m_p_l_child != NULL&&  p_nd->m_metadata == p_nd->m_p_l_child->m_metadata + 2);\n\n  _GLIBCXX_DEBUG_ASSERT(unmarked_valid || marked_valid);\n  if (root)\n    _GLIBCXX_DEBUG_ASSERT(unmarked_valid);\n}\n\n#endif \n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/detail/thin_heap_/erase_fn_imps.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file erase_fn_imps.hpp\n * Contains an implementation for thin_heap_.\n */\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\npop()\n{\n  _GLIBCXX_DEBUG_ONLY(assert_valid();)\n    _GLIBCXX_DEBUG_ASSERT(!base_type::empty());\n\n  _GLIBCXX_DEBUG_ASSERT(m_p_max != NULL);\n\n  node_pointer p_nd = m_p_max;\n\n  remove_max_node();\n\n  base_type::actual_erase_node(p_nd);\n\n  _GLIBCXX_DEBUG_ONLY(assert_valid();)\n    }\n\nPB_DS_CLASS_T_DEC\ninline void\nPB_DS_CLASS_C_DEC::\nremove_max_node()\n{\n  to_aux_except_max();\n\n  make_from_aux();\n}\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nto_aux_except_max()\n{\n  node_pointer p_add = base_type::m_p_root;\n\n  while (p_add != m_p_max)\n    {\n      node_pointer p_next_add = p_add->m_p_next_sibling;\n\n      add_to_aux(p_add);\n\n      p_add = p_next_add;\n    }\n\n  p_add = m_p_max->m_p_l_child;\n\n  while (p_add != NULL)\n    {\n      node_pointer p_next_add = p_add->m_p_next_sibling;\n\n      p_add->m_metadata = p_add->m_p_l_child == NULL?\n\t0 :\n\tp_add->m_p_l_child->m_metadata + 1;\n\n      add_to_aux(p_add);\n\n      p_add = p_next_add;\n    }\n\n  p_add = m_p_max->m_p_next_sibling;\n\n  while (p_add != NULL)\n    {\n      node_pointer p_next_add = p_add->m_p_next_sibling;\n\n      add_to_aux(p_add);\n\n      p_add = p_next_add;\n    }\n}\n\nPB_DS_CLASS_T_DEC\ninline void\nPB_DS_CLASS_C_DEC::\nadd_to_aux(node_pointer p_nd)\n{\n  size_type r = p_nd->m_metadata;\n\n  while (m_a_aux[r] != NULL)\n    {\n      _GLIBCXX_DEBUG_ASSERT(p_nd->m_metadata < rank_bound());\n\n      if (Cmp_Fn::operator()(m_a_aux[r]->m_value, p_nd->m_value))\n\tmake_child_of(m_a_aux[r], p_nd);\n      else\n        {\n\t  make_child_of(p_nd, m_a_aux[r]);\n\n\t  p_nd = m_a_aux[r];\n        }\n\n      m_a_aux[r] = NULL;\n\n      ++r;\n    }\n\n  _GLIBCXX_DEBUG_ASSERT(p_nd->m_metadata < rank_bound());\n\n  m_a_aux[r] = p_nd;\n}\n\nPB_DS_CLASS_T_DEC\ninline void\nPB_DS_CLASS_C_DEC::\nmake_child_of(node_pointer p_nd, node_pointer p_new_parent)\n{\n  _GLIBCXX_DEBUG_ASSERT(p_nd->m_metadata == p_new_parent->m_metadata);\n  _GLIBCXX_DEBUG_ASSERT(m_a_aux[p_nd->m_metadata] == p_nd ||\n\t\t   m_a_aux[p_nd->m_metadata] == p_new_parent);\n\n  ++p_new_parent->m_metadata;\n\n  base_type::make_child_of(p_nd, p_new_parent);\n}\n\nPB_DS_CLASS_T_DEC\ninline void\nPB_DS_CLASS_C_DEC::\nmake_from_aux()\n{\n  base_type::m_p_root = m_p_max = NULL;\n\n  const size_type rnk_bnd = rank_bound();\n\n  size_type i = 0;\n\n  while (i < rnk_bnd)\n    {\n      if (m_a_aux[i] != NULL)\n        {\n\t  make_root_and_link(m_a_aux[i]);\n\n\t  m_a_aux[i] = NULL;\n        }\n\n      ++i;\n    }\n\n  _GLIBCXX_DEBUG_ONLY(assert_aux_null();)\n    }\n\nPB_DS_CLASS_T_DEC\ninline void\nPB_DS_CLASS_C_DEC::\nremove_node(node_pointer p_nd)\n{\n  node_pointer p_parent = p_nd;\n  while (base_type::parent(p_parent) != NULL)\n    p_parent = base_type::parent(p_parent);\n\n  base_type::bubble_to_top(p_nd);\n\n  m_p_max = p_nd;\n\n  node_pointer p_fix = base_type::m_p_root;\n  while (p_fix != NULL&&  p_fix->m_p_next_sibling != p_parent)\n    p_fix = p_fix->m_p_next_sibling;\n\n  if (p_fix != NULL)\n    p_fix->m_p_next_sibling = p_nd;\n\n  remove_max_node();\n}\n\nPB_DS_CLASS_T_DEC\ninline void\nPB_DS_CLASS_C_DEC::\nclear()\n{\n  base_type::clear();\n\n  m_p_max = NULL;\n}\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nerase(point_iterator it)\n{\n  _GLIBCXX_DEBUG_ONLY(assert_valid();)\n    _GLIBCXX_DEBUG_ASSERT(!base_type::empty());\n\n  node_pointer p_nd = it.m_p_nd;\n\n  remove_node(p_nd);\n\n  base_type::actual_erase_node(p_nd);\n\n  _GLIBCXX_DEBUG_ONLY(assert_valid();)\n    }\n\nPB_DS_CLASS_T_DEC\ntemplate<typename Pred>\ntypename PB_DS_CLASS_C_DEC::size_type\nPB_DS_CLASS_C_DEC::\nerase_if(Pred pred)\n{\n  _GLIBCXX_DEBUG_ONLY(assert_valid();)\n\n    if (base_type::empty())\n      {\n        _GLIBCXX_DEBUG_ONLY(assert_valid();)\n\n\t  return 0;\n      }\n\n  base_type::to_linked_list();\n\n  node_pointer p_out = base_type::prune(pred);\n\n  size_type ersd = 0;\n\n  while (p_out != NULL)\n    {\n      ++ersd;\n\n      node_pointer p_next = p_out->m_p_next_sibling;\n\n      base_type::actual_erase_node(p_out);\n\n      p_out = p_next;\n    }\n\n  node_pointer p_cur = base_type::m_p_root;\n\n  m_p_max = base_type::m_p_root = NULL;\n\n  while (p_cur != NULL)\n    {\n      node_pointer p_next = p_cur->m_p_next_sibling;\n\n      make_root_and_link(p_cur);\n\n      p_cur = p_next;\n    }\n\n  _GLIBCXX_DEBUG_ONLY(assert_valid();)\n\n    return ersd;\n}\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::size_type\nPB_DS_CLASS_C_DEC::\nrank_bound()\n{\n  const std::size_t* const p_upper =\n    std::upper_bound(            g_a_rank_bounds, g_a_rank_bounds + num_distinct_rank_bounds, base_type::m_size);\n\n  if (p_upper == g_a_rank_bounds + num_distinct_rank_bounds)\n    return max_rank;\n\n  return (p_upper - g_a_rank_bounds);\n}\n\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/detail/thin_heap_/find_fn_imps.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file find_fn_imps.hpp\n * Contains an implementation for thin_heap_.\n */\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::const_reference\nPB_DS_CLASS_C_DEC::\ntop() const\n{\n  _GLIBCXX_DEBUG_ONLY(assert_valid();)\n    _GLIBCXX_DEBUG_ASSERT(!base_type::empty());\n\n  _GLIBCXX_DEBUG_ASSERT(m_p_max != NULL);\n  return m_p_max->m_value;\n}\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/detail/thin_heap_/insert_fn_imps.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file insert_fn_imps.hpp\n * Contains an implementation for thin_heap_.\n */\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::point_iterator\nPB_DS_CLASS_C_DEC::\npush(const_reference r_val)\n{\n  _GLIBCXX_DEBUG_ONLY(assert_valid();)\n\n    node_pointer p_nd = base_type::get_new_node_for_insert(r_val);\n\n  p_nd->m_metadata = 0;\n\n  p_nd->m_p_prev_or_parent = p_nd->m_p_l_child = NULL;\n\n  if (base_type::m_p_root == NULL)\n    {\n      p_nd->m_p_next_sibling = NULL;\n\n      m_p_max = base_type::m_p_root = p_nd;\n\n      _GLIBCXX_DEBUG_ONLY(assert_valid();)\n\n        return point_iterator(p_nd);\n    }\n\n  p_nd->m_p_next_sibling = base_type::m_p_root;\n\n  base_type::m_p_root->m_p_prev_or_parent = NULL;\n\n  base_type::m_p_root = p_nd;\n\n  update_max(p_nd);\n\n  _GLIBCXX_DEBUG_ONLY(assert_valid();)\n\n    return point_iterator(p_nd);\n}\n\nPB_DS_CLASS_T_DEC\ninline void\nPB_DS_CLASS_C_DEC::\nmake_root(node_pointer p_nd)\n{\n  p_nd->m_metadata =\n    p_nd->m_p_l_child == NULL?\n    0 :\n    1 + p_nd->m_p_l_child->m_metadata;\n}\n\nPB_DS_CLASS_T_DEC\ninline void\nPB_DS_CLASS_C_DEC::\nmake_root_and_link(node_pointer p_nd)\n{\n  make_root(p_nd);\n\n  p_nd->m_p_prev_or_parent = NULL;\n\n  p_nd->m_p_next_sibling = base_type::m_p_root;\n\n  if (base_type::m_p_root != NULL)\n    base_type::m_p_root->m_p_prev_or_parent = NULL;\n\n  base_type::m_p_root = p_nd;\n\n  update_max(p_nd);\n}\n\nPB_DS_CLASS_T_DEC\ninline void\nPB_DS_CLASS_C_DEC::\nfix(node_pointer p_y)\n{\n  while (true)\n    {\n      if (p_y->m_p_prev_or_parent == NULL)\n        {\n\t  fix_root(p_y);\n\n\t  return;\n        }\n      else if (p_y->m_metadata == 1&&  p_y->m_p_next_sibling == NULL)\n        {\n\t  if (p_y->m_p_l_child != NULL)\n            {\n\t      fix_sibling_rank_1_unmarked(p_y);\n\n\t      return;\n            }\n\n\t  fix_sibling_rank_1_marked(p_y);\n\n\t  p_y = p_y->m_p_prev_or_parent;\n        }\n      else if (p_y->m_metadata > p_y->m_p_next_sibling->m_metadata + 1)\n        {\n\t  _GLIBCXX_DEBUG_ASSERT(p_y->m_p_l_child != NULL);\n\n\t  if (p_y->m_metadata != p_y->m_p_l_child->m_metadata + 2)\n            {\n\t      fix_sibling_general_unmarked(p_y);\n\n\t      return;\n            }\n\n\t  fix_sibling_general_marked(p_y);\n\n\t  p_y = p_y->m_p_prev_or_parent;\n        }\n      else if ((p_y->m_p_l_child == NULL&& \n                p_y->m_metadata == 2) ||(p_y->m_p_l_child != NULL&& \n\t\t\t\t\t p_y->m_metadata == p_y->m_p_l_child->m_metadata + 3))\n        {\n\t  node_pointer p_z = p_y->m_p_prev_or_parent;\n\n\t  fix_child(p_y);\n\n\t  p_y = p_z;\n        }\n      else\n\treturn;\n    }\n}\n\nPB_DS_CLASS_T_DEC\ninline void\nPB_DS_CLASS_C_DEC::\nfix_root(node_pointer p_y)\n{\n  _GLIBCXX_DEBUG_ASSERT(p_y->m_p_prev_or_parent == NULL);\n\n  make_root(p_y);\n\n  _GLIBCXX_DEBUG_ONLY(assert_node_consistent(p_y, true);)\n    }\n\nPB_DS_CLASS_T_DEC\ninline void\nPB_DS_CLASS_C_DEC::\nfix_sibling_rank_1_unmarked(node_pointer p_y)\n{\n  _GLIBCXX_DEBUG_ASSERT(p_y->m_p_prev_or_parent != NULL);\n\n  _GLIBCXX_DEBUG_ONLY(node_pointer p_w = p_y->m_p_l_child;)\n    _GLIBCXX_DEBUG_ASSERT(p_w != NULL);\n  _GLIBCXX_DEBUG_ASSERT(p_w->m_p_next_sibling == NULL);\n  _GLIBCXX_DEBUG_ASSERT(p_y->m_p_next_sibling == NULL);\n\n  p_y->m_p_next_sibling = p_y->m_p_l_child;\n\n  p_y->m_p_next_sibling->m_p_prev_or_parent = p_y;\n\n  p_y->m_p_l_child = NULL;\n\n  _GLIBCXX_DEBUG_ONLY(assert_node_consistent(p_y, false);)\n    }\n\nPB_DS_CLASS_T_DEC\ninline void\nPB_DS_CLASS_C_DEC::\nfix_sibling_rank_1_marked(node_pointer p_y)\n{\n  _GLIBCXX_DEBUG_ASSERT(p_y->m_p_prev_or_parent != NULL);\n  _GLIBCXX_DEBUG_ASSERT(p_y->m_p_l_child == NULL);\n\n  p_y->m_metadata = 0;\n\n  _GLIBCXX_DEBUG_ONLY(assert_node_consistent(p_y, false);)\n    }\n\nPB_DS_CLASS_T_DEC\ninline void\nPB_DS_CLASS_C_DEC::\nfix_sibling_general_unmarked(node_pointer p_y)\n{\n  _GLIBCXX_DEBUG_ASSERT(p_y->m_p_prev_or_parent != NULL);\n\n  node_pointer p_w = p_y->m_p_l_child;\n  _GLIBCXX_DEBUG_ASSERT(p_w != NULL);\n  _GLIBCXX_DEBUG_ASSERT(p_w->m_p_next_sibling != NULL);\n\n  p_y->m_p_l_child = p_w->m_p_next_sibling;\n  p_w->m_p_next_sibling->m_p_prev_or_parent = p_y;\n\n  p_w->m_p_next_sibling = p_y->m_p_next_sibling;\n  _GLIBCXX_DEBUG_ASSERT(p_w->m_p_next_sibling != NULL);\n  p_w->m_p_next_sibling->m_p_prev_or_parent = p_w;\n\n  p_y->m_p_next_sibling = p_w;\n  p_w->m_p_prev_or_parent = p_y;\n\n  _GLIBCXX_DEBUG_ONLY(assert_node_consistent(p_y, false);)\n    }\n\nPB_DS_CLASS_T_DEC\ninline void\nPB_DS_CLASS_C_DEC::\nfix_sibling_general_marked(node_pointer p_y)\n{\n  _GLIBCXX_DEBUG_ASSERT(p_y->m_p_prev_or_parent != NULL);\n\n  --p_y->m_metadata;\n\n  _GLIBCXX_DEBUG_ONLY(assert_node_consistent(p_y, false);)\n    }\n\nPB_DS_CLASS_T_DEC\ninline void\nPB_DS_CLASS_C_DEC::\nfix_child(node_pointer p_y)\n{\n  _GLIBCXX_DEBUG_ASSERT(p_y->m_p_prev_or_parent != NULL);\n\n  if (p_y->m_p_next_sibling != NULL)\n    p_y->m_p_next_sibling->m_p_prev_or_parent = p_y->m_p_prev_or_parent;\n\n  if (p_y->m_p_prev_or_parent->m_p_l_child == p_y)\n    p_y->m_p_prev_or_parent->m_p_l_child = p_y->m_p_next_sibling;\n  else\n    p_y->m_p_prev_or_parent->m_p_next_sibling = p_y->m_p_next_sibling;\n\n  make_root_and_link(p_y);\n}\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\nmodify(point_iterator it, const_reference r_new_val)\n{\n  _GLIBCXX_DEBUG_ONLY(assert_valid();)\n    node_pointer p_nd = it.m_p_nd;\n\n  _GLIBCXX_DEBUG_ASSERT(p_nd != NULL);\n\n  const bool smaller = Cmp_Fn::operator()(r_new_val, p_nd->m_value);\n\n  p_nd->m_value = r_new_val;\n\n  if (smaller)\n    {\n      remove_node(p_nd);\n\n      p_nd->m_p_l_child = NULL;\n\n      make_root_and_link(p_nd);\n\n      _GLIBCXX_DEBUG_ONLY(assert_valid();)\n\n        return;\n    }\n\n  if (p_nd->m_p_prev_or_parent == NULL)\n    {\n      update_max(p_nd);\n\n      _GLIBCXX_DEBUG_ONLY(assert_valid();)\n\n        return;\n    }\n\n  node_pointer p_y = p_nd->m_p_prev_or_parent;\n  _GLIBCXX_DEBUG_ASSERT(p_y != NULL);\n\n  if (p_nd->m_p_next_sibling != NULL)\n    p_nd->m_p_next_sibling->m_p_prev_or_parent = p_y;\n\n  if (p_y->m_p_l_child == p_nd)\n    p_y->m_p_l_child = p_nd->m_p_next_sibling;\n  else\n    p_y->m_p_next_sibling = p_nd->m_p_next_sibling;\n\n  fix(p_y);\n\n  make_root_and_link(p_nd);\n\n  _GLIBCXX_DEBUG_ONLY(assert_valid();)\n    }\n\nPB_DS_CLASS_T_DEC\ninline void\nPB_DS_CLASS_C_DEC::\nupdate_max(node_pointer p_nd)\n{\n  if (m_p_max == NULL || Cmp_Fn::operator()(m_p_max->m_value, p_nd->m_value))\n    m_p_max = p_nd;\n}\n\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/detail/thin_heap_/split_join_fn_imps.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file split_join_fn_imps.hpp\n * Contains an implementation for thin_heap_.\n */\n\nPB_DS_CLASS_T_DEC\ntemplate<typename Pred>\nvoid\nPB_DS_CLASS_C_DEC::\nsplit(Pred pred, PB_DS_CLASS_C_DEC& other)\n{\n  _GLIBCXX_DEBUG_ONLY(assert_valid();)\n    _GLIBCXX_DEBUG_ONLY(other.assert_valid();)\n\n    other.clear();\n\n  if (base_type::empty())\n    {\n      _GLIBCXX_DEBUG_ONLY(assert_valid();)\n        _GLIBCXX_DEBUG_ONLY(other.assert_valid();)\n\n        return;\n    }\n\n  base_type::to_linked_list();\n\n  node_pointer p_out = base_type::prune(pred);\n\n  while (p_out != NULL)\n    {\n      _GLIBCXX_DEBUG_ASSERT(base_type::m_size > 0);\n      --base_type::m_size;\n\n      ++other.m_size;\n\n      node_pointer p_next = p_out->m_p_next_sibling;\n\n      other.make_root_and_link(p_out);\n\n      p_out = p_next;\n    }\n\n  _GLIBCXX_DEBUG_ONLY(other.assert_valid();)\n\n    node_pointer p_cur = base_type::m_p_root;\n\n  m_p_max = NULL;\n\n  base_type::m_p_root = NULL;\n\n  while (p_cur != NULL)\n    {\n      node_pointer p_next = p_cur->m_p_next_sibling;\n\n      make_root_and_link(p_cur);\n\n      p_cur = p_next;\n    }\n\n  _GLIBCXX_DEBUG_ONLY(assert_valid();)\n    _GLIBCXX_DEBUG_ONLY(other.assert_valid();)\n    }\n\nPB_DS_CLASS_T_DEC\ninline void\nPB_DS_CLASS_C_DEC::\njoin(PB_DS_CLASS_C_DEC& other)\n{\n  _GLIBCXX_DEBUG_ONLY(assert_valid();)\n    _GLIBCXX_DEBUG_ONLY(other.assert_valid();)\n\n    node_pointer p_other = other.m_p_root;\n\n  while (p_other != NULL)\n    {\n      node_pointer p_next = p_other->m_p_next_sibling;\n\n      make_root_and_link(p_other);\n\n      p_other = p_next;\n    }\n\n  base_type::m_size += other.m_size;\n\n  other.m_p_root = NULL;\n  other.m_size = 0;\n  other.m_p_max = NULL;\n\n  _GLIBCXX_DEBUG_ONLY(assert_valid();)\n    _GLIBCXX_DEBUG_ONLY(other.assert_valid();)\n    }\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/detail/thin_heap_/thin_heap_.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file thin_heap_.hpp\n * Contains an implementation class for a thin heap.\n */\n\n#ifndef PB_DS_THIN_HEAP_HPP\n#define PB_DS_THIN_HEAP_HPP\n\n/*\n * Thin heaps.\n * Tarjan and Kaplan.\n */\n\n#include <algorithm>\n#include <ext/pb_ds/detail/cond_dealtor.hpp>\n#include <ext/pb_ds/detail/type_utils.hpp>\n#include <ext/pb_ds/detail/left_child_next_sibling_heap_/left_child_next_sibling_heap_.hpp>\n#include <ext/pb_ds/detail/left_child_next_sibling_heap_/null_metadata.hpp>\n#include <debug/debug.h>\n\nnamespace pb_ds\n{\n  namespace detail\n  {\n\n#define PB_DS_CLASS_T_DEC \\\n    template<typename Value_Type, class Cmp_Fn, class Allocator>\n\n#define PB_DS_CLASS_C_DEC \\\n    thin_heap_<Value_Type, Cmp_Fn, Allocator>\n\n#ifdef _GLIBCXX_DEBUG\n#define PB_DS_BASE_C_DEC \\\n    left_child_next_sibling_heap_<Value_Type, Cmp_Fn,\t\\\n\t\t\t        typename Allocator::size_type, Allocator, true>\n#else \n#define PB_DS_BASE_C_DEC\t\t\t\t\t\t\\\n    left_child_next_sibling_heap_<Value_Type, Cmp_Fn, \\\n\t\t\t\t  typename Allocator::size_type, Allocator>\n#endif \n\n    /**\n     * class description = \"t|-|i|\\| h34p\">\n     **/\n    template<typename Value_Type, class Cmp_Fn, class Allocator>\n    class thin_heap_ : public PB_DS_BASE_C_DEC\n    {\n\n    private:\n      typedef PB_DS_BASE_C_DEC base_type;\n\n    protected:\n      typedef typename base_type::node node;\n\n      typedef typename base_type::node_pointer node_pointer;\n\n      typedef typename base_type::const_node_pointer const_node_pointer;\n\n    public:\n\n      typedef typename Allocator::size_type size_type;\n\n      typedef typename Allocator::difference_type difference_type;\n\n      typedef Value_Type value_type;\n\n      typedef\n      typename Allocator::template rebind<\n\tvalue_type>::other::pointer\n      pointer;\n\n      typedef\n      typename Allocator::template rebind<\n\tvalue_type>::other::const_pointer\n      const_pointer;\n\n      typedef\n      typename Allocator::template rebind<\n\tvalue_type>::other::reference\n      reference;\n\n      typedef\n      typename Allocator::template rebind<\n\tvalue_type>::other::const_reference\n      const_reference;\n\n      typedef\n      typename PB_DS_BASE_C_DEC::const_point_iterator\n      const_point_iterator;\n\n      typedef typename PB_DS_BASE_C_DEC::point_iterator point_iterator;\n\n      typedef typename PB_DS_BASE_C_DEC::const_iterator const_iterator;\n\n      typedef typename PB_DS_BASE_C_DEC::iterator iterator;\n\n      typedef Cmp_Fn cmp_fn;\n\n      typedef Allocator allocator;\n\n    public:\n\n      inline point_iterator\n      push(const_reference r_val);\n\n      void\n      modify(point_iterator it, const_reference r_new_val);\n\n      inline const_reference\n      top() const;\n\n      void\n      pop();\n\n      void\n      erase(point_iterator it);\n\n      inline void\n      clear();\n\n      template<typename Pred>\n      size_type\n      erase_if(Pred pred);\n\n      template<typename Pred>\n      void\n      split(Pred pred, PB_DS_CLASS_C_DEC& other);\n\n      void\n      join(PB_DS_CLASS_C_DEC& other);\n\n    protected:\n\n      thin_heap_();\n\n      thin_heap_(const Cmp_Fn& r_cmp_fn);\n\n      thin_heap_(const PB_DS_CLASS_C_DEC& other);\n\n      void\n      swap(PB_DS_CLASS_C_DEC& other);\n\n      ~thin_heap_();\n\n      template<typename It>\n      void\n      copy_from_range(It first_it, It last_it);\n\n#ifdef _GLIBCXX_DEBUG\n      void\n      assert_valid() const;\n\n      void\n      assert_max() const;\n#endif \n\n#ifdef PB_DS_THIN_HEAP_TRACE_\n      void\n      trace() const;\n#endif \n\n    private:\n      enum\n\t{\n\t  max_rank = (sizeof(size_type) << 4) + 2\n\t};\n\n    private:\n\n      void\n      initialize();\n\n      inline void\n      update_max(node_pointer p_nd);\n\n      inline void\n      fix(node_pointer p_nd);\n\n      inline void\n      fix_root(node_pointer p_y);\n\n      inline void\n      fix_sibling_rank_1_unmarked(node_pointer p_y);\n\n      inline void\n      fix_sibling_rank_1_marked(node_pointer p_y);\n\n      inline void\n      fix_sibling_general_unmarked(node_pointer p_y);\n\n      inline void\n      fix_sibling_general_marked(node_pointer p_y);\n\n      inline void\n      fix_child(node_pointer p_y);\n\n      inline static void\n      make_root(node_pointer p_nd);\n\n      inline void\n      make_root_and_link(node_pointer p_nd);\n\n      inline void\n      remove_max_node();\n\n      void\n      to_aux_except_max();\n\n      inline void\n      add_to_aux(node_pointer p_nd);\n\n      inline void\n      make_from_aux();\n\n      inline size_type\n      rank_bound();\n\n      inline void\n      make_child_of(node_pointer p_nd, node_pointer p_new_parent);\n\n      inline void\n      remove_node(node_pointer p_nd);\n\n      inline node_pointer\n      join(node_pointer p_lhs, node_pointer p_rhs) const;\n\n#ifdef _GLIBCXX_DEBUG\n      void\n      assert_node_consistent(const_node_pointer p_nd, bool root) const;\n\n      void\n      assert_aux_null() const;\n#endif \n\n    private:\n      node_pointer m_p_max;\n\n      node_pointer m_a_aux[max_rank];\n    };\n\n    enum\n      {\n\tnum_distinct_rank_bounds = 48\n      };\n\n    // Taken from the SGI implementation; acknowledged in the docs.\n    static const std::size_t g_a_rank_bounds[num_distinct_rank_bounds] =\n      {\n\t/* Dealing cards... */\n\t/* 0     */ 0ul,\n\t/* 1     */ 1ul,\n\t/* 2     */ 1ul,\n\t/* 3     */ 2ul,\n\t/* 4     */ 4ul,\n\t/* 5     */ 6ul,\n\t/* 6     */ 11ul,\n\t/* 7     */ 17ul,\n\t/* 8     */ 29ul,\n\t/* 9     */ 46ul,\n\t/* 10    */ 76ul,\n\t/* 11    */ 122ul,\n\t/* 12    */ 199ul,\n\t/* 13    */ 321ul,\n\t/* 14    */ 521ul,\n\t/* 15    */ 842ul,\n\t/* 16    */ 1364ul,\n\t/* 17    */ 2206ul,\n\t/* 18    */ 3571ul,\n\t/* 19    */ 5777ul,\n\t/* 20    */ 9349ul,\n\t/* 21    */ 15126ul,\n\t/* 22    */ 24476ul,\n\t/* 23    */ 39602ul,\n\t/* 24    */ 64079ul,\n\t/* 25    */ 103681ul,\n\t/* 26    */ 167761ul,\n\t/* 27    */ 271442ul,\n\t/* 28    */ 439204ul,\n\t/* 29    */ 710646ul,\n\t/* 30    */ 1149851ul,\n\t/* 31    */ 1860497ul,\n\t/* 32    */ 3010349ul,\n\t/* 33    */ 4870846ul,\n\t/* 34    */ 7881196ul,\n\t/* 35    */ 12752042ul,\n\t/* 36    */ 20633239ul,\n\t/* 37    */ 33385282ul,\n\t/* 38    */ 54018521ul,\n\t/* 39    */ 87403803ul,\n\t/* 40    */ 141422324ul,\n\t/* 41    */ 228826127ul,\n\t/* 42    */ 370248451ul,\n\t/* 43    */ 599074578ul,\n\t/* 44    */ 969323029ul,\n\t/* 45    */ 1568397607ul,\n\t/* 46    */ 2537720636ul,\n\t/* 47    */ 4106118243ul\n\t/* Pot's good, let's play */\n      };\n\n#include <ext/pb_ds/detail/thin_heap_/constructors_destructor_fn_imps.hpp>\n#include <ext/pb_ds/detail/thin_heap_/debug_fn_imps.hpp>\n#include <ext/pb_ds/detail/thin_heap_/trace_fn_imps.hpp>\n#include <ext/pb_ds/detail/thin_heap_/find_fn_imps.hpp>\n#include <ext/pb_ds/detail/thin_heap_/insert_fn_imps.hpp>\n#include <ext/pb_ds/detail/thin_heap_/erase_fn_imps.hpp>\n#include <ext/pb_ds/detail/thin_heap_/split_join_fn_imps.hpp>\n\n#undef PB_DS_CLASS_C_DEC\n#undef PB_DS_CLASS_T_DEC\n#undef PB_DS_BASE_C_DEC\n\n  } // namespace detail\n} // namespace pb_ds\n\n#endif \n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/detail/thin_heap_/trace_fn_imps.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file trace_fn_imps.hpp\n * Contains an implementation class for left_child_next_sibling_heap_.\n */\n\n#ifdef PB_DS_THIN_HEAP_TRACE_\n\nPB_DS_CLASS_T_DEC\nvoid\nPB_DS_CLASS_C_DEC::\ntrace() const\n{\n  std::cerr << std::endl;\n\n  std::cerr << \"m_p_max \" << m_p_max << std::endl;\n\n  base_type::trace();\n}\n\n#endif // #ifdef PB_DS_THIN_HEAP_TRACE_\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/detail/tree_policy/node_metadata_selector.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file node_metadata_selector.hpp\n * Contains an implementation class for trees.\n */\n\n#ifndef PB_DS_TREE_NODE_METADATA_SELECTOR_HPP\n#define PB_DS_TREE_NODE_METADATA_SELECTOR_HPP\n\n#include <ext/pb_ds/detail/basic_tree_policy/null_node_metadata.hpp>\n#include <ext/pb_ds/detail/types_traits.hpp>\n\nnamespace pb_ds\n{\n  namespace detail\n  {\n\n    template<typename Node_Update, bool Null>\n    struct tree_metadata_helper\n    {\n      typedef typename Node_Update::metadata_type type;\n    };\n\n    template<typename Node_Update>\n    struct tree_metadata_helper<\n      Node_Update,\n      true>\n    {\n      typedef null_node_metadata type;\n    };\n\n    template<typename Key,\n\t     typename Data,\n\t     class Cmp_Fn,\n\t     template<typename Const_Node_Iterator,\n\t\t      class Const_Iterator,\n\t\t      class Cmp_Fn_,\n\t\t      class Allocator_>\n    class Node_Update,\n\t     class Allocator>\n    struct tree_node_metadata_selector\n    {\n    private:\n      typedef\n      dumconst_node_iterator<\n      Key,\n      Data,\n      Allocator>\n      dumconst_node_it;\n\n      enum\n\t{\n\t  null_update =\n\t  is_same<\n\t  Node_Update<\n\t  dumconst_node_it,\n\t  dumconst_node_it,\n\t  Cmp_Fn,\n\t  Allocator>,\n\t  null_tree_node_update<\n\t  dumconst_node_it,\n\t  dumconst_node_it,\n\t  Cmp_Fn,\n\t  Allocator> >::value\n\t};\n\n    public:\n      typedef\n      typename tree_metadata_helper<\n      Node_Update<\n      dumconst_node_it,\n      dumconst_node_it,\n      Cmp_Fn,\n      Allocator>,\n      null_update>::type\n      type;\n    };\n\n  } // namespace detail\n} // namespace pb_ds\n\n#endif // #ifndef PB_DS_TREE_NODE_METADATA_SELECTOR_HPP\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/detail/tree_policy/null_node_update_imp.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file null_node_update_imp.hpp\n * Contains an implementation of null_node_update.\n */\n\nPB_DS_CLASS_T_DEC\ntemplate<typename Const_Node_Iterator_,\n\t typename Node_Iterator_,\n\t class    Cmp_Fn_,\n\t typename Allocator_>\ninline void\nPB_DS_CLASS_C_DEC::\nswap(null_tree_node_update<            Const_Node_Iterator_, Node_Iterator_, Cmp_Fn_, Allocator_>& /*other*/)\n{ }\n\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/detail/tree_policy/order_statistics_imp.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file order_statistics_imp.hpp\n * Contains forward declarations for order_statistics_key\n */\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::iterator\nPB_DS_CLASS_C_DEC::\nfind_by_order(size_type order)\n{\n  node_iterator it = node_begin();\n\n  node_iterator end_it = node_end();\n\n  while (it != end_it)\n    {\n      node_iterator l_it = it.get_l_child();\n\n      const size_type o = (l_it == end_it)?\n\t0 :\n\tl_it.get_metadata();\n\n      if (order == o)\n\treturn (*it);\n      else if (order < o)\n\tit = l_it;\n      else\n        {\n\t  order -= o + 1;\n\n\t  it = it.get_r_child();\n        }\n    }\n\n  return (PB_DS_BASE_C_DEC::end_iterator());\n}\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::const_iterator\nPB_DS_CLASS_C_DEC::\nfind_by_order(size_type order) const\n{\n  return (const_cast<PB_DS_CLASS_C_DEC* >(this)->find_by_order(order));\n}\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::size_type\nPB_DS_CLASS_C_DEC::\norder_of_key(const_key_reference r_key) const\n{\n  const_node_iterator it = node_begin();\n\n  const_node_iterator end_it = node_end();\n\n  const cmp_fn& r_cmp_fn =\n    const_cast<PB_DS_CLASS_C_DEC* >(this)->get_cmp_fn();\n\n  size_type ord = 0;\n\n  while (it != end_it)\n    {\n      const_node_iterator l_it = it.get_l_child();\n\n      if (r_cmp_fn(r_key, extract_key(*(*it))))\n\tit = l_it;\n      else if (r_cmp_fn(extract_key(*(*it)), r_key))\n        {\n\n\t  ord += (l_it == end_it)?\n\t    1 :\n\t    1 + l_it.get_metadata();\n\n\t  it = it.get_r_child();\n        }\n      else\n        {\n\t  ord += (l_it == end_it)?\n\t    0 :\n\t    l_it.get_metadata();\n\n\t  it = end_it;\n        }\n    }\n\n  return (ord);\n}\n\nPB_DS_CLASS_T_DEC\ninline void\nPB_DS_CLASS_C_DEC::\noperator()(node_iterator node_it, const_node_iterator end_nd_it) const\n{\n  node_iterator l_child_it = node_it.get_l_child();\n  const size_type l_rank =(l_child_it == end_nd_it)? 0 : l_child_it.get_metadata();\n\n  node_iterator r_child_it = node_it.get_r_child();\n  const size_type r_rank =(r_child_it == end_nd_it)? 0 : r_child_it.get_metadata();\n\n  const_cast<metadata_reference>(node_it.get_metadata())=\n    1 + l_rank + r_rank;\n}\n\nPB_DS_CLASS_T_DEC\nPB_DS_CLASS_C_DEC::\n~tree_order_statistics_node_update()\n{ }\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/detail/tree_policy/sample_tree_node_update.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file sample_tree_node_update.hpp\n * Contains a samle node update functor.\n */\n\n#ifndef PB_DS_SAMPLE_TREE_NODE_UPDATOR_HPP\n#define PB_DS_SAMPLE_TREE_NODE_UPDATOR_HPP\n\n// A sample node updator.\ntemplate<typename Const_Node_Iterator,\n\n\t class Node_Iterator,\n\n\t class Cmp_Fn,\n\n\t class Allocator\n\t >\nclass sample_tree_node_update\n{\n\npublic:\n\n  // Metadata type.\n  typedef size_t metadata_type;\n\nprotected:\n\n  // Default constructor.\n  sample_tree_node_update();\n\n  // Updates the rank of a node through a node_iterator node_it; end_nd_it is the end node iterator.\n  inline void\n  operator()(node_iterator node_it, const_node_iterator end_nd_it) const;\n\n};\n\n#endif // #ifndef PB_DS_SAMPLE_TREE_NODE_UPDATOR_HPP\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/detail/tree_trace_base.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file tree_trace_base.hpp\n * Contains tree-related policies.\n */\n\n#ifndef PB_DS_TREE_TRACE_BASE_HPP\n#define PB_DS_TREE_TRACE_BASE_HPP\n\n#ifdef PB_DS_TREE_TRACE\n\n#include <ext/pb_ds/detail/basic_tree_policy/basic_tree_policy_base.hpp>\n#include <ext/pb_ds/detail/basic_tree_policy/null_node_metadata.hpp>\n\nnamespace pb_ds\n{\n\n  namespace detail\n  {\n\n#ifdef PB_DS_TREE_TRACE\n\n#define PB_DS_CLASS_T_DEC\t\t\t\t\t\t\\\n    template<\t\t\t\t\t\t\t\t\\\n\t\t\t\t\t\tclass Const_Node_Iterator, \\\n\t\t\t\t\t\tclass Node_Iterator,\t\\\n\t\t\t\t\t\tclass Cmp_Fn,\t\t\\\n\t\t\t\t\t\tbool Node_Based,\t\\\n\t\t\t\t\t\tclass Allocator>\n\n#define PB_DS_CLASS_C_DEC\t\t\t\t\t\t\\\n    tree_trace_base<\t\t\t\t\t\t\t\\\n\t\t\t\t\t\tConst_Node_Iterator,\t\\\n\t\t\t\t\t\tNode_Iterator,\t\t\\\n\t\t\t\t\t\tCmp_Fn,\t\t\t\\\n\t\t\t\t\t\tNode_Based,\t\t\\\n\t\t\t\t\t\tAllocator>\n\n#define PB_DS_BASE_C_DEC\t\t\t\t\t\t\\\n    basic_tree_policy_base<\t\t\t\t\\\n\t\t\t\t\t\t\t\tConst_Node_Iterator, \\\n\t\t\t\t\t\t\t\tNode_Iterator, \\\n\t\t\t\t\t\t\t\tAllocator>\n\n    template<typename Const_Node_Iterator,\n\t     class Node_Iterator,\n\t     class Cmp_Fn,\n\t     bool Node_Based,\n\t     class Allocator>\n    class tree_trace_base : private PB_DS_BASE_C_DEC\n    {\n    public:\n      void\n      trace() const;\n\n    private:\n      typedef PB_DS_BASE_C_DEC base_type;\n\n      typedef Const_Node_Iterator const_node_iterator;\n\n      typedef typename Allocator::size_type size_type;\n\n    private:\n      void\n      trace_node(const_node_iterator nd_it, size_type level) const;\n\n      virtual bool\n      empty() const = 0;\n\n      virtual const_node_iterator\n      node_begin() const = 0;\n\n      virtual const_node_iterator\n      node_end() const = 0;\n\n      static void\n      print_node_pointer(Const_Node_Iterator nd_it, integral_constant<int,true>);\n\n      static void\n      print_node_pointer(Const_Node_Iterator nd_it, integral_constant<int,false>);\n\n      template<typename Metadata_>\n      static void\n      trace_it_metadata(Const_Node_Iterator nd_it, type_to_type<Metadata_>);\n\n      static void\n      trace_it_metadata(Const_Node_Iterator, type_to_type<null_node_metadata>);\n    };\n\n    PB_DS_CLASS_T_DEC\n    void\n    PB_DS_CLASS_C_DEC::\n    trace() const\n    {\n      if (empty())\n        return;\n\n      trace_node(node_begin(), 0);\n    }\n\n    PB_DS_CLASS_T_DEC\n    void\n    PB_DS_CLASS_C_DEC::\n    trace_node(const_node_iterator nd_it, size_type level) const\n    {\n      if (nd_it.get_r_child() != node_end())\n        trace_node(nd_it.get_r_child(), level + 1);\n\n      for (size_type i = 0; i < level; ++i)\n        std::cerr << ' ';\n\n      print_node_pointer(nd_it, integral_constant<int,Node_Based>());\n      std::cerr << base_type::extract_key(*(*nd_it));\n\n      typedef\n        type_to_type<\n\ttypename const_node_iterator::metadata_type>\n        m_type_ind_t;\n\n      trace_it_metadata(nd_it, m_type_ind_t());\n\n      std::cerr << std::endl;\n\n      if (nd_it.get_l_child() != node_end())\n        trace_node(nd_it.get_l_child(), level + 1);\n    }\n\n    PB_DS_CLASS_T_DEC\n    template<typename Metadata_>\n    void\n    PB_DS_CLASS_C_DEC::\n    trace_it_metadata(Const_Node_Iterator nd_it, type_to_type<Metadata_>)\n    {\n      std::cerr << \" (\" <<\n        static_cast<unsigned long>(nd_it.get_metadata()) << \") \";\n    }\n\n    PB_DS_CLASS_T_DEC\n    void\n    PB_DS_CLASS_C_DEC::\n    trace_it_metadata(Const_Node_Iterator, type_to_type<null_node_metadata>)\n    { }\n\n    PB_DS_CLASS_T_DEC\n    void\n    PB_DS_CLASS_C_DEC::\n    print_node_pointer(Const_Node_Iterator nd_it, integral_constant<int,true>)\n    {\n      std::cerr << nd_it.m_p_nd << \" \";\n    }\n\n    PB_DS_CLASS_T_DEC\n    void\n    PB_DS_CLASS_C_DEC::\n    print_node_pointer(Const_Node_Iterator nd_it, integral_constant<int,false>)\n    {\n      std::cerr <<* nd_it << \" \";\n    }\n\n#undef PB_DS_CLASS_T_DEC\n\n#undef PB_DS_CLASS_C_DEC\n\n#undef PB_DS_BASE_C_DEC\n\n#endif // #ifdef    PB_DS_TREE_TRACE\n\n  } // namespace detail\n\n} // namespace pb_ds\n\n#endif // #ifdef PB_DS_TREE_TRACE\n\n#endif // #ifndef PB_DS_TREE_TRACE_BASE_HPP\n\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/detail/trie_policy/node_metadata_selector.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file node_metadata_selector.hpp\n * Contains an implementation class for tries.\n */\n\n#ifndef PB_DS_TRIE_NODE_METADATA_SELECTOR_HPP\n#define PB_DS_TRIE_NODE_METADATA_SELECTOR_HPP\n\n#include <ext/pb_ds/detail/basic_tree_policy/null_node_metadata.hpp>\n#include <ext/pb_ds/detail/types_traits.hpp>\n\nnamespace pb_ds\n{\n  namespace detail\n  {\n\n    template<typename Node_Update, bool Null>\n    struct trie_metadata_helper\n    {\n      typedef typename Node_Update::metadata_type type;\n    };\n\n    template<typename Node_Update>\n    struct trie_metadata_helper<\n      Node_Update,\n      true>\n    {\n      typedef null_node_metadata type;\n    };\n\n    template<typename Key,\n\t     typename Data,\n\t     class Cmp_Fn,\n\t     template<typename Const_Node_Iterator,\n\t\t      class Const_Iterator,\n\t\t      class Cmp_Fn_,\n\t\t      class Allocator_>\n    class Node_Update,\n\t     class Allocator>\n    struct trie_node_metadata_selector\n    {\n    private:\n      typedef\n      dumconst_node_iterator<\n      Key,\n      Data,\n      Allocator>\n      dumconst_node_it;\n\n      enum\n\t{\n\t  null_update =\n\t  is_same<\n\t  Node_Update<\n\t  dumconst_node_it,\n\t  dumconst_node_it,\n\t  Cmp_Fn,\n\t  Allocator>,\n\t  null_trie_node_update<\n\t  dumconst_node_it,\n\t  dumconst_node_it,\n\t  Cmp_Fn,\n\t  Allocator> >::value\n\t};\n\n    public:\n      typedef\n      typename trie_metadata_helper<\n      Node_Update<\n      dumconst_node_it,\n      dumconst_node_it,\n      Cmp_Fn,\n      Allocator>,\n      null_update>::type\n      type;\n    };\n\n  } // namespace detail\n} // namespace pb_ds\n\n#endif // #ifndef PB_DS_TRIE_NODE_METADATA_SELECTOR_HPP\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/detail/trie_policy/null_node_update_imp.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file null_node_update_imp.hpp\n * Contains an implementation of null_node_update.\n */\n\nPB_DS_CLASS_T_DEC\ntemplate<typename Const_Node_Iterator_,\n\t typename Node_Iterator_,\n\t class    E_Access_Traits_,\n\t typename Allocator_>\ninline void\nPB_DS_CLASS_C_DEC::\nswap(null_trie_node_update<            Const_Node_Iterator_, Node_Iterator_, E_Access_Traits_, Allocator_>& /*other*/)\n{ }\n\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/detail/trie_policy/order_statistics_imp.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file order_statistics_imp.hpp\n * Contains forward declarations for order_statistics_key\n */\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::iterator\nPB_DS_CLASS_C_DEC::\nfind_by_order(size_type order)\n{\n  if (empty())\n    return (end());\n\n  ++order;\n\n  node_iterator nd_it = node_begin();\n\n  node_iterator end_nd_it = node_end();\n\n  while (true)\n    {\n      if (order > nd_it.get_metadata())\n\treturn (++base_type::rightmost_it(nd_it));\n\n      const size_type num_children = nd_it.num_children();\n\n      if (num_children == 0)\n\treturn (*nd_it);\n\n      for (size_type i = 0; i < num_children; ++i)\n        {\n\t  node_iterator child_nd_it = nd_it.get_child(i);\n\n\t  if (order <= child_nd_it.get_metadata())\n            {\n\t      i = num_children;\n\n\t      nd_it = child_nd_it;\n            }\n\t  else\n\t    order -= child_nd_it.get_metadata();\n        }\n    }\n}\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::const_iterator\nPB_DS_CLASS_C_DEC::\nfind_by_order(size_type order) const\n{\n  return (const_cast<PB_DS_CLASS_C_DEC* >(this)->find_by_order(order));\n}\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::size_type\nPB_DS_CLASS_C_DEC::\norder_of_key(const_key_reference r_key) const\n{\n  const E_Access_Traits& r_traits =\n    const_cast<PB_DS_CLASS_C_DEC* >(this)->get_e_access_traits();\n\n  return (order_of_prefix(\n\t\t\t  r_traits.begin(r_key),\n\t\t\t  r_traits.end(r_key)));\n}\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::size_type\nPB_DS_CLASS_C_DEC::\norder_of_prefix(typename e_access_traits::const_iterator b, typename e_access_traits::const_iterator e) const\n{\n  if (empty())\n    return (0);\n\n  const E_Access_Traits& r_traits =\n    const_cast<PB_DS_CLASS_C_DEC* >(this)->get_e_access_traits();\n\n  const_node_iterator nd_it = node_begin();\n\n  const_node_iterator end_nd_it = node_end();\n\n  size_type ord = 0;\n\n  while (true)\n    {\n      const size_type num_children = nd_it.num_children();\n\n      if (num_children == 0)\n        {\n\t  const_key_reference r_key =\n\t    base_type::extract_key(*(*nd_it));\n\n\t  typename e_access_traits::const_iterator key_b =\n\t    r_traits.begin(r_key);\n\n\t  typename e_access_traits::const_iterator key_e =\n\t    r_traits.end(r_key);\n\n\t  return ((base_type::less(                    key_b, key_e,  b, e,  r_traits))?\n\t\t  ord + 1 :\n\t\t  ord);\n        }\n\n      const_node_iterator next_nd_it = end_nd_it;\n\n      size_type i = num_children - 1;\n\n      do\n        {\n\t  const_node_iterator child_nd_it = nd_it.get_child(i);\n\n\t  if (next_nd_it != end_nd_it)\n\t    ord += child_nd_it.get_metadata();\n\t  else if (!base_type::less(\n\t\t\t\t    b, e,\n\t\t\t\t    child_nd_it.valid_prefix().first,\n\t\t\t\t    child_nd_it.valid_prefix().second,\n\t\t\t\t    r_traits))\n\t    next_nd_it = child_nd_it;\n        }\n      while (i-- > 0);\n\n      if (next_nd_it == end_nd_it)\n\treturn (ord);\n\n      nd_it = next_nd_it;\n    }\n}\n\nPB_DS_CLASS_T_DEC\ninline void\nPB_DS_CLASS_C_DEC::\noperator()(node_iterator nd_it, const_node_iterator /*end_nd_it*/) const\n{\n  const size_type num_children = nd_it.num_children();\n\n  size_type children_rank = 0;\n\n  for (size_type i = 0; i < num_children; ++i)\n    children_rank += nd_it.get_child(i).get_metadata();\n\n  const_cast<size_type& >(nd_it.get_metadata()) =(num_children == 0)? 1 : children_rank;\n}\n\nPB_DS_CLASS_T_DEC\nPB_DS_CLASS_C_DEC::\n~trie_order_statistics_node_update()\n{ }\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/detail/trie_policy/prefix_search_node_update_imp.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file prefix_search_node_update_imp.hpp\n * Contains an implementation of prefix_search_node_update.\n */\n\nPB_DS_CLASS_T_DEC\nstd::pair<\n  typename PB_DS_CLASS_C_DEC::const_iterator,\n  typename PB_DS_CLASS_C_DEC::const_iterator>\nPB_DS_CLASS_C_DEC::\nprefix_range(const_key_reference r_key) const\n{\n  const e_access_traits& r_traits = get_e_access_traits();\n\n  return (prefix_range(\n\t\t       r_traits.begin(r_key),\n\t\t       r_traits.end(r_key)));\n}\n\nPB_DS_CLASS_T_DEC\nstd::pair<\n  typename PB_DS_CLASS_C_DEC::iterator,\n  typename PB_DS_CLASS_C_DEC::iterator>\nPB_DS_CLASS_C_DEC::\nprefix_range(const_key_reference r_key)\n{\n  return (prefix_range(\n\t\t       get_e_access_traits().begin(r_key),\n\t\t       get_e_access_traits().end(r_key)));\n}\n\nPB_DS_CLASS_T_DEC\nstd::pair<\n  typename PB_DS_CLASS_C_DEC::const_iterator,\n  typename PB_DS_CLASS_C_DEC::const_iterator>\nPB_DS_CLASS_C_DEC::\nprefix_range(typename e_access_traits::const_iterator b, typename e_access_traits::const_iterator e) const\n{\n  const std::pair<iterator, iterator> non_const_ret =\n    const_cast<PB_DS_CLASS_C_DEC* >(this)->prefix_range(b, e);\n\n  return (std::make_pair(\n\t\t\t const_iterator(non_const_ret.first),\n\t\t\t const_iterator(non_const_ret.second)));\n}\n\nPB_DS_CLASS_T_DEC\nstd::pair<\n  typename PB_DS_CLASS_C_DEC::iterator,\n  typename PB_DS_CLASS_C_DEC::iterator>\nPB_DS_CLASS_C_DEC::\nprefix_range(typename e_access_traits::const_iterator b, typename e_access_traits::const_iterator e)\n{\n  Node_Iterator nd_it = node_begin();\n  Node_Iterator end_nd_it = node_end();\n\n  const e_access_traits& r_traits =\n    get_e_access_traits();\n\n  const size_type given_range_length = std::distance(b, e);\n\n  while (true)\n    {\n      if (nd_it == end_nd_it)\n\treturn (std::make_pair(end(), end()));\n\n      const size_type common_range_length =\n\tPB_DS_BASE_C_DEC::common_prefix_len(nd_it, b, e, r_traits);\n\n      if (common_range_length >= given_range_length)\n        {\n\t  iterator ret_b = leftmost_it(nd_it);\n\n\t  iterator ret_e = rightmost_it(nd_it);\n\n\t  return (std::make_pair(ret_b, ++ret_e));\n        }\n\n      nd_it = next_child(nd_it, b, e, end_nd_it, r_traits);\n    }\n}\n\nPB_DS_CLASS_T_DEC\ntypename PB_DS_CLASS_C_DEC::node_iterator\nPB_DS_CLASS_C_DEC::\nnext_child(node_iterator nd_it, typename e_access_traits::const_iterator b, typename e_access_traits::const_iterator e, node_iterator end_nd_it, const e_access_traits& r_traits)\n{\n  const size_type num_children = nd_it.num_children();\n\n  node_iterator ret = end_nd_it;\n\n  size_type max_length = 0;\n\n  for (size_type i = 0; i < num_children; ++i)\n    {\n      node_iterator pot = nd_it.get_child(i);\n\n      const size_type common_range_length =\n\tPB_DS_BASE_C_DEC::common_prefix_len(            pot, b, e, r_traits);\n\n      if (common_range_length > max_length)\n        {\n\t  ret = pot;\n\n\t  max_length = common_range_length;\n        }\n    }\n\n  return (ret);\n}\n\nPB_DS_CLASS_T_DEC\ninline void\nPB_DS_CLASS_C_DEC::\noperator()(node_iterator /*nd_it*/, const_node_iterator /*end_nd_it*/) const\n{ }\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/detail/trie_policy/sample_trie_e_access_traits.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file sample_trie_e_access_traits.hpp\n * Contains a sample probe policy.\n */\n\n#ifndef PB_DS_SAMPLE_TRIE_E_ACCESS_TRAITS_HPP\n#define PB_DS_SAMPLE_TRIE_E_ACCESS_TRAITS_HPP\n\n// A sample trie element-access traits.\nclass sample_trie_e_access_traits\n{\n\npublic:\n\n  // Size type.\n  typedef size_t size_type;\n\n  // Key type.\n  typedef std::string key_type;\n\n  // Const key reference type.\n  typedef\n  typename Allocator::template rebind<\n    key_type>::other::const_reference\n  const_key_reference;\n\n  // Element const iterator type.\n  typedef std::string::const_iterator const_iterator;\n\n  // Element type.\n  typedef char e_type;\n\n  enum\n    {\n      max_size = 4\n    };\n\npublic:\n\n  // Returns a const_iterator to the first element of r_key.\n  inline static const_iterator\n  begin(const_key_reference r_key);\n\n  // Returns a const_iterator to the after-last element of r_key.\n  inline static const_iterator\n  end(const_key_reference r_key);\n\n  // Maps an element to a position.\n  inline static size_type\n  e_pos(e_type e);\n\n};\n\n#endif // #ifndef PB_DS_SAMPLE_TRIE_E_ACCESS_TRAITS_HPP\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/detail/trie_policy/sample_trie_node_update.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file sample_trie_node_update.hpp\n * Contains a samle node update functor.\n */\n\n#ifndef PB_DS_SAMPLE_TRIE_NODE_UPDATOR_HPP\n#define PB_DS_SAMPLE_TRIE_NODE_UPDATOR_HPP\n\n// A sample node updator.\ntemplate<typename Const_Node_Iterator,\n\n\t class Node_Iterator,\n\n\t class E_Access_Traits,\n\n\t class Allocator\n\t >\nclass sample_trie_node_update\n{\n\npublic:\n\n  // Metadata type.\n  typedef size_t metadata_type;\n\nprotected:\n\n  // Default constructor.\n  sample_trie_node_update();\n\n  // Updates the rank of a node through a node_iterator node_it; end_nd_it is the end node iterator.\n  inline void\n  operator()(node_iterator node_it, const_node_iterator end_nd_it) const;\n\n};\n\n#endif // #ifndef PB_DS_SAMPLE_TRIE_NODE_UPDATOR_HPP\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/detail/trie_policy/string_trie_e_access_traits_imp.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file string_trie_e_access_traits_imp.hpp\n * Contains a policy for extracting character positions from\n *    a string for a vector-based PATRICIA tree\n */\n\nPB_DS_CLASS_T_DEC\ndetail::integral_constant<int, Reverse> PB_DS_CLASS_C_DEC::s_rev_ind;\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::size_type\nPB_DS_CLASS_C_DEC::\ne_pos(e_type e)\n{\n  return (static_cast<size_type>(e - min_e_val));\n}\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::const_iterator\nPB_DS_CLASS_C_DEC::\nbegin(const_key_reference r_key)\n{\n  return (begin_imp(r_key, s_rev_ind));\n}\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::const_iterator\nPB_DS_CLASS_C_DEC::\nend(const_key_reference r_key)\n{\n  return (end_imp(r_key, s_rev_ind));\n}\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::const_iterator\nPB_DS_CLASS_C_DEC::\nbegin_imp(const_key_reference r_key, detail::false_type)\n{\n  return (r_key.begin());\n}\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::const_iterator\nPB_DS_CLASS_C_DEC::\nbegin_imp(const_key_reference r_key, detail::true_type)\n{\n  return (r_key.rbegin());\n}\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::const_iterator\nPB_DS_CLASS_C_DEC::\nend_imp(const_key_reference r_key, detail::false_type)\n{\n  return (r_key.end());\n}\n\nPB_DS_CLASS_T_DEC\ninline typename PB_DS_CLASS_C_DEC::const_iterator\nPB_DS_CLASS_C_DEC::\nend_imp(const_key_reference r_key, detail::true_type)\n{\n  return (r_key.rend());\n}\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/detail/trie_policy/trie_policy_base.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file trie_policy_base.hpp\n * Contains an implementation of trie_policy_base.\n */\n\n#ifndef PB_DS_TRIE_POLICY_BASE_HPP\n#define PB_DS_TRIE_POLICY_BASE_HPP\n\n#include <ext/pb_ds/detail/basic_tree_policy/basic_tree_policy_base.hpp>\n\nnamespace pb_ds\n{\n  namespace detail\n  {\n\n#define PB_DS_CLASS_T_DEC\t\t\t\t\t\t\\\n    template<\t\t\t\t\t\t\t\t\\\n\t\t\t\t\t\tclass Const_Node_Iterator, \\\n\t\t\t\t\t\tclass Node_Iterator,\t\\\n\t\t\t\t\t\tclass E_Access_Traits,\t\\\n\t\t\t\t\t\ttypename Allocator>\n\n#define PB_DS_CLASS_C_DEC\t\t\t\t\t\t\\\n    trie_policy_base<\t\t\t\t\t\t\t\\\n\t\t\t\t\t\tConst_Node_Iterator,\t\\\n\t\t\t\t\t\tNode_Iterator,\t\t\\\n\t\t\t\t\t\tE_Access_Traits,\t\\\n\t\t\t\t\t\tAllocator>\n\n#define PB_DS_BASE_C_DEC\t\t\t\t\t\t\\\n    basic_tree_policy_base<\t\t\t\t\\\n\t\t\t\t\t\t\t\tConst_Node_Iterator, \\\n\t\t\t\t\t\t\t\tNode_Iterator, \\\n\t\t\t\t\t\t\t\tAllocator>\n\n    template<typename Const_Node_Iterator,\n\t     class Node_Iterator,\n\t     class E_Access_Traits,\n\t     class Allocator>\n    class trie_policy_base : public PB_DS_BASE_C_DEC\n    {\n\n    public:\n\n      typedef E_Access_Traits e_access_traits;\n\n      typedef Allocator allocator;\n\n      typedef typename allocator::size_type size_type;\n\n      typedef null_node_metadata metadata_type;\n\n      typedef Const_Node_Iterator const_node_iterator;\n\n      typedef Node_Iterator node_iterator;\n\n      typedef typename const_node_iterator::value_type const_iterator;\n\n      typedef typename node_iterator::value_type iterator;\n\n    public:\n\n      typedef typename PB_DS_BASE_C_DEC::key_type key_type;\n\n      typedef\n      typename PB_DS_BASE_C_DEC::const_key_reference\n      const_key_reference;\n\n    protected:\n\n      virtual const_iterator\n      end() const = 0;\n\n      virtual iterator\n      end() = 0;\n\n      virtual const_node_iterator\n      node_begin() const = 0;\n\n      virtual node_iterator\n      node_begin() = 0;\n\n      virtual const_node_iterator\n      node_end() const = 0;\n\n      virtual node_iterator\n      node_end() = 0;\n\n      virtual const e_access_traits& \n      get_e_access_traits() const = 0;\n\n    private:\n      typedef\n      std::pair<\n      typename e_access_traits::const_iterator,\n      typename e_access_traits::const_iterator>\n      prefix_range_t;\n\n      typedef PB_DS_BASE_C_DEC base_type;\n\n    protected:\n      static size_type\n      common_prefix_len(node_iterator nd_it, typename e_access_traits::const_iterator b_r, typename e_access_traits::const_iterator e_r, const e_access_traits& r_traits);\n\n      static iterator\n      leftmost_it(node_iterator nd_it);\n\n      static iterator\n      rightmost_it(node_iterator nd_it);\n\n      static bool\n      less(typename e_access_traits::const_iterator b_l, typename e_access_traits::const_iterator e_l, typename e_access_traits::const_iterator b_r, typename e_access_traits::const_iterator e_r, const e_access_traits& r_traits);\n    };\n\n    PB_DS_CLASS_T_DEC\n    typename PB_DS_CLASS_C_DEC::size_type\n    PB_DS_CLASS_C_DEC::\n    common_prefix_len(node_iterator nd_it, typename e_access_traits::const_iterator b_r, typename e_access_traits::const_iterator e_r, const e_access_traits& r_traits)\n    {\n      prefix_range_t pref_range = nd_it.valid_prefix();\n\n      typename e_access_traits::const_iterator b_l = pref_range.first;\n      typename e_access_traits::const_iterator e_l = pref_range.second;\n\n      const size_type range_length_l =\n\tstd::distance(b_l, e_l);\n\n      const size_type range_length_r =\n\tstd::distance(b_r, e_r);\n\n      if (range_length_r < range_length_l)\n\t{\n\t  std::swap(b_l, b_r);\n\n\t  std::swap(e_l, e_r);\n\t}\n\n      size_type ret = 0;\n\n      while (b_l != e_l)\n\t{\n\t  if (r_traits.e_pos(*b_l) != r_traits.e_pos(*b_r))\n\t    return (ret);\n\n\t  ++ret;\n\n\t  ++b_l;\n\n\t  ++b_r;\n\t}\n\n      return (ret);\n    }\n\n    PB_DS_CLASS_T_DEC\n    typename PB_DS_CLASS_C_DEC::iterator\n    PB_DS_CLASS_C_DEC::\n    leftmost_it(node_iterator nd_it)\n    {\n      if (nd_it.num_children() == 0)\n\treturn (*nd_it);\n\n      return (leftmost_it(nd_it.get_child(0)));\n    }\n\n    PB_DS_CLASS_T_DEC\n    typename PB_DS_CLASS_C_DEC::iterator\n    PB_DS_CLASS_C_DEC::\n    rightmost_it(node_iterator nd_it)\n    {\n      const size_type num_children = nd_it.num_children();\n\n      if (num_children == 0)\n\treturn (*nd_it);\n\n      return (rightmost_it(nd_it.get_child(num_children - 1)));\n    }\n\n    PB_DS_CLASS_T_DEC\n    bool\n    PB_DS_CLASS_C_DEC::\n    less(typename e_access_traits::const_iterator b_l, typename e_access_traits::const_iterator e_l, typename e_access_traits::const_iterator b_r, typename e_access_traits::const_iterator e_r, const e_access_traits& r_traits)\n    {\n      while (b_l != e_l)\n\t{\n\t  if (b_r == e_r)\n\t    return (false);\n\n\t  size_type l_pos =\n\t    r_traits.e_pos(*b_l);\n\t  size_type r_pos =\n\t    r_traits.e_pos(*b_r);\n\n\t  if (l_pos != r_pos)\n\t    return (l_pos < r_pos);\n\n\t  ++b_l;\n\t  ++b_r;\n\t}\n\n      return (b_r != e_r);\n    }\n\n#undef PB_DS_CLASS_T_DEC\n\n#undef PB_DS_CLASS_C_DEC\n\n#undef PB_DS_BASE_C_DEC\n\n  } // namespace detail\n} // namespace pb_ds\n\n#endif // #ifndef PB_DS_TRIE_POLICY_BASE_HPP\n\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/detail/type_utils.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file type_utils.hpp\n * Contains utilities for handnling types. All of these classes are based on\n *    \"Modern C++\" by Andrei Alxandrescu.\n */\n\n#ifndef PB_DS_TYPE_UTILS_HPP\n#define PB_DS_TYPE_UTILS_HPP\n\n#include <cstddef>\n#include <utility>\n#include <tr1/type_traits>\n#include <ext/type_traits.h>\n#include <ext/numeric_traits.h>\n\nnamespace pb_ds\n{\n  namespace detail\n  {\n    using std::tr1::is_same;\n    using std::tr1::is_const;\n    using std::tr1::is_pointer;\n    using std::tr1::is_reference;\n    using std::tr1::is_fundamental;\n    using std::tr1::is_member_object_pointer;\n    using std::tr1::is_member_pointer;\n    using std::tr1::is_base_of;\n    using std::tr1::remove_const;\n    using std::tr1::remove_reference;\n\n    // Need integral_const<bool, true> <-> integral_const<int, 1>, so\n    // because of this use the following typedefs instead of importing\n    // std::tr1's.\n    using std::tr1::integral_constant;\n    typedef std::tr1::integral_constant<int, 1> true_type;\n    typedef std::tr1::integral_constant<int, 0> false_type;\n\n    using __gnu_cxx::__conditional_type;\n    using __gnu_cxx::__numeric_traits;\n\n    template<typename T>\n    struct is_const_pointer\n    {\n      enum\n\t{\n\t  value = is_const<T>::value && is_pointer<T>::value\n\t};\n    };\n\n    template<typename T>\n    struct is_const_reference\n    {\n      enum\n\t{\n\t  value = is_const<T>::value && is_reference<T>::value\n\t};\n    };\n\n    template<typename T>\n    struct is_simple\n    {\n      enum\n\t{\n\t  value = is_fundamental<typename remove_const<T>::type>::value \n\t  || is_pointer<typename remove_const<T>::type>::value \n\t  || is_member_pointer<T>::value \n\t};\n    };\n\n    template<typename T>\n    class is_pair\n    {\n    private:\n      template<typename U>\n      struct is_pair_imp\n      {\n\tenum\n\t  {\n\t    value = 0\n\t  };\n      };\n\n      template<typename U, typename V>\n      struct is_pair_imp<std::pair<U,V> >\n      {\n\tenum\n\t  {\n\t    value = 1\n\t  };\n      };\n\n    public:\n      enum\n\t{\n\t  value = is_pair_imp<T>::value\n\t};\n    };\n\n\n    template<bool>\n    struct static_assert;\n\n    template<>\n    struct static_assert<true>\n    { };\n\n    template<int>\n    struct static_assert_dumclass\n    {\n      enum\n\t{\n\t  v = 1\n\t};\n    };\n\n    template<typename Type>\n    struct type_to_type\n    {\n      typedef Type type;\n    };\n  } // namespace detail\n} // namespace pb_ds\n\n#endif \n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/detail/types_traits.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file types_traits.hpp\n * Contains a traits class of types used by containers.\n */\n\n#ifndef PB_DS_TYPES_TRAITS_HPP\n#define PB_DS_TYPES_TRAITS_HPP\n\n#include <ext/pb_ds/detail/basic_types.hpp>\n#include <ext/pb_ds/detail/type_utils.hpp>\n#include <utility>\n\nnamespace pb_ds\n{\n  namespace detail\n  {\n    template<typename Key, typename Mapped, typename Alloc, bool Store_Extra>\n    struct vt_base_selector\n    {\n      typedef value_type_base<Key, Mapped, Alloc, Store_Extra> type;\n    };\n\n    template<typename Key, typename Mapped, typename Alloc, bool Store_Extra>\n    struct types_traits \n    : public vt_base_selector<Key, Mapped, Alloc, Store_Extra>::type\n    {\n      typedef typename Alloc::template rebind<Key>::other key_allocator;\n      typedef typename key_allocator::value_type key_type;\n      typedef typename key_allocator::pointer key_pointer;\n      typedef typename key_allocator::const_pointer const_key_pointer;\n      typedef typename key_allocator::reference key_reference;\n      typedef typename key_allocator::const_reference const_key_reference;\n      typedef typename Alloc::size_type size_type;\n\n      // Extra value (used when the extra value is stored with each value).\n      typedef std::pair<size_type, size_type> comp_hash;\n\n      integral_constant<int, Store_Extra> m_store_extra_indicator;\n      typename no_throw_copies<Key, Mapped>::indicator m_no_throw_copies_indicator;\n    };\n  } // namespace detail\n} // namespace pb_ds\n\n#endif \n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/detail/unordered_iterator/const_iterator.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file const_iterator.hpp\n * Contains an iterator class used for const ranging over the elements of the\n *     table.\n */\n\n// Const range-type iterator.\nclass const_iterator_ : \n  public const_point_iterator_\n\n{\n\npublic:\n\n  // Category.\n  typedef std::forward_iterator_tag iterator_category;\n\n  // Difference type.\n  typedef typename Allocator::difference_type difference_type;\n\n  // Iterator's value type.\n  typedef value_type_ value_type;\n\n  // Iterator's pointer type.\n  typedef pointer_ pointer;\n\n  // Iterator's const pointer type.\n  typedef const_pointer_ const_pointer;\n\n  // Iterator's reference type.\n  typedef reference_ reference;\n\n  // Iterator's const reference type.\n  typedef const_reference_ const_reference;\n\npublic:\n\n  // Default constructor.\n  inline\n  const_iterator_()\n\n    : m_p_tbl(NULL)\n  { }\n\n  // Increments.\n  inline const_iterator_& \n  operator++()\n  {\n    m_p_tbl->inc_it_state(base_type::m_p_value, m_pos);\n\n    return (*this);\n  }\n\n  // Increments.\n  inline const_iterator_\n  operator++(int)\n  {\n    const_iterator_ ret =* this;\n\n    m_p_tbl->inc_it_state(base_type::m_p_value, m_pos);\n\n    return (ret);\n  }\n\nprotected:\n\n  typedef const_point_iterator_ base_type;\n\nprotected:\n\n  /**\n   *  Constructor used by the table to initiate the generalized\n   *      pointer and position (e.g., this is called from within a find()\n   *      of a table.\n   * */\n  inline\n  const_iterator_(const_pointer_ p_value,  PB_DS_GEN_POS pos,  const PB_DS_CLASS_C_DEC* p_tbl) : const_point_iterator_(p_value),\n\t\t\t\t\t\t\t\t\t\t\t\t m_p_tbl(p_tbl),\n\t\t\t\t\t\t\t\t\t\t\t\t m_pos(pos)\n  { }\n\nprotected:\n\n  /**\n   *  Pointer to the table object which created the iterator (used for\n   *      incrementing its position.\n   * */\n  const PB_DS_CLASS_C_DEC* m_p_tbl;\n\n  PB_DS_GEN_POS m_pos;\n\n  friend class PB_DS_CLASS_C_DEC;\n};\n\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/detail/unordered_iterator/const_point_iterator.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file const_point_iterator.hpp\n * Contains an iterator class returned by the tables' const find and insert\n *     methods.\n */\n\nclass point_iterator_;\n\n// Const point-type iterator.\nclass const_point_iterator_\n{\n\npublic:\n\n  // Category.\n  typedef trivial_iterator_tag iterator_category;\n\n  // Difference type.\n  typedef trivial_iterator_difference_type difference_type;\n\n  // Iterator's value type.\n  typedef value_type_ value_type;\n\n  // Iterator's pointer type.\n  typedef pointer_ pointer;\n\n  // Iterator's const pointer type.\n  typedef const_pointer_ const_pointer;\n\n  // Iterator's reference type.\n  typedef reference_ reference;\n\n  // Iterator's const reference type.\n  typedef const_reference_ const_reference;\n\npublic:\n\n  inline\n  const_point_iterator_(const_pointer p_value) : m_p_value(p_value)\n  { }\n\n  // Default constructor.\n  inline\n  const_point_iterator_()\n\n    : m_p_value(NULL)\n  { }\n\n  // Copy constructor.\n  inline\n  const_point_iterator_(const const_point_iterator_& other)\n\n    : m_p_value(other.m_p_value)\n  { }\n\n  // Copy constructor.\n  inline\n  const_point_iterator_(const point_iterator_& other)\n\n    : m_p_value(other.m_p_value)\n  { }\n\n  // Access.\n  inline const_pointer\n  operator->() const\n  {\n    _GLIBCXX_DEBUG_ASSERT(m_p_value != NULL);\n\n    return (m_p_value);\n  }\n\n  // Access.\n  inline const_reference\n  operator*() const\n  {\n    _GLIBCXX_DEBUG_ASSERT(m_p_value != NULL);\n\n    return (*m_p_value);\n  }\n\n  // Compares content to a different iterator object.\n  inline bool\n  operator==(const point_iterator_& other) const\n  {\n    return (m_p_value == other.m_p_value);\n  }\n\n  // Compares content to a different iterator object.\n  inline bool\n  operator==(const const_point_iterator_& other) const\n  {\n    return (m_p_value == other.m_p_value);\n  }\n\n  // Compares content (negatively) to a different iterator object.\n  inline bool\n  operator!=(const point_iterator_& other) const\n  {\n    return (m_p_value != other.m_p_value);\n  }\n\n  // Compares content (negatively) to a different iterator object.\n  inline bool\n  operator!=(const const_point_iterator_& other) const\n  {\n    return (m_p_value != other.m_p_value);\n  }\n\nprotected:\n  const_pointer m_p_value;\n\n  friend class point_iterator_;\n\n  friend class PB_DS_CLASS_C_DEC;\n};\n\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/detail/unordered_iterator/iterator.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file iterator.hpp\n * Contains an iterator_ class used for ranging over the elements of the\n *    table.\n */\n\n// Range-type iterator.\nclass iterator_ : \n  public const_iterator_\n\n{\n\npublic:\n\n  // Category.\n  typedef std::forward_iterator_tag iterator_category;\n\n  // Difference type.\n  typedef typename Allocator::difference_type difference_type;\n\n  // Iterator's value type.\n  typedef value_type_ value_type;\n\n  // Iterator's pointer type.\n  typedef pointer_ pointer;\n\n  // Iterator's const pointer type.\n  typedef const_pointer_ const_pointer;\n\n  // Iterator's reference type.\n  typedef reference_ reference;\n\n  // Iterator's const reference type.\n  typedef const_reference_ const_reference;\n\npublic:\n\n  // Default constructor.\n  inline\n  iterator_()\n\n    : const_iterator_(NULL, PB_DS_GEN_POS(), NULL)\n  { }\n\n  // Conversion to a point-type iterator.\n  inline\n  operator point_iterator_()\n  {\n    return (point_iterator_(\n\t\t\t    const_cast<pointer>(const_iterator_::m_p_value)));\n  }\n\n  // Conversion to a point-type iterator.\n  inline\n  operator const point_iterator_() const\n  {\n    return (point_iterator_(\n\t\t\t    const_cast<pointer>(const_iterator_::m_p_value)));\n  }\n\n  // Access.\n  inline pointer\n  operator->() const\n  {\n    _GLIBCXX_DEBUG_ASSERT(base_type::m_p_value != NULL);\n\n    return (const_cast<pointer>(base_type::m_p_value));\n  }\n\n  // Access.\n  inline reference\n  operator*() const\n  {\n    _GLIBCXX_DEBUG_ASSERT(base_type::m_p_value != NULL);\n\n    return (const_cast<reference>(*base_type::m_p_value));\n  }\n\n  // Increments.\n  inline iterator_& \n  operator++()\n  {\n    base_type::m_p_tbl->inc_it_state(base_type::m_p_value, base_type::m_pos);\n\n    return (*this);\n  }\n\n  // Increments.\n  inline iterator_\n  operator++(int)\n  {\n    iterator_ ret =* this;\n\n    base_type::m_p_tbl->inc_it_state(base_type::m_p_value, base_type::m_pos);\n\n    return (ret);\n  }\n\nprotected:\n  typedef const_iterator_ base_type;\n\nprotected:\n\n  /**\n   *  Constructor used by the table to initiate the generalized\n   *      pointer and position (e.g., this is called from within a find()\n   *      of a table.\n   * */\n  inline\n  iterator_(pointer p_value, PB_DS_GEN_POS pos, PB_DS_CLASS_C_DEC* p_tbl) : const_iterator_(p_value, pos, p_tbl)\n  { }\n\n  friend class PB_DS_CLASS_C_DEC;\n};\n\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/detail/unordered_iterator/point_iterator.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file point_iterator.hpp\n * Contains an iterator class returned by the tables' find and insert\n *     methods.\n */\n\n// Find type iterator.\nclass point_iterator_\n{\n\npublic:\n\n  // Category.\n  typedef trivial_iterator_tag iterator_category;\n\n  // Difference type.\n  typedef trivial_iterator_difference_type difference_type;\n\n  // Iterator's value type.\n  typedef value_type_ value_type;\n\n  // Iterator's pointer type.\n  typedef pointer_ pointer;\n\n  // Iterator's const pointer type.\n  typedef const_pointer_ const_pointer;\n\n  // Iterator's reference type.\n  typedef reference_ reference;\n\n  // Iterator's const reference type.\n  typedef const_reference_ const_reference;\n\npublic:\n\n  // Default constructor.\n  inline\n  point_iterator_()\n\n    : m_p_value(NULL)\n  { }\n\n  // Copy constructor.\n  inline\n  point_iterator_(const point_iterator_& other)\n\n    : m_p_value(other.m_p_value)\n  { }\n\n  // Access.\n  inline pointer\n  operator->() const\n  {\n    _GLIBCXX_DEBUG_ASSERT(m_p_value != NULL);\n\n    return (m_p_value);\n  }\n\n  // Access.\n  inline reference\n  operator*() const\n  {\n    _GLIBCXX_DEBUG_ASSERT(m_p_value != NULL);\n\n    return (*m_p_value);\n  }\n\n  // Compares content to a different iterator object.\n  inline bool\n  operator==(const point_iterator_& other) const\n  {\n    return (m_p_value == other.m_p_value);\n  }\n\n  // Compares content to a different iterator object.\n  inline bool\n  operator==(const const_point_iterator_& other) const\n  {\n    return (m_p_value == other.m_p_value);\n  }\n\n  // Compares content to a different iterator object.\n  inline bool\n  operator!=(const point_iterator_& other) const\n  {\n    return (m_p_value != other.m_p_value);\n  }\n\n  // Compares content (negatively) to a different iterator object.\n  inline bool\n  operator!=(const const_point_iterator_& other) const\n  {\n    return (m_p_value != other.m_p_value);\n  }\n\n  inline\n  point_iterator_(pointer p_value) : m_p_value(p_value)\n  { }\n\nprotected:\n  friend class const_point_iterator_;\n\n  friend class PB_DS_CLASS_C_DEC;\n\nprotected:\n  pointer m_p_value;\n};\n\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/exception.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file exception.hpp\n * Contains exception classes.\n */\n\n#ifndef PB_DS_EXCEPTION_HPP\n#define PB_DS_EXCEPTION_HPP\n\n#include <stdexcept>\n\nnamespace pb_ds\n{\n  // Base class for exceptions.\n  struct container_error : public std::logic_error\n  {\n    container_error() \n    : std::logic_error(__N(\"pb_ds::container_error\")) { }\n  };\n\n  // An entry cannot be inserted into a container object for logical\n  // reasons (not, e.g., if memory is unabvailable, in which case\n  // the allocator's exception will be thrown).\n  struct insert_error : public container_error { };\n\n  // A join cannot be performed logical reasons (i.e., the ranges of\n  // the two container objects being joined overlaps.\n  struct join_error : public container_error { };\n\n  // A container cannot be resized.\n  struct resize_error : public container_error { };\n\n#if __EXCEPTIONS\n  void\n  __throw_container_error(void)\n  { throw container_error(); }\n\n  void\n  __throw_insert_error(void)\n  { throw insert_error(); }\n\n  void\n  __throw_join_error(void)\n  { throw join_error(); }\n\n  void\n  __throw_resize_error(void)\n  { throw resize_error(); }\n#else\n  void\n  __throw_container_error(void)\n  { std::abort(); }\n\n  void\n  __throw_insert_error(void)\n  { std::abort(); }\n\n  void\n  __throw_join_error(void)\n  { std::abort(); }\n\n  void\n  __throw_resize_error(void)\n  { std::abort(); }\n#endif\n} // namespace pb_ds\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/hash_policy.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file hash_policy.hpp\n * Contains hash-related policies.\n */\n\n#ifndef PB_DS_HASH_POLICY_HPP\n#define PB_DS_HASH_POLICY_HPP\n\n#include <algorithm>\n#include <vector>\n#include <cmath>\n#include <ext/pb_ds/exception.hpp>\n#include <ext/pb_ds/detail/type_utils.hpp>\n#include <ext/pb_ds/detail/hash_fn/mask_based_range_hashing.hpp>\n#include <ext/pb_ds/detail/hash_fn/mod_based_range_hashing.hpp>\n#include <ext/pb_ds/detail/resize_policy/hash_load_check_resize_trigger_size_base.hpp>\n\nnamespace pb_ds\n{\n  // A null hash function, indicating that the combining hash function\n  // is actually a ranged hash function.\n  struct null_hash_fn\n  { };\n\n  // A null probe function, indicating that the combining probe\n  // function is actually a ranged probe function.\n  struct null_probe_fn\n  { };\n\n#define PB_DS_CLASS_T_DEC template<typename Size_Type>\n#define PB_DS_CLASS_C_DEC linear_probe_fn<Size_Type>\n\n  // A probe sequence policy using fixed increments.\n  template<typename Size_Type = size_t>\n  class linear_probe_fn\n  {\n  public:\n    typedef Size_Type size_type;\n\n    void\n    swap(PB_DS_CLASS_C_DEC& other);\n\n  protected:\n    // Returns the i-th offset from the hash value.\n    inline size_type\n    operator()(size_type i) const;\n  };\n\n#include <ext/pb_ds/detail/hash_fn/linear_probe_fn_imp.hpp>\n\n#undef PB_DS_CLASS_T_DEC\n#undef PB_DS_CLASS_C_DEC\n\n#define PB_DS_CLASS_T_DEC template<typename Size_Type>\n#define PB_DS_CLASS_C_DEC quadratic_probe_fn<Size_Type>\n\n  // A probe sequence policy using square increments.\n  template<typename Size_Type = size_t>\n  class quadratic_probe_fn\n  {\n  public:\n    typedef Size_Type size_type;\n\n    void\n    swap(PB_DS_CLASS_C_DEC& other);\n\n  protected:\n    // Returns the i-th offset from the hash value.\n    inline size_type\n    operator()(size_type i) const;\n  };\n\n#include <ext/pb_ds/detail/hash_fn/quadratic_probe_fn_imp.hpp>\n\n#undef PB_DS_CLASS_T_DEC\n#undef PB_DS_CLASS_C_DEC\n\n#define PB_DS_CLASS_T_DEC template<typename Size_Type>\n#define PB_DS_CLASS_C_DEC direct_mask_range_hashing<Size_Type>\n\n  // A mask range-hashing class (uses a bit-mask).\n  template<typename Size_Type = size_t>\n  class direct_mask_range_hashing \n  : public detail::mask_based_range_hashing<Size_Type>\n  {\n  private:\n    typedef detail::mask_based_range_hashing<Size_Type> mask_based_base;\n\n  public:\n    typedef Size_Type size_type;\n\n    void\n    swap(PB_DS_CLASS_C_DEC& other);\n\n  protected:\n    void\n    notify_resized(size_type size);\n\n    // Transforms the __hash value hash into a ranged-hash value\n    // (using a bit-mask).\n    inline size_type\n    operator()(size_type hash) const;\n  };\n\n#include <ext/pb_ds/detail/hash_fn/direct_mask_range_hashing_imp.hpp>\n\n#undef PB_DS_CLASS_T_DEC\n#undef PB_DS_CLASS_C_DEC\n\n#define PB_DS_CLASS_T_DEC template<typename Size_Type>\n#define PB_DS_CLASS_C_DEC direct_mod_range_hashing<Size_Type>\n\n  // A mod range-hashing class (uses the modulo function).\n  template<typename Size_Type = size_t>\n  class direct_mod_range_hashing \n  : public detail::mod_based_range_hashing<Size_Type>\n  {\n  public:\n    typedef Size_Type size_type;\n      \n    void\n    swap(PB_DS_CLASS_C_DEC& other);\n\n  protected:\n    void\n    notify_resized(size_type size);\n      \n    // Transforms the __hash value hash into a ranged-hash value\n    // (using a modulo operation).\n    inline size_type\n    operator()(size_type hash) const;\n      \n  private:\n    typedef detail::mod_based_range_hashing<size_type> mod_based_base;\n  };\n\n#include <ext/pb_ds/detail/hash_fn/direct_mod_range_hashing_imp.hpp>\n\n#undef PB_DS_CLASS_T_DEC\n#undef PB_DS_CLASS_C_DEC\n\n#define PB_DS_CLASS_T_DEC template<bool External_Load_Access, typename Size_Type>\n#define PB_DS_CLASS_C_DEC hash_load_check_resize_trigger<External_Load_Access, Size_Type>\n#define PB_DS_SIZE_BASE_C_DEC detail::hash_load_check_resize_trigger_size_base<Size_Type, External_Load_Access>\n\n  // A resize trigger policy based on a load check. It keeps the\n  // load factor between some load factors load_min and load_max.\n  template<bool External_Load_Access = false, typename Size_Type = size_t>\n  class hash_load_check_resize_trigger : private PB_DS_SIZE_BASE_C_DEC\n  {\n  public:\n    typedef Size_Type size_type;\n\n    enum\n      {\n\texternal_load_access = External_Load_Access\n      };\n\n    // Default constructor, or constructor taking load_min and\n    // load_max load factors between which this policy will keep the\n    // actual load.\n    hash_load_check_resize_trigger(float load_min = 0.125,\n\t\t\t\t   float load_max = 0.5);\n\n    void\n    swap(hash_load_check_resize_trigger& other);\n\n    virtual\n    ~hash_load_check_resize_trigger();\n\n    // Returns a pair of the minimal and maximal loads, respectively.\n    inline std::pair<float, float>\n    get_loads() const;\n\n    // Sets the loads through a pair of the minimal and maximal\n    // loads, respectively.\n    void\n    set_loads(std::pair<float, float> load_pair);\n\n  protected:\n    inline void\n    notify_insert_search_start();\n\n    inline void\n    notify_insert_search_collision();\n\n    inline void\n    notify_insert_search_end();\n\n    inline void\n    notify_find_search_start();\n\n    inline void\n    notify_find_search_collision();\n\n    inline void\n    notify_find_search_end();\n\n    inline void\n    notify_erase_search_start();\n\n    inline void\n    notify_erase_search_collision();\n\n    inline void\n    notify_erase_search_end();\n\n    // Notifies an element was inserted. The total number of entries\n    // in the table is num_entries.\n    inline void\n    notify_inserted(size_type num_entries);\n\n    inline void\n    notify_erased(size_type num_entries);\n\n    // Notifies the table was cleared.\n    void\n    notify_cleared();\n\n    // Notifies the table was resized as a result of this object's\n    // signifying that a resize is needed.\n    void\n    notify_resized(size_type new_size);\n\n    void\n    notify_externally_resized(size_type new_size);\n\n    inline bool\n    is_resize_needed() const;\n\n    inline bool\n    is_grow_needed(size_type size, size_type num_entries) const;\n\n  private:\n    virtual void\n    do_resize(size_type new_size);\n\n    typedef PB_DS_SIZE_BASE_C_DEC size_base;\n\n#ifdef _GLIBCXX_DEBUG\n    void\n    assert_valid() const;\n#endif \n\n    float \tm_load_min;\n    float \tm_load_max;\n    size_type \tm_next_shrink_size;\n    size_type \tm_next_grow_size;\n    bool \tm_resize_needed;\n  };\n\n#include <ext/pb_ds/detail/resize_policy/hash_load_check_resize_trigger_imp.hpp>\n\n#undef PB_DS_CLASS_T_DEC\n#undef PB_DS_CLASS_C_DEC\n#undef PB_DS_SIZE_BASE_C_DEC\n\n#define PB_DS_CLASS_T_DEC template<bool External_Load_Access, typename Size_Type>\n#define PB_DS_CLASS_C_DEC cc_hash_max_collision_check_resize_trigger<External_Load_Access, Size_Type>\n\n  // A resize trigger policy based on collision checks. It keeps the\n  // simulated load factor lower than some given load factor.\n  template<bool External_Load_Access = false, typename Size_Type = size_t>\n  class cc_hash_max_collision_check_resize_trigger\n  {\n  public:\n    typedef Size_Type size_type;\n\n    enum\n      {\n\texternal_load_access = External_Load_Access\n      };\n\n    // Default constructor, or constructor taking load, a __load\n    // factor which it will attempt to maintain.\n    cc_hash_max_collision_check_resize_trigger(float load = 0.5);\n\n    void\n    swap(PB_DS_CLASS_C_DEC& other);\n\n    // Returns the current load.\n    inline float\n    get_load() const;\n\n    // Sets the load; does not resize the container.\n    void\n    set_load(float load);\n\n  protected:\n    inline void\n    notify_insert_search_start();\n\n    inline void\n    notify_insert_search_collision();\n\n    inline void\n    notify_insert_search_end();\n\n    inline void\n    notify_find_search_start();\n\n    inline void\n    notify_find_search_collision();\n\n    inline void\n    notify_find_search_end();\n\n    inline void\n    notify_erase_search_start();\n\n    inline void\n    notify_erase_search_collision();\n\n    inline void\n    notify_erase_search_end();\n\n    inline void\n    notify_inserted(size_type num_entries);\n\n    inline void\n    notify_erased(size_type num_entries);\n\n    void\n    notify_cleared();\n\n    // Notifies the table was resized as a result of this object's\n    // signifying that a resize is needed.\n    void\n    notify_resized(size_type new_size);\n\n    void\n    notify_externally_resized(size_type new_size);\n\n    inline bool\n    is_resize_needed() const;\n\n    inline bool\n    is_grow_needed(size_type size, size_type num_entries) const;\n\n  private:\n    void\n    calc_max_num_coll();\n\n    inline void\n    calc_resize_needed();\n\n    float \tm_load;\n    size_type \tm_size;\n    size_type \tm_num_col;\n    size_type \tm_max_col;\n    bool \tm_resize_needed;\n  };\n\n#include <ext/pb_ds/detail/resize_policy/cc_hash_max_collision_check_resize_trigger_imp.hpp>\n\n#undef PB_DS_CLASS_T_DEC\n#undef PB_DS_CLASS_C_DEC\n\n#define PB_DS_CLASS_T_DEC template<typename Size_Type>\n#define PB_DS_CLASS_C_DEC hash_exponential_size_policy<Size_Type>\n\n  // A size policy whose sequence of sizes form an exponential\n  // sequence (typically powers of 2.\n  template<typename Size_Type = size_t>\n  class hash_exponential_size_policy\n  {\n  public:\n    typedef Size_Type size_type;\n\n    // Default constructor, or onstructor taking a start_size, or\n    // constructor taking a start size and grow_factor. The policy\n    // will use the sequence of sizes start_size, start_size*\n    // grow_factor, start_size* grow_factor^2, ...\n    hash_exponential_size_policy(size_type start_size = 8,\n\t\t\t\t size_type grow_factor = 2);\n\n    void\n    swap(PB_DS_CLASS_C_DEC& other);\n\n  protected:\n    size_type\n    get_nearest_larger_size(size_type size) const;\n\n    size_type\n    get_nearest_smaller_size(size_type size) const;\n\n  private:\n    size_type m_start_size;\n    size_type m_grow_factor;\n  };\n\n#include <ext/pb_ds/detail/resize_policy/hash_exponential_size_policy_imp.hpp>\n\n#undef PB_DS_CLASS_T_DEC\n#undef PB_DS_CLASS_C_DEC\n\n#define PB_DS_CLASS_T_DEC\n#define PB_DS_CLASS_C_DEC hash_prime_size_policy\n\n  // A size policy whose sequence of sizes form a nearly-exponential\n  // sequence of primes.\n  class hash_prime_size_policy\n  {\n  public:\n    // Size type.\n    typedef size_t size_type;\n\n    // Default constructor, or onstructor taking a start_size The\n    // policy will use the sequence of sizes approximately\n    // start_size, start_size* 2, start_size* 2^2, ...\n    hash_prime_size_policy(size_type start_size = 8);\n\n    inline void\n    swap(PB_DS_CLASS_C_DEC& other);\n\n  protected:\n    size_type\n    get_nearest_larger_size(size_type size) const;\n\n    size_type\n    get_nearest_smaller_size(size_type size) const;\n\n  private:\n    size_type m_start_size;\n  };\n\n#include <ext/pb_ds/detail/resize_policy/hash_prime_size_policy_imp.hpp>\n\n#undef PB_DS_CLASS_T_DEC\n#undef PB_DS_CLASS_C_DEC\n\n#define PB_DS_CLASS_T_DEC template<typename Size_Policy, typename Trigger_Policy, bool External_Size_Access, typename Size_Type>\n\n#define PB_DS_CLASS_C_DEC hash_standard_resize_policy<Size_Policy, Trigger_Policy, External_Size_Access, Size_Type>\n\n  // A resize policy which delegates operations to size and trigger policies.\n  template<typename Size_Policy = hash_exponential_size_policy<>,\n\t   typename Trigger_Policy = hash_load_check_resize_trigger<>,\n\t   bool External_Size_Access = false,\n\t   typename Size_Type = size_t>\n  class hash_standard_resize_policy \n  : public Size_Policy, public Trigger_Policy\n  {\n  public:\n    typedef Size_Type \t\tsize_type;\n    typedef Trigger_Policy \ttrigger_policy;\n    typedef Size_Policy \tsize_policy;\n\n    enum\n      {\n\texternal_size_access = External_Size_Access\n      };\n\n    // Default constructor.\n    hash_standard_resize_policy();\n\n    // constructor taking some policies r_size_policy will be copied\n    // by the Size_Policy object of this object.\n    hash_standard_resize_policy(const Size_Policy& r_size_policy);\n\n    // constructor taking some policies. r_size_policy will be\n    // copied by the Size_Policy object of this\n    // object. r_trigger_policy will be copied by the Trigger_Policy\n    // object of this object.\n    hash_standard_resize_policy(const Size_Policy& r_size_policy, \n\t\t\t\tconst Trigger_Policy& r_trigger_policy);\n\n    virtual\n    ~hash_standard_resize_policy();\n\n    inline void\n    swap(PB_DS_CLASS_C_DEC& other);\n\n    // Access to the Size_Policy object used.\n    Size_Policy& \n    get_size_policy();\n\n    // Const access to the Size_Policy object used.\n    const Size_Policy& \n    get_size_policy() const;\n\n    // Access to the Trigger_Policy object used.\n    Trigger_Policy& \n    get_trigger_policy();\n\n    // Access to the Trigger_Policy object used.\n    const Trigger_Policy& \n    get_trigger_policy() const;\n\n    // Returns the actual size of the container.\n    inline size_type\n    get_actual_size() const;\n\n    // Resizes the container to suggested_new_size, a suggested size\n    // (the actual size will be determined by the Size_Policy\n    // object).\n    void\n    resize(size_type suggested_new_size);\n\n  protected:\n    inline void\n    notify_insert_search_start();\n\n    inline void\n    notify_insert_search_collision();\n\n    inline void\n    notify_insert_search_end();\n\n    inline void\n    notify_find_search_start();\n\n    inline void\n    notify_find_search_collision();\n\n    inline void\n    notify_find_search_end();\n\n    inline void\n    notify_erase_search_start();\n\n    inline void\n    notify_erase_search_collision();\n\n    inline void\n    notify_erase_search_end();\n\n    inline void\n    notify_inserted(size_type num_e);\n\n    inline void\n    notify_erased(size_type num_e);\n\n    void\n    notify_cleared();\n\n    void\n    notify_resized(size_type new_size);\n\n    inline bool\n    is_resize_needed() const;\n\n    // Queries what the new size should be, when the container is\n    // resized naturally. The current __size of the container is\n    // size, and the number of used entries within the container is\n    // num_used_e.\n    size_type\n    get_new_size(size_type size, size_type num_used_e) const;\n\n  private:\n    // Resizes to new_size.\n    virtual void\n    do_resize(size_type new_size);\n\n    typedef Trigger_Policy trigger_policy_base;\n\n    typedef Size_Policy size_policy_base;\n\n    size_type m_size;\n  };\n\n#include <ext/pb_ds/detail/resize_policy/hash_standard_resize_policy_imp.hpp>\n\n#undef PB_DS_CLASS_T_DEC\n#undef PB_DS_CLASS_C_DEC\n\n} // namespace pb_ds\n\n#endif \n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/list_update_policy.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file list_update_policy.hpp\n * Contains policies for list update containers.\n */\n\n#ifndef PB_DS_LU_POLICY_HPP\n#define PB_DS_LU_POLICY_HPP\n\n#include <ext/pb_ds/detail/list_update_policy/counter_lu_metadata.hpp>\n\nnamespace pb_ds\n{\n  // A null type that means that each link in a list-based container\n  // does not actually need metadata.\n  struct null_lu_metadata\n  { };\n\n#define PB_DS_CLASS_T_DEC template<typename Allocator>\n#define PB_DS_CLASS_C_DEC move_to_front_lu_policy<Allocator>\n\n  // A list-update policy that unconditionally moves elements to the\n  // front of the list.\n  template<typename Allocator = std::allocator<char> >\n  class move_to_front_lu_policy\n  {\n  public:\n    typedef Allocator allocator;\n      \n    // Metadata on which this functor operates.\n    typedef null_lu_metadata metadata_type;\n      \n    // Reference to metadata on which this functor operates.\n    typedef typename allocator::template rebind<metadata_type>::other metadata_rebind;\n    typedef typename metadata_rebind::reference metadata_reference;\n      \n    // Creates a metadata object.\n    metadata_type\n    operator()() const;\n      \n    // Decides whether a metadata object should be moved to the front\n    // of the list.\n    inline bool\n    operator()(metadata_reference r_metadata) const;\n      \n  private:\n    static null_lu_metadata s_metadata;\n  };\n  \n#include <ext/pb_ds/detail/list_update_policy/mtf_lu_policy_imp.hpp>\n\n#undef PB_DS_CLASS_T_DEC\n#undef PB_DS_CLASS_C_DEC\n\n#define PB_DS_CLASS_T_DEC template<size_t Max_Count, class Allocator>\n#define PB_DS_CLASS_C_DEC counter_lu_policy<Max_Count, Allocator>\n\n  // A list-update policy that moves elements to the front of the list\n  // based on the counter algorithm.\n  template<size_t Max_Count = 5, typename Allocator = std::allocator<char> >\n  class counter_lu_policy \n  : private detail::counter_lu_policy_base<typename Allocator::size_type>\n  {\n  public:\n    typedef Allocator allocator;\n\n    enum\n      {\n\tmax_count = Max_Count\n      };\n\n    typedef typename allocator::size_type size_type;\n\n    // Metadata on which this functor operates.\n    typedef detail::counter_lu_metadata<size_type> metadata_type;\n\n    // Reference to metadata on which this functor operates.\n    typedef typename Allocator::template rebind<metadata_type>::other metadata_rebind;\n    typedef typename metadata_rebind::reference metadata_reference;\n\n    // Creates a metadata object.\n    metadata_type\n    operator()() const;\n\n    // Decides whether a metadata object should be moved to the front\n    // of the list.\n    bool\n    operator()(metadata_reference r_metadata) const;\n\n  private:\n    typedef detail::counter_lu_policy_base<typename Allocator::size_type> base_type;\n  };\n\n#include <ext/pb_ds/detail/list_update_policy/counter_lu_policy_imp.hpp>\n\n#undef PB_DS_CLASS_T_DEC\n#undef PB_DS_CLASS_C_DEC\n\n} // namespace pb_ds\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/priority_queue.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file priority_queue.hpp\n * Contains priority_queues.\n */\n\n#ifndef PB_DS_PRIORITY_QUEUE_HPP\n#define PB_DS_PRIORITY_QUEUE_HPP\n\n#include <ext/pb_ds/tag_and_trait.hpp>\n#include <ext/pb_ds/detail/priority_queue_base_dispatch.hpp>\n#include <ext/pb_ds/detail/standard_policies.hpp>\n\nnamespace pb_ds\n{\n  // A priority queue.\n  template<typename Value_Type, \n\t   typename Cmp_Fn = std::less<Value_Type>,\n\t   typename Tag = pairing_heap_tag,\n\t   typename Allocator = std::allocator<char> >\n  class priority_queue \n    : public detail::priority_queue_base_dispatch<Value_Type,Cmp_Fn,Tag,Allocator>::type\n  {\n  private:\n    typedef typename detail::priority_queue_base_dispatch<Value_Type,Cmp_Fn,Tag,Allocator>::type base_type;\n\n  public:\n    typedef Value_Type \t\t\t\t\tvalue_type;\n    typedef Cmp_Fn \t\t\t\t\tcmp_fn;\n    typedef Tag \t\t\t\t\tcontainer_category;\n    typedef Allocator \t\t\t\t\tallocator;\n    typedef typename allocator::size_type \t\tsize_type;\n    typedef typename allocator::difference_type \tdifference_type;\n\n    typedef typename allocator::template rebind<value_type>::other value_rebind;\n    typedef typename value_rebind::reference \t\treference;\n    typedef typename value_rebind::const_reference \tconst_reference;\n    typedef typename value_rebind::pointer \t   \tpointer;\n    typedef typename value_rebind::const_pointer \tconst_pointer;\n\n    typedef typename base_type::const_point_iterator const_point_iterator;\n    typedef typename base_type::point_iterator \t\tpoint_iterator;\n    typedef typename base_type::const_iterator \t\tconst_iterator;\n    typedef typename base_type::iterator \t\titerator;\n\n    priority_queue() { }\n\n    // Constructor taking some policy objects. r_cmp_fn will be copied\n    // by the Cmp_Fn object of the container object.\n    priority_queue(const cmp_fn& r_cmp_fn) : base_type(r_cmp_fn) { }\n\n    // Constructor taking __iterators to a range of value_types. The\n    // value_types between first_it and last_it will be inserted into\n    // the container object.\n    template<typename It>\n    priority_queue(It first_it, It last_it)\n    { base_type::copy_from_range(first_it, last_it); }\n\n    // Constructor taking __iterators to a range of value_types and\n    // some policy objects The value_types between first_it and\n    // last_it will be inserted into the container object. r_cmp_fn\n    // will be copied by the cmp_fn object of the container object.\n    template<typename It>\n    priority_queue(It first_it, It last_it, const cmp_fn& r_cmp_fn)\n    : base_type(r_cmp_fn)\n    { base_type::copy_from_range(first_it, last_it); }\n\n    priority_queue(const priority_queue& other)\n    : base_type((const base_type& )other) { }\n\n    virtual\n    ~priority_queue() { }\n\n    priority_queue& \n    operator=(const priority_queue& other)\n    {\n      if (this !=& other)\n\t{\n\t  priority_queue tmp(other);\n\t  swap(tmp);\n\t}\n      return *this;\n    }\n\n    void\n    swap(priority_queue& other)\n    { base_type::swap(other); }\n  };\n} // namespace pb_ds\n\n#endif \n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/tag_and_trait.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file tag_and_trait.hpp\n * Contains tags and traits, e.g., ones describing underlying\n *    data structures.\n */\n\n#ifndef PB_DS_TAG_AND_TRAIT_HPP\n#define PB_DS_TAG_AND_TRAIT_HPP\n\n#include <ext/pb_ds/detail/type_utils.hpp>\n\nnamespace pb_ds\n{\n  // A trivial iterator tag. Signifies that the iterators has none of\n  // the STL's movement abilities.\n  struct trivial_iterator_tag\n  { };\n\n  // Prohibit moving trivial iterators.\n  typedef void trivial_iterator_difference_type;\n\n\n  // Signifies a basic invalidation guarantee that any iterator,\n  // pointer, or reference to a container object's mapped value type\n  // is valid as long as the container is not modified.\n  struct basic_invalidation_guarantee\n  { };\n\n  // Signifies an invalidation guarantee that includes all those of\n  // its base, and additionally, that any point-type iterator,\n  // pointer, or reference to a container object's mapped value type\n  // is valid as long as its corresponding entry has not be erased,\n  // regardless of modifications to the container object.\n  struct point_invalidation_guarantee : public basic_invalidation_guarantee\n  { };\n\n  // Signifies an invalidation guarantee that includes all those of\n  // its base, and additionally, that any range-type iterator\n  // (including the returns of begin() and end()) is in the correct\n  // relative positions to other range-type iterators as long as its\n  // corresponding entry has not be erased, regardless of\n  // modifications to the container object.\n  struct range_invalidation_guarantee : public point_invalidation_guarantee\n  { };\n\n\n  // A mapped-policy indicating that an associative container is a set.\n  // XXX should this be a trait of the form is_set<T> ??\n  struct null_mapped_type { };\n\n\n  // Base data structure tag.\n  struct container_tag\n  { };\n\n  // Basic associative-container.\n  struct associative_container_tag : public container_tag { };\n\n  // Basic hash.\n  struct basic_hash_tag : public associative_container_tag { };\n\n  // Collision-chaining hash.\n  struct cc_hash_tag : public basic_hash_tag { };\n\n  // General-probing hash.\n  struct gp_hash_tag : public basic_hash_tag { };\n\n  // Basic tree.\n  struct basic_tree_tag : public associative_container_tag { };\n\n  // tree.\n  struct tree_tag : public basic_tree_tag { };\n\n  // Red-black tree.\n  struct rb_tree_tag : public tree_tag { };\n\n  // Splay tree.\n  struct splay_tree_tag : public tree_tag { };\n\n  // Ordered-vector tree.\n  struct ov_tree_tag : public tree_tag { };\n\n  // trie.\n  struct trie_tag : public basic_tree_tag { };\n\n  // PATRICIA trie.\n  struct pat_trie_tag : public trie_tag { };\n\n  // List-update.\n  struct list_update_tag : public associative_container_tag { };\n\n  // Basic priority-queue.\n  struct priority_queue_tag : public container_tag { };\n\n  // Pairing-heap.\n  struct pairing_heap_tag : public priority_queue_tag { };\n\n  // Binomial-heap.\n  struct binomial_heap_tag : public priority_queue_tag { };\n\n  // Redundant-counter binomial-heap.\n  struct rc_binomial_heap_tag : public priority_queue_tag { };\n\n  // Binary-heap (array-based).\n  struct binary_heap_tag : public priority_queue_tag { };\n\n  // Thin heap.\n  struct thin_heap_tag : public priority_queue_tag { };\n\n\n  template<typename Tag>\n  struct container_traits_base;\n\n  template<>\n  struct container_traits_base<cc_hash_tag>\n  {\n    typedef cc_hash_tag container_category;\n    typedef point_invalidation_guarantee invalidation_guarantee;\n\n    enum\n      {\n        order_preserving = false,\n        erase_can_throw = false,\n\tsplit_join_can_throw = false,\n\treverse_iteration = false\n      };\n  };\n\n  template<>\n  struct container_traits_base<gp_hash_tag>\n  {\n    typedef gp_hash_tag container_category;\n    typedef basic_invalidation_guarantee invalidation_guarantee;\n\n    enum\n      {\n        order_preserving = false,\n\terase_can_throw = false,\n\tsplit_join_can_throw = false,\n\treverse_iteration = false\n      };\n  };\n\n  template<>\n  struct container_traits_base<rb_tree_tag>\n  {\n    typedef rb_tree_tag container_category;\n    typedef range_invalidation_guarantee invalidation_guarantee;\n\n    enum\n      {\n        order_preserving = true,\n        erase_can_throw = false,\n\tsplit_join_can_throw = false,\n        reverse_iteration = true\n      };\n  };\n\n  template<>\n  struct container_traits_base<splay_tree_tag>\n  {\n    typedef splay_tree_tag container_category;\n    typedef range_invalidation_guarantee invalidation_guarantee;\n\n    enum\n      {\n        order_preserving = true,\n        erase_can_throw = false,\n        split_join_can_throw = false,\n        reverse_iteration = true\n      };\n  };\n\n  template<>\n  struct container_traits_base<ov_tree_tag>\n  {\n    typedef ov_tree_tag container_category;\n    typedef basic_invalidation_guarantee invalidation_guarantee;\n\n    enum\n      {\n        order_preserving = true,\n        erase_can_throw = true,\n        split_join_can_throw = true,\n        reverse_iteration = false\n      };\n  };\n\n  template<>\n  struct container_traits_base<pat_trie_tag>\n  {\n    typedef pat_trie_tag container_category;\n    typedef range_invalidation_guarantee invalidation_guarantee;\n\n    enum\n      {\n        order_preserving = true,\n        erase_can_throw = false,\n        split_join_can_throw = true,\n        reverse_iteration = true\n      };\n  };\n\n  template<>\n  struct container_traits_base<list_update_tag>\n  {\n    typedef list_update_tag container_category;\n    typedef point_invalidation_guarantee invalidation_guarantee;\n\n    enum\n      {\n        order_preserving = false,\n        erase_can_throw = false,\n\tsplit_join_can_throw = false,\n        reverse_iteration = false\n      };\n  };\n\n\n  template<>\n  struct container_traits_base<pairing_heap_tag>\n  {\n    typedef pairing_heap_tag container_category;\n    typedef point_invalidation_guarantee invalidation_guarantee;\n\n    enum\n      {\n        order_preserving = false,\n        erase_can_throw = false,\n\tsplit_join_can_throw = false,\n        reverse_iteration = false\n      };\n  };\n\n  template<>\n  struct container_traits_base<thin_heap_tag>\n  {\n    typedef thin_heap_tag container_category;\n    typedef point_invalidation_guarantee invalidation_guarantee;\n\n    enum\n      {\n        order_preserving = false,\n        erase_can_throw = false,\n\tsplit_join_can_throw = false,\n        reverse_iteration = false\n      };\n  };\n\n  template<>\n  struct container_traits_base<binomial_heap_tag>\n  {\n    typedef binomial_heap_tag container_category;\n    typedef point_invalidation_guarantee invalidation_guarantee;\n\n    enum\n      {\n        order_preserving = false,\n        erase_can_throw = false,\n\tsplit_join_can_throw = false,\n        reverse_iteration = false\n      };\n  };\n\n  template<>\n  struct container_traits_base<rc_binomial_heap_tag>\n  {\n    typedef rc_binomial_heap_tag container_category;\n    typedef point_invalidation_guarantee invalidation_guarantee;\n\n    enum\n      {\n        order_preserving = false,\n        erase_can_throw = false,\n\tsplit_join_can_throw = false,\n        reverse_iteration = false\n      };\n  };\n\n  template<>\n  struct container_traits_base<binary_heap_tag>\n  {\n    typedef binary_heap_tag container_category;\n    typedef basic_invalidation_guarantee invalidation_guarantee;\n\n    enum\n      {\n        order_preserving = false,\n        erase_can_throw = false,\n\tsplit_join_can_throw = true,\n        reverse_iteration = false\n      };\n  };\n\n  \n  // See Matt Austern for the name, S. Meyers MEFC++ #2, others.\n  template<typename Cntnr>\n  struct container_traits \n  : public container_traits_base<typename Cntnr::container_category>\n  {\n    typedef Cntnr container_type;\n    typedef typename Cntnr::container_category container_category;\n    typedef container_traits_base<container_category> base_type;\n    typedef typename base_type::invalidation_guarantee invalidation_guarantee;\n\n    enum\n      {\n\torder_preserving = base_type::order_preserving,\n\terase_can_throw = base_type::erase_can_throw,\n\tsplit_join_can_throw = base_type::split_join_can_throw,\n\treverse_iteration = base_type::reverse_iteration\n      };\n  };\n} // namespace pb_ds\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/tree_policy.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file tree_policy.hpp\n * Contains tree-related policies.\n */\n\n#ifndef PB_DS_TREE_POLICY_HPP\n#define PB_DS_TREE_POLICY_HPP\n\n#include <iterator>\n#include <ext/pb_ds/detail/type_utils.hpp>\n#include <ext/pb_ds/detail/basic_tree_policy/basic_tree_policy_base.hpp>\n\nnamespace pb_ds\n{\n  // A null node updator, indicating that no node updates are required.\n  template<typename Const_Node_Iterator,\n\t   typename Node_Iterator,\n\t   typename Cmp_Fn,\n\t   typename Allocator>\n  struct null_tree_node_update\n  { };\n\n#define PB_DS_CLASS_T_DEC \\\n  template<typename Const_Node_Iterator, class Node_Iterator, class Cmp_Fn, class Allocator>\n\n#define PB_DS_CLASS_C_DEC \\\n  tree_order_statistics_node_update<Const_Node_Iterator, Node_Iterator, Cmp_Fn, Allocator>\n\n#define PB_DS_BASE_C_DEC\t\t\t\t\t\t\\\n  detail::basic_tree_policy_base<Const_Node_Iterator, Node_Iterator, Allocator>\n\n  // Functor updating ranks of entrees.\n  template<typename Const_Node_Iterator, typename Node_Iterator, \n\t   typename Cmp_Fn, typename Allocator>\n  class tree_order_statistics_node_update : private PB_DS_BASE_C_DEC\n  {\n  private:\n    typedef PB_DS_BASE_C_DEC base_type;\n\n  public:\n    typedef Cmp_Fn cmp_fn;\n    typedef Allocator allocator;\n    typedef typename allocator::size_type size_type;\n    typedef typename base_type::key_type key_type;\n    typedef typename base_type::const_key_reference const_key_reference;\n\n    typedef size_type metadata_type;\n    typedef Const_Node_Iterator const_node_iterator;\n    typedef Node_Iterator node_iterator;\n    typedef typename const_node_iterator::value_type const_iterator;\n    typedef typename node_iterator::value_type iterator;\n\n    // Finds an entry by __order. Returns a const_iterator to the\n    // entry with the __order order, or a const_iterator to the\n    // container object's end if order is at least the size of the\n    // container object.\n    inline const_iterator\n    find_by_order(size_type order) const;\n\n    // Finds an entry by __order. Returns an iterator to the entry\n    // with the __order order, or an iterator to the container\n    // object's end if order is at least the size of the container\n    // object.\n    inline iterator\n    find_by_order(size_type order);\n\n    // Returns the order of a key within a sequence. For exapmle, if\n    // r_key is the smallest key, this method will return 0; if r_key\n    // is a key between the smallest and next key, this method will\n    // return 1; if r_key is a key larger than the largest key, this\n    // method will return the size of r_c.\n    inline size_type\n    order_of_key(const_key_reference r_key) const;\n\n  private:\n    // Const reference to the container's value-type.\n    typedef typename base_type::const_reference const_reference;\n\n    // Const pointer to the container's value-type.\n    typedef typename base_type::const_pointer const_pointer;\n\n    typedef typename allocator::template rebind<metadata_type>::other metadata_rebind;\n    // Const metadata reference.\n    typedef typename metadata_rebind::const_reference const_metadata_reference;\n\n    // Metadata reference.\n    typedef typename metadata_rebind::reference metadata_reference;\n\n    // Returns the const_node_iterator associated with the tree's root node.\n    virtual const_node_iterator\n    node_begin() const = 0;\n\n    // Returns the node_iterator associated with the tree's root node.\n    virtual node_iterator\n    node_begin() = 0;\n\n    // Returns the const_node_iterator associated with a just-after leaf node.\n    virtual const_node_iterator\n    node_end() const = 0;\n\n    // Returns the node_iterator associated with a just-after leaf node.\n    virtual node_iterator\n    node_end() = 0;\n\n    // Access to the cmp_fn object.\n    virtual cmp_fn& \n    get_cmp_fn() = 0;\n\n  protected:\n    // Updates the rank of a node through a node_iterator node_it;\n    // end_nd_it is the end node iterator.\n    inline void\n    operator()(node_iterator node_it, const_node_iterator end_nd_it) const;\n\n    virtual\n    ~tree_order_statistics_node_update();\n  };\n\n#include <ext/pb_ds/detail/tree_policy/order_statistics_imp.hpp>\n\n#undef PB_DS_CLASS_T_DEC\n#undef PB_DS_CLASS_C_DEC\n#undef PB_DS_BASE_C_DEC\n\n} // namespace pb_ds\n\n#endif \n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pb_ds/trie_policy.hpp",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/**\n * @file trie_policy.hpp\n * Contains trie-related policies.\n */\n\n#ifndef PB_DS_TRIE_POLICY_HPP\n#define PB_DS_TRIE_POLICY_HPP\n\n#include <string>\n#include <ext/pb_ds/detail/type_utils.hpp>\n#include <ext/pb_ds/detail/trie_policy/trie_policy_base.hpp>\n\nnamespace pb_ds\n{\n  // A null node updator, indicating that no node updates are required.\n  template<typename Const_Node_Iterator,\n\t   typename Node_Iterator,\n\t   typename E_Access_Traits,\n\t   typename Allocator>\n  struct null_trie_node_update\n  { };\n\n#define PB_DS_STATIC_ASSERT(UNIQUE, E)\t\t\t\t\t\\\n  typedef detail::static_assert_dumclass<sizeof(detail::static_assert<bool(E)>)> UNIQUE##_static_assert_type\n\n#define PB_DS_CLASS_T_DEC\t\t\t\t\t\t\\\n  template<typename String, typename String::value_type Min_E_Val, typename String::value_type Max_E_Val, bool Reverse, typename Allocator>\n\n#define PB_DS_CLASS_C_DEC\t\t\t\t\t\t\\\n  string_trie_e_access_traits<String, Min_E_Val,Max_E_Val,Reverse,Allocator>\n\n  // Element access traits for string types.\n  template<typename String = std::string,\n\t   typename String::value_type Min_E_Val = detail::__numeric_traits<typename String::value_type>::__min, \n\t   typename String::value_type Max_E_Val = detail::__numeric_traits<typename String::value_type>::__max, \n\t   bool Reverse = false,\n\t   typename Allocator = std::allocator<char> >\n  struct string_trie_e_access_traits\n  {\n  public:\n    typedef typename Allocator::size_type size_type;\n    typedef String key_type;\n    typedef typename Allocator::template rebind<key_type>::other key_rebind;\n    typedef typename key_rebind::const_reference const_key_reference;\n\n    enum\n      {\n\treverse = Reverse\n      };\n\n    // Element const iterator type.\n    typedef typename detail::__conditional_type<Reverse, typename String::const_reverse_iterator, typename String::const_iterator>::__type const_iterator;\n\n    // Element type.\n    typedef typename std::iterator_traits<const_iterator>::value_type e_type;\n\n    enum\n      {\n\tmin_e_val = Min_E_Val,\n\tmax_e_val = Max_E_Val,\n\tmax_size = max_e_val - min_e_val + 1\n      };\n    PB_DS_STATIC_ASSERT(min_max_size, max_size >= 2);\n\n    // Returns a const_iterator to the first element of\n    // const_key_reference agumnet.\n    inline static const_iterator\n    begin(const_key_reference);\n\n    // Returns a const_iterator to the after-last element of\n    // const_key_reference argument.\n    inline static const_iterator\n    end(const_key_reference);\n\n    // Maps an element to a position.\n    inline static size_type\n    e_pos(e_type e);\n\n  private:\n\n    inline static const_iterator\n    begin_imp(const_key_reference, detail::false_type);\n\n    inline static const_iterator\n    begin_imp(const_key_reference, detail::true_type);\n\n    inline static const_iterator\n    end_imp(const_key_reference, detail::false_type);\n\n    inline static const_iterator\n    end_imp(const_key_reference, detail::true_type);\n\n    static detail::integral_constant<int, Reverse> s_rev_ind;\n  };\n\n#include <ext/pb_ds/detail/trie_policy/string_trie_e_access_traits_imp.hpp>\n\n#undef PB_DS_CLASS_T_DEC\n#undef PB_DS_CLASS_C_DEC\n\n#define PB_DS_CLASS_T_DEC \\\n  template<typename Const_Node_Iterator,typename Node_Iterator,class E_Access_Traits, typename Allocator>\n\n#define PB_DS_CLASS_C_DEC \\\n  trie_prefix_search_node_update<Const_Node_Iterator, Node_Iterator, E_Access_Traits,Allocator>\n\n#define PB_DS_BASE_C_DEC \\\n  detail::trie_policy_base<Const_Node_Iterator,Node_Iterator,E_Access_Traits, Allocator>\n\n  // A node updator that allows tries to be searched for the range of\n  // values that match a certain prefix.\n  template<typename Const_Node_Iterator,\n\t   typename Node_Iterator,\n\t   typename E_Access_Traits,\n\t   typename Allocator>\n  class trie_prefix_search_node_update : private PB_DS_BASE_C_DEC\n  {\n  private:\n    typedef PB_DS_BASE_C_DEC base_type;\n\n  public:\n    typedef typename base_type::key_type key_type;\n    typedef typename base_type::const_key_reference const_key_reference;\n\n    // Element access traits.\n    typedef E_Access_Traits e_access_traits;\n\n    // Const element iterator.\n    typedef typename e_access_traits::const_iterator const_e_iterator;\n\n    // Allocator type.\n    typedef Allocator allocator;\n\n    // Size type.\n    typedef typename allocator::size_type size_type;\n    typedef detail::null_node_metadata metadata_type;\n    typedef Const_Node_Iterator const_node_iterator;\n    typedef Node_Iterator node_iterator;\n    typedef typename const_node_iterator::value_type const_iterator;\n    typedef typename node_iterator::value_type iterator;\n\n    // Finds the const iterator range corresponding to all values\n    // whose prefixes match r_key.\n    std::pair<const_iterator, const_iterator>\n    prefix_range(const_key_reference) const;\n\n    // Finds the iterator range corresponding to all values whose\n    // prefixes match r_key.\n    std::pair<iterator, iterator>\n    prefix_range(const_key_reference);\n\n    // Finds the const iterator range corresponding to all values\n    // whose prefixes match [b, e).\n    std::pair<const_iterator, const_iterator>\n    prefix_range(const_e_iterator, const_e_iterator) const;\n\n    // Finds the iterator range corresponding to all values whose\n    // prefixes match [b, e).\n    std::pair<iterator, iterator>\n    prefix_range(const_e_iterator, const_e_iterator);\n\n  protected:\n    // Called to update a node's metadata.\n    inline void\n    operator()(node_iterator node_it, const_node_iterator end_nd_it) const;\n\n  private:\n    // Returns the const iterator associated with the just-after last element.\n    virtual const_iterator\n    end() const = 0;\n\n    // Returns the iterator associated with the just-after last element.\n    virtual iterator\n    end() = 0;\n\n    // Returns the const_node_iterator associated with the trie's root node.\n    virtual const_node_iterator\n    node_begin() const = 0;\n\n    // Returns the node_iterator associated with the trie's root node.\n    virtual node_iterator\n    node_begin() = 0;\n\n    // Returns the const_node_iterator associated with a just-after leaf node.\n    virtual const_node_iterator\n    node_end() const = 0;\n\n    // Returns the node_iterator associated with a just-after leaf node.\n    virtual node_iterator\n    node_end() = 0;\n\n    // Access to the cmp_fn object.\n    virtual const e_access_traits& \n    get_e_access_traits() const = 0;\n\n    node_iterator\n    next_child(node_iterator, const_e_iterator, const_e_iterator, \n\t       node_iterator, const e_access_traits&);\n  };\n\n#include <ext/pb_ds/detail/trie_policy/prefix_search_node_update_imp.hpp>\n\n#undef PB_DS_CLASS_C_DEC\n\n#define PB_DS_CLASS_C_DEC \\\n  trie_order_statistics_node_update<Const_Node_Iterator, Node_Iterator,E_Access_Traits, Allocator>\n\n  // Functor updating ranks of entrees.\n  template<typename Const_Node_Iterator,\n\t   typename Node_Iterator,\n\t   typename E_Access_Traits,\n\t   typename Allocator>\n  class trie_order_statistics_node_update : private PB_DS_BASE_C_DEC\n  {\n  private:\n    typedef PB_DS_BASE_C_DEC base_type;\n\n  public:\n    typedef E_Access_Traits e_access_traits;\n    typedef typename e_access_traits::const_iterator const_e_iterator;\n    typedef Allocator allocator;\n    typedef typename allocator::size_type size_type;\n    typedef typename base_type::key_type key_type;\n    typedef typename base_type::const_key_reference const_key_reference;\n\n    typedef size_type metadata_type;\n    typedef Const_Node_Iterator const_node_iterator;\n    typedef Node_Iterator node_iterator;\n    typedef typename const_node_iterator::value_type const_iterator;\n    typedef typename node_iterator::value_type iterator;\n\n    // Finds an entry by __order. Returns a const_iterator to the\n    // entry with the __order order, or a const_iterator to the\n    // container object's end if order is at least the size of the\n    // container object.\n    inline const_iterator\n    find_by_order(size_type) const;\n\n    // Finds an entry by __order. Returns an iterator to the entry\n    // with the __order order, or an iterator to the container\n    // object's end if order is at least the size of the container\n    // object.\n    inline iterator\n    find_by_order(size_type);\n\n    // Returns the order of a key within a sequence. For exapmle, if\n    // r_key is the smallest key, this method will return 0; if r_key\n    // is a key between the smallest and next key, this method will\n    // return 1; if r_key is a key larger than the largest key, this\n    // method will return the size of r_c.\n    inline size_type\n    order_of_key(const_key_reference) const;\n\n    // Returns the order of a prefix within a sequence. For exapmle,\n    // if [b, e] is the smallest prefix, this method will return 0; if\n    // r_key is a key between the smallest and next key, this method\n    // will return 1; if r_key is a key larger than the largest key,\n    // this method will return the size of r_c.\n    inline size_type\n    order_of_prefix(const_e_iterator, const_e_iterator) const;\n\n  private:\n    typedef typename base_type::const_reference const_reference;\n    typedef typename base_type::const_pointer const_pointer;\n\n    typedef typename Allocator::template rebind<metadata_type>::other metadata_rebind;\n    typedef typename metadata_rebind::const_reference const_metadata_reference;\n    typedef typename metadata_rebind::reference metadata_reference;\n\n    // Returns true if the container is empty.\n    virtual bool\n    empty() const = 0;\n\n    // Returns the iterator associated with the trie's first element.\n    virtual iterator\n    begin() = 0;\n\n    // Returns the iterator associated with the trie's\n    // just-after-last element.\n    virtual iterator\n    end() = 0;\n\n    // Returns the const_node_iterator associated with the trie's root node.\n    virtual const_node_iterator\n    node_begin() const = 0;\n\n    // Returns the node_iterator associated with the trie's root node.\n    virtual node_iterator\n    node_begin() = 0;\n\n    // Returns the const_node_iterator associated with a just-after\n    // leaf node.\n    virtual const_node_iterator\n    node_end() const = 0;\n\n    // Returns the node_iterator associated with a just-after leaf node.\n    virtual node_iterator\n    node_end() = 0;\n\n    // Access to the cmp_fn object.\n    virtual e_access_traits& \n    get_e_access_traits() = 0;\n\n  protected:\n    // Updates the rank of a node through a node_iterator node_it;\n    // end_nd_it is the end node iterator.\n    inline void\n    operator()(node_iterator, const_node_iterator) const;\n\n    // Destructor.\n    virtual\n    ~trie_order_statistics_node_update();\n  };\n\n#include <ext/pb_ds/detail/trie_policy/order_statistics_imp.hpp>\n\n#undef PB_DS_CLASS_T_DEC\n#undef PB_DS_CLASS_C_DEC\n#undef PB_DS_BASE_C_DEC\n#undef PB_DS_STATIC_ASSERT\n\n} // namespace pb_ds\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pod_char_traits.h",
    "content": "// POD character, std::char_traits specialization -*- C++ -*-\n\n// Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n/** @file ext/pod_char_traits.h\n *  This file is a GNU extension to the Standard C++ Library.\n */\n\n// Gabriel Dos Reis <gdr@integrable-solutions.net>\n// Benjamin Kosnik <bkoz@redhat.com>\n\n#ifndef _POD_CHAR_TRAITS_H\n#define _POD_CHAR_TRAITS_H 1\n\n#include <string>\n\n_GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)\n\n  // POD character abstraction.\n  // NB: The char_type parameter is a subset of int_type, as to allow\n  // int_type to properly hold the full range of char_type values as\n  // well as EOF.\n  /// @brief A POD class that serves as a character abstraction class.\n  template<typename V, typename I, typename S = mbstate_t>\n    struct character\n    {\n      typedef V\t\t\t\tvalue_type;\n      typedef I\t\t\t\tint_type;\n      typedef S\t\t\t\tstate_type;\n      typedef character<V, I, S>\tchar_type;\n\n      value_type\tvalue;\n\n      template<typename V2>\n        static char_type\n        from(const V2& v)\n        {\n\t  char_type ret = { static_cast<value_type>(v) };\n\t  return ret;\n\t}\n\n      template<typename V2>\n        static V2\n        to(const char_type& c)\n        {\n\t  V2 ret = { static_cast<V2>(c.value) };\n\t  return ret;\n\t}\n\n    };\n\n  template<typename V, typename I, typename S>\n    inline bool\n    operator==(const character<V, I, S>& lhs, const character<V, I, S>& rhs)\n    { return lhs.value == rhs.value; }\n\n  template<typename V, typename I, typename S>\n    inline bool\n    operator<(const character<V, I, S>& lhs, const character<V, I, S>& rhs)\n    { return lhs.value < rhs.value; }\n\n_GLIBCXX_END_NAMESPACE\n\n_GLIBCXX_BEGIN_NAMESPACE(std)\n\n  /// char_traits<__gnu_cxx::character> specialization.\n  template<typename V, typename I, typename S>\n    struct char_traits<__gnu_cxx::character<V, I, S> >\n    {\n      typedef __gnu_cxx::character<V, I, S>\tchar_type;\n      typedef typename char_type::int_type\tint_type;\n      typedef typename char_type::state_type\tstate_type;\n      typedef fpos<state_type>\t\t\tpos_type;\n      typedef streamoff\t\t\t\toff_type;\n\n      static void\n      assign(char_type& __c1, const char_type& __c2)\n      { __c1 = __c2; }\n\n      static bool\n      eq(const char_type& __c1, const char_type& __c2)\n      { return __c1 == __c2; }\n\n      static bool\n      lt(const char_type& __c1, const char_type& __c2)\n      { return __c1 < __c2; }\n\n      static int\n      compare(const char_type* __s1, const char_type* __s2, size_t __n)\n      {\n\tfor (size_t __i = 0; __i < __n; ++__i)\n\t  if (!eq(__s1[__i], __s2[__i]))\n\t    return lt(__s1[__i], __s2[__i]) ? -1 : 1;\n\treturn 0;\n      }\n\n      static size_t\n      length(const char_type* __s)\n      {\n\tconst char_type* __p = __s;\n\twhile (__p->value)\n\t  ++__p;\n\treturn (__p - __s);\n      }\n\n      static const char_type*\n      find(const char_type* __s, size_t __n, const char_type& __a)\n      {\n\tfor (const char_type* __p = __s; size_t(__p - __s) < __n; ++__p)\n\t  if (*__p == __a)\n\t    return __p;\n\treturn 0;\n      }\n\n      static char_type*\n      move(char_type* __s1, const char_type* __s2, size_t __n)\n      { \n\treturn static_cast<char_type*>(std::memmove(__s1, __s2, \n\t\t\t\t\t\t    __n * sizeof(char_type))); \n      }\n\n      static char_type*\n      copy(char_type* __s1, const char_type* __s2, size_t __n)\n      {\n\tstd::copy(__s2, __s2 + __n, __s1);\n\treturn __s1;\n      }\n\n      static char_type*\n      assign(char_type* __s, size_t __n, char_type __a)\n      {\n\tstd::fill_n(__s, __n, __a);\n        return __s;\n      }\n\n      static char_type\n      to_char_type(const int_type& __i)\n      { return char_type::template from(__i); }\n\n      static int_type\n      to_int_type(const char_type& __c)\n      { return char_type::template to<int_type>(__c); }\n\n      static bool\n      eq_int_type(const int_type& __c1, const int_type& __c2)\n      { return __c1 == __c2; }\n\n      static int_type\n      eof() \n      {\n\tint_type __r = { -1 };\n\treturn __r;\n      }\n\n      static int_type\n      not_eof(const int_type& __c)\n      { return eq_int_type(__c, eof()) ? int_type() : __c; }\n    };\n\n_GLIBCXX_END_NAMESPACE\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/pool_allocator.h",
    "content": "// Allocators -*- C++ -*-\n\n// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006\n// Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n/*\n * Copyright (c) 1996-1997\n * Silicon Graphics Computer Systems, Inc.\n *\n * Permission to use, copy, modify, distribute and sell this software\n * and its documentation for any purpose is hereby granted without fee,\n * provided that the above copyright notice appear in all copies and\n * that both that copyright notice and this permission notice appear\n * in supporting documentation.  Silicon Graphics makes no\n * representations about the suitability of this software for any\n * purpose.  It is provided \"as is\" without express or implied warranty.\n */\n\n/** @file ext/pool_allocator.h\n *  This file is a GNU extension to the Standard C++ Library.\n */\n\n#ifndef _POOL_ALLOCATOR_H\n#define _POOL_ALLOCATOR_H 1\n\n#include <bits/c++config.h>\n#include <cstdlib>\n#include <new>\n#include <bits/functexcept.h>\n#include <ext/atomicity.h>\n#include <ext/concurrence.h>\n\n_GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)\n\n  using std::size_t;\n  using std::ptrdiff_t;\n\n  /**\n   *  @brief  Base class for __pool_alloc.\n   *\n   *  @if maint\n   *  Uses various allocators to fulfill underlying requests (and makes as\n   *  few requests as possible when in default high-speed pool mode).\n   *\n   *  Important implementation properties:\n   *  0. If globally mandated, then allocate objects from new\n   *  1. If the clients request an object of size > _S_max_bytes, the resulting\n   *     object will be obtained directly from new\n   *  2. In all other cases, we allocate an object of size exactly\n   *     _S_round_up(requested_size).  Thus the client has enough size\n   *     information that we can return the object to the proper free list\n   *     without permanently losing part of the object.\n   *\n   *  @endif\n   */\n    class __pool_alloc_base\n    {\n    protected:\n\n      enum { _S_align = 8 };\n      enum { _S_max_bytes = 128 };\n      enum { _S_free_list_size = (size_t)_S_max_bytes / (size_t)_S_align };\n      \n      union _Obj\n      {\n\tunion _Obj* _M_free_list_link;\n\tchar        _M_client_data[1];    // The client sees this.\n      };\n      \n      static _Obj* volatile         _S_free_list[_S_free_list_size];\n\n      // Chunk allocation state.\n      static char*                  _S_start_free;\n      static char*                  _S_end_free;\n      static size_t                 _S_heap_size;     \n      \n      size_t\n      _M_round_up(size_t __bytes)\n      { return ((__bytes + (size_t)_S_align - 1) & ~((size_t)_S_align - 1)); }\n      \n      _Obj* volatile*\n      _M_get_free_list(size_t __bytes);\n    \n      __mutex&\n      _M_get_mutex();\n\n      // Returns an object of size __n, and optionally adds to size __n\n      // free list.\n      void*\n      _M_refill(size_t __n);\n      \n      // Allocates a chunk for nobjs of size size.  nobjs may be reduced\n      // if it is inconvenient to allocate the requested number.\n      char*\n      _M_allocate_chunk(size_t __n, int& __nobjs);\n    };\n\n\n  /// @brief  class __pool_alloc.\n  template<typename _Tp>\n    class __pool_alloc : private __pool_alloc_base\n    {\n    private:\n      static _Atomic_word\t    _S_force_new;\n\n    public:\n      typedef size_t     size_type;\n      typedef ptrdiff_t  difference_type;\n      typedef _Tp*       pointer;\n      typedef const _Tp* const_pointer;\n      typedef _Tp&       reference;\n      typedef const _Tp& const_reference;\n      typedef _Tp        value_type;\n\n      template<typename _Tp1>\n        struct rebind\n        { typedef __pool_alloc<_Tp1> other; };\n\n      __pool_alloc() throw() { }\n\n      __pool_alloc(const __pool_alloc&) throw() { }\n\n      template<typename _Tp1>\n        __pool_alloc(const __pool_alloc<_Tp1>&) throw() { }\n\n      ~__pool_alloc() throw() { }\n\n      pointer\n      address(reference __x) const { return &__x; }\n\n      const_pointer\n      address(const_reference __x) const { return &__x; }\n\n      size_type\n      max_size() const throw() \n      { return size_t(-1) / sizeof(_Tp); }\n\n      // _GLIBCXX_RESOLVE_LIB_DEFECTS\n      // 402. wrong new expression in [some_] allocator::construct\n      void \n      construct(pointer __p, const _Tp& __val) \n      { ::new(__p) _Tp(__val); }\n\n      void \n      destroy(pointer __p) { __p->~_Tp(); }\n\n      pointer\n      allocate(size_type __n, const void* = 0);\n\n      void\n      deallocate(pointer __p, size_type __n);      \n    };\n\n  template<typename _Tp>\n    inline bool\n    operator==(const __pool_alloc<_Tp>&, const __pool_alloc<_Tp>&)\n    { return true; }\n\n  template<typename _Tp>\n    inline bool\n    operator!=(const __pool_alloc<_Tp>&, const __pool_alloc<_Tp>&)\n    { return false; }\n\n  template<typename _Tp>\n    _Atomic_word\n    __pool_alloc<_Tp>::_S_force_new;\n\n  template<typename _Tp>\n    _Tp*\n    __pool_alloc<_Tp>::allocate(size_type __n, const void*)\n    {\n      pointer __ret = 0;\n      if (__builtin_expect(__n != 0, true))\n\t{\n\t  if (__builtin_expect(__n > this->max_size(), false))\n\t    std::__throw_bad_alloc();\n\n\t  // If there is a race through here, assume answer from getenv\n\t  // will resolve in same direction.  Inspired by techniques\n\t  // to efficiently support threading found in basic_string.h.\n\t  if (_S_force_new == 0)\n\t    {\n\t      if (std::getenv(\"GLIBCXX_FORCE_NEW\"))\n\t\t__atomic_add_dispatch(&_S_force_new, 1);\n\t      else\n\t\t__atomic_add_dispatch(&_S_force_new, -1);\n\t    }\n\n\t  const size_t __bytes = __n * sizeof(_Tp);\t      \n\t  if (__bytes > size_t(_S_max_bytes) || _S_force_new == 1)\n\t    __ret = static_cast<_Tp*>(::operator new(__bytes));\n\t  else\n\t    {\n\t      _Obj* volatile* __free_list = _M_get_free_list(__bytes);\n\t      \n\t      __scoped_lock sentry(_M_get_mutex());\n\t      _Obj* __restrict__ __result = *__free_list;\n\t      if (__builtin_expect(__result == 0, 0))\n\t\t__ret = static_cast<_Tp*>(_M_refill(_M_round_up(__bytes)));\n\t      else\n\t\t{\n\t\t  *__free_list = __result->_M_free_list_link;\n\t\t  __ret = reinterpret_cast<_Tp*>(__result);\n\t\t}\n\t      if (__builtin_expect(__ret == 0, 0))\n\t\tstd::__throw_bad_alloc();\n\t    }\n\t}\n      return __ret;\n    }\n\n  template<typename _Tp>\n    void\n    __pool_alloc<_Tp>::deallocate(pointer __p, size_type __n)\n    {\n      if (__builtin_expect(__n != 0 && __p != 0, true))\n\t{\n\t  const size_t __bytes = __n * sizeof(_Tp);\n\t  if (__bytes > static_cast<size_t>(_S_max_bytes) || _S_force_new == 1)\n\t    ::operator delete(__p);\n\t  else\n\t    {\n\t      _Obj* volatile* __free_list = _M_get_free_list(__bytes);\n\t      _Obj* __q = reinterpret_cast<_Obj*>(__p);\n\n\t      __scoped_lock sentry(_M_get_mutex());\n\t      __q ->_M_free_list_link = *__free_list;\n\t      *__free_list = __q;\n\t    }\n\t}\n    }\n\n_GLIBCXX_END_NAMESPACE\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/rb_tree",
    "content": "// rb_tree extension -*- C++ -*-\n\n// Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n/*\n *\n * Copyright (c) 1994\n * Hewlett-Packard Company\n *\n * Permission to use, copy, modify, distribute and sell this software\n * and its documentation for any purpose is hereby granted without fee,\n * provided that the above copyright notice appear in all copies and\n * that both that copyright notice and this permission notice appear\n * in supporting documentation.  Hewlett-Packard Company makes no\n * representations about the suitability of this software for any\n * purpose.  It is provided \"as is\" without express or implied warranty.\n *\n *\n * Copyright (c) 1996\n * Silicon Graphics Computer Systems, Inc.\n *\n * Permission to use, copy, modify, distribute and sell this software\n * and its documentation for any purpose is hereby granted without fee,\n * provided that the above copyright notice appear in all copies and\n * that both that copyright notice and this permission notice appear\n * in supporting documentation.  Silicon Graphics makes no\n * representations about the suitability of this software for any\n * purpose.  It is provided \"as is\" without express or implied warranty.\n */\n\n/** @file ext/rb_tree\n *  This file is a GNU extension to the Standard C++ Library (possibly\n *  containing extensions from the HP/SGI STL subset). \n */\n\n#ifndef _RB_TREE\n#define _RB_TREE 1\n\n#pragma GCC system_header\n\n#include <bits/stl_tree.h>\n\n_GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)\n\n  using std::_Rb_tree;\n  using std::allocator;\n\n  // Class rb_tree is not part of the C++ standard.  It is provided for\n  // compatibility with the HP STL.\n\n  /**\n   *  This is an SGI extension.\n   *  @ingroup SGIextensions\n   *  @doctodo\n   */\n  template <class _Key, class _Value, class _KeyOfValue, class _Compare,\n\t    class _Alloc = allocator<_Value> >\n    struct rb_tree\n    : public _Rb_tree<_Key, _Value, _KeyOfValue, _Compare, _Alloc>\n    {\n      typedef _Rb_tree<_Key, _Value, _KeyOfValue, _Compare, _Alloc> _Base;\n      typedef typename _Base::allocator_type allocator_type;\n\n      rb_tree(const _Compare& __comp = _Compare(),\n\t      const allocator_type& __a = allocator_type())\n      : _Base(__comp, __a) { }\n\n      ~rb_tree() { }\n    };\n\n_GLIBCXX_END_NAMESPACE\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/rc_string_base.h",
    "content": "// Reference-counted versatile string base -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n/** @file ext/rc_string_base.h\n *  This file is a GNU extension to the Standard C++ Library.\n *  This is an internal header file, included by other library headers.\n *  You should not attempt to use it directly.\n */\n\n#ifndef _RC_STRING_BASE_H\n#define _RC_STRING_BASE_H 1\n\n#include <ext/atomicity.h>\n\n_GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)\n\n  /**\n   *  @if maint\n   *  Documentation?  What's that?\n   *  Nathan Myers <ncm@cantrip.org>.\n   *\n   *  A string looks like this:\n   *\n   *  @code\n   *                                        [_Rep]\n   *                                        _M_length\n   *   [__rc_string_base<char_type>]        _M_capacity\n   *   _M_dataplus                          _M_refcount\n   *   _M_p ---------------->               unnamed array of char_type\n   *  @endcode\n   *\n   *  Where the _M_p points to the first character in the string, and\n   *  you cast it to a pointer-to-_Rep and subtract 1 to get a\n   *  pointer to the header.\n   *\n   *  This approach has the enormous advantage that a string object\n   *  requires only one allocation.  All the ugliness is confined\n   *  within a single pair of inline functions, which each compile to\n   *  a single \"add\" instruction: _Rep::_M_refdata(), and\n   *  __rc_string_base::_M_rep(); and the allocation function which gets a\n   *  block of raw bytes and with room enough and constructs a _Rep\n   *  object at the front.\n   *\n   *  The reason you want _M_data pointing to the character array and\n   *  not the _Rep is so that the debugger can see the string\n   *  contents. (Probably we should add a non-inline member to get\n   *  the _Rep for the debugger to use, so users can check the actual\n   *  string length.)\n   *\n   *  Note that the _Rep object is a POD so that you can have a\n   *  static \"empty string\" _Rep object already \"constructed\" before\n   *  static constructors have run.  The reference-count encoding is\n   *  chosen so that a 0 indicates one reference, so you never try to\n   *  destroy the empty-string _Rep object.\n   *\n   *  All but the last paragraph is considered pretty conventional\n   *  for a C++ string implementation.\n   *  @endif\n  */\n template<typename _CharT, typename _Traits, typename _Alloc>\n    class __rc_string_base\n    : protected __vstring_utility<_CharT, _Traits, _Alloc>\n    {\n    public:\n      typedef _Traits\t\t\t\t\t    traits_type;\n      typedef typename _Traits::char_type\t\t    value_type;\n      typedef _Alloc\t\t\t\t\t    allocator_type;\n\n      typedef __vstring_utility<_CharT, _Traits, _Alloc>    _Util_Base;\n      typedef typename _Util_Base::_CharT_alloc_type        _CharT_alloc_type;\n      typedef typename _CharT_alloc_type::size_type\t    size_type;\n\n    private:\n      // _Rep: string representation\n      //   Invariants:\n      //   1. String really contains _M_length + 1 characters: due to 21.3.4\n      //      must be kept null-terminated.\n      //   2. _M_capacity >= _M_length\n      //      Allocated memory is always (_M_capacity + 1) * sizeof(_CharT).\n      //   3. _M_refcount has three states:\n      //      -1: leaked, one reference, no ref-copies allowed, non-const.\n      //       0: one reference, non-const.\n      //     n>0: n + 1 references, operations require a lock, const.\n      //   4. All fields == 0 is an empty string, given the extra storage\n      //      beyond-the-end for a null terminator; thus, the shared\n      //      empty string representation needs no constructor.\n      struct _Rep\n      {\n\tunion\n\t{\n\t  struct\n\t  {\n\t    size_type\t    _M_length;\n\t    size_type\t    _M_capacity;\n\t    _Atomic_word    _M_refcount;\n\t  }                 _M_info;\n\t  \n\t  // Only for alignment purposes.\n\t  _CharT            _M_align;\n\t};\n\n\ttypedef typename _Alloc::template rebind<_Rep>::other _Rep_alloc_type;\n\n \t_CharT*\n\t_M_refdata() throw()\n\t{ return reinterpret_cast<_CharT*>(this + 1); }\n\n\t_CharT*\n\t_M_refcopy() throw()\n\t{\n\t  __atomic_add_dispatch(&_M_info._M_refcount, 1);\n\t  return _M_refdata();\n\t}  // XXX MT\n\t\n\tvoid\n\t_M_set_length(size_type __n)\n\t{ \n\t  _M_info._M_refcount = 0;  // One reference.\n\t  _M_info._M_length = __n;\n\t  // grrr. (per 21.3.4)\n\t  // You cannot leave those LWG people alone for a second.\n\t  traits_type::assign(_M_refdata()[__n], _CharT());\n\t}\n\n\t// Create & Destroy\n\tstatic _Rep*\n\t_S_create(size_type, size_type, const _Alloc&);\n\n\tvoid\n\t_M_destroy(const _Alloc&) throw();\n\n\t_CharT*\n\t_M_clone(const _Alloc&, size_type __res = 0);\n      };\n\n      struct _Rep_empty\n      : public _Rep\n      {\n\t_CharT              _M_terminal;\n      };\n\n      static _Rep_empty     _S_empty_rep;\n\n      // The maximum number of individual char_type elements of an\n      // individual string is determined by _S_max_size. This is the\n      // value that will be returned by max_size().  (Whereas npos\n      // is the maximum number of bytes the allocator can allocate.)\n      // If one was to divvy up the theoretical largest size string,\n      // with a terminating character and m _CharT elements, it'd\n      // look like this:\n      // npos = sizeof(_Rep) + (m * sizeof(_CharT)) + sizeof(_CharT)\n      //        + sizeof(_Rep) - 1\n      // (NB: last two terms for rounding reasons, see _M_create below)\n      // Solving for m:\n      // m = ((npos - 2 * sizeof(_Rep) + 1) / sizeof(_CharT)) - 1\n      // In addition, this implementation halfs this amount.\n      enum { _S_max_size = (((static_cast<size_type>(-1) - 2 * sizeof(_Rep)\n\t\t\t      + 1) / sizeof(_CharT)) - 1) / 2 };\n\n      // Data Member (private):\n      mutable typename _Util_Base::template _Alloc_hider<_Alloc>  _M_dataplus;\n\n      void\n      _M_data(_CharT* __p)\n      { _M_dataplus._M_p = __p; }\n\n      _Rep*\n      _M_rep() const\n      { return &((reinterpret_cast<_Rep*>(_M_data()))[-1]); }\n\n      _CharT*\n      _M_grab(const _Alloc& __alloc) const\n      {\n\treturn (!_M_is_leaked() && _M_get_allocator() == __alloc)\n\t        ? _M_rep()->_M_refcopy() : _M_rep()->_M_clone(__alloc);\n      }\n\n      void\n      _M_dispose()\n      {\n\tif (__exchange_and_add_dispatch(&_M_rep()->_M_info._M_refcount,\n\t\t\t\t\t-1) <= 0)\n\t  _M_rep()->_M_destroy(_M_get_allocator());\n      }  // XXX MT\n\n      bool\n      _M_is_leaked() const\n      { return _M_rep()->_M_info._M_refcount < 0; }\n\n      void\n      _M_set_sharable()\n      { _M_rep()->_M_info._M_refcount = 0; }\n\n      void\n      _M_leak_hard();\n\n      // _S_construct_aux is used to implement the 21.3.1 para 15 which\n      // requires special behaviour if _InIterator is an integral type\n      template<typename _InIterator>\n        static _CharT*\n        _S_construct_aux(_InIterator __beg, _InIterator __end,\n\t\t\t const _Alloc& __a, std::__false_type)\n\t{\n          typedef typename iterator_traits<_InIterator>::iterator_category _Tag;\n          return _S_construct(__beg, __end, __a, _Tag());\n\t}\n\n      template<typename _InIterator>\n        static _CharT*\n        _S_construct_aux(_InIterator __beg, _InIterator __end,\n\t\t\t const _Alloc& __a, std::__true_type)\n\t{ return _S_construct(static_cast<size_type>(__beg),\n\t\t\t      static_cast<value_type>(__end), __a); }\n\n      template<typename _InIterator>\n        static _CharT*\n        _S_construct(_InIterator __beg, _InIterator __end, const _Alloc& __a)\n\t{\n\t  typedef typename std::__is_integer<_InIterator>::__type _Integral;\n\t  return _S_construct_aux(__beg, __end, __a, _Integral());\n        }\n\n      // For Input Iterators, used in istreambuf_iterators, etc.\n      template<typename _InIterator>\n        static _CharT*\n         _S_construct(_InIterator __beg, _InIterator __end, const _Alloc& __a,\n\t\t      std::input_iterator_tag);\n      \n      // For forward_iterators up to random_access_iterators, used for\n      // string::iterator, _CharT*, etc.\n      template<typename _FwdIterator>\n        static _CharT*\n        _S_construct(_FwdIterator __beg, _FwdIterator __end, const _Alloc& __a,\n\t\t     std::forward_iterator_tag);\n\n      static _CharT*\n      _S_construct(size_type __req, _CharT __c, const _Alloc& __a);\n\n    public:\n      size_type\n      _M_max_size() const\n      { return size_type(_S_max_size); }\n\n      _CharT*\n      _M_data() const\n      { return _M_dataplus._M_p; }\n\n      size_type\n      _M_length() const\n      { return _M_rep()->_M_info._M_length; }\n\n      size_type\n      _M_capacity() const\n      { return _M_rep()->_M_info._M_capacity; }\n\n      bool\n      _M_is_shared() const\n      { return _M_rep()->_M_info._M_refcount > 0; }\n\n      void\n      _M_set_leaked()\n      { _M_rep()->_M_info._M_refcount = -1; }\n\n      void\n      _M_leak()    // for use in begin() & non-const op[]\n      {\n\tif (!_M_is_leaked())\n\t  _M_leak_hard();\n      }\n\n      void\n      _M_set_length(size_type __n)\n      { _M_rep()->_M_set_length(__n); }\n\n      __rc_string_base()\n      : _M_dataplus(_Alloc(), _S_empty_rep._M_refcopy()) { }\n\n      __rc_string_base(const _Alloc& __a);\n\n      __rc_string_base(const __rc_string_base& __rcs);\n\n      __rc_string_base(size_type __n, _CharT __c, const _Alloc& __a);\n\n      template<typename _InputIterator>\n        __rc_string_base(_InputIterator __beg, _InputIterator __end,\n\t\t\t const _Alloc& __a);\n\n      ~__rc_string_base()\n      { _M_dispose(); }      \n\n      allocator_type&\n      _M_get_allocator()\n      { return _M_dataplus; }\n\n      const allocator_type&\n      _M_get_allocator() const\n      { return _M_dataplus; }\n\n      void\n      _M_swap(__rc_string_base& __rcs);\n\n      void\n      _M_assign(const __rc_string_base& __rcs);\n\n      void\n      _M_reserve(size_type __res);\n\n      void\n      _M_mutate(size_type __pos, size_type __len1, const _CharT* __s,\n\t\tsize_type __len2);\n      \n      void\n      _M_erase(size_type __pos, size_type __n);\n\n      void\n      _M_clear()\n      { _M_erase(size_type(0), _M_length()); }\n\n      bool\n      _M_compare(const __rc_string_base&) const\n      { return false; }\n    };\n\n  template<typename _CharT, typename _Traits, typename _Alloc>\n    typename __rc_string_base<_CharT, _Traits, _Alloc>::_Rep_empty\n    __rc_string_base<_CharT, _Traits, _Alloc>::_S_empty_rep;\n\n  template<typename _CharT, typename _Traits, typename _Alloc>\n    typename __rc_string_base<_CharT, _Traits, _Alloc>::_Rep*\n    __rc_string_base<_CharT, _Traits, _Alloc>::_Rep::\n    _S_create(size_type __capacity, size_type __old_capacity,\n\t      const _Alloc& __alloc)\n    {\n      // _GLIBCXX_RESOLVE_LIB_DEFECTS\n      // 83.  String::npos vs. string::max_size()\n      if (__capacity > size_type(_S_max_size))\n\tstd::__throw_length_error(__N(\"__rc_string_base::_Rep::_S_create\"));\n\n      // The standard places no restriction on allocating more memory\n      // than is strictly needed within this layer at the moment or as\n      // requested by an explicit application call to reserve().\n\n      // Many malloc implementations perform quite poorly when an\n      // application attempts to allocate memory in a stepwise fashion\n      // growing each allocation size by only 1 char.  Additionally,\n      // it makes little sense to allocate less linear memory than the\n      // natural blocking size of the malloc implementation.\n      // Unfortunately, we would need a somewhat low-level calculation\n      // with tuned parameters to get this perfect for any particular\n      // malloc implementation.  Fortunately, generalizations about\n      // common features seen among implementations seems to suffice.\n\n      // __pagesize need not match the actual VM page size for good\n      // results in practice, thus we pick a common value on the low\n      // side.  __malloc_header_size is an estimate of the amount of\n      // overhead per memory allocation (in practice seen N * sizeof\n      // (void*) where N is 0, 2 or 4).  According to folklore,\n      // picking this value on the high side is better than\n      // low-balling it (especially when this algorithm is used with\n      // malloc implementations that allocate memory blocks rounded up\n      // to a size which is a power of 2).\n      const size_type __pagesize = 4096;\n      const size_type __malloc_header_size = 4 * sizeof(void*);\n\n      // The below implements an exponential growth policy, necessary to\n      // meet amortized linear time requirements of the library: see\n      // http://gcc.gnu.org/ml/libstdc++/2001-07/msg00085.html.\n      if (__capacity > __old_capacity && __capacity < 2 * __old_capacity)\n\t{\n\t  __capacity = 2 * __old_capacity;\n\t  // Never allocate a string bigger than _S_max_size.\n\t  if (__capacity > size_type(_S_max_size))\n\t    __capacity = size_type(_S_max_size);\n\t}\n\n      // NB: Need an array of char_type[__capacity], plus a terminating\n      // null char_type() element, plus enough for the _Rep data structure,\n      // plus sizeof(_Rep) - 1 to upper round to a size multiple of\n      // sizeof(_Rep).\n      // Whew. Seemingly so needy, yet so elemental.\n      size_type __size = ((__capacity + 1) * sizeof(_CharT)\n\t\t\t  + 2 * sizeof(_Rep) - 1);\n\n      const size_type __adj_size = __size + __malloc_header_size;\n      if (__adj_size > __pagesize && __capacity > __old_capacity)\n\t{\n\t  const size_type __extra = __pagesize - __adj_size % __pagesize;\n\t  __capacity += __extra / sizeof(_CharT);\n\t  if (__capacity > size_type(_S_max_size))\n\t    __capacity = size_type(_S_max_size);\n\t  __size = (__capacity + 1) * sizeof(_CharT) + 2 * sizeof(_Rep) - 1;\n\t}\n\n      // NB: Might throw, but no worries about a leak, mate: _Rep()\n      // does not throw.\n      _Rep* __place = _Rep_alloc_type(__alloc).allocate(__size / sizeof(_Rep));\n      _Rep* __p = new (__place) _Rep;\n      __p->_M_info._M_capacity = __capacity;\n      return __p;\n    }\n\n  template<typename _CharT, typename _Traits, typename _Alloc>\n    void\n    __rc_string_base<_CharT, _Traits, _Alloc>::_Rep::\n    _M_destroy(const _Alloc& __a) throw ()\n    {\n      const size_type __size = ((_M_info._M_capacity + 1) * sizeof(_CharT)\n\t\t\t\t+ 2 * sizeof(_Rep) - 1);\n      _Rep_alloc_type(__a).deallocate(this, __size / sizeof(_Rep));\n    }\n\n  template<typename _CharT, typename _Traits, typename _Alloc>\n    _CharT*\n    __rc_string_base<_CharT, _Traits, _Alloc>::_Rep::\n    _M_clone(const _Alloc& __alloc, size_type __res)\n    {\n      // Requested capacity of the clone.\n      const size_type __requested_cap = _M_info._M_length + __res;\n      _Rep* __r = _Rep::_S_create(__requested_cap, _M_info._M_capacity,\n\t\t\t\t  __alloc);\n\n      if (_M_info._M_length)\n\t_S_copy(__r->_M_refdata(), _M_refdata(), _M_info._M_length);\n\n      __r->_M_set_length(_M_info._M_length);\n      return __r->_M_refdata();\n    }\n\n  template<typename _CharT, typename _Traits, typename _Alloc>\n    __rc_string_base<_CharT, _Traits, _Alloc>::\n    __rc_string_base(const _Alloc& __a)\n    : _M_dataplus(__a, _S_construct(size_type(), _CharT(), __a)) { }\n\n  template<typename _CharT, typename _Traits, typename _Alloc>\n    __rc_string_base<_CharT, _Traits, _Alloc>::\n    __rc_string_base(const __rc_string_base& __rcs)\n    : _M_dataplus(__rcs._M_get_allocator(),\n\t\t  __rcs._M_grab(__rcs._M_get_allocator())) { }\n\n  template<typename _CharT, typename _Traits, typename _Alloc>\n    __rc_string_base<_CharT, _Traits, _Alloc>::\n    __rc_string_base(size_type __n, _CharT __c, const _Alloc& __a)\n    : _M_dataplus(__a, _S_construct(__n, __c, __a)) { }\n\n  template<typename _CharT, typename _Traits, typename _Alloc>\n    template<typename _InputIterator>\n    __rc_string_base<_CharT, _Traits, _Alloc>::\n    __rc_string_base(_InputIterator __beg, _InputIterator __end,\n\t\t     const _Alloc& __a)\n    : _M_dataplus(__a, _S_construct(__beg, __end, __a)) { }\n\n  template<typename _CharT, typename _Traits, typename _Alloc>\n    void\n    __rc_string_base<_CharT, _Traits, _Alloc>::\n    _M_leak_hard()\n    {\n      if (_M_is_shared())\n\t_M_erase(0, 0);\n      _M_set_leaked();\n    }\n\n  // NB: This is the special case for Input Iterators, used in\n  // istreambuf_iterators, etc.\n  // Input Iterators have a cost structure very different from\n  // pointers, calling for a different coding style.\n  template<typename _CharT, typename _Traits, typename _Alloc>\n    template<typename _InIterator>\n      _CharT*\n      __rc_string_base<_CharT, _Traits, _Alloc>::\n      _S_construct(_InIterator __beg, _InIterator __end, const _Alloc& __a,\n\t\t   std::input_iterator_tag)\n      {\n\tif (__beg == __end && __a == _Alloc())\n\t  return _S_empty_rep._M_refcopy();\n\n\t// Avoid reallocation for common case.\n\t_CharT __buf[128];\n\tsize_type __len = 0;\n\twhile (__beg != __end && __len < sizeof(__buf) / sizeof(_CharT))\n\t  {\n\t    __buf[__len++] = *__beg;\n\t    ++__beg;\n\t  }\n\t_Rep* __r = _Rep::_S_create(__len, size_type(0), __a);\n\t_S_copy(__r->_M_refdata(), __buf, __len);\n\ttry\n\t  {\n\t    while (__beg != __end)\n\t      {\n\t\tif (__len == __r->_M_info._M_capacity)\n\t\t  {\n\t\t    // Allocate more space.\n\t\t    _Rep* __another = _Rep::_S_create(__len + 1, __len, __a);\n\t\t    _S_copy(__another->_M_refdata(), __r->_M_refdata(), __len);\n\t\t    __r->_M_destroy(__a);\n\t\t    __r = __another;\n\t\t  }\n\t\t__r->_M_refdata()[__len++] = *__beg;\n\t\t++__beg;\n\t      }\n\t  }\n\tcatch(...)\n\t  {\n\t    __r->_M_destroy(__a);\n\t    __throw_exception_again;\n\t  }\n\t__r->_M_set_length(__len);\n\treturn __r->_M_refdata();\n      }\n\n  template<typename _CharT, typename _Traits, typename _Alloc>\n    template<typename _InIterator>\n      _CharT*\n      __rc_string_base<_CharT, _Traits, _Alloc>::\n      _S_construct(_InIterator __beg, _InIterator __end, const _Alloc& __a,\n\t\t   std::forward_iterator_tag)\n      {\n\tif (__beg == __end && __a == _Alloc())\n\t  return _S_empty_rep._M_refcopy();\n\n\t// NB: Not required, but considered best practice.\n\tif (__builtin_expect(_S_is_null_pointer(__beg) && __beg != __end, 0))\n\t  std::__throw_logic_error(__N(\"__rc_string_base::\"\n\t\t\t\t       \"_S_construct NULL not valid\"));\n\n\tconst size_type __dnew = static_cast<size_type>(std::distance(__beg,\n\t\t\t\t\t\t\t\t      __end));\n\t// Check for out_of_range and length_error exceptions.\n\t_Rep* __r = _Rep::_S_create(__dnew, size_type(0), __a);\n\ttry\n\t  { _S_copy_chars(__r->_M_refdata(), __beg, __end); }\n\tcatch(...)\n\t  {\n\t    __r->_M_destroy(__a);\n\t    __throw_exception_again;\n\t  }\n\t__r->_M_set_length(__dnew);\n\treturn __r->_M_refdata();\n      }\n\n  template<typename _CharT, typename _Traits, typename _Alloc>\n    _CharT*\n    __rc_string_base<_CharT, _Traits, _Alloc>::\n    _S_construct(size_type __n, _CharT __c, const _Alloc& __a)\n    {\n      if (__n == 0 && __a == _Alloc())\n\treturn _S_empty_rep._M_refcopy();\n\n      // Check for out_of_range and length_error exceptions.\n      _Rep* __r = _Rep::_S_create(__n, size_type(0), __a);\n      if (__n)\n\t_S_assign(__r->_M_refdata(), __n, __c);\n\n      __r->_M_set_length(__n);\n      return __r->_M_refdata();\n    }\n\n  template<typename _CharT, typename _Traits, typename _Alloc>\n    void\n    __rc_string_base<_CharT, _Traits, _Alloc>::\n    _M_swap(__rc_string_base& __rcs)\n    {\n      if (_M_is_leaked())\n\t_M_set_sharable();\n      if (__rcs._M_is_leaked())\n\t__rcs._M_set_sharable();\n      \n      _CharT* __tmp = _M_data();\n      _M_data(__rcs._M_data());\n      __rcs._M_data(__tmp);\n\n      // _GLIBCXX_RESOLVE_LIB_DEFECTS\n      // 431. Swapping containers with unequal allocators.\n      std::__alloc_swap<allocator_type>::_S_do_it(_M_get_allocator(),\n\t\t\t\t\t\t  __rcs._M_get_allocator());\n    } \n\n  template<typename _CharT, typename _Traits, typename _Alloc>\n    void\n    __rc_string_base<_CharT, _Traits, _Alloc>::\n    _M_assign(const __rc_string_base& __rcs)\n    {\n      if (_M_rep() != __rcs._M_rep())\n\t{\n\t  _CharT* __tmp = __rcs._M_grab(_M_get_allocator());\n\t  _M_dispose();\n\t  _M_data(__tmp);\n\t}\n    }\n\n  template<typename _CharT, typename _Traits, typename _Alloc>\n    void\n    __rc_string_base<_CharT, _Traits, _Alloc>::\n    _M_reserve(size_type __res)\n    {\n      // Make sure we don't shrink below the current size.\n      if (__res < _M_length())\n\t__res = _M_length();\n      \n      if (__res != _M_capacity() || _M_is_shared())\n\t{\n\t  _CharT* __tmp = _M_rep()->_M_clone(_M_get_allocator(),\n\t\t\t\t\t     __res - _M_length());\n\t  _M_dispose();\n\t  _M_data(__tmp);\n\t}\n    }\n\n  template<typename _CharT, typename _Traits, typename _Alloc>\n    void\n    __rc_string_base<_CharT, _Traits, _Alloc>::\n    _M_mutate(size_type __pos, size_type __len1, const _CharT* __s,\n\t      size_type __len2)\n    {\n      const size_type __how_much = _M_length() - __pos - __len1;\n      \n      _Rep* __r = _Rep::_S_create(_M_length() + __len2 - __len1,\n\t\t\t\t  _M_capacity(), _M_get_allocator());\n      \n      if (__pos)\n\t_S_copy(__r->_M_refdata(), _M_data(), __pos);\n      if (__s && __len2)\n\t_S_copy(__r->_M_refdata() + __pos, __s, __len2);\n      if (__how_much)\n\t_S_copy(__r->_M_refdata() + __pos + __len2,\n\t\t_M_data() + __pos + __len1, __how_much);\n      \n      _M_dispose();\n      _M_data(__r->_M_refdata());\n    }\n\n  template<typename _CharT, typename _Traits, typename _Alloc>\n    void\n    __rc_string_base<_CharT, _Traits, _Alloc>::\n    _M_erase(size_type __pos, size_type __n)\n    {\n      const size_type __new_size = _M_length() - __n;\n      const size_type __how_much = _M_length() - __pos - __n;\n      \n      if (_M_is_shared())\n\t{\n\t  // Must reallocate.\n\t  _Rep* __r = _Rep::_S_create(__new_size, _M_capacity(),\n\t\t\t\t      _M_get_allocator());\n\n\t  if (__pos)\n\t    _S_copy(__r->_M_refdata(), _M_data(), __pos);\n\t  if (__how_much)\n\t    _S_copy(__r->_M_refdata() + __pos,\n\t\t    _M_data() + __pos + __n, __how_much);\n\n\t  _M_dispose();\n\t  _M_data(__r->_M_refdata());\n\t}\n      else if (__how_much && __n)\n\t{\n\t  // Work in-place.\n\t  _S_move(_M_data() + __pos,\n\t\t  _M_data() + __pos + __n, __how_much);\n\t}\n\n      _M_rep()->_M_set_length(__new_size);      \n    }\n\n  template<>\n    inline bool\n    __rc_string_base<char, std::char_traits<char>,\n\t\t     std::allocator<char> >::\n    _M_compare(const __rc_string_base& __rcs) const\n    {\n      if (_M_rep() == __rcs._M_rep())\n\treturn true;\n      return false;\n    }\n\n#ifdef _GLIBCXX_USE_WCHAR_T\n  template<>\n    inline bool\n    __rc_string_base<wchar_t, std::char_traits<wchar_t>,\n\t\t     std::allocator<wchar_t> >::\n    _M_compare(const __rc_string_base& __rcs) const\n    {\n      if (_M_rep() == __rcs._M_rep())\n\treturn true;\n      return false;\n    }\n#endif\n\n_GLIBCXX_END_NAMESPACE\n\n#endif /* _RC_STRING_BASE_H */\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/rope",
    "content": "// SGI's rope class -*- C++ -*-\n\n// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006\n// Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n/*\n * Copyright (c) 1997\n * Silicon Graphics Computer Systems, Inc.\n *\n * Permission to use, copy, modify, distribute and sell this software\n * and its documentation for any purpose is hereby granted without fee,\n * provided that the above copyright notice appear in all copies and\n * that both that copyright notice and this permission notice appear\n * in supporting documentation.  Silicon Graphics makes no\n * representations about the suitability of this software for any\n * purpose.  It is provided \"as is\" without express or implied warranty.\n */\n\n/** @file ext/rope\n *  This file is a GNU extension to the Standard C++ Library (possibly\n *  containing extensions from the HP/SGI STL subset). \n */\n\n#ifndef _ROPE\n#define _ROPE 1\n\n#include <bits/stl_algobase.h>\n#include <bits/stl_construct.h>\n#include <bits/stl_uninitialized.h>\n#include <bits/stl_algo.h>\n#include <bits/stl_function.h>\n#include <bits/stl_numeric.h>\n#include <bits/allocator.h>\n#include <ext/hash_fun.h>\n\n# ifdef __GC\n#   define __GC_CONST const\n# else\n#   include <bits/gthr.h>\n#   define __GC_CONST   // constant except for deallocation\n# endif\n\n#include <ext/memory> // For uninitialized_copy_n\n\n_GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)\n\n  namespace __detail\n  {\n    enum { _S_max_rope_depth = 45 };\n    enum _Tag {_S_leaf, _S_concat, _S_substringfn, _S_function};\n  } // namespace __detail\n\n  using std::size_t;\n  using std::ptrdiff_t;\n  using std::allocator;\n  using std::iterator;\n  using std::reverse_iterator;\n  using std::_Destroy;\n\n  // The _S_eos function is used for those functions that\n  // convert to/from C-like strings to detect the end of the string.\n  \n  // The end-of-C-string character.\n  // This is what the draft standard says it should be.\n  template <class _CharT>\n    inline _CharT\n    _S_eos(_CharT*)\n    { return _CharT(); }\n\n  // Test for basic character types.\n  // For basic character types leaves having a trailing eos.\n  template <class _CharT>\n    inline bool\n    _S_is_basic_char_type(_CharT*)\n    { return false; }\n  \n  template <class _CharT>\n    inline bool\n    _S_is_one_byte_char_type(_CharT*)\n    { return false; }\n\n  inline bool\n  _S_is_basic_char_type(char*)\n  { return true; }\n  \n  inline bool\n  _S_is_one_byte_char_type(char*)\n  { return true; }\n  \n  inline bool\n  _S_is_basic_char_type(wchar_t*)\n  { return true; }\n\n  // Store an eos iff _CharT is a basic character type.\n  // Do not reference _S_eos if it isn't.\n  template <class _CharT>\n    inline void\n    _S_cond_store_eos(_CharT&) { }\n\n  inline void\n  _S_cond_store_eos(char& __c)\n  { __c = 0; }\n\n  inline void\n  _S_cond_store_eos(wchar_t& __c)\n  { __c = 0; }\n\n  // char_producers are logically functions that generate a section of\n  // a string.  These can be convereted to ropes.  The resulting rope\n  // invokes the char_producer on demand.  This allows, for example,\n  // files to be viewed as ropes without reading the entire file.\n  template <class _CharT>\n    class char_producer\n    {\n    public:\n      virtual ~char_producer() { };\n\n      virtual void\n      operator()(size_t __start_pos, size_t __len,\n\t\t _CharT* __buffer) = 0;\n      // Buffer should really be an arbitrary output iterator.\n      // That way we could flatten directly into an ostream, etc.\n      // This is thoroughly impossible, since iterator types don't\n      // have runtime descriptions.\n    };\n\n  // Sequence buffers:\n  //\n  // Sequence must provide an append operation that appends an\n  // array to the sequence.  Sequence buffers are useful only if\n  // appending an entire array is cheaper than appending element by element.\n  // This is true for many string representations.\n  // This should  perhaps inherit from ostream<sequence::value_type>\n  // and be implemented correspondingly, so that they can be used\n  // for formatted.  For the sake of portability, we don't do this yet.\n  //\n  // For now, sequence buffers behave as output iterators.  But they also\n  // behave a little like basic_ostringstream<sequence::value_type> and a\n  // little like containers.\n\n  template<class _Sequence, size_t _Buf_sz = 100>\n    class sequence_buffer\n    : public iterator<std::output_iterator_tag, void, void, void, void>\n    {\n    public:\n      typedef typename _Sequence::value_type value_type;\n    protected:\n      _Sequence* _M_prefix;\n      value_type _M_buffer[_Buf_sz];\n      size_t     _M_buf_count;\n    public:\n\n      void\n      flush()\n      {\n\t_M_prefix->append(_M_buffer, _M_buffer + _M_buf_count);\n\t_M_buf_count = 0;\n      }\n      \n      ~sequence_buffer()\n      { flush(); }\n      \n      sequence_buffer()\n      : _M_prefix(0), _M_buf_count(0) { }\n\n      sequence_buffer(const sequence_buffer& __x)\n      {\n\t_M_prefix = __x._M_prefix;\n\t_M_buf_count = __x._M_buf_count;\n\tstd::copy(__x._M_buffer, __x._M_buffer + __x._M_buf_count, _M_buffer);\n      }\n      \n      sequence_buffer(sequence_buffer& __x)\n      {\n\t__x.flush();\n\t_M_prefix = __x._M_prefix;\n\t_M_buf_count = 0;\n      }\n      \n      sequence_buffer(_Sequence& __s)\n      : _M_prefix(&__s), _M_buf_count(0) { }\n      \n      sequence_buffer&\n      operator=(sequence_buffer& __x)\n      {\n\t__x.flush();\n\t_M_prefix = __x._M_prefix;\n\t_M_buf_count = 0;\n\treturn *this;\n      }\n\n      sequence_buffer&\n      operator=(const sequence_buffer& __x)\n      {\n\t_M_prefix = __x._M_prefix;\n\t_M_buf_count = __x._M_buf_count;\n\tstd::copy(__x._M_buffer, __x._M_buffer + __x._M_buf_count, _M_buffer);\n\treturn *this;\n      }\n      \n      void\n      push_back(value_type __x)\n      {\n\tif (_M_buf_count < _Buf_sz)\n\t  {\n\t    _M_buffer[_M_buf_count] = __x;\n\t    ++_M_buf_count;\n\t  }\n\telse\n\t  {\n\t    flush();\n\t    _M_buffer[0] = __x;\n\t    _M_buf_count = 1;\n\t  }\n      }\n      \n      void\n      append(value_type* __s, size_t __len)\n      {\n\tif (__len + _M_buf_count <= _Buf_sz)\n\t  {\n\t    size_t __i = _M_buf_count;\n\t    for (size_t __j = 0; __j < __len; __i++, __j++)\n\t      _M_buffer[__i] = __s[__j];\n\t    _M_buf_count += __len;\n\t  }\n\telse if (0 == _M_buf_count)\n\t  _M_prefix->append(__s, __s + __len);\n\telse\n\t  {\n\t    flush();\n\t    append(__s, __len);\n\t  }\n      }\n\n      sequence_buffer&\n      write(value_type* __s, size_t __len)\n      {\n\tappend(__s, __len);\n\treturn *this;\n      }\n      \n      sequence_buffer&\n      put(value_type __x)\n      {\n\tpush_back(__x);\n\treturn *this;\n      }\n      \n      sequence_buffer&\n      operator=(const value_type& __rhs)\n      {\n\tpush_back(__rhs);\n\treturn *this;\n      }\n      \n      sequence_buffer&\n      operator*()\n      { return *this; }\n      \n      sequence_buffer&\n      operator++()\n      { return *this; }\n      \n      sequence_buffer\n      operator++(int)\n      { return *this; }\n    };\n  \n  // The following should be treated as private, at least for now.\n  template<class _CharT>\n    class _Rope_char_consumer\n    {\n    public:\n      // If we had member templates, these should not be virtual.\n      // For now we need to use run-time parametrization where\n      // compile-time would do.  Hence this should all be private\n      // for now.\n      // The symmetry with char_producer is accidental and temporary.\n      virtual ~_Rope_char_consumer() { };\n  \n      virtual bool\n      operator()(const _CharT* __buffer, size_t __len) = 0;\n    };\n  \n  // First a lot of forward declarations.  The standard seems to require\n  // much stricter \"declaration before use\" than many of the implementations\n  // that preceded it.\n  template<class _CharT, class _Alloc = allocator<_CharT> >\n    class rope;\n  \n  template<class _CharT, class _Alloc>\n    struct _Rope_RopeConcatenation;\n\n  template<class _CharT, class _Alloc>\n    struct _Rope_RopeLeaf;\n  \n  template<class _CharT, class _Alloc>\n    struct _Rope_RopeFunction;\n  \n  template<class _CharT, class _Alloc>\n    struct _Rope_RopeSubstring;\n  \n  template<class _CharT, class _Alloc>\n    class _Rope_iterator;\n  \n  template<class _CharT, class _Alloc>\n    class _Rope_const_iterator;\n  \n  template<class _CharT, class _Alloc>\n    class _Rope_char_ref_proxy;\n  \n  template<class _CharT, class _Alloc>\n    class _Rope_char_ptr_proxy;\n\n  template<class _CharT, class _Alloc>\n    bool\n    operator==(const _Rope_char_ptr_proxy<_CharT, _Alloc>& __x,\n\t       const _Rope_char_ptr_proxy<_CharT, _Alloc>& __y);\n\n  template<class _CharT, class _Alloc>\n    _Rope_const_iterator<_CharT, _Alloc>\n    operator-(const _Rope_const_iterator<_CharT, _Alloc>& __x,\n\t      ptrdiff_t __n);\n\n  template<class _CharT, class _Alloc>\n    _Rope_const_iterator<_CharT, _Alloc>\n    operator+(const _Rope_const_iterator<_CharT, _Alloc>& __x,\n\t      ptrdiff_t __n);\n\n  template<class _CharT, class _Alloc>\n    _Rope_const_iterator<_CharT, _Alloc>\n    operator+(ptrdiff_t __n,\n\t      const _Rope_const_iterator<_CharT, _Alloc>& __x);\n\n  template<class _CharT, class _Alloc>\n    bool\n    operator==(const _Rope_const_iterator<_CharT, _Alloc>& __x,\n\t       const _Rope_const_iterator<_CharT, _Alloc>& __y);\n\n  template<class _CharT, class _Alloc>\n    bool\n    operator<(const _Rope_const_iterator<_CharT, _Alloc>& __x,\n\t      const _Rope_const_iterator<_CharT, _Alloc>& __y);\n  \n  template<class _CharT, class _Alloc>\n    ptrdiff_t\n    operator-(const _Rope_const_iterator<_CharT, _Alloc>& __x,\n\t      const _Rope_const_iterator<_CharT, _Alloc>& __y);\n\n  template<class _CharT, class _Alloc>\n    _Rope_iterator<_CharT, _Alloc>\n    operator-(const _Rope_iterator<_CharT, _Alloc>& __x, ptrdiff_t __n);\n\n  template<class _CharT, class _Alloc>\n    _Rope_iterator<_CharT, _Alloc>\n    operator+(const _Rope_iterator<_CharT, _Alloc>& __x, ptrdiff_t __n);\n\n  template<class _CharT, class _Alloc>\n    _Rope_iterator<_CharT, _Alloc>\n    operator+(ptrdiff_t __n, const _Rope_iterator<_CharT, _Alloc>& __x);\n\n  template<class _CharT, class _Alloc>\n    bool\n    operator==(const _Rope_iterator<_CharT, _Alloc>& __x,\n\t       const _Rope_iterator<_CharT, _Alloc>& __y);\n\n  template<class _CharT, class _Alloc>\n    bool\n    operator<(const _Rope_iterator<_CharT, _Alloc>& __x,\n\t      const _Rope_iterator<_CharT, _Alloc>& __y);\n\n  template<class _CharT, class _Alloc>\n    ptrdiff_t\n    operator-(const _Rope_iterator<_CharT, _Alloc>& __x,\n\t      const _Rope_iterator<_CharT, _Alloc>& __y);\n\n  template<class _CharT, class _Alloc>\n    rope<_CharT, _Alloc>\n    operator+(const rope<_CharT, _Alloc>& __left,\n\t      const rope<_CharT, _Alloc>& __right);\n\n  template<class _CharT, class _Alloc>\n    rope<_CharT, _Alloc>\n    operator+(const rope<_CharT, _Alloc>& __left, const _CharT* __right);\n\n  template<class _CharT, class _Alloc>\n    rope<_CharT, _Alloc>\n    operator+(const rope<_CharT, _Alloc>& __left, _CharT __right);\n\n  // Some helpers, so we can use power on ropes.\n  // See below for why this isn't local to the implementation.\n  \n  // This uses a nonstandard refcount convention.\n  // The result has refcount 0.\n  template<class _CharT, class _Alloc>\n    struct _Rope_Concat_fn\n    : public std::binary_function<rope<_CharT, _Alloc>, rope<_CharT, _Alloc>,\n\t\t\t\t  rope<_CharT, _Alloc> >\n    {\n      rope<_CharT, _Alloc>\n      operator()(const rope<_CharT, _Alloc>& __x,\n\t\t const rope<_CharT, _Alloc>& __y)\n      { return __x + __y; }\n    };\n\n  template <class _CharT, class _Alloc>\n    inline rope<_CharT, _Alloc>\n    identity_element(_Rope_Concat_fn<_CharT, _Alloc>)\n    { return rope<_CharT, _Alloc>(); }\n\n  // Class _Refcount_Base provides a type, _RC_t, a data member,\n  // _M_ref_count, and member functions _M_incr and _M_decr, which perform\n  // atomic preincrement/predecrement.  The constructor initializes\n  // _M_ref_count.\n  struct _Refcount_Base\n  {\n    // The type _RC_t\n    typedef size_t _RC_t;\n    \n    // The data member _M_ref_count\n    volatile _RC_t _M_ref_count;\n\n    // Constructor\n    __gthread_mutex_t _M_ref_count_lock;\n\n    _Refcount_Base(_RC_t __n) : _M_ref_count(__n), _M_ref_count_lock()\n    {\n#ifdef __GTHREAD_MUTEX_INIT\n      __gthread_mutex_t __tmp = __GTHREAD_MUTEX_INIT;\n      _M_ref_count_lock = __tmp;\n#elif defined(__GTHREAD_MUTEX_INIT_FUNCTION)\n      __GTHREAD_MUTEX_INIT_FUNCTION (&_M_ref_count_lock);\n#else\n#error __GTHREAD_MUTEX_INIT or __GTHREAD_MUTEX_INIT_FUNCTION should be defined by gthr.h abstraction layer, report problem to libstdc++@gcc.gnu.org.\n#endif\n    }\n\n    void\n    _M_incr()\n    {\n      __gthread_mutex_lock(&_M_ref_count_lock);\n      ++_M_ref_count;\n      __gthread_mutex_unlock(&_M_ref_count_lock);\n    }\n\n    _RC_t\n    _M_decr()\n    {\n      __gthread_mutex_lock(&_M_ref_count_lock);\n      volatile _RC_t __tmp = --_M_ref_count;\n      __gthread_mutex_unlock(&_M_ref_count_lock);\n      return __tmp;\n    }\n  };\n\n  //\n  // What follows should really be local to rope.  Unfortunately,\n  // that doesn't work, since it makes it impossible to define generic\n  // equality on rope iterators.  According to the draft standard, the\n  // template parameters for such an equality operator cannot be inferred\n  // from the occurrence of a member class as a parameter.\n  // (SGI compilers in fact allow this, but the __result wouldn't be\n  // portable.)\n  // Similarly, some of the static member functions are member functions\n  // only to avoid polluting the global namespace, and to circumvent\n  // restrictions on type inference for template functions.\n  //\n\n  //\n  // The internal data structure for representing a rope.  This is\n  // private to the implementation.  A rope is really just a pointer\n  // to one of these.\n  //\n  // A few basic functions for manipulating this data structure\n  // are members of _RopeRep.  Most of the more complex algorithms\n  // are implemented as rope members.\n  //\n  // Some of the static member functions of _RopeRep have identically\n  // named functions in rope that simply invoke the _RopeRep versions.\n\n#define __ROPE_DEFINE_ALLOCS(__a) \\\n        __ROPE_DEFINE_ALLOC(_CharT,_Data) /* character data */ \\\n        typedef _Rope_RopeConcatenation<_CharT,__a> __C; \\\n        __ROPE_DEFINE_ALLOC(__C,_C) \\\n        typedef _Rope_RopeLeaf<_CharT,__a> __L; \\\n        __ROPE_DEFINE_ALLOC(__L,_L) \\\n        typedef _Rope_RopeFunction<_CharT,__a> __F; \\\n        __ROPE_DEFINE_ALLOC(__F,_F) \\\n        typedef _Rope_RopeSubstring<_CharT,__a> __S; \\\n        __ROPE_DEFINE_ALLOC(__S,_S)\n\n  //  Internal rope nodes potentially store a copy of the allocator\n  //  instance used to allocate them.  This is mostly redundant.\n  //  But the alternative would be to pass allocator instances around\n  //  in some form to nearly all internal functions, since any pointer\n  //  assignment may result in a zero reference count and thus require\n  //  deallocation.\n\n#define __STATIC_IF_SGI_ALLOC  /* not static */\n\n  template <class _CharT, class _Alloc>\n    struct _Rope_rep_base\n    : public _Alloc\n    {\n      typedef _Alloc allocator_type;\n\n      allocator_type\n      get_allocator() const\n      { return *static_cast<const _Alloc*>(this); }\n\n      _Rope_rep_base(size_t __size, const allocator_type&)\n      : _M_size(__size) { }\n\n      size_t _M_size;\n\n# define __ROPE_DEFINE_ALLOC(_Tp, __name) \\\n        typedef typename \\\n          _Alloc::template rebind<_Tp>::other __name##Alloc; \\\n        static _Tp* __name##_allocate(size_t __n) \\\n          { return __name##Alloc().allocate(__n); } \\\n        static void __name##_deallocate(_Tp *__p, size_t __n) \\\n          { __name##Alloc().deallocate(__p, __n); }\n      __ROPE_DEFINE_ALLOCS(_Alloc)\n# undef __ROPE_DEFINE_ALLOC\n    };\n\n  template<class _CharT, class _Alloc>\n    struct _Rope_RopeRep\n    : public _Rope_rep_base<_CharT, _Alloc>\n# ifndef __GC\n\t     , _Refcount_Base\n# endif\n    {\n    public:\n      __detail::_Tag _M_tag:8;\n      bool _M_is_balanced:8;\n      unsigned char _M_depth;\n      __GC_CONST _CharT* _M_c_string;\n      __gthread_mutex_t _M_c_string_lock;\n                        /* Flattened version of string, if needed.  */\n                        /* typically 0.                             */\n                        /* If it's not 0, then the memory is owned  */\n                        /* by this node.                            */\n                        /* In the case of a leaf, this may point to */\n                        /* the same memory as the data field.       */\n      typedef typename _Rope_rep_base<_CharT, _Alloc>::allocator_type\n        allocator_type;\n\n      using _Rope_rep_base<_CharT, _Alloc>::get_allocator;\n\n      _Rope_RopeRep(__detail::_Tag __t, int __d, bool __b, size_t __size,\n\t\t    allocator_type __a)\n      : _Rope_rep_base<_CharT, _Alloc>(__size, __a),\n#ifndef __GC\n\t_Refcount_Base(1),\n#endif\n\t_M_tag(__t), _M_is_balanced(__b), _M_depth(__d), _M_c_string(0)\n#ifdef __GTHREAD_MUTEX_INIT\n    {\n      // Do not copy a POSIX/gthr mutex once in use.  However, bits are bits.\n      __gthread_mutex_t __tmp = __GTHREAD_MUTEX_INIT;\n      _M_c_string_lock = __tmp;\n    }\n#else\n    { __GTHREAD_MUTEX_INIT_FUNCTION (&_M_c_string_lock); }\n#endif\n#ifdef __GC\n      void\n      _M_incr () { }\n#endif\n      static void\n      _S_free_string(__GC_CONST _CharT*, size_t __len,\n\t\t     allocator_type __a);\n#define __STL_FREE_STRING(__s, __l, __a) _S_free_string(__s, __l, __a);\n                        // Deallocate data section of a leaf.\n                        // This shouldn't be a member function.\n                        // But its hard to do anything else at the\n                        // moment, because it's templatized w.r.t.\n                        // an allocator.\n                        // Does nothing if __GC is defined.\n#ifndef __GC\n      void _M_free_c_string();\n      void _M_free_tree();\n      // Deallocate t. Assumes t is not 0.\n      void\n      _M_unref_nonnil()\n      {\n\tif (0 == _M_decr())\n\t  _M_free_tree();\n      }\n\n      void\n      _M_ref_nonnil()\n      { _M_incr(); }\n\n      static void\n      _S_unref(_Rope_RopeRep* __t)\n      {\n\tif (0 != __t)\n\t  __t->_M_unref_nonnil();\n      }\n\n      static void\n      _S_ref(_Rope_RopeRep* __t)\n      {\n\tif (0 != __t)\n\t  __t->_M_incr();\n      }\n      \n      static void\n      _S_free_if_unref(_Rope_RopeRep* __t)\n      {\n\tif (0 != __t && 0 == __t->_M_ref_count)\n\t  __t->_M_free_tree();\n      }\n#   else /* __GC */\n      void _M_unref_nonnil() { }\n      void _M_ref_nonnil() { }\n      static void _S_unref(_Rope_RopeRep*) { }\n      static void _S_ref(_Rope_RopeRep*) { }\n      static void _S_free_if_unref(_Rope_RopeRep*) { }\n#   endif\nprotected:\n      _Rope_RopeRep&\n      operator=(const _Rope_RopeRep&);\n\n      _Rope_RopeRep(const _Rope_RopeRep&);\n    };\n\n  template<class _CharT, class _Alloc>\n    struct _Rope_RopeLeaf\n    : public _Rope_RopeRep<_CharT, _Alloc>\n    {\n    public:\n      // Apparently needed by VC++\n      // The data fields of leaves are allocated with some\n      // extra space, to accommodate future growth and for basic\n      // character types, to hold a trailing eos character.\n      enum { _S_alloc_granularity = 8 };\n      \n      static size_t\n      _S_rounded_up_size(size_t __n)\n      {\n        size_t __size_with_eos;\n\t\n        if (_S_is_basic_char_type((_CharT*)0))\n\t  __size_with_eos = __n + 1;\n\telse\n\t  __size_with_eos = __n;\n#ifdef __GC\n\treturn __size_with_eos;\n#else\n\t// Allow slop for in-place expansion.\n\treturn ((__size_with_eos + size_t(_S_alloc_granularity) - 1)\n\t\t&~ (size_t(_S_alloc_granularity) - 1));\n#endif\n      }\n      __GC_CONST _CharT* _M_data; /* Not necessarily 0 terminated. */\n                                  /* The allocated size is         */\n                                  /* _S_rounded_up_size(size), except */\n                                  /* in the GC case, in which it   */\n                                  /* doesn't matter.               */\n      typedef typename _Rope_rep_base<_CharT,_Alloc>::allocator_type\n        allocator_type;\n\n      _Rope_RopeLeaf(__GC_CONST _CharT* __d, size_t __size,\n\t\t     allocator_type __a)\n      : _Rope_RopeRep<_CharT, _Alloc>(__detail::_S_leaf, 0, true,\n\t\t\t\t      __size, __a), _M_data(__d)\n      {\n        if (_S_is_basic_char_type((_CharT *)0))\n\t  {\n            // already eos terminated.\n            this->_M_c_string = __d;\n\t  }\n      }\n      // The constructor assumes that d has been allocated with\n      // the proper allocator and the properly padded size.\n      // In contrast, the destructor deallocates the data:\n#ifndef __GC\n      ~_Rope_RopeLeaf() throw()\n      {\n        if (_M_data != this->_M_c_string)\n\t  this->_M_free_c_string();\n\t\n        __STL_FREE_STRING(_M_data, this->_M_size, this->get_allocator());\n      }\n#endif\nprotected:\n      _Rope_RopeLeaf&\n      operator=(const _Rope_RopeLeaf&);\n\n      _Rope_RopeLeaf(const _Rope_RopeLeaf&);\n    };\n\n  template<class _CharT, class _Alloc>\n    struct _Rope_RopeConcatenation\n    : public _Rope_RopeRep<_CharT, _Alloc>\n    {\n    public:\n      _Rope_RopeRep<_CharT, _Alloc>* _M_left;\n      _Rope_RopeRep<_CharT, _Alloc>* _M_right;\n\n      typedef typename _Rope_rep_base<_CharT, _Alloc>::allocator_type\n        allocator_type;\n\n      _Rope_RopeConcatenation(_Rope_RopeRep<_CharT, _Alloc>* __l,\n\t\t\t      _Rope_RopeRep<_CharT, _Alloc>* __r,\n\t\t\t      allocator_type __a)\n\t: _Rope_RopeRep<_CharT, _Alloc>(__detail::_S_concat,\n\t\t\t\t      std::max(__l->_M_depth,\n\t\t\t\t\t       __r->_M_depth) + 1,\n\t\t\t\t      false,\n\t\t\t\t      __l->_M_size + __r->_M_size, __a),\n        _M_left(__l), _M_right(__r)\n      { }\n#ifndef __GC\n      ~_Rope_RopeConcatenation() throw()\n      {\n\tthis->_M_free_c_string();\n\t_M_left->_M_unref_nonnil();\n\t_M_right->_M_unref_nonnil();\n      }\n#endif\nprotected:\n      _Rope_RopeConcatenation&\n      operator=(const _Rope_RopeConcatenation&);\n      \n      _Rope_RopeConcatenation(const _Rope_RopeConcatenation&);\n    };\n\n  template<class _CharT, class _Alloc>\n    struct _Rope_RopeFunction\n    : public _Rope_RopeRep<_CharT, _Alloc>\n    {\n    public:\n      char_producer<_CharT>* _M_fn;\n#ifndef __GC\n      bool _M_delete_when_done; // Char_producer is owned by the\n                                // rope and should be explicitly\n                                // deleted when the rope becomes\n                                // inaccessible.\n#else\n      // In the GC case, we either register the rope for\n      // finalization, or not.  Thus the field is unnecessary;\n      // the information is stored in the collector data structures.\n      // We do need a finalization procedure to be invoked by the\n      // collector.\n      static void\n      _S_fn_finalization_proc(void * __tree, void *)\n      { delete ((_Rope_RopeFunction *)__tree) -> _M_fn; }\n#endif\n    typedef typename _Rope_rep_base<_CharT, _Alloc>::allocator_type\n      allocator_type;\n\n      _Rope_RopeFunction(char_producer<_CharT>* __f, size_t __size,\n                        bool __d, allocator_type __a)\n      : _Rope_RopeRep<_CharT, _Alloc>(__detail::_S_function, 0, true, __size, __a)\n\t, _M_fn(__f)\n#ifndef __GC\n\t, _M_delete_when_done(__d)\n#endif\n      {\n#ifdef __GC\n\tif (__d)\n\t  {\n\t    GC_REGISTER_FINALIZER(this, _Rope_RopeFunction::\n\t\t\t\t  _S_fn_finalization_proc, 0, 0, 0);\n\t  }\n#endif\n      }\n#ifndef __GC\n      ~_Rope_RopeFunction() throw()\n      {\n\tthis->_M_free_c_string();\n\tif (_M_delete_when_done)\n\t  delete _M_fn;\n      }\n# endif\n    protected:\n      _Rope_RopeFunction&\n      operator=(const _Rope_RopeFunction&);\n\n      _Rope_RopeFunction(const _Rope_RopeFunction&);\n    };\n  // Substring results are usually represented using just\n  // concatenation nodes.  But in the case of very long flat ropes\n  // or ropes with a functional representation that isn't practical.\n  // In that case, we represent the __result as a special case of\n  // RopeFunction, whose char_producer points back to the rope itself.\n  // In all cases except repeated substring operations and\n  // deallocation, we treat the __result as a RopeFunction.\n  template<class _CharT, class _Alloc>\n    struct _Rope_RopeSubstring\n    : public _Rope_RopeFunction<_CharT, _Alloc>,\n      public char_producer<_CharT>\n    {\n    public:\n      // XXX this whole class should be rewritten.\n      _Rope_RopeRep<_CharT,_Alloc>* _M_base;      // not 0\n      size_t _M_start;\n\n      virtual void\n      operator()(size_t __start_pos, size_t __req_len,\n\t\t _CharT* __buffer)\n      {\n        switch(_M_base->_M_tag)\n\t  {\n\t  case __detail::_S_function:\n\t  case __detail::_S_substringfn:\n\t    {\n\t      char_producer<_CharT>* __fn =\n\t\t((_Rope_RopeFunction<_CharT,_Alloc>*)_M_base)->_M_fn;\n\t      (*__fn)(__start_pos + _M_start, __req_len, __buffer);\n\t    }\n\t    break;\n\t  case __detail::_S_leaf:\n\t    {\n\t      __GC_CONST _CharT* __s =\n\t\t((_Rope_RopeLeaf<_CharT,_Alloc>*)_M_base)->_M_data;\n\t      uninitialized_copy_n(__s + __start_pos + _M_start, __req_len,\n\t\t\t\t   __buffer);\n\t    }\n\t    break;\n\t  default:\n\t    break;\n\t  }\n      }\n      \n      typedef typename _Rope_rep_base<_CharT, _Alloc>::allocator_type\n        allocator_type;\n\n      _Rope_RopeSubstring(_Rope_RopeRep<_CharT, _Alloc>* __b, size_t __s,\n                          size_t __l, allocator_type __a)\n      : _Rope_RopeFunction<_CharT, _Alloc>(this, __l, false, __a),\n        char_producer<_CharT>(), _M_base(__b), _M_start(__s)\n      {\n#ifndef __GC\n\t_M_base->_M_ref_nonnil();\n#endif\n        this->_M_tag = __detail::_S_substringfn;\n      }\n    virtual ~_Rope_RopeSubstring() throw()\n      {\n#ifndef __GC\n\t_M_base->_M_unref_nonnil();\n\t// _M_free_c_string();  -- done by parent class\n#endif\n      }\n    };\n\n  // Self-destructing pointers to Rope_rep.\n  // These are not conventional smart pointers.  Their\n  // only purpose in life is to ensure that unref is called\n  // on the pointer either at normal exit or if an exception\n  // is raised.  It is the caller's responsibility to\n  // adjust reference counts when these pointers are initialized\n  // or assigned to.  (This convention significantly reduces\n  // the number of potentially expensive reference count\n  // updates.)\n#ifndef __GC\n  template<class _CharT, class _Alloc>\n    struct _Rope_self_destruct_ptr\n    {\n      _Rope_RopeRep<_CharT, _Alloc>* _M_ptr;\n\n      ~_Rope_self_destruct_ptr()\n      { _Rope_RopeRep<_CharT, _Alloc>::_S_unref(_M_ptr); }\n#ifdef __EXCEPTIONS\n      _Rope_self_destruct_ptr() : _M_ptr(0) { };\n#else\n      _Rope_self_destruct_ptr() { };\n#endif\n      _Rope_self_destruct_ptr(_Rope_RopeRep<_CharT, _Alloc>* __p)\n      : _M_ptr(__p) { }\n    \n      _Rope_RopeRep<_CharT, _Alloc>&\n      operator*()\n      { return *_M_ptr; }\n    \n      _Rope_RopeRep<_CharT, _Alloc>*\n      operator->()\n      { return _M_ptr; }\n    \n      operator _Rope_RopeRep<_CharT, _Alloc>*()\n      { return _M_ptr; }\n    \n      _Rope_self_destruct_ptr&\n      operator=(_Rope_RopeRep<_CharT, _Alloc>* __x)\n      { _M_ptr = __x; return *this; }\n    };\n#endif\n\n  // Dereferencing a nonconst iterator has to return something\n  // that behaves almost like a reference.  It's not possible to\n  // return an actual reference since assignment requires extra\n  // work.  And we would get into the same problems as with the\n  // CD2 version of basic_string.\n  template<class _CharT, class _Alloc>\n    class _Rope_char_ref_proxy\n    {\n      friend class rope<_CharT, _Alloc>;\n      friend class _Rope_iterator<_CharT, _Alloc>;\n      friend class _Rope_char_ptr_proxy<_CharT, _Alloc>;\n#ifdef __GC\n      typedef _Rope_RopeRep<_CharT, _Alloc>* _Self_destruct_ptr;\n#else\n      typedef _Rope_self_destruct_ptr<_CharT, _Alloc> _Self_destruct_ptr;\n#endif\n      typedef _Rope_RopeRep<_CharT, _Alloc> _RopeRep;\n      typedef rope<_CharT, _Alloc> _My_rope;\n      size_t _M_pos;\n      _CharT _M_current;\n      bool _M_current_valid;\n      _My_rope* _M_root;     // The whole rope.\n    public:\n      _Rope_char_ref_proxy(_My_rope* __r, size_t __p)\n      :  _M_pos(__p), _M_current(), _M_current_valid(false), _M_root(__r) { }\n\n      _Rope_char_ref_proxy(const _Rope_char_ref_proxy& __x)\n      : _M_pos(__x._M_pos), _M_current(__x._M_current), \n\t_M_current_valid(false), _M_root(__x._M_root) { }\n\n      // Don't preserve cache if the reference can outlive the\n      // expression.  We claim that's not possible without calling\n      // a copy constructor or generating reference to a proxy\n      // reference.  We declare the latter to have undefined semantics.\n      _Rope_char_ref_proxy(_My_rope* __r, size_t __p, _CharT __c)\n      : _M_pos(__p), _M_current(__c), _M_current_valid(true), _M_root(__r) { }\n\n      inline operator _CharT () const;\n\n      _Rope_char_ref_proxy&\n      operator=(_CharT __c);\n    \n      _Rope_char_ptr_proxy<_CharT, _Alloc> operator&() const;\n      \n      _Rope_char_ref_proxy&\n      operator=(const _Rope_char_ref_proxy& __c)\n      { return operator=((_CharT)__c); }\n    };\n\n  template<class _CharT, class __Alloc>\n    inline void\n    swap(_Rope_char_ref_proxy <_CharT, __Alloc > __a,\n\t _Rope_char_ref_proxy <_CharT, __Alloc > __b)\n    {\n      _CharT __tmp = __a;\n      __a = __b;\n      __b = __tmp;\n    }\n\n  template<class _CharT, class _Alloc>\n    class _Rope_char_ptr_proxy\n    {\n      // XXX this class should be rewritten.\n      friend class _Rope_char_ref_proxy<_CharT, _Alloc>;\n      size_t _M_pos;\n      rope<_CharT,_Alloc>* _M_root;     // The whole rope.\n    public:\n      _Rope_char_ptr_proxy(const _Rope_char_ref_proxy<_CharT,_Alloc>& __x)\n      : _M_pos(__x._M_pos), _M_root(__x._M_root) { }\n\n      _Rope_char_ptr_proxy(const _Rope_char_ptr_proxy& __x)\n      : _M_pos(__x._M_pos), _M_root(__x._M_root) { }\n\n      _Rope_char_ptr_proxy() { }\n      \n      _Rope_char_ptr_proxy(_CharT* __x)\n      : _M_root(0), _M_pos(0) { }\n\n      _Rope_char_ptr_proxy&\n      operator=(const _Rope_char_ptr_proxy& __x)\n      {\n        _M_pos = __x._M_pos;\n        _M_root = __x._M_root;\n        return *this;\n      }\n\n      template<class _CharT2, class _Alloc2>\n        friend bool\n        operator==(const _Rope_char_ptr_proxy<_CharT2, _Alloc2>& __x,\n\t\t   const _Rope_char_ptr_proxy<_CharT2, _Alloc2>& __y);\n\n      _Rope_char_ref_proxy<_CharT, _Alloc> operator*() const\n      { return _Rope_char_ref_proxy<_CharT, _Alloc>(_M_root, _M_pos); }\n    };\n\n  // Rope iterators:\n  // Unlike in the C version, we cache only part of the stack\n  // for rope iterators, since they must be efficiently copyable.\n  // When we run out of cache, we have to reconstruct the iterator\n  // value.\n  // Pointers from iterators are not included in reference counts.\n  // Iterators are assumed to be thread private.  Ropes can\n  // be shared.\n  \n  template<class _CharT, class _Alloc>\n    class _Rope_iterator_base\n    : public iterator<std::random_access_iterator_tag, _CharT>\n    {\n      friend class rope<_CharT, _Alloc>;\n    public:\n      typedef _Alloc _allocator_type; // used in _Rope_rotate, VC++ workaround\n      typedef _Rope_RopeRep<_CharT, _Alloc> _RopeRep;\n      // Borland doesn't want this to be protected.\n    protected:\n      enum { _S_path_cache_len = 4 }; // Must be <= 9.\n      enum { _S_iterator_buf_len = 15 };\n      size_t _M_current_pos;\n      _RopeRep* _M_root;     // The whole rope.\n      size_t _M_leaf_pos;    // Starting position for current leaf\n      __GC_CONST _CharT* _M_buf_start;\n                             // Buffer possibly\n                             // containing current char.\n      __GC_CONST _CharT* _M_buf_ptr;\n                             // Pointer to current char in buffer.\n                             // != 0 ==> buffer valid.\n      __GC_CONST _CharT* _M_buf_end;\n                             // One past __last valid char in buffer.\n      // What follows is the path cache.  We go out of our\n      // way to make this compact.\n      // Path_end contains the bottom section of the path from\n      // the root to the current leaf.\n      const _RopeRep* _M_path_end[_S_path_cache_len];\n      int _M_leaf_index;     // Last valid __pos in path_end;\n                             // _M_path_end[0] ... _M_path_end[leaf_index-1]\n                             // point to concatenation nodes.\n      unsigned char _M_path_directions;\n                          // (path_directions >> __i) & 1 is 1\n                          // iff we got from _M_path_end[leaf_index - __i - 1]\n                          // to _M_path_end[leaf_index - __i] by going to the\n                          // __right. Assumes path_cache_len <= 9.\n      _CharT _M_tmp_buf[_S_iterator_buf_len];\n                        // Short buffer for surrounding chars.\n                        // This is useful primarily for\n                        // RopeFunctions.  We put the buffer\n                        // here to avoid locking in the\n                        // multithreaded case.\n      // The cached path is generally assumed to be valid\n      // only if the buffer is valid.\n      static void _S_setbuf(_Rope_iterator_base& __x);\n                                        // Set buffer contents given\n                                        // path cache.\n      static void _S_setcache(_Rope_iterator_base& __x);\n                                        // Set buffer contents and\n                                        // path cache.\n      static void _S_setcache_for_incr(_Rope_iterator_base& __x);\n                                        // As above, but assumes path\n                                        // cache is valid for previous posn.\n      _Rope_iterator_base() { }\n\n      _Rope_iterator_base(_RopeRep* __root, size_t __pos)\n      : _M_current_pos(__pos), _M_root(__root), _M_buf_ptr(0) { }\n\n      void _M_incr(size_t __n);\n      void _M_decr(size_t __n);\n    public:\n      size_t\n      index() const\n      { return _M_current_pos; }\n    \n      _Rope_iterator_base(const _Rope_iterator_base& __x)\n      {\n        if (0 != __x._M_buf_ptr)\n\t  *this = __x;\n\telse\n\t  {\n            _M_current_pos = __x._M_current_pos;\n            _M_root = __x._M_root;\n            _M_buf_ptr = 0;\n\t  }\n      }\n    };\n\n  template<class _CharT, class _Alloc>\n    class _Rope_iterator;\n\n  template<class _CharT, class _Alloc>\n    class _Rope_const_iterator\n    : public _Rope_iterator_base<_CharT, _Alloc>\n    {\n      friend class rope<_CharT, _Alloc>;\n    protected:\n      typedef _Rope_RopeRep<_CharT, _Alloc> _RopeRep;\n      // The one from the base class may not be directly visible.\n      _Rope_const_iterator(const _RopeRep* __root, size_t __pos)\n      : _Rope_iterator_base<_CharT, _Alloc>(const_cast<_RopeRep*>(__root),\n\t\t\t\t\t    __pos)\n                   // Only nonconst iterators modify root ref count\n      { }\n  public:\n      typedef _CharT reference;   // Really a value.  Returning a reference\n                                  // Would be a mess, since it would have\n                                  // to be included in refcount.\n      typedef const _CharT* pointer;\n\n    public:\n      _Rope_const_iterator() { };\n\n      _Rope_const_iterator(const _Rope_const_iterator& __x)\n      : _Rope_iterator_base<_CharT,_Alloc>(__x) { }\n\n      _Rope_const_iterator(const _Rope_iterator<_CharT,_Alloc>& __x);\n    \n      _Rope_const_iterator(const rope<_CharT, _Alloc>& __r, size_t __pos)\n      : _Rope_iterator_base<_CharT,_Alloc>(__r._M_tree_ptr, __pos) { }\n\n      _Rope_const_iterator&\n      operator=(const _Rope_const_iterator& __x)\n      {\n        if (0 != __x._M_buf_ptr)\n\t  *(static_cast<_Rope_iterator_base<_CharT, _Alloc>*>(this)) = __x;\n\telse\n\t  {\n            this->_M_current_pos = __x._M_current_pos;\n            this->_M_root = __x._M_root;\n            this->_M_buf_ptr = 0;\n\t  }\n        return(*this);\n      }\n\n      reference\n      operator*()\n      {\n        if (0 == this->_M_buf_ptr)\n\t  _S_setcache(*this);\n        return *this->_M_buf_ptr;\n      }\n\n      // Without this const version, Rope iterators do not meet the\n      // requirements of an Input Iterator.\n      reference\n      operator*() const\n      {\n\treturn *const_cast<_Rope_const_iterator&>(*this);\n      }\n\n      _Rope_const_iterator&\n      operator++()\n      {\n        __GC_CONST _CharT* __next;\n        if (0 != this->_M_buf_ptr\n\t    && (__next = this->_M_buf_ptr + 1) < this->_M_buf_end)\n\t  {\n            this->_M_buf_ptr = __next;\n            ++this->_M_current_pos;\n\t  }\n\telse\n\t  this->_M_incr(1);\n\treturn *this;\n      }\n\n      _Rope_const_iterator&\n      operator+=(ptrdiff_t __n)\n      {\n        if (__n >= 0)\n\t  this->_M_incr(__n);\n\telse\n\t  this->_M_decr(-__n);\n\treturn *this;\n      }\n\n      _Rope_const_iterator&\n      operator--()\n      {\n        this->_M_decr(1);\n        return *this;\n      }\n\n      _Rope_const_iterator&\n      operator-=(ptrdiff_t __n)\n      {\n        if (__n >= 0)\n\t  this->_M_decr(__n);\n\telse\n\t  this->_M_incr(-__n);\n\treturn *this;\n      }\n\n      _Rope_const_iterator\n      operator++(int)\n      {\n        size_t __old_pos = this->_M_current_pos;\n        this->_M_incr(1);\n        return _Rope_const_iterator<_CharT,_Alloc>(this->_M_root, __old_pos);\n        // This makes a subsequent dereference expensive.\n        // Perhaps we should instead copy the iterator\n        // if it has a valid cache?\n      }\n\n      _Rope_const_iterator\n      operator--(int)\n      {\n        size_t __old_pos = this->_M_current_pos;\n        this->_M_decr(1);\n        return _Rope_const_iterator<_CharT,_Alloc>(this->_M_root, __old_pos);\n      }\n\n      template<class _CharT2, class _Alloc2>\n        friend _Rope_const_iterator<_CharT2, _Alloc2>\n        operator-(const _Rope_const_iterator<_CharT2, _Alloc2>& __x,\n\t\t  ptrdiff_t __n);\n\n      template<class _CharT2, class _Alloc2>\n        friend _Rope_const_iterator<_CharT2, _Alloc2>\n        operator+(const _Rope_const_iterator<_CharT2, _Alloc2>& __x,\n\t\t  ptrdiff_t __n);\n\n      template<class _CharT2, class _Alloc2>\n        friend _Rope_const_iterator<_CharT2, _Alloc2>\n        operator+(ptrdiff_t __n,\n\t\t  const _Rope_const_iterator<_CharT2, _Alloc2>& __x);\n\n      reference\n      operator[](size_t __n)\n      { return rope<_CharT, _Alloc>::_S_fetch(this->_M_root,\n\t\t\t\t\t      this->_M_current_pos + __n); }\n\n      template<class _CharT2, class _Alloc2>\n        friend bool\n        operator==(const _Rope_const_iterator<_CharT2, _Alloc2>& __x,\n\t\t   const _Rope_const_iterator<_CharT2, _Alloc2>& __y);\n\n      template<class _CharT2, class _Alloc2>\n        friend bool\n        operator<(const _Rope_const_iterator<_CharT2, _Alloc2>& __x,\n\t\t  const _Rope_const_iterator<_CharT2, _Alloc2>& __y);\n\n      template<class _CharT2, class _Alloc2>\n        friend ptrdiff_t\n        operator-(const _Rope_const_iterator<_CharT2, _Alloc2>& __x,\n\t\t  const _Rope_const_iterator<_CharT2, _Alloc2>& __y);\n    };\n\n  template<class _CharT, class _Alloc>\n    class _Rope_iterator\n    : public _Rope_iterator_base<_CharT, _Alloc>\n    {\n      friend class rope<_CharT, _Alloc>;\n    protected:\n      typedef typename _Rope_iterator_base<_CharT, _Alloc>::_RopeRep _RopeRep;\n      rope<_CharT, _Alloc>* _M_root_rope;\n\n      // root is treated as a cached version of this, and is used to\n      // detect changes to the underlying rope.\n\n      // Root is included in the reference count.  This is necessary\n      // so that we can detect changes reliably.  Unfortunately, it\n      // requires careful bookkeeping for the nonGC case.\n      _Rope_iterator(rope<_CharT, _Alloc>* __r, size_t __pos)\n      : _Rope_iterator_base<_CharT, _Alloc>(__r->_M_tree_ptr, __pos),\n        _M_root_rope(__r)\n      { _RopeRep::_S_ref(this->_M_root);\n        if (!(__r -> empty()))\n\t  _S_setcache(*this);\n      }\n\n      void _M_check();\n    public:\n      typedef _Rope_char_ref_proxy<_CharT, _Alloc>  reference;\n      typedef _Rope_char_ref_proxy<_CharT, _Alloc>* pointer;\n\n      rope<_CharT, _Alloc>&\n      container()\n      { return *_M_root_rope; }\n\n      _Rope_iterator()\n      {\n        this->_M_root = 0;  // Needed for reference counting.\n      };\n\n      _Rope_iterator(const _Rope_iterator& __x)\n      : _Rope_iterator_base<_CharT, _Alloc>(__x)\n      {\n        _M_root_rope = __x._M_root_rope;\n        _RopeRep::_S_ref(this->_M_root);\n      }\n\n      _Rope_iterator(rope<_CharT, _Alloc>& __r, size_t __pos);\n\n      ~_Rope_iterator()\n      { _RopeRep::_S_unref(this->_M_root); }\n\n      _Rope_iterator&\n      operator=(const _Rope_iterator& __x)\n      {\n        _RopeRep* __old = this->_M_root;\n\t\n        _RopeRep::_S_ref(__x._M_root);\n        if (0 != __x._M_buf_ptr)\n\t  {\n            _M_root_rope = __x._M_root_rope;\n            *(static_cast<_Rope_iterator_base<_CharT, _Alloc>*>(this)) = __x;\n\t  }\n\telse\n\t  {\n\t    this->_M_current_pos = __x._M_current_pos;\n            this->_M_root = __x._M_root;\n            _M_root_rope = __x._M_root_rope;\n            this->_M_buf_ptr = 0;\n\t  }\n        _RopeRep::_S_unref(__old);\n        return(*this);\n      }\n\n      reference\n      operator*()\n      {\n        _M_check();\n        if (0 == this->_M_buf_ptr)\n\t  return _Rope_char_ref_proxy<_CharT, _Alloc>(_M_root_rope,\n\t\t\t\t\t\t      this->_M_current_pos);\n\telse\n\t  return _Rope_char_ref_proxy<_CharT, _Alloc>(_M_root_rope,\n\t\t\t\t\t\t      this->_M_current_pos,\n\t\t\t\t\t\t      *this->_M_buf_ptr);\n      }\n\n      // See above comment.\n      reference\n      operator*() const\n      {\n\treturn *const_cast<_Rope_iterator&>(*this);\n      }\n\n      _Rope_iterator&\n      operator++()\n      {\n        this->_M_incr(1);\n        return *this;\n      }\n\n      _Rope_iterator&\n      operator+=(ptrdiff_t __n)\n      {\n        if (__n >= 0)\n\t  this->_M_incr(__n);\n\telse\n\t  this->_M_decr(-__n);\n\treturn *this;\n      }\n\n      _Rope_iterator&\n      operator--()\n      {\n        this->_M_decr(1);\n        return *this;\n      }\n\n      _Rope_iterator&\n      operator-=(ptrdiff_t __n)\n      {\n        if (__n >= 0)\n\t  this->_M_decr(__n);\n\telse\n\t  this->_M_incr(-__n);\n\treturn *this;\n      }\n\n      _Rope_iterator\n      operator++(int)\n      {\n        size_t __old_pos = this->_M_current_pos;\n        this->_M_incr(1);\n        return _Rope_iterator<_CharT,_Alloc>(_M_root_rope, __old_pos);\n      }\n\n      _Rope_iterator\n      operator--(int)\n      {\n        size_t __old_pos = this->_M_current_pos;\n        this->_M_decr(1);\n        return _Rope_iterator<_CharT,_Alloc>(_M_root_rope, __old_pos);\n      }\n\n      reference\n      operator[](ptrdiff_t __n)\n      { return _Rope_char_ref_proxy<_CharT, _Alloc>(_M_root_rope,\n\t\t\t\t\t\t    this->_M_current_pos\n\t\t\t\t\t\t    + __n); }\n\n      template<class _CharT2, class _Alloc2>\n        friend bool\n        operator==(const _Rope_iterator<_CharT2, _Alloc2>& __x,\n\t\t   const _Rope_iterator<_CharT2, _Alloc2>& __y);\n\n      template<class _CharT2, class _Alloc2>\n        friend bool\n        operator<(const _Rope_iterator<_CharT2, _Alloc2>& __x,\n\t\t  const _Rope_iterator<_CharT2, _Alloc2>& __y);\n\n      template<class _CharT2, class _Alloc2>\n        friend ptrdiff_t\n        operator-(const _Rope_iterator<_CharT2, _Alloc2>& __x,\n\t\t  const _Rope_iterator<_CharT2, _Alloc2>& __y);\n\n      template<class _CharT2, class _Alloc2>\n        friend _Rope_iterator<_CharT2, _Alloc2>\n        operator-(const _Rope_iterator<_CharT2, _Alloc2>& __x, ptrdiff_t __n);\n\n      template<class _CharT2, class _Alloc2>\n        friend _Rope_iterator<_CharT2, _Alloc2>\n        operator+(const _Rope_iterator<_CharT2, _Alloc2>& __x, ptrdiff_t __n);\n\n      template<class _CharT2, class _Alloc2>\n        friend _Rope_iterator<_CharT2, _Alloc2>\n        operator+(ptrdiff_t __n, const _Rope_iterator<_CharT2, _Alloc2>& __x);\n    };\n\n\n  template <class _CharT, class _Alloc>\n    struct _Rope_base\n    : public _Alloc\n    {\n      typedef _Alloc allocator_type;\n\n      allocator_type\n      get_allocator() const\n      { return *static_cast<const _Alloc*>(this); }\n\n      typedef _Rope_RopeRep<_CharT, _Alloc> _RopeRep;\n      // The one in _Base may not be visible due to template rules.\n\n      _Rope_base(_RopeRep* __t, const allocator_type&)\n      : _M_tree_ptr(__t) { }\n\n      _Rope_base(const allocator_type&) { }\n\n      // The only data member of a rope:\n      _RopeRep *_M_tree_ptr;\n\n#define __ROPE_DEFINE_ALLOC(_Tp, __name) \\\n        typedef typename \\\n          _Alloc::template rebind<_Tp>::other __name##Alloc; \\\n        static _Tp* __name##_allocate(size_t __n) \\\n          { return __name##Alloc().allocate(__n); } \\\n        static void __name##_deallocate(_Tp *__p, size_t __n) \\\n          { __name##Alloc().deallocate(__p, __n); }\n      __ROPE_DEFINE_ALLOCS(_Alloc)\n#undef __ROPE_DEFINE_ALLOC\n\n\tprotected:\n      _Rope_base&\n      operator=(const _Rope_base&);\n      \n      _Rope_base(const _Rope_base&);\n    };\n\n  /**\n   *  This is an SGI extension.\n   *  @ingroup SGIextensions\n   *  @doctodo\n   */\n  template <class _CharT, class _Alloc>\n    class rope : public _Rope_base<_CharT, _Alloc>\n    {\n    public:\n      typedef _CharT value_type;\n      typedef ptrdiff_t difference_type;\n      typedef size_t size_type;\n      typedef _CharT const_reference;\n      typedef const _CharT* const_pointer;\n      typedef _Rope_iterator<_CharT, _Alloc> iterator;\n      typedef _Rope_const_iterator<_CharT, _Alloc> const_iterator;\n      typedef _Rope_char_ref_proxy<_CharT, _Alloc> reference;\n      typedef _Rope_char_ptr_proxy<_CharT, _Alloc> pointer;\n\n      friend class _Rope_iterator<_CharT, _Alloc>;\n      friend class _Rope_const_iterator<_CharT, _Alloc>;\n      friend struct _Rope_RopeRep<_CharT, _Alloc>;\n      friend class _Rope_iterator_base<_CharT, _Alloc>;\n      friend class _Rope_char_ptr_proxy<_CharT, _Alloc>;\n      friend class _Rope_char_ref_proxy<_CharT, _Alloc>;\n      friend struct _Rope_RopeSubstring<_CharT, _Alloc>;\n\n    protected:\n      typedef _Rope_base<_CharT, _Alloc> _Base;\n      typedef typename _Base::allocator_type allocator_type;\n      using _Base::_M_tree_ptr;\n      using _Base::get_allocator;\n      typedef __GC_CONST _CharT* _Cstrptr;\n      \n      static _CharT _S_empty_c_str[1];\n      \n      static bool\n      _S_is0(_CharT __c)\n      { return __c == _S_eos((_CharT*)0); }\n      \n      enum { _S_copy_max = 23 };\n                // For strings shorter than _S_copy_max, we copy to\n                // concatenate.\n\n      typedef _Rope_RopeRep<_CharT, _Alloc> _RopeRep;\n      typedef _Rope_RopeConcatenation<_CharT, _Alloc> _RopeConcatenation;\n      typedef _Rope_RopeLeaf<_CharT, _Alloc> _RopeLeaf;\n      typedef _Rope_RopeFunction<_CharT, _Alloc> _RopeFunction;\n      typedef _Rope_RopeSubstring<_CharT, _Alloc> _RopeSubstring;\n\n      // Retrieve a character at the indicated position.\n      static _CharT _S_fetch(_RopeRep* __r, size_type __pos);\n\n#ifndef __GC\n      // Obtain a pointer to the character at the indicated position.\n      // The pointer can be used to change the character.\n      // If such a pointer cannot be produced, as is frequently the\n      // case, 0 is returned instead.\n      // (Returns nonzero only if all nodes in the path have a refcount\n      // of 1.)\n      static _CharT* _S_fetch_ptr(_RopeRep* __r, size_type __pos);\n#endif\n\n      static bool\n      _S_apply_to_pieces(// should be template parameter\n\t\t\t _Rope_char_consumer<_CharT>& __c,\n\t\t\t const _RopeRep* __r,\n\t\t\t size_t __begin, size_t __end);\n                         // begin and end are assumed to be in range.\n\n#ifndef __GC\n      static void\n      _S_unref(_RopeRep* __t)\n      { _RopeRep::_S_unref(__t); }\n\n      static void\n      _S_ref(_RopeRep* __t)\n      { _RopeRep::_S_ref(__t); }\n\n#else /* __GC */\n      static void _S_unref(_RopeRep*) { }\n      static void _S_ref(_RopeRep*) { }\n#endif\n\n#ifdef __GC\n      typedef _Rope_RopeRep<_CharT, _Alloc>* _Self_destruct_ptr;\n#else\n      typedef _Rope_self_destruct_ptr<_CharT, _Alloc> _Self_destruct_ptr;\n#endif\n\n      // _Result is counted in refcount.\n      static _RopeRep* _S_substring(_RopeRep* __base,\n                                    size_t __start, size_t __endp1);\n\n      static _RopeRep* _S_concat_char_iter(_RopeRep* __r,\n\t\t\t\t\t   const _CharT* __iter, size_t __slen);\n      // Concatenate rope and char ptr, copying __s.\n      // Should really take an arbitrary iterator.\n      // Result is counted in refcount.\n      static _RopeRep* _S_destr_concat_char_iter(_RopeRep* __r,\n\t\t\t\t\t\t const _CharT* __iter,\n\t\t\t\t\t\t size_t __slen)\n\t// As above, but one reference to __r is about to be\n\t// destroyed.  Thus the pieces may be recycled if all\n\t// relevant reference counts are 1.\n#ifdef __GC\n\t// We can't really do anything since refcounts are unavailable.\n      { return _S_concat_char_iter(__r, __iter, __slen); }\n#else\n      ;\n#endif\n\n      static _RopeRep* _S_concat(_RopeRep* __left, _RopeRep* __right);\n      // General concatenation on _RopeRep.  _Result\n      // has refcount of 1.  Adjusts argument refcounts.\n\n   public:\n      void\n      apply_to_pieces(size_t __begin, size_t __end,\n\t\t      _Rope_char_consumer<_CharT>& __c) const\n      { _S_apply_to_pieces(__c, this->_M_tree_ptr, __begin, __end); }\n\n   protected:\n\n      static size_t\n      _S_rounded_up_size(size_t __n)\n      { return _RopeLeaf::_S_rounded_up_size(__n); }\n\n      static size_t\n      _S_allocated_capacity(size_t __n)\n      {\n\tif (_S_is_basic_char_type((_CharT*)0))\n\t  return _S_rounded_up_size(__n) - 1;\n\telse\n\t  return _S_rounded_up_size(__n);\n\t\n      }\n\n      // Allocate and construct a RopeLeaf using the supplied allocator\n      // Takes ownership of s instead of copying.\n      static _RopeLeaf*\n      _S_new_RopeLeaf(__GC_CONST _CharT *__s,\n\t\t      size_t __size, allocator_type __a)\n      {\n\t_RopeLeaf* __space = typename _Base::_LAlloc(__a).allocate(1);\n\treturn new(__space) _RopeLeaf(__s, __size, __a);\n      }\n\n      static _RopeConcatenation*\n      _S_new_RopeConcatenation(_RopeRep* __left, _RopeRep* __right,\n\t\t\t       allocator_type __a)\n      {\n\t_RopeConcatenation* __space = typename _Base::_CAlloc(__a).allocate(1);\n\treturn new(__space) _RopeConcatenation(__left, __right, __a);\n      }\n\n      static _RopeFunction*\n      _S_new_RopeFunction(char_producer<_CharT>* __f,\n\t\t\t  size_t __size, bool __d, allocator_type __a)\n      {\n\t_RopeFunction* __space = typename _Base::_FAlloc(__a).allocate(1);\n\treturn new(__space) _RopeFunction(__f, __size, __d, __a);\n      }\n\n      static _RopeSubstring*\n      _S_new_RopeSubstring(_Rope_RopeRep<_CharT,_Alloc>* __b, size_t __s,\n\t\t\t   size_t __l, allocator_type __a)\n      {\n\t_RopeSubstring* __space = typename _Base::_SAlloc(__a).allocate(1);\n\treturn new(__space) _RopeSubstring(__b, __s, __l, __a);\n      }\n      \n      static _RopeLeaf*\n      _S_RopeLeaf_from_unowned_char_ptr(const _CharT *__s,\n\t\t\t\t\tsize_t __size, allocator_type __a)\n#define __STL_ROPE_FROM_UNOWNED_CHAR_PTR(__s, __size, __a) \\\n                _S_RopeLeaf_from_unowned_char_ptr(__s, __size, __a)\n      {\n\tif (0 == __size)\n\t  return 0;\n\t_CharT* __buf = __a.allocate(_S_rounded_up_size(__size));\n\t\n\t__uninitialized_copy_n_a(__s, __size, __buf, __a);\n\t_S_cond_store_eos(__buf[__size]);\n\ttry\n\t  { return _S_new_RopeLeaf(__buf, __size, __a); }\n\tcatch(...)\n\t  {\n\t    _RopeRep::__STL_FREE_STRING(__buf, __size, __a);\n\t    __throw_exception_again;\n\t  }\n      }\n\n      // Concatenation of nonempty strings.\n      // Always builds a concatenation node.\n      // Rebalances if the result is too deep.\n      // Result has refcount 1.\n      // Does not increment left and right ref counts even though\n      // they are referenced.\n      static _RopeRep*\n      _S_tree_concat(_RopeRep* __left, _RopeRep* __right);\n\n      // Concatenation helper functions\n      static _RopeLeaf*\n      _S_leaf_concat_char_iter(_RopeLeaf* __r,\n\t\t\t       const _CharT* __iter, size_t __slen);\n      // Concatenate by copying leaf.\n      // should take an arbitrary iterator\n      // result has refcount 1.\n#ifndef __GC\n      static _RopeLeaf*\n      _S_destr_leaf_concat_char_iter(_RopeLeaf* __r,\n\t\t\t\t     const _CharT* __iter, size_t __slen);\n      // A version that potentially clobbers __r if __r->_M_ref_count == 1.\n#endif\n\n    private:\n      \n      static size_t _S_char_ptr_len(const _CharT* __s);\n      // slightly generalized strlen\n\n      rope(_RopeRep* __t, const allocator_type& __a = allocator_type())\n      : _Base(__t, __a) { }\n\n\n      // Copy __r to the _CharT buffer.\n      // Returns __buffer + __r->_M_size.\n      // Assumes that buffer is uninitialized.\n      static _CharT* _S_flatten(_RopeRep* __r, _CharT* __buffer);\n\n      // Again, with explicit starting position and length.\n      // Assumes that buffer is uninitialized.\n      static _CharT* _S_flatten(_RopeRep* __r,\n\t\t\t\tsize_t __start, size_t __len,\n\t\t\t\t_CharT* __buffer);\n\n      static const unsigned long\n      _S_min_len[__detail::_S_max_rope_depth + 1];\n      \n      static bool\n      _S_is_balanced(_RopeRep* __r)\n      { return (__r->_M_size >= _S_min_len[__r->_M_depth]); }\n\n      static bool\n      _S_is_almost_balanced(_RopeRep* __r)\n      { return (__r->_M_depth == 0\n\t\t|| __r->_M_size >= _S_min_len[__r->_M_depth - 1]); }\n\n      static bool\n      _S_is_roughly_balanced(_RopeRep* __r)\n      { return (__r->_M_depth <= 1\n\t\t|| __r->_M_size >= _S_min_len[__r->_M_depth - 2]); }\n\n      // Assumes the result is not empty.\n      static _RopeRep*\n      _S_concat_and_set_balanced(_RopeRep* __left, _RopeRep* __right)\n      {\n\t_RopeRep* __result = _S_concat(__left, __right);\n\tif (_S_is_balanced(__result))\n\t  __result->_M_is_balanced = true;\n\treturn __result;\n      }\n\n      // The basic rebalancing operation.  Logically copies the\n      // rope.  The result has refcount of 1.  The client will\n      // usually decrement the reference count of __r.\n      // The result is within height 2 of balanced by the above\n      // definition.\n      static _RopeRep* _S_balance(_RopeRep* __r);\n\n      // Add all unbalanced subtrees to the forest of balanceed trees.\n      // Used only by balance.\n      static void _S_add_to_forest(_RopeRep*__r, _RopeRep** __forest);\n\n      // Add __r to forest, assuming __r is already balanced.\n      static void _S_add_leaf_to_forest(_RopeRep* __r, _RopeRep** __forest);\n      \n      // Print to stdout, exposing structure\n      static void _S_dump(_RopeRep* __r, int __indent = 0);\n      \n      // Return -1, 0, or 1 if __x < __y, __x == __y, or __x > __y resp.\n      static int _S_compare(const _RopeRep* __x, const _RopeRep* __y);\n      \n    public:\n      bool\n      empty() const\n      { return 0 == this->_M_tree_ptr; }\n      \n      // Comparison member function.  This is public only for those\n      // clients that need a ternary comparison.  Others\n      // should use the comparison operators below.\n      int\n      compare(const rope& __y) const\n      { return _S_compare(this->_M_tree_ptr, __y._M_tree_ptr); }\n\n      rope(const _CharT* __s, const allocator_type& __a = allocator_type())\n      : _Base(__STL_ROPE_FROM_UNOWNED_CHAR_PTR(__s, _S_char_ptr_len(__s),\n\t\t\t\t\t       __a), __a)\n      { }\n\n      rope(const _CharT* __s, size_t __len,\n\t   const allocator_type& __a = allocator_type())\n      : _Base(__STL_ROPE_FROM_UNOWNED_CHAR_PTR(__s, __len, __a), __a)\n      { }\n\n      // Should perhaps be templatized with respect to the iterator type\n      // and use Sequence_buffer.  (It should perhaps use sequence_buffer\n      // even now.)\n      rope(const _CharT *__s, const _CharT *__e,\n\t   const allocator_type& __a = allocator_type())\n      : _Base(__STL_ROPE_FROM_UNOWNED_CHAR_PTR(__s, __e - __s, __a), __a)\n      { }\n\n      rope(const const_iterator& __s, const const_iterator& __e,\n\t   const allocator_type& __a = allocator_type())\n      : _Base(_S_substring(__s._M_root, __s._M_current_pos,\n\t\t\t   __e._M_current_pos), __a)\n      { }\n\n      rope(const iterator& __s, const iterator& __e,\n\t   const allocator_type& __a = allocator_type())\n      : _Base(_S_substring(__s._M_root, __s._M_current_pos,\n\t\t\t   __e._M_current_pos), __a)\n      { }\n\n      rope(_CharT __c, const allocator_type& __a = allocator_type())\n      : _Base(__a)\n      {\n\t_CharT* __buf = this->_Data_allocate(_S_rounded_up_size(1));\n\t\n\tget_allocator().construct(__buf, __c);\n\ttry\n\t  { this->_M_tree_ptr = _S_new_RopeLeaf(__buf, 1, __a); }\n\tcatch(...)\n\t  {\n\t    _RopeRep::__STL_FREE_STRING(__buf, 1, __a);\n\t    __throw_exception_again;\n\t  }\n      }\n\n      rope(size_t __n, _CharT __c,\n\t   const allocator_type& __a = allocator_type());\n\n      rope(const allocator_type& __a = allocator_type())\n      : _Base(0, __a) { }\n\n      // Construct a rope from a function that can compute its members\n      rope(char_producer<_CharT> *__fn, size_t __len, bool __delete_fn,\n\t   const allocator_type& __a = allocator_type())\n      : _Base(__a)\n      {\n\tthis->_M_tree_ptr = (0 == __len) ?\n\t  0 : _S_new_RopeFunction(__fn, __len, __delete_fn, __a);\n      }\n\n      rope(const rope& __x, const allocator_type& __a = allocator_type())\n      : _Base(__x._M_tree_ptr, __a)\n      { _S_ref(this->_M_tree_ptr); }\n\n      ~rope() throw()\n      { _S_unref(this->_M_tree_ptr); }\n\n      rope&\n      operator=(const rope& __x)\n      {\n\t_RopeRep* __old = this->_M_tree_ptr;\n\tthis->_M_tree_ptr = __x._M_tree_ptr;\n\t_S_ref(this->_M_tree_ptr);\n\t_S_unref(__old);\n\treturn *this;\n      }\n\n      void\n      clear()\n      {\n\t_S_unref(this->_M_tree_ptr);\n\tthis->_M_tree_ptr = 0;\n      }\n      \n      void\n      push_back(_CharT __x)\n      {\n\t_RopeRep* __old = this->_M_tree_ptr;\n\tthis->_M_tree_ptr\n\t  = _S_destr_concat_char_iter(this->_M_tree_ptr, &__x, 1);\n\t_S_unref(__old);\n      }\n\n      void\n      pop_back()\n      {\n\t_RopeRep* __old = this->_M_tree_ptr;\n\tthis->_M_tree_ptr = _S_substring(this->_M_tree_ptr,\n\t\t\t\t\t 0, this->_M_tree_ptr->_M_size - 1);\n\t_S_unref(__old);\n      }\n\n      _CharT\n      back() const\n      { return _S_fetch(this->_M_tree_ptr, this->_M_tree_ptr->_M_size - 1); }\n\n      void\n      push_front(_CharT __x)\n      {\n\t_RopeRep* __old = this->_M_tree_ptr;\n\t_RopeRep* __left =\n\t  __STL_ROPE_FROM_UNOWNED_CHAR_PTR(&__x, 1, this->get_allocator());\n\ttry\n\t  {\n\t    this->_M_tree_ptr = _S_concat(__left, this->_M_tree_ptr);\n\t    _S_unref(__old);\n\t    _S_unref(__left);\n\t  }\n\tcatch(...)\n\t  {\n\t    _S_unref(__left);\n\t    __throw_exception_again;\n\t  }\n      }\n\n      void\n      pop_front()\n      {\n\t_RopeRep* __old = this->_M_tree_ptr;\n\tthis->_M_tree_ptr\n\t  = _S_substring(this->_M_tree_ptr, 1, this->_M_tree_ptr->_M_size);\n\t_S_unref(__old);\n      }\n\n      _CharT\n      front() const\n      { return _S_fetch(this->_M_tree_ptr, 0); }\n\n      void\n      balance()\n      {\n\t_RopeRep* __old = this->_M_tree_ptr;\n\tthis->_M_tree_ptr = _S_balance(this->_M_tree_ptr);\n\t_S_unref(__old);\n      }\n      \n      void\n      copy(_CharT* __buffer) const\n      {\n\t_Destroy(__buffer, __buffer + size(), get_allocator());\n\t_S_flatten(this->_M_tree_ptr, __buffer);\n      }\n\n      // This is the copy function from the standard, but\n      // with the arguments reordered to make it consistent with the\n      // rest of the interface.\n      // Note that this guaranteed not to compile if the draft standard\n      // order is assumed.\n      size_type\n      copy(size_type __pos, size_type __n, _CharT* __buffer) const\n      {\n\tsize_t __size = size();\n\tsize_t __len = (__pos + __n > __size? __size - __pos : __n);\n\t\n\t_Destroy(__buffer, __buffer + __len, get_allocator());\n\t_S_flatten(this->_M_tree_ptr, __pos, __len, __buffer);\n\treturn __len;\n      }\n\n      // Print to stdout, exposing structure.  May be useful for\n      // performance debugging.\n      void\n      dump()\n      { _S_dump(this->_M_tree_ptr); }\n      \n      // Convert to 0 terminated string in new allocated memory.\n      // Embedded 0s in the input do not terminate the copy.\n      const _CharT* c_str() const;\n\n      // As above, but lso use the flattened representation as the\n      // the new rope representation.\n      const _CharT* replace_with_c_str();\n      \n      // Reclaim memory for the c_str generated flattened string.\n      // Intentionally undocumented, since it's hard to say when this\n      // is safe for multiple threads.\n      void\n      delete_c_str ()\n      {\n\tif (0 == this->_M_tree_ptr)\n\t  return;\n\tif (__detail::_S_leaf == this->_M_tree_ptr->_M_tag &&\n\t    ((_RopeLeaf*)this->_M_tree_ptr)->_M_data ==\n\t    this->_M_tree_ptr->_M_c_string)\n\t  {\n\t    // Representation shared\n\t    return;\n\t  }\n#ifndef __GC\n\tthis->_M_tree_ptr->_M_free_c_string();\n#endif\n\tthis->_M_tree_ptr->_M_c_string = 0;\n      }\n\n      _CharT\n      operator[] (size_type __pos) const\n      { return _S_fetch(this->_M_tree_ptr, __pos); }\n\n      _CharT\n      at(size_type __pos) const\n      {\n\t// if (__pos >= size()) throw out_of_range;  // XXX\n\treturn (*this)[__pos];\n      }\n\n      const_iterator\n      begin() const\n      { return(const_iterator(this->_M_tree_ptr, 0)); }\n\n      // An easy way to get a const iterator from a non-const container.\n      const_iterator\n      const_begin() const\n      { return(const_iterator(this->_M_tree_ptr, 0)); }\n\n      const_iterator\n      end() const\n      { return(const_iterator(this->_M_tree_ptr, size())); }\n\n      const_iterator\n      const_end() const\n      { return(const_iterator(this->_M_tree_ptr, size())); }\n\n      size_type\n      size() const\n      {\treturn(0 == this->_M_tree_ptr? 0 : this->_M_tree_ptr->_M_size); }\n      \n      size_type\n      length() const\n      {\treturn size(); }\n\n      size_type\n      max_size() const\n      {\n\treturn _S_min_len[int(__detail::_S_max_rope_depth) - 1] - 1;\n\t//  Guarantees that the result can be sufficirntly\n\t//  balanced.  Longer ropes will probably still work,\n\t//  but it's harder to make guarantees.\n      }\n\n      typedef reverse_iterator<const_iterator> const_reverse_iterator;\n\n      const_reverse_iterator\n      rbegin() const\n      { return const_reverse_iterator(end()); }\n\n      const_reverse_iterator\n      const_rbegin() const\n      {\treturn const_reverse_iterator(end()); }\n\n      const_reverse_iterator\n      rend() const\n      { return const_reverse_iterator(begin()); }\n      \n      const_reverse_iterator\n      const_rend() const\n      {\treturn const_reverse_iterator(begin()); }\n\n      template<class _CharT2, class _Alloc2>\n        friend rope<_CharT2, _Alloc2>\n        operator+(const rope<_CharT2, _Alloc2>& __left,\n\t\t  const rope<_CharT2, _Alloc2>& __right);\n\n      template<class _CharT2, class _Alloc2>\n        friend rope<_CharT2, _Alloc2>\n        operator+(const rope<_CharT2, _Alloc2>& __left, const _CharT2* __right);\n\n      template<class _CharT2, class _Alloc2>\n        friend rope<_CharT2, _Alloc2>\n        operator+(const rope<_CharT2, _Alloc2>& __left, _CharT2 __right);\n\n      // The symmetric cases are intentionally omitted, since they're\n      // presumed to be less common, and we don't handle them as well.\n\n      // The following should really be templatized.  The first\n      // argument should be an input iterator or forward iterator with\n      // value_type _CharT.\n      rope&\n      append(const _CharT* __iter, size_t __n)\n      {\n\t_RopeRep* __result =\n\t  _S_destr_concat_char_iter(this->_M_tree_ptr, __iter, __n);\n\t_S_unref(this->_M_tree_ptr);\n\tthis->_M_tree_ptr = __result;\n\treturn *this;\n      }\n\n      rope&\n      append(const _CharT* __c_string)\n      {\n\tsize_t __len = _S_char_ptr_len(__c_string);\n\tappend(__c_string, __len);\n\treturn(*this);\n      }\n\n      rope&\n      append(const _CharT* __s, const _CharT* __e)\n      {\n\t_RopeRep* __result =\n\t  _S_destr_concat_char_iter(this->_M_tree_ptr, __s, __e - __s);\n\t_S_unref(this->_M_tree_ptr);\n\tthis->_M_tree_ptr = __result;\n\treturn *this;\n      }\n\n      rope&\n      append(const_iterator __s, const_iterator __e)\n      {\n\t_Self_destruct_ptr __appendee(_S_substring(__s._M_root,\n\t\t\t\t\t\t   __s._M_current_pos,\n\t\t\t\t\t\t   __e._M_current_pos));\n\t_RopeRep* __result = _S_concat(this->_M_tree_ptr, \n\t\t\t\t       (_RopeRep*)__appendee);\n\t_S_unref(this->_M_tree_ptr);\n\tthis->_M_tree_ptr = __result;\n\treturn *this;\n      }\n\n      rope&\n      append(_CharT __c)\n      {\n\t_RopeRep* __result =\n\t  _S_destr_concat_char_iter(this->_M_tree_ptr, &__c, 1);\n\t_S_unref(this->_M_tree_ptr);\n\tthis->_M_tree_ptr = __result;\n\treturn *this;\n      }\n\n      rope&\n      append()\n      { return append(_CharT()); }  // XXX why?\n\n      rope&\n      append(const rope& __y)\n      {\n\t_RopeRep* __result = _S_concat(this->_M_tree_ptr, __y._M_tree_ptr);\n\t_S_unref(this->_M_tree_ptr);\n\tthis->_M_tree_ptr = __result;\n\treturn *this;\n      }\n\n      rope&\n      append(size_t __n, _CharT __c)\n      {\n\trope<_CharT,_Alloc> __last(__n, __c);\n\treturn append(__last);\n      }\n\n      void\n      swap(rope& __b)\n      {\n\t_RopeRep* __tmp = this->_M_tree_ptr;\n\tthis->_M_tree_ptr = __b._M_tree_ptr;\n\t__b._M_tree_ptr = __tmp;\n      }\n\n    protected:\n      // Result is included in refcount.\n      static _RopeRep*\n      replace(_RopeRep* __old, size_t __pos1,\n\t      size_t __pos2, _RopeRep* __r)\n      {\n\tif (0 == __old)\n\t  {\n\t    _S_ref(__r);\n\t    return __r;\n\t  }\n\t_Self_destruct_ptr __left(_S_substring(__old, 0, __pos1));\n\t_Self_destruct_ptr __right(_S_substring(__old, __pos2, __old->_M_size));\n\t_RopeRep* __result;\n\n\tif (0 == __r)\n\t  __result = _S_concat(__left, __right);\n\telse\n\t  {\n\t    _Self_destruct_ptr __left_result(_S_concat(__left, __r));\n\t    __result = _S_concat(__left_result, __right);\n\t  }\n\treturn __result;\n      }\n\n    public:\n      void\n      insert(size_t __p, const rope& __r)\n      {\n\t_RopeRep* __result =\n\t  replace(this->_M_tree_ptr, __p, __p, __r._M_tree_ptr);\n\t_S_unref(this->_M_tree_ptr);\n\tthis->_M_tree_ptr = __result;\n      }\n\n      void\n      insert(size_t __p, size_t __n, _CharT __c)\n      {\n\trope<_CharT,_Alloc> __r(__n,__c);\n\tinsert(__p, __r);\n      }\n      \n      void\n      insert(size_t __p, const _CharT* __i, size_t __n)\n      {\n\t_Self_destruct_ptr __left(_S_substring(this->_M_tree_ptr, 0, __p));\n\t_Self_destruct_ptr __right(_S_substring(this->_M_tree_ptr,\n\t\t\t\t\t\t__p, size()));\n\t_Self_destruct_ptr __left_result(_S_concat_char_iter(__left, __i, __n));\n\t// _S_ destr_concat_char_iter should be safe here.\n\t// But as it stands it's probably not a win, since __left\n\t// is likely to have additional references.\n\t_RopeRep* __result = _S_concat(__left_result, __right);\n\t_S_unref(this->_M_tree_ptr);\n\tthis->_M_tree_ptr = __result;\n      }\n\n      void\n      insert(size_t __p, const _CharT* __c_string)\n      {\tinsert(__p, __c_string, _S_char_ptr_len(__c_string)); }\n\n      void\n      insert(size_t __p, _CharT __c)\n      { insert(__p, &__c, 1); }\n\n      void\n      insert(size_t __p)\n      {\n\t_CharT __c = _CharT();\n\tinsert(__p, &__c, 1);\n      }\n\n      void\n      insert(size_t __p, const _CharT* __i, const _CharT* __j)\n      {\n\trope __r(__i, __j);\n\tinsert(__p, __r);\n      }\n\n      void\n      insert(size_t __p, const const_iterator& __i,\n\t     const const_iterator& __j)\n      {\n\trope __r(__i, __j);\n\tinsert(__p, __r);\n      }\n\n      void\n      insert(size_t __p, const iterator& __i,\n\t     const iterator& __j)\n      {\n\trope __r(__i, __j);\n\tinsert(__p, __r);\n      }\n\n      // (position, length) versions of replace operations:\n      \n      void\n      replace(size_t __p, size_t __n, const rope& __r)\n      {\n\t_RopeRep* __result =\n\t  replace(this->_M_tree_ptr, __p, __p + __n, __r._M_tree_ptr);\n\t_S_unref(this->_M_tree_ptr);\n\tthis->_M_tree_ptr = __result;\n      }\n\n      void\n      replace(size_t __p, size_t __n,\n\t      const _CharT* __i, size_t __i_len)\n      {\n\trope __r(__i, __i_len);\n\treplace(__p, __n, __r);\n      }\n\n      void\n      replace(size_t __p, size_t __n, _CharT __c)\n      {\n\trope __r(__c);\n\treplace(__p, __n, __r);\n      }\n\n      void\n      replace(size_t __p, size_t __n, const _CharT* __c_string)\n      {\n\trope __r(__c_string);\n\treplace(__p, __n, __r);\n      }\n      \n      void\n      replace(size_t __p, size_t __n,\n\t      const _CharT* __i, const _CharT* __j)\n      {\n\trope __r(__i, __j);\n\treplace(__p, __n, __r);\n      }\n      \n      void\n      replace(size_t __p, size_t __n,\n\t      const const_iterator& __i, const const_iterator& __j)\n      {\n\trope __r(__i, __j);\n\treplace(__p, __n, __r);\n      }\n\n      void\n      replace(size_t __p, size_t __n,\n\t      const iterator& __i, const iterator& __j)\n      {\n\trope __r(__i, __j);\n\treplace(__p, __n, __r);\n      }\n\n      // Single character variants:\n      void\n      replace(size_t __p, _CharT __c)\n      {\n\titerator __i(this, __p);\n\t*__i = __c;\n      }\n\n      void\n      replace(size_t __p, const rope& __r)\n      { replace(__p, 1, __r); }\n\n      void\n      replace(size_t __p, const _CharT* __i, size_t __i_len)\n      { replace(__p, 1, __i, __i_len); }\n\n      void\n      replace(size_t __p, const _CharT* __c_string)\n      {\treplace(__p, 1, __c_string); }\n\n      void\n      replace(size_t __p, const _CharT* __i, const _CharT* __j)\n      {\treplace(__p, 1, __i, __j); }\n\n      void\n      replace(size_t __p, const const_iterator& __i,\n\t      const const_iterator& __j)\n      { replace(__p, 1, __i, __j); }\n\n      void\n      replace(size_t __p, const iterator& __i,\n\t      const iterator& __j)\n      { replace(__p, 1, __i, __j); }\n\n      // Erase, (position, size) variant.\n      void\n      erase(size_t __p, size_t __n)\n      {\n\t_RopeRep* __result = replace(this->_M_tree_ptr, __p,\n\t\t\t\t     __p + __n, 0);\n\t_S_unref(this->_M_tree_ptr);\n\tthis->_M_tree_ptr = __result;\n      }\n\n      // Erase, single character\n      void\n      erase(size_t __p)\n      { erase(__p, __p + 1); }\n\n      // Insert, iterator variants.\n      iterator\n      insert(const iterator& __p, const rope& __r)\n      {\n\tinsert(__p.index(), __r);\n\treturn __p;\n      }\n\n      iterator\n      insert(const iterator& __p, size_t __n, _CharT __c)\n      {\n\tinsert(__p.index(), __n, __c);\n\treturn __p;\n      }\n\n      iterator insert(const iterator& __p, _CharT __c)\n      {\n\tinsert(__p.index(), __c);\n\treturn __p;\n      }\n      \n      iterator\n      insert(const iterator& __p )\n      {\n\tinsert(__p.index());\n\treturn __p;\n      }\n      \n      iterator\n      insert(const iterator& __p, const _CharT* c_string)\n      {\n\tinsert(__p.index(), c_string);\n\treturn __p;\n      }\n      \n      iterator\n      insert(const iterator& __p, const _CharT* __i, size_t __n)\n      {\n\tinsert(__p.index(), __i, __n);\n\treturn __p;\n      }\n      \n      iterator\n      insert(const iterator& __p, const _CharT* __i,\n\t     const _CharT* __j)\n      {\n\tinsert(__p.index(), __i, __j); \n\treturn __p;\n      }\n      \n      iterator\n      insert(const iterator& __p,\n\t     const const_iterator& __i, const const_iterator& __j)\n      {\n\tinsert(__p.index(), __i, __j);\n\treturn __p;\n      }\n      \n      iterator\n      insert(const iterator& __p,\n\t     const iterator& __i, const iterator& __j)\n      {\n\tinsert(__p.index(), __i, __j);\n\treturn __p;\n      }\n\n      // Replace, range variants.\n      void\n      replace(const iterator& __p, const iterator& __q, const rope& __r)\n      {\treplace(__p.index(), __q.index() - __p.index(), __r); }\n\n      void\n      replace(const iterator& __p, const iterator& __q, _CharT __c)\n      { replace(__p.index(), __q.index() - __p.index(), __c); }\n      \n      void\n      replace(const iterator& __p, const iterator& __q,\n\t      const _CharT* __c_string)\n      { replace(__p.index(), __q.index() - __p.index(), __c_string); }\n      \n      void\n      replace(const iterator& __p, const iterator& __q,\n\t      const _CharT* __i, size_t __n)\n      { replace(__p.index(), __q.index() - __p.index(), __i, __n); }\n      \n      void\n      replace(const iterator& __p, const iterator& __q,\n\t      const _CharT* __i, const _CharT* __j)\n      { replace(__p.index(), __q.index() - __p.index(), __i, __j); }\n      \n      void\n      replace(const iterator& __p, const iterator& __q,\n\t      const const_iterator& __i, const const_iterator& __j)\n      { replace(__p.index(), __q.index() - __p.index(), __i, __j); }\n      \n      void\n      replace(const iterator& __p, const iterator& __q,\n\t      const iterator& __i, const iterator& __j)\n      { replace(__p.index(), __q.index() - __p.index(), __i, __j); }\n\n      // Replace, iterator variants.\n      void\n      replace(const iterator& __p, const rope& __r)\n      { replace(__p.index(), __r); }\n      \n      void\n      replace(const iterator& __p, _CharT __c)\n      { replace(__p.index(), __c); }\n      \n      void\n      replace(const iterator& __p, const _CharT* __c_string)\n      { replace(__p.index(), __c_string); }\n      \n      void\n      replace(const iterator& __p, const _CharT* __i, size_t __n)\n      { replace(__p.index(), __i, __n); }\n      \n      void\n      replace(const iterator& __p, const _CharT* __i, const _CharT* __j)\n      { replace(__p.index(), __i, __j); }\n      \n      void\n      replace(const iterator& __p, const_iterator __i, const_iterator __j)\n      { replace(__p.index(), __i, __j); }\n      \n      void\n      replace(const iterator& __p, iterator __i, iterator __j)\n      { replace(__p.index(), __i, __j); }\n\n      // Iterator and range variants of erase\n      iterator\n      erase(const iterator& __p, const iterator& __q)\n      {\n\tsize_t __p_index = __p.index();\n\terase(__p_index, __q.index() - __p_index);\n\treturn iterator(this, __p_index);\n      }\n\n      iterator\n      erase(const iterator& __p)\n      {\n\tsize_t __p_index = __p.index();\n\terase(__p_index, 1);\n\treturn iterator(this, __p_index);\n      }\n\n      rope\n      substr(size_t __start, size_t __len = 1) const\n      {\n\treturn rope<_CharT, _Alloc>(_S_substring(this->_M_tree_ptr,\n\t\t\t\t\t\t __start,\n\t\t\t\t\t\t __start + __len));\n      }\n\n      rope\n      substr(iterator __start, iterator __end) const\n      {\n\treturn rope<_CharT, _Alloc>(_S_substring(this->_M_tree_ptr,\n\t\t\t\t\t\t __start.index(),\n\t\t\t\t\t\t __end.index()));\n      }\n\n      rope\n      substr(iterator __start) const\n      {\n\tsize_t __pos = __start.index();\n\treturn rope<_CharT, _Alloc>(_S_substring(this->_M_tree_ptr,\n\t\t\t\t\t\t __pos, __pos + 1));\n      }\n\n      rope\n      substr(const_iterator __start, const_iterator __end) const\n      {\n\t// This might eventually take advantage of the cache in the\n\t// iterator.\n\treturn rope<_CharT, _Alloc>(_S_substring(this->_M_tree_ptr,\n\t\t\t\t\t\t __start.index(),\n\t\t\t\t\t\t __end.index()));\n      }\n\n      rope<_CharT, _Alloc>\n      substr(const_iterator __start)\n      {\n\tsize_t __pos = __start.index();\n\treturn rope<_CharT, _Alloc>(_S_substring(this->_M_tree_ptr,\n\t\t\t\t\t\t __pos, __pos + 1));\n      }\n\n      static const size_type npos;\n\n      size_type find(_CharT __c, size_type __pos = 0) const;\n\n      size_type\n      find(const _CharT* __s, size_type __pos = 0) const\n      {\n\tsize_type __result_pos;\n\tconst_iterator __result =\n\t  std::search(const_begin() + __pos, const_end(),\n\t\t      __s, __s + _S_char_ptr_len(__s));\n\t__result_pos = __result.index();\n#ifndef __STL_OLD_ROPE_SEMANTICS\n\tif (__result_pos == size())\n\t  __result_pos = npos;\n#endif\n\treturn __result_pos;\n      }\n\n      iterator\n      mutable_begin()\n      { return(iterator(this, 0)); }\n      \n      iterator\n      mutable_end()\n      { return(iterator(this, size())); }\n\n      typedef reverse_iterator<iterator> reverse_iterator;\n      \n      reverse_iterator\n      mutable_rbegin()\n      { return reverse_iterator(mutable_end()); }\n\n      reverse_iterator\n      mutable_rend()\n      { return reverse_iterator(mutable_begin()); }\n\n      reference\n      mutable_reference_at(size_type __pos)\n      { return reference(this, __pos); }\n\n#ifdef __STD_STUFF\n      reference\n      operator[] (size_type __pos)\n      { return _char_ref_proxy(this, __pos); }\n\n      reference\n      at(size_type __pos)\n      {\n\t// if (__pos >= size()) throw out_of_range;  // XXX\n\treturn (*this)[__pos];\n      }\n      \n      void resize(size_type __n, _CharT __c) { }\n      void resize(size_type __n) { }\n      void reserve(size_type __res_arg = 0) { }\n      \n      size_type\n      capacity() const\n      { return max_size(); }\n\n      // Stuff below this line is dangerous because it's error prone.\n      // I would really like to get rid of it.\n      // copy function with funny arg ordering.\n      size_type\n      copy(_CharT* __buffer, size_type __n,\n\t   size_type __pos = 0) const\n      { return copy(__pos, __n, __buffer); }\n\n      iterator\n      end()\n      { return mutable_end(); }\n\n      iterator\n      begin()\n      { return mutable_begin(); }\n\n      reverse_iterator\n      rend()\n      { return mutable_rend(); }\n      \n      reverse_iterator\n      rbegin()\n      { return mutable_rbegin(); }\n\n#else\n      const_iterator\n      end()\n      { return const_end(); }\n\n      const_iterator\n      begin()\n      { return const_begin(); }\n\n      const_reverse_iterator\n      rend()\n      { return const_rend(); }\n\n      const_reverse_iterator\n      rbegin()\n      { return const_rbegin(); }\n\n#endif\n    };\n\n  template <class _CharT, class _Alloc>\n    const typename rope<_CharT, _Alloc>::size_type\n    rope<_CharT, _Alloc>::npos = (size_type)(-1);\n  \n  template <class _CharT, class _Alloc>\n    inline bool operator==(const _Rope_const_iterator<_CharT, _Alloc>& __x,\n\t\t\t   const _Rope_const_iterator<_CharT, _Alloc>& __y)\n    { return (__x._M_current_pos == __y._M_current_pos\n\t      && __x._M_root == __y._M_root); }\n\n  template <class _CharT, class _Alloc>\n    inline bool operator<(const _Rope_const_iterator<_CharT, _Alloc>& __x,\n\t\t\t  const _Rope_const_iterator<_CharT, _Alloc>& __y)\n    { return (__x._M_current_pos < __y._M_current_pos); }\n\n  template <class _CharT, class _Alloc>\n    inline bool operator!=(const _Rope_const_iterator<_CharT, _Alloc>& __x,\n\t\t\t   const _Rope_const_iterator<_CharT, _Alloc>& __y)\n    { return !(__x == __y); }\n\n  template <class _CharT, class _Alloc>\n    inline bool operator>(const _Rope_const_iterator<_CharT, _Alloc>& __x,\n\t\t\t  const _Rope_const_iterator<_CharT, _Alloc>& __y)\n    { return __y < __x; }\n\n  template <class _CharT, class _Alloc>\n    inline bool\n    operator<=(const _Rope_const_iterator<_CharT, _Alloc>& __x,\n\t       const _Rope_const_iterator<_CharT, _Alloc>& __y)\n    { return !(__y < __x); }\n\n  template <class _CharT, class _Alloc>\n    inline bool\n    operator>=(const _Rope_const_iterator<_CharT, _Alloc>& __x,\n\t       const _Rope_const_iterator<_CharT, _Alloc>& __y)\n    { return !(__x < __y); }\n\n  template <class _CharT, class _Alloc>\n    inline ptrdiff_t\n    operator-(const _Rope_const_iterator<_CharT, _Alloc>& __x,\n\t      const _Rope_const_iterator<_CharT, _Alloc>& __y)\n    { return (ptrdiff_t)__x._M_current_pos - (ptrdiff_t)__y._M_current_pos; }\n\n  template <class _CharT, class _Alloc>\n    inline _Rope_const_iterator<_CharT, _Alloc>\n    operator-(const _Rope_const_iterator<_CharT, _Alloc>& __x, ptrdiff_t __n)\n    { return _Rope_const_iterator<_CharT, _Alloc>(__x._M_root,\n\t\t\t\t\t\t  __x._M_current_pos - __n); }\n\n  template <class _CharT, class _Alloc>\n    inline _Rope_const_iterator<_CharT, _Alloc>\n    operator+(const _Rope_const_iterator<_CharT, _Alloc>& __x, ptrdiff_t __n)\n    { return _Rope_const_iterator<_CharT, _Alloc>(__x._M_root,\n\t\t\t\t\t\t  __x._M_current_pos + __n); }\n\n  template <class _CharT, class _Alloc>\n    inline _Rope_const_iterator<_CharT, _Alloc>\n    operator+(ptrdiff_t __n, const _Rope_const_iterator<_CharT, _Alloc>& __x)\n  { return _Rope_const_iterator<_CharT, _Alloc>(__x._M_root,\n\t\t\t\t\t\t__x._M_current_pos + __n); }\n\n  template <class _CharT, class _Alloc>\n    inline bool\n    operator==(const _Rope_iterator<_CharT, _Alloc>& __x,\n\t       const _Rope_iterator<_CharT, _Alloc>& __y)\n    {return (__x._M_current_pos == __y._M_current_pos\n\t     && __x._M_root_rope == __y._M_root_rope); }\n  \n  template <class _CharT, class _Alloc>\n    inline bool\n    operator<(const _Rope_iterator<_CharT, _Alloc>& __x,\n\t      const _Rope_iterator<_CharT, _Alloc>& __y)\n    { return (__x._M_current_pos < __y._M_current_pos); }\n\n  template <class _CharT, class _Alloc>\n    inline bool\n    operator!=(const _Rope_iterator<_CharT, _Alloc>& __x,\n\t       const _Rope_iterator<_CharT, _Alloc>& __y)\n    { return !(__x == __y); }\n\n  template <class _CharT, class _Alloc>\n    inline bool\n    operator>(const _Rope_iterator<_CharT, _Alloc>& __x,\n\t      const _Rope_iterator<_CharT, _Alloc>& __y)\n    { return __y < __x; }\n\n  template <class _CharT, class _Alloc>\n    inline bool\n    operator<=(const _Rope_iterator<_CharT, _Alloc>& __x,\n\t       const _Rope_iterator<_CharT, _Alloc>& __y)\n    { return !(__y < __x); }\n\n  template <class _CharT, class _Alloc>\n    inline bool\n    operator>=(const _Rope_iterator<_CharT, _Alloc>& __x,\n\t       const _Rope_iterator<_CharT, _Alloc>& __y)\n    { return !(__x < __y); }\n\n  template <class _CharT, class _Alloc>\n    inline ptrdiff_t\n    operator-(const _Rope_iterator<_CharT, _Alloc>& __x,\n\t      const _Rope_iterator<_CharT, _Alloc>& __y)\n    { return ((ptrdiff_t)__x._M_current_pos\n\t      - (ptrdiff_t)__y._M_current_pos); }\n\n  template <class _CharT, class _Alloc>\n    inline _Rope_iterator<_CharT, _Alloc>\n    operator-(const _Rope_iterator<_CharT, _Alloc>& __x,\n\t      ptrdiff_t __n)\n    { return _Rope_iterator<_CharT, _Alloc>(__x._M_root_rope,\n\t\t\t\t\t    __x._M_current_pos - __n); }\n\n  template <class _CharT, class _Alloc>\n    inline _Rope_iterator<_CharT, _Alloc>\n    operator+(const _Rope_iterator<_CharT, _Alloc>& __x, ptrdiff_t __n)\n    { return _Rope_iterator<_CharT, _Alloc>(__x._M_root_rope,\n\t\t\t\t\t    __x._M_current_pos + __n); }\n\n  template <class _CharT, class _Alloc>\n    inline _Rope_iterator<_CharT, _Alloc>\n    operator+(ptrdiff_t __n, const _Rope_iterator<_CharT, _Alloc>& __x)\n    { return _Rope_iterator<_CharT, _Alloc>(__x._M_root_rope,\n\t\t\t\t\t    __x._M_current_pos + __n); }\n\n  template <class _CharT, class _Alloc>\n    inline rope<_CharT, _Alloc>\n    operator+(const rope<_CharT, _Alloc>& __left,\n\t      const rope<_CharT, _Alloc>& __right)\n    {\n      // Inlining this should make it possible to keep __left and\n      // __right in registers.\n      typedef rope<_CharT, _Alloc> rope_type;\n      return rope_type(rope_type::_S_concat(__left._M_tree_ptr, \n\t\t\t\t\t    __right._M_tree_ptr));\n    }\n\n  template <class _CharT, class _Alloc>\n    inline rope<_CharT, _Alloc>&\n    operator+=(rope<_CharT, _Alloc>& __left,\n\t       const rope<_CharT, _Alloc>& __right)\n    {\n      __left.append(__right);\n      return __left;\n    }\n\n  template <class _CharT, class _Alloc>\n    inline rope<_CharT, _Alloc>\n    operator+(const rope<_CharT, _Alloc>& __left,\n\t      const _CharT* __right)\n    {\n      typedef rope<_CharT, _Alloc> rope_type;\n      size_t __rlen = rope_type::_S_char_ptr_len(__right);\n      return rope_type(rope_type::_S_concat_char_iter(__left._M_tree_ptr,\n\t\t\t\t\t\t      __right, __rlen));\n    }\n\n  template <class _CharT, class _Alloc>\n    inline rope<_CharT, _Alloc>&\n    operator+=(rope<_CharT, _Alloc>& __left,\n\t       const _CharT* __right)\n    {\n      __left.append(__right);\n      return __left;\n    }\n\n  template <class _CharT, class _Alloc>\n    inline rope<_CharT, _Alloc>\n    operator+(const rope<_CharT, _Alloc>& __left, _CharT __right)\n    {\n      typedef rope<_CharT, _Alloc> rope_type;\n      return rope_type(rope_type::_S_concat_char_iter(__left._M_tree_ptr,\n\t\t\t\t\t\t      &__right, 1));\n    }\n\n  template <class _CharT, class _Alloc>\n    inline rope<_CharT, _Alloc>&\n    operator+=(rope<_CharT, _Alloc>& __left, _CharT __right)\n    {\n      __left.append(__right);\n      return __left;\n    }\n  \n  template <class _CharT, class _Alloc>\n    bool\n    operator<(const rope<_CharT, _Alloc>& __left,\n\t      const rope<_CharT, _Alloc>& __right)\n    { return __left.compare(__right) < 0; }\n\n  template <class _CharT, class _Alloc>\n    bool\n    operator==(const rope<_CharT, _Alloc>& __left,\n\t       const rope<_CharT, _Alloc>& __right)\n    { return __left.compare(__right) == 0; }\n\n  template <class _CharT, class _Alloc>\n    inline bool\n    operator==(const _Rope_char_ptr_proxy<_CharT, _Alloc>& __x,\n\t       const _Rope_char_ptr_proxy<_CharT, _Alloc>& __y)\n    { return (__x._M_pos == __y._M_pos && __x._M_root == __y._M_root); }\n\n  template <class _CharT, class _Alloc>\n    inline bool\n    operator!=(const rope<_CharT, _Alloc>& __x,\n\t       const rope<_CharT, _Alloc>& __y)\n    { return !(__x == __y); }\n\n  template <class _CharT, class _Alloc>\n    inline bool\n    operator>(const rope<_CharT, _Alloc>& __x,\n\t      const rope<_CharT, _Alloc>& __y)\n    { return __y < __x; }\n\n  template <class _CharT, class _Alloc>\n    inline bool\n    operator<=(const rope<_CharT, _Alloc>& __x,\n\t       const rope<_CharT, _Alloc>& __y)\n    { return !(__y < __x); }\n\n  template <class _CharT, class _Alloc>\n    inline bool\n    operator>=(const rope<_CharT, _Alloc>& __x,\n\t       const rope<_CharT, _Alloc>& __y)\n    { return !(__x < __y); }\n\n  template <class _CharT, class _Alloc>\n    inline bool\n    operator!=(const _Rope_char_ptr_proxy<_CharT, _Alloc>& __x,\n\t       const _Rope_char_ptr_proxy<_CharT, _Alloc>& __y)\n    { return !(__x == __y); }\n\n  template<class _CharT, class _Traits, class _Alloc>\n    std::basic_ostream<_CharT, _Traits>&\n    operator<<(std::basic_ostream<_CharT, _Traits>& __o,\n\t       const rope<_CharT, _Alloc>& __r);\n\n  typedef rope<char> crope;\n  typedef rope<wchar_t> wrope;\n\n  inline crope::reference\n  __mutable_reference_at(crope& __c, size_t __i)\n  { return __c.mutable_reference_at(__i); }\n\n  inline wrope::reference\n  __mutable_reference_at(wrope& __c, size_t __i)\n  { return __c.mutable_reference_at(__i); }\n\n  template <class _CharT, class _Alloc>\n    inline void\n    swap(rope<_CharT, _Alloc>& __x, rope<_CharT, _Alloc>& __y)\n    { __x.swap(__y); }\n\n  // Hash functions should probably be revisited later:\n  template<>\n    struct hash<crope>\n    {\n      size_t\n      operator()(const crope& __str) const\n      {\n\tsize_t __size = __str.size();\n\tif (0 == __size)\n\t  return 0;\n\treturn 13 * __str[0] + 5 * __str[__size - 1] + __size;\n      }\n    };\n\n\n  template<>\n    struct hash<wrope>\n    {\n      size_t\n      operator()(const wrope& __str) const\n      {\n\tsize_t __size = __str.size();\n\tif (0 == __size)\n\t  return 0;\n\treturn 13 * __str[0] + 5 * __str[__size - 1] + __size;\n      }\n    };\n\n_GLIBCXX_END_NAMESPACE\n\n# include <ext/ropeimpl.h>\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/ropeimpl.h",
    "content": "// SGI's rope class implementation -*- C++ -*-\n\n// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006\n// Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n/*\n * Copyright (c) 1997\n * Silicon Graphics Computer Systems, Inc.\n *\n * Permission to use, copy, modify, distribute and sell this software\n * and its documentation for any purpose is hereby granted without fee,\n * provided that the above copyright notice appear in all copies and\n * that both that copyright notice and this permission notice appear\n * in supporting documentation.  Silicon Graphics makes no\n * representations about the suitability of this software for any\n * purpose.  It is provided \"as is\" without express or implied warranty.\n */\n\n/** @file ropeimpl.h\n *  This is an internal header file, included by other library headers.\n *  You should not attempt to use it directly.\n */\n\n#include <cstdio>\n#include <ostream>\n#include <bits/functexcept.h>\n\n#include <ext/algorithm> // For copy_n and lexicographical_compare_3way\n#include <ext/memory> // For uninitialized_copy_n\n#include <ext/numeric> // For power\n\n_GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)\n\n  using std::size_t;\n  using std::printf;\n  using std::basic_ostream;\n  using std::__throw_length_error;\n  using std::_Destroy;\n  using std::uninitialized_fill_n;\n\n  // Set buf_start, buf_end, and buf_ptr appropriately, filling tmp_buf\n  // if necessary.  Assumes _M_path_end[leaf_index] and leaf_pos are correct.\n  // Results in a valid buf_ptr if the iterator can be legitimately\n  // dereferenced.\n  template <class _CharT, class _Alloc>\n    void\n    _Rope_iterator_base<_CharT, _Alloc>::\n    _S_setbuf(_Rope_iterator_base<_CharT, _Alloc>& __x)\n    {\n      const _RopeRep* __leaf = __x._M_path_end[__x._M_leaf_index];\n      size_t __leaf_pos = __x._M_leaf_pos;\n      size_t __pos = __x._M_current_pos;\n\n      switch(__leaf->_M_tag)\n\t{\n\tcase __detail::_S_leaf:\n\t  __x._M_buf_start = ((_Rope_RopeLeaf<_CharT, _Alloc>*)__leaf)->_M_data;\n\t  __x._M_buf_ptr = __x._M_buf_start + (__pos - __leaf_pos);\n\t  __x._M_buf_end = __x._M_buf_start + __leaf->_M_size;\n\t  break;\n\tcase __detail::_S_function:\n\tcase __detail::_S_substringfn:\n\t  {\n\t    size_t __len = _S_iterator_buf_len;\n\t    size_t __buf_start_pos = __leaf_pos;\n\t    size_t __leaf_end = __leaf_pos + __leaf->_M_size;\n\t    char_producer<_CharT>* __fn = ((_Rope_RopeFunction<_CharT,\n\t\t\t\t\t    _Alloc>*)__leaf)->_M_fn;\n\t    if (__buf_start_pos + __len <= __pos)\n\t      {\n\t\t__buf_start_pos = __pos - __len / 4;\n\t\tif (__buf_start_pos + __len > __leaf_end)\n\t\t  __buf_start_pos = __leaf_end - __len;\n\t      }\n\t    if (__buf_start_pos + __len > __leaf_end)\n\t      __len = __leaf_end - __buf_start_pos;\n\t    (*__fn)(__buf_start_pos - __leaf_pos, __len, __x._M_tmp_buf);\n\t    __x._M_buf_ptr = __x._M_tmp_buf + (__pos - __buf_start_pos);\n\t    __x._M_buf_start = __x._M_tmp_buf;\n\t    __x._M_buf_end = __x._M_tmp_buf + __len;\n\t  }\n\t  break;\n\tdefault:\n\t  break;\n\t}\n    }\n\n  // Set path and buffer inside a rope iterator.  We assume that\n  // pos and root are already set.\n  template <class _CharT, class _Alloc>\n    void\n    _Rope_iterator_base<_CharT, _Alloc>::\n    _S_setcache(_Rope_iterator_base<_CharT, _Alloc>& __x)\n    {\n      const _RopeRep* __path[int(__detail::_S_max_rope_depth) + 1];\n      const _RopeRep* __curr_rope;\n      int __curr_depth = -1;  /* index into path    */\n      size_t __curr_start_pos = 0;\n      size_t __pos = __x._M_current_pos;\n      unsigned char __dirns = 0; // Bit vector marking right turns in the path\n\n      if (__pos >= __x._M_root->_M_size)\n\t{\n\t  __x._M_buf_ptr = 0;\n\t  return;\n\t}\n      __curr_rope = __x._M_root;\n      if (0 != __curr_rope->_M_c_string)\n\t{\n\t  /* Treat the root as a leaf. */\n\t  __x._M_buf_start = __curr_rope->_M_c_string;\n\t  __x._M_buf_end = __curr_rope->_M_c_string + __curr_rope->_M_size;\n\t  __x._M_buf_ptr = __curr_rope->_M_c_string + __pos;\n\t  __x._M_path_end[0] = __curr_rope;\n\t  __x._M_leaf_index = 0;\n\t  __x._M_leaf_pos = 0;\n\t  return;\n\t}\n      for(;;)\n\t{\n\t  ++__curr_depth;\n\t  __path[__curr_depth] = __curr_rope;\n\t  switch(__curr_rope->_M_tag)\n\t    {\n\t    case __detail::_S_leaf:\n\t    case __detail::_S_function:\n\t    case __detail::_S_substringfn:\n\t      __x._M_leaf_pos = __curr_start_pos;\n\t      goto done;\n\t    case __detail::_S_concat:\n\t      {\n\t\t_Rope_RopeConcatenation<_CharT, _Alloc>* __c =\n\t\t  (_Rope_RopeConcatenation<_CharT, _Alloc>*)__curr_rope;\n\t\t_RopeRep* __left = __c->_M_left;\n\t\tsize_t __left_len = __left->_M_size;\n\n\t\t__dirns <<= 1;\n\t\tif (__pos >= __curr_start_pos + __left_len)\n\t\t  {\n\t\t    __dirns |= 1;\n\t\t    __curr_rope = __c->_M_right;\n\t\t    __curr_start_pos += __left_len;\n\t\t  }\n\t\telse\n\t\t  __curr_rope = __left;\n\t      }\n\t      break;\n\t    }\n\t}\n    done:\n      // Copy last section of path into _M_path_end.\n      {\n\tint __i = -1;\n\tint __j = __curr_depth + 1 - int(_S_path_cache_len);\n\n\tif (__j < 0) __j = 0;\n\twhile (__j <= __curr_depth)\n\t  __x._M_path_end[++__i] = __path[__j++];\n\t__x._M_leaf_index = __i;\n      }\n      __x._M_path_directions = __dirns;\n      _S_setbuf(__x);\n    }\n\n  // Specialized version of the above.  Assumes that\n  // the path cache is valid for the previous position.\n  template <class _CharT, class _Alloc>\n    void\n    _Rope_iterator_base<_CharT, _Alloc>::\n    _S_setcache_for_incr(_Rope_iterator_base<_CharT, _Alloc>& __x)\n    {\n      int __current_index = __x._M_leaf_index;\n      const _RopeRep* __current_node = __x._M_path_end[__current_index];\n      size_t __len = __current_node->_M_size;\n      size_t __node_start_pos = __x._M_leaf_pos;\n      unsigned char __dirns = __x._M_path_directions;\n      _Rope_RopeConcatenation<_CharT, _Alloc>* __c;\n\n      if (__x._M_current_pos - __node_start_pos < __len)\n\t{\n\t  /* More stuff in this leaf, we just didn't cache it. */\n\t  _S_setbuf(__x);\n\t  return;\n\t}\n      //  node_start_pos is starting position of last_node.\n      while (--__current_index >= 0)\n\t{\n\t  if (!(__dirns & 1) /* Path turned left */)\n\t    break;\n\t  __current_node = __x._M_path_end[__current_index];\n\t  __c = (_Rope_RopeConcatenation<_CharT, _Alloc>*)__current_node;\n\t  // Otherwise we were in the right child.  Thus we should pop\n\t  // the concatenation node.\n\t  __node_start_pos -= __c->_M_left->_M_size;\n\t  __dirns >>= 1;\n\t}\n      if (__current_index < 0)\n\t{\n\t  // We underflowed the cache. Punt.\n\t  _S_setcache(__x);\n\t  return;\n\t}\n      __current_node = __x._M_path_end[__current_index];\n      __c = (_Rope_RopeConcatenation<_CharT, _Alloc>*)__current_node;\n      // current_node is a concatenation node.  We are positioned on the first\n      // character in its right child.\n      // node_start_pos is starting position of current_node.\n      __node_start_pos += __c->_M_left->_M_size;\n      __current_node = __c->_M_right;\n      __x._M_path_end[++__current_index] = __current_node;\n      __dirns |= 1;\n      while (__detail::_S_concat == __current_node->_M_tag)\n\t{\n\t  ++__current_index;\n\t  if (int(_S_path_cache_len) == __current_index)\n\t    {\n\t      int __i;\n\t      for (__i = 0; __i < int(_S_path_cache_len) - 1; __i++)\n\t\t__x._M_path_end[__i] = __x._M_path_end[__i+1];\n\t      --__current_index;\n\t    }\n\t  __current_node =\n\t    ((_Rope_RopeConcatenation<_CharT, _Alloc>*)__current_node)->_M_left;\n\t  __x._M_path_end[__current_index] = __current_node;\n\t  __dirns <<= 1;\n\t  // node_start_pos is unchanged.\n\t}\n      __x._M_leaf_index = __current_index;\n      __x._M_leaf_pos = __node_start_pos;\n      __x._M_path_directions = __dirns;\n      _S_setbuf(__x);\n    }\n\n  template <class _CharT, class _Alloc>\n    void\n    _Rope_iterator_base<_CharT, _Alloc>::\n    _M_incr(size_t __n)\n    {\n      _M_current_pos += __n;\n      if (0 != _M_buf_ptr)\n\t{\n\t  size_t __chars_left = _M_buf_end - _M_buf_ptr;\n\t  if (__chars_left > __n)\n\t    _M_buf_ptr += __n;\n\t  else if (__chars_left == __n)\n\t    {\n\t      _M_buf_ptr += __n;\n\t      _S_setcache_for_incr(*this);\n\t    }\n\t  else\n\t    _M_buf_ptr = 0;\n\t}\n    }\n\n  template <class _CharT, class _Alloc>\n    void\n    _Rope_iterator_base<_CharT, _Alloc>::\n    _M_decr(size_t __n)\n    {\n      if (0 != _M_buf_ptr)\n\t{\n\t  size_t __chars_left = _M_buf_ptr - _M_buf_start;\n\t  if (__chars_left >= __n)\n\t    _M_buf_ptr -= __n;\n\t  else\n\t    _M_buf_ptr = 0;\n\t}\n      _M_current_pos -= __n;\n    }\n\n  template <class _CharT, class _Alloc>\n    void\n    _Rope_iterator<_CharT, _Alloc>::\n    _M_check()\n    {\n      if (_M_root_rope->_M_tree_ptr != this->_M_root)\n\t{\n\t  // _Rope was modified.  Get things fixed up.\n\t  _RopeRep::_S_unref(this->_M_root);\n\t  this->_M_root = _M_root_rope->_M_tree_ptr;\n\t  _RopeRep::_S_ref(this->_M_root);\n\t  this->_M_buf_ptr = 0;\n\t}\n    }\n\n  template <class _CharT, class _Alloc>\n    inline\n    _Rope_const_iterator<_CharT, _Alloc>::\n    _Rope_const_iterator(const _Rope_iterator<_CharT, _Alloc>& __x)\n    : _Rope_iterator_base<_CharT, _Alloc>(__x)\n    { }\n\n  template <class _CharT, class _Alloc>\n    inline\n    _Rope_iterator<_CharT, _Alloc>::\n    _Rope_iterator(rope<_CharT, _Alloc>& __r, size_t __pos)\n    : _Rope_iterator_base<_CharT,_Alloc>(__r._M_tree_ptr, __pos),\n      _M_root_rope(&__r)\n    { _RopeRep::_S_ref(this->_M_root); }\n\n  template <class _CharT, class _Alloc>\n    inline size_t\n    rope<_CharT, _Alloc>::\n    _S_char_ptr_len(const _CharT* __s)\n    {\n      const _CharT* __p = __s;\n      \n      while (!_S_is0(*__p))\n\t++__p;\n      return (__p - __s);\n    }\n\n\n#ifndef __GC\n\n  template <class _CharT, class _Alloc>\n    inline void\n    _Rope_RopeRep<_CharT, _Alloc>::\n    _M_free_c_string()\n    {\n      _CharT* __cstr = _M_c_string;\n      if (0 != __cstr)\n\t{\n\t  size_t __size = this->_M_size + 1;\n\t  _Destroy(__cstr, __cstr + __size, get_allocator());\n\t  this->_Data_deallocate(__cstr, __size);\n\t}\n    }\n\n  template <class _CharT, class _Alloc>\n    inline void\n    _Rope_RopeRep<_CharT, _Alloc>::\n    _S_free_string(_CharT* __s, size_t __n, allocator_type __a)\n    {\n      if (!_S_is_basic_char_type((_CharT*)0))\n\t_Destroy(__s, __s + __n, __a);\n      \n      //  This has to be a static member, so this gets a bit messy\n      __a.deallocate(__s,\n\t\t     _Rope_RopeLeaf<_CharT, _Alloc>::_S_rounded_up_size(__n));\n    }\n\n  //  There are several reasons for not doing this with virtual destructors\n  //  and a class specific delete operator:\n  //  - A class specific delete operator can't easily get access to\n  //    allocator instances if we need them.\n  //  - Any virtual function would need a 4 or byte vtable pointer;\n  //    this only requires a one byte tag per object.\n  template <class _CharT, class _Alloc>\n    void\n    _Rope_RopeRep<_CharT, _Alloc>::\n    _M_free_tree()\n    {\n      switch(_M_tag)\n\t{\n\tcase __detail::_S_leaf:\n\t  {\n\t    _Rope_RopeLeaf<_CharT, _Alloc>* __l\n\t      = (_Rope_RopeLeaf<_CharT, _Alloc>*)this;\n\t    __l->template _Rope_RopeLeaf<_CharT, _Alloc>::~_Rope_RopeLeaf();\n\t    _L_deallocate(__l, 1);\n\t    break;\n\t  }\n\tcase __detail::_S_concat:\n\t  {\n\t    _Rope_RopeConcatenation<_CharT,_Alloc>* __c\n\t      = (_Rope_RopeConcatenation<_CharT, _Alloc>*)this;\n\t    __c->template _Rope_RopeConcatenation<_CharT, _Alloc>::\n\t      ~_Rope_RopeConcatenation();\n\t    _C_deallocate(__c, 1);\n\t    break;\n\t  }\n\tcase __detail::_S_function:\n\t  {\n\t    _Rope_RopeFunction<_CharT, _Alloc>* __f\n\t      = (_Rope_RopeFunction<_CharT, _Alloc>*)this;\n\t    __f->template _Rope_RopeFunction<_CharT, _Alloc>::~_Rope_RopeFunction();\n\t    _F_deallocate(__f, 1);\n\t    break;\n\t  }\n\tcase __detail::_S_substringfn:\n\t  {\n\t    _Rope_RopeSubstring<_CharT, _Alloc>* __ss =\n\t      (_Rope_RopeSubstring<_CharT, _Alloc>*)this;\n\t    __ss->template _Rope_RopeSubstring<_CharT, _Alloc>::\n\t      ~_Rope_RopeSubstring();\n\t    _S_deallocate(__ss, 1);\n\t    break;\n\t  }\n\t}\n    }\n#else\n\n  template <class _CharT, class _Alloc>\n    inline void\n    _Rope_RopeRep<_CharT, _Alloc>::\n    _S_free_string(const _CharT*, size_t, allocator_type)\n    { }\n\n#endif\n\n  // Concatenate a C string onto a leaf rope by copying the rope data.\n  // Used for short ropes.\n  template <class _CharT, class _Alloc>\n    typename rope<_CharT, _Alloc>::_RopeLeaf*\n    rope<_CharT, _Alloc>::\n    _S_leaf_concat_char_iter(_RopeLeaf* __r, const _CharT* __iter, size_t __len)\n    {\n      size_t __old_len = __r->_M_size;\n      _CharT* __new_data = (_CharT*)\n\t_Rope_rep_base<_CharT, _Alloc>::_Data_allocate(_S_rounded_up_size(__old_len + __len));\n      _RopeLeaf* __result;\n\n      uninitialized_copy_n(__r->_M_data, __old_len, __new_data);\n      uninitialized_copy_n(__iter, __len, __new_data + __old_len);\n      _S_cond_store_eos(__new_data[__old_len + __len]);\n      try\n\t{\n\t  __result = _S_new_RopeLeaf(__new_data, __old_len + __len,\n\t\t\t\t     __r->get_allocator());\n\t}\n      catch(...)\n\t{\n\t  _RopeRep::__STL_FREE_STRING(__new_data, __old_len + __len,\n\t\t\t\t      __r->get_allocator());\n\t  __throw_exception_again;\n\t}\n      return __result;\n    }\n\n#ifndef __GC\n  // As above, but it's OK to clobber original if refcount is 1\n  template <class _CharT, class _Alloc>\n    typename rope<_CharT,_Alloc>::_RopeLeaf*\n    rope<_CharT, _Alloc>::\n    _S_destr_leaf_concat_char_iter(_RopeLeaf* __r, const _CharT* __iter,\n\t\t\t\t   size_t __len)\n    {\n      if (__r->_M_ref_count > 1)\n\treturn _S_leaf_concat_char_iter(__r, __iter, __len);\n      size_t __old_len = __r->_M_size;\n      if (_S_allocated_capacity(__old_len) >= __old_len + __len)\n\t{\n\t  // The space has been partially initialized for the standard\n\t  // character types.  But that doesn't matter for those types.\n\t  uninitialized_copy_n(__iter, __len, __r->_M_data + __old_len);\n\t  if (_S_is_basic_char_type((_CharT*)0))\n\t    _S_cond_store_eos(__r->_M_data[__old_len + __len]);\n\t  else if (__r->_M_c_string != __r->_M_data && 0 != __r->_M_c_string)\n\t    {\n\t      __r->_M_free_c_string();\n\t      __r->_M_c_string = 0;\n\t    }\n\t  __r->_M_size = __old_len + __len;\n\t  __r->_M_ref_count = 2;\n\t  return __r;\n\t}\n      else\n\t{\n\t  _RopeLeaf* __result = _S_leaf_concat_char_iter(__r, __iter, __len);\n\t  return __result;\n\t}\n    }\n#endif\n\n  // Assumes left and right are not 0.\n  // Does not increment (nor decrement on exception) child reference counts.\n  // Result has ref count 1.\n  template <class _CharT, class _Alloc>\n    typename rope<_CharT, _Alloc>::_RopeRep*\n    rope<_CharT, _Alloc>::\n    _S_tree_concat(_RopeRep* __left, _RopeRep* __right)\n    {\n      _RopeConcatenation* __result = _S_new_RopeConcatenation(__left, __right,\n\t\t\t\t\t\t\t      __left->\n\t\t\t\t\t\t\t      get_allocator());\n      size_t __depth = __result->_M_depth;\n      \n      if (__depth > 20\n\t  && (__result->_M_size < 1000\n\t      || __depth > size_t(__detail::_S_max_rope_depth)))\n\t{\n\t  _RopeRep* __balanced;\n\n\t  try\n\t    {\n\t      __balanced = _S_balance(__result);\n\t      __result->_M_unref_nonnil();\n\t    }\n\t  catch(...)\n\t    {\n\t      _C_deallocate(__result,1);\n\t      __throw_exception_again;\n\t    }\n\t  // In case of exception, we need to deallocate\n\t  // otherwise dangling result node.  But caller\n\t  // still owns its children.  Thus unref is\n\t  // inappropriate.\n\t  return __balanced;\n\t}\n      else\n\treturn __result;\n    }\n\n  template <class _CharT, class _Alloc>\n    typename rope<_CharT, _Alloc>::_RopeRep*\n    rope<_CharT, _Alloc>::\n    _S_concat_char_iter(_RopeRep* __r, const _CharT*__s, size_t __slen)\n    {\n      _RopeRep* __result;\n      if (0 == __slen)\n\t{\n\t  _S_ref(__r);\n\t  return __r;\n\t}\n      if (0 == __r)\n\treturn __STL_ROPE_FROM_UNOWNED_CHAR_PTR(__s, __slen,\n\t\t\t\t\t\t__r->get_allocator());\n      if (__r->_M_tag == __detail::_S_leaf\n\t  && __r->_M_size + __slen <= size_t(_S_copy_max))\n\t{\n\t  __result = _S_leaf_concat_char_iter((_RopeLeaf*)__r, __s, __slen);\n\t  return __result;\n\t}\n      if (__detail::_S_concat == __r->_M_tag\n\t  && __detail::_S_leaf == ((_RopeConcatenation*) __r)->_M_right->_M_tag)\n\t{\n\t  _RopeLeaf* __right =\n\t    (_RopeLeaf* )(((_RopeConcatenation* )__r)->_M_right);\n\t  if (__right->_M_size + __slen <= size_t(_S_copy_max))\n\t    {\n\t      _RopeRep* __left = ((_RopeConcatenation*)__r)->_M_left;\n\t      _RopeRep* __nright =\n\t\t_S_leaf_concat_char_iter((_RopeLeaf*)__right, __s, __slen);\n\t      __left->_M_ref_nonnil();\n\t      try\n\t\t{ __result = _S_tree_concat(__left, __nright); }\n\t      catch(...)\n\t\t{\n\t\t  _S_unref(__left);\n\t\t  _S_unref(__nright);\n\t\t  __throw_exception_again;\n\t\t}\n\t      return __result;\n\t    }\n\t}\n      _RopeRep* __nright =\n\t__STL_ROPE_FROM_UNOWNED_CHAR_PTR(__s, __slen, __r->get_allocator());\n      try\n\t{\n\t  __r->_M_ref_nonnil();\n\t  __result = _S_tree_concat(__r, __nright);\n\t}\n      catch(...)\n\t{\n\t  _S_unref(__r);\n\t  _S_unref(__nright);\n\t  __throw_exception_again;\n\t}\n      return __result;\n    }\n\n#ifndef __GC\n  template <class _CharT, class _Alloc>\n    typename rope<_CharT,_Alloc>::_RopeRep*\n    rope<_CharT,_Alloc>::\n    _S_destr_concat_char_iter(_RopeRep* __r, const _CharT* __s, size_t __slen)\n    {\n      _RopeRep* __result;\n      if (0 == __r)\n\treturn __STL_ROPE_FROM_UNOWNED_CHAR_PTR(__s, __slen,\n\t\t\t\t\t\t__r->get_allocator());\n      size_t __count = __r->_M_ref_count;\n      size_t __orig_size = __r->_M_size;\n      if (__count > 1)\n\treturn _S_concat_char_iter(__r, __s, __slen);\n      if (0 == __slen)\n\t{\n\t  __r->_M_ref_count = 2;      // One more than before\n\t  return __r;\n\t}\n      if (__orig_size + __slen <= size_t(_S_copy_max)\n\t  && __detail::_S_leaf == __r->_M_tag)\n\t{\n\t  __result = _S_destr_leaf_concat_char_iter((_RopeLeaf*)__r, __s, \n\t\t\t\t\t\t    __slen);\n\t  return __result;\n\t}\n      if (__detail::_S_concat == __r->_M_tag)\n\t{\n\t  _RopeLeaf* __right = (_RopeLeaf*)(((_RopeConcatenation*)\n\t\t\t\t\t     __r)->_M_right);\n\t  if (__detail::_S_leaf == __right->_M_tag\n\t      && __right->_M_size + __slen <= size_t(_S_copy_max))\n\t    {\n\t      _RopeRep* __new_right =\n\t\t_S_destr_leaf_concat_char_iter(__right, __s, __slen);\n\t      if (__right == __new_right)\n\t\t__new_right->_M_ref_count = 1;\n\t      else\n\t\t__right->_M_unref_nonnil();\n\t      __r->_M_ref_count = 2;    // One more than before.\n\t      ((_RopeConcatenation*)__r)->_M_right = __new_right;\n\t      __r->_M_size = __orig_size + __slen;\n\t      if (0 != __r->_M_c_string)\n\t\t{\n\t\t  __r->_M_free_c_string();\n\t\t  __r->_M_c_string = 0;\n\t\t}\n\t      return __r;\n\t    }\n\t}\n      _RopeRep* __right =\n\t__STL_ROPE_FROM_UNOWNED_CHAR_PTR(__s, __slen, __r->get_allocator());\n      __r->_M_ref_nonnil();\n      try\n\t{ __result = _S_tree_concat(__r, __right); }\n      catch(...)\n\t{\n\t  _S_unref(__r);\n\t  _S_unref(__right);\n\t  __throw_exception_again;\n\t}\n      return __result;\n    }\n#endif /* !__GC */\n  \n  template <class _CharT, class _Alloc>\n    typename rope<_CharT, _Alloc>::_RopeRep*\n    rope<_CharT, _Alloc>::\n    _S_concat(_RopeRep* __left, _RopeRep* __right)\n    {\n      if (0 == __left)\n\t{\n\t  _S_ref(__right);\n\t  return __right;\n\t}\n      if (0 == __right)\n\t{\n\t  __left->_M_ref_nonnil();\n\t  return __left;\n\t}\n      if (__detail::_S_leaf == __right->_M_tag)\n\t{\n\t  if (__detail::_S_leaf == __left->_M_tag)\n\t    {\n\t      if (__right->_M_size + __left->_M_size <= size_t(_S_copy_max))\n\t\treturn _S_leaf_concat_char_iter((_RopeLeaf*)__left,\n\t\t\t\t\t\t((_RopeLeaf*)__right)->_M_data,\n\t\t\t\t\t\t__right->_M_size);\n\t    }\n\t  else if (__detail::_S_concat == __left->_M_tag\n\t\t   && __detail::_S_leaf == ((_RopeConcatenation*)\n\t\t\t\t\t\t   __left)->_M_right->_M_tag)\n\t    {\n\t      _RopeLeaf* __leftright =\n\t\t(_RopeLeaf*)(((_RopeConcatenation*)__left)->_M_right);\n\t      if (__leftright->_M_size\n\t\t  + __right->_M_size <= size_t(_S_copy_max))\n\t\t{\n\t\t  _RopeRep* __leftleft = ((_RopeConcatenation*)__left)->_M_left;\n\t\t  _RopeRep* __rest = _S_leaf_concat_char_iter(__leftright,\n\t\t\t\t\t\t\t      ((_RopeLeaf*)\n\t\t\t\t\t\t\t       __right)->\n\t\t\t\t\t\t\t      _M_data,\n\t\t\t\t\t\t\t      __right->_M_size);\n\t\t  __leftleft->_M_ref_nonnil();\n\t\t  try\n\t\t    { return(_S_tree_concat(__leftleft, __rest)); }\n\t\t  catch(...)\n\t\t    {\n\t\t      _S_unref(__leftleft);\n\t\t      _S_unref(__rest);\n\t\t      __throw_exception_again;\n\t\t    }\n\t\t}\n\t    }\n\t}\n      __left->_M_ref_nonnil();\n      __right->_M_ref_nonnil();\n      try\n\t{ return(_S_tree_concat(__left, __right)); }\n      catch(...)\n\t{\n\t  _S_unref(__left);\n\t  _S_unref(__right);\n\t  __throw_exception_again;\n\t}\n    }\n\n  template <class _CharT, class _Alloc>\n    typename rope<_CharT, _Alloc>::_RopeRep*\n    rope<_CharT, _Alloc>::\n    _S_substring(_RopeRep* __base, size_t __start, size_t __endp1)\n    {\n      if (0 == __base)\n\treturn 0;\n      size_t __len = __base->_M_size;\n      size_t __adj_endp1;\n      const size_t __lazy_threshold = 128;\n      \n      if (__endp1 >= __len)\n\t{\n\t  if (0 == __start)\n\t    {\n\t      __base->_M_ref_nonnil();\n\t      return __base;\n\t    }\n\t  else\n\t    __adj_endp1 = __len;\n\t  \n\t}\n      else\n\t__adj_endp1 = __endp1;\n\n      switch(__base->_M_tag)\n\t{\n\tcase __detail::_S_concat:\n\t    {\n\t      _RopeConcatenation* __c = (_RopeConcatenation*)__base;\n\t      _RopeRep* __left = __c->_M_left;\n\t      _RopeRep* __right = __c->_M_right;\n\t      size_t __left_len = __left->_M_size;\n\t      _RopeRep* __result;\n\t      \n\t      if (__adj_endp1 <= __left_len)\n\t\treturn _S_substring(__left, __start, __endp1);\n\t      else if (__start >= __left_len)\n\t\treturn _S_substring(__right, __start - __left_len,\n\t\t\t\t    __adj_endp1 - __left_len);\n\t      _Self_destruct_ptr __left_result(_S_substring(__left,\n\t\t\t\t\t\t\t    __start,\n\t\t\t\t\t\t\t    __left_len));\n\t      _Self_destruct_ptr __right_result(_S_substring(__right, 0,\n\t\t\t\t\t\t\t     __endp1 \n\t\t\t\t\t\t\t     - __left_len));\n\t      __result = _S_concat(__left_result, __right_result);\n\t      return __result;\n\t    }\n\tcase __detail::_S_leaf:\n\t  {\n\t    _RopeLeaf* __l = (_RopeLeaf*)__base;\n\t    _RopeLeaf* __result;\n\t    size_t __result_len;\n\t    if (__start >= __adj_endp1)\n\t      return 0;\n\t    __result_len = __adj_endp1 - __start;\n\t    if (__result_len > __lazy_threshold)\n\t      goto lazy;\n#ifdef __GC\n\t    const _CharT* __section = __l->_M_data + __start;\n\t    __result = _S_new_RopeLeaf(__section, __result_len,\n\t\t\t\t       __base->get_allocator());\n\t    __result->_M_c_string = 0;  // Not eos terminated.\n#else\n\t    // We should sometimes create substring node instead.\n\t    __result = __STL_ROPE_FROM_UNOWNED_CHAR_PTR(__l->_M_data + __start,\n\t\t\t\t\t\t\t__result_len,\n\t\t\t\t\t\t\t__base->\n\t\t\t\t\t\t\tget_allocator());\n#endif\n\t    return __result;\n\t  }\n\tcase __detail::_S_substringfn:\n\t  // Avoid introducing multiple layers of substring nodes.\n\t  {\n\t    _RopeSubstring* __old = (_RopeSubstring*)__base;\n\t    size_t __result_len;\n\t    if (__start >= __adj_endp1)\n\t      return 0;\n\t    __result_len = __adj_endp1 - __start;\n\t    if (__result_len > __lazy_threshold)\n\t      {\n\t\t_RopeSubstring* __result =\n\t\t  _S_new_RopeSubstring(__old->_M_base,\n\t\t\t\t       __start + __old->_M_start,\n\t\t\t\t       __adj_endp1 - __start,\n\t\t\t\t       __base->get_allocator());\n\t\treturn __result;\n\t\t\n\t      } // *** else fall through: ***\n\t  }\n\tcase __detail::_S_function:\n\t  {\n\t    _RopeFunction* __f = (_RopeFunction*)__base;\n\t    _CharT* __section;\n\t    size_t __result_len;\n\t    if (__start >= __adj_endp1)\n\t      return 0;\n\t    __result_len = __adj_endp1 - __start;\n\t    \n\t    if (__result_len > __lazy_threshold)\n\t      goto lazy;\n\t    __section = (_CharT*)\n\t      _Rope_rep_base<_CharT, _Alloc>::_Data_allocate(_S_rounded_up_size(__result_len));\n\t    try\n\t      {\t(*(__f->_M_fn))(__start, __result_len, __section); }\n\t    catch(...)\n\t      {\n\t\t_RopeRep::__STL_FREE_STRING(__section, __result_len,\n\t\t\t\t\t    __base->get_allocator());\n\t\t__throw_exception_again;\n\t      }\n\t    _S_cond_store_eos(__section[__result_len]);\n\t    return _S_new_RopeLeaf(__section, __result_len,\n\t\t\t\t   __base->get_allocator());\n\t  }\n\t}\n    lazy:\n      {\n\t// Create substring node.\n\treturn _S_new_RopeSubstring(__base, __start, __adj_endp1 - __start,\n\t\t\t\t    __base->get_allocator());\n      }\n    }\n\n  template<class _CharT>\n    class _Rope_flatten_char_consumer\n    : public _Rope_char_consumer<_CharT>\n    {\n    private:\n      _CharT* _M_buf_ptr;\n    public:\n      \n      _Rope_flatten_char_consumer(_CharT* __buffer)\n      { _M_buf_ptr = __buffer; };\n\n      ~_Rope_flatten_char_consumer() {}\n      \n      bool\n      operator()(const _CharT* __leaf, size_t __n)\n      {\n\tuninitialized_copy_n(__leaf, __n, _M_buf_ptr);\n\t_M_buf_ptr += __n;\n\treturn true;\n      }\n    };\n\n  template<class _CharT>\n    class _Rope_find_char_char_consumer\n    : public _Rope_char_consumer<_CharT>\n    {\n    private:\n      _CharT _M_pattern;\n    public:\n      size_t _M_count;  // Number of nonmatching characters\n      \n      _Rope_find_char_char_consumer(_CharT __p)\n      : _M_pattern(__p), _M_count(0) {}\n\t\n      ~_Rope_find_char_char_consumer() {}\n      \n      bool\n      operator()(const _CharT* __leaf, size_t __n)\n      {\n\tsize_t __i;\n\tfor (__i = 0; __i < __n; __i++)\n\t  {\n\t    if (__leaf[__i] == _M_pattern)\n\t      {\n\t\t_M_count += __i;\n\t\treturn false;\n\t      }\n\t  }\n\t_M_count += __n; return true;\n      }\n    };\n\n  template<class _CharT, class _Traits>\n  // Here _CharT is both the stream and rope character type.\n    class _Rope_insert_char_consumer\n    : public _Rope_char_consumer<_CharT>\n    {\n    private:\n      typedef basic_ostream<_CharT,_Traits> _Insert_ostream;\n      _Insert_ostream& _M_o;\n    public:\n      _Rope_insert_char_consumer(_Insert_ostream& __writer)\n\t: _M_o(__writer) {};\n      ~_Rope_insert_char_consumer() { };\n      // Caller is presumed to own the ostream\n      bool operator() (const _CharT* __leaf, size_t __n);\n      // Returns true to continue traversal.\n    };\n\n  template<class _CharT, class _Traits>\n    bool\n    _Rope_insert_char_consumer<_CharT, _Traits>::\n    operator()(const _CharT* __leaf, size_t __n)\n    {\n      size_t __i;\n      //  We assume that formatting is set up correctly for each element.\n      for (__i = 0; __i < __n; __i++)\n\t_M_o.put(__leaf[__i]);\n      return true;\n    }\n\n  template <class _CharT, class _Alloc>\n    bool\n    rope<_CharT, _Alloc>::\n    _S_apply_to_pieces(_Rope_char_consumer<_CharT>& __c,\n\t\t       const _RopeRep* __r, size_t __begin, size_t __end)\n    {\n      if (0 == __r)\n\treturn true;\n      switch(__r->_M_tag)\n\t{\n\tcase __detail::_S_concat:\n\t  {\n\t    _RopeConcatenation* __conc = (_RopeConcatenation*)__r;\n\t    _RopeRep* __left =  __conc->_M_left;\n\t    size_t __left_len = __left->_M_size;\n\t    if (__begin < __left_len)\n\t      {\n\t\tsize_t __left_end = std::min(__left_len, __end);\n\t\tif (!_S_apply_to_pieces(__c, __left, __begin, __left_end))\n\t\t  return false;\n\t      }\n\t    if (__end > __left_len)\n\t      {\n\t\t_RopeRep* __right =  __conc->_M_right;\n\t\tsize_t __right_start = std::max(__left_len, __begin);\n\t\tif (!_S_apply_to_pieces(__c, __right,\n\t\t\t\t\t__right_start - __left_len,\n\t\t\t\t\t__end - __left_len))\n\t\t  return false;\n\t      }\n\t  }\n\t  return true;\n\tcase __detail::_S_leaf:\n\t  {\n\t    _RopeLeaf* __l = (_RopeLeaf*)__r;\n\t    return __c(__l->_M_data + __begin, __end - __begin);\n\t  }\n\tcase __detail::_S_function:\n\tcase __detail::_S_substringfn:\n\t    {\n\t      _RopeFunction* __f = (_RopeFunction*)__r;\n\t      size_t __len = __end - __begin;\n\t      bool __result;\n\t      _CharT* __buffer =\n\t\t(_CharT*)_Alloc().allocate(__len * sizeof(_CharT));\n\t      try\n\t\t{\n\t\t  (*(__f->_M_fn))(__begin, __len, __buffer);\n\t\t  __result = __c(__buffer, __len);\n                  _Alloc().deallocate(__buffer, __len * sizeof(_CharT));\n                }\n\t      catch(...)\n\t\t{\n\t\t  _Alloc().deallocate(__buffer, __len * sizeof(_CharT));\n\t\t  __throw_exception_again;\n\t\t}\n\t      return __result;\n\t    }\n\tdefault:\n\t  return false;\n\t}\n    }\n\n  template<class _CharT, class _Traits>\n    inline void\n    _Rope_fill(basic_ostream<_CharT, _Traits>& __o, size_t __n)\n    {\n      char __f = __o.fill();\n      size_t __i;\n      \n      for (__i = 0; __i < __n; __i++)\n\t__o.put(__f);\n    }\n\n\n  template <class _CharT>\n    inline bool\n    _Rope_is_simple(_CharT*)\n    { return false; }\n\n  inline bool\n  _Rope_is_simple(char*)\n  { return true; }\n\n  inline bool\n  _Rope_is_simple(wchar_t*)\n  { return true; }\n\n  template<class _CharT, class _Traits, class _Alloc>\n    basic_ostream<_CharT, _Traits>&\n    operator<<(basic_ostream<_CharT, _Traits>& __o,\n\t       const rope<_CharT, _Alloc>& __r)\n    {\n      size_t __w = __o.width();\n      bool __left = bool(__o.flags() & std::ios::left);\n      size_t __pad_len;\n      size_t __rope_len = __r.size();\n      _Rope_insert_char_consumer<_CharT, _Traits> __c(__o);\n      bool __is_simple = _Rope_is_simple((_CharT*)0);\n      \n      if (__rope_len < __w)\n\t__pad_len = __w - __rope_len;\n      else\n\t__pad_len = 0;\n\n      if (!__is_simple)\n\t__o.width(__w / __rope_len);\n      try\n\t{\n\t  if (__is_simple && !__left && __pad_len > 0)\n\t    _Rope_fill(__o, __pad_len);\n\t  __r.apply_to_pieces(0, __r.size(), __c);\n\t  if (__is_simple && __left && __pad_len > 0)\n\t    _Rope_fill(__o, __pad_len);\n\t  if (!__is_simple)\n\t    __o.width(__w);\n\t}\n      catch(...)\n\t{\n\t  if (!__is_simple)\n\t    __o.width(__w);\n\t  __throw_exception_again;\n\t}\n      return __o;\n    }\n\n  template <class _CharT, class _Alloc>\n    _CharT*\n    rope<_CharT, _Alloc>::\n    _S_flatten(_RopeRep* __r, size_t __start, size_t __len,\n\t       _CharT* __buffer)\n    {\n      _Rope_flatten_char_consumer<_CharT> __c(__buffer);\n      _S_apply_to_pieces(__c, __r, __start, __start + __len);\n      return(__buffer + __len);\n    }\n\n  template <class _CharT, class _Alloc>\n    size_t\n    rope<_CharT, _Alloc>::\n    find(_CharT __pattern, size_t __start) const\n    {\n      _Rope_find_char_char_consumer<_CharT> __c(__pattern);\n      _S_apply_to_pieces(__c, this->_M_tree_ptr, __start, size());\n      size_type __result_pos = __start + __c._M_count;\n#ifndef __STL_OLD_ROPE_SEMANTICS\n      if (__result_pos == size())\n\t__result_pos = npos;\n#endif\n      return __result_pos;\n    }\n\n  template <class _CharT, class _Alloc>\n    _CharT*\n    rope<_CharT, _Alloc>::\n    _S_flatten(_RopeRep* __r, _CharT* __buffer)\n    {\n      if (0 == __r)\n\treturn __buffer;\n      switch(__r->_M_tag)\n\t{\n\tcase __detail::_S_concat:\n\t  {\n\t    _RopeConcatenation* __c = (_RopeConcatenation*)__r;\n\t    _RopeRep* __left = __c->_M_left;\n\t    _RopeRep* __right = __c->_M_right;\n\t    _CharT* __rest = _S_flatten(__left, __buffer);\n\t    return _S_flatten(__right, __rest);\n\t  }\n\tcase __detail::_S_leaf:\n\t  {\n\t    _RopeLeaf* __l = (_RopeLeaf*)__r;\n\t    return copy_n(__l->_M_data, __l->_M_size, __buffer).second;\n\t  }\n\tcase __detail::_S_function:\n\tcase __detail::_S_substringfn:\n\t  // We don't yet do anything with substring nodes.\n\t  // This needs to be fixed before ropefiles will work well.\n\t  {\n\t    _RopeFunction* __f = (_RopeFunction*)__r;\n\t    (*(__f->_M_fn))(0, __f->_M_size, __buffer);\n\t    return __buffer + __f->_M_size;\n\t  }\n\tdefault:\n\t  return 0;\n\t}\n    }\n\n  // This needs work for _CharT != char\n  template <class _CharT, class _Alloc>\n    void\n    rope<_CharT, _Alloc>::\n    _S_dump(_RopeRep* __r, int __indent)\n    {\n      for (int __i = 0; __i < __indent; __i++)\n\tputchar(' ');\n      if (0 == __r)\n\t{\n\t  printf(\"NULL\\n\");\n\t  return;\n\t}\n      if (_S_concat == __r->_M_tag)\n\t{\n\t  _RopeConcatenation* __c = (_RopeConcatenation*)__r;\n\t  _RopeRep* __left = __c->_M_left;\n\t  _RopeRep* __right = __c->_M_right;\n\t  \n#ifdef __GC\n\t  printf(\"Concatenation %p (depth = %d, len = %ld, %s balanced)\\n\",\n\t\t __r, __r->_M_depth, __r->_M_size,\n\t\t __r->_M_is_balanced? \"\" : \"not\");\n#else\n\t  printf(\"Concatenation %p (rc = %ld, depth = %d, \"\n\t\t \"len = %ld, %s balanced)\\n\",\n\t\t __r, __r->_M_ref_count, __r->_M_depth, __r->_M_size,\n\t\t __r->_M_is_balanced? \"\" : \"not\");\n#endif\n\t  _S_dump(__left, __indent + 2);\n\t  _S_dump(__right, __indent + 2);\n\t  return;\n\t}\n      else\n\t{\n\t  char* __kind;\n\t  \n\t  switch (__r->_M_tag)\n\t    {\n\t    case __detail::_S_leaf:\n\t      __kind = \"Leaf\";\n\t      break;\n\t    case __detail::_S_function:\n\t      __kind = \"Function\";\n\t      break;\n\t    case __detail::_S_substringfn:\n\t      __kind = \"Function representing substring\";\n\t      break;\n\t    default:\n\t      __kind = \"(corrupted kind field!)\";\n\t    }\n#ifdef __GC\n\t  printf(\"%s %p (depth = %d, len = %ld) \",\n\t\t __kind, __r, __r->_M_depth, __r->_M_size);\n#else\n\t  printf(\"%s %p (rc = %ld, depth = %d, len = %ld) \",\n\t\t __kind, __r, __r->_M_ref_count, __r->_M_depth, __r->_M_size);\n#endif\n\t  if (_S_is_one_byte_char_type((_CharT*)0))\n\t    {\n\t      const int __max_len = 40;\n\t      _Self_destruct_ptr __prefix(_S_substring(__r, 0, __max_len));\n\t      _CharT __buffer[__max_len + 1];\n\t      bool __too_big = __r->_M_size > __prefix->_M_size;\n\t      \n\t      _S_flatten(__prefix, __buffer);\n\t      __buffer[__prefix->_M_size] = _S_eos((_CharT*)0);\n\t      printf(\"%s%s\\n\", (char*)__buffer,\n\t\t     __too_big? \"...\\n\" : \"\\n\");\n\t    }\n\t  else\n\t    printf(\"\\n\");\n\t}\n    }\n\n  template <class _CharT, class _Alloc>\n    const unsigned long\n    rope<_CharT, _Alloc>::\n    _S_min_len[int(__detail::_S_max_rope_depth) + 1] = {\n      /* 0 */1, /* 1 */2, /* 2 */3, /* 3 */5, /* 4 */8, /* 5 */13, /* 6 */21,\n      /* 7 */34, /* 8 */55, /* 9 */89, /* 10 */144, /* 11 */233, /* 12 */377,\n      /* 13 */610, /* 14 */987, /* 15 */1597, /* 16 */2584, /* 17 */4181,\n      /* 18 */6765, /* 19 */10946, /* 20 */17711, /* 21 */28657, /* 22 */46368,\n      /* 23 */75025, /* 24 */121393, /* 25 */196418, /* 26 */317811,\n      /* 27 */514229, /* 28 */832040, /* 29 */1346269, /* 30 */2178309,\n      /* 31 */3524578, /* 32 */5702887, /* 33 */9227465, /* 34 */14930352,\n      /* 35 */24157817, /* 36 */39088169, /* 37 */63245986, /* 38 */102334155,\n      /* 39 */165580141, /* 40 */267914296, /* 41 */433494437,\n      /* 42 */701408733, /* 43 */1134903170, /* 44 */1836311903,\n      /* 45 */2971215073u };\n  // These are Fibonacci numbers < 2**32.\n\n  template <class _CharT, class _Alloc>\n    typename rope<_CharT, _Alloc>::_RopeRep*\n    rope<_CharT, _Alloc>::\n    _S_balance(_RopeRep* __r)\n    {\n      _RopeRep* __forest[int(__detail::_S_max_rope_depth) + 1];\n      _RopeRep* __result = 0;\n      int __i;\n      // Invariant:\n      // The concatenation of forest in descending order is equal to __r.\n      // __forest[__i]._M_size >= _S_min_len[__i]\n      // __forest[__i]._M_depth = __i\n      // References from forest are included in refcount.\n      \n      for (__i = 0; __i <= int(__detail::_S_max_rope_depth); ++__i)\n\t__forest[__i] = 0;\n      try\n\t{\n\t  _S_add_to_forest(__r, __forest);\n\t  for (__i = 0; __i <= int(__detail::_S_max_rope_depth); ++__i)\n\t    if (0 != __forest[__i])\n\t      {\n#ifndef __GC\n\t\t_Self_destruct_ptr __old(__result);\n#endif\n\t\t__result = _S_concat(__forest[__i], __result);\n\t\t__forest[__i]->_M_unref_nonnil();\n#if !defined(__GC) && defined(__EXCEPTIONS)\n\t\t__forest[__i] = 0;\n#endif\n\t      }\n\t}\n      catch(...)\n\t{\n\t  for(__i = 0; __i <= int(__detail::_S_max_rope_depth); __i++)\n\t    _S_unref(__forest[__i]);\n\t  __throw_exception_again;\n\t}\n      \n      if (__result->_M_depth > int(__detail::_S_max_rope_depth))\n\t__throw_length_error(__N(\"rope::_S_balance\"));\n      return(__result);\n    }\n\n  template <class _CharT, class _Alloc>\n    void\n    rope<_CharT, _Alloc>::\n    _S_add_to_forest(_RopeRep* __r, _RopeRep** __forest)\n    {\n      if (__r->_M_is_balanced)\n\t{\n\t  _S_add_leaf_to_forest(__r, __forest);\n\t  return;\n\t}\n\n      {\n\t_RopeConcatenation* __c = (_RopeConcatenation*)__r;\n\t\n\t_S_add_to_forest(__c->_M_left, __forest);\n\t_S_add_to_forest(__c->_M_right, __forest);\n      }\n    }\n\n\n  template <class _CharT, class _Alloc>\n    void\n    rope<_CharT, _Alloc>::\n    _S_add_leaf_to_forest(_RopeRep* __r, _RopeRep** __forest)\n    {\n      _RopeRep* __insertee;\t\t// included in refcount\n      _RopeRep* __too_tiny = 0;\t\t// included in refcount\n      int __i;\t\t\t\t// forest[0..__i-1] is empty\n      size_t __s = __r->_M_size;\n      \n      for (__i = 0; __s >= _S_min_len[__i+1]/* not this bucket */; ++__i)\n\t{\n\t  if (0 != __forest[__i])\n\t    {\n#ifndef __GC\n\t      _Self_destruct_ptr __old(__too_tiny);\n#endif\n\t      __too_tiny = _S_concat_and_set_balanced(__forest[__i],\n\t\t\t\t\t\t      __too_tiny);\n\t      __forest[__i]->_M_unref_nonnil();\n\t      __forest[__i] = 0;\n\t    }\n\t}\n      {\n#ifndef __GC\n\t_Self_destruct_ptr __old(__too_tiny);\n#endif\n\t__insertee = _S_concat_and_set_balanced(__too_tiny, __r);\n      }\n      // Too_tiny dead, and no longer included in refcount.\n      // Insertee is live and included.\n      for (;; ++__i)\n\t{\n\t  if (0 != __forest[__i])\n\t    {\n#ifndef __GC\n\t      _Self_destruct_ptr __old(__insertee);\n#endif\n\t      __insertee = _S_concat_and_set_balanced(__forest[__i],\n\t\t\t\t\t\t      __insertee);\n\t      __forest[__i]->_M_unref_nonnil();\n\t      __forest[__i] = 0;\n\t    }\n\t  if (__i == int(__detail::_S_max_rope_depth)\n\t      || __insertee->_M_size < _S_min_len[__i+1])\n\t    {\n\t      __forest[__i] = __insertee;\n\t      // refcount is OK since __insertee is now dead.\n\t      return;\n\t    }\n\t}\n    }\n\n  template <class _CharT, class _Alloc>\n    _CharT\n    rope<_CharT, _Alloc>::\n    _S_fetch(_RopeRep* __r, size_type __i)\n    {\n      __GC_CONST _CharT* __cstr = __r->_M_c_string;\n      \n      if (0 != __cstr)\n\treturn __cstr[__i];\n      for(;;)\n\t{\n\t  switch(__r->_M_tag)\n\t    {\n\t    case __detail::_S_concat:\n\t      {\n\t\t_RopeConcatenation* __c = (_RopeConcatenation*)__r;\n\t\t_RopeRep* __left = __c->_M_left;\n\t\tsize_t __left_len = __left->_M_size;\n\t\t\n\t\tif (__i >= __left_len)\n\t\t  {\n\t\t    __i -= __left_len;\n\t\t    __r = __c->_M_right;\n\t\t  } \n\t\telse\n\t\t  __r = __left;\n\t      }\n\t      break;\n\t    case __detail::_S_leaf:\n\t      {\n\t\t_RopeLeaf* __l = (_RopeLeaf*)__r;\n\t\treturn __l->_M_data[__i];\n\t      }\n\t    case __detail::_S_function:\n\t    case __detail::_S_substringfn:\n\t      {\n\t\t_RopeFunction* __f = (_RopeFunction*)__r;\n\t\t_CharT __result;\n\t\t\n\t\t(*(__f->_M_fn))(__i, 1, &__result);\n\t\treturn __result;\n\t      }\n\t    }\n\t}\n    }\n  \n#ifndef __GC\n  // Return a uniquely referenced character slot for the given\n  // position, or 0 if that's not possible.\n  template <class _CharT, class _Alloc>\n    _CharT*\n    rope<_CharT, _Alloc>::\n    _S_fetch_ptr(_RopeRep* __r, size_type __i)\n    {\n      _RopeRep* __clrstack[__detail::_S_max_rope_depth];\n      size_t __csptr = 0;\n      \n      for(;;)\n\t{\n\t  if (__r->_M_ref_count > 1)\n\t    return 0;\n\t  switch(__r->_M_tag)\n\t    {\n\t    case __detail::_S_concat:\n\t      {\n\t\t_RopeConcatenation* __c = (_RopeConcatenation*)__r;\n\t\t_RopeRep* __left = __c->_M_left;\n\t\tsize_t __left_len = __left->_M_size;\n\t\t\n\t\tif (__c->_M_c_string != 0)\n\t\t  __clrstack[__csptr++] = __c;\n\t\tif (__i >= __left_len)\n\t\t  {\n\t\t    __i -= __left_len;\n\t\t    __r = __c->_M_right;\n\t\t  } \n\t\telse\n\t\t  __r = __left;\n\t      }\n\t      break;\n\t    case __detail::_S_leaf:\n\t      {\n\t\t_RopeLeaf* __l = (_RopeLeaf*)__r;\n\t\tif (__l->_M_c_string != __l->_M_data && __l->_M_c_string != 0)\n\t\t  __clrstack[__csptr++] = __l;\n\t\twhile (__csptr > 0)\n\t\t  {\n\t\t    -- __csptr;\n\t\t    _RopeRep* __d = __clrstack[__csptr];\n\t\t    __d->_M_free_c_string();\n\t\t    __d->_M_c_string = 0;\n\t\t  }\n\t\treturn __l->_M_data + __i;\n\t      }\n\t    case __detail::_S_function:\n\t    case __detail::_S_substringfn:\n\t      return 0;\n\t    }\n\t}\n    }\n#endif /* __GC */\n\n  // The following could be implemented trivially using\n  // lexicographical_compare_3way.\n  // We do a little more work to avoid dealing with rope iterators for\n  // flat strings.\n  template <class _CharT, class _Alloc>\n    int\n    rope<_CharT, _Alloc>::\n    _S_compare (const _RopeRep* __left, const _RopeRep* __right)\n    {\n      size_t __left_len;\n      size_t __right_len;\n      \n      if (0 == __right)\n\treturn 0 != __left;\n      if (0 == __left)\n\treturn -1;\n      __left_len = __left->_M_size;\n      __right_len = __right->_M_size;\n      if (__detail::_S_leaf == __left->_M_tag)\n\t{\n\t  _RopeLeaf* __l = (_RopeLeaf*) __left;\n\t  if (__detail::_S_leaf == __right->_M_tag)\n\t    {\n\t      _RopeLeaf* __r = (_RopeLeaf*) __right;\n\t      return lexicographical_compare_3way(__l->_M_data,\n\t\t\t\t\t\t  __l->_M_data + __left_len,\n\t\t\t\t\t\t  __r->_M_data, __r->_M_data\n\t\t\t\t\t\t  + __right_len);\n\t    }\n\t  else\n\t    {\n\t      const_iterator __rstart(__right, 0);\n\t      const_iterator __rend(__right, __right_len);\n\t      return lexicographical_compare_3way(__l->_M_data, __l->_M_data\n\t\t\t\t\t\t  + __left_len,\n\t\t\t\t\t\t  __rstart, __rend);\n\t    }\n\t}\n      else\n\t{\n\t  const_iterator __lstart(__left, 0);\n\t  const_iterator __lend(__left, __left_len);\n\t  if (__detail::_S_leaf == __right->_M_tag)\n\t    {\n\t      _RopeLeaf* __r = (_RopeLeaf*) __right;\n\t      return lexicographical_compare_3way(__lstart, __lend,\n\t\t\t\t\t\t  __r->_M_data, __r->_M_data\n\t\t\t\t\t\t  + __right_len);\n\t    }\n\t  else\n\t    {\n\t      const_iterator __rstart(__right, 0);\n\t      const_iterator __rend(__right, __right_len);\n\t      return lexicographical_compare_3way(__lstart, __lend,\n\t\t\t\t\t\t  __rstart, __rend);\n\t    }\n\t}\n    }\n\n  // Assignment to reference proxies.\n  template <class _CharT, class _Alloc>\n    _Rope_char_ref_proxy<_CharT, _Alloc>&\n    _Rope_char_ref_proxy<_CharT, _Alloc>::\n    operator=(_CharT __c)\n    {\n      _RopeRep* __old = _M_root->_M_tree_ptr;\n#ifndef __GC\n      // First check for the case in which everything is uniquely\n      // referenced.  In that case we can do this destructively.\n      _CharT* __ptr = _My_rope::_S_fetch_ptr(__old, _M_pos);\n      if (0 != __ptr)\n\t{\n\t  *__ptr = __c;\n\t  return *this;\n\t}\n#endif\n      _Self_destruct_ptr __left(_My_rope::_S_substring(__old, 0, _M_pos));\n      _Self_destruct_ptr __right(_My_rope::_S_substring(__old, _M_pos + 1,\n\t\t\t\t\t\t\t__old->_M_size));\n      _Self_destruct_ptr __result_left(_My_rope::\n\t\t\t\t       _S_destr_concat_char_iter(__left,\n\t\t\t\t\t\t\t\t &__c, 1));\n\n      _RopeRep* __result = _My_rope::_S_concat(__result_left, __right);\n#ifndef __GC\n      _RopeRep::_S_unref(__old);\n#endif\n      _M_root->_M_tree_ptr = __result;\n      return *this;\n    }\n\n  template <class _CharT, class _Alloc>\n    inline _Rope_char_ref_proxy<_CharT, _Alloc>::\n    operator _CharT() const\n    {\n      if (_M_current_valid)\n\treturn _M_current;\n      else\n\treturn _My_rope::_S_fetch(_M_root->_M_tree_ptr, _M_pos);\n    }\n\n  template <class _CharT, class _Alloc>\n    _Rope_char_ptr_proxy<_CharT, _Alloc>\n    _Rope_char_ref_proxy<_CharT, _Alloc>::\n    operator&() const\n    { return _Rope_char_ptr_proxy<_CharT, _Alloc>(*this); }\n\n  template <class _CharT, class _Alloc>\n    rope<_CharT, _Alloc>::\n    rope(size_t __n, _CharT __c, const allocator_type& __a)\n    : _Base(__a)\n    {\n      rope<_CharT,_Alloc> __result;\n      const size_t __exponentiate_threshold = 32;\n      size_t __exponent;\n      size_t __rest;\n      _CharT* __rest_buffer;\n      _RopeRep* __remainder;\n      rope<_CharT, _Alloc> __remainder_rope;\n\n      if (0 == __n)\n\treturn;\n\n      __exponent = __n / __exponentiate_threshold;\n      __rest = __n % __exponentiate_threshold;\n      if (0 == __rest)\n\t__remainder = 0;\n      else\n\t{\n\t  __rest_buffer = this->_Data_allocate(_S_rounded_up_size(__rest));\n\t  __uninitialized_fill_n_a(__rest_buffer, __rest, __c,\n\t\t\t\t   get_allocator());\n\t  _S_cond_store_eos(__rest_buffer[__rest]);\n\t  try\n\t    { __remainder = _S_new_RopeLeaf(__rest_buffer, __rest, __a); }\n\t  catch(...)\n\t    {\n\t      _RopeRep::__STL_FREE_STRING(__rest_buffer, __rest, __a);\n\t      __throw_exception_again;\n\t    }\n\t}\n      __remainder_rope._M_tree_ptr = __remainder;\n      if (__exponent != 0)\n\t{\n\t  _CharT* __base_buffer =\n\t    this->_Data_allocate(_S_rounded_up_size(__exponentiate_threshold));\n\t  _RopeLeaf* __base_leaf;\n\t  rope __base_rope;\n\t  __uninitialized_fill_n_a(__base_buffer, __exponentiate_threshold, __c,\n\t\t\t\t   get_allocator());\n\t  _S_cond_store_eos(__base_buffer[__exponentiate_threshold]);\n\t  try\n\t    {\n\t      __base_leaf = _S_new_RopeLeaf(__base_buffer,\n\t\t\t\t\t    __exponentiate_threshold, __a);\n\t    }\n\t  catch(...)\n\t    {\n\t      _RopeRep::__STL_FREE_STRING(__base_buffer,\n\t\t\t\t\t  __exponentiate_threshold, __a);\n\t      __throw_exception_again;\n\t    }\n\t  __base_rope._M_tree_ptr = __base_leaf;\n\t  if (1 == __exponent)\n\t    __result = __base_rope;\n\t  else\n\t    __result = power(__base_rope, __exponent,\n\t\t\t     _Rope_Concat_fn<_CharT, _Alloc>());\n\t    \n\t  if (0 != __remainder)\n\t    __result += __remainder_rope;\n\t}\n      else\n\t__result = __remainder_rope;\n\t  \n      this->_M_tree_ptr = __result._M_tree_ptr;\n      this->_M_tree_ptr->_M_ref_nonnil();\n    }\n      \n  template<class _CharT, class _Alloc>\n    _CharT\n    rope<_CharT, _Alloc>::_S_empty_c_str[1];\n      \n  template<class _CharT, class _Alloc>\n    const _CharT*\n    rope<_CharT, _Alloc>::\n    c_str() const\n    {\n      if (0 == this->_M_tree_ptr)\n\t{\n\t  _S_empty_c_str[0] = _S_eos((_CharT*)0);  // Possibly redundant,\n\t                                           // but probably fast.\n\t  return _S_empty_c_str;\n\t}\n      __gthread_mutex_lock (&this->_M_tree_ptr->_M_c_string_lock);\n      __GC_CONST _CharT* __result = this->_M_tree_ptr->_M_c_string;\n      if (0 == __result)\n\t{\n\t  size_t __s = size();\n\t  __result = this->_Data_allocate(__s + 1);\n\t  _S_flatten(this->_M_tree_ptr, __result);\n\t  __result[__s] = _S_eos((_CharT*)0);\n\t  this->_M_tree_ptr->_M_c_string = __result;\n\t}\n      __gthread_mutex_unlock (&this->_M_tree_ptr->_M_c_string_lock);\n      return(__result);\n    }\n  \n  template<class _CharT, class _Alloc>\n    const _CharT* rope<_CharT, _Alloc>::\n    replace_with_c_str()\n    {\n      if (0 == this->_M_tree_ptr)\n\t{\n\t  _S_empty_c_str[0] = _S_eos((_CharT*)0);\n\t  return _S_empty_c_str;\n\t}\n      __GC_CONST _CharT* __old_c_string = this->_M_tree_ptr->_M_c_string;\n      if (__detail::_S_leaf == this->_M_tree_ptr->_M_tag\n\t  && 0 != __old_c_string)\n\treturn(__old_c_string);\n      size_t __s = size();\n      _CharT* __result = this->_Data_allocate(_S_rounded_up_size(__s));\n      _S_flatten(this->_M_tree_ptr, __result);\n      __result[__s] = _S_eos((_CharT*)0);\n      this->_M_tree_ptr->_M_unref_nonnil();\n      this->_M_tree_ptr = _S_new_RopeLeaf(__result, __s,\n\t\t\t\t\t  this->get_allocator());\n      return(__result);\n    }\n\n  // Algorithm specializations.  More should be added.\n  \n  template<class _Rope_iterator>  // was templated on CharT and Alloc\n    void\t\t          // VC++ workaround\n    _Rope_rotate(_Rope_iterator __first,\n\t\t _Rope_iterator __middle,\n\t\t _Rope_iterator __last)\n    {\n      typedef typename _Rope_iterator::value_type _CharT;\n      typedef typename _Rope_iterator::_allocator_type _Alloc;\n      \n      rope<_CharT, _Alloc>& __r(__first.container());\n      rope<_CharT, _Alloc> __prefix = __r.substr(0, __first.index());\n      rope<_CharT, _Alloc> __suffix =\n\t__r.substr(__last.index(), __r.size() - __last.index());\n      rope<_CharT, _Alloc> __part1 =\n\t__r.substr(__middle.index(), __last.index() - __middle.index());\n      rope<_CharT, _Alloc> __part2 =\n\t__r.substr(__first.index(), __middle.index() - __first.index());\n      __r = __prefix;\n      __r += __part1;\n      __r += __part2;\n      __r += __suffix;\n    }\n\n#if !defined(__GNUC__)\n  // Appears to confuse g++\n  inline void\n  rotate(_Rope_iterator<char, __STL_DEFAULT_ALLOCATOR(char)> __first,\n\t _Rope_iterator<char, __STL_DEFAULT_ALLOCATOR(char)> __middle,\n\t _Rope_iterator<char, __STL_DEFAULT_ALLOCATOR(char)> __last)\n  { _Rope_rotate(__first, __middle, __last); }\n#endif\n\n# if 0\n  // Probably not useful for several reasons:\n  // - for SGIs 7.1 compiler and probably some others,\n  //   this forces lots of rope<wchar_t, ...> instantiations, creating a\n  //   code bloat and compile time problem.  (Fixed in 7.2.)\n  // - wchar_t is 4 bytes wide on most UNIX platforms, making it\n  //   unattractive for unicode strings.  Unsigned short may be a better\n  //   character type.\n  inline void\n  rotate(_Rope_iterator<wchar_t, __STL_DEFAULT_ALLOCATOR(char)> __first,\n\t _Rope_iterator<wchar_t, __STL_DEFAULT_ALLOCATOR(char)> __middle,\n\t _Rope_iterator<wchar_t, __STL_DEFAULT_ALLOCATOR(char)> __last)\n  { _Rope_rotate(__first, __middle, __last); }\n# endif\n\n_GLIBCXX_END_NAMESPACE\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/slist",
    "content": "// Singly-linked list implementation -*- C++ -*-\n\n// Copyright (C) 2001, 2002, 2004, 2005 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n/*\n * Copyright (c) 1997\n * Silicon Graphics Computer Systems, Inc.\n *\n * Permission to use, copy, modify, distribute and sell this software\n * and its documentation for any purpose is hereby granted without fee,\n * provided that the above copyright notice appear in all copies and\n * that both that copyright notice and this permission notice appear\n * in supporting documentation.  Silicon Graphics makes no\n * representations about the suitability of this software for any\n * purpose.  It is provided \"as is\" without express or implied warranty.\n *\n */\n\n/** @file ext/slist\n *  This file is a GNU extension to the Standard C++ Library (possibly\n *  containing extensions from the HP/SGI STL subset). \n */\n\n#ifndef _SLIST\n#define _SLIST 1\n\n#include <bits/stl_algobase.h>\n#include <bits/allocator.h>\n#include <bits/stl_construct.h>\n#include <bits/stl_uninitialized.h>\n#include <bits/concept_check.h>\n\n_GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)\n\n  using std::size_t;\n  using std::ptrdiff_t;\n  using std::_Construct;\n  using std::_Destroy;\n  using std::allocator;\n  using std::__true_type;\n  using std::__false_type;\n\n  struct _Slist_node_base\n  {\n    _Slist_node_base* _M_next;\n  };\n  \n  inline _Slist_node_base*\n  __slist_make_link(_Slist_node_base* __prev_node,\n\t\t    _Slist_node_base* __new_node)\n  {\n    __new_node->_M_next = __prev_node->_M_next;\n    __prev_node->_M_next = __new_node;\n    return __new_node;\n  }\n\n  inline _Slist_node_base*\n  __slist_previous(_Slist_node_base* __head,\n\t\t   const _Slist_node_base* __node)\n  {\n    while (__head && __head->_M_next != __node)\n      __head = __head->_M_next;\n    return __head;\n  }\n\n  inline const _Slist_node_base*\n  __slist_previous(const _Slist_node_base* __head,\n\t\t   const _Slist_node_base* __node)\n  {\n    while (__head && __head->_M_next != __node)\n      __head = __head->_M_next;\n    return __head;\n  }\n\n  inline void\n  __slist_splice_after(_Slist_node_base* __pos,\n\t\t       _Slist_node_base* __before_first,\n\t\t       _Slist_node_base* __before_last)\n  {\n    if (__pos != __before_first && __pos != __before_last)\n      {\n\t_Slist_node_base* __first = __before_first->_M_next;\n\t_Slist_node_base* __after = __pos->_M_next;\n\t__before_first->_M_next = __before_last->_M_next;\n\t__pos->_M_next = __first;\n\t__before_last->_M_next = __after;\n      }\n  }\n\n  inline void\n  __slist_splice_after(_Slist_node_base* __pos, _Slist_node_base* __head)\n  {\n    _Slist_node_base* __before_last = __slist_previous(__head, 0);\n    if (__before_last != __head)\n      {\n\t_Slist_node_base* __after = __pos->_M_next;\n\t__pos->_M_next = __head->_M_next;\n\t__head->_M_next = 0;\n\t__before_last->_M_next = __after;\n      }\n  }\n\n  inline _Slist_node_base*\n  __slist_reverse(_Slist_node_base* __node)\n  {\n    _Slist_node_base* __result = __node;\n    __node = __node->_M_next;\n    __result->_M_next = 0;\n    while(__node)\n      {\n\t_Slist_node_base* __next = __node->_M_next;\n\t__node->_M_next = __result;\n\t__result = __node;\n\t__node = __next;\n      }\n    return __result;\n  }\n\n  inline size_t\n  __slist_size(_Slist_node_base* __node)\n  {\n    size_t __result = 0;\n    for (; __node != 0; __node = __node->_M_next)\n      ++__result;\n    return __result;\n  }\n\n  template <class _Tp>\n    struct _Slist_node : public _Slist_node_base\n    {\n      _Tp _M_data;\n    };\n\n  struct _Slist_iterator_base\n  {\n    typedef size_t                    size_type;\n    typedef ptrdiff_t                 difference_type;\n    typedef std::forward_iterator_tag iterator_category;\n\n    _Slist_node_base* _M_node;\n    \n    _Slist_iterator_base(_Slist_node_base* __x)\n    : _M_node(__x) {}\n\n    void\n    _M_incr()\n    { _M_node = _M_node->_M_next; }\n\n    bool\n    operator==(const _Slist_iterator_base& __x) const\n    { return _M_node == __x._M_node; }\n\n    bool\n    operator!=(const _Slist_iterator_base& __x) const\n    { return _M_node != __x._M_node; }\n  };\n\n  template <class _Tp, class _Ref, class _Ptr>\n    struct _Slist_iterator : public _Slist_iterator_base\n    {\n      typedef _Slist_iterator<_Tp, _Tp&, _Tp*>             iterator;\n      typedef _Slist_iterator<_Tp, const _Tp&, const _Tp*> const_iterator;\n      typedef _Slist_iterator<_Tp, _Ref, _Ptr>             _Self;\n\n      typedef _Tp              value_type;\n      typedef _Ptr             pointer;\n      typedef _Ref             reference;\n      typedef _Slist_node<_Tp> _Node;\n\n      explicit\n      _Slist_iterator(_Node* __x)\n      : _Slist_iterator_base(__x) {}\n\n      _Slist_iterator()\n      : _Slist_iterator_base(0) {}\n\n      _Slist_iterator(const iterator& __x)\n      : _Slist_iterator_base(__x._M_node) {}\n\n      reference\n      operator*() const\n      { return ((_Node*) _M_node)->_M_data; }\n\n      pointer\n      operator->() const\n      { return &(operator*()); }\n\n      _Self&\n      operator++()\n      {\n\t_M_incr();\n\treturn *this;\n      }\n\n      _Self\n      operator++(int)\n      {\n\t_Self __tmp = *this;\n\t_M_incr();\n\treturn __tmp;\n      }\n    };\n\n  template <class _Tp, class _Alloc>\n    struct _Slist_base\n    : public _Alloc::template rebind<_Slist_node<_Tp> >::other\n    {\n      typedef typename _Alloc::template rebind<_Slist_node<_Tp> >::other\n        _Node_alloc;\n      typedef _Alloc allocator_type;\n\n      allocator_type\n      get_allocator() const\n      { return *static_cast<const _Node_alloc*>(this); }\n\n      _Slist_base(const allocator_type& __a)\n      : _Node_alloc(__a)\n      { this->_M_head._M_next = 0; }\n\n      ~_Slist_base()\n      { _M_erase_after(&this->_M_head, 0); }\n\n    protected:\n      _Slist_node_base _M_head;\n\n      _Slist_node<_Tp>*\n      _M_get_node()\n      { return _Node_alloc::allocate(1); }\n  \n      void\n      _M_put_node(_Slist_node<_Tp>* __p)\n      { _Node_alloc::deallocate(__p, 1); }\n\n    protected:\n      _Slist_node_base* _M_erase_after(_Slist_node_base* __pos)\n      {\n\t_Slist_node<_Tp>* __next = (_Slist_node<_Tp>*) (__pos->_M_next);\n\t_Slist_node_base* __next_next = __next->_M_next;\n\t__pos->_M_next = __next_next;\n\tget_allocator().destroy(&__next->_M_data);\n\t_M_put_node(__next);\n\treturn __next_next;\n      }\n      _Slist_node_base* _M_erase_after(_Slist_node_base*, _Slist_node_base*);\n    };\n\n  template <class _Tp, class _Alloc>\n    _Slist_node_base*\n    _Slist_base<_Tp,_Alloc>::_M_erase_after(_Slist_node_base* __before_first,\n\t\t\t\t\t    _Slist_node_base* __last_node)\n    {\n      _Slist_node<_Tp>* __cur = (_Slist_node<_Tp>*) (__before_first->_M_next);\n      while (__cur != __last_node)\n\t{\n\t  _Slist_node<_Tp>* __tmp = __cur;\n\t  __cur = (_Slist_node<_Tp>*) __cur->_M_next;\n\t  get_allocator().destroy(&__tmp->_M_data);\n\t  _M_put_node(__tmp);\n\t}\n      __before_first->_M_next = __last_node;\n      return __last_node;\n    }\n\n  /**\n   *  This is an SGI extension.\n   *  @ingroup SGIextensions\n   *  @doctodo\n   */\n  template <class _Tp, class _Alloc = allocator<_Tp> >\n    class slist : private _Slist_base<_Tp,_Alloc>\n    {\n      // concept requirements\n      __glibcxx_class_requires(_Tp, _SGIAssignableConcept)\n\t\n    private:\n      typedef _Slist_base<_Tp,_Alloc> _Base;\n\n    public:\n      typedef _Tp               value_type;\n      typedef value_type*       pointer;\n      typedef const value_type* const_pointer;\n      typedef value_type&       reference;\n      typedef const value_type& const_reference;\n      typedef size_t            size_type;\n      typedef ptrdiff_t         difference_type;\n      \n      typedef _Slist_iterator<_Tp, _Tp&, _Tp*>             iterator;\n      typedef _Slist_iterator<_Tp, const _Tp&, const _Tp*> const_iterator;\n      \n      typedef typename _Base::allocator_type allocator_type;\n\n      allocator_type\n      get_allocator() const\n      { return _Base::get_allocator(); }\n\n    private:\n      typedef _Slist_node<_Tp>      _Node;\n      typedef _Slist_node_base      _Node_base;\n      typedef _Slist_iterator_base  _Iterator_base;\n      \n      _Node*\n      _M_create_node(const value_type& __x)\n      {\n\t_Node* __node = this->_M_get_node();\n\ttry\n\t  {\n\t    get_allocator().construct(&__node->_M_data, __x);\n\t    __node->_M_next = 0;\n\t  }\n\tcatch(...)\n\t  {\n\t    this->_M_put_node(__node);\n\t    __throw_exception_again;\n\t  }\n\treturn __node;\n      }\n\n      _Node*\n      _M_create_node()\n      {\n\t_Node* __node = this->_M_get_node();\n\ttry\n\t  {\n\t    get_allocator().construct(&__node->_M_data, value_type());\n\t    __node->_M_next = 0;\n\t  }\n\tcatch(...)\n\t  {\n\t    this->_M_put_node(__node);\n\t    __throw_exception_again;\n\t  }\n\treturn __node;\n      }\n\n    public:\n      explicit\n      slist(const allocator_type& __a = allocator_type())\n      : _Base(__a) {}\n\n      slist(size_type __n, const value_type& __x,\n\t    const allocator_type& __a =  allocator_type())\n      : _Base(__a)\n      { _M_insert_after_fill(&this->_M_head, __n, __x); }\n\n      explicit\n      slist(size_type __n)\n      : _Base(allocator_type())\n      { _M_insert_after_fill(&this->_M_head, __n, value_type()); }\n\n      // We don't need any dispatching tricks here, because\n      // _M_insert_after_range already does them.\n      template <class _InputIterator>\n        slist(_InputIterator __first, _InputIterator __last,\n\t      const allocator_type& __a =  allocator_type())\n\t: _Base(__a)\n        { _M_insert_after_range(&this->_M_head, __first, __last); }\n\n      slist(const slist& __x)\n      : _Base(__x.get_allocator())\n      { _M_insert_after_range(&this->_M_head, __x.begin(), __x.end()); }\n\n      slist&\n      operator= (const slist& __x);\n\n      ~slist() {}\n\n    public:\n      // assign(), a generalized assignment member function.  Two\n      // versions: one that takes a count, and one that takes a range.\n      // The range version is a member template, so we dispatch on whether\n      // or not the type is an integer.\n      \n      void\n      assign(size_type __n, const _Tp& __val)\n      { _M_fill_assign(__n, __val); }\n\n      void\n      _M_fill_assign(size_type __n, const _Tp& __val);\n\n      template <class _InputIterator>\n        void\n        assign(_InputIterator __first, _InputIterator __last)\n        {\n\t  typedef typename std::__is_integer<_InputIterator>::__type _Integral;\n\t  _M_assign_dispatch(__first, __last, _Integral());\n\t}\n\n      template <class _Integer>\n      void\n      _M_assign_dispatch(_Integer __n, _Integer __val, __true_type)\n      { _M_fill_assign((size_type) __n, (_Tp) __val); }\n\n      template <class _InputIterator>\n      void\n      _M_assign_dispatch(_InputIterator __first, _InputIterator __last,\n\t\t\t __false_type);\n\n    public:\n\n      iterator\n      begin()\n      { return iterator((_Node*)this->_M_head._M_next); }\n\n      const_iterator\n      begin() const\n      { return const_iterator((_Node*)this->_M_head._M_next);}\n\n      iterator\n      end()\n      { return iterator(0); }\n\n      const_iterator\n      end() const\n      { return const_iterator(0); }\n\n      // Experimental new feature: before_begin() returns a\n      // non-dereferenceable iterator that, when incremented, yields\n      // begin().  This iterator may be used as the argument to\n      // insert_after, erase_after, etc.  Note that even for an empty\n      // slist, before_begin() is not the same iterator as end().  It\n      // is always necessary to increment before_begin() at least once to\n      // obtain end().\n      iterator\n      before_begin()\n      { return iterator((_Node*) &this->_M_head); }\n\n      const_iterator\n      before_begin() const\n      { return const_iterator((_Node*) &this->_M_head); }\n\n      size_type\n      size() const\n      { return __slist_size(this->_M_head._M_next); }\n\n      size_type\n      max_size() const\n      { return size_type(-1); }\n\n      bool\n      empty() const\n      { return this->_M_head._M_next == 0; }\n\n      void\n      swap(slist& __x)\n      { std::swap(this->_M_head._M_next, __x._M_head._M_next); }\n\n    public:\n\n      reference\n      front()\n      { return ((_Node*) this->_M_head._M_next)->_M_data; }\n\n      const_reference\n      front() const\n      { return ((_Node*) this->_M_head._M_next)->_M_data; }\n\n      void\n      push_front(const value_type& __x)\n      { __slist_make_link(&this->_M_head, _M_create_node(__x)); }\n\n      void\n      push_front()\n      { __slist_make_link(&this->_M_head, _M_create_node()); }\n\n      void\n      pop_front()\n      {\n\t_Node* __node = (_Node*) this->_M_head._M_next;\n\tthis->_M_head._M_next = __node->_M_next;\n\tget_allocator().destroy(&__node->_M_data);\n\tthis->_M_put_node(__node);\n      }\n\n      iterator\n      previous(const_iterator __pos)\n      { return iterator((_Node*) __slist_previous(&this->_M_head,\n\t\t\t\t\t\t  __pos._M_node)); }\n\n      const_iterator\n      previous(const_iterator __pos) const\n      { return const_iterator((_Node*) __slist_previous(&this->_M_head,\n\t\t\t\t\t\t\t__pos._M_node)); }\n\n    private:\n      _Node*\n      _M_insert_after(_Node_base* __pos, const value_type& __x)\n      { return (_Node*) (__slist_make_link(__pos, _M_create_node(__x))); }\n\n      _Node*\n      _M_insert_after(_Node_base* __pos)\n      { return (_Node*) (__slist_make_link(__pos, _M_create_node())); }\n\n      void\n      _M_insert_after_fill(_Node_base* __pos,\n\t\t\t   size_type __n, const value_type& __x)\n      {\n\tfor (size_type __i = 0; __i < __n; ++__i)\n\t  __pos = __slist_make_link(__pos, _M_create_node(__x));\n      }\n\n      // Check whether it's an integral type.  If so, it's not an iterator.\n      template <class _InIterator>\n        void\n        _M_insert_after_range(_Node_base* __pos,\n\t\t\t      _InIterator __first, _InIterator __last)\n        {\n\t  typedef typename std::__is_integer<_InIterator>::__type _Integral;\n\t  _M_insert_after_range(__pos, __first, __last, _Integral());\n\t}\n\n      template <class _Integer>\n        void\n        _M_insert_after_range(_Node_base* __pos, _Integer __n, _Integer __x,\n\t\t\t      __true_type)\n        { _M_insert_after_fill(__pos, __n, __x); }\n\n      template <class _InIterator>\n        void\n        _M_insert_after_range(_Node_base* __pos,\n\t\t\t      _InIterator __first, _InIterator __last,\n\t\t\t      __false_type)\n        {\n\t  while (__first != __last)\n\t    {\n\t      __pos = __slist_make_link(__pos, _M_create_node(*__first));\n\t      ++__first;\n\t    }\n\t}\n\n    public:\n      iterator\n      insert_after(iterator __pos, const value_type& __x)\n      { return iterator(_M_insert_after(__pos._M_node, __x)); }\n\n      iterator\n      insert_after(iterator __pos)\n      { return insert_after(__pos, value_type()); }\n\n      void\n      insert_after(iterator __pos, size_type __n, const value_type& __x)\n      { _M_insert_after_fill(__pos._M_node, __n, __x); }\n\n      // We don't need any dispatching tricks here, because\n      // _M_insert_after_range already does them.\n      template <class _InIterator>\n        void\n        insert_after(iterator __pos, _InIterator __first, _InIterator __last)\n        { _M_insert_after_range(__pos._M_node, __first, __last); }\n\n      iterator\n      insert(iterator __pos, const value_type& __x)\n      { return iterator(_M_insert_after(__slist_previous(&this->_M_head,\n\t\t\t\t\t\t\t __pos._M_node),\n\t\t\t\t\t__x)); }\n\n      iterator\n      insert(iterator __pos)\n      { return iterator(_M_insert_after(__slist_previous(&this->_M_head,\n\t\t\t\t\t\t\t __pos._M_node),\n\t\t\t\t\tvalue_type())); }\n\n      void\n      insert(iterator __pos, size_type __n, const value_type& __x)\n      { _M_insert_after_fill(__slist_previous(&this->_M_head, __pos._M_node),\n\t\t\t     __n, __x); }\n\n      // We don't need any dispatching tricks here, because\n      // _M_insert_after_range already does them.\n      template <class _InIterator>\n        void\n        insert(iterator __pos, _InIterator __first, _InIterator __last)\n        { _M_insert_after_range(__slist_previous(&this->_M_head, __pos._M_node),\n\t\t\t\t__first, __last); }\n\n    public:\n      iterator\n      erase_after(iterator __pos)\n      { return iterator((_Node*) this->_M_erase_after(__pos._M_node)); }\n\n      iterator\n      erase_after(iterator __before_first, iterator __last)\n      { \n\treturn iterator((_Node*) this->_M_erase_after(__before_first._M_node,\n\t\t\t\t\t\t      __last._M_node));\n      }\n\n      iterator\n      erase(iterator __pos)\n      { \n\treturn iterator((_Node*) this->_M_erase_after\n\t\t\t(__slist_previous(&this->_M_head, __pos._M_node)));\n      }\n\n      iterator\n      erase(iterator __first, iterator __last)\n      { \n\treturn iterator((_Node*) this->_M_erase_after\n\t\t\t(__slist_previous(&this->_M_head, __first._M_node),\n\t\t\t __last._M_node));\n      }\n      \n      void\n      resize(size_type new_size, const _Tp& __x);\n\n      void\n      resize(size_type new_size)\n      { resize(new_size, _Tp()); }\n\n      void\n      clear()\n      { this->_M_erase_after(&this->_M_head, 0); }\n\n    public:\n      // Moves the range [__before_first + 1, __before_last + 1) to *this,\n      //  inserting it immediately after __pos.  This is constant time.\n      void\n      splice_after(iterator __pos,\n\t\t   iterator __before_first, iterator __before_last)\n      {\n\tif (__before_first != __before_last)\n\t  __slist_splice_after(__pos._M_node, __before_first._M_node,\n\t\t\t       __before_last._M_node);\n      }\n\n      // Moves the element that follows __prev to *this, inserting it\n      // immediately after __pos.  This is constant time.\n      void\n      splice_after(iterator __pos, iterator __prev)\n      { __slist_splice_after(__pos._M_node,\n\t\t\t     __prev._M_node, __prev._M_node->_M_next); }\n\n      // Removes all of the elements from the list __x to *this, inserting\n      // them immediately after __pos.  __x must not be *this.  Complexity:\n      // linear in __x.size().\n      void\n      splice_after(iterator __pos, slist& __x)\n      { __slist_splice_after(__pos._M_node, &__x._M_head); }\n\n      // Linear in distance(begin(), __pos), and linear in __x.size().\n      void\n      splice(iterator __pos, slist& __x)\n      {\n\tif (__x._M_head._M_next)\n\t  __slist_splice_after(__slist_previous(&this->_M_head, __pos._M_node),\n\t\t\t       &__x._M_head,\n\t\t\t       __slist_previous(&__x._M_head, 0)); }\n\n      // Linear in distance(begin(), __pos), and in distance(__x.begin(), __i).\n      void\n      splice(iterator __pos, slist& __x, iterator __i)\n      { __slist_splice_after(__slist_previous(&this->_M_head, __pos._M_node),\n\t\t\t     __slist_previous(&__x._M_head, __i._M_node),\n\t\t\t     __i._M_node); }\n\n      // Linear in distance(begin(), __pos), in distance(__x.begin(), __first),\n      // and in distance(__first, __last).\n      void\n      splice(iterator __pos, slist& __x, iterator __first, iterator __last)\n      {\n\tif (__first != __last)\n\t  __slist_splice_after(__slist_previous(&this->_M_head, __pos._M_node),\n\t\t\t       __slist_previous(&__x._M_head, __first._M_node),\n\t\t\t       __slist_previous(__first._M_node,\n\t\t\t\t\t\t__last._M_node));\n      }\n\n    public:\n      void\n      reverse()\n      {\n\tif (this->_M_head._M_next)\n\t  this->_M_head._M_next = __slist_reverse(this->_M_head._M_next);\n      }\n\n      void\n      remove(const _Tp& __val);\n\n      void\n      unique();\n      \n      void\n      merge(slist& __x);\n      \n      void\n      sort();\n\n      template <class _Predicate>\n        void\n        remove_if(_Predicate __pred);\n\n      template <class _BinaryPredicate>\n        void\n        unique(_BinaryPredicate __pred);\n\n      template <class _StrictWeakOrdering>\n        void\n        merge(slist&, _StrictWeakOrdering);\n\n      template <class _StrictWeakOrdering>\n        void\n        sort(_StrictWeakOrdering __comp);\n    };\n\n  template <class _Tp, class _Alloc>\n    slist<_Tp, _Alloc>&\n    slist<_Tp, _Alloc>::operator=(const slist<_Tp, _Alloc>& __x)\n    {\n      if (&__x != this)\n\t{\n\t  _Node_base* __p1 = &this->_M_head;\n\t  _Node* __n1 = (_Node*) this->_M_head._M_next;\n\t  const _Node* __n2 = (const _Node*) __x._M_head._M_next;\n\t  while (__n1 && __n2)\n\t    {\n\t      __n1->_M_data = __n2->_M_data;\n\t      __p1 = __n1;\n\t      __n1 = (_Node*) __n1->_M_next;\n\t      __n2 = (const _Node*) __n2->_M_next;\n\t    }\n\t  if (__n2 == 0)\n\t    this->_M_erase_after(__p1, 0);\n\t  else\n\t    _M_insert_after_range(__p1, const_iterator((_Node*)__n2),\n                                  const_iterator(0));\n\t}\n      return *this;\n    }\n\n  template <class _Tp, class _Alloc>\n    void\n    slist<_Tp, _Alloc>::_M_fill_assign(size_type __n, const _Tp& __val)\n    {\n      _Node_base* __prev = &this->_M_head;\n      _Node* __node = (_Node*) this->_M_head._M_next;\n      for (; __node != 0 && __n > 0; --__n)\n\t{\n\t  __node->_M_data = __val;\n\t  __prev = __node;\n\t  __node = (_Node*) __node->_M_next;\n\t}\n      if (__n > 0)\n\t_M_insert_after_fill(__prev, __n, __val);\n      else\n\tthis->_M_erase_after(__prev, 0);\n    }\n  \n  template <class _Tp, class _Alloc>\n    template <class _InputIterator>\n      void\n      slist<_Tp, _Alloc>::_M_assign_dispatch(_InputIterator __first,\n\t\t\t\t\t     _InputIterator __last,\n\t\t\t\t\t     __false_type)\n      {\n\t_Node_base* __prev = &this->_M_head;\n\t_Node* __node = (_Node*) this->_M_head._M_next;\n\twhile (__node != 0 && __first != __last)\n\t  {\n\t    __node->_M_data = *__first;\n\t    __prev = __node;\n\t    __node = (_Node*) __node->_M_next;\n\t    ++__first;\n\t  }\n\tif (__first != __last)\n\t  _M_insert_after_range(__prev, __first, __last);\n\telse\n\t  this->_M_erase_after(__prev, 0);\n      }\n  \n  template <class _Tp, class _Alloc>\n    inline bool\n    operator==(const slist<_Tp, _Alloc>& _SL1, const slist<_Tp, _Alloc>& _SL2)\n    {\n      typedef typename slist<_Tp,_Alloc>::const_iterator const_iterator;\n      const_iterator __end1 = _SL1.end();\n      const_iterator __end2 = _SL2.end();\n      \n      const_iterator __i1 = _SL1.begin();\n      const_iterator __i2 = _SL2.begin();\n      while (__i1 != __end1 && __i2 != __end2 && *__i1 == *__i2)\n\t{\n\t  ++__i1;\n\t  ++__i2;\n\t}\n      return __i1 == __end1 && __i2 == __end2;\n    }\n\n\n  template <class _Tp, class _Alloc>\n    inline bool\n    operator<(const slist<_Tp, _Alloc>& _SL1, const slist<_Tp, _Alloc>& _SL2)\n    { return std::lexicographical_compare(_SL1.begin(), _SL1.end(),\n\t\t\t\t\t  _SL2.begin(), _SL2.end()); }\n\n  template <class _Tp, class _Alloc>\n    inline bool\n    operator!=(const slist<_Tp, _Alloc>& _SL1, const slist<_Tp, _Alloc>& _SL2)\n    { return !(_SL1 == _SL2); }\n\n  template <class _Tp, class _Alloc>\n    inline bool\n    operator>(const slist<_Tp, _Alloc>& _SL1, const slist<_Tp, _Alloc>& _SL2)\n    { return _SL2 < _SL1; }\n\n  template <class _Tp, class _Alloc>\n    inline bool\n    operator<=(const slist<_Tp, _Alloc>& _SL1, const slist<_Tp, _Alloc>& _SL2)\n    { return !(_SL2 < _SL1); }\n\n  template <class _Tp, class _Alloc>\n    inline bool\n    operator>=(const slist<_Tp, _Alloc>& _SL1, const slist<_Tp, _Alloc>& _SL2)\n    { return !(_SL1 < _SL2); }\n\n  template <class _Tp, class _Alloc>\n    inline void\n    swap(slist<_Tp, _Alloc>& __x, slist<_Tp, _Alloc>& __y)\n    { __x.swap(__y); }\n\n  template <class _Tp, class _Alloc>\n    void\n    slist<_Tp, _Alloc>::resize(size_type __len, const _Tp& __x)\n    {\n      _Node_base* __cur = &this->_M_head;\n      while (__cur->_M_next != 0 && __len > 0)\n\t{\n\t  --__len;\n\t  __cur = __cur->_M_next;\n\t}\n      if (__cur->_M_next)\n\tthis->_M_erase_after(__cur, 0);\n      else\n\t_M_insert_after_fill(__cur, __len, __x);\n    }\n\n  template <class _Tp, class _Alloc>\n    void\n    slist<_Tp, _Alloc>::remove(const _Tp& __val)\n    { \n      _Node_base* __cur = &this->_M_head;\n      while (__cur && __cur->_M_next)\n\t{\n\t  if (((_Node*) __cur->_M_next)->_M_data == __val)\n\t    this->_M_erase_after(__cur);\n\t  else\n\t    __cur = __cur->_M_next;\n\t}\n    }\n\n  template <class _Tp, class _Alloc>\n    void\n    slist<_Tp, _Alloc>::unique()\n    {\n      _Node_base* __cur = this->_M_head._M_next;\n      if (__cur)\n\t{\n\t  while (__cur->_M_next)\n\t    {\n\t      if (((_Node*)__cur)->_M_data\n\t\t  == ((_Node*)(__cur->_M_next))->_M_data)\n\t\tthis->_M_erase_after(__cur);\n\t      else\n\t\t__cur = __cur->_M_next;\n\t    }\n\t}\n    }\n\n  template <class _Tp, class _Alloc>\n    void\n    slist<_Tp, _Alloc>::merge(slist<_Tp, _Alloc>& __x)\n    {\n      _Node_base* __n1 = &this->_M_head;\n      while (__n1->_M_next && __x._M_head._M_next)\n\t{\n\t  if (((_Node*) __x._M_head._M_next)->_M_data\n\t      < ((_Node*) __n1->_M_next)->_M_data)\n\t    __slist_splice_after(__n1, &__x._M_head, __x._M_head._M_next);\n\t  __n1 = __n1->_M_next;\n\t}\n      if (__x._M_head._M_next)\n\t{\n\t  __n1->_M_next = __x._M_head._M_next;\n\t  __x._M_head._M_next = 0;\n\t}\n    }\n\n  template <class _Tp, class _Alloc>\n    void\n    slist<_Tp, _Alloc>::sort()\n    {\n      if (this->_M_head._M_next && this->_M_head._M_next->_M_next)\n\t{\n\t  slist __carry;\n\t  slist __counter[64];\n\t  int __fill = 0;\n\t  while (!empty())\n\t    {\n\t      __slist_splice_after(&__carry._M_head,\n\t\t\t\t   &this->_M_head, this->_M_head._M_next);\n\t      int __i = 0;\n\t      while (__i < __fill && !__counter[__i].empty())\n\t\t{\n\t\t  __counter[__i].merge(__carry);\n\t\t  __carry.swap(__counter[__i]);\n\t\t  ++__i;\n\t\t}\n\t      __carry.swap(__counter[__i]);\n\t      if (__i == __fill)\n\t\t++__fill;\n\t    }\n\t  \n\t  for (int __i = 1; __i < __fill; ++__i)\n\t    __counter[__i].merge(__counter[__i-1]);\n\t  this->swap(__counter[__fill-1]);\n\t}\n    }\n\n  template <class _Tp, class _Alloc>\n    template <class _Predicate>\n      void slist<_Tp, _Alloc>::remove_if(_Predicate __pred)\n      {\n\t_Node_base* __cur = &this->_M_head;\n\twhile (__cur->_M_next)\n\t  {\n\t    if (__pred(((_Node*) __cur->_M_next)->_M_data))\n\t      this->_M_erase_after(__cur);\n\t    else\n\t      __cur = __cur->_M_next;\n\t  }\n      }\n\n  template <class _Tp, class _Alloc>\n    template <class _BinaryPredicate>\n      void\n      slist<_Tp, _Alloc>::unique(_BinaryPredicate __pred)\n      {\n\t_Node* __cur = (_Node*) this->_M_head._M_next;\n\tif (__cur)\n\t  {\n\t    while (__cur->_M_next)\n\t      {\n\t\tif (__pred(((_Node*)__cur)->_M_data,\n\t\t\t   ((_Node*)(__cur->_M_next))->_M_data))\n\t\t  this->_M_erase_after(__cur);\n\t\telse\n\t\t  __cur = (_Node*) __cur->_M_next;\n\t      }\n\t  }\n      }\n\n  template <class _Tp, class _Alloc>\n    template <class _StrictWeakOrdering>\n      void\n      slist<_Tp, _Alloc>::merge(slist<_Tp, _Alloc>& __x,\n\t\t\t       _StrictWeakOrdering __comp)\n      {\n\t_Node_base* __n1 = &this->_M_head;\n\twhile (__n1->_M_next && __x._M_head._M_next)\n\t  {\n\t    if (__comp(((_Node*) __x._M_head._M_next)->_M_data,\n\t\t       ((_Node*) __n1->_M_next)->_M_data))\n\t      __slist_splice_after(__n1, &__x._M_head, __x._M_head._M_next);\n\t    __n1 = __n1->_M_next;\n\t  }\n\tif (__x._M_head._M_next)\n\t  {\n\t    __n1->_M_next = __x._M_head._M_next;\n\t    __x._M_head._M_next = 0;\n\t  }\n      }\n\n  template <class _Tp, class _Alloc>\n    template <class _StrictWeakOrdering>\n      void\n      slist<_Tp, _Alloc>::sort(_StrictWeakOrdering __comp)\n      {\n\tif (this->_M_head._M_next && this->_M_head._M_next->_M_next)\n\t  {\n\t    slist __carry;\n\t    slist __counter[64];\n\t    int __fill = 0;\n\t    while (!empty())\n\t      {\n\t\t__slist_splice_after(&__carry._M_head,\n\t\t\t\t     &this->_M_head, this->_M_head._M_next);\n\t\tint __i = 0;\n\t\twhile (__i < __fill && !__counter[__i].empty())\n\t\t  {\n\t\t    __counter[__i].merge(__carry, __comp);\n\t\t    __carry.swap(__counter[__i]);\n\t\t    ++__i;\n\t\t  }\n\t\t__carry.swap(__counter[__i]);\n\t\tif (__i == __fill)\n\t\t  ++__fill;\n\t      }\n\n\t    for (int __i = 1; __i < __fill; ++__i)\n\t      __counter[__i].merge(__counter[__i-1], __comp);\n\t    this->swap(__counter[__fill-1]);\n\t  }\n      }\n\n_GLIBCXX_END_NAMESPACE\n\n_GLIBCXX_BEGIN_NAMESPACE(std)\n\n  // Specialization of insert_iterator so that insertions will be constant\n  // time rather than linear time.\n  template <class _Tp, class _Alloc>\n    class insert_iterator<__gnu_cxx::slist<_Tp, _Alloc> >\n    {\n    protected:\n      typedef __gnu_cxx::slist<_Tp, _Alloc> _Container;\n      _Container* container;\n      typename _Container::iterator iter;\n\n    public:\n      typedef _Container          container_type;\n      typedef output_iterator_tag iterator_category;\n      typedef void                value_type;\n      typedef void                difference_type;\n      typedef void                pointer;\n      typedef void                reference;\n\n      insert_iterator(_Container& __x, typename _Container::iterator __i)\n      : container(&__x)\n      {\n\tif (__i == __x.begin())\n\t  iter = __x.before_begin();\n\telse\n\t  iter = __x.previous(__i);\n      }\n\n      insert_iterator<_Container>&\n      operator=(const typename _Container::value_type& __value)\n      {\n\titer = container->insert_after(iter, __value);\n\treturn *this;\n      }\n\n      insert_iterator<_Container>&\n      operator*()\n      { return *this; }\n\n      insert_iterator<_Container>&\n      operator++()\n      { return *this; }\n\n      insert_iterator<_Container>&\n      operator++(int)\n      { return *this; }\n    };\n\n_GLIBCXX_END_NAMESPACE\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/sso_string_base.h",
    "content": "// Short-string-optimized versatile string base -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n/** @file ext/sso_string_base.h\n *  This file is a GNU extension to the Standard C++ Library.\n *  This is an internal header file, included by other library headers.\n *  You should not attempt to use it directly.\n */\n\n#ifndef _SSO_STRING_BASE_H\n#define _SSO_STRING_BASE_H 1\n\n_GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)\n\n  template<typename _CharT, typename _Traits, typename _Alloc>\n    class __sso_string_base\n    : protected __vstring_utility<_CharT, _Traits, _Alloc>\n    {\n    public:\n      typedef _Traits\t\t\t\t\t    traits_type;\n      typedef typename _Traits::char_type\t\t    value_type;\n\n      typedef __vstring_utility<_CharT, _Traits, _Alloc>    _Util_Base;\n      typedef typename _Util_Base::_CharT_alloc_type        _CharT_alloc_type;\n      typedef typename _CharT_alloc_type::size_type\t    size_type;\n      \n    private:\n      // Data Members:\n      typename _Util_Base::template _Alloc_hider<_CharT_alloc_type>\n                                                            _M_dataplus;\n      size_type                                             _M_string_length;\n\n      enum { _S_local_capacity = 15 };\n      \n      union\n      {\n\t_CharT           _M_local_data[_S_local_capacity + 1];\n\tsize_type        _M_allocated_capacity;\n      };\n\n      void\n      _M_data(_CharT* __p)\n      { _M_dataplus._M_p = __p; }\n\n      void\n      _M_length(size_type __length)\n      { _M_string_length = __length; }\n\n      void\n      _M_capacity(size_type __capacity)\n      { _M_allocated_capacity = __capacity; }\n\n      bool\n      _M_is_local() const\n      { return _M_data() == _M_local_data; }\n\n      // Create & Destroy\n      _CharT*\n      _M_create(size_type&, size_type);\n      \n      void\n      _M_dispose()\n      {\n\tif (!_M_is_local())\n\t  _M_destroy(_M_allocated_capacity);\n      }\n\n      void\n      _M_destroy(size_type __size) throw()\n      { _M_get_allocator().deallocate(_M_data(), __size + 1); }\n\n      // _M_construct_aux is used to implement the 21.3.1 para 15 which\n      // requires special behaviour if _InIterator is an integral type\n      template<typename _InIterator>\n        void\n        _M_construct_aux(_InIterator __beg, _InIterator __end, \n\t\t\t std::__false_type)\n\t{\n          typedef typename iterator_traits<_InIterator>::iterator_category _Tag;\n          _M_construct(__beg, __end, _Tag());\n\t}\n\n      template<typename _InIterator>\n        void\n        _M_construct_aux(_InIterator __beg, _InIterator __end, \n\t\t\t std::__true_type)\n\t{ _M_construct(static_cast<size_type>(__beg),\n\t\t       static_cast<value_type>(__end)); }\n\n      template<typename _InIterator>\n        void\n        _M_construct(_InIterator __beg, _InIterator __end)\n\t{\n\t  typedef typename std::__is_integer<_InIterator>::__type _Integral;\n\t  _M_construct_aux(__beg, __end, _Integral());\n        }\n\n      // For Input Iterators, used in istreambuf_iterators, etc.\n      template<typename _InIterator>\n        void\n        _M_construct(_InIterator __beg, _InIterator __end,\n\t\t     std::input_iterator_tag);\n      \n      // For forward_iterators up to random_access_iterators, used for\n      // string::iterator, _CharT*, etc.\n      template<typename _FwdIterator>\n        void\n        _M_construct(_FwdIterator __beg, _FwdIterator __end,\n\t\t     std::forward_iterator_tag);\n\n      void\n      _M_construct(size_type __req, _CharT __c);\n\n    public:\n      size_type\n      _M_max_size() const\n      { return (_M_get_allocator().max_size() - 1) / 2; }\n\n      _CharT*\n      _M_data() const\n      { return _M_dataplus._M_p; }\n\n      size_type\n      _M_length() const\n      { return _M_string_length; }\n\n      size_type\n      _M_capacity() const\n      {\n\treturn _M_is_local() ? size_type(_S_local_capacity)\n\t                     : _M_allocated_capacity; \n      }\n\n      bool\n      _M_is_shared() const\n      { return false; }\n\n      void\n      _M_set_leaked() { }\n\n      void\n      _M_leak() { }\n\n      void\n      _M_set_length(size_type __n)\n      {\n\t_M_length(__n);\n\ttraits_type::assign(_M_data()[__n], _CharT());\n      }\n\n      __sso_string_base()\n      : _M_dataplus(_Alloc(), _M_local_data)\n      { _M_set_length(0); }\n\n      __sso_string_base(const _Alloc& __a);\n\n      __sso_string_base(const __sso_string_base& __rcs);\n\n      __sso_string_base(size_type __n, _CharT __c, const _Alloc& __a);\n\n      template<typename _InputIterator>\n        __sso_string_base(_InputIterator __beg, _InputIterator __end,\n\t\t\t  const _Alloc& __a);\n\n      ~__sso_string_base()\n      { _M_dispose(); }\n\n      _CharT_alloc_type&\n      _M_get_allocator()\n      { return _M_dataplus; }\n\n      const _CharT_alloc_type&\n      _M_get_allocator() const\n      { return _M_dataplus; }\n\n      void\n      _M_swap(__sso_string_base& __rcs);\n\n      void\n      _M_assign(const __sso_string_base& __rcs);\n\n      void\n      _M_reserve(size_type __res);\n\n      void\n      _M_mutate(size_type __pos, size_type __len1, const _CharT* __s,\n\t\tsize_type __len2);\n\n      void\n      _M_erase(size_type __pos, size_type __n);\n\n      void\n      _M_clear()\n      { _M_set_length(0); }\n\n      bool\n      _M_compare(const __sso_string_base&) const\n      { return false; }\n    };\n\n  template<typename _CharT, typename _Traits, typename _Alloc>\n    void\n    __sso_string_base<_CharT, _Traits, _Alloc>::\n    _M_swap(__sso_string_base& __rcs)\n    {\n      // _GLIBCXX_RESOLVE_LIB_DEFECTS\n      // 431. Swapping containers with unequal allocators.\n      std::__alloc_swap<_CharT_alloc_type>::_S_do_it(_M_get_allocator(),\n\t\t\t\t\t\t     __rcs._M_get_allocator());\n\n      if (_M_is_local())\n\tif (__rcs._M_is_local())\n\t  {\n\t    if (_M_length() && __rcs._M_length())\n\t      {\n\t\t_CharT __tmp_data[_S_local_capacity + 1];\n\t\ttraits_type::copy(__tmp_data, __rcs._M_local_data,\n\t\t\t\t  _S_local_capacity + 1);\n\t\ttraits_type::copy(__rcs._M_local_data, _M_local_data,\n\t\t\t\t  _S_local_capacity + 1);\n\t\ttraits_type::copy(_M_local_data, __tmp_data,\n\t\t\t\t  _S_local_capacity + 1);\n\t      }\n\t    else if (__rcs._M_length())\n\t      {\n\t\ttraits_type::copy(_M_local_data, __rcs._M_local_data,\n\t\t\t\t  _S_local_capacity + 1);\n\t\t_M_length(__rcs._M_length());\n\t\t__rcs._M_set_length(0);\n\t\treturn;\n\t      }\n\t    else if (_M_length())\n\t      {\n\t\ttraits_type::copy(__rcs._M_local_data, _M_local_data,\n\t\t\t\t  _S_local_capacity + 1);\n\t\t__rcs._M_length(_M_length());\n\t\t_M_set_length(0);\n\t\treturn;\n\t      }\n\t  }\n\telse\n\t  {\n\t    const size_type __tmp_capacity = __rcs._M_allocated_capacity;\n\t    traits_type::copy(__rcs._M_local_data, _M_local_data,\n\t\t\t      _S_local_capacity + 1);\n\t    _M_data(__rcs._M_data());\n\t    __rcs._M_data(__rcs._M_local_data);\n\t    _M_capacity(__tmp_capacity);\n\t  }\n      else\n\t{\n\t  const size_type __tmp_capacity = _M_allocated_capacity;\n\t  if (__rcs._M_is_local())\n\t    {\n\t      traits_type::copy(_M_local_data, __rcs._M_local_data,\n\t\t\t\t_S_local_capacity + 1);\n\t      __rcs._M_data(_M_data());\n\t      _M_data(_M_local_data);\n\t    }\n\t  else\n\t    {\n\t      _CharT* __tmp_ptr = _M_data();\n\t      _M_data(__rcs._M_data());\n\t      __rcs._M_data(__tmp_ptr);\n\t      _M_capacity(__rcs._M_allocated_capacity);\n\t    }\n\t  __rcs._M_capacity(__tmp_capacity);\n\t}\n\n      const size_type __tmp_length = _M_length();\n      _M_length(__rcs._M_length());\n      __rcs._M_length(__tmp_length);\n    }\n\n  template<typename _CharT, typename _Traits, typename _Alloc>\n    _CharT*\n    __sso_string_base<_CharT, _Traits, _Alloc>::\n    _M_create(size_type& __capacity, size_type __old_capacity)\n    {\n      // _GLIBCXX_RESOLVE_LIB_DEFECTS\n      // 83.  String::npos vs. string::max_size()\n      if (__capacity > _M_max_size())\n\tstd::__throw_length_error(__N(\"__sso_string_base::_M_create\"));\n\n      // The below implements an exponential growth policy, necessary to\n      // meet amortized linear time requirements of the library: see\n      // http://gcc.gnu.org/ml/libstdc++/2001-07/msg00085.html.\n      if (__capacity > __old_capacity && __capacity < 2 * __old_capacity)\n\t{\n\t  __capacity = 2 * __old_capacity;\n\t  // Never allocate a string bigger than max_size.\n\t  if (__capacity > _M_max_size())\n\t    __capacity = _M_max_size();\n\t}\n\n      // NB: Need an array of char_type[__capacity], plus a terminating\n      // null char_type() element.\n      return _M_get_allocator().allocate(__capacity + 1);\n    }\n\n  template<typename _CharT, typename _Traits, typename _Alloc>\n    __sso_string_base<_CharT, _Traits, _Alloc>::\n    __sso_string_base(const _Alloc& __a)\n    : _M_dataplus(__a, _M_local_data)\n    { _M_set_length(0); }\n\n  template<typename _CharT, typename _Traits, typename _Alloc>\n    __sso_string_base<_CharT, _Traits, _Alloc>::\n    __sso_string_base(const __sso_string_base& __rcs)\n    : _M_dataplus(__rcs._M_get_allocator(), _M_local_data)\n    { _M_construct(__rcs._M_data(), __rcs._M_data() + __rcs._M_length()); }\n\n  template<typename _CharT, typename _Traits, typename _Alloc>\n    __sso_string_base<_CharT, _Traits, _Alloc>::\n    __sso_string_base(size_type __n, _CharT __c, const _Alloc& __a)\n    : _M_dataplus(__a, _M_local_data)\n    { _M_construct(__n, __c); }\n\n  template<typename _CharT, typename _Traits, typename _Alloc>\n    template<typename _InputIterator>\n    __sso_string_base<_CharT, _Traits, _Alloc>::\n    __sso_string_base(_InputIterator __beg, _InputIterator __end,\n\t\t      const _Alloc& __a)\n    : _M_dataplus(__a, _M_local_data)\n    { _M_construct(__beg, __end); }\n\n  // NB: This is the special case for Input Iterators, used in\n  // istreambuf_iterators, etc.\n  // Input Iterators have a cost structure very different from\n  // pointers, calling for a different coding style.\n  template<typename _CharT, typename _Traits, typename _Alloc>\n    template<typename _InIterator>\n      void\n      __sso_string_base<_CharT, _Traits, _Alloc>::\n      _M_construct(_InIterator __beg, _InIterator __end,\n\t\t   std::input_iterator_tag)\n      {\n\tsize_type __len = 0;\n\tsize_type __capacity = size_type(_S_local_capacity);\n\n\twhile (__beg != __end && __len < __capacity)\n\t  {\n\t    _M_data()[__len++] = *__beg;\n\t    ++__beg;\n\t  }\n\t\n\ttry\n\t  {\n\t    while (__beg != __end)\n\t      {\n\t\tif (__len == __capacity)\n\t\t  {\n\t\t    // Allocate more space.\n\t\t    __capacity = __len + 1;\n\t\t    _CharT* __another = _M_create(__capacity, __len);\n\t\t    _S_copy(__another, _M_data(), __len);\n\t\t    _M_dispose();\n\t\t    _M_data(__another);\n\t\t    _M_capacity(__capacity);\n\t\t  }\n\t\t_M_data()[__len++] = *__beg;\n\t\t++__beg;\n\t      }\n\t  }\n\tcatch(...)\n\t  {\n\t    _M_dispose();\n\t    __throw_exception_again;\n\t  }\n\n\t_M_set_length(__len);\n      }\n\n  template<typename _CharT, typename _Traits, typename _Alloc>\n    template<typename _InIterator>\n      void\n      __sso_string_base<_CharT, _Traits, _Alloc>::\n      _M_construct(_InIterator __beg, _InIterator __end,\n\t\t   std::forward_iterator_tag)\n      {\n\t// NB: Not required, but considered best practice.\n\tif (__builtin_expect(_S_is_null_pointer(__beg) && __beg != __end, 0))\n\t  std::__throw_logic_error(__N(\"__sso_string_base::\"\n\t\t\t\t       \"_M_construct NULL not valid\"));\n\n\tsize_type __dnew = static_cast<size_type>(std::distance(__beg, __end));\n\n\tif (__dnew > size_type(_S_local_capacity))\n\t  {\n\t    _M_data(_M_create(__dnew, size_type(0)));\n\t    _M_capacity(__dnew);\n\t  }\n\n\t// Check for out_of_range and length_error exceptions.\n\ttry\n\t  { _S_copy_chars(_M_data(), __beg, __end); }\n\tcatch(...)\n\t  {\n\t    _M_dispose();\n\t    __throw_exception_again;\n\t  }\n\n\t_M_set_length(__dnew);\n      }\n\n  template<typename _CharT, typename _Traits, typename _Alloc>\n    void\n    __sso_string_base<_CharT, _Traits, _Alloc>::\n    _M_construct(size_type __n, _CharT __c)\n    {\n      if (__n > size_type(_S_local_capacity))\n\t{\n\t  _M_data(_M_create(__n, size_type(0)));\n\t  _M_capacity(__n);\n\t}\n\n      if (__n)\n\t_S_assign(_M_data(), __n, __c);\n\n      _M_set_length(__n);\n    }\n\n  template<typename _CharT, typename _Traits, typename _Alloc>\n    void\n    __sso_string_base<_CharT, _Traits, _Alloc>::\n    _M_assign(const __sso_string_base& __rcs)\n    {\n      if (this != &__rcs)\n\t{\n\t  const size_type __rsize = __rcs._M_length();\n\t  const size_type __capacity = _M_capacity();\n\n\t  if (__rsize > __capacity)\n\t    {\n\t      size_type __new_capacity = __rsize;\n\t      _CharT* __tmp = _M_create(__new_capacity, __capacity);\n\t      _M_dispose();\n\t      _M_data(__tmp);\n\t      _M_capacity(__new_capacity);\n\t    }\n\n\t  if (__rsize)\n\t    _S_copy(_M_data(), __rcs._M_data(), __rsize);\n\n\t  _M_set_length(__rsize);\n\t}\n    }\n\n  template<typename _CharT, typename _Traits, typename _Alloc>\n    void\n    __sso_string_base<_CharT, _Traits, _Alloc>::\n    _M_reserve(size_type __res)\n    {\n      // Make sure we don't shrink below the current size.\n      if (__res < _M_length())\n\t__res = _M_length();\n\n      const size_type __capacity = _M_capacity();\n      if (__res != __capacity)\n\t{\n\t  if (__res > __capacity\n\t      || __res > size_type(_S_local_capacity))\n\t    {\n\t      _CharT* __tmp = _M_create(__res, __capacity);\n\t      _S_copy(__tmp, _M_data(), _M_length() + 1);\n\t      _M_dispose();\n\t      _M_data(__tmp);\n\t      _M_capacity(__res);\n\t    }\n\t  else if (!_M_is_local())\n\t    {\n\t      _S_copy(_M_local_data, _M_data(), _M_length() + 1);\n\t      _M_destroy(__capacity);\n\t      _M_data(_M_local_data);\n\t    }\n\t}\n    }\n\n  template<typename _CharT, typename _Traits, typename _Alloc>\n    void\n    __sso_string_base<_CharT, _Traits, _Alloc>::\n    _M_mutate(size_type __pos, size_type __len1, const _CharT* __s,\n\t      const size_type __len2)\n    {\n      const size_type __how_much = _M_length() - __pos - __len1;\n      \n      size_type __new_capacity = _M_length() + __len2 - __len1;\n      _CharT* __r = _M_create(__new_capacity, _M_capacity());\n\n      if (__pos)\n\t_S_copy(__r, _M_data(), __pos);\n      if (__s && __len2)\n\t_S_copy(__r + __pos, __s, __len2);\n      if (__how_much)\n\t_S_copy(__r + __pos + __len2,\n\t\t_M_data() + __pos + __len1, __how_much);\n      \n      _M_dispose();\n      _M_data(__r);\n      _M_capacity(__new_capacity);\n    }\n\n  template<typename _CharT, typename _Traits, typename _Alloc>\n    void\n    __sso_string_base<_CharT, _Traits, _Alloc>::\n    _M_erase(size_type __pos, size_type __n)\n    {\n      const size_type __how_much = _M_length() - __pos - __n;\n\n      if (__how_much && __n)\n\t_S_move(_M_data() + __pos, _M_data() + __pos + __n,\n\t\t__how_much);\n\n      _M_set_length(_M_length() - __n);\n    }\n\n  template<>\n    inline bool\n    __sso_string_base<char, std::char_traits<char>,\n\t\t      std::allocator<char> >::\n    _M_compare(const __sso_string_base& __rcs) const\n    {\n      if (this == &__rcs)\n\treturn true;\n      return false;\n    }\n\n#ifdef _GLIBCXX_USE_WCHAR_T\n  template<>\n    inline bool\n    __sso_string_base<wchar_t, std::char_traits<wchar_t>,\n\t\t      std::allocator<wchar_t> >::\n    _M_compare(const __sso_string_base& __rcs) const\n    {\n      if (this == &__rcs)\n\treturn true;\n      return false;\n    }\n#endif\n\n_GLIBCXX_END_NAMESPACE\n\n#endif /* _SSO_STRING_BASE_H */\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/stdio_filebuf.h",
    "content": "// File descriptor layer for filebuf -*- C++ -*-\n\n// Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n/** @file ext/stdio_filebuf.h\n *  This file is a GNU extension to the Standard C++ Library.\n */\n\n#ifndef _STDIO_FILEBUF_H\n#define _STDIO_FILEBUF_H 1\n\n#pragma GCC system_header\n\n#include <fstream>\n\n_GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)\n\n  /**\n   *  @brief Provides a layer of compatibility for C/POSIX.\n   *\n   *  This GNU extension provides extensions for working with standard C\n   *  FILE*'s and POSIX file descriptors.  It must be instantiated by the\n   *  user with the type of character used in the file stream, e.g.,\n   *  stdio_filebuf<char>.\n  */\n  template<typename _CharT, typename _Traits = std::char_traits<_CharT> >\n    class stdio_filebuf : public std::basic_filebuf<_CharT, _Traits>\n    {\n    public:\n      // Types:\n      typedef _CharT\t\t\t\t        char_type;\n      typedef _Traits\t\t\t\t        traits_type;\n      typedef typename traits_type::int_type\t\tint_type;\n      typedef typename traits_type::pos_type\t\tpos_type;\n      typedef typename traits_type::off_type\t\toff_type;\n      typedef std::size_t                               size_t;\n\n    public:\n      /**\n       * deferred initialization\n      */\n      stdio_filebuf() : std::basic_filebuf<_CharT, _Traits>() {}\n\n      /**\n       *  @param  fd  An open file descriptor.\n       *  @param  mode  Same meaning as in a standard filebuf.\n       *  @param  size  Optimal or preferred size of internal buffer, in chars.\n       *\n       *  This constructor associates a file stream buffer with an open\n       *  POSIX file descriptor. The file descriptor will be automatically\n       *  closed when the stdio_filebuf is closed/destroyed.\n      */\n      stdio_filebuf(int __fd, std::ios_base::openmode __mode,\n\t\t    size_t __size = static_cast<size_t>(BUFSIZ));\n\n      /**\n       *  @param  f  An open @c FILE*.\n       *  @param  mode  Same meaning as in a standard filebuf.\n       *  @param  size  Optimal or preferred size of internal buffer, in chars.\n       *                Defaults to system's @c BUFSIZ.\n       *\n       *  This constructor associates a file stream buffer with an open\n       *  C @c FILE*.  The @c FILE* will not be automatically closed when the\n       *  stdio_filebuf is closed/destroyed.\n      */\n      stdio_filebuf(std::__c_file* __f, std::ios_base::openmode __mode,\n\t\t    size_t __size = static_cast<size_t>(BUFSIZ));\n\n      /**\n       *  Closes the external data stream if the file descriptor constructor\n       *  was used.\n      */\n      virtual\n      ~stdio_filebuf();\n\n      /**\n       *  @return  The underlying file descriptor.\n       *\n       *  Once associated with an external data stream, this function can be\n       *  used to access the underlying POSIX file descriptor.  Note that\n       *  there is no way for the library to track what you do with the\n       *  descriptor, so be careful.\n      */\n      int\n      fd() { return this->_M_file.fd(); }\n\n      /**\n       *  @return  The underlying FILE*.\n       *\n       *  This function can be used to access the underlying \"C\" file pointer.\n       *  Note that there is no way for the library to track what you do\n       *  with the file, so be careful.\n       */\n      std::__c_file*\n      file() { return this->_M_file.file(); }\n    };\n\n  template<typename _CharT, typename _Traits>\n    stdio_filebuf<_CharT, _Traits>::~stdio_filebuf()\n    { }\n\n  template<typename _CharT, typename _Traits>\n    stdio_filebuf<_CharT, _Traits>::\n    stdio_filebuf(int __fd, std::ios_base::openmode __mode, size_t __size)\n    {\n      this->_M_file.sys_open(__fd, __mode);\n      if (this->is_open())\n\t{\n\t  this->_M_mode = __mode;\n\t  this->_M_buf_size = __size;\n\t  this->_M_allocate_internal_buffer();\n\t  this->_M_reading = false;\n\t  this->_M_writing = false;\n\t  this->_M_set_buffer(-1);\n\t}\n    }\n\n  template<typename _CharT, typename _Traits>\n    stdio_filebuf<_CharT, _Traits>::\n    stdio_filebuf(std::__c_file* __f, std::ios_base::openmode __mode,\n\t\t  size_t __size)\n    {\n      this->_M_file.sys_open(__f, __mode);\n      if (this->is_open())\n\t{\n\t  this->_M_mode = __mode;\n\t  this->_M_buf_size = __size;\n\t  this->_M_allocate_internal_buffer();\n\t  this->_M_reading = false;\n\t  this->_M_writing = false;\n\t  this->_M_set_buffer(-1);\n\t}\n    }\n\n_GLIBCXX_END_NAMESPACE\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/stdio_sync_filebuf.h",
    "content": "// Iostreams wrapper for stdio FILE* -*- C++ -*-\n\n// Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n/** @file ext/stdio_sync_filebuf.h\n *  This file is a GNU extension to the Standard C++ Library.\n */\n\n#ifndef _STDIO_SYNC_FILEBUF_H\n#define _STDIO_SYNC_FILEBUF_H 1\n\n#pragma GCC system_header\n\n#include <streambuf>\n#include <unistd.h>\n#include <cstdio>\n\n#ifdef _GLIBCXX_USE_WCHAR_T\n#include <cwchar>\n#endif\n\n_GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)\n\n  /// @brief  class stdio_sync_filebuf.\n  template<typename _CharT, typename _Traits = std::char_traits<_CharT> >\n    class stdio_sync_filebuf : public std::basic_streambuf<_CharT, _Traits>\n    {\n    public:\n      // Types:\n      typedef _CharT\t\t\t\t\tchar_type;\n      typedef _Traits\t\t\t\t\ttraits_type;\n      typedef typename traits_type::int_type\t\tint_type;\n      typedef typename traits_type::pos_type\t\tpos_type;\n      typedef typename traits_type::off_type\t\toff_type;\n\n    private:\n      // Underlying stdio FILE\n      std::__c_file* const _M_file;\n\n      // Last character gotten. This is used when pbackfail is\n      // called from basic_streambuf::sungetc()\n      int_type _M_unget_buf;\n\n    public:\n      explicit\n      stdio_sync_filebuf(std::__c_file* __f)\n      : _M_file(__f), _M_unget_buf(traits_type::eof())\n      { }\n\n      /**\n       *  @return  The underlying FILE*.\n       *\n       *  This function can be used to access the underlying \"C\" file pointer.\n       *  Note that there is no way for the library to track what you do\n       *  with the file, so be careful.\n       */\n      std::__c_file* const\n      file() { return this->_M_file; }\n\n    protected:\n      int_type\n      syncgetc();\n\n      int_type\n      syncungetc(int_type __c);\n\n      int_type\n      syncputc(int_type __c);\n\n      virtual int_type\n      underflow()\n      {\n\tint_type __c = this->syncgetc();\n\treturn this->syncungetc(__c);\n      }\n\n      virtual int_type\n      uflow()\n      {\n\t// Store the gotten character in case we need to unget it.\n\t_M_unget_buf = this->syncgetc();\n\treturn _M_unget_buf;\n      }\n\n      virtual int_type\n      pbackfail(int_type __c = traits_type::eof())\n      {\n\tint_type __ret;\n\tconst int_type __eof = traits_type::eof();\n\n\t// Check if the unget or putback was requested\n\tif (traits_type::eq_int_type(__c, __eof)) // unget\n\t  {\n\t    if (!traits_type::eq_int_type(_M_unget_buf, __eof))\n\t      __ret = this->syncungetc(_M_unget_buf);\n\t    else // buffer invalid, fail.\n\t      __ret = __eof;\n\t  }\n\telse // putback\n\t  __ret = this->syncungetc(__c);\n\n\t// The buffered character is no longer valid, discard it.\n\t_M_unget_buf = __eof;\n\treturn __ret;\n      }\n\n      virtual std::streamsize\n      xsgetn(char_type* __s, std::streamsize __n);\n\n      virtual int_type\n      overflow(int_type __c = traits_type::eof())\n      {\n\tint_type __ret;\n\tif (traits_type::eq_int_type(__c, traits_type::eof()))\n\t  {\n\t    if (std::fflush(_M_file))\n\t      __ret = traits_type::eof();\n\t    else\n\t      __ret = traits_type::not_eof(__c);\n\t  }\n\telse\n\t  __ret = this->syncputc(__c);\n\treturn __ret;\n      }\n\n      virtual std::streamsize\n      xsputn(const char_type* __s, std::streamsize __n);\n\n      virtual int\n      sync()\n      { return std::fflush(_M_file); }\n\n      virtual std::streampos\n      seekoff(std::streamoff __off, std::ios_base::seekdir __dir,\n\t      std::ios_base::openmode = std::ios_base::in | std::ios_base::out)\n      {\n\tstd::streampos __ret(std::streamoff(-1));\n\tint __whence;\n\tif (__dir == std::ios_base::beg)\n\t  __whence = SEEK_SET;\n\telse if (__dir == std::ios_base::cur)\n\t  __whence = SEEK_CUR;\n\telse\n\t  __whence = SEEK_END;\n#ifdef _GLIBCXX_USE_LFS\n\tif (!fseeko64(_M_file, __off, __whence))\n\t  __ret = std::streampos(ftello64(_M_file));\n#else\n\tif (!fseek(_M_file, __off, __whence))\n\t  __ret = std::streampos(std::ftell(_M_file));\n#endif\n\treturn __ret;\n      }\n\n      virtual std::streampos\n      seekpos(std::streampos __pos,\n\t      std::ios_base::openmode __mode =\n\t      std::ios_base::in | std::ios_base::out)\n      { return seekoff(std::streamoff(__pos), std::ios_base::beg, __mode); }\n    };\n\n  template<>\n    inline stdio_sync_filebuf<char>::int_type\n    stdio_sync_filebuf<char>::syncgetc()\n    { return std::getc(_M_file); }\n\n  template<>\n    inline stdio_sync_filebuf<char>::int_type\n    stdio_sync_filebuf<char>::syncungetc(int_type __c)\n    { return std::ungetc(__c, _M_file); }\n\n  template<>\n    inline stdio_sync_filebuf<char>::int_type\n    stdio_sync_filebuf<char>::syncputc(int_type __c)\n    { return std::putc(__c, _M_file); }\n\n  template<>\n    inline std::streamsize\n    stdio_sync_filebuf<char>::xsgetn(char* __s, std::streamsize __n)\n    {\n      std::streamsize __ret = std::fread(__s, 1, __n, _M_file);\n      if (__ret > 0)\n\t_M_unget_buf = traits_type::to_int_type(__s[__ret - 1]);\n      else\n\t_M_unget_buf = traits_type::eof();\n      return __ret;\n    }\n\n  template<>\n    inline std::streamsize\n    stdio_sync_filebuf<char>::xsputn(const char* __s, std::streamsize __n)\n    { return std::fwrite(__s, 1, __n, _M_file); }\n\n#ifdef _GLIBCXX_USE_WCHAR_T\n  template<>\n    inline stdio_sync_filebuf<wchar_t>::int_type\n    stdio_sync_filebuf<wchar_t>::syncgetc()\n    { return std::getwc(_M_file); }\n\n  template<>\n    inline stdio_sync_filebuf<wchar_t>::int_type\n    stdio_sync_filebuf<wchar_t>::syncungetc(int_type __c)\n    { return std::ungetwc(__c, _M_file); }\n\n  template<>\n    inline stdio_sync_filebuf<wchar_t>::int_type\n    stdio_sync_filebuf<wchar_t>::syncputc(int_type __c)\n    { return std::putwc(__c, _M_file); }\n\n  template<>\n    inline std::streamsize\n    stdio_sync_filebuf<wchar_t>::xsgetn(wchar_t* __s, std::streamsize __n)\n    {\n      std::streamsize __ret = 0;\n      const int_type __eof = traits_type::eof();\n      while (__n--)\n\t{\n\t  int_type __c = this->syncgetc();\n\t  if (traits_type::eq_int_type(__c, __eof))\n\t    break;\n\t  __s[__ret] = traits_type::to_char_type(__c);\n\t  ++__ret;\n\t}\n\n      if (__ret > 0)\n\t_M_unget_buf = traits_type::to_int_type(__s[__ret - 1]);\n      else\n\t_M_unget_buf = traits_type::eof();\n      return __ret;\n    }\n\n  template<>\n    inline std::streamsize\n    stdio_sync_filebuf<wchar_t>::xsputn(const wchar_t* __s,\n\t\t\t\t\tstd::streamsize __n)\n    {\n      std::streamsize __ret = 0;\n      const int_type __eof = traits_type::eof();\n      while (__n--)\n\t{\n\t  if (traits_type::eq_int_type(this->syncputc(*__s++), __eof))\n\t    break;\n\t  ++__ret;\n\t}\n      return __ret;\n    }\n#endif\n\n#if _GLIBCXX_EXTERN_TEMPLATE\n  extern template class stdio_sync_filebuf<char>;\n#ifdef _GLIBCXX_USE_WCHAR_T\n  extern template class stdio_sync_filebuf<wchar_t>;\n#endif\n#endif\n\n_GLIBCXX_END_NAMESPACE\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/throw_allocator.h",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this library; see the file COPYING.  If not, write to\n// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,\n// MA 02111-1307, USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice\n// and this permission notice appear in supporting documentation. None\n// of the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied\n// warranty.\n\n/** @file ext/vstring.h\n *  This file is a GNU extension to the Standard C++ Library.\n *\n *  Contains an exception-throwing allocator, useful for testing\n *  exception safety. In addition, allocation addresses are stored and\n *  sanity checked.\n */\n\n/**\n * @file throw_allocator.h \n */\n\n#ifndef _THROW_ALLOCATOR_H\n#define _THROW_ALLOCATOR_H 1\n\n#include <cmath>\n#include <map>\n#include <set>\n#include <string>\n#include <ostream>\n#include <stdexcept>\n#include <utility>\n#include <tr1/random>\n#include <bits/functexcept.h>\n\n_GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)\n\n  class twister_rand_gen\n  {\n  public:\n    twister_rand_gen(unsigned int seed = \n\t\t     static_cast<unsigned int>(std::time(0)));\n    \n    void\n    init(unsigned int);\n    \n    double\n    get_prob();\n    \n  private:\n    std::tr1::mt19937 _M_generator;\n  };\n\n  struct forced_exception_error : public std::exception\n  { };\n\n  // Substitute for concurrence_error object in the case of -fno-exceptions.\n  inline void\n  __throw_forced_exception_error()\n  {\n#if __EXCEPTIONS\n    throw forced_exception_error();\n#else\n    __builtin_abort();\n#endif\n  }\n\n  class throw_allocator_base\n  {\n  public:\n    void\n    init(unsigned long seed);\n\n    static void\n    set_throw_prob(double throw_prob);\n\n    static double\n    get_throw_prob();\n\n    static void\n    set_label(size_t l);\n\n    static bool\n    empty();\n\n    struct group_throw_prob_adjustor\n    {\n      group_throw_prob_adjustor(size_t size) \n      : _M_throw_prob_orig(_S_throw_prob)\n      {\n\t_S_throw_prob =\n\t  1 - ::pow(double(1 - _S_throw_prob), double(0.5 / (size + 1)));\n      }\n\n      ~group_throw_prob_adjustor()\n      { _S_throw_prob = _M_throw_prob_orig; }\n\n    private:\n      const double _M_throw_prob_orig;\n    };\n\n    struct zero_throw_prob_adjustor\n    {\n      zero_throw_prob_adjustor() : _M_throw_prob_orig(_S_throw_prob)\n      { _S_throw_prob = 0; }\n\n      ~zero_throw_prob_adjustor()\n      { _S_throw_prob = _M_throw_prob_orig; }\n\n    private:\n      const double _M_throw_prob_orig;\n    };\n\n  protected:\n    static void\n    insert(void*, size_t);\n\n    static void\n    erase(void*, size_t);\n\n    static void\n    throw_conditionally();\n\n    // See if a particular address and size has been allocated by this\n    // allocator.\n    static void\n    check_allocated(void*, size_t);\n\n    // See if a given label has been allocated by this allocator.\n    static void\n    check_allocated(size_t);\n\n  private:\n    typedef std::pair<size_t, size_t> \t\talloc_data_type;\n    typedef std::map<void*, alloc_data_type> \tmap_type;\n    typedef map_type::value_type \t\tentry_type;\n    typedef map_type::const_iterator \t\tconst_iterator;\n    typedef map_type::const_reference \t\tconst_reference;\n\n    friend std::ostream& \n    operator<<(std::ostream&, const throw_allocator_base&);\n\n    static entry_type\n    make_entry(void*, size_t);\n\n    static void\n    print_to_string(std::string&);\n\n    static void\n    print_to_string(std::string&, const_reference);\n\n    static twister_rand_gen \t_S_g;\n    static map_type \t\t_S_map;\n    static double \t\t_S_throw_prob;\n    static size_t \t\t_S_label;\n  };\n\n\n  template<typename T>\n    class throw_allocator : public throw_allocator_base\n    {\n    public:\n      typedef size_t \t\t\t\tsize_type;\n      typedef ptrdiff_t \t\t\tdifference_type;\n      typedef T \t\t\t\tvalue_type;\n      typedef value_type* \t\t\tpointer;\n      typedef const value_type* \t\tconst_pointer;\n      typedef value_type& \t\t\treference;\n      typedef const value_type& \t\tconst_reference;\n\n\n      template<typename U>\n      struct rebind\n      {\n        typedef throw_allocator<U> other;\n      };\n\n      throw_allocator() throw() { }\n\n      throw_allocator(const throw_allocator&) throw() { }\n\n      template<typename U>\n      throw_allocator(const throw_allocator<U>&) throw() { }\n\n      ~throw_allocator() throw() { }\n\n      size_type\n      max_size() const throw()\n      { return std::allocator<value_type>().max_size(); }\n\n      pointer\n      allocate(size_type num, std::allocator<void>::const_pointer hint = 0)\n      {\n\tthrow_conditionally();\n\tvalue_type* const a = std::allocator<value_type>().allocate(num, hint);\n\tinsert(a, sizeof(value_type) * num);\n\treturn a;\n      }\n\n      void\n      construct(pointer p, const T& val)\n      { return std::allocator<value_type>().construct(p, val); }\n\n      void\n      destroy(pointer p)\n      { std::allocator<value_type>().destroy(p); }\n\n      void\n      deallocate(pointer p, size_type num)\n      {\n\terase(p, sizeof(value_type) * num);\n\tstd::allocator<value_type>().deallocate(p, num);\n      }\n\n      void\n      check_allocated(pointer p, size_type num)\n      { throw_allocator_base::check_allocated(p, sizeof(value_type) * num); }\n\n      void\n      check_allocated(size_type label)\n      { throw_allocator_base::check_allocated(label); }\n    };\n\n  template<typename T>\n    inline bool\n    operator==(const throw_allocator<T>&, const throw_allocator<T>&)\n    { return true; }\n\n  template<typename T>\n    inline bool\n    operator!=(const throw_allocator<T>&, const throw_allocator<T>&)\n    { return false; }\n\n  std::ostream& \n  operator<<(std::ostream& os, const throw_allocator_base& alloc)\n  {\n    std::string error;\n    throw_allocator_base::print_to_string(error);\n    os << error;\n    return os;\n  }\n\n  // XXX Should be in .cc.\n  twister_rand_gen::\n  twister_rand_gen(unsigned int seed) : _M_generator(seed)  { }\n\n  void\n  twister_rand_gen::\n  init(unsigned int seed)\n  { _M_generator.seed(seed); }\n\n  double\n  twister_rand_gen::\n  get_prob()\n  {\n    const double eng_min = _M_generator.min();\n    const double eng_range =\n      static_cast<const double>(_M_generator.max() - eng_min);\n\n    const double eng_res =\n      static_cast<const double>(_M_generator() - eng_min);\n\n    const double ret = eng_res / eng_range;\n    _GLIBCXX_DEBUG_ASSERT(ret >= 0 && ret <= 1);\n    return ret;\n  }\n\n  twister_rand_gen throw_allocator_base::_S_g;\n\n  throw_allocator_base::map_type\n  throw_allocator_base::_S_map;\n\n  double throw_allocator_base::_S_throw_prob;\n\n  size_t throw_allocator_base::_S_label = 0;\n\n  throw_allocator_base::entry_type\n  throw_allocator_base::make_entry(void* p, size_t size)\n  { return std::make_pair(p, alloc_data_type(_S_label, size)); }\n\n  void\n  throw_allocator_base::init(unsigned long seed)\n  { _S_g.init(seed); }\n\n  void\n  throw_allocator_base::set_throw_prob(double throw_prob)\n  { _S_throw_prob = throw_prob; }\n\n  double\n  throw_allocator_base::get_throw_prob()\n  { return _S_throw_prob; }\n\n  void\n  throw_allocator_base::set_label(size_t l)\n  { _S_label = l; }\n\n  void\n  throw_allocator_base::insert(void* p, size_t size)\n  {\n    const_iterator found_it = _S_map.find(p);\n    if (found_it != _S_map.end())\n      {\n\tstd::string error(\"throw_allocator_base::insert\");\n\terror += \"double insert!\";\n\terror += '\\n';\n\tprint_to_string(error, make_entry(p, size));\n\tprint_to_string(error, *found_it);\n\tstd::__throw_logic_error(error.c_str());\n      }\n    _S_map.insert(make_entry(p, size));\n  }\n\n  bool\n  throw_allocator_base::empty()\n  { return _S_map.empty(); }\n\n  void\n  throw_allocator_base::erase(void* p, size_t size)\n  {\n    check_allocated(p, size);\n    _S_map.erase(p);\n  }\n\n  void\n  throw_allocator_base::check_allocated(void* p, size_t size)\n  {\n    const_iterator found_it = _S_map.find(p);\n    if (found_it == _S_map.end())\n      {\n\tstd::string error(\"throw_allocator_base::check_allocated by value \");\n\terror += \"null erase!\";\n\terror += '\\n';\n\tprint_to_string(error, make_entry(p, size));\n\tstd::__throw_logic_error(error.c_str());\n      }\n\n    if (found_it->second.second != size)\n      {\n\tstd::string error(\"throw_allocator_base::check_allocated by value \");\n\terror += \"wrong-size erase!\";\n\terror += '\\n';\n\tprint_to_string(error, make_entry(p, size));\n\tprint_to_string(error, *found_it);\n\tstd::__throw_logic_error(error.c_str());\n      }\n  }\n\n  void\n  throw_allocator_base::check_allocated(size_t label)\n  {\n    std::string found;\n    const_iterator it = _S_map.begin();\n    while (it != _S_map.end())\n      {\n\tif (it->second.first == label)\n\t  print_to_string(found, *it);\n\t++it;\n      }\n\n    if (!found.empty())\n      {\n\tstd::string error(\"throw_allocator_base::check_allocated by label \");\n\terror += '\\n';\n\terror += found;\n\tstd::__throw_logic_error(error.c_str());\n      }\t\n  }\n\n  void\n  throw_allocator_base::throw_conditionally()\n  {\n    if (_S_g.get_prob() < _S_throw_prob)\n      __throw_forced_exception_error();\n  }\n\n  void\n  throw_allocator_base::print_to_string(std::string& s)\n  {\n    const_iterator begin = throw_allocator_base::_S_map.begin();\n    const_iterator end = throw_allocator_base::_S_map.end();\n    for (; begin != end; ++begin)\n      print_to_string(s, *begin);\n  }\n\n  void\n  throw_allocator_base::print_to_string(std::string& s, const_reference ref)\n  {\n    char buf[40];\n    const char tab('\\t');\n    s += \"address: \";\n    sprintf(buf, \"%p\", ref.first);\n    s += buf;\n    s += tab;\n    s += \"label: \";\n    sprintf(buf, \"%u\", ref.second.first);\n    s += buf;\n    s += tab;\n    s += \"size: \";\n    sprintf(buf, \"%u\", ref.second.second);\n    s += buf;\n    s += '\\n';\n  }\n\n_GLIBCXX_END_NAMESPACE\n\n#endif \n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/type_traits.h",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006, 2007 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the terms\n// of the GNU General Public License as published by the Free Software\n// Foundation; either version 2, or (at your option) any later\n// version.\n\n// This library is distributed in the hope that it will be useful, but\n// WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n// General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free\n// software library without restriction.  Specifically, if other files\n// instantiate templates or use macros or inline functions from this\n// file, or you compile this file and link it with other files to\n// produce an executable, this file does not by itself cause the\n// resulting executable to be covered by the GNU General Public\n// License.  This exception does not however invalidate any other\n// reasons why the executable file might be covered by the GNU General\n// Public License.\n\n/** @file ext/type_traits.h\n *  This file is a GNU extension to the Standard C++ Library.\n */\n\n#ifndef _EXT_TYPE_TRAITS\n#define _EXT_TYPE_TRAITS 1\n\n#pragma GCC system_header\n\n#include <cstddef>\n#include <utility>\n#include <bits/cpp_type_traits.h>\n\n_GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)\n\n  // Define a nested type if some predicate holds.\n  template<bool, typename>\n    struct __enable_if \n    { };\n\n  template<typename _Tp>\n    struct __enable_if<true, _Tp>\n    { typedef _Tp __type; };\n\n\n  // Conditional expression for types. If true, first, if false, second.\n  template<bool _Cond, typename _Iftrue, typename _Iffalse>\n    struct __conditional_type\n    { typedef _Iftrue __type; };\n\n  template<typename _Iftrue, typename _Iffalse>\n    struct __conditional_type<false, _Iftrue, _Iffalse>\n    { typedef _Iffalse __type; };\n\n\n  // Given an integral builtin type, return the corresponding unsigned type.\n  template<typename _Tp>\n    struct __add_unsigned\n    { \n    private:\n      typedef __enable_if<std::__is_integer<_Tp>::__value, _Tp> __if_type;\n      \n    public:\n      typedef typename __if_type::__type __type; \n    };\n\n  template<>\n    struct __add_unsigned<char>\n    { typedef unsigned char __type; };\n\n  template<>\n    struct __add_unsigned<signed char>\n    { typedef unsigned char __type; };\n\n  template<>\n    struct __add_unsigned<short>\n    { typedef unsigned short __type; };\n\n  template<>\n    struct __add_unsigned<int>\n    { typedef unsigned int __type; };\n\n  template<>\n    struct __add_unsigned<long>\n    { typedef unsigned long __type; };\n\n  template<>\n    struct __add_unsigned<long long>\n    { typedef unsigned long long __type; };\n\n  // Declare but don't define.\n  template<>\n    struct __add_unsigned<bool>;\n\n  template<>\n    struct __add_unsigned<wchar_t>;\n\n\n  // Given an integral builtin type, return the corresponding signed type.\n  template<typename _Tp>\n    struct __remove_unsigned\n    { \n    private:\n      typedef __enable_if<std::__is_integer<_Tp>::__value, _Tp> __if_type;\n      \n    public:\n      typedef typename __if_type::__type __type; \n    };\n\n  template<>\n    struct __remove_unsigned<char>\n    { typedef signed char __type; };\n\n  template<>\n    struct __remove_unsigned<unsigned char>\n    { typedef signed char __type; };\n\n  template<>\n    struct __remove_unsigned<unsigned short>\n    { typedef short __type; };\n\n  template<>\n    struct __remove_unsigned<unsigned int>\n    { typedef int __type; };\n\n  template<>\n    struct __remove_unsigned<unsigned long>\n    { typedef long __type; };\n\n  template<>\n    struct __remove_unsigned<unsigned long long>\n    { typedef long long __type; };\n\n  // Declare but don't define.\n  template<>\n    struct __remove_unsigned<bool>;\n\n  template<>\n    struct __remove_unsigned<wchar_t>;\n\n_GLIBCXX_END_NAMESPACE\n\n#endif \n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/typelist.h",
    "content": "// -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.\n\n// Permission to use, copy, modify, sell, and distribute this software\n// is hereby granted without fee, provided that the above copyright\n// notice appears in all copies, and that both that copyright notice and\n// this permission notice appear in supporting documentation. None of\n// the above authors, nor IBM Haifa Research Laboratories, make any\n// representation about the suitability of this software for any\n// purpose. It is provided \"as is\" without express or implied warranty.\n\n/**\n * @file typelist.h\n * Contains typelist_chain definitions.\n * Typelists are an idea by Andrei Alexandrescu.\n */\n\n#ifndef _TYPELIST_H\n#define _TYPELIST_H 1\n\n#include <ext/type_traits.h>\n\n_GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)\n\nnamespace typelist\n{\n  struct null_type { };\n\n  template<typename Root>\n    struct node\n    {\n      typedef Root \troot;\n    };\n\n  // Forward declarations of functors.\n  template<typename Hd, typename Typelist>\n    struct chain\n    {\n      typedef Hd \thead;\n      typedef Typelist \ttail;\n    };\n\n  template<typename Fn, class Typelist>\n    void\n    apply(Fn&, Typelist);\n\n  template<typename Typelist0, typename Typelist1>\n    struct append;\n\n  template<typename Typelist_Typelist>\n    struct append_typelist;\n\n  template<typename Typelist, typename T>\n    struct contains;\n \n  template<typename Typelist, template<typename T> class Pred>\n    struct filter;\n\n  template<typename Typelist, int i>\n    struct at_index;\n\n  template<typename Typelist, template<typename T> class Transform>\n    struct transform;\n\n  template<typename Typelist_Typelist>\n    struct flatten;\n\n  template<typename Typelist>\n    struct from_first;\n\n  template<typename T1>\n    struct create1;\n\n  template<typename T1, typename T2>\n    struct create2;\n\n  template<typename T1, typename T2, typename T3>\n    struct create3;\n\n  template<typename T1, typename T2, typename T3, typename T4>\n    struct create4;\n\n  template<typename T1, typename T2, typename T3, typename T4, typename T5>\n    struct create5;\n\n  template<typename T1, typename T2, typename T3, \n\t   typename T4, typename T5, typename T6>\n    struct create6;\n} // namespace typelist\n\n_GLIBCXX_END_NAMESPACE\n\n\n_GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)\n\nnamespace typelist \n{\nnamespace detail\n{\n  template<typename Fn, typename Typelist_Chain>\n    struct apply_;\n\n  template<typename Fn, typename Hd, typename Tl>\n    struct apply_<Fn, chain<Hd, Tl> >\n    {\n      void\n      operator() (Fn& f)\n      {\n\tf.operator()(Hd());\n\tapply_<Fn, Tl> next;\n\tnext(f);\n      }\n  };\n\n  template<typename Fn>\n    struct apply_<Fn, null_type>\n    {\n      void\n      operator()(Fn&) { }\n  };\n\n  template<typename Typelist_Chain0, typename Typelist_Chain1>\n    struct append_;\n\n  template<typename Hd, typename Tl, typename Typelist_Chain>\n    struct append_<chain<Hd, Tl>, Typelist_Chain>\n    {\n    private:\n      typedef append_<Tl, Typelist_Chain> \t\t\tappend_type;\n\n    public:\n      typedef chain<Hd, typename append_type::type> \t\ttype;\n    };\n\n  template<typename Typelist_Chain>\n    struct append_<null_type, Typelist_Chain>\n    {\n      typedef Typelist_Chain \t\t\t      \t\ttype;\n    };\n\n  template<typename Typelist_Chain>\n    struct append_<Typelist_Chain, null_type>\n    {\n      typedef Typelist_Chain \t\t\t\t\ttype;\n    };\n\n  template<>\n    struct append_<null_type, null_type>\n    {\n      typedef null_type \t\t\t\t\ttype;\n    };\n\n  template<typename Typelist_Typelist_Chain>\n    struct append_typelist_;\n\n  template<typename Hd>\n    struct append_typelist_<chain<Hd, null_type> >\n    {\n      typedef chain<Hd, null_type> \t\t\t\ttype;\n    };\n\n  template<typename Hd, typename Tl>\n    struct append_typelist_<chain< Hd, Tl> >\n    {\n    private:\n      typedef typename append_typelist_<Tl>::type \t\trest_type;\n      \n    public:\n      typedef typename append<Hd, node<rest_type> >::type::root\ttype;\n    };\n\n  template<typename Typelist_Chain, typename T>\n    struct contains_;\n\n  template<typename T>\n    struct contains_<null_type, T>\n    {\n      enum\n\t{\n\t  value = false\n\t};\n    };\n\n  template<typename Hd, typename Tl, typename T>\n    struct contains_<chain<Hd, Tl>, T>\n    {\n      enum\n\t{\n\t  value = contains_<Tl, T>::value\n\t};\n    };\n  \n  template<typename Tl, typename T>\n    struct contains_<chain<T, Tl>, T>\n    {\n      enum\n\t{\n\t  value = true\n\t};\n    };\n\n  template<typename Typelist_Chain, template<typename T> class Pred>\n    struct chain_filter_;\n\n  template<template<typename T> class Pred>\n    struct chain_filter_<null_type, Pred>\n    {\n      typedef null_type \t\t\t\t\ttype;\n  };\n\n  template<typename Hd, typename Tl, template<typename T> class Pred>\n    struct chain_filter_<chain<Hd, Tl>, Pred>\n    {\n    private:\n      enum\n\t{\n\t  include_hd = Pred<Hd>::value\n\t};\n      \n      typedef typename chain_filter_<Tl, Pred>::type \t\trest_type;\n      typedef chain<Hd, rest_type> \t\t\t\tchain_type;\n\n    public:\n      typedef typename __conditional_type<include_hd, chain_type, rest_type>::__type type;\n  };\n\n  template<typename Typelist_Chain, int i>\n    struct chain_at_index_;\n\n  template<typename Hd, typename Tl>\n    struct chain_at_index_<chain<Hd, Tl>, 0>\n    {\n      typedef Hd \t\t\t\t\t\ttype;\n    };\n  \n  template<typename Hd, typename Tl, int i>\n    struct chain_at_index_<chain<Hd, Tl>, i>\n    {\n      typedef typename chain_at_index_<Tl, i - 1>::type \ttype;\n    };\n\n  template<class Typelist_Chain, template<typename T> class Transform>\n    struct chain_transform_;\n\n  template<template<typename T> class Transform>\n    struct chain_transform_<null_type, Transform>\n    {\n      typedef null_type \t\t\t\t\ttype;\n    };\n  \n  template<class Hd, class Tl, template<typename T> class Transform>\n    struct chain_transform_<chain<Hd, Tl>, Transform>\n    {\n    private:\n      typedef typename chain_transform_<Tl, Transform>::type \trest_type;\n      typedef typename Transform<Hd>::type \t\t\ttransform_type;\n\n    public:\n      typedef chain<transform_type, rest_type> \t\t\ttype;\n    };\n\n  template<typename Typelist_Typelist_Chain>\n    struct chain_flatten_;\n\n  template<typename Hd_Tl>\n  struct chain_flatten_<chain<Hd_Tl, null_type> >\n  {\n    typedef typename Hd_Tl::root \t\t\t\ttype;\n  };\n\n  template<typename Hd_Typelist, class Tl_Typelist>\n  struct chain_flatten_<chain<Hd_Typelist, Tl_Typelist> >\n  {\n  private:\n    typedef typename chain_flatten_<Tl_Typelist>::type \t\trest_type;\n    typedef append<Hd_Typelist, node<rest_type> >\t\tappend_type;\n  public:\n    typedef typename append_type::type::root \t\t\ttype;\n  };\n} // namespace detail\n} // namespace typelist\n\n_GLIBCXX_END_NAMESPACE\n\n#define _GLIBCXX_TYPELIST_CHAIN1(X0) __gnu_cxx::typelist::chain<X0, __gnu_cxx::typelist::null_type>\n#define _GLIBCXX_TYPELIST_CHAIN2(X0, X1) __gnu_cxx::typelist::chain<X0, _GLIBCXX_TYPELIST_CHAIN1(X1) >\n#define _GLIBCXX_TYPELIST_CHAIN3(X0, X1, X2) __gnu_cxx::typelist::chain<X0, _GLIBCXX_TYPELIST_CHAIN2(X1, X2) >\n#define _GLIBCXX_TYPELIST_CHAIN4(X0, X1, X2, X3) __gnu_cxx::typelist::chain<X0, _GLIBCXX_TYPELIST_CHAIN3(X1, X2, X3) >\n#define _GLIBCXX_TYPELIST_CHAIN5(X0, X1, X2, X3, X4) __gnu_cxx::typelist::chain<X0, _GLIBCXX_TYPELIST_CHAIN4(X1, X2, X3, X4) >\n#define _GLIBCXX_TYPELIST_CHAIN6(X0, X1, X2, X3, X4, X5) __gnu_cxx::typelist::chain<X0, _GLIBCXX_TYPELIST_CHAIN5(X1, X2, X3, X4, X5) >\n#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) >\n#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) >\n#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) >\n#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) >\n#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) >\n#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) >\n#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) >\n#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) >\n#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) >\n\n_GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)\n\nnamespace typelist\n{\n  template<typename Fn, class Typelist>\n    void\n    apply(Fn& fn, Typelist)\n    {\n      detail::apply_<Fn, typename Typelist::root> a;\n      a(fn);\n    }\n\n  template<typename Typelist0, typename Typelist1>\n    struct append\n    {\n    private:\n      typedef typename Typelist0::root \t\t\t\troot0_type;\n      typedef typename Typelist1::root \t\t\t\troot1_type;\n      typedef detail::append_<root0_type, root1_type> \t\tappend_type;\n\n    public:\n      typedef node<typename append_type::type> \t\t\ttype;\n    };\n\n  template<typename Typelist_Typelist>\n    struct append_typelist\n    {\n    private:\n      typedef typename Typelist_Typelist::root \t\t      \troot_type;\n      typedef detail::append_typelist_<root_type> \t\tappend_type;\n\n    public:\n      typedef node<typename append_type::type> \t\t\ttype;\n    };\n\n  template<typename Typelist, typename T>\n    struct contains\n    {\n    private:\n      typedef typename Typelist::root \t\t\t\troot_type;\n\n    public:\n      enum\n\t{\n\t  value = detail::contains_<root_type, T>::value\n\t};\n    };\n\n  template<typename Typelist, template<typename T> class Pred>\n    struct filter\n    {\n    private:\n      typedef typename Typelist::root \t\t\t\troot_type;\n      typedef detail::chain_filter_<root_type, Pred> \t\tfilter_type;\n\n    public:\n      typedef node<typename filter_type::type> \t       \t\ttype;\n    };\n\n  template<typename Typelist, int i>\n    struct at_index\n    {\n    private:\n      typedef typename Typelist::root \t\t\t\troot_type;\n      typedef detail::chain_at_index_<root_type, i> \t\tindex_type;\n      \n    public:\n      typedef typename index_type::type \t\t\ttype;\n    };\n\n  template<typename Typelist, template<typename T> class Transform>\n    struct transform\n    {\n    private:\n      typedef typename Typelist::root \t\t\t\troot_type;\n      typedef detail::chain_transform_<root_type, Transform> \ttransform_type;\n\n    public:\n      typedef node<typename transform_type::type> \t\ttype;\n    };\n\n  template<typename Typelist_Typelist>\n    struct flatten\n    {\n    private:\n      typedef typename Typelist_Typelist::root \t\t      \troot_type;\n      typedef typename detail::chain_flatten_<root_type>::type \tflatten_type;\n\n    public:\n      typedef node<flatten_type> \t\t\t\ttype;\n    };\n\n  template<typename Typelist>\n    struct from_first\n    {\n    private:\n      typedef typename at_index<Typelist, 0>::type \t\tfirst_type;\n\n    public:\n      typedef node<chain<first_type, null_type> > \t\ttype;\n    };\n\n  template<typename T1>\n    struct create1\n    {\n      typedef node<_GLIBCXX_TYPELIST_CHAIN1(T1)> \t\ttype;\n    };\n\n  template<typename T1, typename T2>\n    struct create2\n    {\n      typedef node<_GLIBCXX_TYPELIST_CHAIN2(T1,T2)> \t\ttype;\n    };\n\n  template<typename T1, typename T2, typename T3>\n    struct create3\n    {\n      typedef node<_GLIBCXX_TYPELIST_CHAIN3(T1,T2,T3)>\t\ttype;\n    };\n\n  template<typename T1, typename T2, typename T3, typename T4>\n    struct create4\n    {\n      typedef node<_GLIBCXX_TYPELIST_CHAIN4(T1,T2,T3,T4)>\ttype;\n    };\n\n  template<typename T1, typename T2, typename T3, \n\t   typename T4, typename T5>\n    struct create5\n    {\n      typedef node<_GLIBCXX_TYPELIST_CHAIN5(T1,T2,T3,T4,T5)>\ttype;\n    };\n\n  template<typename T1, typename T2, typename T3, \n\t   typename T4, typename T5, typename T6>\n    struct create6\n    {\n      typedef node<_GLIBCXX_TYPELIST_CHAIN6(T1,T2,T3,T4,T5,T6)>\ttype;\n    };\n} // namespace typelist\n_GLIBCXX_END_NAMESPACE\n\n\n#endif\n\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/vstring.h",
    "content": "// Versatile string -*- C++ -*-\n\n// Copyright (C) 2005, 2006, 2007 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n/** @file ext/vstring.h\n *  This file is a GNU extension to the Standard C++ Library.\n */\n\n#ifndef _VSTRING_H\n#define _VSTRING_H 1\n\n#pragma GCC system_header\n\n#include <ext/vstring_util.h>\n#include <ext/rc_string_base.h>\n#include <ext/sso_string_base.h>\n\n_GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)\n\n  /**\n   *  @class __versa_string vstring.h\n   *  @brief  Managing sequences of characters and character-like objects.\n   */\n\n  // Template class __versa_string\n  template<typename _CharT, typename _Traits, typename _Alloc,\n\t   template <typename, typename, typename> class _Base>\n    class __versa_string\n    : private _Base<_CharT, _Traits, _Alloc>\n    {\n      typedef _Base<_CharT, _Traits, _Alloc>                __vstring_base;      \n      typedef typename __vstring_base::_CharT_alloc_type    _CharT_alloc_type;\n\n      // Types:\n    public:\n      typedef _Traits\t\t\t\t\t    traits_type;\n      typedef typename _Traits::char_type\t\t    value_type;\n      typedef _Alloc\t\t\t\t\t    allocator_type;\n      typedef typename _CharT_alloc_type::size_type\t    size_type;\n      typedef typename _CharT_alloc_type::difference_type   difference_type;\n      typedef typename _CharT_alloc_type::reference\t    reference;\n      typedef typename _CharT_alloc_type::const_reference   const_reference;\n      typedef typename _CharT_alloc_type::pointer\t    pointer;\n      typedef typename _CharT_alloc_type::const_pointer\t    const_pointer;\n      typedef __gnu_cxx::__normal_iterator<pointer, __versa_string>  iterator;\n      typedef __gnu_cxx::__normal_iterator<const_pointer, __versa_string>\n                                                            const_iterator;\n      typedef std::reverse_iterator<const_iterator>\tconst_reverse_iterator;\n      typedef std::reverse_iterator<iterator>\t\t    reverse_iterator;\n\n      // Data Member (public):\n      ///  Value returned by various member functions when they fail.\n      static const size_type\tnpos = static_cast<size_type>(-1);\n\n    private:\n      size_type\n      _M_check(size_type __pos, const char* __s) const\n      {\n\tif (__pos > this->size())\n\t  std::__throw_out_of_range(__N(__s));\n\treturn __pos;\n      }\n\n      void\n      _M_check_length(size_type __n1, size_type __n2, const char* __s) const\n      {\n\tif (this->max_size() - (this->size() - __n1) < __n2)\n\t  std::__throw_length_error(__N(__s));\n      }\n\n      // NB: _M_limit doesn't check for a bad __pos value.\n      size_type\n      _M_limit(size_type __pos, size_type __off) const\n      {\n\tconst bool __testoff =  __off < this->size() - __pos;\n\treturn __testoff ? __off : this->size() - __pos;\n      }\n\n      // True if _Rep and source do not overlap.\n      bool\n      _M_disjunct(const _CharT* __s) const\n      {\n\treturn (std::less<const _CharT*>()(__s, this->_M_data())\n\t\t|| std::less<const _CharT*>()(this->_M_data()\n\t\t\t\t\t      + this->size(), __s));\n      }\n\n      // For the internal use we have functions similar to `begin'/`end'\n      // but they do not call _M_leak.\n      iterator\n      _M_ibegin() const\n      { return iterator(this->_M_data()); }\n\n      iterator\n      _M_iend() const\n      { return iterator(this->_M_data() + this->_M_length()); }\n\n    public:\n      // Construct/copy/destroy:\n      // NB: We overload ctors in some cases instead of using default\n      // arguments, per 17.4.4.4 para. 2 item 2.\n\n      /**\n       *  @brief  Default constructor creates an empty string.\n       */\n      __versa_string()\n      : __vstring_base() { }\n      \n      /**\n       *  @brief  Construct an empty string using allocator @a a.\n       */\n      explicit\n      __versa_string(const _Alloc& __a)\n      : __vstring_base(__a) { }\n\n      // NB: per LWG issue 42, semantics different from IS:\n      /**\n       *  @brief  Construct string with copy of value of @a str.\n       *  @param  str  Source string.\n       */\n      __versa_string(const __versa_string& __str)\n      : __vstring_base(__str) { }\n\n      /**\n       *  @brief  Construct string as copy of a substring.\n       *  @param  str  Source string.\n       *  @param  pos  Index of first character to copy from.\n       *  @param  n  Number of characters to copy (default remainder).\n       */\n      __versa_string(const __versa_string& __str, size_type __pos,\n\t\t     size_type __n = npos)\n      : __vstring_base(__str._M_data()\n\t\t       + __str._M_check(__pos,\n\t\t\t\t\t\"__versa_string::__versa_string\"),\n\t\t       __str._M_data() + __str._M_limit(__pos, __n)\n\t\t       + __pos, _Alloc()) { }\n\n      /**\n       *  @brief  Construct string as copy of a substring.\n       *  @param  str  Source string.\n       *  @param  pos  Index of first character to copy from.\n       *  @param  n  Number of characters to copy.\n       *  @param  a  Allocator to use.\n       */\n      __versa_string(const __versa_string& __str, size_type __pos,\n\t\t     size_type __n, const _Alloc& __a)\n      : __vstring_base(__str._M_data()\n\t\t       + __str._M_check(__pos,\n\t\t\t\t\t\"__versa_string::__versa_string\"),\n\t\t       __str._M_data() + __str._M_limit(__pos, __n)\n\t\t       + __pos, __a) { }\n\n      /**\n       *  @brief  Construct string initialized by a character array.\n       *  @param  s  Source character array.\n       *  @param  n  Number of characters to copy.\n       *  @param  a  Allocator to use (default is default allocator).\n       *\n       *  NB: @a s must have at least @a n characters, '\\0' has no special\n       *  meaning.\n       */\n      __versa_string(const _CharT* __s, size_type __n,\n\t\t     const _Alloc& __a = _Alloc())\n      : __vstring_base(__s, __s + __n, __a) { }\n\n      /**\n       *  @brief  Construct string as copy of a C string.\n       *  @param  s  Source C string.\n       *  @param  a  Allocator to use (default is default allocator).\n       */\n      __versa_string(const _CharT* __s, const _Alloc& __a = _Alloc())\n      : __vstring_base(__s, __s ? __s + traits_type::length(__s) :\n\t\t       __s + npos, __a) { }\n\n      /**\n       *  @brief  Construct string as multiple characters.\n       *  @param  n  Number of characters.\n       *  @param  c  Character to use.\n       *  @param  a  Allocator to use (default is default allocator).\n       */\n      __versa_string(size_type __n, _CharT __c, const _Alloc& __a = _Alloc())\n      : __vstring_base(__n, __c, __a) { }\n\n      /**\n       *  @brief  Construct string as copy of a range.\n       *  @param  beg  Start of range.\n       *  @param  end  End of range.\n       *  @param  a  Allocator to use (default is default allocator).\n       */\n      template<class _InputIterator>\n        __versa_string(_InputIterator __beg, _InputIterator __end,\n\t\t       const _Alloc& __a = _Alloc())\n\t: __vstring_base(__beg, __end, __a) { }\n\n      /**\n       *  @brief  Destroy the string instance.\n       */\n      ~__versa_string() { }\t\n\n      /**\n       *  @brief  Assign the value of @a str to this string.\n       *  @param  str  Source string.\n       */\n      __versa_string&\n      operator=(const __versa_string& __str) \n      { return this->assign(__str); }\n\n      /**\n       *  @brief  Copy contents of @a s into this string.\n       *  @param  s  Source null-terminated string.\n       */\n      __versa_string&\n      operator=(const _CharT* __s) \n      { return this->assign(__s); }\n\n      /**\n       *  @brief  Set value to string of length 1.\n       *  @param  c  Source character.\n       *\n       *  Assigning to a character makes this string length 1 and\n       *  (*this)[0] == @a c.\n       */\n      __versa_string&\n      operator=(_CharT __c) \n      { \n\tthis->assign(1, __c); \n\treturn *this;\n      }\n\n      // Iterators:\n      /**\n       *  Returns a read/write iterator that points to the first character in\n       *  the %string.  Unshares the string.\n       */\n      iterator\n      begin()\n      {\n\tthis->_M_leak();\n\treturn iterator(this->_M_data());\n      }\n\n      /**\n       *  Returns a read-only (constant) iterator that points to the first\n       *  character in the %string.\n       */\n      const_iterator\n      begin() const\n      { return const_iterator(this->_M_data()); }\n\n      /**\n       *  Returns a read/write iterator that points one past the last\n       *  character in the %string.  Unshares the string.\n       */\n      iterator\n      end()\n      {\n\tthis->_M_leak();\n\treturn iterator(this->_M_data() + this->size());\n      }\n\n      /**\n       *  Returns a read-only (constant) iterator that points one past the\n       *  last character in the %string.\n       */\n      const_iterator\n      end() const\n      { return const_iterator(this->_M_data() + this->size()); }\n\n      /**\n       *  Returns a read/write reverse iterator that points to the last\n       *  character in the %string.  Iteration is done in reverse element\n       *  order.  Unshares the string.\n       */\n      reverse_iterator\n      rbegin()\n      { return reverse_iterator(this->end()); }\n\n      /**\n       *  Returns a read-only (constant) reverse iterator that points\n       *  to the last character in the %string.  Iteration is done in\n       *  reverse element order.\n       */\n      const_reverse_iterator\n      rbegin() const\n      { return const_reverse_iterator(this->end()); }\n\n      /**\n       *  Returns a read/write reverse iterator that points to one before the\n       *  first character in the %string.  Iteration is done in reverse\n       *  element order.  Unshares the string.\n       */\n      reverse_iterator\n      rend()\n      { return reverse_iterator(this->begin()); }\n\n      /**\n       *  Returns a read-only (constant) reverse iterator that points\n       *  to one before the first character in the %string.  Iteration\n       *  is done in reverse element order.\n       */\n      const_reverse_iterator\n      rend() const\n      { return const_reverse_iterator(this->begin()); }\n\n    public:\n      // Capacity:\n      ///  Returns the number of characters in the string, not including any\n      ///  null-termination.\n      size_type\n      size() const\n      { return this->_M_length(); }\n\n      ///  Returns the number of characters in the string, not including any\n      ///  null-termination.\n      size_type\n      length() const\n      { return this->_M_length(); }\n\n      /// Returns the size() of the largest possible %string.\n      size_type\n      max_size() const\n      { return this->_M_max_size(); }\n\n      /**\n       *  @brief  Resizes the %string to the specified number of characters.\n       *  @param  n  Number of characters the %string should contain.\n       *  @param  c  Character to fill any new elements.\n       *\n       *  This function will %resize the %string to the specified\n       *  number of characters.  If the number is smaller than the\n       *  %string's current size the %string is truncated, otherwise\n       *  the %string is extended and new elements are set to @a c.\n       */\n      void\n      resize(size_type __n, _CharT __c);\n\n      /**\n       *  @brief  Resizes the %string to the specified number of characters.\n       *  @param  n  Number of characters the %string should contain.\n       *\n       *  This function will resize the %string to the specified length.  If\n       *  the new size is smaller than the %string's current size the %string\n       *  is truncated, otherwise the %string is extended and new characters\n       *  are default-constructed.  For basic types such as char, this means\n       *  setting them to 0.\n       */\n      void\n      resize(size_type __n)\n      { this->resize(__n, _CharT()); }\n\n      /**\n       *  Returns the total number of characters that the %string can hold\n       *  before needing to allocate more memory.\n       */\n      size_type\n      capacity() const\n      { return this->_M_capacity(); }\n\n      /**\n       *  @brief  Attempt to preallocate enough memory for specified number of\n       *          characters.\n       *  @param  res_arg  Number of characters required.\n       *  @throw  std::length_error  If @a res_arg exceeds @c max_size().\n       *\n       *  This function attempts to reserve enough memory for the\n       *  %string to hold the specified number of characters.  If the\n       *  number requested is more than max_size(), length_error is\n       *  thrown.\n       *\n       *  The advantage of this function is that if optimal code is a\n       *  necessity and the user can determine the string length that will be\n       *  required, the user can reserve the memory in %advance, and thus\n       *  prevent a possible reallocation of memory and copying of %string\n       *  data.\n       */\n      void\n      reserve(size_type __res_arg = 0)\n      { this->_M_reserve(__res_arg); }\n\n      /**\n       *  Erases the string, making it empty.\n       */\n      void\n      clear()\n      { this->_M_clear(); }\n\n      /**\n       *  Returns true if the %string is empty.  Equivalent to *this == \"\".\n       */\n      bool\n      empty() const\n      { return this->size() == 0; }\n\n      // Element access:\n      /**\n       *  @brief  Subscript access to the data contained in the %string.\n       *  @param  pos  The index of the character to access.\n       *  @return  Read-only (constant) reference to the character.\n       *\n       *  This operator allows for easy, array-style, data access.\n       *  Note that data access with this operator is unchecked and\n       *  out_of_range lookups are not defined. (For checked lookups\n       *  see at().)\n       */\n      const_reference\n      operator[] (size_type __pos) const\n      {\n\t_GLIBCXX_DEBUG_ASSERT(__pos <= this->size());\n\treturn this->_M_data()[__pos];\n      }\n\n      /**\n       *  @brief  Subscript access to the data contained in the %string.\n       *  @param  pos  The index of the character to access.\n       *  @return  Read/write reference to the character.\n       *\n       *  This operator allows for easy, array-style, data access.\n       *  Note that data access with this operator is unchecked and\n       *  out_of_range lookups are not defined. (For checked lookups\n       *  see at().)  Unshares the string.\n       */\n      reference\n      operator[](size_type __pos)\n      {\n        // allow pos == size() as v3 extension:\n\t_GLIBCXX_DEBUG_ASSERT(__pos <= this->size());\n        // but be strict in pedantic mode:\n\t_GLIBCXX_DEBUG_PEDASSERT(__pos < this->size());\n\tthis->_M_leak();\n\treturn this->_M_data()[__pos];\n      }\n\n      /**\n       *  @brief  Provides access to the data contained in the %string.\n       *  @param n The index of the character to access.\n       *  @return  Read-only (const) reference to the character.\n       *  @throw  std::out_of_range  If @a n is an invalid index.\n       *\n       *  This function provides for safer data access.  The parameter is\n       *  first checked that it is in the range of the string.  The function\n       *  throws out_of_range if the check fails.\n       */\n      const_reference\n      at(size_type __n) const\n      {\n\tif (__n >= this->size())\n\t  std::__throw_out_of_range(__N(\"__versa_string::at\"));\n\treturn this->_M_data()[__n];\n      }\n\n      /**\n       *  @brief  Provides access to the data contained in the %string.\n       *  @param n The index of the character to access.\n       *  @return  Read/write reference to the character.\n       *  @throw  std::out_of_range  If @a n is an invalid index.\n       *\n       *  This function provides for safer data access.  The parameter is\n       *  first checked that it is in the range of the string.  The function\n       *  throws out_of_range if the check fails.  Success results in\n       *  unsharing the string.\n       */\n      reference\n      at(size_type __n)\n      {\n\tif (__n >= this->size())\n\t  std::__throw_out_of_range(__N(\"__versa_string::at\"));\n\tthis->_M_leak();\n\treturn this->_M_data()[__n];\n      }\n\n      // Modifiers:\n      /**\n       *  @brief  Append a string to this string.\n       *  @param str  The string to append.\n       *  @return  Reference to this string.\n       */\n      __versa_string&\n      operator+=(const __versa_string& __str)\n      { return this->append(__str); }\n\n      /**\n       *  @brief  Append a C string.\n       *  @param s  The C string to append.\n       *  @return  Reference to this string.\n       */\n      __versa_string&\n      operator+=(const _CharT* __s)\n      { return this->append(__s); }\n\n      /**\n       *  @brief  Append a character.\n       *  @param c  The character to append.\n       *  @return  Reference to this string.\n       */\n      __versa_string&\n      operator+=(_CharT __c)\n      { \n\tthis->push_back(__c);\n\treturn *this;\n      }\n\n      /**\n       *  @brief  Append a string to this string.\n       *  @param str  The string to append.\n       *  @return  Reference to this string.\n       */\n      __versa_string&\n      append(const __versa_string& __str)\n      { return _M_append(__str._M_data(), __str.size()); }\n\n      /**\n       *  @brief  Append a substring.\n       *  @param str  The string to append.\n       *  @param pos  Index of the first character of str to append.\n       *  @param n  The number of characters to append.\n       *  @return  Reference to this string.\n       *  @throw  std::out_of_range if @a pos is not a valid index.\n       *\n       *  This function appends @a n characters from @a str starting at @a pos\n       *  to this string.  If @a n is is larger than the number of available\n       *  characters in @a str, the remainder of @a str is appended.\n       */\n      __versa_string&\n      append(const __versa_string& __str, size_type __pos, size_type __n)\n      { return _M_append(__str._M_data()\n\t\t\t + __str._M_check(__pos, \"__versa_string::append\"),\n\t\t\t __str._M_limit(__pos, __n)); }\n\n      /**\n       *  @brief  Append a C substring.\n       *  @param s  The C string to append.\n       *  @param n  The number of characters to append.\n       *  @return  Reference to this string.\n       */\n      __versa_string&\n      append(const _CharT* __s, size_type __n)\n      {\n\t__glibcxx_requires_string_len(__s, __n);\n\t_M_check_length(size_type(0), __n, \"__versa_string::append\");\n\treturn _M_append(__s, __n);\n      }\n\n      /**\n       *  @brief  Append a C string.\n       *  @param s  The C string to append.\n       *  @return  Reference to this string.\n       */\n      __versa_string&\n      append(const _CharT* __s)\n      {\n\t__glibcxx_requires_string(__s);\n\tconst size_type __n = traits_type::length(__s);\n\t_M_check_length(size_type(0), __n, \"__versa_string::append\");\n\treturn _M_append(__s, __n);\n      }\n\n      /**\n       *  @brief  Append multiple characters.\n       *  @param n  The number of characters to append.\n       *  @param c  The character to use.\n       *  @return  Reference to this string.\n       *\n       *  Appends n copies of c to this string.\n       */\n      __versa_string&\n      append(size_type __n, _CharT __c)\n      { return _M_replace_aux(this->size(), size_type(0), __n, __c); }\n\n      /**\n       *  @brief  Append a range of characters.\n       *  @param first  Iterator referencing the first character to append.\n       *  @param last  Iterator marking the end of the range.\n       *  @return  Reference to this string.\n       *\n       *  Appends characters in the range [first,last) to this string.\n       */\n      template<class _InputIterator>\n        __versa_string&\n        append(_InputIterator __first, _InputIterator __last)\n        { return this->replace(_M_iend(), _M_iend(), __first, __last); }\n\n      /**\n       *  @brief  Append a single character.\n       *  @param c  Character to append.\n       */\n      void\n      push_back(_CharT __c)\n      { \n\tconst size_type __size = this->size();\n\tif (__size + 1 > this->capacity() || this->_M_is_shared())\n\t  this->_M_mutate(__size, size_type(0), 0, size_type(1));\n\ttraits_type::assign(this->_M_data()[__size], __c);\n\tthis->_M_set_length(__size + 1);\n      }\n\n      /**\n       *  @brief  Set value to contents of another string.\n       *  @param  str  Source string to use.\n       *  @return  Reference to this string.\n       */\n      __versa_string&\n      assign(const __versa_string& __str)\n      {\n\tthis->_M_assign(__str);\n\treturn *this;\n      }\n\n      /**\n       *  @brief  Set value to a substring of a string.\n       *  @param str  The string to use.\n       *  @param pos  Index of the first character of str.\n       *  @param n  Number of characters to use.\n       *  @return  Reference to this string.\n       *  @throw  std::out_of_range if @a pos is not a valid index.\n       *\n       *  This function sets this string to the substring of @a str consisting\n       *  of @a n characters at @a pos.  If @a n is is larger than the number\n       *  of available characters in @a str, the remainder of @a str is used.\n       */\n      __versa_string&\n      assign(const __versa_string& __str, size_type __pos, size_type __n)\n      { return _M_replace(size_type(0), this->size(), __str._M_data()\n\t\t\t  + __str._M_check(__pos, \"__versa_string::assign\"),\n\t\t\t  __str._M_limit(__pos, __n)); }\n\n      /**\n       *  @brief  Set value to a C substring.\n       *  @param s  The C string to use.\n       *  @param n  Number of characters to use.\n       *  @return  Reference to this string.\n       *\n       *  This function sets the value of this string to the first @a n\n       *  characters of @a s.  If @a n is is larger than the number of\n       *  available characters in @a s, the remainder of @a s is used.\n       */\n      __versa_string&\n      assign(const _CharT* __s, size_type __n)\n      {\n\t__glibcxx_requires_string_len(__s, __n);\n\treturn _M_replace(size_type(0), this->size(), __s, __n);\n      }\n\n      /**\n       *  @brief  Set value to contents of a C string.\n       *  @param s  The C string to use.\n       *  @return  Reference to this string.\n       *\n       *  This function sets the value of this string to the value of @a s.\n       *  The data is copied, so there is no dependence on @a s once the\n       *  function returns.\n       */\n      __versa_string&\n      assign(const _CharT* __s)\n      {\n\t__glibcxx_requires_string(__s);\n\treturn _M_replace(size_type(0), this->size(), __s,\n\t\t\t  traits_type::length(__s));\n      }\n\n      /**\n       *  @brief  Set value to multiple characters.\n       *  @param n  Length of the resulting string.\n       *  @param c  The character to use.\n       *  @return  Reference to this string.\n       *\n       *  This function sets the value of this string to @a n copies of\n       *  character @a c.\n       */\n      __versa_string&\n      assign(size_type __n, _CharT __c)\n      { return _M_replace_aux(size_type(0), this->size(), __n, __c); }\n\n      /**\n       *  @brief  Set value to a range of characters.\n       *  @param first  Iterator referencing the first character to append.\n       *  @param last  Iterator marking the end of the range.\n       *  @return  Reference to this string.\n       *\n       *  Sets value of string to characters in the range [first,last).\n      */\n      template<class _InputIterator>\n        __versa_string&\n        assign(_InputIterator __first, _InputIterator __last)\n        { return this->replace(_M_ibegin(), _M_iend(), __first, __last); }\n\n      /**\n       *  @brief  Insert multiple characters.\n       *  @param p  Iterator referencing location in string to insert at.\n       *  @param n  Number of characters to insert\n       *  @param c  The character to insert.\n       *  @throw  std::length_error  If new length exceeds @c max_size().\n       *\n       *  Inserts @a n copies of character @a c starting at the position\n       *  referenced by iterator @a p.  If adding characters causes the length\n       *  to exceed max_size(), length_error is thrown.  The value of the\n       *  string doesn't change if an error is thrown.\n      */\n      void\n      insert(iterator __p, size_type __n, _CharT __c)\n      {\tthis->replace(__p, __p, __n, __c);  }\n\n      /**\n       *  @brief  Insert a range of characters.\n       *  @param p  Iterator referencing location in string to insert at.\n       *  @param beg  Start of range.\n       *  @param end  End of range.\n       *  @throw  std::length_error  If new length exceeds @c max_size().\n       *\n       *  Inserts characters in range [beg,end).  If adding characters causes\n       *  the length to exceed max_size(), length_error is thrown.  The value\n       *  of the string doesn't change if an error is thrown.\n      */\n      template<class _InputIterator>\n        void\n        insert(iterator __p, _InputIterator __beg, _InputIterator __end)\n        { this->replace(__p, __p, __beg, __end); }\n\n      /**\n       *  @brief  Insert value of a string.\n       *  @param pos1  Iterator referencing location in string to insert at.\n       *  @param str  The string to insert.\n       *  @return  Reference to this string.\n       *  @throw  std::length_error  If new length exceeds @c max_size().\n       *\n       *  Inserts value of @a str starting at @a pos1.  If adding characters\n       *  causes the length to exceed max_size(), length_error is thrown.  The\n       *  value of the string doesn't change if an error is thrown.\n      */\n      __versa_string&\n      insert(size_type __pos1, const __versa_string& __str)\n      { return this->replace(__pos1, size_type(0),\n\t\t\t     __str._M_data(), __str.size()); }\n\n      /**\n       *  @brief  Insert a substring.\n       *  @param pos1  Iterator referencing location in string to insert at.\n       *  @param str  The string to insert.\n       *  @param pos2  Start of characters in str to insert.\n       *  @param n  Number of characters to insert.\n       *  @return  Reference to this string.\n       *  @throw  std::length_error  If new length exceeds @c max_size().\n       *  @throw  std::out_of_range  If @a pos1 > size() or\n       *  @a pos2 > @a str.size().\n       *\n       *  Starting at @a pos1, insert @a n character of @a str beginning with\n       *  @a pos2.  If adding characters causes the length to exceed\n       *  max_size(), length_error is thrown.  If @a pos1 is beyond the end of\n       *  this string or @a pos2 is beyond the end of @a str, out_of_range is\n       *  thrown.  The value of the string doesn't change if an error is\n       *  thrown.\n      */\n      __versa_string&\n      insert(size_type __pos1, const __versa_string& __str,\n\t     size_type __pos2, size_type __n)\n      { return this->replace(__pos1, size_type(0), __str._M_data()\n\t\t\t     + __str._M_check(__pos2, \"__versa_string::insert\"),\n\t\t\t     __str._M_limit(__pos2, __n)); }\n\n      /**\n       *  @brief  Insert a C substring.\n       *  @param pos  Iterator referencing location in string to insert at.\n       *  @param s  The C string to insert.\n       *  @param n  The number of characters to insert.\n       *  @return  Reference to this string.\n       *  @throw  std::length_error  If new length exceeds @c max_size().\n       *  @throw  std::out_of_range  If @a pos is beyond the end of this\n       *  string.\n       *\n       *  Inserts the first @a n characters of @a s starting at @a pos.  If\n       *  adding characters causes the length to exceed max_size(),\n       *  length_error is thrown.  If @a pos is beyond end(), out_of_range is\n       *  thrown.  The value of the string doesn't change if an error is\n       *  thrown.\n      */\n      __versa_string&\n      insert(size_type __pos, const _CharT* __s, size_type __n)\n      { return this->replace(__pos, size_type(0), __s, __n); }\n\n      /**\n       *  @brief  Insert a C string.\n       *  @param pos  Iterator referencing location in string to insert at.\n       *  @param s  The C string to insert.\n       *  @return  Reference to this string.\n       *  @throw  std::length_error  If new length exceeds @c max_size().\n       *  @throw  std::out_of_range  If @a pos is beyond the end of this\n       *  string.\n       *\n       *  Inserts the first @a n characters of @a s starting at @a pos.  If\n       *  adding characters causes the length to exceed max_size(),\n       *  length_error is thrown.  If @a pos is beyond end(), out_of_range is\n       *  thrown.  The value of the string doesn't change if an error is\n       *  thrown.\n      */\n      __versa_string&\n      insert(size_type __pos, const _CharT* __s)\n      {\n\t__glibcxx_requires_string(__s);\n\treturn this->replace(__pos, size_type(0), __s,\n\t\t\t     traits_type::length(__s));\n      }\n\n      /**\n       *  @brief  Insert multiple characters.\n       *  @param pos  Index in string to insert at.\n       *  @param n  Number of characters to insert\n       *  @param c  The character to insert.\n       *  @return  Reference to this string.\n       *  @throw  std::length_error  If new length exceeds @c max_size().\n       *  @throw  std::out_of_range  If @a pos is beyond the end of this\n       *  string.\n       *\n       *  Inserts @a n copies of character @a c starting at index @a pos.  If\n       *  adding characters causes the length to exceed max_size(),\n       *  length_error is thrown.  If @a pos > length(), out_of_range is\n       *  thrown.  The value of the string doesn't change if an error is\n       *  thrown.\n      */\n      __versa_string&\n      insert(size_type __pos, size_type __n, _CharT __c)\n      { return _M_replace_aux(_M_check(__pos, \"__versa_string::insert\"),\n\t\t\t      size_type(0), __n, __c); }\n\n      /**\n       *  @brief  Insert one character.\n       *  @param p  Iterator referencing position in string to insert at.\n       *  @param c  The character to insert.\n       *  @return  Iterator referencing newly inserted char.\n       *  @throw  std::length_error  If new length exceeds @c max_size().\n       *\n       *  Inserts character @a c at position referenced by @a p.  If adding\n       *  character causes the length to exceed max_size(), length_error is\n       *  thrown.  If @a p is beyond end of string, out_of_range is thrown.\n       *  The value of the string doesn't change if an error is thrown.\n      */\n      iterator\n      insert(iterator __p, _CharT __c)\n      {\n\t_GLIBCXX_DEBUG_PEDASSERT(__p >= _M_ibegin() && __p <= _M_iend());\n\tconst size_type __pos = __p - _M_ibegin();\n\t_M_replace_aux(__pos, size_type(0), size_type(1), __c);\n\tthis->_M_set_leaked();\n\treturn iterator(this->_M_data() + __pos);\n      }\n\n      /**\n       *  @brief  Remove characters.\n       *  @param pos  Index of first character to remove (default 0).\n       *  @param n  Number of characters to remove (default remainder).\n       *  @return  Reference to this string.\n       *  @throw  std::out_of_range  If @a pos is beyond the end of this\n       *  string.\n       *\n       *  Removes @a n characters from this string starting at @a pos.  The\n       *  length of the string is reduced by @a n.  If there are < @a n\n       *  characters to remove, the remainder of the string is truncated.  If\n       *  @a p is beyond end of string, out_of_range is thrown.  The value of\n       *  the string doesn't change if an error is thrown.\n      */\n      __versa_string&\n      erase(size_type __pos = 0, size_type __n = npos)\n      { \n\tthis->_M_erase(_M_check(__pos, \"__versa_string::erase\"),\n\t\t       _M_limit(__pos, __n));\n\treturn *this;\n      }\n\n      /**\n       *  @brief  Remove one character.\n       *  @param position  Iterator referencing the character to remove.\n       *  @return  iterator referencing same location after removal.\n       *\n       *  Removes the character at @a position from this string. The value\n       *  of the string doesn't change if an error is thrown.\n      */\n      iterator\n      erase(iterator __position)\n      {\n\t_GLIBCXX_DEBUG_PEDASSERT(__position >= _M_ibegin()\n\t\t\t\t && __position < _M_iend());\n\tconst size_type __pos = __position - _M_ibegin();\n\tthis->_M_erase(__pos, size_type(1));\n\tthis->_M_set_leaked();\n\treturn iterator(this->_M_data() + __pos);\n      }\n\n      /**\n       *  @brief  Remove a range of characters.\n       *  @param first  Iterator referencing the first character to remove.\n       *  @param last  Iterator referencing the end of the range.\n       *  @return  Iterator referencing location of first after removal.\n       *\n       *  Removes the characters in the range [first,last) from this string.\n       *  The value of the string doesn't change if an error is thrown.\n      */\n      iterator\n      erase(iterator __first, iterator __last)\n      {\n\t_GLIBCXX_DEBUG_PEDASSERT(__first >= _M_ibegin() && __first <= __last\n\t\t\t\t && __last <= _M_iend());\n        const size_type __pos = __first - _M_ibegin();\n\tthis->_M_erase(__pos, __last - __first);\n\tthis->_M_set_leaked();\n\treturn iterator(this->_M_data() + __pos);\n      }\n\n      /**\n       *  @brief  Replace characters with value from another string.\n       *  @param pos  Index of first character to replace.\n       *  @param n  Number of characters to be replaced.\n       *  @param str  String to insert.\n       *  @return  Reference to this string.\n       *  @throw  std::out_of_range  If @a pos is beyond the end of this\n       *  string.\n       *  @throw  std::length_error  If new length exceeds @c max_size().\n       *\n       *  Removes the characters in the range [pos,pos+n) from this string.\n       *  In place, the value of @a str is inserted.  If @a pos is beyond end\n       *  of string, out_of_range is thrown.  If the length of the result\n       *  exceeds max_size(), length_error is thrown.  The value of the string\n       *  doesn't change if an error is thrown.\n      */\n      __versa_string&\n      replace(size_type __pos, size_type __n, const __versa_string& __str)\n      { return this->replace(__pos, __n, __str._M_data(), __str.size()); }\n\n      /**\n       *  @brief  Replace characters with value from another string.\n       *  @param pos1  Index of first character to replace.\n       *  @param n1  Number of characters to be replaced.\n       *  @param str  String to insert.\n       *  @param pos2  Index of first character of str to use.\n       *  @param n2  Number of characters from str to use.\n       *  @return  Reference to this string.\n       *  @throw  std::out_of_range  If @a pos1 > size() or @a pos2 >\n       *  str.size().\n       *  @throw  std::length_error  If new length exceeds @c max_size().\n       *\n       *  Removes the characters in the range [pos1,pos1 + n) from this\n       *  string.  In place, the value of @a str is inserted.  If @a pos is\n       *  beyond end of string, out_of_range is thrown.  If the length of the\n       *  result exceeds max_size(), length_error is thrown.  The value of the\n       *  string doesn't change if an error is thrown.\n      */\n      __versa_string&\n      replace(size_type __pos1, size_type __n1, const __versa_string& __str,\n\t      size_type __pos2, size_type __n2)\n      {\n\treturn this->replace(__pos1, __n1, __str._M_data()\n\t\t\t     + __str._M_check(__pos2,\n\t\t\t\t\t      \"__versa_string::replace\"),\n\t\t\t     __str._M_limit(__pos2, __n2));\n      }\n\n      /**\n       *  @brief  Replace characters with value of a C substring.\n       *  @param pos  Index of first character to replace.\n       *  @param n1  Number of characters to be replaced.\n       *  @param s  C string to insert.\n       *  @param n2  Number of characters from @a s to use.\n       *  @return  Reference to this string.\n       *  @throw  std::out_of_range  If @a pos1 > size().\n       *  @throw  std::length_error  If new length exceeds @c max_size().\n       *\n       *  Removes the characters in the range [pos,pos + n1) from this string.\n       *  In place, the first @a n2 characters of @a s are inserted, or all\n       *  of @a s if @a n2 is too large.  If @a pos is beyond end of string,\n       *  out_of_range is thrown.  If the length of result exceeds max_size(),\n       *  length_error is thrown.  The value of the string doesn't change if\n       *  an error is thrown.\n      */\n      __versa_string&\n      replace(size_type __pos, size_type __n1, const _CharT* __s,\n\t      size_type __n2)\n      {\n\t__glibcxx_requires_string_len(__s, __n2);\n\treturn _M_replace(_M_check(__pos, \"__versa_string::replace\"),\n\t\t\t  _M_limit(__pos, __n1), __s, __n2);\n      }\n\n      /**\n       *  @brief  Replace characters with value of a C string.\n       *  @param pos  Index of first character to replace.\n       *  @param n1  Number of characters to be replaced.\n       *  @param s  C string to insert.\n       *  @return  Reference to this string.\n       *  @throw  std::out_of_range  If @a pos > size().\n       *  @throw  std::length_error  If new length exceeds @c max_size().\n       *\n       *  Removes the characters in the range [pos,pos + n1) from this string.\n       *  In place, the first @a n characters of @a s are inserted.  If @a\n       *  pos is beyond end of string, out_of_range is thrown.  If the length\n       *  of result exceeds max_size(), length_error is thrown.  The value of\n       *  the string doesn't change if an error is thrown.\n      */\n      __versa_string&\n      replace(size_type __pos, size_type __n1, const _CharT* __s)\n      {\n\t__glibcxx_requires_string(__s);\n\treturn this->replace(__pos, __n1, __s, traits_type::length(__s));\n      }\n\n      /**\n       *  @brief  Replace characters with multiple characters.\n       *  @param pos  Index of first character to replace.\n       *  @param n1  Number of characters to be replaced.\n       *  @param n2  Number of characters to insert.\n       *  @param c  Character to insert.\n       *  @return  Reference to this string.\n       *  @throw  std::out_of_range  If @a pos > size().\n       *  @throw  std::length_error  If new length exceeds @c max_size().\n       *\n       *  Removes the characters in the range [pos,pos + n1) from this string.\n       *  In place, @a n2 copies of @a c are inserted.  If @a pos is beyond\n       *  end of string, out_of_range is thrown.  If the length of result\n       *  exceeds max_size(), length_error is thrown.  The value of the string\n       *  doesn't change if an error is thrown.\n      */\n      __versa_string&\n      replace(size_type __pos, size_type __n1, size_type __n2, _CharT __c)\n      { return _M_replace_aux(_M_check(__pos, \"__versa_string::replace\"),\n\t\t\t      _M_limit(__pos, __n1), __n2, __c); }\n\n      /**\n       *  @brief  Replace range of characters with string.\n       *  @param i1  Iterator referencing start of range to replace.\n       *  @param i2  Iterator referencing end of range to replace.\n       *  @param str  String value to insert.\n       *  @return  Reference to this string.\n       *  @throw  std::length_error  If new length exceeds @c max_size().\n       *\n       *  Removes the characters in the range [i1,i2).  In place, the value of\n       *  @a str is inserted.  If the length of result exceeds max_size(),\n       *  length_error is thrown.  The value of the string doesn't change if\n       *  an error is thrown.\n      */\n      __versa_string&\n      replace(iterator __i1, iterator __i2, const __versa_string& __str)\n      { return this->replace(__i1, __i2, __str._M_data(), __str.size()); }\n\n      /**\n       *  @brief  Replace range of characters with C substring.\n       *  @param i1  Iterator referencing start of range to replace.\n       *  @param i2  Iterator referencing end of range to replace.\n       *  @param s  C string value to insert.\n       *  @param n  Number of characters from s to insert.\n       *  @return  Reference to this string.\n       *  @throw  std::length_error  If new length exceeds @c max_size().\n       *\n       *  Removes the characters in the range [i1,i2).  In place, the first @a\n       *  n characters of @a s are inserted.  If the length of result exceeds\n       *  max_size(), length_error is thrown.  The value of the string doesn't\n       *  change if an error is thrown.\n      */\n      __versa_string&\n      replace(iterator __i1, iterator __i2, const _CharT* __s, size_type __n)\n      {\n\t_GLIBCXX_DEBUG_PEDASSERT(_M_ibegin() <= __i1 && __i1 <= __i2\n\t\t\t\t && __i2 <= _M_iend());\n\treturn this->replace(__i1 - _M_ibegin(), __i2 - __i1, __s, __n);\n      }\n\n      /**\n       *  @brief  Replace range of characters with C string.\n       *  @param i1  Iterator referencing start of range to replace.\n       *  @param i2  Iterator referencing end of range to replace.\n       *  @param s  C string value to insert.\n       *  @return  Reference to this string.\n       *  @throw  std::length_error  If new length exceeds @c max_size().\n       *\n       *  Removes the characters in the range [i1,i2).  In place, the\n       *  characters of @a s are inserted.  If the length of result exceeds\n       *  max_size(), length_error is thrown.  The value of the string doesn't\n       *  change if an error is thrown.\n      */\n      __versa_string&\n      replace(iterator __i1, iterator __i2, const _CharT* __s)\n      {\n\t__glibcxx_requires_string(__s);\n\treturn this->replace(__i1, __i2, __s, traits_type::length(__s));\n      }\n\n      /**\n       *  @brief  Replace range of characters with multiple characters\n       *  @param i1  Iterator referencing start of range to replace.\n       *  @param i2  Iterator referencing end of range to replace.\n       *  @param n  Number of characters to insert.\n       *  @param c  Character to insert.\n       *  @return  Reference to this string.\n       *  @throw  std::length_error  If new length exceeds @c max_size().\n       *\n       *  Removes the characters in the range [i1,i2).  In place, @a n copies\n       *  of @a c are inserted.  If the length of result exceeds max_size(),\n       *  length_error is thrown.  The value of the string doesn't change if\n       *  an error is thrown.\n      */\n      __versa_string&\n      replace(iterator __i1, iterator __i2, size_type __n, _CharT __c)\n      {\n\t_GLIBCXX_DEBUG_PEDASSERT(_M_ibegin() <= __i1 && __i1 <= __i2\n\t\t\t\t && __i2 <= _M_iend());\n\treturn _M_replace_aux(__i1 - _M_ibegin(), __i2 - __i1, __n, __c);\n      }\n\n      /**\n       *  @brief  Replace range of characters with range.\n       *  @param i1  Iterator referencing start of range to replace.\n       *  @param i2  Iterator referencing end of range to replace.\n       *  @param k1  Iterator referencing start of range to insert.\n       *  @param k2  Iterator referencing end of range to insert.\n       *  @return  Reference to this string.\n       *  @throw  std::length_error  If new length exceeds @c max_size().\n       *\n       *  Removes the characters in the range [i1,i2).  In place, characters\n       *  in the range [k1,k2) are inserted.  If the length of result exceeds\n       *  max_size(), length_error is thrown.  The value of the string doesn't\n       *  change if an error is thrown.\n      */\n      template<class _InputIterator>\n        __versa_string&\n        replace(iterator __i1, iterator __i2,\n\t\t_InputIterator __k1, _InputIterator __k2)\n        {\n\t  _GLIBCXX_DEBUG_PEDASSERT(_M_ibegin() <= __i1 && __i1 <= __i2\n\t\t\t\t   && __i2 <= _M_iend());\n\t  __glibcxx_requires_valid_range(__k1, __k2);\n\t  typedef typename std::__is_integer<_InputIterator>::__type _Integral;\n\t  return _M_replace_dispatch(__i1, __i2, __k1, __k2, _Integral());\n\t}\n\n      // Specializations for the common case of pointer and iterator:\n      // useful to avoid the overhead of temporary buffering in _M_replace.\n      __versa_string&\n      replace(iterator __i1, iterator __i2, _CharT* __k1, _CharT* __k2)\n      {\n\t_GLIBCXX_DEBUG_PEDASSERT(_M_ibegin() <= __i1 && __i1 <= __i2\n\t\t\t\t && __i2 <= _M_iend());\n\t__glibcxx_requires_valid_range(__k1, __k2);\n\treturn this->replace(__i1 - _M_ibegin(), __i2 - __i1,\n\t\t\t     __k1, __k2 - __k1);\n      }\n\n      __versa_string&\n      replace(iterator __i1, iterator __i2,\n\t      const _CharT* __k1, const _CharT* __k2)\n      {\n\t_GLIBCXX_DEBUG_PEDASSERT(_M_ibegin() <= __i1 && __i1 <= __i2\n\t\t\t\t && __i2 <= _M_iend());\n\t__glibcxx_requires_valid_range(__k1, __k2);\n\treturn this->replace(__i1 - _M_ibegin(), __i2 - __i1,\n\t\t\t     __k1, __k2 - __k1);\n      }\n\n      __versa_string&\n      replace(iterator __i1, iterator __i2, iterator __k1, iterator __k2)\n      {\n\t_GLIBCXX_DEBUG_PEDASSERT(_M_ibegin() <= __i1 && __i1 <= __i2\n\t\t\t\t && __i2 <= _M_iend());\n\t__glibcxx_requires_valid_range(__k1, __k2);\n\treturn this->replace(__i1 - _M_ibegin(), __i2 - __i1,\n\t\t\t     __k1.base(), __k2 - __k1);\n      }\n\n      __versa_string&\n      replace(iterator __i1, iterator __i2,\n\t      const_iterator __k1, const_iterator __k2)\n      {\n\t_GLIBCXX_DEBUG_PEDASSERT(_M_ibegin() <= __i1 && __i1 <= __i2\n\t\t\t\t && __i2 <= _M_iend());\n\t__glibcxx_requires_valid_range(__k1, __k2);\n\treturn this->replace(__i1 - _M_ibegin(), __i2 - __i1,\n\t\t\t     __k1.base(), __k2 - __k1);\n      }\n      \n    private:\n      template<class _Integer>\n\t__versa_string&\n\t_M_replace_dispatch(iterator __i1, iterator __i2, _Integer __n,\n\t\t\t    _Integer __val, std::__true_type)\n        { return _M_replace_aux(__i1 - _M_ibegin(), __i2 - __i1, __n, __val); }\n\n      template<class _InputIterator>\n\t__versa_string&\n\t_M_replace_dispatch(iterator __i1, iterator __i2, _InputIterator __k1,\n\t\t\t    _InputIterator __k2, std::__false_type);\n\n      __versa_string&\n      _M_replace_aux(size_type __pos1, size_type __n1, size_type __n2,\n\t\t     _CharT __c);\n\n      __versa_string&\n      _M_replace(size_type __pos, size_type __len1, const _CharT* __s,\n\t\t const size_type __len2);\n\n      __versa_string&\n      _M_append(const _CharT* __s, size_type __n);\n\n    public:\n\n      /**\n       *  @brief  Copy substring into C string.\n       *  @param s  C string to copy value into.\n       *  @param n  Number of characters to copy.\n       *  @param pos  Index of first character to copy.\n       *  @return  Number of characters actually copied\n       *  @throw  std::out_of_range  If pos > size().\n       *\n       *  Copies up to @a n characters starting at @a pos into the C string @a\n       *  s.  If @a pos is greater than size(), out_of_range is thrown.\n      */\n      size_type\n      copy(_CharT* __s, size_type __n, size_type __pos = 0) const;\n\n      /**\n       *  @brief  Swap contents with another string.\n       *  @param s  String to swap with.\n       *\n       *  Exchanges the contents of this string with that of @a s in constant\n       *  time.\n      */\n      void\n      swap(__versa_string& __s)\n      { this->_M_swap(__s); }\n\n      // String operations:\n      /**\n       *  @brief  Return const pointer to null-terminated contents.\n       *\n       *  This is a handle to internal data.  Do not modify or dire things may\n       *  happen.\n      */\n      const _CharT*\n      c_str() const\n      { return this->_M_data(); }\n\n      /**\n       *  @brief  Return const pointer to contents.\n       *\n       *  This is a handle to internal data.  Do not modify or dire things may\n       *  happen.\n      */\n      const _CharT*\n      data() const\n      { return this->_M_data(); }\n\n      /**\n       *  @brief  Return copy of allocator used to construct this string.\n      */\n      allocator_type\n      get_allocator() const\n      { return allocator_type(this->_M_get_allocator()); }\n\n      /**\n       *  @brief  Find position of a C substring.\n       *  @param s  C string to locate.\n       *  @param pos  Index of character to search from.\n       *  @param n  Number of characters from @a s to search for.\n       *  @return  Index of start of first occurrence.\n       *\n       *  Starting from @a pos, searches forward for the first @a n characters\n       *  in @a s within this string.  If found, returns the index where it\n       *  begins.  If not found, returns npos.\n      */\n      size_type\n      find(const _CharT* __s, size_type __pos, size_type __n) const;\n\n      /**\n       *  @brief  Find position of a string.\n       *  @param str  String to locate.\n       *  @param pos  Index of character to search from (default 0).\n       *  @return  Index of start of first occurrence.\n       *\n       *  Starting from @a pos, searches forward for value of @a str within\n       *  this string.  If found, returns the index where it begins.  If not\n       *  found, returns npos.\n      */\n      size_type\n      find(const __versa_string& __str, size_type __pos = 0) const\n      { return this->find(__str.data(), __pos, __str.size()); }\n\n      /**\n       *  @brief  Find position of a C string.\n       *  @param s  C string to locate.\n       *  @param pos  Index of character to search from (default 0).\n       *  @return  Index of start of first occurrence.\n       *\n       *  Starting from @a pos, searches forward for the value of @a s within\n       *  this string.  If found, returns the index where it begins.  If not\n       *  found, returns npos.\n      */\n      size_type\n      find(const _CharT* __s, size_type __pos = 0) const\n      {\n\t__glibcxx_requires_string(__s);\n\treturn this->find(__s, __pos, traits_type::length(__s));\n      }\n\n      /**\n       *  @brief  Find position of a character.\n       *  @param c  Character to locate.\n       *  @param pos  Index of character to search from (default 0).\n       *  @return  Index of first occurrence.\n       *\n       *  Starting from @a pos, searches forward for @a c within this string.\n       *  If found, returns the index where it was found.  If not found,\n       *  returns npos.\n      */\n      size_type\n      find(_CharT __c, size_type __pos = 0) const;\n\n      /**\n       *  @brief  Find last position of a string.\n       *  @param str  String to locate.\n       *  @param pos  Index of character to search back from (default end).\n       *  @return  Index of start of last occurrence.\n       *\n       *  Starting from @a pos, searches backward for value of @a str within\n       *  this string.  If found, returns the index where it begins.  If not\n       *  found, returns npos.\n      */\n      size_type\n      rfind(const __versa_string& __str, size_type __pos = npos) const\n      { return this->rfind(__str.data(), __pos, __str.size()); }\n\n      /**\n       *  @brief  Find last position of a C substring.\n       *  @param s  C string to locate.\n       *  @param pos  Index of character to search back from.\n       *  @param n  Number of characters from s to search for.\n       *  @return  Index of start of last occurrence.\n       *\n       *  Starting from @a pos, searches backward for the first @a n\n       *  characters in @a s within this string.  If found, returns the index\n       *  where it begins.  If not found, returns npos.\n      */\n      size_type\n      rfind(const _CharT* __s, size_type __pos, size_type __n) const;\n\n      /**\n       *  @brief  Find last position of a C string.\n       *  @param s  C string to locate.\n       *  @param pos  Index of character to start search at (default end).\n       *  @return  Index of start of  last occurrence.\n       *\n       *  Starting from @a pos, searches backward for the value of @a s within\n       *  this string.  If found, returns the index where it begins.  If not\n       *  found, returns npos.\n      */\n      size_type\n      rfind(const _CharT* __s, size_type __pos = npos) const\n      {\n\t__glibcxx_requires_string(__s);\n\treturn this->rfind(__s, __pos, traits_type::length(__s));\n      }\n\n      /**\n       *  @brief  Find last position of a character.\n       *  @param c  Character to locate.\n       *  @param pos  Index of character to search back from (default end).\n       *  @return  Index of last occurrence.\n       *\n       *  Starting from @a pos, searches backward for @a c within this string.\n       *  If found, returns the index where it was found.  If not found,\n       *  returns npos.\n      */\n      size_type\n      rfind(_CharT __c, size_type __pos = npos) const;\n\n      /**\n       *  @brief  Find position of a character of string.\n       *  @param str  String containing characters to locate.\n       *  @param pos  Index of character to search from (default 0).\n       *  @return  Index of first occurrence.\n       *\n       *  Starting from @a pos, searches forward for one of the characters of\n       *  @a str within this string.  If found, returns the index where it was\n       *  found.  If not found, returns npos.\n      */\n      size_type\n      find_first_of(const __versa_string& __str, size_type __pos = 0) const\n      { return this->find_first_of(__str.data(), __pos, __str.size()); }\n\n      /**\n       *  @brief  Find position of a character of C substring.\n       *  @param s  String containing characters to locate.\n       *  @param pos  Index of character to search from (default 0).\n       *  @param n  Number of characters from s to search for.\n       *  @return  Index of first occurrence.\n       *\n       *  Starting from @a pos, searches forward for one of the first @a n\n       *  characters of @a s within this string.  If found, returns the index\n       *  where it was found.  If not found, returns npos.\n      */\n      size_type\n      find_first_of(const _CharT* __s, size_type __pos, size_type __n) const;\n\n      /**\n       *  @brief  Find position of a character of C string.\n       *  @param s  String containing characters to locate.\n       *  @param pos  Index of character to search from (default 0).\n       *  @return  Index of first occurrence.\n       *\n       *  Starting from @a pos, searches forward for one of the characters of\n       *  @a s within this string.  If found, returns the index where it was\n       *  found.  If not found, returns npos.\n      */\n      size_type\n      find_first_of(const _CharT* __s, size_type __pos = 0) const\n      {\n\t__glibcxx_requires_string(__s);\n\treturn this->find_first_of(__s, __pos, traits_type::length(__s));\n      }\n\n      /**\n       *  @brief  Find position of a character.\n       *  @param c  Character to locate.\n       *  @param pos  Index of character to search from (default 0).\n       *  @return  Index of first occurrence.\n       *\n       *  Starting from @a pos, searches forward for the character @a c within\n       *  this string.  If found, returns the index where it was found.  If\n       *  not found, returns npos.\n       *\n       *  Note: equivalent to find(c, pos).\n      */\n      size_type\n      find_first_of(_CharT __c, size_type __pos = 0) const\n      { return this->find(__c, __pos); }\n\n      /**\n       *  @brief  Find last position of a character of string.\n       *  @param str  String containing characters to locate.\n       *  @param pos  Index of character to search back from (default end).\n       *  @return  Index of last occurrence.\n       *\n       *  Starting from @a pos, searches backward for one of the characters of\n       *  @a str within this string.  If found, returns the index where it was\n       *  found.  If not found, returns npos.\n      */\n      size_type\n      find_last_of(const __versa_string& __str, size_type __pos = npos) const\n      { return this->find_last_of(__str.data(), __pos, __str.size()); }\n\n      /**\n       *  @brief  Find last position of a character of C substring.\n       *  @param s  C string containing characters to locate.\n       *  @param pos  Index of character to search back from (default end).\n       *  @param n  Number of characters from s to search for.\n       *  @return  Index of last occurrence.\n       *\n       *  Starting from @a pos, searches backward for one of the first @a n\n       *  characters of @a s within this string.  If found, returns the index\n       *  where it was found.  If not found, returns npos.\n      */\n      size_type\n      find_last_of(const _CharT* __s, size_type __pos, size_type __n) const;\n\n      /**\n       *  @brief  Find last position of a character of C string.\n       *  @param s  C string containing characters to locate.\n       *  @param pos  Index of character to search back from (default end).\n       *  @return  Index of last occurrence.\n       *\n       *  Starting from @a pos, searches backward for one of the characters of\n       *  @a s within this string.  If found, returns the index where it was\n       *  found.  If not found, returns npos.\n      */\n      size_type\n      find_last_of(const _CharT* __s, size_type __pos = npos) const\n      {\n\t__glibcxx_requires_string(__s);\n\treturn this->find_last_of(__s, __pos, traits_type::length(__s));\n      }\n\n      /**\n       *  @brief  Find last position of a character.\n       *  @param c  Character to locate.\n       *  @param pos  Index of character to search back from (default 0).\n       *  @return  Index of last occurrence.\n       *\n       *  Starting from @a pos, searches backward for @a c within this string.\n       *  If found, returns the index where it was found.  If not found,\n       *  returns npos.\n       *\n       *  Note: equivalent to rfind(c, pos).\n      */\n      size_type\n      find_last_of(_CharT __c, size_type __pos = npos) const\n      { return this->rfind(__c, __pos); }\n\n      /**\n       *  @brief  Find position of a character not in string.\n       *  @param str  String containing characters to avoid.\n       *  @param pos  Index of character to search from (default 0).\n       *  @return  Index of first occurrence.\n       *\n       *  Starting from @a pos, searches forward for a character not contained\n       *  in @a str within this string.  If found, returns the index where it\n       *  was found.  If not found, returns npos.\n      */\n      size_type\n      find_first_not_of(const __versa_string& __str, size_type __pos = 0) const\n      { return this->find_first_not_of(__str.data(), __pos, __str.size()); }\n\n      /**\n       *  @brief  Find position of a character not in C substring.\n       *  @param s  C string containing characters to avoid.\n       *  @param pos  Index of character to search from (default 0).\n       *  @param n  Number of characters from s to consider.\n       *  @return  Index of first occurrence.\n       *\n       *  Starting from @a pos, searches forward for a character not contained\n       *  in the first @a n characters of @a s within this string.  If found,\n       *  returns the index where it was found.  If not found, returns npos.\n      */\n      size_type\n      find_first_not_of(const _CharT* __s, size_type __pos,\n\t\t\tsize_type __n) const;\n\n      /**\n       *  @brief  Find position of a character not in C string.\n       *  @param s  C string containing characters to avoid.\n       *  @param pos  Index of character to search from (default 0).\n       *  @return  Index of first occurrence.\n       *\n       *  Starting from @a pos, searches forward for a character not contained\n       *  in @a s within this string.  If found, returns the index where it\n       *  was found.  If not found, returns npos.\n      */\n      size_type\n      find_first_not_of(const _CharT* __s, size_type __pos = 0) const\n      {\n\t__glibcxx_requires_string(__s);\n\treturn this->find_first_not_of(__s, __pos, traits_type::length(__s));\n      }\n\n      /**\n       *  @brief  Find position of a different character.\n       *  @param c  Character to avoid.\n       *  @param pos  Index of character to search from (default 0).\n       *  @return  Index of first occurrence.\n       *\n       *  Starting from @a pos, searches forward for a character other than @a c\n       *  within this string.  If found, returns the index where it was found.\n       *  If not found, returns npos.\n      */\n      size_type\n      find_first_not_of(_CharT __c, size_type __pos = 0) const;\n\n      /**\n       *  @brief  Find last position of a character not in string.\n       *  @param str  String containing characters to avoid.\n       *  @param pos  Index of character to search from (default 0).\n       *  @return  Index of first occurrence.\n       *\n       *  Starting from @a pos, searches backward for a character not\n       *  contained in @a str within this string.  If found, returns the index\n       *  where it was found.  If not found, returns npos.\n      */\n      size_type\n      find_last_not_of(const __versa_string& __str,\n\t\t       size_type __pos = npos) const\n      { return this->find_last_not_of(__str.data(), __pos, __str.size()); }\n\n      /**\n       *  @brief  Find last position of a character not in C substring.\n       *  @param s  C string containing characters to avoid.\n       *  @param pos  Index of character to search from (default 0).\n       *  @param n  Number of characters from s to consider.\n       *  @return  Index of first occurrence.\n       *\n       *  Starting from @a pos, searches backward for a character not\n       *  contained in the first @a n characters of @a s within this string.\n       *  If found, returns the index where it was found.  If not found,\n       *  returns npos.\n      */\n      size_type\n      find_last_not_of(const _CharT* __s, size_type __pos,\n\t\t       size_type __n) const;\n      /**\n       *  @brief  Find position of a character not in C string.\n       *  @param s  C string containing characters to avoid.\n       *  @param pos  Index of character to search from (default 0).\n       *  @return  Index of first occurrence.\n       *\n       *  Starting from @a pos, searches backward for a character not\n       *  contained in @a s within this string.  If found, returns the index\n       *  where it was found.  If not found, returns npos.\n      */\n      size_type\n      find_last_not_of(const _CharT* __s, size_type __pos = npos) const\n      {\n\t__glibcxx_requires_string(__s);\n\treturn this->find_last_not_of(__s, __pos, traits_type::length(__s));\n      }\n\n      /**\n       *  @brief  Find last position of a different character.\n       *  @param c  Character to avoid.\n       *  @param pos  Index of character to search from (default 0).\n       *  @return  Index of first occurrence.\n       *\n       *  Starting from @a pos, searches backward for a character other than\n       *  @a c within this string.  If found, returns the index where it was\n       *  found.  If not found, returns npos.\n      */\n      size_type\n      find_last_not_of(_CharT __c, size_type __pos = npos) const;\n\n      /**\n       *  @brief  Get a substring.\n       *  @param pos  Index of first character (default 0).\n       *  @param n  Number of characters in substring (default remainder).\n       *  @return  The new string.\n       *  @throw  std::out_of_range  If pos > size().\n       *\n       *  Construct and return a new string using the @a n characters starting\n       *  at @a pos.  If the string is too short, use the remainder of the\n       *  characters.  If @a pos is beyond the end of the string, out_of_range\n       *  is thrown.\n      */\n      __versa_string\n      substr(size_type __pos = 0, size_type __n = npos) const\n      {\n\treturn __versa_string(*this, _M_check(__pos, \"__versa_string::substr\"),\n\t\t\t      __n);\n      }\n\n      /**\n       *  @brief  Compare to a string.\n       *  @param str  String to compare against.\n       *  @return  Integer < 0, 0, or > 0.\n       *\n       *  Returns an integer < 0 if this string is ordered before @a str, 0 if\n       *  their values are equivalent, or > 0 if this string is ordered after\n       *  @a str.  Determines the effective length rlen of the strings to\n       *  compare as the smallest of size() and str.size().  The function\n       *  then compares the two strings by calling traits::compare(data(),\n       *  str.data(),rlen).  If the result of the comparison is nonzero returns\n       *  it, otherwise the shorter one is ordered first.\n      */\n      int\n      compare(const __versa_string& __str) const\n      {\n\tif (this->_M_compare(__str))\n\t  return 0;\n\n\tconst size_type __size = this->size();\n\tconst size_type __osize = __str.size();\n\tconst size_type __len = std::min(__size, __osize);\n\n\tint __r = traits_type::compare(this->_M_data(), __str.data(), __len);\n\tif (!__r)\n\t  __r =  __size - __osize;\n\treturn __r;\n      }\n\n      /**\n       *  @brief  Compare substring to a string.\n       *  @param pos  Index of first character of substring.\n       *  @param n  Number of characters in substring.\n       *  @param str  String to compare against.\n       *  @return  Integer < 0, 0, or > 0.\n       *\n       *  Form the substring of this string from the @a n characters starting\n       *  at @a pos.  Returns an integer < 0 if the substring is ordered\n       *  before @a str, 0 if their values are equivalent, or > 0 if the\n       *  substring is ordered after @a str.  Determines the effective length\n       *  rlen of the strings to compare as the smallest of the length of the\n       *  substring and @a str.size().  The function then compares the two\n       *  strings by calling traits::compare(substring.data(),str.data(),rlen).\n       *  If the result of the comparison is nonzero returns it, otherwise the\n       *  shorter one is ordered first.\n      */\n      int\n      compare(size_type __pos, size_type __n,\n\t      const __versa_string& __str) const;\n\n      /**\n       *  @brief  Compare substring to a substring.\n       *  @param pos1  Index of first character of substring.\n       *  @param n1  Number of characters in substring.\n       *  @param str  String to compare against.\n       *  @param pos2  Index of first character of substring of str.\n       *  @param n2  Number of characters in substring of str.\n       *  @return  Integer < 0, 0, or > 0.\n       *\n       *  Form the substring of this string from the @a n1 characters starting\n       *  at @a pos1.  Form the substring of @a str from the @a n2 characters\n       *  starting at @a pos2.  Returns an integer < 0 if this substring is\n       *  ordered before the substring of @a str, 0 if their values are\n       *  equivalent, or > 0 if this substring is ordered after the substring\n       *  of @a str.  Determines the effective length rlen of the strings\n       *  to compare as the smallest of the lengths of the substrings.  The\n       *  function then compares the two strings by calling\n       *  traits::compare(substring.data(),str.substr(pos2,n2).data(),rlen).\n       *  If the result of the comparison is nonzero returns it, otherwise the\n       *  shorter one is ordered first.\n      */\n      int\n      compare(size_type __pos1, size_type __n1, const __versa_string& __str,\n\t      size_type __pos2, size_type __n2) const;\n\n      /**\n       *  @brief  Compare to a C string.\n       *  @param s  C string to compare against.\n       *  @return  Integer < 0, 0, or > 0.\n       *\n       *  Returns an integer < 0 if this string is ordered before @a s, 0 if\n       *  their values are equivalent, or > 0 if this string is ordered after\n       *  @a s.  Determines the effective length rlen of the strings to\n       *  compare as the smallest of size() and the length of a string\n       *  constructed from @a s.  The function then compares the two strings\n       *  by calling traits::compare(data(),s,rlen).  If the result of the\n       *  comparison is nonzero returns it, otherwise the shorter one is\n       *  ordered first.\n      */\n      int\n      compare(const _CharT* __s) const;\n\n      // _GLIBCXX_RESOLVE_LIB_DEFECTS\n      // 5 String::compare specification questionable\n      /**\n       *  @brief  Compare substring to a C string.\n       *  @param pos  Index of first character of substring.\n       *  @param n1  Number of characters in substring.\n       *  @param s  C string to compare against.\n       *  @return  Integer < 0, 0, or > 0.\n       *\n       *  Form the substring of this string from the @a n1 characters starting\n       *  at @a pos.  Returns an integer < 0 if the substring is ordered\n       *  before @a s, 0 if their values are equivalent, or > 0 if the\n       *  substring is ordered after @a s.  Determines the effective length\n       *  rlen of the strings to compare as the smallest of the length of the \n       *  substring and the length of a string constructed from @a s.  The\n       *  function then compares the two string by calling\n       *  traits::compare(substring.data(),s,rlen).  If the result of the\n       *  comparison is nonzero returns it, otherwise the shorter one is\n       *  ordered first.\n      */\n      int\n      compare(size_type __pos, size_type __n1, const _CharT* __s) const;\n\n      /**\n       *  @brief  Compare substring against a character array.\n       *  @param pos1  Index of first character of substring.\n       *  @param n1  Number of characters in substring.\n       *  @param s  character array to compare against.\n       *  @param n2  Number of characters of s.\n       *  @return  Integer < 0, 0, or > 0.\n       *\n       *  Form the substring of this string from the @a n1 characters starting\n       *  at @a pos1.  Form a string from the first @a n2 characters of @a s.\n       *  Returns an integer < 0 if this substring is ordered before the string\n       *  from @a s, 0 if their values are equivalent, or > 0 if this substring\n       *  is ordered after the string from @a s.   Determines the effective\n       *  length rlen of the strings to compare as the smallest of the length\n       *  of the substring and @a n2.  The function then compares the two\n       *  strings by calling traits::compare(substring.data(),s,rlen).  If the\n       *  result of the comparison is nonzero returns it, otherwise the shorter\n       *  one is ordered first.\n       *\n       *  NB: s must have at least n2 characters, '\\0' has no special\n       *  meaning.\n      */\n      int\n      compare(size_type __pos, size_type __n1, const _CharT* __s,\n\t      size_type __n2) const;\n    };\n\n  // operator+\n  /**\n   *  @brief  Concatenate two strings.\n   *  @param lhs  First string.\n   *  @param rhs  Last string.\n   *  @return  New string with value of @a lhs followed by @a rhs.\n   */\n  template<typename _CharT, typename _Traits, typename _Alloc,\n\t   template <typename, typename, typename> class _Base>\n    __versa_string<_CharT, _Traits, _Alloc, _Base>\n    operator+(const __versa_string<_CharT, _Traits, _Alloc, _Base>& __lhs,\n\t      const __versa_string<_CharT, _Traits, _Alloc, _Base>& __rhs);\n\n  /**\n   *  @brief  Concatenate C string and string.\n   *  @param lhs  First string.\n   *  @param rhs  Last string.\n   *  @return  New string with value of @a lhs followed by @a rhs.\n   */\n  template<typename _CharT, typename _Traits, typename _Alloc,\n\t   template <typename, typename, typename> class _Base>\n    __versa_string<_CharT, _Traits, _Alloc, _Base>\n    operator+(const _CharT* __lhs,\n\t      const __versa_string<_CharT, _Traits, _Alloc, _Base>& __rhs);\n\n  /**\n   *  @brief  Concatenate character and string.\n   *  @param lhs  First string.\n   *  @param rhs  Last string.\n   *  @return  New string with @a lhs followed by @a rhs.\n   */\n  template<typename _CharT, typename _Traits, typename _Alloc,\n\t   template <typename, typename, typename> class _Base>\n    __versa_string<_CharT, _Traits, _Alloc, _Base>\n    operator+(_CharT __lhs,\n\t      const __versa_string<_CharT, _Traits, _Alloc, _Base>& __rhs);\n\n  /**\n   *  @brief  Concatenate string and C string.\n   *  @param lhs  First string.\n   *  @param rhs  Last string.\n   *  @return  New string with @a lhs followed by @a rhs.\n   */\n  template<typename _CharT, typename _Traits, typename _Alloc,\n\t   template <typename, typename, typename> class _Base>\n    __versa_string<_CharT, _Traits, _Alloc, _Base>\n    operator+(const __versa_string<_CharT, _Traits, _Alloc, _Base>& __lhs,\n\t      const _CharT* __rhs);\n\n  /**\n   *  @brief  Concatenate string and character.\n   *  @param lhs  First string.\n   *  @param rhs  Last string.\n   *  @return  New string with @a lhs followed by @a rhs.\n   */\n  template<typename _CharT, typename _Traits, typename _Alloc,\n\t   template <typename, typename, typename> class _Base>\n    __versa_string<_CharT, _Traits, _Alloc, _Base>\n    operator+(const __versa_string<_CharT, _Traits, _Alloc, _Base>& __lhs,\n\t      _CharT __rhs);\n\n  // operator ==\n  /**\n   *  @brief  Test equivalence of two strings.\n   *  @param lhs  First string.\n   *  @param rhs  Second string.\n   *  @return  True if @a lhs.compare(@a rhs) == 0.  False otherwise.\n   */\n  template<typename _CharT, typename _Traits, typename _Alloc,\n\t   template <typename, typename, typename> class _Base>\n    inline bool\n    operator==(const __versa_string<_CharT, _Traits, _Alloc, _Base>& __lhs,\n\t       const __versa_string<_CharT, _Traits, _Alloc, _Base>& __rhs)\n    { return __lhs.compare(__rhs) == 0; }\n\n  /**\n   *  @brief  Test equivalence of C string and string.\n   *  @param lhs  C string.\n   *  @param rhs  String.\n   *  @return  True if @a rhs.compare(@a lhs) == 0.  False otherwise.\n   */\n  template<typename _CharT, typename _Traits, typename _Alloc,\n\t   template <typename, typename, typename> class _Base>\n    inline bool\n    operator==(const _CharT* __lhs,\n\t       const __versa_string<_CharT, _Traits, _Alloc, _Base>& __rhs)\n    { return __rhs.compare(__lhs) == 0; }\n\n  /**\n   *  @brief  Test equivalence of string and C string.\n   *  @param lhs  String.\n   *  @param rhs  C string.\n   *  @return  True if @a lhs.compare(@a rhs) == 0.  False otherwise.\n   */\n  template<typename _CharT, typename _Traits, typename _Alloc,\n\t   template <typename, typename, typename> class _Base>\n    inline bool\n    operator==(const __versa_string<_CharT, _Traits, _Alloc, _Base>& __lhs,\n\t       const _CharT* __rhs)\n    { return __lhs.compare(__rhs) == 0; }\n\n  // operator !=\n  /**\n   *  @brief  Test difference of two strings.\n   *  @param lhs  First string.\n   *  @param rhs  Second string.\n   *  @return  True if @a lhs.compare(@a rhs) != 0.  False otherwise.\n   */\n  template<typename _CharT, typename _Traits, typename _Alloc,\n\t   template <typename, typename, typename> class _Base>\n    inline bool\n    operator!=(const __versa_string<_CharT, _Traits, _Alloc, _Base>& __lhs,\n\t       const __versa_string<_CharT, _Traits, _Alloc, _Base>& __rhs)\n    { return __rhs.compare(__lhs) != 0; }\n\n  /**\n   *  @brief  Test difference of C string and string.\n   *  @param lhs  C string.\n   *  @param rhs  String.\n   *  @return  True if @a rhs.compare(@a lhs) != 0.  False otherwise.\n   */\n  template<typename _CharT, typename _Traits, typename _Alloc,\n\t   template <typename, typename, typename> class _Base>\n    inline bool\n    operator!=(const _CharT* __lhs,\n\t       const __versa_string<_CharT, _Traits, _Alloc, _Base>& __rhs)\n    { return __rhs.compare(__lhs) != 0; }\n\n  /**\n   *  @brief  Test difference of string and C string.\n   *  @param lhs  String.\n   *  @param rhs  C string.\n   *  @return  True if @a lhs.compare(@a rhs) != 0.  False otherwise.\n   */\n  template<typename _CharT, typename _Traits, typename _Alloc,\n\t   template <typename, typename, typename> class _Base>\n    inline bool\n    operator!=(const __versa_string<_CharT, _Traits, _Alloc, _Base>& __lhs,\n\t       const _CharT* __rhs)\n    { return __lhs.compare(__rhs) != 0; }\n\n  // operator <\n  /**\n   *  @brief  Test if string precedes string.\n   *  @param lhs  First string.\n   *  @param rhs  Second string.\n   *  @return  True if @a lhs precedes @a rhs.  False otherwise.\n   */\n  template<typename _CharT, typename _Traits, typename _Alloc,\n\t   template <typename, typename, typename> class _Base>\n    inline bool\n    operator<(const __versa_string<_CharT, _Traits, _Alloc, _Base>& __lhs,\n\t      const __versa_string<_CharT, _Traits, _Alloc, _Base>& __rhs)\n    { return __lhs.compare(__rhs) < 0; }\n\n  /**\n   *  @brief  Test if string precedes C string.\n   *  @param lhs  String.\n   *  @param rhs  C string.\n   *  @return  True if @a lhs precedes @a rhs.  False otherwise.\n   */\n  template<typename _CharT, typename _Traits, typename _Alloc,\n\t   template <typename, typename, typename> class _Base>\n    inline bool\n    operator<(const __versa_string<_CharT, _Traits, _Alloc, _Base>& __lhs,\n\t      const _CharT* __rhs)\n    { return __lhs.compare(__rhs) < 0; }\n\n  /**\n   *  @brief  Test if C string precedes string.\n   *  @param lhs  C string.\n   *  @param rhs  String.\n   *  @return  True if @a lhs precedes @a rhs.  False otherwise.\n   */\n  template<typename _CharT, typename _Traits, typename _Alloc,\n\t   template <typename, typename, typename> class _Base>\n    inline bool\n    operator<(const _CharT* __lhs,\n\t      const __versa_string<_CharT, _Traits, _Alloc, _Base>& __rhs)\n    { return __rhs.compare(__lhs) > 0; }\n\n  // operator >\n  /**\n   *  @brief  Test if string follows string.\n   *  @param lhs  First string.\n   *  @param rhs  Second string.\n   *  @return  True if @a lhs follows @a rhs.  False otherwise.\n   */\n  template<typename _CharT, typename _Traits, typename _Alloc,\n\t   template <typename, typename, typename> class _Base>\n    inline bool\n    operator>(const __versa_string<_CharT, _Traits, _Alloc, _Base>& __lhs,\n\t      const __versa_string<_CharT, _Traits, _Alloc, _Base>& __rhs)\n    { return __lhs.compare(__rhs) > 0; }\n\n  /**\n   *  @brief  Test if string follows C string.\n   *  @param lhs  String.\n   *  @param rhs  C string.\n   *  @return  True if @a lhs follows @a rhs.  False otherwise.\n   */\n  template<typename _CharT, typename _Traits, typename _Alloc,\n\t   template <typename, typename, typename> class _Base>\n    inline bool\n    operator>(const __versa_string<_CharT, _Traits, _Alloc, _Base>& __lhs,\n\t      const _CharT* __rhs)\n    { return __lhs.compare(__rhs) > 0; }\n\n  /**\n   *  @brief  Test if C string follows string.\n   *  @param lhs  C string.\n   *  @param rhs  String.\n   *  @return  True if @a lhs follows @a rhs.  False otherwise.\n   */\n  template<typename _CharT, typename _Traits, typename _Alloc,\n\t   template <typename, typename, typename> class _Base>\n    inline bool\n    operator>(const _CharT* __lhs,\n\t      const __versa_string<_CharT, _Traits, _Alloc, _Base>& __rhs)\n    { return __rhs.compare(__lhs) < 0; }\n\n  // operator <=\n  /**\n   *  @brief  Test if string doesn't follow string.\n   *  @param lhs  First string.\n   *  @param rhs  Second string.\n   *  @return  True if @a lhs doesn't follow @a rhs.  False otherwise.\n   */\n  template<typename _CharT, typename _Traits, typename _Alloc,\n\t   template <typename, typename, typename> class _Base>\n    inline bool\n    operator<=(const __versa_string<_CharT, _Traits, _Alloc, _Base>& __lhs,\n\t       const __versa_string<_CharT, _Traits, _Alloc, _Base>& __rhs)\n    { return __lhs.compare(__rhs) <= 0; }\n\n  /**\n   *  @brief  Test if string doesn't follow C string.\n   *  @param lhs  String.\n   *  @param rhs  C string.\n   *  @return  True if @a lhs doesn't follow @a rhs.  False otherwise.\n   */\n  template<typename _CharT, typename _Traits, typename _Alloc,\n\t   template <typename, typename, typename> class _Base>\n    inline bool\n    operator<=(const __versa_string<_CharT, _Traits, _Alloc, _Base>& __lhs,\n\t       const _CharT* __rhs)\n    { return __lhs.compare(__rhs) <= 0; }\n\n  /**\n   *  @brief  Test if C string doesn't follow string.\n   *  @param lhs  C string.\n   *  @param rhs  String.\n   *  @return  True if @a lhs doesn't follow @a rhs.  False otherwise.\n   */\n  template<typename _CharT, typename _Traits, typename _Alloc,\n\t   template <typename, typename, typename> class _Base>\n    inline bool\n    operator<=(const _CharT* __lhs,\n\t       const __versa_string<_CharT, _Traits, _Alloc, _Base>& __rhs)\n    { return __rhs.compare(__lhs) >= 0; }\n\n  // operator >=\n  /**\n   *  @brief  Test if string doesn't precede string.\n   *  @param lhs  First string.\n   *  @param rhs  Second string.\n   *  @return  True if @a lhs doesn't precede @a rhs.  False otherwise.\n   */\n  template<typename _CharT, typename _Traits, typename _Alloc,\n\t   template <typename, typename, typename> class _Base>\n    inline bool\n    operator>=(const __versa_string<_CharT, _Traits, _Alloc, _Base>& __lhs,\n\t       const __versa_string<_CharT, _Traits, _Alloc, _Base>& __rhs)\n    { return __lhs.compare(__rhs) >= 0; }\n\n  /**\n   *  @brief  Test if string doesn't precede C string.\n   *  @param lhs  String.\n   *  @param rhs  C string.\n   *  @return  True if @a lhs doesn't precede @a rhs.  False otherwise.\n   */\n  template<typename _CharT, typename _Traits, typename _Alloc,\n\t   template <typename, typename, typename> class _Base>\n    inline bool\n    operator>=(const __versa_string<_CharT, _Traits, _Alloc, _Base>& __lhs,\n\t       const _CharT* __rhs)\n    { return __lhs.compare(__rhs) >= 0; }\n\n  /**\n   *  @brief  Test if C string doesn't precede string.\n   *  @param lhs  C string.\n   *  @param rhs  String.\n   *  @return  True if @a lhs doesn't precede @a rhs.  False otherwise.\n   */\n  template<typename _CharT, typename _Traits, typename _Alloc,\n\t   template <typename, typename, typename> class _Base>\n    inline bool\n    operator>=(const _CharT* __lhs,\n\t       const __versa_string<_CharT, _Traits, _Alloc, _Base>& __rhs)\n    { return __rhs.compare(__lhs) <= 0; }\n\n  /**\n   *  @brief  Swap contents of two strings.\n   *  @param lhs  First string.\n   *  @param rhs  Second string.\n   *\n   *  Exchanges the contents of @a lhs and @a rhs in constant time.\n   */\n  template<typename _CharT, typename _Traits, typename _Alloc,\n\t   template <typename, typename, typename> class _Base>\n    inline void\n    swap(__versa_string<_CharT, _Traits, _Alloc, _Base>& __lhs,\n\t __versa_string<_CharT, _Traits, _Alloc, _Base>& __rhs)\n    { __lhs.swap(__rhs); }\n\n_GLIBCXX_END_NAMESPACE\n\n_GLIBCXX_BEGIN_NAMESPACE(std)\n\n  /**\n   *  @brief  Read stream into a string.\n   *  @param is  Input stream.\n   *  @param str  Buffer to store into.\n   *  @return  Reference to the input stream.\n   *\n   *  Stores characters from @a is into @a str until whitespace is found, the\n   *  end of the stream is encountered, or str.max_size() is reached.  If\n   *  is.width() is non-zero, that is the limit on the number of characters\n   *  stored into @a str.  Any previous contents of @a str are erased.\n   */\n  template<typename _CharT, typename _Traits, typename _Alloc,\n           template <typename, typename, typename> class _Base>\n    basic_istream<_CharT, _Traits>&\n    operator>>(basic_istream<_CharT, _Traits>& __is,\n\t       __gnu_cxx::__versa_string<_CharT, _Traits,\n\t                                 _Alloc, _Base>& __str);\n\n  /**\n   *  @brief  Write string to a stream.\n   *  @param os  Output stream.\n   *  @param str  String to write out.\n   *  @return  Reference to the output stream.\n   *\n   *  Output characters of @a str into os following the same rules as for\n   *  writing a C string.\n   */\n  template<typename _CharT, typename _Traits, typename _Alloc,\n           template <typename, typename, typename> class _Base>\n    inline basic_ostream<_CharT, _Traits>&\n    operator<<(basic_ostream<_CharT, _Traits>& __os,\n\t       const __gnu_cxx::__versa_string<_CharT, _Traits,\n\t                                       _Alloc, _Base>& __str)\n    {\n      // _GLIBCXX_RESOLVE_LIB_DEFECTS\n      // 586. string inserter not a formatted function\n      return __ostream_insert(__os, __str.data(), __str.size());\n    }\n\n  /**\n   *  @brief  Read a line from stream into a string.\n   *  @param is  Input stream.\n   *  @param str  Buffer to store into.\n   *  @param delim  Character marking end of line.\n   *  @return  Reference to the input stream.\n   *\n   *  Stores characters from @a is into @a str until @a delim is found, the\n   *  end of the stream is encountered, or str.max_size() is reached.  If\n   *  is.width() is non-zero, that is the limit on the number of characters\n   *  stored into @a str.  Any previous contents of @a str are erased.  If @a\n   *  delim was encountered, it is extracted but not stored into @a str.\n   */\n  template<typename _CharT, typename _Traits, typename _Alloc,\n           template <typename, typename, typename> class _Base>\n    basic_istream<_CharT, _Traits>&\n    getline(basic_istream<_CharT, _Traits>& __is,\n\t    __gnu_cxx::__versa_string<_CharT, _Traits, _Alloc, _Base>& __str,\n\t    _CharT __delim);\n\n  /**\n   *  @brief  Read a line from stream into a string.\n   *  @param is  Input stream.\n   *  @param str  Buffer to store into.\n   *  @return  Reference to the input stream.\n   *\n   *  Stores characters from is into @a str until '\\n' is found, the end of\n   *  the stream is encountered, or str.max_size() is reached.  If is.width()\n   *  is non-zero, that is the limit on the number of characters stored into\n   *  @a str.  Any previous contents of @a str are erased.  If end of line was\n   *  encountered, it is extracted but not stored into @a str.\n   */\n  template<typename _CharT, typename _Traits, typename _Alloc,\n           template <typename, typename, typename> class _Base>\n    inline basic_istream<_CharT, _Traits>&\n    getline(basic_istream<_CharT, _Traits>& __is,\n\t    __gnu_cxx::__versa_string<_CharT, _Traits, _Alloc, _Base>& __str)\n    { return getline(__is, __str, __is.widen('\\n')); }      \n\n_GLIBCXX_END_NAMESPACE\n\n#ifndef _GLIBCXX_EXPORT_TEMPLATE\n# include \"vstring.tcc\" \n#endif\n\n#endif /* _VSTRING_H */\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/vstring.tcc",
    "content": "// Versatile string -*- C++ -*-\n\n// Copyright (C) 2005, 2006, 2007 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n/** @file ext/vstring.tcc\n *  This file is a GNU extension to the Standard C++ Library.\n *  This is an internal header file, included by other library headers.\n *  You should not attempt to use it directly.\n */\n\n#ifndef _VSTRING_TCC\n#define _VSTRING_TCC 1\n\n#pragma GCC system_header\n\n_GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)\n\n  template<typename _CharT, typename _Traits, typename _Alloc,\n\t   template <typename, typename, typename> class _Base>\n    const typename __versa_string<_CharT, _Traits, _Alloc, _Base>::size_type\n    __versa_string<_CharT, _Traits, _Alloc, _Base>::npos;\n\n  template<typename _CharT, typename _Traits, typename _Alloc,\n\t   template <typename, typename, typename> class _Base>\n    void\n    __versa_string<_CharT, _Traits, _Alloc, _Base>::\n    resize(size_type __n, _CharT __c)\n    {\n      const size_type __size = this->size();\n      if (__size < __n)\n\tthis->append(__n - __size, __c);\n      else if (__n < __size)\n\tthis->_M_erase(__n, __size - __n);\n    }\n\n  template<typename _CharT, typename _Traits, typename _Alloc,\n\t   template <typename, typename, typename> class _Base>\n    __versa_string<_CharT, _Traits, _Alloc, _Base>&\n    __versa_string<_CharT, _Traits, _Alloc, _Base>::\n    _M_append(const _CharT* __s, size_type __n)\n    {\n      const size_type __len = __n + this->size();\n\n      if (__len <= this->capacity() && !this->_M_is_shared())\n\t{\n\t  if (__n)\n\t    this->_S_copy(this->_M_data() + this->size(), __s, __n);\n\t}\n      else\n\tthis->_M_mutate(this->size(), size_type(0), __s, __n);\n\n      this->_M_set_length(__len);\n      return *this;\n    }\n\n  template<typename _CharT, typename _Traits, typename _Alloc,\n\t   template <typename, typename, typename> class _Base>\n    template<typename _InputIterator>\n      __versa_string<_CharT, _Traits, _Alloc, _Base>&\n      __versa_string<_CharT, _Traits, _Alloc, _Base>::\n      _M_replace_dispatch(iterator __i1, iterator __i2, _InputIterator __k1,\n\t\t\t  _InputIterator __k2, std::__false_type)\n      {\n\tconst __versa_string __s(__k1, __k2);\n\tconst size_type __n1 = __i2 - __i1;\n\treturn _M_replace(__i1 - _M_ibegin(), __n1, __s._M_data(),\n\t\t\t  __s.size());\n      }\n\n  template<typename _CharT, typename _Traits, typename _Alloc,\n\t   template <typename, typename, typename> class _Base>\n    __versa_string<_CharT, _Traits, _Alloc, _Base>&\n    __versa_string<_CharT, _Traits, _Alloc, _Base>::\n    _M_replace_aux(size_type __pos1, size_type __n1, size_type __n2,\n\t\t   _CharT __c)\n    {\n      _M_check_length(__n1, __n2, \"__versa_string::_M_replace_aux\");\n\n      const size_type __old_size = this->size();\n      const size_type __new_size = __old_size + __n2 - __n1;\n\n      if (__new_size <= this->capacity() && !this->_M_is_shared())\n\t{\n\t  _CharT* __p = this->_M_data() + __pos1;\n\n\t  const size_type __how_much = __old_size - __pos1 - __n1;\n\t  if (__how_much && __n1 != __n2)\n\t    this->_S_move(__p + __n2, __p + __n1, __how_much);\n\t}\n      else\n\tthis->_M_mutate(__pos1, __n1, 0, __n2);\n\n      if (__n2)\n\tthis->_S_assign(this->_M_data() + __pos1, __n2, __c);\n\n      this->_M_set_length(__new_size);\n      return *this;\n    }\n\n  template<typename _CharT, typename _Traits, typename _Alloc,\n\t   template <typename, typename, typename> class _Base>\n    __versa_string<_CharT, _Traits, _Alloc, _Base>&\n    __versa_string<_CharT, _Traits, _Alloc, _Base>::\n    _M_replace(size_type __pos, size_type __len1, const _CharT* __s,\n\t       const size_type __len2)\n    {\n      _M_check_length(__len1, __len2, \"__versa_string::_M_replace\");\n\n      const size_type __old_size = this->size();\n      const size_type __new_size = __old_size + __len2 - __len1;\n      \n      if (__new_size <= this->capacity() && !this->_M_is_shared())\n\t{\n\t  _CharT* __p = this->_M_data() + __pos;\n\n\t  const size_type __how_much = __old_size - __pos - __len1;\n\t  if (_M_disjunct(__s))\n\t    {\n\t      if (__how_much && __len1 != __len2)\n\t\tthis->_S_move(__p + __len2, __p + __len1, __how_much);\n\t      if (__len2)\n\t\tthis->_S_copy(__p, __s, __len2);\n\t    }\n\t  else\n\t    {\n\t      // Work in-place.\n\t      if (__len2 && __len2 <= __len1)\n\t\tthis->_S_move(__p, __s, __len2);\n\t      if (__how_much && __len1 != __len2)\n\t\tthis->_S_move(__p + __len2, __p + __len1, __how_much);\n\t      if (__len2 > __len1)\n\t\t{\n\t\t  if (__s + __len2 <= __p + __len1)\n\t\t    this->_S_move(__p, __s, __len2);\n\t\t  else if (__s >= __p + __len1)\n\t\t    this->_S_copy(__p, __s + __len2 - __len1, __len2);\n\t\t  else\n\t\t    {\n\t\t      const size_type __nleft = (__p + __len1) - __s;\n\t\t      this->_S_move(__p, __s, __nleft);\n\t\t      this->_S_copy(__p + __nleft, __p + __len2,\n\t\t\t\t    __len2 - __nleft);\n\t\t    }\n\t\t}\n\t    }\n\t}\n      else\n\tthis->_M_mutate(__pos, __len1, __s, __len2);\n\n      this->_M_set_length(__new_size);\n      return *this;\n    }\n  \n  template<typename _CharT, typename _Traits, typename _Alloc,\n\t   template <typename, typename, typename> class _Base>\n    __versa_string<_CharT, _Traits, _Alloc, _Base>\n    operator+(const __versa_string<_CharT, _Traits, _Alloc, _Base>& __lhs,\n\t      const __versa_string<_CharT, _Traits, _Alloc, _Base>& __rhs)\n    {\n      __versa_string<_CharT, _Traits, _Alloc, _Base> __str;\n      __str.reserve(__lhs.size() + __rhs.size());\n      __str.append(__lhs);\n      __str.append(__rhs);\n      return __str;\n    }\n\n  template<typename _CharT, typename _Traits, typename _Alloc,\n\t   template <typename, typename, typename> class _Base>\n    __versa_string<_CharT, _Traits, _Alloc, _Base>\n    operator+(const _CharT* __lhs,\n\t      const __versa_string<_CharT, _Traits, _Alloc, _Base>& __rhs)\n    {\n      __glibcxx_requires_string(__lhs);\n      typedef __versa_string<_CharT, _Traits, _Alloc, _Base> __string_type;\n      typedef typename __string_type::size_type\t  __size_type;\n      const __size_type __len = _Traits::length(__lhs);\n      __string_type __str;\n      __str.reserve(__len + __rhs.size());\n      __str.append(__lhs, __len);\n      __str.append(__rhs);\n      return __str;\n    }\n\n  template<typename _CharT, typename _Traits, typename _Alloc,\n\t   template <typename, typename, typename> class _Base>\n    __versa_string<_CharT, _Traits, _Alloc, _Base>\n    operator+(_CharT __lhs,\n\t      const __versa_string<_CharT, _Traits, _Alloc, _Base>& __rhs)\n    {\n      __versa_string<_CharT, _Traits, _Alloc, _Base> __str;\n      __str.reserve(__rhs.size() + 1);\n      __str.push_back(__lhs);\n      __str.append(__rhs);\n      return __str;\n    }\n\n  template<typename _CharT, typename _Traits, typename _Alloc,\n\t   template <typename, typename, typename> class _Base>\n    __versa_string<_CharT, _Traits, _Alloc, _Base>\n    operator+(const __versa_string<_CharT, _Traits, _Alloc, _Base>& __lhs,\n\t      const _CharT* __rhs)\n    {\n      __glibcxx_requires_string(__rhs);\n      typedef __versa_string<_CharT, _Traits, _Alloc, _Base> __string_type;\n      typedef typename __string_type::size_type\t  __size_type;\n      const __size_type __len = _Traits::length(__rhs);\n      __string_type __str;\n      __str.reserve(__lhs.size() + __len);\n      __str.append(__lhs);\n      __str.append(__rhs, __len);\n      return __str;\n    }\n\n  template<typename _CharT, typename _Traits, typename _Alloc,\n\t   template <typename, typename, typename> class _Base>\n    __versa_string<_CharT, _Traits, _Alloc, _Base>\n    operator+(const __versa_string<_CharT, _Traits, _Alloc, _Base>& __lhs,\n\t      _CharT __rhs)\n    {\n      __versa_string<_CharT, _Traits, _Alloc, _Base> __str;\n      __str.reserve(__lhs.size() + 1);\n      __str.append(__lhs);\n      __str.push_back(__rhs);\n      return __str;\n    }\n\n  template<typename _CharT, typename _Traits, typename _Alloc,\n\t   template <typename, typename, typename> class _Base>\n    typename __versa_string<_CharT, _Traits, _Alloc, _Base>::size_type\n    __versa_string<_CharT, _Traits, _Alloc, _Base>::\n    copy(_CharT* __s, size_type __n, size_type __pos) const\n    {\n      _M_check(__pos, \"__versa_string::copy\");\n      __n = _M_limit(__pos, __n);\n      __glibcxx_requires_string_len(__s, __n);\n      if (__n)\n\tthis->_S_copy(__s, this->_M_data() + __pos, __n);\n      // 21.3.5.7 par 3: do not append null.  (good.)\n      return __n;\n    }\n\n  template<typename _CharT, typename _Traits, typename _Alloc,\n\t   template <typename, typename, typename> class _Base>\n    typename __versa_string<_CharT, _Traits, _Alloc, _Base>::size_type\n    __versa_string<_CharT, _Traits, _Alloc, _Base>::\n    find(const _CharT* __s, size_type __pos, size_type __n) const\n    {\n      __glibcxx_requires_string_len(__s, __n);\n      const size_type __size = this->size();\n      const _CharT* __data = this->_M_data();\n\n      if (__n == 0)\n\treturn __pos <= __size ? __pos : npos;\n\n      if (__n <= __size)\n\t{\n\t  for (; __pos <= __size - __n; ++__pos)\n\t    if (traits_type::eq(__data[__pos], __s[0])\n\t\t&& traits_type::compare(__data + __pos + 1,\n\t\t\t\t\t__s + 1, __n - 1) == 0)\n\t      return __pos;\n\t}\n      return npos;\n    }\n\n  template<typename _CharT, typename _Traits, typename _Alloc,\n\t   template <typename, typename, typename> class _Base>\n    typename __versa_string<_CharT, _Traits, _Alloc, _Base>::size_type\n    __versa_string<_CharT, _Traits, _Alloc, _Base>::\n    find(_CharT __c, size_type __pos) const\n    {\n      size_type __ret = npos;\n      const size_type __size = this->size();\n      if (__pos < __size)\n\t{\n\t  const _CharT* __data = this->_M_data();\n\t  const size_type __n = __size - __pos;\n\t  const _CharT* __p = traits_type::find(__data + __pos, __n, __c);\n\t  if (__p)\n\t    __ret = __p - __data;\n\t}\n      return __ret;\n    }\n\n  template<typename _CharT, typename _Traits, typename _Alloc,\n\t   template <typename, typename, typename> class _Base>\n    typename __versa_string<_CharT, _Traits, _Alloc, _Base>::size_type\n    __versa_string<_CharT, _Traits, _Alloc, _Base>::\n    rfind(const _CharT* __s, size_type __pos, size_type __n) const\n    {\n      __glibcxx_requires_string_len(__s, __n);\n      const size_type __size = this->size();\n      if (__n <= __size)\n\t{\n\t  __pos = std::min(size_type(__size - __n), __pos);\n\t  const _CharT* __data = this->_M_data();\n\t  do\n\t    {\n\t      if (traits_type::compare(__data + __pos, __s, __n) == 0)\n\t\treturn __pos;\n\t    }\n\t  while (__pos-- > 0);\n\t}\n      return npos;\n    }\n\n  template<typename _CharT, typename _Traits, typename _Alloc,\n\t   template <typename, typename, typename> class _Base>\n    typename __versa_string<_CharT, _Traits, _Alloc, _Base>::size_type\n    __versa_string<_CharT, _Traits, _Alloc, _Base>::\n    rfind(_CharT __c, size_type __pos) const\n    {\n      size_type __size = this->size();\n      if (__size)\n\t{\n\t  if (--__size > __pos)\n\t    __size = __pos;\n\t  for (++__size; __size-- > 0; )\n\t    if (traits_type::eq(this->_M_data()[__size], __c))\n\t      return __size;\n\t}\n      return npos;\n    }\n\n  template<typename _CharT, typename _Traits, typename _Alloc,\n\t   template <typename, typename, typename> class _Base>\n    typename __versa_string<_CharT, _Traits, _Alloc, _Base>::size_type\n    __versa_string<_CharT, _Traits, _Alloc, _Base>::\n    find_first_of(const _CharT* __s, size_type __pos, size_type __n) const\n    {\n      __glibcxx_requires_string_len(__s, __n);\n      for (; __n && __pos < this->size(); ++__pos)\n\t{\n\t  const _CharT* __p = traits_type::find(__s, __n,\n\t\t\t\t\t\tthis->_M_data()[__pos]);\n\t  if (__p)\n\t    return __pos;\n\t}\n      return npos;\n    }\n\n  template<typename _CharT, typename _Traits, typename _Alloc,\n\t   template <typename, typename, typename> class _Base>\n    typename __versa_string<_CharT, _Traits, _Alloc, _Base>::size_type\n    __versa_string<_CharT, _Traits, _Alloc, _Base>::\n    find_last_of(const _CharT* __s, size_type __pos, size_type __n) const\n    {\n      __glibcxx_requires_string_len(__s, __n);\n      size_type __size = this->size();\n      if (__size && __n)\n\t{\n\t  if (--__size > __pos)\n\t    __size = __pos;\n\t  do\n\t    {\n\t      if (traits_type::find(__s, __n, this->_M_data()[__size]))\n\t\treturn __size;\n\t    }\n\t  while (__size-- != 0);\n\t}\n      return npos;\n    }\n\n  template<typename _CharT, typename _Traits, typename _Alloc,\n\t   template <typename, typename, typename> class _Base>\n    typename __versa_string<_CharT, _Traits, _Alloc, _Base>::size_type\n    __versa_string<_CharT, _Traits, _Alloc, _Base>::\n    find_first_not_of(const _CharT* __s, size_type __pos, size_type __n) const\n    {\n      __glibcxx_requires_string_len(__s, __n);\n      for (; __pos < this->size(); ++__pos)\n\tif (!traits_type::find(__s, __n, this->_M_data()[__pos]))\n\t  return __pos;\n      return npos;\n    }\n\n  template<typename _CharT, typename _Traits, typename _Alloc,\n\t   template <typename, typename, typename> class _Base>\n    typename __versa_string<_CharT, _Traits, _Alloc, _Base>::size_type\n    __versa_string<_CharT, _Traits, _Alloc, _Base>::\n    find_first_not_of(_CharT __c, size_type __pos) const\n    {\n      for (; __pos < this->size(); ++__pos)\n\tif (!traits_type::eq(this->_M_data()[__pos], __c))\n\t  return __pos;\n      return npos;\n    }\n\n  template<typename _CharT, typename _Traits, typename _Alloc,\n\t   template <typename, typename, typename> class _Base>\n    typename __versa_string<_CharT, _Traits, _Alloc, _Base>::size_type\n    __versa_string<_CharT, _Traits, _Alloc, _Base>::\n    find_last_not_of(const _CharT* __s, size_type __pos, size_type __n) const\n    {\n      __glibcxx_requires_string_len(__s, __n);\n      size_type __size = this->size();\n      if (__size)\n\t{\n\t  if (--__size > __pos)\n\t    __size = __pos;\n\t  do\n\t    {\n\t      if (!traits_type::find(__s, __n, this->_M_data()[__size]))\n\t\treturn __size;\n\t    }\n\t  while (__size--);\n\t}\n      return npos;\n    }\n\n  template<typename _CharT, typename _Traits, typename _Alloc,\n\t   template <typename, typename, typename> class _Base>\n    typename __versa_string<_CharT, _Traits, _Alloc, _Base>::size_type\n    __versa_string<_CharT, _Traits, _Alloc, _Base>::\n    find_last_not_of(_CharT __c, size_type __pos) const\n    {\n      size_type __size = this->size();\n      if (__size)\n\t{\n\t  if (--__size > __pos)\n\t    __size = __pos;\n\t  do\n\t    {\n\t      if (!traits_type::eq(this->_M_data()[__size], __c))\n\t\treturn __size;\n\t    }\n\t  while (__size--);\n\t}\n      return npos;\n    }\n\n  template<typename _CharT, typename _Traits, typename _Alloc,\n\t   template <typename, typename, typename> class _Base>\n    int\n    __versa_string<_CharT, _Traits, _Alloc, _Base>::\n    compare(size_type __pos, size_type __n, const __versa_string& __str) const\n    {\n      _M_check(__pos, \"__versa_string::compare\");\n      __n = _M_limit(__pos, __n);\n      const size_type __osize = __str.size();\n      const size_type __len = std::min(__n, __osize);\n      int __r = traits_type::compare(this->_M_data() + __pos,\n\t\t\t\t     __str.data(), __len);\n      if (!__r)\n\t__r = __n - __osize;\n      return __r;\n    }\n\n  template<typename _CharT, typename _Traits, typename _Alloc,\n\t   template <typename, typename, typename> class _Base>\n    int\n    __versa_string<_CharT, _Traits, _Alloc, _Base>::\n    compare(size_type __pos1, size_type __n1, const __versa_string& __str,\n\t    size_type __pos2, size_type __n2) const\n    {\n      _M_check(__pos1, \"__versa_string::compare\");\n      __str._M_check(__pos2, \"__versa_string::compare\");\n      __n1 = _M_limit(__pos1, __n1);\n      __n2 = __str._M_limit(__pos2, __n2);\n      const size_type __len = std::min(__n1, __n2);\n      int __r = traits_type::compare(this->_M_data() + __pos1,\n\t\t\t\t     __str.data() + __pos2, __len);\n      if (!__r)\n\t__r = __n1 - __n2;\n      return __r;\n    }\n\n  template<typename _CharT, typename _Traits, typename _Alloc,\n\t   template <typename, typename, typename> class _Base>\n    int\n    __versa_string<_CharT, _Traits, _Alloc, _Base>::\n    compare(const _CharT* __s) const\n    {\n      __glibcxx_requires_string(__s);\n      const size_type __size = this->size();\n      const size_type __osize = traits_type::length(__s);\n      const size_type __len = std::min(__size, __osize);\n      int __r = traits_type::compare(this->_M_data(), __s, __len);\n      if (!__r)\n\t__r = __size - __osize;\n      return __r;\n    }\n\n  template<typename _CharT, typename _Traits, typename _Alloc,\n\t   template <typename, typename, typename> class _Base>\n    int\n    __versa_string <_CharT, _Traits, _Alloc, _Base>::\n    compare(size_type __pos, size_type __n1, const _CharT* __s) const\n    {\n      __glibcxx_requires_string(__s);\n      _M_check(__pos, \"__versa_string::compare\");\n      __n1 = _M_limit(__pos, __n1);\n      const size_type __osize = traits_type::length(__s);\n      const size_type __len = std::min(__n1, __osize);\n      int __r = traits_type::compare(this->_M_data() + __pos, __s, __len);\n      if (!__r)\n\t__r = __n1 - __osize;\n      return __r;\n    }\n\n  template<typename _CharT, typename _Traits, typename _Alloc,\n\t   template <typename, typename, typename> class _Base>\n    int\n    __versa_string <_CharT, _Traits, _Alloc, _Base>::\n    compare(size_type __pos, size_type __n1, const _CharT* __s,\n\t    size_type __n2) const\n    {\n      __glibcxx_requires_string_len(__s, __n2);\n      _M_check(__pos, \"__versa_string::compare\");\n      __n1 = _M_limit(__pos, __n1);\n      const size_type __len = std::min(__n1, __n2);\n      int __r = traits_type::compare(this->_M_data() + __pos, __s, __len);\n      if (!__r)\n\t__r = __n1 - __n2;\n      return __r;\n    }\n\n_GLIBCXX_END_NAMESPACE\n\n_GLIBCXX_BEGIN_NAMESPACE(std)\n\n  template<typename _CharT, typename _Traits, typename _Alloc,\n           template <typename, typename, typename> class _Base>\n    basic_istream<_CharT, _Traits>&\n    operator>>(basic_istream<_CharT, _Traits>& __in,\n\t       __gnu_cxx::__versa_string<_CharT, _Traits,\n\t                                 _Alloc, _Base>& __str)\n    {\n      typedef basic_istream<_CharT, _Traits>\t        __istream_type;\n      typedef typename __istream_type::int_type\t\t__int_type;\n      typedef typename __istream_type::__streambuf_type __streambuf_type;\n      typedef typename __istream_type::__ctype_type\t__ctype_type;\n      typedef __gnu_cxx::__versa_string<_CharT, _Traits, _Alloc, _Base>\n\t                                                __string_type;\n      typedef typename __string_type::size_type\t\t__size_type;\n\n      __size_type __extracted = 0;\n      ios_base::iostate __err = ios_base::iostate(ios_base::goodbit);\n      typename __istream_type::sentry __cerb(__in, false);\n      if (__cerb)\n\t{\n\t  try\n\t    {\n\t      // Avoid reallocation for common case.\n\t      __str.erase();\n\t      _CharT __buf[128];\n\t      __size_type __len = 0;\n\t      const streamsize __w = __in.width();\n\t      const __size_type __n = __w > 0 ? static_cast<__size_type>(__w)\n\t\t                              : __str.max_size();\n\t      const __ctype_type& __ct = use_facet<__ctype_type>(__in.getloc());\n\t      const __int_type __eof = _Traits::eof();\n\t      __streambuf_type* __sb = __in.rdbuf();\n\t      __int_type __c = __sb->sgetc();\n\n\t      while (__extracted < __n\n\t\t     && !_Traits::eq_int_type(__c, __eof)\n\t\t     && !__ct.is(ctype_base::space, _Traits::to_char_type(__c)))\n\t\t{\n\t\t  if (__len == sizeof(__buf) / sizeof(_CharT))\n\t\t    {\n\t\t      __str.append(__buf, sizeof(__buf) / sizeof(_CharT));\n\t\t      __len = 0;\n\t\t    }\n\t\t  __buf[__len++] = _Traits::to_char_type(__c);\n\t\t  ++__extracted;\n\t\t  __c = __sb->snextc();\n\t\t}\n\t      __str.append(__buf, __len);\n\n\t      if (_Traits::eq_int_type(__c, __eof))\n\t\t__err |= ios_base::eofbit;\n\t      __in.width(0);\n\t    }\n\t  catch(...)\n\t    {\n\t      // _GLIBCXX_RESOLVE_LIB_DEFECTS\n\t      // 91. Description of operator>> and getline() for string<>\n\t      // might cause endless loop\n\t      __in._M_setstate(ios_base::badbit);\n\t    }\n\t}\n      // 211.  operator>>(istream&, string&) doesn't set failbit\n      if (!__extracted)\n\t__err |= ios_base::failbit;\n      if (__err)\n\t__in.setstate(__err);\n      return __in;\n    }      \n\n  template<typename _CharT, typename _Traits, typename _Alloc,\n           template <typename, typename, typename> class _Base>\n    basic_istream<_CharT, _Traits>&\n    getline(basic_istream<_CharT, _Traits>& __in,\n\t    __gnu_cxx::__versa_string<_CharT, _Traits, _Alloc, _Base>& __str,\n\t    _CharT __delim)\n    {\n      typedef basic_istream<_CharT, _Traits>\t        __istream_type;\n      typedef typename __istream_type::int_type\t\t__int_type;\n      typedef typename __istream_type::__streambuf_type __streambuf_type;\n      typedef typename __istream_type::__ctype_type\t__ctype_type;\n      typedef __gnu_cxx::__versa_string<_CharT, _Traits, _Alloc, _Base>\n\t                                                __string_type;\n      typedef typename __string_type::size_type\t\t__size_type;\n\n      __size_type __extracted = 0;\n      const __size_type __n = __str.max_size();\n      ios_base::iostate __err = ios_base::iostate(ios_base::goodbit);\n      typename __istream_type::sentry __cerb(__in, true);\n      if (__cerb)\n\t{\n\t  try\n\t    {\n\t      // Avoid reallocation for common case.\n\t      __str.erase();\n\t      _CharT __buf[128];\n\t      __size_type __len = 0;\n\t      const __int_type __idelim = _Traits::to_int_type(__delim);\n\t      const __int_type __eof = _Traits::eof();\n\t      __streambuf_type* __sb = __in.rdbuf();\n\t      __int_type __c = __sb->sgetc();\n\n\t      while (__extracted < __n\n\t\t     && !_Traits::eq_int_type(__c, __eof)\n\t\t     && !_Traits::eq_int_type(__c, __idelim))\n\t\t{\n\t\t  if (__len == sizeof(__buf) / sizeof(_CharT))\n\t\t    {\n\t\t      __str.append(__buf, sizeof(__buf) / sizeof(_CharT));\n\t\t      __len = 0;\n\t\t    }\n\t\t  __buf[__len++] = _Traits::to_char_type(__c);\n\t\t  ++__extracted;\n\t\t  __c = __sb->snextc();\n\t\t}\n\t      __str.append(__buf, __len);\n\n\t      if (_Traits::eq_int_type(__c, __eof))\n\t\t__err |= ios_base::eofbit;\n\t      else if (_Traits::eq_int_type(__c, __idelim))\n\t\t{\n\t\t  ++__extracted;\t\t  \n\t\t  __sb->sbumpc();\n\t\t}\n\t      else\n\t\t__err |= ios_base::failbit;\n\t    }\n\t  catch(...)\n\t    {\n\t      // _GLIBCXX_RESOLVE_LIB_DEFECTS\n\t      // 91. Description of operator>> and getline() for string<>\n\t      // might cause endless loop\n\t      __in._M_setstate(ios_base::badbit);\n\t    }\n\t}\n      if (!__extracted)\n\t__err |= ios_base::failbit;\n      if (__err)\n\t__in.setstate(__err);\n      return __in;\n    }      \n  \n_GLIBCXX_END_NAMESPACE\n\n#endif // _VSTRING_TCC\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/vstring_fwd.h",
    "content": "// Versatile string forward -*- C++ -*-\n\n// Copyright (C) 2005 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n/** @file ext/vstring_fwd.h\n *  This file is a GNU extension to the Standard C++ Library.\n *  This is an internal header file, included by other library headers.\n *  You should not attempt to use it directly.\n */\n\n#ifndef _VSTRING_FWD_H\n#define _VSTRING_FWD_H 1\n\n#pragma GCC system_header\n\n#include <bits/c++config.h>\n#include <bits/char_traits.h>\n#include <memory> \t// For allocator.\n\n_GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)\n\n  template<typename _CharT, typename _Traits, typename _Alloc>\n    class __sso_string_base;\n\n  template<typename _CharT, typename _Traits, typename _Alloc>\n    class __rc_string_base;\n\n  template<typename _CharT, typename _Traits = std::char_traits<_CharT>,\n           typename _Alloc = std::allocator<_CharT>,\n\t   template\n\t   <typename, typename, typename> class _Base = __sso_string_base>\n    class __versa_string;\n\n  typedef __versa_string<char>                              __vstring;\n  typedef __vstring                                         __sso_string;\n  typedef \n  __versa_string<char, std::char_traits<char>,\n\t\t std::allocator<char>, __rc_string_base>    __rc_string;\n\n#ifdef _GLIBCXX_USE_WCHAR_T\n  typedef __versa_string<wchar_t>                           __wvstring;\n  typedef __wvstring                                        __wsso_string;\n  typedef\n  __versa_string<wchar_t, std::char_traits<wchar_t>,\n\t\t std::allocator<wchar_t>, __rc_string_base> __wrc_string;\n#endif  \n\n_GLIBCXX_END_NAMESPACE\n\n#endif /* _VSTRING_FWD_H */\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ext/vstring_util.h",
    "content": "// Versatile string utility -*- C++ -*-\n\n// Copyright (C) 2005, 2006, 2007 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n/** @file ext/vstring_util.h\n *  This file is a GNU extension to the Standard C++ Library.\n *  This is an internal header file, included by other library headers.\n *  You should not attempt to use it directly.\n */\n\n#ifndef _VSTRING_UTIL_H\n#define _VSTRING_UTIL_H 1\n\n#pragma GCC system_header\n\n#include <ext/vstring_fwd.h>\n#include <debug/debug.h>\n#include <bits/stl_function.h>  // For less\n#include <bits/functexcept.h>\n#include <locale>\n#include <algorithm> // For std::distance, srd::search.\n#include <bits/ostream_insert.h>\n\n_GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)\n\n  template<typename _CharT, typename _Traits, typename _Alloc>\n    struct __vstring_utility\n    {\n      typedef typename _Alloc::template rebind<_CharT>::other _CharT_alloc_type;\n\n      typedef _Traits\t\t\t\t\t    traits_type;      \n      typedef typename _Traits::char_type\t\t    value_type;\n      typedef typename _CharT_alloc_type::size_type\t    size_type;\n      typedef typename _CharT_alloc_type::pointer\t    pointer;\n      typedef typename _CharT_alloc_type::const_pointer\t    const_pointer;\n\n      // For __sso_string.\n      typedef __gnu_cxx::\n      __normal_iterator<pointer, __gnu_cxx::\n\t\t\t__versa_string<_CharT, _Traits, _Alloc,\n\t\t\t\t       __sso_string_base> >\n        __sso_iterator;\n      typedef __gnu_cxx::\n      __normal_iterator<const_pointer, __gnu_cxx::\n\t\t\t__versa_string<_CharT, _Traits, _Alloc,\n\t\t\t\t       __sso_string_base> >\n        __const_sso_iterator;\n\n      // For __rc_string.\n      typedef __gnu_cxx::\n      __normal_iterator<pointer, __gnu_cxx::\n\t\t\t__versa_string<_CharT, _Traits, _Alloc,\n\t\t\t\t       __rc_string_base> >\n        __rc_iterator;\n      typedef __gnu_cxx::\n      __normal_iterator<const_pointer, __gnu_cxx::\n\t\t\t__versa_string<_CharT, _Traits, _Alloc,\n\t\t\t\t       __rc_string_base> >\n        __const_rc_iterator;\n\n      // NB:  When the allocator is empty, deriving from it saves space \n      // (http://www.cantrip.org/emptyopt.html).\n      template<typename _Alloc1>\n        struct _Alloc_hider\n\t: public _Alloc1\n\t{\n\t  _Alloc_hider(const _Alloc1& __a, _CharT* __ptr)\n\t  : _Alloc1(__a), _M_p(__ptr) { }\n\n\t  _CharT*  _M_p; // The actual data.\n\t};\n\n      // For use in _M_construct (_S_construct) forward_iterator_tag.\n      template<typename _Type>\n        static bool\n        _S_is_null_pointer(_Type* __ptr)\n        { return __ptr == 0; }\n\n      template<typename _Type>\n        static bool\n        _S_is_null_pointer(_Type)\n        { return false; }\n\n      // When __n = 1 way faster than the general multichar\n      // traits_type::copy/move/assign.\n      static void\n      _S_copy(_CharT* __d, const _CharT* __s, size_type __n)\n      {\n\tif (__n == 1)\n\t  traits_type::assign(*__d, *__s);\n\telse\n\t  traits_type::copy(__d, __s, __n);\n      }\n\n      static void\n      _S_move(_CharT* __d, const _CharT* __s, size_type __n)\n      {\n\tif (__n == 1)\n\t  traits_type::assign(*__d, *__s);\n\telse\n\t  traits_type::move(__d, __s, __n);\t  \n      }\n\n      static void\n      _S_assign(_CharT* __d, size_type __n, _CharT __c)\n      {\n\tif (__n == 1)\n\t  traits_type::assign(*__d, __c);\n\telse\n\t  traits_type::assign(__d, __n, __c);\t  \n      }\n\n      // _S_copy_chars is a separate template to permit specialization\n      // to optimize for the common case of pointers as iterators.\n      template<typename _Iterator>\n        static void\n        _S_copy_chars(_CharT* __p, _Iterator __k1, _Iterator __k2)\n        {\n\t  for (; __k1 != __k2; ++__k1, ++__p)\n\t    traits_type::assign(*__p, *__k1); // These types are off.\n\t}\n\n      static void\n      _S_copy_chars(_CharT* __p, __sso_iterator __k1, __sso_iterator __k2)\n      { _S_copy_chars(__p, __k1.base(), __k2.base()); }\n\n      static void\n      _S_copy_chars(_CharT* __p, __const_sso_iterator __k1,\n\t\t    __const_sso_iterator __k2)\n      { _S_copy_chars(__p, __k1.base(), __k2.base()); }\n\n      static void\n      _S_copy_chars(_CharT* __p, __rc_iterator __k1, __rc_iterator __k2)\n      { _S_copy_chars(__p, __k1.base(), __k2.base()); }\n\n      static void\n      _S_copy_chars(_CharT* __p, __const_rc_iterator __k1,\n\t\t    __const_rc_iterator __k2)\n      { _S_copy_chars(__p, __k1.base(), __k2.base()); }\n\n      static void\n      _S_copy_chars(_CharT* __p, _CharT* __k1, _CharT* __k2)\n      { _S_copy(__p, __k1, __k2 - __k1); }\n\n      static void\n      _S_copy_chars(_CharT* __p, const _CharT* __k1, const _CharT* __k2)\n      { _S_copy(__p, __k1, __k2 - __k1); }\n    };\n\n_GLIBCXX_END_NAMESPACE\n\n#endif /* _VSTRING_UTIL_H */\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/fstream",
    "content": "// File based streams -*- C++ -*-\n\n// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,\n// 2006, 2007\n// Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n/** @file fstream\n *  This is a Standard C++ Library header.\n */\n\n//\n// ISO C++ 14882: 27.8  File-based streams\n//\n\n#ifndef _GLIBCXX_FSTREAM\n#define _GLIBCXX_FSTREAM 1\n\n#pragma GCC system_header\n\n#include <istream>\n#include <ostream>\n#include <locale>\t// For codecvt\n#include <cstdio>       // For SEEK_SET, SEEK_CUR, SEEK_END, BUFSIZ     \n#include <bits/basic_file.h>\n#include <bits/gthr.h>\n\n_GLIBCXX_BEGIN_NAMESPACE(std)\n\n  // [27.8.1.1] template class basic_filebuf\n  /**\n   *  @brief  The actual work of input and output (for files).\n   *\n   *  This class associates both its input and output sequence with an\n   *  external disk file, and maintains a joint file position for both\n   *  sequences.  Many of its sematics are described in terms of similar\n   *  behavior in the Standard C Library's @c FILE streams.\n  */\n  // Requirements on traits_type, specific to this class:\n  // traits_type::pos_type must be fpos<traits_type::state_type>\n  // traits_type::off_type must be streamoff\n  // traits_type::state_type must be Assignable and DefaultConstructable,\n  // and traits_type::state_type() must be the initial state for codecvt.\n  template<typename _CharT, typename _Traits>\n    class basic_filebuf : public basic_streambuf<_CharT, _Traits>\n    {\n    public:\n      // Types:\n      typedef _CharT                     \t        char_type;\n      typedef _Traits                    \t        traits_type;\n      typedef typename traits_type::int_type \t\tint_type;\n      typedef typename traits_type::pos_type \t\tpos_type;\n      typedef typename traits_type::off_type \t\toff_type;\n\n      typedef basic_streambuf<char_type, traits_type>  \t__streambuf_type;\n      typedef basic_filebuf<char_type, traits_type>     __filebuf_type;\n      typedef __basic_file<char>\t\t        __file_type;\n      typedef typename traits_type::state_type          __state_type;\n      typedef codecvt<char_type, char, __state_type>    __codecvt_type;\n\n      friend class ios_base; // For sync_with_stdio.\n\n    protected:\n      // Data Members:\n      // MT lock inherited from libio or other low-level io library.\n      __c_lock          \t_M_lock;\n\n      // External buffer.\n      __file_type \t\t_M_file;\n\n      /**\n       *  @if maint\n       *  Place to stash in || out || in | out settings for current filebuf.\n       *  @endif\n      */\n      ios_base::openmode \t_M_mode;\n\n      // Beginning state type for codecvt.\n      __state_type \t\t_M_state_beg;\n\n      // During output, the state that corresponds to pptr(),\n      // during input, the state that corresponds to egptr() and\n      // _M_ext_next.\n      __state_type\t\t_M_state_cur;\n\n      // Not used for output. During input, the state that corresponds\n      // to eback() and _M_ext_buf.\n      __state_type\t\t_M_state_last;\n\n      /**\n       *  @if maint\n       *  Pointer to the beginning of internal buffer.\n       *  @endif\n      */\n      char_type*\t\t_M_buf; \t\n\n      /**\n       *  @if maint\n       *  Actual size of internal buffer. This number is equal to the size\n       *  of the put area + 1 position, reserved for the overflow char of\n       *  a full area.\n       *  @endif\n      */\n      size_t\t\t\t_M_buf_size;\n\n      // Set iff _M_buf is allocated memory from _M_allocate_internal_buffer.\n      bool\t\t\t_M_buf_allocated;\n\n      /**\n       *  @if maint\n       *  _M_reading == false && _M_writing == false for 'uncommitted' mode;  \n       *  _M_reading == true for 'read' mode;\n       *  _M_writing == true for 'write' mode;\n       *\n       *  NB: _M_reading == true && _M_writing == true is unused.\n       *  @endif\n      */ \n      bool                      _M_reading;\n      bool                      _M_writing;\n\n      //@{\n      /**\n       *  @if maint\n       *  Necessary bits for putback buffer management.\n       *\n       *  @note pbacks of over one character are not currently supported.\n       *  @endif\n      */\n      char_type\t\t\t_M_pback; \n      char_type*\t\t_M_pback_cur_save;\n      char_type*\t\t_M_pback_end_save;\n      bool\t\t\t_M_pback_init; \n      //@}\n\n      // Cached codecvt facet.\n      const __codecvt_type* \t_M_codecvt;\n\n      /**\n       *  @if maint\n       *  Buffer for external characters. Used for input when\n       *  codecvt::always_noconv() == false. When valid, this corresponds\n       *  to eback().\n       *  @endif\n      */ \n      char*\t\t\t_M_ext_buf;\n\n      /**\n       *  @if maint\n       *  Size of buffer held by _M_ext_buf.\n       *  @endif\n      */ \n      streamsize\t\t_M_ext_buf_size;\n\n      /**\n       *  @if maint\n       *  Pointers into the buffer held by _M_ext_buf that delimit a\n       *  subsequence of bytes that have been read but not yet converted.\n       *  When valid, _M_ext_next corresponds to egptr().\n       *  @endif\n      */ \n      const char*\t\t_M_ext_next;\n      char*\t\t\t_M_ext_end;\n\n      /**\n       *  @if maint\n       *  Initializes pback buffers, and moves normal buffers to safety.\n       *  Assumptions:\n       *  _M_in_cur has already been moved back\n       *  @endif\n      */\n      void\n      _M_create_pback()\n      {\n\tif (!_M_pback_init)\n\t  {\n\t    _M_pback_cur_save = this->gptr();\n\t    _M_pback_end_save = this->egptr();\n\t    this->setg(&_M_pback, &_M_pback, &_M_pback + 1);\n\t    _M_pback_init = true;\n\t  }\n      }\n\n      /**\n       *  @if maint\n       *  Deactivates pback buffer contents, and restores normal buffer.\n       *  Assumptions:\n       *  The pback buffer has only moved forward.\n       *  @endif\n      */ \n      void\n      _M_destroy_pback() throw()\n      {\n\tif (_M_pback_init)\n\t  {\n\t    // Length _M_in_cur moved in the pback buffer.\n\t    _M_pback_cur_save += this->gptr() != this->eback();\n\t    this->setg(_M_buf, _M_pback_cur_save, _M_pback_end_save);\n\t    _M_pback_init = false;\n\t  }\n      }\n\n    public:\n      // Constructors/destructor:\n      /**\n       *  @brief  Does not open any files.\n       *\n       *  The default constructor initializes the parent class using its\n       *  own default ctor.\n      */\n      basic_filebuf();\n\n      /**\n       *  @brief  The destructor closes the file first.\n      */\n      virtual\n      ~basic_filebuf()\n      { this->close(); }\n\n      // Members:\n      /**\n       *  @brief  Returns true if the external file is open.\n      */\n      bool\n      is_open() const throw()\n      { return _M_file.is_open(); }\n\n      /**\n       *  @brief  Opens an external file.\n       *  @param  s  The name of the file.\n       *  @param  mode  The open mode flags.\n       *  @return  @c this on success, NULL on failure\n       *\n       *  If a file is already open, this function immediately fails.\n       *  Otherwise it tries to open the file named @a s using the flags\n       *  given in @a mode.\n       *\n       *  Table 92, adapted here, gives the relation between openmode\n       *  combinations and the equivalent fopen() flags.\n       *  (NB: lines in|out|app and binary|in|out|app per DR 596)\n       *  +---------------------------------------------------------+\n       *  | ios_base Flag combination            stdio equivalent   |\n       *  |binary  in  out  trunc  app                              |\n       *  +---------------------------------------------------------+\n       *  |             +                        \"w\"                |\n       *  |             +           +            \"a\"                |\n       *  |             +     +                  \"w\"                |\n       *  |         +                            \"r\"                |\n       *  |         +   +                        \"r+\"               |\n       *  |         +   +     +                  \"w+\"               |\n       *  |         +   +           +            \"a+\"               |\n       *  +---------------------------------------------------------+\n       *  |   +         +                        \"wb\"               |\n       *  |   +         +           +            \"ab\"               |\n       *  |   +         +     +                  \"wb\"               |\n       *  |   +     +                            \"rb\"               |\n       *  |   +     +   +                        \"r+b\"              |\n       *  |   +     +   +     +                  \"w+b\"              |\n       *  |   +     +   +           +            \"a+b\"              |\n       *  +---------------------------------------------------------+\n       */\n      __filebuf_type*\n      open(const char* __s, ios_base::openmode __mode);\n\n      /**\n       *  @brief  Closes the currently associated file.\n       *  @return  @c this on success, NULL on failure\n       *\n       *  If no file is currently open, this function immediately fails.\n       *\n       *  If a \"put buffer area\" exists, @c overflow(eof) is called to flush\n       *  all the characters.  The file is then closed.\n       *\n       *  If any operations fail, this function also fails.\n      */\n      __filebuf_type*\n      close() throw();\n\n    protected:\n      void\n      _M_allocate_internal_buffer();\n\n      void\n      _M_destroy_internal_buffer() throw();\n\n      // [27.8.1.4] overridden virtual functions\n      virtual streamsize\n      showmanyc();\n\n      // Stroustrup, 1998, p. 628\n      // underflow() and uflow() functions are called to get the next\n      // charater from the real input source when the buffer is empty.\n      // Buffered input uses underflow()\n\n      virtual int_type\n      underflow();\n\n      virtual int_type\n      pbackfail(int_type __c = _Traits::eof());\n\n      // Stroustrup, 1998, p 648\n      // The overflow() function is called to transfer characters to the\n      // real output destination when the buffer is full. A call to\n      // overflow(c) outputs the contents of the buffer plus the\n      // character c.\n      // 27.5.2.4.5\n      // Consume some sequence of the characters in the pending sequence.\n      virtual int_type\n      overflow(int_type __c = _Traits::eof());\n\n      // Convert internal byte sequence to external, char-based\n      // sequence via codecvt.\n      bool\n      _M_convert_to_external(char_type*, streamsize);\n\n      /**\n       *  @brief  Manipulates the buffer.\n       *  @param  s  Pointer to a buffer area.\n       *  @param  n  Size of @a s.\n       *  @return  @c this\n       *\n       *  If no file has been opened, and both @a s and @a n are zero, then\n       *  the stream becomes unbuffered.  Otherwise, @c s is used as a\n       *  buffer; see\n       *  http://gcc.gnu.org/onlinedocs/libstdc++/27_io/howto.html#2\n       *  for more.\n      */\n      virtual __streambuf_type*\n      setbuf(char_type* __s, streamsize __n);\n\n      virtual pos_type\n      seekoff(off_type __off, ios_base::seekdir __way,\n\t      ios_base::openmode __mode = ios_base::in | ios_base::out);\n\n      virtual pos_type\n      seekpos(pos_type __pos,\n\t      ios_base::openmode __mode = ios_base::in | ios_base::out);\n\n      // Common code for seekoff and seekpos\n      pos_type\n      _M_seek(off_type __off, ios_base::seekdir __way, __state_type __state);\n\n      virtual int\n      sync();\n\n      virtual void\n      imbue(const locale& __loc);\n\n      virtual streamsize\n      xsgetn(char_type* __s, streamsize __n);\n\n      virtual streamsize\n      xsputn(const char_type* __s, streamsize __n);\n\n      // Flushes output buffer, then writes unshift sequence.\n      bool\n      _M_terminate_output();\n\n      /**\n       *  @if maint \n       *  This function sets the pointers of the internal buffer, both get\n       *  and put areas. Typically:\n       *\n       *   __off == egptr() - eback() upon underflow/uflow ('read' mode);\n       *   __off == 0 upon overflow ('write' mode);\n       *   __off == -1 upon open, setbuf, seekoff/pos ('uncommitted' mode).\n       * \n       *  NB: epptr() - pbase() == _M_buf_size - 1, since _M_buf_size\n       *  reflects the actual allocated memory and the last cell is reserved\n       *  for the overflow char of a full put area.\n       *  @endif\n      */\n      void\n      _M_set_buffer(streamsize __off)\n      {\n \tconst bool __testin = _M_mode & ios_base::in;\n \tconst bool __testout = _M_mode & ios_base::out;\n\t\n\tif (__testin && __off > 0)\n\t  this->setg(_M_buf, _M_buf, _M_buf + __off);\n\telse\n\t  this->setg(_M_buf, _M_buf, _M_buf);\n\n\tif (__testout && __off == 0 && _M_buf_size > 1 )\n\t  this->setp(_M_buf, _M_buf + _M_buf_size - 1);\n\telse\n\t  this->setp(NULL, NULL);\n      }\n    };\n\n  // [27.8.1.5] Template class basic_ifstream\n  /**\n   *  @brief  Controlling input for files.\n   *\n   *  This class supports reading from named files, using the inherited\n   *  functions from std::basic_istream.  To control the associated\n   *  sequence, an instance of std::basic_filebuf is used, which this page\n   *  refers to as @c sb.\n  */\n  template<typename _CharT, typename _Traits>\n    class basic_ifstream : public basic_istream<_CharT, _Traits>\n    {\n    public:\n      // Types:\n      typedef _CharT \t\t\t\t\tchar_type;\n      typedef _Traits \t\t\t\t\ttraits_type;\n      typedef typename traits_type::int_type \t\tint_type;\n      typedef typename traits_type::pos_type \t\tpos_type;\n      typedef typename traits_type::off_type \t\toff_type;\n\n      // Non-standard types:\n      typedef basic_filebuf<char_type, traits_type> \t__filebuf_type;\n      typedef basic_istream<char_type, traits_type>\t__istream_type;\n\n    private:\n      __filebuf_type\t_M_filebuf;\n\n    public:\n      // Constructors/Destructors:\n      /**\n       *  @brief  Default constructor.\n       *\n       *  Initializes @c sb using its default constructor, and passes\n       *  @c &sb to the base class initializer.  Does not open any files\n       *  (you haven't given it a filename to open).\n      */\n      basic_ifstream() : __istream_type(), _M_filebuf()\n      { this->init(&_M_filebuf); }\n\n      /**\n       *  @brief  Create an input file stream.\n       *  @param  s  Null terminated string specifying the filename.\n       *  @param  mode  Open file in specified mode (see std::ios_base).\n       *\n       *  @c ios_base::in is automatically included in @a mode.\n       *\n       *  Tip:  When using std::string to hold the filename, you must use\n       *  .c_str() before passing it to this constructor.\n      */\n      explicit\n      basic_ifstream(const char* __s, ios_base::openmode __mode = ios_base::in)\n      : __istream_type(), _M_filebuf()\n      {\n\tthis->init(&_M_filebuf);\n\tthis->open(__s, __mode);\n      }\n\n      /**\n       *  @brief  The destructor does nothing.\n       *\n       *  The file is closed by the filebuf object, not the formatting\n       *  stream.\n      */\n      ~basic_ifstream()\n      { }\n\n      // Members:\n      /**\n       *  @brief  Accessing the underlying buffer.\n       *  @return  The current basic_filebuf buffer.\n       *\n       *  This hides both signatures of std::basic_ios::rdbuf().\n      */\n      __filebuf_type*\n      rdbuf() const\n      { return const_cast<__filebuf_type*>(&_M_filebuf); }\n\n      /**\n       *  @brief  Wrapper to test for an open file.\n       *  @return  @c rdbuf()->is_open()\n      */\n      bool\n      is_open()\n      { return _M_filebuf.is_open(); }\n\n      // _GLIBCXX_RESOLVE_LIB_DEFECTS\n      // 365. Lack of const-qualification in clause 27\n      bool\n      is_open() const\n      { return _M_filebuf.is_open(); }\n\n      /**\n       *  @brief  Opens an external file.\n       *  @param  s  The name of the file.\n       *  @param  mode  The open mode flags.\n       *\n       *  Calls @c std::basic_filebuf::open(s,mode|in).  If that function\n       *  fails, @c failbit is set in the stream's error state.\n       *\n       *  Tip:  When using std::string to hold the filename, you must use\n       *  .c_str() before passing it to this constructor.\n      */\n      void\n      open(const char* __s, ios_base::openmode __mode = ios_base::in)\n      {\n\tif (!_M_filebuf.open(__s, __mode | ios_base::in))\n\t  this->setstate(ios_base::failbit);\n\telse\n\t  // _GLIBCXX_RESOLVE_LIB_DEFECTS\n\t  // 409. Closing an fstream should clear error state\n\t  this->clear();\n      }\n\n      /**\n       *  @brief  Close the file.\n       *\n       *  Calls @c std::basic_filebuf::close().  If that function\n       *  fails, @c failbit is set in the stream's error state.\n      */\n      void\n      close()\n      {\n\tif (!_M_filebuf.close())\n\t  this->setstate(ios_base::failbit);\n      }\n    };\n\n\n  // [27.8.1.8] Template class basic_ofstream\n  /**\n   *  @brief  Controlling output for files.\n   *\n   *  This class supports reading from named files, using the inherited\n   *  functions from std::basic_ostream.  To control the associated\n   *  sequence, an instance of std::basic_filebuf is used, which this page\n   *  refers to as @c sb.\n  */\n  template<typename _CharT, typename _Traits>\n    class basic_ofstream : public basic_ostream<_CharT,_Traits>\n    {\n    public:\n      // Types:\n      typedef _CharT \t\t\t\t\tchar_type;\n      typedef _Traits \t\t\t\t\ttraits_type;\n      typedef typename traits_type::int_type \t\tint_type;\n      typedef typename traits_type::pos_type \t\tpos_type;\n      typedef typename traits_type::off_type \t\toff_type;\n\n      // Non-standard types:\n      typedef basic_filebuf<char_type, traits_type> \t__filebuf_type;\n      typedef basic_ostream<char_type, traits_type>\t__ostream_type;\n\n    private:\n      __filebuf_type\t_M_filebuf;\n\n    public:\n      // Constructors:\n      /**\n       *  @brief  Default constructor.\n       *\n       *  Initializes @c sb using its default constructor, and passes\n       *  @c &sb to the base class initializer.  Does not open any files\n       *  (you haven't given it a filename to open).\n      */\n      basic_ofstream(): __ostream_type(), _M_filebuf()\n      { this->init(&_M_filebuf); }\n\n      /**\n       *  @brief  Create an output file stream.\n       *  @param  s  Null terminated string specifying the filename.\n       *  @param  mode  Open file in specified mode (see std::ios_base).\n       *\n       *  @c ios_base::out|ios_base::trunc is automatically included in\n       *  @a mode.\n       *\n       *  Tip:  When using std::string to hold the filename, you must use\n       *  .c_str() before passing it to this constructor.\n      */\n      explicit\n      basic_ofstream(const char* __s,\n\t\t     ios_base::openmode __mode = ios_base::out|ios_base::trunc)\n      : __ostream_type(), _M_filebuf()\n      {\n\tthis->init(&_M_filebuf);\n\tthis->open(__s, __mode);\n      }\n\n      /**\n       *  @brief  The destructor does nothing.\n       *\n       *  The file is closed by the filebuf object, not the formatting\n       *  stream.\n      */\n      ~basic_ofstream()\n      { }\n\n      // Members:\n      /**\n       *  @brief  Accessing the underlying buffer.\n       *  @return  The current basic_filebuf buffer.\n       *\n       *  This hides both signatures of std::basic_ios::rdbuf().\n      */\n      __filebuf_type*\n      rdbuf() const\n      { return const_cast<__filebuf_type*>(&_M_filebuf); }\n\n      /**\n       *  @brief  Wrapper to test for an open file.\n       *  @return  @c rdbuf()->is_open()\n      */\n      bool\n      is_open()\n      { return _M_filebuf.is_open(); }\n\n      // _GLIBCXX_RESOLVE_LIB_DEFECTS\n      // 365. Lack of const-qualification in clause 27\n      bool\n      is_open() const\n      { return _M_filebuf.is_open(); }\n\n      /**\n       *  @brief  Opens an external file.\n       *  @param  s  The name of the file.\n       *  @param  mode  The open mode flags.\n       *\n       *  Calls @c std::basic_filebuf::open(s,mode|out|trunc).  If that\n       *  function fails, @c failbit is set in the stream's error state.\n       *\n       *  Tip:  When using std::string to hold the filename, you must use\n       *  .c_str() before passing it to this constructor.\n      */\n      void\n      open(const char* __s,\n\t   ios_base::openmode __mode = ios_base::out | ios_base::trunc)\n      {\n\tif (!_M_filebuf.open(__s, __mode | ios_base::out))\n\t  this->setstate(ios_base::failbit);\n\telse\n\t  // _GLIBCXX_RESOLVE_LIB_DEFECTS\n\t  // 409. Closing an fstream should clear error state\n\t  this->clear();\n      }\n\n      /**\n       *  @brief  Close the file.\n       *\n       *  Calls @c std::basic_filebuf::close().  If that function\n       *  fails, @c failbit is set in the stream's error state.\n      */\n      void\n      close()\n      {\n\tif (!_M_filebuf.close())\n\t  this->setstate(ios_base::failbit);\n      }\n    };\n\n\n  // [27.8.1.11] Template class basic_fstream\n  /**\n   *  @brief  Controlling intput and output for files.\n   *\n   *  This class supports reading from and writing to named files, using\n   *  the inherited functions from std::basic_iostream.  To control the\n   *  associated sequence, an instance of std::basic_filebuf is used, which\n   *  this page refers to as @c sb.\n  */\n  template<typename _CharT, typename _Traits>\n    class basic_fstream : public basic_iostream<_CharT, _Traits>\n    {\n    public:\n      // Types:\n      typedef _CharT \t\t\t\t\tchar_type;\n      typedef _Traits \t\t\t\t\ttraits_type;\n      typedef typename traits_type::int_type \t\tint_type;\n      typedef typename traits_type::pos_type \t\tpos_type;\n      typedef typename traits_type::off_type \t\toff_type;\n\n      // Non-standard types:\n      typedef basic_filebuf<char_type, traits_type> \t__filebuf_type;\n      typedef basic_ios<char_type, traits_type>\t\t__ios_type;\n      typedef basic_iostream<char_type, traits_type>\t__iostream_type;\n\n    private:\n      __filebuf_type\t_M_filebuf;\n\n    public:\n      // Constructors/destructor:\n      /**\n       *  @brief  Default constructor.\n       *\n       *  Initializes @c sb using its default constructor, and passes\n       *  @c &sb to the base class initializer.  Does not open any files\n       *  (you haven't given it a filename to open).\n      */\n      basic_fstream()\n      : __iostream_type(), _M_filebuf()\n      { this->init(&_M_filebuf); }\n\n      /**\n       *  @brief  Create an input/output file stream.\n       *  @param  s  Null terminated string specifying the filename.\n       *  @param  mode  Open file in specified mode (see std::ios_base).\n       *\n       *  Tip:  When using std::string to hold the filename, you must use\n       *  .c_str() before passing it to this constructor.\n      */\n      explicit\n      basic_fstream(const char* __s,\n\t\t    ios_base::openmode __mode = ios_base::in | ios_base::out)\n      : __iostream_type(NULL), _M_filebuf()\n      {\n\tthis->init(&_M_filebuf);\n\tthis->open(__s, __mode);\n      }\n\n      /**\n       *  @brief  The destructor does nothing.\n       *\n       *  The file is closed by the filebuf object, not the formatting\n       *  stream.\n      */\n      ~basic_fstream()\n      { }\n\n      // Members:\n      /**\n       *  @brief  Accessing the underlying buffer.\n       *  @return  The current basic_filebuf buffer.\n       *\n       *  This hides both signatures of std::basic_ios::rdbuf().\n      */\n      __filebuf_type*\n      rdbuf() const\n      { return const_cast<__filebuf_type*>(&_M_filebuf); }\n\n      /**\n       *  @brief  Wrapper to test for an open file.\n       *  @return  @c rdbuf()->is_open()\n      */\n      bool\n      is_open()\n      { return _M_filebuf.is_open(); }\n\n      // _GLIBCXX_RESOLVE_LIB_DEFECTS\n      // 365. Lack of const-qualification in clause 27\n      bool\n      is_open() const\n      { return _M_filebuf.is_open(); }\n\n      /**\n       *  @brief  Opens an external file.\n       *  @param  s  The name of the file.\n       *  @param  mode  The open mode flags.\n       *\n       *  Calls @c std::basic_filebuf::open(s,mode).  If that\n       *  function fails, @c failbit is set in the stream's error state.\n       *\n       *  Tip:  When using std::string to hold the filename, you must use\n       *  .c_str() before passing it to this constructor.\n      */\n      void\n      open(const char* __s,\n\t   ios_base::openmode __mode = ios_base::in | ios_base::out)\n      {\n\tif (!_M_filebuf.open(__s, __mode))\n\t  this->setstate(ios_base::failbit);\n\telse\n\t  // _GLIBCXX_RESOLVE_LIB_DEFECTS\n\t  // 409. Closing an fstream should clear error state\n\t  this->clear();\n      }\n\n      /**\n       *  @brief  Close the file.\n       *\n       *  Calls @c std::basic_filebuf::close().  If that function\n       *  fails, @c failbit is set in the stream's error state.\n      */\n      void\n      close()\n      {\n\tif (!_M_filebuf.close())\n\t  this->setstate(ios_base::failbit);\n      }\n    };\n\n_GLIBCXX_END_NAMESPACE\n\n#ifndef _GLIBCXX_EXPORT_TEMPLATE\n# include <bits/fstream.tcc>\n#endif\n\n#endif /* _GLIBCXX_FSTREAM */\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/functional",
    "content": "// <functional> -*- C++ -*-\n\n// Copyright (C) 2001, 2002 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n/*\n * Copyright (c) 1997\n * Silicon Graphics Computer Systems, Inc.\n *\n * Permission to use, copy, modify, distribute and sell this software\n * and its documentation for any purpose is hereby granted without fee,\n * provided that the above copyright notice appear in all copies and\n * that both that copyright notice and this permission notice appear\n * in supporting documentation.  Silicon Graphics makes no\n * representations about the suitability of this software for any\n * purpose.  It is provided \"as is\" without express or implied warranty.\n *\n */\n\n/** @file include/functional\n *  This is a Standard C++ Library header.\n */\n\n#ifndef _GLIBCXX_FUNCTIONAL\n#define _GLIBCXX_FUNCTIONAL 1\n\n#pragma GCC system_header\n\n#include <bits/c++config.h>\n#include <cstddef>\n#include <bits/stl_function.h>\n\n#endif /* _GLIBCXX_FUNCTIONAL */\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/iomanip",
    "content": "// Standard stream manipulators -*- C++ -*-\n\n// Copyright (C) 1997, 1998, 1999, 2001, 2002, 2003, 2005\n// Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n/** @file iomanip\n *  This is a Standard C++ Library header.\n */\n\n//\n// ISO C++ 14882: 27.6.3  Standard manipulators\n//\n\n#ifndef _GLIBCXX_IOMANIP\n#define _GLIBCXX_IOMANIP 1\n\n#pragma GCC system_header\n\n#include <bits/c++config.h>\n#include <istream>\n#include <functional>\n\n_GLIBCXX_BEGIN_NAMESPACE(std)\n\n  // [27.6.3] standard manipulators\n  // Also see DR 183.\n\n  struct _Resetiosflags { ios_base::fmtflags _M_mask; };\n\n  /**\n   *  @brief  Manipulator for @c setf.\n   *  @param  mask  A format flags mask.\n   *\n   *  Sent to a stream object, this manipulator resets the specified flags,\n   *  via @e stream.setf(0,mask).\n  */\n  inline _Resetiosflags \n  resetiosflags(ios_base::fmtflags __mask)\n  { \n    _Resetiosflags __x; \n    __x._M_mask = __mask; \n    return __x; \n  }\n\n  template<typename _CharT, typename _Traits>\n    inline basic_istream<_CharT,_Traits>& \n    operator>>(basic_istream<_CharT,_Traits>& __is, _Resetiosflags __f)\n    { \n      __is.setf(ios_base::fmtflags(0), __f._M_mask); \n      return __is; \n    }\n\n  template<typename _CharT, typename _Traits>\n    inline basic_ostream<_CharT,_Traits>& \n    operator<<(basic_ostream<_CharT,_Traits>& __os, _Resetiosflags __f)\n    { \n      __os.setf(ios_base::fmtflags(0), __f._M_mask); \n      return __os; \n    }\n\n\n  struct _Setiosflags { ios_base::fmtflags _M_mask; };\n\n  /**\n   *  @brief  Manipulator for @c setf.\n   *  @param  mask  A format flags mask.\n   *\n   *  Sent to a stream object, this manipulator sets the format flags\n   *  to @a mask.\n  */\n  inline _Setiosflags \n  setiosflags(ios_base::fmtflags __mask)\n  { \n    _Setiosflags __x; \n    __x._M_mask = __mask; \n    return __x; \n  }\n\n  template<typename _CharT, typename _Traits>\n    inline basic_istream<_CharT,_Traits>& \n    operator>>(basic_istream<_CharT,_Traits>& __is, _Setiosflags __f)\n    { \n      __is.setf(__f._M_mask); \n      return __is; \n    }\n\n  template<typename _CharT, typename _Traits>\n    inline basic_ostream<_CharT,_Traits>& \n    operator<<(basic_ostream<_CharT,_Traits>& __os, _Setiosflags __f)\n    { \n      __os.setf(__f._M_mask); \n      return __os; \n    }\n\n\n  struct _Setbase { int _M_base; };\n\n  /**\n   *  @brief  Manipulator for @c setf.\n   *  @param  base  A numeric base.\n   *\n   *  Sent to a stream object, this manipulator changes the\n   *  @c ios_base::basefield flags to @c oct, @c dec, or @c hex when @a base\n   *  is 8, 10, or 16, accordingly, and to 0 if @a base is any other value.\n  */\n  inline _Setbase \n  setbase(int __base)\n  { \n    _Setbase __x; \n    __x._M_base = __base; \n    return __x; \n  }\n\n  template<typename _CharT, typename _Traits>\n    inline basic_istream<_CharT,_Traits>& \n    operator>>(basic_istream<_CharT,_Traits>& __is, _Setbase __f)\n    {\n      __is.setf(__f._M_base ==  8 ? ios_base::oct : \n\t      __f._M_base == 10 ? ios_base::dec : \n\t      __f._M_base == 16 ? ios_base::hex : \n\t      ios_base::fmtflags(0), ios_base::basefield);\n      return __is; \n    }\n  \n  template<typename _CharT, typename _Traits>\n    inline basic_ostream<_CharT,_Traits>& \n    operator<<(basic_ostream<_CharT,_Traits>& __os, _Setbase __f)\n    {\n      __os.setf(__f._M_base ==  8 ? ios_base::oct : \n\t\t__f._M_base == 10 ? ios_base::dec : \n\t\t__f._M_base == 16 ? ios_base::hex : \n\t\tios_base::fmtflags(0), ios_base::basefield);\n      return __os; \n    }\n  \n\n  template<typename _CharT> \n    struct _Setfill { _CharT _M_c; };\n\n  /**\n   *  @brief  Manipulator for @c fill.\n   *  @param  c  The new fill character.\n   *\n   *  Sent to a stream object, this manipulator calls @c fill(c) for that\n   *  object.\n  */\n  template<typename _CharT> \n    inline _Setfill<_CharT> \n    setfill(_CharT __c)\n    { \n      _Setfill<_CharT> __x; \n      __x._M_c = __c; \n      return __x; \n    }\n\n  template<typename _CharT, typename _Traits>\n    inline basic_istream<_CharT,_Traits>& \n    operator>>(basic_istream<_CharT,_Traits>& __is, _Setfill<_CharT> __f)\n    { \n      __is.fill(__f._M_c); \n      return __is; \n    }\n\n  template<typename _CharT, typename _Traits>\n    inline basic_ostream<_CharT,_Traits>& \n    operator<<(basic_ostream<_CharT,_Traits>& __os, _Setfill<_CharT> __f)\n    { \n      __os.fill(__f._M_c); \n      return __os; \n    }\n\n\n  struct _Setprecision { int _M_n; };\n\n  /**\n   *  @brief  Manipulator for @c precision.\n   *  @param  n  The new precision.\n   *\n   *  Sent to a stream object, this manipulator calls @c precision(n) for\n   *  that object.\n  */\n  inline _Setprecision \n  setprecision(int __n)\n  { \n    _Setprecision __x; \n    __x._M_n = __n; \n    return __x; \n  }\n\n  template<typename _CharT, typename _Traits>\n    inline basic_istream<_CharT,_Traits>& \n    operator>>(basic_istream<_CharT,_Traits>& __is, _Setprecision __f)\n    { \n      __is.precision(__f._M_n); \n      return __is; \n    }\n\n  template<typename _CharT, typename _Traits>\n    inline basic_ostream<_CharT,_Traits>& \n    operator<<(basic_ostream<_CharT,_Traits>& __os, _Setprecision __f)\n    { \n      __os.precision(__f._M_n); \n      return __os; \n    }\n\n\n  struct _Setw { int _M_n; };\n\n  /**\n   *  @brief  Manipulator for @c width.\n   *  @param  n  The new width.\n   *\n   *  Sent to a stream object, this manipulator calls @c width(n) for\n   *  that object.\n  */\n  inline _Setw \n  setw(int __n)\n  { \n    _Setw __x; \n    __x._M_n = __n; \n    return __x; \n  }\n\n  template<typename _CharT, typename _Traits>\n    inline basic_istream<_CharT,_Traits>& \n    operator>>(basic_istream<_CharT,_Traits>& __is, _Setw __f)\n    { \n      __is.width(__f._M_n); \n      return __is; \n    }\n\n  template<typename _CharT, typename _Traits>\n    inline basic_ostream<_CharT,_Traits>& \n    operator<<(basic_ostream<_CharT,_Traits>& __os, _Setw __f)\n    { \n      __os.width(__f._M_n); \n      return __os; \n    }\n\n  // Inhibit implicit instantiations for required instantiations,\n  // which are defined via explicit instantiations elsewhere.  \n  // NB:  This syntax is a GNU extension.\n#if _GLIBCXX_EXTERN_TEMPLATE\n  extern template ostream& operator<<(ostream&, _Setfill<char>);\n  extern template ostream& operator<<(ostream&, _Setiosflags);\n  extern template ostream& operator<<(ostream&, _Resetiosflags);\n  extern template ostream& operator<<(ostream&, _Setbase);\n  extern template ostream& operator<<(ostream&, _Setprecision);\n  extern template ostream& operator<<(ostream&, _Setw);\n  extern template istream& operator>>(istream&, _Setfill<char>);\n  extern template istream& operator>>(istream&, _Setiosflags);\n  extern template istream& operator>>(istream&, _Resetiosflags);\n  extern template istream& operator>>(istream&, _Setbase);\n  extern template istream& operator>>(istream&, _Setprecision);\n  extern template istream& operator>>(istream&, _Setw);\n\n#ifdef _GLIBCXX_USE_WCHAR_T\n  extern template wostream& operator<<(wostream&, _Setfill<wchar_t>);\n  extern template wostream& operator<<(wostream&, _Setiosflags);\n  extern template wostream& operator<<(wostream&, _Resetiosflags);\n  extern template wostream& operator<<(wostream&, _Setbase);\n  extern template wostream& operator<<(wostream&, _Setprecision);\n  extern template wostream& operator<<(wostream&, _Setw);\n  extern template wistream& operator>>(wistream&, _Setfill<wchar_t>);\n  extern template wistream& operator>>(wistream&, _Setiosflags);\n  extern template wistream& operator>>(wistream&, _Resetiosflags);\n  extern template wistream& operator>>(wistream&, _Setbase);\n  extern template wistream& operator>>(wistream&, _Setprecision);\n  extern template wistream& operator>>(wistream&, _Setw);\n#endif\n#endif\n\n_GLIBCXX_END_NAMESPACE\n\n#endif /* _GLIBCXX_IOMANIP */\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ios",
    "content": "// Iostreams base classes -*- C++ -*-\n\n// Copyright (C) 1997, 1998, 1999, 2001, 2002 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n/** @file ios\n *  This is a Standard C++ Library header.\n */\n\n//\n// ISO C++ 14882: 27.4  Iostreams base classes\n//\n\n#ifndef _GLIBCXX_IOS\n#define _GLIBCXX_IOS 1\n\n#pragma GCC system_header\n\n#include <iosfwd>\n#include <exception> \t\t// For ios_base::failure\n#include <bits/char_traits.h> \t// For char_traits, streamoff, streamsize, fpos\n#include <cstdio> \t// For SEEK_SET, SEEK_CUR, SEEK_END\n#include <bits/localefwd.h>\t// For class locale\n#include <bits/ios_base.h>\t// For ios_base declarations.\n#include <streambuf> \n#include <bits/basic_ios.h>\n\n#endif\t/* _GLIBCXX_IOS */\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/iosfwd",
    "content": "// Forwarding declarations -*- C++ -*-\n\n// Copyright (C) 1997, 1998, 1999, 2001, 2002, 2003, 2005\n// Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n/** @file iosfwd\n *  This is a Standard C++ Library header.\n */\n\n//\n// ISO C++ 14882: 27.2  Forward declarations\n//\n\n#ifndef _GLIBCXX_IOSFWD\n#define _GLIBCXX_IOSFWD 1\n\n#pragma GCC system_header\n\n#include <bits/c++config.h>\n#include <bits/c++locale.h> \n#include <bits/c++io.h> \n#include <cctype>\t\t// For isspace, etc.\n#include <bits/stringfwd.h> \t// For string forward declarations.\n#include <bits/postypes.h>\n#include <bits/functexcept.h>\n\n_GLIBCXX_BEGIN_NAMESPACE(std)\n\n  template<typename _CharT, typename _Traits = char_traits<_CharT> >\n    class basic_ios;\n\n  template<typename _CharT, typename _Traits = char_traits<_CharT> >\n    class basic_streambuf;\n\n  template<typename _CharT, typename _Traits = char_traits<_CharT> >\n    class basic_istream;\n\n  template<typename _CharT, typename _Traits = char_traits<_CharT> >\n    class basic_ostream;\n\n  template<typename _CharT, typename _Traits = char_traits<_CharT> >\n    class basic_iostream;\n\n  template<typename _CharT, typename _Traits = char_traits<_CharT>,\n\t    typename _Alloc = allocator<_CharT> >\n    class basic_stringbuf;\n\n  template<typename _CharT, typename _Traits = char_traits<_CharT>,\n\t   typename _Alloc = allocator<_CharT> >\n    class basic_istringstream;\n\n  template<typename _CharT, typename _Traits = char_traits<_CharT>,\n\t   typename _Alloc = allocator<_CharT> >\n    class basic_ostringstream;\n\n  template<typename _CharT, typename _Traits = char_traits<_CharT>,\n\t   typename _Alloc = allocator<_CharT> >\n    class basic_stringstream;\n\n  template<typename _CharT, typename _Traits = char_traits<_CharT> >\n    class basic_filebuf;\n\n  template<typename _CharT, typename _Traits = char_traits<_CharT> >\n    class basic_ifstream;\n\n  template<typename _CharT, typename _Traits = char_traits<_CharT> >\n    class basic_ofstream;\n\n  template<typename _CharT, typename _Traits = char_traits<_CharT> >\n    class basic_fstream;\n\n  template<typename _CharT, typename _Traits = char_traits<_CharT> >\n    class istreambuf_iterator;\n\n  template<typename _CharT, typename _Traits = char_traits<_CharT> >\n    class ostreambuf_iterator;\n\n  // _GLIBCXX_RESOLVE_LIB_DEFECTS\n  // Not included.   (??? Apparently no LWG number?)\n  class ios_base; \n\n  /** \n   *  @defgroup s27_2_iosfwd I/O Forward Declarations\n   *\n   *  Nearly all of the I/O classes are parameterized on the type of\n   *  characters they read and write.  (The major exception is ios_base at\n   *  the top of the hierarchy.)  This is a change from pre-Standard\n   *  streams, which were not templates.\n   *\n   *  For ease of use and compatibility, all of the basic_* I/O-related\n   *  classes are given typedef names for both of the builtin character\n   *  widths (wide and narrow).  The typedefs are the same as the\n   *  pre-Standard names, for example:\n   *\n   *  @code\n   *     typedef basic_ifstream<char>  ifstream;\n   *  @endcode\n   *\n   *  Because properly forward-declaring these classes can be difficult, you\n   *  should not do it yourself.  Instead, include the &lt;iosfwd&gt;\n   *  header, which contains only declarations of all the I/O classes as\n   *  well as the typedefs.  Trying to forward-declare the typedefs\n   *  themselves (e.g., \"class ostream;\") is not valid ISO C++.\n   *\n   *  For more specific declarations, see\n   *  http://gcc.gnu.org/onlinedocs/libstdc++/27_io/howto.html#10\n   *\n   *  @{\n  */\n  typedef basic_ios<char> \t\tios;\t\t///< @isiosfwd\n  typedef basic_streambuf<char> \tstreambuf;\t///< @isiosfwd\n  typedef basic_istream<char> \t\tistream;\t///< @isiosfwd\n  typedef basic_ostream<char> \t\tostream;\t///< @isiosfwd\n  typedef basic_iostream<char> \t\tiostream;\t///< @isiosfwd\n  typedef basic_stringbuf<char> \tstringbuf;\t///< @isiosfwd\n  typedef basic_istringstream<char> \tistringstream;\t///< @isiosfwd\n  typedef basic_ostringstream<char> \tostringstream;\t///< @isiosfwd\n  typedef basic_stringstream<char> \tstringstream;\t///< @isiosfwd\n  typedef basic_filebuf<char> \t\tfilebuf;\t///< @isiosfwd\n  typedef basic_ifstream<char> \t\tifstream;\t///< @isiosfwd\n  typedef basic_ofstream<char> \t\tofstream;\t///< @isiosfwd\n  typedef basic_fstream<char> \t\tfstream;\t///< @isiosfwd\n\n#ifdef _GLIBCXX_USE_WCHAR_T\n  typedef basic_ios<wchar_t> \t\twios;\t\t///< @isiosfwd\n  typedef basic_streambuf<wchar_t> \twstreambuf;\t///< @isiosfwd\n  typedef basic_istream<wchar_t> \twistream;\t///< @isiosfwd\n  typedef basic_ostream<wchar_t> \twostream;\t///< @isiosfwd\n  typedef basic_iostream<wchar_t> \twiostream;\t///< @isiosfwd\n  typedef basic_stringbuf<wchar_t> \twstringbuf;\t///< @isiosfwd\n  typedef basic_istringstream<wchar_t> \twistringstream;\t///< @isiosfwd\n  typedef basic_ostringstream<wchar_t> \twostringstream;\t///< @isiosfwd\n  typedef basic_stringstream<wchar_t> \twstringstream;\t///< @isiosfwd\n  typedef basic_filebuf<wchar_t> \twfilebuf;\t///< @isiosfwd\n  typedef basic_ifstream<wchar_t> \twifstream;\t///< @isiosfwd\n  typedef basic_ofstream<wchar_t> \twofstream;\t///< @isiosfwd\n  typedef basic_fstream<wchar_t> \twfstream;\t///< @isiosfwd\n#endif\n  /** @}  */\n\n_GLIBCXX_END_NAMESPACE\n\n#endif /* _GLIBCXX_IOSFWD */\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/iostream",
    "content": "// Standard iostream objects -*- C++ -*-\n\n// Copyright (C) 1997, 1998, 1999, 2001, 2002, 2005\n// Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n/** @file iostream\n *  This is a Standard C++ Library header. \n */\n\n//\n// ISO C++ 14882: 27.3  Standard iostream objects\n//\n\n#ifndef _GLIBCXX_IOSTREAM\n#define _GLIBCXX_IOSTREAM 1\n\n#pragma GCC system_header\n\n#include <bits/c++config.h>\n#include <ostream>\n#include <istream>\n\n_GLIBCXX_BEGIN_NAMESPACE(std)\n\n  /**\n   *  @name Standard Stream Objects\n   *\n   *  The &lt;iostream&gt; header declares the eight <em>standard stream\n   *  objects</em>.  For other declarations, see\n   *  http://gcc.gnu.org/onlinedocs/libstdc++/27_io/howto.html#10 and the\n   *  @link s27_2_iosfwd I/O forward declarations @endlink\n   *\n   *  They are required by default to cooperate with the global C library's\n   *  @c FILE streams, and to be available during program startup and\n   *  termination.  For more information, see the HOWTO linked to above.\n  */\n  //@{\n  extern istream cin;\t\t///< Linked to standard input\n  extern ostream cout;\t\t///< Linked to standard output\n  extern ostream cerr;\t\t///< Linked to standard error (unbuffered)\n  extern ostream clog;\t\t///< Linked to standard error (buffered)\n\n#ifdef _GLIBCXX_USE_WCHAR_T\n  extern wistream wcin;\t\t///< Linked to standard input\n  extern wostream wcout;\t///< Linked to standard output\n  extern wostream wcerr;\t///< Linked to standard error (unbuffered)\n  extern wostream wclog;\t///< Linked to standard error (buffered)\n#endif\n  //@}\n\n  // For construction of filebuffers for cout, cin, cerr, clog et. al.\n  static ios_base::Init __ioinit;\n\n_GLIBCXX_END_NAMESPACE\n\n#endif /* _GLIBCXX_IOSTREAM */\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/istream",
    "content": "// Input streams -*- C++ -*-\n\n// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006\n// Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n//\n// ISO C++ 14882: 27.6.1  Input streams\n//\n\n/** @file istream\n *  This is a Standard C++ Library header.\n */\n\n#ifndef _GLIBCXX_ISTREAM\n#define _GLIBCXX_ISTREAM 1\n\n#pragma GCC system_header\n\n#include <ios>\n#include <limits> // For numeric_limits\n\n_GLIBCXX_BEGIN_NAMESPACE(std)\n\n  // [27.6.1.1] Template class basic_istream\n  /**\n   *  @brief  Controlling input.\n   *\n   *  This is the base class for all input streams.  It provides text\n   *  formatting of all builtin types, and communicates with any class\n   *  derived from basic_streambuf to do the actual input.\n  */\n  template<typename _CharT, typename _Traits>\n    class basic_istream : virtual public basic_ios<_CharT, _Traits>\n    {\n    public:\n      // Types (inherited from basic_ios (27.4.4)):\n      typedef _CharT                     \t\tchar_type;\n      typedef typename _Traits::int_type \t\tint_type;\n      typedef typename _Traits::pos_type \t\tpos_type;\n      typedef typename _Traits::off_type \t\toff_type;\n      typedef _Traits                    \t\ttraits_type;\n      \n      // Non-standard Types:\n      typedef basic_streambuf<_CharT, _Traits> \t\t__streambuf_type;\n      typedef basic_ios<_CharT, _Traits>\t\t__ios_type;\n      typedef basic_istream<_CharT, _Traits>\t\t__istream_type;\n      typedef num_get<_CharT, istreambuf_iterator<_CharT, _Traits> >        \n \t\t\t\t\t\t\t__num_get_type;\n      typedef ctype<_CharT>           \t\t\t__ctype_type;\n\n      template<typename _CharT2, typename _Traits2>\n        friend basic_istream<_CharT2, _Traits2>&\n        operator>>(basic_istream<_CharT2, _Traits2>&, _CharT2&);\n \n      template<typename _CharT2, typename _Traits2>\n        friend basic_istream<_CharT2, _Traits2>&\n        operator>>(basic_istream<_CharT2, _Traits2>&, _CharT2*);\n \n    protected:\n      // Data Members:\n      /**\n       *  @if maint\n       *  The number of characters extracted in the previous unformatted\n       *  function; see gcount().\n       *  @endif\n      */\n      streamsize \t\t_M_gcount;\n\n    public:\n      // [27.6.1.1.1] constructor/destructor\n      /**\n       *  @brief  Base constructor.\n       *\n       *  This ctor is almost never called by the user directly, rather from\n       *  derived classes' initialization lists, which pass a pointer to\n       *  their own stream buffer.\n      */\n      explicit \n      basic_istream(__streambuf_type* __sb): _M_gcount(streamsize(0))\n      { this->init(__sb); }\n\n      /**\n       *  @brief  Base destructor.\n       *\n       *  This does very little apart from providing a virtual base dtor.\n      */\n      virtual \n      ~basic_istream() \n      { _M_gcount = streamsize(0); }\n\n      // [27.6.1.1.2] prefix/suffix\n      class sentry;\n      friend class sentry;\n\n      // [27.6.1.2] formatted input\n      // [27.6.1.2.3] basic_istream::operator>>\n      //@{\n      /**\n       *  @brief  Interface for manipulators.\n       *\n       *  Manuipulators such as @c std::ws and @c std::dec use these\n       *  functions in constructs like \"std::cin >> std::ws\".  For more\n       *  information, see the iomanip header.\n      */\n      __istream_type&\n      operator>>(__istream_type& (*__pf)(__istream_type&))\n      { return __pf(*this); }\n\n      __istream_type&\n      operator>>(__ios_type& (*__pf)(__ios_type&))\n      { \n\t__pf(*this);\n\treturn *this;\n      }\n\n      __istream_type&\n      operator>>(ios_base& (*__pf)(ios_base&))\n      {\n\t__pf(*this);\n\treturn *this;\n      }\n      //@}\n      \n      // [27.6.1.2.2] arithmetic extractors\n      /**\n       *  @name Arithmetic Extractors\n       *\n       *  All the @c operator>> functions (aka <em>formatted input\n       *  functions</em>) have some common behavior.  Each starts by\n       *  constructing a temporary object of type std::basic_istream::sentry\n       *  with the second argument (noskipws) set to false.  This has several\n       *  effects, concluding with the setting of a status flag; see the\n       *  sentry documentation for more.\n       *\n       *  If the sentry status is good, the function tries to extract\n       *  whatever data is appropriate for the type of the argument.\n       *\n       *  If an exception is thrown during extraction, ios_base::badbit\n       *  will be turned on in the stream's error state without causing an\n       *  ios_base::failure to be thrown.  The original exception will then\n       *  be rethrown.\n      */\n      //@{\n      /**\n       *  @brief  Basic arithmetic extractors\n       *  @param  A variable of builtin type.\n       *  @return  @c *this if successful\n       *\n       *  These functions use the stream's current locale (specifically, the\n       *  @c num_get facet) to parse the input data.\n      */\n      __istream_type& \n      operator>>(bool& __n)\n      { return _M_extract(__n); }\n      \n      __istream_type& \n      operator>>(short& __n);\n      \n      __istream_type& \n      operator>>(unsigned short& __n)\n      { return _M_extract(__n); }\n\n      __istream_type& \n      operator>>(int& __n);\n    \n      __istream_type& \n      operator>>(unsigned int& __n)\n      { return _M_extract(__n); }\n\n      __istream_type& \n      operator>>(long& __n)\n      { return _M_extract(__n); }\n      \n      __istream_type& \n      operator>>(unsigned long& __n)\n      { return _M_extract(__n); }\n\n#ifdef _GLIBCXX_USE_LONG_LONG\n      __istream_type& \n      operator>>(long long& __n)\n      { return _M_extract(__n); }\n\n      __istream_type& \n      operator>>(unsigned long long& __n)\n      { return _M_extract(__n); }\n#endif\n\n      __istream_type& \n      operator>>(float& __f)\n      { return _M_extract(__f); }\n\n      __istream_type& \n      operator>>(double& __f)\n      { return _M_extract(__f); }\n\n      __istream_type& \n      operator>>(long double& __f)\n      { return _M_extract(__f); }\n\n      __istream_type& \n      operator>>(void*& __p)\n      { return _M_extract(__p); }\n\n      /**\n       *  @brief  Extracting into another streambuf.\n       *  @param  sb  A pointer to a streambuf\n       *\n       *  This function behaves like one of the basic arithmetic extractors,\n       *  in that it also constructs a sentry object and has the same error\n       *  handling behavior.\n       *\n       *  If @a sb is NULL, the stream will set failbit in its error state.\n       *\n       *  Characters are extracted from this stream and inserted into the\n       *  @a sb streambuf until one of the following occurs:\n       *\n       *  - the input stream reaches end-of-file,\n       *  - insertion into the output buffer fails (in this case, the\n       *    character that would have been inserted is not extracted), or\n       *  - an exception occurs (and in this case is caught)\n       *\n       *  If the function inserts no characters, failbit is set.\n      */\n      __istream_type& \n      operator>>(__streambuf_type* __sb);\n      //@}\n      \n      // [27.6.1.3] unformatted input\n      /**\n       *  @brief  Character counting\n       *  @return  The number of characters extracted by the previous\n       *           unformatted input function dispatched for this stream.\n      */\n      streamsize \n      gcount() const \n      { return _M_gcount; }\n      \n      /**\n       *  @name Unformatted Input Functions\n       *\n       *  All the unformatted input functions have some common behavior.\n       *  Each starts by constructing a temporary object of type\n       *  std::basic_istream::sentry with the second argument (noskipws)\n       *  set to true.  This has several effects, concluding with the\n       *  setting of a status flag; see the sentry documentation for more.\n       *\n       *  If the sentry status is good, the function tries to extract\n       *  whatever data is appropriate for the type of the argument.\n       *\n       *  The number of characters extracted is stored for later retrieval\n       *  by gcount().\n       *\n       *  If an exception is thrown during extraction, ios_base::badbit\n       *  will be turned on in the stream's error state without causing an\n       *  ios_base::failure to be thrown.  The original exception will then\n       *  be rethrown.\n      */\n      //@{\n      /**\n       *  @brief  Simple extraction.\n       *  @return  A character, or eof().\n       *\n       *  Tries to extract a character.  If none are available, sets failbit\n       *  and returns traits::eof().\n      */\n      int_type \n      get();\n\n      /**\n       *  @brief  Simple extraction.\n       *  @param  c  The character in which to store data.\n       *  @return  *this\n       *\n       *  Tries to extract a character and store it in @a c.  If none are\n       *  available, sets failbit and returns traits::eof().\n       *\n       *  @note  This function is not overloaded on signed char and\n       *         unsigned char.\n      */\n      __istream_type& \n      get(char_type& __c);\n\n      /**\n       *  @brief  Simple multiple-character extraction.\n       *  @param  s  Pointer to an array.\n       *  @param  n  Maximum number of characters to store in @a s.\n       *  @param  delim  A \"stop\" character.\n       *  @return  *this\n       *\n       *  Characters are extracted and stored into @a s until one of the\n       *  following happens:\n       *\n       *  - @c n-1 characters are stored\n       *  - the input sequence reaches EOF\n       *  - the next character equals @a delim, in which case the character\n       *    is not extracted\n       *\n       * If no characters are stored, failbit is set in the stream's error\n       * state.\n       *\n       * In any case, a null character is stored into the next location in\n       * the array.\n       *\n       *  @note  This function is not overloaded on signed char and\n       *         unsigned char.\n      */\n      __istream_type& \n      get(char_type* __s, streamsize __n, char_type __delim);\n\n      /**\n       *  @brief  Simple multiple-character extraction.\n       *  @param  s  Pointer to an array.\n       *  @param  n  Maximum number of characters to store in @a s.\n       *  @return  *this\n       *\n       *  Returns @c get(s,n,widen('\\n')).\n      */\n      __istream_type& \n      get(char_type* __s, streamsize __n)\n      { return this->get(__s, __n, this->widen('\\n')); }\n\n      /**\n       *  @brief  Extraction into another streambuf.\n       *  @param  sb  A streambuf in which to store data.\n       *  @param  delim  A \"stop\" character.\n       *  @return  *this\n       *\n       *  Characters are extracted and inserted into @a sb until one of the\n       *  following happens:\n       *\n       *  - the input sequence reaches EOF\n       *  - insertion into the output buffer fails (in this case, the\n       *    character that would have been inserted is not extracted)\n       *  - the next character equals @a delim (in this case, the character\n       *    is not extracted)\n       *  - an exception occurs (and in this case is caught)\n       *\n       * If no characters are stored, failbit is set in the stream's error\n       * state.\n      */\n      __istream_type&\n      get(__streambuf_type& __sb, char_type __delim);\n\n      /**\n       *  @brief  Extraction into another streambuf.\n       *  @param  sb  A streambuf in which to store data.\n       *  @return  *this\n       *\n       *  Returns @c get(sb,widen('\\n')).\n      */\n      __istream_type&\n      get(__streambuf_type& __sb)\n      { return this->get(__sb, this->widen('\\n')); }\n\n      /**\n       *  @brief  String extraction.\n       *  @param  s  A character array in which to store the data.\n       *  @param  n  Maximum number of characters to extract.\n       *  @param  delim  A \"stop\" character.\n       *  @return  *this\n       *\n       *  Extracts and stores characters into @a s until one of the\n       *  following happens.  Note that these criteria are required to be\n       *  tested in the order listed here, to allow an input line to exactly\n       *  fill the @a s array without setting failbit.\n       *\n       *  -# the input sequence reaches end-of-file, in which case eofbit\n       *     is set in the stream error state\n       *  -# the next character equals @c delim, in which case the character\n       *     is extracted (and therefore counted in @c gcount()) but not stored\n       *  -# @c n-1 characters are stored, in which case failbit is set\n       *     in the stream error state\n       *\n       *  If no characters are extracted, failbit is set.  (An empty line of\n       *  input should therefore not cause failbit to be set.)\n       *\n       *  In any case, a null character is stored in the next location in\n       *  the array.\n      */\n      __istream_type& \n      getline(char_type* __s, streamsize __n, char_type __delim);\n\n      /**\n       *  @brief  String extraction.\n       *  @param  s  A character array in which to store the data.\n       *  @param  n  Maximum number of characters to extract.\n       *  @return  *this\n       *\n       *  Returns @c getline(s,n,widen('\\n')).\n      */\n      __istream_type& \n      getline(char_type* __s, streamsize __n)\n      { return this->getline(__s, __n, this->widen('\\n')); }\n\n      /**\n       *  @brief  Discarding characters\n       *  @param  n  Number of characters to discard.\n       *  @param  delim  A \"stop\" character.\n       *  @return  *this\n       *\n       *  Extracts characters and throws them away until one of the\n       *  following happens:\n       *  - if @a n @c != @c std::numeric_limits<int>::max(), @a n\n       *    characters are extracted\n       *  - the input sequence reaches end-of-file\n       *  - the next character equals @a delim (in this case, the character\n       *    is extracted); note that this condition will never occur if\n       *    @a delim equals @c traits::eof().\n       *\n       *  NB: Provide three overloads, instead of the single function\n       *  (with defaults) mandated by the Standard: this leads to a\n       *  better performing implementation, while still conforming to\n       *  the Standard.\n      */\n      __istream_type& \n      ignore();\n\n      __istream_type& \n      ignore(streamsize __n);\n\n      __istream_type& \n      ignore(streamsize __n, int_type __delim);\n      \n      /**\n       *  @brief  Looking ahead in the stream\n       *  @return  The next character, or eof().\n       *\n       *  If, after constructing the sentry object, @c good() is false,\n       *  returns @c traits::eof().  Otherwise reads but does not extract\n       *  the next input character.\n      */\n      int_type \n      peek();\n      \n      /**\n       *  @brief  Extraction without delimiters.\n       *  @param  s  A character array.\n       *  @param  n  Maximum number of characters to store.\n       *  @return  *this\n       *\n       *  If the stream state is @c good(), extracts characters and stores\n       *  them into @a s until one of the following happens:\n       *  - @a n characters are stored\n       *  - the input sequence reaches end-of-file, in which case the error\n       *    state is set to @c failbit|eofbit.\n       *\n       *  @note  This function is not overloaded on signed char and\n       *         unsigned char.\n      */\n      __istream_type& \n      read(char_type* __s, streamsize __n);\n\n      /**\n       *  @brief  Extraction until the buffer is exhausted, but no more.\n       *  @param  s  A character array.\n       *  @param  n  Maximum number of characters to store.\n       *  @return  The number of characters extracted.\n       *\n       *  Extracts characters and stores them into @a s depending on the\n       *  number of characters remaining in the streambuf's buffer,\n       *  @c rdbuf()->in_avail(), called @c A here:\n       *  - if @c A @c == @c -1, sets eofbit and extracts no characters\n       *  - if @c A @c == @c 0, extracts no characters\n       *  - if @c A @c > @c 0, extracts @c min(A,n)\n       *\n       *  The goal is to empty the current buffer, and to not request any\n       *  more from the external input sequence controlled by the streambuf.\n      */\n      streamsize \n      readsome(char_type* __s, streamsize __n);\n      \n      /**\n       *  @brief  Unextracting a single character.\n       *  @param  c  The character to push back into the input stream.\n       *  @return  *this\n       *\n       *  If @c rdbuf() is not null, calls @c rdbuf()->sputbackc(c).\n       *\n       *  If @c rdbuf() is null or if @c sputbackc() fails, sets badbit in\n       *  the error state.\n       *\n       *  @note  Since no characters are extracted, the next call to\n       *         @c gcount() will return 0, as required by DR 60.\n      */\n      __istream_type& \n      putback(char_type __c);\n\n      /**\n       *  @brief  Unextracting the previous character.\n       *  @return  *this\n       *\n       *  If @c rdbuf() is not null, calls @c rdbuf()->sungetc(c).\n       *\n       *  If @c rdbuf() is null or if @c sungetc() fails, sets badbit in\n       *  the error state.\n       *\n       *  @note  Since no characters are extracted, the next call to\n       *         @c gcount() will return 0, as required by DR 60.\n      */\n      __istream_type& \n      unget();\n\n      /**\n       *  @brief  Synchronizing the stream buffer.\n       *  @return  0 on success, -1 on failure\n       *\n       *  If @c rdbuf() is a null pointer, returns -1.\n       *\n       *  Otherwise, calls @c rdbuf()->pubsync(), and if that returns -1,\n       *  sets badbit and returns -1.\n       *\n       *  Otherwise, returns 0.\n       *\n       *  @note  This function does not count the number of characters\n       *         extracted, if any, and therefore does not affect the next\n       *         call to @c gcount().\n      */\n      int \n      sync();\n\n      /**\n       *  @brief  Getting the current read position.\n       *  @return  A file position object.\n       *\n       *  If @c fail() is not false, returns @c pos_type(-1) to indicate\n       *  failure.  Otherwise returns @c rdbuf()->pubseekoff(0,cur,in).\n       *\n       *  @note  This function does not count the number of characters\n       *         extracted, if any, and therefore does not affect the next\n       *         call to @c gcount().\n      */\n      pos_type \n      tellg();\n\n      /**\n       *  @brief  Changing the current read position.\n       *  @param  pos  A file position object.\n       *  @return  *this\n       *\n       *  If @c fail() is not true, calls @c rdbuf()->pubseekpos(pos).  If\n       *  that function fails, sets failbit.\n       *\n       *  @note  This function does not count the number of characters\n       *         extracted, if any, and therefore does not affect the next\n       *         call to @c gcount().\n      */\n      __istream_type& \n      seekg(pos_type);\n\n      /**\n       *  @brief  Changing the current read position.\n       *  @param  off  A file offset object.\n       *  @param  dir  The direction in which to seek.\n       *  @return  *this\n       *\n       *  If @c fail() is not true, calls @c rdbuf()->pubseekoff(off,dir).\n       *  If that function fails, sets failbit.\n       *\n       *  @note  This function does not count the number of characters\n       *         extracted, if any, and therefore does not affect the next\n       *         call to @c gcount().\n      */\n      __istream_type& \n      seekg(off_type, ios_base::seekdir);\n      //@}\n\n    protected:\n      explicit \n      basic_istream(): _M_gcount(streamsize(0)) { }\n\n      template<typename _ValueT>\n        __istream_type&\n        _M_extract(_ValueT& __v);\n    };\n\n  // Explicit specialization declarations, defined in src/istream.cc.\n  template<> \n    basic_istream<char>& \n    basic_istream<char>::\n    getline(char_type* __s, streamsize __n, char_type __delim);\n  \n  template<>\n    basic_istream<char>&\n    basic_istream<char>::\n    ignore(streamsize __n);\n  \n  template<>\n    basic_istream<char>&\n    basic_istream<char>::\n    ignore(streamsize __n, int_type __delim);\n\n#ifdef _GLIBCXX_USE_WCHAR_T\n  template<> \n    basic_istream<wchar_t>& \n    basic_istream<wchar_t>::\n    getline(char_type* __s, streamsize __n, char_type __delim);\n\n  template<>\n    basic_istream<wchar_t>&\n    basic_istream<wchar_t>::\n    ignore(streamsize __n);\n  \n  template<>\n    basic_istream<wchar_t>&\n    basic_istream<wchar_t>::\n    ignore(streamsize __n, int_type __delim);\n#endif\n\n  /**\n   *  @brief  Performs setup work for input streams.\n   *\n   *  Objects of this class are created before all of the standard\n   *  extractors are run.  It is responsible for \"exception-safe prefix and\n   *  suffix operations,\" although only prefix actions are currently required\n   *  by the standard.  Additional actions may be added by the\n   *  implementation, and we list them in\n   *  http://gcc.gnu.org/onlinedocs/libstdc++/17_intro/howto.html#5\n   *  under [27.6] notes.\n  */\n  template<typename _CharT, typename _Traits>\n    class basic_istream<_CharT, _Traits>::sentry\n    {\n    public:\n      /// Easy access to dependant types.\n      typedef _Traits \t\t\t\t\ttraits_type;\n      typedef basic_streambuf<_CharT, _Traits> \t\t__streambuf_type;\n      typedef basic_istream<_CharT, _Traits> \t\t__istream_type;\n      typedef typename __istream_type::__ctype_type \t__ctype_type;\n      typedef typename _Traits::int_type\t\t__int_type;\n\n      /**\n       *  @brief  The constructor performs all the work.\n       *  @param  is  The input stream to guard.\n       *  @param  noskipws  Whether to consume whitespace or not.\n       *\n       *  If the stream state is good (@a is.good() is true), then the\n       *  following actions are performed, otherwise the sentry state is\n       *  false (\"not okay\") and failbit is set in the stream state.\n       *\n       *  The sentry's preparatory actions are:\n       *\n       *  -# if the stream is tied to an output stream, @c is.tie()->flush()\n       *     is called to synchronize the output sequence\n       *  -# if @a noskipws is false, and @c ios_base::skipws is set in\n       *     @c is.flags(), the sentry extracts and discards whitespace\n       *     characters from the stream.  The currently imbued locale is\n       *     used to determine whether each character is whitespace.\n       *\n       *  If the stream state is still good, then the sentry state becomes\n       *  true (\"okay\").\n      */\n      explicit \n      sentry(basic_istream<_CharT, _Traits>& __is, bool __noskipws = false);\n\n      /**\n       *  @brief  Quick status checking.\n       *  @return  The sentry state.\n       *\n       *  For ease of use, sentries may be converted to booleans.  The\n       *  return value is that of the sentry state (true == okay).\n      */\n      operator bool() const\n      { return _M_ok; }\n\n    private:\n      bool _M_ok;\n    };\n\n  // [27.6.1.2.3] character extraction templates\n  //@{\n  /**\n   *  @brief  Character extractors\n   *  @param  in  An input stream.\n   *  @param  c  A character reference.\n   *  @return  in\n   *\n   *  Behaves like one of the formatted arithmetic extractors described in\n   *  std::basic_istream.  After constructing a sentry object with good\n   *  status, this function extracts a character (if one is available) and\n   *  stores it in @a c.  Otherwise, sets failbit in the input stream.\n  */\n  template<typename _CharT, typename _Traits>\n    basic_istream<_CharT, _Traits>&\n    operator>>(basic_istream<_CharT, _Traits>& __in, _CharT& __c);\n\n  template<class _Traits>\n    inline basic_istream<char, _Traits>&\n    operator>>(basic_istream<char, _Traits>& __in, unsigned char& __c)\n    { return (__in >> reinterpret_cast<char&>(__c)); }\n\n  template<class _Traits>\n    inline basic_istream<char, _Traits>&\n    operator>>(basic_istream<char, _Traits>& __in, signed char& __c)\n    { return (__in >> reinterpret_cast<char&>(__c)); }\n  //@}\n\n  //@{\n  /**\n   *  @brief  Character string extractors\n   *  @param  in  An input stream.\n   *  @param  s  A pointer to a character array.\n   *  @return  in\n   *\n   *  Behaves like one of the formatted arithmetic extractors described in\n   *  std::basic_istream.  After constructing a sentry object with good\n   *  status, this function extracts up to @c n characters and stores them\n   *  into the array starting at @a s.  @c n is defined as:\n   *\n   *  - if @c width() is greater than zero, @c n is width()\n   *  - otherwise @c n is \"the number of elements of the largest array of\n   *    @c char_type that can store a terminating @c eos.\" [27.6.1.2.3]/6\n   *\n   *  Characters are extracted and stored until one of the following happens:\n   *  - @c n-1 characters are stored\n   *  - EOF is reached\n   *  - the next character is whitespace according to the current locale\n   *  - the next character is a null byte (i.e., @c charT() )\n   *\n   *  @c width(0) is then called for the input stream.\n   *\n   *  If no characters are extracted, sets failbit.\n  */\n  template<typename _CharT, typename _Traits>\n    basic_istream<_CharT, _Traits>&\n    operator>>(basic_istream<_CharT, _Traits>& __in, _CharT* __s);\n\n  // Explicit specialization declaration, defined in src/istream.cc.\n  template<>\n    basic_istream<char>&\n    operator>>(basic_istream<char>& __in, char* __s);\n\n  template<class _Traits>\n    inline basic_istream<char, _Traits>&\n    operator>>(basic_istream<char, _Traits>& __in, unsigned char* __s)\n    { return (__in >> reinterpret_cast<char*>(__s)); }\n\n  template<class _Traits>\n    inline basic_istream<char, _Traits>&\n    operator>>(basic_istream<char, _Traits>& __in, signed char* __s)\n    { return (__in >> reinterpret_cast<char*>(__s)); }\n  //@}\n\n  // 27.6.1.5 Template class basic_iostream\n  /**\n   *  @brief  Merging istream and ostream capabilities.\n   *\n   *  This class multiply inherits from the input and output stream classes\n   *  simply to provide a single interface.\n  */\n  template<typename _CharT, typename _Traits>\n    class basic_iostream\n    : public basic_istream<_CharT, _Traits>, \n      public basic_ostream<_CharT, _Traits>\n    {\n    public:\n      // _GLIBCXX_RESOLVE_LIB_DEFECTS\n      // 271. basic_iostream missing typedefs\n      // Types (inherited):\n      typedef _CharT                     \t\tchar_type;\n      typedef typename _Traits::int_type \t\tint_type;\n      typedef typename _Traits::pos_type \t\tpos_type;\n      typedef typename _Traits::off_type \t\toff_type;\n      typedef _Traits                    \t\ttraits_type;\n\n      // Non-standard Types:\n      typedef basic_istream<_CharT, _Traits>\t\t__istream_type;\n      typedef basic_ostream<_CharT, _Traits>\t\t__ostream_type;\n\n      /**\n       *  @brief  Constructor does nothing.\n       *\n       *  Both of the parent classes are initialized with the same\n       *  streambuf pointer passed to this constructor.\n      */\n      explicit \n      basic_iostream(basic_streambuf<_CharT, _Traits>* __sb)\n      : __istream_type(), __ostream_type()\n      { this->init(__sb); }\n\n      /**\n       *  @brief  Destructor does nothing.\n      */\n      virtual \n      ~basic_iostream() { }\n\n    protected:\n      explicit \n      basic_iostream() : __istream_type(), __ostream_type()\n      { }\n    };\n\n  // [27.6.1.4] standard basic_istream manipulators\n  /**\n   *  @brief  Quick and easy way to eat whitespace\n   *\n   *  This manipulator extracts whitespace characters, stopping when the\n   *  next character is non-whitespace, or when the input sequence is empty.\n   *  If the sequence is empty, @c eofbit is set in the stream, but not\n   *  @c failbit.\n   *\n   *  The current locale is used to distinguish whitespace characters.\n   *\n   *  Example:\n   *  @code\n   *     MyClass   mc;\n   *\n   *     std::cin >> std::ws >> mc;\n   *  @endcode\n   *  will skip leading whitespace before calling operator>> on cin and your\n   *  object.  Note that the same effect can be achieved by creating a\n   *  std::basic_istream::sentry inside your definition of operator>>.\n  */\n  template<typename _CharT, typename _Traits>\n    basic_istream<_CharT, _Traits>& \n    ws(basic_istream<_CharT, _Traits>& __is);\n\n_GLIBCXX_END_NAMESPACE\n\n#ifndef _GLIBCXX_EXPORT_TEMPLATE\n# include <bits/istream.tcc>\n#endif\n\n#endif\t/* _GLIBCXX_ISTREAM */\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/iterator",
    "content": "// <iterator> -*- C++ -*-\n\n// Copyright (C) 2001, 2002 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n/*\n *\n * Copyright (c) 1994\n * Hewlett-Packard Company\n *\n * Permission to use, copy, modify, distribute and sell this software\n * and its documentation for any purpose is hereby granted without fee,\n * provided that the above copyright notice appear in all copies and\n * that both that copyright notice and this permission notice appear\n * in supporting documentation.  Hewlett-Packard Company makes no\n * representations about the suitability of this software for any\n * purpose.  It is provided \"as is\" without express or implied warranty.\n *\n *\n * Copyright (c) 1996,1997\n * Silicon Graphics Computer Systems, Inc.\n *\n * Permission to use, copy, modify, distribute and sell this software\n * and its documentation for any purpose is hereby granted without fee,\n * provided that the above copyright notice appear in all copies and\n * that both that copyright notice and this permission notice appear\n * in supporting documentation.  Silicon Graphics makes no\n * representations about the suitability of this software for any\n * purpose.  It is provided \"as is\" without express or implied warranty.\n */\n\n/** @file include/iterator\n *  This is a Standard C++ Library header.\n */\n\n#ifndef _GLIBCXX_ITERATOR\n#define _GLIBCXX_ITERATOR 1\n\n#pragma GCC system_header\n\n#include <bits/c++config.h>\n#include <cstddef>\n#include <bits/stl_iterator_base_types.h>\n#include <bits/stl_iterator_base_funcs.h>\n#include <bits/stl_iterator.h>\n#include <ostream>\n#include <istream>\n#include <bits/stream_iterator.h>\n#include <bits/streambuf_iterator.h>\n\n#endif /* _GLIBCXX_ITERATOR */\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/limits",
    "content": "// The template and inlines for the numeric_limits classes. -*- C++ -*- \n\n// Copyright (C) 1999, 2000, 2001, 2002, 2003, 2005 \n// Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n/** @file limits\n *  This is a Standard C++ Library header.\n */\n\n// Note: this is not a conforming implementation.\n// Written by Gabriel Dos Reis <gdr@codesourcery.com>\n\n//\n// ISO 14882:1998\n// 18.2.1\n//\n\n#ifndef _GLIBCXX_NUMERIC_LIMITS\n#define _GLIBCXX_NUMERIC_LIMITS 1\n\n#pragma GCC system_header\n\n#include <bits/c++config.h>\n\n//\n// The numeric_limits<> traits document implementation-defined aspects\n// of fundamental arithmetic data types (integers and floating points).\n// From Standard C++ point of view, there are 13 such types:\n//   * integers\n//         bool\t\t\t\t\t\t        (1)\n//         char, signed char, unsigned char\t\t\t(3)\n//         short, unsigned short\t\t\t\t(2)\n//         int, unsigned\t\t\t\t\t(2)\n//         long, unsigned long\t\t\t\t\t(2)\n//\n//   * floating points\n//         float\t\t\t\t\t\t(1)\n//         double\t\t\t\t\t\t(1)\n//         long double\t\t\t\t\t\t(1)\n//\n// GNU C++ undertstands (where supported by the host C-library)\n//   * integer\n//         long long, unsigned long long\t\t\t(2)\n//\n// which brings us to 15 fundamental arithmetic data types in GNU C++.\n//\n//\n// Since a numeric_limits<> is a bit tricky to get right, we rely on\n// an interface composed of macros which should be defined in config/os\n// or config/cpu when they differ from the generic (read arbitrary)\n// definitions given here.\n//\n\n// These values can be overridden in the target configuration file.\n// The default values are appropriate for many 32-bit targets.\n\n// GCC only intrinsicly supports modulo integral types.  The only remaining\n// integral exceptional values is division by zero.  Only targets that do not\n// signal division by zero in some \"hard to ignore\" way should use false.\n#ifndef __glibcxx_integral_traps\n# define __glibcxx_integral_traps true\n#endif\n\n// float\n//\n\n// Default values.  Should be overriden in configuration files if necessary.\n\n#ifndef __glibcxx_float_has_denorm_loss\n#  define __glibcxx_float_has_denorm_loss false\n#endif\n#ifndef __glibcxx_float_traps\n#  define __glibcxx_float_traps false\n#endif\n#ifndef __glibcxx_float_tinyness_before\n#  define __glibcxx_float_tinyness_before false\n#endif\n\n// double\n\n// Default values.  Should be overriden in configuration files if necessary.\n\n#ifndef __glibcxx_double_has_denorm_loss\n#  define __glibcxx_double_has_denorm_loss false\n#endif\n#ifndef __glibcxx_double_traps\n#  define __glibcxx_double_traps false\n#endif\n#ifndef __glibcxx_double_tinyness_before\n#  define __glibcxx_double_tinyness_before false\n#endif\n\n// long double\n\n// Default values.  Should be overriden in configuration files if necessary.\n\n#ifndef __glibcxx_long_double_has_denorm_loss\n#  define __glibcxx_long_double_has_denorm_loss false\n#endif\n#ifndef __glibcxx_long_double_traps\n#  define __glibcxx_long_double_traps false\n#endif\n#ifndef __glibcxx_long_double_tinyness_before\n#  define __glibcxx_long_double_tinyness_before false\n#endif\n\n// You should not need to define any macros below this point.\n\n#define __glibcxx_signed(T)\t((T)(-1) < 0)\n\n#define __glibcxx_min(T) \\\n  (__glibcxx_signed (T) ? (T)1 << __glibcxx_digits (T) : (T)0)\n\n#define __glibcxx_max(T) \\\n  (__glibcxx_signed (T) ? ((T)1 << __glibcxx_digits (T)) - 1 : ~(T)0)\n\n#define __glibcxx_digits(T) \\\n  (sizeof(T) * __CHAR_BIT__ - __glibcxx_signed (T))\n\n// The fraction 643/2136 approximates log10(2) to 7 significant digits.\n#define __glibcxx_digits10(T) \\\n  (__glibcxx_digits (T) * 643 / 2136)\n\n\n_GLIBCXX_BEGIN_NAMESPACE(std)\n\n  /**\n   *  @brief Describes the rounding style for floating-point types.\n   *\n   *  This is used in the std::numeric_limits class.\n  */\n  enum float_round_style\n  {\n    round_indeterminate       = -1,    ///< Self-explanatory.\n    round_toward_zero         = 0,     ///< Self-explanatory.\n    round_to_nearest          = 1,     ///< To the nearest representable value.\n    round_toward_infinity     = 2,     ///< Self-explanatory.\n    round_toward_neg_infinity = 3      ///< Self-explanatory.\n  };\n\n  /**\n   *  @brief Describes the denormalization for floating-point types.\n   *\n   *  These values represent the presence or absence of a variable number\n   *  of exponent bits.  This type is used in the std::numeric_limits class.\n  */\n  enum float_denorm_style\n  {\n    /// Indeterminate at compile time whether denormalized values are allowed.\n    denorm_indeterminate = -1,\n    /// The type does not allow denormalized values.\n    denorm_absent        = 0,\n    /// The type allows denormalized values.\n    denorm_present       = 1\n  };\n\n  /**\n   *  @brief Part of std::numeric_limits.\n   *\n   *  The @c static @c const members are usable as integral constant\n   *  expressions.\n   *\n   *  @note This is a seperate class for purposes of efficiency; you\n   *        should only access these members as part of an instantiation\n   *        of the std::numeric_limits class.\n  */\n  struct __numeric_limits_base\n  {\n    /** This will be true for all fundamental types (which have\n        specializations), and false for everything else.  */\n    static const bool is_specialized = false;\n\n    /** The number of @c radix digits that be represented without change:  for\n        integer types, the number of non-sign bits in the mantissa; for\n        floating types, the number of @c radix digits in the mantissa.  */\n    static const int digits = 0;\n    /** The number of base 10 digits that can be represented without change. */\n    static const int digits10 = 0;\n    /** True if the type is signed.  */\n    static const bool is_signed = false;\n    /** True if the type is integer.\n     *  @if maint\n     *  Is this supposed to be \"if the type is integral\"?\n     *  @endif\n    */\n    static const bool is_integer = false;\n    /** True if the type uses an exact representation.  \"All integer types are\n        exact, but not all exact types are integer.  For example, rational and\n        fixed-exponent representations are exact but not integer.\"\n        [18.2.1.2]/15  */\n    static const bool is_exact = false;\n    /** For integer types, specifies the base of the representation.  For\n        floating types, specifies the base of the exponent representation.  */\n    static const int radix = 0;\n\n    /** The minimum negative integer such that @c radix raised to the power of\n        (one less than that integer) is a normalized floating point number.  */\n    static const int min_exponent = 0;\n    /** The minimum negative integer such that 10 raised to that power is in\n        the range of normalized floating point numbers.  */\n    static const int min_exponent10 = 0;\n    /** The maximum positive integer such that @c radix raised to the power of\n        (one less than that integer) is a representable finite floating point\n\tnumber.  */\n    static const int max_exponent = 0;\n    /** The maximum positive integer such that 10 raised to that power is in\n        the range of representable finite floating point numbers.  */\n    static const int max_exponent10 = 0;\n\n    /** True if the type has a representation for positive infinity.  */\n    static const bool has_infinity = false;\n    /** True if the type has a representation for a quiet (non-signaling)\n        \"Not a Number.\"  */\n    static const bool has_quiet_NaN = false;\n    /** True if the type has a representation for a signaling\n        \"Not a Number.\"  */\n    static const bool has_signaling_NaN = false;\n    /** See std::float_denorm_style for more information.  */\n    static const float_denorm_style has_denorm = denorm_absent;\n    /** \"True if loss of accuracy is detected as a denormalization loss,\n        rather than as an inexact result.\" [18.2.1.2]/42  */\n    static const bool has_denorm_loss = false;\n\n    /** True if-and-only-if the type adheres to the IEC 559 standard, also\n        known as IEEE 754.  (Only makes sense for floating point types.)  */\n    static const bool is_iec559 = false;\n    /** \"True if the set of values representable by the type is finite.   All\n        built-in types are bounded, this member would be false for arbitrary\n\tprecision types.\" [18.2.1.2]/54  */\n    static const bool is_bounded = false;\n    /** True if the type is @e modulo, that is, if it is possible to add two\n        positive numbers and have a result that wraps around to a third number\n        that is less.  Typically false for floating types, true for unsigned\n        integers, and true for signed integers.  */\n    static const bool is_modulo = false;\n\n    /** True if trapping is implemented for this type.  */\n    static const bool traps = false;\n    /** True if tinyness is detected before rounding.  (see IEC 559)  */\n    static const bool tinyness_before = false;\n    /** See std::float_round_style for more information.  This is only\n        meaningful for floating types; integer types will all be\n\tround_toward_zero.  */\n    static const float_round_style round_style = round_toward_zero;\n  };\n\n  /**\n   *  @brief Properties of fundamental types.\n   *\n   *  This class allows a program to obtain information about the\n   *  representation of a fundamental type on a given platform.  For\n   *  non-fundamental types, the functions will return 0 and the data\n   *  members will all be @c false.\n   *\n   *  @if maint\n   *  _GLIBCXX_RESOLVE_LIB_DEFECTS:  DRs 201 and 184 (hi Gaby!) are\n   *  noted, but not incorporated in this documented (yet).\n   *  @endif\n  */\n  template<typename _Tp>\n    struct numeric_limits : public __numeric_limits_base\n    {\n      /** The minimum finite value, or for floating types with\n          denormalization, the minimum positive normalized value.  */\n      static _Tp min() throw() { return static_cast<_Tp>(0); }\n      /** The maximum finite value.  */\n      static _Tp max() throw() { return static_cast<_Tp>(0); }\n      /** The @e machine @e epsilon:  the difference between 1 and the least\n          value greater than 1 that is representable.  */\n      static _Tp epsilon() throw() { return static_cast<_Tp>(0); }\n      /** The maximum rounding error measurement (see LIA-1).  */\n      static _Tp round_error() throw() { return static_cast<_Tp>(0); }\n      /** The representation of positive infinity, if @c has_infinity.  */\n      static _Tp infinity() throw()  { return static_cast<_Tp>(0); }\n      /** The representation of a quiet \"Not a Number,\" if @c has_quiet_NaN. */\n      static _Tp quiet_NaN() throw() { return static_cast<_Tp>(0); }\n      /** The representation of a signaling \"Not a Number,\" if\n          @c has_signaling_NaN. */\n      static _Tp signaling_NaN() throw() { return static_cast<_Tp>(0); }\n      /** The minimum positive denormalized value.  For types where\n          @c has_denorm is false, this is the minimum positive normalized\n\t  value.  */\n      static _Tp denorm_min() throw() { return static_cast<_Tp>(0); }\n    };\n\n  // Now there follow 15 explicit specializations.  Yes, 15.  Make sure\n  // you get the count right.\n\n  /// numeric_limits<bool> specialization.\n  template<>\n    struct numeric_limits<bool>\n    {\n      static const bool is_specialized = true;\n\n      static bool min() throw()\n      { return false; }\n      static bool max() throw()\n      { return true; }\n\n      static const int digits = 1;\n      static const int digits10 = 0;\n      static const bool is_signed = false;\n      static const bool is_integer = true;\n      static const bool is_exact = true;\n      static const int radix = 2;\n      static bool epsilon() throw()\n      { return false; }\n      static bool round_error() throw()\n      { return false; }\n\n      static const int min_exponent = 0;\n      static const int min_exponent10 = 0;\n      static const int max_exponent = 0;\n      static const int max_exponent10 = 0;\n\n      static const bool has_infinity = false;\n      static const bool has_quiet_NaN = false;\n      static const bool has_signaling_NaN = false;\n      static const float_denorm_style has_denorm = denorm_absent;\n      static const bool has_denorm_loss = false;\n\n      static bool infinity() throw()\n      { return false; }\n      static bool quiet_NaN() throw()\n      { return false; }\n      static bool signaling_NaN() throw()\n      { return false; }\n      static bool denorm_min() throw()\n      { return false; }\n\n      static const bool is_iec559 = false;\n      static const bool is_bounded = true;\n      static const bool is_modulo = false;\n\n      // It is not clear what it means for a boolean type to trap.\n      // This is a DR on the LWG issue list.  Here, I use integer\n      // promotion semantics.\n      static const bool traps = __glibcxx_integral_traps;\n      static const bool tinyness_before = false;\n      static const float_round_style round_style = round_toward_zero;\n    };\n\n  /// numeric_limits<char> specialization.\n  template<>\n    struct numeric_limits<char>\n    {\n      static const bool is_specialized = true;\n\n      static char min() throw()\n      { return __glibcxx_min(char); }\n      static char max() throw()\n      { return __glibcxx_max(char); }\n\n      static const int digits = __glibcxx_digits (char);\n      static const int digits10 = __glibcxx_digits10 (char);\n      static const bool is_signed = __glibcxx_signed (char);\n      static const bool is_integer = true;\n      static const bool is_exact = true;\n      static const int radix = 2;\n      static char epsilon() throw()\n      { return 0; }\n      static char round_error() throw()\n      { return 0; }\n\n      static const int min_exponent = 0;\n      static const int min_exponent10 = 0;\n      static const int max_exponent = 0;\n      static const int max_exponent10 = 0;\n\n      static const bool has_infinity = false;\n      static const bool has_quiet_NaN = false;\n      static const bool has_signaling_NaN = false;\n      static const float_denorm_style has_denorm = denorm_absent;\n      static const bool has_denorm_loss = false;\n\n      static char infinity() throw()\n      { return char(); }\n      static char quiet_NaN() throw()\n      { return char(); }\n      static char signaling_NaN() throw()\n      { return char(); }\n      static char denorm_min() throw()\n      { return static_cast<char>(0); }\n\n      static const bool is_iec559 = false;\n      static const bool is_bounded = true;\n      static const bool is_modulo = true;\n\n      static const bool traps = __glibcxx_integral_traps;\n      static const bool tinyness_before = false;\n      static const float_round_style round_style = round_toward_zero;\n    };\n\n  /// numeric_limits<signed char> specialization.\n  template<>\n    struct numeric_limits<signed char>\n    {\n      static const bool is_specialized = true;\n\n      static signed char min() throw()\n      { return -__SCHAR_MAX__ - 1; }\n      static signed char max() throw()\n      { return __SCHAR_MAX__; }\n\n      static const int digits = __glibcxx_digits (signed char);\n      static const int digits10 = __glibcxx_digits10 (signed char);\n      static const bool is_signed = true;\n      static const bool is_integer = true;\n      static const bool is_exact = true;\n      static const int radix = 2;\n      static signed char epsilon() throw()\n      { return 0; }\n      static signed char round_error() throw()\n      { return 0; }\n\n      static const int min_exponent = 0;\n      static const int min_exponent10 = 0;\n      static const int max_exponent = 0;\n      static const int max_exponent10 = 0;\n\n      static const bool has_infinity = false;\n      static const bool has_quiet_NaN = false;\n      static const bool has_signaling_NaN = false;\n      static const float_denorm_style has_denorm = denorm_absent;\n      static const bool has_denorm_loss = false;\n\n      static signed char infinity() throw()\n      { return static_cast<signed char>(0); }\n      static signed char quiet_NaN() throw()\n      { return static_cast<signed char>(0); }\n      static signed char signaling_NaN() throw()\n      { return static_cast<signed char>(0); }\n      static signed char denorm_min() throw()\n      { return static_cast<signed char>(0); }\n\n      static const bool is_iec559 = false;\n      static const bool is_bounded = true;\n      static const bool is_modulo = true;\n\n      static const bool traps = __glibcxx_integral_traps;\n      static const bool tinyness_before = false;\n      static const float_round_style round_style = round_toward_zero;\n    };\n\n  /// numeric_limits<unsigned char> specialization.\n  template<>\n    struct numeric_limits<unsigned char>\n    {\n      static const bool is_specialized = true;\n\n      static unsigned char min() throw()\n      { return 0; }\n      static unsigned char max() throw()\n      { return __SCHAR_MAX__ * 2U + 1; }\n\n      static const int digits = __glibcxx_digits (unsigned char);\n      static const int digits10 = __glibcxx_digits10 (unsigned char);\n      static const bool is_signed = false;\n      static const bool is_integer = true;\n      static const bool is_exact = true;\n      static const int radix = 2;\n      static unsigned char epsilon() throw()\n      { return 0; }\n      static unsigned char round_error() throw()\n      { return 0; }\n\n      static const int min_exponent = 0;\n      static const int min_exponent10 = 0;\n      static const int max_exponent = 0;\n      static const int max_exponent10 = 0;\n\n      static const bool has_infinity = false;\n      static const bool has_quiet_NaN = false;\n      static const bool has_signaling_NaN = false;\n      static const float_denorm_style has_denorm = denorm_absent;\n      static const bool has_denorm_loss = false;\n\n      static unsigned char infinity() throw()\n      { return static_cast<unsigned char>(0); }\n      static unsigned char quiet_NaN() throw()\n      { return static_cast<unsigned char>(0); }\n      static unsigned char signaling_NaN() throw()\n      { return static_cast<unsigned char>(0); }\n      static unsigned char denorm_min() throw()\n      { return static_cast<unsigned char>(0); }\n\n      static const bool is_iec559 = false;\n      static const bool is_bounded = true;\n      static const bool is_modulo = true;\n\n      static const bool traps = __glibcxx_integral_traps;\n      static const bool tinyness_before = false;\n      static const float_round_style round_style = round_toward_zero;\n    };\n\n  /// numeric_limits<wchar_t> specialization.\n  template<>\n    struct numeric_limits<wchar_t>\n    {\n      static const bool is_specialized = true;\n\n      static wchar_t min() throw()\n      { return __glibcxx_min (wchar_t); }\n      static wchar_t max() throw()\n      { return __glibcxx_max (wchar_t); }\n\n      static const int digits = __glibcxx_digits (wchar_t);\n      static const int digits10 = __glibcxx_digits10 (wchar_t);\n      static const bool is_signed = __glibcxx_signed (wchar_t);\n      static const bool is_integer = true;\n      static const bool is_exact = true;\n      static const int radix = 2;\n      static wchar_t epsilon() throw()\n      { return 0; }\n      static wchar_t round_error() throw()\n      { return 0; }\n\n      static const int min_exponent = 0;\n      static const int min_exponent10 = 0;\n      static const int max_exponent = 0;\n      static const int max_exponent10 = 0;\n\n      static const bool has_infinity = false;\n      static const bool has_quiet_NaN = false;\n      static const bool has_signaling_NaN = false;\n      static const float_denorm_style has_denorm = denorm_absent;\n      static const bool has_denorm_loss = false;\n\n      static wchar_t infinity() throw()\n      { return wchar_t(); }\n      static wchar_t quiet_NaN() throw()\n      { return wchar_t(); }\n      static wchar_t signaling_NaN() throw()\n      { return wchar_t(); }\n      static wchar_t denorm_min() throw()\n      { return wchar_t(); }\n\n      static const bool is_iec559 = false;\n      static const bool is_bounded = true;\n      static const bool is_modulo = true;\n\n      static const bool traps = __glibcxx_integral_traps;\n      static const bool tinyness_before = false;\n      static const float_round_style round_style = round_toward_zero;\n    };\n\n  /// numeric_limits<short> specialization.\n  template<>\n    struct numeric_limits<short>\n    {\n      static const bool is_specialized = true;\n\n      static short min() throw()\n      { return -__SHRT_MAX__ - 1; }\n      static short max() throw()\n      { return __SHRT_MAX__; }\n\n      static const int digits = __glibcxx_digits (short);\n      static const int digits10 = __glibcxx_digits10 (short);\n      static const bool is_signed = true;\n      static const bool is_integer = true;\n      static const bool is_exact = true;\n      static const int radix = 2;\n      static short epsilon() throw()\n      { return 0; }\n      static short round_error() throw()\n      { return 0; }\n\n      static const int min_exponent = 0;\n      static const int min_exponent10 = 0;\n      static const int max_exponent = 0;\n      static const int max_exponent10 = 0;\n\n      static const bool has_infinity = false;\n      static const bool has_quiet_NaN = false;\n      static const bool has_signaling_NaN = false;\n      static const float_denorm_style has_denorm = denorm_absent;\n      static const bool has_denorm_loss = false;\n\n      static short infinity() throw()\n      { return short(); }\n      static short quiet_NaN() throw()\n      { return short(); }\n      static short signaling_NaN() throw()\n      { return short(); }\n      static short denorm_min() throw()\n      { return short(); }\n\n      static const bool is_iec559 = false;\n      static const bool is_bounded = true;\n      static const bool is_modulo = true;\n\n      static const bool traps = __glibcxx_integral_traps;\n      static const bool tinyness_before = false;\n      static const float_round_style round_style = round_toward_zero;\n    };\n\n  /// numeric_limits<unsigned short> specialization.\n  template<>\n    struct numeric_limits<unsigned short>\n    {\n      static const bool is_specialized = true;\n\n      static unsigned short min() throw()\n      { return 0; }\n      static unsigned short max() throw()\n      { return __SHRT_MAX__ * 2U + 1; }\n\n      static const int digits = __glibcxx_digits (unsigned short);\n      static const int digits10 = __glibcxx_digits10 (unsigned short);\n      static const bool is_signed = false;\n      static const bool is_integer = true;\n      static const bool is_exact = true;\n      static const int radix = 2;\n      static unsigned short epsilon() throw()\n      { return 0; }\n      static unsigned short round_error() throw()\n      { return 0; }\n\n      static const int min_exponent = 0;\n      static const int min_exponent10 = 0;\n      static const int max_exponent = 0;\n      static const int max_exponent10 = 0;\n\n      static const bool has_infinity = false;\n      static const bool has_quiet_NaN = false;\n      static const bool has_signaling_NaN = false;\n      static const float_denorm_style has_denorm = denorm_absent;\n      static const bool has_denorm_loss = false;\n\n      static unsigned short infinity() throw()\n      { return static_cast<unsigned short>(0); }\n      static unsigned short quiet_NaN() throw()\n      { return static_cast<unsigned short>(0); }\n      static unsigned short signaling_NaN() throw()\n      { return static_cast<unsigned short>(0); }\n      static unsigned short denorm_min() throw()\n      { return static_cast<unsigned short>(0); }\n\n      static const bool is_iec559 = false;\n      static const bool is_bounded = true;\n      static const bool is_modulo = true;\n\n      static const bool traps = __glibcxx_integral_traps;\n      static const bool tinyness_before = false;\n      static const float_round_style round_style = round_toward_zero;\n    };\n\n  /// numeric_limits<int> specialization.\n  template<>\n    struct numeric_limits<int>\n    {\n      static const bool is_specialized = true;\n\n      static int min() throw()\n      { return -__INT_MAX__ - 1; }\n      static int max() throw()\n      { return __INT_MAX__; }\n\n      static const int digits = __glibcxx_digits (int);\n      static const int digits10 = __glibcxx_digits10 (int);\n      static const bool is_signed = true;\n      static const bool is_integer = true;\n      static const bool is_exact = true;\n      static const int radix = 2;\n      static int epsilon() throw()\n      { return 0; }\n      static int round_error() throw()\n      { return 0; }\n\n      static const int min_exponent = 0;\n      static const int min_exponent10 = 0;\n      static const int max_exponent = 0;\n      static const int max_exponent10 = 0;\n\n      static const bool has_infinity = false;\n      static const bool has_quiet_NaN = false;\n      static const bool has_signaling_NaN = false;\n      static const float_denorm_style has_denorm = denorm_absent;\n      static const bool has_denorm_loss = false;\n\n      static int infinity() throw()\n      { return static_cast<int>(0); }\n      static int quiet_NaN() throw()\n      { return static_cast<int>(0); }\n      static int signaling_NaN() throw()\n      { return static_cast<int>(0); }\n      static int denorm_min() throw()\n      { return static_cast<int>(0); }\n\n      static const bool is_iec559 = false;\n      static const bool is_bounded = true;\n      static const bool is_modulo = true;\n\n      static const bool traps = __glibcxx_integral_traps;\n      static const bool tinyness_before = false;\n      static const float_round_style round_style = round_toward_zero;\n    };\n\n  /// numeric_limits<unsigned int> specialization.\n  template<>\n    struct numeric_limits<unsigned int>\n    {\n      static const bool is_specialized = true;\n\n      static unsigned int min() throw()\n      { return 0; }\n      static unsigned int max() throw()\n      { return __INT_MAX__ * 2U + 1; }\n\n      static const int digits = __glibcxx_digits (unsigned int);\n      static const int digits10 = __glibcxx_digits10 (unsigned int);\n      static const bool is_signed = false;\n      static const bool is_integer = true;\n      static const bool is_exact = true;\n      static const int radix = 2;\n      static unsigned int epsilon() throw()\n      { return 0; }\n      static unsigned int round_error() throw()\n      { return 0; }\n\n      static const int min_exponent = 0;\n      static const int min_exponent10 = 0;\n      static const int max_exponent = 0;\n      static const int max_exponent10 = 0;\n\n      static const bool has_infinity = false;\n      static const bool has_quiet_NaN = false;\n      static const bool has_signaling_NaN = false;\n      static const float_denorm_style has_denorm = denorm_absent;\n      static const bool has_denorm_loss = false;\n\n      static unsigned int infinity() throw()\n      { return static_cast<unsigned int>(0); }\n      static unsigned int quiet_NaN() throw()\n      { return static_cast<unsigned int>(0); }\n      static unsigned int signaling_NaN() throw()\n      { return static_cast<unsigned int>(0); }\n      static unsigned int denorm_min() throw()\n      { return static_cast<unsigned int>(0); }\n\n      static const bool is_iec559 = false;\n      static const bool is_bounded = true;\n      static const bool is_modulo = true;\n\n      static const bool traps = __glibcxx_integral_traps;\n      static const bool tinyness_before = false;\n      static const float_round_style round_style = round_toward_zero;\n    };\n\n  /// numeric_limits<long> specialization.\n  template<>\n    struct numeric_limits<long>\n    {\n      static const bool is_specialized = true;\n\n      static long min() throw()\n      { return -__LONG_MAX__ - 1; }\n      static long max() throw()\n      { return __LONG_MAX__; }\n\n      static const int digits = __glibcxx_digits (long);\n      static const int digits10 = __glibcxx_digits10 (long);\n      static const bool is_signed = true;\n      static const bool is_integer = true;\n      static const bool is_exact = true;\n      static const int radix = 2;\n      static long epsilon() throw()\n      { return 0; }\n      static long round_error() throw()\n      { return 0; }\n\n      static const int min_exponent = 0;\n      static const int min_exponent10 = 0;\n      static const int max_exponent = 0;\n      static const int max_exponent10 = 0;\n\n      static const bool has_infinity = false;\n      static const bool has_quiet_NaN = false;\n      static const bool has_signaling_NaN = false;\n      static const float_denorm_style has_denorm = denorm_absent;\n      static const bool has_denorm_loss = false;\n\n      static long infinity() throw()\n      { return static_cast<long>(0); }\n      static long quiet_NaN() throw()\n      { return static_cast<long>(0); }\n      static long signaling_NaN() throw()\n      { return static_cast<long>(0); }\n      static long denorm_min() throw()\n      { return static_cast<long>(0); }\n\n      static const bool is_iec559 = false;\n      static const bool is_bounded = true;\n      static const bool is_modulo = true;\n\n      static const bool traps = __glibcxx_integral_traps;\n      static const bool tinyness_before = false;\n      static const float_round_style round_style = round_toward_zero;\n    };\n\n  /// numeric_limits<unsigned long> specialization.\n  template<>\n    struct numeric_limits<unsigned long>\n    {\n      static const bool is_specialized = true;\n\n      static unsigned long min() throw()\n      { return 0; }\n      static unsigned long max() throw()\n      { return __LONG_MAX__ * 2UL + 1; }\n\n      static const int digits = __glibcxx_digits (unsigned long);\n      static const int digits10 = __glibcxx_digits10 (unsigned long);\n      static const bool is_signed = false;\n      static const bool is_integer = true;\n      static const bool is_exact = true;\n      static const int radix = 2;\n      static unsigned long epsilon() throw()\n      { return 0; }\n      static unsigned long round_error() throw()\n      { return 0; }\n\n      static const int min_exponent = 0;\n      static const int min_exponent10 = 0;\n      static const int max_exponent = 0;\n      static const int max_exponent10 = 0;\n\n      static const bool has_infinity = false;\n      static const bool has_quiet_NaN = false;\n      static const bool has_signaling_NaN = false;\n      static const float_denorm_style has_denorm = denorm_absent;\n      static const bool has_denorm_loss = false;\n\n      static unsigned long infinity() throw()\n      { return static_cast<unsigned long>(0); }\n      static unsigned long quiet_NaN() throw()\n      { return static_cast<unsigned long>(0); }\n      static unsigned long signaling_NaN() throw()\n      { return static_cast<unsigned long>(0); }\n      static unsigned long denorm_min() throw()\n      { return static_cast<unsigned long>(0); }\n\n      static const bool is_iec559 = false;\n      static const bool is_bounded = true;\n      static const bool is_modulo = true;\n\n      static const bool traps = __glibcxx_integral_traps;\n      static const bool tinyness_before = false;\n      static const float_round_style round_style = round_toward_zero;\n    };\n\n  /// numeric_limits<long long> specialization.\n  template<>\n    struct numeric_limits<long long>\n    {\n      static const bool is_specialized = true;\n\n      static long long min() throw()\n      { return -__LONG_LONG_MAX__ - 1; }\n      static long long max() throw()\n      { return __LONG_LONG_MAX__; }\n\n      static const int digits = __glibcxx_digits (long long);\n      static const int digits10 = __glibcxx_digits10 (long long);\n      static const bool is_signed = true;\n      static const bool is_integer = true;\n      static const bool is_exact = true;\n      static const int radix = 2;\n      static long long epsilon() throw()\n      { return 0; }\n      static long long round_error() throw()\n      { return 0; }\n\n      static const int min_exponent = 0;\n      static const int min_exponent10 = 0;\n      static const int max_exponent = 0;\n      static const int max_exponent10 = 0;\n\n      static const bool has_infinity = false;\n      static const bool has_quiet_NaN = false;\n      static const bool has_signaling_NaN = false;\n      static const float_denorm_style has_denorm = denorm_absent;\n      static const bool has_denorm_loss = false;\n\n      static long long infinity() throw()\n      { return static_cast<long long>(0); }\n      static long long quiet_NaN() throw()\n      { return static_cast<long long>(0); }\n      static long long signaling_NaN() throw()\n      { return static_cast<long long>(0); }\n      static long long denorm_min() throw()\n      { return static_cast<long long>(0); }\n\n      static const bool is_iec559 = false;\n      static const bool is_bounded = true;\n      static const bool is_modulo = true;\n\n      static const bool traps = __glibcxx_integral_traps;\n      static const bool tinyness_before = false;\n      static const float_round_style round_style = round_toward_zero;\n    };\n\n  /// numeric_limits<unsigned long long> specialization.\n  template<>\n    struct numeric_limits<unsigned long long>\n    {\n      static const bool is_specialized = true;\n\n      static unsigned long long min() throw()\n      { return 0; }\n      static unsigned long long max() throw()\n      { return __LONG_LONG_MAX__ * 2ULL + 1; }\n\n      static const int digits = __glibcxx_digits (unsigned long long);\n      static const int digits10 = __glibcxx_digits10 (unsigned long long);\n      static const bool is_signed = false;\n      static const bool is_integer = true;\n      static const bool is_exact = true;\n      static const int radix = 2;\n      static unsigned long long epsilon() throw()\n      { return 0; }\n      static unsigned long long round_error() throw()\n      { return 0; }\n\n      static const int min_exponent = 0;\n      static const int min_exponent10 = 0;\n      static const int max_exponent = 0;\n      static const int max_exponent10 = 0;\n\n      static const bool has_infinity = false;\n      static const bool has_quiet_NaN = false;\n      static const bool has_signaling_NaN = false;\n      static const float_denorm_style has_denorm = denorm_absent;\n      static const bool has_denorm_loss = false;\n\n      static unsigned long long infinity() throw()\n      { return static_cast<unsigned long long>(0); }\n      static unsigned long long quiet_NaN() throw()\n      { return static_cast<unsigned long long>(0); }\n      static unsigned long long signaling_NaN() throw()\n      { return static_cast<unsigned long long>(0); }\n      static unsigned long long denorm_min() throw()\n      { return static_cast<unsigned long long>(0); }\n\n      static const bool is_iec559 = false;\n      static const bool is_bounded = true;\n      static const bool is_modulo = true;\n\n      static const bool traps = __glibcxx_integral_traps;\n      static const bool tinyness_before = false;\n      static const float_round_style round_style = round_toward_zero;\n    };\n\n  /// numeric_limits<float> specialization.\n  template<>\n    struct numeric_limits<float>\n    {\n      static const bool is_specialized = true;\n\n      static float min() throw()\n      { return __FLT_MIN__; }\n      static float max() throw()\n      { return __FLT_MAX__; }\n\n      static const int digits = __FLT_MANT_DIG__;\n      static const int digits10 = __FLT_DIG__;\n      static const bool is_signed = true;\n      static const bool is_integer = false;\n      static const bool is_exact = false;\n      static const int radix = __FLT_RADIX__;\n      static float epsilon() throw()\n      { return __FLT_EPSILON__; }\n      static float round_error() throw()\n      { return 0.5F; }\n\n      static const int min_exponent = __FLT_MIN_EXP__;\n      static const int min_exponent10 = __FLT_MIN_10_EXP__;\n      static const int max_exponent = __FLT_MAX_EXP__;\n      static const int max_exponent10 = __FLT_MAX_10_EXP__;\n\n      static const bool has_infinity = __FLT_HAS_INFINITY__;\n      static const bool has_quiet_NaN = __FLT_HAS_QUIET_NAN__;\n      static const bool has_signaling_NaN = has_quiet_NaN;\n      static const float_denorm_style has_denorm\n\t= bool(__FLT_HAS_DENORM__) ? denorm_present : denorm_absent;\n      static const bool has_denorm_loss = __glibcxx_float_has_denorm_loss;\n\n      static float infinity() throw()\n      { return __builtin_huge_valf (); }\n      static float quiet_NaN() throw()\n      { return __builtin_nanf (\"\"); }\n      static float signaling_NaN() throw()\n      { return __builtin_nansf (\"\"); }\n      static float denorm_min() throw()\n      { return __FLT_DENORM_MIN__; }\n\n      static const bool is_iec559\n\t= has_infinity && has_quiet_NaN && has_denorm == denorm_present;\n      static const bool is_bounded = true;\n      static const bool is_modulo = false;\n\n      static const bool traps = __glibcxx_float_traps;\n      static const bool tinyness_before = __glibcxx_float_tinyness_before;\n      static const float_round_style round_style = round_to_nearest;\n    };\n\n#undef __glibcxx_float_has_denorm_loss\n#undef __glibcxx_float_traps\n#undef __glibcxx_float_tinyness_before\n\n  /// numeric_limits<double> specialization.\n  template<>\n    struct numeric_limits<double>\n    {\n      static const bool is_specialized = true;\n\n      static double min() throw()\n      { return __DBL_MIN__; }\n      static double max() throw()\n      { return __DBL_MAX__; }\n\n      static const int digits = __DBL_MANT_DIG__;\n      static const int digits10 = __DBL_DIG__;\n      static const bool is_signed = true;\n      static const bool is_integer = false;\n      static const bool is_exact = false;\n      static const int radix = __FLT_RADIX__;\n      static double epsilon() throw()\n      { return __DBL_EPSILON__; }\n      static double round_error() throw()\n      { return 0.5; }\n\n      static const int min_exponent = __DBL_MIN_EXP__;\n      static const int min_exponent10 = __DBL_MIN_10_EXP__;\n      static const int max_exponent = __DBL_MAX_EXP__;\n      static const int max_exponent10 = __DBL_MAX_10_EXP__;\n\n      static const bool has_infinity = __DBL_HAS_INFINITY__;\n      static const bool has_quiet_NaN = __DBL_HAS_QUIET_NAN__;\n      static const bool has_signaling_NaN = has_quiet_NaN;\n      static const float_denorm_style has_denorm\n\t= bool(__DBL_HAS_DENORM__) ? denorm_present : denorm_absent;\n      static const bool has_denorm_loss = __glibcxx_double_has_denorm_loss;\n\n      static double infinity() throw()\n      { return __builtin_huge_val(); }\n      static double quiet_NaN() throw()\n      { return __builtin_nan (\"\"); }\n      static double signaling_NaN() throw()\n      { return __builtin_nans (\"\"); }\n      static double denorm_min() throw()\n      { return __DBL_DENORM_MIN__; }\n\n      static const bool is_iec559\n\t= has_infinity && has_quiet_NaN && has_denorm == denorm_present;\n      static const bool is_bounded = true;\n      static const bool is_modulo = false;\n\n      static const bool traps = __glibcxx_double_traps;\n      static const bool tinyness_before = __glibcxx_double_tinyness_before;\n      static const float_round_style round_style = round_to_nearest;\n    };\n\n#undef __glibcxx_double_has_denorm_loss\n#undef __glibcxx_double_traps\n#undef __glibcxx_double_tinyness_before\n\n  /// numeric_limits<long double> specialization.\n  template<>\n    struct numeric_limits<long double>\n    {\n      static const bool is_specialized = true;\n\n      static long double min() throw()\n      { return __LDBL_MIN__; }\n      static long double max() throw()\n      { return __LDBL_MAX__; }\n\n      static const int digits = __LDBL_MANT_DIG__;\n      static const int digits10 = __LDBL_DIG__;\n      static const bool is_signed = true;\n      static const bool is_integer = false;\n      static const bool is_exact = false;\n      static const int radix = __FLT_RADIX__;\n      static long double epsilon() throw()\n      { return __LDBL_EPSILON__; }\n      static long double round_error() throw()\n      { return 0.5L; }\n\n      static const int min_exponent = __LDBL_MIN_EXP__;\n      static const int min_exponent10 = __LDBL_MIN_10_EXP__;\n      static const int max_exponent = __LDBL_MAX_EXP__;\n      static const int max_exponent10 = __LDBL_MAX_10_EXP__;\n\n      static const bool has_infinity = __LDBL_HAS_INFINITY__;\n      static const bool has_quiet_NaN = __LDBL_HAS_QUIET_NAN__;\n      static const bool has_signaling_NaN = has_quiet_NaN;\n      static const float_denorm_style has_denorm\n\t= bool(__LDBL_HAS_DENORM__) ? denorm_present : denorm_absent;\n      static const bool has_denorm_loss\n\t= __glibcxx_long_double_has_denorm_loss;\n\n      static long double infinity() throw()\n      { return __builtin_huge_vall (); }\n      static long double quiet_NaN() throw()\n      { return __builtin_nanl (\"\"); }\n      static long double signaling_NaN() throw()\n      { return __builtin_nansl (\"\"); }\n      static long double denorm_min() throw()\n      { return __LDBL_DENORM_MIN__; }\n\n      static const bool is_iec559\n\t= has_infinity && has_quiet_NaN && has_denorm == denorm_present;\n      static const bool is_bounded = true;\n      static const bool is_modulo = false;\n\n      static const bool traps = __glibcxx_long_double_traps;\n      static const bool tinyness_before = __glibcxx_long_double_tinyness_before;\n      static const float_round_style round_style = round_to_nearest;\n    };\n\n#undef __glibcxx_long_double_has_denorm_loss\n#undef __glibcxx_long_double_traps\n#undef __glibcxx_long_double_tinyness_before\n\n_GLIBCXX_END_NAMESPACE\n\n#undef __glibcxx_signed\n#undef __glibcxx_min\n#undef __glibcxx_max\n#undef __glibcxx_digits\n#undef __glibcxx_digits10\n\n#endif // _GLIBCXX_NUMERIC_LIMITS\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/list",
    "content": "// <list> -*- C++ -*-\n\n// Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n/*\n *\n * Copyright (c) 1994\n * Hewlett-Packard Company\n *\n * Permission to use, copy, modify, distribute and sell this software\n * and its documentation for any purpose is hereby granted without fee,\n * provided that the above copyright notice appear in all copies and\n * that both that copyright notice and this permission notice appear\n * in supporting documentation.  Hewlett-Packard Company makes no\n * representations about the suitability of this software for any\n * purpose.  It is provided \"as is\" without express or implied warranty.\n *\n *\n * Copyright (c) 1996,1997\n * Silicon Graphics Computer Systems, Inc.\n *\n * Permission to use, copy, modify, distribute and sell this software\n * and its documentation for any purpose is hereby granted without fee,\n * provided that the above copyright notice appear in all copies and\n * that both that copyright notice and this permission notice appear\n * in supporting documentation.  Silicon Graphics makes no\n * representations about the suitability of this software for any\n * purpose.  It is provided \"as is\" without express or implied warranty.\n */\n\n/** @file include/list\n *  This is a Standard C++ Library header.\n */\n\n#ifndef _GLIBCXX_LIST\n#define _GLIBCXX_LIST 1\n\n#pragma GCC system_header\n\n#include <bits/functexcept.h>\n#include <bits/stl_algobase.h>\n#include <bits/allocator.h>\n#include <bits/stl_construct.h>\n#include <bits/stl_uninitialized.h>\n#include <bits/stl_list.h>\n\n#ifndef _GLIBCXX_EXPORT_TEMPLATE\n# include <bits/list.tcc>\n#endif\n\n#ifdef _GLIBCXX_DEBUG\n# include <debug/list>\n#endif\n\n#endif /* _GLIBCXX_LIST */\n\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/locale",
    "content": "// Locale support -*- C++ -*-\n\n// Copyright (C) 1997, 1998, 1999, 2002, 2003 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n//\n// ISO C++ 14882: 22.1  Locales\n//\n\n/** @file locale\n *  This is a Standard C++ Library header.\n */\n\n#ifndef _GLIBCXX_LOCALE\n#define _GLIBCXX_LOCALE\t1\n\n#pragma GCC system_header\n\n#include <bits/localefwd.h>\n#include <bits/locale_classes.h>\n#include <bits/locale_facets.h>\n#include <bits/locale_facets.tcc>\n\n#endif /* _GLIBCXX_LOCALE */\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/map",
    "content": "// <map> -*- C++ -*-\n\n// Copyright (C) 2001, 2002 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n/*\n *\n * Copyright (c) 1994\n * Hewlett-Packard Company\n *\n * Permission to use, copy, modify, distribute and sell this software\n * and its documentation for any purpose is hereby granted without fee,\n * provided that the above copyright notice appear in all copies and\n * that both that copyright notice and this permission notice appear\n * in supporting documentation.  Hewlett-Packard Company makes no\n * representations about the suitability of this software for any\n * purpose.  It is provided \"as is\" without express or implied warranty.\n *\n *\n * Copyright (c) 1996,1997\n * Silicon Graphics Computer Systems, Inc.\n *\n * Permission to use, copy, modify, distribute and sell this software\n * and its documentation for any purpose is hereby granted without fee,\n * provided that the above copyright notice appear in all copies and\n * that both that copyright notice and this permission notice appear\n * in supporting documentation.  Silicon Graphics makes no\n * representations about the suitability of this software for any\n * purpose.  It is provided \"as is\" without express or implied warranty.\n */\n\n/** @file include/map\n *  This is a Standard C++ Library header.\n */\n\n#ifndef _GLIBCXX_MAP\n#define _GLIBCXX_MAP 1\n\n#pragma GCC system_header\n\n#include <bits/stl_tree.h>\n#include <bits/stl_map.h>\n#include <bits/stl_multimap.h>\n\n#ifdef _GLIBCXX_DEBUG\n# include <debug/map>\n#endif\n\n#endif /* _GLIBCXX_MAP */\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/memory",
    "content": "// <memory> -*- C++ -*-\n\n// Copyright (C) 2001, 2002, 2004, 2005 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n/*\n * Copyright (c) 1997-1999\n * Silicon Graphics Computer Systems, Inc.\n *\n * Permission to use, copy, modify, distribute and sell this software\n * and its documentation for any purpose is hereby granted without fee,\n * provided that the above copyright notice appear in all copies and\n * that both that copyright notice and this permission notice appear\n * in supporting documentation.  Silicon Graphics makes no\n * representations about the suitability of this software for any\n * purpose.  It is provided \"as is\" without express or implied warranty.\n *\n */\n\n/** @file include/memory\n *  This is a Standard C++ Library header.\n */\n\n#ifndef _GLIBCXX_MEMORY\n#define _GLIBCXX_MEMORY 1\n\n#pragma GCC system_header\n\n#include <bits/stl_algobase.h>\n#include <bits/allocator.h>\n#include <bits/stl_construct.h>\n#include <bits/stl_iterator_base_types.h> //for iterator_traits\n#include <bits/stl_uninitialized.h>\n#include <bits/stl_raw_storage_iter.h>\n#include <debug/debug.h>\n#include <limits>\n\n_GLIBCXX_BEGIN_NAMESPACE(std)\n\n  /**\n   *  @if maint\n   *  This is a helper function.  The unused second parameter exists to\n   *  permit the real get_temporary_buffer to use template parameter deduction.\n   *\n   *  XXX This should perhaps use the pool.\n   *  @endif\n   */\n  template<typename _Tp>\n    pair<_Tp*, ptrdiff_t>\n    __get_temporary_buffer(ptrdiff_t __len, _Tp*)\n    {\n      const ptrdiff_t __max = numeric_limits<ptrdiff_t>::max() / sizeof(_Tp);\n      if (__len > __max)\n\t__len = __max;\n      \n      while (__len > 0) \n\t{\n\t  _Tp* __tmp = static_cast<_Tp*>(::operator new(__len * sizeof(_Tp), \n\t\t\t\t\t\t\tnothrow));\n\t  if (__tmp != 0)\n\t    return pair<_Tp*, ptrdiff_t>(__tmp, __len);\n\t  __len /= 2;\n\t}\n      return pair<_Tp*, ptrdiff_t>(static_cast<_Tp*>(0), 0);\n    }\n\n  /**\n   *  @brief Allocates a temporary buffer.\n   *  @param  len  The number of objects of type Tp.\n   *  @return See full description.\n   *\n   *  Reinventing the wheel, but this time with prettier spokes!\n   *\n   *  This function tries to obtain storage for @c len adjacent Tp\n   *  objects.  The objects themselves are not constructed, of course.\n   *  A pair<> is returned containing \"the buffer s address and\n   *  capacity (in the units of sizeof(Tp)), or a pair of 0 values if\n   *  no storage can be obtained.\"  Note that the capacity obtained\n   *  may be less than that requested if the memory is unavailable;\n   *  you should compare len with the .second return value.\n   *\n   * Provides the nothrow exception guarantee.\n   */\n  template<typename _Tp>\n    inline pair<_Tp*, ptrdiff_t>\n    get_temporary_buffer(ptrdiff_t __len)\n    { return std::__get_temporary_buffer(__len, static_cast<_Tp*>(0)); }\n\n  /**\n   *  @brief The companion to get_temporary_buffer().\n   *  @param  p  A buffer previously allocated by get_temporary_buffer.\n   *  @return   None.\n   *\n   *  Frees the memory pointed to by p.\n   */\n  template<typename _Tp>\n    void\n    return_temporary_buffer(_Tp* __p)\n    { ::operator delete(__p, nothrow); }\n\n  /**\n   *  A wrapper class to provide auto_ptr with reference semantics.\n   *  For example, an auto_ptr can be assigned (or constructed from)\n   *  the result of a function which returns an auto_ptr by value.\n   *\n   *  All the auto_ptr_ref stuff should happen behind the scenes.\n   */\n  template<typename _Tp1>\n    struct auto_ptr_ref\n    {\n      _Tp1* _M_ptr;\n      \n      explicit\n      auto_ptr_ref(_Tp1* __p): _M_ptr(__p) { }\n    };\n\n\n  /**\n   *  @brief  A simple smart pointer providing strict ownership semantics.\n   *\n   *  The Standard says:\n   *  <pre>\n   *  An @c auto_ptr owns the object it holds a pointer to.  Copying\n   *  an @c auto_ptr copies the pointer and transfers ownership to the\n   *  destination.  If more than one @c auto_ptr owns the same object\n   *  at the same time the behavior of the program is undefined.\n   *\n   *  The uses of @c auto_ptr include providing temporary\n   *  exception-safety for dynamically allocated memory, passing\n   *  ownership of dynamically allocated memory to a function, and\n   *  returning dynamically allocated memory from a function.  @c\n   *  auto_ptr does not meet the CopyConstructible and Assignable\n   *  requirements for Standard Library <a\n   *  href=\"tables.html#65\">container</a> elements and thus\n   *  instantiating a Standard Library container with an @c auto_ptr\n   *  results in undefined behavior.\n   *  </pre>\n   *  Quoted from [20.4.5]/3.\n   *\n   *  Good examples of what can and cannot be done with auto_ptr can\n   *  be found in the libstdc++ testsuite.\n   *\n   *  @if maint\n   *  _GLIBCXX_RESOLVE_LIB_DEFECTS\n   *  127.  auto_ptr<> conversion issues\n   *  These resolutions have all been incorporated.\n   *  @endif\n   */\n  template<typename _Tp>\n    class auto_ptr\n    {\n    private:\n      _Tp* _M_ptr;\n      \n    public:\n      /// The pointed-to type.\n      typedef _Tp element_type;\n      \n      /**\n       *  @brief  An %auto_ptr is usually constructed from a raw pointer.\n       *  @param  p  A pointer (defaults to NULL).\n       *\n       *  This object now @e owns the object pointed to by @a p.\n       */\n      explicit\n      auto_ptr(element_type* __p = 0) throw() : _M_ptr(__p) { }\n\n      /**\n       *  @brief  An %auto_ptr can be constructed from another %auto_ptr.\n       *  @param  a  Another %auto_ptr of the same type.\n       *\n       *  This object now @e owns the object previously owned by @a a,\n       *  which has given up ownsership.\n       */\n      auto_ptr(auto_ptr& __a) throw() : _M_ptr(__a.release()) { }\n\n      /**\n       *  @brief  An %auto_ptr can be constructed from another %auto_ptr.\n       *  @param  a  Another %auto_ptr of a different but related type.\n       *\n       *  A pointer-to-Tp1 must be convertible to a\n       *  pointer-to-Tp/element_type.\n       *\n       *  This object now @e owns the object previously owned by @a a,\n       *  which has given up ownsership.\n       */\n      template<typename _Tp1>\n        auto_ptr(auto_ptr<_Tp1>& __a) throw() : _M_ptr(__a.release()) { }\n\n      /**\n       *  @brief  %auto_ptr assignment operator.\n       *  @param  a  Another %auto_ptr of the same type.\n       *\n       *  This object now @e owns the object previously owned by @a a,\n       *  which has given up ownsership.  The object that this one @e\n       *  used to own and track has been deleted.\n       */\n      auto_ptr&\n      operator=(auto_ptr& __a) throw()\n      {\n\treset(__a.release());\n\treturn *this;\n      }\n\n      /**\n       *  @brief  %auto_ptr assignment operator.\n       *  @param  a  Another %auto_ptr of a different but related type.\n       *\n       *  A pointer-to-Tp1 must be convertible to a pointer-to-Tp/element_type.\n       *\n       *  This object now @e owns the object previously owned by @a a,\n       *  which has given up ownsership.  The object that this one @e\n       *  used to own and track has been deleted.\n       */\n      template<typename _Tp1>\n        auto_ptr&\n        operator=(auto_ptr<_Tp1>& __a) throw()\n        {\n\t  reset(__a.release());\n\t  return *this;\n\t}\n\n      /**\n       *  When the %auto_ptr goes out of scope, the object it owns is\n       *  deleted.  If it no longer owns anything (i.e., @c get() is\n       *  @c NULL), then this has no effect.\n       *\n       *  @if maint\n       *  The C++ standard says there is supposed to be an empty throw\n       *  specification here, but omitting it is standard conforming.  Its\n       *  presence can be detected only if _Tp::~_Tp() throws, but this is\n       *  prohibited.  [17.4.3.6]/2\n       *  @endif\n       */\n      ~auto_ptr() { delete _M_ptr; }\n      \n      /**\n       *  @brief  Smart pointer dereferencing.\n       *\n       *  If this %auto_ptr no longer owns anything, then this\n       *  operation will crash.  (For a smart pointer, \"no longer owns\n       *  anything\" is the same as being a null pointer, and you know\n       *  what happens when you dereference one of those...)\n       */\n      element_type&\n      operator*() const throw() \n      {\n\t_GLIBCXX_DEBUG_ASSERT(_M_ptr != 0);\n\treturn *_M_ptr; \n      }\n      \n      /**\n       *  @brief  Smart pointer dereferencing.\n       *\n       *  This returns the pointer itself, which the language then will\n       *  automatically cause to be dereferenced.\n       */\n      element_type*\n      operator->() const throw() \n      {\n\t_GLIBCXX_DEBUG_ASSERT(_M_ptr != 0);\n\treturn _M_ptr; \n      }\n      \n      /**\n       *  @brief  Bypassing the smart pointer.\n       *  @return  The raw pointer being managed.\n       *\n       *  You can get a copy of the pointer that this object owns, for\n       *  situations such as passing to a function which only accepts\n       *  a raw pointer.\n       *\n       *  @note  This %auto_ptr still owns the memory.\n       */\n      element_type*\n      get() const throw() { return _M_ptr; }\n      \n      /**\n       *  @brief  Bypassing the smart pointer.\n       *  @return  The raw pointer being managed.\n       *\n       *  You can get a copy of the pointer that this object owns, for\n       *  situations such as passing to a function which only accepts\n       *  a raw pointer.\n       *\n       *  @note  This %auto_ptr no longer owns the memory.  When this object\n       *  goes out of scope, nothing will happen.\n       */\n      element_type*\n      release() throw()\n      {\n\telement_type* __tmp = _M_ptr;\n\t_M_ptr = 0;\n\treturn __tmp;\n      }\n      \n      /**\n       *  @brief  Forcibly deletes the managed object.\n       *  @param  p  A pointer (defaults to NULL).\n       *\n       *  This object now @e owns the object pointed to by @a p.  The\n       *  previous object has been deleted.\n       */\n      void\n      reset(element_type* __p = 0) throw()\n      {\n\tif (__p != _M_ptr)\n\t  {\n\t    delete _M_ptr;\n\t    _M_ptr = __p;\n\t  }\n      }\n      \n      /** \n       *  @brief  Automatic conversions\n       *\n       *  These operations convert an %auto_ptr into and from an auto_ptr_ref\n       *  automatically as needed.  This allows constructs such as\n       *  @code\n       *    auto_ptr<Derived>  func_returning_auto_ptr(.....);\n       *    ...\n       *    auto_ptr<Base> ptr = func_returning_auto_ptr(.....);\n       *  @endcode\n       */\n      auto_ptr(auto_ptr_ref<element_type> __ref) throw()\n      : _M_ptr(__ref._M_ptr) { }\n      \n      auto_ptr&\n      operator=(auto_ptr_ref<element_type> __ref) throw()\n      {\n\tif (__ref._M_ptr != this->get())\n\t  {\n\t    delete _M_ptr;\n\t    _M_ptr = __ref._M_ptr;\n\t  }\n\treturn *this;\n      }\n      \n      template<typename _Tp1>\n        operator auto_ptr_ref<_Tp1>() throw()\n        { return auto_ptr_ref<_Tp1>(this->release()); }\n\n      template<typename _Tp1>\n        operator auto_ptr<_Tp1>() throw()\n        { return auto_ptr<_Tp1>(this->release()); }\n  };\n\n_GLIBCXX_END_NAMESPACE\n\n#endif /* _GLIBCXX_MEMORY */\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/new",
    "content": "// The -*- C++ -*- dynamic memory management header.\n\n// Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,\n// 2003, 2004, 2005, 2006, 2007\n// Free Software Foundation\n\n// This file is part of GCC.\n//\n// GCC is free software; you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation; either version 2, or (at your option)\n// any later version.\n// \n// GCC is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n// \n// You should have received a copy of the GNU General Public License\n// along with GCC; see the file COPYING.  If not, write to\n// the Free Software Foundation, 51 Franklin Street, Fifth Floor,\n// Boston, MA 02110-1301, USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n/** @file new\n *  This is a Standard C++ Library header.\n *\n *  The header @c new defines several functions to manage dynamic memory and\n *  handling memory allocation errors; see\n *  http://gcc.gnu.org/onlinedocs/libstdc++/18_support/howto.html#4 for more.\n */\n\n#ifndef _NEW\n#define _NEW\n\n#include <cstddef>\n#include <exception>\n\n#pragma GCC visibility push(default)\n\nextern \"C++\" {\n\nnamespace std \n{\n  /**\n   *  @brief  Exception possibly thrown by @c new.\n   *\n   *  @c bad_alloc (or classes derived from it) is used to report allocation\n   *  errors from the throwing forms of @c new.  */\n  class bad_alloc : public exception \n  {\n  public:\n    bad_alloc() throw() { }\n\n    // This declaration is not useless:\n    // http://gcc.gnu.org/onlinedocs/gcc-3.0.2/gcc_6.html#SEC118\n    virtual ~bad_alloc() throw();\n\n    // See comment in eh_exception.cc.\n    virtual const char* what() const throw();\n  };\n\n  struct nothrow_t { };\n\n  extern const nothrow_t nothrow;\n\n  /** If you write your own error handler to be called by @c new, it must\n   *  be of this type.  */\n  typedef void (*new_handler)();\n\n  /// Takes a replacement handler as the argument, returns the\n  /// previous handler.\n  new_handler set_new_handler(new_handler) throw();\n} // namespace std\n\n//@{\n/** These are replaceable signatures:\n *  - normal single new and delete (no arguments, throw @c bad_alloc on error)\n *  - normal array new and delete (same)\n *  - @c nothrow single new and delete (take a @c nothrow argument, return\n *    @c NULL on error)\n *  - @c nothrow array new and delete (same)\n *\n *  Placement new and delete signatures (take a memory address argument,\n *  does nothing) may not be replaced by a user's program.\n*/\nvoid* operator new(std::size_t) throw (std::bad_alloc);\nvoid* operator new[](std::size_t) throw (std::bad_alloc);\nvoid operator delete(void*) throw();\nvoid operator delete[](void*) throw();\nvoid* operator new(std::size_t, const std::nothrow_t&) throw();\nvoid* operator new[](std::size_t, const std::nothrow_t&) throw();\nvoid operator delete(void*, const std::nothrow_t&) throw();\nvoid operator delete[](void*, const std::nothrow_t&) throw();\n\n// Default placement versions of operator new.\ninline void* operator new(std::size_t, void* __p) throw() { return __p; }\ninline void* operator new[](std::size_t, void* __p) throw() { return __p; }\n\n// Default placement versions of operator delete.\ninline void  operator delete  (void*, void*) throw() { }\ninline void  operator delete[](void*, void*) throw() { }\n//@}\n} // extern \"C++\"\n\n#pragma GCC visibility pop\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/numeric",
    "content": "// <numeric> -*- C++ -*-\n\n// Copyright (C) 2001, 2002 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n/*\n *\n * Copyright (c) 1994\n * Hewlett-Packard Company\n *\n * Permission to use, copy, modify, distribute and sell this software\n * and its documentation for any purpose is hereby granted without fee,\n * provided that the above copyright notice appear in all copies and\n * that both that copyright notice and this permission notice appear\n * in supporting documentation.  Hewlett-Packard Company makes no\n * representations about the suitability of this software for any\n * purpose.  It is provided \"as is\" without express or implied warranty.\n *\n *\n * Copyright (c) 1996,1997\n * Silicon Graphics Computer Systems, Inc.\n *\n * Permission to use, copy, modify, distribute and sell this software\n * and its documentation for any purpose is hereby granted without fee,\n * provided that the above copyright notice appear in all copies and\n * that both that copyright notice and this permission notice appear\n * in supporting documentation.  Silicon Graphics makes no\n * representations about the suitability of this software for any\n * purpose.  It is provided \"as is\" without express or implied warranty.\n */\n\n/** @file include/numeric\n *  This is a Standard C++ Library header.\n */\n\n#ifndef _GLIBCXX_NUMERIC\n#define _GLIBCXX_NUMERIC 1\n\n#pragma GCC system_header\n\n#include <bits/c++config.h>\n#include <cstddef>\n#include <iterator>\n#include <bits/stl_function.h>\n#include <bits/stl_numeric.h>\n\n#endif /* _GLIBCXX_NUMERIC */\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/ostream",
    "content": "// Output streams -*- C++ -*-\n\n// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,\n// 2006, 2007\n// Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n/** @file ostream\n *  This is a Standard C++ Library header.\n */\n\n//\n// ISO C++ 14882: 27.6.2  Output streams\n//\n\n#ifndef _GLIBCXX_OSTREAM\n#define _GLIBCXX_OSTREAM 1\n\n#pragma GCC system_header\n\n#include <ios>\n#include <bits/ostream_insert.h>\n\n_GLIBCXX_BEGIN_NAMESPACE(std)\n\n  // [27.6.2.1] Template class basic_ostream\n  /**\n   *  @brief  Controlling output.\n   *\n   *  This is the base class for all output streams.  It provides text\n   *  formatting of all builtin types, and communicates with any class\n   *  derived from basic_streambuf to do the actual output.\n  */\n  template<typename _CharT, typename _Traits>\n    class basic_ostream : virtual public basic_ios<_CharT, _Traits>\n    {\n    public:\n      // Types (inherited from basic_ios (27.4.4)):\n      typedef _CharT                     \t\tchar_type;\n      typedef typename _Traits::int_type \t\tint_type;\n      typedef typename _Traits::pos_type \t\tpos_type;\n      typedef typename _Traits::off_type \t\toff_type;\n      typedef _Traits                    \t\ttraits_type;\n      \n      // Non-standard Types:\n      typedef basic_streambuf<_CharT, _Traits> \t\t__streambuf_type;\n      typedef basic_ios<_CharT, _Traits>\t\t__ios_type;\n      typedef basic_ostream<_CharT, _Traits>\t\t__ostream_type;\n      typedef num_put<_CharT, ostreambuf_iterator<_CharT, _Traits> >        \n      \t\t\t\t\t\t\t__num_put_type;\n      typedef ctype<_CharT>           \t\t\t__ctype_type;\n\n      // [27.6.2.2] constructor/destructor\n      /**\n       *  @brief  Base constructor.\n       *\n       *  This ctor is almost never called by the user directly, rather from\n       *  derived classes' initialization lists, which pass a pointer to\n       *  their own stream buffer.\n      */\n      explicit \n      basic_ostream(__streambuf_type* __sb)\n      { this->init(__sb); }\n\n      /**\n       *  @brief  Base destructor.\n       *\n       *  This does very little apart from providing a virtual base dtor.\n      */\n      virtual \n      ~basic_ostream() { }\n\n      // [27.6.2.3] prefix/suffix\n      class sentry;\n      friend class sentry;\n      \n      // [27.6.2.5] formatted output\n      // [27.6.2.5.3]  basic_ostream::operator<<\n      //@{\n      /**\n       *  @brief  Interface for manipulators.\n       *\n       *  Manuipulators such as @c std::endl and @c std::hex use these\n       *  functions in constructs like \"std::cout << std::endl\".  For more\n       *  information, see the iomanip header.\n      */\n      __ostream_type&\n      operator<<(__ostream_type& (*__pf)(__ostream_type&))\n      {\n\t// _GLIBCXX_RESOLVE_LIB_DEFECTS\n\t// DR 60. What is a formatted input function?\n\t// The inserters for manipulators are *not* formatted output functions.\n\treturn __pf(*this);\n      }\n\n      __ostream_type&\n      operator<<(__ios_type& (*__pf)(__ios_type&))\n      {\n\t// _GLIBCXX_RESOLVE_LIB_DEFECTS\n\t// DR 60. What is a formatted input function?\n\t// The inserters for manipulators are *not* formatted output functions.\n\t__pf(*this);\n\treturn *this;\n      }\n\n      __ostream_type&\n      operator<<(ios_base& (*__pf) (ios_base&))\n      {\n\t// _GLIBCXX_RESOLVE_LIB_DEFECTS\n\t// DR 60. What is a formatted input function?\n\t// The inserters for manipulators are *not* formatted output functions.\n\t__pf(*this);\n\treturn *this;\n      }\n      //@}\n\n      // [27.6.2.5.2] arithmetic inserters\n      /**\n       *  @name Arithmetic Inserters\n       *\n       *  All the @c operator<< functions (aka <em>formatted output\n       *  functions</em>) have some common behavior.  Each starts by\n       *  constructing a temporary object of type std::basic_ostream::sentry.\n       *  This can have several effects, concluding with the setting of a\n       *  status flag; see the sentry documentation for more.\n       *\n       *  If the sentry status is good, the function tries to generate\n       *  whatever data is appropriate for the type of the argument.\n       *\n       *  If an exception is thrown during insertion, ios_base::badbit\n       *  will be turned on in the stream's error state without causing an\n       *  ios_base::failure to be thrown.  The original exception will then\n       *  be rethrown.\n      */\n      //@{\n      /**\n       *  @brief  Basic arithmetic inserters\n       *  @param  A variable of builtin type.\n       *  @return  @c *this if successful\n       *\n       *  These functions use the stream's current locale (specifically, the\n       *  @c num_get facet) to perform numeric formatting.\n      */\n      __ostream_type& \n      operator<<(long __n)\n      { return _M_insert(__n); }\n      \n      __ostream_type& \n      operator<<(unsigned long __n)\n      { return _M_insert(__n); }\t\n\n      __ostream_type& \n      operator<<(bool __n)\n      { return _M_insert(__n); }\n\n      __ostream_type& \n      operator<<(short __n);\n\n      __ostream_type& \n      operator<<(unsigned short __n)\n      {\n\t// _GLIBCXX_RESOLVE_LIB_DEFECTS\n\t// 117. basic_ostream uses nonexistent num_put member functions.\n\treturn _M_insert(static_cast<unsigned long>(__n));\n      }\n\n      __ostream_type& \n      operator<<(int __n);\n\n      __ostream_type& \n      operator<<(unsigned int __n)\n      {\n\t// _GLIBCXX_RESOLVE_LIB_DEFECTS\n\t// 117. basic_ostream uses nonexistent num_put member functions.\n\treturn _M_insert(static_cast<unsigned long>(__n));\n      }\n\n#ifdef _GLIBCXX_USE_LONG_LONG\n      __ostream_type& \n      operator<<(long long __n)\n      { return _M_insert(__n); }\n\n      __ostream_type& \n      operator<<(unsigned long long __n)\n      { return _M_insert(__n); }\t\n#endif\n\n      __ostream_type& \n      operator<<(double __f)\n      { return _M_insert(__f); }\n\n      __ostream_type& \n      operator<<(float __f)\n      {\n\t// _GLIBCXX_RESOLVE_LIB_DEFECTS\n\t// 117. basic_ostream uses nonexistent num_put member functions.\n\treturn _M_insert(static_cast<double>(__f));\n      }\n\n      __ostream_type& \n      operator<<(long double __f)\n      { return _M_insert(__f); }\n\n      __ostream_type& \n      operator<<(const void* __p)\n      { return _M_insert(__p); }\n\n      /**\n       *  @brief  Extracting from another streambuf.\n       *  @param  sb  A pointer to a streambuf\n       *\n       *  This function behaves like one of the basic arithmetic extractors,\n       *  in that it also constructs a sentry object and has the same error\n       *  handling behavior.\n       *\n       *  If @a sb is NULL, the stream will set failbit in its error state.\n       *\n       *  Characters are extracted from @a sb and inserted into @c *this\n       *  until one of the following occurs:\n       *\n       *  - the input stream reaches end-of-file,\n       *  - insertion into the output sequence fails (in this case, the\n       *    character that would have been inserted is not extracted), or\n       *  - an exception occurs while getting a character from @a sb, which\n       *    sets failbit in the error state\n       *\n       *  If the function inserts no characters, failbit is set.\n      */\n      __ostream_type& \n      operator<<(__streambuf_type* __sb);\n      //@}\n\n      // [27.6.2.6] unformatted output functions\n      /**\n       *  @name Unformatted Output Functions\n       *\n       *  All the unformatted output functions have some common behavior.\n       *  Each starts by constructing a temporary object of type\n       *  std::basic_ostream::sentry.  This has several effects, concluding\n       *  with the setting of a status flag; see the sentry documentation\n       *  for more.\n       *\n       *  If the sentry status is good, the function tries to generate\n       *  whatever data is appropriate for the type of the argument.\n       *\n       *  If an exception is thrown during insertion, ios_base::badbit\n       *  will be turned on in the stream's error state.  If badbit is on in\n       *  the stream's exceptions mask, the exception will be rethrown\n       *  without completing its actions.\n      */\n      //@{\n      /**\n       *  @brief  Simple insertion.\n       *  @param  c  The character to insert.\n       *  @return  *this\n       *\n       *  Tries to insert @a c.\n       *\n       *  @note  This function is not overloaded on signed char and\n       *         unsigned char.\n      */\n      __ostream_type& \n      put(char_type __c);\n\n      // Core write functionality, without sentry.\n      void\n      _M_write(const char_type* __s, streamsize __n)\n      {\n\tconst streamsize __put = this->rdbuf()->sputn(__s, __n);\n\tif (__put != __n)\n\t  this->setstate(ios_base::badbit);\n      }\n\n      /**\n       *  @brief  Character string insertion.\n       *  @param  s  The array to insert.\n       *  @param  n  Maximum number of characters to insert.\n       *  @return  *this\n       *\n       *  Characters are copied from @a s and inserted into the stream until\n       *  one of the following happens:\n       *\n       *  - @a n characters are inserted\n       *  - inserting into the output sequence fails (in this case, badbit\n       *    will be set in the stream's error state)\n       *\n       *  @note  This function is not overloaded on signed char and\n       *         unsigned char.\n      */\n      __ostream_type& \n      write(const char_type* __s, streamsize __n);\n      //@}\n\n      /**\n       *  @brief  Synchronizing the stream buffer.\n       *  @return  *this\n       *\n       *  If @c rdbuf() is a null pointer, changes nothing.\n       *\n       *  Otherwise, calls @c rdbuf()->pubsync(), and if that returns -1,\n       *  sets badbit.\n      */\n      __ostream_type& \n      flush();\n\n      // [27.6.2.4] seek members\n      /**\n       *  @brief  Getting the current write position.\n       *  @return  A file position object.\n       *\n       *  If @c fail() is not false, returns @c pos_type(-1) to indicate\n       *  failure.  Otherwise returns @c rdbuf()->pubseekoff(0,cur,out).\n      */\n      pos_type \n      tellp();\n\n      /**\n       *  @brief  Changing the current write position.\n       *  @param  pos  A file position object.\n       *  @return  *this\n       *\n       *  If @c fail() is not true, calls @c rdbuf()->pubseekpos(pos).  If\n       *  that function fails, sets failbit.\n      */\n      __ostream_type& \n      seekp(pos_type);\n\n      /**\n       *  @brief  Changing the current write position.\n       *  @param  off  A file offset object.\n       *  @param  dir  The direction in which to seek.\n       *  @return  *this\n       *\n       *  If @c fail() is not true, calls @c rdbuf()->pubseekoff(off,dir).\n       *  If that function fails, sets failbit.\n      */\n       __ostream_type& \n      seekp(off_type, ios_base::seekdir);\n      \n    protected:\n      explicit \n      basic_ostream() { }\n\n      template<typename _ValueT>\n        __ostream_type&\n        _M_insert(_ValueT __v);\n    };\n\n  /**\n   *  @brief  Performs setup work for output streams.\n   *\n   *  Objects of this class are created before all of the standard\n   *  inserters are run.  It is responsible for \"exception-safe prefix and\n   *  suffix operations.\"  Additional actions may be added by the\n   *  implementation, and we list them in\n   *  http://gcc.gnu.org/onlinedocs/libstdc++/17_intro/howto.html#5\n   *  under [27.6] notes.\n  */\n  template <typename _CharT, typename _Traits>\n    class basic_ostream<_CharT, _Traits>::sentry\n    {\n      // Data Members:\n      bool \t\t\t\t_M_ok;\n      basic_ostream<_CharT, _Traits>& \t_M_os;\n      \n    public:\n      /**\n       *  @brief  The constructor performs preparatory work.\n       *  @param  os  The output stream to guard.\n       *\n       *  If the stream state is good (@a os.good() is true), then if the\n       *  stream is tied to another output stream, @c is.tie()->flush()\n       *  is called to synchronize the output sequences.\n       *\n       *  If the stream state is still good, then the sentry state becomes\n       *  true (\"okay\").\n      */\n      explicit\n      sentry(basic_ostream<_CharT, _Traits>& __os);\n\n      /**\n       *  @brief  Possibly flushes the stream.\n       *\n       *  If @c ios_base::unitbuf is set in @c os.flags(), and\n       *  @c std::uncaught_exception() is true, the sentry destructor calls\n       *  @c flush() on the output stream.\n      */\n      ~sentry()\n      {\n\t// XXX MT\n\tif (_M_os.flags() & ios_base::unitbuf && !uncaught_exception())\n\t  {\n\t    // Can't call flush directly or else will get into recursive lock.\n\t    if (_M_os.rdbuf() && _M_os.rdbuf()->pubsync() == -1)\n\t      _M_os.setstate(ios_base::badbit);\n\t  }\n      }\n\n      /**\n       *  @brief  Quick status checking.\n       *  @return  The sentry state.\n       *\n       *  For ease of use, sentries may be converted to booleans.  The\n       *  return value is that of the sentry state (true == okay).\n      */\n      operator bool() const\n      { return _M_ok; }\n    };\n\n  // [27.6.2.5.4] character insertion templates\n  //@{\n  /**\n   *  @brief  Character inserters\n   *  @param  out  An output stream.\n   *  @param  c  A character.\n   *  @return  out\n   *\n   *  Behaves like one of the formatted arithmetic inserters described in\n   *  std::basic_ostream.  After constructing a sentry object with good\n   *  status, this function inserts a single character and any required\n   *  padding (as determined by [22.2.2.2.2]).  @c out.width(0) is then\n   *  called.\n   *\n   *  If @a c is of type @c char and the character type of the stream is not\n   *  @c char, the character is widened before insertion.\n  */\n  template<typename _CharT, typename _Traits>\n    inline basic_ostream<_CharT, _Traits>&\n    operator<<(basic_ostream<_CharT, _Traits>& __out, _CharT __c)\n    { return __ostream_insert(__out, &__c, 1); }\n\n  template<typename _CharT, typename _Traits>\n    inline basic_ostream<_CharT, _Traits>&\n    operator<<(basic_ostream<_CharT, _Traits>& __out, char __c)\n    { return (__out << __out.widen(__c)); }\n\n  // Specialization\n  template <class _Traits> \n    inline basic_ostream<char, _Traits>&\n    operator<<(basic_ostream<char, _Traits>& __out, char __c)\n    { return __ostream_insert(__out, &__c, 1); }\n\n  // Signed and unsigned\n  template<class _Traits>\n    inline basic_ostream<char, _Traits>&\n    operator<<(basic_ostream<char, _Traits>& __out, signed char __c)\n    { return (__out << static_cast<char>(__c)); }\n  \n  template<class _Traits>\n    inline basic_ostream<char, _Traits>&\n    operator<<(basic_ostream<char, _Traits>& __out, unsigned char __c)\n    { return (__out << static_cast<char>(__c)); }\n  //@}\n  \n  //@{\n  /**\n   *  @brief  String inserters\n   *  @param  out  An output stream.\n   *  @param  s  A character string.\n   *  @return  out\n   *  @pre  @a s must be a non-NULL pointer\n   *\n   *  Behaves like one of the formatted arithmetic inserters described in\n   *  std::basic_ostream.  After constructing a sentry object with good\n   *  status, this function inserts @c traits::length(s) characters starting\n   *  at @a s, widened if necessary, followed by any required padding (as\n   *  determined by [22.2.2.2.2]).  @c out.width(0) is then called.\n  */\n  template<typename _CharT, typename _Traits>\n    inline basic_ostream<_CharT, _Traits>&\n    operator<<(basic_ostream<_CharT, _Traits>& __out, const _CharT* __s)\n    {\n      if (!__s)\n\t__out.setstate(ios_base::badbit);\n      else\n\t__ostream_insert(__out, __s,\n\t\t\t static_cast<streamsize>(_Traits::length(__s)));\n      return __out;\n    }\n\n  template<typename _CharT, typename _Traits>\n    basic_ostream<_CharT, _Traits> &\n    operator<<(basic_ostream<_CharT, _Traits>& __out, const char* __s);\n\n  // Partial specializationss\n  template<class _Traits>\n    inline basic_ostream<char, _Traits>&\n    operator<<(basic_ostream<char, _Traits>& __out, const char* __s)\n    {\n      if (!__s)\n\t__out.setstate(ios_base::badbit);\n      else\n\t__ostream_insert(__out, __s,\n\t\t\t static_cast<streamsize>(_Traits::length(__s)));\n      return __out;\n    }\n\n  // Signed and unsigned\n  template<class _Traits>\n    inline basic_ostream<char, _Traits>&\n    operator<<(basic_ostream<char, _Traits>& __out, const signed char* __s)\n    { return (__out << reinterpret_cast<const char*>(__s)); }\n\n  template<class _Traits>\n    inline basic_ostream<char, _Traits> &\n    operator<<(basic_ostream<char, _Traits>& __out, const unsigned char* __s)\n    { return (__out << reinterpret_cast<const char*>(__s)); }\n  //@}\n\n  // [27.6.2.7] standard basic_ostream manipulators\n  /**\n   *  @brief  Write a newline and flush the stream.\n   *\n   *  This manipulator is often mistakenly used when a simple newline is\n   *  desired, leading to poor buffering performance.  See\n   *  http://gcc.gnu.org/onlinedocs/libstdc++/27_io/howto.html#2 for more\n   *  on this subject.\n  */\n  template<typename _CharT, typename _Traits>\n    inline basic_ostream<_CharT, _Traits>& \n    endl(basic_ostream<_CharT, _Traits>& __os)\n    { return flush(__os.put(__os.widen('\\n'))); }\n\n  /**\n   *  @brief  Write a null character into the output sequence.\n   *\n   *  \"Null character\" is @c CharT() by definition.  For CharT of @c char,\n   *  this correctly writes the ASCII @c NUL character string terminator.\n  */\n  template<typename _CharT, typename _Traits>\n    inline basic_ostream<_CharT, _Traits>& \n    ends(basic_ostream<_CharT, _Traits>& __os)\n    { return __os.put(_CharT()); }\n  \n  /**\n   *  @brief  Flushes the output stream.\n   *\n   *  This manipulator simply calls the stream's @c flush() member function.\n  */\n  template<typename _CharT, typename _Traits>\n    inline basic_ostream<_CharT, _Traits>& \n    flush(basic_ostream<_CharT, _Traits>& __os)\n    { return __os.flush(); }\n\n_GLIBCXX_END_NAMESPACE\n\n#ifndef _GLIBCXX_EXPORT_TEMPLATE\n# include <bits/ostream.tcc>\n#endif\n\n#endif\t/* _GLIBCXX_OSTREAM */\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/queue",
    "content": "// <queue> -*- C++ -*-\n\n// Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n/*\n *\n * Copyright (c) 1994\n * Hewlett-Packard Company\n *\n * Permission to use, copy, modify, distribute and sell this software\n * and its documentation for any purpose is hereby granted without fee,\n * provided that the above copyright notice appear in all copies and\n * that both that copyright notice and this permission notice appear\n * in supporting documentation.  Hewlett-Packard Company makes no\n * representations about the suitability of this software for any\n * purpose.  It is provided \"as is\" without express or implied warranty.\n *\n *\n * Copyright (c) 1996,1997\n * Silicon Graphics Computer Systems, Inc.\n *\n * Permission to use, copy, modify, distribute and sell this software\n * and its documentation for any purpose is hereby granted without fee,\n * provided that the above copyright notice appear in all copies and\n * that both that copyright notice and this permission notice appear\n * in supporting documentation.  Silicon Graphics makes no\n * representations about the suitability of this software for any\n * purpose.  It is provided \"as is\" without express or implied warranty.\n */\n\n/** @file include/queue\n *  This is a Standard C++ Library header.\n */\n\n#ifndef _GLIBCXX_QUEUE\n#define _GLIBCXX_QUEUE 1\n\n#pragma GCC system_header\n\n#include <bits/c++config.h>\n#include <bits/functexcept.h>\n#include <bits/stl_algobase.h>\n#include <bits/allocator.h>\n#include <bits/stl_construct.h>\n#include <bits/stl_uninitialized.h>\n#include <bits/stl_heap.h>\n#include <bits/stl_function.h>\n#include <deque>\n#include <vector>\n#include <bits/stl_queue.h>\n\n#endif /* _GLIBCXX_QUEUE */\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/set",
    "content": "// <set> -*- C++ -*-\n\n// Copyright (C) 2001, 2002 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n/*\n *\n * Copyright (c) 1994\n * Hewlett-Packard Company\n *\n * Permission to use, copy, modify, distribute and sell this software\n * and its documentation for any purpose is hereby granted without fee,\n * provided that the above copyright notice appear in all copies and\n * that both that copyright notice and this permission notice appear\n * in supporting documentation.  Hewlett-Packard Company makes no\n * representations about the suitability of this software for any\n * purpose.  It is provided \"as is\" without express or implied warranty.\n *\n *\n * Copyright (c) 1996,1997\n * Silicon Graphics Computer Systems, Inc.\n *\n * Permission to use, copy, modify, distribute and sell this software\n * and its documentation for any purpose is hereby granted without fee,\n * provided that the above copyright notice appear in all copies and\n * that both that copyright notice and this permission notice appear\n * in supporting documentation.  Silicon Graphics makes no\n * representations about the suitability of this software for any\n * purpose.  It is provided \"as is\" without express or implied warranty.\n */\n\n/** @file include/set\n *  This is a Standard C++ Library header.\n */\n\n#ifndef _GLIBCXX_SET\n#define _GLIBCXX_SET 1\n\n#pragma GCC system_header\n\n#include <bits/stl_tree.h>\n#include <bits/stl_set.h>\n#include <bits/stl_multiset.h>\n\n#ifdef _GLIBCXX_DEBUG\n# include <debug/set>\n#endif\n\n#endif /* _GLIBCXX_SET */\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/sstream",
    "content": "// String based streams -*- C++ -*-\n\n// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006\n// Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n/** @file sstream\n *  This is a Standard C++ Library header.\n */\n\n//\n// ISO C++ 14882: 27.7  String-based streams\n//\n\n#ifndef _GLIBCXX_SSTREAM\n#define _GLIBCXX_SSTREAM 1\n\n#pragma GCC system_header\n\n#include <istream>\n#include <ostream>\n\n_GLIBCXX_BEGIN_NAMESPACE(std)\n\n  // [27.7.1] template class basic_stringbuf\n  /**\n   *  @brief  The actual work of input and output (for std::string).\n   *\n   *  This class associates either or both of its input and output sequences\n   *  with a sequence of characters, which can be initialized from, or made\n   *  available as, a @c std::basic_string.  (Paraphrased from [27.7.1]/1.)\n   *\n   *  For this class, open modes (of type @c ios_base::openmode) have\n   *  @c in set if the input sequence can be read, and @c out set if the\n   *  output sequence can be written.\n  */\n  template<typename _CharT, typename _Traits, typename _Alloc>\n    class basic_stringbuf : public basic_streambuf<_CharT, _Traits>\n    {\n    public:\n      // Types:\n      typedef _CharT \t\t\t\t\tchar_type;\n      typedef _Traits \t\t\t\t\ttraits_type;\n      // _GLIBCXX_RESOLVE_LIB_DEFECTS\n      // 251. basic_stringbuf missing allocator_type\n      typedef _Alloc\t\t\t\t       \tallocator_type;\n      typedef typename traits_type::int_type \t\tint_type;\n      typedef typename traits_type::pos_type \t\tpos_type;\n      typedef typename traits_type::off_type \t\toff_type;\n\n      typedef basic_streambuf<char_type, traits_type>  \t__streambuf_type;\n      typedef basic_string<char_type, _Traits, _Alloc> \t__string_type;\n      typedef typename __string_type::size_type\t\t__size_type;\n\n    protected:\n      /**\n       *  @if maint\n       *  Place to stash in || out || in | out settings for current stringbuf.\n       *  @endif\n      */\n      ios_base::openmode \t_M_mode;\n\n      // Data Members:\n      __string_type \t\t_M_string;\n\n    public:\n      // Constructors:\n      /**\n       *  @brief  Starts with an empty string buffer.\n       *  @param  mode  Whether the buffer can read, or write, or both.\n       *\n       *  The default constructor initializes the parent class using its\n       *  own default ctor.\n      */\n      explicit\n      basic_stringbuf(ios_base::openmode __mode = ios_base::in | ios_base::out)\n      : __streambuf_type(), _M_mode(__mode), _M_string()\n      { }\n\n      /**\n       *  @brief  Starts with an existing string buffer.\n       *  @param  str  A string to copy as a starting buffer.\n       *  @param  mode  Whether the buffer can read, or write, or both.\n       *\n       *  This constructor initializes the parent class using its\n       *  own default ctor.\n      */\n      explicit\n      basic_stringbuf(const __string_type& __str,\n\t\t      ios_base::openmode __mode = ios_base::in | ios_base::out)\n      : __streambuf_type(), _M_mode(), _M_string(__str.data(), __str.size())\n      { _M_stringbuf_init(__mode); }\n\n      // Get and set:\n      /**\n       *  @brief  Copying out the string buffer.\n       *  @return  A copy of one of the underlying sequences.\n       *\n       *  \"If the buffer is only created in input mode, the underlying\n       *  character sequence is equal to the input sequence; otherwise, it\n       *  is equal to the output sequence.\" [27.7.1.2]/1\n      */\n      __string_type\n      str() const\n      {\n\t__string_type __ret;\n\tif (this->pptr())\n\t  {\n\t    // The current egptr() may not be the actual string end.\n\t    if (this->pptr() > this->egptr())\n\t      __ret = __string_type(this->pbase(), this->pptr());\n\t    else\n \t      __ret = __string_type(this->pbase(), this->egptr());\n\t  }\n\telse\n\t  __ret = _M_string;\n\treturn __ret;\n      }\n\n      /**\n       *  @brief  Setting a new buffer.\n       *  @param  s  The string to use as a new sequence.\n       *\n       *  Deallocates any previous stored sequence, then copies @a s to\n       *  use as a new one.\n      */\n      void\n      str(const __string_type& __s)\n      {\n\t// Cannot use _M_string = __s, since v3 strings are COW.\n\t_M_string.assign(__s.data(), __s.size());\n\t_M_stringbuf_init(_M_mode);\n      }\n\n    protected:\n      // Common initialization code goes here.\n      void\n      _M_stringbuf_init(ios_base::openmode __mode)\n      {\n\t_M_mode = __mode;\n\t__size_type __len = 0;\n\tif (_M_mode & (ios_base::ate | ios_base::app))\n\t  __len = _M_string.size();\n\t_M_sync(const_cast<char_type*>(_M_string.data()), 0, __len);\n      }\n\n      virtual streamsize\n      showmanyc()\n      { \n\tstreamsize __ret = -1;\n\tif (_M_mode & ios_base::in)\n\t  {\n\t    _M_update_egptr();\n\t    __ret = this->egptr() - this->gptr();\n\t  }\n\treturn __ret;\n      }\n\n      virtual int_type\n      underflow();\n\n      virtual int_type\n      pbackfail(int_type __c = traits_type::eof());\n\n      virtual int_type\n      overflow(int_type __c = traits_type::eof());\n\n      /**\n       *  @brief  Manipulates the buffer.\n       *  @param  s  Pointer to a buffer area.\n       *  @param  n  Size of @a s.\n       *  @return  @c this\n       *\n       *  If no buffer has already been created, and both @a s and @a n are\n       *  non-zero, then @c s is used as a buffer; see\n       *  http://gcc.gnu.org/onlinedocs/libstdc++/27_io/howto.html#2\n       *  for more.\n      */\n      virtual __streambuf_type*\n      setbuf(char_type* __s, streamsize __n)\n      {\n\tif (__s && __n >= 0)\n\t  {\n\t    // This is implementation-defined behavior, and assumes\n\t    // that an external char_type array of length __n exists\n\t    // and has been pre-allocated. If this is not the case,\n\t    // things will quickly blow up.\n\t    \n\t    // Step 1: Destroy the current internal array.\n\t    _M_string.clear();\n\t    \n\t    // Step 2: Use the external array.\n\t    _M_sync(__s, __n, 0);\n\t  }\n\treturn this;\n      }\n\n      virtual pos_type\n      seekoff(off_type __off, ios_base::seekdir __way,\n\t      ios_base::openmode __mode = ios_base::in | ios_base::out);\n\n      virtual pos_type\n      seekpos(pos_type __sp,\n\t      ios_base::openmode __mode = ios_base::in | ios_base::out);\n\n      // Internal function for correctly updating the internal buffer\n      // for a particular _M_string, due to initialization or re-sizing\n      // of an existing _M_string.\n      void\n      _M_sync(char_type* __base, __size_type __i, __size_type __o);\n\n      // Internal function for correctly updating egptr() to the actual\n      // string end.\n      void\n      _M_update_egptr()\n      {\n\tconst bool __testin = _M_mode & ios_base::in;\n\tif (this->pptr() && this->pptr() > this->egptr())\n\t  if (__testin)\n\t    this->setg(this->eback(), this->gptr(), this->pptr());\n\t  else\n\t    this->setg(this->pptr(), this->pptr(), this->pptr());\n      }\n    };\n\n\n  // [27.7.2] Template class basic_istringstream\n  /**\n   *  @brief  Controlling input for std::string.\n   *\n   *  This class supports reading from objects of type std::basic_string,\n   *  using the inherited functions from std::basic_istream.  To control\n   *  the associated sequence, an instance of std::basic_stringbuf is used,\n   *  which this page refers to as @c sb.\n  */\n  template<typename _CharT, typename _Traits, typename _Alloc>\n    class basic_istringstream : public basic_istream<_CharT, _Traits>\n    {\n    public:\n      // Types:\n      typedef _CharT \t\t\t\t\tchar_type;\n      typedef _Traits \t\t\t\t\ttraits_type;\n      // _GLIBCXX_RESOLVE_LIB_DEFECTS\n      // 251. basic_stringbuf missing allocator_type\n      typedef _Alloc\t\t\t\t       \tallocator_type;\n      typedef typename traits_type::int_type \t\tint_type;\n      typedef typename traits_type::pos_type \t\tpos_type;\n      typedef typename traits_type::off_type \t\toff_type;\n\n      // Non-standard types:\n      typedef basic_string<_CharT, _Traits, _Alloc> \t__string_type;\n      typedef basic_stringbuf<_CharT, _Traits, _Alloc> \t__stringbuf_type;\n      typedef basic_istream<char_type, traits_type>\t__istream_type;\n\n    private:\n      __stringbuf_type\t_M_stringbuf;\n\n    public:\n      // Constructors:\n      /**\n       *  @brief  Default constructor starts with an empty string buffer.\n       *  @param  mode  Whether the buffer can read, or write, or both.\n       *\n       *  @c ios_base::in is automatically included in @a mode.\n       *\n       *  Initializes @c sb using @c mode|in, and passes @c &sb to the base\n       *  class initializer.  Does not allocate any buffer.\n       *\n       *  @if maint\n       *  That's a lie.  We initialize the base class with NULL, because the\n       *  string class does its own memory management.\n       *  @endif\n      */\n      explicit\n      basic_istringstream(ios_base::openmode __mode = ios_base::in)\n      : __istream_type(), _M_stringbuf(__mode | ios_base::in)\n      { this->init(&_M_stringbuf); }\n\n      /**\n       *  @brief  Starts with an existing string buffer.\n       *  @param  str  A string to copy as a starting buffer.\n       *  @param  mode  Whether the buffer can read, or write, or both.\n       *\n       *  @c ios_base::in is automatically included in @a mode.\n       *\n       *  Initializes @c sb using @a str and @c mode|in, and passes @c &sb\n       *  to the base class initializer.\n       *\n       *  @if maint\n       *  That's a lie.  We initialize the base class with NULL, because the\n       *  string class does its own memory management.\n       *  @endif\n      */\n      explicit\n      basic_istringstream(const __string_type& __str,\n\t\t\t  ios_base::openmode __mode = ios_base::in)\n      : __istream_type(), _M_stringbuf(__str, __mode | ios_base::in)\n      { this->init(&_M_stringbuf); }\n\n      /**\n       *  @brief  The destructor does nothing.\n       *\n       *  The buffer is deallocated by the stringbuf object, not the\n       *  formatting stream.\n      */\n      ~basic_istringstream()\n      { }\n\n      // Members:\n      /**\n       *  @brief  Accessing the underlying buffer.\n       *  @return  The current basic_stringbuf buffer.\n       *\n       *  This hides both signatures of std::basic_ios::rdbuf().\n      */\n      __stringbuf_type*\n      rdbuf() const\n      { return const_cast<__stringbuf_type*>(&_M_stringbuf); }\n\n      /**\n       *  @brief  Copying out the string buffer.\n       *  @return  @c rdbuf()->str()\n      */\n      __string_type\n      str() const\n      { return _M_stringbuf.str(); }\n\n      /**\n       *  @brief  Setting a new buffer.\n       *  @param  s  The string to use as a new sequence.\n       *\n       *  Calls @c rdbuf()->str(s).\n      */\n      void\n      str(const __string_type& __s)\n      { _M_stringbuf.str(__s); }\n    };\n\n\n  // [27.7.3] Template class basic_ostringstream\n  /**\n   *  @brief  Controlling output for std::string.\n   *\n   *  This class supports writing to objects of type std::basic_string,\n   *  using the inherited functions from std::basic_ostream.  To control\n   *  the associated sequence, an instance of std::basic_stringbuf is used,\n   *  which this page refers to as @c sb.\n  */\n  template <typename _CharT, typename _Traits, typename _Alloc>\n    class basic_ostringstream : public basic_ostream<_CharT, _Traits>\n    {\n    public:\n      // Types:\n      typedef _CharT \t\t\t\t\tchar_type;\n      typedef _Traits \t\t\t\t\ttraits_type;\n      // _GLIBCXX_RESOLVE_LIB_DEFECTS\n      // 251. basic_stringbuf missing allocator_type\n      typedef _Alloc\t\t\t\t       \tallocator_type;\n      typedef typename traits_type::int_type \t\tint_type;\n      typedef typename traits_type::pos_type \t\tpos_type;\n      typedef typename traits_type::off_type \t\toff_type;\n\n      // Non-standard types:\n      typedef basic_string<_CharT, _Traits, _Alloc> \t__string_type;\n      typedef basic_stringbuf<_CharT, _Traits, _Alloc> \t__stringbuf_type;\n      typedef basic_ostream<char_type, traits_type>\t__ostream_type;\n\n    private:\n      __stringbuf_type\t_M_stringbuf;\n\n    public:\n      // Constructors/destructor:\n      /**\n       *  @brief  Default constructor starts with an empty string buffer.\n       *  @param  mode  Whether the buffer can read, or write, or both.\n       *\n       *  @c ios_base::out is automatically included in @a mode.\n       *\n       *  Initializes @c sb using @c mode|out, and passes @c &sb to the base\n       *  class initializer.  Does not allocate any buffer.\n       *\n       *  @if maint\n       *  That's a lie.  We initialize the base class with NULL, because the\n       *  string class does its own memory management.\n       *  @endif\n      */\n      explicit\n      basic_ostringstream(ios_base::openmode __mode = ios_base::out)\n      : __ostream_type(), _M_stringbuf(__mode | ios_base::out)\n      { this->init(&_M_stringbuf); }\n\n      /**\n       *  @brief  Starts with an existing string buffer.\n       *  @param  str  A string to copy as a starting buffer.\n       *  @param  mode  Whether the buffer can read, or write, or both.\n       *\n       *  @c ios_base::out is automatically included in @a mode.\n       *\n       *  Initializes @c sb using @a str and @c mode|out, and passes @c &sb\n       *  to the base class initializer.\n       *\n       *  @if maint\n       *  That's a lie.  We initialize the base class with NULL, because the\n       *  string class does its own memory management.\n       *  @endif\n      */\n      explicit\n      basic_ostringstream(const __string_type& __str,\n\t\t\t  ios_base::openmode __mode = ios_base::out)\n      : __ostream_type(), _M_stringbuf(__str, __mode | ios_base::out)\n      { this->init(&_M_stringbuf); }\n\n      /**\n       *  @brief  The destructor does nothing.\n       *\n       *  The buffer is deallocated by the stringbuf object, not the\n       *  formatting stream.\n      */\n      ~basic_ostringstream()\n      { }\n\n      // Members:\n      /**\n       *  @brief  Accessing the underlying buffer.\n       *  @return  The current basic_stringbuf buffer.\n       *\n       *  This hides both signatures of std::basic_ios::rdbuf().\n      */\n      __stringbuf_type*\n      rdbuf() const\n      { return const_cast<__stringbuf_type*>(&_M_stringbuf); }\n\n      /**\n       *  @brief  Copying out the string buffer.\n       *  @return  @c rdbuf()->str()\n      */\n      __string_type\n      str() const\n      { return _M_stringbuf.str(); }\n\n      /**\n       *  @brief  Setting a new buffer.\n       *  @param  s  The string to use as a new sequence.\n       *\n       *  Calls @c rdbuf()->str(s).\n      */\n      void\n      str(const __string_type& __s)\n      { _M_stringbuf.str(__s); }\n    };\n\n\n  // [27.7.4] Template class basic_stringstream\n  /**\n   *  @brief  Controlling input and output for std::string.\n   *\n   *  This class supports reading from and writing to objects of type\n   *  std::basic_string, using the inherited functions from\n   *  std::basic_iostream.  To control the associated sequence, an instance\n   *  of std::basic_stringbuf is used, which this page refers to as @c sb.\n  */\n  template <typename _CharT, typename _Traits, typename _Alloc>\n    class basic_stringstream : public basic_iostream<_CharT, _Traits>\n    {\n    public:\n      // Types:\n      typedef _CharT \t\t\t\t\tchar_type;\n      typedef _Traits \t\t\t\t\ttraits_type;\n      // _GLIBCXX_RESOLVE_LIB_DEFECTS\n      // 251. basic_stringbuf missing allocator_type\n      typedef _Alloc\t\t\t\t       \tallocator_type;\n      typedef typename traits_type::int_type \t\tint_type;\n      typedef typename traits_type::pos_type \t\tpos_type;\n      typedef typename traits_type::off_type \t\toff_type;\n\n      // Non-standard Types:\n      typedef basic_string<_CharT, _Traits, _Alloc> \t__string_type;\n      typedef basic_stringbuf<_CharT, _Traits, _Alloc> \t__stringbuf_type;\n      typedef basic_iostream<char_type, traits_type>\t__iostream_type;\n\n    private:\n      __stringbuf_type\t_M_stringbuf;\n\n    public:\n      // Constructors/destructors\n      /**\n       *  @brief  Default constructor starts with an empty string buffer.\n       *  @param  mode  Whether the buffer can read, or write, or both.\n       *\n       *  Initializes @c sb using @c mode, and passes @c &sb to the base\n       *  class initializer.  Does not allocate any buffer.\n       *\n       *  @if maint\n       *  That's a lie.  We initialize the base class with NULL, because the\n       *  string class does its own memory management.\n       *  @endif\n      */\n      explicit\n      basic_stringstream(ios_base::openmode __m = ios_base::out | ios_base::in)\n      : __iostream_type(), _M_stringbuf(__m)\n      { this->init(&_M_stringbuf); }\n\n      /**\n       *  @brief  Starts with an existing string buffer.\n       *  @param  str  A string to copy as a starting buffer.\n       *  @param  mode  Whether the buffer can read, or write, or both.\n       *\n       *  Initializes @c sb using @a str and @c mode, and passes @c &sb\n       *  to the base class initializer.\n       *\n       *  @if maint\n       *  That's a lie.  We initialize the base class with NULL, because the\n       *  string class does its own memory management.\n       *  @endif\n      */\n      explicit\n      basic_stringstream(const __string_type& __str,\n\t\t\t ios_base::openmode __m = ios_base::out | ios_base::in)\n      : __iostream_type(), _M_stringbuf(__str, __m)\n      { this->init(&_M_stringbuf); }\n\n      /**\n       *  @brief  The destructor does nothing.\n       *\n       *  The buffer is deallocated by the stringbuf object, not the\n       *  formatting stream.\n      */\n      ~basic_stringstream()\n      { }\n\n      // Members:\n      /**\n       *  @brief  Accessing the underlying buffer.\n       *  @return  The current basic_stringbuf buffer.\n       *\n       *  This hides both signatures of std::basic_ios::rdbuf().\n      */\n      __stringbuf_type*\n      rdbuf() const\n      { return const_cast<__stringbuf_type*>(&_M_stringbuf); }\n\n      /**\n       *  @brief  Copying out the string buffer.\n       *  @return  @c rdbuf()->str()\n      */\n      __string_type\n      str() const\n      { return _M_stringbuf.str(); }\n\n      /**\n       *  @brief  Setting a new buffer.\n       *  @param  s  The string to use as a new sequence.\n       *\n       *  Calls @c rdbuf()->str(s).\n      */\n      void\n      str(const __string_type& __s)\n      { _M_stringbuf.str(__s); }\n    };\n\n_GLIBCXX_END_NAMESPACE\n\n#ifndef _GLIBCXX_EXPORT_TEMPLATE\n# include <bits/sstream.tcc>\n#endif\n\n#endif /* _GLIBCXX_SSTREAM */\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/stack",
    "content": "// <stack> -*- C++ -*-\n\n// Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n/*\n *\n * Copyright (c) 1994\n * Hewlett-Packard Company\n *\n * Permission to use, copy, modify, distribute and sell this software\n * and its documentation for any purpose is hereby granted without fee,\n * provided that the above copyright notice appear in all copies and\n * that both that copyright notice and this permission notice appear\n * in supporting documentation.  Hewlett-Packard Company makes no\n * representations about the suitability of this software for any\n * purpose.  It is provided \"as is\" without express or implied warranty.\n *\n *\n * Copyright (c) 1996,1997\n * Silicon Graphics Computer Systems, Inc.\n *\n * Permission to use, copy, modify, distribute and sell this software\n * and its documentation for any purpose is hereby granted without fee,\n * provided that the above copyright notice appear in all copies and\n * that both that copyright notice and this permission notice appear\n * in supporting documentation.  Silicon Graphics makes no\n * representations about the suitability of this software for any\n * purpose.  It is provided \"as is\" without express or implied warranty.\n */\n\n/** @file include/stack\n *  This is a Standard C++ Library header.\n */\n\n#ifndef _GLIBCXX_STACK\n#define _GLIBCXX_STACK 1\n\n#pragma GCC system_header\n\n#include <bits/stl_algobase.h>\n#include <bits/allocator.h>\n#include <bits/stl_construct.h>\n#include <bits/stl_uninitialized.h>\n#include <deque>\n#include <bits/stl_stack.h>\n\n#endif /* _GLIBCXX_STACK */\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/stdexcept",
    "content": "// Standard exception classes  -*- C++ -*-\n\n// Copyright (C) 2001, 2002, 2005 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n/** @file stdexcept\n *  This is a Standard C++ Library header.\n */\n\n//\n// ISO C++ 19.1  Exception classes\n//\n\n#ifndef _GLIBCXX_STDEXCEPT\n#define _GLIBCXX_STDEXCEPT 1\n\n#pragma GCC system_header\n\n#include <exception>\n#include <string>\n\n_GLIBCXX_BEGIN_NAMESPACE(std)\n\n  /** Logic errors represent problems in the internal logic of a program;\n   *  in theory, these are preventable, and even detectable before the\n   *  program runs (e.g., violations of class invariants).\n   *  @brief One of two subclasses of exception.\n   */\n  class logic_error : public exception \n  {\n    string _M_msg;\n\n  public:\n    /** Takes a character string describing the error.  */\n    explicit \n    logic_error(const string&  __arg);\n\n    virtual \n    ~logic_error() throw();\n\n    /** Returns a C-style character string describing the general cause of\n     *  the current error (the same string passed to the ctor).  */\n    virtual const char* \n    what() const throw();\n  };\n\n  /** Thrown by the library, or by you, to report domain errors (domain in\n   *  the mathmatical sense).  */\n  class domain_error : public logic_error \n  {\n  public:\n    explicit domain_error(const string&  __arg);\n  };\n\n  /** Thrown to report invalid arguments to functions.  */\n  class invalid_argument : public logic_error \n  {\n  public:\n    explicit invalid_argument(const string&  __arg);\n  };\n\n  /** Thrown when an object is constructed that would exceed its maximum\n   *  permitted size (e.g., a basic_string instance).  */\n  class length_error : public logic_error \n  {\n  public:\n    explicit length_error(const string&  __arg);\n  };\n\n  /** This represents an argument whose value is not within the expected\n   *  range (e.g., boundary checks in basic_string).  */\n  class out_of_range : public logic_error \n  {\n  public:\n    explicit out_of_range(const string&  __arg);\n  };\n\n  /** Runtime errors represent problems outside the scope of a program;\n   *  they cannot be easily predicted and can generally only be caught as\n   *  the program executes.\n   *  @brief One of two subclasses of exception.\n   */\n  class runtime_error : public exception \n  {\n    string _M_msg;\n\n  public:\n    /** Takes a character string describing the error.  */\n    explicit \n    runtime_error(const string&  __arg);\n\n    virtual \n    ~runtime_error() throw();\n\n    /** Returns a C-style character string describing the general cause of\n     *  the current error (the same string passed to the ctor).  */\n    virtual const char* \n    what() const throw();\n  };\n\n  /** Thrown to indicate range errors in internal computations.  */\n  class range_error : public runtime_error \n  {\n  public:\n    explicit range_error(const string&  __arg);\n  };\n\n  /** Thrown to indicate arithmetic overflow.  */\n  class overflow_error : public runtime_error \n  {\n  public:\n    explicit overflow_error(const string&  __arg);\n  };\n\n  /** Thrown to indicate arithmetic underflow.  */\n  class underflow_error : public runtime_error \n  {\n  public:\n    explicit underflow_error(const string&  __arg);\n  };\n\n_GLIBCXX_END_NAMESPACE\n\n#endif /* _GLIBCXX_STDEXCEPT */\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/streambuf",
    "content": "// Stream buffer classes -*- C++ -*-\n\n// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006\n// Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n/** @file streambuf\n *  This is a Standard C++ Library header.\n */\n\n//\n// ISO C++ 14882: 27.5  Stream buffers\n//\n\n#ifndef _GLIBXX_STREAMBUF\n#define _GLIBXX_STREAMBUF 1\n\n#pragma GCC system_header\n\n#include <bits/c++config.h>\n#include <iosfwd>\n#include <bits/localefwd.h>\n#include <bits/ios_base.h>\n#include <bits/cpp_type_traits.h>\n#include <ext/type_traits.h>\n\n_GLIBCXX_BEGIN_NAMESPACE(std)\n\n  /**\n   *  @if maint\n   *  Does stuff.\n   *  @endif\n  */\n  template<typename _CharT, typename _Traits>\n    streamsize\n    __copy_streambufs_eof(basic_streambuf<_CharT, _Traits>*,\n\t\t\t  basic_streambuf<_CharT, _Traits>*, bool&);\n\n  /**\n   *  @brief  The actual work of input and output (interface).\n   *\n   *  This is a base class.  Derived stream buffers each control a\n   *  pair of character sequences:  one for input, and one for output.\n   *\n   *  Section [27.5.1] of the standard describes the requirements and\n   *  behavior of stream buffer classes.  That section (three paragraphs)\n   *  is reproduced here, for simplicity and accuracy.\n   *\n   *  -# Stream buffers can impose various constraints on the sequences\n   *     they control.  Some constraints are:\n   *     - The controlled input sequence can be not readable.\n   *     - The controlled output sequence can be not writable.\n   *     - The controlled sequences can be associated with the contents of\n   *       other representations for character sequences, such as external\n   *       files.\n   *     - The controlled sequences can support operations @e directly to or\n   *       from associated sequences.\n   *     - The controlled sequences can impose limitations on how the\n   *       program can read characters from a sequence, write characters to\n   *       a sequence, put characters back into an input sequence, or alter\n   *       the stream position.\n   *     .\n   *  -# Each sequence is characterized by three pointers which, if non-null,\n   *     all point into the same @c charT array object.  The array object\n   *     represents, at any moment, a (sub)sequence of characters from the\n   *     sequence.  Operations performed on a sequence alter the values\n   *     stored in these pointers, perform reads and writes directly to or\n   *     from associated sequences, and alter \"the stream position\" and\n   *     conversion state as needed to maintain this subsequence relationship.\n   *     The three pointers are:\n   *     - the <em>beginning pointer</em>, or lowest element address in the\n   *       array (called @e xbeg here);\n   *     - the <em>next pointer</em>, or next element address that is a\n   *       current candidate for reading or writing (called @e xnext here);\n   *     - the <em>end pointer</em>, or first element address beyond the\n   *       end of the array (called @e xend here).\n   *     .\n   *  -# The following semantic constraints shall always apply for any set\n   *     of three pointers for a sequence, using the pointer names given\n   *     immediately above:\n   *     - If @e xnext is not a null pointer, then @e xbeg and @e xend shall\n   *       also be non-null pointers into the same @c charT array, as\n   *       described above; otherwise, @e xbeg and @e xend shall also be null.\n   *     - If @e xnext is not a null pointer and @e xnext < @e xend for an\n   *       output sequence, then a <em>write position</em> is available.\n   *       In this case, @e *xnext shall be assignable as the next element\n   *       to write (to put, or to store a character value, into the sequence).\n   *     - If @e xnext is not a null pointer and @e xbeg < @e xnext for an\n   *       input sequence, then a <em>putback position</em> is available.\n   *       In this case, @e xnext[-1] shall have a defined value and is the\n   *       next (preceding) element to store a character that is put back\n   *       into the input sequence.\n   *     - If @e xnext is not a null pointer and @e xnext< @e xend for an\n   *       input sequence, then a <em>read position</em> is available.\n   *       In this case, @e *xnext shall have a defined value and is the\n   *       next element to read (to get, or to obtain a character value,\n   *       from the sequence).\n  */\n  template<typename _CharT, typename _Traits>\n    class basic_streambuf \n    {\n    public:\n      //@{\n      /**\n       *  These are standard types.  They permit a standardized way of\n       *  referring to names of (or names dependant on) the template\n       *  parameters, which are specific to the implementation.\n      */\n      typedef _CharT \t\t\t\t\tchar_type;\n      typedef _Traits \t\t\t\t\ttraits_type;\n      typedef typename traits_type::int_type \t\tint_type;\n      typedef typename traits_type::pos_type \t\tpos_type;\n      typedef typename traits_type::off_type \t\toff_type;\n      //@}\n\n      //@{\n      /**\n       *  @if maint\n       *  This is a non-standard type.\n       *  @endif\n      */\n      typedef basic_streambuf<char_type, traits_type>  \t__streambuf_type;\n      //@}\n      \n      friend class basic_ios<char_type, traits_type>;\n      friend class basic_istream<char_type, traits_type>;\n      friend class basic_ostream<char_type, traits_type>;\n      friend class istreambuf_iterator<char_type, traits_type>;\n      friend class ostreambuf_iterator<char_type, traits_type>;\n\n      friend streamsize\n      __copy_streambufs_eof<>(__streambuf_type*, __streambuf_type*, bool&);\n\n      template<typename _CharT2>\n        friend typename __gnu_cxx::__enable_if<__is_char<_CharT2>::__value, \n\t\t\t\t\t       _CharT2*>::__type\n        __copy_aux(istreambuf_iterator<_CharT2>,\n\t\t   istreambuf_iterator<_CharT2>, _CharT2*);\n\n      template<typename _CharT2>\n        friend typename __gnu_cxx::__enable_if<__is_char<_CharT2>::__value,\n\t\t\t\t  istreambuf_iterator<_CharT2> >::__type\n        find(istreambuf_iterator<_CharT2>, istreambuf_iterator<_CharT2>,\n\t     const _CharT2&);\n\n      template<typename _CharT2, typename _Traits2>\n        friend basic_istream<_CharT2, _Traits2>&\n        operator>>(basic_istream<_CharT2, _Traits2>&, _CharT2*);\n\n      template<typename _CharT2, typename _Traits2, typename _Alloc>\n        friend basic_istream<_CharT2, _Traits2>&\n        operator>>(basic_istream<_CharT2, _Traits2>&,\n\t\t   basic_string<_CharT2, _Traits2, _Alloc>&);\n\n      template<typename _CharT2, typename _Traits2, typename _Alloc>\n        friend basic_istream<_CharT2, _Traits2>&\n        getline(basic_istream<_CharT2, _Traits2>&,\n\t\tbasic_string<_CharT2, _Traits2, _Alloc>&, _CharT2);\n\n    protected:\n      //@{\n      /**\n       *  @if maint\n       *  This is based on _IO_FILE, just reordered to be more consistent,\n       *  and is intended to be the most minimal abstraction for an\n       *  internal buffer.\n       *  -  get == input == read\n       *  -  put == output == write\n       *  @endif\n      */\n      char_type* \t\t_M_in_beg;     // Start of get area. \n      char_type* \t\t_M_in_cur;     // Current read area. \n      char_type* \t\t_M_in_end;     // End of get area. \n      char_type* \t\t_M_out_beg;    // Start of put area. \n      char_type* \t\t_M_out_cur;    // Current put area. \n      char_type* \t\t_M_out_end;    // End of put area.\n\n      /**\n       *  @if maint\n       *  Current locale setting.\n       *  @endif\n      */\n      locale \t\t\t_M_buf_locale;\t\n\n  public:\n      /// Destructor deallocates no buffer space.\n      virtual \n      ~basic_streambuf() \n      { }\n\n      // [27.5.2.2.1] locales\n      /**\n       *  @brief  Entry point for imbue().\n       *  @param  loc  The new locale.\n       *  @return  The previous locale.\n       *\n       *  Calls the derived imbue(loc).\n      */\n      locale \n      pubimbue(const locale &__loc)\n      {\n\tlocale __tmp(this->getloc());\n\tthis->imbue(__loc);\n\t_M_buf_locale = __loc;\n\treturn __tmp;\n      }\n\n      /**\n       *  @brief  Locale access.\n       *  @return  The current locale in effect.\n       *\n       *  If pubimbue(loc) has been called, then the most recent @c loc\n       *  is returned.  Otherwise the global locale in effect at the time\n       *  of construction is returned.\n      */\n      locale   \n      getloc() const\n      { return _M_buf_locale; } \n\n      // [27.5.2.2.2] buffer management and positioning\n      //@{\n      /**\n       *  @brief  Entry points for derived buffer functions.\n       *\n       *  The public versions of @c pubfoo dispatch to the protected\n       *  derived @c foo member functions, passing the arguments (if any)\n       *  and returning the result unchanged.\n      */\n      __streambuf_type* \n      pubsetbuf(char_type* __s, streamsize __n) \n      { return this->setbuf(__s, __n); }\n\n      pos_type \n      pubseekoff(off_type __off, ios_base::seekdir __way, \n\t\t ios_base::openmode __mode = ios_base::in | ios_base::out)\n      { return this->seekoff(__off, __way, __mode); }\n\n      pos_type \n      pubseekpos(pos_type __sp,\n\t\t ios_base::openmode __mode = ios_base::in | ios_base::out)\n      { return this->seekpos(__sp, __mode); }\n\n      int \n      pubsync() { return this->sync(); }\n      //@}\n\n      // [27.5.2.2.3] get area\n      /**\n       *  @brief  Looking ahead into the stream.\n       *  @return  The number of characters available.\n       *\n       *  If a read position is available, returns the number of characters\n       *  available for reading before the buffer must be refilled.\n       *  Otherwise returns the derived @c showmanyc().\n      */\n      streamsize \n      in_avail() \n      { \n\tconst streamsize __ret = this->egptr() - this->gptr();\n\treturn __ret ? __ret : this->showmanyc();\n      }\n\n      /**\n       *  @brief  Getting the next character.\n       *  @return  The next character, or eof.\n       *\n       *  Calls @c sbumpc(), and if that function returns\n       *  @c traits::eof(), so does this function.  Otherwise, @c sgetc().\n      */\n      int_type \n      snextc()\n      {\n\tint_type __ret = traits_type::eof();\n\tif (__builtin_expect(!traits_type::eq_int_type(this->sbumpc(), \n\t\t\t\t\t\t       __ret), true))\n\t  __ret = this->sgetc();\n\treturn __ret;\n      }\n\n      /**\n       *  @brief  Getting the next character.\n       *  @return  The next character, or eof.\n       *\n       *  If the input read position is available, returns that character\n       *  and increments the read pointer, otherwise calls and returns\n       *  @c uflow().\n      */\n      int_type \n      sbumpc()\n      {\n\tint_type __ret;\n\tif (__builtin_expect(this->gptr() < this->egptr(), true))\n\t  {\n\t    __ret = traits_type::to_int_type(*this->gptr());\n\t    this->gbump(1);\n\t  }\n\telse \n\t  __ret = this->uflow();\n\treturn __ret;\n      }\n\n      /**\n       *  @brief  Getting the next character.\n       *  @return  The next character, or eof.\n       *\n       *  If the input read position is available, returns that character,\n       *  otherwise calls and returns @c underflow().  Does not move the \n       *  read position after fetching the character.\n      */\n      int_type \n      sgetc()\n      {\n\tint_type __ret;\n\tif (__builtin_expect(this->gptr() < this->egptr(), true))\n\t  __ret = traits_type::to_int_type(*this->gptr());\n\telse \n\t  __ret = this->underflow();\n\treturn __ret;\n      }\n\n      /**\n       *  @brief  Entry point for xsgetn.\n       *  @param  s  A buffer area.\n       *  @param  n  A count.\n       *\n       *  Returns xsgetn(s,n).  The effect is to fill @a s[0] through\n       *  @a s[n-1] with characters from the input sequence, if possible.\n      */\n      streamsize \n      sgetn(char_type* __s, streamsize __n)\n      { return this->xsgetn(__s, __n); }\n\n      // [27.5.2.2.4] putback\n      /**\n       *  @brief  Pushing characters back into the input stream.\n       *  @param  c  The character to push back.\n       *  @return  The previous character, if possible.\n       *\n       *  Similar to sungetc(), but @a c is pushed onto the stream instead\n       *  of \"the previous character\".  If successful, the next character\n       *  fetched from the input stream will be @a c.\n      */\n      int_type \n      sputbackc(char_type __c)\n      {\n\tint_type __ret;\n\tconst bool __testpos = this->eback() < this->gptr();\n\tif (__builtin_expect(!__testpos || \n\t\t\t     !traits_type::eq(__c, this->gptr()[-1]), false))\n\t  __ret = this->pbackfail(traits_type::to_int_type(__c));\n\telse \n\t  {\n\t    this->gbump(-1);\n\t    __ret = traits_type::to_int_type(*this->gptr());\n\t  }\n\treturn __ret;\n      }\n\n      /**\n       *  @brief  Moving backwards in the input stream.\n       *  @return  The previous character, if possible.\n       *\n       *  If a putback position is available, this function decrements the\n       *  input pointer and returns that character.  Otherwise, calls and\n       *  returns pbackfail().  The effect is to \"unget\" the last character\n       *  \"gotten\".\n      */\n      int_type \n      sungetc()\n      {\n\tint_type __ret;\n\tif (__builtin_expect(this->eback() < this->gptr(), true))\n\t  {\n\t    this->gbump(-1);\n\t    __ret = traits_type::to_int_type(*this->gptr());\n\t  }\n\telse \n\t  __ret = this->pbackfail();\n\treturn __ret;\n      }\n\n      // [27.5.2.2.5] put area\n      /**\n       *  @brief  Entry point for all single-character output functions.\n       *  @param  c  A character to output.\n       *  @return  @a c, if possible.\n       *\n       *  One of two public output functions.\n       *\n       *  If a write position is available for the output sequence (i.e.,\n       *  the buffer is not full), stores @a c in that position, increments\n       *  the position, and returns @c traits::to_int_type(c).  If a write\n       *  position is not available, returns @c overflow(c).\n      */\n      int_type \n      sputc(char_type __c)\n      {\n\tint_type __ret;\n\tif (__builtin_expect(this->pptr() < this->epptr(), true))\n\t  {\n\t    *this->pptr() = __c;\n\t    this->pbump(1);\n\t    __ret = traits_type::to_int_type(__c);\n\t  }\n\telse\n\t  __ret = this->overflow(traits_type::to_int_type(__c));\n\treturn __ret;\n      }\n\n      /**\n       *  @brief  Entry point for all single-character output functions.\n       *  @param  s  A buffer read area.\n       *  @param  n  A count.\n       *\n       *  One of two public output functions.\n       *\n       *\n       *  Returns xsputn(s,n).  The effect is to write @a s[0] through\n       *  @a s[n-1] to the output sequence, if possible.\n      */\n      streamsize \n      sputn(const char_type* __s, streamsize __n)\n      { return this->xsputn(__s, __n); }\n\n    protected:\n      /**\n       *  @brief  Base constructor.\n       *\n       *  Only called from derived constructors, and sets up all the\n       *  buffer data to zero, including the pointers described in the\n       *  basic_streambuf class description.  Note that, as a result,\n       *  - the class starts with no read nor write positions available,\n       *  - this is not an error\n      */\n      basic_streambuf()\n      : _M_in_beg(0), _M_in_cur(0), _M_in_end(0), \n      _M_out_beg(0), _M_out_cur(0), _M_out_end(0),\n      _M_buf_locale(locale()) \n      { }\n\n      // [27.5.2.3.1] get area access\n      //@{\n      /**\n       *  @brief  Access to the get area.\n       *\n       *  These functions are only available to other protected functions,\n       *  including derived classes.\n       *\n       *  - eback() returns the beginning pointer for the input sequence\n       *  - gptr() returns the next pointer for the input sequence\n       *  - egptr() returns the end pointer for the input sequence\n      */\n      char_type* \n      eback() const { return _M_in_beg; }\n\n      char_type* \n      gptr()  const { return _M_in_cur;  }\n\n      char_type* \n      egptr() const { return _M_in_end; }\n      //@}\n\n      /**\n       *  @brief  Moving the read position.\n       *  @param  n  The delta by which to move.\n       *\n       *  This just advances the read position without returning any data.\n      */\n      void \n      gbump(int __n) { _M_in_cur += __n; }\n\n      /**\n       *  @brief  Setting the three read area pointers.\n       *  @param  gbeg  A pointer.\n       *  @param  gnext  A pointer.\n       *  @param  gend  A pointer.\n       *  @post  @a gbeg == @c eback(), @a gnext == @c gptr(), and\n       *         @a gend == @c egptr()\n      */\n      void \n      setg(char_type* __gbeg, char_type* __gnext, char_type* __gend)\n      {\n\t_M_in_beg = __gbeg;\n\t_M_in_cur = __gnext;\n\t_M_in_end = __gend;\n      }\n\n      // [27.5.2.3.2] put area access\n      //@{\n      /**\n       *  @brief  Access to the put area.\n       *\n       *  These functions are only available to other protected functions,\n       *  including derived classes.\n       *\n       *  - pbase() returns the beginning pointer for the output sequence\n       *  - pptr() returns the next pointer for the output sequence\n       *  - epptr() returns the end pointer for the output sequence\n      */\n      char_type* \n      pbase() const { return _M_out_beg; }\n\n      char_type* \n      pptr() const { return _M_out_cur; }\n\n      char_type* \n      epptr() const { return _M_out_end; }\n      //@}\n\n      /**\n       *  @brief  Moving the write position.\n       *  @param  n  The delta by which to move.\n       *\n       *  This just advances the write position without returning any data.\n      */\n      void \n      pbump(int __n) { _M_out_cur += __n; }\n\n      /**\n       *  @brief  Setting the three write area pointers.\n       *  @param  pbeg  A pointer.\n       *  @param  pend  A pointer.\n       *  @post  @a pbeg == @c pbase(), @a pbeg == @c pptr(), and\n       *         @a pend == @c epptr()\n      */\n      void \n      setp(char_type* __pbeg, char_type* __pend)\n      { \n\t_M_out_beg = _M_out_cur = __pbeg; \n\t_M_out_end = __pend;\n      }\n\n      // [27.5.2.4] virtual functions\n      // [27.5.2.4.1] locales\n      /**\n       *  @brief  Changes translations.\n       *  @param  loc  A new locale.\n       *\n       *  Translations done during I/O which depend on the current locale\n       *  are changed by this call.  The standard adds, \"Between invocations\n       *  of this function a class derived from streambuf can safely cache\n       *  results of calls to locale functions and to members of facets\n       *  so obtained.\"\n       *\n       *  @note  Base class version does nothing.\n      */\n      virtual void \n      imbue(const locale&) \n      { }\n\n      // [27.5.2.4.2] buffer management and positioning\n      /**\n       *  @brief  Maniuplates the buffer.\n       *\n       *  Each derived class provides its own appropriate behavior.  See\n       *  the next-to-last paragraph of \n       *  http://gcc.gnu.org/onlinedocs/libstdc++/27_io/howto.html#2 for\n       *  more on this function.\n       *\n       *  @note  Base class version does nothing, returns @c this.\n      */\n      virtual basic_streambuf<char_type,_Traits>* \n      setbuf(char_type*, streamsize)\n      {\treturn this; }\n      \n      /**\n       *  @brief  Alters the stream positions.\n       *\n       *  Each derived class provides its own appropriate behavior.\n       *  @note  Base class version does nothing, returns a @c pos_type\n       *         that represents an invalid stream position.\n      */\n      virtual pos_type \n      seekoff(off_type, ios_base::seekdir,\n\t      ios_base::openmode /*__mode*/ = ios_base::in | ios_base::out)\n      { return pos_type(off_type(-1)); } \n\n      /**\n       *  @brief  Alters the stream positions.\n       *\n       *  Each derived class provides its own appropriate behavior.\n       *  @note  Base class version does nothing, returns a @c pos_type\n       *         that represents an invalid stream position.\n      */\n      virtual pos_type \n      seekpos(pos_type, \n\t      ios_base::openmode /*__mode*/ = ios_base::in | ios_base::out)\n      { return pos_type(off_type(-1)); } \n\n      /**\n       *  @brief  Synchronizes the buffer arrays with the controlled sequences.\n       *  @return  -1 on failure.\n       *\n       *  Each derived class provides its own appropriate behavior,\n       *  including the definition of \"failure\".\n       *  @note  Base class version does nothing, returns zero.\n      */\n      virtual int \n      sync() { return 0; }\n\n      // [27.5.2.4.3] get area\n      /**\n       *  @brief  Investigating the data available.\n       *  @return  An estimate of the number of characters available in the\n       *           input sequence, or -1.\n       *\n       *  \"If it returns a positive value, then successive calls to\n       *  @c underflow() will not return @c traits::eof() until at least that\n       *  number of characters have been supplied.  If @c showmanyc()\n       *  returns -1, then calls to @c underflow() or @c uflow() will fail.\"\n       *  [27.5.2.4.3]/1\n       *\n       *  @note  Base class version does nothing, returns zero.\n       *  @note  The standard adds that \"the intention is not only that the\n       *         calls [to underflow or uflow] will not return @c eof() but\n       *         that they will return \"immediately\".\n       *  @note  The standard adds that \"the morphemes of @c showmanyc are\n       *         \"es-how-many-see\", not \"show-manic\".\n      */\n      virtual streamsize \n      showmanyc() { return 0; }\n\n      /**\n       *  @brief  Multiple character extraction.\n       *  @param  s  A buffer area.\n       *  @param  n  Maximum number of characters to assign.\n       *  @return  The number of characters assigned.\n       *\n       *  Fills @a s[0] through @a s[n-1] with characters from the input\n       *  sequence, as if by @c sbumpc().  Stops when either @a n characters\n       *  have been copied, or when @c traits::eof() would be copied.\n       *\n       *  It is expected that derived classes provide a more efficient\n       *  implementation by overriding this definition.\n      */\n      virtual streamsize \n      xsgetn(char_type* __s, streamsize __n);\n\n      /**\n       *  @brief  Fetches more data from the controlled sequence.\n       *  @return  The first character from the <em>pending sequence</em>.\n       *\n       *  Informally, this function is called when the input buffer is\n       *  exhausted (or does not exist, as buffering need not actually be\n       *  done).  If a buffer exists, it is \"refilled\".  In either case, the\n       *  next available character is returned, or @c traits::eof() to\n       *  indicate a null pending sequence.\n       *\n       *  For a formal definiton of the pending sequence, see a good text\n       *  such as Langer & Kreft, or [27.5.2.4.3]/7-14.\n       *\n       *  A functioning input streambuf can be created by overriding only\n       *  this function (no buffer area will be used).  For an example, see\n       *  http://gcc.gnu.org/onlinedocs/libstdc++/27_io/howto.html#6\n       *\n       *  @note  Base class version does nothing, returns eof().\n      */\n      virtual int_type \n      underflow()\n      { return traits_type::eof(); }\n\n      /**\n       *  @brief  Fetches more data from the controlled sequence.\n       *  @return  The first character from the <em>pending sequence</em>.\n       *\n       *  Informally, this function does the same thing as @c underflow(),\n       *  and in fact is required to call that function.  It also returns\n       *  the new character, like @c underflow() does.  However, this\n       *  function also moves the read position forward by one.\n      */\n      virtual int_type \n      uflow() \n      {\n\tint_type __ret = traits_type::eof();\n\tconst bool __testeof = traits_type::eq_int_type(this->underflow(), \n\t\t\t\t\t\t\t__ret);\n\tif (!__testeof)\n\t  {\n\t    __ret = traits_type::to_int_type(*this->gptr());\n\t    this->gbump(1);\n\t  }\n\treturn __ret;    \n      }\n\n      // [27.5.2.4.4] putback\n      /**\n       *  @brief  Tries to back up the input sequence.\n       *  @param  c  The character to be inserted back into the sequence.\n       *  @return  eof() on failure, \"some other value\" on success\n       *  @post  The constraints of @c gptr(), @c eback(), and @c pptr()\n       *         are the same as for @c underflow().\n       *\n       *  @note  Base class version does nothing, returns eof().\n      */\n      virtual int_type \n      pbackfail(int_type /* __c */  = traits_type::eof())\n      { return traits_type::eof(); }\n\n      // Put area:\n      /**\n       *  @brief  Multiple character insertion.\n       *  @param  s  A buffer area.\n       *  @param  n  Maximum number of characters to write.\n       *  @return  The number of characters written.\n       *\n       *  Writes @a s[0] through @a s[n-1] to the output sequence, as if\n       *  by @c sputc().  Stops when either @a n characters have been\n       *  copied, or when @c sputc() would return @c traits::eof().\n       *\n       *  It is expected that derived classes provide a more efficient\n       *  implementation by overriding this definition.\n      */\n      virtual streamsize \n      xsputn(const char_type* __s, streamsize __n);\n\n      /**\n       *  @brief  Consumes data from the buffer; writes to the\n       *          controlled sequence.\n       *  @param  c  An additional character to consume.\n       *  @return  eof() to indicate failure, something else (usually\n       *           @a c, or not_eof())\n       *\n       *  Informally, this function is called when the output buffer is full\n       *  (or does not exist, as buffering need not actually be done).  If a\n       *  buffer exists, it is \"consumed\", with \"some effect\" on the\n       *  controlled sequence.  (Typically, the buffer is written out to the\n       *  sequence verbatim.)  In either case, the character @a c is also\n       *  written out, if @a c is not @c eof().\n       *\n       *  For a formal definiton of this function, see a good text\n       *  such as Langer & Kreft, or [27.5.2.4.5]/3-7.\n       *\n       *  A functioning output streambuf can be created by overriding only\n       *  this function (no buffer area will be used).\n       *\n       *  @note  Base class version does nothing, returns eof().\n      */\n      virtual int_type \n      overflow(int_type /* __c */ = traits_type::eof())\n      { return traits_type::eof(); }\n\n#ifdef _GLIBCXX_DEPRECATED\n    // Annex D.6\n    public:\n      /**\n       *  @brief  Tosses a character.\n       *\n       *  Advances the read pointer, ignoring the character that would have\n       *  been read.\n       *\n       *  See http://gcc.gnu.org/ml/libstdc++/2002-05/msg00168.html\n       *\n       *  @note  This function has been deprecated by the standard.  You\n       *         must define @c _GLIBCXX_DEPRECATED to make this visible; see\n       *         c++config.h.\n      */\n      void \n      stossc() \n      {\n\tif (this->gptr() < this->egptr()) \n\t  this->gbump(1);\n\telse \n\t  this->uflow();\n      }\n#endif\n\n    private:\n      // _GLIBCXX_RESOLVE_LIB_DEFECTS\n      // Side effect of DR 50. \n      basic_streambuf(const __streambuf_type& __sb)\n      : _M_in_beg(__sb._M_in_beg), _M_in_cur(__sb._M_in_cur), \n      _M_in_end(__sb._M_in_end), _M_out_beg(__sb._M_out_beg), \n      _M_out_cur(__sb._M_out_cur), _M_out_end(__sb._M_out_cur),\n      _M_buf_locale(__sb._M_buf_locale) \n      { }\n\n      __streambuf_type& \n      operator=(const __streambuf_type&) { return *this; };\n    };\n\n  // Explicit specialization declarations, defined in src/streambuf.cc.\n  template<>\n    streamsize\n    __copy_streambufs_eof(basic_streambuf<char>* __sbin,\n\t\t\t  basic_streambuf<char>* __sbout, bool& __ineof);\n#ifdef _GLIBCXX_USE_WCHAR_T\n  template<>\n    streamsize\n    __copy_streambufs_eof(basic_streambuf<wchar_t>* __sbin,\n\t\t\t  basic_streambuf<wchar_t>* __sbout, bool& __ineof);\n#endif\n\n_GLIBCXX_END_NAMESPACE\n\n#ifndef _GLIBCXX_EXPORT_TEMPLATE\n# include <bits/streambuf.tcc>\n#endif\n\n#endif /* _GLIBCXX_STREAMBUF */\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/string",
    "content": "// Components for manipulating sequences of characters -*- C++ -*-\n\n// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,\n// 2006, 2007\n// Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n/** @file include/string\n *  This is a Standard C++ Library header.\n */\n\n//\n// ISO C++ 14882: 21  Strings library\n//\n\n#ifndef _GLIBCXX_STRING\n#define _GLIBCXX_STRING\t1\n\n#pragma GCC system_header\n\n#include <bits/c++config.h>\n#include <bits/stringfwd.h>\n#include <bits/char_traits.h>\n#include <memory> \t// For allocator.\n#include <bits/cpp_type_traits.h>\n#include <iosfwd> \t// For operators >>, <<, and getline decls.\n#include <bits/ostream_insert.h>\n#include <bits/stl_iterator.h>\n#include <bits/stl_function.h>  // For less\n#include <bits/basic_string.h>\n\n#ifndef _GLIBCXX_EXPORT_TEMPLATE\n# include <algorithm> // for find_if\n# include <bits/basic_string.tcc> \n#endif\n\n#endif /* _GLIBCXX_STRING */\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/tr1/array",
    "content": "// class template array -*- C++ -*-\n\n// Copyright (C) 2004, 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n/** @file tr1/array\n *  This is a TR1 C++ Library header. \n */\n\n#ifndef _TR1_ARRAY\n#define _TR1_ARRAY 1\n\n#include <new>\n#include <iterator>\n#include <algorithm>\n#include <cstddef>\n#include <bits/functexcept.h>\n#include <ext/type_traits.h>\n\n//namespace std::tr1\nnamespace std\n{\n_GLIBCXX_BEGIN_NAMESPACE(tr1)\n\n  /// @brief  struct array [6.2.2].\n  /// NB: Requires complete type _Tp.\n  template<typename _Tp, std::size_t _Nm>\n    struct array\n    {\n      typedef _Tp \t    \t\t\t      value_type;\n      typedef value_type&                   \t      reference;\n      typedef const value_type&             \t      const_reference;\n      typedef value_type*          \t\t      iterator;\n      typedef const value_type*\t\t\t      const_iterator;\n      typedef std::size_t                    \t      size_type;\n      typedef std::ptrdiff_t                   \t      difference_type;\n      typedef std::reverse_iterator<iterator>\t      reverse_iterator;\n      typedef std::reverse_iterator<const_iterator>   const_reverse_iterator;\n\n      // Support for zero-sized arrays mandatory.\n      value_type _M_instance[_Nm ? _Nm : 1] __attribute__((__aligned__));\n\n      // No explicit construct/copy/destroy for aggregate type.\n\n      void \n      assign(const value_type& __u)\n      { std::fill_n(begin(), size(), __u); }\n\n      void \n      swap(array& __other)\n      { std::swap_ranges(begin(), end(), __other.begin()); }\n\n      // Iterators.\n      iterator\n      begin()\n      { return iterator(&_M_instance[0]); }\n\n      const_iterator\n      begin() const \n      { return const_iterator(&_M_instance[0]); }\n\n      iterator\n      end() \n      { return iterator(&_M_instance[_Nm]); }\n\n      const_iterator\n      end() const\n      { return const_iterator(&_M_instance[_Nm]); }\n\n      reverse_iterator \n      rbegin()\n      { return reverse_iterator(end()); }\n\n      const_reverse_iterator \n      rbegin() const\n      { return const_reverse_iterator(end()); }\n\n      reverse_iterator \n      rend()\n      { return reverse_iterator(begin()); }\n\n      const_reverse_iterator \n      rend() const\n      { return const_reverse_iterator(begin()); }\n\n      // Capacity.\n      size_type \n      size() const { return _Nm; }\n\n      size_type \n      max_size() const { return _Nm; }\n\n      bool \n      empty() const { return size() == 0; }\n\n      // Element access.\n      reference\n      operator[](size_type __n)\n      { return _M_instance[__n]; }\n\n      const_reference\n      operator[](size_type __n) const\n      { return _M_instance[__n]; }\n\n      reference\n      at(size_type __n)\n      { \n\t_M_check<_Nm>(__n);\n\treturn _M_instance[__n];\n      }\n\n      const_reference\n      at(size_type __n) const\n      {\n\t_M_check<_Nm>(__n);\n\treturn _M_instance[__n];\n      }\n\n      reference \n      front()\n      { return *begin(); }\n\n      const_reference \n      front() const\n      { return *begin(); }\n\n      reference \n      back()\n      { return _Nm ? *(end() - 1) : *end(); }\n\n      const_reference \n      back() const\n      { return _Nm ? *(end() - 1) : *end(); }\n\n      _Tp* \n      data()\n      { return &_M_instance[0]; }\n\n      const _Tp* \n      data() const\n      { return &_M_instance[0]; }\n\n    private:\n      template<std::size_t _Mm>\n        typename __gnu_cxx::__enable_if<_Mm, void>::__type\n        _M_check(size_type __n) const\n        {\n\t  if (__builtin_expect(__n >= _Mm, false))\n\t    std::__throw_out_of_range(__N(\"array::_M_check\"));\n\t}\n\n      // Avoid \"unsigned comparison with zero\" warnings.\n      template<std::size_t _Mm>\n        typename __gnu_cxx::__enable_if<!_Mm, void>::__type\n        _M_check(size_type) const\n        { std::__throw_out_of_range(__N(\"array::_M_check\")); }\n    };\n\n  // Array comparisons.\n  template<typename _Tp, std::size_t _Nm>\n    inline bool \n    operator==(const array<_Tp, _Nm>& __one, const array<_Tp, _Nm>& __two)\n    { return std::equal(__one.begin(), __one.end(), __two.begin()); }\n\n  template<typename _Tp, std::size_t _Nm>\n    inline bool\n    operator!=(const array<_Tp, _Nm>& __one, const array<_Tp, _Nm>& __two)\n    { return !(__one == __two); }\n\n  template<typename _Tp, std::size_t _Nm>\n    inline bool\n    operator<(const array<_Tp, _Nm>& __a, const array<_Tp, _Nm>& __b)\n    { \n      return std::lexicographical_compare(__a.begin(), __a.end(),\n\t\t\t\t\t  __b.begin(), __b.end()); \n    }\n\n  template<typename _Tp, std::size_t _Nm>\n    inline bool\n    operator>(const array<_Tp, _Nm>& __one, const array<_Tp, _Nm>& __two)\n    { return __two < __one; }\n\n  template<typename _Tp, std::size_t _Nm>\n    inline bool\n    operator<=(const array<_Tp, _Nm>& __one, const array<_Tp, _Nm>& __two)\n    { return !(__one > __two); }\n\n  template<typename _Tp, std::size_t _Nm>\n    inline bool\n    operator>=(const array<_Tp, _Nm>& __one, const array<_Tp, _Nm>& __two)\n    { return !(__one < __two); }\n\n  // Specialized algorithms [6.2.2.2].\n  template<typename _Tp, std::size_t _Nm>\n    inline void\n    swap(array<_Tp, _Nm>& __one, array<_Tp, _Nm>& __two)\n    { std::swap_ranges(__one.begin(), __one.end(), __two.begin()); }\n\n  // Tuple interface to class template array [6.2.2.5].\n  template<typename _Tp> class tuple_size;\n  template<int _Int, typename _Tp> class tuple_element;\n\n  template<typename _Tp, std::size_t _Nm>\n    struct tuple_size<array<_Tp, _Nm> >\n    { static const int value = _Nm; };\n\n  template<typename _Tp, std::size_t _Nm>\n    const int tuple_size<array<_Tp, _Nm> >::value;\n\n  template<int _Int, typename _Tp, std::size_t _Nm>\n    struct tuple_element<_Int, array<_Tp, _Nm> >\n    { typedef _Tp type; };\n\n  template<int _Int, typename _Tp, std::size_t _Nm>\n    inline _Tp&\n    get(array<_Tp, _Nm>& __arr)\n    { return __arr[_Int]; }\n\n  template<int _Int, typename _Tp, std::size_t _Nm>\n    inline const _Tp&\n    get(const array<_Tp, _Nm>& __arr)\n    { return __arr[_Int]; }\n\n_GLIBCXX_END_NAMESPACE\n}\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/tr1/bind_iterate.h",
    "content": "// TR1 functional -*- C++ -*-\n\n// Copyright (C) 2005 Free Software Foundation, Inc.\n// Written by Douglas Gregor <doug.gregor -at- gmail.com>\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n/** @file tr1/bind_iterate.h\n *  This is an internal header file, included by other library headers.\n *  You should not attempt to use it directly.\n */\n\n#if _GLIBCXX_BIND_NUM_ARGS > 0\ntemplate<_GLIBCXX_BIND_TEMPLATE_PARAMS>\n#endif\n#ifdef _GLIBCXX_BIND_HAS_RESULT_TYPE\nresult_type\n#else\ntypename result_of<_Functor(_GLIBCXX_BIND_V_TEMPLATE_ARGS())>::type\n#endif\noperator()(_GLIBCXX_BIND_PARAMS)\n{ return _M_f(_GLIBCXX_BIND_V_ARGS); }\n\n#if _GLIBCXX_BIND_NUM_ARGS > 0\ntemplate<_GLIBCXX_BIND_TEMPLATE_PARAMS>\n#endif\n#ifdef _GLIBCXX_BIND_HAS_RESULT_TYPE\nresult_type\n#else\ntypename result_of<const _Functor(_GLIBCXX_BIND_V_TEMPLATE_ARGS(const))>::type\n#endif\noperator()(_GLIBCXX_BIND_PARAMS) const\n{ return _M_f(_GLIBCXX_BIND_V_ARGS); }\n\n#if _GLIBCXX_BIND_NUM_ARGS > 0\ntemplate<_GLIBCXX_BIND_TEMPLATE_PARAMS>\n#endif\n#ifdef _GLIBCXX_BIND_HAS_RESULT_TYPE\nresult_type\n#else\ntypename result_of<volatile _Functor(_GLIBCXX_BIND_V_TEMPLATE_ARGS(volatile))>::type\n#endif\noperator()(_GLIBCXX_BIND_PARAMS) volatile\n{ return _M_f(_GLIBCXX_BIND_V_ARGS); }\n\n#if _GLIBCXX_BIND_NUM_ARGS > 0\ntemplate<_GLIBCXX_BIND_TEMPLATE_PARAMS>\n#endif\n#ifdef _GLIBCXX_BIND_HAS_RESULT_TYPE\nresult_type\n#else\ntypename result_of<const volatile _Functor(_GLIBCXX_BIND_V_TEMPLATE_ARGS(const volatile))>::type\n#endif\noperator()(_GLIBCXX_BIND_PARAMS) const volatile\n{ return _M_f(_GLIBCXX_BIND_V_ARGS); }\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/tr1/bind_repeat.h",
    "content": "// TR1 code repetition for bind -*- C++ -*-\n\n// Copyright (C) 2005 Free Software Foundation, Inc.\n// Written by Douglas Gregor <doug.gregor -at- gmail.com>\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n/** @file tr1/bind_repeat.h\n *  This is an internal header file, included by other library headers.\n *  You should not attempt to use it directly.\n */\n\n#ifndef _GLIBCXX_BIND_REPEAT_HEADER\n#  error Internal error: _GLIBCXX_BIND_REPEAT_HEADER must be set\n#endif /* _GLIBCXX_BIND_REPEAT_HEADER */\n\n#define _GLIBCXX_BIND_NUM_ARGS 0\n#define _GLIBCXX_BIND_COMMA\n#define _GLIBCXX_BIND_TEMPLATE_PARAMS\n#define _GLIBCXX_BIND_TEMPLATE_ARGS\n#define _GLIBCXX_BIND_PARAMS\n#define _GLIBCXX_BIND_ARGS\n#  include _GLIBCXX_BIND_REPEAT_HEADER\n#undef _GLIBCXX_BIND_ARGS\n#undef _GLIBCXX_BIND_PARAMS\n#undef _GLIBCXX_BIND_TEMPLATE_ARGS\n#undef _GLIBCXX_BIND_TEMPLATE_PARAMS\n#undef _GLIBCXX_BIND_COMMA\n#undef _GLIBCXX_BIND_NUM_ARGS\n\n#define _GLIBCXX_BIND_NUM_ARGS 1\n#define _GLIBCXX_BIND_COMMA ,\n#define _GLIBCXX_BIND_TEMPLATE_PARAMS typename _U1\n#define _GLIBCXX_BIND_TEMPLATE_ARGS _U1\n#define _GLIBCXX_BIND_PARAMS _U1& __u1\n#define _GLIBCXX_BIND_ARGS __u1\n#include _GLIBCXX_BIND_REPEAT_HEADER\n#undef _GLIBCXX_BIND_ARGS\n#undef _GLIBCXX_BIND_PARAMS\n#undef _GLIBCXX_BIND_TEMPLATE_ARGS\n#undef _GLIBCXX_BIND_TEMPLATE_PARAMS\n#undef _GLIBCXX_BIND_COMMA\n#undef _GLIBCXX_BIND_NUM_ARGS\n#define _GLIBCXX_BIND_NUM_ARGS 2\n#define _GLIBCXX_BIND_COMMA ,\n#define _GLIBCXX_BIND_TEMPLATE_PARAMS typename _U1, typename _U2\n#define _GLIBCXX_BIND_TEMPLATE_ARGS _U1, _U2\n#define _GLIBCXX_BIND_PARAMS _U1& __u1, _U2& __u2\n#define _GLIBCXX_BIND_ARGS __u1, __u2\n#include _GLIBCXX_BIND_REPEAT_HEADER\n#undef _GLIBCXX_BIND_ARGS\n#undef _GLIBCXX_BIND_PARAMS\n#undef _GLIBCXX_BIND_TEMPLATE_ARGS\n#undef _GLIBCXX_BIND_TEMPLATE_PARAMS\n#undef _GLIBCXX_BIND_COMMA\n#undef _GLIBCXX_BIND_NUM_ARGS\n\n#define _GLIBCXX_BIND_NUM_ARGS 3\n#define _GLIBCXX_BIND_COMMA ,\n#define _GLIBCXX_BIND_TEMPLATE_PARAMS typename _U1, typename _U2, typename _U3\n#define _GLIBCXX_BIND_TEMPLATE_ARGS _U1, _U2, _U3\n#define _GLIBCXX_BIND_PARAMS _U1& __u1, _U2& __u2, _U3& __u3\n#define _GLIBCXX_BIND_ARGS __u1, __u2, __u3\n#include _GLIBCXX_BIND_REPEAT_HEADER\n#undef _GLIBCXX_BIND_ARGS\n#undef _GLIBCXX_BIND_PARAMS\n#undef _GLIBCXX_BIND_TEMPLATE_ARGS\n#undef _GLIBCXX_BIND_TEMPLATE_PARAMS\n#undef _GLIBCXX_BIND_COMMA\n#undef _GLIBCXX_BIND_NUM_ARGS\n\n#define _GLIBCXX_BIND_NUM_ARGS 4\n#define _GLIBCXX_BIND_COMMA ,\n#define _GLIBCXX_BIND_TEMPLATE_PARAMS typename _U1, typename _U2, typename _U3, typename _U4\n#define _GLIBCXX_BIND_TEMPLATE_ARGS _U1, _U2, _U3, _U4\n#define _GLIBCXX_BIND_PARAMS _U1& __u1, _U2& __u2, _U3& __u3, _U4& __u4\n#define _GLIBCXX_BIND_ARGS __u1, __u2, __u3, __u4\n#include _GLIBCXX_BIND_REPEAT_HEADER\n#undef _GLIBCXX_BIND_ARGS\n#undef _GLIBCXX_BIND_PARAMS\n#undef _GLIBCXX_BIND_TEMPLATE_ARGS\n#undef _GLIBCXX_BIND_TEMPLATE_PARAMS\n#undef _GLIBCXX_BIND_COMMA\n#undef _GLIBCXX_BIND_NUM_ARGS\n\n#define _GLIBCXX_BIND_NUM_ARGS 5\n#define _GLIBCXX_BIND_COMMA ,\n#define _GLIBCXX_BIND_TEMPLATE_PARAMS typename _U1, typename _U2, typename _U3, typename _U4, typename _U5\n#define _GLIBCXX_BIND_TEMPLATE_ARGS _U1, _U2, _U3, _U4, _U5\n#define _GLIBCXX_BIND_PARAMS _U1& __u1, _U2& __u2, _U3& __u3, _U4& __u4, _U5& __u5\n#define _GLIBCXX_BIND_ARGS __u1, __u2, __u3, __u4, __u5\n#include _GLIBCXX_BIND_REPEAT_HEADER\n#undef _GLIBCXX_BIND_ARGS\n#undef _GLIBCXX_BIND_PARAMS\n#undef _GLIBCXX_BIND_TEMPLATE_ARGS\n#undef _GLIBCXX_BIND_TEMPLATE_PARAMS\n#undef _GLIBCXX_BIND_COMMA\n#undef _GLIBCXX_BIND_NUM_ARGS\n\n#define _GLIBCXX_BIND_NUM_ARGS 6\n#define _GLIBCXX_BIND_COMMA ,\n#define _GLIBCXX_BIND_TEMPLATE_PARAMS typename _U1, typename _U2, typename _U3, typename _U4, typename _U5, typename _U6\n#define _GLIBCXX_BIND_TEMPLATE_ARGS _U1, _U2, _U3, _U4, _U5, _U6\n#define _GLIBCXX_BIND_PARAMS _U1& __u1, _U2& __u2, _U3& __u3, _U4& __u4, _U5& __u5, _U6& __u6\n#define _GLIBCXX_BIND_ARGS __u1, __u2, __u3, __u4, __u5, __u6\n#include _GLIBCXX_BIND_REPEAT_HEADER\n#undef _GLIBCXX_BIND_ARGS\n#undef _GLIBCXX_BIND_PARAMS\n#undef _GLIBCXX_BIND_TEMPLATE_ARGS\n#undef _GLIBCXX_BIND_TEMPLATE_PARAMS\n#undef _GLIBCXX_BIND_COMMA\n#undef _GLIBCXX_BIND_NUM_ARGS\n\n#define _GLIBCXX_BIND_NUM_ARGS 7\n#define _GLIBCXX_BIND_COMMA ,\n#define _GLIBCXX_BIND_TEMPLATE_PARAMS typename _U1, typename _U2, typename _U3, typename _U4, typename _U5, typename _U6, typename _U7\n#define _GLIBCXX_BIND_TEMPLATE_ARGS _U1, _U2, _U3, _U4, _U5, _U6, _U7\n#define _GLIBCXX_BIND_PARAMS _U1& __u1, _U2& __u2, _U3& __u3, _U4& __u4, _U5& __u5, _U6& __u6, _U7& __u7\n#define _GLIBCXX_BIND_ARGS __u1, __u2, __u3, __u4, __u5, __u6, __u7\n#include _GLIBCXX_BIND_REPEAT_HEADER\n#undef _GLIBCXX_BIND_ARGS\n#undef _GLIBCXX_BIND_PARAMS\n#undef _GLIBCXX_BIND_TEMPLATE_ARGS\n#undef _GLIBCXX_BIND_TEMPLATE_PARAMS\n#undef _GLIBCXX_BIND_COMMA\n#undef _GLIBCXX_BIND_NUM_ARGS\n\n#define _GLIBCXX_BIND_NUM_ARGS 8\n#define _GLIBCXX_BIND_COMMA ,\n#define _GLIBCXX_BIND_TEMPLATE_PARAMS typename _U1, typename _U2, typename _U3, typename _U4, typename _U5, typename _U6, typename _U7, typename _U8\n#define _GLIBCXX_BIND_TEMPLATE_ARGS _U1, _U2, _U3, _U4, _U5, _U6, _U7, _U8\n#define _GLIBCXX_BIND_PARAMS _U1& __u1, _U2& __u2, _U3& __u3, _U4& __u4, _U5& __u5, _U6& __u6, _U7& __u7, _U8& __u8\n#define _GLIBCXX_BIND_ARGS __u1, __u2, __u3, __u4, __u5, __u6, __u7, __u8\n#include _GLIBCXX_BIND_REPEAT_HEADER\n#undef _GLIBCXX_BIND_ARGS\n#undef _GLIBCXX_BIND_PARAMS\n#undef _GLIBCXX_BIND_TEMPLATE_ARGS\n#undef _GLIBCXX_BIND_TEMPLATE_PARAMS\n#undef _GLIBCXX_BIND_COMMA\n#undef _GLIBCXX_BIND_NUM_ARGS\n\n#define _GLIBCXX_BIND_NUM_ARGS 9\n#define _GLIBCXX_BIND_COMMA ,\n#define _GLIBCXX_BIND_TEMPLATE_PARAMS typename _U1, typename _U2, typename _U3, typename _U4, typename _U5, typename _U6, typename _U7, typename _U8, typename _U9\n#define _GLIBCXX_BIND_TEMPLATE_ARGS _U1, _U2, _U3, _U4, _U5, _U6, _U7, _U8, _U9\n#define _GLIBCXX_BIND_PARAMS _U1& __u1, _U2& __u2, _U3& __u3, _U4& __u4, _U5& __u5, _U6& __u6, _U7& __u7, _U8& __u8, _U9& __u9\n#define _GLIBCXX_BIND_ARGS __u1, __u2, __u3, __u4, __u5, __u6, __u7, __u8, __u9\n#include _GLIBCXX_BIND_REPEAT_HEADER\n#undef _GLIBCXX_BIND_ARGS\n#undef _GLIBCXX_BIND_PARAMS\n#undef _GLIBCXX_BIND_TEMPLATE_ARGS\n#undef _GLIBCXX_BIND_TEMPLATE_PARAMS\n#undef _GLIBCXX_BIND_COMMA\n#undef _GLIBCXX_BIND_NUM_ARGS\n\n#define _GLIBCXX_BIND_NUM_ARGS 10\n#define _GLIBCXX_BIND_COMMA ,\n#define _GLIBCXX_BIND_TEMPLATE_PARAMS typename _U1, typename _U2, typename _U3, typename _U4, typename _U5, typename _U6, typename _U7, typename _U8, typename _U9, typename _U10\n#define _GLIBCXX_BIND_TEMPLATE_ARGS _U1, _U2, _U3, _U4, _U5, _U6, _U7, _U8, _U9, _U10\n#define _GLIBCXX_BIND_PARAMS _U1& __u1, _U2& __u2, _U3& __u3, _U4& __u4, _U5& __u5, _U6& __u6, _U7& __u7, _U8& __u8, _U9& __u9, _U10& __u10\n#define _GLIBCXX_BIND_ARGS __u1, __u2, __u3, __u4, __u5, __u6, __u7, __u8, __u9, __u10\n#include _GLIBCXX_BIND_REPEAT_HEADER\n#undef _GLIBCXX_BIND_ARGS\n#undef _GLIBCXX_BIND_PARAMS\n#undef _GLIBCXX_BIND_TEMPLATE_ARGS\n#undef _GLIBCXX_BIND_TEMPLATE_PARAMS\n#undef _GLIBCXX_BIND_COMMA\n#undef _GLIBCXX_BIND_NUM_ARGS\n\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/tr1/boost_shared_ptr.h",
    "content": "// <tr1/boost_shared_ptr.h> -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n//  shared_count.hpp\n//  Copyright (c) 2001, 2002, 2003 Peter Dimov and Multi Media Ltd.\n\n//  shared_ptr.hpp\n//  Copyright (C) 1998, 1999 Greg Colvin and Beman Dawes.\n//  Copyright (C) 2001, 2002, 2003 Peter Dimov\n\n//  weak_ptr.hpp\n//  Copyright (C) 2001, 2002, 2003 Peter Dimov\n\n//  enable_shared_from_this.hpp\n//  Copyright (C) 2002 Peter Dimov\n\n// Distributed under the Boost Software License, Version 1.0. (See\n// accompanying file LICENSE_1_0.txt or copy at\n// http://www.boost.org/LICENSE_1_0.txt)\n\n// GCC Note:  based on version 1.32.0 of the Boost library.\n\n/** @file tr1/boost_shared_ptr.h\n *  This is an internal header file, included by other library headers.\n *  You should not attempt to use it directly.\n */\n\n#ifndef _BOOST_SHARED_PTR_H\n#define _BOOST_SHARED_PTR_H 1\n\nnamespace std\n{\n_GLIBCXX_BEGIN_NAMESPACE(tr1)\n\n  class bad_weak_ptr : public std::exception\n  {\n  public:\n    virtual char const*\n    what() const throw()\n    { return \"tr1::bad_weak_ptr\"; }\n  };\n\n  // Substitute for bad_weak_ptr object in the case of -fno-exceptions.\n  inline void\n  __throw_bad_weak_ptr()\n  {\n#if __EXCEPTIONS\n    throw bad_weak_ptr();\n#else\n    std::abort();\n#endif\n  }\n\n  using __gnu_cxx::_Lock_policy;\n  using __gnu_cxx::__default_lock_policy;\n  using __gnu_cxx::_S_single;\n  using __gnu_cxx::_S_mutex;\n  using __gnu_cxx::_S_atomic;\n\n  template<typename _Tp>\n    struct _Sp_deleter\n    {\n      typedef void result_type;\n      typedef _Tp* argument_type;\n\n      void\n      operator()(_Tp* __p) const\n      { delete __p; }\n    };\n\n  // Empty helper class except when the template argument is _S_mutex.\n  template<_Lock_policy _Lp>\n    class _Mutex_base\n    { };\n\n  template<>\n    class _Mutex_base<_S_mutex>\n    : public __gnu_cxx::__mutex\n    { };\n\n  template<_Lock_policy _Lp = __default_lock_policy>\n    class _Sp_counted_base\n    : public _Mutex_base<_Lp>\n    {\n    public:  \n      _Sp_counted_base()\n      : _M_use_count(1), _M_weak_count(1) { }\n      \n      virtual\n      ~_Sp_counted_base() // nothrow \n      { }\n  \n      // Called when _M_use_count drops to zero, to release the resources\n      // managed by *this.\n      virtual void\n      _M_dispose() = 0; // nothrow\n      \n      // Called when _M_weak_count drops to zero.\n      virtual void\n      _M_destroy() // nothrow\n      { delete this; }\n      \n      virtual void*\n      _M_get_deleter(const std::type_info&) = 0;\n\n      void\n      _M_add_ref_copy()\n      { __gnu_cxx::__atomic_add_dispatch(&_M_use_count, 1); }\n  \n      void\n      _M_add_ref_lock();\n      \n      void\n      _M_release() // nothrow\n      {\n\tif (__gnu_cxx::__exchange_and_add_dispatch(&_M_use_count,\n\t\t\t\t\t\t   -1) == 1)\n\t  {\n\t    _M_dispose();\n#ifdef __GTHREADS\n\t    _GLIBCXX_READ_MEM_BARRIER;\n\t    _GLIBCXX_WRITE_MEM_BARRIER;\n#endif\n\t    if (__gnu_cxx::__exchange_and_add_dispatch(&_M_weak_count,\n\t\t\t\t\t\t       -1) == 1)\n\t      _M_destroy();\n\t  }\n      }\n  \n      void\n      _M_weak_add_ref() // nothrow\n      { __gnu_cxx::__atomic_add_dispatch(&_M_weak_count, 1); }\n\n      void\n      _M_weak_release() // nothrow\n      {\n\tif (__gnu_cxx::__exchange_and_add_dispatch(&_M_weak_count, -1) == 1)\n\t  {\n#ifdef __GTHREADS\n\t    _GLIBCXX_READ_MEM_BARRIER;\n\t    _GLIBCXX_WRITE_MEM_BARRIER;\n#endif\n\t    _M_destroy();\n\t  }\n      }\n  \n      long\n      _M_get_use_count() const // nothrow\n      { return _M_use_count; }  // XXX is this MT safe? \n      \n    private:  \n      _Sp_counted_base(_Sp_counted_base const&);\n      _Sp_counted_base& operator=(_Sp_counted_base const&);\n\n      _Atomic_word  _M_use_count;     // #shared\n      _Atomic_word  _M_weak_count;    // #weak + (#shared != 0)\n    };\n\n  template<>\n    inline void\n    _Sp_counted_base<_S_single>::\n    _M_add_ref_lock()\n    {\n      if (__gnu_cxx::__exchange_and_add_dispatch(&_M_use_count, 1) == 0)\n\t{\n\t  _M_use_count = 0;\n\t  __throw_bad_weak_ptr();\n\t}\n    }\n\n#ifdef __GTHREADS\n  template<>\n    inline void\n    _Sp_counted_base<_S_mutex>::\n    _M_add_ref_lock()\n    {\n      __gnu_cxx::__scoped_lock sentry(*this);\n      if (__gnu_cxx::__exchange_and_add_dispatch(&_M_use_count, 1) == 0)\n\t{\n\t  _M_use_count = 0;\n\t  __throw_bad_weak_ptr();\n\t}\n    }\n#endif\n\n  template<> \n    inline void\n    _Sp_counted_base<_S_atomic>::\n    _M_add_ref_lock()\n    {\n      // Perform lock-free add-if-not-zero operation.\n      _Atomic_word __count;\n      do\n\t{\n\t  __count = _M_use_count;\n\t  if (__count == 0)\n\t    __throw_bad_weak_ptr();\n\t  \n\t  // Replace the current counter value with the old value + 1, as\n\t  // long as it's not changed meanwhile. \n\t}\n      while (!__sync_bool_compare_and_swap(&_M_use_count, __count,\n\t\t\t\t\t   __count + 1));\n    }\n\n  template<typename _Ptr, typename _Deleter, _Lock_policy _Lp>\n    class _Sp_counted_base_impl\n    : public _Sp_counted_base<_Lp>\n    {\n    public:\n      /**\n       *  @brief   \n       *  @pre     __d(__p) must not throw.\n       */\n      _Sp_counted_base_impl(_Ptr __p, _Deleter __d)\n      : _M_ptr(__p), _M_del(__d) { }\n    \n      virtual void\n      _M_dispose() // nothrow\n      { _M_del(_M_ptr); }\n      \n      virtual void*\n      _M_get_deleter(const std::type_info& __ti)\n      { return __ti == typeid(_Deleter) ? &_M_del : 0; }\n      \n    private:\n      _Sp_counted_base_impl(const _Sp_counted_base_impl&);\n      _Sp_counted_base_impl& operator=(const _Sp_counted_base_impl&);\n      \n      _Ptr      _M_ptr;  // copy constructor must not throw\n      _Deleter  _M_del;  // copy constructor must not throw\n    };\n\n  template<_Lock_policy _Lp = __default_lock_policy>\n    class __weak_count;\n\n  template<_Lock_policy _Lp = __default_lock_policy>\n    class __shared_count\n    {\n    public: \n      __shared_count()\n      : _M_pi(0) // nothrow\n      { }\n  \n      template<typename _Ptr, typename _Deleter>\n        __shared_count(_Ptr __p, _Deleter __d) : _M_pi(0)\n        {\n\t  try\n\t    {\n\t      _M_pi = new _Sp_counted_base_impl<_Ptr, _Deleter, _Lp>(__p, __d);\n\t    }\n\t  catch(...)\n\t    {\n\t      __d(__p); // Call _Deleter on __p.\n\t      __throw_exception_again;\n\t    }\n\t}\n\n      // Special case for auto_ptr<_Tp> to provide the strong guarantee.\n      template<typename _Tp>\n        explicit\n        __shared_count(std::auto_ptr<_Tp>& __r)\n\t: _M_pi(new _Sp_counted_base_impl<_Tp*,\n\t\t_Sp_deleter<_Tp>, _Lp >(__r.get(), _Sp_deleter<_Tp>()))\n        { __r.release(); }\n  \n      // Throw bad_weak_ptr when __r._M_get_use_count() == 0.\n      explicit\n      __shared_count(const __weak_count<_Lp>& __r);\n  \n      ~__shared_count() // nothrow\n      {\n\tif (_M_pi != 0)\n\t  _M_pi->_M_release();\n      }\n      \n      __shared_count(const __shared_count& __r)\n      : _M_pi(__r._M_pi) // nothrow\n      {\n\tif (_M_pi != 0)\n\t  _M_pi->_M_add_ref_copy();\n      }\n  \n      __shared_count&\n      operator=(const __shared_count& __r) // nothrow\n      {\n\t_Sp_counted_base<_Lp>* __tmp = __r._M_pi;\n\tif (__tmp != _M_pi)\n\t  {\n\t    if (__tmp != 0)\n\t      __tmp->_M_add_ref_copy();\n\t    if (_M_pi != 0)\n\t      _M_pi->_M_release();\n\t    _M_pi = __tmp;\n\t  }\n\treturn *this;\n      }\n  \n      void\n      _M_swap(__shared_count& __r) // nothrow\n      {\n\t_Sp_counted_base<_Lp>* __tmp = __r._M_pi;\n\t__r._M_pi = _M_pi;\n\t_M_pi = __tmp;\n      }\n  \n      long\n      _M_get_use_count() const // nothrow\n      { return _M_pi != 0 ? _M_pi->_M_get_use_count() : 0; }\n\n      bool\n      _M_unique() const // nothrow\n      { return this->_M_get_use_count() == 1; }\n      \n      friend inline bool\n      operator==(const __shared_count& __a, const __shared_count& __b)\n      { return __a._M_pi == __b._M_pi; }\n  \n      friend inline bool\n      operator<(const __shared_count& __a, const __shared_count& __b)\n      { return std::less<_Sp_counted_base<_Lp>*>()(__a._M_pi, __b._M_pi); }\n  \n      void*\n      _M_get_deleter(const std::type_info& __ti) const\n      { return _M_pi ? _M_pi->_M_get_deleter(__ti) : 0; }\n\n    private:\n      friend class __weak_count<_Lp>;\n\n      _Sp_counted_base<_Lp>*  _M_pi;\n    };\n\n  template<_Lock_policy _Lp>\n    class __weak_count\n    {\n    public:\n      __weak_count()\n      : _M_pi(0) // nothrow\n      { }\n  \n      __weak_count(const __shared_count<_Lp>& __r)\n      : _M_pi(__r._M_pi) // nothrow\n      {\n\tif (_M_pi != 0)\n\t  _M_pi->_M_weak_add_ref();\n      }\n      \n      __weak_count(const __weak_count<_Lp>& __r)\n      : _M_pi(__r._M_pi) // nothrow\n      {\n\tif (_M_pi != 0)\n\t  _M_pi->_M_weak_add_ref();\n      }\n      \n      ~__weak_count() // nothrow\n      {\n\tif (_M_pi != 0)\n\t  _M_pi->_M_weak_release();\n      }\n      \n      __weak_count<_Lp>&\n      operator=(const __shared_count<_Lp>& __r) // nothrow\n      {\n\t_Sp_counted_base<_Lp>* __tmp = __r._M_pi;\n\tif (__tmp != 0)\n\t  __tmp->_M_weak_add_ref();\n\tif (_M_pi != 0)\n\t  _M_pi->_M_weak_release();\n\t_M_pi = __tmp;  \n\treturn *this;\n      }\n      \n      __weak_count<_Lp>&\n      operator=(const __weak_count<_Lp>& __r) // nothrow\n      {\n\t_Sp_counted_base<_Lp>* __tmp = __r._M_pi;\n\tif (__tmp != 0)\n\t  __tmp->_M_weak_add_ref();\n\tif (_M_pi != 0)\n\t  _M_pi->_M_weak_release();\n\t_M_pi = __tmp;\n\treturn *this;\n      }\n\n      void\n      _M_swap(__weak_count<_Lp>& __r) // nothrow\n      {\n\t_Sp_counted_base<_Lp>* __tmp = __r._M_pi;\n\t__r._M_pi = _M_pi;\n\t_M_pi = __tmp;\n      }\n  \n      long\n      _M_get_use_count() const // nothrow\n      { return _M_pi != 0 ? _M_pi->_M_get_use_count() : 0; }\n\n      friend inline bool\n      operator==(const __weak_count<_Lp>& __a, const __weak_count<_Lp>& __b)\n      { return __a._M_pi == __b._M_pi; }\n      \n      friend inline bool\n      operator<(const __weak_count<_Lp>& __a, const __weak_count<_Lp>& __b)\n      { return std::less<_Sp_counted_base<_Lp>*>()(__a._M_pi, __b._M_pi); }\n\n    private:\n      friend class __shared_count<_Lp>;\n\n      _Sp_counted_base<_Lp>*  _M_pi;\n    };\n\n  template<_Lock_policy _Lp>\n    inline\n    __shared_count<_Lp>::\n    __shared_count(const __weak_count<_Lp>& __r)\n    : _M_pi(__r._M_pi)\n    {\n      if (_M_pi != 0)\n\t_M_pi->_M_add_ref_lock();\n      else\n\t__throw_bad_weak_ptr();\n    }\n  \n\n  // Forward declarations.\n  template<typename _Tp, _Lock_policy _Lp = __default_lock_policy>\n    class __shared_ptr;\n  \n  template<typename _Tp, _Lock_policy _Lp = __default_lock_policy>\n    class __weak_ptr;\n\n  template<typename _Tp, _Lock_policy _Lp = __default_lock_policy>\n    class __enable_shared_from_this;\n\n  template<typename _Tp>\n    class shared_ptr;\n  \n  template<typename _Tp>\n    class weak_ptr;\n\n  template<typename _Tp>\n    class enable_shared_from_this;\n\n  // Support for enable_shared_from_this.\n\n  // Friend of __enable_shared_from_this.\n  template<_Lock_policy _Lp, typename _Tp1, typename _Tp2>\n    void\n    __enable_shared_from_this_helper(const __shared_count<_Lp>&,\n\t\t\t\t     const __enable_shared_from_this<_Tp1,\n\t\t\t\t     _Lp>*, const _Tp2*);\n\n  // Friend of enable_shared_from_this.\n  template<typename _Tp1, typename _Tp2>\n    void\n    __enable_shared_from_this_helper(const __shared_count<>&,\n\t\t\t\t     const enable_shared_from_this<_Tp1>*,\n\t\t\t\t     const _Tp2*);\n\n  template<_Lock_policy _Lp>\n    inline void\n    __enable_shared_from_this_helper(const __shared_count<_Lp>&, ...)\n    { }\n\n\n  struct __static_cast_tag { };\n  struct __const_cast_tag { };\n  struct __dynamic_cast_tag { };\n\n  /**\n   *  @class shared_ptr <tr1/memory>\n   *\n   *  A smart pointer with reference-counted copy semantics.\n   *  The object pointed to is deleted when the last shared_ptr pointing to\n   *  it is destroyed or reset.\n   */\n  template<typename _Tp, _Lock_policy _Lp>\n    class __shared_ptr\n    {\n    public:\n      typedef _Tp   element_type;\n      \n      /** @brief  Construct an empty %__shared_ptr.\n       *  @post   use_count()==0 && get()==0\n       */\n      __shared_ptr()\n      : _M_ptr(0), _M_refcount() // never throws\n      { }\n\n      /** @brief  Construct a %__shared_ptr that owns the pointer @a __p.\n       *  @param  __p  A pointer that is convertible to element_type*.\n       *  @post   use_count() == 1 && get() == __p\n       *  @throw  std::bad_alloc, in which case @c delete @a __p is called.\n       */\n      template<typename _Tp1>\n        explicit\n        __shared_ptr(_Tp1* __p)\n\t: _M_ptr(__p), _M_refcount(__p, _Sp_deleter<_Tp1>())\n        {\n\t  __glibcxx_function_requires(_ConvertibleConcept<_Tp1*, _Tp*>)\n\t  // __glibcxx_function_requires(_CompleteConcept<_Tp1*>)\n\t  __enable_shared_from_this_helper(_M_refcount, __p, __p);\n\t}\n\n      //\n      // Requirements: _Deleter' copy constructor and destructor must not throw\n      //\n      // __shared_ptr will release __p by calling __d(__p)\n      //\n      /** @brief  Construct a %__shared_ptr that owns the pointer @a __p\n       *          and the deleter @a __d.\n       *  @param  __p  A pointer.\n       *  @param  __d  A deleter.\n       *  @post   use_count() == 1 && get() == __p\n       *  @throw  std::bad_alloc, in which case @a __d(__p) is called.\n       */\n      template<typename _Tp1, typename _Deleter>\n        __shared_ptr(_Tp1* __p, _Deleter __d)\n\t: _M_ptr(__p), _M_refcount(__p, __d)\n        {\n\t  __glibcxx_function_requires(_ConvertibleConcept<_Tp1*, _Tp*>)\n\t  // TODO requires _Deleter CopyConstructible and __d(__p) well-formed\n\t  __enable_shared_from_this_helper(_M_refcount, __p, __p);\n\t}\n      \n      //  generated copy constructor, assignment, destructor are fine.\n      \n      /** @brief  If @a __r is empty, constructs an empty %__shared_ptr;\n       *          otherwise construct a %__shared_ptr that shares ownership\n       *          with @a __r.\n       *  @param  __r  A %__shared_ptr.\n       *  @post   get() == __r.get() && use_count() == __r.use_count()\n       *  @throw  std::bad_alloc, in which case \n       */\n      template<typename _Tp1>\n        __shared_ptr(const __shared_ptr<_Tp1, _Lp>& __r)\n\t: _M_ptr(__r._M_ptr), _M_refcount(__r._M_refcount) // never throws\n        { __glibcxx_function_requires(_ConvertibleConcept<_Tp1*, _Tp*>) }\n\n      /** @brief  Constructs a %__shared_ptr that shares ownership with @a __r\n       *          and stores a copy of the pointer stored in @a __r.\n       *  @param  __r  A weak_ptr.\n       *  @post   use_count() == __r.use_count()\n       *  @throw  bad_weak_ptr when __r.expired(),\n       *          in which case the constructor has no effect.\n       */\n      template<typename _Tp1>\n        explicit\n        __shared_ptr(const __weak_ptr<_Tp1, _Lp>& __r)\n\t: _M_refcount(__r._M_refcount) // may throw\n        {\n\t  __glibcxx_function_requires(_ConvertibleConcept<_Tp1*, _Tp*>)\n\t  // It is now safe to copy __r._M_ptr, as _M_refcount(__r._M_refcount)\n\t  // did not throw.\n\t  _M_ptr = __r._M_ptr;\n\t}\n\n      /**\n       * @post use_count() == 1 and __r.get() == 0\n       */\n      template<typename _Tp1>\n        explicit\n        __shared_ptr(std::auto_ptr<_Tp1>& __r)\n\t: _M_ptr(__r.get()), _M_refcount()\n        {\n\t  // TODO requires __r.release() convertible to _Tp*, _Tp1 is complete,\n\t  // delete __r.release() well-formed\n\t  _Tp1* __tmp = __r.get();\n\t  _M_refcount = __shared_count<_Lp>(__r);\n\t  __enable_shared_from_this_helper(_M_refcount, __tmp, __tmp);\n\t}\n\n      template<typename _Tp1>\n        __shared_ptr(const __shared_ptr<_Tp1, _Lp>& __r, __static_cast_tag)\n\t: _M_ptr(static_cast<element_type*>(__r._M_ptr)),\n\t  _M_refcount(__r._M_refcount)\n        { }\n\n      template<typename _Tp1>\n        __shared_ptr(const __shared_ptr<_Tp1, _Lp>& __r, __const_cast_tag)\n\t: _M_ptr(const_cast<element_type*>(__r._M_ptr)),\n\t  _M_refcount(__r._M_refcount)\n        { }\n\n      template<typename _Tp1>\n        __shared_ptr(const __shared_ptr<_Tp1, _Lp>& __r, __dynamic_cast_tag)\n\t: _M_ptr(dynamic_cast<element_type*>(__r._M_ptr)),\n\t  _M_refcount(__r._M_refcount)\n        {\n\t  if (_M_ptr == 0) // need to allocate new counter -- the cast failed\n\t    _M_refcount = __shared_count<_Lp>();\n\t}\n      \n      template<typename _Tp1>\n        __shared_ptr&\n        operator=(const __shared_ptr<_Tp1, _Lp>& __r) // never throws\n        {\n\t  _M_ptr = __r._M_ptr;\n\t  _M_refcount = __r._M_refcount; // __shared_count::op= doesn't throw\n\t  return *this;\n\t}\n\n      template<typename _Tp1>\n        __shared_ptr&\n        operator=(std::auto_ptr<_Tp1>& __r)\n        {\n\t  __shared_ptr(__r).swap(*this);\n\t  return *this;\n\t}\n\n      void\n      reset() // never throws\n      { __shared_ptr().swap(*this); }\n\n      template<typename _Tp1>\n        void\n        reset(_Tp1* __p) // _Tp1 must be complete.\n        {\n\t  // Catch self-reset errors.\n\t  _GLIBCXX_DEBUG_ASSERT(__p == 0 || __p != _M_ptr); \n\t  __shared_ptr(__p).swap(*this);\n\t}\n\n      template<typename _Tp1, typename _Deleter>\n        void\n        reset(_Tp1* __p, _Deleter __d)\n        { __shared_ptr(__p, __d).swap(*this); }\n\n      // Allow class instantiation when _Tp is [cv-qual] void.\n      typename add_reference<_Tp>::type\n      operator*() const // never throws\n      {\n\t_GLIBCXX_DEBUG_ASSERT(_M_ptr != 0);\n\treturn *_M_ptr;\n      }\n\n      _Tp*\n      operator->() const // never throws\n      {\n\t_GLIBCXX_DEBUG_ASSERT(_M_ptr != 0);\n\treturn _M_ptr;\n      }\n    \n      _Tp*\n      get() const // never throws\n      { return _M_ptr; }\n\n      // Implicit conversion to \"bool\"\n    private:\n      typedef _Tp* __shared_ptr::*__unspecified_bool_type;\n\n    public:\n      operator __unspecified_bool_type() const // never throws\n      { return _M_ptr == 0 ? 0 : &__shared_ptr::_M_ptr; }\n\n      bool\n      unique() const // never throws\n      { return _M_refcount._M_unique(); }\n\n      long\n      use_count() const // never throws\n      { return _M_refcount._M_get_use_count(); }\n\n      void\n      swap(__shared_ptr<_Tp, _Lp>& __other) // never throws\n      {\n\tstd::swap(_M_ptr, __other._M_ptr);\n\t_M_refcount._M_swap(__other._M_refcount);\n      }\n\n    private:\n      void*\n      _M_get_deleter(const std::type_info& __ti) const\n      { return _M_refcount._M_get_deleter(__ti); }\n\n      template<typename _Tp1, _Lock_policy _Lp1>\n        bool\n        _M_less(const __shared_ptr<_Tp1, _Lp1>& __rhs) const\n        { return _M_refcount < __rhs._M_refcount; }\n\n      template<typename _Tp1, _Lock_policy _Lp1> friend class __shared_ptr;\n      template<typename _Tp1, _Lock_policy _Lp1> friend class __weak_ptr;\n\n      template<typename _Del, typename _Tp1, _Lock_policy _Lp1>\n        friend _Del* get_deleter(const __shared_ptr<_Tp1, _Lp1>&);\n\n      // Friends injected into enclosing namespace and found by ADL:\n      template<typename _Tp1>\n        friend inline bool\n        operator==(const __shared_ptr& __a, const __shared_ptr<_Tp1, _Lp>& __b)\n        { return __a.get() == __b.get(); }\n\n      template<typename _Tp1>\n        friend inline bool\n        operator!=(const __shared_ptr& __a, const __shared_ptr<_Tp1, _Lp>& __b)\n        { return __a.get() != __b.get(); }\n\n      template<typename _Tp1>\n        friend inline bool\n        operator<(const __shared_ptr& __a, const __shared_ptr<_Tp1, _Lp>& __b)\n        { return __a._M_less(__b); }\n\n      _Tp*         \t   _M_ptr;         // Contained pointer.\n      __shared_count<_Lp>  _M_refcount;    // Reference counter.\n    };\n\n  // 2.2.3.8 shared_ptr specialized algorithms.\n  template<typename _Tp, _Lock_policy _Lp>\n    inline void\n    swap(__shared_ptr<_Tp, _Lp>& __a, __shared_ptr<_Tp, _Lp>& __b)\n    { __a.swap(__b); }\n\n  // 2.2.3.9 shared_ptr casts\n  /** @warning The seemingly equivalent\n   *           <code>shared_ptr<_Tp, _Lp>(static_cast<_Tp*>(__r.get()))</code>\n   *           will eventually result in undefined behaviour,\n   *           attempting to delete the same object twice.\n   */\n  template<typename _Tp, typename _Tp1, _Lock_policy _Lp>\n    __shared_ptr<_Tp, _Lp>\n    static_pointer_cast(const __shared_ptr<_Tp1, _Lp>& __r)\n    { return __shared_ptr<_Tp, _Lp>(__r, __static_cast_tag()); }\n\n  /** @warning The seemingly equivalent\n   *           <code>shared_ptr<_Tp, _Lp>(const_cast<_Tp*>(__r.get()))</code>\n   *           will eventually result in undefined behaviour,\n   *           attempting to delete the same object twice.\n   */\n  template<typename _Tp, typename _Tp1, _Lock_policy _Lp>\n    __shared_ptr<_Tp, _Lp>\n    const_pointer_cast(const __shared_ptr<_Tp1, _Lp>& __r)\n    { return __shared_ptr<_Tp, _Lp>(__r, __const_cast_tag()); }\n\n  /** @warning The seemingly equivalent\n   *           <code>shared_ptr<_Tp, _Lp>(dynamic_cast<_Tp*>(__r.get()))</code>\n   *           will eventually result in undefined behaviour,\n   *           attempting to delete the same object twice.\n   */\n  template<typename _Tp, typename _Tp1, _Lock_policy _Lp>\n    __shared_ptr<_Tp, _Lp>\n    dynamic_pointer_cast(const __shared_ptr<_Tp1, _Lp>& __r)\n    { return __shared_ptr<_Tp, _Lp>(__r, __dynamic_cast_tag()); }\n\n  // 2.2.3.7 shared_ptr I/O\n  template<typename _Ch, typename _Tr, typename _Tp, _Lock_policy _Lp>\n    std::basic_ostream<_Ch, _Tr>&\n    operator<<(std::basic_ostream<_Ch, _Tr>& __os, \n\t       const __shared_ptr<_Tp, _Lp>& __p)\n    {\n      __os << __p.get();\n      return __os;\n    }\n\n  // 2.2.3.10 shared_ptr get_deleter (experimental)\n  template<typename _Del, typename _Tp, _Lock_policy _Lp>\n    inline _Del*\n    get_deleter(const __shared_ptr<_Tp, _Lp>& __p)\n    { return static_cast<_Del*>(__p._M_get_deleter(typeid(_Del))); }\n\n\n  template<typename _Tp, _Lock_policy _Lp>\n    class __weak_ptr\n    {\n    public:\n      typedef _Tp element_type;\n      \n      __weak_ptr()\n      : _M_ptr(0), _M_refcount() // never throws\n      { }\n\n      // Generated copy constructor, assignment, destructor are fine.\n      \n      // The \"obvious\" converting constructor implementation:\n      //\n      //  template<typename _Tp1>\n      //    __weak_ptr(const __weak_ptr<_Tp1, _Lp>& __r)\n      //    : _M_ptr(__r._M_ptr), _M_refcount(__r._M_refcount) // never throws\n      //    { }\n      //\n      // has a serious problem.\n      //\n      //  __r._M_ptr may already have been invalidated. The _M_ptr(__r._M_ptr)\n      //  conversion may require access to *__r._M_ptr (virtual inheritance).\n      //\n      // It is not possible to avoid spurious access violations since\n      // in multithreaded programs __r._M_ptr may be invalidated at any point.\n      template<typename _Tp1>\n        __weak_ptr(const __weak_ptr<_Tp1, _Lp>& __r)\n\t: _M_refcount(__r._M_refcount) // never throws\n        {\n\t  __glibcxx_function_requires(_ConvertibleConcept<_Tp1*, _Tp*>)\n\t  _M_ptr = __r.lock().get();\n\t}\n\n      template<typename _Tp1>\n        __weak_ptr(const __shared_ptr<_Tp1, _Lp>& __r)\n\t: _M_ptr(__r._M_ptr), _M_refcount(__r._M_refcount) // never throws\n        { __glibcxx_function_requires(_ConvertibleConcept<_Tp1*, _Tp*>) }\n\n      template<typename _Tp1>\n        __weak_ptr&\n        operator=(const __weak_ptr<_Tp1, _Lp>& __r) // never throws\n        {\n\t  _M_ptr = __r.lock().get();\n\t  _M_refcount = __r._M_refcount;\n\t  return *this;\n\t}\n      \n      template<typename _Tp1>\n        __weak_ptr&\n        operator=(const __shared_ptr<_Tp1, _Lp>& __r) // never throws\n        {\n\t  _M_ptr = __r._M_ptr;\n\t  _M_refcount = __r._M_refcount;\n\t  return *this;\n\t}\n\n      __shared_ptr<_Tp, _Lp>\n      lock() const // never throws\n      {\n#ifdef __GTHREADS\n\t// Optimization: avoid throw overhead.\n\tif (expired())\n\t  return __shared_ptr<element_type, _Lp>();\n\n\ttry\n\t  {\n\t    return __shared_ptr<element_type, _Lp>(*this);\n\t  }\n\tcatch(const bad_weak_ptr&)\n\t  {\n\t    // Q: How can we get here?\n\t    // A: Another thread may have invalidated r after the\n\t    //    use_count test above.\n\t    return __shared_ptr<element_type>();\n\t  }\n\t\n#else\n\t// Optimization: avoid try/catch overhead when single threaded.\n\treturn expired() ? __shared_ptr<element_type, _Lp>()\n\t                 : __shared_ptr<element_type, _Lp>(*this);\n\n#endif\n      } // XXX MT\n\n      long\n      use_count() const // never throws\n      { return _M_refcount._M_get_use_count(); }\n\n      bool\n      expired() const // never throws\n      { return _M_refcount._M_get_use_count() == 0; }\n      \n      void\n      reset() // never throws\n      { __weak_ptr().swap(*this); }\n\n      void\n      swap(__weak_ptr& __s) // never throws\n      {\n\tstd::swap(_M_ptr, __s._M_ptr);\n\t_M_refcount._M_swap(__s._M_refcount);\n      }\n\n    private:\n      // Used by __enable_shared_from_this.\n      void\n      _M_assign(_Tp* __ptr, const __shared_count<_Lp>& __refcount)\n      {\n\t_M_ptr = __ptr;\n\t_M_refcount = __refcount;\n      }\n\n      template<typename _Tp1>\n        bool\n        _M_less(const __weak_ptr<_Tp1, _Lp>& __rhs) const\n        { return _M_refcount < __rhs._M_refcount; }\n\n      template<typename _Tp1, _Lock_policy _Lp1> friend class __shared_ptr;\n      template<typename _Tp1, _Lock_policy _Lp1> friend class __weak_ptr;\n      friend class __enable_shared_from_this<_Tp, _Lp>;\n      friend class enable_shared_from_this<_Tp>;\n\n      // Friend injected into namespace and found by ADL.\n      template<typename _Tp1>\n        friend inline bool\n        operator<(const __weak_ptr& __lhs, const __weak_ptr<_Tp1, _Lp>& __rhs)\n        { return __lhs._M_less(__rhs); }\n\n      _Tp*       \t _M_ptr;         // Contained pointer.\n      __weak_count<_Lp>  _M_refcount;    // Reference counter.\n    };\n\n  // 2.2.4.7 weak_ptr specialized algorithms.\n  template<typename _Tp, _Lock_policy _Lp>\n    inline void\n    swap(__weak_ptr<_Tp, _Lp>& __a, __weak_ptr<_Tp, _Lp>& __b)\n    { __a.swap(__b); }\n\n\n  template<typename _Tp, _Lock_policy _Lp>\n    class __enable_shared_from_this\n    {\n    protected:\n      __enable_shared_from_this() { }\n      \n      __enable_shared_from_this(const __enable_shared_from_this&) { }\n      \n      __enable_shared_from_this&\n      operator=(const __enable_shared_from_this&)\n      { return *this; }\n\n      ~__enable_shared_from_this() { }\n      \n    public:\n      __shared_ptr<_Tp, _Lp>\n      shared_from_this()\n      { return __shared_ptr<_Tp, _Lp>(this->_M_weak_this); }\n\n      __shared_ptr<const _Tp, _Lp>\n      shared_from_this() const\n      { return __shared_ptr<const _Tp, _Lp>(this->_M_weak_this); }\n\n    private:\n      template<typename _Tp1>\n        void\n        _M_weak_assign(_Tp1* __p, const __shared_count<_Lp>& __n) const\n        { _M_weak_this._M_assign(__p, __n); }\n\n      template<typename _Tp1>\n        friend void\n        __enable_shared_from_this_helper(const __shared_count<_Lp>& __pn,\n\t\t\t\t\t const __enable_shared_from_this* __pe,\n\t\t\t\t\t const _Tp1* __px)\n        {\n\t  if (__pe != 0)\n\t    __pe->_M_weak_assign(const_cast<_Tp1*>(__px), __pn);\n\t}\n\n      mutable __weak_ptr<_Tp, _Lp>  _M_weak_this;\n    };\n\n\n  // The actual TR1 shared_ptr, with forwarding constructors and\n  // assignment operators.\n  template<typename _Tp>\n    class shared_ptr\n    : public __shared_ptr<_Tp>\n    {\n    public:\n      shared_ptr()\n      : __shared_ptr<_Tp>() { }\n\n      template<typename _Tp1>\n        explicit\n        shared_ptr(_Tp1* __p)\n\t: __shared_ptr<_Tp>(__p) { }\n\n      template<typename _Tp1, typename _Deleter>\n        shared_ptr(_Tp1* __p, _Deleter __d)\n\t: __shared_ptr<_Tp>(__p, __d) { }\n\n      template<typename _Tp1>\n        shared_ptr(const shared_ptr<_Tp1>& __r)\n\t: __shared_ptr<_Tp>(__r) { }\n\n      template<typename _Tp1>\n        explicit\n        shared_ptr(const weak_ptr<_Tp1>& __r)\n\t: __shared_ptr<_Tp>(__r) { }\n\n      template<typename _Tp1>\n        explicit\n        shared_ptr(std::auto_ptr<_Tp1>& __r)\n\t: __shared_ptr<_Tp>(__r) { }\n\n      template<typename _Tp1>\n        shared_ptr(const shared_ptr<_Tp1>& __r, __static_cast_tag)\n\t: __shared_ptr<_Tp>(__r, __static_cast_tag()) { }\n\n      template<typename _Tp1>\n        shared_ptr(const shared_ptr<_Tp1>& __r, __const_cast_tag)\n\t: __shared_ptr<_Tp>(__r, __const_cast_tag()) { }\n\n      template<typename _Tp1>\n        shared_ptr(const shared_ptr<_Tp1>& __r, __dynamic_cast_tag)\n\t: __shared_ptr<_Tp>(__r, __dynamic_cast_tag()) { }\n\n      template<typename _Tp1>\n        shared_ptr&\n        operator=(const shared_ptr<_Tp1>& __r) // never throws\n        {\n\t  this->__shared_ptr<_Tp>::operator=(__r);\n\t  return *this;\n\t}\n\n      template<typename _Tp1>\n        shared_ptr&\n        operator=(std::auto_ptr<_Tp1>& __r)\n        {\n\t  this->__shared_ptr<_Tp>::operator=(__r);\n\t  return *this;\n\t}\n    };\n\n  template<typename _Tp, typename _Tp1>\n    shared_ptr<_Tp>\n    static_pointer_cast(const shared_ptr<_Tp1>& __r)\n    { return shared_ptr<_Tp>(__r, __static_cast_tag()); }\n\n  template<typename _Tp, typename _Tp1>\n    shared_ptr<_Tp>\n    const_pointer_cast(const shared_ptr<_Tp1>& __r)\n    { return shared_ptr<_Tp>(__r, __const_cast_tag()); }\n\n  template<typename _Tp, typename _Tp1>\n    shared_ptr<_Tp>\n    dynamic_pointer_cast(const shared_ptr<_Tp1>& __r)\n    { return shared_ptr<_Tp>(__r, __dynamic_cast_tag()); }\n\n\n  // The actual TR1 weak_ptr, with forwarding constructors and\n  // assignment operators.\n  template<typename _Tp>\n    class weak_ptr\n    : public __weak_ptr<_Tp>\n    {\n    public:\n      weak_ptr()\n      : __weak_ptr<_Tp>() { }\n      \n      template<typename _Tp1>\n        weak_ptr(const weak_ptr<_Tp1>& __r)\n\t: __weak_ptr<_Tp>(__r) { }\n\n      template<typename _Tp1>\n        weak_ptr(const shared_ptr<_Tp1>& __r)\n\t: __weak_ptr<_Tp>(__r) { }\n\n      template<typename _Tp1>\n        weak_ptr&\n        operator=(const weak_ptr<_Tp1>& __r) // never throws\n        {\n\t  this->__weak_ptr<_Tp>::operator=(__r);\n\t  return *this;\n\t}\n\n      template<typename _Tp1>\n        weak_ptr&\n        operator=(const shared_ptr<_Tp1>& __r) // never throws\n        {\n\t  this->__weak_ptr<_Tp>::operator=(__r);\n\t  return *this;\n\t}\n\n      shared_ptr<_Tp>\n      lock() const // never throws\n      {\n#ifdef __GTHREADS\n\tif (this->expired())\n\t  return shared_ptr<_Tp>();\n\n\ttry\n\t  {\n\t    return shared_ptr<_Tp>(*this);\n\t  }\n\tcatch(const bad_weak_ptr&)\n\t  {\n\t    return shared_ptr<_Tp>();\n\t  }\n#else\n\treturn this->expired() ? shared_ptr<_Tp>()\n\t                       : shared_ptr<_Tp>(*this);\n#endif\n      }\n    };\n\n\n  template<typename _Tp>\n    class enable_shared_from_this\n    {\n    protected:\n      enable_shared_from_this() { }\n      \n      enable_shared_from_this(const enable_shared_from_this&) { }\n\n      enable_shared_from_this&\n      operator=(const enable_shared_from_this&)\n      { return *this; }\n\n      ~enable_shared_from_this() { }\n\n    public:\n      shared_ptr<_Tp>\n      shared_from_this()\n      { return shared_ptr<_Tp>(this->_M_weak_this); }\n\n      shared_ptr<const _Tp>\n      shared_from_this() const\n      { return shared_ptr<const _Tp>(this->_M_weak_this); }\n\n    private:\n      template<typename _Tp1>\n        void\n        _M_weak_assign(_Tp1* __p, const __shared_count<>& __n) const\n        { _M_weak_this._M_assign(__p, __n); }\n\n      template<typename _Tp1>\n        friend void\n        __enable_shared_from_this_helper(const __shared_count<>& __pn,\n\t\t\t\t\t const enable_shared_from_this* __pe,\n\t\t\t\t\t const _Tp1* __px)\n        {\n\t  if (__pe != 0)\n\t    __pe->_M_weak_assign(const_cast<_Tp1*>(__px), __pn);\n\t}\n\n      mutable weak_ptr<_Tp>  _M_weak_this;\n    };\n\n_GLIBCXX_END_NAMESPACE\n} // namespace std\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/tr1/cctype",
    "content": "// TR1 cctype -*- C++ -*-\n\n// Copyright (C) 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n/** @file tr1/cctype\n *  This is a TR1 C++ Library header. \n */\n\n#ifndef _TR1_CCTYPE\n#define _TR1_CCTYPE 1\n\n#include <bits/c++config.h>\n#include <cctype>\n\n#if _GLIBCXX_USE_C99_CTYPE_TR1\n\n#undef isblank\n\n// namespace std::tr1\nnamespace std\n{\n_GLIBCXX_BEGIN_NAMESPACE(tr1)\n\n  using ::isblank;\n\n_GLIBCXX_END_NAMESPACE\n}\n\n#endif\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/tr1/cfenv",
    "content": "// TR1 cctype -*- C++ -*-\n\n// Copyright (C) 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n/** @file tr1/cfenv\n *  This is a TR1 C++ Library header. \n */\n\n#ifndef _TR1_CFENV\n#define _TR1_CFENV 1\n\n#include <bits/c++config.h>\n\n#if _GLIBCXX_USE_C99_FENV_TR1\n\n#include <fenv.h>\n\n#undef feclearexcept\n#undef fegetexceptflag\n#undef feraiseexcept\n#undef fesetexceptflag\n#undef fetestexcept\n#undef fegetround\n#undef fesetround\n#undef fegetenv\n#undef feholdexcept\n#undef fesetenv\n#undef feupdateenv\n\n// namespace std::tr1\nnamespace std\n{\n_GLIBCXX_BEGIN_NAMESPACE(tr1)\n\n  // types\n  using ::fenv_t;\n  using ::fexcept_t;\n\n  // functions\n  using ::feclearexcept;\n  using ::fegetexceptflag;\n  using ::feraiseexcept;\n  using ::fesetexceptflag;\n  using ::fetestexcept;\n\n  using ::fegetround;\n  using ::fesetround;\n\n  using ::fegetenv;\n  using ::feholdexcept;\n  using ::fesetenv;\n  using ::feupdateenv;\n  \n_GLIBCXX_END_NAMESPACE\n}\n\n#endif\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/tr1/cfloat",
    "content": "// TR1 cfloat -*- C++ -*-\n\n// Copyright (C) 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n/** @file tr1/cfloat\n *  This is a TR1 C++ Library header. \n */\n\n#ifndef _TR1_CFLOAT\n#define _TR1_CFLOAT 1\n\n#include <cfloat>\n\n#ifndef DECIMAL_DIG\n#define DECIMAL_DIG __DECIMAL_DIG__\n#endif\n\n#ifndef FLT_EVAL_METHOD\n#define FLT_EVAL_METHOD __FLT_EVAL_METHOD__\n#endif\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/tr1/cinttypes",
    "content": "// TR1 cinttypes -*- C++ -*-\n\n// Copyright (C) 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n/** @file tr1/cinttypes\n *  This is a TR1 C++ Library header. \n */\n\n#ifndef _TR1_CINTTYPES\n#define _TR1_CINTTYPES 1\n\n#include <bits/c++config.h>\n#include <tr1/cstdint>\n\n#if _GLIBCXX_USE_C99_INTTYPES_TR1\n\n// For 8.11.1/1 (see C99, Note 184) \n#define __STDC_FORMAT_MACROS\n#include <inttypes.h>\n\n// namespace std::tr1\nnamespace std\n{\n_GLIBCXX_BEGIN_NAMESPACE(tr1)\n\n  // types\n  using ::imaxdiv_t;\n\n  // functions\n  using ::imaxabs;\n\n  // May collide with _Longlong abs(_Longlong), and is not described\n  // anywhere outside the synopsis.  Likely, a defect.\n  //\n  // intmax_t abs(intmax_t)\n\n  using ::imaxdiv;\n\n  // Likewise, with lldiv_t div(_Longlong, _Longlong).\n  //\n  // imaxdiv_t div(intmax_t, intmax_t)\n\n  using ::strtoimax;\n  using ::strtoumax;\n\n#ifdef _GLIBCXX_USE_WCHAR_T\n  using ::wcstoimax;\n  using ::wcstoumax;\n#endif\n\n_GLIBCXX_END_NAMESPACE\n}\n\n#endif\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/tr1/climits",
    "content": "// TR1 climits -*- C++ -*-\n\n// Copyright (C) 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n/** @file tr1/climits\n *  This is a TR1 C++ Library header. \n */\n\n#ifndef _TR1_CLIMITS\n#define _TR1_CLIMITS 1\n\n#include <climits>\n\n#ifndef LLONG_MIN\n#define LLONG_MIN -__LONG_LONG_MAX__ - 1\n#endif\n\n#ifndef LLONG_MAX\n#define LLONG_MAX __LONG_LONG_MAX__\n#endif\n\n#ifndef ULLONG_MAX\n#define ULLONG_MAX __LONG_LONG_MAX__ * 2ULL + 1\n#endif\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/tr1/cmath",
    "content": "// TR1 cmath -*- C++ -*-\n\n// Copyright (C) 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n/** @file tr1/cmath\n *  This is a TR1 C++ Library header. \n */\n\n#ifndef _TR1_CMATH\n#define _TR1_CMATH 1\n\n#include <bits/c++config.h>\n#include <cmath>\n#include <tr1/common.h>\n\n#if _GLIBCXX_USE_C99_MATH_TR1\n\n#undef acosh\n#undef acoshf\n#undef acoshl\n#undef asinh\n#undef asinhf\n#undef asinhl\n#undef atanh\n#undef atanhf\n#undef atanhl\n#undef cbrt\n#undef cbrtf\n#undef cbrtl\n#undef copysign\n#undef copysignf\n#undef copysignl\n#undef erf\n#undef erff\n#undef erfl\n#undef erfc\n#undef erfcf\n#undef erfcl\n#undef exp2\n#undef exp2f\n#undef exp2l\n#undef expm1\n#undef expm1f\n#undef expm1l\n#undef fdim\n#undef fdimf\n#undef fdiml\n#undef fma\n#undef fmaf\n#undef fmal\n#undef fmax\n#undef fmaxf\n#undef fmaxl\n#undef fmin\n#undef fminf\n#undef fminl\n#undef hypot\n#undef hypotf\n#undef hypotl\n#undef ilogb\n#undef ilogbf\n#undef ilogbl\n#undef lgamma\n#undef lgammaf\n#undef lgammal\n#undef llrint\n#undef llrintf\n#undef llrintl\n#undef llround\n#undef llroundf\n#undef llroundl\n#undef log1p\n#undef log1pf\n#undef log1pl\n#undef log2\n#undef log2f\n#undef log2l\n#undef logb\n#undef logbf\n#undef logbl\n#undef lrint\n#undef lrintf\n#undef lrintl\n#undef lround\n#undef lroundf\n#undef lroundl\n#undef nan\n#undef nanf\n#undef nanl\n#undef nearbyint\n#undef nearbyintf\n#undef nearbyintl\n#undef nextafter\n#undef nextafterf\n#undef nextafterl\n#undef nexttoward\n#undef nexttowardf\n#undef nexttowardl\n#undef remainder\n#undef remainderf\n#undef remainderl\n#undef remquo\n#undef remquo\n#undef remquo\n#undef rint\n#undef rintf\n#undef rintl\n#undef round\n#undef roundf\n#undef roundl\n#undef scalbln\n#undef scalblnf\n#undef scalblnl\n#undef scalbn\n#undef scalbnf\n#undef scalbnl\n#undef tgamma\n#undef tgammaf\n#undef tgammal\n#undef trunc\n#undef truncf\n#undef truncl\n\n#endif\n\n// namespace std::tr1\nnamespace std\n{\n_GLIBCXX_BEGIN_NAMESPACE(tr1)\n\n#if _GLIBCXX_USE_C99_MATH_TR1\n\n  // types\n  using ::double_t;\n  using ::float_t;\n\n  // functions\n  using ::acosh;\n  using ::acoshf;\n  using ::acoshl;\n\n  using ::asinh;\n  using ::asinhf;\n  using ::asinhl;\n\n  using ::atanh;\n  using ::atanhf;\n  using ::atanhl;\n\n  using ::cbrt;\n  using ::cbrtf;\n  using ::cbrtl;\n\n  using ::copysign;\n  using ::copysignf;\n  using ::copysignl;\n\n  using ::erf;\n  using ::erff;\n  using ::erfl;\n\n  using ::erfc;\n  using ::erfcf;\n  using ::erfcl;\n\n  using ::exp2;\n  using ::exp2f;\n  using ::exp2l;\n\n  using ::expm1;\n  using ::expm1f;\n  using ::expm1l;\n\n  using ::fdim;\n  using ::fdimf;\n  using ::fdiml;\n\n  using ::fma;\n  using ::fmaf;\n  using ::fmal;\n\n  using ::fmax;\n  using ::fmaxf;\n  using ::fmaxl;\n\n  using ::fmin;\n  using ::fminf;\n  using ::fminl;\n\n  using ::hypot;\n  using ::hypotf;\n  using ::hypotl;\n\n  using ::ilogb;\n  using ::ilogbf;\n  using ::ilogbl;\n\n  using ::lgamma;\n  using ::lgammaf;\n  using ::lgammal;\n\n  using ::llrint;\n  using ::llrintf;\n  using ::llrintl;\n\n  using ::llround;\n  using ::llroundf;\n  using ::llroundl;\n\n  using ::log1p;\n  using ::log1pf;\n  using ::log1pl;\n\n  using ::log2;\n  using ::log2f;\n  using ::log2l;\n\n  using ::logb;\n  using ::logbf;\n  using ::logbl;\n\n  using ::lrint;\n  using ::lrintf;\n  using ::lrintl;\n\n  using ::lround;\n  using ::lroundf;\n  using ::lroundl;\n\n  using ::nan;\n  using ::nanf;\n  using ::nanl;\n\n  using ::nearbyint;\n  using ::nearbyintf;\n  using ::nearbyintl;\n\n  using ::nextafter;\n  using ::nextafterf;\n  using ::nextafterl;\n\n  using ::nexttoward;\n  using ::nexttowardf;\n  using ::nexttowardl;\n\n  using ::remainder;\n  using ::remainderf;\n  using ::remainderl;\n\n  using ::remquo;\n  using ::remquo;\n  using ::remquo;\n\n  using ::rint;\n  using ::rintf;\n  using ::rintl;\n\n  using ::round;\n  using ::roundf;\n  using ::roundl;\n\n  using ::scalbln;\n  using ::scalblnf;\n  using ::scalblnl;\n\n  using ::scalbn;\n  using ::scalbnf;\n  using ::scalbnl;\n\n  using ::tgamma;\n  using ::tgammaf;\n  using ::tgammal;\n\n  using ::trunc;\n  using ::truncf;\n  using ::truncl;\n\n#endif\n\n#if _GLIBCXX_USE_C99_MATH\n#if !_GLIBCXX_USE_C99_FP_MACROS_DYNAMIC\n\n  /// @brief Function template definitions [8.16.3].\n  //\n  using std::signbit;\n  \n  using std::fpclassify;\n\n  using std::isfinite;\n  using std::isinf;\n  using std::isnan;\n  using std::isnormal;\n\n  using std::isgreater;\n  using std::isgreaterequal;\n  using std::isless;\n  using std::islessequal;\n  using std::islessgreater;\n  using std::isunordered;\n#endif\n#endif\n\n#if _GLIBCXX_USE_C99_MATH_TR1\n\n  /// @brief Additional overloads [8.16.4].\n  //\n  using std::acos;\n\n  inline float\n  acosh(float __x)\n  { return __builtin_acoshf(__x); }\n\n  inline long double\n  acosh(long double __x)\n  { return __builtin_acoshl(__x); }\n\n  template<typename _Tp>\n    inline typename __promote<_Tp>::__type \n    acosh(_Tp __x)\n    {\n      typedef typename __promote<_Tp>::__type __type;\n      return acosh(__type(__x));\n    }\n\n  using std::asin;\n\n  inline float\n  asinh(float __x)\n  { return __builtin_asinhf(__x); }\n\n  inline long double\n  asinh(long double __x)\n  { return __builtin_asinhl(__x); }\n\n  template<typename _Tp>\n    inline typename __promote<_Tp>::__type \n    asinh(_Tp __x)\n    {\n      typedef typename __promote<_Tp>::__type __type;\n      return asinh(__type(__x));\n    }\n\n  using std::atan;\n\n  // Workaround for c++/21682.\n  namespace __detail\n  {\n    template<typename _Tp, typename _Up>\n      inline typename\n      __gnu_cxx::__enable_if<std::__is_floating<_Tp>::__value\n                             || std::__is_floating<_Up>::__value,\n\t\t\t     typename\n\t\t\t     std::tr1::__promote_2<_Tp, _Up>::__type>::__type\n      atan2(_Tp __y, _Up __x)\n      {\n\ttypedef typename std::tr1::__promote_2<_Tp, _Up>::__type __type;\n\treturn std::atan2(__type(__y), __type(__x));\n      }\n  } // namespace __detail\n\n  using std::atan2;\n  using __detail::atan2;\n \n  inline float\n  atanh(float __x)\n  { return __builtin_atanhf(__x); }\n\n  inline long double\n  atanh(long double __x)\n  { return __builtin_atanhl(__x); }\n\n  template<typename _Tp>\n    inline typename __promote<_Tp>::__type \n    atanh(_Tp __x)\n    {\n      typedef typename __promote<_Tp>::__type __type;\n      return atanh(__type(__x));\n    }\n\n  inline float\n  cbrt(float __x)\n  { return __builtin_cbrtf(__x); }\n\n  inline long double\n  cbrt(long double __x)\n  { return __builtin_cbrtl(__x); }\n\n  template<typename _Tp>\n    inline typename __promote<_Tp>::__type \n    cbrt(_Tp __x)\n    {\n      typedef typename __promote<_Tp>::__type __type;\n      return cbrt(__type(__x));\n    }\n\n  using std::ceil;\n\n  inline float\n  copysign(float __x, float __y)\n  { return __builtin_copysignf(__x, __y); }\n\n  inline long double\n  copysign(long double __x, long double __y)\n  { return __builtin_copysignl(__x, __y); }\n\n  template<typename _Tp, typename _Up>\n    inline typename __promote_2<_Tp, _Up>::__type\n    copysign(_Tp __x, _Up __y)\n    {\n      typedef typename __promote_2<_Tp, _Up>::__type __type;\n      return copysign(__type(__x), __type(__y));\n    }\n\n  using std::cos;\n  using std::cosh;  \n\n  inline float\n  erf(float __x)\n  { return __builtin_erff(__x); }\n\n  inline long double\n  erf(long double __x)\n  { return __builtin_erfl(__x); }\n\n  template<typename _Tp>\n    inline typename __promote<_Tp>::__type \n    erf(_Tp __x)\n    {\n      typedef typename __promote<_Tp>::__type __type;\n      return erf(__type(__x));\n    }\n\n  inline float\n  erfc(float __x)\n  { return __builtin_erfcf(__x); }\n\n  inline long double\n  erfc(long double __x)\n  { return __builtin_erfcl(__x); }\n\n  template<typename _Tp>\n    inline typename __promote<_Tp>::__type \n    erfc(_Tp __x)\n    {\n      typedef typename __promote<_Tp>::__type __type;\n      return erfc(__type(__x));\n    }\n\n  using std::exp;\n\n  inline float\n  exp2(float __x)\n  { return __builtin_exp2f(__x); }\n\n  inline long double\n  exp2(long double __x)\n  { return __builtin_exp2l(__x); }\n\n  template<typename _Tp>\n    inline typename __promote<_Tp>::__type \n    exp2(_Tp __x)\n    {\n      typedef typename __promote<_Tp>::__type __type;\n      return exp2(__type(__x));\n    }\n\n  inline float\n  expm1(float __x)\n  { return __builtin_expm1f(__x); }\n\n  inline long double\n  expm1(long double __x)\n  { return __builtin_expm1l(__x); }\n\n  template<typename _Tp>\n    inline typename __promote<_Tp>::__type \n    expm1(_Tp __x)\n    {\n      typedef typename __promote<_Tp>::__type __type;\n      return expm1(__type(__x));\n    }\n\n  using std::fabs;\n\n  inline float\n  fdim(float __x, float __y)\n  { return __builtin_fdimf(__x, __y); }\n\n  inline long double\n  fdim(long double __x, long double __y)\n  { return __builtin_fdiml(__x, __y); }\n\n  template<typename _Tp, typename _Up>\n    inline typename __promote_2<_Tp, _Up>::__type\n    fdim(_Tp __x, _Up __y)\n    {\n      typedef typename __promote_2<_Tp, _Up>::__type __type;\n      return fdim(__type(__x), __type(__y));\n    }\n\n  using std::floor;\n\n  inline float\n  fma(float __x, float __y, float __z)\n  { return __builtin_fmaf(__x, __y, __z); }\n\n  inline long double\n  fma(long double __x, long double __y, long double __z)\n  { return __builtin_fmal(__x, __y, __z); }\n\n  template<typename _Tp, typename _Up, typename _Vp>\n    inline typename __promote_3<_Tp, _Up, _Vp>::__type\n    fma(_Tp __x, _Up __y, _Vp __z)\n    {\n      typedef typename __promote_3<_Tp, _Up, _Vp>::__type __type;\n      return fma(__type(__x), __type(__y), __type(__z));\n    }\n\n  inline float\n  fmax(float __x, float __y)\n  { return __builtin_fmaxf(__x, __y); }\n\n  inline long double\n  fmax(long double __x, long double __y)\n  { return __builtin_fmaxl(__x, __y); }\n\n  template<typename _Tp, typename _Up>\n    inline typename __promote_2<_Tp, _Up>::__type\n    fmax(_Tp __x, _Up __y)\n    {\n      typedef typename __promote_2<_Tp, _Up>::__type __type;\n      return fmax(__type(__x), __type(__y));\n    }\n\n  inline float\n  fmin(float __x, float __y)\n  { return __builtin_fminf(__x, __y); }\n\n  inline long double\n  fmin(long double __x, long double __y)\n  { return __builtin_fminl(__x, __y); }\n\n  template<typename _Tp, typename _Up>\n    inline typename __promote_2<_Tp, _Up>::__type\n    fmin(_Tp __x, _Up __y)\n    {\n      typedef typename __promote_2<_Tp, _Up>::__type __type;\n      return fmin(__type(__x), __type(__y));\n    }\n\n  using std::fmod;\n  using std::frexp;\n\n  inline float\n  hypot(float __x, float __y)\n  { return __builtin_hypotf(__x, __y); }\n\n  inline long double\n  hypot(long double __x, long double __y)\n  { return __builtin_hypotl(__x, __y); }\n\n  template<typename _Tp, typename _Up>\n    inline typename __promote_2<_Tp, _Up>::__type\n    hypot(_Tp __x, _Up __y)\n    {\n      typedef typename __promote_2<_Tp, _Up>::__type __type;\n      return hypot(__type(__x), __type(__y));\n    }\n\n  inline int\n  ilogb(float __x)\n  { return __builtin_ilogbf(__x); }\n\n  inline int\n  ilogb(long double __x)\n  { return __builtin_ilogbl(__x); }\n\n  template<typename _Tp>\n    inline int\n    ilogb(_Tp __x)\n    {\n      typedef typename __promote<_Tp>::__type __type;\n      return ilogb(__type(__x));\n    }\n\n  using std::ldexp;\n\n  inline float\n  lgamma(float __x)\n  { return __builtin_lgammaf(__x); }\n\n  inline long double\n  lgamma(long double __x)\n  { return __builtin_lgammal(__x); }\n\n  template<typename _Tp>\n    inline typename __promote<_Tp>::__type \n    lgamma(_Tp __x)\n    {\n      typedef typename __promote<_Tp>::__type __type;\n      return lgamma(__type(__x));\n    }\n\n  inline long long\n  llrint(float __x)\n  { return __builtin_llrintf(__x); }\n\n  inline long long\n  llrint(long double __x)\n  { return __builtin_llrintl(__x); }\n\n  template<typename _Tp>\n    inline long long\n    llrint(_Tp __x)\n    {\n      typedef typename __promote<_Tp>::__type __type;\n      return llrint(__type(__x));\n    }\n\n  inline long long\n  llround(float __x)\n  { return __builtin_llroundf(__x); }\n\n  inline long long\n  llround(long double __x)\n  { return __builtin_llroundl(__x); }\n\n  template<typename _Tp>\n    inline long long\n    llround(_Tp __x)\n    {\n      typedef typename __promote<_Tp>::__type __type;\n      return llround(__type(__x));\n    }\n\n  using std::log;\n  using std::log10;\n\n  inline float\n  log1p(float __x)\n  { return __builtin_log1pf(__x); }\n\n  inline long double\n  log1p(long double __x)\n  { return __builtin_log1pl(__x); }\n\n  template<typename _Tp>\n    inline typename __promote<_Tp>::__type \n    log1p(_Tp __x)\n    {\n      typedef typename __promote<_Tp>::__type __type;\n      return log1p(__type(__x));\n    }\n\n  // DR 568.\n  inline float\n  log2(float __x)\n  { return __builtin_log2f(__x); }\n\n  inline long double\n  log2(long double __x)\n  { return __builtin_log2l(__x); }\n\n  template<typename _Tp>\n    inline typename __promote<_Tp>::__type \n    log2(_Tp __x)\n    {\n      typedef typename __promote<_Tp>::__type __type;\n      return log2(__type(__x));\n    }\n\n  inline float\n  logb(float __x)\n  { return __builtin_logbf(__x); }\n\n  inline long double\n  logb(long double __x)\n  { return __builtin_logbl(__x); }\n\n  template<typename _Tp>\n    inline typename __promote<_Tp>::__type \n    logb(_Tp __x)\n    {\n      typedef typename __promote<_Tp>::__type __type;\n      return logb(__type(__x));\n    }\n\n  inline long\n  lrint(float __x)\n  { return __builtin_lrintf(__x); }\n\n  inline long\n  lrint(long double __x)\n  { return __builtin_lrintl(__x); }\n\n  template<typename _Tp>\n    inline long\n    lrint(_Tp __x)\n    {\n      typedef typename __promote<_Tp>::__type __type;\n      return lrint(__type(__x));\n    }\n\n  inline long\n  lround(float __x)\n  { return __builtin_lroundf(__x); }\n\n  inline long\n  lround(long double __x)\n  { return __builtin_lroundl(__x); }\n\n  template<typename _Tp>\n    inline long\n    lround(_Tp __x)\n    {\n      typedef typename __promote<_Tp>::__type __type;\n      return lround(__type(__x));\n    }\n\n  inline float\n  nearbyint(float __x)\n  { return __builtin_nearbyintf(__x); }\n\n  inline long double\n  nearbyint(long double __x)\n  { return __builtin_nearbyintl(__x); }\n\n  template<typename _Tp>\n    inline typename __promote<_Tp>::__type \n    nearbyint(_Tp __x)\n    {\n      typedef typename __promote<_Tp>::__type __type;\n      return nearbyint(__type(__x));\n    }\n\n  inline float\n  nextafter(float __x, float __y)\n  { return __builtin_nextafterf(__x, __y); }\n\n  inline long double\n  nextafter(long double __x, long double __y)\n  { return __builtin_nextafterl(__x, __y); }\n\n  template<typename _Tp, typename _Up>\n    inline typename __promote_2<_Tp, _Up>::__type\n    nextafter(_Tp __x, _Up __y)\n    {\n      typedef typename __promote_2<_Tp, _Up>::__type __type;\n      return nextafter(__type(__x), __type(__y));\n    }\n\n  inline float\n  nexttoward(float __x, long double __y)\n  { return __builtin_nexttowardf(__x, __y); }\n\n  inline long double\n  nexttoward(long double __x, long double __y)\n  { return __builtin_nexttowardl(__x, __y); }\n\n  template<typename _Tp>\n    inline typename __promote<_Tp>::__type\n    nexttoward(_Tp __x, long double __y)\n    {\n      typedef typename __promote<_Tp>::__type __type;\n      return nexttoward(__type(__x), __y);\n    }\n\n  using std::pow;\n\n  // DR 550.\n  template<typename _Tp, typename _Up>\n    inline typename __promote_2<_Tp, _Up>::__type\n    pow(_Tp __x, _Up __y)\n    {\n      typedef typename __promote_2<_Tp, _Up>::__type __type;\n      return pow(__type(__x), __type(__y));\n    }\n\n  inline float\n  remainder(float __x, float __y)\n  { return __builtin_remainderf(__x, __y); }\n\n  inline long double\n  remainder(long double __x, long double __y)\n  { return __builtin_remainderl(__x, __y); }\n\n  template<typename _Tp, typename _Up>\n    inline typename __promote_2<_Tp, _Up>::__type\n    remainder(_Tp __x, _Up __y)\n    {\n      typedef typename __promote_2<_Tp, _Up>::__type __type;\n      return remainder(__type(__x), __type(__y));\n    }\n\n  inline float\n  remquo(float __x, float __y, int* __pquo)\n  { return __builtin_remquof(__x, __y, __pquo); }\n\n  inline long double\n  remquo(long double __x, long double __y, int* __pquo)\n  { return __builtin_remquol(__x, __y, __pquo); }\n\n  template<typename _Tp, typename _Up>\n    inline typename __promote_2<_Tp, _Up>::__type\n    remquo(_Tp __x, _Up __y, int* __pquo)\n    {\n      typedef typename __promote_2<_Tp, _Up>::__type __type;\n      return remquo(__type(__x), __type(__y), __pquo);\n    }\n\n  inline float\n  rint(float __x)\n  { return __builtin_rintf(__x); }\n\n  inline long double\n  rint(long double __x)\n  { return __builtin_rintl(__x); }\n\n  template<typename _Tp>\n    inline typename __promote<_Tp>::__type\n    rint(_Tp __x)\n    {\n      typedef typename __promote<_Tp>::__type __type;\n      return rint(__type(__x));\n    }\n\n  inline float\n  round(float __x)\n  { return __builtin_roundf(__x); }\n\n  inline long double\n  round(long double __x)\n  { return __builtin_roundl(__x); }\n\n  template<typename _Tp>\n    inline typename __promote<_Tp>::__type\n    round(_Tp __x)\n    {\n      typedef typename __promote<_Tp>::__type __type;\n      return round(__type(__x));\n    }\n\n  inline float\n  scalbln(float __x, long __ex)\n  { return __builtin_scalblnf(__x, __ex); }\n\n  inline long double\n  scalbln(long double __x, long __ex)\n  { return __builtin_scalblnl(__x, __ex); }\n\n  template<typename _Tp>\n    inline typename __promote<_Tp>::__type \n    scalbln(_Tp __x, long __ex)\n    {\n      typedef typename __promote<_Tp>::__type __type;\n      return scalbln(__type(__x), __ex);\n    }\n \n  inline float\n  scalbn(float __x, int __ex)\n  { return __builtin_scalbnf(__x, __ex); }\n\n  inline long double\n  scalbn(long double __x, int __ex)\n  { return __builtin_scalbnl(__x, __ex); }\n\n  template<typename _Tp>\n    inline typename __promote<_Tp>::__type \n    scalbn(_Tp __x, int __ex)\n    {\n      typedef typename __promote<_Tp>::__type __type;\n      return scalbn(__type(__x), __ex);\n    }\n\n  using std::sin;\n  using std::sinh;\n  using std::sqrt;\n  using std::tan;\n  using std::tanh;\n\n  inline float\n  tgamma(float __x)\n  { return __builtin_tgammaf(__x); }\n\n  inline long double\n  tgamma(long double __x)\n  { return __builtin_tgammal(__x); }\n\n  template<typename _Tp>\n    inline typename __promote<_Tp>::__type \n    tgamma(_Tp __x)\n    {\n      typedef typename __promote<_Tp>::__type __type;\n      return tgamma(__type(__x));\n    }\n \n  inline float\n  trunc(float __x)\n  { return __builtin_truncf(__x); }\n\n  inline long double\n  trunc(long double __x)\n  { return __builtin_truncl(__x); }\n\n  template<typename _Tp>\n    inline typename __promote<_Tp>::__type \n    trunc(_Tp __x)\n    {\n      typedef typename __promote<_Tp>::__type __type;\n      return trunc(__type(__x));\n    }\n\n#endif\n\n_GLIBCXX_END_NAMESPACE\n}\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/tr1/common.h",
    "content": "// Internal header for TR1 complex -*- C++ -*-\n\n// Copyright (C) 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n/** @file tr1/common.h\n *  This is a TR1 C++ Library header. \n */\n\n#ifndef _TR1_COMMON_H\n#define _TR1_COMMON_H 1\n\n#include <tr1/type_traits>\n\n// namespace std::tr1\nnamespace std\n{\n_GLIBCXX_BEGIN_NAMESPACE(tr1)\n\n  template<typename _Tp, bool = is_integral<_Tp>::value>\n    struct __promote\n    { typedef double __type; };\n\n  template<typename _Tp>\n    struct __promote<_Tp, false>\n    { typedef _Tp __type; };\n\n  template<typename _Tp, typename _Up>\n    struct __promote_2\n    {\n    private:\n      typedef typename __promote<_Tp>::__type __type1;\n      typedef typename __promote<_Up>::__type __type2;\n\n    public:\n      typedef __typeof__(__type1() + __type2()) __type;\n    };\n\n  template<typename _Tp, typename _Up, typename _Vp>\n    struct __promote_3\n    {\n    private:\n      typedef typename __promote<_Tp>::__type __type1;\n      typedef typename __promote<_Up>::__type __type2;\n      typedef typename __promote<_Vp>::__type __type3;\n\n    public:\n      typedef __typeof__(__type1() + __type2() + __type3()) __type;\n    };\n\n_GLIBCXX_END_NAMESPACE\n} // namespace std\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/tr1/complex",
    "content": "// TR1 complex -*- C++ -*-\n\n// Copyright (C) 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n/** @file tr1/complex\n *  This is a TR1 C++ Library header. \n */\n\n#ifndef _TR1_COMPLEX\n#define _TR1_COMPLEX 1\n\n#include \"../complex\"\n#include <tr1/common.h>\n\n// namespace std::tr1\nnamespace std\n{\n_GLIBCXX_BEGIN_NAMESPACE(tr1)\n\n  // Forward declarations.\n  template<typename _Tp> std::complex<_Tp> acos(const std::complex<_Tp>&);\n  template<typename _Tp> std::complex<_Tp> asin(const std::complex<_Tp>&);\n  template<typename _Tp> std::complex<_Tp> atan(const std::complex<_Tp>&);\n\n  template<typename _Tp> std::complex<_Tp> acosh(const std::complex<_Tp>&);\n  template<typename _Tp> std::complex<_Tp> asinh(const std::complex<_Tp>&);\n  template<typename _Tp> std::complex<_Tp> atanh(const std::complex<_Tp>&);\n  template<typename _Tp> std::complex<_Tp> fabs(const std::complex<_Tp>&);\n\n  /// @brief acos(__z) [8.1.2].\n  //  Effects:  Behaves the same as C99 function cacos, defined\n  //            in subclause 7.3.5.1.\n  template<typename _Tp>\n    inline std::complex<_Tp>\n    __complex_acos(const std::complex<_Tp>& __z)\n    {\n      const std::complex<_Tp> __t = std::tr1::asin(__z);\n      const _Tp __pi_2 = 1.5707963267948966192313216916397514L;\n      return std::complex<_Tp>(__pi_2 - __t.real(), -__t.imag());\n    }\n\n#if _GLIBCXX_USE_C99_COMPLEX_TR1\n  inline __complex__ float\n  __complex_acos(__complex__ float __z)\n  { return __builtin_cacosf(__z); }\n\n  inline __complex__ double\n  __complex_acos(__complex__ double __z)\n  { return __builtin_cacos(__z); }\n\n  inline __complex__ long double\n  __complex_acos(const __complex__ long double& __z)\n  { return __builtin_cacosl(__z); }\n\n  template<typename _Tp>\n    inline std::complex<_Tp>\n    acos(const std::complex<_Tp>& __z)\n    { return __complex_acos(__z.__rep()); }\n#else\n  template<typename _Tp>\n    inline std::complex<_Tp>\n    acos(const std::complex<_Tp>& __z)\n    { return __complex_acos(__z); }\n#endif\n\n  /// @brief asin(__z) [8.1.3].\n  //  Effects:  Behaves the same as C99 function casin, defined\n  //            in subclause 7.3.5.2.\n  template<typename _Tp>\n    inline std::complex<_Tp>\n    __complex_asin(const std::complex<_Tp>& __z)\n    {\n      std::complex<_Tp> __t(-__z.imag(), __z.real());\n      __t = std::tr1::asinh(__t);\n      return std::complex<_Tp>(__t.imag(), -__t.real());\n    }\n\n#if _GLIBCXX_USE_C99_COMPLEX_TR1\n  inline __complex__ float\n  __complex_asin(__complex__ float __z)\n  { return __builtin_casinf(__z); }\n\n  inline __complex__ double\n  __complex_asin(__complex__ double __z)\n  { return __builtin_casin(__z); }\n\n  inline __complex__ long double\n  __complex_asin(const __complex__ long double& __z)\n  { return __builtin_casinl(__z); }\n\n  template<typename _Tp>\n    inline std::complex<_Tp>\n    asin(const std::complex<_Tp>& __z)\n    { return __complex_asin(__z.__rep()); }\n#else\n  template<typename _Tp>\n    inline std::complex<_Tp>\n    asin(const std::complex<_Tp>& __z)\n    { return __complex_asin(__z); }\n#endif\n  \n  /// @brief atan(__z) [8.1.4].\n  //  Effects:  Behaves the same as C99 function catan, defined\n  //            in subclause 7.3.5.3.\n  template<typename _Tp>\n    std::complex<_Tp>\n    __complex_atan(const std::complex<_Tp>& __z)\n    {\n      const _Tp __r2 = __z.real() * __z.real();\n      const _Tp __x = _Tp(1.0) - __r2 - __z.imag() * __z.imag();\n\n      _Tp __num = __z.imag() + _Tp(1.0);\n      _Tp __den = __z.imag() - _Tp(1.0);\n\n      __num = __r2 + __num * __num;\n      __den = __r2 + __den * __den;\n\n      return std::complex<_Tp>(_Tp(0.5) * atan2(_Tp(2.0) * __z.real(), __x),\n\t\t\t       _Tp(0.25) * log(__num / __den));\n    }\n\n#if _GLIBCXX_USE_C99_COMPLEX_TR1\n  inline __complex__ float\n  __complex_atan(__complex__ float __z)\n  { return __builtin_catanf(__z); }\n\n  inline __complex__ double\n  __complex_atan(__complex__ double __z)\n  { return __builtin_catan(__z); }\n\n  inline __complex__ long double\n  __complex_atan(const __complex__ long double& __z)\n  { return __builtin_catanl(__z); }\n\n  template<typename _Tp>\n    inline std::complex<_Tp>\n    atan(const std::complex<_Tp>& __z)\n    { return __complex_atan(__z.__rep()); }\n#else\n  template<typename _Tp>\n    inline std::complex<_Tp>\n    atan(const std::complex<_Tp>& __z)\n    { return __complex_atan(__z); }\n#endif\n\n  /// @brief acosh(__z) [8.1.5].\n  //  Effects:  Behaves the same as C99 function cacosh, defined\n  //            in subclause 7.3.6.1.\n  template<typename _Tp>\n    std::complex<_Tp>\n    __complex_acosh(const std::complex<_Tp>& __z)\n    {\n      std::complex<_Tp> __t((__z.real() - __z.imag())\n\t\t\t    * (__z.real() + __z.imag()) - _Tp(1.0),\n\t\t\t    _Tp(2.0) * __z.real() * __z.imag());\n      __t = std::sqrt(__t);\n\n      return std::log(__t + __z);\n    }\n\n#if _GLIBCXX_USE_C99_COMPLEX_TR1\n  inline __complex__ float\n  __complex_acosh(__complex__ float __z)\n  { return __builtin_cacoshf(__z); }\n\n  inline __complex__ double\n  __complex_acosh(__complex__ double __z)\n  { return __builtin_cacosh(__z); }\n\n  inline __complex__ long double\n  __complex_acosh(const __complex__ long double& __z)\n  { return __builtin_cacoshl(__z); }\n\n  template<typename _Tp>\n    inline std::complex<_Tp>\n    acosh(const std::complex<_Tp>& __z)\n    { return __complex_acosh(__z.__rep()); }\n#else\n  template<typename _Tp>\n    inline std::complex<_Tp>\n    acosh(const std::complex<_Tp>& __z)\n    { return __complex_acosh(__z); }\n#endif\n\n  /// @brief asinh(__z) [8.1.6].\n  //  Effects:  Behaves the same as C99 function casin, defined\n  //            in subclause 7.3.6.2.\n  template<typename _Tp>\n    std::complex<_Tp>\n    __complex_asinh(const std::complex<_Tp>& __z)\n    {\n      std::complex<_Tp> __t((__z.real() - __z.imag())\n\t\t\t    * (__z.real() + __z.imag()) + _Tp(1.0),\n\t\t\t    _Tp(2.0) * __z.real() * __z.imag());\n      __t = std::sqrt(__t);\n\n      return std::log(__t + __z);\n    }\n\n#if _GLIBCXX_USE_C99_COMPLEX_TR1\n  inline __complex__ float\n  __complex_asinh(__complex__ float __z)\n  { return __builtin_casinhf(__z); }\n\n  inline __complex__ double\n  __complex_asinh(__complex__ double __z)\n  { return __builtin_casinh(__z); }\n\n  inline __complex__ long double\n  __complex_asinh(const __complex__ long double& __z)\n  { return __builtin_casinhl(__z); }\n\n  template<typename _Tp>\n    inline std::complex<_Tp>\n    asinh(const std::complex<_Tp>& __z)\n    { return __complex_asinh(__z.__rep()); }\n#else\n  template<typename _Tp>\n    inline std::complex<_Tp>\n    asinh(const std::complex<_Tp>& __z)\n    { return __complex_asinh(__z); }\n#endif\n\n  /// @brief atanh(__z) [8.1.7].\n  //  Effects:  Behaves the same as C99 function catanh, defined\n  //            in subclause 7.3.6.3.\n  template<typename _Tp>\n    std::complex<_Tp>\n    __complex_atanh(const std::complex<_Tp>& __z)\n    {\n      const _Tp __i2 = __z.imag() * __z.imag();\n      const _Tp __x = _Tp(1.0) - __i2 - __z.real() * __z.real();\n\n      _Tp __num = _Tp(1.0) + __z.real();\n      _Tp __den = _Tp(1.0) - __z.real();\n\n      __num = __i2 + __num * __num;\n      __den = __i2 + __den * __den;\n\n      return std::complex<_Tp>(_Tp(0.25) * (log(__num) - log(__den)),\n\t\t\t       _Tp(0.5) * atan2(_Tp(2.0) * __z.imag(), __x));\n    }\n\n#if _GLIBCXX_USE_C99_COMPLEX_TR1\n  inline __complex__ float\n  __complex_atanh(__complex__ float __z)\n  { return __builtin_catanhf(__z); }\n\n  inline __complex__ double\n  __complex_atanh(__complex__ double __z)\n  { return __builtin_catanh(__z); }\n\n  inline __complex__ long double\n  __complex_atanh(const __complex__ long double& __z)\n  { return __builtin_catanhl(__z); }\n\n  template<typename _Tp>\n    inline std::complex<_Tp>\n    atanh(const std::complex<_Tp>& __z)\n    { return __complex_atanh(__z.__rep()); }\n#else\n  template<typename _Tp>\n    inline std::complex<_Tp>\n    atanh(const std::complex<_Tp>& __z)\n    { return __complex_atanh(__z); }\n#endif\n\n  /// @brief fabs(__z) [8.1.8].\n  //  Effects:  Behaves the same as C99 function cabs, defined\n  //            in subclause 7.3.8.1.\n  template<typename _Tp>\n    inline std::complex<_Tp>\n    fabs(const std::complex<_Tp>& __z)\n    { return std::abs(__z); }\n\n\n  /// @brief Additional overloads [8.1.9].\n  //\n\n  // See common.h for the primary template.\n  template<typename _Tp, typename _Up>\n    struct __promote_2<std::complex<_Tp>, _Up>\n    {\n    public:\n      typedef std::complex<typename __promote_2<_Tp, _Up>::__type> __type;\n    };\n\n  template<typename _Tp, typename _Up>\n    struct __promote_2<_Tp, std::complex<_Up> >\n    {\n    public:\n      typedef std::complex<typename __promote_2<_Tp, _Up>::__type> __type;\n    };\n  \n  template<typename _Tp, typename _Up>\n    struct __promote_2<std::complex<_Tp>, std::complex<_Up> >\n    {\n    public:\n      typedef std::complex<typename __promote_2<_Tp, _Up>::__type> __type;\n    };\n\n\n  using std::arg;\n\n  template<typename _Tp>\n    inline typename __promote<_Tp>::__type\n    arg(_Tp __x)\n    {\n      typedef typename __promote<_Tp>::__type __type;\n      return std::arg(std::complex<__type>(__x));\n    }\n\n  using std::conj;\n\n  template<typename _Tp>\n    inline std::complex<typename __promote<_Tp>::__type>\n    conj(_Tp __x)\n    { return __x; }\n\n  using std::imag;\n\n  template<typename _Tp>\n    inline typename __promote<_Tp>::__type\n    imag(_Tp)\n    { return _Tp(); }\n\n  using std::norm;\n\n  template<typename _Tp>\n    inline typename __promote<_Tp>::__type\n    norm(_Tp __x)\n    {\n      typedef typename __promote<_Tp>::__type __type;\n      return __type(__x) * __type(__x);\n    }\n\n  using std::polar;\n\n  template<typename _Tp, typename _Up>\n    inline std::complex<typename __promote_2<_Tp, _Up>::__type>\n    polar(const _Tp& __rho, const _Up& __theta)\n    {\n      typedef typename __promote_2<_Tp, _Up>::__type __type;\n      return std::polar(__type(__rho), __type(__theta));\n    }\n  \n  using std::pow;\n  \n  template<typename _Tp, typename _Up>\n    inline std::complex<typename __promote_2<_Tp, _Up>::__type>\n    pow(const std::complex<_Tp>& __x, const _Up& __y)\n    {\n      typedef typename __promote_2<_Tp, _Up>::__type __type;\n      return std::pow(std::complex<__type>(__x), __type(__y));\n    }\n\n  template<typename _Tp, typename _Up>\n    inline std::complex<typename __promote_2<_Tp, _Up>::__type>\n    pow(const _Tp& __x, const std::complex<_Up>& __y)\n    {\n      typedef typename __promote_2<_Tp, _Up>::__type __type;\n      return std::pow(__type(__x), std::complex<__type>(__y));\n    }\n\n  template<typename _Tp, typename _Up>\n    inline std::complex<typename __promote_2<_Tp, _Up>::__type>\n    pow(const std::complex<_Tp>& __x, const std::complex<_Up>& __y)\n    {\n      typedef typename __promote_2<_Tp, _Up>::__type __type;\n      return std::pow(std::complex<__type>(__x),\n\t\t      std::complex<__type>(__y));\n    }\n\n  using std::real;\n\n  template<typename _Tp>\n    inline typename __promote<_Tp>::__type\n    real(_Tp __x)\n    { return __x; }\n\n_GLIBCXX_END_NAMESPACE\n}\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/tr1/cstdarg",
    "content": "// TR1 cstdarg -*- C++ -*-\n\n// Copyright (C) 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n/** @file tr1/cstdarg\n *  This is a TR1 C++ Library header. \n */\n\n#ifndef _TR1_CSTDARG\n#define _TR1_CSTDARG 1\n\n#include <cstdarg>\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/tr1/cstdbool",
    "content": "// TR1 cstdbool -*- C++ -*-\n\n// Copyright (C) 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n/** @file tr1/cstdbool\n *  This is a TR1 C++ Library header. \n */\n\n#ifndef _TR1_CSTDBOOL\n#define _TR1_CSTDBOOL 1\n\n#include <bits/c++config.h>\n\n#if _GLIBCXX_HAVE_STDBOOL_H\n#include <stdbool.h>\n#endif\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/tr1/cstdint",
    "content": "// TR1 cstdint -*- C++ -*-\n\n// Copyright (C) 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n/** @file tr1/cstdint\n *  This is a TR1 C++ Library header. \n */\n\n#ifndef _TR1_CSTDINT\n#define _TR1_CSTDINT 1\n\n#include <bits/c++config.h>\n\n#if _GLIBCXX_USE_C99_STDINT_TR1\n\n// For 8.22.1/1 (see C99, Notes 219, 220, 222) \n#define __STDC_LIMIT_MACROS\n#define __STDC_CONSTANT_MACROS\n#include <stdint.h>\n\n// namespace std::tr1\nnamespace std\n{\n_GLIBCXX_BEGIN_NAMESPACE(tr1)\n\n  using ::int8_t;\n  using ::int16_t;\n  using ::int32_t;\n  using ::int64_t;\n\n  using ::int_fast8_t;\n  using ::int_fast16_t;\n  using ::int_fast32_t;\n  using ::int_fast64_t;\n\n  using ::int_least8_t;\n  using ::int_least16_t;\n  using ::int_least32_t;\n  using ::int_least64_t;\n\n  using ::intmax_t;\n  using ::intptr_t;\n  \n  using ::uint8_t;\n  using ::uint16_t;\n  using ::uint32_t;\n  using ::uint64_t;\n\n  using ::uint_fast8_t;\n  using ::uint_fast16_t;\n  using ::uint_fast32_t;\n  using ::uint_fast64_t;\n\n  using ::uint_least8_t;\n  using ::uint_least16_t;\n  using ::uint_least32_t;\n  using ::uint_least64_t;\n\n  using ::uintmax_t;\n  using ::uintptr_t;\n\n_GLIBCXX_END_NAMESPACE\n}\n\n#endif\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/tr1/cstdio",
    "content": "// TR1 cstdio -*- C++ -*-\n\n// Copyright (C) 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n/** @file tr1/cstdio\n *  This is a TR1 C++ Library header. \n */\n\n#ifndef _TR1_CSTDIO\n#define _TR1_CSTDIO 1\n\n#include <bits/c++config.h>\n#include <cstdio>\n\n// namespace std::tr1\nnamespace std\n{\n_GLIBCXX_BEGIN_NAMESPACE(tr1)\n\n#if _GLIBCXX_USE_C99\n  using std::snprintf;\n  using std::vsnprintf;\n\n  using std::vfscanf;\n  using std::vscanf;\n  using std::vsscanf;\n#endif\n\n_GLIBCXX_END_NAMESPACE\n}\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/tr1/cstdlib",
    "content": "// TR1 cstdlib -*- C++ -*-\n\n// Copyright (C) 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n/** @file tr1/cstdlib\n *  This is a TR1 C++ Library header. \n */\n\n#ifndef _TR1_CSTDLIB\n#define _TR1_CSTDLIB 1\n\n#include <bits/c++config.h>\n\n#if _GLIBCXX_HOSTED\n\n#include <cstdlib>\n\n// namespace std::tr1\nnamespace std\n{\n_GLIBCXX_BEGIN_NAMESPACE(tr1)\n\n#if _GLIBCXX_USE_C99\n\n#if !_GLIBCXX_USE_C99_LONG_LONG_DYNAMIC\n  // types\n  using std::lldiv_t;\n\n  // functions\n  using std::llabs;\n  using std::lldiv;\n#endif\n\n  using std::atoll;\n  using std::strtoll;\n  using std::strtoull;\n\n  using std::strtof;\n  using std::strtold;\n\n  // overloads\n  using std::abs;\n#if !_GLIBCXX_USE_C99_LONG_LONG_DYNAMIC\n  using std::div;\n#endif\n\n#endif\n\n_GLIBCXX_END_NAMESPACE\n}\n\n#endif\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/tr1/ctgmath",
    "content": "// TR1 ctgmath -*- C++ -*-\n\n// Copyright (C) 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n/** @file tr1/ctgmath\n *  This is a TR1 C++ Library header. \n */\n\n#ifndef _TR1_CTGMATH\n#define _TR1_CTGMATH 1\n\n#include <tr1/cmath>\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/tr1/ctime",
    "content": "// TR1 ctime -*- C++ -*-\n\n// Copyright (C) 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n/** @file tr1/ctime\n *  This is a TR1 C++ Library header. \n */\n\n#ifndef _TR1_CTIME\n#define _TR1_CTIME 1\n\n#include <ctime>\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/tr1/ctype.h",
    "content": "// TR1 ctype.h -*- C++ -*-\n\n// Copyright (C) 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n/** @file tr1/ctype.h\n *  This is a TR1 C++ Library header. \n */\n\n#ifndef _TR1_CTYPE_H\n#define _TR1_CTYPE_H 1\n\n#include <tr1/cctype>\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/tr1/cwchar",
    "content": "// TR1 cwchar -*- C++ -*-\n\n// Copyright (C) 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n/** @file tr1/cwchar\n *  This is a TR1 C++ Library header. \n */\n\n#ifndef _TR1_CWCHAR\n#define _TR1_CWCHAR 1\n\n#include <bits/c++config.h>\n\n#if _GLIBCXX_USE_WCHAR_T\n\n#include <cwchar>\n\n// namespace std::tr1\nnamespace std\n{\n_GLIBCXX_BEGIN_NAMESPACE(tr1)\n\n#if _GLIBCXX_HAVE_WCSTOF\n  using std::wcstof;\n#endif\n#if _GLIBCXX_HAVE_VFWSCANF\n  using std::vfwscanf;\n#endif\n#if _GLIBCXX_HAVE_VSWSCANF\n  using std::vswscanf;\n#endif\n#if _GLIBCXX_HAVE_VWSCANF\n  using std::vwscanf;\n#endif\n\n#if _GLIBCXX_USE_C99\n  using std::wcstold;\n  using std::wcstoll;\n  using std::wcstoull;\n#endif\n\n_GLIBCXX_END_NAMESPACE\n}\n\n#endif\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/tr1/cwctype",
    "content": "// TR1 cwctype -*- C++ -*-\n\n// Copyright (C) 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n/** @file tr1/cwctype\n *  This is a TR1 C++ Library header. \n */\n\n#ifndef _TR1_CWCTYPE\n#define _TR1_CWCTYPE 1\n\n#include <bits/c++config.h>\n\n#if _GLIBCXX_USE_WCHAR_T\n\n#include <cwctype>\n\n// namespace std::tr1\nnamespace std\n{\n_GLIBCXX_BEGIN_NAMESPACE(tr1)\n\n#if _GLIBCXX_HAVE_ISWBLANK\n  using std::iswblank;\n#endif  \n\n_GLIBCXX_END_NAMESPACE\n}\n\n#endif\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/tr1/fenv.h",
    "content": "// TR1 fenv.h -*- C++ -*-\n\n// Copyright (C) 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n/** @file tr1/fenv.h\n *  This is a TR1 C++ Library header. \n */\n\n#ifndef _TR1_FENV_H\n#define _TR1_FENV_H 1\n\n#include <tr1/cfenv>\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/tr1/float.h",
    "content": "// TR1 float.h -*- C++ -*-\n\n// Copyright (C) 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n/** @file tr1/float.h\n *  This is a TR1 C++ Library header. \n */\n\n#ifndef _TR1_FLOAT_H\n#define _TR1_FLOAT_H 1\n\n#include <tr1/cfloat>\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/tr1/functional",
    "content": "// TR1 functional header -*- C++ -*-\n\n// Copyright (C) 2004, 2005, 2006, 2007 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n/** @file tr1/functional\n *  This is a TR1 C++ Library header.\n */\n\n#ifndef _TR1_FUNCTIONAL\n#define _TR1_FUNCTIONAL 1\n\n#pragma GCC system_header\n\n#include \"../functional\"\n#include <typeinfo>\n#include <tr1/type_traits>\n#include <ext/type_traits.h>\n#include <cstdlib>  // for std::abort\n#include <tr1/tuple>\n\nnamespace std\n{\n_GLIBCXX_BEGIN_NAMESPACE(tr1)\n\n  template<typename _MemberPointer>\n    class _Mem_fn;\n\n  /**\n   *  @if maint\n   *  Actual implementation of _Has_result_type, which uses SFINAE to\n   *  determine if the type _Tp has a publicly-accessible member type\n   *  result_type.\n   *  @endif\n  */\n  template<typename _Tp>\n    class _Has_result_type_helper : __sfinae_types\n    {\n      template<typename _Up>\n      struct _Wrap_type\n      { };\n\n      template<typename _Up>\n        static __one __test(_Wrap_type<typename _Up::result_type>*);\n\n      template<typename _Up>\n        static __two __test(...);\n\n    public:\n      static const bool value = sizeof(__test<_Tp>(0)) == 1;\n    };\n\n  template<typename _Tp>\n    struct _Has_result_type\n       : integral_constant<\n           bool,\n           _Has_result_type_helper<typename remove_cv<_Tp>::type>::value>\n    { };\n\n  /**\n   *  @if maint\n   *  If we have found a result_type, extract it.\n   *  @endif\n  */\n  template<bool _Has_result_type, typename _Functor>\n    struct _Maybe_get_result_type\n    { };\n\n  template<typename _Functor>\n    struct _Maybe_get_result_type<true, _Functor>\n    {\n      typedef typename _Functor::result_type result_type;\n    };\n\n  /**\n   *  @if maint\n   *  Base class for any function object that has a weak result type, as\n   *  defined in 3.3/3 of TR1.\n   *  @endif\n  */\n  template<typename _Functor>\n    struct _Weak_result_type_impl\n    : _Maybe_get_result_type<_Has_result_type<_Functor>::value, _Functor>\n    {\n    };\n\n  /**\n   *  @if maint\n   *  Strip top-level cv-qualifiers from the function object and let\n   *  _Weak_result_type_impl perform the real work.\n   *  @endif\n  */\n  template<typename _Functor>\n    struct _Weak_result_type\n    : _Weak_result_type_impl<typename remove_cv<_Functor>::type>\n    {\n    };\n\n  template<typename _Signature>\n    class result_of;\n\n  /**\n   *  @if maint\n   *  Actual implementation of result_of. When _Has_result_type is\n   *  true, gets its result from _Weak_result_type. Otherwise, uses\n   *  the function object's member template result to extract the\n   *  result type.\n   *  @endif\n  */\n  template<bool _Has_result_type, typename _Signature>\n    struct _Result_of_impl;\n\n  // Handle member data pointers using _Mem_fn's logic\n  template<typename _Res, typename _Class, typename _T1>\n    struct _Result_of_impl<false, _Res _Class::*(_T1)>\n    {\n      typedef typename _Mem_fn<_Res _Class::*>\n                ::template _Result_type<_T1>::type type;\n    };\n\n  /**\n   *  @if maint\n   *  Determines if the type _Tp derives from unary_function.\n   *  @endif\n  */\n  template<typename _Tp>\n    struct _Derives_from_unary_function : __sfinae_types\n    {\n    private:\n      template<typename _T1, typename _Res>\n        static __one __test(const volatile unary_function<_T1, _Res>*);\n\n      // It's tempting to change \"...\" to const volatile void*, but\n      // that fails when _Tp is a function type.\n      static __two __test(...);\n\n    public:\n      static const bool value = sizeof(__test((_Tp*)0)) == 1;\n    };\n\n  /**\n   *  @if maint\n   *  Determines if the type _Tp derives from binary_function.\n   *  @endif\n  */\n  template<typename _Tp>\n    struct _Derives_from_binary_function : __sfinae_types\n    {\n    private:\n      template<typename _T1, typename _T2, typename _Res>\n        static __one __test(const volatile binary_function<_T1, _T2, _Res>*);\n\n      // It's tempting to change \"...\" to const volatile void*, but\n      // that fails when _Tp is a function type.\n      static __two __test(...);\n\n    public:\n      static const bool value = sizeof(__test((_Tp*)0)) == 1;\n    };\n\n  /**\n   *  @if maint\n   *  Turns a function type into a function pointer type\n   *  @endif\n  */\n  template<typename _Tp, bool _IsFunctionType = is_function<_Tp>::value>\n    struct _Function_to_function_pointer\n    {\n      typedef _Tp type;\n    };\n\n  template<typename _Tp>\n    struct _Function_to_function_pointer<_Tp, true>\n    {\n      typedef _Tp* type;\n    };\n\n  /**\n   *  @if maint\n   *  Knowing which of unary_function and binary_function _Tp derives\n   *  from, derives from the same and ensures that reference_wrapper\n   *  will have a weak result type. See cases below.\n   *  @endif\n   */\n  template<bool _Unary, bool _Binary, typename _Tp>\n    struct _Reference_wrapper_base_impl;\n\n  // Not a unary_function or binary_function, so try a weak result type\n  template<typename _Tp>\n    struct _Reference_wrapper_base_impl<false, false, _Tp>\n    : _Weak_result_type<_Tp>\n    { };\n\n  // unary_function but not binary_function\n  template<typename _Tp>\n    struct _Reference_wrapper_base_impl<true, false, _Tp>\n    : unary_function<typename _Tp::argument_type,\n\t\t     typename _Tp::result_type>\n    { };\n\n  // binary_function but not unary_function\n  template<typename _Tp>\n    struct _Reference_wrapper_base_impl<false, true, _Tp>\n    : binary_function<typename _Tp::first_argument_type,\n\t\t      typename _Tp::second_argument_type,\n\t\t      typename _Tp::result_type>\n    { };\n\n  // both unary_function and binary_function. import result_type to\n  // avoid conflicts.\n   template<typename _Tp>\n    struct _Reference_wrapper_base_impl<true, true, _Tp>\n    : unary_function<typename _Tp::argument_type,\n\t\t     typename _Tp::result_type>,\n      binary_function<typename _Tp::first_argument_type,\n\t\t      typename _Tp::second_argument_type,\n\t\t      typename _Tp::result_type>\n    {\n      typedef typename _Tp::result_type result_type;\n    };\n\n  /**\n   *  @if maint\n   *  Derives from unary_function or binary_function when it\n   *  can. Specializations handle all of the easy cases. The primary\n   *  template determines what to do with a class type, which may\n   *  derive from both unary_function and binary_function.\n   *  @endif\n  */\n  template<typename _Tp>\n    struct _Reference_wrapper_base\n    : _Reference_wrapper_base_impl<\n      _Derives_from_unary_function<_Tp>::value,\n      _Derives_from_binary_function<_Tp>::value,\n      _Tp>\n    { };\n\n  // - a function type (unary)\n  template<typename _Res, typename _T1>\n    struct _Reference_wrapper_base<_Res(_T1)>\n    : unary_function<_T1, _Res>\n    { };\n\n  // - a function type (binary)\n  template<typename _Res, typename _T1, typename _T2>\n    struct _Reference_wrapper_base<_Res(_T1, _T2)>\n    : binary_function<_T1, _T2, _Res>\n    { };\n\n  // - a function pointer type (unary)\n  template<typename _Res, typename _T1>\n    struct _Reference_wrapper_base<_Res(*)(_T1)>\n    : unary_function<_T1, _Res>\n    { };\n\n  // - a function pointer type (binary)\n  template<typename _Res, typename _T1, typename _T2>\n    struct _Reference_wrapper_base<_Res(*)(_T1, _T2)>\n    : binary_function<_T1, _T2, _Res>\n    { };\n\n  // - a pointer to member function type (unary, no qualifiers)\n  template<typename _Res, typename _T1>\n    struct _Reference_wrapper_base<_Res (_T1::*)()>\n    : unary_function<_T1*, _Res>\n    { };\n\n  // - a pointer to member function type (binary, no qualifiers)\n  template<typename _Res, typename _T1, typename _T2>\n    struct _Reference_wrapper_base<_Res (_T1::*)(_T2)>\n    : binary_function<_T1*, _T2, _Res>\n    { };\n\n  // - a pointer to member function type (unary, const)\n  template<typename _Res, typename _T1>\n    struct _Reference_wrapper_base<_Res (_T1::*)() const>\n    : unary_function<const _T1*, _Res>\n    { };\n\n  // - a pointer to member function type (binary, const)\n  template<typename _Res, typename _T1, typename _T2>\n    struct _Reference_wrapper_base<_Res (_T1::*)(_T2) const>\n    : binary_function<const _T1*, _T2, _Res>\n    { };\n\n  // - a pointer to member function type (unary, volatile)\n  template<typename _Res, typename _T1>\n    struct _Reference_wrapper_base<_Res (_T1::*)() volatile>\n    : unary_function<volatile _T1*, _Res>\n    { };\n\n  // - a pointer to member function type (binary, volatile)\n  template<typename _Res, typename _T1, typename _T2>\n    struct _Reference_wrapper_base<_Res (_T1::*)(_T2) volatile>\n    : binary_function<volatile _T1*, _T2, _Res>\n    { };\n\n  // - a pointer to member function type (unary, const volatile)\n  template<typename _Res, typename _T1>\n    struct _Reference_wrapper_base<_Res (_T1::*)() const volatile>\n    : unary_function<const volatile _T1*, _Res>\n    { };\n\n  // - a pointer to member function type (binary, const volatile)\n  template<typename _Res, typename _T1, typename _T2>\n    struct _Reference_wrapper_base<_Res (_T1::*)(_T2) const volatile>\n    : binary_function<const volatile _T1*, _T2, _Res>\n    { };\n\n  template<typename _Tp>\n    class reference_wrapper\n      : public _Reference_wrapper_base<typename remove_cv<_Tp>::type>\n    {\n      // If _Tp is a function type, we can't form result_of<_Tp(...)>,\n      // so turn it into a function pointer type.\n      typedef typename _Function_to_function_pointer<_Tp>::type\n        _M_func_type;\n\n      _Tp* _M_data;\n    public:\n      typedef _Tp type;\n      explicit reference_wrapper(_Tp& __indata): _M_data(&__indata)\n      { }\n\n      reference_wrapper(const reference_wrapper<_Tp>& __inref):\n      _M_data(__inref._M_data)\n      { }\n\n      reference_wrapper&\n      operator=(const reference_wrapper<_Tp>& __inref)\n      {\n        _M_data = __inref._M_data;\n        return *this;\n      }\n\n      operator _Tp&() const\n      { return this->get(); }\n\n      _Tp&\n      get() const\n      { return *_M_data; }\n\n#define _GLIBCXX_REPEAT_HEADER <tr1/ref_wrap_iterate.h>\n#include <tr1/repeat.h>\n#undef _GLIBCXX_REPEAT_HEADER\n    };\n\n\n  // Denotes a reference should be taken to a variable.\n  template<typename _Tp>\n    inline reference_wrapper<_Tp>\n    ref(_Tp& __t)\n    { return reference_wrapper<_Tp>(__t); }\n\n  // Denotes a const reference should be taken to a variable.\n  template<typename _Tp>\n    inline reference_wrapper<const _Tp>\n    cref(const _Tp& __t)\n    { return reference_wrapper<const _Tp>(__t); }\n\n  template<typename _Tp>\n    inline reference_wrapper<_Tp>\n    ref(reference_wrapper<_Tp> __t)\n    { return ref(__t.get()); }\n\n  template<typename _Tp>\n    inline reference_wrapper<const _Tp>\n    cref(reference_wrapper<_Tp> __t)\n    { return cref(__t.get()); }\n\n   template<typename _Tp, bool>\n     struct _Mem_fn_const_or_non\n     {\n       typedef const _Tp& type;\n     };\n\n    template<typename _Tp>\n      struct _Mem_fn_const_or_non<_Tp, false>\n      {\n        typedef _Tp& type;\n      };\n\n  template<typename _Res, typename _Class>\n  class _Mem_fn<_Res _Class::*>\n  {\n    // This bit of genius is due to Peter Dimov, improved slightly by\n    // Douglas Gregor.\n    template<typename _Tp>\n      _Res&\n      _M_call(_Tp& __object, _Class *) const\n      { return __object.*__pm; }\n\n    template<typename _Tp, typename _Up>\n      _Res&\n      _M_call(_Tp& __object, _Up * const *) const\n      { return (*__object).*__pm; }\n\n    template<typename _Tp, typename _Up>\n      const _Res&\n      _M_call(_Tp& __object, const _Up * const *) const\n      { return (*__object).*__pm; }\n\n    template<typename _Tp>\n      const _Res&\n      _M_call(_Tp& __object, const _Class *) const\n      { return __object.*__pm; }\n\n    template<typename _Tp>\n      const _Res&\n      _M_call(_Tp& __ptr, const volatile void*) const\n      { return (*__ptr).*__pm; }\n\n    template<typename _Tp> static _Tp& __get_ref();\n\n    template<typename _Tp>\n      static __sfinae_types::__one __check_const(_Tp&, _Class*);\n    template<typename _Tp, typename _Up>\n      static __sfinae_types::__one __check_const(_Tp&, _Up * const *);\n    template<typename _Tp, typename _Up>\n      static __sfinae_types::__two __check_const(_Tp&, const _Up * const *);\n    template<typename _Tp>\n      static __sfinae_types::__two __check_const(_Tp&, const _Class*);\n    template<typename _Tp>\n      static __sfinae_types::__two __check_const(_Tp&, const volatile void*);\n\n  public:\n    template<typename _Tp>\n      struct _Result_type\n      : _Mem_fn_const_or_non<\n        _Res,\n        (sizeof(__sfinae_types::__two)\n\t == sizeof(__check_const<_Tp>(__get_ref<_Tp>(), (_Tp*)0)))>\n      { };\n\n    template<typename _Signature>\n      struct result;\n\n    template<typename _CVMem, typename _Tp>\n      struct result<_CVMem(_Tp)>\n      : public _Result_type<_Tp> { };\n\n    template<typename _CVMem, typename _Tp>\n      struct result<_CVMem(_Tp&)>\n      : public _Result_type<_Tp> { };\n\n    explicit _Mem_fn(_Res _Class::*__pm) : __pm(__pm) { }\n\n    // Handle objects\n    _Res&       operator()(_Class& __object)       const\n    { return __object.*__pm; }\n\n    const _Res& operator()(const _Class& __object) const\n    { return __object.*__pm; }\n\n    // Handle pointers\n    _Res&       operator()(_Class* __object)       const\n    { return __object->*__pm; }\n\n    const _Res&\n    operator()(const _Class* __object) const\n    { return __object->*__pm; }\n\n    // Handle smart pointers and derived\n    template<typename _Tp>\n      typename _Result_type<_Tp>::type\n      operator()(_Tp& __unknown) const\n      { return _M_call(__unknown, &__unknown); }\n\n  private:\n    _Res _Class::*__pm;\n  };\n\n  /**\n   *  @brief Returns a function object that forwards to the member\n   *  pointer @a pm.\n   */\n  template<typename _Tp, typename _Class>\n    inline _Mem_fn<_Tp _Class::*>\n    mem_fn(_Tp _Class::* __pm)\n    {\n      return _Mem_fn<_Tp _Class::*>(__pm);\n    }\n\n  /**\n   *  @brief Determines if the given type _Tp is a function object\n   *  should be treated as a subexpression when evaluating calls to\n   *  function objects returned by bind(). [TR1 3.6.1]\n   */\n  template<typename _Tp>\n    struct is_bind_expression\n    { static const bool value = false; };\n\n  template<typename _Tp>\n    const bool is_bind_expression<_Tp>::value;\n\n  /**\n   *  @brief Determines if the given type _Tp is a placeholder in a\n   *  bind() expression and, if so, which placeholder it is. [TR1 3.6.2]\n   */\n  template<typename _Tp>\n    struct is_placeholder\n    { static const int value = 0; };\n\n  template<typename _Tp>\n    const int is_placeholder<_Tp>::value;\n\n  /**\n   *  @if maint\n   *  The type of placeholder objects defined by libstdc++.\n   *  @endif\n   */\n  template<int _Num> struct _Placeholder { };\n\n  /**\n   *  @if maint\n   *  Partial specialization of is_placeholder that provides the placeholder\n   *  number for the placeholder objects defined by libstdc++.\n   *  @endif\n   */\n  template<int _Num>\n    struct is_placeholder<_Placeholder<_Num> >\n    { static const int value = _Num; };\n\n  template<int _Num>\n    const int is_placeholder<_Placeholder<_Num> >::value;\n\n  /**\n   *  @if maint\n   *  Maps an argument to bind() into an actual argument to the bound\n   *  function object [TR1 3.6.3/5]. Only the first parameter should\n   *  be specified: the rest are used to determine among the various\n   *  implementations. Note that, although this class is a function\n   *  object, isn't not entirely normal because it takes only two\n   *  parameters regardless of the number of parameters passed to the\n   *  bind expression. The first parameter is the bound argument and\n   *  the second parameter is a tuple containing references to the\n   *  rest of the arguments.\n   *  @endif\n   */\n  template<typename _Arg,\n           bool _IsBindExp = is_bind_expression<_Arg>::value,\n           bool _IsPlaceholder = (is_placeholder<_Arg>::value > 0)>\n    class _Mu;\n\n  /**\n   *  @if maint\n   *  If the argument is reference_wrapper<_Tp>, returns the\n   *  underlying reference. [TR1 3.6.3/5 bullet 1]\n   *  @endif\n   */\n  template<typename _Tp>\n    class _Mu<reference_wrapper<_Tp>, false, false>\n    {\n    public:\n      typedef _Tp& result_type;\n\n      /* Note: This won't actually work for const volatile\n       * reference_wrappers, because reference_wrapper::get() is const\n       * but not volatile-qualified. This might be a defect in the TR.\n       */\n      template<typename _CVRef, typename _Tuple>\n      result_type\n      operator()(_CVRef& __arg, const _Tuple&) const volatile\n      { return __arg.get(); }\n    };\n\n  /**\n   *  @if maint\n   *  If the argument is a bind expression, we invoke the underlying\n   *  function object with the same cv-qualifiers as we are given and\n   *  pass along all of our arguments (unwrapped). [TR1 3.6.3/5 bullet 2]\n   *  @endif\n   */\n  template<typename _Arg>\n    class _Mu<_Arg, true, false>\n    {\n    public:\n      template<typename _Signature> class result;\n\n#define _GLIBCXX_REPEAT_HEADER <tr1/mu_iterate.h>\n#  include <tr1/repeat.h>\n#undef _GLIBCXX_REPEAT_HEADER\n    };\n\n  /**\n   *  @if maint\n   *  If the argument is a placeholder for the Nth argument, returns\n   *  a reference to the Nth argument to the bind function object.\n   *  [TR1 3.6.3/5 bullet 3]\n   *  @endif\n   */\n  template<typename _Arg>\n    class _Mu<_Arg, false, true>\n    {\n    public:\n      template<typename _Signature> class result;\n\n      template<typename _CVMu, typename _CVArg, typename _Tuple>\n      class result<_CVMu(_CVArg, _Tuple)>\n      {\n        // Add a reference, if it hasn't already been done for us.\n        // This allows us to be a little bit sloppy in constructing\n        // the tuple that we pass to result_of<...>.\n        typedef typename tuple_element<(is_placeholder<_Arg>::value - 1),\n                                       _Tuple>::type __base_type;\n\n      public:\n        typedef typename add_reference<__base_type>::type type;\n      };\n\n      template<typename _Tuple>\n      typename result<_Mu(_Arg, _Tuple)>::type\n      operator()(const volatile _Arg&, const _Tuple& __tuple) const volatile\n      {\n        return ::std::tr1::get<(is_placeholder<_Arg>::value - 1)>(__tuple);\n      }\n    };\n\n  /**\n   *  @if maint\n   *  If the argument is just a value, returns a reference to that\n   *  value. The cv-qualifiers on the reference are the same as the\n   *  cv-qualifiers on the _Mu object. [TR1 3.6.3/5 bullet 4]\n   *  @endif\n   */\n  template<typename _Arg>\n    class _Mu<_Arg, false, false>\n    {\n    public:\n      template<typename _Signature> struct result;\n\n      template<typename _CVMu, typename _CVArg, typename _Tuple>\n      struct result<_CVMu(_CVArg, _Tuple)>\n      {\n        typedef typename add_reference<_CVArg>::type type;\n      };\n\n      // Pick up the cv-qualifiers of the argument\n      template<typename _CVArg, typename _Tuple>\n      _CVArg& operator()(_CVArg& __arg, const _Tuple&) const volatile\n      { return __arg; }\n    };\n\n  /**\n   *  @if maint\n   *  Maps member pointers into instances of _Mem_fn but leaves all\n   *  other function objects untouched. Used by tr1::bind(). The\n   *  primary template handles the non--member-pointer case.\n   *  @endif\n   */\n  template<typename _Tp>\n    struct _Maybe_wrap_member_pointer\n    {\n      typedef _Tp type;\n      static const _Tp& __do_wrap(const _Tp& __x) { return __x; }\n    };\n\n  /**\n   *  @if maint\n   *  Maps member pointers into instances of _Mem_fn but leaves all\n   *  other function objects untouched. Used by tr1::bind(). This\n   *  partial specialization handles the member pointer case.\n   *  @endif\n   */\n  template<typename _Tp, typename _Class>\n    struct _Maybe_wrap_member_pointer<_Tp _Class::*>\n    {\n      typedef _Mem_fn<_Tp _Class::*> type;\n      static type __do_wrap(_Tp _Class::* __pm) { return type(__pm); }\n    };\n\n  /**\n   *  @if maint\n   *  Type of the function object returned from bind().\n   *  @endif\n   */\n   template<typename _Signature>\n     struct _Bind;\n\n  /**\n   *  @if maint\n   *  Type of the function object returned from bind<R>().\n   *  @endif\n   */\n   template<typename _Result, typename _Signature>\n     struct _Bind_result;\n\n  /**\n   *  @if maint\n   *  Class template _Bind is always a bind expression.\n   *  @endif\n   */\n   template<typename _Signature>\n     struct is_bind_expression<_Bind<_Signature> >\n     { static const bool value = true; };\n\n   template<typename _Signature>\n     const bool is_bind_expression<_Bind<_Signature> >::value;\n\n  /**\n   *  @if maint\n   *  Class template _Bind_result is always a bind expression.\n   *  @endif\n   */\n   template<typename _Result, typename _Signature>\n     struct is_bind_expression<_Bind_result<_Result, _Signature> >\n     { static const bool value = true; };\n\n   template<typename _Result, typename _Signature>\n     const bool is_bind_expression<_Bind_result<_Result, _Signature> >::value;\n\n  /**\n   *  @brief Exception class thrown when class template function's\n   *  operator() is called with an empty target.\n   *\n   */\n  class bad_function_call : public std::exception { };\n\n  /**\n   *  @if maint\n   *  The integral constant expression 0 can be converted into a\n   *  pointer to this type. It is used by the function template to\n   *  accept NULL pointers.\n   *  @endif\n   */\n  struct _M_clear_type;\n\n  /**\n   *  @if maint\n   *  Trait identifying \"location-invariant\" types, meaning that the\n   *  address of the object (or any of its members) will not escape.\n   *  Also implies a trivial copy constructor and assignment operator.\n   *   @endif\n   */\n  template<typename _Tp>\n    struct __is_location_invariant\n    : integral_constant<bool,\n                        (is_pointer<_Tp>::value\n                         || is_member_pointer<_Tp>::value)>\n    {\n    };\n\n  class _Undefined_class;\n\n  union _Nocopy_types\n  {\n    void*       _M_object;\n    const void* _M_const_object;\n    void (*_M_function_pointer)();\n    void (_Undefined_class::*_M_member_pointer)();\n  };\n\n  union _Any_data {\n    void*       _M_access()       { return &_M_pod_data[0]; }\n    const void* _M_access() const { return &_M_pod_data[0]; }\n\n    template<typename _Tp> _Tp& _M_access()\n    { return *static_cast<_Tp*>(_M_access()); }\n\n    template<typename _Tp> const _Tp& _M_access() const\n    { return *static_cast<const _Tp*>(_M_access()); }\n\n    _Nocopy_types _M_unused;\n    char _M_pod_data[sizeof(_Nocopy_types)];\n  };\n\n  enum _Manager_operation\n  {\n    __get_type_info,\n    __get_functor_ptr,\n    __clone_functor,\n    __destroy_functor\n  };\n\n  /* Simple type wrapper that helps avoid annoying const problems\n     when casting between void pointers and pointers-to-pointers. */\n  template<typename _Tp>\n    struct _Simple_type_wrapper\n    {\n      _Simple_type_wrapper(_Tp __value) : __value(__value) { }\n\n      _Tp __value;\n    };\n\n  template<typename _Tp>\n    struct __is_location_invariant<_Simple_type_wrapper<_Tp> >\n      : __is_location_invariant<_Tp>\n    {\n    };\n\n  // Converts a reference to a function object into a callable\n  // function object.\n  template<typename _Functor>\n    inline _Functor& __callable_functor(_Functor& __f) { return __f; }\n\n  template<typename _Member, typename _Class>\n    inline _Mem_fn<_Member _Class::*>\n    __callable_functor(_Member _Class::* &__p)\n    { return mem_fn(__p); }\n\n  template<typename _Member, typename _Class>\n    inline _Mem_fn<_Member _Class::*>\n    __callable_functor(_Member _Class::* const &__p)\n    { return mem_fn(__p); }\n\n  template<typename _Signature, typename _Functor>\n    class _Function_handler;\n\n  template<typename _Signature>\n    class function;\n\n\n  /**\n   *  @if maint\n   *  Base class of all polymorphic function object wrappers.\n   *  @endif\n   */\n  class _Function_base\n  {\n  public:\n    static const std::size_t _M_max_size = sizeof(_Nocopy_types);\n    static const std::size_t _M_max_align = __alignof__(_Nocopy_types);\n\n    template<typename _Functor>\n    class _Base_manager\n    {\n    protected:\n      static const bool __stored_locally =\n        (__is_location_invariant<_Functor>::value\n         && sizeof(_Functor) <= _M_max_size\n         && __alignof__(_Functor) <= _M_max_align\n         && (_M_max_align % __alignof__(_Functor) == 0));\n      typedef integral_constant<bool, __stored_locally> _Local_storage;\n\n      // Retrieve a pointer to the function object\n      static _Functor* _M_get_pointer(const _Any_data& __source)\n      {\n        const _Functor* __ptr =\n          __stored_locally? &__source._M_access<_Functor>()\n          /* have stored a pointer */ : __source._M_access<_Functor*>();\n        return const_cast<_Functor*>(__ptr);\n      }\n\n      // Clone a location-invariant function object that fits within\n      // an _Any_data structure.\n      static void\n      _M_clone(_Any_data& __dest, const _Any_data& __source, true_type)\n      {\n        new (__dest._M_access()) _Functor(__source._M_access<_Functor>());\n      }\n\n      // Clone a function object that is not location-invariant or\n      // that cannot fit into an _Any_data structure.\n      static void\n      _M_clone(_Any_data& __dest, const _Any_data& __source, false_type)\n      {\n        __dest._M_access<_Functor*>() =\n          new _Functor(*__source._M_access<_Functor*>());\n      }\n\n      // Destroying a location-invariant object may still require\n      // destruction.\n      static void\n      _M_destroy(_Any_data& __victim, true_type)\n      {\n        __victim._M_access<_Functor>().~_Functor();\n      }\n\n      // Destroying an object located on the heap.\n      static void\n      _M_destroy(_Any_data& __victim, false_type)\n      {\n        delete __victim._M_access<_Functor*>();\n      }\n\n    public:\n      static bool\n      _M_manager(_Any_data& __dest, const _Any_data& __source,\n                 _Manager_operation __op)\n      {\n        switch (__op) {\n        case __get_type_info:\n          __dest._M_access<const type_info*>() = &typeid(_Functor);\n          break;\n\n        case __get_functor_ptr:\n          __dest._M_access<_Functor*>() = _M_get_pointer(__source);\n          break;\n\n        case __clone_functor:\n          _M_clone(__dest, __source, _Local_storage());\n          break;\n\n        case __destroy_functor:\n          _M_destroy(__dest, _Local_storage());\n          break;\n        }\n        return false;\n      }\n\n      static void\n      _M_init_functor(_Any_data& __functor, const _Functor& __f)\n      {\n        _M_init_functor(__functor, __f, _Local_storage());\n      }\n\n      template<typename _Signature>\n      static bool\n      _M_not_empty_function(const function<_Signature>& __f)\n      {\n        return __f;\n      }\n\n      template<typename _Tp>\n      static bool\n      _M_not_empty_function(const _Tp*& __fp)\n      {\n        return __fp;\n      }\n\n      template<typename _Class, typename _Tp>\n      static bool\n      _M_not_empty_function(_Tp _Class::* const& __mp)\n      {\n        return __mp;\n      }\n\n      template<typename _Tp>\n      static bool\n      _M_not_empty_function(const _Tp&)\n      {\n        return true;\n      }\n\n    private:\n      static void\n      _M_init_functor(_Any_data& __functor, const _Functor& __f, true_type)\n      {\n        new (__functor._M_access()) _Functor(__f);\n      }\n\n      static void\n      _M_init_functor(_Any_data& __functor, const _Functor& __f, false_type)\n      {\n        __functor._M_access<_Functor*>() = new _Functor(__f);\n      }\n    };\n\n    template<typename _Functor>\n    class _Ref_manager : public _Base_manager<_Functor*>\n    {\n      typedef _Function_base::_Base_manager<_Functor*> _Base;\n\n    public:\n      static bool\n      _M_manager(_Any_data& __dest, const _Any_data& __source,\n                 _Manager_operation __op)\n      {\n        switch (__op) {\n        case __get_type_info:\n          __dest._M_access<const type_info*>() = &typeid(_Functor);\n          break;\n\n        case __get_functor_ptr:\n          __dest._M_access<_Functor*>() = *_Base::_M_get_pointer(__source);\n          return is_const<_Functor>::value;\n          break;\n\n        default:\n          _Base::_M_manager(__dest, __source, __op);\n        }\n        return false;\n      }\n\n      static void\n      _M_init_functor(_Any_data& __functor, reference_wrapper<_Functor> __f)\n      {\n        // TBD: Use address_of function instead\n        _Base::_M_init_functor(__functor, &__f.get());\n      }\n    };\n\n    _Function_base() : _M_manager(0) { }\n\n    ~_Function_base()\n    {\n      if (_M_manager)\n        {\n          _M_manager(_M_functor, _M_functor, __destroy_functor);\n        }\n    }\n\n\n    bool _M_empty() const { return !_M_manager; }\n\n    typedef bool (*_Manager_type)(_Any_data&, const _Any_data&,\n                                  _Manager_operation);\n\n    _Any_data     _M_functor;\n    _Manager_type _M_manager;\n  };\n\n  // [3.7.2.7] null pointer comparisons\n\n  /**\n   *  @brief Compares a polymorphic function object wrapper against 0\n   *  (the NULL pointer).\n   *  @returns @c true if the wrapper has no target, @c false otherwise\n   *\n   *  This function will not throw an exception.\n   */\n  template<typename _Signature>\n    inline bool\n    operator==(const function<_Signature>& __f, _M_clear_type*)\n    {\n      return !__f;\n    }\n\n  /**\n   *  @overload\n   */\n  template<typename _Signature>\n    inline bool\n    operator==(_M_clear_type*, const function<_Signature>& __f)\n    {\n      return !__f;\n    }\n\n  /**\n   *  @brief Compares a polymorphic function object wrapper against 0\n   *  (the NULL pointer).\n   *  @returns @c false if the wrapper has no target, @c true otherwise\n   *\n   *  This function will not throw an exception.\n   */\n  template<typename _Signature>\n    inline bool\n    operator!=(const function<_Signature>& __f, _M_clear_type*)\n    {\n      return __f;\n    }\n\n  /**\n   *  @overload\n   */\n  template<typename _Signature>\n    inline bool\n    operator!=(_M_clear_type*, const function<_Signature>& __f)\n    {\n      return __f;\n    }\n\n  // [3.7.2.8] specialized algorithms\n\n  /**\n   *  @brief Swap the targets of two polymorphic function object wrappers.\n   *\n   *  This function will not throw an exception.\n   */\n  template<typename _Signature>\n    inline void\n    swap(function<_Signature>& __x, function<_Signature>& __y)\n    {\n      __x.swap(__y);\n    }\n\n_GLIBCXX_END_NAMESPACE\n}\n\n#define _GLIBCXX_JOIN(X,Y) _GLIBCXX_JOIN2( X , Y )\n#define _GLIBCXX_JOIN2(X,Y) _GLIBCXX_JOIN3(X,Y)\n#define _GLIBCXX_JOIN3(X,Y) X##Y\n#define _GLIBCXX_REPEAT_HEADER <tr1/functional_iterate.h>\n#include <tr1/repeat.h>\n#undef _GLIBCXX_REPEAT_HEADER\n#undef _GLIBCXX_JOIN3\n#undef _GLIBCXX_JOIN2\n#undef _GLIBCXX_JOIN\n\n#include <tr1/functional_hash.h>\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/tr1/functional_hash.h",
    "content": "// TR1 functional -*- C++ -*-\n\n// Copyright (C) 2007 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n/** @file tr1/functional_hash.h\n *  This is an internal header file, included by other library headers.\n *  You should not attempt to use it directly.\n */\n\n#ifndef _TR1_FUNCTIONAL_HASH_H\n#define _TR1_FUNCTIONAL_HASH_H 1\n\n#include <string>\n#include <cmath>  // for std::frexp\n\nnamespace std\n{\n_GLIBCXX_BEGIN_NAMESPACE(tr1)\n\n  // Definition of default hash function std::tr1::hash<>.  The types for\n  // which std::tr1::hash<T> is defined is in clause 6.3.3. of the PDTR.\n  template<typename T>\n    struct hash;\n\n#define _TR1_hashtable_define_trivial_hash(_Tp)         \\\n  template<>                                            \\\n    struct hash<_Tp>                                    \\\n    : public std::unary_function<_Tp, std::size_t>      \\\n    {                                                   \\\n      std::size_t                                       \\\n      operator()(_Tp __val) const                       \\\n      { return static_cast<std::size_t>(__val); }       \\\n    }                                                     \n\n  _TR1_hashtable_define_trivial_hash(bool);\n  _TR1_hashtable_define_trivial_hash(char);\n  _TR1_hashtable_define_trivial_hash(signed char);\n  _TR1_hashtable_define_trivial_hash(unsigned char);\n  _TR1_hashtable_define_trivial_hash(wchar_t);\n  _TR1_hashtable_define_trivial_hash(short);\n  _TR1_hashtable_define_trivial_hash(int);\n  _TR1_hashtable_define_trivial_hash(long);\n  _TR1_hashtable_define_trivial_hash(long long);\n  _TR1_hashtable_define_trivial_hash(unsigned short);\n  _TR1_hashtable_define_trivial_hash(unsigned int);\n  _TR1_hashtable_define_trivial_hash(unsigned long);\n  _TR1_hashtable_define_trivial_hash(unsigned long long);\n\n#undef _TR1_hashtable_define_trivial_hash\n\n  template<typename _Tp>\n    struct hash<_Tp*>\n    : public std::unary_function<_Tp*, std::size_t>\n    {\n      std::size_t\n      operator()(_Tp* __p) const\n      { return reinterpret_cast<std::size_t>(__p); }\n    };\n\n  // Fowler / Noll / Vo (FNV) Hash (type FNV-1a)\n  // (used by the next specializations of std::tr1::hash<>)\n\n  // Dummy generic implementation (for sizeof(size_t) != 4, 8).\n  template<std::size_t = sizeof(std::size_t)>\n    struct _Fnv_hash\n    {\n      static std::size_t\n      hash(const char* __first, std::size_t __length)\n      {\n\tstd::size_t __result = 0;\n\tfor (; __length > 0; --__length)\n\t  __result = (__result * 131) + *__first++;\n\treturn __result;\n      }\n    };\n\n  template<>\n    struct _Fnv_hash<4>\n    {\n      static std::size_t\n      hash(const char* __first, std::size_t __length)\n      {\n\tstd::size_t __result = static_cast<std::size_t>(2166136261UL);\n\tfor (; __length > 0; --__length)\n\t  {\n\t    __result ^= static_cast<std::size_t>(*__first++);\n\t    __result *= static_cast<std::size_t>(16777619UL);\n\t  }\n\treturn __result;\n      }\n    };\n  \n  template<>\n    struct _Fnv_hash<8>\n    {\n      static std::size_t\n      hash(const char* __first, std::size_t __length)\n      {\n\tstd::size_t __result =\n\t  static_cast<std::size_t>(14695981039346656037ULL);\n\tfor (; __length > 0; --__length)\n\t  {\n\t    __result ^= static_cast<std::size_t>(*__first++);\n\t    __result *= static_cast<std::size_t>(1099511628211ULL);\n\t  }\n\treturn __result;\n      }\n    };\n\n  // XXX String and floating point hashes probably shouldn't be inline\n  // member functions, since are nontrivial.  Once we have the framework\n  // for TR1 .cc files, these should go in one.\n  template<>\n    struct hash<std::string>\n    : public std::unary_function<std::string, std::size_t>\n    {      \n      std::size_t\n      operator()(const std::string& __s) const\n      { return _Fnv_hash<>::hash(__s.data(), __s.length()); }\n    };\n\n#ifdef _GLIBCXX_USE_WCHAR_T\n  template<>\n    struct hash<std::wstring>\n    : public std::unary_function<std::wstring, std::size_t>\n    {\n      std::size_t\n      operator()(const std::wstring& __s) const\n      {\n\treturn _Fnv_hash<>::hash(reinterpret_cast<const char*>(__s.data()),\n\t\t\t\t __s.length() * sizeof(wchar_t));\n      }\n    };\n#endif\n\n  template<>\n    struct hash<float>\n    : public std::unary_function<float, std::size_t>\n    {\n      std::size_t\n      operator()(float __fval) const\n      {\n\tstd::size_t __result = 0;\n\n\t// 0 and -0 both hash to zero.\n\tif (__fval != 0.0f)\n\t  __result = _Fnv_hash<>::hash(reinterpret_cast<const char*>(&__fval),\n\t\t\t\t       sizeof(__fval));\n\treturn __result;\n      }\n    };\n\n  template<>\n    struct hash<double>\n    : public std::unary_function<double, std::size_t>\n    {\n      std::size_t\n      operator()(double __dval) const\n      {\n\tstd::size_t __result = 0;\n\n\t// 0 and -0 both hash to zero.\n\tif (__dval != 0.0)\n\t  __result = _Fnv_hash<>::hash(reinterpret_cast<const char*>(&__dval),\n\t\t\t\t       sizeof(__dval));\n\treturn __result;\n      }\n    };\n\n  // For long double, careful with random padding bits (e.g., on x86,\n  // 10 bytes -> 12 bytes) and resort to frexp.\n  template<>\n    struct hash<long double>\n    : public std::unary_function<long double, std::size_t>\n    {\n      std::size_t\n      operator()(long double __ldval) const\n      {\n\tstd::size_t __result = 0;\n\n\tint __exponent;\n\t__ldval = std::frexp(__ldval, &__exponent);\n\t__ldval = __ldval < 0.0l ? -(__ldval + 0.5l) : __ldval;\n\n\tconst long double __mult =\n\t  std::numeric_limits<std::size_t>::max() + 1.0l;\n\t__ldval *= __mult;\n\n\t// Try to use all the bits of the mantissa (really necessary only\n\t// on 32-bit targets, at least for 80-bit floating point formats).\n\tconst std::size_t __hibits = (std::size_t)__ldval;\n\t__ldval = (__ldval - (long double)__hibits) * __mult;\n\n\tconst std::size_t __coeff =\n\t  (std::numeric_limits<std::size_t>::max()\n\t   / std::numeric_limits<long double>::max_exponent);\n\n\t__result = __hibits + (std::size_t)__ldval + __coeff * __exponent;\n\n\treturn __result;\n      }\n    };\n\n_GLIBCXX_END_NAMESPACE\n}\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/tr1/functional_iterate.h",
    "content": "// TR1 functional -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n// Written by Douglas Gregor <doug.gregor -at- gmail.com>\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n/** @file tr1/functional_iterate.h\n *  This is an internal header file, included by other library headers.\n *  You should not attempt to use it directly.\n */\n\nnamespace std\n{\n_GLIBCXX_BEGIN_NAMESPACE(tr1)\n\ntemplate<typename _Res _GLIBCXX_COMMA _GLIBCXX_TEMPLATE_PARAMS>\n  struct _Weak_result_type_impl<_Res(_GLIBCXX_TEMPLATE_ARGS)>\n  {\n    typedef _Res result_type;\n  };\n\ntemplate<typename _Res _GLIBCXX_COMMA _GLIBCXX_TEMPLATE_PARAMS>\n  struct _Weak_result_type_impl<_Res (&)(_GLIBCXX_TEMPLATE_ARGS)>\n  {\n    typedef _Res result_type;\n  };\n\ntemplate<typename _Res _GLIBCXX_COMMA _GLIBCXX_TEMPLATE_PARAMS>\n  struct _Weak_result_type_impl<_Res (*)(_GLIBCXX_TEMPLATE_ARGS)>\n  {\n    typedef _Res result_type;\n  };\n\n#if _GLIBCXX_NUM_ARGS > 0\ntemplate<typename _Res, typename _Class _GLIBCXX_COMMA_SHIFTED\n         _GLIBCXX_TEMPLATE_PARAMS_SHIFTED>\n  struct _Weak_result_type_impl<\n           _Res (_Class::*)(_GLIBCXX_TEMPLATE_ARGS_SHIFTED)>\n  {\n    typedef _Res result_type;\n  };\n\ntemplate<typename _Res, typename _Class _GLIBCXX_COMMA_SHIFTED\n         _GLIBCXX_TEMPLATE_PARAMS_SHIFTED>\n  struct _Weak_result_type_impl<\n           _Res (_Class::*)(_GLIBCXX_TEMPLATE_ARGS_SHIFTED) const>\n  {\n    typedef _Res result_type;\n  };\n\ntemplate<typename _Res, typename _Class _GLIBCXX_COMMA_SHIFTED\n         _GLIBCXX_TEMPLATE_PARAMS_SHIFTED>\n  struct _Weak_result_type_impl<\n           _Res (_Class::*)(_GLIBCXX_TEMPLATE_ARGS_SHIFTED) volatile>\n  {\n    typedef _Res result_type;\n  };\n\ntemplate<typename _Res, typename _Class _GLIBCXX_COMMA_SHIFTED\n         _GLIBCXX_TEMPLATE_PARAMS_SHIFTED>\n  struct _Weak_result_type_impl<\n           _Res (_Class::*)(_GLIBCXX_TEMPLATE_ARGS_SHIFTED) const volatile>\n  {\n    typedef _Res result_type;\n  };\n#endif\n\ntemplate<typename _Functor _GLIBCXX_COMMA _GLIBCXX_TEMPLATE_PARAMS>\n  class result_of<_Functor(_GLIBCXX_TEMPLATE_ARGS)>\n    : public _Result_of_impl<\n               _Has_result_type<_Weak_result_type<_Functor> >::value,\n             _Functor(_GLIBCXX_TEMPLATE_ARGS)>\n  { };\n\ntemplate<typename _Functor _GLIBCXX_COMMA _GLIBCXX_TEMPLATE_PARAMS>\n  struct _Result_of_impl<true, _Functor(_GLIBCXX_TEMPLATE_ARGS)>\n  {\n    typedef typename _Weak_result_type<_Functor>::result_type type;\n  };\n\ntemplate<typename _Functor _GLIBCXX_COMMA _GLIBCXX_TEMPLATE_PARAMS>\n  struct _Result_of_impl<false, _Functor(_GLIBCXX_TEMPLATE_ARGS)>\n  {\n#if _GLIBCXX_NUM_ARGS > 0\n    typedef typename _Functor\n              ::template result<_Functor(_GLIBCXX_TEMPLATE_ARGS)>::type type;\n#else\n    typedef void type;\n#endif\n  };\n\n/**\n * @if maint\n * Invoke a function object, which may be either a member pointer or a\n * function object. The first parameter will tell which.\n * @endif\n */\ntemplate<typename _Functor _GLIBCXX_COMMA _GLIBCXX_TEMPLATE_PARAMS>\n  inline\n  typename __gnu_cxx::__enable_if<(!is_member_pointer<_Functor>::value\n\t\t\t&& !is_function<_Functor>::value\n              && !is_function<typename remove_pointer<_Functor>::type>::value),\n           typename result_of<_Functor(_GLIBCXX_TEMPLATE_ARGS)>::type>::__type\n  __invoke(_Functor& __f _GLIBCXX_COMMA _GLIBCXX_REF_PARAMS)\n  {\n    return __f(_GLIBCXX_ARGS);\n  }\n\n#if _GLIBCXX_NUM_ARGS > 0\ntemplate<typename _Functor _GLIBCXX_COMMA _GLIBCXX_TEMPLATE_PARAMS>\n  inline\n  typename __gnu_cxx::__enable_if<(is_member_pointer<_Functor>::value\n\t\t\t&& !is_function<_Functor>::value\n              && !is_function<typename remove_pointer<_Functor>::type>::value),\n             typename result_of<_Functor(_GLIBCXX_TEMPLATE_ARGS)>::type\n           >::__type\n  __invoke(_Functor& __f _GLIBCXX_COMMA _GLIBCXX_REF_PARAMS)\n  {\n    return mem_fn(__f)(_GLIBCXX_ARGS);\n  }\n#endif\n\n// To pick up function references (that will become function pointers)\ntemplate<typename _Functor _GLIBCXX_COMMA _GLIBCXX_TEMPLATE_PARAMS>\n  inline\n  typename __gnu_cxx::__enable_if<(is_pointer<_Functor>::value\n\t&& is_function<typename remove_pointer<_Functor>::type>::value),\n             typename result_of<_Functor(_GLIBCXX_TEMPLATE_ARGS)>::type\n           >::__type\n  __invoke(_Functor __f _GLIBCXX_COMMA _GLIBCXX_REF_PARAMS)\n  {\n    return __f(_GLIBCXX_ARGS);\n  }\n\n/**\n * @if maint\n * Implementation of reference_wrapper::operator()\n * @endif\n*/\n#if _GLIBCXX_NUM_ARGS > 0\ntemplate<typename _Tp>\ntemplate<_GLIBCXX_TEMPLATE_PARAMS>\n  typename result_of<\n   typename reference_wrapper<_Tp>::_M_func_type(_GLIBCXX_TEMPLATE_ARGS)>::type\n  reference_wrapper<_Tp>::operator()(_GLIBCXX_REF_PARAMS) const\n  {\n    return __invoke(get(), _GLIBCXX_ARGS);\n  }\n#endif\n\n#if _GLIBCXX_NUM_ARGS > 0\ntemplate<typename _Res, typename _Class _GLIBCXX_COMMA_SHIFTED\n         _GLIBCXX_TEMPLATE_PARAMS_SHIFTED>\n  class _Mem_fn<_Res (_Class::*)(_GLIBCXX_TEMPLATE_ARGS_SHIFTED)>\n#if _GLIBCXX_NUM_ARGS == 1\n  : public unary_function<_Class*, _Res>\n#elif _GLIBCXX_NUM_ARGS == 2\n    : public binary_function<_Class*, _T1, _Res>\n#endif\n  {\n    typedef _Res (_Class::*_Functor)(_GLIBCXX_TEMPLATE_ARGS_SHIFTED);\n\n    template<typename _Tp>\n      _Res\n      _M_call(_Tp& __object, const volatile _Class * _GLIBCXX_COMMA_SHIFTED\n              _GLIBCXX_PARAMS_SHIFTED) const\n      { return (__object.*__pmf)(_GLIBCXX_ARGS_SHIFTED); }\n\n    template<typename _Tp>\n      _Res\n      _M_call(_Tp& __ptr, const volatile void * _GLIBCXX_COMMA_SHIFTED\n              _GLIBCXX_PARAMS_SHIFTED) const\n      {  return ((*__ptr).*__pmf)(_GLIBCXX_ARGS_SHIFTED); }\n\n  public:\n    typedef _Res result_type;\n\n    explicit _Mem_fn(_Functor __pf) : __pmf(__pf) { }\n\n    // Handle objects\n    _Res\n    operator()(_Class& __object _GLIBCXX_COMMA_SHIFTED\n               _GLIBCXX_PARAMS_SHIFTED) const\n    { return (__object.*__pmf)(_GLIBCXX_ARGS_SHIFTED); }\n\n    // Handle pointers\n    _Res\n    operator()(_Class* __object _GLIBCXX_COMMA_SHIFTED\n               _GLIBCXX_PARAMS_SHIFTED) const\n    { return (__object->*__pmf)(_GLIBCXX_ARGS_SHIFTED); }\n\n    // Handle smart pointers, references and pointers to derived\n    template<typename _Tp>\n      _Res\n      operator()(_Tp& __object _GLIBCXX_COMMA_SHIFTED\n                 _GLIBCXX_PARAMS_SHIFTED) const\n      {\n        return _M_call(__object, &__object _GLIBCXX_COMMA_SHIFTED\n                       _GLIBCXX_ARGS_SHIFTED);\n      }\n\n  private:\n    _Functor __pmf;\n  };\n\ntemplate<typename _Res, typename _Class _GLIBCXX_COMMA_SHIFTED\n         _GLIBCXX_TEMPLATE_PARAMS_SHIFTED>\n  class _Mem_fn<_Res (_Class::*)(_GLIBCXX_TEMPLATE_ARGS_SHIFTED) const>\n#if _GLIBCXX_NUM_ARGS == 1\n  : public unary_function<const _Class*, _Res>\n#elif _GLIBCXX_NUM_ARGS == 2\n    : public binary_function<const _Class*, _T1, _Res>\n#endif\n  {\n    typedef _Res (_Class::*_Functor)(_GLIBCXX_TEMPLATE_ARGS_SHIFTED) const;\n\n     template<typename _Tp>\n      _Res\n      _M_call(_Tp& __object, const volatile _Class * _GLIBCXX_COMMA_SHIFTED\n              _GLIBCXX_PARAMS_SHIFTED) const\n      { return (__object.*__pmf)(_GLIBCXX_ARGS_SHIFTED); }\n\n    template<typename _Tp>\n      _Res\n      _M_call(_Tp& __ptr, const volatile void * _GLIBCXX_COMMA_SHIFTED\n              _GLIBCXX_PARAMS_SHIFTED) const\n      {  return ((*__ptr).*__pmf)(_GLIBCXX_ARGS_SHIFTED); }\n\n  public:\n    typedef _Res result_type;\n\n    explicit _Mem_fn(_Functor __pf) : __pmf(__pf) { }\n\n    // Handle objects\n    _Res\n    operator()(const _Class& __object _GLIBCXX_COMMA_SHIFTED\n               _GLIBCXX_PARAMS_SHIFTED) const\n    { return (__object.*__pmf)(_GLIBCXX_ARGS_SHIFTED); }\n\n    // Handle pointers\n    _Res\n    operator()(const _Class* __object _GLIBCXX_COMMA_SHIFTED\n               _GLIBCXX_PARAMS_SHIFTED) const\n    { return (__object->*__pmf)(_GLIBCXX_ARGS_SHIFTED); }\n\n    // Handle smart pointers, references and pointers to derived\n    template<typename _Tp>\n      _Res\n      operator()(_Tp& __object _GLIBCXX_COMMA_SHIFTED\n                 _GLIBCXX_PARAMS_SHIFTED) const\n      {\n        return _M_call(__object, &__object _GLIBCXX_COMMA_SHIFTED\n                       _GLIBCXX_ARGS_SHIFTED);\n      }\n\n  private:\n    _Functor __pmf;\n  };\n\ntemplate<typename _Res, typename _Class _GLIBCXX_COMMA_SHIFTED\n         _GLIBCXX_TEMPLATE_PARAMS_SHIFTED>\n  class _Mem_fn<_Res (_Class::*)(_GLIBCXX_TEMPLATE_ARGS_SHIFTED) volatile>\n#if _GLIBCXX_NUM_ARGS == 1\n  : public unary_function<volatile _Class*, _Res>\n#elif _GLIBCXX_NUM_ARGS == 2\n    : public binary_function<volatile _Class*, _T1, _Res>\n#endif\n  {\n    typedef _Res (_Class::*_Functor)(_GLIBCXX_TEMPLATE_ARGS_SHIFTED) volatile;\n\n    template<typename _Tp>\n      _Res\n      _M_call(_Tp& __object, const volatile _Class * _GLIBCXX_COMMA_SHIFTED\n              _GLIBCXX_PARAMS_SHIFTED) const\n      { return (__object.*__pmf)(_GLIBCXX_ARGS_SHIFTED); }\n\n    template<typename _Tp>\n      _Res\n      _M_call(_Tp& __ptr, const volatile void * _GLIBCXX_COMMA_SHIFTED\n              _GLIBCXX_PARAMS_SHIFTED) const\n      {  return ((*__ptr).*__pmf)(_GLIBCXX_ARGS_SHIFTED); }\n\n  public:\n    typedef _Res result_type;\n\n    explicit _Mem_fn(_Functor __pf) : __pmf(__pf) { }\n\n    // Handle objects\n    _Res\n    operator()(volatile _Class& __object _GLIBCXX_COMMA_SHIFTED\n               _GLIBCXX_PARAMS_SHIFTED) const\n    { return (__object.*__pmf)(_GLIBCXX_ARGS_SHIFTED); }\n\n    // Handle pointers\n    _Res\n    operator()(volatile _Class* __object _GLIBCXX_COMMA_SHIFTED\n               _GLIBCXX_PARAMS_SHIFTED) const\n    { return (__object->*__pmf)(_GLIBCXX_ARGS_SHIFTED); }\n\n    // Handle smart pointers, references and pointers to derived\n    template<typename _Tp>\n      _Res\n      operator()(_Tp& __object _GLIBCXX_COMMA_SHIFTED\n                 _GLIBCXX_PARAMS_SHIFTED) const\n      {\n        return _M_call(__object, &__object _GLIBCXX_COMMA_SHIFTED\n                       _GLIBCXX_ARGS_SHIFTED);\n      }\n  private:\n    _Functor __pmf;\n  };\n\ntemplate<typename _Res, typename _Class _GLIBCXX_COMMA_SHIFTED\n         _GLIBCXX_TEMPLATE_PARAMS_SHIFTED>\n  class _Mem_fn<_Res(_Class::*)(_GLIBCXX_TEMPLATE_ARGS_SHIFTED) const volatile>\n#if _GLIBCXX_NUM_ARGS == 1\n  : public unary_function<const volatile _Class*, _Res>\n#elif _GLIBCXX_NUM_ARGS == 2\n    : public binary_function<const volatile _Class*, _T1, _Res>\n#endif\n  {\n    typedef _Res (_Class::*_Functor)(_GLIBCXX_TEMPLATE_ARGS_SHIFTED)\n              const volatile;\n\n    template<typename _Tp>\n      _Res\n      _M_call(_Tp& __object, const volatile _Class * _GLIBCXX_COMMA_SHIFTED\n              _GLIBCXX_PARAMS_SHIFTED) const\n      { return (__object.*__pmf)(_GLIBCXX_ARGS_SHIFTED); }\n\n    template<typename _Tp>\n      _Res\n      _M_call(_Tp& __ptr, const volatile void * _GLIBCXX_COMMA_SHIFTED\n              _GLIBCXX_PARAMS_SHIFTED) const\n      {  return ((*__ptr).*__pmf)(_GLIBCXX_ARGS_SHIFTED); }\n\n  public:\n    typedef _Res result_type;\n\n    explicit _Mem_fn(_Functor __pf) : __pmf(__pf) { }\n\n    // Handle objects\n    _Res\n    operator()(const volatile _Class& __object _GLIBCXX_COMMA_SHIFTED\n               _GLIBCXX_PARAMS_SHIFTED) const\n    { return (__object.*__pmf)(_GLIBCXX_ARGS_SHIFTED); }\n\n    // Handle pointers\n    _Res\n    operator()(const volatile _Class* __object _GLIBCXX_COMMA_SHIFTED\n               _GLIBCXX_PARAMS_SHIFTED) const\n    { return (__object->*__pmf)(_GLIBCXX_ARGS_SHIFTED); }\n\n    // Handle smart pointers, references and pointers to derived\n    template<typename _Tp>\n      _Res\n      operator()(_Tp& __object _GLIBCXX_COMMA_SHIFTED\n                 _GLIBCXX_PARAMS_SHIFTED) const\n      {\n        return _M_call(__object, &__object _GLIBCXX_COMMA_SHIFTED\n                       _GLIBCXX_ARGS_SHIFTED);\n      }\n\n  private:\n    _Functor __pmf;\n  };\n#endif\n\n#if _GLIBCXX_NUM_ARGS > 0\nnamespace placeholders\n{\nnamespace\n{\n   _Placeholder<_GLIBCXX_NUM_ARGS> _GLIBCXX_JOIN(_,_GLIBCXX_NUM_ARGS);\n} // anonymous namespace\n}\n#endif\n\ntemplate<typename _Functor _GLIBCXX_COMMA _GLIBCXX_TEMPLATE_PARAMS>\nclass _Bind<_Functor(_GLIBCXX_TEMPLATE_ARGS)>\n  : public _Weak_result_type<_Functor>\n{\n  typedef _Bind __self_type;\n\n  _Functor _M_f;\n  _GLIBCXX_BIND_MEMBERS\n\n public:\n#if _GLIBCXX_NUM_ARGS == 0\n  explicit\n#endif\n  _Bind(_Functor __f _GLIBCXX_COMMA _GLIBCXX_PARAMS)\n    : _M_f(__f) _GLIBCXX_COMMA _GLIBCXX_BIND_MEMBERS_INIT { }\n\n#define _GLIBCXX_BIND_REPEAT_HEADER <tr1/bind_iterate.h>\n#include <tr1/bind_repeat.h>\n#undef _GLIBCXX_BIND_REPEAT_HEADER\n};\n\ntemplate<typename _Result, typename _Functor\n         _GLIBCXX_COMMA _GLIBCXX_TEMPLATE_PARAMS>\nclass _Bind_result<_Result, _Functor(_GLIBCXX_TEMPLATE_ARGS)>\n{\n  _Functor _M_f;\n  _GLIBCXX_BIND_MEMBERS\n\n public:\n  typedef _Result result_type;\n\n#if _GLIBCXX_NUM_ARGS == 0\n  explicit\n#endif\n  _Bind_result(_Functor __f _GLIBCXX_COMMA _GLIBCXX_PARAMS)\n    : _M_f(__f) _GLIBCXX_COMMA _GLIBCXX_BIND_MEMBERS_INIT { }\n\n#define _GLIBCXX_BIND_REPEAT_HEADER <tr1/bind_iterate.h>\n#define _GLIBCXX_BIND_HAS_RESULT_TYPE\n#include <tr1/bind_repeat.h>\n#undef _GLIBCXX_BIND_HAS_RESULT_TYPE\n#undef _GLIBCXX_BIND_REPEAT_HEADER\n};\n\n// Handle arbitrary function objects\ntemplate<typename _Functor _GLIBCXX_COMMA _GLIBCXX_TEMPLATE_PARAMS>\ninline\n_Bind<typename _Maybe_wrap_member_pointer<_Functor>::type\n        (_GLIBCXX_TEMPLATE_ARGS)>\nbind(_Functor __f _GLIBCXX_COMMA _GLIBCXX_PARAMS)\n{\n  typedef _Maybe_wrap_member_pointer<_Functor> __maybe_type;\n  typedef typename __maybe_type::type __functor_type;\n  typedef _Bind<__functor_type(_GLIBCXX_TEMPLATE_ARGS)> __result_type;\n  return __result_type(__maybe_type::__do_wrap(__f)\n                       _GLIBCXX_COMMA _GLIBCXX_ARGS);\n}\n\ntemplate<typename _Result, typename _Functor\n         _GLIBCXX_COMMA _GLIBCXX_TEMPLATE_PARAMS>\ninline\n_Bind_result<_Result,\n             typename _Maybe_wrap_member_pointer<_Functor>::type\n               (_GLIBCXX_TEMPLATE_ARGS)>\nbind(_Functor __f _GLIBCXX_COMMA _GLIBCXX_PARAMS)\n{\n  typedef _Maybe_wrap_member_pointer<_Functor> __maybe_type;\n  typedef typename __maybe_type::type __functor_type;\n  typedef _Bind_result<_Result, __functor_type(_GLIBCXX_TEMPLATE_ARGS)>\n    __result_type;\n  return __result_type(__maybe_type::__do_wrap(__f)\n                       _GLIBCXX_COMMA _GLIBCXX_ARGS);\n}\n\ntemplate<typename _Res, typename _Functor _GLIBCXX_COMMA\n         _GLIBCXX_TEMPLATE_PARAMS>\nclass _Function_handler<_Res(_GLIBCXX_TEMPLATE_ARGS), _Functor>\n  : public _Function_base::_Base_manager<_Functor>\n{\n  typedef _Function_base::_Base_manager<_Functor> _Base;\n\n public:\n  static _Res\n  _M_invoke(const _Any_data& __functor _GLIBCXX_COMMA _GLIBCXX_PARAMS)\n  {\n    return (*_Base::_M_get_pointer(__functor))(_GLIBCXX_ARGS);\n  }\n};\n\ntemplate<typename _Functor _GLIBCXX_COMMA _GLIBCXX_TEMPLATE_PARAMS>\nclass _Function_handler<void(_GLIBCXX_TEMPLATE_ARGS), _Functor>\n  : public _Function_base::_Base_manager<_Functor>\n{\n  typedef _Function_base::_Base_manager<_Functor> _Base;\n\n public:\n  static void\n  _M_invoke(const _Any_data& __functor _GLIBCXX_COMMA _GLIBCXX_PARAMS)\n  {\n    (*_Base::_M_get_pointer(__functor))(_GLIBCXX_ARGS);\n  }\n};\n\ntemplate<typename _Res, typename _Functor _GLIBCXX_COMMA\n         _GLIBCXX_TEMPLATE_PARAMS>\nclass _Function_handler<_Res(_GLIBCXX_TEMPLATE_ARGS),\n                        reference_wrapper<_Functor> >\n  : public _Function_base::_Ref_manager<_Functor>\n{\n  typedef _Function_base::_Ref_manager<_Functor> _Base;\n\n public:\n  static _Res\n  _M_invoke(const _Any_data& __functor _GLIBCXX_COMMA _GLIBCXX_PARAMS)\n  {\n    return __callable_functor(**_Base::_M_get_pointer(__functor))\n             (_GLIBCXX_ARGS);\n  }\n};\n\ntemplate<typename _Functor _GLIBCXX_COMMA _GLIBCXX_TEMPLATE_PARAMS>\nclass _Function_handler<void(_GLIBCXX_TEMPLATE_ARGS),\n                        reference_wrapper<_Functor> >\n  : public _Function_base::_Ref_manager<_Functor>\n{\n  typedef _Function_base::_Ref_manager<_Functor> _Base;\n\n public:\n  static void\n  _M_invoke(const _Any_data& __functor _GLIBCXX_COMMA _GLIBCXX_PARAMS)\n  {\n    __callable_functor(**_Base::_M_get_pointer(__functor))(_GLIBCXX_ARGS);\n  }\n};\n\ntemplate<typename _Class, typename _Member, typename _Res\n         _GLIBCXX_COMMA _GLIBCXX_TEMPLATE_PARAMS>\nclass _Function_handler<_Res(_GLIBCXX_TEMPLATE_ARGS), _Member _Class::*>\n  : public _Function_handler<void(_GLIBCXX_TEMPLATE_ARGS), _Member _Class::*>\n{\n  typedef _Function_handler<void(_GLIBCXX_TEMPLATE_ARGS), _Member _Class::*>\n    _Base;\n\n public:\n  static _Res\n  _M_invoke(const _Any_data& __functor _GLIBCXX_COMMA _GLIBCXX_PARAMS)\n  {\n    return std::tr1::mem_fn(_Base::_M_get_pointer(__functor)->__value)\n             (_GLIBCXX_ARGS);\n  }\n};\n\ntemplate<typename _Class, typename _Member\n         _GLIBCXX_COMMA _GLIBCXX_TEMPLATE_PARAMS>\nclass _Function_handler<void(_GLIBCXX_TEMPLATE_ARGS), _Member _Class::*>\n  : public _Function_base::_Base_manager<\n             _Simple_type_wrapper< _Member _Class::* > >\n{\n  typedef _Member _Class::* _Functor;\n  typedef _Simple_type_wrapper< _Functor > _Wrapper;\n  typedef _Function_base::_Base_manager<_Wrapper> _Base;\n\n public:\n  static bool\n  _M_manager(_Any_data& __dest, const _Any_data& __source,\n             _Manager_operation __op)\n  {\n    switch (__op) {\n    case __get_type_info:\n      __dest._M_access<const type_info*>() = &typeid(_Functor);\n      break;\n\n    case __get_functor_ptr:\n      __dest._M_access<_Functor*>() =\n        &_Base::_M_get_pointer(__source)->__value;\n      break;\n\n    default:\n      _Base::_M_manager(__dest, __source, __op);\n    }\n    return false;\n  }\n\n  static void\n  _M_invoke(const _Any_data& __functor _GLIBCXX_COMMA _GLIBCXX_PARAMS)\n  {\n    std::tr1::mem_fn(_Base::_M_get_pointer(__functor)->__value)\n      (_GLIBCXX_ARGS);\n  }\n};\n\ntemplate<typename _Res _GLIBCXX_COMMA _GLIBCXX_TEMPLATE_PARAMS>\nclass function<_Res(_GLIBCXX_TEMPLATE_ARGS)>\n#if _GLIBCXX_NUM_ARGS == 1\n  : public unary_function<_T1, _Res>, private _Function_base\n#elif _GLIBCXX_NUM_ARGS == 2\n  : public binary_function<_T1, _T2, _Res>, private _Function_base\n#else\n  : private _Function_base\n#endif\n{\n  /**\n   *  @if maint\n   *  This class is used to implement the safe_bool idiom.\n   *  @endif\n   */\n  struct _Hidden_type\n  {\n    _Hidden_type* _M_bool;\n  };\n\n  /**\n   *  @if maint\n   *  This typedef is used to implement the safe_bool idiom.\n   *  @endif\n   */\n  typedef _Hidden_type* _Hidden_type::* _Safe_bool;\n\n  typedef _Res _Signature_type(_GLIBCXX_TEMPLATE_ARGS);\n\n  struct _Useless {};\n\n public:\n  typedef _Res result_type;\n\n  // [3.7.2.1] construct/copy/destroy\n\n  /**\n   *  @brief Default construct creates an empty function call wrapper.\n   *  @post @c !(bool)*this\n   */\n  function() : _Function_base() { }\n\n  /**\n   *  @brief Default construct creates an empty function call wrapper.\n   *  @post @c !(bool)*this\n   */\n  function(_M_clear_type*) : _Function_base() { }\n\n  /**\n   *  @brief %Function copy constructor.\n   *  @param x A %function object with identical call signature.\n   *  @pre @c (bool)*this == (bool)x\n   *\n   *  The newly-created %function contains a copy of the target of @a\n   *  x (if it has one).\n   */\n  function(const function& __x);\n\n  /**\n   *  @brief Builds a %function that targets a copy of the incoming\n   *  function object.\n   *  @param f A %function object that is callable with parameters of\n   *  type @c T1, @c T2, ..., @c TN and returns a value convertible\n   *  to @c Res.\n   *\n   *  The newly-created %function object will target a copy of @a\n   *  f. If @a f is @c reference_wrapper<F>, then this function\n   *  object will contain a reference to the function object @c\n   *  f.get(). If @a f is a NULL function pointer or NULL\n   *  pointer-to-member, the newly-created object will be empty.\n   *\n   *  If @a f is a non-NULL function pointer or an object of type @c\n   *  reference_wrapper<F>, this function will not throw.\n   */\n  template<typename _Functor>\n    function(_Functor __f,\n             typename __gnu_cxx::__enable_if<!is_integral<_Functor>::value, _Useless>::__type = _Useless());\n\n  /**\n   *  @brief %Function assignment operator.\n   *  @param x A %function with identical call signature.\n   *  @post @c (bool)*this == (bool)x\n   *  @returns @c *this\n   *\n   *  The target of @a x is copied to @c *this. If @a x has no\n   *  target, then @c *this will be empty.\n   *\n   *  If @a x targets a function pointer or a reference to a function\n   *  object, then this operation will not throw an exception.\n   */\n  function& operator=(const function& __x)\n    {\n      function(__x).swap(*this);\n      return *this;\n    }\n\n  /**\n   *  @brief %Function assignment to zero.\n   *  @post @c !(bool)*this\n   *  @returns @c *this\n   *\n   *  The target of @a *this is deallocated, leaving it empty.\n   */\n  function& operator=(_M_clear_type*)\n    {\n      if (_M_manager) {\n        _M_manager(_M_functor, _M_functor, __destroy_functor);\n        _M_manager = 0;\n        _M_invoker = 0;\n      }\n      return *this;\n    }\n\n  /**\n   *  @brief %Function assignment to a new target.\n   *  @param f A %function object that is callable with parameters of\n   *  type @c T1, @c T2, ..., @c TN and returns a value convertible\n   *  to @c Res.\n   *  @return @c *this\n   *\n   *  This  %function object wrapper will target a copy of @a\n   *  f. If @a f is @c reference_wrapper<F>, then this function\n   *  object will contain a reference to the function object @c\n   *  f.get(). If @a f is a NULL function pointer or NULL\n   *  pointer-to-member, @c this object will be empty.\n   *\n   *  If @a f is a non-NULL function pointer or an object of type @c\n   *  reference_wrapper<F>, this function will not throw.\n   */\n  template<typename _Functor>\n    typename __gnu_cxx::__enable_if<!is_integral<_Functor>::value, function&>::__type\n    operator=(_Functor __f)\n    {\n      function(__f).swap(*this);\n      return *this;\n    }\n\n  // [3.7.2.2] function modifiers\n\n  /**\n   *  @brief Swap the targets of two %function objects.\n   *  @param f A %function with identical call signature.\n   *\n   *  Swap the targets of @c this function object and @a f. This\n   *  function will not throw an exception.\n   */\n  void swap(function& __x)\n  {\n    _Any_data __old_functor = _M_functor;\n    _M_functor = __x._M_functor;\n    __x._M_functor = __old_functor;\n    _Manager_type __old_manager = _M_manager;\n    _M_manager = __x._M_manager;\n    __x._M_manager = __old_manager;\n    _Invoker_type __old_invoker = _M_invoker;\n    _M_invoker = __x._M_invoker;\n    __x._M_invoker = __old_invoker;\n  }\n\n  // [3.7.2.3] function capacity\n\n  /**\n   *  @brief Determine if the %function wrapper has a target.\n   *\n   *  @return @c true when this %function object contains a target,\n   *  or @c false when it is empty.\n   *\n   *  This function will not throw an exception.\n   */\n  operator _Safe_bool() const\n    {\n      if (_M_empty())\n        {\n          return 0;\n        }\n      else\n        {\n          return &_Hidden_type::_M_bool;\n        }\n    }\n\n  // [3.7.2.4] function invocation\n\n  /**\n   *  @brief Invokes the function targeted by @c *this.\n   *  @returns the result of the target.\n   *  @throws bad_function_call when @c !(bool)*this\n   *\n   *  The function call operator invokes the target function object\n   *  stored by @c this.\n   */\n  _Res operator()(_GLIBCXX_PARAMS) const;\n\n  // [3.7.2.5] function target access\n  /**\n   *  @brief Determine the type of the target of this function object\n   *  wrapper.\n   *\n   *  @returns the type identifier of the target function object, or\n   *  @c typeid(void) if @c !(bool)*this.\n   *\n   *  This function will not throw an exception.\n   */\n  const type_info& target_type() const;\n\n  /**\n   *  @brief Access the stored target function object.\n   *\n   *  @return Returns a pointer to the stored target function object,\n   *  if @c typeid(Functor).equals(target_type()); otherwise, a NULL\n   *  pointer.\n   *\n   * This function will not throw an exception.\n   */\n  template<typename _Functor>       _Functor* target();\n\n  /**\n   *  @overload\n   */\n  template<typename _Functor> const _Functor* target() const;\n\n private:\n  // [3.7.2.6] undefined operators\n  template<typename _Function>\n    void operator==(const function<_Function>&) const;\n  template<typename _Function>\n    void operator!=(const function<_Function>&) const;\n\n  typedef _Res (*_Invoker_type)(const _Any_data& _GLIBCXX_COMMA\n                                _GLIBCXX_PARAMS);\n  _Invoker_type _M_invoker;\n};\n\ntemplate<typename _Res _GLIBCXX_COMMA _GLIBCXX_TEMPLATE_PARAMS>\n  function<_Res(_GLIBCXX_TEMPLATE_ARGS)>::function(const function& __x)\n    : _Function_base()\n  {\n    if (__x) {\n      _M_invoker = __x._M_invoker;\n      _M_manager = __x._M_manager;\n      __x._M_manager(_M_functor, __x._M_functor, __clone_functor);\n    }\n  }\n\ntemplate<typename _Res _GLIBCXX_COMMA _GLIBCXX_TEMPLATE_PARAMS>\ntemplate<typename _Functor>\n  function<_Res(_GLIBCXX_TEMPLATE_ARGS)>\n  ::function(_Functor __f,\n        typename __gnu_cxx::__enable_if<!is_integral<_Functor>::value, _Useless>::__type)\n    : _Function_base()\n{\n  typedef _Function_handler<_Signature_type, _Functor> _My_handler;\n  if (_My_handler::_M_not_empty_function(__f)) {\n    _M_invoker = &_My_handler::_M_invoke;\n    _M_manager = &_My_handler::_M_manager;\n    _My_handler::_M_init_functor(_M_functor, __f);\n  }\n}\n\ntemplate<typename _Res _GLIBCXX_COMMA _GLIBCXX_TEMPLATE_PARAMS>\n  _Res\n  function<_Res(_GLIBCXX_TEMPLATE_ARGS)>::operator()(_GLIBCXX_PARAMS) const\n  {\n    if (_M_empty())\n      {\n#if __EXCEPTIONS\n        throw bad_function_call();\n#else\n        std::abort();\n#endif\n      }\n    return _M_invoker(_M_functor _GLIBCXX_COMMA _GLIBCXX_ARGS);\n  }\n\ntemplate<typename _Res _GLIBCXX_COMMA _GLIBCXX_TEMPLATE_PARAMS>\n  const type_info&\n  function<_Res(_GLIBCXX_TEMPLATE_ARGS)>::target_type() const\n  {\n    if (_M_manager)\n      {\n        _Any_data __typeinfo_result;\n        _M_manager(__typeinfo_result, _M_functor, __get_type_info);\n        return *__typeinfo_result._M_access<const type_info*>();\n      }\n    else\n      {\n        return typeid(void);\n      }\n  }\n\ntemplate<typename _Res _GLIBCXX_COMMA _GLIBCXX_TEMPLATE_PARAMS>\ntemplate<typename _Functor>\n  _Functor*\n  function<_Res(_GLIBCXX_TEMPLATE_ARGS)>::target()\n  {\n    if (typeid(_Functor) == target_type() && _M_manager)\n      {\n        _Any_data __ptr;\n        if (_M_manager(__ptr, _M_functor, __get_functor_ptr)\n            && !is_const<_Functor>::value)\n          return 0;\n        else\n          return __ptr._M_access<_Functor*>();\n      }\n    else\n      {\n        return 0;\n      }\n  }\n\ntemplate<typename _Res _GLIBCXX_COMMA _GLIBCXX_TEMPLATE_PARAMS>\ntemplate<typename _Functor>\n  const _Functor*\n  function<_Res(_GLIBCXX_TEMPLATE_ARGS)>::target() const\n  {\n    if (typeid(_Functor) == target_type() && _M_manager)\n      {\n        _Any_data __ptr;\n        _M_manager(__ptr, _M_functor, __get_functor_ptr);\n        return __ptr._M_access<const _Functor*>();\n      }\n    else\n      {\n        return 0;\n      }\n  }\n\n_GLIBCXX_END_NAMESPACE\n}\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/tr1/hashtable",
    "content": "// Internal header for TR1 unordered_set and unordered_map -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n/** @file tr1/hashtable\n *  This is a TR1 C++ Library header. \n */\n\n// This header file defines std::tr1::hashtable, which is used to\n// implement std::tr1::unordered_set, std::tr1::unordered_map, \n// std::tr1::unordered_multiset, and std::tr1::unordered_multimap.\n// hashtable has many template parameters, partly to accommodate\n// the differences between those four classes and partly to \n// accommodate policy choices that go beyond what TR1 calls for.\n\n// Class template hashtable attempts to encapsulate all reasonable\n// variation among hash tables that use chaining.  It does not handle\n// open addressing.\n\n// References: \n// M. Austern, \"A Proposal to Add Hash Tables to the Standard\n//    Library (revision 4),\" WG21 Document N1456=03-0039, 2003.\n// D. E. Knuth, The Art of Computer Programming, v. 3, Sorting and Searching.\n// A. Tavori and V. Dreizin, \"Policy-Based Data Structures\", 2004.\n// http://gcc.gnu.org/onlinedocs/libstdc++/ext/pb_ds/index.html\n\n#ifndef _TR1_HASHTABLE\n#define _TR1_HASHTABLE 1\n\n#include <utility>\t\t// For std::pair\n#include <memory>\n#include <iterator>\n#include <cstddef>\n#include <cstdlib>\n#include <cmath>\n#include <bits/functexcept.h>\n#include <tr1/type_traits>\t// For true_type and false_type\n#include <tr1/hashtable_policy.h>\n\nnamespace std\n{ \n_GLIBCXX_BEGIN_NAMESPACE(tr1)\n\n  // Class template _Hashtable, class definition.\n  \n  // Meaning of class template _Hashtable's template parameters\n  \n  // _Key and _Value: arbitrary CopyConstructible types.\n  \n  // _Allocator: an allocator type ([lib.allocator.requirements]) whose\n  // value type is Value.  As a conforming extension, we allow for\n  // value type != Value.\n\n  // _ExtractKey: function object that takes a object of type Value\n  // and returns a value of type _Key.\n  \n  // _Equal: function object that takes two objects of type k and returns\n  // a bool-like value that is true if the two objects are considered equal.\n  \n  // _H1: the hash function.  A unary function object with argument type\n  // Key and result type size_t.  Return values should be distributed\n  // over the entire range [0, numeric_limits<size_t>:::max()].\n  \n  // _H2: the range-hashing function (in the terminology of Tavori and\n  // Dreizin).  A binary function object whose argument types and result\n  // type are all size_t.  Given arguments r and N, the return value is\n  // in the range [0, N).\n  \n  // _Hash: the ranged hash function (Tavori and Dreizin). A binary function\n  // whose argument types are _Key and size_t and whose result type is\n  // size_t.  Given arguments k and N, the return value is in the range\n  // [0, N).  Default: hash(k, N) = h2(h1(k), N).  If _Hash is anything other\n  // than the default, _H1 and _H2 are ignored.\n  \n  // _RehashPolicy: Policy class with three members, all of which govern\n  // the bucket count. _M_next_bkt(n) returns a bucket count no smaller\n  // than n.  _M_bkt_for_elements(n) returns a bucket count appropriate\n  // for an element count of n.  _M_need_rehash(n_bkt, n_elt, n_ins)\n  // determines whether, if the current bucket count is n_bkt and the\n  // current element count is n_elt, we need to increase the bucket\n  // count.  If so, returns make_pair(true, n), where n is the new\n  // bucket count.  If not, returns make_pair(false, <anything>).\n  \n  // ??? Right now it is hard-wired that the number of buckets never\n  // shrinks.  Should we allow _RehashPolicy to change that?\n  \n  // __cache_hash_code: bool.  true if we store the value of the hash\n  // function along with the value.  This is a time-space tradeoff.\n  // Storing it may improve lookup speed by reducing the number of times\n  // we need to call the Equal function.\n  \n  // __constant_iterators: bool.  true if iterator and const_iterator are\n  // both constant iterator types.  This is true for unordered_set and\n  // unordered_multiset, false for unordered_map and unordered_multimap.\n  \n  // __unique_keys: bool.  true if the return value of _Hashtable::count(k)\n  // is always at most one, false if it may be an arbitrary number.  This\n  // true for unordered_set and unordered_map, false for unordered_multiset\n  // and unordered_multimap.\n  \n  template<typename _Key, typename _Value, typename _Allocator,\n\t   typename _ExtractKey, typename _Equal,\n\t   typename _H1, typename _H2, typename _Hash, \n\t   typename _RehashPolicy,\n\t   bool __cache_hash_code,\n\t   bool __constant_iterators,\n\t   bool __unique_keys>\n    class _Hashtable\n    : public __detail::_Rehash_base<_RehashPolicy,\n\t\t\t\t    _Hashtable<_Key, _Value, _Allocator,\n\t\t\t\t\t       _ExtractKey,\n\t\t\t\t\t       _Equal, _H1, _H2, _Hash,\n\t\t\t\t\t       _RehashPolicy,\n\t\t\t\t\t       __cache_hash_code,\n\t\t\t\t\t       __constant_iterators,\n\t\t\t\t\t       __unique_keys> >,\n      public __detail::_Hash_code_base<_Key, _Value, _ExtractKey, _Equal,\n\t\t\t\t       _H1, _H2, _Hash, __cache_hash_code>,\n      public __detail::_Map_base<_Key, _Value, _ExtractKey, __unique_keys,\n\t\t\t\t _Hashtable<_Key, _Value, _Allocator,\n\t\t\t\t\t    _ExtractKey,\n\t\t\t\t\t    _Equal, _H1, _H2, _Hash,\n\t\t\t\t\t    _RehashPolicy,\n\t\t\t\t\t    __cache_hash_code,\n\t\t\t\t\t    __constant_iterators,\n\t\t\t\t\t    __unique_keys> >\n    {\n    public:\n      typedef _Allocator                                  allocator_type;\n      typedef _Value                                      value_type;\n      typedef _Key                                        key_type;\n      typedef _Equal                                      key_equal;\n      // mapped_type, if present, comes from _Map_base.\n      // hasher, if present, comes from _Hash_code_base.\n      typedef typename _Allocator::difference_type        difference_type;\n      typedef typename _Allocator::size_type              size_type;\n      typedef typename _Allocator::reference              reference;\n      typedef typename _Allocator::const_reference        const_reference;\n      \n      typedef __detail::_Node_iterator<value_type, __constant_iterators,\n\t\t\t\t       __cache_hash_code>\n                                                          local_iterator;\n      typedef __detail::_Node_const_iterator<value_type,\n\t\t\t\t\t     __constant_iterators,\n\t\t\t\t\t     __cache_hash_code>\n                                                          const_local_iterator;\n\n      typedef __detail::_Hashtable_iterator<value_type, __constant_iterators,\n\t\t\t\t\t    __cache_hash_code>\n                                                          iterator;\n      typedef __detail::_Hashtable_const_iterator<value_type,\n\t\t\t\t\t\t  __constant_iterators,\n\t\t\t\t\t\t  __cache_hash_code>\n                                                          const_iterator;\n\n      template<typename _Key2, typename _Pair, typename _Hashtable>\n        friend struct __detail::_Map_base;\n\n    private:\n      typedef __detail::_Hash_node<_Value, __cache_hash_code> _Node;\n      typedef typename _Allocator::template rebind<_Node>::other\n                                                        _Node_allocator_type;\n      typedef typename _Allocator::template rebind<_Node*>::other\n                                                        _Bucket_allocator_type;\n\n      typedef typename _Allocator::template rebind<_Value>::other\n                                                        _Value_allocator_type;\n\n      _Node_allocator_type   _M_node_allocator;\n      _Node**                _M_buckets;\n      size_type              _M_bucket_count;\n      size_type              _M_element_count;\n      _RehashPolicy          _M_rehash_policy;\n      \n      _Node*\n      _M_allocate_node(const value_type& __v);\n  \n      void\n      _M_deallocate_node(_Node* __n);\n  \n      void\n      _M_deallocate_nodes(_Node**, size_type);\n\n      _Node**\n      _M_allocate_buckets(size_type __n);\n  \n      void\n      _M_deallocate_buckets(_Node**, size_type __n);\n\n    public:\t\t\t    \n      // Constructor, destructor, assignment, swap\n      _Hashtable(size_type __bucket_hint,\n\t\t const _H1&, const _H2&, const _Hash&,\n\t\t const _Equal&, const _ExtractKey&,\n\t\t const allocator_type&);\n  \n      template<typename _InputIterator>\n        _Hashtable(_InputIterator __first, _InputIterator __last,\n\t\t   size_type __bucket_hint,\n\t\t   const _H1&, const _H2&, const _Hash&, \n\t\t   const _Equal&, const _ExtractKey&,\n\t\t   const allocator_type&);\n  \n      _Hashtable(const _Hashtable&);\n      \n      _Hashtable&\n      operator=(const _Hashtable&);\n  \n      ~_Hashtable();\n\n      void swap(_Hashtable&);\n\n      // Basic container operations\n      iterator\n      begin()\n      {\n\titerator __i(_M_buckets);\n\tif (!__i._M_cur_node)\n\t  __i._M_incr_bucket();\n\treturn __i;\n      }\n\n      const_iterator\n      begin() const\n      {\n\tconst_iterator __i(_M_buckets);\n\tif (!__i._M_cur_node)\n\t  __i._M_incr_bucket();\n\treturn __i;\n      }\n\n      iterator\n      end()\n      { return iterator(_M_buckets + _M_bucket_count); }\n\n      const_iterator\n      end() const\n      { return const_iterator(_M_buckets + _M_bucket_count); }\n\n      size_type\n      size() const\n      { return _M_element_count; }\n  \n      bool\n      empty() const\n      { return size() == 0; }\n\n      allocator_type\n      get_allocator() const\n      { return allocator_type(_M_node_allocator); }\n\n      _Value_allocator_type\n      _M_get_Value_allocator() const\n      { return _Value_allocator_type(_M_node_allocator); }\n\n      size_type\n      max_size() const\n      { return _M_get_Value_allocator().max_size(); }\n\n      // Observers\n      key_equal\n      key_eq() const\n      { return this->_M_eq; }\n\n      // hash_function, if present, comes from _Hash_code_base.\n\n      // Bucket operations\n      size_type\n      bucket_count() const\n      { return _M_bucket_count; }\n  \n      size_type\n      max_bucket_count() const\n      { return max_size(); }\n  \n      size_type\n      bucket_size(size_type __n) const\n      { return std::distance(begin(__n), end(__n)); }\n  \n      size_type\n      bucket(const key_type& __k) const\n      { \n\treturn this->_M_bucket_index(__k, this->_M_hash_code(__k),\n\t\t\t\t     bucket_count());\n      }\n\n      local_iterator\n      begin(size_type __n)\n      { return local_iterator(_M_buckets[__n]); }\n  \n      local_iterator\n      end(size_type)\n      { return local_iterator(0); }\n  \n      const_local_iterator\n      begin(size_type __n) const\n      { return const_local_iterator(_M_buckets[__n]); }\n  \n      const_local_iterator\n      end(size_type) const\n      { return const_local_iterator(0); }\n\n      float\n      load_factor() const\n      { \n\treturn static_cast<float>(size()) / static_cast<float>(bucket_count());\n      }\n\n      // max_load_factor, if present, comes from _Rehash_base.\n\n      // Generalization of max_load_factor.  Extension, not found in TR1.  Only\n      // useful if _RehashPolicy is something other than the default.\n      const _RehashPolicy&\n      __rehash_policy() const\n      { return _M_rehash_policy; }\n      \n      void \n      __rehash_policy(const _RehashPolicy&);\n\n      // Lookup.\n      iterator\n      find(const key_type& __k);\n\n      const_iterator\n      find(const key_type& __k) const;\n\n      size_type\n      count(const key_type& __k) const;\n\n      std::pair<iterator, iterator>\n      equal_range(const key_type& __k);\n\n      std::pair<const_iterator, const_iterator>\n      equal_range(const key_type& __k) const;\n\n    private:\t\t\t// Find, insert and erase helper functions\n      // ??? This dispatching is a workaround for the fact that we don't\n      // have partial specialization of member templates; it would be\n      // better to just specialize insert on __unique_keys.  There may be a\n      // cleaner workaround.\n      typedef typename __gnu_cxx::__conditional_type<__unique_keys,\n\t\t       \t    std::pair<iterator, bool>, iterator>::__type\n        _Insert_Return_Type;\n\n      typedef typename __gnu_cxx::__conditional_type<__unique_keys,\n\t\t\t\t\t  std::_Select1st<_Insert_Return_Type>,\n\t\t\t\t  \t  std::_Identity<_Insert_Return_Type>\n                                   >::__type\n        _Insert_Conv_Type;\n\n      _Node*\n      _M_find_node(_Node*, const key_type&,\n\t\t   typename _Hashtable::_Hash_code_type) const;\n\n      iterator\n      _M_insert_bucket(const value_type&, size_type,\n\t\t       typename _Hashtable::_Hash_code_type);\n\n      std::pair<iterator, bool>\n      _M_insert(const value_type&, std::tr1::true_type);\n\n      iterator\n      _M_insert(const value_type&, std::tr1::false_type);\n\n      void\n      _M_erase_node(_Node*, _Node**);\n\n    public:\t\t\t\t\n      // Insert and erase\n      _Insert_Return_Type\n      insert(const value_type& __v) \n      { return _M_insert(__v, std::tr1::integral_constant<bool,\n\t\t\t __unique_keys>()); }\n\n      iterator\n      insert(iterator, const value_type& __v)\n      { return iterator(_Insert_Conv_Type()(this->insert(__v))); }\n\n      const_iterator\n      insert(const_iterator, const value_type& __v)\n      { return const_iterator(_Insert_Conv_Type()(this->insert(__v))); }\n\n      template<typename _InputIterator>\n        void\n        insert(_InputIterator __first, _InputIterator __last);\n\n      iterator\n      erase(iterator);\n\n      const_iterator\n      erase(const_iterator);\n\n      size_type\n      erase(const key_type&);\n\n      iterator\n      erase(iterator, iterator);\n\n      const_iterator\n      erase(const_iterator, const_iterator);\n\n      void\n      clear();\n\n      // Set number of buckets to be appropriate for container of n element.\n      void rehash(size_type __n);\n      \n    private:\n      // Unconditionally change size of bucket array to n.\n      void _M_rehash(size_type __n);\n    };\n\n\n  // Definitions of class template _Hashtable's out-of-line member functions.\n  template<typename _Key, typename _Value, \n\t   typename _Allocator, typename _ExtractKey, typename _Equal,\n\t   typename _H1, typename _H2, typename _Hash, typename _RehashPolicy,\n\t   bool __chc, bool __cit, bool __uk>\n    typename _Hashtable<_Key, _Value, _Allocator, _ExtractKey, _Equal,\n\t\t\t_H1, _H2, _Hash, _RehashPolicy,\n\t\t\t__chc, __cit, __uk>::_Node*\n    _Hashtable<_Key, _Value, _Allocator, _ExtractKey, _Equal,\n\t       _H1, _H2, _Hash, _RehashPolicy, __chc, __cit, __uk>::\n    _M_allocate_node(const value_type& __v)\n    {\n      _Node* __n = _M_node_allocator.allocate(1);\n      try\n\t{\n\t  _M_get_Value_allocator().construct(&__n->_M_v, __v);\n\t  __n->_M_next = 0;\n\t  return __n;\n\t}\n      catch(...)\n\t{\n\t  _M_node_allocator.deallocate(__n, 1);\n\t  __throw_exception_again;\n\t}\n    }\n\n  template<typename _Key, typename _Value, \n\t   typename _Allocator, typename _ExtractKey, typename _Equal,\n\t   typename _H1, typename _H2, typename _Hash, typename _RehashPolicy,\n\t   bool __chc, bool __cit, bool __uk>\n    void\n    _Hashtable<_Key, _Value, _Allocator, _ExtractKey, _Equal,\n\t       _H1, _H2, _Hash, _RehashPolicy, __chc, __cit, __uk>::\n    _M_deallocate_node(_Node* __n)\n    {\n      _M_get_Value_allocator().destroy(&__n->_M_v);\n      _M_node_allocator.deallocate(__n, 1);\n    }\n\n  template<typename _Key, typename _Value, \n\t   typename _Allocator, typename _ExtractKey, typename _Equal,\n\t   typename _H1, typename _H2, typename _Hash, typename _RehashPolicy,\n\t   bool __chc, bool __cit, bool __uk>\n    void\n    _Hashtable<_Key, _Value, _Allocator, _ExtractKey, _Equal,\n\t       _H1, _H2, _Hash, _RehashPolicy, __chc, __cit, __uk>::\n    _M_deallocate_nodes(_Node** __array, size_type __n)\n    {\n      for (size_type __i = 0; __i < __n; ++__i)\n\t{\n\t  _Node* __p = __array[__i];\n\t  while (__p)\n\t    {\n\t      _Node* __tmp = __p;\n\t      __p = __p->_M_next;\n\t      _M_deallocate_node(__tmp);\n\t    }\n\t  __array[__i] = 0;\n\t}\n    }\n\n  template<typename _Key, typename _Value, \n\t   typename _Allocator, typename _ExtractKey, typename _Equal,\n\t   typename _H1, typename _H2, typename _Hash, typename _RehashPolicy,\n\t   bool __chc, bool __cit, bool __uk>\n    typename _Hashtable<_Key, _Value, _Allocator, _ExtractKey, _Equal,\n\t\t\t_H1, _H2, _Hash, _RehashPolicy,\n\t\t\t__chc, __cit, __uk>::_Node**\n    _Hashtable<_Key, _Value, _Allocator, _ExtractKey, _Equal,\n\t       _H1, _H2, _Hash, _RehashPolicy, __chc, __cit, __uk>::\n    _M_allocate_buckets(size_type __n)\n    {\n      _Bucket_allocator_type __alloc(_M_node_allocator);\n\n      // We allocate one extra bucket to hold a sentinel, an arbitrary\n      // non-null pointer.  Iterator increment relies on this.\n      _Node** __p = __alloc.allocate(__n + 1);\n      std::fill(__p, __p + __n, (_Node*) 0);\n      __p[__n] = reinterpret_cast<_Node*>(0x1000);\n      return __p;\n    }\n\n  template<typename _Key, typename _Value, \n\t   typename _Allocator, typename _ExtractKey, typename _Equal,\n\t   typename _H1, typename _H2, typename _Hash, typename _RehashPolicy,\n\t   bool __chc, bool __cit, bool __uk>\n    void\n    _Hashtable<_Key, _Value, _Allocator, _ExtractKey, _Equal,\n\t       _H1, _H2, _Hash, _RehashPolicy, __chc, __cit, __uk>::\n    _M_deallocate_buckets(_Node** __p, size_type __n)\n    {\n      _Bucket_allocator_type __alloc(_M_node_allocator);\n      __alloc.deallocate(__p, __n + 1);\n    }\n\n  template<typename _Key, typename _Value, \n\t   typename _Allocator, typename _ExtractKey, typename _Equal,\n\t   typename _H1, typename _H2, typename _Hash, typename _RehashPolicy,\n\t   bool __chc, bool __cit, bool __uk>\n    _Hashtable<_Key, _Value, _Allocator, _ExtractKey, _Equal,\n\t       _H1, _H2, _Hash, _RehashPolicy, __chc, __cit, __uk>::\n    _Hashtable(size_type __bucket_hint,\n\t       const _H1& __h1, const _H2& __h2, const _Hash& __h,\n\t       const _Equal& __eq, const _ExtractKey& __exk,\n\t       const allocator_type& __a)\n    : __detail::_Rehash_base<_RehashPolicy, _Hashtable>(),\n      __detail::_Hash_code_base<_Key, _Value, _ExtractKey, _Equal,\n\t\t\t\t_H1, _H2, _Hash, __chc>(__exk, __eq,\n\t\t\t\t\t\t\t__h1, __h2, __h),\n      __detail::_Map_base<_Key, _Value, _ExtractKey, __uk, _Hashtable>(),\n      _M_node_allocator(__a),\n      _M_bucket_count(0),\n      _M_element_count(0),\n      _M_rehash_policy()\n    {\n      _M_bucket_count = _M_rehash_policy._M_next_bkt(__bucket_hint);\n      _M_buckets = _M_allocate_buckets(_M_bucket_count);\n    }\n\n  template<typename _Key, typename _Value, \n\t   typename _Allocator, typename _ExtractKey, typename _Equal,\n\t   typename _H1, typename _H2, typename _Hash, typename _RehashPolicy,\n\t   bool __chc, bool __cit, bool __uk>\n    template<typename _InputIterator>\n      _Hashtable<_Key, _Value, _Allocator, _ExtractKey, _Equal,\n\t\t _H1, _H2, _Hash, _RehashPolicy, __chc, __cit, __uk>::\n      _Hashtable(_InputIterator __f, _InputIterator __l,\n\t\t size_type __bucket_hint,\n\t\t const _H1& __h1, const _H2& __h2, const _Hash& __h,\n\t\t const _Equal& __eq, const _ExtractKey& __exk,\n\t\t const allocator_type& __a)\n      : __detail::_Rehash_base<_RehashPolicy, _Hashtable>(),\n\t__detail::_Hash_code_base<_Key, _Value, _ExtractKey, _Equal,\n\t\t\t\t  _H1, _H2, _Hash, __chc>(__exk, __eq,\n\t\t\t\t\t\t\t  __h1, __h2, __h),\n\t__detail::_Map_base<_Key, _Value, _ExtractKey, __uk, _Hashtable>(),\n\t_M_node_allocator(__a),\n\t_M_bucket_count(0),\n\t_M_element_count(0),\n\t_M_rehash_policy()\n      {\n\t_M_bucket_count = std::max(_M_rehash_policy._M_next_bkt(__bucket_hint),\n\t\t\t\t   _M_rehash_policy.\n\t\t\t\t   _M_bkt_for_elements(__detail::\n\t\t\t\t\t\t       __distance_fw(__f,\n\t\t\t\t\t\t\t\t     __l)));\n\t_M_buckets = _M_allocate_buckets(_M_bucket_count);\n\ttry\n\t  {\n\t    for (; __f != __l; ++__f)\n\t      this->insert(*__f);\n\t  }\n\tcatch(...)\n\t  {\n\t    clear();\n\t    _M_deallocate_buckets(_M_buckets, _M_bucket_count);\n\t    __throw_exception_again;\n\t  }\n      }\n  \n  template<typename _Key, typename _Value, \n\t   typename _Allocator, typename _ExtractKey, typename _Equal,\n\t   typename _H1, typename _H2, typename _Hash, typename _RehashPolicy,\n\t   bool __chc, bool __cit, bool __uk>\n    _Hashtable<_Key, _Value, _Allocator, _ExtractKey, _Equal,\n\t       _H1, _H2, _Hash, _RehashPolicy, __chc, __cit, __uk>::\n    _Hashtable(const _Hashtable& __ht)\n    : __detail::_Rehash_base<_RehashPolicy, _Hashtable>(__ht),\n      __detail::_Hash_code_base<_Key, _Value, _ExtractKey, _Equal,\n\t\t\t\t_H1, _H2, _Hash, __chc>(__ht),\n      __detail::_Map_base<_Key, _Value, _ExtractKey, __uk, _Hashtable>(__ht),\n      _M_node_allocator(__ht._M_node_allocator),\n      _M_bucket_count(__ht._M_bucket_count),\n      _M_element_count(__ht._M_element_count),\n      _M_rehash_policy(__ht._M_rehash_policy)\n    {\n      _M_buckets = _M_allocate_buckets(_M_bucket_count);\n      try\n\t{\n\t  for (size_type __i = 0; __i < __ht._M_bucket_count; ++__i)\n\t    {\n\t      _Node* __n = __ht._M_buckets[__i];\n\t      _Node** __tail = _M_buckets + __i;\n\t      while (__n)\n\t\t{\n\t\t  *__tail = _M_allocate_node(__n->_M_v);\n\t\t  this->_M_copy_code(*__tail, __n);\n\t\t  __tail = &((*__tail)->_M_next);\n\t\t  __n = __n->_M_next;\n\t\t}\n\t    }\n\t}\n      catch(...)\n\t{\n\t  clear();\n\t  _M_deallocate_buckets(_M_buckets, _M_bucket_count);\n\t  __throw_exception_again;\n\t}\n    }\n\n  template<typename _Key, typename _Value, \n\t   typename _Allocator, typename _ExtractKey, typename _Equal,\n\t   typename _H1, typename _H2, typename _Hash, typename _RehashPolicy,\n\t   bool __chc, bool __cit, bool __uk>\n    _Hashtable<_Key, _Value, _Allocator, _ExtractKey, _Equal,\n\t       _H1, _H2, _Hash, _RehashPolicy, __chc, __cit, __uk>&\n    _Hashtable<_Key, _Value, _Allocator, _ExtractKey, _Equal,\n\t       _H1, _H2, _Hash, _RehashPolicy, __chc, __cit, __uk>::\n    operator=(const _Hashtable& __ht)\n    {\n      _Hashtable __tmp(__ht);\n      this->swap(__tmp);\n      return *this;\n    }\n\n  template<typename _Key, typename _Value, \n\t   typename _Allocator, typename _ExtractKey, typename _Equal,\n\t   typename _H1, typename _H2, typename _Hash, typename _RehashPolicy,\n\t   bool __chc, bool __cit, bool __uk>\n    _Hashtable<_Key, _Value, _Allocator, _ExtractKey, _Equal,\n\t       _H1, _H2, _Hash, _RehashPolicy, __chc, __cit, __uk>::\n    ~_Hashtable()\n    {\n      clear();\n      _M_deallocate_buckets(_M_buckets, _M_bucket_count);\n    }\n\n  template<typename _Key, typename _Value, \n\t   typename _Allocator, typename _ExtractKey, typename _Equal,\n\t   typename _H1, typename _H2, typename _Hash, typename _RehashPolicy,\n\t   bool __chc, bool __cit, bool __uk>\n    void\n    _Hashtable<_Key, _Value, _Allocator, _ExtractKey, _Equal,\n\t       _H1, _H2, _Hash, _RehashPolicy, __chc, __cit, __uk>::\n    swap(_Hashtable& __x)\n    {\n      // The only base class with member variables is hash_code_base.  We\n      // define _Hash_code_base::_M_swap because different specializations\n      // have different members.\n      __detail::_Hash_code_base<_Key, _Value, _ExtractKey, _Equal,\n\t_H1, _H2, _Hash, __chc>::_M_swap(__x);\n\n      // _GLIBCXX_RESOLVE_LIB_DEFECTS\n      // 431. Swapping containers with unequal allocators.\n      std::__alloc_swap<_Node_allocator_type>::_S_do_it(_M_node_allocator,\n\t\t\t\t\t\t\t__x._M_node_allocator);\n\n      std::swap(_M_rehash_policy, __x._M_rehash_policy);\n      std::swap(_M_buckets, __x._M_buckets);\n      std::swap(_M_bucket_count, __x._M_bucket_count);\n      std::swap(_M_element_count, __x._M_element_count);\n    }\n\n  template<typename _Key, typename _Value, \n\t   typename _Allocator, typename _ExtractKey, typename _Equal,\n\t   typename _H1, typename _H2, typename _Hash, typename _RehashPolicy,\n\t   bool __chc, bool __cit, bool __uk>\n    void\n    _Hashtable<_Key, _Value, _Allocator, _ExtractKey, _Equal,\n\t       _H1, _H2, _Hash, _RehashPolicy, __chc, __cit, __uk>::\n    __rehash_policy(const _RehashPolicy& __pol)\n    {\n      _M_rehash_policy = __pol;\n      size_type __n_bkt = __pol._M_bkt_for_elements(_M_element_count);\n      if (__n_bkt > _M_bucket_count)\n\t_M_rehash(__n_bkt);\n    }\n\n  template<typename _Key, typename _Value, \n\t   typename _Allocator, typename _ExtractKey, typename _Equal,\n\t   typename _H1, typename _H2, typename _Hash, typename _RehashPolicy,\n\t   bool __chc, bool __cit, bool __uk>\n    typename _Hashtable<_Key, _Value, _Allocator, _ExtractKey, _Equal,\n\t\t\t_H1, _H2, _Hash, _RehashPolicy,\n\t\t\t__chc, __cit, __uk>::iterator\n    _Hashtable<_Key, _Value, _Allocator, _ExtractKey, _Equal,\n\t       _H1, _H2, _Hash, _RehashPolicy, __chc, __cit, __uk>::\n    find(const key_type& __k)\n    {\n      typename _Hashtable::_Hash_code_type __code = this->_M_hash_code(__k);\n      std::size_t __n = this->_M_bucket_index(__k, __code, _M_bucket_count);\n      _Node* __p = _M_find_node(_M_buckets[__n], __k, __code);\n      return __p ? iterator(__p, _M_buckets + __n) : this->end();\n    }\n\n  template<typename _Key, typename _Value, \n\t   typename _Allocator, typename _ExtractKey, typename _Equal,\n\t   typename _H1, typename _H2, typename _Hash, typename _RehashPolicy,\n\t   bool __chc, bool __cit, bool __uk>\n    typename _Hashtable<_Key, _Value, _Allocator, _ExtractKey, _Equal,\n\t\t\t_H1, _H2, _Hash, _RehashPolicy,\n\t\t\t__chc, __cit, __uk>::const_iterator\n    _Hashtable<_Key, _Value, _Allocator, _ExtractKey, _Equal,\n\t       _H1, _H2, _Hash, _RehashPolicy, __chc, __cit, __uk>::\n    find(const key_type& __k) const\n    {\n      typename _Hashtable::_Hash_code_type __code = this->_M_hash_code(__k);\n      std::size_t __n = this->_M_bucket_index(__k, __code, _M_bucket_count);\n      _Node* __p = _M_find_node(_M_buckets[__n], __k, __code);\n      return __p ? const_iterator(__p, _M_buckets + __n) : this->end();\n    }\n\n  template<typename _Key, typename _Value, \n\t   typename _Allocator, typename _ExtractKey, typename _Equal,\n\t   typename _H1, typename _H2, typename _Hash, typename _RehashPolicy,\n\t   bool __chc, bool __cit, bool __uk>\n    typename _Hashtable<_Key, _Value, _Allocator, _ExtractKey, _Equal,\n\t\t\t_H1, _H2, _Hash, _RehashPolicy,\n\t\t\t__chc, __cit, __uk>::size_type\n    _Hashtable<_Key, _Value, _Allocator, _ExtractKey, _Equal,\n\t       _H1, _H2, _Hash, _RehashPolicy, __chc, __cit, __uk>::\n    count(const key_type& __k) const\n    {\n      typename _Hashtable::_Hash_code_type __code = this->_M_hash_code(__k);\n      std::size_t __n = this->_M_bucket_index(__k, __code, _M_bucket_count);\n      std::size_t __result = 0;\n      for (_Node* __p = _M_buckets[__n]; __p; __p = __p->_M_next)\n\tif (this->_M_compare(__k, __code, __p))\n\t  ++__result;\n      return __result;\n    }\n\n  template<typename _Key, typename _Value, \n\t   typename _Allocator, typename _ExtractKey, typename _Equal,\n\t   typename _H1, typename _H2, typename _Hash, typename _RehashPolicy,\n\t   bool __chc, bool __cit, bool __uk>\n    std::pair<typename _Hashtable<_Key, _Value, _Allocator,\n\t\t\t\t  _ExtractKey, _Equal, _H1,\n\t\t\t\t  _H2, _Hash, _RehashPolicy,\n\t\t\t\t  __chc, __cit, __uk>::iterator,\n\t      typename _Hashtable<_Key, _Value, _Allocator,\n\t\t\t\t  _ExtractKey, _Equal, _H1,\n\t\t\t\t  _H2, _Hash, _RehashPolicy,\n\t\t\t\t  __chc, __cit, __uk>::iterator>\n    _Hashtable<_Key, _Value, _Allocator, _ExtractKey, _Equal,\n\t       _H1, _H2, _Hash, _RehashPolicy, __chc, __cit, __uk>::\n    equal_range(const key_type& __k)\n    {\n      typename _Hashtable::_Hash_code_type __code = this->_M_hash_code(__k);\n      std::size_t __n = this->_M_bucket_index(__k, __code, _M_bucket_count);\n      _Node** __head = _M_buckets + __n;\n      _Node* __p = _M_find_node(*__head, __k, __code);\n      \n      if (__p)\n\t{\n\t  _Node* __p1 = __p->_M_next;\n\t  for (; __p1; __p1 = __p1->_M_next)\n\t    if (!this->_M_compare(__k, __code, __p1))\n\t      break;\n\n\t  iterator __first(__p, __head);\n\t  iterator __last(__p1, __head);\n\t  if (!__p1)\n\t    __last._M_incr_bucket();\n\t  return std::make_pair(__first, __last);\n\t}\n      else\n\treturn std::make_pair(this->end(), this->end());\n    }\n\n  template<typename _Key, typename _Value, \n\t   typename _Allocator, typename _ExtractKey, typename _Equal,\n\t   typename _H1, typename _H2, typename _Hash, typename _RehashPolicy,\n\t   bool __chc, bool __cit, bool __uk>\n    std::pair<typename _Hashtable<_Key, _Value, _Allocator,\n\t\t\t\t  _ExtractKey, _Equal, _H1,\n\t\t\t\t  _H2, _Hash, _RehashPolicy,\n\t\t\t\t  __chc, __cit, __uk>::const_iterator,\n\t      typename _Hashtable<_Key, _Value, _Allocator,\n\t\t\t\t  _ExtractKey, _Equal, _H1,\n\t\t\t\t  _H2, _Hash, _RehashPolicy,\n\t\t\t\t  __chc, __cit, __uk>::const_iterator>\n    _Hashtable<_Key, _Value, _Allocator, _ExtractKey, _Equal,\n\t       _H1, _H2, _Hash, _RehashPolicy, __chc, __cit, __uk>::\n    equal_range(const key_type& __k) const\n    {\n      typename _Hashtable::_Hash_code_type __code = this->_M_hash_code(__k);\n      std::size_t __n = this->_M_bucket_index(__k, __code, _M_bucket_count);\n      _Node** __head = _M_buckets + __n;\n      _Node* __p = _M_find_node(*__head, __k, __code);\n\n      if (__p)\n\t{\n\t  _Node* __p1 = __p->_M_next;\n\t  for (; __p1; __p1 = __p1->_M_next)\n\t    if (!this->_M_compare(__k, __code, __p1))\n\t      break;\n\n\t  const_iterator __first(__p, __head);\n\t  const_iterator __last(__p1, __head);\n\t  if (!__p1)\n\t    __last._M_incr_bucket();\n\t  return std::make_pair(__first, __last);\n\t}\n      else\n\treturn std::make_pair(this->end(), this->end());\n    }\n\n  // Find the node whose key compares equal to k, beginning the search\n  // at p (usually the head of a bucket).  Return nil if no node is found.\n  template<typename _Key, typename _Value, \n\t   typename _Allocator, typename _ExtractKey, typename _Equal,\n\t   typename _H1, typename _H2, typename _Hash, typename _RehashPolicy,\n\t   bool __chc, bool __cit, bool __uk>\n    typename _Hashtable<_Key, _Value, _Allocator, _ExtractKey,\n\t\t\t_Equal, _H1, _H2, _Hash, _RehashPolicy,\n\t\t\t__chc, __cit, __uk>::_Node* \n    _Hashtable<_Key, _Value, _Allocator, _ExtractKey, _Equal,\n\t       _H1, _H2, _Hash, _RehashPolicy, __chc, __cit, __uk>::\n    _M_find_node(_Node* __p, const key_type& __k,\n\t\ttypename _Hashtable::_Hash_code_type __code) const\n    {\n      for (; __p; __p = __p->_M_next)\n\tif (this->_M_compare(__k, __code, __p))\n\t  return __p;\n      return false;\n    }\n\n  // Insert v in bucket n (assumes no element with its key already present).\n  template<typename _Key, typename _Value, \n\t   typename _Allocator, typename _ExtractKey, typename _Equal,\n\t   typename _H1, typename _H2, typename _Hash, typename _RehashPolicy,\n\t   bool __chc, bool __cit, bool __uk>\n    typename _Hashtable<_Key, _Value, _Allocator, _ExtractKey, _Equal,\n\t\t\t_H1, _H2, _Hash, _RehashPolicy,\n\t\t\t__chc, __cit, __uk>::iterator\n    _Hashtable<_Key, _Value, _Allocator, _ExtractKey, _Equal,\n\t       _H1, _H2, _Hash, _RehashPolicy, __chc, __cit, __uk>::\n    _M_insert_bucket(const value_type& __v, size_type __n,\n\t\t    typename _Hashtable::_Hash_code_type __code)\n    {\n      std::pair<bool, std::size_t> __do_rehash\n\t= _M_rehash_policy._M_need_rehash(_M_bucket_count,\n\t\t\t\t\t  _M_element_count, 1);\n\n      // Allocate the new node before doing the rehash so that we don't\n      // do a rehash if the allocation throws.\n      _Node* __new_node = _M_allocate_node(__v);\n\n      try\n\t{\n\t  if (__do_rehash.first)\n\t    {\n\t      const key_type& __k = this->_M_extract(__v);\n\t      __n = this->_M_bucket_index(__k, __code, __do_rehash.second);\n\t      _M_rehash(__do_rehash.second);\n\t    }\n\n\t  __new_node->_M_next = _M_buckets[__n];\n\t  this->_M_store_code(__new_node, __code);\n\t  _M_buckets[__n] = __new_node;\n\t  ++_M_element_count;\n\t  return iterator(__new_node, _M_buckets + __n);\n\t}\n      catch(...)\n\t{\n\t  _M_deallocate_node(__new_node);\n\t  __throw_exception_again;\n\t}\n    }\n\n  // Insert v if no element with its key is already present.\n  template<typename _Key, typename _Value, \n\t   typename _Allocator, typename _ExtractKey, typename _Equal,\n\t   typename _H1, typename _H2, typename _Hash, typename _RehashPolicy,\n\t   bool __chc, bool __cit, bool __uk>\n    std::pair<typename _Hashtable<_Key, _Value, _Allocator,\n\t\t\t\t  _ExtractKey, _Equal, _H1,\n\t\t\t\t  _H2, _Hash, _RehashPolicy,\n\t\t\t\t  __chc, __cit, __uk>::iterator, bool>\n    _Hashtable<_Key, _Value, _Allocator, _ExtractKey, _Equal,\n\t       _H1, _H2, _Hash, _RehashPolicy, __chc, __cit, __uk>::\n    _M_insert(const value_type& __v, std::tr1::true_type)\n    {\n      const key_type& __k = this->_M_extract(__v);\n      typename _Hashtable::_Hash_code_type __code = this->_M_hash_code(__k);\n      size_type __n = this->_M_bucket_index(__k, __code, _M_bucket_count);\n\n      if (_Node* __p = _M_find_node(_M_buckets[__n], __k, __code))\n\treturn std::make_pair(iterator(__p, _M_buckets + __n), false);\n      return std::make_pair(_M_insert_bucket(__v, __n, __code), true);\n    }\n  \n  // Insert v unconditionally.\n  template<typename _Key, typename _Value, \n\t   typename _Allocator, typename _ExtractKey, typename _Equal,\n\t   typename _H1, typename _H2, typename _Hash, typename _RehashPolicy,\n\t   bool __chc, bool __cit, bool __uk>\n    typename _Hashtable<_Key, _Value, _Allocator, _ExtractKey, _Equal,\n\t\t\t_H1, _H2, _Hash, _RehashPolicy,\n\t\t\t__chc, __cit, __uk>::iterator\n    _Hashtable<_Key, _Value, _Allocator, _ExtractKey, _Equal,\n\t       _H1, _H2, _Hash, _RehashPolicy, __chc, __cit, __uk>::\n    _M_insert(const value_type& __v, std::tr1::false_type)\n    {\n      std::pair<bool, std::size_t> __do_rehash\n\t= _M_rehash_policy._M_need_rehash(_M_bucket_count,\n\t\t\t\t\t  _M_element_count, 1);\n      if (__do_rehash.first)\n\t_M_rehash(__do_rehash.second);\n \n      const key_type& __k = this->_M_extract(__v);\n      typename _Hashtable::_Hash_code_type __code = this->_M_hash_code(__k);\n      size_type __n = this->_M_bucket_index(__k, __code, _M_bucket_count);\n\n      // First find the node, avoid leaking new_node if compare throws.\n      _Node* __prev = _M_find_node(_M_buckets[__n], __k, __code);\n      _Node* __new_node = _M_allocate_node(__v);\n\n      if (__prev)\n\t{\n\t  __new_node->_M_next = __prev->_M_next;\n\t  __prev->_M_next = __new_node;\n\t}\n      else\n\t{\n\t  __new_node->_M_next = _M_buckets[__n];\n\t  _M_buckets[__n] = __new_node;\n\t}\n      this->_M_store_code(__new_node, __code);\n\n      ++_M_element_count;\n      return iterator(__new_node, _M_buckets + __n);\n    }\n\n  // For erase(iterator) and erase(const_iterator).\n  template<typename _Key, typename _Value, \n\t   typename _Allocator, typename _ExtractKey, typename _Equal,\n\t   typename _H1, typename _H2, typename _Hash, typename _RehashPolicy,\n\t   bool __chc, bool __cit, bool __uk>\n    void\n    _Hashtable<_Key, _Value, _Allocator, _ExtractKey, _Equal,\n\t       _H1, _H2, _Hash, _RehashPolicy, __chc, __cit, __uk>::\n    _M_erase_node(_Node* __p, _Node** __b)\n    {\n      _Node* __cur = *__b;\n      if (__cur == __p)\n\t*__b = __cur->_M_next;\n      else\n\t{\n\t  _Node* __next = __cur->_M_next;\n\t  while (__next != __p)\n\t    {\n\t      __cur = __next;\n\t      __next = __cur->_M_next;\n\t    }\n\t  __cur->_M_next = __next->_M_next;\n\t}\n\n      _M_deallocate_node(__p);\n      --_M_element_count;\n    }\n\n  template<typename _Key, typename _Value, \n\t   typename _Allocator, typename _ExtractKey, typename _Equal,\n\t   typename _H1, typename _H2, typename _Hash, typename _RehashPolicy,\n\t   bool __chc, bool __cit, bool __uk>\n    template<typename _InputIterator>\n      void \n      _Hashtable<_Key, _Value, _Allocator, _ExtractKey, _Equal,\n\t\t _H1, _H2, _Hash, _RehashPolicy, __chc, __cit, __uk>::\n      insert(_InputIterator __first, _InputIterator __last)\n      {\n\tsize_type __n_elt = __detail::__distance_fw(__first, __last);\n\tstd::pair<bool, std::size_t> __do_rehash\n\t  = _M_rehash_policy._M_need_rehash(_M_bucket_count,\n\t\t\t\t\t    _M_element_count, __n_elt);\n\tif (__do_rehash.first)\n\t  _M_rehash(__do_rehash.second);\n\n\tfor (; __first != __last; ++__first)\n\t  this->insert(*__first);\n      }\n\n  template<typename _Key, typename _Value, \n\t   typename _Allocator, typename _ExtractKey, typename _Equal,\n\t   typename _H1, typename _H2, typename _Hash, typename _RehashPolicy,\n\t   bool __chc, bool __cit, bool __uk>\n    typename _Hashtable<_Key, _Value, _Allocator, _ExtractKey, _Equal,\n\t\t\t_H1, _H2, _Hash, _RehashPolicy,\n\t\t\t__chc, __cit, __uk>::iterator\n    _Hashtable<_Key, _Value, _Allocator, _ExtractKey, _Equal,\n\t       _H1, _H2, _Hash, _RehashPolicy, __chc, __cit, __uk>::\n    erase(iterator __it)\n    {\n      iterator __result = __it;\n      ++__result;\n      _M_erase_node(__it._M_cur_node, __it._M_cur_bucket);\n      return __result;\n    }\n\n  template<typename _Key, typename _Value, \n\t   typename _Allocator, typename _ExtractKey, typename _Equal,\n\t   typename _H1, typename _H2, typename _Hash, typename _RehashPolicy,\n\t   bool __chc, bool __cit, bool __uk>\n    typename _Hashtable<_Key, _Value, _Allocator, _ExtractKey, _Equal,\n\t\t\t_H1, _H2, _Hash, _RehashPolicy,\n\t\t\t__chc, __cit, __uk>::const_iterator\n    _Hashtable<_Key, _Value, _Allocator, _ExtractKey, _Equal,\n\t       _H1, _H2, _Hash, _RehashPolicy, __chc, __cit, __uk>::\n    erase(const_iterator __it)\n    {\n      const_iterator __result = __it;\n      ++__result;\n      _M_erase_node(__it._M_cur_node, __it._M_cur_bucket);\n      return __result;\n    }\n\n  template<typename _Key, typename _Value, \n\t   typename _Allocator, typename _ExtractKey, typename _Equal,\n\t   typename _H1, typename _H2, typename _Hash, typename _RehashPolicy,\n\t   bool __chc, bool __cit, bool __uk>\n    typename _Hashtable<_Key, _Value, _Allocator, _ExtractKey, _Equal,\n\t\t\t_H1, _H2, _Hash, _RehashPolicy,\n\t\t\t__chc, __cit, __uk>::size_type\n    _Hashtable<_Key, _Value, _Allocator, _ExtractKey, _Equal,\n\t       _H1, _H2, _Hash, _RehashPolicy, __chc, __cit, __uk>::\n    erase(const key_type& __k)\n    {\n      typename _Hashtable::_Hash_code_type __code = this->_M_hash_code(__k);\n      std::size_t __n = this->_M_bucket_index(__k, __code, _M_bucket_count);\n      size_type __result = 0;\n      \n      _Node** __slot = _M_buckets + __n;\n      while (*__slot && !this->_M_compare(__k, __code, *__slot))\n\t__slot = &((*__slot)->_M_next);\n\n      while (*__slot && this->_M_compare(__k, __code, *__slot))\n\t{\n\t  _Node* __p = *__slot;\n\t  *__slot = __p->_M_next;\n\t  _M_deallocate_node(__p);\n\t  --_M_element_count;\n\t  ++__result;\n\t}\n\n      return __result;\n    }\n\n  // ??? This could be optimized by taking advantage of the bucket\n  // structure, but it's not clear that it's worth doing.  It probably\n  // wouldn't even be an optimization unless the load factor is large.\n  template<typename _Key, typename _Value, \n\t   typename _Allocator, typename _ExtractKey, typename _Equal,\n\t   typename _H1, typename _H2, typename _Hash, typename _RehashPolicy,\n\t   bool __chc, bool __cit, bool __uk>\n    typename _Hashtable<_Key, _Value, _Allocator, _ExtractKey, _Equal,\n\t\t\t_H1, _H2, _Hash, _RehashPolicy,\n\t\t\t__chc, __cit, __uk>::iterator\n    _Hashtable<_Key, _Value, _Allocator, _ExtractKey, _Equal,\n\t       _H1, _H2, _Hash, _RehashPolicy, __chc, __cit, __uk>::\n    erase(iterator __first, iterator __last)\n    {\n      while (__first != __last)\n\t__first = this->erase(__first);\n      return __last;\n    }\n  \n  template<typename _Key, typename _Value, \n\t   typename _Allocator, typename _ExtractKey, typename _Equal,\n\t   typename _H1, typename _H2, typename _Hash, typename _RehashPolicy,\n\t   bool __chc, bool __cit, bool __uk>\n    typename _Hashtable<_Key, _Value, _Allocator, _ExtractKey, _Equal,\n\t\t\t_H1, _H2, _Hash, _RehashPolicy,\n\t\t\t__chc, __cit, __uk>::const_iterator\n    _Hashtable<_Key, _Value, _Allocator, _ExtractKey, _Equal,\n\t       _H1, _H2, _Hash, _RehashPolicy, __chc, __cit, __uk>::\n    erase(const_iterator __first, const_iterator __last)\n    {\n      while (__first != __last)\n\t__first = this->erase(__first);\n      return __last;\n    }\n\n  template<typename _Key, typename _Value, \n\t   typename _Allocator, typename _ExtractKey, typename _Equal,\n\t   typename _H1, typename _H2, typename _Hash, typename _RehashPolicy,\n\t   bool __chc, bool __cit, bool __uk>\n    void\n    _Hashtable<_Key, _Value, _Allocator, _ExtractKey, _Equal,\n\t       _H1, _H2, _Hash, _RehashPolicy, __chc, __cit, __uk>::\n    clear()\n    {\n      _M_deallocate_nodes(_M_buckets, _M_bucket_count);\n      _M_element_count = 0;\n    }\n \n  template<typename _Key, typename _Value, \n\t   typename _Allocator, typename _ExtractKey, typename _Equal,\n\t   typename _H1, typename _H2, typename _Hash, typename _RehashPolicy,\n\t   bool __chc, bool __cit, bool __uk>\n    void\n    _Hashtable<_Key, _Value, _Allocator, _ExtractKey, _Equal,\n\t       _H1, _H2, _Hash, _RehashPolicy, __chc, __cit, __uk>::\n    rehash(size_type __n)\n    {\n      _M_rehash(std::max(_M_rehash_policy._M_next_bkt(__n),\n\t\t\t _M_rehash_policy._M_bkt_for_elements(_M_element_count\n\t\t\t\t\t\t\t      + 1)));\n    }\n\n  template<typename _Key, typename _Value, \n\t   typename _Allocator, typename _ExtractKey, typename _Equal,\n\t   typename _H1, typename _H2, typename _Hash, typename _RehashPolicy,\n\t   bool __chc, bool __cit, bool __uk>\n    void\n    _Hashtable<_Key, _Value, _Allocator, _ExtractKey, _Equal,\n\t       _H1, _H2, _Hash, _RehashPolicy, __chc, __cit, __uk>::\n    _M_rehash(size_type __n)\n    {\n      _Node** __new_array = _M_allocate_buckets(__n);\n      try\n\t{\n\t  for (size_type __i = 0; __i < _M_bucket_count; ++__i)\n\t    while (_Node* __p = _M_buckets[__i])\n\t      {\n\t\tstd::size_t __new_index = this->_M_bucket_index(__p, __n);\n\t\t_M_buckets[__i] = __p->_M_next;\n\t\t__p->_M_next = __new_array[__new_index];\n\t\t__new_array[__new_index] = __p;\n\t      }\n\t  _M_deallocate_buckets(_M_buckets, _M_bucket_count);\n\t  _M_bucket_count = __n;\n\t  _M_buckets = __new_array;\n\t}\n      catch(...)\n\t{\n\t  // A failure here means that a hash function threw an exception.\n\t  // We can't restore the previous state without calling the hash\n\t  // function again, so the only sensible recovery is to delete\n\t  // everything.\n\t  _M_deallocate_nodes(__new_array, __n);\n\t  _M_deallocate_buckets(__new_array, __n);\n\t  _M_deallocate_nodes(_M_buckets, _M_bucket_count);\n\t  _M_element_count = 0;\n\t  __throw_exception_again;\n\t}\n    }\n\n_GLIBCXX_END_NAMESPACE\n} // namespace std::tr1\n\n#endif // _TR1_HASHTABLE\n\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/tr1/hashtable_policy.h",
    "content": "// Internal policy header for TR1 unordered_set and unordered_map -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n/** @file tr1/hashtable_policy.h\n *  This is a TR1 C++ Library header. \n */\n\n#ifndef _TR1_HASHTABLE_POLICY_H\n#define _TR1_HASHTABLE_POLICY_H 1\n\n#include <functional> // _Identity, _Select1st\n#include <tr1/utility>\n#include <ext/type_traits.h>\n\nnamespace std\n{ \n_GLIBCXX_BEGIN_NAMESPACE(tr1)\nnamespace __detail\n{\n  // Helper function: return distance(first, last) for forward\n  // iterators, or 0 for input iterators.\n  template<class _Iterator>\n    inline typename std::iterator_traits<_Iterator>::difference_type\n    __distance_fw(_Iterator __first, _Iterator __last,\n\t\t  std::input_iterator_tag)\n    { return 0; }\n\n  template<class _Iterator>\n    inline typename std::iterator_traits<_Iterator>::difference_type\n    __distance_fw(_Iterator __first, _Iterator __last,\n\t\t  std::forward_iterator_tag)\n    { return std::distance(__first, __last); }\n\n  template<class _Iterator>\n    inline typename std::iterator_traits<_Iterator>::difference_type\n    __distance_fw(_Iterator __first, _Iterator __last)\n    {\n      typedef typename std::iterator_traits<_Iterator>::iterator_category _Tag;\n      return __distance_fw(__first, __last, _Tag());\n    }\n\n  // XXX This is a hack.  _Prime_rehash_policy's member functions, and\n  // certainly the list of primes, should be defined in a .cc file.\n  // We're temporarily putting them in a header because we don't have a\n  // place to put TR1 .cc files yet.  There's no good reason for any of\n  // _Prime_rehash_policy's member functions to be inline, and there's\n  // certainly no good reason for _Primes<> to exist at all.  \n  struct _LessThan\n  {\n    template<typename _Tp, typename _Up>\n      bool\n      operator()(_Tp __x, _Up __y)\n      { return __x < __y; }\n  };\n\n  template<int __ulongsize = sizeof(unsigned long)>\n    struct _Primes\n    {\n      static const int __n_primes = __ulongsize != 8 ? 256 : 256 + 48;\n      static const unsigned long __primes[256 + 48 + 1];\n    };\n\n  template<int __ulongsize>\n    const int _Primes<__ulongsize>::__n_primes;\n\n  template<int __ulongsize>\n    const unsigned long _Primes<__ulongsize>::__primes[256 + 48 + 1] =\n    {\n      2ul, 3ul, 5ul, 7ul, 11ul, 13ul, 17ul, 19ul, 23ul, 29ul, 31ul,\n      37ul, 41ul, 43ul, 47ul, 53ul, 59ul, 61ul, 67ul, 71ul, 73ul, 79ul,\n      83ul, 89ul, 97ul, 103ul, 109ul, 113ul, 127ul, 137ul, 139ul, 149ul,\n      157ul, 167ul, 179ul, 193ul, 199ul, 211ul, 227ul, 241ul, 257ul,\n      277ul, 293ul, 313ul, 337ul, 359ul, 383ul, 409ul, 439ul, 467ul,\n      503ul, 541ul, 577ul, 619ul, 661ul, 709ul, 761ul, 823ul, 887ul,\n      953ul, 1031ul, 1109ul, 1193ul, 1289ul, 1381ul, 1493ul, 1613ul,\n      1741ul, 1879ul, 2029ul, 2179ul, 2357ul, 2549ul, 2753ul, 2971ul,\n      3209ul, 3469ul, 3739ul, 4027ul, 4349ul, 4703ul, 5087ul, 5503ul,\n      5953ul, 6427ul, 6949ul, 7517ul, 8123ul, 8783ul, 9497ul, 10273ul,\n      11113ul, 12011ul, 12983ul, 14033ul, 15173ul, 16411ul, 17749ul,\n      19183ul, 20753ul, 22447ul, 24281ul, 26267ul, 28411ul, 30727ul,\n      33223ul, 35933ul, 38873ul, 42043ul, 45481ul, 49201ul, 53201ul,\n      57557ul, 62233ul, 67307ul, 72817ul, 78779ul, 85229ul, 92203ul,\n      99733ul, 107897ul, 116731ul, 126271ul, 136607ul, 147793ul,\n      159871ul, 172933ul, 187091ul, 202409ul, 218971ul, 236897ul,\n      256279ul, 277261ul, 299951ul, 324503ul, 351061ul, 379787ul,\n      410857ul, 444487ul, 480881ul, 520241ul, 562841ul, 608903ul,\n      658753ul, 712697ul, 771049ul, 834181ul, 902483ul, 976369ul,\n      1056323ul, 1142821ul, 1236397ul, 1337629ul, 1447153ul, 1565659ul,\n      1693859ul, 1832561ul, 1982627ul, 2144977ul, 2320627ul, 2510653ul,\n      2716249ul, 2938679ul, 3179303ul, 3439651ul, 3721303ul, 4026031ul,\n      4355707ul, 4712381ul, 5098259ul, 5515729ul, 5967347ul, 6456007ul,\n      6984629ul, 7556579ul, 8175383ul, 8844859ul, 9569143ul, 10352717ul,\n      11200489ul, 12117689ul, 13109983ul, 14183539ul, 15345007ul,\n      16601593ul, 17961079ul, 19431899ul, 21023161ul, 22744717ul,\n      24607243ul, 26622317ul, 28802401ul, 31160981ul, 33712729ul,\n      36473443ul, 39460231ul, 42691603ul, 46187573ul, 49969847ul,\n      54061849ul, 58488943ul, 63278561ul, 68460391ul, 74066549ul,\n      80131819ul, 86693767ul, 93793069ul, 101473717ul, 109783337ul,\n      118773397ul, 128499677ul, 139022417ul, 150406843ul, 162723577ul,\n      176048909ul, 190465427ul, 206062531ul, 222936881ul, 241193053ul,\n      260944219ul, 282312799ul, 305431229ul, 330442829ul, 357502601ul,\n      386778277ul, 418451333ul, 452718089ul, 489790921ul, 529899637ul,\n      573292817ul, 620239453ul, 671030513ul, 725980837ul, 785430967ul,\n      849749479ul, 919334987ul, 994618837ul, 1076067617ul, 1164186217ul,\n      1259520799ul, 1362662261ul, 1474249943ul, 1594975441ul,\n      1725587117ul, 1866894511ul, 2019773507ul, 2185171673ul,\n      2364114217ul, 2557710269ul, 2767159799ul, 2993761039ul,\n      3238918481ul, 3504151727ul, 3791104843ul, 4101556399ul,\n      4294967291ul,\n      // Sentinel, so we don't have to test the result of lower_bound,\n      // or, on 64-bit machines, rest of the table.\n      __ulongsize != 8 ? 4294967291ul : (unsigned long)6442450933ull,\n      (unsigned long)8589934583ull,\n      (unsigned long)12884901857ull, (unsigned long)17179869143ull,\n      (unsigned long)25769803693ull, (unsigned long)34359738337ull,\n      (unsigned long)51539607367ull, (unsigned long)68719476731ull,\n      (unsigned long)103079215087ull, (unsigned long)137438953447ull,\n      (unsigned long)206158430123ull, (unsigned long)274877906899ull,\n      (unsigned long)412316860387ull, (unsigned long)549755813881ull,\n      (unsigned long)824633720731ull, (unsigned long)1099511627689ull,\n      (unsigned long)1649267441579ull, (unsigned long)2199023255531ull,\n      (unsigned long)3298534883309ull, (unsigned long)4398046511093ull,\n      (unsigned long)6597069766607ull, (unsigned long)8796093022151ull,\n      (unsigned long)13194139533241ull, (unsigned long)17592186044399ull,\n      (unsigned long)26388279066581ull, (unsigned long)35184372088777ull,\n      (unsigned long)52776558133177ull, (unsigned long)70368744177643ull,\n      (unsigned long)105553116266399ull, (unsigned long)140737488355213ull,\n      (unsigned long)211106232532861ull, (unsigned long)281474976710597ull,\n      (unsigned long)562949953421231ull, (unsigned long)1125899906842597ull,\n      (unsigned long)2251799813685119ull, (unsigned long)4503599627370449ull,\n      (unsigned long)9007199254740881ull, (unsigned long)18014398509481951ull,\n      (unsigned long)36028797018963913ull, (unsigned long)72057594037927931ull,\n      (unsigned long)144115188075855859ull,\n      (unsigned long)288230376151711717ull,\n      (unsigned long)576460752303423433ull,\n      (unsigned long)1152921504606846883ull,\n      (unsigned long)2305843009213693951ull,\n      (unsigned long)4611686018427387847ull,\n      (unsigned long)9223372036854775783ull,\n      (unsigned long)18446744073709551557ull,\n      (unsigned long)18446744073709551557ull\n    };\n\n  // Auxiliary types used for all instantiations of _Hashtable: nodes\n  // and iterators.\n  \n  // Nodes, used to wrap elements stored in the hash table.  A policy\n  // template parameter of class template _Hashtable controls whether\n  // nodes also store a hash code. In some cases (e.g. strings) this\n  // may be a performance win.\n  template<typename _Value, bool __cache_hash_code>\n    struct _Hash_node;\n\n  template<typename _Value>\n    struct _Hash_node<_Value, true>\n    {\n      _Value       _M_v;\n      std::size_t  _M_hash_code;\n      _Hash_node*  _M_next;\n    };\n\n  template<typename _Value>\n    struct _Hash_node<_Value, false>\n    {\n      _Value       _M_v;\n      _Hash_node*  _M_next;\n    };\n\n  // Local iterators, used to iterate within a bucket but not between\n  // buckets.\n  template<typename _Value, bool __cache>\n    struct _Node_iterator_base\n    {\n      _Node_iterator_base(_Hash_node<_Value, __cache>* __p)\n      : _M_cur(__p) { }\n      \n      void\n      _M_incr()\n      { _M_cur = _M_cur->_M_next; }\n\n      _Hash_node<_Value, __cache>*  _M_cur;\n    };\n\n  template<typename _Value, bool __cache>\n    inline bool\n    operator==(const _Node_iterator_base<_Value, __cache>& __x,\n\t       const _Node_iterator_base<_Value, __cache>& __y)\n    { return __x._M_cur == __y._M_cur; }\n\n  template<typename _Value, bool __cache>\n    inline bool\n    operator!=(const _Node_iterator_base<_Value, __cache>& __x,\n\t       const _Node_iterator_base<_Value, __cache>& __y)\n    { return __x._M_cur != __y._M_cur; }\n\n  template<typename _Value, bool __constant_iterators, bool __cache>\n    struct _Node_iterator\n    : public _Node_iterator_base<_Value, __cache>\n    {\n      typedef _Value                                   value_type;\n      typedef typename\n      __gnu_cxx::__conditional_type<__constant_iterators,\n\t\t\t\t    const _Value*, _Value*>::__type\n                                                       pointer;\n      typedef typename\n      __gnu_cxx::__conditional_type<__constant_iterators,\n\t\t\t\t    const _Value&, _Value&>::__type\n                                                       reference;\n      typedef std::ptrdiff_t                           difference_type;\n      typedef std::forward_iterator_tag                iterator_category;\n\n      _Node_iterator()\n      : _Node_iterator_base<_Value, __cache>(0) { }\n\n      explicit\n      _Node_iterator(_Hash_node<_Value, __cache>* __p)\n      : _Node_iterator_base<_Value, __cache>(__p) { }\n\n      reference\n      operator*() const\n      { return this->_M_cur->_M_v; }\n  \n      pointer\n      operator->() const\n      { return &this->_M_cur->_M_v; }\n\n      _Node_iterator&\n      operator++()\n      { \n\tthis->_M_incr();\n\treturn *this; \n      }\n  \n      _Node_iterator\n      operator++(int)\n      { \n\t_Node_iterator __tmp(*this);\n\tthis->_M_incr();\n\treturn __tmp;\n      }\n    };\n\n  template<typename _Value, bool __constant_iterators, bool __cache>\n    struct _Node_const_iterator\n    : public _Node_iterator_base<_Value, __cache>\n    {\n      typedef _Value                                   value_type;\n      typedef const _Value*                            pointer;\n      typedef const _Value&                            reference;\n      typedef std::ptrdiff_t                           difference_type;\n      typedef std::forward_iterator_tag                iterator_category;\n\n      _Node_const_iterator()\n      : _Node_iterator_base<_Value, __cache>(0) { }\n\n      explicit\n      _Node_const_iterator(_Hash_node<_Value, __cache>* __p)\n      : _Node_iterator_base<_Value, __cache>(__p) { }\n\n      _Node_const_iterator(const _Node_iterator<_Value, __constant_iterators,\n\t\t\t   __cache>& __x)\n      : _Node_iterator_base<_Value, __cache>(__x._M_cur) { }\n\n      reference\n      operator*() const\n      { return this->_M_cur->_M_v; }\n  \n      pointer\n      operator->() const\n      { return &this->_M_cur->_M_v; }\n\n      _Node_const_iterator&\n      operator++()\n      { \n\tthis->_M_incr();\n\treturn *this; \n      }\n  \n      _Node_const_iterator\n      operator++(int)\n      { \n\t_Node_const_iterator __tmp(*this);\n\tthis->_M_incr();\n\treturn __tmp;\n      }\n    };\n\n  template<typename _Value, bool __cache>\n    struct _Hashtable_iterator_base\n    {\n      _Hashtable_iterator_base(_Hash_node<_Value, __cache>* __node,\n\t\t\t       _Hash_node<_Value, __cache>** __bucket)\n      : _M_cur_node(__node), _M_cur_bucket(__bucket) { }\n\n      void\n      _M_incr()\n      {\n\t_M_cur_node = _M_cur_node->_M_next;\n\tif (!_M_cur_node)\n\t  _M_incr_bucket();\n      }\n\n      void\n      _M_incr_bucket();\n\n      _Hash_node<_Value, __cache>*   _M_cur_node;\n      _Hash_node<_Value, __cache>**  _M_cur_bucket;\n    };\n\n  // Global iterators, used for arbitrary iteration within a hash\n  // table.  Larger and more expensive than local iterators.\n  template<typename _Value, bool __cache>\n    void\n    _Hashtable_iterator_base<_Value, __cache>::\n    _M_incr_bucket()\n    {\n      ++_M_cur_bucket;\n\n      // This loop requires the bucket array to have a non-null sentinel.\n      while (!*_M_cur_bucket)\n\t++_M_cur_bucket;\n      _M_cur_node = *_M_cur_bucket;\n    }\n\n  template<typename _Value, bool __cache>\n    inline bool\n    operator==(const _Hashtable_iterator_base<_Value, __cache>& __x,\n\t       const _Hashtable_iterator_base<_Value, __cache>& __y)\n    { return __x._M_cur_node == __y._M_cur_node; }\n\n  template<typename _Value, bool __cache>\n    inline bool\n    operator!=(const _Hashtable_iterator_base<_Value, __cache>& __x,\n\t       const _Hashtable_iterator_base<_Value, __cache>& __y)\n    { return __x._M_cur_node != __y._M_cur_node; }\n\n  template<typename _Value, bool __constant_iterators, bool __cache>\n    struct _Hashtable_iterator\n    : public _Hashtable_iterator_base<_Value, __cache>\n    {\n      typedef _Value                                   value_type;\n      typedef typename\n      __gnu_cxx::__conditional_type<__constant_iterators,\n\t\t\t\t    const _Value*, _Value*>::__type\n                                                       pointer;\n      typedef typename\n      __gnu_cxx::__conditional_type<__constant_iterators,\n\t\t\t\t    const _Value&, _Value&>::__type\n                                                       reference;\n      typedef std::ptrdiff_t                           difference_type;\n      typedef std::forward_iterator_tag                iterator_category;\n\n      _Hashtable_iterator()\n      : _Hashtable_iterator_base<_Value, __cache>(0, 0) { }\n\n      _Hashtable_iterator(_Hash_node<_Value, __cache>* __p,\n\t\t\t  _Hash_node<_Value, __cache>** __b)\n      : _Hashtable_iterator_base<_Value, __cache>(__p, __b) { }\n\n      explicit\n      _Hashtable_iterator(_Hash_node<_Value, __cache>** __b)\n      : _Hashtable_iterator_base<_Value, __cache>(*__b, __b) { }\n\n      reference\n      operator*() const\n      { return this->_M_cur_node->_M_v; }\n  \n      pointer\n      operator->() const\n      { return &this->_M_cur_node->_M_v; }\n\n      _Hashtable_iterator&\n      operator++()\n      { \n\tthis->_M_incr();\n\treturn *this;\n      }\n  \n      _Hashtable_iterator\n      operator++(int)\n      { \n\t_Hashtable_iterator __tmp(*this);\n\tthis->_M_incr();\n\treturn __tmp;\n      }\n    };\n\n  template<typename _Value, bool __constant_iterators, bool __cache>\n    struct _Hashtable_const_iterator\n    : public _Hashtable_iterator_base<_Value, __cache>\n    {\n      typedef _Value                                   value_type;\n      typedef const _Value*                            pointer;\n      typedef const _Value&                            reference;\n      typedef std::ptrdiff_t                           difference_type;\n      typedef std::forward_iterator_tag                iterator_category;\n\n      _Hashtable_const_iterator()\n      : _Hashtable_iterator_base<_Value, __cache>(0, 0) { }\n\n      _Hashtable_const_iterator(_Hash_node<_Value, __cache>* __p,\n\t\t\t\t_Hash_node<_Value, __cache>** __b)\n      : _Hashtable_iterator_base<_Value, __cache>(__p, __b) { }\n\n      explicit\n      _Hashtable_const_iterator(_Hash_node<_Value, __cache>** __b)\n      : _Hashtable_iterator_base<_Value, __cache>(*__b, __b) { }\n\n      _Hashtable_const_iterator(const _Hashtable_iterator<_Value,\n\t\t\t\t__constant_iterators, __cache>& __x)\n      : _Hashtable_iterator_base<_Value, __cache>(__x._M_cur_node,\n\t\t\t\t\t\t  __x._M_cur_bucket) { }\n\n      reference\n      operator*() const\n      { return this->_M_cur_node->_M_v; }\n  \n      pointer\n      operator->() const\n      { return &this->_M_cur_node->_M_v; }\n\n      _Hashtable_const_iterator&\n      operator++()\n      { \n\tthis->_M_incr();\n\treturn *this;\n      }\n  \n      _Hashtable_const_iterator\n      operator++(int)\n      { \n\t_Hashtable_const_iterator __tmp(*this);\n\tthis->_M_incr();\n\treturn __tmp;\n      }\n    };\n\n\n  // Many of class template _Hashtable's template parameters are policy\n  // classes.  These are defaults for the policies.\n\n  // Default range hashing function: use division to fold a large number\n  // into the range [0, N).\n  struct _Mod_range_hashing\n  {\n    typedef std::size_t first_argument_type;\n    typedef std::size_t second_argument_type;\n    typedef std::size_t result_type;\n\n    result_type\n    operator()(first_argument_type __num, second_argument_type __den) const\n    { return __num % __den; }\n  };\n\n  // Default ranged hash function H.  In principle it should be a\n  // function object composed from objects of type H1 and H2 such that\n  // h(k, N) = h2(h1(k), N), but that would mean making extra copies of\n  // h1 and h2.  So instead we'll just use a tag to tell class template\n  // hashtable to do that composition.\n  struct _Default_ranged_hash { };\n\n  // Default value for rehash policy.  Bucket size is (usually) the\n  // smallest prime that keeps the load factor small enough.\n  struct _Prime_rehash_policy\n  {\n    _Prime_rehash_policy(float __z = 1.0);\n\n    float\n    max_load_factor() const;\n\n    // Return a bucket size no smaller than n.\n    std::size_t\n    _M_next_bkt(std::size_t __n) const;\n    \n    // Return a bucket count appropriate for n elements\n    std::size_t\n    _M_bkt_for_elements(std::size_t __n) const;\n    \n    // __n_bkt is current bucket count, __n_elt is current element count,\n    // and __n_ins is number of elements to be inserted.  Do we need to\n    // increase bucket count?  If so, return make_pair(true, n), where n\n    // is the new bucket count.  If not, return make_pair(false, 0).\n    std::pair<bool, std::size_t>\n    _M_need_rehash(std::size_t __n_bkt, std::size_t __n_elt,\n\t\t   std::size_t __n_ins) const;\n    \n    float                _M_max_load_factor;\n    float                _M_growth_factor;\n    mutable std::size_t  _M_next_resize;\n  };\n\n  inline\n  _Prime_rehash_policy::\n  _Prime_rehash_policy(float __z)\n  : _M_max_load_factor(__z), _M_growth_factor(2.f), _M_next_resize(0)\n  { }\n\n  inline float\n  _Prime_rehash_policy::\n  max_load_factor() const\n  { return _M_max_load_factor; }\n\n  // Return a prime no smaller than n.\n  inline std::size_t\n  _Prime_rehash_policy::\n  _M_next_bkt(std::size_t __n) const\n  {\n    const unsigned long* const __last = (_Primes<>::__primes\n\t\t\t\t\t + _Primes<>::__n_primes);\n    const unsigned long* __p = std::lower_bound(_Primes<>::__primes, __last,\n\t\t\t\t\t\t__n);\n    _M_next_resize = static_cast<std::size_t>(std::ceil(*__p\n\t\t\t\t\t\t\t* _M_max_load_factor));\n    return *__p;\n  }\n\n  // Return the smallest prime p such that alpha p >= n, where alpha\n  // is the load factor.\n  inline std::size_t\n  _Prime_rehash_policy::\n  _M_bkt_for_elements(std::size_t __n) const\n  {\n    const unsigned long* const __last = (_Primes<>::__primes\n\t\t\t\t\t + _Primes<>::__n_primes);\n    const float __min_bkts = __n / _M_max_load_factor;\n    const unsigned long* __p = std::lower_bound(_Primes<>::__primes, __last,\n\t\t\t\t\t\t__min_bkts, _LessThan());\n    _M_next_resize = static_cast<std::size_t>(std::ceil(*__p\n\t\t\t\t\t\t\t* _M_max_load_factor));\n    return *__p;\n  }\n\n  // Finds the smallest prime p such that alpha p > __n_elt + __n_ins.\n  // If p > __n_bkt, return make_pair(true, p); otherwise return\n  // make_pair(false, 0).  In principle this isn't very different from \n  // _M_bkt_for_elements.\n  \n  // The only tricky part is that we're caching the element count at\n  // which we need to rehash, so we don't have to do a floating-point\n  // multiply for every insertion.\n  \n  inline std::pair<bool, std::size_t>\n  _Prime_rehash_policy::\n  _M_need_rehash(std::size_t __n_bkt, std::size_t __n_elt,\n\t\t std::size_t __n_ins) const\n  {\n    if (__n_elt + __n_ins > _M_next_resize)\n      {\n\tfloat __min_bkts = ((float(__n_ins) + float(__n_elt))\n\t\t\t    / _M_max_load_factor);\n\tif (__min_bkts > __n_bkt)\n\t  {\n\t    __min_bkts = std::max(__min_bkts, _M_growth_factor * __n_bkt);\n\t    const unsigned long* const __last = (_Primes<>::__primes\n\t\t\t\t\t\t + _Primes<>::__n_primes);\n\t    const unsigned long* __p = std::lower_bound(_Primes<>::__primes,\n\t\t\t\t\t\t\t__last, __min_bkts,\n\t\t\t\t\t\t\t_LessThan());\n\t    _M_next_resize = \n\t      static_cast<std::size_t>(std::ceil(*__p * _M_max_load_factor));\n\t    return std::make_pair(true, *__p);\n\t  }\n\telse \n\t  {\n\t    _M_next_resize =\n\t      static_cast<std::size_t>(std::ceil(__n_bkt\n\t\t\t\t\t\t * _M_max_load_factor));\n\t    return std::make_pair(false, 0);\n\t  }\n      }\n    else\n      return std::make_pair(false, 0);\n  }\n\n  // Base classes for std::tr1::_Hashtable.  We define these base\n  // classes because in some cases we want to do different things\n  // depending on the value of a policy class.  In some cases the\n  // policy class affects which member functions and nested typedefs\n  // are defined; we handle that by specializing base class templates.\n  // Several of the base class templates need to access other members\n  // of class template _Hashtable, so we use the \"curiously recurring\n  // template pattern\" for them.\n\n  // class template _Map_base.  If the hashtable has a value type of the\n  // form pair<T1, T2> and a key extraction policy that returns the\n  // first part of the pair, the hashtable gets a mapped_type typedef.\n  // If it satisfies those criteria and also has unique keys, then it\n  // also gets an operator[].  \n  template<typename _Key, typename _Value, typename _Ex, bool __unique,\n\t   typename _Hashtable>\n    struct _Map_base { };\n\t  \n  template<typename _Key, typename _Pair, typename _Hashtable>\n    struct _Map_base<_Key, _Pair, std::_Select1st<_Pair>, false, _Hashtable>\n    {\n      typedef typename _Pair::second_type mapped_type;\n    };\n\n  template<typename _Key, typename _Pair, typename _Hashtable>\n  struct _Map_base<_Key, _Pair, std::_Select1st<_Pair>, true, _Hashtable>\n    {\n      typedef typename _Pair::second_type mapped_type;\n      \n      mapped_type&\n      operator[](const _Key& __k);\n    };\n\n  template<typename _Key, typename _Pair, typename _Hashtable>\n    typename _Map_base<_Key, _Pair, std::_Select1st<_Pair>,\n\t\t       true, _Hashtable>::mapped_type&\n    _Map_base<_Key, _Pair, std::_Select1st<_Pair>, true, _Hashtable>::\n    operator[](const _Key& __k)\n    {\n      _Hashtable* __h = static_cast<_Hashtable*>(this);\n      typename _Hashtable::_Hash_code_type __code = __h->_M_hash_code(__k);\n      std::size_t __n = __h->_M_bucket_index(__k, __code,\n\t\t\t\t\t     __h->_M_bucket_count);\n\n      typename _Hashtable::_Node* __p =\n\t__h->_M_find_node(__h->_M_buckets[__n], __k, __code);\n      if (!__p)\n\treturn __h->_M_insert_bucket(std::make_pair(__k, mapped_type()),\n\t\t\t\t     __n, __code)->second;\n      return (__p->_M_v).second;\n    }\n\n  // class template _Rehash_base.  Give hashtable the max_load_factor\n  // functions iff the rehash policy is _Prime_rehash_policy.\n  template<typename _RehashPolicy, typename _Hashtable>\n    struct _Rehash_base { };\n\n  template<typename _Hashtable>\n    struct _Rehash_base<_Prime_rehash_policy, _Hashtable>\n    {\n      float\n      max_load_factor() const\n      {\n\tconst _Hashtable* __this = static_cast<const _Hashtable*>(this);\n\treturn __this->__rehash_policy().max_load_factor();\n      }\n\n      void\n      max_load_factor(float __z)\n      {\n\t_Hashtable* __this = static_cast<_Hashtable*>(this);\n\t__this->__rehash_policy(_Prime_rehash_policy(__z));\n      }\n    };\n\n  // Class template _Hash_code_base.  Encapsulates two policy issues that\n  // aren't quite orthogonal.\n  //   (1) the difference between using a ranged hash function and using\n  //       the combination of a hash function and a range-hashing function.\n  //       In the former case we don't have such things as hash codes, so\n  //       we have a dummy type as placeholder.\n  //   (2) Whether or not we cache hash codes.  Caching hash codes is\n  //       meaningless if we have a ranged hash function.\n  // We also put the key extraction and equality comparison function \n  // objects here, for convenience.\n  \n  // Primary template: unused except as a hook for specializations.  \n  template<typename _Key, typename _Value,\n\t   typename _ExtractKey, typename _Equal,\n\t   typename _H1, typename _H2, typename _Hash,\n\t   bool __cache_hash_code>\n    struct _Hash_code_base;\n\n  // Specialization: ranged hash function, no caching hash codes.  H1\n  // and H2 are provided but ignored.  We define a dummy hash code type.\n  template<typename _Key, typename _Value,\n\t   typename _ExtractKey, typename _Equal,\n\t   typename _H1, typename _H2, typename _Hash>\n    struct _Hash_code_base<_Key, _Value, _ExtractKey, _Equal, _H1, _H2,\n\t\t\t   _Hash, false>\n    {\n    protected:\n      _Hash_code_base(const _ExtractKey& __ex, const _Equal& __eq,\n\t\t      const _H1&, const _H2&, const _Hash& __h)\n      : _M_extract(__ex), _M_eq(__eq), _M_ranged_hash(__h) { }\n\n      typedef void* _Hash_code_type;\n  \n      _Hash_code_type\n      _M_hash_code(const _Key& __key) const\n      { return 0; }\n  \n      std::size_t\n      _M_bucket_index(const _Key& __k, _Hash_code_type,\n\t\t      std::size_t __n) const\n      { return _M_ranged_hash(__k, __n); }\n\n      std::size_t\n      _M_bucket_index(const _Hash_node<_Value, false>* __p,\n\t\t      std::size_t __n) const\n      { return _M_ranged_hash(_M_extract(__p->_M_v), __n); }\n  \n      bool\n      _M_compare(const _Key& __k, _Hash_code_type,\n\t\t _Hash_node<_Value, false>* __n) const\n      { return _M_eq(__k, _M_extract(__n->_M_v)); }\n\n      void\n      _M_store_code(_Hash_node<_Value, false>*, _Hash_code_type) const\n      { }\n\n      void\n      _M_copy_code(_Hash_node<_Value, false>*,\n\t\t   const _Hash_node<_Value, false>*) const\n      { }\n      \n      void\n      _M_swap(_Hash_code_base& __x)\n      {\n\tstd::swap(_M_extract, __x._M_extract);\n\tstd::swap(_M_eq, __x._M_eq);\n\tstd::swap(_M_ranged_hash, __x._M_ranged_hash);\n      }\n\n    protected:\n      _ExtractKey  _M_extract;\n      _Equal       _M_eq;\n      _Hash        _M_ranged_hash;\n    };\n\n\n  // No specialization for ranged hash function while caching hash codes.\n  // That combination is meaningless, and trying to do it is an error.\n  \n  \n  // Specialization: ranged hash function, cache hash codes.  This\n  // combination is meaningless, so we provide only a declaration\n  // and no definition.  \n  template<typename _Key, typename _Value,\n\t   typename _ExtractKey, typename _Equal,\n\t   typename _H1, typename _H2, typename _Hash>\n    struct _Hash_code_base<_Key, _Value, _ExtractKey, _Equal, _H1, _H2,\n\t\t\t   _Hash, true>;\n\n  // Specialization: hash function and range-hashing function, no\n  // caching of hash codes.  H is provided but ignored.  Provides\n  // typedef and accessor required by TR1.  \n  template<typename _Key, typename _Value,\n\t   typename _ExtractKey, typename _Equal,\n\t   typename _H1, typename _H2>\n    struct _Hash_code_base<_Key, _Value, _ExtractKey, _Equal, _H1, _H2,\n\t\t\t   _Default_ranged_hash, false>\n    {\n      typedef _H1 hasher;\n\n      hasher\n      hash_function() const\n      { return _M_h1; }\n\n    protected:\n      _Hash_code_base(const _ExtractKey& __ex, const _Equal& __eq,\n\t\t      const _H1& __h1, const _H2& __h2,\n\t\t      const _Default_ranged_hash&)\n      : _M_extract(__ex), _M_eq(__eq), _M_h1(__h1), _M_h2(__h2) { }\n\n      typedef std::size_t _Hash_code_type;\n\n      _Hash_code_type\n      _M_hash_code(const _Key& __k) const\n      { return _M_h1(__k); }\n      \n      std::size_t\n      _M_bucket_index(const _Key&, _Hash_code_type __c,\n\t\t      std::size_t __n) const\n      { return _M_h2(__c, __n); }\n\n      std::size_t\n      _M_bucket_index(const _Hash_node<_Value, false>* __p,\n\t\t      std::size_t __n) const\n      { return _M_h2(_M_h1(_M_extract(__p->_M_v)), __n); }\n\n      bool\n      _M_compare(const _Key& __k, _Hash_code_type,\n\t\t _Hash_node<_Value, false>* __n) const\n      { return _M_eq(__k, _M_extract(__n->_M_v)); }\n\n      void\n      _M_store_code(_Hash_node<_Value, false>*, _Hash_code_type) const\n      { }\n\n      void\n      _M_copy_code(_Hash_node<_Value, false>*,\n\t\t   const _Hash_node<_Value, false>*) const\n      { }\n\n      void\n      _M_swap(_Hash_code_base& __x)\n      {\n\tstd::swap(_M_extract, __x._M_extract);\n\tstd::swap(_M_eq, __x._M_eq);\n\tstd::swap(_M_h1, __x._M_h1);\n\tstd::swap(_M_h2, __x._M_h2);\n      }\n\n    protected:\n      _ExtractKey  _M_extract;\n      _Equal       _M_eq;\n      _H1          _M_h1;\n      _H2          _M_h2;\n    };\n\n  // Specialization: hash function and range-hashing function, \n  // caching hash codes.  H is provided but ignored.  Provides\n  // typedef and accessor required by TR1.\n  template<typename _Key, typename _Value,\n\t   typename _ExtractKey, typename _Equal,\n\t   typename _H1, typename _H2>\n    struct _Hash_code_base<_Key, _Value, _ExtractKey, _Equal, _H1, _H2,\n\t\t\t   _Default_ranged_hash, true>\n    {\n      typedef _H1 hasher;\n      \n      hasher\n      hash_function() const\n      { return _M_h1; }\n\n    protected:\n      _Hash_code_base(const _ExtractKey& __ex, const _Equal& __eq,\n\t\t      const _H1& __h1, const _H2& __h2,\n\t\t      const _Default_ranged_hash&)\n      : _M_extract(__ex), _M_eq(__eq), _M_h1(__h1), _M_h2(__h2) { }\n\n      typedef std::size_t _Hash_code_type;\n  \n      _Hash_code_type\n      _M_hash_code(const _Key& __k) const\n      { return _M_h1(__k); }\n  \n      std::size_t\n      _M_bucket_index(const _Key&, _Hash_code_type __c,\n\t\t      std::size_t __n) const\n      { return _M_h2(__c, __n); }\n\n      std::size_t\n      _M_bucket_index(const _Hash_node<_Value, true>* __p,\n\t\t      std::size_t __n) const\n      { return _M_h2(__p->_M_hash_code, __n); }\n\n      bool\n      _M_compare(const _Key& __k, _Hash_code_type __c,\n\t\t _Hash_node<_Value, true>* __n) const\n      { return __c == __n->_M_hash_code && _M_eq(__k, _M_extract(__n->_M_v)); }\n\n      void\n      _M_store_code(_Hash_node<_Value, true>* __n, _Hash_code_type __c) const\n      { __n->_M_hash_code = __c; }\n\n      void\n      _M_copy_code(_Hash_node<_Value, true>* __to,\n\t\t   const _Hash_node<_Value, true>* __from) const\n      { __to->_M_hash_code = __from->_M_hash_code; }\n\n      void\n      _M_swap(_Hash_code_base& __x)\n      {\n\tstd::swap(_M_extract, __x._M_extract);\n\tstd::swap(_M_eq, __x._M_eq);\n\tstd::swap(_M_h1, __x._M_h1);\n\tstd::swap(_M_h2, __x._M_h2);\n      }\n      \n    protected:\n      _ExtractKey  _M_extract;\n      _Equal       _M_eq;\n      _H1          _M_h1;\n      _H2          _M_h2;\n    };\n} // namespace __detail\n_GLIBCXX_END_NAMESPACE\n} // namespace std::tr1\n\n#endif // _TR1_HASHTABLE_POLICY_H\n\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/tr1/inttypes.h",
    "content": "// TR1 inttypes.h -*- C++ -*-\n\n// Copyright (C) 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n/** @file tr1/inttypes.h\n *  This is a TR1 C++ Library header. \n */\n\n#ifndef _TR1_INTTYPES_H\n#define _TR1_INTTYPES_H 1\n\n#include <tr1/cinttypes>\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/tr1/limits.h",
    "content": "// TR1 limits.h -*- C++ -*-\n\n// Copyright (C) 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n/** @file tr1/limits.h\n *  This is a TR1 C++ Library header. \n */\n\n#ifndef _TR1_LIMITS_H\n#define _TR1_LIMITS_H 1\n\n#include <tr1/climits>\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/tr1/math.h",
    "content": "// TR1 math.h -*- C++ -*-\n\n// Copyright (C) 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n/** @file tr1/math.h\n *  This is a TR1 C++ Library header. \n */\n\n#ifndef _TR1_MATH_H\n#define _TR1_MATH_H 1\n\n#include <tr1/cmath>\n\n#if _GLIBCXX_USE_C99_MATH_TR1\n\nusing std::tr1::acos;\nusing std::tr1::acosh;\nusing std::tr1::asin;\nusing std::tr1::asinh;\nusing std::tr1::atan;\nusing std::tr1::atan2;\nusing std::tr1::atanh;\nusing std::tr1::cbrt;\nusing std::tr1::ceil;\nusing std::tr1::copysign;\nusing std::tr1::cos;\nusing std::tr1::cosh;\nusing std::tr1::erf;\nusing std::tr1::erfc;\nusing std::tr1::exp;\nusing std::tr1::exp2;\nusing std::tr1::expm1;\nusing std::tr1::fabs;\nusing std::tr1::fdim;\nusing std::tr1::floor;\nusing std::tr1::fma;\nusing std::tr1::fmax;\nusing std::tr1::fmin;\nusing std::tr1::fmod;\nusing std::tr1::frexp;\nusing std::tr1::hypot;\nusing std::tr1::ilogb;\nusing std::tr1::ldexp;\nusing std::tr1::lgamma;\nusing std::tr1::llrint;\nusing std::tr1::llround;\nusing std::tr1::log;\nusing std::tr1::log10;\nusing std::tr1::log1p;\nusing std::tr1::log2;\nusing std::tr1::logb;\nusing std::tr1::lrint;\nusing std::tr1::lround;\nusing std::tr1::nearbyint;\nusing std::tr1::nextafter;\nusing std::tr1::nexttoward;\nusing std::tr1::pow;\nusing std::tr1::remainder;\nusing std::tr1::remquo;\nusing std::tr1::rint;\nusing std::tr1::round;\nusing std::tr1::scalbln;\nusing std::tr1::scalbn;\nusing std::tr1::sin;\nusing std::tr1::sinh;\nusing std::tr1::sqrt;\nusing std::tr1::tan;\nusing std::tr1::tanh;\nusing std::tr1::tgamma;\nusing std::tr1::trunc;\n\n#endif\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/tr1/memory",
    "content": "// <tr1/memory> -*- C++ -*-\n\n// Copyright (C) 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n/**\n * @file tr1/memory\n * This is a TR1 C++ Library header. \n */\n\n#ifndef _TR1_MEMORY\n#define _TR1_MEMORY 1\n\n#include \"../memory\"\n#include <functional>       // std::less\n#include <exception>        // std::exception\n#include <new>              // std::bad_alloc\n#include <typeinfo>         // std::type_info in get_deleter\n#include <cstddef>          // std::size_t\n#include <algorithm>        // std::swap\n#include <iosfwd>           // std::basic_ostream\n#include <cstdlib>          // std::abort\n\n#include <ext/atomicity.h>\n#include <ext/concurrence.h>\n#include <bits/functexcept.h>\n#include <debug/debug.h>\n#include <tr1/type_traits>  // tr1::add_reference\n\n#include <tr1/boost_shared_ptr.h>\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/tr1/mu_iterate.h",
    "content": "// TR1 functional -*- C++ -*-\n\n// Copyright (C) 2005 Free Software Foundation, Inc.\n// Written by Douglas Gregor <doug.gregor -at- gmail.com>\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n/** @file tr1/mu_iterate.h\n *  This is an internal header file, included by other library headers.\n *  You should not attempt to use it directly.\n */\n\n// Determine the result type when we pass the arguments along. This\n// involves passing along the cv-qualifiers placed on _Mu and\n// unwrapping the argument bundle.\n// @namespace std::tr1\n// @class std::tr1::_Mu::result\ntemplate<typename _CVMu, typename _CVArg\n         _GLIBCXX_COMMA _GLIBCXX_TEMPLATE_PARAMS>\nclass result<_CVMu(_CVArg, tuple<_GLIBCXX_TEMPLATE_ARGS>)>\n  : public result_of<_CVArg(_GLIBCXX_TEMPLATE_ARGS)> { };\n\ntemplate<typename _CVArg _GLIBCXX_COMMA _GLIBCXX_TEMPLATE_PARAMS>\ntypename result_of<_CVArg(_GLIBCXX_TEMPLATE_ARGS)>::type\noperator()(_CVArg& __arg, const tuple<_GLIBCXX_TEMPLATE_ARGS>& __tuple)\n  const volatile\n{\n  return __arg(_GLIBCXX_MU_GET_TUPLE_ARGS);\n}\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/tr1/random",
    "content": "// random number generation -*- C++ -*-\n\n// Copyright (C) 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n/**\n * @file tr1/random\n * This is a TR1 C++ Library header. \n */\n\n#ifndef _TR1_RANDOM\n#define _TR1_RANDOM 1\n\n#include <cmath>\n#include <cstdio>\n#include <string>\n#include <iosfwd>\n#include <limits>\n#include <tr1/type_traits>\n#include <tr1/cmath>\n#include <ext/type_traits.h>\n#include <ext/numeric_traits.h>\n#include <bits/concept_check.h>\n#include <debug/debug.h>\n\nnamespace std\n{\n_GLIBCXX_BEGIN_NAMESPACE(tr1)\n\n  // [5.1] Random number generation\n\n  /**\n   * @addtogroup tr1_random Random Number Generation\n   * A facility for generating random numbers on selected distributions.\n   * @{\n   */\n\n  /*\n   * Implementation-space details.\n   */\n  namespace __detail\n  {\n    template<typename _UIntType, int __w, \n\t     bool = __w < std::numeric_limits<_UIntType>::digits>\n      struct _Shift\n      { static const _UIntType __value = 0; };\n\n    template<typename _UIntType, int __w>\n      struct _Shift<_UIntType, __w, true>\n      { static const _UIntType __value = _UIntType(1) << __w; };\n\n    template<typename _Tp, _Tp __a, _Tp __c, _Tp __m, bool>\n      struct _Mod;\n\n    // Dispatch based on modulus value to prevent divide-by-zero compile-time\n    // errors when m == 0.\n    template<typename _Tp, _Tp __a, _Tp __c, _Tp __m>\n      inline _Tp\n      __mod(_Tp __x)\n      { return _Mod<_Tp, __a, __c, __m, __m == 0>::__calc(__x); }\n\n    typedef __gnu_cxx::__conditional_type<(sizeof(unsigned) == 4),\n\t\t    unsigned, unsigned long>::__type _UInt32Type;\n\n    /*\n     * An adaptor class for converting the output of any Generator into\n     * the input for a specific Distribution.\n     */\n    template<typename _Engine, typename _Distribution>\n      struct _Adaptor\n      { \n\ttypedef typename _Engine::result_type        _Engine_result_type;\n\ttypedef typename _Distribution::input_type   result_type;\n\n      public:\n\t_Adaptor(const _Engine& __g)\n\t: _M_g(__g) { }\n\n\tresult_type\n\tmin() const\n\t{\n\t  result_type __return_value = 0;\n\t  if (is_integral<_Engine_result_type>::value\n\t      && is_integral<result_type>::value)\n\t    __return_value = _M_g.min();\n\t  else if (!is_integral<result_type>::value)\n\t    __return_value = result_type(0);\n\t  return __return_value;\n\t}\n\n\tresult_type\n\tmax() const\n\t{\n\t  result_type __return_value = 0;\n\t  if (is_integral<_Engine_result_type>::value\n\t      && is_integral<result_type>::value)\n\t    __return_value = _M_g.max();\n\t  else if (!is_integral<result_type>::value)\n\t    __return_value = result_type(1);\n\t  return __return_value;\n\t}\n\n\tresult_type\n\toperator()();\n\n      private:\n\t_Engine _M_g;\n      };\n\n    /*\n     * Converts a value generated by the adapted random number generator into a\n     * value in the input domain for the dependent random number distribution.\n     *\n     * Because the type traits are compile time constants only the appropriate\n     * clause of the if statements will actually be emitted by the compiler.\n     */\n    template<typename _Engine, typename _Distribution>\n      typename _Adaptor<_Engine, _Distribution>::result_type\n      _Adaptor<_Engine, _Distribution>::\n      operator()()\n      {\n\tresult_type __return_value = 0;\n\tif (is_integral<_Engine_result_type>::value\n\t    && is_integral<result_type>::value)\n\t  __return_value = _M_g();\n      \telse if (is_integral<_Engine_result_type>::value\n\t\t && !is_integral<result_type>::value)\n\t  __return_value = result_type(_M_g() - _M_g.min())\n\t    / result_type(_M_g.max() - _M_g.min() + result_type(1));\n\telse if (!is_integral<_Engine_result_type>::value\n\t\t && !is_integral<result_type>::value)\n\t  __return_value = result_type(_M_g() - _M_g.min())\n\t    / result_type(_M_g.max() - _M_g.min());\n      \treturn __return_value;\n      }\n  } // namespace __detail\n\n  /**\n   * Produces random numbers on a given disribution function using a un uniform\n   * random number generation engine.\n   *\n   * @todo the engine_value_type needs to be studied more carefully.\n   */\n  template<typename _Engine, typename _Dist>\n    class variate_generator\n    {\n      // Concept requirements.\n      __glibcxx_class_requires(_Engine, _CopyConstructibleConcept)\n      //  __glibcxx_class_requires(_Engine, _EngineConcept)\n      //  __glibcxx_class_requires(_Dist, _EngineConcept)\n\n    public:\n      typedef _Engine                                engine_type;\n      typedef __detail::_Adaptor<_Engine, _Dist>     engine_value_type;\n      typedef _Dist                                  distribution_type;\n      typedef typename _Dist::result_type            result_type;\n\n      // tr1:5.1.1 table 5.1 requirement\n      typedef typename __gnu_cxx::__enable_if<\n\tis_arithmetic<result_type>::value, result_type>::__type _IsValidType;\n\n      /**\n       * Constructs a variate generator with the uniform random number\n       * generator @p __eng for the random distribution @p __dist.\n       *\n       * @throws Any exceptions which may thrown by the copy constructors of\n       * the @p _Engine or @p _Dist objects.\n       */\n      variate_generator(engine_type __eng, distribution_type __dist)\n      : _M_engine(__eng), _M_dist(__dist) { }\n\n      /**\n       * Gets the next generated value on the distribution.\n       */\n      result_type\n      operator()()\n      { return _M_dist(_M_engine); }\n\n      /**\n       * WTF?\n       */\n      template<typename _Tp>\n        result_type\n        operator()(_Tp __value)\n        { return _M_dist(_M_engine, __value); }\n\n      /**\n       * Gets a reference to the underlying uniform random number generator\n       * object.\n       */\n      engine_value_type&\n      engine()\n      { return _M_engine; }\n\n      /**\n       * Gets a const reference to the underlying uniform random number\n       * generator object.\n       */\n      const engine_value_type&\n      engine() const\n      { return _M_engine; }\n\n      /**\n       * Gets a reference to the underlying random distribution.\n       */\n      distribution_type&\n      distribution()\n      { return _M_dist; }\n\n      /**\n       * Gets a const reference to the underlying random distribution.\n       */\n      const distribution_type&\n      distribution() const\n      { return _M_dist; }\n\n      /**\n       * Gets the closed lower bound of the distribution interval.\n       */\n      result_type\n      min() const\n      { return this->distribution().min(); }\n\n      /**\n       * Gets the closed upper bound of the distribution interval.\n       */\n      result_type\n      max() const\n      { return this->distribution().max(); }\n\n    private:\n      engine_value_type _M_engine;\n      distribution_type _M_dist;\n    };\n\n\n  /**\n   * @addtogroup tr1_random_generators Random Number Generators\n   * @ingroup tr1_random\n   *\n   * These classes define objects which provide random or pseudorandom\n   * numbers, either from a discrete or a continuous interval.  The\n   * random number generator supplied as a part of this library are\n   * all uniform random number generators which provide a sequence of\n   * random number uniformly distributed over their range.\n   *\n   * A number generator is a function object with an operator() that\n   * takes zero arguments and returns a number.\n   *\n   * A compliant random number generator must satisy the following\n   * requirements.  <table border=1 cellpadding=10 cellspacing=0>\n   * <caption align=top>Random Number Generator Requirements</caption>\n   * <tr><td>To be documented.</td></tr> </table>\n   * \n   * @{\n   */\n\n  /**\n   * @brief A model of a linear congruential random number generator.\n   *\n   * A random number generator that produces pseudorandom numbers using the\n   * linear function @f$x_{i+1}\\leftarrow(ax_{i} + c) \\bmod m @f$.\n   *\n   * The template parameter @p _UIntType must be an unsigned integral type\n   * large enough to store values up to (__m-1). If the template parameter\n   * @p __m is 0, the modulus @p __m used is\n   * std::numeric_limits<_UIntType>::max() plus 1. Otherwise, the template\n   * parameters @p __a and @p __c must be less than @p __m.\n   *\n   * The size of the state is @f$ 1 @f$.\n   */\n  template<class _UIntType, _UIntType __a, _UIntType __c, _UIntType __m>\n    class linear_congruential\n    {\n      __glibcxx_class_requires(_UIntType, _UnsignedIntegerConcept)\n      //  __glibcpp_class_requires(__a < __m && __c < __m)\n\n    public:\n      /** The type of the generated random value. */\n      typedef _UIntType result_type;\n\n      /** The multiplier. */\n      static const _UIntType multiplier = __a;\n      /** An increment. */\n      static const _UIntType increment = __c;\n      /** The modulus. */\n      static const _UIntType modulus = __m;\n\n      /**\n       * Constructs a %linear_congruential random number generator engine with\n       * seed @p __s.  The default seed value is 1.\n       *\n       * @param __s The initial seed value.\n       */\n      explicit\n      linear_congruential(unsigned long __x0 = 1)\n      { this->seed(__x0); }\n\n      /**\n       * Constructs a %linear_congruential random number generator engine\n       * seeded from the generator function @p __g.\n       *\n       * @param __g The seed generator function.\n       */\n      template<class _Gen>\n        linear_congruential(_Gen& __g)\n        { this->seed(__g); }\n\n      /**\n       * Reseeds the %linear_congruential random number generator engine\n       * sequence to the seed @g __s.\n       *\n       * @param __s The new seed.\n       */\n      void\n      seed(unsigned long __s = 1);\n\n      /**\n       * Reseeds the %linear_congruential random number generator engine\n       * sequence using values from the generator function @p __g.\n       *\n       * @param __g the seed generator function.\n       */\n      template<class _Gen>\n        void\n        seed(_Gen& __g)\n        { seed(__g, typename is_fundamental<_Gen>::type()); }\n\n      /**\n       * Gets the smallest possible value in the output range.\n       *\n       * The minumum depends on the @p __c parameter: if it is zero, the\n       * minimum generated must be > 0, otherwise 0 is allowed.\n       */\n      result_type\n      min() const\n      { return (__detail::__mod<_UIntType, 1, 0, __m>(__c) == 0) ? 1 : 0; }\n\n      /**\n       * Gets the largest possible value in the output range.\n       */\n      result_type\n      max() const\n      { return __m - 1; }\n\n      /**\n       * Gets the next random number in the sequence.\n       */\n      result_type\n      operator()();\n\n      /**\n       * Compares two linear congruential random number generator\n       * objects of the same type for equality.\n       *  \n       * @param __lhs A linear congruential random number generator object.\n       * @param __rhs Another linear congruential random number generator obj.\n       *\n       * @returns true if the two objects are equal, false otherwise.\n       */\n      friend bool\n      operator==(const linear_congruential& __lhs,\n\t\t const linear_congruential& __rhs)\n      { return __lhs._M_x == __rhs._M_x; }\n\n      /**\n       * Compares two linear congruential random number generator\n       * objects of the same type for inequality.\n       *\n       * @param __lhs A linear congruential random number generator object.\n       * @param __rhs Another linear congruential random number generator obj.\n       *\n       * @returns true if the two objects are not equal, false otherwise.\n       */\n      friend bool\n      operator!=(const linear_congruential& __lhs,\n\t\t const linear_congruential& __rhs)\n      { return !(__lhs == __rhs); }\n\n      /**\n       * Writes the textual representation of the state x(i) of x to @p __os.\n       *\n       * @param __os  The output stream.\n       * @param __lcr A % linear_congruential random number generator.\n       * @returns __os.\n       */\n      template<class _UIntType1, _UIntType1 __a1, _UIntType1 __c1,\n\t       _UIntType1 __m1,\n\t       typename _CharT, typename _Traits>\n        friend std::basic_ostream<_CharT, _Traits>&\n        operator<<(std::basic_ostream<_CharT, _Traits>& __os,\n\t\t   const linear_congruential<_UIntType1, __a1, __c1,\n\t\t   __m1>& __lcr);\n\n      /**\n       * Sets the state of the engine by reading its textual\n       * representation from @p __is.\n       *\n       * The textual representation must have been previously written using an\n       * output stream whose imbued locale and whose type's template\n       * specialization arguments _CharT and _Traits were the same as those of\n       * @p __is.\n       *\n       * @param __is  The input stream.\n       * @param __lcr A % linear_congruential random number generator.\n       * @returns __is.\n       */\n      template<class _UIntType1, _UIntType1 __a1, _UIntType1 __c1,\n\t       _UIntType1 __m1,\n\t       typename _CharT, typename _Traits>\n        friend std::basic_istream<_CharT, _Traits>&\n        operator>>(std::basic_istream<_CharT, _Traits>& __is,\n\t\t   linear_congruential<_UIntType1, __a1, __c1, __m1>& __lcr);\n\n    private:\n      template<class _Gen>\n        void\n        seed(_Gen& __g, true_type)\n        { return seed(static_cast<unsigned long>(__g)); }\n\n      template<class _Gen>\n        void\n        seed(_Gen& __g, false_type);\n\n      _UIntType _M_x;\n    };\n\n  /**\n   * The classic Minimum Standard rand0 of Lewis, Goodman, and Miller.\n   */\n  typedef linear_congruential<unsigned long, 16807, 0, 2147483647> minstd_rand0;\n\n  /**\n   * An alternative LCR (Lehmer Generator function) .\n   */\n  typedef linear_congruential<unsigned long, 48271, 0, 2147483647> minstd_rand;\n\n\n  /**\n   * A generalized feedback shift register discrete random number generator.\n   *\n   * This algorithm avoind multiplication and division and is designed to be\n   * friendly to a pipelined architecture.  If the parameters are chosen\n   * correctly, this generator will produce numbers with a very long period and\n   * fairly good apparent entropy, although still not cryptographically strong.\n   *\n   * The best way to use this generator is with the predefined mt19937 class.\n   *\n   * This algorithm was originally invented by Makoto Matsumoto and\n   * Takuji Nishimura.\n   *\n   * @var word_size   The number of bits in each element of the state vector.\n   * @var state_size  The degree of recursion.\n   * @var shift_size  The period parameter.\n   * @var mask_bits   The separation point bit index.\n   * @var parameter_a The last row of the twist matrix.\n   * @var output_u    The first right-shift tempering matrix parameter.\n   * @var output_s    The first left-shift tempering matrix parameter.\n   * @var output_b    The first left-shift tempering matrix mask.\n   * @var output_t    The second left-shift tempering matrix parameter.\n   * @var output_c    The second left-shift tempering matrix mask.\n   * @var output_l    The second right-shift tempering matrix parameter.\n   */\n  template<class _UIntType, int __w, int __n, int __m, int __r,\n\t   _UIntType __a, int __u, int __s, _UIntType __b, int __t,\n\t   _UIntType __c, int __l>\n    class mersenne_twister\n    {\n      __glibcxx_class_requires(_UIntType, _UnsignedIntegerConcept)\n\n    public:\n      // types\n      typedef _UIntType result_type;\n\n      // parameter values\n      static const int       word_size   = __w;\n      static const int       state_size  = __n;\n      static const int       shift_size  = __m;\n      static const int       mask_bits   = __r;\n      static const _UIntType parameter_a = __a;\n      static const int       output_u    = __u;\n      static const int       output_s    = __s;\n      static const _UIntType output_b    = __b;\n      static const int       output_t    = __t;\n      static const _UIntType output_c    = __c;\n      static const int       output_l    = __l;\n\n      // constructors and member function\n      mersenne_twister()\n      { seed(); }\n\n      explicit\n      mersenne_twister(unsigned long __value)\n      { seed(__value); }\n\n      template<class _Gen>\n        mersenne_twister(_Gen& __g)\n        { seed(__g); }\n\n      void\n      seed()\n      { seed(5489UL); }\n\n      void\n      seed(unsigned long __value);\n\n      template<class _Gen>\n        void\n        seed(_Gen& __g)\n        { seed(__g, typename is_fundamental<_Gen>::type()); }\n\n      result_type\n      min() const\n      { return 0; };\n\n      result_type\n      max() const\n      { return __detail::_Shift<_UIntType, __w>::__value - 1; }\n\n      result_type\n      operator()();\n\n      /**\n       * Compares two % mersenne_twister random number generator objects of\n       * the same type for equality.\n       *\n       * @param __lhs A % mersenne_twister random number generator object.\n       * @param __rhs Another % mersenne_twister random number generator\n       *              object.\n       *\n       * @returns true if the two objects are equal, false otherwise.\n       */\n      friend bool\n      operator==(const mersenne_twister& __lhs,\n\t\t const mersenne_twister& __rhs)\n      { return std::equal(__lhs._M_x, __lhs._M_x + state_size, __rhs._M_x); }\n\n      /**\n       * Compares two % mersenne_twister random number generator objects of\n       * the same type for inequality.\n       *\n       * @param __lhs A % mersenne_twister random number generator object.\n       * @param __rhs Another % mersenne_twister random number generator\n       *              object.\n       *\n       * @returns true if the two objects are not equal, false otherwise.\n       */\n      friend bool\n      operator!=(const mersenne_twister& __lhs,\n\t\t const mersenne_twister& __rhs)\n      { return !(__lhs == __rhs); }\n\n      /**\n       * Inserts the current state of a % mersenne_twister random number\n       * generator engine @p __x into the output stream @p __os.\n       *\n       * @param __os An output stream.\n       * @param __x  A % mersenne_twister random number generator engine.\n       *\n       * @returns The output stream with the state of @p __x inserted or in\n       * an error state.\n       */\n      template<class _UIntType1, int __w1, int __n1, int __m1, int __r1,\n\t       _UIntType1 __a1, int __u1, int __s1, _UIntType1 __b1, int __t1,\n\t       _UIntType1 __c1, int __l1,\n\t       typename _CharT, typename _Traits>\n        friend std::basic_ostream<_CharT, _Traits>&\n        operator<<(std::basic_ostream<_CharT, _Traits>& __os,\n\t\t   const mersenne_twister<_UIntType1, __w1, __n1, __m1, __r1,\n\t\t   __a1, __u1, __s1, __b1, __t1, __c1, __l1>& __x);\n\n      /**\n       * Extracts the current state of a % mersenne_twister random number\n       * generator engine @p __x from the input stream @p __is.\n       *\n       * @param __is An input stream.\n       * @param __x  A % mersenne_twister random number generator engine.\n       *\n       * @returns The input stream with the state of @p __x extracted or in\n       * an error state.\n       */\n      template<class _UIntType1, int __w1, int __n1, int __m1, int __r1,\n\t       _UIntType1 __a1, int __u1, int __s1, _UIntType1 __b1, int __t1,\n\t       _UIntType1 __c1, int __l1,\n\t       typename _CharT, typename _Traits>\n        friend std::basic_istream<_CharT, _Traits>&\n        operator>>(std::basic_istream<_CharT, _Traits>& __is,\n\t\t   mersenne_twister<_UIntType1, __w1, __n1, __m1, __r1,\n\t\t   __a1, __u1, __s1, __b1, __t1, __c1, __l1>& __x);\n\n    private:\n      template<class _Gen>\n        void\n        seed(_Gen& __g, true_type)\n        { return seed(static_cast<unsigned long>(__g)); }\n\n      template<class _Gen>\n        void\n        seed(_Gen& __g, false_type);\n\n      _UIntType _M_x[state_size];\n      int       _M_p;\n    };\n\n  /**\n   * The classic Mersenne Twister.\n   *\n   * Reference:\n   * M. Matsumoto and T. Nishimura, \"Mersenne Twister: A 623-Dimensionally\n   * Equidistributed Uniform Pseudo-Random Number Generator\", ACM Transactions\n   * on Modeling and Computer Simulation, Vol. 8, No. 1, January 1998, pp 3-30.\n   */\n  typedef mersenne_twister<\n    unsigned long, 32, 624, 397, 31,\n    0x9908b0dful, 11, 7,\n    0x9d2c5680ul, 15,\n    0xefc60000ul, 18\n    > mt19937;\n\n\n  /**\n   * @brief The Marsaglia-Zaman generator.\n   * \n   * This is a model of a Generalized Fibonacci discrete random number\n   * generator, sometimes referred to as the SWC generator.\n   *\n   * A discrete random number generator that produces pseudorandom\n   * numbers using @f$x_{i}\\leftarrow(x_{i - s} - x_{i - r} -\n   * carry_{i-1}) \\bmod m @f$.\n   *\n   * The size of the state is @f$ r @f$\n   * and the maximum period of the generator is @f$ m^r - m^s -1 @f$.\n   *\n   * N1688[4.13] says \"the template parameter _IntType shall denote an integral\n   * type large enough to store values up to m.\"\n   *\n   * @if maint\n   * @var _M_x     The state of the generator.  This is a ring buffer.\n   * @var _M_carry The carry.\n   * @var _M_p     Current index of x(i - r).\n   * @endif\n   */\n  template<typename _IntType, _IntType __m, int __s, int __r>\n    class subtract_with_carry\n    {\n      __glibcxx_class_requires(_IntType, _IntegerConcept)\n\n    public:\n      /** The type of the generated random value. */\n      typedef _IntType result_type;\n      \n      // parameter values\n      static const _IntType modulus   = __m;\n      static const int      long_lag  = __r;\n      static const int      short_lag = __s;\n\n      /**\n       * Constructs a default-initialized % subtract_with_carry random number\n       * generator.\n       */\n      subtract_with_carry()\n      { this->seed(); }\n\n      /**\n       * Constructs an explicitly seeded % subtract_with_carry random number\n       * generator.\n       */\n      explicit\n      subtract_with_carry(unsigned long __value)\n      { this->seed(__value); }\n\n      /**\n       * Constructs a %subtract_with_carry random number generator engine\n       * seeded from the generator function @p __g.\n       *\n       * @param __g The seed generator function.\n       */\n      template<class _Gen>\n        subtract_with_carry(_Gen& __g)\n        { this->seed(__g); }\n\n      /**\n       * Seeds the initial state @f$ x_0 @f$ of the random number generator.\n       *\n       * N1688[4.19] modifies this as follows.  If @p __value == 0,\n       * sets value to 19780503.  In any case, with a linear\n       * congruential generator lcg(i) having parameters @f$ m_{lcg} =\n       * 2147483563, a_{lcg} = 40014, c_{lcg} = 0, and lcg(0) = value\n       * @f$, sets @f$ x_{-r} \\dots x_{-1} @f$ to @f$ lcg(1) \\bmod m\n       * \\dots lcg(r) \\bmod m @f$ respectively.  If @f$ x_{-1} = 0 @f$\n       * set carry to 1, otherwise sets carry to 0.\n       */\n      void\n      seed(unsigned long __value = 19780503);\n\n      /**\n       * Seeds the initial state @f$ x_0 @f$ of the % subtract_with_carry\n       * random number generator.\n       */\n      template<class _Gen>\n        void\n        seed(_Gen& __g)\n        { seed(__g, typename is_fundamental<_Gen>::type()); }\n\n      /**\n       * Gets the inclusive minimum value of the range of random integers\n       * returned by this generator.\n       */\n      result_type\n      min() const\n      { return 0; }\n\n      /**\n       * Gets the inclusive maximum value of the range of random integers\n       * returned by this generator.\n       */\n      result_type\n      max() const\n      { return this->modulus - 1; }\n\n      /**\n       * Gets the next random number in the sequence.\n       */\n      result_type\n      operator()();\n\n      /**\n       * Compares two % subtract_with_carry random number generator objects of\n       * the same type for equality.\n       *\n       * @param __lhs A % subtract_with_carry random number generator object.\n       * @param __rhs Another % subtract_with_carry random number generator\n       *              object.\n       *\n       * @returns true if the two objects are equal, false otherwise.\n       */\n      friend bool\n      operator==(const subtract_with_carry& __lhs,\n\t\t const subtract_with_carry& __rhs)\n      { return std::equal(__lhs._M_x, __lhs._M_x + long_lag, __rhs._M_x); }\n\n      /**\n       * Compares two % subtract_with_carry random number generator objects of\n       * the same type for inequality.\n       *\n       * @param __lhs A % subtract_with_carry random number generator object.\n       * @param __rhs Another % subtract_with_carry random number generator\n       *              object.\n       *\n       * @returns true if the two objects are not equal, false otherwise.\n       */\n      friend bool\n      operator!=(const subtract_with_carry& __lhs,\n\t\t const subtract_with_carry& __rhs)\n      { return !(__lhs == __rhs); }\n\n      /**\n       * Inserts the current state of a % subtract_with_carry random number\n       * generator engine @p __x into the output stream @p __os.\n       *\n       * @param __os An output stream.\n       * @param __x  A % subtract_with_carry random number generator engine.\n       *\n       * @returns The output stream with the state of @p __x inserted or in\n       * an error state.\n       */\n      template<typename _IntType1, _IntType1 __m1, int __s1, int __r1,\n\t       typename _CharT, typename _Traits>\n        friend std::basic_ostream<_CharT, _Traits>&\n        operator<<(std::basic_ostream<_CharT, _Traits>& __os,\n\t\t   const subtract_with_carry<_IntType1, __m1, __s1,\n\t\t   __r1>& __x);\n\n      /**\n       * Extracts the current state of a % subtract_with_carry random number\n       * generator engine @p __x from the input stream @p __is.\n       *\n       * @param __is An input stream.\n       * @param __x  A % subtract_with_carry random number generator engine.\n       *\n       * @returns The input stream with the state of @p __x extracted or in\n       * an error state.\n       */\n      template<typename _IntType1, _IntType1 __m1, int __s1, int __r1,\n\t       typename _CharT, typename _Traits>\n        friend std::basic_istream<_CharT, _Traits>&\n        operator>>(std::basic_istream<_CharT, _Traits>& __is,\n\t\t   subtract_with_carry<_IntType1, __m1, __s1, __r1>& __x);\n\n    private:\n      template<class _Gen>\n        void\n        seed(_Gen& __g, true_type)\n        { return seed(static_cast<unsigned long>(__g)); }\n\n      template<class _Gen>\n        void\n        seed(_Gen& __g, false_type);\n\n      typedef typename __gnu_cxx::__add_unsigned<_IntType>::__type _UIntType;\n\n      _UIntType  _M_x[long_lag];\n      _UIntType  _M_carry;\n      int        _M_p;\n    };\n\n\n  /**\n   * @brief The Marsaglia-Zaman generator (floats version).\n   *\n   * @if maint\n   * @var _M_x     The state of the generator.  This is a ring buffer.\n   * @var _M_carry The carry.\n   * @var _M_p     Current index of x(i - r).\n   * @var _M_npows Precomputed negative powers of 2.   \n   * @endif\n   */\n  template<typename _RealType, int __w, int __s, int __r>\n    class subtract_with_carry_01\n    {\n    public:\n      /** The type of the generated random value. */\n      typedef _RealType result_type;\n      \n      // parameter values\n      static const int      word_size = __w;\n      static const int      long_lag  = __r;\n      static const int      short_lag = __s;\n\n      /**\n       * Constructs a default-initialized % subtract_with_carry_01 random\n       * number generator.\n       */\n      subtract_with_carry_01()\n      {\n\tthis->seed();\n\t_M_initialize_npows();\n      }\n\n      /**\n       * Constructs an explicitly seeded % subtract_with_carry_01 random number\n       * generator.\n       */\n      explicit\n      subtract_with_carry_01(unsigned long __value)\n      {\n\tthis->seed(__value);\n\t_M_initialize_npows();\n      }\n\n      /**\n       * Constructs a % subtract_with_carry_01 random number generator engine\n       * seeded from the generator function @p __g.\n       *\n       * @param __g The seed generator function.\n       */\n      template<class _Gen>\n        subtract_with_carry_01(_Gen& __g)\n        {\n\t  this->seed(__g);\n\t  _M_initialize_npows();\t  \n\t}\n\n      /**\n       * Seeds the initial state @f$ x_0 @f$ of the random number generator.\n       */\n      void\n      seed(unsigned long __value = 19780503);\n\n      /**\n       * Seeds the initial state @f$ x_0 @f$ of the % subtract_with_carry_01\n       * random number generator.\n       */\n      template<class _Gen>\n        void\n        seed(_Gen& __g)\n        { seed(__g, typename is_fundamental<_Gen>::type()); }\n\n      /**\n       * Gets the minimum value of the range of random floats\n       * returned by this generator.\n       */\n      result_type\n      min() const\n      { return 0.0; }\n\n      /**\n       * Gets the maximum value of the range of random floats\n       * returned by this generator.\n       */\n      result_type\n      max() const\n      { return 1.0; }\n\n      /**\n       * Gets the next random number in the sequence.\n       */\n      result_type\n      operator()();\n\n      /**\n       * Compares two % subtract_with_carry_01 random number generator objects\n       * of the same type for equality.\n       *\n       * @param __lhs A % subtract_with_carry_01 random number\n       *              generator object.\n       * @param __rhs Another % subtract_with_carry_01 random number generator\n       *              object.\n       *\n       * @returns true if the two objects are equal, false otherwise.\n       */\n      friend bool\n      operator==(const subtract_with_carry_01& __lhs,\n\t\t const subtract_with_carry_01& __rhs)\n      {\n\tfor (int __i = 0; __i < long_lag; ++__i)\n\t  if (!std::equal(__lhs._M_x[__i], __lhs._M_x[__i] + __n,\n\t\t\t  __rhs._M_x[__i]))\n\t    return false;\n\treturn true;\n      }\n\n      /**\n       * Compares two % subtract_with_carry_01 random number generator objects\n       * of the same type for inequality.\n       *\n       * @param __lhs A % subtract_with_carry_01 random number\n       *              generator object.\n       *\n       * @param __rhs Another % subtract_with_carry_01 random number generator\n       *              object.\n       *\n       * @returns true if the two objects are not equal, false otherwise.\n       */\n      friend bool\n      operator!=(const subtract_with_carry_01& __lhs,\n\t\t const subtract_with_carry_01& __rhs)\n      { return !(__lhs == __rhs); }\n\n      /**\n       * Inserts the current state of a % subtract_with_carry_01 random number\n       * generator engine @p __x into the output stream @p __os.\n       *\n       * @param __os An output stream.\n       * @param __x  A % subtract_with_carry_01 random number generator engine.\n       *\n       * @returns The output stream with the state of @p __x inserted or in\n       * an error state.\n       */\n      template<typename _RealType1, int __w1, int __s1, int __r1,\n\t       typename _CharT, typename _Traits>\n        friend std::basic_ostream<_CharT, _Traits>&\n        operator<<(std::basic_ostream<_CharT, _Traits>& __os,\n\t\t   const subtract_with_carry_01<_RealType1, __w1, __s1,\n\t\t   __r1>& __x);\n\n      /**\n       * Extracts the current state of a % subtract_with_carry_01 random number\n       * generator engine @p __x from the input stream @p __is.\n       *\n       * @param __is An input stream.\n       * @param __x  A % subtract_with_carry_01 random number generator engine.\n       *\n       * @returns The input stream with the state of @p __x extracted or in\n       * an error state.\n       */\n      template<typename _RealType1, int __w1, int __s1, int __r1,\n\t       typename _CharT, typename _Traits>\n        friend std::basic_istream<_CharT, _Traits>&\n        operator>>(std::basic_istream<_CharT, _Traits>& __is,\n\t\t   subtract_with_carry_01<_RealType1, __w1, __s1, __r1>& __x);\n\n    private:\n      template<class _Gen>\n        void\n        seed(_Gen& __g, true_type)\n        { return seed(static_cast<unsigned long>(__g)); }\n\n      template<class _Gen>\n        void\n        seed(_Gen& __g, false_type);\n\n      void\n      _M_initialize_npows();\n\n      static const int __n = (__w + 31) / 32;\n\n      typedef __detail::_UInt32Type _UInt32Type;\n      _UInt32Type  _M_x[long_lag][__n];\n      _RealType    _M_npows[__n];\n      _UInt32Type  _M_carry;\n      int          _M_p;\n    };\n\n  typedef subtract_with_carry_01<float, 24, 10, 24>   ranlux_base_01;\n\n  // _GLIBCXX_RESOLVE_LIB_DEFECTS\n  // 508. Bad parameters for ranlux64_base_01.\n  typedef subtract_with_carry_01<double, 48, 5, 12> ranlux64_base_01;  \n\n\n  /**\n   * Produces random numbers from some base engine by discarding blocks of\n   * data.\n   *\n   * 0 <= @p __r <= @p __p\n   */\n  template<class _UniformRandomNumberGenerator, int __p, int __r>\n    class discard_block\n    {\n      // __glibcxx_class_requires(typename base_type::result_type,\n      //                          ArithmeticTypeConcept)\n\n    public:\n      /** The type of the underlying generator engine. */\n      typedef _UniformRandomNumberGenerator   base_type;\n      /** The type of the generated random value. */\n      typedef typename base_type::result_type result_type;\n\n      // parameter values\n      static const int block_size = __p;\n      static const int used_block = __r;\n\n      /**\n       * Constructs a default %discard_block engine.\n       *\n       * The underlying engine is default constructed as well.\n       */\n      discard_block()\n      : _M_n(0) { }\n\n      /**\n       * Copy constructs a %discard_block engine.\n       *\n       * Copies an existing base class random number geenerator.\n       * @param rng An existing (base class) engine object.\n       */\n      explicit\n      discard_block(const base_type& __rng)\n      : _M_b(__rng), _M_n(0) { }\n\n      /**\n       * Seed constructs a %discard_block engine.\n       *\n       * Constructs the underlying generator engine seeded with @p __s.\n       * @param __s A seed value for the base class engine.\n       */\n      explicit\n      discard_block(unsigned long __s)\n      : _M_b(__s), _M_n(0) { }\n\n      /**\n       * Generator construct a %discard_block engine.\n       *\n       * @param __g A seed generator function.\n       */\n      template<class _Gen>\n        discard_block(_Gen& __g)\n\t: _M_b(__g), _M_n(0) { }\n\n      /**\n       * Reseeds the %discard_block object with the default seed for the\n       * underlying base class generator engine.\n       */\n      void seed()\n      {\n\t_M_b.seed();\n\t_M_n = 0;\n      }\n\n      /**\n       * Reseeds the %discard_block object with the given seed generator\n       * function.\n       * @param __g A seed generator function.\n       */\n      template<class _Gen>\n        void seed(_Gen& __g)\n        {\n\t  _M_b.seed(__g);\n\t  _M_n = 0;\n\t}\n\n      /**\n       * Gets a const reference to the underlying generator engine object.\n       */\n      const base_type&\n      base() const\n      { return _M_b; }\n\n      /**\n       * Gets the minimum value in the generated random number range.\n       */\n      result_type\n      min() const\n      { return _M_b.min(); }\n\n      /**\n       * Gets the maximum value in the generated random number range.\n       */\n      result_type\n      max() const\n      { return _M_b.max(); }\n\n      /**\n       * Gets the next value in the generated random number sequence.\n       */\n      result_type\n      operator()();\n\n      /**\n       * Compares two %discard_block random number generator objects of\n       * the same type for equality.\n       *\n       * @param __lhs A %discard_block random number generator object.\n       * @param __rhs Another %discard_block random number generator\n       *              object.\n       *\n       * @returns true if the two objects are equal, false otherwise.\n       */\n      friend bool\n      operator==(const discard_block& __lhs, const discard_block& __rhs)\n      { return (__lhs._M_b == __rhs._M_b) && (__lhs._M_n == __rhs._M_n); }\n\n      /**\n       * Compares two %discard_block random number generator objects of\n       * the same type for inequality.\n       *\n       * @param __lhs A %discard_block random number generator object.\n       * @param __rhs Another %discard_block random number generator\n       *              object.\n       *\n       * @returns true if the two objects are not equal, false otherwise.\n       */\n      friend bool\n      operator!=(const discard_block& __lhs, const discard_block& __rhs)\n      { return !(__lhs == __rhs); }\n\n      /**\n       * Inserts the current state of a %discard_block random number\n       * generator engine @p __x into the output stream @p __os.\n       *\n       * @param __os An output stream.\n       * @param __x  A %discard_block random number generator engine.\n       *\n       * @returns The output stream with the state of @p __x inserted or in\n       * an error state.\n       */\n      template<class _UniformRandomNumberGenerator1, int __p1, int __r1,\n\t       typename _CharT, typename _Traits>\n        friend std::basic_ostream<_CharT, _Traits>&\n        operator<<(std::basic_ostream<_CharT, _Traits>& __os,\n\t\t   const discard_block<_UniformRandomNumberGenerator1,\n\t\t   __p1, __r1>& __x);\n\n      /**\n       * Extracts the current state of a % subtract_with_carry random number\n       * generator engine @p __x from the input stream @p __is.\n       *\n       * @param __is An input stream.\n       * @param __x  A %discard_block random number generator engine.\n       *\n       * @returns The input stream with the state of @p __x extracted or in\n       * an error state.\n       */\n      template<class _UniformRandomNumberGenerator1, int __p1, int __r1,\n\t       typename _CharT, typename _Traits>\n        friend std::basic_istream<_CharT, _Traits>&\n        operator>>(std::basic_istream<_CharT, _Traits>& __is,\n\t\t   discard_block<_UniformRandomNumberGenerator1,\n\t\t   __p1, __r1>& __x);\n\n    private:\n      base_type _M_b;\n      int       _M_n;\n    };\n\n\n  /**\n   * James's luxury-level-3 integer adaptation of Luescher's generator.\n   */\n  typedef discard_block<\n    subtract_with_carry<unsigned long, (1UL << 24), 10, 24>,\n      223,\n      24\n      > ranlux3;\n\n  /**\n   * James's luxury-level-4 integer adaptation of Luescher's generator.\n   */\n  typedef discard_block<\n    subtract_with_carry<unsigned long, (1UL << 24), 10, 24>,\n      389,\n      24\n      > ranlux4;\n\n  typedef discard_block<\n    subtract_with_carry_01<float, 24, 10, 24>,\n      223,\n      24\n      > ranlux3_01;\n\n  typedef discard_block<\n    subtract_with_carry_01<float, 24, 10, 24>,\n      389,\n      24\n      > ranlux4_01;\n\n\n  /**\n   * A random number generator adaptor class that combines two random number\n   * generator engines into a single output sequence.\n   */\n  template<class _UniformRandomNumberGenerator1, int __s1,\n\t   class _UniformRandomNumberGenerator2, int __s2>\n    class xor_combine\n    {\n      // __glibcxx_class_requires(typename _UniformRandomNumberGenerator1::\n      //                          result_type, ArithmeticTypeConcept)\n      // __glibcxx_class_requires(typename _UniformRandomNumberGenerator2::\n      //                          result_type, ArithmeticTypeConcept)\n\n    public:\n      /** The type of the the first underlying generator engine. */\n      typedef _UniformRandomNumberGenerator1   base1_type;\n      /** The type of the the second underlying generator engine. */\n      typedef _UniformRandomNumberGenerator2   base2_type;\n\n    private:\n      typedef typename base1_type::result_type _Result_type1;\n      typedef typename base2_type::result_type _Result_type2;\n\n    public:\n      /** The type of the generated random value. */\n      typedef typename __gnu_cxx::__conditional_type<(sizeof(_Result_type1)\n\t\t\t\t\t\t      > sizeof(_Result_type2)),\n\t_Result_type1, _Result_type2>::__type result_type;\n\n      // parameter values\n      static const int shift1 = __s1;\n      static const int shift2 = __s2;\n\n      // constructors and member function\n      xor_combine()\n      : _M_b1(), _M_b2()\t\n      { _M_initialize_max(); }\n\n      xor_combine(const base1_type& __rng1, const base2_type& __rng2)\n      : _M_b1(__rng1), _M_b2(__rng2)\n      { _M_initialize_max(); }\n\n      xor_combine(unsigned long __s)\n      : _M_b1(__s), _M_b2(__s + 1)\n      { _M_initialize_max(); }\n\n      template<class _Gen>\n        xor_combine(_Gen& __g)\n\t: _M_b1(__g), _M_b2(__g)\n        { _M_initialize_max(); }\n\n      void\n      seed()\n      {\n\t_M_b1.seed();\n\t_M_b2.seed();\n      }\n\n      template<class _Gen>\n        void\n        seed(_Gen& __g)\n        {\n\t  _M_b1.seed(__g);\n\t  _M_b2.seed(__g);\n\t}\n\n      const base1_type&\n      base1() const\n      { return _M_b1; }\n\n      const base2_type&\n      base2() const\n      { return _M_b2; }\n\n      result_type\n      min() const\n      { return 0; }\n\n      result_type\n      max() const\n      { return _M_max; }\n\n      /**\n       * Gets the next random number in the sequence.\n       */\n      // NB: Not exactly the TR1 formula, per N2079 instead.\n      result_type\n      operator()()\n      {\n\treturn ((result_type(_M_b1() - _M_b1.min()) << shift1)\n\t\t^ (result_type(_M_b2() - _M_b2.min()) << shift2));\n      }\n\n      /**\n       * Compares two %xor_combine random number generator objects of\n       * the same type for equality.\n       *\n       * @param __lhs A %xor_combine random number generator object.\n       * @param __rhs Another %xor_combine random number generator\n       *              object.\n       *\n       * @returns true if the two objects are equal, false otherwise.\n       */\n      friend bool\n      operator==(const xor_combine& __lhs, const xor_combine& __rhs)\n      {\n\treturn (__lhs.base1() == __rhs.base1())\n\t        && (__lhs.base2() == __rhs.base2());\n      }\n\n      /**\n       * Compares two %xor_combine random number generator objects of\n       * the same type for inequality.\n       *\n       * @param __lhs A %xor_combine random number generator object.\n       * @param __rhs Another %xor_combine random number generator\n       *              object.\n       *\n       * @returns true if the two objects are not equal, false otherwise.\n       */\n      friend bool\n      operator!=(const xor_combine& __lhs, const xor_combine& __rhs)\n      { return !(__lhs == __rhs); }\n\n      /**\n       * Inserts the current state of a %xor_combine random number\n       * generator engine @p __x into the output stream @p __os.\n       *\n       * @param __os An output stream.\n       * @param __x  A %xor_combine random number generator engine.\n       *\n       * @returns The output stream with the state of @p __x inserted or in\n       * an error state.\n       */\n      template<class _UniformRandomNumberGenerator11, int __s11,\n\t       class _UniformRandomNumberGenerator21, int __s21,\n\t       typename _CharT, typename _Traits>\n        friend std::basic_ostream<_CharT, _Traits>&\n        operator<<(std::basic_ostream<_CharT, _Traits>& __os,\n\t\t   const xor_combine<_UniformRandomNumberGenerator11, __s11,\n\t\t   _UniformRandomNumberGenerator21, __s21>& __x);\n\n      /**\n       * Extracts the current state of a %xor_combine random number\n       * generator engine @p __x from the input stream @p __is.\n       *\n       * @param __is An input stream.\n       * @param __x  A %xor_combine random number generator engine.\n       *\n       * @returns The input stream with the state of @p __x extracted or in\n       * an error state.\n       */\n      template<class _UniformRandomNumberGenerator11, int __s11,\n\t       class _UniformRandomNumberGenerator21, int __s21,\n\t       typename _CharT, typename _Traits>\n        friend std::basic_istream<_CharT, _Traits>&\n        operator>>(std::basic_istream<_CharT, _Traits>& __is,\n\t\t   xor_combine<_UniformRandomNumberGenerator11, __s11,\n\t\t   _UniformRandomNumberGenerator21, __s21>& __x);\n\n    private:\n      void\n      _M_initialize_max();\n\n      result_type\n      _M_initialize_max_aux(result_type, result_type, int);\n\n      base1_type  _M_b1;\n      base2_type  _M_b2;\n      result_type _M_max;\n    };\n\n\n  /**\n   * A standard interface to a platform-specific non-deterministic\n   * random number generator (if any are available).\n   */\n  class random_device\n  {\n  public:\n    // types\n    typedef unsigned int result_type;\n\n    // constructors, destructors and member functions\n\n#ifdef _GLIBCXX_USE_RANDOM_TR1\n\n    explicit\n    random_device(const std::string& __token = \"/dev/urandom\")\n    {\n      if ((__token != \"/dev/urandom\" && __token != \"/dev/random\")\n\t  || !(_M_file = std::fopen(__token.c_str(), \"rb\")))\n\tstd::__throw_runtime_error(__N(\"random_device::\"\n\t\t\t\t       \"random_device(const std::string&)\"));\n    }\n\n    ~random_device()\n    { std::fclose(_M_file); }\n\n#else\n\n    explicit\n    random_device(const std::string& __token = \"mt19937\")\n    : _M_mt(_M_strtoul(__token)) { }\n\n  private:\n    static unsigned long\n    _M_strtoul(const std::string& __str)\n    {\n      unsigned long __ret = 5489UL;\n      if (__str != \"mt19937\")\n\t{\n\t  const char* __nptr = __str.c_str();\n\t  char* __endptr;\n\t  __ret = std::strtoul(__nptr, &__endptr, 0);\n\t  if (*__nptr == '\\0' || *__endptr != '\\0')\n\t    std::__throw_runtime_error(__N(\"random_device::_M_strtoul\"\n\t\t\t\t\t   \"(const std::string&)\"));\n\t}\n      return __ret;\n    }\n\n  public:\n\n#endif\n\n    result_type\n    min() const\n    { return std::numeric_limits<result_type>::min(); }\n\n    result_type\n    max() const\n    { return std::numeric_limits<result_type>::max(); }\n\n    double\n    entropy() const\n    { return 0.0; }\n\n    result_type\n    operator()()\n    {\n#ifdef _GLIBCXX_USE_RANDOM_TR1\n      result_type __ret;\n      std::fread(reinterpret_cast<void*>(&__ret), sizeof(result_type),\n\t\t 1, _M_file);\n      return __ret;\n#else\n      return _M_mt();\n#endif\n    }\n\n  private:\n    random_device(const random_device&);\n    void operator=(const random_device&);\n\n#ifdef _GLIBCXX_USE_RANDOM_TR1\n    FILE*        _M_file;\n#else\n    mt19937      _M_mt;\n#endif\n  };\n\n  /* @} */ // group tr1_random_generators\n\n  /**\n   * @addtogroup tr1_random_distributions Random Number Distributions\n   * @ingroup tr1_random\n   * @{\n   */\n\n  /**\n   * @addtogroup tr1_random_distributions_discrete Discrete Distributions\n   * @ingroup tr1_random_distributions\n   * @{\n   */\n\n  /**\n   * @brief Uniform discrete distribution for random numbers.\n   * A discrete random distribution on the range @f$[min, max]@f$ with equal\n   * probability throughout the range.\n   */\n  template<typename _IntType = int>\n    class uniform_int\n    {\n      __glibcxx_class_requires(_IntType, _IntegerConcept)\n \n    public:\n      /** The type of the parameters of the distribution. */\n      typedef _IntType input_type;\n      /** The type of the range of the distribution. */\n      typedef _IntType result_type;\n\n    public:\n      /**\n       * Constructs a uniform distribution object.\n       */\n      explicit\n      uniform_int(_IntType __min = 0, _IntType __max = 9)\n      : _M_min(__min), _M_max(__max)\n      {\n\t_GLIBCXX_DEBUG_ASSERT(_M_min <= _M_max);\n      }\n\n      /**\n       * Gets the inclusive lower bound of the distribution range.\n       */\n      result_type\n      min() const\n      { return _M_min; }\n\n      /**\n       * Gets the inclusive upper bound of the distribution range.\n       */\n      result_type\n      max() const\n      { return _M_max; }\n\n      /**\n       * Resets the distribution state.\n       *\n       * Does nothing for the uniform integer distribution.\n       */\n      void\n      reset() { }\n\n      /**\n       * Gets a uniformly distributed random number in the range\n       * @f$(min, max)@f$.\n       */\n      template<typename _UniformRandomNumberGenerator>\n        result_type\n        operator()(_UniformRandomNumberGenerator& __urng)\n        {\n\t  typedef typename _UniformRandomNumberGenerator::result_type\n\t    _UResult_type;\n\t  return _M_call(__urng, _M_min, _M_max,\n\t\t\t typename is_integral<_UResult_type>::type());\n\t}\n\n      /**\n       * Gets a uniform random number in the range @f$[0, n)@f$.\n       *\n       * This function is aimed at use with std::random_shuffle.\n       */\n      template<typename _UniformRandomNumberGenerator>\n        result_type\n        operator()(_UniformRandomNumberGenerator& __urng, result_type __n)\n        {\n\t  typedef typename _UniformRandomNumberGenerator::result_type\n\t    _UResult_type;\n\t  return _M_call(__urng, 0, __n - 1,\n\t\t\t typename is_integral<_UResult_type>::type());\n\t}\n\n      /**\n       * Inserts a %uniform_int random number distribution @p __x into the\n       * output stream @p os.\n       *\n       * @param __os An output stream.\n       * @param __x  A %uniform_int random number distribution.\n       *\n       * @returns The output stream with the state of @p __x inserted or in\n       * an error state.\n       */\n      template<typename _IntType1, typename _CharT, typename _Traits>\n        friend std::basic_ostream<_CharT, _Traits>&\n        operator<<(std::basic_ostream<_CharT, _Traits>& __os,\n\t\t   const uniform_int<_IntType1>& __x);\n\n      /**\n       * Extracts a %unform_int random number distribution\n       * @p __x from the input stream @p __is.\n       *\n       * @param __is An input stream.\n       * @param __x  A %uniform_int random number generator engine.\n       *\n       * @returns The input stream with @p __x extracted or in an error state.\n       */\n      template<typename _IntType1, typename _CharT, typename _Traits>\n        friend std::basic_istream<_CharT, _Traits>&\n        operator>>(std::basic_istream<_CharT, _Traits>& __is,\n\t\t   uniform_int<_IntType1>& __x);\n\n    private:\n      template<typename _UniformRandomNumberGenerator>\n        result_type\n        _M_call(_UniformRandomNumberGenerator& __urng,\n\t\tresult_type __min, result_type __max, true_type)\n        { \n\t  typedef typename __gnu_cxx::__add_unsigned<typename\n\t    _UniformRandomNumberGenerator::result_type>::__type __utype;\n\t  return result_type(__utype(__urng()) % (__max - __min + 1)) + __min;\n\t}\n\n      template<typename _UniformRandomNumberGenerator>\n        result_type\n        _M_call(_UniformRandomNumberGenerator& __urng,\n\t\tresult_type __min, result_type __max, false_type)\n        {\n\t  return result_type((__urng() - __urng.min())\n\t\t\t     / (__urng.max() - __urng.min())\n\t\t\t     * (__max - __min + 1)) + __min;\n\t}\n\n      _IntType _M_min;\n      _IntType _M_max;\n    };\n\n\n  /**\n   * @brief A Bernoulli random number distribution.\n   *\n   * Generates a sequence of true and false values with likelihood @f$ p @f$\n   * that true will come up and @f$ (1 - p) @f$ that false will appear.\n   */\n  class bernoulli_distribution\n  {\n  public:\n    typedef int  input_type;\n    typedef bool result_type;\n\n  public:\n    /**\n     * Constructs a Bernoulli distribution with likelihood @p p.\n     *\n     * @param __p  [IN]  The likelihood of a true result being returned.  Must\n     * be in the interval @f$ [0, 1] @f$.\n     */\n    explicit\n    bernoulli_distribution(double __p = 0.5)\n    : _M_p(__p)\n    { \n      _GLIBCXX_DEBUG_ASSERT((_M_p >= 0.0) && (_M_p <= 1.0));\n    }\n\n    /**\n     * Gets the @p p parameter of the distribution.\n     */\n    double\n    p() const\n    { return _M_p; }\n\n    /**\n     * Resets the distribution state.\n     *\n     * Does nothing for a bernoulli distribution.\n     */\n    void\n    reset() { }\n\n    /**\n     * Gets the next value in the Bernoullian sequence.\n     */\n    template<class _UniformRandomNumberGenerator>\n      result_type\n      operator()(_UniformRandomNumberGenerator& __urng)\n      {\n\tif ((__urng() - __urng.min()) < _M_p * (__urng.max() - __urng.min()))\n\t  return true;\n\treturn false;\n      }\n\n    /**\n     * Inserts a %bernoulli_distribution random number distribution\n     * @p __x into the output stream @p __os.\n     *\n     * @param __os An output stream.\n     * @param __x  A %bernoulli_distribution random number distribution.\n     *\n     * @returns The output stream with the state of @p __x inserted or in\n     * an error state.\n     */\n    template<typename _CharT, typename _Traits>\n      friend std::basic_ostream<_CharT, _Traits>&\n      operator<<(std::basic_ostream<_CharT, _Traits>& __os,\n\t\t const bernoulli_distribution& __x);\n\n    /**\n     * Extracts a %bernoulli_distribution random number distribution\n     * @p __x from the input stream @p __is.\n     *\n     * @param __is An input stream.\n     * @param __x  A %bernoulli_distribution random number generator engine.\n     *\n     * @returns The input stream with @p __x extracted or in an error state.\n     */\n    template<typename _CharT, typename _Traits>\n      friend std::basic_istream<_CharT, _Traits>&\n      operator>>(std::basic_istream<_CharT, _Traits>& __is,\n\t\t bernoulli_distribution& __x)\n      { return __is >> __x._M_p; }\n\n  private:\n    double _M_p;\n  };\n\n\n  /**\n   * @brief A discrete geometric random number distribution.\n   *\n   * The formula for the geometric probability mass function is \n   * @f$ p(i) = (1 - p)p^{i-1} @f$ where @f$ p @f$ is the parameter of the\n   * distribution.\n   */\n  template<typename _IntType = int, typename _RealType = double>\n    class geometric_distribution\n    {\n    public:\n      // types\n      typedef _RealType input_type;\n      typedef _IntType  result_type;\n\n      // constructors and member function\n      explicit\n      geometric_distribution(const _RealType& __p = _RealType(0.5))\n      : _M_p(__p)\n      {\n\t_GLIBCXX_DEBUG_ASSERT((_M_p > 0.0) && (_M_p < 1.0));\n\t_M_initialize();\n      }\n\n      /**\n       * Gets the distribution parameter @p p.\n       */\n      _RealType\n      p() const\n      { return _M_p; }\n\n      void\n      reset() { }\n\n      template<class _UniformRandomNumberGenerator>\n        result_type\n        operator()(_UniformRandomNumberGenerator& __urng);\n\n      /**\n       * Inserts a %geometric_distribution random number distribution\n       * @p __x into the output stream @p __os.\n       *\n       * @param __os An output stream.\n       * @param __x  A %geometric_distribution random number distribution.\n       *\n       * @returns The output stream with the state of @p __x inserted or in\n       * an error state.\n       */\n      template<typename _IntType1, typename _RealType1,\n\t       typename _CharT, typename _Traits>\n        friend std::basic_ostream<_CharT, _Traits>&\n        operator<<(std::basic_ostream<_CharT, _Traits>& __os,\n\t\t   const geometric_distribution<_IntType1, _RealType1>& __x);\n\n      /**\n       * Extracts a %geometric_distribution random number distribution\n       * @p __x from the input stream @p __is.\n       *\n       * @param __is An input stream.\n       * @param __x  A %geometric_distribution random number generator engine.\n       *\n       * @returns The input stream with @p __x extracted or in an error state.\n       */\n      template<typename _CharT, typename _Traits>\n        friend std::basic_istream<_CharT, _Traits>&\n        operator>>(std::basic_istream<_CharT, _Traits>& __is,\n\t\t   geometric_distribution& __x)\n        {\n\t  __is >> __x._M_p;\n\t  __x._M_initialize();\n\t  return __is;\n\t}\n\n    private:\n      void\n      _M_initialize()\n      { _M_log_p = std::log(_M_p); }\n\n      _RealType _M_p;\n      _RealType _M_log_p;\n    };\n\n\n  template<typename _RealType>\n    class normal_distribution;\n\n  /**\n   * @brief A discrete Poisson random number distribution.\n   *\n   * The formula for the poisson probability mass function is \n   * @f$ p(i) = \\frac{mean^i}{i!} e^{-mean} @f$ where @f$ mean @f$ is the\n   * parameter of the distribution.\n   */\n  template<typename _IntType = int, typename _RealType = double>\n    class poisson_distribution\n    {\n    public:\n      // types\n      typedef _RealType input_type;\n      typedef _IntType  result_type;\n\n      // constructors and member function\n      explicit\n      poisson_distribution(const _RealType& __mean = _RealType(1))\n      : _M_mean(__mean), _M_nd()\n      {\n\t_GLIBCXX_DEBUG_ASSERT(_M_mean > 0.0);\n\t_M_initialize();\n      }\n\n      /**\n       * Gets the distribution parameter @p mean.\n       */\n      _RealType\n      mean() const\n      { return _M_mean; }\n\n      void\n      reset()\n      { _M_nd.reset(); }\n\n      template<class _UniformRandomNumberGenerator>\n        result_type\n        operator()(_UniformRandomNumberGenerator& __urng);\n\n      /**\n       * Inserts a %poisson_distribution random number distribution\n       * @p __x into the output stream @p __os.\n       *\n       * @param __os An output stream.\n       * @param __x  A %poisson_distribution random number distribution.\n       *\n       * @returns The output stream with the state of @p __x inserted or in\n       * an error state.\n       */\n      template<typename _IntType1, typename _RealType1,\n\t       typename _CharT, typename _Traits>\n        friend std::basic_ostream<_CharT, _Traits>&\n        operator<<(std::basic_ostream<_CharT, _Traits>& __os,\n\t\t   const poisson_distribution<_IntType1, _RealType1>& __x);\n\n      /**\n       * Extracts a %poisson_distribution random number distribution\n       * @p __x from the input stream @p __is.\n       *\n       * @param __is An input stream.\n       * @param __x  A %poisson_distribution random number generator engine.\n       *\n       * @returns The input stream with @p __x extracted or in an error state.\n       */\n      template<typename _IntType1, typename _RealType1,\n\t       typename _CharT, typename _Traits>\n        friend std::basic_istream<_CharT, _Traits>&\n        operator>>(std::basic_istream<_CharT, _Traits>& __is,\n\t\t   poisson_distribution<_IntType1, _RealType1>& __x);\n\n    private:\n      void\n      _M_initialize();\n\n      // NB: Unused when _GLIBCXX_USE_C99_MATH_TR1 is undefined.\n      normal_distribution<_RealType> _M_nd;\n\n      _RealType _M_mean;\n\n      // Hosts either log(mean) or the threshold of the simple method.\n      _RealType _M_lm_thr;\n#if _GLIBCXX_USE_C99_MATH_TR1\n      _RealType _M_lfm, _M_sm, _M_d, _M_scx, _M_1cx, _M_c2b, _M_cb;\n#endif\n    };\n\n\n  /**\n   * @brief A discrete binomial random number distribution.\n   *\n   * The formula for the binomial probability mass function is \n   * @f$ p(i) = \\binom{n}{i} p^i (1 - p)^{t - i} @f$ where @f$ t @f$\n   * and @f$ p @f$ are the parameters of the distribution.\n   */\n  template<typename _IntType = int, typename _RealType = double>\n    class binomial_distribution\n    {\n    public:\n      // types\n      typedef _RealType input_type;\n      typedef _IntType  result_type;\n\n      // constructors and member function\n      explicit\n      binomial_distribution(_IntType __t = 1,\n\t\t\t    const _RealType& __p = _RealType(0.5))\n      : _M_t(__t), _M_p(__p), _M_nd()\n      {\n\t_GLIBCXX_DEBUG_ASSERT((_M_t >= 0) && (_M_p >= 0.0) && (_M_p <= 1.0));\n\t_M_initialize();\n      }\n\n      /**\n       * Gets the distribution @p t parameter.\n       */\n      _IntType\n      t() const\n      { return _M_t; }\n      \n      /**\n       * Gets the distribution @p p parameter.\n       */\n      _RealType\n      p() const\n      { return _M_p; }\n\n      void\n      reset()\n      { _M_nd.reset(); }\n\n      template<class _UniformRandomNumberGenerator>\n        result_type\n        operator()(_UniformRandomNumberGenerator& __urng);\n\n      /**\n       * Inserts a %binomial_distribution random number distribution\n       * @p __x into the output stream @p __os.\n       *\n       * @param __os An output stream.\n       * @param __x  A %binomial_distribution random number distribution.\n       *\n       * @returns The output stream with the state of @p __x inserted or in\n       * an error state.\n       */\n      template<typename _IntType1, typename _RealType1,\n\t       typename _CharT, typename _Traits>\n        friend std::basic_ostream<_CharT, _Traits>&\n        operator<<(std::basic_ostream<_CharT, _Traits>& __os,\n\t\t   const binomial_distribution<_IntType1, _RealType1>& __x);\n\n      /**\n       * Extracts a %binomial_distribution random number distribution\n       * @p __x from the input stream @p __is.\n       *\n       * @param __is An input stream.\n       * @param __x  A %binomial_distribution random number generator engine.\n       *\n       * @returns The input stream with @p __x extracted or in an error state.\n       */\n      template<typename _IntType1, typename _RealType1,\n\t       typename _CharT, typename _Traits>\n        friend std::basic_istream<_CharT, _Traits>&\n        operator>>(std::basic_istream<_CharT, _Traits>& __is,\n\t\t   binomial_distribution<_IntType1, _RealType1>& __x);\n\n    private:\n      void\n      _M_initialize();\n\n      template<class _UniformRandomNumberGenerator>\n        result_type\n        _M_waiting(_UniformRandomNumberGenerator& __urng, _IntType __t);\n\n      // NB: Unused when _GLIBCXX_USE_C99_MATH_TR1 is undefined.\n      normal_distribution<_RealType> _M_nd;\n\n      _RealType _M_q;\n#if _GLIBCXX_USE_C99_MATH_TR1\n      _RealType _M_d1, _M_d2, _M_s1, _M_s2, _M_c,\n\t        _M_a1, _M_a123, _M_s, _M_lf, _M_lp1p;\n#endif\n      _RealType _M_p;\n      _IntType  _M_t;\n\n      bool      _M_easy;\n    };\n\n  /* @} */ // group tr1_random_distributions_discrete\n\n  /**\n   * @addtogroup tr1_random_distributions_continuous Continuous Distributions\n   * @ingroup tr1_random_distributions\n   * @{\n   */\n\n  /**\n   * @brief Uniform continuous distribution for random numbers.\n   *\n   * A continuous random distribution on the range [min, max) with equal\n   * probability throughout the range.  The URNG should be real-valued and\n   * deliver number in the range [0, 1).\n   */\n  template<typename _RealType = double>\n    class uniform_real\n    {\n    public:\n      // types\n      typedef _RealType input_type;\n      typedef _RealType result_type;\n\n    public:\n      /**\n       * Constructs a uniform_real object.\n       *\n       * @param __min [IN]  The lower bound of the distribution.\n       * @param __max [IN]  The upper bound of the distribution.\n       */\n      explicit\n      uniform_real(_RealType __min = _RealType(0),\n\t\t   _RealType __max = _RealType(1))\n      : _M_min(__min), _M_max(__max)\n      {\n\t_GLIBCXX_DEBUG_ASSERT(_M_min <= _M_max);\n      }\n\n      result_type\n      min() const\n      { return _M_min; }\n\n      result_type\n      max() const\n      { return _M_max; }\n\n      void\n      reset() { }\n\n      template<class _UniformRandomNumberGenerator>\n        result_type\n        operator()(_UniformRandomNumberGenerator& __urng)\n        { return (__urng() * (_M_max - _M_min)) + _M_min; }\n\n      /**\n       * Inserts a %uniform_real random number distribution @p __x into the\n       * output stream @p __os.\n       *\n       * @param __os An output stream.\n       * @param __x  A %uniform_real random number distribution.\n       *\n       * @returns The output stream with the state of @p __x inserted or in\n       * an error state.\n       */\n      template<typename _RealType1, typename _CharT, typename _Traits>\n        friend std::basic_ostream<_CharT, _Traits>&\n        operator<<(std::basic_ostream<_CharT, _Traits>& __os,\n\t\t   const uniform_real<_RealType1>& __x);\n\n      /**\n       * Extracts a %unform_real random number distribution\n       * @p __x from the input stream @p __is.\n       *\n       * @param __is An input stream.\n       * @param __x  A %uniform_real random number generator engine.\n       *\n       * @returns The input stream with @p __x extracted or in an error state.\n       */\n      template<typename _RealType1, typename _CharT, typename _Traits>\n        friend std::basic_istream<_CharT, _Traits>&\n        operator>>(std::basic_istream<_CharT, _Traits>& __is,\n\t\t   uniform_real<_RealType1>& __x);\n\n    private:\n      _RealType _M_min;\n      _RealType _M_max;\n    };\n\n\n  /**\n   * @brief An exponential continuous distribution for random numbers.\n   *\n   * The formula for the exponential probability mass function is \n   * @f$ p(x) = \\lambda e^{-\\lambda x} @f$.\n   *\n   * <table border=1 cellpadding=10 cellspacing=0>\n   * <caption align=top>Distribution Statistics</caption>\n   * <tr><td>Mean</td><td>@f$ \\frac{1}{\\lambda} @f$</td></tr>\n   * <tr><td>Median</td><td>@f$ \\frac{\\ln 2}{\\lambda} @f$</td></tr>\n   * <tr><td>Mode</td><td>@f$ zero @f$</td></tr>\n   * <tr><td>Range</td><td>@f$[0, \\infty]@f$</td></tr>\n   * <tr><td>Standard Deviation</td><td>@f$ \\frac{1}{\\lambda} @f$</td></tr>\n   * </table>\n   */\n  template<typename _RealType = double>\n    class exponential_distribution\n    {\n    public:\n      // types\n      typedef _RealType input_type;\n      typedef _RealType result_type;\n\n    public:\n      /**\n       * Constructs an exponential distribution with inverse scale parameter\n       * @f$ \\lambda @f$.\n       */\n      explicit\n      exponential_distribution(const result_type& __lambda = result_type(1))\n      : _M_lambda(__lambda)\n      { \n\t_GLIBCXX_DEBUG_ASSERT(_M_lambda > 0);\n      }\n\n      /**\n       * Gets the inverse scale parameter of the distribution.\n       */\n      _RealType\n      lambda() const\n      { return _M_lambda; }\n\n      /**\n       * Resets the distribution.\n       *\n       * Has no effect on exponential distributions.\n       */\n      void\n      reset() { }\n\n      template<class _UniformRandomNumberGenerator>\n        result_type\n        operator()(_UniformRandomNumberGenerator& __urng)\n        { return -std::log(__urng()) / _M_lambda; }\n\n      /**\n       * Inserts a %exponential_distribution random number distribution\n       * @p __x into the output stream @p __os.\n       *\n       * @param __os An output stream.\n       * @param __x  A %exponential_distribution random number distribution.\n       *\n       * @returns The output stream with the state of @p __x inserted or in\n       * an error state.\n       */\n      template<typename _RealType1, typename _CharT, typename _Traits>\n        friend std::basic_ostream<_CharT, _Traits>&\n        operator<<(std::basic_ostream<_CharT, _Traits>& __os,\n\t\t   const exponential_distribution<_RealType1>& __x);\n\n      /**\n       * Extracts a %exponential_distribution random number distribution\n       * @p __x from the input stream @p __is.\n       *\n       * @param __is An input stream.\n       * @param __x A %exponential_distribution random number\n       *            generator engine.\n       *\n       * @returns The input stream with @p __x extracted or in an error state.\n       */\n      template<typename _CharT, typename _Traits>\n        friend std::basic_istream<_CharT, _Traits>&\n        operator>>(std::basic_istream<_CharT, _Traits>& __is,\n\t\t   exponential_distribution& __x)\n        { return __is >> __x._M_lambda; }\n\n    private:\n      result_type _M_lambda;\n    };\n\n\n  /**\n   * @brief A normal continuous distribution for random numbers.\n   *\n   * The formula for the normal probability mass function is \n   * @f$ p(x) = \\frac{1}{\\sigma \\sqrt{2 \\pi}} \n   *            e^{- \\frac{{x - mean}^ {2}}{2 \\sigma ^ {2}} } @f$.\n   */\n  template<typename _RealType = double>\n    class normal_distribution\n    {\n    public:\n      // types\n      typedef _RealType input_type;\n      typedef _RealType result_type;\n\n    public:\n      /**\n       * Constructs a normal distribution with parameters @f$ mean @f$ and\n       * @f$ \\sigma @f$.\n       */\n      explicit\n      normal_distribution(const result_type& __mean = result_type(0),\n\t\t\t  const result_type& __sigma = result_type(1))\n      : _M_mean(__mean), _M_sigma(__sigma), _M_saved_available(false)\n      { \n\t_GLIBCXX_DEBUG_ASSERT(_M_sigma > 0);\n      }\n\n      /**\n       * Gets the mean of the distribution.\n       */\n      _RealType\n      mean() const\n      { return _M_mean; }\n\n      /**\n       * Gets the @f$ \\sigma @f$ of the distribution.\n       */\n      _RealType\n      sigma() const\n      { return _M_sigma; }\n\n      /**\n       * Resets the distribution.\n       */\n      void\n      reset()\n      { _M_saved_available = false; }\n\n      template<class _UniformRandomNumberGenerator>\n        result_type\n        operator()(_UniformRandomNumberGenerator& __urng);\n\n      /**\n       * Inserts a %normal_distribution random number distribution\n       * @p __x into the output stream @p __os.\n       *\n       * @param __os An output stream.\n       * @param __x  A %normal_distribution random number distribution.\n       *\n       * @returns The output stream with the state of @p __x inserted or in\n       * an error state.\n       */\n      template<typename _RealType1, typename _CharT, typename _Traits>\n        friend std::basic_ostream<_CharT, _Traits>&\n        operator<<(std::basic_ostream<_CharT, _Traits>& __os,\n\t\t   const normal_distribution<_RealType1>& __x);\n\n      /**\n       * Extracts a %normal_distribution random number distribution\n       * @p __x from the input stream @p __is.\n       *\n       * @param __is An input stream.\n       * @param __x  A %normal_distribution random number generator engine.\n       *\n       * @returns The input stream with @p __x extracted or in an error state.\n       */\n      template<typename _RealType1, typename _CharT, typename _Traits>\n        friend std::basic_istream<_CharT, _Traits>&\n        operator>>(std::basic_istream<_CharT, _Traits>& __is,\n\t\t   normal_distribution<_RealType1>& __x);\n\n    private:\n      result_type _M_mean;\n      result_type _M_sigma;\n      result_type _M_saved;\n      bool        _M_saved_available;     \n    };\n\n\n  /**\n   * @brief A gamma continuous distribution for random numbers.\n   *\n   * The formula for the gamma probability mass function is \n   * @f$ p(x) = \\frac{1}{\\Gamma(\\alpha)} x^{\\alpha - 1} e^{-x} @f$.\n   */\n  template<typename _RealType = double>\n    class gamma_distribution\n    {\n    public:\n      // types\n      typedef _RealType input_type;\n      typedef _RealType result_type;\n\n    public:\n      /**\n       * Constructs a gamma distribution with parameters @f$ \\alpha @f$.\n       */\n      explicit\n      gamma_distribution(const result_type& __alpha_val = result_type(1))\n      : _M_alpha(__alpha_val)\n      { \n\t_GLIBCXX_DEBUG_ASSERT(_M_alpha > 0);\n\t_M_initialize();\n      }\n\n      /**\n       * Gets the @f$ \\alpha @f$ of the distribution.\n       */\n      _RealType\n      alpha() const\n      { return _M_alpha; }\n\n      /**\n       * Resets the distribution.\n       */\n      void\n      reset() { }\n\n      template<class _UniformRandomNumberGenerator>\n        result_type\n        operator()(_UniformRandomNumberGenerator& __urng);\n\n      /**\n       * Inserts a %gamma_distribution random number distribution\n       * @p __x into the output stream @p __os.\n       *\n       * @param __os An output stream.\n       * @param __x  A %gamma_distribution random number distribution.\n       *\n       * @returns The output stream with the state of @p __x inserted or in\n       * an error state.\n       */\n      template<typename _RealType1, typename _CharT, typename _Traits>\n        friend std::basic_ostream<_CharT, _Traits>&\n        operator<<(std::basic_ostream<_CharT, _Traits>& __os,\n\t\t   const gamma_distribution<_RealType1>& __x);\n\n      /**\n       * Extracts a %gamma_distribution random number distribution\n       * @p __x from the input stream @p __is.\n       *\n       * @param __is An input stream.\n       * @param __x  A %gamma_distribution random number generator engine.\n       *\n       * @returns The input stream with @p __x extracted or in an error state.\n       */\n      template<typename _CharT, typename _Traits>\n        friend std::basic_istream<_CharT, _Traits>&\n        operator>>(std::basic_istream<_CharT, _Traits>& __is,\n\t\t   gamma_distribution& __x)\n        {\n\t  __is >> __x._M_alpha;\n\t  __x._M_initialize();\n\t  return __is;\n\t}\n\n    private:\n      void\n      _M_initialize();\n\n      result_type _M_alpha;\n\n      // Hosts either lambda of GB or d of modified Vaduva's.\n      result_type _M_l_d;\n    };\n\n  /* @} */ // group tr1_random_distributions_continuous\n  /* @} */ // group tr1_random_distributions\n  /* @} */ // group tr1_random\n\n_GLIBCXX_END_NAMESPACE\n}\n\n#include <tr1/random.tcc>\n\n#endif // _TR1_RANDOM\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/tr1/random.tcc",
    "content": "// random number generation (out of line) -*- C++ -*-\n\n// Copyright (C) 2006, 2007 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n/** @file tr1/random.tcc\n *  This is a TR1 C++ Library header. \n */\n\nnamespace std\n{\n_GLIBCXX_BEGIN_NAMESPACE(tr1)\n\n  /*\n   * (Further) implementation-space details.\n   */\n  namespace __detail\n  {\n    // General case for x = (ax + c) mod m -- use Schrage's algorithm to avoid\n    // integer overflow.\n    //\n    // Because a and c are compile-time integral constants the compiler kindly\n    // elides any unreachable paths.\n    //\n    // Preconditions:  a > 0, m > 0.\n    //\n    template<typename _Tp, _Tp __a, _Tp __c, _Tp __m, bool>\n      struct _Mod\n      {\n\tstatic _Tp\n\t__calc(_Tp __x)\n\t{\n\t  if (__a == 1)\n\t    __x %= __m;\n\t  else\n\t    {\n\t      static const _Tp __q = __m / __a;\n\t      static const _Tp __r = __m % __a;\n\t      \n\t      _Tp __t1 = __a * (__x % __q);\n\t      _Tp __t2 = __r * (__x / __q);\n\t      if (__t1 >= __t2)\n\t\t__x = __t1 - __t2;\n\t      else\n\t\t__x = __m - __t2 + __t1;\n\t    }\n\n\t  if (__c != 0)\n\t    {\n\t      const _Tp __d = __m - __x;\n\t      if (__d > __c)\n\t\t__x += __c;\n\t      else\n\t\t__x = __c - __d;\n\t    }\n\t  return __x;\n\t}\n      };\n\n    // Special case for m == 0 -- use unsigned integer overflow as modulo\n    // operator.\n    template<typename _Tp, _Tp __a, _Tp __c, _Tp __m>\n      struct _Mod<_Tp, __a, __c, __m, true>\n      {\n\tstatic _Tp\n\t__calc(_Tp __x)\n\t{ return __a * __x + __c; }\n      };\n  } // namespace __detail\n\n  /**\n   * Seeds the LCR with integral value @p __x0, adjusted so that the \n   * ring identity is never a member of the convergence set.\n   */\n  template<class _UIntType, _UIntType __a, _UIntType __c, _UIntType __m>\n    void\n    linear_congruential<_UIntType, __a, __c, __m>::\n    seed(unsigned long __x0)\n    {\n      if ((__detail::__mod<_UIntType, 1, 0, __m>(__c) == 0)\n\t  && (__detail::__mod<_UIntType, 1, 0, __m>(__x0) == 0))\n\t_M_x = __detail::__mod<_UIntType, 1, 0, __m>(1);\n      else\n\t_M_x = __detail::__mod<_UIntType, 1, 0, __m>(__x0);\n    }\n\n  /**\n   * Seeds the LCR engine with a value generated by @p __g.\n   */\n  template<class _UIntType, _UIntType __a, _UIntType __c, _UIntType __m>\n    template<class _Gen>\n      void\n      linear_congruential<_UIntType, __a, __c, __m>::\n      seed(_Gen& __g, false_type)\n      {\n\t_UIntType __x0 = __g();\n\tif ((__detail::__mod<_UIntType, 1, 0, __m>(__c) == 0)\n\t    && (__detail::__mod<_UIntType, 1, 0, __m>(__x0) == 0))\n\t  _M_x = __detail::__mod<_UIntType, 1, 0, __m>(1);\n\telse\n\t  _M_x = __detail::__mod<_UIntType, 1, 0, __m>(__x0);\n      }\n\n  /**\n   * Gets the next generated value in sequence.\n   */\n  template<class _UIntType, _UIntType __a, _UIntType __c, _UIntType __m>\n    typename linear_congruential<_UIntType, __a, __c, __m>::result_type\n    linear_congruential<_UIntType, __a, __c, __m>::\n    operator()()\n    {\n      _M_x = __detail::__mod<_UIntType, __a, __c, __m>(_M_x);\n      return _M_x;\n    }\n\n  template<class _UIntType, _UIntType __a, _UIntType __c, _UIntType __m,\n\t   typename _CharT, typename _Traits>\n    std::basic_ostream<_CharT, _Traits>&\n    operator<<(std::basic_ostream<_CharT, _Traits>& __os,\n\t       const linear_congruential<_UIntType, __a, __c, __m>& __lcr)\n    {\n      typedef std::basic_ostream<_CharT, _Traits>  __ostream_type;\n      typedef typename __ostream_type::ios_base    __ios_base;\n\n      const typename __ios_base::fmtflags __flags = __os.flags();\n      const _CharT __fill = __os.fill();\n      __os.flags(__ios_base::dec | __ios_base::fixed | __ios_base::left);\n      __os.fill(__os.widen(' '));\n\n      __os << __lcr._M_x;\n\n      __os.flags(__flags);\n      __os.fill(__fill);\n      return __os;\n    }\n\n  template<class _UIntType, _UIntType __a, _UIntType __c, _UIntType __m,\n\t   typename _CharT, typename _Traits>\n    std::basic_istream<_CharT, _Traits>&\n    operator>>(std::basic_istream<_CharT, _Traits>& __is,\n\t       linear_congruential<_UIntType, __a, __c, __m>& __lcr)\n    {\n      typedef std::basic_istream<_CharT, _Traits>  __istream_type;\n      typedef typename __istream_type::ios_base    __ios_base;\n\n      const typename __ios_base::fmtflags __flags = __is.flags();\n      __is.flags(__ios_base::dec);\n\n      __is >> __lcr._M_x;\n\n      __is.flags(__flags);\n      return __is;\n    } \n\n\n  template<class _UIntType, int __w, int __n, int __m, int __r,\n\t   _UIntType __a, int __u, int __s,\n\t   _UIntType __b, int __t, _UIntType __c, int __l>\n    void\n    mersenne_twister<_UIntType, __w, __n, __m, __r, __a, __u, __s,\n\t\t     __b, __t, __c, __l>::\n    seed(unsigned long __value)\n    {\n      _M_x[0] = __detail::__mod<_UIntType, 1, 0,\n\t__detail::_Shift<_UIntType, __w>::__value>(__value);\n\n      for (int __i = 1; __i < state_size; ++__i)\n\t{\n\t  _UIntType __x = _M_x[__i - 1];\n\t  __x ^= __x >> (__w - 2);\n\t  __x *= 1812433253ul;\n\t  __x += __i;\n\t  _M_x[__i] = __detail::__mod<_UIntType, 1, 0,\n\t    __detail::_Shift<_UIntType, __w>::__value>(__x);\t  \n\t}\n      _M_p = state_size;\n    }\n\n  template<class _UIntType, int __w, int __n, int __m, int __r,\n\t   _UIntType __a, int __u, int __s,\n\t   _UIntType __b, int __t, _UIntType __c, int __l>\n    template<class _Gen>\n      void\n      mersenne_twister<_UIntType, __w, __n, __m, __r, __a, __u, __s,\n\t\t       __b, __t, __c, __l>::\n      seed(_Gen& __gen, false_type)\n      {\n\tfor (int __i = 0; __i < state_size; ++__i)\n\t  _M_x[__i] = __detail::__mod<_UIntType, 1, 0,\n\t    __detail::_Shift<_UIntType, __w>::__value>(__gen());\n\t_M_p = state_size;\n      }\n\n  template<class _UIntType, int __w, int __n, int __m, int __r,\n\t   _UIntType __a, int __u, int __s,\n\t   _UIntType __b, int __t, _UIntType __c, int __l>\n    typename\n    mersenne_twister<_UIntType, __w, __n, __m, __r, __a, __u, __s,\n\t\t     __b, __t, __c, __l>::result_type\n    mersenne_twister<_UIntType, __w, __n, __m, __r, __a, __u, __s,\n\t\t     __b, __t, __c, __l>::\n    operator()()\n    {\n      // Reload the vector - cost is O(n) amortized over n calls.\n      if (_M_p >= state_size)\n\t{\n\t  const _UIntType __upper_mask = (~_UIntType()) << __r;\n\t  const _UIntType __lower_mask = ~__upper_mask;\n\n\t  for (int __k = 0; __k < (__n - __m); ++__k)\n\t    {\n\t      _UIntType __y = ((_M_x[__k] & __upper_mask)\n\t\t\t       | (_M_x[__k + 1] & __lower_mask));\n\t      _M_x[__k] = (_M_x[__k + __m] ^ (__y >> 1)\n\t\t\t   ^ ((__y & 0x01) ? __a : 0));\n\t    }\n\n\t  for (int __k = (__n - __m); __k < (__n - 1); ++__k)\n\t    {\n\t      _UIntType __y = ((_M_x[__k] & __upper_mask)\n\t\t\t       | (_M_x[__k + 1] & __lower_mask));\n\t      _M_x[__k] = (_M_x[__k + (__m - __n)] ^ (__y >> 1)\n\t\t\t   ^ ((__y & 0x01) ? __a : 0));\n\t    }\n\n\t  _UIntType __y = ((_M_x[__n - 1] & __upper_mask)\n\t\t\t   | (_M_x[0] & __lower_mask));\n\t  _M_x[__n - 1] = (_M_x[__m - 1] ^ (__y >> 1)\n\t\t\t   ^ ((__y & 0x01) ? __a : 0));\n\t  _M_p = 0;\n\t}\n\n      // Calculate o(x(i)).\n      result_type __z = _M_x[_M_p++];\n      __z ^= (__z >> __u);\n      __z ^= (__z << __s) & __b;\n      __z ^= (__z << __t) & __c;\n      __z ^= (__z >> __l);\n\n      return __z;\n    }\n\n  template<class _UIntType, int __w, int __n, int __m, int __r,\n\t   _UIntType __a, int __u, int __s, _UIntType __b, int __t,\n\t   _UIntType __c, int __l,\n\t   typename _CharT, typename _Traits>\n    std::basic_ostream<_CharT, _Traits>&\n    operator<<(std::basic_ostream<_CharT, _Traits>& __os,\n\t       const mersenne_twister<_UIntType, __w, __n, __m,\n\t       __r, __a, __u, __s, __b, __t, __c, __l>& __x)\n    {\n      typedef std::basic_ostream<_CharT, _Traits>  __ostream_type;\n      typedef typename __ostream_type::ios_base    __ios_base;\n\n      const typename __ios_base::fmtflags __flags = __os.flags();\n      const _CharT __fill = __os.fill();\n      const _CharT __space = __os.widen(' ');\n      __os.flags(__ios_base::dec | __ios_base::fixed | __ios_base::left);\n      __os.fill(__space);\n\n      for (int __i = 0; __i < __n - 1; ++__i)\n\t__os << __x._M_x[__i] << __space;\n      __os << __x._M_x[__n - 1];\n\n      __os.flags(__flags);\n      __os.fill(__fill);\n      return __os;\n    }\n\n  template<class _UIntType, int __w, int __n, int __m, int __r,\n\t   _UIntType __a, int __u, int __s, _UIntType __b, int __t,\n\t   _UIntType __c, int __l,\n\t   typename _CharT, typename _Traits>\n    std::basic_istream<_CharT, _Traits>&\n    operator>>(std::basic_istream<_CharT, _Traits>& __is,\n\t       mersenne_twister<_UIntType, __w, __n, __m,\n\t       __r, __a, __u, __s, __b, __t, __c, __l>& __x)\n    {\n      typedef std::basic_istream<_CharT, _Traits>  __istream_type;\n      typedef typename __istream_type::ios_base    __ios_base;\n\n      const typename __ios_base::fmtflags __flags = __is.flags();\n      __is.flags(__ios_base::dec | __ios_base::skipws);\n\n      for (int __i = 0; __i < __n; ++__i)\n\t__is >> __x._M_x[__i];\n\n      __is.flags(__flags);\n      return __is;\n    }\n\n\n  template<typename _IntType, _IntType __m, int __s, int __r>\n    void\n    subtract_with_carry<_IntType, __m, __s, __r>::\n    seed(unsigned long __value)\n    {\n      if (__value == 0)\n\t__value = 19780503;\n\n      std::tr1::linear_congruential<unsigned long, 40014, 0, 2147483563>\n\t__lcg(__value);\n\n      for (int __i = 0; __i < long_lag; ++__i)\n\t_M_x[__i] = __detail::__mod<_UIntType, 1, 0, modulus>(__lcg());\n\n      _M_carry = (_M_x[long_lag - 1] == 0) ? 1 : 0;\n      _M_p = 0;\n    }\n\n  template<typename _IntType, _IntType __m, int __s, int __r>\n    template<class _Gen>\n      void\n      subtract_with_carry<_IntType, __m, __s, __r>::\n      seed(_Gen& __gen, false_type)\n      {\n\tconst int __n = (std::numeric_limits<_UIntType>::digits + 31) / 32;\n\n\tfor (int __i = 0; __i < long_lag; ++__i)\n\t  {\n\t    _UIntType __tmp = 0;\n\t    _UIntType __factor = 1;\n\t    for (int __j = 0; __j < __n; ++__j)\n\t      {\n\t\t__tmp += __detail::__mod<__detail::_UInt32Type, 1, 0, 0>\n\t\t         (__gen()) * __factor;\n\t\t__factor *= __detail::_Shift<_UIntType, 32>::__value;\n\t      }\n\t    _M_x[__i] = __detail::__mod<_UIntType, 1, 0, modulus>(__tmp);\n\t  }\n\t_M_carry = (_M_x[long_lag - 1] == 0) ? 1 : 0;\n\t_M_p = 0;\n      }\n\n  template<typename _IntType, _IntType __m, int __s, int __r>\n    typename subtract_with_carry<_IntType, __m, __s, __r>::result_type\n    subtract_with_carry<_IntType, __m, __s, __r>::\n    operator()()\n    {\n      // Derive short lag index from current index.\n      int __ps = _M_p - short_lag;\n      if (__ps < 0)\n\t__ps += long_lag;\n\n      // Calculate new x(i) without overflow or division.\n      // NB: Thanks to the requirements for _IntType, _M_x[_M_p] + _M_carry\n      // cannot overflow.\n      _UIntType __xi;\n      if (_M_x[__ps] >= _M_x[_M_p] + _M_carry)\n\t{\n\t  __xi = _M_x[__ps] - _M_x[_M_p] - _M_carry;\n\t  _M_carry = 0;\n\t}\n      else\n\t{\n\t  __xi = modulus - _M_x[_M_p] - _M_carry + _M_x[__ps];\n\t  _M_carry = 1;\n\t}\n      _M_x[_M_p] = __xi;\n\n      // Adjust current index to loop around in ring buffer.\n      if (++_M_p >= long_lag)\n\t_M_p = 0;\n\n      return __xi;\n    }\n\n  template<typename _IntType, _IntType __m, int __s, int __r,\n\t   typename _CharT, typename _Traits>\n    std::basic_ostream<_CharT, _Traits>&\n    operator<<(std::basic_ostream<_CharT, _Traits>& __os,\n\t       const subtract_with_carry<_IntType, __m, __s, __r>& __x)\n    {\n      typedef std::basic_ostream<_CharT, _Traits>  __ostream_type;\n      typedef typename __ostream_type::ios_base    __ios_base;\n\n      const typename __ios_base::fmtflags __flags = __os.flags();\n      const _CharT __fill = __os.fill();\n      const _CharT __space = __os.widen(' ');\n      __os.flags(__ios_base::dec | __ios_base::fixed | __ios_base::left);\n      __os.fill(__space);\n\n      for (int __i = 0; __i < __r; ++__i)\n\t__os << __x._M_x[__i] << __space;\n      __os << __x._M_carry;\n\n      __os.flags(__flags);\n      __os.fill(__fill);\n      return __os;\n    }\n\n  template<typename _IntType, _IntType __m, int __s, int __r,\n\t   typename _CharT, typename _Traits>\n    std::basic_istream<_CharT, _Traits>&\n    operator>>(std::basic_istream<_CharT, _Traits>& __is,\n\t       subtract_with_carry<_IntType, __m, __s, __r>& __x)\n    {\n      typedef std::basic_ostream<_CharT, _Traits>  __istream_type;\n      typedef typename __istream_type::ios_base    __ios_base;\n\n      const typename __ios_base::fmtflags __flags = __is.flags();\n      __is.flags(__ios_base::dec | __ios_base::skipws);\n\n      for (int __i = 0; __i < __r; ++__i)\n\t__is >> __x._M_x[__i];\n      __is >> __x._M_carry;\n\n      __is.flags(__flags);\n      return __is;\n    }\n\n\n  template<typename _RealType, int __w, int __s, int __r>\n    void\n    subtract_with_carry_01<_RealType, __w, __s, __r>::\n    _M_initialize_npows()\n    {\n      for (int __j = 0; __j < __n; ++__j)\n#if _GLIBCXX_USE_C99_MATH_TR1\n\t_M_npows[__j] = std::tr1::ldexp(_RealType(1), -__w + __j * 32);\n#else\n        _M_npows[__j] = std::pow(_RealType(2), -__w + __j * 32);\n#endif\n    }\n\n  template<typename _RealType, int __w, int __s, int __r>\n    void\n    subtract_with_carry_01<_RealType, __w, __s, __r>::\n    seed(unsigned long __value)\n    {\n      if (__value == 0)\n\t__value = 19780503;\n\n      // _GLIBCXX_RESOLVE_LIB_DEFECTS\n      // 512. Seeding subtract_with_carry_01 from a single unsigned long.\n      std::tr1::linear_congruential<unsigned long, 40014, 0, 2147483563>\n\t__lcg(__value);\n\n      this->seed(__lcg);\n    }\n\n  template<typename _RealType, int __w, int __s, int __r>\n    template<class _Gen>\n      void\n      subtract_with_carry_01<_RealType, __w, __s, __r>::\n      seed(_Gen& __gen, false_type)\n      {\n\tfor (int __i = 0; __i < long_lag; ++__i)\n\t  {\n\t    for (int __j = 0; __j < __n - 1; ++__j)\n\t      _M_x[__i][__j] = __detail::__mod<_UInt32Type, 1, 0, 0>(__gen());\n\t    _M_x[__i][__n - 1] = __detail::__mod<_UInt32Type, 1, 0,\n\t      __detail::_Shift<_UInt32Type, __w % 32>::__value>(__gen());\n\t  }\n\n\t_M_carry = 1;\n\tfor (int __j = 0; __j < __n; ++__j)\n\t  if (_M_x[long_lag - 1][__j] != 0)\n\t    {\n\t      _M_carry = 0;\n\t      break;\n\t    }\n\n\t_M_p = 0;\n      }\n\n  template<typename _RealType, int __w, int __s, int __r>\n    typename subtract_with_carry_01<_RealType, __w, __s, __r>::result_type\n    subtract_with_carry_01<_RealType, __w, __s, __r>::\n    operator()()\n    {\n      // Derive short lag index from current index.\n      int __ps = _M_p - short_lag;\n      if (__ps < 0)\n\t__ps += long_lag;\n\n      _UInt32Type __new_carry;\n      for (int __j = 0; __j < __n - 1; ++__j)\n\t{\n\t  if (_M_x[__ps][__j] > _M_x[_M_p][__j]\n\t      || (_M_x[__ps][__j] == _M_x[_M_p][__j] && _M_carry == 0))\n\t    __new_carry = 0;\n\t  else\n\t    __new_carry = 1;\n\n\t  _M_x[_M_p][__j] = _M_x[__ps][__j] - _M_x[_M_p][__j] - _M_carry;\n\t  _M_carry = __new_carry;\n\t}\n\n      if (_M_x[__ps][__n - 1] > _M_x[_M_p][__n - 1]\n\t  || (_M_x[__ps][__n - 1] == _M_x[_M_p][__n - 1] && _M_carry == 0))\n\t__new_carry = 0;\n      else\n\t__new_carry = 1;\n      \n      _M_x[_M_p][__n - 1] = __detail::__mod<_UInt32Type, 1, 0,\n\t__detail::_Shift<_UInt32Type, __w % 32>::__value>\n\t(_M_x[__ps][__n - 1] - _M_x[_M_p][__n - 1] - _M_carry);\n      _M_carry = __new_carry;\n\n      result_type __ret = 0.0;\n      for (int __j = 0; __j < __n; ++__j)\n\t__ret += _M_x[_M_p][__j] * _M_npows[__j];\n\n      // Adjust current index to loop around in ring buffer.\n      if (++_M_p >= long_lag)\n\t_M_p = 0;\n\n      return __ret;\n    }\n\n  template<typename _RealType, int __w, int __s, int __r,\n\t   typename _CharT, typename _Traits>\n    std::basic_ostream<_CharT, _Traits>&\n    operator<<(std::basic_ostream<_CharT, _Traits>& __os,\n\t       const subtract_with_carry_01<_RealType, __w, __s, __r>& __x)\n    {\n      typedef std::basic_ostream<_CharT, _Traits>  __ostream_type;\n      typedef typename __ostream_type::ios_base    __ios_base;\n\n      const typename __ios_base::fmtflags __flags = __os.flags();\n      const _CharT __fill = __os.fill();\n      const _CharT __space = __os.widen(' ');\n      __os.flags(__ios_base::dec | __ios_base::fixed | __ios_base::left);\n      __os.fill(__space);\n\n      for (int __i = 0; __i < __r; ++__i)\n\tfor (int __j = 0; __j < __x.__n; ++__j)\n\t  __os << __x._M_x[__i][__j] << __space;\n      __os << __x._M_carry;\n\n      __os.flags(__flags);\n      __os.fill(__fill);\n      return __os;\n    }\n\n  template<typename _RealType, int __w, int __s, int __r,\n\t   typename _CharT, typename _Traits>\n    std::basic_istream<_CharT, _Traits>&\n    operator>>(std::basic_istream<_CharT, _Traits>& __is,\n\t       subtract_with_carry_01<_RealType, __w, __s, __r>& __x)\n    {\n      typedef std::basic_istream<_CharT, _Traits>  __istream_type;\n      typedef typename __istream_type::ios_base    __ios_base;\n\n      const typename __ios_base::fmtflags __flags = __is.flags();\n      __is.flags(__ios_base::dec | __ios_base::skipws);\n\n      for (int __i = 0; __i < __r; ++__i)\n\tfor (int __j = 0; __j < __x.__n; ++__j)\n\t  __is >> __x._M_x[__i][__j];\n      __is >> __x._M_carry;\n\n      __is.flags(__flags);\n      return __is;\n    }\n\n\n  template<class _UniformRandomNumberGenerator, int __p, int __r>\n    typename discard_block<_UniformRandomNumberGenerator,\n\t\t\t   __p, __r>::result_type\n    discard_block<_UniformRandomNumberGenerator, __p, __r>::\n    operator()()\n    {\n      if (_M_n >= used_block)\n\t{\n\t  while (_M_n < block_size)\n\t    {\n\t      _M_b();\n\t      ++_M_n;\n\t    }\n\t  _M_n = 0;\n\t}\n      ++_M_n;\n      return _M_b();\n    }\n\n  template<class _UniformRandomNumberGenerator, int __p, int __r,\n\t   typename _CharT, typename _Traits>\n    std::basic_ostream<_CharT, _Traits>&\n    operator<<(std::basic_ostream<_CharT, _Traits>& __os,\n\t       const discard_block<_UniformRandomNumberGenerator,\n\t       __p, __r>& __x)\n    {\n      typedef std::basic_ostream<_CharT, _Traits>  __ostream_type;\n      typedef typename __ostream_type::ios_base    __ios_base;\n\n      const typename __ios_base::fmtflags __flags = __os.flags();\n      const _CharT __fill = __os.fill();\n      const _CharT __space = __os.widen(' ');\n      __os.flags(__ios_base::dec | __ios_base::fixed\n\t\t | __ios_base::left);\n      __os.fill(__space);\n\n      __os << __x._M_b << __space << __x._M_n;\n\n      __os.flags(__flags);\n      __os.fill(__fill);\n      return __os;\n    }\n\n  template<class _UniformRandomNumberGenerator, int __p, int __r,\n\t   typename _CharT, typename _Traits>\n    std::basic_istream<_CharT, _Traits>&\n    operator>>(std::basic_istream<_CharT, _Traits>& __is,\n\t       discard_block<_UniformRandomNumberGenerator, __p, __r>& __x)\n    {\n      typedef std::basic_istream<_CharT, _Traits>  __istream_type;\n      typedef typename __istream_type::ios_base    __ios_base;\n\n      const typename __ios_base::fmtflags __flags = __is.flags();\n      __is.flags(__ios_base::dec | __ios_base::skipws);\n\n      __is >> __x._M_b >> __x._M_n;\n\n      __is.flags(__flags);\n      return __is;\n    }\n\n\n  template<class _UniformRandomNumberGenerator1, int __s1,\n\t   class _UniformRandomNumberGenerator2, int __s2>\n    void\n    xor_combine<_UniformRandomNumberGenerator1, __s1,\n\t\t_UniformRandomNumberGenerator2, __s2>::\n    _M_initialize_max()\n    {\n      const int __w = std::numeric_limits<result_type>::digits;\n\n      const result_type __m1 =\n\tstd::min(result_type(_M_b1.max() - _M_b1.min()),\n\t\t __detail::_Shift<result_type, __w - __s1>::__value - 1);\n\n      const result_type __m2 =\n\tstd::min(result_type(_M_b2.max() - _M_b2.min()),\n\t\t __detail::_Shift<result_type, __w - __s2>::__value - 1);\n\n      // NB: In TR1 s1 is not required to be >= s2.\n      if (__s1 < __s2)\n\t_M_max = _M_initialize_max_aux(__m2, __m1, __s2 - __s1) << __s1;\n      else\n\t_M_max = _M_initialize_max_aux(__m1, __m2, __s1 - __s2) << __s2;\n    }\n\n  template<class _UniformRandomNumberGenerator1, int __s1,\n\t   class _UniformRandomNumberGenerator2, int __s2>\n    typename xor_combine<_UniformRandomNumberGenerator1, __s1,\n\t\t\t _UniformRandomNumberGenerator2, __s2>::result_type\n    xor_combine<_UniformRandomNumberGenerator1, __s1,\n\t\t_UniformRandomNumberGenerator2, __s2>::\n    _M_initialize_max_aux(result_type __a, result_type __b, int __d)\n    {\n      const result_type __two2d = result_type(1) << __d;\n      const result_type __c = __a * __two2d;\n\n      if (__a == 0 || __b < __two2d)\n\treturn __c + __b;\n\n      const result_type __t = std::max(__c, __b);\n      const result_type __u = std::min(__c, __b);\n\n      result_type __ub = __u;\n      result_type __p;\n      for (__p = 0; __ub != 1; __ub >>= 1)\n\t++__p;\n\n      const result_type __two2p = result_type(1) << __p;\n      const result_type __k = __t / __two2p;\n\n      if (__k & 1)\n\treturn (__k + 1) * __two2p - 1;\n\n      if (__c >= __b)\n\treturn (__k + 1) * __two2p + _M_initialize_max_aux((__t % __two2p)\n\t\t\t\t\t\t\t   / __two2d,\n\t\t\t\t\t\t\t   __u % __two2p, __d);\n      else\n\treturn (__k + 1) * __two2p + _M_initialize_max_aux((__u % __two2p)\n\t\t\t\t\t\t\t   / __two2d,\n\t\t\t\t\t\t\t   __t % __two2p, __d);\n    }\n\n  template<class _UniformRandomNumberGenerator1, int __s1,\n\t   class _UniformRandomNumberGenerator2, int __s2,\n\t   typename _CharT, typename _Traits>\n    std::basic_ostream<_CharT, _Traits>&\n    operator<<(std::basic_ostream<_CharT, _Traits>& __os,\n\t       const xor_combine<_UniformRandomNumberGenerator1, __s1,\n\t       _UniformRandomNumberGenerator2, __s2>& __x)\n    {\n      typedef std::basic_ostream<_CharT, _Traits>  __ostream_type;\n      typedef typename __ostream_type::ios_base    __ios_base;\n\n      const typename __ios_base::fmtflags __flags = __os.flags();\n      const _CharT __fill = __os.fill();\n      const _CharT __space = __os.widen(' ');\n      __os.flags(__ios_base::dec | __ios_base::fixed | __ios_base::left);\n      __os.fill(__space);\n\n      __os << __x.base1() << __space << __x.base2();\n\n      __os.flags(__flags);\n      __os.fill(__fill);\n      return __os; \n    }\n\n  template<class _UniformRandomNumberGenerator1, int __s1,\n\t   class _UniformRandomNumberGenerator2, int __s2,\n\t   typename _CharT, typename _Traits>\n    std::basic_istream<_CharT, _Traits>&\n    operator>>(std::basic_istream<_CharT, _Traits>& __is,\n\t       xor_combine<_UniformRandomNumberGenerator1, __s1,\n\t       _UniformRandomNumberGenerator2, __s2>& __x)\n    {\n      typedef std::basic_istream<_CharT, _Traits>  __istream_type;\n      typedef typename __istream_type::ios_base    __ios_base;\n\n      const typename __ios_base::fmtflags __flags = __is.flags();\n      __is.flags(__ios_base::skipws);\n\n      __is >> __x._M_b1 >> __x._M_b2;\n\n      __is.flags(__flags);\n      return __is;\n    }\n\n\n  template<typename _IntType, typename _CharT, typename _Traits>\n    std::basic_ostream<_CharT, _Traits>&\n    operator<<(std::basic_ostream<_CharT, _Traits>& __os,\n\t       const uniform_int<_IntType>& __x)\n    {\n      typedef std::basic_ostream<_CharT, _Traits>  __ostream_type;\n      typedef typename __ostream_type::ios_base    __ios_base;\n\n      const typename __ios_base::fmtflags __flags = __os.flags();\n      const _CharT __fill = __os.fill();\n      const _CharT __space = __os.widen(' ');\n      __os.flags(__ios_base::scientific | __ios_base::left);\n      __os.fill(__space);\n\n      __os << __x.min() << __space << __x.max();\n\n      __os.flags(__flags);\n      __os.fill(__fill);\n      return __os;\n    }\n\n  template<typename _IntType, typename _CharT, typename _Traits>\n    std::basic_istream<_CharT, _Traits>&\n    operator>>(std::basic_istream<_CharT, _Traits>& __is,\n\t       uniform_int<_IntType>& __x)\n    {\n      typedef std::basic_istream<_CharT, _Traits>  __istream_type;\n      typedef typename __istream_type::ios_base    __ios_base;\n\n      const typename __ios_base::fmtflags __flags = __is.flags();\n      __is.flags(__ios_base::dec | __ios_base::skipws);\n\n      __is >> __x._M_min >> __x._M_max;\n\n      __is.flags(__flags);\n      return __is;\n    }\n\n  \n  template<typename _CharT, typename _Traits>\n    std::basic_ostream<_CharT, _Traits>&\n    operator<<(std::basic_ostream<_CharT, _Traits>& __os,\n\t       const bernoulli_distribution& __x)\n    {\n      typedef std::basic_ostream<_CharT, _Traits>  __ostream_type;\n      typedef typename __ostream_type::ios_base    __ios_base;\n\n      const typename __ios_base::fmtflags __flags = __os.flags();\n      const _CharT __fill = __os.fill();\n      const std::streamsize __precision = __os.precision();\n      __os.flags(__ios_base::scientific | __ios_base::left);\n      __os.fill(__os.widen(' '));\n      __os.precision(__gnu_cxx::__numeric_traits<double>::__max_digits10);\n\n      __os << __x.p();\n\n      __os.flags(__flags);\n      __os.fill(__fill);\n      __os.precision(__precision);\n      return __os;\n    }\n\n\n  template<typename _IntType, typename _RealType>\n    template<class _UniformRandomNumberGenerator>\n      typename geometric_distribution<_IntType, _RealType>::result_type\n      geometric_distribution<_IntType, _RealType>::\n      operator()(_UniformRandomNumberGenerator& __urng)\n      {\n\t// About the epsilon thing see this thread:\n        // http://gcc.gnu.org/ml/gcc-patches/2006-10/msg00971.html\n\tconst _RealType __naf =\n\t  (1 - std::numeric_limits<_RealType>::epsilon()) / 2;\n\t// The largest _RealType convertible to _IntType.\n\tconst _RealType __thr =\n\t  std::numeric_limits<_IntType>::max() + __naf;\n\n\t_RealType __cand;\n\tdo\n\t  __cand = std::ceil(std::log(__urng()) / _M_log_p);\n\twhile (__cand >= __thr);\n\n\treturn result_type(__cand + __naf);\n      }\n\n  template<typename _IntType, typename _RealType,\n\t   typename _CharT, typename _Traits>\n    std::basic_ostream<_CharT, _Traits>&\n    operator<<(std::basic_ostream<_CharT, _Traits>& __os,\n\t       const geometric_distribution<_IntType, _RealType>& __x)\n    {\n      typedef std::basic_ostream<_CharT, _Traits>  __ostream_type;\n      typedef typename __ostream_type::ios_base    __ios_base;\n\n      const typename __ios_base::fmtflags __flags = __os.flags();\n      const _CharT __fill = __os.fill();\n      const std::streamsize __precision = __os.precision();\n      __os.flags(__ios_base::scientific | __ios_base::left);\n      __os.fill(__os.widen(' '));\n      __os.precision(__gnu_cxx::__numeric_traits<_RealType>::__max_digits10);\n\n      __os << __x.p();\n\n      __os.flags(__flags);\n      __os.fill(__fill);\n      __os.precision(__precision);\n      return __os;\n    }\n\n\n  template<typename _IntType, typename _RealType>\n    void\n    poisson_distribution<_IntType, _RealType>::\n    _M_initialize()\n    {\n#if _GLIBCXX_USE_C99_MATH_TR1\n      if (_M_mean >= 12)\n\t{\n\t  const _RealType __m = std::floor(_M_mean);\n\t  _M_lm_thr = std::log(_M_mean);\n\t  _M_lfm = std::tr1::lgamma(__m + 1);\n\t  _M_sm = std::sqrt(__m);\n\n\t  const _RealType __pi_4 = 0.7853981633974483096156608458198757L;\n\t  const _RealType __dx = std::sqrt(2 * __m * std::log(32 * __m\n\t\t\t\t\t\t\t      / __pi_4));\n\t  _M_d = std::tr1::round(std::max(_RealType(6),\n\t\t\t\t\t  std::min(__m, __dx)));\n\t  const _RealType __cx = 2 * __m + _M_d;\n\t  _M_scx = std::sqrt(__cx / 2);\n\t  _M_1cx = 1 / __cx;\n\n\t  _M_c2b = std::sqrt(__pi_4 * __cx) * std::exp(_M_1cx);\n\t  _M_cb = 2 * __cx * std::exp(-_M_d * _M_1cx * (1 + _M_d / 2)) / _M_d;\n\t}\n      else\n#endif\n\t_M_lm_thr = std::exp(-_M_mean);\n      }\n\n  /**\n   * A rejection algorithm when mean >= 12 and a simple method based\n   * upon the multiplication of uniform random variates otherwise.\n   * NB: The former is available only if _GLIBCXX_USE_C99_MATH_TR1\n   * is defined.\n   *\n   * Reference:\n   * Devroye, L. \"Non-Uniform Random Variates Generation.\" Springer-Verlag,\n   * New York, 1986, Ch. X, Sects. 3.3 & 3.4 (+ Errata!).\n   */\n  template<typename _IntType, typename _RealType>\n    template<class _UniformRandomNumberGenerator>\n      typename poisson_distribution<_IntType, _RealType>::result_type\n      poisson_distribution<_IntType, _RealType>::\n      operator()(_UniformRandomNumberGenerator& __urng)\n      {\n#if _GLIBCXX_USE_C99_MATH_TR1\n\tif (_M_mean >= 12)\n\t  {\n\t    _RealType __x;\n\n\t    // See comments above...\n\t    const _RealType __naf =\n\t      (1 - std::numeric_limits<_RealType>::epsilon()) / 2;\n\t    const _RealType __thr =\n\t      std::numeric_limits<_IntType>::max() + __naf;\n\n\t    const _RealType __m = std::floor(_M_mean);\n\t    // sqrt(pi / 2)\n\t    const _RealType __spi_2 = 1.2533141373155002512078826424055226L;\n\t    const _RealType __c1 = _M_sm * __spi_2;\n\t    const _RealType __c2 = _M_c2b + __c1; \n\t    const _RealType __c3 = __c2 + 1;\n\t    const _RealType __c4 = __c3 + 1;\n\t    // e^(1 / 78)\n\t    const _RealType __e178 = 1.0129030479320018583185514777512983L;\n\t    const _RealType __c5 = __c4 + __e178;\n\t    const _RealType __c = _M_cb + __c5;\n\t    const _RealType __2cx = 2 * (2 * __m + _M_d);\n\n\t    bool __reject = true;\n\t    do\n\t      {\n\t\tconst _RealType __u = __c * __urng();\n\t\tconst _RealType __e = -std::log(__urng());\n\n\t\t_RealType __w = 0.0;\n\t\t\n\t\tif (__u <= __c1)\n\t\t  {\n\t\t    const _RealType __n = _M_nd(__urng);\n\t\t    const _RealType __y = -std::abs(__n) * _M_sm - 1;\n\t\t    __x = std::floor(__y);\n\t\t    __w = -__n * __n / 2;\n\t\t    if (__x < -__m)\n\t\t      continue;\n\t\t  }\n\t\telse if (__u <= __c2)\n\t\t  {\n\t\t    const _RealType __n = _M_nd(__urng);\n\t\t    const _RealType __y = 1 + std::abs(__n) * _M_scx;\n\t\t    __x = std::ceil(__y);\n\t\t    __w = __y * (2 - __y) * _M_1cx;\n\t\t    if (__x > _M_d)\n\t\t      continue;\n\t\t  }\n\t\telse if (__u <= __c3)\n\t\t  // NB: This case not in the book, nor in the Errata,\n\t\t  // but should be ok...\n\t\t  __x = -1;\n\t\telse if (__u <= __c4)\n\t\t  __x = 0;\n\t\telse if (__u <= __c5)\n\t\t  __x = 1;\n\t\telse\n\t\t  {\n\t\t    const _RealType __v = -std::log(__urng());\n\t\t    const _RealType __y = _M_d + __v * __2cx / _M_d;\n\t\t    __x = std::ceil(__y);\n\t\t    __w = -_M_d * _M_1cx * (1 + __y / 2);\n\t\t  }\n\n\t\t__reject = (__w - __e - __x * _M_lm_thr\n\t\t\t    > _M_lfm - std::tr1::lgamma(__x + __m + 1));\n\n\t\t__reject |= __x + __m >= __thr;\n\n\t      } while (__reject);\n\n\t    return result_type(__x + __m + __naf);\n\t  }\n\telse\n#endif\n\t  {\n\t    _IntType     __x = 0;\n\t    _RealType __prod = 1.0;\n\n\t    do\n\t      {\n\t\t__prod *= __urng();\n\t\t__x += 1;\n\t      }\n\t    while (__prod > _M_lm_thr);\n\n\t    return __x - 1;\n\t  }\n      }\n\n  template<typename _IntType, typename _RealType,\n\t   typename _CharT, typename _Traits>\n    std::basic_ostream<_CharT, _Traits>&\n    operator<<(std::basic_ostream<_CharT, _Traits>& __os,\n\t       const poisson_distribution<_IntType, _RealType>& __x)\n    {\n      typedef std::basic_ostream<_CharT, _Traits>  __ostream_type;\n      typedef typename __ostream_type::ios_base    __ios_base;\n\n      const typename __ios_base::fmtflags __flags = __os.flags();\n      const _CharT __fill = __os.fill();\n      const std::streamsize __precision = __os.precision();\n      const _CharT __space = __os.widen(' ');\n      __os.flags(__ios_base::scientific | __ios_base::left);\n      __os.fill(__space);\n      __os.precision(__gnu_cxx::__numeric_traits<_RealType>::__max_digits10);\n\n      __os << __x.mean() << __space << __x._M_nd;\n\n      __os.flags(__flags);\n      __os.fill(__fill);\n      __os.precision(__precision);\n      return __os;\n    }\n\n  template<typename _IntType, typename _RealType,\n\t   typename _CharT, typename _Traits>\n    std::basic_istream<_CharT, _Traits>&\n    operator>>(std::basic_istream<_CharT, _Traits>& __is,\n\t       poisson_distribution<_IntType, _RealType>& __x)\n    {\n      typedef std::basic_istream<_CharT, _Traits>  __istream_type;\n      typedef typename __istream_type::ios_base    __ios_base;\n\n      const typename __ios_base::fmtflags __flags = __is.flags();\n      __is.flags(__ios_base::skipws);\n\n      __is >> __x._M_mean >> __x._M_nd;\n      __x._M_initialize();\n\n      __is.flags(__flags);\n      return __is;\n    }\n\n\n  template<typename _IntType, typename _RealType>\n    void\n    binomial_distribution<_IntType, _RealType>::\n    _M_initialize()\n    {\n      const _RealType __p12 = _M_p <= 0.5 ? _M_p : 1.0 - _M_p;\n\n      _M_easy = true;\n\n#if _GLIBCXX_USE_C99_MATH_TR1\n      if (_M_t * __p12 >= 8)\n\t{\n\t  _M_easy = false;\n\t  const _RealType __np = std::floor(_M_t * __p12);\n\t  const _RealType __pa = __np / _M_t;\n\t  const _RealType __1p = 1 - __pa;\n\t  \n\t  const _RealType __pi_4 = 0.7853981633974483096156608458198757L;\n\t  const _RealType __d1x =\n\t    std::sqrt(__np * __1p * std::log(32 * __np\n\t\t\t\t\t     / (81 * __pi_4 * __1p)));\n\t  _M_d1 = std::tr1::round(std::max(_RealType(1), __d1x));\n\t  const _RealType __d2x =\n\t    std::sqrt(__np * __1p * std::log(32 * _M_t * __1p\n\t\t\t\t\t     / (__pi_4 * __pa)));\n\t  _M_d2 = std::tr1::round(std::max(_RealType(1), __d2x));\n\t  \n\t  // sqrt(pi / 2)\n\t  const _RealType __spi_2 = 1.2533141373155002512078826424055226L;\n\t  _M_s1 = std::sqrt(__np * __1p) * (1 + _M_d1 / (4 * __np));\n\t  _M_s2 = std::sqrt(__np * __1p) * (1 + _M_d2 / (4 * _M_t * __1p));\n\t  _M_c = 2 * _M_d1 / __np;\n\t  _M_a1 = std::exp(_M_c) * _M_s1 * __spi_2;\n\t  const _RealType __a12 = _M_a1 + _M_s2 * __spi_2;\n\t  const _RealType __s1s = _M_s1 * _M_s1;\n\t  _M_a123 = __a12 + (std::exp(_M_d1 / (_M_t * __1p))\n\t\t\t     * 2 * __s1s / _M_d1\n\t\t\t     * std::exp(-_M_d1 * _M_d1 / (2 * __s1s)));\n\t  const _RealType __s2s = _M_s2 * _M_s2;\n\t  _M_s = (_M_a123 + 2 * __s2s / _M_d2\n\t\t  * std::exp(-_M_d2 * _M_d2 / (2 * __s2s)));\n\t  _M_lf = (std::tr1::lgamma(__np + 1)\n\t\t   + std::tr1::lgamma(_M_t - __np + 1));\n\t  _M_lp1p = std::log(__pa / __1p);\n\n\t  _M_q = -std::log(1 - (__p12 - __pa) / __1p);\n\t}\n      else\n#endif\n\t_M_q = -std::log(1 - __p12);\n    }\n\n  template<typename _IntType, typename _RealType>\n    template<class _UniformRandomNumberGenerator>\n      typename binomial_distribution<_IntType, _RealType>::result_type\n      binomial_distribution<_IntType, _RealType>::\n      _M_waiting(_UniformRandomNumberGenerator& __urng, _IntType __t)\n      {\n\t_IntType    __x = 0;\n\t_RealType __sum = 0;\n\n\tdo\n\t  {\n\t    const _RealType __e = -std::log(__urng());\n\t    __sum += __e / (__t - __x);\n\t    __x += 1;\n\t  }\n\twhile (__sum <= _M_q);\n\n\treturn __x - 1;\n      }\n\n  /**\n   * A rejection algorithm when t * p >= 8 and a simple waiting time\n   * method - the second in the referenced book - otherwise.\n   * NB: The former is available only if _GLIBCXX_USE_C99_MATH_TR1\n   * is defined.\n   *\n   * Reference:\n   * Devroye, L. \"Non-Uniform Random Variates Generation.\" Springer-Verlag,\n   * New York, 1986, Ch. X, Sect. 4 (+ Errata!).\n   */\n  template<typename _IntType, typename _RealType>\n    template<class _UniformRandomNumberGenerator>\n      typename binomial_distribution<_IntType, _RealType>::result_type\n      binomial_distribution<_IntType, _RealType>::\n      operator()(_UniformRandomNumberGenerator& __urng)\n      {\n\tresult_type __ret;\n\tconst _RealType __p12 = _M_p <= 0.5 ? _M_p : 1.0 - _M_p;\n\n#if _GLIBCXX_USE_C99_MATH_TR1\n\tif (!_M_easy)\n\t  {\n\t    _RealType __x;\n\n\t    // See comments above...\n\t    const _RealType __naf =\n\t      (1 - std::numeric_limits<_RealType>::epsilon()) / 2;\n\t    const _RealType __thr =\n\t      std::numeric_limits<_IntType>::max() + __naf;\n\n\t    const _RealType __np = std::floor(_M_t * __p12);\n\t    const _RealType __pa = __np / _M_t;\n\n\t    // sqrt(pi / 2)\n\t    const _RealType __spi_2 = 1.2533141373155002512078826424055226L;\n\t    const _RealType __a1 = _M_a1;\n\t    const _RealType __a12 = __a1 + _M_s2 * __spi_2;\n\t    const _RealType __a123 = _M_a123;\n\t    const _RealType __s1s = _M_s1 * _M_s1;\n\t    const _RealType __s2s = _M_s2 * _M_s2;\n\n\t    bool __reject;\n\t    do\n\t      {\n\t\tconst _RealType __u = _M_s * __urng();\n\n\t\t_RealType __v;\n\n\t\tif (__u <= __a1)\n\t\t  {\n\t\t    const _RealType __n = _M_nd(__urng);\n\t\t    const _RealType __y = _M_s1 * std::abs(__n);\n\t\t    __reject = __y >= _M_d1;\n\t\t    if (!__reject)\n\t\t      {\n\t\t\tconst _RealType __e = -std::log(__urng());\n\t\t\t__x = std::floor(__y);\n\t\t\t__v = -__e - __n * __n / 2 + _M_c;\n\t\t      }\n\t\t  }\n\t\telse if (__u <= __a12)\n\t\t  {\n\t\t    const _RealType __n = _M_nd(__urng);\n\t\t    const _RealType __y = _M_s2 * std::abs(__n);\n\t\t    __reject = __y >= _M_d2;\n\t\t    if (!__reject)\n\t\t      {\n\t\t\tconst _RealType __e = -std::log(__urng());\n\t\t\t__x = std::floor(-__y);\n\t\t\t__v = -__e - __n * __n / 2;\n\t\t      }\n\t\t  }\n\t\telse if (__u <= __a123)\n\t\t  {\n\t\t    const _RealType __e1 = -std::log(__urng());\t\t    \n\t\t    const _RealType __e2 = -std::log(__urng());\n\n\t\t    const _RealType __y = _M_d1 + 2 * __s1s * __e1 / _M_d1;\n\t\t    __x = std::floor(__y);\n\t\t    __v = (-__e2 + _M_d1 * (1 / (_M_t - __np)\n\t\t\t\t\t    -__y / (2 * __s1s)));\n\t\t    __reject = false;\n\t\t  }\n\t\telse\n\t\t  {\n\t\t    const _RealType __e1 = -std::log(__urng());\t\t    \n\t\t    const _RealType __e2 = -std::log(__urng());\n\n\t\t    const _RealType __y = _M_d2 + 2 * __s2s * __e1 / _M_d2;\n\t\t    __x = std::floor(-__y);\n\t\t    __v = -__e2 - _M_d2 * __y / (2 * __s2s);\n\t\t    __reject = false;\n\t\t  }\n\n\t\t__reject = __reject || __x < -__np || __x > _M_t - __np;\n\t\tif (!__reject)\n\t\t  {\n\t\t    const _RealType __lfx =\n\t\t      std::tr1::lgamma(__np + __x + 1)\n\t\t      + std::tr1::lgamma(_M_t - (__np + __x) + 1);\n\t\t    __reject = __v > _M_lf - __lfx + __x * _M_lp1p;\n\t\t  }\n\n\t\t__reject |= __x + __np >= __thr;\n\t      }\n\t    while (__reject);\n\n\t    __x += __np + __naf;\n\n\t    const _IntType __z = _M_waiting(__urng, _M_t - _IntType(__x)); \n\t    __ret = _IntType(__x) + __z;\n\t  }\n\telse\n#endif\n\t  __ret = _M_waiting(__urng, _M_t);\n\n\tif (__p12 != _M_p)\n\t  __ret = _M_t - __ret;\n\treturn __ret;\n      }\n\n  template<typename _IntType, typename _RealType,\n\t   typename _CharT, typename _Traits>\n    std::basic_ostream<_CharT, _Traits>&\n    operator<<(std::basic_ostream<_CharT, _Traits>& __os,\n\t       const binomial_distribution<_IntType, _RealType>& __x)\n    {\n      typedef std::basic_ostream<_CharT, _Traits>  __ostream_type;\n      typedef typename __ostream_type::ios_base    __ios_base;\n\n      const typename __ios_base::fmtflags __flags = __os.flags();\n      const _CharT __fill = __os.fill();\n      const std::streamsize __precision = __os.precision();\n      const _CharT __space = __os.widen(' ');\n      __os.flags(__ios_base::scientific | __ios_base::left);\n      __os.fill(__space);\n      __os.precision(__gnu_cxx::__numeric_traits<_RealType>::__max_digits10);\n\n      __os << __x.t() << __space << __x.p() \n\t   << __space << __x._M_nd;\n\n      __os.flags(__flags);\n      __os.fill(__fill);\n      __os.precision(__precision);\n      return __os;\n    }\n\n  template<typename _IntType, typename _RealType,\n\t   typename _CharT, typename _Traits>\n    std::basic_istream<_CharT, _Traits>&\n    operator>>(std::basic_istream<_CharT, _Traits>& __is,\n\t       binomial_distribution<_IntType, _RealType>& __x)\n    {\n      typedef std::basic_istream<_CharT, _Traits>  __istream_type;\n      typedef typename __istream_type::ios_base    __ios_base;\n\n      const typename __ios_base::fmtflags __flags = __is.flags();\n      __is.flags(__ios_base::dec | __ios_base::skipws);\n\n      __is >> __x._M_t >> __x._M_p >> __x._M_nd;\n      __x._M_initialize();\n\n      __is.flags(__flags);\n      return __is;\n    }\n\n\n  template<typename _RealType, typename _CharT, typename _Traits>\n    std::basic_ostream<_CharT, _Traits>&\n    operator<<(std::basic_ostream<_CharT, _Traits>& __os,\n\t       const uniform_real<_RealType>& __x)\n    {\n      typedef std::basic_ostream<_CharT, _Traits>  __ostream_type;\n      typedef typename __ostream_type::ios_base    __ios_base;\n\n      const typename __ios_base::fmtflags __flags = __os.flags();\n      const _CharT __fill = __os.fill();\n      const std::streamsize __precision = __os.precision();\n      const _CharT __space = __os.widen(' ');\n      __os.flags(__ios_base::scientific | __ios_base::left);\n      __os.fill(__space);\n      __os.precision(__gnu_cxx::__numeric_traits<_RealType>::__max_digits10);\n\n      __os << __x.min() << __space << __x.max();\n\n      __os.flags(__flags);\n      __os.fill(__fill);\n      __os.precision(__precision);\n      return __os;\n    }\n\n  template<typename _RealType, typename _CharT, typename _Traits>\n    std::basic_istream<_CharT, _Traits>&\n    operator>>(std::basic_istream<_CharT, _Traits>& __is,\n\t       uniform_real<_RealType>& __x)\n    {\n      typedef std::basic_istream<_CharT, _Traits>  __istream_type;\n      typedef typename __istream_type::ios_base    __ios_base;\n\n      const typename __ios_base::fmtflags __flags = __is.flags();\n      __is.flags(__ios_base::skipws);\n\n      __is >> __x._M_min >> __x._M_max;\n\n      __is.flags(__flags);\n      return __is;\n    }\n\n\n  template<typename _RealType, typename _CharT, typename _Traits>\n    std::basic_ostream<_CharT, _Traits>&\n    operator<<(std::basic_ostream<_CharT, _Traits>& __os,\n\t       const exponential_distribution<_RealType>& __x)\n    {\n      typedef std::basic_ostream<_CharT, _Traits>  __ostream_type;\n      typedef typename __ostream_type::ios_base    __ios_base;\n\n      const typename __ios_base::fmtflags __flags = __os.flags();\n      const _CharT __fill = __os.fill();\n      const std::streamsize __precision = __os.precision();\n      __os.flags(__ios_base::scientific | __ios_base::left);\n      __os.fill(__os.widen(' '));\n      __os.precision(__gnu_cxx::__numeric_traits<_RealType>::__max_digits10);\n\n      __os << __x.lambda();\n\n      __os.flags(__flags);\n      __os.fill(__fill);\n      __os.precision(__precision);\n      return __os;\n    }\n\n\n  /**\n   * Polar method due to Marsaglia.\n   *\n   * Devroye, L. \"Non-Uniform Random Variates Generation.\" Springer-Verlag,\n   * New York, 1986, Ch. V, Sect. 4.4.\n   */\n  template<typename _RealType>\n    template<class _UniformRandomNumberGenerator>\n      typename normal_distribution<_RealType>::result_type\n      normal_distribution<_RealType>::\n      operator()(_UniformRandomNumberGenerator& __urng)\n      {\n\tresult_type __ret;\n\n\tif (_M_saved_available)\n\t  {\n\t    _M_saved_available = false;\n\t    __ret = _M_saved;\n\t  }\n\telse\n\t  {\n\t    result_type __x, __y, __r2;\n\t    do\n\t      {\n\t\t__x = result_type(2.0) * __urng() - 1.0;\n\t\t__y = result_type(2.0) * __urng() - 1.0;\n\t\t__r2 = __x * __x + __y * __y;\n\t      }\n\t    while (__r2 > 1.0 || __r2 == 0.0);\n\n\t    const result_type __mult = std::sqrt(-2 * std::log(__r2) / __r2);\n\t    _M_saved = __x * __mult;\n\t    _M_saved_available = true;\n\t    __ret = __y * __mult;\n\t  }\n\t\n\t__ret = __ret * _M_sigma + _M_mean;\n\treturn __ret;\n      }\n\n  template<typename _RealType, typename _CharT, typename _Traits>\n    std::basic_ostream<_CharT, _Traits>&\n    operator<<(std::basic_ostream<_CharT, _Traits>& __os,\n\t       const normal_distribution<_RealType>& __x)\n    {\n      typedef std::basic_ostream<_CharT, _Traits>  __ostream_type;\n      typedef typename __ostream_type::ios_base    __ios_base;\n\n      const typename __ios_base::fmtflags __flags = __os.flags();\n      const _CharT __fill = __os.fill();\n      const std::streamsize __precision = __os.precision();\n      const _CharT __space = __os.widen(' ');\n      __os.flags(__ios_base::scientific | __ios_base::left);\n      __os.fill(__space);\n      __os.precision(__gnu_cxx::__numeric_traits<_RealType>::__max_digits10);\n\n      __os << __x._M_saved_available << __space\n\t   << __x.mean() << __space\n\t   << __x.sigma();\n      if (__x._M_saved_available)\n\t__os << __space << __x._M_saved;\n\n      __os.flags(__flags);\n      __os.fill(__fill);\n      __os.precision(__precision);\n      return __os;\n    }\n\n  template<typename _RealType, typename _CharT, typename _Traits>\n    std::basic_istream<_CharT, _Traits>&\n    operator>>(std::basic_istream<_CharT, _Traits>& __is,\n\t       normal_distribution<_RealType>& __x)\n    {\n      typedef std::basic_istream<_CharT, _Traits>  __istream_type;\n      typedef typename __istream_type::ios_base    __ios_base;\n\n      const typename __ios_base::fmtflags __flags = __is.flags();\n      __is.flags(__ios_base::dec | __ios_base::skipws);\n\n      __is >> __x._M_saved_available >> __x._M_mean\n\t   >> __x._M_sigma;\n      if (__x._M_saved_available)\n\t__is >> __x._M_saved;\n\n      __is.flags(__flags);\n      return __is;\n    }\n\n\n  template<typename _RealType>\n    void\n    gamma_distribution<_RealType>::\n    _M_initialize()\n    {\n      if (_M_alpha >= 1)\n\t_M_l_d = std::sqrt(2 * _M_alpha - 1);\n      else\n\t_M_l_d = (std::pow(_M_alpha, _M_alpha / (1 - _M_alpha))\n\t\t  * (1 - _M_alpha));\n    }\n\n  /**\n   * Cheng's rejection algorithm GB for alpha >= 1 and a modification\n   * of Vaduva's rejection from Weibull algorithm due to Devroye for\n   * alpha < 1.\n   *\n   * References:\n   * Cheng, R. C. \"The Generation of Gamma Random Variables with Non-integral\n   * Shape Parameter.\" Applied Statistics, 26, 71-75, 1977.\n   *\n   * Vaduva, I. \"Computer Generation of Gamma Gandom Variables by Rejection\n   * and Composition Procedures.\" Math. Operationsforschung and Statistik,\n   * Series in Statistics, 8, 545-576, 1977.\n   *\n   * Devroye, L. \"Non-Uniform Random Variates Generation.\" Springer-Verlag,\n   * New York, 1986, Ch. IX, Sect. 3.4 (+ Errata!).\n   */\n  template<typename _RealType>\n    template<class _UniformRandomNumberGenerator>\n      typename gamma_distribution<_RealType>::result_type\n      gamma_distribution<_RealType>::\n      operator()(_UniformRandomNumberGenerator& __urng)\n      {\n\tresult_type __x;\n\n\tbool __reject;\n\tif (_M_alpha >= 1)\n\t  {\n\t    // alpha - log(4)\n\t    const result_type __b = _M_alpha\n\t      - result_type(1.3862943611198906188344642429163531L);\n\t    const result_type __c = _M_alpha + _M_l_d;\n\t    const result_type __1l = 1 / _M_l_d;\n\n\t    // 1 + log(9 / 2)\n\t    const result_type __k = 2.5040773967762740733732583523868748L;\n\n\t    do\n\t      {\n\t\tconst result_type __u = __urng();\n\t\tconst result_type __v = __urng();\n\n\t\tconst result_type __y = __1l * std::log(__v / (1 - __v));\n\t\t__x = _M_alpha * std::exp(__y);\n\n\t\tconst result_type __z = __u * __v * __v;\n\t\tconst result_type __r = __b + __c * __y - __x;\n\n\t\t__reject = __r < result_type(4.5) * __z - __k;\n\t\tif (__reject)\n\t\t  __reject = __r < std::log(__z);\n\t      }\n\t    while (__reject);\n\t  }\n\telse\n\t  {\n\t    const result_type __c = 1 / _M_alpha;\n\n\t    do\n\t      {\n\t\tconst result_type __z = -std::log(__urng());\n\t\tconst result_type __e = -std::log(__urng());\n\n\t\t__x = std::pow(__z, __c);\n\n\t\t__reject = __z + __e < _M_l_d + __x;\n\t      }\n\t    while (__reject);\n\t  }\n\n\treturn __x;\n      }\n\n  template<typename _RealType, typename _CharT, typename _Traits>\n    std::basic_ostream<_CharT, _Traits>&\n    operator<<(std::basic_ostream<_CharT, _Traits>& __os,\n\t       const gamma_distribution<_RealType>& __x)\n    {\n      typedef std::basic_ostream<_CharT, _Traits>  __ostream_type;\n      typedef typename __ostream_type::ios_base    __ios_base;\n\n      const typename __ios_base::fmtflags __flags = __os.flags();\n      const _CharT __fill = __os.fill();\n      const std::streamsize __precision = __os.precision();\n      __os.flags(__ios_base::scientific | __ios_base::left);\n      __os.fill(__os.widen(' '));\n      __os.precision(__gnu_cxx::__numeric_traits<_RealType>::__max_digits10);\n\n      __os << __x.alpha();\n\n      __os.flags(__flags);\n      __os.fill(__fill);\n      __os.precision(__precision);\n      return __os;\n    }\n\n_GLIBCXX_END_NAMESPACE\n}\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/tr1/ref_fwd.h",
    "content": "\n\n// class template reference_wrapper forwarding header -*- C++ -*-\n\n// Copyright (C) 2004, 2005 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n/** @file tr1/ref_fwd.h\n *  This is an internal header file, included by other library headers.\n *  You should not attempt to use it directly.\n */\n\n// Douglas Gregor <doug.gregor -at- gmail.com>\n#ifndef _TR1_REF_FWD\n#define _TR1_REF_FWD\n\nnamespace std\n{\n_GLIBCXX_BEGIN_NAMESPACE(tr1)\n\ntemplate<typename _Tp>\n  class reference_wrapper;\n\ntemplate<typename _Tp>\n  reference_wrapper<_Tp>\n  ref(_Tp& __t);\n\n  // Denotes a const reference should be taken to a variable.\ntemplate<typename _Tp>\n  reference_wrapper<const _Tp>\n  cref(const _Tp& __t);\n\n_GLIBCXX_END_NAMESPACE\n}\n#endif\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/tr1/ref_wrap_iterate.h",
    "content": "// TR1 reference_wrapper -*- C++ -*-\n\n// Copyright (C) 2005 Free Software Foundation, Inc.\n// Written by Douglas Gregor <doug.gregor -at- gmail.com>\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n/** @file tr1/ref_wrap_iterate.h\n *  This is an internal header file, included by other library headers.\n *  You should not attempt to use it directly.\n */\n\n#if _GLIBCXX_NUM_ARGS > 0\ntemplate<_GLIBCXX_TEMPLATE_PARAMS>\n  typename result_of<_M_func_type(_GLIBCXX_TEMPLATE_ARGS)>::type\n  operator()(_GLIBCXX_REF_PARAMS) const;\n#else\ntypename result_of<_M_func_type()>::type\noperator()() const\n{ return get()(); }\n#endif\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/tr1/repeat.h",
    "content": "// TR1 code repetition -*- C++ -*-\n\n// Copyright (C) 2005 Free Software Foundation, Inc.\n// Written by Douglas Gregor <doug.gregor -at- gmail.com>\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n/** @file tr1/repeat.h\n *  This is an internal header file, included by other library headers.\n *  You should not attempt to use it directly.\n */\n\n#ifndef _GLIBCXX_REPEAT_HEADER\n#  error Internal error: _GLIBCXX_REPEAT_HEADER must be set\n#endif /* _GLIBCXX_REPEAT_HEADER */\n\n#ifndef _GLIBCXX_TUPLE_ALL_TEMPLATE_PARAMS\n#  define _GLIBCXX_TUPLE_ALL_TEMPLATE_PARAMS typename _T1, typename _T2, typename _T3, typename _T4, typename _T5, typename _T6, typename _T7, typename _T8, typename _T9, typename _T10\n#  define _GLIBCXX_TUPLE_ALL_TEMPLATE_PARAMS_UNNAMED typename, typename, typename, typename, typename, typename, typename, typename, typename, typename\n#  define _GLIBCXX_TUPLE_ALL_TEMPLATE_ARGS _T1, _T2, _T3, _T4, _T5, _T6, _T7, _T8, _T9, _T10\n#endif\n\n#define _GLIBCXX_NUM_ARGS 0\n#define _GLIBCXX_COMMA\n#define _GLIBCXX_TEMPLATE_PARAMS\n#define _GLIBCXX_TEMPLATE_ARGS\n#define _GLIBCXX_PARAMS\n#define _GLIBCXX_REF_PARAMS\n#define _GLIBCXX_ARGS\n#define _GLIBCXX_COMMA_SHIFTED\n#define _GLIBCXX_TEMPLATE_PARAMS_SHIFTED\n#define _GLIBCXX_TEMPLATE_ARGS_SHIFTED\n#define _GLIBCXX_PARAMS_SHIFTED\n#define _GLIBCXX_ARGS_SHIFTED\n#define _GLIBCXX_BIND_MEMBERS_INIT\n#define _GLIBCXX_BIND_MEMBERS\n#define _GLIBCXX_MU_GET_TUPLE_ARGS\n#define _GLIBCXX_BIND_V_TEMPLATE_ARGS(_CV)\n#define _GLIBCXX_BIND_V_ARGS\n#define _GLIBCXX_TUPLE_ADD_CREF\n#define _GLIBCXX_TUPLE_COPY_INIT\n#define _GLIBCXX_TUPLE_ASSIGN\n#define _GLIBCXX_TEMPLATE_PARAMS_NULL_CLASS\n#define _GLIBCXX_TEMPLATE_ARGS_STRIPPED\n#define _GLIBCXX_TEMPLATE_PARAMS_U\n#define _GLIBCXX_TEMPLATE_ARGS_U\n#define _GLIBCXX_REF_WRAP_PARAMS\n#define _GLIBCXX_REF_TEMPLATE_ARGS\n#define _GLIBCXX_NUM_ARGS_PLUS_1 1\n#define _GLIBCXX_T_NUM_ARGS_PLUS_1 _T1\n#include _GLIBCXX_REPEAT_HEADER\n#undef _GLIBCXX_T_NUM_ARGS_PLUS_1\n#undef _GLIBCXX_NUM_ARGS_PLUS_1\n#undef _GLIBCXX_REF_TEMPLATE_ARGS\n#undef _GLIBCXX_REF_WRAP_PARAMS\n#undef _GLIBCXX_TEMPLATE_ARGS_U\n#undef _GLIBCXX_TEMPLATE_PARAMS_U\n#undef _GLIBCXX_TEMPLATE_ARGS_STRIPPED\n#undef _GLIBCXX_TEMPLATE_PARAMS_NULL_CLASS\n#undef _GLIBCXX_TUPLE_ASSIGN\n#undef _GLIBCXX_TUPLE_COPY_INIT\n#undef _GLIBCXX_TUPLE_ADD_CREF\n#undef _GLIBCXX_BIND_V_ARGS\n#undef _GLIBCXX_BIND_V_TEMPLATE_ARGS\n#undef _GLIBCXX_MU_GET_TUPLE_ARGS\n#undef _GLIBCXX_BIND_MEMBERS_INIT\n#undef _GLIBCXX_BIND_MEMBERS\n#undef _GLIBCXX_ARGS_SHIFTED\n#undef _GLIBCXX_PARAMS_SHIFTED\n#undef _GLIBCXX_TEMPLATE_ARGS_SHIFTED\n#undef _GLIBCXX_TEMPLATE_PARAMS_SHIFTED\n#undef _GLIBCXX_COMMA_SHIFTED\n#undef _GLIBCXX_ARGS\n#undef _GLIBCXX_REF_PARAMS\n#undef _GLIBCXX_PARAMS\n#undef _GLIBCXX_TEMPLATE_ARGS\n#undef _GLIBCXX_TEMPLATE_PARAMS\n#undef _GLIBCXX_COMMA\n#undef _GLIBCXX_NUM_ARGS\n\n#define _GLIBCXX_NUM_ARGS 1\n#define _GLIBCXX_COMMA ,\n#define _GLIBCXX_TEMPLATE_PARAMS typename _T1\n#define _GLIBCXX_TEMPLATE_ARGS _T1\n#define _GLIBCXX_PARAMS _T1 __a1\n#define _GLIBCXX_REF_PARAMS _T1& __a1\n#define _GLIBCXX_ARGS __a1\n#define _GLIBCXX_COMMA_SHIFTED\n#define _GLIBCXX_TEMPLATE_PARAMS_SHIFTED\n#define _GLIBCXX_TEMPLATE_ARGS_SHIFTED\n#define _GLIBCXX_PARAMS_SHIFTED\n#define _GLIBCXX_ARGS_SHIFTED\n#define _GLIBCXX_BIND_MEMBERS _T1 _M_arg1;\n#define _GLIBCXX_BIND_MEMBERS_INIT _M_arg1(__a1)\n#define _GLIBCXX_MU_GET_TUPLE_ARGS ::std::tr1::get<0>(__tuple)\n#define _GLIBCXX_BIND_V_TEMPLATE_ARGS(_CV) typename result_of<_Mu<_T1> _CV(_T1, tuple<_GLIBCXX_BIND_TEMPLATE_ARGS>)>::type\n#define _GLIBCXX_BIND_V_ARGS _Mu<_T1>()(_M_arg1, ::std::tr1::tie(_GLIBCXX_BIND_ARGS))\n#define _GLIBCXX_TUPLE_ADD_CREF typename __add_c_ref<_T1>::type __a1\n#define _GLIBCXX_TUPLE_COPY_INIT _M_arg1(__in._M_arg1)\n#define _GLIBCXX_TUPLE_ASSIGN _M_arg1 = __in._M_arg1;\n#define _GLIBCXX_TEMPLATE_PARAMS_NULL_CLASS typename _T1 = _NullClass\n#define _GLIBCXX_TEMPLATE_ARGS_STRIPPED typename __strip_reference_wrapper<_T1>::__type\n#define _GLIBCXX_TEMPLATE_PARAMS_U typename _U1\n#define _GLIBCXX_TEMPLATE_ARGS_U _U1\n#define _GLIBCXX_REF_WRAP_PARAMS ref(__a1)\n#define _GLIBCXX_REF_TEMPLATE_ARGS _T1&\n#define _GLIBCXX_NUM_ARGS_PLUS_1 2\n#define _GLIBCXX_T_NUM_ARGS_PLUS_1 _T2\n#include _GLIBCXX_REPEAT_HEADER\n#undef _GLIBCXX_T_NUM_ARGS_PLUS_1\n#undef _GLIBCXX_NUM_ARGS_PLUS_1\n#undef _GLIBCXX_REF_TEMPLATE_ARGS\n#undef _GLIBCXX_REF_WRAP_PARAMS\n#undef _GLIBCXX_TEMPLATE_ARGS_U\n#undef _GLIBCXX_TEMPLATE_PARAMS_U\n#undef _GLIBCXX_TEMPLATE_ARGS_STRIPPED\n#undef _GLIBCXX_TEMPLATE_PARAMS_NULL_CLASS\n#undef _GLIBCXX_TUPLE_ASSIGN\n#undef _GLIBCXX_TUPLE_COPY_INIT\n#undef _GLIBCXX_TUPLE_ADD_CREF\n#undef _GLIBCXX_BIND_V_ARGS\n#undef _GLIBCXX_BIND_V_TEMPLATE_ARGS\n#undef _GLIBCXX_MU_GET_TUPLE_ARGS\n#undef _GLIBCXX_BIND_MEMBERS_INIT\n#undef _GLIBCXX_BIND_MEMBERS\n#undef _GLIBCXX_ARGS_SHIFTED\n#undef _GLIBCXX_PARAMS_SHIFTED\n#undef _GLIBCXX_TEMPLATE_ARGS_SHIFTED\n#undef _GLIBCXX_TEMPLATE_PARAMS_SHIFTED\n#undef _GLIBCXX_COMMA_SHIFTED\n#undef _GLIBCXX_ARGS\n#undef _GLIBCXX_REF_PARAMS\n#undef _GLIBCXX_PARAMS\n#undef _GLIBCXX_TEMPLATE_ARGS\n#undef _GLIBCXX_TEMPLATE_PARAMS\n#undef _GLIBCXX_COMMA\n#undef _GLIBCXX_NUM_ARGS\n\n#define _GLIBCXX_NUM_ARGS 2\n#define _GLIBCXX_COMMA ,\n#define _GLIBCXX_TEMPLATE_PARAMS typename _T1, typename _T2\n#define _GLIBCXX_TEMPLATE_ARGS _T1, _T2\n#define _GLIBCXX_PARAMS _T1 __a1, _T2 __a2\n#define _GLIBCXX_REF_PARAMS _T1& __a1, _T2& __a2\n#define _GLIBCXX_ARGS __a1, __a2\n#define _GLIBCXX_COMMA_SHIFTED ,\n#define _GLIBCXX_TEMPLATE_PARAMS_SHIFTED typename _T1\n#define _GLIBCXX_TEMPLATE_ARGS_SHIFTED _T1\n#define _GLIBCXX_PARAMS_SHIFTED _T1 __a1\n#define _GLIBCXX_ARGS_SHIFTED __a1\n#define _GLIBCXX_BIND_MEMBERS _T1 _M_arg1; _T2 _M_arg2;\n#define _GLIBCXX_BIND_MEMBERS_INIT _M_arg1(__a1), _M_arg2(__a2)\n#define _GLIBCXX_MU_GET_TUPLE_ARGS ::std::tr1::get<0>(__tuple), ::std::tr1::get<1>(__tuple)\n#define _GLIBCXX_BIND_V_TEMPLATE_ARGS(_CV) typename result_of<_Mu<_T1> _CV(_T1, tuple<_GLIBCXX_BIND_TEMPLATE_ARGS>)>::type, typename result_of<_Mu<_T2> _CV(_T2, tuple<_GLIBCXX_BIND_TEMPLATE_ARGS>)>::type\n#define _GLIBCXX_BIND_V_ARGS _Mu<_T1>()(_M_arg1, ::std::tr1::tie(_GLIBCXX_BIND_ARGS)), _Mu<_T2>()(_M_arg2, ::std::tr1::tie(_GLIBCXX_BIND_ARGS))\n#define _GLIBCXX_TUPLE_ADD_CREF typename __add_c_ref<_T1>::type __a1, typename __add_c_ref<_T2>::type __a2\n#define _GLIBCXX_TUPLE_COPY_INIT _M_arg1(__in._M_arg1), _M_arg2(__in._M_arg2)\n#define _GLIBCXX_TUPLE_ASSIGN _M_arg1 = __in._M_arg1; _M_arg2 = __in._M_arg2;\n#define _GLIBCXX_TEMPLATE_PARAMS_NULL_CLASS typename _T1 = _NullClass, typename _T2 = _NullClass\n#define _GLIBCXX_TEMPLATE_ARGS_STRIPPED typename __strip_reference_wrapper<_T1>::__type, typename __strip_reference_wrapper<_T2>::__type\n#define _GLIBCXX_TEMPLATE_PARAMS_U typename _U1, typename _U2\n#define _GLIBCXX_TEMPLATE_ARGS_U _U1, _U2\n#define _GLIBCXX_REF_WRAP_PARAMS ref(__a1), ref(__a2)\n#define _GLIBCXX_REF_TEMPLATE_ARGS _T1&, _T2&\n#define _GLIBCXX_NUM_ARGS_PLUS_1 3\n#define _GLIBCXX_T_NUM_ARGS_PLUS_1 _T3\n#include _GLIBCXX_REPEAT_HEADER\n#undef _GLIBCXX_T_NUM_ARGS_PLUS_1\n#undef _GLIBCXX_NUM_ARGS_PLUS_1\n#undef _GLIBCXX_REF_TEMPLATE_ARGS\n#undef _GLIBCXX_REF_WRAP_PARAMS\n#undef _GLIBCXX_TEMPLATE_ARGS_U\n#undef _GLIBCXX_TEMPLATE_PARAMS_U\n#undef _GLIBCXX_TEMPLATE_ARGS_STRIPPED\n#undef _GLIBCXX_TEMPLATE_PARAMS_NULL_CLASS\n#undef _GLIBCXX_TUPLE_ASSIGN\n#undef _GLIBCXX_TUPLE_COPY_INIT\n#undef _GLIBCXX_TUPLE_ADD_CREF\n#undef _GLIBCXX_BIND_V_ARGS\n#undef _GLIBCXX_BIND_V_TEMPLATE_ARGS\n#undef _GLIBCXX_MU_GET_TUPLE_ARGS\n#undef _GLIBCXX_BIND_MEMBERS_INIT\n#undef _GLIBCXX_BIND_MEMBERS\n#undef _GLIBCXX_ARGS_SHIFTED\n#undef _GLIBCXX_PARAMS_SHIFTED\n#undef _GLIBCXX_TEMPLATE_ARGS_SHIFTED\n#undef _GLIBCXX_TEMPLATE_PARAMS_SHIFTED\n#undef _GLIBCXX_COMMA_SHIFTED\n#undef _GLIBCXX_ARGS\n#undef _GLIBCXX_REF_PARAMS\n#undef _GLIBCXX_PARAMS\n#undef _GLIBCXX_TEMPLATE_ARGS\n#undef _GLIBCXX_TEMPLATE_PARAMS\n#undef _GLIBCXX_COMMA\n#undef _GLIBCXX_NUM_ARGS\n#define _GLIBCXX_NUM_ARGS 3\n#define _GLIBCXX_COMMA ,\n#define _GLIBCXX_TEMPLATE_PARAMS typename _T1, typename _T2, typename _T3\n#define _GLIBCXX_TEMPLATE_ARGS _T1, _T2, _T3\n#define _GLIBCXX_PARAMS _T1 __a1, _T2 __a2, _T3 __a3\n#define _GLIBCXX_REF_PARAMS _T1& __a1, _T2& __a2, _T3& __a3\n#define _GLIBCXX_ARGS __a1, __a2, __a3\n#define _GLIBCXX_COMMA_SHIFTED ,\n#define _GLIBCXX_TEMPLATE_PARAMS_SHIFTED typename _T1, typename _T2\n#define _GLIBCXX_TEMPLATE_ARGS_SHIFTED _T1, _T2\n#define _GLIBCXX_PARAMS_SHIFTED _T1 __a1, _T2 __a2\n#define _GLIBCXX_ARGS_SHIFTED __a1, __a2\n#define _GLIBCXX_BIND_MEMBERS _T1 _M_arg1; _T2 _M_arg2; _T3 _M_arg3;\n#define _GLIBCXX_BIND_MEMBERS_INIT _M_arg1(__a1), _M_arg2(__a2), _M_arg3(__a3)\n#define _GLIBCXX_MU_GET_TUPLE_ARGS ::std::tr1::get<0>(__tuple), ::std::tr1::get<1>(__tuple), ::std::tr1::get<2>(__tuple)\n#define _GLIBCXX_BIND_V_TEMPLATE_ARGS(_CV) typename result_of<_Mu<_T1> _CV(_T1, tuple<_GLIBCXX_BIND_TEMPLATE_ARGS>)>::type, typename result_of<_Mu<_T2> _CV(_T2, tuple<_GLIBCXX_BIND_TEMPLATE_ARGS>)>::type, typename result_of<_Mu<_T3> _CV(_T3, tuple<_GLIBCXX_BIND_TEMPLATE_ARGS>)>::type\n#define _GLIBCXX_BIND_V_ARGS _Mu<_T1>()(_M_arg1, ::std::tr1::tie(_GLIBCXX_BIND_ARGS)), _Mu<_T2>()(_M_arg2, ::std::tr1::tie(_GLIBCXX_BIND_ARGS)), _Mu<_T3>()(_M_arg3, ::std::tr1::tie(_GLIBCXX_BIND_ARGS))\n#define _GLIBCXX_TUPLE_ADD_CREF typename __add_c_ref<_T1>::type __a1, typename __add_c_ref<_T2>::type __a2, typename __add_c_ref<_T3>::type __a3\n#define _GLIBCXX_TUPLE_COPY_INIT _M_arg1(__in._M_arg1), _M_arg2(__in._M_arg2), _M_arg3(__in._M_arg3)\n#define _GLIBCXX_TUPLE_ASSIGN _M_arg1 = __in._M_arg1; _M_arg2 = __in._M_arg2; _M_arg3 = __in._M_arg3;\n#define _GLIBCXX_TEMPLATE_PARAMS_NULL_CLASS typename _T1 = _NullClass, typename _T2 = _NullClass, typename _T3 = _NullClass\n#define _GLIBCXX_TEMPLATE_ARGS_STRIPPED typename __strip_reference_wrapper<_T1>::__type, typename __strip_reference_wrapper<_T2>::__type, typename __strip_reference_wrapper<_T3>::__type\n#define _GLIBCXX_TEMPLATE_PARAMS_U typename _U1, typename _U2, typename _U3\n#define _GLIBCXX_TEMPLATE_ARGS_U _U1, _U2, _U3\n#define _GLIBCXX_REF_WRAP_PARAMS ref(__a1), ref(__a2), ref(__a3)\n#define _GLIBCXX_REF_TEMPLATE_ARGS _T1&, _T2&, _T3&\n#define _GLIBCXX_NUM_ARGS_PLUS_1 4\n#define _GLIBCXX_T_NUM_ARGS_PLUS_1 _T4\n#include _GLIBCXX_REPEAT_HEADER\n#undef _GLIBCXX_T_NUM_ARGS_PLUS_1\n#undef _GLIBCXX_NUM_ARGS_PLUS_1\n#undef _GLIBCXX_REF_TEMPLATE_ARGS\n#undef _GLIBCXX_REF_WRAP_PARAMS\n#undef _GLIBCXX_TEMPLATE_ARGS_U\n#undef _GLIBCXX_TEMPLATE_PARAMS_U\n#undef _GLIBCXX_TEMPLATE_ARGS_STRIPPED\n#undef _GLIBCXX_TEMPLATE_PARAMS_NULL_CLASS\n#undef _GLIBCXX_TUPLE_ASSIGN\n#undef _GLIBCXX_TUPLE_COPY_INIT\n#undef _GLIBCXX_TUPLE_ADD_CREF\n#undef _GLIBCXX_BIND_V_ARGS\n#undef _GLIBCXX_BIND_V_TEMPLATE_ARGS\n#undef _GLIBCXX_MU_GET_TUPLE_ARGS\n#undef _GLIBCXX_BIND_MEMBERS_INIT\n#undef _GLIBCXX_BIND_MEMBERS\n#undef _GLIBCXX_ARGS_SHIFTED\n#undef _GLIBCXX_PARAMS_SHIFTED\n#undef _GLIBCXX_TEMPLATE_ARGS_SHIFTED\n#undef _GLIBCXX_TEMPLATE_PARAMS_SHIFTED\n#undef _GLIBCXX_COMMA_SHIFTED\n#undef _GLIBCXX_ARGS\n#undef _GLIBCXX_REF_PARAMS\n#undef _GLIBCXX_PARAMS\n#undef _GLIBCXX_TEMPLATE_ARGS\n#undef _GLIBCXX_TEMPLATE_PARAMS\n#undef _GLIBCXX_COMMA\n#undef _GLIBCXX_NUM_ARGS\n#define _GLIBCXX_NUM_ARGS 4\n#define _GLIBCXX_COMMA ,\n#define _GLIBCXX_TEMPLATE_PARAMS typename _T1, typename _T2, typename _T3, typename _T4\n#define _GLIBCXX_TEMPLATE_ARGS _T1, _T2, _T3, _T4\n#define _GLIBCXX_PARAMS _T1 __a1, _T2 __a2, _T3 __a3, _T4 __a4\n#define _GLIBCXX_REF_PARAMS _T1& __a1, _T2& __a2, _T3& __a3, _T4& __a4\n#define _GLIBCXX_ARGS __a1, __a2, __a3, __a4\n#define _GLIBCXX_COMMA_SHIFTED ,\n#define _GLIBCXX_TEMPLATE_PARAMS_SHIFTED typename _T1, typename _T2, typename _T3\n#define _GLIBCXX_TEMPLATE_ARGS_SHIFTED _T1, _T2, _T3\n#define _GLIBCXX_PARAMS_SHIFTED _T1 __a1, _T2 __a2, _T3 __a3\n#define _GLIBCXX_ARGS_SHIFTED __a1, __a2, __a3\n#define _GLIBCXX_BIND_MEMBERS _T1 _M_arg1; _T2 _M_arg2; _T3 _M_arg3; _T4 _M_arg4;\n#define _GLIBCXX_BIND_MEMBERS_INIT _M_arg1(__a1), _M_arg2(__a2), _M_arg3(__a3), _M_arg4(__a4)\n#define _GLIBCXX_MU_GET_TUPLE_ARGS ::std::tr1::get<0>(__tuple), ::std::tr1::get<1>(__tuple), ::std::tr1::get<2>(__tuple), ::std::tr1::get<3>(__tuple)\n#define _GLIBCXX_BIND_V_TEMPLATE_ARGS(_CV) typename result_of<_Mu<_T1> _CV(_T1, tuple<_GLIBCXX_BIND_TEMPLATE_ARGS>)>::type, typename result_of<_Mu<_T2> _CV(_T2, tuple<_GLIBCXX_BIND_TEMPLATE_ARGS>)>::type, typename result_of<_Mu<_T3> _CV(_T3, tuple<_GLIBCXX_BIND_TEMPLATE_ARGS>)>::type, typename result_of<_Mu<_T4> _CV(_T4, tuple<_GLIBCXX_BIND_TEMPLATE_ARGS>)>::type\n#define _GLIBCXX_BIND_V_ARGS _Mu<_T1>()(_M_arg1, ::std::tr1::tie(_GLIBCXX_BIND_ARGS)), _Mu<_T2>()(_M_arg2, ::std::tr1::tie(_GLIBCXX_BIND_ARGS)), _Mu<_T3>()(_M_arg3, ::std::tr1::tie(_GLIBCXX_BIND_ARGS)), _Mu<_T4>()(_M_arg4, ::std::tr1::tie(_GLIBCXX_BIND_ARGS))\n#define _GLIBCXX_TUPLE_ADD_CREF typename __add_c_ref<_T1>::type __a1, typename __add_c_ref<_T2>::type __a2, typename __add_c_ref<_T3>::type __a3, typename __add_c_ref<_T4>::type __a4\n#define _GLIBCXX_TUPLE_COPY_INIT _M_arg1(__in._M_arg1), _M_arg2(__in._M_arg2), _M_arg3(__in._M_arg3), _M_arg4(__in._M_arg4)\n#define _GLIBCXX_TUPLE_ASSIGN _M_arg1 = __in._M_arg1; _M_arg2 = __in._M_arg2; _M_arg3 = __in._M_arg3; _M_arg4 = __in._M_arg4;\n#define _GLIBCXX_TEMPLATE_PARAMS_NULL_CLASS typename _T1 = _NullClass, typename _T2 = _NullClass, typename _T3 = _NullClass, typename _T4 = _NullClass\n#define _GLIBCXX_TEMPLATE_ARGS_STRIPPED typename __strip_reference_wrapper<_T1>::__type, typename __strip_reference_wrapper<_T2>::__type, typename __strip_reference_wrapper<_T3>::__type, typename __strip_reference_wrapper<_T4>::__type\n#define _GLIBCXX_TEMPLATE_PARAMS_U typename _U1, typename _U2, typename _U3, typename _U4\n#define _GLIBCXX_TEMPLATE_ARGS_U _U1, _U2, _U3, _U4\n#define _GLIBCXX_REF_WRAP_PARAMS ref(__a1), ref(__a2), ref(__a3), ref(__a4)\n#define _GLIBCXX_REF_TEMPLATE_ARGS _T1&, _T2&, _T3&, _T4&\n#define _GLIBCXX_NUM_ARGS_PLUS_1 5\n#define _GLIBCXX_T_NUM_ARGS_PLUS_1 _T5\n#include _GLIBCXX_REPEAT_HEADER\n#undef _GLIBCXX_T_NUM_ARGS_PLUS_1\n#undef _GLIBCXX_NUM_ARGS_PLUS_1\n#undef _GLIBCXX_REF_TEMPLATE_ARGS\n#undef _GLIBCXX_REF_WRAP_PARAMS\n#undef _GLIBCXX_TEMPLATE_ARGS_U\n#undef _GLIBCXX_TEMPLATE_PARAMS_U\n#undef _GLIBCXX_TEMPLATE_ARGS_STRIPPED\n#undef _GLIBCXX_TEMPLATE_PARAMS_NULL_CLASS\n#undef _GLIBCXX_TUPLE_ASSIGN\n#undef _GLIBCXX_TUPLE_COPY_INIT\n#undef _GLIBCXX_TUPLE_ADD_CREF\n#undef _GLIBCXX_BIND_V_ARGS\n#undef _GLIBCXX_BIND_V_TEMPLATE_ARGS\n#undef _GLIBCXX_MU_GET_TUPLE_ARGS\n#undef _GLIBCXX_BIND_MEMBERS_INIT\n#undef _GLIBCXX_BIND_MEMBERS\n#undef _GLIBCXX_ARGS_SHIFTED\n#undef _GLIBCXX_PARAMS_SHIFTED\n#undef _GLIBCXX_TEMPLATE_ARGS_SHIFTED\n#undef _GLIBCXX_TEMPLATE_PARAMS_SHIFTED\n#undef _GLIBCXX_COMMA_SHIFTED\n#undef _GLIBCXX_ARGS\n#undef _GLIBCXX_REF_PARAMS\n#undef _GLIBCXX_PARAMS\n#undef _GLIBCXX_TEMPLATE_ARGS\n#undef _GLIBCXX_TEMPLATE_PARAMS\n#undef _GLIBCXX_COMMA\n#undef _GLIBCXX_NUM_ARGS\n#define _GLIBCXX_NUM_ARGS 5\n#define _GLIBCXX_COMMA ,\n#define _GLIBCXX_TEMPLATE_PARAMS typename _T1, typename _T2, typename _T3, typename _T4, typename _T5\n#define _GLIBCXX_TEMPLATE_ARGS _T1, _T2, _T3, _T4, _T5\n#define _GLIBCXX_PARAMS _T1 __a1, _T2 __a2, _T3 __a3, _T4 __a4, _T5 __a5\n#define _GLIBCXX_REF_PARAMS _T1& __a1, _T2& __a2, _T3& __a3, _T4& __a4, _T5& __a5\n#define _GLIBCXX_ARGS __a1, __a2, __a3, __a4, __a5\n#define _GLIBCXX_COMMA_SHIFTED ,\n#define _GLIBCXX_TEMPLATE_PARAMS_SHIFTED typename _T1, typename _T2, typename _T3, typename _T4\n#define _GLIBCXX_TEMPLATE_ARGS_SHIFTED _T1, _T2, _T3, _T4\n#define _GLIBCXX_PARAMS_SHIFTED _T1 __a1, _T2 __a2, _T3 __a3, _T4 __a4\n#define _GLIBCXX_ARGS_SHIFTED __a1, __a2, __a3, __a4\n#define _GLIBCXX_BIND_MEMBERS _T1 _M_arg1; _T2 _M_arg2; _T3 _M_arg3; _T4 _M_arg4; _T5 _M_arg5;\n#define _GLIBCXX_BIND_MEMBERS_INIT _M_arg1(__a1), _M_arg2(__a2), _M_arg3(__a3), _M_arg4(__a4), _M_arg5(__a5)\n#define _GLIBCXX_MU_GET_TUPLE_ARGS ::std::tr1::get<0>(__tuple), ::std::tr1::get<1>(__tuple), ::std::tr1::get<2>(__tuple), ::std::tr1::get<3>(__tuple), ::std::tr1::get<4>(__tuple)\n#define _GLIBCXX_BIND_V_TEMPLATE_ARGS(_CV) typename result_of<_Mu<_T1> _CV(_T1, tuple<_GLIBCXX_BIND_TEMPLATE_ARGS>)>::type, typename result_of<_Mu<_T2> _CV(_T2, tuple<_GLIBCXX_BIND_TEMPLATE_ARGS>)>::type, typename result_of<_Mu<_T3> _CV(_T3, tuple<_GLIBCXX_BIND_TEMPLATE_ARGS>)>::type, typename result_of<_Mu<_T4> _CV(_T4, tuple<_GLIBCXX_BIND_TEMPLATE_ARGS>)>::type, typename result_of<_Mu<_T5> _CV(_T5, tuple<_GLIBCXX_BIND_TEMPLATE_ARGS>)>::type\n#define _GLIBCXX_BIND_V_ARGS _Mu<_T1>()(_M_arg1, ::std::tr1::tie(_GLIBCXX_BIND_ARGS)), _Mu<_T2>()(_M_arg2, ::std::tr1::tie(_GLIBCXX_BIND_ARGS)), _Mu<_T3>()(_M_arg3, ::std::tr1::tie(_GLIBCXX_BIND_ARGS)), _Mu<_T4>()(_M_arg4, ::std::tr1::tie(_GLIBCXX_BIND_ARGS)), _Mu<_T5>()(_M_arg5, ::std::tr1::tie(_GLIBCXX_BIND_ARGS))\n#define _GLIBCXX_TUPLE_ADD_CREF typename __add_c_ref<_T1>::type __a1, typename __add_c_ref<_T2>::type __a2, typename __add_c_ref<_T3>::type __a3, typename __add_c_ref<_T4>::type __a4, typename __add_c_ref<_T5>::type __a5\n#define _GLIBCXX_TUPLE_COPY_INIT _M_arg1(__in._M_arg1), _M_arg2(__in._M_arg2), _M_arg3(__in._M_arg3), _M_arg4(__in._M_arg4), _M_arg5(__in._M_arg5)\n#define _GLIBCXX_TUPLE_ASSIGN _M_arg1 = __in._M_arg1; _M_arg2 = __in._M_arg2; _M_arg3 = __in._M_arg3; _M_arg4 = __in._M_arg4; _M_arg5 = __in._M_arg5;\n#define _GLIBCXX_TEMPLATE_PARAMS_NULL_CLASS typename _T1 = _NullClass, typename _T2 = _NullClass, typename _T3 = _NullClass, typename _T4 = _NullClass, typename _T5 = _NullClass\n#define _GLIBCXX_TEMPLATE_ARGS_STRIPPED typename __strip_reference_wrapper<_T1>::__type, typename __strip_reference_wrapper<_T2>::__type, typename __strip_reference_wrapper<_T3>::__type, typename __strip_reference_wrapper<_T4>::__type, typename __strip_reference_wrapper<_T5>::__type\n#define _GLIBCXX_TEMPLATE_PARAMS_U typename _U1, typename _U2, typename _U3, typename _U4, typename _U5\n#define _GLIBCXX_TEMPLATE_ARGS_U _U1, _U2, _U3, _U4, _U5\n#define _GLIBCXX_REF_WRAP_PARAMS ref(__a1), ref(__a2), ref(__a3), ref(__a4), ref(__a5)\n#define _GLIBCXX_REF_TEMPLATE_ARGS _T1&, _T2&, _T3&, _T4&, _T5&\n#define _GLIBCXX_NUM_ARGS_PLUS_1 6\n#define _GLIBCXX_T_NUM_ARGS_PLUS_1 _T6\n#include _GLIBCXX_REPEAT_HEADER\n#undef _GLIBCXX_T_NUM_ARGS_PLUS_1\n#undef _GLIBCXX_NUM_ARGS_PLUS_1\n#undef _GLIBCXX_REF_TEMPLATE_ARGS\n#undef _GLIBCXX_REF_WRAP_PARAMS\n#undef _GLIBCXX_TEMPLATE_ARGS_U\n#undef _GLIBCXX_TEMPLATE_PARAMS_U\n#undef _GLIBCXX_TEMPLATE_ARGS_STRIPPED\n#undef _GLIBCXX_TEMPLATE_PARAMS_NULL_CLASS\n#undef _GLIBCXX_TUPLE_ASSIGN\n#undef _GLIBCXX_TUPLE_COPY_INIT\n#undef _GLIBCXX_TUPLE_ADD_CREF\n#undef _GLIBCXX_BIND_V_ARGS\n#undef _GLIBCXX_BIND_V_TEMPLATE_ARGS\n#undef _GLIBCXX_MU_GET_TUPLE_ARGS\n#undef _GLIBCXX_BIND_MEMBERS_INIT\n#undef _GLIBCXX_BIND_MEMBERS\n#undef _GLIBCXX_ARGS_SHIFTED\n#undef _GLIBCXX_PARAMS_SHIFTED\n#undef _GLIBCXX_TEMPLATE_ARGS_SHIFTED\n#undef _GLIBCXX_TEMPLATE_PARAMS_SHIFTED\n#undef _GLIBCXX_COMMA_SHIFTED\n#undef _GLIBCXX_ARGS\n#undef _GLIBCXX_REF_PARAMS\n#undef _GLIBCXX_PARAMS\n#undef _GLIBCXX_TEMPLATE_ARGS\n#undef _GLIBCXX_TEMPLATE_PARAMS\n#undef _GLIBCXX_COMMA\n#undef _GLIBCXX_NUM_ARGS\n#define _GLIBCXX_NUM_ARGS 6\n#define _GLIBCXX_COMMA ,\n#define _GLIBCXX_TEMPLATE_PARAMS typename _T1, typename _T2, typename _T3, typename _T4, typename _T5, typename _T6\n#define _GLIBCXX_TEMPLATE_ARGS _T1, _T2, _T3, _T4, _T5, _T6\n#define _GLIBCXX_PARAMS _T1 __a1, _T2 __a2, _T3 __a3, _T4 __a4, _T5 __a5, _T6 __a6\n#define _GLIBCXX_REF_PARAMS _T1& __a1, _T2& __a2, _T3& __a3, _T4& __a4, _T5& __a5, _T6& __a6\n#define _GLIBCXX_ARGS __a1, __a2, __a3, __a4, __a5, __a6\n#define _GLIBCXX_COMMA_SHIFTED ,\n#define _GLIBCXX_TEMPLATE_PARAMS_SHIFTED typename _T1, typename _T2, typename _T3, typename _T4, typename _T5\n#define _GLIBCXX_TEMPLATE_ARGS_SHIFTED _T1, _T2, _T3, _T4, _T5\n#define _GLIBCXX_PARAMS_SHIFTED _T1 __a1, _T2 __a2, _T3 __a3, _T4 __a4, _T5 __a5\n#define _GLIBCXX_ARGS_SHIFTED __a1, __a2, __a3, __a4, __a5\n#define _GLIBCXX_BIND_MEMBERS _T1 _M_arg1; _T2 _M_arg2; _T3 _M_arg3; _T4 _M_arg4; _T5 _M_arg5; _T6 _M_arg6;\n#define _GLIBCXX_BIND_MEMBERS_INIT _M_arg1(__a1), _M_arg2(__a2), _M_arg3(__a3), _M_arg4(__a4), _M_arg5(__a5), _M_arg6(__a6)\n#define _GLIBCXX_MU_GET_TUPLE_ARGS ::std::tr1::get<0>(__tuple), ::std::tr1::get<1>(__tuple), ::std::tr1::get<2>(__tuple), ::std::tr1::get<3>(__tuple), ::std::tr1::get<4>(__tuple), ::std::tr1::get<5>(__tuple)\n#define _GLIBCXX_BIND_V_TEMPLATE_ARGS(_CV) typename result_of<_Mu<_T1> _CV(_T1, tuple<_GLIBCXX_BIND_TEMPLATE_ARGS>)>::type, typename result_of<_Mu<_T2> _CV(_T2, tuple<_GLIBCXX_BIND_TEMPLATE_ARGS>)>::type, typename result_of<_Mu<_T3> _CV(_T3, tuple<_GLIBCXX_BIND_TEMPLATE_ARGS>)>::type, typename result_of<_Mu<_T4> _CV(_T4, tuple<_GLIBCXX_BIND_TEMPLATE_ARGS>)>::type, typename result_of<_Mu<_T5> _CV(_T5, tuple<_GLIBCXX_BIND_TEMPLATE_ARGS>)>::type, typename result_of<_Mu<_T6> _CV(_T6, tuple<_GLIBCXX_BIND_TEMPLATE_ARGS>)>::type\n#define _GLIBCXX_BIND_V_ARGS _Mu<_T1>()(_M_arg1, ::std::tr1::tie(_GLIBCXX_BIND_ARGS)), _Mu<_T2>()(_M_arg2, ::std::tr1::tie(_GLIBCXX_BIND_ARGS)), _Mu<_T3>()(_M_arg3, ::std::tr1::tie(_GLIBCXX_BIND_ARGS)), _Mu<_T4>()(_M_arg4, ::std::tr1::tie(_GLIBCXX_BIND_ARGS)), _Mu<_T5>()(_M_arg5, ::std::tr1::tie(_GLIBCXX_BIND_ARGS)), _Mu<_T6>()(_M_arg6, ::std::tr1::tie(_GLIBCXX_BIND_ARGS))\n#define _GLIBCXX_TUPLE_ADD_CREF typename __add_c_ref<_T1>::type __a1, typename __add_c_ref<_T2>::type __a2, typename __add_c_ref<_T3>::type __a3, typename __add_c_ref<_T4>::type __a4, typename __add_c_ref<_T5>::type __a5, typename __add_c_ref<_T6>::type __a6\n#define _GLIBCXX_TUPLE_COPY_INIT _M_arg1(__in._M_arg1), _M_arg2(__in._M_arg2), _M_arg3(__in._M_arg3), _M_arg4(__in._M_arg4), _M_arg5(__in._M_arg5), _M_arg6(__in._M_arg6)\n#define _GLIBCXX_TUPLE_ASSIGN _M_arg1 = __in._M_arg1; _M_arg2 = __in._M_arg2; _M_arg3 = __in._M_arg3; _M_arg4 = __in._M_arg4; _M_arg5 = __in._M_arg5; _M_arg6 = __in._M_arg6;\n#define _GLIBCXX_TEMPLATE_PARAMS_NULL_CLASS typename _T1 = _NullClass, typename _T2 = _NullClass, typename _T3 = _NullClass, typename _T4 = _NullClass, typename _T5 = _NullClass, typename _T6 = _NullClass\n#define _GLIBCXX_TEMPLATE_ARGS_STRIPPED typename __strip_reference_wrapper<_T1>::__type, typename __strip_reference_wrapper<_T2>::__type, typename __strip_reference_wrapper<_T3>::__type, typename __strip_reference_wrapper<_T4>::__type, typename __strip_reference_wrapper<_T5>::__type, typename __strip_reference_wrapper<_T6>::__type\n#define _GLIBCXX_TEMPLATE_PARAMS_U typename _U1, typename _U2, typename _U3, typename _U4, typename _U5, typename _U6\n#define _GLIBCXX_TEMPLATE_ARGS_U _U1, _U2, _U3, _U4, _U5, _U6\n#define _GLIBCXX_REF_WRAP_PARAMS ref(__a1), ref(__a2), ref(__a3), ref(__a4), ref(__a5), ref(__a6)\n#define _GLIBCXX_REF_TEMPLATE_ARGS _T1&, _T2&, _T3&, _T4&, _T5&, _T6&\n#define _GLIBCXX_NUM_ARGS_PLUS_1 7\n#define _GLIBCXX_T_NUM_ARGS_PLUS_1 _T7\n#include _GLIBCXX_REPEAT_HEADER\n#undef _GLIBCXX_T_NUM_ARGS_PLUS_1\n#undef _GLIBCXX_NUM_ARGS_PLUS_1\n#undef _GLIBCXX_REF_TEMPLATE_ARGS\n#undef _GLIBCXX_REF_WRAP_PARAMS\n#undef _GLIBCXX_TEMPLATE_ARGS_U\n#undef _GLIBCXX_TEMPLATE_PARAMS_U\n#undef _GLIBCXX_TEMPLATE_ARGS_STRIPPED\n#undef _GLIBCXX_TEMPLATE_PARAMS_NULL_CLASS\n#undef _GLIBCXX_TUPLE_ASSIGN\n#undef _GLIBCXX_TUPLE_COPY_INIT\n#undef _GLIBCXX_TUPLE_ADD_CREF\n#undef _GLIBCXX_BIND_V_ARGS\n#undef _GLIBCXX_BIND_V_TEMPLATE_ARGS\n#undef _GLIBCXX_MU_GET_TUPLE_ARGS\n#undef _GLIBCXX_BIND_MEMBERS_INIT\n#undef _GLIBCXX_BIND_MEMBERS\n#undef _GLIBCXX_ARGS_SHIFTED\n#undef _GLIBCXX_PARAMS_SHIFTED\n#undef _GLIBCXX_TEMPLATE_ARGS_SHIFTED\n#undef _GLIBCXX_TEMPLATE_PARAMS_SHIFTED\n#undef _GLIBCXX_COMMA_SHIFTED\n#undef _GLIBCXX_ARGS\n#undef _GLIBCXX_REF_PARAMS\n#undef _GLIBCXX_PARAMS\n#undef _GLIBCXX_TEMPLATE_ARGS\n#undef _GLIBCXX_TEMPLATE_PARAMS\n#undef _GLIBCXX_COMMA\n#undef _GLIBCXX_NUM_ARGS\n#define _GLIBCXX_NUM_ARGS 7\n#define _GLIBCXX_COMMA ,\n#define _GLIBCXX_TEMPLATE_PARAMS typename _T1, typename _T2, typename _T3, typename _T4, typename _T5, typename _T6, typename _T7\n#define _GLIBCXX_TEMPLATE_ARGS _T1, _T2, _T3, _T4, _T5, _T6, _T7\n#define _GLIBCXX_PARAMS _T1 __a1, _T2 __a2, _T3 __a3, _T4 __a4, _T5 __a5, _T6 __a6, _T7 __a7\n#define _GLIBCXX_REF_PARAMS _T1& __a1, _T2& __a2, _T3& __a3, _T4& __a4, _T5& __a5, _T6& __a6, _T7& __a7\n#define _GLIBCXX_ARGS __a1, __a2, __a3, __a4, __a5, __a6, __a7\n#define _GLIBCXX_COMMA_SHIFTED ,\n#define _GLIBCXX_TEMPLATE_PARAMS_SHIFTED typename _T1, typename _T2, typename _T3, typename _T4, typename _T5, typename _T6\n#define _GLIBCXX_TEMPLATE_ARGS_SHIFTED _T1, _T2, _T3, _T4, _T5, _T6\n#define _GLIBCXX_PARAMS_SHIFTED _T1 __a1, _T2 __a2, _T3 __a3, _T4 __a4, _T5 __a5, _T6 __a6\n#define _GLIBCXX_ARGS_SHIFTED __a1, __a2, __a3, __a4, __a5, __a6\n#define _GLIBCXX_BIND_MEMBERS _T1 _M_arg1; _T2 _M_arg2; _T3 _M_arg3; _T4 _M_arg4; _T5 _M_arg5; _T6 _M_arg6; _T7 _M_arg7;\n#define _GLIBCXX_BIND_MEMBERS_INIT _M_arg1(__a1), _M_arg2(__a2), _M_arg3(__a3), _M_arg4(__a4), _M_arg5(__a5), _M_arg6(__a6), _M_arg7(__a7)\n#define _GLIBCXX_MU_GET_TUPLE_ARGS ::std::tr1::get<0>(__tuple), ::std::tr1::get<1>(__tuple), ::std::tr1::get<2>(__tuple), ::std::tr1::get<3>(__tuple), ::std::tr1::get<4>(__tuple), ::std::tr1::get<5>(__tuple), ::std::tr1::get<6>(__tuple)\n#define _GLIBCXX_BIND_V_TEMPLATE_ARGS(_CV) typename result_of<_Mu<_T1> _CV(_T1, tuple<_GLIBCXX_BIND_TEMPLATE_ARGS>)>::type, typename result_of<_Mu<_T2> _CV(_T2, tuple<_GLIBCXX_BIND_TEMPLATE_ARGS>)>::type, typename result_of<_Mu<_T3> _CV(_T3, tuple<_GLIBCXX_BIND_TEMPLATE_ARGS>)>::type, typename result_of<_Mu<_T4> _CV(_T4, tuple<_GLIBCXX_BIND_TEMPLATE_ARGS>)>::type, typename result_of<_Mu<_T5> _CV(_T5, tuple<_GLIBCXX_BIND_TEMPLATE_ARGS>)>::type, typename result_of<_Mu<_T6> _CV(_T6, tuple<_GLIBCXX_BIND_TEMPLATE_ARGS>)>::type, typename result_of<_Mu<_T7> _CV(_T7, tuple<_GLIBCXX_BIND_TEMPLATE_ARGS>)>::type\n#define _GLIBCXX_BIND_V_ARGS _Mu<_T1>()(_M_arg1, ::std::tr1::tie(_GLIBCXX_BIND_ARGS)), _Mu<_T2>()(_M_arg2, ::std::tr1::tie(_GLIBCXX_BIND_ARGS)), _Mu<_T3>()(_M_arg3, ::std::tr1::tie(_GLIBCXX_BIND_ARGS)), _Mu<_T4>()(_M_arg4, ::std::tr1::tie(_GLIBCXX_BIND_ARGS)), _Mu<_T5>()(_M_arg5, ::std::tr1::tie(_GLIBCXX_BIND_ARGS)), _Mu<_T6>()(_M_arg6, ::std::tr1::tie(_GLIBCXX_BIND_ARGS)), _Mu<_T7>()(_M_arg7, ::std::tr1::tie(_GLIBCXX_BIND_ARGS))\n#define _GLIBCXX_TUPLE_ADD_CREF typename __add_c_ref<_T1>::type __a1, typename __add_c_ref<_T2>::type __a2, typename __add_c_ref<_T3>::type __a3, typename __add_c_ref<_T4>::type __a4, typename __add_c_ref<_T5>::type __a5, typename __add_c_ref<_T6>::type __a6, typename __add_c_ref<_T7>::type __a7\n#define _GLIBCXX_TUPLE_COPY_INIT _M_arg1(__in._M_arg1), _M_arg2(__in._M_arg2), _M_arg3(__in._M_arg3), _M_arg4(__in._M_arg4), _M_arg5(__in._M_arg5), _M_arg6(__in._M_arg6), _M_arg7(__in._M_arg7)\n#define _GLIBCXX_TUPLE_ASSIGN _M_arg1 = __in._M_arg1; _M_arg2 = __in._M_arg2; _M_arg3 = __in._M_arg3; _M_arg4 = __in._M_arg4; _M_arg5 = __in._M_arg5; _M_arg6 = __in._M_arg6; _M_arg7 = __in._M_arg7;\n#define _GLIBCXX_TEMPLATE_PARAMS_NULL_CLASS typename _T1 = _NullClass, typename _T2 = _NullClass, typename _T3 = _NullClass, typename _T4 = _NullClass, typename _T5 = _NullClass, typename _T6 = _NullClass, typename _T7 = _NullClass\n#define _GLIBCXX_TEMPLATE_ARGS_STRIPPED typename __strip_reference_wrapper<_T1>::__type, typename __strip_reference_wrapper<_T2>::__type, typename __strip_reference_wrapper<_T3>::__type, typename __strip_reference_wrapper<_T4>::__type, typename __strip_reference_wrapper<_T5>::__type, typename __strip_reference_wrapper<_T6>::__type, typename __strip_reference_wrapper<_T7>::__type\n#define _GLIBCXX_TEMPLATE_PARAMS_U typename _U1, typename _U2, typename _U3, typename _U4, typename _U5, typename _U6, typename _U7\n#define _GLIBCXX_TEMPLATE_ARGS_U _U1, _U2, _U3, _U4, _U5, _U6, _U7\n#define _GLIBCXX_REF_WRAP_PARAMS ref(__a1), ref(__a2), ref(__a3), ref(__a4), ref(__a5), ref(__a6), ref(__a7)\n#define _GLIBCXX_REF_TEMPLATE_ARGS _T1&, _T2&, _T3&, _T4&, _T5&, _T6&, _T7&\n#define _GLIBCXX_NUM_ARGS_PLUS_1 8\n#define _GLIBCXX_T_NUM_ARGS_PLUS_1 _T8\n#include _GLIBCXX_REPEAT_HEADER\n#undef _GLIBCXX_T_NUM_ARGS_PLUS_1\n#undef _GLIBCXX_NUM_ARGS_PLUS_1\n#undef _GLIBCXX_REF_TEMPLATE_ARGS\n#undef _GLIBCXX_REF_WRAP_PARAMS\n#undef _GLIBCXX_TEMPLATE_ARGS_U\n#undef _GLIBCXX_TEMPLATE_PARAMS_U\n#undef _GLIBCXX_TEMPLATE_ARGS_STRIPPED\n#undef _GLIBCXX_TEMPLATE_PARAMS_NULL_CLASS\n#undef _GLIBCXX_TUPLE_ASSIGN\n#undef _GLIBCXX_TUPLE_COPY_INIT\n#undef _GLIBCXX_TUPLE_ADD_CREF\n#undef _GLIBCXX_BIND_V_ARGS\n#undef _GLIBCXX_BIND_V_TEMPLATE_ARGS\n#undef _GLIBCXX_MU_GET_TUPLE_ARGS\n#undef _GLIBCXX_BIND_MEMBERS_INIT\n#undef _GLIBCXX_BIND_MEMBERS\n#undef _GLIBCXX_ARGS_SHIFTED\n#undef _GLIBCXX_PARAMS_SHIFTED\n#undef _GLIBCXX_TEMPLATE_ARGS_SHIFTED\n#undef _GLIBCXX_TEMPLATE_PARAMS_SHIFTED\n#undef _GLIBCXX_COMMA_SHIFTED\n#undef _GLIBCXX_ARGS\n#undef _GLIBCXX_REF_PARAMS\n#undef _GLIBCXX_PARAMS\n#undef _GLIBCXX_TEMPLATE_ARGS\n#undef _GLIBCXX_TEMPLATE_PARAMS\n#undef _GLIBCXX_COMMA\n#undef _GLIBCXX_NUM_ARGS\n#define _GLIBCXX_NUM_ARGS 8\n#define _GLIBCXX_COMMA ,\n#define _GLIBCXX_TEMPLATE_PARAMS typename _T1, typename _T2, typename _T3, typename _T4, typename _T5, typename _T6, typename _T7, typename _T8\n#define _GLIBCXX_TEMPLATE_ARGS _T1, _T2, _T3, _T4, _T5, _T6, _T7, _T8\n#define _GLIBCXX_PARAMS _T1 __a1, _T2 __a2, _T3 __a3, _T4 __a4, _T5 __a5, _T6 __a6, _T7 __a7, _T8 __a8\n#define _GLIBCXX_REF_PARAMS _T1& __a1, _T2& __a2, _T3& __a3, _T4& __a4, _T5& __a5, _T6& __a6, _T7& __a7, _T8& __a8\n#define _GLIBCXX_ARGS __a1, __a2, __a3, __a4, __a5, __a6, __a7, __a8\n#define _GLIBCXX_COMMA_SHIFTED ,\n#define _GLIBCXX_TEMPLATE_PARAMS_SHIFTED typename _T1, typename _T2, typename _T3, typename _T4, typename _T5, typename _T6, typename _T7\n#define _GLIBCXX_TEMPLATE_ARGS_SHIFTED _T1, _T2, _T3, _T4, _T5, _T6, _T7\n#define _GLIBCXX_PARAMS_SHIFTED _T1 __a1, _T2 __a2, _T3 __a3, _T4 __a4, _T5 __a5, _T6 __a6, _T7 __a7\n#define _GLIBCXX_ARGS_SHIFTED __a1, __a2, __a3, __a4, __a5, __a6, __a7\n#define _GLIBCXX_BIND_MEMBERS _T1 _M_arg1; _T2 _M_arg2; _T3 _M_arg3; _T4 _M_arg4; _T5 _M_arg5; _T6 _M_arg6; _T7 _M_arg7; _T8 _M_arg8;\n#define _GLIBCXX_BIND_MEMBERS_INIT _M_arg1(__a1), _M_arg2(__a2), _M_arg3(__a3), _M_arg4(__a4), _M_arg5(__a5), _M_arg6(__a6), _M_arg7(__a7), _M_arg8(__a8)\n#define _GLIBCXX_MU_GET_TUPLE_ARGS ::std::tr1::get<0>(__tuple), ::std::tr1::get<1>(__tuple), ::std::tr1::get<2>(__tuple), ::std::tr1::get<3>(__tuple), ::std::tr1::get<4>(__tuple), ::std::tr1::get<5>(__tuple), ::std::tr1::get<6>(__tuple), ::std::tr1::get<7>(__tuple)\n#define _GLIBCXX_BIND_V_TEMPLATE_ARGS(_CV) typename result_of<_Mu<_T1> _CV(_T1, tuple<_GLIBCXX_BIND_TEMPLATE_ARGS>)>::type, typename result_of<_Mu<_T2> _CV(_T2, tuple<_GLIBCXX_BIND_TEMPLATE_ARGS>)>::type, typename result_of<_Mu<_T3> _CV(_T3, tuple<_GLIBCXX_BIND_TEMPLATE_ARGS>)>::type, typename result_of<_Mu<_T4> _CV(_T4, tuple<_GLIBCXX_BIND_TEMPLATE_ARGS>)>::type, typename result_of<_Mu<_T5> _CV(_T5, tuple<_GLIBCXX_BIND_TEMPLATE_ARGS>)>::type, typename result_of<_Mu<_T6> _CV(_T6, tuple<_GLIBCXX_BIND_TEMPLATE_ARGS>)>::type, typename result_of<_Mu<_T7> _CV(_T7, tuple<_GLIBCXX_BIND_TEMPLATE_ARGS>)>::type, typename result_of<_Mu<_T8> _CV(_T8, tuple<_GLIBCXX_BIND_TEMPLATE_ARGS>)>::type\n#define _GLIBCXX_BIND_V_ARGS _Mu<_T1>()(_M_arg1, ::std::tr1::tie(_GLIBCXX_BIND_ARGS)), _Mu<_T2>()(_M_arg2, ::std::tr1::tie(_GLIBCXX_BIND_ARGS)), _Mu<_T3>()(_M_arg3, ::std::tr1::tie(_GLIBCXX_BIND_ARGS)), _Mu<_T4>()(_M_arg4, ::std::tr1::tie(_GLIBCXX_BIND_ARGS)), _Mu<_T5>()(_M_arg5, ::std::tr1::tie(_GLIBCXX_BIND_ARGS)), _Mu<_T6>()(_M_arg6, ::std::tr1::tie(_GLIBCXX_BIND_ARGS)), _Mu<_T7>()(_M_arg7, ::std::tr1::tie(_GLIBCXX_BIND_ARGS)), _Mu<_T8>()(_M_arg8, ::std::tr1::tie(_GLIBCXX_BIND_ARGS))\n#define _GLIBCXX_TUPLE_ADD_CREF typename __add_c_ref<_T1>::type __a1, typename __add_c_ref<_T2>::type __a2, typename __add_c_ref<_T3>::type __a3, typename __add_c_ref<_T4>::type __a4, typename __add_c_ref<_T5>::type __a5, typename __add_c_ref<_T6>::type __a6, typename __add_c_ref<_T7>::type __a7, typename __add_c_ref<_T8>::type __a8\n#define _GLIBCXX_TUPLE_COPY_INIT _M_arg1(__in._M_arg1), _M_arg2(__in._M_arg2), _M_arg3(__in._M_arg3), _M_arg4(__in._M_arg4), _M_arg5(__in._M_arg5), _M_arg6(__in._M_arg6), _M_arg7(__in._M_arg7), _M_arg8(__in._M_arg8)\n#define _GLIBCXX_TUPLE_ASSIGN _M_arg1 = __in._M_arg1; _M_arg2 = __in._M_arg2; _M_arg3 = __in._M_arg3; _M_arg4 = __in._M_arg4; _M_arg5 = __in._M_arg5; _M_arg6 = __in._M_arg6; _M_arg7 = __in._M_arg7; _M_arg8 = __in._M_arg8;\n#define _GLIBCXX_TEMPLATE_PARAMS_NULL_CLASS typename _T1 = _NullClass, typename _T2 = _NullClass, typename _T3 = _NullClass, typename _T4 = _NullClass, typename _T5 = _NullClass, typename _T6 = _NullClass, typename _T7 = _NullClass, typename _T8 = _NullClass\n#define _GLIBCXX_TEMPLATE_ARGS_STRIPPED typename __strip_reference_wrapper<_T1>::__type, typename __strip_reference_wrapper<_T2>::__type, typename __strip_reference_wrapper<_T3>::__type, typename __strip_reference_wrapper<_T4>::__type, typename __strip_reference_wrapper<_T5>::__type, typename __strip_reference_wrapper<_T6>::__type, typename __strip_reference_wrapper<_T7>::__type, typename __strip_reference_wrapper<_T8>::__type\n#define _GLIBCXX_TEMPLATE_PARAMS_U typename _U1, typename _U2, typename _U3, typename _U4, typename _U5, typename _U6, typename _U7, typename _U8\n#define _GLIBCXX_TEMPLATE_ARGS_U _U1, _U2, _U3, _U4, _U5, _U6, _U7, _U8\n#define _GLIBCXX_REF_WRAP_PARAMS ref(__a1), ref(__a2), ref(__a3), ref(__a4), ref(__a5), ref(__a6), ref(__a7), ref(__a8)\n#define _GLIBCXX_REF_TEMPLATE_ARGS _T1&, _T2&, _T3&, _T4&, _T5&, _T6&, _T7&, _T8&\n#define _GLIBCXX_NUM_ARGS_PLUS_1 9\n#define _GLIBCXX_T_NUM_ARGS_PLUS_1 _T9\n#include _GLIBCXX_REPEAT_HEADER\n#undef _GLIBCXX_T_NUM_ARGS_PLUS_1\n#undef _GLIBCXX_NUM_ARGS_PLUS_1\n#undef _GLIBCXX_REF_TEMPLATE_ARGS\n#undef _GLIBCXX_REF_WRAP_PARAMS\n#undef _GLIBCXX_TEMPLATE_ARGS_U\n#undef _GLIBCXX_TEMPLATE_PARAMS_U\n#undef _GLIBCXX_TEMPLATE_ARGS_STRIPPED\n#undef _GLIBCXX_TEMPLATE_PARAMS_NULL_CLASS\n#undef _GLIBCXX_TUPLE_ASSIGN\n#undef _GLIBCXX_TUPLE_COPY_INIT\n#undef _GLIBCXX_TUPLE_ADD_CREF\n#undef _GLIBCXX_BIND_V_ARGS\n#undef _GLIBCXX_BIND_V_TEMPLATE_ARGS\n#undef _GLIBCXX_MU_GET_TUPLE_ARGS\n#undef _GLIBCXX_BIND_MEMBERS_INIT\n#undef _GLIBCXX_BIND_MEMBERS\n#undef _GLIBCXX_ARGS_SHIFTED\n#undef _GLIBCXX_PARAMS_SHIFTED\n#undef _GLIBCXX_TEMPLATE_ARGS_SHIFTED\n#undef _GLIBCXX_TEMPLATE_PARAMS_SHIFTED\n#undef _GLIBCXX_COMMA_SHIFTED\n#undef _GLIBCXX_ARGS\n#undef _GLIBCXX_REF_PARAMS\n#undef _GLIBCXX_PARAMS\n#undef _GLIBCXX_TEMPLATE_ARGS\n#undef _GLIBCXX_TEMPLATE_PARAMS\n#undef _GLIBCXX_COMMA\n#undef _GLIBCXX_NUM_ARGS\n#define _GLIBCXX_NUM_ARGS 9\n#define _GLIBCXX_COMMA ,\n#define _GLIBCXX_TEMPLATE_PARAMS typename _T1, typename _T2, typename _T3, typename _T4, typename _T5, typename _T6, typename _T7, typename _T8, typename _T9\n#define _GLIBCXX_TEMPLATE_ARGS _T1, _T2, _T3, _T4, _T5, _T6, _T7, _T8, _T9\n#define _GLIBCXX_PARAMS _T1 __a1, _T2 __a2, _T3 __a3, _T4 __a4, _T5 __a5, _T6 __a6, _T7 __a7, _T8 __a8, _T9 __a9\n#define _GLIBCXX_REF_PARAMS _T1& __a1, _T2& __a2, _T3& __a3, _T4& __a4, _T5& __a5, _T6& __a6, _T7& __a7, _T8& __a8, _T9& __a9\n#define _GLIBCXX_ARGS __a1, __a2, __a3, __a4, __a5, __a6, __a7, __a8, __a9\n#define _GLIBCXX_COMMA_SHIFTED ,\n#define _GLIBCXX_TEMPLATE_PARAMS_SHIFTED typename _T1, typename _T2, typename _T3, typename _T4, typename _T5, typename _T6, typename _T7, typename _T8\n#define _GLIBCXX_TEMPLATE_ARGS_SHIFTED _T1, _T2, _T3, _T4, _T5, _T6, _T7, _T8\n#define _GLIBCXX_PARAMS_SHIFTED _T1 __a1, _T2 __a2, _T3 __a3, _T4 __a4, _T5 __a5, _T6 __a6, _T7 __a7, _T8 __a8\n#define _GLIBCXX_ARGS_SHIFTED __a1, __a2, __a3, __a4, __a5, __a6, __a7, __a8\n#define _GLIBCXX_BIND_MEMBERS _T1 _M_arg1; _T2 _M_arg2; _T3 _M_arg3; _T4 _M_arg4; _T5 _M_arg5; _T6 _M_arg6; _T7 _M_arg7; _T8 _M_arg8; _T9 _M_arg9;\n#define _GLIBCXX_BIND_MEMBERS_INIT _M_arg1(__a1), _M_arg2(__a2), _M_arg3(__a3), _M_arg4(__a4), _M_arg5(__a5), _M_arg6(__a6), _M_arg7(__a7), _M_arg8(__a8), _M_arg9(__a9)\n#define _GLIBCXX_MU_GET_TUPLE_ARGS ::std::tr1::get<0>(__tuple), ::std::tr1::get<1>(__tuple), ::std::tr1::get<2>(__tuple), ::std::tr1::get<3>(__tuple), ::std::tr1::get<4>(__tuple), ::std::tr1::get<5>(__tuple), ::std::tr1::get<6>(__tuple), ::std::tr1::get<7>(__tuple), ::std::tr1::get<8>(__tuple)\n#define _GLIBCXX_BIND_V_TEMPLATE_ARGS(_CV) typename result_of<_Mu<_T1> _CV(_T1, tuple<_GLIBCXX_BIND_TEMPLATE_ARGS>)>::type, typename result_of<_Mu<_T2> _CV(_T2, tuple<_GLIBCXX_BIND_TEMPLATE_ARGS>)>::type, typename result_of<_Mu<_T3> _CV(_T3, tuple<_GLIBCXX_BIND_TEMPLATE_ARGS>)>::type, typename result_of<_Mu<_T4> _CV(_T4, tuple<_GLIBCXX_BIND_TEMPLATE_ARGS>)>::type, typename result_of<_Mu<_T5> _CV(_T5, tuple<_GLIBCXX_BIND_TEMPLATE_ARGS>)>::type, typename result_of<_Mu<_T6> _CV(_T6, tuple<_GLIBCXX_BIND_TEMPLATE_ARGS>)>::type, typename result_of<_Mu<_T7> _CV(_T7, tuple<_GLIBCXX_BIND_TEMPLATE_ARGS>)>::type, typename result_of<_Mu<_T8> _CV(_T8, tuple<_GLIBCXX_BIND_TEMPLATE_ARGS>)>::type, typename result_of<_Mu<_T9> _CV(_T9, tuple<_GLIBCXX_BIND_TEMPLATE_ARGS>)>::type\n#define _GLIBCXX_BIND_V_ARGS _Mu<_T1>()(_M_arg1, ::std::tr1::tie(_GLIBCXX_BIND_ARGS)), _Mu<_T2>()(_M_arg2, ::std::tr1::tie(_GLIBCXX_BIND_ARGS)), _Mu<_T3>()(_M_arg3, ::std::tr1::tie(_GLIBCXX_BIND_ARGS)), _Mu<_T4>()(_M_arg4, ::std::tr1::tie(_GLIBCXX_BIND_ARGS)), _Mu<_T5>()(_M_arg5, ::std::tr1::tie(_GLIBCXX_BIND_ARGS)), _Mu<_T6>()(_M_arg6, ::std::tr1::tie(_GLIBCXX_BIND_ARGS)), _Mu<_T7>()(_M_arg7, ::std::tr1::tie(_GLIBCXX_BIND_ARGS)), _Mu<_T8>()(_M_arg8, ::std::tr1::tie(_GLIBCXX_BIND_ARGS)), _Mu<_T9>()(_M_arg9, ::std::tr1::tie(_GLIBCXX_BIND_ARGS))\n#define _GLIBCXX_TUPLE_ADD_CREF typename __add_c_ref<_T1>::type __a1, typename __add_c_ref<_T2>::type __a2, typename __add_c_ref<_T3>::type __a3, typename __add_c_ref<_T4>::type __a4, typename __add_c_ref<_T5>::type __a5, typename __add_c_ref<_T6>::type __a6, typename __add_c_ref<_T7>::type __a7, typename __add_c_ref<_T8>::type __a8, typename __add_c_ref<_T9>::type __a9\n#define _GLIBCXX_TUPLE_COPY_INIT _M_arg1(__in._M_arg1), _M_arg2(__in._M_arg2), _M_arg3(__in._M_arg3), _M_arg4(__in._M_arg4), _M_arg5(__in._M_arg5), _M_arg6(__in._M_arg6), _M_arg7(__in._M_arg7), _M_arg8(__in._M_arg8), _M_arg9(__in._M_arg9)\n#define _GLIBCXX_TUPLE_ASSIGN _M_arg1 = __in._M_arg1; _M_arg2 = __in._M_arg2; _M_arg3 = __in._M_arg3; _M_arg4 = __in._M_arg4; _M_arg5 = __in._M_arg5; _M_arg6 = __in._M_arg6; _M_arg7 = __in._M_arg7; _M_arg8 = __in._M_arg8; _M_arg9 = __in._M_arg9;\n#define _GLIBCXX_TEMPLATE_PARAMS_NULL_CLASS typename _T1 = _NullClass, typename _T2 = _NullClass, typename _T3 = _NullClass, typename _T4 = _NullClass, typename _T5 = _NullClass, typename _T6 = _NullClass, typename _T7 = _NullClass, typename _T8 = _NullClass, typename _T9 = _NullClass\n#define _GLIBCXX_TEMPLATE_ARGS_STRIPPED typename __strip_reference_wrapper<_T1>::__type, typename __strip_reference_wrapper<_T2>::__type, typename __strip_reference_wrapper<_T3>::__type, typename __strip_reference_wrapper<_T4>::__type, typename __strip_reference_wrapper<_T5>::__type, typename __strip_reference_wrapper<_T6>::__type, typename __strip_reference_wrapper<_T7>::__type, typename __strip_reference_wrapper<_T8>::__type, typename __strip_reference_wrapper<_T9>::__type\n#define _GLIBCXX_TEMPLATE_PARAMS_U typename _U1, typename _U2, typename _U3, typename _U4, typename _U5, typename _U6, typename _U7, typename _U8, typename _U9\n#define _GLIBCXX_TEMPLATE_ARGS_U _U1, _U2, _U3, _U4, _U5, _U6, _U7, _U8, _U9\n#define _GLIBCXX_REF_WRAP_PARAMS ref(__a1), ref(__a2), ref(__a3), ref(__a4), ref(__a5), ref(__a6), ref(__a7), ref(__a8), ref(__a9)\n#define _GLIBCXX_REF_TEMPLATE_ARGS _T1&, _T2&, _T3&, _T4&, _T5&, _T6&, _T7&, _T8&, _T9&\n#define _GLIBCXX_NUM_ARGS_PLUS_1 10\n#define _GLIBCXX_T_NUM_ARGS_PLUS_1 _T10\n#include _GLIBCXX_REPEAT_HEADER\n#undef _GLIBCXX_T_NUM_ARGS_PLUS_1\n#undef _GLIBCXX_NUM_ARGS_PLUS_1\n#undef _GLIBCXX_REF_TEMPLATE_ARGS\n#undef _GLIBCXX_REF_WRAP_PARAMS\n#undef _GLIBCXX_TEMPLATE_ARGS_U\n#undef _GLIBCXX_TEMPLATE_PARAMS_U\n#undef _GLIBCXX_TEMPLATE_ARGS_STRIPPED\n#undef _GLIBCXX_TEMPLATE_PARAMS_NULL_CLASS\n#undef _GLIBCXX_TUPLE_ASSIGN\n#undef _GLIBCXX_TUPLE_COPY_INIT\n#undef _GLIBCXX_TUPLE_ADD_CREF\n#undef _GLIBCXX_BIND_V_ARGS\n#undef _GLIBCXX_BIND_V_TEMPLATE_ARGS\n#undef _GLIBCXX_MU_GET_TUPLE_ARGS\n#undef _GLIBCXX_BIND_MEMBERS_INIT\n#undef _GLIBCXX_BIND_MEMBERS\n#undef _GLIBCXX_ARGS_SHIFTED\n#undef _GLIBCXX_PARAMS_SHIFTED\n#undef _GLIBCXX_TEMPLATE_ARGS_SHIFTED\n#undef _GLIBCXX_TEMPLATE_PARAMS_SHIFTED\n#undef _GLIBCXX_COMMA_SHIFTED\n#undef _GLIBCXX_ARGS\n#undef _GLIBCXX_REF_PARAMS\n#undef _GLIBCXX_PARAMS\n#undef _GLIBCXX_TEMPLATE_ARGS\n#undef _GLIBCXX_TEMPLATE_PARAMS\n#undef _GLIBCXX_COMMA\n#undef _GLIBCXX_NUM_ARGS\n#define _GLIBCXX_LAST_INCLUDE\n#define _GLIBCXX_NUM_ARGS 10\n#define _GLIBCXX_COMMA ,\n#define _GLIBCXX_TEMPLATE_PARAMS typename _T1, typename _T2, typename _T3, typename _T4, typename _T5, typename _T6, typename _T7, typename _T8, typename _T9, typename _T10\n#define _GLIBCXX_TEMPLATE_ARGS _T1, _T2, _T3, _T4, _T5, _T6, _T7, _T8, _T9, _T10\n#define _GLIBCXX_PARAMS _T1 __a1, _T2 __a2, _T3 __a3, _T4 __a4, _T5 __a5, _T6 __a6, _T7 __a7, _T8 __a8, _T9 __a9, _T10 __a10\n#define _GLIBCXX_REF_PARAMS _T1& __a1, _T2& __a2, _T3& __a3, _T4& __a4, _T5& __a5, _T6& __a6, _T7& __a7, _T8& __a8, _T9& __a9, _T10& __a10\n#define _GLIBCXX_ARGS __a1, __a2, __a3, __a4, __a5, __a6, __a7, __a8, __a9, __a10\n#define _GLIBCXX_COMMA_SHIFTED ,\n#define _GLIBCXX_TEMPLATE_PARAMS_SHIFTED typename _T1, typename _T2, typename _T3, typename _T4, typename _T5, typename _T6, typename _T7, typename _T8, typename _T9\n#define _GLIBCXX_TEMPLATE_ARGS_SHIFTED _T1, _T2, _T3, _T4, _T5, _T6, _T7, _T8, _T9\n#define _GLIBCXX_PARAMS_SHIFTED _T1 __a1, _T2 __a2, _T3 __a3, _T4 __a4, _T5 __a5, _T6 __a6, _T7 __a7, _T8 __a8, _T9 __a9\n#define _GLIBCXX_ARGS_SHIFTED __a1, __a2, __a3, __a4, __a5, __a6, __a7, __a8, __a9\n#define _GLIBCXX_BIND_MEMBERS _T1 _M_arg1; _T2 _M_arg2; _T3 _M_arg3; _T4 _M_arg4; _T5 _M_arg5; _T6 _M_arg6; _T7 _M_arg7; _T8 _M_arg8; _T9 _M_arg9; _T10 _M_arg10;\n#define _GLIBCXX_BIND_MEMBERS_INIT _M_arg1(__a1), _M_arg2(__a2), _M_arg3(__a3), _M_arg4(__a4), _M_arg5(__a5), _M_arg6(__a6), _M_arg7(__a7), _M_arg8(__a8), _M_arg9(__a9), _M_arg10(__a10)\n#define _GLIBCXX_MU_GET_TUPLE_ARGS ::std::tr1::get<0>(__tuple), ::std::tr1::get<1>(__tuple), ::std::tr1::get<2>(__tuple), ::std::tr1::get<3>(__tuple), ::std::tr1::get<4>(__tuple), ::std::tr1::get<5>(__tuple), ::std::tr1::get<6>(__tuple), ::std::tr1::get<7>(__tuple), ::std::tr1::get<8>(__tuple), ::std::tr1::get<9>(__tuple)\n#define _GLIBCXX_BIND_V_TEMPLATE_ARGS(_CV) typename result_of<_Mu<_T1> _CV(_T1, tuple<_GLIBCXX_BIND_TEMPLATE_ARGS>)>::type, typename result_of<_Mu<_T2> _CV(_T2, tuple<_GLIBCXX_BIND_TEMPLATE_ARGS>)>::type, typename result_of<_Mu<_T3> _CV(_T3, tuple<_GLIBCXX_BIND_TEMPLATE_ARGS>)>::type, typename result_of<_Mu<_T4> _CV(_T4, tuple<_GLIBCXX_BIND_TEMPLATE_ARGS>)>::type, typename result_of<_Mu<_T5> _CV(_T5, tuple<_GLIBCXX_BIND_TEMPLATE_ARGS>)>::type, typename result_of<_Mu<_T6> _CV(_T6, tuple<_GLIBCXX_BIND_TEMPLATE_ARGS>)>::type, typename result_of<_Mu<_T7> _CV(_T7, tuple<_GLIBCXX_BIND_TEMPLATE_ARGS>)>::type, typename result_of<_Mu<_T8> _CV(_T8, tuple<_GLIBCXX_BIND_TEMPLATE_ARGS>)>::type, typename result_of<_Mu<_T9> _CV(_T9, tuple<_GLIBCXX_BIND_TEMPLATE_ARGS>)>::type, typename result_of<_Mu<_T10> _CV(_T10, tuple<_GLIBCXX_BIND_TEMPLATE_ARGS>)>::type\n#define _GLIBCXX_BIND_V_ARGS _Mu<_T1>()(_M_arg1, ::std::tr1::tie(_GLIBCXX_BIND_ARGS)), _Mu<_T2>()(_M_arg2, ::std::tr1::tie(_GLIBCXX_BIND_ARGS)), _Mu<_T3>()(_M_arg3, ::std::tr1::tie(_GLIBCXX_BIND_ARGS)), _Mu<_T4>()(_M_arg4, ::std::tr1::tie(_GLIBCXX_BIND_ARGS)), _Mu<_T5>()(_M_arg5, ::std::tr1::tie(_GLIBCXX_BIND_ARGS)), _Mu<_T6>()(_M_arg6, ::std::tr1::tie(_GLIBCXX_BIND_ARGS)), _Mu<_T7>()(_M_arg7, ::std::tr1::tie(_GLIBCXX_BIND_ARGS)), _Mu<_T8>()(_M_arg8, ::std::tr1::tie(_GLIBCXX_BIND_ARGS)), _Mu<_T9>()(_M_arg9, ::std::tr1::tie(_GLIBCXX_BIND_ARGS)), _Mu<_T10>()(_M_arg10, ::std::tr1::tie(_GLIBCXX_BIND_ARGS))\n#define _GLIBCXX_TUPLE_ADD_CREF typename __add_c_ref<_T1>::type __a1, typename __add_c_ref<_T2>::type __a2, typename __add_c_ref<_T3>::type __a3, typename __add_c_ref<_T4>::type __a4, typename __add_c_ref<_T5>::type __a5, typename __add_c_ref<_T6>::type __a6, typename __add_c_ref<_T7>::type __a7, typename __add_c_ref<_T8>::type __a8, typename __add_c_ref<_T9>::type __a9, typename __add_c_ref<_T10>::type __a10\n#define _GLIBCXX_TUPLE_COPY_INIT _M_arg1(__in._M_arg1), _M_arg2(__in._M_arg2), _M_arg3(__in._M_arg3), _M_arg4(__in._M_arg4), _M_arg5(__in._M_arg5), _M_arg6(__in._M_arg6), _M_arg7(__in._M_arg7), _M_arg8(__in._M_arg8), _M_arg9(__in._M_arg9), _M_arg10(__in._M_arg10)\n#define _GLIBCXX_TUPLE_ASSIGN _M_arg1 = __in._M_arg1; _M_arg2 = __in._M_arg2; _M_arg3 = __in._M_arg3; _M_arg4 = __in._M_arg4; _M_arg5 = __in._M_arg5; _M_arg6 = __in._M_arg6; _M_arg7 = __in._M_arg7; _M_arg8 = __in._M_arg8; _M_arg9 = __in._M_arg9; _M_arg10 = __in._M_arg10;\n#define _GLIBCXX_TEMPLATE_PARAMS_NULL_CLASS typename _T1 = _NullClass, typename _T2 = _NullClass, typename _T3 = _NullClass, typename _T4 = _NullClass, typename _T5 = _NullClass, typename _T6 = _NullClass, typename _T7 = _NullClass, typename _T8 = _NullClass, typename _T9 = _NullClass, typename _T10 = _NullClass\n#define _GLIBCXX_TEMPLATE_ARGS_STRIPPED typename __strip_reference_wrapper<_T1>::__type, typename __strip_reference_wrapper<_T2>::__type, typename __strip_reference_wrapper<_T3>::__type, typename __strip_reference_wrapper<_T4>::__type, typename __strip_reference_wrapper<_T5>::__type, typename __strip_reference_wrapper<_T6>::__type, typename __strip_reference_wrapper<_T7>::__type, typename __strip_reference_wrapper<_T8>::__type, typename __strip_reference_wrapper<_T9>::__type, typename __strip_reference_wrapper<_T10>::__type\n#define _GLIBCXX_TEMPLATE_PARAMS_U typename _U1, typename _U2, typename _U3, typename _U4, typename _U5, typename _U6, typename _U7, typename _U8, typename _U9, typename _U10\n#define _GLIBCXX_TEMPLATE_ARGS_U _U1, _U2, _U3, _U4, _U5, _U6, _U7, _U8, _U9, _U10\n#define _GLIBCXX_REF_WRAP_PARAMS ref(__a1), ref(__a2), ref(__a3), ref(__a4), ref(__a5), ref(__a6), ref(__a7), ref(__a8), ref(__a9), ref(__a10)\n#define _GLIBCXX_REF_TEMPLATE_ARGS _T1&, _T2&, _T3&, _T4&, _T5&, _T6&, _T7&, _T8&, _T9&, _T10&\n#define _GLIBCXX_NUM_ARGS_PLUS_1 11\n#define _GLIBCXX_T_NUM_ARGS_PLUS_1 _T11\n#include _GLIBCXX_REPEAT_HEADER\n#undef _GLIBCXX_T_NUM_ARGS_PLUS_1\n#undef _GLIBCXX_NUM_ARGS_PLUS_1\n#undef _GLIBCXX_REF_TEMPLATE_ARGS\n#undef _GLIBCXX_REF_WRAP_PARAMS\n#undef _GLIBCXX_TEMPLATE_ARGS_U\n#undef _GLIBCXX_TEMPLATE_PARAMS_U\n#undef _GLIBCXX_TEMPLATE_ARGS_STRIPPED\n#undef _GLIBCXX_TEMPLATE_PARAMS_NULL_CLASS\n#undef _GLIBCXX_TUPLE_ASSIGN\n#undef _GLIBCXX_TUPLE_COPY_INIT\n#undef _GLIBCXX_TUPLE_ADD_CREF\n#undef _GLIBCXX_BIND_V_ARGS\n#undef _GLIBCXX_BIND_V_TEMPLATE_ARGS\n#undef _GLIBCXX_MU_GET_TUPLE_ARGS\n#undef _GLIBCXX_BIND_MEMBERS_INIT\n#undef _GLIBCXX_BIND_MEMBERS\n#undef _GLIBCXX_ARGS_SHIFTED\n#undef _GLIBCXX_PARAMS_SHIFTED\n#undef _GLIBCXX_TEMPLATE_ARGS_SHIFTED\n#undef _GLIBCXX_TEMPLATE_PARAMS_SHIFTED\n#undef _GLIBCXX_COMMA_SHIFTED\n#undef _GLIBCXX_ARGS\n#undef _GLIBCXX_REF_PARAMS\n#undef _GLIBCXX_PARAMS\n#undef _GLIBCXX_TEMPLATE_ARGS\n#undef _GLIBCXX_TEMPLATE_PARAMS\n#undef _GLIBCXX_COMMA\n#undef _GLIBCXX_NUM_ARGS\n#undef _GLIBCXX_LAST_INCLUDE\n\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/tr1/stdarg.h",
    "content": "// TR1 stdarg.h -*- C++ -*-\n\n// Copyright (C) 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n/** @file tr1/stdarg.h\n *  This is a TR1 C++ Library header. \n */\n\n#ifndef _TR1_STDARG_H\n#define _TR1_STDARG_H 1\n\n#include <tr1/cstdarg>\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/tr1/stdbool.h",
    "content": "// TR1 stdbool.h -*- C++ -*-\n\n// Copyright (C) 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n/** @file tr1/stdbool.h\n *  This is a TR1 C++ Library header. \n */\n\n#ifndef _TR1_STDBOOL_H\n#define _TR1_STDBOOL_H 1\n\n#include <tr1/cstdbool>\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/tr1/stdint.h",
    "content": "// TR1 stdint.h -*- C++ -*-\n\n// Copyright (C) 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n/** @file tr1/stdint.h\n *  This is a TR1 C++ Library header. \n */\n\n#ifndef _TR1_STDINT_H\n#define _TR1_STDINT_H 1\n\n#include <tr1/cstdint>\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/tr1/stdio.h",
    "content": "// TR1 stdio.h -*- C++ -*-\n\n// Copyright (C) 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n/** @file tr1/stdio.h\n *  This is a TR1 C++ Library header. \n */\n\n#ifndef _TR1_STDIO_H\n#define _TR1_STDIO_H 1\n\n#include <tr1/cstdio>\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/tr1/stdlib.h",
    "content": "// TR1 stdlib.h -*- C++ -*-\n\n// Copyright (C) 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n/** @file tr1/stdlib.h\n *  This is a TR1 C++ Library header. \n */\n\n#ifndef _TR1_STDLIB_H\n#define _TR1_STDLIB_H 1\n\n#include <tr1/cstdlib>\n\n#if _GLIBCXX_HOSTED\n\n#if _GLIBCXX_USE_C99\n\nusing std::tr1::atoll;\nusing std::tr1::strtoll;\nusing std::tr1::strtoull;\n\nusing std::tr1::abs;\n#if !_GLIBCXX_USE_C99_LONG_LONG_DYNAMIC\nusing std::tr1::div;\n#endif\n\n#endif\n\n#endif\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/tr1/tgmath.h",
    "content": "// TR1 tgmath.h -*- C++ -*-\n\n// Copyright (C) 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n/** @file tr1/tgmath.h\n *  This is a TR1 C++ Library header. \n */\n\n#ifndef _TR1_TGMATH_H\n#define _TR1_TGMATH_H 1\n\n#include <tr1/ctgmath>\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/tr1/tuple",
    "content": "// class template tuple -*- C++ -*-\n\n// Copyright (C) 2004, 2005 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n/** @file tr1/tuple\n*  This is a TR1 C++ Library header.\n*/\n\n// Chris Jefferson <chris@bubblescope.net>\n\n#ifndef _TR1_TUPLE\n#define _TR1_TUPLE 1\n\n#include <tr1/utility>\n#include <tr1/ref_fwd.h>\n\nnamespace std\n{\n_GLIBCXX_BEGIN_NAMESPACE(tr1)\n\n // An implementation specific class which is used in the tuple class\n // when the tuple is not maximum possible size.\n struct _NullClass { };\n\n /// Gives the type of the ith element of a given tuple type.\n template<int __i, typename _Tp>\n   struct tuple_element;\n\n /// Finds the size of a given tuple type.\n template<typename _Tp>\n   struct tuple_size;\n\n // Adds a const reference to a non-reference type.\n template<typename _Tp>\n   struct __add_c_ref\n   { typedef const _Tp& type; };\n\n template<typename _Tp>\n   struct __add_c_ref<_Tp&>\n   { typedef _Tp& type; };\n\n // Adds a reference to a non-reference type.\n template<typename _Tp>\n   struct __add_ref\n   { typedef _Tp& type; };\n\n template<typename _Tp>\n   struct __add_ref<_Tp&>\n   { typedef _Tp& type; };\n\n // Class used in the implementation of get\n template<int __i, typename _Tp>\n   struct __get_helper;\n\n // Returns a const reference to the ith element of a tuple.\n // Any const or non-const ref elements are returned with their original type.\n\n // This class helps construct the various comparison operations on tuples\n template<int __check_equal_size, int __i, int __j, typename _Tp, typename _Up>\n   struct __tuple_compare;\n\n // Helper which adds a reference to a type when given a reference_wrapper\n template<typename _Tp>\n   struct __strip_reference_wrapper\n   {\n       typedef _Tp __type;\n   };\n\n template<typename _Tp>\n   struct __strip_reference_wrapper<reference_wrapper<_Tp> >\n   {\n     typedef _Tp& __type;\n   };\n\n template<typename _Tp>\n   struct __strip_reference_wrapper<const reference_wrapper<_Tp> >\n   {\n       typedef _Tp& __type;\n   };\n\n  #include \"tuple_defs.h\"\n\n template<int __i, int __j, typename _Tp, typename _Up>\n   struct __tuple_compare<0, __i, __j, _Tp, _Up>\n   {\n     static bool __eq(const _Tp& __t, const _Up& __u)\n     {\n       return get<__i>(__t) == get<__i>(__u) &&\n          __tuple_compare<0, __i+1, __j, _Tp, _Up>::__eq(__t, __u);\n     }\n     static bool __less(const _Tp& __t, const _Up& __u)\n     {\n       return (get<__i>(__t) < get<__i>(__u)) || !(get<__i>(__u) < get<__i>(__t)) &&\n          __tuple_compare<0, __i+1, __j, _Tp, _Up>::__less(__t, __u);\n     }\n   };\n\n template<int __i, typename _Tp, typename _Up>\n   struct __tuple_compare<0, __i, __i, _Tp, _Up>\n   {\n     static bool __eq(const _Tp&, const _Up&)\n     { return true; }\n     static bool __less(const _Tp&, const _Up&)\n     { return false; }\n   };\n\n // A class (and instance) which can be used in 'tie' when an element\n // of a tuple is not required\n struct swallow_assign\n {\n   template<class T>\n   swallow_assign&\n     operator=(const T&)\n     { return *this; }\n };\n\n // TODO: Put this in some kind of shared file.\n namespace\n {\n   swallow_assign ignore;\n }; // anonymous namespace\n\n_GLIBCXX_END_NAMESPACE\n}\n\n#define _GLIBCXX_CAT(x,y) _GLIBCXX_CAT2(x,y)\n#define _GLIBCXX_CAT2(x,y) x##y\n#define _SHORT_REPEAT\n#define _GLIBCXX_REPEAT_HEADER <tr1/tuple_iterate.h>\n#include <tr1/repeat.h>\n#undef _GLIBCXX_REPEAT_HEADER\n#undef _SHORT_REPEAT\n\n#include <tr1/functional>\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/tr1/tuple_defs.h",
    "content": "// class template tuple -*- C++ -*-\n\n// Copyright (C) 2004, 2005 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n/** @file tr1/tuple_defs.h\n *  This is an internal header file, included by other library headers.\n *  You should not attempt to use it directly.\n */\n\n#ifndef _GLIBCXX_REPEAT_HEADER\n#  define _GLIBCXX_REPEAT_HEADER \"tuple_defs.h\"\n#  include \"repeat.h\"\n#  undef _GLIBCXX_REPEAT_HEADER\n#endif\n\n#ifdef _GLIBCXX_LAST_INCLUDE\n// Chris Jefferson <chris@bubblescope.net>\n   template<_GLIBCXX_TEMPLATE_PARAMS_NULL_CLASS> class tuple;\n\n   // Returns a const reference to the ith element of a tuple.\n   // Any const or non-const ref elements are returned with their original type.\n   template<int __i, _GLIBCXX_TEMPLATE_PARAMS>\n   typename __add_ref<typename tuple_element<__i, tuple<_GLIBCXX_TEMPLATE_ARGS> >::type>::type\n   get(tuple<_GLIBCXX_TEMPLATE_ARGS>& __t)\n   {\n     return __get_helper<__i, tuple<_GLIBCXX_TEMPLATE_ARGS> >::get_value(__t);\n   }\n\n   template<int __i, _GLIBCXX_TEMPLATE_PARAMS>\n   typename __add_c_ref<typename tuple_element<__i, tuple<_GLIBCXX_TEMPLATE_ARGS> >::type>::type\n   get(const tuple<_GLIBCXX_TEMPLATE_ARGS>& __t)\n   {\n     return __get_helper<__i, tuple<_GLIBCXX_TEMPLATE_ARGS> >::get_value(__t);\n   }\n\n template<_GLIBCXX_TEMPLATE_PARAMS, _GLIBCXX_TEMPLATE_PARAMS_U>\n bool\n operator==(const tuple<_GLIBCXX_TEMPLATE_ARGS>& __t,\n            const tuple<_GLIBCXX_TEMPLATE_ARGS_U>& __u)\n {\n   typedef tuple<_GLIBCXX_TEMPLATE_ARGS> _Tp;\n   typedef tuple<_GLIBCXX_TEMPLATE_ARGS_U> _Up;\n   return __tuple_compare<tuple_size<_Tp>::value - tuple_size<_Tp>::value, 0,\n                          tuple_size<_Tp>::value, _Tp, _Up>::__eq(__t, __u);\n }\n\n template<_GLIBCXX_TEMPLATE_PARAMS, _GLIBCXX_TEMPLATE_PARAMS_U>\n bool\n operator<(const tuple<_GLIBCXX_TEMPLATE_ARGS>& __t,\n           const tuple<_GLIBCXX_TEMPLATE_ARGS_U>& __u)\n {\n   typedef tuple<_GLIBCXX_TEMPLATE_ARGS> _Tp;\n   typedef tuple<_GLIBCXX_TEMPLATE_ARGS_U> _Up;\n   return __tuple_compare<tuple_size<_Tp>::value - tuple_size<_Tp>::value, 0,\n                          tuple_size<_Tp>::value, _Tp, _Up>::__less(__t, __u);\n }\n\n template<_GLIBCXX_TEMPLATE_PARAMS, _GLIBCXX_TEMPLATE_PARAMS_U>\n bool\n operator!=(const tuple<_GLIBCXX_TEMPLATE_ARGS>& __t,\n            const tuple<_GLIBCXX_TEMPLATE_ARGS_U>& __u)\n { return !(__t == __u); }\n\n template<_GLIBCXX_TEMPLATE_PARAMS, _GLIBCXX_TEMPLATE_PARAMS_U>\n bool\n operator>(const tuple<_GLIBCXX_TEMPLATE_ARGS>& __t,\n           const tuple<_GLIBCXX_TEMPLATE_ARGS_U>& __u)\n { return __u < __t; }\n\n template<_GLIBCXX_TEMPLATE_PARAMS, _GLIBCXX_TEMPLATE_PARAMS_U>\n bool\n operator<=(const tuple<_GLIBCXX_TEMPLATE_ARGS>& __t,\n            const tuple<_GLIBCXX_TEMPLATE_ARGS_U>& __u)\n { return !(__u < __t); }\n\n template<_GLIBCXX_TEMPLATE_PARAMS, _GLIBCXX_TEMPLATE_PARAMS_U>\n bool\n operator>=(const tuple<_GLIBCXX_TEMPLATE_ARGS>& __t,\n            const tuple<_GLIBCXX_TEMPLATE_ARGS_U>& __u)\n { return !(__t < __u); }\n\n template<_GLIBCXX_TEMPLATE_PARAMS_NULL_CLASS>\n   struct __stripped_tuple_type\n   {\n     typedef tuple<_GLIBCXX_TEMPLATE_ARGS_STRIPPED>      __type;\n   };\n\n#endif\n\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/tr1/tuple_iterate.h",
    "content": "// class template tuple -*- C++ -*-\n\n// Copyright (C) 2004, 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n/** @file tr1/tuple_iterate.h\n *  This is an internal header file, included by other library headers.\n *  You should not attempt to use it directly.\n */\n\n// Chris Jefferson <chris@bubblescope.net>\n\nnamespace std\n{\n_GLIBCXX_BEGIN_NAMESPACE(tr1)\n\n/// @brief class tuple_size\ntemplate<_GLIBCXX_TEMPLATE_PARAMS>\n  struct tuple_size<tuple<_GLIBCXX_TEMPLATE_ARGS> >\n  { static const int value = _GLIBCXX_NUM_ARGS; };\n\n#if _GLIBCXX_NUM_ARGS > 0\ntemplate<_GLIBCXX_TEMPLATE_PARAMS>\n  const int tuple_size<tuple<_GLIBCXX_TEMPLATE_ARGS> >::value;\n#endif\n\ntemplate<_GLIBCXX_TEMPLATE_PARAMS>\n#ifdef _GLIBCXX_LAST_INCLUDE\n  class tuple\n#else\n  class tuple<_GLIBCXX_TEMPLATE_ARGS>\n#endif\n  {\n    _GLIBCXX_BIND_MEMBERS\n\n  public:\n    tuple()\n    { }\n\n#if _GLIBCXX_NUM_ARGS == 2\n    template<typename _U1, typename _U2>\n      tuple(const std::pair<_U1, _U2>& __u) :\n      _M_arg1(__u.first), _M_arg2(__u.second)\n      { }\n\n    template<typename _U1, typename _U2>\n      tuple&\n      operator=(const std::pair<_U1, _U2>& __u)\n      { \n\t_M_arg1 = __u.first;\n\t_M_arg2 = __u.second;\n\treturn *this;\n      }\n#endif\n\n#if _GLIBCXX_NUM_ARGS > 0\n    explicit tuple(_GLIBCXX_TUPLE_ADD_CREF) :\n      _GLIBCXX_BIND_MEMBERS_INIT\n    { }\n\n    template<_GLIBCXX_TEMPLATE_PARAMS_U>\n      tuple(const tuple<_GLIBCXX_TEMPLATE_ARGS_U>& __in) :\n      _GLIBCXX_TUPLE_COPY_INIT\n    { }\n\n\n    template<_GLIBCXX_TEMPLATE_PARAMS_U>\n      tuple&\n      operator=(const tuple<_GLIBCXX_TEMPLATE_ARGS_U>& __in)\n      {\n        _GLIBCXX_TUPLE_ASSIGN\n        return *this;\n      }\n\n    tuple(const tuple& __in) :\n      _GLIBCXX_TUPLE_COPY_INIT\n    { }\n\n#else\n\n    tuple(const tuple&)\n    { }\n\n#endif\n\n    tuple&\n    operator=(const tuple& __in __attribute__((__unused__)) )\n    {\n      _GLIBCXX_TUPLE_ASSIGN\n        return *this;\n    }\n\n    template<int __i, typename __Type>\n      friend class __get_helper;\n\n    template<_GLIBCXX_TUPLE_ALL_TEMPLATE_PARAMS_UNNAMED>\n      friend class tuple;\n  };\n\n#ifndef _GLIBCXX_LAST_INCLUDE\n\ntemplate<typename _Tp>\n    struct __get_helper<_GLIBCXX_NUM_ARGS, _Tp>\n    {\n      static typename __add_ref<typename tuple_element<_GLIBCXX_NUM_ARGS,\n                                                       _Tp>::type>::type\n      get_value(_Tp& __in)\n      { return __in._GLIBCXX_CAT(_M_arg,_GLIBCXX_NUM_ARGS_PLUS_1); }\n\n      static typename __add_c_ref<typename tuple_element<_GLIBCXX_NUM_ARGS,\n                                                         _Tp>::type>::type\n      get_value(const _Tp& __in)\n      { return __in._GLIBCXX_CAT(_M_arg,_GLIBCXX_NUM_ARGS_PLUS_1); }\n    };\n\n/// @brief class tuple_element\ntemplate<_GLIBCXX_TUPLE_ALL_TEMPLATE_PARAMS>\n   struct tuple_element<_GLIBCXX_NUM_ARGS, tuple<_GLIBCXX_TUPLE_ALL_TEMPLATE_ARGS> >\n  { typedef _GLIBCXX_T_NUM_ARGS_PLUS_1 type; };\n\n#endif\n#if _GLIBCXX_NUM_ARGS == 0\n\ntuple<>\ninline make_tuple()\n{ return tuple<>(); }\n\ntuple<>\ninline tie()\n{ return tuple<>(); }\n#else\n\ntemplate<_GLIBCXX_TEMPLATE_PARAMS>\n  typename __stripped_tuple_type<_GLIBCXX_TEMPLATE_ARGS>::__type\n  inline make_tuple(_GLIBCXX_PARAMS)\n  {\n    return typename __stripped_tuple_type<_GLIBCXX_TEMPLATE_ARGS>::\n      __type(_GLIBCXX_ARGS);\n  }\n\ntemplate<_GLIBCXX_TEMPLATE_PARAMS>\n  tuple<_GLIBCXX_REF_TEMPLATE_ARGS>\n  inline tie(_GLIBCXX_REF_PARAMS)\n  { return make_tuple(_GLIBCXX_REF_WRAP_PARAMS); }\n#endif\n\n_GLIBCXX_END_NAMESPACE\n}\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/tr1/type_traits",
    "content": "// TR1 type_traits -*- C++ -*-\n\n// Copyright (C) 2004, 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n/** @file tr1/type_traits\n *  This is a TR1 C++ Library header. \n */\n\n#ifndef _TR1_TYPE_TRAITS\n#define _TR1_TYPE_TRAITS 1\n\n#include <bits/c++config.h>\n#include <tr1/type_traits_fwd.h>\n\n// namespace std::tr1\nnamespace std\n{\n_GLIBCXX_BEGIN_NAMESPACE(tr1)\n\n  // For use in __in_array and elsewhere.\n  struct __sfinae_types\n  {\n    typedef char __one;\n    typedef struct { char __arr[2]; } __two;\n  };\n\n  template<typename _Tp>\n    struct __in_array\n    : public __sfinae_types\n    {\n    private:\n      template<typename _Up>\n        static __one __test(_Up(*)[1]);\n      template<typename>\n        static __two __test(...);\n    \n    public:\n      static const bool __value = sizeof(__test<_Tp>(0)) == 1;\n    };\n\n#define _DEFINE_SPEC_BODY(_Value)                                    \\\n    : public integral_constant<bool, _Value> { };\n\n#define _DEFINE_SPEC_0_HELPER(_Spec, _Value)                         \\\n  template<>                                                         \\\n    struct _Spec                                                     \\\n    _DEFINE_SPEC_BODY(_Value)\n\n#define _DEFINE_SPEC_1_HELPER(_Spec, _Value)                         \\\n  template<typename _Tp>                                             \\\n    struct _Spec                                                     \\\n    _DEFINE_SPEC_BODY(_Value)\n      \n#define _DEFINE_SPEC_2_HELPER(_Spec, _Value)                         \\\n  template<typename _Tp, typename _Cp>                               \\\n    struct _Spec                                                     \\\n    _DEFINE_SPEC_BODY(_Value)\n\n#define _DEFINE_SPEC(_Order, _Trait, _Type, _Value)                  \\\n  _DEFINE_SPEC_##_Order##_HELPER(_Trait<_Type>, _Value)              \\\n  _DEFINE_SPEC_##_Order##_HELPER(_Trait<_Type const>, _Value)        \\\n  _DEFINE_SPEC_##_Order##_HELPER(_Trait<_Type volatile>, _Value)     \\\n  _DEFINE_SPEC_##_Order##_HELPER(_Trait<_Type const volatile>, _Value)\n\n  /// @brief  helper classes [4.3].\n  template<typename _Tp, _Tp __v>\n    struct integral_constant\n    {\n      static const _Tp                      value = __v;\n      typedef _Tp                           value_type;\n      typedef integral_constant<_Tp, __v>   type;\n    };\n  typedef integral_constant<bool, true>     true_type;\n  typedef integral_constant<bool, false>    false_type;\n\n  template<typename _Tp, _Tp __v>\n    const _Tp integral_constant<_Tp, __v>::value;\n\n  /// @brief  primary type categories [4.5.1].\n  template<typename>\n    struct is_void\n    : public false_type { };\n  _DEFINE_SPEC(0, is_void, void, true)\n\n  template<typename>\n    struct is_integral\n    : public false_type { };\n  _DEFINE_SPEC(0, is_integral, bool, true)\n  _DEFINE_SPEC(0, is_integral, char, true)\n  _DEFINE_SPEC(0, is_integral, signed char, true)\n  _DEFINE_SPEC(0, is_integral, unsigned char, true)\n#ifdef _GLIBCXX_USE_WCHAR_T\n  _DEFINE_SPEC(0, is_integral, wchar_t, true)\n#endif\n  _DEFINE_SPEC(0, is_integral, short, true)\n  _DEFINE_SPEC(0, is_integral, unsigned short, true)\n  _DEFINE_SPEC(0, is_integral, int, true)\n  _DEFINE_SPEC(0, is_integral, unsigned int, true)\n  _DEFINE_SPEC(0, is_integral, long, true)\n  _DEFINE_SPEC(0, is_integral, unsigned long, true)\n  _DEFINE_SPEC(0, is_integral, long long, true)\n  _DEFINE_SPEC(0, is_integral, unsigned long long, true)\n\n  template<typename>\n    struct is_floating_point\n    : public false_type { };\n  _DEFINE_SPEC(0, is_floating_point, float, true)\n  _DEFINE_SPEC(0, is_floating_point, double, true)\n  _DEFINE_SPEC(0, is_floating_point, long double, true)\n\n  template<typename>\n    struct is_array\n    : public false_type { };\n\n  template<typename _Tp, std::size_t _Size>\n    struct is_array<_Tp[_Size]>\n    : public true_type { };\n\n  template<typename _Tp>\n    struct is_array<_Tp[]>\n    : public true_type { };\n\n  template<typename>\n    struct is_pointer\n    : public false_type { };\n  _DEFINE_SPEC(1, is_pointer, _Tp*, true)\n \n  template<typename>\n    struct is_reference\n    : public false_type { };\n\n  template<typename _Tp>\n    struct is_reference<_Tp&>\n    : public true_type { };\n\n  template<typename>\n    struct is_member_object_pointer\n    : public false_type { };\n  _DEFINE_SPEC(2, is_member_object_pointer, _Tp _Cp::*,\n\t       !is_function<_Tp>::value)\n\n  template<typename>\n    struct is_member_function_pointer\n    : public false_type { };\n  _DEFINE_SPEC(2, is_member_function_pointer, _Tp _Cp::*,\n\t       is_function<_Tp>::value)\n\n  template<typename _Tp>\n    struct is_enum\n    : public integral_constant<bool, !(is_fundamental<_Tp>::value\n\t\t\t\t       || is_array<_Tp>::value\n\t\t\t\t       || is_pointer<_Tp>::value\n\t\t\t\t       || is_reference<_Tp>::value\n\t\t\t\t       || is_member_pointer<_Tp>::value\n\t\t\t\t       || is_function<_Tp>::value\n\t\t\t\t       || __is_union_or_class<_Tp>::value)>\n    { };\n\n  template<typename>\n    struct is_union { };\n\n  template<typename>\n    struct is_class { };\n\n  template<typename _Tp>\n    struct is_function\n    : public integral_constant<bool, !(__in_array<_Tp>::__value\n\t\t\t\t       || __is_union_or_class<_Tp>::value\n\t\t\t\t       || is_reference<_Tp>::value\n\t\t\t\t       || is_void<_Tp>::value)>\n    { };\n\n  /// @brief  composite type traits [4.5.2].\n  template<typename _Tp>\n    struct is_arithmetic\n    : public integral_constant<bool, (is_integral<_Tp>::value\n\t\t\t\t      || is_floating_point<_Tp>::value)>\n    { };\n\n  template<typename _Tp>\n    struct is_fundamental\n    : public integral_constant<bool, (is_arithmetic<_Tp>::value\n\t\t\t\t      || is_void<_Tp>::value)>\n    { };\n\n  template<typename _Tp>\n    struct is_object\n    : public integral_constant<bool, !(is_function<_Tp>::value\n\t\t\t\t       || is_reference<_Tp>::value\n\t\t\t\t       || is_void<_Tp>::value)>\n    { };\n\n  template<typename _Tp>\n    struct is_scalar\n    : public integral_constant<bool, (is_arithmetic<_Tp>::value\n\t\t\t\t      || is_enum<_Tp>::value\n\t\t\t\t      || is_pointer<_Tp>::value\n\t\t\t\t      || is_member_pointer<_Tp>::value)>\n    { };\n\n  template<typename _Tp>\n    struct is_compound\n    : public integral_constant<bool, !is_fundamental<_Tp>::value> { };\n\n  template<typename _Tp>\n    struct is_member_pointer\n    : public integral_constant<bool,\n\t\t\t       (is_member_object_pointer<_Tp>::value\n\t\t\t\t|| is_member_function_pointer<_Tp>::value)>\n    { };\n\n  template<typename _Tp>\n    struct __is_union_or_class_helper\n    : public __sfinae_types\n    {\n    private:\n      template<typename _Up>\n        static __one __test(int _Up::*);\n      template<typename>\n        static __two __test(...);\n    \n    public:\n      static const bool __value = sizeof(__test<_Tp>(0)) == 1;\n    };\n\n  // Extension.\n  template<typename _Tp>\n    struct __is_union_or_class\n    : public integral_constant<bool, __is_union_or_class_helper<_Tp>::__value>\n    { };\n  \n  /// @brief  type properties [4.5.3].\n  template<typename>\n    struct is_const\n    : public false_type { };\n\n  template<typename _Tp>\n    struct is_const<_Tp const>\n    : public true_type { };\n  \n  template<typename>\n    struct is_volatile\n    : public false_type { };\n\n  template<typename _Tp>\n    struct is_volatile<_Tp volatile>\n    : public true_type { };\n\n  template<typename _Tp>\n    struct is_pod\n    : public integral_constant<bool, (is_void<_Tp>::value\n\t\t\t\t      || is_scalar<typename\n\t\t\t\t      remove_all_extents<_Tp>::type>::value)>\n    { };\n\n  // NB: Without compiler support we cannot tell union from class types,\n  // and is_empty and is_polymorphic don't work at all with the former. \n  template<typename _Tp, bool = !__is_union_or_class<_Tp>::value>\n    struct __is_empty_helper\n    { \n    private:\n      template<typename>\n        struct __first { };\n      template<typename _Up>\n        struct __second\n        : public _Up { };\n           \n    public:\n      static const bool __value = sizeof(__first<_Tp>) == sizeof(__second<_Tp>);\n    };\n\n  template<typename _Tp>\n    struct __is_empty_helper<_Tp, true>\n    { static const bool __value = false; };\n\n  template<typename _Tp>\n    struct is_empty\n    : public integral_constant<bool, __is_empty_helper<_Tp>::__value>\n    { };\n\n  template<typename _Tp, bool = !__is_union_or_class<_Tp>::value>\n    struct __is_polymorphic_helper\n    { \n    private:\n      template<typename _Up>\n        struct __first\n        : public _Up { };\n      template<typename _Up>\n        struct __second\n        : public _Up\n\t{ \n\t  virtual void __dummy();\n\t  virtual ~__second() throw();\n\t};\n\n    public:\n      static const bool __value = sizeof(__first<_Tp>) == sizeof(__second<_Tp>);\n    };\n\n  template<typename _Tp>\n    struct __is_polymorphic_helper<_Tp, true>\n    { static const bool __value = false; };\n\n  template<typename _Tp>\n    struct is_polymorphic\n    : public integral_constant<bool, __is_polymorphic_helper<_Tp>::__value>\n    { };\n\n  // Exploit the resolution DR core/337.\n  template<typename _Tp>\n    struct is_abstract\n    : public integral_constant<bool, (!__in_array<_Tp>::__value\n\t\t\t\t      && __is_union_or_class<_Tp>::value)> { };\n\n  template<typename _Tp>\n    struct has_trivial_constructor\n    : public integral_constant<bool, is_pod<_Tp>::value> { };\n\n  template<typename _Tp>\n    struct has_trivial_copy\n    : public integral_constant<bool, is_pod<_Tp>::value> { };\n\n  template<typename _Tp>\n    struct has_trivial_assign\n    : public integral_constant<bool, is_pod<_Tp>::value> { };\n\n  template<typename _Tp>\n    struct has_trivial_destructor\n    : public integral_constant<bool, is_pod<_Tp>::value> { };\n\n  template<typename _Tp>\n    struct has_nothrow_constructor\n    : public integral_constant<bool, is_pod<_Tp>::value> { };\n\n  template<typename _Tp>\n    struct has_nothrow_copy\n    : public integral_constant<bool, is_pod<_Tp>::value> { };\n\n  template<typename _Tp>\n    struct has_nothrow_assign\n    : public integral_constant<bool, is_pod<_Tp>::value> { };\n\n  template<typename>\n    struct has_virtual_destructor\n    : public false_type { };\n\n  template<typename>\n    struct is_signed\n    : public false_type { };\n  _DEFINE_SPEC(0, is_signed, signed char, true)\n  _DEFINE_SPEC(0, is_signed, short, true)\n  _DEFINE_SPEC(0, is_signed, int, true)\n  _DEFINE_SPEC(0, is_signed, long, true)\n  _DEFINE_SPEC(0, is_signed, long long, true)\n\n  template<typename>\n    struct is_unsigned\n    : public false_type { };\n  _DEFINE_SPEC(0, is_unsigned, unsigned char, true)\n  _DEFINE_SPEC(0, is_unsigned, unsigned short, true)\n  _DEFINE_SPEC(0, is_unsigned, unsigned int, true)\n  _DEFINE_SPEC(0, is_unsigned, unsigned long, true)\n  _DEFINE_SPEC(0, is_unsigned, unsigned long long, true)\n\n  template<typename _Tp>\n    struct alignment_of\n    : public integral_constant<std::size_t, __alignof__(_Tp)> { };\n  \n  template<typename>\n    struct rank\n    : public integral_constant<std::size_t, 0> { };\n   \n  template<typename _Tp, std::size_t _Size>\n    struct rank<_Tp[_Size]>\n    : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { };\n\n  template<typename _Tp>\n    struct rank<_Tp[]>\n    : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { };\n   \n  template<typename, unsigned>\n    struct extent\n    : public integral_constant<std::size_t, 0> { };\n  \n  template<typename _Tp, unsigned _Uint, std::size_t _Size>\n    struct extent<_Tp[_Size], _Uint>\n    : public integral_constant<std::size_t,\n\t\t\t       _Uint == 0 ? _Size : extent<_Tp,\n\t\t\t\t\t\t\t   _Uint - 1>::value>\n    { };\n\n  template<typename _Tp, unsigned _Uint>\n    struct extent<_Tp[], _Uint>\n    : public integral_constant<std::size_t,\n\t\t\t       _Uint == 0 ? 0 : extent<_Tp,\n\t\t\t\t\t\t       _Uint - 1>::value>\n    { };\n  \n  /// @brief  relationships between types [4.6].\n  template<typename, typename>\n    struct is_same\n    : public false_type { };\n\n  template<typename _Tp>\n    struct is_same<_Tp, _Tp>\n    : public true_type { };\n\n  // See Daveed Vandevoorde explanation in http://tinyurl.com/502f.\n  // Also see Rani Sharoni in http://tinyurl.com/6jvyq.\n  template<typename _Base, typename _Derived,\n\t   bool = (!__is_union_or_class<_Base>::value\n\t\t   || !__is_union_or_class<_Derived>::value\n\t\t   || is_same<_Base, _Derived>::value)>\n    struct __is_base_of_helper\n    : public __sfinae_types\n    {\n    private:\n      typedef typename remove_cv<_Base>::type     _NoCv_Base;      \n      typedef typename remove_cv<_Derived>::type  _NoCv_Derived;\n      \n      template<typename _Up>\n        static __one __test(_NoCv_Derived&, _Up);\n      static __two __test(_NoCv_Base&, int);\n   \n      struct _Conv\n      {\n\toperator _NoCv_Derived&();\n\toperator _NoCv_Base&() const;\n      };\n   \n    public:\n      static const bool __value = sizeof(__test(_Conv(), 0)) == 1;\n    };\n\n  template<typename _Base, typename _Derived>\n    struct __is_base_of_helper<_Base, _Derived, true>\n    { static const bool __value = is_same<_Base, _Derived>::value; };\n\n  template<typename _Base, typename _Derived>\n    struct is_base_of\n    : public integral_constant<bool,\n\t\t\t       __is_base_of_helper<_Base, _Derived>::__value>\n    { };\n\n  template<typename _From, typename _To>\n    struct __is_convertible_simple\n    : public __sfinae_types\n    {\n    private:\n      static __one __test(_To);\n      static __two __test(...);\n      static _From __makeFrom();\n    \n    public:\n      static const bool __value = sizeof(__test(__makeFrom())) == 1;\n    };\n\n  template<typename _Tp>\n    struct __is_int_or_cref\n    {\n      typedef typename remove_reference<_Tp>::type __rr_Tp;\n      static const bool __value = (is_integral<_Tp>::value\n\t\t\t\t   || (is_integral<__rr_Tp>::value\n\t\t\t\t       && is_const<__rr_Tp>::value\n\t\t\t\t       && !is_volatile<__rr_Tp>::value));\n    };\n\n  template<typename _From, typename _To,\n\t   bool = (is_void<_From>::value || is_void<_To>::value\n\t\t   || is_function<_To>::value || is_array<_To>::value\n\t\t   // This special case is here only to avoid warnings.\t\t   \n\t\t   || (is_floating_point<typename\n\t\t       remove_reference<_From>::type>::value\n\t\t       && __is_int_or_cref<_To>::__value))>\n    struct __is_convertible_helper\n    {\n      // \"An imaginary lvalue of type From...\".\n      static const bool __value = (__is_convertible_simple<typename\n\t\t\t\t   add_reference<_From>::type, _To>::__value);\n    };\n\n  template<typename _From, typename _To>\n    struct __is_convertible_helper<_From, _To, true>\n    { static const bool __value = (is_void<_To>::value\n\t\t\t\t   || (__is_int_or_cref<_To>::__value\n\t\t\t\t       && !is_void<_From>::value)); };\n\n  template<typename _From, typename _To>\n    struct is_convertible\n    : public integral_constant<bool,\n\t\t\t       __is_convertible_helper<_From, _To>::__value>\n    { };\n\n  /// @brief  const-volatile modifications [4.7.1].\n  template<typename _Tp>\n    struct remove_const\n    { typedef _Tp     type; };\n\n  template<typename _Tp>\n    struct remove_const<_Tp const>\n    { typedef _Tp     type; };\n  \n  template<typename _Tp>\n    struct remove_volatile\n    { typedef _Tp     type; };\n\n  template<typename _Tp>\n    struct remove_volatile<_Tp volatile>\n    { typedef _Tp     type; };\n  \n  template<typename _Tp>\n    struct remove_cv\n    {\n      typedef typename\n      remove_const<typename remove_volatile<_Tp>::type>::type     type;\n    };\n  \n  template<typename _Tp>\n    struct add_const\n    { typedef _Tp const     type; };\n   \n  template<typename _Tp>\n    struct add_volatile\n    { typedef _Tp volatile     type; };\n  \n  template<typename _Tp>\n    struct add_cv\n    {\n      typedef typename\n      add_const<typename add_volatile<_Tp>::type>::type     type;\n    };\n\n  /// @brief  reference modifications [4.7.2].\n  template<typename _Tp>\n    struct remove_reference\n    { typedef _Tp     type; };\n\n  template<typename _Tp>\n    struct remove_reference<_Tp&>\n    { typedef _Tp     type; };\n\n  // NB: Careful with reference to void.\n  template<typename _Tp, bool = (is_void<_Tp>::value\n\t\t\t\t || is_reference<_Tp>::value)>\n    struct __add_reference_helper\n    { typedef _Tp&    type; };\n\n  template<typename _Tp>\n    struct __add_reference_helper<_Tp, true>\n    { typedef _Tp     type; };\n\n  template<typename _Tp>\n    struct add_reference\n    : public __add_reference_helper<_Tp>\n    { };\n\n  /// @brief  array modifications [4.7.3].\n  template<typename _Tp>\n    struct remove_extent\n    { typedef _Tp     type; };\n\n  template<typename _Tp, std::size_t _Size>\n    struct remove_extent<_Tp[_Size]>\n    { typedef _Tp     type; };\n\n  template<typename _Tp>\n    struct remove_extent<_Tp[]>\n    { typedef _Tp     type; };\n\n  template<typename _Tp>\n    struct remove_all_extents\n    { typedef _Tp     type; };\n\n  template<typename _Tp, std::size_t _Size>\n    struct remove_all_extents<_Tp[_Size]>\n    { typedef typename remove_all_extents<_Tp>::type     type; };\n\n  template<typename _Tp>\n    struct remove_all_extents<_Tp[]>\n    { typedef typename remove_all_extents<_Tp>::type     type; };\n\n  /// @brief  pointer modifications [4.7.4].\n#undef _DEFINE_SPEC_BODY\n#define _DEFINE_SPEC_BODY(_Value)      \\\n    { typedef _Tp     type; };\n\n  template<typename _Tp>\n    struct remove_pointer\n    { typedef _Tp     type; };\n  _DEFINE_SPEC(1, remove_pointer, _Tp*, false)\n  \n  template<typename _Tp>\n    struct add_pointer\n    { typedef typename remove_reference<_Tp>::type*     type; };\n\n  /// @brief  other transformations [4.8].\n  \n  // Due to c++/19163 and c++/17743, for the time being we cannot use\n  // the correct, neat implementation :-(\n  // \n  // template<std::size_t _Len, std::size_t _Align>\n  //   struct aligned_storage\n  //   { typedef char type[_Len] __attribute__((__aligned__(_Align))); }\n  //\n  // Temporary workaround, useful for Align up to 32:\n  template<std::size_t, std::size_t>\n    struct aligned_storage { };\n\n  template<std::size_t _Len>\n    struct aligned_storage<_Len, 1>\n    {\n      union type\n      {\n\tunsigned char __data[_Len];\n\tchar __align __attribute__((__aligned__(1)));\n      };\n    };\n\n  template<std::size_t _Len>\n    struct aligned_storage<_Len, 2>\n    {\n      union type\n      {\n\tunsigned char __data[_Len];\n\tchar __align __attribute__((__aligned__(2)));\n      };\n    };\n\n  template<std::size_t _Len>\n    struct aligned_storage<_Len, 4>\n    {\n      union type\n      {\n\tunsigned char __data[_Len];\n\tchar __align __attribute__((__aligned__(4)));\n      };\n    };\n\n  template<std::size_t _Len>\n    struct aligned_storage<_Len, 8>\n    {\n      union type\n      {\n\tunsigned char __data[_Len];\n\tchar __align __attribute__((__aligned__(8)));\n      };\n    };\n\n  template<std::size_t _Len>\n    struct aligned_storage<_Len, 16>\n    {\n      union type\n      {\n\tunsigned char __data[_Len];\n\tchar __align __attribute__((__aligned__(16)));\n      };\n    };\n  \n  template<std::size_t _Len>\n    struct aligned_storage<_Len, 32>\n    {\n      union type\n      {\n\tunsigned char __data[_Len];\n\tchar __align __attribute__((__aligned__(32)));\n      };\n    };\n\n#undef _DEFINE_SPEC_0_HELPER\n#undef _DEFINE_SPEC_1_HELPER\n#undef _DEFINE_SPEC_2_HELPER\n#undef _DEFINE_SPEC\n#undef _DEFINE_SPEC_BODY\n\n_GLIBCXX_END_NAMESPACE\n}\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/tr1/type_traits_fwd.h",
    "content": "// TR1 type_traits -*- C++ -*-\n\n// Copyright (C) 2004, 2005, 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n/** @file tr1/type_traits_fwd.h\n *  This is an internal header file, included by other library headers.\n *  You should not attempt to use it directly.\n */\n\n#ifndef _TYPE_TRAITS_FWD_H\n#define _TYPE_TRAITS_FWD_H 1\n\n#include <cstddef>\n\n// namespace std::tr1\nnamespace std\n{\n_GLIBCXX_BEGIN_NAMESPACE(tr1)\n\n  /// @brief  helper classes [4.3].\n  template<typename _Tp, _Tp __v>\n    struct integral_constant;\n  typedef integral_constant<bool, true>     true_type;\n  typedef integral_constant<bool, false>    false_type;\n\n  /// @brief  primary type categories [4.5.1].\n  template<typename _Tp>\n    struct is_void;\n\n  template<typename _Tp>\n    struct is_integral;\n\n  template<typename _Tp>\n    struct is_floating_point;\n\n  template<typename _Tp>\n    struct is_array;\n  \n  template<typename _Tp>\n    struct is_pointer;\n \n  template<typename _Tp>\n    struct is_reference;\n\n  template<typename _Tp>\n    struct is_member_object_pointer;\n  \n  template<typename _Tp>\n    struct is_member_function_pointer;   \n\n  template<typename _Tp>\n    struct is_enum;\n  \n  template<typename _Tp>\n    struct is_union;\n  \n  template<typename _Tp>\n    struct is_class;\n\n  template<typename _Tp>\n    struct is_function;\n\n  /// @brief  composite type traits [4.5.2].\n  template<typename _Tp>\n    struct is_arithmetic;\n\n  template<typename _Tp>\n    struct is_fundamental;\n\n  template<typename _Tp>\n    struct is_object;\n\n  template<typename _Tp>\n    struct is_scalar;\n\n  template<typename _Tp>\n    struct is_compound;\n\n  template<typename _Tp>\n    struct is_member_pointer;\n\n  // Extension.\n  template<typename _Tp>\n    struct __is_union_or_class;\n   \n  /// @brief  type properties [4.5.3].\n  template<typename _Tp>\n    struct is_const;\n  \n  template<typename _Tp>\n    struct is_volatile;\n\n  template<typename _Tp>\n    struct is_pod;\n  \n  template<typename _Tp>\n    struct is_empty;\n  \n  template<typename _Tp>\n    struct is_polymorphic;\n  \n  template<typename _Tp>\n    struct is_abstract;\n  \n  template<typename _Tp>\n    struct has_trivial_constructor;\n  \n  template<typename _Tp>\n    struct has_trivial_copy;\n\n  template<typename _Tp>\n    struct has_trivial_assign;\n  \n  template<typename _Tp>\n    struct has_trivial_destructor;\n  \n  template<typename _Tp>\n    struct has_nothrow_constructor;\n  \n  template<typename _Tp>\n    struct has_nothrow_copy;\n\n  template<typename _Tp>\n    struct has_nothrow_assign;\n  \n  template<typename _Tp>\n    struct has_virtual_destructor;\n  \n  template<typename _Tp>\n    struct is_signed;\n  \n  template<typename _Tp>\n    struct is_unsigned;\n   \n  template<typename _Tp>\n    struct alignment_of;\n  \n  template<typename _Tp>\n    struct rank;\n  \n  template<typename _Tp, unsigned _Uint = 0>\n    struct extent;\n  \n  /// @brief  relationships between types [4.6].\n  template<typename _Tp, typename _Up>\n    struct is_same;\n\n  template<typename _From, typename _To>\n    struct is_convertible;\n\n  template<typename _Base, typename _Derived>\n    struct is_base_of;\n\n  /// @brief  const-volatile modifications [4.7.1].\n  template<typename _Tp>\n    struct remove_const;\n  \n  template<typename _Tp>\n    struct remove_volatile;\n  \n  template<typename _Tp>\n    struct remove_cv;\n  \n  template<typename _Tp>\n    struct add_const;\n   \n  template<typename _Tp>\n    struct add_volatile;\n  \n  template<typename _Tp>\n    struct add_cv;\n\n  /// @brief  reference modifications [4.7.2].\n  template<typename _Tp>\n    struct remove_reference;\n  \n  template<typename _Tp>\n    struct add_reference;\n\n  /// @brief  array modifications [4.7.3].\n  template<typename _Tp>\n    struct remove_extent;\n\n  template<typename _Tp>\n    struct remove_all_extents;\n\n  /// @brief  pointer modifications [4.7.4].\n  template<typename _Tp>\n    struct remove_pointer;\n  \n  template<typename _Tp>\n    struct add_pointer;\n\n  /// @brief  other transformations [4.8].\n  template<std::size_t _Len, std::size_t _Align>\n    struct aligned_storage;\n\n_GLIBCXX_END_NAMESPACE\n}\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/tr1/unordered_map",
    "content": "// TR1 unordered_map -*- C++ -*-\n\n// Copyright (C) 2005, 2006, 2007 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n/** @file tr1/unordered_map\n *  This is a TR1 C++ Library header. \n */\n\n#ifndef _TR1_UNORDERED_MAP\n#define _TR1_UNORDERED_MAP 1\n\n#include <tr1/hashtable>\n#include <tr1/functional_hash.h>\n\nnamespace std\n{\n_GLIBCXX_BEGIN_NAMESPACE(tr1)\n\n  // XXX When we get typedef templates these class definitions\n  // will be unnecessary.\n  template<class _Key, class _Tp,\n\t   class _Hash = hash<_Key>,\n\t   class _Pred = std::equal_to<_Key>,\n\t   class _Alloc = std::allocator<std::pair<const _Key, _Tp> >,\n\t   bool __cache_hash_code = false>\n    class unordered_map\n    : public _Hashtable<_Key, std::pair<const _Key, _Tp>, _Alloc,\n\t\t\tstd::_Select1st<std::pair<const _Key, _Tp> >, _Pred, \n\t\t\t_Hash, __detail::_Mod_range_hashing,\n\t\t\t__detail::_Default_ranged_hash,\n\t\t\t__detail::_Prime_rehash_policy,\n\t\t\t__cache_hash_code, false, true>\n    {\n      typedef _Hashtable<_Key, std::pair<const _Key, _Tp>, _Alloc,\n\t\t\t std::_Select1st<std::pair<const _Key, _Tp> >, _Pred,\n\t\t\t _Hash, __detail::_Mod_range_hashing,\n\t\t\t __detail::_Default_ranged_hash,\n\t\t\t __detail::_Prime_rehash_policy,\n\t\t\t __cache_hash_code, false, true>\n        _Base;\n\n    public:\n      typedef typename _Base::size_type       size_type;\n      typedef typename _Base::hasher          hasher;\n      typedef typename _Base::key_equal       key_equal;\n      typedef typename _Base::allocator_type  allocator_type;\n\n      explicit\n      unordered_map(size_type __n = 10,\n\t\t    const hasher& __hf = hasher(),\n\t\t    const key_equal& __eql = key_equal(),\n\t\t    const allocator_type& __a = allocator_type())\n      : _Base(__n, __hf, __detail::_Mod_range_hashing(),\n\t      __detail::_Default_ranged_hash(),\n\t      __eql, std::_Select1st<std::pair<const _Key, _Tp> >(), __a)\n      { }\n\n      template<typename _InputIterator>\n        unordered_map(_InputIterator __f, _InputIterator __l, \n\t\t      size_type __n = 10,\n\t\t      const hasher& __hf = hasher(), \n\t\t      const key_equal& __eql = key_equal(), \n\t\t      const allocator_type& __a = allocator_type())\n\t: _Base(__f, __l, __n, __hf, __detail::_Mod_range_hashing(),\n\t\t__detail::_Default_ranged_hash(),\n\t\t__eql, std::_Select1st<std::pair<const _Key, _Tp> >(), __a)\n\t{ }\n    };\n  \n  template<class _Key, class _Tp,\n\t   class _Hash = hash<_Key>,\n\t   class _Pred = std::equal_to<_Key>,\n\t   class _Alloc = std::allocator<std::pair<const _Key, _Tp> >,\n\t   bool __cache_hash_code = false>\n    class unordered_multimap\n    : public _Hashtable<_Key, std::pair<const _Key, _Tp>,\n\t\t\t_Alloc,\n\t\t\tstd::_Select1st<std::pair<const _Key, _Tp> >, _Pred,\n\t\t\t_Hash, __detail::_Mod_range_hashing,\n\t\t\t__detail::_Default_ranged_hash,\n\t\t\t__detail::_Prime_rehash_policy,\n\t\t\t__cache_hash_code, false, false>\n    {\n      typedef _Hashtable<_Key, std::pair<const _Key, _Tp>,\n\t\t\t _Alloc,\n\t\t\t std::_Select1st<std::pair<const _Key, _Tp> >, _Pred,\n\t\t\t _Hash, __detail::_Mod_range_hashing,\n\t\t\t __detail::_Default_ranged_hash,\n\t\t\t __detail::_Prime_rehash_policy,\n\t\t\t __cache_hash_code, false, false>\n        _Base;\n\n    public:\n      typedef typename _Base::size_type       size_type;\n      typedef typename _Base::hasher          hasher;\n      typedef typename _Base::key_equal       key_equal;\n      typedef typename _Base::allocator_type  allocator_type;\n      \n      explicit\n      unordered_multimap(size_type __n = 10,\n\t\t\t const hasher& __hf = hasher(),\n\t\t\t const key_equal& __eql = key_equal(),\n\t\t\t const allocator_type& __a = allocator_type())\n      : _Base(__n, __hf, __detail::_Mod_range_hashing(),\n\t      __detail::_Default_ranged_hash(),\n\t      __eql, std::_Select1st<std::pair<const _Key, _Tp> >(), __a)\n      { }\n\n\n      template<typename _InputIterator>\n        unordered_multimap(_InputIterator __f, _InputIterator __l, \n\t\t\t   typename _Base::size_type __n = 0,\n\t\t\t   const hasher& __hf = hasher(), \n\t\t\t   const key_equal& __eql = key_equal(), \n\t\t\t   const allocator_type& __a = allocator_type())\n\t: _Base(__f, __l, __n, __hf, __detail::_Mod_range_hashing(),\n\t\t__detail::_Default_ranged_hash(),\n\t\t__eql, std::_Select1st<std::pair<const _Key, _Tp> >(), __a)\n        { }\n    };\n\n  template<class _Key, class _Tp, class _Hash, class _Pred, class _Alloc,\n\t   bool __cache_hash_code>\n    inline void\n    swap(unordered_map<_Key, _Tp, _Hash, _Pred,\n\t _Alloc, __cache_hash_code>& __x,\n\t unordered_map<_Key, _Tp, _Hash, _Pred,\n\t _Alloc, __cache_hash_code>& __y)\n    { __x.swap(__y); }\n\n  template<class _Key, class _Tp, class _Hash, class _Pred, class _Alloc,\n\t   bool __cache_hash_code>\n    inline void\n    swap(unordered_multimap<_Key, _Tp, _Hash, _Pred,\n\t _Alloc, __cache_hash_code>& __x,\n\t unordered_multimap<_Key, _Tp, _Hash, _Pred,\n\t _Alloc, __cache_hash_code>& __y)\n    { __x.swap(__y); }\n\n_GLIBCXX_END_NAMESPACE\n}\n\n#endif // _TR1_UNORDERED_MAP\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/tr1/unordered_set",
    "content": "// TR1 unordered_set -*- C++ -*-\n\n// Copyright (C) 2005, 2006, 2007 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n/** @file tr1/unordered_set\n *  This is a TR1 C++ Library header. \n */\n\n#ifndef _TR1_UNORDERED_SET\n#define _TR1_UNORDERED_SET 1\n\n#include <tr1/hashtable>\n#include <tr1/functional_hash.h>\n\nnamespace std\n{ \n_GLIBCXX_BEGIN_NAMESPACE(tr1)\n\n  // XXX When we get typedef templates these class definitions\n  // will be unnecessary.\n  template<class _Value,\n\t   class _Hash = hash<_Value>,\n\t   class _Pred = std::equal_to<_Value>,\n\t   class _Alloc = std::allocator<_Value>,\n\t   bool __cache_hash_code = false>\n    class unordered_set\n    : public _Hashtable<_Value, _Value, _Alloc,\n\t\t\tstd::_Identity<_Value>, _Pred,\n\t\t\t_Hash, __detail::_Mod_range_hashing,\n\t\t\t__detail::_Default_ranged_hash,\n\t\t\t__detail::_Prime_rehash_policy,\n\t\t\t__cache_hash_code, true, true>\n    {\n      typedef _Hashtable<_Value, _Value, _Alloc,\n\t\t\t std::_Identity<_Value>, _Pred,\n\t\t\t _Hash, __detail::_Mod_range_hashing,\n\t\t\t __detail::_Default_ranged_hash,\n\t\t\t __detail::_Prime_rehash_policy,\n\t\t\t __cache_hash_code, true, true>\n        _Base;\n\n    public:\n      typedef typename _Base::size_type       size_type;\n      typedef typename _Base::hasher          hasher;\n      typedef typename _Base::key_equal       key_equal;\n      typedef typename _Base::allocator_type  allocator_type;\n      \n      explicit\n      unordered_set(size_type __n = 10,\n\t\t    const hasher& __hf = hasher(),\n\t\t    const key_equal& __eql = key_equal(),\n\t\t    const allocator_type& __a = allocator_type())\n      : _Base(__n, __hf, __detail::_Mod_range_hashing(),\n\t      __detail::_Default_ranged_hash(), __eql,\n\t      std::_Identity<_Value>(), __a)\n      { }\n\n      template<typename _InputIterator>\n        unordered_set(_InputIterator __f, _InputIterator __l, \n\t\t      size_type __n = 10,\n\t\t      const hasher& __hf = hasher(), \n\t\t      const key_equal& __eql = key_equal(), \n\t\t      const allocator_type& __a = allocator_type())\n\t: _Base(__f, __l, __n, __hf, __detail::_Mod_range_hashing(),\n\t\t__detail::_Default_ranged_hash(), __eql,\n\t\tstd::_Identity<_Value>(), __a)\n        { }\n    };\n\n  template<class _Value,\n\t   class _Hash = hash<_Value>,\n\t   class _Pred = std::equal_to<_Value>,\n\t   class _Alloc = std::allocator<_Value>,\n\t   bool __cache_hash_code = false>\n    class unordered_multiset\n    : public _Hashtable<_Value, _Value, _Alloc,\n\t\t\tstd::_Identity<_Value>, _Pred,\n\t\t\t_Hash, __detail::_Mod_range_hashing,\n\t\t\t__detail::_Default_ranged_hash,\n\t\t\t__detail::_Prime_rehash_policy,\n\t\t\t__cache_hash_code, true, false>\n    {\n      typedef _Hashtable<_Value, _Value, _Alloc,\n\t\t\t std::_Identity<_Value>, _Pred,\n\t\t\t _Hash, __detail::_Mod_range_hashing,\n\t\t\t __detail::_Default_ranged_hash,\n\t\t\t __detail::_Prime_rehash_policy,\n\t\t\t __cache_hash_code, true, false>\n        _Base;\n\n    public:\n      typedef typename _Base::size_type       size_type;\n      typedef typename _Base::hasher          hasher;\n      typedef typename _Base::key_equal       key_equal;\n      typedef typename _Base::allocator_type  allocator_type;\n      \n      explicit\n      unordered_multiset(size_type __n = 10,\n\t\t\t const hasher& __hf = hasher(),\n\t\t\t const key_equal& __eql = key_equal(),\n\t\t\t const allocator_type& __a = allocator_type())\n      : _Base(__n, __hf, __detail::_Mod_range_hashing(),\n\t      __detail::_Default_ranged_hash(), __eql,\n\t      std::_Identity<_Value>(), __a)\n      { }\n\n\n      template<typename _InputIterator>\n        unordered_multiset(_InputIterator __f, _InputIterator __l, \n\t\t\t   typename _Base::size_type __n = 0,\n\t\t\t   const hasher& __hf = hasher(), \n\t\t\t   const key_equal& __eql = key_equal(), \n\t\t\t   const allocator_type& __a = allocator_type())\n\t: _Base(__f, __l, __n, __hf, __detail::_Mod_range_hashing(),\n\t\t__detail::_Default_ranged_hash(), __eql,\n\t\tstd::_Identity<_Value>(), __a)\n        { }\n    };\n\n  template<class _Value, class _Hash, class _Pred, class _Alloc,\n\t   bool __cache_hash_code>\n    inline void\n    swap (unordered_set<_Value, _Hash, _Pred,\n\t  _Alloc, __cache_hash_code>& __x,\n\t  unordered_set<_Value, _Hash, _Pred,\n\t  _Alloc, __cache_hash_code>& __y)\n    { __x.swap(__y); }\n\n  template<class _Value, class _Hash, class _Pred, class _Alloc,\n\t   bool __cache_hash_code>\n    inline void\n    swap(unordered_multiset<_Value, _Hash, _Pred,\n\t _Alloc, __cache_hash_code>& __x,\n\t unordered_multiset<_Value, _Hash, _Pred,\n\t _Alloc, __cache_hash_code>& __y)\n    { __x.swap(__y); }\n\n_GLIBCXX_END_NAMESPACE\n}\n\n#endif // _TR1_UNORDERED_SET\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/tr1/utility",
    "content": "// TR1 utility -*- C++ -*-\n\n// Copyright (C) 2004, 2005, 2006, 2007 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n/** @file tr1/utility\n *  This is a TR1 C++ Library header. \n */\n\n#ifndef _TR1_UTILITY\n#define _TR1_UTILITY 1\n\n#include \"../utility\"\n\nnamespace std\n{\n_GLIBCXX_BEGIN_NAMESPACE(tr1)\n\n  template<class _Tp> class tuple_size;\n  template<int _Int, class _Tp> class tuple_element;\n\n   // Various functions which give std::pair a tuple-like interface.\n  template<class _Tp1, class _Tp2>\n    struct tuple_size<std::pair<_Tp1, _Tp2> >\n    { static const int value = 2; };\n\n  template<class _Tp1, class _Tp2>\n    const int tuple_size<std::pair<_Tp1, _Tp2> >::value;\n\n  template<class _Tp1, class _Tp2>\n    struct tuple_element<0, std::pair<_Tp1, _Tp2> >\n    { typedef _Tp1 type; };\n \n  template<class _Tp1, class _Tp2>\n    struct tuple_element<1, std::pair<_Tp1, _Tp2> >\n    { typedef _Tp2 type; };\n \n\n  template<int _Int> struct __pair_get;\n\n  template<>\n    struct __pair_get<0>\n    {\n      template<typename _Tp1, typename _Tp2>\n      static _Tp1& __get(std::pair<_Tp1, _Tp2>& __pair)\n      { return __pair.first; }\n\n      template<typename _Tp1, typename _Tp2>\n      static const _Tp1& __const_get(const std::pair<_Tp1, _Tp2>& __pair)\n      { return __pair.first; }\n    };\n\n  template<>\n    struct __pair_get<1>\n    {\n      template<typename _Tp1, typename _Tp2>\n      static _Tp2& __get(std::pair<_Tp1, _Tp2>& __pair)\n      { return __pair.second; }\n\n      template<typename _Tp1, typename _Tp2>\n      static const _Tp2& __const_get(const std::pair<_Tp1, _Tp2>& __pair)\n      { return __pair.second; }\n    };\n\n   template<int _Int, class _Tp1, class _Tp2>\n     inline typename tuple_element<_Int, std::pair<_Tp1, _Tp2> >::type&\n     get(std::pair<_Tp1, _Tp2>& __in)\n     { return __pair_get<_Int>::__get(__in); }\n \n   template<int _Int, class _Tp1, class _Tp2>\n     inline const typename tuple_element<_Int, std::pair<_Tp1, _Tp2> >::type&\n     get(const std::pair<_Tp1, _Tp2>& __in)\n     { return __pair_get<_Int>::__const_get(__in); }\n\n_GLIBCXX_END_NAMESPACE\n} \n\n#endif\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/tr1/wchar.h",
    "content": "// TR1 wchar.h -*- C++ -*-\n\n// Copyright (C) 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n/** @file tr1/wchar.h\n *  This is a TR1 C++ Library header. \n */\n\n#ifndef _TR1_WCHAR_H\n#define _TR1_WCHAR_H 1\n\n#include <tr1/cwchar>\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/tr1/wctype.h",
    "content": "// TR1 wctype.h -*- C++ -*-\n\n// Copyright (C) 2006 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n/** @file tr1/wctype.h\n *  This is a TR1 C++ Library header. \n */\n\n#ifndef _TR1_WCTYPE_H\n#define _TR1_WCTYPE_H 1\n\n#include <tr1/cwctype>\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/typeinfo",
    "content": "// RTTI support for -*- C++ -*-\n// Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,\n// 2003, 2004, 2005, 2006, 2007\n// Free Software Foundation\n//\n// This file is part of GCC.\n//\n// GCC is free software; you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation; either version 2, or (at your option)\n// any later version.\n// \n// GCC is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n// \n// You should have received a copy of the GNU General Public License\n// along with GCC; see the file COPYING.  If not, write to\n// the Free Software Foundation, 51 Franklin Street, Fifth Floor,\n// Boston, MA 02110-1301, USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n/** @file typeinfo\n *  This is a Standard C++ Library header.\n */\n\n#ifndef _TYPEINFO\n#define _TYPEINFO\n\n#include <exception>\n\n#pragma GCC visibility push(default)\n\nextern \"C++\" {\n\nnamespace __cxxabiv1\n{\n  class __class_type_info;\n} // namespace __cxxabiv1\n\n#ifndef __GXX_MERGED_TYPEINFO_NAMES\n  #if !__GXX_WEAK__\n    // If weak symbols are not supported, typeinfo names are not merged.\n    #define __GXX_MERGED_TYPEINFO_NAMES 0\n  #else\n    // On platforms that support weak symbols, typeinfo names are merged.\n    #define __GXX_MERGED_TYPEINFO_NAMES 1\n  #endif\n#endif\n\nnamespace std \n{\n  /**\n   *  @brief  Part of RTTI.\n   *\n   *  The @c type_info class describes type information generated by\n   *  an implementation.\n  */\n  class type_info \n  {\n  public:\n    /** Destructor first. Being the first non-inline virtual function, this\n     *  controls in which translation unit the vtable is emitted. The\n     *  compiler makes use of that information to know where to emit\n     *  the runtime-mandated type_info structures in the new-abi.  */\n    virtual ~type_info();\n\n    /** Returns an @e implementation-defined byte string; this is not\n     *  portable between compilers!  */\n    const char* name() const\n    { return __name; }\n\n#if !__GXX_MERGED_TYPEINFO_NAMES\n    bool before(const type_info& __arg) const;\n\n    // In old abi, or when weak symbols are not supported, there can\n    // be multiple instances of a type_info object for one\n    // type. Uniqueness must use the _name value, not object address.\n    bool operator==(const type_info& __arg) const;\n#else\n    /** Returns true if @c *this precedes @c __arg in the implementation's\n     *  collation order.  */\n    // In new abi we can rely on type_info's NTBS being unique,\n    // and therefore address comparisons are sufficient.\n    bool before(const type_info& __arg) const\n    { return __name < __arg.__name; }\n\n    bool operator==(const type_info& __arg) const\n    { return __name == __arg.__name; }\n#endif\n    bool operator!=(const type_info& __arg) const\n    { return !operator==(__arg); }\n    \n    // Try and catch a thrown type. Store an adjusted pointer to the\n    // caught type in THR_OBJ. If THR_TYPE is not a pointer type, then\n    // THR_OBJ points to the thrown object. If THR_TYPE is a pointer\n    // type, then THR_OBJ is the pointer itself. OUTER indicates the\n    // number of outer pointers, and whether they were const\n    // qualified.\n    virtual bool __do_catch(const type_info *__thr_type, void **__thr_obj,\n\t\t\t    unsigned __outer) const;\n\n    // Internally used during catch matching\n    virtual bool __do_upcast(const __cxxabiv1::__class_type_info *__target,\n\t\t\t     void **__obj_ptr) const;\n\n   // Return true if this is a pointer type of some kind\n    virtual bool __is_pointer_p() const;\n\n    // Return true if this is a function type\n    virtual bool __is_function_p() const;\n\n  protected:\n    const char *__name;\n    \n    explicit type_info(const char *__n): __name(__n) { }\n    \n  private:\n    /// Assigning type_info is not supported.\n    type_info& operator=(const type_info&);\n    type_info(const type_info&);\n  };\n\n  /**\n   *  @brief  Thrown during incorrect typecasting.\n   *\n   *  If you attempt an invalid @c dynamic_cast expression, an instance of\n   *  this class (or something derived from this class) is thrown.  */\n  class bad_cast : public exception \n  {\n  public:\n    bad_cast() throw() { }\n\n    // This declaration is not useless:\n    // http://gcc.gnu.org/onlinedocs/gcc-3.0.2/gcc_6.html#SEC118\n    virtual ~bad_cast() throw();\n\n    // See comment in eh_exception.cc.\n    virtual const char* what() const throw();\n  };\n  \n  /** If you use a NULL pointer in a @c typeid expression, this is thrown.  */\n  class bad_typeid : public exception \n  {\n  public:\n    bad_typeid () throw() { }\n\n    // This declaration is not useless:\n    // http://gcc.gnu.org/onlinedocs/gcc-3.0.2/gcc_6.html#SEC118\n    virtual ~bad_typeid() throw();\n\n    // See comment in eh_exception.cc.\n    virtual const char* what() const throw();\n  };\n} // namespace std\n\n#pragma GCC visibility pop\n\n} // extern \"C++\"\n#endif\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/utility",
    "content": "// <utility> -*- C++ -*-\n\n// Copyright (C) 2001, 2002 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n/*\n *\n * Copyright (c) 1994\n * Hewlett-Packard Company\n *\n * Permission to use, copy, modify, distribute and sell this software\n * and its documentation for any purpose is hereby granted without fee,\n * provided that the above copyright notice appear in all copies and\n * that both that copyright notice and this permission notice appear\n * in supporting documentation.  Hewlett-Packard Company makes no\n * representations about the suitability of this software for any\n * purpose.  It is provided \"as is\" without express or implied warranty.\n *\n *\n * Copyright (c) 1996,1997\n * Silicon Graphics Computer Systems, Inc.\n *\n * Permission to use, copy, modify, distribute and sell this software\n * and its documentation for any purpose is hereby granted without fee,\n * provided that the above copyright notice appear in all copies and\n * that both that copyright notice and this permission notice appear\n * in supporting documentation.  Silicon Graphics makes no\n * representations about the suitability of this software for any\n * purpose.  It is provided \"as is\" without express or implied warranty.\n */\n\n/** @file include/utility\n *  This is a Standard C++ Library header. \n */\n\n#ifndef _GLIBCXX_UTILITY\n#define _GLIBCXX_UTILITY 1\n\n#pragma GCC system_header\n\n#include <bits/c++config.h>\n#include <bits/stl_relops.h>\n#include <bits/stl_pair.h>\n\n#endif /* _GLIBCXX_UTILITY */\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/valarray",
    "content": "// The template and inlines for the -*- C++ -*- valarray class.\n\n// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2004, 2005, 2006, 2007\n// Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n/** @file valarray\n *  This is a Standard C++ Library header. \n */\n\n// Written by Gabriel Dos Reis <Gabriel.Dos-Reis@DPTMaths.ENS-Cachan.Fr>\n\n#ifndef _GLIBCXX_VALARRAY\n#define _GLIBCXX_VALARRAY 1\n\n#pragma GCC system_header\n\n#include <bits/c++config.h>\n#include <cstddef>\n#include <cmath>\n#include <cstdlib>\n#include <numeric>\n#include <algorithm>\n#include <debug/debug.h>\n\n_GLIBCXX_BEGIN_NAMESPACE(std)\n\n  template<class _Clos, typename _Tp> \n    class _Expr;\n\n  template<typename _Tp1, typename _Tp2> \n    class _ValArray;    \n\n  template<class _Oper, template<class, class> class _Meta, class _Dom>\n    struct _UnClos;\n\n  template<class _Oper,\n        template<class, class> class _Meta1,\n        template<class, class> class _Meta2,\n        class _Dom1, class _Dom2> \n    class _BinClos;\n\n  template<template<class, class> class _Meta, class _Dom> \n    class _SClos;\n\n  template<template<class, class> class _Meta, class _Dom> \n    class _GClos;\n    \n  template<template<class, class> class _Meta, class _Dom> \n    class _IClos;\n    \n  template<template<class, class> class _Meta, class _Dom> \n    class _ValFunClos;\n  \n  template<template<class, class> class _Meta, class _Dom> \n    class _RefFunClos;\n\n  template<class _Tp> class valarray;   // An array of type _Tp\n  class slice;                          // BLAS-like slice out of an array\n  template<class _Tp> class slice_array;\n  class gslice;                         // generalized slice out of an array\n  template<class _Tp> class gslice_array;\n  template<class _Tp> class mask_array;     // masked array\n  template<class _Tp> class indirect_array; // indirected array\n\n_GLIBCXX_END_NAMESPACE\n\n#include <bits/valarray_array.h>\n#include <bits/valarray_before.h>\n  \n_GLIBCXX_BEGIN_NAMESPACE(std)\n\n  /**\n   *  @brief  Smart array designed to support numeric processing.\n   *\n   *  A valarray is an array that provides constraints intended to allow for\n   *  effective optimization of numeric array processing by reducing the\n   *  aliasing that can result from pointer representations.  It represents a\n   *  one-dimensional array from which different multidimensional subsets can\n   *  be accessed and modified.\n   *  \n   *  @param  Tp  Type of object in the array.\n   */\n  template<class _Tp> \n    class valarray\n    {\n      template<class _Op>\n\tstruct _UnaryOp \n\t{\n\t  typedef typename __fun<_Op, _Tp>::result_type __rt;\n\t  typedef _Expr<_UnClos<_Op, _ValArray, _Tp>, __rt> _Rt;\n\t};\n    public:\n      typedef _Tp value_type;\n      \n\t// _lib.valarray.cons_ construct/destroy:\n      ///  Construct an empty array.\n      valarray();\n\n      ///  Construct an array with @a n elements.\n      explicit valarray(size_t);\n\n      ///  Construct an array with @a n elements initialized to @a t.\n      valarray(const _Tp&, size_t);\n\n      ///  Construct an array initialized to the first @a n elements of @a t.\n      valarray(const _Tp* __restrict__, size_t);\n\n      ///  Copy constructor.\n      valarray(const valarray&);\n\n      ///  Construct an array with the same size and values in @a sa.\n      valarray(const slice_array<_Tp>&);\n\n      ///  Construct an array with the same size and values in @a ga.\n      valarray(const gslice_array<_Tp>&);\n\n      ///  Construct an array with the same size and values in @a ma.\n      valarray(const mask_array<_Tp>&);\n\n      ///  Construct an array with the same size and values in @a ia.\n      valarray(const indirect_array<_Tp>&);\n\n      template<class _Dom>\n\tvalarray(const _Expr<_Dom, _Tp>& __e);\n\n      ~valarray();\n\n      // _lib.valarray.assign_ assignment:\n      /**\n       *  @brief  Assign elements to an array.\n       *\n       *  Assign elements of array to values in @a v.  Results are undefined\n       *  if @a v does not have the same size as this array.\n       *\n       *  @param  v  Valarray to get values from.\n       */\n      valarray<_Tp>& operator=(const valarray<_Tp>&);\n\n      /**\n       *  @brief  Assign elements to a value.\n       *\n       *  Assign all elements of array to @a t.\n       *\n       *  @param  t  Value for elements.\n       */\n      valarray<_Tp>& operator=(const _Tp&);\n\n      /**\n       *  @brief  Assign elements to an array subset.\n       *\n       *  Assign elements of array to values in @a sa.  Results are undefined\n       *  if @a sa does not have the same size as this array.\n       *\n       *  @param  sa  Array slice to get values from.\n       */\n      valarray<_Tp>& operator=(const slice_array<_Tp>&);\n\n      /**\n       *  @brief  Assign elements to an array subset.\n       *\n       *  Assign elements of array to values in @a ga.  Results are undefined\n       *  if @a ga does not have the same size as this array.\n       *\n       *  @param  ga  Array slice to get values from.\n       */\n      valarray<_Tp>& operator=(const gslice_array<_Tp>&);\n\n      /**\n       *  @brief  Assign elements to an array subset.\n       *\n       *  Assign elements of array to values in @a ma.  Results are undefined\n       *  if @a ma does not have the same size as this array.\n       *\n       *  @param  ma  Array slice to get values from.\n       */\n      valarray<_Tp>& operator=(const mask_array<_Tp>&);\n\n      /**\n       *  @brief  Assign elements to an array subset.\n       *\n       *  Assign elements of array to values in @a ia.  Results are undefined\n       *  if @a ia does not have the same size as this array.\n       *\n       *  @param  ia  Array slice to get values from.\n       */\n      valarray<_Tp>& operator=(const indirect_array<_Tp>&);\n\n      template<class _Dom> valarray<_Tp>&\n\toperator= (const _Expr<_Dom, _Tp>&);\n\n      // _lib.valarray.access_ element access:\n      /**\n       *  Return a reference to the i'th array element.  \n       *\n       *  @param  i  Index of element to return.\n       *  @return  Reference to the i'th element.\n       */\n      _Tp&                operator[](size_t);\n\n      // _GLIBCXX_RESOLVE_LIB_DEFECTS\n      // 389. Const overload of valarray::operator[] returns by value.\n      const _Tp&          operator[](size_t) const;\n\n      // _lib.valarray.sub_ subset operations:\n      /**\n       *  @brief  Return an array subset.\n       *\n       *  Returns a new valarray containing the elements of the array\n       *  indicated by the slice argument.  The new valarray has the same size\n       *  as the input slice.  @see slice.\n       *\n       *  @param  s  The source slice.\n       *  @return  New valarray containing elements in @a s.\n       */\n      _Expr<_SClos<_ValArray, _Tp>, _Tp> operator[](slice) const;\n\n      /**\n       *  @brief  Return a reference to an array subset.\n       *\n       *  Returns a new valarray containing the elements of the array\n       *  indicated by the slice argument.  The new valarray has the same size\n       *  as the input slice.  @see slice.\n       *\n       *  @param  s  The source slice.\n       *  @return  New valarray containing elements in @a s.\n       */\n      slice_array<_Tp>    operator[](slice);\n\n      /**\n       *  @brief  Return an array subset.\n       *\n       *  Returns a slice_array referencing the elements of the array\n       *  indicated by the slice argument.  @see gslice.\n       *\n       *  @param  s  The source slice.\n       *  @return  Slice_array referencing elements indicated by @a s.\n       */\n      _Expr<_GClos<_ValArray, _Tp>, _Tp> operator[](const gslice&) const;\n\n      /**\n       *  @brief  Return a reference to an array subset.\n       *\n       *  Returns a new valarray containing the elements of the array\n       *  indicated by the gslice argument.  The new valarray has\n       *  the same size as the input gslice.  @see gslice.\n       *\n       *  @param  s  The source gslice.\n       *  @return  New valarray containing elements in @a s.\n       */\n      gslice_array<_Tp>   operator[](const gslice&);\n\n      /**\n       *  @brief  Return an array subset.\n       *\n       *  Returns a new valarray containing the elements of the array\n       *  indicated by the argument.  The input is a valarray of bool which\n       *  represents a bitmask indicating which elements should be copied into\n       *  the new valarray.  Each element of the array is added to the return\n       *  valarray if the corresponding element of the argument is true.\n       *\n       *  @param  m  The valarray bitmask.\n       *  @return  New valarray containing elements indicated by @a m.\n       */\n      valarray<_Tp>       operator[](const valarray<bool>&) const;\n\n      /**\n       *  @brief  Return a reference to an array subset.\n       *\n       *  Returns a new mask_array referencing the elements of the array\n       *  indicated by the argument.  The input is a valarray of bool which\n       *  represents a bitmask indicating which elements are part of the\n       *  subset.  Elements of the array are part of the subset if the\n       *  corresponding element of the argument is true.\n       *\n       *  @param  m  The valarray bitmask.\n       *  @return  New valarray containing elements indicated by @a m.\n       */\n      mask_array<_Tp>     operator[](const valarray<bool>&);\n\n      /**\n       *  @brief  Return an array subset.\n       *\n       *  Returns a new valarray containing the elements of the array\n       *  indicated by the argument.  The elements in the argument are\n       *  interpreted as the indices of elements of this valarray to copy to\n       *  the return valarray.\n       *\n       *  @param  i  The valarray element index list.\n       *  @return  New valarray containing elements in @a s.\n       */\n      _Expr<_IClos<_ValArray, _Tp>, _Tp>\n        operator[](const valarray<size_t>&) const;\n\n      /**\n       *  @brief  Return a reference to an array subset.\n       *\n       *  Returns an indirect_array referencing the elements of the array\n       *  indicated by the argument.  The elements in the argument are\n       *  interpreted as the indices of elements of this valarray to include\n       *  in the subset.  The returned indirect_array refers to these\n       *  elements.\n       *\n       *  @param  i  The valarray element index list.\n       *  @return  Indirect_array referencing elements in @a i.\n       */\n      indirect_array<_Tp> operator[](const valarray<size_t>&);\n\n      // _lib.valarray.unary_ unary operators:\n      ///  Return a new valarray by applying unary + to each element.\n      typename _UnaryOp<__unary_plus>::_Rt  operator+() const;\n\n      ///  Return a new valarray by applying unary - to each element.\n      typename _UnaryOp<__negate>::_Rt      operator-() const;\n\n      ///  Return a new valarray by applying unary ~ to each element.\n      typename _UnaryOp<__bitwise_not>::_Rt operator~() const;\n\n      ///  Return a new valarray by applying unary ! to each element.\n      typename _UnaryOp<__logical_not>::_Rt operator!() const;\n\n      // _lib.valarray.cassign_ computed assignment:\n      ///  Multiply each element of array by @a t.\n      valarray<_Tp>& operator*=(const _Tp&);\n\n      ///  Divide each element of array by @a t.\n      valarray<_Tp>& operator/=(const _Tp&);\n\n      ///  Set each element e of array to e % @a t.\n      valarray<_Tp>& operator%=(const _Tp&);\n\n      ///  Add @a t to each element of array.\n      valarray<_Tp>& operator+=(const _Tp&);\n\n      ///  Subtract @a t to each element of array.\n      valarray<_Tp>& operator-=(const _Tp&);\n\n      ///  Set each element e of array to e ^ @a t.\n      valarray<_Tp>& operator^=(const _Tp&);\n\n      ///  Set each element e of array to e & @a t.\n      valarray<_Tp>& operator&=(const _Tp&);\n\n      ///  Set each element e of array to e | @a t.\n      valarray<_Tp>& operator|=(const _Tp&);\n\n      ///  Left shift each element e of array by @a t bits.\n      valarray<_Tp>& operator<<=(const _Tp&);\n\n      ///  Right shift each element e of array by @a t bits.\n      valarray<_Tp>& operator>>=(const _Tp&);\n\n      ///  Multiply elements of array by corresponding elements of @a v.\n      valarray<_Tp>& operator*=(const valarray<_Tp>&);\n\n      ///  Divide elements of array by corresponding elements of @a v.\n      valarray<_Tp>& operator/=(const valarray<_Tp>&);\n\n      ///  Modulo elements of array by corresponding elements of @a v.\n      valarray<_Tp>& operator%=(const valarray<_Tp>&);\n\n      ///  Add corresponding elements of @a v to elements of array.\n      valarray<_Tp>& operator+=(const valarray<_Tp>&);\n\n      ///  Subtract corresponding elements of @a v from elements of array.\n      valarray<_Tp>& operator-=(const valarray<_Tp>&);\n\n      ///  Logical xor corresponding elements of @a v with elements of array.\n      valarray<_Tp>& operator^=(const valarray<_Tp>&);\n\n      ///  Logical or corresponding elements of @a v with elements of array.\n      valarray<_Tp>& operator|=(const valarray<_Tp>&);\n\n      ///  Logical and corresponding elements of @a v with elements of array.\n      valarray<_Tp>& operator&=(const valarray<_Tp>&);\n\n      ///  Left shift elements of array by corresponding elements of @a v.\n      valarray<_Tp>& operator<<=(const valarray<_Tp>&);\n\n      ///  Right shift elements of array by corresponding elements of @a v.\n      valarray<_Tp>& operator>>=(const valarray<_Tp>&);\n\n      template<class _Dom>\n\tvalarray<_Tp>& operator*=(const _Expr<_Dom, _Tp>&);\n      template<class _Dom>\n\tvalarray<_Tp>& operator/=(const _Expr<_Dom, _Tp>&);\n      template<class _Dom>\n\tvalarray<_Tp>& operator%=(const _Expr<_Dom, _Tp>&);\n      template<class _Dom>\n\tvalarray<_Tp>& operator+=(const _Expr<_Dom, _Tp>&);\n      template<class _Dom>\n\tvalarray<_Tp>& operator-=(const _Expr<_Dom, _Tp>&);\n      template<class _Dom>\n\tvalarray<_Tp>& operator^=(const _Expr<_Dom, _Tp>&);\n      template<class _Dom>\n\tvalarray<_Tp>& operator|=(const _Expr<_Dom, _Tp>&);\n      template<class _Dom>\n\tvalarray<_Tp>& operator&=(const _Expr<_Dom, _Tp>&);\n      template<class _Dom>\n        valarray<_Tp>& operator<<=(const _Expr<_Dom, _Tp>&);\n      template<class _Dom>\n\tvalarray<_Tp>& operator>>=(const _Expr<_Dom, _Tp>&);\n\n      // _lib.valarray.members_ member functions:\n      ///  Return the number of elements in array.\n      size_t size() const;\n\n      /**\n       *  @brief  Return the sum of all elements in the array.\n       *\n       *  Accumulates the sum of all elements into a Tp using +=.  The order\n       *  of adding the elements is unspecified.\n       */\n      _Tp    sum() const;\n\n      ///  Return the minimum element using operator<().\n      _Tp    min() const;\t\n\n      ///  Return the maximum element using operator<().\n      _Tp    max() const;\t\n\n      /**\n       *  @brief  Return a shifted array.\n       *\n       *  A new valarray is constructed as a copy of this array with elements\n       *  in shifted positions.  For an element with index i, the new position\n       *  is i - n.  The new valarray has the same size as the current one.\n       *  New elements without a value are set to 0.  Elements whose new\n       *  position is outside the bounds of the array are discarded.\n       *\n       *  Positive arguments shift toward index 0, discarding elements [0, n).\n       *  Negative arguments discard elements from the top of the array.\n       *\n       *  @param  n  Number of element positions to shift.\n       *  @return  New valarray with elements in shifted positions.\n       */\n      valarray<_Tp> shift (int) const;\n\n      /**\n       *  @brief  Return a rotated array.\n       *\n       *  A new valarray is constructed as a copy of this array with elements\n       *  in shifted positions.  For an element with index i, the new position\n       *  is (i - n) % size().  The new valarray has the same size as the\n       *  current one.  Elements that are shifted beyond the array bounds are\n       *  shifted into the other end of the array.  No elements are lost.\n       *\n       *  Positive arguments shift toward index 0, wrapping around the top.\n       *  Negative arguments shift towards the top, wrapping around to 0.\n       *\n       *  @param  n  Number of element positions to rotate.\n       *  @return  New valarray with elements in shifted positions.\n       */\n      valarray<_Tp> cshift(int) const;\n\n      /**\n       *  @brief  Apply a function to the array.\n       *\n       *  Returns a new valarray with elements assigned to the result of\n       *  applying func to the corresponding element of this array.  The new\n       *  array has the same size as this one.\n       *\n       *  @param  func  Function of Tp returning Tp to apply.\n       *  @return  New valarray with transformed elements.\n       */\n      _Expr<_ValFunClos<_ValArray, _Tp>, _Tp> apply(_Tp func(_Tp)) const;\n\n      /**\n       *  @brief  Apply a function to the array.\n       *\n       *  Returns a new valarray with elements assigned to the result of\n       *  applying func to the corresponding element of this array.  The new\n       *  array has the same size as this one.\n       *\n       *  @param  func  Function of const Tp& returning Tp to apply.\n       *  @return  New valarray with transformed elements.\n       */\n      _Expr<_RefFunClos<_ValArray, _Tp>, _Tp> apply(_Tp func(const _Tp&)) const;\n\n      /**\n       *  @brief  Resize array.\n       *\n       *  Resize this array to @a size and set all elements to @a c.  All\n       *  references and iterators are invalidated.\n       *\n       *  @param  size  New array size.\n       *  @param  c  New value for all elements.\n       */\n      void resize(size_t __size, _Tp __c = _Tp());\n\n    private:\n      size_t _M_size;\n      _Tp* __restrict__ _M_data;\n      \n      friend class _Array<_Tp>;\n    };\n  \n  template<typename _Tp>\n    inline const _Tp&\n    valarray<_Tp>::operator[](size_t __i) const\n    { \n      __glibcxx_requires_subscript(__i);\n      return _M_data[__i];\n    }\n\n  template<typename _Tp>\n    inline _Tp&\n    valarray<_Tp>::operator[](size_t __i)\n    { \n      __glibcxx_requires_subscript(__i);\n      return _M_data[__i];\n    }\n\n_GLIBCXX_END_NAMESPACE\n\n#include <bits/valarray_after.h>\n#include <bits/slice_array.h>\n#include <bits/gslice.h>\n#include <bits/gslice_array.h>\n#include <bits/mask_array.h>\n#include <bits/indirect_array.h>\n\n_GLIBCXX_BEGIN_NAMESPACE(std)\n\n  template<typename _Tp>\n    inline\n    valarray<_Tp>::valarray() : _M_size(0), _M_data(0) {}\n\n  template<typename _Tp>\n    inline \n    valarray<_Tp>::valarray(size_t __n) \n    : _M_size(__n), _M_data(__valarray_get_storage<_Tp>(__n))\n    { std::__valarray_default_construct(_M_data, _M_data + __n); }\n\n  template<typename _Tp>\n    inline\n    valarray<_Tp>::valarray(const _Tp& __t, size_t __n)\n    : _M_size(__n), _M_data(__valarray_get_storage<_Tp>(__n))\n    { std::__valarray_fill_construct(_M_data, _M_data + __n, __t); }\n\n  template<typename _Tp>\n    inline\n    valarray<_Tp>::valarray(const _Tp* __restrict__ __p, size_t __n)\n    : _M_size(__n), _M_data(__valarray_get_storage<_Tp>(__n))\n    { \n      _GLIBCXX_DEBUG_ASSERT(__p != 0 || __n == 0);\n      std::__valarray_copy_construct(__p, __p + __n, _M_data); \n    }\n\n  template<typename _Tp>\n    inline\n    valarray<_Tp>::valarray(const valarray<_Tp>& __v)\n    : _M_size(__v._M_size), _M_data(__valarray_get_storage<_Tp>(__v._M_size))\n    { std::__valarray_copy_construct(__v._M_data, __v._M_data + _M_size,\n\t\t\t\t     _M_data); }\n\n  template<typename _Tp>\n    inline\n    valarray<_Tp>::valarray(const slice_array<_Tp>& __sa)\n    : _M_size(__sa._M_sz), _M_data(__valarray_get_storage<_Tp>(__sa._M_sz))\n    {\n      std::__valarray_copy_construct\n\t(__sa._M_array, __sa._M_sz, __sa._M_stride, _Array<_Tp>(_M_data));\n    }\n\n  template<typename _Tp>\n    inline\n    valarray<_Tp>::valarray(const gslice_array<_Tp>& __ga)\n    : _M_size(__ga._M_index.size()),\n      _M_data(__valarray_get_storage<_Tp>(_M_size))\n    {\n      std::__valarray_copy_construct\n\t(__ga._M_array, _Array<size_t>(__ga._M_index),\n\t _Array<_Tp>(_M_data), _M_size);\n    }\n\n  template<typename _Tp>\n    inline\n    valarray<_Tp>::valarray(const mask_array<_Tp>& __ma)\n    : _M_size(__ma._M_sz), _M_data(__valarray_get_storage<_Tp>(__ma._M_sz))\n    {\n      std::__valarray_copy_construct\n\t(__ma._M_array, __ma._M_mask, _Array<_Tp>(_M_data), _M_size);\n    }\n\n  template<typename _Tp>\n    inline\n    valarray<_Tp>::valarray(const indirect_array<_Tp>& __ia)\n    : _M_size(__ia._M_sz), _M_data(__valarray_get_storage<_Tp>(__ia._M_sz))\n    {\n      std::__valarray_copy_construct\n\t(__ia._M_array, __ia._M_index, _Array<_Tp>(_M_data), _M_size);\n    }\n\n  template<typename _Tp> template<class _Dom>\n    inline\n    valarray<_Tp>::valarray(const _Expr<_Dom, _Tp>& __e)\n    : _M_size(__e.size()), _M_data(__valarray_get_storage<_Tp>(_M_size))\n    { std::__valarray_copy_construct(__e, _M_size, _Array<_Tp>(_M_data)); }\n\n  template<typename _Tp>\n    inline\n    valarray<_Tp>::~valarray()\n    {\n      std::__valarray_destroy_elements(_M_data, _M_data + _M_size);\n      std::__valarray_release_memory(_M_data);\n    }\n\n  template<typename _Tp>\n    inline valarray<_Tp>&\n    valarray<_Tp>::operator=(const valarray<_Tp>& __v)\n    {\n      _GLIBCXX_DEBUG_ASSERT(_M_size == __v._M_size);\n      std::__valarray_copy(__v._M_data, _M_size, _M_data);\n      return *this;\n    }\n\n  template<typename _Tp>\n    inline valarray<_Tp>&\n    valarray<_Tp>::operator=(const _Tp& __t)\n    {\n      std::__valarray_fill(_M_data, _M_size, __t);\n      return *this;\n    }\n\n  template<typename _Tp>\n    inline valarray<_Tp>&\n    valarray<_Tp>::operator=(const slice_array<_Tp>& __sa)\n    {\n      _GLIBCXX_DEBUG_ASSERT(_M_size == __sa._M_sz);\n      std::__valarray_copy(__sa._M_array, __sa._M_sz,\n\t\t\t   __sa._M_stride, _Array<_Tp>(_M_data));\n      return *this;\n    }\n\n  template<typename _Tp>\n    inline valarray<_Tp>&\n    valarray<_Tp>::operator=(const gslice_array<_Tp>& __ga)\n    {\n      _GLIBCXX_DEBUG_ASSERT(_M_size == __ga._M_index.size());\n      std::__valarray_copy(__ga._M_array, _Array<size_t>(__ga._M_index),\n\t\t\t   _Array<_Tp>(_M_data), _M_size);\n      return *this;\n    }\n\n  template<typename _Tp>\n    inline valarray<_Tp>&\n    valarray<_Tp>::operator=(const mask_array<_Tp>& __ma)\n    {\n      _GLIBCXX_DEBUG_ASSERT(_M_size == __ma._M_sz);\n      std::__valarray_copy(__ma._M_array, __ma._M_mask,\n\t\t\t   _Array<_Tp>(_M_data), _M_size);\n      return *this;\n    }\n\n  template<typename _Tp>\n    inline valarray<_Tp>&\n    valarray<_Tp>::operator=(const indirect_array<_Tp>& __ia)\n    {\n      _GLIBCXX_DEBUG_ASSERT(_M_size == __ia._M_sz);\n      std::__valarray_copy(__ia._M_array, __ia._M_index,\n\t\t\t   _Array<_Tp>(_M_data), _M_size);\n      return *this;\n    }\n\n  template<typename _Tp> template<class _Dom>\n    inline valarray<_Tp>&\n    valarray<_Tp>::operator=(const _Expr<_Dom, _Tp>& __e)\n    {\n      _GLIBCXX_DEBUG_ASSERT(_M_size == __e.size());\n      std::__valarray_copy(__e, _M_size, _Array<_Tp>(_M_data));\n      return *this;\n    }\n\n  template<typename _Tp>\n    inline _Expr<_SClos<_ValArray,_Tp>, _Tp>\n    valarray<_Tp>::operator[](slice __s) const\n    {\n      typedef _SClos<_ValArray,_Tp> _Closure;\n      return _Expr<_Closure, _Tp>(_Closure (_Array<_Tp>(_M_data), __s));\n    }\n\n  template<typename _Tp>\n    inline slice_array<_Tp>\n    valarray<_Tp>::operator[](slice __s)\n    { return slice_array<_Tp>(_Array<_Tp>(_M_data), __s); }\n\n  template<typename _Tp>\n    inline _Expr<_GClos<_ValArray,_Tp>, _Tp>\n    valarray<_Tp>::operator[](const gslice& __gs) const\n    {\n      typedef _GClos<_ValArray,_Tp> _Closure;\n      return _Expr<_Closure, _Tp>\n\t(_Closure(_Array<_Tp>(_M_data), __gs._M_index->_M_index));\n    }\n\n  template<typename _Tp>\n    inline gslice_array<_Tp>\n    valarray<_Tp>::operator[](const gslice& __gs)\n    {\n      return gslice_array<_Tp>\n\t(_Array<_Tp>(_M_data), __gs._M_index->_M_index);\n    }\n\n  template<typename _Tp>\n    inline valarray<_Tp>\n    valarray<_Tp>::operator[](const valarray<bool>& __m) const\n    {\n      size_t __s = 0;\n      size_t __e = __m.size();\n      for (size_t __i=0; __i<__e; ++__i)\n\tif (__m[__i]) ++__s;\n      return valarray<_Tp>(mask_array<_Tp>(_Array<_Tp>(_M_data), __s,\n\t\t\t\t\t   _Array<bool> (__m)));\n    }\n\n  template<typename _Tp>\n    inline mask_array<_Tp>\n    valarray<_Tp>::operator[](const valarray<bool>& __m)\n    {\n      size_t __s = 0;\n      size_t __e = __m.size();\n      for (size_t __i=0; __i<__e; ++__i)\n\tif (__m[__i]) ++__s;\n      return mask_array<_Tp>(_Array<_Tp>(_M_data), __s, _Array<bool>(__m));\n    }\n\n  template<typename _Tp>\n    inline _Expr<_IClos<_ValArray,_Tp>, _Tp>\n    valarray<_Tp>::operator[](const valarray<size_t>& __i) const\n    {\n      typedef _IClos<_ValArray,_Tp> _Closure;\n      return _Expr<_Closure, _Tp>(_Closure(*this, __i));\n    }\n\n  template<typename _Tp>\n    inline indirect_array<_Tp>\n    valarray<_Tp>::operator[](const valarray<size_t>& __i)\n    {\n      return indirect_array<_Tp>(_Array<_Tp>(_M_data), __i.size(),\n\t\t\t\t _Array<size_t>(__i));\n    }\n\n  template<class _Tp>\n    inline size_t \n    valarray<_Tp>::size() const\n    { return _M_size; }\n\n  template<class _Tp>\n    inline _Tp\n    valarray<_Tp>::sum() const\n    {\n      _GLIBCXX_DEBUG_ASSERT(_M_size > 0);\n      return std::__valarray_sum(_M_data, _M_data + _M_size);\n    }\n\n  template<class _Tp>\n     inline valarray<_Tp>\n     valarray<_Tp>::shift(int __n) const\n     {\n       valarray<_Tp> __ret;\n\n       if (_M_size == 0)\n\t return __ret;\n\n       _Tp* __restrict__ __tmp_M_data =\n\t std::__valarray_get_storage<_Tp>(_M_size);\n\n       if (__n == 0)\n\t std::__valarray_copy_construct(_M_data,\n\t\t\t\t\t_M_data + _M_size, __tmp_M_data);\n       else if (__n > 0)      // shift left\n\t {\n\t   if (size_t(__n) > _M_size)\n\t     __n = _M_size;\n\n\t   std::__valarray_copy_construct(_M_data + __n,\n\t\t\t\t\t  _M_data + _M_size, __tmp_M_data);\n\t   std::__valarray_default_construct(__tmp_M_data + _M_size - __n,\n\t\t\t\t\t     __tmp_M_data + _M_size);\n\t }\n       else                   // shift right\n\t {\n\t   if (size_t(-__n) > _M_size)\n\t     __n = -_M_size;\n\n\t   std::__valarray_copy_construct(_M_data, _M_data + _M_size + __n,\n\t\t\t\t\t  __tmp_M_data - __n);\n\t   std::__valarray_default_construct(__tmp_M_data,\n\t\t\t\t\t     __tmp_M_data - __n);\n\t }\n\n       __ret._M_size = _M_size;\n       __ret._M_data = __tmp_M_data;\n       return __ret;\n     }\n\n  template<class _Tp>\n     inline valarray<_Tp>\n     valarray<_Tp>::cshift(int __n) const\n     {\n       valarray<_Tp> __ret;\n\n       if (_M_size == 0)\n\t return __ret;\n\n       _Tp* __restrict__ __tmp_M_data =\n\t std::__valarray_get_storage<_Tp>(_M_size);\n\n       if (__n == 0)\n\t std::__valarray_copy_construct(_M_data,\n\t\t\t\t\t_M_data + _M_size, __tmp_M_data);\n       else if (__n > 0)      // cshift left\n\t {\n\t   if (size_t(__n) > _M_size)\n\t     __n = __n % _M_size;\n\n\t   std::__valarray_copy_construct(_M_data, _M_data + __n,\n\t\t\t\t\t  __tmp_M_data + _M_size - __n);\n\t   std::__valarray_copy_construct(_M_data + __n, _M_data + _M_size,\n\t\t\t\t\t  __tmp_M_data);\n\t }\n       else                   // cshift right\n\t {\n\t   if (size_t(-__n) > _M_size)\n\t     __n = -(size_t(-__n) % _M_size);\n\n\t   std::__valarray_copy_construct(_M_data + _M_size + __n,\n\t\t\t\t\t  _M_data + _M_size, __tmp_M_data);\n\t   std::__valarray_copy_construct(_M_data, _M_data + _M_size + __n,\n\t\t\t\t\t  __tmp_M_data - __n);\n\t }\n\n       __ret._M_size = _M_size;\n       __ret._M_data = __tmp_M_data;\n       return __ret;\n     }\n\n  template<class _Tp>\n    inline void\n    valarray<_Tp>::resize(size_t __n, _Tp __c)\n    {\n      // This complication is so to make valarray<valarray<T> > work\n      // even though it is not required by the standard.  Nobody should\n      // be saying valarray<valarray<T> > anyway.  See the specs.\n      std::__valarray_destroy_elements(_M_data, _M_data + _M_size);\n      if (_M_size != __n)\n\t{\n\t  std::__valarray_release_memory(_M_data);\n\t  _M_size = __n;\n\t  _M_data = __valarray_get_storage<_Tp>(__n);\n\t}\n      std::__valarray_fill_construct(_M_data, _M_data + __n, __c);\n    }\n    \n  template<typename _Tp>\n    inline _Tp\n    valarray<_Tp>::min() const\n    {\n      _GLIBCXX_DEBUG_ASSERT(_M_size > 0);\n      return *std::min_element(_M_data, _M_data+_M_size);\n    }\n\n  template<typename _Tp>\n    inline _Tp\n    valarray<_Tp>::max() const\n    {\n      _GLIBCXX_DEBUG_ASSERT(_M_size > 0);\n      return *std::max_element(_M_data, _M_data+_M_size);\n    }\n  \n  template<class _Tp>\n    inline _Expr<_ValFunClos<_ValArray, _Tp>, _Tp>\n    valarray<_Tp>::apply(_Tp func(_Tp)) const\n    {\n      typedef _ValFunClos<_ValArray, _Tp> _Closure;\n      return _Expr<_Closure, _Tp>(_Closure(*this, func));\n    }\n\n  template<class _Tp>\n    inline _Expr<_RefFunClos<_ValArray, _Tp>, _Tp>\n    valarray<_Tp>::apply(_Tp func(const _Tp &)) const\n    {\n      typedef _RefFunClos<_ValArray, _Tp> _Closure;\n      return _Expr<_Closure, _Tp>(_Closure(*this, func));\n    }\n\n#define _DEFINE_VALARRAY_UNARY_OPERATOR(_Op, _Name)                     \\\n  template<typename _Tp>\t\t\t\t\t\t\\\n    inline typename valarray<_Tp>::template _UnaryOp<_Name>::_Rt      \t\\\n    valarray<_Tp>::operator _Op() const\t\t\t\t\t\\\n    {\t\t\t\t\t\t\t\t\t\\\n      typedef _UnClos<_Name, _ValArray, _Tp> _Closure;\t                \\\n      typedef typename __fun<_Name, _Tp>::result_type _Rt;              \\\n      return _Expr<_Closure, _Rt>(_Closure(*this));\t\t\t\\\n    }\n\n    _DEFINE_VALARRAY_UNARY_OPERATOR(+, __unary_plus)\n    _DEFINE_VALARRAY_UNARY_OPERATOR(-, __negate)\n    _DEFINE_VALARRAY_UNARY_OPERATOR(~, __bitwise_not)\n    _DEFINE_VALARRAY_UNARY_OPERATOR (!, __logical_not)\n\n#undef _DEFINE_VALARRAY_UNARY_OPERATOR\n\n#define _DEFINE_VALARRAY_AUGMENTED_ASSIGNMENT(_Op, _Name)               \\\n  template<class _Tp>\t\t\t\t\t\t\t\\\n    inline valarray<_Tp>&\t\t\t\t\t\t\\\n    valarray<_Tp>::operator _Op##=(const _Tp &__t)\t\t\t\\\n    {\t\t\t\t\t\t\t\t\t\\\n      _Array_augmented_##_Name(_Array<_Tp>(_M_data), _M_size, __t);\t\\\n      return *this;\t\t\t\t\t\t\t\\\n    }\t\t\t\t\t\t\t\t\t\\\n\t\t\t\t\t\t\t\t\t\\\n  template<class _Tp>\t\t\t\t\t\t\t\\\n    inline valarray<_Tp>&\t\t\t\t\t\t\\\n    valarray<_Tp>::operator _Op##=(const valarray<_Tp> &__v)\t\t\\\n    {\t\t\t\t\t\t\t\t\t\\\n      _GLIBCXX_DEBUG_ASSERT(_M_size == __v._M_size);                    \\\n      _Array_augmented_##_Name(_Array<_Tp>(_M_data), _M_size, \t\t\\\n\t\t\t       _Array<_Tp>(__v._M_data));\t\t\\\n      return *this;\t\t\t\t\t\t\t\\\n    }\n\n_DEFINE_VALARRAY_AUGMENTED_ASSIGNMENT(+, __plus)\n_DEFINE_VALARRAY_AUGMENTED_ASSIGNMENT(-, __minus)\n_DEFINE_VALARRAY_AUGMENTED_ASSIGNMENT(*, __multiplies)\n_DEFINE_VALARRAY_AUGMENTED_ASSIGNMENT(/, __divides)\n_DEFINE_VALARRAY_AUGMENTED_ASSIGNMENT(%, __modulus)\n_DEFINE_VALARRAY_AUGMENTED_ASSIGNMENT(^, __bitwise_xor)\n_DEFINE_VALARRAY_AUGMENTED_ASSIGNMENT(&, __bitwise_and)\n_DEFINE_VALARRAY_AUGMENTED_ASSIGNMENT(|, __bitwise_or)\n_DEFINE_VALARRAY_AUGMENTED_ASSIGNMENT(<<, __shift_left)\n_DEFINE_VALARRAY_AUGMENTED_ASSIGNMENT(>>, __shift_right)\n\n#undef _DEFINE_VALARRAY_AUGMENTED_ASSIGNMENT\n\n#define _DEFINE_VALARRAY_EXPR_AUGMENTED_ASSIGNMENT(_Op, _Name)          \\\n  template<class _Tp> template<class _Dom>\t\t\t\t\\\n    inline valarray<_Tp>&\t\t\t\t\t\t\\\n    valarray<_Tp>::operator _Op##=(const _Expr<_Dom, _Tp>& __e)\t\t\\\n    {\t\t\t\t\t\t\t\t\t\\\n      _Array_augmented_##_Name(_Array<_Tp>(_M_data), __e, _M_size);\t\\\n      return *this;\t\t\t\t\t\t\t\\\n    }\n\n_DEFINE_VALARRAY_EXPR_AUGMENTED_ASSIGNMENT(+, __plus)\n_DEFINE_VALARRAY_EXPR_AUGMENTED_ASSIGNMENT(-, __minus)\n_DEFINE_VALARRAY_EXPR_AUGMENTED_ASSIGNMENT(*, __multiplies)\n_DEFINE_VALARRAY_EXPR_AUGMENTED_ASSIGNMENT(/, __divides)\n_DEFINE_VALARRAY_EXPR_AUGMENTED_ASSIGNMENT(%, __modulus)\n_DEFINE_VALARRAY_EXPR_AUGMENTED_ASSIGNMENT(^, __bitwise_xor)\n_DEFINE_VALARRAY_EXPR_AUGMENTED_ASSIGNMENT(&, __bitwise_and)\n_DEFINE_VALARRAY_EXPR_AUGMENTED_ASSIGNMENT(|, __bitwise_or)\n_DEFINE_VALARRAY_EXPR_AUGMENTED_ASSIGNMENT(<<, __shift_left)\n_DEFINE_VALARRAY_EXPR_AUGMENTED_ASSIGNMENT(>>, __shift_right)\n\n#undef _DEFINE_VALARRAY_EXPR_AUGMENTED_ASSIGNMENT\n    \n\n#define _DEFINE_BINARY_OPERATOR(_Op, _Name)\t\t\t\t\\\n  template<typename _Tp>\t\t\t\t\t\t\\\n    inline _Expr<_BinClos<_Name, _ValArray, _ValArray, _Tp, _Tp>,       \\\n                 typename __fun<_Name, _Tp>::result_type>               \\\n    operator _Op(const valarray<_Tp>& __v, const valarray<_Tp>& __w)\t\\\n    {\t\t\t\t\t\t\t\t\t\\\n      _GLIBCXX_DEBUG_ASSERT(__v.size() == __w.size());                  \\\n      typedef _BinClos<_Name, _ValArray, _ValArray, _Tp, _Tp> _Closure; \\\n      typedef typename __fun<_Name, _Tp>::result_type _Rt;              \\\n      return _Expr<_Closure, _Rt>(_Closure(__v, __w));                  \\\n    }\t\t\t\t\t\t\t\t\t\\\n\t\t\t\t\t\t\t\t\t\\\n  template<typename _Tp>\t\t\t\t\t\t\\\n    inline _Expr<_BinClos<_Name, _ValArray,_Constant, _Tp, _Tp>,        \\\n                 typename __fun<_Name, _Tp>::result_type>               \\\n    operator _Op(const valarray<_Tp>& __v, const _Tp& __t)\t\t\\\n    {\t\t\t\t\t\t\t\t\t\\\n      typedef _BinClos<_Name, _ValArray, _Constant, _Tp, _Tp> _Closure;\t\\\n      typedef typename __fun<_Name, _Tp>::result_type _Rt;              \\\n      return _Expr<_Closure, _Rt>(_Closure(__v, __t));\t                \\\n    }\t\t\t\t\t\t\t\t\t\\\n\t\t\t\t\t\t\t\t\t\\\n  template<typename _Tp>\t\t\t\t\t\t\\\n    inline _Expr<_BinClos<_Name, _Constant, _ValArray, _Tp, _Tp>,       \\\n                 typename __fun<_Name, _Tp>::result_type>               \\\n    operator _Op(const _Tp& __t, const valarray<_Tp>& __v)\t\t\\\n    {\t\t\t\t\t\t\t\t\t\\\n      typedef _BinClos<_Name, _Constant, _ValArray, _Tp, _Tp> _Closure; \\\n      typedef typename __fun<_Name, _Tp>::result_type _Rt;              \\\n      return _Expr<_Closure, _Rt>(_Closure(__t, __v));        \t        \\\n    }\n\n_DEFINE_BINARY_OPERATOR(+, __plus)\n_DEFINE_BINARY_OPERATOR(-, __minus)\n_DEFINE_BINARY_OPERATOR(*, __multiplies)\n_DEFINE_BINARY_OPERATOR(/, __divides)\n_DEFINE_BINARY_OPERATOR(%, __modulus)\n_DEFINE_BINARY_OPERATOR(^, __bitwise_xor)\n_DEFINE_BINARY_OPERATOR(&, __bitwise_and)\n_DEFINE_BINARY_OPERATOR(|, __bitwise_or)\n_DEFINE_BINARY_OPERATOR(<<, __shift_left)\n_DEFINE_BINARY_OPERATOR(>>, __shift_right)\n_DEFINE_BINARY_OPERATOR(&&, __logical_and)\n_DEFINE_BINARY_OPERATOR(||, __logical_or)\n_DEFINE_BINARY_OPERATOR(==, __equal_to)\n_DEFINE_BINARY_OPERATOR(!=, __not_equal_to)\n_DEFINE_BINARY_OPERATOR(<, __less)\n_DEFINE_BINARY_OPERATOR(>, __greater)\n_DEFINE_BINARY_OPERATOR(<=, __less_equal)\n_DEFINE_BINARY_OPERATOR(>=, __greater_equal)\n\n#undef _DEFINE_BINARY_OPERATOR\n\n_GLIBCXX_END_NAMESPACE\n\n#endif /* _GLIBCXX_VALARRAY */\n"
  },
  {
    "path": "freebsd-headers/c++/4.2/vector",
    "content": "// <vector> -*- C++ -*-\n\n// Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc.\n//\n// This file is part of the GNU ISO C++ Library.  This library is free\n// software; you can redistribute it and/or modify it under the\n// terms of the GNU General Public License as published by the\n// Free Software Foundation; either version 2, or (at your option)\n// any later version.\n\n// This library is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License along\n// with this library; see the file COPYING.  If not, write to the Free\n// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,\n// USA.\n\n// As a special exception, you may use this file as part of a free software\n// library without restriction.  Specifically, if other files instantiate\n// templates or use macros or inline functions from this file, or you compile\n// this file and link it with other files to produce an executable, this\n// file does not by itself cause the resulting executable to be covered by\n// the GNU General Public License.  This exception does not however\n// invalidate any other reasons why the executable file might be covered by\n// the GNU General Public License.\n\n/*\n *\n * Copyright (c) 1994\n * Hewlett-Packard Company\n *\n * Permission to use, copy, modify, distribute and sell this software\n * and its documentation for any purpose is hereby granted without fee,\n * provided that the above copyright notice appear in all copies and\n * that both that copyright notice and this permission notice appear\n * in supporting documentation.  Hewlett-Packard Company makes no\n * representations about the suitability of this software for any\n * purpose.  It is provided \"as is\" without express or implied warranty.\n *\n *\n * Copyright (c) 1996\n * Silicon Graphics Computer Systems, Inc.\n *\n * Permission to use, copy, modify, distribute and sell this software\n * and its documentation for any purpose is hereby granted without fee,\n * provided that the above copyright notice appear in all copies and\n * that both that copyright notice and this permission notice appear\n * in supporting documentation.  Silicon Graphics makes no\n * representations about the suitability of this software for any\n * purpose.  It is provided \"as is\" without express or implied warranty.\n */\n\n/** @file include/vector\n *  This is a Standard C++ Library header.\n */\n\n#ifndef _GLIBCXX_VECTOR\n#define _GLIBCXX_VECTOR 1\n\n#pragma GCC system_header\n\n#include <bits/functexcept.h>\n#include <bits/stl_algobase.h>\n#include <bits/allocator.h>\n#include <bits/stl_construct.h>\n#include <bits/stl_uninitialized.h>\n#include <bits/stl_vector.h>\n#include <bits/stl_bvector.h> \n\n#ifndef _GLIBCXX_EXPORT_TEMPLATE\n# include <bits/vector.tcc>\n#endif\n\n#ifdef _GLIBCXX_DEBUG\n# include <debug/vector>\n#endif\n\n#endif /* _GLIBCXX_VECTOR */\n\n"
  },
  {
    "path": "freebsd-headers/calendar.h",
    "content": "/*-\n * Copyright (c) 1997 Wolfgang Helbig\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/lib/libcalendar/calendar.h 50476 1999-08-28 00:22:10Z peter $\n */\nstruct date {\n\tint y;\t/* year */\n\tint m;\t/* month */\n\tint d;\t/* day */\n};\n\nstruct date\t*easterg(int _year, struct date *_dt);\nstruct date\t*easterog(int _year, struct date *_dt);\nstruct date\t*easteroj(int _year, struct date *_dt);\nstruct date\t*gdate(int _nd, struct date *_dt);\nstruct date\t*jdate(int _nd, struct date *_dt);\nint\t\t ndaysg(struct date *_dt);\nint\t\t ndaysj(struct date *_dt);\nint\t\t week(int _nd, int *_year);\nint\t\t weekday(int _nd);\n"
  },
  {
    "path": "freebsd-headers/cam/ata/ata_all.h",
    "content": "/*-\n * Copyright (c) 2009 Alexander Motin <mav@FreeBSD.org>\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer,\n *    without modification, immediately at the beginning of the file.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR\n * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES\n * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,\n * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF\n * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/cam/ata/ata_all.h 220886 2011-04-20 13:27:50Z mav $\n */\n\n#ifndef\tCAM_ATA_ALL_H\n#define CAM_ATA_ALL_H 1\n\n#include <sys/ata.h>\n\nstruct ccb_ataio;\nstruct cam_periph;\nunion  ccb;\n\n#define\tSID_DMA\t\t0x10\t/* Abuse inq_flags bit to track enabled DMA. */\n\nstruct ata_cmd {\n\tu_int8_t\tflags;\t\t/* ATA command flags */\n#define\t\tCAM_ATAIO_48BIT\t\t0x01\t/* Command has 48-bit format */\n#define\t\tCAM_ATAIO_FPDMA\t\t0x02\t/* FPDMA command */\n#define\t\tCAM_ATAIO_CONTROL\t0x04\t/* Control, not a command */\n#define\t\tCAM_ATAIO_NEEDRESULT\t0x08\t/* Request requires result. */\n#define\t\tCAM_ATAIO_DMA\t\t0x10\t/* DMA command */\n\n\tu_int8_t\tcommand;\n\tu_int8_t\tfeatures;\n\n\tu_int8_t\tlba_low;\n\tu_int8_t\tlba_mid;\n\tu_int8_t\tlba_high;\n\tu_int8_t\tdevice;\n\n\tu_int8_t\tlba_low_exp;\n\tu_int8_t\tlba_mid_exp;\n\tu_int8_t\tlba_high_exp;\n\tu_int8_t\tfeatures_exp;\n\n\tu_int8_t\tsector_count;\n\tu_int8_t\tsector_count_exp;\n\tu_int8_t\tcontrol;\n};\n\nstruct ata_res {\n\tu_int8_t\tflags;\t\t/* ATA command flags */\n#define\t\tCAM_ATAIO_48BIT\t\t0x01\t/* Command has 48-bit format */\n\n\tu_int8_t\tstatus;\n\tu_int8_t\terror;\n\n\tu_int8_t\tlba_low;\n\tu_int8_t\tlba_mid;\n\tu_int8_t\tlba_high;\n\tu_int8_t\tdevice;\n\n\tu_int8_t\tlba_low_exp;\n\tu_int8_t\tlba_mid_exp;\n\tu_int8_t\tlba_high_exp;\n\n\tu_int8_t\tsector_count;\n\tu_int8_t\tsector_count_exp;\n};\n\nint\tata_version(int ver);\n\nchar *\tata_op_string(struct ata_cmd *cmd);\nchar *\tata_cmd_string(struct ata_cmd *cmd, char *cmd_string, size_t len);\nchar *\tata_res_string(struct ata_res *res, char *res_string, size_t len);\nint\tata_command_sbuf(struct ccb_ataio *ataio, struct sbuf *sb);\nint\tata_status_sbuf(struct ccb_ataio *ataio, struct sbuf *sb);\nint\tata_res_sbuf(struct ccb_ataio *ataio, struct sbuf *sb);\n\nvoid\tata_print_ident(struct ata_params *ident_data);\n\nuint32_t\tata_logical_sector_size(struct ata_params *ident_data);\nuint64_t\tata_physical_sector_size(struct ata_params *ident_data);\nuint64_t\tata_logical_sector_offset(struct ata_params *ident_data);\n\nvoid\tata_28bit_cmd(struct ccb_ataio *ataio, uint8_t cmd, uint8_t features,\n    uint32_t lba, uint8_t sector_count);\nvoid\tata_48bit_cmd(struct ccb_ataio *ataio, uint8_t cmd, uint16_t features,\n    uint64_t lba, uint16_t sector_count);\nvoid\tata_ncq_cmd(struct ccb_ataio *ataio, uint8_t cmd,\n    uint64_t lba, uint16_t sector_count);\nvoid\tata_reset_cmd(struct ccb_ataio *ataio);\nvoid\tata_pm_read_cmd(struct ccb_ataio *ataio, int reg, int port);\nvoid\tata_pm_write_cmd(struct ccb_ataio *ataio, int reg, int port, uint32_t val);\n\nvoid\tata_bswap(int8_t *buf, int len);\nvoid\tata_btrim(int8_t *buf, int len);\nvoid\tata_bpack(int8_t *src, int8_t *dst, int len);\n\nint\tata_max_pmode(struct ata_params *ap);\nint\tata_max_wmode(struct ata_params *ap);\nint\tata_max_umode(struct ata_params *ap);\nint\tata_max_mode(struct ata_params *ap, int maxmode);\n\nchar *\tata_mode2string(int mode);\nint\tata_string2mode(char *str);\nu_int\tata_mode2speed(int mode);\nu_int\tata_revision2speed(int revision);\nint\tata_speed2revision(u_int speed);\n\nint\tata_identify_match(caddr_t identbuffer, caddr_t table_entry);\nint\tata_static_identify_match(caddr_t identbuffer, caddr_t table_entry);\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/cam/cam.h",
    "content": "/*-\n * Data structures and definitions for the CAM system.\n *\n * Copyright (c) 1997 Justin T. Gibbs.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions, and the following disclaimer,\n *    without modification, immediately at the beginning of the file.\n * 2. The name of the author may not be used to endorse or promote products\n *    derived from this software without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR\n * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/cam/cam.h 216088 2010-11-30 22:39:46Z ken $\n */\n\n#ifndef _CAM_CAM_H\n#define _CAM_CAM_H 1\n\n#ifdef _KERNEL\n#include <opt_cam.h>\n#endif\n\n#include <sys/cdefs.h>\n\ntypedef u_int path_id_t;\ntypedef u_int target_id_t;\ntypedef u_int lun_id_t;\n\n#define\tCAM_XPT_PATH_ID\t((path_id_t)~0)\n#define\tCAM_BUS_WILDCARD ((path_id_t)~0)\n#define\tCAM_TARGET_WILDCARD ((target_id_t)~0)\n#define\tCAM_LUN_WILDCARD ((lun_id_t)~0)\n\n/*\n * Maximum length for a CAM CDB.  \n */\n#define CAM_MAX_CDBLEN 16\n\n/*\n * Definition of a CAM peripheral driver entry.  Peripheral drivers instantiate\n * one of these for each device they wish to communicate with and pass it into\n * the xpt layer when they wish to schedule work on that device via the\n * xpt_schedule API.\n */\nstruct cam_periph;\n\n/*\n * Priority information for a CAM structure. \n */\ntypedef enum {\n    CAM_RL_HOST,\n    CAM_RL_BUS,\n    CAM_RL_XPT,\n    CAM_RL_DEV,\n    CAM_RL_NORMAL,\n    CAM_RL_VALUES\n} cam_rl;\n/*\n * The generation number is incremented everytime a new entry is entered into\n * the queue giving round robin per priority level scheduling.\n */\ntypedef struct {\n\tu_int32_t priority;\n#define CAM_PRIORITY_HOST\t((CAM_RL_HOST << 8) + 0x80)\n#define CAM_PRIORITY_BUS\t((CAM_RL_BUS << 8) + 0x80)\n#define CAM_PRIORITY_XPT\t((CAM_RL_XPT << 8) + 0x80)\n#define CAM_PRIORITY_DEV\t((CAM_RL_DEV << 8) + 0x80)\n#define CAM_PRIORITY_NORMAL\t((CAM_RL_NORMAL << 8) + 0x80)\n#define CAM_PRIORITY_NONE\t(u_int32_t)-1\n#define CAM_PRIORITY_TO_RL(x)\t((x) >> 8)\n\tu_int32_t generation;\n\tint       index;\n#define CAM_UNQUEUED_INDEX\t-1\n#define CAM_ACTIVE_INDEX\t-2\t\n#define CAM_DONEQ_INDEX\t\t-3\t\n} cam_pinfo;\n\n/*\n * Macro to compare two generation numbers.  It is used like this:  \n *\n *\tif (GENERATIONCMP(a, >=, b))\n *\t\t...;\n *\n * GERERATIONCMP uses modular arithmetic to guard against wraps\n * wraps in the generation number.\n */\n#define GENERATIONCMP(x, op, y) ((int32_t)((x) - (y)) op 0)\n\n/* CAM flags XXX Move to cam_periph.h ??? */\ntypedef enum {\n\tCAM_FLAG_NONE\t\t= 0x00,\n\tCAM_EXPECT_INQ_CHANGE\t= 0x01,\n\tCAM_RETRY_SELTO\t\t= 0x02 /* Retry Selection Timeouts */\n} cam_flags;\n\n/* CAM  Status field values */\ntypedef enum {\n\tCAM_REQ_INPROG,\t\t/* CCB request is in progress */\n\tCAM_REQ_CMP,\t\t/* CCB request completed without error */\n\tCAM_REQ_ABORTED,\t/* CCB request aborted by the host */\n\tCAM_UA_ABORT,\t\t/* Unable to abort CCB request */\n\tCAM_REQ_CMP_ERR,\t/* CCB request completed with an error */\n\tCAM_BUSY,\t\t/* CAM subsystem is busy */\n\tCAM_REQ_INVALID,\t/* CCB request was invalid */\n\tCAM_PATH_INVALID,\t/* Supplied Path ID is invalid */\n\tCAM_DEV_NOT_THERE,\t/* SCSI Device Not Installed/there */\n\tCAM_UA_TERMIO,\t\t/* Unable to terminate I/O CCB request */\n\tCAM_SEL_TIMEOUT,\t/* Target Selection Timeout */\n\tCAM_CMD_TIMEOUT,\t/* Command timeout */\n\tCAM_SCSI_STATUS_ERROR,\t/* SCSI error, look at error code in CCB */\n\tCAM_MSG_REJECT_REC,\t/* Message Reject Received */\n\tCAM_SCSI_BUS_RESET,\t/* SCSI Bus Reset Sent/Received */\n\tCAM_UNCOR_PARITY,\t/* Uncorrectable parity error occurred */\n\tCAM_AUTOSENSE_FAIL = 0x10,/* Autosense: request sense cmd fail */\n\tCAM_NO_HBA,\t\t/* No HBA Detected error */\n\tCAM_DATA_RUN_ERR,\t/* Data Overrun error */\n\tCAM_UNEXP_BUSFREE,\t/* Unexpected Bus Free */\n\tCAM_SEQUENCE_FAIL,\t/* Target Bus Phase Sequence Failure */\n\tCAM_CCB_LEN_ERR,\t/* CCB length supplied is inadequate */\n\tCAM_PROVIDE_FAIL,\t/* Unable to provide requested capability */\n\tCAM_BDR_SENT,\t\t/* A SCSI BDR msg was sent to target */\n\tCAM_REQ_TERMIO,\t\t/* CCB request terminated by the host */\n\tCAM_UNREC_HBA_ERROR,\t/* Unrecoverable Host Bus Adapter Error */\n\tCAM_REQ_TOO_BIG,\t/* The request was too large for this host */\n\tCAM_REQUEUE_REQ,\t/*\n\t\t\t\t * This request should be requeued to preserve\n\t\t\t\t * transaction ordering.  This typically occurs\n\t\t\t\t * when the SIM recognizes an error that should\n\t\t\t\t * freeze the queue and must place additional\n\t\t\t\t * requests for the target at the sim level\n\t\t\t\t * back into the XPT queue.\n\t\t\t\t */\n\tCAM_ATA_STATUS_ERROR,\t/* ATA error, look at error code in CCB */\n\tCAM_SCSI_IT_NEXUS_LOST,\t/* Initiator/Target Nexus lost. */\n\tCAM_SMP_STATUS_ERROR,\t/* SMP error, look at error code in CCB */\n\tCAM_IDE = 0x33,\t\t/* Initiator Detected Error */\n\tCAM_RESRC_UNAVAIL,\t/* Resource Unavailable */\n\tCAM_UNACKED_EVENT,\t/* Unacknowledged Event by Host */\n\tCAM_MESSAGE_RECV,\t/* Message Received in Host Target Mode */\n\tCAM_INVALID_CDB,\t/* Invalid CDB received in Host Target Mode */\n\tCAM_LUN_INVALID,\t/* Lun supplied is invalid */\n\tCAM_TID_INVALID,\t/* Target ID supplied is invalid */\n\tCAM_FUNC_NOTAVAIL,\t/* The requested function is not available */\n\tCAM_NO_NEXUS,\t\t/* Nexus is not established */\n\tCAM_IID_INVALID,\t/* The initiator ID is invalid */\n\tCAM_CDB_RECVD,\t\t/* The SCSI CDB has been received */\n\tCAM_LUN_ALRDY_ENA,\t/* The LUN is already enabled for target mode */\n\tCAM_SCSI_BUSY,\t\t/* SCSI Bus Busy */\n\n\tCAM_DEV_QFRZN = 0x40,\t/* The DEV queue is frozen w/this err */\n\n\t\t\t\t/* Autosense data valid for target */\n\tCAM_AUTOSNS_VALID = 0x80,\n\tCAM_RELEASE_SIMQ = 0x100,/* SIM ready to take more commands */\n\tCAM_SIM_QUEUED   = 0x200,/* SIM has this command in it's queue */\n\n\tCAM_STATUS_MASK = 0x3F,\t/* Mask bits for just the status # */\n\n\t\t\t\t/* Target Specific Adjunct Status */\n\tCAM_SENT_SENSE = 0x40000000\t/* sent sense with status */\n} cam_status;\n\ntypedef enum {\n\tCAM_ESF_NONE\t\t= 0x00,\n\tCAM_ESF_COMMAND\t\t= 0x01,\n\tCAM_ESF_CAM_STATUS\t= 0x02,\n\tCAM_ESF_PROTO_STATUS\t= 0x04,\n\tCAM_ESF_ALL\t\t= 0xff\n} cam_error_string_flags;\n\ntypedef enum {\n\tCAM_EPF_NONE\t\t= 0x00,\n\tCAM_EPF_MINIMAL\t\t= 0x01,\n\tCAM_EPF_NORMAL\t\t= 0x02,\n\tCAM_EPF_ALL\t\t= 0x03,\n\tCAM_EPF_LEVEL_MASK\t= 0x0f\n\t/* All bits above bit 3 are protocol-specific */\n} cam_error_proto_flags;\n\ntypedef enum {\n\tCAM_ESF_PRINT_NONE\t= 0x00,\n\tCAM_ESF_PRINT_STATUS\t= 0x10,\n\tCAM_ESF_PRINT_SENSE\t= 0x20\n} cam_error_scsi_flags;\n\ntypedef enum {\n\tCAM_ESMF_PRINT_NONE\t= 0x00,\n\tCAM_ESMF_PRINT_STATUS\t= 0x10,\n\tCAM_ESMF_PRINT_FULL_CMD\t= 0x20,\n} cam_error_smp_flags;\n\ntypedef enum {\n\tCAM_EAF_PRINT_NONE\t= 0x00,\n\tCAM_EAF_PRINT_STATUS\t= 0x10,\n\tCAM_EAF_PRINT_RESULT\t= 0x20\n} cam_error_ata_flags;\n\nstruct cam_status_entry\n{\n\tcam_status  status_code;\n\tconst char *status_text;\n};\n\nextern const struct cam_status_entry cam_status_table[];\nextern const int num_cam_status_entries;\nunion ccb;\n\n#ifdef SYSCTL_DECL\t/* from sysctl.h */\nSYSCTL_DECL(_kern_cam);\n#endif\n\n__BEGIN_DECLS\ntypedef int (cam_quirkmatch_t)(caddr_t, caddr_t);\n\ncaddr_t\tcam_quirkmatch(caddr_t target, caddr_t quirk_table, int num_entries,\n\t\t       int entry_size, cam_quirkmatch_t *comp_func);\n\nvoid\tcam_strvis(u_int8_t *dst, const u_int8_t *src, int srclen, int dstlen);\n\nint\tcam_strmatch(const u_int8_t *str, const u_int8_t *pattern, int str_len);\nconst struct cam_status_entry*\n\tcam_fetch_status_entry(cam_status status);\n#ifdef _KERNEL\nchar *\tcam_error_string(union ccb *ccb, char *str, int str_len,\n\t\t\t cam_error_string_flags flags,\n\t\t\t cam_error_proto_flags proto_flags);\nvoid\tcam_error_print(union ccb *ccb, cam_error_string_flags flags,\n\t\t\tcam_error_proto_flags proto_flags);\n#else /* _KERNEL */\nstruct cam_device;\n\nchar *\tcam_error_string(struct cam_device *device, union ccb *ccb, char *str,\n\t\t\t int str_len, cam_error_string_flags flags,\n\t\t\t cam_error_proto_flags proto_flags);\nvoid\tcam_error_print(struct cam_device *device, union ccb *ccb,\n\t\t\tcam_error_string_flags flags,\n\t\t\tcam_error_proto_flags proto_flags, FILE *ofile);\n#endif /* _KERNEL */\n__END_DECLS\n\n#ifdef _KERNEL\nstatic __inline void cam_init_pinfo(cam_pinfo *pinfo);\n\nstatic __inline void cam_init_pinfo(cam_pinfo *pinfo)\n{\n\tpinfo->priority = CAM_PRIORITY_NONE;\t\n\tpinfo->index = CAM_UNQUEUED_INDEX;\n}\n#endif\n\n#endif /* _CAM_CAM_H */\n"
  },
  {
    "path": "freebsd-headers/cam/cam_ccb.h",
    "content": "/*-\n * Data structures and definitions for CAM Control Blocks (CCBs).\n *\n * Copyright (c) 1997, 1998 Justin T. Gibbs.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions, and the following disclaimer,\n *    without modification, immediately at the beginning of the file.\n * 2. The name of the author may not be used to endorse or promote products\n *    derived from this software without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR\n * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/cam/cam_ccb.h 226067 2011-10-06 19:15:51Z ken $\n */\n\n#ifndef _CAM_CAM_CCB_H\n#define _CAM_CAM_CCB_H 1\n\n#include <sys/queue.h>\n#include <sys/cdefs.h>\n#include <sys/time.h>\n#include <sys/limits.h>\n#ifndef _KERNEL\n#include <sys/callout.h>\n#endif\n#include <cam/cam_debug.h>\n#include <cam/scsi/scsi_all.h>\n#include <cam/ata/ata_all.h>\n\n\n/* General allocation length definitions for CCB structures */\n#define\tIOCDBLEN\tCAM_MAX_CDBLEN\t/* Space for CDB bytes/pointer */\n#define\tVUHBALEN\t14\t\t/* Vendor Unique HBA length */\n#define\tSIM_IDLEN\t16\t\t/* ASCII string len for SIM ID */\n#define\tHBA_IDLEN\t16\t\t/* ASCII string len for HBA ID */\n#define\tDEV_IDLEN\t16\t\t/* ASCII string len for device names */\n#define CCB_PERIPH_PRIV_SIZE \t2\t/* size of peripheral private area */\n#define CCB_SIM_PRIV_SIZE \t2\t/* size of sim private area */\n\n/* Struct definitions for CAM control blocks */\n\n/* Common CCB header */\n/* CAM CCB flags */\ntypedef enum {\n\tCAM_CDB_POINTER\t\t= 0x00000001,/* The CDB field is a pointer    */\n\tCAM_QUEUE_ENABLE\t= 0x00000002,/* SIM queue actions are enabled */\n\tCAM_CDB_LINKED\t\t= 0x00000004,/* CCB contains a linked CDB     */\n\tCAM_NEGOTIATE\t\t= 0x00000008,/*\n\t\t\t\t\t      * Perform transport negotiation\n\t\t\t\t\t      * with this command.\n\t\t\t\t\t      */\n\tCAM_SCATTER_VALID\t= 0x00000010,/* Scatter/gather list is valid  */\n\tCAM_DIS_AUTOSENSE\t= 0x00000020,/* Disable autosense feature     */\n\tCAM_DIR_BOTH\t\t= 0x00000000,/* Data direction (00:IN/OUT)    */\n\tCAM_DIR_IN\t\t= 0x00000040,/* Data direction (01:DATA IN)   */\n\tCAM_DIR_OUT\t\t= 0x00000080,/* Data direction (10:DATA OUT)  */\n\tCAM_DIR_NONE\t\t= 0x000000C0,/* Data direction (11:no data)   */\n\tCAM_DIR_MASK\t\t= 0x000000C0,/* Data direction Mask\t      */\n\tCAM_SOFT_RST_OP\t\t= 0x00000100,/* Use Soft reset alternative    */\n\tCAM_ENG_SYNC\t\t= 0x00000200,/* Flush resid bytes on complete */\n\tCAM_DEV_QFRZDIS\t\t= 0x00000400,/* Disable DEV Q freezing\t      */\n\tCAM_DEV_QFREEZE\t\t= 0x00000800,/* Freeze DEV Q on execution     */\n\tCAM_HIGH_POWER\t\t= 0x00001000,/* Command takes a lot of power  */\n\tCAM_SENSE_PTR\t\t= 0x00002000,/* Sense data is a pointer\t      */\n\tCAM_SENSE_PHYS\t\t= 0x00004000,/* Sense pointer is physical addr*/\n\tCAM_TAG_ACTION_VALID\t= 0x00008000,/* Use the tag action in this ccb*/\n\tCAM_PASS_ERR_RECOVER\t= 0x00010000,/* Pass driver does err. recovery*/\n\tCAM_DIS_DISCONNECT\t= 0x00020000,/* Disable disconnect\t      */\n\tCAM_SG_LIST_PHYS\t= 0x00040000,/* SG list has physical addrs.   */\n\tCAM_MSG_BUF_PHYS\t= 0x00080000,/* Message buffer ptr is physical*/\n\tCAM_SNS_BUF_PHYS\t= 0x00100000,/* Autosense data ptr is physical*/\n\tCAM_DATA_PHYS\t\t= 0x00200000,/* SG/Buffer data ptrs are phys. */\n\tCAM_CDB_PHYS\t\t= 0x00400000,/* CDB poiner is physical\t      */\n\tCAM_ENG_SGLIST\t\t= 0x00800000,/* SG list is for the HBA engine */\n\n/* Phase cognizant mode flags */\n\tCAM_DIS_AUTOSRP\t\t= 0x01000000,/* Disable autosave/restore ptrs */\n\tCAM_DIS_AUTODISC\t= 0x02000000,/* Disable auto disconnect\t      */\n\tCAM_TGT_CCB_AVAIL\t= 0x04000000,/* Target CCB available\t      */\n\tCAM_TGT_PHASE_MODE\t= 0x08000000,/* The SIM runs in phase mode    */\n\tCAM_MSGB_VALID\t\t= 0x10000000,/* Message buffer valid\t      */\n\tCAM_STATUS_VALID\t= 0x20000000,/* Status buffer valid\t      */\n\tCAM_DATAB_VALID\t\t= 0x40000000,/* Data buffer valid\t      */\n\t\n/* Host target Mode flags */\n\tCAM_SEND_SENSE\t\t= 0x08000000,/* Send sense data with status   */\n\tCAM_TERM_IO\t\t= 0x10000000,/* Terminate I/O Message sup.    */\n\tCAM_DISCONNECT\t\t= 0x20000000,/* Disconnects are mandatory     */\n\tCAM_SEND_STATUS\t\t= 0x40000000 /* Send status after data phase  */\n} ccb_flags;\n\n/* XPT Opcodes for xpt_action */\ntypedef enum {\n/* Function code flags are bits greater than 0xff */\n\tXPT_FC_QUEUED\t\t= 0x100,\n\t\t\t\t/* Non-immediate function code */\n\tXPT_FC_USER_CCB\t\t= 0x200,\n\tXPT_FC_XPT_ONLY\t\t= 0x400,\n\t\t\t\t/* Only for the transport layer device */\n\tXPT_FC_DEV_QUEUED\t= 0x800 | XPT_FC_QUEUED,\n\t\t\t\t/* Passes through the device queues */\n/* Common function commands: 0x00->0x0F */\n\tXPT_NOOP \t\t= 0x00,\n\t\t\t\t/* Execute Nothing */\n\tXPT_SCSI_IO\t\t= 0x01 | XPT_FC_DEV_QUEUED,\n\t\t\t\t/* Execute the requested I/O operation */\n\tXPT_GDEV_TYPE\t\t= 0x02,\n\t\t\t\t/* Get type information for specified device */\n\tXPT_GDEVLIST\t\t= 0x03,\n\t\t\t\t/* Get a list of peripheral devices */\n\tXPT_PATH_INQ\t\t= 0x04,\n\t\t\t\t/* Path routing inquiry */\n\tXPT_REL_SIMQ\t\t= 0x05,\n\t\t\t\t/* Release a frozen device queue */\n\tXPT_SASYNC_CB\t\t= 0x06,\n\t\t\t\t/* Set Asynchronous Callback Parameters */\n\tXPT_SDEV_TYPE\t\t= 0x07,\n\t\t\t\t/* Set device type information */\n\tXPT_SCAN_BUS\t\t= 0x08 | XPT_FC_QUEUED | XPT_FC_USER_CCB\n\t\t\t\t       | XPT_FC_XPT_ONLY,\n\t\t\t\t/* (Re)Scan the SCSI Bus */\n\tXPT_DEV_MATCH\t\t= 0x09 | XPT_FC_XPT_ONLY,\n\t\t\t\t/* Get EDT entries matching the given pattern */\n\tXPT_DEBUG\t\t= 0x0a,\n\t\t\t\t/* Turn on debugging for a bus, target or lun */\n\tXPT_PATH_STATS\t\t= 0x0b,\n\t\t\t\t/* Path statistics (error counts, etc.) */\n\tXPT_GDEV_STATS\t\t= 0x0c,\n\t\t\t\t/* Device statistics (error counts, etc.) */\n\tXPT_FREEZE_QUEUE\t= 0x0d,\n\t\t\t\t/* Freeze device queue */\n\tXPT_DEV_ADVINFO\t\t= 0x0e,\n\t\t\t\t/* Get/Set Device advanced information */\n/* SCSI Control Functions: 0x10->0x1F */\n\tXPT_ABORT\t\t= 0x10,\n\t\t\t\t/* Abort the specified CCB */\n\tXPT_RESET_BUS\t\t= 0x11 | XPT_FC_XPT_ONLY,\n\t\t\t\t/* Reset the specified SCSI bus */\n\tXPT_RESET_DEV\t\t= 0x12 | XPT_FC_DEV_QUEUED,\n\t\t\t\t/* Bus Device Reset the specified SCSI device */\n\tXPT_TERM_IO\t\t= 0x13,\n\t\t\t\t/* Terminate the I/O process */\n\tXPT_SCAN_LUN\t\t= 0x14 | XPT_FC_QUEUED | XPT_FC_USER_CCB\n\t\t\t\t       | XPT_FC_XPT_ONLY,\n\t\t\t\t/* Scan Logical Unit */\n\tXPT_GET_TRAN_SETTINGS\t= 0x15,\n\t\t\t\t/*\n\t\t\t\t * Get default/user transfer settings\n\t\t\t\t * for the target\n\t\t\t\t */\n\tXPT_SET_TRAN_SETTINGS\t= 0x16,\n\t\t\t\t/*\n\t\t\t\t * Set transfer rate/width\n\t\t\t\t * negotiation settings\n\t\t\t\t */\n\tXPT_CALC_GEOMETRY\t= 0x17,\n\t\t\t\t/*\n\t\t\t\t * Calculate the geometry parameters for\n\t\t\t\t * a device give the sector size and\n\t\t\t\t * volume size.\n\t\t\t\t */\n\tXPT_ATA_IO\t\t= 0x18 | XPT_FC_DEV_QUEUED,\n\t\t\t\t/* Execute the requested ATA I/O operation */\n\n\tXPT_GET_SIM_KNOB\t= 0x18,\n\t\t\t\t/*\n\t\t\t\t * Get SIM specific knob values.\n\t\t\t\t */\n\n\tXPT_SET_SIM_KNOB\t= 0x19,\n\t\t\t\t/*\n\t\t\t\t * Set SIM specific knob values.\n\t\t\t\t */\n\n\tXPT_SMP_IO\t\t= 0x1b | XPT_FC_DEV_QUEUED,\n\t\t\t\t/* Serial Management Protocol */\n\n\tXPT_SCAN_TGT\t\t= 0x1E | XPT_FC_QUEUED | XPT_FC_USER_CCB\n\t\t\t\t       | XPT_FC_XPT_ONLY,\n\t\t\t\t/* Scan Target */\n\n/* HBA engine commands 0x20->0x2F */\n\tXPT_ENG_INQ\t\t= 0x20 | XPT_FC_XPT_ONLY,\n\t\t\t\t/* HBA engine feature inquiry */\n\tXPT_ENG_EXEC\t\t= 0x21 | XPT_FC_DEV_QUEUED,\n\t\t\t\t/* HBA execute engine request */\n\n/* Target mode commands: 0x30->0x3F */\n\tXPT_EN_LUN\t\t= 0x30,\n\t\t\t\t/* Enable LUN as a target */\n\tXPT_TARGET_IO\t\t= 0x31 | XPT_FC_DEV_QUEUED,\n\t\t\t\t/* Execute target I/O request */\n\tXPT_ACCEPT_TARGET_IO\t= 0x32 | XPT_FC_QUEUED | XPT_FC_USER_CCB,\n\t\t\t\t/* Accept Host Target Mode CDB */\n\tXPT_CONT_TARGET_IO\t= 0x33 | XPT_FC_DEV_QUEUED,\n\t\t\t\t/* Continue Host Target I/O Connection */\n\tXPT_IMMED_NOTIFY\t= 0x34 | XPT_FC_QUEUED | XPT_FC_USER_CCB,\n\t\t\t\t/* Notify Host Target driver of event (obsolete) */\n\tXPT_NOTIFY_ACK\t\t= 0x35,\n\t\t\t\t/* Acknowledgement of event (obsolete) */\n\tXPT_IMMEDIATE_NOTIFY\t= 0x36 | XPT_FC_QUEUED | XPT_FC_USER_CCB,\n\t\t\t\t/* Notify Host Target driver of event */\n\tXPT_NOTIFY_ACKNOWLEDGE\t= 0x37 | XPT_FC_QUEUED | XPT_FC_USER_CCB,\n\t\t\t\t/* Acknowledgement of event */\n\n/* Vendor Unique codes: 0x80->0x8F */\n\tXPT_VUNIQUE\t\t= 0x80\n} xpt_opcode;\n\n#define XPT_FC_GROUP_MASK\t\t0xF0\n#define XPT_FC_GROUP(op) ((op) & XPT_FC_GROUP_MASK)\n#define XPT_FC_GROUP_COMMON\t\t0x00\n#define XPT_FC_GROUP_SCSI_CONTROL\t0x10\n#define XPT_FC_GROUP_HBA_ENGINE\t\t0x20\n#define XPT_FC_GROUP_TMODE\t\t0x30\n#define XPT_FC_GROUP_VENDOR_UNIQUE\t0x80\n\n#define XPT_FC_IS_DEV_QUEUED(ccb) \t\\\n    (((ccb)->ccb_h.func_code & XPT_FC_DEV_QUEUED) == XPT_FC_DEV_QUEUED)\n#define XPT_FC_IS_QUEUED(ccb) \t\\\n    (((ccb)->ccb_h.func_code & XPT_FC_QUEUED) != 0)\n\ntypedef enum {\n\tPROTO_UNKNOWN,\n\tPROTO_UNSPECIFIED,\n\tPROTO_SCSI,\t/* Small Computer System Interface */\n\tPROTO_ATA,\t/* AT Attachment */\n\tPROTO_ATAPI,\t/* AT Attachment Packetized Interface */\n\tPROTO_SATAPM,\t/* SATA Port Multiplier */\n} cam_proto;\n\ntypedef enum {\n\tXPORT_UNKNOWN,\n\tXPORT_UNSPECIFIED,\n\tXPORT_SPI,\t/* SCSI Parallel Interface */\n\tXPORT_FC,\t/* Fiber Channel */\n\tXPORT_SSA,\t/* Serial Storage Architecture */\n\tXPORT_USB,\t/* Universal Serial Bus */\n\tXPORT_PPB,\t/* Parallel Port Bus */\n\tXPORT_ATA,\t/* AT Attachment */\n\tXPORT_SAS,\t/* Serial Attached SCSI */\n\tXPORT_SATA,\t/* Serial AT Attachment */\n\tXPORT_ISCSI,\t/* iSCSI */\n} cam_xport;\n\n#define XPORT_IS_ATA(t)\t\t((t) == XPORT_ATA || (t) == XPORT_SATA)\n#define XPORT_IS_SCSI(t)\t((t) != XPORT_UNKNOWN && \\\n\t\t\t\t (t) != XPORT_UNSPECIFIED && \\\n\t\t\t\t !XPORT_IS_ATA(t))\n#define XPORT_DEVSTAT_TYPE(t)\t(XPORT_IS_ATA(t) ? DEVSTAT_TYPE_IF_IDE : \\\n\t\t\t\t XPORT_IS_SCSI(t) ? DEVSTAT_TYPE_IF_SCSI : \\\n\t\t\t\t DEVSTAT_TYPE_IF_OTHER)\n\n#define PROTO_VERSION_UNKNOWN (UINT_MAX - 1)\n#define PROTO_VERSION_UNSPECIFIED UINT_MAX\n#define XPORT_VERSION_UNKNOWN (UINT_MAX - 1)\n#define XPORT_VERSION_UNSPECIFIED UINT_MAX\n\ntypedef union {\n\tLIST_ENTRY(ccb_hdr) le;\n\tSLIST_ENTRY(ccb_hdr) sle;\n\tTAILQ_ENTRY(ccb_hdr) tqe;\n\tSTAILQ_ENTRY(ccb_hdr) stqe;\n} camq_entry;\n\ntypedef union {\n\tvoid\t\t*ptr;\n\tu_long\t\tfield;\n\tu_int8_t\tbytes[sizeof(uintptr_t)];\n} ccb_priv_entry;\n\ntypedef union {\n\tccb_priv_entry\tentries[CCB_PERIPH_PRIV_SIZE];\n\tu_int8_t\tbytes[CCB_PERIPH_PRIV_SIZE * sizeof(ccb_priv_entry)];\n} ccb_ppriv_area;\n\ntypedef union {\n\tccb_priv_entry\tentries[CCB_SIM_PRIV_SIZE];\n\tu_int8_t\tbytes[CCB_SIM_PRIV_SIZE * sizeof(ccb_priv_entry)];\n} ccb_spriv_area;\n\nstruct ccb_hdr {\n\tcam_pinfo\tpinfo;\t\t/* Info for priority scheduling */\n\tcamq_entry\txpt_links;\t/* For chaining in the XPT layer */\t\n\tcamq_entry\tsim_links;\t/* For chaining in the SIM layer */\t\n\tcamq_entry\tperiph_links;\t/* For chaining in the type driver */\n\tu_int32_t\tretry_count;\n\tvoid\t\t(*cbfcnp)(struct cam_periph *, union ccb *);\n\t\t\t\t\t/* Callback on completion function */\n\txpt_opcode\tfunc_code;\t/* XPT function code */\n\tu_int32_t\tstatus;\t\t/* Status returned by CAM subsystem */\n\tstruct\t\tcam_path *path;\t/* Compiled path for this ccb */\n\tpath_id_t\tpath_id;\t/* Path ID for the request */\n\ttarget_id_t\ttarget_id;\t/* Target device ID */\n\tlun_id_t\ttarget_lun;\t/* Target LUN number */\n\tu_int32_t\tflags;\t\t/* ccb_flags */\n\tccb_ppriv_area\tperiph_priv;\n\tccb_spriv_area\tsim_priv;\n\tu_int32_t\ttimeout;\t/* Timeout value */\n\n\t/*\n\t * Deprecated, only for use by non-MPSAFE SIMs.  All others must\n\t * allocate and initialize their own callout storage.\n\t */\n\tstruct\t\tcallout_handle timeout_ch;\n};\n\n/* Get Device Information CCB */\nstruct ccb_getdev {\n\tstruct\t  ccb_hdr ccb_h;\n\tcam_proto protocol;\n\tstruct scsi_inquiry_data inq_data;\n\tstruct ata_params ident_data;\n\tu_int8_t  serial_num[252];\n\tu_int8_t  inq_flags;\n\tu_int8_t  serial_num_len;\n};\n\n/* Device Statistics CCB */\nstruct ccb_getdevstats {\n\tstruct\tccb_hdr\tccb_h;\n\tint\tdev_openings;\t/* Space left for more work on device*/\t\n\tint\tdev_active;\t/* Transactions running on the device */\n\tint\tdevq_openings;\t/* Space left for more queued work */\n\tint\tdevq_queued;\t/* Transactions queued to be sent */\n\tint\theld;\t\t/*\n\t\t\t\t * CCBs held by peripheral drivers\n\t\t\t\t * for this device\n\t\t\t\t */\n\tint\tmaxtags;\t/*\n\t\t\t\t * Boundary conditions for number of\n\t\t\t\t * tagged operations\n\t\t\t\t */\n\tint\tmintags;\n\tstruct\ttimeval last_reset;\t/* Time of last bus reset/loop init */\n};\n\ntypedef enum {\n\tCAM_GDEVLIST_LAST_DEVICE,\n\tCAM_GDEVLIST_LIST_CHANGED,\n\tCAM_GDEVLIST_MORE_DEVS,\n\tCAM_GDEVLIST_ERROR\n} ccb_getdevlist_status_e;\n\nstruct ccb_getdevlist {\n\tstruct ccb_hdr\t\tccb_h;\n\tchar \t\t\tperiph_name[DEV_IDLEN];\n\tu_int32_t\t\tunit_number;\n\tunsigned int\t\tgeneration;\n\tu_int32_t\t\tindex;\n\tccb_getdevlist_status_e\tstatus;\n};\n\ntypedef enum {\n\tPERIPH_MATCH_NONE\t= 0x000,\n\tPERIPH_MATCH_PATH\t= 0x001,\n\tPERIPH_MATCH_TARGET\t= 0x002,\n\tPERIPH_MATCH_LUN\t= 0x004,\n\tPERIPH_MATCH_NAME\t= 0x008,\n\tPERIPH_MATCH_UNIT\t= 0x010,\n\tPERIPH_MATCH_ANY\t= 0x01f\n} periph_pattern_flags;\n\nstruct periph_match_pattern {\n\tchar\t\t\tperiph_name[DEV_IDLEN];\n\tu_int32_t\t\tunit_number;\n\tpath_id_t\t\tpath_id;\n\ttarget_id_t\t\ttarget_id;\n\tlun_id_t\t\ttarget_lun;\n\tperiph_pattern_flags\tflags;\n};\n\ntypedef enum {\n\tDEV_MATCH_NONE\t\t= 0x000,\n\tDEV_MATCH_PATH\t\t= 0x001,\n\tDEV_MATCH_TARGET\t= 0x002,\n\tDEV_MATCH_LUN\t\t= 0x004,\n\tDEV_MATCH_INQUIRY\t= 0x008,\n\tDEV_MATCH_DEVID\t\t= 0x010,\n\tDEV_MATCH_ANY\t\t= 0x00f\n} dev_pattern_flags;\n\nstruct device_id_match_pattern {\n\tuint8_t id_len;\n\tuint8_t id[256];\n};\n\nstruct device_match_pattern {\n\tpath_id_t\t\t\t\t\tpath_id;\n\ttarget_id_t\t\t\t\t\ttarget_id;\n\tlun_id_t\t\t\t\t\ttarget_lun;\n\tdev_pattern_flags\t\t\t\tflags;\n\tunion {\n\t\tstruct scsi_static_inquiry_pattern\tinq_pat;\n\t\tstruct device_id_match_pattern\t\tdevid_pat;\n\t} data;\t\n};\n\ntypedef enum {\n\tBUS_MATCH_NONE\t\t= 0x000,\n\tBUS_MATCH_PATH\t\t= 0x001,\n\tBUS_MATCH_NAME\t\t= 0x002,\n\tBUS_MATCH_UNIT\t\t= 0x004,\n\tBUS_MATCH_BUS_ID\t= 0x008,\n\tBUS_MATCH_ANY\t\t= 0x00f\n} bus_pattern_flags;\n\nstruct bus_match_pattern {\n\tpath_id_t\t\tpath_id;\n\tchar\t\t\tdev_name[DEV_IDLEN];\n\tu_int32_t\t\tunit_number;\n\tu_int32_t\t\tbus_id;\n\tbus_pattern_flags\tflags;\n};\n\nunion match_pattern {\n\tstruct periph_match_pattern\tperiph_pattern;\n\tstruct device_match_pattern\tdevice_pattern;\n\tstruct bus_match_pattern\tbus_pattern;\n};\n\ntypedef enum {\n\tDEV_MATCH_PERIPH,\n\tDEV_MATCH_DEVICE,\n\tDEV_MATCH_BUS\n} dev_match_type;\n\nstruct dev_match_pattern {\n\tdev_match_type\t\ttype;\n\tunion match_pattern\tpattern;\n};\n\nstruct periph_match_result {\n\tchar\t\t\tperiph_name[DEV_IDLEN];\n\tu_int32_t\t\tunit_number;\n\tpath_id_t\t\tpath_id;\n\ttarget_id_t\t\ttarget_id;\n\tlun_id_t\t\ttarget_lun;\n};\n\ntypedef enum {\n\tDEV_RESULT_NOFLAG\t\t= 0x00,\n\tDEV_RESULT_UNCONFIGURED\t\t= 0x01\n} dev_result_flags;\n\nstruct device_match_result {\n\tpath_id_t\t\t\tpath_id;\n\ttarget_id_t\t\t\ttarget_id;\n\tlun_id_t\t\t\ttarget_lun;\n\tcam_proto\t\t\tprotocol;\n\tstruct scsi_inquiry_data\tinq_data;\n\tstruct ata_params\t\tident_data;\n\tdev_result_flags\t\tflags;\n};\n\nstruct bus_match_result {\n\tpath_id_t\tpath_id;\n\tchar\t\tdev_name[DEV_IDLEN];\n\tu_int32_t\tunit_number;\n\tu_int32_t\tbus_id;\n};\n\nunion match_result {\n\tstruct periph_match_result\tperiph_result;\n\tstruct device_match_result\tdevice_result;\n\tstruct bus_match_result\t\tbus_result;\n};\n\nstruct dev_match_result {\n\tdev_match_type\t\ttype;\n\tunion match_result\tresult;\n};\n\ntypedef enum {\n\tCAM_DEV_MATCH_LAST,\n\tCAM_DEV_MATCH_MORE,\n\tCAM_DEV_MATCH_LIST_CHANGED,\n\tCAM_DEV_MATCH_SIZE_ERROR,\n\tCAM_DEV_MATCH_ERROR\n} ccb_dev_match_status;\n\ntypedef enum {\n\tCAM_DEV_POS_NONE\t= 0x000,\n\tCAM_DEV_POS_BUS\t\t= 0x001,\n\tCAM_DEV_POS_TARGET\t= 0x002,\n\tCAM_DEV_POS_DEVICE\t= 0x004,\n\tCAM_DEV_POS_PERIPH\t= 0x008,\n\tCAM_DEV_POS_PDPTR\t= 0x010,\n\tCAM_DEV_POS_TYPEMASK\t= 0xf00,\n\tCAM_DEV_POS_EDT\t\t= 0x100,\n\tCAM_DEV_POS_PDRV\t= 0x200\n} dev_pos_type;\n\nstruct ccb_dm_cookie {\n\tvoid \t*bus;\n\tvoid\t*target;\t\n\tvoid\t*device;\n\tvoid\t*periph;\n\tvoid\t*pdrv;\n};\n\nstruct ccb_dev_position {\n\tu_int\t\t\tgenerations[4];\n#define\tCAM_BUS_GENERATION\t0x00\n#define CAM_TARGET_GENERATION\t0x01\n#define CAM_DEV_GENERATION\t0x02\n#define CAM_PERIPH_GENERATION\t0x03\n\tdev_pos_type\t\tposition_type;\n\tstruct ccb_dm_cookie\tcookie;\n};\n\nstruct ccb_dev_match {\n\tstruct ccb_hdr\t\t\tccb_h;\n\tccb_dev_match_status\t\tstatus;\n\tu_int32_t\t\t\tnum_patterns;\n\tu_int32_t\t\t\tpattern_buf_len;\n\tstruct dev_match_pattern\t*patterns;\n\tu_int32_t\t\t\tnum_matches;\n\tu_int32_t\t\t\tmatch_buf_len;\n\tstruct dev_match_result\t\t*matches;\n\tstruct ccb_dev_position\t\tpos;\n};\n\n/*\n * Definitions for the path inquiry CCB fields.\n */\n#define CAM_VERSION\t0x16\t/* Hex value for current version */\n\ntypedef enum {\n\tPI_MDP_ABLE\t= 0x80,\t/* Supports MDP message */\n\tPI_WIDE_32\t= 0x40,\t/* Supports 32 bit wide SCSI */\n\tPI_WIDE_16\t= 0x20, /* Supports 16 bit wide SCSI */\n\tPI_SDTR_ABLE\t= 0x10,\t/* Supports SDTR message */\n\tPI_LINKED_CDB\t= 0x08, /* Supports linked CDBs */\n\tPI_SATAPM\t= 0x04,\t/* Supports SATA PM */\n\tPI_TAG_ABLE\t= 0x02,\t/* Supports tag queue messages */\n\tPI_SOFT_RST\t= 0x01\t/* Supports soft reset alternative */\n} pi_inqflag;\n\ntypedef enum {\n\tPIT_PROCESSOR\t= 0x80,\t/* Target mode processor mode */\n\tPIT_PHASE\t= 0x40,\t/* Target mode phase cog. mode */\n\tPIT_DISCONNECT\t= 0x20,\t/* Disconnects supported in target mode */\n\tPIT_TERM_IO\t= 0x10,\t/* Terminate I/O message supported in TM */\n\tPIT_GRP_6\t= 0x08,\t/* Group 6 commands supported */\n\tPIT_GRP_7\t= 0x04\t/* Group 7 commands supported */\n} pi_tmflag;\n\ntypedef enum {\n\tPIM_SCANHILO\t= 0x80,\t/* Bus scans from high ID to low ID */\n\tPIM_NOREMOVE\t= 0x40,\t/* Removeable devices not included in scan */\n\tPIM_NOINITIATOR\t= 0x20,\t/* Initiator role not supported. */\n\tPIM_NOBUSRESET\t= 0x10,\t/* User has disabled initial BUS RESET */\n\tPIM_NO_6_BYTE\t= 0x08,\t/* Do not send 6-byte commands */\n\tPIM_SEQSCAN\t= 0x04\t/* Do bus scans sequentially, not in parallel */\n} pi_miscflag;\n\n/* Path Inquiry CCB */\nstruct ccb_pathinq_settings_spi {\n\tu_int8_t ppr_options;\n};\n\nstruct ccb_pathinq_settings_fc {\n\tu_int64_t wwnn;\t\t/* world wide node name */\n\tu_int64_t wwpn;\t\t/* world wide port name */\n\tu_int32_t port;\t\t/* 24 bit port id, if known */\n\tu_int32_t bitrate;\t/* Mbps */\n};\n\nstruct ccb_pathinq_settings_sas {\n\tu_int32_t bitrate;\t/* Mbps */\n};\n#define\tPATHINQ_SETTINGS_SIZE\t128\n\nstruct ccb_pathinq {\n\tstruct \t    ccb_hdr ccb_h;\n\tu_int8_t    version_num;\t/* Version number for the SIM/HBA */\n\tu_int8_t    hba_inquiry;\t/* Mimic of INQ byte 7 for the HBA */\n\tu_int8_t    target_sprt;\t/* Flags for target mode support */\n\tu_int8_t    hba_misc;\t\t/* Misc HBA features */\n\tu_int16_t   hba_eng_cnt;\t/* HBA engine count */\n\t\t\t\t\t/* Vendor Unique capabilities */\n\tu_int8_t    vuhba_flags[VUHBALEN];\n\tu_int32_t   max_target;\t\t/* Maximum supported Target */\n\tu_int32_t   max_lun;\t\t/* Maximum supported Lun */\n\tu_int32_t   async_flags;\t/* Installed Async handlers */\n\tpath_id_t   hpath_id;\t\t/* Highest Path ID in the subsystem */\n\ttarget_id_t initiator_id;\t/* ID of the HBA on the SCSI bus */\n\tchar\t    sim_vid[SIM_IDLEN];\t/* Vendor ID of the SIM */\n\tchar\t    hba_vid[HBA_IDLEN];\t/* Vendor ID of the HBA */\n\tchar \t    dev_name[DEV_IDLEN];/* Device name for SIM */\n\tu_int32_t   unit_number;\t/* Unit number for SIM */\n\tu_int32_t   bus_id;\t\t/* Bus ID for SIM */\n\tu_int32_t   base_transfer_speed;/* Base bus speed in KB/sec */\n\tcam_proto   protocol;\n\tu_int\t    protocol_version;\n\tcam_xport   transport;\n\tu_int\t    transport_version;\n\tunion {\n\t\tstruct ccb_pathinq_settings_spi spi;\n\t\tstruct ccb_pathinq_settings_fc fc;\n\t\tstruct ccb_pathinq_settings_sas sas;\n\t\tchar ccb_pathinq_settings_opaque[PATHINQ_SETTINGS_SIZE];\n\t} xport_specific;\n\tu_int\t\tmaxio;\t\t/* Max supported I/O size, in bytes. */\n\tu_int16_t\thba_vendor;\t/* HBA vendor ID */\n\tu_int16_t\thba_device;\t/* HBA device ID */\n\tu_int16_t\thba_subvendor;\t/* HBA subvendor ID */\n\tu_int16_t\thba_subdevice;\t/* HBA subdevice ID */\n};\n\n/* Path Statistics CCB */\nstruct ccb_pathstats {\n\tstruct\tccb_hdr\tccb_h;\n\tstruct\ttimeval last_reset;\t/* Time of last bus reset/loop init */\n};\n\ntypedef enum {\n\tSMP_FLAG_NONE\t\t= 0x00,\n\tSMP_FLAG_REQ_SG\t\t= 0x01,\n\tSMP_FLAG_RSP_SG\t\t= 0x02\n} ccb_smp_pass_flags;\n\n/*\n * Serial Management Protocol CCB\n * XXX Currently the semantics for this CCB are that it is executed either\n * by the addressed device, or that device's parent (i.e. an expander for\n * any device on an expander) if the addressed device doesn't support SMP.\n * Later, once we have the ability to probe SMP-only devices and put them\n * in CAM's topology, the CCB will only be executed by the addressed device\n * if possible.\n */\nstruct ccb_smpio {\n\tstruct ccb_hdr\t\tccb_h;\n\tuint8_t\t\t\t*smp_request;\n\tint\t\t\tsmp_request_len;\n\tuint16_t\t\tsmp_request_sglist_cnt;\n\tuint8_t\t\t\t*smp_response;\n\tint\t\t\tsmp_response_len;\n\tuint16_t\t\tsmp_response_sglist_cnt;\n\tccb_smp_pass_flags\tflags;\n};\n\ntypedef union {\n\tu_int8_t *sense_ptr;\t\t/*\n\t\t\t\t\t * Pointer to storage\n\t\t\t\t\t * for sense information\n\t\t\t\t\t */\n\t                                /* Storage Area for sense information */\n\tstruct\t scsi_sense_data sense_buf;\n} sense_t;\n\ntypedef union {\n\tu_int8_t  *cdb_ptr;\t\t/* Pointer to the CDB bytes to send */\n\t\t\t\t\t/* Area for the CDB send */\n\tu_int8_t  cdb_bytes[IOCDBLEN];\n} cdb_t;\n\n/*\n * SCSI I/O Request CCB used for the XPT_SCSI_IO and XPT_CONT_TARGET_IO\n * function codes.\n */\nstruct ccb_scsiio {\n\tstruct\t   ccb_hdr ccb_h;\n\tunion\t   ccb *next_ccb;\t/* Ptr for next CCB for action */\n\tu_int8_t   *req_map;\t\t/* Ptr to mapping info */\n\tu_int8_t   *data_ptr;\t\t/* Ptr to the data buf/SG list */\n\tu_int32_t  dxfer_len;\t\t/* Data transfer length */\n\t\t\t\t\t/* Autosense storage */\t\n\tstruct     scsi_sense_data sense_data;\n\tu_int8_t   sense_len;\t\t/* Number of bytes to autosense */\n\tu_int8_t   cdb_len;\t\t/* Number of bytes for the CDB */\n\tu_int16_t  sglist_cnt;\t\t/* Number of SG list entries */\n\tu_int8_t   scsi_status;\t\t/* Returned SCSI status */\n\tu_int8_t   sense_resid;\t\t/* Autosense resid length: 2's comp */\n\tu_int32_t  resid;\t\t/* Transfer residual length: 2's comp */\n\tcdb_t\t   cdb_io;\t\t/* Union for CDB bytes/pointer */\n\tu_int8_t   *msg_ptr;\t\t/* Pointer to the message buffer */\n\tu_int16_t  msg_len;\t\t/* Number of bytes for the Message */\n\tu_int8_t   tag_action;\t\t/* What to do for tag queueing */\n\t/*\n\t * The tag action should be either the define below (to send a\n\t * non-tagged transaction) or one of the defined scsi tag messages\n\t * from scsi_message.h.\n\t */\n#define\t\tCAM_TAG_ACTION_NONE\t0x00\n\tu_int\t   tag_id;\t\t/* tag id from initator (target mode) */\n\tu_int\t   init_id;\t\t/* initiator id of who selected */\n};\n\n/*\n * ATA I/O Request CCB used for the XPT_ATA_IO function code.\n */\nstruct ccb_ataio {\n\tstruct\t   ccb_hdr ccb_h;\n\tunion\t   ccb *next_ccb;\t/* Ptr for next CCB for action */\n\tstruct ata_cmd\tcmd;\t\t/* ATA command register set */\n\tstruct ata_res\tres;\t\t/* ATA result register set */\n\tu_int8_t   *data_ptr;\t\t/* Ptr to the data buf/SG list */\n\tu_int32_t  dxfer_len;\t\t/* Data transfer length */\n\tu_int32_t  resid;\t\t/* Transfer residual length: 2's comp */\n\tu_int8_t   tag_action;\t\t/* What to do for tag queueing */\n\t/*\n\t * The tag action should be either the define below (to send a\n\t * non-tagged transaction) or one of the defined scsi tag messages\n\t * from scsi_message.h.\n\t */\n#define\t\tCAM_TAG_ACTION_NONE\t0x00\n\tu_int\t   tag_id;\t\t/* tag id from initator (target mode) */\n\tu_int\t   init_id;\t\t/* initiator id of who selected */\n};\n\nstruct ccb_accept_tio {\n\tstruct\t   ccb_hdr ccb_h;\n\tcdb_t\t   cdb_io;\t\t/* Union for CDB bytes/pointer */\n\tu_int8_t   cdb_len;\t\t/* Number of bytes for the CDB */\n\tu_int8_t   tag_action;\t\t/* What to do for tag queueing */\n\tu_int8_t   sense_len;\t\t/* Number of bytes of Sense Data */\n\tu_int      tag_id;\t\t/* tag id from initator (target mode) */\n\tu_int      init_id;\t\t/* initiator id of who selected */\n\tstruct     scsi_sense_data sense_data;\n};\n\n/* Release SIM Queue */\nstruct ccb_relsim {\n\tstruct ccb_hdr ccb_h;\n\tu_int32_t      release_flags;\n#define RELSIM_ADJUST_OPENINGS\t\t0x01\n#define RELSIM_RELEASE_AFTER_TIMEOUT\t0x02\n#define RELSIM_RELEASE_AFTER_CMDCMPLT\t0x04\n#define RELSIM_RELEASE_AFTER_QEMPTY\t0x08\n#define RELSIM_RELEASE_RUNLEVEL\t\t0x10\n\tu_int32_t      openings;\n\tu_int32_t      release_timeout;\t/* Abstract argument. */\n\tu_int32_t      qfrozen_cnt;\n};\n\n/*\n * Definitions for the asynchronous callback CCB fields.\n */\ntypedef enum {\n\tAC_ADVINFO_CHANGED\t= 0x2000,/* Advance info might have changes */\n\tAC_CONTRACT\t\t= 0x1000,/* A contractual callback */\n\tAC_GETDEV_CHANGED\t= 0x800,/* Getdev info might have changed */\n\tAC_INQ_CHANGED\t\t= 0x400,/* Inquiry info might have changed */\n\tAC_TRANSFER_NEG\t\t= 0x200,/* New transfer settings in effect */\n\tAC_LOST_DEVICE\t\t= 0x100,/* A device went away */\n\tAC_FOUND_DEVICE\t\t= 0x080,/* A new device was found */\n\tAC_PATH_DEREGISTERED\t= 0x040,/* A path has de-registered */\n\tAC_PATH_REGISTERED\t= 0x020,/* A new path has been registered */\n\tAC_SENT_BDR\t\t= 0x010,/* A BDR message was sent to target */\n\tAC_SCSI_AEN\t\t= 0x008,/* A SCSI AEN has been received */\n\tAC_UNSOL_RESEL\t\t= 0x002,/* Unsolicited reselection occurred */\n\tAC_BUS_RESET\t\t= 0x001\t/* A SCSI bus reset occurred */\n} ac_code;\n\ntypedef void ac_callback_t (void *softc, u_int32_t code,\n\t\t\t    struct cam_path *path, void *args);\n\n/*\n * Generic Asynchronous callbacks.\n *\n * Generic arguments passed bac which are then interpreted between a per-system\n * contract number.\n */\n#define\tAC_CONTRACT_DATA_MAX (128 - sizeof (u_int64_t))\nstruct ac_contract {\n\tu_int64_t\tcontract_number;\n\tu_int8_t\tcontract_data[AC_CONTRACT_DATA_MAX];\n};\n\n#define\tAC_CONTRACT_DEV_CHG\t1\nstruct ac_device_changed {\n\tu_int64_t\twwpn;\n\tu_int32_t\tport;\n\ttarget_id_t\ttarget;\n\tu_int8_t\tarrived;\n};\n\n/* Set Asynchronous Callback CCB */\nstruct ccb_setasync {\n\tstruct ccb_hdr\t ccb_h;\n\tu_int32_t\t event_enable;\t/* Async Event enables */\t\n\tac_callback_t\t*callback;\n\tvoid\t\t*callback_arg;\n};\n\n/* Set Device Type CCB */\nstruct ccb_setdev {\n\tstruct\t   ccb_hdr ccb_h;\n\tu_int8_t   dev_type;\t/* Value for dev type field in EDT */\n};\n\n/* SCSI Control Functions */\n\n/* Abort XPT request CCB */\nstruct ccb_abort {\n\tstruct \tccb_hdr ccb_h;\n\tunion\tccb *abort_ccb;\t/* Pointer to CCB to abort */\n};\n\n/* Reset SCSI Bus CCB */\nstruct ccb_resetbus {\n\tstruct\tccb_hdr ccb_h;\n};\n\n/* Reset SCSI Device CCB */\nstruct ccb_resetdev {\n\tstruct\tccb_hdr ccb_h;\n};\n\n/* Terminate I/O Process Request CCB */\nstruct ccb_termio {\n\tstruct\tccb_hdr ccb_h;\n\tunion\tccb *termio_ccb;\t/* Pointer to CCB to terminate */\n};\n\ntypedef enum {\n\tCTS_TYPE_CURRENT_SETTINGS,\n\tCTS_TYPE_USER_SETTINGS\n} cts_type;\n\nstruct ccb_trans_settings_scsi\n{\n\tu_int\tvalid;\t/* Which fields to honor */\n#define\tCTS_SCSI_VALID_TQ\t\t0x01\n\tu_int\tflags;\n#define\tCTS_SCSI_FLAGS_TAG_ENB\t\t0x01\n};\n\nstruct ccb_trans_settings_spi\n{\n\tu_int\t  valid;\t/* Which fields to honor */\n#define\tCTS_SPI_VALID_SYNC_RATE\t\t0x01\n#define\tCTS_SPI_VALID_SYNC_OFFSET\t0x02\n#define\tCTS_SPI_VALID_BUS_WIDTH\t\t0x04\n#define\tCTS_SPI_VALID_DISC\t\t0x08\n#define CTS_SPI_VALID_PPR_OPTIONS\t0x10\n\tu_int\tflags;\n#define\tCTS_SPI_FLAGS_DISC_ENB\t\t0x01\n\tu_int\tsync_period;\n\tu_int\tsync_offset;\n\tu_int\tbus_width;\n\tu_int\tppr_options;\n};\n\nstruct ccb_trans_settings_fc {\n\tu_int     \tvalid;\t\t/* Which fields to honor */\n#define\tCTS_FC_VALID_WWNN\t\t0x8000\n#define\tCTS_FC_VALID_WWPN\t\t0x4000\n#define\tCTS_FC_VALID_PORT\t\t0x2000\n#define\tCTS_FC_VALID_SPEED\t\t0x1000\n\tu_int64_t\twwnn;\t\t/* world wide node name */\n\tu_int64_t \twwpn;\t\t/* world wide port name */\n\tu_int32_t \tport;\t\t/* 24 bit port id, if known */\n\tu_int32_t \tbitrate;\t/* Mbps */\n};\n\nstruct ccb_trans_settings_sas {\n\tu_int     \tvalid;\t\t/* Which fields to honor */\n#define\tCTS_SAS_VALID_SPEED\t\t0x1000\n\tu_int32_t \tbitrate;\t/* Mbps */\n};\n\nstruct ccb_trans_settings_ata {\n\tu_int     \tvalid;\t\t/* Which fields to honor */\n#define\tCTS_ATA_VALID_MODE\t\t0x01\n#define\tCTS_ATA_VALID_BYTECOUNT\t\t0x02\n#define\tCTS_ATA_VALID_ATAPI\t\t0x20\n\tint\t\tmode;\t\t/* Mode */\n\tu_int \t\tbytecount;\t/* Length of PIO transaction */\n\tu_int \t\tatapi;\t\t/* Length of ATAPI CDB */\n};\n\nstruct ccb_trans_settings_sata {\n\tu_int     \tvalid;\t\t/* Which fields to honor */\n#define\tCTS_SATA_VALID_MODE\t\t0x01\n#define\tCTS_SATA_VALID_BYTECOUNT\t0x02\n#define\tCTS_SATA_VALID_REVISION\t\t0x04\n#define\tCTS_SATA_VALID_PM\t\t0x08\n#define\tCTS_SATA_VALID_TAGS\t\t0x10\n#define\tCTS_SATA_VALID_ATAPI\t\t0x20\n#define\tCTS_SATA_VALID_CAPS\t\t0x40\n\tint\t\tmode;\t\t/* Legacy PATA mode */\n\tu_int \t\tbytecount;\t/* Length of PIO transaction */\n\tint\t\trevision;\t/* SATA revision */\n\tu_int \t\tpm_present;\t/* PM is present (XPT->SIM) */\n\tu_int \t\ttags;\t\t/* Number of allowed tags */\n\tu_int \t\tatapi;\t\t/* Length of ATAPI CDB */\n\tu_int \t\tcaps;\t\t/* Device and host SATA caps. */\n#define\tCTS_SATA_CAPS_H\t\t\t0x0000ffff\n#define\tCTS_SATA_CAPS_H_PMREQ\t\t0x00000001\n#define\tCTS_SATA_CAPS_H_APST\t\t0x00000002\n#define\tCTS_SATA_CAPS_H_DMAAA\t\t0x00000010 /* Auto-activation */\n#define\tCTS_SATA_CAPS_H_AN\t\t0x00000020 /* Async. notification */\n#define\tCTS_SATA_CAPS_D\t\t\t0xffff0000\n#define\tCTS_SATA_CAPS_D_PMREQ\t\t0x00010000\n#define\tCTS_SATA_CAPS_D_APST\t\t0x00020000\n};\n\n/* Get/Set transfer rate/width/disconnection/tag queueing settings */\nstruct ccb_trans_settings {\n\tstruct\t  ccb_hdr ccb_h;\n\tcts_type  type;\t\t/* Current or User settings */\n\tcam_proto protocol;\n\tu_int\t  protocol_version;\n\tcam_xport transport;\n\tu_int\t  transport_version;\n\tunion {\n\t\tu_int  valid;\t/* Which fields to honor */\n\t\tstruct ccb_trans_settings_scsi scsi;\n\t} proto_specific;\n\tunion {\n\t\tu_int  valid;\t/* Which fields to honor */\n\t\tstruct ccb_trans_settings_spi spi;\n\t\tstruct ccb_trans_settings_fc fc;\n\t\tstruct ccb_trans_settings_sas sas;\n\t\tstruct ccb_trans_settings_ata ata;\n\t\tstruct ccb_trans_settings_sata sata;\n\t} xport_specific;\n};\n\n\n/*\n * Calculate the geometry parameters for a device\n * give the block size and volume size in blocks.\n */\nstruct ccb_calc_geometry {\n\tstruct\t  ccb_hdr ccb_h;\n\tu_int32_t block_size;\n\tu_int64_t volume_size;\n\tu_int32_t cylinders;\t\t\n\tu_int8_t  heads;\n\tu_int8_t  secs_per_track;\n};\n\n/*\n * Set or get SIM (and transport) specific knobs\n */\n\n#define\tKNOB_VALID_ADDRESS\t0x1\n#define\tKNOB_VALID_ROLE\t\t0x2\n\n\n#define\tKNOB_ROLE_NONE\t\t0x0\n#define\tKNOB_ROLE_INITIATOR\t0x1\n#define\tKNOB_ROLE_TARGET\t0x2\n#define\tKNOB_ROLE_BOTH\t\t0x3\n\nstruct ccb_sim_knob_settings_spi {\n\tu_int\t\tvalid;\n\tu_int\t\tinitiator_id;\n\tu_int\t\trole;\n};\n\nstruct ccb_sim_knob_settings_fc {\n\tu_int\t\tvalid;\n\tu_int64_t\twwnn;\t\t/* world wide node name */\n\tu_int64_t \twwpn;\t\t/* world wide port name */\n\tu_int\t\trole;\n};\n\nstruct ccb_sim_knob_settings_sas {\n\tu_int\t\tvalid;\n\tu_int64_t\twwnn;\t\t/* world wide node name */\n\tu_int\t\trole;\n};\n#define\tKNOB_SETTINGS_SIZE\t128\n\nstruct ccb_sim_knob {\n\tstruct\t  ccb_hdr ccb_h;\n\tunion {\n\t\tu_int  valid;\t/* Which fields to honor */\n\t\tstruct ccb_sim_knob_settings_spi spi;\n\t\tstruct ccb_sim_knob_settings_fc fc;\n\t\tstruct ccb_sim_knob_settings_sas sas;\n\t\tchar pad[KNOB_SETTINGS_SIZE];\n\t} xport_specific;\n};\n\n/*\n * Rescan the given bus, or bus/target/lun\n */\nstruct ccb_rescan {\n\tstruct\tccb_hdr ccb_h;\n\tcam_flags\tflags;\n};\n\n/*\n * Turn on debugging for the given bus, bus/target, or bus/target/lun.\n */\nstruct ccb_debug {\n\tstruct\tccb_hdr ccb_h;\n\tcam_debug_flags flags;\n};\n\n/* Target mode structures. */\n\nstruct ccb_en_lun {\n\tstruct\t  ccb_hdr ccb_h;\n\tu_int16_t grp6_len;\t\t/* Group 6 VU CDB length */\n\tu_int16_t grp7_len;\t\t/* Group 7 VU CDB length */\n\tu_int8_t  enable;\n};\n\n/* old, barely used immediate notify, binary compatibility */\nstruct ccb_immed_notify {\n\tstruct\t  ccb_hdr ccb_h;\n\tstruct    scsi_sense_data sense_data;\n\tu_int8_t  sense_len;\t\t/* Number of bytes in sense buffer */\n\tu_int8_t  initiator_id;\t\t/* Id of initiator that selected */\n\tu_int8_t  message_args[7];\t/* Message Arguments */\n};\n\nstruct ccb_notify_ack {\n\tstruct\t  ccb_hdr ccb_h;\n\tu_int16_t seq_id;\t\t/* Sequence identifier */\n\tu_int8_t  event;\t\t/* Event flags */\n};\n\nstruct ccb_immediate_notify {\n\tstruct    ccb_hdr ccb_h;\n\tu_int     tag_id;\t\t/* Tag for immediate notify */\n\tu_int     seq_id;\t\t/* Tag for target of notify */\n\tu_int     initiator_id;\t\t/* Initiator Identifier */\n\tu_int     arg;\t\t\t/* Function specific */\n};\n\nstruct ccb_notify_acknowledge {\n\tstruct    ccb_hdr ccb_h;\n\tu_int     tag_id;\t\t/* Tag for immediate notify */\n\tu_int     seq_id;\t\t/* Tar for target of notify */\n\tu_int     initiator_id;\t\t/* Initiator Identifier */\n\tu_int     arg;\t\t\t/* Function specific */\n};\n\n/* HBA engine structures. */\n\ntypedef enum {\n\tEIT_BUFFER,\t/* Engine type: buffer memory */\n\tEIT_LOSSLESS,\t/* Engine type: lossless compression */\n\tEIT_LOSSY,\t/* Engine type: lossy compression */\n\tEIT_ENCRYPT\t/* Engine type: encryption */\n} ei_type;\n\ntypedef enum {\n\tEAD_VUNIQUE,\t/* Engine algorithm ID: vendor unique */\n\tEAD_LZ1V1,\t/* Engine algorithm ID: LZ1 var.1 */\n\tEAD_LZ2V1,\t/* Engine algorithm ID: LZ2 var.1 */\n\tEAD_LZ2V2\t/* Engine algorithm ID: LZ2 var.2 */\n} ei_algo;\n\nstruct ccb_eng_inq {\n\tstruct\t  ccb_hdr ccb_h;\n\tu_int16_t eng_num;\t/* The engine number for this inquiry */\n\tei_type   eng_type;\t/* Returned engine type */\n\tei_algo   eng_algo;\t/* Returned engine algorithm type */\n\tu_int32_t eng_memeory;\t/* Returned engine memory size */\n};\n\nstruct ccb_eng_exec {\t/* This structure must match SCSIIO size */\n\tstruct\t  ccb_hdr ccb_h;\n\tu_int8_t  *pdrv_ptr;\t/* Ptr used by the peripheral driver */\n\tu_int8_t  *req_map;\t/* Ptr for mapping info on the req. */\n\tu_int8_t  *data_ptr;\t/* Pointer to the data buf/SG list */\n\tu_int32_t dxfer_len;\t/* Data transfer length */\n\tu_int8_t  *engdata_ptr;\t/* Pointer to the engine buffer data */\n\tu_int16_t sglist_cnt;\t/* Num of scatter gather list entries */\n\tu_int32_t dmax_len;\t/* Destination data maximum length */\n\tu_int32_t dest_len;\t/* Destination data length */\n\tint32_t\t  src_resid;\t/* Source residual length: 2's comp */\n\tu_int32_t timeout;\t/* Timeout value */\n\tu_int16_t eng_num;\t/* Engine number for this request */\n\tu_int16_t vu_flags;\t/* Vendor Unique flags */\n};\n\n/*\n * Definitions for the timeout field in the SCSI I/O CCB.\n */\n#define\tCAM_TIME_DEFAULT\t0x00000000\t/* Use SIM default value */\n#define\tCAM_TIME_INFINITY\t0xFFFFFFFF\t/* Infinite timeout */\n\n#define\tCAM_SUCCESS\t0\t/* For signaling general success */\n#define\tCAM_FAILURE\t1\t/* For signaling general failure */\n\n#define CAM_FALSE\t0\n#define CAM_TRUE\t1\n\n#define XPT_CCB_INVALID\t-1\t/* for signaling a bad CCB to free */\n\n/*\n * CCB for working with advanced device information.  This operates in a fashion\n * similar to XPT_GDEV_TYPE.  Specify the target in ccb_h, the buffer\n * type requested, and provide a buffer size/buffer to write to.  If the\n * buffer is too small, provsiz will be larger than bufsiz.\n */\nstruct ccb_dev_advinfo {\n\tstruct ccb_hdr ccb_h;\n\tuint32_t flags;\n#define\tCDAI_FLAG_STORE\t\t0x1\t/* If set, action becomes store */\n\tuint32_t buftype;\t\t/* IN: Type of data being requested */\n\t/* NB: buftype is interpreted on a per-transport basis */\n#define\tCDAI_TYPE_SCSI_DEVID\t1\n#define\tCDAI_TYPE_SERIAL_NUM\t2\n#define\tCDAI_TYPE_PHYS_PATH\t3\n\toff_t bufsiz;\t\t\t/* IN: Size of external buffer */\n#define\tCAM_SCSI_DEVID_MAXLEN\t65536\t/* length in buffer is an uint16_t */\n\toff_t provsiz;\t\t\t/* OUT: Size required/used */\n\tuint8_t *buf;\t\t\t/* IN/OUT: Buffer for requested data */\n};\n\n/*\n * Union of all CCB types for kernel space allocation.  This union should\n * never be used for manipulating CCBs - its only use is for the allocation\n * and deallocation of raw CCB space and is the return type of xpt_ccb_alloc\n * and the argument to xpt_ccb_free.\n */\nunion ccb {\n\tstruct\tccb_hdr\t\t\tccb_h;\t/* For convenience */\n\tstruct\tccb_scsiio\t\tcsio;\n\tstruct\tccb_getdev\t\tcgd;\n\tstruct\tccb_getdevlist\t\tcgdl;\n\tstruct\tccb_pathinq\t\tcpi;\n\tstruct\tccb_relsim\t\tcrs;\n\tstruct\tccb_setasync\t\tcsa;\n\tstruct\tccb_setdev\t\tcsd;\n\tstruct\tccb_pathstats\t\tcpis;\n\tstruct\tccb_getdevstats\t\tcgds;\n\tstruct\tccb_dev_match\t\tcdm;\n\tstruct\tccb_trans_settings\tcts;\n\tstruct\tccb_calc_geometry\tccg;\t\n\tstruct\tccb_sim_knob\t\tknob;\t\n\tstruct\tccb_abort\t\tcab;\n\tstruct\tccb_resetbus\t\tcrb;\n\tstruct\tccb_resetdev\t\tcrd;\n\tstruct\tccb_termio\t\ttio;\n\tstruct\tccb_accept_tio\t\tatio;\n\tstruct\tccb_scsiio\t\tctio;\n\tstruct\tccb_en_lun\t\tcel;\n\tstruct\tccb_immed_notify\tcin;\n\tstruct\tccb_notify_ack\t\tcna;\n\tstruct\tccb_immediate_notify\tcin1;\n\tstruct\tccb_notify_acknowledge\tcna2;\n\tstruct\tccb_eng_inq\t\tcei;\n\tstruct\tccb_eng_exec\t\tcee;\n\tstruct\tccb_smpio\t\tsmpio;\n\tstruct \tccb_rescan\t\tcrcn;\n\tstruct  ccb_debug\t\tcdbg;\n\tstruct\tccb_ataio\t\tataio;\n\tstruct\tccb_dev_advinfo\t\tcdai;\n};\n\n__BEGIN_DECLS\nstatic __inline void\ncam_fill_csio(struct ccb_scsiio *csio, u_int32_t retries,\n\t      void (*cbfcnp)(struct cam_periph *, union ccb *),\n\t      u_int32_t flags, u_int8_t tag_action,\n\t      u_int8_t *data_ptr, u_int32_t dxfer_len,\n\t      u_int8_t sense_len, u_int8_t cdb_len,\n\t      u_int32_t timeout);\n\nstatic __inline void\ncam_fill_ctio(struct ccb_scsiio *csio, u_int32_t retries,\n\t      void (*cbfcnp)(struct cam_periph *, union ccb *),\n\t      u_int32_t flags, u_int tag_action, u_int tag_id,\n\t      u_int init_id, u_int scsi_status, u_int8_t *data_ptr,\n\t      u_int32_t dxfer_len, u_int32_t timeout);\n\nstatic __inline void\ncam_fill_ataio(struct ccb_ataio *ataio, u_int32_t retries,\n\t      void (*cbfcnp)(struct cam_periph *, union ccb *),\n\t      u_int32_t flags, u_int tag_action,\n\t      u_int8_t *data_ptr, u_int32_t dxfer_len,\n\t      u_int32_t timeout);\n\nstatic __inline void\ncam_fill_smpio(struct ccb_smpio *smpio, uint32_t retries, \n\t       void (*cbfcnp)(struct cam_periph *, union ccb *), uint32_t flags,\n\t       uint8_t *smp_request, int smp_request_len,\n\t       uint8_t *smp_response, int smp_response_len,\n\t       uint32_t timeout);\n\nstatic __inline void\ncam_fill_csio(struct ccb_scsiio *csio, u_int32_t retries,\n\t      void (*cbfcnp)(struct cam_periph *, union ccb *),\n\t      u_int32_t flags, u_int8_t tag_action,\n\t      u_int8_t *data_ptr, u_int32_t dxfer_len,\n\t      u_int8_t sense_len, u_int8_t cdb_len,\n\t      u_int32_t timeout)\n{\n\tcsio->ccb_h.func_code = XPT_SCSI_IO;\n\tcsio->ccb_h.flags = flags;\n\tcsio->ccb_h.retry_count = retries;\t\n\tcsio->ccb_h.cbfcnp = cbfcnp;\n\tcsio->ccb_h.timeout = timeout;\n\tcsio->data_ptr = data_ptr;\n\tcsio->dxfer_len = dxfer_len;\n\tcsio->sense_len = sense_len;\n\tcsio->cdb_len = cdb_len;\n\tcsio->tag_action = tag_action;\n}\n\nstatic __inline void\ncam_fill_ctio(struct ccb_scsiio *csio, u_int32_t retries,\n\t      void (*cbfcnp)(struct cam_periph *, union ccb *),\n\t      u_int32_t flags, u_int tag_action, u_int tag_id,\n\t      u_int init_id, u_int scsi_status, u_int8_t *data_ptr,\n\t      u_int32_t dxfer_len, u_int32_t timeout)\n{\n\tcsio->ccb_h.func_code = XPT_CONT_TARGET_IO;\n\tcsio->ccb_h.flags = flags;\n\tcsio->ccb_h.retry_count = retries;\t\n\tcsio->ccb_h.cbfcnp = cbfcnp;\n\tcsio->ccb_h.timeout = timeout;\n\tcsio->data_ptr = data_ptr;\n\tcsio->dxfer_len = dxfer_len;\n\tcsio->scsi_status = scsi_status;\n\tcsio->tag_action = tag_action;\n\tcsio->tag_id = tag_id;\n\tcsio->init_id = init_id;\n}\n\nstatic __inline void\ncam_fill_ataio(struct ccb_ataio *ataio, u_int32_t retries,\n\t      void (*cbfcnp)(struct cam_periph *, union ccb *),\n\t      u_int32_t flags, u_int tag_action,\n\t      u_int8_t *data_ptr, u_int32_t dxfer_len,\n\t      u_int32_t timeout)\n{\n\tataio->ccb_h.func_code = XPT_ATA_IO;\n\tataio->ccb_h.flags = flags;\n\tataio->ccb_h.retry_count = retries;\n\tataio->ccb_h.cbfcnp = cbfcnp;\n\tataio->ccb_h.timeout = timeout;\n\tataio->data_ptr = data_ptr;\n\tataio->dxfer_len = dxfer_len;\n\tataio->tag_action = tag_action;\n}\n\nstatic __inline void\ncam_fill_smpio(struct ccb_smpio *smpio, uint32_t retries, \n\t       void (*cbfcnp)(struct cam_periph *, union ccb *), uint32_t flags,\n\t       uint8_t *smp_request, int smp_request_len,\n\t       uint8_t *smp_response, int smp_response_len,\n\t       uint32_t timeout)\n{\n#ifdef _KERNEL\n\tKASSERT((flags & CAM_DIR_MASK) == CAM_DIR_BOTH,\n\t\t(\"direction != CAM_DIR_BOTH\"));\n\tKASSERT((smp_request != NULL) && (smp_response != NULL),\n\t\t(\"need valid request and response buffers\"));\n\tKASSERT((smp_request_len != 0) && (smp_response_len != 0),\n\t\t(\"need non-zero request and response lengths\"));\n#endif /*_KERNEL*/\n\tsmpio->ccb_h.func_code = XPT_SMP_IO;\n\tsmpio->ccb_h.flags = flags;\n\tsmpio->ccb_h.retry_count = retries;\n\tsmpio->ccb_h.cbfcnp = cbfcnp;\n\tsmpio->ccb_h.timeout = timeout;\n\tsmpio->smp_request = smp_request;\n\tsmpio->smp_request_len = smp_request_len;\n\tsmpio->smp_response = smp_response;\n\tsmpio->smp_response_len = smp_response_len;\n}\n\nvoid cam_calc_geometry(struct ccb_calc_geometry *ccg, int extended);\n\n__END_DECLS\n\n#endif /* _CAM_CAM_CCB_H */\n"
  },
  {
    "path": "freebsd-headers/cam/cam_debug.h",
    "content": "/*-\n * Macros for tracing/loging information in the CAM layer\n *\n * Copyright (c) 1997 Justin T. Gibbs.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions, and the following disclaimer,\n *    without modification, immediately at the beginning of the file.\n * 2. The name of the author may not be used to endorse or promote products\n *    derived from this software without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR\n * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/cam/cam_debug.h 208911 2010-06-08 16:17:25Z mjacob $\n */\n#ifndef\t_CAM_CAM_DEBUG_H\n#define _CAM_CAM_DEBUG_H 1\n\n/*\n * Debugging flags.\n */\ntypedef enum {\n\tCAM_DEBUG_NONE\t\t= 0x00, /* no debugging */\n\tCAM_DEBUG_INFO\t\t= 0x01,\t/* scsi commands, errors, data */ \n\tCAM_DEBUG_TRACE\t\t= 0x02,\t/* routine flow tracking */\n\tCAM_DEBUG_SUBTRACE\t= 0x04,\t/* internal to routine flows */\n\tCAM_DEBUG_CDB\t\t= 0x08, /* print out SCSI CDBs only */\n\tCAM_DEBUG_XPT\t\t= 0x10,\t/* print out xpt scheduling */\n\tCAM_DEBUG_PERIPH\t= 0x20, /* print out peripheral calls */\n\tCAM_DEBUG_PROBE\t\t= 0x40  /* print out probe actions */\n} cam_debug_flags;\n\n#if defined(CAMDEBUG) && defined(_KERNEL)\n\n/* Path we want to debug */\nextern struct cam_path *cam_dpath;\n/* Current debug levels set */\nextern u_int32_t cam_dflags;\n/* Printf delay value (to prevent scrolling) */\nextern u_int32_t cam_debug_delay;\n \n/* Debugging macros. */\n#define\tCAM_DEBUGGED(path, flag)\t\t\t\\\n\t((cam_dflags & (flag))\t\t\t\t\\\n\t && (cam_dpath != NULL)\t\t\t\t\\\n\t && (xpt_path_comp(cam_dpath, path) >= 0)\t\\\n\t && (xpt_path_comp(cam_dpath, path) < 2))\n\n#define\tCAM_DEBUG(path, flag, printfargs)\t\t\\\n\tif ((cam_dflags & (flag))\t\t\t\\\n\t && (cam_dpath != NULL)\t\t\t\t\\\n\t && (xpt_path_comp(cam_dpath, path) >= 0)\t\\\n\t && (xpt_path_comp(cam_dpath, path) < 2)) {\t\\\n\t\txpt_print_path(path);\t\t\t\\\n \t\tprintf printfargs;\t\t\t\\\n\t\tif (cam_debug_delay != 0)\t\t\\\n\t\t\tDELAY(cam_debug_delay);\t\t\\\n\t}\n\n#define\tCAM_DEBUG_PRINT(flag, printfargs)\t\t\\\n\tif (cam_dflags & (flag)) {\t\t\t\\\n\t\tprintf(\"cam_debug: \");\t\t\t\\\n \t\tprintf printfargs;\t\t\t\\\n\t\tif (cam_debug_delay != 0)\t\t\\\n\t\t\tDELAY(cam_debug_delay);\t\t\\\n\t}\n\n#define\tCAM_DEBUG_PATH_PRINT(flag, path, printfargs)\t\\\n\tif (cam_dflags & (flag)) {\t\t\t\\\n\t\txpt_print(path, \"cam_debug: \");\t\t\\\n \t\tprintf printfargs;\t\t\t\\\n\t\tif (cam_debug_delay != 0)\t\t\\\n\t\t\tDELAY(cam_debug_delay);\t\t\\\n\t}\n\n#else /* !CAMDEBUG || !_KERNEL */\n\n#define\tCAM_DEBUGGED(A, B)\t0\n#define\tCAM_DEBUG(A, B, C)\n#define\tCAM_DEBUG_PRINT(A, B)\n#define\tCAM_DEBUG_PATH_PRINT(A, B, C)\n\n#endif /* CAMDEBUG && _KERNEL */\n\n#endif /* _CAM_CAM_DEBUG_H */\n"
  },
  {
    "path": "freebsd-headers/cam/cam_periph.h",
    "content": "/*-\n * Data structures and definitions for CAM peripheral (\"type\") drivers.\n *\n * Copyright (c) 1997, 1998 Justin T. Gibbs.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions, and the following disclaimer,\n *    without modification, immediately at the beginning of the file.\n * 2. The name of the author may not be used to endorse or promote products\n *    derived from this software without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR\n * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/cam/cam_periph.h 223081 2011-06-14 14:53:17Z gibbs $\n */\n\n#ifndef _CAM_CAM_PERIPH_H\n#define _CAM_CAM_PERIPH_H 1\n\n#include <sys/queue.h>\n#include <cam/cam_sim.h>\n\n#ifdef _KERNEL\n\nstruct devstat;\n\nextern struct cam_periph *xpt_periph;\n\nextern struct periph_driver **periph_drivers;\nvoid periphdriver_register(void *);\nvoid periphdriver_init(int level);\n\n#include <sys/module.h>\n#define PERIPHDRIVER_DECLARE(name, driver) \\\n\tstatic int name ## _modevent(module_t mod, int type, void *data) \\\n\t{ \\\n\t\tswitch (type) { \\\n\t\tcase MOD_LOAD: \\\n\t\t\tperiphdriver_register(data); \\\n\t\t\tbreak; \\\n\t\tcase MOD_UNLOAD: \\\n\t\t\tprintf(#name \" module unload - not possible for this module type\\n\"); \\\n\t\t\treturn EINVAL; \\\n\t\tdefault: \\\n\t\t\treturn EOPNOTSUPP; \\\n\t\t} \\\n\t\treturn 0; \\\n\t} \\\n\tstatic moduledata_t name ## _mod = { \\\n\t\t#name, \\\n\t\tname ## _modevent, \\\n\t\t(void *)&driver \\\n\t}; \\\n\tDECLARE_MODULE(name, name ## _mod, SI_SUB_DRIVERS, SI_ORDER_ANY); \\\n\tMODULE_DEPEND(name, cam, 1, 1, 1)\n\ntypedef void (periph_init_t)(void); /*\n\t\t\t\t     * Callback informing the peripheral driver\n\t\t\t\t     * it can perform it's initialization since\n\t\t\t\t     * the XPT is now fully initialized.\n\t\t\t\t     */\ntypedef periph_init_t *periph_init_func_t;\n\nstruct periph_driver {\n\tperiph_init_func_t\t init;\n\tchar\t\t\t *driver_name;\n\tTAILQ_HEAD(,cam_periph)\t units;\n\tu_int\t\t\t generation;\n\tu_int\t\t\t flags;\n#define CAM_PERIPH_DRV_EARLY\t\t0x01\n};\n\ntypedef enum {\n\tCAM_PERIPH_BIO\n} cam_periph_type;\n\n/* Generically usefull offsets into the peripheral private area */\n#define ppriv_ptr0 periph_priv.entries[0].ptr\n#define ppriv_ptr1 periph_priv.entries[1].ptr\n#define ppriv_field0 periph_priv.entries[0].field\n#define ppriv_field1 periph_priv.entries[1].field\n\ntypedef void\t\tperiph_start_t (struct cam_periph *periph,\n\t\t\t\t\tunion ccb *start_ccb);\ntypedef cam_status\tperiph_ctor_t (struct cam_periph *periph,\n\t\t\t\t       void *arg);\ntypedef void\t\tperiph_oninv_t (struct cam_periph *periph);\ntypedef void\t\tperiph_dtor_t (struct cam_periph *periph);\nstruct cam_periph {\n\tcam_pinfo\t\t pinfo;\n\tperiph_start_t\t\t*periph_start;\n\tperiph_oninv_t\t\t*periph_oninval;\n\tperiph_dtor_t\t\t*periph_dtor;\n\tchar\t\t\t*periph_name;\n\tstruct cam_path\t\t*path;\t/* Compiled path to device */\n\tvoid\t\t\t*softc;\n\tstruct cam_sim\t\t*sim;\n\tu_int32_t\t\t unit_number;\n\tcam_periph_type\t\t type;\n\tu_int32_t\t\t flags;\n#define CAM_PERIPH_RUNNING\t\t0x01\n#define CAM_PERIPH_LOCKED\t\t0x02\n#define CAM_PERIPH_LOCK_WANTED\t\t0x04\n#define CAM_PERIPH_INVALID\t\t0x08\n#define CAM_PERIPH_NEW_DEV_FOUND\t0x10\n#define CAM_PERIPH_RECOVERY_INPROG\t0x20\n#define CAM_PERIPH_SENSE_INPROG\t\t0x40\n\tu_int32_t\t\t immediate_priority;\n\tu_int32_t\t\t refcount;\n\tSLIST_HEAD(, ccb_hdr)\t ccb_list;\t/* For \"immediate\" requests */\n\tSLIST_ENTRY(cam_periph)  periph_links;\n\tTAILQ_ENTRY(cam_periph)  unit_links;\n\tac_callback_t\t\t*deferred_callback; \n\tac_code\t\t\t deferred_ac;\n};\n\n#define CAM_PERIPH_MAXMAPS\t2\n\nstruct cam_periph_map_info {\n\tint\t\tnum_bufs_used;\n\tstruct buf\t*bp[CAM_PERIPH_MAXMAPS];\n};\n\ncam_status cam_periph_alloc(periph_ctor_t *periph_ctor,\n\t\t\t    periph_oninv_t *periph_oninvalidate,\n\t\t\t    periph_dtor_t *periph_dtor,\n\t\t\t    periph_start_t *periph_start,\n\t\t\t    char *name, cam_periph_type type, struct cam_path *,\n\t\t\t    ac_callback_t *, ac_code, void *arg);\nstruct cam_periph *cam_periph_find(struct cam_path *path, char *name);\nint\t\tcam_periph_list(struct cam_path *, struct sbuf *);\ncam_status\tcam_periph_acquire(struct cam_periph *periph);\nvoid\t\tcam_periph_release(struct cam_periph *periph);\nvoid\t\tcam_periph_release_locked(struct cam_periph *periph);\nint\t\tcam_periph_hold(struct cam_periph *periph, int priority);\nvoid\t\tcam_periph_unhold(struct cam_periph *periph);\nvoid\t\tcam_periph_invalidate(struct cam_periph *periph);\nint\t\tcam_periph_mapmem(union ccb *ccb,\n\t\t\t\t  struct cam_periph_map_info *mapinfo);\nvoid\t\tcam_periph_unmapmem(union ccb *ccb,\n\t\t\t\t    struct cam_periph_map_info *mapinfo);\nunion ccb\t*cam_periph_getccb(struct cam_periph *periph,\n\t\t\t\t   u_int32_t priority);\nvoid\t\tcam_periph_ccbwait(union ccb *ccb);\nint\t\tcam_periph_runccb(union ccb *ccb,\n\t\t\t\t  int (*error_routine)(union ccb *ccb,\n\t\t\t\t\t\t       cam_flags camflags,\n\t\t\t\t\t\t       u_int32_t sense_flags),\n\t\t\t\t  cam_flags camflags, u_int32_t sense_flags,\n\t\t\t\t  struct devstat *ds);\nint\t\tcam_periph_ioctl(struct cam_periph *periph, u_long cmd, \n\t\t\t\t caddr_t addr,\n\t\t\t\t int (*error_routine)(union ccb *ccb,\n\t\t\t\t\t\t      cam_flags camflags,\n\t\t\t\t\t\t      u_int32_t sense_flags));\nvoid\t\tcam_freeze_devq(struct cam_path *path);\nvoid\t\tcam_freeze_devq_arg(struct cam_path *path, u_int32_t flags,\n\t\t    uint32_t arg);\nu_int32_t\tcam_release_devq(struct cam_path *path, u_int32_t relsim_flags,\n\t\t\t\t u_int32_t opening_reduction, u_int32_t arg,\n\t\t\t\t int getcount_only);\nvoid\t\tcam_periph_async(struct cam_periph *periph, u_int32_t code,\n\t\t \t\t struct cam_path *path, void *arg);\nvoid\t\tcam_periph_bus_settle(struct cam_periph *periph,\n\t\t\t\t      u_int bus_settle_ms);\nvoid\t\tcam_periph_freeze_after_event(struct cam_periph *periph,\n\t\t\t\t\t      struct timeval* event_time,\n\t\t\t\t\t      u_int duration_ms);\nint\t\tcam_periph_error(union ccb *ccb, cam_flags camflags,\n\t\t\t\t u_int32_t sense_flags, union ccb *save_ccb);\n\nstatic __inline void\ncam_periph_lock(struct cam_periph *periph)\n{\n\tmtx_lock(periph->sim->mtx);\n}\n\nstatic __inline void\ncam_periph_unlock(struct cam_periph *periph)\n{\n\tmtx_unlock(periph->sim->mtx);\n}\n\nstatic __inline int\ncam_periph_owned(struct cam_periph *periph)\n{\n\treturn (mtx_owned(periph->sim->mtx));\n}\n\nstatic __inline int\ncam_periph_sleep(struct cam_periph *periph, void *chan, int priority,\n\t\t const char *wmesg, int timo)\n{\n\treturn (msleep(chan, periph->sim->mtx, priority, wmesg, timo));\n}\n\n#endif /* _KERNEL */\n#endif /* _CAM_CAM_PERIPH_H */\n"
  },
  {
    "path": "freebsd-headers/cam/cam_queue.h",
    "content": "/*-\n * CAM request queue management definitions.\n *\n * Copyright (c) 1997 Justin T. Gibbs.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions, and the following disclaimer,\n *    without modification, immediately at the beginning of the file.\n * 2. The name of the author may not be used to endorse or promote products\n *    derived from this software without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR\n * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/cam/cam_queue.h 203108 2010-01-28 08:41:30Z mav $\n */\n\n#ifndef _CAM_CAM_QUEUE_H\n#define _CAM_CAM_QUEUE_H 1\n\n#ifdef _KERNEL\n\n#include <sys/queue.h>\n#include <cam/cam.h>\n\n/*\n * This structure implements a heap based priority queue.  The queue\n * assumes that the objects stored in it begin with a cam_qentry\n * structure holding the priority information used to sort the objects.\n * This structure is opaque to clients (outside of the XPT layer) to allow\n * the implementation to change without affecting them.\n */\nstruct camq {\n\tcam_pinfo **queue_array;\n\tint\t   array_size;\n\tint\t   entries;\n\tu_int32_t  generation;\n\tu_int32_t  qfrozen_cnt[CAM_RL_VALUES];\n};\n\nTAILQ_HEAD(ccb_hdr_tailq, ccb_hdr);\nLIST_HEAD(ccb_hdr_list, ccb_hdr);\nSLIST_HEAD(ccb_hdr_slist, ccb_hdr);\n\nstruct cam_ccbq {\n\tstruct\tcamq queue;\n\tint\tdevq_openings;\n\tint\tdev_openings;\t\n\tint\tdev_active;\n\tint\theld;\n};\n\nstruct cam_ed;\n\nstruct cam_devq {\n\tstruct\tcamq alloc_queue;\n\tstruct\tcamq send_queue;\n\tstruct\tcam_ed *active_dev;\n\tint\talloc_openings;\n\tint\talloc_active;\n\tint\tsend_openings;\n\tint\tsend_active;\n};\n\n\nstruct cam_devq *cam_devq_alloc(int devices, int openings);\n\nint\t\t cam_devq_init(struct cam_devq *devq, int devices,\n\t\t\t       int openings);\n\nvoid\t\t cam_devq_free(struct cam_devq *devq);\n\nu_int32_t\t cam_devq_resize(struct cam_devq *camq, int openings);\n\t\n/*\n * Allocate a cam_ccb_queue structure and initialize it.\n */\nstruct cam_ccbq\t*cam_ccbq_alloc(int openings);\n\nu_int32_t\tcam_ccbq_resize(struct cam_ccbq *ccbq, int devices);\n\nint\t\tcam_ccbq_init(struct cam_ccbq *ccbq, int openings);\n\nvoid\t\tcam_ccbq_free(struct cam_ccbq *ccbq);\n\nvoid\t\tcam_ccbq_fini(struct cam_ccbq *ccbq);\n\n/*\n * Allocate and initialize a cam_queue structure.\n */\nstruct camq\t*camq_alloc(int size);\n\n/*\n * Resize a cam queue\n */\nu_int32_t\tcamq_resize(struct camq *queue, int new_size);\n\n/* \n * Initialize a camq structure.  Return 0 on success, 1 on failure.\n */\nint\t\tcamq_init(struct camq *camq, int size);\n\n/*\n * Free a cam_queue structure.  This should only be called if a controller\n * driver failes somehow during its attach routine or is unloaded and has\n * obtained a cam_queue structure.\n */\nvoid\t\tcamq_free(struct camq *queue);\n\n/*\n * Finialize any internal storage or state of a cam_queue.\n */\nvoid\t\tcamq_fini(struct camq *queue);\n\n/*\n * cam_queue_insert: Given a CAM queue with at least one open spot,\n * insert the new entry maintaining order.\n */\nvoid\t\tcamq_insert(struct camq *queue, cam_pinfo *new_entry);\n\n/*\n * camq_remove: Remove and arbitrary entry from the queue maintaining\n * queue order.\n */\ncam_pinfo\t*camq_remove(struct camq *queue, int index);\n#define CAMQ_HEAD 1\t/* Head of queue index */\n\n/* Index the first element in the heap */\n#define CAMQ_GET_HEAD(camq) ((camq)->queue_array[CAMQ_HEAD])\n\n/* Get the first element priority. */\n#define CAMQ_GET_PRIO(camq) (((camq)->entries > 0) ?\t\t\t\\\n\t\t\t    ((camq)->queue_array[CAMQ_HEAD]->priority) : 0)\n\n/*\n * camq_change_priority: Raise or lower the priority of an entry\n * maintaining queue order.\n */\nvoid\t\tcamq_change_priority(struct camq *queue, int index,\n\t\t\t\t     u_int32_t new_priority);\n\nstatic __inline int\ncam_ccbq_pending_ccb_count(struct cam_ccbq *ccbq);\n\nstatic __inline void\ncam_ccbq_take_opening(struct cam_ccbq *ccbq);\n\nstatic __inline int\ncam_ccbq_insert_ccb(struct cam_ccbq *ccbq, union ccb *new_ccb);\n\nstatic __inline int\ncam_ccbq_remove_ccb(struct cam_ccbq *ccbq, union ccb *ccb);\n\nstatic __inline union ccb *\ncam_ccbq_peek_ccb(struct cam_ccbq *ccbq, int index);\n\nstatic __inline void\ncam_ccbq_send_ccb(struct cam_ccbq *queue, union ccb *send_ccb);\n\nstatic __inline void\ncam_ccbq_ccb_done(struct cam_ccbq *ccbq, union ccb *done_ccb);\n\nstatic __inline void\ncam_ccbq_release_opening(struct cam_ccbq *ccbq);\n\n\nstatic __inline int\ncam_ccbq_pending_ccb_count(struct cam_ccbq *ccbq)\n{\n\treturn (ccbq->queue.entries);\n}\n\nstatic __inline void\ncam_ccbq_take_opening(struct cam_ccbq *ccbq)\n{\n\tccbq->devq_openings--;\n\tccbq->held++;\n}\n\nstatic __inline int\ncam_ccbq_insert_ccb(struct cam_ccbq *ccbq, union ccb *new_ccb)\n{\n\tccbq->held--;\n\tcamq_insert(&ccbq->queue, &new_ccb->ccb_h.pinfo);\n\tif (ccbq->queue.qfrozen_cnt[CAM_PRIORITY_TO_RL(\n\t    new_ccb->ccb_h.pinfo.priority)] > 0) {\n\t\tccbq->devq_openings++;\n\t\tccbq->held++;\n\t\treturn (1);\n\t} else\n\t\treturn (0);\n}\n\nstatic __inline int\ncam_ccbq_remove_ccb(struct cam_ccbq *ccbq, union ccb *ccb)\n{\n\tcamq_remove(&ccbq->queue, ccb->ccb_h.pinfo.index);\n\tif (ccbq->queue.qfrozen_cnt[CAM_PRIORITY_TO_RL(\n\t    ccb->ccb_h.pinfo.priority)] > 0) {\n\t\tccbq->devq_openings--;\n\t\tccbq->held--;\n\t\treturn (1);\n\t} else\n\t\treturn (0);\n}\n\nstatic __inline union ccb *\ncam_ccbq_peek_ccb(struct cam_ccbq *ccbq, int index)\n{\n\treturn((union ccb *)ccbq->queue.queue_array[index]);\n}\n\nstatic __inline void\ncam_ccbq_send_ccb(struct cam_ccbq *ccbq, union ccb *send_ccb)\n{\n\n\tsend_ccb->ccb_h.pinfo.index = CAM_ACTIVE_INDEX;\n\tccbq->dev_active++;\n\tccbq->dev_openings--;\t\t\n}\n\nstatic __inline void\ncam_ccbq_ccb_done(struct cam_ccbq *ccbq, union ccb *done_ccb)\n{\n\n\tccbq->dev_active--;\n\tccbq->dev_openings++;\t\n\tccbq->held++;\n}\n\nstatic __inline void\ncam_ccbq_release_opening(struct cam_ccbq *ccbq)\n{\n\tccbq->held--;\n\tccbq->devq_openings++;\n}\n\nstatic __inline int\ncam_ccbq_freeze(struct cam_ccbq *ccbq, cam_rl rl, u_int32_t cnt)\n{\n\tint i, frozen = 0;\n\tcam_rl p, n;\n\n\t/* Find pevious run level. */\n\tfor (p = 0; p < CAM_RL_VALUES && ccbq->queue.qfrozen_cnt[p] == 0; p++);\n\t/* Find new run level. */\n\tn = min(rl, p);\n\t/* Apply new run level. */\n\tfor (i = rl; i < CAM_RL_VALUES; i++)\n\t\tccbq->queue.qfrozen_cnt[i] += cnt;\n\t/* Update ccbq statistics. */\n\tif (n == p)\n\t\treturn (0);\n\tfor (i = CAMQ_HEAD; i <= ccbq->queue.entries; i++) {\n\t\tcam_rl rrl =\n\t\t    CAM_PRIORITY_TO_RL(ccbq->queue.queue_array[i]->priority);\n\t\tif (rrl < n)\n\t\t\tcontinue;\n\t\tif (rrl >= p)\n\t\t\tbreak;\n\t\tccbq->devq_openings++;\n\t\tccbq->held++;\n\t\tfrozen++;\n\t}\n\treturn (frozen);\n}\n\nstatic __inline int\ncam_ccbq_release(struct cam_ccbq *ccbq, cam_rl rl, u_int32_t cnt)\n{\n\tint i, released = 0;\n\tcam_rl p, n;\n\n\t/* Apply new run level. */\n\tfor (i = rl; i < CAM_RL_VALUES; i++)\n\t\tccbq->queue.qfrozen_cnt[i] -= cnt;\n\t/* Find new run level. */\n\tfor (n = 0; n < CAM_RL_VALUES && ccbq->queue.qfrozen_cnt[n] == 0; n++);\n\t/* Find previous run level. */\n\tp = min(rl, n);\n\t/* Update ccbq statistics. */\n\tif (n == p)\n\t\treturn (0);\n\tfor (i = CAMQ_HEAD; i <= ccbq->queue.entries; i++) {\n\t\tcam_rl rrl =\n\t\t    CAM_PRIORITY_TO_RL(ccbq->queue.queue_array[i]->priority);\n\t\tif (rrl < p)\n\t\t\tcontinue;\n\t\tif (rrl >= n)\n\t\t\tbreak;\n\t\tccbq->devq_openings--;\n\t\tccbq->held--;\n\t\treleased++;\n\t}\n\treturn (released);\n}\n\nstatic __inline u_int32_t\ncam_ccbq_frozen(struct cam_ccbq *ccbq, cam_rl rl)\n{\n\t\n\treturn (ccbq->queue.qfrozen_cnt[rl]);\n}\n\nstatic __inline u_int32_t\ncam_ccbq_frozen_top(struct cam_ccbq *ccbq)\n{\n\tcam_rl rl;\n\t\n\trl = CAM_PRIORITY_TO_RL(CAMQ_GET_PRIO(&ccbq->queue));\n\treturn (ccbq->queue.qfrozen_cnt[rl]);\n}\n\n#endif /* _KERNEL */\n#endif  /* _CAM_CAM_QUEUE_H */\n"
  },
  {
    "path": "freebsd-headers/cam/cam_sim.h",
    "content": "/*-\n * Data structures and definitions for SCSI Interface Modules (SIMs).\n *\n * Copyright (c) 1997 Justin T. Gibbs.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions, and the following disclaimer,\n *    without modification, immediately at the beginning of the file.\n * 2. The name of the author may not be used to endorse or promote products\n *    derived from this software without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR\n * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/cam/cam_sim.h 186396 2008-12-22 16:58:47Z scottl $\n */\n\n#ifndef _CAM_CAM_SIM_H\n#define _CAM_CAM_SIM_H 1\n\n#ifdef _KERNEL\n\n/*\n * The sim driver creates a sim for each controller.  The sim device\n * queue is separately created in order to allow resource sharing between\n * sims.  For instance, a driver may create one sim for each channel of\n * a multi-channel controller and use the same queue for each channel.\n * In this way, the queue resources are shared across all the channels\n * of the multi-channel controller.\n */\n\nstruct cam_sim;\nstruct cam_devq;\n\ntypedef void (*sim_action_func)(struct cam_sim *sim, union ccb *ccb);\ntypedef void (*sim_poll_func)(struct cam_sim *sim);\n\nstruct cam_devq * cam_simq_alloc(u_int32_t max_sim_transactions);\nvoid\t\t  cam_simq_free(struct cam_devq *devq);\n\nstruct cam_sim *  cam_sim_alloc(sim_action_func sim_action,\n\t\t\t\tsim_poll_func sim_poll,\n\t\t\t\tconst char *sim_name,\n\t\t\t\tvoid *softc,\n\t\t\t\tu_int32_t unit,\n\t\t\t\tstruct mtx *mtx,\n\t\t\t\tint max_dev_transactions,\n\t\t\t\tint max_tagged_dev_transactions,\n\t\t\t\tstruct cam_devq *queue);\nvoid\t\t  cam_sim_free(struct cam_sim *sim, int free_devq);\nvoid\t\t  cam_sim_hold(struct cam_sim *sim);\nvoid\t\t  cam_sim_release(struct cam_sim *sim);\n\n/* Optional sim attributes may be set with these. */\nvoid\tcam_sim_set_path(struct cam_sim *sim, u_int32_t path_id);\n\n\n\n/* Convenience routines for accessing sim attributes. */\nstatic __inline u_int32_t    cam_sim_path(struct cam_sim *sim);\nstatic __inline const char * cam_sim_name(struct cam_sim *sim);\nstatic __inline void *\t     cam_sim_softc(struct cam_sim *sim);\nstatic __inline u_int32_t    cam_sim_unit(struct cam_sim *sim);\nstatic __inline u_int32_t    cam_sim_bus(struct cam_sim *sim);\n\n\n\n/* Generically useful offsets into the sim private area */\n#define spriv_ptr0 sim_priv.entries[0].ptr\n#define spriv_ptr1 sim_priv.entries[1].ptr\n#define spriv_field0 sim_priv.entries[0].field\n#define spriv_field1 sim_priv.entries[1].field\n\n/*\n * The sim driver should not access anything directly from this\n * structure.\n */\nstruct cam_sim {\n\tsim_action_func\t\tsim_action;\n\tsim_poll_func\t\tsim_poll;\n\tconst char\t\t*sim_name;\n\tvoid\t\t\t*softc;\n\tstruct mtx\t\t*mtx;\n\tTAILQ_HEAD(, ccb_hdr)\tsim_doneq;\n\tTAILQ_ENTRY(cam_sim)\tlinks;\n\tu_int32_t\t\tpath_id;/* The Boot device may set this to 0? */\n\tu_int32_t\t\tunit_number;\n\tu_int32_t\t\tbus_id;\n\tint\t\t\tmax_tagged_dev_openings;\n\tint\t\t\tmax_dev_openings;\n\tu_int32_t\t\tflags;\n#define\tCAM_SIM_REL_TIMEOUT_PENDING\t0x01\n#define\tCAM_SIM_MPSAFE\t\t\t0x02\n#define CAM_SIM_ON_DONEQ\t\t0x04\n\tstruct callout\t\tcallout;\n\tstruct cam_devq \t*devq;\t/* Device Queue to use for this SIM */\n\tint\t\t\trefcount; /* References to the SIM. */\n\n\t/* \"Pool\" of inactive ccbs managed by xpt_get_ccb and xpt_release_ccb */\n\tSLIST_HEAD(,ccb_hdr)\tccb_freeq;\n\t/*\n\t * Maximum size of ccb pool.  Modified as devices are added/removed\n\t * or have their * opening counts changed.\n\t */\n\tu_int\t\t\tmax_ccbs;\n\t/* Current count of allocated ccbs */\n\tu_int\t\t\tccb_count;\n\n};\n\n#define CAM_SIM_LOCK(sim)\tmtx_lock((sim)->mtx);\n#define CAM_SIM_UNLOCK(sim)\tmtx_unlock((sim)->mtx);\n\nstatic __inline u_int32_t\ncam_sim_path(struct cam_sim *sim)\n{\n\treturn (sim->path_id);\n}\n\nstatic __inline const char *\ncam_sim_name(struct cam_sim *sim)\n{\n\treturn (sim->sim_name);\n}\n\nstatic __inline void *\ncam_sim_softc(struct cam_sim *sim)\n{\n\treturn (sim->softc);\n}\n\nstatic __inline u_int32_t\ncam_sim_unit(struct cam_sim *sim)\n{\n\treturn (sim->unit_number);\n}\n\nstatic __inline u_int32_t\ncam_sim_bus(struct cam_sim *sim)\n{\n\treturn (sim->bus_id);\n}\n\n#endif /* _KERNEL */\n#endif /* _CAM_CAM_SIM_H */\n"
  },
  {
    "path": "freebsd-headers/cam/cam_xpt.h",
    "content": "/*-\n * Data structures and definitions for dealing with the \n * Common Access Method Transport (xpt) layer.\n *\n * Copyright (c) 1997 Justin T. Gibbs.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions, and the following disclaimer,\n *    without modification, immediately at the beginning of the file.\n * 2. The name of the author may not be used to endorse or promote products\n *    derived from this software without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR\n * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/cam/cam_xpt.h 224806 2011-08-12 20:09:38Z mjacob $\n */\n\n#ifndef _CAM_CAM_XPT_H\n#define _CAM_CAM_XPT_H 1\n\n/* Forward Declarations */\nunion ccb;\nstruct cam_periph;\nstruct cam_sim;\n\n/*\n * Definition of a CAM path.  Paths are created from bus, target, and lun ids\n * via xpt_create_path and allow for reference to devices without recurring\n * lookups in the edt.\n */\nstruct cam_path;\n\n/* Path functions */\n\n#ifdef _KERNEL\n\n/*\n * Definition of an async handler callback block.  These are used to add\n * SIMs and peripherals to the async callback lists.\n */\nstruct async_node {\n\tSLIST_ENTRY(async_node)\tlinks;\n\tu_int32_t\tevent_enable;\t/* Async Event enables */\n\tvoid\t\t(*callback)(void *arg, u_int32_t code,\n\t\t\t\t    struct cam_path *path, void *args);\n\tvoid\t\t*callback_arg;\n};\n\nSLIST_HEAD(async_list, async_node);\nSLIST_HEAD(periph_list, cam_periph);\n\n#if defined(CAM_DEBUG_FLAGS) && !defined(CAMDEBUG)\n#error \"You must have options CAMDEBUG to use options CAM_DEBUG_FLAGS\"\n#endif\n\n/*\n * In order to enable the CAM_DEBUG_* options, the user must have CAMDEBUG\n * enabled.  Also, the user must have either none, or all of CAM_DEBUG_BUS,\n * CAM_DEBUG_TARGET, and CAM_DEBUG_LUN specified.\n */\n#if defined(CAM_DEBUG_BUS) || defined(CAM_DEBUG_TARGET) \\\n    || defined(CAM_DEBUG_LUN)\n#ifdef CAMDEBUG\n#if !defined(CAM_DEBUG_BUS) || !defined(CAM_DEBUG_TARGET) \\\n    || !defined(CAM_DEBUG_LUN)\n#error \"You must define all or none of CAM_DEBUG_BUS, CAM_DEBUG_TARGET \\\n        and CAM_DEBUG_LUN\"\n#endif /* !CAM_DEBUG_BUS || !CAM_DEBUG_TARGET || !CAM_DEBUG_LUN */\n#else /* !CAMDEBUG */\n#error \"You must use options CAMDEBUG if you use the CAM_DEBUG_* options\"\n#endif /* CAMDEBUG */\n#endif /* CAM_DEBUG_BUS || CAM_DEBUG_TARGET || CAM_DEBUG_LUN */\n\nvoid\t\t\txpt_action(union ccb *new_ccb);\nvoid\t\t\txpt_action_default(union ccb *new_ccb);\nunion ccb\t\t*xpt_alloc_ccb(void);\nunion ccb\t\t*xpt_alloc_ccb_nowait(void);\nvoid\t\t\txpt_free_ccb(union ccb *free_ccb);\nvoid\t\t\txpt_setup_ccb(struct ccb_hdr *ccb_h,\n\t\t\t\t      struct cam_path *path,\n\t\t\t\t      u_int32_t priority);\nvoid\t\t\txpt_merge_ccb(union ccb *master_ccb,\n\t\t\t\t      union ccb *slave_ccb);\ncam_status\t\txpt_create_path(struct cam_path **new_path_ptr,\n\t\t\t\t\tstruct cam_periph *perph,\n\t\t\t\t\tpath_id_t path_id,\n\t\t\t\t\ttarget_id_t target_id, lun_id_t lun_id);\ncam_status\t\txpt_create_path_unlocked(struct cam_path **new_path_ptr,\n\t\t\t\t\tstruct cam_periph *perph,\n\t\t\t\t\tpath_id_t path_id,\n\t\t\t\t\ttarget_id_t target_id, lun_id_t lun_id);\nint\t\t\txpt_getattr(char *buf, size_t len, const char *attr,\n\t\t\t\t    struct cam_path *path);\nvoid\t\t\txpt_free_path(struct cam_path *path);\nvoid\t\t\txpt_path_counts(struct cam_path *path, uint32_t *bus_ref,\n\t\t\t\t\tuint32_t *periph_ref, uint32_t *target_ref,\n\t\t\t\t\tuint32_t *device_ref);\nint\t\t\txpt_path_comp(struct cam_path *path1,\n\t\t\t\t      struct cam_path *path2);\nvoid\t\t\txpt_print_path(struct cam_path *path);\nvoid\t\t\txpt_print(struct cam_path *path, const char *fmt, ...);\nint\t\t\txpt_path_string(struct cam_path *path, char *str,\n\t\t\t\t\tsize_t str_len);\npath_id_t\t\txpt_path_path_id(struct cam_path *path);\ntarget_id_t\t\txpt_path_target_id(struct cam_path *path);\nlun_id_t\t\txpt_path_lun_id(struct cam_path *path);\nint\t\t\txpt_path_legacy_ata_id(struct cam_path *path);\nstruct cam_sim\t\t*xpt_path_sim(struct cam_path *path);\nstruct cam_periph\t*xpt_path_periph(struct cam_path *path);\nvoid\t\t\txpt_async(u_int32_t async_code, struct cam_path *path,\n\t\t\t\t  void *async_arg);\nvoid\t\t\txpt_rescan(union ccb *ccb);\nvoid\t\t\txpt_hold_boot(void);\nvoid\t\t\txpt_release_boot(void);\nvoid\t\t\txpt_lock_buses(void);\nvoid\t\t\txpt_unlock_buses(void);\ncam_status\t\txpt_register_async(int event, ac_callback_t *cbfunc,\n\t\t\t\t\t   void *cbarg, struct cam_path *path);\ncam_status\t\txpt_compile_path(struct cam_path *new_path,\n\t\t\t\t\t struct cam_periph *perph,\n\t\t\t\t\t path_id_t path_id,\n\t\t\t\t\t target_id_t target_id,\n\t\t\t\t\t lun_id_t lun_id);\n\nvoid\t\t\txpt_release_path(struct cam_path *path);\n\n#endif /* _KERNEL */\n\n#endif /* _CAM_CAM_XPT_H */\n"
  },
  {
    "path": "freebsd-headers/cam/cam_xpt_internal.h",
    "content": "/*-\n * Copyright 2009 Scott Long\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions, and the following disclaimer,\n *    without modification, immediately at the beginning of the file.\n * 2. The name of the author may not be used to endorse or promote products\n *    derived from this software without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR\n * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/cam/cam_xpt_internal.h 223081 2011-06-14 14:53:17Z gibbs $\n */\n\n#ifndef _CAM_CAM_XPT_INTERNAL_H\n#define _CAM_CAM_XPT_INTERNAL_H 1\n\n/* Forward Declarations */\nstruct cam_eb;\nstruct cam_et;\nstruct cam_ed;\n\ntypedef struct cam_ed * (*xpt_alloc_device_func)(struct cam_eb *bus,\n\t\t\t\t\t         struct cam_et *target,\n\t\t\t\t\t         lun_id_t lun_id);\ntypedef void (*xpt_release_device_func)(struct cam_ed *device);\ntypedef void (*xpt_action_func)(union ccb *start_ccb);\ntypedef void (*xpt_dev_async_func)(u_int32_t async_code,\n\t\t\t\t   struct cam_eb *bus,\n\t\t\t\t   struct cam_et *target,\n\t\t\t\t   struct cam_ed *device,\n\t\t\t\t   void *async_arg);\ntypedef void (*xpt_announce_periph_func)(struct cam_periph *periph);\n\nstruct xpt_xport {\n\txpt_alloc_device_func\talloc_device;\n\txpt_release_device_func\treldev;\n\txpt_action_func\t\taction;\n\txpt_dev_async_func\tasync;\n\txpt_announce_periph_func announce;\n};\n\n/*\n * Structure for queueing a device in a run queue.\n * There is one run queue for allocating new ccbs,\n * and another for sending ccbs to the controller.\n */\nstruct cam_ed_qinfo {\n\tcam_pinfo pinfo;\n\tstruct\t  cam_ed *device;\n};\n\n/*\n * The CAM EDT (Existing Device Table) contains the device information for\n * all devices for all busses in the system.  The table contains a\n * cam_ed structure for each device on the bus.\n */\nstruct cam_ed {\n\tTAILQ_ENTRY(cam_ed) links;\n\tstruct\tcam_ed_qinfo alloc_ccb_entry;\n\tstruct\tcam_ed_qinfo send_ccb_entry;\n\tstruct\tcam_et\t *target;\n\tstruct\tcam_sim  *sim;\n\tlun_id_t\t lun_id;\n\tstruct\tcamq drvq;\t\t/*\n\t\t\t\t\t * Queue of type drivers wanting to do\n\t\t\t\t\t * work on this device.\n\t\t\t\t\t */\n\tstruct\tcam_ccbq ccbq;\t\t/* Queue of pending ccbs */\n\tstruct\tasync_list asyncs;\t/* Async callback info for this B/T/L */\n\tstruct\tperiph_list periphs;\t/* All attached devices */\n\tu_int\tgeneration;\t\t/* Generation number */\n\tstruct\tcam_periph *owner;\t/* Peripheral driver's ownership tag */\n\tvoid\t\t *quirk;\t/* Oddities about this device */\n\tu_int\t\t maxtags;\n\tu_int\t\t mintags;\n\tcam_proto\t protocol;\n\tu_int\t\t protocol_version;\n\tcam_xport\t transport;\n\tu_int\t\t transport_version;\n\tstruct\t\t scsi_inquiry_data inq_data;\n\tuint8_t\t\t *supported_vpds;\n\tuint8_t\t\t supported_vpds_len;\n\tuint32_t\t device_id_len;\n\tuint8_t\t\t *device_id;\n\tuint8_t\t\t physpath_len;\n\tuint8_t\t\t *physpath;\t/* physical path string form */\n\tstruct\t\t ata_params ident_data;\n\tu_int8_t\t inq_flags;\t/*\n\t\t\t\t\t * Current settings for inquiry flags.\n\t\t\t\t\t * This allows us to override settings\n\t\t\t\t\t * like disconnection and tagged\n\t\t\t\t\t * queuing for a device.\n\t\t\t\t\t */\n\tu_int8_t\t queue_flags;\t/* Queue flags from the control page */\n\tu_int8_t\t serial_num_len;\n\tu_int8_t\t*serial_num;\n\tu_int32_t\t flags;\n#define CAM_DEV_UNCONFIGURED\t \t0x01\n#define CAM_DEV_REL_TIMEOUT_PENDING\t0x02\n#define CAM_DEV_REL_ON_COMPLETE\t\t0x04\n#define CAM_DEV_REL_ON_QUEUE_EMPTY\t0x08\n#define CAM_DEV_RESIZE_QUEUE_NEEDED\t0x10\n#define CAM_DEV_TAG_AFTER_COUNT\t\t0x20\n#define CAM_DEV_INQUIRY_DATA_VALID\t0x40\n#define\tCAM_DEV_IN_DV\t\t\t0x80\n#define\tCAM_DEV_DV_HIT_BOTTOM\t\t0x100\n#define CAM_DEV_IDENTIFY_DATA_VALID\t0x200\n\tu_int32_t\t tag_delay_count;\n#define\tCAM_TAG_DELAY_COUNT\t\t5\n\tu_int32_t\t tag_saved_openings;\n\tu_int32_t\t refcount;\n\tstruct callout\t callout;\n};\n\n/*\n * Each target is represented by an ET (Existing Target).  These\n * entries are created when a target is successfully probed with an\n * identify, and removed when a device fails to respond after a number\n * of retries, or a bus rescan finds the device missing.\n */\nstruct cam_et {\n\tTAILQ_HEAD(, cam_ed) ed_entries;\n\tTAILQ_ENTRY(cam_et) links;\n\tstruct\tcam_eb\t*bus;\n\ttarget_id_t\ttarget_id;\n\tu_int32_t\trefcount;\n\tu_int\t\tgeneration;\n\tstruct\t\ttimeval last_reset;\n\tu_int\t\trpl_size;\n\tstruct scsi_report_luns_data *luns;\n};\n\n/*\n * Each bus is represented by an EB (Existing Bus).  These entries\n * are created by calls to xpt_bus_register and deleted by calls to\n * xpt_bus_deregister.\n */\nstruct cam_eb {\n\tTAILQ_HEAD(, cam_et) et_entries;\n\tTAILQ_ENTRY(cam_eb)  links;\n\tpath_id_t\t     path_id;\n\tstruct cam_sim\t     *sim;\n\tstruct timeval\t     last_reset;\n\tu_int32_t\t     flags;\n#define\tCAM_EB_RUNQ_SCHEDULED\t0x01\n\tu_int32_t\t     refcount;\n\tu_int\t\t     generation;\n\tdevice_t\t     parent_dev;\n\tstruct xpt_xport     *xport;\n};\n\nstruct cam_path {\n\tstruct cam_periph *periph;\n\tstruct cam_eb\t  *bus;\n\tstruct cam_et\t  *target;\n\tstruct cam_ed\t  *device;\n};\n\nstruct xpt_xport *\tscsi_get_xport(void);\nstruct xpt_xport *\tata_get_xport(void);\n\nstruct cam_ed *\t\txpt_alloc_device(struct cam_eb *bus,\n\t\t\t\t\t struct cam_et *target,\n\t\t\t\t\t lun_id_t lun_id);\nvoid\t\t\txpt_acquire_device(struct cam_ed *device);\nvoid\t\t\txpt_release_device(struct cam_ed *device);\nint\t\t\txpt_schedule_dev(struct camq *queue, cam_pinfo *dev_pinfo,\n\t\t\t\t\t u_int32_t new_priority);\nu_int32_t\t\txpt_dev_ccbq_resize(struct cam_path *path, int newopenings);\nvoid\t\t\txpt_start_tags(struct cam_path *path);\nvoid\t\t\txpt_stop_tags(struct cam_path *path);\n\nMALLOC_DECLARE(M_CAMXPT);\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/cam/cam_xpt_periph.h",
    "content": "/*-\n * Data structures and definitions for dealing with the \n * Common Access Method Transport (xpt) layer from peripheral\n * drivers.\n *\n * Copyright (c) 1997 Justin T. Gibbs.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions, and the following disclaimer,\n *    without modification, immediately at the beginning of the file.\n * 2. The name of the author may not be used to endorse or promote products\n *    derived from this software without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR\n * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/cam/cam_xpt_periph.h 203108 2010-01-28 08:41:30Z mav $\n */\n\n#ifndef _CAM_CAM_XPT_PERIPH_H\n#define _CAM_CAM_XPT_PERIPH_H 1\n\n#include <cam/cam_queue.h>\n#include <cam/cam_xpt.h>\n\n/* Functions accessed by the peripheral drivers */\n#ifdef _KERNEL\nvoid\t\txpt_polled_action(union ccb *ccb);\nvoid\t\txpt_release_ccb(union ccb *released_ccb);\nvoid\t\txpt_schedule(struct cam_periph *perph, u_int32_t new_priority);\nint32_t\t\txpt_add_periph(struct cam_periph *periph);\nvoid\t\txpt_remove_periph(struct cam_periph *periph);\nvoid\t\txpt_announce_periph(struct cam_periph *periph,\n\t\t\t\t    char *announce_string);\n#endif\n\n#endif /* _CAM_CAM_XPT_PERIPH_H */\n"
  },
  {
    "path": "freebsd-headers/cam/cam_xpt_sim.h",
    "content": "/*-\n * Data structures and definitions for dealing with the \n * Common Access Method Transport (xpt) layer.\n *\n * Copyright (c) 1997 Justin T. Gibbs.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions, and the following disclaimer,\n *    without modification, immediately at the beginning of the file.\n * 2. The name of the author may not be used to endorse or promote products\n *    derived from this software without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR\n * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/cam/cam_xpt_sim.h 203108 2010-01-28 08:41:30Z mav $\n */\n\n#ifndef _CAM_CAM_XPT_SIM_H\n#define _CAM_CAM_XPT_SIM_H 1\n\n#include <cam/cam_xpt.h>\n#include <cam/cam_queue.h>\n\n/* Functions accessed by SIM drivers */\n#ifdef _KERNEL\nint32_t\t\txpt_bus_register(struct cam_sim *sim, device_t parent,\n\t\t\t\t u_int32_t bus);\nint32_t\t\txpt_bus_deregister(path_id_t path_id);\nu_int32_t\txpt_freeze_simq(struct cam_sim *sim, u_int count);\nvoid\t\txpt_release_simq(struct cam_sim *sim, int run_queue);\nu_int32_t\txpt_freeze_devq(struct cam_path *path, u_int count);\nu_int32_t\txpt_freeze_devq_rl(struct cam_path *path, cam_rl rl,\n\t\t    u_int count);\nvoid\t\txpt_release_devq(struct cam_path *path,\n\t\t    u_int count, int run_queue);\nvoid\t\txpt_release_devq_rl(struct cam_path *path, cam_rl rl,\n\t\t    u_int count, int run_queue);\nint\t\txpt_sim_opened(struct cam_sim *sim);\nvoid\t\txpt_done(union ccb *done_ccb);\n#endif\n\n#endif /* _CAM_CAM_XPT_SIM_H */\n\n"
  },
  {
    "path": "freebsd-headers/cam/scsi/scsi_all.h",
    "content": "/*-\n * Largely written by Julian Elischer (julian@tfs.com)\n * for TRW Financial Systems.\n *\n * TRW Financial Systems, in accordance with their agreement with Carnegie\n * Mellon University, makes this software available to CMU to distribute\n * or use in any manner that they see fit as long as this message is kept with\n * the software. For this reason TFS also grants any other persons or\n * organisations permission to use or modify this software.\n *\n * TFS supplies this software to be publicly redistributed\n * on the understanding that TFS is not responsible for the correct\n * functioning of this software in any circumstances.\n *\n * Ported to run under 386BSD by Julian Elischer (julian@tfs.com) Sept 1992\n *\n * $FreeBSD: release/9.0.0/sys/cam/scsi/scsi_all.h 226067 2011-10-06 19:15:51Z ken $\n */\n\n/*\n * SCSI general  interface description\n */\n\n#ifndef\t_SCSI_SCSI_ALL_H\n#define\t_SCSI_SCSI_ALL_H 1\n\n#include <sys/cdefs.h>\n#include <machine/stdarg.h>\n\n#ifdef _KERNEL\n/*\n * This is the number of seconds we wait for devices to settle after a SCSI\n * bus reset.\n */\nextern int scsi_delay;\n#endif /* _KERNEL */\n\n/*\n * SCSI command format\n */\n\n/*\n * Define dome bits that are in ALL (or a lot of) scsi commands\n */\n#define\tSCSI_CTL_LINK\t\t0x01\n#define\tSCSI_CTL_FLAG\t\t0x02\n#define\tSCSI_CTL_VENDOR\t\t0xC0\n#define\tSCSI_CMD_LUN\t\t0xA0\t/* these two should not be needed */\n#define\tSCSI_CMD_LUN_SHIFT\t5\t/* LUN in the cmd is no longer SCSI */\n\n#define\tSCSI_MAX_CDBLEN\t\t16\t/* \n\t\t\t\t\t * 16 byte commands are in the \n\t\t\t\t\t * SCSI-3 spec \n\t\t\t\t\t */\n#if defined(CAM_MAX_CDBLEN) && (CAM_MAX_CDBLEN < SCSI_MAX_CDBLEN)\n#error \"CAM_MAX_CDBLEN cannot be less than SCSI_MAX_CDBLEN\"\n#endif\n\n/* 6byte CDBs special case 0 length to be 256 */\n#define\tSCSI_CDB6_LEN(len)\t((len) == 0 ? 256 : len)\n\n/*\n * This type defines actions to be taken when a particular sense code is\n * received.  Right now, these flags are only defined to take up 16 bits,\n * but can be expanded in the future if necessary.\n */\ntypedef enum {\n\tSS_NOP      = 0x000000,\t/* Do nothing */\n\tSS_RETRY    = 0x010000,\t/* Retry the command */\n\tSS_FAIL     = 0x020000,\t/* Bail out */\n\tSS_START    = 0x030000,\t/* Send a Start Unit command to the device,\n\t\t\t\t * then retry the original command.\n\t\t\t\t */\n\tSS_TUR      = 0x040000,\t/* Send a Test Unit Ready command to the\n\t\t\t\t * device, then retry the original command.\n\t\t\t\t */\n\tSS_REQSENSE = 0x050000,\t/* Send a RequestSense command to the\n\t\t\t\t * device, then retry the original command.\n\t\t\t\t */\n\tSS_MASK     = 0xff0000\n} scsi_sense_action;\n\ntypedef enum {\n\tSSQ_NONE\t\t= 0x0000,\n\tSSQ_DECREMENT_COUNT\t= 0x0100,  /* Decrement the retry count */\n\tSSQ_MANY\t\t= 0x0200,  /* send lots of recovery commands */\n\tSSQ_RANGE\t\t= 0x0400,  /*\n\t\t\t\t\t    * This table entry represents the\n\t\t\t\t\t    * end of a range of ASCQs that\n\t\t\t\t\t    * have identical error actions\n\t\t\t\t\t    * and text.\n\t\t\t\t\t    */\n\tSSQ_PRINT_SENSE\t\t= 0x0800,\n\tSSQ_MASK\t\t= 0xff00\n} scsi_sense_action_qualifier;\n\n/* Mask for error status values */\n#define\tSS_ERRMASK\t0xff\n\n/* The default, retyable, error action */\n#define\tSS_RDEF\t\tSS_RETRY|SSQ_DECREMENT_COUNT|SSQ_PRINT_SENSE|EIO\n\n/* The retyable, error action, with table specified error code */\n#define\tSS_RET\t\tSS_RETRY|SSQ_DECREMENT_COUNT|SSQ_PRINT_SENSE\n\n/* Fatal error action, with table specified error code */\n#define\tSS_FATAL\tSS_FAIL|SSQ_PRINT_SENSE\n\nstruct scsi_generic\n{\n\tu_int8_t opcode;\n\tu_int8_t bytes[11];\n};\n\nstruct scsi_request_sense\n{\n\tu_int8_t opcode;\n\tu_int8_t byte2;\n#define\tSRS_DESC\t0x01\n\tu_int8_t unused[2];\n\tu_int8_t length;\n\tu_int8_t control;\n};\n\nstruct scsi_test_unit_ready\n{\n\tu_int8_t opcode;\n\tu_int8_t byte2;\n\tu_int8_t unused[3];\n\tu_int8_t control;\n};\n\nstruct scsi_receive_diag {\n\tuint8_t opcode;\n\tuint8_t byte2;\n#define SRD_PCV\t\t0x01\n\tuint8_t page_code;\n\tuint8_t length[2]; \n\tuint8_t control;\n};\n\nstruct scsi_send_diag {\n\tuint8_t opcode;\n\tuint8_t byte2;\n#define SSD_UNITOFFL\t\t\t\t0x01\n#define SSD_DEVOFFL\t\t\t\t0x02\n#define SSD_SELFTEST\t\t\t\t0x04\n#define SSD_PF\t\t\t\t\t0x10\n#define SSD_SELF_TEST_CODE_MASK\t\t\t0xE0\n#define SSD_SELF_TEST_CODE_SHIFT\t\t5\n#define\t\tSSD_SELF_TEST_CODE_NONE\t\t0x00\n#define\t\tSSD_SELF_TEST_CODE_BG_SHORT\t0x01\n#define\t\tSSD_SELF_TEST_CODE_BG_EXTENDED\t0x02\n#define\t\tSSD_SELF_TEST_CODE_BG_ABORT\t0x04\n#define\t\tSSD_SELF_TEST_CODE_FG_SHORT\t0x05\n#define\t\tSSD_SELF_TEST_CODE_FG_EXTENDED\t0x06\n\tuint8_t\treserved;\n\tuint8_t\tlength[2];\n\tuint8_t control;\n};\n\nstruct scsi_sense\n{\n\tu_int8_t opcode;\n\tu_int8_t byte2;\n\tu_int8_t unused[2];\n\tu_int8_t length;\n\tu_int8_t control;\n};\n\nstruct scsi_inquiry\n{\n\tu_int8_t opcode;\n\tu_int8_t byte2;\n#define\tSI_EVPD \t0x01\n#define\tSI_CMDDT\t0x02\n\tu_int8_t page_code;\n\tu_int8_t reserved;\n\tu_int8_t length;\n\tu_int8_t control;\n};\n\nstruct scsi_mode_sense_6\n{\n\tu_int8_t opcode;\n\tu_int8_t byte2;\n#define\tSMS_DBD\t\t\t\t0x08\n\tu_int8_t page;\n#define\tSMS_PAGE_CODE \t\t\t0x3F\n#define\tSMS_VENDOR_SPECIFIC_PAGE\t0x00\n#define\tSMS_DISCONNECT_RECONNECT_PAGE\t0x02\n#define\tSMS_FORMAT_DEVICE_PAGE\t\t0x03\n#define\tSMS_GEOMETRY_PAGE\t\t0x04\n#define\tSMS_CACHE_PAGE\t\t\t0x08\n#define\tSMS_PERIPHERAL_DEVICE_PAGE\t0x09\n#define\tSMS_CONTROL_MODE_PAGE\t\t0x0A\n#define\tSMS_PROTO_SPECIFIC_PAGE\t\t0x19\n#define\tSMS_INFO_EXCEPTIONS_PAGE\t0x1C\n#define\tSMS_ALL_PAGES_PAGE\t\t0x3F\n#define\tSMS_PAGE_CTRL_MASK\t\t0xC0\n#define\tSMS_PAGE_CTRL_CURRENT \t\t0x00\n#define\tSMS_PAGE_CTRL_CHANGEABLE \t0x40\n#define\tSMS_PAGE_CTRL_DEFAULT \t\t0x80\n#define\tSMS_PAGE_CTRL_SAVED \t\t0xC0\n\tu_int8_t subpage;\n#define\tSMS_SUBPAGE_PAGE_0\t\t0x00\n#define\tSMS_SUBPAGE_ALL\t\t\t0xff\n\tu_int8_t length;\n\tu_int8_t control;\n};\n\nstruct scsi_mode_sense_10\n{\n\tu_int8_t opcode;\n\tu_int8_t byte2;\t\t/* same bits as small version */\n#define\tSMS10_LLBAA\t\t\t0x10\n\tu_int8_t page; \t\t/* same bits as small version */\n\tu_int8_t subpage;\n\tu_int8_t unused[3];\n\tu_int8_t length[2];\n\tu_int8_t control;\n};\n\nstruct scsi_mode_select_6\n{\n\tu_int8_t opcode;\n\tu_int8_t byte2;\n#define\tSMS_SP\t0x01\n#define\tSMS_PF\t0x10\n\tu_int8_t unused[2];\n\tu_int8_t length;\n\tu_int8_t control;\n};\n\nstruct scsi_mode_select_10\n{\n\tu_int8_t opcode;\n\tu_int8_t byte2;\t\t/* same bits as small version */\n\tu_int8_t unused[5];\n\tu_int8_t length[2];\n\tu_int8_t control;\n};\n\n/*\n * When sending a mode select to a tape drive, the medium type must be 0.\n */\nstruct scsi_mode_hdr_6\n{\n\tu_int8_t datalen;\n\tu_int8_t medium_type;\n\tu_int8_t dev_specific;\n\tu_int8_t block_descr_len;\n};\n\nstruct scsi_mode_hdr_10\n{\n\tu_int8_t datalen[2];\n\tu_int8_t medium_type;\n\tu_int8_t dev_specific;\n\tu_int8_t reserved[2];\n\tu_int8_t block_descr_len[2];\n};\n\nstruct scsi_mode_block_descr\n{\n\tu_int8_t density_code;\n\tu_int8_t num_blocks[3];\n\tu_int8_t reserved;\n\tu_int8_t block_len[3];\n};\n\nstruct scsi_per_res_in\n{\n\tu_int8_t opcode;\n\tu_int8_t action;\n#define\tSPRI_RK\t0x00\n#define\tSPRI_RR\t0x01\n#define\tSPRI_RC\t0x02\n#define\tSPRI_RS\t0x03\n\tu_int8_t reserved[5];\n\tu_int8_t length[2];\n\tu_int8_t control;\n};\n\nstruct scsi_per_res_in_header\n{\n\tu_int8_t generation[4];\n\tu_int8_t length[4];\n};\n\nstruct scsi_per_res_key\n{\n\tu_int8_t key[8];\n};\n\nstruct scsi_per_res_in_keys\n{\n\tstruct scsi_per_res_in_header header;\n\tstruct scsi_per_res_key keys[0];\n};\n\nstruct scsi_per_res_cap\n{\n\tuint8_t length[2];\n\tuint8_t flags1;\n#define\tSPRI_CRH\t0x10\n#define\tSPRI_SIP_C\t0x08\n#define\tSPRI_ATP_C\t0x04\n#define\tSPRI_PTPL_C\t0x01\n\tuint8_t flags2;\n#define\tSPRI_TMV\t0x80\n#define\tSPRI_PTPL_A\t0x01\n\tuint8_t type_mask[2];\n#define\tSPRI_TM_WR_EX_AR\t0x8000\n#define\tSPRI_TM_EX_AC_RO\t0x4000\n#define\tSPRI_TM_WR_EX_RO\t0x2000\n#define\tSPRI_TM_EX_AC\t\t0x0800\n#define\tSPRI_TM_WR_EX\t\t0x0200\n#define\tSPRI_TM_EX_AC_AR\t0x0001\n\tuint8_t reserved[2];\n};\n\nstruct scsi_per_res_in_rsrv_data\n{\n\tuint8_t reservation[8];\n\tuint8_t obsolete1[4];\n\tuint8_t reserved;\n\tuint8_t scopetype;\n#define\tSPRT_WE    0x01\n#define\tSPRT_EA    0x03\n#define\tSPRT_WERO  0x05\n#define\tSPRT_EARO  0x06\n#define\tSPRT_WEAR  0x07\n#define\tSPRT_EAAR  0x08\n\tuint8_t obsolete2[2];\n};\n\nstruct scsi_per_res_in_rsrv\n{\n\tstruct scsi_per_res_in_header header;\n\tstruct scsi_per_res_in_rsrv_data data;\n};\n\nstruct scsi_per_res_out\n{\n\tu_int8_t opcode;\n\tu_int8_t action;\n#define\tSPRO_REGISTER\t\t0x00\n#define\tSPRO_RESERVE\t\t0x01\n#define\tSPRO_RELEASE\t\t0x02\n#define\tSPRO_CLEAR\t\t0x03\n#define\tSPRO_PREEMPT\t\t0x04\n#define\tSPRO_PRE_ABO\t\t0x05\n#define\tSPRO_REG_IGNO\t\t0x06\n#define\tSPRO_REG_MOVE\t\t0x07\n#define\tSPRO_ACTION_MASK\t0x1f\n\tu_int8_t scope_type;\n#define\tSPR_SCOPE_MASK\t\t0xf0\n#define\tSPR_LU_SCOPE\t\t0x00\n#define\tSPR_TYPE_MASK\t\t0x0f\n#define\tSPR_TYPE_WR_EX\t\t0x01\n#define\tSPR_TYPE_EX_AC\t\t0x03\n#define\tSPR_TYPE_WR_EX_RO\t0x05\n#define\tSPR_TYPE_EX_AC_RO\t0x06\n#define\tSPR_TYPE_WR_EX_AR\t0x07\n#define\tSPR_TYPE_EX_AC_AR\t0x08\n\tu_int8_t reserved[2];\n\tu_int8_t length[4];\n\tu_int8_t control;\n};\n\nstruct scsi_per_res_out_parms\n{\n\tstruct scsi_per_res_key res_key;\n\tu_int8_t serv_act_res_key[8];\n\tu_int8_t obsolete1[4];\n\tu_int8_t flags;\n#define\tSPR_SPEC_I_PT\t\t0x08\n#define\tSPR_ALL_TG_PT\t\t0x04\n#define\tSPR_APTPL\t\t0x01\n\tu_int8_t reserved1;\n\tu_int8_t obsolete2[2];\n};\n\n\nstruct scsi_log_sense\n{\n\tu_int8_t opcode;\n\tu_int8_t byte2;\n#define\tSLS_SP\t\t\t\t0x01\n#define\tSLS_PPC\t\t\t\t0x02\n\tu_int8_t page;\n#define\tSLS_PAGE_CODE \t\t\t0x3F\n#define\tSLS_ALL_PAGES_PAGE\t\t0x00\n#define\tSLS_OVERRUN_PAGE\t\t0x01\n#define\tSLS_ERROR_WRITE_PAGE\t\t0x02\n#define\tSLS_ERROR_READ_PAGE\t\t0x03\n#define\tSLS_ERROR_READREVERSE_PAGE\t0x04\n#define\tSLS_ERROR_VERIFY_PAGE\t\t0x05\n#define\tSLS_ERROR_NONMEDIUM_PAGE\t0x06\n#define\tSLS_ERROR_LASTN_PAGE\t\t0x07\n#define\tSLS_SELF_TEST_PAGE\t\t0x10\n#define\tSLS_IE_PAGE\t\t\t0x2f\n#define\tSLS_PAGE_CTRL_MASK\t\t0xC0\n#define\tSLS_PAGE_CTRL_THRESHOLD\t\t0x00\n#define\tSLS_PAGE_CTRL_CUMULATIVE\t0x40\n#define\tSLS_PAGE_CTRL_THRESH_DEFAULT\t0x80\n#define\tSLS_PAGE_CTRL_CUMUL_DEFAULT\t0xC0\n\tu_int8_t reserved[2];\n\tu_int8_t paramptr[2];\n\tu_int8_t length[2];\n\tu_int8_t control;\n};\n\nstruct scsi_log_select\n{\n\tu_int8_t opcode;\n\tu_int8_t byte2;\n/*\tSLS_SP\t\t\t\t0x01 */\n#define\tSLS_PCR\t\t\t\t0x02\n\tu_int8_t page;\n/*\tSLS_PAGE_CTRL_MASK\t\t0xC0 */\n/*\tSLS_PAGE_CTRL_THRESHOLD\t\t0x00 */\n/*\tSLS_PAGE_CTRL_CUMULATIVE\t0x40 */\n/*\tSLS_PAGE_CTRL_THRESH_DEFAULT\t0x80 */\n/*\tSLS_PAGE_CTRL_CUMUL_DEFAULT\t0xC0 */\n\tu_int8_t reserved[4];\n\tu_int8_t length[2];\n\tu_int8_t control;\n};\n\nstruct scsi_log_header\n{\n\tu_int8_t page;\n\tu_int8_t reserved;\n\tu_int8_t datalen[2];\n};\n\nstruct scsi_log_param_header {\n\tu_int8_t param_code[2];\n\tu_int8_t param_control;\n#define\tSLP_LP\t\t\t\t0x01\n#define\tSLP_LBIN\t\t\t0x02\n#define\tSLP_TMC_MASK\t\t\t0x0C\n#define\tSLP_TMC_ALWAYS\t\t\t0x00\n#define\tSLP_TMC_EQUAL\t\t\t0x04\n#define\tSLP_TMC_NOTEQUAL\t\t0x08\n#define\tSLP_TMC_GREATER\t\t\t0x0C\n#define\tSLP_ETC\t\t\t\t0x10\n#define\tSLP_TSD\t\t\t\t0x20\n#define\tSLP_DS\t\t\t\t0x40\n#define\tSLP_DU\t\t\t\t0x80\n\tu_int8_t param_len;\n};\n\nstruct scsi_control_page {\n\tu_int8_t page_code;\n\tu_int8_t page_length;\n\tu_int8_t rlec;\n#define\tSCP_RLEC\t\t\t0x01\t/*Report Log Exception Cond*/\n#define\tSCP_GLTSD\t\t\t0x02\t/*Global Logging target\n\t\t\t\t\t\t  save disable */\n#define\tSCP_DSENSE\t\t\t0x04\t/*Descriptor Sense */\n#define\tSCP_DPICZ\t\t\t0x08\t/*Disable Prot. Info Check\n\t\t\t\t\t\t  if Prot. Field is Zero */\n#define\tSCP_TMF_ONLY\t\t\t0x10\t/*TM Functions Only*/\n#define\tSCP_TST_MASK\t\t\t0xE0\t/*Task Set Type Mask*/\n#define\tSCP_TST_ONE\t\t\t0x00\t/*One Task Set*/\n#define\tSCP_TST_SEPARATE\t\t0x20\t/*Separate Task Sets*/\n\tu_int8_t queue_flags;\n#define\tSCP_QUEUE_ALG_MASK\t\t0xF0\n#define\tSCP_QUEUE_ALG_RESTRICTED\t0x00\n#define\tSCP_QUEUE_ALG_UNRESTRICTED\t0x10\n#define\tSCP_QUEUE_ERR\t\t\t0x02\t/*Queued I/O aborted for CACs*/\n#define\tSCP_QUEUE_DQUE\t\t\t0x01\t/*Queued I/O disabled*/\n\tu_int8_t eca_and_aen;\n#define\tSCP_EECA\t\t\t0x80\t/*Enable Extended CA*/\n#define\tSCP_RAENP\t\t\t0x04\t/*Ready AEN Permission*/\n#define\tSCP_UAAENP\t\t\t0x02\t/*UA AEN Permission*/\n#define\tSCP_EAENP\t\t\t0x01\t/*Error AEN Permission*/\n\tu_int8_t reserved;\n\tu_int8_t aen_holdoff_period[2];\n};\n\nstruct scsi_cache_page {\n\tu_int8_t page_code;\n#define\tSCHP_PAGE_SAVABLE\t\t0x80\t/* Page is savable */\n\tu_int8_t page_length;\n\tu_int8_t cache_flags;\n#define\tSCHP_FLAGS_WCE\t\t\t0x04\t/* Write Cache Enable */\n#define\tSCHP_FLAGS_MF\t\t\t0x02\t/* Multiplication factor */\n#define\tSCHP_FLAGS_RCD\t\t\t0x01\t/* Read Cache Disable */\n\tu_int8_t rw_cache_policy;\n\tu_int8_t dis_prefetch[2];\n\tu_int8_t min_prefetch[2];\n\tu_int8_t max_prefetch[2];\n\tu_int8_t max_prefetch_ceil[2];\n};\n\n/*\n * XXX KDM\n * Updated version of the cache page, as of SBC.  Update this to SBC-3 and\n * rationalize the two.\n */\nstruct scsi_caching_page {\n\tuint8_t page_code;\n#define\tSMS_CACHING_PAGE\t\t0x08\n\tuint8_t page_length;\n\tuint8_t flags1;\n#define\tSCP_IC\t\t0x80\n#define\tSCP_ABPF\t0x40\n#define\tSCP_CAP\t\t0x20\n#define\tSCP_DISC\t0x10\n#define\tSCP_SIZE\t0x08\n#define\tSCP_WCE\t\t0x04\n#define\tSCP_MF\t\t0x02\n#define\tSCP_RCD\t\t0x01\n\tuint8_t ret_priority;\n\tuint8_t disable_pf_transfer_len[2];\n\tuint8_t min_prefetch[2];\n\tuint8_t max_prefetch[2];\n\tuint8_t max_pf_ceiling[2];\n\tuint8_t flags2;\n#define\tSCP_FSW\t\t0x80\n#define\tSCP_LBCSS\t0x40\n#define\tSCP_DRA\t\t0x20\n#define\tSCP_VS1\t\t0x10\n#define\tSCP_VS2\t\t0x08\n\tuint8_t cache_segments;\n\tuint8_t cache_seg_size[2];\n\tuint8_t reserved;\n\tuint8_t non_cache_seg_size[3];\n};\n\nstruct scsi_info_exceptions_page {\n\tu_int8_t page_code;\n#define\tSIEP_PAGE_SAVABLE\t\t0x80\t/* Page is savable */\n\tu_int8_t page_length;\n\tu_int8_t info_flags;\n#define\tSIEP_FLAGS_PERF\t\t\t0x80\n#define\tSIEP_FLAGS_EBF\t\t\t0x20\n#define\tSIEP_FLAGS_EWASC\t\t0x10\n#define\tSIEP_FLAGS_DEXCPT\t\t0x08\n#define\tSIEP_FLAGS_TEST\t\t\t0x04\n#define\tSIEP_FLAGS_EBACKERR\t\t0x02\n#define\tSIEP_FLAGS_LOGERR\t\t0x01\n\tu_int8_t mrie;\n\tu_int8_t interval_timer[4];\n\tu_int8_t report_count[4];\n};\n\nstruct scsi_proto_specific_page {\n\tu_int8_t page_code;\n#define\tSPSP_PAGE_SAVABLE\t\t0x80\t/* Page is savable */\n\tu_int8_t page_length;\n\tu_int8_t protocol;\n#define\tSPSP_PROTO_FC\t\t\t0x00\n#define\tSPSP_PROTO_SPI\t\t\t0x01\n#define\tSPSP_PROTO_SSA\t\t\t0x02\n#define\tSPSP_PROTO_1394\t\t\t0x03\n#define\tSPSP_PROTO_RDMA\t\t\t0x04\n#define\tSPSP_PROTO_ISCSI\t\t0x05\n#define\tSPSP_PROTO_SAS\t\t\t0x06\n#define\tSPSP_PROTO_ADT\t\t\t0x07\n#define\tSPSP_PROTO_ATA\t\t\t0x08\n#define\tSPSP_PROTO_NONE\t\t\t0x0f\n};\n\nstruct scsi_reserve\n{\n\tu_int8_t opcode;\n\tu_int8_t byte2;\n#define\tSR_EXTENT\t0x01\n#define\tSR_ID_MASK\t0x0e\n#define\tSR_3RDPTY\t0x10\n#define\tSR_LUN_MASK\t0xe0\n\tu_int8_t resv_id;\n\tu_int8_t length[2];\n\tu_int8_t control;\n};\n\nstruct scsi_reserve_10 {\n\tuint8_t\topcode;\n\tuint8_t\tbyte2;\n#define\tSR10_3RDPTY\t0x10\n#define\tSR10_LONGID\t0x02\n#define\tSR10_EXTENT\t0x01\n\tuint8_t resv_id;\n\tuint8_t thirdparty_id;\n\tuint8_t reserved[3];\n\tuint8_t length[2];\n\tuint8_t control;\n};\n\n\nstruct scsi_release\n{\n\tu_int8_t opcode;\n\tu_int8_t byte2;\n\tu_int8_t resv_id;\n\tu_int8_t unused[1];\n\tu_int8_t length;\n\tu_int8_t control;\n};\n\nstruct scsi_release_10 {\n\tuint8_t opcode;\n\tuint8_t byte2;\n\tuint8_t resv_id;\n\tuint8_t thirdparty_id;\n\tuint8_t reserved[3];\n\tuint8_t length[2];\n\tuint8_t control;\n};\n\nstruct scsi_prevent\n{\n\tu_int8_t opcode;\n\tu_int8_t byte2;\n\tu_int8_t unused[2];\n\tu_int8_t how;\n\tu_int8_t control;\n};\n#define\tPR_PREVENT 0x01\n#define\tPR_ALLOW   0x00\n\nstruct scsi_sync_cache\n{\n\tu_int8_t opcode;\n\tu_int8_t byte2;\n#define\tSSC_IMMED\t0x02\n#define\tSSC_RELADR\t0x01\n\tu_int8_t begin_lba[4];\n\tu_int8_t reserved;\n\tu_int8_t lb_count[2];\n\tu_int8_t control;\t\n};\n\nstruct scsi_sync_cache_16\n{\n\tuint8_t opcode;\n\tuint8_t byte2;\n\tuint8_t begin_lba[8];\n\tuint8_t lb_count[4];\n\tuint8_t reserved;\n\tuint8_t control;\n};\n\nstruct scsi_format {\n\tuint8_t opcode;\n\tuint8_t byte2;\n#define\tSF_LONGLIST\t\t0x20\n#define\tSF_FMTDATA\t\t0x10\n#define\tSF_CMPLIST\t\t0x08\n#define\tSF_FORMAT_MASK\t\t0x07\n#define\tSF_FORMAT_BLOCK\t\t0x00\n#define\tSF_FORMAT_LONG_BLOCK\t0x03\n#define\tSF_FORMAT_BFI\t\t0x04\n#define\tSF_FORMAT_PHYS\t\t0x05\n\tuint8_t vendor;\n\tuint8_t interleave[2];\n\tuint8_t control;\n};\n\nstruct scsi_format_header_short {\n\tuint8_t reserved;\n#define\tSF_DATA_FOV\t0x80\n#define\tSF_DATA_DPRY\t0x40\n#define\tSF_DATA_DCRT\t0x20\n#define\tSF_DATA_STPF\t0x10\n#define\tSF_DATA_IP\t0x08\n#define\tSF_DATA_DSP\t0x04\n#define\tSF_DATA_IMMED\t0x02\n#define\tSF_DATA_VS\t0x01\n\tuint8_t byte2;\n\tuint8_t defect_list_len[2];\n};\n\nstruct scsi_format_header_long {\n\tuint8_t reserved;\n\tuint8_t byte2;\n\tuint8_t reserved2[2];\n\tuint8_t defect_list_len[4];\n};\n\nstruct scsi_changedef\n{\n\tu_int8_t opcode;\n\tu_int8_t byte2;\n\tu_int8_t unused1;\n\tu_int8_t how;\n\tu_int8_t unused[4];\n\tu_int8_t datalen;\n\tu_int8_t control;\n};\n\nstruct scsi_read_buffer\n{\n\tu_int8_t opcode;\n\tu_int8_t byte2;\n#define\tRWB_MODE\t\t0x07\n#define\tRWB_MODE_HDR_DATA\t0x00\n#define\tRWB_MODE_VENDOR\t\t0x01\n#define\tRWB_MODE_DATA\t\t0x02\n#define\tRWB_MODE_DOWNLOAD\t0x04\n#define\tRWB_MODE_DOWNLOAD_SAVE\t0x05\n        u_int8_t buffer_id;\n        u_int8_t offset[3];\n        u_int8_t length[3];\n        u_int8_t control;\n};\n\nstruct scsi_write_buffer\n{\n\tu_int8_t opcode;\n\tu_int8_t byte2;\n\tu_int8_t buffer_id;\n\tu_int8_t offset[3];\n\tu_int8_t length[3];\n\tu_int8_t control;\n};\n\nstruct scsi_rw_6\n{\n\tu_int8_t opcode;\n\tu_int8_t addr[3];\n/* only 5 bits are valid in the MSB address byte */\n#define\tSRW_TOPADDR\t0x1F\n\tu_int8_t length;\n\tu_int8_t control;\n};\n\nstruct scsi_rw_10\n{\n\tu_int8_t opcode;\n#define\tSRW10_RELADDR\t0x01\n/* EBP defined for WRITE(10) only */\n#define\tSRW10_EBP\t0x04\n#define\tSRW10_FUA\t0x08\n#define\tSRW10_DPO\t0x10\n\tu_int8_t byte2;\n\tu_int8_t addr[4];\n\tu_int8_t reserved;\n\tu_int8_t length[2];\n\tu_int8_t control;\n};\n\nstruct scsi_rw_12\n{\n\tu_int8_t opcode;\n#define\tSRW12_RELADDR\t0x01\n#define\tSRW12_FUA\t0x08\n#define\tSRW12_DPO\t0x10\n\tu_int8_t byte2;\n\tu_int8_t addr[4];\n\tu_int8_t length[4];\n\tu_int8_t reserved;\n\tu_int8_t control;\n};\n\nstruct scsi_rw_16\n{\n\tu_int8_t opcode;\n#define\tSRW16_RELADDR\t0x01\n#define\tSRW16_FUA\t0x08\n#define\tSRW16_DPO\t0x10\n\tu_int8_t byte2;\n\tu_int8_t addr[8];\n\tu_int8_t length[4];\n\tu_int8_t reserved;\n\tu_int8_t control;\n};\n\nstruct scsi_write_verify_10\n{\n\tuint8_t\topcode;\n\tuint8_t\tbyte2;\n#define\tSWV_BYTCHK\t\t0x02\n#define\tSWV_DPO\t\t\t0x10\n#define\tSWV_WRPROECT_MASK\t0xe0\n\tuint8_t\taddr[4];\n\tuint8_t\tgroup;\n\tuint8_t length[2];\n\tuint8_t\tcontrol;\n};\n\nstruct scsi_write_verify_12\n{\n\tuint8_t\topcode;\n\tuint8_t\tbyte2;\n\tuint8_t\taddr[4];\n\tuint8_t\tlength[4];\n\tuint8_t\tgroup;\n\tuint8_t\tcontrol;\n};\n\nstruct scsi_write_verify_16\n{\n\tuint8_t\topcode;\n\tuint8_t\tbyte2;\n\tuint8_t\taddr[8];\n\tuint8_t\tlength[4];\n\tuint8_t\tgroup;\n\tuint8_t\tcontrol;\n};\n\n\nstruct scsi_start_stop_unit\n{\n\tu_int8_t opcode;\n\tu_int8_t byte2;\n#define\tSSS_IMMED\t\t0x01\n\tu_int8_t reserved[2];\n\tu_int8_t how;\n#define\tSSS_START\t\t0x01\n#define\tSSS_LOEJ\t\t0x02\n#define\tSSS_PC_MASK\t\t0xf0\n#define\tSSS_PC_START_VALID\t0x00\n#define\tSSS_PC_ACTIVE\t\t0x10\n#define\tSSS_PC_IDLE\t\t0x20\n#define\tSSS_PC_STANDBY\t\t0x30\n#define\tSSS_PC_LU_CONTROL\t0x70\n#define\tSSS_PC_FORCE_IDLE_0\t0xa0\n#define\tSSS_PC_FORCE_STANDBY_0\t0xb0\n\tu_int8_t control;\n};\n\nstruct ata_pass_12 {\n\tu_int8_t opcode;\n\tu_int8_t protocol;\n#define\tAP_MULTI\t0xe0\n\tu_int8_t flags;\n#define\tAP_T_LEN\t0x03\n#define\tAP_BB\t\t0x04\n#define\tAP_T_DIR\t0x08\n#define\tAP_CK_COND\t0x20\n#define\tAP_OFFLINE\t0x60\n\tu_int8_t features;\n\tu_int8_t sector_count;\n\tu_int8_t lba_low;\n\tu_int8_t lba_mid;\n\tu_int8_t lba_high;\n\tu_int8_t device;\n\tu_int8_t command;\n\tu_int8_t reserved;\n\tu_int8_t control;\n};\n\nstruct scsi_maintenance_in\n{\n        uint8_t  opcode;\n        uint8_t  byte2;\n#define SERVICE_ACTION_MASK  0x1f\n#define SA_RPRT_TRGT_GRP     0x0a\n        uint8_t  reserved[4];\n\tuint8_t  length[4];\n\tuint8_t  reserved1;\n\tuint8_t  control;\n};\n\nstruct ata_pass_16 {\n\tu_int8_t opcode;\n\tu_int8_t protocol;\n#define\tAP_EXTEND\t0x01\n\tu_int8_t flags;\n\tu_int8_t features_ext;\n\tu_int8_t features;\n\tu_int8_t sector_count_ext;\n\tu_int8_t sector_count;\n\tu_int8_t lba_low_ext;\n\tu_int8_t lba_low;\n\tu_int8_t lba_mid_ext;\n\tu_int8_t lba_mid;\n\tu_int8_t lba_high_ext;\n\tu_int8_t lba_high;\n\tu_int8_t device;\n\tu_int8_t command;\n\tu_int8_t control;\n};\n\n#define\tSC_SCSI_1 0x01\n#define\tSC_SCSI_2 0x03\n\n/*\n * Opcodes\n */\n\n#define\tTEST_UNIT_READY\t\t0x00\n#define\tREQUEST_SENSE\t\t0x03\n#define\tREAD_6\t\t\t0x08\n#define\tWRITE_6\t\t\t0x0A\n#define\tINQUIRY\t\t\t0x12\n#define\tMODE_SELECT_6\t\t0x15\n#define\tMODE_SENSE_6\t\t0x1A\n#define\tSTART_STOP_UNIT\t\t0x1B\n#define\tSTART_STOP\t\t0x1B\n#define\tRESERVE      \t\t0x16\n#define\tRELEASE      \t\t0x17\n#define\tRECEIVE_DIAGNOSTIC\t0x1C\n#define\tSEND_DIAGNOSTIC\t\t0x1D\n#define\tPREVENT_ALLOW\t\t0x1E\n#define\tREAD_CAPACITY\t\t0x25\n#define\tREAD_10\t\t\t0x28\n#define\tWRITE_10\t\t0x2A\n#define\tPOSITION_TO_ELEMENT\t0x2B\n#define\tWRITE_VERIFY_10\t\t0x2E\n#define\tSYNCHRONIZE_CACHE\t0x35\n#define\tREAD_DEFECT_DATA_10\t0x37\n#define\tWRITE_BUFFER            0x3B\n#define\tREAD_BUFFER             0x3C\n#define\tCHANGE_DEFINITION\t0x40\n#define\tLOG_SELECT\t\t0x4C\n#define\tLOG_SENSE\t\t0x4D\n#define\tMODE_SELECT_10\t\t0x55\n#define\tRESERVE_10\t\t0x56\n#define\tRELEASE_10\t\t0x57\n#define\tMODE_SENSE_10\t\t0x5A\n#define\tPERSISTENT_RES_IN\t0x5E\n#define\tPERSISTENT_RES_OUT\t0x5F\n#define\tATA_PASS_16\t\t0x85\n#define\tREAD_16\t\t\t0x88\n#define\tWRITE_16\t\t0x8A\n#define\tWRITE_VERIFY_16\t\t0x8E\n#define\tSYNCHRONIZE_CACHE_16\t0x91\n#define\tSERVICE_ACTION_IN\t0x9E\n#define\tREPORT_LUNS\t\t0xA0\n#define\tATA_PASS_12\t\t0xA1\n#define\tMAINTENANCE_IN\t\t0xA3\n#define\tMAINTENANCE_OUT\t\t0xA4\n#define\tMOVE_MEDIUM     \t0xA5\n#define\tREAD_12\t\t\t0xA8\n#define\tWRITE_12\t\t0xAA\n#define\tWRITE_VERIFY_12\t\t0xAE\n#define\tREAD_ELEMENT_STATUS\t0xB8\n\n/* Maintenance In Service Action Codes */\n#define\tREPORT_IDENTIFYING_INFRMATION\t\t0x05\n#define\tREPORT_TARGET_PORT_GROUPS\t\t0x0A\n#define\tREPORT_ALIASES\t\t\t\t0x0B\n#define\tREPORT_SUPPORTED_OPERATION_CODES\t0x0C\n#define\tREPORT_SUPPORTED_TASK_MANAGEMENT_FUNCTIONS\t0x0D\n#define\tREPORT_PRIORITY\t\t\t\t0x0E\n#define\tREPORT_TIMESTAMP\t\t\t0x0F\n#define\tMANAGEMENT_PROTOCOL_IN\t\t\t0x10\n/* Maintenance Out Service Action Codes */\n#define\tSET_IDENTIFY_INFORMATION\t\t0x06\n#define\tSET_TARGET_PORT_GROUPS\t\t\t0x0A\n#define\tCHANGE_ALIASES\t\t\t\t0x0B\n#define\tSET_PRIORITY\t\t\t\t0x0E\n#define\tSET_TIMESTAMP\t\t\t\t0x0F\n#define\tMANGAEMENT_PROTOCOL_OUT\t\t\t0x10\n\n/*\n * Device Types\n */\n#define\tT_DIRECT\t0x00\n#define\tT_SEQUENTIAL\t0x01\n#define\tT_PRINTER\t0x02\n#define\tT_PROCESSOR\t0x03\n#define\tT_WORM\t\t0x04\n#define\tT_CDROM\t\t0x05\n#define\tT_SCANNER\t0x06\n#define\tT_OPTICAL \t0x07\n#define\tT_CHANGER\t0x08\n#define\tT_COMM\t\t0x09\n#define\tT_ASC0\t\t0x0a\n#define\tT_ASC1\t\t0x0b\n#define\tT_STORARRAY\t0x0c\n#define\tT_ENCLOSURE\t0x0d\n#define\tT_RBC\t\t0x0e\n#define\tT_OCRW\t\t0x0f\n#define\tT_OSD\t\t0x11\n#define\tT_ADC\t\t0x12\n#define\tT_NODEVICE\t0x1f\n#define\tT_ANY\t\t0xff\t/* Used in Quirk table matches */\n\n#define\tT_REMOV\t\t1\n#define\tT_FIXED\t\t0\n\n/*\n * This length is the initial inquiry length used by the probe code, as    \n * well as the legnth necessary for scsi_print_inquiry() to function \n * correctly.  If either use requires a different length in the future, \n * the two values should be de-coupled.\n */\n#define\tSHORT_INQUIRY_LENGTH\t36\n\nstruct scsi_inquiry_data\n{\n\tu_int8_t device;\n#define\tSID_TYPE(inq_data) ((inq_data)->device & 0x1f)\n#define\tSID_QUAL(inq_data) (((inq_data)->device & 0xE0) >> 5)\n#define\tSID_QUAL_LU_CONNECTED\t0x00\t/*\n\t\t\t\t\t * The specified peripheral device\n\t\t\t\t\t * type is currently connected to\n\t\t\t\t\t * logical unit.  If the target cannot\n\t\t\t\t\t * determine whether or not a physical\n\t\t\t\t\t * device is currently connected, it\n\t\t\t\t\t * shall also use this peripheral\n\t\t\t\t\t * qualifier when returning the INQUIRY\n\t\t\t\t\t * data.  This peripheral qualifier\n\t\t\t\t\t * does not mean that the device is\n\t\t\t\t\t * ready for access by the initiator.\n\t\t\t\t\t */\n#define\tSID_QUAL_LU_OFFLINE\t0x01\t/*\n\t\t\t\t\t * The target is capable of supporting\n\t\t\t\t\t * the specified peripheral device type\n\t\t\t\t\t * on this logical unit; however, the\n\t\t\t\t\t * physical device is not currently\n\t\t\t\t\t * connected to this logical unit.\n\t\t\t\t\t */\n#define\tSID_QUAL_RSVD\t\t0x02\n#define\tSID_QUAL_BAD_LU\t\t0x03\t/*\n\t\t\t\t\t * The target is not capable of\n\t\t\t\t\t * supporting a physical device on\n\t\t\t\t\t * this logical unit. For this\n\t\t\t\t\t * peripheral qualifier the peripheral\n\t\t\t\t\t * device type shall be set to 1Fh to\n\t\t\t\t\t * provide compatibility with previous\n\t\t\t\t\t * versions of SCSI. All other\n\t\t\t\t\t * peripheral device type values are\n\t\t\t\t\t * reserved for this peripheral\n\t\t\t\t\t * qualifier.\n\t\t\t\t\t */\n#define\tSID_QUAL_IS_VENDOR_UNIQUE(inq_data) ((SID_QUAL(inq_data) & 0x08) != 0)\n\tu_int8_t dev_qual2;\n#define\tSID_QUAL2\t0x7F\n#define\tSID_IS_REMOVABLE(inq_data) (((inq_data)->dev_qual2 & 0x80) != 0)\n\tu_int8_t version;\n#define\tSID_ANSI_REV(inq_data) ((inq_data)->version & 0x07)\n#define\t\tSCSI_REV_0\t\t0\n#define\t\tSCSI_REV_CCS\t\t1\n#define\t\tSCSI_REV_2\t\t2\n#define\t\tSCSI_REV_SPC\t\t3\n#define\t\tSCSI_REV_SPC2\t\t4\n#define\t\tSCSI_REV_SPC3\t\t5\n#define\t\tSCSI_REV_SPC4\t\t6\n\n#define\tSID_ECMA\t0x38\n#define\tSID_ISO\t\t0xC0\n\tu_int8_t response_format;\n#define\tSID_AENC\t0x80\n#define\tSID_TrmIOP\t0x40\n#define\tSID_NormACA\t0x20\n#define\tSID_HiSup\t0x10\n\tu_int8_t additional_length;\n#define\tSID_ADDITIONAL_LENGTH(iqd)\t\t\t\t\t\\\n\t((iqd)->additional_length +\t\t\t\t\t\\\n\t__offsetof(struct scsi_inquiry_data, additional_length) + 1)\n\tu_int8_t spc3_flags;\n#define\tSPC3_SID_PROTECT\t0x01\n#define\tSPC3_SID_3PC\t\t0x08\n#define\tSPC3_SID_TPGS_MASK\t0x30\n#define\tSPC3_SID_TPGS_IMPLICIT\t0x10\n#define\tSPC3_SID_TPGS_EXPLICIT\t0x20\n#define\tSPC3_SID_ACC\t\t0x40\n#define\tSPC3_SID_SCCS\t\t0x80\n\tu_int8_t spc2_flags;\n#define\tSPC2_SID_ADDR16\t\t0x01\n#define\tSPC2_SID_MChngr \t0x08\n#define\tSPC2_SID_MultiP \t0x10\n#define\tSPC2_SID_EncServ\t0x40\n#define\tSPC2_SID_BQueue\t\t0x80\n\n#define\tINQ_DATA_TQ_ENABLED(iqd)\t\t\t\t\\\n    ((SID_ANSI_REV(iqd) < SCSI_REV_SPC2)? ((iqd)->flags & SID_CmdQue) :\t\\\n    (((iqd)->flags & SID_CmdQue) && !((iqd)->spc2_flags & SPC2_SID_BQueue)) || \\\n    (!((iqd)->flags & SID_CmdQue) && ((iqd)->spc2_flags & SPC2_SID_BQueue)))\n\n\tu_int8_t flags;\n#define\tSID_SftRe\t0x01\n#define\tSID_CmdQue\t0x02\n#define\tSID_Linked\t0x08\n#define\tSID_Sync\t0x10\n#define\tSID_WBus16\t0x20\n#define\tSID_WBus32\t0x40\n#define\tSID_RelAdr\t0x80\n#define\tSID_VENDOR_SIZE   8\n\tchar\t vendor[SID_VENDOR_SIZE];\n#define\tSID_PRODUCT_SIZE  16\n\tchar\t product[SID_PRODUCT_SIZE];\n#define\tSID_REVISION_SIZE 4\n\tchar\t revision[SID_REVISION_SIZE];\n\t/*\n\t * The following fields were taken from SCSI Primary Commands - 2\n\t * (SPC-2) Revision 14, Dated 11 November 1999\n\t */\n#define\tSID_VENDOR_SPECIFIC_0_SIZE\t20\n\tu_int8_t vendor_specific0[SID_VENDOR_SPECIFIC_0_SIZE];\n\t/*\n\t * An extension of SCSI Parallel Specific Values\n\t */\n#define\tSID_SPI_IUS\t\t0x01\n#define\tSID_SPI_QAS\t\t0x02\n#define\tSID_SPI_CLOCK_ST\t0x00\n#define\tSID_SPI_CLOCK_DT\t0x04\n#define\tSID_SPI_CLOCK_DT_ST\t0x0C\n#define\tSID_SPI_MASK\t\t0x0F\n\tu_int8_t spi3data;\n\tu_int8_t reserved2;\n\t/*\n\t * Version Descriptors, stored 2 byte values.\n\t */\n\tu_int8_t version1[2];\n\tu_int8_t version2[2];\n\tu_int8_t version3[2];\n\tu_int8_t version4[2];\n\tu_int8_t version5[2];\n\tu_int8_t version6[2];\n\tu_int8_t version7[2];\n\tu_int8_t version8[2];\n\n\tu_int8_t reserved3[22];\n\n#define\tSID_VENDOR_SPECIFIC_1_SIZE\t160\n\tu_int8_t vendor_specific1[SID_VENDOR_SPECIFIC_1_SIZE];\n};\n\n/*\n * This structure is more suited to initiator operation, because the\n * maximum number of supported pages is already allocated.\n */\nstruct scsi_vpd_supported_page_list\n{\n\tu_int8_t device;\n\tu_int8_t page_code;\n#define\tSVPD_SUPPORTED_PAGE_LIST\t0x00\n#define\tSVPD_SUPPORTED_PAGES_HDR_LEN\t4\n\tu_int8_t reserved;\n\tu_int8_t length;\t/* number of VPD entries */\n#define\tSVPD_SUPPORTED_PAGES_SIZE\t251\n\tu_int8_t list[SVPD_SUPPORTED_PAGES_SIZE];\n};\n\n/*\n * This structure is more suited to target operation, because the\n * number of supported pages is left to the user to allocate.\n */\nstruct scsi_vpd_supported_pages\n{\n\tu_int8_t device;\n\tu_int8_t page_code;\n\tu_int8_t reserved;\n#define\tSVPD_SUPPORTED_PAGES\t0x00\n\tu_int8_t length;\n\tu_int8_t page_list[0];\n};\n\n\nstruct scsi_vpd_unit_serial_number\n{\n\tu_int8_t device;\n\tu_int8_t page_code;\n#define\tSVPD_UNIT_SERIAL_NUMBER\t0x80\n\tu_int8_t reserved;\n\tu_int8_t length; /* serial number length */\n#define\tSVPD_SERIAL_NUM_SIZE 251\n\tu_int8_t serial_num[SVPD_SERIAL_NUM_SIZE];\n};\n\nstruct scsi_vpd_device_id\n{\n\tu_int8_t device;\n\tu_int8_t page_code;\n#define\tSVPD_DEVICE_ID\t\t\t0x83\n#define\tSVPD_DEVICE_ID_MAX_SIZE\t\t252\n#define\tSVPD_DEVICE_ID_HDR_LEN \\\n    __offsetof(struct scsi_vpd_device_id, desc_list)\n\tu_int8_t length[2];\n\tu_int8_t desc_list[];\n};\n\nstruct scsi_vpd_id_descriptor\n{\n\tu_int8_t\tproto_codeset;\n#define\tSCSI_PROTO_FC\t\t0x00\n#define\tSCSI_PROTO_SPI\t\t0x01\n#define\tSCSI_PROTO_SSA\t\t0x02\n#define\tSCSI_PROTO_1394\t\t0x03\n#define\tSCSI_PROTO_RDMA\t\t0x04\n#define SCSI_PROTO_iSCSI\t0x05\n#define\tSCSI_PROTO_SAS\t\t0x06\n#define\tSVPD_ID_PROTO_SHIFT\t4\n#define\tSVPD_ID_CODESET_BINARY\t0x01\n#define\tSVPD_ID_CODESET_ASCII\t0x02\n#define\tSVPD_ID_CODESET_MASK\t0x0f\n\tu_int8_t\tid_type;\n#define\tSVPD_ID_PIV\t\t0x80\n#define\tSVPD_ID_ASSOC_LUN\t0x00\n#define\tSVPD_ID_ASSOC_PORT\t0x10\n#define\tSVPD_ID_ASSOC_TARGET\t0x20\n#define\tSVPD_ID_ASSOC_MASK\t0x30\n#define\tSVPD_ID_TYPE_VENDOR\t0x00\n#define\tSVPD_ID_TYPE_T10\t0x01\n#define\tSVPD_ID_TYPE_EUI64\t0x02\n#define\tSVPD_ID_TYPE_NAA\t0x03\n#define\tSVPD_ID_TYPE_RELTARG\t0x04\n#define\tSVPD_ID_TYPE_TPORTGRP\t0x05\n#define\tSVPD_ID_TYPE_LUNGRP\t0x06\n#define\tSVPD_ID_TYPE_MD5_LUN_ID\t0x07\n#define\tSVPD_ID_TYPE_SCSI_NAME\t0x08\n#define\tSVPD_ID_TYPE_MASK\t0x0f\n\tu_int8_t\treserved;\n\tu_int8_t\tlength;\n#define\tSVPD_DEVICE_ID_DESC_HDR_LEN \\\n    __offsetof(struct scsi_vpd_id_descriptor, identifier) \n\tu_int8_t\tidentifier[];\n};\n\nstruct scsi_vpd_id_t10\n{\n\tu_int8_t\tvendor[8];\n\tu_int8_t\tvendor_spec_id[0];\n};\n\nstruct scsi_vpd_id_eui64\n{\n\tu_int8_t\tieee_company_id[3];\n\tu_int8_t\textension_id[5];\n};\n\nstruct scsi_vpd_id_naa_basic\n{\n\tuint8_t naa;\n\t/* big endian, packed:\n\tuint8_t\tnaa : 4;\n\tuint8_t naa_desig : 4;\n\t*/\n#define\tSVPD_ID_NAA_NAA_SHIFT\t\t4\n#define\tSVPD_ID_NAA_IEEE_EXT\t\t0x02\n#define\tSVPD_ID_NAA_LOCAL_REG\t\t0x03\n#define\tSVPD_ID_NAA_IEEE_REG\t\t0x05\n#define\tSVPD_ID_NAA_IEEE_REG_EXT\t0x06\n\tuint8_t\tnaa_data[];\n};\n\nstruct scsi_vpd_id_naa_ieee_extended_id\n{\n\tuint8_t naa;\n\tuint8_t vendor_specific_id_a;\n\tuint8_t ieee_company_id[3];\n\tuint8_t vendor_specific_id_b[4];\n};\n\nstruct scsi_vpd_id_naa_local_reg\n{\n\tuint8_t naa;\n\tuint8_t local_value[7];\n};\n\nstruct scsi_vpd_id_naa_ieee_reg\n{\n\tuint8_t naa;\n\tuint8_t reg_value[7];\n\t/* big endian, packed:\n\tuint8_t naa_basic : 4;\n\tuint8_t ieee_company_id_0 : 4;\n\tuint8_t ieee_company_id_1[2];\n\tuint8_t ieee_company_id_2 : 4;\n\tuint8_t vendor_specific_id_0 : 4;\n\tuint8_t vendor_specific_id_1[4];\n\t*/\n};\n\nstruct scsi_vpd_id_naa_ieee_reg_extended\n{\n\tuint8_t naa;\n\tuint8_t reg_value[15];\n\t/* big endian, packed:\n\tuint8_t naa_basic : 4;\n\tuint8_t ieee_company_id_0 : 4;\n\tuint8_t ieee_company_id_1[2];\n\tuint8_t ieee_company_id_2 : 4;\n\tuint8_t vendor_specific_id_0 : 4;\n\tuint8_t vendor_specific_id_1[4];\n\tuint8_t vendor_specific_id_ext[8];\n\t*/\n};\n\nstruct scsi_vpd_id_rel_trgt_port_id\n{\n\tuint8_t obsolete[2];\n\tuint8_t rel_trgt_port_id[2];\n};\n\nstruct scsi_vpd_id_trgt_port_grp_id\n{\n\tuint8_t reserved[2];\n\tuint8_t trgt_port_grp[2];\n};\n\nstruct scsi_vpd_id_lun_grp_id\n{\n\tuint8_t reserved[2];\n\tuint8_t log_unit_grp[2];\n};\n\nstruct scsi_vpd_id_md5_lun_id\n{\n\tuint8_t lun_id[16];\n};\n\nstruct scsi_vpd_id_scsi_name\n{\n\tuint8_t name_string[256];\n};\n\nstruct scsi_service_action_in\n{\n\tuint8_t opcode;\n\tuint8_t service_action;\n\tuint8_t action_dependent[13];\n\tuint8_t control;\n};\n\nstruct scsi_read_capacity\n{\n\tu_int8_t opcode;\n\tu_int8_t byte2;\n#define\tSRC_RELADR\t0x01\n\tu_int8_t addr[4];\n\tu_int8_t unused[2];\n\tu_int8_t pmi;\n#define\tSRC_PMI\t\t0x01\n\tu_int8_t control;\n};\n\nstruct scsi_read_capacity_16\n{\n\tuint8_t opcode;\n#define\tSRC16_SERVICE_ACTION\t0x10\n\tuint8_t service_action;\n\tuint8_t addr[8];\n\tuint8_t alloc_len[4];\n#define\tSRC16_PMI\t\t0x01\n#define\tSRC16_RELADR\t\t0x02\n\tuint8_t reladr;\n\tuint8_t control;\n};\n\nstruct scsi_read_capacity_data\n{\n\tu_int8_t addr[4];\n\tu_int8_t length[4];\n};\n\nstruct scsi_read_capacity_data_long\n{\n\tuint8_t addr[8];\n\tuint8_t length[4];\n};\n\nstruct scsi_report_luns\n{\n\tuint8_t opcode;\n\tuint8_t reserved1;\n#define\tRPL_REPORT_DEFAULT\t0x00\n#define\tRPL_REPORT_WELLKNOWN\t0x01\n#define\tRPL_REPORT_ALL\t\t0x02\n\tuint8_t select_report;\n\tuint8_t reserved2[3];\n\tuint8_t length[4];\n\tuint8_t reserved3;\n\tuint8_t control;\n};\n\nstruct scsi_report_luns_lundata {\n\tuint8_t lundata[8];\n#define\tRPL_LUNDATA_PERIPH_BUS_MASK\t0x3f\n#define\tRPL_LUNDATA_FLAT_LUN_MASK\t0x3f\n#define\tRPL_LUNDATA_FLAT_LUN_BITS\t0x06\n#define\tRPL_LUNDATA_LUN_TARG_MASK\t0x3f\n#define\tRPL_LUNDATA_LUN_BUS_MASK\t0xe0\n#define\tRPL_LUNDATA_LUN_LUN_MASK\t0x1f\n#define\tRPL_LUNDATA_EXT_LEN_MASK\t0x30\n#define\tRPL_LUNDATA_EXT_EAM_MASK\t0x0f\n#define\tRPL_LUNDATA_EXT_EAM_WK\t\t0x01\n#define\tRPL_LUNDATA_EXT_EAM_NOT_SPEC\t0x0f\n#define\tRPL_LUNDATA_ATYP_MASK\t0xc0\t/* MBZ for type 0 lun */\n#define\tRPL_LUNDATA_ATYP_PERIPH\t0x00\n#define\tRPL_LUNDATA_ATYP_FLAT\t0x40\n#define\tRPL_LUNDATA_ATYP_LUN\t0x80\n#define\tRPL_LUNDATA_ATYP_EXTLUN\t0xc0\n};\n\nstruct scsi_report_luns_data {\n\tu_int8_t length[4];\t/* length of LUN inventory, in bytes */\n\tu_int8_t reserved[4];\t/* unused */\n\t/*\n\t * LUN inventory- we only support the type zero form for now.\n\t */\n\tstruct scsi_report_luns_lundata luns[0];\n};\n\nstruct scsi_target_group\n{\n\tuint8_t opcode;\n\tuint8_t service_action;\n#define\tSTG_PDF_LENGTH\t\t0x00\n#define\tRPL_PDF_EXTENDED\t0x20\n\tuint8_t reserved1[4];\n\tuint8_t length[4];\n\tuint8_t reserved2;\n\tuint8_t control;\n};\n\nstruct scsi_target_port_descriptor {\n\tuint8_t\treserved[2];\n\tuint8_t\trelative_target_port_identifier[2];\n\tuint8_t desc_list[];\n};\n\nstruct scsi_target_port_group_descriptor {\n\tuint8_t\tpref_state;\n#define\tTPG_PRIMARY\t\t\t\t0x80\n#define\tTPG_ASYMMETRIC_ACCESS_STATE_MASK\t0xf\n#define\tTPG_ASYMMETRIC_ACCESS_OPTIMIZED\t\t0x0\n#define\tTPG_ASYMMETRIC_ACCESS_NONOPTIMIZED\t0x1\n#define\tTPG_ASYMMETRIC_ACCESS_STANDBY\t\t0x2\n#define\tTPG_ASYMMETRIC_ACCESS_UNAVAILABLE\t0x3\n#define\tTPG_ASYMMETRIC_ACCESS_LBA_DEPENDENT\t0x4\n#define\tTPG_ASYMMETRIC_ACCESS_OFFLINE\t\t0xE\n#define\tTPG_ASYMMETRIC_ACCESS_TRANSITIONING\t0xF\n\tuint8_t support;\n#define\tTPG_AO_SUP\t0x01\n#define\tTPG_AN_SUP\t0x02\n#define\tTPG_S_SUP\t0x04\n#define\tTPG_U_SUP\t0x08\n#define\tTPG_LBD_SUP\t0x10\n#define\tTPG_O_SUP\t0x40\n#define\tTPG_T_SUP\t0x80\n\tuint8_t target_port_group[2];\n\tuint8_t reserved;\n\tuint8_t status;\n#define TPG_UNAVLBL      0\n#define TPG_SET_BY_STPG  0x01\n#define TPG_IMPLICIT     0x02\n\tuint8_t vendor_specific;\n\tuint8_t\ttarget_port_count;\n\tstruct scsi_target_port_descriptor descriptors[];\n};\n\nstruct scsi_target_group_data {\n\tuint8_t length[4];\t/* length of returned data, in bytes */\n\tstruct scsi_target_port_group_descriptor groups[];\n};\n\nstruct scsi_target_group_data_extended {\n\tuint8_t length[4];\t/* length of returned data, in bytes */\n\tuint8_t format_type;\t/* STG_PDF_LENGTH or RPL_PDF_EXTENDED */\n\tuint8_t\timplicit_transition_time;\n\tuint8_t reserved[2];\n\tstruct scsi_target_port_group_descriptor groups[];\n};\n\n\ntypedef enum {\n\tSSD_TYPE_NONE,\n\tSSD_TYPE_FIXED,\n\tSSD_TYPE_DESC\n} scsi_sense_data_type;\n\ntypedef enum {\n\tSSD_ELEM_NONE,\n\tSSD_ELEM_SKIP,\n\tSSD_ELEM_DESC,\n\tSSD_ELEM_SKS,\n\tSSD_ELEM_COMMAND,\n\tSSD_ELEM_INFO,\n\tSSD_ELEM_FRU,\n\tSSD_ELEM_STREAM,\n\tSSD_ELEM_MAX\n} scsi_sense_elem_type;\n\n\nstruct scsi_sense_data\n{\n\tuint8_t error_code;\n\t/*\n\t * SPC-4 says that the maximum length of sense data is 252 bytes.\n\t * So this structure is exactly 252 bytes log.\n\t */\n#define\tSSD_FULL_SIZE 252\n\tuint8_t sense_buf[SSD_FULL_SIZE - 1];\n\t/*\n\t * XXX KDM is this still a reasonable minimum size?\n\t */\n#define\tSSD_MIN_SIZE 18\n\t/*\n\t * Maximum value for the extra_len field in the sense data.\n\t */\n#define\tSSD_EXTRA_MAX 244\n};\n\n/*\n * Fixed format sense data.\n */\nstruct scsi_sense_data_fixed\n{\n\tu_int8_t error_code;\n#define\tSSD_ERRCODE\t\t\t0x7F\n#define\t\tSSD_CURRENT_ERROR\t0x70\n#define\t\tSSD_DEFERRED_ERROR\t0x71\n#define\tSSD_ERRCODE_VALID\t0x80\t\n\tu_int8_t segment;\n\tu_int8_t flags;\n#define\tSSD_KEY\t\t\t\t0x0F\n#define\t\tSSD_KEY_NO_SENSE\t0x00\n#define\t\tSSD_KEY_RECOVERED_ERROR\t0x01\n#define\t\tSSD_KEY_NOT_READY\t0x02\n#define\t\tSSD_KEY_MEDIUM_ERROR\t0x03\n#define\t\tSSD_KEY_HARDWARE_ERROR\t0x04\n#define\t\tSSD_KEY_ILLEGAL_REQUEST\t0x05\n#define\t\tSSD_KEY_UNIT_ATTENTION\t0x06\n#define\t\tSSD_KEY_DATA_PROTECT\t0x07\n#define\t\tSSD_KEY_BLANK_CHECK\t0x08\n#define\t\tSSD_KEY_Vendor_Specific\t0x09\n#define\t\tSSD_KEY_COPY_ABORTED\t0x0a\n#define\t\tSSD_KEY_ABORTED_COMMAND\t0x0b\t\t\n#define\t\tSSD_KEY_EQUAL\t\t0x0c\n#define\t\tSSD_KEY_VOLUME_OVERFLOW\t0x0d\n#define\t\tSSD_KEY_MISCOMPARE\t0x0e\n#define\t\tSSD_KEY_COMPLETED\t0x0f\t\t\t\n#define\tSSD_ILI\t\t0x20\n#define\tSSD_EOM\t\t0x40\n#define\tSSD_FILEMARK\t0x80\n\tu_int8_t info[4];\n\tu_int8_t extra_len;\n\tu_int8_t cmd_spec_info[4];\n\tu_int8_t add_sense_code;\n\tu_int8_t add_sense_code_qual;\n\tu_int8_t fru;\n\tu_int8_t sense_key_spec[3];\n#define\tSSD_SCS_VALID\t\t0x80\n#define\tSSD_FIELDPTR_CMD\t0x40\n#define\tSSD_BITPTR_VALID\t0x08\n#define\tSSD_BITPTR_VALUE\t0x07\n\tu_int8_t extra_bytes[14];\n#define\tSSD_FIXED_IS_PRESENT(sense, length, field) \t\t\t\\\n\t((length >= (offsetof(struct scsi_sense_data_fixed, field) +\t\\\n\tsizeof(sense->field))) ? 1 :0)\n#define\tSSD_FIXED_IS_FILLED(sense, field) \t\t\t\t\\\n\t((((offsetof(struct scsi_sense_data_fixed, field) +\t\t\\\n\tsizeof(sense->field)) -\t\t\t\t\t\t\\\n\t(offsetof(struct scsi_sense_data_fixed, extra_len) +\t\t\\\n\tsizeof(sense->extra_len))) <= sense->extra_len) ? 1 : 0)\n};\n\n/*\n * Descriptor format sense data definitions.\n * Introduced in SPC-3.\n */\nstruct scsi_sense_data_desc \n{\n\tuint8_t\terror_code;\n#define\tSSD_DESC_CURRENT_ERROR\t0x72\n#define\tSSD_DESC_DEFERRED_ERROR\t0x73\n\tuint8_t sense_key;\n\tuint8_t\tadd_sense_code;\n\tuint8_t\tadd_sense_code_qual;\n\tuint8_t\treserved[3];\n\t/*\n\t * Note that SPC-4, section 4.5.2.1 says that the extra_len field\n\t * must be less than or equal to 244.\n\t */\n\tuint8_t\textra_len;\n\tuint8_t\tsense_desc[0];\n#define\tSSD_DESC_IS_PRESENT(sense, length, field) \t\t\t\\\n\t((length >= (offsetof(struct scsi_sense_data_desc, field) +\t\\\n\tsizeof(sense->field))) ? 1 :0)\n};\n\nstruct scsi_sense_desc_header\n{\n\tuint8_t desc_type;\n\tuint8_t length;\n};\n/*\n * The information provide in the Information descriptor is device type or\n * command specific information, and defined in a command standard.\n *\n * Note that any changes to the field names or positions in this structure,\n * even reserved fields, should be accompanied by an examination of the\n * code in ctl_set_sense() that uses them.\n *\n * Maximum descriptors allowed: 1 (as of SPC-4)\n */\nstruct scsi_sense_info\n{\n\tuint8_t\tdesc_type;\n#define\tSSD_DESC_INFO\t0x00\n\tuint8_t\tlength;\n\tuint8_t\tbyte2;\n#define\tSSD_INFO_VALID\t0x80\n\tuint8_t\treserved;\n\tuint8_t\tinfo[8];\n};\n\n/*\n * Command-specific information depends on the command for which the\n * reported condition occured.\n *\n * Note that any changes to the field names or positions in this structure,\n * even reserved fields, should be accompanied by an examination of the\n * code in ctl_set_sense() that uses them.\n *\n * Maximum descriptors allowed: 1 (as of SPC-4)\n */\nstruct scsi_sense_command\n{\n\tuint8_t\tdesc_type;\n#define\tSSD_DESC_COMMAND\t0x01\n\tuint8_t\tlength;\n\tuint8_t\treserved[2];\n\tuint8_t\tcommand_info[8];\n};\n\n/*\n * Sense key specific descriptor.  The sense key specific data format\n * depends on the sense key in question.\n *\n * Maximum descriptors allowed: 1 (as of SPC-4)\n */\nstruct scsi_sense_sks\n{\n\tuint8_t\tdesc_type;\n#define\tSSD_DESC_SKS\t\t0x02\n\tuint8_t\tlength;\n\tuint8_t reserved1[2];\n\tuint8_t\tsense_key_spec[3];\n#define\tSSD_SKS_VALID\t\t0x80\n\tuint8_t reserved2;\n};\n\n/*\n * This is used for the Illegal Request sense key (0x05) only.\n */\nstruct scsi_sense_sks_field\n{\n\tuint8_t\tbyte0;\n#define\tSSD_SKS_FIELD_VALID\t0x80\n#define\tSSD_SKS_FIELD_CMD\t0x40\n#define\tSSD_SKS_BPV\t\t0x08\n#define\tSSD_SKS_BIT_VALUE\t0x07\n\tuint8_t\tfield[2];\n};\n\n\n/* \n * This is used for the Hardware Error (0x04), Medium Error (0x03) and\n * Recovered Error (0x01) sense keys.\n */\nstruct scsi_sense_sks_retry\n{\n\tuint8_t byte0;\n#define\tSSD_SKS_RETRY_VALID\t0x80\n\tuint8_t actual_retry_count[2];\n};\n\n/*\n * Used with the NO Sense (0x00) or Not Ready (0x02) sense keys.\n */\nstruct scsi_sense_sks_progress\n{\n\tuint8_t byte0;\n#define\tSSD_SKS_PROGRESS_VALID\t0x80\n\tuint8_t progress[2];\n#define\tSSD_SKS_PROGRESS_DENOM\t0x10000\n};\n\n/*\n * Used with the Copy Aborted (0x0a) sense key.\n */\nstruct scsi_sense_sks_segment\n{\n\tuint8_t byte0;\n#define\tSSD_SKS_SEGMENT_VALID\t0x80\n#define\tSSD_SKS_SEGMENT_SD\t0x20\n#define\tSSD_SKS_SEGMENT_BPV\t0x08\n#define\tSSD_SKS_SEGMENT_BITPTR\t0x07\n\tuint8_t field[2];\n};\n\n/*\n * Used with the Unit Attention (0x06) sense key.\n *\n * This is currently used to indicate that the unit attention condition\n * queue has overflowed (when the overflow bit is set).\n */\nstruct scsi_sense_sks_overflow\n{\n\tuint8_t byte0;\n#define\tSSD_SKS_OVERFLOW_VALID\t0x80\n#define\tSSD_SKS_OVERFLOW_SET\t0x01\n\tuint8_t\treserved[2];\n};\n\n/*\n * This specifies which component is associated with the sense data.  There\n * is no standard meaning for the fru value.\n *\n * Maximum descriptors allowed: 1 (as of SPC-4)\n */\nstruct scsi_sense_fru\n{\n\tuint8_t\tdesc_type;\n#define\tSSD_DESC_FRU\t\t0x03\n\tuint8_t\tlength;\n\tuint8_t reserved;\n\tuint8_t fru;\n};\n\n/*\n * Used for Stream commands, defined in SSC-4.\n *\n * Maximum descriptors allowed: 1 (as of SPC-4)\n */\n \nstruct scsi_sense_stream\n{\n\tuint8_t\tdesc_type;\n#define\tSSD_DESC_STREAM\t\t0x04\n\tuint8_t\tlength;\n\tuint8_t\treserved;\n\tuint8_t\tbyte3;\n#define\tSSD_DESC_STREAM_FM\t0x80\n#define\tSSD_DESC_STREAM_EOM\t0x40\n#define\tSSD_DESC_STREAM_ILI\t0x20\n};\n\n/*\n * Used for Block commands, defined in SBC-3.\n *\n * This is currently (as of SBC-3) only used for the Incorrect Length\n * Indication (ILI) bit, which says that the data length requested in the\n * READ LONG or WRITE LONG command did not match the length of the logical\n * block.\n *\n * Maximum descriptors allowed: 1 (as of SPC-4)\n */\nstruct scsi_sense_block\n{\n\tuint8_t\tdesc_type;\n#define\tSSD_DESC_BLOCK\t\t0x05\n\tuint8_t\tlength;\n\tuint8_t\treserved;\n\tuint8_t\tbyte3;\n#define\tSSD_DESC_BLOCK_ILI\t0x20\n};\n\n/*\n * Used for Object-Based Storage Devices (OSD-3).\n *\n * Maximum descriptors allowed: 1 (as of SPC-4)\n */\nstruct scsi_sense_osd_objid\n{\n\tuint8_t\tdesc_type;\n#define\tSSD_DESC_OSD_OBJID\t0x06\n\tuint8_t\tlength;\n\tuint8_t\treserved[6];\n\t/*\n\t * XXX KDM provide the bit definitions here?  There are a lot of\n\t * them, and we don't have an OSD driver yet.\n\t */\n\tuint8_t\tnot_init_cmds[4];\n\tuint8_t\tcompleted_cmds[4];\n\tuint8_t\tpartition_id[8];\n\tuint8_t\tobject_id[8];\n};\n\n/*\n * Used for Object-Based Storage Devices (OSD-3).\n *\n * Maximum descriptors allowed: 1 (as of SPC-4)\n */\nstruct scsi_sense_osd_integrity\n{\n\tuint8_t\tdesc_type;\n#define\tSSD_DESC_OSD_INTEGRITY\t0x07\n\tuint8_t\tlength;\n\tuint8_t\tinteg_check_val[32];\n};\n\n/*\n * Used for Object-Based Storage Devices (OSD-3).\n *\n * Maximum descriptors allowed: 1 (as of SPC-4)\n */\nstruct scsi_sense_osd_attr_id\n{\n\tuint8_t\tdesc_type;\n#define\tSSD_DESC_OSD_ATTR_ID\t0x08\n\tuint8_t\tlength;\n\tuint8_t\treserved[2];\n\tuint8_t\tattr_desc[0];\n};\n\n/*\n * Used with Sense keys No Sense (0x00) and Not Ready (0x02).\n *\n * Maximum descriptors allowed: 32 (as of SPC-4)\n */\nstruct scsi_sense_progress\n{\n\tuint8_t\tdesc_type;\n#define\tSSD_DESC_PROGRESS\t0x0a\n\tuint8_t\tlength;\n\tuint8_t\tsense_key;\n\tuint8_t\tadd_sense_code;\n\tuint8_t\tadd_sense_code_qual;\n\tuint8_t reserved;\n\tuint8_t\tprogress[2];\n};\n\n/*\n * This is typically forwarded as the result of an EXTENDED COPY command.\n *\n * Maximum descriptors allowed: 2 (as of SPC-4)\n */\nstruct scsi_sense_forwarded\n{\n\tuint8_t\tdesc_type;\n#define\tSSD_DESC_FORWARDED\t0x0c\n\tuint8_t\tlength;\n\tuint8_t\tbyte2;\n#define\tSSD_FORWARDED_FSDT\t0x80\n#define\tSSD_FORWARDED_SDS_MASK\t0x0f\n#define\tSSD_FORWARDED_SDS_UNK\t0x00\n#define\tSSD_FORWARDED_SDS_EXSRC\t0x01\n#define\tSSD_FORWARDED_SDS_EXDST\t0x02\n};\n\n/*\n * Vendor-specific sense descriptor.  The desc_type field will be in the\n * range bewteen MIN and MAX inclusive.\n */\nstruct scsi_sense_vendor\n{\n\tuint8_t\tdesc_type;\n#define\tSSD_DESC_VENDOR_MIN\t0x80\n#define\tSSD_DESC_VENDOR_MAX\t0xff\n\tuint8_t length;\n\tuint8_t\tdata[0];\n};\n\nstruct scsi_mode_header_6\n{\n\tu_int8_t data_length;\t/* Sense data length */\n\tu_int8_t medium_type;\n\tu_int8_t dev_spec;\n\tu_int8_t blk_desc_len;\n};\n\nstruct scsi_mode_header_10\n{\n\tu_int8_t data_length[2];/* Sense data length */\n\tu_int8_t medium_type;\n\tu_int8_t dev_spec;\n\tu_int8_t unused[2];\n\tu_int8_t blk_desc_len[2];\n};\n\nstruct scsi_mode_page_header\n{\n\tu_int8_t page_code;\n#define\tSMPH_PS\t\t0x80\n#define\tSMPH_SPF\t0x40\n#define\tSMPH_PC_MASK\t0x3f\n\tu_int8_t page_length;\n};\n\nstruct scsi_mode_page_header_sp\n{\n\tuint8_t page_code;\n\tuint8_t subpage;\n\tuint8_t page_length[2];\n};\n\n\nstruct scsi_mode_blk_desc\n{\n\tu_int8_t density;\n\tu_int8_t nblocks[3];\n\tu_int8_t reserved;\n\tu_int8_t blklen[3];\n};\n\n#define\tSCSI_DEFAULT_DENSITY\t0x00\t/* use 'default' density */\n#define\tSCSI_SAME_DENSITY\t0x7f\t/* use 'same' density- >= SCSI-2 only */\n\n\n/*\n * Status Byte\n */\n#define\tSCSI_STATUS_OK\t\t\t0x00\n#define\tSCSI_STATUS_CHECK_COND\t\t0x02\n#define\tSCSI_STATUS_COND_MET\t\t0x04\n#define\tSCSI_STATUS_BUSY\t\t0x08\n#define\tSCSI_STATUS_INTERMED\t\t0x10\n#define\tSCSI_STATUS_INTERMED_COND_MET\t0x14\n#define\tSCSI_STATUS_RESERV_CONFLICT\t0x18\n#define\tSCSI_STATUS_CMD_TERMINATED\t0x22\t/* Obsolete in SAM-2 */\n#define\tSCSI_STATUS_QUEUE_FULL\t\t0x28\n#define\tSCSI_STATUS_ACA_ACTIVE\t\t0x30\n#define\tSCSI_STATUS_TASK_ABORTED\t0x40\n\nstruct scsi_inquiry_pattern {\n\tu_int8_t   type;\n\tu_int8_t   media_type;\n#define\tSIP_MEDIA_REMOVABLE\t0x01\n#define\tSIP_MEDIA_FIXED\t\t0x02\n\tconst char *vendor;\n\tconst char *product;\n\tconst char *revision;\n}; \n\nstruct scsi_static_inquiry_pattern {\n\tu_int8_t   type;\n\tu_int8_t   media_type;\n\tchar       vendor[SID_VENDOR_SIZE+1];\n\tchar       product[SID_PRODUCT_SIZE+1];\n\tchar       revision[SID_REVISION_SIZE+1];\n};\n\nstruct scsi_sense_quirk_entry {\n\tstruct scsi_inquiry_pattern\tinq_pat;\n\tint\t\t\t\tnum_sense_keys;\n\tint\t\t\t\tnum_ascs;\n\tstruct sense_key_table_entry\t*sense_key_info;\n\tstruct asc_table_entry\t\t*asc_info;\n};\n\nstruct sense_key_table_entry {\n\tu_int8_t    sense_key;\n\tu_int32_t   action;\n\tconst char *desc;\n};\n\nstruct asc_table_entry {\n\tu_int8_t    asc;\n\tu_int8_t    ascq;\n\tu_int32_t   action;\n\tconst char *desc;\n};\n\nstruct op_table_entry {\n\tu_int8_t    opcode;\n\tu_int32_t   opmask;\n\tconst char  *desc;\n};\n\nstruct scsi_op_quirk_entry {\n\tstruct scsi_inquiry_pattern\tinq_pat;\n\tint\t\t\t\tnum_ops;\n\tstruct op_table_entry\t\t*op_table;\n};\n\ntypedef enum {\n\tSSS_FLAG_NONE\t\t= 0x00,\n\tSSS_FLAG_PRINT_COMMAND\t= 0x01\n} scsi_sense_string_flags;\n\nstruct ccb_scsiio;\nstruct cam_periph;\nunion  ccb;\n#ifndef _KERNEL\nstruct cam_device;\n#endif\n\nextern const char *scsi_sense_key_text[];\n\nstruct sbuf;\n\n__BEGIN_DECLS\nvoid scsi_sense_desc(int sense_key, int asc, int ascq,\n\t\t     struct scsi_inquiry_data *inq_data,\n\t\t     const char **sense_key_desc, const char **asc_desc);\nscsi_sense_action scsi_error_action(struct ccb_scsiio* csio,\n\t\t\t\t    struct scsi_inquiry_data *inq_data,\n\t\t\t\t    u_int32_t sense_flags);\nconst char *\tscsi_status_string(struct ccb_scsiio *csio);\n\nvoid scsi_desc_iterate(struct scsi_sense_data_desc *sense, u_int sense_len,\n\t\t       int (*iter_func)(struct scsi_sense_data_desc *sense,\n\t\t\t\t\tu_int, struct scsi_sense_desc_header *,\n\t\t\t\t\tvoid *), void *arg);\nuint8_t *scsi_find_desc(struct scsi_sense_data_desc *sense, u_int sense_len,\n\t\t\tuint8_t desc_type);\nvoid scsi_set_sense_data(struct scsi_sense_data *sense_data, \n\t\t\t scsi_sense_data_type sense_format, int current_error,\n\t\t\t int sense_key, int asc, int ascq, ...) ;\nvoid scsi_set_sense_data_va(struct scsi_sense_data *sense_data,\n\t\t\t    scsi_sense_data_type sense_format,\n\t\t\t    int current_error, int sense_key, int asc,\n\t\t\t    int ascq, va_list ap);\nint scsi_get_sense_info(struct scsi_sense_data *sense_data, u_int sense_len,\n\t\t\tuint8_t info_type, uint64_t *info,\n\t\t\tint64_t *signed_info);\nint scsi_get_sks(struct scsi_sense_data *sense_data, u_int sense_len,\n\t\t uint8_t *sks);\nint scsi_get_block_info(struct scsi_sense_data *sense_data, u_int sense_len,\n\t\t\tstruct scsi_inquiry_data *inq_data,\n\t\t\tuint8_t *block_bits);\nint scsi_get_stream_info(struct scsi_sense_data *sense_data, u_int sense_len,\n\t\t\t struct scsi_inquiry_data *inq_data,\n\t\t\t uint8_t *stream_bits);\nvoid scsi_info_sbuf(struct sbuf *sb, uint8_t *cdb, int cdb_len,\n\t\t    struct scsi_inquiry_data *inq_data, uint64_t info);\nvoid scsi_command_sbuf(struct sbuf *sb, uint8_t *cdb, int cdb_len,\n\t\t       struct scsi_inquiry_data *inq_data, uint64_t csi);\nvoid scsi_progress_sbuf(struct sbuf *sb, uint16_t progress);\nint scsi_sks_sbuf(struct sbuf *sb, int sense_key, uint8_t *sks);\nvoid scsi_fru_sbuf(struct sbuf *sb, uint64_t fru);\nvoid scsi_stream_sbuf(struct sbuf *sb, uint8_t stream_bits, uint64_t info);\nvoid scsi_block_sbuf(struct sbuf *sb, uint8_t block_bits, uint64_t info);\nvoid scsi_sense_info_sbuf(struct sbuf *sb, struct scsi_sense_data *sense,\n\t\t\t  u_int sense_len, uint8_t *cdb, int cdb_len,\n\t\t\t  struct scsi_inquiry_data *inq_data,\n\t\t\t  struct scsi_sense_desc_header *header);\n\nvoid scsi_sense_command_sbuf(struct sbuf *sb, struct scsi_sense_data *sense,\n\t\t\t     u_int sense_len, uint8_t *cdb, int cdb_len,\n\t\t\t     struct scsi_inquiry_data *inq_data,\n\t\t\t     struct scsi_sense_desc_header *header);\nvoid scsi_sense_sks_sbuf(struct sbuf *sb, struct scsi_sense_data *sense,\n\t\t\t u_int sense_len, uint8_t *cdb, int cdb_len,\n\t\t\t struct scsi_inquiry_data *inq_data,\n\t\t\t struct scsi_sense_desc_header *header);\nvoid scsi_sense_fru_sbuf(struct sbuf *sb, struct scsi_sense_data *sense,\n\t\t\t u_int sense_len, uint8_t *cdb, int cdb_len,\n\t\t\t struct scsi_inquiry_data *inq_data,\n\t\t\t struct scsi_sense_desc_header *header);\nvoid scsi_sense_stream_sbuf(struct sbuf *sb, struct scsi_sense_data *sense,\n\t\t\t    u_int sense_len, uint8_t *cdb, int cdb_len,\n\t\t\t    struct scsi_inquiry_data *inq_data,\n\t\t\t    struct scsi_sense_desc_header *header);\nvoid scsi_sense_block_sbuf(struct sbuf *sb, struct scsi_sense_data *sense,\n\t\t\t   u_int sense_len, uint8_t *cdb, int cdb_len,\n\t\t\t   struct scsi_inquiry_data *inq_data,\n\t\t\t   struct scsi_sense_desc_header *header);\nvoid scsi_sense_progress_sbuf(struct sbuf *sb, struct scsi_sense_data *sense,\n\t\t\t      u_int sense_len, uint8_t *cdb, int cdb_len,\n\t\t\t      struct scsi_inquiry_data *inq_data,\n\t\t\t      struct scsi_sense_desc_header *header);\nvoid scsi_sense_generic_sbuf(struct sbuf *sb, struct scsi_sense_data *sense,\n\t\t\t     u_int sense_len, uint8_t *cdb, int cdb_len,\n\t\t\t     struct scsi_inquiry_data *inq_data,\n\t\t\t     struct scsi_sense_desc_header *header);\nvoid scsi_sense_desc_sbuf(struct sbuf *sb, struct scsi_sense_data *sense,\n\t\t\t  u_int sense_len, uint8_t *cdb, int cdb_len,\n\t\t\t  struct scsi_inquiry_data *inq_data,\n\t\t\t  struct scsi_sense_desc_header *header);\nscsi_sense_data_type scsi_sense_type(struct scsi_sense_data *sense_data);\n\nvoid scsi_sense_only_sbuf(struct scsi_sense_data *sense, u_int sense_len,\n\t\t\t  struct sbuf *sb, char *path_str,\n\t\t\t  struct scsi_inquiry_data *inq_data, uint8_t *cdb,\n\t\t\t  int cdb_len);\n\n#ifdef _KERNEL\nint\t\tscsi_command_string(struct ccb_scsiio *csio, struct sbuf *sb);\nint\t\tscsi_sense_sbuf(struct ccb_scsiio *csio, struct sbuf *sb,\n\t\t\t\tscsi_sense_string_flags flags);\nchar *\t\tscsi_sense_string(struct ccb_scsiio *csio,\n\t\t\t\t  char *str, int str_len);\nvoid\t\tscsi_sense_print(struct ccb_scsiio *csio);\nint\t\tscsi_interpret_sense(union ccb *ccb, \n\t\t\t\t     u_int32_t sense_flags,\n\t\t\t\t     u_int32_t *relsim_flags, \n\t\t\t\t     u_int32_t *reduction,\n\t\t\t\t     u_int32_t *timeout,\n\t\t\t\t     scsi_sense_action error_action);\n#else /* _KERNEL */\nint\t\tscsi_command_string(struct cam_device *device,\n\t\t\t\t    struct ccb_scsiio *csio, struct sbuf *sb);\nint\t\tscsi_sense_sbuf(struct cam_device *device, \n\t\t\t\tstruct ccb_scsiio *csio, struct sbuf *sb,\n\t\t\t\tscsi_sense_string_flags flags);\nchar *\t\tscsi_sense_string(struct cam_device *device, \n\t\t\t\t  struct ccb_scsiio *csio,\n\t\t\t\t  char *str, int str_len);\nvoid\t\tscsi_sense_print(struct cam_device *device, \n\t\t\t\t struct ccb_scsiio *csio, FILE *ofile);\nint\t\tscsi_interpret_sense(struct cam_device *device,\n\t\t\t\t     union ccb *ccb,\n\t\t\t\t     u_int32_t sense_flags,\n\t\t\t\t     u_int32_t *relsim_flags, \n\t\t\t\t     u_int32_t *reduction,\n\t\t\t\t     u_int32_t *timeout,\n\t\t\t\t     scsi_sense_action error_action);\n#endif /* _KERNEL */\n\n#define\tSF_RETRY_UA\t0x01\n#define\tSF_NO_PRINT\t0x02\n#define\tSF_QUIET_IR\t0x04\t/* Be quiet about Illegal Request reponses */\n#define\tSF_PRINT_ALWAYS\t0x08\n\n\nconst char *\tscsi_op_desc(u_int16_t opcode, \n\t\t\t     struct scsi_inquiry_data *inq_data);\nchar *\t\tscsi_cdb_string(u_int8_t *cdb_ptr, char *cdb_string,\n\t\t\t\tsize_t len);\n\nvoid\t\tscsi_print_inquiry(struct scsi_inquiry_data *inq_data);\n\nu_int\t\tscsi_calc_syncsrate(u_int period_factor);\nu_int\t\tscsi_calc_syncparam(u_int period);\n\ntypedef int\t(*scsi_devid_checkfn_t)(uint8_t *);\nint\t\tscsi_devid_is_naa_ieee_reg(uint8_t *bufp);\nint\t\tscsi_devid_is_sas_target(uint8_t *bufp);\nuint8_t *\tscsi_get_devid(struct scsi_vpd_device_id *id, uint32_t len,\n\t\t\t       scsi_devid_checkfn_t ck_fn);\n\nvoid\t\tscsi_test_unit_ready(struct ccb_scsiio *csio, u_int32_t retries,\n\t\t\t\t     void (*cbfcnp)(struct cam_periph *, \n\t\t\t\t\t\t    union ccb *),\n\t\t\t\t     u_int8_t tag_action, \n\t\t\t\t     u_int8_t sense_len, u_int32_t timeout);\n\nvoid\t\tscsi_request_sense(struct ccb_scsiio *csio, u_int32_t retries,\n\t\t\t\t   void (*cbfcnp)(struct cam_periph *, \n\t\t\t\t\t\t  union ccb *),\n\t\t\t\t   void *data_ptr, u_int8_t dxfer_len,\n\t\t\t\t   u_int8_t tag_action, u_int8_t sense_len,\n\t\t\t\t   u_int32_t timeout);\n\nvoid\t\tscsi_inquiry(struct ccb_scsiio *csio, u_int32_t retries,\n\t\t\t     void (*cbfcnp)(struct cam_periph *, union ccb *),\n\t\t\t     u_int8_t tag_action, u_int8_t *inq_buf, \n\t\t\t     u_int32_t inq_len, int evpd, u_int8_t page_code,\n\t\t\t     u_int8_t sense_len, u_int32_t timeout);\n\nvoid\t\tscsi_mode_sense(struct ccb_scsiio *csio, u_int32_t retries,\n\t\t\t\tvoid (*cbfcnp)(struct cam_periph *,\n\t\t\t\t\t       union ccb *),\n\t\t\t\tu_int8_t tag_action, int dbd,\n\t\t\t\tu_int8_t page_code, u_int8_t page,\n\t\t\t\tu_int8_t *param_buf, u_int32_t param_len,\n\t\t\t\tu_int8_t sense_len, u_int32_t timeout);\n\nvoid\t\tscsi_mode_sense_len(struct ccb_scsiio *csio, u_int32_t retries,\n\t\t\t\t    void (*cbfcnp)(struct cam_periph *,\n\t\t\t\t\t\t   union ccb *),\n\t\t\t\t    u_int8_t tag_action, int dbd,\n\t\t\t\t    u_int8_t page_code, u_int8_t page,\n\t\t\t\t    u_int8_t *param_buf, u_int32_t param_len,\n\t\t\t\t    int minimum_cmd_size, u_int8_t sense_len,\n\t\t\t\t    u_int32_t timeout);\n\nvoid\t\tscsi_mode_select(struct ccb_scsiio *csio, u_int32_t retries,\n\t\t\t\t void (*cbfcnp)(struct cam_periph *,\n\t\t\t\t\t\tunion ccb *),\n\t\t\t\t u_int8_t tag_action, int scsi_page_fmt,\n\t\t\t\t int save_pages, u_int8_t *param_buf,\n\t\t\t\t u_int32_t param_len, u_int8_t sense_len,\n\t\t\t\t u_int32_t timeout);\n\nvoid\t\tscsi_mode_select_len(struct ccb_scsiio *csio, u_int32_t retries,\n\t\t\t\t     void (*cbfcnp)(struct cam_periph *,\n\t\t\t\t\t\t    union ccb *),\n\t\t\t\t     u_int8_t tag_action, int scsi_page_fmt,\n\t\t\t\t     int save_pages, u_int8_t *param_buf,\n\t\t\t\t     u_int32_t param_len, int minimum_cmd_size,\n\t\t\t\t     u_int8_t sense_len, u_int32_t timeout);\n\nvoid\t\tscsi_log_sense(struct ccb_scsiio *csio, u_int32_t retries,\n\t\t\t       void (*cbfcnp)(struct cam_periph *, union ccb *),\n\t\t\t       u_int8_t tag_action, u_int8_t page_code,\n\t\t\t       u_int8_t page, int save_pages, int ppc,\n\t\t\t       u_int32_t paramptr, u_int8_t *param_buf,\n\t\t\t       u_int32_t param_len, u_int8_t sense_len,\n\t\t\t       u_int32_t timeout);\n\nvoid\t\tscsi_log_select(struct ccb_scsiio *csio, u_int32_t retries,\n\t\t\t\tvoid (*cbfcnp)(struct cam_periph *,\n\t\t\t\tunion ccb *), u_int8_t tag_action,\n\t\t\t\tu_int8_t page_code, int save_pages,\n\t\t\t\tint pc_reset, u_int8_t *param_buf,\n\t\t\t\tu_int32_t param_len, u_int8_t sense_len,\n\t\t\t\tu_int32_t timeout);\n\nvoid\t\tscsi_prevent(struct ccb_scsiio *csio, u_int32_t retries,\n\t\t\t     void (*cbfcnp)(struct cam_periph *, union ccb *),\n\t\t\t     u_int8_t tag_action, u_int8_t action,\n\t\t\t     u_int8_t sense_len, u_int32_t timeout);\n\nvoid\t\tscsi_read_capacity(struct ccb_scsiio *csio, u_int32_t retries,\n\t\t\t\t   void (*cbfcnp)(struct cam_periph *, \n\t\t\t\t   union ccb *), u_int8_t tag_action, \n\t\t\t\t   struct scsi_read_capacity_data *,\n\t\t\t\t   u_int8_t sense_len, u_int32_t timeout);\nvoid\t\tscsi_read_capacity_16(struct ccb_scsiio *csio, uint32_t retries,\n\t\t\t\t      void (*cbfcnp)(struct cam_periph *,\n\t\t\t\t      union ccb *), uint8_t tag_action,\n\t\t\t\t      uint64_t lba, int reladr, int pmi,\n\t\t\t\t      struct scsi_read_capacity_data_long\n\t\t\t\t      *rcap_buf, uint8_t sense_len,\n\t\t\t\t      uint32_t timeout);\n\nvoid\t\tscsi_report_luns(struct ccb_scsiio *csio, u_int32_t retries,\n\t\t\t\t void (*cbfcnp)(struct cam_periph *, \n\t\t\t\t union ccb *), u_int8_t tag_action, \n\t\t\t\t u_int8_t select_report,\n\t\t\t\t struct scsi_report_luns_data *rpl_buf,\n\t\t\t\t u_int32_t alloc_len, u_int8_t sense_len,\n\t\t\t\t u_int32_t timeout);\n\nvoid\t\tscsi_report_target_group(struct ccb_scsiio *csio, u_int32_t retries,\n\t\t\t\t void (*cbfcnp)(struct cam_periph *, \n\t\t\t\t union ccb *), u_int8_t tag_action, \n\t\t\t\t u_int8_t pdf,\n\t\t\t\t void *buf,\n\t\t\t\t u_int32_t alloc_len, u_int8_t sense_len,\n\t\t\t\t u_int32_t timeout);\n\nvoid\t\tscsi_set_target_group(struct ccb_scsiio *csio, u_int32_t retries,\n\t\t\t\t void (*cbfcnp)(struct cam_periph *, \n\t\t\t\t union ccb *), u_int8_t tag_action, void *buf,\n\t\t\t\t u_int32_t alloc_len, u_int8_t sense_len,\n\t\t\t\t u_int32_t timeout);\n\nvoid\t\tscsi_synchronize_cache(struct ccb_scsiio *csio, \n\t\t\t\t       u_int32_t retries,\n\t\t\t\t       void (*cbfcnp)(struct cam_periph *, \n\t\t\t\t       union ccb *), u_int8_t tag_action, \n\t\t\t\t       u_int32_t begin_lba, u_int16_t lb_count,\n\t\t\t\t       u_int8_t sense_len, u_int32_t timeout);\n\nvoid scsi_receive_diagnostic_results(struct ccb_scsiio *csio, u_int32_t retries,\n\t\t\t\t     void (*cbfcnp)(struct cam_periph *,\n\t\t\t\t\t\t    union ccb*),\n\t\t\t\t     uint8_t tag_action, int pcv,\n\t\t\t\t     uint8_t page_code, uint8_t *data_ptr,\n\t\t\t\t     uint16_t allocation_length,\n\t\t\t\t     uint8_t sense_len, uint32_t timeout);\n\nvoid scsi_send_diagnostic(struct ccb_scsiio *csio, u_int32_t retries,\n\t\t\t  void (*cbfcnp)(struct cam_periph *, union ccb *),\n\t\t\t  uint8_t tag_action, int unit_offline,\n\t\t\t  int device_offline, int self_test, int page_format,\n\t\t\t  int self_test_code, uint8_t *data_ptr,\n\t\t\t  uint16_t param_list_length, uint8_t sense_len,\n\t\t\t  uint32_t timeout);\n\nvoid scsi_read_write(struct ccb_scsiio *csio, u_int32_t retries,\n\t\t     void (*cbfcnp)(struct cam_periph *, union ccb *),\n\t\t     u_int8_t tag_action, int readop, u_int8_t byte2, \n\t\t     int minimum_cmd_size, u_int64_t lba,\n\t\t     u_int32_t block_count, u_int8_t *data_ptr,\n\t\t     u_int32_t dxfer_len, u_int8_t sense_len,\n\t\t     u_int32_t timeout);\n\nvoid scsi_start_stop(struct ccb_scsiio *csio, u_int32_t retries,\n\t\t     void (*cbfcnp)(struct cam_periph *, union ccb *),\n\t\t     u_int8_t tag_action, int start, int load_eject,\n\t\t     int immediate, u_int8_t sense_len, u_int32_t timeout);\n\nint\t\tscsi_inquiry_match(caddr_t inqbuffer, caddr_t table_entry);\nint\t\tscsi_static_inquiry_match(caddr_t inqbuffer,\n\t\t\t\t\t  caddr_t table_entry);\nint\t\tscsi_devid_match(uint8_t *rhs, size_t rhs_len,\n\t\t\t\t uint8_t *lhs, size_t lhs_len);\n\nvoid scsi_extract_sense(struct scsi_sense_data *sense, int *error_code,\n\t\t\tint *sense_key, int *asc, int *ascq);\nvoid scsi_extract_sense_len(struct scsi_sense_data *sense,\n\t\t\t    u_int sense_len, int *error_code, int *sense_key,\n\t\t\t    int *asc, int *ascq, int show_errors);\nint scsi_get_sense_key(struct scsi_sense_data *sense, u_int sense_len,\n\t\t       int show_errors);\nint scsi_get_asc(struct scsi_sense_data *sense, u_int sense_len,\n\t\t int show_errors);\nint scsi_get_ascq(struct scsi_sense_data *sense, u_int sense_len,\n\t\t  int show_errors);\nstatic __inline void scsi_ulto2b(u_int32_t val, u_int8_t *bytes);\nstatic __inline void scsi_ulto3b(u_int32_t val, u_int8_t *bytes);\nstatic __inline void scsi_ulto4b(u_int32_t val, u_int8_t *bytes);\nstatic __inline void scsi_u64to8b(u_int64_t val, u_int8_t *bytes);\nstatic __inline uint32_t scsi_2btoul(const uint8_t *bytes);\nstatic __inline uint32_t scsi_3btoul(const uint8_t *bytes);\nstatic __inline int32_t scsi_3btol(const uint8_t *bytes);\nstatic __inline uint32_t scsi_4btoul(const uint8_t *bytes);\nstatic __inline uint64_t scsi_8btou64(const uint8_t *bytes);\nstatic __inline void *find_mode_page_6(struct scsi_mode_header_6 *mode_header);\nstatic __inline void *find_mode_page_10(struct scsi_mode_header_10 *mode_header);\n\nstatic __inline void\nscsi_ulto2b(u_int32_t val, u_int8_t *bytes)\n{\n\n\tbytes[0] = (val >> 8) & 0xff;\n\tbytes[1] = val & 0xff;\n}\n\nstatic __inline void\nscsi_ulto3b(u_int32_t val, u_int8_t *bytes)\n{\n\n\tbytes[0] = (val >> 16) & 0xff;\n\tbytes[1] = (val >> 8) & 0xff;\n\tbytes[2] = val & 0xff;\n}\n\nstatic __inline void\nscsi_ulto4b(u_int32_t val, u_int8_t *bytes)\n{\n\n\tbytes[0] = (val >> 24) & 0xff;\n\tbytes[1] = (val >> 16) & 0xff;\n\tbytes[2] = (val >> 8) & 0xff;\n\tbytes[3] = val & 0xff;\n}\n\nstatic __inline void\nscsi_u64to8b(u_int64_t val, u_int8_t *bytes)\n{\n\n\tbytes[0] = (val >> 56) & 0xff;\n\tbytes[1] = (val >> 48) & 0xff;\n\tbytes[2] = (val >> 40) & 0xff;\n\tbytes[3] = (val >> 32) & 0xff;\n\tbytes[4] = (val >> 24) & 0xff;\n\tbytes[5] = (val >> 16) & 0xff;\n\tbytes[6] = (val >> 8) & 0xff;\n\tbytes[7] = val & 0xff;\n}\n\nstatic __inline uint32_t\nscsi_2btoul(const uint8_t *bytes)\n{\n\tuint32_t rv;\n\n\trv = (bytes[0] << 8) |\n\t     bytes[1];\n\treturn (rv);\n}\n\nstatic __inline uint32_t\nscsi_3btoul(const uint8_t *bytes)\n{\n\tuint32_t rv;\n\n\trv = (bytes[0] << 16) |\n\t     (bytes[1] << 8) |\n\t     bytes[2];\n\treturn (rv);\n}\n\nstatic __inline int32_t \nscsi_3btol(const uint8_t *bytes)\n{\n\tuint32_t rc = scsi_3btoul(bytes);\n \n\tif (rc & 0x00800000)\n\t\trc |= 0xff000000;\n\n\treturn (int32_t) rc;\n}\n\nstatic __inline uint32_t\nscsi_4btoul(const uint8_t *bytes)\n{\n\tuint32_t rv;\n\n\trv = (bytes[0] << 24) |\n\t     (bytes[1] << 16) |\n\t     (bytes[2] << 8) |\n\t     bytes[3];\n\treturn (rv);\n}\n\nstatic __inline uint64_t\nscsi_8btou64(const uint8_t *bytes)\n{\n        uint64_t rv;\n \n\trv = (((uint64_t)bytes[0]) << 56) |\n\t     (((uint64_t)bytes[1]) << 48) |\n\t     (((uint64_t)bytes[2]) << 40) |\n\t     (((uint64_t)bytes[3]) << 32) |\n\t     (((uint64_t)bytes[4]) << 24) |\n\t     (((uint64_t)bytes[5]) << 16) |\n\t     (((uint64_t)bytes[6]) << 8) |\n\t     bytes[7];\n\treturn (rv);\n}\n\n/*\n * Given the pointer to a returned mode sense buffer, return a pointer to\n * the start of the first mode page.\n */\nstatic __inline void *\nfind_mode_page_6(struct scsi_mode_header_6 *mode_header)\n{\n\tvoid *page_start;\n\n\tpage_start = (void *)((u_int8_t *)&mode_header[1] +\n\t\t\t      mode_header->blk_desc_len);\n\n\treturn(page_start);\n}\n\nstatic __inline void *\nfind_mode_page_10(struct scsi_mode_header_10 *mode_header)\n{\n\tvoid *page_start;\n\n\tpage_start = (void *)((u_int8_t *)&mode_header[1] +\n\t\t\t       scsi_2btoul(mode_header->blk_desc_len));\n\n\treturn(page_start);\n}\n\n__END_DECLS\n\n#endif /*_SCSI_SCSI_ALL_H*/\n"
  },
  {
    "path": "freebsd-headers/cam/scsi/scsi_cd.h",
    "content": "/*-\n * Copyright (c) 2000, 2002 Kenneth D. Merry\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions, and the following disclaimer,\n *    without modification, immediately at the beginning of the file.\n * 2. The name of the author may not be used to endorse or promote products\n *    derived from this software without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR\n * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n */\n/*\n * Written by Julian Elischer (julian@tfs.com)\n * for TRW Financial Systems.\n *\n * TRW Financial Systems, in accordance with their agreement with Carnegie\n * Mellon University, makes this software available to CMU to distribute\n * or use in any manner that they see fit as long as this message is kept with\n * the software. For this reason TFS also grants any other persons or\n * organisations permission to use or modify this software.\n *\n * TFS supplies this software to be publicly redistributed\n * on the understanding that TFS is not responsible for the correct\n * functioning of this software in any circumstances.\n *\n * Ported to run under 386BSD by Julian Elischer (julian@tfs.com) Sept 1992\n *\n *\tfrom: scsi_cd.h,v 1.10 1997/02/22 09:44:28 peter Exp $\n * $FreeBSD: release/9.0.0/sys/cam/scsi/scsi_cd.h 111206 2003-02-21 06:19:38Z ken $\n */\n#ifndef\t_SCSI_SCSI_CD_H\n#define _SCSI_SCSI_CD_H 1\n\n/*\n *\tDefine two bits always in the same place in byte 2 (flag byte)\n */\n#define\tCD_RELADDR\t0x01\n#define\tCD_MSF\t\t0x02\n\n/*\n * SCSI command format\n */\n\nstruct scsi_pause\n{\n\tu_int8_t op_code;\n\tu_int8_t byte2;\n\tu_int8_t unused[6];\n\tu_int8_t resume;\n\tu_int8_t control;\n};\n#define\tPA_PAUSE\t1\n#define PA_RESUME\t0\n\nstruct scsi_play_msf\n{\n\tu_int8_t op_code;\n\tu_int8_t byte2;\n\tu_int8_t unused;\n\tu_int8_t start_m;\n\tu_int8_t start_s;\n\tu_int8_t start_f;\n\tu_int8_t end_m;\n\tu_int8_t end_s;\n\tu_int8_t end_f;\n\tu_int8_t control;\n};\n\nstruct scsi_play_track\n{\n\tu_int8_t op_code;\n\tu_int8_t byte2;\n\tu_int8_t unused[2];\n\tu_int8_t start_track;\n\tu_int8_t start_index;\n\tu_int8_t unused1;\n\tu_int8_t end_track;\n\tu_int8_t end_index;\n\tu_int8_t control;\n};\n\nstruct scsi_play_10\n{\n\tu_int8_t op_code;\n\tu_int8_t byte2;\n\tu_int8_t blk_addr[4];\n\tu_int8_t unused;\n\tu_int8_t xfer_len[2];\n\tu_int8_t control;\n};\n\nstruct scsi_play_12\n{\n\tu_int8_t op_code;\n\tu_int8_t byte2;\t/* same as above */\n\tu_int8_t blk_addr[4];\n\tu_int8_t xfer_len[4];\n\tu_int8_t unused;\n\tu_int8_t control;\n};\n\nstruct scsi_play_rel_12\n{\n\tu_int8_t op_code;\n\tu_int8_t byte2;\t/* same as above */\n\tu_int8_t blk_addr[4];\n\tu_int8_t xfer_len[4];\n\tu_int8_t track;\n\tu_int8_t control;\n};\n\nstruct scsi_read_header\n{\n\tu_int8_t op_code;\n\tu_int8_t byte2;\n\tu_int8_t blk_addr[4];\n\tu_int8_t unused;\n\tu_int8_t data_len[2];\n\tu_int8_t control;\n};\n\nstruct scsi_read_subchannel\n{\n\tu_int8_t op_code;\n\tu_int8_t byte1;\n\tu_int8_t byte2;\n#define\tSRS_SUBQ\t0x40\n\tu_int8_t subchan_format;\n\tu_int8_t unused[2];\n\tu_int8_t track;\n\tu_int8_t data_len[2];\n\tu_int8_t control;\n};\n\nstruct scsi_read_toc\n{\n\tu_int8_t op_code;\n\tu_int8_t byte2;\n\tu_int8_t unused[4];\n\tu_int8_t from_track;\n\tu_int8_t data_len[2];\n\tu_int8_t control;\n};\n\nstruct scsi_read_cd_capacity\n{\n\tu_int8_t op_code;\n\tu_int8_t byte2;\n\tu_int8_t addr_3;\t/* Most Significant */\n\tu_int8_t addr_2;\n\tu_int8_t addr_1;\n\tu_int8_t addr_0;\t/* Least Significant */\n\tu_int8_t unused[3];\n\tu_int8_t control;\n};\n\nstruct scsi_set_speed\n{\n\tu_int8_t opcode;\n\tu_int8_t byte2;\n\tu_int8_t readspeed[2];\n\tu_int8_t writespeed[2];\n\tu_int8_t reserved[5];\n\tu_int8_t control;\n};\n\nstruct scsi_report_key \n{\n\tu_int8_t opcode;\n\tu_int8_t reserved0;\n\tu_int8_t lba[4];\n\tu_int8_t reserved1[2];\n\tu_int8_t alloc_len[2];\n\tu_int8_t agid_keyformat;\n#define RK_KF_AGID_MASK\t\t0xc0\n#define RK_KF_AGID_SHIFT\t6\n#define RK_KF_KEYFORMAT_MASK\t0x3f\n#define RK_KF_AGID\t\t0x00\n#define RK_KF_CHALLENGE\t\t0x01\n#define RF_KF_KEY1\t\t0x02\n#define RK_KF_KEY2\t\t0x03\n#define RF_KF_TITLE\t\t0x04\n#define RF_KF_ASF\t\t0x05\n#define RK_KF_RPC_SET\t\t0x06\n#define RF_KF_RPC_REPORT\t0x08\n#define RF_KF_INV_AGID\t\t0x3f\n\tu_int8_t control;\n};\n\n/*\n * See the report key structure for key format and AGID definitions.\n */\nstruct scsi_send_key\n{\n\tu_int8_t opcode;\n\tu_int8_t reserved[7];\n\tu_int8_t param_len[2];\n\tu_int8_t agid_keyformat;\n\tu_int8_t control;\n};\n\nstruct scsi_read_dvd_structure\n{\n\tu_int8_t opcode;\n\tu_int8_t reserved;\n\tu_int8_t address[4];\n\tu_int8_t layer_number;\n\tu_int8_t format;\n#define RDS_FORMAT_PHYSICAL\t\t0x00\n#define RDS_FORMAT_COPYRIGHT\t\t0x01\n#define RDS_FORMAT_DISC_KEY\t\t0x02\n#define RDS_FORMAT_BCA\t\t\t0x03\n#define RDS_FORMAT_MANUFACTURER\t\t0x04\n#define RDS_FORMAT_CMGS_CPM\t\t0x05\n#define RDS_FORMAT_PROT_DISCID\t\t0x06\n#define RDS_FORMAT_DISC_KEY_BLOCK\t0x07\n#define RDS_FORMAT_DDS\t\t\t0x08\n#define RDS_FORMAT_DVDRAM_MEDIA_STAT\t0x09\n#define RDS_FORMAT_SPARE_AREA\t\t0x0a\n#define RDS_FORMAT_RMD_BORDEROUT\t0x0c\n#define RDS_FORMAT_RMD\t\t\t0x0d\n#define RDS_FORMAT_LEADIN\t\t0x0e\n#define RDS_FORMAT_DISC_ID\t\t0x0f\n#define RDS_FORMAT_DCB\t\t\t0x30\n#define RDS_FORMAT_WRITE_PROT\t\t0xc0\n#define RDS_FORMAT_STRUCTURE_LIST\t0xff\n\tu_int8_t alloc_len[2];\n\tu_int8_t agid;\n\tu_int8_t control;\n};\n\n/*\n * Opcodes\n */\n#define READ_CD_CAPACITY\t0x25\t/* slightly different from disk */\n#define READ_SUBCHANNEL\t\t0x42\t/* cdrom read Subchannel */\n#define READ_TOC\t\t0x43\t/* cdrom read TOC */\n#define READ_HEADER\t\t0x44\t/* cdrom read header */\n#define PLAY_10\t\t\t0x45\t/* cdrom play  'play audio' mode */\n#define PLAY_MSF\t\t0x47\t/* cdrom play Min,Sec,Frames mode */\n#define PLAY_TRACK\t\t0x48\t/* cdrom play track/index mode */\n#define PLAY_TRACK_REL\t\t0x49\t/* cdrom play track/index mode */\n#define PAUSE\t\t\t0x4b\t/* cdrom pause in 'play audio' mode */\n#define SEND_KEY\t\t0xa3\t/* dvd send key command */\n#define REPORT_KEY\t\t0xa4\t/* dvd report key command */\n#define PLAY_12\t\t\t0xa5\t/* cdrom pause in 'play audio' mode */\n#define PLAY_TRACK_REL_BIG\t0xa9\t/* cdrom play track/index mode */\n#define READ_DVD_STRUCTURE\t0xad\t/* read dvd structure */\n#define SET_CD_SPEED\t\t0xbb\t/* set c/dvd speed */\n\nstruct scsi_report_key_data_header\n{\n\tu_int8_t data_len[2];\n\tu_int8_t reserved[2];\n};\n\nstruct scsi_report_key_data_agid\n{\n\tu_int8_t data_len[2];\n\tu_int8_t reserved[5];\n\tu_int8_t agid;\n#define RKD_AGID_MASK\t0xc0\n#define RKD_AGID_SHIFT\t6\n};\n\nstruct scsi_report_key_data_challenge\n{\n\tu_int8_t data_len[2];\n\tu_int8_t reserved0[2];\n\tu_int8_t challenge_key[10];\n\tu_int8_t reserved1[2];\n};\n\nstruct scsi_report_key_data_key1_key2\n{\n\tu_int8_t data_len[2];\n\tu_int8_t reserved0[2];\n\tu_int8_t key1[5];\n\tu_int8_t reserved1[3];\n};\n\nstruct scsi_report_key_data_title\n{\n\tu_int8_t data_len[2];\n\tu_int8_t reserved0[2];\n\tu_int8_t byte0;\n#define RKD_TITLE_CPM\t\t0x80\n#define RKD_TITLE_CPM_SHIFT\t7\n#define RKD_TITLE_CP_SEC\t0x40\n#define RKD_TITLE_CP_SEC_SHIFT\t6\n#define RKD_TITLE_CMGS_MASK\t0x30\n#define RKD_TITLE_CMGS_SHIFT\t4\n#define RKD_TITLE_CMGS_NO_RST\t0x00\n#define RKD_TITLE_CMGS_RSVD\t0x10\n#define RKD_TITLE_CMGS_1_GEN\t0x20\n#define RKD_TITLE_CMGS_NO_COPY\t0x30\n\tu_int8_t title_key[5];\n\tu_int8_t reserved1[2];\n};\n\nstruct scsi_report_key_data_asf\n{\n\tu_int8_t data_len[2];\n\tu_int8_t reserved[5];\n\tu_int8_t success;\n#define RKD_ASF_SUCCESS\t0x01\n};\n\nstruct scsi_report_key_data_rpc\n{\n\tu_int8_t data_len[2];\n\tu_int8_t rpc_scheme0;\n#define RKD_RPC_SCHEME_UNKNOWN\t\t0x00\n#define RKD_RPC_SCHEME_PHASE_II\t\t0x01\n\tu_int8_t reserved0;\n\tu_int8_t byte4;\n#define RKD_RPC_TYPE_MASK\t\t0xC0\n#define RKD_RPC_TYPE_SHIFT\t\t6\n#define RKD_RPC_TYPE_NONE\t\t0x00\n#define RKD_RPC_TYPE_SET\t\t0x40\n#define RKD_RPC_TYPE_LAST_CHANCE\t0x80\n#define RKD_RPC_TYPE_PERM\t\t0xC0\n#define RKD_RPC_VENDOR_RESET_MASK\t0x38\n#define RKD_RPC_VENDOR_RESET_SHIFT\t3\n#define RKD_RPC_USER_RESET_MASK\t\t0x07\n#define RKD_RPC_USER_RESET_SHIFT\t0\n\tu_int8_t region_mask;\n\tu_int8_t rpc_scheme1;\n\tu_int8_t reserved1;\n};\n\nstruct scsi_send_key_data_rpc\n{\n\tu_int8_t data_len[2];\n\tu_int8_t reserved0[2];\n\tu_int8_t region_code;\n\tu_int8_t reserved1[3];\n};\n\n/*\n * Common header for the return data from the READ DVD STRUCTURE command.\n */\nstruct scsi_read_dvd_struct_data_header\n{\n\tu_int8_t data_len[2];\n\tu_int8_t reserved[2];\n};\n\nstruct scsi_read_dvd_struct_data_layer_desc\n{\n\tu_int8_t book_type_version;\n#define RDSD_BOOK_TYPE_DVD_ROM\t0x00\n#define RDSD_BOOK_TYPE_DVD_RAM\t0x10\n#define RDSD_BOOK_TYPE_DVD_R\t0x20\n#define RDSD_BOOK_TYPE_DVD_RW\t0x30\n#define RDSD_BOOK_TYPE_DVD_PRW\t0x90\n#define RDSD_BOOK_TYPE_MASK\t0xf0\n#define RDSD_BOOK_TYPE_SHIFT\t4\n#define RDSD_BOOK_VERSION_MASK\t0x0f\n\t/*\n\t * The lower 4 bits of this field is referred to as the \"minimum\n\t * rate\" field in MMC2, and the \"maximum rate\" field in MMC3.  Ugh.\n\t */\n\tu_int8_t disc_size_max_rate;\n#define RDSD_DISC_SIZE_120MM\t0x00\n#define RDSD_DISC_SIZE_80MM\t0x10\n#define RDSD_DISC_SIZE_MASK\t0xf0\n#define RDSD_DISC_SIZE_SHIFT\t4\n#define RDSD_MAX_RATE_0252\t0x00\n#define RDSD_MAX_RATE_0504\t0x01\n#define RDSD_MAX_RATE_1008\t0x02\n#define RDSD_MAX_RATE_NOT_SPEC\t0x0f\n#define RDSD_MAX_RATE_MASK\t0x0f\n\tu_int8_t layer_info;\n#define RDSD_NUM_LAYERS_MASK\t0x60\n#define RDSD_NUM_LAYERS_SHIFT\t5\n#define RDSD_NL_ONE_LAYER\t0x00\n#define RDSD_NL_TWO_LAYERS\t0x20\n#define RDSD_TRACK_PATH_MASK\t0x10\n#define RDSD_TRACK_PATH_SHIFT\t4\n#define RDSD_TP_PTP\t\t0x00\n#define RDSD_TP_OTP\t\t0x10\n#define RDSD_LAYER_TYPE_RO\t0x01\n#define RDSD_LAYER_TYPE_RECORD\t0x02\n#define RDSD_LAYER_TYPE_RW\t0x04\n#define RDSD_LAYER_TYPE_MASK\t0x0f\n\tu_int8_t density;\n#define RDSD_LIN_DENSITY_0267\t\t0x00\n#define RDSD_LIN_DENSITY_0293\t\t0x10\n#define RDSD_LIN_DENSITY_0409_0435\t0x20\n#define RDSD_LIN_DENSITY_0280_0291\t0x40\n/* XXX MMC2 uses 0.176um/bit instead of 0.353 as in MMC3 */\n#define RDSD_LIN_DENSITY_0353\t\t0x80\n#define RDSD_LIN_DENSITY_MASK\t\t0xf0\n#define RDSD_LIN_DENSITY_SHIFT\t\t4\n#define RDSD_TRACK_DENSITY_074\t\t0x00\n#define RDSD_TRACK_DENSITY_080\t\t0x01\n#define RDSD_TRACK_DENSITY_0615\t\t0x02\n#define RDSD_TRACK_DENSITY_MASK\t\t0x0f\n\tu_int8_t zeros0;\n\tu_int8_t main_data_start[3];\n#define RDSD_MAIN_DATA_START_DVD_RO\t0x30000\n#define RDSD_MAIN_DATA_START_DVD_RW\t0x31000\n\tu_int8_t zeros1;\n\tu_int8_t main_data_end[3];\n\tu_int8_t zeros2;\n\tu_int8_t end_sector_layer0[3];\n\tu_int8_t bca;\n#define RDSD_BCA\t0x80\n#define RDSD_BCA_MASK\t0x80\n#define RDSD_BCA_SHIFT\t7\n\tu_int8_t media_specific[2031];\n};\n\nstruct scsi_read_dvd_struct_data_physical\n{\n\tu_int8_t data_len[2];\n\tu_int8_t reserved[2];\n\tstruct scsi_read_dvd_struct_data_layer_desc layer_desc;\n};\n\nstruct scsi_read_dvd_struct_data_copyright\n{\n\tu_int8_t data_len[2];\n\tu_int8_t reserved0[2];\n\tu_int8_t cps_type;\n#define RDSD_CPS_NOT_PRESENT\t0x00\n#define RDSD_CPS_DATA_EXISTS\t0x01\n\tu_int8_t region_info;\n\tu_int8_t reserved1[2];\n};\n\nstruct scsi_read_dvd_struct_data_disc_key\n{\n\tu_int8_t data_len[2];\n\tu_int8_t reserved[2];\n\tu_int8_t disc_key[2048];\n};\n\nstruct scsi_read_dvd_struct_data_bca\n{\n\tu_int8_t data_len[2];\n\tu_int8_t reserved[2];\n\tu_int8_t bca_info[188]; /* XXX 12-188 bytes */\n};\n\nstruct scsi_read_dvd_struct_data_manufacturer\n{\n\tu_int8_t data_len[2];\n\tu_int8_t reserved[2];\n\tu_int8_t manuf_info[2048];\n};\n\nstruct scsi_read_dvd_struct_data_copy_manage\n{\n\tu_int8_t data_len[2];\n\tu_int8_t reserved0[2];\n\tu_int8_t byte4;\n#define RDSD_CPM_NO_COPYRIGHT\t0x00\n#define RDSD_CPM_HAS_COPYRIGHT\t0x80\n#define RDSD_CPM_MASK\t\t0x80\n#define RDSD_CMGS_COPY_ALLOWED\t0x00\n#define RDSD_CMGS_ONE_COPY\t0x20\n#define RDSD_CMGS_NO_COPIES\t0x30\n#define RDSD_CMGS_MASK\t\t0x30\n\tu_int8_t reserved1[3];\n};\n\nstruct scsi_read_dvd_struct_data_prot_discid\n{\n\tu_int8_t data_len[2];\n\tu_int8_t reserved[2];\n\tu_int8_t prot_discid_data[16];\n};\n\nstruct scsi_read_dvd_struct_data_disc_key_blk\n{\n\t/*\n\t * Length is 0x6ffe == 28670 for CPRM, 0x3002 == 12990 for CSS2.\n\t */\n\tu_int8_t data_len[2];\n\tu_int8_t reserved;\n\tu_int8_t total_packs;\n\tu_int8_t disc_key_pack_data[28668];\n};\nstruct scsi_read_dvd_struct_data_dds\n{\n\tu_int8_t data_len[2];\n\tu_int8_t reserved[2];\n\tu_int8_t dds_info[2048];\n};\n\nstruct scsi_read_dvd_struct_data_medium_status\n{\n\tu_int8_t data_len[2];\n\tu_int8_t reserved0[2];\n\tu_int8_t byte4;\n#define RDSD_MS_CARTRIDGE\t0x80\n#define RDSD_MS_OUT\t\t0x40\n#define RDSD_MS_MSWI\t\t0x08\n#define RDSD_MS_CWP\t\t0x04\n#define RDSD_MS_PWP\t\t0x02\n\tu_int8_t disc_type_id;\n#define RDSD_DT_NEED_CARTRIDGE\t0x00\n#define RDSD_DT_NO_CART_NEEDED\t0x01\n\tu_int8_t reserved1;\n\tu_int8_t ram_swi_info;\n#define RDSD_SWI_NO_BARE\t0x01\n#define RDSD_SWI_UNSPEC\t\t0xff\n};\n\nstruct scsi_read_dvd_struct_data_spare_area\n{\n\tu_int8_t data_len[2];\n\tu_int8_t reserved[2];\n\tu_int8_t unused_primary[4];\n\tu_int8_t unused_supl[4];\n\tu_int8_t allocated_supl[4];\n};\n\nstruct scsi_read_dvd_struct_data_rmd_borderout\n{\n\tu_int8_t data_len[2];\n\tu_int8_t reserved[2];\n\tu_int8_t rmd[30720]; \t/* maximum is 30720 bytes */\n};\n\nstruct scsi_read_dvd_struct_data_rmd\n{\n\tu_int8_t data_len[2];\n\tu_int8_t reserved[2];\n\tu_int8_t last_sector_num[4];\n\tu_int8_t rmd_bytes[32768];  /* This is the maximum */\n};\n\n/*\n * XXX KDM this is the MMC2 version of the structure.\n * The variable positions have changed (in a semi-conflicting way) in the\n * MMC3 spec, although the overall length of the structure is the same.\n */\nstruct scsi_read_dvd_struct_data_leadin\n{\n\tu_int8_t data_len[2];\n\tu_int8_t reserved0[2];\n\tu_int8_t field_id_1;\n\tu_int8_t app_code;\n\tu_int8_t disc_physical_data;\n\tu_int8_t last_addr[3];\n\tu_int8_t reserved1[2];\n\tu_int8_t field_id_2;\n\tu_int8_t rwp;\n\tu_int8_t rwp_wavelength;\n\tu_int8_t optimum_write_strategy;\n\tu_int8_t reserved2[4];\n\tu_int8_t field_id_3;\n\tu_int8_t manuf_id_17_12[6];\n\tu_int8_t reserved3;\n\tu_int8_t field_id_4;\n\tu_int8_t manuf_id_11_6[6];\n\tu_int8_t reserved4;\n\tu_int8_t field_id_5;\n\tu_int8_t manuf_id_5_0[6];\n\tu_int8_t reserved5[25];\n};\n\nstruct scsi_read_dvd_struct_data_disc_id\n{\n\tu_int8_t data_len[2];\n\tu_int8_t reserved[4];\n\tu_int8_t random_num[2];\n\tu_int8_t year[4];\n\tu_int8_t month[2];\n\tu_int8_t day[2];\n\tu_int8_t hour[2];\n\tu_int8_t minute[2];\n\tu_int8_t second[2];\n};\n\nstruct scsi_read_dvd_struct_data_generic_dcb\n{\n\tu_int8_t content_desc[4];\n#define SCSI_RCB\n\tu_int8_t unknown_desc_actions[4];\n#define RDSD_ACTION_RECORDING\t0x0001\n#define RDSD_ACTION_READING\t0x0002\n#define RDSD_ACTION_FORMAT\t0x0004\n#define RDSD_ACTION_MODIFY_DCB\t0x0008\n\tu_int8_t vendor_id[32];\n\tu_int8_t dcb_data[32728];\n};\n\nstruct scsi_read_dvd_struct_data_dcb\n{\n\tu_int8_t data_len[2];\n\tu_int8_t reserved[2];\n\tstruct scsi_read_dvd_struct_data_generic_dcb dcb;\n};\n\nstruct read_dvd_struct_write_prot\n{\n\tu_int8_t data_len[2];\n\tu_int8_t reserved0[2];\n\tu_int8_t write_prot_status;\n#define RDSD_WPS_MSWI\t\t0x08\n#define RDSD_WPS_CWP\t\t0x04\n#define RDSD_WPS_PWP\t\t0x02\n#define RDSD_WPS_SWPP\t\t0x01\n\tu_int8_t reserved[3];\n};\n\nstruct read_dvd_struct_list_entry\n{\n\tu_int8_t format_code;\n\tu_int8_t sds_rds;\n#define RDSD_SDS_NOT_WRITEABLE\t0x00\n#define RDSD_SDS_WRITEABLE\t0x80\n#define RDSD_SDS_MASK\t\t0x80\n#define RDSD_RDS_NOT_READABLE\t0x00\n#define RDSD_RDS_READABLE\t0x40\n#define RDSD_RDS_MASK\t\t0x40\n\tu_int8_t struct_len[2];\n};\n\nstruct read_dvd_struct_data_list\n{\n\tu_int8_t data_len[2];\n\tu_int8_t reserved[2];\n\tstruct read_dvd_struct_list_entry entries[0];\n};\n\nstruct scsi_read_cd_cap_data\n{\n\tu_int8_t addr_3;\t/* Most significant */\n\tu_int8_t addr_2;\n\tu_int8_t addr_1;\n\tu_int8_t addr_0;\t/* Least significant */\n\tu_int8_t length_3;\t/* Most significant */\n\tu_int8_t length_2;\n\tu_int8_t length_1;\n\tu_int8_t length_0;\t/* Least significant */\n};\n\nstruct cd_audio_page\n{\n\tu_int8_t page_code;\n#define\tCD_PAGE_CODE\t\t0x3F\n#define\tAUDIO_PAGE\t\t0x0e\n#define\tCD_PAGE_PS\t\t0x80\n\tu_int8_t param_len;\n\tu_int8_t flags;\n#define\tCD_PA_SOTC\t\t0x02\n#define\tCD_PA_IMMED\t\t0x04\n\tu_int8_t unused[2];\n\tu_int8_t format_lba;\n#define\tCD_PA_FORMAT_LBA\t0x0F\n#define\tCD_PA_APR_VALID\t\t0x80\n\tu_int8_t lb_per_sec[2];\n\tstruct\tport_control\n\t{\n\t\tu_int8_t channels;\n#define\tCHANNEL\t\t\t0x0F\n#define\tCHANNEL_0\t\t1\n#define\tCHANNEL_1\t\t2\n#define\tCHANNEL_2\t\t4\n#define\tCHANNEL_3\t\t8\n#define\tLEFT_CHANNEL\t\tCHANNEL_0\n#define\tRIGHT_CHANNEL\t\tCHANNEL_1\n\t\tu_int8_t volume;\n\t} port[4];\n#define\tLEFT_PORT\t\t0\n#define\tRIGHT_PORT\t\t1\n};\n\nunion cd_pages\n{\n\tstruct cd_audio_page audio;\n};\n\nstruct cd_mode_data_10\n{\n\tstruct scsi_mode_header_10 header;\n\tstruct scsi_mode_blk_desc  blk_desc;\n\tunion cd_pages page;\n};\n\nstruct cd_mode_data\n{\n\tstruct scsi_mode_header_6 header;\n\tstruct scsi_mode_blk_desc blk_desc;\n\tunion cd_pages page;\n};\n\nunion cd_mode_data_6_10\n{\n\tstruct cd_mode_data mode_data_6;\n\tstruct cd_mode_data_10 mode_data_10;\n};\n\nstruct cd_mode_params\n{\n\tSTAILQ_ENTRY(cd_mode_params)\tlinks;\n\tint\t\t\t\tcdb_size;\n\tint\t\t\t\talloc_len;\n\tu_int8_t\t\t\t*mode_buf;\n};\n\n__BEGIN_DECLS\nvoid scsi_report_key(struct ccb_scsiio *csio, u_int32_t retries,\n\t\t     void (*cbfcnp)(struct cam_periph *, union ccb *),\n\t\t     u_int8_t tag_action, u_int32_t lba, u_int8_t agid,\n\t\t     u_int8_t key_format, u_int8_t *data_ptr,\n\t\t     u_int32_t dxfer_len, u_int8_t sense_len,\n\t\t     u_int32_t timeout);\n\nvoid scsi_send_key(struct ccb_scsiio *csio, u_int32_t retries,\n\t\t   void (*cbfcnp)(struct cam_periph *, union ccb *),\n\t\t   u_int8_t tag_action, u_int8_t agid, u_int8_t key_format,\n\t\t   u_int8_t *data_ptr, u_int32_t dxfer_len, u_int8_t sense_len,\n\t\t   u_int32_t timeout);\n\nvoid scsi_read_dvd_structure(struct ccb_scsiio *csio, u_int32_t retries,\n\t\t\t     void (*cbfcnp)(struct cam_periph *, union ccb *),\n\t\t\t     u_int8_t tag_action, u_int32_t address,\n\t\t\t     u_int8_t layer_number, u_int8_t format,\n\t\t\t     u_int8_t agid, u_int8_t *data_ptr,\n\t\t\t     u_int32_t dxfer_len, u_int8_t sense_len,\n\t\t\t     u_int32_t timeout);\n\n__END_DECLS\n\n#endif /*_SCSI_SCSI_CD_H*/\n\n"
  },
  {
    "path": "freebsd-headers/cam/scsi/scsi_ch.h",
    "content": "/* $FreeBSD: release/9.0.0/sys/cam/scsi/scsi_ch.h 208905 2010-06-08 05:14:18Z mjacob $ */\n/*\t$NetBSD: scsi_changer.h,v 1.11 1998/02/13 08:28:32 enami Exp $\t*/\n\n/*-\n * Copyright (c) 1996 Jason R. Thorpe <thorpej@and.com>\n * All rights reserved.\n *\n * Partially based on an autochanger driver written by Stefan Grefen\n * and on an autochanger driver written by the Systems Programming Group\n * at the University of Utah Computer Science Department.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. All advertising materials mentioning features or use of this software\n *    must display the following acknowledgements:\n *\tThis product includes software developed by Jason R. Thorpe\n *\tfor And Communications, http://www.and.com/\n * 4. The name of the author may not be used to endorse or promote products\n *    derived from this software without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR\n * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES\n * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,\n * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,\n * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\n * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED\n * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,\n * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n */\n\n/*\n * SCSI changer interface description\n */\n\n/*-\n * Partially derived from software written by Stefan Grefen\n * (grefen@goofy.zdv.uni-mainz.de soon grefen@convex.com)\n * based on the SCSI System by written Julian Elischer (julian@tfs.com)\n * for TRW Financial Systems.\n *\n * TRW Financial Systems, in accordance with their agreement with Carnegie\n * Mellon University, makes this software available to CMU to distribute\n * or use in any manner that they see fit as long as this message is kept with \n * the software. For this reason TFS also grants any other persons or\n * organisations permission to use or modify this software.\n *\n * TFS supplies this software to be publicly redistributed\n * on the understanding that TFS is not responsible for the correct\n * functioning of this software in any circumstances.\n *\n * Ported to run under 386BSD by Julian Elischer (julian@tfs.com) Sept 1992\n */\n\n#ifndef _SCSI_SCSI_CH_H\n#define _SCSI_SCSI_CH_H 1\n\n#include <sys/cdefs.h>\n\n/*\n * SCSI command format\n */\n\n/*\n * Exchange the medium in the source element with the medium\n * located at the destination element.\n */\nstruct scsi_exchange_medium {\n\tu_int8_t\topcode;\n#define EXCHANGE_MEDIUM\t\t0xa6\n\tu_int8_t\tbyte2;\n\tu_int8_t\ttea[2];\t/* transport element address */\n\tu_int8_t\tsrc[2];\t/* source address */\n\tu_int8_t\tfdst[2]; /* first destination address */\n\tu_int8_t\tsdst[2]; /* second destination address */\n\tu_int8_t\tinvert;\n#define EXCHANGE_MEDIUM_INV1\t0x01\n#define EXCHANGE_MEDIUM_INV2\t0x02\n\tu_int8_t\tcontrol;\n};\n\n/*\n * Cause the medium changer to check all elements for medium and any\n * other status relevant to the element.\n */\nstruct scsi_initialize_element_status {\n\tu_int8_t\topcode;\n#define INITIALIZE_ELEMENT_STATUS\t0x07\n\tu_int8_t\tbyte2;\n\tu_int8_t\treserved[3];\n\tu_int8_t\tcontrol;\n};\n\n/*\n * Request the changer to move a unit of media from the source element\n * to the destination element.\n */\nstruct scsi_move_medium {\n\tu_int8_t\topcode;\n\tu_int8_t\tbyte2;\n\tu_int8_t\ttea[2];\t/* transport element address */\n\tu_int8_t\tsrc[2];\t/* source element address */\n\tu_int8_t\tdst[2];\t/* destination element address */\n\tu_int8_t\treserved[2];\n\tu_int8_t\tinvert;\n#define MOVE_MEDIUM_INVERT\t0x01\n\tu_int8_t\tcontrol;\n};\n\n/*\n * Position the specified transport element (picker) in front of\n * the destination element specified.\n */\nstruct scsi_position_to_element {\n\tu_int8_t\topcode;\n\tu_int8_t\tbyte2;\n\tu_int8_t\ttea[2];\t/* transport element address */\n\tu_int8_t\tdst[2];\t/* destination element address */\n\tu_int8_t\treserved[2];\n\tu_int8_t\tinvert;\n#define POSITION_TO_ELEMENT_INVERT\t0x01\n\tu_int8_t\tcontrol;\n};\n\n/*\n * Request that the changer report the status of its internal elements.\n */\nstruct scsi_read_element_status {\n\tu_int8_t\topcode;\n\tu_int8_t\tbyte2;\n#define READ_ELEMENT_STATUS_VOLTAG\t0x10\t/* report volume tag info */\n\t/* ...next 4 bits are an element type code... */\n\tu_int8_t\tsea[2];\t/* starting element address */\n\tu_int8_t\tcount[2]; /* number of elements */\n\tu_int8_t\treserved0;\n\tu_int8_t\tlen[3];\t/* length of data buffer */\n\tu_int8_t\treserved1;\n\tu_int8_t\tcontrol;\n};\n\nstruct scsi_request_volume_element_address {\n\tu_int8_t\topcode;\n\tu_int8_t\tbyte2;\n#define REQUEST_VOLUME_ELEMENT_ADDRESS_VOLTAG\t0x10\n\t/* ...next 4 bits are an element type code... */\n\tu_int8_t\teaddr[2];\t/* element address */\n\tu_int8_t\tcount[2];\t/* number of elements */\n\tu_int8_t\treserved0;\n\tu_int8_t\tlen[3];\t\t/* length of data buffer */\n\tu_int8_t\treserved1;\n\tu_int8_t\tcontrol;\n};\n\n/* XXX scsi_release */\n\n/*\n * Changer-specific mode page numbers.\n */\n#define\tCH_ELEMENT_ADDR_ASSIGN_PAGE\t0x1D\n#define\tCH_TRANS_GEOM_PARAMS_PAGE\t0x1E\n#define\tCH_DEVICE_CAP_PAGE\t\t0x1F\n\n/*\n * Data returned by READ ELEMENT STATUS consists of an 8-byte header\n * followed by one or more read_element_status_pages.\n */\nstruct read_element_status_header {\n\tu_int8_t\tfear[2];  /* first element address reported */\n\tu_int8_t\tcount[2]; /* number of elements available */\n\tu_int8_t\treserved;\n\tu_int8_t\tnbytes[3]; /* byte count of all pages */\n};\n\nstruct read_element_status_page_header {\n\tu_int8_t\ttype;\t/* element type code; see type codes below */\n\tu_int8_t\tflags;\n#define READ_ELEMENT_STATUS_AVOLTAG\t0x40\n#define READ_ELEMENT_STATUS_PVOLTAG\t0x80\n\tu_int8_t\tedl[2];\t/* element descriptor length */\n\tu_int8_t\treserved;\n\tu_int8_t\tnbytes[3]; /* byte count of all descriptors */\n};\n\n/*\n * Format of a volume tag\n */\n\nstruct volume_tag {\n\tu_int8_t\tvif[32];\t/* volume identification field */\n\tu_int8_t\treserved[2];\n\tu_int8_t\tvsn[2];\t\t/* volume sequence number */\n};\n\nstruct read_element_status_descriptor {\n\tu_int8_t\teaddr[2];\t/* element address */\n\tu_int8_t\tflags1;\n\n#define READ_ELEMENT_STATUS_FULL\t0x01\n#define READ_ELEMENT_STATUS_IMPEXP\t0x02\n#define READ_ELEMENT_STATUS_EXCEPT\t0x04\n#define READ_ELEMENT_STATUS_ACCESS\t0x08\n#define READ_ELEMENT_STATUS_EXENAB\t0x10\n#define READ_ELEMENT_STATUS_INENAB\t0x20\n\n#define READ_ELEMENT_STATUS_MT_MASK1\t0x05\n#define READ_ELEMENT_STATUS_ST_MASK1\t0x0c\n#define READ_ELEMENT_STATUS_IE_MASK1\t0x3f\n#define READ_ELEMENT_STATUS_DT_MASK1\t0x0c\n\n\tu_int8_t\treserved0;\n\tu_int8_t\tsense_code;\n\tu_int8_t\tsense_qual;\n\n\t/*\n\t * dt_scsi_flags and dt_scsi_addr are valid only on data transport\n\t * elements.  These bytes are undefined for all other element types.\n\t */\n\tu_int8_t\tdt_scsi_flags;\n\n#define READ_ELEMENT_STATUS_DT_LUNMASK\t0x07\n#define READ_ELEMENT_STATUS_DT_LUVALID\t0x10\n#define READ_ELEMENT_STATUS_DT_IDVALID\t0x20\n#define READ_ELEMENT_STATUS_DT_NOTBUS\t0x80\n\n\tu_int8_t\tdt_scsi_addr;\n\n\tu_int8_t\treserved1;\n\n\tu_int8_t\tflags2;\n#define READ_ELEMENT_STATUS_INVERT\t0x40\n#define READ_ELEMENT_STATUS_SVALID\t0x80\n\tu_int8_t\tssea[2];\t/* source storage element address */\n\n\tstruct volume_tag pvoltag;\t/* omitted if PVOLTAG == 0 */\n\tstruct volume_tag avoltag;\t/* omitted if AVOLTAG == 0 */\n\n\t/* Other data may follow */\n};\n\n/* XXX add data returned by REQUEST VOLUME ELEMENT ADDRESS */\n\n/* Element type codes */\n#define ELEMENT_TYPE_MASK\t0x0f\t/* Note: these aren't bits */\n#define ELEMENT_TYPE_ALL\t0x00\n#define ELEMENT_TYPE_MT\t\t0x01\n#define ELEMENT_TYPE_ST\t\t0x02\n#define ELEMENT_TYPE_IE\t\t0x03\n#define ELEMENT_TYPE_DT\t\t0x04\n\n/*\n * XXX The following definitions should be common to all SCSI device types.\n */\n#define PGCODE_MASK\t0x3f\t/* valid page number bits in pg_code */\n#define PGCODE_PS\t0x80\t/* indicates page is savable */\n\n/*\n * Send volume tag information to the changer\n */\n\nstruct scsi_send_volume_tag {\n\tu_int8_t\topcode;\n#define SEND_VOLUME_TAG\t0xb6\n\tu_int8_t\tbyte2;\n\tu_int8_t\tea[2];\t\t/* element address */\n\tu_int8_t\treserved2;\n  \tu_int8_t\tsac;\t\t/* send action code */\n\n#define SEND_VOLUME_TAG_ASSERT_PRIMARY\t\t0x08\n#define SEND_VOLUME_TAG_ASSERT_ALTERNATE\t0x09\n#define SEND_VOLUME_TAG_REPLACE_PRIMARY\t\t0x0a\n#define SEND_VOLUME_TAG_REPLACE_ALTERNATE\t0x0b\n#define SEND_VOLUME_TAG_UNDEFINED_PRIMARY\t0x0c\n#define SEND_VOLUME_TAG_UNDEFINED_ALTERNATE\t0x0d\n\n\tu_int8_t\treserved4[2];\n\tu_int8_t\tpll[2];\t\t/* parameter list length */\n\tu_int8_t\treserved5;\n\tu_int8_t\tcontrol;\n};\n\n/*\n * Parameter format for SEND VOLUME TAG\n */\n\nstruct scsi_send_volume_tag_parameters {\n\tu_int8_t\tvitf[32];\t/* volume tag identification template */\n\tu_int8_t\treserved1[2];\n\tu_int8_t\tminvsn[2];\t/* minimum volume sequence number */\n\tu_int8_t\treserved2[2];\n\tu_int8_t\tmaxvsn[2];\t/* maximum volume sequence number */\n};\n\n/*\n * Device capabilities page.\n *\n * This page defines characteristics of the elemenet types in the\n * medium changer device.\n *\n * Note in the definitions below, the following abbreviations are\n * used:\n *\t\tMT\tMedium transport element (picker)\n *\t\tST\tStorage transport element (slot)\n *\t\tIE\tImport/export element (portal)\n *\t\tDT\tData tranfer element (tape/disk drive)\n */\nstruct page_device_capabilities {\n\tu_int8_t\tpg_code;\t/* page code (0x1f) */\n\tu_int8_t\tpg_length;\t/* page length (0x12) */\n\n\t/*\n\t * The STOR_xx bits indicate that an element of a given\n\t * type may provide independent storage for a unit of\n\t * media.  The top four bits of this value are reserved.\n\t */\n\tu_int8_t\tstor;\n#define STOR_MT\t\t0x01\n#define STOR_ST\t\t0x02\n#define STOR_IE\t\t0x04\n#define STOR_DT\t\t0x08\n\n\tu_int8_t\treserved0;\n\n\t/*\n\t * The MOVE_TO_yy bits indicate the changer supports\n\t * moving a unit of medium from an element of a given type to an\n\t * element of type yy.  This is used to determine if a given\n\t * MOVE MEDIUM command is legal.  The top four bits of each\n\t * of these values are reserved.\n\t */\n\tu_int8_t\tmove_from[CHET_MAX + 1];\n#define MOVE_TO_MT\t0x01\n#define MOVE_TO_ST\t0x02\n#define MOVE_TO_IE\t0x04\n#define MOVE_TO_DT\t0x08\n\n\tu_int8_t\treserved1[4];\n\n\t/*\n\t * Similar to above, but for EXCHANGE MEDIUM.\n\t */\n\tu_int8_t\texchange_with[CHET_MAX + 1];\n#define EXCHANGE_WITH_MT\t0x01\n#define EXCHANGE_WITH_ST\t0x02\n#define EXCHANGE_WITH_IE\t0x04\n#define EXCHANGE_WITH_DT\t0x08\n};\n\n/*\n * Medium changer elemement address assignment page.\n *\n * Some of these fields can be a little confusing, so an explanation\n * is in order.\n *\n * Each component within a a medium changer apparatus is called an\n * \"element\".\n *\n * The \"medium transport element address\" is the address of the first\n * picker (robotic arm).  \"Number of medium transport elements\" tells\n * us how many pickers exist in the changer.\n *\n * The \"first storage element address\" is the address of the first\n * slot in the tape or disk magazine.  \"Number of storage elements\" tells\n * us how many slots exist in the changer.\n *\n * The \"first import/export element address\" is the address of the first\n * medium portal accessible both by the medium changer and an outside\n * human operator.  This is where the changer might deposit tapes destined\n * for some vault.  The \"number of import/export elements\" tells us\n * not many of these portals exist in the changer.  NOTE: this number may\n * be 0.\n *\n * The \"first data transfer element address\" is the address of the first\n * tape or disk drive in the changer.  \"Number of data transfer elements\"\n * tells us how many drives exist in the changer.\n */\nstruct page_element_address_assignment {\n\tu_int8_t\tpg_code;\t/* page code (0x1d) */\n\tu_int8_t\tpg_length;\t/* page length (0x12) */\n\n\t/* Medium transport element address */\n\tu_int8_t\tmtea[2];\n\n\t/* Number of medium transport elements */\n\tu_int8_t\tnmte[2];\n\n\t/* First storage element address */\n\tu_int8_t\tfsea[2];\n\n\t/* Number of storage elements */\n\tu_int8_t\tnse[2];\n\n\t/* First import/export element address */\n\tu_int8_t\tfieea[2];\n\n\t/* Number of import/export elements */\n\tu_int8_t\tniee[2];\n\n\t/* First data transfer element address */\n\tu_int8_t\tfdtea[2];\n\n\t/* Number of data trafer elements */\n\tu_int8_t\tndte[2];\n\n\tu_int8_t\treserved[2];\n};\n\n/*\n * Transport geometry parameters page.\n *\n * Defines whether each medium transport element is a member of a set of\n * elements that share a common robotics subsystem and whether the element\n * is capable of media rotation.  One transport geometry descriptor is\n * transferred for each medium transport element, beginning with the first\n * medium transport element (other than the default transport element address\n * of 0).\n */\nstruct page_transport_geometry_parameters {\n\tu_int8_t\tpg_code;\t/* page code (0x1e) */\n\tu_int8_t\tpg_length;\t/* page length; variable */\n\n\t/* Transport geometry descriptor(s) are here. */\n\n\tu_int8_t\tmisc;\n#define CAN_ROTATE\t0x01\n\n\t/* Member number in transport element set. */\n\tu_int8_t\tmember;\n};\n\n__BEGIN_DECLS\nvoid scsi_move_medium(struct ccb_scsiio *csio, u_int32_t retries,\n\t\t      void (*cbfcnp)(struct cam_periph *, union ccb *),\n\t\t      u_int8_t tag_action, u_int32_t tea, u_int32_t src,\n\t\t      u_int32_t dst, int invert, u_int8_t sense_len,\n\t\t      u_int32_t timeout);\n\nvoid scsi_exchange_medium(struct ccb_scsiio *csio, u_int32_t retries,\n\t\t\t  void (*cbfcnp)(struct cam_periph *, union ccb *),\n\t\t\t  u_int8_t tag_action, u_int32_t tea, u_int32_t src,\n\t\t\t  u_int32_t dst1, u_int32_t dst2, int invert1,\n\t\t\t  int invert2, u_int8_t sense_len, u_int32_t timeout);\n\nvoid scsi_position_to_element(struct ccb_scsiio *csio, u_int32_t retries,\n\t\t\t      void (*cbfcnp)(struct cam_periph *, union ccb *),\n\t\t\t      u_int8_t tag_action, u_int32_t tea, u_int32_t dst,\n\t\t\t      int invert, u_int8_t sense_len,\n\t\t\t      u_int32_t timeout);\n\nvoid scsi_read_element_status(struct ccb_scsiio *csio, u_int32_t retries,\n\t\t\t      void (*cbfcnp)(struct cam_periph *, union ccb *),\n\t\t\t      u_int8_t tag_action, int voltag, u_int32_t sea,\n\t\t\t      u_int32_t count, u_int8_t *data_ptr,\n\t\t\t      u_int32_t dxfer_len, u_int8_t sense_len,\n\t\t\t      u_int32_t timeout);\n\nvoid scsi_initialize_element_status(struct ccb_scsiio *csio, u_int32_t retries,\n\t\t\t       void (*cbfcnp)(struct cam_periph *, union ccb *),\n\t\t\t       u_int8_t tag_action, u_int8_t sense_len,\n\t\t\t       u_int32_t timeout);\nvoid scsi_send_volume_tag(struct ccb_scsiio *csio, u_int32_t retries,\n\t\t\t  void (*cbfcnp)(struct cam_periph *, union ccb *),\n\t\t\t  u_int8_t tag_action, \n\t\t\t  u_int16_t element_address,\n\t\t\t  u_int8_t send_action_code,\n\t\t\t  struct scsi_send_volume_tag_parameters *parameters,\n\t\t\t  u_int8_t sense_len, u_int32_t timeout);\n__END_DECLS\n\n#endif /* _SCSI_SCSI_CH_H */\n"
  },
  {
    "path": "freebsd-headers/cam/scsi/scsi_da.h",
    "content": "/*\n * Structures and definitions for SCSI commands to Direct Access Devices\n */\n\n/*-\n * Some lines of this file come from a file of the name \"scsi.h\"\n * distributed by OSF as part of mach2.5,\n *  so the following disclaimer has been kept.\n *\n * Copyright 1990 by Open Software Foundation,\n * Grenoble, FRANCE\n *\n * \t\tAll Rights Reserved\n *\n *   Permission to use, copy, modify, and distribute this software and\n * its documentation for any purpose and without fee is hereby granted,\n * provided that the above copyright notice appears in all copies and\n * that both the copyright notice and this permission notice appear in\n * supporting documentation, and that the name of OSF or Open Software\n * Foundation not be used in advertising or publicity pertaining to\n * distribution of the software without specific, written prior\n * permission.\n *\n *   OSF DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE\n * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS,\n * IN NO EVENT SHALL OSF BE LIABLE FOR ANY SPECIAL, INDIRECT, OR\n * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\n * LOSS OF USE, DATA OR PROFITS, WHETHER IN ACTION OF CONTRACT,\n * NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION\n * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.\n */\n\n/*-\n * Largely written by Julian Elischer (julian@tfs.com)\n * for TRW Financial Systems.\n *\n * TRW Financial Systems, in accordance with their agreement with Carnegie\n * Mellon University, makes this software available to CMU to distribute\n * or use in any manner that they see fit as long as this message is kept with\n * the software. For this reason TFS also grants any other persons or\n * organisations permission to use or modify this software.\n *\n * TFS supplies this software to be publicly redistributed\n * on the understanding that TFS is not responsible for the correct\n * functioning of this software in any circumstances.\n *\n * Ported to run under 386BSD by Julian Elischer (julian@tfs.com) Sept 1992\n *\n * $FreeBSD: release/9.0.0/sys/cam/scsi/scsi_da.h 139743 2005-01-05 22:34:37Z imp $\n */\n\n#ifndef\t_SCSI_SCSI_DA_H\n#define _SCSI_SCSI_DA_H 1\n\n#include <sys/cdefs.h>\n\nstruct scsi_rezero_unit\n{\n\tu_int8_t opcode;\n#define SRZU_LUN_MASK 0xE0\n\tu_int8_t byte2;\n\tu_int8_t reserved[3];\n\tu_int8_t control;\n};\n\n/*\n * NOTE:  The lower three bits of byte2 of the format CDB are the same as\n * the lower three bits of byte2 of the read defect data CDB, below.\n */\nstruct scsi_format_unit\n{\n\tu_int8_t opcode;\n\tu_int8_t byte2;\n#define FU_FORMAT_MASK\tSRDD10_DLIST_FORMAT_MASK\n#define FU_BLOCK_FORMAT\tSRDD10_BLOCK_FORMAT\n#define FU_BFI_FORMAT\tSRDD10_BYTES_FROM_INDEX_FORMAT\n#define FU_PHYS_FORMAT\tSRDD10_PHYSICAL_SECTOR_FORMAT\n#define FU_CMPLST\t0x08\n#define FU_FMT_DATA\t0x10\n\tu_int8_t vendor_specific;\n\tu_int8_t interleave[2];\n\tu_int8_t control;\n};\n\nstruct scsi_reassign_blocks\n{\n\tu_int8_t opcode;\n\tu_int8_t byte2;\n\tu_int8_t unused[3];\n\tu_int8_t control;\n};\n\nstruct scsi_read_defect_data_10\n{\n\tu_int8_t opcode;\n\n\t/* \n\t * The most significant 3 bits are the LUN, the other 5 are\n\t * reserved.\n\t */\n#define SRDD10_LUN_MASK 0xE0\n\tu_int8_t byte2;\n#define SRDD10_GLIST 0x08\n#define SRDD10_PLIST 0x10\n#define SRDD10_DLIST_FORMAT_MASK 0x07\n#define SRDD10_BLOCK_FORMAT            0x00\n#define SRDD10_BYTES_FROM_INDEX_FORMAT 0x04\n#define SRDD10_PHYSICAL_SECTOR_FORMAT  0x05\n\tu_int8_t format;\n\n\tu_int8_t reserved[4];\n\n\tu_int8_t alloc_length[2];\n\n\tu_int8_t control;\n};\n\nstruct scsi_read_defect_data_12\n{\n\tu_int8_t opcode;\n\n\t/* \n\t * The most significant 3 bits are the LUN, the other 5 are\n\t * reserved.\n\t */\n#define SRDD12_LUN_MASK 0xE0\n\tu_int8_t byte2;\n\n#define SRDD12_GLIST 0x08\n#define SRDD12_PLIST 0x10\n#define SRDD12_DLIST_FORMAT_MASK 0x07\n#define SRDD12_BLOCK_FORMAT            0x00\n#define SRDD12_BYTES_FROM_INDEX_FORMAT 0x04\n#define SRDD12_PHYSICAL_SECTOR_FORMAT  0x05\n\tu_int8_t format;\n\n\tu_int8_t reserved[4];\n\n\tu_int8_t alloc_length[4];\n\n\tu_int8_t control;\n\t\n};\n\n\n/*\n * Opcodes\n */\n#define REZERO_UNIT\t\t0x01\n#define FORMAT_UNIT\t\t0x04\n#define\tREASSIGN_BLOCKS\t\t0x07\n#define MODE_SELECT\t\t0x15\n#define MODE_SENSE\t\t0x1a\n#define\tREAD_FORMAT_CAPACITIES\t0x23\n#define\tWRITE_AND_VERIFY\t0x2e\n#define\tVERIFY\t\t\t0x2f\n#define READ_DEFECT_DATA_10\t0x37\n#define READ_DEFECT_DATA_12\t0xb7\n\nstruct format_defect_list_header\n{\n\tu_int8_t reserved;\n\tu_int8_t byte2;\n#define FU_DLH_VS\t0x01\n#define FU_DLH_IMMED\t0x02\n#define FU_DLH_DSP\t0x04\n#define FU_DLH_IP\t0x08\n#define FU_DLH_STPF\t0x10\n#define FU_DLH_DCRT\t0x20\n#define FU_DLH_DPRY\t0x40\n#define FU_DLH_FOV\t0x80\n\tu_int8_t defect_list_length[2];\n};\n\nstruct format_ipat_descriptor\n{\n\tu_int8_t byte1;\n#define\tFU_INIT_NO_HDR\t\t0x00\n#define FU_INIT_LBA_MSB\t\t0x40\n#define FU_INIT_LBA_EACH\t0x80\n#define FU_INIT_SI\t\t0x20\n\tu_int8_t pattern_type;\n#define FU_INIT_PAT_DEFAULT\t0x00\n#define FU_INIT_PAT_REPEAT\t0x01\n\tu_int8_t pat_length[2];\n};\n\nstruct scsi_read_format_capacities\n{\n\tuint8_t\topcode;\t\t/* READ_FORMAT_CAPACITIES */\n\tuint8_t\tbyte2;\n#define\tSRFC_LUN_MASK\t0xE0\n\tuint8_t\treserved0[5];\n\tuint8_t\talloc_length[2];\n\tuint8_t\treserved1[3];\n};\n\nstruct scsi_verify\n{\n\tuint8_t\topcode;\t\t/* VERIFY */\n\tuint8_t\tbyte2;\n#define\tSVFY_LUN_MASK\t0xE0\n#define\tSVFY_RELADR\t0x01\n#define\tSVFY_BYTECHK\t0x02\n#define\tSVFY_DPO\t0x10\n\tuint8_t\taddr[4];\t/* LBA to begin verification at */\n\tuint8_t\treserved0[1];\n\tuint8_t\tlen[2];\t\t/* number of blocks to verify */\n\tuint8_t\treserved1[3];\n};\n\nstruct scsi_write_and_verify\n{\n\tuint8_t\topcode;\t\t/* WRITE_AND_VERIFY */\n\tuint8_t\tbyte2;\n#define\tSWVY_LUN_MASK\t0xE0\n#define\tSWVY_RELADR\t0x01\n#define\tSWVY_BYTECHK\t0x02\n#define\tSWVY_DPO\t0x10\n\tuint8_t\taddr[4];\t/* LBA to begin verification at */\n\tuint8_t\treserved0[1];\n\tuint8_t\tlen[2];\t\t/* number of blocks to write and verify */\n\tuint8_t\treserved1[3];\n};\n\n/*\n * Replies to READ_FORMAT_CAPACITIES look like this:\n *\n * struct format_capacity_list_header\n * struct format_capacity_descriptor[1..n]\n *\n * These are similar, but not totally identical to, the\n * defect list used to format a rigid disk.\n *\n * The appropriate csio_decode() format string looks like this:\n * \"{} *i3 {Len} i1 {Blocks} i4 {} *b6 {Code} b2 {Blocklen} i3\"\n *\n * If the capacity_list_length is greater than\n * sizeof(struct format_capacity_descriptor), then there are\n * additional format capacity descriptors available which\n * denote which format(s) the drive can handle.\n *\n * (Source: USB Mass Storage UFI Specification)\n */\n\nstruct format_capacity_list_header {\n\tuint8_t\tunused[3];\n\tuint8_t\tcapacity_list_length;\n};\n\nstruct format_capacity_descriptor {\n\tuint8_t\tnblocks[4];\t/* total number of LBAs */\n\tuint8_t\tbyte4;\t\t/* only present in max/cur descriptor */\n#define FCD_CODE_MASK\t0x03\t/* mask for code field above */\n#define FCD_UNFORMATTED\t0x01\t/* unformatted media present,\n\t\t\t\t * maximum capacity returned */\n#define FCD_FORMATTED\t0x02\t/* formatted media present,\n\t\t\t\t * current capacity returned */\n#define FCD_NOMEDIA\t0x03\t/* no media present,\n\t\t\t\t * maximum device capacity returned */\n\tuint8_t\tblock_length[3];\t/* length of an LBA in bytes */\n};\n\nstruct scsi_reassign_blocks_data\n{\n\tu_int8_t reserved[2];\n\tu_int8_t length[2];\n\tstruct {\n\t\tu_int8_t dlbaddr[4];\t/* defect logical block address */\n\t} defect_descriptor[1];\n};\n\n\n/*\n * This is the list header for the READ DEFECT DATA(10) command above.\n * It may be a bit wrong to append the 10 at the end of the data structure,\n * since it's only 4 bytes but it does tie it to the 10 byte command.\n */\nstruct scsi_read_defect_data_hdr_10\n{\n\tu_int8_t reserved;\n#define SRDDH10_GLIST 0x08\n#define SRDDH10_PLIST 0x10\n#define SRDDH10_DLIST_FORMAT_MASK 0x07\n#define SRDDH10_BLOCK_FORMAT            0x00\n#define SRDDH10_BYTES_FROM_INDEX_FORMAT 0x04\n#define SRDDH10_PHYSICAL_SECTOR_FORMAT  0x05\n\tu_int8_t format;\n\tu_int8_t length[2];\n};\n\nstruct scsi_defect_desc_block\n{\n\tu_int8_t address[4];\n};\n\nstruct scsi_defect_desc_bytes_from_index\n{\n\tu_int8_t cylinder[3];\n\tu_int8_t head;\n\tu_int8_t bytes_from_index[4];\n};\n\nstruct scsi_defect_desc_phys_sector\n{\n\tu_int8_t cylinder[3];\n\tu_int8_t head;\n\tu_int8_t sector[4];\n};\n\nstruct scsi_read_defect_data_hdr_12\n{\n\tu_int8_t reserved;\n#define SRDDH12_GLIST 0x08\n#define SRDDH12_PLIST 0x10\n#define SRDDH12_DLIST_FORMAT_MASK 0x07\n#define SRDDH12_BLOCK_FORMAT            0x00\n#define SRDDH12_BYTES_FROM_INDEX_FORMAT 0x04\n#define SRDDH12_PHYSICAL_SECTOR_FORMAT  0x05\n\tu_int8_t format;\n\tu_int8_t length[4];\n};\n\nunion\tdisk_pages /* this is the structure copied from osf */\n{\n\tstruct format_device_page {\n\t\tu_int8_t pg_code;\t/* page code (should be 3)\t      */\n#define\tSMS_FORMAT_DEVICE_PAGE\t0x03\t/* only 6 bits valid */\n\t\tu_int8_t pg_length;\t/* page length (should be 0x16)\t      */\n#define\tSMS_FORMAT_DEVICE_PLEN\t0x16\n\t\tu_int8_t trk_z_1;\t/* tracks per zone (MSB)\t      */\n\t\tu_int8_t trk_z_0;\t/* tracks per zone (LSB)\t      */\n\t\tu_int8_t alt_sec_1;\t/* alternate sectors per zone (MSB)   */\n\t\tu_int8_t alt_sec_0;\t/* alternate sectors per zone (LSB)   */\n\t\tu_int8_t alt_trk_z_1;\t/* alternate tracks per zone (MSB)    */\n\t\tu_int8_t alt_trk_z_0;\t/* alternate tracks per zone (LSB)    */\n\t\tu_int8_t alt_trk_v_1;\t/* alternate tracks per volume (MSB)  */\n\t\tu_int8_t alt_trk_v_0;\t/* alternate tracks per volume (LSB)  */\n\t\tu_int8_t ph_sec_t_1;\t/* physical sectors per track (MSB)   */\n\t\tu_int8_t ph_sec_t_0;\t/* physical sectors per track (LSB)   */\n\t\tu_int8_t bytes_s_1;\t/* bytes per sector (MSB)\t      */\n\t\tu_int8_t bytes_s_0;\t/* bytes per sector (LSB)\t      */\n\t\tu_int8_t interleave_1;\t/* interleave (MSB)\t\t      */\n\t\tu_int8_t interleave_0;\t/* interleave (LSB)\t\t      */\n\t\tu_int8_t trk_skew_1;\t/* track skew factor (MSB)\t      */\n\t\tu_int8_t trk_skew_0;\t/* track skew factor (LSB)\t      */\n\t\tu_int8_t cyl_skew_1;\t/* cylinder skew (MSB)\t\t      */\n\t\tu_int8_t cyl_skew_0;\t/* cylinder skew (LSB)\t\t      */\n\t\tu_int8_t flags;\t\t/* various */\n#define\t\t\tDISK_FMT_SURF\t0x10\n#define\t       \t\tDISK_FMT_RMB\t0x20\n#define\t\t\tDISK_FMT_HSEC\t0x40\n#define\t\t\tDISK_FMT_SSEC\t0x80\n\t\tu_int8_t reserved21;\n\t\tu_int8_t reserved22;\n\t\tu_int8_t reserved23;\n\t} format_device;\n\tstruct rigid_geometry_page {\n\t\tu_int8_t pg_code;\t/* page code (should be 4)\t      */\n#define SMS_RIGID_GEOMETRY_PAGE 0x04\n\t\tu_int8_t pg_length;\t/* page length (should be 0x16)\t      */\n#define SMS_RIGID_GEOMETRY_PLEN 0x16\t\t\n\t\tu_int8_t ncyl_2;\t/* number of cylinders (MSB)\t      */\n\t\tu_int8_t ncyl_1;\t/* number of cylinders \t\t      */\n\t\tu_int8_t ncyl_0;\t/* number of cylinders (LSB)\t      */\n\t\tu_int8_t nheads;\t/* number of heads \t\t      */\n\t\tu_int8_t st_cyl_wp_2;\t/* starting cyl., write precomp (MSB) */\n\t\tu_int8_t st_cyl_wp_1;\t/* starting cyl., write precomp\t      */\n\t\tu_int8_t st_cyl_wp_0;\t/* starting cyl., write precomp (LSB) */\n\t\tu_int8_t st_cyl_rwc_2;\t/* starting cyl., red. write cur (MSB)*/\n\t\tu_int8_t st_cyl_rwc_1;\t/* starting cyl., red. write cur      */\n\t\tu_int8_t st_cyl_rwc_0;\t/* starting cyl., red. write cur (LSB)*/\n\t\tu_int8_t driv_step_1;\t/* drive step rate (MSB)\t      */\n\t\tu_int8_t driv_step_0;\t/* drive step rate (LSB)\t      */\n\t\tu_int8_t land_zone_2;\t/* landing zone cylinder (MSB)\t      */\n\t\tu_int8_t land_zone_1;\t/* landing zone cylinder \t      */\n\t\tu_int8_t land_zone_0;\t/* landing zone cylinder (LSB)\t      */\n\t\tu_int8_t rpl;\t\t/* rotational position locking (2 bits) */\n\t\tu_int8_t rot_offset;\t/* rotational offset */\n\t\tu_int8_t reserved19;\n\t\tu_int8_t medium_rot_rate_1; /* medium rotation rate (RPM) (MSB) */\n\t\tu_int8_t medium_rot_rate_0; /* medium rotation rate (RPM) (LSB) */\n\t\tu_int8_t reserved22;\n\t\tu_int8_t reserved23;\n    \t} rigid_geometry;\n\tstruct flexible_disk_page {\n\t\tu_int8_t pg_code;\t/* page code (should be 5)\t      */\n#define SMS_FLEXIBLE_GEOMETRY_PAGE 0x05\n\t\tu_int8_t pg_length;\t/* page length (should be 0x1E)\t      */\n#define SMS_FLEXIBLE_GEOMETRY_PLEN 0x1E\n\t\tu_int8_t xfr_rate_1;\t/* transfer rate (MSB)\t\t      */\n\t\tu_int8_t xfr_rate_0;\t/* transfer rate (LSB)\t\t      */\n\t\tu_int8_t nheads;\t/* number of heads \t\t      */\n\t\tu_int8_t sec_per_track;\t/* Sectors per track\t\t      */\n\t\tu_int8_t bytes_s_1;\t/* bytes per sector (MSB)\t      */\n\t\tu_int8_t bytes_s_0;\t/* bytes per sector (LSB)\t      */\n\t\tu_int8_t ncyl_1;\t/* number of cylinders (MSB)\t      */\n\t\tu_int8_t ncyl_0;\t/* number of cylinders (LSB)\t      */\n\t\tu_int8_t st_cyl_wp_1;\t/* starting cyl., write precomp (MSB) */\n\t\tu_int8_t st_cyl_wp_0;\t/* starting cyl., write precomp (LSB) */\n\t\tu_int8_t st_cyl_rwc_1;\t/* starting cyl., red. write cur (MSB)*/\n\t\tu_int8_t st_cyl_rwc_0;\t/* starting cyl., red. write cur (LSB)*/\t\t\n\t\tu_int8_t driv_step_1;\t/* drive step rate (MSB)\t      */\n\t\tu_int8_t driv_step_0;\t/* drive step rate (LSB)\t      */\n\t\tu_int8_t driv_step_pw;\t/* drive step pulse width\t      */\n\t\tu_int8_t head_stl_del_1;/* Head settle delay (MSB)\t      */\n\t\tu_int8_t head_stl_del_0;/* Head settle delay (LSB)\t      */\n\t\tu_int8_t motor_on_del;\t/* Motor on delay\t\t      */\n\t\tu_int8_t motor_off_del;\t/* Motor off delay\t\t      */\n\t\tu_int8_t trdy_ssn_mo;\t/* XXX ??? */\n\t\tu_int8_t spc;\t\t/* XXX ??? */\n\t\tu_int8_t write_comp;\t/* Write compensation */\n\t\tu_int8_t head_load_del; /* Head load delay */\n\t\tu_int8_t head_uload_del;/* Head un-load delay */\n\t\tu_int8_t pin32_pin2;\n\t\tu_int8_t pin4_pint1;\n\t\tu_int8_t medium_rot_rate_1; /* medium rotation rate (RPM) (MSB) */\n\t\tu_int8_t medium_rot_rate_0; /* medium rotation rate (RPM) (LSB) */\t\t\n\t\tu_int8_t reserved30;\n\t\tu_int8_t reserved31;\n    \t} flexible_disk;\t\n};\n\nstruct scsi_da_rw_recovery_page {\n\tu_int8_t page_code;\n#define SMS_RW_ERROR_RECOVERY_PAGE\t0x01\n\tu_int8_t page_length;\n\tu_int8_t byte3;\n#define SMS_RWER_AWRE\t\t\t0x80\n#define SMS_RWER_ARRE\t\t\t0x40\n#define SMS_RWER_TB\t\t\t0x20\n#define SMS_RWER_RC\t\t\t0x10\n#define SMS_RWER_EER\t\t\t0x08\n#define SMS_RWER_PER\t\t\t0x04\n#define SMS_RWER_DTE\t\t\t0x02\n#define SMS_RWER_DCR\t\t\t0x01\n\tu_int8_t read_retry_count;\n\tu_int8_t correction_span;\n\tu_int8_t head_offset_count;\n\tu_int8_t data_strobe_offset_cnt;\n\tu_int8_t reserved;\n\tu_int8_t write_retry_count;\n\tu_int8_t reserved2;\n\tu_int8_t recovery_time_limit[2];\n};\n\n__BEGIN_DECLS\n/*\n * XXX This is only left out of the kernel build to silence warnings.  If,\n * for some reason this function is used in the kernel, the ifdefs should\n * be moved so it is included both in the kernel and userland.\n */\n#ifndef _KERNEL\nvoid scsi_format_unit(struct ccb_scsiio *csio, u_int32_t retries,\n\t\t      void (*cbfcnp)(struct cam_periph *, union ccb *),\n\t\t      u_int8_t tag_action, u_int8_t byte2, u_int16_t ileave,\n\t\t      u_int8_t *data_ptr, u_int32_t dxfer_len,\n\t\t      u_int8_t sense_len, u_int32_t timeout);\n\n#endif /* !_KERNEL */\n__END_DECLS\n\n#endif /* _SCSI_SCSI_DA_H */\n"
  },
  {
    "path": "freebsd-headers/cam/scsi/scsi_dvcfg.h",
    "content": "/*\t$FreeBSD: release/9.0.0/sys/cam/scsi/scsi_dvcfg.h 139743 2005-01-05 22:34:37Z imp $\t*/\n/*\t$NecBSD: scsi_dvcfg.h,v 1.4 1998/03/14 07:05:06 kmatsuda Exp $\t*/\n/*\t$NetBSD$\t*/\n\n/*-\n * [NetBSD for NEC PC-98 series]\n *  Copyright (c) 1994, 1995, 1996, 1997, 1998\n *\tNetBSD/pc98 porting staff. All rights reserved.\n *  Copyright (c) 1994, 1995, 1996, 1997, 1998\n *\tNaofumi HONDA. All rights reserved.\n * \n *  Redistribution and use in source and binary forms, with or without\n *  modification, are permitted provided that the following conditions\n *  are met:\n *  1. Redistributions of source code must retain the above copyright\n *     notice, this list of conditions and the following disclaimer.\n *  2. Redistributions in binary form must reproduce the above copyright\n *     notice, this list of conditions and the following disclaimer in the\n *     documentation and/or other materials provided with the distribution.\n *  3. The name of the author may not be used to endorse or promote products\n *     derived from this software without specific prior written permission.\n * \n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR\n * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\n * DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR\n * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,\n * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\n#ifndef\t_SCSI_DVCFG_H_\n#define\t_SCSI_DVCFG_H_\n\n/* common dvcfg flags defitions for bs, ncv, stg */\n\n#define\tDVF_SCSI_SYNC\t\t0x01\n#define\tDVF_SCSI_DISC\t\t0x02\n#define\tDVF_SCSI_WAIT\t\t0x04\n#define\tDVF_SCSI_LINK\t\t0x08\n#define\tDVF_SCSI_QTAG\t\t0x10\n#define\tDVF_SCSI_SP0\t\t0x100\n#define\tDVF_SCSI_NOPARITY\t0x200\n#define\tDVF_SCSI_SAVESP\t\t0x400\n#define\tDVF_SCSI_SP1\t\t0x800\n#define\tDVF_SCSI_PERIOD(XXX)\t(((XXX) >> 24) & 0xff)\n#define\tDVF_SCSI_OFFSET(XXX)\t(((XXX) >> 16) & 0xff)\n#define DVF_SCSI_SYNCMASK\t0xffff0000\n\n#define\tDVF_SCSI_DEFCFG\t(DVF_SCSI_SYNC | DVF_SCSI_NOPARITY | DVF_SCSI_SYNCMASK)\n\n#define\tDVF_SCSI_BITS\t\t\"\\020\\13fssp\\12noparity\\11nosat\\005qtag\\004cmdlnk\\003wait\\002disc\\001sync\"\n\n#endif\t/* !_SCSI_DVCFG_H_ */\n"
  },
  {
    "path": "freebsd-headers/cam/scsi/scsi_iu.h",
    "content": "/*-\n * This file is in the public domain.\n * $FreeBSD: release/9.0.0/sys/cam/scsi/scsi_iu.h 139743 2005-01-05 22:34:37Z imp $\n */\n#ifndef\t_SCSI_SCSI_IU_H\n#define _SCSI_SCSI_IU_H 1\n\nstruct scsi_status_iu_header\n{\n\tu_int8_t reserved[2];\n\tu_int8_t flags;\n#define\tSIU_SNSVALID 0x2\n#define\tSIU_RSPVALID 0x1\n\tu_int8_t status;\n\tu_int8_t sense_length[4];\n\tu_int8_t pkt_failures_length[4];\n\tu_int8_t pkt_failures[1];\n};\n\n#define SIU_PKTFAIL_OFFSET(siu) 12\n#define SIU_PKTFAIL_CODE(siu) (scsi_4btoul((siu)->pkt_failures) & 0xFF)\n#define\t\tSIU_PFC_NONE\t\t\t0\n#define\t\tSIU_PFC_CIU_FIELDS_INVALID\t2\n#define\t\tSIU_PFC_TMF_NOT_SUPPORTED\t4\n#define\t\tSIU_PFC_TMF_FAILED\t\t5\n#define\t\tSIU_PFC_INVALID_TYPE_CODE\t6\n#define\t\tSIU_PFC_ILLEGAL_REQUEST\t\t7\n#define SIU_SENSE_OFFSET(siu)\t\t\t\t\\\n    (12 + (((siu)->flags & SIU_RSPVALID)\t\t\\\n\t? scsi_4btoul((siu)->pkt_failures_length)\t\\\n\t: 0))\n\n#define\tSIU_TASKMGMT_NONE\t\t0x00\n#define\tSIU_TASKMGMT_ABORT_TASK\t\t0x01\n#define\tSIU_TASKMGMT_ABORT_TASK_SET\t0x02\n#define\tSIU_TASKMGMT_CLEAR_TASK_SET\t0x04\n#define\tSIU_TASKMGMT_LUN_RESET\t\t0x08\n#define\tSIU_TASKMGMT_TARGET_RESET\t0x20\n#define\tSIU_TASKMGMT_CLEAR_ACA\t\t0x40\n#endif /*_SCSI_SCSI_IU_H*/\n"
  },
  {
    "path": "freebsd-headers/cam/scsi/scsi_low.h",
    "content": "/*\t$FreeBSD: release/9.0.0/sys/cam/scsi/scsi_low.h 174898 2007-12-25 17:52:02Z rwatson $\t*/\n/*\t$NecBSD: scsi_low.h,v 1.24.10.5 2001/06/26 07:31:46 honda Exp $\t*/\n/*\t$NetBSD$\t*/\n\n#define\tSCSI_LOW_DIAGNOSTIC\n#define\tSCSI_LOW_ALT_QTAG_ALLOCATE\n\n/*-\n * [NetBSD for NEC PC-98 series]\n *  Copyright (c) 1995, 1996, 1997, 1998, 1999, 2000, 2001\n *\tNetBSD/pc98 porting staff. All rights reserved.\n *  Copyright (c) 1995, 1996, 1997, 1998, 1999, 2000, 2001\n *\tNaofumi HONDA. All rights reserved.\n *\n * [Ported for FreeBSD CAM]\n *  Copyright (c) 2000, 2001\n *      MITSUNAGA Noriaki, NOKUBI Hirotaka and TAKAHASHI Yoshihiro.\n *      All rights reserved.\n * \n *  Redistribution and use in source and binary forms, with or without\n *  modification, are permitted provided that the following conditions\n *  are met:\n *  1. Redistributions of source code must retain the above copyright\n *     notice, this list of conditions and the following disclaimer.\n *  2. Redistributions in binary form must reproduce the above copyright\n *     notice, this list of conditions and the following disclaimer in the\n *     documentation and/or other materials provided with the distribution.\n *  3. The name of the author may not be used to endorse or promote products\n *     derived from this software without specific prior written permission.\n * \n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR\n * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\n * DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR\n * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,\n * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\n#ifndef\t_SCSI_LOW_H_\n#define\t_SCSI_LOW_H_\n\n/*================================================\n * Scsi low OSDEP \n * (All os depend structures should be here!)\n ================================================*/\n/******** interface ******************************/\n#ifdef\t__NetBSD__\n#define\tSCSI_LOW_INTERFACE_XS\n#endif\t/* __NetBSD__ */\n\n#ifdef\t__FreeBSD__\n#define\tSCSI_LOW_INTERFACE_CAM\n#define\tCAM\n#endif\t/* __FreeBSD__ */\n\n/******** includes *******************************/\n#ifdef\t__NetBSD__\n#include <i386/Cbus/dev/scsi_dvcfg.h>\n#include <dev/isa/ccbque.h>\n#endif\t/* __NetBSD__ */\n\n#ifdef\t__FreeBSD__\n#include <sys/device_port.h>\n#include <sys/kdb.h>\n#include <cam/cam.h>\n#include <cam/cam_ccb.h>\n#include <cam/cam_sim.h>\n#include <cam/cam_xpt_sim.h>\n#include <cam/cam_debug.h>\n\n#include <cam/scsi/scsi_dvcfg.h>\n#include <i386/isa/ccbque.h>\n#endif\t/* __FreeBSD__ */\n\n/******** functions macro ************************/\n#ifdef\t__NetBSD__\n#define\tSCSI_LOW_DEBUGGER(dev)\tDebugger()\n#define\tSCSI_LOW_DELAY(mu)\tdelay((mu))\n#define\tSCSI_LOW_SPLSCSI\tsplbio\n#define\tSCSI_LOW_BZERO(pt, size)\tmemset((pt), 0, (size))\n#endif\t/* __NetBSD__ */\n\n#ifdef\t__FreeBSD__\n#undef\tMSG_IDENTIFY\n#define\tSCSI_LOW_DEBUGGER(dev)\tkdb_enter(KDB_WHY_CAM, dev)\n#define\tSCSI_LOW_DELAY(mu)\tDELAY((mu))\n#define\tSCSI_LOW_SPLSCSI\tsplcam\n#define\tSCSI_LOW_BZERO(pt, size)\tbzero((pt), (size))\n#endif\t/* __FreeBSD__ */\n\n/******** os depend interface structures **********/\n#ifdef\t__NetBSD__\ntypedef\tstruct scsipi_sense_data scsi_low_osdep_sense_data_t;\n\nstruct scsi_low_osdep_interface {\n\tstruct device si_dev;\n\n\tstruct scsipi_link *si_splp;\n};\n\nstruct scsi_low_osdep_targ_interface {\n};\n\nstruct scsi_low_osdep_lun_interface {\n\tu_int sloi_quirks;\n};\n#endif\t/* __NetBSD__ */\n\n#ifdef\t__FreeBSD__\ntypedef\tstruct scsi_sense_data scsi_low_osdep_sense_data_t;\n\nstruct scsi_low_osdep_interface {\n\tDEVPORT_DEVICE si_dev;\n\n\tstruct cam_sim *sim;\n\tstruct cam_path *path;\n\n\tint si_poll_count;\n\n\tstruct callout_handle engage_ch;\n\tstruct callout_handle timeout_ch;\n#ifdef\tSCSI_LOW_POWFUNC\n\tstruct callout_handle recover_ch;\n#endif\n};\n\nstruct scsi_low_osdep_targ_interface {\n};\n\nstruct scsi_low_osdep_lun_interface {\n};\n#endif\t/* __FreeBSD__ */\n\n/******** os depend interface functions *************/\nstruct slccb;\nstruct scsi_low_softc;\n#define\tSCSI_LOW_TIMEOUT_STOP\t\t0\n#define\tSCSI_LOW_TIMEOUT_START\t\t1\n#define\tSCSI_LOW_TIMEOUT_CH_IO\t\t0\n#define\tSCSI_LOW_TIMEOUT_CH_ENGAGE\t1\n#define\tSCSI_LOW_TIMEOUT_CH_RECOVER\t2\n\nstruct scsi_low_osdep_funcs {\n\tint (*scsi_low_osdep_attach) \\\n\t\t\t(struct scsi_low_softc *);\n\tint (*scsi_low_osdep_world_start) \\\n\t\t\t(struct scsi_low_softc *);\n\tint (*scsi_low_osdep_dettach) \\\n\t\t\t(struct scsi_low_softc *);\n\tint (*scsi_low_osdep_ccb_setup) \\\n\t\t\t(struct scsi_low_softc *, struct slccb *);\n\tint (*scsi_low_osdep_done) \\\n\t\t\t(struct scsi_low_softc *, struct slccb *);\n\tvoid (*scsi_low_osdep_timeout) \\\n\t\t\t(struct scsi_low_softc *, int, int);\n};\n\n/*================================================\n * Generic Scsi Low header file \n * (All os depend structures should be above!)\n ================================================*/\n/*************************************************\n * Scsi low definitions\n *************************************************/\n#define\tSCSI_LOW_SYNC\t\tDVF_SCSI_SYNC\n#define\tSCSI_LOW_DISC\t\tDVF_SCSI_DISC\n#define\tSCSI_LOW_WAIT\t\tDVF_SCSI_WAIT\n#define\tSCSI_LOW_LINK\t\tDVF_SCSI_LINK\n#define\tSCSI_LOW_QTAG\t\tDVF_SCSI_QTAG\n#define\tSCSI_LOW_NOPARITY\tDVF_SCSI_NOPARITY\n#define\tSCSI_LOW_SAVESP\t\tDVF_SCSI_SAVESP\n#define\tSCSI_LOW_DEFCFG\t\tDVF_SCSI_DEFCFG\n#define\tSCSI_LOW_BITS\t\tDVF_SCSI_BITS\n\n#define\tSCSI_LOW_PERIOD(n)\tDVF_SCSI_PERIOD(n)\n#define\tSCSI_LOW_OFFSET(n)\tDVF_SCSI_OFFSET(n)\n\n/* host scsi id and targets macro */\n#ifndef\tSCSI_LOW_NTARGETS\n#define\tSCSI_LOW_NTARGETS\t\t\t8\n#endif\t/* SCSI_LOW_NTARGETS */\n#define\tSCSI_LOW_NCCB\t\t\t\t128\n\n#define\tSCSI_LOW_MAX_RETRY\t\t\t3\n#define\tSCSI_LOW_MAX_SELECTION_RETRY\t\t10\n\n/* timeout control macro */\n#define\tSCSI_LOW_TIMEOUT_HZ\t\t\t10\n#define SCSI_LOW_MIN_TOUT\t\t\t12\n#define SCSI_LOW_TIMEOUT_CHECK_INTERVAL \t1\n#define\tSCSI_LOW_POWDOWN_TC\t\t\t15\n#define\tSCSI_LOW_MAX_PHCHANGES\t\t\t256\n#define\tSCSI2_RESET_DELAY\t\t\t5000000\n\n/* msg */\n#define\tSCSI_LOW_MAX_MSGLEN\t\t\t32\n#define\tSCSI_LOW_MSG_LOG_DATALEN  \t\t8\n\n/*************************************************\n * Scsi Data Pointer\n *************************************************/\n/* scsi pointer */\nstruct sc_p {\n\tu_int8_t *scp_data;\n\tint scp_datalen;\n\n\tu_int8_t *scp_cmd;\n\tint scp_cmdlen;\n\n\tu_int8_t scp_direction;\n#define\tSCSI_LOW_RWUNK\t(-1)\n#define\tSCSI_LOW_WRITE\t0\n#define\tSCSI_LOW_READ\t1\n\tu_int8_t scp_status;\n\tu_int8_t scp_spare[2];\n};\n\n/*************************************************\n * Command Control Block Structure\n *************************************************/\ntypedef int scsi_low_tag_t;\t\t\t\nstruct targ_info;\n\n#define\tSCSI_LOW_UNKLUN\t((u_int) -1)\n#define\tSCSI_LOW_UNKTAG\t((scsi_low_tag_t) -1)\n\nstruct slccb {\n\tTAILQ_ENTRY(slccb) ccb_chain;\n\n\tvoid *osdep;\t\t\t/* os depend structure */\n\n\tstruct targ_info *ti;\t\t/* targ_info */\n\tstruct lun_info *li;\t\t/* lun info */\n\tstruct buf *bp;\t\t\t/* io bufs */\n\n\tscsi_low_tag_t ccb_tag;\t\t/* effective qtag */\n\tscsi_low_tag_t ccb_otag;\t/* allocated qtag */\n\n\t/*****************************************\n\t * Scsi data pointers (original and saved)\n\t *****************************************/\n\tstruct sc_p ccb_scp;\t\t/* given */\n\tstruct sc_p ccb_sscp;\t\t/* saved scsi data pointer */\n\tint ccb_datalen;\t\t/* transfered data counter */\n\n\t/*****************************************\n\t * Msgout \n\t *****************************************/\n\tu_int ccb_msgoutflag;\n\tu_int ccb_omsgoutflag;\n\n\t/*****************************************\n\t * Error or Timeout counters\n\t *****************************************/\n\tu_int ccb_flags;\n#define\tCCB_INTERNAL\t0x0001\n#define\tCCB_SENSE\t0x0002\n#define\tCCB_CLEARQ\t0x0004\n#define\tCCB_DISCQ\t0x0008\n#define\tCCB_STARTQ\t0x0010\n#define\tCCB_POLLED\t0x0100\t/* polling ccb */\n#define\tCCB_NORETRY\t0x0200\t/* do NOT retry */\n#define\tCCB_AUTOSENSE\t0x0400\t/* do a sence after CA */\n#define\tCCB_URGENT\t0x0800\t/* an urgent ccb */\n#define\tCCB_NOSDONE\t0x1000\t/* do not call an os done routine */\n#define\tCCB_SCSIIO\t0x2000\t/* a normal scsi io coming from upper layer */\n#define\tCCB_SILENT\t0x4000\t/* no terminate messages */\n\n\tu_int ccb_error;\n\n\tint ccb_rcnt;\t\t\t/* retry counter */\n\tint ccb_selrcnt;\t\t/* selection retry counter */\n\tint ccb_tc;\t\t\t/* timer counter */\n\tint ccb_tcmax;\t\t\t/* max timeout */\n\n\t/*****************************************\n\t * Sense data buffer\n\t *****************************************/\n\tu_int8_t ccb_scsi_cmd[12];\n\tscsi_low_osdep_sense_data_t ccb_sense;\n};\n\n/*************************************************\n * Slccb functions\n *************************************************/\nGENERIC_CCB_ASSERT(scsi_low, slccb)\n\n/*************************************************\n * Target and Lun structures\n *************************************************/\nstruct scsi_low_softc;\nLIST_HEAD(scsi_low_softc_tab, scsi_low_softc);\nTAILQ_HEAD(targ_info_tab, targ_info);\nLIST_HEAD(lun_info_tab, lun_info);\n\nstruct lun_info {\n\tstruct scsi_low_osdep_lun_interface li_sloi;\n\n\tint li_lun;\n\tstruct targ_info *li_ti;\t\t/* my target */\n\n\tLIST_ENTRY(lun_info) lun_chain;\t\t/* targ_info link */\n\n\tstruct slccbtab li_discq;\t\t\t/* disconnect queue */\n\n\t/*\n\t * qtag control\n\t */\n\tint li_maxnexus;\n\tint li_maxnqio;\t\n\tint li_nqio;\n\tint li_disc;\n\n#define\tSCSI_LOW_MAXNEXUS (sizeof(u_int) * NBBY)\n\tu_int li_qtagbits;\n\n#ifdef\tSCSI_LOW_ALT_QTAG_ALLOCATE\n\tu_int8_t li_qtagarray[SCSI_LOW_MAXNEXUS];\n\tu_int li_qd;\n#endif\t/* SCSI_LOW_ALT_QTAG_ALLOCATE */\n\n#define\tSCSI_LOW_QFLAG_CA_QCLEAR\t0x01\n\tu_int li_qflags;\n\n\t/*\n\t * lun state\n\t */\n#define\tSCSI_LOW_LUN_SLEEP\t0x00\n#define\tSCSI_LOW_LUN_START\t0x01\n#define\tSCSI_LOW_LUN_INQ\t0x02\n#define\tSCSI_LOW_LUN_MODEQ\t0x03\n#define\tSCSI_LOW_LUN_OK\t\t0x04\n\tu_int li_state;\t\t\t\t/* target lun state */\n\n\t/*\n\t * lun control flags\n \t */\n\tu_int li_flags_valid;\t/* valid flags */\n#define\tSCSI_LOW_LUN_FLAGS_USER_VALID\t0x0001\n#define\tSCSI_LOW_LUN_FLAGS_DISK_VALID\t0x0002\n#define\tSCSI_LOW_LUN_FLAGS_QUIRKS_VALID\t0x0004\n#define\tSCSI_LOW_LUN_FLAGS_ALL_VALID \\\n\t(SCSI_LOW_LUN_FLAGS_USER_VALID | \\\n\t SCSI_LOW_LUN_FLAGS_DISK_VALID | SCSI_LOW_LUN_FLAGS_QUIRKS_VALID)\n\n\tu_int li_flags;\t\t/* real lun control flags */\n\tu_int li_cfgflags;\t/* lun control flags given by user */\n\tu_int li_diskflags;\t/* lun control flags given by hardware info */\n\tu_int li_quirks;\t/* lun control flags given by upper layer */\n\n\t/* inq buffer */\n\tstruct scsi_low_inq_data {\n\t\tu_int8_t sd_type;\t\n\t\tu_int8_t sd_sp1;\n\t\tu_int8_t sd_version;\n\t\tu_int8_t sd_resp;\n\t\tu_int8_t sd_len;\n\t\tu_int8_t sd_sp2[2];\n\t\tu_int8_t sd_support;\n\t} __packed li_inq;\n\n\t/* modeq buffer */\n\tstruct scsi_low_mode_sense_data {\n\t\tu_int8_t sms_header[4];\n\t\tstruct {\n\t\t\tu_int8_t cmp_page;\n\t\t\tu_int8_t cmp_length;\n\t\t\tu_int8_t cmp_rlec;\n\t\t\tu_int8_t cmp_qc;\n\t\t\tu_int8_t cmp_eca;\n\t\t\tu_int8_t cmp_spare[3];\n\t\t} __packed sms_cmp;\t\n\t\n\t} li_sms;\t\n};\n\nstruct scsi_low_msg_log {\n\tint slml_ptr;\n\tstruct {\n\t\tu_int8_t msg[2];\n\t} slml_msg[SCSI_LOW_MSG_LOG_DATALEN];\n};\n\nstruct targ_info {\n\tstruct scsi_low_osdep_targ_interface ti_slti;\n\n\tTAILQ_ENTRY(targ_info) ti_chain;\t/* targ_info link */\n\n\tstruct scsi_low_softc *ti_sc;\t\t/* our softc */\n\tu_int ti_id;\t\t\t\t/* scsi id */\n\n\t/*\n\t * Lun chain\n\t */\n\tstruct lun_info_tab ti_litab;\t\t/* lun chain */\n\n\t/*\n\t * total disconnected nexus\n\t */\n\tint ti_disc;\n\n\t/*\n\t * Scsi phase control\n \t */\n\n#define\tPH_NULL\t\t0x00\n#define\tPH_ARBSTART\t0x01\n#define\tPH_SELSTART\t0x02\n#define\tPH_SELECTED\t0x03\n#define\tPH_CMD\t\t0x04\n#define\tPH_DATA\t\t0x05\n#define\tPH_MSGIN\t0x06\n#define\tPH_MSGOUT\t0x07\n#define\tPH_STAT\t\t0x08\n#define\tPH_DISC\t\t0x09\n#define\tPH_RESEL\t0x0a\n\tu_int ti_phase;\t\t\t\t/* scsi phase */\n\tu_int ti_ophase;\t\t\t/* old scsi phase */\n\n\t/*\n\t * Msg in\n \t */\n\tu_int ti_msginptr;\t\t\t/* msgin ptr */\n\tu_int ti_msginlen;\t\t\t/* expected msg length */\n\tint ti_msgin_parity_error;\t\t/* parity error detected */\n\tu_int8_t ti_msgin[SCSI_LOW_MAX_MSGLEN];\t/* msgin buffer */\n\n\t/*\n\t * Msg out\n \t */\n\tu_int ti_msgflags;\t\t\t/* msgs to be asserted */\n\tu_int ti_omsgflags;\t\t\t/* msgs asserted */\n\tu_int ti_emsgflags;\t\t\t/* a msg currently asserted */\n#define\tSCSI_LOW_MSG_RESET\t0x00000001\n#define\tSCSI_LOW_MSG_REJECT\t0x00000002\n#define\tSCSI_LOW_MSG_PARITY\t0x00000004\n#define\tSCSI_LOW_MSG_ERROR\t0x00000008\n#define\tSCSI_LOW_MSG_IDENTIFY\t0x00000010\n#define\tSCSI_LOW_MSG_ABORT\t0x00000020\n#define\tSCSI_LOW_MSG_TERMIO\t0x00000040\n#define\tSCSI_LOW_MSG_SIMPLE_QTAG\t0x00000080\n#define\tSCSI_LOW_MSG_ORDERED_QTAG\t0x00000100\n#define\tSCSI_LOW_MSG_HEAD_QTAG\t\t0x00000200\n#define\tSCSI_LOW_MSG_ABORT_QTAG 0x00000400\n#define\tSCSI_LOW_MSG_CLEAR_QTAG 0x00000800\n#define\tSCSI_LOW_MSG_WIDE\t0x00001000\n#define\tSCSI_LOW_MSG_SYNCH\t0x00002000\n#define\tSCSI_LOW_MSG_NOOP\t0x00004000\n#define\tSCSI_LOW_MSG_LAST\t0x00008000\n#define\tSCSI_LOW_MSG_ALL\t0xffffffff\n\n\t/* msgout buffer */\n\tu_int8_t ti_msgoutstr[SCSI_LOW_MAX_MSGLEN];\t/* scsi msgout */\n\tu_int ti_msgoutlen;\t\t\t/* msgout strlen */\n\n\t/*\n\t * target initialize msgout \n \t */\n\tu_int ti_setup_msg;\t\t/* setup msgout requests */\n\tu_int ti_setup_msg_done;\n\n\t/*\n\t * synch and wide data info\n \t */\n\tu_int ti_flags_valid;\t/* valid flags */\n#define\tSCSI_LOW_TARG_FLAGS_USER_VALID\t\t0x0001\n#define\tSCSI_LOW_TARG_FLAGS_DISK_VALID\t\t0x0002\n#define\tSCSI_LOW_TARG_FLAGS_QUIRKS_VALID\t0x0004\n#define\tSCSI_LOW_TARG_FLAGS_ALL_VALID \\\n\t(SCSI_LOW_TARG_FLAGS_USER_VALID | \\\n\t SCSI_LOW_TARG_FLAGS_DISK_VALID | SCSI_LOW_TARG_FLAGS_QUIRKS_VALID)\n\n\tu_int ti_diskflags;\t/* given target disk flags */\n\tu_int ti_quirks;\t/* given target quirk */\n\n\tstruct synch {\n\t\tu_int8_t offset;\n\t\tu_int8_t period;\n\t} ti_osynch, ti_maxsynch;\t\t/* synch data */\n\n#define\tSCSI_LOW_BUS_WIDTH_8\t0\n#define\tSCSI_LOW_BUS_WIDTH_16\t1\n#define\tSCSI_LOW_BUS_WIDTH_32\t2\n\tu_int ti_owidth, ti_width;\n\n\t/*\n\t * lun info size.\n \t */\n\tint ti_lunsize;\t\n\n#ifdef\tSCSI_LOW_DIAGNOSTIC\n\tstruct scsi_low_msg_log ti_log_msgout;\n\tstruct scsi_low_msg_log ti_log_msgin;\n#endif\t/* SCSI_LOW_DIAGNOSTIC */\n};\n\n/*************************************************\n * COMMON HEADER STRUCTURE\n *************************************************/\nstruct scsi_low_softc;\nstruct proc;\ntypedef struct scsi_low_softc *sc_low_t;\n\n#define\tSCSI_LOW_START_OK\t0\n#define\tSCSI_LOW_START_FAIL\t1\n#define\tSCSI_LOW_INFO_ALLOC\t0\n#define\tSCSI_LOW_INFO_REVOKE\t1\n#define\tSCSI_LOW_INFO_DEALLOC\t2\n#define\tSCSI_LOW_POWDOWN\t1\n#define\tSCSI_LOW_ENGAGE\t\t2\n\n#define\tSC_LOW_INIT_T (int (*)(sc_low_t, int))\n#define\tSC_LOW_BUSRST_T (void (*)(sc_low_t))\n#define\tSC_LOW_TARG_INIT_T (int (*)(sc_low_t, struct targ_info *, int))\n#define\tSC_LOW_LUN_INIT_T (int (*)(sc_low_t, struct targ_info *, struct lun_info *, int))\n#define\tSC_LOW_SELECT_T (int (*)(sc_low_t, struct slccb *))\n#define\tSC_LOW_ATTEN_T (void (*)(sc_low_t))\n#define\tSC_LOW_NEXUS_T (int (*)(sc_low_t))\n#define\tSC_LOW_MSG_T (int (*)(sc_low_t, struct targ_info *, u_int))\n#define\tSC_LOW_POLL_T (int (*)(void *))\n#define\tSC_LOW_POWER_T (int (*)(sc_low_t, u_int))\n#define\tSC_LOW_TIMEOUT_T (int (*)(sc_low_t))\n\nstruct scsi_low_funcs {\n\tint (*scsi_low_init)(sc_low_t, int);\n\tvoid (*scsi_low_bus_reset)(sc_low_t);\n\tint (*scsi_low_targ_init)(sc_low_t, struct targ_info *, int);\n\tint (*scsi_low_lun_init)(sc_low_t, struct targ_info *, struct lun_info *, int);\n\tint (*scsi_low_start_bus)(sc_low_t, struct slccb *);\n\tint (*scsi_low_establish_lun_nexus)(sc_low_t);\n\tint (*scsi_low_establish_ccb_nexus)(sc_low_t);\n\tvoid (*scsi_low_attention)(sc_low_t);\n\tint (*scsi_low_msg)(sc_low_t, struct targ_info *, u_int);\n\tint (*scsi_low_timeout)(sc_low_t);\n\tint (*scsi_low_poll)(void *);\n\tint (*scsi_low_power)(sc_low_t, u_int);\n\tint (*scsi_low_ioctl)(sc_low_t, u_long, caddr_t, int, struct proc *);\n};\n\nstruct scsi_low_softc {\n\t/* os depend structure */\n\tstruct scsi_low_osdep_interface sl_si;\n#define\tsl_dev\tsl_si.si_dev\n\tstruct scsi_low_osdep_funcs *sl_osdep_fp;\n\tu_char sl_xname[16];\n\t\t\t\t\n\t/* our chain */\n\tLIST_ENTRY(scsi_low_softc) sl_chain;\n\n\t/* my targets */\n\tstruct targ_info *sl_ti[SCSI_LOW_NTARGETS];\n\tstruct targ_info_tab sl_titab;\n\n\t/* current active T_L_Q nexus */\n\tstruct targ_info *sl_Tnexus;\t\t/* Target nexus */\n\tstruct lun_info *sl_Lnexus;\t\t/* Lun nexus */\n\tstruct slccb *sl_Qnexus;\t\t\t/* Qtag nexus */\n\tint sl_nexus_call;\n\n\t/* ccb start queue */\n\tstruct slccbtab sl_start;\t\n\n\t/* retry limit and phase change counter */\n\tint sl_max_retry;\n\tint sl_ph_count;\n\tint sl_timeout_count;\n\n\t/* selection & total num disconnect targets */\n\tint sl_nio;\n\tint sl_disc;\n\tint sl_retry_sel;\n\tstruct slccb *sl_selid;\n\n\t/* attention */\n\tint sl_atten;\t\t\t/* ATN asserted */\n\tint sl_clear_atten;\t\t/* negate ATN required */\n\n\t/* scsi phase suggested by scsi msg */\n\tu_int sl_msgphase;\t\n#define\tMSGPH_NULL\t0x00\t\t/* no msg */\n#define\tMSGPH_DISC\t0x01\t\t/* disconnect msg */\n#define\tMSGPH_CMDC\t0x02\t\t/* cmd complete msg */\n#define\tMSGPH_ABORT\t0x03\t\t/* abort seq */\n#define\tMSGPH_TERM\t0x04\t\t/* current io terminate */\n#define\tMSGPH_LCTERM\t0x05\t\t/* cmd link terminated */\n#define\tMSGPH_RESET\t0x06\t\t/* reset target */\n\n\t/* error */\n\tu_int sl_error;\t\t\t/* error flags */\n#define\tFATALIO\t\t0x0001\t\t/* generic io error & retry io */\n#define\tABORTIO\t\t0x0002\t\t/* generic io error & terminate io */\n#define\tTIMEOUTIO\t0x0004\t\t/* watch dog timeout */\n#define\tSELTIMEOUTIO\t0x0008\t\t/* selection timeout */\n#define\tPDMAERR\t\t0x0010\t\t/* dma xfer error */\n#define\tMSGERR\t\t0x0020\t\t/* msgsys error */\n#define\tPARITYERR\t0x0040\t\t/* parity error */\n#define\tBUSYERR\t\t0x0080\t\t/* target busy error */\n#define\tSTATERR\t\t0x0100\t\t/* status error */\n#define\tUACAERR\t\t0x0200\t\t/* target CA state, no sense check */\n#define\tSENSEIO\t\t0x1000\t\t/* cmd not excuted but sense data ok */\n#define\tSENSEERR\t0x2000\t\t/* cmd not excuted and sense data bad */\n#define\tUBFERR\t\t0x4000\t\t/* unexpected bus free */\n#define\tPENDINGIO\t0x8000\t\t/* ccb start not yet */\n#define\tSCSI_LOW_ERRORBITS \"\\020\\017ubferr\\016senseerr\\015senseio\\012uacaerr\\011staterr\\010busy\\007parity\\006msgerr\\005pdmaerr\\004seltimeout\\003timeout\\002abort\\001fatal\"\n\n\t/* current scsi data pointer */\n\tstruct sc_p sl_scp;\n\n\t/* power control */\n\tu_int sl_active;\t\t/* host is busy state */\n\tint sl_powc;\t\t\t/* power down timer counter */\n\tu_int sl_rstep;\t\t\t/* resume step */\n\n\t/* configuration flags */\n\tu_int sl_flags;\t\t\n#define\tHW_POWDOWN\t0x0001\n#define\tHW_RESUME\t0x0002\n#define\tHW_PDMASTART\t0x0004\n#define\tHW_INACTIVE\t0x0008\n#define\tHW_POWERCTRL\t0x0010\n#define\tHW_INITIALIZING 0x0020\n#define\tHW_READ_PADDING\t\t0x1000\n#define\tHW_WRITE_PADDING\t0x2000\n\n\tu_int sl_cfgflags;\n#define\tCFG_NODISC\t\t0x0001\n#define\tCFG_NOPARITY\t\t0x0002\n#define\tCFG_NOATTEN\t\t0x0004\n#define\tCFG_ASYNC\t\t0x0008\n#define\tCFG_NOQTAG\t\t0x0010\n\n\tint sl_show_result;\n#define\tSHOW_SYNCH_NEG\t0x0001\n#define\tSHOW_WIDE_NEG\t0x0002\n#define\tSHOW_CALCF_RES\t0x0010\n#define\tSHOW_PROBE_RES\t0x0020\n#define\tSHOW_ALL_NEG\t-1\n\n\t/* host informations */\n\tu_int sl_hostid;\n\tint sl_nluns;\n\tint sl_ntargs;\n\tint sl_openings;\n\n\t/* interface functions */\n\tstruct scsi_low_funcs *sl_funcs;\n\n\t/* targinfo size */\n\tint sl_targsize;\n\n#if\tdefined(i386) || defined(__i386__)\n\tu_int sl_irq;\t\t/* XXX */\n#endif\t/* i386 */\n};\n\n/*************************************************\n * SCSI LOW service functions\n *************************************************/\n/* \n * Scsi low attachment function.\n */\nint scsi_low_attach(struct scsi_low_softc *, int, int, int, int, int);\nint scsi_low_dettach(struct scsi_low_softc *);\n\n/* \n * Scsi low interface activate or deactivate functions\n */\nint scsi_low_is_busy(struct scsi_low_softc *);\nint scsi_low_activate(struct scsi_low_softc *);\nint scsi_low_deactivate(struct scsi_low_softc *);\n\n/* \n * Scsi phase \"bus service\" functions.\n * These functions are corresponding to each scsi bus phaeses.\n */\n/* bus idle phase (other initiators or targets release bus) */\nvoid scsi_low_bus_idle(struct scsi_low_softc *);\n\n/* arbitration and selection phase */\nvoid scsi_low_arbit_fail(struct scsi_low_softc *, struct slccb *);\nstatic __inline void scsi_low_arbit_win(struct scsi_low_softc *);\n\n/* msgout phase */\n#define\tSCSI_LOW_MSGOUT_INIT\t\t0x00000001\n#define\tSCSI_LOW_MSGOUT_UNIFY\t\t0x00000002\nint scsi_low_msgout(struct scsi_low_softc *, struct targ_info *, u_int);\n\n/* msgin phase */\n#define SCSI_LOW_DATA_PE\t0x80000000\nint scsi_low_msgin(struct scsi_low_softc *, struct targ_info *, u_int);\n\n/* statusin phase */\nstatic __inline int scsi_low_statusin(struct scsi_low_softc *, struct targ_info *, u_int);\n\n/* data phase */\nint scsi_low_data(struct scsi_low_softc *, struct targ_info *, struct buf **, int);\nstatic __inline void scsi_low_data_finish(struct scsi_low_softc *);\n\n/* cmd phase */\nint scsi_low_cmd(struct scsi_low_softc *, struct targ_info *);\n\n/* reselection phase */\nstruct targ_info *scsi_low_reselected(struct scsi_low_softc *, u_int);\n\n/* disconnection phase */\nint scsi_low_disconnected(struct scsi_low_softc *, struct targ_info *);\n\n/* \n * Scsi bus restart function.\n * Canncel all established nexuses => scsi system initialized => restart jobs.\n */\n#define\tSCSI_LOW_RESTART_HARD\t1\n#define\tSCSI_LOW_RESTART_SOFT\t0\nint scsi_low_restart(struct scsi_low_softc *, int, u_char *);\n\n/* \n * Scsi utility fucntions\n */\n/* print current status */\nvoid scsi_low_print(struct scsi_low_softc *, struct targ_info *);\n\n/* bus reset utility */\nvoid scsi_low_bus_reset(struct scsi_low_softc *);\n\n/*************************************************\n * Message macro defs\n *************************************************/\n#define\tSCSI_LOW_SETUP_PHASE(ti, phase)\t\t\t\\\n{\t\t\t\t\t\t\t\\\n\t(ti)->ti_ophase = ti->ti_phase;\t\t\t\\\n\t(ti)->ti_phase = (phase);\t\t\t\\\n}\n\n#define\tSCSI_LOW_SETUP_MSGPHASE(slp, PHASE)\t\t\\\n{\t\t\t\t\t\t\t\\\n\t(slp)->sl_msgphase = (PHASE);\t\t\t\\\n}\n\n#define\tSCSI_LOW_ASSERT_ATN(slp)\t\t\t\\\n{\t\t\t\t\t\t\t\\\n\t(slp)->sl_atten = 1;\t\t\t\t\\\n}\n\n#define\tSCSI_LOW_DEASSERT_ATN(slp)\t\t\t\\\n{\t\t\t\t\t\t\t\\\n\t(slp)->sl_atten = 0;\t\t\t\t\\\n}\n\n/*************************************************\n * Inline functions\n *************************************************/\nstatic __inline void scsi_low_attention(struct scsi_low_softc *);\nstatic __inline int scsi_low_is_msgout_continue(struct targ_info *, u_int);\nstatic __inline int scsi_low_assert_msg(struct scsi_low_softc *, struct targ_info *, u_int, int);\nstatic __inline int scsi_low_is_disconnect_ok(struct slccb *);\n\nstatic __inline int\nscsi_low_is_msgout_continue(ti, mask)\n\tstruct targ_info *ti;\n\tu_int mask;\n{\n\t\n\treturn ((ti->ti_msgflags & (~mask)) != 0);\n}\n\nstatic __inline int\nscsi_low_is_disconnect_ok(cb)\n\tstruct slccb *cb;\n{\n\n\treturn ((cb->li->li_flags & SCSI_LOW_DISC) != 0 &&\n\t\t    (cb->ccb_flags & (CCB_SENSE | CCB_CLEARQ)) == 0);\n}\n\nstatic __inline void\nscsi_low_attention(slp)\n\tstruct scsi_low_softc *slp;\n{\n\n\tif (slp->sl_atten != 0)\n\t\treturn;\n\n\t(*slp->sl_funcs->scsi_low_attention) (slp);\n\tSCSI_LOW_ASSERT_ATN(slp);\n}\n\nstatic __inline int\nscsi_low_assert_msg(slp, ti, msg, now)\n\tstruct scsi_low_softc *slp;\n\tstruct targ_info *ti;\n\tu_int msg;\n\tint now;\n{\n\n\tti->ti_msgflags |= msg;\n\tif (now != 0)\n\t\tscsi_low_attention(slp);\n\treturn 0;\n}\n\nstatic __inline void\nscsi_low_arbit_win(slp)\n\tstruct scsi_low_softc *slp;\n{\n\n\tslp->sl_selid = NULL;\n}\n\nstatic __inline void\nscsi_low_data_finish(slp)\n\tstruct scsi_low_softc *slp;\n{\n\n\tif (slp->sl_Qnexus != NULL)\n\t{\n\t\tslp->sl_Qnexus->ccb_datalen = slp->sl_scp.scp_datalen;\n\t}\n}\n\nstatic __inline int\nscsi_low_statusin(slp, ti, c)\n\tstruct scsi_low_softc *slp;\n\tstruct targ_info *ti;\n\tu_int c;\n{\n\n\tslp->sl_ph_count ++;\n\tif ((c & SCSI_LOW_DATA_PE) != 0)\n\t{\n\t\tscsi_low_assert_msg(slp, ti, SCSI_LOW_MSG_ERROR, 0);\n\t\treturn EIO;\n\t}\n\tslp->sl_scp.scp_status = (u_int8_t) c;\n\treturn 0;\n}\n\n/*************************************************\n * Message out defs\n *************************************************/\n/* XXX: use scsi_message.h */\n#define\tST_GOOD\t\t0x00\n#define\tST_CHKCOND\t0x02\n#define\tST_MET\t\t0x04\n#define\tST_BUSY\t\t0x08\n#define\tST_INTERGOOD\t0x10\n#define\tST_INTERMET\t0x14\n#define\tST_CONFLICT\t0x18\n#define\tST_CMDTERM\t0x22\n#define\tST_QUEFULL\t0x28\n#define\tST_UNKNOWN\t0xff\n\n#define\tMSG_COMP\t0x00\n#define\tMSG_EXTEND\t0x01\n\n#define\tMKMSG_EXTEND(XLEN, XCODE) ((((u_int)(XLEN)) << NBBY) | ((u_int)(XCODE)))\n#define\tMSG_EXTEND_MDPCODE\t0x00\n#define\tMSG_EXTEND_MDPLEN\t0x05\n#define\tMSG_EXTEND_SYNCHCODE\t0x01\n#define\tMSG_EXTEND_SYNCHLEN\t0x03\n#define\tMSG_EXTEND_WIDECODE\t0x03\n#define\tMSG_EXTEND_WIDELEN\t0x02\n\n#define\tMSG_SAVESP\t0x02\n#define\tMSG_RESTORESP\t0x03\n#define\tMSG_DISCON\t0x04\n#define\tMSG_I_ERROR\t0x05\n#define\tMSG_ABORT\t0x06\n#define\tMSG_REJECT\t0x07\n#define\tMSG_NOOP\t0x08\n#define\tMSG_PARITY\t0x09\n#define\tMSG_LCOMP\t0x0a\n#define\tMSG_LCOMP_F\t0x0b\n#define\tMSG_RESET\t0x0c\n#define\tMSG_ABORT_QTAG\t0x0d\n#define\tMSG_CLEAR_QTAG\t0x0e\n#define\tMSG_TERM_IO\t0x11\n#define\tMSG_SIMPLE_QTAG\t0x20\n#define\tMSG_HEAD_QTAG\t0x21\n#define\tMSG_ORDERED_QTAG\t0x22\n#define\tMSG_IDENTIFY\t  \t0x80\n#define\tMSG_IDENTIFY_DISCPRIV\t0x40\n#endif\t/* !_SCSI_LOW_H_ */\n"
  },
  {
    "path": "freebsd-headers/cam/scsi/scsi_low_pisa.h",
    "content": "/*\t$FreeBSD: release/9.0.0/sys/cam/scsi/scsi_low_pisa.h 139743 2005-01-05 22:34:37Z imp $\t*/\n/*\t$NecBSD: scsi_low_pisa.h,v 1.3.14.1 2001/06/08 06:27:49 honda Exp $\t*/\n/*\t$NetBSD$\t*/\n\n/*-\n * [NetBSD for NEC PC-98 series]\n *  Copyright (c) 1998\n *\tNetBSD/pc98 porting staff. All rights reserved.\n * \n *  Redistribution and use in source and binary forms, with or without\n *  modification, are permitted provided that the following conditions\n *  are met:\n *  1. Redistributions of source code must retain the above copyright\n *     notice, this list of conditions and the following disclaimer.\n *  2. Redistributions in binary form must reproduce the above copyright\n *     notice, this list of conditions and the following disclaimer in the\n *     documentation and/or other materials provided with the distribution.\n *  3. The name of the author may not be used to endorse or promote products\n *     derived from this software without specific prior written permission.\n * \n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR\n * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\n * DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR\n * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,\n * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\n#ifndef\t_SCSI_LOW_PISA_H_\n#define\t_SCSI_LOW_PISA_H_\n\n#ifdef\t__NetBSD__\nint scsi_low_activate_pisa(pisa_device_handle_t);\nint scsi_low_deactivate_pisa(pisa_device_handle_t);\nint scsi_low_notify_pisa(pisa_device_handle_t, pisa_event_t);\n#endif\t/* __NetBSD__ */\n\n#ifdef\t__FreeBSD__\nint scsi_low_activate_pisa(struct scsi_low_softc *, int);\nint scsi_low_deactivate_pisa(struct scsi_low_softc *);\n#endif\t/* __FreeBSD__ */\n#endif\t/* !_SCSI_LOW_PISA_H_ */\n"
  },
  {
    "path": "freebsd-headers/cam/scsi/scsi_message.h",
    "content": "/*-\n * This file is in the public domain.\n * $FreeBSD: release/9.0.0/sys/cam/scsi/scsi_message.h 139743 2005-01-05 22:34:37Z imp $\n */\n\n/* Messages (1 byte) */\t\t     /* I/T (M)andatory or (O)ptional */\n#define MSG_CMDCOMPLETE\t\t0x00 /* M/M */\n#define MSG_TASK_COMPLETE\t0x00 /* M/M */ /* SPI3 Terminology */\n#define MSG_EXTENDED\t\t0x01 /* O/O */\n#define MSG_SAVEDATAPOINTER\t0x02 /* O/O */\n#define MSG_RESTOREPOINTERS\t0x03 /* O/O */\n#define MSG_DISCONNECT\t\t0x04 /* O/O */\n#define MSG_INITIATOR_DET_ERR\t0x05 /* M/M */\n#define MSG_ABORT\t\t0x06 /* O/M */\n#define MSG_ABORT_TASK_SET\t0x06 /* O/M */ /* SPI3 Terminology */\n#define MSG_MESSAGE_REJECT\t0x07 /* M/M */\n#define MSG_NOOP\t\t0x08 /* M/M */\n#define MSG_PARITY_ERROR\t0x09 /* M/M */\n#define MSG_LINK_CMD_COMPLETE\t0x0a /* O/O */\n#define MSG_LINK_CMD_COMPLETEF\t0x0b /* O/O */ /* Obsolete */\n#define MSG_BUS_DEV_RESET\t0x0c /* O/M */\n#define MSG_TARGET_RESET\t0x0c /* O/M */ /* SPI3 Terminology */\n#define MSG_ABORT_TAG\t\t0x0d /* O/O */\n#define MSG_ABORT_TASK\t\t0x0d /* O/O */ /* SPI3 Terminology */\n#define MSG_CLEAR_QUEUE\t\t0x0e /* O/O */\n#define MSG_CLEAR_TASK_SET\t0x0e /* O/O */ /* SPI3 Terminology */\n#define MSG_INIT_RECOVERY\t0x0f /* O/O */ /* Deprecated in SPI3 */\n#define MSG_REL_RECOVERY\t0x10 /* O/O */ /* Deprecated in SPI3 */\n#define MSG_TERM_IO_PROC\t0x11 /* O/O */ /* Deprecated in SPI3 */\n#define MSG_CLEAR_ACA\t\t0x16 /* O/O */ /* SPI3 */\n#define MSG_LOGICAL_UNIT_RESET\t0x17 /* O/O */ /* SPI3 */\n#define MSG_QAS_REQUEST\t\t0x55 /* O/O */ /* SPI3 */\n\n/* Messages (2 byte) */\n#define MSG_SIMPLE_Q_TAG\t0x20 /* O/O */\n#define MSG_SIMPLE_TASK\t\t0x20 /* O/O */ /* SPI3 Terminology */\n#define MSG_HEAD_OF_Q_TAG\t0x21 /* O/O */\n#define MSG_HEAD_OF_QUEUE_TASK\t0x21 /* O/O */ /* SPI3 Terminology */\n#define MSG_ORDERED_Q_TAG\t0x22 /* O/O */\n#define MSG_ORDERED_TASK\t0x22 /* O/O */ /* SPI3 Terminology */\n#define MSG_IGN_WIDE_RESIDUE\t0x23 /* O/O */\n#define MSG_ACA_TASK\t\t0x24 /* 0/0 */ /* SPI3 */\n\n/* Identify message */\t\t     /* M/M */\t\n#define MSG_IDENTIFYFLAG\t0x80 \n#define MSG_IDENTIFY_DISCFLAG\t0x40 \n#define MSG_IDENTIFY(lun, disc)\t(((disc) ? 0xc0 : MSG_IDENTIFYFLAG) | (lun))\n#define MSG_ISIDENTIFY(m)\t((m) & MSG_IDENTIFYFLAG)\n#define MSG_IDENTIFY_LUNMASK\t0x3F \n\n/* Extended messages (opcode and length) */\n#define MSG_EXT_SDTR\t\t0x01\n#define MSG_EXT_SDTR_LEN\t0x03\n\n#define MSG_EXT_WDTR\t\t0x03\n#define MSG_EXT_WDTR_LEN\t0x02\n#define MSG_EXT_WDTR_BUS_8_BIT\t0x00\n#define MSG_EXT_WDTR_BUS_16_BIT\t0x01\n#define MSG_EXT_WDTR_BUS_32_BIT\t0x02 /* Deprecated in SPI3 */\n\n#define\tMSG_EXT_PPR\t\t0x04 /* SPI3/SPI4 */\n#define\tMSG_EXT_PPR_LEN\t\t0x06\n#define\tMSG_EXT_PPR_PCOMP_EN\t0x80\n#define\tMSG_EXT_PPR_RTI\t\t0x40\n#define\tMSG_EXT_PPR_RD_STRM\t0x20\n#define\tMSG_EXT_PPR_WR_FLOW\t0x10\n#define\tMSG_EXT_PPR_HOLD_MCS\t0x08\n#define\tMSG_EXT_PPR_QAS_REQ\t0x04\n#define\tMSG_EXT_PPR_DT_REQ\t0x02\n#define\tMSG_EXT_PPR_IU_REQ\t0x01\n"
  },
  {
    "path": "freebsd-headers/cam/scsi/scsi_pass.h",
    "content": "/*-\n * Copyright (c) 1997, 1999 Kenneth D. Merry.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. The name of the author may not be used to endorse or promote products\n *    derived from this software without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/cam/scsi/scsi_pass.h 139743 2005-01-05 22:34:37Z imp $\n */\n\n#ifndef _SCSI_PASS_H\n#define _SCSI_PASS_H 1\n\n#include <sys/ioccom.h>\n\n#include <cam/cam_ccb.h>\n\n/*\n * Convert to using a pointer to a ccb in the next major version.\n * This should allow us to avoid an extra copy of the CCB data.\n */\n#define CAMIOCOMMAND\t_IOWR(CAM_VERSION, 2, union ccb)\n#define CAMGETPASSTHRU\t_IOWR(CAM_VERSION, 3, union ccb)\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/cam/scsi/scsi_pt.h",
    "content": "/*-\n * Structure and function declarations for Processor type devices.\n *\n * Copyright (c) 1998 Justin T. Gibbs\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions, and the following disclaimer,\n *    without modification, immediately at the beginning of the file.\n * 2. The name of the author may not be used to endorse or promote products\n *    derived from this software without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR\n * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/cam/scsi/scsi_pt.h 139743 2005-01-05 22:34:37Z imp $\n */\n\n#ifndef\t_SCSI_SCSI_PT_H\n#define _SCSI_SCSI_PT_H 1\n\nstruct scsi_send_receive\n{\n\tu_int8_t opcode;\n\tu_int8_t byte2;\n\tu_int8_t xfer_len[3];\n\tu_int8_t control;\n};\n\n/*\n * Opcodes\n */\n#define RECEIVE\t\t\t0x08\n#define SEND\t\t\t0x0A\n\n#endif /* _SCSI_SCSI_PT_H */\n"
  },
  {
    "path": "freebsd-headers/cam/scsi/scsi_sa.h",
    "content": "/*-\n * Structure and function declarations for the\n * SCSI Sequential Access Peripheral driver for CAM.\n *\n * Copyright (c) 1999, 2000 Matthew Jacob\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions, and the following disclaimer,\n *    without modification, immediately at the beginning of the file.\n * 2. The name of the author may not be used to endorse or promote products\n *    derived from this software without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR\n * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/cam/scsi/scsi_sa.h 139743 2005-01-05 22:34:37Z imp $\n */\n\n#ifndef\t_SCSI_SCSI_SA_H\n#define _SCSI_SCSI_SA_H 1\n\n#include <sys/cdefs.h>\n\nstruct scsi_read_block_limits\n{\n\tu_int8_t opcode;\n\tu_int8_t byte2;\n\tu_int8_t unused[3];\n\tu_int8_t control;\n};\n\nstruct scsi_read_block_limits_data\n{\n\tu_int8_t gran;\n#define\tRBL_GRAN_MASK\t0x1F\n#define RBL_GRAN(rblim) ((rblim)->gran & RBL_GRAN_MASK)\n\tu_int8_t maximum[3];\n\tu_int8_t minimum[2];\n};\n\nstruct scsi_sa_rw\n{\n\tu_int8_t opcode;\n        u_int8_t sli_fixed;\n#define SAR_SLI\t\t0x02\n#define SARW_FIXED\t0x01\n\tu_int8_t length[3];\n        u_int8_t control;\n};\n\nstruct scsi_load_unload\n{\n\tu_int8_t opcode;\n        u_int8_t immediate;\n#define SLU_IMMED\t0x01\n\tu_int8_t reserved[2];\n\tu_int8_t eot_reten_load;\n#define SLU_EOT\t\t0x04\n#define SLU_RETEN\t0x02\n#define SLU_LOAD\t0x01\n        u_int8_t control;\n};\n\nstruct scsi_rewind\n{\n\tu_int8_t opcode;\n        u_int8_t immediate;\n#define SREW_IMMED\t0x01\n\tu_int8_t reserved[3];\n        u_int8_t control;\n};\n\ntypedef enum {\n\tSS_BLOCKS,\n\tSS_FILEMARKS,\n\tSS_SEQFILEMARKS,\n\tSS_EOD,\n\tSS_SETMARKS,\n\tSS_SEQSETMARKS\n} scsi_space_code;\n\nstruct scsi_space\n{\n\tu_int8_t opcode;\n        u_int8_t code;\n#define SREW_IMMED\t0x01\n\tu_int8_t count[3];\n        u_int8_t control;\n};\n\nstruct scsi_write_filemarks\n{\n\tu_int8_t opcode;\n        u_int8_t byte2;\n#define SWFMRK_IMMED\t0x01\n#define SWFMRK_WSMK\t0x02\n\tu_int8_t num_marks[3];\n        u_int8_t control;\n};\n\n/*\n * Reserve and release unit have the same exact cdb format, but different\n * opcodes.\n */\nstruct scsi_reserve_release_unit\n{\n\tu_int8_t opcode;\n\tu_int8_t lun_thirdparty;\n#define SRRU_LUN_MASK\t0xE0\n#define SRRU_3RD_PARTY\t0x10\n#define SRRU_3RD_SHAMT\t1\n#define SRRU_3RD_MASK\t0xE\n\tu_int8_t reserved[3];\n\tu_int8_t control;\n};\n\n/*\n * Erase a tape\n */\nstruct scsi_erase\n{\n\tu_int8_t opcode;\n\tu_int8_t lun_imm_long;\n#define SE_LUN_MASK\t0xE0\n#define SE_LONG\t\t0x1\n#define SE_IMMED\t0x2\n\tu_int8_t reserved[3];\n\tu_int8_t control;\n};\n\n/*\n * Dev specific mode page masks.\n */\n#define SMH_SA_WP\t\t0x80\n#define\tSMH_SA_BUF_MODE_MASK\t0x70\n#define SMH_SA_BUF_MODE_NOBUF\t0x00\n#define SMH_SA_BUF_MODE_SIBUF\t0x10\t/* Single-Initiator buffering */\n#define SMH_SA_BUF_MODE_MIBUF\t0x20\t/* Multi-Initiator buffering */\n#define SMH_SA_SPEED_MASK\t0x0F\n#define SMH_SA_SPEED_DEFAULT\t0x00\n\n/*\n * Sequential-access specific mode page numbers.\n */\n#define SA_DEVICE_CONFIGURATION_PAGE\t0x10\n#define SA_MEDIUM_PARTITION_PAGE_1\t0x11\n#define SA_MEDIUM_PARTITION_PAGE_2\t0x12\n#define SA_MEDIUM_PARTITION_PAGE_3\t0x13\n#define SA_MEDIUM_PARTITION_PAGE_4\t0x14\n#define SA_DATA_COMPRESSION_PAGE\t0x0f\t/* SCSI-3 */\n\n/*\n * Mode page definitions.\n */\n\n/* See SCSI-II spec 9.3.3.1 */\nstruct scsi_dev_conf_page {\n\tu_int8_t pagecode;\t/* 0x10 */\n\tu_int8_t pagelength;\t/* 0x0e */\n\tu_int8_t byte2;\t\t/* CAP, CAF, Active Format */\n\tu_int8_t active_partition;\n\tu_int8_t wb_full_ratio;\n\tu_int8_t rb_empty_ratio;\n\tu_int8_t wrdelay_time[2];\n\tu_int8_t byte8;\n#define\tSA_DBR\t\t\t0x80\t/* data buffer recovery */\n#define\tSA_BIS\t\t\t0x40\t/* block identifiers supported */\n#define\tSA_RSMK\t\t\t0x20\t/* report setmarks */\n#define\tSA_AVC\t\t\t0x10\t/* automatic velocity control */\n#define\tSA_SOCF_MASK\t\t0xc0\t/* stop on consecutive formats */\n#define\tSA_RBO\t\t\t0x20\t/* recover buffer order */\n#define\tSA_REW\t\t\t0x10\t/* report early warning */\n\tu_int8_t gap_size;\n\tu_int8_t byte10;\n\tu_int8_t ew_bufsize[3];\n\tu_int8_t sel_comp_alg;\n#define\tSA_COMP_NONE\t\t0x00\n#define\tSA_COMP_DEFAULT\t\t0x01\n\t/* the following is 'reserved' in SCSI-2 but is defined in SSC-r22 */\n\tu_int8_t extra_wp;\n#define\tSA_ASOC_WP\t\t0x04\t/* Associated Write Protect */\n#define\tSA_PERS_WP\t\t0x02\t/* Persistent Write Protect */\n#define\tSA_PERM_WP\t\t0x01\t/* Permanent Write Protect */\n};\n\n/* from SCSI-3: SSC-Rev10 (6/97) */\nstruct scsi_data_compression_page {\n\tu_int8_t page_code;\t/* 0x0f */\n\tu_int8_t page_length;\t/* 0x0e */\n\tu_int8_t dce_and_dcc;\n#define SA_DCP_DCE\t\t0x80 \t/* Data compression enable */\n#define SA_DCP_DCC\t\t0x40\t/* Data compression capable */\n\tu_int8_t dde_and_red;\n#define SA_DCP_DDE\t\t0x80\t/* Data decompression enable */\n#define SA_DCP_RED_MASK\t\t0x60\t/* Report Exception on Decomp. */\n#define SA_DCP_RED_SHAMT\t5\n#define SA_DCP_RED_0\t\t0x00\n#define SA_DCP_RED_1\t\t0x20\n#define SA_DCP_RED_2\t\t0x40\n\tu_int8_t comp_algorithm[4];\n\tu_int8_t decomp_algorithm[4];\n\tu_int8_t reserved[4];\n};\n\ntypedef union {\n\tstruct { u_int8_t pagecode, pagelength; } hdr;\n\tstruct scsi_dev_conf_page dconf;\n\tstruct scsi_data_compression_page dcomp;\n} sa_comp_t;\n\nstruct scsi_tape_read_position {\n\tu_int8_t opcode;\t\t/* READ_POSITION */\n\tu_int8_t byte1;\t\t\t/* set LSB to read hardware block pos */\n\tu_int8_t reserved[8];\n};\n\nstruct scsi_tape_position_data\t{\t/* Short Form */\n\tu_int8_t flags;\n#define\tSA_RPOS_BOP\t\t0x80\t/* Beginning of Partition */\n#define\tSA_RPOS_EOP\t\t0x40\t/* End of Partition */\n#define\tSA_RPOS_BCU\t\t0x20\t/* Block Count Unknown (SCSI3) */\n#define\tSA_RPOS_BYCU\t\t0x10\t/* Byte Count Unknown (SCSI3) */\n#define\tSA_RPOS_BPU\t\t0x04\t/* Block Position Unknown */\n#define\tSA_RPOS_PERR\t\t0x02\t/* Position Error (SCSI3) */\n#define\tSA_RPOS_UNCERTAIN\tSA_RPOS_BPU\n\tu_int8_t partition;\n\tu_int8_t reserved[2];\n\tu_int8_t firstblk[4];\n\tu_int8_t lastblk[4];\n\tu_int8_t reserved2;\n\tu_int8_t nbufblk[3];\n\tu_int8_t nbufbyte[4];\n};\n\nstruct scsi_tape_locate {\n\tu_int8_t opcode;\n\tu_int8_t byte1;\n#define\tSA_SPOS_IMMED\t\t0x01\n#define\tSA_SPOS_CP\t\t0x02\n#define\tSA_SPOS_BT\t\t0x04\n\tu_int8_t reserved1;\n\tu_int8_t blkaddr[4];\n\tu_int8_t reserved2;\n\tu_int8_t partition;\n\tu_int8_t control;\n};\n\n/*\n * Opcodes\n */\n#define REWIND\t\t\t0x01\n#define READ_BLOCK_LIMITS\t0x05\n#define SA_READ\t\t\t0x08\n#define SA_WRITE\t\t0x0A\n#define WRITE_FILEMARKS\t\t0x10\n#define SPACE\t\t\t0x11\n#define RESERVE_UNIT\t\t0x16\n#define RELEASE_UNIT\t\t0x17\n#define ERASE\t\t\t0x19\n#define LOAD_UNLOAD\t\t0x1B\n#define\tLOCATE\t\t\t0x2B\n#define\tREAD_POSITION\t\t0x34\n\n/*\n * Tape specific density codes- only enough of them here to recognize\n * some specific older units so we can choose 2FM@EOD or FIXED blocksize\n * quirks.\n */\n#define SCSI_DENSITY_HALFINCH_800\t0x01\n#define SCSI_DENSITY_HALFINCH_1600\t0x02\n#define SCSI_DENSITY_HALFINCH_6250\t0x03\n#define SCSI_DENSITY_HALFINCH_6250C\t0xC3\t/* HP Compressed 6250 */\n#define SCSI_DENSITY_QIC_11_4TRK\t0x04\n#define SCSI_DENSITY_QIC_11_9TRK\t0x84\t/* Vendor Unique Emulex */\n#define SCSI_DENSITY_QIC_24\t\t0x05\n#define SCSI_DENSITY_HALFINCH_PE\t0x06\n#define SCSI_DENSITY_QIC_120\t\t0x0f\n#define SCSI_DENSITY_QIC_150\t\t0x10    \n#define\tSCSI_DENSITY_QIC_525_320\t0x11\n#define\tSCSI_DENSITY_QIC_1320\t\t0x12\n#define\tSCSI_DENSITY_QIC_2GB\t\t0x22\n#define\tSCSI_DENSITY_QIC_4GB\t\t0x26\n#define\tSCSI_DENSITY_QIC_3080\t\t0x29\n\n__BEGIN_DECLS\nvoid\tscsi_read_block_limits(struct ccb_scsiio *, u_int32_t,\n\t\t\t       void (*cbfcnp)(struct cam_periph *, union ccb *),\n\t\t\t       u_int8_t, struct scsi_read_block_limits_data *,\n\t\t\t       u_int8_t , u_int32_t);\n\nvoid\tscsi_sa_read_write(struct ccb_scsiio *csio, u_int32_t retries,\n\t\t\t   void (*cbfcnp)(struct cam_periph *, union ccb *),\n\t\t\t   u_int8_t tag_action, int readop, int sli,\n\t\t\t   int fixed, u_int32_t length, u_int8_t *data_ptr,\n\t\t\t   u_int32_t dxfer_len, u_int8_t sense_len,\n\t\t\t   u_int32_t timeout);\n\nvoid\tscsi_rewind(struct ccb_scsiio *csio, u_int32_t retries,\n\t\t    void (*cbfcnp)(struct cam_periph *, union ccb *),\n\t\t    u_int8_t tag_action, int immediate, u_int8_t sense_len,\n\t\t    u_int32_t timeout);\n\nvoid\tscsi_space(struct ccb_scsiio *csio, u_int32_t retries,\n\t\t   void (*cbfcnp)(struct cam_periph *, union ccb *),\n\t\t   u_int8_t tag_action, scsi_space_code code,\n\t\t   u_int32_t count, u_int8_t sense_len, u_int32_t timeout);\n\nvoid\tscsi_load_unload(struct ccb_scsiio *csio, u_int32_t retries,         \n\t\t\t void (*cbfcnp)(struct cam_periph *, union ccb *),   \n\t\t\t u_int8_t tag_action, int immediate,   int eot,\n\t\t\t int reten, int load, u_int8_t sense_len,\n\t\t\t u_int32_t timeout);\n\t\nvoid\tscsi_write_filemarks(struct ccb_scsiio *csio, u_int32_t retries,\n\t\t\t     void (*cbfcnp)(struct cam_periph *, union ccb *),\n\t\t\t     u_int8_t tag_action, int immediate, int setmark,\n\t\t\t     u_int32_t num_marks, u_int8_t sense_len,\n\t\t\t     u_int32_t timeout);\n\nvoid\tscsi_reserve_release_unit(struct ccb_scsiio *csio, u_int32_t retries,\n\t\t\t\t  void (*cbfcnp)(struct cam_periph *,\n\t\t\t\t  union ccb *), u_int8_t tag_action,\t\n\t\t\t\t  int third_party, int third_party_id,\n\t\t\t\t  u_int8_t sense_len, u_int32_t timeout,\n\t\t\t\t  int reserve);\n\nvoid\tscsi_erase(struct ccb_scsiio *csio, u_int32_t retries,\n\t\t   void (*cbfcnp)(struct cam_periph *, union ccb *),\n\t\t   u_int8_t tag_action, int immediate, int long_erase,\n\t\t   u_int8_t sense_len, u_int32_t timeout);\n\nvoid\tscsi_data_comp_page(struct scsi_data_compression_page *page,\n\t\t\t    u_int8_t dce, u_int8_t dde, u_int8_t red,\n\t\t\t    u_int32_t comp_algorithm,\n\t\t\t    u_int32_t decomp_algorithm);\n\nvoid\tscsi_read_position(struct ccb_scsiio *csio, u_int32_t retries,\n                           void (*cbfcnp)(struct cam_periph *, union ccb *),\n                           u_int8_t tag_action, int hardsoft,\n                           struct scsi_tape_position_data *sbp,\n                           u_int8_t sense_len, u_int32_t timeout);\n\nvoid\tscsi_set_position(struct ccb_scsiio *csio, u_int32_t retries,\n                         void (*cbfcnp)(struct cam_periph *, union ccb *),\n                         u_int8_t tag_action, int hardsoft, u_int32_t blkno,\n                         u_int8_t sense_len, u_int32_t timeout);\n__END_DECLS\n\n#endif /* _SCSI_SCSI_SA_H */\n"
  },
  {
    "path": "freebsd-headers/cam/scsi/scsi_ses.h",
    "content": "/* $FreeBSD: release/9.0.0/sys/cam/scsi/scsi_ses.h 222339 2011-05-27 03:44:47Z mav $ */\n/*-\n * Copyright (c) 2000 by Matthew Jacob\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions, and the following disclaimer,\n *    without modification, immediately at the beginning of the file.\n * 2. The name of the author may not be used to endorse or promote products\n *    derived from this software without specific prior written permission.\n *\n * Alternatively, this software may be distributed under the terms of the\n * the GNU Public License (\"GPL\").\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR\n * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n */\n\n#define\tSESIOC\t\t\t('s' - 040)\n#define\tSESIOC_GETNOBJ\t\t_IO(SESIOC, 1)\n#define\tSESIOC_GETOBJMAP\t_IO(SESIOC, 2)\n#define\tSESIOC_GETENCSTAT\t_IO(SESIOC, 3)\n#define\tSESIOC_SETENCSTAT\t_IO(SESIOC, 4)\n#define\tSESIOC_GETOBJSTAT\t_IO(SESIOC, 5)\n#define\tSESIOC_SETOBJSTAT\t_IO(SESIOC, 6)\n#define\tSESIOC_GETTEXT\t\t_IO(SESIOC, 7)\n#define\tSESIOC_INIT\t\t_IO(SESIOC, 8)\n\n/*\n * Platform Independent Definitions for SES devices.\n */\n/*\n * SCSI Based Environmental Services Application Defines\n *\n * Based almost entirely on SCSI-3 SES Revision 8A specification,\n * but slightly abstracted as the underlying device may in fact\n * be a SAF-TE or vendor unique device.\n */\n/*\n * SES Driver Operations:\n * (The defines themselves are platform and access method specific)\n *\n * SESIOC_GETNOBJ\n * SESIOC_GETOBJMAP\n * SESIOC_GETENCSTAT\n * SESIOC_SETENCSTAT\n * SESIOC_GETOBJSTAT\n * SESIOC_SETOBJSTAT\n * SESIOC_INIT\n *\n *\n * An application finds out how many objects an SES instance\n * is managing by performing a SESIOC_GETNOBJ operation. It then\n * performs a SESIOC_GETOBJMAP to get the map that contains the\n * object identifiers for all objects (see ses_object below).\n * This information is static.\n * \n * The application may perform SESIOC_GETOBJSTAT operations to retrieve\n * status on an object (see the ses_objstat structure below), SESIOC_SETOBJSTAT\n * operations to set status for an object.\n *\n * Similarly overall enclosure status me be fetched or set via\n * SESIOC_GETENCSTAT or  SESIOC_SETENCSTAT operations (see ses_encstat below).\n *\n * Readers should note that there is nothing that requires either a set\n * or a clear operation to actually latch and do anything in the target.\n *\n * A SESIOC_INIT operation causes the enclosure to be initialized.\n */\n\ntypedef struct {\n\tunsigned int\tobj_id;\t\t/* Object Identifier */\n\tunsigned char\tsubencid;\t/* SubEnclosure ID */\n\tunsigned char\tobject_type;\t/* Object Type */\n} ses_object;\n\n/* Object Types */\n#define\tSESTYP_UNSPECIFIED\t0x00\n#define\tSESTYP_DEVICE\t\t0x01\n#define\tSESTYP_POWER\t\t0x02\n#define\tSESTYP_FAN\t\t0x03\n#define\tSESTYP_THERM\t\t0x04\n#define\tSESTYP_DOORLOCK\t\t0x05\n#define\tSESTYP_ALARM\t\t0x06\n#define\tSESTYP_ESCC\t\t0x07\t/* Enclosure SCC */\n#define\tSESTYP_SCC\t\t0x08\t/* SCC */\n#define\tSESTYP_NVRAM\t\t0x09\n#define\tSESTYP_UPS\t\t0x0b\n#define\tSESTYP_DISPLAY\t\t0x0c\n#define\tSESTYP_KEYPAD\t\t0x0d\n#define\tSESTYP_ENCLOSURE\t0x0e\n#define\tSESTYP_SCSIXVR\t\t0x0f\n#define\tSESTYP_LANGUAGE\t\t0x10\n#define\tSESTYP_COMPORT\t\t0x11\n#define\tSESTYP_VOM\t\t0x12\n#define\tSESTYP_AMMETER\t\t0x13\n#define\tSESTYP_SCSI_TGT\t\t0x14\n#define\tSESTYP_SCSI_INI\t\t0x15\n#define\tSESTYP_SUBENC\t\t0x16\n#define\tSESTYP_ARRAY\t\t0x17\n#define\tSESTYP_SASEXPANDER\t0x18\n#define\tSESTYP_SASCONNECTOR\t0x19\n\n/*\n * Overall Enclosure Status\n */\ntypedef unsigned char ses_encstat;\n#define\tSES_ENCSTAT_UNRECOV\t\t0x1\n#define\tSES_ENCSTAT_CRITICAL\t\t0x2\n#define\tSES_ENCSTAT_NONCRITICAL\t\t0x4\n#define\tSES_ENCSTAT_INFO\t\t0x8\n\n/*\n * Object Status\n */\ntypedef struct {\n\tunsigned int\tobj_id;\n\tunsigned char\tcstat[4];\n} ses_objstat;\n\n/* Summary SES Status Defines, Common Status Codes */\n#define\tSES_OBJSTAT_UNSUPPORTED\t\t0\n#define\tSES_OBJSTAT_OK\t\t\t1\n#define\tSES_OBJSTAT_CRIT\t\t2\n#define\tSES_OBJSTAT_NONCRIT\t\t3\n#define\tSES_OBJSTAT_UNRECOV\t\t4\n#define\tSES_OBJSTAT_NOTINSTALLED\t5\n#define\tSES_OBJSTAT_UNKNOWN\t\t6\n#define\tSES_OBJSTAT_NOTAVAIL\t\t7\n\n/*\n * For control pages, cstat[0] is the same for the\n * enclosure and is common across all device types.\n *\n * If SESCTL_CSEL is set, then PRDFAIL, DISABLE and RSTSWAP\n * are checked, otherwise bits that are specific to the device\n * type in the other 3 bytes of cstat or checked.\n */\n#define\tSESCTL_CSEL\t\t0x80\n#define\tSESCTL_PRDFAIL\t\t0x40\n#define\tSESCTL_DISABLE\t\t0x20\n#define\tSESCTL_RSTSWAP\t\t0x10\n\n\n/* Control bits, Device Elements, byte 2 */\n#define\tSESCTL_DRVLCK\t0x40\t/* \"DO NOT REMOVE\" */\n#define\tSESCTL_RQSINS\t0x08\t/* RQST INSERT */\n#define\tSESCTL_RQSRMV\t0x04\t/* RQST REMOVE */\n#define\tSESCTL_RQSID\t0x02\t/* RQST IDENT */\n/* Control bits, Device Elements, byte 3 */\n#define\tSESCTL_RQSFLT\t0x20\t/* RQST FAULT */\n#define\tSESCTL_DEVOFF\t0x10\t/* DEVICE OFF */\n\n/* Control bits, Generic, byte 3 */\n#define\tSESCTL_RQSTFAIL\t0x40\n#define\tSESCTL_RQSTON\t0x20\n\n/*\n * Getting text for an object type is a little\n * trickier because it's string data that can\n * go up to 64 KBytes. Build this union and\n * fill the obj_id with the id of the object who's\n * help text you want, and if text is available,\n * obj_text will be filled in, null terminated.\n */\n\ntypedef union {\n\tunsigned int obj_id;\n\tchar obj_text[1];\n} ses_hlptxt;\n"
  },
  {
    "path": "freebsd-headers/cam/scsi/scsi_sg.h",
    "content": "/*\n * Structures and definitions for SCSI commands to the SG passthrough device.\n *\n * $FreeBSD: release/9.0.0/sys/cam/scsi/scsi_sg.h 168598 2007-04-10 20:03:42Z scottl $\n */\n\n#ifndef _SCSI_SG_H\n#define _SCSI_SG_H\n\n#define SGIOC\t'\"'\n#define SG_SET_TIMEOUT\t\t_IO(SGIOC, 0x01)\n#define SG_GET_TIMEOUT\t\t_IO(SGIOC, 0x02)\n#define SG_EMULATED_HOST\t_IO(SGIOC, 0x03)\n#define SG_SET_TRANSFORM\t_IO(SGIOC, 0x04)\n#define SG_GET_TRANSFORM\t_IO(SGIOC, 0x05)\n#define SG_GET_COMMAND_Q\t_IO(SGIOC, 0x70)\n#define SG_SET_COMMAND_Q\t_IO(SGIOC, 0x71)\n#define SG_GET_RESERVED_SIZE\t_IO(SGIOC, 0x72)\n#define SG_SET_RESERVED_SIZE\t_IO(SGIOC, 0x75)\n#define SG_GET_SCSI_ID\t\t_IO(SGIOC, 0x76)\n#define SG_SET_FORCE_LOW_DMA\t_IO(SGIOC, 0x79)\n#define SG_GET_LOW_DMA\t\t_IO(SGIOC, 0x7a)\n#define SG_SET_FORCE_PACK_ID\t_IO(SGIOC, 0x7b)\n#define SG_GET_PACK_ID\t\t_IO(SGIOC, 0x7c)\n#define SG_GET_NUM_WAITING\t_IO(SGIOC, 0x7d)\n#define SG_SET_DEBUG\t\t_IO(SGIOC, 0x7e)\n#define SG_GET_SG_TABLESIZE\t_IO(SGIOC, 0x7f)\n#define SG_GET_VERSION_NUM\t_IO(SGIOC, 0x82)\n#define SG_NEXT_CMD_LEN\t\t_IO(SGIOC, 0x83)\n#define SG_SCSI_RESET\t\t_IO(SGIOC, 0x84)\n#define SG_IO\t\t\t_IO(SGIOC, 0x85)\n#define SG_GET_REQUEST_TABLE\t_IO(SGIOC, 0x86)\n#define SG_SET_KEEP_ORPHAN\t_IO(SGIOC, 0x87)\n#define SG_GET_KEEP_ORPHAN\t_IO(SGIOC, 0x88)\n#define SG_GET_ACCESS_COUNT\t_IO(SGIOC, 0x89)\n\nstruct sg_io_hdr {\n\tint\t\tinterface_id;\n\tint\t\tdxfer_direction;\n\tu_char\t\tcmd_len;\n\tu_char\t\tmx_sb_len;\n\tu_short\t\tiovec_count;\n\tu_int\t\tdxfer_len;\n\tvoid\t\t*dxferp;\n\tu_char\t\t*cmdp;\n\tu_char\t\t*sbp;\n\tu_int\t\ttimeout;\n\tu_int\t\tflags;\n\tint\t\tpack_id;\n\tvoid\t\t*usr_ptr;\n\tu_char\t\tstatus;\n\tu_char\t\tmasked_status;\n\tu_char\t\tmsg_status;\n\tu_char\t\tsb_len_wr;\n\tu_short\t\thost_status;\n\tu_short\t\tdriver_status;\n\tint\t\tresid;\n\tu_int\t\tduration;\n\tu_int\t\tinfo;\n};\n\n#define SG_DXFER_NONE\t\t-1\n#define SG_DXFER_TO_DEV\t\t-2\n#define SG_DXFER_FROM_DEV\t-3\n#define SG_DXFER_TO_FROM_DEV\t-4\n#define SG_DXFER_UNKNOWN\t-5\n\n#define SG_MAX_SENSE 16\nstruct sg_header {\n\tint\t\tpack_len;\n\tint\t\treply_len;\n\tint\t\tpack_id;\n\tint\t\tresult;\n\tu_int\t\ttwelve_byte:1;\n\tu_int\t\ttarget_status:5;\n\tu_int\t\thost_status:8;\n\tu_int\t\tdriver_status:8;\n\tu_int\t\tother_flags:10;\n\tu_char\t\tsense_buffer[SG_MAX_SENSE];\n};\n\nstruct sg_scsi_id {\n\tint\t\thost_no;\n\tint\t\tchannel;\n\tint\t\tscsi_id;\n\tint\t\tlun;\n\tint\t\tscsi_type;\n\tshort\t\th_cmd_per_lun;\n\tshort\t\td_queue_depth;\n\tint\t\tunused[2];\n};\n\nstruct scsi_idlun {\n\tuint32_t\tdev_id;\n\tuint32_t\thost_unique_id;\n};\n\n/*\n * Host codes\n */\n#define DID_OK\t\t0x00\t/* OK */\n#define DID_NO_CONNECT\t0x01\t/* timeout during connect */\n#define DID_BUS_BUSY\t0x02\t/* timeout during command */\n#define DID_TIME_OUT\t0x03\t/* other timeout */\n#define DID_BAD_TARGET\t0x04\t/* bad target */\n#define DID_ABORT\t0x05\t/* abort */\n#define DID_PARITY\t0x06\t/* parity error */\n#define DID_ERROR\t0x07\t/* internal error */\n#define DID_RESET\t0x08\t/* reset by somebody */\n#define DID_BAD_INTR\t0x09\t/* unexpected interrupt */\n#define DID_PASSTHROUGH\t0x0a\t/* passthrough */\n#define DID_SOFT_ERROR\t0x0b\t/* low driver wants retry */\n#define DID_IMM_RETRY\t0x0c\t/* retry without decreasing retrycnt */\n\n/*\n * Driver codes\n */\n#define DRIVER_OK\t0x00\n#define DRIVER_BUSY\t0x01\n#define DRIVER_SOFT\t0x02\n#define DRIVER_MEDIA\t0x03\n#define DRIVER_ERROR\t0x04\n\n#define DRIVER_INVALID\t0x05\n#define DRIVER_TIMEOUT\t0x06\n#define DRIVER_HARD\t0x07\n#define DRIVER_SENSE\t0x08\n\n#define SUGGEST_RETRY\t0x10\n#define SUGGEST_ABORT\t0x20\n#define SUGGEST_REMAP\t0x30\n#define SUGGEST_DIE\t0x40\n#define SUGGEST_SENSE\t0x80\n#define SUGGEST_IS_OK\t0xff\n\n#define DRIVER_MASK\t0x0f\n#define SUGGEST_MASK\t0xf0\n\n/* Other definitions */\n/* HZ isn't always available, so simulate it */\n#define SG_DEFAULT_HZ\t\t1000\n#define SG_DEFAULT_TIMEOUT\t(60*SG_DEFAULT_HZ)\n\n#endif /* !_SCSI_SG_H */\n"
  },
  {
    "path": "freebsd-headers/cam/scsi/scsi_targetio.h",
    "content": "/*-\n * Ioctl definitions for the SCSI Target Driver\n *\n * Copyright (c) 2002 Nate Lawson.\n * Copyright (c) 1998 Justin T. Gibbs.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions, and the following disclaimer,\n *    without modification, immediately at the beginning of the file.\n * 2. The name of the author may not be used to endorse or promote products\n *    derived from this software without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR\n * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/cam/scsi/scsi_targetio.h 139743 2005-01-05 22:34:37Z imp $\n */\n\n#ifndef _CAM_SCSI_SCSI_TARGETIO_H_\n#define _CAM_SCSI_SCSI_TARGETIO_H_\n#ifndef _KERNEL\n#include <sys/types.h>\n#endif\n#include <sys/ioccom.h>\n\n#include <cam/cam.h>\n#include <cam/cam_ccb.h>\n\n/*\n * CCBs (ATIO, CTIO, INOT, REL_SIMQ) are sent to the kernel driver\n * by writing one or more pointers.  The user receives notification\n * of CCB completion through poll/select/kqueue and then calls\n * read(2) which outputs pointers to the completed CCBs.\n */\n\n/*\n * Enable and disable a target mode instance.  For enabling, the path_id,\n * target_id, and lun_id fields must be set.  The grp6/7_len fields\n * specify the length of vendor-specific CDBs the target expects and\n * should normally be set to 0.  On successful completion\n * of enable, the specified target instance will answer selection.\n * Disable causes the target instance to abort any outstanding commands\n * and stop accepting new ones.  The aborted CCBs will be returned to\n * the user via read(2) or discarded if the user closes the device.\n * The user can then re-enable the device for a new path.\n */\nstruct ioc_enable_lun {\n\tpath_id_t\tpath_id;\n\ttarget_id_t\ttarget_id;\n\tlun_id_t\tlun_id;\n\tint\t\tgrp6_len;\n\tint\t\tgrp7_len;\n};\n#define TARGIOCENABLE\t_IOW('C', 5, struct ioc_enable_lun)\n#define TARGIOCDISABLE\t _IO('C', 6)\n\n/*\n * Set/clear debugging for this target mode instance\n */\n#define\tTARGIOCDEBUG\t_IOW('C', 7, int)\n\nTAILQ_HEAD(ccb_queue, ccb_hdr);\n\n#endif /* _CAM_SCSI_SCSI_TARGETIO_H_ */\n"
  },
  {
    "path": "freebsd-headers/cam/scsi/smp_all.h",
    "content": "/*-\n * Copyright (c) 2010 Spectra Logic Corporation\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions, and the following disclaimer,\n *    without modification.\n * 2. Redistributions in binary form must reproduce at minimum a disclaimer\n *    substantially similar to the \"NO WARRANTY\" disclaimer below\n *    (\"Disclaimer\") and any redistribution must be conditioned upon\n *    including a substantially similar Disclaimer requirement for further\n *    binary redistribution.\n *\n * NO WARRANTY\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n * \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR\n * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,\n * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING\n * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGES.\n *\n * $Id: //depot/users/kenm/FreeBSD-test/sys/cam/scsi/smp_all.h#4 $\n * $FreeBSD: release/9.0.0/sys/cam/scsi/smp_all.h 216088 2010-11-30 22:39:46Z ken $\n */\n\n/*\n * Serial Management Protocol definitions.\n */\n\n#ifndef\t_SCSI_SMP_ALL_H\n#define\t_SCSI_SMP_ALL_H\t1\n\n#define\tSMP_FRAME_TYPE_REQUEST\t0x40\n#define\tSMP_FRAME_TYPE_RESPONSE\t0x41\n#define\tSMP_WORD_LEN\t\t4\n#define\tSMP_CRC_LEN\t\t4\n\n/*\n * SMP Functions (current as of SPL Revision 7)\n */\n/* 0x00 to 0x7f: SMP input functions */\n/* 0x00 to 0x0f: General SMP input functions */\n#define\tSMP_FUNC_REPORT_GENERAL\t\t0x00\n#define\tSMP_FUNC_REPORT_MANUF_INFO\t0x01\n#define\tSMP_FUNC_REPORT_SC_STATUS\t0x03\n#define\tSMP_FUNC_REPORT_ZONE_PERM_TBL\t0x04\n#define\tSMP_FUNC_REPORT_ZONE_MAN_PWD\t0x05\n#define\tSMP_FUNC_REPORT_BROADCAST\t0x06\n\n/* 0x10 to 0x1f: Phy-based SMP input functions */\n#define\tSMP_FUNC_DISCOVER\t\t0x10\n#define\tSMP_FUNC_REPORT_PHY_ERR_LOG\t0x11\n#define\tSMP_FUNC_REPORT_PHY_SATA\t0x12\n#define\tSMP_FUNC_REPORT_ROUTE_INFO\t0x13\n#define\tSMP_FUNC_REPORT_PHY_EVENT\t0x14\n\n/* 0x20 to 0x2f: Descriptor list-based SMP input functions */\n#define\tSMP_FUNC_DISCOVER_LIST\t\t0x20\n#define\tSMP_FUNC_REPORT_PHY_EVENT_LIST\t0x21\n#define\tSMP_FUNC_REPORT_EXP_RTL\t\t0x22\n\n/* 0x30 to 0x3f: Reserved for SMP input functions */\n/* 0x40 to 0x7f: Vendor specific */\n\n/* 0x80 to 0xff: SMP output functions */\n/* 0x80 to 0x8f: General SMP output functions */\n#define\tSMP_FUNC_CONFIG_GENERAL\t\t0x80\n#define\tSMP_FUNC_ENABLE_DISABLE_ZONING\t0x81\n#define\tSMP_FUNC_ZONED_BROADCAST\t0x85\n#define\tSMP_FUNC_ZONE_LOCK\t\t0x86\n#define\tSMP_FUNC_ZONE_ACTIVATE\t\t0x87\n#define\tSMP_FUNC_ZONE_UNLOCK\t\t0x88\n#define\tSMP_FUNC_CONFIG_ZM_PWD\t\t0x89\n#define\tSMP_FUNC_CONFIG_ZONE_PHY_INFO\t0x8a\n#define\tSMP_FUNC_CONFIG_ZONE_PERM_TBL\t0x8b\n\n/* 0x90 to 0x9f: Phy-based SMP output functions */\n#define\tSMP_FUNC_CONFIG_ROUTE_INFO\t0x90\n#define\tSMP_FUNC_PHY_CONTROL\t\t0x91\n#define\tSMP_FUNC_PHY_TEST_FUNC\t\t0x92\n#define\tSMP_FUNC_CONFIG_PHY_EVENT\t0x93\n\n/* 0xa0 to 0xbf: Reserved for SMP output functions */\n/* 0xc0 to 0xff: Vendor specific */\n\n/*\n * Function Results (current as of SPL Revision 7)\n */\n#define\tSMP_FR_ACCEPTED\t\t\t0x00\n#define\tSMP_FR_UNKNOWN_FUNC\t\t0x01\n#define\tSMP_FR_FUNCTION_FAILED\t\t0x02\n#define\tSMP_FR_INVALID_REQ_FRAME_LEN\t0x03\n#define\tSMP_FR_INVALID_EXP_CHG_CNT\t0x04\n#define\tSMP_FR_BUSY\t\t\t0x05\n#define\tSMP_FR_INCOMPLETE_DESC_LIST\t0x06\n#define\tSMP_FR_PHY_DOES_NOT_EXIST\t0x10\n#define\tSMP_FR_INDEX_DOES_NOT_EXIST\t0x11\n#define\tSMP_FR_PHY_DOES_NOT_SUP_SATA\t0x12\n#define\tSMP_FR_UNKNOWN_PHY_OP\t\t0x13\n#define\tSMP_FR_UNKNOWN_PHY_TEST_FUNC\t0x14\n#define\tSMP_FR_PHY_TEST_FUNC_INPROG\t0x15\n#define\tSMP_FR_PHY_VACANT\t\t0x16\n#define\tSMP_FR_UNKNOWN_PHY_EVENT_SRC\t0x17\n#define\tSMP_FR_UNKNOWN_DESC_TYPE\t0x18\n#define\tSMP_FR_UNKNOWN_PHY_FILTER\t0x19\n#define\tSMP_FR_AFFILIATION_VIOLATION\t0x1a\n#define\tSMP_FR_SMP_ZONE_VIOLATION\t0x20\n#define\tSMP_FR_NO_MGMT_ACCESS_RIGHTS\t0x21\n#define\tSMP_FR_UNKNOWN_ED_ZONING_VAL\t0x22\n#define\tSMP_FR_ZONE_LOCK_VIOLATION\t0x23\n#define\tSMP_FR_NOT_ACTIVATED\t\t0x24\n#define\tSMP_FR_ZG_OUT_OF_RANGE\t\t0x25\n#define\tSMP_FR_NO_PHYS_PRESENCE\t\t0x26\n#define\tSMP_FR_SAVING_NOT_SUP\t\t0x27\n#define\tSMP_FR_SRC_ZONE_DNE\t\t0x28\n#define\tSMP_FR_DISABLED_PWD_NOT_SUP\t0x29\n\n/*\n * REPORT GENERAL request and response, current as of SPL Revision 7.\n */\nstruct smp_report_general_request\n{\n\tuint8_t\tframe_type;\n\tuint8_t\tfunction;\n\tuint8_t\tresponse_len;\n\tuint8_t\trequest_len;\n\tuint8_t\tcrc[4];\n};\n\nstruct smp_report_general_response\n{\n\tuint8_t\tframe_type;\n\tuint8_t\tfunction;\n\tuint8_t\tfunction_result;\n\tuint8_t\tresponse_len;\n#define\tSMP_RG_RESPONSE_LEN\t\t0x11\n\tuint8_t\texpander_change_count[2];\n\tuint8_t\texpander_route_indexes[2];\n\tuint8_t\tlong_response;\n#define\tSMP_RG_LONG_RESPONSE\t\t0x80\n\tuint8_t\tnum_phys;\n\tuint8_t\tconfig_bits0;\n#define\tSMP_RG_TABLE_TO_TABLE_SUP\t0x80\n#define\tSMP_RG_ZONE_CONFIGURING\t\t0x40\n#define\tSMP_RG_SELF_CONFIGURING\t\t0x20\n#define\tSMP_RG_STP_CONTINUE_AWT\t\t0x10\n#define\tSMP_RG_OPEN_REJECT_RETRY_SUP\t0x08\n#define\tSMP_RG_CONFIGURES_OTHERS\t0x04\n#define\tSMP_RG_CONFIGURING\t\t0x02\n#define\tSMP_RG_EXT_CONFIG_ROUTE_TABLE\t0x01\n\tuint8_t\treserved0;\n\tuint8_t\tencl_logical_id[8];\n\tuint8_t\treserved1[8];\n\tuint8_t\treserved2[2];\n\tuint8_t\tstp_bus_inact_time_limit[2];\n\tuint8_t\tstp_max_conn_time_limit[2];\n\tuint8_t\tstp_smp_it_nexus_loss_time[2];\n\tuint8_t\tconfig_bits1;\n#define\tSMP_RG_NUM_ZONE_GROUPS_MASK\t0xc0\n#define\tSMP_RG_NUM_ZONE_GROUPS_SHIFT\t6\n#define\tSMP_RG_ZONE_LOCKED\t\t0x10\n#define\tSMP_RG_PP_SUPPORTED\t\t0x08\n#define\tSMP_RG_PP_ASSERTED\t\t0x04\n#define\tSMP_RG_ZONING_SUPPORTED\t\t0x02\n#define\tSMP_RG_ZONING_ENABLED\t\t0x01\n\tuint8_t\tconfig_bits2;\n#define\tSMP_RG_SAVING\t\t\t0x10\n#define\tSMP_RG_SAVING_ZM_PWD_SUP\t0x08\n#define\tSMP_RG_SAVING_PHY_INFO_SUP\t0x04\n#define\tSMP_RG_SAVING_ZPERM_TAB_SUP\t0x02\n#define\tSMP_RG_SAVING_ZENABLED_SUP\t0x01\n\tuint8_t\tmax_num_routed_addrs[2];\n\tuint8_t\tactive_zm_address[8];\n\tuint8_t\tzone_lock_inact_time_limit[2];\n\tuint8_t\treserved3[2];\n\tuint8_t\treserved4;\n\tuint8_t\tfirst_encl_conn_el_index;\n\tuint8_t\tnum_encl_conn_el_indexes;\n\tuint8_t\treserved5;\n\tuint8_t\treduced_functionality;\n#define\tSMP_RG_REDUCED_FUNCTIONALITY\t0x80\n\tuint8_t\ttime_to_reduced_func;\n\tuint8_t\tinitial_time_to_reduced_func;\n\tuint8_t\tmax_reduced_func_time;\n\tuint8_t\tlast_sc_stat_desc_index[2];\n\tuint8_t\tmax_sc_stat_descs[2];\n\tuint8_t\tlast_phy_evl_desc_index[2];\n\tuint8_t\tmax_stored_pel_descs[2];\n\tuint8_t\tstp_reject_to_open_limit[2];\n\tuint8_t\treserved6[2];\n\tuint8_t\tcrc[4];\n};\n\n/*\n * REPORT MANUFACTURER INFORMATION request and response, current as of SPL\n * Revision 7.\n */\nstruct smp_report_manuf_info_request\n{\n\tuint8_t\tframe_type;\n\tuint8_t\tfunction;\n\tuint8_t\tresponse_len;\n\tuint8_t\trequest_len;\n#define\tSMP_RMI_REQUEST_LEN\t\t0x00\n\tuint8_t\tcrc[4];\n};\n\nstruct smp_report_manuf_info_response\n{\n\tuint8_t\tframe_type;\n\tuint8_t\tfunction;\n\tuint8_t\tfunction_result;\n\tuint8_t\tresponse_len;\n#define\tSMP_RMI_RESPONSE_LEN\t\t0x0e\n\tuint8_t\texpander_change_count[2];\n\tuint8_t\treserved0[2];\n\tuint8_t\tsas_11_format;\n#define\tSMP_RMI_SAS11_FORMAT\t\t0x01\n\tuint8_t\treserved1[3];\n\tuint8_t\tvendor[8];\n\tuint8_t\tproduct[16];\n\tuint8_t\trevision[4];\n\tuint8_t\tcomp_vendor[8];\n\tuint8_t\tcomp_id[2];\n\tuint8_t\tcomp_revision;\n\tuint8_t\treserved2;\n\tuint8_t\tvendor_specific[8];\n\tuint8_t\tcrc[4];\n};\n\n/*\n * DISCOVER request and response, current as of SPL Revision 7.\n */\nstruct smp_discover_request\n{\n\tuint8_t\tframe_type;\n\tuint8_t\tfunction;\n\tuint8_t response_len;\n\tuint8_t request_len;\n#define\tSMP_DIS_REQUEST_LEN\t\t0x02\n\tuint8_t reserved0[4];\n\tuint8_t\tignore_zone_group;\n#define\tSMP_DIS_IGNORE_ZONE_GROUP\t0x01\n\tuint8_t\tphy;\n\tuint8_t\treserved1[2];\n\tuint8_t\tcrc[4];\n};\n\nstruct smp_discover_response\n{\n\tuint8_t\tframe_type;\n\tuint8_t\tfunction;\n\tuint8_t\tfunction_result;\n\tuint8_t\tresponse_len;\n#define\tSMP_DIS_RESPONSE_LEN\t\t0x20\n\tuint8_t\texpander_change_count[2];\n\tuint8_t\treserved0[3];\n\tuint8_t\tphy;\n\tuint8_t\treserved1[2];\n\tuint8_t\tattached_device;\n#define\tSMP_DIS_AD_TYPE_MASK\t\t0x70\n#define\tSMP_DIS_AD_TYPE_NONE\t\t0x00\n#define\tSMP_DIS_AD_TYPE_SAS_SATA\t0x10\n#define\tSMP_DIS_AD_TYPE_EXP\t\t0x20\n#define\tSMP_DIS_AD_TYPE_EXP_OLD\t\t0x30\n#define\tSMP_DIS_ATTACH_REASON_MASK\t0x0f\n\tuint8_t\tneg_logical_link_rate;\n#define\tSMP_DIS_LR_MASK\t\t\t0x0f\n#define\tSMP_DIS_LR_DISABLED\t\t0x01\n#define\tSMP_DIS_LR_PHY_RES_PROB\t\t0x02\n#define\tSMP_DIS_LR_SPINUP_HOLD\t\t0x03\n#define\tSMP_DIS_LR_PORT_SEL\t\t0x04\n#define\tSMP_DIS_LR_RESET_IN_PROG\t0x05\n#define\tSMP_DIS_LR_UNSUP_PHY_ATTACHED\t0x06\n#define\tSMP_DIS_LR_G1_15GBPS\t\t0x08\n#define\tSMP_DIS_LR_G2_30GBPS\t\t0x09\n#define\tSMP_DIS_LR_G3_60GBPS\t\t0x0a\n\tuint8_t\tconfig_bits0;\n#define\tSMP_DIS_ATTACHED_SSP_INIT\t0x08\n#define\tSMP_DIS_ATTACHED_STP_INIT\t0x04\n#define\tSMP_DIS_ATTACHED_SMP_INIT\t0x02\n#define\tSMP_DIS_ATTACHED_SATA_HOST\t0x01\n\tuint8_t\tconfig_bits1;\n#define\tSMP_DIS_ATTACHED_SATA_PORTSEL\t0x80\n#define\tSMP_DIS_STP_BUFFER_TOO_SMALL\t0x10\n#define\tSMP_DIS_ATTACHED_SSP_TARG\t0x08\n#define\tSMP_DIS_ATTACHED_STP_TARG\t0x04\n#define\tSMP_DIS_ATTACHED_SMP_TARG\t0x02\n#define\tSMP_DIS_ATTACHED_SATA_DEV\t0x01\n\tuint8_t\tsas_address[8];\n\tuint8_t\tattached_sas_address[8];\n\tuint8_t\tattached_phy_id;\n\tuint8_t\tconfig_bits2;\n#define\tSMP_DIS_ATT_SLUMB_CAP\t\t0x10\n#define\tSMP_DIS_ATT_PAR_CAP\t\t0x08\n#define\tSMP_DIS_ATT_IN_ZPSDS_PER\t0x04\n#define\tSMP_DIS_ATT_REQ_IN_ZPSDS\t0x02\n#define\tSMP_DIS_ATT_BREAK_RPL_CAP\t0x01\n\tuint8_t\treserved2[6];\n\tuint8_t\tlink_rate0;\n#define\tSMP_DIS_PROG_MIN_LR_MASK\t0xf0\n#define\tSMP_DIS_PROG_MIN_LR_SHIFT\t4\n#define\tSMP_DIS_HARD_MIN_LR_MASK\t0x0f\n\tuint8_t\tlink_rate1;\n#define\tSMP_DIS_PROG_MAX_LR_MAX\t\t0xf0\n#define\tSMP_DIS_PROG_MAX_LR_SHIFT\t4\n#define\tSMP_DIS_HARD_MAX_LR_MASK\t0x0f\n\tuint8_t\tphy_change_count;\n\tuint8_t\tpp_timeout;\n#define\tSMP_DIS_VIRTUAL_PHY\t\t0x80\n#define\tSMP_DIS_PP_TIMEOUT_MASK\t\t0x0f\n\tuint8_t\trouting_attr;\n\tuint8_t\tconn_type;\n\tuint8_t\tconn_el_index;\n\tuint8_t\tconn_phys_link;\n\tuint8_t\tconfig_bits3;\n#define\tSMP_DIS_PHY_POW_COND_MASK\t0xc0\n#define\tSMP_DIS_PHY_POW_COND_SHIFT\t6\n#define\tSMP_DIS_SAS_SLUMB_CAP\t\t0x08\n#define\tSMP_DIS_SAS_PART_CAP\t\t0x04\n#define\tSMP_DIS_SATA_SLUMB_CAP\t\t0x02\n#define\tSMP_DIS_SATA_PART_CAP\t\t0x01\n\tuint8_t\tconfig_bits4;\n#define\tSMP_DIS_SAS_SLUMB_ENB\t\t0x08\n#define\tSMP_DIS_SAS_PART_ENB\t\t0x04\n#define\tSMP_DIS_SATA_SLUMB_ENB\t\t0x02\n#define\tSMP_DIS_SATA_PART_ENB\t\t0x01\n\tuint8_t\tvendor_spec[2];\n\tuint8_t\tattached_dev_name[8];\n\tuint8_t\tconfig_bits5;\n#define\tSMP_DIS_REQ_IN_ZPSDS_CHG\t0x40\n#define\tSMP_DIS_IN_ZPSDS_PER\t\t0x20\n#define\tSMP_DIS_REQ_IN_ZPSDS\t\t0x10\n#define\tSMP_DIS_ZG_PER\t\t\t0x04\n#define\tSMP_DIS_IN_ZPSDS\t\t0x02\n#define\tSMP_DIS_ZONING_ENB\t\t0x01\n\tuint8_t\treserved3[2];\n\tuint8_t\tzone_group;\n\tuint8_t\tself_config_status;\n\tuint8_t\tself_config_levels_comp;\n\tuint8_t\treserved4[2];\n\tuint8_t\tself_config_sas_addr[8];\n\tuint8_t\tprog_phy_cap[4];\n\tuint8_t\tcurrent_phy_cap[4];\n\tuint8_t\tattached_phy_cap[4];\n\tuint8_t\treserved5[6];\n\tuint8_t\tneg_phys_link_rate;\n#define\tSMP_DIS_REASON_MASK\t\t0xf0\n#define\tSMP_DIS_REASON_SHIFT\t\t4\n#define\tSMP_DIS_PHYS_LR_MASK\t\t0x0f\n\tuint8_t\tconfig_bits6;\n#define\tSMP_DIS_OPTICAL_MODE_ENB\t0x04\n#define\tSMP_DIS_NEG_SSC\t\t\t0x02\n#define\tSMP_DIS_HW_MUX_SUP\t\t0x01\n\tuint8_t\tconfig_bits7;\n#define\tSMP_DIS_DEF_IN_ZPSDS_PER\t0x20\n#define\tSMP_DIS_DEF_REQ_IN_ZPSDS\t0x10\n#define\tSMP_DIS_DEF_ZG_PER\t\t0x04\n#define\tSMP_DIS_DEF_ZONING_ENB\t\t0x01\n\tuint8_t\treserved6;\n\tuint8_t\treserved7;\n\tuint8_t\tdefault_zone_group;\n\tuint8_t\tconfig_bits8;\n#define\tSMP_DIS_SAVED_IN_ZPSDS_PER\t0x20\n#define\tSMP_DIS_SAVED_REQ_IN_SPSDS\t0x10\n#define\tSMP_DIS_SAVED_ZG_PER\t\t0x04\n#define\tSMP_DIS_SAVED_ZONING_ENB\t0x01\n\tuint8_t\treserved8;\n\tuint8_t\treserved9;\n\tuint8_t\tsaved_zone_group;\n\tuint8_t\tconfig_bits9;\n#define\tSMP_DIS_SHADOW_IN_ZPSDS_PER\t0x20\n#define\tSMP_DIS_SHADOW_IN_REQ_IN_ZPSDS\t0x10\n#define\tSMP_DIS_SHADOW_ZG_PER\t\t0x04\n\tuint8_t reserved10;\n\tuint8_t reserved11;\n\tuint8_t\tshadow_zone_group;\n\tuint8_t\tdevice_slot_num;\n\tuint8_t\tdevice_slot_group_num;\n\tuint8_t\tdevice_slot_group_out_conn[6];\n\tuint8_t\tstp_buffer_size[2];\n\tuint8_t\treserved12;\n\tuint8_t\treserved13;\n\tuint8_t\tcrc[4];\n};\n\n/*\n * PHY CONTROL request and response.  Current as of SPL Revision 7.\n */\nstruct smp_phy_control_request\n{\n\tuint8_t\tframe_type;\n\tuint8_t\tfunction;\n\tuint8_t response_len;\n#define\tSMP_PC_RESPONSE_LEN\t\t0x00\n\tuint8_t request_len;\n#define\tSMP_PC_REQUEST_LEN\t\t0x09\n\tuint8_t expected_exp_chg_cnt[2];\n\tuint8_t reserved0[3];\n\tuint8_t phy;\n\tuint8_t phy_operation;\n#define\tSMP_PC_PHY_OP_NOP\t\t0x00\n#define\tSMP_PC_PHY_OP_LINK_RESET\t0x01\n#define\tSMP_PC_PHY_OP_HARD_RESET\t0x02\n#define\tSMP_PC_PHY_OP_DISABLE\t\t0x03\n#define\tSMP_PC_PHY_OP_CLEAR_ERR_LOG\t0x05\n#define\tSMP_PC_PHY_OP_CLEAR_AFFILIATON\t0x06\n#define\tSMP_PC_PHY_OP_TRANS_SATA_PSS\t0x07\n#define\tSMP_PC_PHY_OP_CLEAR_STP_ITN_LS\t0x08\n#define\tSMP_PC_PHY_OP_SET_ATT_DEV_NAME\t0x09\n\tuint8_t update_pp_timeout;\n#define\tSMP_PC_UPDATE_PP_TIMEOUT\t0x01\n\tuint8_t reserved1[12];\n\tuint8_t attached_device_name[8];\n\tuint8_t prog_min_phys_link_rate;\n#define\tSMP_PC_PROG_MIN_PL_RATE_MASK\t0xf0\n#define\tSMP_PC_PROG_MIN_PL_RATE_SHIFT\t4\n\tuint8_t prog_max_phys_link_rate;\n#define\tSMP_PC_PROG_MAX_PL_RATE_MASK\t0xf0\n#define\tSMP_PC_PROG_MAX_PL_RATE_SHIFT\t4\n\tuint8_t\tconfig_bits0;\n#define\tSMP_PC_SP_NC\t\t\t0x00\n#define\tSMP_PC_SP_DISABLE\t\t0x02\n#define\tSMP_PC_SP_ENABLE\t\t0x01\n#define\tSMP_PC_SAS_SLUMBER_NC\t\t0x00\n#define\tSMP_PC_SAS_SLUMBER_DISABLE\t0x80\n#define\tSMP_PC_SAS_SLUMBER_ENABLE\t0x40\n#define\tSMP_PC_SAS_SLUMBER_MASK\t\t0xc0\n#define\tSMP_PC_SAS_SLUMBER_SHIFT\t6\n#define\tSMP_PC_SAS_PARTIAL_NC\t\t0x00\n#define\tSMP_PC_SAS_PARTIAL_DISABLE\t0x20\n#define\tSMP_PC_SAS_PARTIAL_ENABLE\t0x10\n#define\tSMP_PC_SAS_PARTIAL_MASK\t\t0x30\n#define\tSMP_PC_SAS_PARTIAL_SHIFT\t4\n#define\tSMP_PC_SATA_SLUMBER_NC\t\t0x00\n#define\tSMP_PC_SATA_SLUMBER_DISABLE\t0x08\n#define\tSMP_PC_SATA_SLUMBER_ENABLE\t0x04\n#define\tSMP_PC_SATA_SLUMBER_MASK\t0x0c\n#define\tSMP_PC_SATA_SLUMBER_SHIFT\t2\n#define\tSMP_PC_SATA_PARTIAL_NC\t\t0x00\n#define\tSMP_PC_SATA_PARTIAL_DISABLE\t0x02\n#define\tSMP_PC_SATA_PARTIAL_ENABLE\t0x01\n#define\tSMP_PC_SATA_PARTIAL_MASK\t0x03\n#define\tSMP_PC_SATA_PARTIAL_SHIFT\t0\n\tuint8_t\treserved2;\n\tuint8_t\tpp_timeout_value;\n#define\tSMP_PC_PP_TIMEOUT_MASK\t\t0x0f\n\tuint8_t reserved3[3];\n\tuint8_t\tcrc[4];\n};\n\nstruct smp_phy_control_response\n{\n\tuint8_t\tframe_type;\n\tuint8_t\tfunction;\n\tuint8_t\tfunction_result;\n\tuint8_t\tresponse_len;\n#define\tSMP_PC_RESPONSE_LEN\t\t0x00\n\tuint8_t crc[4];\n};\n\n__BEGIN_DECLS\n\nconst char *smp_error_desc(int function_result);\nconst char *smp_command_desc(uint8_t cmd_num);\nvoid smp_command_decode(uint8_t *smp_request, int request_len, struct sbuf *sb,\n\t\t\tchar *line_prefix, int first_line_len, int line_len);\nvoid smp_command_sbuf(struct ccb_smpio *smpio, struct sbuf *sb,\n\t\t      char *line_prefix, int first_line_len, int line_len);\n\n#ifdef _KERNEL\nvoid smp_error_sbuf(struct ccb_smpio *smpio, struct sbuf *sb);\n#else /* !_KERNEL*/\nvoid smp_error_sbuf(struct cam_device *device, struct ccb_smpio *smpio,\n\t\t    struct sbuf *sb);\n#endif /* _KERNEL/!_KERNEL */\n\nvoid smp_report_general_sbuf(struct smp_report_general_response *response,\n\t\t\t     int response_len, struct sbuf *sb);\n\nvoid smp_report_manuf_info_sbuf(struct smp_report_manuf_info_response *response,\n\t\t\t\tint response_len, struct sbuf *sb);\n\nvoid smp_report_general(struct ccb_smpio *smpio, uint32_t retries,\n\t\t\tvoid (*cbfcnp)(struct cam_periph *, union ccb *),\n\t\t\tstruct smp_report_general_request *request,\n\t\t\tint request_len, uint8_t *response, int response_len,\n\t\t\tint long_response, uint32_t timeout);\n\nvoid smp_discover(struct ccb_smpio *smpio, uint32_t retries,\n\t\t  void (*cbfcnp)(struct cam_periph *, union ccb *),\n\t\t  struct smp_discover_request *request, int request_len,\n\t\t  uint8_t *response, int response_len, int long_response,\n\t\t  int ignore_zone_group, int phy, uint32_t timeout);\n\nvoid smp_report_manuf_info(struct ccb_smpio *smpio, uint32_t retries,\n\t\t\t   void (*cbfcnp)(struct cam_periph *, union ccb *),\n\t\t\t   struct smp_report_manuf_info_request *request,\n\t\t\t   int request_len, uint8_t *response, int response_len,\n\t\t\t   int long_response, uint32_t timeout);\n\nvoid smp_phy_control(struct ccb_smpio *smpio, uint32_t retries,\n\t\t     void (*cbfcnp)(struct cam_periph *, union ccb *),\n\t\t     struct smp_phy_control_request *request, int request_len,\n\t\t     uint8_t *response, int response_len, int long_response,\n\t\t     uint32_t expected_exp_change_count, int phy, int phy_op,\n\t\t     int update_pp_timeout_val, uint64_t attached_device_name,\n\t\t     int prog_min_prl, int prog_max_prl, int slumber_partial,\n\t\t     int pp_timeout_value, uint32_t timeout);\n__END_DECLS\n\n#endif /*_SCSI_SMP_ALL_H*/\n"
  },
  {
    "path": "freebsd-headers/camlib.h",
    "content": "/*\n * Copyright (c) 1997, 1998 Kenneth D. Merry.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. The name of the author may not be used to endorse or promote products\n *    derived from this software without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/lib/libcam/camlib.h 95331 2002-04-23 23:58:20Z obrien $\n */\n/*\n * Buffer encoding/decoding routines taken from the original FreeBSD SCSI\n * library and slightly modified.  The original header file had the following\n * copyright:\n */\n/* Copyright (c) 1994 HD Associates (hd@world.std.com)\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. All advertising materials mentioning features or use of this software\n *    must display the following acknowledgement:\n * This product includes software developed by HD Associates\n * 4. Neither the name of the HD Associaates nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY HD ASSOCIATES``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL HD ASSOCIATES OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n */\n\n\n#ifndef _CAMLIB_H\n#define _CAMLIB_H\n\n#include <sys/cdefs.h>\n#include <sys/param.h>\n\n#include <cam/cam.h>\n#include <cam/cam_ccb.h>\n\n#define CAM_ERRBUF_SIZE 2048\t/* sizeof the CAM libarary error string  */\n\n/*\n * Right now we hard code the transport layer device, but this will change\n * if we ever get more than one transport layer.\n */\n#define XPT_DEVICE\t\"/dev/xpt0\"\n\n\nextern char cam_errbuf[];\n\nstruct cam_device {\n\tchar \t\tdevice_path[MAXPATHLEN];/*\n\t\t\t\t\t\t   * Pathname of the device \n\t\t\t\t\t\t   * given by the user. This\n\t\t\t\t\t\t   * may be null if the\n\t\t\t\t\t\t   * user states the device\n\t\t\t\t\t\t   * name and unit number\n\t\t\t\t\t\t   * separately.\n\t\t\t\t\t\t   */\n\tchar\t\tgiven_dev_name[DEV_IDLEN+1];/*\n\t\t\t\t\t\t     * Device name given by\n\t\t\t\t\t\t     * the user.\n\t\t\t\t\t\t     */\n\tu_int32_t\tgiven_unit_number;\t    /*\n\t\t\t\t\t\t     * Unit number given by\n\t\t\t\t\t\t     * the user.\n\t\t\t\t\t\t     */\n\tchar\t\tdevice_name[DEV_IDLEN+1];/* \n\t\t\t\t\t\t  * Name of the device, \n\t\t\t\t\t\t  * e.g. 'pass' \n\t\t\t\t\t\t  */\n\tu_int32_t\tdev_unit_num;\t/* Unit number of the passthrough\n\t\t\t\t\t * device associated with this\n\t\t\t\t\t * particular device.\n\t\t\t\t\t */\n\t\n\tchar\t\tsim_name[SIM_IDLEN+1]; /* Controller name, e.g. 'ahc' */\n\tu_int32_t\tsim_unit_number; /* Controller unit number */\n\tu_int32_t\tbus_id;\t\t /* Controller bus number */\n\tlun_id_t\ttarget_lun;\t /* Logical Unit Number */\n\ttarget_id_t\ttarget_id;\t /* Target ID */\n\tpath_id_t\tpath_id;\t /* System SCSI bus number */\n\tu_int16_t\tpd_type;\t /* type of peripheral device */\n\tstruct scsi_inquiry_data inq_data;  /* SCSI Inquiry data */\n\tu_int8_t\tserial_num[252]; /* device serial number */\n\tu_int8_t\tserial_num_len;  /* length of the serial number */\n\tu_int8_t\tsync_period;\t /* Negotiated sync period */\n\tu_int8_t\tsync_offset;\t /* Negotiated sync offset */\n\tu_int8_t\tbus_width;\t /* Negotiated bus width */\n\tint\t\tfd;\t\t /* file descriptor for device */\n};\n\n__BEGIN_DECLS\n/* Basic utility commands */\nstruct cam_device *\tcam_open_device(const char *path, int flags);\nvoid\t\t\tcam_close_device(struct cam_device *dev);\nvoid\t\t\tcam_close_spec_device(struct cam_device *dev);\nstruct cam_device *\tcam_open_spec_device(const char *dev_name,\n\t\t\t\t\t     int unit, int flags,\n\t\t\t\t\t     struct cam_device *device);\nstruct cam_device *\tcam_open_btl(path_id_t path_id, target_id_t target_id,\n\t\t\t\t     lun_id_t target_lun, int flags,\n\t\t\t\t     struct cam_device *device);\nstruct cam_device *\tcam_open_pass(const char *path, int flags,\n\t\t\t\t      struct cam_device *device);\nunion ccb *\t\tcam_getccb(struct cam_device *dev);\nvoid\t\t\tcam_freeccb(union ccb *ccb);\nint\t\t\tcam_send_ccb(struct cam_device *device, union ccb *ccb);\nchar *\t\t\tcam_path_string(struct cam_device *dev, char *str,\n\t\t\t\t\tint len);\nstruct cam_device *\tcam_device_dup(struct cam_device *device);\nvoid\t\t\tcam_device_copy(struct cam_device *src, \n\t\t\t\t\tstruct cam_device *dst);\nint\t\t\tcam_get_device(const char *path, char *dev_name,\n\t\t\t\t       int devnamelen, int *unit);\n\n/*\n * Buffer encoding/decoding routines, from the old SCSI library.\n */\nint csio_decode(struct ccb_scsiio *csio, const char *fmt, ...)\n\t\t__printflike(2, 3);\nint csio_decode_visit(struct ccb_scsiio *csio, const char *fmt,\n\t\t      void (*arg_put)(void *, int, void *, int, char *),\n\t\t      void *puthook);\nint buff_decode(u_int8_t *buff, size_t len, const char *fmt, ...)\n\t\t__printflike(3, 4);\nint buff_decode_visit(u_int8_t *buff, size_t len, const char *fmt,\n\t\t      void (*arg_put)(void *, int, void *, int, char *),\n\t\t      void *puthook);\nint csio_build(struct ccb_scsiio *csio, u_int8_t *data_ptr,\n\t       u_int32_t dxfer_len, u_int32_t flags, int retry_count,\n\t       int timeout, const char *cmd_spec, ...);\nint csio_build_visit(struct ccb_scsiio *csio, u_int8_t *data_ptr,\n\t\t     u_int32_t dxfer_len, u_int32_t flags, int retry_count,\n\t\t     int timeout, const char *cmd_spec,\n\t\t     int (*arg_get)(void *hook, char *field_name),\n\t\t     void *gethook);\nint csio_encode(struct ccb_scsiio *csio, const char *fmt, ...)\n\t\t__printflike(2, 3);\nint buff_encode_visit(u_int8_t *buff, size_t len, const char *fmt,\n\t\t      int (*arg_get)(void *hook, char *field_name),\n\t\t      void *gethook);\nint csio_encode_visit(struct ccb_scsiio *csio, const char *fmt,\n\t\t      int (*arg_get)(void *hook, char *field_name),\n\t\t      void *gethook);\n__END_DECLS\n\n#endif /* _CAMLIB_H */\n"
  },
  {
    "path": "freebsd-headers/capstone/arm.h",
    "content": "#ifndef CAPSTONE_ARM_H\n#define CAPSTONE_ARM_H\n\n/* Capstone Disassembly Engine */\n/* By Nguyen Anh Quynh <aquynh@gmail.com>, 2013-2015 */\n\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\n#include \"platform.h\"\n\n#ifdef _MSC_VER\n#pragma warning(disable:4201)\n#endif\n\n/// ARM shift type\ntypedef enum arm_shifter {\n\tARM_SFT_INVALID = 0,\n\tARM_SFT_ASR,\t///< shift with immediate const\n\tARM_SFT_LSL,\t///< shift with immediate const\n\tARM_SFT_LSR,\t///< shift with immediate const\n\tARM_SFT_ROR,\t///< shift with immediate const\n\tARM_SFT_RRX,\t///< shift with immediate const\n\tARM_SFT_ASR_REG,\t///< shift with register\n\tARM_SFT_LSL_REG,\t///< shift with register\n\tARM_SFT_LSR_REG,\t///< shift with register\n\tARM_SFT_ROR_REG,\t///< shift with register\n\tARM_SFT_RRX_REG,\t///< shift with register\n} arm_shifter;\n\n/// ARM condition code\ntypedef enum arm_cc {\n\tARM_CC_INVALID = 0,\n\tARM_CC_EQ,            ///< Equal                      Equal\n\tARM_CC_NE,            ///< Not equal                  Not equal, or unordered\n\tARM_CC_HS,            ///< Carry set                  >, ==, or unordered\n\tARM_CC_LO,            ///< Carry clear                Less than\n\tARM_CC_MI,            ///< Minus, negative            Less than\n\tARM_CC_PL,            ///< Plus, positive or zero     >, ==, or unordered\n\tARM_CC_VS,            ///< Overflow                   Unordered\n\tARM_CC_VC,            ///< No overflow                Not unordered\n\tARM_CC_HI,            ///< Unsigned higher            Greater than, or unordered\n\tARM_CC_LS,            ///< Unsigned lower or same     Less than or equal\n\tARM_CC_GE,            ///< Greater than or equal      Greater than or equal\n\tARM_CC_LT,            ///< Less than                  Less than, or unordered\n\tARM_CC_GT,            ///< Greater than               Greater than\n\tARM_CC_LE,            ///< Less than or equal         <, ==, or unordered\n\tARM_CC_AL             ///< Always (unconditional)     Always (unconditional)\n} arm_cc;\n\ntypedef enum arm_sysreg {\n\t/// Special registers for MSR\n\tARM_SYSREG_INVALID = 0,\n\n\t// SPSR* registers can be OR combined\n\tARM_SYSREG_SPSR_C = 1,\n\tARM_SYSREG_SPSR_X = 2,\n\tARM_SYSREG_SPSR_S = 4,\n\tARM_SYSREG_SPSR_F = 8,\n\n\t// CPSR* registers can be OR combined\n\tARM_SYSREG_CPSR_C = 16,\n\tARM_SYSREG_CPSR_X = 32,\n\tARM_SYSREG_CPSR_S = 64,\n\tARM_SYSREG_CPSR_F = 128,\n\n\t// independent registers\n\tARM_SYSREG_APSR = 256,\n\tARM_SYSREG_APSR_G,\n\tARM_SYSREG_APSR_NZCVQ,\n\tARM_SYSREG_APSR_NZCVQG,\n\n\tARM_SYSREG_IAPSR,\n\tARM_SYSREG_IAPSR_G,\n\tARM_SYSREG_IAPSR_NZCVQG,\n\tARM_SYSREG_IAPSR_NZCVQ,\n\n\tARM_SYSREG_EAPSR,\n\tARM_SYSREG_EAPSR_G,\n\tARM_SYSREG_EAPSR_NZCVQG,\n\tARM_SYSREG_EAPSR_NZCVQ,\n\n\tARM_SYSREG_XPSR,\n\tARM_SYSREG_XPSR_G,\n\tARM_SYSREG_XPSR_NZCVQG,\n\tARM_SYSREG_XPSR_NZCVQ,\n\n\tARM_SYSREG_IPSR,\n\tARM_SYSREG_EPSR,\n\tARM_SYSREG_IEPSR,\n\n\tARM_SYSREG_MSP,\n\tARM_SYSREG_PSP,\n\tARM_SYSREG_PRIMASK,\n\tARM_SYSREG_BASEPRI,\n\tARM_SYSREG_BASEPRI_MAX,\n\tARM_SYSREG_FAULTMASK,\n\tARM_SYSREG_CONTROL,\n\n\t// Banked Registers\n\tARM_SYSREG_R8_USR,\n\tARM_SYSREG_R9_USR,\n\tARM_SYSREG_R10_USR,\n\tARM_SYSREG_R11_USR,\n\tARM_SYSREG_R12_USR,\n\tARM_SYSREG_SP_USR,\n\tARM_SYSREG_LR_USR,\n\tARM_SYSREG_R8_FIQ,\n\tARM_SYSREG_R9_FIQ,\n\tARM_SYSREG_R10_FIQ,\n\tARM_SYSREG_R11_FIQ,\n\tARM_SYSREG_R12_FIQ,\n\tARM_SYSREG_SP_FIQ,\n\tARM_SYSREG_LR_FIQ,\n\tARM_SYSREG_LR_IRQ,\n\tARM_SYSREG_SP_IRQ,\n\tARM_SYSREG_LR_SVC,\n\tARM_SYSREG_SP_SVC,\n\tARM_SYSREG_LR_ABT,\n\tARM_SYSREG_SP_ABT,\n\tARM_SYSREG_LR_UND,\n\tARM_SYSREG_SP_UND,\n\tARM_SYSREG_LR_MON,\n\tARM_SYSREG_SP_MON,\n\tARM_SYSREG_ELR_HYP,\n\tARM_SYSREG_SP_HYP,\n\n\tARM_SYSREG_SPSR_FIQ,\n\tARM_SYSREG_SPSR_IRQ,\n\tARM_SYSREG_SPSR_SVC,\n\tARM_SYSREG_SPSR_ABT,\n\tARM_SYSREG_SPSR_UND,\n\tARM_SYSREG_SPSR_MON,\n\tARM_SYSREG_SPSR_HYP,\n} arm_sysreg;\n\n/// The memory barrier constants map directly to the 4-bit encoding of\n/// the option field for Memory Barrier operations.\ntypedef enum arm_mem_barrier {\n\tARM_MB_INVALID = 0,\n\tARM_MB_RESERVED_0,\n\tARM_MB_OSHLD,\n\tARM_MB_OSHST,\n\tARM_MB_OSH,\n\tARM_MB_RESERVED_4,\n\tARM_MB_NSHLD,\n\tARM_MB_NSHST,\n\tARM_MB_NSH,\n\tARM_MB_RESERVED_8,\n\tARM_MB_ISHLD,\n\tARM_MB_ISHST,\n\tARM_MB_ISH,\n\tARM_MB_RESERVED_12,\n\tARM_MB_LD,\n\tARM_MB_ST,\n\tARM_MB_SY,\n} arm_mem_barrier;\n\n/// Operand type for instruction's operands\ntypedef enum arm_op_type {\n\tARM_OP_INVALID = 0, ///< = CS_OP_INVALID (Uninitialized).\n\tARM_OP_REG, ///< = CS_OP_REG (Register operand).\n\tARM_OP_IMM, ///< = CS_OP_IMM (Immediate operand).\n\tARM_OP_MEM, ///< = CS_OP_MEM (Memory operand).\n\tARM_OP_FP,  ///< = CS_OP_FP (Floating-Point operand).\n\tARM_OP_CIMM = 64, ///< C-Immediate (coprocessor registers)\n\tARM_OP_PIMM, ///< P-Immediate (coprocessor registers)\n\tARM_OP_SETEND,\t///< operand for SETEND instruction\n\tARM_OP_SYSREG,\t///< MSR/MRS special register operand\n} arm_op_type;\n\n/// Operand type for SETEND instruction\ntypedef enum arm_setend_type {\n\tARM_SETEND_INVALID = 0,\t///< Uninitialized.\n\tARM_SETEND_BE,\t///< BE operand.\n\tARM_SETEND_LE, ///< LE operand\n} arm_setend_type;\n\ntypedef enum arm_cpsmode_type {\n\tARM_CPSMODE_INVALID = 0,\n\tARM_CPSMODE_IE = 2,\n\tARM_CPSMODE_ID = 3\n} arm_cpsmode_type;\n\n/// Operand type for SETEND instruction\ntypedef enum arm_cpsflag_type {\n\tARM_CPSFLAG_INVALID = 0,\n\tARM_CPSFLAG_F = 1,\n\tARM_CPSFLAG_I = 2,\n\tARM_CPSFLAG_A = 4,\n\tARM_CPSFLAG_NONE = 16,\t///< no flag\n} arm_cpsflag_type;\n\n/// Data type for elements of vector instructions.\ntypedef enum arm_vectordata_type {\n\tARM_VECTORDATA_INVALID = 0,\n\n\t// Integer type\n\tARM_VECTORDATA_I8,\n\tARM_VECTORDATA_I16,\n\tARM_VECTORDATA_I32,\n\tARM_VECTORDATA_I64,\n\n\t// Signed integer type\n\tARM_VECTORDATA_S8,\n\tARM_VECTORDATA_S16,\n\tARM_VECTORDATA_S32,\n\tARM_VECTORDATA_S64,\n\n\t// Unsigned integer type\n\tARM_VECTORDATA_U8,\n\tARM_VECTORDATA_U16,\n\tARM_VECTORDATA_U32,\n\tARM_VECTORDATA_U64,\n\n\t// Data type for VMUL/VMULL\n\tARM_VECTORDATA_P8,\n\n\t// Floating type\n\tARM_VECTORDATA_F32,\n\tARM_VECTORDATA_F64,\n\n\t// Convert float <-> float\n\tARM_VECTORDATA_F16F64,\t// f16.f64\n\tARM_VECTORDATA_F64F16,\t// f64.f16\n\tARM_VECTORDATA_F32F16,\t// f32.f16\n\tARM_VECTORDATA_F16F32,\t// f32.f16\n\tARM_VECTORDATA_F64F32,\t// f64.f32\n\tARM_VECTORDATA_F32F64,\t// f32.f64\n\n\t// Convert integer <-> float\n\tARM_VECTORDATA_S32F32,\t// s32.f32\n\tARM_VECTORDATA_U32F32,\t// u32.f32\n\tARM_VECTORDATA_F32S32,\t// f32.s32\n\tARM_VECTORDATA_F32U32,\t// f32.u32\n\tARM_VECTORDATA_F64S16,\t// f64.s16\n\tARM_VECTORDATA_F32S16,\t// f32.s16\n\tARM_VECTORDATA_F64S32,\t// f64.s32\n\tARM_VECTORDATA_S16F64,\t// s16.f64\n\tARM_VECTORDATA_S16F32,\t// s16.f64\n\tARM_VECTORDATA_S32F64,\t// s32.f64\n\tARM_VECTORDATA_U16F64,\t// u16.f64\n\tARM_VECTORDATA_U16F32,\t// u16.f32\n\tARM_VECTORDATA_U32F64,\t// u32.f64\n\tARM_VECTORDATA_F64U16,\t// f64.u16\n\tARM_VECTORDATA_F32U16,\t// f32.u16\n\tARM_VECTORDATA_F64U32,\t// f64.u32\n} arm_vectordata_type;\n\n/// ARM registers\ntypedef enum arm_reg {\n\tARM_REG_INVALID = 0,\n\tARM_REG_APSR,\n\tARM_REG_APSR_NZCV,\n\tARM_REG_CPSR,\n\tARM_REG_FPEXC,\n\tARM_REG_FPINST,\n\tARM_REG_FPSCR,\n\tARM_REG_FPSCR_NZCV,\n\tARM_REG_FPSID,\n\tARM_REG_ITSTATE,\n\tARM_REG_LR,\n\tARM_REG_PC,\n\tARM_REG_SP,\n\tARM_REG_SPSR,\n\tARM_REG_D0,\n\tARM_REG_D1,\n\tARM_REG_D2,\n\tARM_REG_D3,\n\tARM_REG_D4,\n\tARM_REG_D5,\n\tARM_REG_D6,\n\tARM_REG_D7,\n\tARM_REG_D8,\n\tARM_REG_D9,\n\tARM_REG_D10,\n\tARM_REG_D11,\n\tARM_REG_D12,\n\tARM_REG_D13,\n\tARM_REG_D14,\n\tARM_REG_D15,\n\tARM_REG_D16,\n\tARM_REG_D17,\n\tARM_REG_D18,\n\tARM_REG_D19,\n\tARM_REG_D20,\n\tARM_REG_D21,\n\tARM_REG_D22,\n\tARM_REG_D23,\n\tARM_REG_D24,\n\tARM_REG_D25,\n\tARM_REG_D26,\n\tARM_REG_D27,\n\tARM_REG_D28,\n\tARM_REG_D29,\n\tARM_REG_D30,\n\tARM_REG_D31,\n\tARM_REG_FPINST2,\n\tARM_REG_MVFR0,\n\tARM_REG_MVFR1,\n\tARM_REG_MVFR2,\n\tARM_REG_Q0,\n\tARM_REG_Q1,\n\tARM_REG_Q2,\n\tARM_REG_Q3,\n\tARM_REG_Q4,\n\tARM_REG_Q5,\n\tARM_REG_Q6,\n\tARM_REG_Q7,\n\tARM_REG_Q8,\n\tARM_REG_Q9,\n\tARM_REG_Q10,\n\tARM_REG_Q11,\n\tARM_REG_Q12,\n\tARM_REG_Q13,\n\tARM_REG_Q14,\n\tARM_REG_Q15,\n\tARM_REG_R0,\n\tARM_REG_R1,\n\tARM_REG_R2,\n\tARM_REG_R3,\n\tARM_REG_R4,\n\tARM_REG_R5,\n\tARM_REG_R6,\n\tARM_REG_R7,\n\tARM_REG_R8,\n\tARM_REG_R9,\n\tARM_REG_R10,\n\tARM_REG_R11,\n\tARM_REG_R12,\n\tARM_REG_S0,\n\tARM_REG_S1,\n\tARM_REG_S2,\n\tARM_REG_S3,\n\tARM_REG_S4,\n\tARM_REG_S5,\n\tARM_REG_S6,\n\tARM_REG_S7,\n\tARM_REG_S8,\n\tARM_REG_S9,\n\tARM_REG_S10,\n\tARM_REG_S11,\n\tARM_REG_S12,\n\tARM_REG_S13,\n\tARM_REG_S14,\n\tARM_REG_S15,\n\tARM_REG_S16,\n\tARM_REG_S17,\n\tARM_REG_S18,\n\tARM_REG_S19,\n\tARM_REG_S20,\n\tARM_REG_S21,\n\tARM_REG_S22,\n\tARM_REG_S23,\n\tARM_REG_S24,\n\tARM_REG_S25,\n\tARM_REG_S26,\n\tARM_REG_S27,\n\tARM_REG_S28,\n\tARM_REG_S29,\n\tARM_REG_S30,\n\tARM_REG_S31,\n\n\tARM_REG_ENDING,\t\t// <-- mark the end of the list or registers\n\n\t// alias registers\n\tARM_REG_R13 = ARM_REG_SP,\n\tARM_REG_R14 = ARM_REG_LR,\n\tARM_REG_R15 = ARM_REG_PC,\n\n\tARM_REG_SB = ARM_REG_R9,\n\tARM_REG_SL = ARM_REG_R10,\n\tARM_REG_FP = ARM_REG_R11,\n\tARM_REG_IP = ARM_REG_R12,\n} arm_reg;\n\n/// Instruction's operand referring to memory\n/// This is associated with ARM_OP_MEM operand type above\ntypedef struct arm_op_mem {\n\tarm_reg base;\t///< base register\n\tarm_reg index;\t///< index register\n\tint scale;\t///< scale for index register (can be 1, or -1)\n\tint disp;\t///< displacement/offset value\n\t/// left-shift on index register, or 0 if irrelevant\n\t/// NOTE: this value can also be fetched via operand.shift.value\n\tint lshift;\n} arm_op_mem;\n\n/// Instruction operand\ntypedef struct cs_arm_op {\n\tint vector_index;\t///< Vector Index for some vector operands (or -1 if irrelevant)\n\n\tstruct {\n\t\tarm_shifter type;\n\t\tunsigned int value;\n\t} shift;\n\n\tarm_op_type type;\t///< operand type\n\n\tunion {\n\t\tint reg;\t///< register value for REG/SYSREG operand\n\t\tint32_t imm;\t\t\t///< immediate value for C-IMM, P-IMM or IMM operand\n\t\tdouble fp;\t\t\t///< floating point value for FP operand\n\t\tarm_op_mem mem;\t\t///< base/index/scale/disp value for MEM operand\n\t\tarm_setend_type setend; ///< SETEND instruction's operand type\n\t};\n\n\t/// in some instructions, an operand can be subtracted or added to\n\t/// the base register,\n\t/// if TRUE, this operand is subtracted. otherwise, it is added.\n\tbool subtracted;\n\n\t/// How is this operand accessed? (READ, WRITE or READ|WRITE)\n\t/// This field is combined of cs_ac_type.\n\t/// NOTE: this field is irrelevant if engine is compiled in DIET mode.\n\tuint8_t access;\n\n\t/// Neon lane index for NEON instructions (or -1 if irrelevant)\n\tint8_t neon_lane;\n} cs_arm_op;\n\n/// Instruction structure\ntypedef struct cs_arm {\n\tbool usermode;\t///< User-mode registers to be loaded (for LDM/STM instructions)\n\tint vector_size; \t///< Scalar size for vector instructions\n\tarm_vectordata_type vector_data; ///< Data type for elements of vector instructions\n\tarm_cpsmode_type cps_mode;\t///< CPS mode for CPS instruction\n\tarm_cpsflag_type cps_flag;\t///< CPS mode for CPS instruction\n\tarm_cc cc;\t\t\t///< conditional code for this insn\n\tbool update_flags;\t///< does this insn update flags?\n\tbool writeback;\t\t///< does this insn write-back?\n\tarm_mem_barrier mem_barrier;\t///< Option for some memory barrier instructions\n\n\t/// Number of operands of this instruction,\n\t/// or 0 when instruction has no operand.\n\tuint8_t op_count;\n\n\tcs_arm_op operands[36];\t///< operands for this instruction.\n} cs_arm;\n\n/// ARM instruction\ntypedef enum arm_insn {\n\tARM_INS_INVALID = 0,\n\n\tARM_INS_ADC,\n\tARM_INS_ADD,\n\tARM_INS_ADR,\n\tARM_INS_AESD,\n\tARM_INS_AESE,\n\tARM_INS_AESIMC,\n\tARM_INS_AESMC,\n\tARM_INS_AND,\n\tARM_INS_BFC,\n\tARM_INS_BFI,\n\tARM_INS_BIC,\n\tARM_INS_BKPT,\n\tARM_INS_BL,\n\tARM_INS_BLX,\n\tARM_INS_BX,\n\tARM_INS_BXJ,\n\tARM_INS_B,\n\tARM_INS_CDP,\n\tARM_INS_CDP2,\n\tARM_INS_CLREX,\n\tARM_INS_CLZ,\n\tARM_INS_CMN,\n\tARM_INS_CMP,\n\tARM_INS_CPS,\n\tARM_INS_CRC32B,\n\tARM_INS_CRC32CB,\n\tARM_INS_CRC32CH,\n\tARM_INS_CRC32CW,\n\tARM_INS_CRC32H,\n\tARM_INS_CRC32W,\n\tARM_INS_DBG,\n\tARM_INS_DMB,\n\tARM_INS_DSB,\n\tARM_INS_EOR,\n\tARM_INS_ERET,\n\tARM_INS_VMOV,\n\tARM_INS_FLDMDBX,\n\tARM_INS_FLDMIAX,\n\tARM_INS_VMRS,\n\tARM_INS_FSTMDBX,\n\tARM_INS_FSTMIAX,\n\tARM_INS_HINT,\n\tARM_INS_HLT,\n\tARM_INS_HVC,\n\tARM_INS_ISB,\n\tARM_INS_LDA,\n\tARM_INS_LDAB,\n\tARM_INS_LDAEX,\n\tARM_INS_LDAEXB,\n\tARM_INS_LDAEXD,\n\tARM_INS_LDAEXH,\n\tARM_INS_LDAH,\n\tARM_INS_LDC2L,\n\tARM_INS_LDC2,\n\tARM_INS_LDCL,\n\tARM_INS_LDC,\n\tARM_INS_LDMDA,\n\tARM_INS_LDMDB,\n\tARM_INS_LDM,\n\tARM_INS_LDMIB,\n\tARM_INS_LDRBT,\n\tARM_INS_LDRB,\n\tARM_INS_LDRD,\n\tARM_INS_LDREX,\n\tARM_INS_LDREXB,\n\tARM_INS_LDREXD,\n\tARM_INS_LDREXH,\n\tARM_INS_LDRH,\n\tARM_INS_LDRHT,\n\tARM_INS_LDRSB,\n\tARM_INS_LDRSBT,\n\tARM_INS_LDRSH,\n\tARM_INS_LDRSHT,\n\tARM_INS_LDRT,\n\tARM_INS_LDR,\n\tARM_INS_MCR,\n\tARM_INS_MCR2,\n\tARM_INS_MCRR,\n\tARM_INS_MCRR2,\n\tARM_INS_MLA,\n\tARM_INS_MLS,\n\tARM_INS_MOV,\n\tARM_INS_MOVT,\n\tARM_INS_MOVW,\n\tARM_INS_MRC,\n\tARM_INS_MRC2,\n\tARM_INS_MRRC,\n\tARM_INS_MRRC2,\n\tARM_INS_MRS,\n\tARM_INS_MSR,\n\tARM_INS_MUL,\n\tARM_INS_MVN,\n\tARM_INS_ORR,\n\tARM_INS_PKHBT,\n\tARM_INS_PKHTB,\n\tARM_INS_PLDW,\n\tARM_INS_PLD,\n\tARM_INS_PLI,\n\tARM_INS_QADD,\n\tARM_INS_QADD16,\n\tARM_INS_QADD8,\n\tARM_INS_QASX,\n\tARM_INS_QDADD,\n\tARM_INS_QDSUB,\n\tARM_INS_QSAX,\n\tARM_INS_QSUB,\n\tARM_INS_QSUB16,\n\tARM_INS_QSUB8,\n\tARM_INS_RBIT,\n\tARM_INS_REV,\n\tARM_INS_REV16,\n\tARM_INS_REVSH,\n\tARM_INS_RFEDA,\n\tARM_INS_RFEDB,\n\tARM_INS_RFEIA,\n\tARM_INS_RFEIB,\n\tARM_INS_RSB,\n\tARM_INS_RSC,\n\tARM_INS_SADD16,\n\tARM_INS_SADD8,\n\tARM_INS_SASX,\n\tARM_INS_SBC,\n\tARM_INS_SBFX,\n\tARM_INS_SDIV,\n\tARM_INS_SEL,\n\tARM_INS_SETEND,\n\tARM_INS_SHA1C,\n\tARM_INS_SHA1H,\n\tARM_INS_SHA1M,\n\tARM_INS_SHA1P,\n\tARM_INS_SHA1SU0,\n\tARM_INS_SHA1SU1,\n\tARM_INS_SHA256H,\n\tARM_INS_SHA256H2,\n\tARM_INS_SHA256SU0,\n\tARM_INS_SHA256SU1,\n\tARM_INS_SHADD16,\n\tARM_INS_SHADD8,\n\tARM_INS_SHASX,\n\tARM_INS_SHSAX,\n\tARM_INS_SHSUB16,\n\tARM_INS_SHSUB8,\n\tARM_INS_SMC,\n\tARM_INS_SMLABB,\n\tARM_INS_SMLABT,\n\tARM_INS_SMLAD,\n\tARM_INS_SMLADX,\n\tARM_INS_SMLAL,\n\tARM_INS_SMLALBB,\n\tARM_INS_SMLALBT,\n\tARM_INS_SMLALD,\n\tARM_INS_SMLALDX,\n\tARM_INS_SMLALTB,\n\tARM_INS_SMLALTT,\n\tARM_INS_SMLATB,\n\tARM_INS_SMLATT,\n\tARM_INS_SMLAWB,\n\tARM_INS_SMLAWT,\n\tARM_INS_SMLSD,\n\tARM_INS_SMLSDX,\n\tARM_INS_SMLSLD,\n\tARM_INS_SMLSLDX,\n\tARM_INS_SMMLA,\n\tARM_INS_SMMLAR,\n\tARM_INS_SMMLS,\n\tARM_INS_SMMLSR,\n\tARM_INS_SMMUL,\n\tARM_INS_SMMULR,\n\tARM_INS_SMUAD,\n\tARM_INS_SMUADX,\n\tARM_INS_SMULBB,\n\tARM_INS_SMULBT,\n\tARM_INS_SMULL,\n\tARM_INS_SMULTB,\n\tARM_INS_SMULTT,\n\tARM_INS_SMULWB,\n\tARM_INS_SMULWT,\n\tARM_INS_SMUSD,\n\tARM_INS_SMUSDX,\n\tARM_INS_SRSDA,\n\tARM_INS_SRSDB,\n\tARM_INS_SRSIA,\n\tARM_INS_SRSIB,\n\tARM_INS_SSAT,\n\tARM_INS_SSAT16,\n\tARM_INS_SSAX,\n\tARM_INS_SSUB16,\n\tARM_INS_SSUB8,\n\tARM_INS_STC2L,\n\tARM_INS_STC2,\n\tARM_INS_STCL,\n\tARM_INS_STC,\n\tARM_INS_STL,\n\tARM_INS_STLB,\n\tARM_INS_STLEX,\n\tARM_INS_STLEXB,\n\tARM_INS_STLEXD,\n\tARM_INS_STLEXH,\n\tARM_INS_STLH,\n\tARM_INS_STMDA,\n\tARM_INS_STMDB,\n\tARM_INS_STM,\n\tARM_INS_STMIB,\n\tARM_INS_STRBT,\n\tARM_INS_STRB,\n\tARM_INS_STRD,\n\tARM_INS_STREX,\n\tARM_INS_STREXB,\n\tARM_INS_STREXD,\n\tARM_INS_STREXH,\n\tARM_INS_STRH,\n\tARM_INS_STRHT,\n\tARM_INS_STRT,\n\tARM_INS_STR,\n\tARM_INS_SUB,\n\tARM_INS_SVC,\n\tARM_INS_SWP,\n\tARM_INS_SWPB,\n\tARM_INS_SXTAB,\n\tARM_INS_SXTAB16,\n\tARM_INS_SXTAH,\n\tARM_INS_SXTB,\n\tARM_INS_SXTB16,\n\tARM_INS_SXTH,\n\tARM_INS_TEQ,\n\tARM_INS_TRAP,\n\tARM_INS_TST,\n\tARM_INS_UADD16,\n\tARM_INS_UADD8,\n\tARM_INS_UASX,\n\tARM_INS_UBFX,\n\tARM_INS_UDF,\n\tARM_INS_UDIV,\n\tARM_INS_UHADD16,\n\tARM_INS_UHADD8,\n\tARM_INS_UHASX,\n\tARM_INS_UHSAX,\n\tARM_INS_UHSUB16,\n\tARM_INS_UHSUB8,\n\tARM_INS_UMAAL,\n\tARM_INS_UMLAL,\n\tARM_INS_UMULL,\n\tARM_INS_UQADD16,\n\tARM_INS_UQADD8,\n\tARM_INS_UQASX,\n\tARM_INS_UQSAX,\n\tARM_INS_UQSUB16,\n\tARM_INS_UQSUB8,\n\tARM_INS_USAD8,\n\tARM_INS_USADA8,\n\tARM_INS_USAT,\n\tARM_INS_USAT16,\n\tARM_INS_USAX,\n\tARM_INS_USUB16,\n\tARM_INS_USUB8,\n\tARM_INS_UXTAB,\n\tARM_INS_UXTAB16,\n\tARM_INS_UXTAH,\n\tARM_INS_UXTB,\n\tARM_INS_UXTB16,\n\tARM_INS_UXTH,\n\tARM_INS_VABAL,\n\tARM_INS_VABA,\n\tARM_INS_VABDL,\n\tARM_INS_VABD,\n\tARM_INS_VABS,\n\tARM_INS_VACGE,\n\tARM_INS_VACGT,\n\tARM_INS_VADD,\n\tARM_INS_VADDHN,\n\tARM_INS_VADDL,\n\tARM_INS_VADDW,\n\tARM_INS_VAND,\n\tARM_INS_VBIC,\n\tARM_INS_VBIF,\n\tARM_INS_VBIT,\n\tARM_INS_VBSL,\n\tARM_INS_VCEQ,\n\tARM_INS_VCGE,\n\tARM_INS_VCGT,\n\tARM_INS_VCLE,\n\tARM_INS_VCLS,\n\tARM_INS_VCLT,\n\tARM_INS_VCLZ,\n\tARM_INS_VCMP,\n\tARM_INS_VCMPE,\n\tARM_INS_VCNT,\n\tARM_INS_VCVTA,\n\tARM_INS_VCVTB,\n\tARM_INS_VCVT,\n\tARM_INS_VCVTM,\n\tARM_INS_VCVTN,\n\tARM_INS_VCVTP,\n\tARM_INS_VCVTT,\n\tARM_INS_VDIV,\n\tARM_INS_VDUP,\n\tARM_INS_VEOR,\n\tARM_INS_VEXT,\n\tARM_INS_VFMA,\n\tARM_INS_VFMS,\n\tARM_INS_VFNMA,\n\tARM_INS_VFNMS,\n\tARM_INS_VHADD,\n\tARM_INS_VHSUB,\n\tARM_INS_VLD1,\n\tARM_INS_VLD2,\n\tARM_INS_VLD3,\n\tARM_INS_VLD4,\n\tARM_INS_VLDMDB,\n\tARM_INS_VLDMIA,\n\tARM_INS_VLDR,\n\tARM_INS_VMAXNM,\n\tARM_INS_VMAX,\n\tARM_INS_VMINNM,\n\tARM_INS_VMIN,\n\tARM_INS_VMLA,\n\tARM_INS_VMLAL,\n\tARM_INS_VMLS,\n\tARM_INS_VMLSL,\n\tARM_INS_VMOVL,\n\tARM_INS_VMOVN,\n\tARM_INS_VMSR,\n\tARM_INS_VMUL,\n\tARM_INS_VMULL,\n\tARM_INS_VMVN,\n\tARM_INS_VNEG,\n\tARM_INS_VNMLA,\n\tARM_INS_VNMLS,\n\tARM_INS_VNMUL,\n\tARM_INS_VORN,\n\tARM_INS_VORR,\n\tARM_INS_VPADAL,\n\tARM_INS_VPADDL,\n\tARM_INS_VPADD,\n\tARM_INS_VPMAX,\n\tARM_INS_VPMIN,\n\tARM_INS_VQABS,\n\tARM_INS_VQADD,\n\tARM_INS_VQDMLAL,\n\tARM_INS_VQDMLSL,\n\tARM_INS_VQDMULH,\n\tARM_INS_VQDMULL,\n\tARM_INS_VQMOVUN,\n\tARM_INS_VQMOVN,\n\tARM_INS_VQNEG,\n\tARM_INS_VQRDMULH,\n\tARM_INS_VQRSHL,\n\tARM_INS_VQRSHRN,\n\tARM_INS_VQRSHRUN,\n\tARM_INS_VQSHL,\n\tARM_INS_VQSHLU,\n\tARM_INS_VQSHRN,\n\tARM_INS_VQSHRUN,\n\tARM_INS_VQSUB,\n\tARM_INS_VRADDHN,\n\tARM_INS_VRECPE,\n\tARM_INS_VRECPS,\n\tARM_INS_VREV16,\n\tARM_INS_VREV32,\n\tARM_INS_VREV64,\n\tARM_INS_VRHADD,\n\tARM_INS_VRINTA,\n\tARM_INS_VRINTM,\n\tARM_INS_VRINTN,\n\tARM_INS_VRINTP,\n\tARM_INS_VRINTR,\n\tARM_INS_VRINTX,\n\tARM_INS_VRINTZ,\n\tARM_INS_VRSHL,\n\tARM_INS_VRSHRN,\n\tARM_INS_VRSHR,\n\tARM_INS_VRSQRTE,\n\tARM_INS_VRSQRTS,\n\tARM_INS_VRSRA,\n\tARM_INS_VRSUBHN,\n\tARM_INS_VSELEQ,\n\tARM_INS_VSELGE,\n\tARM_INS_VSELGT,\n\tARM_INS_VSELVS,\n\tARM_INS_VSHLL,\n\tARM_INS_VSHL,\n\tARM_INS_VSHRN,\n\tARM_INS_VSHR,\n\tARM_INS_VSLI,\n\tARM_INS_VSQRT,\n\tARM_INS_VSRA,\n\tARM_INS_VSRI,\n\tARM_INS_VST1,\n\tARM_INS_VST2,\n\tARM_INS_VST3,\n\tARM_INS_VST4,\n\tARM_INS_VSTMDB,\n\tARM_INS_VSTMIA,\n\tARM_INS_VSTR,\n\tARM_INS_VSUB,\n\tARM_INS_VSUBHN,\n\tARM_INS_VSUBL,\n\tARM_INS_VSUBW,\n\tARM_INS_VSWP,\n\tARM_INS_VTBL,\n\tARM_INS_VTBX,\n\tARM_INS_VCVTR,\n\tARM_INS_VTRN,\n\tARM_INS_VTST,\n\tARM_INS_VUZP,\n\tARM_INS_VZIP,\n\tARM_INS_ADDW,\n\tARM_INS_ASR,\n\tARM_INS_DCPS1,\n\tARM_INS_DCPS2,\n\tARM_INS_DCPS3,\n\tARM_INS_IT,\n\tARM_INS_LSL,\n\tARM_INS_LSR,\n\tARM_INS_ORN,\n\tARM_INS_ROR,\n\tARM_INS_RRX,\n\tARM_INS_SUBW,\n\tARM_INS_TBB,\n\tARM_INS_TBH,\n\tARM_INS_CBNZ,\n\tARM_INS_CBZ,\n\tARM_INS_POP,\n\tARM_INS_PUSH,\n\n\t// special instructions\n\tARM_INS_NOP,\n\tARM_INS_YIELD,\n\tARM_INS_WFE,\n\tARM_INS_WFI,\n\tARM_INS_SEV,\n\tARM_INS_SEVL,\n\tARM_INS_VPUSH,\n\tARM_INS_VPOP,\n\n\tARM_INS_ENDING,\t// <-- mark the end of the list of instructions\n} arm_insn;\n\n/// Group of ARM instructions\ntypedef enum arm_insn_group {\n\tARM_GRP_INVALID = 0, ///< = CS_GRP_INVALID\n\n\t// Generic groups\n\t// all jump instructions (conditional+direct+indirect jumps)\n\tARM_GRP_JUMP,\t///< = CS_GRP_JUMP\n\tARM_GRP_CALL,\t///< = CS_GRP_CALL\n\tARM_GRP_INT = 4, ///< = CS_GRP_INT\n\tARM_GRP_PRIVILEGE = 6, ///< = CS_GRP_PRIVILEGE\n\tARM_GRP_BRANCH_RELATIVE, ///< = CS_GRP_BRANCH_RELATIVE\n\n\t// Architecture-specific groups\n\tARM_GRP_CRYPTO = 128,\n\tARM_GRP_DATABARRIER,\n\tARM_GRP_DIVIDE,\n\tARM_GRP_FPARMV8,\n\tARM_GRP_MULTPRO,\n\tARM_GRP_NEON,\n\tARM_GRP_T2EXTRACTPACK,\n\tARM_GRP_THUMB2DSP,\n\tARM_GRP_TRUSTZONE,\n\tARM_GRP_V4T,\n\tARM_GRP_V5T,\n\tARM_GRP_V5TE,\n\tARM_GRP_V6,\n\tARM_GRP_V6T2,\n\tARM_GRP_V7,\n\tARM_GRP_V8,\n\tARM_GRP_VFP2,\n\tARM_GRP_VFP3,\n\tARM_GRP_VFP4,\n\tARM_GRP_ARM,\n\tARM_GRP_MCLASS,\n\tARM_GRP_NOTMCLASS,\n\tARM_GRP_THUMB,\n\tARM_GRP_THUMB1ONLY,\n\tARM_GRP_THUMB2,\n\tARM_GRP_PREV8,\n\tARM_GRP_FPVMLX,\n\tARM_GRP_MULOPS,\n\tARM_GRP_CRC,\n\tARM_GRP_DPVFP,\n\tARM_GRP_V6M,\n\tARM_GRP_VIRTUALIZATION,\n\n\tARM_GRP_ENDING,\n} arm_insn_group;\n\n#ifdef __cplusplus\n}\n#endif\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/capstone/arm64.h",
    "content": "#ifndef CAPSTONE_ARM64_H\n#define CAPSTONE_ARM64_H\n\n/* Capstone Disassembly Engine */\n/* By Nguyen Anh Quynh <aquynh@gmail.com>, 2013-2015 */\n\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\n#include \"platform.h\"\n\n#ifdef _MSC_VER\n#pragma warning(disable:4201)\n#endif\n\n/// ARM64 shift type\ntypedef enum arm64_shifter {\n\tARM64_SFT_INVALID = 0,\n\tARM64_SFT_LSL = 1,\n\tARM64_SFT_MSL = 2,\n\tARM64_SFT_LSR = 3,\n\tARM64_SFT_ASR = 4,\n\tARM64_SFT_ROR = 5,\n} arm64_shifter;\n\n/// ARM64 extender type\ntypedef enum arm64_extender {\n\tARM64_EXT_INVALID = 0,\n\tARM64_EXT_UXTB = 1,\n\tARM64_EXT_UXTH = 2,\n\tARM64_EXT_UXTW = 3,\n\tARM64_EXT_UXTX = 4,\n\tARM64_EXT_SXTB = 5,\n\tARM64_EXT_SXTH = 6,\n\tARM64_EXT_SXTW = 7,\n\tARM64_EXT_SXTX = 8,\n} arm64_extender;\n\n/// ARM64 condition code\ntypedef enum arm64_cc {\n\tARM64_CC_INVALID = 0,\n\tARM64_CC_EQ = 1,     ///< Equal\n\tARM64_CC_NE = 2,     ///< Not equal:                 Not equal, or unordered\n\tARM64_CC_HS = 3,     ///< Unsigned higher or same:   >, ==, or unordered\n\tARM64_CC_LO = 4,     ///< Unsigned lower or same:    Less than\n\tARM64_CC_MI = 5,     ///< Minus, negative:           Less than\n\tARM64_CC_PL = 6,     ///< Plus, positive or zero:    >, ==, or unordered\n\tARM64_CC_VS = 7,     ///< Overflow:                  Unordered\n\tARM64_CC_VC = 8,     ///< No overflow:               Ordered\n\tARM64_CC_HI = 9,     ///< Unsigned higher:           Greater than, or unordered\n\tARM64_CC_LS = 10,     ///< Unsigned lower or same:    Less than or equal\n\tARM64_CC_GE = 11,     ///< Greater than or equal:     Greater than or equal\n\tARM64_CC_LT = 12,     ///< Less than:                 Less than, or unordered\n\tARM64_CC_GT = 13,     ///< Signed greater than:       Greater than\n\tARM64_CC_LE = 14,     ///< Signed less than or equal: <, ==, or unordered\n\tARM64_CC_AL = 15,     ///< Always (unconditional):    Always (unconditional)\n\tARM64_CC_NV = 16,     ///< Always (unconditional):   Always (unconditional)\n\t//< Note the NV exists purely to disassemble 0b1111. Execution\n\t//< is \"always\".\n} arm64_cc;\n\n/// System registers\ntypedef enum arm64_sysreg {\n\t// System registers for MRS\n\tARM64_SYSREG_INVALID           = 0,\n\tARM64_SYSREG_MDCCSR_EL0        = 0x9808, // 10  011  0000  0001  000\n\tARM64_SYSREG_DBGDTRRX_EL0      = 0x9828, // 10  011  0000  0101  000\n\tARM64_SYSREG_MDRAR_EL1         = 0x8080, // 10  000  0001  0000  000\n\tARM64_SYSREG_OSLSR_EL1         = 0x808c, // 10  000  0001  0001  100\n\tARM64_SYSREG_DBGAUTHSTATUS_EL1 = 0x83f6, // 10  000  0111  1110  110\n\tARM64_SYSREG_PMCEID0_EL0       = 0xdce6, // 11  011  1001  1100  110\n\tARM64_SYSREG_PMCEID1_EL0       = 0xdce7, // 11  011  1001  1100  111\n\tARM64_SYSREG_MIDR_EL1          = 0xc000, // 11  000  0000  0000  000\n\tARM64_SYSREG_CCSIDR_EL1        = 0xc800, // 11  001  0000  0000  000\n\tARM64_SYSREG_CLIDR_EL1         = 0xc801, // 11  001  0000  0000  001\n\tARM64_SYSREG_CTR_EL0           = 0xd801, // 11  011  0000  0000  001\n\tARM64_SYSREG_MPIDR_EL1         = 0xc005, // 11  000  0000  0000  101\n\tARM64_SYSREG_REVIDR_EL1        = 0xc006, // 11  000  0000  0000  110\n\tARM64_SYSREG_AIDR_EL1          = 0xc807, // 11  001  0000  0000  111\n\tARM64_SYSREG_DCZID_EL0         = 0xd807, // 11  011  0000  0000  111\n\tARM64_SYSREG_ID_PFR0_EL1       = 0xc008, // 11  000  0000  0001  000\n\tARM64_SYSREG_ID_PFR1_EL1       = 0xc009, // 11  000  0000  0001  001\n\tARM64_SYSREG_ID_DFR0_EL1       = 0xc00a, // 11  000  0000  0001  010\n\tARM64_SYSREG_ID_AFR0_EL1       = 0xc00b, // 11  000  0000  0001  011\n\tARM64_SYSREG_ID_MMFR0_EL1      = 0xc00c, // 11  000  0000  0001  100\n\tARM64_SYSREG_ID_MMFR1_EL1      = 0xc00d, // 11  000  0000  0001  101\n\tARM64_SYSREG_ID_MMFR2_EL1      = 0xc00e, // 11  000  0000  0001  110\n\tARM64_SYSREG_ID_MMFR3_EL1      = 0xc00f, // 11  000  0000  0001  111\n\tARM64_SYSREG_ID_ISAR0_EL1      = 0xc010, // 11  000  0000  0010  000\n\tARM64_SYSREG_ID_ISAR1_EL1      = 0xc011, // 11  000  0000  0010  001\n\tARM64_SYSREG_ID_ISAR2_EL1      = 0xc012, // 11  000  0000  0010  010\n\tARM64_SYSREG_ID_ISAR3_EL1      = 0xc013, // 11  000  0000  0010  011\n\tARM64_SYSREG_ID_ISAR4_EL1      = 0xc014, // 11  000  0000  0010  100\n\tARM64_SYSREG_ID_ISAR5_EL1      = 0xc015, // 11  000  0000  0010  101\n\tARM64_SYSREG_ID_A64PFR0_EL1   = 0xc020, // 11  000  0000  0100  000\n\tARM64_SYSREG_ID_A64PFR1_EL1   = 0xc021, // 11  000  0000  0100  001\n\tARM64_SYSREG_ID_A64DFR0_EL1   = 0xc028, // 11  000  0000  0101  000\n\tARM64_SYSREG_ID_A64DFR1_EL1   = 0xc029, // 11  000  0000  0101  001\n\tARM64_SYSREG_ID_A64AFR0_EL1   = 0xc02c, // 11  000  0000  0101  100\n\tARM64_SYSREG_ID_A64AFR1_EL1   = 0xc02d, // 11  000  0000  0101  101\n\tARM64_SYSREG_ID_A64ISAR0_EL1  = 0xc030, // 11  000  0000  0110  000\n\tARM64_SYSREG_ID_A64ISAR1_EL1  = 0xc031, // 11  000  0000  0110  001\n\tARM64_SYSREG_ID_A64MMFR0_EL1  = 0xc038, // 11  000  0000  0111  000\n\tARM64_SYSREG_ID_A64MMFR1_EL1  = 0xc039, // 11  000  0000  0111  001\n\tARM64_SYSREG_MVFR0_EL1         = 0xc018, // 11  000  0000  0011  000\n\tARM64_SYSREG_MVFR1_EL1         = 0xc019, // 11  000  0000  0011  001\n\tARM64_SYSREG_MVFR2_EL1         = 0xc01a, // 11  000  0000  0011  010\n\tARM64_SYSREG_RVBAR_EL1         = 0xc601, // 11  000  1100  0000  001\n\tARM64_SYSREG_RVBAR_EL2         = 0xe601, // 11  100  1100  0000  001\n\tARM64_SYSREG_RVBAR_EL3         = 0xf601, // 11  110  1100  0000  001\n\tARM64_SYSREG_ISR_EL1           = 0xc608, // 11  000  1100  0001  000\n\tARM64_SYSREG_CNTPCT_EL0        = 0xdf01, // 11  011  1110  0000  001\n\tARM64_SYSREG_CNTVCT_EL0        = 0xdf02,  // 11  011  1110  0000  010\n\n\t// Trace registers\n\tARM64_SYSREG_TRCSTATR          = 0x8818, // 10  001  0000  0011  000\n\tARM64_SYSREG_TRCIDR8           = 0x8806, // 10  001  0000  0000  110\n\tARM64_SYSREG_TRCIDR9           = 0x880e, // 10  001  0000  0001  110\n\tARM64_SYSREG_TRCIDR10          = 0x8816, // 10  001  0000  0010  110\n\tARM64_SYSREG_TRCIDR11          = 0x881e, // 10  001  0000  0011  110\n\tARM64_SYSREG_TRCIDR12          = 0x8826, // 10  001  0000  0100  110\n\tARM64_SYSREG_TRCIDR13          = 0x882e, // 10  001  0000  0101  110\n\tARM64_SYSREG_TRCIDR0           = 0x8847, // 10  001  0000  1000  111\n\tARM64_SYSREG_TRCIDR1           = 0x884f, // 10  001  0000  1001  111\n\tARM64_SYSREG_TRCIDR2           = 0x8857, // 10  001  0000  1010  111\n\tARM64_SYSREG_TRCIDR3           = 0x885f, // 10  001  0000  1011  111\n\tARM64_SYSREG_TRCIDR4           = 0x8867, // 10  001  0000  1100  111\n\tARM64_SYSREG_TRCIDR5           = 0x886f, // 10  001  0000  1101  111\n\tARM64_SYSREG_TRCIDR6           = 0x8877, // 10  001  0000  1110  111\n\tARM64_SYSREG_TRCIDR7           = 0x887f, // 10  001  0000  1111  111\n\tARM64_SYSREG_TRCOSLSR          = 0x888c, // 10  001  0001  0001  100\n\tARM64_SYSREG_TRCPDSR           = 0x88ac, // 10  001  0001  0101  100\n\tARM64_SYSREG_TRCDEVAFF0        = 0x8bd6, // 10  001  0111  1010  110\n\tARM64_SYSREG_TRCDEVAFF1        = 0x8bde, // 10  001  0111  1011  110\n\tARM64_SYSREG_TRCLSR            = 0x8bee, // 10  001  0111  1101  110\n\tARM64_SYSREG_TRCAUTHSTATUS     = 0x8bf6, // 10  001  0111  1110  110\n\tARM64_SYSREG_TRCDEVARCH        = 0x8bfe, // 10  001  0111  1111  110\n\tARM64_SYSREG_TRCDEVID          = 0x8b97, // 10  001  0111  0010  111\n\tARM64_SYSREG_TRCDEVTYPE        = 0x8b9f, // 10  001  0111  0011  111\n\tARM64_SYSREG_TRCPIDR4          = 0x8ba7, // 10  001  0111  0100  111\n\tARM64_SYSREG_TRCPIDR5          = 0x8baf, // 10  001  0111  0101  111\n\tARM64_SYSREG_TRCPIDR6          = 0x8bb7, // 10  001  0111  0110  111\n\tARM64_SYSREG_TRCPIDR7          = 0x8bbf, // 10  001  0111  0111  111\n\tARM64_SYSREG_TRCPIDR0          = 0x8bc7, // 10  001  0111  1000  111\n\tARM64_SYSREG_TRCPIDR1          = 0x8bcf, // 10  001  0111  1001  111\n\tARM64_SYSREG_TRCPIDR2          = 0x8bd7, // 10  001  0111  1010  111\n\tARM64_SYSREG_TRCPIDR3          = 0x8bdf, // 10  001  0111  1011  111\n\tARM64_SYSREG_TRCCIDR0          = 0x8be7, // 10  001  0111  1100  111\n\tARM64_SYSREG_TRCCIDR1          = 0x8bef, // 10  001  0111  1101  111\n\tARM64_SYSREG_TRCCIDR2          = 0x8bf7, // 10  001  0111  1110  111\n\tARM64_SYSREG_TRCCIDR3          = 0x8bff, // 10  001  0111  1111  111\n\n\t// GICv3 registers\n\tARM64_SYSREG_ICC_IAR1_EL1      = 0xc660, // 11  000  1100  1100  000\n\tARM64_SYSREG_ICC_IAR0_EL1      = 0xc640, // 11  000  1100  1000  000\n\tARM64_SYSREG_ICC_HPPIR1_EL1    = 0xc662, // 11  000  1100  1100  010\n\tARM64_SYSREG_ICC_HPPIR0_EL1    = 0xc642, // 11  000  1100  1000  010\n\tARM64_SYSREG_ICC_RPR_EL1       = 0xc65b, // 11  000  1100  1011  011\n\tARM64_SYSREG_ICH_VTR_EL2       = 0xe659, // 11  100  1100  1011  001\n\tARM64_SYSREG_ICH_EISR_EL2      = 0xe65b, // 11  100  1100  1011  011\n\tARM64_SYSREG_ICH_ELSR_EL2      = 0xe65d, // 11  100  1100  1011  101\n} arm64_sysreg;\n\ntypedef enum arm64_msr_reg {\n\t// System registers for MSR\n\tARM64_SYSREG_DBGDTRTX_EL0      = 0x9828, // 10  011  0000  0101  000\n\tARM64_SYSREG_OSLAR_EL1         = 0x8084, // 10  000  0001  0000  100\n\tARM64_SYSREG_PMSWINC_EL0       = 0xdce4,  // 11  011  1001  1100  100\n\n\t// Trace Registers\n\tARM64_SYSREG_TRCOSLAR          = 0x8884, // 10  001  0001  0000  100\n\tARM64_SYSREG_TRCLAR            = 0x8be6, // 10  001  0111  1100  110\n\n\t// GICv3 registers\n\tARM64_SYSREG_ICC_EOIR1_EL1     = 0xc661, // 11  000  1100  1100  001\n\tARM64_SYSREG_ICC_EOIR0_EL1     = 0xc641, // 11  000  1100  1000  001\n\tARM64_SYSREG_ICC_DIR_EL1       = 0xc659, // 11  000  1100  1011  001\n\tARM64_SYSREG_ICC_SGI1R_EL1     = 0xc65d, // 11  000  1100  1011  101\n\tARM64_SYSREG_ICC_ASGI1R_EL1    = 0xc65e, // 11  000  1100  1011  110\n\tARM64_SYSREG_ICC_SGI0R_EL1     = 0xc65f, // 11  000  1100  1011  111\n} arm64_msr_reg;\n\n/// System PState Field (MSR instruction)\ntypedef enum arm64_pstate {\n\tARM64_PSTATE_INVALID = 0,\n\tARM64_PSTATE_SPSEL = 0x05,\n\tARM64_PSTATE_DAIFSET = 0x1e,\n\tARM64_PSTATE_DAIFCLR = 0x1f\n} arm64_pstate;\n\n/// Vector arrangement specifier (for FloatingPoint/Advanced SIMD insn)\ntypedef enum arm64_vas {\n\tARM64_VAS_INVALID = 0,\n\tARM64_VAS_8B,\n\tARM64_VAS_16B,\n\tARM64_VAS_4H,\n\tARM64_VAS_8H,\n\tARM64_VAS_2S,\n\tARM64_VAS_4S,\n\tARM64_VAS_1D,\n\tARM64_VAS_2D,\n\tARM64_VAS_1Q,\n} arm64_vas;\n\n/// Vector element size specifier\ntypedef enum arm64_vess {\n\tARM64_VESS_INVALID = 0,\n\tARM64_VESS_B,\n\tARM64_VESS_H,\n\tARM64_VESS_S,\n\tARM64_VESS_D,\n} arm64_vess;\n\n/// Memory barrier operands\ntypedef enum arm64_barrier_op {\n\tARM64_BARRIER_INVALID = 0,\n\tARM64_BARRIER_OSHLD = 0x1,\n\tARM64_BARRIER_OSHST = 0x2,\n\tARM64_BARRIER_OSH =   0x3,\n\tARM64_BARRIER_NSHLD = 0x5,\n\tARM64_BARRIER_NSHST = 0x6,\n\tARM64_BARRIER_NSH =   0x7,\n\tARM64_BARRIER_ISHLD = 0x9,\n\tARM64_BARRIER_ISHST = 0xa,\n\tARM64_BARRIER_ISH =   0xb,\n\tARM64_BARRIER_LD =    0xd,\n\tARM64_BARRIER_ST =    0xe,\n\tARM64_BARRIER_SY =    0xf\n} arm64_barrier_op;\n\n/// Operand type for instruction's operands\ntypedef enum arm64_op_type {\n\tARM64_OP_INVALID = 0, ///< = CS_OP_INVALID (Uninitialized).\n\tARM64_OP_REG, ///< = CS_OP_REG (Register operand).\n\tARM64_OP_IMM, ///< = CS_OP_IMM (Immediate operand).\n\tARM64_OP_MEM, ///< = CS_OP_MEM (Memory operand).\n\tARM64_OP_FP,  ///< = CS_OP_FP (Floating-Point operand).\n\tARM64_OP_CIMM = 64, ///< C-Immediate\n\tARM64_OP_REG_MRS, ///< MRS register operand.\n\tARM64_OP_REG_MSR, ///< MSR register operand.\n\tARM64_OP_PSTATE, ///< PState operand.\n\tARM64_OP_SYS, ///< SYS operand for IC/DC/AT/TLBI instructions.\n\tARM64_OP_PREFETCH, ///< Prefetch operand (PRFM).\n\tARM64_OP_BARRIER, ///< Memory barrier operand (ISB/DMB/DSB instructions).\n} arm64_op_type;\n\n/// TLBI operations\ntypedef enum arm64_tlbi_op {\n\tARM64_TLBI_INVALID = 0,\n\tARM64_TLBI_VMALLE1IS,\n\tARM64_TLBI_VAE1IS,\n\tARM64_TLBI_ASIDE1IS,\n\tARM64_TLBI_VAAE1IS,\n\tARM64_TLBI_VALE1IS,\n\tARM64_TLBI_VAALE1IS,\n\tARM64_TLBI_ALLE2IS,\n\tARM64_TLBI_VAE2IS,\n\tARM64_TLBI_ALLE1IS,\n\tARM64_TLBI_VALE2IS,\n\tARM64_TLBI_VMALLS12E1IS,\n\tARM64_TLBI_ALLE3IS,\n\tARM64_TLBI_VAE3IS,\n\tARM64_TLBI_VALE3IS,\n\tARM64_TLBI_IPAS2E1IS,\n\tARM64_TLBI_IPAS2LE1IS,\n\tARM64_TLBI_IPAS2E1,\n\tARM64_TLBI_IPAS2LE1,\n\tARM64_TLBI_VMALLE1,\n\tARM64_TLBI_VAE1,\n\tARM64_TLBI_ASIDE1,\n\tARM64_TLBI_VAAE1,\n\tARM64_TLBI_VALE1,\n\tARM64_TLBI_VAALE1,\n\tARM64_TLBI_ALLE2,\n\tARM64_TLBI_VAE2,\n\tARM64_TLBI_ALLE1,\n\tARM64_TLBI_VALE2,\n\tARM64_TLBI_VMALLS12E1,\n\tARM64_TLBI_ALLE3,\n\tARM64_TLBI_VAE3,\n\tARM64_TLBI_VALE3,\n} arm64_tlbi_op;\n\n/// AT operations\ntypedef enum arm64_at_op {\n\tARM64_AT_S1E1R,\n\tARM64_AT_S1E1W,\n\tARM64_AT_S1E0R,\n\tARM64_AT_S1E0W,\n\tARM64_AT_S1E2R,\n\tARM64_AT_S1E2W,\n\tARM64_AT_S12E1R,\n\tARM64_AT_S12E1W,\n\tARM64_AT_S12E0R,\n\tARM64_AT_S12E0W,\n\tARM64_AT_S1E3R,\n\tARM64_AT_S1E3W,\n} arm64_at_op;\n\n/// DC operations\ntypedef enum arm64_dc_op {\n\tARM64_DC_INVALID = 0,\n\tARM64_DC_ZVA,\n\tARM64_DC_IVAC,\n\tARM64_DC_ISW,\n\tARM64_DC_CVAC,\n\tARM64_DC_CSW,\n\tARM64_DC_CVAU,\n\tARM64_DC_CIVAC,\n\tARM64_DC_CISW,\n} arm64_dc_op;\n\n/// IC operations\ntypedef enum arm64_ic_op {\n\tARM64_IC_INVALID = 0,\n\tARM64_IC_IALLUIS,\n\tARM64_IC_IALLU,\n\tARM64_IC_IVAU,\n} arm64_ic_op;\n\n/// Prefetch operations (PRFM)\ntypedef enum arm64_prefetch_op {\n\tARM64_PRFM_INVALID = 0,\n\tARM64_PRFM_PLDL1KEEP = 0x00 + 1,\n\tARM64_PRFM_PLDL1STRM = 0x01 + 1,\n\tARM64_PRFM_PLDL2KEEP = 0x02 + 1,\n\tARM64_PRFM_PLDL2STRM = 0x03 + 1,\n\tARM64_PRFM_PLDL3KEEP = 0x04 + 1,\n\tARM64_PRFM_PLDL3STRM = 0x05 + 1,\n\tARM64_PRFM_PLIL1KEEP = 0x08 + 1,\n\tARM64_PRFM_PLIL1STRM = 0x09 + 1,\n\tARM64_PRFM_PLIL2KEEP = 0x0a + 1,\n\tARM64_PRFM_PLIL2STRM = 0x0b + 1,\n\tARM64_PRFM_PLIL3KEEP = 0x0c + 1,\n\tARM64_PRFM_PLIL3STRM = 0x0d + 1,\n\tARM64_PRFM_PSTL1KEEP = 0x10 + 1,\n\tARM64_PRFM_PSTL1STRM = 0x11 + 1,\n\tARM64_PRFM_PSTL2KEEP = 0x12 + 1,\n\tARM64_PRFM_PSTL2STRM = 0x13 + 1,\n\tARM64_PRFM_PSTL3KEEP = 0x14 + 1,\n\tARM64_PRFM_PSTL3STRM = 0x15 + 1,\n} arm64_prefetch_op;\n\n\n/// ARM64 registers\ntypedef enum arm64_reg {\n\tARM64_REG_INVALID = 0,\n\n\tARM64_REG_X29,\n\tARM64_REG_X30,\n\tARM64_REG_NZCV,\n\tARM64_REG_SP,\n\tARM64_REG_WSP,\n\tARM64_REG_WZR,\n\tARM64_REG_XZR,\n\tARM64_REG_B0,\n\tARM64_REG_B1,\n\tARM64_REG_B2,\n\tARM64_REG_B3,\n\tARM64_REG_B4,\n\tARM64_REG_B5,\n\tARM64_REG_B6,\n\tARM64_REG_B7,\n\tARM64_REG_B8,\n\tARM64_REG_B9,\n\tARM64_REG_B10,\n\tARM64_REG_B11,\n\tARM64_REG_B12,\n\tARM64_REG_B13,\n\tARM64_REG_B14,\n\tARM64_REG_B15,\n\tARM64_REG_B16,\n\tARM64_REG_B17,\n\tARM64_REG_B18,\n\tARM64_REG_B19,\n\tARM64_REG_B20,\n\tARM64_REG_B21,\n\tARM64_REG_B22,\n\tARM64_REG_B23,\n\tARM64_REG_B24,\n\tARM64_REG_B25,\n\tARM64_REG_B26,\n\tARM64_REG_B27,\n\tARM64_REG_B28,\n\tARM64_REG_B29,\n\tARM64_REG_B30,\n\tARM64_REG_B31,\n\tARM64_REG_D0,\n\tARM64_REG_D1,\n\tARM64_REG_D2,\n\tARM64_REG_D3,\n\tARM64_REG_D4,\n\tARM64_REG_D5,\n\tARM64_REG_D6,\n\tARM64_REG_D7,\n\tARM64_REG_D8,\n\tARM64_REG_D9,\n\tARM64_REG_D10,\n\tARM64_REG_D11,\n\tARM64_REG_D12,\n\tARM64_REG_D13,\n\tARM64_REG_D14,\n\tARM64_REG_D15,\n\tARM64_REG_D16,\n\tARM64_REG_D17,\n\tARM64_REG_D18,\n\tARM64_REG_D19,\n\tARM64_REG_D20,\n\tARM64_REG_D21,\n\tARM64_REG_D22,\n\tARM64_REG_D23,\n\tARM64_REG_D24,\n\tARM64_REG_D25,\n\tARM64_REG_D26,\n\tARM64_REG_D27,\n\tARM64_REG_D28,\n\tARM64_REG_D29,\n\tARM64_REG_D30,\n\tARM64_REG_D31,\n\tARM64_REG_H0,\n\tARM64_REG_H1,\n\tARM64_REG_H2,\n\tARM64_REG_H3,\n\tARM64_REG_H4,\n\tARM64_REG_H5,\n\tARM64_REG_H6,\n\tARM64_REG_H7,\n\tARM64_REG_H8,\n\tARM64_REG_H9,\n\tARM64_REG_H10,\n\tARM64_REG_H11,\n\tARM64_REG_H12,\n\tARM64_REG_H13,\n\tARM64_REG_H14,\n\tARM64_REG_H15,\n\tARM64_REG_H16,\n\tARM64_REG_H17,\n\tARM64_REG_H18,\n\tARM64_REG_H19,\n\tARM64_REG_H20,\n\tARM64_REG_H21,\n\tARM64_REG_H22,\n\tARM64_REG_H23,\n\tARM64_REG_H24,\n\tARM64_REG_H25,\n\tARM64_REG_H26,\n\tARM64_REG_H27,\n\tARM64_REG_H28,\n\tARM64_REG_H29,\n\tARM64_REG_H30,\n\tARM64_REG_H31,\n\tARM64_REG_Q0,\n\tARM64_REG_Q1,\n\tARM64_REG_Q2,\n\tARM64_REG_Q3,\n\tARM64_REG_Q4,\n\tARM64_REG_Q5,\n\tARM64_REG_Q6,\n\tARM64_REG_Q7,\n\tARM64_REG_Q8,\n\tARM64_REG_Q9,\n\tARM64_REG_Q10,\n\tARM64_REG_Q11,\n\tARM64_REG_Q12,\n\tARM64_REG_Q13,\n\tARM64_REG_Q14,\n\tARM64_REG_Q15,\n\tARM64_REG_Q16,\n\tARM64_REG_Q17,\n\tARM64_REG_Q18,\n\tARM64_REG_Q19,\n\tARM64_REG_Q20,\n\tARM64_REG_Q21,\n\tARM64_REG_Q22,\n\tARM64_REG_Q23,\n\tARM64_REG_Q24,\n\tARM64_REG_Q25,\n\tARM64_REG_Q26,\n\tARM64_REG_Q27,\n\tARM64_REG_Q28,\n\tARM64_REG_Q29,\n\tARM64_REG_Q30,\n\tARM64_REG_Q31,\n\tARM64_REG_S0,\n\tARM64_REG_S1,\n\tARM64_REG_S2,\n\tARM64_REG_S3,\n\tARM64_REG_S4,\n\tARM64_REG_S5,\n\tARM64_REG_S6,\n\tARM64_REG_S7,\n\tARM64_REG_S8,\n\tARM64_REG_S9,\n\tARM64_REG_S10,\n\tARM64_REG_S11,\n\tARM64_REG_S12,\n\tARM64_REG_S13,\n\tARM64_REG_S14,\n\tARM64_REG_S15,\n\tARM64_REG_S16,\n\tARM64_REG_S17,\n\tARM64_REG_S18,\n\tARM64_REG_S19,\n\tARM64_REG_S20,\n\tARM64_REG_S21,\n\tARM64_REG_S22,\n\tARM64_REG_S23,\n\tARM64_REG_S24,\n\tARM64_REG_S25,\n\tARM64_REG_S26,\n\tARM64_REG_S27,\n\tARM64_REG_S28,\n\tARM64_REG_S29,\n\tARM64_REG_S30,\n\tARM64_REG_S31,\n\tARM64_REG_W0,\n\tARM64_REG_W1,\n\tARM64_REG_W2,\n\tARM64_REG_W3,\n\tARM64_REG_W4,\n\tARM64_REG_W5,\n\tARM64_REG_W6,\n\tARM64_REG_W7,\n\tARM64_REG_W8,\n\tARM64_REG_W9,\n\tARM64_REG_W10,\n\tARM64_REG_W11,\n\tARM64_REG_W12,\n\tARM64_REG_W13,\n\tARM64_REG_W14,\n\tARM64_REG_W15,\n\tARM64_REG_W16,\n\tARM64_REG_W17,\n\tARM64_REG_W18,\n\tARM64_REG_W19,\n\tARM64_REG_W20,\n\tARM64_REG_W21,\n\tARM64_REG_W22,\n\tARM64_REG_W23,\n\tARM64_REG_W24,\n\tARM64_REG_W25,\n\tARM64_REG_W26,\n\tARM64_REG_W27,\n\tARM64_REG_W28,\n\tARM64_REG_W29,\n\tARM64_REG_W30,\n\tARM64_REG_X0,\n\tARM64_REG_X1,\n\tARM64_REG_X2,\n\tARM64_REG_X3,\n\tARM64_REG_X4,\n\tARM64_REG_X5,\n\tARM64_REG_X6,\n\tARM64_REG_X7,\n\tARM64_REG_X8,\n\tARM64_REG_X9,\n\tARM64_REG_X10,\n\tARM64_REG_X11,\n\tARM64_REG_X12,\n\tARM64_REG_X13,\n\tARM64_REG_X14,\n\tARM64_REG_X15,\n\tARM64_REG_X16,\n\tARM64_REG_X17,\n\tARM64_REG_X18,\n\tARM64_REG_X19,\n\tARM64_REG_X20,\n\tARM64_REG_X21,\n\tARM64_REG_X22,\n\tARM64_REG_X23,\n\tARM64_REG_X24,\n\tARM64_REG_X25,\n\tARM64_REG_X26,\n\tARM64_REG_X27,\n\tARM64_REG_X28,\n\n\tARM64_REG_V0,\n\tARM64_REG_V1,\n\tARM64_REG_V2,\n\tARM64_REG_V3,\n\tARM64_REG_V4,\n\tARM64_REG_V5,\n\tARM64_REG_V6,\n\tARM64_REG_V7,\n\tARM64_REG_V8,\n\tARM64_REG_V9,\n\tARM64_REG_V10,\n\tARM64_REG_V11,\n\tARM64_REG_V12,\n\tARM64_REG_V13,\n\tARM64_REG_V14,\n\tARM64_REG_V15,\n\tARM64_REG_V16,\n\tARM64_REG_V17,\n\tARM64_REG_V18,\n\tARM64_REG_V19,\n\tARM64_REG_V20,\n\tARM64_REG_V21,\n\tARM64_REG_V22,\n\tARM64_REG_V23,\n\tARM64_REG_V24,\n\tARM64_REG_V25,\n\tARM64_REG_V26,\n\tARM64_REG_V27,\n\tARM64_REG_V28,\n\tARM64_REG_V29,\n\tARM64_REG_V30,\n\tARM64_REG_V31,\n\n\tARM64_REG_ENDING,\t\t// <-- mark the end of the list of registers\n\n\t// alias registers\n\n\tARM64_REG_IP0 = ARM64_REG_X16,\n\tARM64_REG_IP1 = ARM64_REG_X17,\n\tARM64_REG_FP = ARM64_REG_X29,\n\tARM64_REG_LR = ARM64_REG_X30,\n} arm64_reg;\n\n/// Instruction's operand referring to memory\n/// This is associated with ARM64_OP_MEM operand type above\ntypedef struct arm64_op_mem {\n\tarm64_reg base;\t///< base register\n\tarm64_reg index;\t///< index register\n\tint32_t disp;\t///< displacement/offset value\n} arm64_op_mem;\n\n/// Instruction operand\ntypedef struct cs_arm64_op {\n\tint vector_index;\t///< Vector Index for some vector operands (or -1 if irrelevant)\n\tarm64_vas vas;\t\t///< Vector Arrangement Specifier\n\tarm64_vess vess;\t///< Vector Element Size Specifier\n\tstruct {\n\t\tarm64_shifter type;\t///< shifter type of this operand\n\t\tunsigned int value;\t///< shifter value of this operand\n\t} shift;\n\tarm64_extender ext;\t\t///< extender type of this operand\n\tarm64_op_type type;\t///< operand type\n\tunion {\n\t\tarm64_reg reg;\t///< register value for REG operand\n\t\tint64_t imm;\t\t///< immediate value, or index for C-IMM or IMM operand\n\t\tdouble fp;\t\t\t///< floating point value for FP operand\n\t\tarm64_op_mem mem;\t\t///< base/index/scale/disp value for MEM operand\n\t\tarm64_pstate pstate;\t\t///< PState field of MSR instruction.\n\t\tunsigned int sys;  ///< IC/DC/AT/TLBI operation (see arm64_ic_op, arm64_dc_op, arm64_at_op, arm64_tlbi_op)\n\t\tarm64_prefetch_op prefetch;  ///< PRFM operation.\n\t\tarm64_barrier_op barrier;  ///< Memory barrier operation (ISB/DMB/DSB instructions).\n\t};\n\n\t/// How is this operand accessed? (READ, WRITE or READ|WRITE)\n\t/// This field is combined of cs_ac_type.\n\t/// NOTE: this field is irrelevant if engine is compiled in DIET mode.\n\tuint8_t access;\n} cs_arm64_op;\n\n/// Instruction structure\ntypedef struct cs_arm64 {\n\tarm64_cc cc;\t///< conditional code for this insn\n\tbool update_flags;\t///< does this insn update flags?\n\tbool writeback;\t///< does this insn request writeback? 'True' means 'yes'\n\n\t/// Number of operands of this instruction,\n\t/// or 0 when instruction has no operand.\n\tuint8_t op_count;\n\n\tcs_arm64_op operands[8]; ///< operands for this instruction.\n} cs_arm64;\n\n/// ARM64 instruction\ntypedef enum arm64_insn {\n\tARM64_INS_INVALID = 0,\n\n\tARM64_INS_ABS,\n\tARM64_INS_ADC,\n\tARM64_INS_ADDHN,\n\tARM64_INS_ADDHN2,\n\tARM64_INS_ADDP,\n\tARM64_INS_ADD,\n\tARM64_INS_ADDV,\n\tARM64_INS_ADR,\n\tARM64_INS_ADRP,\n\tARM64_INS_AESD,\n\tARM64_INS_AESE,\n\tARM64_INS_AESIMC,\n\tARM64_INS_AESMC,\n\tARM64_INS_AND,\n\tARM64_INS_ASR,\n\tARM64_INS_B,\n\tARM64_INS_BFM,\n\tARM64_INS_BIC,\n\tARM64_INS_BIF,\n\tARM64_INS_BIT,\n\tARM64_INS_BL,\n\tARM64_INS_BLR,\n\tARM64_INS_BR,\n\tARM64_INS_BRK,\n\tARM64_INS_BSL,\n\tARM64_INS_CBNZ,\n\tARM64_INS_CBZ,\n\tARM64_INS_CCMN,\n\tARM64_INS_CCMP,\n\tARM64_INS_CLREX,\n\tARM64_INS_CLS,\n\tARM64_INS_CLZ,\n\tARM64_INS_CMEQ,\n\tARM64_INS_CMGE,\n\tARM64_INS_CMGT,\n\tARM64_INS_CMHI,\n\tARM64_INS_CMHS,\n\tARM64_INS_CMLE,\n\tARM64_INS_CMLT,\n\tARM64_INS_CMTST,\n\tARM64_INS_CNT,\n\tARM64_INS_MOV,\n\tARM64_INS_CRC32B,\n\tARM64_INS_CRC32CB,\n\tARM64_INS_CRC32CH,\n\tARM64_INS_CRC32CW,\n\tARM64_INS_CRC32CX,\n\tARM64_INS_CRC32H,\n\tARM64_INS_CRC32W,\n\tARM64_INS_CRC32X,\n\tARM64_INS_CSEL,\n\tARM64_INS_CSINC,\n\tARM64_INS_CSINV,\n\tARM64_INS_CSNEG,\n\tARM64_INS_DCPS1,\n\tARM64_INS_DCPS2,\n\tARM64_INS_DCPS3,\n\tARM64_INS_DMB,\n\tARM64_INS_DRPS,\n\tARM64_INS_DSB,\n\tARM64_INS_DUP,\n\tARM64_INS_EON,\n\tARM64_INS_EOR,\n\tARM64_INS_ERET,\n\tARM64_INS_EXTR,\n\tARM64_INS_EXT,\n\tARM64_INS_FABD,\n\tARM64_INS_FABS,\n\tARM64_INS_FACGE,\n\tARM64_INS_FACGT,\n\tARM64_INS_FADD,\n\tARM64_INS_FADDP,\n\tARM64_INS_FCCMP,\n\tARM64_INS_FCCMPE,\n\tARM64_INS_FCMEQ,\n\tARM64_INS_FCMGE,\n\tARM64_INS_FCMGT,\n\tARM64_INS_FCMLE,\n\tARM64_INS_FCMLT,\n\tARM64_INS_FCMP,\n\tARM64_INS_FCMPE,\n\tARM64_INS_FCSEL,\n\tARM64_INS_FCVTAS,\n\tARM64_INS_FCVTAU,\n\tARM64_INS_FCVT,\n\tARM64_INS_FCVTL,\n\tARM64_INS_FCVTL2,\n\tARM64_INS_FCVTMS,\n\tARM64_INS_FCVTMU,\n\tARM64_INS_FCVTNS,\n\tARM64_INS_FCVTNU,\n\tARM64_INS_FCVTN,\n\tARM64_INS_FCVTN2,\n\tARM64_INS_FCVTPS,\n\tARM64_INS_FCVTPU,\n\tARM64_INS_FCVTXN,\n\tARM64_INS_FCVTXN2,\n\tARM64_INS_FCVTZS,\n\tARM64_INS_FCVTZU,\n\tARM64_INS_FDIV,\n\tARM64_INS_FMADD,\n\tARM64_INS_FMAX,\n\tARM64_INS_FMAXNM,\n\tARM64_INS_FMAXNMP,\n\tARM64_INS_FMAXNMV,\n\tARM64_INS_FMAXP,\n\tARM64_INS_FMAXV,\n\tARM64_INS_FMIN,\n\tARM64_INS_FMINNM,\n\tARM64_INS_FMINNMP,\n\tARM64_INS_FMINNMV,\n\tARM64_INS_FMINP,\n\tARM64_INS_FMINV,\n\tARM64_INS_FMLA,\n\tARM64_INS_FMLS,\n\tARM64_INS_FMOV,\n\tARM64_INS_FMSUB,\n\tARM64_INS_FMUL,\n\tARM64_INS_FMULX,\n\tARM64_INS_FNEG,\n\tARM64_INS_FNMADD,\n\tARM64_INS_FNMSUB,\n\tARM64_INS_FNMUL,\n\tARM64_INS_FRECPE,\n\tARM64_INS_FRECPS,\n\tARM64_INS_FRECPX,\n\tARM64_INS_FRINTA,\n\tARM64_INS_FRINTI,\n\tARM64_INS_FRINTM,\n\tARM64_INS_FRINTN,\n\tARM64_INS_FRINTP,\n\tARM64_INS_FRINTX,\n\tARM64_INS_FRINTZ,\n\tARM64_INS_FRSQRTE,\n\tARM64_INS_FRSQRTS,\n\tARM64_INS_FSQRT,\n\tARM64_INS_FSUB,\n\tARM64_INS_HINT,\n\tARM64_INS_HLT,\n\tARM64_INS_HVC,\n\tARM64_INS_INS,\n\n\tARM64_INS_ISB,\n\tARM64_INS_LD1,\n\tARM64_INS_LD1R,\n\tARM64_INS_LD2R,\n\tARM64_INS_LD2,\n\tARM64_INS_LD3R,\n\tARM64_INS_LD3,\n\tARM64_INS_LD4,\n\tARM64_INS_LD4R,\n\n\tARM64_INS_LDARB,\n\tARM64_INS_LDARH,\n\tARM64_INS_LDAR,\n\tARM64_INS_LDAXP,\n\tARM64_INS_LDAXRB,\n\tARM64_INS_LDAXRH,\n\tARM64_INS_LDAXR,\n\tARM64_INS_LDNP,\n\tARM64_INS_LDP,\n\tARM64_INS_LDPSW,\n\tARM64_INS_LDRB,\n\tARM64_INS_LDR,\n\tARM64_INS_LDRH,\n\tARM64_INS_LDRSB,\n\tARM64_INS_LDRSH,\n\tARM64_INS_LDRSW,\n\tARM64_INS_LDTRB,\n\tARM64_INS_LDTRH,\n\tARM64_INS_LDTRSB,\n\n\tARM64_INS_LDTRSH,\n\tARM64_INS_LDTRSW,\n\tARM64_INS_LDTR,\n\tARM64_INS_LDURB,\n\tARM64_INS_LDUR,\n\tARM64_INS_LDURH,\n\tARM64_INS_LDURSB,\n\tARM64_INS_LDURSH,\n\tARM64_INS_LDURSW,\n\tARM64_INS_LDXP,\n\tARM64_INS_LDXRB,\n\tARM64_INS_LDXRH,\n\tARM64_INS_LDXR,\n\tARM64_INS_LSL,\n\tARM64_INS_LSR,\n\tARM64_INS_MADD,\n\tARM64_INS_MLA,\n\tARM64_INS_MLS,\n\tARM64_INS_MOVI,\n\tARM64_INS_MOVK,\n\tARM64_INS_MOVN,\n\tARM64_INS_MOVZ,\n\tARM64_INS_MRS,\n\tARM64_INS_MSR,\n\tARM64_INS_MSUB,\n\tARM64_INS_MUL,\n\tARM64_INS_MVNI,\n\tARM64_INS_NEG,\n\tARM64_INS_NOT,\n\tARM64_INS_ORN,\n\tARM64_INS_ORR,\n\tARM64_INS_PMULL2,\n\tARM64_INS_PMULL,\n\tARM64_INS_PMUL,\n\tARM64_INS_PRFM,\n\tARM64_INS_PRFUM,\n\tARM64_INS_RADDHN,\n\tARM64_INS_RADDHN2,\n\tARM64_INS_RBIT,\n\tARM64_INS_RET,\n\tARM64_INS_REV16,\n\tARM64_INS_REV32,\n\tARM64_INS_REV64,\n\tARM64_INS_REV,\n\tARM64_INS_ROR,\n\tARM64_INS_RSHRN2,\n\tARM64_INS_RSHRN,\n\tARM64_INS_RSUBHN,\n\tARM64_INS_RSUBHN2,\n\tARM64_INS_SABAL2,\n\tARM64_INS_SABAL,\n\n\tARM64_INS_SABA,\n\tARM64_INS_SABDL2,\n\tARM64_INS_SABDL,\n\tARM64_INS_SABD,\n\tARM64_INS_SADALP,\n\tARM64_INS_SADDLP,\n\tARM64_INS_SADDLV,\n\tARM64_INS_SADDL2,\n\tARM64_INS_SADDL,\n\tARM64_INS_SADDW2,\n\tARM64_INS_SADDW,\n\tARM64_INS_SBC,\n\tARM64_INS_SBFM,\n\tARM64_INS_SCVTF,\n\tARM64_INS_SDIV,\n\tARM64_INS_SHA1C,\n\tARM64_INS_SHA1H,\n\tARM64_INS_SHA1M,\n\tARM64_INS_SHA1P,\n\tARM64_INS_SHA1SU0,\n\tARM64_INS_SHA1SU1,\n\tARM64_INS_SHA256H2,\n\tARM64_INS_SHA256H,\n\tARM64_INS_SHA256SU0,\n\tARM64_INS_SHA256SU1,\n\tARM64_INS_SHADD,\n\tARM64_INS_SHLL2,\n\tARM64_INS_SHLL,\n\tARM64_INS_SHL,\n\tARM64_INS_SHRN2,\n\tARM64_INS_SHRN,\n\tARM64_INS_SHSUB,\n\tARM64_INS_SLI,\n\tARM64_INS_SMADDL,\n\tARM64_INS_SMAXP,\n\tARM64_INS_SMAXV,\n\tARM64_INS_SMAX,\n\tARM64_INS_SMC,\n\tARM64_INS_SMINP,\n\tARM64_INS_SMINV,\n\tARM64_INS_SMIN,\n\tARM64_INS_SMLAL2,\n\tARM64_INS_SMLAL,\n\tARM64_INS_SMLSL2,\n\tARM64_INS_SMLSL,\n\tARM64_INS_SMOV,\n\tARM64_INS_SMSUBL,\n\tARM64_INS_SMULH,\n\tARM64_INS_SMULL2,\n\tARM64_INS_SMULL,\n\tARM64_INS_SQABS,\n\tARM64_INS_SQADD,\n\tARM64_INS_SQDMLAL,\n\tARM64_INS_SQDMLAL2,\n\tARM64_INS_SQDMLSL,\n\tARM64_INS_SQDMLSL2,\n\tARM64_INS_SQDMULH,\n\tARM64_INS_SQDMULL,\n\tARM64_INS_SQDMULL2,\n\tARM64_INS_SQNEG,\n\tARM64_INS_SQRDMULH,\n\tARM64_INS_SQRSHL,\n\tARM64_INS_SQRSHRN,\n\tARM64_INS_SQRSHRN2,\n\tARM64_INS_SQRSHRUN,\n\tARM64_INS_SQRSHRUN2,\n\tARM64_INS_SQSHLU,\n\tARM64_INS_SQSHL,\n\tARM64_INS_SQSHRN,\n\tARM64_INS_SQSHRN2,\n\tARM64_INS_SQSHRUN,\n\tARM64_INS_SQSHRUN2,\n\tARM64_INS_SQSUB,\n\tARM64_INS_SQXTN2,\n\tARM64_INS_SQXTN,\n\tARM64_INS_SQXTUN2,\n\tARM64_INS_SQXTUN,\n\tARM64_INS_SRHADD,\n\tARM64_INS_SRI,\n\tARM64_INS_SRSHL,\n\tARM64_INS_SRSHR,\n\tARM64_INS_SRSRA,\n\tARM64_INS_SSHLL2,\n\tARM64_INS_SSHLL,\n\tARM64_INS_SSHL,\n\tARM64_INS_SSHR,\n\tARM64_INS_SSRA,\n\tARM64_INS_SSUBL2,\n\tARM64_INS_SSUBL,\n\tARM64_INS_SSUBW2,\n\tARM64_INS_SSUBW,\n\tARM64_INS_ST1,\n\tARM64_INS_ST2,\n\tARM64_INS_ST3,\n\tARM64_INS_ST4,\n\tARM64_INS_STLRB,\n\tARM64_INS_STLRH,\n\tARM64_INS_STLR,\n\tARM64_INS_STLXP,\n\tARM64_INS_STLXRB,\n\tARM64_INS_STLXRH,\n\tARM64_INS_STLXR,\n\tARM64_INS_STNP,\n\tARM64_INS_STP,\n\tARM64_INS_STRB,\n\tARM64_INS_STR,\n\tARM64_INS_STRH,\n\tARM64_INS_STTRB,\n\tARM64_INS_STTRH,\n\tARM64_INS_STTR,\n\tARM64_INS_STURB,\n\tARM64_INS_STUR,\n\tARM64_INS_STURH,\n\tARM64_INS_STXP,\n\tARM64_INS_STXRB,\n\tARM64_INS_STXRH,\n\tARM64_INS_STXR,\n\tARM64_INS_SUBHN,\n\tARM64_INS_SUBHN2,\n\tARM64_INS_SUB,\n\tARM64_INS_SUQADD,\n\tARM64_INS_SVC,\n\tARM64_INS_SYSL,\n\tARM64_INS_SYS,\n\tARM64_INS_TBL,\n\tARM64_INS_TBNZ,\n\tARM64_INS_TBX,\n\tARM64_INS_TBZ,\n\tARM64_INS_TRN1,\n\tARM64_INS_TRN2,\n\tARM64_INS_UABAL2,\n\tARM64_INS_UABAL,\n\tARM64_INS_UABA,\n\tARM64_INS_UABDL2,\n\tARM64_INS_UABDL,\n\tARM64_INS_UABD,\n\tARM64_INS_UADALP,\n\tARM64_INS_UADDLP,\n\tARM64_INS_UADDLV,\n\tARM64_INS_UADDL2,\n\tARM64_INS_UADDL,\n\tARM64_INS_UADDW2,\n\tARM64_INS_UADDW,\n\tARM64_INS_UBFM,\n\tARM64_INS_UCVTF,\n\tARM64_INS_UDIV,\n\tARM64_INS_UHADD,\n\tARM64_INS_UHSUB,\n\tARM64_INS_UMADDL,\n\tARM64_INS_UMAXP,\n\tARM64_INS_UMAXV,\n\tARM64_INS_UMAX,\n\tARM64_INS_UMINP,\n\tARM64_INS_UMINV,\n\tARM64_INS_UMIN,\n\tARM64_INS_UMLAL2,\n\tARM64_INS_UMLAL,\n\tARM64_INS_UMLSL2,\n\tARM64_INS_UMLSL,\n\tARM64_INS_UMOV,\n\tARM64_INS_UMSUBL,\n\tARM64_INS_UMULH,\n\tARM64_INS_UMULL2,\n\tARM64_INS_UMULL,\n\tARM64_INS_UQADD,\n\tARM64_INS_UQRSHL,\n\tARM64_INS_UQRSHRN,\n\tARM64_INS_UQRSHRN2,\n\tARM64_INS_UQSHL,\n\tARM64_INS_UQSHRN,\n\tARM64_INS_UQSHRN2,\n\tARM64_INS_UQSUB,\n\tARM64_INS_UQXTN2,\n\tARM64_INS_UQXTN,\n\tARM64_INS_URECPE,\n\tARM64_INS_URHADD,\n\tARM64_INS_URSHL,\n\tARM64_INS_URSHR,\n\tARM64_INS_URSQRTE,\n\tARM64_INS_URSRA,\n\tARM64_INS_USHLL2,\n\tARM64_INS_USHLL,\n\tARM64_INS_USHL,\n\tARM64_INS_USHR,\n\tARM64_INS_USQADD,\n\tARM64_INS_USRA,\n\tARM64_INS_USUBL2,\n\tARM64_INS_USUBL,\n\tARM64_INS_USUBW2,\n\tARM64_INS_USUBW,\n\tARM64_INS_UZP1,\n\tARM64_INS_UZP2,\n\tARM64_INS_XTN2,\n\tARM64_INS_XTN,\n\tARM64_INS_ZIP1,\n\tARM64_INS_ZIP2,\n\n\t// alias insn\n\tARM64_INS_MNEG,\n\tARM64_INS_UMNEGL,\n\tARM64_INS_SMNEGL,\n\tARM64_INS_NOP,\n\tARM64_INS_YIELD,\n\tARM64_INS_WFE,\n\tARM64_INS_WFI,\n\tARM64_INS_SEV,\n\tARM64_INS_SEVL,\n\tARM64_INS_NGC,\n\tARM64_INS_SBFIZ,\n\tARM64_INS_UBFIZ,\n\tARM64_INS_SBFX,\n\tARM64_INS_UBFX,\n\tARM64_INS_BFI,\n\tARM64_INS_BFXIL,\n\tARM64_INS_CMN,\n\tARM64_INS_MVN,\n\tARM64_INS_TST,\n\tARM64_INS_CSET,\n\tARM64_INS_CINC,\n\tARM64_INS_CSETM,\n\tARM64_INS_CINV,\n\tARM64_INS_CNEG,\n\tARM64_INS_SXTB,\n\tARM64_INS_SXTH,\n\tARM64_INS_SXTW,\n\tARM64_INS_CMP,\n\tARM64_INS_UXTB,\n\tARM64_INS_UXTH,\n\tARM64_INS_UXTW,\n\tARM64_INS_IC,\n\tARM64_INS_DC,\n\tARM64_INS_AT,\n\tARM64_INS_TLBI,\n\n\tARM64_INS_NEGS,\n\tARM64_INS_NGCS,\n\n\tARM64_INS_ENDING,  // <-- mark the end of the list of insn\n} arm64_insn;\n\n/// Group of ARM64 instructions\ntypedef enum arm64_insn_group {\n\tARM64_GRP_INVALID = 0, ///< = CS_GRP_INVALID\n\n\t// Generic groups\n\t// all jump instructions (conditional+direct+indirect jumps)\n\tARM64_GRP_JUMP,\t///< = CS_GRP_JUMP\n\tARM64_GRP_CALL,\n\tARM64_GRP_RET,\n\tARM64_GRP_INT,\n\tARM64_GRP_PRIVILEGE = 6, ///< = CS_GRP_PRIVILEGE\n\tARM64_GRP_BRANCH_RELATIVE, ///< = CS_GRP_BRANCH_RELATIVE\n\n\t// Architecture-specific groups\n\tARM64_GRP_CRYPTO = 128,\n\tARM64_GRP_FPARMV8,\n\tARM64_GRP_NEON,\n\tARM64_GRP_CRC,\n\n\tARM64_GRP_ENDING,  // <-- mark the end of the list of groups\n} arm64_insn_group;\n\n#ifdef __cplusplus\n}\n#endif\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/capstone/capstone.h",
    "content": "#ifndef CAPSTONE_ENGINE_H\n#define CAPSTONE_ENGINE_H\n\n/* Capstone Disassembly Engine */\n/* By Nguyen Anh Quynh <aquynh@gmail.com>, 2013-2016 */\n\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\n#include <stdarg.h>\n\n#if defined(CAPSTONE_HAS_OSXKERNEL)\n#include <libkern/libkern.h>\n#else\n#include <stdlib.h>\n#include <stdio.h>\n#endif\n\n#include \"platform.h\"\n\n#ifdef _MSC_VER\n#pragma warning(disable:4201)\n#pragma warning(disable:4100)\n#define CAPSTONE_API __cdecl\n#ifdef CAPSTONE_SHARED\n#define CAPSTONE_EXPORT __declspec(dllexport)\n#else    // defined(CAPSTONE_STATIC)\n#define CAPSTONE_EXPORT\n#endif\n#else\n#define CAPSTONE_API\n#if defined(__GNUC__) && !defined(CAPSTONE_STATIC)\n#define CAPSTONE_EXPORT __attribute__((visibility(\"default\")))\n#else    // defined(CAPSTONE_STATIC)\n#define CAPSTONE_EXPORT\n#endif\n#endif\n\n#ifdef __GNUC__\n#define CAPSTONE_DEPRECATED __attribute__((deprecated))\n#elif defined(_MSC_VER)\n#define CAPSTONE_DEPRECATED __declspec(deprecated)\n#else\n#pragma message(\"WARNING: You need to implement CAPSTONE_DEPRECATED for this compiler\")\n#define CAPSTONE_DEPRECATED\n#endif\n\n// Capstone API version\n#define CS_API_MAJOR 4\n#define CS_API_MINOR 0\n\n// Version for bleeding edge code of the Github's \"next\" branch.\n// Use this if you want the absolutely latest development code.\n// This version number will be bumped up whenever we have a new major change.\n#define CS_NEXT_VERSION 5\n\n// Capstone package version\n#define CS_VERSION_MAJOR CS_API_MAJOR\n#define CS_VERSION_MINOR CS_API_MINOR\n#define CS_VERSION_EXTRA 2\n\n/// Macro to create combined version which can be compared to\n/// result of cs_version() API.\n#define CS_MAKE_VERSION(major, minor) ((major << 8) + minor)\n\n/// Maximum size of an instruction mnemonic string.\n#define CS_MNEMONIC_SIZE 32\n\n// Handle using with all API\ntypedef size_t csh;\n\n/// Architecture type\ntypedef enum cs_arch {\n\tCS_ARCH_ARM = 0,\t///< ARM architecture (including Thumb, Thumb-2)\n\tCS_ARCH_ARM64,\t\t///< ARM-64, also called AArch64\n\tCS_ARCH_MIPS,\t\t///< Mips architecture\n\tCS_ARCH_X86,\t\t///< X86 architecture (including x86 & x86-64)\n\tCS_ARCH_PPC,\t\t///< PowerPC architecture\n\tCS_ARCH_SPARC,\t\t///< Sparc architecture\n\tCS_ARCH_SYSZ,\t\t///< SystemZ architecture\n\tCS_ARCH_XCORE,\t\t///< XCore architecture\n\tCS_ARCH_M68K,\t\t///< 68K architecture\n\tCS_ARCH_TMS320C64X,\t///< TMS320C64x architecture\n\tCS_ARCH_M680X,\t\t///< 680X architecture\n\tCS_ARCH_EVM,\t\t///< Ethereum architecture\n\tCS_ARCH_MAX,\n\tCS_ARCH_ALL = 0xFFFF, // All architectures - for cs_support()\n} cs_arch;\n\n// Support value to verify diet mode of the engine.\n// If cs_support(CS_SUPPORT_DIET) return True, the engine was compiled\n// in diet mode.\n#define CS_SUPPORT_DIET (CS_ARCH_ALL + 1)\n\n// Support value to verify X86 reduce mode of the engine.\n// If cs_support(CS_SUPPORT_X86_REDUCE) return True, the engine was compiled\n// in X86 reduce mode.\n#define CS_SUPPORT_X86_REDUCE (CS_ARCH_ALL + 2)\n\n/// Mode type\ntypedef enum cs_mode {\n\tCS_MODE_LITTLE_ENDIAN = 0,\t///< little-endian mode (default mode)\n\tCS_MODE_ARM = 0,\t///< 32-bit ARM\n\tCS_MODE_16 = 1 << 1,\t///< 16-bit mode (X86)\n\tCS_MODE_32 = 1 << 2,\t///< 32-bit mode (X86)\n\tCS_MODE_64 = 1 << 3,\t///< 64-bit mode (X86, PPC)\n\tCS_MODE_THUMB = 1 << 4,\t///< ARM's Thumb mode, including Thumb-2\n\tCS_MODE_MCLASS = 1 << 5,\t///< ARM's Cortex-M series\n\tCS_MODE_V8 = 1 << 6,\t///< ARMv8 A32 encodings for ARM\n\tCS_MODE_MICRO = 1 << 4, ///< MicroMips mode (MIPS)\n\tCS_MODE_MIPS3 = 1 << 5, ///< Mips III ISA\n\tCS_MODE_MIPS32R6 = 1 << 6, ///< Mips32r6 ISA\n\tCS_MODE_MIPS2 = 1 << 7, ///< Mips II ISA\n\tCS_MODE_V9 = 1 << 4, ///< SparcV9 mode (Sparc)\n\tCS_MODE_QPX = 1 << 4, ///< Quad Processing eXtensions mode (PPC)\n\tCS_MODE_M68K_000 = 1 << 1, ///< M68K 68000 mode\n\tCS_MODE_M68K_010 = 1 << 2, ///< M68K 68010 mode\n\tCS_MODE_M68K_020 = 1 << 3, ///< M68K 68020 mode\n\tCS_MODE_M68K_030 = 1 << 4, ///< M68K 68030 mode\n\tCS_MODE_M68K_040 = 1 << 5, ///< M68K 68040 mode\n\tCS_MODE_M68K_060 = 1 << 6, ///< M68K 68060 mode\n\tCS_MODE_BIG_ENDIAN = 1 << 31,\t///< big-endian mode\n\tCS_MODE_MIPS32 = CS_MODE_32,\t///< Mips32 ISA (Mips)\n\tCS_MODE_MIPS64 = CS_MODE_64,\t///< Mips64 ISA (Mips)\n\tCS_MODE_M680X_6301 = 1 << 1, ///< M680X Hitachi 6301,6303 mode\n\tCS_MODE_M680X_6309 = 1 << 2, ///< M680X Hitachi 6309 mode\n\tCS_MODE_M680X_6800 = 1 << 3, ///< M680X Motorola 6800,6802 mode\n\tCS_MODE_M680X_6801 = 1 << 4, ///< M680X Motorola 6801,6803 mode\n\tCS_MODE_M680X_6805 = 1 << 5, ///< M680X Motorola/Freescale 6805 mode\n\tCS_MODE_M680X_6808 = 1 << 6, ///< M680X Motorola/Freescale/NXP 68HC08 mode\n\tCS_MODE_M680X_6809 = 1 << 7, ///< M680X Motorola 6809 mode\n\tCS_MODE_M680X_6811 = 1 << 8, ///< M680X Motorola/Freescale/NXP 68HC11 mode\n\tCS_MODE_M680X_CPU12 = 1 << 9, ///< M680X Motorola/Freescale/NXP CPU12\n\t\t\t\t\t///< used on M68HC12/HCS12\n\tCS_MODE_M680X_HCS08 = 1 << 10, ///< M680X Freescale/NXP HCS08 mode\n} cs_mode;\n\ntypedef void* (CAPSTONE_API *cs_malloc_t)(size_t size);\ntypedef void* (CAPSTONE_API *cs_calloc_t)(size_t nmemb, size_t size);\ntypedef void* (CAPSTONE_API *cs_realloc_t)(void *ptr, size_t size);\ntypedef void (CAPSTONE_API *cs_free_t)(void *ptr);\ntypedef int (CAPSTONE_API *cs_vsnprintf_t)(char *str, size_t size, const char *format, va_list ap);\n\n\n/// User-defined dynamic memory related functions: malloc/calloc/realloc/free/vsnprintf()\n/// By default, Capstone uses system's malloc(), calloc(), realloc(), free() & vsnprintf().\ntypedef struct cs_opt_mem {\n\tcs_malloc_t malloc;\n\tcs_calloc_t calloc;\n\tcs_realloc_t realloc;\n\tcs_free_t free;\n\tcs_vsnprintf_t vsnprintf;\n} cs_opt_mem;\n\n/// Customize mnemonic for instructions with alternative name.\n/// To reset existing customized instruction to its default mnemonic,\n/// call cs_option(CS_OPT_MNEMONIC) again with the same @id and NULL value\n/// for @mnemonic.\ntypedef struct cs_opt_mnem {\n\t/// ID of instruction to be customized.\n\tunsigned int id;\n\t/// Customized instruction mnemonic.\n\tconst char *mnemonic;\n} cs_opt_mnem;\n\n/// Runtime option for the disassembled engine\ntypedef enum cs_opt_type {\n\tCS_OPT_INVALID = 0,\t///< No option specified\n\tCS_OPT_SYNTAX,\t///< Assembly output syntax\n\tCS_OPT_DETAIL,\t///< Break down instruction structure into details\n\tCS_OPT_MODE,\t///< Change engine's mode at run-time\n\tCS_OPT_MEM,\t///< User-defined dynamic memory related functions\n\tCS_OPT_SKIPDATA, ///< Skip data when disassembling. Then engine is in SKIPDATA mode.\n\tCS_OPT_SKIPDATA_SETUP, ///< Setup user-defined function for SKIPDATA option\n\tCS_OPT_MNEMONIC, ///< Customize instruction mnemonic\n\tCS_OPT_UNSIGNED, ///< print immediate operands in unsigned form\n} cs_opt_type;\n\n/// Runtime option value (associated with option type above)\ntypedef enum cs_opt_value {\n\tCS_OPT_OFF = 0,  ///< Turn OFF an option - default for CS_OPT_DETAIL, CS_OPT_SKIPDATA, CS_OPT_UNSIGNED.\n\tCS_OPT_ON = 3, ///< Turn ON an option (CS_OPT_DETAIL, CS_OPT_SKIPDATA).\n\tCS_OPT_SYNTAX_DEFAULT = 0, ///< Default asm syntax (CS_OPT_SYNTAX).\n\tCS_OPT_SYNTAX_INTEL, ///< X86 Intel asm syntax - default on X86 (CS_OPT_SYNTAX).\n\tCS_OPT_SYNTAX_ATT,   ///< X86 ATT asm syntax (CS_OPT_SYNTAX).\n\tCS_OPT_SYNTAX_NOREGNAME, ///< Prints register name with only number (CS_OPT_SYNTAX)\n\tCS_OPT_SYNTAX_MASM, ///< X86 Intel Masm syntax (CS_OPT_SYNTAX).\n} cs_opt_value;\n\n/// Common instruction operand types - to be consistent across all architectures.\ntypedef enum cs_op_type {\n\tCS_OP_INVALID = 0,  ///< uninitialized/invalid operand.\n\tCS_OP_REG,          ///< Register operand.\n\tCS_OP_IMM,          ///< Immediate operand.\n\tCS_OP_MEM,          ///< Memory operand.\n\tCS_OP_FP,           ///< Floating-Point operand.\n} cs_op_type;\n\n/// Common instruction operand access types - to be consistent across all architectures.\n/// It is possible to combine access types, for example: CS_AC_READ | CS_AC_WRITE\ntypedef enum cs_ac_type {\n\tCS_AC_INVALID = 0,        ///< Uninitialized/invalid access type.\n\tCS_AC_READ    = 1 << 0,   ///< Operand read from memory or register.\n\tCS_AC_WRITE   = 1 << 1,   ///< Operand write to memory or register.\n} cs_ac_type;\n\n/// Common instruction groups - to be consistent across all architectures.\ntypedef enum cs_group_type {\n\tCS_GRP_INVALID = 0,  ///< uninitialized/invalid group.\n\tCS_GRP_JUMP,    ///< all jump instructions (conditional+direct+indirect jumps)\n\tCS_GRP_CALL,    ///< all call instructions\n\tCS_GRP_RET,     ///< all return instructions\n\tCS_GRP_INT,     ///< all interrupt instructions (int+syscall)\n\tCS_GRP_IRET,    ///< all interrupt return instructions\n\tCS_GRP_PRIVILEGE,    ///< all privileged instructions\n\tCS_GRP_BRANCH_RELATIVE, ///< all relative branching instructions\n} cs_group_type;\n\n/**\n User-defined callback function for SKIPDATA option.\n See tests/test_skipdata.c for sample code demonstrating this API.\n\n @code: the input buffer containing code to be disassembled.\n        This is the same buffer passed to cs_disasm().\n @code_size: size (in bytes) of the above @code buffer.\n @offset: the position of the currently-examining byte in the input\n      buffer @code mentioned above.\n @user_data: user-data passed to cs_option() via @user_data field in\n      cs_opt_skipdata struct below.\n\n @return: return number of bytes to skip, or 0 to immediately stop disassembling.\n*/\ntypedef size_t (CAPSTONE_API *cs_skipdata_cb_t)(const uint8_t *code, size_t code_size, size_t offset, void *user_data);\n\n/// User-customized setup for SKIPDATA option\ntypedef struct cs_opt_skipdata {\n\t/// Capstone considers data to skip as special \"instructions\".\n\t/// User can specify the string for this instruction's \"mnemonic\" here.\n\t/// By default (if @mnemonic is NULL), Capstone use \".byte\".\n\tconst char *mnemonic;\n\n\t/// User-defined callback function to be called when Capstone hits data.\n\t/// If the returned value from this callback is positive (>0), Capstone\n\t/// will skip exactly that number of bytes & continue. Otherwise, if\n\t/// the callback returns 0, Capstone stops disassembling and returns\n\t/// immediately from cs_disasm()\n\t/// NOTE: if this callback pointer is NULL, Capstone would skip a number\n\t/// of bytes depending on architectures, as following:\n\t/// Arm:     2 bytes (Thumb mode) or 4 bytes.\n\t/// Arm64:   4 bytes.\n\t/// Mips:    4 bytes.\n\t/// M680x:   1 byte.\n\t/// PowerPC: 4 bytes.\n\t/// Sparc:   4 bytes.\n\t/// SystemZ: 2 bytes.\n\t/// X86:     1 bytes.\n\t/// XCore:   2 bytes.\n\t/// EVM:     1 bytes.\n\tcs_skipdata_cb_t callback; \t// default value is NULL\n\n\t/// User-defined data to be passed to @callback function pointer.\n\tvoid *user_data;\n} cs_opt_skipdata;\n\n\n#include \"arm.h\"\n#include \"arm64.h\"\n#include \"m68k.h\"\n#include \"mips.h\"\n#include \"ppc.h\"\n#include \"sparc.h\"\n#include \"systemz.h\"\n#include \"x86.h\"\n#include \"xcore.h\"\n#include \"tms320c64x.h\"\n#include \"m680x.h\"\n#include \"evm.h\"\n\n/// NOTE: All information in cs_detail is only available when CS_OPT_DETAIL = CS_OPT_ON\n/// Initialized as memset(., 0, offsetof(cs_detail, ARCH)+sizeof(cs_ARCH))\n/// by ARCH_getInstruction in arch/ARCH/ARCHDisassembler.c\n/// if cs_detail changes, in particular if a field is added after the union,\n/// then update arch/ARCH/ARCHDisassembler.c accordingly\ntypedef struct cs_detail {\n\tuint16_t regs_read[12]; ///< list of implicit registers read by this insn\n\tuint8_t regs_read_count; ///< number of implicit registers read by this insn\n\n\tuint16_t regs_write[20]; ///< list of implicit registers modified by this insn\n\tuint8_t regs_write_count; ///< number of implicit registers modified by this insn\n\n\tuint8_t groups[8]; ///< list of group this instruction belong to\n\tuint8_t groups_count; ///< number of groups this insn belongs to\n\n\t/// Architecture-specific instruction info\n\tunion {\n\t\tcs_x86 x86;     ///< X86 architecture, including 16-bit, 32-bit & 64-bit mode\n\t\tcs_arm64 arm64; ///< ARM64 architecture (aka AArch64)\n\t\tcs_arm arm;     ///< ARM architecture (including Thumb/Thumb2)\n\t\tcs_m68k m68k;   ///< M68K architecture\n\t\tcs_mips mips;   ///< MIPS architecture\n\t\tcs_ppc ppc;\t    ///< PowerPC architecture\n\t\tcs_sparc sparc; ///< Sparc architecture\n\t\tcs_sysz sysz;   ///< SystemZ architecture\n\t\tcs_xcore xcore; ///< XCore architecture\n\t\tcs_tms320c64x tms320c64x;  ///< TMS320C64x architecture\n\t\tcs_m680x m680x; ///< M680X architecture\n\t\tcs_evm evm;\t    ///< Ethereum architecture\n\t};\n} cs_detail;\n\n/// Detail information of disassembled instruction\ntypedef struct cs_insn {\n\t/// Instruction ID (basically a numeric ID for the instruction mnemonic)\n\t/// Find the instruction id in the '[ARCH]_insn' enum in the header file\n\t/// of corresponding architecture, such as 'arm_insn' in arm.h for ARM,\n\t/// 'x86_insn' in x86.h for X86, etc...\n\t/// This information is available even when CS_OPT_DETAIL = CS_OPT_OFF\n\t/// NOTE: in Skipdata mode, \"data\" instruction has 0 for this id field.\n\tunsigned int id;\n\n\t/// Address (EIP) of this instruction\n\t/// This information is available even when CS_OPT_DETAIL = CS_OPT_OFF\n\tuint64_t address;\n\n\t/// Size of this instruction\n\t/// This information is available even when CS_OPT_DETAIL = CS_OPT_OFF\n\tuint16_t size;\n\n\t/// Machine bytes of this instruction, with number of bytes indicated by @size above\n\t/// This information is available even when CS_OPT_DETAIL = CS_OPT_OFF\n\tuint8_t bytes[16];\n\n\t/// Ascii text of instruction mnemonic\n\t/// This information is available even when CS_OPT_DETAIL = CS_OPT_OFF\n\tchar mnemonic[CS_MNEMONIC_SIZE];\n\n\t/// Ascii text of instruction operands\n\t/// This information is available even when CS_OPT_DETAIL = CS_OPT_OFF\n\tchar op_str[160];\n\n\t/// Pointer to cs_detail.\n\t/// NOTE: detail pointer is only valid when both requirements below are met:\n\t/// (1) CS_OP_DETAIL = CS_OPT_ON\n\t/// (2) Engine is not in Skipdata mode (CS_OP_SKIPDATA option set to CS_OPT_ON)\n\t///\n\t/// NOTE 2: when in Skipdata mode, or when detail mode is OFF, even if this pointer\n\t///     is not NULL, its content is still irrelevant.\n\tcs_detail *detail;\n} cs_insn;\n\n\n/// Calculate the offset of a disassembled instruction in its buffer, given its position\n/// in its array of disassembled insn\n/// NOTE: this macro works with position (>=1), not index\n#define CS_INSN_OFFSET(insns, post) (insns[post - 1].address - insns[0].address)\n\n\n/// All type of errors encountered by Capstone API.\n/// These are values returned by cs_errno()\ntypedef enum cs_err {\n\tCS_ERR_OK = 0,   ///< No error: everything was fine\n\tCS_ERR_MEM,      ///< Out-Of-Memory error: cs_open(), cs_disasm(), cs_disasm_iter()\n\tCS_ERR_ARCH,     ///< Unsupported architecture: cs_open()\n\tCS_ERR_HANDLE,   ///< Invalid handle: cs_op_count(), cs_op_index()\n\tCS_ERR_CSH,      ///< Invalid csh argument: cs_close(), cs_errno(), cs_option()\n\tCS_ERR_MODE,     ///< Invalid/unsupported mode: cs_open()\n\tCS_ERR_OPTION,   ///< Invalid/unsupported option: cs_option()\n\tCS_ERR_DETAIL,   ///< Information is unavailable because detail option is OFF\n\tCS_ERR_MEMSETUP, ///< Dynamic memory management uninitialized (see CS_OPT_MEM)\n\tCS_ERR_VERSION,  ///< Unsupported version (bindings)\n\tCS_ERR_DIET,     ///< Access irrelevant data in \"diet\" engine\n\tCS_ERR_SKIPDATA, ///< Access irrelevant data for \"data\" instruction in SKIPDATA mode\n\tCS_ERR_X86_ATT,  ///< X86 AT&T syntax is unsupported (opt-out at compile time)\n\tCS_ERR_X86_INTEL, ///< X86 Intel syntax is unsupported (opt-out at compile time)\n\tCS_ERR_X86_MASM, ///< X86 Masm syntax is unsupported (opt-out at compile time)\n} cs_err;\n\n/**\n Return combined API version & major and minor version numbers.\n\n @major: major number of API version\n @minor: minor number of API version\n\n @return hexical number as (major << 8 | minor), which encodes both\n\t major & minor versions.\n\t NOTE: This returned value can be compared with version number made\n\t with macro CS_MAKE_VERSION\n\n For example, second API version would return 1 in @major, and 1 in @minor\n The return value would be 0x0101\n\n NOTE: if you only care about returned value, but not major and minor values,\n set both @major & @minor arguments to NULL.\n*/\nCAPSTONE_EXPORT\nunsigned int CAPSTONE_API cs_version(int *major, int *minor);\n\n\n/**\n This API can be used to either ask for archs supported by this library,\n or check to see if the library was compile with 'diet' option (or called\n in 'diet' mode).\n\n To check if a particular arch is supported by this library, set @query to\n arch mode (CS_ARCH_* value).\n To verify if this library supports all the archs, use CS_ARCH_ALL.\n\n To check if this library is in 'diet' mode, set @query to CS_SUPPORT_DIET.\n\n @return True if this library supports the given arch, or in 'diet' mode.\n*/\nCAPSTONE_EXPORT\nbool CAPSTONE_API cs_support(int query);\n\n/**\n Initialize CS handle: this must be done before any usage of CS.\n\n @arch: architecture type (CS_ARCH_*)\n @mode: hardware mode. This is combined of CS_MODE_*\n @handle: pointer to handle, which will be updated at return time\n\n @return CS_ERR_OK on success, or other value on failure (refer to cs_err enum\n for detailed error).\n*/\nCAPSTONE_EXPORT\ncs_err CAPSTONE_API cs_open(cs_arch arch, cs_mode mode, csh *handle);\n\n/**\n Close CS handle: MUST do to release the handle when it is not used anymore.\n NOTE: this must be only called when there is no longer usage of Capstone,\n not even access to cs_insn array. The reason is the this API releases some\n cached memory, thus access to any Capstone API after cs_close() might crash\n your application.\n\n In fact,this API invalidate @handle by ZERO out its value (i.e *handle = 0).\n\n @handle: pointer to a handle returned by cs_open()\n\n @return CS_ERR_OK on success, or other value on failure (refer to cs_err enum\n for detailed error).\n*/\nCAPSTONE_EXPORT\ncs_err CAPSTONE_API cs_close(csh *handle);\n\n/**\n Set option for disassembling engine at runtime\n\n @handle: handle returned by cs_open()\n @type: type of option to be set\n @value: option value corresponding with @type\n\n @return: CS_ERR_OK on success, or other value on failure.\n Refer to cs_err enum for detailed error.\n\n NOTE: in the case of CS_OPT_MEM, handle's value can be anything,\n so that cs_option(handle, CS_OPT_MEM, value) can (i.e must) be called\n even before cs_open()\n*/\nCAPSTONE_EXPORT\ncs_err CAPSTONE_API cs_option(csh handle, cs_opt_type type, size_t value);\n\n/**\n Report the last error number when some API function fail.\n Like glibc's errno, cs_errno might not retain its old value once accessed.\n\n @handle: handle returned by cs_open()\n\n @return: error code of cs_err enum type (CS_ERR_*, see above)\n*/\nCAPSTONE_EXPORT\ncs_err CAPSTONE_API cs_errno(csh handle);\n\n\n/**\n Return a string describing given error code.\n\n @code: error code (see CS_ERR_* above)\n\n @return: returns a pointer to a string that describes the error code\n\tpassed in the argument @code\n*/\nCAPSTONE_EXPORT\nconst char * CAPSTONE_API cs_strerror(cs_err code);\n\n/**\n Disassemble binary code, given the code buffer, size, address and number\n of instructions to be decoded.\n This API dynamically allocate memory to contain disassembled instruction.\n Resulting instructions will be put into @*insn\n\n NOTE 1: this API will automatically determine memory needed to contain\n output disassembled instructions in @insn.\n\n NOTE 2: caller must free the allocated memory itself to avoid memory leaking.\n\n NOTE 3: for system with scarce memory to be dynamically allocated such as\n OS kernel or firmware, the API cs_disasm_iter() might be a better choice than\n cs_disasm(). The reason is that with cs_disasm(), based on limited available\n memory, we have to calculate in advance how many instructions to be disassembled,\n which complicates things. This is especially troublesome for the case @count=0,\n when cs_disasm() runs uncontrollably (until either end of input buffer, or\n when it encounters an invalid instruction).\n \n @handle: handle returned by cs_open()\n @code: buffer containing raw binary code to be disassembled.\n @code_size: size of the above code buffer.\n @address: address of the first instruction in given raw code buffer.\n @insn: array of instructions filled in by this API.\n\t   NOTE: @insn will be allocated by this function, and should be freed\n\t   with cs_free() API.\n @count: number of instructions to be disassembled, or 0 to get all of them\n\n @return: the number of successfully disassembled instructions,\n or 0 if this function failed to disassemble the given code\n\n On failure, call cs_errno() for error code.\n*/\nCAPSTONE_EXPORT\nsize_t CAPSTONE_API cs_disasm(csh handle,\n\t\tconst uint8_t *code, size_t code_size,\n\t\tuint64_t address,\n\t\tsize_t count,\n\t\tcs_insn **insn);\n\n/**\n  Deprecated function - to be retired in the next version!\n  Use cs_disasm() instead of cs_disasm_ex()\n*/\nCAPSTONE_EXPORT\nCAPSTONE_DEPRECATED\nsize_t CAPSTONE_API cs_disasm_ex(csh handle,\n\t\tconst uint8_t *code, size_t code_size,\n\t\tuint64_t address,\n\t\tsize_t count,\n\t\tcs_insn **insn);\n\n/**\n Free memory allocated by cs_malloc() or cs_disasm() (argument @insn)\n\n @insn: pointer returned by @insn argument in cs_disasm() or cs_malloc()\n @count: number of cs_insn structures returned by cs_disasm(), or 1\n     to free memory allocated by cs_malloc().\n*/\nCAPSTONE_EXPORT\nvoid CAPSTONE_API cs_free(cs_insn *insn, size_t count);\n\n\n/**\n Allocate memory for 1 instruction to be used by cs_disasm_iter().\n\n @handle: handle returned by cs_open()\n\n NOTE: when no longer in use, you can reclaim the memory allocated for\n this instruction with cs_free(insn, 1)\n*/\nCAPSTONE_EXPORT\ncs_insn * CAPSTONE_API cs_malloc(csh handle);\n\n/**\n Fast API to disassemble binary code, given the code buffer, size, address\n and number of instructions to be decoded.\n This API puts the resulting instruction into a given cache in @insn.\n See tests/test_iter.c for sample code demonstrating this API.\n\n NOTE 1: this API will update @code, @size & @address to point to the next\n instruction in the input buffer. Therefore, it is convenient to use\n cs_disasm_iter() inside a loop to quickly iterate all the instructions.\n While decoding one instruction at a time can also be achieved with\n cs_disasm(count=1), some benchmarks shown that cs_disasm_iter() can be 30%\n faster on random input.\n\n NOTE 2: the cache in @insn can be created with cs_malloc() API.\n\n NOTE 3: for system with scarce memory to be dynamically allocated such as\n OS kernel or firmware, this API is recommended over cs_disasm(), which\n allocates memory based on the number of instructions to be disassembled.\n The reason is that with cs_disasm(), based on limited available memory,\n we have to calculate in advance how many instructions to be disassembled,\n which complicates things. This is especially troublesome for the case\n @count=0, when cs_disasm() runs uncontrollably (until either end of input\n buffer, or when it encounters an invalid instruction).\n \n @handle: handle returned by cs_open()\n @code: buffer containing raw binary code to be disassembled\n @size: size of above code\n @address: address of the first insn in given raw code buffer\n @insn: pointer to instruction to be filled in by this API.\n\n @return: true if this API successfully decode 1 instruction,\n or false otherwise.\n\n On failure, call cs_errno() for error code.\n*/\nCAPSTONE_EXPORT\nbool CAPSTONE_API cs_disasm_iter(csh handle,\n\tconst uint8_t **code, size_t *size,\n\tuint64_t *address, cs_insn *insn);\n\n/**\n Return friendly name of register in a string.\n Find the instruction id from header file of corresponding architecture (arm.h for ARM,\n x86.h for X86, ...)\n\n WARN: when in 'diet' mode, this API is irrelevant because engine does not\n store register name.\n\n @handle: handle returned by cs_open()\n @reg_id: register id\n\n @return: string name of the register, or NULL if @reg_id is invalid.\n*/\nCAPSTONE_EXPORT\nconst char * CAPSTONE_API cs_reg_name(csh handle, unsigned int reg_id);\n\n/**\n Return friendly name of an instruction in a string.\n Find the instruction id from header file of corresponding architecture (arm.h for ARM, x86.h for X86, ...)\n\n WARN: when in 'diet' mode, this API is irrelevant because the engine does not\n store instruction name.\n\n @handle: handle returned by cs_open()\n @insn_id: instruction id\n\n @return: string name of the instruction, or NULL if @insn_id is invalid.\n*/\nCAPSTONE_EXPORT\nconst char * CAPSTONE_API cs_insn_name(csh handle, unsigned int insn_id);\n\n/**\n Return friendly name of a group id (that an instruction can belong to)\n Find the group id from header file of corresponding architecture (arm.h for ARM, x86.h for X86, ...)\n\n WARN: when in 'diet' mode, this API is irrelevant because the engine does not\n store group name.\n\n @handle: handle returned by cs_open()\n @group_id: group id\n\n @return: string name of the group, or NULL if @group_id is invalid.\n*/\nCAPSTONE_EXPORT\nconst char * CAPSTONE_API cs_group_name(csh handle, unsigned int group_id);\n\n/**\n Check if a disassembled instruction belong to a particular group.\n Find the group id from header file of corresponding architecture (arm.h for ARM, x86.h for X86, ...)\n Internally, this simply verifies if @group_id matches any member of insn->groups array.\n\n NOTE: this API is only valid when detail option is ON (which is OFF by default).\n\n WARN: when in 'diet' mode, this API is irrelevant because the engine does not\n update @groups array.\n\n @handle: handle returned by cs_open()\n @insn: disassembled instruction structure received from cs_disasm() or cs_disasm_iter()\n @group_id: group that you want to check if this instruction belong to.\n\n @return: true if this instruction indeed belongs to the given group, or false otherwise.\n*/\nCAPSTONE_EXPORT\nbool CAPSTONE_API cs_insn_group(csh handle, const cs_insn *insn, unsigned int group_id);\n\n/**\n Check if a disassembled instruction IMPLICITLY used a particular register.\n Find the register id from header file of corresponding architecture (arm.h for ARM, x86.h for X86, ...)\n Internally, this simply verifies if @reg_id matches any member of insn->regs_read array.\n\n NOTE: this API is only valid when detail option is ON (which is OFF by default)\n\n WARN: when in 'diet' mode, this API is irrelevant because the engine does not\n update @regs_read array.\n\n @insn: disassembled instruction structure received from cs_disasm() or cs_disasm_iter()\n @reg_id: register that you want to check if this instruction used it.\n\n @return: true if this instruction indeed implicitly used the given register, or false otherwise.\n*/\nCAPSTONE_EXPORT\nbool CAPSTONE_API cs_reg_read(csh handle, const cs_insn *insn, unsigned int reg_id);\n\n/**\n Check if a disassembled instruction IMPLICITLY modified a particular register.\n Find the register id from header file of corresponding architecture (arm.h for ARM, x86.h for X86, ...)\n Internally, this simply verifies if @reg_id matches any member of insn->regs_write array.\n\n NOTE: this API is only valid when detail option is ON (which is OFF by default)\n\n WARN: when in 'diet' mode, this API is irrelevant because the engine does not\n update @regs_write array.\n\n @insn: disassembled instruction structure received from cs_disasm() or cs_disasm_iter()\n @reg_id: register that you want to check if this instruction modified it.\n\n @return: true if this instruction indeed implicitly modified the given register, or false otherwise.\n*/\nCAPSTONE_EXPORT\nbool CAPSTONE_API cs_reg_write(csh handle, const cs_insn *insn, unsigned int reg_id);\n\n/**\n Count the number of operands of a given type.\n Find the operand type in header file of corresponding architecture (arm.h for ARM, x86.h for X86, ...)\n\n NOTE: this API is only valid when detail option is ON (which is OFF by default)\n\n @handle: handle returned by cs_open()\n @insn: disassembled instruction structure received from cs_disasm() or cs_disasm_iter()\n @op_type: Operand type to be found.\n\n @return: number of operands of given type @op_type in instruction @insn,\n or -1 on failure.\n*/\nCAPSTONE_EXPORT\nint CAPSTONE_API cs_op_count(csh handle, const cs_insn *insn, unsigned int op_type);\n\n/**\n Retrieve the position of operand of given type in <arch>.operands[] array.\n Later, the operand can be accessed using the returned position.\n Find the operand type in header file of corresponding architecture (arm.h for ARM, x86.h for X86, ...)\n\n NOTE: this API is only valid when detail option is ON (which is OFF by default)\n\n @handle: handle returned by cs_open()\n @insn: disassembled instruction structure received from cs_disasm() or cs_disasm_iter()\n @op_type: Operand type to be found.\n @position: position of the operand to be found. This must be in the range\n\t\t\t[1, cs_op_count(handle, insn, op_type)]\n\n @return: index of operand of given type @op_type in <arch>.operands[] array\n in instruction @insn, or -1 on failure.\n*/\nCAPSTONE_EXPORT\nint CAPSTONE_API cs_op_index(csh handle, const cs_insn *insn, unsigned int op_type,\n\t\tunsigned int position);\n\n/// Type of array to keep the list of registers\ntypedef uint16_t cs_regs[64];\n\n/**\n Retrieve all the registers accessed by an instruction, either explicitly or\n implicitly.\n\n WARN: when in 'diet' mode, this API is irrelevant because engine does not\n store registers.\n\n @handle: handle returned by cs_open()\n @insn: disassembled instruction structure returned from cs_disasm() or cs_disasm_iter()\n @regs_read: on return, this array contains all registers read by instruction.\n @regs_read_count: number of registers kept inside @regs_read array.\n @regs_write: on return, this array contains all registers written by instruction.\n @regs_write_count: number of registers kept inside @regs_write array.\n\n @return CS_ERR_OK on success, or other value on failure (refer to cs_err enum\n for detailed error).\n*/\nCAPSTONE_EXPORT\ncs_err CAPSTONE_API cs_regs_access(csh handle, const cs_insn *insn,\n\t\tcs_regs regs_read, uint8_t *regs_read_count,\n\t\tcs_regs regs_write, uint8_t *regs_write_count);\n\n#ifdef __cplusplus\n}\n#endif\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/capstone/evm.h",
    "content": "#ifndef CAPSTONE_EVM_H\n#define CAPSTONE_EVM_H\n\n/* Capstone Disassembly Engine */\n/* By Nguyen Anh Quynh <aquynh@gmail.com>, 2013-2018 */\n\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\n#include \"platform.h\"\n\n#ifdef _MSC_VER\n#pragma warning(disable:4201)\n#endif\n\n/// Instruction structure\ntypedef struct cs_evm {\n    unsigned char pop;    ///< number of items popped from the stack\n    unsigned char push;   ///< number of items pushed into the stack\n    unsigned int  fee;    ///< gas fee for the instruction\n} cs_evm;\n\n/// EVM instruction\ntypedef enum evm_insn {\n\tEVM_INS_STOP = 0,\n\tEVM_INS_ADD = 1,\n\tEVM_INS_MUL = 2,\n\tEVM_INS_SUB = 3,\n\tEVM_INS_DIV = 4,\n\tEVM_INS_SDIV = 5,\n\tEVM_INS_MOD = 6,\n\tEVM_INS_SMOD = 7,\n\tEVM_INS_ADDMOD = 8,\n\tEVM_INS_MULMOD = 9,\n\tEVM_INS_EXP = 10,\n\tEVM_INS_SIGNEXTEND = 11,\n\tEVM_INS_LT = 16,\n\tEVM_INS_GT = 17,\n\tEVM_INS_SLT = 18,\n\tEVM_INS_SGT = 19,\n\tEVM_INS_EQ = 20,\n\tEVM_INS_ISZERO = 21,\n\tEVM_INS_AND = 22,\n\tEVM_INS_OR = 23,\n\tEVM_INS_XOR = 24,\n\tEVM_INS_NOT = 25,\n\tEVM_INS_BYTE = 26,\n\tEVM_INS_SHA3 = 32,\n\tEVM_INS_ADDRESS = 48,\n\tEVM_INS_BALANCE = 49,\n\tEVM_INS_ORIGIN = 50,\n\tEVM_INS_CALLER = 51,\n\tEVM_INS_CALLVALUE = 52,\n\tEVM_INS_CALLDATALOAD = 53,\n\tEVM_INS_CALLDATASIZE = 54,\n\tEVM_INS_CALLDATACOPY = 55,\n\tEVM_INS_CODESIZE = 56,\n\tEVM_INS_CODECOPY = 57,\n\tEVM_INS_GASPRICE = 58,\n\tEVM_INS_EXTCODESIZE = 59,\n\tEVM_INS_EXTCODECOPY = 60,\n\tEVM_INS_RETURNDATASIZE = 61,\n\tEVM_INS_RETURNDATACOPY = 62,\n\tEVM_INS_BLOCKHASH = 64,\n\tEVM_INS_COINBASE = 65,\n\tEVM_INS_TIMESTAMP = 66,\n\tEVM_INS_NUMBER = 67,\n\tEVM_INS_DIFFICULTY = 68,\n\tEVM_INS_GASLIMIT = 69,\n\tEVM_INS_POP = 80,\n\tEVM_INS_MLOAD = 81,\n\tEVM_INS_MSTORE = 82,\n\tEVM_INS_MSTORE8 = 83,\n\tEVM_INS_SLOAD = 84,\n\tEVM_INS_SSTORE = 85,\n\tEVM_INS_JUMP = 86,\n\tEVM_INS_JUMPI = 87,\n\tEVM_INS_PC = 88,\n\tEVM_INS_MSIZE = 89,\n\tEVM_INS_GAS = 90,\n\tEVM_INS_JUMPDEST = 91,\n\tEVM_INS_PUSH1 = 96,\n\tEVM_INS_PUSH2 = 97,\n\tEVM_INS_PUSH3 = 98,\n\tEVM_INS_PUSH4 = 99,\n\tEVM_INS_PUSH5 = 100,\n\tEVM_INS_PUSH6 = 101,\n\tEVM_INS_PUSH7 = 102,\n\tEVM_INS_PUSH8 = 103,\n\tEVM_INS_PUSH9 = 104,\n\tEVM_INS_PUSH10 = 105,\n\tEVM_INS_PUSH11 = 106,\n\tEVM_INS_PUSH12 = 107,\n\tEVM_INS_PUSH13 = 108,\n\tEVM_INS_PUSH14 = 109,\n\tEVM_INS_PUSH15 = 110,\n\tEVM_INS_PUSH16 = 111,\n\tEVM_INS_PUSH17 = 112,\n\tEVM_INS_PUSH18 = 113,\n\tEVM_INS_PUSH19 = 114,\n\tEVM_INS_PUSH20 = 115,\n\tEVM_INS_PUSH21 = 116,\n\tEVM_INS_PUSH22 = 117,\n\tEVM_INS_PUSH23 = 118,\n\tEVM_INS_PUSH24 = 119,\n\tEVM_INS_PUSH25 = 120,\n\tEVM_INS_PUSH26 = 121,\n\tEVM_INS_PUSH27 = 122,\n\tEVM_INS_PUSH28 = 123,\n\tEVM_INS_PUSH29 = 124,\n\tEVM_INS_PUSH30 = 125,\n\tEVM_INS_PUSH31 = 126,\n\tEVM_INS_PUSH32 = 127,\n\tEVM_INS_DUP1 = 128,\n\tEVM_INS_DUP2 = 129,\n\tEVM_INS_DUP3 = 130,\n\tEVM_INS_DUP4 = 131,\n\tEVM_INS_DUP5 = 132,\n\tEVM_INS_DUP6 = 133,\n\tEVM_INS_DUP7 = 134,\n\tEVM_INS_DUP8 = 135,\n\tEVM_INS_DUP9 = 136,\n\tEVM_INS_DUP10 = 137,\n\tEVM_INS_DUP11 = 138,\n\tEVM_INS_DUP12 = 139,\n\tEVM_INS_DUP13 = 140,\n\tEVM_INS_DUP14 = 141,\n\tEVM_INS_DUP15 = 142,\n\tEVM_INS_DUP16 = 143,\n\tEVM_INS_SWAP1 = 144,\n\tEVM_INS_SWAP2 = 145,\n\tEVM_INS_SWAP3 = 146,\n\tEVM_INS_SWAP4 = 147,\n\tEVM_INS_SWAP5 = 148,\n\tEVM_INS_SWAP6 = 149,\n\tEVM_INS_SWAP7 = 150,\n\tEVM_INS_SWAP8 = 151,\n\tEVM_INS_SWAP9 = 152,\n\tEVM_INS_SWAP10 = 153,\n\tEVM_INS_SWAP11 = 154,\n\tEVM_INS_SWAP12 = 155,\n\tEVM_INS_SWAP13 = 156,\n\tEVM_INS_SWAP14 = 157,\n\tEVM_INS_SWAP15 = 158,\n\tEVM_INS_SWAP16 = 159,\n\tEVM_INS_LOG0 = 160,\n\tEVM_INS_LOG1 = 161,\n\tEVM_INS_LOG2 = 162,\n\tEVM_INS_LOG3 = 163,\n\tEVM_INS_LOG4 = 164,\n\tEVM_INS_CREATE = 240,\n\tEVM_INS_CALL = 241,\n\tEVM_INS_CALLCODE = 242,\n\tEVM_INS_RETURN = 243,\n\tEVM_INS_DELEGATECALL = 244,\n\tEVM_INS_CALLBLACKBOX = 245,\n\tEVM_INS_STATICCALL = 250,\n\tEVM_INS_REVERT = 253,\n\tEVM_INS_SUICIDE = 255,\n\n\tEVM_INS_INVALID = 512,\n\tEVM_INS_ENDING,   // <-- mark the end of the list of instructions\n} evm_insn;\n\n/// Group of EVM instructions\ntypedef enum evm_insn_group {\n\tEVM_GRP_INVALID = 0, ///< = CS_GRP_INVALID\n\n\tEVM_GRP_JUMP,          ///< all jump instructions\n\n\tEVM_GRP_MATH = 8,      ///< math instructions\n\tEVM_GRP_STACK_WRITE,   ///< instructions write to stack\n\tEVM_GRP_STACK_READ,    ///< instructions read from stack\n\tEVM_GRP_MEM_WRITE,     ///< instructions write to memory\n\tEVM_GRP_MEM_READ,      ///< instructions read from memory\n\tEVM_GRP_STORE_WRITE,   ///< instructions write to storage\n\tEVM_GRP_STORE_READ,    ///< instructions read from storage\n\tEVM_GRP_HALT,    ///< instructions halt execution\n\n\tEVM_GRP_ENDING,   ///< <-- mark the end of the list of groups\n} evm_insn_group;\n\n#ifdef __cplusplus\n}\n#endif\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/capstone/m680x.h",
    "content": "#ifndef CAPSTONE_M680X_H\n#define CAPSTONE_M680X_H\n\n/* Capstone Disassembly Engine */\n/* M680X Backend by Wolfgang Schwotzer <wolfgang.schwotzer@gmx.net> 2017 */\n\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\n#include \"platform.h\"\n\n#ifdef _MSC_VER\n#pragma warning(disable:4201)\n#endif\n\n#define M680X_OPERAND_COUNT 9\n\n/// M680X registers and special registers\ntypedef enum m680x_reg {\n\tM680X_REG_INVALID = 0,\n\n\tM680X_REG_A, ///< M6800/1/2/3/9, HD6301/9\n\tM680X_REG_B, ///< M6800/1/2/3/9, HD6301/9\n\tM680X_REG_E, ///< HD6309\n\tM680X_REG_F, ///< HD6309\n\tM680X_REG_0, ///< HD6309\n\n\tM680X_REG_D, ///< M6801/3/9, HD6301/9\n\tM680X_REG_W, ///< HD6309\n\n\tM680X_REG_CC, ///< M6800/1/2/3/9, M6301/9\n\tM680X_REG_DP, ///< M6809/M6309\n\tM680X_REG_MD, ///< M6309\n\n\tM680X_REG_HX, ///< M6808\n\tM680X_REG_H, ///< M6808\n\tM680X_REG_X, ///< M6800/1/2/3/9, M6301/9\n\tM680X_REG_Y, ///< M6809/M6309\n\tM680X_REG_S, ///< M6809/M6309\n\tM680X_REG_U, ///< M6809/M6309\n\tM680X_REG_V, ///< M6309\n\n\tM680X_REG_Q, ///< M6309\n\n\tM680X_REG_PC, ///< M6800/1/2/3/9, M6301/9\n\n\tM680X_REG_TMP2, ///< CPU12\n\tM680X_REG_TMP3, ///< CPU12\n\n\tM680X_REG_ENDING,   ///< <-- mark the end of the list of registers\n} m680x_reg;\n\n/// Operand type for instruction's operands\ntypedef enum m680x_op_type {\n\tM680X_OP_INVALID = 0, ///< = CS_OP_INVALID (Uninitialized).\n\tM680X_OP_REGISTER,    ///< = Register operand.\n\tM680X_OP_IMMEDIATE,   ///< = Immediate operand.\n\tM680X_OP_INDEXED,     ///< = Indexed addressing operand.\n\tM680X_OP_EXTENDED,    ///< = Extended addressing operand.\n\tM680X_OP_DIRECT,      ///< = Direct addressing operand.\n\tM680X_OP_RELATIVE,    ///< = Relative addressing operand.\n\tM680X_OP_CONSTANT,    ///< = constant operand (Displayed as number only).\n\t\t\t\t///< Used e.g. for a bit index or page number.\n} m680x_op_type;\n\n// Supported bit values for mem.idx.offset_bits\n#define M680X_OFFSET_NONE      0\n#define M680X_OFFSET_BITS_5    5\n#define M680X_OFFSET_BITS_8    8\n#define M680X_OFFSET_BITS_9    9\n#define M680X_OFFSET_BITS_16  16\n\n// Supported bit flags for mem.idx.flags\n// These flags can be combined\n#define M680X_IDX_INDIRECT     1\n#define M680X_IDX_NO_COMMA     2\n#define M680X_IDX_POST_INC_DEC 4\n\n/// Instruction's operand referring to indexed addressing\ntypedef struct m680x_op_idx {\n\tm680x_reg base_reg;\t///< base register (or M680X_REG_INVALID if\n\t\t\t\t///< irrelevant)\n\tm680x_reg offset_reg;\t///< offset register (or M680X_REG_INVALID if\n\t\t\t\t///< irrelevant)\n\tint16_t offset;\t\t///< 5-,8- or 16-bit offset. See also offset_bits.\n\tuint16_t offset_addr;\t///< = offset addr. if base_reg == M680X_REG_PC.\n\t\t\t\t///< calculated as offset + PC\n\tuint8_t offset_bits;\t///< offset width in bits for indexed addressing\n\tint8_t inc_dec;\t\t///< inc. or dec. value:\n\t\t\t\t///<    0: no inc-/decrement\n\t\t\t\t///<    1 .. 8: increment by 1 .. 8\n\t\t\t\t///<    -1 .. -8: decrement by 1 .. 8\n\t\t\t\t///< if flag M680X_IDX_POST_INC_DEC set it is post\n\t\t\t\t///< inc-/decrement otherwise pre inc-/decrement\n\tuint8_t flags;\t\t///< 8-bit flags (see above)\n} m680x_op_idx;\n\n/// Instruction's memory operand referring to relative addressing (Bcc/LBcc)\ntypedef struct m680x_op_rel {\n\tuint16_t address;\t///< The absolute address.\n\t\t\t\t///< calculated as PC + offset. PC is the first\n\t\t\t\t///< address after the instruction.\n\tint16_t offset;\t\t///< the offset/displacement value\n} m680x_op_rel;\n\n/// Instruction's operand referring to extended addressing\ntypedef struct m680x_op_ext {\n\tuint16_t address;      ///< The absolute address\n\tbool indirect;         ///< true if extended indirect addressing\n} m680x_op_ext;\n\n/// Instruction operand\ntypedef struct cs_m680x_op {\n\tm680x_op_type type;\n\tunion {\n\t\tint32_t imm;\t\t///< immediate value for IMM operand\n\t\tm680x_reg reg;\t\t///< register value for REG operand\n\t\tm680x_op_idx idx;\t///< Indexed addressing operand\n\t\tm680x_op_rel rel;\t///< Relative address. operand (Bcc/LBcc)\n\t\tm680x_op_ext ext;\t///< Extended address\n\t\tuint8_t direct_addr;\t///<</ Direct address (lower 8-bit)\n\t\tuint8_t const_val;\t///< constant value (bit index, page nr.)\n\t};\n\tuint8_t size;\t\t\t///< size of this operand (in bytes)\n\t/// How is this operand accessed? (READ, WRITE or READ|WRITE)\n\t/// This field is combined of cs_ac_type.\n\t/// NOTE: this field is irrelevant if engine is compiled in DIET \n\tuint8_t access;\n} cs_m680x_op;\n\n/// Group of M680X instructions\ntypedef enum m680x_group_type {\n\tM680X_GRP_INVALID = 0,\t/// = CS_GRP_INVALID\n\t// Generic groups\n\t// all jump instructions (conditional+direct+indirect jumps)\n\tM680X_GRP_JUMP,\t\t///< = CS_GRP_JUMP\n\t// all call instructions\n\tM680X_GRP_CALL,\t\t///< = CS_GRP_CALL\n\t// all return instructions\n\tM680X_GRP_RET,\t\t///< = CS_GRP_RET\n\t// all interrupt instructions (int+syscall)\n\tM680X_GRP_INT,\t\t///< = CS_GRP_INT\n\t// all interrupt return instructions\n\tM680X_GRP_IRET,\t\t///< = CS_GRP_IRET\n\t// all privileged instructions\n\tM680X_GRP_PRIV,\t\t///< = CS_GRP_PRIVILEDGE; not used\n\t// all relative branching instructions\n\tM680X_GRP_BRAREL,\t///< = CS_GRP_BRANCH_RELATIVE\n\n\t// Architecture-specific groups\n\tM680X_GRP_ENDING,\t// <-- mark the end of the list of groups\n} m680x_group_type;\n\n// M680X instruction flags:\n\n/// The first (register) operand is part of the\n/// instruction mnemonic\n#define M680X_FIRST_OP_IN_MNEM    1\n/// The second (register) operand is part of the\n/// instruction mnemonic\n#define M680X_SECOND_OP_IN_MNEM   2\n\n/// The M680X instruction and it's operands\ntypedef struct cs_m680x {\n\tuint8_t flags;\t\t///< See: M680X instruction flags\n\tuint8_t op_count;\t///< number of operands for the instruction or 0\n\tcs_m680x_op operands[M680X_OPERAND_COUNT]; ///< operands for this insn.\n} cs_m680x;\n\n/// M680X instruction IDs\ntypedef enum m680x_insn {\n\tM680X_INS_INVLD = 0,\n\tM680X_INS_ABA, ///< M6800/1/2/3\n\tM680X_INS_ABX,\n\tM680X_INS_ABY,\n\tM680X_INS_ADC,\n\tM680X_INS_ADCA,\n\tM680X_INS_ADCB,\n\tM680X_INS_ADCD,\n\tM680X_INS_ADCR,\n\tM680X_INS_ADD,\n\tM680X_INS_ADDA,\n\tM680X_INS_ADDB,\n\tM680X_INS_ADDD,\n\tM680X_INS_ADDE,\n\tM680X_INS_ADDF,\n\tM680X_INS_ADDR,\n\tM680X_INS_ADDW,\n\tM680X_INS_AIM,\n\tM680X_INS_AIS,\n\tM680X_INS_AIX,\n\tM680X_INS_AND,\n\tM680X_INS_ANDA,\n\tM680X_INS_ANDB,\n\tM680X_INS_ANDCC,\n\tM680X_INS_ANDD,\n\tM680X_INS_ANDR,\n\tM680X_INS_ASL,\n\tM680X_INS_ASLA,\n\tM680X_INS_ASLB,\n\tM680X_INS_ASLD, ///< or LSLD\n\tM680X_INS_ASR,\n\tM680X_INS_ASRA,\n\tM680X_INS_ASRB,\n\tM680X_INS_ASRD,\n\tM680X_INS_ASRX,\n\tM680X_INS_BAND,\n\tM680X_INS_BCC, ///< or BHS\n\tM680X_INS_BCLR,\n\tM680X_INS_BCS, ///< or BLO\n\tM680X_INS_BEOR,\n\tM680X_INS_BEQ,\n\tM680X_INS_BGE,\n\tM680X_INS_BGND,\n\tM680X_INS_BGT,\n\tM680X_INS_BHCC,\n\tM680X_INS_BHCS,\n\tM680X_INS_BHI,\n\tM680X_INS_BIAND,\n\tM680X_INS_BIEOR,\n\tM680X_INS_BIH,\n\tM680X_INS_BIL,\n\tM680X_INS_BIOR,\n\tM680X_INS_BIT,\n\tM680X_INS_BITA,\n\tM680X_INS_BITB,\n\tM680X_INS_BITD,\n\tM680X_INS_BITMD,\n\tM680X_INS_BLE,\n\tM680X_INS_BLS,\n\tM680X_INS_BLT,\n\tM680X_INS_BMC,\n\tM680X_INS_BMI,\n\tM680X_INS_BMS,\n\tM680X_INS_BNE,\n\tM680X_INS_BOR,\n\tM680X_INS_BPL,\n\tM680X_INS_BRCLR,\n\tM680X_INS_BRSET,\n\tM680X_INS_BRA,\n\tM680X_INS_BRN,\n\tM680X_INS_BSET,\n\tM680X_INS_BSR,\n\tM680X_INS_BVC,\n\tM680X_INS_BVS,\n\tM680X_INS_CALL,\n\tM680X_INS_CBA, ///< M6800/1/2/3\n\tM680X_INS_CBEQ,\n\tM680X_INS_CBEQA,\n\tM680X_INS_CBEQX,\n\tM680X_INS_CLC, ///< M6800/1/2/3\n\tM680X_INS_CLI, ///< M6800/1/2/3\n\tM680X_INS_CLR,\n\tM680X_INS_CLRA,\n\tM680X_INS_CLRB,\n\tM680X_INS_CLRD,\n\tM680X_INS_CLRE,\n\tM680X_INS_CLRF,\n\tM680X_INS_CLRH,\n\tM680X_INS_CLRW,\n\tM680X_INS_CLRX,\n\tM680X_INS_CLV, ///< M6800/1/2/3\n\tM680X_INS_CMP,\n\tM680X_INS_CMPA,\n\tM680X_INS_CMPB,\n\tM680X_INS_CMPD,\n\tM680X_INS_CMPE,\n\tM680X_INS_CMPF,\n\tM680X_INS_CMPR,\n\tM680X_INS_CMPS,\n\tM680X_INS_CMPU,\n\tM680X_INS_CMPW,\n\tM680X_INS_CMPX,\n\tM680X_INS_CMPY,\n\tM680X_INS_COM,\n\tM680X_INS_COMA,\n\tM680X_INS_COMB,\n\tM680X_INS_COMD,\n\tM680X_INS_COME,\n\tM680X_INS_COMF,\n\tM680X_INS_COMW,\n\tM680X_INS_COMX,\n\tM680X_INS_CPD,\n\tM680X_INS_CPHX,\n\tM680X_INS_CPS,\n\tM680X_INS_CPX, ///< M6800/1/2/3\n\tM680X_INS_CPY,\n\tM680X_INS_CWAI,\n\tM680X_INS_DAA,\n\tM680X_INS_DBEQ,\n\tM680X_INS_DBNE,\n\tM680X_INS_DBNZ,\n\tM680X_INS_DBNZA,\n\tM680X_INS_DBNZX,\n\tM680X_INS_DEC,\n\tM680X_INS_DECA,\n\tM680X_INS_DECB,\n\tM680X_INS_DECD,\n\tM680X_INS_DECE,\n\tM680X_INS_DECF,\n\tM680X_INS_DECW,\n\tM680X_INS_DECX,\n\tM680X_INS_DES, ///< M6800/1/2/3\n\tM680X_INS_DEX, ///< M6800/1/2/3\n\tM680X_INS_DEY,\n\tM680X_INS_DIV,\n\tM680X_INS_DIVD,\n\tM680X_INS_DIVQ,\n\tM680X_INS_EDIV,\n\tM680X_INS_EDIVS,\n\tM680X_INS_EIM,\n\tM680X_INS_EMACS,\n\tM680X_INS_EMAXD,\n\tM680X_INS_EMAXM,\n\tM680X_INS_EMIND,\n\tM680X_INS_EMINM,\n\tM680X_INS_EMUL,\n\tM680X_INS_EMULS,\n\tM680X_INS_EOR,\n\tM680X_INS_EORA,\n\tM680X_INS_EORB,\n\tM680X_INS_EORD,\n\tM680X_INS_EORR,\n\tM680X_INS_ETBL,\n\tM680X_INS_EXG,\n\tM680X_INS_FDIV,\n\tM680X_INS_IBEQ,\n\tM680X_INS_IBNE,\n\tM680X_INS_IDIV,\n\tM680X_INS_IDIVS,\n\tM680X_INS_ILLGL,\n\tM680X_INS_INC,\n\tM680X_INS_INCA,\n\tM680X_INS_INCB,\n\tM680X_INS_INCD,\n\tM680X_INS_INCE,\n\tM680X_INS_INCF,\n\tM680X_INS_INCW,\n\tM680X_INS_INCX,\n\tM680X_INS_INS, ///< M6800/1/2/3\n\tM680X_INS_INX, ///< M6800/1/2/3\n\tM680X_INS_INY,\n\tM680X_INS_JMP,\n\tM680X_INS_JSR,\n\tM680X_INS_LBCC, ///< or LBHS\n\tM680X_INS_LBCS, ///< or LBLO\n\tM680X_INS_LBEQ,\n\tM680X_INS_LBGE,\n\tM680X_INS_LBGT,\n\tM680X_INS_LBHI,\n\tM680X_INS_LBLE,\n\tM680X_INS_LBLS,\n\tM680X_INS_LBLT,\n\tM680X_INS_LBMI,\n\tM680X_INS_LBNE,\n\tM680X_INS_LBPL,\n\tM680X_INS_LBRA,\n\tM680X_INS_LBRN,\n\tM680X_INS_LBSR,\n\tM680X_INS_LBVC,\n\tM680X_INS_LBVS,\n\tM680X_INS_LDA,\n\tM680X_INS_LDAA, ///< M6800/1/2/3\n\tM680X_INS_LDAB, ///< M6800/1/2/3\n\tM680X_INS_LDB,\n\tM680X_INS_LDBT,\n\tM680X_INS_LDD,\n\tM680X_INS_LDE,\n\tM680X_INS_LDF,\n\tM680X_INS_LDHX,\n\tM680X_INS_LDMD,\n\tM680X_INS_LDQ,\n\tM680X_INS_LDS,\n\tM680X_INS_LDU,\n\tM680X_INS_LDW,\n\tM680X_INS_LDX,\n\tM680X_INS_LDY,\n\tM680X_INS_LEAS,\n\tM680X_INS_LEAU,\n\tM680X_INS_LEAX,\n\tM680X_INS_LEAY,\n\tM680X_INS_LSL,\n\tM680X_INS_LSLA,\n\tM680X_INS_LSLB,\n\tM680X_INS_LSLD,\n\tM680X_INS_LSLX,\n\tM680X_INS_LSR,\n\tM680X_INS_LSRA,\n\tM680X_INS_LSRB,\n\tM680X_INS_LSRD, ///< or ASRD\n\tM680X_INS_LSRW,\n\tM680X_INS_LSRX,\n\tM680X_INS_MAXA,\n\tM680X_INS_MAXM,\n\tM680X_INS_MEM,\n\tM680X_INS_MINA,\n\tM680X_INS_MINM,\n\tM680X_INS_MOV,\n\tM680X_INS_MOVB,\n\tM680X_INS_MOVW,\n\tM680X_INS_MUL,\n\tM680X_INS_MULD,\n\tM680X_INS_NEG,\n\tM680X_INS_NEGA,\n\tM680X_INS_NEGB,\n\tM680X_INS_NEGD,\n\tM680X_INS_NEGX,\n\tM680X_INS_NOP,\n\tM680X_INS_NSA,\n\tM680X_INS_OIM,\n\tM680X_INS_ORA,\n\tM680X_INS_ORAA, ///< M6800/1/2/3\n\tM680X_INS_ORAB, ///< M6800/1/2/3\n\tM680X_INS_ORB,\n\tM680X_INS_ORCC,\n\tM680X_INS_ORD,\n\tM680X_INS_ORR,\n\tM680X_INS_PSHA, ///< M6800/1/2/3\n\tM680X_INS_PSHB, ///< M6800/1/2/3\n\tM680X_INS_PSHC,\n\tM680X_INS_PSHD,\n\tM680X_INS_PSHH,\n\tM680X_INS_PSHS,\n\tM680X_INS_PSHSW,\n\tM680X_INS_PSHU,\n\tM680X_INS_PSHUW,\n\tM680X_INS_PSHX, ///< M6800/1/2/3\n\tM680X_INS_PSHY,\n\tM680X_INS_PULA, ///< M6800/1/2/3\n\tM680X_INS_PULB, ///< M6800/1/2/3\n\tM680X_INS_PULC,\n\tM680X_INS_PULD,\n\tM680X_INS_PULH,\n\tM680X_INS_PULS,\n\tM680X_INS_PULSW,\n\tM680X_INS_PULU,\n\tM680X_INS_PULUW,\n\tM680X_INS_PULX, ///< M6800/1/2/3\n\tM680X_INS_PULY,\n\tM680X_INS_REV,\n\tM680X_INS_REVW,\n\tM680X_INS_ROL,\n\tM680X_INS_ROLA,\n\tM680X_INS_ROLB,\n\tM680X_INS_ROLD,\n\tM680X_INS_ROLW,\n\tM680X_INS_ROLX,\n\tM680X_INS_ROR,\n\tM680X_INS_RORA,\n\tM680X_INS_RORB,\n\tM680X_INS_RORD,\n\tM680X_INS_RORW,\n\tM680X_INS_RORX,\n\tM680X_INS_RSP,\n\tM680X_INS_RTC,\n\tM680X_INS_RTI,\n\tM680X_INS_RTS,\n\tM680X_INS_SBA, ///< M6800/1/2/3\n\tM680X_INS_SBC,\n\tM680X_INS_SBCA,\n\tM680X_INS_SBCB,\n\tM680X_INS_SBCD,\n\tM680X_INS_SBCR,\n\tM680X_INS_SEC,\n\tM680X_INS_SEI,\n\tM680X_INS_SEV,\n\tM680X_INS_SEX,\n\tM680X_INS_SEXW,\n\tM680X_INS_SLP,\n\tM680X_INS_STA,\n\tM680X_INS_STAA, ///< M6800/1/2/3\n\tM680X_INS_STAB, ///< M6800/1/2/3\n\tM680X_INS_STB,\n\tM680X_INS_STBT,\n\tM680X_INS_STD,\n\tM680X_INS_STE,\n\tM680X_INS_STF,\n\tM680X_INS_STOP,\n\tM680X_INS_STHX,\n\tM680X_INS_STQ,\n\tM680X_INS_STS,\n\tM680X_INS_STU,\n\tM680X_INS_STW,\n\tM680X_INS_STX,\n\tM680X_INS_STY,\n\tM680X_INS_SUB,\n\tM680X_INS_SUBA,\n\tM680X_INS_SUBB,\n\tM680X_INS_SUBD,\n\tM680X_INS_SUBE,\n\tM680X_INS_SUBF,\n\tM680X_INS_SUBR,\n\tM680X_INS_SUBW,\n\tM680X_INS_SWI,\n\tM680X_INS_SWI2,\n\tM680X_INS_SWI3,\n\tM680X_INS_SYNC,\n\tM680X_INS_TAB, ///< M6800/1/2/3\n\tM680X_INS_TAP, ///< M6800/1/2/3\n\tM680X_INS_TAX,\n\tM680X_INS_TBA, ///< M6800/1/2/3\n\tM680X_INS_TBEQ,\n\tM680X_INS_TBL,\n\tM680X_INS_TBNE,\n\tM680X_INS_TEST,\n\tM680X_INS_TFM,\n\tM680X_INS_TFR,\n\tM680X_INS_TIM,\n\tM680X_INS_TPA, ///< M6800/1/2/3\n\tM680X_INS_TST,\n\tM680X_INS_TSTA,\n\tM680X_INS_TSTB,\n\tM680X_INS_TSTD,\n\tM680X_INS_TSTE,\n\tM680X_INS_TSTF,\n\tM680X_INS_TSTW,\n\tM680X_INS_TSTX,\n\tM680X_INS_TSX, ///< M6800/1/2/3\n\tM680X_INS_TSY,\n\tM680X_INS_TXA,\n\tM680X_INS_TXS, ///< M6800/1/2/3\n\tM680X_INS_TYS,\n\tM680X_INS_WAI, ///< M6800/1/2/3\n\tM680X_INS_WAIT,\n\tM680X_INS_WAV,\n\tM680X_INS_WAVR,\n\tM680X_INS_XGDX, ///< HD6301\n\tM680X_INS_XGDY,\n\tM680X_INS_ENDING,   // <-- mark the end of the list of instructions\n} m680x_insn;\n\n#ifdef __cplusplus\n}\n#endif\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/capstone/m68k.h",
    "content": "#ifndef CAPSTONE_M68K_H\n#define CAPSTONE_M68K_H\n\n/* Capstone Disassembly Engine */\n/* By Daniel Collin <daniel@collin.com>, 2015-2016 */\n\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\n#include \"platform.h\"\n\n#ifdef _MSC_VER\n#pragma warning(disable:4201)\n#endif\n\n#define M68K_OPERAND_COUNT 4\n\n/// M68K registers and special registers\ntypedef enum m68k_reg {\n\tM68K_REG_INVALID = 0,\n\n\tM68K_REG_D0,\n\tM68K_REG_D1,\n\tM68K_REG_D2,\n\tM68K_REG_D3,\n\tM68K_REG_D4,\n\tM68K_REG_D5,\n\tM68K_REG_D6,\n\tM68K_REG_D7,\n\n\tM68K_REG_A0,\n\tM68K_REG_A1,\n\tM68K_REG_A2,\n\tM68K_REG_A3,\n\tM68K_REG_A4,\n\tM68K_REG_A5,\n\tM68K_REG_A6,\n\tM68K_REG_A7,\n\n\tM68K_REG_FP0,\n\tM68K_REG_FP1,\n\tM68K_REG_FP2,\n\tM68K_REG_FP3,\n\tM68K_REG_FP4,\n\tM68K_REG_FP5,\n\tM68K_REG_FP6,\n\tM68K_REG_FP7,\n\n\tM68K_REG_PC,\n\n\tM68K_REG_SR,\n\tM68K_REG_CCR,\n\tM68K_REG_SFC,\n\tM68K_REG_DFC,\n\tM68K_REG_USP,\n\tM68K_REG_VBR,\n\tM68K_REG_CACR,\n\tM68K_REG_CAAR,\n\tM68K_REG_MSP,\n\tM68K_REG_ISP,\n\tM68K_REG_TC,\n\tM68K_REG_ITT0,\n\tM68K_REG_ITT1,\n\tM68K_REG_DTT0,\n\tM68K_REG_DTT1,\n\tM68K_REG_MMUSR,\n\tM68K_REG_URP,\n\tM68K_REG_SRP,\n\n\tM68K_REG_FPCR,\n\tM68K_REG_FPSR,\n\tM68K_REG_FPIAR,\n\n\tM68K_REG_ENDING,   // <-- mark the end of the list of registers\n} m68k_reg;\n\n/// M68K Addressing Modes\ntypedef enum m68k_address_mode {\n\tM68K_AM_NONE = 0,\t\t\t///< No address mode.\n\n\tM68K_AM_REG_DIRECT_DATA,\t\t///< Register Direct - Data\n\tM68K_AM_REG_DIRECT_ADDR,\t\t///< Register Direct - Address\n\n\tM68K_AM_REGI_ADDR,\t\t\t\t///< Register Indirect - Address\n\tM68K_AM_REGI_ADDR_POST_INC,\t\t///< Register Indirect - Address with Postincrement\n\tM68K_AM_REGI_ADDR_PRE_DEC,\t\t///< Register Indirect - Address with Predecrement\n\tM68K_AM_REGI_ADDR_DISP,\t\t\t///< Register Indirect - Address with Displacement\n\n\tM68K_AM_AREGI_INDEX_8_BIT_DISP,\t///< Address Register Indirect With Index- 8-bit displacement\n\tM68K_AM_AREGI_INDEX_BASE_DISP,\t///< Address Register Indirect With Index- Base displacement\n\n\tM68K_AM_MEMI_POST_INDEX,\t\t///< Memory indirect - Postindex\n\tM68K_AM_MEMI_PRE_INDEX,\t\t\t///< Memory indirect - Preindex\n\n\tM68K_AM_PCI_DISP,\t\t\t\t///< Program Counter Indirect - with Displacement\n\n\tM68K_AM_PCI_INDEX_8_BIT_DISP,\t///< Program Counter Indirect with Index - with 8-Bit Displacement\n\tM68K_AM_PCI_INDEX_BASE_DISP,\t///< Program Counter Indirect with Index - with Base Displacement\n\n\tM68K_AM_PC_MEMI_POST_INDEX,\t\t///< Program Counter Memory Indirect - Postindexed\n\tM68K_AM_PC_MEMI_PRE_INDEX,\t\t///< Program Counter Memory Indirect - Preindexed\n\n\tM68K_AM_ABSOLUTE_DATA_SHORT,\t///< Absolute Data Addressing  - Short\n\tM68K_AM_ABSOLUTE_DATA_LONG,\t\t///< Absolute Data Addressing  - Long\n\tM68K_AM_IMMEDIATE,              ///< Immediate value\n\n\tM68K_AM_BRANCH_DISPLACEMENT,    ///< Address as displacement from (PC+2) used by branches\n} m68k_address_mode;\n\n/// Operand type for instruction's operands\ntypedef enum m68k_op_type {\n\tM68K_OP_INVALID = 0, ///< = CS_OP_INVALID (Uninitialized).\n\tM68K_OP_REG,         ///< = CS_OP_REG (Register operand).\n\tM68K_OP_IMM,         ///< = CS_OP_IMM (Immediate operand).\n\tM68K_OP_MEM,         ///< = CS_OP_MEM (Memory operand).\n\tM68K_OP_FP_SINGLE,   ///< single precision Floating-Point operand\n\tM68K_OP_FP_DOUBLE,   ///< double precision Floating-Point operand\n\tM68K_OP_REG_BITS,    ///< Register bits move\n\tM68K_OP_REG_PAIR,    ///< Register pair in the same op (upper 4 bits for first reg, lower for second)\n\tM68K_OP_BR_DISP,     ///< Branch displacement\n} m68k_op_type;\n\n/// Instruction's operand referring to memory\n/// This is associated with M68K_OP_MEM operand type above\ntypedef struct m68k_op_mem {\n\tm68k_reg base_reg;      ///< base register (or M68K_REG_INVALID if irrelevant)\n\tm68k_reg index_reg;     ///< index register (or M68K_REG_INVALID if irrelevant)\n\tm68k_reg in_base_reg;   ///< indirect base register (or M68K_REG_INVALID if irrelevant)\n\tuint32_t in_disp; \t    ///< indirect displacement\n\tuint32_t out_disp;      ///< other displacement\n\tint16_t disp;\t        ///< displacement value\n\tuint8_t scale;\t        ///< scale for index register\n\tuint8_t bitfield;       ///< set to true if the two values below should be used\n\tuint8_t width;\t        ///< used for bf* instructions\n\tuint8_t offset;\t        ///< used for bf* instructions\n\tuint8_t index_size;     ///< 0 = w, 1 = l\n} m68k_op_mem;\n\n/// Operand type for instruction's operands\ntypedef enum m68k_op_br_disp_size {\n\tM68K_OP_BR_DISP_SIZE_INVALID = 0, ///< = CS_OP_INVALID (Uninitialized).\n\tM68K_OP_BR_DISP_SIZE_BYTE = 1,    ///< signed 8-bit displacement\n\tM68K_OP_BR_DISP_SIZE_WORD = 2,    ///< signed 16-bit displacement\n\tM68K_OP_BR_DISP_SIZE_LONG = 4,    ///< signed 32-bit displacement\n} m68k_op_br_disp_size;\n\ntypedef struct m68k_op_br_disp {\n\tint32_t disp;\t        ///< displacement value\n\tuint8_t disp_size;\t\t///< Size from m68k_op_br_disp_size type above\n} m68k_op_br_disp;\n\n/// Register pair in one operand.\ntypedef struct cs_m68k_op_reg_pair {\n\tm68k_reg reg_0;\n\tm68k_reg reg_1;\n} cs_m68k_op_reg_pair;\n\n/// Instruction operand\ntypedef struct cs_m68k_op {\n\tunion {\n\t\tuint64_t imm;               ///< immediate value for IMM operand\n\t\tdouble dimm; \t\t    ///< double imm\n\t\tfloat simm; \t\t    ///< float imm\n\t\tm68k_reg reg;\t\t    ///< register value for REG operand\n\t\tcs_m68k_op_reg_pair reg_pair; ///< register pair in one operand\n\t};\n\n\tm68k_op_mem mem; \t    ///< data when operand is targeting memory\n\tm68k_op_br_disp br_disp; ///< data when operand is a branch displacement\n\tuint32_t register_bits; ///< register bits for movem etc. (always in d0-d7, a0-a7, fp0 - fp7 order)\n\tm68k_op_type type;\n\tm68k_address_mode address_mode;\t///< M68K addressing mode for this op\n} cs_m68k_op;\n\n/// Operation size of the CPU instructions\ntypedef enum m68k_cpu_size {\n\tM68K_CPU_SIZE_NONE = 0,\t\t///< unsized or unspecified\n\tM68K_CPU_SIZE_BYTE = 1,\t\t///< 1 byte in size\n\tM68K_CPU_SIZE_WORD = 2,\t\t///< 2 bytes in size\n\tM68K_CPU_SIZE_LONG = 4,\t\t///< 4 bytes in size\n} m68k_cpu_size;\n\n/// Operation size of the FPU instructions (Notice that FPU instruction can also use CPU sizes if needed)\ntypedef enum m68k_fpu_size {\n\tM68K_FPU_SIZE_NONE = 0,\t\t///< unsized like fsave/frestore\n\tM68K_FPU_SIZE_SINGLE = 4,\t\t///< 4 byte in size (single float)\n\tM68K_FPU_SIZE_DOUBLE = 8,\t\t///< 8 byte in size (double)\n\tM68K_FPU_SIZE_EXTENDED = 12,\t///< 12 byte in size (extended real format)\n} m68k_fpu_size;\n\n/// Type of size that is being used for the current instruction\ntypedef enum m68k_size_type {\n\tM68K_SIZE_TYPE_INVALID = 0,\n\n\tM68K_SIZE_TYPE_CPU,\n\tM68K_SIZE_TYPE_FPU,\n} m68k_size_type;\n\n/// Operation size of the current instruction (NOT the actually size of instruction)\ntypedef struct m68k_op_size {\n\tm68k_size_type type;\n\tunion {\n\t\tm68k_cpu_size cpu_size;\n\t\tm68k_fpu_size fpu_size;\n\t};\n} m68k_op_size;\n\n/// The M68K instruction and it's operands\ntypedef struct cs_m68k {\n\t// Number of operands of this instruction or 0 when instruction has no operand.\n\tcs_m68k_op operands[M68K_OPERAND_COUNT]; ///< operands for this instruction.\n\tm68k_op_size op_size;\t///< size of data operand works on in bytes (.b, .w, .l, etc)\n\tuint8_t op_count; ///< number of operands for the instruction\n} cs_m68k;\n\n/// M68K instruction\ntypedef enum m68k_insn {\n\tM68K_INS_INVALID = 0,\n\n\tM68K_INS_ABCD,\n\tM68K_INS_ADD,\n\tM68K_INS_ADDA,\n\tM68K_INS_ADDI,\n\tM68K_INS_ADDQ,\n\tM68K_INS_ADDX,\n\tM68K_INS_AND,\n\tM68K_INS_ANDI,\n\tM68K_INS_ASL,\n\tM68K_INS_ASR,\n\tM68K_INS_BHS,\n\tM68K_INS_BLO,\n\tM68K_INS_BHI,\n\tM68K_INS_BLS,\n\tM68K_INS_BCC,\n\tM68K_INS_BCS,\n\tM68K_INS_BNE,\n\tM68K_INS_BEQ,\n\tM68K_INS_BVC,\n\tM68K_INS_BVS,\n\tM68K_INS_BPL,\n\tM68K_INS_BMI,\n\tM68K_INS_BGE,\n\tM68K_INS_BLT,\n\tM68K_INS_BGT,\n\tM68K_INS_BLE,\n\tM68K_INS_BRA,\n\tM68K_INS_BSR,\n\tM68K_INS_BCHG,\n\tM68K_INS_BCLR,\n\tM68K_INS_BSET,\n\tM68K_INS_BTST,\n\tM68K_INS_BFCHG,\n\tM68K_INS_BFCLR,\n\tM68K_INS_BFEXTS,\n\tM68K_INS_BFEXTU,\n\tM68K_INS_BFFFO,\n\tM68K_INS_BFINS,\n\tM68K_INS_BFSET,\n\tM68K_INS_BFTST,\n\tM68K_INS_BKPT,\n\tM68K_INS_CALLM,\n\tM68K_INS_CAS,\n\tM68K_INS_CAS2,\n\tM68K_INS_CHK,\n\tM68K_INS_CHK2,\n\tM68K_INS_CLR,\n\tM68K_INS_CMP,\n\tM68K_INS_CMPA,\n\tM68K_INS_CMPI,\n\tM68K_INS_CMPM,\n\tM68K_INS_CMP2,\n\tM68K_INS_CINVL,\n\tM68K_INS_CINVP,\n\tM68K_INS_CINVA,\n\tM68K_INS_CPUSHL,\n\tM68K_INS_CPUSHP,\n\tM68K_INS_CPUSHA,\n\tM68K_INS_DBT,\n\tM68K_INS_DBF,\n\tM68K_INS_DBHI,\n\tM68K_INS_DBLS,\n\tM68K_INS_DBCC,\n\tM68K_INS_DBCS,\n\tM68K_INS_DBNE,\n\tM68K_INS_DBEQ,\n\tM68K_INS_DBVC,\n\tM68K_INS_DBVS,\n\tM68K_INS_DBPL,\n\tM68K_INS_DBMI,\n\tM68K_INS_DBGE,\n\tM68K_INS_DBLT,\n\tM68K_INS_DBGT,\n\tM68K_INS_DBLE,\n\tM68K_INS_DBRA,\n\tM68K_INS_DIVS,\n\tM68K_INS_DIVSL,\n\tM68K_INS_DIVU,\n\tM68K_INS_DIVUL,\n\tM68K_INS_EOR,\n\tM68K_INS_EORI,\n\tM68K_INS_EXG,\n\tM68K_INS_EXT,\n\tM68K_INS_EXTB,\n\tM68K_INS_FABS,\n\tM68K_INS_FSABS,\n\tM68K_INS_FDABS,\n\tM68K_INS_FACOS,\n\tM68K_INS_FADD,\n\tM68K_INS_FSADD,\n\tM68K_INS_FDADD,\n\tM68K_INS_FASIN,\n\tM68K_INS_FATAN,\n\tM68K_INS_FATANH,\n\tM68K_INS_FBF,\n\tM68K_INS_FBEQ,\n\tM68K_INS_FBOGT,\n\tM68K_INS_FBOGE,\n\tM68K_INS_FBOLT,\n\tM68K_INS_FBOLE,\n\tM68K_INS_FBOGL,\n\tM68K_INS_FBOR,\n\tM68K_INS_FBUN,\n\tM68K_INS_FBUEQ,\n\tM68K_INS_FBUGT,\n\tM68K_INS_FBUGE,\n\tM68K_INS_FBULT,\n\tM68K_INS_FBULE,\n\tM68K_INS_FBNE,\n\tM68K_INS_FBT,\n\tM68K_INS_FBSF,\n\tM68K_INS_FBSEQ,\n\tM68K_INS_FBGT,\n\tM68K_INS_FBGE,\n\tM68K_INS_FBLT,\n\tM68K_INS_FBLE,\n\tM68K_INS_FBGL,\n\tM68K_INS_FBGLE,\n\tM68K_INS_FBNGLE,\n\tM68K_INS_FBNGL,\n\tM68K_INS_FBNLE,\n\tM68K_INS_FBNLT,\n\tM68K_INS_FBNGE,\n\tM68K_INS_FBNGT,\n\tM68K_INS_FBSNE,\n\tM68K_INS_FBST,\n\tM68K_INS_FCMP,\n\tM68K_INS_FCOS,\n\tM68K_INS_FCOSH,\n\tM68K_INS_FDBF,\n\tM68K_INS_FDBEQ,\n\tM68K_INS_FDBOGT,\n\tM68K_INS_FDBOGE,\n\tM68K_INS_FDBOLT,\n\tM68K_INS_FDBOLE,\n\tM68K_INS_FDBOGL,\n\tM68K_INS_FDBOR,\n\tM68K_INS_FDBUN,\n\tM68K_INS_FDBUEQ,\n\tM68K_INS_FDBUGT,\n\tM68K_INS_FDBUGE,\n\tM68K_INS_FDBULT,\n\tM68K_INS_FDBULE,\n\tM68K_INS_FDBNE,\n\tM68K_INS_FDBT,\n\tM68K_INS_FDBSF,\n\tM68K_INS_FDBSEQ,\n\tM68K_INS_FDBGT,\n\tM68K_INS_FDBGE,\n\tM68K_INS_FDBLT,\n\tM68K_INS_FDBLE,\n\tM68K_INS_FDBGL,\n\tM68K_INS_FDBGLE,\n\tM68K_INS_FDBNGLE,\n\tM68K_INS_FDBNGL,\n\tM68K_INS_FDBNLE,\n\tM68K_INS_FDBNLT,\n\tM68K_INS_FDBNGE,\n\tM68K_INS_FDBNGT,\n\tM68K_INS_FDBSNE,\n\tM68K_INS_FDBST,\n\tM68K_INS_FDIV,\n\tM68K_INS_FSDIV,\n\tM68K_INS_FDDIV,\n\tM68K_INS_FETOX,\n\tM68K_INS_FETOXM1,\n\tM68K_INS_FGETEXP,\n\tM68K_INS_FGETMAN,\n\tM68K_INS_FINT,\n\tM68K_INS_FINTRZ,\n\tM68K_INS_FLOG10,\n\tM68K_INS_FLOG2,\n\tM68K_INS_FLOGN,\n\tM68K_INS_FLOGNP1,\n\tM68K_INS_FMOD,\n\tM68K_INS_FMOVE,\n\tM68K_INS_FSMOVE,\n\tM68K_INS_FDMOVE,\n\tM68K_INS_FMOVECR,\n\tM68K_INS_FMOVEM,\n\tM68K_INS_FMUL,\n\tM68K_INS_FSMUL,\n\tM68K_INS_FDMUL,\n\tM68K_INS_FNEG,\n\tM68K_INS_FSNEG,\n\tM68K_INS_FDNEG,\n\tM68K_INS_FNOP,\n\tM68K_INS_FREM,\n\tM68K_INS_FRESTORE,\n\tM68K_INS_FSAVE,\n\tM68K_INS_FSCALE,\n\tM68K_INS_FSGLDIV,\n\tM68K_INS_FSGLMUL,\n\tM68K_INS_FSIN,\n\tM68K_INS_FSINCOS,\n\tM68K_INS_FSINH,\n\tM68K_INS_FSQRT,\n\tM68K_INS_FSSQRT,\n\tM68K_INS_FDSQRT,\n\tM68K_INS_FSF,\n\tM68K_INS_FSBEQ,\n\tM68K_INS_FSOGT,\n\tM68K_INS_FSOGE,\n\tM68K_INS_FSOLT,\n\tM68K_INS_FSOLE,\n\tM68K_INS_FSOGL,\n\tM68K_INS_FSOR,\n\tM68K_INS_FSUN,\n\tM68K_INS_FSUEQ,\n\tM68K_INS_FSUGT,\n\tM68K_INS_FSUGE,\n\tM68K_INS_FSULT,\n\tM68K_INS_FSULE,\n\tM68K_INS_FSNE,\n\tM68K_INS_FST,\n\tM68K_INS_FSSF,\n\tM68K_INS_FSSEQ,\n\tM68K_INS_FSGT,\n\tM68K_INS_FSGE,\n\tM68K_INS_FSLT,\n\tM68K_INS_FSLE,\n\tM68K_INS_FSGL,\n\tM68K_INS_FSGLE,\n\tM68K_INS_FSNGLE,\n\tM68K_INS_FSNGL,\n\tM68K_INS_FSNLE,\n\tM68K_INS_FSNLT,\n\tM68K_INS_FSNGE,\n\tM68K_INS_FSNGT,\n\tM68K_INS_FSSNE,\n\tM68K_INS_FSST,\n\tM68K_INS_FSUB,\n\tM68K_INS_FSSUB,\n\tM68K_INS_FDSUB,\n\tM68K_INS_FTAN,\n\tM68K_INS_FTANH,\n\tM68K_INS_FTENTOX,\n\tM68K_INS_FTRAPF,\n\tM68K_INS_FTRAPEQ,\n\tM68K_INS_FTRAPOGT,\n\tM68K_INS_FTRAPOGE,\n\tM68K_INS_FTRAPOLT,\n\tM68K_INS_FTRAPOLE,\n\tM68K_INS_FTRAPOGL,\n\tM68K_INS_FTRAPOR,\n\tM68K_INS_FTRAPUN,\n\tM68K_INS_FTRAPUEQ,\n\tM68K_INS_FTRAPUGT,\n\tM68K_INS_FTRAPUGE,\n\tM68K_INS_FTRAPULT,\n\tM68K_INS_FTRAPULE,\n\tM68K_INS_FTRAPNE,\n\tM68K_INS_FTRAPT,\n\tM68K_INS_FTRAPSF,\n\tM68K_INS_FTRAPSEQ,\n\tM68K_INS_FTRAPGT,\n\tM68K_INS_FTRAPGE,\n\tM68K_INS_FTRAPLT,\n\tM68K_INS_FTRAPLE,\n\tM68K_INS_FTRAPGL,\n\tM68K_INS_FTRAPGLE,\n\tM68K_INS_FTRAPNGLE,\n\tM68K_INS_FTRAPNGL,\n\tM68K_INS_FTRAPNLE,\n\tM68K_INS_FTRAPNLT,\n\tM68K_INS_FTRAPNGE,\n\tM68K_INS_FTRAPNGT,\n\tM68K_INS_FTRAPSNE,\n\tM68K_INS_FTRAPST,\n\tM68K_INS_FTST,\n\tM68K_INS_FTWOTOX,\n\tM68K_INS_HALT,\n\tM68K_INS_ILLEGAL,\n\tM68K_INS_JMP,\n\tM68K_INS_JSR,\n\tM68K_INS_LEA,\n\tM68K_INS_LINK,\n\tM68K_INS_LPSTOP,\n\tM68K_INS_LSL,\n\tM68K_INS_LSR,\n\tM68K_INS_MOVE,\n\tM68K_INS_MOVEA,\n\tM68K_INS_MOVEC,\n\tM68K_INS_MOVEM,\n\tM68K_INS_MOVEP,\n\tM68K_INS_MOVEQ,\n\tM68K_INS_MOVES,\n\tM68K_INS_MOVE16,\n\tM68K_INS_MULS,\n\tM68K_INS_MULU,\n\tM68K_INS_NBCD,\n\tM68K_INS_NEG,\n\tM68K_INS_NEGX,\n\tM68K_INS_NOP,\n\tM68K_INS_NOT,\n\tM68K_INS_OR,\n\tM68K_INS_ORI,\n\tM68K_INS_PACK,\n\tM68K_INS_PEA,\n\tM68K_INS_PFLUSH,\n\tM68K_INS_PFLUSHA,\n\tM68K_INS_PFLUSHAN,\n\tM68K_INS_PFLUSHN,\n\tM68K_INS_PLOADR,\n\tM68K_INS_PLOADW,\n\tM68K_INS_PLPAR,\n\tM68K_INS_PLPAW,\n\tM68K_INS_PMOVE,\n\tM68K_INS_PMOVEFD,\n\tM68K_INS_PTESTR,\n\tM68K_INS_PTESTW,\n\tM68K_INS_PULSE,\n\tM68K_INS_REMS,\n\tM68K_INS_REMU,\n\tM68K_INS_RESET,\n\tM68K_INS_ROL,\n\tM68K_INS_ROR,\n\tM68K_INS_ROXL,\n\tM68K_INS_ROXR,\n\tM68K_INS_RTD,\n\tM68K_INS_RTE,\n\tM68K_INS_RTM,\n\tM68K_INS_RTR,\n\tM68K_INS_RTS,\n\tM68K_INS_SBCD,\n\tM68K_INS_ST,\n\tM68K_INS_SF,\n\tM68K_INS_SHI,\n\tM68K_INS_SLS,\n\tM68K_INS_SCC,\n\tM68K_INS_SHS,\n\tM68K_INS_SCS,\n\tM68K_INS_SLO,\n\tM68K_INS_SNE,\n\tM68K_INS_SEQ,\n\tM68K_INS_SVC,\n\tM68K_INS_SVS,\n\tM68K_INS_SPL,\n\tM68K_INS_SMI,\n\tM68K_INS_SGE,\n\tM68K_INS_SLT,\n\tM68K_INS_SGT,\n\tM68K_INS_SLE,\n\tM68K_INS_STOP,\n\tM68K_INS_SUB,\n\tM68K_INS_SUBA,\n\tM68K_INS_SUBI,\n\tM68K_INS_SUBQ,\n\tM68K_INS_SUBX,\n\tM68K_INS_SWAP,\n\tM68K_INS_TAS,\n\tM68K_INS_TRAP,\n\tM68K_INS_TRAPV,\n\tM68K_INS_TRAPT,\n\tM68K_INS_TRAPF,\n\tM68K_INS_TRAPHI,\n\tM68K_INS_TRAPLS,\n\tM68K_INS_TRAPCC,\n\tM68K_INS_TRAPHS,\n\tM68K_INS_TRAPCS,\n\tM68K_INS_TRAPLO,\n\tM68K_INS_TRAPNE,\n\tM68K_INS_TRAPEQ,\n\tM68K_INS_TRAPVC,\n\tM68K_INS_TRAPVS,\n\tM68K_INS_TRAPPL,\n\tM68K_INS_TRAPMI,\n\tM68K_INS_TRAPGE,\n\tM68K_INS_TRAPLT,\n\tM68K_INS_TRAPGT,\n\tM68K_INS_TRAPLE,\n\tM68K_INS_TST,\n\tM68K_INS_UNLK,\n\tM68K_INS_UNPK,\n\tM68K_INS_ENDING,   // <-- mark the end of the list of instructions\n} m68k_insn;\n\n/// Group of M68K instructions\ntypedef enum m68k_group_type {\n\tM68K_GRP_INVALID = 0,  ///< CS_GRUP_INVALID\n\tM68K_GRP_JUMP,  ///< = CS_GRP_JUMP\n\tM68K_GRP_RET = 3,  ///< = CS_GRP_RET\n\tM68K_GRP_IRET = 5, ///< = CS_GRP_IRET\n\tM68K_GRP_BRANCH_RELATIVE = 7, ///< = CS_GRP_BRANCH_RELATIVE\n\n\tM68K_GRP_ENDING,// <-- mark the end of the list of groups\n} m68k_group_type;\n\n#ifdef __cplusplus\n}\n#endif\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/capstone/mips.h",
    "content": "#ifndef CAPSTONE_MIPS_H\n#define CAPSTONE_MIPS_H\n\n/* Capstone Disassembly Engine */\n/* By Nguyen Anh Quynh <aquynh@gmail.com>, 2013-2015 */\n\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\n#include \"platform.h\"\n\n// GCC MIPS toolchain has a default macro called \"mips\" which breaks\n// compilation\n#undef mips\n\n#ifdef _MSC_VER\n#pragma warning(disable:4201)\n#endif\n\n/// Operand type for instruction's operands\ntypedef enum mips_op_type {\n\tMIPS_OP_INVALID = 0, ///< = CS_OP_INVALID (Uninitialized).\n\tMIPS_OP_REG, ///< = CS_OP_REG (Register operand).\n\tMIPS_OP_IMM, ///< = CS_OP_IMM (Immediate operand).\n\tMIPS_OP_MEM, ///< = CS_OP_MEM (Memory operand).\n} mips_op_type;\n\n/// MIPS registers\ntypedef enum mips_reg {\n\tMIPS_REG_INVALID = 0,\n\t// General purpose registers\n\tMIPS_REG_PC,\n\n\tMIPS_REG_0,\n\tMIPS_REG_1,\n\tMIPS_REG_2,\n\tMIPS_REG_3,\n\tMIPS_REG_4,\n\tMIPS_REG_5,\n\tMIPS_REG_6,\n\tMIPS_REG_7,\n\tMIPS_REG_8,\n\tMIPS_REG_9,\n\tMIPS_REG_10,\n\tMIPS_REG_11,\n\tMIPS_REG_12,\n\tMIPS_REG_13,\n\tMIPS_REG_14,\n\tMIPS_REG_15,\n\tMIPS_REG_16,\n\tMIPS_REG_17,\n\tMIPS_REG_18,\n\tMIPS_REG_19,\n\tMIPS_REG_20,\n\tMIPS_REG_21,\n\tMIPS_REG_22,\n\tMIPS_REG_23,\n\tMIPS_REG_24,\n\tMIPS_REG_25,\n\tMIPS_REG_26,\n\tMIPS_REG_27,\n\tMIPS_REG_28,\n\tMIPS_REG_29,\n\tMIPS_REG_30,\n\tMIPS_REG_31,\n\n\t// DSP registers\n\tMIPS_REG_DSPCCOND,\n\tMIPS_REG_DSPCARRY,\n\tMIPS_REG_DSPEFI,\n\tMIPS_REG_DSPOUTFLAG,\n\tMIPS_REG_DSPOUTFLAG16_19,\n\tMIPS_REG_DSPOUTFLAG20,\n\tMIPS_REG_DSPOUTFLAG21,\n\tMIPS_REG_DSPOUTFLAG22,\n\tMIPS_REG_DSPOUTFLAG23,\n\tMIPS_REG_DSPPOS,\n\tMIPS_REG_DSPSCOUNT,\n\n\t// ACC registers\n\tMIPS_REG_AC0,\n\tMIPS_REG_AC1,\n\tMIPS_REG_AC2,\n\tMIPS_REG_AC3,\n\n\t// COP registers\n\tMIPS_REG_CC0,\n\tMIPS_REG_CC1,\n\tMIPS_REG_CC2,\n\tMIPS_REG_CC3,\n\tMIPS_REG_CC4,\n\tMIPS_REG_CC5,\n\tMIPS_REG_CC6,\n\tMIPS_REG_CC7,\n\n\t// FPU registers\n\tMIPS_REG_F0,\n\tMIPS_REG_F1,\n\tMIPS_REG_F2,\n\tMIPS_REG_F3,\n\tMIPS_REG_F4,\n\tMIPS_REG_F5,\n\tMIPS_REG_F6,\n\tMIPS_REG_F7,\n\tMIPS_REG_F8,\n\tMIPS_REG_F9,\n\tMIPS_REG_F10,\n\tMIPS_REG_F11,\n\tMIPS_REG_F12,\n\tMIPS_REG_F13,\n\tMIPS_REG_F14,\n\tMIPS_REG_F15,\n\tMIPS_REG_F16,\n\tMIPS_REG_F17,\n\tMIPS_REG_F18,\n\tMIPS_REG_F19,\n\tMIPS_REG_F20,\n\tMIPS_REG_F21,\n\tMIPS_REG_F22,\n\tMIPS_REG_F23,\n\tMIPS_REG_F24,\n\tMIPS_REG_F25,\n\tMIPS_REG_F26,\n\tMIPS_REG_F27,\n\tMIPS_REG_F28,\n\tMIPS_REG_F29,\n\tMIPS_REG_F30,\n\tMIPS_REG_F31,\n\n\tMIPS_REG_FCC0,\n\tMIPS_REG_FCC1,\n\tMIPS_REG_FCC2,\n\tMIPS_REG_FCC3,\n\tMIPS_REG_FCC4,\n\tMIPS_REG_FCC5,\n\tMIPS_REG_FCC6,\n\tMIPS_REG_FCC7,\n\n\t// AFPR128\n\tMIPS_REG_W0,\n\tMIPS_REG_W1,\n\tMIPS_REG_W2,\n\tMIPS_REG_W3,\n\tMIPS_REG_W4,\n\tMIPS_REG_W5,\n\tMIPS_REG_W6,\n\tMIPS_REG_W7,\n\tMIPS_REG_W8,\n\tMIPS_REG_W9,\n\tMIPS_REG_W10,\n\tMIPS_REG_W11,\n\tMIPS_REG_W12,\n\tMIPS_REG_W13,\n\tMIPS_REG_W14,\n\tMIPS_REG_W15,\n\tMIPS_REG_W16,\n\tMIPS_REG_W17,\n\tMIPS_REG_W18,\n\tMIPS_REG_W19,\n\tMIPS_REG_W20,\n\tMIPS_REG_W21,\n\tMIPS_REG_W22,\n\tMIPS_REG_W23,\n\tMIPS_REG_W24,\n\tMIPS_REG_W25,\n\tMIPS_REG_W26,\n\tMIPS_REG_W27,\n\tMIPS_REG_W28,\n\tMIPS_REG_W29,\n\tMIPS_REG_W30,\n\tMIPS_REG_W31,\n\n\tMIPS_REG_HI,\n\tMIPS_REG_LO,\n\n\tMIPS_REG_P0,\n\tMIPS_REG_P1,\n\tMIPS_REG_P2,\n\n\tMIPS_REG_MPL0,\n\tMIPS_REG_MPL1,\n\tMIPS_REG_MPL2,\n\n\tMIPS_REG_ENDING,\t// <-- mark the end of the list or registers\n\n\t// alias registers\n\tMIPS_REG_ZERO = MIPS_REG_0,\n\tMIPS_REG_AT = MIPS_REG_1,\n\tMIPS_REG_V0 = MIPS_REG_2,\n\tMIPS_REG_V1 = MIPS_REG_3,\n\tMIPS_REG_A0 = MIPS_REG_4,\n\tMIPS_REG_A1 = MIPS_REG_5,\n\tMIPS_REG_A2 = MIPS_REG_6,\n\tMIPS_REG_A3 = MIPS_REG_7,\n\tMIPS_REG_T0 = MIPS_REG_8,\n\tMIPS_REG_T1 = MIPS_REG_9,\n\tMIPS_REG_T2 = MIPS_REG_10,\n\tMIPS_REG_T3 = MIPS_REG_11,\n\tMIPS_REG_T4 = MIPS_REG_12,\n\tMIPS_REG_T5 = MIPS_REG_13,\n\tMIPS_REG_T6 = MIPS_REG_14,\n\tMIPS_REG_T7 = MIPS_REG_15,\n\tMIPS_REG_S0 = MIPS_REG_16,\n\tMIPS_REG_S1 = MIPS_REG_17,\n\tMIPS_REG_S2 = MIPS_REG_18,\n\tMIPS_REG_S3 = MIPS_REG_19,\n\tMIPS_REG_S4 = MIPS_REG_20,\n\tMIPS_REG_S5 = MIPS_REG_21,\n\tMIPS_REG_S6 = MIPS_REG_22,\n\tMIPS_REG_S7 = MIPS_REG_23,\n\tMIPS_REG_T8 = MIPS_REG_24,\n\tMIPS_REG_T9 = MIPS_REG_25,\n\tMIPS_REG_K0 = MIPS_REG_26,\n\tMIPS_REG_K1 = MIPS_REG_27,\n\tMIPS_REG_GP = MIPS_REG_28,\n\tMIPS_REG_SP = MIPS_REG_29,\n\tMIPS_REG_FP = MIPS_REG_30, MIPS_REG_S8 = MIPS_REG_30,\n\tMIPS_REG_RA = MIPS_REG_31,\n\n\tMIPS_REG_HI0 = MIPS_REG_AC0,\n\tMIPS_REG_HI1 = MIPS_REG_AC1,\n\tMIPS_REG_HI2 = MIPS_REG_AC2,\n\tMIPS_REG_HI3 = MIPS_REG_AC3,\n\n\tMIPS_REG_LO0 = MIPS_REG_HI0,\n\tMIPS_REG_LO1 = MIPS_REG_HI1,\n\tMIPS_REG_LO2 = MIPS_REG_HI2,\n\tMIPS_REG_LO3 = MIPS_REG_HI3,\n} mips_reg;\n\n/// Instruction's operand referring to memory\n/// This is associated with MIPS_OP_MEM operand type above\ntypedef struct mips_op_mem {\n\tmips_reg base;\t///< base register\n\tint64_t disp;\t///< displacement/offset value\n} mips_op_mem;\n\n/// Instruction operand\ntypedef struct cs_mips_op {\n\tmips_op_type type;\t///< operand type\n\tunion {\n\t\tmips_reg reg;\t\t///< register value for REG operand\n\t\tint64_t imm;\t\t///< immediate value for IMM operand\n\t\tmips_op_mem mem;\t///< base/index/scale/disp value for MEM operand\n\t};\n} cs_mips_op;\n\n/// Instruction structure\ntypedef struct cs_mips {\n\t/// Number of operands of this instruction,\n\t/// or 0 when instruction has no operand.\n\tuint8_t op_count;\n\tcs_mips_op operands[10]; ///< operands for this instruction.\n} cs_mips;\n\n/// MIPS instruction\ntypedef enum mips_insn {\n\tMIPS_INS_INVALID = 0,\n\n\tMIPS_INS_ABSQ_S,\n\tMIPS_INS_ADD,\n\tMIPS_INS_ADDIUPC,\n\tMIPS_INS_ADDIUR1SP,\n\tMIPS_INS_ADDIUR2,\n\tMIPS_INS_ADDIUS5,\n\tMIPS_INS_ADDIUSP,\n\tMIPS_INS_ADDQH,\n\tMIPS_INS_ADDQH_R,\n\tMIPS_INS_ADDQ,\n\tMIPS_INS_ADDQ_S,\n\tMIPS_INS_ADDSC,\n\tMIPS_INS_ADDS_A,\n\tMIPS_INS_ADDS_S,\n\tMIPS_INS_ADDS_U,\n\tMIPS_INS_ADDU16,\n\tMIPS_INS_ADDUH,\n\tMIPS_INS_ADDUH_R,\n\tMIPS_INS_ADDU,\n\tMIPS_INS_ADDU_S,\n\tMIPS_INS_ADDVI,\n\tMIPS_INS_ADDV,\n\tMIPS_INS_ADDWC,\n\tMIPS_INS_ADD_A,\n\tMIPS_INS_ADDI,\n\tMIPS_INS_ADDIU,\n\tMIPS_INS_ALIGN,\n\tMIPS_INS_ALUIPC,\n\tMIPS_INS_AND,\n\tMIPS_INS_AND16,\n\tMIPS_INS_ANDI16,\n\tMIPS_INS_ANDI,\n\tMIPS_INS_APPEND,\n\tMIPS_INS_ASUB_S,\n\tMIPS_INS_ASUB_U,\n\tMIPS_INS_AUI,\n\tMIPS_INS_AUIPC,\n\tMIPS_INS_AVER_S,\n\tMIPS_INS_AVER_U,\n\tMIPS_INS_AVE_S,\n\tMIPS_INS_AVE_U,\n\tMIPS_INS_B16,\n\tMIPS_INS_BADDU,\n\tMIPS_INS_BAL,\n\tMIPS_INS_BALC,\n\tMIPS_INS_BALIGN,\n\tMIPS_INS_BBIT0,\n\tMIPS_INS_BBIT032,\n\tMIPS_INS_BBIT1,\n\tMIPS_INS_BBIT132,\n\tMIPS_INS_BC,\n\tMIPS_INS_BC0F,\n\tMIPS_INS_BC0FL,\n\tMIPS_INS_BC0T,\n\tMIPS_INS_BC0TL,\n\tMIPS_INS_BC1EQZ,\n\tMIPS_INS_BC1F,\n\tMIPS_INS_BC1FL,\n\tMIPS_INS_BC1NEZ,\n\tMIPS_INS_BC1T,\n\tMIPS_INS_BC1TL,\n\tMIPS_INS_BC2EQZ,\n\tMIPS_INS_BC2F,\n\tMIPS_INS_BC2FL,\n\tMIPS_INS_BC2NEZ,\n\tMIPS_INS_BC2T,\n\tMIPS_INS_BC2TL,\n\tMIPS_INS_BC3F,\n\tMIPS_INS_BC3FL,\n\tMIPS_INS_BC3T,\n\tMIPS_INS_BC3TL,\n\tMIPS_INS_BCLRI,\n\tMIPS_INS_BCLR,\n\tMIPS_INS_BEQ,\n\tMIPS_INS_BEQC,\n\tMIPS_INS_BEQL,\n\tMIPS_INS_BEQZ16,\n\tMIPS_INS_BEQZALC,\n\tMIPS_INS_BEQZC,\n\tMIPS_INS_BGEC,\n\tMIPS_INS_BGEUC,\n\tMIPS_INS_BGEZ,\n\tMIPS_INS_BGEZAL,\n\tMIPS_INS_BGEZALC,\n\tMIPS_INS_BGEZALL,\n\tMIPS_INS_BGEZALS,\n\tMIPS_INS_BGEZC,\n\tMIPS_INS_BGEZL,\n\tMIPS_INS_BGTZ,\n\tMIPS_INS_BGTZALC,\n\tMIPS_INS_BGTZC,\n\tMIPS_INS_BGTZL,\n\tMIPS_INS_BINSLI,\n\tMIPS_INS_BINSL,\n\tMIPS_INS_BINSRI,\n\tMIPS_INS_BINSR,\n\tMIPS_INS_BITREV,\n\tMIPS_INS_BITSWAP,\n\tMIPS_INS_BLEZ,\n\tMIPS_INS_BLEZALC,\n\tMIPS_INS_BLEZC,\n\tMIPS_INS_BLEZL,\n\tMIPS_INS_BLTC,\n\tMIPS_INS_BLTUC,\n\tMIPS_INS_BLTZ,\n\tMIPS_INS_BLTZAL,\n\tMIPS_INS_BLTZALC,\n\tMIPS_INS_BLTZALL,\n\tMIPS_INS_BLTZALS,\n\tMIPS_INS_BLTZC,\n\tMIPS_INS_BLTZL,\n\tMIPS_INS_BMNZI,\n\tMIPS_INS_BMNZ,\n\tMIPS_INS_BMZI,\n\tMIPS_INS_BMZ,\n\tMIPS_INS_BNE,\n\tMIPS_INS_BNEC,\n\tMIPS_INS_BNEGI,\n\tMIPS_INS_BNEG,\n\tMIPS_INS_BNEL,\n\tMIPS_INS_BNEZ16,\n\tMIPS_INS_BNEZALC,\n\tMIPS_INS_BNEZC,\n\tMIPS_INS_BNVC,\n\tMIPS_INS_BNZ,\n\tMIPS_INS_BOVC,\n\tMIPS_INS_BPOSGE32,\n\tMIPS_INS_BREAK,\n\tMIPS_INS_BREAK16,\n\tMIPS_INS_BSELI,\n\tMIPS_INS_BSEL,\n\tMIPS_INS_BSETI,\n\tMIPS_INS_BSET,\n\tMIPS_INS_BZ,\n\tMIPS_INS_BEQZ,\n\tMIPS_INS_B,\n\tMIPS_INS_BNEZ,\n\tMIPS_INS_BTEQZ,\n\tMIPS_INS_BTNEZ,\n\tMIPS_INS_CACHE,\n\tMIPS_INS_CEIL,\n\tMIPS_INS_CEQI,\n\tMIPS_INS_CEQ,\n\tMIPS_INS_CFC1,\n\tMIPS_INS_CFCMSA,\n\tMIPS_INS_CINS,\n\tMIPS_INS_CINS32,\n\tMIPS_INS_CLASS,\n\tMIPS_INS_CLEI_S,\n\tMIPS_INS_CLEI_U,\n\tMIPS_INS_CLE_S,\n\tMIPS_INS_CLE_U,\n\tMIPS_INS_CLO,\n\tMIPS_INS_CLTI_S,\n\tMIPS_INS_CLTI_U,\n\tMIPS_INS_CLT_S,\n\tMIPS_INS_CLT_U,\n\tMIPS_INS_CLZ,\n\tMIPS_INS_CMPGDU,\n\tMIPS_INS_CMPGU,\n\tMIPS_INS_CMPU,\n\tMIPS_INS_CMP,\n\tMIPS_INS_COPY_S,\n\tMIPS_INS_COPY_U,\n\tMIPS_INS_CTC1,\n\tMIPS_INS_CTCMSA,\n\tMIPS_INS_CVT,\n\tMIPS_INS_C,\n\tMIPS_INS_CMPI,\n\tMIPS_INS_DADD,\n\tMIPS_INS_DADDI,\n\tMIPS_INS_DADDIU,\n\tMIPS_INS_DADDU,\n\tMIPS_INS_DAHI,\n\tMIPS_INS_DALIGN,\n\tMIPS_INS_DATI,\n\tMIPS_INS_DAUI,\n\tMIPS_INS_DBITSWAP,\n\tMIPS_INS_DCLO,\n\tMIPS_INS_DCLZ,\n\tMIPS_INS_DDIV,\n\tMIPS_INS_DDIVU,\n\tMIPS_INS_DERET,\n\tMIPS_INS_DEXT,\n\tMIPS_INS_DEXTM,\n\tMIPS_INS_DEXTU,\n\tMIPS_INS_DI,\n\tMIPS_INS_DINS,\n\tMIPS_INS_DINSM,\n\tMIPS_INS_DINSU,\n\tMIPS_INS_DIV,\n\tMIPS_INS_DIVU,\n\tMIPS_INS_DIV_S,\n\tMIPS_INS_DIV_U,\n\tMIPS_INS_DLSA,\n\tMIPS_INS_DMFC0,\n\tMIPS_INS_DMFC1,\n\tMIPS_INS_DMFC2,\n\tMIPS_INS_DMOD,\n\tMIPS_INS_DMODU,\n\tMIPS_INS_DMTC0,\n\tMIPS_INS_DMTC1,\n\tMIPS_INS_DMTC2,\n\tMIPS_INS_DMUH,\n\tMIPS_INS_DMUHU,\n\tMIPS_INS_DMUL,\n\tMIPS_INS_DMULT,\n\tMIPS_INS_DMULTU,\n\tMIPS_INS_DMULU,\n\tMIPS_INS_DOTP_S,\n\tMIPS_INS_DOTP_U,\n\tMIPS_INS_DPADD_S,\n\tMIPS_INS_DPADD_U,\n\tMIPS_INS_DPAQX_SA,\n\tMIPS_INS_DPAQX_S,\n\tMIPS_INS_DPAQ_SA,\n\tMIPS_INS_DPAQ_S,\n\tMIPS_INS_DPAU,\n\tMIPS_INS_DPAX,\n\tMIPS_INS_DPA,\n\tMIPS_INS_DPOP,\n\tMIPS_INS_DPSQX_SA,\n\tMIPS_INS_DPSQX_S,\n\tMIPS_INS_DPSQ_SA,\n\tMIPS_INS_DPSQ_S,\n\tMIPS_INS_DPSUB_S,\n\tMIPS_INS_DPSUB_U,\n\tMIPS_INS_DPSU,\n\tMIPS_INS_DPSX,\n\tMIPS_INS_DPS,\n\tMIPS_INS_DROTR,\n\tMIPS_INS_DROTR32,\n\tMIPS_INS_DROTRV,\n\tMIPS_INS_DSBH,\n\tMIPS_INS_DSHD,\n\tMIPS_INS_DSLL,\n\tMIPS_INS_DSLL32,\n\tMIPS_INS_DSLLV,\n\tMIPS_INS_DSRA,\n\tMIPS_INS_DSRA32,\n\tMIPS_INS_DSRAV,\n\tMIPS_INS_DSRL,\n\tMIPS_INS_DSRL32,\n\tMIPS_INS_DSRLV,\n\tMIPS_INS_DSUB,\n\tMIPS_INS_DSUBU,\n\tMIPS_INS_EHB,\n\tMIPS_INS_EI,\n\tMIPS_INS_ERET,\n\tMIPS_INS_EXT,\n\tMIPS_INS_EXTP,\n\tMIPS_INS_EXTPDP,\n\tMIPS_INS_EXTPDPV,\n\tMIPS_INS_EXTPV,\n\tMIPS_INS_EXTRV_RS,\n\tMIPS_INS_EXTRV_R,\n\tMIPS_INS_EXTRV_S,\n\tMIPS_INS_EXTRV,\n\tMIPS_INS_EXTR_RS,\n\tMIPS_INS_EXTR_R,\n\tMIPS_INS_EXTR_S,\n\tMIPS_INS_EXTR,\n\tMIPS_INS_EXTS,\n\tMIPS_INS_EXTS32,\n\tMIPS_INS_ABS,\n\tMIPS_INS_FADD,\n\tMIPS_INS_FCAF,\n\tMIPS_INS_FCEQ,\n\tMIPS_INS_FCLASS,\n\tMIPS_INS_FCLE,\n\tMIPS_INS_FCLT,\n\tMIPS_INS_FCNE,\n\tMIPS_INS_FCOR,\n\tMIPS_INS_FCUEQ,\n\tMIPS_INS_FCULE,\n\tMIPS_INS_FCULT,\n\tMIPS_INS_FCUNE,\n\tMIPS_INS_FCUN,\n\tMIPS_INS_FDIV,\n\tMIPS_INS_FEXDO,\n\tMIPS_INS_FEXP2,\n\tMIPS_INS_FEXUPL,\n\tMIPS_INS_FEXUPR,\n\tMIPS_INS_FFINT_S,\n\tMIPS_INS_FFINT_U,\n\tMIPS_INS_FFQL,\n\tMIPS_INS_FFQR,\n\tMIPS_INS_FILL,\n\tMIPS_INS_FLOG2,\n\tMIPS_INS_FLOOR,\n\tMIPS_INS_FMADD,\n\tMIPS_INS_FMAX_A,\n\tMIPS_INS_FMAX,\n\tMIPS_INS_FMIN_A,\n\tMIPS_INS_FMIN,\n\tMIPS_INS_MOV,\n\tMIPS_INS_FMSUB,\n\tMIPS_INS_FMUL,\n\tMIPS_INS_MUL,\n\tMIPS_INS_NEG,\n\tMIPS_INS_FRCP,\n\tMIPS_INS_FRINT,\n\tMIPS_INS_FRSQRT,\n\tMIPS_INS_FSAF,\n\tMIPS_INS_FSEQ,\n\tMIPS_INS_FSLE,\n\tMIPS_INS_FSLT,\n\tMIPS_INS_FSNE,\n\tMIPS_INS_FSOR,\n\tMIPS_INS_FSQRT,\n\tMIPS_INS_SQRT,\n\tMIPS_INS_FSUB,\n\tMIPS_INS_SUB,\n\tMIPS_INS_FSUEQ,\n\tMIPS_INS_FSULE,\n\tMIPS_INS_FSULT,\n\tMIPS_INS_FSUNE,\n\tMIPS_INS_FSUN,\n\tMIPS_INS_FTINT_S,\n\tMIPS_INS_FTINT_U,\n\tMIPS_INS_FTQ,\n\tMIPS_INS_FTRUNC_S,\n\tMIPS_INS_FTRUNC_U,\n\tMIPS_INS_HADD_S,\n\tMIPS_INS_HADD_U,\n\tMIPS_INS_HSUB_S,\n\tMIPS_INS_HSUB_U,\n\tMIPS_INS_ILVEV,\n\tMIPS_INS_ILVL,\n\tMIPS_INS_ILVOD,\n\tMIPS_INS_ILVR,\n\tMIPS_INS_INS,\n\tMIPS_INS_INSERT,\n\tMIPS_INS_INSV,\n\tMIPS_INS_INSVE,\n\tMIPS_INS_J,\n\tMIPS_INS_JAL,\n\tMIPS_INS_JALR,\n\tMIPS_INS_JALRS16,\n\tMIPS_INS_JALRS,\n\tMIPS_INS_JALS,\n\tMIPS_INS_JALX,\n\tMIPS_INS_JIALC,\n\tMIPS_INS_JIC,\n\tMIPS_INS_JR,\n\tMIPS_INS_JR16,\n\tMIPS_INS_JRADDIUSP,\n\tMIPS_INS_JRC,\n\tMIPS_INS_JALRC,\n\tMIPS_INS_LB,\n\tMIPS_INS_LBU16,\n\tMIPS_INS_LBUX,\n\tMIPS_INS_LBU,\n\tMIPS_INS_LD,\n\tMIPS_INS_LDC1,\n\tMIPS_INS_LDC2,\n\tMIPS_INS_LDC3,\n\tMIPS_INS_LDI,\n\tMIPS_INS_LDL,\n\tMIPS_INS_LDPC,\n\tMIPS_INS_LDR,\n\tMIPS_INS_LDXC1,\n\tMIPS_INS_LH,\n\tMIPS_INS_LHU16,\n\tMIPS_INS_LHX,\n\tMIPS_INS_LHU,\n\tMIPS_INS_LI16,\n\tMIPS_INS_LL,\n\tMIPS_INS_LLD,\n\tMIPS_INS_LSA,\n\tMIPS_INS_LUXC1,\n\tMIPS_INS_LUI,\n\tMIPS_INS_LW,\n\tMIPS_INS_LW16,\n\tMIPS_INS_LWC1,\n\tMIPS_INS_LWC2,\n\tMIPS_INS_LWC3,\n\tMIPS_INS_LWL,\n\tMIPS_INS_LWM16,\n\tMIPS_INS_LWM32,\n\tMIPS_INS_LWPC,\n\tMIPS_INS_LWP,\n\tMIPS_INS_LWR,\n\tMIPS_INS_LWUPC,\n\tMIPS_INS_LWU,\n\tMIPS_INS_LWX,\n\tMIPS_INS_LWXC1,\n\tMIPS_INS_LWXS,\n\tMIPS_INS_LI,\n\tMIPS_INS_MADD,\n\tMIPS_INS_MADDF,\n\tMIPS_INS_MADDR_Q,\n\tMIPS_INS_MADDU,\n\tMIPS_INS_MADDV,\n\tMIPS_INS_MADD_Q,\n\tMIPS_INS_MAQ_SA,\n\tMIPS_INS_MAQ_S,\n\tMIPS_INS_MAXA,\n\tMIPS_INS_MAXI_S,\n\tMIPS_INS_MAXI_U,\n\tMIPS_INS_MAX_A,\n\tMIPS_INS_MAX,\n\tMIPS_INS_MAX_S,\n\tMIPS_INS_MAX_U,\n\tMIPS_INS_MFC0,\n\tMIPS_INS_MFC1,\n\tMIPS_INS_MFC2,\n\tMIPS_INS_MFHC1,\n\tMIPS_INS_MFHI,\n\tMIPS_INS_MFLO,\n\tMIPS_INS_MINA,\n\tMIPS_INS_MINI_S,\n\tMIPS_INS_MINI_U,\n\tMIPS_INS_MIN_A,\n\tMIPS_INS_MIN,\n\tMIPS_INS_MIN_S,\n\tMIPS_INS_MIN_U,\n\tMIPS_INS_MOD,\n\tMIPS_INS_MODSUB,\n\tMIPS_INS_MODU,\n\tMIPS_INS_MOD_S,\n\tMIPS_INS_MOD_U,\n\tMIPS_INS_MOVE,\n\tMIPS_INS_MOVEP,\n\tMIPS_INS_MOVF,\n\tMIPS_INS_MOVN,\n\tMIPS_INS_MOVT,\n\tMIPS_INS_MOVZ,\n\tMIPS_INS_MSUB,\n\tMIPS_INS_MSUBF,\n\tMIPS_INS_MSUBR_Q,\n\tMIPS_INS_MSUBU,\n\tMIPS_INS_MSUBV,\n\tMIPS_INS_MSUB_Q,\n\tMIPS_INS_MTC0,\n\tMIPS_INS_MTC1,\n\tMIPS_INS_MTC2,\n\tMIPS_INS_MTHC1,\n\tMIPS_INS_MTHI,\n\tMIPS_INS_MTHLIP,\n\tMIPS_INS_MTLO,\n\tMIPS_INS_MTM0,\n\tMIPS_INS_MTM1,\n\tMIPS_INS_MTM2,\n\tMIPS_INS_MTP0,\n\tMIPS_INS_MTP1,\n\tMIPS_INS_MTP2,\n\tMIPS_INS_MUH,\n\tMIPS_INS_MUHU,\n\tMIPS_INS_MULEQ_S,\n\tMIPS_INS_MULEU_S,\n\tMIPS_INS_MULQ_RS,\n\tMIPS_INS_MULQ_S,\n\tMIPS_INS_MULR_Q,\n\tMIPS_INS_MULSAQ_S,\n\tMIPS_INS_MULSA,\n\tMIPS_INS_MULT,\n\tMIPS_INS_MULTU,\n\tMIPS_INS_MULU,\n\tMIPS_INS_MULV,\n\tMIPS_INS_MUL_Q,\n\tMIPS_INS_MUL_S,\n\tMIPS_INS_NLOC,\n\tMIPS_INS_NLZC,\n\tMIPS_INS_NMADD,\n\tMIPS_INS_NMSUB,\n\tMIPS_INS_NOR,\n\tMIPS_INS_NORI,\n\tMIPS_INS_NOT16,\n\tMIPS_INS_NOT,\n\tMIPS_INS_OR,\n\tMIPS_INS_OR16,\n\tMIPS_INS_ORI,\n\tMIPS_INS_PACKRL,\n\tMIPS_INS_PAUSE,\n\tMIPS_INS_PCKEV,\n\tMIPS_INS_PCKOD,\n\tMIPS_INS_PCNT,\n\tMIPS_INS_PICK,\n\tMIPS_INS_POP,\n\tMIPS_INS_PRECEQU,\n\tMIPS_INS_PRECEQ,\n\tMIPS_INS_PRECEU,\n\tMIPS_INS_PRECRQU_S,\n\tMIPS_INS_PRECRQ,\n\tMIPS_INS_PRECRQ_RS,\n\tMIPS_INS_PRECR,\n\tMIPS_INS_PRECR_SRA,\n\tMIPS_INS_PRECR_SRA_R,\n\tMIPS_INS_PREF,\n\tMIPS_INS_PREPEND,\n\tMIPS_INS_RADDU,\n\tMIPS_INS_RDDSP,\n\tMIPS_INS_RDHWR,\n\tMIPS_INS_REPLV,\n\tMIPS_INS_REPL,\n\tMIPS_INS_RINT,\n\tMIPS_INS_ROTR,\n\tMIPS_INS_ROTRV,\n\tMIPS_INS_ROUND,\n\tMIPS_INS_SAT_S,\n\tMIPS_INS_SAT_U,\n\tMIPS_INS_SB,\n\tMIPS_INS_SB16,\n\tMIPS_INS_SC,\n\tMIPS_INS_SCD,\n\tMIPS_INS_SD,\n\tMIPS_INS_SDBBP,\n\tMIPS_INS_SDBBP16,\n\tMIPS_INS_SDC1,\n\tMIPS_INS_SDC2,\n\tMIPS_INS_SDC3,\n\tMIPS_INS_SDL,\n\tMIPS_INS_SDR,\n\tMIPS_INS_SDXC1,\n\tMIPS_INS_SEB,\n\tMIPS_INS_SEH,\n\tMIPS_INS_SELEQZ,\n\tMIPS_INS_SELNEZ,\n\tMIPS_INS_SEL,\n\tMIPS_INS_SEQ,\n\tMIPS_INS_SEQI,\n\tMIPS_INS_SH,\n\tMIPS_INS_SH16,\n\tMIPS_INS_SHF,\n\tMIPS_INS_SHILO,\n\tMIPS_INS_SHILOV,\n\tMIPS_INS_SHLLV,\n\tMIPS_INS_SHLLV_S,\n\tMIPS_INS_SHLL,\n\tMIPS_INS_SHLL_S,\n\tMIPS_INS_SHRAV,\n\tMIPS_INS_SHRAV_R,\n\tMIPS_INS_SHRA,\n\tMIPS_INS_SHRA_R,\n\tMIPS_INS_SHRLV,\n\tMIPS_INS_SHRL,\n\tMIPS_INS_SLDI,\n\tMIPS_INS_SLD,\n\tMIPS_INS_SLL,\n\tMIPS_INS_SLL16,\n\tMIPS_INS_SLLI,\n\tMIPS_INS_SLLV,\n\tMIPS_INS_SLT,\n\tMIPS_INS_SLTI,\n\tMIPS_INS_SLTIU,\n\tMIPS_INS_SLTU,\n\tMIPS_INS_SNE,\n\tMIPS_INS_SNEI,\n\tMIPS_INS_SPLATI,\n\tMIPS_INS_SPLAT,\n\tMIPS_INS_SRA,\n\tMIPS_INS_SRAI,\n\tMIPS_INS_SRARI,\n\tMIPS_INS_SRAR,\n\tMIPS_INS_SRAV,\n\tMIPS_INS_SRL,\n\tMIPS_INS_SRL16,\n\tMIPS_INS_SRLI,\n\tMIPS_INS_SRLRI,\n\tMIPS_INS_SRLR,\n\tMIPS_INS_SRLV,\n\tMIPS_INS_SSNOP,\n\tMIPS_INS_ST,\n\tMIPS_INS_SUBQH,\n\tMIPS_INS_SUBQH_R,\n\tMIPS_INS_SUBQ,\n\tMIPS_INS_SUBQ_S,\n\tMIPS_INS_SUBSUS_U,\n\tMIPS_INS_SUBSUU_S,\n\tMIPS_INS_SUBS_S,\n\tMIPS_INS_SUBS_U,\n\tMIPS_INS_SUBU16,\n\tMIPS_INS_SUBUH,\n\tMIPS_INS_SUBUH_R,\n\tMIPS_INS_SUBU,\n\tMIPS_INS_SUBU_S,\n\tMIPS_INS_SUBVI,\n\tMIPS_INS_SUBV,\n\tMIPS_INS_SUXC1,\n\tMIPS_INS_SW,\n\tMIPS_INS_SW16,\n\tMIPS_INS_SWC1,\n\tMIPS_INS_SWC2,\n\tMIPS_INS_SWC3,\n\tMIPS_INS_SWL,\n\tMIPS_INS_SWM16,\n\tMIPS_INS_SWM32,\n\tMIPS_INS_SWP,\n\tMIPS_INS_SWR,\n\tMIPS_INS_SWXC1,\n\tMIPS_INS_SYNC,\n\tMIPS_INS_SYNCI,\n\tMIPS_INS_SYSCALL,\n\tMIPS_INS_TEQ,\n\tMIPS_INS_TEQI,\n\tMIPS_INS_TGE,\n\tMIPS_INS_TGEI,\n\tMIPS_INS_TGEIU,\n\tMIPS_INS_TGEU,\n\tMIPS_INS_TLBP,\n\tMIPS_INS_TLBR,\n\tMIPS_INS_TLBWI,\n\tMIPS_INS_TLBWR,\n\tMIPS_INS_TLT,\n\tMIPS_INS_TLTI,\n\tMIPS_INS_TLTIU,\n\tMIPS_INS_TLTU,\n\tMIPS_INS_TNE,\n\tMIPS_INS_TNEI,\n\tMIPS_INS_TRUNC,\n\tMIPS_INS_V3MULU,\n\tMIPS_INS_VMM0,\n\tMIPS_INS_VMULU,\n\tMIPS_INS_VSHF,\n\tMIPS_INS_WAIT,\n\tMIPS_INS_WRDSP,\n\tMIPS_INS_WSBH,\n\tMIPS_INS_XOR,\n\tMIPS_INS_XOR16,\n\tMIPS_INS_XORI,\n\n\t//> some alias instructions\n\tMIPS_INS_NOP,\n\tMIPS_INS_NEGU,\n\n\t//> special instructions\n\tMIPS_INS_JALR_HB,\t// jump and link with Hazard Barrier\n\tMIPS_INS_JR_HB,\t\t// jump register with Hazard Barrier\n\n\tMIPS_INS_ENDING,\n} mips_insn;\n\n/// Group of MIPS instructions\ntypedef enum mips_insn_group {\n\tMIPS_GRP_INVALID = 0, ///< = CS_GRP_INVALID\n\n\t// Generic groups\n\t// all jump instructions (conditional+direct+indirect jumps)\n\tMIPS_GRP_JUMP,\t///< = CS_GRP_JUMP\n\t// all call instructions\n\tMIPS_GRP_CALL,\t///< = CS_GRP_CALL\n\t// all return instructions\n\tMIPS_GRP_RET,\t///< = CS_GRP_RET\n\t// all interrupt instructions (int+syscall)\n\tMIPS_GRP_INT,\t///< = CS_GRP_INT\n\t// all interrupt return instructions\n\tMIPS_GRP_IRET,\t///< = CS_GRP_IRET\n\t// all privileged instructions\n\tMIPS_GRP_PRIVILEGE,\t///< = CS_GRP_PRIVILEGE\n\t// all relative branching instructions\n\tMIPS_GRP_BRANCH_RELATIVE, ///< = CS_GRP_BRANCH_RELATIVE\n\n\t// Architecture-specific groups\n\tMIPS_GRP_BITCOUNT = 128,\n\tMIPS_GRP_DSP,\n\tMIPS_GRP_DSPR2,\n\tMIPS_GRP_FPIDX,\n\tMIPS_GRP_MSA,\n\tMIPS_GRP_MIPS32R2,\n\tMIPS_GRP_MIPS64,\n\tMIPS_GRP_MIPS64R2,\n\tMIPS_GRP_SEINREG,\n\tMIPS_GRP_STDENC,\n\tMIPS_GRP_SWAP,\n\tMIPS_GRP_MICROMIPS,\n\tMIPS_GRP_MIPS16MODE,\n\tMIPS_GRP_FP64BIT,\n\tMIPS_GRP_NONANSFPMATH,\n\tMIPS_GRP_NOTFP64BIT,\n\tMIPS_GRP_NOTINMICROMIPS,\n\tMIPS_GRP_NOTNACL,\n\tMIPS_GRP_NOTMIPS32R6,\n\tMIPS_GRP_NOTMIPS64R6,\n\tMIPS_GRP_CNMIPS,\n\tMIPS_GRP_MIPS32,\n\tMIPS_GRP_MIPS32R6,\n\tMIPS_GRP_MIPS64R6,\n\tMIPS_GRP_MIPS2,\n\tMIPS_GRP_MIPS3,\n\tMIPS_GRP_MIPS3_32,\n\tMIPS_GRP_MIPS3_32R2,\n\tMIPS_GRP_MIPS4_32,\n\tMIPS_GRP_MIPS4_32R2,\n\tMIPS_GRP_MIPS5_32R2,\n\tMIPS_GRP_GP32BIT,\n\tMIPS_GRP_GP64BIT,\n\n\tMIPS_GRP_ENDING,\n} mips_insn_group;\n\n#ifdef __cplusplus\n}\n#endif\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/capstone/platform.h",
    "content": "/* Capstone Disassembly Engine */\n/* By Axel Souchet & Nguyen Anh Quynh, 2014 */\n\n#ifndef CAPSTONE_PLATFORM_H\n#define CAPSTONE_PLATFORM_H\n\n\n// handle C99 issue (for pre-2013 VisualStudio)\n#if !defined(__CYGWIN__) && !defined(__MINGW32__) && !defined(__MINGW64__) && (defined (WIN32) || defined (WIN64) || defined (_WIN32) || defined (_WIN64))\n// MSVC\n\n// stdbool.h\n#if (_MSC_VER < 1800) || defined(_KERNEL_MODE)\n// this system does not have stdbool.h\n#ifndef __cplusplus\ntypedef unsigned char bool;\n#define false 0\n#define true 1\n#endif  // __cplusplus\n\n#else\n// VisualStudio 2013+ -> C99 is supported\n#include <stdbool.h>\n#endif  // (_MSC_VER < 1800) || defined(_KERNEL_MODE)\n\n#else\n// not MSVC -> C99 is supported\n#include <stdbool.h>\n#endif  // !defined(__CYGWIN__) && !defined(__MINGW32__) && !defined(__MINGW64__) && (defined (WIN32) || defined (WIN64) || defined (_WIN32) || defined (_WIN64))\n\n\n// handle inttypes.h / stdint.h compatibility\n#if defined(_WIN32_WCE) && (_WIN32_WCE < 0x800)\n#include \"windowsce/stdint.h\"\n#endif  // defined(_WIN32_WCE) && (_WIN32_WCE < 0x800)\n\n#if defined(CAPSTONE_HAS_OSXKERNEL) || (defined(_MSC_VER) && (_MSC_VER <= 1700 || defined(_KERNEL_MODE)))\n// this system does not have inttypes.h\n\n#if defined(_MSC_VER) && (_MSC_VER <= 1600 || defined(_KERNEL_MODE))\n// this system does not have stdint.h\ntypedef signed char  int8_t;\ntypedef signed short int16_t;\ntypedef signed int   int32_t;\ntypedef unsigned char  uint8_t;\ntypedef unsigned short uint16_t;\ntypedef unsigned int   uint32_t;\ntypedef signed long long   int64_t;\ntypedef unsigned long long uint64_t;\n#endif  // defined(_MSC_VER) && (_MSC_VER <= 1600 || defined(_KERNEL_MODE))\n\n#if defined(_MSC_VER) && (_MSC_VER < 1600 || defined(_KERNEL_MODE))\n#define INT8_MIN         (-127i8 - 1)\n#define INT16_MIN        (-32767i16 - 1)\n#define INT32_MIN        (-2147483647i32 - 1)\n#define INT64_MIN        (-9223372036854775807i64 - 1)\n#define INT8_MAX         127i8\n#define INT16_MAX        32767i16\n#define INT32_MAX        2147483647i32\n#define INT64_MAX        9223372036854775807i64\n#define UINT8_MAX        0xffui8\n#define UINT16_MAX       0xffffui16\n#define UINT32_MAX       0xffffffffui32\n#define UINT64_MAX       0xffffffffffffffffui64\n#endif  // defined(_MSC_VER) && (_MSC_VER < 1600 || defined(_KERNEL_MODE))\n\n#ifdef CAPSTONE_HAS_OSXKERNEL\n// this system has stdint.h\n#include <stdint.h>\n#endif\n\n#define __PRI_8_LENGTH_MODIFIER__ \"hh\"\n#define __PRI_64_LENGTH_MODIFIER__ \"ll\"\n\n#define PRId8         __PRI_8_LENGTH_MODIFIER__ \"d\"\n#define PRIi8         __PRI_8_LENGTH_MODIFIER__ \"i\"\n#define PRIo8         __PRI_8_LENGTH_MODIFIER__ \"o\"\n#define PRIu8         __PRI_8_LENGTH_MODIFIER__ \"u\"\n#define PRIx8         __PRI_8_LENGTH_MODIFIER__ \"x\"\n#define PRIX8         __PRI_8_LENGTH_MODIFIER__ \"X\"\n\n#define PRId16        \"hd\"\n#define PRIi16        \"hi\"\n#define PRIo16        \"ho\"\n#define PRIu16        \"hu\"\n#define PRIx16        \"hx\"\n#define PRIX16        \"hX\"\n\n#if defined(_MSC_VER) && _MSC_VER <= 1700\n#define PRId32        \"ld\"\n#define PRIi32        \"li\"\n#define PRIo32        \"lo\"\n#define PRIu32        \"lu\"\n#define PRIx32        \"lx\"\n#define PRIX32        \"lX\"\n#else\t// OSX\n#define PRId32        \"d\"\n#define PRIi32        \"i\"\n#define PRIo32        \"o\"\n#define PRIu32        \"u\"\n#define PRIx32        \"x\"\n#define PRIX32        \"X\"\n#endif  // defined(_MSC_VER) && _MSC_VER <= 1700\n\n#if defined(_MSC_VER) && _MSC_VER <= 1700\n// redefine functions from inttypes.h used in cstool\n#define strtoull _strtoui64\n#endif\n\n#define PRId64        __PRI_64_LENGTH_MODIFIER__ \"d\"\n#define PRIi64        __PRI_64_LENGTH_MODIFIER__ \"i\"\n#define PRIo64        __PRI_64_LENGTH_MODIFIER__ \"o\"\n#define PRIu64        __PRI_64_LENGTH_MODIFIER__ \"u\"\n#define PRIx64        __PRI_64_LENGTH_MODIFIER__ \"x\"\n#define PRIX64        __PRI_64_LENGTH_MODIFIER__ \"X\"\n\n#else\n// this system has inttypes.h by default\n#include <inttypes.h>\n#endif  // defined(CAPSTONE_HAS_OSXKERNEL) || (defined(_MSC_VER) && (_MSC_VER <= 1700 || defined(_KERNEL_MODE)))\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/capstone/ppc.h",
    "content": "#ifndef CAPSTONE_PPC_H\n#define CAPSTONE_PPC_H\n\n/* Capstone Disassembly Engine */\n/* By Nguyen Anh Quynh <aquynh@gmail.com>, 2013-2015 */\n\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\n#include \"platform.h\"\n\n#ifdef _MSC_VER\n#pragma warning(disable:4201)\n#endif\n\n/// PPC branch codes for some branch instructions\ntypedef enum ppc_bc {\n\tPPC_BC_INVALID  = 0,\n\tPPC_BC_LT       = (0 << 5) | 12,\n\tPPC_BC_LE       = (1 << 5) |  4,\n\tPPC_BC_EQ       = (2 << 5) | 12,\n\tPPC_BC_GE       = (0 << 5) |  4,\n\tPPC_BC_GT       = (1 << 5) | 12,\n\tPPC_BC_NE       = (2 << 5) |  4,\n\tPPC_BC_UN       = (3 << 5) | 12,\n\tPPC_BC_NU       = (3 << 5) |  4,\n\n\t// extra conditions\n\tPPC_BC_SO = (4 << 5) | 12,\t///< summary overflow\n\tPPC_BC_NS = (4 << 5) | 4,\t///< not summary overflow\n} ppc_bc;\n\n/// PPC branch hint for some branch instructions\ntypedef enum ppc_bh {\n\tPPC_BH_INVALID = 0,\t///< no hint\n\tPPC_BH_PLUS,\t///< PLUS hint\n\tPPC_BH_MINUS,\t///< MINUS hint\n} ppc_bh;\n\n/// Operand type for instruction's operands\ntypedef enum ppc_op_type {\n\tPPC_OP_INVALID = 0, ///< = CS_OP_INVALID (Uninitialized).\n\tPPC_OP_REG, ///< = CS_OP_REG (Register operand).\n\tPPC_OP_IMM, ///< = CS_OP_IMM (Immediate operand).\n\tPPC_OP_MEM, ///< = CS_OP_MEM (Memory operand).\n\tPPC_OP_CRX = 64,\t///< Condition Register field\n} ppc_op_type;\n\n/// PPC registers\ntypedef enum ppc_reg {\n\tPPC_REG_INVALID = 0,\n\n\tPPC_REG_CARRY,\n\tPPC_REG_CR0,\n\tPPC_REG_CR1,\n\tPPC_REG_CR2,\n\tPPC_REG_CR3,\n\tPPC_REG_CR4,\n\tPPC_REG_CR5,\n\tPPC_REG_CR6,\n\tPPC_REG_CR7,\n\tPPC_REG_CTR,\n\tPPC_REG_F0,\n\tPPC_REG_F1,\n\tPPC_REG_F2,\n\tPPC_REG_F3,\n\tPPC_REG_F4,\n\tPPC_REG_F5,\n\tPPC_REG_F6,\n\tPPC_REG_F7,\n\tPPC_REG_F8,\n\tPPC_REG_F9,\n\tPPC_REG_F10,\n\tPPC_REG_F11,\n\tPPC_REG_F12,\n\tPPC_REG_F13,\n\tPPC_REG_F14,\n\tPPC_REG_F15,\n\tPPC_REG_F16,\n\tPPC_REG_F17,\n\tPPC_REG_F18,\n\tPPC_REG_F19,\n\tPPC_REG_F20,\n\tPPC_REG_F21,\n\tPPC_REG_F22,\n\tPPC_REG_F23,\n\tPPC_REG_F24,\n\tPPC_REG_F25,\n\tPPC_REG_F26,\n\tPPC_REG_F27,\n\tPPC_REG_F28,\n\tPPC_REG_F29,\n\tPPC_REG_F30,\n\tPPC_REG_F31,\n\tPPC_REG_LR,\n\tPPC_REG_R0,\n\tPPC_REG_R1,\n\tPPC_REG_R2,\n\tPPC_REG_R3,\n\tPPC_REG_R4,\n\tPPC_REG_R5,\n\tPPC_REG_R6,\n\tPPC_REG_R7,\n\tPPC_REG_R8,\n\tPPC_REG_R9,\n\tPPC_REG_R10,\n\tPPC_REG_R11,\n\tPPC_REG_R12,\n\tPPC_REG_R13,\n\tPPC_REG_R14,\n\tPPC_REG_R15,\n\tPPC_REG_R16,\n\tPPC_REG_R17,\n\tPPC_REG_R18,\n\tPPC_REG_R19,\n\tPPC_REG_R20,\n\tPPC_REG_R21,\n\tPPC_REG_R22,\n\tPPC_REG_R23,\n\tPPC_REG_R24,\n\tPPC_REG_R25,\n\tPPC_REG_R26,\n\tPPC_REG_R27,\n\tPPC_REG_R28,\n\tPPC_REG_R29,\n\tPPC_REG_R30,\n\tPPC_REG_R31,\n\tPPC_REG_V0,\n\tPPC_REG_V1,\n\tPPC_REG_V2,\n\tPPC_REG_V3,\n\tPPC_REG_V4,\n\tPPC_REG_V5,\n\tPPC_REG_V6,\n\tPPC_REG_V7,\n\tPPC_REG_V8,\n\tPPC_REG_V9,\n\tPPC_REG_V10,\n\tPPC_REG_V11,\n\tPPC_REG_V12,\n\tPPC_REG_V13,\n\tPPC_REG_V14,\n\tPPC_REG_V15,\n\tPPC_REG_V16,\n\tPPC_REG_V17,\n\tPPC_REG_V18,\n\tPPC_REG_V19,\n\tPPC_REG_V20,\n\tPPC_REG_V21,\n\tPPC_REG_V22,\n\tPPC_REG_V23,\n\tPPC_REG_V24,\n\tPPC_REG_V25,\n\tPPC_REG_V26,\n\tPPC_REG_V27,\n\tPPC_REG_V28,\n\tPPC_REG_V29,\n\tPPC_REG_V30,\n\tPPC_REG_V31,\n\tPPC_REG_VRSAVE,\n\tPPC_REG_VS0,\n\tPPC_REG_VS1,\n\tPPC_REG_VS2,\n\tPPC_REG_VS3,\n\tPPC_REG_VS4,\n\tPPC_REG_VS5,\n\tPPC_REG_VS6,\n\tPPC_REG_VS7,\n\tPPC_REG_VS8,\n\tPPC_REG_VS9,\n\tPPC_REG_VS10,\n\tPPC_REG_VS11,\n\tPPC_REG_VS12,\n\tPPC_REG_VS13,\n\tPPC_REG_VS14,\n\tPPC_REG_VS15,\n\tPPC_REG_VS16,\n\tPPC_REG_VS17,\n\tPPC_REG_VS18,\n\tPPC_REG_VS19,\n\tPPC_REG_VS20,\n\tPPC_REG_VS21,\n\tPPC_REG_VS22,\n\tPPC_REG_VS23,\n\tPPC_REG_VS24,\n\tPPC_REG_VS25,\n\tPPC_REG_VS26,\n\tPPC_REG_VS27,\n\tPPC_REG_VS28,\n\tPPC_REG_VS29,\n\tPPC_REG_VS30,\n\tPPC_REG_VS31,\n\tPPC_REG_VS32,\n\tPPC_REG_VS33,\n\tPPC_REG_VS34,\n\tPPC_REG_VS35,\n\tPPC_REG_VS36,\n\tPPC_REG_VS37,\n\tPPC_REG_VS38,\n\tPPC_REG_VS39,\n\tPPC_REG_VS40,\n\tPPC_REG_VS41,\n\tPPC_REG_VS42,\n\tPPC_REG_VS43,\n\tPPC_REG_VS44,\n\tPPC_REG_VS45,\n\tPPC_REG_VS46,\n\tPPC_REG_VS47,\n\tPPC_REG_VS48,\n\tPPC_REG_VS49,\n\tPPC_REG_VS50,\n\tPPC_REG_VS51,\n\tPPC_REG_VS52,\n\tPPC_REG_VS53,\n\tPPC_REG_VS54,\n\tPPC_REG_VS55,\n\tPPC_REG_VS56,\n\tPPC_REG_VS57,\n\tPPC_REG_VS58,\n\tPPC_REG_VS59,\n\tPPC_REG_VS60,\n\tPPC_REG_VS61,\n\tPPC_REG_VS62,\n\tPPC_REG_VS63,\n\tPPC_REG_Q0,\n\tPPC_REG_Q1,\n\tPPC_REG_Q2,\n\tPPC_REG_Q3,\n\tPPC_REG_Q4,\n\tPPC_REG_Q5,\n\tPPC_REG_Q6,\n\tPPC_REG_Q7,\n\tPPC_REG_Q8,\n\tPPC_REG_Q9,\n\tPPC_REG_Q10,\n\tPPC_REG_Q11,\n\tPPC_REG_Q12,\n\tPPC_REG_Q13,\n\tPPC_REG_Q14,\n\tPPC_REG_Q15,\n\tPPC_REG_Q16,\n\tPPC_REG_Q17,\n\tPPC_REG_Q18,\n\tPPC_REG_Q19,\n\tPPC_REG_Q20,\n\tPPC_REG_Q21,\n\tPPC_REG_Q22,\n\tPPC_REG_Q23,\n\tPPC_REG_Q24,\n\tPPC_REG_Q25,\n\tPPC_REG_Q26,\n\tPPC_REG_Q27,\n\tPPC_REG_Q28,\n\tPPC_REG_Q29,\n\tPPC_REG_Q30,\n\tPPC_REG_Q31,\n\n\t// extra registers for PPCMapping.c\n\tPPC_REG_RM,\n\tPPC_REG_CTR8,\n\tPPC_REG_LR8,\n\tPPC_REG_CR1EQ,\n\tPPC_REG_X2,\n\n\tPPC_REG_ENDING,   // <-- mark the end of the list of registers\n} ppc_reg;\n\n/// Instruction's operand referring to memory\n/// This is associated with PPC_OP_MEM operand type above\ntypedef struct ppc_op_mem {\n\tppc_reg base;\t///< base register\n\tint32_t disp;\t///< displacement/offset value\n} ppc_op_mem;\n\ntypedef struct ppc_op_crx {\n\tunsigned int scale;\n\tppc_reg reg;\n\tppc_bc cond;\n} ppc_op_crx;\n\n/// Instruction operand\ntypedef struct cs_ppc_op {\n\tppc_op_type type;\t///< operand type\n\tunion {\n\t\tppc_reg reg;\t///< register value for REG operand\n\t\tint64_t imm;\t\t///< immediate value for IMM operand\n\t\tppc_op_mem mem;\t\t///< base/disp value for MEM operand\n\t\tppc_op_crx crx;\t\t///< operand with condition register\n\t};\n} cs_ppc_op;\n\n/// Instruction structure\ntypedef struct cs_ppc {\n\t/// branch code for branch instructions\n\tppc_bc bc;\n\n\t/// branch hint for branch instructions\n\tppc_bh bh;\n\n\t/// if update_cr0 = True, then this 'dot' insn updates CR0\n\tbool update_cr0;\n\n\t/// Number of operands of this instruction,\n\t/// or 0 when instruction has no operand.\n\tuint8_t op_count;\n\tcs_ppc_op operands[8]; ///< operands for this instruction.\n} cs_ppc;\n\n/// PPC instruction\ntypedef enum ppc_insn {\n\tPPC_INS_INVALID = 0,\n\n\tPPC_INS_ADD,\n\tPPC_INS_ADDC,\n\tPPC_INS_ADDE,\n\tPPC_INS_ADDI,\n\tPPC_INS_ADDIC,\n\tPPC_INS_ADDIS,\n\tPPC_INS_ADDME,\n\tPPC_INS_ADDZE,\n\tPPC_INS_AND,\n\tPPC_INS_ANDC,\n\tPPC_INS_ANDIS,\n\tPPC_INS_ANDI,\n\tPPC_INS_ATTN,\n\tPPC_INS_B,\n\tPPC_INS_BA,\n\tPPC_INS_BC,\n\tPPC_INS_BCCTR,\n\tPPC_INS_BCCTRL,\n\tPPC_INS_BCL,\n\tPPC_INS_BCLR,\n\tPPC_INS_BCLRL,\n\tPPC_INS_BCTR,\n\tPPC_INS_BCTRL,\n\tPPC_INS_BCT,\n\tPPC_INS_BDNZ,\n\tPPC_INS_BDNZA,\n\tPPC_INS_BDNZL,\n\tPPC_INS_BDNZLA,\n\tPPC_INS_BDNZLR,\n\tPPC_INS_BDNZLRL,\n\tPPC_INS_BDZ,\n\tPPC_INS_BDZA,\n\tPPC_INS_BDZL,\n\tPPC_INS_BDZLA,\n\tPPC_INS_BDZLR,\n\tPPC_INS_BDZLRL,\n\tPPC_INS_BL,\n\tPPC_INS_BLA,\n\tPPC_INS_BLR,\n\tPPC_INS_BLRL,\n\tPPC_INS_BRINC,\n\tPPC_INS_CMPB,\n\tPPC_INS_CMPD,\n\tPPC_INS_CMPDI,\n\tPPC_INS_CMPLD,\n\tPPC_INS_CMPLDI,\n\tPPC_INS_CMPLW,\n\tPPC_INS_CMPLWI,\n\tPPC_INS_CMPW,\n\tPPC_INS_CMPWI,\n\tPPC_INS_CNTLZD,\n\tPPC_INS_CNTLZW,\n\tPPC_INS_CREQV,\n\tPPC_INS_CRXOR,\n\tPPC_INS_CRAND,\n\tPPC_INS_CRANDC,\n\tPPC_INS_CRNAND,\n\tPPC_INS_CRNOR,\n\tPPC_INS_CROR,\n\tPPC_INS_CRORC,\n\tPPC_INS_DCBA,\n\tPPC_INS_DCBF,\n\tPPC_INS_DCBI,\n\tPPC_INS_DCBST,\n\tPPC_INS_DCBT,\n\tPPC_INS_DCBTST,\n\tPPC_INS_DCBZ,\n\tPPC_INS_DCBZL,\n\tPPC_INS_DCCCI,\n\tPPC_INS_DIVD,\n\tPPC_INS_DIVDU,\n\tPPC_INS_DIVW,\n\tPPC_INS_DIVWU,\n\tPPC_INS_DSS,\n\tPPC_INS_DSSALL,\n\tPPC_INS_DST,\n\tPPC_INS_DSTST,\n\tPPC_INS_DSTSTT,\n\tPPC_INS_DSTT,\n\tPPC_INS_EQV,\n\tPPC_INS_EVABS,\n\tPPC_INS_EVADDIW,\n\tPPC_INS_EVADDSMIAAW,\n\tPPC_INS_EVADDSSIAAW,\n\tPPC_INS_EVADDUMIAAW,\n\tPPC_INS_EVADDUSIAAW,\n\tPPC_INS_EVADDW,\n\tPPC_INS_EVAND,\n\tPPC_INS_EVANDC,\n\tPPC_INS_EVCMPEQ,\n\tPPC_INS_EVCMPGTS,\n\tPPC_INS_EVCMPGTU,\n\tPPC_INS_EVCMPLTS,\n\tPPC_INS_EVCMPLTU,\n\tPPC_INS_EVCNTLSW,\n\tPPC_INS_EVCNTLZW,\n\tPPC_INS_EVDIVWS,\n\tPPC_INS_EVDIVWU,\n\tPPC_INS_EVEQV,\n\tPPC_INS_EVEXTSB,\n\tPPC_INS_EVEXTSH,\n\tPPC_INS_EVLDD,\n\tPPC_INS_EVLDDX,\n\tPPC_INS_EVLDH,\n\tPPC_INS_EVLDHX,\n\tPPC_INS_EVLDW,\n\tPPC_INS_EVLDWX,\n\tPPC_INS_EVLHHESPLAT,\n\tPPC_INS_EVLHHESPLATX,\n\tPPC_INS_EVLHHOSSPLAT,\n\tPPC_INS_EVLHHOSSPLATX,\n\tPPC_INS_EVLHHOUSPLAT,\n\tPPC_INS_EVLHHOUSPLATX,\n\tPPC_INS_EVLWHE,\n\tPPC_INS_EVLWHEX,\n\tPPC_INS_EVLWHOS,\n\tPPC_INS_EVLWHOSX,\n\tPPC_INS_EVLWHOU,\n\tPPC_INS_EVLWHOUX,\n\tPPC_INS_EVLWHSPLAT,\n\tPPC_INS_EVLWHSPLATX,\n\tPPC_INS_EVLWWSPLAT,\n\tPPC_INS_EVLWWSPLATX,\n\tPPC_INS_EVMERGEHI,\n\tPPC_INS_EVMERGEHILO,\n\tPPC_INS_EVMERGELO,\n\tPPC_INS_EVMERGELOHI,\n\tPPC_INS_EVMHEGSMFAA,\n\tPPC_INS_EVMHEGSMFAN,\n\tPPC_INS_EVMHEGSMIAA,\n\tPPC_INS_EVMHEGSMIAN,\n\tPPC_INS_EVMHEGUMIAA,\n\tPPC_INS_EVMHEGUMIAN,\n\tPPC_INS_EVMHESMF,\n\tPPC_INS_EVMHESMFA,\n\tPPC_INS_EVMHESMFAAW,\n\tPPC_INS_EVMHESMFANW,\n\tPPC_INS_EVMHESMI,\n\tPPC_INS_EVMHESMIA,\n\tPPC_INS_EVMHESMIAAW,\n\tPPC_INS_EVMHESMIANW,\n\tPPC_INS_EVMHESSF,\n\tPPC_INS_EVMHESSFA,\n\tPPC_INS_EVMHESSFAAW,\n\tPPC_INS_EVMHESSFANW,\n\tPPC_INS_EVMHESSIAAW,\n\tPPC_INS_EVMHESSIANW,\n\tPPC_INS_EVMHEUMI,\n\tPPC_INS_EVMHEUMIA,\n\tPPC_INS_EVMHEUMIAAW,\n\tPPC_INS_EVMHEUMIANW,\n\tPPC_INS_EVMHEUSIAAW,\n\tPPC_INS_EVMHEUSIANW,\n\tPPC_INS_EVMHOGSMFAA,\n\tPPC_INS_EVMHOGSMFAN,\n\tPPC_INS_EVMHOGSMIAA,\n\tPPC_INS_EVMHOGSMIAN,\n\tPPC_INS_EVMHOGUMIAA,\n\tPPC_INS_EVMHOGUMIAN,\n\tPPC_INS_EVMHOSMF,\n\tPPC_INS_EVMHOSMFA,\n\tPPC_INS_EVMHOSMFAAW,\n\tPPC_INS_EVMHOSMFANW,\n\tPPC_INS_EVMHOSMI,\n\tPPC_INS_EVMHOSMIA,\n\tPPC_INS_EVMHOSMIAAW,\n\tPPC_INS_EVMHOSMIANW,\n\tPPC_INS_EVMHOSSF,\n\tPPC_INS_EVMHOSSFA,\n\tPPC_INS_EVMHOSSFAAW,\n\tPPC_INS_EVMHOSSFANW,\n\tPPC_INS_EVMHOSSIAAW,\n\tPPC_INS_EVMHOSSIANW,\n\tPPC_INS_EVMHOUMI,\n\tPPC_INS_EVMHOUMIA,\n\tPPC_INS_EVMHOUMIAAW,\n\tPPC_INS_EVMHOUMIANW,\n\tPPC_INS_EVMHOUSIAAW,\n\tPPC_INS_EVMHOUSIANW,\n\tPPC_INS_EVMRA,\n\tPPC_INS_EVMWHSMF,\n\tPPC_INS_EVMWHSMFA,\n\tPPC_INS_EVMWHSMI,\n\tPPC_INS_EVMWHSMIA,\n\tPPC_INS_EVMWHSSF,\n\tPPC_INS_EVMWHSSFA,\n\tPPC_INS_EVMWHUMI,\n\tPPC_INS_EVMWHUMIA,\n\tPPC_INS_EVMWLSMIAAW,\n\tPPC_INS_EVMWLSMIANW,\n\tPPC_INS_EVMWLSSIAAW,\n\tPPC_INS_EVMWLSSIANW,\n\tPPC_INS_EVMWLUMI,\n\tPPC_INS_EVMWLUMIA,\n\tPPC_INS_EVMWLUMIAAW,\n\tPPC_INS_EVMWLUMIANW,\n\tPPC_INS_EVMWLUSIAAW,\n\tPPC_INS_EVMWLUSIANW,\n\tPPC_INS_EVMWSMF,\n\tPPC_INS_EVMWSMFA,\n\tPPC_INS_EVMWSMFAA,\n\tPPC_INS_EVMWSMFAN,\n\tPPC_INS_EVMWSMI,\n\tPPC_INS_EVMWSMIA,\n\tPPC_INS_EVMWSMIAA,\n\tPPC_INS_EVMWSMIAN,\n\tPPC_INS_EVMWSSF,\n\tPPC_INS_EVMWSSFA,\n\tPPC_INS_EVMWSSFAA,\n\tPPC_INS_EVMWSSFAN,\n\tPPC_INS_EVMWUMI,\n\tPPC_INS_EVMWUMIA,\n\tPPC_INS_EVMWUMIAA,\n\tPPC_INS_EVMWUMIAN,\n\tPPC_INS_EVNAND,\n\tPPC_INS_EVNEG,\n\tPPC_INS_EVNOR,\n\tPPC_INS_EVOR,\n\tPPC_INS_EVORC,\n\tPPC_INS_EVRLW,\n\tPPC_INS_EVRLWI,\n\tPPC_INS_EVRNDW,\n\tPPC_INS_EVSLW,\n\tPPC_INS_EVSLWI,\n\tPPC_INS_EVSPLATFI,\n\tPPC_INS_EVSPLATI,\n\tPPC_INS_EVSRWIS,\n\tPPC_INS_EVSRWIU,\n\tPPC_INS_EVSRWS,\n\tPPC_INS_EVSRWU,\n\tPPC_INS_EVSTDD,\n\tPPC_INS_EVSTDDX,\n\tPPC_INS_EVSTDH,\n\tPPC_INS_EVSTDHX,\n\tPPC_INS_EVSTDW,\n\tPPC_INS_EVSTDWX,\n\tPPC_INS_EVSTWHE,\n\tPPC_INS_EVSTWHEX,\n\tPPC_INS_EVSTWHO,\n\tPPC_INS_EVSTWHOX,\n\tPPC_INS_EVSTWWE,\n\tPPC_INS_EVSTWWEX,\n\tPPC_INS_EVSTWWO,\n\tPPC_INS_EVSTWWOX,\n\tPPC_INS_EVSUBFSMIAAW,\n\tPPC_INS_EVSUBFSSIAAW,\n\tPPC_INS_EVSUBFUMIAAW,\n\tPPC_INS_EVSUBFUSIAAW,\n\tPPC_INS_EVSUBFW,\n\tPPC_INS_EVSUBIFW,\n\tPPC_INS_EVXOR,\n\tPPC_INS_EXTSB,\n\tPPC_INS_EXTSH,\n\tPPC_INS_EXTSW,\n\tPPC_INS_EIEIO,\n\tPPC_INS_FABS,\n\tPPC_INS_FADD,\n\tPPC_INS_FADDS,\n\tPPC_INS_FCFID,\n\tPPC_INS_FCFIDS,\n\tPPC_INS_FCFIDU,\n\tPPC_INS_FCFIDUS,\n\tPPC_INS_FCMPU,\n\tPPC_INS_FCPSGN,\n\tPPC_INS_FCTID,\n\tPPC_INS_FCTIDUZ,\n\tPPC_INS_FCTIDZ,\n\tPPC_INS_FCTIW,\n\tPPC_INS_FCTIWUZ,\n\tPPC_INS_FCTIWZ,\n\tPPC_INS_FDIV,\n\tPPC_INS_FDIVS,\n\tPPC_INS_FMADD,\n\tPPC_INS_FMADDS,\n\tPPC_INS_FMR,\n\tPPC_INS_FMSUB,\n\tPPC_INS_FMSUBS,\n\tPPC_INS_FMUL,\n\tPPC_INS_FMULS,\n\tPPC_INS_FNABS,\n\tPPC_INS_FNEG,\n\tPPC_INS_FNMADD,\n\tPPC_INS_FNMADDS,\n\tPPC_INS_FNMSUB,\n\tPPC_INS_FNMSUBS,\n\tPPC_INS_FRE,\n\tPPC_INS_FRES,\n\tPPC_INS_FRIM,\n\tPPC_INS_FRIN,\n\tPPC_INS_FRIP,\n\tPPC_INS_FRIZ,\n\tPPC_INS_FRSP,\n\tPPC_INS_FRSQRTE,\n\tPPC_INS_FRSQRTES,\n\tPPC_INS_FSEL,\n\tPPC_INS_FSQRT,\n\tPPC_INS_FSQRTS,\n\tPPC_INS_FSUB,\n\tPPC_INS_FSUBS,\n\tPPC_INS_ICBI,\n\tPPC_INS_ICBT,\n\tPPC_INS_ICCCI,\n\tPPC_INS_ISEL,\n\tPPC_INS_ISYNC,\n\tPPC_INS_LA,\n\tPPC_INS_LBZ,\n\tPPC_INS_LBZCIX,\n\tPPC_INS_LBZU,\n\tPPC_INS_LBZUX,\n\tPPC_INS_LBZX,\n\tPPC_INS_LD,\n\tPPC_INS_LDARX,\n\tPPC_INS_LDBRX,\n\tPPC_INS_LDCIX,\n\tPPC_INS_LDU,\n\tPPC_INS_LDUX,\n\tPPC_INS_LDX,\n\tPPC_INS_LFD,\n\tPPC_INS_LFDU,\n\tPPC_INS_LFDUX,\n\tPPC_INS_LFDX,\n\tPPC_INS_LFIWAX,\n\tPPC_INS_LFIWZX,\n\tPPC_INS_LFS,\n\tPPC_INS_LFSU,\n\tPPC_INS_LFSUX,\n\tPPC_INS_LFSX,\n\tPPC_INS_LHA,\n\tPPC_INS_LHAU,\n\tPPC_INS_LHAUX,\n\tPPC_INS_LHAX,\n\tPPC_INS_LHBRX,\n\tPPC_INS_LHZ,\n\tPPC_INS_LHZCIX,\n\tPPC_INS_LHZU,\n\tPPC_INS_LHZUX,\n\tPPC_INS_LHZX,\n\tPPC_INS_LI,\n\tPPC_INS_LIS,\n\tPPC_INS_LMW,\n\tPPC_INS_LSWI,\n\tPPC_INS_LVEBX,\n\tPPC_INS_LVEHX,\n\tPPC_INS_LVEWX,\n\tPPC_INS_LVSL,\n\tPPC_INS_LVSR,\n\tPPC_INS_LVX,\n\tPPC_INS_LVXL,\n\tPPC_INS_LWA,\n\tPPC_INS_LWARX,\n\tPPC_INS_LWAUX,\n\tPPC_INS_LWAX,\n\tPPC_INS_LWBRX,\n\tPPC_INS_LWZ,\n\tPPC_INS_LWZCIX,\n\tPPC_INS_LWZU,\n\tPPC_INS_LWZUX,\n\tPPC_INS_LWZX,\n\tPPC_INS_LXSDX,\n\tPPC_INS_LXVD2X,\n\tPPC_INS_LXVDSX,\n\tPPC_INS_LXVW4X,\n\tPPC_INS_MBAR,\n\tPPC_INS_MCRF,\n\tPPC_INS_MCRFS,\n\tPPC_INS_MFCR,\n\tPPC_INS_MFCTR,\n\tPPC_INS_MFDCR,\n\tPPC_INS_MFFS,\n\tPPC_INS_MFLR,\n\tPPC_INS_MFMSR,\n\tPPC_INS_MFOCRF,\n\tPPC_INS_MFSPR,\n\tPPC_INS_MFSR,\n\tPPC_INS_MFSRIN,\n\tPPC_INS_MFTB,\n\tPPC_INS_MFVSCR,\n\tPPC_INS_MSYNC,\n\tPPC_INS_MTCRF,\n\tPPC_INS_MTCTR,\n\tPPC_INS_MTDCR,\n\tPPC_INS_MTFSB0,\n\tPPC_INS_MTFSB1,\n\tPPC_INS_MTFSF,\n\tPPC_INS_MTFSFI,\n\tPPC_INS_MTLR,\n\tPPC_INS_MTMSR,\n\tPPC_INS_MTMSRD,\n\tPPC_INS_MTOCRF,\n\tPPC_INS_MTSPR,\n\tPPC_INS_MTSR,\n\tPPC_INS_MTSRIN,\n\tPPC_INS_MTVSCR,\n\tPPC_INS_MULHD,\n\tPPC_INS_MULHDU,\n\tPPC_INS_MULHW,\n\tPPC_INS_MULHWU,\n\tPPC_INS_MULLD,\n\tPPC_INS_MULLI,\n\tPPC_INS_MULLW,\n\tPPC_INS_NAND,\n\tPPC_INS_NEG,\n\tPPC_INS_NOP,\n\tPPC_INS_ORI,\n\tPPC_INS_NOR,\n\tPPC_INS_OR,\n\tPPC_INS_ORC,\n\tPPC_INS_ORIS,\n\tPPC_INS_POPCNTD,\n\tPPC_INS_POPCNTW,\n\tPPC_INS_QVALIGNI,\n\tPPC_INS_QVESPLATI,\n\tPPC_INS_QVFABS,\n\tPPC_INS_QVFADD,\n\tPPC_INS_QVFADDS,\n\tPPC_INS_QVFCFID,\n\tPPC_INS_QVFCFIDS,\n\tPPC_INS_QVFCFIDU,\n\tPPC_INS_QVFCFIDUS,\n\tPPC_INS_QVFCMPEQ,\n\tPPC_INS_QVFCMPGT,\n\tPPC_INS_QVFCMPLT,\n\tPPC_INS_QVFCPSGN,\n\tPPC_INS_QVFCTID,\n\tPPC_INS_QVFCTIDU,\n\tPPC_INS_QVFCTIDUZ,\n\tPPC_INS_QVFCTIDZ,\n\tPPC_INS_QVFCTIW,\n\tPPC_INS_QVFCTIWU,\n\tPPC_INS_QVFCTIWUZ,\n\tPPC_INS_QVFCTIWZ,\n\tPPC_INS_QVFLOGICAL,\n\tPPC_INS_QVFMADD,\n\tPPC_INS_QVFMADDS,\n\tPPC_INS_QVFMR,\n\tPPC_INS_QVFMSUB,\n\tPPC_INS_QVFMSUBS,\n\tPPC_INS_QVFMUL,\n\tPPC_INS_QVFMULS,\n\tPPC_INS_QVFNABS,\n\tPPC_INS_QVFNEG,\n\tPPC_INS_QVFNMADD,\n\tPPC_INS_QVFNMADDS,\n\tPPC_INS_QVFNMSUB,\n\tPPC_INS_QVFNMSUBS,\n\tPPC_INS_QVFPERM,\n\tPPC_INS_QVFRE,\n\tPPC_INS_QVFRES,\n\tPPC_INS_QVFRIM,\n\tPPC_INS_QVFRIN,\n\tPPC_INS_QVFRIP,\n\tPPC_INS_QVFRIZ,\n\tPPC_INS_QVFRSP,\n\tPPC_INS_QVFRSQRTE,\n\tPPC_INS_QVFRSQRTES,\n\tPPC_INS_QVFSEL,\n\tPPC_INS_QVFSUB,\n\tPPC_INS_QVFSUBS,\n\tPPC_INS_QVFTSTNAN,\n\tPPC_INS_QVFXMADD,\n\tPPC_INS_QVFXMADDS,\n\tPPC_INS_QVFXMUL,\n\tPPC_INS_QVFXMULS,\n\tPPC_INS_QVFXXCPNMADD,\n\tPPC_INS_QVFXXCPNMADDS,\n\tPPC_INS_QVFXXMADD,\n\tPPC_INS_QVFXXMADDS,\n\tPPC_INS_QVFXXNPMADD,\n\tPPC_INS_QVFXXNPMADDS,\n\tPPC_INS_QVGPCI,\n\tPPC_INS_QVLFCDUX,\n\tPPC_INS_QVLFCDUXA,\n\tPPC_INS_QVLFCDX,\n\tPPC_INS_QVLFCDXA,\n\tPPC_INS_QVLFCSUX,\n\tPPC_INS_QVLFCSUXA,\n\tPPC_INS_QVLFCSX,\n\tPPC_INS_QVLFCSXA,\n\tPPC_INS_QVLFDUX,\n\tPPC_INS_QVLFDUXA,\n\tPPC_INS_QVLFDX,\n\tPPC_INS_QVLFDXA,\n\tPPC_INS_QVLFIWAX,\n\tPPC_INS_QVLFIWAXA,\n\tPPC_INS_QVLFIWZX,\n\tPPC_INS_QVLFIWZXA,\n\tPPC_INS_QVLFSUX,\n\tPPC_INS_QVLFSUXA,\n\tPPC_INS_QVLFSX,\n\tPPC_INS_QVLFSXA,\n\tPPC_INS_QVLPCLDX,\n\tPPC_INS_QVLPCLSX,\n\tPPC_INS_QVLPCRDX,\n\tPPC_INS_QVLPCRSX,\n\tPPC_INS_QVSTFCDUX,\n\tPPC_INS_QVSTFCDUXA,\n\tPPC_INS_QVSTFCDUXI,\n\tPPC_INS_QVSTFCDUXIA,\n\tPPC_INS_QVSTFCDX,\n\tPPC_INS_QVSTFCDXA,\n\tPPC_INS_QVSTFCDXI,\n\tPPC_INS_QVSTFCDXIA,\n\tPPC_INS_QVSTFCSUX,\n\tPPC_INS_QVSTFCSUXA,\n\tPPC_INS_QVSTFCSUXI,\n\tPPC_INS_QVSTFCSUXIA,\n\tPPC_INS_QVSTFCSX,\n\tPPC_INS_QVSTFCSXA,\n\tPPC_INS_QVSTFCSXI,\n\tPPC_INS_QVSTFCSXIA,\n\tPPC_INS_QVSTFDUX,\n\tPPC_INS_QVSTFDUXA,\n\tPPC_INS_QVSTFDUXI,\n\tPPC_INS_QVSTFDUXIA,\n\tPPC_INS_QVSTFDX,\n\tPPC_INS_QVSTFDXA,\n\tPPC_INS_QVSTFDXI,\n\tPPC_INS_QVSTFDXIA,\n\tPPC_INS_QVSTFIWX,\n\tPPC_INS_QVSTFIWXA,\n\tPPC_INS_QVSTFSUX,\n\tPPC_INS_QVSTFSUXA,\n\tPPC_INS_QVSTFSUXI,\n\tPPC_INS_QVSTFSUXIA,\n\tPPC_INS_QVSTFSX,\n\tPPC_INS_QVSTFSXA,\n\tPPC_INS_QVSTFSXI,\n\tPPC_INS_QVSTFSXIA,\n\tPPC_INS_RFCI,\n\tPPC_INS_RFDI,\n\tPPC_INS_RFI,\n\tPPC_INS_RFID,\n\tPPC_INS_RFMCI,\n\tPPC_INS_RLDCL,\n\tPPC_INS_RLDCR,\n\tPPC_INS_RLDIC,\n\tPPC_INS_RLDICL,\n\tPPC_INS_RLDICR,\n\tPPC_INS_RLDIMI,\n\tPPC_INS_RLWIMI,\n\tPPC_INS_RLWINM,\n\tPPC_INS_RLWNM,\n\tPPC_INS_SC,\n\tPPC_INS_SLBIA,\n\tPPC_INS_SLBIE,\n\tPPC_INS_SLBMFEE,\n\tPPC_INS_SLBMTE,\n\tPPC_INS_SLD,\n\tPPC_INS_SLW,\n\tPPC_INS_SRAD,\n\tPPC_INS_SRADI,\n\tPPC_INS_SRAW,\n\tPPC_INS_SRAWI,\n\tPPC_INS_SRD,\n\tPPC_INS_SRW,\n\tPPC_INS_STB,\n\tPPC_INS_STBCIX,\n\tPPC_INS_STBU,\n\tPPC_INS_STBUX,\n\tPPC_INS_STBX,\n\tPPC_INS_STD,\n\tPPC_INS_STDBRX,\n\tPPC_INS_STDCIX,\n\tPPC_INS_STDCX,\n\tPPC_INS_STDU,\n\tPPC_INS_STDUX,\n\tPPC_INS_STDX,\n\tPPC_INS_STFD,\n\tPPC_INS_STFDU,\n\tPPC_INS_STFDUX,\n\tPPC_INS_STFDX,\n\tPPC_INS_STFIWX,\n\tPPC_INS_STFS,\n\tPPC_INS_STFSU,\n\tPPC_INS_STFSUX,\n\tPPC_INS_STFSX,\n\tPPC_INS_STH,\n\tPPC_INS_STHBRX,\n\tPPC_INS_STHCIX,\n\tPPC_INS_STHU,\n\tPPC_INS_STHUX,\n\tPPC_INS_STHX,\n\tPPC_INS_STMW,\n\tPPC_INS_STSWI,\n\tPPC_INS_STVEBX,\n\tPPC_INS_STVEHX,\n\tPPC_INS_STVEWX,\n\tPPC_INS_STVX,\n\tPPC_INS_STVXL,\n\tPPC_INS_STW,\n\tPPC_INS_STWBRX,\n\tPPC_INS_STWCIX,\n\tPPC_INS_STWCX,\n\tPPC_INS_STWU,\n\tPPC_INS_STWUX,\n\tPPC_INS_STWX,\n\tPPC_INS_STXSDX,\n\tPPC_INS_STXVD2X,\n\tPPC_INS_STXVW4X,\n\tPPC_INS_SUBF,\n\tPPC_INS_SUBFC,\n\tPPC_INS_SUBFE,\n\tPPC_INS_SUBFIC,\n\tPPC_INS_SUBFME,\n\tPPC_INS_SUBFZE,\n\tPPC_INS_SYNC,\n\tPPC_INS_TD,\n\tPPC_INS_TDI,\n\tPPC_INS_TLBIA,\n\tPPC_INS_TLBIE,\n\tPPC_INS_TLBIEL,\n\tPPC_INS_TLBIVAX,\n\tPPC_INS_TLBLD,\n\tPPC_INS_TLBLI,\n\tPPC_INS_TLBRE,\n\tPPC_INS_TLBSX,\n\tPPC_INS_TLBSYNC,\n\tPPC_INS_TLBWE,\n\tPPC_INS_TRAP,\n\tPPC_INS_TW,\n\tPPC_INS_TWI,\n\tPPC_INS_VADDCUW,\n\tPPC_INS_VADDFP,\n\tPPC_INS_VADDSBS,\n\tPPC_INS_VADDSHS,\n\tPPC_INS_VADDSWS,\n\tPPC_INS_VADDUBM,\n\tPPC_INS_VADDUBS,\n\tPPC_INS_VADDUDM,\n\tPPC_INS_VADDUHM,\n\tPPC_INS_VADDUHS,\n\tPPC_INS_VADDUWM,\n\tPPC_INS_VADDUWS,\n\tPPC_INS_VAND,\n\tPPC_INS_VANDC,\n\tPPC_INS_VAVGSB,\n\tPPC_INS_VAVGSH,\n\tPPC_INS_VAVGSW,\n\tPPC_INS_VAVGUB,\n\tPPC_INS_VAVGUH,\n\tPPC_INS_VAVGUW,\n\tPPC_INS_VCFSX,\n\tPPC_INS_VCFUX,\n\tPPC_INS_VCLZB,\n\tPPC_INS_VCLZD,\n\tPPC_INS_VCLZH,\n\tPPC_INS_VCLZW,\n\tPPC_INS_VCMPBFP,\n\tPPC_INS_VCMPEQFP,\n\tPPC_INS_VCMPEQUB,\n\tPPC_INS_VCMPEQUD,\n\tPPC_INS_VCMPEQUH,\n\tPPC_INS_VCMPEQUW,\n\tPPC_INS_VCMPGEFP,\n\tPPC_INS_VCMPGTFP,\n\tPPC_INS_VCMPGTSB,\n\tPPC_INS_VCMPGTSD,\n\tPPC_INS_VCMPGTSH,\n\tPPC_INS_VCMPGTSW,\n\tPPC_INS_VCMPGTUB,\n\tPPC_INS_VCMPGTUD,\n\tPPC_INS_VCMPGTUH,\n\tPPC_INS_VCMPGTUW,\n\tPPC_INS_VCTSXS,\n\tPPC_INS_VCTUXS,\n\tPPC_INS_VEQV,\n\tPPC_INS_VEXPTEFP,\n\tPPC_INS_VLOGEFP,\n\tPPC_INS_VMADDFP,\n\tPPC_INS_VMAXFP,\n\tPPC_INS_VMAXSB,\n\tPPC_INS_VMAXSD,\n\tPPC_INS_VMAXSH,\n\tPPC_INS_VMAXSW,\n\tPPC_INS_VMAXUB,\n\tPPC_INS_VMAXUD,\n\tPPC_INS_VMAXUH,\n\tPPC_INS_VMAXUW,\n\tPPC_INS_VMHADDSHS,\n\tPPC_INS_VMHRADDSHS,\n\tPPC_INS_VMINUD,\n\tPPC_INS_VMINFP,\n\tPPC_INS_VMINSB,\n\tPPC_INS_VMINSD,\n\tPPC_INS_VMINSH,\n\tPPC_INS_VMINSW,\n\tPPC_INS_VMINUB,\n\tPPC_INS_VMINUH,\n\tPPC_INS_VMINUW,\n\tPPC_INS_VMLADDUHM,\n\tPPC_INS_VMRGHB,\n\tPPC_INS_VMRGHH,\n\tPPC_INS_VMRGHW,\n\tPPC_INS_VMRGLB,\n\tPPC_INS_VMRGLH,\n\tPPC_INS_VMRGLW,\n\tPPC_INS_VMSUMMBM,\n\tPPC_INS_VMSUMSHM,\n\tPPC_INS_VMSUMSHS,\n\tPPC_INS_VMSUMUBM,\n\tPPC_INS_VMSUMUHM,\n\tPPC_INS_VMSUMUHS,\n\tPPC_INS_VMULESB,\n\tPPC_INS_VMULESH,\n\tPPC_INS_VMULESW,\n\tPPC_INS_VMULEUB,\n\tPPC_INS_VMULEUH,\n\tPPC_INS_VMULEUW,\n\tPPC_INS_VMULOSB,\n\tPPC_INS_VMULOSH,\n\tPPC_INS_VMULOSW,\n\tPPC_INS_VMULOUB,\n\tPPC_INS_VMULOUH,\n\tPPC_INS_VMULOUW,\n\tPPC_INS_VMULUWM,\n\tPPC_INS_VNAND,\n\tPPC_INS_VNMSUBFP,\n\tPPC_INS_VNOR,\n\tPPC_INS_VOR,\n\tPPC_INS_VORC,\n\tPPC_INS_VPERM,\n\tPPC_INS_VPKPX,\n\tPPC_INS_VPKSHSS,\n\tPPC_INS_VPKSHUS,\n\tPPC_INS_VPKSWSS,\n\tPPC_INS_VPKSWUS,\n\tPPC_INS_VPKUHUM,\n\tPPC_INS_VPKUHUS,\n\tPPC_INS_VPKUWUM,\n\tPPC_INS_VPKUWUS,\n\tPPC_INS_VPOPCNTB,\n\tPPC_INS_VPOPCNTD,\n\tPPC_INS_VPOPCNTH,\n\tPPC_INS_VPOPCNTW,\n\tPPC_INS_VREFP,\n\tPPC_INS_VRFIM,\n\tPPC_INS_VRFIN,\n\tPPC_INS_VRFIP,\n\tPPC_INS_VRFIZ,\n\tPPC_INS_VRLB,\n\tPPC_INS_VRLD,\n\tPPC_INS_VRLH,\n\tPPC_INS_VRLW,\n\tPPC_INS_VRSQRTEFP,\n\tPPC_INS_VSEL,\n\tPPC_INS_VSL,\n\tPPC_INS_VSLB,\n\tPPC_INS_VSLD,\n\tPPC_INS_VSLDOI,\n\tPPC_INS_VSLH,\n\tPPC_INS_VSLO,\n\tPPC_INS_VSLW,\n\tPPC_INS_VSPLTB,\n\tPPC_INS_VSPLTH,\n\tPPC_INS_VSPLTISB,\n\tPPC_INS_VSPLTISH,\n\tPPC_INS_VSPLTISW,\n\tPPC_INS_VSPLTW,\n\tPPC_INS_VSR,\n\tPPC_INS_VSRAB,\n\tPPC_INS_VSRAD,\n\tPPC_INS_VSRAH,\n\tPPC_INS_VSRAW,\n\tPPC_INS_VSRB,\n\tPPC_INS_VSRD,\n\tPPC_INS_VSRH,\n\tPPC_INS_VSRO,\n\tPPC_INS_VSRW,\n\tPPC_INS_VSUBCUW,\n\tPPC_INS_VSUBFP,\n\tPPC_INS_VSUBSBS,\n\tPPC_INS_VSUBSHS,\n\tPPC_INS_VSUBSWS,\n\tPPC_INS_VSUBUBM,\n\tPPC_INS_VSUBUBS,\n\tPPC_INS_VSUBUDM,\n\tPPC_INS_VSUBUHM,\n\tPPC_INS_VSUBUHS,\n\tPPC_INS_VSUBUWM,\n\tPPC_INS_VSUBUWS,\n\tPPC_INS_VSUM2SWS,\n\tPPC_INS_VSUM4SBS,\n\tPPC_INS_VSUM4SHS,\n\tPPC_INS_VSUM4UBS,\n\tPPC_INS_VSUMSWS,\n\tPPC_INS_VUPKHPX,\n\tPPC_INS_VUPKHSB,\n\tPPC_INS_VUPKHSH,\n\tPPC_INS_VUPKLPX,\n\tPPC_INS_VUPKLSB,\n\tPPC_INS_VUPKLSH,\n\tPPC_INS_VXOR,\n\tPPC_INS_WAIT,\n\tPPC_INS_WRTEE,\n\tPPC_INS_WRTEEI,\n\tPPC_INS_XOR,\n\tPPC_INS_XORI,\n\tPPC_INS_XORIS,\n\tPPC_INS_XSABSDP,\n\tPPC_INS_XSADDDP,\n\tPPC_INS_XSCMPODP,\n\tPPC_INS_XSCMPUDP,\n\tPPC_INS_XSCPSGNDP,\n\tPPC_INS_XSCVDPSP,\n\tPPC_INS_XSCVDPSXDS,\n\tPPC_INS_XSCVDPSXWS,\n\tPPC_INS_XSCVDPUXDS,\n\tPPC_INS_XSCVDPUXWS,\n\tPPC_INS_XSCVSPDP,\n\tPPC_INS_XSCVSXDDP,\n\tPPC_INS_XSCVUXDDP,\n\tPPC_INS_XSDIVDP,\n\tPPC_INS_XSMADDADP,\n\tPPC_INS_XSMADDMDP,\n\tPPC_INS_XSMAXDP,\n\tPPC_INS_XSMINDP,\n\tPPC_INS_XSMSUBADP,\n\tPPC_INS_XSMSUBMDP,\n\tPPC_INS_XSMULDP,\n\tPPC_INS_XSNABSDP,\n\tPPC_INS_XSNEGDP,\n\tPPC_INS_XSNMADDADP,\n\tPPC_INS_XSNMADDMDP,\n\tPPC_INS_XSNMSUBADP,\n\tPPC_INS_XSNMSUBMDP,\n\tPPC_INS_XSRDPI,\n\tPPC_INS_XSRDPIC,\n\tPPC_INS_XSRDPIM,\n\tPPC_INS_XSRDPIP,\n\tPPC_INS_XSRDPIZ,\n\tPPC_INS_XSREDP,\n\tPPC_INS_XSRSQRTEDP,\n\tPPC_INS_XSSQRTDP,\n\tPPC_INS_XSSUBDP,\n\tPPC_INS_XSTDIVDP,\n\tPPC_INS_XSTSQRTDP,\n\tPPC_INS_XVABSDP,\n\tPPC_INS_XVABSSP,\n\tPPC_INS_XVADDDP,\n\tPPC_INS_XVADDSP,\n\tPPC_INS_XVCMPEQDP,\n\tPPC_INS_XVCMPEQSP,\n\tPPC_INS_XVCMPGEDP,\n\tPPC_INS_XVCMPGESP,\n\tPPC_INS_XVCMPGTDP,\n\tPPC_INS_XVCMPGTSP,\n\tPPC_INS_XVCPSGNDP,\n\tPPC_INS_XVCPSGNSP,\n\tPPC_INS_XVCVDPSP,\n\tPPC_INS_XVCVDPSXDS,\n\tPPC_INS_XVCVDPSXWS,\n\tPPC_INS_XVCVDPUXDS,\n\tPPC_INS_XVCVDPUXWS,\n\tPPC_INS_XVCVSPDP,\n\tPPC_INS_XVCVSPSXDS,\n\tPPC_INS_XVCVSPSXWS,\n\tPPC_INS_XVCVSPUXDS,\n\tPPC_INS_XVCVSPUXWS,\n\tPPC_INS_XVCVSXDDP,\n\tPPC_INS_XVCVSXDSP,\n\tPPC_INS_XVCVSXWDP,\n\tPPC_INS_XVCVSXWSP,\n\tPPC_INS_XVCVUXDDP,\n\tPPC_INS_XVCVUXDSP,\n\tPPC_INS_XVCVUXWDP,\n\tPPC_INS_XVCVUXWSP,\n\tPPC_INS_XVDIVDP,\n\tPPC_INS_XVDIVSP,\n\tPPC_INS_XVMADDADP,\n\tPPC_INS_XVMADDASP,\n\tPPC_INS_XVMADDMDP,\n\tPPC_INS_XVMADDMSP,\n\tPPC_INS_XVMAXDP,\n\tPPC_INS_XVMAXSP,\n\tPPC_INS_XVMINDP,\n\tPPC_INS_XVMINSP,\n\tPPC_INS_XVMSUBADP,\n\tPPC_INS_XVMSUBASP,\n\tPPC_INS_XVMSUBMDP,\n\tPPC_INS_XVMSUBMSP,\n\tPPC_INS_XVMULDP,\n\tPPC_INS_XVMULSP,\n\tPPC_INS_XVNABSDP,\n\tPPC_INS_XVNABSSP,\n\tPPC_INS_XVNEGDP,\n\tPPC_INS_XVNEGSP,\n\tPPC_INS_XVNMADDADP,\n\tPPC_INS_XVNMADDASP,\n\tPPC_INS_XVNMADDMDP,\n\tPPC_INS_XVNMADDMSP,\n\tPPC_INS_XVNMSUBADP,\n\tPPC_INS_XVNMSUBASP,\n\tPPC_INS_XVNMSUBMDP,\n\tPPC_INS_XVNMSUBMSP,\n\tPPC_INS_XVRDPI,\n\tPPC_INS_XVRDPIC,\n\tPPC_INS_XVRDPIM,\n\tPPC_INS_XVRDPIP,\n\tPPC_INS_XVRDPIZ,\n\tPPC_INS_XVREDP,\n\tPPC_INS_XVRESP,\n\tPPC_INS_XVRSPI,\n\tPPC_INS_XVRSPIC,\n\tPPC_INS_XVRSPIM,\n\tPPC_INS_XVRSPIP,\n\tPPC_INS_XVRSPIZ,\n\tPPC_INS_XVRSQRTEDP,\n\tPPC_INS_XVRSQRTESP,\n\tPPC_INS_XVSQRTDP,\n\tPPC_INS_XVSQRTSP,\n\tPPC_INS_XVSUBDP,\n\tPPC_INS_XVSUBSP,\n\tPPC_INS_XVTDIVDP,\n\tPPC_INS_XVTDIVSP,\n\tPPC_INS_XVTSQRTDP,\n\tPPC_INS_XVTSQRTSP,\n\tPPC_INS_XXLAND,\n\tPPC_INS_XXLANDC,\n\tPPC_INS_XXLEQV,\n\tPPC_INS_XXLNAND,\n\tPPC_INS_XXLNOR,\n\tPPC_INS_XXLOR,\n\tPPC_INS_XXLORC,\n\tPPC_INS_XXLXOR,\n\tPPC_INS_XXMRGHW,\n\tPPC_INS_XXMRGLW,\n\tPPC_INS_XXPERMDI,\n\tPPC_INS_XXSEL,\n\tPPC_INS_XXSLDWI,\n\tPPC_INS_XXSPLTW,\n\tPPC_INS_BCA,\n\tPPC_INS_BCLA,\n\n\t// extra & alias instructions\n\tPPC_INS_SLWI,\n\tPPC_INS_SRWI,\n\tPPC_INS_SLDI,\n\n\tPPC_INS_BTA,\n\tPPC_INS_CRSET,\n\tPPC_INS_CRNOT,\n\tPPC_INS_CRMOVE,\n\tPPC_INS_CRCLR,\n\tPPC_INS_MFBR0,\n\tPPC_INS_MFBR1,\n\tPPC_INS_MFBR2,\n\tPPC_INS_MFBR3,\n\tPPC_INS_MFBR4,\n\tPPC_INS_MFBR5,\n\tPPC_INS_MFBR6,\n\tPPC_INS_MFBR7,\n\tPPC_INS_MFXER,\n\tPPC_INS_MFRTCU,\n\tPPC_INS_MFRTCL,\n\tPPC_INS_MFDSCR,\n\tPPC_INS_MFDSISR,\n\tPPC_INS_MFDAR,\n\tPPC_INS_MFSRR2,\n\tPPC_INS_MFSRR3,\n\tPPC_INS_MFCFAR,\n\tPPC_INS_MFAMR,\n\tPPC_INS_MFPID,\n\tPPC_INS_MFTBLO,\n\tPPC_INS_MFTBHI,\n\tPPC_INS_MFDBATU,\n\tPPC_INS_MFDBATL,\n\tPPC_INS_MFIBATU,\n\tPPC_INS_MFIBATL,\n\tPPC_INS_MFDCCR,\n\tPPC_INS_MFICCR,\n\tPPC_INS_MFDEAR,\n\tPPC_INS_MFESR,\n\tPPC_INS_MFSPEFSCR,\n\tPPC_INS_MFTCR,\n\tPPC_INS_MFASR,\n\tPPC_INS_MFPVR,\n\tPPC_INS_MFTBU,\n\tPPC_INS_MTCR,\n\tPPC_INS_MTBR0,\n\tPPC_INS_MTBR1,\n\tPPC_INS_MTBR2,\n\tPPC_INS_MTBR3,\n\tPPC_INS_MTBR4,\n\tPPC_INS_MTBR5,\n\tPPC_INS_MTBR6,\n\tPPC_INS_MTBR7,\n\tPPC_INS_MTXER,\n\tPPC_INS_MTDSCR,\n\tPPC_INS_MTDSISR,\n\tPPC_INS_MTDAR,\n\tPPC_INS_MTSRR2,\n\tPPC_INS_MTSRR3,\n\tPPC_INS_MTCFAR,\n\tPPC_INS_MTAMR,\n\tPPC_INS_MTPID,\n\tPPC_INS_MTTBL,\n\tPPC_INS_MTTBU,\n\tPPC_INS_MTTBLO,\n\tPPC_INS_MTTBHI,\n\tPPC_INS_MTDBATU,\n\tPPC_INS_MTDBATL,\n\tPPC_INS_MTIBATU,\n\tPPC_INS_MTIBATL,\n\tPPC_INS_MTDCCR,\n\tPPC_INS_MTICCR,\n\tPPC_INS_MTDEAR,\n\tPPC_INS_MTESR,\n\tPPC_INS_MTSPEFSCR,\n\tPPC_INS_MTTCR,\n\tPPC_INS_NOT,\n\tPPC_INS_MR,\n\tPPC_INS_ROTLD,\n\tPPC_INS_ROTLDI,\n\tPPC_INS_CLRLDI,\n\tPPC_INS_ROTLWI,\n\tPPC_INS_CLRLWI,\n\tPPC_INS_ROTLW,\n\tPPC_INS_SUB,\n\tPPC_INS_SUBC,\n\tPPC_INS_LWSYNC,\n\tPPC_INS_PTESYNC,\n\tPPC_INS_TDLT,\n\tPPC_INS_TDEQ,\n\tPPC_INS_TDGT,\n\tPPC_INS_TDNE,\n\tPPC_INS_TDLLT,\n\tPPC_INS_TDLGT,\n\tPPC_INS_TDU,\n\tPPC_INS_TDLTI,\n\tPPC_INS_TDEQI,\n\tPPC_INS_TDGTI,\n\tPPC_INS_TDNEI,\n\tPPC_INS_TDLLTI,\n\tPPC_INS_TDLGTI,\n\tPPC_INS_TDUI,\n\tPPC_INS_TLBREHI,\n\tPPC_INS_TLBRELO,\n\tPPC_INS_TLBWEHI,\n\tPPC_INS_TLBWELO,\n\tPPC_INS_TWLT,\n\tPPC_INS_TWEQ,\n\tPPC_INS_TWGT,\n\tPPC_INS_TWNE,\n\tPPC_INS_TWLLT,\n\tPPC_INS_TWLGT,\n\tPPC_INS_TWU,\n\tPPC_INS_TWLTI,\n\tPPC_INS_TWEQI,\n\tPPC_INS_TWGTI,\n\tPPC_INS_TWNEI,\n\tPPC_INS_TWLLTI,\n\tPPC_INS_TWLGTI,\n\tPPC_INS_TWUI,\n\tPPC_INS_WAITRSV,\n\tPPC_INS_WAITIMPL,\n\tPPC_INS_XNOP,\n\tPPC_INS_XVMOVDP,\n\tPPC_INS_XVMOVSP,\n\tPPC_INS_XXSPLTD,\n\tPPC_INS_XXMRGHD,\n\tPPC_INS_XXMRGLD,\n\tPPC_INS_XXSWAPD,\n\tPPC_INS_BT,\n\tPPC_INS_BF,\n\tPPC_INS_BDNZT,\n\tPPC_INS_BDNZF,\n\tPPC_INS_BDZF,\n\tPPC_INS_BDZT,\n\tPPC_INS_BFA,\n\tPPC_INS_BDNZTA,\n\tPPC_INS_BDNZFA,\n\tPPC_INS_BDZTA,\n\tPPC_INS_BDZFA,\n\tPPC_INS_BTCTR,\n\tPPC_INS_BFCTR,\n\tPPC_INS_BTCTRL,\n\tPPC_INS_BFCTRL,\n\tPPC_INS_BTL,\n\tPPC_INS_BFL,\n\tPPC_INS_BDNZTL,\n\tPPC_INS_BDNZFL,\n\tPPC_INS_BDZTL,\n\tPPC_INS_BDZFL,\n\tPPC_INS_BTLA,\n\tPPC_INS_BFLA,\n\tPPC_INS_BDNZTLA,\n\tPPC_INS_BDNZFLA,\n\tPPC_INS_BDZTLA,\n\tPPC_INS_BDZFLA,\n\tPPC_INS_BTLR,\n\tPPC_INS_BFLR,\n\tPPC_INS_BDNZTLR,\n\tPPC_INS_BDZTLR,\n\tPPC_INS_BDZFLR,\n\tPPC_INS_BTLRL,\n\tPPC_INS_BFLRL,\n\tPPC_INS_BDNZTLRL,\n\tPPC_INS_BDNZFLRL,\n\tPPC_INS_BDZTLRL,\n\tPPC_INS_BDZFLRL,\n\n\t// QPX\n\tPPC_INS_QVFAND,\n\tPPC_INS_QVFCLR,\n\tPPC_INS_QVFANDC,\n\tPPC_INS_QVFCTFB,\n\tPPC_INS_QVFXOR,\n\tPPC_INS_QVFOR,\n\tPPC_INS_QVFNOR,\n\tPPC_INS_QVFEQU,\n\tPPC_INS_QVFNOT,\n\tPPC_INS_QVFORC,\n\tPPC_INS_QVFNAND,\n\tPPC_INS_QVFSET,\n\n\tPPC_INS_ENDING,   // <-- mark the end of the list of instructions\n} ppc_insn;\n\n/// Group of PPC instructions\ntypedef enum ppc_insn_group {\n\tPPC_GRP_INVALID = 0, ///< = CS_GRP_INVALID\n\n\t// Generic groups\n\t// all jump instructions (conditional+direct+indirect jumps)\n\tPPC_GRP_JUMP,\t///< = CS_GRP_JUMP\n\n\t// Architecture-specific groups\n\tPPC_GRP_ALTIVEC = 128,\n\tPPC_GRP_MODE32,\n\tPPC_GRP_MODE64,\n\tPPC_GRP_BOOKE,\n\tPPC_GRP_NOTBOOKE,\n\tPPC_GRP_SPE,\n\tPPC_GRP_VSX,\n\tPPC_GRP_E500,\n\tPPC_GRP_PPC4XX,\n\tPPC_GRP_PPC6XX,\n\tPPC_GRP_ICBT,\n\tPPC_GRP_P8ALTIVEC,\n\tPPC_GRP_P8VECTOR,\n\tPPC_GRP_QPX,\n\n\tPPC_GRP_ENDING,   // <-- mark the end of the list of groups\n} ppc_insn_group;\n\n#ifdef __cplusplus\n}\n#endif\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/capstone/sparc.h",
    "content": "#ifndef CAPSTONE_SPARC_H\n#define CAPSTONE_SPARC_H\n\n/* Capstone Disassembly Engine */\n/* By Nguyen Anh Quynh <aquynh@gmail.com>, 2014-2015 */\n\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\n#include \"platform.h\"\n\n// GCC SPARC toolchain has a default macro called \"sparc\" which breaks\n// compilation\n#undef sparc\n\n#ifdef _MSC_VER\n#pragma warning(disable:4201)\n#endif\n\n/// Enums corresponding to Sparc condition codes, both icc's and fcc's.\ntypedef enum sparc_cc {\n\tSPARC_CC_INVALID = 0,\t///< invalid CC (default)\n\t// Integer condition codes\n\tSPARC_CC_ICC_A   =  8+256,  ///< Always\n\tSPARC_CC_ICC_N   =  0+256,  ///< Never\n\tSPARC_CC_ICC_NE  =  9+256,  ///< Not Equal\n\tSPARC_CC_ICC_E   =  1+256,  ///< Equal\n\tSPARC_CC_ICC_G   = 10+256,  ///< Greater\n\tSPARC_CC_ICC_LE  =  2+256,  ///< Less or Equal\n\tSPARC_CC_ICC_GE  = 11+256,  ///< Greater or Equal\n\tSPARC_CC_ICC_L   =  3+256,  ///< Less\n\tSPARC_CC_ICC_GU  = 12+256,  ///< Greater Unsigned\n\tSPARC_CC_ICC_LEU =  4+256,  ///< Less or Equal Unsigned\n\tSPARC_CC_ICC_CC  = 13+256,  ///< Carry Clear/Great or Equal Unsigned\n\tSPARC_CC_ICC_CS  =  5+256,  ///< Carry Set/Less Unsigned\n\tSPARC_CC_ICC_POS = 14+256,  ///< Positive\n\tSPARC_CC_ICC_NEG =  6+256,  ///< Negative\n\tSPARC_CC_ICC_VC  = 15+256,  ///< Overflow Clear\n\tSPARC_CC_ICC_VS  =  7+256,  ///< Overflow Set\n\n\t// Floating condition codes\n\tSPARC_CC_FCC_A   =  8+16+256,  ///< Always\n\tSPARC_CC_FCC_N   =  0+16+256,  ///< Never\n\tSPARC_CC_FCC_U   =  7+16+256,  ///< Unordered\n\tSPARC_CC_FCC_G   =  6+16+256,  ///< Greater\n\tSPARC_CC_FCC_UG  =  5+16+256,  ///< Unordered or Greater\n\tSPARC_CC_FCC_L   =  4+16+256,  ///< Less\n\tSPARC_CC_FCC_UL  =  3+16+256,  ///< Unordered or Less\n\tSPARC_CC_FCC_LG  =  2+16+256,  ///< Less or Greater\n\tSPARC_CC_FCC_NE  =  1+16+256,  ///< Not Equal\n\tSPARC_CC_FCC_E   =  9+16+256,  ///< Equal\n\tSPARC_CC_FCC_UE  = 10+16+256,  ///< Unordered or Equal\n\tSPARC_CC_FCC_GE  = 11+16+256,  ///< Greater or Equal\n\tSPARC_CC_FCC_UGE = 12+16+256,  ///< Unordered or Greater or Equal\n\tSPARC_CC_FCC_LE  = 13+16+256,  ///< Less or Equal\n\tSPARC_CC_FCC_ULE = 14+16+256,  ///< Unordered or Less or Equal\n\tSPARC_CC_FCC_O   = 15+16+256,  ///< Ordered\n} sparc_cc;\n\n/// Branch hint\ntypedef enum sparc_hint {\n\tSPARC_HINT_INVALID = 0,\t///< no hint\n\tSPARC_HINT_A\t= 1 << 0,\t///< annul delay slot instruction\n\tSPARC_HINT_PT\t= 1 << 1,\t///< branch taken\n\tSPARC_HINT_PN\t= 1 << 2,\t///< branch NOT taken\n} sparc_hint;\n\n/// Operand type for instruction's operands\ntypedef enum sparc_op_type {\n\tSPARC_OP_INVALID = 0, ///< = CS_OP_INVALID (Uninitialized).\n\tSPARC_OP_REG, ///< = CS_OP_REG (Register operand).\n\tSPARC_OP_IMM, ///< = CS_OP_IMM (Immediate operand).\n\tSPARC_OP_MEM, ///< = CS_OP_MEM (Memory operand).\n} sparc_op_type;\n\n/// SPARC registers\ntypedef enum sparc_reg {\n\tSPARC_REG_INVALID = 0,\n\n\tSPARC_REG_F0,\n\tSPARC_REG_F1,\n\tSPARC_REG_F2,\n\tSPARC_REG_F3,\n\tSPARC_REG_F4,\n\tSPARC_REG_F5,\n\tSPARC_REG_F6,\n\tSPARC_REG_F7,\n\tSPARC_REG_F8,\n\tSPARC_REG_F9,\n\tSPARC_REG_F10,\n\tSPARC_REG_F11,\n\tSPARC_REG_F12,\n\tSPARC_REG_F13,\n\tSPARC_REG_F14,\n\tSPARC_REG_F15,\n\tSPARC_REG_F16,\n\tSPARC_REG_F17,\n\tSPARC_REG_F18,\n\tSPARC_REG_F19,\n\tSPARC_REG_F20,\n\tSPARC_REG_F21,\n\tSPARC_REG_F22,\n\tSPARC_REG_F23,\n\tSPARC_REG_F24,\n\tSPARC_REG_F25,\n\tSPARC_REG_F26,\n\tSPARC_REG_F27,\n\tSPARC_REG_F28,\n\tSPARC_REG_F29,\n\tSPARC_REG_F30,\n\tSPARC_REG_F31,\n\tSPARC_REG_F32,\n\tSPARC_REG_F34,\n\tSPARC_REG_F36,\n\tSPARC_REG_F38,\n\tSPARC_REG_F40,\n\tSPARC_REG_F42,\n\tSPARC_REG_F44,\n\tSPARC_REG_F46,\n\tSPARC_REG_F48,\n\tSPARC_REG_F50,\n\tSPARC_REG_F52,\n\tSPARC_REG_F54,\n\tSPARC_REG_F56,\n\tSPARC_REG_F58,\n\tSPARC_REG_F60,\n\tSPARC_REG_F62,\n\tSPARC_REG_FCC0,\t// Floating condition codes\n\tSPARC_REG_FCC1,\n\tSPARC_REG_FCC2,\n\tSPARC_REG_FCC3,\n\tSPARC_REG_FP,\n\tSPARC_REG_G0,\n\tSPARC_REG_G1,\n\tSPARC_REG_G2,\n\tSPARC_REG_G3,\n\tSPARC_REG_G4,\n\tSPARC_REG_G5,\n\tSPARC_REG_G6,\n\tSPARC_REG_G7,\n\tSPARC_REG_I0,\n\tSPARC_REG_I1,\n\tSPARC_REG_I2,\n\tSPARC_REG_I3,\n\tSPARC_REG_I4,\n\tSPARC_REG_I5,\n\tSPARC_REG_I7,\n\tSPARC_REG_ICC,\t// Integer condition codes\n\tSPARC_REG_L0,\n\tSPARC_REG_L1,\n\tSPARC_REG_L2,\n\tSPARC_REG_L3,\n\tSPARC_REG_L4,\n\tSPARC_REG_L5,\n\tSPARC_REG_L6,\n\tSPARC_REG_L7,\n\tSPARC_REG_O0,\n\tSPARC_REG_O1,\n\tSPARC_REG_O2,\n\tSPARC_REG_O3,\n\tSPARC_REG_O4,\n\tSPARC_REG_O5,\n\tSPARC_REG_O7,\n\tSPARC_REG_SP,\n\tSPARC_REG_Y,\n\n\t// special register\n\tSPARC_REG_XCC,\n\n\tSPARC_REG_ENDING,   // <-- mark the end of the list of registers\n\n\t// extras\n\tSPARC_REG_O6 = SPARC_REG_SP,\n\tSPARC_REG_I6 = SPARC_REG_FP,\n} sparc_reg;\n\n/// Instruction's operand referring to memory\n/// This is associated with SPARC_OP_MEM operand type above\ntypedef struct sparc_op_mem {\n\tuint8_t base;\t\t///< base register, can be safely interpreted as\n\t\t\t\t///< a value of type `sparc_reg`, but it is only\n\t\t\t\t///< one byte wide\n\tuint8_t index;\t\t///< index register, same conditions apply here\n\tint32_t disp;\t\t///< displacement/offset value\n} sparc_op_mem;\n\n/// Instruction operand\ntypedef struct cs_sparc_op {\n\tsparc_op_type type;\t///< operand type\n\tunion {\n\t\tsparc_reg reg;\t///< register value for REG operand\n\t\tint64_t imm;\t\t///< immediate value for IMM operand\n\t\tsparc_op_mem mem;\t\t///< base/disp value for MEM operand\n\t};\n} cs_sparc_op;\n\n/// Instruction structure\ntypedef struct cs_sparc {\n\tsparc_cc cc;\t///< code condition for this insn\n\tsparc_hint hint;\t///< branch hint: encoding as bitwise OR of sparc_hint.\n\t/// Number of operands of this instruction,\n\t/// or 0 when instruction has no operand.\n\tuint8_t op_count;\n\tcs_sparc_op operands[4]; ///< operands for this instruction.\n} cs_sparc;\n\n/// SPARC instruction\ntypedef enum sparc_insn {\n\tSPARC_INS_INVALID = 0,\n\n\tSPARC_INS_ADDCC,\n\tSPARC_INS_ADDX,\n\tSPARC_INS_ADDXCC,\n\tSPARC_INS_ADDXC,\n\tSPARC_INS_ADDXCCC,\n\tSPARC_INS_ADD,\n\tSPARC_INS_ALIGNADDR,\n\tSPARC_INS_ALIGNADDRL,\n\tSPARC_INS_ANDCC,\n\tSPARC_INS_ANDNCC,\n\tSPARC_INS_ANDN,\n\tSPARC_INS_AND,\n\tSPARC_INS_ARRAY16,\n\tSPARC_INS_ARRAY32,\n\tSPARC_INS_ARRAY8,\n\tSPARC_INS_B,\n\tSPARC_INS_JMP,\n\tSPARC_INS_BMASK,\n\tSPARC_INS_FB,\n\tSPARC_INS_BRGEZ,\n\tSPARC_INS_BRGZ,\n\tSPARC_INS_BRLEZ,\n\tSPARC_INS_BRLZ,\n\tSPARC_INS_BRNZ,\n\tSPARC_INS_BRZ,\n\tSPARC_INS_BSHUFFLE,\n\tSPARC_INS_CALL,\n\tSPARC_INS_CASX,\n\tSPARC_INS_CAS,\n\tSPARC_INS_CMASK16,\n\tSPARC_INS_CMASK32,\n\tSPARC_INS_CMASK8,\n\tSPARC_INS_CMP,\n\tSPARC_INS_EDGE16,\n\tSPARC_INS_EDGE16L,\n\tSPARC_INS_EDGE16LN,\n\tSPARC_INS_EDGE16N,\n\tSPARC_INS_EDGE32,\n\tSPARC_INS_EDGE32L,\n\tSPARC_INS_EDGE32LN,\n\tSPARC_INS_EDGE32N,\n\tSPARC_INS_EDGE8,\n\tSPARC_INS_EDGE8L,\n\tSPARC_INS_EDGE8LN,\n\tSPARC_INS_EDGE8N,\n\tSPARC_INS_FABSD,\n\tSPARC_INS_FABSQ,\n\tSPARC_INS_FABSS,\n\tSPARC_INS_FADDD,\n\tSPARC_INS_FADDQ,\n\tSPARC_INS_FADDS,\n\tSPARC_INS_FALIGNDATA,\n\tSPARC_INS_FAND,\n\tSPARC_INS_FANDNOT1,\n\tSPARC_INS_FANDNOT1S,\n\tSPARC_INS_FANDNOT2,\n\tSPARC_INS_FANDNOT2S,\n\tSPARC_INS_FANDS,\n\tSPARC_INS_FCHKSM16,\n\tSPARC_INS_FCMPD,\n\tSPARC_INS_FCMPEQ16,\n\tSPARC_INS_FCMPEQ32,\n\tSPARC_INS_FCMPGT16,\n\tSPARC_INS_FCMPGT32,\n\tSPARC_INS_FCMPLE16,\n\tSPARC_INS_FCMPLE32,\n\tSPARC_INS_FCMPNE16,\n\tSPARC_INS_FCMPNE32,\n\tSPARC_INS_FCMPQ,\n\tSPARC_INS_FCMPS,\n\tSPARC_INS_FDIVD,\n\tSPARC_INS_FDIVQ,\n\tSPARC_INS_FDIVS,\n\tSPARC_INS_FDMULQ,\n\tSPARC_INS_FDTOI,\n\tSPARC_INS_FDTOQ,\n\tSPARC_INS_FDTOS,\n\tSPARC_INS_FDTOX,\n\tSPARC_INS_FEXPAND,\n\tSPARC_INS_FHADDD,\n\tSPARC_INS_FHADDS,\n\tSPARC_INS_FHSUBD,\n\tSPARC_INS_FHSUBS,\n\tSPARC_INS_FITOD,\n\tSPARC_INS_FITOQ,\n\tSPARC_INS_FITOS,\n\tSPARC_INS_FLCMPD,\n\tSPARC_INS_FLCMPS,\n\tSPARC_INS_FLUSHW,\n\tSPARC_INS_FMEAN16,\n\tSPARC_INS_FMOVD,\n\tSPARC_INS_FMOVQ,\n\tSPARC_INS_FMOVRDGEZ,\n\tSPARC_INS_FMOVRQGEZ,\n\tSPARC_INS_FMOVRSGEZ,\n\tSPARC_INS_FMOVRDGZ,\n\tSPARC_INS_FMOVRQGZ,\n\tSPARC_INS_FMOVRSGZ,\n\tSPARC_INS_FMOVRDLEZ,\n\tSPARC_INS_FMOVRQLEZ,\n\tSPARC_INS_FMOVRSLEZ,\n\tSPARC_INS_FMOVRDLZ,\n\tSPARC_INS_FMOVRQLZ,\n\tSPARC_INS_FMOVRSLZ,\n\tSPARC_INS_FMOVRDNZ,\n\tSPARC_INS_FMOVRQNZ,\n\tSPARC_INS_FMOVRSNZ,\n\tSPARC_INS_FMOVRDZ,\n\tSPARC_INS_FMOVRQZ,\n\tSPARC_INS_FMOVRSZ,\n\tSPARC_INS_FMOVS,\n\tSPARC_INS_FMUL8SUX16,\n\tSPARC_INS_FMUL8ULX16,\n\tSPARC_INS_FMUL8X16,\n\tSPARC_INS_FMUL8X16AL,\n\tSPARC_INS_FMUL8X16AU,\n\tSPARC_INS_FMULD,\n\tSPARC_INS_FMULD8SUX16,\n\tSPARC_INS_FMULD8ULX16,\n\tSPARC_INS_FMULQ,\n\tSPARC_INS_FMULS,\n\tSPARC_INS_FNADDD,\n\tSPARC_INS_FNADDS,\n\tSPARC_INS_FNAND,\n\tSPARC_INS_FNANDS,\n\tSPARC_INS_FNEGD,\n\tSPARC_INS_FNEGQ,\n\tSPARC_INS_FNEGS,\n\tSPARC_INS_FNHADDD,\n\tSPARC_INS_FNHADDS,\n\tSPARC_INS_FNOR,\n\tSPARC_INS_FNORS,\n\tSPARC_INS_FNOT1,\n\tSPARC_INS_FNOT1S,\n\tSPARC_INS_FNOT2,\n\tSPARC_INS_FNOT2S,\n\tSPARC_INS_FONE,\n\tSPARC_INS_FONES,\n\tSPARC_INS_FOR,\n\tSPARC_INS_FORNOT1,\n\tSPARC_INS_FORNOT1S,\n\tSPARC_INS_FORNOT2,\n\tSPARC_INS_FORNOT2S,\n\tSPARC_INS_FORS,\n\tSPARC_INS_FPACK16,\n\tSPARC_INS_FPACK32,\n\tSPARC_INS_FPACKFIX,\n\tSPARC_INS_FPADD16,\n\tSPARC_INS_FPADD16S,\n\tSPARC_INS_FPADD32,\n\tSPARC_INS_FPADD32S,\n\tSPARC_INS_FPADD64,\n\tSPARC_INS_FPMERGE,\n\tSPARC_INS_FPSUB16,\n\tSPARC_INS_FPSUB16S,\n\tSPARC_INS_FPSUB32,\n\tSPARC_INS_FPSUB32S,\n\tSPARC_INS_FQTOD,\n\tSPARC_INS_FQTOI,\n\tSPARC_INS_FQTOS,\n\tSPARC_INS_FQTOX,\n\tSPARC_INS_FSLAS16,\n\tSPARC_INS_FSLAS32,\n\tSPARC_INS_FSLL16,\n\tSPARC_INS_FSLL32,\n\tSPARC_INS_FSMULD,\n\tSPARC_INS_FSQRTD,\n\tSPARC_INS_FSQRTQ,\n\tSPARC_INS_FSQRTS,\n\tSPARC_INS_FSRA16,\n\tSPARC_INS_FSRA32,\n\tSPARC_INS_FSRC1,\n\tSPARC_INS_FSRC1S,\n\tSPARC_INS_FSRC2,\n\tSPARC_INS_FSRC2S,\n\tSPARC_INS_FSRL16,\n\tSPARC_INS_FSRL32,\n\tSPARC_INS_FSTOD,\n\tSPARC_INS_FSTOI,\n\tSPARC_INS_FSTOQ,\n\tSPARC_INS_FSTOX,\n\tSPARC_INS_FSUBD,\n\tSPARC_INS_FSUBQ,\n\tSPARC_INS_FSUBS,\n\tSPARC_INS_FXNOR,\n\tSPARC_INS_FXNORS,\n\tSPARC_INS_FXOR,\n\tSPARC_INS_FXORS,\n\tSPARC_INS_FXTOD,\n\tSPARC_INS_FXTOQ,\n\tSPARC_INS_FXTOS,\n\tSPARC_INS_FZERO,\n\tSPARC_INS_FZEROS,\n\tSPARC_INS_JMPL,\n\tSPARC_INS_LDD,\n\tSPARC_INS_LD,\n\tSPARC_INS_LDQ,\n\tSPARC_INS_LDSB,\n\tSPARC_INS_LDSH,\n\tSPARC_INS_LDSW,\n\tSPARC_INS_LDUB,\n\tSPARC_INS_LDUH,\n\tSPARC_INS_LDX,\n\tSPARC_INS_LZCNT,\n\tSPARC_INS_MEMBAR,\n\tSPARC_INS_MOVDTOX,\n\tSPARC_INS_MOV,\n\tSPARC_INS_MOVRGEZ,\n\tSPARC_INS_MOVRGZ,\n\tSPARC_INS_MOVRLEZ,\n\tSPARC_INS_MOVRLZ,\n\tSPARC_INS_MOVRNZ,\n\tSPARC_INS_MOVRZ,\n\tSPARC_INS_MOVSTOSW,\n\tSPARC_INS_MOVSTOUW,\n\tSPARC_INS_MULX,\n\tSPARC_INS_NOP,\n\tSPARC_INS_ORCC,\n\tSPARC_INS_ORNCC,\n\tSPARC_INS_ORN,\n\tSPARC_INS_OR,\n\tSPARC_INS_PDIST,\n\tSPARC_INS_PDISTN,\n\tSPARC_INS_POPC,\n\tSPARC_INS_RD,\n\tSPARC_INS_RESTORE,\n\tSPARC_INS_RETT,\n\tSPARC_INS_SAVE,\n\tSPARC_INS_SDIVCC,\n\tSPARC_INS_SDIVX,\n\tSPARC_INS_SDIV,\n\tSPARC_INS_SETHI,\n\tSPARC_INS_SHUTDOWN,\n\tSPARC_INS_SIAM,\n\tSPARC_INS_SLLX,\n\tSPARC_INS_SLL,\n\tSPARC_INS_SMULCC,\n\tSPARC_INS_SMUL,\n\tSPARC_INS_SRAX,\n\tSPARC_INS_SRA,\n\tSPARC_INS_SRLX,\n\tSPARC_INS_SRL,\n\tSPARC_INS_STBAR,\n\tSPARC_INS_STB,\n\tSPARC_INS_STD,\n\tSPARC_INS_ST,\n\tSPARC_INS_STH,\n\tSPARC_INS_STQ,\n\tSPARC_INS_STX,\n\tSPARC_INS_SUBCC,\n\tSPARC_INS_SUBX,\n\tSPARC_INS_SUBXCC,\n\tSPARC_INS_SUB,\n\tSPARC_INS_SWAP,\n\tSPARC_INS_TADDCCTV,\n\tSPARC_INS_TADDCC,\n\tSPARC_INS_T,\n\tSPARC_INS_TSUBCCTV,\n\tSPARC_INS_TSUBCC,\n\tSPARC_INS_UDIVCC,\n\tSPARC_INS_UDIVX,\n\tSPARC_INS_UDIV,\n\tSPARC_INS_UMULCC,\n\tSPARC_INS_UMULXHI,\n\tSPARC_INS_UMUL,\n\tSPARC_INS_UNIMP,\n\tSPARC_INS_FCMPED,\n\tSPARC_INS_FCMPEQ,\n\tSPARC_INS_FCMPES,\n\tSPARC_INS_WR,\n\tSPARC_INS_XMULX,\n\tSPARC_INS_XMULXHI,\n\tSPARC_INS_XNORCC,\n\tSPARC_INS_XNOR,\n\tSPARC_INS_XORCC,\n\tSPARC_INS_XOR,\n\n\t// alias instructions\n\tSPARC_INS_RET,\n\tSPARC_INS_RETL,\n\n\tSPARC_INS_ENDING,   // <-- mark the end of the list of instructions\n} sparc_insn;\n\n/// Group of SPARC instructions\ntypedef enum sparc_insn_group {\n\tSPARC_GRP_INVALID = 0, ///< = CS_GRP_INVALID\n\n\t// Generic groups\n\t// all jump instructions (conditional+direct+indirect jumps)\n\tSPARC_GRP_JUMP,\t///< = CS_GRP_JUMP\n\n\t// Architecture-specific groups\n\tSPARC_GRP_HARDQUAD = 128,\n\tSPARC_GRP_V9,\n\tSPARC_GRP_VIS,\n\tSPARC_GRP_VIS2,\n\tSPARC_GRP_VIS3, \n\tSPARC_GRP_32BIT,\n\tSPARC_GRP_64BIT,\n\n\tSPARC_GRP_ENDING,   // <-- mark the end of the list of groups\n} sparc_insn_group;\n\n#ifdef __cplusplus\n}\n#endif\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/capstone/systemz.h",
    "content": "#ifndef CAPSTONE_SYSTEMZ_H\n#define CAPSTONE_SYSTEMZ_H\n\n/* Capstone Disassembly Engine */\n/* By Nguyen Anh Quynh <aquynh@gmail.com>, 2014-2015 */\n\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\n#include \"platform.h\"\n\n#ifdef _MSC_VER\n#pragma warning(disable:4201)\n#endif\n\n/// Enums corresponding to SystemZ condition codes\ntypedef enum sysz_cc {\n\tSYSZ_CC_INVALID = 0,\t///< invalid CC (default)\n\n\tSYSZ_CC_O,\n\tSYSZ_CC_H,\n\tSYSZ_CC_NLE,\n\tSYSZ_CC_L,\n\tSYSZ_CC_NHE,\n\tSYSZ_CC_LH,\n\tSYSZ_CC_NE,\n\tSYSZ_CC_E,\n\tSYSZ_CC_NLH,\n\tSYSZ_CC_HE,\n\tSYSZ_CC_NL,\n\tSYSZ_CC_LE,\n\tSYSZ_CC_NH,\n\tSYSZ_CC_NO,\n} sysz_cc;\n\n/// Operand type for instruction's operands\ntypedef enum sysz_op_type {\n\tSYSZ_OP_INVALID = 0, ///< = CS_OP_INVALID (Uninitialized).\n\tSYSZ_OP_REG, ///< = CS_OP_REG (Register operand).\n\tSYSZ_OP_IMM, ///< = CS_OP_IMM (Immediate operand).\n\tSYSZ_OP_MEM, ///< = CS_OP_MEM (Memory operand).\n\tSYSZ_OP_ACREG = 64,\t///< Access register operand.\n} sysz_op_type;\n\n/// SystemZ registers\ntypedef enum sysz_reg {\n\tSYSZ_REG_INVALID = 0,\n\n\tSYSZ_REG_0, \n\tSYSZ_REG_1, \n\tSYSZ_REG_2, \n\tSYSZ_REG_3, \n\tSYSZ_REG_4, \n\tSYSZ_REG_5, \n\tSYSZ_REG_6, \n\tSYSZ_REG_7, \n\tSYSZ_REG_8, \n\tSYSZ_REG_9, \n\tSYSZ_REG_10,\n\tSYSZ_REG_11,\n\tSYSZ_REG_12,\n\tSYSZ_REG_13,\n\tSYSZ_REG_14,\n\tSYSZ_REG_15,\n\tSYSZ_REG_CC,\n\tSYSZ_REG_F0,\n\tSYSZ_REG_F1,\n\tSYSZ_REG_F2,\n\tSYSZ_REG_F3,\n\tSYSZ_REG_F4,\n\tSYSZ_REG_F5,\n\tSYSZ_REG_F6,\n\tSYSZ_REG_F7,\n\tSYSZ_REG_F8,\n\tSYSZ_REG_F9,\n\tSYSZ_REG_F10,\n\tSYSZ_REG_F11,\n\tSYSZ_REG_F12,\n\tSYSZ_REG_F13,\n\tSYSZ_REG_F14,\n\tSYSZ_REG_F15,\n\n\tSYSZ_REG_R0L,\n\n\tSYSZ_REG_ENDING,\n} sysz_reg;\n\n/// Instruction's operand referring to memory\n/// This is associated with SYSZ_OP_MEM operand type above\ntypedef struct sysz_op_mem {\n\tuint8_t base;\t\t///< base register, can be safely interpreted as\n\t\t\t\t///< a value of type `sysz_reg`, but it is only\n\t\t\t\t///< one byte wide\n\tuint8_t index;\t\t///< index register, same conditions apply here\n\tuint64_t length;\t///< BDLAddr operand\n\tint64_t disp;\t///< displacement/offset value\n} sysz_op_mem;\n\n/// Instruction operand\ntypedef struct cs_sysz_op {\n\tsysz_op_type type;\t///< operand type\n\tunion {\n\t\tsysz_reg reg;\t\t///< register value for REG operand\n\t\tint64_t imm;\t\t///< immediate value for IMM operand\n\t\tsysz_op_mem mem;\t///< base/disp value for MEM operand\n\t};\n} cs_sysz_op;\n\n// Instruction structure\ntypedef struct cs_sysz {\n\tsysz_cc cc;\t\t///< Code condition\n\t/// Number of operands of this instruction,\n\t/// or 0 when instruction has no operand.\n\tuint8_t op_count;\n\tcs_sysz_op operands[6]; ///< operands for this instruction.\n} cs_sysz;\n\n/// SystemZ instruction\ntypedef enum sysz_insn {\n\tSYSZ_INS_INVALID = 0,\n\n\tSYSZ_INS_A,\n\tSYSZ_INS_ADB,\n\tSYSZ_INS_ADBR,\n\tSYSZ_INS_AEB,\n\tSYSZ_INS_AEBR,\n\tSYSZ_INS_AFI,\n\tSYSZ_INS_AG,\n\tSYSZ_INS_AGF,\n\tSYSZ_INS_AGFI,\n\tSYSZ_INS_AGFR,\n\tSYSZ_INS_AGHI,\n\tSYSZ_INS_AGHIK,\n\tSYSZ_INS_AGR,\n\tSYSZ_INS_AGRK,\n\tSYSZ_INS_AGSI,\n\tSYSZ_INS_AH,\n\tSYSZ_INS_AHI,\n\tSYSZ_INS_AHIK,\n\tSYSZ_INS_AHY,\n\tSYSZ_INS_AIH,\n\tSYSZ_INS_AL,\n\tSYSZ_INS_ALC,\n\tSYSZ_INS_ALCG,\n\tSYSZ_INS_ALCGR,\n\tSYSZ_INS_ALCR,\n\tSYSZ_INS_ALFI,\n\tSYSZ_INS_ALG,\n\tSYSZ_INS_ALGF,\n\tSYSZ_INS_ALGFI,\n\tSYSZ_INS_ALGFR,\n\tSYSZ_INS_ALGHSIK,\n\tSYSZ_INS_ALGR,\n\tSYSZ_INS_ALGRK,\n\tSYSZ_INS_ALHSIK,\n\tSYSZ_INS_ALR,\n\tSYSZ_INS_ALRK,\n\tSYSZ_INS_ALY,\n\tSYSZ_INS_AR,\n\tSYSZ_INS_ARK,\n\tSYSZ_INS_ASI,\n\tSYSZ_INS_AXBR,\n\tSYSZ_INS_AY,\n\tSYSZ_INS_BCR,\n\tSYSZ_INS_BRC,\n\tSYSZ_INS_BRCL,\n\tSYSZ_INS_CGIJ,\n\tSYSZ_INS_CGRJ,\n\tSYSZ_INS_CIJ,\n\tSYSZ_INS_CLGIJ,\n\tSYSZ_INS_CLGRJ,\n\tSYSZ_INS_CLIJ,\n\tSYSZ_INS_CLRJ,\n\tSYSZ_INS_CRJ,\n\tSYSZ_INS_BER,\n\tSYSZ_INS_JE,\n\tSYSZ_INS_JGE,\n\tSYSZ_INS_LOCE,\n\tSYSZ_INS_LOCGE,\n\tSYSZ_INS_LOCGRE,\n\tSYSZ_INS_LOCRE,\n\tSYSZ_INS_STOCE,\n\tSYSZ_INS_STOCGE,\n\tSYSZ_INS_BHR,\n\tSYSZ_INS_BHER,\n\tSYSZ_INS_JHE,\n\tSYSZ_INS_JGHE,\n\tSYSZ_INS_LOCHE,\n\tSYSZ_INS_LOCGHE,\n\tSYSZ_INS_LOCGRHE,\n\tSYSZ_INS_LOCRHE,\n\tSYSZ_INS_STOCHE,\n\tSYSZ_INS_STOCGHE,\n\tSYSZ_INS_JH,\n\tSYSZ_INS_JGH,\n\tSYSZ_INS_LOCH,\n\tSYSZ_INS_LOCGH,\n\tSYSZ_INS_LOCGRH,\n\tSYSZ_INS_LOCRH,\n\tSYSZ_INS_STOCH,\n\tSYSZ_INS_STOCGH,\n\tSYSZ_INS_CGIJNLH,\n\tSYSZ_INS_CGRJNLH,\n\tSYSZ_INS_CIJNLH,\n\tSYSZ_INS_CLGIJNLH,\n\tSYSZ_INS_CLGRJNLH,\n\tSYSZ_INS_CLIJNLH,\n\tSYSZ_INS_CLRJNLH,\n\tSYSZ_INS_CRJNLH,\n\tSYSZ_INS_CGIJE,\n\tSYSZ_INS_CGRJE,\n\tSYSZ_INS_CIJE,\n\tSYSZ_INS_CLGIJE,\n\tSYSZ_INS_CLGRJE,\n\tSYSZ_INS_CLIJE,\n\tSYSZ_INS_CLRJE,\n\tSYSZ_INS_CRJE,\n\tSYSZ_INS_CGIJNLE,\n\tSYSZ_INS_CGRJNLE,\n\tSYSZ_INS_CIJNLE,\n\tSYSZ_INS_CLGIJNLE,\n\tSYSZ_INS_CLGRJNLE,\n\tSYSZ_INS_CLIJNLE,\n\tSYSZ_INS_CLRJNLE,\n\tSYSZ_INS_CRJNLE,\n\tSYSZ_INS_CGIJH,\n\tSYSZ_INS_CGRJH,\n\tSYSZ_INS_CIJH,\n\tSYSZ_INS_CLGIJH,\n\tSYSZ_INS_CLGRJH,\n\tSYSZ_INS_CLIJH,\n\tSYSZ_INS_CLRJH,\n\tSYSZ_INS_CRJH,\n\tSYSZ_INS_CGIJNL,\n\tSYSZ_INS_CGRJNL,\n\tSYSZ_INS_CIJNL,\n\tSYSZ_INS_CLGIJNL,\n\tSYSZ_INS_CLGRJNL,\n\tSYSZ_INS_CLIJNL,\n\tSYSZ_INS_CLRJNL,\n\tSYSZ_INS_CRJNL,\n\tSYSZ_INS_CGIJHE,\n\tSYSZ_INS_CGRJHE,\n\tSYSZ_INS_CIJHE,\n\tSYSZ_INS_CLGIJHE,\n\tSYSZ_INS_CLGRJHE,\n\tSYSZ_INS_CLIJHE,\n\tSYSZ_INS_CLRJHE,\n\tSYSZ_INS_CRJHE,\n\tSYSZ_INS_CGIJNHE,\n\tSYSZ_INS_CGRJNHE,\n\tSYSZ_INS_CIJNHE,\n\tSYSZ_INS_CLGIJNHE,\n\tSYSZ_INS_CLGRJNHE,\n\tSYSZ_INS_CLIJNHE,\n\tSYSZ_INS_CLRJNHE,\n\tSYSZ_INS_CRJNHE,\n\tSYSZ_INS_CGIJL,\n\tSYSZ_INS_CGRJL,\n\tSYSZ_INS_CIJL,\n\tSYSZ_INS_CLGIJL,\n\tSYSZ_INS_CLGRJL,\n\tSYSZ_INS_CLIJL,\n\tSYSZ_INS_CLRJL,\n\tSYSZ_INS_CRJL,\n\tSYSZ_INS_CGIJNH,\n\tSYSZ_INS_CGRJNH,\n\tSYSZ_INS_CIJNH,\n\tSYSZ_INS_CLGIJNH,\n\tSYSZ_INS_CLGRJNH,\n\tSYSZ_INS_CLIJNH,\n\tSYSZ_INS_CLRJNH,\n\tSYSZ_INS_CRJNH,\n\tSYSZ_INS_CGIJLE,\n\tSYSZ_INS_CGRJLE,\n\tSYSZ_INS_CIJLE,\n\tSYSZ_INS_CLGIJLE,\n\tSYSZ_INS_CLGRJLE,\n\tSYSZ_INS_CLIJLE,\n\tSYSZ_INS_CLRJLE,\n\tSYSZ_INS_CRJLE,\n\tSYSZ_INS_CGIJNE,\n\tSYSZ_INS_CGRJNE,\n\tSYSZ_INS_CIJNE,\n\tSYSZ_INS_CLGIJNE,\n\tSYSZ_INS_CLGRJNE,\n\tSYSZ_INS_CLIJNE,\n\tSYSZ_INS_CLRJNE,\n\tSYSZ_INS_CRJNE,\n\tSYSZ_INS_CGIJLH,\n\tSYSZ_INS_CGRJLH,\n\tSYSZ_INS_CIJLH,\n\tSYSZ_INS_CLGIJLH,\n\tSYSZ_INS_CLGRJLH,\n\tSYSZ_INS_CLIJLH,\n\tSYSZ_INS_CLRJLH,\n\tSYSZ_INS_CRJLH,\n\tSYSZ_INS_BLR,\n\tSYSZ_INS_BLER,\n\tSYSZ_INS_JLE,\n\tSYSZ_INS_JGLE,\n\tSYSZ_INS_LOCLE,\n\tSYSZ_INS_LOCGLE,\n\tSYSZ_INS_LOCGRLE,\n\tSYSZ_INS_LOCRLE,\n\tSYSZ_INS_STOCLE,\n\tSYSZ_INS_STOCGLE,\n\tSYSZ_INS_BLHR,\n\tSYSZ_INS_JLH,\n\tSYSZ_INS_JGLH,\n\tSYSZ_INS_LOCLH,\n\tSYSZ_INS_LOCGLH,\n\tSYSZ_INS_LOCGRLH,\n\tSYSZ_INS_LOCRLH,\n\tSYSZ_INS_STOCLH,\n\tSYSZ_INS_STOCGLH,\n\tSYSZ_INS_JL,\n\tSYSZ_INS_JGL,\n\tSYSZ_INS_LOCL,\n\tSYSZ_INS_LOCGL,\n\tSYSZ_INS_LOCGRL,\n\tSYSZ_INS_LOCRL,\n\tSYSZ_INS_LOC,\n\tSYSZ_INS_LOCG,\n\tSYSZ_INS_LOCGR,\n\tSYSZ_INS_LOCR,\n\tSYSZ_INS_STOCL,\n\tSYSZ_INS_STOCGL,\n\tSYSZ_INS_BNER,\n\tSYSZ_INS_JNE,\n\tSYSZ_INS_JGNE,\n\tSYSZ_INS_LOCNE,\n\tSYSZ_INS_LOCGNE,\n\tSYSZ_INS_LOCGRNE,\n\tSYSZ_INS_LOCRNE,\n\tSYSZ_INS_STOCNE,\n\tSYSZ_INS_STOCGNE,\n\tSYSZ_INS_BNHR,\n\tSYSZ_INS_BNHER,\n\tSYSZ_INS_JNHE,\n\tSYSZ_INS_JGNHE,\n\tSYSZ_INS_LOCNHE,\n\tSYSZ_INS_LOCGNHE,\n\tSYSZ_INS_LOCGRNHE,\n\tSYSZ_INS_LOCRNHE,\n\tSYSZ_INS_STOCNHE,\n\tSYSZ_INS_STOCGNHE,\n\tSYSZ_INS_JNH,\n\tSYSZ_INS_JGNH,\n\tSYSZ_INS_LOCNH,\n\tSYSZ_INS_LOCGNH,\n\tSYSZ_INS_LOCGRNH,\n\tSYSZ_INS_LOCRNH,\n\tSYSZ_INS_STOCNH,\n\tSYSZ_INS_STOCGNH,\n\tSYSZ_INS_BNLR,\n\tSYSZ_INS_BNLER,\n\tSYSZ_INS_JNLE,\n\tSYSZ_INS_JGNLE,\n\tSYSZ_INS_LOCNLE,\n\tSYSZ_INS_LOCGNLE,\n\tSYSZ_INS_LOCGRNLE,\n\tSYSZ_INS_LOCRNLE,\n\tSYSZ_INS_STOCNLE,\n\tSYSZ_INS_STOCGNLE,\n\tSYSZ_INS_BNLHR,\n\tSYSZ_INS_JNLH,\n\tSYSZ_INS_JGNLH,\n\tSYSZ_INS_LOCNLH,\n\tSYSZ_INS_LOCGNLH,\n\tSYSZ_INS_LOCGRNLH,\n\tSYSZ_INS_LOCRNLH,\n\tSYSZ_INS_STOCNLH,\n\tSYSZ_INS_STOCGNLH,\n\tSYSZ_INS_JNL,\n\tSYSZ_INS_JGNL,\n\tSYSZ_INS_LOCNL,\n\tSYSZ_INS_LOCGNL,\n\tSYSZ_INS_LOCGRNL,\n\tSYSZ_INS_LOCRNL,\n\tSYSZ_INS_STOCNL,\n\tSYSZ_INS_STOCGNL,\n\tSYSZ_INS_BNOR,\n\tSYSZ_INS_JNO,\n\tSYSZ_INS_JGNO,\n\tSYSZ_INS_LOCNO,\n\tSYSZ_INS_LOCGNO,\n\tSYSZ_INS_LOCGRNO,\n\tSYSZ_INS_LOCRNO,\n\tSYSZ_INS_STOCNO,\n\tSYSZ_INS_STOCGNO,\n\tSYSZ_INS_BOR,\n\tSYSZ_INS_JO,\n\tSYSZ_INS_JGO,\n\tSYSZ_INS_LOCO,\n\tSYSZ_INS_LOCGO,\n\tSYSZ_INS_LOCGRO,\n\tSYSZ_INS_LOCRO,\n\tSYSZ_INS_STOCO,\n\tSYSZ_INS_STOCGO,\n\tSYSZ_INS_STOC,\n\tSYSZ_INS_STOCG,\n\tSYSZ_INS_BASR,\n\tSYSZ_INS_BR,\n\tSYSZ_INS_BRAS,\n\tSYSZ_INS_BRASL,\n\tSYSZ_INS_J,\n\tSYSZ_INS_JG,\n\tSYSZ_INS_BRCT,\n\tSYSZ_INS_BRCTG,\n\tSYSZ_INS_C,\n\tSYSZ_INS_CDB,\n\tSYSZ_INS_CDBR,\n\tSYSZ_INS_CDFBR,\n\tSYSZ_INS_CDGBR,\n\tSYSZ_INS_CDLFBR,\n\tSYSZ_INS_CDLGBR,\n\tSYSZ_INS_CEB,\n\tSYSZ_INS_CEBR,\n\tSYSZ_INS_CEFBR,\n\tSYSZ_INS_CEGBR,\n\tSYSZ_INS_CELFBR,\n\tSYSZ_INS_CELGBR,\n\tSYSZ_INS_CFDBR,\n\tSYSZ_INS_CFEBR,\n\tSYSZ_INS_CFI,\n\tSYSZ_INS_CFXBR,\n\tSYSZ_INS_CG,\n\tSYSZ_INS_CGDBR,\n\tSYSZ_INS_CGEBR,\n\tSYSZ_INS_CGF,\n\tSYSZ_INS_CGFI,\n\tSYSZ_INS_CGFR,\n\tSYSZ_INS_CGFRL,\n\tSYSZ_INS_CGH,\n\tSYSZ_INS_CGHI,\n\tSYSZ_INS_CGHRL,\n\tSYSZ_INS_CGHSI,\n\tSYSZ_INS_CGR,\n\tSYSZ_INS_CGRL,\n\tSYSZ_INS_CGXBR,\n\tSYSZ_INS_CH,\n\tSYSZ_INS_CHF,\n\tSYSZ_INS_CHHSI,\n\tSYSZ_INS_CHI,\n\tSYSZ_INS_CHRL,\n\tSYSZ_INS_CHSI,\n\tSYSZ_INS_CHY,\n\tSYSZ_INS_CIH,\n\tSYSZ_INS_CL,\n\tSYSZ_INS_CLC,\n\tSYSZ_INS_CLFDBR,\n\tSYSZ_INS_CLFEBR,\n\tSYSZ_INS_CLFHSI,\n\tSYSZ_INS_CLFI,\n\tSYSZ_INS_CLFXBR,\n\tSYSZ_INS_CLG,\n\tSYSZ_INS_CLGDBR,\n\tSYSZ_INS_CLGEBR,\n\tSYSZ_INS_CLGF,\n\tSYSZ_INS_CLGFI,\n\tSYSZ_INS_CLGFR,\n\tSYSZ_INS_CLGFRL,\n\tSYSZ_INS_CLGHRL,\n\tSYSZ_INS_CLGHSI,\n\tSYSZ_INS_CLGR,\n\tSYSZ_INS_CLGRL,\n\tSYSZ_INS_CLGXBR,\n\tSYSZ_INS_CLHF,\n\tSYSZ_INS_CLHHSI,\n\tSYSZ_INS_CLHRL,\n\tSYSZ_INS_CLI,\n\tSYSZ_INS_CLIH,\n\tSYSZ_INS_CLIY,\n\tSYSZ_INS_CLR,\n\tSYSZ_INS_CLRL,\n\tSYSZ_INS_CLST,\n\tSYSZ_INS_CLY,\n\tSYSZ_INS_CPSDR,\n\tSYSZ_INS_CR,\n\tSYSZ_INS_CRL,\n\tSYSZ_INS_CS,\n\tSYSZ_INS_CSG,\n\tSYSZ_INS_CSY,\n\tSYSZ_INS_CXBR,\n\tSYSZ_INS_CXFBR,\n\tSYSZ_INS_CXGBR,\n\tSYSZ_INS_CXLFBR,\n\tSYSZ_INS_CXLGBR,\n\tSYSZ_INS_CY,\n\tSYSZ_INS_DDB,\n\tSYSZ_INS_DDBR,\n\tSYSZ_INS_DEB,\n\tSYSZ_INS_DEBR,\n\tSYSZ_INS_DL,\n\tSYSZ_INS_DLG,\n\tSYSZ_INS_DLGR,\n\tSYSZ_INS_DLR,\n\tSYSZ_INS_DSG,\n\tSYSZ_INS_DSGF,\n\tSYSZ_INS_DSGFR,\n\tSYSZ_INS_DSGR,\n\tSYSZ_INS_DXBR,\n\tSYSZ_INS_EAR,\n\tSYSZ_INS_FIDBR,\n\tSYSZ_INS_FIDBRA,\n\tSYSZ_INS_FIEBR,\n\tSYSZ_INS_FIEBRA,\n\tSYSZ_INS_FIXBR,\n\tSYSZ_INS_FIXBRA,\n\tSYSZ_INS_FLOGR,\n\tSYSZ_INS_IC,\n\tSYSZ_INS_ICY,\n\tSYSZ_INS_IIHF,\n\tSYSZ_INS_IIHH,\n\tSYSZ_INS_IIHL,\n\tSYSZ_INS_IILF,\n\tSYSZ_INS_IILH,\n\tSYSZ_INS_IILL,\n\tSYSZ_INS_IPM,\n\tSYSZ_INS_L,\n\tSYSZ_INS_LA,\n\tSYSZ_INS_LAA,\n\tSYSZ_INS_LAAG,\n\tSYSZ_INS_LAAL,\n\tSYSZ_INS_LAALG,\n\tSYSZ_INS_LAN,\n\tSYSZ_INS_LANG,\n\tSYSZ_INS_LAO,\n\tSYSZ_INS_LAOG,\n\tSYSZ_INS_LARL,\n\tSYSZ_INS_LAX,\n\tSYSZ_INS_LAXG,\n\tSYSZ_INS_LAY,\n\tSYSZ_INS_LB,\n\tSYSZ_INS_LBH,\n\tSYSZ_INS_LBR,\n\tSYSZ_INS_LCDBR,\n\tSYSZ_INS_LCEBR,\n\tSYSZ_INS_LCGFR,\n\tSYSZ_INS_LCGR,\n\tSYSZ_INS_LCR,\n\tSYSZ_INS_LCXBR,\n\tSYSZ_INS_LD,\n\tSYSZ_INS_LDEB,\n\tSYSZ_INS_LDEBR,\n\tSYSZ_INS_LDGR,\n\tSYSZ_INS_LDR,\n\tSYSZ_INS_LDXBR,\n\tSYSZ_INS_LDXBRA,\n\tSYSZ_INS_LDY,\n\tSYSZ_INS_LE,\n\tSYSZ_INS_LEDBR,\n\tSYSZ_INS_LEDBRA,\n\tSYSZ_INS_LER,\n\tSYSZ_INS_LEXBR,\n\tSYSZ_INS_LEXBRA,\n\tSYSZ_INS_LEY,\n\tSYSZ_INS_LFH,\n\tSYSZ_INS_LG,\n\tSYSZ_INS_LGB,\n\tSYSZ_INS_LGBR,\n\tSYSZ_INS_LGDR,\n\tSYSZ_INS_LGF,\n\tSYSZ_INS_LGFI,\n\tSYSZ_INS_LGFR,\n\tSYSZ_INS_LGFRL,\n\tSYSZ_INS_LGH,\n\tSYSZ_INS_LGHI,\n\tSYSZ_INS_LGHR,\n\tSYSZ_INS_LGHRL,\n\tSYSZ_INS_LGR,\n\tSYSZ_INS_LGRL,\n\tSYSZ_INS_LH,\n\tSYSZ_INS_LHH,\n\tSYSZ_INS_LHI,\n\tSYSZ_INS_LHR,\n\tSYSZ_INS_LHRL,\n\tSYSZ_INS_LHY,\n\tSYSZ_INS_LLC,\n\tSYSZ_INS_LLCH,\n\tSYSZ_INS_LLCR,\n\tSYSZ_INS_LLGC,\n\tSYSZ_INS_LLGCR,\n\tSYSZ_INS_LLGF,\n\tSYSZ_INS_LLGFR,\n\tSYSZ_INS_LLGFRL,\n\tSYSZ_INS_LLGH,\n\tSYSZ_INS_LLGHR,\n\tSYSZ_INS_LLGHRL,\n\tSYSZ_INS_LLH,\n\tSYSZ_INS_LLHH,\n\tSYSZ_INS_LLHR,\n\tSYSZ_INS_LLHRL,\n\tSYSZ_INS_LLIHF,\n\tSYSZ_INS_LLIHH,\n\tSYSZ_INS_LLIHL,\n\tSYSZ_INS_LLILF,\n\tSYSZ_INS_LLILH,\n\tSYSZ_INS_LLILL,\n\tSYSZ_INS_LMG,\n\tSYSZ_INS_LNDBR,\n\tSYSZ_INS_LNEBR,\n\tSYSZ_INS_LNGFR,\n\tSYSZ_INS_LNGR,\n\tSYSZ_INS_LNR,\n\tSYSZ_INS_LNXBR,\n\tSYSZ_INS_LPDBR,\n\tSYSZ_INS_LPEBR,\n\tSYSZ_INS_LPGFR,\n\tSYSZ_INS_LPGR,\n\tSYSZ_INS_LPR,\n\tSYSZ_INS_LPXBR,\n\tSYSZ_INS_LR,\n\tSYSZ_INS_LRL,\n\tSYSZ_INS_LRV,\n\tSYSZ_INS_LRVG,\n\tSYSZ_INS_LRVGR,\n\tSYSZ_INS_LRVR,\n\tSYSZ_INS_LT,\n\tSYSZ_INS_LTDBR,\n\tSYSZ_INS_LTEBR,\n\tSYSZ_INS_LTG,\n\tSYSZ_INS_LTGF,\n\tSYSZ_INS_LTGFR,\n\tSYSZ_INS_LTGR,\n\tSYSZ_INS_LTR,\n\tSYSZ_INS_LTXBR,\n\tSYSZ_INS_LXDB,\n\tSYSZ_INS_LXDBR,\n\tSYSZ_INS_LXEB,\n\tSYSZ_INS_LXEBR,\n\tSYSZ_INS_LXR,\n\tSYSZ_INS_LY,\n\tSYSZ_INS_LZDR,\n\tSYSZ_INS_LZER,\n\tSYSZ_INS_LZXR,\n\tSYSZ_INS_MADB,\n\tSYSZ_INS_MADBR,\n\tSYSZ_INS_MAEB,\n\tSYSZ_INS_MAEBR,\n\tSYSZ_INS_MDB,\n\tSYSZ_INS_MDBR,\n\tSYSZ_INS_MDEB,\n\tSYSZ_INS_MDEBR,\n\tSYSZ_INS_MEEB,\n\tSYSZ_INS_MEEBR,\n\tSYSZ_INS_MGHI,\n\tSYSZ_INS_MH,\n\tSYSZ_INS_MHI,\n\tSYSZ_INS_MHY,\n\tSYSZ_INS_MLG,\n\tSYSZ_INS_MLGR,\n\tSYSZ_INS_MS,\n\tSYSZ_INS_MSDB,\n\tSYSZ_INS_MSDBR,\n\tSYSZ_INS_MSEB,\n\tSYSZ_INS_MSEBR,\n\tSYSZ_INS_MSFI,\n\tSYSZ_INS_MSG,\n\tSYSZ_INS_MSGF,\n\tSYSZ_INS_MSGFI,\n\tSYSZ_INS_MSGFR,\n\tSYSZ_INS_MSGR,\n\tSYSZ_INS_MSR,\n\tSYSZ_INS_MSY,\n\tSYSZ_INS_MVC,\n\tSYSZ_INS_MVGHI,\n\tSYSZ_INS_MVHHI,\n\tSYSZ_INS_MVHI,\n\tSYSZ_INS_MVI,\n\tSYSZ_INS_MVIY,\n\tSYSZ_INS_MVST,\n\tSYSZ_INS_MXBR,\n\tSYSZ_INS_MXDB,\n\tSYSZ_INS_MXDBR,\n\tSYSZ_INS_N,\n\tSYSZ_INS_NC,\n\tSYSZ_INS_NG,\n\tSYSZ_INS_NGR,\n\tSYSZ_INS_NGRK,\n\tSYSZ_INS_NI,\n\tSYSZ_INS_NIHF,\n\tSYSZ_INS_NIHH,\n\tSYSZ_INS_NIHL,\n\tSYSZ_INS_NILF,\n\tSYSZ_INS_NILH,\n\tSYSZ_INS_NILL,\n\tSYSZ_INS_NIY,\n\tSYSZ_INS_NR,\n\tSYSZ_INS_NRK,\n\tSYSZ_INS_NY,\n\tSYSZ_INS_O,\n\tSYSZ_INS_OC,\n\tSYSZ_INS_OG,\n\tSYSZ_INS_OGR,\n\tSYSZ_INS_OGRK,\n\tSYSZ_INS_OI,\n\tSYSZ_INS_OIHF,\n\tSYSZ_INS_OIHH,\n\tSYSZ_INS_OIHL,\n\tSYSZ_INS_OILF,\n\tSYSZ_INS_OILH,\n\tSYSZ_INS_OILL,\n\tSYSZ_INS_OIY,\n\tSYSZ_INS_OR,\n\tSYSZ_INS_ORK,\n\tSYSZ_INS_OY,\n\tSYSZ_INS_PFD,\n\tSYSZ_INS_PFDRL,\n\tSYSZ_INS_RISBG,\n\tSYSZ_INS_RISBHG,\n\tSYSZ_INS_RISBLG,\n\tSYSZ_INS_RLL,\n\tSYSZ_INS_RLLG,\n\tSYSZ_INS_RNSBG,\n\tSYSZ_INS_ROSBG,\n\tSYSZ_INS_RXSBG,\n\tSYSZ_INS_S,\n\tSYSZ_INS_SDB,\n\tSYSZ_INS_SDBR,\n\tSYSZ_INS_SEB,\n\tSYSZ_INS_SEBR,\n\tSYSZ_INS_SG,\n\tSYSZ_INS_SGF,\n\tSYSZ_INS_SGFR,\n\tSYSZ_INS_SGR,\n\tSYSZ_INS_SGRK,\n\tSYSZ_INS_SH,\n\tSYSZ_INS_SHY,\n\tSYSZ_INS_SL,\n\tSYSZ_INS_SLB,\n\tSYSZ_INS_SLBG,\n\tSYSZ_INS_SLBR,\n\tSYSZ_INS_SLFI,\n\tSYSZ_INS_SLG,\n\tSYSZ_INS_SLBGR,\n\tSYSZ_INS_SLGF,\n\tSYSZ_INS_SLGFI,\n\tSYSZ_INS_SLGFR,\n\tSYSZ_INS_SLGR,\n\tSYSZ_INS_SLGRK,\n\tSYSZ_INS_SLL,\n\tSYSZ_INS_SLLG,\n\tSYSZ_INS_SLLK,\n\tSYSZ_INS_SLR,\n\tSYSZ_INS_SLRK,\n\tSYSZ_INS_SLY,\n\tSYSZ_INS_SQDB,\n\tSYSZ_INS_SQDBR,\n\tSYSZ_INS_SQEB,\n\tSYSZ_INS_SQEBR,\n\tSYSZ_INS_SQXBR,\n\tSYSZ_INS_SR,\n\tSYSZ_INS_SRA,\n\tSYSZ_INS_SRAG,\n\tSYSZ_INS_SRAK,\n\tSYSZ_INS_SRK,\n\tSYSZ_INS_SRL,\n\tSYSZ_INS_SRLG,\n\tSYSZ_INS_SRLK,\n\tSYSZ_INS_SRST,\n\tSYSZ_INS_ST,\n\tSYSZ_INS_STC,\n\tSYSZ_INS_STCH,\n\tSYSZ_INS_STCY,\n\tSYSZ_INS_STD,\n\tSYSZ_INS_STDY,\n\tSYSZ_INS_STE,\n\tSYSZ_INS_STEY,\n\tSYSZ_INS_STFH,\n\tSYSZ_INS_STG,\n\tSYSZ_INS_STGRL,\n\tSYSZ_INS_STH,\n\tSYSZ_INS_STHH,\n\tSYSZ_INS_STHRL,\n\tSYSZ_INS_STHY,\n\tSYSZ_INS_STMG,\n\tSYSZ_INS_STRL,\n\tSYSZ_INS_STRV,\n\tSYSZ_INS_STRVG,\n\tSYSZ_INS_STY,\n\tSYSZ_INS_SXBR,\n\tSYSZ_INS_SY,\n\tSYSZ_INS_TM,\n\tSYSZ_INS_TMHH,\n\tSYSZ_INS_TMHL,\n\tSYSZ_INS_TMLH,\n\tSYSZ_INS_TMLL,\n\tSYSZ_INS_TMY,\n\tSYSZ_INS_X,\n\tSYSZ_INS_XC,\n\tSYSZ_INS_XG,\n\tSYSZ_INS_XGR,\n\tSYSZ_INS_XGRK,\n\tSYSZ_INS_XI,\n\tSYSZ_INS_XIHF,\n\tSYSZ_INS_XILF,\n\tSYSZ_INS_XIY,\n\tSYSZ_INS_XR,\n\tSYSZ_INS_XRK,\n\tSYSZ_INS_XY,\n\n\tSYSZ_INS_ENDING,   // <-- mark the end of the list of instructions\n} sysz_insn;\n\n/// Group of SystemZ instructions\ntypedef enum sysz_insn_group {\n\tSYSZ_GRP_INVALID = 0, ///< = CS_GRP_INVALID\n\n\t// Generic groups\n\t// all jump instructions (conditional+direct+indirect jumps)\n\tSYSZ_GRP_JUMP,\t///< = CS_GRP_JUMP\n\n\t// Architecture-specific groups\n\tSYSZ_GRP_DISTINCTOPS = 128,\n\tSYSZ_GRP_FPEXTENSION,\n\tSYSZ_GRP_HIGHWORD,\n\tSYSZ_GRP_INTERLOCKEDACCESS1,\n\tSYSZ_GRP_LOADSTOREONCOND,\n\n\tSYSZ_GRP_ENDING,   // <-- mark the end of the list of groups\n} sysz_insn_group;\n\n#ifdef __cplusplus\n}\n#endif\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/capstone/tms320c64x.h",
    "content": "/* Capstone Disassembly Engine */\n/* TMS320C64x Backend by Fotis Loukos <me@fotisl.com> 2016 */\n\n#ifndef CAPSTONE_TMS320C64X_H\n#define CAPSTONE_TMS320C64X_H\n\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\n#include <stdint.h>\n#include \"platform.h\"\n\n#ifdef _MSC_VER\n#pragma warning(disable:4201)\n#endif\n\ntypedef enum tms320c64x_op_type {\n\tTMS320C64X_OP_INVALID = 0, ///< = CS_OP_INVALID (Uninitialized).\n\tTMS320C64X_OP_REG, ///< = CS_OP_REG (Register operand).\n\tTMS320C64X_OP_IMM, ///< = CS_OP_IMM (Immediate operand).\n\tTMS320C64X_OP_MEM, ///< = CS_OP_MEM (Memory operand).\n\tTMS320C64X_OP_REGPAIR = 64, ///< Register pair for double word ops\n} tms320c64x_op_type;\n\ntypedef enum tms320c64x_mem_disp {\n\tTMS320C64X_MEM_DISP_INVALID = 0,\n\tTMS320C64X_MEM_DISP_CONSTANT,\n\tTMS320C64X_MEM_DISP_REGISTER,\n} tms320c64x_mem_disp;\n\ntypedef enum tms320c64x_mem_dir {\n\tTMS320C64X_MEM_DIR_INVALID = 0,\n\tTMS320C64X_MEM_DIR_FW,\n\tTMS320C64X_MEM_DIR_BW,\n} tms320c64x_mem_dir;\n\ntypedef enum tms320c64x_mem_mod {\n\tTMS320C64X_MEM_MOD_INVALID = 0,\n\tTMS320C64X_MEM_MOD_NO,\n\tTMS320C64X_MEM_MOD_PRE,\n\tTMS320C64X_MEM_MOD_POST,\n} tms320c64x_mem_mod;\n\ntypedef struct tms320c64x_op_mem {\n\tunsigned int\tbase;\t///< base register\n\tunsigned int\tdisp;\t///< displacement/offset value\n\tunsigned int\tunit;\t///< unit of base and offset register\n\tunsigned int\tscaled;\t///< offset scaled\n\tunsigned int\tdisptype;\t///< displacement type\n\tunsigned int\tdirection;\t///< direction\n\tunsigned int\tmodify;\t///< modification\n} tms320c64x_op_mem;\n\ntypedef struct cs_tms320c64x_op {\n\ttms320c64x_op_type type;\t///< operand type\n\tunion {\n\t\tunsigned int reg;\t///< register value for REG operand or first register for REGPAIR operand\n\t\tint32_t imm;\t\t///< immediate value for IMM operand\n\t\ttms320c64x_op_mem mem;\t\t///< base/disp value for MEM operand\n\t};\n} cs_tms320c64x_op;\n\ntypedef struct cs_tms320c64x {\n\tuint8_t op_count;\n\tcs_tms320c64x_op operands[8]; ///< operands for this instruction.\n\tstruct {\n\t\tunsigned int reg;\n\t\tunsigned int zero;\n\t} condition;\n\tstruct {\n\t\tunsigned int unit;\n\t\tunsigned int side;\n\t\tunsigned int crosspath;\n\t} funit;\n\tunsigned int parallel;\n} cs_tms320c64x;\n\ntypedef enum tms320c64x_reg {\n\tTMS320C64X_REG_INVALID = 0,\n\n\tTMS320C64X_REG_AMR,\n\tTMS320C64X_REG_CSR,\n\tTMS320C64X_REG_DIER,\n\tTMS320C64X_REG_DNUM,\n\tTMS320C64X_REG_ECR,\n\tTMS320C64X_REG_GFPGFR,\n\tTMS320C64X_REG_GPLYA,\n\tTMS320C64X_REG_GPLYB,\n\tTMS320C64X_REG_ICR,\n\tTMS320C64X_REG_IER,\n\tTMS320C64X_REG_IERR,\n\tTMS320C64X_REG_ILC,\n\tTMS320C64X_REG_IRP,\n\tTMS320C64X_REG_ISR,\n\tTMS320C64X_REG_ISTP,\n\tTMS320C64X_REG_ITSR,\n\tTMS320C64X_REG_NRP,\n\tTMS320C64X_REG_NTSR,\n\tTMS320C64X_REG_REP,\n\tTMS320C64X_REG_RILC,\n\tTMS320C64X_REG_SSR,\n\tTMS320C64X_REG_TSCH,\n\tTMS320C64X_REG_TSCL,\n\tTMS320C64X_REG_TSR,\n\tTMS320C64X_REG_A0,\n\tTMS320C64X_REG_A1,\n\tTMS320C64X_REG_A2,\n\tTMS320C64X_REG_A3,\n\tTMS320C64X_REG_A4,\n\tTMS320C64X_REG_A5,\n\tTMS320C64X_REG_A6,\n\tTMS320C64X_REG_A7,\n\tTMS320C64X_REG_A8,\n\tTMS320C64X_REG_A9,\n\tTMS320C64X_REG_A10,\n\tTMS320C64X_REG_A11,\n\tTMS320C64X_REG_A12,\n\tTMS320C64X_REG_A13,\n\tTMS320C64X_REG_A14,\n\tTMS320C64X_REG_A15,\n\tTMS320C64X_REG_A16,\n\tTMS320C64X_REG_A17,\n\tTMS320C64X_REG_A18,\n\tTMS320C64X_REG_A19,\n\tTMS320C64X_REG_A20,\n\tTMS320C64X_REG_A21,\n\tTMS320C64X_REG_A22,\n\tTMS320C64X_REG_A23,\n\tTMS320C64X_REG_A24,\n\tTMS320C64X_REG_A25,\n\tTMS320C64X_REG_A26,\n\tTMS320C64X_REG_A27,\n\tTMS320C64X_REG_A28,\n\tTMS320C64X_REG_A29,\n\tTMS320C64X_REG_A30,\n\tTMS320C64X_REG_A31,\n\tTMS320C64X_REG_B0,\n\tTMS320C64X_REG_B1,\n\tTMS320C64X_REG_B2,\n\tTMS320C64X_REG_B3,\n\tTMS320C64X_REG_B4,\n\tTMS320C64X_REG_B5,\n\tTMS320C64X_REG_B6,\n\tTMS320C64X_REG_B7,\n\tTMS320C64X_REG_B8,\n\tTMS320C64X_REG_B9,\n\tTMS320C64X_REG_B10,\n\tTMS320C64X_REG_B11,\n\tTMS320C64X_REG_B12,\n\tTMS320C64X_REG_B13,\n\tTMS320C64X_REG_B14,\n\tTMS320C64X_REG_B15,\n\tTMS320C64X_REG_B16,\n\tTMS320C64X_REG_B17,\n\tTMS320C64X_REG_B18,\n\tTMS320C64X_REG_B19,\n\tTMS320C64X_REG_B20,\n\tTMS320C64X_REG_B21,\n\tTMS320C64X_REG_B22,\n\tTMS320C64X_REG_B23,\n\tTMS320C64X_REG_B24,\n\tTMS320C64X_REG_B25,\n\tTMS320C64X_REG_B26,\n\tTMS320C64X_REG_B27,\n\tTMS320C64X_REG_B28,\n\tTMS320C64X_REG_B29,\n\tTMS320C64X_REG_B30,\n\tTMS320C64X_REG_B31,\n\tTMS320C64X_REG_PCE1,\n\n\tTMS320C64X_REG_ENDING,\t// <-- mark the end of the list of registers\n\n\t// Alias registers\n\tTMS320C64X_REG_EFR = TMS320C64X_REG_ECR,\n\tTMS320C64X_REG_IFR = TMS320C64X_REG_ISR,\n} tms320c64x_reg;\n\ntypedef enum tms320c64x_insn {\n\tTMS320C64X_INS_INVALID = 0,\n\n\tTMS320C64X_INS_ABS,\n\tTMS320C64X_INS_ABS2,\n\tTMS320C64X_INS_ADD,\n\tTMS320C64X_INS_ADD2,\n\tTMS320C64X_INS_ADD4,\n\tTMS320C64X_INS_ADDAB,\n\tTMS320C64X_INS_ADDAD,\n\tTMS320C64X_INS_ADDAH,\n\tTMS320C64X_INS_ADDAW,\n\tTMS320C64X_INS_ADDK,\n\tTMS320C64X_INS_ADDKPC,\n\tTMS320C64X_INS_ADDU,\n\tTMS320C64X_INS_AND,\n\tTMS320C64X_INS_ANDN,\n\tTMS320C64X_INS_AVG2,\n\tTMS320C64X_INS_AVGU4,\n\tTMS320C64X_INS_B,\n\tTMS320C64X_INS_BDEC,\n\tTMS320C64X_INS_BITC4,\n\tTMS320C64X_INS_BNOP,\n\tTMS320C64X_INS_BPOS,\n\tTMS320C64X_INS_CLR,\n\tTMS320C64X_INS_CMPEQ,\n\tTMS320C64X_INS_CMPEQ2,\n\tTMS320C64X_INS_CMPEQ4,\n\tTMS320C64X_INS_CMPGT,\n\tTMS320C64X_INS_CMPGT2,\n\tTMS320C64X_INS_CMPGTU4,\n\tTMS320C64X_INS_CMPLT,\n\tTMS320C64X_INS_CMPLTU,\n\tTMS320C64X_INS_DEAL,\n\tTMS320C64X_INS_DOTP2,\n\tTMS320C64X_INS_DOTPN2,\n\tTMS320C64X_INS_DOTPNRSU2,\n\tTMS320C64X_INS_DOTPRSU2,\n\tTMS320C64X_INS_DOTPSU4,\n\tTMS320C64X_INS_DOTPU4,\n\tTMS320C64X_INS_EXT,\n\tTMS320C64X_INS_EXTU,\n\tTMS320C64X_INS_GMPGTU,\n\tTMS320C64X_INS_GMPY4,\n\tTMS320C64X_INS_LDB,\n\tTMS320C64X_INS_LDBU,\n\tTMS320C64X_INS_LDDW,\n\tTMS320C64X_INS_LDH,\n\tTMS320C64X_INS_LDHU,\n\tTMS320C64X_INS_LDNDW,\n\tTMS320C64X_INS_LDNW,\n\tTMS320C64X_INS_LDW,\n\tTMS320C64X_INS_LMBD,\n\tTMS320C64X_INS_MAX2,\n\tTMS320C64X_INS_MAXU4,\n\tTMS320C64X_INS_MIN2,\n\tTMS320C64X_INS_MINU4,\n\tTMS320C64X_INS_MPY,\n\tTMS320C64X_INS_MPY2,\n\tTMS320C64X_INS_MPYH,\n\tTMS320C64X_INS_MPYHI,\n\tTMS320C64X_INS_MPYHIR,\n\tTMS320C64X_INS_MPYHL,\n\tTMS320C64X_INS_MPYHLU,\n\tTMS320C64X_INS_MPYHSLU,\n\tTMS320C64X_INS_MPYHSU,\n\tTMS320C64X_INS_MPYHU,\n\tTMS320C64X_INS_MPYHULS,\n\tTMS320C64X_INS_MPYHUS,\n\tTMS320C64X_INS_MPYLH,\n\tTMS320C64X_INS_MPYLHU,\n\tTMS320C64X_INS_MPYLI,\n\tTMS320C64X_INS_MPYLIR,\n\tTMS320C64X_INS_MPYLSHU,\n\tTMS320C64X_INS_MPYLUHS,\n\tTMS320C64X_INS_MPYSU,\n\tTMS320C64X_INS_MPYSU4,\n\tTMS320C64X_INS_MPYU,\n\tTMS320C64X_INS_MPYU4,\n\tTMS320C64X_INS_MPYUS,\n\tTMS320C64X_INS_MVC,\n\tTMS320C64X_INS_MVD,\n\tTMS320C64X_INS_MVK,\n\tTMS320C64X_INS_MVKL,\n\tTMS320C64X_INS_MVKLH,\n\tTMS320C64X_INS_NOP,\n\tTMS320C64X_INS_NORM,\n\tTMS320C64X_INS_OR,\n\tTMS320C64X_INS_PACK2,\n\tTMS320C64X_INS_PACKH2,\n\tTMS320C64X_INS_PACKH4,\n\tTMS320C64X_INS_PACKHL2,\n\tTMS320C64X_INS_PACKL4,\n\tTMS320C64X_INS_PACKLH2,\n\tTMS320C64X_INS_ROTL,\n\tTMS320C64X_INS_SADD,\n\tTMS320C64X_INS_SADD2,\n\tTMS320C64X_INS_SADDU4,\n\tTMS320C64X_INS_SADDUS2,\n\tTMS320C64X_INS_SAT,\n\tTMS320C64X_INS_SET,\n\tTMS320C64X_INS_SHFL,\n\tTMS320C64X_INS_SHL,\n\tTMS320C64X_INS_SHLMB,\n\tTMS320C64X_INS_SHR,\n\tTMS320C64X_INS_SHR2,\n\tTMS320C64X_INS_SHRMB,\n\tTMS320C64X_INS_SHRU,\n\tTMS320C64X_INS_SHRU2,\n\tTMS320C64X_INS_SMPY,\n\tTMS320C64X_INS_SMPY2,\n\tTMS320C64X_INS_SMPYH,\n\tTMS320C64X_INS_SMPYHL,\n\tTMS320C64X_INS_SMPYLH,\n\tTMS320C64X_INS_SPACK2,\n\tTMS320C64X_INS_SPACKU4,\n\tTMS320C64X_INS_SSHL,\n\tTMS320C64X_INS_SSHVL,\n\tTMS320C64X_INS_SSHVR,\n\tTMS320C64X_INS_SSUB,\n\tTMS320C64X_INS_STB,\n\tTMS320C64X_INS_STDW,\n\tTMS320C64X_INS_STH,\n\tTMS320C64X_INS_STNDW,\n\tTMS320C64X_INS_STNW,\n\tTMS320C64X_INS_STW,\n\tTMS320C64X_INS_SUB,\n\tTMS320C64X_INS_SUB2,\n\tTMS320C64X_INS_SUB4,\n\tTMS320C64X_INS_SUBAB,\n\tTMS320C64X_INS_SUBABS4,\n\tTMS320C64X_INS_SUBAH,\n\tTMS320C64X_INS_SUBAW,\n\tTMS320C64X_INS_SUBC,\n\tTMS320C64X_INS_SUBU,\n\tTMS320C64X_INS_SWAP4,\n\tTMS320C64X_INS_UNPKHU4,\n\tTMS320C64X_INS_UNPKLU4,\n\tTMS320C64X_INS_XOR,\n\tTMS320C64X_INS_XPND2,\n\tTMS320C64X_INS_XPND4,\n\t// Aliases\n\tTMS320C64X_INS_IDLE,\n\tTMS320C64X_INS_MV,\n\tTMS320C64X_INS_NEG,\n\tTMS320C64X_INS_NOT,\n\tTMS320C64X_INS_SWAP2,\n\tTMS320C64X_INS_ZERO,\n\n\tTMS320C64X_INS_ENDING,   // <-- mark the end of the list of instructions\n} tms320c64x_insn;\n\ntypedef enum tms320c64x_insn_group {\n\tTMS320C64X_GRP_INVALID = 0, ///< = CS_GRP_INVALID\n\n\tTMS320C64X_GRP_JUMP,\t///< = CS_GRP_JUMP\n\n\tTMS320C64X_GRP_FUNIT_D = 128,\n\tTMS320C64X_GRP_FUNIT_L,\n\tTMS320C64X_GRP_FUNIT_M,\n\tTMS320C64X_GRP_FUNIT_S,\n\tTMS320C64X_GRP_FUNIT_NO,\n\n\tTMS320C64X_GRP_ENDING,   // <-- mark the end of the list of groups\n} tms320c64x_insn_group;\n\ntypedef enum tms320c64x_funit {\n\tTMS320C64X_FUNIT_INVALID = 0,\n\tTMS320C64X_FUNIT_D,\n\tTMS320C64X_FUNIT_L,\n\tTMS320C64X_FUNIT_M,\n\tTMS320C64X_FUNIT_S,\n\tTMS320C64X_FUNIT_NO\n} tms320c64x_funit;\n\n#ifdef __cplusplus\n}\n#endif\n\n#endif\n\n"
  },
  {
    "path": "freebsd-headers/capstone/x86.h",
    "content": "#ifndef CAPSTONE_X86_H\n#define CAPSTONE_X86_H\n\n/* Capstone Disassembly Engine */\n/* By Nguyen Anh Quynh <aquynh@gmail.com>, 2013-2015 */\n\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\n#include \"platform.h\"\n\n/// Calculate relative address for X86-64, given cs_insn structure\n#define X86_REL_ADDR(insn) (((insn).detail->x86.operands[0].type == X86_OP_IMM) \\\n\t? (uint64_t)((insn).detail->x86.operands[0].imm) \\\n\t: (((insn).address + (insn).size) + (uint64_t)(insn).detail->x86.disp))\n\n/// X86 registers\ntypedef enum x86_reg {\n\tX86_REG_INVALID = 0,\n\tX86_REG_AH, X86_REG_AL, X86_REG_AX, X86_REG_BH, X86_REG_BL,\n\tX86_REG_BP, X86_REG_BPL, X86_REG_BX, X86_REG_CH, X86_REG_CL,\n\tX86_REG_CS, X86_REG_CX, X86_REG_DH, X86_REG_DI, X86_REG_DIL,\n\tX86_REG_DL, X86_REG_DS, X86_REG_DX, X86_REG_EAX, X86_REG_EBP,\n\tX86_REG_EBX, X86_REG_ECX, X86_REG_EDI, X86_REG_EDX, X86_REG_EFLAGS,\n\tX86_REG_EIP, X86_REG_EIZ, X86_REG_ES, X86_REG_ESI, X86_REG_ESP,\n\tX86_REG_FPSW, X86_REG_FS, X86_REG_GS, X86_REG_IP, X86_REG_RAX,\n\tX86_REG_RBP, X86_REG_RBX, X86_REG_RCX, X86_REG_RDI, X86_REG_RDX,\n\tX86_REG_RIP, X86_REG_RIZ, X86_REG_RSI, X86_REG_RSP, X86_REG_SI,\n\tX86_REG_SIL, X86_REG_SP, X86_REG_SPL, X86_REG_SS, X86_REG_CR0,\n\tX86_REG_CR1, X86_REG_CR2, X86_REG_CR3, X86_REG_CR4, X86_REG_CR5,\n\tX86_REG_CR6, X86_REG_CR7, X86_REG_CR8, X86_REG_CR9, X86_REG_CR10,\n\tX86_REG_CR11, X86_REG_CR12, X86_REG_CR13, X86_REG_CR14, X86_REG_CR15,\n\tX86_REG_DR0, X86_REG_DR1, X86_REG_DR2, X86_REG_DR3, X86_REG_DR4,\n\tX86_REG_DR5, X86_REG_DR6, X86_REG_DR7, X86_REG_DR8, X86_REG_DR9,\n\tX86_REG_DR10, X86_REG_DR11, X86_REG_DR12, X86_REG_DR13, X86_REG_DR14,\n\tX86_REG_DR15, X86_REG_FP0, X86_REG_FP1, X86_REG_FP2, X86_REG_FP3,\n\tX86_REG_FP4, X86_REG_FP5, X86_REG_FP6, X86_REG_FP7,\n\tX86_REG_K0, X86_REG_K1, X86_REG_K2, X86_REG_K3, X86_REG_K4,\n\tX86_REG_K5, X86_REG_K6, X86_REG_K7, X86_REG_MM0, X86_REG_MM1,\n\tX86_REG_MM2, X86_REG_MM3, X86_REG_MM4, X86_REG_MM5, X86_REG_MM6,\n\tX86_REG_MM7, X86_REG_R8, X86_REG_R9, X86_REG_R10, X86_REG_R11,\n\tX86_REG_R12, X86_REG_R13, X86_REG_R14, X86_REG_R15,\n\tX86_REG_ST0, X86_REG_ST1, X86_REG_ST2, X86_REG_ST3,\n\tX86_REG_ST4, X86_REG_ST5, X86_REG_ST6, X86_REG_ST7,\n\tX86_REG_XMM0, X86_REG_XMM1, X86_REG_XMM2, X86_REG_XMM3, X86_REG_XMM4,\n\tX86_REG_XMM5, X86_REG_XMM6, X86_REG_XMM7, X86_REG_XMM8, X86_REG_XMM9,\n\tX86_REG_XMM10, X86_REG_XMM11, X86_REG_XMM12, X86_REG_XMM13, X86_REG_XMM14,\n\tX86_REG_XMM15, X86_REG_XMM16, X86_REG_XMM17, X86_REG_XMM18, X86_REG_XMM19,\n\tX86_REG_XMM20, X86_REG_XMM21, X86_REG_XMM22, X86_REG_XMM23, X86_REG_XMM24,\n\tX86_REG_XMM25, X86_REG_XMM26, X86_REG_XMM27, X86_REG_XMM28, X86_REG_XMM29,\n\tX86_REG_XMM30, X86_REG_XMM31, X86_REG_YMM0, X86_REG_YMM1, X86_REG_YMM2,\n\tX86_REG_YMM3, X86_REG_YMM4, X86_REG_YMM5, X86_REG_YMM6, X86_REG_YMM7,\n\tX86_REG_YMM8, X86_REG_YMM9, X86_REG_YMM10, X86_REG_YMM11, X86_REG_YMM12,\n\tX86_REG_YMM13, X86_REG_YMM14, X86_REG_YMM15, X86_REG_YMM16, X86_REG_YMM17,\n\tX86_REG_YMM18, X86_REG_YMM19, X86_REG_YMM20, X86_REG_YMM21, X86_REG_YMM22,\n\tX86_REG_YMM23, X86_REG_YMM24, X86_REG_YMM25, X86_REG_YMM26, X86_REG_YMM27,\n\tX86_REG_YMM28, X86_REG_YMM29, X86_REG_YMM30, X86_REG_YMM31, X86_REG_ZMM0,\n\tX86_REG_ZMM1, X86_REG_ZMM2, X86_REG_ZMM3, X86_REG_ZMM4, X86_REG_ZMM5,\n\tX86_REG_ZMM6, X86_REG_ZMM7, X86_REG_ZMM8, X86_REG_ZMM9, X86_REG_ZMM10,\n\tX86_REG_ZMM11, X86_REG_ZMM12, X86_REG_ZMM13, X86_REG_ZMM14, X86_REG_ZMM15,\n\tX86_REG_ZMM16, X86_REG_ZMM17, X86_REG_ZMM18, X86_REG_ZMM19, X86_REG_ZMM20,\n\tX86_REG_ZMM21, X86_REG_ZMM22, X86_REG_ZMM23, X86_REG_ZMM24, X86_REG_ZMM25,\n\tX86_REG_ZMM26, X86_REG_ZMM27, X86_REG_ZMM28, X86_REG_ZMM29, X86_REG_ZMM30,\n\tX86_REG_ZMM31, X86_REG_R8B, X86_REG_R9B, X86_REG_R10B, X86_REG_R11B,\n\tX86_REG_R12B, X86_REG_R13B, X86_REG_R14B, X86_REG_R15B, X86_REG_R8D,\n\tX86_REG_R9D, X86_REG_R10D, X86_REG_R11D, X86_REG_R12D, X86_REG_R13D,\n\tX86_REG_R14D, X86_REG_R15D, X86_REG_R8W, X86_REG_R9W, X86_REG_R10W,\n\tX86_REG_R11W, X86_REG_R12W, X86_REG_R13W, X86_REG_R14W, X86_REG_R15W,\n\n\tX86_REG_ENDING\t\t// <-- mark the end of the list of registers\n} x86_reg;\n\n// Sub-flags of EFLAGS\n#define X86_EFLAGS_MODIFY_AF (1ULL << 0)\n#define X86_EFLAGS_MODIFY_CF (1ULL << 1)\n#define X86_EFLAGS_MODIFY_SF (1ULL << 2)\n#define X86_EFLAGS_MODIFY_ZF (1ULL << 3)\n#define X86_EFLAGS_MODIFY_PF (1ULL << 4)\n#define X86_EFLAGS_MODIFY_OF (1ULL << 5)\n#define X86_EFLAGS_MODIFY_TF (1ULL << 6)\n#define X86_EFLAGS_MODIFY_IF (1ULL << 7)\n#define X86_EFLAGS_MODIFY_DF (1ULL << 8)\n#define X86_EFLAGS_MODIFY_NT (1ULL << 9)\n#define X86_EFLAGS_MODIFY_RF (1ULL << 10)\n#define X86_EFLAGS_PRIOR_OF (1ULL << 11)\n#define X86_EFLAGS_PRIOR_SF (1ULL << 12)\n#define X86_EFLAGS_PRIOR_ZF (1ULL << 13)\n#define X86_EFLAGS_PRIOR_AF (1ULL << 14)\n#define X86_EFLAGS_PRIOR_PF (1ULL << 15)\n#define X86_EFLAGS_PRIOR_CF (1ULL << 16)\n#define X86_EFLAGS_PRIOR_TF (1ULL << 17)\n#define X86_EFLAGS_PRIOR_IF (1ULL << 18)\n#define X86_EFLAGS_PRIOR_DF (1ULL << 19)\n#define X86_EFLAGS_PRIOR_NT (1ULL << 20)\n#define X86_EFLAGS_RESET_OF (1ULL << 21)\n#define X86_EFLAGS_RESET_CF (1ULL << 22)\n#define X86_EFLAGS_RESET_DF (1ULL << 23)\n#define X86_EFLAGS_RESET_IF (1ULL << 24)\n#define X86_EFLAGS_RESET_SF (1ULL << 25)\n#define X86_EFLAGS_RESET_AF (1ULL << 26)\n#define X86_EFLAGS_RESET_TF (1ULL << 27)\n#define X86_EFLAGS_RESET_NT (1ULL << 28)\n#define X86_EFLAGS_RESET_PF (1ULL << 29)\n#define X86_EFLAGS_SET_CF (1ULL << 30)\n#define X86_EFLAGS_SET_DF (1ULL << 31)\n#define X86_EFLAGS_SET_IF (1ULL << 32)\n#define X86_EFLAGS_TEST_OF (1ULL << 33)\n#define X86_EFLAGS_TEST_SF (1ULL << 34)\n#define X86_EFLAGS_TEST_ZF (1ULL << 35)\n#define X86_EFLAGS_TEST_PF (1ULL << 36)\n#define X86_EFLAGS_TEST_CF (1ULL << 37)\n#define X86_EFLAGS_TEST_NT (1ULL << 38)\n#define X86_EFLAGS_TEST_DF (1ULL << 39)\n#define X86_EFLAGS_UNDEFINED_OF (1ULL << 40)\n#define X86_EFLAGS_UNDEFINED_SF (1ULL << 41)\n#define X86_EFLAGS_UNDEFINED_ZF (1ULL << 42)\n#define X86_EFLAGS_UNDEFINED_PF (1ULL << 43)\n#define X86_EFLAGS_UNDEFINED_AF (1ULL << 44)\n#define X86_EFLAGS_UNDEFINED_CF (1ULL << 45)\n#define X86_EFLAGS_RESET_RF (1ULL << 46)\n#define X86_EFLAGS_TEST_RF (1ULL << 47)\n#define X86_EFLAGS_TEST_IF (1ULL << 48)\n#define X86_EFLAGS_TEST_TF (1ULL << 49)\n#define X86_EFLAGS_TEST_AF (1ULL << 50)\n#define X86_EFLAGS_RESET_ZF (1ULL << 51)\n#define X86_EFLAGS_SET_OF (1ULL << 52)\n#define X86_EFLAGS_SET_SF (1ULL << 53)\n#define X86_EFLAGS_SET_ZF (1ULL << 54)\n#define X86_EFLAGS_SET_AF (1ULL << 55)\n#define X86_EFLAGS_SET_PF (1ULL << 56)\n#define X86_EFLAGS_RESET_0F (1ULL << 57)\n#define X86_EFLAGS_RESET_AC (1ULL << 58)\n\n#define X86_FPU_FLAGS_MODIFY_C0 (1ULL << 0)\n#define X86_FPU_FLAGS_MODIFY_C1 (1ULL << 1)\n#define X86_FPU_FLAGS_MODIFY_C2 (1ULL << 2)\n#define X86_FPU_FLAGS_MODIFY_C3 (1ULL << 3)\n#define X86_FPU_FLAGS_RESET_C0 (1ULL << 4)\n#define X86_FPU_FLAGS_RESET_C1 (1ULL << 5)\n#define X86_FPU_FLAGS_RESET_C2 (1ULL << 6)\n#define X86_FPU_FLAGS_RESET_C3 (1ULL << 7)\n#define X86_FPU_FLAGS_SET_C0 (1ULL << 8)\n#define X86_FPU_FLAGS_SET_C1 (1ULL << 9)\n#define X86_FPU_FLAGS_SET_C2 (1ULL << 10)\n#define X86_FPU_FLAGS_SET_C3 (1ULL << 11)\n#define X86_FPU_FLAGS_UNDEFINED_C0 (1ULL << 12)\n#define X86_FPU_FLAGS_UNDEFINED_C1 (1ULL << 13)\n#define X86_FPU_FLAGS_UNDEFINED_C2 (1ULL << 14)\n#define X86_FPU_FLAGS_UNDEFINED_C3 (1ULL << 15)\n#define X86_FPU_FLAGS_TEST_C0 (1ULL << 16)\n#define X86_FPU_FLAGS_TEST_C1 (1ULL << 17)\n#define X86_FPU_FLAGS_TEST_C2 (1ULL << 18)\n#define X86_FPU_FLAGS_TEST_C3 (1ULL << 19)\n\n\n/// Operand type for instruction's operands\ntypedef enum x86_op_type {\n\tX86_OP_INVALID = 0, ///< = CS_OP_INVALID (Uninitialized).\n\tX86_OP_REG, ///< = CS_OP_REG (Register operand).\n\tX86_OP_IMM, ///< = CS_OP_IMM (Immediate operand).\n\tX86_OP_MEM, ///< = CS_OP_MEM (Memory operand).\n} x86_op_type;\n\n/// XOP Code Condition type\ntypedef enum x86_xop_cc {\n\tX86_XOP_CC_INVALID = 0,\t///< Uninitialized.\n\tX86_XOP_CC_LT,\n\tX86_XOP_CC_LE,\n\tX86_XOP_CC_GT,\n\tX86_XOP_CC_GE,\n\tX86_XOP_CC_EQ,\n\tX86_XOP_CC_NEQ,\n\tX86_XOP_CC_FALSE,\n\tX86_XOP_CC_TRUE,\n} x86_xop_cc;\n\n/// AVX broadcast type\ntypedef enum x86_avx_bcast {\n\tX86_AVX_BCAST_INVALID = 0,\t///< Uninitialized.\n\tX86_AVX_BCAST_2,\t///< AVX512 broadcast type {1to2}\n\tX86_AVX_BCAST_4,\t///< AVX512 broadcast type {1to4}\n\tX86_AVX_BCAST_8,\t///< AVX512 broadcast type {1to8}\n\tX86_AVX_BCAST_16,\t///< AVX512 broadcast type {1to16}\n} x86_avx_bcast;\n\n/// SSE Code Condition type\ntypedef enum x86_sse_cc {\n\tX86_SSE_CC_INVALID = 0,\t///< Uninitialized.\n\tX86_SSE_CC_EQ,\n\tX86_SSE_CC_LT,\n\tX86_SSE_CC_LE,\n\tX86_SSE_CC_UNORD,\n\tX86_SSE_CC_NEQ,\n\tX86_SSE_CC_NLT,\n\tX86_SSE_CC_NLE,\n\tX86_SSE_CC_ORD,\n} x86_sse_cc;\n\n/// AVX Code Condition type\ntypedef enum x86_avx_cc {\n\tX86_AVX_CC_INVALID = 0,\t///< Uninitialized.\n\tX86_AVX_CC_EQ,\n\tX86_AVX_CC_LT,\n\tX86_AVX_CC_LE,\n\tX86_AVX_CC_UNORD,\n\tX86_AVX_CC_NEQ,\n\tX86_AVX_CC_NLT,\n\tX86_AVX_CC_NLE,\n\tX86_AVX_CC_ORD,\n\tX86_AVX_CC_EQ_UQ,\n\tX86_AVX_CC_NGE,\n\tX86_AVX_CC_NGT,\n\tX86_AVX_CC_FALSE,\n\tX86_AVX_CC_NEQ_OQ,\n\tX86_AVX_CC_GE,\n\tX86_AVX_CC_GT,\n\tX86_AVX_CC_TRUE,\n\tX86_AVX_CC_EQ_OS,\n\tX86_AVX_CC_LT_OQ,\n\tX86_AVX_CC_LE_OQ,\n\tX86_AVX_CC_UNORD_S,\n\tX86_AVX_CC_NEQ_US,\n\tX86_AVX_CC_NLT_UQ,\n\tX86_AVX_CC_NLE_UQ,\n\tX86_AVX_CC_ORD_S,\n\tX86_AVX_CC_EQ_US,\n\tX86_AVX_CC_NGE_UQ,\n\tX86_AVX_CC_NGT_UQ,\n\tX86_AVX_CC_FALSE_OS,\n\tX86_AVX_CC_NEQ_OS,\n\tX86_AVX_CC_GE_OQ,\n\tX86_AVX_CC_GT_OQ,\n\tX86_AVX_CC_TRUE_US,\n} x86_avx_cc;\n\n/// AVX static rounding mode type\ntypedef enum x86_avx_rm {\n\tX86_AVX_RM_INVALID = 0,\t///< Uninitialized.\n\tX86_AVX_RM_RN,\t///< Round to nearest\n\tX86_AVX_RM_RD,\t///< Round down\n\tX86_AVX_RM_RU,\t///< Round up\n\tX86_AVX_RM_RZ,\t///< Round toward zero\n} x86_avx_rm;\n\n/// Instruction prefixes - to be used in cs_x86.prefix[]\ntypedef enum x86_prefix {\n\tX86_PREFIX_LOCK\t\t= \t0xf0,\t///< lock (cs_x86.prefix[0]\n\tX86_PREFIX_REP\t\t= \t0xf3,\t///< rep (cs_x86.prefix[0]\n\tX86_PREFIX_REPE\t\t= \t0xf3,\t///< repe/repz (cs_x86.prefix[0]\n\tX86_PREFIX_REPNE\t= \t0xf2,\t///< repne/repnz (cs_x86.prefix[0]\n\n\tX86_PREFIX_CS\t\t= \t0x2e,\t///< segment override CS (cs_x86.prefix[1]\n\tX86_PREFIX_SS\t\t= \t0x36,\t///< segment override SS (cs_x86.prefix[1]\n\tX86_PREFIX_DS\t\t= \t0x3e,\t///< segment override DS (cs_x86.prefix[1]\n\tX86_PREFIX_ES\t\t= \t0x26,\t///< segment override ES (cs_x86.prefix[1]\n\tX86_PREFIX_FS\t\t= \t0x64,\t///< segment override FS (cs_x86.prefix[1]\n\tX86_PREFIX_GS\t\t= \t0x65,\t///< segment override GS (cs_x86.prefix[1]\n\n\tX86_PREFIX_OPSIZE\t=\t0x66,\t///< operand-size override (cs_x86.prefix[2]\n\tX86_PREFIX_ADDRSIZE\t=\t0x67,\t///< address-size override (cs_x86.prefix[3]\n} x86_prefix;\n\n/// Instruction's operand referring to memory\n/// This is associated with X86_OP_MEM operand type above\ntypedef struct x86_op_mem {\n\tx86_reg segment; ///< segment register (or X86_REG_INVALID if irrelevant)\n\tx86_reg base;\t///< base register (or X86_REG_INVALID if irrelevant)\n\tx86_reg index;\t///< index register (or X86_REG_INVALID if irrelevant)\n\tint scale;\t///< scale for index register\n\tint64_t disp;\t///< displacement value\n} x86_op_mem;\n\n/// Instruction operand\ntypedef struct cs_x86_op {\n\t\tx86_op_type type;\t///< operand type\n\t\tunion {\n\t\t\tx86_reg reg;\t  ///< register value for REG operand\n\t\t\tint64_t imm;\t\t///< immediate value for IMM operand\n\t\t\tx86_op_mem mem;\t\t///< base/index/scale/disp value for MEM operand\n\t\t};\n\n\t\t/// size of this operand (in bytes).\n\t\tuint8_t size;\n\n\t\t/// How is this operand accessed? (READ, WRITE or READ|WRITE)\n\t\t/// This field is combined of cs_ac_type.\n\t\t/// NOTE: this field is irrelevant if engine is compiled in DIET mode.\n\t\tuint8_t access;\n\n\t\t/// AVX broadcast type, or 0 if irrelevant\n\t\tx86_avx_bcast avx_bcast;\n\n\t\t/// AVX zero opmask {z}\n\t\tbool avx_zero_opmask;\n} cs_x86_op;\n\ntypedef struct cs_x86_encoding {\n\t/// ModR/M offset, or 0 when irrelevant\n\tuint8_t modrm_offset;\n\n\t/// Displacement offset, or 0 when irrelevant.\n\tuint8_t disp_offset;\n\tuint8_t disp_size;\n\n\t/// Immediate offset, or 0 when irrelevant.\n\tuint8_t imm_offset;\n\tuint8_t imm_size;\n} cs_x86_encoding;\n\n/// Instruction structure\ntypedef struct cs_x86 {\n\t/// Instruction prefix, which can be up to 4 bytes.\n\t/// A prefix byte gets value 0 when irrelevant.\n\t/// prefix[0] indicates REP/REPNE/LOCK prefix (See X86_PREFIX_REP/REPNE/LOCK above)\n\t/// prefix[1] indicates segment override (irrelevant for x86_64):\n\t/// See X86_PREFIX_CS/SS/DS/ES/FS/GS above.\n\t/// prefix[2] indicates operand-size override (X86_PREFIX_OPSIZE)\n\t/// prefix[3] indicates address-size override (X86_PREFIX_ADDRSIZE)\n\tuint8_t prefix[4];\n\n\t/// Instruction opcode, which can be from 1 to 4 bytes in size.\n\t/// This contains VEX opcode as well.\n\t/// An trailing opcode byte gets value 0 when irrelevant.\n\tuint8_t opcode[4];\n\n\t/// REX prefix: only a non-zero value is relevant for x86_64\n\tuint8_t rex;\n\n\t/// Address size, which can be overridden with above prefix[5].\n\tuint8_t addr_size;\n\n\t/// ModR/M byte\n\tuint8_t modrm;\n\n\t/// SIB value, or 0 when irrelevant.\n\tuint8_t sib;\n\n\t/// Displacement value, valid if encoding.disp_offset != 0\n\tint64_t disp;\n\n\t/// SIB index register, or X86_REG_INVALID when irrelevant.\n\tx86_reg sib_index;\n\t/// SIB scale, only applicable if sib_index is valid.\n\tint8_t sib_scale;\n\t/// SIB base register, or X86_REG_INVALID when irrelevant.\n\tx86_reg sib_base;\n\n\t/// XOP Code Condition\n\tx86_xop_cc xop_cc;\n\n\t/// SSE Code Condition\n\tx86_sse_cc sse_cc;\n\n\t/// AVX Code Condition\n\tx86_avx_cc avx_cc;\n\n\t/// AVX Suppress all Exception\n\tbool avx_sae;\n\n\t/// AVX static rounding mode\n\tx86_avx_rm avx_rm;\n\n\t\n\tunion {\n\t\t/// EFLAGS updated by this instruction.\n\t\t/// This can be formed from OR combination of X86_EFLAGS_* symbols in x86.h\n\t\tuint64_t eflags;\n\t\t/// FPU_FLAGS updated by this instruction.\n\t\t/// This can be formed from OR combination of X86_FPU_FLAGS_* symbols in x86.h\n\t\tuint64_t fpu_flags;\n\t};\n\n\t/// Number of operands of this instruction,\n\t/// or 0 when instruction has no operand.\n\tuint8_t op_count;\n\n\tcs_x86_op operands[8];\t///< operands for this instruction.\n\n\tcs_x86_encoding encoding;  ///< encoding information\n} cs_x86;\n\n/// X86 instructions\ntypedef enum x86_insn {\n\tX86_INS_INVALID = 0,\n\n\tX86_INS_AAA,\n\tX86_INS_AAD,\n\tX86_INS_AAM,\n\tX86_INS_AAS,\n\tX86_INS_FABS,\n\tX86_INS_ADC,\n\tX86_INS_ADCX,\n\tX86_INS_ADD,\n\tX86_INS_ADDPD,\n\tX86_INS_ADDPS,\n\tX86_INS_ADDSD,\n\tX86_INS_ADDSS,\n\tX86_INS_ADDSUBPD,\n\tX86_INS_ADDSUBPS,\n\tX86_INS_FADD,\n\tX86_INS_FIADD,\n\tX86_INS_FADDP,\n\tX86_INS_ADOX,\n\tX86_INS_AESDECLAST,\n\tX86_INS_AESDEC,\n\tX86_INS_AESENCLAST,\n\tX86_INS_AESENC,\n\tX86_INS_AESIMC,\n\tX86_INS_AESKEYGENASSIST,\n\tX86_INS_AND,\n\tX86_INS_ANDN,\n\tX86_INS_ANDNPD,\n\tX86_INS_ANDNPS,\n\tX86_INS_ANDPD,\n\tX86_INS_ANDPS,\n\tX86_INS_ARPL,\n\tX86_INS_BEXTR,\n\tX86_INS_BLCFILL,\n\tX86_INS_BLCI,\n\tX86_INS_BLCIC,\n\tX86_INS_BLCMSK,\n\tX86_INS_BLCS,\n\tX86_INS_BLENDPD,\n\tX86_INS_BLENDPS,\n\tX86_INS_BLENDVPD,\n\tX86_INS_BLENDVPS,\n\tX86_INS_BLSFILL,\n\tX86_INS_BLSI,\n\tX86_INS_BLSIC,\n\tX86_INS_BLSMSK,\n\tX86_INS_BLSR,\n\tX86_INS_BOUND,\n\tX86_INS_BSF,\n\tX86_INS_BSR,\n\tX86_INS_BSWAP,\n\tX86_INS_BT,\n\tX86_INS_BTC,\n\tX86_INS_BTR,\n\tX86_INS_BTS,\n\tX86_INS_BZHI,\n\tX86_INS_CALL,\n\tX86_INS_CBW,\n\tX86_INS_CDQ,\n\tX86_INS_CDQE,\n\tX86_INS_FCHS,\n\tX86_INS_CLAC,\n\tX86_INS_CLC,\n\tX86_INS_CLD,\n\tX86_INS_CLFLUSH,\n\tX86_INS_CLFLUSHOPT,\n\tX86_INS_CLGI,\n\tX86_INS_CLI,\n\tX86_INS_CLTS,\n\tX86_INS_CLWB,\n\tX86_INS_CMC,\n\tX86_INS_CMOVA,\n\tX86_INS_CMOVAE,\n\tX86_INS_CMOVB,\n\tX86_INS_CMOVBE,\n\tX86_INS_FCMOVBE,\n\tX86_INS_FCMOVB,\n\tX86_INS_CMOVE,\n\tX86_INS_FCMOVE,\n\tX86_INS_CMOVG,\n\tX86_INS_CMOVGE,\n\tX86_INS_CMOVL,\n\tX86_INS_CMOVLE,\n\tX86_INS_FCMOVNBE,\n\tX86_INS_FCMOVNB,\n\tX86_INS_CMOVNE,\n\tX86_INS_FCMOVNE,\n\tX86_INS_CMOVNO,\n\tX86_INS_CMOVNP,\n\tX86_INS_FCMOVNU,\n\tX86_INS_CMOVNS,\n\tX86_INS_CMOVO,\n\tX86_INS_CMOVP,\n\tX86_INS_FCMOVU,\n\tX86_INS_CMOVS,\n\tX86_INS_CMP,\n\tX86_INS_CMPSB,\n\tX86_INS_CMPSQ,\n\tX86_INS_CMPSW,\n\tX86_INS_CMPXCHG16B,\n\tX86_INS_CMPXCHG,\n\tX86_INS_CMPXCHG8B,\n\tX86_INS_COMISD,\n\tX86_INS_COMISS,\n\tX86_INS_FCOMP,\n\tX86_INS_FCOMIP,\n\tX86_INS_FCOMI,\n\tX86_INS_FCOM,\n\tX86_INS_FCOS,\n\tX86_INS_CPUID,\n\tX86_INS_CQO,\n\tX86_INS_CRC32,\n\tX86_INS_CVTDQ2PD,\n\tX86_INS_CVTDQ2PS,\n\tX86_INS_CVTPD2DQ,\n\tX86_INS_CVTPD2PS,\n\tX86_INS_CVTPS2DQ,\n\tX86_INS_CVTPS2PD,\n\tX86_INS_CVTSD2SI,\n\tX86_INS_CVTSD2SS,\n\tX86_INS_CVTSI2SD,\n\tX86_INS_CVTSI2SS,\n\tX86_INS_CVTSS2SD,\n\tX86_INS_CVTSS2SI,\n\tX86_INS_CVTTPD2DQ,\n\tX86_INS_CVTTPS2DQ,\n\tX86_INS_CVTTSD2SI,\n\tX86_INS_CVTTSS2SI,\n\tX86_INS_CWD,\n\tX86_INS_CWDE,\n\tX86_INS_DAA,\n\tX86_INS_DAS,\n\tX86_INS_DATA16,\n\tX86_INS_DEC,\n\tX86_INS_DIV,\n\tX86_INS_DIVPD,\n\tX86_INS_DIVPS,\n\tX86_INS_FDIVR,\n\tX86_INS_FIDIVR,\n\tX86_INS_FDIVRP,\n\tX86_INS_DIVSD,\n\tX86_INS_DIVSS,\n\tX86_INS_FDIV,\n\tX86_INS_FIDIV,\n\tX86_INS_FDIVP,\n\tX86_INS_DPPD,\n\tX86_INS_DPPS,\n\tX86_INS_RET,\n\tX86_INS_ENCLS,\n\tX86_INS_ENCLU,\n\tX86_INS_ENTER,\n\tX86_INS_EXTRACTPS,\n\tX86_INS_EXTRQ,\n\tX86_INS_F2XM1,\n\tX86_INS_LCALL,\n\tX86_INS_LJMP,\n\tX86_INS_FBLD,\n\tX86_INS_FBSTP,\n\tX86_INS_FCOMPP,\n\tX86_INS_FDECSTP,\n\tX86_INS_FEMMS,\n\tX86_INS_FFREE,\n\tX86_INS_FICOM,\n\tX86_INS_FICOMP,\n\tX86_INS_FINCSTP,\n\tX86_INS_FLDCW,\n\tX86_INS_FLDENV,\n\tX86_INS_FLDL2E,\n\tX86_INS_FLDL2T,\n\tX86_INS_FLDLG2,\n\tX86_INS_FLDLN2,\n\tX86_INS_FLDPI,\n\tX86_INS_FNCLEX,\n\tX86_INS_FNINIT,\n\tX86_INS_FNOP,\n\tX86_INS_FNSTCW,\n\tX86_INS_FNSTSW,\n\tX86_INS_FPATAN,\n\tX86_INS_FPREM,\n\tX86_INS_FPREM1,\n\tX86_INS_FPTAN,\n\tX86_INS_FFREEP,\n\tX86_INS_FRNDINT,\n\tX86_INS_FRSTOR,\n\tX86_INS_FNSAVE,\n\tX86_INS_FSCALE,\n\tX86_INS_FSETPM,\n\tX86_INS_FSINCOS,\n\tX86_INS_FNSTENV,\n\tX86_INS_FXAM,\n\tX86_INS_FXRSTOR,\n\tX86_INS_FXRSTOR64,\n\tX86_INS_FXSAVE,\n\tX86_INS_FXSAVE64,\n\tX86_INS_FXTRACT,\n\tX86_INS_FYL2X,\n\tX86_INS_FYL2XP1,\n\tX86_INS_MOVAPD,\n\tX86_INS_MOVAPS,\n\tX86_INS_ORPD,\n\tX86_INS_ORPS,\n\tX86_INS_VMOVAPD,\n\tX86_INS_VMOVAPS,\n\tX86_INS_XORPD,\n\tX86_INS_XORPS,\n\tX86_INS_GETSEC,\n\tX86_INS_HADDPD,\n\tX86_INS_HADDPS,\n\tX86_INS_HLT,\n\tX86_INS_HSUBPD,\n\tX86_INS_HSUBPS,\n\tX86_INS_IDIV,\n\tX86_INS_FILD,\n\tX86_INS_IMUL,\n\tX86_INS_IN,\n\tX86_INS_INC,\n\tX86_INS_INSB,\n\tX86_INS_INSERTPS,\n\tX86_INS_INSERTQ,\n\tX86_INS_INSD,\n\tX86_INS_INSW,\n\tX86_INS_INT,\n\tX86_INS_INT1,\n\tX86_INS_INT3,\n\tX86_INS_INTO,\n\tX86_INS_INVD,\n\tX86_INS_INVEPT,\n\tX86_INS_INVLPG,\n\tX86_INS_INVLPGA,\n\tX86_INS_INVPCID,\n\tX86_INS_INVVPID,\n\tX86_INS_IRET,\n\tX86_INS_IRETD,\n\tX86_INS_IRETQ,\n\tX86_INS_FISTTP,\n\tX86_INS_FIST,\n\tX86_INS_FISTP,\n\tX86_INS_UCOMISD,\n\tX86_INS_UCOMISS,\n\tX86_INS_VCOMISD,\n\tX86_INS_VCOMISS,\n\tX86_INS_VCVTSD2SS,\n\tX86_INS_VCVTSI2SD,\n\tX86_INS_VCVTSI2SS,\n\tX86_INS_VCVTSS2SD,\n\tX86_INS_VCVTTSD2SI,\n\tX86_INS_VCVTTSD2USI,\n\tX86_INS_VCVTTSS2SI,\n\tX86_INS_VCVTTSS2USI,\n\tX86_INS_VCVTUSI2SD,\n\tX86_INS_VCVTUSI2SS,\n\tX86_INS_VUCOMISD,\n\tX86_INS_VUCOMISS,\n\tX86_INS_JAE,\n\tX86_INS_JA,\n\tX86_INS_JBE,\n\tX86_INS_JB,\n\tX86_INS_JCXZ,\n\tX86_INS_JECXZ,\n\tX86_INS_JE,\n\tX86_INS_JGE,\n\tX86_INS_JG,\n\tX86_INS_JLE,\n\tX86_INS_JL,\n\tX86_INS_JMP,\n\tX86_INS_JNE,\n\tX86_INS_JNO,\n\tX86_INS_JNP,\n\tX86_INS_JNS,\n\tX86_INS_JO,\n\tX86_INS_JP,\n\tX86_INS_JRCXZ,\n\tX86_INS_JS,\n\tX86_INS_KANDB,\n\tX86_INS_KANDD,\n\tX86_INS_KANDNB,\n\tX86_INS_KANDND,\n\tX86_INS_KANDNQ,\n\tX86_INS_KANDNW,\n\tX86_INS_KANDQ,\n\tX86_INS_KANDW,\n\tX86_INS_KMOVB,\n\tX86_INS_KMOVD,\n\tX86_INS_KMOVQ,\n\tX86_INS_KMOVW,\n\tX86_INS_KNOTB,\n\tX86_INS_KNOTD,\n\tX86_INS_KNOTQ,\n\tX86_INS_KNOTW,\n\tX86_INS_KORB,\n\tX86_INS_KORD,\n\tX86_INS_KORQ,\n\tX86_INS_KORTESTB,\n\tX86_INS_KORTESTD,\n\tX86_INS_KORTESTQ,\n\tX86_INS_KORTESTW,\n\tX86_INS_KORW,\n\tX86_INS_KSHIFTLB,\n\tX86_INS_KSHIFTLD,\n\tX86_INS_KSHIFTLQ,\n\tX86_INS_KSHIFTLW,\n\tX86_INS_KSHIFTRB,\n\tX86_INS_KSHIFTRD,\n\tX86_INS_KSHIFTRQ,\n\tX86_INS_KSHIFTRW,\n\tX86_INS_KUNPCKBW,\n\tX86_INS_KXNORB,\n\tX86_INS_KXNORD,\n\tX86_INS_KXNORQ,\n\tX86_INS_KXNORW,\n\tX86_INS_KXORB,\n\tX86_INS_KXORD,\n\tX86_INS_KXORQ,\n\tX86_INS_KXORW,\n\tX86_INS_LAHF,\n\tX86_INS_LAR,\n\tX86_INS_LDDQU,\n\tX86_INS_LDMXCSR,\n\tX86_INS_LDS,\n\tX86_INS_FLDZ,\n\tX86_INS_FLD1,\n\tX86_INS_FLD,\n\tX86_INS_LEA,\n\tX86_INS_LEAVE,\n\tX86_INS_LES,\n\tX86_INS_LFENCE,\n\tX86_INS_LFS,\n\tX86_INS_LGDT,\n\tX86_INS_LGS,\n\tX86_INS_LIDT,\n\tX86_INS_LLDT,\n\tX86_INS_LMSW,\n\tX86_INS_OR,\n\tX86_INS_SUB,\n\tX86_INS_XOR,\n\tX86_INS_LODSB,\n\tX86_INS_LODSD,\n\tX86_INS_LODSQ,\n\tX86_INS_LODSW,\n\tX86_INS_LOOP,\n\tX86_INS_LOOPE,\n\tX86_INS_LOOPNE,\n\tX86_INS_RETF,\n\tX86_INS_RETFQ,\n\tX86_INS_LSL,\n\tX86_INS_LSS,\n\tX86_INS_LTR,\n\tX86_INS_XADD,\n\tX86_INS_LZCNT,\n\tX86_INS_MASKMOVDQU,\n\tX86_INS_MAXPD,\n\tX86_INS_MAXPS,\n\tX86_INS_MAXSD,\n\tX86_INS_MAXSS,\n\tX86_INS_MFENCE,\n\tX86_INS_MINPD,\n\tX86_INS_MINPS,\n\tX86_INS_MINSD,\n\tX86_INS_MINSS,\n\tX86_INS_CVTPD2PI,\n\tX86_INS_CVTPI2PD,\n\tX86_INS_CVTPI2PS,\n\tX86_INS_CVTPS2PI,\n\tX86_INS_CVTTPD2PI,\n\tX86_INS_CVTTPS2PI,\n\tX86_INS_EMMS,\n\tX86_INS_MASKMOVQ,\n\tX86_INS_MOVD,\n\tX86_INS_MOVDQ2Q,\n\tX86_INS_MOVNTQ,\n\tX86_INS_MOVQ2DQ,\n\tX86_INS_MOVQ,\n\tX86_INS_PABSB,\n\tX86_INS_PABSD,\n\tX86_INS_PABSW,\n\tX86_INS_PACKSSDW,\n\tX86_INS_PACKSSWB,\n\tX86_INS_PACKUSWB,\n\tX86_INS_PADDB,\n\tX86_INS_PADDD,\n\tX86_INS_PADDQ,\n\tX86_INS_PADDSB,\n\tX86_INS_PADDSW,\n\tX86_INS_PADDUSB,\n\tX86_INS_PADDUSW,\n\tX86_INS_PADDW,\n\tX86_INS_PALIGNR,\n\tX86_INS_PANDN,\n\tX86_INS_PAND,\n\tX86_INS_PAVGB,\n\tX86_INS_PAVGW,\n\tX86_INS_PCMPEQB,\n\tX86_INS_PCMPEQD,\n\tX86_INS_PCMPEQW,\n\tX86_INS_PCMPGTB,\n\tX86_INS_PCMPGTD,\n\tX86_INS_PCMPGTW,\n\tX86_INS_PEXTRW,\n\tX86_INS_PHADDSW,\n\tX86_INS_PHADDW,\n\tX86_INS_PHADDD,\n\tX86_INS_PHSUBD,\n\tX86_INS_PHSUBSW,\n\tX86_INS_PHSUBW,\n\tX86_INS_PINSRW,\n\tX86_INS_PMADDUBSW,\n\tX86_INS_PMADDWD,\n\tX86_INS_PMAXSW,\n\tX86_INS_PMAXUB,\n\tX86_INS_PMINSW,\n\tX86_INS_PMINUB,\n\tX86_INS_PMOVMSKB,\n\tX86_INS_PMULHRSW,\n\tX86_INS_PMULHUW,\n\tX86_INS_PMULHW,\n\tX86_INS_PMULLW,\n\tX86_INS_PMULUDQ,\n\tX86_INS_POR,\n\tX86_INS_PSADBW,\n\tX86_INS_PSHUFB,\n\tX86_INS_PSHUFW,\n\tX86_INS_PSIGNB,\n\tX86_INS_PSIGND,\n\tX86_INS_PSIGNW,\n\tX86_INS_PSLLD,\n\tX86_INS_PSLLQ,\n\tX86_INS_PSLLW,\n\tX86_INS_PSRAD,\n\tX86_INS_PSRAW,\n\tX86_INS_PSRLD,\n\tX86_INS_PSRLQ,\n\tX86_INS_PSRLW,\n\tX86_INS_PSUBB,\n\tX86_INS_PSUBD,\n\tX86_INS_PSUBQ,\n\tX86_INS_PSUBSB,\n\tX86_INS_PSUBSW,\n\tX86_INS_PSUBUSB,\n\tX86_INS_PSUBUSW,\n\tX86_INS_PSUBW,\n\tX86_INS_PUNPCKHBW,\n\tX86_INS_PUNPCKHDQ,\n\tX86_INS_PUNPCKHWD,\n\tX86_INS_PUNPCKLBW,\n\tX86_INS_PUNPCKLDQ,\n\tX86_INS_PUNPCKLWD,\n\tX86_INS_PXOR,\n\tX86_INS_MONITOR,\n\tX86_INS_MONTMUL,\n\tX86_INS_MOV,\n\tX86_INS_MOVABS,\n\tX86_INS_MOVBE,\n\tX86_INS_MOVDDUP,\n\tX86_INS_MOVDQA,\n\tX86_INS_MOVDQU,\n\tX86_INS_MOVHLPS,\n\tX86_INS_MOVHPD,\n\tX86_INS_MOVHPS,\n\tX86_INS_MOVLHPS,\n\tX86_INS_MOVLPD,\n\tX86_INS_MOVLPS,\n\tX86_INS_MOVMSKPD,\n\tX86_INS_MOVMSKPS,\n\tX86_INS_MOVNTDQA,\n\tX86_INS_MOVNTDQ,\n\tX86_INS_MOVNTI,\n\tX86_INS_MOVNTPD,\n\tX86_INS_MOVNTPS,\n\tX86_INS_MOVNTSD,\n\tX86_INS_MOVNTSS,\n\tX86_INS_MOVSB,\n\tX86_INS_MOVSD,\n\tX86_INS_MOVSHDUP,\n\tX86_INS_MOVSLDUP,\n\tX86_INS_MOVSQ,\n\tX86_INS_MOVSS,\n\tX86_INS_MOVSW,\n\tX86_INS_MOVSX,\n\tX86_INS_MOVSXD,\n\tX86_INS_MOVUPD,\n\tX86_INS_MOVUPS,\n\tX86_INS_MOVZX,\n\tX86_INS_MPSADBW,\n\tX86_INS_MUL,\n\tX86_INS_MULPD,\n\tX86_INS_MULPS,\n\tX86_INS_MULSD,\n\tX86_INS_MULSS,\n\tX86_INS_MULX,\n\tX86_INS_FMUL,\n\tX86_INS_FIMUL,\n\tX86_INS_FMULP,\n\tX86_INS_MWAIT,\n\tX86_INS_NEG,\n\tX86_INS_NOP,\n\tX86_INS_NOT,\n\tX86_INS_OUT,\n\tX86_INS_OUTSB,\n\tX86_INS_OUTSD,\n\tX86_INS_OUTSW,\n\tX86_INS_PACKUSDW,\n\tX86_INS_PAUSE,\n\tX86_INS_PAVGUSB,\n\tX86_INS_PBLENDVB,\n\tX86_INS_PBLENDW,\n\tX86_INS_PCLMULQDQ,\n\tX86_INS_PCMPEQQ,\n\tX86_INS_PCMPESTRI,\n\tX86_INS_PCMPESTRM,\n\tX86_INS_PCMPGTQ,\n\tX86_INS_PCMPISTRI,\n\tX86_INS_PCMPISTRM,\n\tX86_INS_PCOMMIT,\n\tX86_INS_PDEP,\n\tX86_INS_PEXT,\n\tX86_INS_PEXTRB,\n\tX86_INS_PEXTRD,\n\tX86_INS_PEXTRQ,\n\tX86_INS_PF2ID,\n\tX86_INS_PF2IW,\n\tX86_INS_PFACC,\n\tX86_INS_PFADD,\n\tX86_INS_PFCMPEQ,\n\tX86_INS_PFCMPGE,\n\tX86_INS_PFCMPGT,\n\tX86_INS_PFMAX,\n\tX86_INS_PFMIN,\n\tX86_INS_PFMUL,\n\tX86_INS_PFNACC,\n\tX86_INS_PFPNACC,\n\tX86_INS_PFRCPIT1,\n\tX86_INS_PFRCPIT2,\n\tX86_INS_PFRCP,\n\tX86_INS_PFRSQIT1,\n\tX86_INS_PFRSQRT,\n\tX86_INS_PFSUBR,\n\tX86_INS_PFSUB,\n\tX86_INS_PHMINPOSUW,\n\tX86_INS_PI2FD,\n\tX86_INS_PI2FW,\n\tX86_INS_PINSRB,\n\tX86_INS_PINSRD,\n\tX86_INS_PINSRQ,\n\tX86_INS_PMAXSB,\n\tX86_INS_PMAXSD,\n\tX86_INS_PMAXUD,\n\tX86_INS_PMAXUW,\n\tX86_INS_PMINSB,\n\tX86_INS_PMINSD,\n\tX86_INS_PMINUD,\n\tX86_INS_PMINUW,\n\tX86_INS_PMOVSXBD,\n\tX86_INS_PMOVSXBQ,\n\tX86_INS_PMOVSXBW,\n\tX86_INS_PMOVSXDQ,\n\tX86_INS_PMOVSXWD,\n\tX86_INS_PMOVSXWQ,\n\tX86_INS_PMOVZXBD,\n\tX86_INS_PMOVZXBQ,\n\tX86_INS_PMOVZXBW,\n\tX86_INS_PMOVZXDQ,\n\tX86_INS_PMOVZXWD,\n\tX86_INS_PMOVZXWQ,\n\tX86_INS_PMULDQ,\n\tX86_INS_PMULHRW,\n\tX86_INS_PMULLD,\n\tX86_INS_POP,\n\tX86_INS_POPAW,\n\tX86_INS_POPAL,\n\tX86_INS_POPCNT,\n\tX86_INS_POPF,\n\tX86_INS_POPFD,\n\tX86_INS_POPFQ,\n\tX86_INS_PREFETCH,\n\tX86_INS_PREFETCHNTA,\n\tX86_INS_PREFETCHT0,\n\tX86_INS_PREFETCHT1,\n\tX86_INS_PREFETCHT2,\n\tX86_INS_PREFETCHW,\n\tX86_INS_PSHUFD,\n\tX86_INS_PSHUFHW,\n\tX86_INS_PSHUFLW,\n\tX86_INS_PSLLDQ,\n\tX86_INS_PSRLDQ,\n\tX86_INS_PSWAPD,\n\tX86_INS_PTEST,\n\tX86_INS_PUNPCKHQDQ,\n\tX86_INS_PUNPCKLQDQ,\n\tX86_INS_PUSH,\n\tX86_INS_PUSHAW,\n\tX86_INS_PUSHAL,\n\tX86_INS_PUSHF,\n\tX86_INS_PUSHFD,\n\tX86_INS_PUSHFQ,\n\tX86_INS_RCL,\n\tX86_INS_RCPPS,\n\tX86_INS_RCPSS,\n\tX86_INS_RCR,\n\tX86_INS_RDFSBASE,\n\tX86_INS_RDGSBASE,\n\tX86_INS_RDMSR,\n\tX86_INS_RDPMC,\n\tX86_INS_RDRAND,\n\tX86_INS_RDSEED,\n\tX86_INS_RDTSC,\n\tX86_INS_RDTSCP,\n\tX86_INS_ROL,\n\tX86_INS_ROR,\n\tX86_INS_RORX,\n\tX86_INS_ROUNDPD,\n\tX86_INS_ROUNDPS,\n\tX86_INS_ROUNDSD,\n\tX86_INS_ROUNDSS,\n\tX86_INS_RSM,\n\tX86_INS_RSQRTPS,\n\tX86_INS_RSQRTSS,\n\tX86_INS_SAHF,\n\tX86_INS_SAL,\n\tX86_INS_SALC,\n\tX86_INS_SAR,\n\tX86_INS_SARX,\n\tX86_INS_SBB,\n\tX86_INS_SCASB,\n\tX86_INS_SCASD,\n\tX86_INS_SCASQ,\n\tX86_INS_SCASW,\n\tX86_INS_SETAE,\n\tX86_INS_SETA,\n\tX86_INS_SETBE,\n\tX86_INS_SETB,\n\tX86_INS_SETE,\n\tX86_INS_SETGE,\n\tX86_INS_SETG,\n\tX86_INS_SETLE,\n\tX86_INS_SETL,\n\tX86_INS_SETNE,\n\tX86_INS_SETNO,\n\tX86_INS_SETNP,\n\tX86_INS_SETNS,\n\tX86_INS_SETO,\n\tX86_INS_SETP,\n\tX86_INS_SETS,\n\tX86_INS_SFENCE,\n\tX86_INS_SGDT,\n\tX86_INS_SHA1MSG1,\n\tX86_INS_SHA1MSG2,\n\tX86_INS_SHA1NEXTE,\n\tX86_INS_SHA1RNDS4,\n\tX86_INS_SHA256MSG1,\n\tX86_INS_SHA256MSG2,\n\tX86_INS_SHA256RNDS2,\n\tX86_INS_SHL,\n\tX86_INS_SHLD,\n\tX86_INS_SHLX,\n\tX86_INS_SHR,\n\tX86_INS_SHRD,\n\tX86_INS_SHRX,\n\tX86_INS_SHUFPD,\n\tX86_INS_SHUFPS,\n\tX86_INS_SIDT,\n\tX86_INS_FSIN,\n\tX86_INS_SKINIT,\n\tX86_INS_SLDT,\n\tX86_INS_SMSW,\n\tX86_INS_SQRTPD,\n\tX86_INS_SQRTPS,\n\tX86_INS_SQRTSD,\n\tX86_INS_SQRTSS,\n\tX86_INS_FSQRT,\n\tX86_INS_STAC,\n\tX86_INS_STC,\n\tX86_INS_STD,\n\tX86_INS_STGI,\n\tX86_INS_STI,\n\tX86_INS_STMXCSR,\n\tX86_INS_STOSB,\n\tX86_INS_STOSD,\n\tX86_INS_STOSQ,\n\tX86_INS_STOSW,\n\tX86_INS_STR,\n\tX86_INS_FST,\n\tX86_INS_FSTP,\n\tX86_INS_FSTPNCE,\n\tX86_INS_FXCH,\n\tX86_INS_SUBPD,\n\tX86_INS_SUBPS,\n\tX86_INS_FSUBR,\n\tX86_INS_FISUBR,\n\tX86_INS_FSUBRP,\n\tX86_INS_SUBSD,\n\tX86_INS_SUBSS,\n\tX86_INS_FSUB,\n\tX86_INS_FISUB,\n\tX86_INS_FSUBP,\n\tX86_INS_SWAPGS,\n\tX86_INS_SYSCALL,\n\tX86_INS_SYSENTER,\n\tX86_INS_SYSEXIT,\n\tX86_INS_SYSRET,\n\tX86_INS_T1MSKC,\n\tX86_INS_TEST,\n\tX86_INS_UD2,\n\tX86_INS_FTST,\n\tX86_INS_TZCNT,\n\tX86_INS_TZMSK,\n\tX86_INS_FUCOMIP,\n\tX86_INS_FUCOMI,\n\tX86_INS_FUCOMPP,\n\tX86_INS_FUCOMP,\n\tX86_INS_FUCOM,\n\tX86_INS_UD2B,\n\tX86_INS_UNPCKHPD,\n\tX86_INS_UNPCKHPS,\n\tX86_INS_UNPCKLPD,\n\tX86_INS_UNPCKLPS,\n\tX86_INS_VADDPD,\n\tX86_INS_VADDPS,\n\tX86_INS_VADDSD,\n\tX86_INS_VADDSS,\n\tX86_INS_VADDSUBPD,\n\tX86_INS_VADDSUBPS,\n\tX86_INS_VAESDECLAST,\n\tX86_INS_VAESDEC,\n\tX86_INS_VAESENCLAST,\n\tX86_INS_VAESENC,\n\tX86_INS_VAESIMC,\n\tX86_INS_VAESKEYGENASSIST,\n\tX86_INS_VALIGND,\n\tX86_INS_VALIGNQ,\n\tX86_INS_VANDNPD,\n\tX86_INS_VANDNPS,\n\tX86_INS_VANDPD,\n\tX86_INS_VANDPS,\n\tX86_INS_VBLENDMPD,\n\tX86_INS_VBLENDMPS,\n\tX86_INS_VBLENDPD,\n\tX86_INS_VBLENDPS,\n\tX86_INS_VBLENDVPD,\n\tX86_INS_VBLENDVPS,\n\tX86_INS_VBROADCASTF128,\n\tX86_INS_VBROADCASTI32X4,\n\tX86_INS_VBROADCASTI64X4,\n\tX86_INS_VBROADCASTSD,\n\tX86_INS_VBROADCASTSS,\n\tX86_INS_VCOMPRESSPD,\n\tX86_INS_VCOMPRESSPS,\n\tX86_INS_VCVTDQ2PD,\n\tX86_INS_VCVTDQ2PS,\n\tX86_INS_VCVTPD2DQX,\n\tX86_INS_VCVTPD2DQ,\n\tX86_INS_VCVTPD2PSX,\n\tX86_INS_VCVTPD2PS,\n\tX86_INS_VCVTPD2UDQ,\n\tX86_INS_VCVTPH2PS,\n\tX86_INS_VCVTPS2DQ,\n\tX86_INS_VCVTPS2PD,\n\tX86_INS_VCVTPS2PH,\n\tX86_INS_VCVTPS2UDQ,\n\tX86_INS_VCVTSD2SI,\n\tX86_INS_VCVTSD2USI,\n\tX86_INS_VCVTSS2SI,\n\tX86_INS_VCVTSS2USI,\n\tX86_INS_VCVTTPD2DQX,\n\tX86_INS_VCVTTPD2DQ,\n\tX86_INS_VCVTTPD2UDQ,\n\tX86_INS_VCVTTPS2DQ,\n\tX86_INS_VCVTTPS2UDQ,\n\tX86_INS_VCVTUDQ2PD,\n\tX86_INS_VCVTUDQ2PS,\n\tX86_INS_VDIVPD,\n\tX86_INS_VDIVPS,\n\tX86_INS_VDIVSD,\n\tX86_INS_VDIVSS,\n\tX86_INS_VDPPD,\n\tX86_INS_VDPPS,\n\tX86_INS_VERR,\n\tX86_INS_VERW,\n\tX86_INS_VEXP2PD,\n\tX86_INS_VEXP2PS,\n\tX86_INS_VEXPANDPD,\n\tX86_INS_VEXPANDPS,\n\tX86_INS_VEXTRACTF128,\n\tX86_INS_VEXTRACTF32X4,\n\tX86_INS_VEXTRACTF64X4,\n\tX86_INS_VEXTRACTI128,\n\tX86_INS_VEXTRACTI32X4,\n\tX86_INS_VEXTRACTI64X4,\n\tX86_INS_VEXTRACTPS,\n\tX86_INS_VFMADD132PD,\n\tX86_INS_VFMADD132PS,\n\tX86_INS_VFMADDPD,\n\tX86_INS_VFMADD213PD,\n\tX86_INS_VFMADD231PD,\n\tX86_INS_VFMADDPS,\n\tX86_INS_VFMADD213PS,\n\tX86_INS_VFMADD231PS,\n\tX86_INS_VFMADDSD,\n\tX86_INS_VFMADD213SD,\n\tX86_INS_VFMADD132SD,\n\tX86_INS_VFMADD231SD,\n\tX86_INS_VFMADDSS,\n\tX86_INS_VFMADD213SS,\n\tX86_INS_VFMADD132SS,\n\tX86_INS_VFMADD231SS,\n\tX86_INS_VFMADDSUB132PD,\n\tX86_INS_VFMADDSUB132PS,\n\tX86_INS_VFMADDSUBPD,\n\tX86_INS_VFMADDSUB213PD,\n\tX86_INS_VFMADDSUB231PD,\n\tX86_INS_VFMADDSUBPS,\n\tX86_INS_VFMADDSUB213PS,\n\tX86_INS_VFMADDSUB231PS,\n\tX86_INS_VFMSUB132PD,\n\tX86_INS_VFMSUB132PS,\n\tX86_INS_VFMSUBADD132PD,\n\tX86_INS_VFMSUBADD132PS,\n\tX86_INS_VFMSUBADDPD,\n\tX86_INS_VFMSUBADD213PD,\n\tX86_INS_VFMSUBADD231PD,\n\tX86_INS_VFMSUBADDPS,\n\tX86_INS_VFMSUBADD213PS,\n\tX86_INS_VFMSUBADD231PS,\n\tX86_INS_VFMSUBPD,\n\tX86_INS_VFMSUB213PD,\n\tX86_INS_VFMSUB231PD,\n\tX86_INS_VFMSUBPS,\n\tX86_INS_VFMSUB213PS,\n\tX86_INS_VFMSUB231PS,\n\tX86_INS_VFMSUBSD,\n\tX86_INS_VFMSUB213SD,\n\tX86_INS_VFMSUB132SD,\n\tX86_INS_VFMSUB231SD,\n\tX86_INS_VFMSUBSS,\n\tX86_INS_VFMSUB213SS,\n\tX86_INS_VFMSUB132SS,\n\tX86_INS_VFMSUB231SS,\n\tX86_INS_VFNMADD132PD,\n\tX86_INS_VFNMADD132PS,\n\tX86_INS_VFNMADDPD,\n\tX86_INS_VFNMADD213PD,\n\tX86_INS_VFNMADD231PD,\n\tX86_INS_VFNMADDPS,\n\tX86_INS_VFNMADD213PS,\n\tX86_INS_VFNMADD231PS,\n\tX86_INS_VFNMADDSD,\n\tX86_INS_VFNMADD213SD,\n\tX86_INS_VFNMADD132SD,\n\tX86_INS_VFNMADD231SD,\n\tX86_INS_VFNMADDSS,\n\tX86_INS_VFNMADD213SS,\n\tX86_INS_VFNMADD132SS,\n\tX86_INS_VFNMADD231SS,\n\tX86_INS_VFNMSUB132PD,\n\tX86_INS_VFNMSUB132PS,\n\tX86_INS_VFNMSUBPD,\n\tX86_INS_VFNMSUB213PD,\n\tX86_INS_VFNMSUB231PD,\n\tX86_INS_VFNMSUBPS,\n\tX86_INS_VFNMSUB213PS,\n\tX86_INS_VFNMSUB231PS,\n\tX86_INS_VFNMSUBSD,\n\tX86_INS_VFNMSUB213SD,\n\tX86_INS_VFNMSUB132SD,\n\tX86_INS_VFNMSUB231SD,\n\tX86_INS_VFNMSUBSS,\n\tX86_INS_VFNMSUB213SS,\n\tX86_INS_VFNMSUB132SS,\n\tX86_INS_VFNMSUB231SS,\n\tX86_INS_VFRCZPD,\n\tX86_INS_VFRCZPS,\n\tX86_INS_VFRCZSD,\n\tX86_INS_VFRCZSS,\n\tX86_INS_VORPD,\n\tX86_INS_VORPS,\n\tX86_INS_VXORPD,\n\tX86_INS_VXORPS,\n\tX86_INS_VGATHERDPD,\n\tX86_INS_VGATHERDPS,\n\tX86_INS_VGATHERPF0DPD,\n\tX86_INS_VGATHERPF0DPS,\n\tX86_INS_VGATHERPF0QPD,\n\tX86_INS_VGATHERPF0QPS,\n\tX86_INS_VGATHERPF1DPD,\n\tX86_INS_VGATHERPF1DPS,\n\tX86_INS_VGATHERPF1QPD,\n\tX86_INS_VGATHERPF1QPS,\n\tX86_INS_VGATHERQPD,\n\tX86_INS_VGATHERQPS,\n\tX86_INS_VHADDPD,\n\tX86_INS_VHADDPS,\n\tX86_INS_VHSUBPD,\n\tX86_INS_VHSUBPS,\n\tX86_INS_VINSERTF128,\n\tX86_INS_VINSERTF32X4,\n\tX86_INS_VINSERTF32X8,\n\tX86_INS_VINSERTF64X2,\n\tX86_INS_VINSERTF64X4,\n\tX86_INS_VINSERTI128,\n\tX86_INS_VINSERTI32X4,\n\tX86_INS_VINSERTI32X8,\n\tX86_INS_VINSERTI64X2,\n\tX86_INS_VINSERTI64X4,\n\tX86_INS_VINSERTPS,\n\tX86_INS_VLDDQU,\n\tX86_INS_VLDMXCSR,\n\tX86_INS_VMASKMOVDQU,\n\tX86_INS_VMASKMOVPD,\n\tX86_INS_VMASKMOVPS,\n\tX86_INS_VMAXPD,\n\tX86_INS_VMAXPS,\n\tX86_INS_VMAXSD,\n\tX86_INS_VMAXSS,\n\tX86_INS_VMCALL,\n\tX86_INS_VMCLEAR,\n\tX86_INS_VMFUNC,\n\tX86_INS_VMINPD,\n\tX86_INS_VMINPS,\n\tX86_INS_VMINSD,\n\tX86_INS_VMINSS,\n\tX86_INS_VMLAUNCH,\n\tX86_INS_VMLOAD,\n\tX86_INS_VMMCALL,\n\tX86_INS_VMOVQ,\n\tX86_INS_VMOVDDUP,\n\tX86_INS_VMOVD,\n\tX86_INS_VMOVDQA32,\n\tX86_INS_VMOVDQA64,\n\tX86_INS_VMOVDQA,\n\tX86_INS_VMOVDQU16,\n\tX86_INS_VMOVDQU32,\n\tX86_INS_VMOVDQU64,\n\tX86_INS_VMOVDQU8,\n\tX86_INS_VMOVDQU,\n\tX86_INS_VMOVHLPS,\n\tX86_INS_VMOVHPD,\n\tX86_INS_VMOVHPS,\n\tX86_INS_VMOVLHPS,\n\tX86_INS_VMOVLPD,\n\tX86_INS_VMOVLPS,\n\tX86_INS_VMOVMSKPD,\n\tX86_INS_VMOVMSKPS,\n\tX86_INS_VMOVNTDQA,\n\tX86_INS_VMOVNTDQ,\n\tX86_INS_VMOVNTPD,\n\tX86_INS_VMOVNTPS,\n\tX86_INS_VMOVSD,\n\tX86_INS_VMOVSHDUP,\n\tX86_INS_VMOVSLDUP,\n\tX86_INS_VMOVSS,\n\tX86_INS_VMOVUPD,\n\tX86_INS_VMOVUPS,\n\tX86_INS_VMPSADBW,\n\tX86_INS_VMPTRLD,\n\tX86_INS_VMPTRST,\n\tX86_INS_VMREAD,\n\tX86_INS_VMRESUME,\n\tX86_INS_VMRUN,\n\tX86_INS_VMSAVE,\n\tX86_INS_VMULPD,\n\tX86_INS_VMULPS,\n\tX86_INS_VMULSD,\n\tX86_INS_VMULSS,\n\tX86_INS_VMWRITE,\n\tX86_INS_VMXOFF,\n\tX86_INS_VMXON,\n\tX86_INS_VPABSB,\n\tX86_INS_VPABSD,\n\tX86_INS_VPABSQ,\n\tX86_INS_VPABSW,\n\tX86_INS_VPACKSSDW,\n\tX86_INS_VPACKSSWB,\n\tX86_INS_VPACKUSDW,\n\tX86_INS_VPACKUSWB,\n\tX86_INS_VPADDB,\n\tX86_INS_VPADDD,\n\tX86_INS_VPADDQ,\n\tX86_INS_VPADDSB,\n\tX86_INS_VPADDSW,\n\tX86_INS_VPADDUSB,\n\tX86_INS_VPADDUSW,\n\tX86_INS_VPADDW,\n\tX86_INS_VPALIGNR,\n\tX86_INS_VPANDD,\n\tX86_INS_VPANDND,\n\tX86_INS_VPANDNQ,\n\tX86_INS_VPANDN,\n\tX86_INS_VPANDQ,\n\tX86_INS_VPAND,\n\tX86_INS_VPAVGB,\n\tX86_INS_VPAVGW,\n\tX86_INS_VPBLENDD,\n\tX86_INS_VPBLENDMB,\n\tX86_INS_VPBLENDMD,\n\tX86_INS_VPBLENDMQ,\n\tX86_INS_VPBLENDMW,\n\tX86_INS_VPBLENDVB,\n\tX86_INS_VPBLENDW,\n\tX86_INS_VPBROADCASTB,\n\tX86_INS_VPBROADCASTD,\n\tX86_INS_VPBROADCASTMB2Q,\n\tX86_INS_VPBROADCASTMW2D,\n\tX86_INS_VPBROADCASTQ,\n\tX86_INS_VPBROADCASTW,\n\tX86_INS_VPCLMULQDQ,\n\tX86_INS_VPCMOV,\n\tX86_INS_VPCMPB,\n\tX86_INS_VPCMPD,\n\tX86_INS_VPCMPEQB,\n\tX86_INS_VPCMPEQD,\n\tX86_INS_VPCMPEQQ,\n\tX86_INS_VPCMPEQW,\n\tX86_INS_VPCMPESTRI,\n\tX86_INS_VPCMPESTRM,\n\tX86_INS_VPCMPGTB,\n\tX86_INS_VPCMPGTD,\n\tX86_INS_VPCMPGTQ,\n\tX86_INS_VPCMPGTW,\n\tX86_INS_VPCMPISTRI,\n\tX86_INS_VPCMPISTRM,\n\tX86_INS_VPCMPQ,\n\tX86_INS_VPCMPUB,\n\tX86_INS_VPCMPUD,\n\tX86_INS_VPCMPUQ,\n\tX86_INS_VPCMPUW,\n\tX86_INS_VPCMPW,\n\tX86_INS_VPCOMB,\n\tX86_INS_VPCOMD,\n\tX86_INS_VPCOMPRESSD,\n\tX86_INS_VPCOMPRESSQ,\n\tX86_INS_VPCOMQ,\n\tX86_INS_VPCOMUB,\n\tX86_INS_VPCOMUD,\n\tX86_INS_VPCOMUQ,\n\tX86_INS_VPCOMUW,\n\tX86_INS_VPCOMW,\n\tX86_INS_VPCONFLICTD,\n\tX86_INS_VPCONFLICTQ,\n\tX86_INS_VPERM2F128,\n\tX86_INS_VPERM2I128,\n\tX86_INS_VPERMD,\n\tX86_INS_VPERMI2D,\n\tX86_INS_VPERMI2PD,\n\tX86_INS_VPERMI2PS,\n\tX86_INS_VPERMI2Q,\n\tX86_INS_VPERMIL2PD,\n\tX86_INS_VPERMIL2PS,\n\tX86_INS_VPERMILPD,\n\tX86_INS_VPERMILPS,\n\tX86_INS_VPERMPD,\n\tX86_INS_VPERMPS,\n\tX86_INS_VPERMQ,\n\tX86_INS_VPERMT2D,\n\tX86_INS_VPERMT2PD,\n\tX86_INS_VPERMT2PS,\n\tX86_INS_VPERMT2Q,\n\tX86_INS_VPEXPANDD,\n\tX86_INS_VPEXPANDQ,\n\tX86_INS_VPEXTRB,\n\tX86_INS_VPEXTRD,\n\tX86_INS_VPEXTRQ,\n\tX86_INS_VPEXTRW,\n\tX86_INS_VPGATHERDD,\n\tX86_INS_VPGATHERDQ,\n\tX86_INS_VPGATHERQD,\n\tX86_INS_VPGATHERQQ,\n\tX86_INS_VPHADDBD,\n\tX86_INS_VPHADDBQ,\n\tX86_INS_VPHADDBW,\n\tX86_INS_VPHADDDQ,\n\tX86_INS_VPHADDD,\n\tX86_INS_VPHADDSW,\n\tX86_INS_VPHADDUBD,\n\tX86_INS_VPHADDUBQ,\n\tX86_INS_VPHADDUBW,\n\tX86_INS_VPHADDUDQ,\n\tX86_INS_VPHADDUWD,\n\tX86_INS_VPHADDUWQ,\n\tX86_INS_VPHADDWD,\n\tX86_INS_VPHADDWQ,\n\tX86_INS_VPHADDW,\n\tX86_INS_VPHMINPOSUW,\n\tX86_INS_VPHSUBBW,\n\tX86_INS_VPHSUBDQ,\n\tX86_INS_VPHSUBD,\n\tX86_INS_VPHSUBSW,\n\tX86_INS_VPHSUBWD,\n\tX86_INS_VPHSUBW,\n\tX86_INS_VPINSRB,\n\tX86_INS_VPINSRD,\n\tX86_INS_VPINSRQ,\n\tX86_INS_VPINSRW,\n\tX86_INS_VPLZCNTD,\n\tX86_INS_VPLZCNTQ,\n\tX86_INS_VPMACSDD,\n\tX86_INS_VPMACSDQH,\n\tX86_INS_VPMACSDQL,\n\tX86_INS_VPMACSSDD,\n\tX86_INS_VPMACSSDQH,\n\tX86_INS_VPMACSSDQL,\n\tX86_INS_VPMACSSWD,\n\tX86_INS_VPMACSSWW,\n\tX86_INS_VPMACSWD,\n\tX86_INS_VPMACSWW,\n\tX86_INS_VPMADCSSWD,\n\tX86_INS_VPMADCSWD,\n\tX86_INS_VPMADDUBSW,\n\tX86_INS_VPMADDWD,\n\tX86_INS_VPMASKMOVD,\n\tX86_INS_VPMASKMOVQ,\n\tX86_INS_VPMAXSB,\n\tX86_INS_VPMAXSD,\n\tX86_INS_VPMAXSQ,\n\tX86_INS_VPMAXSW,\n\tX86_INS_VPMAXUB,\n\tX86_INS_VPMAXUD,\n\tX86_INS_VPMAXUQ,\n\tX86_INS_VPMAXUW,\n\tX86_INS_VPMINSB,\n\tX86_INS_VPMINSD,\n\tX86_INS_VPMINSQ,\n\tX86_INS_VPMINSW,\n\tX86_INS_VPMINUB,\n\tX86_INS_VPMINUD,\n\tX86_INS_VPMINUQ,\n\tX86_INS_VPMINUW,\n\tX86_INS_VPMOVDB,\n\tX86_INS_VPMOVDW,\n\tX86_INS_VPMOVM2B,\n\tX86_INS_VPMOVM2D,\n\tX86_INS_VPMOVM2Q,\n\tX86_INS_VPMOVM2W,\n\tX86_INS_VPMOVMSKB,\n\tX86_INS_VPMOVQB,\n\tX86_INS_VPMOVQD,\n\tX86_INS_VPMOVQW,\n\tX86_INS_VPMOVSDB,\n\tX86_INS_VPMOVSDW,\n\tX86_INS_VPMOVSQB,\n\tX86_INS_VPMOVSQD,\n\tX86_INS_VPMOVSQW,\n\tX86_INS_VPMOVSXBD,\n\tX86_INS_VPMOVSXBQ,\n\tX86_INS_VPMOVSXBW,\n\tX86_INS_VPMOVSXDQ,\n\tX86_INS_VPMOVSXWD,\n\tX86_INS_VPMOVSXWQ,\n\tX86_INS_VPMOVUSDB,\n\tX86_INS_VPMOVUSDW,\n\tX86_INS_VPMOVUSQB,\n\tX86_INS_VPMOVUSQD,\n\tX86_INS_VPMOVUSQW,\n\tX86_INS_VPMOVZXBD,\n\tX86_INS_VPMOVZXBQ,\n\tX86_INS_VPMOVZXBW,\n\tX86_INS_VPMOVZXDQ,\n\tX86_INS_VPMOVZXWD,\n\tX86_INS_VPMOVZXWQ,\n\tX86_INS_VPMULDQ,\n\tX86_INS_VPMULHRSW,\n\tX86_INS_VPMULHUW,\n\tX86_INS_VPMULHW,\n\tX86_INS_VPMULLD,\n\tX86_INS_VPMULLQ,\n\tX86_INS_VPMULLW,\n\tX86_INS_VPMULUDQ,\n\tX86_INS_VPORD,\n\tX86_INS_VPORQ,\n\tX86_INS_VPOR,\n\tX86_INS_VPPERM,\n\tX86_INS_VPROTB,\n\tX86_INS_VPROTD,\n\tX86_INS_VPROTQ,\n\tX86_INS_VPROTW,\n\tX86_INS_VPSADBW,\n\tX86_INS_VPSCATTERDD,\n\tX86_INS_VPSCATTERDQ,\n\tX86_INS_VPSCATTERQD,\n\tX86_INS_VPSCATTERQQ,\n\tX86_INS_VPSHAB,\n\tX86_INS_VPSHAD,\n\tX86_INS_VPSHAQ,\n\tX86_INS_VPSHAW,\n\tX86_INS_VPSHLB,\n\tX86_INS_VPSHLD,\n\tX86_INS_VPSHLQ,\n\tX86_INS_VPSHLW,\n\tX86_INS_VPSHUFB,\n\tX86_INS_VPSHUFD,\n\tX86_INS_VPSHUFHW,\n\tX86_INS_VPSHUFLW,\n\tX86_INS_VPSIGNB,\n\tX86_INS_VPSIGND,\n\tX86_INS_VPSIGNW,\n\tX86_INS_VPSLLDQ,\n\tX86_INS_VPSLLD,\n\tX86_INS_VPSLLQ,\n\tX86_INS_VPSLLVD,\n\tX86_INS_VPSLLVQ,\n\tX86_INS_VPSLLW,\n\tX86_INS_VPSRAD,\n\tX86_INS_VPSRAQ,\n\tX86_INS_VPSRAVD,\n\tX86_INS_VPSRAVQ,\n\tX86_INS_VPSRAW,\n\tX86_INS_VPSRLDQ,\n\tX86_INS_VPSRLD,\n\tX86_INS_VPSRLQ,\n\tX86_INS_VPSRLVD,\n\tX86_INS_VPSRLVQ,\n\tX86_INS_VPSRLW,\n\tX86_INS_VPSUBB,\n\tX86_INS_VPSUBD,\n\tX86_INS_VPSUBQ,\n\tX86_INS_VPSUBSB,\n\tX86_INS_VPSUBSW,\n\tX86_INS_VPSUBUSB,\n\tX86_INS_VPSUBUSW,\n\tX86_INS_VPSUBW,\n\tX86_INS_VPTESTMD,\n\tX86_INS_VPTESTMQ,\n\tX86_INS_VPTESTNMD,\n\tX86_INS_VPTESTNMQ,\n\tX86_INS_VPTEST,\n\tX86_INS_VPUNPCKHBW,\n\tX86_INS_VPUNPCKHDQ,\n\tX86_INS_VPUNPCKHQDQ,\n\tX86_INS_VPUNPCKHWD,\n\tX86_INS_VPUNPCKLBW,\n\tX86_INS_VPUNPCKLDQ,\n\tX86_INS_VPUNPCKLQDQ,\n\tX86_INS_VPUNPCKLWD,\n\tX86_INS_VPXORD,\n\tX86_INS_VPXORQ,\n\tX86_INS_VPXOR,\n\tX86_INS_VRCP14PD,\n\tX86_INS_VRCP14PS,\n\tX86_INS_VRCP14SD,\n\tX86_INS_VRCP14SS,\n\tX86_INS_VRCP28PD,\n\tX86_INS_VRCP28PS,\n\tX86_INS_VRCP28SD,\n\tX86_INS_VRCP28SS,\n\tX86_INS_VRCPPS,\n\tX86_INS_VRCPSS,\n\tX86_INS_VRNDSCALEPD,\n\tX86_INS_VRNDSCALEPS,\n\tX86_INS_VRNDSCALESD,\n\tX86_INS_VRNDSCALESS,\n\tX86_INS_VROUNDPD,\n\tX86_INS_VROUNDPS,\n\tX86_INS_VROUNDSD,\n\tX86_INS_VROUNDSS,\n\tX86_INS_VRSQRT14PD,\n\tX86_INS_VRSQRT14PS,\n\tX86_INS_VRSQRT14SD,\n\tX86_INS_VRSQRT14SS,\n\tX86_INS_VRSQRT28PD,\n\tX86_INS_VRSQRT28PS,\n\tX86_INS_VRSQRT28SD,\n\tX86_INS_VRSQRT28SS,\n\tX86_INS_VRSQRTPS,\n\tX86_INS_VRSQRTSS,\n\tX86_INS_VSCATTERDPD,\n\tX86_INS_VSCATTERDPS,\n\tX86_INS_VSCATTERPF0DPD,\n\tX86_INS_VSCATTERPF0DPS,\n\tX86_INS_VSCATTERPF0QPD,\n\tX86_INS_VSCATTERPF0QPS,\n\tX86_INS_VSCATTERPF1DPD,\n\tX86_INS_VSCATTERPF1DPS,\n\tX86_INS_VSCATTERPF1QPD,\n\tX86_INS_VSCATTERPF1QPS,\n\tX86_INS_VSCATTERQPD,\n\tX86_INS_VSCATTERQPS,\n\tX86_INS_VSHUFPD,\n\tX86_INS_VSHUFPS,\n\tX86_INS_VSQRTPD,\n\tX86_INS_VSQRTPS,\n\tX86_INS_VSQRTSD,\n\tX86_INS_VSQRTSS,\n\tX86_INS_VSTMXCSR,\n\tX86_INS_VSUBPD,\n\tX86_INS_VSUBPS,\n\tX86_INS_VSUBSD,\n\tX86_INS_VSUBSS,\n\tX86_INS_VTESTPD,\n\tX86_INS_VTESTPS,\n\tX86_INS_VUNPCKHPD,\n\tX86_INS_VUNPCKHPS,\n\tX86_INS_VUNPCKLPD,\n\tX86_INS_VUNPCKLPS,\n\tX86_INS_VZEROALL,\n\tX86_INS_VZEROUPPER,\n\tX86_INS_WAIT,\n\tX86_INS_WBINVD,\n\tX86_INS_WRFSBASE,\n\tX86_INS_WRGSBASE,\n\tX86_INS_WRMSR,\n\tX86_INS_XABORT,\n\tX86_INS_XACQUIRE,\n\tX86_INS_XBEGIN,\n\tX86_INS_XCHG,\n\tX86_INS_XCRYPTCBC,\n\tX86_INS_XCRYPTCFB,\n\tX86_INS_XCRYPTCTR,\n\tX86_INS_XCRYPTECB,\n\tX86_INS_XCRYPTOFB,\n\tX86_INS_XEND,\n\tX86_INS_XGETBV,\n\tX86_INS_XLATB,\n\tX86_INS_XRELEASE,\n\tX86_INS_XRSTOR,\n\tX86_INS_XRSTOR64,\n\tX86_INS_XRSTORS,\n\tX86_INS_XRSTORS64,\n\tX86_INS_XSAVE,\n\tX86_INS_XSAVE64,\n\tX86_INS_XSAVEC,\n\tX86_INS_XSAVEC64,\n\tX86_INS_XSAVEOPT,\n\tX86_INS_XSAVEOPT64,\n\tX86_INS_XSAVES,\n\tX86_INS_XSAVES64,\n\tX86_INS_XSETBV,\n\tX86_INS_XSHA1,\n\tX86_INS_XSHA256,\n\tX86_INS_XSTORE,\n\tX86_INS_XTEST,\n\tX86_INS_FDISI8087_NOP,\n\tX86_INS_FENI8087_NOP,\n\n\t// pseudo instructions\n\tX86_INS_CMPSS,\n\tX86_INS_CMPEQSS,\n\tX86_INS_CMPLTSS,\n\tX86_INS_CMPLESS,\n\tX86_INS_CMPUNORDSS,\n\tX86_INS_CMPNEQSS,\n\tX86_INS_CMPNLTSS,\n\tX86_INS_CMPNLESS,\n\tX86_INS_CMPORDSS,\n\n\tX86_INS_CMPSD,\n\tX86_INS_CMPEQSD,\n\tX86_INS_CMPLTSD,\n\tX86_INS_CMPLESD,\n\tX86_INS_CMPUNORDSD,\n\tX86_INS_CMPNEQSD,\n\tX86_INS_CMPNLTSD,\n\tX86_INS_CMPNLESD,\n\tX86_INS_CMPORDSD,\n\n\tX86_INS_CMPPS,\n\tX86_INS_CMPEQPS,\n\tX86_INS_CMPLTPS,\n\tX86_INS_CMPLEPS,\n\tX86_INS_CMPUNORDPS,\n\tX86_INS_CMPNEQPS,\n\tX86_INS_CMPNLTPS,\n\tX86_INS_CMPNLEPS,\n\tX86_INS_CMPORDPS,\n\n\tX86_INS_CMPPD,\n\tX86_INS_CMPEQPD,\n\tX86_INS_CMPLTPD,\n\tX86_INS_CMPLEPD,\n\tX86_INS_CMPUNORDPD,\n\tX86_INS_CMPNEQPD,\n\tX86_INS_CMPNLTPD,\n\tX86_INS_CMPNLEPD,\n\tX86_INS_CMPORDPD,\n\n\tX86_INS_VCMPSS,\n\tX86_INS_VCMPEQSS,\n\tX86_INS_VCMPLTSS,\n\tX86_INS_VCMPLESS,\n\tX86_INS_VCMPUNORDSS,\n\tX86_INS_VCMPNEQSS,\n\tX86_INS_VCMPNLTSS,\n\tX86_INS_VCMPNLESS,\n\tX86_INS_VCMPORDSS,\n\tX86_INS_VCMPEQ_UQSS,\n\tX86_INS_VCMPNGESS,\n\tX86_INS_VCMPNGTSS,\n\tX86_INS_VCMPFALSESS,\n\tX86_INS_VCMPNEQ_OQSS,\n\tX86_INS_VCMPGESS,\n\tX86_INS_VCMPGTSS,\n\tX86_INS_VCMPTRUESS,\n\tX86_INS_VCMPEQ_OSSS,\n\tX86_INS_VCMPLT_OQSS,\n\tX86_INS_VCMPLE_OQSS,\n\tX86_INS_VCMPUNORD_SSS,\n\tX86_INS_VCMPNEQ_USSS,\n\tX86_INS_VCMPNLT_UQSS,\n\tX86_INS_VCMPNLE_UQSS,\n\tX86_INS_VCMPORD_SSS,\n\tX86_INS_VCMPEQ_USSS,\n\tX86_INS_VCMPNGE_UQSS,\n\tX86_INS_VCMPNGT_UQSS,\n\tX86_INS_VCMPFALSE_OSSS,\n\tX86_INS_VCMPNEQ_OSSS,\n\tX86_INS_VCMPGE_OQSS,\n\tX86_INS_VCMPGT_OQSS,\n\tX86_INS_VCMPTRUE_USSS,\n\n\tX86_INS_VCMPSD,\n\tX86_INS_VCMPEQSD,\n\tX86_INS_VCMPLTSD,\n\tX86_INS_VCMPLESD,\n\tX86_INS_VCMPUNORDSD,\n\tX86_INS_VCMPNEQSD,\n\tX86_INS_VCMPNLTSD,\n\tX86_INS_VCMPNLESD,\n\tX86_INS_VCMPORDSD,\n\tX86_INS_VCMPEQ_UQSD,\n\tX86_INS_VCMPNGESD,\n\tX86_INS_VCMPNGTSD,\n\tX86_INS_VCMPFALSESD,\n\tX86_INS_VCMPNEQ_OQSD,\n\tX86_INS_VCMPGESD,\n\tX86_INS_VCMPGTSD,\n\tX86_INS_VCMPTRUESD,\n\tX86_INS_VCMPEQ_OSSD,\n\tX86_INS_VCMPLT_OQSD,\n\tX86_INS_VCMPLE_OQSD,\n\tX86_INS_VCMPUNORD_SSD,\n\tX86_INS_VCMPNEQ_USSD,\n\tX86_INS_VCMPNLT_UQSD,\n\tX86_INS_VCMPNLE_UQSD,\n\tX86_INS_VCMPORD_SSD,\n\tX86_INS_VCMPEQ_USSD,\n\tX86_INS_VCMPNGE_UQSD,\n\tX86_INS_VCMPNGT_UQSD,\n\tX86_INS_VCMPFALSE_OSSD,\n\tX86_INS_VCMPNEQ_OSSD,\n\tX86_INS_VCMPGE_OQSD,\n\tX86_INS_VCMPGT_OQSD,\n\tX86_INS_VCMPTRUE_USSD,\n\n\tX86_INS_VCMPPS,\n\tX86_INS_VCMPEQPS,\n\tX86_INS_VCMPLTPS,\n\tX86_INS_VCMPLEPS,\n\tX86_INS_VCMPUNORDPS,\n\tX86_INS_VCMPNEQPS,\n\tX86_INS_VCMPNLTPS,\n\tX86_INS_VCMPNLEPS,\n\tX86_INS_VCMPORDPS,\n\tX86_INS_VCMPEQ_UQPS,\n\tX86_INS_VCMPNGEPS,\n\tX86_INS_VCMPNGTPS,\n\tX86_INS_VCMPFALSEPS,\n\tX86_INS_VCMPNEQ_OQPS,\n\tX86_INS_VCMPGEPS,\n\tX86_INS_VCMPGTPS,\n\tX86_INS_VCMPTRUEPS,\n\tX86_INS_VCMPEQ_OSPS,\n\tX86_INS_VCMPLT_OQPS,\n\tX86_INS_VCMPLE_OQPS,\n\tX86_INS_VCMPUNORD_SPS,\n\tX86_INS_VCMPNEQ_USPS,\n\tX86_INS_VCMPNLT_UQPS,\n\tX86_INS_VCMPNLE_UQPS,\n\tX86_INS_VCMPORD_SPS,\n\tX86_INS_VCMPEQ_USPS,\n\tX86_INS_VCMPNGE_UQPS,\n\tX86_INS_VCMPNGT_UQPS,\n\tX86_INS_VCMPFALSE_OSPS,\n\tX86_INS_VCMPNEQ_OSPS,\n\tX86_INS_VCMPGE_OQPS,\n\tX86_INS_VCMPGT_OQPS,\n\tX86_INS_VCMPTRUE_USPS,\n\n\tX86_INS_VCMPPD,\n\tX86_INS_VCMPEQPD,\n\tX86_INS_VCMPLTPD,\n\tX86_INS_VCMPLEPD,\n\tX86_INS_VCMPUNORDPD,\n\tX86_INS_VCMPNEQPD,\n\tX86_INS_VCMPNLTPD,\n\tX86_INS_VCMPNLEPD,\n\tX86_INS_VCMPORDPD,\n\tX86_INS_VCMPEQ_UQPD,\n\tX86_INS_VCMPNGEPD,\n\tX86_INS_VCMPNGTPD,\n\tX86_INS_VCMPFALSEPD,\n\tX86_INS_VCMPNEQ_OQPD,\n\tX86_INS_VCMPGEPD,\n\tX86_INS_VCMPGTPD,\n\tX86_INS_VCMPTRUEPD,\n\tX86_INS_VCMPEQ_OSPD,\n\tX86_INS_VCMPLT_OQPD,\n\tX86_INS_VCMPLE_OQPD,\n\tX86_INS_VCMPUNORD_SPD,\n\tX86_INS_VCMPNEQ_USPD,\n\tX86_INS_VCMPNLT_UQPD,\n\tX86_INS_VCMPNLE_UQPD,\n\tX86_INS_VCMPORD_SPD,\n\tX86_INS_VCMPEQ_USPD,\n\tX86_INS_VCMPNGE_UQPD,\n\tX86_INS_VCMPNGT_UQPD,\n\tX86_INS_VCMPFALSE_OSPD,\n\tX86_INS_VCMPNEQ_OSPD,\n\tX86_INS_VCMPGE_OQPD,\n\tX86_INS_VCMPGT_OQPD,\n\tX86_INS_VCMPTRUE_USPD,\n\n\tX86_INS_UD0,\n\tX86_INS_ENDBR32,\n\tX86_INS_ENDBR64,\n\n\tX86_INS_ENDING, // mark the end of the list of insn\n} x86_insn;\n\n/// Group of X86 instructions\ntypedef enum  x86_insn_group {\n\tX86_GRP_INVALID = 0, ///< = CS_GRP_INVALID\n\n\t// Generic groups\n\t// all jump instructions (conditional+direct+indirect jumps)\n\tX86_GRP_JUMP,\t///< = CS_GRP_JUMP\n\t// all call instructions\n\tX86_GRP_CALL,\t///< = CS_GRP_CALL\n\t// all return instructions\n\tX86_GRP_RET,\t///< = CS_GRP_RET\n\t// all interrupt instructions (int+syscall)\n\tX86_GRP_INT,\t///< = CS_GRP_INT\n\t// all interrupt return instructions\n\tX86_GRP_IRET,\t///< = CS_GRP_IRET\n\t// all privileged instructions\n\tX86_GRP_PRIVILEGE,\t///< = CS_GRP_PRIVILEGE\n\t// all relative branching instructions\n\tX86_GRP_BRANCH_RELATIVE, ///< = CS_GRP_BRANCH_RELATIVE\n\n\t// Architecture-specific groups\n\tX86_GRP_VM = 128,\t///< all virtualization instructions (VT-x + AMD-V)\n\tX86_GRP_3DNOW,\n\tX86_GRP_AES,\n\tX86_GRP_ADX,\n\tX86_GRP_AVX,\n\tX86_GRP_AVX2,\n\tX86_GRP_AVX512,\n\tX86_GRP_BMI,\n\tX86_GRP_BMI2,\n\tX86_GRP_CMOV,\n\tX86_GRP_F16C,\n\tX86_GRP_FMA,\n\tX86_GRP_FMA4,\n\tX86_GRP_FSGSBASE,\n\tX86_GRP_HLE,\n\tX86_GRP_MMX,\n\tX86_GRP_MODE32,\n\tX86_GRP_MODE64,\n\tX86_GRP_RTM,\n\tX86_GRP_SHA,\n\tX86_GRP_SSE1,\n\tX86_GRP_SSE2,\n\tX86_GRP_SSE3,\n\tX86_GRP_SSE41,\n\tX86_GRP_SSE42,\n\tX86_GRP_SSE4A,\n\tX86_GRP_SSSE3,\n\tX86_GRP_PCLMUL,\n\tX86_GRP_XOP,\n\tX86_GRP_CDI,\n\tX86_GRP_ERI,\n\tX86_GRP_TBM,\n\tX86_GRP_16BITMODE,\n\tX86_GRP_NOT64BITMODE,\n\tX86_GRP_SGX,\n\tX86_GRP_DQI,\n\tX86_GRP_BWI,\n\tX86_GRP_PFI,\n\tX86_GRP_VLX,\n\tX86_GRP_SMAP,\n\tX86_GRP_NOVLX,\n\tX86_GRP_FPU,\n\n\tX86_GRP_ENDING\n} x86_insn_group;\n\n#ifdef __cplusplus\n}\n#endif\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/capstone/xcore.h",
    "content": "#ifndef CAPSTONE_XCORE_H\n#define CAPSTONE_XCORE_H\n\n/* Capstone Disassembly Engine */\n/* By Nguyen Anh Quynh <aquynh@gmail.com>, 2014-2015 */\n\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\n#include \"platform.h\"\n\n#ifdef _MSC_VER\n#pragma warning(disable:4201)\n#endif\n\n/// Operand type for instruction's operands\ntypedef enum xcore_op_type {\n\tXCORE_OP_INVALID = 0, ///< = CS_OP_INVALID (Uninitialized).\n\tXCORE_OP_REG, ///< = CS_OP_REG (Register operand).\n\tXCORE_OP_IMM, ///< = CS_OP_IMM (Immediate operand).\n\tXCORE_OP_MEM, ///< = CS_OP_MEM (Memory operand).\n} xcore_op_type;\n\n/// XCore registers\ntypedef enum xcore_reg {\n\tXCORE_REG_INVALID = 0,\n\n\tXCORE_REG_CP,\n\tXCORE_REG_DP,\n\tXCORE_REG_LR,\n\tXCORE_REG_SP,\n\tXCORE_REG_R0,\n\tXCORE_REG_R1,\n\tXCORE_REG_R2,\n\tXCORE_REG_R3,\n\tXCORE_REG_R4,\n\tXCORE_REG_R5,\n\tXCORE_REG_R6,\n\tXCORE_REG_R7,\n\tXCORE_REG_R8,\n\tXCORE_REG_R9,\n\tXCORE_REG_R10,\n\tXCORE_REG_R11,\n\n\t// pseudo registers\n\tXCORE_REG_PC,\t///< pc\n\n\t// internal thread registers\n\t// see The-XMOS-XS1-Architecture(X7879A).pdf\n\tXCORE_REG_SCP,\t///< save pc\n\tXCORE_REG_SSR,\t//< save status\n\tXCORE_REG_ET,\t//< exception type\n\tXCORE_REG_ED,\t//< exception data\n\tXCORE_REG_SED,\t//< save exception data\n\tXCORE_REG_KEP,\t//< kernel entry pointer\n\tXCORE_REG_KSP,\t//< kernel stack pointer\n\tXCORE_REG_ID,\t//< thread ID\n\n\tXCORE_REG_ENDING,\t// <-- mark the end of the list of registers\n} xcore_reg;\n\n/// Instruction's operand referring to memory\n/// This is associated with XCORE_OP_MEM operand type above\ntypedef struct xcore_op_mem {\n\tuint8_t base;\t\t///< base register, can be safely interpreted as\n\t\t\t\t///< a value of type `xcore_reg`, but it is only\n\t\t\t\t///< one byte wide\n\tuint8_t index;\t\t///< index register, same conditions apply here\n\tint32_t disp;\t///< displacement/offset value\n\tint     direct;\t///< +1: forward, -1: backward\n} xcore_op_mem;\n\n/// Instruction operand\ntypedef struct cs_xcore_op {\n\txcore_op_type type;\t///< operand type\n\tunion {\n\t\txcore_reg reg;\t///< register value for REG operand\n\t\tint32_t imm;\t\t///< immediate value for IMM operand\n\t\txcore_op_mem mem;\t\t///< base/disp value for MEM operand\n\t};\n} cs_xcore_op;\n\n/// Instruction structure\ntypedef struct cs_xcore {\n\t/// Number of operands of this instruction,\n\t/// or 0 when instruction has no operand.\n\tuint8_t op_count;\n\tcs_xcore_op operands[8]; ///< operands for this instruction.\n} cs_xcore;\n\n/// XCore instruction\ntypedef enum xcore_insn {\n\tXCORE_INS_INVALID = 0,\n\n\tXCORE_INS_ADD,\n\tXCORE_INS_ANDNOT,\n\tXCORE_INS_AND,\n\tXCORE_INS_ASHR,\n\tXCORE_INS_BAU,\n\tXCORE_INS_BITREV,\n\tXCORE_INS_BLA,\n\tXCORE_INS_BLAT,\n\tXCORE_INS_BL,\n\tXCORE_INS_BF,\n\tXCORE_INS_BT,\n\tXCORE_INS_BU,\n\tXCORE_INS_BRU,\n\tXCORE_INS_BYTEREV,\n\tXCORE_INS_CHKCT,\n\tXCORE_INS_CLRE,\n\tXCORE_INS_CLRPT,\n\tXCORE_INS_CLRSR,\n\tXCORE_INS_CLZ,\n\tXCORE_INS_CRC8,\n\tXCORE_INS_CRC32,\n\tXCORE_INS_DCALL,\n\tXCORE_INS_DENTSP,\n\tXCORE_INS_DGETREG,\n\tXCORE_INS_DIVS,\n\tXCORE_INS_DIVU,\n\tXCORE_INS_DRESTSP,\n\tXCORE_INS_DRET,\n\tXCORE_INS_ECALLF,\n\tXCORE_INS_ECALLT,\n\tXCORE_INS_EDU,\n\tXCORE_INS_EEF,\n\tXCORE_INS_EET,\n\tXCORE_INS_EEU,\n\tXCORE_INS_ENDIN,\n\tXCORE_INS_ENTSP,\n\tXCORE_INS_EQ,\n\tXCORE_INS_EXTDP,\n\tXCORE_INS_EXTSP,\n\tXCORE_INS_FREER,\n\tXCORE_INS_FREET,\n\tXCORE_INS_GETD,\n\tXCORE_INS_GET,\n\tXCORE_INS_GETN,\n\tXCORE_INS_GETR,\n\tXCORE_INS_GETSR,\n\tXCORE_INS_GETST,\n\tXCORE_INS_GETTS,\n\tXCORE_INS_INCT,\n\tXCORE_INS_INIT,\n\tXCORE_INS_INPW,\n\tXCORE_INS_INSHR,\n\tXCORE_INS_INT,\n\tXCORE_INS_IN,\n\tXCORE_INS_KCALL,\n\tXCORE_INS_KENTSP,\n\tXCORE_INS_KRESTSP,\n\tXCORE_INS_KRET,\n\tXCORE_INS_LADD,\n\tXCORE_INS_LD16S,\n\tXCORE_INS_LD8U,\n\tXCORE_INS_LDA16,\n\tXCORE_INS_LDAP,\n\tXCORE_INS_LDAW,\n\tXCORE_INS_LDC,\n\tXCORE_INS_LDW,\n\tXCORE_INS_LDIVU,\n\tXCORE_INS_LMUL,\n\tXCORE_INS_LSS,\n\tXCORE_INS_LSUB,\n\tXCORE_INS_LSU,\n\tXCORE_INS_MACCS,\n\tXCORE_INS_MACCU,\n\tXCORE_INS_MJOIN,\n\tXCORE_INS_MKMSK,\n\tXCORE_INS_MSYNC,\n\tXCORE_INS_MUL,\n\tXCORE_INS_NEG,\n\tXCORE_INS_NOT,\n\tXCORE_INS_OR,\n\tXCORE_INS_OUTCT,\n\tXCORE_INS_OUTPW,\n\tXCORE_INS_OUTSHR,\n\tXCORE_INS_OUTT,\n\tXCORE_INS_OUT,\n\tXCORE_INS_PEEK,\n\tXCORE_INS_REMS,\n\tXCORE_INS_REMU,\n\tXCORE_INS_RETSP,\n\tXCORE_INS_SETCLK,\n\tXCORE_INS_SET,\n\tXCORE_INS_SETC,\n\tXCORE_INS_SETD,\n\tXCORE_INS_SETEV,\n\tXCORE_INS_SETN,\n\tXCORE_INS_SETPSC,\n\tXCORE_INS_SETPT,\n\tXCORE_INS_SETRDY,\n\tXCORE_INS_SETSR,\n\tXCORE_INS_SETTW,\n\tXCORE_INS_SETV,\n\tXCORE_INS_SEXT,\n\tXCORE_INS_SHL,\n\tXCORE_INS_SHR,\n\tXCORE_INS_SSYNC,\n\tXCORE_INS_ST16,\n\tXCORE_INS_ST8,\n\tXCORE_INS_STW,\n\tXCORE_INS_SUB,\n\tXCORE_INS_SYNCR,\n\tXCORE_INS_TESTCT,\n\tXCORE_INS_TESTLCL,\n\tXCORE_INS_TESTWCT,\n\tXCORE_INS_TSETMR,\n\tXCORE_INS_START,\n\tXCORE_INS_WAITEF,\n\tXCORE_INS_WAITET,\n\tXCORE_INS_WAITEU,\n\tXCORE_INS_XOR,\n\tXCORE_INS_ZEXT,\n\n\tXCORE_INS_ENDING,   // <-- mark the end of the list of instructions\n} xcore_insn;\n\n/// Group of XCore instructions\ntypedef enum xcore_insn_group {\n\tXCORE_GRP_INVALID = 0, ///< = CS_GRP_INVALID\n\n\t// Generic groups\n\t// all jump instructions (conditional+direct+indirect jumps)\n\tXCORE_GRP_JUMP,\t///< = CS_GRP_JUMP\n\n\tXCORE_GRP_ENDING,   // <-- mark the end of the list of groups\n} xcore_insn_group;\n\n#ifdef __cplusplus\n}\n#endif\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/clang/3.0/altivec.h",
    "content": "/*===---- altivec.h - Standard header for type generic math ---------------===*\\\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n *\n\\*===----------------------------------------------------------------------===*/\n\n#ifndef __ALTIVEC_H\n#define __ALTIVEC_H\n\n#ifndef __ALTIVEC__\n#error \"AltiVec support not enabled\"\n#endif\n\n/* constants for mapping CR6 bits to predicate result. */\n\n#define __CR6_EQ     0\n#define __CR6_EQ_REV 1\n#define __CR6_LT     2\n#define __CR6_LT_REV 3\n\n#define __ATTRS_o_ai __attribute__((__overloadable__, __always_inline__))\n\nstatic vector signed char __ATTRS_o_ai\nvec_perm(vector signed char a, vector signed char b, vector unsigned char c);\n\nstatic vector unsigned char __ATTRS_o_ai\nvec_perm(vector unsigned char a,\n         vector unsigned char b, \n         vector unsigned char c);\n\nstatic vector bool char __ATTRS_o_ai\nvec_perm(vector bool char a, vector bool char b, vector unsigned char c);\n\nstatic vector short __ATTRS_o_ai\nvec_perm(vector short a, vector short b, vector unsigned char c);\n\nstatic vector unsigned short __ATTRS_o_ai\nvec_perm(vector unsigned short a,\n         vector unsigned short b, \n         vector unsigned char c);\n\nstatic vector bool short __ATTRS_o_ai\nvec_perm(vector bool short a, vector bool short b, vector unsigned char c);\n\nstatic vector pixel __ATTRS_o_ai\nvec_perm(vector pixel a, vector pixel b, vector unsigned char c);\n\nstatic vector int __ATTRS_o_ai\nvec_perm(vector int a, vector int b, vector unsigned char c);\n\nstatic vector unsigned int __ATTRS_o_ai\nvec_perm(vector unsigned int a, vector unsigned int b, vector unsigned char c);\n\nstatic vector bool int __ATTRS_o_ai\nvec_perm(vector bool int a, vector bool int b, vector unsigned char c);\n\nstatic vector float __ATTRS_o_ai\nvec_perm(vector float a, vector float b, vector unsigned char c);\n\n/* vec_abs */\n\n#define __builtin_altivec_abs_v16qi vec_abs\n#define __builtin_altivec_abs_v8hi  vec_abs\n#define __builtin_altivec_abs_v4si  vec_abs\n\nstatic vector signed char __ATTRS_o_ai\nvec_abs(vector signed char a)\n{\n  return __builtin_altivec_vmaxsb(a, -a);\n}\n\nstatic vector signed short __ATTRS_o_ai\nvec_abs(vector signed short a)\n{\n  return __builtin_altivec_vmaxsh(a, -a);\n}\n\nstatic vector signed int __ATTRS_o_ai\nvec_abs(vector signed int a)\n{\n  return __builtin_altivec_vmaxsw(a, -a);\n}\n\nstatic vector float __ATTRS_o_ai\nvec_abs(vector float a)\n{\n  vector unsigned int res = (vector unsigned int)a \n                            & (vector unsigned int)(0x7FFFFFFF);\n  return (vector float)res;\n}\n\n/* vec_abss */\n\n#define __builtin_altivec_abss_v16qi vec_abss\n#define __builtin_altivec_abss_v8hi  vec_abss\n#define __builtin_altivec_abss_v4si  vec_abss\n\nstatic vector signed char __ATTRS_o_ai\nvec_abss(vector signed char a)\n{\n  return __builtin_altivec_vmaxsb\n           (a, __builtin_altivec_vsubsbs((vector signed char)(0), a));\n}\n\nstatic vector signed short __ATTRS_o_ai\nvec_abss(vector signed short a)\n{\n  return __builtin_altivec_vmaxsh\n           (a, __builtin_altivec_vsubshs((vector signed short)(0), a));\n}\n\nstatic vector signed int __ATTRS_o_ai\nvec_abss(vector signed int a)\n{\n  return __builtin_altivec_vmaxsw\n           (a, __builtin_altivec_vsubsws((vector signed int)(0), a));\n}\n\n/* vec_add */\n\nstatic vector signed char __ATTRS_o_ai\nvec_add(vector signed char a, vector signed char b)\n{\n  return a + b;\n}\n\nstatic vector signed char __ATTRS_o_ai\nvec_add(vector bool char a, vector signed char b)\n{\n  return (vector signed char)a + b;\n}\n\nstatic vector signed char __ATTRS_o_ai\nvec_add(vector signed char a, vector bool char b)\n{\n  return a + (vector signed char)b;\n}\n\nstatic vector unsigned char __ATTRS_o_ai\nvec_add(vector unsigned char a, vector unsigned char b)\n{\n  return a + b;\n}\n\nstatic vector unsigned char __ATTRS_o_ai\nvec_add(vector bool char a, vector unsigned char b)\n{\n  return (vector unsigned char)a + b;\n}\n\nstatic vector unsigned char __ATTRS_o_ai\nvec_add(vector unsigned char a, vector bool char b)\n{\n  return a + (vector unsigned char)b;\n}\n\nstatic vector short __ATTRS_o_ai\nvec_add(vector short a, vector short b)\n{\n  return a + b;\n}\n\nstatic vector short __ATTRS_o_ai\nvec_add(vector bool short a, vector short b)\n{\n  return (vector short)a + b;\n}\n\nstatic vector short __ATTRS_o_ai\nvec_add(vector short a, vector bool short b)\n{\n  return a + (vector short)b;\n}\n\nstatic vector unsigned short __ATTRS_o_ai\nvec_add(vector unsigned short a, vector unsigned short b)\n{\n  return a + b;\n}\n\nstatic vector unsigned short __ATTRS_o_ai\nvec_add(vector bool short a, vector unsigned short b)\n{\n  return (vector unsigned short)a + b;\n}\n\nstatic vector unsigned short __ATTRS_o_ai\nvec_add(vector unsigned short a, vector bool short b)\n{\n  return a + (vector unsigned short)b;\n}\n\nstatic vector int __ATTRS_o_ai\nvec_add(vector int a, vector int b)\n{\n  return a + b;\n}\n\nstatic vector int __ATTRS_o_ai\nvec_add(vector bool int a, vector int b)\n{\n  return (vector int)a + b;\n}\n\nstatic vector int __ATTRS_o_ai\nvec_add(vector int a, vector bool int b)\n{\n  return a + (vector int)b;\n}\n\nstatic vector unsigned int __ATTRS_o_ai\nvec_add(vector unsigned int a, vector unsigned int b)\n{\n  return a + b;\n}\n\nstatic vector unsigned int __ATTRS_o_ai\nvec_add(vector bool int a, vector unsigned int b)\n{\n  return (vector unsigned int)a + b;\n}\n\nstatic vector unsigned int __ATTRS_o_ai\nvec_add(vector unsigned int a, vector bool int b)\n{\n  return a + (vector unsigned int)b;\n}\n\nstatic vector float __ATTRS_o_ai\nvec_add(vector float a, vector float b)\n{\n  return a + b;\n}\n\n/* vec_vaddubm */\n\n#define __builtin_altivec_vaddubm vec_vaddubm\n\nstatic vector signed char __ATTRS_o_ai\nvec_vaddubm(vector signed char a, vector signed char b)\n{\n  return a + b;\n}\n\nstatic vector signed char __ATTRS_o_ai\nvec_vaddubm(vector bool char a, vector signed char b)\n{\n  return (vector signed char)a + b;\n}\n\nstatic vector signed char __ATTRS_o_ai\nvec_vaddubm(vector signed char a, vector bool char b)\n{\n  return a + (vector signed char)b;\n}\n\nstatic vector unsigned char __ATTRS_o_ai\nvec_vaddubm(vector unsigned char a, vector unsigned char b)\n{\n  return a + b;\n}\n\nstatic vector unsigned char __ATTRS_o_ai\nvec_vaddubm(vector bool char a, vector unsigned char b)\n{\n  return (vector unsigned char)a + b;\n}\n\nstatic vector unsigned char __ATTRS_o_ai\nvec_vaddubm(vector unsigned char a, vector bool char b)\n{\n  return a + (vector unsigned char)b;\n}\n\n/* vec_vadduhm */\n\n#define __builtin_altivec_vadduhm vec_vadduhm\n\nstatic vector short __ATTRS_o_ai\nvec_vadduhm(vector short a, vector short b)\n{\n  return a + b;\n}\n\nstatic vector short __ATTRS_o_ai\nvec_vadduhm(vector bool short a, vector short b)\n{\n  return (vector short)a + b;\n}\n\nstatic vector short __ATTRS_o_ai\nvec_vadduhm(vector short a, vector bool short b)\n{\n  return a + (vector short)b;\n}\n\nstatic vector unsigned short __ATTRS_o_ai\nvec_vadduhm(vector unsigned short a, vector unsigned short b)\n{\n  return a + b;\n}\n\nstatic vector unsigned short __ATTRS_o_ai\nvec_vadduhm(vector bool short a, vector unsigned short b)\n{\n  return (vector unsigned short)a + b;\n}\n\nstatic vector unsigned short __ATTRS_o_ai\nvec_vadduhm(vector unsigned short a, vector bool short b)\n{\n  return a + (vector unsigned short)b;\n}\n\n/* vec_vadduwm */\n\n#define __builtin_altivec_vadduwm vec_vadduwm\n\nstatic vector int __ATTRS_o_ai\nvec_vadduwm(vector int a, vector int b)\n{\n  return a + b;\n}\n\nstatic vector int __ATTRS_o_ai\nvec_vadduwm(vector bool int a, vector int b)\n{\n  return (vector int)a + b;\n}\n\nstatic vector int __ATTRS_o_ai\nvec_vadduwm(vector int a, vector bool int b)\n{\n  return a + (vector int)b;\n}\n\nstatic vector unsigned int __ATTRS_o_ai\nvec_vadduwm(vector unsigned int a, vector unsigned int b)\n{\n  return a + b;\n}\n\nstatic vector unsigned int __ATTRS_o_ai\nvec_vadduwm(vector bool int a, vector unsigned int b)\n{\n  return (vector unsigned int)a + b;\n}\n\nstatic vector unsigned int __ATTRS_o_ai\nvec_vadduwm(vector unsigned int a, vector bool int b)\n{\n  return a + (vector unsigned int)b;\n}\n\n/* vec_vaddfp */\n\n#define __builtin_altivec_vaddfp  vec_vaddfp\n\nstatic vector float __attribute__((__always_inline__))\nvec_vaddfp(vector float a, vector float b)\n{\n  return a + b;\n}\n\n/* vec_addc */\n\nstatic vector unsigned int __attribute__((__always_inline__))\nvec_addc(vector unsigned int a, vector unsigned int b)\n{\n  return __builtin_altivec_vaddcuw(a, b);\n}\n\n/* vec_vaddcuw */\n\nstatic vector unsigned int __attribute__((__always_inline__))\nvec_vaddcuw(vector unsigned int a, vector unsigned int b)\n{\n  return __builtin_altivec_vaddcuw(a, b);\n}\n\n/* vec_adds */\n\nstatic vector signed char __ATTRS_o_ai\nvec_adds(vector signed char a, vector signed char b)\n{\n  return __builtin_altivec_vaddsbs(a, b);\n}\n\nstatic vector signed char __ATTRS_o_ai\nvec_adds(vector bool char a, vector signed char b)\n{\n  return __builtin_altivec_vaddsbs((vector signed char)a, b);\n}\n\nstatic vector signed char __ATTRS_o_ai\nvec_adds(vector signed char a, vector bool char b)\n{\n  return __builtin_altivec_vaddsbs(a, (vector signed char)b);\n}\n\nstatic vector unsigned char __ATTRS_o_ai\nvec_adds(vector unsigned char a, vector unsigned char b)\n{\n  return __builtin_altivec_vaddubs(a, b);\n}\n\nstatic vector unsigned char __ATTRS_o_ai\nvec_adds(vector bool char a, vector unsigned char b)\n{\n  return __builtin_altivec_vaddubs((vector unsigned char)a, b);\n}\n\nstatic vector unsigned char __ATTRS_o_ai\nvec_adds(vector unsigned char a, vector bool char b)\n{\n  return __builtin_altivec_vaddubs(a, (vector unsigned char)b);\n}\n\nstatic vector short __ATTRS_o_ai\nvec_adds(vector short a, vector short b)\n{\n  return __builtin_altivec_vaddshs(a, b);\n}\n\nstatic vector short __ATTRS_o_ai\nvec_adds(vector bool short a, vector short b)\n{\n  return __builtin_altivec_vaddshs((vector short)a, b);\n}\n\nstatic vector short __ATTRS_o_ai\nvec_adds(vector short a, vector bool short b)\n{\n  return __builtin_altivec_vaddshs(a, (vector short)b);\n}\n\nstatic vector unsigned short __ATTRS_o_ai\nvec_adds(vector unsigned short a, vector unsigned short b)\n{\n  return __builtin_altivec_vadduhs(a, b);\n}\n\nstatic vector unsigned short __ATTRS_o_ai\nvec_adds(vector bool short a, vector unsigned short b)\n{\n  return __builtin_altivec_vadduhs((vector unsigned short)a, b);\n}\n\nstatic vector unsigned short __ATTRS_o_ai\nvec_adds(vector unsigned short a, vector bool short b)\n{\n  return __builtin_altivec_vadduhs(a, (vector unsigned short)b);\n}\n\nstatic vector int __ATTRS_o_ai\nvec_adds(vector int a, vector int b)\n{\n  return __builtin_altivec_vaddsws(a, b);\n}\n\nstatic vector int __ATTRS_o_ai\nvec_adds(vector bool int a, vector int b)\n{\n  return __builtin_altivec_vaddsws((vector int)a, b);\n}\n\nstatic vector int __ATTRS_o_ai\nvec_adds(vector int a, vector bool int b)\n{\n  return __builtin_altivec_vaddsws(a, (vector int)b);\n}\n\nstatic vector unsigned int __ATTRS_o_ai\nvec_adds(vector unsigned int a, vector unsigned int b)\n{\n  return __builtin_altivec_vadduws(a, b);\n}\n\nstatic vector unsigned int __ATTRS_o_ai\nvec_adds(vector bool int a, vector unsigned int b)\n{\n  return __builtin_altivec_vadduws((vector unsigned int)a, b);\n}\n\nstatic vector unsigned int __ATTRS_o_ai\nvec_adds(vector unsigned int a, vector bool int b)\n{\n  return __builtin_altivec_vadduws(a, (vector unsigned int)b);\n}\n\n/* vec_vaddsbs */\n\nstatic vector signed char __ATTRS_o_ai\nvec_vaddsbs(vector signed char a, vector signed char b)\n{\n  return __builtin_altivec_vaddsbs(a, b);\n}\n\nstatic vector signed char __ATTRS_o_ai\nvec_vaddsbs(vector bool char a, vector signed char b)\n{\n  return __builtin_altivec_vaddsbs((vector signed char)a, b);\n}\n\nstatic vector signed char __ATTRS_o_ai\nvec_vaddsbs(vector signed char a, vector bool char b)\n{\n  return __builtin_altivec_vaddsbs(a, (vector signed char)b);\n}\n\n/* vec_vaddubs */\n\nstatic vector unsigned char __ATTRS_o_ai\nvec_vaddubs(vector unsigned char a, vector unsigned char b)\n{\n  return __builtin_altivec_vaddubs(a, b);\n}\n\nstatic vector unsigned char __ATTRS_o_ai\nvec_vaddubs(vector bool char a, vector unsigned char b)\n{\n  return __builtin_altivec_vaddubs((vector unsigned char)a, b);\n}\n\nstatic vector unsigned char __ATTRS_o_ai\nvec_vaddubs(vector unsigned char a, vector bool char b)\n{\n  return __builtin_altivec_vaddubs(a, (vector unsigned char)b);\n}\n\n/* vec_vaddshs */\n\nstatic vector short __ATTRS_o_ai\nvec_vaddshs(vector short a, vector short b)\n{\n  return __builtin_altivec_vaddshs(a, b);\n}\n\nstatic vector short __ATTRS_o_ai\nvec_vaddshs(vector bool short a, vector short b)\n{\n  return __builtin_altivec_vaddshs((vector short)a, b);\n}\n\nstatic vector short __ATTRS_o_ai\nvec_vaddshs(vector short a, vector bool short b)\n{\n  return __builtin_altivec_vaddshs(a, (vector short)b);\n}\n\n/* vec_vadduhs */\n\nstatic vector unsigned short __ATTRS_o_ai\nvec_vadduhs(vector unsigned short a, vector unsigned short b)\n{\n  return __builtin_altivec_vadduhs(a, b);\n}\n\nstatic vector unsigned short __ATTRS_o_ai\nvec_vadduhs(vector bool short a, vector unsigned short b)\n{\n  return __builtin_altivec_vadduhs((vector unsigned short)a, b);\n}\n\nstatic vector unsigned short __ATTRS_o_ai\nvec_vadduhs(vector unsigned short a, vector bool short b)\n{\n  return __builtin_altivec_vadduhs(a, (vector unsigned short)b);\n}\n\n/* vec_vaddsws */\n\nstatic vector int __ATTRS_o_ai\nvec_vaddsws(vector int a, vector int b)\n{\n  return __builtin_altivec_vaddsws(a, b);\n}\n\nstatic vector int __ATTRS_o_ai\nvec_vaddsws(vector bool int a, vector int b)\n{\n  return __builtin_altivec_vaddsws((vector int)a, b);\n}\n\nstatic vector int __ATTRS_o_ai\nvec_vaddsws(vector int a, vector bool int b)\n{\n  return __builtin_altivec_vaddsws(a, (vector int)b);\n}\n\n/* vec_vadduws */\n\nstatic vector unsigned int __ATTRS_o_ai\nvec_vadduws(vector unsigned int a, vector unsigned int b)\n{\n  return __builtin_altivec_vadduws(a, b);\n}\n\nstatic vector unsigned int __ATTRS_o_ai\nvec_vadduws(vector bool int a, vector unsigned int b)\n{\n  return __builtin_altivec_vadduws((vector unsigned int)a, b);\n}\n\nstatic vector unsigned int __ATTRS_o_ai\nvec_vadduws(vector unsigned int a, vector bool int b)\n{\n  return __builtin_altivec_vadduws(a, (vector unsigned int)b);\n}\n\n/* vec_and */\n\n#define __builtin_altivec_vand vec_and\n\nstatic vector signed char __ATTRS_o_ai\nvec_and(vector signed char a, vector signed char b)\n{\n  return a & b;\n}\n\nstatic vector signed char __ATTRS_o_ai\nvec_and(vector bool char a, vector signed char b)\n{\n  return (vector signed char)a & b;\n}\n\nstatic vector signed char __ATTRS_o_ai\nvec_and(vector signed char a, vector bool char b)\n{\n  return a & (vector signed char)b;\n}\n\nstatic vector unsigned char __ATTRS_o_ai\nvec_and(vector unsigned char a, vector unsigned char b)\n{\n  return a & b;\n}\n\nstatic vector unsigned char __ATTRS_o_ai\nvec_and(vector bool char a, vector unsigned char b)\n{\n  return (vector unsigned char)a & b;\n}\n\nstatic vector unsigned char __ATTRS_o_ai\nvec_and(vector unsigned char a, vector bool char b)\n{\n  return a & (vector unsigned char)b;\n}\n\nstatic vector bool char __ATTRS_o_ai\nvec_and(vector bool char a, vector bool char b)\n{\n  return a & b;\n}\n\nstatic vector short __ATTRS_o_ai\nvec_and(vector short a, vector short b)\n{\n  return a & b;\n}\n\nstatic vector short __ATTRS_o_ai\nvec_and(vector bool short a, vector short b)\n{\n  return (vector short)a & b;\n}\n\nstatic vector short __ATTRS_o_ai\nvec_and(vector short a, vector bool short b)\n{\n  return a & (vector short)b;\n}\n\nstatic vector unsigned short __ATTRS_o_ai\nvec_and(vector unsigned short a, vector unsigned short b)\n{\n  return a & b;\n}\n\nstatic vector unsigned short __ATTRS_o_ai\nvec_and(vector bool short a, vector unsigned short b)\n{\n  return (vector unsigned short)a & b;\n}\n\nstatic vector unsigned short __ATTRS_o_ai\nvec_and(vector unsigned short a, vector bool short b)\n{\n  return a & (vector unsigned short)b;\n}\n\nstatic vector bool short __ATTRS_o_ai\nvec_and(vector bool short a, vector bool short b)\n{\n  return a & b;\n}\n\nstatic vector int __ATTRS_o_ai\nvec_and(vector int a, vector int b)\n{\n  return a & b;\n}\n\nstatic vector int __ATTRS_o_ai\nvec_and(vector bool int a, vector int b)\n{\n  return (vector int)a & b;\n}\n\nstatic vector int __ATTRS_o_ai\nvec_and(vector int a, vector bool int b)\n{\n  return a & (vector int)b;\n}\n\nstatic vector unsigned int __ATTRS_o_ai\nvec_and(vector unsigned int a, vector unsigned int b)\n{\n  return a & b;\n}\n\nstatic vector unsigned int __ATTRS_o_ai\nvec_and(vector bool int a, vector unsigned int b)\n{\n  return (vector unsigned int)a & b;\n}\n\nstatic vector unsigned int __ATTRS_o_ai\nvec_and(vector unsigned int a, vector bool int b)\n{\n  return a & (vector unsigned int)b;\n}\n\nstatic vector bool int __ATTRS_o_ai\nvec_and(vector bool int a, vector bool int b)\n{\n  return a & b;\n}\n\nstatic vector float __ATTRS_o_ai\nvec_and(vector float a, vector float b)\n{\n  vector unsigned int res = (vector unsigned int)a & (vector unsigned int)b;\n  return (vector float)res;\n}\n\nstatic vector float __ATTRS_o_ai\nvec_and(vector bool int a, vector float b)\n{\n  vector unsigned int res = (vector unsigned int)a & (vector unsigned int)b;\n  return (vector float)res;\n}\n\nstatic vector float __ATTRS_o_ai\nvec_and(vector float a, vector bool int b)\n{\n  vector unsigned int res = (vector unsigned int)a & (vector unsigned int)b;\n  return (vector float)res;\n}\n\n/* vec_vand */\n\nstatic vector signed char __ATTRS_o_ai\nvec_vand(vector signed char a, vector signed char b)\n{\n  return a & b;\n}\n\nstatic vector signed char __ATTRS_o_ai\nvec_vand(vector bool char a, vector signed char b)\n{\n  return (vector signed char)a & b;\n}\n\nstatic vector signed char __ATTRS_o_ai\nvec_vand(vector signed char a, vector bool char b)\n{\n  return a & (vector signed char)b;\n}\n\nstatic vector unsigned char __ATTRS_o_ai\nvec_vand(vector unsigned char a, vector unsigned char b)\n{\n  return a & b;\n}\n\nstatic vector unsigned char __ATTRS_o_ai\nvec_vand(vector bool char a, vector unsigned char b)\n{\n  return (vector unsigned char)a & b;\n}\n\nstatic vector unsigned char __ATTRS_o_ai\nvec_vand(vector unsigned char a, vector bool char b)\n{\n  return a & (vector unsigned char)b;\n}\n\nstatic vector bool char __ATTRS_o_ai\nvec_vand(vector bool char a, vector bool char b)\n{\n  return a & b;\n}\n\nstatic vector short __ATTRS_o_ai\nvec_vand(vector short a, vector short b)\n{\n  return a & b;\n}\n\nstatic vector short __ATTRS_o_ai\nvec_vand(vector bool short a, vector short b)\n{\n  return (vector short)a & b;\n}\n\nstatic vector short __ATTRS_o_ai\nvec_vand(vector short a, vector bool short b)\n{\n  return a & (vector short)b;\n}\n\nstatic vector unsigned short __ATTRS_o_ai\nvec_vand(vector unsigned short a, vector unsigned short b)\n{\n  return a & b;\n}\n\nstatic vector unsigned short __ATTRS_o_ai\nvec_vand(vector bool short a, vector unsigned short b)\n{\n  return (vector unsigned short)a & b;\n}\n\nstatic vector unsigned short __ATTRS_o_ai\nvec_vand(vector unsigned short a, vector bool short b)\n{\n  return a & (vector unsigned short)b;\n}\n\nstatic vector bool short __ATTRS_o_ai\nvec_vand(vector bool short a, vector bool short b)\n{\n  return a & b;\n}\n\nstatic vector int __ATTRS_o_ai\nvec_vand(vector int a, vector int b)\n{\n  return a & b;\n}\n\nstatic vector int __ATTRS_o_ai\nvec_vand(vector bool int a, vector int b)\n{\n  return (vector int)a & b;\n}\n\nstatic vector int __ATTRS_o_ai\nvec_vand(vector int a, vector bool int b)\n{\n  return a & (vector int)b;\n}\n\nstatic vector unsigned int __ATTRS_o_ai\nvec_vand(vector unsigned int a, vector unsigned int b)\n{\n  return a & b;\n}\n\nstatic vector unsigned int __ATTRS_o_ai\nvec_vand(vector bool int a, vector unsigned int b)\n{\n  return (vector unsigned int)a & b;\n}\n\nstatic vector unsigned int __ATTRS_o_ai\nvec_vand(vector unsigned int a, vector bool int b)\n{\n  return a & (vector unsigned int)b;\n}\n\nstatic vector bool int __ATTRS_o_ai\nvec_vand(vector bool int a, vector bool int b)\n{\n  return a & b;\n}\n\nstatic vector float __ATTRS_o_ai\nvec_vand(vector float a, vector float b)\n{\n  vector unsigned int res = (vector unsigned int)a & (vector unsigned int)b;\n  return (vector float)res;\n}\n\nstatic vector float __ATTRS_o_ai\nvec_vand(vector bool int a, vector float b)\n{\n  vector unsigned int res = (vector unsigned int)a & (vector unsigned int)b;\n  return (vector float)res;\n}\n\nstatic vector float __ATTRS_o_ai\nvec_vand(vector float a, vector bool int b)\n{\n  vector unsigned int res = (vector unsigned int)a & (vector unsigned int)b;\n  return (vector float)res;\n}\n\n/* vec_andc */\n\n#define __builtin_altivec_vandc vec_andc\n\nstatic vector signed char __ATTRS_o_ai\nvec_andc(vector signed char a, vector signed char b)\n{\n  return a & ~b;\n}\n\nstatic vector signed char __ATTRS_o_ai\nvec_andc(vector bool char a, vector signed char b)\n{\n  return (vector signed char)a & ~b;\n}\n\nstatic vector signed char __ATTRS_o_ai\nvec_andc(vector signed char a, vector bool char b)\n{\n  return a & ~(vector signed char)b;\n}\n\nstatic vector unsigned char __ATTRS_o_ai\nvec_andc(vector unsigned char a, vector unsigned char b)\n{\n  return a & ~b;\n}\n\nstatic vector unsigned char __ATTRS_o_ai\nvec_andc(vector bool char a, vector unsigned char b)\n{\n  return (vector unsigned char)a & ~b;\n}\n\nstatic vector unsigned char __ATTRS_o_ai\nvec_andc(vector unsigned char a, vector bool char b)\n{\n  return a & ~(vector unsigned char)b;\n}\n\nstatic vector bool char __ATTRS_o_ai\nvec_andc(vector bool char a, vector bool char b)\n{\n  return a & ~b;\n}\n\nstatic vector short __ATTRS_o_ai\nvec_andc(vector short a, vector short b)\n{\n  return a & ~b;\n}\n\nstatic vector short __ATTRS_o_ai\nvec_andc(vector bool short a, vector short b)\n{\n  return (vector short)a & ~b;\n}\n\nstatic vector short __ATTRS_o_ai\nvec_andc(vector short a, vector bool short b)\n{\n  return a & ~(vector short)b;\n}\n\nstatic vector unsigned short __ATTRS_o_ai\nvec_andc(vector unsigned short a, vector unsigned short b)\n{\n  return a & ~b;\n}\n\nstatic vector unsigned short __ATTRS_o_ai\nvec_andc(vector bool short a, vector unsigned short b)\n{\n  return (vector unsigned short)a & ~b;\n}\n\nstatic vector unsigned short __ATTRS_o_ai\nvec_andc(vector unsigned short a, vector bool short b)\n{\n  return a & ~(vector unsigned short)b;\n}\n\nstatic vector bool short __ATTRS_o_ai\nvec_andc(vector bool short a, vector bool short b)\n{\n  return a & ~b;\n}\n\nstatic vector int __ATTRS_o_ai\nvec_andc(vector int a, vector int b)\n{\n  return a & ~b;\n}\n\nstatic vector int __ATTRS_o_ai\nvec_andc(vector bool int a, vector int b)\n{\n  return (vector int)a & ~b;\n}\n\nstatic vector int __ATTRS_o_ai\nvec_andc(vector int a, vector bool int b)\n{\n  return a & ~(vector int)b;\n}\n\nstatic vector unsigned int __ATTRS_o_ai\nvec_andc(vector unsigned int a, vector unsigned int b)\n{\n  return a & ~b;\n}\n\nstatic vector unsigned int __ATTRS_o_ai\nvec_andc(vector bool int a, vector unsigned int b)\n{\n  return (vector unsigned int)a & ~b;\n}\n\nstatic vector unsigned int __ATTRS_o_ai\nvec_andc(vector unsigned int a, vector bool int b)\n{\n  return a & ~(vector unsigned int)b;\n}\n\nstatic vector bool int __ATTRS_o_ai\nvec_andc(vector bool int a, vector bool int b)\n{\n  return a & ~b;\n}\n\nstatic vector float __ATTRS_o_ai\nvec_andc(vector float a, vector float b)\n{\n  vector unsigned int res = (vector unsigned int)a & ~(vector unsigned int)b;\n  return (vector float)res;\n}\n\nstatic vector float __ATTRS_o_ai\nvec_andc(vector bool int a, vector float b)\n{\n  vector unsigned int res = (vector unsigned int)a & ~(vector unsigned int)b;\n  return (vector float)res;\n}\n\nstatic vector float __ATTRS_o_ai\nvec_andc(vector float a, vector bool int b)\n{\n  vector unsigned int res = (vector unsigned int)a & ~(vector unsigned int)b;\n  return (vector float)res;\n}\n\n/* vec_vandc */\n\nstatic vector signed char __ATTRS_o_ai\nvec_vandc(vector signed char a, vector signed char b)\n{\n  return a & ~b;\n}\n\nstatic vector signed char __ATTRS_o_ai\nvec_vandc(vector bool char a, vector signed char b)\n{\n  return (vector signed char)a & ~b;\n}\n\nstatic vector signed char __ATTRS_o_ai\nvec_vandc(vector signed char a, vector bool char b)\n{\n  return a & ~(vector signed char)b;\n}\n\nstatic vector unsigned char __ATTRS_o_ai\nvec_vandc(vector unsigned char a, vector unsigned char b)\n{\n  return a & ~b;\n}\n\nstatic vector unsigned char __ATTRS_o_ai\nvec_vandc(vector bool char a, vector unsigned char b)\n{\n  return (vector unsigned char)a & ~b;\n}\n\nstatic vector unsigned char __ATTRS_o_ai\nvec_vandc(vector unsigned char a, vector bool char b)\n{\n  return a & ~(vector unsigned char)b;\n}\n\nstatic vector bool char __ATTRS_o_ai\nvec_vandc(vector bool char a, vector bool char b)\n{\n  return a & ~b;\n}\n\nstatic vector short __ATTRS_o_ai\nvec_vandc(vector short a, vector short b)\n{\n  return a & ~b;\n}\n\nstatic vector short __ATTRS_o_ai\nvec_vandc(vector bool short a, vector short b)\n{\n  return (vector short)a & ~b;\n}\n\nstatic vector short __ATTRS_o_ai\nvec_vandc(vector short a, vector bool short b)\n{\n  return a & ~(vector short)b;\n}\n\nstatic vector unsigned short __ATTRS_o_ai\nvec_vandc(vector unsigned short a, vector unsigned short b)\n{\n  return a & ~b;\n}\n\nstatic vector unsigned short __ATTRS_o_ai\nvec_vandc(vector bool short a, vector unsigned short b)\n{\n  return (vector unsigned short)a & ~b;\n}\n\nstatic vector unsigned short __ATTRS_o_ai\nvec_vandc(vector unsigned short a, vector bool short b)\n{\n  return a & ~(vector unsigned short)b;\n}\n\nstatic vector bool short __ATTRS_o_ai\nvec_vandc(vector bool short a, vector bool short b)\n{\n  return a & ~b;\n}\n\nstatic vector int __ATTRS_o_ai\nvec_vandc(vector int a, vector int b)\n{\n  return a & ~b;\n}\n\nstatic vector int __ATTRS_o_ai\nvec_vandc(vector bool int a, vector int b)\n{\n  return (vector int)a & ~b;\n}\n\nstatic vector int __ATTRS_o_ai\nvec_vandc(vector int a, vector bool int b)\n{\n  return a & ~(vector int)b;\n}\n\nstatic vector unsigned int __ATTRS_o_ai\nvec_vandc(vector unsigned int a, vector unsigned int b)\n{\n  return a & ~b;\n}\n\nstatic vector unsigned int __ATTRS_o_ai\nvec_vandc(vector bool int a, vector unsigned int b)\n{\n  return (vector unsigned int)a & ~b;\n}\n\nstatic vector unsigned int __ATTRS_o_ai\nvec_vandc(vector unsigned int a, vector bool int b)\n{\n  return a & ~(vector unsigned int)b;\n}\n\nstatic vector bool int __ATTRS_o_ai\nvec_vandc(vector bool int a, vector bool int b)\n{\n  return a & ~b;\n}\n\nstatic vector float __ATTRS_o_ai\nvec_vandc(vector float a, vector float b)\n{\n  vector unsigned int res = (vector unsigned int)a & ~(vector unsigned int)b;\n  return (vector float)res;\n}\n\nstatic vector float __ATTRS_o_ai\nvec_vandc(vector bool int a, vector float b)\n{\n  vector unsigned int res = (vector unsigned int)a & ~(vector unsigned int)b;\n  return (vector float)res;\n}\n\nstatic vector float __ATTRS_o_ai\nvec_vandc(vector float a, vector bool int b)\n{\n  vector unsigned int res = (vector unsigned int)a & ~(vector unsigned int)b;\n  return (vector float)res;\n}\n\n/* vec_avg */\n\nstatic vector signed char __ATTRS_o_ai\nvec_avg(vector signed char a, vector signed char b)\n{\n  return __builtin_altivec_vavgsb(a, b);\n}\n\nstatic vector unsigned char __ATTRS_o_ai\nvec_avg(vector unsigned char a, vector unsigned char b)\n{\n  return __builtin_altivec_vavgub(a, b);\n}\n\nstatic vector short __ATTRS_o_ai\nvec_avg(vector short a, vector short b)\n{\n  return __builtin_altivec_vavgsh(a, b);\n}\n\nstatic vector unsigned short __ATTRS_o_ai\nvec_avg(vector unsigned short a, vector unsigned short b)\n{\n  return __builtin_altivec_vavguh(a, b);\n}\n\nstatic vector int __ATTRS_o_ai\nvec_avg(vector int a, vector int b)\n{\n  return __builtin_altivec_vavgsw(a, b);\n}\n\nstatic vector unsigned int __ATTRS_o_ai\nvec_avg(vector unsigned int a, vector unsigned int b)\n{\n  return __builtin_altivec_vavguw(a, b);\n}\n\n/* vec_vavgsb */\n\nstatic vector signed char __attribute__((__always_inline__))\nvec_vavgsb(vector signed char a, vector signed char b)\n{\n  return __builtin_altivec_vavgsb(a, b);\n}\n\n/* vec_vavgub */\n\nstatic vector unsigned char __attribute__((__always_inline__))\nvec_vavgub(vector unsigned char a, vector unsigned char b)\n{\n  return __builtin_altivec_vavgub(a, b);\n}\n\n/* vec_vavgsh */\n\nstatic vector short __attribute__((__always_inline__))\nvec_vavgsh(vector short a, vector short b)\n{\n  return __builtin_altivec_vavgsh(a, b);\n}\n\n/* vec_vavguh */\n\nstatic vector unsigned short __attribute__((__always_inline__))\nvec_vavguh(vector unsigned short a, vector unsigned short b)\n{\n  return __builtin_altivec_vavguh(a, b);\n}\n\n/* vec_vavgsw */\n\nstatic vector int __attribute__((__always_inline__))\nvec_vavgsw(vector int a, vector int b)\n{\n  return __builtin_altivec_vavgsw(a, b);\n}\n\n/* vec_vavguw */\n\nstatic vector unsigned int __attribute__((__always_inline__))\nvec_vavguw(vector unsigned int a, vector unsigned int b)\n{\n  return __builtin_altivec_vavguw(a, b);\n}\n\n/* vec_ceil */\n\nstatic vector float __attribute__((__always_inline__))\nvec_ceil(vector float a)\n{\n  return __builtin_altivec_vrfip(a);\n}\n\n/* vec_vrfip */\n\nstatic vector float __attribute__((__always_inline__))\nvec_vrfip(vector float a)\n{\n  return __builtin_altivec_vrfip(a);\n}\n\n/* vec_cmpb */\n\nstatic vector int __attribute__((__always_inline__))\nvec_cmpb(vector float a, vector float b)\n{\n  return __builtin_altivec_vcmpbfp(a, b);\n}\n\n/* vec_vcmpbfp */\n\nstatic vector int __attribute__((__always_inline__))\nvec_vcmpbfp(vector float a, vector float b)\n{\n  return __builtin_altivec_vcmpbfp(a, b);\n}\n\n/* vec_cmpeq */\n\nstatic vector bool char __ATTRS_o_ai\nvec_cmpeq(vector signed char a, vector signed char b)\n{\n  return (vector bool char)\n    __builtin_altivec_vcmpequb((vector char)a, (vector char)b);\n}\n\nstatic vector bool char __ATTRS_o_ai\nvec_cmpeq(vector unsigned char a, vector unsigned char b)\n{\n  return (vector bool char)\n    __builtin_altivec_vcmpequb((vector char)a, (vector char)b);\n}\n\nstatic vector bool short __ATTRS_o_ai\nvec_cmpeq(vector short a, vector short b)\n{\n  return (vector bool short)__builtin_altivec_vcmpequh(a, b);\n}\n\nstatic vector bool short __ATTRS_o_ai\nvec_cmpeq(vector unsigned short a, vector unsigned short b)\n{\n  return (vector bool short)\n    __builtin_altivec_vcmpequh((vector short)a, (vector short)b);\n}\n\nstatic vector bool int __ATTRS_o_ai\nvec_cmpeq(vector int a, vector int b)\n{\n  return (vector bool int)__builtin_altivec_vcmpequw(a, b);\n}\n\nstatic vector bool int __ATTRS_o_ai\nvec_cmpeq(vector unsigned int a, vector unsigned int b)\n{\n  return (vector bool int)\n    __builtin_altivec_vcmpequw((vector int)a, (vector int)b);\n}\n\nstatic vector bool int __ATTRS_o_ai\nvec_cmpeq(vector float a, vector float b)\n{\n  return (vector bool int)__builtin_altivec_vcmpeqfp(a, b);\n}\n\n/* vec_cmpge */\n\nstatic vector bool int __attribute__((__always_inline__))\nvec_cmpge(vector float a, vector float b)\n{\n  return (vector bool int)__builtin_altivec_vcmpgefp(a, b);\n}\n\n/* vec_vcmpgefp */\n\nstatic vector bool int __attribute__((__always_inline__))\nvec_vcmpgefp(vector float a, vector float b)\n{\n  return (vector bool int)__builtin_altivec_vcmpgefp(a, b);\n}\n\n/* vec_cmpgt */\n\nstatic vector bool char __ATTRS_o_ai\nvec_cmpgt(vector signed char a, vector signed char b)\n{\n  return (vector bool char)__builtin_altivec_vcmpgtsb(a, b);\n}\n\nstatic vector bool char __ATTRS_o_ai\nvec_cmpgt(vector unsigned char a, vector unsigned char b)\n{\n  return (vector bool char)__builtin_altivec_vcmpgtub(a, b);\n}\n\nstatic vector bool short __ATTRS_o_ai\nvec_cmpgt(vector short a, vector short b)\n{\n  return (vector bool short)__builtin_altivec_vcmpgtsh(a, b);\n}\n\nstatic vector bool short __ATTRS_o_ai\nvec_cmpgt(vector unsigned short a, vector unsigned short b)\n{\n  return (vector bool short)__builtin_altivec_vcmpgtuh(a, b);\n}\n\nstatic vector bool int __ATTRS_o_ai\nvec_cmpgt(vector int a, vector int b)\n{\n  return (vector bool int)__builtin_altivec_vcmpgtsw(a, b);\n}\n\nstatic vector bool int __ATTRS_o_ai\nvec_cmpgt(vector unsigned int a, vector unsigned int b)\n{\n  return (vector bool int)__builtin_altivec_vcmpgtuw(a, b);\n}\n\nstatic vector bool int __ATTRS_o_ai\nvec_cmpgt(vector float a, vector float b)\n{\n  return (vector bool int)__builtin_altivec_vcmpgtfp(a, b);\n}\n\n/* vec_vcmpgtsb */\n\nstatic vector bool char __attribute__((__always_inline__))\nvec_vcmpgtsb(vector signed char a, vector signed char b)\n{\n  return (vector bool char)__builtin_altivec_vcmpgtsb(a, b);\n}\n\n/* vec_vcmpgtub */\n\nstatic vector bool char __attribute__((__always_inline__))\nvec_vcmpgtub(vector unsigned char a, vector unsigned char b)\n{\n  return (vector bool char)__builtin_altivec_vcmpgtub(a, b);\n}\n\n/* vec_vcmpgtsh */\n\nstatic vector bool short __attribute__((__always_inline__))\nvec_vcmpgtsh(vector short a, vector short b)\n{\n  return (vector bool short)__builtin_altivec_vcmpgtsh(a, b);\n}\n\n/* vec_vcmpgtuh */\n\nstatic vector bool short __attribute__((__always_inline__))\nvec_vcmpgtuh(vector unsigned short a, vector unsigned short b)\n{\n  return (vector bool short)__builtin_altivec_vcmpgtuh(a, b);\n}\n\n/* vec_vcmpgtsw */\n\nstatic vector bool int __attribute__((__always_inline__))\nvec_vcmpgtsw(vector int a, vector int b)\n{\n  return (vector bool int)__builtin_altivec_vcmpgtsw(a, b);\n}\n\n/* vec_vcmpgtuw */\n\nstatic vector bool int __attribute__((__always_inline__))\nvec_vcmpgtuw(vector unsigned int a, vector unsigned int b)\n{\n  return (vector bool int)__builtin_altivec_vcmpgtuw(a, b);\n}\n\n/* vec_vcmpgtfp */\n\nstatic vector bool int __attribute__((__always_inline__))\nvec_vcmpgtfp(vector float a, vector float b)\n{\n  return (vector bool int)__builtin_altivec_vcmpgtfp(a, b);\n}\n\n/* vec_cmple */\n\nstatic vector bool int __attribute__((__always_inline__))\nvec_cmple(vector float a, vector float b)\n{\n  return (vector bool int)__builtin_altivec_vcmpgefp(b, a);\n}\n\n/* vec_cmplt */\n\nstatic vector bool char __ATTRS_o_ai\nvec_cmplt(vector signed char a, vector signed char b)\n{\n  return (vector bool char)__builtin_altivec_vcmpgtsb(b, a);\n}\n\nstatic vector bool char __ATTRS_o_ai\nvec_cmplt(vector unsigned char a, vector unsigned char b)\n{\n  return (vector bool char)__builtin_altivec_vcmpgtub(b, a);\n}\n\nstatic vector bool short __ATTRS_o_ai\nvec_cmplt(vector short a, vector short b)\n{\n  return (vector bool short)__builtin_altivec_vcmpgtsh(b, a);\n}\n\nstatic vector bool short __ATTRS_o_ai\nvec_cmplt(vector unsigned short a, vector unsigned short b)\n{\n  return (vector bool short)__builtin_altivec_vcmpgtuh(b, a);\n}\n\nstatic vector bool int __ATTRS_o_ai\nvec_cmplt(vector int a, vector int b)\n{\n  return (vector bool int)__builtin_altivec_vcmpgtsw(b, a);\n}\n\nstatic vector bool int __ATTRS_o_ai\nvec_cmplt(vector unsigned int a, vector unsigned int b)\n{\n  return (vector bool int)__builtin_altivec_vcmpgtuw(b, a);\n}\n\nstatic vector bool int __ATTRS_o_ai\nvec_cmplt(vector float a, vector float b)\n{\n  return (vector bool int)__builtin_altivec_vcmpgtfp(b, a);\n}\n\n/* vec_ctf */\n\nstatic vector float __ATTRS_o_ai\nvec_ctf(vector int a, int b)\n{\n  return __builtin_altivec_vcfsx(a, b);\n}\n\nstatic vector float __ATTRS_o_ai\nvec_ctf(vector unsigned int a, int b)\n{\n  return __builtin_altivec_vcfux((vector int)a, b);\n}\n\n/* vec_vcfsx */\n\nstatic vector float __attribute__((__always_inline__))\nvec_vcfsx(vector int a, int b)\n{\n  return __builtin_altivec_vcfsx(a, b);\n}\n\n/* vec_vcfux */\n\nstatic vector float __attribute__((__always_inline__))\nvec_vcfux(vector unsigned int a, int b)\n{\n  return __builtin_altivec_vcfux((vector int)a, b);\n}\n\n/* vec_cts */\n\nstatic vector int __attribute__((__always_inline__))\nvec_cts(vector float a, int b)\n{\n  return __builtin_altivec_vctsxs(a, b);\n}\n\n/* vec_vctsxs */\n\nstatic vector int __attribute__((__always_inline__))\nvec_vctsxs(vector float a, int b)\n{\n  return __builtin_altivec_vctsxs(a, b);\n}\n\n/* vec_ctu */\n\nstatic vector unsigned int __attribute__((__always_inline__))\nvec_ctu(vector float a, int b)\n{\n  return __builtin_altivec_vctuxs(a, b);\n}\n\n/* vec_vctuxs */\n\nstatic vector unsigned int __attribute__((__always_inline__))\nvec_vctuxs(vector float a, int b)\n{\n  return __builtin_altivec_vctuxs(a, b);\n}\n\n/* vec_dss */\n\nstatic void __attribute__((__always_inline__))\nvec_dss(int a)\n{\n  __builtin_altivec_dss(a);\n}\n\n/* vec_dssall */\n\nstatic void __attribute__((__always_inline__))\nvec_dssall(void)\n{\n  __builtin_altivec_dssall();\n}\n\n/* vec_dst */\n\nstatic void __attribute__((__always_inline__))\nvec_dst(const void *a, int b, int c)\n{\n  __builtin_altivec_dst(a, b, c);\n}\n\n/* vec_dstst */\n\nstatic void __attribute__((__always_inline__))\nvec_dstst(const void *a, int b, int c)\n{\n  __builtin_altivec_dstst(a, b, c);\n}\n\n/* vec_dststt */\n\nstatic void __attribute__((__always_inline__))\nvec_dststt(const void *a, int b, int c)\n{\n  __builtin_altivec_dststt(a, b, c);\n}\n\n/* vec_dstt */\n\nstatic void __attribute__((__always_inline__))\nvec_dstt(const void *a, int b, int c)\n{\n  __builtin_altivec_dstt(a, b, c);\n}\n\n/* vec_expte */\n\nstatic vector float __attribute__((__always_inline__))\nvec_expte(vector float a)\n{\n  return __builtin_altivec_vexptefp(a);\n}\n\n/* vec_vexptefp */\n\nstatic vector float __attribute__((__always_inline__))\nvec_vexptefp(vector float a)\n{\n  return __builtin_altivec_vexptefp(a);\n}\n\n/* vec_floor */\n\nstatic vector float __attribute__((__always_inline__))\nvec_floor(vector float a)\n{\n  return __builtin_altivec_vrfim(a);\n}\n\n/* vec_vrfim */\n\nstatic vector float __attribute__((__always_inline__))\nvec_vrfim(vector float a)\n{\n  return __builtin_altivec_vrfim(a);\n}\n\n/* vec_ld */\n\nstatic vector signed char __ATTRS_o_ai\nvec_ld(int a, const vector signed char *b)\n{\n  return (vector signed char)__builtin_altivec_lvx(a, b);\n}\n\nstatic vector signed char __ATTRS_o_ai\nvec_ld(int a, const signed char *b)\n{\n  return (vector signed char)__builtin_altivec_lvx(a, b);\n}\n\nstatic vector unsigned char __ATTRS_o_ai\nvec_ld(int a, const vector unsigned char *b)\n{\n  return (vector unsigned char)__builtin_altivec_lvx(a, b);\n}\n\nstatic vector unsigned char __ATTRS_o_ai\nvec_ld(int a, const unsigned char *b)\n{\n  return (vector unsigned char)__builtin_altivec_lvx(a, b);\n}\n\nstatic vector bool char __ATTRS_o_ai\nvec_ld(int a, const vector bool char *b)\n{\n  return (vector bool char)__builtin_altivec_lvx(a, b);\n}\n\nstatic vector short __ATTRS_o_ai\nvec_ld(int a, const vector short *b)\n{\n  return (vector short)__builtin_altivec_lvx(a, b);\n}\n\nstatic vector short __ATTRS_o_ai\nvec_ld(int a, const short *b)\n{\n  return (vector short)__builtin_altivec_lvx(a, b);\n}\n\nstatic vector unsigned short __ATTRS_o_ai\nvec_ld(int a, const vector unsigned short *b)\n{\n  return (vector unsigned short)__builtin_altivec_lvx(a, b);\n}\n\nstatic vector unsigned short __ATTRS_o_ai\nvec_ld(int a, const unsigned short *b)\n{\n  return (vector unsigned short)__builtin_altivec_lvx(a, b);\n}\n\nstatic vector bool short __ATTRS_o_ai\nvec_ld(int a, const vector bool short *b)\n{\n  return (vector bool short)__builtin_altivec_lvx(a, b);\n}\n\nstatic vector pixel __ATTRS_o_ai\nvec_ld(int a, const vector pixel *b)\n{\n  return (vector pixel)__builtin_altivec_lvx(a, b);\n}\n\nstatic vector int __ATTRS_o_ai\nvec_ld(int a, const vector int *b)\n{\n  return (vector int)__builtin_altivec_lvx(a, b);\n}\n\nstatic vector int __ATTRS_o_ai\nvec_ld(int a, const int *b)\n{\n  return (vector int)__builtin_altivec_lvx(a, b);\n}\n\nstatic vector unsigned int __ATTRS_o_ai\nvec_ld(int a, const vector unsigned int *b)\n{\n  return (vector unsigned int)__builtin_altivec_lvx(a, b);\n}\n\nstatic vector unsigned int __ATTRS_o_ai\nvec_ld(int a, const unsigned int *b)\n{\n  return (vector unsigned int)__builtin_altivec_lvx(a, b);\n}\n\nstatic vector bool int __ATTRS_o_ai\nvec_ld(int a, const vector bool int *b)\n{\n  return (vector bool int)__builtin_altivec_lvx(a, b);\n}\n\nstatic vector float __ATTRS_o_ai\nvec_ld(int a, const vector float *b)\n{\n  return (vector float)__builtin_altivec_lvx(a, b);\n}\n\nstatic vector float __ATTRS_o_ai\nvec_ld(int a, const float *b)\n{\n  return (vector float)__builtin_altivec_lvx(a, b);\n}\n\n/* vec_lvx */\n\nstatic vector signed char __ATTRS_o_ai\nvec_lvx(int a, const vector signed char *b)\n{\n  return (vector signed char)__builtin_altivec_lvx(a, b);\n}\n\nstatic vector signed char __ATTRS_o_ai\nvec_lvx(int a, const signed char *b)\n{\n  return (vector signed char)__builtin_altivec_lvx(a, b);\n}\n\nstatic vector unsigned char __ATTRS_o_ai\nvec_lvx(int a, const vector unsigned char *b)\n{\n  return (vector unsigned char)__builtin_altivec_lvx(a, b);\n}\n\nstatic vector unsigned char __ATTRS_o_ai\nvec_lvx(int a, const unsigned char *b)\n{\n  return (vector unsigned char)__builtin_altivec_lvx(a, b);\n}\n\nstatic vector bool char __ATTRS_o_ai\nvec_lvx(int a, const vector bool char *b)\n{\n  return (vector bool char)__builtin_altivec_lvx(a, b);\n}\n\nstatic vector short __ATTRS_o_ai\nvec_lvx(int a, const vector short *b)\n{\n  return (vector short)__builtin_altivec_lvx(a, b);\n}\n\nstatic vector short __ATTRS_o_ai\nvec_lvx(int a, const short *b)\n{\n  return (vector short)__builtin_altivec_lvx(a, b);\n}\n\nstatic vector unsigned short __ATTRS_o_ai\nvec_lvx(int a, const vector unsigned short *b)\n{\n  return (vector unsigned short)__builtin_altivec_lvx(a, b);\n}\n\nstatic vector unsigned short __ATTRS_o_ai\nvec_lvx(int a, const unsigned short *b)\n{\n  return (vector unsigned short)__builtin_altivec_lvx(a, b);\n}\n\nstatic vector bool short __ATTRS_o_ai\nvec_lvx(int a, const vector bool short *b)\n{\n  return (vector bool short)__builtin_altivec_lvx(a, b);\n}\n\nstatic vector pixel __ATTRS_o_ai\nvec_lvx(int a, const vector pixel *b)\n{\n  return (vector pixel)__builtin_altivec_lvx(a, b);\n}\n\nstatic vector int __ATTRS_o_ai\nvec_lvx(int a, const vector int *b)\n{\n  return (vector int)__builtin_altivec_lvx(a, b);\n}\n\nstatic vector int __ATTRS_o_ai\nvec_lvx(int a, const int *b)\n{\n  return (vector int)__builtin_altivec_lvx(a, b);\n}\n\nstatic vector unsigned int __ATTRS_o_ai\nvec_lvx(int a, const vector unsigned int *b)\n{\n  return (vector unsigned int)__builtin_altivec_lvx(a, b);\n}\n\nstatic vector unsigned int __ATTRS_o_ai\nvec_lvx(int a, const unsigned int *b)\n{\n  return (vector unsigned int)__builtin_altivec_lvx(a, b);\n}\n\nstatic vector bool int __ATTRS_o_ai\nvec_lvx(int a, const vector bool int *b)\n{\n  return (vector bool int)__builtin_altivec_lvx(a, b);\n}\n\nstatic vector float __ATTRS_o_ai\nvec_lvx(int a, const vector float *b)\n{\n  return (vector float)__builtin_altivec_lvx(a, b);\n}\n\nstatic vector float __ATTRS_o_ai\nvec_lvx(int a, const float *b)\n{\n  return (vector float)__builtin_altivec_lvx(a, b);\n}\n\n/* vec_lde */\n\nstatic vector signed char __ATTRS_o_ai\nvec_lde(int a, const vector signed char *b)\n{\n  return (vector signed char)__builtin_altivec_lvebx(a, b);\n}\n\nstatic vector unsigned char __ATTRS_o_ai\nvec_lde(int a, const vector unsigned char *b)\n{\n  return (vector unsigned char)__builtin_altivec_lvebx(a, b);\n}\n\nstatic vector short __ATTRS_o_ai\nvec_lde(int a, const vector short *b)\n{\n  return (vector short)__builtin_altivec_lvehx(a, b);\n}\n\nstatic vector unsigned short __ATTRS_o_ai\nvec_lde(int a, const vector unsigned short *b)\n{\n  return (vector unsigned short)__builtin_altivec_lvehx(a, b);\n}\n\nstatic vector int __ATTRS_o_ai\nvec_lde(int a, const vector int *b)\n{\n  return (vector int)__builtin_altivec_lvewx(a, b);\n}\n\nstatic vector unsigned int __ATTRS_o_ai\nvec_lde(int a, const vector unsigned int *b)\n{\n  return (vector unsigned int)__builtin_altivec_lvewx(a, b);\n}\n\nstatic vector float __ATTRS_o_ai\nvec_lde(int a, const vector float *b)\n{\n  return (vector float)__builtin_altivec_lvewx(a, b);\n}\n\n/* vec_lvebx */\n\nstatic vector signed char __ATTRS_o_ai\nvec_lvebx(int a, const vector signed char *b)\n{\n  return (vector signed char)__builtin_altivec_lvebx(a, b);\n}\n\nstatic vector unsigned char __ATTRS_o_ai\nvec_lvebx(int a, const vector unsigned char *b)\n{\n  return (vector unsigned char)__builtin_altivec_lvebx(a, b);\n}\n\n/* vec_lvehx */\n\nstatic vector short __ATTRS_o_ai\nvec_lvehx(int a, const vector short *b)\n{\n  return (vector short)__builtin_altivec_lvehx(a, b);\n}\n\nstatic vector unsigned short __ATTRS_o_ai\nvec_lvehx(int a, const vector unsigned short *b)\n{\n  return (vector unsigned short)__builtin_altivec_lvehx(a, b);\n}\n\n/* vec_lvewx */\n\nstatic vector int __ATTRS_o_ai\nvec_lvewx(int a, const vector int *b)\n{\n  return (vector int)__builtin_altivec_lvewx(a, b);\n}\n\nstatic vector unsigned int __ATTRS_o_ai\nvec_lvewx(int a, const vector unsigned int *b)\n{\n  return (vector unsigned int)__builtin_altivec_lvewx(a, b);\n}\n\nstatic vector float __ATTRS_o_ai\nvec_lvewx(int a, const vector float *b)\n{\n  return (vector float)__builtin_altivec_lvewx(a, b);\n}\n\n/* vec_ldl */\n\nstatic vector signed char __ATTRS_o_ai\nvec_ldl(int a, const vector signed char *b)\n{\n  return (vector signed char)__builtin_altivec_lvxl(a, b);\n}\n\nstatic vector signed char __ATTRS_o_ai\nvec_ldl(int a, const signed char *b)\n{\n  return (vector signed char)__builtin_altivec_lvxl(a, b);\n}\n\nstatic vector unsigned char __ATTRS_o_ai\nvec_ldl(int a, const vector unsigned char *b)\n{\n  return (vector unsigned char)__builtin_altivec_lvxl(a, b);\n}\n\nstatic vector unsigned char __ATTRS_o_ai\nvec_ldl(int a, const unsigned char *b)\n{\n  return (vector unsigned char)__builtin_altivec_lvxl(a, b);\n}\n\nstatic vector bool char __ATTRS_o_ai\nvec_ldl(int a, const vector bool char *b)\n{\n  return (vector bool char)__builtin_altivec_lvxl(a, b);\n}\n\nstatic vector short __ATTRS_o_ai\nvec_ldl(int a, const vector short *b)\n{\n  return (vector short)__builtin_altivec_lvxl(a, b);\n}\n\nstatic vector short __ATTRS_o_ai\nvec_ldl(int a, const short *b)\n{\n  return (vector short)__builtin_altivec_lvxl(a, b);\n}\n\nstatic vector unsigned short __ATTRS_o_ai\nvec_ldl(int a, const vector unsigned short *b)\n{\n  return (vector unsigned short)__builtin_altivec_lvxl(a, b);\n}\n\nstatic vector unsigned short __ATTRS_o_ai\nvec_ldl(int a, const unsigned short *b)\n{\n  return (vector unsigned short)__builtin_altivec_lvxl(a, b);\n}\n\nstatic vector bool short __ATTRS_o_ai\nvec_ldl(int a, const vector bool short *b)\n{\n  return (vector bool short)__builtin_altivec_lvxl(a, b);\n}\n\nstatic vector pixel __ATTRS_o_ai\nvec_ldl(int a, const vector pixel *b)\n{\n  return (vector pixel short)__builtin_altivec_lvxl(a, b);\n}\n\nstatic vector int __ATTRS_o_ai\nvec_ldl(int a, const vector int *b)\n{\n  return (vector int)__builtin_altivec_lvxl(a, b);\n}\n\nstatic vector int __ATTRS_o_ai\nvec_ldl(int a, const int *b)\n{\n  return (vector int)__builtin_altivec_lvxl(a, b);\n}\n\nstatic vector unsigned int __ATTRS_o_ai\nvec_ldl(int a, const vector unsigned int *b)\n{\n  return (vector unsigned int)__builtin_altivec_lvxl(a, b);\n}\n\nstatic vector unsigned int __ATTRS_o_ai\nvec_ldl(int a, const unsigned int *b)\n{\n  return (vector unsigned int)__builtin_altivec_lvxl(a, b);\n}\n\nstatic vector bool int __ATTRS_o_ai\nvec_ldl(int a, const vector bool int *b)\n{\n  return (vector bool int)__builtin_altivec_lvxl(a, b);\n}\n\nstatic vector float __ATTRS_o_ai\nvec_ldl(int a, const vector float *b)\n{\n  return (vector float)__builtin_altivec_lvxl(a, b);\n}\n\nstatic vector float __ATTRS_o_ai\nvec_ldl(int a, const float *b)\n{\n  return (vector float)__builtin_altivec_lvxl(a, b);\n}\n\n/* vec_lvxl */\n\nstatic vector signed char __ATTRS_o_ai\nvec_lvxl(int a, const vector signed char *b)\n{\n  return (vector signed char)__builtin_altivec_lvxl(a, b);\n}\n\nstatic vector signed char __ATTRS_o_ai\nvec_lvxl(int a, const signed char *b)\n{\n  return (vector signed char)__builtin_altivec_lvxl(a, b);\n}\n\nstatic vector unsigned char __ATTRS_o_ai\nvec_lvxl(int a, const vector unsigned char *b)\n{\n  return (vector unsigned char)__builtin_altivec_lvxl(a, b);\n}\n\nstatic vector unsigned char __ATTRS_o_ai\nvec_lvxl(int a, const unsigned char *b)\n{\n  return (vector unsigned char)__builtin_altivec_lvxl(a, b);\n}\n\nstatic vector bool char __ATTRS_o_ai\nvec_lvxl(int a, const vector bool char *b)\n{\n  return (vector bool char)__builtin_altivec_lvxl(a, b);\n}\n\nstatic vector short __ATTRS_o_ai\nvec_lvxl(int a, const vector short *b)\n{\n  return (vector short)__builtin_altivec_lvxl(a, b);\n}\n\nstatic vector short __ATTRS_o_ai\nvec_lvxl(int a, const short *b)\n{\n  return (vector short)__builtin_altivec_lvxl(a, b);\n}\n\nstatic vector unsigned short __ATTRS_o_ai\nvec_lvxl(int a, const vector unsigned short *b)\n{\n  return (vector unsigned short)__builtin_altivec_lvxl(a, b);\n}\n\nstatic vector unsigned short __ATTRS_o_ai\nvec_lvxl(int a, const unsigned short *b)\n{\n  return (vector unsigned short)__builtin_altivec_lvxl(a, b);\n}\n\nstatic vector bool short __ATTRS_o_ai\nvec_lvxl(int a, const vector bool short *b)\n{\n  return (vector bool short)__builtin_altivec_lvxl(a, b);\n}\n\nstatic vector pixel __ATTRS_o_ai\nvec_lvxl(int a, const vector pixel *b)\n{\n  return (vector pixel)__builtin_altivec_lvxl(a, b);\n}\n\nstatic vector int __ATTRS_o_ai\nvec_lvxl(int a, const vector int *b)\n{\n  return (vector int)__builtin_altivec_lvxl(a, b);\n}\n\nstatic vector int __ATTRS_o_ai\nvec_lvxl(int a, const int *b)\n{\n  return (vector int)__builtin_altivec_lvxl(a, b);\n}\n\nstatic vector unsigned int __ATTRS_o_ai\nvec_lvxl(int a, const vector unsigned int *b)\n{\n  return (vector unsigned int)__builtin_altivec_lvxl(a, b);\n}\n\nstatic vector unsigned int __ATTRS_o_ai\nvec_lvxl(int a, const unsigned int *b)\n{\n  return (vector unsigned int)__builtin_altivec_lvxl(a, b);\n}\n\nstatic vector bool int __ATTRS_o_ai\nvec_lvxl(int a, const vector bool int *b)\n{\n  return (vector bool int)__builtin_altivec_lvxl(a, b);\n}\n\nstatic vector float __ATTRS_o_ai\nvec_lvxl(int a, const vector float *b)\n{\n  return (vector float)__builtin_altivec_lvxl(a, b);\n}\n\nstatic vector float __ATTRS_o_ai\nvec_lvxl(int a, const float *b)\n{\n  return (vector float)__builtin_altivec_lvxl(a, b);\n}\n\n/* vec_loge */\n\nstatic vector float __attribute__((__always_inline__))\nvec_loge(vector float a)\n{\n  return __builtin_altivec_vlogefp(a);\n}\n\n/* vec_vlogefp */\n\nstatic vector float __attribute__((__always_inline__))\nvec_vlogefp(vector float a)\n{\n  return __builtin_altivec_vlogefp(a);\n}\n\n/* vec_lvsl */\n\nstatic vector unsigned char __ATTRS_o_ai\nvec_lvsl(int a, const signed char *b)\n{\n  return (vector unsigned char)__builtin_altivec_lvsl(a, b);\n}\n\nstatic vector unsigned char __ATTRS_o_ai\nvec_lvsl(int a, const unsigned char *b)\n{\n  return (vector unsigned char)__builtin_altivec_lvsl(a, b);\n}\n\nstatic vector unsigned char __ATTRS_o_ai\nvec_lvsl(int a, const short *b)\n{\n  return (vector unsigned char)__builtin_altivec_lvsl(a, b);\n}\n\nstatic vector unsigned char __ATTRS_o_ai\nvec_lvsl(int a, const unsigned short *b)\n{\n  return (vector unsigned char)__builtin_altivec_lvsl(a, b);\n}\n\nstatic vector unsigned char __ATTRS_o_ai\nvec_lvsl(int a, const int *b)\n{\n  return (vector unsigned char)__builtin_altivec_lvsl(a, b);\n}\n\nstatic vector unsigned char __ATTRS_o_ai\nvec_lvsl(int a, const unsigned int *b)\n{\n  return (vector unsigned char)__builtin_altivec_lvsl(a, b);\n}\n\nstatic vector unsigned char __ATTRS_o_ai\nvec_lvsl(int a, const float *b)\n{\n  return (vector unsigned char)__builtin_altivec_lvsl(a, b);\n}\n\n/* vec_lvsr */\n\nstatic vector unsigned char __ATTRS_o_ai\nvec_lvsr(int a, const signed char *b)\n{\n  return (vector unsigned char)__builtin_altivec_lvsr(a, b);\n}\n\nstatic vector unsigned char __ATTRS_o_ai\nvec_lvsr(int a, const unsigned char *b)\n{\n  return (vector unsigned char)__builtin_altivec_lvsr(a, b);\n}\n\nstatic vector unsigned char __ATTRS_o_ai\nvec_lvsr(int a, const short *b)\n{\n  return (vector unsigned char)__builtin_altivec_lvsr(a, b);\n}\n\nstatic vector unsigned char __ATTRS_o_ai\nvec_lvsr(int a, const unsigned short *b)\n{\n  return (vector unsigned char)__builtin_altivec_lvsr(a, b);\n}\n\nstatic vector unsigned char __ATTRS_o_ai\nvec_lvsr(int a, const int *b)\n{\n  return (vector unsigned char)__builtin_altivec_lvsr(a, b);\n}\n\nstatic vector unsigned char __ATTRS_o_ai\nvec_lvsr(int a, const unsigned int *b)\n{\n  return (vector unsigned char)__builtin_altivec_lvsr(a, b);\n}\n\nstatic vector unsigned char __ATTRS_o_ai\nvec_lvsr(int a, const float *b)\n{\n  return (vector unsigned char)__builtin_altivec_lvsr(a, b);\n}\n\n/* vec_madd */\n\nstatic vector float __attribute__((__always_inline__))\nvec_madd(vector float a, vector float b, vector float c)\n{\n  return __builtin_altivec_vmaddfp(a, b, c);\n}\n\n/* vec_vmaddfp */\n\nstatic vector float __attribute__((__always_inline__))\nvec_vmaddfp(vector float a, vector float b, vector float c)\n{\n  return __builtin_altivec_vmaddfp(a, b, c);\n}\n\n/* vec_madds */\n\nstatic vector signed short __attribute__((__always_inline__))\nvec_madds(vector signed short a, vector signed short b, vector signed short c)\n{\n  return __builtin_altivec_vmhaddshs(a, b, c);\n}\n\n/* vec_vmhaddshs */\nstatic vector signed short __attribute__((__always_inline__))\nvec_vmhaddshs(vector signed short a,\n              vector signed short b, \n              vector signed short c)\n{\n  return __builtin_altivec_vmhaddshs(a, b, c);\n}\n\n/* vec_max */\n\nstatic vector signed char __ATTRS_o_ai\nvec_max(vector signed char a, vector signed char b)\n{\n  return __builtin_altivec_vmaxsb(a, b);\n}\n\nstatic vector signed char __ATTRS_o_ai\nvec_max(vector bool char a, vector signed char b)\n{\n  return __builtin_altivec_vmaxsb((vector signed char)a, b);\n}\n\nstatic vector signed char __ATTRS_o_ai\nvec_max(vector signed char a, vector bool char b)\n{\n  return __builtin_altivec_vmaxsb(a, (vector signed char)b);\n}\n\nstatic vector unsigned char __ATTRS_o_ai\nvec_max(vector unsigned char a, vector unsigned char b)\n{\n  return __builtin_altivec_vmaxub(a, b);\n}\n\nstatic vector unsigned char __ATTRS_o_ai\nvec_max(vector bool char a, vector unsigned char b)\n{\n  return __builtin_altivec_vmaxub((vector unsigned char)a, b);\n}\n\nstatic vector unsigned char __ATTRS_o_ai\nvec_max(vector unsigned char a, vector bool char b)\n{\n  return __builtin_altivec_vmaxub(a, (vector unsigned char)b);\n}\n\nstatic vector short __ATTRS_o_ai\nvec_max(vector short a, vector short b)\n{\n  return __builtin_altivec_vmaxsh(a, b);\n}\n\nstatic vector short __ATTRS_o_ai\nvec_max(vector bool short a, vector short b)\n{\n  return __builtin_altivec_vmaxsh((vector short)a, b);\n}\n\nstatic vector short __ATTRS_o_ai\nvec_max(vector short a, vector bool short b)\n{\n  return __builtin_altivec_vmaxsh(a, (vector short)b);\n}\n\nstatic vector unsigned short __ATTRS_o_ai\nvec_max(vector unsigned short a, vector unsigned short b)\n{\n  return __builtin_altivec_vmaxuh(a, b);\n}\n\nstatic vector unsigned short __ATTRS_o_ai\nvec_max(vector bool short a, vector unsigned short b)\n{\n  return __builtin_altivec_vmaxuh((vector unsigned short)a, b);\n}\n\nstatic vector unsigned short __ATTRS_o_ai\nvec_max(vector unsigned short a, vector bool short b)\n{\n  return __builtin_altivec_vmaxuh(a, (vector unsigned short)b);\n}\n\nstatic vector int __ATTRS_o_ai\nvec_max(vector int a, vector int b)\n{\n  return __builtin_altivec_vmaxsw(a, b);\n}\n\nstatic vector int __ATTRS_o_ai\nvec_max(vector bool int a, vector int b)\n{\n  return __builtin_altivec_vmaxsw((vector int)a, b);\n}\n\nstatic vector int __ATTRS_o_ai\nvec_max(vector int a, vector bool int b)\n{\n  return __builtin_altivec_vmaxsw(a, (vector int)b);\n}\n\nstatic vector unsigned int __ATTRS_o_ai\nvec_max(vector unsigned int a, vector unsigned int b)\n{\n  return __builtin_altivec_vmaxuw(a, b);\n}\n\nstatic vector unsigned int __ATTRS_o_ai\nvec_max(vector bool int a, vector unsigned int b)\n{\n  return __builtin_altivec_vmaxuw((vector unsigned int)a, b);\n}\n\nstatic vector unsigned int __ATTRS_o_ai\nvec_max(vector unsigned int a, vector bool int b)\n{\n  return __builtin_altivec_vmaxuw(a, (vector unsigned int)b);\n}\n\nstatic vector float __ATTRS_o_ai\nvec_max(vector float a, vector float b)\n{\n  return __builtin_altivec_vmaxfp(a, b);\n}\n\n/* vec_vmaxsb */\n\nstatic vector signed char __ATTRS_o_ai\nvec_vmaxsb(vector signed char a, vector signed char b)\n{\n  return __builtin_altivec_vmaxsb(a, b);\n}\n\nstatic vector signed char __ATTRS_o_ai\nvec_vmaxsb(vector bool char a, vector signed char b)\n{\n  return __builtin_altivec_vmaxsb((vector signed char)a, b);\n}\n\nstatic vector signed char __ATTRS_o_ai\nvec_vmaxsb(vector signed char a, vector bool char b)\n{\n  return __builtin_altivec_vmaxsb(a, (vector signed char)b);\n}\n\n/* vec_vmaxub */\n\nstatic vector unsigned char __ATTRS_o_ai\nvec_vmaxub(vector unsigned char a, vector unsigned char b)\n{\n  return __builtin_altivec_vmaxub(a, b);\n}\n\nstatic vector unsigned char __ATTRS_o_ai\nvec_vmaxub(vector bool char a, vector unsigned char b)\n{\n  return __builtin_altivec_vmaxub((vector unsigned char)a, b);\n}\n\nstatic vector unsigned char __ATTRS_o_ai\nvec_vmaxub(vector unsigned char a, vector bool char b)\n{\n  return __builtin_altivec_vmaxub(a, (vector unsigned char)b);\n}\n\n/* vec_vmaxsh */\n\nstatic vector short __ATTRS_o_ai\nvec_vmaxsh(vector short a, vector short b)\n{\n  return __builtin_altivec_vmaxsh(a, b);\n}\n\nstatic vector short __ATTRS_o_ai\nvec_vmaxsh(vector bool short a, vector short b)\n{\n  return __builtin_altivec_vmaxsh((vector short)a, b);\n}\n\nstatic vector short __ATTRS_o_ai\nvec_vmaxsh(vector short a, vector bool short b)\n{\n  return __builtin_altivec_vmaxsh(a, (vector short)b);\n}\n\n/* vec_vmaxuh */\n\nstatic vector unsigned short __ATTRS_o_ai\nvec_vmaxuh(vector unsigned short a, vector unsigned short b)\n{\n  return __builtin_altivec_vmaxuh(a, b);\n}\n\nstatic vector unsigned short __ATTRS_o_ai\nvec_vmaxuh(vector bool short a, vector unsigned short b)\n{\n  return __builtin_altivec_vmaxuh((vector unsigned short)a, b);\n}\n\nstatic vector unsigned short __ATTRS_o_ai\nvec_vmaxuh(vector unsigned short a, vector bool short b)\n{\n  return __builtin_altivec_vmaxuh(a, (vector unsigned short)b);\n}\n\n/* vec_vmaxsw */\n\nstatic vector int __ATTRS_o_ai\nvec_vmaxsw(vector int a, vector int b)\n{\n  return __builtin_altivec_vmaxsw(a, b);\n}\n\nstatic vector int __ATTRS_o_ai\nvec_vmaxsw(vector bool int a, vector int b)\n{\n  return __builtin_altivec_vmaxsw((vector int)a, b);\n}\n\nstatic vector int __ATTRS_o_ai\nvec_vmaxsw(vector int a, vector bool int b)\n{\n  return __builtin_altivec_vmaxsw(a, (vector int)b);\n}\n\n/* vec_vmaxuw */\n\nstatic vector unsigned int __ATTRS_o_ai\nvec_vmaxuw(vector unsigned int a, vector unsigned int b)\n{\n  return __builtin_altivec_vmaxuw(a, b);\n}\n\nstatic vector unsigned int __ATTRS_o_ai\nvec_vmaxuw(vector bool int a, vector unsigned int b)\n{\n  return __builtin_altivec_vmaxuw((vector unsigned int)a, b);\n}\n\nstatic vector unsigned int __ATTRS_o_ai\nvec_vmaxuw(vector unsigned int a, vector bool int b)\n{\n  return __builtin_altivec_vmaxuw(a, (vector unsigned int)b);\n}\n\n/* vec_vmaxfp */\n\nstatic vector float __attribute__((__always_inline__))\nvec_vmaxfp(vector float a, vector float b)\n{\n  return __builtin_altivec_vmaxfp(a, b);\n}\n\n/* vec_mergeh */\n\nstatic vector signed char __ATTRS_o_ai\nvec_mergeh(vector signed char a, vector signed char b)\n{\n  return vec_perm(a, b, (vector unsigned char)\n    (0x00, 0x10, 0x01, 0x11, 0x02, 0x12, 0x03, 0x13, \n     0x04, 0x14, 0x05, 0x15, 0x06, 0x16, 0x07, 0x17));\n}\n\nstatic vector unsigned char __ATTRS_o_ai\nvec_mergeh(vector unsigned char a, vector unsigned char b)\n{\n  return vec_perm(a, b, (vector unsigned char)\n    (0x00, 0x10, 0x01, 0x11, 0x02, 0x12, 0x03, 0x13, \n     0x04, 0x14, 0x05, 0x15, 0x06, 0x16, 0x07, 0x17));\n}\n\nstatic vector bool char __ATTRS_o_ai\nvec_mergeh(vector bool char a, vector bool char b)\n{\n  return vec_perm(a, b, (vector unsigned char)\n    (0x00, 0x10, 0x01, 0x11, 0x02, 0x12, 0x03, 0x13, \n     0x04, 0x14, 0x05, 0x15, 0x06, 0x16, 0x07, 0x17));\n}\n\nstatic vector short __ATTRS_o_ai\nvec_mergeh(vector short a, vector short b)\n{\n  return vec_perm(a, b, (vector unsigned char)\n    (0x00, 0x01, 0x10, 0x11, 0x02, 0x03, 0x12, 0x13,\n     0x04, 0x05, 0x14, 0x15, 0x06, 0x07, 0x16, 0x17));\n}\n\nstatic vector unsigned short __ATTRS_o_ai\nvec_mergeh(vector unsigned short a, vector unsigned short b)\n{\n  return vec_perm(a, b, (vector unsigned char)\n    (0x00, 0x01, 0x10, 0x11, 0x02, 0x03, 0x12, 0x13,\n     0x04, 0x05, 0x14, 0x15, 0x06, 0x07, 0x16, 0x17));\n}\n\nstatic vector bool short __ATTRS_o_ai\nvec_mergeh(vector bool short a, vector bool short b)\n{\n  return vec_perm(a, b, (vector unsigned char)\n    (0x00, 0x01, 0x10, 0x11, 0x02, 0x03, 0x12, 0x13,\n     0x04, 0x05, 0x14, 0x15, 0x06, 0x07, 0x16, 0x17));\n}\n\nstatic vector pixel __ATTRS_o_ai\nvec_mergeh(vector pixel a, vector pixel b)\n{\n  return vec_perm(a, b, (vector unsigned char)\n    (0x00, 0x01, 0x10, 0x11, 0x02, 0x03, 0x12, 0x13,\n     0x04, 0x05, 0x14, 0x15, 0x06, 0x07, 0x16, 0x17));\n}\n\nstatic vector int __ATTRS_o_ai\nvec_mergeh(vector int a, vector int b)\n{\n  return vec_perm(a, b, (vector unsigned char)\n    (0x00, 0x01, 0x02, 0x03, 0x10, 0x11, 0x12, 0x13,\n     0x04, 0x05, 0x06, 0x07, 0x14, 0x15, 0x16, 0x17));\n}\n\nstatic vector unsigned int __ATTRS_o_ai\nvec_mergeh(vector unsigned int a, vector unsigned int b)\n{\n  return vec_perm(a, b, (vector unsigned char)\n    (0x00, 0x01, 0x02, 0x03, 0x10, 0x11, 0x12, 0x13,\n     0x04, 0x05, 0x06, 0x07, 0x14, 0x15, 0x16, 0x17));\n}\n\nstatic vector bool int __ATTRS_o_ai\nvec_mergeh(vector bool int a, vector bool int b)\n{\n  return vec_perm(a, b, (vector unsigned char)\n    (0x00, 0x01, 0x02, 0x03, 0x10, 0x11, 0x12, 0x13,\n     0x04, 0x05, 0x06, 0x07, 0x14, 0x15, 0x16, 0x17));\n}\n\nstatic vector float __ATTRS_o_ai\nvec_mergeh(vector float a, vector float b)\n{\n  return vec_perm(a, b, (vector unsigned char)\n    (0x00, 0x01, 0x02, 0x03, 0x10, 0x11, 0x12, 0x13,\n     0x04, 0x05, 0x06, 0x07, 0x14, 0x15, 0x16, 0x17));\n}\n\n/* vec_vmrghb */\n\n#define __builtin_altivec_vmrghb vec_vmrghb\n\nstatic vector signed char __ATTRS_o_ai\nvec_vmrghb(vector signed char a, vector signed char b)\n{\n  return vec_perm(a, b, (vector unsigned char)\n    (0x00, 0x10, 0x01, 0x11, 0x02, 0x12, 0x03, 0x13, \n     0x04, 0x14, 0x05, 0x15, 0x06, 0x16, 0x07, 0x17));\n}\n\nstatic vector unsigned char __ATTRS_o_ai\nvec_vmrghb(vector unsigned char a, vector unsigned char b)\n{\n  return vec_perm(a, b, (vector unsigned char)\n    (0x00, 0x10, 0x01, 0x11, 0x02, 0x12, 0x03, 0x13, \n     0x04, 0x14, 0x05, 0x15, 0x06, 0x16, 0x07, 0x17));\n}\n\nstatic vector bool char __ATTRS_o_ai\nvec_vmrghb(vector bool char a, vector bool char b)\n{\n  return vec_perm(a, b, (vector unsigned char)\n    (0x00, 0x10, 0x01, 0x11, 0x02, 0x12, 0x03, 0x13, \n     0x04, 0x14, 0x05, 0x15, 0x06, 0x16, 0x07, 0x17));\n}\n\n/* vec_vmrghh */\n\n#define __builtin_altivec_vmrghh vec_vmrghh\n\nstatic vector short __ATTRS_o_ai\nvec_vmrghh(vector short a, vector short b)\n{\n  return vec_perm(a, b, (vector unsigned char)\n    (0x00, 0x01, 0x10, 0x11, 0x02, 0x03, 0x12, 0x13,\n     0x04, 0x05, 0x14, 0x15, 0x06, 0x07, 0x16, 0x17));\n}\n\nstatic vector unsigned short __ATTRS_o_ai\nvec_vmrghh(vector unsigned short a, vector unsigned short b)\n{\n  return vec_perm(a, b, (vector unsigned char)\n    (0x00, 0x01, 0x10, 0x11, 0x02, 0x03, 0x12, 0x13,\n     0x04, 0x05, 0x14, 0x15, 0x06, 0x07, 0x16, 0x17));\n}\n\nstatic vector bool short __ATTRS_o_ai\nvec_vmrghh(vector bool short a, vector bool short b)\n{\n  return vec_perm(a, b, (vector unsigned char)\n    (0x00, 0x01, 0x10, 0x11, 0x02, 0x03, 0x12, 0x13,\n     0x04, 0x05, 0x14, 0x15, 0x06, 0x07, 0x16, 0x17));\n}\n\nstatic vector pixel __ATTRS_o_ai\nvec_vmrghh(vector pixel a, vector pixel b)\n{\n  return vec_perm(a, b, (vector unsigned char)\n    (0x00, 0x01, 0x10, 0x11, 0x02, 0x03, 0x12, 0x13,\n     0x04, 0x05, 0x14, 0x15, 0x06, 0x07, 0x16, 0x17));\n}\n\n/* vec_vmrghw */\n\n#define __builtin_altivec_vmrghw vec_vmrghw\n\nstatic vector int __ATTRS_o_ai\nvec_vmrghw(vector int a, vector int b)\n{\n  return vec_perm(a, b, (vector unsigned char)\n    (0x00, 0x01, 0x02, 0x03, 0x10, 0x11, 0x12, 0x13,\n     0x04, 0x05, 0x06, 0x07, 0x14, 0x15, 0x16, 0x17));\n}\n\nstatic vector unsigned int __ATTRS_o_ai\nvec_vmrghw(vector unsigned int a, vector unsigned int b)\n{\n  return vec_perm(a, b, (vector unsigned char)\n    (0x00, 0x01, 0x02, 0x03, 0x10, 0x11, 0x12, 0x13,\n     0x04, 0x05, 0x06, 0x07, 0x14, 0x15, 0x16, 0x17));\n}\n\nstatic vector bool int __ATTRS_o_ai\nvec_vmrghw(vector bool int a, vector bool int b)\n{\n  return vec_perm(a, b, (vector unsigned char)\n    (0x00, 0x01, 0x02, 0x03, 0x10, 0x11, 0x12, 0x13,\n     0x04, 0x05, 0x06, 0x07, 0x14, 0x15, 0x16, 0x17));\n}\n\nstatic vector float __ATTRS_o_ai\nvec_vmrghw(vector float a, vector float b)\n{\n  return vec_perm(a, b, (vector unsigned char)\n    (0x00, 0x01, 0x02, 0x03, 0x10, 0x11, 0x12, 0x13,\n     0x04, 0x05, 0x06, 0x07, 0x14, 0x15, 0x16, 0x17));\n}\n\n/* vec_mergel */\n\nstatic vector signed char __ATTRS_o_ai\nvec_mergel(vector signed char a, vector signed char b)\n{\n  return vec_perm(a, b, (vector unsigned char)\n    (0x08, 0x18, 0x09, 0x19, 0x0A, 0x1A, 0x0B, 0x1B, \n     0x0C, 0x1C, 0x0D, 0x1D, 0x0E, 0x1E, 0x0F, 0x1F));\n}\n\nstatic vector unsigned char __ATTRS_o_ai\nvec_mergel(vector unsigned char a, vector unsigned char b)\n{\n  return vec_perm(a, b, (vector unsigned char)\n    (0x08, 0x18, 0x09, 0x19, 0x0A, 0x1A, 0x0B, 0x1B, \n     0x0C, 0x1C, 0x0D, 0x1D, 0x0E, 0x1E, 0x0F, 0x1F));\n}\n\nstatic vector bool char __ATTRS_o_ai\nvec_mergel(vector bool char a, vector bool char b)\n{\n  return vec_perm(a, b, (vector unsigned char)\n    (0x08, 0x18, 0x09, 0x19, 0x0A, 0x1A, 0x0B, 0x1B, \n     0x0C, 0x1C, 0x0D, 0x1D, 0x0E, 0x1E, 0x0F, 0x1F));\n}\n\nstatic vector short __ATTRS_o_ai\nvec_mergel(vector short a, vector short b)\n{\n  return vec_perm(a, b, (vector unsigned char)\n    (0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B, 0x1A, 0x1B,\n     0x0C, 0x0D, 0x1C, 0x1D, 0x0E, 0x0F, 0x1E, 0x1F));\n}\n\nstatic vector unsigned short __ATTRS_o_ai\nvec_mergel(vector unsigned short a, vector unsigned short b)\n{\n  return vec_perm(a, b, (vector unsigned char)\n    (0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B, 0x1A, 0x1B,\n     0x0C, 0x0D, 0x1C, 0x1D, 0x0E, 0x0F, 0x1E, 0x1F));\n}\n\nstatic vector bool short __ATTRS_o_ai\nvec_mergel(vector bool short a, vector bool short b)\n{\n  return vec_perm(a, b, (vector unsigned char)\n    (0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B, 0x1A, 0x1B,\n     0x0C, 0x0D, 0x1C, 0x1D, 0x0E, 0x0F, 0x1E, 0x1F));\n}\n\nstatic vector pixel __ATTRS_o_ai\nvec_mergel(vector pixel a, vector pixel b)\n{\n  return vec_perm(a, b, (vector unsigned char)\n    (0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B, 0x1A, 0x1B,\n     0x0C, 0x0D, 0x1C, 0x1D, 0x0E, 0x0F, 0x1E, 0x1F));\n}\n\nstatic vector int __ATTRS_o_ai\nvec_mergel(vector int a, vector int b)\n{\n  return vec_perm(a, b, (vector unsigned char)\n    (0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19, 0x1A, 0x1B,\n     0x0C, 0x0D, 0x0E, 0x0F, 0x1C, 0x1D, 0x1E, 0x1F));\n}\n\nstatic vector unsigned int __ATTRS_o_ai\nvec_mergel(vector unsigned int a, vector unsigned int b)\n{\n  return vec_perm(a, b, (vector unsigned char)\n    (0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19, 0x1A, 0x1B,\n     0x0C, 0x0D, 0x0E, 0x0F, 0x1C, 0x1D, 0x1E, 0x1F));\n}\n\nstatic vector bool int __ATTRS_o_ai\nvec_mergel(vector bool int a, vector bool int b)\n{\n  return vec_perm(a, b, (vector unsigned char)\n    (0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19, 0x1A, 0x1B,\n     0x0C, 0x0D, 0x0E, 0x0F, 0x1C, 0x1D, 0x1E, 0x1F));\n}\n\nstatic vector float __ATTRS_o_ai\nvec_mergel(vector float a, vector float b)\n{\n  return vec_perm(a, b, (vector unsigned char)\n    (0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19, 0x1A, 0x1B,\n     0x0C, 0x0D, 0x0E, 0x0F, 0x1C, 0x1D, 0x1E, 0x1F));\n}\n\n/* vec_vmrglb */\n\n#define __builtin_altivec_vmrglb vec_vmrglb\n\nstatic vector signed char __ATTRS_o_ai\nvec_vmrglb(vector signed char a, vector signed char b)\n{\n  return vec_perm(a, b, (vector unsigned char)\n    (0x08, 0x18, 0x09, 0x19, 0x0A, 0x1A, 0x0B, 0x1B, \n     0x0C, 0x1C, 0x0D, 0x1D, 0x0E, 0x1E, 0x0F, 0x1F));\n}\n\nstatic vector unsigned char __ATTRS_o_ai\nvec_vmrglb(vector unsigned char a, vector unsigned char b)\n{\n  return vec_perm(a, b, (vector unsigned char)\n    (0x08, 0x18, 0x09, 0x19, 0x0A, 0x1A, 0x0B, 0x1B, \n     0x0C, 0x1C, 0x0D, 0x1D, 0x0E, 0x1E, 0x0F, 0x1F));\n}\n\nstatic vector bool char __ATTRS_o_ai\nvec_vmrglb(vector bool char a, vector bool char b)\n{\n  return vec_perm(a, b, (vector unsigned char)\n    (0x08, 0x18, 0x09, 0x19, 0x0A, 0x1A, 0x0B, 0x1B, \n     0x0C, 0x1C, 0x0D, 0x1D, 0x0E, 0x1E, 0x0F, 0x1F));\n}\n\n/* vec_vmrglh */\n\n#define __builtin_altivec_vmrglh vec_vmrglh\n\nstatic vector short __ATTRS_o_ai\nvec_vmrglh(vector short a, vector short b)\n{\n  return vec_perm(a, b, (vector unsigned char)\n    (0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B, 0x1A, 0x1B,\n     0x0C, 0x0D, 0x1C, 0x1D, 0x0E, 0x0F, 0x1E, 0x1F));\n}\n\nstatic vector unsigned short __ATTRS_o_ai\nvec_vmrglh(vector unsigned short a, vector unsigned short b)\n{\n  return vec_perm(a, b, (vector unsigned char)\n    (0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B, 0x1A, 0x1B,\n     0x0C, 0x0D, 0x1C, 0x1D, 0x0E, 0x0F, 0x1E, 0x1F));\n}\n\nstatic vector bool short __ATTRS_o_ai\nvec_vmrglh(vector bool short a, vector bool short b)\n{\n  return vec_perm(a, b, (vector unsigned char)\n    (0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B, 0x1A, 0x1B,\n     0x0C, 0x0D, 0x1C, 0x1D, 0x0E, 0x0F, 0x1E, 0x1F));\n}\n\nstatic vector pixel __ATTRS_o_ai\nvec_vmrglh(vector pixel a, vector pixel b)\n{\n  return vec_perm(a, b, (vector unsigned char)\n    (0x08, 0x09, 0x18, 0x19, 0x0A, 0x0B, 0x1A, 0x1B,\n     0x0C, 0x0D, 0x1C, 0x1D, 0x0E, 0x0F, 0x1E, 0x1F));\n}\n\n/* vec_vmrglw */\n\n#define __builtin_altivec_vmrglw vec_vmrglw\n\nstatic vector int __ATTRS_o_ai\nvec_vmrglw(vector int a, vector int b)\n{\n  return vec_perm(a, b, (vector unsigned char)\n    (0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19, 0x1A, 0x1B,\n     0x0C, 0x0D, 0x0E, 0x0F, 0x1C, 0x1D, 0x1E, 0x1F));\n}\n\nstatic vector unsigned int __ATTRS_o_ai\nvec_vmrglw(vector unsigned int a, vector unsigned int b)\n{\n  return vec_perm(a, b, (vector unsigned char)\n    (0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19, 0x1A, 0x1B,\n     0x0C, 0x0D, 0x0E, 0x0F, 0x1C, 0x1D, 0x1E, 0x1F));\n}\n\nstatic vector bool int __ATTRS_o_ai\nvec_vmrglw(vector bool int a, vector bool int b)\n{\n  return vec_perm(a, b, (vector unsigned char)\n    (0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19, 0x1A, 0x1B,\n     0x0C, 0x0D, 0x0E, 0x0F, 0x1C, 0x1D, 0x1E, 0x1F));\n}\n\nstatic vector float __ATTRS_o_ai\nvec_vmrglw(vector float a, vector float b)\n{\n  return vec_perm(a, b, (vector unsigned char)\n    (0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19, 0x1A, 0x1B,\n     0x0C, 0x0D, 0x0E, 0x0F, 0x1C, 0x1D, 0x1E, 0x1F));\n}\n\n/* vec_mfvscr */\n\nstatic vector unsigned short __attribute__((__always_inline__))\nvec_mfvscr(void)\n{\n  return __builtin_altivec_mfvscr();\n}\n\n/* vec_min */\n\nstatic vector signed char __ATTRS_o_ai\nvec_min(vector signed char a, vector signed char b)\n{\n  return __builtin_altivec_vminsb(a, b);\n}\n\nstatic vector signed char __ATTRS_o_ai\nvec_min(vector bool char a, vector signed char b)\n{\n  return __builtin_altivec_vminsb((vector signed char)a, b);\n}\n\nstatic vector signed char __ATTRS_o_ai\nvec_min(vector signed char a, vector bool char b)\n{\n  return __builtin_altivec_vminsb(a, (vector signed char)b);\n}\n\nstatic vector unsigned char __ATTRS_o_ai\nvec_min(vector unsigned char a, vector unsigned char b)\n{\n  return __builtin_altivec_vminub(a, b);\n}\n\nstatic vector unsigned char __ATTRS_o_ai\nvec_min(vector bool char a, vector unsigned char b)\n{\n  return __builtin_altivec_vminub((vector unsigned char)a, b);\n}\n\nstatic vector unsigned char __ATTRS_o_ai\nvec_min(vector unsigned char a, vector bool char b)\n{\n  return __builtin_altivec_vminub(a, (vector unsigned char)b);\n}\n\nstatic vector short __ATTRS_o_ai\nvec_min(vector short a, vector short b)\n{\n  return __builtin_altivec_vminsh(a, b);\n}\n\nstatic vector short __ATTRS_o_ai\nvec_min(vector bool short a, vector short b)\n{\n  return __builtin_altivec_vminsh((vector short)a, b);\n}\n\nstatic vector short __ATTRS_o_ai\nvec_min(vector short a, vector bool short b)\n{\n  return __builtin_altivec_vminsh(a, (vector short)b);\n}\n\nstatic vector unsigned short __ATTRS_o_ai\nvec_min(vector unsigned short a, vector unsigned short b)\n{\n  return __builtin_altivec_vminuh(a, b);\n}\n\nstatic vector unsigned short __ATTRS_o_ai\nvec_min(vector bool short a, vector unsigned short b)\n{\n  return __builtin_altivec_vminuh((vector unsigned short)a, b);\n}\n\nstatic vector unsigned short __ATTRS_o_ai\nvec_min(vector unsigned short a, vector bool short b)\n{\n  return __builtin_altivec_vminuh(a, (vector unsigned short)b);\n}\n\nstatic vector int __ATTRS_o_ai\nvec_min(vector int a, vector int b)\n{\n  return __builtin_altivec_vminsw(a, b);\n}\n\nstatic vector int __ATTRS_o_ai\nvec_min(vector bool int a, vector int b)\n{\n  return __builtin_altivec_vminsw((vector int)a, b);\n}\n\nstatic vector int __ATTRS_o_ai\nvec_min(vector int a, vector bool int b)\n{\n  return __builtin_altivec_vminsw(a, (vector int)b);\n}\n\nstatic vector unsigned int __ATTRS_o_ai\nvec_min(vector unsigned int a, vector unsigned int b)\n{\n  return __builtin_altivec_vminuw(a, b);\n}\n\nstatic vector unsigned int __ATTRS_o_ai\nvec_min(vector bool int a, vector unsigned int b)\n{\n  return __builtin_altivec_vminuw((vector unsigned int)a, b);\n}\n\nstatic vector unsigned int __ATTRS_o_ai\nvec_min(vector unsigned int a, vector bool int b)\n{\n  return __builtin_altivec_vminuw(a, (vector unsigned int)b);\n}\n\nstatic vector float __ATTRS_o_ai\nvec_min(vector float a, vector float b)\n{\n  return __builtin_altivec_vminfp(a, b);\n}\n\n/* vec_vminsb */\n\nstatic vector signed char __ATTRS_o_ai\nvec_vminsb(vector signed char a, vector signed char b)\n{\n  return __builtin_altivec_vminsb(a, b);\n}\n\nstatic vector signed char __ATTRS_o_ai\nvec_vminsb(vector bool char a, vector signed char b)\n{\n  return __builtin_altivec_vminsb((vector signed char)a, b);\n}\n\nstatic vector signed char __ATTRS_o_ai\nvec_vminsb(vector signed char a, vector bool char b)\n{\n  return __builtin_altivec_vminsb(a, (vector signed char)b);\n}\n\n/* vec_vminub */\n\nstatic vector unsigned char __ATTRS_o_ai\nvec_vminub(vector unsigned char a, vector unsigned char b)\n{\n  return __builtin_altivec_vminub(a, b);\n}\n\nstatic vector unsigned char __ATTRS_o_ai\nvec_vminub(vector bool char a, vector unsigned char b)\n{\n  return __builtin_altivec_vminub((vector unsigned char)a, b);\n}\n\nstatic vector unsigned char __ATTRS_o_ai\nvec_vminub(vector unsigned char a, vector bool char b)\n{\n  return __builtin_altivec_vminub(a, (vector unsigned char)b);\n}\n\n/* vec_vminsh */\n\nstatic vector short __ATTRS_o_ai\nvec_vminsh(vector short a, vector short b)\n{\n  return __builtin_altivec_vminsh(a, b);\n}\n\nstatic vector short __ATTRS_o_ai\nvec_vminsh(vector bool short a, vector short b)\n{\n  return __builtin_altivec_vminsh((vector short)a, b);\n}\n\nstatic vector short __ATTRS_o_ai\nvec_vminsh(vector short a, vector bool short b)\n{\n  return __builtin_altivec_vminsh(a, (vector short)b);\n}\n\n/* vec_vminuh */\n\nstatic vector unsigned short __ATTRS_o_ai\nvec_vminuh(vector unsigned short a, vector unsigned short b)\n{\n  return __builtin_altivec_vminuh(a, b);\n}\n\nstatic vector unsigned short __ATTRS_o_ai\nvec_vminuh(vector bool short a, vector unsigned short b)\n{\n  return __builtin_altivec_vminuh((vector unsigned short)a, b);\n}\n\nstatic vector unsigned short __ATTRS_o_ai\nvec_vminuh(vector unsigned short a, vector bool short b)\n{\n  return __builtin_altivec_vminuh(a, (vector unsigned short)b);\n}\n\n/* vec_vminsw */\n\nstatic vector int __ATTRS_o_ai\nvec_vminsw(vector int a, vector int b)\n{\n  return __builtin_altivec_vminsw(a, b);\n}\n\nstatic vector int __ATTRS_o_ai\nvec_vminsw(vector bool int a, vector int b)\n{\n  return __builtin_altivec_vminsw((vector int)a, b);\n}\n\nstatic vector int __ATTRS_o_ai\nvec_vminsw(vector int a, vector bool int b)\n{\n  return __builtin_altivec_vminsw(a, (vector int)b);\n}\n\n/* vec_vminuw */\n\nstatic vector unsigned int __ATTRS_o_ai\nvec_vminuw(vector unsigned int a, vector unsigned int b)\n{\n  return __builtin_altivec_vminuw(a, b);\n}\n\nstatic vector unsigned int __ATTRS_o_ai\nvec_vminuw(vector bool int a, vector unsigned int b)\n{\n  return __builtin_altivec_vminuw((vector unsigned int)a, b);\n}\n\nstatic vector unsigned int __ATTRS_o_ai\nvec_vminuw(vector unsigned int a, vector bool int b)\n{\n  return __builtin_altivec_vminuw(a, (vector unsigned int)b);\n}\n\n/* vec_vminfp */\n\nstatic vector float __attribute__((__always_inline__))\nvec_vminfp(vector float a, vector float b)\n{\n  return __builtin_altivec_vminfp(a, b);\n}\n\n/* vec_mladd */\n\n#define __builtin_altivec_vmladduhm vec_mladd\n\nstatic vector short __ATTRS_o_ai\nvec_mladd(vector short a, vector short b, vector short c)\n{\n  return a * b + c;\n}\n\nstatic vector short __ATTRS_o_ai\nvec_mladd(vector short a, vector unsigned short b, vector unsigned short c)\n{\n  return a * (vector short)b + (vector short)c;\n}\n\nstatic vector short __ATTRS_o_ai\nvec_mladd(vector unsigned short a, vector short b, vector short c)\n{\n  return (vector short)a * b + c;\n}\n\nstatic vector unsigned short __ATTRS_o_ai\nvec_mladd(vector unsigned short a,\n          vector unsigned short b, \n          vector unsigned short c)\n{\n  return a * b + c;\n}\n\n/* vec_vmladduhm */\n\nstatic vector short __ATTRS_o_ai\nvec_vmladduhm(vector short a, vector short b, vector short c)\n{\n  return a * b + c;\n}\n\nstatic vector short __ATTRS_o_ai\nvec_vmladduhm(vector short a, vector unsigned short b, vector unsigned short c)\n{\n  return a * (vector short)b + (vector short)c;\n}\n\nstatic vector short __ATTRS_o_ai\nvec_vmladduhm(vector unsigned short a, vector short b, vector short c)\n{\n  return (vector short)a * b + c;\n}\n\nstatic vector unsigned short __ATTRS_o_ai\nvec_vmladduhm(vector unsigned short a,\n              vector unsigned short b,\n              vector unsigned short c)\n{\n  return a * b + c;\n}\n\n/* vec_mradds */\n\nstatic vector short __attribute__((__always_inline__))\nvec_mradds(vector short a, vector short b, vector short c)\n{\n  return __builtin_altivec_vmhraddshs(a, b, c);\n}\n\n/* vec_vmhraddshs */\n\nstatic vector short __attribute__((__always_inline__))\nvec_vmhraddshs(vector short a, vector short b, vector short c)\n{\n  return __builtin_altivec_vmhraddshs(a, b, c);\n}\n\n/* vec_msum */\n\nstatic vector int __ATTRS_o_ai\nvec_msum(vector signed char a, vector unsigned char b, vector int c)\n{\n  return __builtin_altivec_vmsummbm(a, b, c);\n}\n\nstatic vector unsigned int __ATTRS_o_ai\nvec_msum(vector unsigned char a, vector unsigned char b, vector unsigned int c)\n{\n  return __builtin_altivec_vmsumubm(a, b, c);\n}\n\nstatic vector int __ATTRS_o_ai\nvec_msum(vector short a, vector short b, vector int c)\n{\n  return __builtin_altivec_vmsumshm(a, b, c);\n}\n\nstatic vector unsigned int __ATTRS_o_ai\nvec_msum(vector unsigned short a,\n         vector unsigned short b,\n         vector unsigned int c)\n{\n  return __builtin_altivec_vmsumuhm(a, b, c);\n}\n\n/* vec_vmsummbm */\n\nstatic vector int __attribute__((__always_inline__))\nvec_vmsummbm(vector signed char a, vector unsigned char b, vector int c)\n{\n  return __builtin_altivec_vmsummbm(a, b, c);\n}\n\n/* vec_vmsumubm */\n\nstatic vector unsigned int __attribute__((__always_inline__))\nvec_vmsumubm(vector unsigned char a,\n             vector unsigned char b,\n             vector unsigned int c)\n{\n  return __builtin_altivec_vmsumubm(a, b, c);\n}\n\n/* vec_vmsumshm */\n\nstatic vector int __attribute__((__always_inline__))\nvec_vmsumshm(vector short a, vector short b, vector int c)\n{\n  return __builtin_altivec_vmsumshm(a, b, c);\n}\n\n/* vec_vmsumuhm */\n\nstatic vector unsigned int __attribute__((__always_inline__))\nvec_vmsumuhm(vector unsigned short a,\n             vector unsigned short b,\n             vector unsigned int c)\n{\n  return __builtin_altivec_vmsumuhm(a, b, c);\n}\n\n/* vec_msums */\n\nstatic vector int __ATTRS_o_ai\nvec_msums(vector short a, vector short b, vector int c)\n{\n  return __builtin_altivec_vmsumshs(a, b, c);\n}\n\nstatic vector unsigned int __ATTRS_o_ai\nvec_msums(vector unsigned short a,\n          vector unsigned short b,\n          vector unsigned int c)\n{\n  return __builtin_altivec_vmsumuhs(a, b, c);\n}\n\n/* vec_vmsumshs */\n\nstatic vector int __attribute__((__always_inline__))\nvec_vmsumshs(vector short a, vector short b, vector int c)\n{\n  return __builtin_altivec_vmsumshs(a, b, c);\n}\n\n/* vec_vmsumuhs */\n\nstatic vector unsigned int __attribute__((__always_inline__))\nvec_vmsumuhs(vector unsigned short a,\n             vector unsigned short b,\n             vector unsigned int c)\n{\n  return __builtin_altivec_vmsumuhs(a, b, c);\n}\n\n/* vec_mtvscr */\n\nstatic void __ATTRS_o_ai\nvec_mtvscr(vector signed char a)\n{\n  __builtin_altivec_mtvscr((vector int)a);\n}\n\nstatic void __ATTRS_o_ai\nvec_mtvscr(vector unsigned char a)\n{\n  __builtin_altivec_mtvscr((vector int)a);\n}\n\nstatic void __ATTRS_o_ai\nvec_mtvscr(vector bool char a)\n{\n  __builtin_altivec_mtvscr((vector int)a);\n}\n\nstatic void __ATTRS_o_ai\nvec_mtvscr(vector short a)\n{\n  __builtin_altivec_mtvscr((vector int)a);\n}\n\nstatic void __ATTRS_o_ai\nvec_mtvscr(vector unsigned short a)\n{\n  __builtin_altivec_mtvscr((vector int)a);\n}\n\nstatic void __ATTRS_o_ai\nvec_mtvscr(vector bool short a)\n{\n  __builtin_altivec_mtvscr((vector int)a);\n}\n\nstatic void __ATTRS_o_ai\nvec_mtvscr(vector pixel a)\n{\n  __builtin_altivec_mtvscr((vector int)a);\n}\n\nstatic void __ATTRS_o_ai\nvec_mtvscr(vector int a)\n{\n  __builtin_altivec_mtvscr((vector int)a);\n}\n\nstatic void __ATTRS_o_ai\nvec_mtvscr(vector unsigned int a)\n{\n  __builtin_altivec_mtvscr((vector int)a);\n}\n\nstatic void __ATTRS_o_ai\nvec_mtvscr(vector bool int a)\n{\n  __builtin_altivec_mtvscr((vector int)a);\n}\n\nstatic void __ATTRS_o_ai\nvec_mtvscr(vector float a)\n{\n  __builtin_altivec_mtvscr((vector int)a);\n}\n\n/* vec_mule */\n\nstatic vector short __ATTRS_o_ai\nvec_mule(vector signed char a, vector signed char b)\n{\n  return __builtin_altivec_vmulesb(a, b);\n}\n\nstatic vector unsigned short __ATTRS_o_ai\nvec_mule(vector unsigned char a, vector unsigned char b)\n{\n  return __builtin_altivec_vmuleub(a, b);\n}\n\nstatic vector int __ATTRS_o_ai\nvec_mule(vector short a, vector short b)\n{\n  return __builtin_altivec_vmulesh(a, b);\n}\n\nstatic vector unsigned int __ATTRS_o_ai\nvec_mule(vector unsigned short a, vector unsigned short b)\n{\n  return __builtin_altivec_vmuleuh(a, b);\n}\n\n/* vec_vmulesb */\n\nstatic vector short __attribute__((__always_inline__))\nvec_vmulesb(vector signed char a, vector signed char b)\n{\n  return __builtin_altivec_vmulesb(a, b);\n}\n\n/* vec_vmuleub */\n\nstatic vector unsigned short __attribute__((__always_inline__))\nvec_vmuleub(vector unsigned char a, vector unsigned char b)\n{\n  return __builtin_altivec_vmuleub(a, b);\n}\n\n/* vec_vmulesh */\n\nstatic vector int __attribute__((__always_inline__))\nvec_vmulesh(vector short a, vector short b)\n{\n  return __builtin_altivec_vmulesh(a, b);\n}\n\n/* vec_vmuleuh */\n\nstatic vector unsigned int __attribute__((__always_inline__))\nvec_vmuleuh(vector unsigned short a, vector unsigned short b)\n{\n  return __builtin_altivec_vmuleuh(a, b);\n}\n\n/* vec_mulo */\n\nstatic vector short __ATTRS_o_ai\nvec_mulo(vector signed char a, vector signed char b)\n{\n  return __builtin_altivec_vmulosb(a, b);\n}\n\nstatic vector unsigned short __ATTRS_o_ai\nvec_mulo(vector unsigned char a, vector unsigned char b)\n{\n  return __builtin_altivec_vmuloub(a, b);\n}\n\nstatic vector int __ATTRS_o_ai\nvec_mulo(vector short a, vector short b)\n{\n  return __builtin_altivec_vmulosh(a, b);\n}\n\nstatic vector unsigned int __ATTRS_o_ai\nvec_mulo(vector unsigned short a, vector unsigned short b)\n{\n  return __builtin_altivec_vmulouh(a, b);\n}\n\n/* vec_vmulosb */\n\nstatic vector short __attribute__((__always_inline__))\nvec_vmulosb(vector signed char a, vector signed char b)\n{\n  return __builtin_altivec_vmulosb(a, b);\n}\n\n/* vec_vmuloub */\n\nstatic vector unsigned short __attribute__((__always_inline__))\nvec_vmuloub(vector unsigned char a, vector unsigned char b)\n{\n  return __builtin_altivec_vmuloub(a, b);\n}\n\n/* vec_vmulosh */\n\nstatic vector int __attribute__((__always_inline__))\nvec_vmulosh(vector short a, vector short b)\n{\n  return __builtin_altivec_vmulosh(a, b);\n}\n\n/* vec_vmulouh */\n\nstatic vector unsigned int __attribute__((__always_inline__))\nvec_vmulouh(vector unsigned short a, vector unsigned short b)\n{\n  return __builtin_altivec_vmulouh(a, b);\n}\n\n/* vec_nmsub */\n\nstatic vector float __attribute__((__always_inline__))\nvec_nmsub(vector float a, vector float b, vector float c)\n{\n  return __builtin_altivec_vnmsubfp(a, b, c);\n}\n\n/* vec_vnmsubfp */\n\nstatic vector float __attribute__((__always_inline__))\nvec_vnmsubfp(vector float a, vector float b, vector float c)\n{\n  return __builtin_altivec_vnmsubfp(a, b, c);\n}\n\n/* vec_nor */\n\n#define __builtin_altivec_vnor vec_nor\n\nstatic vector signed char __ATTRS_o_ai\nvec_nor(vector signed char a, vector signed char b)\n{\n  return ~(a | b);\n}\n\nstatic vector unsigned char __ATTRS_o_ai\nvec_nor(vector unsigned char a, vector unsigned char b)\n{\n  return ~(a | b);\n}\n\nstatic vector bool char __ATTRS_o_ai\nvec_nor(vector bool char a, vector bool char b)\n{\n  return ~(a | b);\n}\n\nstatic vector short __ATTRS_o_ai\nvec_nor(vector short a, vector short b)\n{\n  return ~(a | b);\n}\n\nstatic vector unsigned short __ATTRS_o_ai\nvec_nor(vector unsigned short a, vector unsigned short b)\n{\n  return ~(a | b);\n}\n\nstatic vector bool short __ATTRS_o_ai\nvec_nor(vector bool short a, vector bool short b)\n{\n  return ~(a | b);\n}\n\nstatic vector int __ATTRS_o_ai\nvec_nor(vector int a, vector int b)\n{\n  return ~(a | b);\n}\n\nstatic vector unsigned int __ATTRS_o_ai\nvec_nor(vector unsigned int a, vector unsigned int b)\n{\n  return ~(a | b);\n}\n\nstatic vector bool int __ATTRS_o_ai\nvec_nor(vector bool int a, vector bool int b)\n{\n  return ~(a | b);\n}\n\nstatic vector float __ATTRS_o_ai\nvec_nor(vector float a, vector float b)\n{\n  vector unsigned int res = ~((vector unsigned int)a | (vector unsigned int)b);\n  return (vector float)res;\n}\n\n/* vec_vnor */\n\nstatic vector signed char __ATTRS_o_ai\nvec_vnor(vector signed char a, vector signed char b)\n{\n  return ~(a | b);\n}\n\nstatic vector unsigned char __ATTRS_o_ai\nvec_vnor(vector unsigned char a, vector unsigned char b)\n{\n  return ~(a | b);\n}\n\nstatic vector bool char __ATTRS_o_ai\nvec_vnor(vector bool char a, vector bool char b)\n{\n  return ~(a | b);\n}\n\nstatic vector short __ATTRS_o_ai\nvec_vnor(vector short a, vector short b)\n{\n  return ~(a | b);\n}\n\nstatic vector unsigned short __ATTRS_o_ai\nvec_vnor(vector unsigned short a, vector unsigned short b)\n{\n  return ~(a | b);\n}\n\nstatic vector bool short __ATTRS_o_ai\nvec_vnor(vector bool short a, vector bool short b)\n{\n  return ~(a | b);\n}\n\nstatic vector int __ATTRS_o_ai\nvec_vnor(vector int a, vector int b)\n{\n  return ~(a | b);\n}\n\nstatic vector unsigned int __ATTRS_o_ai\nvec_vnor(vector unsigned int a, vector unsigned int b)\n{\n  return ~(a | b);\n}\n\nstatic vector bool int __ATTRS_o_ai\nvec_vnor(vector bool int a, vector bool int b)\n{\n  return ~(a | b);\n}\n\nstatic vector float __ATTRS_o_ai\nvec_vnor(vector float a, vector float b)\n{\n  vector unsigned int res = ~((vector unsigned int)a | (vector unsigned int)b);\n  return (vector float)res;\n}\n\n/* vec_or */\n\n#define __builtin_altivec_vor vec_or\n\nstatic vector signed char __ATTRS_o_ai\nvec_or(vector signed char a, vector signed char b)\n{\n  return a | b;\n}\n\nstatic vector signed char __ATTRS_o_ai\nvec_or(vector bool char a, vector signed char b)\n{\n  return (vector signed char)a | b;\n}\n\nstatic vector signed char __ATTRS_o_ai\nvec_or(vector signed char a, vector bool char b)\n{\n  return a | (vector signed char)b;\n}\n\nstatic vector unsigned char __ATTRS_o_ai\nvec_or(vector unsigned char a, vector unsigned char b)\n{\n  return a | b;\n}\n\nstatic vector unsigned char __ATTRS_o_ai\nvec_or(vector bool char a, vector unsigned char b)\n{\n  return (vector unsigned char)a | b;\n}\n\nstatic vector unsigned char __ATTRS_o_ai\nvec_or(vector unsigned char a, vector bool char b)\n{\n  return a | (vector unsigned char)b;\n}\n\nstatic vector bool char __ATTRS_o_ai\nvec_or(vector bool char a, vector bool char b)\n{\n  return a | b;\n}\n\nstatic vector short __ATTRS_o_ai\nvec_or(vector short a, vector short b)\n{\n  return a | b;\n}\n\nstatic vector short __ATTRS_o_ai\nvec_or(vector bool short a, vector short b)\n{\n  return (vector short)a | b;\n}\n\nstatic vector short __ATTRS_o_ai\nvec_or(vector short a, vector bool short b)\n{\n  return a | (vector short)b;\n}\n\nstatic vector unsigned short __ATTRS_o_ai\nvec_or(vector unsigned short a, vector unsigned short b)\n{\n  return a | b;\n}\n\nstatic vector unsigned short __ATTRS_o_ai\nvec_or(vector bool short a, vector unsigned short b)\n{\n  return (vector unsigned short)a | b;\n}\n\nstatic vector unsigned short __ATTRS_o_ai\nvec_or(vector unsigned short a, vector bool short b)\n{\n  return a | (vector unsigned short)b;\n}\n\nstatic vector bool short __ATTRS_o_ai\nvec_or(vector bool short a, vector bool short b)\n{\n  return a | b;\n}\n\nstatic vector int __ATTRS_o_ai\nvec_or(vector int a, vector int b)\n{\n  return a | b;\n}\n\nstatic vector int __ATTRS_o_ai\nvec_or(vector bool int a, vector int b)\n{\n  return (vector int)a | b;\n}\n\nstatic vector int __ATTRS_o_ai\nvec_or(vector int a, vector bool int b)\n{\n  return a | (vector int)b;\n}\n\nstatic vector unsigned int __ATTRS_o_ai\nvec_or(vector unsigned int a, vector unsigned int b)\n{\n  return a | b;\n}\n\nstatic vector unsigned int __ATTRS_o_ai\nvec_or(vector bool int a, vector unsigned int b)\n{\n  return (vector unsigned int)a | b;\n}\n\nstatic vector unsigned int __ATTRS_o_ai\nvec_or(vector unsigned int a, vector bool int b)\n{\n  return a | (vector unsigned int)b;\n}\n\nstatic vector bool int __ATTRS_o_ai\nvec_or(vector bool int a, vector bool int b)\n{\n  return a | b;\n}\n\nstatic vector float __ATTRS_o_ai\nvec_or(vector float a, vector float b)\n{\n  vector unsigned int res = (vector unsigned int)a | (vector unsigned int)b;\n  return (vector float)res;\n}\n\nstatic vector float __ATTRS_o_ai\nvec_or(vector bool int a, vector float b)\n{\n  vector unsigned int res = (vector unsigned int)a | (vector unsigned int)b;\n  return (vector float)res;\n}\n\nstatic vector float __ATTRS_o_ai\nvec_or(vector float a, vector bool int b)\n{\n  vector unsigned int res = (vector unsigned int)a | (vector unsigned int)b;\n  return (vector float)res;\n}\n\n/* vec_vor */\n\nstatic vector signed char __ATTRS_o_ai\nvec_vor(vector signed char a, vector signed char b)\n{\n  return a | b;\n}\n\nstatic vector signed char __ATTRS_o_ai\nvec_vor(vector bool char a, vector signed char b)\n{\n  return (vector signed char)a | b;\n}\n\nstatic vector signed char __ATTRS_o_ai\nvec_vor(vector signed char a, vector bool char b)\n{\n  return a | (vector signed char)b;\n}\n\nstatic vector unsigned char __ATTRS_o_ai\nvec_vor(vector unsigned char a, vector unsigned char b)\n{\n  return a | b;\n}\n\nstatic vector unsigned char __ATTRS_o_ai\nvec_vor(vector bool char a, vector unsigned char b)\n{\n  return (vector unsigned char)a | b;\n}\n\nstatic vector unsigned char __ATTRS_o_ai\nvec_vor(vector unsigned char a, vector bool char b)\n{\n  return a | (vector unsigned char)b;\n}\n\nstatic vector bool char __ATTRS_o_ai\nvec_vor(vector bool char a, vector bool char b)\n{\n  return a | b;\n}\n\nstatic vector short __ATTRS_o_ai\nvec_vor(vector short a, vector short b)\n{\n  return a | b;\n}\n\nstatic vector short __ATTRS_o_ai\nvec_vor(vector bool short a, vector short b)\n{\n  return (vector short)a | b;\n}\n\nstatic vector short __ATTRS_o_ai\nvec_vor(vector short a, vector bool short b)\n{\n  return a | (vector short)b;\n}\n\nstatic vector unsigned short __ATTRS_o_ai\nvec_vor(vector unsigned short a, vector unsigned short b)\n{\n  return a | b;\n}\n\nstatic vector unsigned short __ATTRS_o_ai\nvec_vor(vector bool short a, vector unsigned short b)\n{\n  return (vector unsigned short)a | b;\n}\n\nstatic vector unsigned short __ATTRS_o_ai\nvec_vor(vector unsigned short a, vector bool short b)\n{\n  return a | (vector unsigned short)b;\n}\n\nstatic vector bool short __ATTRS_o_ai\nvec_vor(vector bool short a, vector bool short b)\n{\n  return a | b;\n}\n\nstatic vector int __ATTRS_o_ai\nvec_vor(vector int a, vector int b)\n{\n  return a | b;\n}\n\nstatic vector int __ATTRS_o_ai\nvec_vor(vector bool int a, vector int b)\n{\n  return (vector int)a | b;\n}\n\nstatic vector int __ATTRS_o_ai\nvec_vor(vector int a, vector bool int b)\n{\n  return a | (vector int)b;\n}\n\nstatic vector unsigned int __ATTRS_o_ai\nvec_vor(vector unsigned int a, vector unsigned int b)\n{\n  return a | b;\n}\n\nstatic vector unsigned int __ATTRS_o_ai\nvec_vor(vector bool int a, vector unsigned int b)\n{\n  return (vector unsigned int)a | b;\n}\n\nstatic vector unsigned int __ATTRS_o_ai\nvec_vor(vector unsigned int a, vector bool int b)\n{\n  return a | (vector unsigned int)b;\n}\n\nstatic vector bool int __ATTRS_o_ai\nvec_vor(vector bool int a, vector bool int b)\n{\n  return a | b;\n}\n\nstatic vector float __ATTRS_o_ai\nvec_vor(vector float a, vector float b)\n{\n  vector unsigned int res = (vector unsigned int)a | (vector unsigned int)b;\n  return (vector float)res;\n}\n\nstatic vector float __ATTRS_o_ai\nvec_vor(vector bool int a, vector float b)\n{\n  vector unsigned int res = (vector unsigned int)a | (vector unsigned int)b;\n  return (vector float)res;\n}\n\nstatic vector float __ATTRS_o_ai\nvec_vor(vector float a, vector bool int b)\n{\n  vector unsigned int res = (vector unsigned int)a | (vector unsigned int)b;\n  return (vector float)res;\n}\n\n/* vec_pack */\n\nstatic vector signed char __ATTRS_o_ai\nvec_pack(vector signed short a, vector signed short b)\n{\n  return (vector signed char)vec_perm(a, b, (vector unsigned char)\n    (0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F,\n     0x11, 0x13, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F));\n}\n\nstatic vector unsigned char __ATTRS_o_ai\nvec_pack(vector unsigned short a, vector unsigned short b)\n{\n  return (vector unsigned char)vec_perm(a, b, (vector unsigned char)\n    (0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F,\n     0x11, 0x13, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F));\n}\n\nstatic vector bool char __ATTRS_o_ai\nvec_pack(vector bool short a, vector bool short b)\n{\n  return (vector bool char)vec_perm(a, b, (vector unsigned char)\n    (0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F,\n     0x11, 0x13, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F));\n}\n\nstatic vector short __ATTRS_o_ai\nvec_pack(vector int a, vector int b)\n{\n  return (vector short)vec_perm(a, b, (vector unsigned char)\n    (0x02, 0x03, 0x06, 0x07, 0x0A, 0x0B, 0x0E, 0x0F,\n     0x12, 0x13, 0x16, 0x17, 0x1A, 0x1B, 0x1E, 0x1F));\n}\n\nstatic vector unsigned short __ATTRS_o_ai\nvec_pack(vector unsigned int a, vector unsigned int b)\n{\n  return (vector unsigned short)vec_perm(a, b, (vector unsigned char)\n    (0x02, 0x03, 0x06, 0x07, 0x0A, 0x0B, 0x0E, 0x0F,\n     0x12, 0x13, 0x16, 0x17, 0x1A, 0x1B, 0x1E, 0x1F));\n}\n\nstatic vector bool short __ATTRS_o_ai\nvec_pack(vector bool int a, vector bool int b)\n{\n  return (vector bool short)vec_perm(a, b, (vector unsigned char)\n    (0x02, 0x03, 0x06, 0x07, 0x0A, 0x0B, 0x0E, 0x0F,\n     0x12, 0x13, 0x16, 0x17, 0x1A, 0x1B, 0x1E, 0x1F));\n}\n\n/* vec_vpkuhum */\n\n#define __builtin_altivec_vpkuhum vec_vpkuhum\n\nstatic vector signed char __ATTRS_o_ai\nvec_vpkuhum(vector signed short a, vector signed short b)\n{\n  return (vector signed char)vec_perm(a, b, (vector unsigned char)\n    (0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F,\n     0x11, 0x13, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F));\n}\n\nstatic vector unsigned char __ATTRS_o_ai\nvec_vpkuhum(vector unsigned short a, vector unsigned short b)\n{\n  return (vector unsigned char)vec_perm(a, b, (vector unsigned char)\n    (0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F,\n     0x11, 0x13, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F));\n}\n\nstatic vector bool char __ATTRS_o_ai\nvec_vpkuhum(vector bool short a, vector bool short b)\n{\n  return (vector bool char)vec_perm(a, b, (vector unsigned char)\n    (0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F,\n     0x11, 0x13, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F));\n}\n\n/* vec_vpkuwum */\n\n#define __builtin_altivec_vpkuwum vec_vpkuwum\n\nstatic vector short __ATTRS_o_ai\nvec_vpkuwum(vector int a, vector int b)\n{\n  return (vector short)vec_perm(a, b, (vector unsigned char)\n    (0x02, 0x03, 0x06, 0x07, 0x0A, 0x0B, 0x0E, 0x0F,\n     0x12, 0x13, 0x16, 0x17, 0x1A, 0x1B, 0x1E, 0x1F));\n}\n\nstatic vector unsigned short __ATTRS_o_ai\nvec_vpkuwum(vector unsigned int a, vector unsigned int b)\n{\n  return (vector unsigned short)vec_perm(a, b, (vector unsigned char)\n    (0x02, 0x03, 0x06, 0x07, 0x0A, 0x0B, 0x0E, 0x0F,\n     0x12, 0x13, 0x16, 0x17, 0x1A, 0x1B, 0x1E, 0x1F));\n}\n\nstatic vector bool short __ATTRS_o_ai\nvec_vpkuwum(vector bool int a, vector bool int b)\n{\n  return (vector bool short)vec_perm(a, b, (vector unsigned char)\n    (0x02, 0x03, 0x06, 0x07, 0x0A, 0x0B, 0x0E, 0x0F,\n     0x12, 0x13, 0x16, 0x17, 0x1A, 0x1B, 0x1E, 0x1F));\n}\n\n/* vec_packpx */\n\nstatic vector pixel __attribute__((__always_inline__))\nvec_packpx(vector unsigned int a, vector unsigned int b)\n{\n  return (vector pixel)__builtin_altivec_vpkpx(a, b);\n}\n\n/* vec_vpkpx */\n\nstatic vector pixel __attribute__((__always_inline__))\nvec_vpkpx(vector unsigned int a, vector unsigned int b)\n{\n  return (vector pixel)__builtin_altivec_vpkpx(a, b);\n}\n\n/* vec_packs */\n\nstatic vector signed char __ATTRS_o_ai\nvec_packs(vector short a, vector short b)\n{\n  return __builtin_altivec_vpkshss(a, b);\n}\n\nstatic vector unsigned char __ATTRS_o_ai\nvec_packs(vector unsigned short a, vector unsigned short b)\n{\n  return __builtin_altivec_vpkuhus(a, b);\n}\n\nstatic vector signed short __ATTRS_o_ai\nvec_packs(vector int a, vector int b)\n{\n  return __builtin_altivec_vpkswss(a, b);\n}\n\nstatic vector unsigned short __ATTRS_o_ai\nvec_packs(vector unsigned int a, vector unsigned int b)\n{\n  return __builtin_altivec_vpkuwus(a, b);\n}\n\n/* vec_vpkshss */\n\nstatic vector signed char __attribute__((__always_inline__))\nvec_vpkshss(vector short a, vector short b)\n{\n  return __builtin_altivec_vpkshss(a, b);\n}\n\n/* vec_vpkuhus */\n\nstatic vector unsigned char __attribute__((__always_inline__))\nvec_vpkuhus(vector unsigned short a, vector unsigned short b)\n{\n  return __builtin_altivec_vpkuhus(a, b);\n}\n\n/* vec_vpkswss */\n\nstatic vector signed short __attribute__((__always_inline__))\nvec_vpkswss(vector int a, vector int b)\n{\n  return __builtin_altivec_vpkswss(a, b);\n}\n\n/* vec_vpkuwus */\n\nstatic vector unsigned short __attribute__((__always_inline__))\nvec_vpkuwus(vector unsigned int a, vector unsigned int b)\n{\n  return __builtin_altivec_vpkuwus(a, b);\n}\n\n/* vec_packsu */\n\nstatic vector unsigned char __ATTRS_o_ai\nvec_packsu(vector short a, vector short b)\n{\n  return __builtin_altivec_vpkshus(a, b);\n}\n\nstatic vector unsigned char __ATTRS_o_ai\nvec_packsu(vector unsigned short a, vector unsigned short b)\n{\n  return __builtin_altivec_vpkuhus(a, b);\n}\n\nstatic vector unsigned short __ATTRS_o_ai\nvec_packsu(vector int a, vector int b)\n{\n  return __builtin_altivec_vpkswus(a, b);\n}\n\nstatic vector unsigned short __ATTRS_o_ai\nvec_packsu(vector unsigned int a, vector unsigned int b)\n{\n  return __builtin_altivec_vpkuwus(a, b);\n}\n\n/* vec_vpkshus */\n\nstatic vector unsigned char __ATTRS_o_ai\nvec_vpkshus(vector short a, vector short b)\n{\n  return __builtin_altivec_vpkshus(a, b);\n}\n\nstatic vector unsigned char __ATTRS_o_ai\nvec_vpkshus(vector unsigned short a, vector unsigned short b)\n{\n  return __builtin_altivec_vpkuhus(a, b);\n}\n\n/* vec_vpkswus */\n\nstatic vector unsigned short __ATTRS_o_ai\nvec_vpkswus(vector int a, vector int b)\n{\n  return __builtin_altivec_vpkswus(a, b);\n}\n\nstatic vector unsigned short __ATTRS_o_ai\nvec_vpkswus(vector unsigned int a, vector unsigned int b)\n{\n  return __builtin_altivec_vpkuwus(a, b);\n}\n\n/* vec_perm */\n\nvector signed char __ATTRS_o_ai\nvec_perm(vector signed char a, vector signed char b, vector unsigned char c)\n{\n  return (vector signed char)\n           __builtin_altivec_vperm_4si((vector int)a, (vector int)b, c);\n}\n\nvector unsigned char __ATTRS_o_ai\nvec_perm(vector unsigned char a,\n         vector unsigned char b,\n         vector unsigned char c)\n{\n  return (vector unsigned char)\n           __builtin_altivec_vperm_4si((vector int)a, (vector int)b, c);\n}\n\nvector bool char __ATTRS_o_ai\nvec_perm(vector bool char a, vector bool char b, vector unsigned char c)\n{\n  return (vector bool char)\n           __builtin_altivec_vperm_4si((vector int)a, (vector int)b, c);\n}\n\nvector short __ATTRS_o_ai\nvec_perm(vector short a, vector short b, vector unsigned char c)\n{\n  return (vector short)\n           __builtin_altivec_vperm_4si((vector int)a, (vector int)b, c);\n}\n\nvector unsigned short __ATTRS_o_ai\nvec_perm(vector unsigned short a,\n         vector unsigned short b,\n         vector unsigned char c)\n{\n  return (vector unsigned short)\n           __builtin_altivec_vperm_4si((vector int)a, (vector int)b, c);\n}\n\nvector bool short __ATTRS_o_ai\nvec_perm(vector bool short a, vector bool short b, vector unsigned char c)\n{\n  return (vector bool short)\n           __builtin_altivec_vperm_4si((vector int)a, (vector int)b, c);\n}\n\nvector pixel __ATTRS_o_ai\nvec_perm(vector pixel a, vector pixel b, vector unsigned char c)\n{\n  return (vector pixel)\n           __builtin_altivec_vperm_4si((vector int)a, (vector int)b, c);\n}\n\nvector int __ATTRS_o_ai\nvec_perm(vector int a, vector int b, vector unsigned char c)\n{\n  return (vector int)__builtin_altivec_vperm_4si(a, b, c);\n}\n\nvector unsigned int __ATTRS_o_ai\nvec_perm(vector unsigned int a, vector unsigned int b, vector unsigned char c)\n{\n  return (vector unsigned int)\n           __builtin_altivec_vperm_4si((vector int)a, (vector int)b, c);\n}\n\nvector bool int __ATTRS_o_ai\nvec_perm(vector bool int a, vector bool int b, vector unsigned char c)\n{\n  return (vector bool int)\n           __builtin_altivec_vperm_4si((vector int)a, (vector int)b, c);\n}\n\nvector float __ATTRS_o_ai\nvec_perm(vector float a, vector float b, vector unsigned char c)\n{\n  return (vector float)\n           __builtin_altivec_vperm_4si((vector int)a, (vector int)b, c);\n}\n\n/* vec_vperm */\n\nvector signed char __ATTRS_o_ai\nvec_vperm(vector signed char a, vector signed char b, vector unsigned char c)\n{\n  return (vector signed char)\n           __builtin_altivec_vperm_4si((vector int)a, (vector int)b, c);\n}\n\nvector unsigned char __ATTRS_o_ai\nvec_vperm(vector unsigned char a,\n          vector unsigned char b,\n          vector unsigned char c)\n{\n  return (vector unsigned char)\n           __builtin_altivec_vperm_4si((vector int)a, (vector int)b, c);\n}\n\nvector bool char __ATTRS_o_ai\nvec_vperm(vector bool char a, vector bool char b, vector unsigned char c)\n{\n  return (vector bool char)\n           __builtin_altivec_vperm_4si((vector int)a, (vector int)b, c);\n}\n\nvector short __ATTRS_o_ai\nvec_vperm(vector short a, vector short b, vector unsigned char c)\n{\n  return (vector short)\n           __builtin_altivec_vperm_4si((vector int)a, (vector int)b, c);\n}\n\nvector unsigned short __ATTRS_o_ai\nvec_vperm(vector unsigned short a,\n          vector unsigned short b,\n          vector unsigned char c)\n{\n  return (vector unsigned short)\n           __builtin_altivec_vperm_4si((vector int)a, (vector int)b, c);\n}\n\nvector bool short __ATTRS_o_ai\nvec_vperm(vector bool short a, vector bool short b, vector unsigned char c)\n{\n  return (vector bool short)\n           __builtin_altivec_vperm_4si((vector int)a, (vector int)b, c);\n}\n\nvector pixel __ATTRS_o_ai\nvec_vperm(vector pixel a, vector pixel b, vector unsigned char c)\n{\n  return (vector pixel)\n           __builtin_altivec_vperm_4si((vector int)a, (vector int)b, c);\n}\n\nvector int __ATTRS_o_ai\nvec_vperm(vector int a, vector int b, vector unsigned char c)\n{\n  return (vector int)__builtin_altivec_vperm_4si(a, b, c);\n}\n\nvector unsigned int __ATTRS_o_ai\nvec_vperm(vector unsigned int a, vector unsigned int b, vector unsigned char c)\n{\n  return (vector unsigned int)\n           __builtin_altivec_vperm_4si((vector int)a, (vector int)b, c);\n}\n\nvector bool int __ATTRS_o_ai\nvec_vperm(vector bool int a, vector bool int b, vector unsigned char c)\n{\n  return (vector bool int)\n           __builtin_altivec_vperm_4si((vector int)a, (vector int)b, c);\n}\n\nvector float __ATTRS_o_ai\nvec_vperm(vector float a, vector float b, vector unsigned char c)\n{\n  return (vector float)\n           __builtin_altivec_vperm_4si((vector int)a, (vector int)b, c);\n}\n\n/* vec_re */\n\nvector float __attribute__((__always_inline__))\nvec_re(vector float a)\n{\n  return __builtin_altivec_vrefp(a);\n}\n\n/* vec_vrefp */\n\nvector float __attribute__((__always_inline__))\nvec_vrefp(vector float a)\n{\n  return __builtin_altivec_vrefp(a);\n}\n\n/* vec_rl */\n\nstatic vector signed char __ATTRS_o_ai\nvec_rl(vector signed char a, vector unsigned char b)\n{\n  return (vector signed char)__builtin_altivec_vrlb((vector char)a, b);\n}\n\nstatic vector unsigned char __ATTRS_o_ai\nvec_rl(vector unsigned char a, vector unsigned char b)\n{\n  return (vector unsigned char)__builtin_altivec_vrlb((vector char)a, b);\n}\n\nstatic vector short __ATTRS_o_ai\nvec_rl(vector short a, vector unsigned short b)\n{\n  return __builtin_altivec_vrlh(a, b);\n}\n\nstatic vector unsigned short __ATTRS_o_ai\nvec_rl(vector unsigned short a, vector unsigned short b)\n{\n  return (vector unsigned short)__builtin_altivec_vrlh((vector short)a, b);\n}\n\nstatic vector int __ATTRS_o_ai\nvec_rl(vector int a, vector unsigned int b)\n{\n  return __builtin_altivec_vrlw(a, b);\n}\n\nstatic vector unsigned int __ATTRS_o_ai\nvec_rl(vector unsigned int a, vector unsigned int b)\n{\n  return (vector unsigned int)__builtin_altivec_vrlw((vector int)a, b);\n}\n\n/* vec_vrlb */\n\nstatic vector signed char __ATTRS_o_ai\nvec_vrlb(vector signed char a, vector unsigned char b)\n{\n  return (vector signed char)__builtin_altivec_vrlb((vector char)a, b);\n}\n\nstatic vector unsigned char __ATTRS_o_ai\nvec_vrlb(vector unsigned char a, vector unsigned char b)\n{\n  return (vector unsigned char)__builtin_altivec_vrlb((vector char)a, b);\n}\n\n/* vec_vrlh */\n\nstatic vector short __ATTRS_o_ai\nvec_vrlh(vector short a, vector unsigned short b)\n{\n  return __builtin_altivec_vrlh(a, b);\n}\n\nstatic vector unsigned short __ATTRS_o_ai\nvec_vrlh(vector unsigned short a, vector unsigned short b)\n{\n  return (vector unsigned short)__builtin_altivec_vrlh((vector short)a, b);\n}\n\n/* vec_vrlw */\n\nstatic vector int __ATTRS_o_ai\nvec_vrlw(vector int a, vector unsigned int b)\n{\n  return __builtin_altivec_vrlw(a, b);\n}\n\nstatic vector unsigned int __ATTRS_o_ai\nvec_vrlw(vector unsigned int a, vector unsigned int b)\n{\n  return (vector unsigned int)__builtin_altivec_vrlw((vector int)a, b);\n}\n\n/* vec_round */\n\nstatic vector float __attribute__((__always_inline__))\nvec_round(vector float a)\n{\n  return __builtin_altivec_vrfin(a);\n}\n\n/* vec_vrfin */\n\nstatic vector float __attribute__((__always_inline__))\nvec_vrfin(vector float a)\n{\n  return __builtin_altivec_vrfin(a);\n}\n\n/* vec_rsqrte */\n\nstatic __vector float __attribute__((__always_inline__))\nvec_rsqrte(vector float a)\n{\n  return __builtin_altivec_vrsqrtefp(a);\n}\n\n/* vec_vrsqrtefp */\n\nstatic __vector float __attribute__((__always_inline__))\nvec_vrsqrtefp(vector float a)\n{\n  return __builtin_altivec_vrsqrtefp(a);\n}\n\n/* vec_sel */\n\n#define __builtin_altivec_vsel_4si vec_sel\n\nstatic vector signed char __ATTRS_o_ai\nvec_sel(vector signed char a, vector signed char b, vector unsigned char c)\n{\n  return (a & ~(vector signed char)c) | (b & (vector signed char)c);\n}\n\nstatic vector signed char __ATTRS_o_ai\nvec_sel(vector signed char a, vector signed char b, vector bool char c)\n{\n  return (a & ~(vector signed char)c) | (b & (vector signed char)c);\n}\n\nstatic vector unsigned char __ATTRS_o_ai\nvec_sel(vector unsigned char a, vector unsigned char b, vector unsigned char c)\n{\n  return (a & ~c) | (b & c);\n}\n\nstatic vector unsigned char __ATTRS_o_ai\nvec_sel(vector unsigned char a, vector unsigned char b, vector bool char c)\n{\n  return (a & ~(vector unsigned char)c) | (b & (vector unsigned char)c);\n}\n\nstatic vector bool char __ATTRS_o_ai\nvec_sel(vector bool char a, vector bool char b, vector unsigned char c)\n{\n  return (a & ~(vector bool char)c) | (b & (vector bool char)c);\n}\n\nstatic vector bool char __ATTRS_o_ai\nvec_sel(vector bool char a, vector bool char b, vector bool char c)\n{\n  return (a & ~c) | (b & c);\n}\n\nstatic vector short __ATTRS_o_ai\nvec_sel(vector short a, vector short b, vector unsigned short c)\n{\n  return (a & ~(vector short)c) | (b & (vector short)c);\n}\n\nstatic vector short __ATTRS_o_ai\nvec_sel(vector short a, vector short b, vector bool short c)\n{\n  return (a & ~(vector short)c) | (b & (vector short)c);\n}\n\nstatic vector unsigned short __ATTRS_o_ai\nvec_sel(vector unsigned short a,\n        vector unsigned short b,\n        vector unsigned short c)\n{\n  return (a & ~c) | (b & c);\n}\n\nstatic vector unsigned short __ATTRS_o_ai\nvec_sel(vector unsigned short a, vector unsigned short b, vector bool short c)\n{\n  return (a & ~(vector unsigned short)c) | (b & (vector unsigned short)c);\n}\n\nstatic vector bool short __ATTRS_o_ai\nvec_sel(vector bool short a, vector bool short b, vector unsigned short c)\n{\n  return (a & ~(vector bool short)c) | (b & (vector bool short)c);\n}\n\nstatic vector bool short __ATTRS_o_ai\nvec_sel(vector bool short a, vector bool short b, vector bool short c)\n{\n  return (a & ~c) | (b & c);\n}\n\nstatic vector int __ATTRS_o_ai\nvec_sel(vector int a, vector int b, vector unsigned int c)\n{\n  return (a & ~(vector int)c) | (b & (vector int)c);\n}\n\nstatic vector int __ATTRS_o_ai\nvec_sel(vector int a, vector int b, vector bool int c)\n{\n  return (a & ~(vector int)c) | (b & (vector int)c);\n}\n\nstatic vector unsigned int __ATTRS_o_ai\nvec_sel(vector unsigned int a, vector unsigned int b, vector unsigned int c)\n{\n  return (a & ~c) | (b & c);\n}\n\nstatic vector unsigned int __ATTRS_o_ai\nvec_sel(vector unsigned int a, vector unsigned int b, vector bool int c)\n{\n  return (a & ~(vector unsigned int)c) | (b & (vector unsigned int)c);\n}\n\nstatic vector bool int __ATTRS_o_ai\nvec_sel(vector bool int a, vector bool int b, vector unsigned int c)\n{\n  return (a & ~(vector bool int)c) | (b & (vector bool int)c);\n}\n\nstatic vector bool int __ATTRS_o_ai\nvec_sel(vector bool int a, vector bool int b, vector bool int c)\n{\n  return (a & ~c) | (b & c);\n}\n\nstatic vector float __ATTRS_o_ai\nvec_sel(vector float a, vector float b, vector unsigned int c)\n{\n  vector int res = ((vector int)a & ~(vector int)c) \n                   | ((vector int)b & (vector int)c);\n  return (vector float)res;\n}\n\nstatic vector float __ATTRS_o_ai\nvec_sel(vector float a, vector float b, vector bool int c)\n{\n  vector int res = ((vector int)a & ~(vector int)c)\n                   | ((vector int)b & (vector int)c);\n  return (vector float)res;\n}\n\n/* vec_vsel */\n\nstatic vector signed char __ATTRS_o_ai\nvec_vsel(vector signed char a, vector signed char b, vector unsigned char c)\n{\n  return (a & ~(vector signed char)c) | (b & (vector signed char)c);\n}\n\nstatic vector signed char __ATTRS_o_ai\nvec_vsel(vector signed char a, vector signed char b, vector bool char c)\n{\n  return (a & ~(vector signed char)c) | (b & (vector signed char)c);\n}\n\nstatic vector unsigned char __ATTRS_o_ai\nvec_vsel(vector unsigned char a, vector unsigned char b, vector unsigned char c)\n{\n  return (a & ~c) | (b & c);\n}\n\nstatic vector unsigned char __ATTRS_o_ai\nvec_vsel(vector unsigned char a, vector unsigned char b, vector bool char c)\n{\n  return (a & ~(vector unsigned char)c) | (b & (vector unsigned char)c);\n}\n\nstatic vector bool char __ATTRS_o_ai\nvec_vsel(vector bool char a, vector bool char b, vector unsigned char c)\n{\n  return (a & ~(vector bool char)c) | (b & (vector bool char)c);\n}\n\nstatic vector bool char __ATTRS_o_ai\nvec_vsel(vector bool char a, vector bool char b, vector bool char c)\n{\n  return (a & ~c) | (b & c);\n}\n\nstatic vector short __ATTRS_o_ai\nvec_vsel(vector short a, vector short b, vector unsigned short c)\n{\n  return (a & ~(vector short)c) | (b & (vector short)c);\n}\n\nstatic vector short __ATTRS_o_ai\nvec_vsel(vector short a, vector short b, vector bool short c)\n{\n  return (a & ~(vector short)c) | (b & (vector short)c);\n}\n\nstatic vector unsigned short __ATTRS_o_ai\nvec_vsel(vector unsigned short a,\n         vector unsigned short b,\n         vector unsigned short c)\n{\n  return (a & ~c) | (b & c);\n}\n\nstatic vector unsigned short __ATTRS_o_ai\nvec_vsel(vector unsigned short a, vector unsigned short b, vector bool short c)\n{\n  return (a & ~(vector unsigned short)c) | (b & (vector unsigned short)c);\n}\n\nstatic vector bool short __ATTRS_o_ai\nvec_vsel(vector bool short a, vector bool short b, vector unsigned short c)\n{\n  return (a & ~(vector bool short)c) | (b & (vector bool short)c);\n}\n\nstatic vector bool short __ATTRS_o_ai\nvec_vsel(vector bool short a, vector bool short b, vector bool short c)\n{\n  return (a & ~c) | (b & c);\n}\n\nstatic vector int __ATTRS_o_ai\nvec_vsel(vector int a, vector int b, vector unsigned int c)\n{\n  return (a & ~(vector int)c) | (b & (vector int)c);\n}\n\nstatic vector int __ATTRS_o_ai\nvec_vsel(vector int a, vector int b, vector bool int c)\n{\n  return (a & ~(vector int)c) | (b & (vector int)c);\n}\n\nstatic vector unsigned int __ATTRS_o_ai\nvec_vsel(vector unsigned int a, vector unsigned int b, vector unsigned int c)\n{\n  return (a & ~c) | (b & c);\n}\n\nstatic vector unsigned int __ATTRS_o_ai\nvec_vsel(vector unsigned int a, vector unsigned int b, vector bool int c)\n{\n  return (a & ~(vector unsigned int)c) | (b & (vector unsigned int)c);\n}\n\nstatic vector bool int __ATTRS_o_ai\nvec_vsel(vector bool int a, vector bool int b, vector unsigned int c)\n{\n  return (a & ~(vector bool int)c) | (b & (vector bool int)c);\n}\n\nstatic vector bool int __ATTRS_o_ai\nvec_vsel(vector bool int a, vector bool int b, vector bool int c)\n{\n  return (a & ~c) | (b & c);\n}\n\nstatic vector float __ATTRS_o_ai\nvec_vsel(vector float a, vector float b, vector unsigned int c)\n{\n  vector int res = ((vector int)a & ~(vector int)c)\n                   | ((vector int)b & (vector int)c);\n  return (vector float)res;\n}\n\nstatic vector float __ATTRS_o_ai\nvec_vsel(vector float a, vector float b, vector bool int c)\n{\n  vector int res = ((vector int)a & ~(vector int)c)\n                   | ((vector int)b & (vector int)c);\n  return (vector float)res;\n}\n\n/* vec_sl */\n\nstatic vector signed char __ATTRS_o_ai\nvec_sl(vector signed char a, vector unsigned char b)\n{\n  return a << (vector signed char)b;\n}\n\nstatic vector unsigned char __ATTRS_o_ai\nvec_sl(vector unsigned char a, vector unsigned char b)\n{\n  return a << b;\n}\n\nstatic vector short __ATTRS_o_ai\nvec_sl(vector short a, vector unsigned short b)\n{\n  return a << (vector short)b;\n}\n\nstatic vector unsigned short __ATTRS_o_ai\nvec_sl(vector unsigned short a, vector unsigned short b)\n{\n  return a << b;\n}\n\nstatic vector int __ATTRS_o_ai\nvec_sl(vector int a, vector unsigned int b)\n{\n  return a << (vector int)b;\n}\n\nstatic vector unsigned int __ATTRS_o_ai\nvec_sl(vector unsigned int a, vector unsigned int b)\n{\n  return a << b;\n}\n\n/* vec_vslb */\n\n#define __builtin_altivec_vslb vec_vslb\n\nstatic vector signed char __ATTRS_o_ai\nvec_vslb(vector signed char a, vector unsigned char b)\n{\n  return vec_sl(a, b);\n}\n\nstatic vector unsigned char __ATTRS_o_ai\nvec_vslb(vector unsigned char a, vector unsigned char b)\n{\n  return vec_sl(a, b);\n}\n\n/* vec_vslh */\n\n#define __builtin_altivec_vslh vec_vslh\n\nstatic vector short __ATTRS_o_ai\nvec_vslh(vector short a, vector unsigned short b)\n{\n  return vec_sl(a, b);\n}\n\nstatic vector unsigned short __ATTRS_o_ai\nvec_vslh(vector unsigned short a, vector unsigned short b)\n{\n  return vec_sl(a, b);\n}\n\n/* vec_vslw */\n\n#define __builtin_altivec_vslw vec_vslw\n\nstatic vector int __ATTRS_o_ai\nvec_vslw(vector int a, vector unsigned int b)\n{\n  return vec_sl(a, b);\n}\n\nstatic vector unsigned int __ATTRS_o_ai\nvec_vslw(vector unsigned int a, vector unsigned int b)\n{\n  return vec_sl(a, b);\n}\n\n/* vec_sld */\n\n#define __builtin_altivec_vsldoi_4si vec_sld\n\nstatic vector signed char __ATTRS_o_ai\nvec_sld(vector signed char a, vector signed char b, unsigned char c)\n{\n  return vec_perm(a, b, (vector unsigned char)\n    (c,   c+1, c+2,  c+3,  c+4,  c+5,  c+6,  c+7, \n     c+8, c+9, c+10, c+11, c+12, c+13, c+14, c+15));\n}\n\nstatic vector unsigned char __ATTRS_o_ai\nvec_sld(vector unsigned char a, vector unsigned char b, unsigned char c)\n{\n  return vec_perm(a, b, (vector unsigned char)\n    (c,   c+1, c+2,  c+3,  c+4,  c+5,  c+6,  c+7, \n     c+8, c+9, c+10, c+11, c+12, c+13, c+14, c+15));\n}\n\nstatic vector short __ATTRS_o_ai\nvec_sld(vector short a, vector short b, unsigned char c)\n{\n  return vec_perm(a, b, (vector unsigned char)\n    (c,   c+1, c+2,  c+3,  c+4,  c+5,  c+6,  c+7, \n     c+8, c+9, c+10, c+11, c+12, c+13, c+14, c+15));\n}\n\nstatic vector unsigned short __ATTRS_o_ai\nvec_sld(vector unsigned short a, vector unsigned short b, unsigned char c)\n{\n  return vec_perm(a, b, (vector unsigned char)\n    (c,   c+1, c+2,  c+3,  c+4,  c+5,  c+6,  c+7, \n     c+8, c+9, c+10, c+11, c+12, c+13, c+14, c+15));\n}\n\nstatic vector pixel __ATTRS_o_ai\nvec_sld(vector pixel a, vector pixel b, unsigned char c)\n{\n  return vec_perm(a, b, (vector unsigned char)\n    (c,   c+1, c+2,  c+3,  c+4,  c+5,  c+6,  c+7, \n     c+8, c+9, c+10, c+11, c+12, c+13, c+14, c+15));\n}\n\nstatic vector int __ATTRS_o_ai\nvec_sld(vector int a, vector int b, unsigned char c)\n{\n  return vec_perm(a, b, (vector unsigned char)\n    (c,   c+1, c+2,  c+3,  c+4,  c+5,  c+6,  c+7, \n     c+8, c+9, c+10, c+11, c+12, c+13, c+14, c+15));\n}\n\nstatic vector unsigned int __ATTRS_o_ai\nvec_sld(vector unsigned int a, vector unsigned int b, unsigned char c)\n{\n  return vec_perm(a, b, (vector unsigned char)\n    (c,   c+1, c+2,  c+3,  c+4,  c+5,  c+6,  c+7, \n     c+8, c+9, c+10, c+11, c+12, c+13, c+14, c+15));\n}\n\nstatic vector float __ATTRS_o_ai\nvec_sld(vector float a, vector float b, unsigned char c)\n{\n  return vec_perm(a, b, (vector unsigned char)\n    (c,   c+1, c+2,  c+3,  c+4,  c+5,  c+6,  c+7, \n     c+8, c+9, c+10, c+11, c+12, c+13, c+14, c+15));\n}\n\n/* vec_vsldoi */\n\nstatic vector signed char __ATTRS_o_ai\nvec_vsldoi(vector signed char a, vector signed char b, unsigned char c)\n{\n  return vec_perm(a, b, (vector unsigned char)\n    (c,   c+1, c+2,  c+3,  c+4,  c+5,  c+6,  c+7, \n     c+8, c+9, c+10, c+11, c+12, c+13, c+14, c+15));\n}\n\nstatic vector unsigned char __ATTRS_o_ai\nvec_vsldoi(vector unsigned char a, vector unsigned char b, unsigned char c)\n{\n  return vec_perm(a, b, (vector unsigned char)\n    (c,   c+1, c+2,  c+3,  c+4,  c+5,  c+6,  c+7, \n     c+8, c+9, c+10, c+11, c+12, c+13, c+14, c+15));\n}\n\nstatic vector short __ATTRS_o_ai\nvec_vsldoi(vector short a, vector short b, unsigned char c)\n{\n  return vec_perm(a, b, (vector unsigned char)\n    (c,   c+1, c+2,  c+3,  c+4,  c+5,  c+6,  c+7, \n     c+8, c+9, c+10, c+11, c+12, c+13, c+14, c+15));\n}\n\nstatic vector unsigned short __ATTRS_o_ai\nvec_vsldoi(vector unsigned short a, vector unsigned short b, unsigned char c)\n{\n  return vec_perm(a, b, (vector unsigned char)\n    (c,   c+1, c+2,  c+3,  c+4,  c+5,  c+6,  c+7, \n     c+8, c+9, c+10, c+11, c+12, c+13, c+14, c+15));\n}\n\nstatic vector pixel __ATTRS_o_ai\nvec_vsldoi(vector pixel a, vector pixel b, unsigned char c)\n{\n  return vec_perm(a, b, (vector unsigned char)\n    (c,   c+1, c+2,  c+3,  c+4,  c+5,  c+6,  c+7, \n     c+8, c+9, c+10, c+11, c+12, c+13, c+14, c+15));\n}\n\nstatic vector int __ATTRS_o_ai\nvec_vsldoi(vector int a, vector int b, unsigned char c)\n{\n  return vec_perm(a, b, (vector unsigned char)\n    (c,   c+1, c+2,  c+3,  c+4,  c+5,  c+6,  c+7, \n     c+8, c+9, c+10, c+11, c+12, c+13, c+14, c+15));\n}\n\nstatic vector unsigned int __ATTRS_o_ai\nvec_vsldoi(vector unsigned int a, vector unsigned int b, unsigned char c)\n{\n  return vec_perm(a, b, (vector unsigned char)\n    (c,   c+1, c+2,  c+3,  c+4,  c+5,  c+6,  c+7, \n     c+8, c+9, c+10, c+11, c+12, c+13, c+14, c+15));\n}\n\nstatic vector float __ATTRS_o_ai\nvec_vsldoi(vector float a, vector float b, unsigned char c)\n{\n  return vec_perm(a, b, (vector unsigned char)\n    (c,   c+1, c+2,  c+3,  c+4,  c+5,  c+6,  c+7, \n     c+8, c+9, c+10, c+11, c+12, c+13, c+14, c+15));\n}\n\n/* vec_sll */\n\nstatic vector signed char __ATTRS_o_ai\nvec_sll(vector signed char a, vector unsigned char b)\n{\n  return (vector signed char)\n           __builtin_altivec_vsl((vector int)a, (vector int)b);\n}\n\nstatic vector signed char __ATTRS_o_ai\nvec_sll(vector signed char a, vector unsigned short b)\n{\n  return (vector signed char)\n           __builtin_altivec_vsl((vector int)a, (vector int)b);\n}\n\nstatic vector signed char __ATTRS_o_ai\nvec_sll(vector signed char a, vector unsigned int b)\n{\n  return (vector signed char)\n           __builtin_altivec_vsl((vector int)a, (vector int)b);\n}\n\nstatic vector unsigned char __ATTRS_o_ai\nvec_sll(vector unsigned char a, vector unsigned char b)\n{\n  return (vector unsigned char)\n           __builtin_altivec_vsl((vector int)a, (vector int)b);\n}\n\nstatic vector unsigned char __ATTRS_o_ai\nvec_sll(vector unsigned char a, vector unsigned short b)\n{\n  return (vector unsigned char)\n           __builtin_altivec_vsl((vector int)a, (vector int)b);\n}\n\nstatic vector unsigned char __ATTRS_o_ai\nvec_sll(vector unsigned char a, vector unsigned int b)\n{\n  return (vector unsigned char)\n           __builtin_altivec_vsl((vector int)a, (vector int)b);\n}\n\nstatic vector bool char __ATTRS_o_ai\nvec_sll(vector bool char a, vector unsigned char b)\n{\n  return (vector bool char)__builtin_altivec_vsl((vector int)a, (vector int)b);\n}\n\nstatic vector bool char __ATTRS_o_ai\nvec_sll(vector bool char a, vector unsigned short b)\n{\n  return (vector bool char)__builtin_altivec_vsl((vector int)a, (vector int)b);\n}\n\nstatic vector bool char __ATTRS_o_ai\nvec_sll(vector bool char a, vector unsigned int b)\n{\n  return (vector bool char)__builtin_altivec_vsl((vector int)a, (vector int)b);\n}\n\nstatic vector short __ATTRS_o_ai\nvec_sll(vector short a, vector unsigned char b)\n{\n  return (vector short)__builtin_altivec_vsl((vector int)a, (vector int)b);\n}\n\nstatic vector short __ATTRS_o_ai\nvec_sll(vector short a, vector unsigned short b)\n{\n  return (vector short)__builtin_altivec_vsl((vector int)a, (vector int)b);\n}\n\nstatic vector short __ATTRS_o_ai\nvec_sll(vector short a, vector unsigned int b)\n{\n  return (vector short)__builtin_altivec_vsl((vector int)a, (vector int)b);\n}\n\nstatic vector unsigned short __ATTRS_o_ai\nvec_sll(vector unsigned short a, vector unsigned char b)\n{\n  return (vector unsigned short)\n           __builtin_altivec_vsl((vector int)a, (vector int)b);\n}\n\nstatic vector unsigned short __ATTRS_o_ai\nvec_sll(vector unsigned short a, vector unsigned short b)\n{\n  return (vector unsigned short)\n           __builtin_altivec_vsl((vector int)a, (vector int)b);\n}\n\nstatic vector unsigned short __ATTRS_o_ai\nvec_sll(vector unsigned short a, vector unsigned int b)\n{\n  return (vector unsigned short)\n           __builtin_altivec_vsl((vector int)a, (vector int)b);\n}\n\nstatic vector bool short __ATTRS_o_ai\nvec_sll(vector bool short a, vector unsigned char b)\n{\n  return (vector bool short)__builtin_altivec_vsl((vector int)a, (vector int)b);\n}\n\nstatic vector bool short __ATTRS_o_ai\nvec_sll(vector bool short a, vector unsigned short b)\n{\n  return (vector bool short)__builtin_altivec_vsl((vector int)a, (vector int)b);\n}\n\nstatic vector bool short __ATTRS_o_ai\nvec_sll(vector bool short a, vector unsigned int b)\n{\n  return (vector bool short)__builtin_altivec_vsl((vector int)a, (vector int)b);\n}\n\nstatic vector pixel __ATTRS_o_ai\nvec_sll(vector pixel a, vector unsigned char b)\n{\n  return (vector pixel)__builtin_altivec_vsl((vector int)a, (vector int)b);\n}\n\nstatic vector pixel __ATTRS_o_ai\nvec_sll(vector pixel a, vector unsigned short b)\n{\n  return (vector pixel)__builtin_altivec_vsl((vector int)a, (vector int)b);\n}\n\nstatic vector pixel __ATTRS_o_ai\nvec_sll(vector pixel a, vector unsigned int b)\n{\n  return (vector pixel)__builtin_altivec_vsl((vector int)a, (vector int)b);\n}\n\nstatic vector int __ATTRS_o_ai\nvec_sll(vector int a, vector unsigned char b)\n{\n  return (vector int)__builtin_altivec_vsl(a, (vector int)b);\n}\n\nstatic vector int __ATTRS_o_ai\nvec_sll(vector int a, vector unsigned short b)\n{\n  return (vector int)__builtin_altivec_vsl(a, (vector int)b);\n}\n\nstatic vector int __ATTRS_o_ai\nvec_sll(vector int a, vector unsigned int b)\n{\n  return (vector int)__builtin_altivec_vsl(a, (vector int)b);\n}\n\nstatic vector unsigned int __ATTRS_o_ai\nvec_sll(vector unsigned int a, vector unsigned char b)\n{\n  return (vector unsigned int)\n           __builtin_altivec_vsl((vector int)a, (vector int)b);\n}\n\nstatic vector unsigned int __ATTRS_o_ai\nvec_sll(vector unsigned int a, vector unsigned short b)\n{\n  return (vector unsigned int)\n           __builtin_altivec_vsl((vector int)a, (vector int)b);\n}\n\nstatic vector unsigned int __ATTRS_o_ai\nvec_sll(vector unsigned int a, vector unsigned int b)\n{\n  return (vector unsigned int)\n           __builtin_altivec_vsl((vector int)a, (vector int)b);\n}\n\nstatic vector bool int __ATTRS_o_ai\nvec_sll(vector bool int a, vector unsigned char b)\n{\n  return (vector bool int)__builtin_altivec_vsl((vector int)a, (vector int)b);\n}\n\nstatic vector bool int __ATTRS_o_ai\nvec_sll(vector bool int a, vector unsigned short b)\n{\n  return (vector bool int)__builtin_altivec_vsl((vector int)a, (vector int)b);\n}\n\nstatic vector bool int __ATTRS_o_ai\nvec_sll(vector bool int a, vector unsigned int b)\n{\n  return (vector bool int)__builtin_altivec_vsl((vector int)a, (vector int)b);\n}\n\n/* vec_vsl */\n\nstatic vector signed char __ATTRS_o_ai\nvec_vsl(vector signed char a, vector unsigned char b)\n{\n  return (vector signed char)\n           __builtin_altivec_vsl((vector int)a, (vector int)b);\n}\n\nstatic vector signed char __ATTRS_o_ai\nvec_vsl(vector signed char a, vector unsigned short b)\n{\n  return (vector signed char)\n           __builtin_altivec_vsl((vector int)a, (vector int)b);\n}\n\nstatic vector signed char __ATTRS_o_ai\nvec_vsl(vector signed char a, vector unsigned int b)\n{\n  return (vector signed char)\n           __builtin_altivec_vsl((vector int)a, (vector int)b);\n}\n\nstatic vector unsigned char __ATTRS_o_ai\nvec_vsl(vector unsigned char a, vector unsigned char b)\n{\n  return (vector unsigned char)\n           __builtin_altivec_vsl((vector int)a, (vector int)b);\n}\n\nstatic vector unsigned char __ATTRS_o_ai\nvec_vsl(vector unsigned char a, vector unsigned short b)\n{\n  return (vector unsigned char)\n           __builtin_altivec_vsl((vector int)a, (vector int)b);\n}\n\nstatic vector unsigned char __ATTRS_o_ai\nvec_vsl(vector unsigned char a, vector unsigned int b)\n{\n  return (vector unsigned char)\n           __builtin_altivec_vsl((vector int)a, (vector int)b);\n}\n\nstatic vector bool char __ATTRS_o_ai\nvec_vsl(vector bool char a, vector unsigned char b)\n{\n  return (vector bool char)__builtin_altivec_vsl((vector int)a, (vector int)b);\n}\n\nstatic vector bool char __ATTRS_o_ai\nvec_vsl(vector bool char a, vector unsigned short b)\n{\n  return (vector bool char)__builtin_altivec_vsl((vector int)a, (vector int)b);\n}\n\nstatic vector bool char __ATTRS_o_ai\nvec_vsl(vector bool char a, vector unsigned int b)\n{\n  return (vector bool char)__builtin_altivec_vsl((vector int)a, (vector int)b);\n}\n\nstatic vector short __ATTRS_o_ai\nvec_vsl(vector short a, vector unsigned char b)\n{\n  return (vector short)__builtin_altivec_vsl((vector int)a, (vector int)b);\n}\n\nstatic vector short __ATTRS_o_ai\nvec_vsl(vector short a, vector unsigned short b)\n{\n  return (vector short)__builtin_altivec_vsl((vector int)a, (vector int)b);\n}\n\nstatic vector short __ATTRS_o_ai\nvec_vsl(vector short a, vector unsigned int b)\n{\n  return (vector short)__builtin_altivec_vsl((vector int)a, (vector int)b);\n}\n\nstatic vector unsigned short __ATTRS_o_ai\nvec_vsl(vector unsigned short a, vector unsigned char b)\n{\n  return (vector unsigned short)\n           __builtin_altivec_vsl((vector int)a, (vector int)b);\n}\n\nstatic vector unsigned short __ATTRS_o_ai\nvec_vsl(vector unsigned short a, vector unsigned short b)\n{\n  return (vector unsigned short)\n           __builtin_altivec_vsl((vector int)a, (vector int)b);\n}\n\nstatic vector unsigned short __ATTRS_o_ai\nvec_vsl(vector unsigned short a, vector unsigned int b)\n{\n  return (vector unsigned short)\n           __builtin_altivec_vsl((vector int)a, (vector int)b);\n}\n\nstatic vector bool short __ATTRS_o_ai\nvec_vsl(vector bool short a, vector unsigned char b)\n{\n  return (vector bool short)__builtin_altivec_vsl((vector int)a, (vector int)b);\n}\n\nstatic vector bool short __ATTRS_o_ai\nvec_vsl(vector bool short a, vector unsigned short b)\n{\n  return (vector bool short)__builtin_altivec_vsl((vector int)a, (vector int)b);\n}\n\nstatic vector bool short __ATTRS_o_ai\nvec_vsl(vector bool short a, vector unsigned int b)\n{\n  return (vector bool short)__builtin_altivec_vsl((vector int)a, (vector int)b);\n}\n\nstatic vector pixel __ATTRS_o_ai\nvec_vsl(vector pixel a, vector unsigned char b)\n{\n  return (vector pixel)__builtin_altivec_vsl((vector int)a, (vector int)b);\n}\n\nstatic vector pixel __ATTRS_o_ai\nvec_vsl(vector pixel a, vector unsigned short b)\n{\n  return (vector pixel)__builtin_altivec_vsl((vector int)a, (vector int)b);\n}\n\nstatic vector pixel __ATTRS_o_ai\nvec_vsl(vector pixel a, vector unsigned int b)\n{\n  return (vector pixel)__builtin_altivec_vsl((vector int)a, (vector int)b);\n}\n\nstatic vector int __ATTRS_o_ai\nvec_vsl(vector int a, vector unsigned char b)\n{\n  return (vector int)__builtin_altivec_vsl(a, (vector int)b);\n}\n\nstatic vector int __ATTRS_o_ai\nvec_vsl(vector int a, vector unsigned short b)\n{\n  return (vector int)__builtin_altivec_vsl(a, (vector int)b);\n}\n\nstatic vector int __ATTRS_o_ai\nvec_vsl(vector int a, vector unsigned int b)\n{\n  return (vector int)__builtin_altivec_vsl(a, (vector int)b);\n}\n\nstatic vector unsigned int __ATTRS_o_ai\nvec_vsl(vector unsigned int a, vector unsigned char b)\n{\n  return (vector unsigned int)\n           __builtin_altivec_vsl((vector int)a, (vector int)b);\n}\n\nstatic vector unsigned int __ATTRS_o_ai\nvec_vsl(vector unsigned int a, vector unsigned short b)\n{\n  return (vector unsigned int)\n           __builtin_altivec_vsl((vector int)a, (vector int)b);\n}\n\nstatic vector unsigned int __ATTRS_o_ai\nvec_vsl(vector unsigned int a, vector unsigned int b)\n{\n  return (vector unsigned int)\n           __builtin_altivec_vsl((vector int)a, (vector int)b);\n}\n\nstatic vector bool int __ATTRS_o_ai\nvec_vsl(vector bool int a, vector unsigned char b)\n{\n  return (vector bool int)__builtin_altivec_vsl((vector int)a, (vector int)b);\n}\n\nstatic vector bool int __ATTRS_o_ai\nvec_vsl(vector bool int a, vector unsigned short b)\n{\n  return (vector bool int)__builtin_altivec_vsl((vector int)a, (vector int)b);\n}\n\nstatic vector bool int __ATTRS_o_ai\nvec_vsl(vector bool int a, vector unsigned int b)\n{\n  return (vector bool int)__builtin_altivec_vsl((vector int)a, (vector int)b);\n}\n\n/* vec_slo */\n\nstatic vector signed char __ATTRS_o_ai\nvec_slo(vector signed char a, vector signed char b)\n{\n  return (vector signed char)\n           __builtin_altivec_vslo((vector int)a, (vector int)b);\n}\n\nstatic vector signed char __ATTRS_o_ai\nvec_slo(vector signed char a, vector unsigned char b)\n{\n  return (vector signed char)\n           __builtin_altivec_vslo((vector int)a, (vector int)b);\n}\n\nstatic vector unsigned char __ATTRS_o_ai\nvec_slo(vector unsigned char a, vector signed char b)\n{\n  return (vector unsigned char)\n           __builtin_altivec_vslo((vector int)a, (vector int)b);\n}\n\nstatic vector unsigned char __ATTRS_o_ai\nvec_slo(vector unsigned char a, vector unsigned char b)\n{\n  return (vector unsigned char)\n           __builtin_altivec_vslo((vector int)a, (vector int)b);\n}\n\nstatic vector short __ATTRS_o_ai\nvec_slo(vector short a, vector signed char b)\n{\n  return (vector short)__builtin_altivec_vslo((vector int)a, (vector int)b);\n}\n\nstatic vector short __ATTRS_o_ai\nvec_slo(vector short a, vector unsigned char b)\n{\n  return (vector short)__builtin_altivec_vslo((vector int)a, (vector int)b);\n}\n\nstatic vector unsigned short __ATTRS_o_ai\nvec_slo(vector unsigned short a, vector signed char b)\n{\n  return (vector unsigned short)\n           __builtin_altivec_vslo((vector int)a, (vector int)b);\n}\n\nstatic vector unsigned short __ATTRS_o_ai\nvec_slo(vector unsigned short a, vector unsigned char b)\n{\n  return (vector unsigned short)\n           __builtin_altivec_vslo((vector int)a, (vector int)b);\n}\n\nstatic vector pixel __ATTRS_o_ai\nvec_slo(vector pixel a, vector signed char b)\n{\n  return (vector pixel)__builtin_altivec_vslo((vector int)a, (vector int)b);\n}\n\nstatic vector pixel __ATTRS_o_ai\nvec_slo(vector pixel a, vector unsigned char b)\n{\n  return (vector pixel)__builtin_altivec_vslo((vector int)a, (vector int)b);\n}\n\nstatic vector int __ATTRS_o_ai\nvec_slo(vector int a, vector signed char b)\n{\n  return (vector int)__builtin_altivec_vslo(a, (vector int)b);\n}\n\nstatic vector int __ATTRS_o_ai\nvec_slo(vector int a, vector unsigned char b)\n{\n  return (vector int)__builtin_altivec_vslo(a, (vector int)b);\n}\n\nstatic vector unsigned int __ATTRS_o_ai\nvec_slo(vector unsigned int a, vector signed char b)\n{\n  return (vector unsigned int)\n           __builtin_altivec_vslo((vector int)a, (vector int)b);\n}\n\nstatic vector unsigned int __ATTRS_o_ai\nvec_slo(vector unsigned int a, vector unsigned char b)\n{\n  return (vector unsigned int)\n           __builtin_altivec_vslo((vector int)a, (vector int)b);\n}\n\nstatic vector float __ATTRS_o_ai\nvec_slo(vector float a, vector signed char b)\n{\n  return (vector float)__builtin_altivec_vslo((vector int)a, (vector int)b);\n}\n\nstatic vector float __ATTRS_o_ai\nvec_slo(vector float a, vector unsigned char b)\n{\n  return (vector float)__builtin_altivec_vslo((vector int)a, (vector int)b);\n}\n\n/* vec_vslo */\n\nstatic vector signed char __ATTRS_o_ai\nvec_vslo(vector signed char a, vector signed char b)\n{\n  return (vector signed char)\n           __builtin_altivec_vslo((vector int)a, (vector int)b);\n}\n\nstatic vector signed char __ATTRS_o_ai\nvec_vslo(vector signed char a, vector unsigned char b)\n{\n  return (vector signed char)\n           __builtin_altivec_vslo((vector int)a, (vector int)b);\n}\n\nstatic vector unsigned char __ATTRS_o_ai\nvec_vslo(vector unsigned char a, vector signed char b)\n{\n  return (vector unsigned char)\n           __builtin_altivec_vslo((vector int)a, (vector int)b);\n}\n\nstatic vector unsigned char __ATTRS_o_ai\nvec_vslo(vector unsigned char a, vector unsigned char b)\n{\n  return (vector unsigned char)\n           __builtin_altivec_vslo((vector int)a, (vector int)b);\n}\n\nstatic vector short __ATTRS_o_ai\nvec_vslo(vector short a, vector signed char b)\n{\n  return (vector short)__builtin_altivec_vslo((vector int)a, (vector int)b);\n}\n\nstatic vector short __ATTRS_o_ai\nvec_vslo(vector short a, vector unsigned char b)\n{\n  return (vector short)__builtin_altivec_vslo((vector int)a, (vector int)b);\n}\n\nstatic vector unsigned short __ATTRS_o_ai\nvec_vslo(vector unsigned short a, vector signed char b)\n{\n  return (vector unsigned short)\n           __builtin_altivec_vslo((vector int)a, (vector int)b);\n}\n\nstatic vector unsigned short __ATTRS_o_ai\nvec_vslo(vector unsigned short a, vector unsigned char b)\n{\n  return (vector unsigned short)\n           __builtin_altivec_vslo((vector int)a, (vector int)b);\n}\n\nstatic vector pixel __ATTRS_o_ai\nvec_vslo(vector pixel a, vector signed char b)\n{\n  return (vector pixel)__builtin_altivec_vslo((vector int)a, (vector int)b);\n}\n\nstatic vector pixel __ATTRS_o_ai\nvec_vslo(vector pixel a, vector unsigned char b)\n{\n  return (vector pixel)__builtin_altivec_vslo((vector int)a, (vector int)b);\n}\n\nstatic vector int __ATTRS_o_ai\nvec_vslo(vector int a, vector signed char b)\n{\n  return (vector int)__builtin_altivec_vslo(a, (vector int)b);\n}\n\nstatic vector int __ATTRS_o_ai\nvec_vslo(vector int a, vector unsigned char b)\n{\n  return (vector int)__builtin_altivec_vslo(a, (vector int)b);\n}\n\nstatic vector unsigned int __ATTRS_o_ai\nvec_vslo(vector unsigned int a, vector signed char b)\n{\n  return (vector unsigned int)\n           __builtin_altivec_vslo((vector int)a, (vector int)b);\n}\n\nstatic vector unsigned int __ATTRS_o_ai\nvec_vslo(vector unsigned int a, vector unsigned char b)\n{\n  return (vector unsigned int)\n           __builtin_altivec_vslo((vector int)a, (vector int)b);\n}\n\nstatic vector float __ATTRS_o_ai\nvec_vslo(vector float a, vector signed char b)\n{\n  return (vector float)__builtin_altivec_vslo((vector int)a, (vector int)b);\n}\n\nstatic vector float __ATTRS_o_ai\nvec_vslo(vector float a, vector unsigned char b)\n{\n  return (vector float)__builtin_altivec_vslo((vector int)a, (vector int)b);\n}\n\n/* vec_splat */\n\nstatic vector signed char __ATTRS_o_ai\nvec_splat(vector signed char a, unsigned char b)\n{\n  return vec_perm(a, a, (vector unsigned char)(b));\n}\n\nstatic vector unsigned char __ATTRS_o_ai\nvec_splat(vector unsigned char a, unsigned char b)\n{\n  return vec_perm(a, a, (vector unsigned char)(b));\n}\n\nstatic vector bool char __ATTRS_o_ai\nvec_splat(vector bool char a, unsigned char b)\n{\n  return vec_perm(a, a, (vector unsigned char)(b));\n}\n\nstatic vector short __ATTRS_o_ai\nvec_splat(vector short a, unsigned char b)\n{ \n  b *= 2;\n  unsigned char b1=b+1;\n  return vec_perm(a, a, (vector unsigned char)\n    (b, b1, b, b1, b, b1, b, b1, b, b1, b, b1, b, b1, b, b1));\n}\n\nstatic vector unsigned short __ATTRS_o_ai\nvec_splat(vector unsigned short a, unsigned char b)\n{ \n  b *= 2;\n  unsigned char b1=b+1;\n  return vec_perm(a, a, (vector unsigned char)\n    (b, b1, b, b1, b, b1, b, b1, b, b1, b, b1, b, b1, b, b1));\n}\n\nstatic vector bool short __ATTRS_o_ai\nvec_splat(vector bool short a, unsigned char b)\n{ \n  b *= 2;\n  unsigned char b1=b+1;\n  return vec_perm(a, a, (vector unsigned char)\n    (b, b1, b, b1, b, b1, b, b1, b, b1, b, b1, b, b1, b, b1));\n}\n\nstatic vector pixel __ATTRS_o_ai\nvec_splat(vector pixel a, unsigned char b)\n{ \n  b *= 2;\n  unsigned char b1=b+1;\n  return vec_perm(a, a, (vector unsigned char)\n    (b, b1, b, b1, b, b1, b, b1, b, b1, b, b1, b, b1, b, b1));\n}\n\nstatic vector int __ATTRS_o_ai\nvec_splat(vector int a, unsigned char b)\n{ \n  b *= 4;\n  unsigned char b1=b+1, b2=b+2, b3=b+3;\n  return vec_perm(a, a, (vector unsigned char)\n    (b, b1, b2, b3, b, b1, b2, b3, b, b1, b2, b3, b, b1, b2, b3));\n}\n\nstatic vector unsigned int __ATTRS_o_ai\nvec_splat(vector unsigned int a, unsigned char b)\n{ \n  b *= 4;\n  unsigned char b1=b+1, b2=b+2, b3=b+3;\n  return vec_perm(a, a, (vector unsigned char)\n    (b, b1, b2, b3, b, b1, b2, b3, b, b1, b2, b3, b, b1, b2, b3));\n}\n\nstatic vector bool int __ATTRS_o_ai\nvec_splat(vector bool int a, unsigned char b)\n{ \n  b *= 4;\n  unsigned char b1=b+1, b2=b+2, b3=b+3;\n  return vec_perm(a, a, (vector unsigned char)\n    (b, b1, b2, b3, b, b1, b2, b3, b, b1, b2, b3, b, b1, b2, b3));\n}\n\nstatic vector float __ATTRS_o_ai\nvec_splat(vector float a, unsigned char b)\n{ \n  b *= 4;\n  unsigned char b1=b+1, b2=b+2, b3=b+3;\n  return vec_perm(a, a, (vector unsigned char)\n    (b, b1, b2, b3, b, b1, b2, b3, b, b1, b2, b3, b, b1, b2, b3));\n}\n\n/* vec_vspltb */\n\n#define __builtin_altivec_vspltb vec_vspltb\n\nstatic vector signed char __ATTRS_o_ai\nvec_vspltb(vector signed char a, unsigned char b)\n{\n  return vec_perm(a, a, (vector unsigned char)(b));\n}\n\nstatic vector unsigned char __ATTRS_o_ai\nvec_vspltb(vector unsigned char a, unsigned char b)\n{\n  return vec_perm(a, a, (vector unsigned char)(b));\n}\n\nstatic vector bool char __ATTRS_o_ai\nvec_vspltb(vector bool char a, unsigned char b)\n{\n  return vec_perm(a, a, (vector unsigned char)(b));\n}\n\n/* vec_vsplth */\n\n#define __builtin_altivec_vsplth vec_vsplth\n\nstatic vector short __ATTRS_o_ai\nvec_vsplth(vector short a, unsigned char b)\n{\n  b *= 2;\n  unsigned char b1=b+1;\n  return vec_perm(a, a, (vector unsigned char)\n    (b, b1, b, b1, b, b1, b, b1, b, b1, b, b1, b, b1, b, b1));\n}\n\nstatic vector unsigned short __ATTRS_o_ai\nvec_vsplth(vector unsigned short a, unsigned char b)\n{\n  b *= 2;\n  unsigned char b1=b+1;\n  return vec_perm(a, a, (vector unsigned char)\n    (b, b1, b, b1, b, b1, b, b1, b, b1, b, b1, b, b1, b, b1));\n}\n\nstatic vector bool short __ATTRS_o_ai\nvec_vsplth(vector bool short a, unsigned char b)\n{\n  b *= 2;\n  unsigned char b1=b+1;\n  return vec_perm(a, a, (vector unsigned char)\n    (b, b1, b, b1, b, b1, b, b1, b, b1, b, b1, b, b1, b, b1));\n}\n\nstatic vector pixel __ATTRS_o_ai\nvec_vsplth(vector pixel a, unsigned char b)\n{\n  b *= 2;\n  unsigned char b1=b+1;\n  return vec_perm(a, a, (vector unsigned char)\n    (b, b1, b, b1, b, b1, b, b1, b, b1, b, b1, b, b1, b, b1));\n}\n\n/* vec_vspltw */\n\n#define __builtin_altivec_vspltw vec_vspltw\n\nstatic vector int __ATTRS_o_ai\nvec_vspltw(vector int a, unsigned char b)\n{\n  b *= 4;\n  unsigned char b1=b+1, b2=b+2, b3=b+3;\n  return vec_perm(a, a, (vector unsigned char)\n    (b, b1, b2, b3, b, b1, b2, b3, b, b1, b2, b3, b, b1, b2, b3));\n}\n\nstatic vector unsigned int __ATTRS_o_ai\nvec_vspltw(vector unsigned int a, unsigned char b)\n{\n  b *= 4;\n  unsigned char b1=b+1, b2=b+2, b3=b+3;\n  return vec_perm(a, a, (vector unsigned char)\n    (b, b1, b2, b3, b, b1, b2, b3, b, b1, b2, b3, b, b1, b2, b3));\n}\n\nstatic vector bool int __ATTRS_o_ai\nvec_vspltw(vector bool int a, unsigned char b)\n{\n  b *= 4;\n  unsigned char b1=b+1, b2=b+2, b3=b+3;\n  return vec_perm(a, a, (vector unsigned char)\n    (b, b1, b2, b3, b, b1, b2, b3, b, b1, b2, b3, b, b1, b2, b3));\n}\n\nstatic vector float __ATTRS_o_ai\nvec_vspltw(vector float a, unsigned char b)\n{\n  b *= 4;\n  unsigned char b1=b+1, b2=b+2, b3=b+3;\n  return vec_perm(a, a, (vector unsigned char)\n    (b, b1, b2, b3, b, b1, b2, b3, b, b1, b2, b3, b, b1, b2, b3));\n}\n\n/* vec_splat_s8 */\n\n#define __builtin_altivec_vspltisb vec_splat_s8\n\n// FIXME: parameter should be treated as 5-bit signed literal\nstatic vector signed char __ATTRS_o_ai\nvec_splat_s8(signed char a)\n{\n  return (vector signed char)(a);\n}\n\n/* vec_vspltisb */\n\n// FIXME: parameter should be treated as 5-bit signed literal\nstatic vector signed char __ATTRS_o_ai\nvec_vspltisb(signed char a)\n{\n  return (vector signed char)(a);\n}\n\n/* vec_splat_s16 */\n\n#define __builtin_altivec_vspltish vec_splat_s16\n\n// FIXME: parameter should be treated as 5-bit signed literal\nstatic vector short __ATTRS_o_ai\nvec_splat_s16(signed char a)\n{\n  return (vector short)(a);\n}\n\n/* vec_vspltish */\n\n// FIXME: parameter should be treated as 5-bit signed literal\nstatic vector short __ATTRS_o_ai\nvec_vspltish(signed char a)\n{\n  return (vector short)(a);\n}\n\n/* vec_splat_s32 */\n\n#define __builtin_altivec_vspltisw vec_splat_s32\n\n// FIXME: parameter should be treated as 5-bit signed literal\nstatic vector int __ATTRS_o_ai\nvec_splat_s32(signed char a)\n{\n  return (vector int)(a);\n}\n\n/* vec_vspltisw */\n\n// FIXME: parameter should be treated as 5-bit signed literal\nstatic vector int __ATTRS_o_ai\nvec_vspltisw(signed char a)\n{\n  return (vector int)(a);\n}\n\n/* vec_splat_u8 */\n\n// FIXME: parameter should be treated as 5-bit signed literal\nstatic vector unsigned char __ATTRS_o_ai\nvec_splat_u8(unsigned char a)\n{\n  return (vector unsigned char)(a);\n}\n\n/* vec_splat_u16 */\n\n// FIXME: parameter should be treated as 5-bit signed literal\nstatic vector unsigned short __ATTRS_o_ai\nvec_splat_u16(signed char a)\n{\n  return (vector unsigned short)(a);\n}\n\n/* vec_splat_u32 */\n\n// FIXME: parameter should be treated as 5-bit signed literal\nstatic vector unsigned int __ATTRS_o_ai\nvec_splat_u32(signed char a)\n{\n  return (vector unsigned int)(a);\n}\n\n/* vec_sr */\n\nstatic vector signed char __ATTRS_o_ai\nvec_sr(vector signed char a, vector unsigned char b)\n{\n  return a >> (vector signed char)b;\n}\n\nstatic vector unsigned char __ATTRS_o_ai\nvec_sr(vector unsigned char a, vector unsigned char b)\n{\n  return a >> b;\n}\n\nstatic vector short __ATTRS_o_ai\nvec_sr(vector short a, vector unsigned short b)\n{\n  return a >> (vector short)b;\n}\n\nstatic vector unsigned short __ATTRS_o_ai\nvec_sr(vector unsigned short a, vector unsigned short b)\n{\n  return a >> b;\n}\n\nstatic vector int __ATTRS_o_ai\nvec_sr(vector int a, vector unsigned int b)\n{\n  return a >> (vector int)b;\n}\n\nstatic vector unsigned int __ATTRS_o_ai\nvec_sr(vector unsigned int a, vector unsigned int b)\n{\n  return a >> b;\n}\n\n/* vec_vsrb */\n\n#define __builtin_altivec_vsrb vec_vsrb\n\nstatic vector signed char __ATTRS_o_ai\nvec_vsrb(vector signed char a, vector unsigned char b)\n{\n  return a >> (vector signed char)b;\n}\n\nstatic vector unsigned char __ATTRS_o_ai\nvec_vsrb(vector unsigned char a, vector unsigned char b)\n{\n  return a >> b;\n}\n\n/* vec_vsrh */\n\n#define __builtin_altivec_vsrh vec_vsrh\n\nstatic vector short __ATTRS_o_ai\nvec_vsrh(vector short a, vector unsigned short b)\n{\n  return a >> (vector short)b;\n}\n\nstatic vector unsigned short __ATTRS_o_ai\nvec_vsrh(vector unsigned short a, vector unsigned short b)\n{\n  return a >> b;\n}\n\n/* vec_vsrw */\n\n#define __builtin_altivec_vsrw vec_vsrw\n\nstatic vector int __ATTRS_o_ai\nvec_vsrw(vector int a, vector unsigned int b)\n{\n  return a >> (vector int)b;\n}\n\nstatic vector unsigned int __ATTRS_o_ai\nvec_vsrw(vector unsigned int a, vector unsigned int b)\n{\n  return a >> b;\n}\n\n/* vec_sra */\n\nstatic vector signed char __ATTRS_o_ai\nvec_sra(vector signed char a, vector unsigned char b)\n{\n  return (vector signed char)__builtin_altivec_vsrab((vector char)a, b);\n}\n\nstatic vector unsigned char __ATTRS_o_ai\nvec_sra(vector unsigned char a, vector unsigned char b)\n{\n  return (vector unsigned char)__builtin_altivec_vsrab((vector char)a, b);\n}\n\nstatic vector short __ATTRS_o_ai\nvec_sra(vector short a, vector unsigned short b)\n{\n  return __builtin_altivec_vsrah(a, (vector unsigned short)b);\n}\n\nstatic vector unsigned short __ATTRS_o_ai\nvec_sra(vector unsigned short a, vector unsigned short b)\n{\n  return (vector unsigned short)__builtin_altivec_vsrah((vector short)a, b);\n}\n\nstatic vector int __ATTRS_o_ai\nvec_sra(vector int a, vector unsigned int b)\n{\n  return __builtin_altivec_vsraw(a, b);\n}\n\nstatic vector unsigned int __ATTRS_o_ai\nvec_sra(vector unsigned int a, vector unsigned int b)\n{\n  return (vector unsigned int)__builtin_altivec_vsraw((vector int)a, b);\n}\n\n/* vec_vsrab */\n\nstatic vector signed char __ATTRS_o_ai\nvec_vsrab(vector signed char a, vector unsigned char b)\n{\n  return (vector signed char)__builtin_altivec_vsrab((vector char)a, b);\n}\n\nstatic vector unsigned char __ATTRS_o_ai\nvec_vsrab(vector unsigned char a, vector unsigned char b)\n{\n  return (vector unsigned char)__builtin_altivec_vsrab((vector char)a, b);\n}\n\n/* vec_vsrah */\n\nstatic vector short __ATTRS_o_ai\nvec_vsrah(vector short a, vector unsigned short b)\n{\n  return __builtin_altivec_vsrah(a, (vector unsigned short)b);\n}\n\nstatic vector unsigned short __ATTRS_o_ai\nvec_vsrah(vector unsigned short a, vector unsigned short b)\n{\n  return (vector unsigned short)__builtin_altivec_vsrah((vector short)a, b);\n}\n\n/* vec_vsraw */\n\nstatic vector int __ATTRS_o_ai\nvec_vsraw(vector int a, vector unsigned int b)\n{\n  return __builtin_altivec_vsraw(a, b);\n}\n\nstatic vector unsigned int __ATTRS_o_ai\nvec_vsraw(vector unsigned int a, vector unsigned int b)\n{\n  return (vector unsigned int)__builtin_altivec_vsraw((vector int)a, b);\n}\n\n/* vec_srl */\n\nstatic vector signed char __ATTRS_o_ai\nvec_srl(vector signed char a, vector unsigned char b)\n{\n  return (vector signed char)\n           __builtin_altivec_vsr((vector int)a, (vector int)b);\n}\n\nstatic vector signed char __ATTRS_o_ai\nvec_srl(vector signed char a, vector unsigned short b)\n{\n  return (vector signed char)\n           __builtin_altivec_vsr((vector int)a, (vector int)b);\n}\n\nstatic vector signed char __ATTRS_o_ai\nvec_srl(vector signed char a, vector unsigned int b)\n{\n  return (vector signed char)\n           __builtin_altivec_vsr((vector int)a, (vector int)b);\n}\n\nstatic vector unsigned char __ATTRS_o_ai\nvec_srl(vector unsigned char a, vector unsigned char b)\n{\n  return (vector unsigned char)\n           __builtin_altivec_vsr((vector int)a, (vector int)b);\n}\n\nstatic vector unsigned char __ATTRS_o_ai\nvec_srl(vector unsigned char a, vector unsigned short b)\n{\n  return (vector unsigned char)\n           __builtin_altivec_vsr((vector int)a, (vector int)b);\n}\n\nstatic vector unsigned char __ATTRS_o_ai\nvec_srl(vector unsigned char a, vector unsigned int b)\n{\n  return (vector unsigned char)\n           __builtin_altivec_vsr((vector int)a, (vector int)b);\n}\n\nstatic vector bool char __ATTRS_o_ai\nvec_srl(vector bool char a, vector unsigned char b)\n{\n  return (vector bool char)__builtin_altivec_vsr((vector int)a, (vector int)b);\n}\n\nstatic vector bool char __ATTRS_o_ai\nvec_srl(vector bool char a, vector unsigned short b)\n{\n  return (vector bool char)__builtin_altivec_vsr((vector int)a, (vector int)b);\n}\n\nstatic vector bool char __ATTRS_o_ai\nvec_srl(vector bool char a, vector unsigned int b)\n{\n  return (vector bool char)__builtin_altivec_vsr((vector int)a, (vector int)b);\n}\n\nstatic vector short __ATTRS_o_ai\nvec_srl(vector short a, vector unsigned char b)\n{\n  return (vector short)__builtin_altivec_vsr((vector int)a, (vector int)b);\n}\n\nstatic vector short __ATTRS_o_ai\nvec_srl(vector short a, vector unsigned short b)\n{\n  return (vector short)__builtin_altivec_vsr((vector int)a, (vector int)b);\n}\n\nstatic vector short __ATTRS_o_ai\nvec_srl(vector short a, vector unsigned int b)\n{\n  return (vector short)__builtin_altivec_vsr((vector int)a, (vector int)b);\n}\n\nstatic vector unsigned short __ATTRS_o_ai\nvec_srl(vector unsigned short a, vector unsigned char b)\n{\n  return (vector unsigned short)\n           __builtin_altivec_vsr((vector int)a, (vector int)b);\n}\n\nstatic vector unsigned short __ATTRS_o_ai\nvec_srl(vector unsigned short a, vector unsigned short b)\n{\n  return (vector unsigned short)\n           __builtin_altivec_vsr((vector int)a, (vector int)b);\n}\n\nstatic vector unsigned short __ATTRS_o_ai\nvec_srl(vector unsigned short a, vector unsigned int b)\n{\n  return (vector unsigned short)\n           __builtin_altivec_vsr((vector int)a, (vector int)b);\n}\n\nstatic vector bool short __ATTRS_o_ai\nvec_srl(vector bool short a, vector unsigned char b)\n{\n  return (vector bool short)__builtin_altivec_vsr((vector int)a, (vector int)b);\n}\n\nstatic vector bool short __ATTRS_o_ai\nvec_srl(vector bool short a, vector unsigned short b)\n{\n  return (vector bool short)__builtin_altivec_vsr((vector int)a, (vector int)b);\n}\n\nstatic vector bool short __ATTRS_o_ai\nvec_srl(vector bool short a, vector unsigned int b)\n{\n  return (vector bool short)__builtin_altivec_vsr((vector int)a, (vector int)b);\n}\n\nstatic vector pixel __ATTRS_o_ai\nvec_srl(vector pixel a, vector unsigned char b)\n{\n  return (vector pixel)__builtin_altivec_vsr((vector int)a, (vector int)b);\n}\n\nstatic vector pixel __ATTRS_o_ai\nvec_srl(vector pixel a, vector unsigned short b)\n{\n  return (vector pixel)__builtin_altivec_vsr((vector int)a, (vector int)b);\n}\n\nstatic vector pixel __ATTRS_o_ai\nvec_srl(vector pixel a, vector unsigned int b)\n{\n  return (vector pixel)__builtin_altivec_vsr((vector int)a, (vector int)b);\n}\n\nstatic vector int __ATTRS_o_ai\nvec_srl(vector int a, vector unsigned char b)\n{\n  return (vector int)__builtin_altivec_vsr(a, (vector int)b);\n}\n\nstatic vector int __ATTRS_o_ai\nvec_srl(vector int a, vector unsigned short b)\n{\n  return (vector int)__builtin_altivec_vsr(a, (vector int)b);\n}\n\nstatic vector int __ATTRS_o_ai\nvec_srl(vector int a, vector unsigned int b)\n{\n  return (vector int)__builtin_altivec_vsr(a, (vector int)b);\n}\n\nstatic vector unsigned int __ATTRS_o_ai\nvec_srl(vector unsigned int a, vector unsigned char b)\n{\n  return (vector unsigned int)\n           __builtin_altivec_vsr((vector int)a, (vector int)b);\n}\n\nstatic vector unsigned int __ATTRS_o_ai\nvec_srl(vector unsigned int a, vector unsigned short b)\n{\n  return (vector unsigned int)\n           __builtin_altivec_vsr((vector int)a, (vector int)b);\n}\n\nstatic vector unsigned int __ATTRS_o_ai\nvec_srl(vector unsigned int a, vector unsigned int b)\n{\n  return (vector unsigned int)\n           __builtin_altivec_vsr((vector int)a, (vector int)b);\n}\n\nstatic vector bool int __ATTRS_o_ai\nvec_srl(vector bool int a, vector unsigned char b)\n{\n  return (vector bool int)__builtin_altivec_vsr((vector int)a, (vector int)b);\n}\n\nstatic vector bool int __ATTRS_o_ai\nvec_srl(vector bool int a, vector unsigned short b)\n{\n  return (vector bool int)__builtin_altivec_vsr((vector int)a, (vector int)b);\n}\n\nstatic vector bool int __ATTRS_o_ai\nvec_srl(vector bool int a, vector unsigned int b)\n{\n  return (vector bool int)__builtin_altivec_vsr((vector int)a, (vector int)b);\n}\n\n/* vec_vsr */\n\nstatic vector signed char __ATTRS_o_ai\nvec_vsr(vector signed char a, vector unsigned char b)\n{\n  return (vector signed char)\n           __builtin_altivec_vsr((vector int)a, (vector int)b);\n}\n\nstatic vector signed char __ATTRS_o_ai\nvec_vsr(vector signed char a, vector unsigned short b)\n{\n  return (vector signed char)\n           __builtin_altivec_vsr((vector int)a, (vector int)b);\n}\n\nstatic vector signed char __ATTRS_o_ai\nvec_vsr(vector signed char a, vector unsigned int b)\n{\n  return (vector signed char)\n           __builtin_altivec_vsr((vector int)a, (vector int)b);\n}\n\nstatic vector unsigned char __ATTRS_o_ai\nvec_vsr(vector unsigned char a, vector unsigned char b)\n{\n  return (vector unsigned char)\n           __builtin_altivec_vsr((vector int)a, (vector int)b);\n}\n\nstatic vector unsigned char __ATTRS_o_ai\nvec_vsr(vector unsigned char a, vector unsigned short b)\n{\n  return (vector unsigned char)\n           __builtin_altivec_vsr((vector int)a, (vector int)b);\n}\n\nstatic vector unsigned char __ATTRS_o_ai\nvec_vsr(vector unsigned char a, vector unsigned int b)\n{\n  return (vector unsigned char)\n           __builtin_altivec_vsr((vector int)a, (vector int)b);\n}\n\nstatic vector bool char __ATTRS_o_ai\nvec_vsr(vector bool char a, vector unsigned char b)\n{\n  return (vector bool char)__builtin_altivec_vsr((vector int)a, (vector int)b);\n}\n\nstatic vector bool char __ATTRS_o_ai\nvec_vsr(vector bool char a, vector unsigned short b)\n{\n  return (vector bool char)__builtin_altivec_vsr((vector int)a, (vector int)b);\n}\n\nstatic vector bool char __ATTRS_o_ai\nvec_vsr(vector bool char a, vector unsigned int b)\n{\n  return (vector bool char)__builtin_altivec_vsr((vector int)a, (vector int)b);\n}\n\nstatic vector short __ATTRS_o_ai\nvec_vsr(vector short a, vector unsigned char b)\n{\n  return (vector short)__builtin_altivec_vsr((vector int)a, (vector int)b);\n}\n\nstatic vector short __ATTRS_o_ai\nvec_vsr(vector short a, vector unsigned short b)\n{\n  return (vector short)__builtin_altivec_vsr((vector int)a, (vector int)b);\n}\n\nstatic vector short __ATTRS_o_ai\nvec_vsr(vector short a, vector unsigned int b)\n{\n  return (vector short)__builtin_altivec_vsr((vector int)a, (vector int)b);\n}\n\nstatic vector unsigned short __ATTRS_o_ai\nvec_vsr(vector unsigned short a, vector unsigned char b)\n{\n  return (vector unsigned short)\n           __builtin_altivec_vsr((vector int)a, (vector int)b);\n}\n\nstatic vector unsigned short __ATTRS_o_ai\nvec_vsr(vector unsigned short a, vector unsigned short b)\n{\n  return (vector unsigned short)\n           __builtin_altivec_vsr((vector int)a, (vector int)b);\n}\n\nstatic vector unsigned short __ATTRS_o_ai\nvec_vsr(vector unsigned short a, vector unsigned int b)\n{\n  return (vector unsigned short)\n           __builtin_altivec_vsr((vector int)a, (vector int)b);\n}\n\nstatic vector bool short __ATTRS_o_ai\nvec_vsr(vector bool short a, vector unsigned char b)\n{\n  return (vector bool short)__builtin_altivec_vsr((vector int)a, (vector int)b);\n}\n\nstatic vector bool short __ATTRS_o_ai\nvec_vsr(vector bool short a, vector unsigned short b)\n{\n  return (vector bool short)__builtin_altivec_vsr((vector int)a, (vector int)b);\n}\n\nstatic vector bool short __ATTRS_o_ai\nvec_vsr(vector bool short a, vector unsigned int b)\n{\n  return (vector bool short)__builtin_altivec_vsr((vector int)a, (vector int)b);\n}\n\nstatic vector pixel __ATTRS_o_ai\nvec_vsr(vector pixel a, vector unsigned char b)\n{\n  return (vector pixel)__builtin_altivec_vsr((vector int)a, (vector int)b);\n}\n\nstatic vector pixel __ATTRS_o_ai\nvec_vsr(vector pixel a, vector unsigned short b)\n{\n  return (vector pixel)__builtin_altivec_vsr((vector int)a, (vector int)b);\n}\n\nstatic vector pixel __ATTRS_o_ai\nvec_vsr(vector pixel a, vector unsigned int b)\n{\n  return (vector pixel)__builtin_altivec_vsr((vector int)a, (vector int)b);\n}\n\nstatic vector int __ATTRS_o_ai\nvec_vsr(vector int a, vector unsigned char b)\n{\n  return (vector int)__builtin_altivec_vsr(a, (vector int)b);\n}\n\nstatic vector int __ATTRS_o_ai\nvec_vsr(vector int a, vector unsigned short b)\n{\n  return (vector int)__builtin_altivec_vsr(a, (vector int)b);\n}\n\nstatic vector int __ATTRS_o_ai\nvec_vsr(vector int a, vector unsigned int b)\n{\n  return (vector int)__builtin_altivec_vsr(a, (vector int)b);\n}\n\nstatic vector unsigned int __ATTRS_o_ai\nvec_vsr(vector unsigned int a, vector unsigned char b)\n{\n  return (vector unsigned int)\n           __builtin_altivec_vsr((vector int)a, (vector int)b);\n}\n\nstatic vector unsigned int __ATTRS_o_ai\nvec_vsr(vector unsigned int a, vector unsigned short b)\n{\n  return (vector unsigned int)\n           __builtin_altivec_vsr((vector int)a, (vector int)b);\n}\n\nstatic vector unsigned int __ATTRS_o_ai\nvec_vsr(vector unsigned int a, vector unsigned int b)\n{\n  return (vector unsigned int)\n           __builtin_altivec_vsr((vector int)a, (vector int)b);\n}\n\nstatic vector bool int __ATTRS_o_ai\nvec_vsr(vector bool int a, vector unsigned char b)\n{\n  return (vector bool int)__builtin_altivec_vsr((vector int)a, (vector int)b);\n}\n\nstatic vector bool int __ATTRS_o_ai\nvec_vsr(vector bool int a, vector unsigned short b)\n{\n  return (vector bool int)__builtin_altivec_vsr((vector int)a, (vector int)b);\n}\n\nstatic vector bool int __ATTRS_o_ai\nvec_vsr(vector bool int a, vector unsigned int b)\n{\n  return (vector bool int)__builtin_altivec_vsr((vector int)a, (vector int)b);\n}\n\n/* vec_sro */\n\nstatic vector signed char __ATTRS_o_ai\nvec_sro(vector signed char a, vector signed char b)\n{\n  return (vector signed char)\n           __builtin_altivec_vsro((vector int)a, (vector int)b);\n}\n\nstatic vector signed char __ATTRS_o_ai\nvec_sro(vector signed char a, vector unsigned char b)\n{\n  return (vector signed char)\n           __builtin_altivec_vsro((vector int)a, (vector int)b);\n}\n\nstatic vector unsigned char __ATTRS_o_ai\nvec_sro(vector unsigned char a, vector signed char b)\n{\n  return (vector unsigned char)\n           __builtin_altivec_vsro((vector int)a, (vector int)b);\n}\n\nstatic vector unsigned char __ATTRS_o_ai\nvec_sro(vector unsigned char a, vector unsigned char b)\n{\n  return (vector unsigned char)\n           __builtin_altivec_vsro((vector int)a, (vector int)b);\n}\n\nstatic vector short __ATTRS_o_ai\nvec_sro(vector short a, vector signed char b)\n{\n  return (vector short)__builtin_altivec_vsro((vector int)a, (vector int)b);\n}\n\nstatic vector short __ATTRS_o_ai\nvec_sro(vector short a, vector unsigned char b)\n{\n  return (vector short)__builtin_altivec_vsro((vector int)a, (vector int)b);\n}\n\nstatic vector unsigned short __ATTRS_o_ai\nvec_sro(vector unsigned short a, vector signed char b)\n{\n  return (vector unsigned short)\n           __builtin_altivec_vsro((vector int)a, (vector int)b);\n}\n\nstatic vector unsigned short __ATTRS_o_ai\nvec_sro(vector unsigned short a, vector unsigned char b)\n{\n  return (vector unsigned short)\n           __builtin_altivec_vsro((vector int)a, (vector int)b);\n}\n\nstatic vector pixel __ATTRS_o_ai\nvec_sro(vector pixel a, vector signed char b)\n{\n  return (vector pixel)__builtin_altivec_vsro((vector int)a, (vector int)b);\n}\n\nstatic vector pixel __ATTRS_o_ai\nvec_sro(vector pixel a, vector unsigned char b)\n{\n  return (vector pixel)__builtin_altivec_vsro((vector int)a, (vector int)b);\n}\n\nstatic vector int __ATTRS_o_ai\nvec_sro(vector int a, vector signed char b)\n{\n  return (vector int)__builtin_altivec_vsro(a, (vector int)b);\n}\n\nstatic vector int __ATTRS_o_ai\nvec_sro(vector int a, vector unsigned char b)\n{\n  return (vector int)__builtin_altivec_vsro(a, (vector int)b);\n}\n\nstatic vector unsigned int __ATTRS_o_ai\nvec_sro(vector unsigned int a, vector signed char b)\n{\n  return (vector unsigned int)\n           __builtin_altivec_vsro((vector int)a, (vector int)b);\n}\n\nstatic vector unsigned int __ATTRS_o_ai\nvec_sro(vector unsigned int a, vector unsigned char b)\n{\n  return (vector unsigned int)\n           __builtin_altivec_vsro((vector int)a, (vector int)b);\n}\n\nstatic vector float __ATTRS_o_ai\nvec_sro(vector float a, vector signed char b)\n{\n  return (vector float)__builtin_altivec_vsro((vector int)a, (vector int)b);\n}\n\nstatic vector float __ATTRS_o_ai\nvec_sro(vector float a, vector unsigned char b)\n{\n  return (vector float)__builtin_altivec_vsro((vector int)a, (vector int)b);\n}\n\n/* vec_vsro */\n\nstatic vector signed char __ATTRS_o_ai\nvec_vsro(vector signed char a, vector signed char b)\n{\n  return (vector signed char)\n           __builtin_altivec_vsro((vector int)a, (vector int)b);\n}\n\nstatic vector signed char __ATTRS_o_ai\nvec_vsro(vector signed char a, vector unsigned char b)\n{\n  return (vector signed char)\n           __builtin_altivec_vsro((vector int)a, (vector int)b);\n}\n\nstatic vector unsigned char __ATTRS_o_ai\nvec_vsro(vector unsigned char a, vector signed char b)\n{\n  return (vector unsigned char)\n           __builtin_altivec_vsro((vector int)a, (vector int)b);\n}\n\nstatic vector unsigned char __ATTRS_o_ai\nvec_vsro(vector unsigned char a, vector unsigned char b)\n{\n  return (vector unsigned char)\n           __builtin_altivec_vsro((vector int)a, (vector int)b);\n}\n\nstatic vector short __ATTRS_o_ai\nvec_vsro(vector short a, vector signed char b)\n{\n  return (vector short)__builtin_altivec_vsro((vector int)a, (vector int)b);\n}\n\nstatic vector short __ATTRS_o_ai\nvec_vsro(vector short a, vector unsigned char b)\n{\n  return (vector short)__builtin_altivec_vsro((vector int)a, (vector int)b);\n}\n\nstatic vector unsigned short __ATTRS_o_ai\nvec_vsro(vector unsigned short a, vector signed char b)\n{\n  return (vector unsigned short)\n           __builtin_altivec_vsro((vector int)a, (vector int)b);\n}\n\nstatic vector unsigned short __ATTRS_o_ai\nvec_vsro(vector unsigned short a, vector unsigned char b)\n{\n  return (vector unsigned short)\n           __builtin_altivec_vsro((vector int)a, (vector int)b);\n}\n\nstatic vector pixel __ATTRS_o_ai\nvec_vsro(vector pixel a, vector signed char b)\n{\n  return (vector pixel)__builtin_altivec_vsro((vector int)a, (vector int)b);\n}\n\nstatic vector pixel __ATTRS_o_ai\nvec_vsro(vector pixel a, vector unsigned char b)\n{\n  return (vector pixel)__builtin_altivec_vsro((vector int)a, (vector int)b);\n}\n\nstatic vector int __ATTRS_o_ai\nvec_vsro(vector int a, vector signed char b)\n{\n  return (vector int)__builtin_altivec_vsro(a, (vector int)b);\n}\n\nstatic vector int __ATTRS_o_ai\nvec_vsro(vector int a, vector unsigned char b)\n{\n  return (vector int)__builtin_altivec_vsro(a, (vector int)b);\n}\n\nstatic vector unsigned int __ATTRS_o_ai\nvec_vsro(vector unsigned int a, vector signed char b)\n{\n  return (vector unsigned int)\n           __builtin_altivec_vsro((vector int)a, (vector int)b);\n}\n\nstatic vector unsigned int __ATTRS_o_ai\nvec_vsro(vector unsigned int a, vector unsigned char b)\n{\n  return (vector unsigned int)\n           __builtin_altivec_vsro((vector int)a, (vector int)b);\n}\n\nstatic vector float __ATTRS_o_ai\nvec_vsro(vector float a, vector signed char b)\n{\n  return (vector float)__builtin_altivec_vsro((vector int)a, (vector int)b);\n}\n\nstatic vector float __ATTRS_o_ai\nvec_vsro(vector float a, vector unsigned char b)\n{\n  return (vector float)__builtin_altivec_vsro((vector int)a, (vector int)b);\n}\n\n/* vec_st */\n\nstatic void __ATTRS_o_ai\nvec_st(vector signed char a, int b, vector signed char *c)\n{\n  __builtin_altivec_stvx((vector int)a, b, c);\n}\n\nstatic void __ATTRS_o_ai\nvec_st(vector signed char a, int b, signed char *c)\n{\n  __builtin_altivec_stvx((vector int)a, b, c);\n}\n\nstatic void __ATTRS_o_ai\nvec_st(vector unsigned char a, int b, vector unsigned char *c)\n{\n  __builtin_altivec_stvx((vector int)a, b, c);\n}\n\nstatic void __ATTRS_o_ai\nvec_st(vector unsigned char a, int b, unsigned char *c)\n{\n  __builtin_altivec_stvx((vector int)a, b, c);\n}\n\nstatic void __ATTRS_o_ai\nvec_st(vector bool char a, int b, signed char *c)\n{\n  __builtin_altivec_stvx((vector int)a, b, c);\n}\n\nstatic void __ATTRS_o_ai\nvec_st(vector bool char a, int b, unsigned char *c)\n{\n  __builtin_altivec_stvx((vector int)a, b, c);\n}\n\nstatic void __ATTRS_o_ai\nvec_st(vector bool char a, int b, vector bool char *c)\n{\n  __builtin_altivec_stvx((vector int)a, b, c);\n}\n\nstatic void __ATTRS_o_ai\nvec_st(vector short a, int b, vector short *c)\n{\n  __builtin_altivec_stvx((vector int)a, b, c);\n}\n\nstatic void __ATTRS_o_ai\nvec_st(vector short a, int b, short *c)\n{\n  __builtin_altivec_stvx((vector int)a, b, c);\n}\n\nstatic void __ATTRS_o_ai\nvec_st(vector unsigned short a, int b, vector unsigned short *c)\n{\n  __builtin_altivec_stvx((vector int)a, b, c);\n}\n\nstatic void __ATTRS_o_ai\nvec_st(vector unsigned short a, int b, unsigned short *c)\n{\n  __builtin_altivec_stvx((vector int)a, b, c);\n}\n\nstatic void __ATTRS_o_ai\nvec_st(vector bool short a, int b, short *c)\n{\n  __builtin_altivec_stvx((vector int)a, b, c);\n}\n\nstatic void __ATTRS_o_ai\nvec_st(vector bool short a, int b, unsigned short *c)\n{\n  __builtin_altivec_stvx((vector int)a, b, c);\n}\n\nstatic void __ATTRS_o_ai\nvec_st(vector bool short a, int b, vector bool short *c)\n{\n  __builtin_altivec_stvx((vector int)a, b, c);\n}\n\nstatic void __ATTRS_o_ai\nvec_st(vector pixel a, int b, short *c)\n{\n  __builtin_altivec_stvx((vector int)a, b, c);\n}\n\nstatic void __ATTRS_o_ai\nvec_st(vector pixel a, int b, unsigned short *c)\n{\n  __builtin_altivec_stvx((vector int)a, b, c);\n}\n\nstatic void __ATTRS_o_ai\nvec_st(vector pixel a, int b, vector pixel *c)\n{\n  __builtin_altivec_stvx((vector int)a, b, c);\n}\n\nstatic void __ATTRS_o_ai\nvec_st(vector int a, int b, vector int *c)\n{\n  __builtin_altivec_stvx(a, b, c);\n}\n\nstatic void __ATTRS_o_ai\nvec_st(vector int a, int b, int *c)\n{\n  __builtin_altivec_stvx(a, b, c);\n}\n\nstatic void __ATTRS_o_ai\nvec_st(vector unsigned int a, int b, vector unsigned int *c)\n{\n  __builtin_altivec_stvx((vector int)a, b, c);\n}\n\nstatic void __ATTRS_o_ai\nvec_st(vector unsigned int a, int b, unsigned int *c)\n{\n  __builtin_altivec_stvx((vector int)a, b, c);\n}\n\nstatic void __ATTRS_o_ai\nvec_st(vector bool int a, int b, int *c)\n{\n  __builtin_altivec_stvx((vector int)a, b, c);\n}\n\nstatic void __ATTRS_o_ai\nvec_st(vector bool int a, int b, unsigned int *c)\n{\n  __builtin_altivec_stvx((vector int)a, b, c);\n}\n\nstatic void __ATTRS_o_ai\nvec_st(vector bool int a, int b, vector bool int *c)\n{\n  __builtin_altivec_stvx((vector int)a, b, c);\n}\n\nstatic void __ATTRS_o_ai\nvec_st(vector float a, int b, vector float *c)\n{\n  __builtin_altivec_stvx((vector int)a, b, c);\n}\n\nstatic void __ATTRS_o_ai\nvec_st(vector float a, int b, float *c)\n{\n  __builtin_altivec_stvx((vector int)a, b, c);\n}\n\n/* vec_stvx */\n\nstatic void __ATTRS_o_ai\nvec_stvx(vector signed char a, int b, vector signed char *c)\n{\n  __builtin_altivec_stvx((vector int)a, b, c);\n}\n\nstatic void __ATTRS_o_ai\nvec_stvx(vector signed char a, int b, signed char *c)\n{\n  __builtin_altivec_stvx((vector int)a, b, c);\n}\n\nstatic void __ATTRS_o_ai\nvec_stvx(vector unsigned char a, int b, vector unsigned char *c)\n{\n  __builtin_altivec_stvx((vector int)a, b, c);\n}\n\nstatic void __ATTRS_o_ai\nvec_stvx(vector unsigned char a, int b, unsigned char *c)\n{\n  __builtin_altivec_stvx((vector int)a, b, c);\n}\n\nstatic void __ATTRS_o_ai\nvec_stvx(vector bool char a, int b, signed char *c)\n{\n  __builtin_altivec_stvx((vector int)a, b, c);\n}\n\nstatic void __ATTRS_o_ai\nvec_stvx(vector bool char a, int b, unsigned char *c)\n{\n  __builtin_altivec_stvx((vector int)a, b, c);\n}\n\nstatic void __ATTRS_o_ai\nvec_stvx(vector bool char a, int b, vector bool char *c)\n{\n  __builtin_altivec_stvx((vector int)a, b, c);\n}\n\nstatic void __ATTRS_o_ai\nvec_stvx(vector short a, int b, vector short *c)\n{\n  __builtin_altivec_stvx((vector int)a, b, c);\n}\n\nstatic void __ATTRS_o_ai\nvec_stvx(vector short a, int b, short *c)\n{\n  __builtin_altivec_stvx((vector int)a, b, c);\n}\n\nstatic void __ATTRS_o_ai\nvec_stvx(vector unsigned short a, int b, vector unsigned short *c)\n{\n  __builtin_altivec_stvx((vector int)a, b, c);\n}\n\nstatic void __ATTRS_o_ai\nvec_stvx(vector unsigned short a, int b, unsigned short *c)\n{\n  __builtin_altivec_stvx((vector int)a, b, c);\n}\n\nstatic void __ATTRS_o_ai\nvec_stvx(vector bool short a, int b, short *c)\n{\n  __builtin_altivec_stvx((vector int)a, b, c);\n}\n\nstatic void __ATTRS_o_ai\nvec_stvx(vector bool short a, int b, unsigned short *c)\n{\n  __builtin_altivec_stvx((vector int)a, b, c);\n}\n\nstatic void __ATTRS_o_ai\nvec_stvx(vector bool short a, int b, vector bool short *c)\n{\n  __builtin_altivec_stvx((vector int)a, b, c);\n}\n\nstatic void __ATTRS_o_ai\nvec_stvx(vector pixel a, int b, short *c)\n{\n  __builtin_altivec_stvx((vector int)a, b, c);\n}\n\nstatic void __ATTRS_o_ai\nvec_stvx(vector pixel a, int b, unsigned short *c)\n{\n  __builtin_altivec_stvx((vector int)a, b, c);\n}\n\nstatic void __ATTRS_o_ai\nvec_stvx(vector pixel a, int b, vector pixel *c)\n{\n  __builtin_altivec_stvx((vector int)a, b, c);\n}\n\nstatic void __ATTRS_o_ai\nvec_stvx(vector int a, int b, vector int *c)\n{\n  __builtin_altivec_stvx(a, b, c);\n}\n\nstatic void __ATTRS_o_ai\nvec_stvx(vector int a, int b, int *c)\n{\n  __builtin_altivec_stvx(a, b, c);\n}\n\nstatic void __ATTRS_o_ai\nvec_stvx(vector unsigned int a, int b, vector unsigned int *c)\n{\n  __builtin_altivec_stvx((vector int)a, b, c);\n}\n\nstatic void __ATTRS_o_ai\nvec_stvx(vector unsigned int a, int b, unsigned int *c)\n{\n  __builtin_altivec_stvx((vector int)a, b, c);\n}\n\nstatic void __ATTRS_o_ai\nvec_stvx(vector bool int a, int b, int *c)\n{\n  __builtin_altivec_stvx((vector int)a, b, c);\n}\n\nstatic void __ATTRS_o_ai\nvec_stvx(vector bool int a, int b, unsigned int *c)\n{\n  __builtin_altivec_stvx((vector int)a, b, c);\n}\n\nstatic void __ATTRS_o_ai\nvec_stvx(vector bool int a, int b, vector bool int *c)\n{\n  __builtin_altivec_stvx((vector int)a, b, c);\n}\n\nstatic void __ATTRS_o_ai\nvec_stvx(vector float a, int b, vector float *c)\n{\n  __builtin_altivec_stvx((vector int)a, b, c);\n}\n\nstatic void __ATTRS_o_ai\nvec_stvx(vector float a, int b, float *c)\n{\n  __builtin_altivec_stvx((vector int)a, b, c);\n}\n\n/* vec_ste */\n\nstatic void __ATTRS_o_ai\nvec_ste(vector signed char a, int b, signed char *c)\n{\n  __builtin_altivec_stvebx((vector char)a, b, c);\n}\n\nstatic void __ATTRS_o_ai\nvec_ste(vector unsigned char a, int b, unsigned char *c)\n{\n  __builtin_altivec_stvebx((vector char)a, b, c);\n}\n\nstatic void __ATTRS_o_ai\nvec_ste(vector bool char a, int b, signed char *c)\n{\n  __builtin_altivec_stvebx((vector char)a, b, c);\n}\n\nstatic void __ATTRS_o_ai\nvec_ste(vector bool char a, int b, unsigned char *c)\n{\n  __builtin_altivec_stvebx((vector char)a, b, c);\n}\n\nstatic void __ATTRS_o_ai\nvec_ste(vector short a, int b, short *c)\n{\n  __builtin_altivec_stvehx(a, b, c);\n}\n\nstatic void __ATTRS_o_ai\nvec_ste(vector unsigned short a, int b, unsigned short *c)\n{\n  __builtin_altivec_stvehx((vector short)a, b, c);\n}\n\nstatic void __ATTRS_o_ai\nvec_ste(vector bool short a, int b, short *c)\n{\n  __builtin_altivec_stvehx((vector short)a, b, c);\n}\n\nstatic void __ATTRS_o_ai\nvec_ste(vector bool short a, int b, unsigned short *c)\n{\n  __builtin_altivec_stvehx((vector short)a, b, c);\n}\n\nstatic void __ATTRS_o_ai\nvec_ste(vector pixel a, int b, short *c)\n{\n  __builtin_altivec_stvehx((vector short)a, b, c);\n}\n\nstatic void __ATTRS_o_ai\nvec_ste(vector pixel a, int b, unsigned short *c)\n{\n  __builtin_altivec_stvehx((vector short)a, b, c);\n}\n\nstatic void __ATTRS_o_ai\nvec_ste(vector int a, int b, int *c)\n{\n  __builtin_altivec_stvewx(a, b, c);\n}\n\nstatic void __ATTRS_o_ai\nvec_ste(vector unsigned int a, int b, unsigned int *c)\n{\n  __builtin_altivec_stvewx((vector int)a, b, c);\n}\n\nstatic void __ATTRS_o_ai\nvec_ste(vector bool int a, int b, int *c)\n{\n  __builtin_altivec_stvewx((vector int)a, b, c);\n}\n\nstatic void __ATTRS_o_ai\nvec_ste(vector bool int a, int b, unsigned int *c)\n{\n  __builtin_altivec_stvewx((vector int)a, b, c);\n}\n\nstatic void __ATTRS_o_ai\nvec_ste(vector float a, int b, float *c)\n{\n  __builtin_altivec_stvewx((vector int)a, b, c);\n}\n\n/* vec_stvebx */\n\nstatic void __ATTRS_o_ai\nvec_stvebx(vector signed char a, int b, signed char *c)\n{\n  __builtin_altivec_stvebx((vector char)a, b, c);\n}\n\nstatic void __ATTRS_o_ai\nvec_stvebx(vector unsigned char a, int b, unsigned char *c)\n{\n  __builtin_altivec_stvebx((vector char)a, b, c);\n}\n\nstatic void __ATTRS_o_ai\nvec_stvebx(vector bool char a, int b, signed char *c)\n{\n  __builtin_altivec_stvebx((vector char)a, b, c);\n}\n\nstatic void __ATTRS_o_ai\nvec_stvebx(vector bool char a, int b, unsigned char *c)\n{\n  __builtin_altivec_stvebx((vector char)a, b, c);\n}\n\n/* vec_stvehx */\n\nstatic void __ATTRS_o_ai\nvec_stvehx(vector short a, int b, short *c)\n{\n  __builtin_altivec_stvehx(a, b, c);\n}\n\nstatic void __ATTRS_o_ai\nvec_stvehx(vector unsigned short a, int b, unsigned short *c)\n{\n  __builtin_altivec_stvehx((vector short)a, b, c);\n}\n\nstatic void __ATTRS_o_ai\nvec_stvehx(vector bool short a, int b, short *c)\n{\n  __builtin_altivec_stvehx((vector short)a, b, c);\n}\n\nstatic void __ATTRS_o_ai\nvec_stvehx(vector bool short a, int b, unsigned short *c)\n{\n  __builtin_altivec_stvehx((vector short)a, b, c);\n}\n\nstatic void __ATTRS_o_ai\nvec_stvehx(vector pixel a, int b, short *c)\n{\n  __builtin_altivec_stvehx((vector short)a, b, c);\n}\n\nstatic void __ATTRS_o_ai\nvec_stvehx(vector pixel a, int b, unsigned short *c)\n{\n  __builtin_altivec_stvehx((vector short)a, b, c);\n}\n\n/* vec_stvewx */\n\nstatic void __ATTRS_o_ai\nvec_stvewx(vector int a, int b, int *c)\n{\n  __builtin_altivec_stvewx(a, b, c);\n}\n\nstatic void __ATTRS_o_ai\nvec_stvewx(vector unsigned int a, int b, unsigned int *c)\n{\n  __builtin_altivec_stvewx((vector int)a, b, c);\n}\n\nstatic void __ATTRS_o_ai\nvec_stvewx(vector bool int a, int b, int *c)\n{\n  __builtin_altivec_stvewx((vector int)a, b, c);\n}\n\nstatic void __ATTRS_o_ai\nvec_stvewx(vector bool int a, int b, unsigned int *c)\n{\n  __builtin_altivec_stvewx((vector int)a, b, c);\n}\n\nstatic void __ATTRS_o_ai\nvec_stvewx(vector float a, int b, float *c)\n{\n  __builtin_altivec_stvewx((vector int)a, b, c);\n}\n\n/* vec_stl */\n\nstatic void __ATTRS_o_ai\nvec_stl(vector signed char a, int b, vector signed char *c)\n{\n  __builtin_altivec_stvxl((vector int)a, b, c);\n}\n\nstatic void __ATTRS_o_ai\nvec_stl(vector signed char a, int b, signed char *c)\n{\n  __builtin_altivec_stvxl((vector int)a, b, c);\n}\n\nstatic void __ATTRS_o_ai\nvec_stl(vector unsigned char a, int b, vector unsigned char *c)\n{\n  __builtin_altivec_stvxl((vector int)a, b, c);\n}\n\nstatic void __ATTRS_o_ai\nvec_stl(vector unsigned char a, int b, unsigned char *c)\n{\n  __builtin_altivec_stvxl((vector int)a, b, c);\n}\n\nstatic void __ATTRS_o_ai\nvec_stl(vector bool char a, int b, signed char *c)\n{\n  __builtin_altivec_stvxl((vector int)a, b, c);\n}\n\nstatic void __ATTRS_o_ai\nvec_stl(vector bool char a, int b, unsigned char *c)\n{\n  __builtin_altivec_stvxl((vector int)a, b, c);\n}\n\nstatic void __ATTRS_o_ai\nvec_stl(vector bool char a, int b, vector bool char *c)\n{\n  __builtin_altivec_stvxl((vector int)a, b, c);\n}\n\nstatic void __ATTRS_o_ai\nvec_stl(vector short a, int b, vector short *c)\n{\n  __builtin_altivec_stvxl((vector int)a, b, c);\n}\n\nstatic void __ATTRS_o_ai\nvec_stl(vector short a, int b, short *c)\n{\n  __builtin_altivec_stvxl((vector int)a, b, c);\n}\n\nstatic void __ATTRS_o_ai\nvec_stl(vector unsigned short a, int b, vector unsigned short *c)\n{\n  __builtin_altivec_stvxl((vector int)a, b, c);\n}\n\nstatic void __ATTRS_o_ai\nvec_stl(vector unsigned short a, int b, unsigned short *c)\n{\n  __builtin_altivec_stvxl((vector int)a, b, c);\n}\n\nstatic void __ATTRS_o_ai\nvec_stl(vector bool short a, int b, short *c)\n{\n  __builtin_altivec_stvxl((vector int)a, b, c);\n}\n\nstatic void __ATTRS_o_ai\nvec_stl(vector bool short a, int b, unsigned short *c)\n{\n  __builtin_altivec_stvxl((vector int)a, b, c);\n}\n\nstatic void __ATTRS_o_ai\nvec_stl(vector bool short a, int b, vector bool short *c)\n{\n  __builtin_altivec_stvxl((vector int)a, b, c);\n}\n\nstatic void __ATTRS_o_ai\nvec_stl(vector pixel a, int b, short *c)\n{\n  __builtin_altivec_stvxl((vector int)a, b, c);\n}\n\nstatic void __ATTRS_o_ai\nvec_stl(vector pixel a, int b, unsigned short *c)\n{\n  __builtin_altivec_stvxl((vector int)a, b, c);\n}\n\nstatic void __ATTRS_o_ai\nvec_stl(vector pixel a, int b, vector pixel *c)\n{\n  __builtin_altivec_stvxl((vector int)a, b, c);\n}\n\nstatic void __ATTRS_o_ai\nvec_stl(vector int a, int b, vector int *c)\n{\n  __builtin_altivec_stvxl(a, b, c);\n}\n\nstatic void __ATTRS_o_ai\nvec_stl(vector int a, int b, int *c)\n{\n  __builtin_altivec_stvxl(a, b, c);\n}\n\nstatic void __ATTRS_o_ai\nvec_stl(vector unsigned int a, int b, vector unsigned int *c)\n{\n  __builtin_altivec_stvxl((vector int)a, b, c);\n}\n\nstatic void __ATTRS_o_ai\nvec_stl(vector unsigned int a, int b, unsigned int *c)\n{\n  __builtin_altivec_stvxl((vector int)a, b, c);\n}\n\nstatic void __ATTRS_o_ai\nvec_stl(vector bool int a, int b, int *c)\n{\n  __builtin_altivec_stvxl((vector int)a, b, c);\n}\n\nstatic void __ATTRS_o_ai\nvec_stl(vector bool int a, int b, unsigned int *c)\n{\n  __builtin_altivec_stvxl((vector int)a, b, c);\n}\n\nstatic void __ATTRS_o_ai\nvec_stl(vector bool int a, int b, vector bool int *c)\n{\n  __builtin_altivec_stvxl((vector int)a, b, c);\n}\n\nstatic void __ATTRS_o_ai\nvec_stl(vector float a, int b, vector float *c)\n{\n  __builtin_altivec_stvxl((vector int)a, b, c);\n}\n\nstatic void __ATTRS_o_ai\nvec_stl(vector float a, int b, float *c)\n{\n  __builtin_altivec_stvxl((vector int)a, b, c);\n}\n\n/* vec_stvxl */\n\nstatic void __ATTRS_o_ai\nvec_stvxl(vector signed char a, int b, vector signed char *c)\n{\n  __builtin_altivec_stvxl((vector int)a, b, c);\n}\n\nstatic void __ATTRS_o_ai\nvec_stvxl(vector signed char a, int b, signed char *c)\n{\n  __builtin_altivec_stvxl((vector int)a, b, c);\n}\n\nstatic void __ATTRS_o_ai\nvec_stvxl(vector unsigned char a, int b, vector unsigned char *c)\n{\n  __builtin_altivec_stvxl((vector int)a, b, c);\n}\n\nstatic void __ATTRS_o_ai\nvec_stvxl(vector unsigned char a, int b, unsigned char *c)\n{\n  __builtin_altivec_stvxl((vector int)a, b, c);\n}\n\nstatic void __ATTRS_o_ai\nvec_stvxl(vector bool char a, int b, signed char *c)\n{\n  __builtin_altivec_stvxl((vector int)a, b, c);\n}\n\nstatic void __ATTRS_o_ai\nvec_stvxl(vector bool char a, int b, unsigned char *c)\n{\n  __builtin_altivec_stvxl((vector int)a, b, c);\n}\n\nstatic void __ATTRS_o_ai\nvec_stvxl(vector bool char a, int b, vector bool char *c)\n{\n  __builtin_altivec_stvxl((vector int)a, b, c);\n}\n\nstatic void __ATTRS_o_ai\nvec_stvxl(vector short a, int b, vector short *c)\n{\n  __builtin_altivec_stvxl((vector int)a, b, c);\n}\n\nstatic void __ATTRS_o_ai\nvec_stvxl(vector short a, int b, short *c)\n{\n  __builtin_altivec_stvxl((vector int)a, b, c);\n}\n\nstatic void __ATTRS_o_ai\nvec_stvxl(vector unsigned short a, int b, vector unsigned short *c)\n{\n  __builtin_altivec_stvxl((vector int)a, b, c);\n}\n\nstatic void __ATTRS_o_ai\nvec_stvxl(vector unsigned short a, int b, unsigned short *c)\n{\n  __builtin_altivec_stvxl((vector int)a, b, c);\n}\n\nstatic void __ATTRS_o_ai\nvec_stvxl(vector bool short a, int b, short *c)\n{\n  __builtin_altivec_stvxl((vector int)a, b, c);\n}\n\nstatic void __ATTRS_o_ai\nvec_stvxl(vector bool short a, int b, unsigned short *c)\n{\n  __builtin_altivec_stvxl((vector int)a, b, c);\n}\n\nstatic void __ATTRS_o_ai\nvec_stvxl(vector bool short a, int b, vector bool short *c)\n{\n  __builtin_altivec_stvxl((vector int)a, b, c);\n}\n\nstatic void __ATTRS_o_ai\nvec_stvxl(vector pixel a, int b, short *c)\n{\n  __builtin_altivec_stvxl((vector int)a, b, c);\n}\n\nstatic void __ATTRS_o_ai\nvec_stvxl(vector pixel a, int b, unsigned short *c)\n{\n  __builtin_altivec_stvxl((vector int)a, b, c);\n}\n\nstatic void __ATTRS_o_ai\nvec_stvxl(vector pixel a, int b, vector pixel *c)\n{\n  __builtin_altivec_stvxl((vector int)a, b, c);\n}\n\nstatic void __ATTRS_o_ai\nvec_stvxl(vector int a, int b, vector int *c)\n{\n  __builtin_altivec_stvxl(a, b, c);\n}\n\nstatic void __ATTRS_o_ai\nvec_stvxl(vector int a, int b, int *c)\n{\n  __builtin_altivec_stvxl(a, b, c);\n}\n\nstatic void __ATTRS_o_ai\nvec_stvxl(vector unsigned int a, int b, vector unsigned int *c)\n{\n  __builtin_altivec_stvxl((vector int)a, b, c);\n}\n\nstatic void __ATTRS_o_ai\nvec_stvxl(vector unsigned int a, int b, unsigned int *c)\n{\n  __builtin_altivec_stvxl((vector int)a, b, c);\n}\n\nstatic void __ATTRS_o_ai\nvec_stvxl(vector bool int a, int b, int *c)\n{\n  __builtin_altivec_stvxl((vector int)a, b, c);\n}\n\nstatic void __ATTRS_o_ai\nvec_stvxl(vector bool int a, int b, unsigned int *c)\n{\n  __builtin_altivec_stvxl((vector int)a, b, c);\n}\n\nstatic void __ATTRS_o_ai\nvec_stvxl(vector bool int a, int b, vector bool int *c)\n{\n  __builtin_altivec_stvxl((vector int)a, b, c);\n}\n\nstatic void __ATTRS_o_ai\nvec_stvxl(vector float a, int b, vector float *c)\n{\n  __builtin_altivec_stvxl((vector int)a, b, c);\n}\n\nstatic void __ATTRS_o_ai\nvec_stvxl(vector float a, int b, float *c)\n{\n  __builtin_altivec_stvxl((vector int)a, b, c);\n}\n\n/* vec_sub */\n\nstatic vector signed char __ATTRS_o_ai\nvec_sub(vector signed char a, vector signed char b)\n{\n  return a - b;\n}\n\nstatic vector signed char __ATTRS_o_ai\nvec_sub(vector bool char a, vector signed char b)\n{\n  return (vector signed char)a - b;\n}\n\nstatic vector signed char __ATTRS_o_ai\nvec_sub(vector signed char a, vector bool char b)\n{\n  return a - (vector signed char)b;\n}\n\nstatic vector unsigned char __ATTRS_o_ai\nvec_sub(vector unsigned char a, vector unsigned char b)\n{\n  return a - b;\n}\n\nstatic vector unsigned char __ATTRS_o_ai\nvec_sub(vector bool char a, vector unsigned char b)\n{\n  return (vector unsigned char)a - b;\n}\n\nstatic vector unsigned char __ATTRS_o_ai\nvec_sub(vector unsigned char a, vector bool char b)\n{\n  return a - (vector unsigned char)b;\n}\n\nstatic vector short __ATTRS_o_ai\nvec_sub(vector short a, vector short b)\n{\n  return a - b;\n}\n\nstatic vector short __ATTRS_o_ai\nvec_sub(vector bool short a, vector short b)\n{\n  return (vector short)a - b;\n}\n\nstatic vector short __ATTRS_o_ai\nvec_sub(vector short a, vector bool short b)\n{\n  return a - (vector short)b;\n}\n\nstatic vector unsigned short __ATTRS_o_ai\nvec_sub(vector unsigned short a, vector unsigned short b)\n{\n  return a - b;\n}\n\nstatic vector unsigned short __ATTRS_o_ai\nvec_sub(vector bool short a, vector unsigned short b)\n{\n  return (vector unsigned short)a - b;\n}\n\nstatic vector unsigned short __ATTRS_o_ai\nvec_sub(vector unsigned short a, vector bool short b)\n{\n  return a - (vector unsigned short)b;\n}\n\nstatic vector int __ATTRS_o_ai\nvec_sub(vector int a, vector int b)\n{\n  return a - b;\n}\n\nstatic vector int __ATTRS_o_ai\nvec_sub(vector bool int a, vector int b)\n{\n  return (vector int)a - b;\n}\n\nstatic vector int __ATTRS_o_ai\nvec_sub(vector int a, vector bool int b)\n{\n  return a - (vector int)b;\n}\n\nstatic vector unsigned int __ATTRS_o_ai\nvec_sub(vector unsigned int a, vector unsigned int b)\n{\n  return a - b;\n}\n\nstatic vector unsigned int __ATTRS_o_ai\nvec_sub(vector bool int a, vector unsigned int b)\n{\n  return (vector unsigned int)a - b;\n}\n\nstatic vector unsigned int __ATTRS_o_ai\nvec_sub(vector unsigned int a, vector bool int b)\n{\n  return a - (vector unsigned int)b;\n}\n\nstatic vector float __ATTRS_o_ai\nvec_sub(vector float a, vector float b)\n{\n  return a - b;\n}\n\n/* vec_vsububm */\n\n#define __builtin_altivec_vsububm vec_vsububm\n\nstatic vector signed char __ATTRS_o_ai\nvec_vsububm(vector signed char a, vector signed char b)\n{\n  return a - b;\n}\n\nstatic vector signed char __ATTRS_o_ai\nvec_vsububm(vector bool char a, vector signed char b)\n{\n  return (vector signed char)a - b;\n}\n\nstatic vector signed char __ATTRS_o_ai\nvec_vsububm(vector signed char a, vector bool char b)\n{\n  return a - (vector signed char)b;\n}\n\nstatic vector unsigned char __ATTRS_o_ai\nvec_vsububm(vector unsigned char a, vector unsigned char b)\n{\n  return a - b;\n}\n\nstatic vector unsigned char __ATTRS_o_ai\nvec_vsububm(vector bool char a, vector unsigned char b)\n{\n  return (vector unsigned char)a - b;\n}\n\nstatic vector unsigned char __ATTRS_o_ai\nvec_vsububm(vector unsigned char a, vector bool char b)\n{\n  return a - (vector unsigned char)b;\n}\n\n/* vec_vsubuhm */\n\n#define __builtin_altivec_vsubuhm vec_vsubuhm\n\nstatic vector short __ATTRS_o_ai\nvec_vsubuhm(vector short a, vector short b)\n{\n  return a - b;\n}\n\nstatic vector short __ATTRS_o_ai\nvec_vsubuhm(vector bool short a, vector short b)\n{\n  return (vector short)a - b;\n}\n\nstatic vector short __ATTRS_o_ai\nvec_vsubuhm(vector short a, vector bool short b)\n{\n  return a - (vector short)b;\n}\n\nstatic vector unsigned short __ATTRS_o_ai\nvec_vsubuhm(vector unsigned short a, vector unsigned short b)\n{\n  return a - b;\n}\n\nstatic vector unsigned short __ATTRS_o_ai\nvec_vsubuhm(vector bool short a, vector unsigned short b)\n{\n  return (vector unsigned short)a - b;\n}\n\nstatic vector unsigned short __ATTRS_o_ai\nvec_vsubuhm(vector unsigned short a, vector bool short b)\n{\n  return a - (vector unsigned short)b;\n}\n\n/* vec_vsubuwm */\n\n#define __builtin_altivec_vsubuwm vec_vsubuwm\n\nstatic vector int __ATTRS_o_ai\nvec_vsubuwm(vector int a, vector int b)\n{\n  return a - b;\n}\n\nstatic vector int __ATTRS_o_ai\nvec_vsubuwm(vector bool int a, vector int b)\n{\n  return (vector int)a - b;\n}\n\nstatic vector int __ATTRS_o_ai\nvec_vsubuwm(vector int a, vector bool int b)\n{\n  return a - (vector int)b;\n}\n\nstatic vector unsigned int __ATTRS_o_ai\nvec_vsubuwm(vector unsigned int a, vector unsigned int b)\n{\n  return a - b;\n}\n\nstatic vector unsigned int __ATTRS_o_ai\nvec_vsubuwm(vector bool int a, vector unsigned int b)\n{\n  return (vector unsigned int)a - b;\n}\n\nstatic vector unsigned int __ATTRS_o_ai\nvec_vsubuwm(vector unsigned int a, vector bool int b)\n{\n  return a - (vector unsigned int)b;\n}\n\n/* vec_vsubfp */\n\n#define __builtin_altivec_vsubfp vec_vsubfp\n\nstatic vector float __attribute__((__always_inline__))\nvec_vsubfp(vector float a, vector float b)\n{\n  return a - b;\n}\n\n/* vec_subc */\n\nstatic vector unsigned int __attribute__((__always_inline__))\nvec_subc(vector unsigned int a, vector unsigned int b)\n{\n  return __builtin_altivec_vsubcuw(a, b);\n}\n\n/* vec_vsubcuw */\n\nstatic vector unsigned int __attribute__((__always_inline__))\nvec_vsubcuw(vector unsigned int a, vector unsigned int b)\n{\n  return __builtin_altivec_vsubcuw(a, b);\n}\n\n/* vec_subs */\n\nstatic vector signed char __ATTRS_o_ai\nvec_subs(vector signed char a, vector signed char b)\n{\n  return __builtin_altivec_vsubsbs(a, b);\n}\n\nstatic vector signed char __ATTRS_o_ai\nvec_subs(vector bool char a, vector signed char b)\n{\n  return __builtin_altivec_vsubsbs((vector signed char)a, b);\n}\n\nstatic vector signed char __ATTRS_o_ai\nvec_subs(vector signed char a, vector bool char b)\n{\n  return __builtin_altivec_vsubsbs(a, (vector signed char)b);\n}\n\nstatic vector unsigned char __ATTRS_o_ai\nvec_subs(vector unsigned char a, vector unsigned char b)\n{\n  return __builtin_altivec_vsububs(a, b);\n}\n\nstatic vector unsigned char __ATTRS_o_ai\nvec_subs(vector bool char a, vector unsigned char b)\n{\n  return __builtin_altivec_vsububs((vector unsigned char)a, b);\n}\n\nstatic vector unsigned char __ATTRS_o_ai\nvec_subs(vector unsigned char a, vector bool char b)\n{\n  return __builtin_altivec_vsububs(a, (vector unsigned char)b);\n}\n\nstatic vector short __ATTRS_o_ai\nvec_subs(vector short a, vector short b)\n{\n  return __builtin_altivec_vsubshs(a, b);\n}\n\nstatic vector short __ATTRS_o_ai\nvec_subs(vector bool short a, vector short b)\n{\n  return __builtin_altivec_vsubshs((vector short)a, b);\n}\n\nstatic vector short __ATTRS_o_ai\nvec_subs(vector short a, vector bool short b)\n{\n  return __builtin_altivec_vsubshs(a, (vector short)b);\n}\n\nstatic vector unsigned short __ATTRS_o_ai\nvec_subs(vector unsigned short a, vector unsigned short b)\n{\n  return __builtin_altivec_vsubuhs(a, b);\n}\n\nstatic vector unsigned short __ATTRS_o_ai\nvec_subs(vector bool short a, vector unsigned short b)\n{\n  return __builtin_altivec_vsubuhs((vector unsigned short)a, b);\n}\n\nstatic vector unsigned short __ATTRS_o_ai\nvec_subs(vector unsigned short a, vector bool short b)\n{\n  return __builtin_altivec_vsubuhs(a, (vector unsigned short)b);\n}\n\nstatic vector int __ATTRS_o_ai\nvec_subs(vector int a, vector int b)\n{\n  return __builtin_altivec_vsubsws(a, b);\n}\n\nstatic vector int __ATTRS_o_ai\nvec_subs(vector bool int a, vector int b)\n{\n  return __builtin_altivec_vsubsws((vector int)a, b);\n}\n\nstatic vector int __ATTRS_o_ai\nvec_subs(vector int a, vector bool int b)\n{\n  return __builtin_altivec_vsubsws(a, (vector int)b);\n}\n\nstatic vector unsigned int __ATTRS_o_ai\nvec_subs(vector unsigned int a, vector unsigned int b)\n{\n  return __builtin_altivec_vsubuws(a, b);\n}\n\nstatic vector unsigned int __ATTRS_o_ai\nvec_subs(vector bool int a, vector unsigned int b)\n{\n  return __builtin_altivec_vsubuws((vector unsigned int)a, b);\n}\n\nstatic vector unsigned int __ATTRS_o_ai\nvec_subs(vector unsigned int a, vector bool int b)\n{\n  return __builtin_altivec_vsubuws(a, (vector unsigned int)b);\n}\n\n/* vec_vsubsbs */\n\nstatic vector signed char __ATTRS_o_ai\nvec_vsubsbs(vector signed char a, vector signed char b)\n{\n  return __builtin_altivec_vsubsbs(a, b);\n}\n\nstatic vector signed char __ATTRS_o_ai\nvec_vsubsbs(vector bool char a, vector signed char b)\n{\n  return __builtin_altivec_vsubsbs((vector signed char)a, b);\n}\n\nstatic vector signed char __ATTRS_o_ai\nvec_vsubsbs(vector signed char a, vector bool char b)\n{\n  return __builtin_altivec_vsubsbs(a, (vector signed char)b);\n}\n\n/* vec_vsububs */\n\nstatic vector unsigned char __ATTRS_o_ai\nvec_vsububs(vector unsigned char a, vector unsigned char b)\n{\n  return __builtin_altivec_vsububs(a, b);\n}\n\nstatic vector unsigned char __ATTRS_o_ai\nvec_vsububs(vector bool char a, vector unsigned char b)\n{\n  return __builtin_altivec_vsububs((vector unsigned char)a, b);\n}\n\nstatic vector unsigned char __ATTRS_o_ai\nvec_vsububs(vector unsigned char a, vector bool char b)\n{\n  return __builtin_altivec_vsububs(a, (vector unsigned char)b);\n}\n\n/* vec_vsubshs */\n\nstatic vector short __ATTRS_o_ai\nvec_vsubshs(vector short a, vector short b)\n{\n  return __builtin_altivec_vsubshs(a, b);\n}\n\nstatic vector short __ATTRS_o_ai\nvec_vsubshs(vector bool short a, vector short b)\n{\n  return __builtin_altivec_vsubshs((vector short)a, b);\n}\n\nstatic vector short __ATTRS_o_ai\nvec_vsubshs(vector short a, vector bool short b)\n{\n  return __builtin_altivec_vsubshs(a, (vector short)b);\n}\n\n/* vec_vsubuhs */\n\nstatic vector unsigned short __ATTRS_o_ai\nvec_vsubuhs(vector unsigned short a, vector unsigned short b)\n{\n  return __builtin_altivec_vsubuhs(a, b);\n}\n\nstatic vector unsigned short __ATTRS_o_ai\nvec_vsubuhs(vector bool short a, vector unsigned short b)\n{\n  return __builtin_altivec_vsubuhs((vector unsigned short)a, b);\n}\n\nstatic vector unsigned short __ATTRS_o_ai\nvec_vsubuhs(vector unsigned short a, vector bool short b)\n{\n  return __builtin_altivec_vsubuhs(a, (vector unsigned short)b);\n}\n\n/* vec_vsubsws */\n\nstatic vector int __ATTRS_o_ai\nvec_vsubsws(vector int a, vector int b)\n{\n  return __builtin_altivec_vsubsws(a, b);\n}\n\nstatic vector int __ATTRS_o_ai\nvec_vsubsws(vector bool int a, vector int b)\n{\n  return __builtin_altivec_vsubsws((vector int)a, b);\n}\n\nstatic vector int __ATTRS_o_ai\nvec_vsubsws(vector int a, vector bool int b)\n{\n  return __builtin_altivec_vsubsws(a, (vector int)b);\n}\n\n/* vec_vsubuws */\n\nstatic vector unsigned int __ATTRS_o_ai\nvec_vsubuws(vector unsigned int a, vector unsigned int b)\n{\n  return __builtin_altivec_vsubuws(a, b);\n}\n\nstatic vector unsigned int __ATTRS_o_ai\nvec_vsubuws(vector bool int a, vector unsigned int b)\n{\n  return __builtin_altivec_vsubuws((vector unsigned int)a, b);\n}\n\nstatic vector unsigned int __ATTRS_o_ai\nvec_vsubuws(vector unsigned int a, vector bool int b)\n{\n  return __builtin_altivec_vsubuws(a, (vector unsigned int)b);\n}\n\n/* vec_sum4s */\n\nstatic vector int __ATTRS_o_ai\nvec_sum4s(vector signed char a, vector int b)\n{\n  return __builtin_altivec_vsum4sbs(a, b);\n}\n\nstatic vector unsigned int __ATTRS_o_ai\nvec_sum4s(vector unsigned char a, vector unsigned int b)\n{\n  return __builtin_altivec_vsum4ubs(a, b);\n}\n\nstatic vector int __ATTRS_o_ai\nvec_sum4s(vector signed short a, vector int b)\n{\n  return __builtin_altivec_vsum4shs(a, b);\n}\n\n/* vec_vsum4sbs */\n\nstatic vector int __attribute__((__always_inline__))\nvec_vsum4sbs(vector signed char a, vector int b)\n{\n  return __builtin_altivec_vsum4sbs(a, b);\n}\n\n/* vec_vsum4ubs */\n\nstatic vector unsigned int __attribute__((__always_inline__))\nvec_vsum4ubs(vector unsigned char a, vector unsigned int b)\n{\n  return __builtin_altivec_vsum4ubs(a, b);\n}\n\n/* vec_vsum4shs */\n\nstatic vector int __attribute__((__always_inline__))\nvec_vsum4shs(vector signed short a, vector int b)\n{\n  return __builtin_altivec_vsum4shs(a, b);\n}\n\n/* vec_sum2s */\n\nstatic vector signed int __attribute__((__always_inline__))\nvec_sum2s(vector int a, vector int b)\n{\n  return __builtin_altivec_vsum2sws(a, b);\n}\n\n/* vec_vsum2sws */\n\nstatic vector signed int __attribute__((__always_inline__))\nvec_vsum2sws(vector int a, vector int b)\n{\n  return __builtin_altivec_vsum2sws(a, b);\n}\n\n/* vec_sums */\n\nstatic vector signed int __attribute__((__always_inline__))\nvec_sums(vector signed int a, vector signed int b)\n{\n  return __builtin_altivec_vsumsws(a, b);\n}\n\n/* vec_vsumsws */\n\nstatic vector signed int __attribute__((__always_inline__))\nvec_vsumsws(vector signed int a, vector signed int b)\n{\n  return __builtin_altivec_vsumsws(a, b);\n}\n\n/* vec_trunc */\n\nstatic vector float __attribute__((__always_inline__))\nvec_trunc(vector float a)\n{\n  return __builtin_altivec_vrfiz(a);\n}\n\n/* vec_vrfiz */\n\nstatic vector float __attribute__((__always_inline__))\nvec_vrfiz(vector float a)\n{\n  return __builtin_altivec_vrfiz(a);\n}\n\n/* vec_unpackh */\n\nstatic vector short __ATTRS_o_ai\nvec_unpackh(vector signed char a)\n{\n  return __builtin_altivec_vupkhsb((vector char)a);\n}\n\nstatic vector bool short __ATTRS_o_ai\nvec_unpackh(vector bool char a)\n{\n  return (vector bool short)__builtin_altivec_vupkhsb((vector char)a);\n}\n\nstatic vector int __ATTRS_o_ai\nvec_unpackh(vector short a)\n{\n  return __builtin_altivec_vupkhsh(a);\n}\n\nstatic vector bool int __ATTRS_o_ai\nvec_unpackh(vector bool short a)\n{\n  return (vector bool int)__builtin_altivec_vupkhsh((vector short)a);\n}\n\nstatic vector unsigned int __ATTRS_o_ai\nvec_unpackh(vector pixel a)\n{\n  return (vector unsigned int)__builtin_altivec_vupkhsh((vector short)a);\n}\n\n/* vec_vupkhsb */\n\nstatic vector short __ATTRS_o_ai\nvec_vupkhsb(vector signed char a)\n{\n  return __builtin_altivec_vupkhsb((vector char)a);\n}\n\nstatic vector bool short __ATTRS_o_ai\nvec_vupkhsb(vector bool char a)\n{\n  return (vector bool short)__builtin_altivec_vupkhsb((vector char)a);\n}\n\n/* vec_vupkhsh */\n\nstatic vector int __ATTRS_o_ai\nvec_vupkhsh(vector short a)\n{\n  return __builtin_altivec_vupkhsh(a);\n}\n\nstatic vector bool int __ATTRS_o_ai\nvec_vupkhsh(vector bool short a)\n{\n  return (vector bool int)__builtin_altivec_vupkhsh((vector short)a);\n}\n\nstatic vector unsigned int __ATTRS_o_ai\nvec_vupkhsh(vector pixel a)\n{\n  return (vector unsigned int)__builtin_altivec_vupkhsh((vector short)a);\n}\n\n/* vec_unpackl */\n\nstatic vector short __ATTRS_o_ai\nvec_unpackl(vector signed char a)\n{\n  return __builtin_altivec_vupklsb((vector char)a);\n}\n\nstatic vector bool short __ATTRS_o_ai\nvec_unpackl(vector bool char a)\n{\n  return (vector bool short)__builtin_altivec_vupklsb((vector char)a);\n}\n\nstatic vector int __ATTRS_o_ai\nvec_unpackl(vector short a)\n{\n  return __builtin_altivec_vupklsh(a);\n}\n\nstatic vector bool int __ATTRS_o_ai\nvec_unpackl(vector bool short a)\n{\n  return (vector bool int)__builtin_altivec_vupklsh((vector short)a);\n}\n\nstatic vector unsigned int __ATTRS_o_ai\nvec_unpackl(vector pixel a)\n{\n  return (vector unsigned int)__builtin_altivec_vupklsh((vector short)a);\n}\n\n/* vec_vupklsb */\n\nstatic vector short __ATTRS_o_ai\nvec_vupklsb(vector signed char a)\n{\n  return __builtin_altivec_vupklsb((vector char)a);\n}\n\nstatic vector bool short __ATTRS_o_ai\nvec_vupklsb(vector bool char a)\n{\n  return (vector bool short)__builtin_altivec_vupklsb((vector char)a);\n}\n\n/* vec_vupklsh */\n\nstatic vector int __ATTRS_o_ai\nvec_vupklsh(vector short a)\n{\n  return __builtin_altivec_vupklsh(a);\n}\n\nstatic vector bool int __ATTRS_o_ai\nvec_vupklsh(vector bool short a)\n{\n  return (vector bool int)__builtin_altivec_vupklsh((vector short)a);\n}\n\nstatic vector unsigned int __ATTRS_o_ai\nvec_vupklsh(vector pixel a)\n{\n  return (vector unsigned int)__builtin_altivec_vupklsh((vector short)a);\n}\n\n/* vec_xor */\n\n#define __builtin_altivec_vxor vec_xor\n\nstatic vector signed char __ATTRS_o_ai\nvec_xor(vector signed char a, vector signed char b)\n{\n  return a ^ b;\n}\n\nstatic vector signed char __ATTRS_o_ai\nvec_xor(vector bool char a, vector signed char b)\n{\n  return (vector signed char)a ^ b;\n}\n\nstatic vector signed char __ATTRS_o_ai\nvec_xor(vector signed char a, vector bool char b)\n{\n  return a ^ (vector signed char)b;\n}\n\nstatic vector unsigned char __ATTRS_o_ai\nvec_xor(vector unsigned char a, vector unsigned char b)\n{\n  return a ^ b;\n}\n\nstatic vector unsigned char __ATTRS_o_ai\nvec_xor(vector bool char a, vector unsigned char b)\n{\n  return (vector unsigned char)a ^ b;\n}\n\nstatic vector unsigned char __ATTRS_o_ai\nvec_xor(vector unsigned char a, vector bool char b)\n{\n  return a ^ (vector unsigned char)b;\n}\n\nstatic vector bool char __ATTRS_o_ai\nvec_xor(vector bool char a, vector bool char b)\n{\n  return a ^ b;\n}\n\nstatic vector short __ATTRS_o_ai\nvec_xor(vector short a, vector short b)\n{\n  return a ^ b;\n}\n\nstatic vector short __ATTRS_o_ai\nvec_xor(vector bool short a, vector short b)\n{\n  return (vector short)a ^ b;\n}\n\nstatic vector short __ATTRS_o_ai\nvec_xor(vector short a, vector bool short b)\n{\n  return a ^ (vector short)b;\n}\n\nstatic vector unsigned short __ATTRS_o_ai\nvec_xor(vector unsigned short a, vector unsigned short b)\n{\n  return a ^ b;\n}\n\nstatic vector unsigned short __ATTRS_o_ai\nvec_xor(vector bool short a, vector unsigned short b)\n{\n  return (vector unsigned short)a ^ b;\n}\n\nstatic vector unsigned short __ATTRS_o_ai\nvec_xor(vector unsigned short a, vector bool short b)\n{\n  return a ^ (vector unsigned short)b;\n}\n\nstatic vector bool short __ATTRS_o_ai\nvec_xor(vector bool short a, vector bool short b)\n{\n  return a ^ b;\n}\n\nstatic vector int __ATTRS_o_ai\nvec_xor(vector int a, vector int b)\n{\n  return a ^ b;\n}\n\nstatic vector int __ATTRS_o_ai\nvec_xor(vector bool int a, vector int b)\n{\n  return (vector int)a ^ b;\n}\n\nstatic vector int __ATTRS_o_ai\nvec_xor(vector int a, vector bool int b)\n{\n  return a ^ (vector int)b;\n}\n\nstatic vector unsigned int __ATTRS_o_ai\nvec_xor(vector unsigned int a, vector unsigned int b)\n{\n  return a ^ b;\n}\n\nstatic vector unsigned int __ATTRS_o_ai\nvec_xor(vector bool int a, vector unsigned int b)\n{\n  return (vector unsigned int)a ^ b;\n}\n\nstatic vector unsigned int __ATTRS_o_ai\nvec_xor(vector unsigned int a, vector bool int b)\n{\n  return a ^ (vector unsigned int)b;\n}\n\nstatic vector bool int __ATTRS_o_ai\nvec_xor(vector bool int a, vector bool int b)\n{\n  return a ^ b;\n}\n\nstatic vector float __ATTRS_o_ai\nvec_xor(vector float a, vector float b)\n{\n  vector unsigned int res = (vector unsigned int)a ^ (vector unsigned int)b;\n  return (vector float)res;\n}\n\nstatic vector float __ATTRS_o_ai\nvec_xor(vector bool int a, vector float b)\n{\n  vector unsigned int res = (vector unsigned int)a ^ (vector unsigned int)b;\n  return (vector float)res;\n}\n\nstatic vector float __ATTRS_o_ai\nvec_xor(vector float a, vector bool int b)\n{\n  vector unsigned int res = (vector unsigned int)a ^ (vector unsigned int)b;\n  return (vector float)res;\n}\n\n/* vec_vxor */\n\nstatic vector signed char __ATTRS_o_ai\nvec_vxor(vector signed char a, vector signed char b)\n{\n  return a ^ b;\n}\n\nstatic vector signed char __ATTRS_o_ai\nvec_vxor(vector bool char a, vector signed char b)\n{\n  return (vector signed char)a ^ b;\n}\n\nstatic vector signed char __ATTRS_o_ai\nvec_vxor(vector signed char a, vector bool char b)\n{\n  return a ^ (vector signed char)b;\n}\n\nstatic vector unsigned char __ATTRS_o_ai\nvec_vxor(vector unsigned char a, vector unsigned char b)\n{\n  return a ^ b;\n}\n\nstatic vector unsigned char __ATTRS_o_ai\nvec_vxor(vector bool char a, vector unsigned char b)\n{\n  return (vector unsigned char)a ^ b;\n}\n\nstatic vector unsigned char __ATTRS_o_ai\nvec_vxor(vector unsigned char a, vector bool char b)\n{\n  return a ^ (vector unsigned char)b;\n}\n\nstatic vector bool char __ATTRS_o_ai\nvec_vxor(vector bool char a, vector bool char b)\n{\n  return a ^ b;\n}\n\nstatic vector short __ATTRS_o_ai\nvec_vxor(vector short a, vector short b)\n{\n  return a ^ b;\n}\n\nstatic vector short __ATTRS_o_ai\nvec_vxor(vector bool short a, vector short b)\n{\n  return (vector short)a ^ b;\n}\n\nstatic vector short __ATTRS_o_ai\nvec_vxor(vector short a, vector bool short b)\n{\n  return a ^ (vector short)b;\n}\n\nstatic vector unsigned short __ATTRS_o_ai\nvec_vxor(vector unsigned short a, vector unsigned short b)\n{\n  return a ^ b;\n}\n\nstatic vector unsigned short __ATTRS_o_ai\nvec_vxor(vector bool short a, vector unsigned short b)\n{\n  return (vector unsigned short)a ^ b;\n}\n\nstatic vector unsigned short __ATTRS_o_ai\nvec_vxor(vector unsigned short a, vector bool short b)\n{\n  return a ^ (vector unsigned short)b;\n}\n\nstatic vector bool short __ATTRS_o_ai\nvec_vxor(vector bool short a, vector bool short b)\n{\n  return a ^ b;\n}\n\nstatic vector int __ATTRS_o_ai\nvec_vxor(vector int a, vector int b)\n{\n  return a ^ b;\n}\n\nstatic vector int __ATTRS_o_ai\nvec_vxor(vector bool int a, vector int b)\n{\n  return (vector int)a ^ b;\n}\n\nstatic vector int __ATTRS_o_ai\nvec_vxor(vector int a, vector bool int b)\n{\n  return a ^ (vector int)b;\n}\n\nstatic vector unsigned int __ATTRS_o_ai\nvec_vxor(vector unsigned int a, vector unsigned int b)\n{\n  return a ^ b;\n}\n\nstatic vector unsigned int __ATTRS_o_ai\nvec_vxor(vector bool int a, vector unsigned int b)\n{\n  return (vector unsigned int)a ^ b;\n}\n\nstatic vector unsigned int __ATTRS_o_ai\nvec_vxor(vector unsigned int a, vector bool int b)\n{\n  return a ^ (vector unsigned int)b;\n}\n\nstatic vector bool int __ATTRS_o_ai\nvec_vxor(vector bool int a, vector bool int b)\n{\n  return a ^ b;\n}\n\nstatic vector float __ATTRS_o_ai\nvec_vxor(vector float a, vector float b)\n{\n  vector unsigned int res = (vector unsigned int)a ^ (vector unsigned int)b;\n  return (vector float)res;\n}\n\nstatic vector float __ATTRS_o_ai\nvec_vxor(vector bool int a, vector float b)\n{\n  vector unsigned int res = (vector unsigned int)a ^ (vector unsigned int)b;\n  return (vector float)res;\n}\n\nstatic vector float __ATTRS_o_ai\nvec_vxor(vector float a, vector bool int b)\n{\n  vector unsigned int res = (vector unsigned int)a ^ (vector unsigned int)b;\n  return (vector float)res;\n}\n\n/* ------------------------ extensions for CBEA ----------------------------- */\n\n/* vec_extract */\n\nstatic signed char __ATTRS_o_ai\nvec_extract(vector signed char a, int b)\n{\n  return a[b];\n}\n\nstatic unsigned char __ATTRS_o_ai\nvec_extract(vector unsigned char a, int b)\n{\n  return a[b];\n}\n\nstatic short __ATTRS_o_ai\nvec_extract(vector short a, int b)\n{\n  return a[b];\n}\n\nstatic unsigned short __ATTRS_o_ai\nvec_extract(vector unsigned short a, int b)\n{\n  return a[b];\n}\n\nstatic int __ATTRS_o_ai\nvec_extract(vector int a, int b)\n{\n  return a[b];\n}\n\nstatic unsigned int __ATTRS_o_ai\nvec_extract(vector unsigned int a, int b)\n{\n  return a[b];\n}\n\nstatic float __ATTRS_o_ai\nvec_extract(vector float a, int b)\n{\n  return a[b];\n}\n\n/* vec_insert */\n\nstatic vector signed char __ATTRS_o_ai\nvec_insert(signed char a, vector signed char b, int c)\n{\n  b[c] = a;\n  return b;\n}\n\nstatic vector unsigned char __ATTRS_o_ai\nvec_insert(unsigned char a, vector unsigned char b, int c)\n{\n  b[c] = a;\n  return b;\n}\n\nstatic vector short __ATTRS_o_ai\nvec_insert(short a, vector short b, int c)\n{\n  b[c] = a;\n  return b;\n}\n\nstatic vector unsigned short __ATTRS_o_ai\nvec_insert(unsigned short a, vector unsigned short b, int c)\n{\n  b[c] = a;\n  return b;\n}\n\nstatic vector int __ATTRS_o_ai\nvec_insert(int a, vector int b, int c)\n{\n  b[c] = a;\n  return b;\n}\n\nstatic vector unsigned int __ATTRS_o_ai\nvec_insert(unsigned int a, vector unsigned int b, int c)\n{\n  b[c] = a;\n  return b;\n}\n\nstatic vector float __ATTRS_o_ai\nvec_insert(float a, vector float b, int c)\n{\n  b[c] = a;\n  return b;\n}\n\n/* vec_lvlx */\n\nstatic vector signed char __ATTRS_o_ai\nvec_lvlx(int a, const signed char *b)\n{\n  return vec_perm(vec_ld(a, b),\n                  (vector signed char)(0),\n                  vec_lvsl(a, b));\n}\n\nstatic vector signed char __ATTRS_o_ai\nvec_lvlx(int a, const vector signed char *b)\n{\n  return vec_perm(vec_ld(a, b), \n                  (vector signed char)(0),\n                  vec_lvsl(a, (unsigned char *)b));\n}\n\nstatic vector unsigned char __ATTRS_o_ai\nvec_lvlx(int a, const unsigned char *b)\n{\n  return vec_perm(vec_ld(a, b),\n                  (vector unsigned char)(0),\n                  vec_lvsl(a, b));\n}\n\nstatic vector unsigned char __ATTRS_o_ai\nvec_lvlx(int a, const vector unsigned char *b)\n{\n  return vec_perm(vec_ld(a, b), \n                  (vector unsigned char)(0),\n                  vec_lvsl(a, (unsigned char *)b));\n}\n\nstatic vector bool char __ATTRS_o_ai\nvec_lvlx(int a, const vector bool char *b)\n{\n  return vec_perm(vec_ld(a, b), \n                  (vector bool char)(0),\n                  vec_lvsl(a, (unsigned char *)b));\n}\n\nstatic vector short __ATTRS_o_ai\nvec_lvlx(int a, const short *b)\n{\n  return vec_perm(vec_ld(a, b),\n                  (vector short)(0),\n                  vec_lvsl(a, b));\n}\n\nstatic vector short __ATTRS_o_ai\nvec_lvlx(int a, const vector short *b)\n{\n  return vec_perm(vec_ld(a, b),\n                  (vector short)(0),\n                  vec_lvsl(a, (unsigned char *)b));\n}\n\nstatic vector unsigned short __ATTRS_o_ai\nvec_lvlx(int a, const unsigned short *b)\n{\n  return vec_perm(vec_ld(a, b),\n                  (vector unsigned short)(0),\n                  vec_lvsl(a, b));\n}\n\nstatic vector unsigned short __ATTRS_o_ai\nvec_lvlx(int a, const vector unsigned short *b)\n{\n  return vec_perm(vec_ld(a, b), \n                  (vector unsigned short)(0),\n                  vec_lvsl(a, (unsigned char *)b));\n}\n\nstatic vector bool short __ATTRS_o_ai\nvec_lvlx(int a, const vector bool short *b)\n{\n  return vec_perm(vec_ld(a, b), \n                  (vector bool short)(0),\n                  vec_lvsl(a, (unsigned char *)b));\n}\n\nstatic vector pixel __ATTRS_o_ai\nvec_lvlx(int a, const vector pixel *b)\n{\n  return vec_perm(vec_ld(a, b), \n                  (vector pixel)(0),\n                  vec_lvsl(a, (unsigned char *)b));\n}\n\nstatic vector int __ATTRS_o_ai\nvec_lvlx(int a, const int *b)\n{\n  return vec_perm(vec_ld(a, b),\n                  (vector int)(0),\n                  vec_lvsl(a, b));\n}\n\nstatic vector int __ATTRS_o_ai\nvec_lvlx(int a, const vector int *b)\n{\n  return vec_perm(vec_ld(a, b),\n                  (vector int)(0),\n                  vec_lvsl(a, (unsigned char *)b));\n}\n\nstatic vector unsigned int __ATTRS_o_ai\nvec_lvlx(int a, const unsigned int *b)\n{\n  return vec_perm(vec_ld(a, b),\n                  (vector unsigned int)(0),\n                  vec_lvsl(a, b));\n}\n\nstatic vector unsigned int __ATTRS_o_ai\nvec_lvlx(int a, const vector unsigned int *b)\n{\n  return vec_perm(vec_ld(a, b), \n                  (vector unsigned int)(0),\n                  vec_lvsl(a, (unsigned char *)b));\n}\n\nstatic vector bool int __ATTRS_o_ai\nvec_lvlx(int a, const vector bool int *b)\n{\n  return vec_perm(vec_ld(a, b), \n                  (vector bool int)(0),\n                  vec_lvsl(a, (unsigned char *)b));\n}\n\nstatic vector float __ATTRS_o_ai\nvec_lvlx(int a, const float *b)\n{\n  return vec_perm(vec_ld(a, b),\n                  (vector float)(0),\n                  vec_lvsl(a, b));\n}\n\nstatic vector float __ATTRS_o_ai\nvec_lvlx(int a, const vector float *b)\n{\n  return vec_perm(vec_ld(a, b),\n                  (vector float)(0),\n                  vec_lvsl(a, (unsigned char *)b));\n}\n\n/* vec_lvlxl */\n\nstatic vector signed char __ATTRS_o_ai\nvec_lvlxl(int a, const signed char *b)\n{\n  return vec_perm(vec_ldl(a, b),\n                  (vector signed char)(0),\n                  vec_lvsl(a, b));\n}\n\nstatic vector signed char __ATTRS_o_ai\nvec_lvlxl(int a, const vector signed char *b)\n{\n  return vec_perm(vec_ldl(a, b), \n                  (vector signed char)(0),\n                  vec_lvsl(a, (unsigned char *)b));\n}\n\nstatic vector unsigned char __ATTRS_o_ai\nvec_lvlxl(int a, const unsigned char *b)\n{\n  return vec_perm(vec_ldl(a, b),\n                  (vector unsigned char)(0),\n                  vec_lvsl(a, b));\n}\n\nstatic vector unsigned char __ATTRS_o_ai\nvec_lvlxl(int a, const vector unsigned char *b)\n{\n  return vec_perm(vec_ldl(a, b), \n                  (vector unsigned char)(0),\n                  vec_lvsl(a, (unsigned char *)b));\n}\n\nstatic vector bool char __ATTRS_o_ai\nvec_lvlxl(int a, const vector bool char *b)\n{\n  return vec_perm(vec_ldl(a, b), \n                  (vector bool char)(0),\n                  vec_lvsl(a, (unsigned char *)b));\n}\n\nstatic vector short __ATTRS_o_ai\nvec_lvlxl(int a, const short *b)\n{\n  return vec_perm(vec_ldl(a, b),\n                  (vector short)(0),\n                  vec_lvsl(a, b));\n}\n\nstatic vector short __ATTRS_o_ai\nvec_lvlxl(int a, const vector short *b)\n{\n  return vec_perm(vec_ldl(a, b),\n                  (vector short)(0),\n                  vec_lvsl(a, (unsigned char *)b));\n}\n\nstatic vector unsigned short __ATTRS_o_ai\nvec_lvlxl(int a, const unsigned short *b)\n{\n  return vec_perm(vec_ldl(a, b),\n                  (vector unsigned short)(0),\n                  vec_lvsl(a, b));\n}\n\nstatic vector unsigned short __ATTRS_o_ai\nvec_lvlxl(int a, const vector unsigned short *b)\n{\n  return vec_perm(vec_ldl(a, b), \n                  (vector unsigned short)(0),\n                  vec_lvsl(a, (unsigned char *)b));\n}\n\nstatic vector bool short __ATTRS_o_ai\nvec_lvlxl(int a, const vector bool short *b)\n{\n  return vec_perm(vec_ldl(a, b), \n                  (vector bool short)(0),\n                  vec_lvsl(a, (unsigned char *)b));\n}\n\nstatic vector pixel __ATTRS_o_ai\nvec_lvlxl(int a, const vector pixel *b)\n{\n  return vec_perm(vec_ldl(a, b), \n                  (vector pixel)(0),\n                  vec_lvsl(a, (unsigned char *)b));\n}\n\nstatic vector int __ATTRS_o_ai\nvec_lvlxl(int a, const int *b)\n{\n  return vec_perm(vec_ldl(a, b),\n                  (vector int)(0),\n                  vec_lvsl(a, b));\n}\n\nstatic vector int __ATTRS_o_ai\nvec_lvlxl(int a, const vector int *b)\n{\n  return vec_perm(vec_ldl(a, b),\n                  (vector int)(0),\n                  vec_lvsl(a, (unsigned char *)b));\n}\n\nstatic vector unsigned int __ATTRS_o_ai\nvec_lvlxl(int a, const unsigned int *b)\n{\n  return vec_perm(vec_ldl(a, b),\n                  (vector unsigned int)(0),\n                  vec_lvsl(a, b));\n}\n\nstatic vector unsigned int __ATTRS_o_ai\nvec_lvlxl(int a, const vector unsigned int *b)\n{\n  return vec_perm(vec_ldl(a, b), \n                  (vector unsigned int)(0),\n                  vec_lvsl(a, (unsigned char *)b));\n}\n\nstatic vector bool int __ATTRS_o_ai\nvec_lvlxl(int a, const vector bool int *b)\n{\n  return vec_perm(vec_ldl(a, b), \n                  (vector bool int)(0),\n                  vec_lvsl(a, (unsigned char *)b));\n}\n\nstatic vector float __ATTRS_o_ai\nvec_lvlxl(int a, const float *b)\n{\n  return vec_perm(vec_ldl(a, b),\n                  (vector float)(0),\n                  vec_lvsl(a, b));\n}\n\nstatic vector float __ATTRS_o_ai\nvec_lvlxl(int a, vector float *b)\n{\n  return vec_perm(vec_ldl(a, b),\n                  (vector float)(0),\n                  vec_lvsl(a, (unsigned char *)b));\n}\n\n/* vec_lvrx */\n\nstatic vector signed char __ATTRS_o_ai\nvec_lvrx(int a, const signed char *b)\n{\n  return vec_perm((vector signed char)(0),\n                  vec_ld(a, b),\n                  vec_lvsl(a, b));\n}\n\nstatic vector signed char __ATTRS_o_ai\nvec_lvrx(int a, const vector signed char *b)\n{\n  return vec_perm((vector signed char)(0),\n                  vec_ld(a, b), \n                  vec_lvsl(a, (unsigned char *)b));\n}\n\nstatic vector unsigned char __ATTRS_o_ai\nvec_lvrx(int a, const unsigned char *b)\n{\n  return vec_perm((vector unsigned char)(0),\n                  vec_ld(a, b),\n                  vec_lvsl(a, b));\n}\n\nstatic vector unsigned char __ATTRS_o_ai\nvec_lvrx(int a, const vector unsigned char *b)\n{\n  return vec_perm((vector unsigned char)(0),\n                  vec_ld(a, b), \n                  vec_lvsl(a, (unsigned char *)b));\n}\n\nstatic vector bool char __ATTRS_o_ai\nvec_lvrx(int a, const vector bool char *b)\n{\n  return vec_perm((vector bool char)(0),\n                  vec_ld(a, b), \n                  vec_lvsl(a, (unsigned char *)b));\n}\n\nstatic vector short __ATTRS_o_ai\nvec_lvrx(int a, const short *b)\n{\n  return vec_perm((vector short)(0),\n                  vec_ld(a, b),\n                  vec_lvsl(a, b));\n}\n\nstatic vector short __ATTRS_o_ai\nvec_lvrx(int a, const vector short *b)\n{\n  return vec_perm((vector short)(0),\n                  vec_ld(a, b),\n                  vec_lvsl(a, (unsigned char *)b));\n}\n\nstatic vector unsigned short __ATTRS_o_ai\nvec_lvrx(int a, const unsigned short *b)\n{\n  return vec_perm((vector unsigned short)(0),\n                  vec_ld(a, b),\n                  vec_lvsl(a, b));\n}\n\nstatic vector unsigned short __ATTRS_o_ai\nvec_lvrx(int a, const vector unsigned short *b)\n{\n  return vec_perm((vector unsigned short)(0),\n                  vec_ld(a, b), \n                  vec_lvsl(a, (unsigned char *)b));\n}\n\nstatic vector bool short __ATTRS_o_ai\nvec_lvrx(int a, const vector bool short *b)\n{\n  return vec_perm((vector bool short)(0),\n                  vec_ld(a, b), \n                  vec_lvsl(a, (unsigned char *)b));\n}\n\nstatic vector pixel __ATTRS_o_ai\nvec_lvrx(int a, const vector pixel *b)\n{\n  return vec_perm((vector pixel)(0),\n                  vec_ld(a, b), \n                  vec_lvsl(a, (unsigned char *)b));\n}\n\nstatic vector int __ATTRS_o_ai\nvec_lvrx(int a, const int *b)\n{\n  return vec_perm((vector int)(0),\n                  vec_ld(a, b),\n                  vec_lvsl(a, b));\n}\n\nstatic vector int __ATTRS_o_ai\nvec_lvrx(int a, const vector int *b)\n{\n  return vec_perm((vector int)(0),\n                  vec_ld(a, b),\n                  vec_lvsl(a, (unsigned char *)b));\n}\n\nstatic vector unsigned int __ATTRS_o_ai\nvec_lvrx(int a, const unsigned int *b)\n{\n  return vec_perm((vector unsigned int)(0),\n                  vec_ld(a, b),\n                  vec_lvsl(a, b));\n}\n\nstatic vector unsigned int __ATTRS_o_ai\nvec_lvrx(int a, const vector unsigned int *b)\n{\n  return vec_perm((vector unsigned int)(0),\n                  vec_ld(a, b), \n                  vec_lvsl(a, (unsigned char *)b));\n}\n\nstatic vector bool int __ATTRS_o_ai\nvec_lvrx(int a, const vector bool int *b)\n{\n  return vec_perm((vector bool int)(0),\n                  vec_ld(a, b), \n                  vec_lvsl(a, (unsigned char *)b));\n}\n\nstatic vector float __ATTRS_o_ai\nvec_lvrx(int a, const float *b)\n{\n  return vec_perm((vector float)(0),\n                  vec_ld(a, b),\n                  vec_lvsl(a, b));\n}\n\nstatic vector float __ATTRS_o_ai\nvec_lvrx(int a, const vector float *b)\n{\n  return vec_perm((vector float)(0),\n                  vec_ld(a, b),\n                  vec_lvsl(a, (unsigned char *)b));\n}\n\n/* vec_lvrxl */\n\nstatic vector signed char __ATTRS_o_ai\nvec_lvrxl(int a, const signed char *b)\n{\n  return vec_perm((vector signed char)(0),\n                  vec_ldl(a, b),\n                  vec_lvsl(a, b));\n}\n\nstatic vector signed char __ATTRS_o_ai\nvec_lvrxl(int a, const vector signed char *b)\n{\n  return vec_perm((vector signed char)(0),\n                  vec_ldl(a, b), \n                  vec_lvsl(a, (unsigned char *)b));\n}\n\nstatic vector unsigned char __ATTRS_o_ai\nvec_lvrxl(int a, const unsigned char *b)\n{\n  return vec_perm((vector unsigned char)(0),\n                  vec_ldl(a, b),\n                  vec_lvsl(a, b));\n}\n\nstatic vector unsigned char __ATTRS_o_ai\nvec_lvrxl(int a, const vector unsigned char *b)\n{\n  return vec_perm((vector unsigned char)(0),\n                  vec_ldl(a, b), \n                  vec_lvsl(a, (unsigned char *)b));\n}\n\nstatic vector bool char __ATTRS_o_ai\nvec_lvrxl(int a, const vector bool char *b)\n{\n  return vec_perm((vector bool char)(0),\n                  vec_ldl(a, b), \n                  vec_lvsl(a, (unsigned char *)b));\n}\n\nstatic vector short __ATTRS_o_ai\nvec_lvrxl(int a, const short *b)\n{\n  return vec_perm((vector short)(0),\n                  vec_ldl(a, b),\n                  vec_lvsl(a, b));\n}\n\nstatic vector short __ATTRS_o_ai\nvec_lvrxl(int a, const vector short *b)\n{\n  return vec_perm((vector short)(0),\n                  vec_ldl(a, b),\n                  vec_lvsl(a, (unsigned char *)b));\n}\n\nstatic vector unsigned short __ATTRS_o_ai\nvec_lvrxl(int a, const unsigned short *b)\n{\n  return vec_perm((vector unsigned short)(0),\n                  vec_ldl(a, b),\n                  vec_lvsl(a, b));\n}\n\nstatic vector unsigned short __ATTRS_o_ai\nvec_lvrxl(int a, const vector unsigned short *b)\n{\n  return vec_perm((vector unsigned short)(0),\n                  vec_ldl(a, b), \n                  vec_lvsl(a, (unsigned char *)b));\n}\n\nstatic vector bool short __ATTRS_o_ai\nvec_lvrxl(int a, const vector bool short *b)\n{\n  return vec_perm((vector bool short)(0),\n                  vec_ldl(a, b), \n                  vec_lvsl(a, (unsigned char *)b));\n}\n\nstatic vector pixel __ATTRS_o_ai\nvec_lvrxl(int a, const vector pixel *b)\n{\n  return vec_perm((vector pixel)(0),\n                  vec_ldl(a, b), \n                  vec_lvsl(a, (unsigned char *)b));\n}\n\nstatic vector int __ATTRS_o_ai\nvec_lvrxl(int a, const int *b)\n{\n  return vec_perm((vector int)(0),\n                  vec_ldl(a, b),\n                  vec_lvsl(a, b));\n}\n\nstatic vector int __ATTRS_o_ai\nvec_lvrxl(int a, const vector int *b)\n{\n  return vec_perm((vector int)(0),\n                  vec_ldl(a, b),\n                  vec_lvsl(a, (unsigned char *)b));\n}\n\nstatic vector unsigned int __ATTRS_o_ai\nvec_lvrxl(int a, const unsigned int *b)\n{\n  return vec_perm((vector unsigned int)(0),\n                  vec_ldl(a, b),\n                  vec_lvsl(a, b));\n}\n\nstatic vector unsigned int __ATTRS_o_ai\nvec_lvrxl(int a, const vector unsigned int *b)\n{\n  return vec_perm((vector unsigned int)(0),\n                  vec_ldl(a, b), \n                  vec_lvsl(a, (unsigned char *)b));\n}\n\nstatic vector bool int __ATTRS_o_ai\nvec_lvrxl(int a, const vector bool int *b)\n{\n  return vec_perm((vector bool int)(0),\n                  vec_ldl(a, b), \n                  vec_lvsl(a, (unsigned char *)b));\n}\n\nstatic vector float __ATTRS_o_ai\nvec_lvrxl(int a, const float *b)\n{\n  return vec_perm((vector float)(0),\n                  vec_ldl(a, b),\n                  vec_lvsl(a, b));\n}\n\nstatic vector float __ATTRS_o_ai\nvec_lvrxl(int a, const vector float *b)\n{\n  return vec_perm((vector float)(0),\n                  vec_ldl(a, b),\n                  vec_lvsl(a, (unsigned char *)b));\n}\n\n/* vec_stvlx */\n\nstatic void __ATTRS_o_ai\nvec_stvlx(vector signed char a, int b, signed char *c)\n{\n  return vec_st(vec_perm(vec_lvrx(b, c),\n                         a,\n                         vec_lvsr(b, c)),\n                b, c);\n}\n\nstatic void __ATTRS_o_ai\nvec_stvlx(vector signed char a, int b, vector signed char *c)\n{\n  return vec_st(vec_perm(vec_lvrx(b, c),\n                         a,\n                         vec_lvsr(b, (unsigned char *)c)),\n                b, c);\n}\n\nstatic void __ATTRS_o_ai\nvec_stvlx(vector unsigned char a, int b, unsigned char *c)\n{\n  return vec_st(vec_perm(vec_lvrx(b, c),\n                         a,\n                         vec_lvsr(b, c)),\n                b, c);\n}\n\nstatic void __ATTRS_o_ai\nvec_stvlx(vector unsigned char a, int b, vector unsigned char *c)\n{\n  return vec_st(vec_perm(vec_lvrx(b, c),\n                         a,\n                         vec_lvsr(b, (unsigned char *)c)),\n                b, c);\n}\n\nstatic void __ATTRS_o_ai\nvec_stvlx(vector bool char a, int b, vector bool char *c)\n{\n  return vec_st(vec_perm(vec_lvrx(b, c),\n                         a,\n                         vec_lvsr(b, (unsigned char *)c)),\n                b, c);\n}\n\nstatic void __ATTRS_o_ai\nvec_stvlx(vector short a, int b, short *c)\n{\n  return vec_st(vec_perm(vec_lvrx(b, c),\n                         a,\n                         vec_lvsr(b, c)),\n                b, c);\n}\n\nstatic void __ATTRS_o_ai\nvec_stvlx(vector short a, int b, vector short *c)\n{\n  return vec_st(vec_perm(vec_lvrx(b, c),\n                         a,\n                         vec_lvsr(b, (unsigned char *)c)),\n                b, c);\n}\n\nstatic void __ATTRS_o_ai\nvec_stvlx(vector unsigned short a, int b, unsigned short *c)\n{\n  return vec_st(vec_perm(vec_lvrx(b, c),\n                         a,\n                         vec_lvsr(b, c)),\n                b, c);\n}\n\nstatic void __ATTRS_o_ai\nvec_stvlx(vector unsigned short a, int b, vector unsigned short *c)\n{\n  return vec_st(vec_perm(vec_lvrx(b, c),\n                         a,\n                         vec_lvsr(b, (unsigned char *)c)),\n                b, c);\n}\n\nstatic void __ATTRS_o_ai\nvec_stvlx(vector bool short a, int b, vector bool short *c)\n{\n  return vec_st(vec_perm(vec_lvrx(b, c),\n                         a,\n                         vec_lvsr(b, (unsigned char *)c)),\n                b, c);\n}\n\nstatic void __ATTRS_o_ai\nvec_stvlx(vector pixel a, int b, vector pixel *c)\n{\n  return vec_st(vec_perm(vec_lvrx(b, c),\n                         a,\n                         vec_lvsr(b, (unsigned char *)c)),\n                b, c);\n}\n\nstatic void __ATTRS_o_ai\nvec_stvlx(vector int a, int b, int *c)\n{\n  return vec_st(vec_perm(vec_lvrx(b, c),\n                         a,\n                         vec_lvsr(b, c)),\n                b, c);\n}\n\nstatic void __ATTRS_o_ai\nvec_stvlx(vector int a, int b, vector int *c)\n{\n  return vec_st(vec_perm(vec_lvrx(b, c),\n                         a,\n                         vec_lvsr(b, (unsigned char *)c)),\n                b, c);\n}\n\nstatic void __ATTRS_o_ai\nvec_stvlx(vector unsigned int a, int b, unsigned int *c)\n{\n  return vec_st(vec_perm(vec_lvrx(b, c),\n                         a,\n                         vec_lvsr(b, c)),\n                b, c);\n}\n\nstatic void __ATTRS_o_ai\nvec_stvlx(vector unsigned int a, int b, vector unsigned int *c)\n{\n  return vec_st(vec_perm(vec_lvrx(b, c),\n                         a,\n                         vec_lvsr(b, (unsigned char *)c)),\n                b, c);\n}\n\nstatic void __ATTRS_o_ai\nvec_stvlx(vector bool int a, int b, vector bool int *c)\n{\n  return vec_st(vec_perm(vec_lvrx(b, c),\n                         a,\n                         vec_lvsr(b, (unsigned char *)c)),\n                b, c);\n}\n\nstatic void __ATTRS_o_ai\nvec_stvlx(vector float a, int b, vector float *c)\n{\n  return vec_st(vec_perm(vec_lvrx(b, c),\n                         a,\n                         vec_lvsr(b, (unsigned char *)c)),\n                b, c);\n}\n\n/* vec_stvlxl */\n\nstatic void __ATTRS_o_ai\nvec_stvlxl(vector signed char a, int b, signed char *c)\n{\n  return vec_stl(vec_perm(vec_lvrx(b, c),\n                          a,\n                          vec_lvsr(b, c)),\n                 b, c);\n}\n\nstatic void __ATTRS_o_ai\nvec_stvlxl(vector signed char a, int b, vector signed char *c)\n{\n  return vec_stl(vec_perm(vec_lvrx(b, c),\n                          a,\n                          vec_lvsr(b, (unsigned char *)c)),\n                 b, c);\n}\n\nstatic void __ATTRS_o_ai\nvec_stvlxl(vector unsigned char a, int b, unsigned char *c)\n{\n  return vec_stl(vec_perm(vec_lvrx(b, c),\n                          a,\n                          vec_lvsr(b, c)),\n                 b, c);\n}\n\nstatic void __ATTRS_o_ai\nvec_stvlxl(vector unsigned char a, int b, vector unsigned char *c)\n{\n  return vec_stl(vec_perm(vec_lvrx(b, c),\n                          a,\n                          vec_lvsr(b, (unsigned char *)c)),\n                 b, c);\n}\n\nstatic void __ATTRS_o_ai\nvec_stvlxl(vector bool char a, int b, vector bool char *c)\n{\n  return vec_stl(vec_perm(vec_lvrx(b, c),\n                          a,\n                          vec_lvsr(b, (unsigned char *)c)),\n                 b, c);\n}\n\nstatic void __ATTRS_o_ai\nvec_stvlxl(vector short a, int b, short *c)\n{\n  return vec_stl(vec_perm(vec_lvrx(b, c),\n                          a,\n                          vec_lvsr(b, c)),\n                 b, c);\n}\n\nstatic void __ATTRS_o_ai\nvec_stvlxl(vector short a, int b, vector short *c)\n{\n  return vec_stl(vec_perm(vec_lvrx(b, c),\n                          a,\n                          vec_lvsr(b, (unsigned char *)c)),\n                 b, c);\n}\n\nstatic void __ATTRS_o_ai\nvec_stvlxl(vector unsigned short a, int b, unsigned short *c)\n{\n  return vec_stl(vec_perm(vec_lvrx(b, c),\n                          a,\n                          vec_lvsr(b, c)),\n                 b, c);\n}\n\nstatic void __ATTRS_o_ai\nvec_stvlxl(vector unsigned short a, int b, vector unsigned short *c)\n{\n  return vec_stl(vec_perm(vec_lvrx(b, c),\n                          a,\n                          vec_lvsr(b, (unsigned char *)c)),\n                 b, c);\n}\n\nstatic void __ATTRS_o_ai\nvec_stvlxl(vector bool short a, int b, vector bool short *c)\n{\n  return vec_stl(vec_perm(vec_lvrx(b, c),\n                          a,\n                          vec_lvsr(b, (unsigned char *)c)),\n                 b, c);\n}\n\nstatic void __ATTRS_o_ai\nvec_stvlxl(vector pixel a, int b, vector pixel *c)\n{\n  return vec_stl(vec_perm(vec_lvrx(b, c),\n                          a,\n                          vec_lvsr(b, (unsigned char *)c)),\n                 b, c);\n}\n\nstatic void __ATTRS_o_ai\nvec_stvlxl(vector int a, int b, int *c)\n{\n  return vec_stl(vec_perm(vec_lvrx(b, c),\n                          a,\n                          vec_lvsr(b, c)),\n                 b, c);\n}\n\nstatic void __ATTRS_o_ai\nvec_stvlxl(vector int a, int b, vector int *c)\n{\n  return vec_stl(vec_perm(vec_lvrx(b, c),\n                          a,\n                          vec_lvsr(b, (unsigned char *)c)),\n                 b, c);\n}\n\nstatic void __ATTRS_o_ai\nvec_stvlxl(vector unsigned int a, int b, unsigned int *c)\n{\n  return vec_stl(vec_perm(vec_lvrx(b, c),\n                          a,\n                          vec_lvsr(b, c)),\n                 b, c);\n}\n\nstatic void __ATTRS_o_ai\nvec_stvlxl(vector unsigned int a, int b, vector unsigned int *c)\n{\n  return vec_stl(vec_perm(vec_lvrx(b, c),\n                          a,\n                          vec_lvsr(b, (unsigned char *)c)),\n                 b, c);\n}\n\nstatic void __ATTRS_o_ai\nvec_stvlxl(vector bool int a, int b, vector bool int *c)\n{\n  return vec_stl(vec_perm(vec_lvrx(b, c),\n                          a,\n                          vec_lvsr(b, (unsigned char *)c)),\n                 b, c);\n}\n\nstatic void __ATTRS_o_ai\nvec_stvlxl(vector float a, int b, vector float *c)\n{\n  return vec_stl(vec_perm(vec_lvrx(b, c),\n                          a,\n                          vec_lvsr(b, (unsigned char *)c)),\n                 b, c);\n}\n\n/* vec_stvrx */\n\nstatic void __ATTRS_o_ai\nvec_stvrx(vector signed char a, int b, signed char *c)\n{\n  return vec_st(vec_perm(a,\n                         vec_lvlx(b, c),\n                         vec_lvsr(b, c)),\n                b, c);\n}\n\nstatic void __ATTRS_o_ai\nvec_stvrx(vector signed char a, int b, vector signed char *c)\n{\n  return vec_st(vec_perm(a,\n                         vec_lvlx(b, c),\n                         vec_lvsr(b, (unsigned char *)c)),\n                b, c);\n}\n\nstatic void __ATTRS_o_ai\nvec_stvrx(vector unsigned char a, int b, unsigned char *c)\n{\n  return vec_st(vec_perm(a,\n                         vec_lvlx(b, c),\n                         vec_lvsr(b, c)),\n                b, c);\n}\n\nstatic void __ATTRS_o_ai\nvec_stvrx(vector unsigned char a, int b, vector unsigned char *c)\n{\n  return vec_st(vec_perm(a,\n                         vec_lvlx(b, c),\n                         vec_lvsr(b, (unsigned char *)c)),\n                b, c);\n}\n\nstatic void __ATTRS_o_ai\nvec_stvrx(vector bool char a, int b, vector bool char *c)\n{\n  return vec_st(vec_perm(a,\n                         vec_lvlx(b, c),\n                         vec_lvsr(b, (unsigned char *)c)),\n                b, c);\n}\n\nstatic void __ATTRS_o_ai\nvec_stvrx(vector short a, int b, short *c)\n{\n  return vec_st(vec_perm(a,\n                         vec_lvlx(b, c),\n                         vec_lvsr(b, c)),\n                b, c);\n}\n\nstatic void __ATTRS_o_ai\nvec_stvrx(vector short a, int b, vector short *c)\n{\n  return vec_st(vec_perm(a,\n                         vec_lvlx(b, c),\n                         vec_lvsr(b, (unsigned char *)c)),\n                b, c);\n}\n\nstatic void __ATTRS_o_ai\nvec_stvrx(vector unsigned short a, int b, unsigned short *c)\n{\n  return vec_st(vec_perm(a,\n                         vec_lvlx(b, c),\n                         vec_lvsr(b, c)),\n                b, c);\n}\n\nstatic void __ATTRS_o_ai\nvec_stvrx(vector unsigned short a, int b, vector unsigned short *c)\n{\n  return vec_st(vec_perm(a,\n                         vec_lvlx(b, c),\n                         vec_lvsr(b, (unsigned char *)c)),\n                b, c);\n}\n\nstatic void __ATTRS_o_ai\nvec_stvrx(vector bool short a, int b, vector bool short *c)\n{\n  return vec_st(vec_perm(a,\n                         vec_lvlx(b, c),\n                         vec_lvsr(b, (unsigned char *)c)),\n                b, c);\n}\n\nstatic void __ATTRS_o_ai\nvec_stvrx(vector pixel a, int b, vector pixel *c)\n{\n  return vec_st(vec_perm(a,\n                         vec_lvlx(b, c),\n                         vec_lvsr(b, (unsigned char *)c)),\n                b, c);\n}\n\nstatic void __ATTRS_o_ai\nvec_stvrx(vector int a, int b, int *c)\n{\n  return vec_st(vec_perm(a,\n                         vec_lvlx(b, c),\n                         vec_lvsr(b, c)),\n                b, c);\n}\n\nstatic void __ATTRS_o_ai\nvec_stvrx(vector int a, int b, vector int *c)\n{\n  return vec_st(vec_perm(a,\n                         vec_lvlx(b, c),\n                         vec_lvsr(b, (unsigned char *)c)),\n                b, c);\n}\n\nstatic void __ATTRS_o_ai\nvec_stvrx(vector unsigned int a, int b, unsigned int *c)\n{\n  return vec_st(vec_perm(a,\n                         vec_lvlx(b, c),\n                         vec_lvsr(b, c)),\n                b, c);\n}\n\nstatic void __ATTRS_o_ai\nvec_stvrx(vector unsigned int a, int b, vector unsigned int *c)\n{\n  return vec_st(vec_perm(a,\n                         vec_lvlx(b, c),\n                         vec_lvsr(b, (unsigned char *)c)),\n                b, c);\n}\n\nstatic void __ATTRS_o_ai\nvec_stvrx(vector bool int a, int b, vector bool int *c)\n{\n  return vec_st(vec_perm(a,\n                         vec_lvlx(b, c),\n                         vec_lvsr(b, (unsigned char *)c)),\n                b, c);\n}\n\nstatic void __ATTRS_o_ai\nvec_stvrx(vector float a, int b, vector float *c)\n{\n  return vec_st(vec_perm(a,\n                         vec_lvlx(b, c),\n                         vec_lvsr(b, (unsigned char *)c)),\n                b, c);\n}\n\n/* vec_stvrxl */\n\nstatic void __ATTRS_o_ai\nvec_stvrxl(vector signed char a, int b, signed char *c)\n{\n  return vec_stl(vec_perm(a,\n                          vec_lvlx(b, c),\n                          vec_lvsr(b, c)),\n                 b, c);\n}\n\nstatic void __ATTRS_o_ai\nvec_stvrxl(vector signed char a, int b, vector signed char *c)\n{\n  return vec_stl(vec_perm(a,\n                          vec_lvlx(b, c),\n                          vec_lvsr(b, (unsigned char *)c)),\n                 b, c);\n}\n\nstatic void __ATTRS_o_ai\nvec_stvrxl(vector unsigned char a, int b, unsigned char *c)\n{\n  return vec_stl(vec_perm(a,\n                          vec_lvlx(b, c),\n                          vec_lvsr(b, c)),\n                 b, c);\n}\n\nstatic void __ATTRS_o_ai\nvec_stvrxl(vector unsigned char a, int b, vector unsigned char *c)\n{\n  return vec_stl(vec_perm(a,\n                          vec_lvlx(b, c),\n                          vec_lvsr(b, (unsigned char *)c)),\n                 b, c);\n}\n\nstatic void __ATTRS_o_ai\nvec_stvrxl(vector bool char a, int b, vector bool char *c)\n{\n  return vec_stl(vec_perm(a,\n                          vec_lvlx(b, c),\n                          vec_lvsr(b, (unsigned char *)c)),\n                 b, c);\n}\n\nstatic void __ATTRS_o_ai\nvec_stvrxl(vector short a, int b, short *c)\n{\n  return vec_stl(vec_perm(a,\n                          vec_lvlx(b, c),\n                          vec_lvsr(b, c)),\n                 b, c);\n}\n\nstatic void __ATTRS_o_ai\nvec_stvrxl(vector short a, int b, vector short *c)\n{\n  return vec_stl(vec_perm(a,\n                          vec_lvlx(b, c),\n                          vec_lvsr(b, (unsigned char *)c)),\n                 b, c);\n}\n\nstatic void __ATTRS_o_ai\nvec_stvrxl(vector unsigned short a, int b, unsigned short *c)\n{\n  return vec_stl(vec_perm(a,\n                          vec_lvlx(b, c),\n                          vec_lvsr(b, c)),\n                 b, c);\n}\n\nstatic void __ATTRS_o_ai\nvec_stvrxl(vector unsigned short a, int b, vector unsigned short *c)\n{\n  return vec_stl(vec_perm(a,\n                          vec_lvlx(b, c),\n                          vec_lvsr(b, (unsigned char *)c)),\n                 b, c);\n}\n\nstatic void __ATTRS_o_ai\nvec_stvrxl(vector bool short a, int b, vector bool short *c)\n{\n  return vec_stl(vec_perm(a,\n                          vec_lvlx(b, c),\n                          vec_lvsr(b, (unsigned char *)c)),\n                 b, c);\n}\n\nstatic void __ATTRS_o_ai\nvec_stvrxl(vector pixel a, int b, vector pixel *c)\n{\n  return vec_stl(vec_perm(a,\n                          vec_lvlx(b, c),\n                          vec_lvsr(b, (unsigned char *)c)),\n                 b, c);\n}\n\nstatic void __ATTRS_o_ai\nvec_stvrxl(vector int a, int b, int *c)\n{\n  return vec_stl(vec_perm(a,\n                          vec_lvlx(b, c),\n                          vec_lvsr(b, c)),\n                 b, c);\n}\n\nstatic void __ATTRS_o_ai\nvec_stvrxl(vector int a, int b, vector int *c)\n{\n  return vec_stl(vec_perm(a,\n                          vec_lvlx(b, c),\n                          vec_lvsr(b, (unsigned char *)c)),\n                 b, c);\n}\n\nstatic void __ATTRS_o_ai\nvec_stvrxl(vector unsigned int a, int b, unsigned int *c)\n{\n  return vec_stl(vec_perm(a,\n                          vec_lvlx(b, c),\n                          vec_lvsr(b, c)),\n                 b, c);\n}\n\nstatic void __ATTRS_o_ai\nvec_stvrxl(vector unsigned int a, int b, vector unsigned int *c)\n{\n  return vec_stl(vec_perm(a,\n                          vec_lvlx(b, c),\n                          vec_lvsr(b, (unsigned char *)c)),\n                 b, c);\n}\n\nstatic void __ATTRS_o_ai\nvec_stvrxl(vector bool int a, int b, vector bool int *c)\n{\n  return vec_stl(vec_perm(a,\n                          vec_lvlx(b, c),\n                          vec_lvsr(b, (unsigned char *)c)),\n                 b, c);\n}\n\nstatic void __ATTRS_o_ai\nvec_stvrxl(vector float a, int b, vector float *c)\n{\n  return vec_stl(vec_perm(a,\n                          vec_lvlx(b, c),\n                          vec_lvsr(b, (unsigned char *)c)),\n                 b, c);\n}\n\n/* vec_promote */\n\nstatic vector signed char __ATTRS_o_ai\nvec_promote(signed char a, int b)\n{\n  vector signed char res = (vector signed char)(0);\n  res[b] = a;\n  return res;\n}\n\nstatic vector unsigned char __ATTRS_o_ai\nvec_promote(unsigned char a, int b)\n{\n  vector unsigned char res = (vector unsigned char)(0);\n  res[b] = a;\n  return res;\n}\n\nstatic vector short __ATTRS_o_ai\nvec_promote(short a, int b)\n{\n  vector short res = (vector short)(0);\n  res[b] = a;\n  return res;\n}\n\nstatic vector unsigned short __ATTRS_o_ai\nvec_promote(unsigned short a, int b)\n{\n  vector unsigned short res = (vector unsigned short)(0);\n  res[b] = a;\n  return res;\n}\n\nstatic vector int __ATTRS_o_ai\nvec_promote(int a, int b)\n{\n  vector int res = (vector int)(0);\n  res[b] = a;\n  return res;\n}\n\nstatic vector unsigned int __ATTRS_o_ai\nvec_promote(unsigned int a, int b)\n{\n  vector unsigned int res = (vector unsigned int)(0);\n  res[b] = a;\n  return res;\n}\n\nstatic vector float __ATTRS_o_ai\nvec_promote(float a, int b)\n{\n  vector float res = (vector float)(0);\n  res[b] = a;\n  return res;\n}\n\n/* vec_splats */\n\nstatic vector signed char __ATTRS_o_ai\nvec_splats(signed char a)\n{\n  return (vector signed char)(a);\n}\n\nstatic vector unsigned char __ATTRS_o_ai\nvec_splats(unsigned char a)\n{\n  return (vector unsigned char)(a);\n}\n\nstatic vector short __ATTRS_o_ai\nvec_splats(short a)\n{\n  return (vector short)(a);\n}\n\nstatic vector unsigned short __ATTRS_o_ai\nvec_splats(unsigned short a)\n{\n  return (vector unsigned short)(a);\n}\n\nstatic vector int __ATTRS_o_ai\nvec_splats(int a)\n{\n  return (vector int)(a);\n}\n\nstatic vector unsigned int __ATTRS_o_ai\nvec_splats(unsigned int a)\n{\n  return (vector unsigned int)(a);\n}\n\nstatic vector float __ATTRS_o_ai\nvec_splats(float a)\n{\n  return (vector float)(a);\n}\n\n/* ----------------------------- predicates --------------------------------- */\n\n/* vec_all_eq */\n\nstatic int __ATTRS_o_ai\nvec_all_eq(vector signed char a, vector signed char b)\n{\n  return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)a, (vector char)b);\n}\n\nstatic int __ATTRS_o_ai\nvec_all_eq(vector signed char a, vector bool char b)\n{\n  return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)a, (vector char)b);\n}\n\nstatic int __ATTRS_o_ai\nvec_all_eq(vector unsigned char a, vector unsigned char b)\n{\n  return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)a, (vector char)b);\n}\n\nstatic int __ATTRS_o_ai\nvec_all_eq(vector unsigned char a, vector bool char b)\n{\n  return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)a, (vector char)b);\n}\n\nstatic int __ATTRS_o_ai\nvec_all_eq(vector bool char a, vector signed char b)\n{\n  return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)a, (vector char)b);\n}\n\nstatic int __ATTRS_o_ai\nvec_all_eq(vector bool char a, vector unsigned char b)\n{\n  return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)a, (vector char)b);\n}\n\nstatic int __ATTRS_o_ai\nvec_all_eq(vector bool char a, vector bool char b)\n{\n  return __builtin_altivec_vcmpequb_p(__CR6_LT, (vector char)a, (vector char)b);\n}\n\nstatic int __ATTRS_o_ai\nvec_all_eq(vector short a, vector short b)\n{\n  return __builtin_altivec_vcmpequh_p(__CR6_LT, a, b);\n}\n\nstatic int __ATTRS_o_ai\nvec_all_eq(vector short a, vector bool short b)\n{\n  return __builtin_altivec_vcmpequh_p(__CR6_LT, a, (vector short)b);\n}\n\nstatic int __ATTRS_o_ai\nvec_all_eq(vector unsigned short a, vector unsigned short b)\n{\n  return\n    __builtin_altivec_vcmpequh_p(__CR6_LT, (vector short)a, (vector short)b);\n}\n\nstatic int __ATTRS_o_ai\nvec_all_eq(vector unsigned short a, vector bool short b)\n{\n  return\n    __builtin_altivec_vcmpequh_p(__CR6_LT, (vector short)a, (vector short)b);\n}\n\nstatic int __ATTRS_o_ai\nvec_all_eq(vector bool short a, vector short b)\n{\n  return\n    __builtin_altivec_vcmpequh_p(__CR6_LT, (vector short)a, (vector short)b);\n}\n\nstatic int __ATTRS_o_ai\nvec_all_eq(vector bool short a, vector unsigned short b)\n{\n  return\n    __builtin_altivec_vcmpequh_p(__CR6_LT, (vector short)a, (vector short)b);\n}\n\nstatic int __ATTRS_o_ai\nvec_all_eq(vector bool short a, vector bool short b)\n{\n  return\n    __builtin_altivec_vcmpequh_p(__CR6_LT, (vector short)a, (vector short)b);\n}\n\nstatic int __ATTRS_o_ai\nvec_all_eq(vector pixel a, vector pixel b)\n{\n  return\n    __builtin_altivec_vcmpequh_p(__CR6_LT, (vector short)a, (vector short)b);\n}\n\nstatic int __ATTRS_o_ai\nvec_all_eq(vector int a, vector int b)\n{\n  return __builtin_altivec_vcmpequw_p(__CR6_LT, a, b);\n}\n\nstatic int __ATTRS_o_ai\nvec_all_eq(vector int a, vector bool int b)\n{\n  return __builtin_altivec_vcmpequw_p(__CR6_LT, a, (vector int)b);\n}\n\nstatic int __ATTRS_o_ai\nvec_all_eq(vector unsigned int a, vector unsigned int b)\n{\n  return __builtin_altivec_vcmpequw_p(__CR6_LT, (vector int)a, (vector int)b);\n}\n\nstatic int __ATTRS_o_ai\nvec_all_eq(vector unsigned int a, vector bool int b)\n{\n  return __builtin_altivec_vcmpequw_p(__CR6_LT, (vector int)a, (vector int)b);\n}\n\nstatic int __ATTRS_o_ai\nvec_all_eq(vector bool int a, vector int b)\n{\n  return __builtin_altivec_vcmpequw_p(__CR6_LT, (vector int)a, (vector int)b);\n}\n\nstatic int __ATTRS_o_ai\nvec_all_eq(vector bool int a, vector unsigned int b)\n{\n  return __builtin_altivec_vcmpequw_p(__CR6_LT, (vector int)a, (vector int)b);\n}\n\nstatic int __ATTRS_o_ai\nvec_all_eq(vector bool int a, vector bool int b)\n{\n  return __builtin_altivec_vcmpequw_p(__CR6_LT, (vector int)a, (vector int)b);\n}\n\nstatic int __ATTRS_o_ai\nvec_all_eq(vector float a, vector float b)\n{\n  return __builtin_altivec_vcmpeqfp_p(__CR6_LT, a, b);\n}\n\n/* vec_all_ge */\n\nstatic int __ATTRS_o_ai\nvec_all_ge(vector signed char a, vector signed char b)\n{\n  return __builtin_altivec_vcmpgtsb_p(__CR6_EQ, b, a);\n}\n\nstatic int __ATTRS_o_ai\nvec_all_ge(vector signed char a, vector bool char b)\n{\n  return __builtin_altivec_vcmpgtsb_p(__CR6_EQ, (vector signed char)b, a);\n}\n\nstatic int __ATTRS_o_ai\nvec_all_ge(vector unsigned char a, vector unsigned char b)\n{\n  return __builtin_altivec_vcmpgtub_p(__CR6_EQ, b, a);\n}\n\nstatic int __ATTRS_o_ai\nvec_all_ge(vector unsigned char a, vector bool char b)\n{\n  return __builtin_altivec_vcmpgtub_p(__CR6_EQ, (vector unsigned char)b, a);\n}\n\nstatic int __ATTRS_o_ai\nvec_all_ge(vector bool char a, vector signed char b)\n{\n  return __builtin_altivec_vcmpgtub_p(__CR6_EQ,\n                                      (vector unsigned char)b,\n                                      (vector unsigned char)a);\n}\n\nstatic int __ATTRS_o_ai\nvec_all_ge(vector bool char a, vector unsigned char b)\n{\n  return __builtin_altivec_vcmpgtub_p(__CR6_EQ, b, (vector unsigned char)a);\n}\n\nstatic int __ATTRS_o_ai\nvec_all_ge(vector bool char a, vector bool char b)\n{\n  return __builtin_altivec_vcmpgtub_p(__CR6_EQ,\n                                      (vector unsigned char)b,\n                                      (vector unsigned char)a);\n}\n\nstatic int __ATTRS_o_ai\nvec_all_ge(vector short a, vector short b)\n{\n  return __builtin_altivec_vcmpgtsh_p(__CR6_EQ, b, a);\n}\n\nstatic int __ATTRS_o_ai\nvec_all_ge(vector short a, vector bool short b)\n{\n  return __builtin_altivec_vcmpgtsh_p(__CR6_EQ, (vector short)b, a);\n}\n\nstatic int __ATTRS_o_ai\nvec_all_ge(vector unsigned short a, vector unsigned short b)\n{\n  return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, b, a);\n}\n\nstatic int __ATTRS_o_ai\nvec_all_ge(vector unsigned short a, vector bool short b)\n{\n  return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, (vector unsigned short)b, a);\n}\n\nstatic int __ATTRS_o_ai\nvec_all_ge(vector bool short a, vector short b)\n{\n  return __builtin_altivec_vcmpgtuh_p(__CR6_EQ,\n                                      (vector unsigned short)b,\n                                      (vector unsigned short)a);\n}\n\nstatic int __ATTRS_o_ai\nvec_all_ge(vector bool short a, vector unsigned short b)\n{\n  return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, b, (vector unsigned short)a);\n}\n\nstatic int __ATTRS_o_ai\nvec_all_ge(vector bool short a, vector bool short b)\n{\n  return __builtin_altivec_vcmpgtuh_p(__CR6_EQ,\n                                      (vector unsigned short)b,\n                                      (vector unsigned short)a);\n}\n\nstatic int __ATTRS_o_ai\nvec_all_ge(vector int a, vector int b)\n{\n  return __builtin_altivec_vcmpgtsw_p(__CR6_EQ, b, a);\n}\n\nstatic int __ATTRS_o_ai\nvec_all_ge(vector int a, vector bool int b)\n{\n  return __builtin_altivec_vcmpgtsw_p(__CR6_EQ, (vector int)b, a);\n}\n\nstatic int __ATTRS_o_ai\nvec_all_ge(vector unsigned int a, vector unsigned int b)\n{\n  return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, b, a);\n}\n\nstatic int __ATTRS_o_ai\nvec_all_ge(vector unsigned int a, vector bool int b)\n{\n  return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, (vector unsigned int)b, a);\n}\n\nstatic int __ATTRS_o_ai\nvec_all_ge(vector bool int a, vector int b)\n{\n  return __builtin_altivec_vcmpgtuw_p(__CR6_EQ,\n                                      (vector unsigned int)b,\n                                      (vector unsigned int)a);\n}\n\nstatic int __ATTRS_o_ai\nvec_all_ge(vector bool int a, vector unsigned int b)\n{\n  return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, b, (vector unsigned int)a);\n}\n\nstatic int __ATTRS_o_ai\nvec_all_ge(vector bool int a, vector bool int b)\n{\n  return __builtin_altivec_vcmpgtuw_p(__CR6_EQ,\n                                      (vector unsigned int)b,\n                                      (vector unsigned int)a);\n}\n\nstatic int __ATTRS_o_ai\nvec_all_ge(vector float a, vector float b)\n{\n  return __builtin_altivec_vcmpgefp_p(__CR6_LT, a, b);\n}\n\n/* vec_all_gt */\n\nstatic int __ATTRS_o_ai\nvec_all_gt(vector signed char a, vector signed char b)\n{\n  return __builtin_altivec_vcmpgtsb_p(__CR6_LT, a, b);\n}\n\nstatic int __ATTRS_o_ai\nvec_all_gt(vector signed char a, vector bool char b)\n{\n  return __builtin_altivec_vcmpgtsb_p(__CR6_LT, a, (vector signed char)b);\n}\n\nstatic int __ATTRS_o_ai\nvec_all_gt(vector unsigned char a, vector unsigned char b)\n{\n  return __builtin_altivec_vcmpgtub_p(__CR6_LT, a, b);\n}\n\nstatic int __ATTRS_o_ai\nvec_all_gt(vector unsigned char a, vector bool char b)\n{\n  return __builtin_altivec_vcmpgtub_p(__CR6_LT, a, (vector unsigned char)b);\n}\n\nstatic int __ATTRS_o_ai\nvec_all_gt(vector bool char a, vector signed char b)\n{\n  return __builtin_altivec_vcmpgtub_p(__CR6_LT,\n                                      (vector unsigned char)a,\n                                      (vector unsigned char)b);\n}\n\nstatic int __ATTRS_o_ai\nvec_all_gt(vector bool char a, vector unsigned char b)\n{\n  return __builtin_altivec_vcmpgtub_p(__CR6_LT, (vector unsigned char)a, b);\n}\n\nstatic int __ATTRS_o_ai\nvec_all_gt(vector bool char a, vector bool char b)\n{\n  return __builtin_altivec_vcmpgtub_p(__CR6_LT,\n                                      (vector unsigned char)a,\n                                      (vector unsigned char)b);\n}\n\nstatic int __ATTRS_o_ai\nvec_all_gt(vector short a, vector short b)\n{\n  return __builtin_altivec_vcmpgtsh_p(__CR6_LT, a, b);\n}\n\nstatic int __ATTRS_o_ai\nvec_all_gt(vector short a, vector bool short b)\n{\n  return __builtin_altivec_vcmpgtsh_p(__CR6_LT, a, (vector short)b);\n}\n\nstatic int __ATTRS_o_ai\nvec_all_gt(vector unsigned short a, vector unsigned short b)\n{\n  return __builtin_altivec_vcmpgtuh_p(__CR6_LT, a, b);\n}\n\nstatic int __ATTRS_o_ai\nvec_all_gt(vector unsigned short a, vector bool short b)\n{\n  return __builtin_altivec_vcmpgtuh_p(__CR6_LT, a, (vector unsigned short)b);\n}\n\nstatic int __ATTRS_o_ai\nvec_all_gt(vector bool short a, vector short b)\n{\n  return __builtin_altivec_vcmpgtuh_p(__CR6_LT,\n                                      (vector unsigned short)a,\n                                      (vector unsigned short)b);\n}\n\nstatic int __ATTRS_o_ai\nvec_all_gt(vector bool short a, vector unsigned short b)\n{\n  return __builtin_altivec_vcmpgtuh_p(__CR6_LT, (vector unsigned short)a, b);\n}\n\nstatic int __ATTRS_o_ai\nvec_all_gt(vector bool short a, vector bool short b)\n{\n  return __builtin_altivec_vcmpgtuh_p(__CR6_LT,\n                                      (vector unsigned short)a,\n                                      (vector unsigned short)b);\n}\n\nstatic int __ATTRS_o_ai\nvec_all_gt(vector int a, vector int b)\n{\n  return __builtin_altivec_vcmpgtsw_p(__CR6_LT, a, b);\n}\n\nstatic int __ATTRS_o_ai\nvec_all_gt(vector int a, vector bool int b)\n{\n  return __builtin_altivec_vcmpgtsw_p(__CR6_LT, a, (vector int)b);\n}\n\nstatic int __ATTRS_o_ai\nvec_all_gt(vector unsigned int a, vector unsigned int b)\n{\n  return __builtin_altivec_vcmpgtuw_p(__CR6_LT, a, b);\n}\n\nstatic int __ATTRS_o_ai\nvec_all_gt(vector unsigned int a, vector bool int b)\n{\n  return __builtin_altivec_vcmpgtuw_p(__CR6_LT, a, (vector unsigned int)b);\n}\n\nstatic int __ATTRS_o_ai\nvec_all_gt(vector bool int a, vector int b)\n{\n  return __builtin_altivec_vcmpgtuw_p(__CR6_LT,\n                                      (vector unsigned int)a,\n                                      (vector unsigned int)b);\n}\n\nstatic int __ATTRS_o_ai\nvec_all_gt(vector bool int a, vector unsigned int b)\n{\n  return __builtin_altivec_vcmpgtuw_p(__CR6_LT, (vector unsigned int)a, b);\n}\n\nstatic int __ATTRS_o_ai\nvec_all_gt(vector bool int a, vector bool int b)\n{\n  return __builtin_altivec_vcmpgtuw_p(__CR6_LT,\n                                      (vector unsigned int)a,\n                                      (vector unsigned int)b);\n}\n\nstatic int __ATTRS_o_ai\nvec_all_gt(vector float a, vector float b)\n{\n  return __builtin_altivec_vcmpgtfp_p(__CR6_LT, a, b);\n}\n\n/* vec_all_in */\n\nstatic int __attribute__((__always_inline__))\nvec_all_in(vector float a, vector float b)\n{\n  return __builtin_altivec_vcmpbfp_p(__CR6_EQ, a, b);\n}\n\n/* vec_all_le */\n\nstatic int __ATTRS_o_ai\nvec_all_le(vector signed char a, vector signed char b)\n{\n  return __builtin_altivec_vcmpgtsb_p(__CR6_EQ, a, b);\n}\n\nstatic int __ATTRS_o_ai\nvec_all_le(vector signed char a, vector bool char b)\n{\n  return __builtin_altivec_vcmpgtsb_p(__CR6_EQ, a, (vector signed char)b);\n}\n\nstatic int __ATTRS_o_ai\nvec_all_le(vector unsigned char a, vector unsigned char b)\n{\n  return __builtin_altivec_vcmpgtub_p(__CR6_EQ, a, b);\n}\n\nstatic int __ATTRS_o_ai\nvec_all_le(vector unsigned char a, vector bool char b)\n{\n  return __builtin_altivec_vcmpgtub_p(__CR6_EQ, a, (vector unsigned char)b);\n}\n\nstatic int __ATTRS_o_ai\nvec_all_le(vector bool char a, vector signed char b)\n{\n  return __builtin_altivec_vcmpgtub_p(__CR6_EQ,\n                                      (vector unsigned char)a,\n                                      (vector unsigned char)b);\n}\n\nstatic int __ATTRS_o_ai\nvec_all_le(vector bool char a, vector unsigned char b)\n{\n  return __builtin_altivec_vcmpgtub_p(__CR6_EQ, (vector unsigned char)a, b);\n}\n\nstatic int __ATTRS_o_ai\nvec_all_le(vector bool char a, vector bool char b)\n{\n  return __builtin_altivec_vcmpgtub_p(__CR6_EQ,\n                                      (vector unsigned char)a,\n                                      (vector unsigned char)b);\n}\n\nstatic int __ATTRS_o_ai\nvec_all_le(vector short a, vector short b)\n{\n  return __builtin_altivec_vcmpgtsh_p(__CR6_EQ, a, b);\n}\n\nstatic int __ATTRS_o_ai\nvec_all_le(vector short a, vector bool short b)\n{\n  return __builtin_altivec_vcmpgtsh_p(__CR6_EQ, a, (vector short)b);\n}\n\nstatic int __ATTRS_o_ai\nvec_all_le(vector unsigned short a, vector unsigned short b)\n{\n  return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, a, b);\n}\n\nstatic int __ATTRS_o_ai\nvec_all_le(vector unsigned short a, vector bool short b)\n{\n  return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, a, (vector unsigned short)b);\n}\n\nstatic int __ATTRS_o_ai\nvec_all_le(vector bool short a, vector short b)\n{\n  return __builtin_altivec_vcmpgtuh_p(__CR6_EQ,\n                                      (vector unsigned short)a,\n                                      (vector unsigned short)b);\n}\n\nstatic int __ATTRS_o_ai\nvec_all_le(vector bool short a, vector unsigned short b)\n{\n  return __builtin_altivec_vcmpgtuh_p(__CR6_EQ, (vector unsigned short)a, b);\n}\n\nstatic int __ATTRS_o_ai\nvec_all_le(vector bool short a, vector bool short b)\n{\n  return __builtin_altivec_vcmpgtuh_p(__CR6_EQ,\n                                      (vector unsigned short)a,\n                                      (vector unsigned short)b);\n}\n\nstatic int __ATTRS_o_ai\nvec_all_le(vector int a, vector int b)\n{\n  return __builtin_altivec_vcmpgtsw_p(__CR6_EQ, a, b);\n}\n\nstatic int __ATTRS_o_ai\nvec_all_le(vector int a, vector bool int b)\n{\n  return __builtin_altivec_vcmpgtsw_p(__CR6_EQ, a, (vector int)b);\n}\n\nstatic int __ATTRS_o_ai\nvec_all_le(vector unsigned int a, vector unsigned int b)\n{\n  return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, a, b);\n}\n\nstatic int __ATTRS_o_ai\nvec_all_le(vector unsigned int a, vector bool int b)\n{\n  return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, a, (vector unsigned int)b);\n}\n\nstatic int __ATTRS_o_ai\nvec_all_le(vector bool int a, vector int b)\n{\n  return __builtin_altivec_vcmpgtuw_p(__CR6_EQ,\n                                      (vector unsigned int)a,\n                                      (vector unsigned int)b);\n}\n\nstatic int __ATTRS_o_ai\nvec_all_le(vector bool int a, vector unsigned int b)\n{\n  return __builtin_altivec_vcmpgtuw_p(__CR6_EQ, (vector unsigned int)a, b);\n}\n\nstatic int __ATTRS_o_ai\nvec_all_le(vector bool int a, vector bool int b)\n{\n  return __builtin_altivec_vcmpgtuw_p(__CR6_EQ,\n                                      (vector unsigned int)a,\n                                      (vector unsigned int)b);\n}\n\nstatic int __ATTRS_o_ai\nvec_all_le(vector float a, vector float b)\n{\n  return __builtin_altivec_vcmpgefp_p(__CR6_LT, b, a);\n}\n\n/* vec_all_lt */\n\nstatic int __ATTRS_o_ai\nvec_all_lt(vector signed char a, vector signed char b)\n{\n  return __builtin_altivec_vcmpgtsb_p(__CR6_LT, b, a);\n}\n\nstatic int __ATTRS_o_ai\nvec_all_lt(vector signed char a, vector bool char b)\n{\n  return __builtin_altivec_vcmpgtsb_p(__CR6_LT, (vector signed char)b, a);\n}\n\nstatic int __ATTRS_o_ai\nvec_all_lt(vector unsigned char a, vector unsigned char b)\n{\n  return __builtin_altivec_vcmpgtub_p(__CR6_LT, b, a);\n}\n\nstatic int __ATTRS_o_ai\nvec_all_lt(vector unsigned char a, vector bool char b)\n{\n  return __builtin_altivec_vcmpgtub_p(__CR6_LT, (vector unsigned char)b, a);\n}\n\nstatic int __ATTRS_o_ai\nvec_all_lt(vector bool char a, vector signed char b)\n{\n  return __builtin_altivec_vcmpgtub_p(__CR6_LT,\n                                      (vector unsigned char)b,\n                                      (vector unsigned char)a);\n}\n\nstatic int __ATTRS_o_ai\nvec_all_lt(vector bool char a, vector unsigned char b)\n{\n  return __builtin_altivec_vcmpgtub_p(__CR6_LT, b, (vector unsigned char)a);\n}\n\nstatic int __ATTRS_o_ai\nvec_all_lt(vector bool char a, vector bool char b)\n{\n  return __builtin_altivec_vcmpgtub_p(__CR6_LT,\n                                      (vector unsigned char)b,\n                                      (vector unsigned char)a);\n}\n\nstatic int __ATTRS_o_ai\nvec_all_lt(vector short a, vector short b)\n{\n  return __builtin_altivec_vcmpgtsh_p(__CR6_LT, b, a);\n}\n\nstatic int __ATTRS_o_ai\nvec_all_lt(vector short a, vector bool short b)\n{\n  return __builtin_altivec_vcmpgtsh_p(__CR6_LT, (vector short)b, a);\n}\n\nstatic int __ATTRS_o_ai\nvec_all_lt(vector unsigned short a, vector unsigned short b)\n{\n  return __builtin_altivec_vcmpgtuh_p(__CR6_LT, b, a);\n}\n\nstatic int __ATTRS_o_ai\nvec_all_lt(vector unsigned short a, vector bool short b)\n{\n  return __builtin_altivec_vcmpgtuh_p(__CR6_LT, (vector unsigned short)b, a);\n}\n\nstatic int __ATTRS_o_ai\nvec_all_lt(vector bool short a, vector short b)\n{\n  return __builtin_altivec_vcmpgtuh_p(__CR6_LT,\n                                      (vector unsigned short)b,\n                                      (vector unsigned short)a);\n}\n\nstatic int __ATTRS_o_ai\nvec_all_lt(vector bool short a, vector unsigned short b)\n{\n  return __builtin_altivec_vcmpgtuh_p(__CR6_LT, b, (vector unsigned short)a);\n}\n\nstatic int __ATTRS_o_ai\nvec_all_lt(vector bool short a, vector bool short b)\n{\n  return __builtin_altivec_vcmpgtuh_p(__CR6_LT,\n                                      (vector unsigned short)b,\n                                      (vector unsigned short)a);\n}\n\nstatic int __ATTRS_o_ai\nvec_all_lt(vector int a, vector int b)\n{\n  return __builtin_altivec_vcmpgtsw_p(__CR6_LT, b, a);\n}\n\nstatic int __ATTRS_o_ai\nvec_all_lt(vector int a, vector bool int b)\n{\n  return __builtin_altivec_vcmpgtsw_p(__CR6_LT, (vector int)b, a);\n}\n\nstatic int __ATTRS_o_ai\nvec_all_lt(vector unsigned int a, vector unsigned int b)\n{\n  return __builtin_altivec_vcmpgtuw_p(__CR6_LT, b, a);\n}\n\nstatic int __ATTRS_o_ai\nvec_all_lt(vector unsigned int a, vector bool int b)\n{\n  return __builtin_altivec_vcmpgtuw_p(__CR6_LT, (vector unsigned int)b, a);\n}\n\nstatic int __ATTRS_o_ai\nvec_all_lt(vector bool int a, vector int b)\n{\n  return __builtin_altivec_vcmpgtuw_p(__CR6_LT,\n                                      (vector unsigned int)b,\n                                      (vector unsigned int)a);\n}\n\nstatic int __ATTRS_o_ai\nvec_all_lt(vector bool int a, vector unsigned int b)\n{\n  return __builtin_altivec_vcmpgtuw_p(__CR6_LT, b, (vector unsigned int)a);\n}\n\nstatic int __ATTRS_o_ai\nvec_all_lt(vector bool int a, vector bool int b)\n{\n  return __builtin_altivec_vcmpgtuw_p(__CR6_LT,\n                                      (vector unsigned int)b,\n                                      (vector unsigned int)a);\n}\n\nstatic int __ATTRS_o_ai\nvec_all_lt(vector float a, vector float b)\n{\n  return __builtin_altivec_vcmpgtfp_p(__CR6_LT, b, a);\n}\n\n/* vec_all_nan */\n\nstatic int __attribute__((__always_inline__))\nvec_all_nan(vector float a)\n{\n  return __builtin_altivec_vcmpeqfp_p(__CR6_EQ, a, a);\n}\n\n/* vec_all_ne */\n\nstatic int __ATTRS_o_ai\nvec_all_ne(vector signed char a, vector signed char b)\n{\n  return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)a, (vector char)b);\n}\n\nstatic int __ATTRS_o_ai\nvec_all_ne(vector signed char a, vector bool char b)\n{\n  return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)a, (vector char)b);\n}\n\nstatic int __ATTRS_o_ai\nvec_all_ne(vector unsigned char a, vector unsigned char b)\n{\n  return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)a, (vector char)b);\n}\n\nstatic int __ATTRS_o_ai\nvec_all_ne(vector unsigned char a, vector bool char b)\n{\n  return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)a, (vector char)b);\n}\n\nstatic int __ATTRS_o_ai\nvec_all_ne(vector bool char a, vector signed char b)\n{\n  return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)a, (vector char)b);\n}\n\nstatic int __ATTRS_o_ai\nvec_all_ne(vector bool char a, vector unsigned char b)\n{\n  return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)a, (vector char)b);\n}\n\nstatic int __ATTRS_o_ai\nvec_all_ne(vector bool char a, vector bool char b)\n{\n  return __builtin_altivec_vcmpequb_p(__CR6_EQ, (vector char)a, (vector char)b);\n}\n\nstatic int __ATTRS_o_ai\nvec_all_ne(vector short a, vector short b)\n{\n  return __builtin_altivec_vcmpequh_p(__CR6_EQ, a, b);\n}\n\nstatic int __ATTRS_o_ai\nvec_all_ne(vector short a, vector bool short b)\n{\n  return __builtin_altivec_vcmpequh_p(__CR6_EQ, a, (vector short)b);\n}\n\nstatic int __ATTRS_o_ai\nvec_all_ne(vector unsigned short a, vector unsigned short b)\n{\n  return\n    __builtin_altivec_vcmpequh_p(__CR6_EQ, (vector short)a, (vector short)b);\n}\n\nstatic int __ATTRS_o_ai\nvec_all_ne(vector unsigned short a, vector bool short b)\n{\n  return\n    __builtin_altivec_vcmpequh_p(__CR6_EQ, (vector short)a, (vector short)b);\n}\n\nstatic int __ATTRS_o_ai\nvec_all_ne(vector bool short a, vector short b)\n{\n  return\n    __builtin_altivec_vcmpequh_p(__CR6_EQ, (vector short)a, (vector short)b);\n}\n\nstatic int __ATTRS_o_ai\nvec_all_ne(vector bool short a, vector unsigned short b)\n{\n  return\n    __builtin_altivec_vcmpequh_p(__CR6_EQ, (vector short)a, (vector short)b);\n}\n\nstatic int __ATTRS_o_ai\nvec_all_ne(vector bool short a, vector bool short b)\n{\n  return\n    __builtin_altivec_vcmpequh_p(__CR6_EQ, (vector short)a, (vector short)b);\n}\n\nstatic int __ATTRS_o_ai\nvec_all_ne(vector pixel a, vector pixel b)\n{\n  return\n    __builtin_altivec_vcmpequh_p(__CR6_EQ, (vector short)a, (vector short)b);\n}\n\nstatic int __ATTRS_o_ai\nvec_all_ne(vector int a, vector int b)\n{\n  return __builtin_altivec_vcmpequw_p(__CR6_EQ, a, b);\n}\n\nstatic int __ATTRS_o_ai\nvec_all_ne(vector int a, vector bool int b)\n{\n  return __builtin_altivec_vcmpequw_p(__CR6_EQ, a, (vector int)b);\n}\n\nstatic int __ATTRS_o_ai\nvec_all_ne(vector unsigned int a, vector unsigned int b)\n{\n  return __builtin_altivec_vcmpequw_p(__CR6_EQ, (vector int)a, (vector int)b);\n}\n\nstatic int __ATTRS_o_ai\nvec_all_ne(vector unsigned int a, vector bool int b)\n{\n  return __builtin_altivec_vcmpequw_p(__CR6_EQ, (vector int)a, (vector int)b);\n}\n\nstatic int __ATTRS_o_ai\nvec_all_ne(vector bool int a, vector int b)\n{\n  return __builtin_altivec_vcmpequw_p(__CR6_EQ, (vector int)a, (vector int)b);\n}\n\nstatic int __ATTRS_o_ai\nvec_all_ne(vector bool int a, vector unsigned int b)\n{\n  return __builtin_altivec_vcmpequw_p(__CR6_EQ, (vector int)a, (vector int)b);\n}\n\nstatic int __ATTRS_o_ai\nvec_all_ne(vector bool int a, vector bool int b)\n{\n  return __builtin_altivec_vcmpequw_p(__CR6_EQ, (vector int)a, (vector int)b);\n}\n\nstatic int __ATTRS_o_ai\nvec_all_ne(vector float a, vector float b)\n{\n  return __builtin_altivec_vcmpeqfp_p(__CR6_EQ, a, b);\n}\n\n/* vec_all_nge */\n\nstatic int __attribute__((__always_inline__))\nvec_all_nge(vector float a, vector float b)\n{\n  return __builtin_altivec_vcmpgefp_p(__CR6_EQ, a, b);\n}\n\n/* vec_all_ngt */\n\nstatic int __attribute__((__always_inline__))\nvec_all_ngt(vector float a, vector float b)\n{\n  return __builtin_altivec_vcmpgtfp_p(__CR6_EQ, a, b);\n}\n\n/* vec_all_nle */\n\nstatic int __attribute__((__always_inline__))\nvec_all_nle(vector float a, vector float b)\n{\n  return __builtin_altivec_vcmpgefp_p(__CR6_EQ, b, a);\n}\n\n/* vec_all_nlt */\n\nstatic int __attribute__((__always_inline__))\nvec_all_nlt(vector float a, vector float b)\n{\n  return __builtin_altivec_vcmpgtfp_p(__CR6_EQ, b, a);\n}\n\n/* vec_all_numeric */\n\nstatic int __attribute__((__always_inline__))\nvec_all_numeric(vector float a)\n{\n  return __builtin_altivec_vcmpeqfp_p(__CR6_LT, a, a);\n}\n\n/* vec_any_eq */\n\nstatic int __ATTRS_o_ai\nvec_any_eq(vector signed char a, vector signed char b)\n{\n  return\n    __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)a, (vector char)b);\n}\n\nstatic int __ATTRS_o_ai\nvec_any_eq(vector signed char a, vector bool char b)\n{\n  return\n    __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)a, (vector char)b);\n}\n\nstatic int __ATTRS_o_ai\nvec_any_eq(vector unsigned char a, vector unsigned char b)\n{\n  return\n    __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)a, (vector char)b);\n}\n\nstatic int __ATTRS_o_ai\nvec_any_eq(vector unsigned char a, vector bool char b)\n{\n  return\n    __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)a, (vector char)b);\n}\n\nstatic int __ATTRS_o_ai\nvec_any_eq(vector bool char a, vector signed char b)\n{\n  return\n    __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)a, (vector char)b);\n}\n\nstatic int __ATTRS_o_ai\nvec_any_eq(vector bool char a, vector unsigned char b)\n{\n  return\n    __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)a, (vector char)b);\n}\n\nstatic int __ATTRS_o_ai\nvec_any_eq(vector bool char a, vector bool char b)\n{\n  return\n    __builtin_altivec_vcmpequb_p(__CR6_EQ_REV, (vector char)a, (vector char)b);\n}\n\nstatic int __ATTRS_o_ai\nvec_any_eq(vector short a, vector short b)\n{\n  return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, a, b);\n}\n\nstatic int __ATTRS_o_ai\nvec_any_eq(vector short a, vector bool short b)\n{\n  return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, a, (vector short)b);\n}\n\nstatic int __ATTRS_o_ai\nvec_any_eq(vector unsigned short a, vector unsigned short b)\n{\n  return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, \n                                      (vector short)a,\n                                      (vector short)b);\n}\n\nstatic int __ATTRS_o_ai\nvec_any_eq(vector unsigned short a, vector bool short b)\n{\n  return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, \n                                      (vector short)a,\n                                      (vector short)b);\n}\n\nstatic int __ATTRS_o_ai\nvec_any_eq(vector bool short a, vector short b)\n{\n  return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV,\n                                      (vector short)a,\n                                      (vector short)b);\n}\n\nstatic int __ATTRS_o_ai\nvec_any_eq(vector bool short a, vector unsigned short b)\n{\n  return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV,\n                                      (vector short)a,\n                                      (vector short)b);\n}\n\nstatic int __ATTRS_o_ai\nvec_any_eq(vector bool short a, vector bool short b)\n{\n  return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV,\n                                      (vector short)a,\n                                      (vector short)b);\n}\n\nstatic int __ATTRS_o_ai\nvec_any_eq(vector pixel a, vector pixel b)\n{\n  return __builtin_altivec_vcmpequh_p(__CR6_EQ_REV, \n                                      (vector short)a,\n                                      (vector short)b);\n}\n\nstatic int __ATTRS_o_ai\nvec_any_eq(vector int a, vector int b)\n{\n  return __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, a, b);\n}\n\nstatic int __ATTRS_o_ai\nvec_any_eq(vector int a, vector bool int b)\n{\n  return __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, a, (vector int)b);\n}\n\nstatic int __ATTRS_o_ai\nvec_any_eq(vector unsigned int a, vector unsigned int b)\n{\n  return\n    __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, (vector int)a, (vector int)b);\n}\n\nstatic int __ATTRS_o_ai\nvec_any_eq(vector unsigned int a, vector bool int b)\n{\n  return\n    __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, (vector int)a, (vector int)b);\n}\n\nstatic int __ATTRS_o_ai\nvec_any_eq(vector bool int a, vector int b)\n{\n  return\n    __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, (vector int)a, (vector int)b);\n}\n\nstatic int __ATTRS_o_ai\nvec_any_eq(vector bool int a, vector unsigned int b)\n{\n  return\n    __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, (vector int)a, (vector int)b);\n}\n\nstatic int __ATTRS_o_ai\nvec_any_eq(vector bool int a, vector bool int b)\n{\n  return\n    __builtin_altivec_vcmpequw_p(__CR6_EQ_REV, (vector int)a, (vector int)b);\n}\n\nstatic int __ATTRS_o_ai\nvec_any_eq(vector float a, vector float b)\n{\n  return __builtin_altivec_vcmpeqfp_p(__CR6_EQ_REV, a, b);\n}\n\n/* vec_any_ge */\n\nstatic int __ATTRS_o_ai\nvec_any_ge(vector signed char a, vector signed char b)\n{\n  return __builtin_altivec_vcmpgtsb_p(__CR6_LT_REV, b, a);\n}\n\nstatic int __ATTRS_o_ai\nvec_any_ge(vector signed char a, vector bool char b)\n{\n  return __builtin_altivec_vcmpgtsb_p(__CR6_LT_REV, (vector signed char)b, a);\n}\n\nstatic int __ATTRS_o_ai\nvec_any_ge(vector unsigned char a, vector unsigned char b)\n{\n  return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, b, a);\n}\n\nstatic int __ATTRS_o_ai\nvec_any_ge(vector unsigned char a, vector bool char b)\n{\n  return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, (vector unsigned char)b, a);\n}\n\nstatic int __ATTRS_o_ai\nvec_any_ge(vector bool char a, vector signed char b)\n{\n  return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV,\n                                      (vector unsigned char)b,\n                                      (vector unsigned char)a);\n}\n\nstatic int __ATTRS_o_ai\nvec_any_ge(vector bool char a, vector unsigned char b)\n{\n  return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, b, (vector unsigned char)a);\n}\n\nstatic int __ATTRS_o_ai\nvec_any_ge(vector bool char a, vector bool char b)\n{\n  return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV,\n                                      (vector unsigned char)b,\n                                      (vector unsigned char)a);\n}\n\nstatic int __ATTRS_o_ai\nvec_any_ge(vector short a, vector short b)\n{\n  return __builtin_altivec_vcmpgtsh_p(__CR6_LT_REV, b, a);\n}\n\nstatic int __ATTRS_o_ai\nvec_any_ge(vector short a, vector bool short b)\n{\n  return __builtin_altivec_vcmpgtsh_p(__CR6_LT_REV, (vector short)b, a);\n}\n\nstatic int __ATTRS_o_ai\nvec_any_ge(vector unsigned short a, vector unsigned short b)\n{\n  return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, b, a);\n}\n\nstatic int __ATTRS_o_ai\nvec_any_ge(vector unsigned short a, vector bool short b)\n{\n  return\n    __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, (vector unsigned short)b, a);\n}\n\nstatic int __ATTRS_o_ai\nvec_any_ge(vector bool short a, vector short b)\n{\n  return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV,\n                                      (vector unsigned short)b,\n                                      (vector unsigned short)a);\n}\n\nstatic int __ATTRS_o_ai\nvec_any_ge(vector bool short a, vector unsigned short b)\n{\n  return \n    __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, b, (vector unsigned short)a);\n}\n\nstatic int __ATTRS_o_ai\nvec_any_ge(vector bool short a, vector bool short b)\n{\n  return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV,\n                                      (vector unsigned short)b,\n                                      (vector unsigned short)a);\n}\n\nstatic int __ATTRS_o_ai\nvec_any_ge(vector int a, vector int b)\n{\n  return __builtin_altivec_vcmpgtsw_p(__CR6_LT_REV, b, a);\n}\n\nstatic int __ATTRS_o_ai\nvec_any_ge(vector int a, vector bool int b)\n{\n  return __builtin_altivec_vcmpgtsw_p(__CR6_LT_REV, (vector int)b, a);\n}\n\nstatic int __ATTRS_o_ai\nvec_any_ge(vector unsigned int a, vector unsigned int b)\n{\n  return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, b, a);\n}\n\nstatic int __ATTRS_o_ai\nvec_any_ge(vector unsigned int a, vector bool int b)\n{\n  return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, (vector unsigned int)b, a);\n}\n\nstatic int __ATTRS_o_ai\nvec_any_ge(vector bool int a, vector int b)\n{\n  return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV,\n                                      (vector unsigned int)b,\n                                      (vector unsigned int)a);\n}\n\nstatic int __ATTRS_o_ai\nvec_any_ge(vector bool int a, vector unsigned int b)\n{\n  return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, b, (vector unsigned int)a);\n}\n\nstatic int __ATTRS_o_ai\nvec_any_ge(vector bool int a, vector bool int b)\n{\n  return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV,\n                                      (vector unsigned int)b,\n                                      (vector unsigned int)a);\n}\n\nstatic int __ATTRS_o_ai\nvec_any_ge(vector float a, vector float b)\n{\n  return __builtin_altivec_vcmpgefp_p(__CR6_EQ_REV, a, b);\n}\n\n/* vec_any_gt */\n\nstatic int __ATTRS_o_ai\nvec_any_gt(vector signed char a, vector signed char b)\n{\n  return __builtin_altivec_vcmpgtsb_p(__CR6_EQ_REV, a, b);\n}\n\nstatic int __ATTRS_o_ai\nvec_any_gt(vector signed char a, vector bool char b)\n{\n  return __builtin_altivec_vcmpgtsb_p(__CR6_EQ_REV, a, (vector signed char)b);\n}\n\nstatic int __ATTRS_o_ai\nvec_any_gt(vector unsigned char a, vector unsigned char b)\n{\n  return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, a, b);\n}\n\nstatic int __ATTRS_o_ai\nvec_any_gt(vector unsigned char a, vector bool char b)\n{\n  return \n    __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, a, (vector unsigned char)b);\n}\n\nstatic int __ATTRS_o_ai\nvec_any_gt(vector bool char a, vector signed char b)\n{\n  return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV,\n                                      (vector unsigned char)a,\n                                      (vector unsigned char)b);\n}\n\nstatic int __ATTRS_o_ai\nvec_any_gt(vector bool char a, vector unsigned char b)\n{\n  return \n    __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, (vector unsigned char)a, b);\n}\n\nstatic int __ATTRS_o_ai\nvec_any_gt(vector bool char a, vector bool char b)\n{\n  return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV,\n                                      (vector unsigned char)a,\n                                      (vector unsigned char)b);\n}\n\nstatic int __ATTRS_o_ai\nvec_any_gt(vector short a, vector short b)\n{\n  return __builtin_altivec_vcmpgtsh_p(__CR6_EQ_REV, a, b);\n}\n\nstatic int __ATTRS_o_ai\nvec_any_gt(vector short a, vector bool short b)\n{\n  return __builtin_altivec_vcmpgtsh_p(__CR6_EQ_REV, a, (vector short)b);\n}\n\nstatic int __ATTRS_o_ai\nvec_any_gt(vector unsigned short a, vector unsigned short b)\n{\n  return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, a, b);\n}\n\nstatic int __ATTRS_o_ai\nvec_any_gt(vector unsigned short a, vector bool short b)\n{\n  return \n    __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, a, (vector unsigned short)b);\n}\n\nstatic int __ATTRS_o_ai\nvec_any_gt(vector bool short a, vector short b)\n{\n  return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV,\n                                      (vector unsigned short)a,\n                                      (vector unsigned short)b);\n}\n\nstatic int __ATTRS_o_ai\nvec_any_gt(vector bool short a, vector unsigned short b)\n{\n  return\n    __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, (vector unsigned short)a, b);\n}\n\nstatic int __ATTRS_o_ai\nvec_any_gt(vector bool short a, vector bool short b)\n{\n  return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV,\n                                      (vector unsigned short)a,\n                                      (vector unsigned short)b);\n}\n\nstatic int __ATTRS_o_ai\nvec_any_gt(vector int a, vector int b)\n{\n  return __builtin_altivec_vcmpgtsw_p(__CR6_EQ_REV, a, b);\n}\n\nstatic int __ATTRS_o_ai\nvec_any_gt(vector int a, vector bool int b)\n{\n  return __builtin_altivec_vcmpgtsw_p(__CR6_EQ_REV, a, (vector int)b);\n}\n\nstatic int __ATTRS_o_ai\nvec_any_gt(vector unsigned int a, vector unsigned int b)\n{\n  return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, a, b);\n}\n\nstatic int __ATTRS_o_ai\nvec_any_gt(vector unsigned int a, vector bool int b)\n{\n  return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, a, (vector unsigned int)b);\n}\n\nstatic int __ATTRS_o_ai\nvec_any_gt(vector bool int a, vector int b)\n{\n  return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV,\n                                      (vector unsigned int)a,\n                                      (vector unsigned int)b);\n}\n\nstatic int __ATTRS_o_ai\nvec_any_gt(vector bool int a, vector unsigned int b)\n{\n  return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, (vector unsigned int)a, b);\n}\n\nstatic int __ATTRS_o_ai\nvec_any_gt(vector bool int a, vector bool int b)\n{\n  return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV,\n                                      (vector unsigned int)a,\n                                      (vector unsigned int)b);\n}\n\nstatic int __ATTRS_o_ai\nvec_any_gt(vector float a, vector float b)\n{\n  return __builtin_altivec_vcmpgtfp_p(__CR6_EQ_REV, a, b);\n}\n\n/* vec_any_le */\n\nstatic int __ATTRS_o_ai\nvec_any_le(vector signed char a, vector signed char b)\n{\n  return __builtin_altivec_vcmpgtsb_p(__CR6_LT_REV, a, b);\n}\n\nstatic int __ATTRS_o_ai\nvec_any_le(vector signed char a, vector bool char b)\n{\n  return __builtin_altivec_vcmpgtsb_p(__CR6_LT_REV, a, (vector signed char)b);\n}\n\nstatic int __ATTRS_o_ai\nvec_any_le(vector unsigned char a, vector unsigned char b)\n{\n  return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, a, b);\n}\n\nstatic int __ATTRS_o_ai\nvec_any_le(vector unsigned char a, vector bool char b)\n{\n  return \n    __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, a, (vector unsigned char)b);\n}\n\nstatic int __ATTRS_o_ai\nvec_any_le(vector bool char a, vector signed char b)\n{\n  return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV,\n                                      (vector unsigned char)a,\n                                      (vector unsigned char)b);\n}\n\nstatic int __ATTRS_o_ai\nvec_any_le(vector bool char a, vector unsigned char b)\n{\n  return \n    __builtin_altivec_vcmpgtub_p(__CR6_LT_REV, (vector unsigned char)a, b);\n}\n\nstatic int __ATTRS_o_ai\nvec_any_le(vector bool char a, vector bool char b)\n{\n  return __builtin_altivec_vcmpgtub_p(__CR6_LT_REV,\n                                      (vector unsigned char)a,\n                                      (vector unsigned char)b);\n}\n\nstatic int __ATTRS_o_ai\nvec_any_le(vector short a, vector short b)\n{\n  return __builtin_altivec_vcmpgtsh_p(__CR6_LT_REV, a, b);\n}\n\nstatic int __ATTRS_o_ai\nvec_any_le(vector short a, vector bool short b)\n{\n  return __builtin_altivec_vcmpgtsh_p(__CR6_LT_REV, a, (vector short)b);\n}\n\nstatic int __ATTRS_o_ai\nvec_any_le(vector unsigned short a, vector unsigned short b)\n{\n  return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, a, b);\n}\n\nstatic int __ATTRS_o_ai\nvec_any_le(vector unsigned short a, vector bool short b)\n{\n  return \n    __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, a, (vector unsigned short)b);\n}\n\nstatic int __ATTRS_o_ai\nvec_any_le(vector bool short a, vector short b)\n{\n  return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV,\n                                      (vector unsigned short)a,\n                                      (vector unsigned short)b);\n}\n\nstatic int __ATTRS_o_ai\nvec_any_le(vector bool short a, vector unsigned short b)\n{\n  return \n    __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV, (vector unsigned short)a, b);\n}\n\nstatic int __ATTRS_o_ai\nvec_any_le(vector bool short a, vector bool short b)\n{\n  return __builtin_altivec_vcmpgtuh_p(__CR6_LT_REV,\n                                      (vector unsigned short)a,\n                                      (vector unsigned short)b);\n}\n\nstatic int __ATTRS_o_ai\nvec_any_le(vector int a, vector int b)\n{\n  return __builtin_altivec_vcmpgtsw_p(__CR6_LT_REV, a, b);\n}\n\nstatic int __ATTRS_o_ai\nvec_any_le(vector int a, vector bool int b)\n{\n  return __builtin_altivec_vcmpgtsw_p(__CR6_LT_REV, a, (vector int)b);\n}\n\nstatic int __ATTRS_o_ai\nvec_any_le(vector unsigned int a, vector unsigned int b)\n{\n  return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, a, b);\n}\n\nstatic int __ATTRS_o_ai\nvec_any_le(vector unsigned int a, vector bool int b)\n{\n  return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, a, (vector unsigned int)b);\n}\n\nstatic int __ATTRS_o_ai\nvec_any_le(vector bool int a, vector int b)\n{\n  return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV,\n                                      (vector unsigned int)a,\n                                      (vector unsigned int)b);\n}\n\nstatic int __ATTRS_o_ai\nvec_any_le(vector bool int a, vector unsigned int b)\n{\n  return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV, (vector unsigned int)a, b);\n}\n\nstatic int __ATTRS_o_ai\nvec_any_le(vector bool int a, vector bool int b)\n{\n  return __builtin_altivec_vcmpgtuw_p(__CR6_LT_REV,\n                                      (vector unsigned int)a,\n                                      (vector unsigned int)b);\n}\n\nstatic int __ATTRS_o_ai\nvec_any_le(vector float a, vector float b)\n{\n  return __builtin_altivec_vcmpgefp_p(__CR6_EQ_REV, b, a);\n}\n\n/* vec_any_lt */\n\nstatic int __ATTRS_o_ai\nvec_any_lt(vector signed char a, vector signed char b)\n{\n  return __builtin_altivec_vcmpgtsb_p(__CR6_EQ_REV, b, a);\n}\n\nstatic int __ATTRS_o_ai\nvec_any_lt(vector signed char a, vector bool char b)\n{\n  return __builtin_altivec_vcmpgtsb_p(__CR6_EQ_REV, (vector signed char)b, a);\n}\n\nstatic int __ATTRS_o_ai\nvec_any_lt(vector unsigned char a, vector unsigned char b)\n{\n  return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, b, a);\n}\n\nstatic int __ATTRS_o_ai\nvec_any_lt(vector unsigned char a, vector bool char b)\n{\n  return \n    __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, (vector unsigned char)b, a);\n}\n\nstatic int __ATTRS_o_ai\nvec_any_lt(vector bool char a, vector signed char b)\n{\n  return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV,\n                                      (vector unsigned char)b,\n                                      (vector unsigned char)a);\n}\n\nstatic int __ATTRS_o_ai\nvec_any_lt(vector bool char a, vector unsigned char b)\n{\n  return \n    __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV, b, (vector unsigned char)a);\n}\n\nstatic int __ATTRS_o_ai\nvec_any_lt(vector bool char a, vector bool char b)\n{\n  return __builtin_altivec_vcmpgtub_p(__CR6_EQ_REV,\n                                      (vector unsigned char)b,\n                                      (vector unsigned char)a);\n}\n\nstatic int __ATTRS_o_ai\nvec_any_lt(vector short a, vector short b)\n{\n  return __builtin_altivec_vcmpgtsh_p(__CR6_EQ_REV, b, a);\n}\n\nstatic int __ATTRS_o_ai\nvec_any_lt(vector short a, vector bool short b)\n{\n  return __builtin_altivec_vcmpgtsh_p(__CR6_EQ_REV, (vector short)b, a);\n}\n\nstatic int __ATTRS_o_ai\nvec_any_lt(vector unsigned short a, vector unsigned short b)\n{\n  return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, b, a);\n}\n\nstatic int __ATTRS_o_ai\nvec_any_lt(vector unsigned short a, vector bool short b)\n{\n  return \n    __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, (vector unsigned short)b, a);\n}\n\nstatic int __ATTRS_o_ai\nvec_any_lt(vector bool short a, vector short b)\n{\n  return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV,\n                                      (vector unsigned short)b,\n                                      (vector unsigned short)a);\n}\n\nstatic int __ATTRS_o_ai\nvec_any_lt(vector bool short a, vector unsigned short b)\n{\n  return \n    __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV, b, (vector unsigned short)a);\n}\n\nstatic int __ATTRS_o_ai\nvec_any_lt(vector bool short a, vector bool short b)\n{\n  return __builtin_altivec_vcmpgtuh_p(__CR6_EQ_REV,\n                                      (vector unsigned short)b,\n                                      (vector unsigned short)a);\n}\n\nstatic int __ATTRS_o_ai\nvec_any_lt(vector int a, vector int b)\n{\n  return __builtin_altivec_vcmpgtsw_p(__CR6_EQ_REV, b, a);\n}\n\nstatic int __ATTRS_o_ai\nvec_any_lt(vector int a, vector bool int b)\n{\n  return __builtin_altivec_vcmpgtsw_p(__CR6_EQ_REV, (vector int)b, a);\n}\n\nstatic int __ATTRS_o_ai\nvec_any_lt(vector unsigned int a, vector unsigned int b)\n{\n  return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, b, a);\n}\n\nstatic int __ATTRS_o_ai\nvec_any_lt(vector unsigned int a, vector bool int b)\n{\n  return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, (vector unsigned int)b, a);\n}\n\nstatic int __ATTRS_o_ai\nvec_any_lt(vector bool int a, vector int b)\n{\n  return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV,\n                                      (vector unsigned int)b,\n                                      (vector unsigned int)a);\n}\n\nstatic int __ATTRS_o_ai\nvec_any_lt(vector bool int a, vector unsigned int b)\n{\n  return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV, b, (vector unsigned int)a);\n}\n\nstatic int __ATTRS_o_ai\nvec_any_lt(vector bool int a, vector bool int b)\n{\n  return __builtin_altivec_vcmpgtuw_p(__CR6_EQ_REV,\n                                      (vector unsigned int)b,\n                                      (vector unsigned int)a);\n}\n\nstatic int __ATTRS_o_ai\nvec_any_lt(vector float a, vector float b)\n{\n  return __builtin_altivec_vcmpgtfp_p(__CR6_EQ_REV, b, a);\n}\n\n/* vec_any_nan */\n\nstatic int __attribute__((__always_inline__))\nvec_any_nan(vector float a)\n{\n  return __builtin_altivec_vcmpeqfp_p(__CR6_LT_REV, a, a);\n}\n\n/* vec_any_ne */\n\nstatic int __ATTRS_o_ai\nvec_any_ne(vector signed char a, vector signed char b)\n{\n  return\n    __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)a, (vector char)b);\n}\n\nstatic int __ATTRS_o_ai\nvec_any_ne(vector signed char a, vector bool char b)\n{\n  return\n    __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)a, (vector char)b);\n}\n\nstatic int __ATTRS_o_ai\nvec_any_ne(vector unsigned char a, vector unsigned char b)\n{\n  return\n    __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)a, (vector char)b);\n}\n\nstatic int __ATTRS_o_ai\nvec_any_ne(vector unsigned char a, vector bool char b)\n{\n  return\n    __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)a, (vector char)b);\n}\n\nstatic int __ATTRS_o_ai\nvec_any_ne(vector bool char a, vector signed char b)\n{\n  return\n    __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)a, (vector char)b);\n}\n\nstatic int __ATTRS_o_ai\nvec_any_ne(vector bool char a, vector unsigned char b)\n{\n  return\n    __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)a, (vector char)b);\n}\n\nstatic int __ATTRS_o_ai\nvec_any_ne(vector bool char a, vector bool char b)\n{\n  return\n    __builtin_altivec_vcmpequb_p(__CR6_LT_REV, (vector char)a, (vector char)b);\n}\n\nstatic int __ATTRS_o_ai\nvec_any_ne(vector short a, vector short b)\n{\n  return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, a, b);\n}\n\nstatic int __ATTRS_o_ai\nvec_any_ne(vector short a, vector bool short b)\n{\n  return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, a, (vector short)b);\n}\n\nstatic int __ATTRS_o_ai\nvec_any_ne(vector unsigned short a, vector unsigned short b)\n{\n  return __builtin_altivec_vcmpequh_p(__CR6_LT_REV, \n                                      (vector short)a,\n                                      (vector short)b);\n}\n\nstatic int __ATTRS_o_ai\nvec_any_ne(vector unsigned short a, vector bool short b)\n{\n  return __builtin_altivec_vcmpequh_p(__CR6_LT_REV,\n                                      (vector short)a,\n                                      (vector short)b);\n}\n\nstatic int __ATTRS_o_ai\nvec_any_ne(vector bool short a, vector short b)\n{\n  return __builtin_altivec_vcmpequh_p(__CR6_LT_REV,\n                                      (vector short)a,\n                                      (vector short)b);\n}\n\nstatic int __ATTRS_o_ai\nvec_any_ne(vector bool short a, vector unsigned short b)\n{\n  return __builtin_altivec_vcmpequh_p(__CR6_LT_REV,\n                                      (vector short)a,\n                                      (vector short)b);\n}\n\nstatic int __ATTRS_o_ai\nvec_any_ne(vector bool short a, vector bool short b)\n{\n  return __builtin_altivec_vcmpequh_p(__CR6_LT_REV,\n                                      (vector short)a,\n                                      (vector short)b);\n}\n\nstatic int __ATTRS_o_ai\nvec_any_ne(vector pixel a, vector pixel b)\n{\n  return __builtin_altivec_vcmpequh_p(__CR6_LT_REV,\n                                      (vector short)a,\n                                      (vector short)b);\n}\n\nstatic int __ATTRS_o_ai\nvec_any_ne(vector int a, vector int b)\n{\n  return __builtin_altivec_vcmpequw_p(__CR6_LT_REV, a, b);\n}\n\nstatic int __ATTRS_o_ai\nvec_any_ne(vector int a, vector bool int b)\n{\n  return __builtin_altivec_vcmpequw_p(__CR6_LT_REV, a, (vector int)b);\n}\n\nstatic int __ATTRS_o_ai\nvec_any_ne(vector unsigned int a, vector unsigned int b)\n{\n  return\n    __builtin_altivec_vcmpequw_p(__CR6_LT_REV, (vector int)a, (vector int)b);\n}\n\nstatic int __ATTRS_o_ai\nvec_any_ne(vector unsigned int a, vector bool int b)\n{\n  return\n    __builtin_altivec_vcmpequw_p(__CR6_LT_REV, (vector int)a, (vector int)b);\n}\n\nstatic int __ATTRS_o_ai\nvec_any_ne(vector bool int a, vector int b)\n{\n  return\n    __builtin_altivec_vcmpequw_p(__CR6_LT_REV, (vector int)a, (vector int)b);\n}\n\nstatic int __ATTRS_o_ai\nvec_any_ne(vector bool int a, vector unsigned int b)\n{\n  return\n    __builtin_altivec_vcmpequw_p(__CR6_LT_REV, (vector int)a, (vector int)b);\n}\n\nstatic int __ATTRS_o_ai\nvec_any_ne(vector bool int a, vector bool int b)\n{\n  return\n    __builtin_altivec_vcmpequw_p(__CR6_LT_REV, (vector int)a, (vector int)b);\n}\n\nstatic int __ATTRS_o_ai\nvec_any_ne(vector float a, vector float b)\n{\n  return __builtin_altivec_vcmpeqfp_p(__CR6_LT_REV, a, b);\n}\n\n/* vec_any_nge */\n\nstatic int __attribute__((__always_inline__))\nvec_any_nge(vector float a, vector float b)\n{\n  return __builtin_altivec_vcmpgefp_p(__CR6_LT_REV, a, b);\n}\n\n/* vec_any_ngt */\n\nstatic int __attribute__((__always_inline__))\nvec_any_ngt(vector float a, vector float b)\n{\n  return __builtin_altivec_vcmpgtfp_p(__CR6_LT_REV, a, b);\n}\n\n/* vec_any_nle */\n\nstatic int __attribute__((__always_inline__))\nvec_any_nle(vector float a, vector float b)\n{\n  return __builtin_altivec_vcmpgefp_p(__CR6_LT_REV, b, a);\n}\n\n/* vec_any_nlt */\n\nstatic int __attribute__((__always_inline__))\nvec_any_nlt(vector float a, vector float b)\n{\n  return __builtin_altivec_vcmpgtfp_p(__CR6_LT_REV, b, a);\n}\n\n/* vec_any_numeric */\n\nstatic int __attribute__((__always_inline__))\nvec_any_numeric(vector float a)\n{\n  return __builtin_altivec_vcmpeqfp_p(__CR6_EQ_REV, a, a);\n}\n\n/* vec_any_out */\n\nstatic int __attribute__((__always_inline__))\nvec_any_out(vector float a, vector float b)\n{\n  return __builtin_altivec_vcmpbfp_p(__CR6_EQ_REV, a, b);\n}\n\n#undef __ATTRS_o_ai\n\n#endif /* __ALTIVEC_H */\n"
  },
  {
    "path": "freebsd-headers/clang/3.0/avxintrin.h",
    "content": "/*===---- avxintrin.h - AVX intrinsics -------------------------------------===\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n *\n *===-----------------------------------------------------------------------===\n */\n\n#ifndef __IMMINTRIN_H\n#error \"Never use <avxintrin.h> directly; include <immintrin.h> instead.\"\n#endif\n\ntypedef double __v4df __attribute__ ((__vector_size__ (32)));\ntypedef float __v8sf __attribute__ ((__vector_size__ (32)));\ntypedef long long __v4di __attribute__ ((__vector_size__ (32)));\ntypedef int __v8si __attribute__ ((__vector_size__ (32)));\ntypedef short __v16hi __attribute__ ((__vector_size__ (32)));\ntypedef char __v32qi __attribute__ ((__vector_size__ (32)));\n\ntypedef float __m256 __attribute__ ((__vector_size__ (32)));\ntypedef double __m256d __attribute__((__vector_size__(32)));\ntypedef long long __m256i __attribute__((__vector_size__(32)));\n\n/* Arithmetic */\nstatic __inline __m256d __attribute__((__always_inline__, __nodebug__))\n_mm256_add_pd(__m256d a, __m256d b)\n{\n  return a+b;\n}\n\nstatic __inline __m256 __attribute__((__always_inline__, __nodebug__))\n_mm256_add_ps(__m256 a, __m256 b)\n{\n  return a+b;\n}\n\nstatic __inline __m256d __attribute__((__always_inline__, __nodebug__))\n_mm256_sub_pd(__m256d a, __m256d b)\n{\n  return a-b;\n}\n\nstatic __inline __m256 __attribute__((__always_inline__, __nodebug__))\n_mm256_sub_ps(__m256 a, __m256 b)\n{\n  return a-b;\n}\n\nstatic __inline __m256d __attribute__((__always_inline__, __nodebug__))\n_mm256_addsub_pd(__m256d a, __m256d b)\n{\n  return (__m256d)__builtin_ia32_addsubpd256((__v4df)a, (__v4df)b);\n}\n\nstatic __inline __m256 __attribute__((__always_inline__, __nodebug__))\n_mm256_addsub_ps(__m256 a, __m256 b)\n{\n  return (__m256)__builtin_ia32_addsubps256((__v8sf)a, (__v8sf)b);\n}\n\nstatic __inline __m256d __attribute__((__always_inline__, __nodebug__))\n_mm256_div_pd(__m256d a, __m256d b)\n{\n  return a / b;\n}\n\nstatic __inline __m256 __attribute__((__always_inline__, __nodebug__))\n_mm256_div_ps(__m256 a, __m256 b)\n{\n  return a / b;\n}\n\nstatic __inline __m256d __attribute__((__always_inline__, __nodebug__))\n_mm256_max_pd(__m256d a, __m256d b)\n{\n  return (__m256d)__builtin_ia32_maxpd256((__v4df)a, (__v4df)b);\n}\n\nstatic __inline __m256 __attribute__((__always_inline__, __nodebug__))\n_mm256_max_ps(__m256 a, __m256 b)\n{\n  return (__m256)__builtin_ia32_maxps256((__v8sf)a, (__v8sf)b);\n}\n\nstatic __inline __m256d __attribute__((__always_inline__, __nodebug__))\n_mm256_min_pd(__m256d a, __m256d b)\n{\n  return (__m256d)__builtin_ia32_minpd256((__v4df)a, (__v4df)b);\n}\n\nstatic __inline __m256 __attribute__((__always_inline__, __nodebug__))\n_mm256_min_ps(__m256 a, __m256 b)\n{\n  return (__m256)__builtin_ia32_minps256((__v8sf)a, (__v8sf)b);\n}\n\nstatic __inline __m256d __attribute__((__always_inline__, __nodebug__))\n_mm256_mul_pd(__m256d a, __m256d b)\n{\n  return a * b;\n}\n\nstatic __inline __m256 __attribute__((__always_inline__, __nodebug__))\n_mm256_mul_ps(__m256 a, __m256 b)\n{\n  return a * b;\n}\n\nstatic __inline __m256d __attribute__((__always_inline__, __nodebug__))\n_mm256_sqrt_pd(__m256d a)\n{\n  return (__m256d)__builtin_ia32_sqrtpd256((__v4df)a);\n}\n\nstatic __inline __m256 __attribute__((__always_inline__, __nodebug__))\n_mm256_sqrt_ps(__m256 a)\n{\n  return (__m256)__builtin_ia32_sqrtps256((__v8sf)a);\n}\n\nstatic __inline __m256 __attribute__((__always_inline__, __nodebug__))\n_mm256_rsqrt_ps(__m256 a)\n{\n  return (__m256)__builtin_ia32_rsqrtps256((__v8sf)a);\n}\n\nstatic __inline __m256 __attribute__((__always_inline__, __nodebug__))\n_mm256_rcp_ps(__m256 a)\n{\n  return (__m256)__builtin_ia32_rcpps256((__v8sf)a);\n}\n\nstatic __inline __m256d __attribute__((__always_inline__, __nodebug__))\n_mm256_round_pd(__m256d v, const int m)\n{\n  return (__m256d)__builtin_ia32_roundpd256((__v4df)v, m);\n}\n\nstatic __inline __m256 __attribute__((__always_inline__, __nodebug__))\n_mm256_round_ps(__m256 v, const int m)\n{\n  return (__m256)__builtin_ia32_roundps256((__v8sf)v, m);\n}\n\n#define _mm256_ceil_pd(V)  _mm256_round_pd((V), _MM_FROUND_CEIL)\n#define _mm256_floor_pd(V) _mm256_round_pd((V), _MM_FROUND_FLOOR)\n#define _mm256_ceil_ps(V)  _mm256_round_ps((V), _MM_FROUND_CEIL)\n#define _mm256_floor_ps(V) _mm256_round_ps((V), _MM_FROUND_FLOOR)\n\n/* Logical */\nstatic __inline __m256d __attribute__((__always_inline__, __nodebug__))\n_mm256_and_pd(__m256d a, __m256d b)\n{\n  return (__m256d)((__v4di)a & (__v4di)b);\n}\n\nstatic __inline __m256 __attribute__((__always_inline__, __nodebug__))\n_mm256_and_ps(__m256 a, __m256 b)\n{\n  return (__m256)((__v8si)a & (__v8si)b);\n}\n\nstatic __inline __m256d __attribute__((__always_inline__, __nodebug__))\n_mm256_andnot_pd(__m256d a, __m256d b)\n{\n  return (__m256d)(~(__v4di)a & (__v4di)b);\n}\n\nstatic __inline __m256 __attribute__((__always_inline__, __nodebug__))\n_mm256_andnot_ps(__m256 a, __m256 b)\n{\n  return (__m256)(~(__v8si)a & (__v8si)b);\n}\n\nstatic __inline __m256d __attribute__((__always_inline__, __nodebug__))\n_mm256_or_pd(__m256d a, __m256d b)\n{\n  return (__m256d)((__v4di)a | (__v4di)b);\n}\n\nstatic __inline __m256 __attribute__((__always_inline__, __nodebug__))\n_mm256_or_ps(__m256 a, __m256 b)\n{\n  return (__m256)((__v8si)a | (__v8si)b);\n}\n\nstatic __inline __m256d __attribute__((__always_inline__, __nodebug__))\n_mm256_xor_pd(__m256d a, __m256d b)\n{\n  return (__m256d)((__v4di)a ^ (__v4di)b);\n}\n\nstatic __inline __m256 __attribute__((__always_inline__, __nodebug__))\n_mm256_xor_ps(__m256 a, __m256 b)\n{\n  return (__m256)((__v8si)a ^ (__v8si)b);\n}\n\n/* Horizontal arithmetic */\nstatic __inline __m256d __attribute__((__always_inline__, __nodebug__))\n_mm256_hadd_pd(__m256d a, __m256d b)\n{\n  return (__m256d)__builtin_ia32_haddpd256((__v4df)a, (__v4df)b);\n}\n\nstatic __inline __m256 __attribute__((__always_inline__, __nodebug__))\n_mm256_hadd_ps(__m256 a, __m256 b)\n{\n  return (__m256)__builtin_ia32_haddps256((__v8sf)a, (__v8sf)b);\n}\n\nstatic __inline __m256d __attribute__((__always_inline__, __nodebug__))\n_mm256_hsub_pd(__m256d a, __m256d b)\n{\n  return (__m256d)__builtin_ia32_hsubpd256((__v4df)a, (__v4df)b);\n}\n\nstatic __inline __m256 __attribute__((__always_inline__, __nodebug__))\n_mm256_hsub_ps(__m256 a, __m256 b)\n{\n  return (__m256)__builtin_ia32_hsubps256((__v8sf)a, (__v8sf)b);\n}\n\n/* Vector permutations */\nstatic __inline __m128d __attribute__((__always_inline__, __nodebug__))\n_mm_permutevar_pd(__m128d a, __m128i c)\n{\n  return (__m128d)__builtin_ia32_vpermilvarpd((__v2df)a, (__v2di)c);\n}\n\nstatic __inline __m256d __attribute__((__always_inline__, __nodebug__))\n_mm256_permutevar_pd(__m256d a, __m256i c)\n{\n  return (__m256d)__builtin_ia32_vpermilvarpd256((__v4df)a, (__v4di)c);\n}\n\nstatic __inline __m128 __attribute__((__always_inline__, __nodebug__))\n_mm_permutevar_ps(__m128 a, __m128i c)\n{\n  return (__m128)__builtin_ia32_vpermilvarps((__v4sf)a, (__v4si)c);\n}\n\nstatic __inline __m256 __attribute__((__always_inline__, __nodebug__))\n_mm256_permutevar_ps(__m256 a, __m256i c)\n{\n  return (__m256)__builtin_ia32_vpermilvarps256((__v8sf)a,\n\t\t\t\t\t\t  (__v8si)c);\n}\n\nstatic __inline __m128d __attribute__((__always_inline__, __nodebug__))\n_mm_permute_pd(__m128d a, const int c)\n{\n  return (__m128d)__builtin_ia32_vpermilpd((__v2df)a, c);\n}\n\nstatic __inline __m256d __attribute__((__always_inline__, __nodebug__))\n_mm256_permute_pd(__m256d a, const int c)\n{\n  return (__m256d)__builtin_ia32_vpermilpd256((__v4df)a, c);\n}\n\nstatic __inline __m128 __attribute__((__always_inline__, __nodebug__))\n_mm_permute_ps(__m128 a, const int c)\n{\n  return (__m128)__builtin_ia32_vpermilps((__v4sf)a, c);\n}\n\nstatic __inline __m256 __attribute__((__always_inline__, __nodebug__))\n_mm256_permute_ps(__m256 a, const int c)\n{\n  return (__m256)__builtin_ia32_vpermilps256((__v8sf)a, c);\n}\n\nstatic __inline __m256d __attribute__((__always_inline__, __nodebug__))\n_mm256_permute2f128_pd(__m256d a, __m256d b, const int c)\n{\n  return (__m256d)__builtin_ia32_vperm2f128_pd256((__v4df)a, (__v4df)b, c);\n}\n\nstatic __inline __m256 __attribute__((__always_inline__, __nodebug__))\n_mm256_permute2f128_ps(__m256 a, __m256 b, const int c)\n{\n  return (__m256)__builtin_ia32_vperm2f128_ps256((__v8sf)a, (__v8sf)b, c);\n}\n\nstatic __inline __m256i __attribute__((__always_inline__, __nodebug__))\n_mm256_permute2f128_si256(__m256i a, __m256i b, const int c)\n{\n  return (__m256i)__builtin_ia32_vperm2f128_si256((__v8si)a, (__v8si)b, c);\n}\n\n/* Vector Blend */\nstatic __inline __m256d __attribute__((__always_inline__, __nodebug__))\n_mm256_blend_pd(__m256d a, __m256d b, const int c)\n{\n  return (__m256d)__builtin_ia32_blendpd256((__v4df)a, (__v4df)b, c);\n}\n\nstatic __inline __m256 __attribute__((__always_inline__, __nodebug__))\n_mm256_blend_ps(__m256 a, __m256 b, const int c)\n{\n  return (__m256)__builtin_ia32_blendps256((__v8sf)a, (__v8sf)b, c);\n}\n\nstatic __inline __m256d __attribute__((__always_inline__, __nodebug__))\n_mm256_blendv_pd(__m256d a, __m256d b, __m256d c)\n{\n  return (__m256d)__builtin_ia32_blendvpd256((__v4df)a, (__v4df)b, (__v4df)c);\n}\n\nstatic __inline __m256 __attribute__((__always_inline__, __nodebug__))\n_mm256_blendv_ps(__m256 a, __m256 b, __m256 c)\n{\n  return (__m256)__builtin_ia32_blendvps256((__v8sf)a, (__v8sf)b, (__v8sf)c);\n}\n\n/* Vector Dot Product */\nstatic __inline __m256 __attribute__((__always_inline__, __nodebug__))\n_mm256_dp_ps(__m256 a, __m256 b, const int c)\n{\n  return (__m256)__builtin_ia32_dpps256((__v8sf)a, (__v8sf)b, c);\n}\n\n/* Vector shuffle */\n#define _mm256_shuffle_ps(a, b, mask) \\\n        (__builtin_shufflevector((__v8sf)(a), (__v8sf)(b), \\\n        (mask) & 0x3,                ((mask) & 0xc) >> 2, \\\n        (((mask) & 0x30) >> 4) + 8,  (((mask) & 0xc0) >> 6) + 8, \\\n        ((mask) & 0x3) + 4,          (((mask) & 0xc) >> 2) + 4, \\\n        (((mask) & 0x30) >> 4) + 12, (((mask) & 0xc0) >> 6) + 12))\n\n#define _mm256_shuffle_pd(a, b, mask) \\\n        (__builtin_shufflevector((__v4df)(a), (__v4df)(b), \\\n        (mask) & 0x1, \\\n        (((mask) & 0x2) >> 1) + 4, \\\n        (((mask) & 0x4) >> 2) + 2, \\\n        (((mask) & 0x8) >> 3) + 6))\n\n/* Compare */\n#define _CMP_EQ_OQ    0x00 /* Equal (ordered, non-signaling)  */\n#define _CMP_LT_OS    0x01 /* Less-than (ordered, signaling)  */\n#define _CMP_LE_OS    0x02 /* Less-than-or-equal (ordered, signaling)  */\n#define _CMP_UNORD_Q  0x03 /* Unordered (non-signaling)  */\n#define _CMP_NEQ_UQ   0x04 /* Not-equal (unordered, non-signaling)  */\n#define _CMP_NLT_US   0x05 /* Not-less-than (unordered, signaling)  */\n#define _CMP_NLE_US   0x06 /* Not-less-than-or-equal (unordered, signaling)  */\n#define _CMP_ORD_Q    0x07 /* Ordered (nonsignaling)   */\n#define _CMP_EQ_UQ    0x08 /* Equal (unordered, non-signaling)  */\n#define _CMP_NGE_US   0x09 /* Not-greater-than-or-equal (unord, signaling)  */\n#define _CMP_NGT_US   0x0a /* Not-greater-than (unordered, signaling)  */\n#define _CMP_FALSE_OQ 0x0b /* False (ordered, non-signaling)  */\n#define _CMP_NEQ_OQ   0x0c /* Not-equal (ordered, non-signaling)  */\n#define _CMP_GE_OS    0x0d /* Greater-than-or-equal (ordered, signaling)  */\n#define _CMP_GT_OS    0x0e /* Greater-than (ordered, signaling)  */\n#define _CMP_TRUE_UQ  0x0f /* True (unordered, non-signaling)  */\n#define _CMP_EQ_OS    0x10 /* Equal (ordered, signaling)  */\n#define _CMP_LT_OQ    0x11 /* Less-than (ordered, non-signaling)  */\n#define _CMP_LE_OQ    0x12 /* Less-than-or-equal (ordered, non-signaling)  */\n#define _CMP_UNORD_S  0x13 /* Unordered (signaling)  */\n#define _CMP_NEQ_US   0x14 /* Not-equal (unordered, signaling)  */\n#define _CMP_NLT_UQ   0x15 /* Not-less-than (unordered, non-signaling)  */\n#define _CMP_NLE_UQ   0x16 /* Not-less-than-or-equal (unord, non-signaling)  */\n#define _CMP_ORD_S    0x17 /* Ordered (signaling)  */\n#define _CMP_EQ_US    0x18 /* Equal (unordered, signaling)  */\n#define _CMP_NGE_UQ   0x19 /* Not-greater-than-or-equal (unord, non-sign)  */\n#define _CMP_NGT_UQ   0x1a /* Not-greater-than (unordered, non-signaling)  */\n#define _CMP_FALSE_OS 0x1b /* False (ordered, signaling)  */\n#define _CMP_NEQ_OS   0x1c /* Not-equal (ordered, signaling)  */\n#define _CMP_GE_OQ    0x1d /* Greater-than-or-equal (ordered, non-signaling)  */\n#define _CMP_GT_OQ    0x1e /* Greater-than (ordered, non-signaling)  */\n#define _CMP_TRUE_US  0x1f /* True (unordered, signaling)  */\n\n#define _mm_cmp_pd(a, b, c) \\\n  (__m128d)__builtin_ia32_cmppd((__v2df)(a), (__v2df)(b), (c))\n\n#define _mm_cmp_ps(a, b, c) \\\n  (__m128)__builtin_ia32_cmpps((__v4sf)(a), (__v4sf)(b), (c))\n\n#define _mm256_cmp_pd(a, b, c) \\\n  (__m256d)__builtin_ia32_cmppd256((__v4df)(a), (__v4df)(b), (c))\n\n#define _mm256_cmp_ps(a, b, c) \\\n  (__m256)__builtin_ia32_cmpps256((__v8sf)(a), (__v8sf)(b), (c))\n\n#define _mm_cmp_sd(a, b, c) \\\n  (__m128d)__builtin_ia32_cmpsd((__v2df)(a), (__v2df)(b), (c))\n\n#define _mm_cmp_ss(a, b, c) \\\n  (__m128)__builtin_ia32_cmpss((__v4sf)(a), (__v4sf)(b), (c))\n\n/* Vector extract */\nstatic __inline __m128d __attribute__((__always_inline__, __nodebug__))\n_mm256_extractf128_pd(__m256d a, const int o)\n{\n  return (__m128d)__builtin_ia32_vextractf128_pd256((__v4df)a, o);\n}\n\nstatic __inline __m128 __attribute__((__always_inline__, __nodebug__))\n_mm256_extractf128_ps(__m256 a, const int o)\n{\n  return (__m128)__builtin_ia32_vextractf128_ps256((__v8sf)a, o);\n}\n\nstatic __inline __m128i __attribute__((__always_inline__, __nodebug__))\n_mm256_extractf128_si256(__m256i a, const int o)\n{\n  return (__m128i)__builtin_ia32_vextractf128_si256((__v8si)a, o);\n}\n\nstatic __inline int __attribute__((__always_inline__, __nodebug__))\n_mm256_extract_epi32(__m256i a, int const imm)\n{\n  __v8si b = (__v8si)a;\n  return b[imm];\n}\n\nstatic __inline int __attribute__((__always_inline__, __nodebug__))\n_mm256_extract_epi16(__m256i a, int const imm)\n{\n  __v16hi b = (__v16hi)a;\n  return b[imm];\n}\n\nstatic __inline int __attribute__((__always_inline__, __nodebug__))\n_mm256_extract_epi8(__m256i a, int const imm)\n{\n  __v32qi b = (__v32qi)a;\n  return b[imm];\n}\n\n#ifdef __x86_64__\nstatic __inline long long  __attribute__((__always_inline__, __nodebug__))\n_mm256_extract_epi64(__m256i a, const int imm)\n{\n  __v4di b = (__v4di)a;\n  return b[imm];\n}\n#endif\n\n/* Vector insert */\nstatic __inline __m256d __attribute__((__always_inline__, __nodebug__))\n_mm256_insertf128_pd(__m256d a, __m128d b, const int o)\n{\n  return (__m256d)__builtin_ia32_vinsertf128_pd256((__v4df)a, (__v2df)b, o);\n}\n\nstatic __inline __m256 __attribute__((__always_inline__, __nodebug__))\n_mm256_insertf128_ps(__m256 a, __m128 b, const int o)\n{\n  return (__m256)__builtin_ia32_vinsertf128_ps256((__v8sf)a, (__v4sf)b, o);\n}\n\nstatic __inline __m256i __attribute__((__always_inline__, __nodebug__))\n_mm256_insertf128_si256(__m256i a, __m128i b, const int o)\n{\n  return (__m256i)__builtin_ia32_vinsertf128_si256((__v8si)a, (__v4si)b, o);\n}\n\nstatic __inline __m256i __attribute__((__always_inline__, __nodebug__))\n_mm256_insert_epi32(__m256i a, int b, int const imm)\n{\n  __v8si c = (__v8si)a;\n  c[imm & 7] = b;\n  return (__m256i)c;\n}\n\nstatic __inline __m256i __attribute__((__always_inline__, __nodebug__))\n_mm256_insert_epi16(__m256i a, int b, int const imm)\n{\n  __v16hi c = (__v16hi)a;\n  c[imm & 15] = b;\n  return (__m256i)c;\n}\n\nstatic __inline __m256i __attribute__((__always_inline__, __nodebug__))\n_mm256_insert_epi8(__m256i a, int b, int const imm)\n{\n  __v32qi c = (__v32qi)a;\n  c[imm & 31] = b;\n  return (__m256i)c;\n}\n\n#ifdef __x86_64__\nstatic __inline __m256i __attribute__((__always_inline__, __nodebug__))\n_mm256_insert_epi64(__m256i a, int b, int const imm)\n{\n  __v4di c = (__v4di)a;\n  c[imm & 3] = b;\n  return (__m256i)c;\n}\n#endif\n\n/* Conversion */\nstatic __inline __m256d __attribute__((__always_inline__, __nodebug__))\n_mm256_cvtepi32_pd(__m128i a)\n{\n  return (__m256d)__builtin_ia32_cvtdq2pd256((__v4si) a);\n}\n\nstatic __inline __m256 __attribute__((__always_inline__, __nodebug__))\n_mm256_cvtepi32_ps(__m256i a)\n{\n  return (__m256)__builtin_ia32_cvtdq2ps256((__v8si) a);\n}\n\nstatic __inline __m128 __attribute__((__always_inline__, __nodebug__))\n_mm256_cvtpd_ps(__m256d a)\n{\n  return (__m128)__builtin_ia32_cvtpd2ps256((__v4df) a);\n}\n\nstatic __inline __m256i __attribute__((__always_inline__, __nodebug__))\n_mm256_cvtps_epi32(__m256 a)\n{\n  return (__m256i)__builtin_ia32_cvtps2dq256((__v8sf) a);\n}\n\nstatic __inline __m256d __attribute__((__always_inline__, __nodebug__))\n_mm256_cvtps_pd(__m128 a)\n{\n  return (__m256d)__builtin_ia32_cvtps2pd256((__v4sf) a);\n}\n\nstatic __inline __m128i __attribute__((__always_inline__, __nodebug__))\n_mm256_cvttpd_epi32(__m256d a)\n{\n  return (__m128i)__builtin_ia32_cvttpd2dq256((__v4df) a);\n}\n\nstatic __inline __m128i __attribute__((__always_inline__, __nodebug__))\n_mm256_cvtpd_epi32(__m256d a)\n{\n  return (__m128i)__builtin_ia32_cvtpd2dq256((__v4df) a);\n}\n\nstatic __inline __m256i __attribute__((__always_inline__, __nodebug__))\n_mm256_cvttps_epi32(__m256 a)\n{\n  return (__m256i)__builtin_ia32_cvttps2dq256((__v8sf) a);\n}\n\n/* Vector replicate */\nstatic __inline __m256 __attribute__((__always_inline__, __nodebug__))\n_mm256_movehdup_ps(__m256 a)\n{\n  return __builtin_shufflevector(a, a, 1, 1, 3, 3, 5, 5, 7, 7);\n}\n\nstatic __inline __m256 __attribute__((__always_inline__, __nodebug__))\n_mm256_moveldup_ps(__m256 a)\n{\n  return __builtin_shufflevector(a, a, 0, 0, 2, 2, 4, 4, 6, 6);\n}\n\nstatic __inline __m256d __attribute__((__always_inline__, __nodebug__))\n_mm256_movedup_pd(__m256d a)\n{\n  return __builtin_shufflevector(a, a, 0, 0, 2, 2);\n}\n\n/* Unpack and Interleave */\nstatic __inline __m256d __attribute__((__always_inline__, __nodebug__))\n_mm256_unpackhi_pd(__m256d a, __m256d b)\n{\n  return __builtin_shufflevector(a, b, 1, 5, 1+2, 5+2);\n}\n\nstatic __inline __m256d __attribute__((__always_inline__, __nodebug__))\n_mm256_unpacklo_pd(__m256d a, __m256d b)\n{\n  return __builtin_shufflevector(a, b, 0, 4, 0+2, 4+2);\n}\n\nstatic __inline __m256 __attribute__((__always_inline__, __nodebug__))\n_mm256_unpackhi_ps(__m256 a, __m256 b)\n{\n  return __builtin_shufflevector(a, b, 2, 10, 2+1, 10+1, 6, 14, 6+1, 14+1);\n}\n\nstatic __inline __m256 __attribute__((__always_inline__, __nodebug__))\n_mm256_unpacklo_ps(__m256 a, __m256 b)\n{\n  return __builtin_shufflevector(a, b, 0, 8, 0+1, 8+1, 4, 12, 4+1, 12+1);\n}\n\n/* Bit Test */\nstatic __inline int __attribute__((__always_inline__, __nodebug__))\n_mm_testz_pd(__m128d a, __m128d b)\n{\n  return __builtin_ia32_vtestzpd((__v2df)a, (__v2df)b);\n}\n\nstatic __inline int __attribute__((__always_inline__, __nodebug__))\n_mm_testc_pd(__m128d a, __m128d b)\n{\n  return __builtin_ia32_vtestcpd((__v2df)a, (__v2df)b);\n}\n\nstatic __inline int __attribute__((__always_inline__, __nodebug__))\n_mm_testnzc_pd(__m128d a, __m128d b)\n{\n  return __builtin_ia32_vtestnzcpd((__v2df)a, (__v2df)b);\n}\n\nstatic __inline int __attribute__((__always_inline__, __nodebug__))\n_mm_testz_ps(__m128 a, __m128 b)\n{\n  return __builtin_ia32_vtestzps((__v4sf)a, (__v4sf)b);\n}\n\nstatic __inline int __attribute__((__always_inline__, __nodebug__))\n_mm_testc_ps(__m128 a, __m128 b)\n{\n  return __builtin_ia32_vtestcps((__v4sf)a, (__v4sf)b);\n}\n\nstatic __inline int __attribute__((__always_inline__, __nodebug__))\n_mm_testnzc_ps(__m128 a, __m128 b)\n{\n  return __builtin_ia32_vtestnzcps((__v4sf)a, (__v4sf)b);\n}\n\nstatic __inline int __attribute__((__always_inline__, __nodebug__))\n_mm256_testz_pd(__m256d a, __m256d b)\n{\n  return __builtin_ia32_vtestzpd256((__v4df)a, (__v4df)b);\n}\n\nstatic __inline int __attribute__((__always_inline__, __nodebug__))\n_mm256_testc_pd(__m256d a, __m256d b)\n{\n  return __builtin_ia32_vtestcpd256((__v4df)a, (__v4df)b);\n}\n\nstatic __inline int __attribute__((__always_inline__, __nodebug__))\n_mm256_testnzc_pd(__m256d a, __m256d b)\n{\n  return __builtin_ia32_vtestnzcpd256((__v4df)a, (__v4df)b);\n}\n\nstatic __inline int __attribute__((__always_inline__, __nodebug__))\n_mm256_testz_ps(__m256 a, __m256 b)\n{\n  return __builtin_ia32_vtestzps256((__v8sf)a, (__v8sf)b);\n}\n\nstatic __inline int __attribute__((__always_inline__, __nodebug__))\n_mm256_testc_ps(__m256 a, __m256 b)\n{\n  return __builtin_ia32_vtestcps256((__v8sf)a, (__v8sf)b);\n}\n\nstatic __inline int __attribute__((__always_inline__, __nodebug__))\n_mm256_testnzc_ps(__m256 a, __m256 b)\n{\n  return __builtin_ia32_vtestnzcps256((__v8sf)a, (__v8sf)b);\n}\n\nstatic __inline int __attribute__((__always_inline__, __nodebug__))\n_mm256_testz_si256(__m256i a, __m256i b)\n{\n  return __builtin_ia32_ptestz256((__v4di)a, (__v4di)b);\n}\n\nstatic __inline int __attribute__((__always_inline__, __nodebug__))\n_mm256_testc_si256(__m256i a, __m256i b)\n{\n  return __builtin_ia32_ptestc256((__v4di)a, (__v4di)b);\n}\n\nstatic __inline int __attribute__((__always_inline__, __nodebug__))\n_mm256_testnzc_si256(__m256i a, __m256i b)\n{\n  return __builtin_ia32_ptestnzc256((__v4di)a, (__v4di)b);\n}\n\n/* Vector extract sign mask */\nstatic __inline int __attribute__((__always_inline__, __nodebug__))\n_mm256_movemask_pd(__m256d a)\n{\n  return __builtin_ia32_movmskpd256((__v4df)a);\n}\n\nstatic __inline int __attribute__((__always_inline__, __nodebug__))\n_mm256_movemask_ps(__m256 a)\n{\n  return __builtin_ia32_movmskps256((__v8sf)a);\n}\n\n/* Vector zero */\nstatic __inline void __attribute__((__always_inline__, __nodebug__))\n_mm256_zeroall(void)\n{\n  __builtin_ia32_vzeroall();\n}\n\nstatic __inline void __attribute__((__always_inline__, __nodebug__))\n_mm256_zeroupper(void)\n{\n  __builtin_ia32_vzeroupper();\n}\n\n/* Vector load with broadcast */\nstatic __inline __m128 __attribute__((__always_inline__, __nodebug__))\n_mm_broadcast_ss(float const *a)\n{\n  return (__m128)__builtin_ia32_vbroadcastss(a);\n}\n\nstatic __inline __m256d __attribute__((__always_inline__, __nodebug__))\n_mm256_broadcast_sd(double const *a)\n{\n  return (__m256d)__builtin_ia32_vbroadcastsd256(a);\n}\n\nstatic __inline __m256 __attribute__((__always_inline__, __nodebug__))\n_mm256_broadcast_ss(float const *a)\n{\n  return (__m256)__builtin_ia32_vbroadcastss256(a);\n}\n\nstatic __inline __m256d __attribute__((__always_inline__, __nodebug__))\n_mm256_broadcast_pd(__m128d const *a)\n{\n  return (__m256d)__builtin_ia32_vbroadcastf128_pd256(a);\n}\n\nstatic __inline __m256 __attribute__((__always_inline__, __nodebug__))\n_mm256_broadcast_ps(__m128 const *a)\n{\n  return (__m256)__builtin_ia32_vbroadcastf128_ps256(a);\n}\n\n/* SIMD load ops */\nstatic __inline __m256d __attribute__((__always_inline__, __nodebug__))\n_mm256_load_pd(double const *p)\n{\n  return *(__m256d *)p;\n}\n\nstatic __inline __m256 __attribute__((__always_inline__, __nodebug__))\n_mm256_load_ps(float const *p)\n{\n  return *(__m256 *)p;\n}\n\nstatic __inline __m256d __attribute__((__always_inline__, __nodebug__))\n_mm256_loadu_pd(double const *p)\n{\n  return (__m256d)__builtin_ia32_loadupd256(p);\n}\n\nstatic __inline __m256 __attribute__((__always_inline__, __nodebug__))\n_mm256_loadu_ps(float const *p)\n{\n  return (__m256)__builtin_ia32_loadups256(p);\n}\n\nstatic __inline __m256i __attribute__((__always_inline__, __nodebug__))\n_mm256_load_si256(__m256i const *p)\n{\n  return *p;\n}\n\nstatic __inline __m256i __attribute__((__always_inline__, __nodebug__))\n_mm256_loadu_si256(__m256i const *p)\n{\n  return (__m256i)__builtin_ia32_loaddqu256((char const *)p);\n}\n\nstatic __inline __m256i __attribute__((__always_inline__, __nodebug__))\n_mm256_lddqu_si256(__m256i const *p)\n{\n  return (__m256i)__builtin_ia32_lddqu256((char const *)p);\n}\n\n/* SIMD store ops */\nstatic __inline void __attribute__((__always_inline__, __nodebug__))\n_mm256_store_pd(double *p, __m256d a)\n{\n  *(__m256d *)p = a;\n}\n\nstatic __inline void __attribute__((__always_inline__, __nodebug__))\n_mm256_store_ps(float *p, __m256 a)\n{\n  *(__m256 *)p = a;\n}\n\nstatic __inline void __attribute__((__always_inline__, __nodebug__))\n_mm256_storeu_pd(double *p, __m256d a)\n{\n  __builtin_ia32_storeupd256(p, (__v4df)a);\n}\n\nstatic __inline void __attribute__((__always_inline__, __nodebug__))\n_mm256_storeu_ps(float *p, __m256 a)\n{\n  __builtin_ia32_storeups256(p, (__v8sf)a);\n}\n\nstatic __inline void __attribute__((__always_inline__, __nodebug__))\n_mm256_store_si256(__m256i *p, __m256i a)\n{\n  *p = a;\n}\n\nstatic __inline void __attribute__((__always_inline__, __nodebug__))\n_mm256_storeu_si256(__m256i *p, __m256i a)\n{\n  __builtin_ia32_storedqu256((char *)p, (__v32qi)a);\n}\n\n/* Conditional load ops */\nstatic __inline __m128d __attribute__((__always_inline__, __nodebug__))\n_mm_maskload_pd(double const *p, __m128d m)\n{\n  return (__m128d)__builtin_ia32_maskloadpd((const __v2df *)p, (__v2df)m);\n}\n\nstatic __inline __m256d __attribute__((__always_inline__, __nodebug__))\n_mm256_maskload_pd(double const *p, __m256d m)\n{\n  return (__m256d)__builtin_ia32_maskloadpd256((const __v4df *)p, (__v4df)m);\n}\n\nstatic __inline __m128 __attribute__((__always_inline__, __nodebug__))\n_mm_maskload_ps(float const *p, __m128 m)\n{\n  return (__m128)__builtin_ia32_maskloadps((const __v4sf *)p, (__v4sf)m);\n}\n\nstatic __inline __m256 __attribute__((__always_inline__, __nodebug__))\n_mm256_maskload_ps(float const *p, __m256 m)\n{\n  return (__m256)__builtin_ia32_maskloadps256((const __v8sf *)p, (__v8sf)m);\n}\n\n/* Conditional store ops */\nstatic __inline void __attribute__((__always_inline__, __nodebug__))\n_mm256_maskstore_ps(float *p, __m256 m, __m256 a)\n{\n  __builtin_ia32_maskstoreps256((__v8sf *)p, (__v8sf)m, (__v8sf)a);\n}\n\nstatic __inline void __attribute__((__always_inline__, __nodebug__))\n_mm_maskstore_pd(double *p, __m128d m, __m128d a)\n{\n  __builtin_ia32_maskstorepd((__v2df *)p, (__v2df)m, (__v2df)a);\n}\n\nstatic __inline void __attribute__((__always_inline__, __nodebug__))\n_mm256_maskstore_pd(double *p, __m256d m, __m256d a)\n{\n  __builtin_ia32_maskstorepd256((__v4df *)p, (__v4df)m, (__v4df)a);\n}\n\nstatic __inline void __attribute__((__always_inline__, __nodebug__))\n_mm_maskstore_ps(float *p, __m128 m, __m128 a)\n{\n  __builtin_ia32_maskstoreps((__v4sf *)p, (__v4sf)m, (__v4sf)a);\n}\n\n/* Cacheability support ops */\nstatic __inline void __attribute__((__always_inline__, __nodebug__))\n_mm256_stream_si256(__m256i *a, __m256i b)\n{\n  __builtin_ia32_movntdq256((__v4di *)a, (__v4di)b);\n}\n\nstatic __inline void __attribute__((__always_inline__, __nodebug__))\n_mm256_stream_pd(double *a, __m256d b)\n{\n  __builtin_ia32_movntpd256(a, (__v4df)b);\n}\n\nstatic __inline void __attribute__((__always_inline__, __nodebug__))\n_mm256_stream_ps(float *p, __m256 a)\n{\n  __builtin_ia32_movntps256(p, (__v8sf)a);\n}\n\n/* Create vectors */\nstatic __inline __m256d __attribute__((__always_inline__, __nodebug__))\n_mm256_set_pd(double a, double b, double c, double d)\n{\n  return (__m256d){ d, c, b, a };\n}\n\nstatic __inline __m256 __attribute__((__always_inline__, __nodebug__))\n_mm256_set_ps(float a, float b, float c, float d,\n\t            float e, float f, float g, float h)\n{\n  return (__m256){ h, g, f, e, d, c, b, a };\n}\n\nstatic __inline __m256i __attribute__((__always_inline__, __nodebug__))\n_mm256_set_epi32(int i0, int i1, int i2, int i3,\n\t\t             int i4, int i5, int i6, int i7)\n{\n  return (__m256i)(__v8si){ i7, i6, i5, i4, i3, i2, i1, i0 };\n}\n\nstatic __inline __m256i __attribute__((__always_inline__, __nodebug__))\n_mm256_set_epi16(short w15, short w14, short w13, short w12,\n\t\t             short w11, short w10, short w09, short w08,\n\t\t             short w07, short w06, short w05, short w04,\n\t\t             short w03, short w02, short w01, short w00)\n{\n  return (__m256i)(__v16hi){ w00, w01, w02, w03, w04, w05, w06, w07,\n                             w08, w09, w10, w11, w12, w13, w14, w15 };\n}\n\nstatic __inline __m256i __attribute__((__always_inline__, __nodebug__))\n_mm256_set_epi8(char b31, char b30, char b29, char b28,\n\t\t            char b27, char b26, char b25, char b24,\n\t\t            char b23, char b22, char b21, char b20,\n\t\t            char b19, char b18, char b17, char b16,\n\t\t            char b15, char b14, char b13, char b12,\n\t\t            char b11, char b10, char b09, char b08,\n\t\t            char b07, char b06, char b05, char b04,\n\t\t            char b03, char b02, char b01, char b00)\n{\n  return (__m256i)(__v32qi){\n    b00, b01, b02, b03, b04, b05, b06, b07,\n    b08, b09, b10, b11, b12, b13, b14, b15,\n    b16, b17, b18, b19, b20, b21, b22, b23,\n    b24, b25, b26, b27, b28, b29, b30, b31\n  };\n}\n\nstatic __inline __m256i __attribute__((__always_inline__, __nodebug__))\n_mm256_set_epi64x(long long a, long long b, long long c, long long d)\n{\n  return (__m256i)(__v4di){ d, c, b, a };\n}\n\n/* Create vectors with elements in reverse order */\nstatic __inline __m256d __attribute__((__always_inline__, __nodebug__))\n_mm256_setr_pd(double a, double b, double c, double d)\n{\n  return (__m256d){ a, b, c, d };\n}\n\nstatic __inline __m256 __attribute__((__always_inline__, __nodebug__))\n_mm256_setr_ps(float a, float b, float c, float d,\n\t\t           float e, float f, float g, float h)\n{\n  return (__m256){ a, b, c, d, e, f, g, h };\n}\n\nstatic __inline __m256i __attribute__((__always_inline__, __nodebug__))\n_mm256_setr_epi32(int i0, int i1, int i2, int i3,\n\t\t              int i4, int i5, int i6, int i7)\n{\n  return (__m256i)(__v8si){ i0, i1, i2, i3, i4, i5, i6, i7 };\n}\n\nstatic __inline __m256i __attribute__((__always_inline__, __nodebug__))\n_mm256_setr_epi16(short w15, short w14, short w13, short w12,\n\t\t   short w11, short w10, short w09, short w08,\n\t\t   short w07, short w06, short w05, short w04,\n\t\t   short w03, short w02, short w01, short w00)\n{\n  return (__m256i)(__v16hi){ w15, w14, w13, w12, w11, w10, w09, w08,\n\t\t\t                       w07, w06, w05, w04, w03, w02, w01, w00 };\n}\n\nstatic __inline __m256i __attribute__((__always_inline__, __nodebug__))\n_mm256_setr_epi8(char b31, char b30, char b29, char b28,\n\t\t             char b27, char b26, char b25, char b24,\n\t\t             char b23, char b22, char b21, char b20,\n\t\t             char b19, char b18, char b17, char b16,\n\t\t             char b15, char b14, char b13, char b12,\n\t\t             char b11, char b10, char b09, char b08,\n\t\t             char b07, char b06, char b05, char b04,\n\t\t             char b03, char b02, char b01, char b00)\n{\n  return (__m256i)(__v32qi){\n    b31, b30, b29, b28, b27, b26, b25, b24,\n\t\tb23, b22, b21, b20, b19, b18, b17, b16,\n\t\tb15, b14, b13, b12, b11, b10, b09, b08,\n\t\tb07, b06, b05, b04, b03, b02, b01, b00 };\n}\n\nstatic __inline __m256i __attribute__((__always_inline__, __nodebug__))\n_mm256_setr_epi64x(long long a, long long b, long long c, long long d)\n{\n  return (__m256i)(__v4di){ a, b, c, d };\n}\n\n/* Create vectors with repeated elements */\nstatic __inline __m256d __attribute__((__always_inline__, __nodebug__))\n_mm256_set1_pd(double w)\n{\n  return (__m256d){ w, w, w, w };\n}\n\nstatic __inline __m256 __attribute__((__always_inline__, __nodebug__))\n_mm256_set1_ps(float w)\n{\n  return (__m256){ w, w, w, w, w, w, w, w };\n}\n\nstatic __inline __m256i __attribute__((__always_inline__, __nodebug__))\n_mm256_set1_epi32(int i)\n{\n  return (__m256i)(__v8si){ i, i, i, i, i, i, i, i };\n}\n\nstatic __inline __m256i __attribute__((__always_inline__, __nodebug__))\n_mm256_set1_epi16(short w)\n{\n  return (__m256i)(__v16hi){ w, w, w, w, w, w, w, w, w, w, w, w, w, w, w, w };\n}\n\nstatic __inline __m256i __attribute__((__always_inline__, __nodebug__))\n_mm256_set1_epi8(char b)\n{\n  return (__m256i)(__v32qi){ b, b, b, b, b, b, b, b, b, b, b, b, b, b, b, b,\n                             b, b, b, b, b, b, b, b, b, b, b, b, b, b, b, b };\n}\n\nstatic __inline __m256i __attribute__((__always_inline__, __nodebug__))\n_mm256_set1_epi64x(long long q)\n{\n  return (__m256i)(__v4di){ q, q, q, q };\n}\n\n/* Create zeroed vectors */\nstatic __inline __m256d __attribute__((__always_inline__, __nodebug__))\n_mm256_setzero_pd(void)\n{\n  return (__m256d){ 0, 0, 0, 0 };\n}\n\nstatic __inline __m256 __attribute__((__always_inline__, __nodebug__))\n_mm256_setzero_ps(void)\n{\n  return (__m256){ 0, 0, 0, 0, 0, 0, 0, 0 };\n}\n\nstatic __inline __m256i __attribute__((__always_inline__, __nodebug__))\n_mm256_setzero_si256(void)\n{\n  return (__m256i){ 0LL, 0LL, 0LL, 0LL };\n}\n\n/* Cast between vector types */\nstatic __inline __m256 __attribute__((__always_inline__, __nodebug__))\n_mm256_castpd_ps(__m256d in)\n{\n  return (__m256)in;\n}\n\nstatic __inline __m256i __attribute__((__always_inline__, __nodebug__))\n_mm256_castpd_si256(__m256d in)\n{\n  return (__m256i)in;\n}\n\nstatic __inline __m256d __attribute__((__always_inline__, __nodebug__))\n_mm256_castps_pd(__m256 in)\n{\n  return (__m256d)in;\n}\n\nstatic __inline __m256i __attribute__((__always_inline__, __nodebug__))\n_mm256_castps_si256(__m256 in)\n{\n  return (__m256i)in;\n}\n\nstatic __inline __m256 __attribute__((__always_inline__, __nodebug__))\n_mm256_castsi256_ps(__m256i in)\n{\n  return (__m256)in;\n}\n\nstatic __inline __m256d __attribute__((__always_inline__, __nodebug__))\n_mm256_castsi256_pd(__m256i in)\n{\n  return (__m256d)in;\n}\n\nstatic __inline __m128d __attribute__((__always_inline__, __nodebug__))\n_mm256_castpd256_pd128(__m256d in)\n{\n  return __builtin_shufflevector(in, in, 0, 1);\n}\n\nstatic __inline __m128 __attribute__((__always_inline__, __nodebug__))\n_mm256_castps256_ps128(__m256 in)\n{\n  return __builtin_shufflevector(in, in, 0, 1, 2, 3);\n}\n\nstatic __inline __m128i __attribute__((__always_inline__, __nodebug__))\n_mm256_castsi256_si128(__m256i in)\n{\n  return __builtin_shufflevector(in, in, 0, 1);\n}\n\nstatic __inline __m256d __attribute__((__always_inline__, __nodebug__))\n_mm256_castpd128_pd256(__m128d in)\n{\n  __m128d zero = _mm_setzero_pd();\n  return __builtin_shufflevector(in, zero, 0, 1, 2, 2);\n}\n\nstatic __inline __m256 __attribute__((__always_inline__, __nodebug__))\n_mm256_castps128_ps256(__m128 in)\n{\n  __m128 zero = _mm_setzero_ps();\n  return __builtin_shufflevector(in, zero, 0, 1, 2, 3, 4, 4, 4, 4);\n}\n\nstatic __inline __m256i __attribute__((__always_inline__, __nodebug__))\n_mm256_castsi128_si256(__m128i in)\n{\n  __m128i zero = _mm_setzero_si128();\n  return __builtin_shufflevector(in, zero, 0, 1, 2, 2);\n}\n"
  },
  {
    "path": "freebsd-headers/clang/3.0/emmintrin.h",
    "content": "/*===---- emmintrin.h - SSE2 intrinsics ------------------------------------===\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n *\n *===-----------------------------------------------------------------------===\n */\n\n#ifndef __EMMINTRIN_H\n#define __EMMINTRIN_H\n\n#ifndef __SSE2__\n#error \"SSE2 instruction set not enabled\"\n#else\n\n#include <xmmintrin.h>\n\ntypedef double __m128d __attribute__((__vector_size__(16)));\ntypedef long long __m128i __attribute__((__vector_size__(16)));\n\n/* Type defines.  */\ntypedef double __v2df __attribute__ ((__vector_size__ (16)));\ntypedef long long __v2di __attribute__ ((__vector_size__ (16)));\ntypedef short __v8hi __attribute__((__vector_size__(16)));\ntypedef char __v16qi __attribute__((__vector_size__(16)));\n\nstatic __inline__ __m128d __attribute__((__always_inline__, __nodebug__))\n_mm_add_sd(__m128d a, __m128d b)\n{\n  a[0] += b[0];\n  return a;\n}\n\nstatic __inline__ __m128d __attribute__((__always_inline__, __nodebug__))\n_mm_add_pd(__m128d a, __m128d b)\n{\n  return a + b;\n}\n\nstatic __inline__ __m128d __attribute__((__always_inline__, __nodebug__))\n_mm_sub_sd(__m128d a, __m128d b)\n{\n  a[0] -= b[0];\n  return a;\n}\n\nstatic __inline__ __m128d __attribute__((__always_inline__, __nodebug__))\n_mm_sub_pd(__m128d a, __m128d b)\n{\n  return a - b;\n}\n\nstatic __inline__ __m128d __attribute__((__always_inline__, __nodebug__))\n_mm_mul_sd(__m128d a, __m128d b)\n{\n  a[0] *= b[0];\n  return a;\n}\n\nstatic __inline__ __m128d __attribute__((__always_inline__, __nodebug__))\n_mm_mul_pd(__m128d a, __m128d b)\n{\n  return a * b;\n}\n\nstatic __inline__ __m128d __attribute__((__always_inline__, __nodebug__))\n_mm_div_sd(__m128d a, __m128d b)\n{\n  a[0] /= b[0];\n  return a;\n}\n\nstatic __inline__ __m128d __attribute__((__always_inline__, __nodebug__))\n_mm_div_pd(__m128d a, __m128d b)\n{\n  return a / b;\n}\n\nstatic __inline__ __m128d __attribute__((__always_inline__, __nodebug__))\n_mm_sqrt_sd(__m128d a, __m128d b)\n{\n  __m128d c = __builtin_ia32_sqrtsd(b);\n  return (__m128d) { c[0], a[1] };\n}\n\nstatic __inline__ __m128d __attribute__((__always_inline__, __nodebug__))\n_mm_sqrt_pd(__m128d a)\n{\n  return __builtin_ia32_sqrtpd(a);\n}\n\nstatic __inline__ __m128d __attribute__((__always_inline__, __nodebug__))\n_mm_min_sd(__m128d a, __m128d b)\n{\n  return __builtin_ia32_minsd(a, b);\n}\n\nstatic __inline__ __m128d __attribute__((__always_inline__, __nodebug__))\n_mm_min_pd(__m128d a, __m128d b)\n{\n  return __builtin_ia32_minpd(a, b);\n}\n\nstatic __inline__ __m128d __attribute__((__always_inline__, __nodebug__))\n_mm_max_sd(__m128d a, __m128d b)\n{\n  return __builtin_ia32_maxsd(a, b);\n}\n\nstatic __inline__ __m128d __attribute__((__always_inline__, __nodebug__))\n_mm_max_pd(__m128d a, __m128d b)\n{\n  return __builtin_ia32_maxpd(a, b);\n}\n\nstatic __inline__ __m128d __attribute__((__always_inline__, __nodebug__))\n_mm_and_pd(__m128d a, __m128d b)\n{\n  return (__m128d)((__v4si)a & (__v4si)b);\n}\n\nstatic __inline__ __m128d __attribute__((__always_inline__, __nodebug__))\n_mm_andnot_pd(__m128d a, __m128d b)\n{\n  return (__m128d)(~(__v4si)a & (__v4si)b);\n}\n\nstatic __inline__ __m128d __attribute__((__always_inline__, __nodebug__))\n_mm_or_pd(__m128d a, __m128d b)\n{\n  return (__m128d)((__v4si)a | (__v4si)b);\n}\n\nstatic __inline__ __m128d __attribute__((__always_inline__, __nodebug__))\n_mm_xor_pd(__m128d a, __m128d b)\n{\n  return (__m128d)((__v4si)a ^ (__v4si)b);\n}\n\nstatic __inline__ __m128d __attribute__((__always_inline__, __nodebug__))\n_mm_cmpeq_pd(__m128d a, __m128d b)\n{\n  return (__m128d)__builtin_ia32_cmppd(a, b, 0);\n}\n\nstatic __inline__ __m128d __attribute__((__always_inline__, __nodebug__))\n_mm_cmplt_pd(__m128d a, __m128d b)\n{\n  return (__m128d)__builtin_ia32_cmppd(a, b, 1);\n}\n\nstatic __inline__ __m128d __attribute__((__always_inline__, __nodebug__))\n_mm_cmple_pd(__m128d a, __m128d b)\n{\n  return (__m128d)__builtin_ia32_cmppd(a, b, 2);\n}\n\nstatic __inline__ __m128d __attribute__((__always_inline__, __nodebug__))\n_mm_cmpgt_pd(__m128d a, __m128d b)\n{\n  return (__m128d)__builtin_ia32_cmppd(b, a, 1);\n}\n\nstatic __inline__ __m128d __attribute__((__always_inline__, __nodebug__))\n_mm_cmpge_pd(__m128d a, __m128d b)\n{\n  return (__m128d)__builtin_ia32_cmppd(b, a, 2);\n}\n\nstatic __inline__ __m128d __attribute__((__always_inline__, __nodebug__))\n_mm_cmpord_pd(__m128d a, __m128d b)\n{\n  return (__m128d)__builtin_ia32_cmppd(a, b, 7);\n}\n\nstatic __inline__ __m128d __attribute__((__always_inline__, __nodebug__))\n_mm_cmpunord_pd(__m128d a, __m128d b)\n{\n  return (__m128d)__builtin_ia32_cmppd(a, b, 3);\n}\n\nstatic __inline__ __m128d __attribute__((__always_inline__, __nodebug__))\n_mm_cmpneq_pd(__m128d a, __m128d b)\n{\n  return (__m128d)__builtin_ia32_cmppd(a, b, 4);\n}\n\nstatic __inline__ __m128d __attribute__((__always_inline__, __nodebug__))\n_mm_cmpnlt_pd(__m128d a, __m128d b)\n{\n  return (__m128d)__builtin_ia32_cmppd(a, b, 5);\n}\n\nstatic __inline__ __m128d __attribute__((__always_inline__, __nodebug__))\n_mm_cmpnle_pd(__m128d a, __m128d b)\n{\n  return (__m128d)__builtin_ia32_cmppd(a, b, 6);\n}\n\nstatic __inline__ __m128d __attribute__((__always_inline__, __nodebug__))\n_mm_cmpngt_pd(__m128d a, __m128d b)\n{\n  return (__m128d)__builtin_ia32_cmppd(b, a, 5);\n}\n\nstatic __inline__ __m128d __attribute__((__always_inline__, __nodebug__))\n_mm_cmpnge_pd(__m128d a, __m128d b)\n{\n  return (__m128d)__builtin_ia32_cmppd(b, a, 6);\n}\n\nstatic __inline__ __m128d __attribute__((__always_inline__, __nodebug__))\n_mm_cmpeq_sd(__m128d a, __m128d b)\n{\n  return (__m128d)__builtin_ia32_cmpsd(a, b, 0);\n}\n\nstatic __inline__ __m128d __attribute__((__always_inline__, __nodebug__))\n_mm_cmplt_sd(__m128d a, __m128d b)\n{\n  return (__m128d)__builtin_ia32_cmpsd(a, b, 1);\n}\n\nstatic __inline__ __m128d __attribute__((__always_inline__, __nodebug__))\n_mm_cmple_sd(__m128d a, __m128d b)\n{\n  return (__m128d)__builtin_ia32_cmpsd(a, b, 2);\n}\n\nstatic __inline__ __m128d __attribute__((__always_inline__, __nodebug__))\n_mm_cmpgt_sd(__m128d a, __m128d b)\n{\n  return (__m128d)__builtin_ia32_cmpsd(b, a, 1);\n}\n\nstatic __inline__ __m128d __attribute__((__always_inline__, __nodebug__))\n_mm_cmpge_sd(__m128d a, __m128d b)\n{\n  return (__m128d)__builtin_ia32_cmpsd(b, a, 2);\n}\n\nstatic __inline__ __m128d __attribute__((__always_inline__, __nodebug__))\n_mm_cmpord_sd(__m128d a, __m128d b)\n{\n  return (__m128d)__builtin_ia32_cmpsd(a, b, 7);\n}\n\nstatic __inline__ __m128d __attribute__((__always_inline__, __nodebug__))\n_mm_cmpunord_sd(__m128d a, __m128d b)\n{\n  return (__m128d)__builtin_ia32_cmpsd(a, b, 3);\n}\n\nstatic __inline__ __m128d __attribute__((__always_inline__, __nodebug__))\n_mm_cmpneq_sd(__m128d a, __m128d b)\n{\n  return (__m128d)__builtin_ia32_cmpsd(a, b, 4);\n}\n\nstatic __inline__ __m128d __attribute__((__always_inline__, __nodebug__))\n_mm_cmpnlt_sd(__m128d a, __m128d b)\n{\n  return (__m128d)__builtin_ia32_cmpsd(a, b, 5);\n}\n\nstatic __inline__ __m128d __attribute__((__always_inline__, __nodebug__))\n_mm_cmpnle_sd(__m128d a, __m128d b)\n{\n  return (__m128d)__builtin_ia32_cmpsd(a, b, 6);\n}\n\nstatic __inline__ __m128d __attribute__((__always_inline__, __nodebug__))\n_mm_cmpngt_sd(__m128d a, __m128d b)\n{\n  return (__m128d)__builtin_ia32_cmpsd(b, a, 5);\n}\n\nstatic __inline__ __m128d __attribute__((__always_inline__, __nodebug__))\n_mm_cmpnge_sd(__m128d a, __m128d b)\n{\n  return (__m128d)__builtin_ia32_cmpsd(b, a, 6);\n}\n\nstatic __inline__ int __attribute__((__always_inline__, __nodebug__))\n_mm_comieq_sd(__m128d a, __m128d b)\n{\n  return __builtin_ia32_comisdeq(a, b);\n}\n\nstatic __inline__ int __attribute__((__always_inline__, __nodebug__))\n_mm_comilt_sd(__m128d a, __m128d b)\n{\n  return __builtin_ia32_comisdlt(a, b);\n}\n\nstatic __inline__ int __attribute__((__always_inline__, __nodebug__))\n_mm_comile_sd(__m128d a, __m128d b)\n{\n  return __builtin_ia32_comisdle(a, b);\n}\n\nstatic __inline__ int __attribute__((__always_inline__, __nodebug__))\n_mm_comigt_sd(__m128d a, __m128d b)\n{\n  return __builtin_ia32_comisdgt(a, b);\n}\n\nstatic __inline__ int __attribute__((__always_inline__, __nodebug__))\n_mm_comige_sd(__m128d a, __m128d b)\n{\n  return __builtin_ia32_comisdge(a, b);\n}\n\nstatic __inline__ int __attribute__((__always_inline__, __nodebug__))\n_mm_comineq_sd(__m128d a, __m128d b)\n{\n  return __builtin_ia32_comisdneq(a, b);\n}\n\nstatic __inline__ int __attribute__((__always_inline__, __nodebug__))\n_mm_ucomieq_sd(__m128d a, __m128d b)\n{\n  return __builtin_ia32_ucomisdeq(a, b);\n}\n\nstatic __inline__ int __attribute__((__always_inline__, __nodebug__))\n_mm_ucomilt_sd(__m128d a, __m128d b)\n{\n  return __builtin_ia32_ucomisdlt(a, b);\n}\n\nstatic __inline__ int __attribute__((__always_inline__, __nodebug__))\n_mm_ucomile_sd(__m128d a, __m128d b)\n{\n  return __builtin_ia32_ucomisdle(a, b);\n}\n\nstatic __inline__ int __attribute__((__always_inline__, __nodebug__))\n_mm_ucomigt_sd(__m128d a, __m128d b)\n{\n  return __builtin_ia32_ucomisdgt(a, b);\n}\n\nstatic __inline__ int __attribute__((__always_inline__, __nodebug__))\n_mm_ucomige_sd(__m128d a, __m128d b)\n{\n  return __builtin_ia32_ucomisdge(a, b);\n}\n\nstatic __inline__ int __attribute__((__always_inline__, __nodebug__))\n_mm_ucomineq_sd(__m128d a, __m128d b)\n{\n  return __builtin_ia32_ucomisdneq(a, b);\n}\n\nstatic __inline__ __m128 __attribute__((__always_inline__, __nodebug__))\n_mm_cvtpd_ps(__m128d a)\n{\n  return __builtin_ia32_cvtpd2ps(a);\n}\n\nstatic __inline__ __m128d __attribute__((__always_inline__, __nodebug__))\n_mm_cvtps_pd(__m128 a)\n{\n  return __builtin_ia32_cvtps2pd(a);\n}\n\nstatic __inline__ __m128d __attribute__((__always_inline__, __nodebug__))\n_mm_cvtepi32_pd(__m128i a)\n{\n  return __builtin_ia32_cvtdq2pd((__v4si)a);\n}\n\nstatic __inline__ __m128i __attribute__((__always_inline__, __nodebug__))\n_mm_cvtpd_epi32(__m128d a)\n{\n  return __builtin_ia32_cvtpd2dq(a);\n}\n\nstatic __inline__ int __attribute__((__always_inline__, __nodebug__))\n_mm_cvtsd_si32(__m128d a)\n{\n  return __builtin_ia32_cvtsd2si(a);\n}\n\nstatic __inline__ __m128 __attribute__((__always_inline__, __nodebug__))\n_mm_cvtsd_ss(__m128 a, __m128d b)\n{\n  a[0] = b[0];\n  return a;\n}\n\nstatic __inline__ __m128d __attribute__((__always_inline__, __nodebug__))\n_mm_cvtsi32_sd(__m128d a, int b)\n{\n  a[0] = b;\n  return a;\n}\n\nstatic __inline__ __m128d __attribute__((__always_inline__, __nodebug__))\n_mm_cvtss_sd(__m128d a, __m128 b)\n{\n  a[0] = b[0];\n  return a;\n}\n\nstatic __inline__ __m128i __attribute__((__always_inline__, __nodebug__))\n_mm_cvttpd_epi32(__m128d a)\n{\n  return (__m128i)__builtin_ia32_cvttpd2dq(a);\n}\n\nstatic __inline__ int __attribute__((__always_inline__, __nodebug__))\n_mm_cvttsd_si32(__m128d a)\n{\n  return a[0];\n}\n\nstatic __inline__ __m64 __attribute__((__always_inline__, __nodebug__))\n_mm_cvtpd_pi32(__m128d a)\n{\n  return (__m64)__builtin_ia32_cvtpd2pi(a);\n}\n\nstatic __inline__ __m64 __attribute__((__always_inline__, __nodebug__))\n_mm_cvttpd_pi32(__m128d a)\n{\n  return (__m64)__builtin_ia32_cvttpd2pi(a);\n}\n\nstatic __inline__ __m128d __attribute__((__always_inline__, __nodebug__))\n_mm_cvtpi32_pd(__m64 a)\n{\n  return __builtin_ia32_cvtpi2pd((__v2si)a);\n}\n\nstatic __inline__ double __attribute__((__always_inline__, __nodebug__))\n_mm_cvtsd_f64(__m128d a)\n{\n  return a[0];\n}\n\nstatic __inline__ __m128d __attribute__((__always_inline__, __nodebug__))\n_mm_load_pd(double const *dp)\n{\n  return *(__m128d*)dp;\n}\n\nstatic __inline__ __m128d __attribute__((__always_inline__, __nodebug__))\n_mm_load1_pd(double const *dp)\n{\n  struct __mm_load1_pd_struct {\n    double u;\n  } __attribute__((__packed__, __may_alias__));\n  double u = ((struct __mm_load1_pd_struct*)dp)->u;\n  return (__m128d){ u, u };\n}\n\n#define        _mm_load_pd1(dp)        _mm_load1_pd(dp)\n\nstatic __inline__ __m128d __attribute__((__always_inline__, __nodebug__))\n_mm_loadr_pd(double const *dp)\n{\n  __m128d u = *(__m128d*)dp;\n  return __builtin_shufflevector(u, u, 1, 0);\n}\n\nstatic __inline__ __m128d __attribute__((__always_inline__, __nodebug__))\n_mm_loadu_pd(double const *dp)\n{\n  struct __loadu_pd {\n    __m128d v;\n  } __attribute__((packed, may_alias));\n  return ((struct __loadu_pd*)dp)->v;\n}\n\nstatic __inline__ __m128d __attribute__((__always_inline__, __nodebug__))\n_mm_load_sd(double const *dp)\n{\n  struct __mm_load_sd_struct {\n    double u;\n  } __attribute__((__packed__, __may_alias__));\n  double u = ((struct __mm_load_sd_struct*)dp)->u;\n  return (__m128d){ u, 0 };\n}\n\nstatic __inline__ __m128d __attribute__((__always_inline__, __nodebug__))\n_mm_loadh_pd(__m128d a, double const *dp)\n{\n  struct __mm_loadh_pd_struct {\n    double u;\n  } __attribute__((__packed__, __may_alias__));\n  double u = ((struct __mm_loadh_pd_struct*)dp)->u;\n  return (__m128d){ a[0], u };\n}\n\nstatic __inline__ __m128d __attribute__((__always_inline__, __nodebug__))\n_mm_loadl_pd(__m128d a, double const *dp)\n{\n  struct __mm_loadl_pd_struct {\n    double u;\n  } __attribute__((__packed__, __may_alias__));\n  double u = ((struct __mm_loadl_pd_struct*)dp)->u;\n  return (__m128d){ u, a[1] }; \n}\n\nstatic __inline__ __m128d __attribute__((__always_inline__, __nodebug__))\n_mm_set_sd(double w)\n{\n  return (__m128d){ w, 0 };\n}\n\nstatic __inline__ __m128d __attribute__((__always_inline__, __nodebug__))\n_mm_set1_pd(double w)\n{\n  return (__m128d){ w, w };\n}\n\nstatic __inline__ __m128d __attribute__((__always_inline__, __nodebug__))\n_mm_set_pd(double w, double x)\n{\n  return (__m128d){ x, w };\n}\n\nstatic __inline__ __m128d __attribute__((__always_inline__, __nodebug__))\n_mm_setr_pd(double w, double x)\n{\n  return (__m128d){ w, x };\n}\n\nstatic __inline__ __m128d __attribute__((__always_inline__, __nodebug__))\n_mm_setzero_pd(void)\n{\n  return (__m128d){ 0, 0 };\n}\n\nstatic __inline__ __m128d __attribute__((__always_inline__, __nodebug__))\n_mm_move_sd(__m128d a, __m128d b)\n{\n  return (__m128d){ b[0], a[1] };\n}\n\nstatic __inline__ void __attribute__((__always_inline__, __nodebug__))\n_mm_store_sd(double *dp, __m128d a)\n{\n  struct __mm_store_sd_struct {\n    double u;\n  } __attribute__((__packed__, __may_alias__));\n  ((struct __mm_store_sd_struct*)dp)->u = a[0];\n}\n\nstatic __inline__ void __attribute__((__always_inline__, __nodebug__))\n_mm_store1_pd(double *dp, __m128d a)\n{\n  struct __mm_store1_pd_struct {\n    double u[2];\n  } __attribute__((__packed__, __may_alias__));\n  ((struct __mm_store1_pd_struct*)dp)->u[0] = a[0];\n  ((struct __mm_store1_pd_struct*)dp)->u[1] = a[0];\n}\n\nstatic __inline__ void __attribute__((__always_inline__, __nodebug__))\n_mm_store_pd(double *dp, __m128d a)\n{\n  *(__m128d *)dp = a;\n}\n\nstatic __inline__ void __attribute__((__always_inline__, __nodebug__))\n_mm_storeu_pd(double *dp, __m128d a)\n{\n  __builtin_ia32_storeupd(dp, a);\n}\n\nstatic __inline__ void __attribute__((__always_inline__, __nodebug__))\n_mm_storer_pd(double *dp, __m128d a)\n{\n  a = __builtin_shufflevector(a, a, 1, 0);\n  *(__m128d *)dp = a;\n}\n\nstatic __inline__ void __attribute__((__always_inline__, __nodebug__))\n_mm_storeh_pd(double *dp, __m128d a)\n{\n  struct __mm_storeh_pd_struct {\n    double u;\n  } __attribute__((__packed__, __may_alias__));\n  ((struct __mm_storeh_pd_struct*)dp)->u = a[1];\n}\n\nstatic __inline__ void __attribute__((__always_inline__, __nodebug__))\n_mm_storel_pd(double *dp, __m128d a)\n{\n  struct __mm_storeh_pd_struct {\n    double u;\n  } __attribute__((__packed__, __may_alias__));\n  ((struct __mm_storeh_pd_struct*)dp)->u = a[0];\n}\n\nstatic __inline__ __m128i __attribute__((__always_inline__, __nodebug__))\n_mm_add_epi8(__m128i a, __m128i b)\n{\n  return (__m128i)((__v16qi)a + (__v16qi)b);\n}\n\nstatic __inline__ __m128i __attribute__((__always_inline__, __nodebug__))\n_mm_add_epi16(__m128i a, __m128i b)\n{\n  return (__m128i)((__v8hi)a + (__v8hi)b);\n}\n\nstatic __inline__ __m128i __attribute__((__always_inline__, __nodebug__))\n_mm_add_epi32(__m128i a, __m128i b)\n{\n  return (__m128i)((__v4si)a + (__v4si)b);\n}\n\nstatic __inline__ __m64 __attribute__((__always_inline__, __nodebug__))\n_mm_add_si64(__m64 a, __m64 b)\n{\n  return a + b;\n}\n\nstatic __inline__ __m128i __attribute__((__always_inline__, __nodebug__))\n_mm_add_epi64(__m128i a, __m128i b)\n{\n  return a + b;\n}\n\nstatic __inline__ __m128i __attribute__((__always_inline__, __nodebug__))\n_mm_adds_epi8(__m128i a, __m128i b)\n{\n  return (__m128i)__builtin_ia32_paddsb128((__v16qi)a, (__v16qi)b);\n}\n\nstatic __inline__ __m128i __attribute__((__always_inline__, __nodebug__))\n_mm_adds_epi16(__m128i a, __m128i b)\n{\n  return (__m128i)__builtin_ia32_paddsw128((__v8hi)a, (__v8hi)b);\n}\n\nstatic __inline__ __m128i __attribute__((__always_inline__, __nodebug__))\n_mm_adds_epu8(__m128i a, __m128i b)\n{\n  return (__m128i)__builtin_ia32_paddusb128((__v16qi)a, (__v16qi)b);\n}\n\nstatic __inline__ __m128i __attribute__((__always_inline__, __nodebug__))\n_mm_adds_epu16(__m128i a, __m128i b)\n{\n  return (__m128i)__builtin_ia32_paddusw128((__v8hi)a, (__v8hi)b);\n}\n\nstatic __inline__ __m128i __attribute__((__always_inline__, __nodebug__))\n_mm_avg_epu8(__m128i a, __m128i b)\n{\n  return (__m128i)__builtin_ia32_pavgb128((__v16qi)a, (__v16qi)b);\n}\n\nstatic __inline__ __m128i __attribute__((__always_inline__, __nodebug__))\n_mm_avg_epu16(__m128i a, __m128i b)\n{\n  return (__m128i)__builtin_ia32_pavgw128((__v8hi)a, (__v8hi)b);\n}\n\nstatic __inline__ __m128i __attribute__((__always_inline__, __nodebug__))\n_mm_madd_epi16(__m128i a, __m128i b)\n{\n  return (__m128i)__builtin_ia32_pmaddwd128((__v8hi)a, (__v8hi)b);\n}\n\nstatic __inline__ __m128i __attribute__((__always_inline__, __nodebug__))\n_mm_max_epi16(__m128i a, __m128i b)\n{\n  return (__m128i)__builtin_ia32_pmaxsw128((__v8hi)a, (__v8hi)b);\n}\n\nstatic __inline__ __m128i __attribute__((__always_inline__, __nodebug__))\n_mm_max_epu8(__m128i a, __m128i b)\n{\n  return (__m128i)__builtin_ia32_pmaxub128((__v16qi)a, (__v16qi)b);\n}\n\nstatic __inline__ __m128i __attribute__((__always_inline__, __nodebug__))\n_mm_min_epi16(__m128i a, __m128i b)\n{\n  return (__m128i)__builtin_ia32_pminsw128((__v8hi)a, (__v8hi)b);\n}\n\nstatic __inline__ __m128i __attribute__((__always_inline__, __nodebug__))\n_mm_min_epu8(__m128i a, __m128i b)\n{\n  return (__m128i)__builtin_ia32_pminub128((__v16qi)a, (__v16qi)b);\n}\n\nstatic __inline__ __m128i __attribute__((__always_inline__, __nodebug__))\n_mm_mulhi_epi16(__m128i a, __m128i b)\n{\n  return (__m128i)__builtin_ia32_pmulhw128((__v8hi)a, (__v8hi)b);\n}\n\nstatic __inline__ __m128i __attribute__((__always_inline__, __nodebug__))\n_mm_mulhi_epu16(__m128i a, __m128i b)\n{\n  return (__m128i)__builtin_ia32_pmulhuw128((__v8hi)a, (__v8hi)b);\n}\n\nstatic __inline__ __m128i __attribute__((__always_inline__, __nodebug__))\n_mm_mullo_epi16(__m128i a, __m128i b)\n{\n  return (__m128i)((__v8hi)a * (__v8hi)b);\n}\n\nstatic __inline__ __m64 __attribute__((__always_inline__, __nodebug__))\n_mm_mul_su32(__m64 a, __m64 b)\n{\n  return __builtin_ia32_pmuludq((__v2si)a, (__v2si)b);\n}\n\nstatic __inline__ __m128i __attribute__((__always_inline__, __nodebug__))\n_mm_mul_epu32(__m128i a, __m128i b)\n{\n  return __builtin_ia32_pmuludq128((__v4si)a, (__v4si)b);\n}\n\nstatic __inline__ __m128i __attribute__((__always_inline__, __nodebug__))\n_mm_sad_epu8(__m128i a, __m128i b)\n{\n  return __builtin_ia32_psadbw128((__v16qi)a, (__v16qi)b);\n}\n\nstatic __inline__ __m128i __attribute__((__always_inline__, __nodebug__))\n_mm_sub_epi8(__m128i a, __m128i b)\n{\n  return (__m128i)((__v16qi)a - (__v16qi)b);\n}\n\nstatic __inline__ __m128i __attribute__((__always_inline__, __nodebug__))\n_mm_sub_epi16(__m128i a, __m128i b)\n{\n  return (__m128i)((__v8hi)a - (__v8hi)b);\n}\n\nstatic __inline__ __m128i __attribute__((__always_inline__, __nodebug__))\n_mm_sub_epi32(__m128i a, __m128i b)\n{\n  return (__m128i)((__v4si)a - (__v4si)b);\n}\n\nstatic __inline__ __m64 __attribute__((__always_inline__, __nodebug__))\n_mm_sub_si64(__m64 a, __m64 b)\n{\n  return a - b;\n}\n\nstatic __inline__ __m128i __attribute__((__always_inline__, __nodebug__))\n_mm_sub_epi64(__m128i a, __m128i b)\n{\n  return a - b;\n}\n\nstatic __inline__ __m128i __attribute__((__always_inline__, __nodebug__))\n_mm_subs_epi8(__m128i a, __m128i b)\n{\n  return (__m128i)__builtin_ia32_psubsb128((__v16qi)a, (__v16qi)b);\n}\n\nstatic __inline__ __m128i __attribute__((__always_inline__, __nodebug__))\n_mm_subs_epi16(__m128i a, __m128i b)\n{\n  return (__m128i)__builtin_ia32_psubsw128((__v8hi)a, (__v8hi)b);\n}\n\nstatic __inline__ __m128i __attribute__((__always_inline__, __nodebug__))\n_mm_subs_epu8(__m128i a, __m128i b)\n{\n  return (__m128i)__builtin_ia32_psubusb128((__v16qi)a, (__v16qi)b);\n}\n\nstatic __inline__ __m128i __attribute__((__always_inline__, __nodebug__))\n_mm_subs_epu16(__m128i a, __m128i b)\n{\n  return (__m128i)__builtin_ia32_psubusw128((__v8hi)a, (__v8hi)b);\n}\n\nstatic __inline__ __m128i __attribute__((__always_inline__, __nodebug__))\n_mm_and_si128(__m128i a, __m128i b)\n{\n  return a & b;\n}\n\nstatic __inline__ __m128i __attribute__((__always_inline__, __nodebug__))\n_mm_andnot_si128(__m128i a, __m128i b)\n{\n  return ~a & b;\n}\n\nstatic __inline__ __m128i __attribute__((__always_inline__, __nodebug__))\n_mm_or_si128(__m128i a, __m128i b)\n{\n  return a | b;\n}\n\nstatic __inline__ __m128i __attribute__((__always_inline__, __nodebug__))\n_mm_xor_si128(__m128i a, __m128i b)\n{\n  return a ^ b;\n}\n\n#define _mm_slli_si128(VEC, IMM) \\\n  ((__m128i)__builtin_ia32_pslldqi128((__m128i)(VEC), (IMM)*8))\n\nstatic __inline__ __m128i __attribute__((__always_inline__, __nodebug__))\n_mm_slli_epi16(__m128i a, int count)\n{\n  return (__m128i)__builtin_ia32_psllwi128((__v8hi)a, count);\n}\n\nstatic __inline__ __m128i __attribute__((__always_inline__, __nodebug__))\n_mm_sll_epi16(__m128i a, __m128i count)\n{\n  return (__m128i)__builtin_ia32_psllw128((__v8hi)a, (__v8hi)count);\n}\n\nstatic __inline__ __m128i __attribute__((__always_inline__, __nodebug__))\n_mm_slli_epi32(__m128i a, int count)\n{\n  return (__m128i)__builtin_ia32_pslldi128((__v4si)a, count);\n}\n\nstatic __inline__ __m128i __attribute__((__always_inline__, __nodebug__))\n_mm_sll_epi32(__m128i a, __m128i count)\n{\n  return (__m128i)__builtin_ia32_pslld128((__v4si)a, (__v4si)count);\n}\n\nstatic __inline__ __m128i __attribute__((__always_inline__, __nodebug__))\n_mm_slli_epi64(__m128i a, int count)\n{\n  return __builtin_ia32_psllqi128(a, count);\n}\n\nstatic __inline__ __m128i __attribute__((__always_inline__, __nodebug__))\n_mm_sll_epi64(__m128i a, __m128i count)\n{\n  return __builtin_ia32_psllq128(a, count);\n}\n\nstatic __inline__ __m128i __attribute__((__always_inline__, __nodebug__))\n_mm_srai_epi16(__m128i a, int count)\n{\n  return (__m128i)__builtin_ia32_psrawi128((__v8hi)a, count);\n}\n\nstatic __inline__ __m128i __attribute__((__always_inline__, __nodebug__))\n_mm_sra_epi16(__m128i a, __m128i count)\n{\n  return (__m128i)__builtin_ia32_psraw128((__v8hi)a, (__v8hi)count);\n}\n\nstatic __inline__ __m128i __attribute__((__always_inline__, __nodebug__))\n_mm_srai_epi32(__m128i a, int count)\n{\n  return (__m128i)__builtin_ia32_psradi128((__v4si)a, count);\n}\n\nstatic __inline__ __m128i __attribute__((__always_inline__, __nodebug__))\n_mm_sra_epi32(__m128i a, __m128i count)\n{\n  return (__m128i)__builtin_ia32_psrad128((__v4si)a, (__v4si)count);\n}\n\n\n#define _mm_srli_si128(VEC, IMM) \\\n  ((__m128i)__builtin_ia32_psrldqi128((__m128i)(VEC), (IMM)*8))\n\nstatic __inline__ __m128i __attribute__((__always_inline__, __nodebug__))\n_mm_srli_epi16(__m128i a, int count)\n{\n  return (__m128i)__builtin_ia32_psrlwi128((__v8hi)a, count);\n}\n\nstatic __inline__ __m128i __attribute__((__always_inline__, __nodebug__))\n_mm_srl_epi16(__m128i a, __m128i count)\n{\n  return (__m128i)__builtin_ia32_psrlw128((__v8hi)a, (__v8hi)count);\n}\n\nstatic __inline__ __m128i __attribute__((__always_inline__, __nodebug__))\n_mm_srli_epi32(__m128i a, int count)\n{\n  return (__m128i)__builtin_ia32_psrldi128((__v4si)a, count);\n}\n\nstatic __inline__ __m128i __attribute__((__always_inline__, __nodebug__))\n_mm_srl_epi32(__m128i a, __m128i count)\n{\n  return (__m128i)__builtin_ia32_psrld128((__v4si)a, (__v4si)count);\n}\n\nstatic __inline__ __m128i __attribute__((__always_inline__, __nodebug__))\n_mm_srli_epi64(__m128i a, int count)\n{\n  return __builtin_ia32_psrlqi128(a, count);\n}\n\nstatic __inline__ __m128i __attribute__((__always_inline__, __nodebug__))\n_mm_srl_epi64(__m128i a, __m128i count)\n{\n  return __builtin_ia32_psrlq128(a, count);\n}\n\nstatic __inline__ __m128i __attribute__((__always_inline__, __nodebug__))\n_mm_cmpeq_epi8(__m128i a, __m128i b)\n{\n  return (__m128i)((__v16qi)a == (__v16qi)b);\n}\n\nstatic __inline__ __m128i __attribute__((__always_inline__, __nodebug__))\n_mm_cmpeq_epi16(__m128i a, __m128i b)\n{\n  return (__m128i)((__v8hi)a == (__v8hi)b);\n}\n\nstatic __inline__ __m128i __attribute__((__always_inline__, __nodebug__))\n_mm_cmpeq_epi32(__m128i a, __m128i b)\n{\n  return (__m128i)((__v4si)a == (__v4si)b);\n}\n\nstatic __inline__ __m128i __attribute__((__always_inline__, __nodebug__))\n_mm_cmpgt_epi8(__m128i a, __m128i b)\n{\n  return (__m128i)((__v16qi)a > (__v16qi)b);\n}\n\nstatic __inline__ __m128i __attribute__((__always_inline__, __nodebug__))\n_mm_cmpgt_epi16(__m128i a, __m128i b)\n{\n  return (__m128i)((__v8hi)a > (__v8hi)b);\n}\n\nstatic __inline__ __m128i __attribute__((__always_inline__, __nodebug__))\n_mm_cmpgt_epi32(__m128i a, __m128i b)\n{\n  return (__m128i)((__v4si)a > (__v4si)b);\n}\n\nstatic __inline__ __m128i __attribute__((__always_inline__, __nodebug__))\n_mm_cmplt_epi8(__m128i a, __m128i b)\n{\n  return _mm_cmpgt_epi8(b,a);\n}\n\nstatic __inline__ __m128i __attribute__((__always_inline__, __nodebug__))\n_mm_cmplt_epi16(__m128i a, __m128i b)\n{\n  return _mm_cmpgt_epi16(b,a);\n}\n\nstatic __inline__ __m128i __attribute__((__always_inline__, __nodebug__))\n_mm_cmplt_epi32(__m128i a, __m128i b)\n{\n  return _mm_cmpgt_epi32(b,a);\n}\n\n#ifdef __x86_64__\nstatic __inline__ __m128d __attribute__((__always_inline__, __nodebug__))\n_mm_cvtsi64_sd(__m128d a, long long b)\n{\n  a[0] = b;\n  return a;\n}\n\nstatic __inline__ long long __attribute__((__always_inline__, __nodebug__))\n_mm_cvtsd_si64(__m128d a)\n{\n  return __builtin_ia32_cvtsd2si64(a);\n}\n\nstatic __inline__ long long __attribute__((__always_inline__, __nodebug__))\n_mm_cvttsd_si64(__m128d a)\n{\n  return a[0];\n}\n#endif\n\nstatic __inline__ __m128 __attribute__((__always_inline__, __nodebug__))\n_mm_cvtepi32_ps(__m128i a)\n{\n  return __builtin_ia32_cvtdq2ps((__v4si)a);\n}\n\nstatic __inline__ __m128i __attribute__((__always_inline__, __nodebug__))\n_mm_cvtps_epi32(__m128 a)\n{\n  return (__m128i)__builtin_ia32_cvtps2dq(a);\n}\n\nstatic __inline__ __m128i __attribute__((__always_inline__, __nodebug__))\n_mm_cvttps_epi32(__m128 a)\n{\n  return (__m128i)__builtin_ia32_cvttps2dq(a);\n}\n\nstatic __inline__ __m128i __attribute__((__always_inline__, __nodebug__))\n_mm_cvtsi32_si128(int a)\n{\n  return (__m128i)(__v4si){ a, 0, 0, 0 };\n}\n\n#ifdef __x86_64__\nstatic __inline__ __m128i __attribute__((__always_inline__, __nodebug__))\n_mm_cvtsi64_si128(long long a)\n{\n  return (__m128i){ a, 0 };\n}\n#endif\n\nstatic __inline__ int __attribute__((__always_inline__, __nodebug__))\n_mm_cvtsi128_si32(__m128i a)\n{\n  __v4si b = (__v4si)a;\n  return b[0];\n}\n\n#ifdef __x86_64__\nstatic __inline__ long long __attribute__((__always_inline__, __nodebug__))\n_mm_cvtsi128_si64(__m128i a)\n{\n  return a[0];\n}\n#endif\n\nstatic __inline__ __m128i __attribute__((__always_inline__, __nodebug__))\n_mm_load_si128(__m128i const *p)\n{\n  return *p;\n}\n\nstatic __inline__ __m128i __attribute__((__always_inline__, __nodebug__))\n_mm_loadu_si128(__m128i const *p)\n{\n  struct __loadu_si128 {\n    __m128i v;\n  } __attribute__((packed, may_alias));\n  return ((struct __loadu_si128*)p)->v;\n}\n\nstatic __inline__ __m128i __attribute__((__always_inline__, __nodebug__))\n_mm_loadl_epi64(__m128i const *p)\n{\n  struct __mm_loadl_epi64_struct {\n    long long u;\n  } __attribute__((__packed__, __may_alias__));\n  return (__m128i) { ((struct __mm_loadl_epi64_struct*)p)->u, 0};\n}\n\nstatic __inline__ __m128i __attribute__((__always_inline__, __nodebug__))\n_mm_set_epi64x(long long q1, long long q0)\n{\n  return (__m128i){ q0, q1 };\n}\n\nstatic __inline__ __m128i __attribute__((__always_inline__, __nodebug__))\n_mm_set_epi64(__m64 q1, __m64 q0)\n{\n  return (__m128i){ (long long)q0, (long long)q1 };\n}\n\nstatic __inline__ __m128i __attribute__((__always_inline__, __nodebug__))\n_mm_set_epi32(int i3, int i2, int i1, int i0)\n{\n  return (__m128i)(__v4si){ i0, i1, i2, i3};\n}\n\nstatic __inline__ __m128i __attribute__((__always_inline__, __nodebug__))\n_mm_set_epi16(short w7, short w6, short w5, short w4, short w3, short w2, short w1, short w0)\n{\n  return (__m128i)(__v8hi){ w0, w1, w2, w3, w4, w5, w6, w7 };\n}\n\nstatic __inline__ __m128i __attribute__((__always_inline__, __nodebug__))\n_mm_set_epi8(char b15, char b14, char b13, char b12, char b11, char b10, char b9, char b8, char b7, char b6, char b5, char b4, char b3, char b2, char b1, char b0)\n{\n  return (__m128i)(__v16qi){ b0, b1, b2, b3, b4, b5, b6, b7, b8, b9, b10, b11, b12, b13, b14, b15 };\n}\n\nstatic __inline__ __m128i __attribute__((__always_inline__, __nodebug__))\n_mm_set1_epi64x(long long q)\n{\n  return (__m128i){ q, q };\n}\n\nstatic __inline__ __m128i __attribute__((__always_inline__, __nodebug__))\n_mm_set1_epi64(__m64 q)\n{\n  return (__m128i){ (long long)q, (long long)q };\n}\n\nstatic __inline__ __m128i __attribute__((__always_inline__, __nodebug__))\n_mm_set1_epi32(int i)\n{\n  return (__m128i)(__v4si){ i, i, i, i };\n}\n\nstatic __inline__ __m128i __attribute__((__always_inline__, __nodebug__))\n_mm_set1_epi16(short w)\n{\n  return (__m128i)(__v8hi){ w, w, w, w, w, w, w, w };\n}\n\nstatic __inline__ __m128i __attribute__((__always_inline__, __nodebug__))\n_mm_set1_epi8(char b)\n{\n  return (__m128i)(__v16qi){ b, b, b, b, b, b, b, b, b, b, b, b, b, b, b, b };\n}\n\nstatic __inline__ __m128i __attribute__((__always_inline__, __nodebug__))\n_mm_setr_epi64(__m64 q0, __m64 q1)\n{\n  return (__m128i){ (long long)q0, (long long)q1 };\n}\n\nstatic __inline__ __m128i __attribute__((__always_inline__, __nodebug__))\n_mm_setr_epi32(int i0, int i1, int i2, int i3)\n{\n  return (__m128i)(__v4si){ i0, i1, i2, i3};\n}\n\nstatic __inline__ __m128i __attribute__((__always_inline__, __nodebug__))\n_mm_setr_epi16(short w0, short w1, short w2, short w3, short w4, short w5, short w6, short w7)\n{\n  return (__m128i)(__v8hi){ w0, w1, w2, w3, w4, w5, w6, w7 };\n}\n\nstatic __inline__ __m128i __attribute__((__always_inline__, __nodebug__))\n_mm_setr_epi8(char b0, char b1, char b2, char b3, char b4, char b5, char b6, char b7, char b8, char b9, char b10, char b11, char b12, char b13, char b14, char b15)\n{\n  return (__m128i)(__v16qi){ b0, b1, b2, b3, b4, b5, b6, b7, b8, b9, b10, b11, b12, b13, b14, b15 };\n}\n\nstatic __inline__ __m128i __attribute__((__always_inline__, __nodebug__))\n_mm_setzero_si128(void)\n{\n  return (__m128i){ 0LL, 0LL };\n}\n\nstatic __inline__ void __attribute__((__always_inline__, __nodebug__))\n_mm_store_si128(__m128i *p, __m128i b)\n{\n  *p = b;\n}\n\nstatic __inline__ void __attribute__((__always_inline__, __nodebug__))\n_mm_storeu_si128(__m128i *p, __m128i b)\n{\n  __builtin_ia32_storedqu((char *)p, (__v16qi)b);\n}\n\nstatic __inline__ void __attribute__((__always_inline__, __nodebug__))\n_mm_maskmoveu_si128(__m128i d, __m128i n, char *p)\n{\n  __builtin_ia32_maskmovdqu((__v16qi)d, (__v16qi)n, p);\n}\n\nstatic __inline__ void __attribute__((__always_inline__, __nodebug__))\n_mm_storel_epi64(__m128i *p, __m128i a)\n{\n  __builtin_ia32_storelv4si((__v2si *)p, a);\n}\n\nstatic __inline__ void __attribute__((__always_inline__, __nodebug__))\n_mm_stream_pd(double *p, __m128d a)\n{\n  __builtin_ia32_movntpd(p, a);\n}\n\nstatic __inline__ void __attribute__((__always_inline__, __nodebug__))\n_mm_stream_si128(__m128i *p, __m128i a)\n{\n  __builtin_ia32_movntdq(p, a);\n}\n\nstatic __inline__ void __attribute__((__always_inline__, __nodebug__))\n_mm_stream_si32(int *p, int a)\n{\n  __builtin_ia32_movnti(p, a);\n}\n\nstatic __inline__ void __attribute__((__always_inline__, __nodebug__))\n_mm_clflush(void const *p)\n{\n  __builtin_ia32_clflush(p);\n}\n\nstatic __inline__ void __attribute__((__always_inline__, __nodebug__))\n_mm_lfence(void)\n{\n  __builtin_ia32_lfence();\n}\n\nstatic __inline__ void __attribute__((__always_inline__, __nodebug__))\n_mm_mfence(void)\n{\n  __builtin_ia32_mfence();\n}\n\nstatic __inline__ __m128i __attribute__((__always_inline__, __nodebug__))\n_mm_packs_epi16(__m128i a, __m128i b)\n{\n  return (__m128i)__builtin_ia32_packsswb128((__v8hi)a, (__v8hi)b);\n}\n\nstatic __inline__ __m128i __attribute__((__always_inline__, __nodebug__))\n_mm_packs_epi32(__m128i a, __m128i b)\n{\n  return (__m128i)__builtin_ia32_packssdw128((__v4si)a, (__v4si)b);\n}\n\nstatic __inline__ __m128i __attribute__((__always_inline__, __nodebug__))\n_mm_packus_epi16(__m128i a, __m128i b)\n{\n  return (__m128i)__builtin_ia32_packuswb128((__v8hi)a, (__v8hi)b);\n}\n\nstatic __inline__ int __attribute__((__always_inline__, __nodebug__))\n_mm_extract_epi16(__m128i a, int imm)\n{\n  __v8hi b = (__v8hi)a;\n  return (unsigned short)b[imm];\n}\n\nstatic __inline__ __m128i __attribute__((__always_inline__, __nodebug__))\n_mm_insert_epi16(__m128i a, int b, int imm)\n{\n  __v8hi c = (__v8hi)a;\n  c[imm & 7] = b;\n  return (__m128i)c;\n}\n\nstatic __inline__ int __attribute__((__always_inline__, __nodebug__))\n_mm_movemask_epi8(__m128i a)\n{\n  return __builtin_ia32_pmovmskb128((__v16qi)a);\n}\n\n#define _mm_shuffle_epi32(a, imm) \\\n  ((__m128i)__builtin_shufflevector((__v4si)(a), (__v4si) _mm_set1_epi32(0), \\\n                                    (imm) & 0x3, ((imm) & 0xc) >> 2, \\\n                                    ((imm) & 0x30) >> 4, ((imm) & 0xc0) >> 6))\n\n\n#define _mm_shufflelo_epi16(a, imm) \\\n  ((__m128i)__builtin_shufflevector((__v8hi)(a), (__v8hi) _mm_set1_epi16(0), \\\n                                    (imm) & 0x3, ((imm) & 0xc) >> 2, \\\n                                    ((imm) & 0x30) >> 4, ((imm) & 0xc0) >> 6, \\\n                                    4, 5, 6, 7))\n#define _mm_shufflehi_epi16(a, imm) \\\n  ((__m128i)__builtin_shufflevector((__v8hi)(a), (__v8hi) _mm_set1_epi16(0), 0, 1, 2, 3, \\\n                                    4 + (((imm) & 0x03) >> 0), \\\n                                    4 + (((imm) & 0x0c) >> 2), \\\n                                    4 + (((imm) & 0x30) >> 4), \\\n                                    4 + (((imm) & 0xc0) >> 6)))\n\nstatic __inline__ __m128i __attribute__((__always_inline__, __nodebug__))\n_mm_unpackhi_epi8(__m128i a, __m128i b)\n{\n  return (__m128i)__builtin_shufflevector((__v16qi)a, (__v16qi)b, 8, 16+8, 9, 16+9, 10, 16+10, 11, 16+11, 12, 16+12, 13, 16+13, 14, 16+14, 15, 16+15);\n}\n\nstatic __inline__ __m128i __attribute__((__always_inline__, __nodebug__))\n_mm_unpackhi_epi16(__m128i a, __m128i b)\n{\n  return (__m128i)__builtin_shufflevector((__v8hi)a, (__v8hi)b, 4, 8+4, 5, 8+5, 6, 8+6, 7, 8+7);\n}\n\nstatic __inline__ __m128i __attribute__((__always_inline__, __nodebug__))\n_mm_unpackhi_epi32(__m128i a, __m128i b)\n{\n  return (__m128i)__builtin_shufflevector((__v4si)a, (__v4si)b, 2, 4+2, 3, 4+3);\n}\n\nstatic __inline__ __m128i __attribute__((__always_inline__, __nodebug__))\n_mm_unpackhi_epi64(__m128i a, __m128i b)\n{\n  return (__m128i)__builtin_shufflevector(a, b, 1, 2+1);\n}\n\nstatic __inline__ __m128i __attribute__((__always_inline__, __nodebug__))\n_mm_unpacklo_epi8(__m128i a, __m128i b)\n{\n  return (__m128i)__builtin_shufflevector((__v16qi)a, (__v16qi)b, 0, 16+0, 1, 16+1, 2, 16+2, 3, 16+3, 4, 16+4, 5, 16+5, 6, 16+6, 7, 16+7);\n}\n\nstatic __inline__ __m128i __attribute__((__always_inline__, __nodebug__))\n_mm_unpacklo_epi16(__m128i a, __m128i b)\n{\n  return (__m128i)__builtin_shufflevector((__v8hi)a, (__v8hi)b, 0, 8+0, 1, 8+1, 2, 8+2, 3, 8+3);\n}\n\nstatic __inline__ __m128i __attribute__((__always_inline__, __nodebug__))\n_mm_unpacklo_epi32(__m128i a, __m128i b)\n{\n  return (__m128i)__builtin_shufflevector((__v4si)a, (__v4si)b, 0, 4+0, 1, 4+1);\n}\n\nstatic __inline__ __m128i __attribute__((__always_inline__, __nodebug__))\n_mm_unpacklo_epi64(__m128i a, __m128i b)\n{\n  return (__m128i)__builtin_shufflevector(a, b, 0, 2+0);\n}\n\nstatic __inline__ __m64 __attribute__((__always_inline__, __nodebug__))\n_mm_movepi64_pi64(__m128i a)\n{\n  return (__m64)a[0];\n}\n\nstatic __inline__ __m128i __attribute__((__always_inline__, __nodebug__))\n_mm_movpi64_pi64(__m64 a)\n{\n  return (__m128i){ (long long)a, 0 };\n}\n\nstatic __inline__ __m128i __attribute__((__always_inline__, __nodebug__))\n_mm_move_epi64(__m128i a)\n{\n  return __builtin_shufflevector(a, (__m128i){ 0 }, 0, 2);\n}\n\nstatic __inline__ __m128d __attribute__((__always_inline__, __nodebug__))\n_mm_unpackhi_pd(__m128d a, __m128d b)\n{\n  return __builtin_shufflevector(a, b, 1, 2+1);\n}\n\nstatic __inline__ __m128d __attribute__((__always_inline__, __nodebug__))\n_mm_unpacklo_pd(__m128d a, __m128d b)\n{\n  return __builtin_shufflevector(a, b, 0, 2+0);\n}\n\nstatic __inline__ int __attribute__((__always_inline__, __nodebug__))\n_mm_movemask_pd(__m128d a)\n{\n  return __builtin_ia32_movmskpd(a);\n}\n\n#define _mm_shuffle_pd(a, b, i) \\\n  (__builtin_shufflevector((__m128d)(a), (__m128d)(b), (i) & 1, \\\n                                                       (((i) & 2) >> 1) + 2))\n\nstatic __inline__ __m128 __attribute__((__always_inline__, __nodebug__))\n_mm_castpd_ps(__m128d in)\n{\n  return (__m128)in;\n}\n\nstatic __inline__ __m128i __attribute__((__always_inline__, __nodebug__))\n_mm_castpd_si128(__m128d in)\n{\n  return (__m128i)in;\n}\n\nstatic __inline__ __m128d __attribute__((__always_inline__, __nodebug__))\n_mm_castps_pd(__m128 in)\n{\n  return (__m128d)in;\n}\n\nstatic __inline__ __m128i __attribute__((__always_inline__, __nodebug__))\n_mm_castps_si128(__m128 in)\n{\n  return (__m128i)in;\n}\n\nstatic __inline__ __m128 __attribute__((__always_inline__, __nodebug__))\n_mm_castsi128_ps(__m128i in)\n{\n  return (__m128)in;\n}\n\nstatic __inline__ __m128d __attribute__((__always_inline__, __nodebug__))\n_mm_castsi128_pd(__m128i in)\n{\n  return (__m128d)in;\n}\n\nstatic __inline__ void __attribute__((__always_inline__, __nodebug__))\n_mm_pause(void)\n{\n  __asm__ volatile (\"pause\");\n}\n\n#define _MM_SHUFFLE2(x, y) (((x) << 1) | (y))\n\n#endif /* __SSE2__ */\n\n#endif /* __EMMINTRIN_H */\n"
  },
  {
    "path": "freebsd-headers/clang/3.0/immintrin.h",
    "content": "/*===---- immintrin.h - Intel intrinsics -----------------------------------===\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n *\n *===-----------------------------------------------------------------------===\n */\n\n#ifndef __IMMINTRIN_H\n#define __IMMINTRIN_H\n\n#ifdef __MMX__\n#include <mmintrin.h>\n#endif\n\n#ifdef __SSE__\n#include <xmmintrin.h>\n#endif\n\n#ifdef __SSE2__\n#include <emmintrin.h>\n#endif\n\n#ifdef __SSE3__\n#include <pmmintrin.h>\n#endif\n\n#ifdef __SSSE3__\n#include <tmmintrin.h>\n#endif\n\n#if defined (__SSE4_2__) || defined (__SSE4_1__)\n#include <smmintrin.h>\n#endif\n\n#if defined (__AES__) || defined (__PCLMUL__)\n#include <wmmintrin.h>\n#endif\n\n#ifdef __AVX__\n#include <avxintrin.h>\n#endif\n\n#endif /* __IMMINTRIN_H */\n"
  },
  {
    "path": "freebsd-headers/clang/3.0/mm3dnow.h",
    "content": "/*===---- mm3dnow.h - 3DNow! intrinsics ------------------------------------===\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n *\n *===-----------------------------------------------------------------------===\n */\n\n#ifndef _MM3DNOW_H_INCLUDED\n#define _MM3DNOW_H_INCLUDED\n\n#include <mmintrin.h>\n\ntypedef float __v2sf __attribute__((__vector_size__(8)));\n\nstatic __inline__ void __attribute__((__always_inline__, __nodebug__))\n_m_femms() {\n  __builtin_ia32_femms();\n}\n\nstatic __inline__ __m64 __attribute__((__always_inline__, __nodebug__))\n_m_pavgusb(__m64 __m1, __m64 __m2) {\n  return (__m64)__builtin_ia32_pavgusb((__v8qi)__m1, (__v8qi)__m2);\n}\n\nstatic __inline__ __m64 __attribute__((__always_inline__, __nodebug__))\n_m_pf2id(__m64 __m) {\n  return (__m64)__builtin_ia32_pf2id((__v2sf)__m);\n}\n\nstatic __inline__ __m64 __attribute__((__always_inline__, __nodebug__))\n_m_pfacc(__m64 __m1, __m64 __m2) {\n  return (__m64)__builtin_ia32_pfacc((__v2sf)__m1, (__v2sf)__m2);\n}\n\nstatic __inline__ __m64 __attribute__((__always_inline__, __nodebug__))\n_m_pfadd(__m64 __m1, __m64 __m2) {\n  return (__m64)__builtin_ia32_pfadd((__v2sf)__m1, (__v2sf)__m2);\n}\n\nstatic __inline__ __m64 __attribute__((__always_inline__, __nodebug__))\n_m_pfcmpeq(__m64 __m1, __m64 __m2) {\n  return (__m64)__builtin_ia32_pfcmpeq((__v2sf)__m1, (__v2sf)__m2);\n}\n\nstatic __inline__ __m64 __attribute__((__always_inline__, __nodebug__))\n_m_pfcmpge(__m64 __m1, __m64 __m2) {\n  return (__m64)__builtin_ia32_pfcmpge((__v2sf)__m1, (__v2sf)__m2);\n}\n\nstatic __inline__ __m64 __attribute__((__always_inline__, __nodebug__))\n_m_pfcmpgt(__m64 __m1, __m64 __m2) {\n  return (__m64)__builtin_ia32_pfcmpgt((__v2sf)__m1, (__v2sf)__m2);\n}\n\nstatic __inline__ __m64 __attribute__((__always_inline__, __nodebug__))\n_m_pfmax(__m64 __m1, __m64 __m2) {\n  return (__m64)__builtin_ia32_pfmax((__v2sf)__m1, (__v2sf)__m2);\n}\n\nstatic __inline__ __m64 __attribute__((__always_inline__, __nodebug__))\n_m_pfmin(__m64 __m1, __m64 __m2) {\n  return (__m64)__builtin_ia32_pfmin((__v2sf)__m1, (__v2sf)__m2);\n}\n\nstatic __inline__ __m64 __attribute__((__always_inline__, __nodebug__))\n_m_pfmul(__m64 __m1, __m64 __m2) {\n  return (__m64)__builtin_ia32_pfmul((__v2sf)__m1, (__v2sf)__m2);\n}\n\nstatic __inline__ __m64 __attribute__((__always_inline__, __nodebug__))\n_m_pfrcp(__m64 __m) {\n  return (__m64)__builtin_ia32_pfrcp((__v2sf)__m);\n}\n\nstatic __inline__ __m64 __attribute__((__always_inline__, __nodebug__))\n_m_pfrcpit1(__m64 __m1, __m64 __m2) {\n  return (__m64)__builtin_ia32_pfrcpit1((__v2sf)__m1, (__v2sf)__m2);\n}\n\nstatic __inline__ __m64 __attribute__((__always_inline__, __nodebug__))\n_m_pfrcpit2(__m64 __m1, __m64 __m2) {\n  return (__m64)__builtin_ia32_pfrcpit2((__v2sf)__m1, (__v2sf)__m2);\n}\n\nstatic __inline__ __m64 __attribute__((__always_inline__, __nodebug__))\n_m_pfrsqrt(__m64 __m) {\n  return (__m64)__builtin_ia32_pfrsqrt((__v2sf)__m);\n}\n\nstatic __inline__ __m64 __attribute__((__always_inline__, __nodebug__))\n_m_pfrsqrtit1(__m64 __m1, __m64 __m2) {\n  return (__m64)__builtin_ia32_pfrsqrtit1((__v2sf)__m1, (__v2sf)__m2);\n}\n\nstatic __inline__ __m64 __attribute__((__always_inline__, __nodebug__))\n_m_pfsub(__m64 __m1, __m64 __m2) {\n  return (__m64)__builtin_ia32_pfsub((__v2sf)__m1, (__v2sf)__m2);\n}\n\nstatic __inline__ __m64 __attribute__((__always_inline__, __nodebug__))\n_m_pfsubr(__m64 __m1, __m64 __m2) {\n  return (__m64)__builtin_ia32_pfsubr((__v2sf)__m1, (__v2sf)__m2);\n}\n\nstatic __inline__ __m64 __attribute__((__always_inline__, __nodebug__))\n_m_pi2fd(__m64 __m) {\n  return (__m64)__builtin_ia32_pi2fd((__v2si)__m);\n}\n\nstatic __inline__ __m64 __attribute__((__always_inline__, __nodebug__))\n_m_pmulhrw(__m64 __m1, __m64 __m2) {\n  return (__m64)__builtin_ia32_pmulhrw((__v4hi)__m1, (__v4hi)__m2);\n}\n\nstatic __inline__ __m64 __attribute__((__always_inline__, __nodebug__))\n_m_pf2iw(__m64 __m) {\n  return (__m64)__builtin_ia32_pf2iw((__v2sf)__m);\n}\n\nstatic __inline__ __m64 __attribute__((__always_inline__, __nodebug__))\n_m_pfnacc(__m64 __m1, __m64 __m2) {\n  return (__m64)__builtin_ia32_pfnacc((__v2sf)__m1, (__v2sf)__m2);\n}\n\nstatic __inline__ __m64 __attribute__((__always_inline__, __nodebug__))\n_m_pfpnacc(__m64 __m1, __m64 __m2) {\n  return (__m64)__builtin_ia32_pfpnacc((__v2sf)__m1, (__v2sf)__m2);\n}\n\nstatic __inline__ __m64 __attribute__((__always_inline__, __nodebug__))\n_m_pi2fw(__m64 __m) {\n  return (__m64)__builtin_ia32_pi2fw((__v2si)__m);\n}\n\nstatic __inline__ __m64 __attribute__((__always_inline__, __nodebug__))\n_m_pswapdsf(__m64 __m) {\n  return (__m64)__builtin_ia32_pswapdsf((__v2sf)__m);\n}\n\nstatic __inline__ __m64 __attribute__((__always_inline__, __nodebug__))\n_m_pswapdsi(__m64 __m) {\n  return (__m64)__builtin_ia32_pswapdsi((__v2si)__m);\n}\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/clang/3.0/mm_malloc.h",
    "content": "/*===---- mm_malloc.h - Allocating and Freeing Aligned Memory Blocks -------===\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n *\n *===-----------------------------------------------------------------------===\n */\n\n#ifndef __MM_MALLOC_H\n#define __MM_MALLOC_H\n\n#include <stdlib.h>\n\n#ifdef _WIN32\n#include <malloc.h>\n#else\n#ifndef __cplusplus\nextern int posix_memalign(void **memptr, size_t alignment, size_t size);\n#else\n// Some systems (e.g. those with GNU libc) declare posix_memalign with an\n// exception specifier. Via an \"egregious workaround\" in\n// Sema::CheckEquivalentExceptionSpec, Clang accepts the following as a valid\n// redeclaration of glibc's declaration.\nextern \"C\" int posix_memalign(void **memptr, size_t alignment, size_t size);\n#endif\n#endif\n\n#if !(defined(_WIN32) && defined(_mm_malloc))\nstatic __inline__ void *__attribute__((__always_inline__, __nodebug__,\n                                       __malloc__))\n_mm_malloc(size_t size, size_t align)\n{\n  if (align == 1) {\n    return malloc(size);\n  }\n\n  if (!(align & (align - 1)) && align < sizeof(void *))\n    align = sizeof(void *);\n\n  void *mallocedMemory;\n#if defined(__MINGW32__)\n  mallocedMemory = __mingw_aligned_malloc(size, align);\n#elif defined(_WIN32)\n  mallocedMemory = _aligned_malloc(size, align);\n#else\n  if (posix_memalign(&mallocedMemory, align, size))\n    return 0;\n#endif\n\n  return mallocedMemory;\n}\n\nstatic __inline__ void __attribute__((__always_inline__, __nodebug__))\n_mm_free(void *p)\n{\n  free(p);\n}\n#endif\n\n#endif /* __MM_MALLOC_H */\n"
  },
  {
    "path": "freebsd-headers/clang/3.0/mmintrin.h",
    "content": "/*===---- mmintrin.h - MMX intrinsics --------------------------------------===\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n *\n *===-----------------------------------------------------------------------===\n */\n\n#ifndef __MMINTRIN_H\n#define __MMINTRIN_H\n\n#ifndef __MMX__\n#error \"MMX instruction set not enabled\"\n#else\n\ntypedef long long __m64 __attribute__((__vector_size__(8)));\n\ntypedef int __v2si __attribute__((__vector_size__(8)));\ntypedef short __v4hi __attribute__((__vector_size__(8)));\ntypedef char __v8qi __attribute__((__vector_size__(8)));\n\nstatic __inline__ void __attribute__((__always_inline__, __nodebug__))\n_mm_empty(void)\n{\n    __builtin_ia32_emms();\n}\n\nstatic __inline__ __m64 __attribute__((__always_inline__, __nodebug__))\n_mm_cvtsi32_si64(int __i)\n{\n    return (__m64)__builtin_ia32_vec_init_v2si(__i, 0);\n}\n\nstatic __inline__ int __attribute__((__always_inline__, __nodebug__))\n_mm_cvtsi64_si32(__m64 __m)\n{\n    return __builtin_ia32_vec_ext_v2si((__v2si)__m, 0);\n}\n\nstatic __inline__ __m64 __attribute__((__always_inline__, __nodebug__))\n_mm_cvtsi64_m64(long long __i)\n{\n    return (__m64)__i;\n}\n\nstatic __inline__ long long __attribute__((__always_inline__, __nodebug__))\n_mm_cvtm64_si64(__m64 __m)\n{\n    return (long long)__m;\n}\n\nstatic __inline__ __m64 __attribute__((__always_inline__, __nodebug__))\n_mm_packs_pi16(__m64 __m1, __m64 __m2)\n{\n    return (__m64)__builtin_ia32_packsswb((__v4hi)__m1, (__v4hi)__m2);\n}\n\nstatic __inline__ __m64 __attribute__((__always_inline__, __nodebug__))\n_mm_packs_pi32(__m64 __m1, __m64 __m2)\n{\n    return (__m64)__builtin_ia32_packssdw((__v2si)__m1, (__v2si)__m2);\n}\n\nstatic __inline__ __m64 __attribute__((__always_inline__, __nodebug__))\n_mm_packs_pu16(__m64 __m1, __m64 __m2)\n{\n    return (__m64)__builtin_ia32_packuswb((__v4hi)__m1, (__v4hi)__m2);\n}\n\nstatic __inline__ __m64 __attribute__((__always_inline__, __nodebug__))\n_mm_unpackhi_pi8(__m64 __m1, __m64 __m2)\n{\n    return (__m64)__builtin_ia32_punpckhbw((__v8qi)__m1, (__v8qi)__m2);\n}\n\nstatic __inline__ __m64 __attribute__((__always_inline__, __nodebug__))\n_mm_unpackhi_pi16(__m64 __m1, __m64 __m2)\n{\n    return (__m64)__builtin_ia32_punpckhwd((__v4hi)__m1, (__v4hi)__m2);\n}\n\nstatic __inline__ __m64 __attribute__((__always_inline__, __nodebug__))\n_mm_unpackhi_pi32(__m64 __m1, __m64 __m2)\n{\n    return (__m64)__builtin_ia32_punpckhdq((__v2si)__m1, (__v2si)__m2);\n}\n\nstatic __inline__ __m64 __attribute__((__always_inline__, __nodebug__))\n_mm_unpacklo_pi8(__m64 __m1, __m64 __m2)\n{\n    return (__m64)__builtin_ia32_punpcklbw((__v8qi)__m1, (__v8qi)__m2);\n}\n\nstatic __inline__ __m64 __attribute__((__always_inline__, __nodebug__))\n_mm_unpacklo_pi16(__m64 __m1, __m64 __m2)\n{\n    return (__m64)__builtin_ia32_punpcklwd((__v4hi)__m1, (__v4hi)__m2);\n}\n\nstatic __inline__ __m64 __attribute__((__always_inline__, __nodebug__))\n_mm_unpacklo_pi32(__m64 __m1, __m64 __m2)\n{\n    return (__m64)__builtin_ia32_punpckldq((__v2si)__m1, (__v2si)__m2);\n}\n\nstatic __inline__ __m64 __attribute__((__always_inline__, __nodebug__))\n_mm_add_pi8(__m64 __m1, __m64 __m2)\n{\n    return (__m64)__builtin_ia32_paddb((__v8qi)__m1, (__v8qi)__m2);\n}\n\nstatic __inline__ __m64 __attribute__((__always_inline__, __nodebug__))\n_mm_add_pi16(__m64 __m1, __m64 __m2)\n{\n    return (__m64)__builtin_ia32_paddw((__v4hi)__m1, (__v4hi)__m2);\n}\n\nstatic __inline__ __m64 __attribute__((__always_inline__, __nodebug__))\n_mm_add_pi32(__m64 __m1, __m64 __m2)\n{\n    return (__m64)__builtin_ia32_paddd((__v2si)__m1, (__v2si)__m2);\n}\n\nstatic __inline__ __m64 __attribute__((__always_inline__, __nodebug__))\n_mm_adds_pi8(__m64 __m1, __m64 __m2) \n{\n    return (__m64)__builtin_ia32_paddsb((__v8qi)__m1, (__v8qi)__m2);\n}\n\nstatic __inline__ __m64 __attribute__((__always_inline__, __nodebug__))\n_mm_adds_pi16(__m64 __m1, __m64 __m2)\n{\n    return (__m64)__builtin_ia32_paddsw((__v4hi)__m1, (__v4hi)__m2);    \n}\n\nstatic __inline__ __m64 __attribute__((__always_inline__, __nodebug__))\n_mm_adds_pu8(__m64 __m1, __m64 __m2) \n{\n    return (__m64)__builtin_ia32_paddusb((__v8qi)__m1, (__v8qi)__m2);\n}\n \nstatic __inline__ __m64 __attribute__((__always_inline__, __nodebug__))\n_mm_adds_pu16(__m64 __m1, __m64 __m2) \n{\n    return (__m64)__builtin_ia32_paddusw((__v4hi)__m1, (__v4hi)__m2);\n}\n\nstatic __inline__ __m64 __attribute__((__always_inline__, __nodebug__))\n_mm_sub_pi8(__m64 __m1, __m64 __m2)\n{\n    return (__m64)__builtin_ia32_psubb((__v8qi)__m1, (__v8qi)__m2);\n}\n \nstatic __inline__ __m64 __attribute__((__always_inline__, __nodebug__))\n_mm_sub_pi16(__m64 __m1, __m64 __m2)\n{\n    return (__m64)__builtin_ia32_psubw((__v4hi)__m1, (__v4hi)__m2);\n}\n \nstatic __inline__ __m64 __attribute__((__always_inline__, __nodebug__))\n_mm_sub_pi32(__m64 __m1, __m64 __m2)\n{\n    return (__m64)__builtin_ia32_psubd((__v2si)__m1, (__v2si)__m2);\n}\n\nstatic __inline__ __m64 __attribute__((__always_inline__, __nodebug__))\n_mm_subs_pi8(__m64 __m1, __m64 __m2)\n{\n    return (__m64)__builtin_ia32_psubsb((__v8qi)__m1, (__v8qi)__m2);\n}\n\nstatic __inline__ __m64 __attribute__((__always_inline__, __nodebug__))\n_mm_subs_pi16(__m64 __m1, __m64 __m2)\n{\n    return (__m64)__builtin_ia32_psubsw((__v4hi)__m1, (__v4hi)__m2);\n}\n\nstatic __inline__ __m64 __attribute__((__always_inline__, __nodebug__))\n_mm_subs_pu8(__m64 __m1, __m64 __m2)\n{\n    return (__m64)__builtin_ia32_psubusb((__v8qi)__m1, (__v8qi)__m2);\n}\n \nstatic __inline__ __m64 __attribute__((__always_inline__, __nodebug__))\n_mm_subs_pu16(__m64 __m1, __m64 __m2)\n{\n    return (__m64)__builtin_ia32_psubusw((__v4hi)__m1, (__v4hi)__m2);\n}\n\nstatic __inline__ __m64 __attribute__((__always_inline__, __nodebug__))\n_mm_madd_pi16(__m64 __m1, __m64 __m2)\n{\n    return (__m64)__builtin_ia32_pmaddwd((__v4hi)__m1, (__v4hi)__m2);\n}\n\nstatic __inline__ __m64 __attribute__((__always_inline__, __nodebug__))\n_mm_mulhi_pi16(__m64 __m1, __m64 __m2)\n{\n    return (__m64)__builtin_ia32_pmulhw((__v4hi)__m1, (__v4hi)__m2);\n}\n \nstatic __inline__ __m64 __attribute__((__always_inline__, __nodebug__))\n_mm_mullo_pi16(__m64 __m1, __m64 __m2) \n{\n    return (__m64)__builtin_ia32_pmullw((__v4hi)__m1, (__v4hi)__m2);\n}\n\nstatic __inline__ __m64 __attribute__((__always_inline__, __nodebug__))\n_mm_sll_pi16(__m64 __m, __m64 __count)\n{\n    return (__m64)__builtin_ia32_psllw((__v4hi)__m, __count);\n}\n\nstatic __inline__ __m64 __attribute__((__always_inline__, __nodebug__))\n_mm_slli_pi16(__m64 __m, int __count)\n{\n    return (__m64)__builtin_ia32_psllwi((__v4hi)__m, __count);    \n}\n\nstatic __inline__ __m64 __attribute__((__always_inline__, __nodebug__))\n_mm_sll_pi32(__m64 __m, __m64 __count)\n{\n    return (__m64)__builtin_ia32_pslld((__v2si)__m, __count);\n}\n\nstatic __inline__ __m64 __attribute__((__always_inline__, __nodebug__))\n_mm_slli_pi32(__m64 __m, int __count)\n{\n    return (__m64)__builtin_ia32_pslldi((__v2si)__m, __count);\n}\n\nstatic __inline__ __m64 __attribute__((__always_inline__, __nodebug__))\n_mm_sll_si64(__m64 __m, __m64 __count)\n{\n    return (__m64)__builtin_ia32_psllq(__m, __count);\n}\n\nstatic __inline__ __m64 __attribute__((__always_inline__, __nodebug__))\n_mm_slli_si64(__m64 __m, int __count)\n{\n    return (__m64)__builtin_ia32_psllqi(__m, __count);    \n}\n\nstatic __inline__ __m64 __attribute__((__always_inline__, __nodebug__))\n_mm_sra_pi16(__m64 __m, __m64 __count)\n{\n    return (__m64)__builtin_ia32_psraw((__v4hi)__m, __count);    \n}\n\nstatic __inline__ __m64 __attribute__((__always_inline__, __nodebug__))\n_mm_srai_pi16(__m64 __m, int __count)\n{\n    return (__m64)__builtin_ia32_psrawi((__v4hi)__m, __count);\n}\n\nstatic __inline__ __m64 __attribute__((__always_inline__, __nodebug__))\n_mm_sra_pi32(__m64 __m, __m64 __count)\n{\n    return (__m64)__builtin_ia32_psrad((__v2si)__m, __count);    \n}\n\nstatic __inline__ __m64 __attribute__((__always_inline__, __nodebug__))\n_mm_srai_pi32(__m64 __m, int __count)\n{\n    return (__m64)__builtin_ia32_psradi((__v2si)__m, __count);\n}\n\nstatic __inline__ __m64 __attribute__((__always_inline__, __nodebug__))\n_mm_srl_pi16(__m64 __m, __m64 __count)\n{\n    return (__m64)__builtin_ia32_psrlw((__v4hi)__m, __count);    \n}\n\nstatic __inline__ __m64 __attribute__((__always_inline__, __nodebug__))\n_mm_srli_pi16(__m64 __m, int __count)\n{\n    return (__m64)__builtin_ia32_psrlwi((__v4hi)__m, __count);    \n}\n\nstatic __inline__ __m64 __attribute__((__always_inline__, __nodebug__))\n_mm_srl_pi32(__m64 __m, __m64 __count)\n{\n    return (__m64)__builtin_ia32_psrld((__v2si)__m, __count);       \n}\n\nstatic __inline__ __m64 __attribute__((__always_inline__, __nodebug__))\n_mm_srli_pi32(__m64 __m, int __count)\n{\n    return (__m64)__builtin_ia32_psrldi((__v2si)__m, __count);\n}\n\nstatic __inline__ __m64 __attribute__((__always_inline__, __nodebug__))\n_mm_srl_si64(__m64 __m, __m64 __count)\n{\n    return (__m64)__builtin_ia32_psrlq(__m, __count);    \n}\n\nstatic __inline__ __m64 __attribute__((__always_inline__, __nodebug__))\n_mm_srli_si64(__m64 __m, int __count)\n{\n    return (__m64)__builtin_ia32_psrlqi(__m, __count);    \n}\n\nstatic __inline__ __m64 __attribute__((__always_inline__, __nodebug__))\n_mm_and_si64(__m64 __m1, __m64 __m2)\n{\n    return __builtin_ia32_pand(__m1, __m2);\n}\n\nstatic __inline__ __m64 __attribute__((__always_inline__, __nodebug__))\n_mm_andnot_si64(__m64 __m1, __m64 __m2)\n{\n    return __builtin_ia32_pandn(__m1, __m2);\n}\n\nstatic __inline__ __m64 __attribute__((__always_inline__, __nodebug__))\n_mm_or_si64(__m64 __m1, __m64 __m2)\n{\n    return __builtin_ia32_por(__m1, __m2);\n}\n\nstatic __inline__ __m64 __attribute__((__always_inline__, __nodebug__))\n_mm_xor_si64(__m64 __m1, __m64 __m2)\n{\n    return __builtin_ia32_pxor(__m1, __m2);\n}\n\nstatic __inline__ __m64 __attribute__((__always_inline__, __nodebug__))\n_mm_cmpeq_pi8(__m64 __m1, __m64 __m2)\n{\n    return (__m64)__builtin_ia32_pcmpeqb((__v8qi)__m1, (__v8qi)__m2);\n}\n\nstatic __inline__ __m64 __attribute__((__always_inline__, __nodebug__))\n_mm_cmpeq_pi16(__m64 __m1, __m64 __m2)\n{\n    return (__m64)__builtin_ia32_pcmpeqw((__v4hi)__m1, (__v4hi)__m2);\n}\n\nstatic __inline__ __m64 __attribute__((__always_inline__, __nodebug__))\n_mm_cmpeq_pi32(__m64 __m1, __m64 __m2)\n{\n    return (__m64)__builtin_ia32_pcmpeqd((__v2si)__m1, (__v2si)__m2);\n}\n\nstatic __inline__ __m64 __attribute__((__always_inline__, __nodebug__))\n_mm_cmpgt_pi8(__m64 __m1, __m64 __m2)\n{\n    return (__m64)__builtin_ia32_pcmpgtb((__v8qi)__m1, (__v8qi)__m2);\n}\n\nstatic __inline__ __m64 __attribute__((__always_inline__, __nodebug__))\n_mm_cmpgt_pi16(__m64 __m1, __m64 __m2)\n{\n    return (__m64)__builtin_ia32_pcmpgtw((__v4hi)__m1, (__v4hi)__m2);\n}\n\nstatic __inline__ __m64 __attribute__((__always_inline__, __nodebug__))\n_mm_cmpgt_pi32(__m64 __m1, __m64 __m2)\n{\n    return (__m64)__builtin_ia32_pcmpgtd((__v2si)__m1, (__v2si)__m2);\n}\n\nstatic __inline__ __m64 __attribute__((__always_inline__, __nodebug__))\n_mm_setzero_si64(void)\n{\n    return (__m64){ 0LL };\n}\n\nstatic __inline__ __m64 __attribute__((__always_inline__, __nodebug__))\n_mm_set_pi32(int __i1, int __i0)\n{\n    return (__m64)__builtin_ia32_vec_init_v2si(__i0, __i1);\n}\n\nstatic __inline__ __m64 __attribute__((__always_inline__, __nodebug__))\n_mm_set_pi16(short __s3, short __s2, short __s1, short __s0)\n{\n    return (__m64)__builtin_ia32_vec_init_v4hi(__s0, __s1, __s2, __s3);\n}\n\nstatic __inline__ __m64 __attribute__((__always_inline__, __nodebug__))\n_mm_set_pi8(char __b7, char __b6, char __b5, char __b4, char __b3, char __b2,\n            char __b1, char __b0)\n{\n    return (__m64)__builtin_ia32_vec_init_v8qi(__b0, __b1, __b2, __b3,\n                                               __b4, __b5, __b6, __b7);\n}\n\nstatic __inline__ __m64 __attribute__((__always_inline__, __nodebug__))\n_mm_set1_pi32(int __i)\n{\n    return _mm_set_pi32(__i, __i);\n}\n\nstatic __inline__ __m64 __attribute__((__always_inline__, __nodebug__))\n_mm_set1_pi16(short __w)\n{\n    return _mm_set_pi16(__w, __w, __w, __w);\n}\n\nstatic __inline__ __m64 __attribute__((__always_inline__, __nodebug__))\n_mm_set1_pi8(char __b)\n{\n    return _mm_set_pi8(__b, __b, __b, __b, __b, __b, __b, __b);\n}\n\nstatic __inline__ __m64 __attribute__((__always_inline__, __nodebug__))\n_mm_setr_pi32(int __i0, int __i1)\n{\n    return _mm_set_pi32(__i1, __i0);\n}\n\nstatic __inline__ __m64 __attribute__((__always_inline__, __nodebug__))\n_mm_setr_pi16(short __w0, short __w1, short __w2, short __w3)\n{\n    return _mm_set_pi16(__w3, __w2, __w1, __w0);\n}\n\nstatic __inline__ __m64 __attribute__((__always_inline__, __nodebug__))\n_mm_setr_pi8(char __b0, char __b1, char __b2, char __b3, char __b4, char __b5,\n             char __b6, char __b7)\n{\n    return _mm_set_pi8(__b7, __b6, __b5, __b4, __b3, __b2, __b1, __b0);\n}\n\n\n/* Aliases for compatibility. */\n#define _m_empty _mm_empty\n#define _m_from_int _mm_cvtsi32_si64\n#define _m_to_int _mm_cvtsi64_si32\n#define _m_packsswb _mm_packs_pi16\n#define _m_packssdw _mm_packs_pi32\n#define _m_packuswb _mm_packs_pu16\n#define _m_punpckhbw _mm_unpackhi_pi8\n#define _m_punpckhwd _mm_unpackhi_pi16\n#define _m_punpckhdq _mm_unpackhi_pi32\n#define _m_punpcklbw _mm_unpacklo_pi8\n#define _m_punpcklwd _mm_unpacklo_pi16\n#define _m_punpckldq _mm_unpacklo_pi32\n#define _m_paddb _mm_add_pi8\n#define _m_paddw _mm_add_pi16\n#define _m_paddd _mm_add_pi32\n#define _m_paddsb _mm_adds_pi8\n#define _m_paddsw _mm_adds_pi16\n#define _m_paddusb _mm_adds_pu8\n#define _m_paddusw _mm_adds_pu16\n#define _m_psubb _mm_sub_pi8\n#define _m_psubw _mm_sub_pi16\n#define _m_psubd _mm_sub_pi32\n#define _m_psubsb _mm_subs_pi8\n#define _m_psubsw _mm_subs_pi16\n#define _m_psubusb _mm_subs_pu8\n#define _m_psubusw _mm_subs_pu16\n#define _m_pmaddwd _mm_madd_pi16\n#define _m_pmulhw _mm_mulhi_pi16\n#define _m_pmullw _mm_mullo_pi16\n#define _m_psllw _mm_sll_pi16\n#define _m_psllwi _mm_slli_pi16\n#define _m_pslld _mm_sll_pi32\n#define _m_pslldi _mm_slli_pi32\n#define _m_psllq _mm_sll_si64\n#define _m_psllqi _mm_slli_si64\n#define _m_psraw _mm_sra_pi16\n#define _m_psrawi _mm_srai_pi16\n#define _m_psrad _mm_sra_pi32\n#define _m_psradi _mm_srai_pi32\n#define _m_psrlw _mm_srl_pi16\n#define _m_psrlwi _mm_srli_pi16\n#define _m_psrld _mm_srl_pi32\n#define _m_psrldi _mm_srli_pi32\n#define _m_psrlq _mm_srl_si64\n#define _m_psrlqi _mm_srli_si64\n#define _m_pand _mm_and_si64\n#define _m_pandn _mm_andnot_si64\n#define _m_por _mm_or_si64\n#define _m_pxor _mm_xor_si64\n#define _m_pcmpeqb _mm_cmpeq_pi8\n#define _m_pcmpeqw _mm_cmpeq_pi16\n#define _m_pcmpeqd _mm_cmpeq_pi32\n#define _m_pcmpgtb _mm_cmpgt_pi8\n#define _m_pcmpgtw _mm_cmpgt_pi16\n#define _m_pcmpgtd _mm_cmpgt_pi32\n\n#endif /* __MMX__ */\n\n#endif /* __MMINTRIN_H */\n\n"
  },
  {
    "path": "freebsd-headers/clang/3.0/nmmintrin.h",
    "content": "/*===---- nmmintrin.h - SSE4 intrinsics ------------------------------------===\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n *\n *===-----------------------------------------------------------------------===\n */\n\n#ifndef _NMMINTRIN_H\n#define _NMMINTRIN_H\n\n#ifndef __SSE4_2__\n#error \"SSE4.2 instruction set not enabled\"\n#else\n\n/* To match expectations of gcc we put the sse4.2 definitions into smmintrin.h,\n   just include it now then.  */\n#include <smmintrin.h>\n#endif /* __SSE4_2__ */\n#endif /* _NMMINTRIN_H */\n"
  },
  {
    "path": "freebsd-headers/clang/3.0/pmmintrin.h",
    "content": "/*===---- pmmintrin.h - SSE3 intrinsics ------------------------------------===\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n *\n *===-----------------------------------------------------------------------===\n */\n \n#ifndef __PMMINTRIN_H\n#define __PMMINTRIN_H\n\n#ifndef __SSE3__\n#error \"SSE3 instruction set not enabled\"\n#else\n\n#include <emmintrin.h>\n\nstatic __inline__ __m128i __attribute__((__always_inline__, __nodebug__))\n_mm_lddqu_si128(__m128i const *p)\n{\n  return (__m128i)__builtin_ia32_lddqu((char const *)p);\n}\n\nstatic __inline__ __m128 __attribute__((__always_inline__, __nodebug__))\n_mm_addsub_ps(__m128 a, __m128 b)\n{\n  return __builtin_ia32_addsubps(a, b);\n}\n\nstatic __inline__ __m128 __attribute__((__always_inline__, __nodebug__))\n_mm_hadd_ps(__m128 a, __m128 b)\n{\n  return __builtin_ia32_haddps(a, b);\n}\n\nstatic __inline__ __m128 __attribute__((__always_inline__, __nodebug__))\n_mm_hsub_ps(__m128 a, __m128 b)\n{\n  return __builtin_ia32_hsubps(a, b);\n}\n\nstatic __inline__ __m128 __attribute__((__always_inline__, __nodebug__))\n_mm_movehdup_ps(__m128 a)\n{\n  return __builtin_shufflevector(a, a, 1, 1, 3, 3);\n}\n\nstatic __inline__ __m128 __attribute__((__always_inline__, __nodebug__))\n_mm_moveldup_ps(__m128 a)\n{\n  return __builtin_shufflevector(a, a, 0, 0, 2, 2);\n}\n\nstatic __inline__ __m128d __attribute__((__always_inline__, __nodebug__))\n_mm_addsub_pd(__m128d a, __m128d b)\n{\n  return __builtin_ia32_addsubpd(a, b);\n}\n\nstatic __inline__ __m128d __attribute__((__always_inline__, __nodebug__))\n_mm_hadd_pd(__m128d a, __m128d b)\n{\n  return __builtin_ia32_haddpd(a, b);\n}\n\nstatic __inline__ __m128d __attribute__((__always_inline__, __nodebug__))\n_mm_hsub_pd(__m128d a, __m128d b)\n{\n  return __builtin_ia32_hsubpd(a, b);\n}\n\n#define        _mm_loaddup_pd(dp)        _mm_load1_pd(dp)\n\nstatic __inline__ __m128d __attribute__((__always_inline__, __nodebug__))\n_mm_movedup_pd(__m128d a)\n{\n  return __builtin_shufflevector(a, a, 0, 0);\n}\n\n#define _MM_DENORMALS_ZERO_ON   (0x0040)\n#define _MM_DENORMALS_ZERO_OFF  (0x0000)\n\n#define _MM_DENORMALS_ZERO_MASK (0x0040)\n\n#define _MM_GET_DENORMALS_ZERO_MODE() (_mm_getcsr() & _MM_DENORMALS_ZERO_MASK)\n#define _MM_SET_DENORMALS_ZERO_MODE(x) (_mm_setcsr((_mm_getcsr() & ~_MM_DENORMALS_ZERO_MASK) | (x)))\n\nstatic __inline__ void __attribute__((__always_inline__, __nodebug__))\n_mm_monitor(void const *p, unsigned extensions, unsigned hints)\n{\n  __builtin_ia32_monitor((void *)p, extensions, hints);\n}\n\nstatic __inline__ void __attribute__((__always_inline__, __nodebug__))\n_mm_mwait(unsigned extensions, unsigned hints)\n{\n  __builtin_ia32_mwait(extensions, hints);\n}\n\n#endif /* __SSE3__ */\n\n#endif /* __PMMINTRIN_H */\n"
  },
  {
    "path": "freebsd-headers/clang/3.0/smmintrin.h",
    "content": "/*===---- smmintrin.h - SSE4 intrinsics ------------------------------------===\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n *\n *===-----------------------------------------------------------------------===\n */\n\n#ifndef _SMMINTRIN_H\n#define _SMMINTRIN_H\n\n#ifndef __SSE4_1__\n#error \"SSE4.1 instruction set not enabled\"\n#else\n\n#include <tmmintrin.h>\n\n/* SSE4 Rounding macros. */\n#define _MM_FROUND_TO_NEAREST_INT    0x00\n#define _MM_FROUND_TO_NEG_INF        0x01\n#define _MM_FROUND_TO_POS_INF        0x02\n#define _MM_FROUND_TO_ZERO           0x03\n#define _MM_FROUND_CUR_DIRECTION     0x04\n\n#define _MM_FROUND_RAISE_EXC         0x00\n#define _MM_FROUND_NO_EXC            0x08\n\n#define _MM_FROUND_NINT      (_MM_FROUND_RAISE_EXC | _MM_FROUND_TO_NEAREST_INT)\n#define _MM_FROUND_FLOOR     (_MM_FROUND_RAISE_EXC | _MM_FROUND_TO_NEG_INF)\n#define _MM_FROUND_CEIL      (_MM_FROUND_RAISE_EXC | _MM_FROUND_TO_POS_INF)\n#define _MM_FROUND_TRUNC     (_MM_FROUND_RAISE_EXC | _MM_FROUND_TO_ZERO)\n#define _MM_FROUND_RINT      (_MM_FROUND_RAISE_EXC | _MM_FROUND_CUR_DIRECTION)\n#define _MM_FROUND_NEARBYINT (_MM_FROUND_NO_EXC | _MM_FROUND_CUR_DIRECTION)\n\n#define _mm_ceil_ps(X)       _mm_round_ps((X), _MM_FROUND_CEIL)\n#define _mm_ceil_pd(X)       _mm_round_pd((X), _MM_FROUND_CEIL)\n#define _mm_ceil_ss(X, Y)    _mm_round_ss((X), (Y), _MM_FROUND_CEIL)\n#define _mm_ceil_sd(X, Y)    _mm_round_sd((X), (Y), _MM_FROUND_CEIL)\n\n#define _mm_floor_ps(X)      _mm_round_ps((X), _MM_FROUND_FLOOR)\n#define _mm_floor_pd(X)      _mm_round_pd((X), _MM_FROUND_FLOOR)\n#define _mm_floor_ss(X, Y)   _mm_round_ss((X), (Y), _MM_FROUND_FLOOR)\n#define _mm_floor_sd(X, Y)   _mm_round_sd((X), (Y), _MM_FROUND_FLOOR)\n\n#define _mm_round_ps(X, Y)      __builtin_ia32_roundps((X), (Y))\n#define _mm_round_ss(X, Y, M)   __builtin_ia32_roundss((X), (Y), (M))\n#define _mm_round_pd(X, M)      __builtin_ia32_roundpd((X), (M))\n#define _mm_round_sd(X, Y, M)   __builtin_ia32_roundsd((X), (Y), (M))\n\n/* SSE4 Packed Blending Intrinsics.  */\nstatic __inline__ __m128d __attribute__((__always_inline__, __nodebug__))\n_mm_blend_pd (__m128d __V1, __m128d __V2, const int __M)\n{\n  return (__m128d) __builtin_ia32_blendpd ((__v2df)__V1, (__v2df)__V2, __M);\n}\n\nstatic __inline__ __m128 __attribute__((__always_inline__, __nodebug__))\n_mm_blend_ps (__m128 __V1, __m128 __V2, const int __M)\n{\n  return (__m128) __builtin_ia32_blendps ((__v4sf)__V1, (__v4sf)__V2, __M);\n}\n\nstatic __inline__ __m128d __attribute__((__always_inline__, __nodebug__))\n_mm_blendv_pd (__m128d __V1, __m128d __V2, __m128d __M)\n{\n  return (__m128d) __builtin_ia32_blendvpd ((__v2df)__V1, (__v2df)__V2,\n                                            (__v2df)__M);\n}\n\nstatic __inline__ __m128 __attribute__((__always_inline__, __nodebug__))\n_mm_blendv_ps (__m128 __V1, __m128 __V2, __m128 __M)\n{\n  return (__m128) __builtin_ia32_blendvps ((__v4sf)__V1, (__v4sf)__V2,\n                                           (__v4sf)__M);\n}\n\nstatic __inline__ __m128i __attribute__((__always_inline__, __nodebug__))\n_mm_blendv_epi8 (__m128i __V1, __m128i __V2, __m128i __M)\n{\n  return (__m128i) __builtin_ia32_pblendvb128 ((__v16qi)__V1, (__v16qi)__V2,\n                                               (__v16qi)__M);\n}\n\nstatic __inline__  __m128i __attribute__((__always_inline__, __nodebug__))\n_mm_blend_epi16 (__m128i __V1, __m128i __V2, const int __M)\n{\n  return (__m128i) __builtin_ia32_pblendw128 ((__v8hi)__V1, (__v8hi)__V2, __M);\n}\n\n/* SSE4 Dword Multiply Instructions.  */\nstatic __inline__  __m128i __attribute__((__always_inline__, __nodebug__))\n_mm_mullo_epi32 (__m128i __V1, __m128i __V2)\n{\n  return (__m128i) ((__v4si)__V1 * (__v4si)__V2);\n}\n\nstatic __inline__  __m128i __attribute__((__always_inline__, __nodebug__))\n_mm_mul_epi32 (__m128i __V1, __m128i __V2)\n{\n  return (__m128i) __builtin_ia32_pmuldq128 ((__v4si)__V1, (__v4si)__V2);\n}\n\n/* SSE4 Floating Point Dot Product Instructions.  */\n#define _mm_dp_ps(X, Y, M) __builtin_ia32_dpps ((X), (Y), (M))\n#define _mm_dp_pd(X, Y, M) __builtin_ia32_dppd ((X), (Y), (M))\n\n/* SSE4 Streaming Load Hint Instruction.  */\nstatic __inline__  __m128i __attribute__((__always_inline__, __nodebug__))\n_mm_stream_load_si128 (__m128i *__V)\n{\n  return (__m128i) __builtin_ia32_movntdqa ((__v2di *) __V);\n}\n\n/* SSE4 Packed Integer Min/Max Instructions.  */\nstatic __inline__  __m128i __attribute__((__always_inline__, __nodebug__))\n_mm_min_epi8 (__m128i __V1, __m128i __V2)\n{\n  return (__m128i) __builtin_ia32_pminsb128 ((__v16qi) __V1, (__v16qi) __V2);\n}\n\nstatic __inline__  __m128i __attribute__((__always_inline__, __nodebug__))\n_mm_max_epi8 (__m128i __V1, __m128i __V2)\n{\n  return (__m128i) __builtin_ia32_pmaxsb128 ((__v16qi) __V1, (__v16qi) __V2);\n}\n\nstatic __inline__  __m128i __attribute__((__always_inline__, __nodebug__))\n_mm_min_epu16 (__m128i __V1, __m128i __V2)\n{\n  return (__m128i) __builtin_ia32_pminuw128 ((__v8hi) __V1, (__v8hi) __V2);\n}\n\nstatic __inline__  __m128i __attribute__((__always_inline__, __nodebug__))\n_mm_max_epu16 (__m128i __V1, __m128i __V2)\n{\n  return (__m128i) __builtin_ia32_pmaxuw128 ((__v8hi) __V1, (__v8hi) __V2);\n}\n\nstatic __inline__  __m128i __attribute__((__always_inline__, __nodebug__))\n_mm_min_epi32 (__m128i __V1, __m128i __V2)\n{\n  return (__m128i) __builtin_ia32_pminsd128 ((__v4si) __V1, (__v4si) __V2);\n}\n\nstatic __inline__  __m128i __attribute__((__always_inline__, __nodebug__))\n_mm_max_epi32 (__m128i __V1, __m128i __V2)\n{\n  return (__m128i) __builtin_ia32_pmaxsd128 ((__v4si) __V1, (__v4si) __V2);\n}\n\nstatic __inline__  __m128i __attribute__((__always_inline__, __nodebug__))\n_mm_min_epu32 (__m128i __V1, __m128i __V2)\n{\n  return (__m128i) __builtin_ia32_pminud128((__v4si) __V1, (__v4si) __V2);\n}\n\nstatic __inline__  __m128i __attribute__((__always_inline__, __nodebug__))\n_mm_max_epu32 (__m128i __V1, __m128i __V2)\n{\n  return (__m128i) __builtin_ia32_pmaxud128((__v4si) __V1, (__v4si) __V2);\n}\n\n/* SSE4 Insertion and Extraction from XMM Register Instructions.  */\n#define _mm_insert_ps(X, Y, N) __builtin_ia32_insertps128((X), (Y), (N))\n#define _mm_extract_ps(X, N) (__extension__                      \\\n                              ({ union { int i; float f; } __t;  \\\n                                 __v4sf __a = (__v4sf)(X);       \\\n                                 __t.f = __a[N];                 \\\n                                 __t.i;}))\n\n/* Miscellaneous insert and extract macros.  */\n/* Extract a single-precision float from X at index N into D.  */\n#define _MM_EXTRACT_FLOAT(D, X, N) (__extension__ ({ __v4sf __a = (__v4sf)(X); \\\n                                                    (D) = __a[N]; }))\n                                                    \n/* Or together 2 sets of indexes (X and Y) with the zeroing bits (Z) to create\n   an index suitable for _mm_insert_ps.  */\n#define _MM_MK_INSERTPS_NDX(X, Y, Z) (((X) << 6) | ((Y) << 4) | (Z))\n                                           \n/* Extract a float from X at index N into the first index of the return.  */\n#define _MM_PICK_OUT_PS(X, N) _mm_insert_ps (_mm_setzero_ps(), (X),   \\\n                                             _MM_MK_INSERTPS_NDX((N), 0, 0x0e))\n                                             \n/* Insert int into packed integer array at index.  */\n#define _mm_insert_epi8(X, I, N) (__extension__ ({ __v16qi __a = (__v16qi)(X); \\\n                                                   __a[N] = I;               \\\n                                                   __a;}))\n#define _mm_insert_epi32(X, I, N) (__extension__ ({ __v4si __a = (__v4si)(X); \\\n                                                    __a[N] = I;             \\\n                                                    __a;}))\n#ifdef __x86_64__\n#define _mm_insert_epi64(X, I, N) (__extension__ ({ __v2di __a = (__v2di)(X); \\\n                                                    __a[N] = I;             \\\n                                                    __a;}))\n#endif /* __x86_64__ */\n\n/* Extract int from packed integer array at index.  This returns the element\n * as a zero extended value, so it is unsigned.\n */\n#define _mm_extract_epi8(X, N) (__extension__ ({ __v16qi __a = (__v16qi)(X); \\\n                                                 (unsigned char)__a[N];}))\n#define _mm_extract_epi32(X, N) (__extension__ ({ __v4si __a = (__v4si)(X); \\\n                                                  (unsigned)__a[N];}))\n#ifdef __x86_64__\n#define _mm_extract_epi64(X, N) (__extension__ ({ __v2di __a = (__v2di)(X); \\\n                                                  __a[N];}))\n#endif /* __x86_64 */\n\n/* SSE4 128-bit Packed Integer Comparisons.  */\nstatic __inline__ int __attribute__((__always_inline__, __nodebug__))\n_mm_testz_si128(__m128i __M, __m128i __V)\n{\n  return __builtin_ia32_ptestz128((__v2di)__M, (__v2di)__V);\n}\n\nstatic __inline__ int __attribute__((__always_inline__, __nodebug__))\n_mm_testc_si128(__m128i __M, __m128i __V)\n{\n  return __builtin_ia32_ptestc128((__v2di)__M, (__v2di)__V);\n}\n\nstatic __inline__ int __attribute__((__always_inline__, __nodebug__))\n_mm_testnzc_si128(__m128i __M, __m128i __V)\n{\n  return __builtin_ia32_ptestnzc128((__v2di)__M, (__v2di)__V);\n}\n\n#define _mm_test_all_ones(V) _mm_testc_si128((V), _mm_cmpeq_epi32((V), (V)))\n#define _mm_test_mix_ones_zeros(M, V) _mm_testnzc_si128((M), (V))\n#define _mm_test_all_zeros(M, V) _mm_testz_si128 ((V), (V))\n\n/* SSE4 64-bit Packed Integer Comparisons.  */\nstatic __inline__ __m128i __attribute__((__always_inline__, __nodebug__))\n_mm_cmpeq_epi64(__m128i __V1, __m128i __V2)\n{\n  return (__m128i) __builtin_ia32_pcmpeqq((__v2di)__V1, (__v2di)__V2);\n}\n\n/* SSE4 Packed Integer Sign-Extension.  */\nstatic __inline__ __m128i __attribute__((__always_inline__, __nodebug__))\n_mm_cvtepi8_epi16(__m128i __V)\n{\n  return (__m128i) __builtin_ia32_pmovsxbw128((__v16qi) __V);\n}\n\nstatic __inline__ __m128i __attribute__((__always_inline__, __nodebug__))\n_mm_cvtepi8_epi32(__m128i __V)\n{\n  return (__m128i) __builtin_ia32_pmovsxbd128((__v16qi) __V);\n}\n\nstatic __inline__ __m128i __attribute__((__always_inline__, __nodebug__))\n_mm_cvtepi8_epi64(__m128i __V)\n{\n  return (__m128i) __builtin_ia32_pmovsxbq128((__v16qi) __V);\n}\n\nstatic __inline__ __m128i __attribute__((__always_inline__, __nodebug__))\n_mm_cvtepi16_epi32(__m128i __V)\n{\n  return (__m128i) __builtin_ia32_pmovsxwd128((__v8hi) __V); \n}\n\nstatic __inline__ __m128i __attribute__((__always_inline__, __nodebug__))\n_mm_cvtepi16_epi64(__m128i __V)\n{\n  return (__m128i) __builtin_ia32_pmovsxwq128((__v8hi)__V);\n}\n\nstatic __inline__ __m128i __attribute__((__always_inline__, __nodebug__))\n_mm_cvtepi32_epi64(__m128i __V)\n{\n  return (__m128i) __builtin_ia32_pmovsxdq128((__v4si)__V);\n}\n\n/* SSE4 Packed Integer Zero-Extension.  */\nstatic __inline__ __m128i __attribute__((__always_inline__, __nodebug__))\n_mm_cvtepu8_epi16(__m128i __V)\n{\n  return (__m128i) __builtin_ia32_pmovzxbw128((__v16qi) __V);\n}\n\nstatic __inline__ __m128i __attribute__((__always_inline__, __nodebug__))\n_mm_cvtepu8_epi32(__m128i __V)\n{\n  return (__m128i) __builtin_ia32_pmovzxbd128((__v16qi)__V);\n}\n\nstatic __inline__ __m128i __attribute__((__always_inline__, __nodebug__))\n_mm_cvtepu8_epi64(__m128i __V)\n{\n  return (__m128i) __builtin_ia32_pmovzxbq128((__v16qi)__V);\n}\n\nstatic __inline__ __m128i __attribute__((__always_inline__, __nodebug__))\n_mm_cvtepu16_epi32(__m128i __V)\n{\n  return (__m128i) __builtin_ia32_pmovzxwd128((__v8hi)__V);\n}\n\nstatic __inline__ __m128i __attribute__((__always_inline__, __nodebug__))\n_mm_cvtepu16_epi64(__m128i __V)\n{\n  return (__m128i) __builtin_ia32_pmovzxwq128((__v8hi)__V);\n}\n\nstatic __inline__ __m128i __attribute__((__always_inline__, __nodebug__))\n_mm_cvtepu32_epi64(__m128i __V)\n{\n  return (__m128i) __builtin_ia32_pmovzxdq128((__v4si)__V);\n}\n\n/* SSE4 Pack with Unsigned Saturation.  */\nstatic __inline__ __m128i __attribute__((__always_inline__, __nodebug__))\n_mm_packus_epi32(__m128i __V1, __m128i __V2)\n{\n  return (__m128i) __builtin_ia32_packusdw128((__v4si)__V1, (__v4si)__V2);\n}\n\n/* SSE4 Multiple Packed Sums of Absolute Difference.  */\n#define _mm_mpsadbw_epu8(X, Y, M) __builtin_ia32_mpsadbw128((X), (Y), (M))\n\n/* These definitions are normally in nmmintrin.h, but gcc puts them in here\n   so we'll do the same.  */\n#ifdef __SSE4_2__\n\n/* These specify the type of data that we're comparing.  */\n#define _SIDD_UBYTE_OPS                 0x00\n#define _SIDD_UWORD_OPS                 0x01\n#define _SIDD_SBYTE_OPS                 0x02\n#define _SIDD_SWORD_OPS                 0x03\n\n/* These specify the type of comparison operation.  */\n#define _SIDD_CMP_EQUAL_ANY             0x00\n#define _SIDD_CMP_RANGES                0x04\n#define _SIDD_CMP_EQUAL_EACH            0x08\n#define _SIDD_CMP_EQUAL_ORDERED         0x0c\n\n/* These macros specify the polarity of the operation.  */\n#define _SIDD_POSITIVE_POLARITY         0x00\n#define _SIDD_NEGATIVE_POLARITY         0x10\n#define _SIDD_MASKED_POSITIVE_POLARITY  0x20\n#define _SIDD_MASKED_NEGATIVE_POLARITY  0x30\n\n/* These macros are used in _mm_cmpXstri() to specify the return.  */\n#define _SIDD_LEAST_SIGNIFICANT         0x00\n#define _SIDD_MOST_SIGNIFICANT          0x40\n\n/* These macros are used in _mm_cmpXstri() to specify the return.  */\n#define _SIDD_BIT_MASK                  0x00\n#define _SIDD_UNIT_MASK                 0x40\n\n/* SSE4.2 Packed Comparison Intrinsics.  */\n#define _mm_cmpistrm(A, B, M) __builtin_ia32_pcmpistrm128((A), (B), (M))\n#define _mm_cmpistri(A, B, M) __builtin_ia32_pcmpistri128((A), (B), (M))\n\n#define _mm_cmpestrm(A, LA, B, LB, M) \\\n     __builtin_ia32_pcmpestrm128((A), (LA), (B), (LB), (M))\n#define _mm_cmpestri(X, LX, Y, LY, M) \\\n     __builtin_ia32_pcmpestri128((A), (LA), (B), (LB), (M))\n     \n/* SSE4.2 Packed Comparison Intrinsics and EFlag Reading.  */\n#define _mm_cmpistra(A, LA, B, LB, M) \\\n     __builtin_ia32_pcmpistria128((A), (LA), (B), (LB), (M))\n#define _mm_cmpistrc(A, LA, B, LB, M) \\\n     __builtin_ia32_pcmpistric128((A), (LA), (B), (LB), (M))\n#define _mm_cmpistro(A, LA, B, LB, M) \\\n     __builtin_ia32_pcmpistrio128((A), (LA), (B), (LB), (M))\n#define _mm_cmpistrs(A, LA, B, LB, M) \\\n     __builtin_ia32_pcmpistris128((A), (LA), (B), (LB), (M))\n#define _mm_cmpistrz(A, LA, B, LB, M) \\\n     __builtin_ia32_pcmpistriz128((A), (LA), (B), (LB), (M))\n\n#define _mm_cmpestra(A, LA, B, LB, M) \\\n     __builtin_ia32_pcmpestria128((A), (LA), (B), (LB), (M))\n#define _mm_cmpestrc(A, LA, B, LB, M) \\\n     __builtin_ia32_pcmpestric128((A), (LA), (B), (LB), (M))\n#define _mm_cmpestro(A, LA, B, LB, M) \\\n     __builtin_ia32_pcmpestrio128((A), (LA), (B), (LB), (M))\n#define _mm_cmpestrs(A, LA, B, LB, M) \\\n     __builtin_ia32_pcmpestris128((A), (LA), (B), (LB), (M))\n#define _mm_cmpestrz(A, LA, B, LB, M) \\\n     __builtin_ia32_pcmpestriz128((A), (LA), (B), (LB), (M))\n\n/* SSE4.2 Compare Packed Data -- Greater Than.  */\nstatic __inline__ __m128i __attribute__((__always_inline__, __nodebug__))\n_mm_cmpgt_epi64(__m128i __V1, __m128i __V2)\n{\n  return __builtin_ia32_pcmpgtq((__v2di)__V1, (__v2di)__V2);\n}\n\n/* SSE4.2 Accumulate CRC32.  */\nstatic __inline__ unsigned int __attribute__((__always_inline__, __nodebug__))\n_mm_crc32_u8(unsigned int __C, unsigned char __D)\n{\n  return __builtin_ia32_crc32qi(__C, __D);\n}\n\nstatic __inline__ unsigned int __attribute__((__always_inline__, __nodebug__))\n_mm_crc32_u16(unsigned int __C, unsigned short __D)\n{\n  return __builtin_ia32_crc32hi(__C, __D);\n}\n\nstatic __inline__ unsigned int __attribute__((__always_inline__, __nodebug__))\n_mm_crc32_u32(unsigned int __C, unsigned int __D)\n{\n  return __builtin_ia32_crc32si(__C, __D);\n}\n\n#ifdef __x86_64__\nstatic __inline__ unsigned long long __attribute__((__always_inline__, __nodebug__))\n_mm_crc32_u64(unsigned long long __C, unsigned long long __D)\n{\n  return __builtin_ia32_crc32di(__C, __D);\n}\n#endif /* __x86_64__ */\n\n/* SSE4.2 Population Count.  */\nstatic __inline__ int __attribute__((__always_inline__, __nodebug__))\n_mm_popcnt_u32(unsigned int __A)\n{\n  return __builtin_popcount(__A);\n}\n\n#ifdef __x86_64__\nstatic __inline__ long long __attribute__((__always_inline__, __nodebug__))\n_mm_popcnt_u64(unsigned long long __A)\n{\n  return __builtin_popcountll(__A);\n}\n#endif /* __x86_64__ */\n\n#endif /* __SSE4_2__ */\n#endif /* __SSE4_1__ */\n\n#endif /* _SMMINTRIN_H */\n"
  },
  {
    "path": "freebsd-headers/clang/3.0/tmmintrin.h",
    "content": "/*===---- tmmintrin.h - SSSE3 intrinsics -----------------------------------===\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n *\n *===-----------------------------------------------------------------------===\n */\n \n#ifndef __TMMINTRIN_H\n#define __TMMINTRIN_H\n\n#ifndef __SSSE3__\n#error \"SSSE3 instruction set not enabled\"\n#else\n\n#include <pmmintrin.h>\n\nstatic __inline__ __m64 __attribute__((__always_inline__, __nodebug__))\n_mm_abs_pi8(__m64 a)\n{\n    return (__m64)__builtin_ia32_pabsb((__v8qi)a);\n}\n\nstatic __inline__ __m128i __attribute__((__always_inline__, __nodebug__))\n_mm_abs_epi8(__m128i a)\n{\n    return (__m128i)__builtin_ia32_pabsb128((__v16qi)a);\n}\n\nstatic __inline__ __m64 __attribute__((__always_inline__, __nodebug__))\n_mm_abs_pi16(__m64 a)\n{\n    return (__m64)__builtin_ia32_pabsw((__v4hi)a);\n}\n\nstatic __inline__ __m128i __attribute__((__always_inline__, __nodebug__))\n_mm_abs_epi16(__m128i a)\n{\n    return (__m128i)__builtin_ia32_pabsw128((__v8hi)a);\n}\n\nstatic __inline__ __m64 __attribute__((__always_inline__, __nodebug__))\n_mm_abs_pi32(__m64 a)\n{\n    return (__m64)__builtin_ia32_pabsd((__v2si)a);\n}\n\nstatic __inline__ __m128i __attribute__((__always_inline__, __nodebug__))\n_mm_abs_epi32(__m128i a)\n{\n    return (__m128i)__builtin_ia32_pabsd128((__v4si)a);\n}\n\n#define _mm_alignr_epi8(a, b, n) (__builtin_ia32_palignr128((a), (b), (n)))\n#define _mm_alignr_pi8(a, b, n) (__builtin_ia32_palignr((a), (b), (n)))\n\nstatic __inline__ __m128i __attribute__((__always_inline__, __nodebug__))\n_mm_hadd_epi16(__m128i a, __m128i b)\n{\n    return (__m128i)__builtin_ia32_phaddw128((__v8hi)a, (__v8hi)b);\n}\n\nstatic __inline__ __m128i __attribute__((__always_inline__, __nodebug__))\n_mm_hadd_epi32(__m128i a, __m128i b)\n{\n    return (__m128i)__builtin_ia32_phaddd128((__v4si)a, (__v4si)b);\n}\n\nstatic __inline__ __m64 __attribute__((__always_inline__, __nodebug__))\n_mm_hadd_pi16(__m64 a, __m64 b)\n{\n    return (__m64)__builtin_ia32_phaddw((__v4hi)a, (__v4hi)b);\n}\n\nstatic __inline__ __m64 __attribute__((__always_inline__, __nodebug__))\n_mm_hadd_pi32(__m64 a, __m64 b)\n{\n    return (__m64)__builtin_ia32_phaddd((__v2si)a, (__v2si)b);\n}\n\nstatic __inline__ __m128i __attribute__((__always_inline__, __nodebug__))\n_mm_hadds_epi16(__m128i a, __m128i b)\n{\n    return (__m128i)__builtin_ia32_phaddsw128((__v8hi)a, (__v8hi)b);\n}\n\nstatic __inline__ __m64 __attribute__((__always_inline__, __nodebug__))\n_mm_hadds_pi16(__m64 a, __m64 b)\n{\n    return (__m64)__builtin_ia32_phaddsw((__v4hi)a, (__v4hi)b);\n}\n\nstatic __inline__ __m128i __attribute__((__always_inline__, __nodebug__))\n_mm_hsub_epi16(__m128i a, __m128i b)\n{\n    return (__m128i)__builtin_ia32_phsubw128((__v8hi)a, (__v8hi)b);\n}\n\nstatic __inline__ __m128i __attribute__((__always_inline__, __nodebug__))\n_mm_hsub_epi32(__m128i a, __m128i b)\n{\n    return (__m128i)__builtin_ia32_phsubd128((__v4si)a, (__v4si)b);\n}\n\nstatic __inline__ __m64 __attribute__((__always_inline__, __nodebug__))\n_mm_hsub_pi16(__m64 a, __m64 b)\n{\n    return (__m64)__builtin_ia32_phsubw((__v4hi)a, (__v4hi)b);\n}\n\nstatic __inline__ __m64 __attribute__((__always_inline__, __nodebug__))\n_mm_hsub_pi32(__m64 a, __m64 b)\n{\n    return (__m64)__builtin_ia32_phsubd((__v2si)a, (__v2si)b);\n}\n\nstatic __inline__ __m128i __attribute__((__always_inline__, __nodebug__))\n_mm_hsubs_epi16(__m128i a, __m128i b)\n{\n    return (__m128i)__builtin_ia32_phsubsw128((__v8hi)a, (__v8hi)b);\n}\n\nstatic __inline__ __m64 __attribute__((__always_inline__, __nodebug__))\n_mm_hsubs_pi16(__m64 a, __m64 b)\n{\n    return (__m64)__builtin_ia32_phsubsw((__v4hi)a, (__v4hi)b);\n}\n\nstatic __inline__ __m128i __attribute__((__always_inline__, __nodebug__))\n_mm_maddubs_epi16(__m128i a, __m128i b)\n{\n    return (__m128i)__builtin_ia32_pmaddubsw128((__v16qi)a, (__v16qi)b);\n}\n\nstatic __inline__ __m64 __attribute__((__always_inline__, __nodebug__))\n_mm_maddubs_pi16(__m64 a, __m64 b)\n{\n    return (__m64)__builtin_ia32_pmaddubsw((__v8qi)a, (__v8qi)b);\n}\n\nstatic __inline__ __m128i __attribute__((__always_inline__, __nodebug__))\n_mm_mulhrs_epi16(__m128i a, __m128i b)\n{\n    return (__m128i)__builtin_ia32_pmulhrsw128((__v8hi)a, (__v8hi)b);\n}\n\nstatic __inline__ __m64 __attribute__((__always_inline__, __nodebug__))\n_mm_mulhrs_pi16(__m64 a, __m64 b)\n{\n    return (__m64)__builtin_ia32_pmulhrsw((__v4hi)a, (__v4hi)b);\n}\n\nstatic __inline__ __m128i __attribute__((__always_inline__, __nodebug__))\n_mm_shuffle_epi8(__m128i a, __m128i b)\n{\n    return (__m128i)__builtin_ia32_pshufb128((__v16qi)a, (__v16qi)b);\n}\n\nstatic __inline__ __m64 __attribute__((__always_inline__, __nodebug__))\n_mm_shuffle_pi8(__m64 a, __m64 b)\n{\n    return (__m64)__builtin_ia32_pshufb((__v8qi)a, (__v8qi)b);\n}\n\nstatic __inline__ __m128i __attribute__((__always_inline__, __nodebug__))\n_mm_sign_epi8(__m128i a, __m128i b)\n{\n    return (__m128i)__builtin_ia32_psignb128((__v16qi)a, (__v16qi)b);\n}\n\nstatic __inline__ __m128i __attribute__((__always_inline__, __nodebug__))\n_mm_sign_epi16(__m128i a, __m128i b)\n{\n    return (__m128i)__builtin_ia32_psignw128((__v8hi)a, (__v8hi)b);\n}\n\nstatic __inline__ __m128i __attribute__((__always_inline__, __nodebug__))\n_mm_sign_epi32(__m128i a, __m128i b)\n{\n    return (__m128i)__builtin_ia32_psignd128((__v4si)a, (__v4si)b);\n}\n\nstatic __inline__ __m64 __attribute__((__always_inline__, __nodebug__))\n_mm_sign_pi8(__m64 a, __m64 b)\n{\n    return (__m64)__builtin_ia32_psignb((__v8qi)a, (__v8qi)b);  \n}\n\nstatic __inline__ __m64 __attribute__((__always_inline__, __nodebug__))\n_mm_sign_pi16(__m64 a, __m64 b)\n{\n    return (__m64)__builtin_ia32_psignw((__v4hi)a, (__v4hi)b);  \n}\n\nstatic __inline__ __m64 __attribute__((__always_inline__, __nodebug__))\n_mm_sign_pi32(__m64 a, __m64 b)\n{\n    return (__m64)__builtin_ia32_psignd((__v2si)a, (__v2si)b);\n}\n\n#endif /* __SSSE3__ */\n\n#endif /* __TMMINTRIN_H */\n"
  },
  {
    "path": "freebsd-headers/clang/3.0/wmmintrin.h",
    "content": "/*===---- wmmintrin.h - AES intrinsics ------------------------------------===\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n *\n *===-----------------------------------------------------------------------===\n */\n\n#ifndef _WMMINTRIN_H\n#define _WMMINTRIN_H\n\n#if !defined (__AES__)\n# error \"AES instructions not enabled\"\n#else\n\n#include <smmintrin.h>\n\nstatic __inline__ __m128i __attribute__((__always_inline__, __nodebug__))\n_mm_aesenc_si128(__m128i __V, __m128i __R)\n{\n  return (__m128i)__builtin_ia32_aesenc128(__V, __R);\n}\n\nstatic __inline__ __m128i __attribute__((__always_inline__, __nodebug__))\n_mm_aesenclast_si128(__m128i __V, __m128i __R)\n{\n  return (__m128i)__builtin_ia32_aesenclast128(__V, __R);\n}\n\nstatic __inline__ __m128i __attribute__((__always_inline__, __nodebug__))\n_mm_aesdec_si128(__m128i __V, __m128i __R)\n{\n  return (__m128i)__builtin_ia32_aesdec128(__V, __R);\n}\n\nstatic __inline__ __m128i __attribute__((__always_inline__, __nodebug__))\n_mm_aesdeclast_si128(__m128i __V, __m128i __R)\n{\n  return (__m128i)__builtin_ia32_aesdeclast128(__V, __R);\n}\n\nstatic __inline__ __m128i __attribute__((__always_inline__, __nodebug__))\n_mm_aesimc_si128(__m128i __V)\n{\n  return (__m128i)__builtin_ia32_aesimc128(__V);\n}\n\n#define _mm_aeskeygenassist_si128(C, R) \\\n  __builtin_ia32_aeskeygenassist128((C), (R))\n\n#endif /* __AES__ */\n#endif /* _WMMINTRIN_H */\n"
  },
  {
    "path": "freebsd-headers/clang/3.0/x86intrin.h",
    "content": "/*===---- x86intrin.h - X86 intrinsics -------------------------------------===\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n *\n *===-----------------------------------------------------------------------===\n */\n\n#ifndef __X86INTRIN_H\n#define __X86INTRIN_H\n\n#include <immintrin.h>\n\n// FIXME: SSE4A, 3dNOW, FMA4, XOP, LWP, ABM, POPCNT\n\n#endif /* __X86INTRIN_H */\n"
  },
  {
    "path": "freebsd-headers/clang/3.0/xmmintrin.h",
    "content": "/*===---- xmmintrin.h - SSE intrinsics -------------------------------------===\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n *\n *===-----------------------------------------------------------------------===\n */\n \n#ifndef __XMMINTRIN_H\n#define __XMMINTRIN_H\n \n#ifndef __SSE__\n#error \"SSE instruction set not enabled\"\n#else\n\n#include <mmintrin.h>\n\ntypedef int __v4si __attribute__((__vector_size__(16)));\ntypedef float __v4sf __attribute__((__vector_size__(16)));\ntypedef float __m128 __attribute__((__vector_size__(16)));\n\n// This header should only be included in a hosted environment as it depends on\n// a standard library to provide allocation routines.\n#if __STDC_HOSTED__\n#include <mm_malloc.h>\n#endif\n\nstatic __inline__ __m128 __attribute__((__always_inline__, __nodebug__))\n_mm_add_ss(__m128 a, __m128 b)\n{\n  a[0] += b[0];\n  return a;\n}\n\nstatic __inline__ __m128 __attribute__((__always_inline__, __nodebug__))\n_mm_add_ps(__m128 a, __m128 b)\n{\n  return a + b;\n}\n\nstatic __inline__ __m128 __attribute__((__always_inline__, __nodebug__))\n_mm_sub_ss(__m128 a, __m128 b)\n{\n  a[0] -= b[0];\n  return a;\n}\n\nstatic __inline__ __m128 __attribute__((__always_inline__, __nodebug__))\n_mm_sub_ps(__m128 a, __m128 b)\n{\n  return a - b;\n}\n\nstatic __inline__ __m128 __attribute__((__always_inline__, __nodebug__))\n_mm_mul_ss(__m128 a, __m128 b)\n{\n  a[0] *= b[0];\n  return a;\n}\n\nstatic __inline__ __m128 __attribute__((__always_inline__, __nodebug__))\n_mm_mul_ps(__m128 a, __m128 b)\n{\n  return a * b;\n}\n\nstatic __inline__ __m128 __attribute__((__always_inline__, __nodebug__))\n_mm_div_ss(__m128 a, __m128 b)\n{\n  a[0] /= b[0];\n  return a;\n}\n\nstatic __inline__ __m128 __attribute__((__always_inline__, __nodebug__))\n_mm_div_ps(__m128 a, __m128 b)\n{\n  return a / b;\n}\n\nstatic __inline__ __m128 __attribute__((__always_inline__, __nodebug__))\n_mm_sqrt_ss(__m128 a)\n{\n  return __builtin_ia32_sqrtss(a);\n}\n\nstatic __inline__ __m128 __attribute__((__always_inline__, __nodebug__))\n_mm_sqrt_ps(__m128 a)\n{\n  return __builtin_ia32_sqrtps(a);\n}\n\nstatic __inline__ __m128 __attribute__((__always_inline__, __nodebug__))\n_mm_rcp_ss(__m128 a)\n{\n  return __builtin_ia32_rcpss(a);\n}\n\nstatic __inline__ __m128 __attribute__((__always_inline__, __nodebug__))\n_mm_rcp_ps(__m128 a)\n{\n  return __builtin_ia32_rcpps(a);\n}\n\nstatic __inline__ __m128 __attribute__((__always_inline__, __nodebug__))\n_mm_rsqrt_ss(__m128 a)\n{\n  return __builtin_ia32_rsqrtss(a);\n}\n\nstatic __inline__ __m128 __attribute__((__always_inline__, __nodebug__))\n_mm_rsqrt_ps(__m128 a)\n{\n  return __builtin_ia32_rsqrtps(a);\n}\n\nstatic __inline__ __m128 __attribute__((__always_inline__, __nodebug__))\n_mm_min_ss(__m128 a, __m128 b)\n{\n  return __builtin_ia32_minss(a, b);\n}\n\nstatic __inline__ __m128 __attribute__((__always_inline__, __nodebug__))\n_mm_min_ps(__m128 a, __m128 b)\n{\n  return __builtin_ia32_minps(a, b);\n}\n\nstatic __inline__ __m128 __attribute__((__always_inline__, __nodebug__))\n_mm_max_ss(__m128 a, __m128 b)\n{\n  return __builtin_ia32_maxss(a, b);\n}\n\nstatic __inline__ __m128 __attribute__((__always_inline__, __nodebug__))\n_mm_max_ps(__m128 a, __m128 b)\n{\n  return __builtin_ia32_maxps(a, b);\n}\n\nstatic __inline__ __m128 __attribute__((__always_inline__, __nodebug__))\n_mm_and_ps(__m128 a, __m128 b)\n{\n  return (__m128)((__v4si)a & (__v4si)b);\n}\n\nstatic __inline__ __m128 __attribute__((__always_inline__, __nodebug__))\n_mm_andnot_ps(__m128 a, __m128 b)\n{\n  return (__m128)(~(__v4si)a & (__v4si)b);\n}\n\nstatic __inline__ __m128 __attribute__((__always_inline__, __nodebug__))\n_mm_or_ps(__m128 a, __m128 b)\n{\n  return (__m128)((__v4si)a | (__v4si)b);\n}\n\nstatic __inline__ __m128 __attribute__((__always_inline__, __nodebug__))\n_mm_xor_ps(__m128 a, __m128 b)\n{\n  return (__m128)((__v4si)a ^ (__v4si)b);\n}\n\nstatic __inline__ __m128 __attribute__((__always_inline__, __nodebug__))\n_mm_cmpeq_ss(__m128 a, __m128 b)\n{\n  return (__m128)__builtin_ia32_cmpss(a, b, 0);\n}\n\nstatic __inline__ __m128 __attribute__((__always_inline__, __nodebug__))\n_mm_cmpeq_ps(__m128 a, __m128 b)\n{\n  return (__m128)__builtin_ia32_cmpps(a, b, 0);\n}\n\nstatic __inline__ __m128 __attribute__((__always_inline__, __nodebug__))\n_mm_cmplt_ss(__m128 a, __m128 b)\n{\n  return (__m128)__builtin_ia32_cmpss(a, b, 1);\n}\n\nstatic __inline__ __m128 __attribute__((__always_inline__, __nodebug__))\n_mm_cmplt_ps(__m128 a, __m128 b)\n{\n  return (__m128)__builtin_ia32_cmpps(a, b, 1);\n}\n\nstatic __inline__ __m128 __attribute__((__always_inline__, __nodebug__))\n_mm_cmple_ss(__m128 a, __m128 b)\n{\n  return (__m128)__builtin_ia32_cmpss(a, b, 2);\n}\n\nstatic __inline__ __m128 __attribute__((__always_inline__, __nodebug__))\n_mm_cmple_ps(__m128 a, __m128 b)\n{\n  return (__m128)__builtin_ia32_cmpps(a, b, 2);\n}\n\nstatic __inline__ __m128 __attribute__((__always_inline__, __nodebug__))\n_mm_cmpgt_ss(__m128 a, __m128 b)\n{\n  return (__m128)__builtin_ia32_cmpss(b, a, 1);\n}\n\nstatic __inline__ __m128 __attribute__((__always_inline__, __nodebug__))\n_mm_cmpgt_ps(__m128 a, __m128 b)\n{\n  return (__m128)__builtin_ia32_cmpps(b, a, 1);\n}\n\nstatic __inline__ __m128 __attribute__((__always_inline__, __nodebug__))\n_mm_cmpge_ss(__m128 a, __m128 b)\n{\n  return (__m128)__builtin_ia32_cmpss(b, a, 2);\n}\n\nstatic __inline__ __m128 __attribute__((__always_inline__, __nodebug__))\n_mm_cmpge_ps(__m128 a, __m128 b)\n{\n  return (__m128)__builtin_ia32_cmpps(b, a, 2);\n}\n\nstatic __inline__ __m128 __attribute__((__always_inline__, __nodebug__))\n_mm_cmpneq_ss(__m128 a, __m128 b)\n{\n  return (__m128)__builtin_ia32_cmpss(a, b, 4);\n}\n\nstatic __inline__ __m128 __attribute__((__always_inline__, __nodebug__))\n_mm_cmpneq_ps(__m128 a, __m128 b)\n{\n  return (__m128)__builtin_ia32_cmpps(a, b, 4);\n}\n\nstatic __inline__ __m128 __attribute__((__always_inline__, __nodebug__))\n_mm_cmpnlt_ss(__m128 a, __m128 b)\n{\n  return (__m128)__builtin_ia32_cmpss(a, b, 5);\n}\n\nstatic __inline__ __m128 __attribute__((__always_inline__, __nodebug__))\n_mm_cmpnlt_ps(__m128 a, __m128 b)\n{\n  return (__m128)__builtin_ia32_cmpps(a, b, 5);\n}\n\nstatic __inline__ __m128 __attribute__((__always_inline__, __nodebug__))\n_mm_cmpnle_ss(__m128 a, __m128 b)\n{\n  return (__m128)__builtin_ia32_cmpss(a, b, 6);\n}\n\nstatic __inline__ __m128 __attribute__((__always_inline__, __nodebug__))\n_mm_cmpnle_ps(__m128 a, __m128 b)\n{\n  return (__m128)__builtin_ia32_cmpps(a, b, 6);\n}\n\nstatic __inline__ __m128 __attribute__((__always_inline__, __nodebug__))\n_mm_cmpngt_ss(__m128 a, __m128 b)\n{\n  return (__m128)__builtin_ia32_cmpss(b, a, 5);\n}\n\nstatic __inline__ __m128 __attribute__((__always_inline__, __nodebug__))\n_mm_cmpngt_ps(__m128 a, __m128 b)\n{\n  return (__m128)__builtin_ia32_cmpps(b, a, 5);\n}\n\nstatic __inline__ __m128 __attribute__((__always_inline__, __nodebug__))\n_mm_cmpnge_ss(__m128 a, __m128 b)\n{\n  return (__m128)__builtin_ia32_cmpss(b, a, 6);\n}\n\nstatic __inline__ __m128 __attribute__((__always_inline__, __nodebug__))\n_mm_cmpnge_ps(__m128 a, __m128 b)\n{\n  return (__m128)__builtin_ia32_cmpps(b, a, 6);\n}\n\nstatic __inline__ __m128 __attribute__((__always_inline__, __nodebug__))\n_mm_cmpord_ss(__m128 a, __m128 b)\n{\n  return (__m128)__builtin_ia32_cmpss(a, b, 7);\n}\n\nstatic __inline__ __m128 __attribute__((__always_inline__, __nodebug__))\n_mm_cmpord_ps(__m128 a, __m128 b)\n{\n  return (__m128)__builtin_ia32_cmpps(a, b, 7);\n}\n\nstatic __inline__ __m128 __attribute__((__always_inline__, __nodebug__))\n_mm_cmpunord_ss(__m128 a, __m128 b)\n{\n  return (__m128)__builtin_ia32_cmpss(a, b, 3);\n}\n\nstatic __inline__ __m128 __attribute__((__always_inline__, __nodebug__))\n_mm_cmpunord_ps(__m128 a, __m128 b)\n{\n  return (__m128)__builtin_ia32_cmpps(a, b, 3);\n}\n\nstatic __inline__ int __attribute__((__always_inline__, __nodebug__))\n_mm_comieq_ss(__m128 a, __m128 b)\n{\n  return __builtin_ia32_comieq(a, b);\n}\n\nstatic __inline__ int __attribute__((__always_inline__, __nodebug__))\n_mm_comilt_ss(__m128 a, __m128 b)\n{\n  return __builtin_ia32_comilt(a, b);\n}\n\nstatic __inline__ int __attribute__((__always_inline__, __nodebug__))\n_mm_comile_ss(__m128 a, __m128 b)\n{\n  return __builtin_ia32_comile(a, b);\n}\n\nstatic __inline__ int __attribute__((__always_inline__, __nodebug__))\n_mm_comigt_ss(__m128 a, __m128 b)\n{\n  return __builtin_ia32_comigt(a, b);\n}\n\nstatic __inline__ int __attribute__((__always_inline__, __nodebug__))\n_mm_comige_ss(__m128 a, __m128 b)\n{\n  return __builtin_ia32_comige(a, b);\n}\n\nstatic __inline__ int __attribute__((__always_inline__, __nodebug__))\n_mm_comineq_ss(__m128 a, __m128 b)\n{\n  return __builtin_ia32_comineq(a, b);\n}\n\nstatic __inline__ int __attribute__((__always_inline__, __nodebug__))\n_mm_ucomieq_ss(__m128 a, __m128 b)\n{\n  return __builtin_ia32_ucomieq(a, b);\n}\n\nstatic __inline__ int __attribute__((__always_inline__, __nodebug__))\n_mm_ucomilt_ss(__m128 a, __m128 b)\n{\n  return __builtin_ia32_ucomilt(a, b);\n}\n\nstatic __inline__ int __attribute__((__always_inline__, __nodebug__))\n_mm_ucomile_ss(__m128 a, __m128 b)\n{\n  return __builtin_ia32_ucomile(a, b);\n}\n\nstatic __inline__ int __attribute__((__always_inline__, __nodebug__))\n_mm_ucomigt_ss(__m128 a, __m128 b)\n{\n  return __builtin_ia32_ucomigt(a, b);\n}\n\nstatic __inline__ int __attribute__((__always_inline__, __nodebug__))\n_mm_ucomige_ss(__m128 a, __m128 b)\n{\n  return __builtin_ia32_ucomige(a, b);\n}\n\nstatic __inline__ int __attribute__((__always_inline__, __nodebug__))\n_mm_ucomineq_ss(__m128 a, __m128 b)\n{\n  return __builtin_ia32_ucomineq(a, b);\n}\n\nstatic __inline__ int __attribute__((__always_inline__, __nodebug__))\n_mm_cvtss_si32(__m128 a)\n{\n  return __builtin_ia32_cvtss2si(a);\n}\n\nstatic __inline__ int __attribute__((__always_inline__, __nodebug__))\n_mm_cvt_ss2si(__m128 a)\n{\n  return _mm_cvtss_si32(a);\n}\n\n#ifdef __x86_64__\n\nstatic __inline__ long long __attribute__((__always_inline__, __nodebug__))\n_mm_cvtss_si64(__m128 a)\n{\n  return __builtin_ia32_cvtss2si64(a);\n}\n\n#endif\n\nstatic __inline__ __m64 __attribute__((__always_inline__, __nodebug__))\n_mm_cvtps_pi32(__m128 a)\n{\n  return (__m64)__builtin_ia32_cvtps2pi(a);\n}\n\nstatic __inline__ __m64 __attribute__((__always_inline__, __nodebug__))\n_mm_cvt_ps2pi(__m128 a)\n{\n  return _mm_cvtps_pi32(a);\n}\n\nstatic __inline__ int __attribute__((__always_inline__, __nodebug__))\n_mm_cvttss_si32(__m128 a)\n{\n  return a[0];\n}\n\nstatic __inline__ int __attribute__((__always_inline__, __nodebug__))\n_mm_cvtt_ss2si(__m128 a)\n{\n  return _mm_cvttss_si32(a);\n}\n\nstatic __inline__ long long __attribute__((__always_inline__, __nodebug__))\n_mm_cvttss_si64(__m128 a)\n{\n  return a[0];\n}\n\nstatic __inline__ __m64 __attribute__((__always_inline__, __nodebug__))\n_mm_cvttps_pi32(__m128 a)\n{\n  return (__m64)__builtin_ia32_cvttps2pi(a);\n}\n\nstatic __inline__ __m64 __attribute__((__always_inline__, __nodebug__))\n_mm_cvtt_ps2pi(__m128 a)\n{\n  return _mm_cvttps_pi32(a);\n}\n\nstatic __inline__ __m128 __attribute__((__always_inline__, __nodebug__))\n_mm_cvtsi32_ss(__m128 a, int b)\n{\n  a[0] = b;\n  return a;\n}\n\nstatic __inline__ __m128 __attribute__((__always_inline__, __nodebug__))\n_mm_cvt_si2ss(__m128 a, int b)\n{\n  return _mm_cvtsi32_ss(a, b);\n}\n\n#ifdef __x86_64__\n\nstatic __inline__ __m128 __attribute__((__always_inline__, __nodebug__))\n_mm_cvtsi64_ss(__m128 a, long long b)\n{\n  a[0] = b;\n  return a;\n}\n\n#endif\n\nstatic __inline__ __m128 __attribute__((__always_inline__, __nodebug__))\n_mm_cvtpi32_ps(__m128 a, __m64 b)\n{\n  return __builtin_ia32_cvtpi2ps(a, (__v2si)b);\n}\n\nstatic __inline__ __m128 __attribute__((__always_inline__, __nodebug__))\n_mm_cvt_pi2ps(__m128 a, __m64 b)\n{\n  return _mm_cvtpi32_ps(a, b);\n}\n\nstatic __inline__ float __attribute__((__always_inline__, __nodebug__))\n_mm_cvtss_f32(__m128 a)\n{\n  return a[0];\n}\n\nstatic __inline__ __m128 __attribute__((__always_inline__, __nodebug__))\n_mm_loadh_pi(__m128 a, const __m64 *p)\n{\n  typedef float __mm_loadh_pi_v2f32 __attribute__((__vector_size__(8)));\n  struct __mm_loadh_pi_struct {\n    __mm_loadh_pi_v2f32 u;\n  } __attribute__((__packed__, __may_alias__));\n  __mm_loadh_pi_v2f32 b = ((struct __mm_loadh_pi_struct*)p)->u;\n  __m128 bb = __builtin_shufflevector(b, b, 0, 1, 0, 1);\n  return __builtin_shufflevector(a, bb, 0, 1, 4, 5);\n}\n\nstatic __inline__ __m128 __attribute__((__always_inline__, __nodebug__))\n_mm_loadl_pi(__m128 a, const __m64 *p)\n{\n  typedef float __mm_loadl_pi_v2f32 __attribute__((__vector_size__(8)));\n  struct __mm_loadl_pi_struct {\n    __mm_loadl_pi_v2f32 u;\n  } __attribute__((__packed__, __may_alias__));\n  __mm_loadl_pi_v2f32 b = ((struct __mm_loadl_pi_struct*)p)->u;\n  __m128 bb = __builtin_shufflevector(b, b, 0, 1, 0, 1);\n  return __builtin_shufflevector(a, bb, 4, 5, 2, 3);\n}\n\nstatic __inline__ __m128 __attribute__((__always_inline__, __nodebug__))\n_mm_load_ss(const float *p)\n{\n  struct __mm_load_ss_struct {\n    float u;\n  } __attribute__((__packed__, __may_alias__));\n  float u = ((struct __mm_load_ss_struct*)p)->u;\n  return (__m128){ u, 0, 0, 0 };\n}\n\nstatic __inline__ __m128 __attribute__((__always_inline__, __nodebug__))\n_mm_load1_ps(const float *p)\n{\n  struct __mm_load1_ps_struct {\n    float u;\n  } __attribute__((__packed__, __may_alias__));\n  float u = ((struct __mm_load1_ps_struct*)p)->u;\n  return (__m128){ u, u, u, u };\n}\n\n#define        _mm_load_ps1(p) _mm_load1_ps(p)\n\nstatic __inline__ __m128 __attribute__((__always_inline__, __nodebug__))\n_mm_load_ps(const float *p)\n{\n  return *(__m128*)p;\n}\n\nstatic __inline__ __m128 __attribute__((__always_inline__, __nodebug__))\n_mm_loadu_ps(const float *p)\n{\n  struct __loadu_ps {\n    __m128 v;\n  } __attribute__((__packed__, __may_alias__));\n  return ((struct __loadu_ps*)p)->v;\n}\n\nstatic __inline__ __m128 __attribute__((__always_inline__, __nodebug__))\n_mm_loadr_ps(const float *p)\n{\n  __m128 a = _mm_load_ps(p);\n  return __builtin_shufflevector(a, a, 3, 2, 1, 0);\n}\n\nstatic __inline__ __m128 __attribute__((__always_inline__, __nodebug__))\n_mm_set_ss(float w)\n{\n  return (__m128){ w, 0, 0, 0 };\n}\n\nstatic __inline__ __m128 __attribute__((__always_inline__, __nodebug__))\n_mm_set1_ps(float w)\n{\n  return (__m128){ w, w, w, w };\n}\n\n// Microsoft specific.\nstatic __inline__ __m128 __attribute__((__always_inline__, __nodebug__))\n_mm_set_ps1(float w)\n{\n    return _mm_set1_ps(w);\n}\n\nstatic __inline__ __m128 __attribute__((__always_inline__, __nodebug__))\n_mm_set_ps(float z, float y, float x, float w)\n{\n  return (__m128){ w, x, y, z };\n}\n\nstatic __inline__ __m128 __attribute__((__always_inline__, __nodebug__))\n_mm_setr_ps(float z, float y, float x, float w)\n{\n  return (__m128){ z, y, x, w };\n}\n\nstatic __inline__ __m128 __attribute__((__always_inline__))\n_mm_setzero_ps(void)\n{\n  return (__m128){ 0, 0, 0, 0 };\n}\n\nstatic __inline__ void __attribute__((__always_inline__))\n_mm_storeh_pi(__m64 *p, __m128 a)\n{\n  __builtin_ia32_storehps((__v2si *)p, a);\n}\n\nstatic __inline__ void __attribute__((__always_inline__))\n_mm_storel_pi(__m64 *p, __m128 a)\n{\n  __builtin_ia32_storelps((__v2si *)p, a);\n}\n\nstatic __inline__ void __attribute__((__always_inline__))\n_mm_store_ss(float *p, __m128 a)\n{\n  struct __mm_store_ss_struct {\n    float u;\n  } __attribute__((__packed__, __may_alias__));\n  ((struct __mm_store_ss_struct*)p)->u = a[0];\n}\n\nstatic __inline__ void __attribute__((__always_inline__, __nodebug__))\n_mm_storeu_ps(float *p, __m128 a)\n{\n  __builtin_ia32_storeups(p, a);\n}\n\nstatic __inline__ void __attribute__((__always_inline__, __nodebug__))\n_mm_store1_ps(float *p, __m128 a)\n{\n  a = __builtin_shufflevector(a, a, 0, 0, 0, 0);\n  _mm_storeu_ps(p, a);\n}\n\nstatic __inline__ void __attribute__((__always_inline__, __nodebug__))\n_mm_store_ps1(float *p, __m128 a)\n{\n    return _mm_store1_ps(p, a);\n}\n\nstatic __inline__ void __attribute__((__always_inline__, __nodebug__))\n_mm_store_ps(float *p, __m128 a)\n{\n  *(__m128 *)p = a;\n}\n\nstatic __inline__ void __attribute__((__always_inline__, __nodebug__))\n_mm_storer_ps(float *p, __m128 a)\n{\n  a = __builtin_shufflevector(a, a, 3, 2, 1, 0);\n  _mm_store_ps(p, a);\n}\n\n#define _MM_HINT_T0 3\n#define _MM_HINT_T1 2\n#define _MM_HINT_T2 1\n#define _MM_HINT_NTA 0\n\n/* FIXME: We have to #define this because \"sel\" must be a constant integer, and\n   Sema doesn't do any form of constant propagation yet. */\n\n#define _mm_prefetch(a, sel) (__builtin_prefetch((void *)(a), 0, sel))\n\nstatic __inline__ void __attribute__((__always_inline__, __nodebug__))\n_mm_stream_pi(__m64 *p, __m64 a)\n{\n  __builtin_ia32_movntq(p, a);\n}\n\nstatic __inline__ void __attribute__((__always_inline__, __nodebug__))\n_mm_stream_ps(float *p, __m128 a)\n{\n  __builtin_ia32_movntps(p, a);\n}\n\nstatic __inline__ void __attribute__((__always_inline__, __nodebug__))\n_mm_sfence(void)\n{\n  __builtin_ia32_sfence();\n}\n\nstatic __inline__ int __attribute__((__always_inline__, __nodebug__))\n_mm_extract_pi16(__m64 a, int n)\n{\n  __v4hi b = (__v4hi)a;\n  return (unsigned short)b[n & 3];\n}\n\nstatic __inline__ __m64 __attribute__((__always_inline__, __nodebug__))\n_mm_insert_pi16(__m64 a, int d, int n)\n{\n   __v4hi b = (__v4hi)a;\n   b[n & 3] = d;\n   return (__m64)b;\n}\n\nstatic __inline__ __m64 __attribute__((__always_inline__, __nodebug__))\n_mm_max_pi16(__m64 a, __m64 b)\n{\n  return (__m64)__builtin_ia32_pmaxsw((__v4hi)a, (__v4hi)b);\n}\n\nstatic __inline__ __m64 __attribute__((__always_inline__, __nodebug__))\n_mm_max_pu8(__m64 a, __m64 b)\n{\n  return (__m64)__builtin_ia32_pmaxub((__v8qi)a, (__v8qi)b);\n}\n\nstatic __inline__ __m64 __attribute__((__always_inline__, __nodebug__))\n_mm_min_pi16(__m64 a, __m64 b)\n{\n  return (__m64)__builtin_ia32_pminsw((__v4hi)a, (__v4hi)b);\n}\n\nstatic __inline__ __m64 __attribute__((__always_inline__, __nodebug__))\n_mm_min_pu8(__m64 a, __m64 b)\n{\n  return (__m64)__builtin_ia32_pminub((__v8qi)a, (__v8qi)b);\n}\n\nstatic __inline__ int __attribute__((__always_inline__, __nodebug__))\n_mm_movemask_pi8(__m64 a)\n{\n  return __builtin_ia32_pmovmskb((__v8qi)a);\n}\n\nstatic __inline__ __m64 __attribute__((__always_inline__, __nodebug__))\n_mm_mulhi_pu16(__m64 a, __m64 b)\n{\n  return (__m64)__builtin_ia32_pmulhuw((__v4hi)a, (__v4hi)b);  \n}\n\n#define _mm_shuffle_pi16(a, n) \\\n  ((__m64)__builtin_ia32_pshufw(a, n))\n\nstatic __inline__ void __attribute__((__always_inline__, __nodebug__))\n_mm_maskmove_si64(__m64 d, __m64 n, char *p)\n{\n  __builtin_ia32_maskmovq((__v8qi)d, (__v8qi)n, p);\n}\n\nstatic __inline__ __m64 __attribute__((__always_inline__, __nodebug__))\n_mm_avg_pu8(__m64 a, __m64 b)\n{\n  return (__m64)__builtin_ia32_pavgb((__v8qi)a, (__v8qi)b);\n}\n\nstatic __inline__ __m64 __attribute__((__always_inline__, __nodebug__))\n_mm_avg_pu16(__m64 a, __m64 b)\n{\n  return (__m64)__builtin_ia32_pavgw((__v4hi)a, (__v4hi)b);\n}\n\nstatic __inline__ __m64 __attribute__((__always_inline__, __nodebug__))\n_mm_sad_pu8(__m64 a, __m64 b)\n{\n  return (__m64)__builtin_ia32_psadbw((__v8qi)a, (__v8qi)b);\n}\n\nstatic __inline__ unsigned int __attribute__((__always_inline__, __nodebug__))\n_mm_getcsr(void)\n{\n  return __builtin_ia32_stmxcsr();\n}\n\nstatic __inline__ void __attribute__((__always_inline__, __nodebug__))\n_mm_setcsr(unsigned int i)\n{\n  __builtin_ia32_ldmxcsr(i);\n}\n\n#define _mm_shuffle_ps(a, b, mask) \\\n        (__builtin_shufflevector((__v4sf)(a), (__v4sf)(b),                \\\n                                 (mask) & 0x3, ((mask) & 0xc) >> 2, \\\n                                 (((mask) & 0x30) >> 4) + 4, \\\n                                 (((mask) & 0xc0) >> 6) + 4))\n\nstatic __inline__ __m128 __attribute__((__always_inline__, __nodebug__))\n_mm_unpackhi_ps(__m128 a, __m128 b)\n{\n  return __builtin_shufflevector(a, b, 2, 6, 3, 7);\n}\n\nstatic __inline__ __m128 __attribute__((__always_inline__, __nodebug__))\n_mm_unpacklo_ps(__m128 a, __m128 b)\n{\n  return __builtin_shufflevector(a, b, 0, 4, 1, 5);\n}\n\nstatic __inline__ __m128 __attribute__((__always_inline__, __nodebug__))\n_mm_move_ss(__m128 a, __m128 b)\n{\n  return __builtin_shufflevector(a, b, 4, 1, 2, 3);\n}\n\nstatic __inline__ __m128 __attribute__((__always_inline__, __nodebug__))\n_mm_movehl_ps(__m128 a, __m128 b)\n{\n  return __builtin_shufflevector(a, b, 6, 7, 2, 3);\n}\n\nstatic __inline__ __m128 __attribute__((__always_inline__, __nodebug__))\n_mm_movelh_ps(__m128 a, __m128 b)\n{\n  return __builtin_shufflevector(a, b, 0, 1, 4, 5);\n}\n\nstatic __inline__ __m128 __attribute__((__always_inline__, __nodebug__))\n_mm_cvtpi16_ps(__m64 a)\n{\n  __m64 b, c;\n  __m128 r;\n\n  b = _mm_setzero_si64();\n  b = _mm_cmpgt_pi16(b, a);\n  c = _mm_unpackhi_pi16(a, b);  \n  r = _mm_setzero_ps();\n  r = _mm_cvtpi32_ps(r, c);\n  r = _mm_movelh_ps(r, r);\n  c = _mm_unpacklo_pi16(a, b);  \n  r = _mm_cvtpi32_ps(r, c);\n\n  return r;\n}\n\nstatic __inline__ __m128 __attribute__((__always_inline__, __nodebug__))\n_mm_cvtpu16_ps(__m64 a)\n{\n  __m64 b, c;\n  __m128 r;\n\n  b = _mm_setzero_si64();\n  c = _mm_unpackhi_pi16(a, b);  \n  r = _mm_setzero_ps();\n  r = _mm_cvtpi32_ps(r, c);\n  r = _mm_movelh_ps(r, r);\n  c = _mm_unpacklo_pi16(a, b);  \n  r = _mm_cvtpi32_ps(r, c);\n\n  return r;\n}\n\nstatic __inline__ __m128 __attribute__((__always_inline__, __nodebug__))\n_mm_cvtpi8_ps(__m64 a)\n{\n  __m64 b;\n  \n  b = _mm_setzero_si64();\n  b = _mm_cmpgt_pi8(b, a);\n  b = _mm_unpacklo_pi8(a, b);\n\n  return _mm_cvtpi16_ps(b);\n}\n\nstatic __inline__ __m128 __attribute__((__always_inline__, __nodebug__))\n_mm_cvtpu8_ps(__m64 a)\n{\n  __m64 b;\n  \n  b = _mm_setzero_si64();\n  b = _mm_unpacklo_pi8(a, b);\n\n  return _mm_cvtpi16_ps(b);\n}\n\nstatic __inline__ __m128 __attribute__((__always_inline__, __nodebug__))\n_mm_cvtpi32x2_ps(__m64 a, __m64 b)\n{\n  __m128 c;\n  \n  c = _mm_setzero_ps();  \n  c = _mm_cvtpi32_ps(c, b);\n  c = _mm_movelh_ps(c, c);\n\n  return _mm_cvtpi32_ps(c, a);\n}\n\nstatic __inline__ __m64 __attribute__((__always_inline__, __nodebug__))\n_mm_cvtps_pi16(__m128 a)\n{\n  __m64 b, c;\n  \n  b = _mm_cvtps_pi32(a);\n  a = _mm_movehl_ps(a, a);\n  c = _mm_cvtps_pi32(a);\n  \n  return _mm_packs_pi16(b, c);\n}\n\nstatic __inline__ __m64 __attribute__((__always_inline__, __nodebug__))\n_mm_cvtps_pi8(__m128 a)\n{\n  __m64 b, c;\n  \n  b = _mm_cvtps_pi16(a);\n  c = _mm_setzero_si64();\n  \n  return _mm_packs_pi16(b, c);\n}\n\nstatic __inline__ int __attribute__((__always_inline__, __nodebug__))\n_mm_movemask_ps(__m128 a)\n{\n  return __builtin_ia32_movmskps(a);\n}\n\n#define _MM_SHUFFLE(z, y, x, w) (((z) << 6) | ((y) << 4) | ((x) << 2) | (w))\n\n#define _MM_EXCEPT_INVALID    (0x0001)\n#define _MM_EXCEPT_DENORM     (0x0002)\n#define _MM_EXCEPT_DIV_ZERO   (0x0004)\n#define _MM_EXCEPT_OVERFLOW   (0x0008)\n#define _MM_EXCEPT_UNDERFLOW  (0x0010)\n#define _MM_EXCEPT_INEXACT    (0x0020)\n#define _MM_EXCEPT_MASK       (0x003f)\n\n#define _MM_MASK_INVALID      (0x0080)\n#define _MM_MASK_DENORM       (0x0100)\n#define _MM_MASK_DIV_ZERO     (0x0200)\n#define _MM_MASK_OVERFLOW     (0x0400)\n#define _MM_MASK_UNDERFLOW    (0x0800)\n#define _MM_MASK_INEXACT      (0x1000)\n#define _MM_MASK_MASK         (0x1f80)\n\n#define _MM_ROUND_NEAREST     (0x0000)\n#define _MM_ROUND_DOWN        (0x2000)\n#define _MM_ROUND_UP          (0x4000)\n#define _MM_ROUND_TOWARD_ZERO (0x6000)\n#define _MM_ROUND_MASK        (0x6000)\n\n#define _MM_FLUSH_ZERO_MASK   (0x8000)\n#define _MM_FLUSH_ZERO_ON     (0x8000)\n#define _MM_FLUSH_ZERO_OFF    (0x8000)\n\n#define _MM_GET_EXCEPTION_MASK() (_mm_getcsr() & _MM_MASK_MASK)\n#define _MM_GET_EXCEPTION_STATE() (_mm_getcsr() & _MM_EXCEPT_MASK)\n#define _MM_GET_FLUSH_ZERO_MODE() (_mm_getcsr() & _MM_FLUSH_ZERO_MASK)\n#define _MM_GET_ROUNDING_MODE() (_mm_getcsr() & _MM_ROUND_MASK)\n\n#define _MM_SET_EXCEPTION_MASK(x) (_mm_setcsr((_mm_getcsr() & ~_MM_MASK_MASK) | (x)))\n#define _MM_SET_EXCEPTION_STATE(x) (_mm_setcsr((_mm_getcsr() & ~_MM_EXCEPT_MASK) | (x)))\n#define _MM_SET_FLUSH_ZERO_MODE(x) (_mm_setcsr((_mm_getcsr() & ~_MM_FLUSH_ZERO_MASK) | (x)))\n#define _MM_SET_ROUNDING_MODE(x) (_mm_setcsr((_mm_getcsr() & ~_MM_ROUND_MASK) | (x)))\n\n#define _MM_TRANSPOSE4_PS(row0, row1, row2, row3) \\\ndo { \\\n  __m128 tmp3, tmp2, tmp1, tmp0; \\\n  tmp0 = _mm_unpacklo_ps((row0), (row1)); \\\n  tmp2 = _mm_unpacklo_ps((row2), (row3)); \\\n  tmp1 = _mm_unpackhi_ps((row0), (row1)); \\\n  tmp3 = _mm_unpackhi_ps((row2), (row3)); \\\n  (row0) = _mm_movelh_ps(tmp0, tmp2); \\\n  (row1) = _mm_movehl_ps(tmp2, tmp0); \\\n  (row2) = _mm_movelh_ps(tmp1, tmp3); \\\n  (row3) = _mm_movehl_ps(tmp3, tmp1); \\\n} while (0)\n\n/* Aliases for compatibility. */\n#define _m_pextrw _mm_extract_pi16\n#define _m_pinsrw _mm_insert_pi16\n#define _m_pmaxsw _mm_max_pi16\n#define _m_pmaxub _mm_max_pu8\n#define _m_pminsw _mm_min_pi16\n#define _m_pminub _mm_min_pu8\n#define _m_pmovmskb _mm_movemask_pi8\n#define _m_pmulhuw _mm_mulhi_pu16\n#define _m_pshufw _mm_shuffle_pi16\n#define _m_maskmovq _mm_maskmove_si64\n#define _m_pavgb _mm_avg_pu8\n#define _m_pavgw _mm_avg_pu16\n#define _m_psadbw _mm_sad_pu8\n#define _m_ _mm_\n#define _m_ _mm_\n\n/* Ugly hack for backwards-compatibility (compatible with gcc) */\n#ifdef __SSE2__\n#include <emmintrin.h>\n#endif\n\n#endif /* __SSE__ */\n\n#endif /* __XMMINTRIN_H */\n"
  },
  {
    "path": "freebsd-headers/cms_asn1.h",
    "content": "/* Generated from /usr/src/kerberos5/lib/libasn1/../../../crypto/heimdal/lib/asn1/CMS.asn1 */\n/* Do not edit */\n\n#ifndef __cms_asn1_h__\n#define __cms_asn1_h__\n\n#include <stddef.h>\n#include <time.h>\n\n#ifndef __asn1_common_definitions__\n#define __asn1_common_definitions__\n\ntypedef struct heim_integer {\n  size_t length;\n  void *data;\n  int negative;\n} heim_integer;\n\ntypedef struct heim_octet_string {\n  size_t length;\n  void *data;\n} heim_octet_string;\n\ntypedef char *heim_general_string;\n\ntypedef char *heim_utf8_string;\n\ntypedef char *heim_printable_string;\n\ntypedef char *heim_ia5_string;\n\ntypedef struct heim_bmp_string {\n  size_t length;\n  uint16_t *data;\n} heim_bmp_string;\n\ntypedef struct heim_universal_string {\n  size_t length;\n  uint32_t *data;\n} heim_universal_string;\n\ntypedef char *heim_visible_string;\n\ntypedef struct heim_oid {\n  size_t length;\n  unsigned *components;\n} heim_oid;\n\ntypedef struct heim_bit_string {\n  size_t length;\n  void *data;\n} heim_bit_string;\n\ntypedef struct heim_octet_string heim_any;\ntypedef struct heim_octet_string heim_any_set;\n\n#define ASN1_MALLOC_ENCODE(T, B, BL, S, L, R)                  \\\n  do {                                                         \\\n    (BL) = length_##T((S));                                    \\\n    (B) = malloc((BL));                                        \\\n    if((B) == NULL) {                                          \\\n      (R) = ENOMEM;                                            \\\n    } else {                                                   \\\n      (R) = encode_##T(((unsigned char*)(B)) + (BL) - 1, (BL), \\\n                       (S), (L));                              \\\n      if((R) != 0) {                                           \\\n        free((B));                                             \\\n        (B) = NULL;                                            \\\n      }                                                        \\\n    }                                                          \\\n  } while (0)\n\nstruct units;\n\n#endif\n\n#include <rfc2459_asn1.h>\n#include <heim_asn1.h>\n/* OBJECT IDENTIFIER id-pkcs7 ::= { iso(1) member-body(2) us(840) rsadsi(113549) pkcs(1) pkcs7(7) } */\nconst heim_oid *oid_id_pkcs7(void);\n\n/* OBJECT IDENTIFIER id-pkcs7-data ::= { iso(1) member-body(2) us(840) rsadsi(113549) pkcs(1) pkcs7(7) label-less(1) } */\nconst heim_oid *oid_id_pkcs7_data(void);\n\n/* OBJECT IDENTIFIER id-pkcs7-signedData ::= { iso(1) member-body(2) us(840) rsadsi(113549) pkcs(1) pkcs7(7) label-less(2) } */\nconst heim_oid *oid_id_pkcs7_signedData(void);\n\n/* OBJECT IDENTIFIER id-pkcs7-envelopedData ::= { iso(1) member-body(2) us(840) rsadsi(113549) pkcs(1) pkcs7(7) label-less(3) } */\nconst heim_oid *oid_id_pkcs7_envelopedData(void);\n\n/* OBJECT IDENTIFIER id-pkcs7-signedAndEnvelopedData ::= { iso(1) member-body(2) us(840) rsadsi(113549) pkcs(1) pkcs7(7) label-less(4) } */\nconst heim_oid *oid_id_pkcs7_signedAndEnvelopedData(void);\n\n/* OBJECT IDENTIFIER id-pkcs7-digestedData ::= { iso(1) member-body(2) us(840) rsadsi(113549) pkcs(1) pkcs7(7) label-less(5) } */\nconst heim_oid *oid_id_pkcs7_digestedData(void);\n\n/* OBJECT IDENTIFIER id-pkcs7-encryptedData ::= { iso(1) member-body(2) us(840) rsadsi(113549) pkcs(1) pkcs7(7) label-less(6) } */\nconst heim_oid *oid_id_pkcs7_encryptedData(void);\n\n/*\nCMSVersion ::= INTEGER {\n  CMSVersion_v0(0),\n  CMSVersion_v1(1),\n  CMSVersion_v2(2),\n  CMSVersion_v3(3),\n  CMSVersion_v4(4)\n}\n*/\n\ntypedef enum CMSVersion {\n  CMSVersion_v0 = 0,\n  CMSVersion_v1 = 1,\n  CMSVersion_v2 = 2,\n  CMSVersion_v3 = 3,\n  CMSVersion_v4 = 4\n} CMSVersion;\n\nint    encode_CMSVersion(unsigned char *, size_t, const CMSVersion *, size_t *);\nint    decode_CMSVersion(const unsigned char *, size_t, CMSVersion *, size_t *);\nvoid   free_CMSVersion  (CMSVersion *);\nsize_t length_CMSVersion(const CMSVersion *);\nint    copy_CMSVersion  (const CMSVersion *, CMSVersion *);\n\n\n/*\nDigestAlgorithmIdentifier ::= AlgorithmIdentifier\n*/\n\ntypedef AlgorithmIdentifier DigestAlgorithmIdentifier;\n\nint    encode_DigestAlgorithmIdentifier(unsigned char *, size_t, const DigestAlgorithmIdentifier *, size_t *);\nint    decode_DigestAlgorithmIdentifier(const unsigned char *, size_t, DigestAlgorithmIdentifier *, size_t *);\nvoid   free_DigestAlgorithmIdentifier  (DigestAlgorithmIdentifier *);\nsize_t length_DigestAlgorithmIdentifier(const DigestAlgorithmIdentifier *);\nint    copy_DigestAlgorithmIdentifier  (const DigestAlgorithmIdentifier *, DigestAlgorithmIdentifier *);\n\n\n/*\nDigestAlgorithmIdentifiers ::= SET OF DigestAlgorithmIdentifier\n*/\n\ntypedef struct DigestAlgorithmIdentifiers {\n  unsigned int len;\n  DigestAlgorithmIdentifier *val;\n} DigestAlgorithmIdentifiers;\n\nint    encode_DigestAlgorithmIdentifiers(unsigned char *, size_t, const DigestAlgorithmIdentifiers *, size_t *);\nint    decode_DigestAlgorithmIdentifiers(const unsigned char *, size_t, DigestAlgorithmIdentifiers *, size_t *);\nvoid   free_DigestAlgorithmIdentifiers  (DigestAlgorithmIdentifiers *);\nsize_t length_DigestAlgorithmIdentifiers(const DigestAlgorithmIdentifiers *);\nint    copy_DigestAlgorithmIdentifiers  (const DigestAlgorithmIdentifiers *, DigestAlgorithmIdentifiers *);\n\n\n/*\nSignatureAlgorithmIdentifier ::= AlgorithmIdentifier\n*/\n\ntypedef AlgorithmIdentifier SignatureAlgorithmIdentifier;\n\nint    encode_SignatureAlgorithmIdentifier(unsigned char *, size_t, const SignatureAlgorithmIdentifier *, size_t *);\nint    decode_SignatureAlgorithmIdentifier(const unsigned char *, size_t, SignatureAlgorithmIdentifier *, size_t *);\nvoid   free_SignatureAlgorithmIdentifier  (SignatureAlgorithmIdentifier *);\nsize_t length_SignatureAlgorithmIdentifier(const SignatureAlgorithmIdentifier *);\nint    copy_SignatureAlgorithmIdentifier  (const SignatureAlgorithmIdentifier *, SignatureAlgorithmIdentifier *);\n\n\n/*\nContentType ::= OBJECT IDENTIFIER\n*/\n\ntypedef heim_oid ContentType;\n\nint    encode_ContentType(unsigned char *, size_t, const ContentType *, size_t *);\nint    decode_ContentType(const unsigned char *, size_t, ContentType *, size_t *);\nvoid   free_ContentType  (ContentType *);\nsize_t length_ContentType(const ContentType *);\nint    copy_ContentType  (const ContentType *, ContentType *);\n\n\n/*\nMessageDigest ::= OCTET STRING\n*/\n\ntypedef heim_octet_string MessageDigest;\n\nint    encode_MessageDigest(unsigned char *, size_t, const MessageDigest *, size_t *);\nint    decode_MessageDigest(const unsigned char *, size_t, MessageDigest *, size_t *);\nvoid   free_MessageDigest  (MessageDigest *);\nsize_t length_MessageDigest(const MessageDigest *);\nint    copy_MessageDigest  (const MessageDigest *, MessageDigest *);\n\n\n/*\nContentInfo ::= SEQUENCE {\n  contentType     ContentType,\n  content         [0] heim_any OPTIONAL,\n}\n*/\n\ntypedef struct ContentInfo {\n  ContentType contentType;\n  heim_any *content;\n} ContentInfo;\n\nint    encode_ContentInfo(unsigned char *, size_t, const ContentInfo *, size_t *);\nint    decode_ContentInfo(const unsigned char *, size_t, ContentInfo *, size_t *);\nvoid   free_ContentInfo  (ContentInfo *);\nsize_t length_ContentInfo(const ContentInfo *);\nint    copy_ContentInfo  (const ContentInfo *, ContentInfo *);\n\n\n/*\nEncapsulatedContentInfo ::= SEQUENCE {\n  eContentType    ContentType,\n  eContent        [0] OCTET STRING OPTIONAL,\n}\n*/\n\ntypedef struct EncapsulatedContentInfo {\n  ContentType eContentType;\n  heim_octet_string *eContent;\n} EncapsulatedContentInfo;\n\nint    encode_EncapsulatedContentInfo(unsigned char *, size_t, const EncapsulatedContentInfo *, size_t *);\nint    decode_EncapsulatedContentInfo(const unsigned char *, size_t, EncapsulatedContentInfo *, size_t *);\nvoid   free_EncapsulatedContentInfo  (EncapsulatedContentInfo *);\nsize_t length_EncapsulatedContentInfo(const EncapsulatedContentInfo *);\nint    copy_EncapsulatedContentInfo  (const EncapsulatedContentInfo *, EncapsulatedContentInfo *);\n\n\n/*\nCertificateSet ::= SET OF heim_any\n*/\n\ntypedef struct CertificateSet {\n  unsigned int len;\n  heim_any *val;\n} CertificateSet;\n\nint    encode_CertificateSet(unsigned char *, size_t, const CertificateSet *, size_t *);\nint    decode_CertificateSet(const unsigned char *, size_t, CertificateSet *, size_t *);\nvoid   free_CertificateSet  (CertificateSet *);\nsize_t length_CertificateSet(const CertificateSet *);\nint    copy_CertificateSet  (const CertificateSet *, CertificateSet *);\n\n\n/*\nCertificateList ::= Certificate\n*/\n\ntypedef Certificate CertificateList;\n\nint    encode_CertificateList(unsigned char *, size_t, const CertificateList *, size_t *);\nint    decode_CertificateList(const unsigned char *, size_t, CertificateList *, size_t *);\nvoid   free_CertificateList  (CertificateList *);\nsize_t length_CertificateList(const CertificateList *);\nint    copy_CertificateList  (const CertificateList *, CertificateList *);\n\n\n/*\nCertificateRevocationLists ::= SET OF CertificateList\n*/\n\ntypedef struct CertificateRevocationLists {\n  unsigned int len;\n  CertificateList *val;\n} CertificateRevocationLists;\n\nint    encode_CertificateRevocationLists(unsigned char *, size_t, const CertificateRevocationLists *, size_t *);\nint    decode_CertificateRevocationLists(const unsigned char *, size_t, CertificateRevocationLists *, size_t *);\nvoid   free_CertificateRevocationLists  (CertificateRevocationLists *);\nsize_t length_CertificateRevocationLists(const CertificateRevocationLists *);\nint    copy_CertificateRevocationLists  (const CertificateRevocationLists *, CertificateRevocationLists *);\n\n\n/*\nIssuerAndSerialNumber ::= SEQUENCE {\n  issuer          Name,\n  serialNumber    CertificateSerialNumber,\n}\n*/\n\ntypedef struct IssuerAndSerialNumber {\n  Name issuer;\n  CertificateSerialNumber serialNumber;\n} IssuerAndSerialNumber;\n\nint    encode_IssuerAndSerialNumber(unsigned char *, size_t, const IssuerAndSerialNumber *, size_t *);\nint    decode_IssuerAndSerialNumber(const unsigned char *, size_t, IssuerAndSerialNumber *, size_t *);\nvoid   free_IssuerAndSerialNumber  (IssuerAndSerialNumber *);\nsize_t length_IssuerAndSerialNumber(const IssuerAndSerialNumber *);\nint    copy_IssuerAndSerialNumber  (const IssuerAndSerialNumber *, IssuerAndSerialNumber *);\n\n\n/*\nCMSIdentifier ::= CHOICE {\n  issuerAndSerialNumber   IssuerAndSerialNumber,\n  subjectKeyIdentifier    [0] SubjectKeyIdentifier,\n}\n*/\n\ntypedef struct CMSIdentifier {\n  enum {\n    choice_CMSIdentifier_issuerAndSerialNumber = 1,\n    choice_CMSIdentifier_subjectKeyIdentifier\n  } element;\n  union {\n    IssuerAndSerialNumber issuerAndSerialNumber;\n    SubjectKeyIdentifier subjectKeyIdentifier;\n  } u;\n} CMSIdentifier;\n\nint    encode_CMSIdentifier(unsigned char *, size_t, const CMSIdentifier *, size_t *);\nint    decode_CMSIdentifier(const unsigned char *, size_t, CMSIdentifier *, size_t *);\nvoid   free_CMSIdentifier  (CMSIdentifier *);\nsize_t length_CMSIdentifier(const CMSIdentifier *);\nint    copy_CMSIdentifier  (const CMSIdentifier *, CMSIdentifier *);\n\n\n/*\nSignerIdentifier ::= CMSIdentifier\n*/\n\ntypedef CMSIdentifier SignerIdentifier;\n\nint    encode_SignerIdentifier(unsigned char *, size_t, const SignerIdentifier *, size_t *);\nint    decode_SignerIdentifier(const unsigned char *, size_t, SignerIdentifier *, size_t *);\nvoid   free_SignerIdentifier  (SignerIdentifier *);\nsize_t length_SignerIdentifier(const SignerIdentifier *);\nint    copy_SignerIdentifier  (const SignerIdentifier *, SignerIdentifier *);\n\n\n/*\nRecipientIdentifier ::= CMSIdentifier\n*/\n\ntypedef CMSIdentifier RecipientIdentifier;\n\nint    encode_RecipientIdentifier(unsigned char *, size_t, const RecipientIdentifier *, size_t *);\nint    decode_RecipientIdentifier(const unsigned char *, size_t, RecipientIdentifier *, size_t *);\nvoid   free_RecipientIdentifier  (RecipientIdentifier *);\nsize_t length_RecipientIdentifier(const RecipientIdentifier *);\nint    copy_RecipientIdentifier  (const RecipientIdentifier *, RecipientIdentifier *);\n\n\n/*\nCMSAttributes ::= SET OF Attribute\n*/\n\ntypedef struct CMSAttributes {\n  unsigned int len;\n  Attribute *val;\n} CMSAttributes;\n\nint    encode_CMSAttributes(unsigned char *, size_t, const CMSAttributes *, size_t *);\nint    decode_CMSAttributes(const unsigned char *, size_t, CMSAttributes *, size_t *);\nvoid   free_CMSAttributes  (CMSAttributes *);\nsize_t length_CMSAttributes(const CMSAttributes *);\nint    copy_CMSAttributes  (const CMSAttributes *, CMSAttributes *);\n\n\n/*\nSignatureValue ::= OCTET STRING\n*/\n\ntypedef heim_octet_string SignatureValue;\n\nint    encode_SignatureValue(unsigned char *, size_t, const SignatureValue *, size_t *);\nint    decode_SignatureValue(const unsigned char *, size_t, SignatureValue *, size_t *);\nvoid   free_SignatureValue  (SignatureValue *);\nsize_t length_SignatureValue(const SignatureValue *);\nint    copy_SignatureValue  (const SignatureValue *, SignatureValue *);\n\n\n/*\nSignerInfo ::= SEQUENCE {\n  version              CMSVersion,\n  sid                  SignerIdentifier,\n  digestAlgorithm      DigestAlgorithmIdentifier,\n  signedAttrs          [0] IMPLICIT SET OF Attribute OPTIONAL,\n  signatureAlgorithm   SignatureAlgorithmIdentifier,\n  signature            SignatureValue,\n  unsignedAttrs        [1] IMPLICIT SET OF Attribute OPTIONAL,\n}\n*/\n\ntypedef struct SignerInfo {\n  CMSVersion version;\n  SignerIdentifier sid;\n  DigestAlgorithmIdentifier digestAlgorithm;\n  struct  {\n    unsigned int len;\n    Attribute *val;\n  } *signedAttrs;\n  SignatureAlgorithmIdentifier signatureAlgorithm;\n  SignatureValue signature;\n  struct  {\n    unsigned int len;\n    Attribute *val;\n  } *unsignedAttrs;\n} SignerInfo;\n\nint    encode_SignerInfo(unsigned char *, size_t, const SignerInfo *, size_t *);\nint    decode_SignerInfo(const unsigned char *, size_t, SignerInfo *, size_t *);\nvoid   free_SignerInfo  (SignerInfo *);\nsize_t length_SignerInfo(const SignerInfo *);\nint    copy_SignerInfo  (const SignerInfo *, SignerInfo *);\n\n\n/*\nSignerInfos ::= SET OF SignerInfo\n*/\n\ntypedef struct SignerInfos {\n  unsigned int len;\n  SignerInfo *val;\n} SignerInfos;\n\nint    encode_SignerInfos(unsigned char *, size_t, const SignerInfos *, size_t *);\nint    decode_SignerInfos(const unsigned char *, size_t, SignerInfos *, size_t *);\nvoid   free_SignerInfos  (SignerInfos *);\nsize_t length_SignerInfos(const SignerInfos *);\nint    copy_SignerInfos  (const SignerInfos *, SignerInfos *);\n\n\n/*\nSignedData ::= SEQUENCE {\n  version            CMSVersion,\n  digestAlgorithms   DigestAlgorithmIdentifiers,\n  encapContentInfo   EncapsulatedContentInfo,\n  certificates       [0] IMPLICIT SET OF heim_any OPTIONAL,\n  crls               [1] IMPLICIT heim_any OPTIONAL,\n  signerInfos        SignerInfos,\n}\n*/\n\ntypedef struct SignedData {\n  CMSVersion version;\n  DigestAlgorithmIdentifiers digestAlgorithms;\n  EncapsulatedContentInfo encapContentInfo;\n  struct  {\n    unsigned int len;\n    heim_any *val;\n  } *certificates;\n  heim_any *crls;\n  SignerInfos signerInfos;\n} SignedData;\n\nint    encode_SignedData(unsigned char *, size_t, const SignedData *, size_t *);\nint    decode_SignedData(const unsigned char *, size_t, SignedData *, size_t *);\nvoid   free_SignedData  (SignedData *);\nsize_t length_SignedData(const SignedData *);\nint    copy_SignedData  (const SignedData *, SignedData *);\n\n\n/*\nOriginatorInfo ::= SEQUENCE {\n  certs           [0] IMPLICIT SET OF heim_any OPTIONAL,\n  crls            [1] IMPLICIT heim_any OPTIONAL,\n}\n*/\n\ntypedef struct OriginatorInfo {\n  struct  {\n    unsigned int len;\n    heim_any *val;\n  } *certs;\n  heim_any *crls;\n} OriginatorInfo;\n\nint    encode_OriginatorInfo(unsigned char *, size_t, const OriginatorInfo *, size_t *);\nint    decode_OriginatorInfo(const unsigned char *, size_t, OriginatorInfo *, size_t *);\nvoid   free_OriginatorInfo  (OriginatorInfo *);\nsize_t length_OriginatorInfo(const OriginatorInfo *);\nint    copy_OriginatorInfo  (const OriginatorInfo *, OriginatorInfo *);\n\n\n/*\nKeyEncryptionAlgorithmIdentifier ::= AlgorithmIdentifier\n*/\n\ntypedef AlgorithmIdentifier KeyEncryptionAlgorithmIdentifier;\n\nint    encode_KeyEncryptionAlgorithmIdentifier(unsigned char *, size_t, const KeyEncryptionAlgorithmIdentifier *, size_t *);\nint    decode_KeyEncryptionAlgorithmIdentifier(const unsigned char *, size_t, KeyEncryptionAlgorithmIdentifier *, size_t *);\nvoid   free_KeyEncryptionAlgorithmIdentifier  (KeyEncryptionAlgorithmIdentifier *);\nsize_t length_KeyEncryptionAlgorithmIdentifier(const KeyEncryptionAlgorithmIdentifier *);\nint    copy_KeyEncryptionAlgorithmIdentifier  (const KeyEncryptionAlgorithmIdentifier *, KeyEncryptionAlgorithmIdentifier *);\n\n\n/*\nContentEncryptionAlgorithmIdentifier ::= AlgorithmIdentifier\n*/\n\ntypedef AlgorithmIdentifier ContentEncryptionAlgorithmIdentifier;\n\nint    encode_ContentEncryptionAlgorithmIdentifier(unsigned char *, size_t, const ContentEncryptionAlgorithmIdentifier *, size_t *);\nint    decode_ContentEncryptionAlgorithmIdentifier(const unsigned char *, size_t, ContentEncryptionAlgorithmIdentifier *, size_t *);\nvoid   free_ContentEncryptionAlgorithmIdentifier  (ContentEncryptionAlgorithmIdentifier *);\nsize_t length_ContentEncryptionAlgorithmIdentifier(const ContentEncryptionAlgorithmIdentifier *);\nint    copy_ContentEncryptionAlgorithmIdentifier  (const ContentEncryptionAlgorithmIdentifier *, ContentEncryptionAlgorithmIdentifier *);\n\n\n/*\nEncryptedKey ::= OCTET STRING\n*/\n\ntypedef heim_octet_string EncryptedKey;\n\nint    encode_EncryptedKey(unsigned char *, size_t, const EncryptedKey *, size_t *);\nint    decode_EncryptedKey(const unsigned char *, size_t, EncryptedKey *, size_t *);\nvoid   free_EncryptedKey  (EncryptedKey *);\nsize_t length_EncryptedKey(const EncryptedKey *);\nint    copy_EncryptedKey  (const EncryptedKey *, EncryptedKey *);\n\n\n/*\nKeyTransRecipientInfo ::= SEQUENCE {\n  version                  CMSVersion,\n  rid                      RecipientIdentifier,\n  keyEncryptionAlgorithm   KeyEncryptionAlgorithmIdentifier,\n  encryptedKey             EncryptedKey,\n}\n*/\n\ntypedef struct KeyTransRecipientInfo {\n  CMSVersion version;\n  RecipientIdentifier rid;\n  KeyEncryptionAlgorithmIdentifier keyEncryptionAlgorithm;\n  EncryptedKey encryptedKey;\n} KeyTransRecipientInfo;\n\nint    encode_KeyTransRecipientInfo(unsigned char *, size_t, const KeyTransRecipientInfo *, size_t *);\nint    decode_KeyTransRecipientInfo(const unsigned char *, size_t, KeyTransRecipientInfo *, size_t *);\nvoid   free_KeyTransRecipientInfo  (KeyTransRecipientInfo *);\nsize_t length_KeyTransRecipientInfo(const KeyTransRecipientInfo *);\nint    copy_KeyTransRecipientInfo  (const KeyTransRecipientInfo *, KeyTransRecipientInfo *);\n\n\n/*\nRecipientInfo ::= KeyTransRecipientInfo\n*/\n\ntypedef KeyTransRecipientInfo RecipientInfo;\n\nint    encode_RecipientInfo(unsigned char *, size_t, const RecipientInfo *, size_t *);\nint    decode_RecipientInfo(const unsigned char *, size_t, RecipientInfo *, size_t *);\nvoid   free_RecipientInfo  (RecipientInfo *);\nsize_t length_RecipientInfo(const RecipientInfo *);\nint    copy_RecipientInfo  (const RecipientInfo *, RecipientInfo *);\n\n\n/*\nRecipientInfos ::= SET OF RecipientInfo\n*/\n\ntypedef struct RecipientInfos {\n  unsigned int len;\n  RecipientInfo *val;\n} RecipientInfos;\n\nint    encode_RecipientInfos(unsigned char *, size_t, const RecipientInfos *, size_t *);\nint    decode_RecipientInfos(const unsigned char *, size_t, RecipientInfos *, size_t *);\nvoid   free_RecipientInfos  (RecipientInfos *);\nsize_t length_RecipientInfos(const RecipientInfos *);\nint    copy_RecipientInfos  (const RecipientInfos *, RecipientInfos *);\n\n\n/*\nEncryptedContent ::= OCTET STRING\n*/\n\ntypedef heim_octet_string EncryptedContent;\n\nint    encode_EncryptedContent(unsigned char *, size_t, const EncryptedContent *, size_t *);\nint    decode_EncryptedContent(const unsigned char *, size_t, EncryptedContent *, size_t *);\nvoid   free_EncryptedContent  (EncryptedContent *);\nsize_t length_EncryptedContent(const EncryptedContent *);\nint    copy_EncryptedContent  (const EncryptedContent *, EncryptedContent *);\n\n\n/*\nEncryptedContentInfo ::= SEQUENCE {\n  contentType                  ContentType,\n  contentEncryptionAlgorithm   ContentEncryptionAlgorithmIdentifier,\n  encryptedContent             [0] IMPLICIT OCTET STRING OPTIONAL,\n}\n*/\n\ntypedef struct EncryptedContentInfo {\n  ContentType contentType;\n  ContentEncryptionAlgorithmIdentifier contentEncryptionAlgorithm;\n  heim_octet_string *encryptedContent;\n} EncryptedContentInfo;\n\nint    encode_EncryptedContentInfo(unsigned char *, size_t, const EncryptedContentInfo *, size_t *);\nint    decode_EncryptedContentInfo(const unsigned char *, size_t, EncryptedContentInfo *, size_t *);\nvoid   free_EncryptedContentInfo  (EncryptedContentInfo *);\nsize_t length_EncryptedContentInfo(const EncryptedContentInfo *);\nint    copy_EncryptedContentInfo  (const EncryptedContentInfo *, EncryptedContentInfo *);\n\n\n/*\nUnprotectedAttributes ::= SET OF Attribute\n*/\n\ntypedef struct UnprotectedAttributes {\n  unsigned int len;\n  Attribute *val;\n} UnprotectedAttributes;\n\nint    encode_UnprotectedAttributes(unsigned char *, size_t, const UnprotectedAttributes *, size_t *);\nint    decode_UnprotectedAttributes(const unsigned char *, size_t, UnprotectedAttributes *, size_t *);\nvoid   free_UnprotectedAttributes  (UnprotectedAttributes *);\nsize_t length_UnprotectedAttributes(const UnprotectedAttributes *);\nint    copy_UnprotectedAttributes  (const UnprotectedAttributes *, UnprotectedAttributes *);\n\n\n/*\nCMSEncryptedData ::= SEQUENCE {\n  version                CMSVersion,\n  encryptedContentInfo   EncryptedContentInfo,\n  unprotectedAttrs       [1] IMPLICIT heim_any OPTIONAL,\n}\n*/\n\ntypedef struct CMSEncryptedData {\n  CMSVersion version;\n  EncryptedContentInfo encryptedContentInfo;\n  heim_any *unprotectedAttrs;\n} CMSEncryptedData;\n\nint    encode_CMSEncryptedData(unsigned char *, size_t, const CMSEncryptedData *, size_t *);\nint    decode_CMSEncryptedData(const unsigned char *, size_t, CMSEncryptedData *, size_t *);\nvoid   free_CMSEncryptedData  (CMSEncryptedData *);\nsize_t length_CMSEncryptedData(const CMSEncryptedData *);\nint    copy_CMSEncryptedData  (const CMSEncryptedData *, CMSEncryptedData *);\n\n\n/*\nEnvelopedData ::= SEQUENCE {\n  version                CMSVersion,\n  originatorInfo         [0] IMPLICIT heim_any OPTIONAL,\n  recipientInfos         RecipientInfos,\n  encryptedContentInfo   EncryptedContentInfo,\n  unprotectedAttrs       [1] IMPLICIT heim_any OPTIONAL,\n}\n*/\n\ntypedef struct EnvelopedData {\n  CMSVersion version;\n  heim_any *originatorInfo;\n  RecipientInfos recipientInfos;\n  EncryptedContentInfo encryptedContentInfo;\n  heim_any *unprotectedAttrs;\n} EnvelopedData;\n\nint    encode_EnvelopedData(unsigned char *, size_t, const EnvelopedData *, size_t *);\nint    decode_EnvelopedData(const unsigned char *, size_t, EnvelopedData *, size_t *);\nvoid   free_EnvelopedData  (EnvelopedData *);\nsize_t length_EnvelopedData(const EnvelopedData *);\nint    copy_EnvelopedData  (const EnvelopedData *, EnvelopedData *);\n\n\n/*\nCMSRC2CBCParameter ::= SEQUENCE {\n  rc2ParameterVersion   INTEGER (0..-1),\n  iv                    OCTET STRING,\n}\n*/\n\ntypedef struct CMSRC2CBCParameter {\n  unsigned int rc2ParameterVersion;\n  heim_octet_string iv;\n} CMSRC2CBCParameter;\n\nint    encode_CMSRC2CBCParameter(unsigned char *, size_t, const CMSRC2CBCParameter *, size_t *);\nint    decode_CMSRC2CBCParameter(const unsigned char *, size_t, CMSRC2CBCParameter *, size_t *);\nvoid   free_CMSRC2CBCParameter  (CMSRC2CBCParameter *);\nsize_t length_CMSRC2CBCParameter(const CMSRC2CBCParameter *);\nint    copy_CMSRC2CBCParameter  (const CMSRC2CBCParameter *, CMSRC2CBCParameter *);\n\n\n/*\nCMSCBCParameter ::= OCTET STRING\n*/\n\ntypedef heim_octet_string CMSCBCParameter;\n\nint    encode_CMSCBCParameter(unsigned char *, size_t, const CMSCBCParameter *, size_t *);\nint    decode_CMSCBCParameter(const unsigned char *, size_t, CMSCBCParameter *, size_t *);\nvoid   free_CMSCBCParameter  (CMSCBCParameter *);\nsize_t length_CMSCBCParameter(const CMSCBCParameter *);\nint    copy_CMSCBCParameter  (const CMSCBCParameter *, CMSCBCParameter *);\n\n\n#endif /* __cms_asn1_h__ */\n"
  },
  {
    "path": "freebsd-headers/com_err.h",
    "content": "/*\n * Copyright (c) 1997 - 2001 Kungliga Tekniska Hgskolan\n * (Royal Institute of Technology, Stockholm, Sweden). \n * All rights reserved. \n *\n * Redistribution and use in source and binary forms, with or without \n * modification, are permitted provided that the following conditions \n * are met: \n *\n * 1. Redistributions of source code must retain the above copyright \n *    notice, this list of conditions and the following disclaimer. \n *\n * 2. Redistributions in binary form must reproduce the above copyright \n *    notice, this list of conditions and the following disclaimer in the \n *    documentation and/or other materials provided with the distribution. \n *\n * 3. Neither the name of the Institute nor the names of its contributors \n *    may be used to endorse or promote products derived from this software \n *    without specific prior written permission. \n *\n * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND \n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE \n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE \n * ARE DISCLAIMED.  IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE \n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL \n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS \n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) \n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT \n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY \n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF \n * SUCH DAMAGE. \n */\n\n/* $FreeBSD: release/9.0.0/contrib/com_err/com_err.h 178846 2008-05-08 11:01:46Z dfr $ */\n/* $Id: com_err.h 15566 2005-07-07 14:58:07Z lha $ */\n\n/* MIT compatible com_err library */\n\n#ifndef __COM_ERR_H__\n#define __COM_ERR_H__\n\n#include <sys/cdefs.h>\n#include <stdarg.h>\n\n#include <com_right.h>\n#include <stdarg.h>\n\ntypedef void (*errf) __P((const char *, long, const char *, va_list));\n\nconst char * error_message (long);\nint init_error_table (const char**, long, int);\n\nvoid com_err_va __P((const char *, long, const char *, va_list))\n    __printflike(3, 0);\n\nvoid com_err __P((const char *, long, const char *, ...))\n    __printflike(3, 4);\n\nerrf set_com_err_hook (errf);\nerrf reset_com_err_hook (void);\n\nconst char *error_table_name  (int num);\n\nvoid add_to_error_table (struct et_list *new_table);\n\n#endif /* __COM_ERR_H__ */\n"
  },
  {
    "path": "freebsd-headers/com_right.h",
    "content": "/*\n * Copyright (c) 1997 - 2000 Kungliga Tekniska Hgskolan\n * (Royal Institute of Technology, Stockholm, Sweden). \n * All rights reserved. \n *\n * Redistribution and use in source and binary forms, with or without \n * modification, are permitted provided that the following conditions \n * are met: \n *\n * 1. Redistributions of source code must retain the above copyright \n *    notice, this list of conditions and the following disclaimer. \n *\n * 2. Redistributions in binary form must reproduce the above copyright \n *    notice, this list of conditions and the following disclaimer in the \n *    documentation and/or other materials provided with the distribution. \n *\n * 3. Neither the name of the Institute nor the names of its contributors \n *    may be used to endorse or promote products derived from this software \n *    without specific prior written permission. \n *\n * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND \n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE \n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE \n * ARE DISCLAIMED.  IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE \n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL \n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS \n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) \n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT \n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY \n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF \n * SUCH DAMAGE. \n */\n\n/* $Id: com_right.h 14551 2005-02-03 08:45:13Z lha $ */\n/* $FreeBSD: release/9.0.0/contrib/com_err/com_right.h 178846 2008-05-08 11:01:46Z dfr $ */\n\n#ifndef __COM_RIGHT_H__\n#define __COM_RIGHT_H__\n\n#include <sys/cdefs.h>\n#include <stdarg.h>\n\nstruct error_table {\n    char const * const * msgs;\n    long base;\n    int n_msgs;\n};\nstruct et_list {\n    struct et_list *next;\n    struct error_table *table;\n};\nextern struct et_list *_et_list;\n\nconst char *com_right (struct et_list *list, long code);\nvoid initialize_error_table_r (struct et_list **, const char **, int, long);\nvoid free_error_table (struct et_list *);\n\n#endif /* __COM_RIGHT_H__ */\n"
  },
  {
    "path": "freebsd-headers/complex.h",
    "content": "/*-\n * Copyright (c) 2001-2008 The FreeBSD Project.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/include/complex.h 219379 2011-03-07 16:05:45Z das $\n */\n\n#ifndef _COMPLEX_H\n#define\t_COMPLEX_H\n\n#ifdef __GNUC__\n#if __STDC_VERSION__ < 199901\n#define\t_Complex\t__complex__\n#endif\n#define\t_Complex_I\t1.0fi\n#endif\n\n#define\tcomplex\t\t_Complex\n#define\tI\t\t_Complex_I\n\n#include <sys/cdefs.h>\n\n__BEGIN_DECLS\n\ndouble\t\tcabs(double complex);\nfloat\t\tcabsf(float complex);\nlong double\tcabsl(long double complex);\ndouble\t\tcarg(double complex);\nfloat\t\tcargf(float complex);\nlong double\tcargl(long double complex);\ndouble complex\tcexp(double complex);\nfloat complex\tcexpf(float complex);\ndouble\t\tcimag(double complex) __pure2;\nfloat\t\tcimagf(float complex) __pure2;\nlong double\tcimagl(long double complex) __pure2;\ndouble complex\tconj(double complex) __pure2;\nfloat complex\tconjf(float complex) __pure2;\nlong double complex\n\t\tconjl(long double complex) __pure2;\nfloat complex\tcprojf(float complex) __pure2;\ndouble complex\tcproj(double complex) __pure2;\nlong double complex\n\t\tcprojl(long double complex) __pure2;\ndouble\t\tcreal(double complex) __pure2;\nfloat\t\tcrealf(float complex) __pure2;\nlong double\tcreall(long double complex) __pure2;\ndouble complex\tcsqrt(double complex);\nfloat complex\tcsqrtf(float complex);\nlong double complex\n\t\tcsqrtl(long double complex);\n\n__END_DECLS\n\n#endif /* _COMPLEX_H */\n"
  },
  {
    "path": "freebsd-headers/cpio.h",
    "content": "/*-\n * Copyright (c) 2002 Mike Barcroft <mike@FreeBSD.org>\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/include/cpio.h 101138 2002-08-01 07:18:38Z mike $\n */\n\n#ifndef _CPIO_H_\n#define\t_CPIO_H_\n\n#define\tC_ISSOCK 0140000\t/* Socket. */\n#define\tC_ISLNK\t0120000\t\t/* Symbolic link. */\n#define\tC_ISCTG\t0110000\t\t/* Reserved. */\n#define\tC_ISREG\t0100000\t\t/* Regular file. */\n#define\tC_ISBLK\t0060000\t\t/* Block special. */\n#define\tC_ISDIR\t0040000\t\t/* Directory. */\n#define\tC_ISCHR\t0020000\t\t/* Character special. */\n#define\tC_ISFIFO 0010000\t/* FIFO. */\n#define\tC_ISUID\t0004000\t\t/* Set user ID. */\n#define\tC_ISGID\t0002000\t\t/* Set group ID. */\n#define\tC_ISVTX\t0001000\t\t/* On directories, restricted deletion flag. */\n#define\tC_IRUSR\t0000400\t\t/* Read by owner. */\n#define\tC_IWUSR\t0000200\t\t/* Write by owner. */\n#define\tC_IXUSR\t0000100\t\t/* Execute by owner. */\n#define\tC_IRGRP\t0000040\t\t/* Read by group. */\n#define\tC_IWGRP\t0000020\t\t/* Write by group. */\n#define\tC_IXGRP\t0000010\t\t/* Execute by group. */\n#define\tC_IROTH\t0000004\t\t/* Read by others. */\n#define\tC_IWOTH\t0000002\t\t/* Write by others. */\n#define\tC_IXOTH\t0000001\t\t/* Execute by others. */\n\n#define\tMAGIC\t\"070707\"\n\n#endif /* _CPIO_H_ */\n"
  },
  {
    "path": "freebsd-headers/crypto/cast.h",
    "content": "/*\t$FreeBSD: release/9.0.0/sys/opencrypto/cast.h 139825 2005-01-07 02:29:27Z imp $\t*/\n/*      $OpenBSD: cast.h,v 1.2 2002/03/14 01:26:51 millert Exp $       */\n\n/*-\n *\tCAST-128 in C\n *\tWritten by Steve Reid <sreid@sea-to-sky.net>\n *\t100% Public Domain - no warranty\n *\tReleased 1997.10.11\n */\n\n#ifndef _CAST_H_\n#define _CAST_H_\n\ntypedef struct {\n\tu_int32_t\txkey[32];\t/* Key, after expansion */\n\tint\t\trounds;\t\t/* Number of rounds to use, 12 or 16 */\n} cast_key;\n\nvoid cast_setkey(cast_key * key, u_int8_t * rawkey, int keybytes);\nvoid cast_encrypt(cast_key * key, u_int8_t * inblock, u_int8_t * outblock);\nvoid cast_decrypt(cast_key * key, u_int8_t * inblock, u_int8_t * outblock);\n\n#endif /* ifndef _CAST_H_ */\n"
  },
  {
    "path": "freebsd-headers/crypto/castsb.h",
    "content": "/*\t$FreeBSD: release/9.0.0/sys/opencrypto/castsb.h 139825 2005-01-07 02:29:27Z imp $\t*/\n/*      $OpenBSD: castsb.h,v 1.1 2000/02/28 23:13:04 deraadt Exp $       */\n/*-\n *\tCAST-128 in C\n *\tWritten by Steve Reid <sreid@sea-to-sky.net>\n *\t100% Public Domain - no warranty\n *\tReleased 1997.10.11\n */\n\nstatic const u_int32_t cast_sbox1[256] = {\n\t0x30FB40D4, 0x9FA0FF0B, 0x6BECCD2F, 0x3F258C7A,\n\t0x1E213F2F, 0x9C004DD3, 0x6003E540, 0xCF9FC949,\n\t0xBFD4AF27, 0x88BBBDB5, 0xE2034090, 0x98D09675,\n\t0x6E63A0E0, 0x15C361D2, 0xC2E7661D, 0x22D4FF8E,\n\t0x28683B6F, 0xC07FD059, 0xFF2379C8, 0x775F50E2,\n\t0x43C340D3, 0xDF2F8656, 0x887CA41A, 0xA2D2BD2D,\n\t0xA1C9E0D6, 0x346C4819, 0x61B76D87, 0x22540F2F,\n\t0x2ABE32E1, 0xAA54166B, 0x22568E3A, 0xA2D341D0,\n\t0x66DB40C8, 0xA784392F, 0x004DFF2F, 0x2DB9D2DE,\n\t0x97943FAC, 0x4A97C1D8, 0x527644B7, 0xB5F437A7,\n\t0xB82CBAEF, 0xD751D159, 0x6FF7F0ED, 0x5A097A1F,\n\t0x827B68D0, 0x90ECF52E, 0x22B0C054, 0xBC8E5935,\n\t0x4B6D2F7F, 0x50BB64A2, 0xD2664910, 0xBEE5812D,\n\t0xB7332290, 0xE93B159F, 0xB48EE411, 0x4BFF345D,\n\t0xFD45C240, 0xAD31973F, 0xC4F6D02E, 0x55FC8165,\n\t0xD5B1CAAD, 0xA1AC2DAE, 0xA2D4B76D, 0xC19B0C50,\n\t0x882240F2, 0x0C6E4F38, 0xA4E4BFD7, 0x4F5BA272,\n\t0x564C1D2F, 0xC59C5319, 0xB949E354, 0xB04669FE,\n\t0xB1B6AB8A, 0xC71358DD, 0x6385C545, 0x110F935D,\n\t0x57538AD5, 0x6A390493, 0xE63D37E0, 0x2A54F6B3,\n\t0x3A787D5F, 0x6276A0B5, 0x19A6FCDF, 0x7A42206A,\n\t0x29F9D4D5, 0xF61B1891, 0xBB72275E, 0xAA508167,\n\t0x38901091, 0xC6B505EB, 0x84C7CB8C, 0x2AD75A0F,\n\t0x874A1427, 0xA2D1936B, 0x2AD286AF, 0xAA56D291,\n\t0xD7894360, 0x425C750D, 0x93B39E26, 0x187184C9,\n\t0x6C00B32D, 0x73E2BB14, 0xA0BEBC3C, 0x54623779,\n\t0x64459EAB, 0x3F328B82, 0x7718CF82, 0x59A2CEA6,\n\t0x04EE002E, 0x89FE78E6, 0x3FAB0950, 0x325FF6C2,\n\t0x81383F05, 0x6963C5C8, 0x76CB5AD6, 0xD49974C9,\n\t0xCA180DCF, 0x380782D5, 0xC7FA5CF6, 0x8AC31511,\n\t0x35E79E13, 0x47DA91D0, 0xF40F9086, 0xA7E2419E,\n\t0x31366241, 0x051EF495, 0xAA573B04, 0x4A805D8D,\n\t0x548300D0, 0x00322A3C, 0xBF64CDDF, 0xBA57A68E,\n\t0x75C6372B, 0x50AFD341, 0xA7C13275, 0x915A0BF5,\n\t0x6B54BFAB, 0x2B0B1426, 0xAB4CC9D7, 0x449CCD82,\n\t0xF7FBF265, 0xAB85C5F3, 0x1B55DB94, 0xAAD4E324,\n\t0xCFA4BD3F, 0x2DEAA3E2, 0x9E204D02, 0xC8BD25AC,\n\t0xEADF55B3, 0xD5BD9E98, 0xE31231B2, 0x2AD5AD6C,\n\t0x954329DE, 0xADBE4528, 0xD8710F69, 0xAA51C90F,\n\t0xAA786BF6, 0x22513F1E, 0xAA51A79B, 0x2AD344CC,\n\t0x7B5A41F0, 0xD37CFBAD, 0x1B069505, 0x41ECE491,\n\t0xB4C332E6, 0x032268D4, 0xC9600ACC, 0xCE387E6D,\n\t0xBF6BB16C, 0x6A70FB78, 0x0D03D9C9, 0xD4DF39DE,\n\t0xE01063DA, 0x4736F464, 0x5AD328D8, 0xB347CC96,\n\t0x75BB0FC3, 0x98511BFB, 0x4FFBCC35, 0xB58BCF6A,\n\t0xE11F0ABC, 0xBFC5FE4A, 0xA70AEC10, 0xAC39570A,\n\t0x3F04442F, 0x6188B153, 0xE0397A2E, 0x5727CB79,\n\t0x9CEB418F, 0x1CACD68D, 0x2AD37C96, 0x0175CB9D,\n\t0xC69DFF09, 0xC75B65F0, 0xD9DB40D8, 0xEC0E7779,\n\t0x4744EAD4, 0xB11C3274, 0xDD24CB9E, 0x7E1C54BD,\n\t0xF01144F9, 0xD2240EB1, 0x9675B3FD, 0xA3AC3755,\n\t0xD47C27AF, 0x51C85F4D, 0x56907596, 0xA5BB15E6,\n\t0x580304F0, 0xCA042CF1, 0x011A37EA, 0x8DBFAADB,\n\t0x35BA3E4A, 0x3526FFA0, 0xC37B4D09, 0xBC306ED9,\n\t0x98A52666, 0x5648F725, 0xFF5E569D, 0x0CED63D0,\n\t0x7C63B2CF, 0x700B45E1, 0xD5EA50F1, 0x85A92872,\n\t0xAF1FBDA7, 0xD4234870, 0xA7870BF3, 0x2D3B4D79,\n\t0x42E04198, 0x0CD0EDE7, 0x26470DB8, 0xF881814C,\n\t0x474D6AD7, 0x7C0C5E5C, 0xD1231959, 0x381B7298,\n\t0xF5D2F4DB, 0xAB838653, 0x6E2F1E23, 0x83719C9E,\n\t0xBD91E046, 0x9A56456E, 0xDC39200C, 0x20C8C571,\n\t0x962BDA1C, 0xE1E696FF, 0xB141AB08, 0x7CCA89B9,\n\t0x1A69E783, 0x02CC4843, 0xA2F7C579, 0x429EF47D,\n\t0x427B169C, 0x5AC9F049, 0xDD8F0F00, 0x5C8165BF\n};\n\nstatic const u_int32_t cast_sbox2[256] = {\n\t0x1F201094, 0xEF0BA75B, 0x69E3CF7E, 0x393F4380,\n\t0xFE61CF7A, 0xEEC5207A, 0x55889C94, 0x72FC0651,\n\t0xADA7EF79, 0x4E1D7235, 0xD55A63CE, 0xDE0436BA,\n\t0x99C430EF, 0x5F0C0794, 0x18DCDB7D, 0xA1D6EFF3,\n\t0xA0B52F7B, 0x59E83605, 0xEE15B094, 0xE9FFD909,\n\t0xDC440086, 0xEF944459, 0xBA83CCB3, 0xE0C3CDFB,\n\t0xD1DA4181, 0x3B092AB1, 0xF997F1C1, 0xA5E6CF7B,\n\t0x01420DDB, 0xE4E7EF5B, 0x25A1FF41, 0xE180F806,\n\t0x1FC41080, 0x179BEE7A, 0xD37AC6A9, 0xFE5830A4,\n\t0x98DE8B7F, 0x77E83F4E, 0x79929269, 0x24FA9F7B,\n\t0xE113C85B, 0xACC40083, 0xD7503525, 0xF7EA615F,\n\t0x62143154, 0x0D554B63, 0x5D681121, 0xC866C359,\n\t0x3D63CF73, 0xCEE234C0, 0xD4D87E87, 0x5C672B21,\n\t0x071F6181, 0x39F7627F, 0x361E3084, 0xE4EB573B,\n\t0x602F64A4, 0xD63ACD9C, 0x1BBC4635, 0x9E81032D,\n\t0x2701F50C, 0x99847AB4, 0xA0E3DF79, 0xBA6CF38C,\n\t0x10843094, 0x2537A95E, 0xF46F6FFE, 0xA1FF3B1F,\n\t0x208CFB6A, 0x8F458C74, 0xD9E0A227, 0x4EC73A34,\n\t0xFC884F69, 0x3E4DE8DF, 0xEF0E0088, 0x3559648D,\n\t0x8A45388C, 0x1D804366, 0x721D9BFD, 0xA58684BB,\n\t0xE8256333, 0x844E8212, 0x128D8098, 0xFED33FB4,\n\t0xCE280AE1, 0x27E19BA5, 0xD5A6C252, 0xE49754BD,\n\t0xC5D655DD, 0xEB667064, 0x77840B4D, 0xA1B6A801,\n\t0x84DB26A9, 0xE0B56714, 0x21F043B7, 0xE5D05860,\n\t0x54F03084, 0x066FF472, 0xA31AA153, 0xDADC4755,\n\t0xB5625DBF, 0x68561BE6, 0x83CA6B94, 0x2D6ED23B,\n\t0xECCF01DB, 0xA6D3D0BA, 0xB6803D5C, 0xAF77A709,\n\t0x33B4A34C, 0x397BC8D6, 0x5EE22B95, 0x5F0E5304,\n\t0x81ED6F61, 0x20E74364, 0xB45E1378, 0xDE18639B,\n\t0x881CA122, 0xB96726D1, 0x8049A7E8, 0x22B7DA7B,\n\t0x5E552D25, 0x5272D237, 0x79D2951C, 0xC60D894C,\n\t0x488CB402, 0x1BA4FE5B, 0xA4B09F6B, 0x1CA815CF,\n\t0xA20C3005, 0x8871DF63, 0xB9DE2FCB, 0x0CC6C9E9,\n\t0x0BEEFF53, 0xE3214517, 0xB4542835, 0x9F63293C,\n\t0xEE41E729, 0x6E1D2D7C, 0x50045286, 0x1E6685F3,\n\t0xF33401C6, 0x30A22C95, 0x31A70850, 0x60930F13,\n\t0x73F98417, 0xA1269859, 0xEC645C44, 0x52C877A9,\n\t0xCDFF33A6, 0xA02B1741, 0x7CBAD9A2, 0x2180036F,\n\t0x50D99C08, 0xCB3F4861, 0xC26BD765, 0x64A3F6AB,\n\t0x80342676, 0x25A75E7B, 0xE4E6D1FC, 0x20C710E6,\n\t0xCDF0B680, 0x17844D3B, 0x31EEF84D, 0x7E0824E4,\n\t0x2CCB49EB, 0x846A3BAE, 0x8FF77888, 0xEE5D60F6,\n\t0x7AF75673, 0x2FDD5CDB, 0xA11631C1, 0x30F66F43,\n\t0xB3FAEC54, 0x157FD7FA, 0xEF8579CC, 0xD152DE58,\n\t0xDB2FFD5E, 0x8F32CE19, 0x306AF97A, 0x02F03EF8,\n\t0x99319AD5, 0xC242FA0F, 0xA7E3EBB0, 0xC68E4906,\n\t0xB8DA230C, 0x80823028, 0xDCDEF3C8, 0xD35FB171,\n\t0x088A1BC8, 0xBEC0C560, 0x61A3C9E8, 0xBCA8F54D,\n\t0xC72FEFFA, 0x22822E99, 0x82C570B4, 0xD8D94E89,\n\t0x8B1C34BC, 0x301E16E6, 0x273BE979, 0xB0FFEAA6,\n\t0x61D9B8C6, 0x00B24869, 0xB7FFCE3F, 0x08DC283B,\n\t0x43DAF65A, 0xF7E19798, 0x7619B72F, 0x8F1C9BA4,\n\t0xDC8637A0, 0x16A7D3B1, 0x9FC393B7, 0xA7136EEB,\n\t0xC6BCC63E, 0x1A513742, 0xEF6828BC, 0x520365D6,\n\t0x2D6A77AB, 0x3527ED4B, 0x821FD216, 0x095C6E2E,\n\t0xDB92F2FB, 0x5EEA29CB, 0x145892F5, 0x91584F7F,\n\t0x5483697B, 0x2667A8CC, 0x85196048, 0x8C4BACEA,\n\t0x833860D4, 0x0D23E0F9, 0x6C387E8A, 0x0AE6D249,\n\t0xB284600C, 0xD835731D, 0xDCB1C647, 0xAC4C56EA,\n\t0x3EBD81B3, 0x230EABB0, 0x6438BC87, 0xF0B5B1FA,\n\t0x8F5EA2B3, 0xFC184642, 0x0A036B7A, 0x4FB089BD,\n\t0x649DA589, 0xA345415E, 0x5C038323, 0x3E5D3BB9,\n\t0x43D79572, 0x7E6DD07C, 0x06DFDF1E, 0x6C6CC4EF,\n\t0x7160A539, 0x73BFBE70, 0x83877605, 0x4523ECF1\n};\n\nstatic const u_int32_t cast_sbox3[256] = {\n\t0x8DEFC240, 0x25FA5D9F, 0xEB903DBF, 0xE810C907,\n\t0x47607FFF, 0x369FE44B, 0x8C1FC644, 0xAECECA90,\n\t0xBEB1F9BF, 0xEEFBCAEA, 0xE8CF1950, 0x51DF07AE,\n\t0x920E8806, 0xF0AD0548, 0xE13C8D83, 0x927010D5,\n\t0x11107D9F, 0x07647DB9, 0xB2E3E4D4, 0x3D4F285E,\n\t0xB9AFA820, 0xFADE82E0, 0xA067268B, 0x8272792E,\n\t0x553FB2C0, 0x489AE22B, 0xD4EF9794, 0x125E3FBC,\n\t0x21FFFCEE, 0x825B1BFD, 0x9255C5ED, 0x1257A240,\n\t0x4E1A8302, 0xBAE07FFF, 0x528246E7, 0x8E57140E,\n\t0x3373F7BF, 0x8C9F8188, 0xA6FC4EE8, 0xC982B5A5,\n\t0xA8C01DB7, 0x579FC264, 0x67094F31, 0xF2BD3F5F,\n\t0x40FFF7C1, 0x1FB78DFC, 0x8E6BD2C1, 0x437BE59B,\n\t0x99B03DBF, 0xB5DBC64B, 0x638DC0E6, 0x55819D99,\n\t0xA197C81C, 0x4A012D6E, 0xC5884A28, 0xCCC36F71,\n\t0xB843C213, 0x6C0743F1, 0x8309893C, 0x0FEDDD5F,\n\t0x2F7FE850, 0xD7C07F7E, 0x02507FBF, 0x5AFB9A04,\n\t0xA747D2D0, 0x1651192E, 0xAF70BF3E, 0x58C31380,\n\t0x5F98302E, 0x727CC3C4, 0x0A0FB402, 0x0F7FEF82,\n\t0x8C96FDAD, 0x5D2C2AAE, 0x8EE99A49, 0x50DA88B8,\n\t0x8427F4A0, 0x1EAC5790, 0x796FB449, 0x8252DC15,\n\t0xEFBD7D9B, 0xA672597D, 0xADA840D8, 0x45F54504,\n\t0xFA5D7403, 0xE83EC305, 0x4F91751A, 0x925669C2,\n\t0x23EFE941, 0xA903F12E, 0x60270DF2, 0x0276E4B6,\n\t0x94FD6574, 0x927985B2, 0x8276DBCB, 0x02778176,\n\t0xF8AF918D, 0x4E48F79E, 0x8F616DDF, 0xE29D840E,\n\t0x842F7D83, 0x340CE5C8, 0x96BBB682, 0x93B4B148,\n\t0xEF303CAB, 0x984FAF28, 0x779FAF9B, 0x92DC560D,\n\t0x224D1E20, 0x8437AA88, 0x7D29DC96, 0x2756D3DC,\n\t0x8B907CEE, 0xB51FD240, 0xE7C07CE3, 0xE566B4A1,\n\t0xC3E9615E, 0x3CF8209D, 0x6094D1E3, 0xCD9CA341,\n\t0x5C76460E, 0x00EA983B, 0xD4D67881, 0xFD47572C,\n\t0xF76CEDD9, 0xBDA8229C, 0x127DADAA, 0x438A074E,\n\t0x1F97C090, 0x081BDB8A, 0x93A07EBE, 0xB938CA15,\n\t0x97B03CFF, 0x3DC2C0F8, 0x8D1AB2EC, 0x64380E51,\n\t0x68CC7BFB, 0xD90F2788, 0x12490181, 0x5DE5FFD4,\n\t0xDD7EF86A, 0x76A2E214, 0xB9A40368, 0x925D958F,\n\t0x4B39FFFA, 0xBA39AEE9, 0xA4FFD30B, 0xFAF7933B,\n\t0x6D498623, 0x193CBCFA, 0x27627545, 0x825CF47A,\n\t0x61BD8BA0, 0xD11E42D1, 0xCEAD04F4, 0x127EA392,\n\t0x10428DB7, 0x8272A972, 0x9270C4A8, 0x127DE50B,\n\t0x285BA1C8, 0x3C62F44F, 0x35C0EAA5, 0xE805D231,\n\t0x428929FB, 0xB4FCDF82, 0x4FB66A53, 0x0E7DC15B,\n\t0x1F081FAB, 0x108618AE, 0xFCFD086D, 0xF9FF2889,\n\t0x694BCC11, 0x236A5CAE, 0x12DECA4D, 0x2C3F8CC5,\n\t0xD2D02DFE, 0xF8EF5896, 0xE4CF52DA, 0x95155B67,\n\t0x494A488C, 0xB9B6A80C, 0x5C8F82BC, 0x89D36B45,\n\t0x3A609437, 0xEC00C9A9, 0x44715253, 0x0A874B49,\n\t0xD773BC40, 0x7C34671C, 0x02717EF6, 0x4FEB5536,\n\t0xA2D02FFF, 0xD2BF60C4, 0xD43F03C0, 0x50B4EF6D,\n\t0x07478CD1, 0x006E1888, 0xA2E53F55, 0xB9E6D4BC,\n\t0xA2048016, 0x97573833, 0xD7207D67, 0xDE0F8F3D,\n\t0x72F87B33, 0xABCC4F33, 0x7688C55D, 0x7B00A6B0,\n\t0x947B0001, 0x570075D2, 0xF9BB88F8, 0x8942019E,\n\t0x4264A5FF, 0x856302E0, 0x72DBD92B, 0xEE971B69,\n\t0x6EA22FDE, 0x5F08AE2B, 0xAF7A616D, 0xE5C98767,\n\t0xCF1FEBD2, 0x61EFC8C2, 0xF1AC2571, 0xCC8239C2,\n\t0x67214CB8, 0xB1E583D1, 0xB7DC3E62, 0x7F10BDCE,\n\t0xF90A5C38, 0x0FF0443D, 0x606E6DC6, 0x60543A49,\n\t0x5727C148, 0x2BE98A1D, 0x8AB41738, 0x20E1BE24,\n\t0xAF96DA0F, 0x68458425, 0x99833BE5, 0x600D457D,\n\t0x282F9350, 0x8334B362, 0xD91D1120, 0x2B6D8DA0,\n\t0x642B1E31, 0x9C305A00, 0x52BCE688, 0x1B03588A,\n\t0xF7BAEFD5, 0x4142ED9C, 0xA4315C11, 0x83323EC5,\n\t0xDFEF4636, 0xA133C501, 0xE9D3531C, 0xEE353783\n};\n\nstatic const u_int32_t cast_sbox4[256] = {\n\t0x9DB30420, 0x1FB6E9DE, 0xA7BE7BEF, 0xD273A298,\n\t0x4A4F7BDB, 0x64AD8C57, 0x85510443, 0xFA020ED1,\n\t0x7E287AFF, 0xE60FB663, 0x095F35A1, 0x79EBF120,\n\t0xFD059D43, 0x6497B7B1, 0xF3641F63, 0x241E4ADF,\n\t0x28147F5F, 0x4FA2B8CD, 0xC9430040, 0x0CC32220,\n\t0xFDD30B30, 0xC0A5374F, 0x1D2D00D9, 0x24147B15,\n\t0xEE4D111A, 0x0FCA5167, 0x71FF904C, 0x2D195FFE,\n\t0x1A05645F, 0x0C13FEFE, 0x081B08CA, 0x05170121,\n\t0x80530100, 0xE83E5EFE, 0xAC9AF4F8, 0x7FE72701,\n\t0xD2B8EE5F, 0x06DF4261, 0xBB9E9B8A, 0x7293EA25,\n\t0xCE84FFDF, 0xF5718801, 0x3DD64B04, 0xA26F263B,\n\t0x7ED48400, 0x547EEBE6, 0x446D4CA0, 0x6CF3D6F5,\n\t0x2649ABDF, 0xAEA0C7F5, 0x36338CC1, 0x503F7E93,\n\t0xD3772061, 0x11B638E1, 0x72500E03, 0xF80EB2BB,\n\t0xABE0502E, 0xEC8D77DE, 0x57971E81, 0xE14F6746,\n\t0xC9335400, 0x6920318F, 0x081DBB99, 0xFFC304A5,\n\t0x4D351805, 0x7F3D5CE3, 0xA6C866C6, 0x5D5BCCA9,\n\t0xDAEC6FEA, 0x9F926F91, 0x9F46222F, 0x3991467D,\n\t0xA5BF6D8E, 0x1143C44F, 0x43958302, 0xD0214EEB,\n\t0x022083B8, 0x3FB6180C, 0x18F8931E, 0x281658E6,\n\t0x26486E3E, 0x8BD78A70, 0x7477E4C1, 0xB506E07C,\n\t0xF32D0A25, 0x79098B02, 0xE4EABB81, 0x28123B23,\n\t0x69DEAD38, 0x1574CA16, 0xDF871B62, 0x211C40B7,\n\t0xA51A9EF9, 0x0014377B, 0x041E8AC8, 0x09114003,\n\t0xBD59E4D2, 0xE3D156D5, 0x4FE876D5, 0x2F91A340,\n\t0x557BE8DE, 0x00EAE4A7, 0x0CE5C2EC, 0x4DB4BBA6,\n\t0xE756BDFF, 0xDD3369AC, 0xEC17B035, 0x06572327,\n\t0x99AFC8B0, 0x56C8C391, 0x6B65811C, 0x5E146119,\n\t0x6E85CB75, 0xBE07C002, 0xC2325577, 0x893FF4EC,\n\t0x5BBFC92D, 0xD0EC3B25, 0xB7801AB7, 0x8D6D3B24,\n\t0x20C763EF, 0xC366A5FC, 0x9C382880, 0x0ACE3205,\n\t0xAAC9548A, 0xECA1D7C7, 0x041AFA32, 0x1D16625A,\n\t0x6701902C, 0x9B757A54, 0x31D477F7, 0x9126B031,\n\t0x36CC6FDB, 0xC70B8B46, 0xD9E66A48, 0x56E55A79,\n\t0x026A4CEB, 0x52437EFF, 0x2F8F76B4, 0x0DF980A5,\n\t0x8674CDE3, 0xEDDA04EB, 0x17A9BE04, 0x2C18F4DF,\n\t0xB7747F9D, 0xAB2AF7B4, 0xEFC34D20, 0x2E096B7C,\n\t0x1741A254, 0xE5B6A035, 0x213D42F6, 0x2C1C7C26,\n\t0x61C2F50F, 0x6552DAF9, 0xD2C231F8, 0x25130F69,\n\t0xD8167FA2, 0x0418F2C8, 0x001A96A6, 0x0D1526AB,\n\t0x63315C21, 0x5E0A72EC, 0x49BAFEFD, 0x187908D9,\n\t0x8D0DBD86, 0x311170A7, 0x3E9B640C, 0xCC3E10D7,\n\t0xD5CAD3B6, 0x0CAEC388, 0xF73001E1, 0x6C728AFF,\n\t0x71EAE2A1, 0x1F9AF36E, 0xCFCBD12F, 0xC1DE8417,\n\t0xAC07BE6B, 0xCB44A1D8, 0x8B9B0F56, 0x013988C3,\n\t0xB1C52FCA, 0xB4BE31CD, 0xD8782806, 0x12A3A4E2,\n\t0x6F7DE532, 0x58FD7EB6, 0xD01EE900, 0x24ADFFC2,\n\t0xF4990FC5, 0x9711AAC5, 0x001D7B95, 0x82E5E7D2,\n\t0x109873F6, 0x00613096, 0xC32D9521, 0xADA121FF,\n\t0x29908415, 0x7FBB977F, 0xAF9EB3DB, 0x29C9ED2A,\n\t0x5CE2A465, 0xA730F32C, 0xD0AA3FE8, 0x8A5CC091,\n\t0xD49E2CE7, 0x0CE454A9, 0xD60ACD86, 0x015F1919,\n\t0x77079103, 0xDEA03AF6, 0x78A8565E, 0xDEE356DF,\n\t0x21F05CBE, 0x8B75E387, 0xB3C50651, 0xB8A5C3EF,\n\t0xD8EEB6D2, 0xE523BE77, 0xC2154529, 0x2F69EFDF,\n\t0xAFE67AFB, 0xF470C4B2, 0xF3E0EB5B, 0xD6CC9876,\n\t0x39E4460C, 0x1FDA8538, 0x1987832F, 0xCA007367,\n\t0xA99144F8, 0x296B299E, 0x492FC295, 0x9266BEAB,\n\t0xB5676E69, 0x9BD3DDDA, 0xDF7E052F, 0xDB25701C,\n\t0x1B5E51EE, 0xF65324E6, 0x6AFCE36C, 0x0316CC04,\n\t0x8644213E, 0xB7DC59D0, 0x7965291F, 0xCCD6FD43,\n\t0x41823979, 0x932BCDF6, 0xB657C34D, 0x4EDFD282,\n\t0x7AE5290C, 0x3CB9536B, 0x851E20FE, 0x9833557E,\n\t0x13ECF0B0, 0xD3FFB372, 0x3F85C5C1, 0x0AEF7ED2\n};\n\nstatic const u_int32_t cast_sbox5[256] = {\n\t0x7EC90C04, 0x2C6E74B9, 0x9B0E66DF, 0xA6337911,\n\t0xB86A7FFF, 0x1DD358F5, 0x44DD9D44, 0x1731167F,\n\t0x08FBF1FA, 0xE7F511CC, 0xD2051B00, 0x735ABA00,\n\t0x2AB722D8, 0x386381CB, 0xACF6243A, 0x69BEFD7A,\n\t0xE6A2E77F, 0xF0C720CD, 0xC4494816, 0xCCF5C180,\n\t0x38851640, 0x15B0A848, 0xE68B18CB, 0x4CAADEFF,\n\t0x5F480A01, 0x0412B2AA, 0x259814FC, 0x41D0EFE2,\n\t0x4E40B48D, 0x248EB6FB, 0x8DBA1CFE, 0x41A99B02,\n\t0x1A550A04, 0xBA8F65CB, 0x7251F4E7, 0x95A51725,\n\t0xC106ECD7, 0x97A5980A, 0xC539B9AA, 0x4D79FE6A,\n\t0xF2F3F763, 0x68AF8040, 0xED0C9E56, 0x11B4958B,\n\t0xE1EB5A88, 0x8709E6B0, 0xD7E07156, 0x4E29FEA7,\n\t0x6366E52D, 0x02D1C000, 0xC4AC8E05, 0x9377F571,\n\t0x0C05372A, 0x578535F2, 0x2261BE02, 0xD642A0C9,\n\t0xDF13A280, 0x74B55BD2, 0x682199C0, 0xD421E5EC,\n\t0x53FB3CE8, 0xC8ADEDB3, 0x28A87FC9, 0x3D959981,\n\t0x5C1FF900, 0xFE38D399, 0x0C4EFF0B, 0x062407EA,\n\t0xAA2F4FB1, 0x4FB96976, 0x90C79505, 0xB0A8A774,\n\t0xEF55A1FF, 0xE59CA2C2, 0xA6B62D27, 0xE66A4263,\n\t0xDF65001F, 0x0EC50966, 0xDFDD55BC, 0x29DE0655,\n\t0x911E739A, 0x17AF8975, 0x32C7911C, 0x89F89468,\n\t0x0D01E980, 0x524755F4, 0x03B63CC9, 0x0CC844B2,\n\t0xBCF3F0AA, 0x87AC36E9, 0xE53A7426, 0x01B3D82B,\n\t0x1A9E7449, 0x64EE2D7E, 0xCDDBB1DA, 0x01C94910,\n\t0xB868BF80, 0x0D26F3FD, 0x9342EDE7, 0x04A5C284,\n\t0x636737B6, 0x50F5B616, 0xF24766E3, 0x8ECA36C1,\n\t0x136E05DB, 0xFEF18391, 0xFB887A37, 0xD6E7F7D4,\n\t0xC7FB7DC9, 0x3063FCDF, 0xB6F589DE, 0xEC2941DA,\n\t0x26E46695, 0xB7566419, 0xF654EFC5, 0xD08D58B7,\n\t0x48925401, 0xC1BACB7F, 0xE5FF550F, 0xB6083049,\n\t0x5BB5D0E8, 0x87D72E5A, 0xAB6A6EE1, 0x223A66CE,\n\t0xC62BF3CD, 0x9E0885F9, 0x68CB3E47, 0x086C010F,\n\t0xA21DE820, 0xD18B69DE, 0xF3F65777, 0xFA02C3F6,\n\t0x407EDAC3, 0xCBB3D550, 0x1793084D, 0xB0D70EBA,\n\t0x0AB378D5, 0xD951FB0C, 0xDED7DA56, 0x4124BBE4,\n\t0x94CA0B56, 0x0F5755D1, 0xE0E1E56E, 0x6184B5BE,\n\t0x580A249F, 0x94F74BC0, 0xE327888E, 0x9F7B5561,\n\t0xC3DC0280, 0x05687715, 0x646C6BD7, 0x44904DB3,\n\t0x66B4F0A3, 0xC0F1648A, 0x697ED5AF, 0x49E92FF6,\n\t0x309E374F, 0x2CB6356A, 0x85808573, 0x4991F840,\n\t0x76F0AE02, 0x083BE84D, 0x28421C9A, 0x44489406,\n\t0x736E4CB8, 0xC1092910, 0x8BC95FC6, 0x7D869CF4,\n\t0x134F616F, 0x2E77118D, 0xB31B2BE1, 0xAA90B472,\n\t0x3CA5D717, 0x7D161BBA, 0x9CAD9010, 0xAF462BA2,\n\t0x9FE459D2, 0x45D34559, 0xD9F2DA13, 0xDBC65487,\n\t0xF3E4F94E, 0x176D486F, 0x097C13EA, 0x631DA5C7,\n\t0x445F7382, 0x175683F4, 0xCDC66A97, 0x70BE0288,\n\t0xB3CDCF72, 0x6E5DD2F3, 0x20936079, 0x459B80A5,\n\t0xBE60E2DB, 0xA9C23101, 0xEBA5315C, 0x224E42F2,\n\t0x1C5C1572, 0xF6721B2C, 0x1AD2FFF3, 0x8C25404E,\n\t0x324ED72F, 0x4067B7FD, 0x0523138E, 0x5CA3BC78,\n\t0xDC0FD66E, 0x75922283, 0x784D6B17, 0x58EBB16E,\n\t0x44094F85, 0x3F481D87, 0xFCFEAE7B, 0x77B5FF76,\n\t0x8C2302BF, 0xAAF47556, 0x5F46B02A, 0x2B092801,\n\t0x3D38F5F7, 0x0CA81F36, 0x52AF4A8A, 0x66D5E7C0,\n\t0xDF3B0874, 0x95055110, 0x1B5AD7A8, 0xF61ED5AD,\n\t0x6CF6E479, 0x20758184, 0xD0CEFA65, 0x88F7BE58,\n\t0x4A046826, 0x0FF6F8F3, 0xA09C7F70, 0x5346ABA0,\n\t0x5CE96C28, 0xE176EDA3, 0x6BAC307F, 0x376829D2,\n\t0x85360FA9, 0x17E3FE2A, 0x24B79767, 0xF5A96B20,\n\t0xD6CD2595, 0x68FF1EBF, 0x7555442C, 0xF19F06BE,\n\t0xF9E0659A, 0xEEB9491D, 0x34010718, 0xBB30CAB8,\n\t0xE822FE15, 0x88570983, 0x750E6249, 0xDA627E55,\n\t0x5E76FFA8, 0xB1534546, 0x6D47DE08, 0xEFE9E7D4\n};\n\nstatic const u_int32_t cast_sbox6[256] = {\n\t0xF6FA8F9D, 0x2CAC6CE1, 0x4CA34867, 0xE2337F7C,\n\t0x95DB08E7, 0x016843B4, 0xECED5CBC, 0x325553AC,\n\t0xBF9F0960, 0xDFA1E2ED, 0x83F0579D, 0x63ED86B9,\n\t0x1AB6A6B8, 0xDE5EBE39, 0xF38FF732, 0x8989B138,\n\t0x33F14961, 0xC01937BD, 0xF506C6DA, 0xE4625E7E,\n\t0xA308EA99, 0x4E23E33C, 0x79CBD7CC, 0x48A14367,\n\t0xA3149619, 0xFEC94BD5, 0xA114174A, 0xEAA01866,\n\t0xA084DB2D, 0x09A8486F, 0xA888614A, 0x2900AF98,\n\t0x01665991, 0xE1992863, 0xC8F30C60, 0x2E78EF3C,\n\t0xD0D51932, 0xCF0FEC14, 0xF7CA07D2, 0xD0A82072,\n\t0xFD41197E, 0x9305A6B0, 0xE86BE3DA, 0x74BED3CD,\n\t0x372DA53C, 0x4C7F4448, 0xDAB5D440, 0x6DBA0EC3,\n\t0x083919A7, 0x9FBAEED9, 0x49DBCFB0, 0x4E670C53,\n\t0x5C3D9C01, 0x64BDB941, 0x2C0E636A, 0xBA7DD9CD,\n\t0xEA6F7388, 0xE70BC762, 0x35F29ADB, 0x5C4CDD8D,\n\t0xF0D48D8C, 0xB88153E2, 0x08A19866, 0x1AE2EAC8,\n\t0x284CAF89, 0xAA928223, 0x9334BE53, 0x3B3A21BF,\n\t0x16434BE3, 0x9AEA3906, 0xEFE8C36E, 0xF890CDD9,\n\t0x80226DAE, 0xC340A4A3, 0xDF7E9C09, 0xA694A807,\n\t0x5B7C5ECC, 0x221DB3A6, 0x9A69A02F, 0x68818A54,\n\t0xCEB2296F, 0x53C0843A, 0xFE893655, 0x25BFE68A,\n\t0xB4628ABC, 0xCF222EBF, 0x25AC6F48, 0xA9A99387,\n\t0x53BDDB65, 0xE76FFBE7, 0xE967FD78, 0x0BA93563,\n\t0x8E342BC1, 0xE8A11BE9, 0x4980740D, 0xC8087DFC,\n\t0x8DE4BF99, 0xA11101A0, 0x7FD37975, 0xDA5A26C0,\n\t0xE81F994F, 0x9528CD89, 0xFD339FED, 0xB87834BF,\n\t0x5F04456D, 0x22258698, 0xC9C4C83B, 0x2DC156BE,\n\t0x4F628DAA, 0x57F55EC5, 0xE2220ABE, 0xD2916EBF,\n\t0x4EC75B95, 0x24F2C3C0, 0x42D15D99, 0xCD0D7FA0,\n\t0x7B6E27FF, 0xA8DC8AF0, 0x7345C106, 0xF41E232F,\n\t0x35162386, 0xE6EA8926, 0x3333B094, 0x157EC6F2,\n\t0x372B74AF, 0x692573E4, 0xE9A9D848, 0xF3160289,\n\t0x3A62EF1D, 0xA787E238, 0xF3A5F676, 0x74364853,\n\t0x20951063, 0x4576698D, 0xB6FAD407, 0x592AF950,\n\t0x36F73523, 0x4CFB6E87, 0x7DA4CEC0, 0x6C152DAA,\n\t0xCB0396A8, 0xC50DFE5D, 0xFCD707AB, 0x0921C42F,\n\t0x89DFF0BB, 0x5FE2BE78, 0x448F4F33, 0x754613C9,\n\t0x2B05D08D, 0x48B9D585, 0xDC049441, 0xC8098F9B,\n\t0x7DEDE786, 0xC39A3373, 0x42410005, 0x6A091751,\n\t0x0EF3C8A6, 0x890072D6, 0x28207682, 0xA9A9F7BE,\n\t0xBF32679D, 0xD45B5B75, 0xB353FD00, 0xCBB0E358,\n\t0x830F220A, 0x1F8FB214, 0xD372CF08, 0xCC3C4A13,\n\t0x8CF63166, 0x061C87BE, 0x88C98F88, 0x6062E397,\n\t0x47CF8E7A, 0xB6C85283, 0x3CC2ACFB, 0x3FC06976,\n\t0x4E8F0252, 0x64D8314D, 0xDA3870E3, 0x1E665459,\n\t0xC10908F0, 0x513021A5, 0x6C5B68B7, 0x822F8AA0,\n\t0x3007CD3E, 0x74719EEF, 0xDC872681, 0x073340D4,\n\t0x7E432FD9, 0x0C5EC241, 0x8809286C, 0xF592D891,\n\t0x08A930F6, 0x957EF305, 0xB7FBFFBD, 0xC266E96F,\n\t0x6FE4AC98, 0xB173ECC0, 0xBC60B42A, 0x953498DA,\n\t0xFBA1AE12, 0x2D4BD736, 0x0F25FAAB, 0xA4F3FCEB,\n\t0xE2969123, 0x257F0C3D, 0x9348AF49, 0x361400BC,\n\t0xE8816F4A, 0x3814F200, 0xA3F94043, 0x9C7A54C2,\n\t0xBC704F57, 0xDA41E7F9, 0xC25AD33A, 0x54F4A084,\n\t0xB17F5505, 0x59357CBE, 0xEDBD15C8, 0x7F97C5AB,\n\t0xBA5AC7B5, 0xB6F6DEAF, 0x3A479C3A, 0x5302DA25,\n\t0x653D7E6A, 0x54268D49, 0x51A477EA, 0x5017D55B,\n\t0xD7D25D88, 0x44136C76, 0x0404A8C8, 0xB8E5A121,\n\t0xB81A928A, 0x60ED5869, 0x97C55B96, 0xEAEC991B,\n\t0x29935913, 0x01FDB7F1, 0x088E8DFA, 0x9AB6F6F5,\n\t0x3B4CBF9F, 0x4A5DE3AB, 0xE6051D35, 0xA0E1D855,\n\t0xD36B4CF1, 0xF544EDEB, 0xB0E93524, 0xBEBB8FBD,\n\t0xA2D762CF, 0x49C92F54, 0x38B5F331, 0x7128A454,\n\t0x48392905, 0xA65B1DB8, 0x851C97BD, 0xD675CF2F\n};\n\nstatic const u_int32_t cast_sbox7[256] = {\n\t0x85E04019, 0x332BF567, 0x662DBFFF, 0xCFC65693,\n\t0x2A8D7F6F, 0xAB9BC912, 0xDE6008A1, 0x2028DA1F,\n\t0x0227BCE7, 0x4D642916, 0x18FAC300, 0x50F18B82,\n\t0x2CB2CB11, 0xB232E75C, 0x4B3695F2, 0xB28707DE,\n\t0xA05FBCF6, 0xCD4181E9, 0xE150210C, 0xE24EF1BD,\n\t0xB168C381, 0xFDE4E789, 0x5C79B0D8, 0x1E8BFD43,\n\t0x4D495001, 0x38BE4341, 0x913CEE1D, 0x92A79C3F,\n\t0x089766BE, 0xBAEEADF4, 0x1286BECF, 0xB6EACB19,\n\t0x2660C200, 0x7565BDE4, 0x64241F7A, 0x8248DCA9,\n\t0xC3B3AD66, 0x28136086, 0x0BD8DFA8, 0x356D1CF2,\n\t0x107789BE, 0xB3B2E9CE, 0x0502AA8F, 0x0BC0351E,\n\t0x166BF52A, 0xEB12FF82, 0xE3486911, 0xD34D7516,\n\t0x4E7B3AFF, 0x5F43671B, 0x9CF6E037, 0x4981AC83,\n\t0x334266CE, 0x8C9341B7, 0xD0D854C0, 0xCB3A6C88,\n\t0x47BC2829, 0x4725BA37, 0xA66AD22B, 0x7AD61F1E,\n\t0x0C5CBAFA, 0x4437F107, 0xB6E79962, 0x42D2D816,\n\t0x0A961288, 0xE1A5C06E, 0x13749E67, 0x72FC081A,\n\t0xB1D139F7, 0xF9583745, 0xCF19DF58, 0xBEC3F756,\n\t0xC06EBA30, 0x07211B24, 0x45C28829, 0xC95E317F,\n\t0xBC8EC511, 0x38BC46E9, 0xC6E6FA14, 0xBAE8584A,\n\t0xAD4EBC46, 0x468F508B, 0x7829435F, 0xF124183B,\n\t0x821DBA9F, 0xAFF60FF4, 0xEA2C4E6D, 0x16E39264,\n\t0x92544A8B, 0x009B4FC3, 0xABA68CED, 0x9AC96F78,\n\t0x06A5B79A, 0xB2856E6E, 0x1AEC3CA9, 0xBE838688,\n\t0x0E0804E9, 0x55F1BE56, 0xE7E5363B, 0xB3A1F25D,\n\t0xF7DEBB85, 0x61FE033C, 0x16746233, 0x3C034C28,\n\t0xDA6D0C74, 0x79AAC56C, 0x3CE4E1AD, 0x51F0C802,\n\t0x98F8F35A, 0x1626A49F, 0xEED82B29, 0x1D382FE3,\n\t0x0C4FB99A, 0xBB325778, 0x3EC6D97B, 0x6E77A6A9,\n\t0xCB658B5C, 0xD45230C7, 0x2BD1408B, 0x60C03EB7,\n\t0xB9068D78, 0xA33754F4, 0xF430C87D, 0xC8A71302,\n\t0xB96D8C32, 0xEBD4E7BE, 0xBE8B9D2D, 0x7979FB06,\n\t0xE7225308, 0x8B75CF77, 0x11EF8DA4, 0xE083C858,\n\t0x8D6B786F, 0x5A6317A6, 0xFA5CF7A0, 0x5DDA0033,\n\t0xF28EBFB0, 0xF5B9C310, 0xA0EAC280, 0x08B9767A,\n\t0xA3D9D2B0, 0x79D34217, 0x021A718D, 0x9AC6336A,\n\t0x2711FD60, 0x438050E3, 0x069908A8, 0x3D7FEDC4,\n\t0x826D2BEF, 0x4EEB8476, 0x488DCF25, 0x36C9D566,\n\t0x28E74E41, 0xC2610ACA, 0x3D49A9CF, 0xBAE3B9DF,\n\t0xB65F8DE6, 0x92AEAF64, 0x3AC7D5E6, 0x9EA80509,\n\t0xF22B017D, 0xA4173F70, 0xDD1E16C3, 0x15E0D7F9,\n\t0x50B1B887, 0x2B9F4FD5, 0x625ABA82, 0x6A017962,\n\t0x2EC01B9C, 0x15488AA9, 0xD716E740, 0x40055A2C,\n\t0x93D29A22, 0xE32DBF9A, 0x058745B9, 0x3453DC1E,\n\t0xD699296E, 0x496CFF6F, 0x1C9F4986, 0xDFE2ED07,\n\t0xB87242D1, 0x19DE7EAE, 0x053E561A, 0x15AD6F8C,\n\t0x66626C1C, 0x7154C24C, 0xEA082B2A, 0x93EB2939,\n\t0x17DCB0F0, 0x58D4F2AE, 0x9EA294FB, 0x52CF564C,\n\t0x9883FE66, 0x2EC40581, 0x763953C3, 0x01D6692E,\n\t0xD3A0C108, 0xA1E7160E, 0xE4F2DFA6, 0x693ED285,\n\t0x74904698, 0x4C2B0EDD, 0x4F757656, 0x5D393378,\n\t0xA132234F, 0x3D321C5D, 0xC3F5E194, 0x4B269301,\n\t0xC79F022F, 0x3C997E7E, 0x5E4F9504, 0x3FFAFBBD,\n\t0x76F7AD0E, 0x296693F4, 0x3D1FCE6F, 0xC61E45BE,\n\t0xD3B5AB34, 0xF72BF9B7, 0x1B0434C0, 0x4E72B567,\n\t0x5592A33D, 0xB5229301, 0xCFD2A87F, 0x60AEB767,\n\t0x1814386B, 0x30BCC33D, 0x38A0C07D, 0xFD1606F2,\n\t0xC363519B, 0x589DD390, 0x5479F8E6, 0x1CB8D647,\n\t0x97FD61A9, 0xEA7759F4, 0x2D57539D, 0x569A58CF,\n\t0xE84E63AD, 0x462E1B78, 0x6580F87E, 0xF3817914,\n\t0x91DA55F4, 0x40A230F3, 0xD1988F35, 0xB6E318D2,\n\t0x3FFA50BC, 0x3D40F021, 0xC3C0BDAE, 0x4958C24C,\n\t0x518F36B2, 0x84B1D370, 0x0FEDCE83, 0x878DDADA,\n\t0xF2A279C7, 0x94E01BE8, 0x90716F4B, 0x954B8AA3\n};\n\nstatic const u_int32_t cast_sbox8[256] = {\n\t0xE216300D, 0xBBDDFFFC, 0xA7EBDABD, 0x35648095,\n\t0x7789F8B7, 0xE6C1121B, 0x0E241600, 0x052CE8B5,\n\t0x11A9CFB0, 0xE5952F11, 0xECE7990A, 0x9386D174,\n\t0x2A42931C, 0x76E38111, 0xB12DEF3A, 0x37DDDDFC,\n\t0xDE9ADEB1, 0x0A0CC32C, 0xBE197029, 0x84A00940,\n\t0xBB243A0F, 0xB4D137CF, 0xB44E79F0, 0x049EEDFD,\n\t0x0B15A15D, 0x480D3168, 0x8BBBDE5A, 0x669DED42,\n\t0xC7ECE831, 0x3F8F95E7, 0x72DF191B, 0x7580330D,\n\t0x94074251, 0x5C7DCDFA, 0xABBE6D63, 0xAA402164,\n\t0xB301D40A, 0x02E7D1CA, 0x53571DAE, 0x7A3182A2,\n\t0x12A8DDEC, 0xFDAA335D, 0x176F43E8, 0x71FB46D4,\n\t0x38129022, 0xCE949AD4, 0xB84769AD, 0x965BD862,\n\t0x82F3D055, 0x66FB9767, 0x15B80B4E, 0x1D5B47A0,\n\t0x4CFDE06F, 0xC28EC4B8, 0x57E8726E, 0x647A78FC,\n\t0x99865D44, 0x608BD593, 0x6C200E03, 0x39DC5FF6,\n\t0x5D0B00A3, 0xAE63AFF2, 0x7E8BD632, 0x70108C0C,\n\t0xBBD35049, 0x2998DF04, 0x980CF42A, 0x9B6DF491,\n\t0x9E7EDD53, 0x06918548, 0x58CB7E07, 0x3B74EF2E,\n\t0x522FFFB1, 0xD24708CC, 0x1C7E27CD, 0xA4EB215B,\n\t0x3CF1D2E2, 0x19B47A38, 0x424F7618, 0x35856039,\n\t0x9D17DEE7, 0x27EB35E6, 0xC9AFF67B, 0x36BAF5B8,\n\t0x09C467CD, 0xC18910B1, 0xE11DBF7B, 0x06CD1AF8,\n\t0x7170C608, 0x2D5E3354, 0xD4DE495A, 0x64C6D006,\n\t0xBCC0C62C, 0x3DD00DB3, 0x708F8F34, 0x77D51B42,\n\t0x264F620F, 0x24B8D2BF, 0x15C1B79E, 0x46A52564,\n\t0xF8D7E54E, 0x3E378160, 0x7895CDA5, 0x859C15A5,\n\t0xE6459788, 0xC37BC75F, 0xDB07BA0C, 0x0676A3AB,\n\t0x7F229B1E, 0x31842E7B, 0x24259FD7, 0xF8BEF472,\n\t0x835FFCB8, 0x6DF4C1F2, 0x96F5B195, 0xFD0AF0FC,\n\t0xB0FE134C, 0xE2506D3D, 0x4F9B12EA, 0xF215F225,\n\t0xA223736F, 0x9FB4C428, 0x25D04979, 0x34C713F8,\n\t0xC4618187, 0xEA7A6E98, 0x7CD16EFC, 0x1436876C,\n\t0xF1544107, 0xBEDEEE14, 0x56E9AF27, 0xA04AA441,\n\t0x3CF7C899, 0x92ECBAE6, 0xDD67016D, 0x151682EB,\n\t0xA842EEDF, 0xFDBA60B4, 0xF1907B75, 0x20E3030F,\n\t0x24D8C29E, 0xE139673B, 0xEFA63FB8, 0x71873054,\n\t0xB6F2CF3B, 0x9F326442, 0xCB15A4CC, 0xB01A4504,\n\t0xF1E47D8D, 0x844A1BE5, 0xBAE7DFDC, 0x42CBDA70,\n\t0xCD7DAE0A, 0x57E85B7A, 0xD53F5AF6, 0x20CF4D8C,\n\t0xCEA4D428, 0x79D130A4, 0x3486EBFB, 0x33D3CDDC,\n\t0x77853B53, 0x37EFFCB5, 0xC5068778, 0xE580B3E6,\n\t0x4E68B8F4, 0xC5C8B37E, 0x0D809EA2, 0x398FEB7C,\n\t0x132A4F94, 0x43B7950E, 0x2FEE7D1C, 0x223613BD,\n\t0xDD06CAA2, 0x37DF932B, 0xC4248289, 0xACF3EBC3,\n\t0x5715F6B7, 0xEF3478DD, 0xF267616F, 0xC148CBE4,\n\t0x9052815E, 0x5E410FAB, 0xB48A2465, 0x2EDA7FA4,\n\t0xE87B40E4, 0xE98EA084, 0x5889E9E1, 0xEFD390FC,\n\t0xDD07D35B, 0xDB485694, 0x38D7E5B2, 0x57720101,\n\t0x730EDEBC, 0x5B643113, 0x94917E4F, 0x503C2FBA,\n\t0x646F1282, 0x7523D24A, 0xE0779695, 0xF9C17A8F,\n\t0x7A5B2121, 0xD187B896, 0x29263A4D, 0xBA510CDF,\n\t0x81F47C9F, 0xAD1163ED, 0xEA7B5965, 0x1A00726E,\n\t0x11403092, 0x00DA6D77, 0x4A0CDD61, 0xAD1F4603,\n\t0x605BDFB0, 0x9EEDC364, 0x22EBE6A8, 0xCEE7D28A,\n\t0xA0E736A0, 0x5564A6B9, 0x10853209, 0xC7EB8F37,\n\t0x2DE705CA, 0x8951570F, 0xDF09822B, 0xBD691A6C,\n\t0xAA12E4F2, 0x87451C0F, 0xE0F6A27A, 0x3ADA4819,\n\t0x4CF1764F, 0x0D771C2B, 0x67CDB156, 0x350D8384,\n\t0x5938FA0F, 0x42399EF3, 0x36997B07, 0x0E84093D,\n\t0x4AA93E61, 0x8360D87B, 0x1FA98B0C, 0x1149382C,\n\t0xE97625A5, 0x0614D1B7, 0x0E25244B, 0x0C768347,\n\t0x589E8D82, 0x0D2059D1, 0xA466BB1E, 0xF8DA0A82,\n\t0x04F19130, 0xBA6E4EC0, 0x99265164, 0x1EE7230D,\n\t0x50B2AD80, 0xEAEE6801, 0x8DB2A283, 0xEA8BF59E\n};\n\n"
  },
  {
    "path": "freebsd-headers/crypto/cryptodev.h",
    "content": "/*\t$FreeBSD: release/9.0.0/sys/opencrypto/cryptodev.h 213068 2010-09-23 11:52:32Z pjd $\t*/\n/*\t$OpenBSD: cryptodev.h,v 1.31 2002/06/11 11:14:29 beck Exp $\t*/\n\n/*-\n * The author of this code is Angelos D. Keromytis (angelos@cis.upenn.edu)\n * Copyright (c) 2002-2006 Sam Leffler, Errno Consulting\n *\n * This code was written by Angelos D. Keromytis in Athens, Greece, in\n * February 2000. Network Security Technologies Inc. (NSTI) kindly\n * supported the development of this code.\n *\n * Copyright (c) 2000 Angelos D. Keromytis\n *\n * Permission to use, copy, and modify this software with or without fee\n * is hereby granted, provided that this entire notice is included in\n * all source code copies of any software which is or includes a copy or\n * modification of this software.\n *\n * THIS SOFTWARE IS BEING PROVIDED \"AS IS\", WITHOUT ANY EXPRESS OR\n * IMPLIED WARRANTY. IN PARTICULAR, NONE OF THE AUTHORS MAKES ANY\n * REPRESENTATION OR WARRANTY OF ANY KIND CONCERNING THE\n * MERCHANTABILITY OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR\n * PURPOSE.\n *\n * Copyright (c) 2001 Theo de Raadt\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n *\n * 1. Redistributions of source code must retain the above copyright\n *   notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *   notice, this list of conditions and the following disclaimer in the\n *   documentation and/or other materials provided with the distribution.\n * 3. The name of the author may not be used to endorse or promote products\n *   derived from this software without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR\n * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES\n * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,\n * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF\n * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n *\n * Effort sponsored in part by the Defense Advanced Research Projects\n * Agency (DARPA) and Air Force Research Laboratory, Air Force\n * Materiel Command, USAF, under agreement number F30602-01-2-0537.\n *\n */\n\n#ifndef _CRYPTO_CRYPTO_H_\n#define _CRYPTO_CRYPTO_H_\n\n#include <sys/ioccom.h>\n\n/* Some initial values */\n#define CRYPTO_DRIVERS_INITIAL\t4\n#define CRYPTO_SW_SESSIONS\t32\n\n/* Hash values */\n#define\tNULL_HASH_LEN\t\t16\n#define\tMD5_HASH_LEN\t\t16\n#define\tSHA1_HASH_LEN\t\t20\n#define\tRIPEMD160_HASH_LEN\t20\n#define\tSHA2_256_HASH_LEN\t32\n#define\tSHA2_384_HASH_LEN\t48\n#define\tSHA2_512_HASH_LEN\t64\n#define\tMD5_KPDK_HASH_LEN\t16\n#define\tSHA1_KPDK_HASH_LEN\t20\n/* Maximum hash algorithm result length */\n#define\tHASH_MAX_LEN\t\tSHA2_512_HASH_LEN /* Keep this updated */\n\n/* HMAC values */\n#define\tNULL_HMAC_BLOCK_LEN\t\t64\n#define\tMD5_HMAC_BLOCK_LEN\t\t64\n#define\tSHA1_HMAC_BLOCK_LEN\t\t64\n#define\tRIPEMD160_HMAC_BLOCK_LEN\t64\n#define\tSHA2_256_HMAC_BLOCK_LEN\t\t64\n#define\tSHA2_384_HMAC_BLOCK_LEN\t\t128\n#define\tSHA2_512_HMAC_BLOCK_LEN\t\t128\n/* Maximum HMAC block length */\n#define\tHMAC_MAX_BLOCK_LEN\t\tSHA2_512_HMAC_BLOCK_LEN /* Keep this updated */\n#define\tHMAC_IPAD_VAL\t\t\t0x36\n#define\tHMAC_OPAD_VAL\t\t\t0x5C\n\n/* Encryption algorithm block sizes */\n#define NULL_BLOCK_LEN\t\t4\n#define DES_BLOCK_LEN\t\t8\n#define DES3_BLOCK_LEN\t\t8\n#define BLOWFISH_BLOCK_LEN\t8\n#define SKIPJACK_BLOCK_LEN\t8\n#define CAST128_BLOCK_LEN\t8\n#define RIJNDAEL128_BLOCK_LEN\t16\n#define AES_BLOCK_LEN\t\tRIJNDAEL128_BLOCK_LEN\n#define CAMELLIA_BLOCK_LEN\t16\n#define EALG_MAX_BLOCK_LEN\tAES_BLOCK_LEN /* Keep this updated */\n\n#define\tCRYPTO_ALGORITHM_MIN\t1\n#define CRYPTO_DES_CBC\t\t1\n#define CRYPTO_3DES_CBC\t\t2\n#define CRYPTO_BLF_CBC\t\t3\n#define CRYPTO_CAST_CBC\t\t4\n#define CRYPTO_SKIPJACK_CBC\t5\n#define CRYPTO_MD5_HMAC\t\t6\n#define CRYPTO_SHA1_HMAC\t7\n#define CRYPTO_RIPEMD160_HMAC\t8\n#define CRYPTO_MD5_KPDK\t\t9\n#define CRYPTO_SHA1_KPDK\t10\n#define CRYPTO_RIJNDAEL128_CBC\t11 /* 128 bit blocksize */\n#define CRYPTO_AES_CBC\t\t11 /* 128 bit blocksize -- the same as above */\n#define CRYPTO_ARC4\t\t12\n#define\tCRYPTO_MD5\t\t13\n#define\tCRYPTO_SHA1\t\t14\n#define\tCRYPTO_NULL_HMAC\t15\n#define\tCRYPTO_NULL_CBC\t\t16\n#define\tCRYPTO_DEFLATE_COMP\t17 /* Deflate compression algorithm */\n#define\tCRYPTO_SHA2_256_HMAC\t18\n#define\tCRYPTO_SHA2_384_HMAC\t19\n#define\tCRYPTO_SHA2_512_HMAC\t20\n#define CRYPTO_CAMELLIA_CBC\t21\n#define\tCRYPTO_AES_XTS\t\t22\n#define\tCRYPTO_ALGORITHM_MAX\t22 /* Keep updated - see below */\n\n/* Algorithm flags */\n#define\tCRYPTO_ALG_FLAG_SUPPORTED\t0x01 /* Algorithm is supported */\n#define\tCRYPTO_ALG_FLAG_RNG_ENABLE\t0x02 /* Has HW RNG for DH/DSA */\n#define\tCRYPTO_ALG_FLAG_DSA_SHA\t\t0x04 /* Can do SHA on msg */\n\n/*\n * Crypto driver/device flags.  They can set in the crid\n * parameter when creating a session or submitting a key\n * op to affect the device/driver assigned.  If neither\n * of these are specified then the crid is assumed to hold\n * the driver id of an existing (and suitable) device that\n * must be used to satisfy the request.\n */\n#define CRYPTO_FLAG_HARDWARE\t0x01000000\t/* hardware accelerated */\n#define CRYPTO_FLAG_SOFTWARE\t0x02000000\t/* software implementation */\n\n/* NB: deprecated */\nstruct session_op {\n\tu_int32_t\tcipher;\t\t/* ie. CRYPTO_DES_CBC */\n\tu_int32_t\tmac;\t\t/* ie. CRYPTO_MD5_HMAC */\n\n\tu_int32_t\tkeylen;\t\t/* cipher key */\n\tcaddr_t\t\tkey;\n\tint\t\tmackeylen;\t/* mac key */\n\tcaddr_t\t\tmackey;\n\n  \tu_int32_t\tses;\t\t/* returns: session # */ \n};\n\nstruct session2_op {\n\tu_int32_t\tcipher;\t\t/* ie. CRYPTO_DES_CBC */\n\tu_int32_t\tmac;\t\t/* ie. CRYPTO_MD5_HMAC */\n\n\tu_int32_t\tkeylen;\t\t/* cipher key */\n\tcaddr_t\t\tkey;\n\tint\t\tmackeylen;\t/* mac key */\n\tcaddr_t\t\tmackey;\n\n  \tu_int32_t\tses;\t\t/* returns: session # */ \n\tint\t\tcrid;\t\t/* driver id + flags (rw) */\n\tint\t\tpad[4];\t\t/* for future expansion */\n};\n\nstruct crypt_op {\n\tu_int32_t\tses;\n\tu_int16_t\top;\t\t/* i.e. COP_ENCRYPT */\n#define COP_ENCRYPT\t1\n#define COP_DECRYPT\t2\n\tu_int16_t\tflags;\n#define\tCOP_F_BATCH\t0x0008\t\t/* Batch op if possible */\n\tu_int\t\tlen;\n\tcaddr_t\t\tsrc, dst;\t/* become iov[] inside kernel */\n\tcaddr_t\t\tmac;\t\t/* must be big enough for chosen MAC */\n\tcaddr_t\t\tiv;\n};\n\n/*\n * Parameters for looking up a crypto driver/device by\n * device name or by id.  The latter are returned for\n * created sessions (crid) and completed key operations.\n */\nstruct crypt_find_op {\n\tint\t\tcrid;\t\t/* driver id + flags */\n\tchar\t\tname[32];\t/* device/driver name */\n};\n\n/* bignum parameter, in packed bytes, ... */\nstruct crparam {\n\tcaddr_t\t\tcrp_p;\n\tu_int\t\tcrp_nbits;\n};\n\n#define CRK_MAXPARAM\t8\n\nstruct crypt_kop {\n\tu_int\t\tcrk_op;\t\t/* ie. CRK_MOD_EXP or other */\n\tu_int\t\tcrk_status;\t/* return status */\n\tu_short\t\tcrk_iparams;\t/* # of input parameters */\n\tu_short\t\tcrk_oparams;\t/* # of output parameters */\n\tu_int\t\tcrk_crid;\t/* NB: only used by CIOCKEY2 (rw) */\n\tstruct crparam\tcrk_param[CRK_MAXPARAM];\n};\n#define\tCRK_ALGORITM_MIN\t0\n#define CRK_MOD_EXP\t\t0\n#define CRK_MOD_EXP_CRT\t\t1\n#define CRK_DSA_SIGN\t\t2\n#define CRK_DSA_VERIFY\t\t3\n#define CRK_DH_COMPUTE_KEY\t4\n#define CRK_ALGORITHM_MAX\t4 /* Keep updated - see below */\n\n#define CRF_MOD_EXP\t\t(1 << CRK_MOD_EXP)\n#define CRF_MOD_EXP_CRT\t\t(1 << CRK_MOD_EXP_CRT)\n#define CRF_DSA_SIGN\t\t(1 << CRK_DSA_SIGN)\n#define CRF_DSA_VERIFY\t\t(1 << CRK_DSA_VERIFY)\n#define CRF_DH_COMPUTE_KEY\t(1 << CRK_DH_COMPUTE_KEY)\n\n/*\n * done against open of /dev/crypto, to get a cloned descriptor.\n * Please use F_SETFD against the cloned descriptor.\n */\n#define\tCRIOGET\t\t_IOWR('c', 100, u_int32_t)\n#define\tCRIOASYMFEAT\tCIOCASYMFEAT\n#define\tCRIOFINDDEV\tCIOCFINDDEV\n\n/* the following are done against the cloned descriptor */\n#define\tCIOCGSESSION\t_IOWR('c', 101, struct session_op)\n#define\tCIOCFSESSION\t_IOW('c', 102, u_int32_t)\n#define CIOCCRYPT\t_IOWR('c', 103, struct crypt_op)\n#define CIOCKEY\t\t_IOWR('c', 104, struct crypt_kop)\n#define CIOCASYMFEAT\t_IOR('c', 105, u_int32_t)\n#define\tCIOCGSESSION2\t_IOWR('c', 106, struct session2_op)\n#define\tCIOCKEY2\t_IOWR('c', 107, struct crypt_kop)\n#define\tCIOCFINDDEV\t_IOWR('c', 108, struct crypt_find_op)\n\nstruct cryptotstat {\n\tstruct timespec\tacc;\t\t/* total accumulated time */\n\tstruct timespec\tmin;\t\t/* min time */\n\tstruct timespec\tmax;\t\t/* max time */\n\tu_int32_t\tcount;\t\t/* number of observations */\n};\n\nstruct cryptostats {\n\tu_int32_t\tcs_ops;\t\t/* symmetric crypto ops submitted */\n\tu_int32_t\tcs_errs;\t/* symmetric crypto ops that failed */\n\tu_int32_t\tcs_kops;\t/* asymetric/key ops submitted */\n\tu_int32_t\tcs_kerrs;\t/* asymetric/key ops that failed */\n\tu_int32_t\tcs_intrs;\t/* crypto swi thread activations */\n\tu_int32_t\tcs_rets;\t/* crypto return thread activations */\n\tu_int32_t\tcs_blocks;\t/* symmetric op driver block */\n\tu_int32_t\tcs_kblocks;\t/* symmetric op driver block */\n\t/*\n\t * When CRYPTO_TIMING is defined at compile time and the\n\t * sysctl debug.crypto is set to 1, the crypto system will\n\t * accumulate statistics about how long it takes to process\n\t * crypto requests at various points during processing.\n\t */\n\tstruct cryptotstat cs_invoke;\t/* crypto_dipsatch -> crypto_invoke */\n\tstruct cryptotstat cs_done;\t/* crypto_invoke -> crypto_done */\n\tstruct cryptotstat cs_cb;\t/* crypto_done -> callback */\n\tstruct cryptotstat cs_finis;\t/* callback -> callback return */\n};\n\n#ifdef _KERNEL\n/* Standard initialization structure beginning */\nstruct cryptoini {\n\tint\t\tcri_alg;\t/* Algorithm to use */\n\tint\t\tcri_klen;\t/* Key length, in bits */\n\tint\t\tcri_mlen;\t/* Number of bytes we want from the\n\t\t\t\t\t   entire hash. 0 means all. */\n\tcaddr_t\t\tcri_key;\t/* key to use */\n\tu_int8_t\tcri_iv[EALG_MAX_BLOCK_LEN];\t/* IV to use */\n\tstruct cryptoini *cri_next;\n};\n\n/* Describe boundaries of a single crypto operation */\nstruct cryptodesc {\n\tint\t\tcrd_skip;\t/* How many bytes to ignore from start */\n\tint\t\tcrd_len;\t/* How many bytes to process */\n\tint\t\tcrd_inject;\t/* Where to inject results, if applicable */\n\tint\t\tcrd_flags;\n\n#define\tCRD_F_ENCRYPT\t\t0x01\t/* Set when doing encryption */\n#define\tCRD_F_IV_PRESENT\t0x02\t/* When encrypting, IV is already in\n\t\t\t\t\t   place, so don't copy. */\n#define\tCRD_F_IV_EXPLICIT\t0x04\t/* IV explicitly provided */\n#define\tCRD_F_DSA_SHA_NEEDED\t0x08\t/* Compute SHA-1 of buffer for DSA */\n#define\tCRD_F_KEY_EXPLICIT\t0x10\t/* Key explicitly provided */\n#define CRD_F_COMP\t\t0x0f    /* Set when doing compression */\n\n\tstruct cryptoini\tCRD_INI; /* Initialization/context data */\n#define crd_iv\t\tCRD_INI.cri_iv\n#define crd_key\t\tCRD_INI.cri_key\n#define crd_alg\t\tCRD_INI.cri_alg\n#define crd_klen\tCRD_INI.cri_klen\n\n\tstruct cryptodesc *crd_next;\n};\n\n/* Structure describing complete operation */\nstruct cryptop {\n\tTAILQ_ENTRY(cryptop) crp_next;\n\n\tu_int64_t\tcrp_sid;\t/* Session ID */\n\tint\t\tcrp_ilen;\t/* Input data total length */\n\tint\t\tcrp_olen;\t/* Result total length */\n\n\tint\t\tcrp_etype;\t/*\n\t\t\t\t\t * Error type (zero means no error).\n\t\t\t\t\t * All error codes except EAGAIN\n\t\t\t\t\t * indicate possible data corruption (as in,\n\t\t\t\t\t * the data have been touched). On all\n\t\t\t\t\t * errors, the crp_sid may have changed\n\t\t\t\t\t * (reset to a new one), so the caller\n\t\t\t\t\t * should always check and use the new\n\t\t\t\t\t * value on future requests.\n\t\t\t\t\t */\n\tint\t\tcrp_flags;\n\n#define CRYPTO_F_IMBUF\t\t0x0001\t/* Input/output are mbuf chains */\n#define CRYPTO_F_IOV\t\t0x0002\t/* Input/output are uio */\n#define CRYPTO_F_REL\t\t0x0004\t/* Must return data in same place */\n#define\tCRYPTO_F_BATCH\t\t0x0008\t/* Batch op if possible */\n#define\tCRYPTO_F_CBIMM\t\t0x0010\t/* Do callback immediately */\n#define\tCRYPTO_F_DONE\t\t0x0020\t/* Operation completed */\n#define\tCRYPTO_F_CBIFSYNC\t0x0040\t/* Do CBIMM if op is synchronous */\n\n\tcaddr_t\t\tcrp_buf;\t/* Data to be processed */\n\tcaddr_t\t\tcrp_opaque;\t/* Opaque pointer, passed along */\n\tstruct cryptodesc *crp_desc;\t/* Linked list of processing descriptors */\n\n\tint (*crp_callback)(struct cryptop *); /* Callback function */\n\n\tstruct bintime\tcrp_tstamp;\t/* performance time stamp */\n};\n\n#define CRYPTO_BUF_CONTIG\t0x0\n#define CRYPTO_BUF_IOV\t\t0x1\n#define CRYPTO_BUF_MBUF\t\t0x2\n\n#define CRYPTO_OP_DECRYPT\t0x0\n#define CRYPTO_OP_ENCRYPT\t0x1\n\n/*\n * Hints passed to process methods.\n */\n#define\tCRYPTO_HINT_MORE\t0x1\t/* more ops coming shortly */\n\nstruct cryptkop {\n\tTAILQ_ENTRY(cryptkop) krp_next;\n\n\tu_int\t\tkrp_op;\t\t/* ie. CRK_MOD_EXP or other */\n\tu_int\t\tkrp_status;\t/* return status */\n\tu_short\t\tkrp_iparams;\t/* # of input parameters */\n\tu_short\t\tkrp_oparams;\t/* # of output parameters */\n\tu_int\t\tkrp_crid;\t/* desired device, etc. */\n\tu_int32_t\tkrp_hid;\n\tstruct crparam\tkrp_param[CRK_MAXPARAM];\t/* kvm */\n\tint\t\t(*krp_callback)(struct cryptkop *);\n};\n\n/*\n * Session ids are 64 bits.  The lower 32 bits contain a \"local id\" which\n * is a driver-private session identifier.  The upper 32 bits contain a\n * \"hardware id\" used by the core crypto code to identify the driver and\n * a copy of the driver's capabilities that can be used by client code to\n * optimize operation.\n */\n#define\tCRYPTO_SESID2HID(_sid)\t(((_sid) >> 32) & 0x00ffffff)\n#define\tCRYPTO_SESID2CAPS(_sid)\t(((_sid) >> 32) & 0xff000000)\n#define\tCRYPTO_SESID2LID(_sid)\t(((u_int32_t) (_sid)) & 0xffffffff)\n\nMALLOC_DECLARE(M_CRYPTO_DATA);\n\nextern\tint crypto_newsession(u_int64_t *sid, struct cryptoini *cri, int hard);\nextern\tint crypto_freesession(u_int64_t sid);\n#define CRYPTOCAP_F_HARDWARE\tCRYPTO_FLAG_HARDWARE\n#define CRYPTOCAP_F_SOFTWARE\tCRYPTO_FLAG_SOFTWARE\n#define CRYPTOCAP_F_SYNC\t0x04000000\t/* operates synchronously */\nextern\tint32_t crypto_get_driverid(device_t dev, int flags);\nextern\tint crypto_find_driver(const char *);\nextern\tdevice_t crypto_find_device_byhid(int hid);\nextern\tint crypto_getcaps(int hid);\nextern\tint crypto_register(u_int32_t driverid, int alg, u_int16_t maxoplen,\n\t    u_int32_t flags);\nextern\tint crypto_kregister(u_int32_t, int, u_int32_t);\nextern\tint crypto_unregister(u_int32_t driverid, int alg);\nextern\tint crypto_unregister_all(u_int32_t driverid);\nextern\tint crypto_dispatch(struct cryptop *crp);\nextern\tint crypto_kdispatch(struct cryptkop *);\n#define\tCRYPTO_SYMQ\t0x1\n#define\tCRYPTO_ASYMQ\t0x2\nextern\tint crypto_unblock(u_int32_t, int);\nextern\tvoid crypto_done(struct cryptop *crp);\nextern\tvoid crypto_kdone(struct cryptkop *);\nextern\tint crypto_getfeat(int *);\n\nextern\tvoid crypto_freereq(struct cryptop *crp);\nextern\tstruct cryptop *crypto_getreq(int num);\n\nextern\tint crypto_usercrypto;\t\t/* userland may do crypto requests */\nextern\tint crypto_userasymcrypto;\t/* userland may do asym crypto reqs */\nextern\tint crypto_devallowsoft;\t/* only use hardware crypto */\n\n/*\n * Crypto-related utility routines used mainly by drivers.\n *\n * XXX these don't really belong here; but for now they're\n *     kept apart from the rest of the system.\n */\nstruct uio;\nextern\tvoid cuio_copydata(struct uio* uio, int off, int len, caddr_t cp);\nextern\tvoid cuio_copyback(struct uio* uio, int off, int len, caddr_t cp);\nextern\tstruct iovec *cuio_getptr(struct uio *uio, int loc, int *off);\nextern\tint cuio_apply(struct uio *uio, int off, int len,\n\t    int (*f)(void *, void *, u_int), void *arg);\n\nextern\tvoid crypto_copyback(int flags, caddr_t buf, int off, int size,\n\t    caddr_t in);\nextern\tvoid crypto_copydata(int flags, caddr_t buf, int off, int size,\n\t    caddr_t out);\nextern\tint crypto_apply(int flags, caddr_t buf, int off, int len,\n\t    int (*f)(void *, void *, u_int), void *arg);\n#endif /* _KERNEL */\n#endif /* _CRYPTO_CRYPTO_H_ */\n"
  },
  {
    "path": "freebsd-headers/crypto/cryptosoft.h",
    "content": "/*\t$FreeBSD: release/9.0.0/sys/opencrypto/cryptosoft.h 167755 2007-03-21 03:42:51Z sam $\t*/\n/*\t$OpenBSD: cryptosoft.h,v 1.10 2002/04/22 23:10:09 deraadt Exp $\t*/\n\n/*-\n * The author of this code is Angelos D. Keromytis (angelos@cis.upenn.edu)\n *\n * This code was written by Angelos D. Keromytis in Athens, Greece, in\n * February 2000. Network Security Technologies Inc. (NSTI) kindly\n * supported the development of this code.\n *\n * Copyright (c) 2000 Angelos D. Keromytis\n *\n * Permission to use, copy, and modify this software with or without fee\n * is hereby granted, provided that this entire notice is included in\n * all source code copies of any software which is or includes a copy or\n * modification of this software.\n *\n * THIS SOFTWARE IS BEING PROVIDED \"AS IS\", WITHOUT ANY EXPRESS OR\n * IMPLIED WARRANTY. IN PARTICULAR, NONE OF THE AUTHORS MAKES ANY\n * REPRESENTATION OR WARRANTY OF ANY KIND CONCERNING THE\n * MERCHANTABILITY OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR\n * PURPOSE.\n */\n\n#ifndef _CRYPTO_CRYPTOSOFT_H_\n#define _CRYPTO_CRYPTOSOFT_H_\n\n/* Software session entry */\nstruct swcr_data {\n\tint\t\tsw_alg;\t\t/* Algorithm */\n\tunion {\n\t\tstruct {\n\t\t\tu_int8_t\t *SW_ictx;\n\t\t\tu_int8_t\t *SW_octx;\n\t\t\tu_int16_t\t SW_klen;\n\t\t\tu_int16_t\t SW_mlen;\n\t\t\tstruct auth_hash *SW_axf;\n\t\t} SWCR_AUTH;\n\t\tstruct {\n\t\t\tu_int8_t\t *SW_kschedule;\n\t\t\tstruct enc_xform *SW_exf;\n\t\t} SWCR_ENC;\n\t\tstruct {\n\t\t\tu_int32_t\t SW_size;\n\t\t\tstruct comp_algo *SW_cxf;\n\t\t} SWCR_COMP;\n\t} SWCR_UN;\n\n#define sw_ictx\t\tSWCR_UN.SWCR_AUTH.SW_ictx\n#define sw_octx\t\tSWCR_UN.SWCR_AUTH.SW_octx\n#define sw_klen\t\tSWCR_UN.SWCR_AUTH.SW_klen\n#define sw_mlen\t\tSWCR_UN.SWCR_AUTH.SW_mlen\n#define sw_axf\t\tSWCR_UN.SWCR_AUTH.SW_axf\n#define sw_kschedule\tSWCR_UN.SWCR_ENC.SW_kschedule\n#define sw_exf\t\tSWCR_UN.SWCR_ENC.SW_exf\n#define sw_size\t\tSWCR_UN.SWCR_COMP.SW_size\n#define sw_cxf\t\tSWCR_UN.SWCR_COMP.SW_cxf\n\n\tstruct swcr_data *sw_next;\n};\n\n#ifdef _KERNEL\nextern u_int8_t hmac_ipad_buffer[];\nextern u_int8_t hmac_opad_buffer[];\n#endif /* _KERNEL */\n\n#endif /* _CRYPTO_CRYPTO_H_ */\n"
  },
  {
    "path": "freebsd-headers/crypto/deflate.h",
    "content": "/*\t$FreeBSD: release/9.0.0/sys/opencrypto/deflate.h 199895 2009-11-28 21:08:19Z bz $\t*/\n/* $OpenBSD: deflate.h,v 1.3 2002/03/14 01:26:51 millert Exp $ */\n\n/*-\n * Copyright (c) 2001 Jean-Jacques Bernard-Gundol (jj@wabbitt.org)\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n *\n * 1. Redistributions of source code must retain the above copyright\n *   notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *   notice, this list of conditions and the following disclaimer in the\n *   documentation and/or other materials provided with the distribution.\n * 3. The name of the author may not be used to endorse or promote products\n *   derived from this software without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR\n * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES\n * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,\n * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF\n * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n */\n\n/*\n * Definition for the wrapper around the deflate compression \n * algorithm used in /sys/crypto\n */\n\n#ifndef _CRYPTO_DEFLATE_H_\n#define _CRYPTO_DEFLATE_H_\n\n#include <net/zlib.h>\n\n#define Z_METHOD\t8\n#define Z_MEMLEVEL\t8\n#define MINCOMP\t\t2\t/* won't be used, but must be defined */\n#define ZBUF\t\t10\n\nu_int32_t deflate_global(u_int8_t *, u_int32_t, int, u_int8_t **);\nvoid *z_alloc(void *, u_int, u_int);\nvoid z_free(void *, void *);\n\n/*\n * We are going to use a combined allocation to hold the metadata\n * from the struct immediately followed by the real application data.\n */\nstruct deflate_buf {\n\tstruct deflate_buf *next;\n\tuint32_t size;\n\tuint8_t data[];\n};\n\n#endif /* _CRYPTO_DEFLATE_H_ */\n"
  },
  {
    "path": "freebsd-headers/crypto/rijndael.h",
    "content": "/*\t$KAME: rijndael.h,v 1.6 2003/08/28 08:36:32 itojun Exp $\t*/\n/*\t$FreeBSD: release/9.0.0/sys/crypto/rijndael/rijndael.h 143431 2005-03-11 22:07:04Z ume $\t*/\n\n/**\n * rijndael-alg-fst.h\n *\n * @version 3.0 (December 2000)\n *\n * Optimised ANSI C code for the Rijndael cipher (now AES)\n *\n * @author Vincent Rijmen <vincent.rijmen@esat.kuleuven.ac.be>\n * @author Antoon Bosselaers <antoon.bosselaers@esat.kuleuven.ac.be>\n * @author Paulo Barreto <paulo.barreto@terra.com.br>\n *\n * This code is hereby placed in the public domain.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ''AS IS'' AND ANY EXPRESS\n * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE\n * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\n * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\n * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR\n * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE\n * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,\n * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n */\n\n#ifndef __RIJNDAEL_H\n#define\t__RIJNDAEL_H\n\n#define RIJNDAEL_MAXKC\t(256/32)\n#define RIJNDAEL_MAXKB\t(256/8)\n#define RIJNDAEL_MAXNR\t14\n\ntypedef struct {\n\tint\tdecrypt;\n\tint\tNr;\t\t/* key-length-dependent number of rounds */\n\tuint32_t ek[4 * (RIJNDAEL_MAXNR + 1)];\t/* encrypt key schedule */\n\tuint32_t dk[4 * (RIJNDAEL_MAXNR + 1)];\t/* decrypt key schedule */\n} rijndael_ctx;\n\nvoid\trijndael_set_key(rijndael_ctx *, const u_char *, int);\nvoid\trijndael_decrypt(const rijndael_ctx *, const u_char *, u_char *);\nvoid\trijndael_encrypt(const rijndael_ctx *, const u_char *, u_char *);\n\nint\trijndaelKeySetupEnc(u_int32_t [/*4*(Nr+1)*/], const u_int8_t [], int);\nint\trijndaelKeySetupDec(u_int32_t [/*4*(Nr+1)*/], const u_int8_t [], int);\nvoid\trijndaelEncrypt(const u_int32_t [/*4*(Nr+1)*/], int,\n\tconst u_int8_t[16], u_int8_t [16]);\nvoid\trijndaelDecrypt(const u_int32_t [/*4*(Nr+1)*/], int,\n\tconst u_int8_t [16], u_int8_t [16]);\n\n#endif /* __RIJNDAEL_H */\n"
  },
  {
    "path": "freebsd-headers/crypto/rmd160.h",
    "content": "/*\t$FreeBSD: release/9.0.0/sys/opencrypto/rmd160.h 139825 2005-01-07 02:29:27Z imp $\t*/\n/*\t$OpenBSD: rmd160.h,v 1.3 2002/03/14 01:26:51 millert Exp $\t*/\n/*-\n * Copyright (c) 2001 Markus Friedl.  All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR\n * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES\n * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,\n * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF\n * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n */\n#ifndef  _RMD160_H\n#define  _RMD160_H\n\n/* RMD160 context. */\ntypedef struct RMD160Context {\n\tu_int32_t state[5];\t/* state */\n\tu_int64_t count;\t/* number of bits, modulo 2^64 */\n\tu_char buffer[64];\t/* input buffer */\n} RMD160_CTX;\n\nvoid\t RMD160Init(RMD160_CTX *);\nvoid\t RMD160Transform(u_int32_t [5], const u_char [64]);\nvoid\t RMD160Update(RMD160_CTX *, const u_char *, u_int32_t);\nvoid\t RMD160Final(u_char [20], RMD160_CTX *);\n\n#endif  /* _RMD160_H */\n"
  },
  {
    "path": "freebsd-headers/crypto/skipjack.h",
    "content": "/*\t$FreeBSD: release/9.0.0/sys/opencrypto/skipjack.h 139825 2005-01-07 02:29:27Z imp $\t*/\n/*\t$OpenBSD: skipjack.h,v 1.3 2002/03/14 01:26:51 millert Exp $\t*/\n\n/*-\n * Further optimized test implementation of SKIPJACK algorithm \n * Mark Tillotson <markt@chaos.org.uk>, 25 June 98\r\n * Optimizations suit RISC (lots of registers) machine best.\n *\n * based on unoptimized implementation of\n * Panu Rissanen <bande@lut.fi> 960624\n *\n * SKIPJACK and KEA Algorithm Specifications \n * Version 2.0 \n * 29 May 1998\n*/\n\nextern void skipjack_forwards(u_int8_t *plain, u_int8_t *cipher, u_int8_t **key);\nextern void skipjack_backwards(u_int8_t *cipher, u_int8_t *plain, u_int8_t **key);\nextern void subkey_table_gen(u_int8_t *key, u_int8_t **key_tables);\n"
  },
  {
    "path": "freebsd-headers/crypto/xform.h",
    "content": "/*\t$FreeBSD: release/9.0.0/sys/opencrypto/xform.h 219026 2011-02-25 09:29:32Z vanhu $\t*/\n/*\t$OpenBSD: xform.h,v 1.8 2001/08/28 12:20:43 ben Exp $\t*/\n\n/*-\n * The author of this code is Angelos D. Keromytis (angelos@cis.upenn.edu)\n *\n * This code was written by Angelos D. Keromytis in Athens, Greece, in\n * February 2000. Network Security Technologies Inc. (NSTI) kindly\n * supported the development of this code.\n *\n * Copyright (c) 2000 Angelos D. Keromytis\n *\n * Permission to use, copy, and modify this software without fee\n * is hereby granted, provided that this entire notice is included in\n * all source code copies of any software which is or includes a copy or\n * modification of this software. \n *\n * THIS SOFTWARE IS BEING PROVIDED \"AS IS\", WITHOUT ANY EXPRESS OR\n * IMPLIED WARRANTY. IN PARTICULAR, NONE OF THE AUTHORS MAKES ANY\n * REPRESENTATION OR WARRANTY OF ANY KIND CONCERNING THE\n * MERCHANTABILITY OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR\n * PURPOSE.\n */\n\n#ifndef _CRYPTO_XFORM_H_\n#define _CRYPTO_XFORM_H_\n\n#include <sys/md5.h>\n#include <crypto/sha1.h>\n#include <crypto/sha2/sha2.h>\n#include <opencrypto/rmd160.h>\n\n/* Declarations */\nstruct auth_hash {\n\tint type;\n\tchar *name;\n\tu_int16_t keysize;\n\tu_int16_t hashsize; \n\tu_int16_t blocksize;\n\tu_int16_t ctxsize;\n\tvoid (*Init) (void *);\n\tint  (*Update) (void *, u_int8_t *, u_int16_t);\n\tvoid (*Final) (u_int8_t *, void *);\n};\n\n/* XXX use a define common with other hash stuff ! */\n#define\tAH_ALEN_MAX\t64\t/* max authenticator hash length */\n\nstruct enc_xform {\n\tint type;\n\tchar *name;\n\tu_int16_t blocksize;\n\tu_int16_t minkey, maxkey;\n\tvoid (*encrypt) (caddr_t, u_int8_t *);\n\tvoid (*decrypt) (caddr_t, u_int8_t *);\n\tint (*setkey) (u_int8_t **, u_int8_t *, int len);\n\tvoid (*zerokey) (u_int8_t **);\n\tvoid (*reinit) (caddr_t, u_int8_t *);\n};\n\nstruct comp_algo {\n\tint type;\n\tchar *name;\n\tsize_t minlen;\n\tu_int32_t (*compress) (u_int8_t *, u_int32_t, u_int8_t **);\n\tu_int32_t (*decompress) (u_int8_t *, u_int32_t, u_int8_t **);\n};\n\nunion authctx {\n\tMD5_CTX md5ctx;\n\tSHA1_CTX sha1ctx;\n\tRMD160_CTX rmd160ctx;\n\tSHA256_CTX sha256ctx;\n\tSHA384_CTX sha384ctx;\n\tSHA512_CTX sha512ctx;\n};\n\nextern struct enc_xform enc_xform_null;\nextern struct enc_xform enc_xform_des;\nextern struct enc_xform enc_xform_3des;\nextern struct enc_xform enc_xform_blf;\nextern struct enc_xform enc_xform_cast5;\nextern struct enc_xform enc_xform_skipjack;\nextern struct enc_xform enc_xform_rijndael128;\nextern struct enc_xform enc_xform_aes_xts;\nextern struct enc_xform enc_xform_arc4;\nextern struct enc_xform enc_xform_camellia;\n\nextern struct auth_hash auth_hash_null;\nextern struct auth_hash auth_hash_key_md5;\nextern struct auth_hash auth_hash_key_sha1;\nextern struct auth_hash auth_hash_hmac_md5;\nextern struct auth_hash auth_hash_hmac_sha1;\nextern struct auth_hash auth_hash_hmac_ripemd_160;\nextern struct auth_hash auth_hash_hmac_sha2_256;\nextern struct auth_hash auth_hash_hmac_sha2_384;\nextern struct auth_hash auth_hash_hmac_sha2_512;\n\nextern struct comp_algo comp_algo_deflate;\n\n#ifdef _KERNEL\n#include <sys/malloc.h>\nMALLOC_DECLARE(M_XDATA);\n#endif\n#endif /* _CRYPTO_XFORM_H_ */\n"
  },
  {
    "path": "freebsd-headers/ctype.h",
    "content": "/*\n * Copyright (c) 1989, 1993\n *\tThe Regents of the University of California.  All rights reserved.\n * (c) UNIX System Laboratories, Inc.\n * All or some portions of this file are derived from material licensed\n * to the University of California by American Telephone and Telegraph\n * Co. or Unix System Laboratories, Inc. and are reproduced herein with\n * the permission of UNIX System Laboratories, Inc.\n *\n * This code is derived from software contributed to Berkeley by\n * Paul Borman at Krystal Technologies.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t@(#)ctype.h\t8.4 (Berkeley) 1/21/94\n *      $FreeBSD: release/9.0.0/include/ctype.h 203964 2010-02-16 19:39:50Z imp $\n */\n\n#ifndef _CTYPE_H_\n#define\t_CTYPE_H_\n\n#include <sys/cdefs.h>\n#include <sys/_types.h>\n#include <_ctype.h>\n\n__BEGIN_DECLS\nint\tisalnum(int);\nint\tisalpha(int);\nint\tiscntrl(int);\nint\tisdigit(int);\nint\tisgraph(int);\nint\tislower(int);\nint\tisprint(int);\nint\tispunct(int);\nint\tisspace(int);\nint\tisupper(int);\nint\tisxdigit(int);\nint\ttolower(int);\nint\ttoupper(int);\n\n#if __XSI_VISIBLE\nint\tisascii(int);\nint\ttoascii(int);\n#endif\n\n#if __ISO_C_VISIBLE >= 1999\nint\tisblank(int);\n#endif\n\n#if __BSD_VISIBLE\nint\tdigittoint(int);\nint\tishexnumber(int);\nint\tisideogram(int);\nint\tisnumber(int);\nint\tisphonogram(int);\nint\tisrune(int);\nint\tisspecial(int);\n#endif\n__END_DECLS\n\n#define\tisalnum(c)\t__sbistype((c), _CTYPE_A|_CTYPE_D)\n#define\tisalpha(c)\t__sbistype((c), _CTYPE_A)\n#define\tiscntrl(c)\t__sbistype((c), _CTYPE_C)\n#define\tisdigit(c)\t__isctype((c), _CTYPE_D) /* ANSI -- locale independent */\n#define\tisgraph(c)\t__sbistype((c), _CTYPE_G)\n#define\tislower(c)\t__sbistype((c), _CTYPE_L)\n#define\tisprint(c)\t__sbistype((c), _CTYPE_R)\n#define\tispunct(c)\t__sbistype((c), _CTYPE_P)\n#define\tisspace(c)\t__sbistype((c), _CTYPE_S)\n#define\tisupper(c)\t__sbistype((c), _CTYPE_U)\n#define\tisxdigit(c)\t__isctype((c), _CTYPE_X) /* ANSI -- locale independent */\n#define\ttolower(c)\t__sbtolower(c)\n#define\ttoupper(c)\t__sbtoupper(c)\n\n#if __XSI_VISIBLE\n/*\n * POSIX.1-2001 specifies _tolower() and _toupper() to be macros equivalent to\n * tolower() and toupper() respectively, minus extra checking to ensure that\n * the argument is a lower or uppercase letter respectively.  We've chosen to\n * implement these macros with the same error checking as tolower() and\n * toupper() since this doesn't violate the specification itself, only its\n * intent.  We purposely leave _tolower() and _toupper() undocumented to\n * discourage their use.\n *\n * XXX isascii() and toascii() should similarly be undocumented.\n */\n#define\t_tolower(c)\t__sbtolower(c)\n#define\t_toupper(c)\t__sbtoupper(c)\n#define\tisascii(c)\t(((c) & ~0x7F) == 0)\n#define\ttoascii(c)\t((c) & 0x7F)\n#endif\n\n#if __ISO_C_VISIBLE >= 1999\n#define\tisblank(c)\t__sbistype((c), _CTYPE_B)\n#endif\n\n#if __BSD_VISIBLE\n#define\tdigittoint(c)\t__sbmaskrune((c), 0xFF)\n#define\tishexnumber(c)\t__sbistype((c), _CTYPE_X)\n#define\tisideogram(c)\t__sbistype((c), _CTYPE_I)\n#define\tisnumber(c)\t__sbistype((c), _CTYPE_D)\n#define\tisphonogram(c)\t__sbistype((c), _CTYPE_Q)\n#define\tisrune(c)\t__sbistype((c), 0xFFFFFF00L)\n#define\tisspecial(c)\t__sbistype((c), _CTYPE_T)\n#endif\n\n#endif /* !_CTYPE_H_ */\n"
  },
  {
    "path": "freebsd-headers/curses.h",
    "content": "/****************************************************************************\n * Copyright (c) 1998-2007,2008 Free Software Foundation, Inc.              *\n *                                                                          *\n * Permission is hereby granted, free of charge, to any person obtaining a  *\n * copy of this software and associated documentation files (the            *\n * \"Software\"), to deal in the Software without restriction, including      *\n * without limitation the rights to use, copy, modify, merge, publish,      *\n * distribute, distribute with modifications, sublicense, and/or sell       *\n * copies of the Software, and to permit persons to whom the Software is    *\n * furnished to do so, subject to the following conditions:                 *\n *                                                                          *\n * The above copyright notice and this permission notice shall be included  *\n * in all copies or substantial portions of the Software.                   *\n *                                                                          *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS  *\n * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF               *\n * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.   *\n * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,   *\n * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR    *\n * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR    *\n * THE USE OR OTHER DEALINGS IN THE SOFTWARE.                               *\n *                                                                          *\n * Except as contained in this notice, the name(s) of the above copyright   *\n * holders shall not be used in advertising or otherwise to promote the     *\n * sale, use or other dealings in this Software without prior written       *\n * authorization.                                                           *\n ****************************************************************************/\n\n/****************************************************************************\n *  Author: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995               *\n *     and: Eric S. Raymond <esr@snark.thyrsus.com>                         *\n *     and: Thomas E. Dickey                        1996-on                 *\n ****************************************************************************/\n\n/* $Id: curses.h.in,v 1.187 2008/08/30 20:11:29 tom Exp $ */\n\n#ifndef __NCURSES_H\n#define __NCURSES_H\n\n#define CURSES 1\n#define CURSES_H 1\n\n/* This should be defined for the enhanced functionality to be visible.\n * However, some of the wide-character (enhanced) functionality is missing.\n * So we do not define it (yet).\n#define _XOPEN_CURSES 1\n */\n\n/* These are defined only in curses.h, and are used for conditional compiles */\n#define NCURSES_VERSION_MAJOR 5\n#define NCURSES_VERSION_MINOR 7\n#define NCURSES_VERSION_PATCH 20081102\n\n/* This is defined in more than one ncurses header, for identification */\n#undef  NCURSES_VERSION\n#define NCURSES_VERSION \"5.7\"\n\n/*\n * Identify the mouse encoding version.\n */\n#define NCURSES_MOUSE_VERSION 1\n\n/*\n * Definitions to facilitate DLL's.\n */\n#include <ncurses_dll.h>\n\n/*\n * User-definable tweak to disable the include of <stdbool.h>.\n */\n#ifndef NCURSES_ENABLE_STDBOOL_H\n#define NCURSES_ENABLE_STDBOOL_H 1\n#endif\n\n/*\n * NCURSES_ATTR_T is used to quiet compiler warnings when building ncurses\n * configured using --disable-macros.\n */\n#ifdef NCURSES_NOMACROS\n#ifndef NCURSES_ATTR_T\n#define NCURSES_ATTR_T attr_t\n#endif\n#endif /* NCURSES_NOMACROS */\n\n#ifndef NCURSES_ATTR_T\n#define NCURSES_ATTR_T int\n#endif\n\n/*\n * Expands to 'const' if ncurses is configured using --enable-const.  Note that\n * doing so makes it incompatible with other implementations of X/Open Curses.\n */\n#undef  NCURSES_CONST\n#define NCURSES_CONST const\n\n#undef NCURSES_INLINE\n#define NCURSES_INLINE inline\n\n/*\n * The internal type used for color values\n */\n#undef\tNCURSES_COLOR_T\n#define\tNCURSES_COLOR_T short\n\n/*\n * Definition used to make WINDOW and similar structs opaque.\n */\n#ifndef NCURSES_OPAQUE\n#define NCURSES_OPAQUE 0\n#endif\n\n/*\n * The internal type used for window dimensions.\n */\n#undef\tNCURSES_SIZE_T\n#define\tNCURSES_SIZE_T short\n\n/*\n * Control whether tparm() supports varargs or fixed-parameter list.\n */\n#undef NCURSES_TPARM_VARARGS\n#define NCURSES_TPARM_VARARGS 1\n\n/*\n * NCURSES_CH_T is used in building the library, but not used otherwise in\n * this header file, since that would make the normal/wide-character versions\n * of the header incompatible.\n */\n#undef\tNCURSES_CH_T\n#define NCURSES_CH_T cchar_t\n\n#if 0 && defined(_LP64)\ntypedef unsigned chtype;\ntypedef unsigned mmask_t;\n#else\ntypedef unsigned long chtype;\ntypedef unsigned long mmask_t;\n#endif\n\n#include <stdio.h>\n#include <unctrl.h>\n#include <stdarg.h>\t/* we need va_list */\n#ifdef _XOPEN_SOURCE_EXTENDED\n#include <stddef.h>\t/* we want wchar_t */\n#endif /* _XOPEN_SOURCE_EXTENDED */\n\n/* X/Open and SVr4 specify that curses implements 'bool'.  However, C++ may also\n * implement it.  If so, we must use the C++ compiler's type to avoid conflict\n * with other interfaces.\n *\n * A further complication is that <stdbool.h> may declare 'bool' to be a\n * different type, such as an enum which is not necessarily compatible with\n * C++.  If we have <stdbool.h>, make 'bool' a macro, so users may #undef it.\n * Otherwise, let it remain a typedef to avoid conflicts with other #define's.\n * In either case, make a typedef for NCURSES_BOOL which can be used if needed\n * from either C or C++.\n */\n\n#undef TRUE\n#define TRUE    1\n\n#undef FALSE\n#define FALSE   0\n\ntypedef unsigned char NCURSES_BOOL;\n\n#if defined(__cplusplus)\t/* __cplusplus, etc. */\n\n/* use the C++ compiler's bool type */\n#define NCURSES_BOOL bool\n\n#else\t\t\t/* c89, c99, etc. */\n\n#if NCURSES_ENABLE_STDBOOL_H\n#include <stdbool.h>\n/* use whatever the C compiler decides bool really is */\n#define NCURSES_BOOL bool\n#else\n/* there is no predefined bool - use our own */\n#undef bool\n#define bool NCURSES_BOOL\n#endif\n\n#endif /* !__cplusplus, etc. */\n\n#ifdef __cplusplus\nextern \"C\" {\n#define NCURSES_CAST(type,value) static_cast<type>(value)\n#else\n#define NCURSES_CAST(type,value) (type)(value)\n#endif\n\n/*\n * X/Open attributes.  In the ncurses implementation, they are identical to the\n * A_ attributes.\n */\n#define WA_ATTRIBUTES\tA_ATTRIBUTES\n#define WA_NORMAL\tA_NORMAL\n#define WA_STANDOUT\tA_STANDOUT\n#define WA_UNDERLINE\tA_UNDERLINE\n#define WA_REVERSE\tA_REVERSE\n#define WA_BLINK\tA_BLINK\n#define WA_DIM\t\tA_DIM\n#define WA_BOLD\t\tA_BOLD\n#define WA_ALTCHARSET\tA_ALTCHARSET\n#define WA_INVIS\tA_INVIS\n#define WA_PROTECT\tA_PROTECT\n#define WA_HORIZONTAL\tA_HORIZONTAL\n#define WA_LEFT\t\tA_LEFT\n#define WA_LOW\t\tA_LOW\n#define WA_RIGHT\tA_RIGHT\n#define WA_TOP\t\tA_TOP\n#define WA_VERTICAL\tA_VERTICAL\n\n/* colors */\n#define COLOR_BLACK\t0\n#define COLOR_RED\t1\n#define COLOR_GREEN\t2\n#define COLOR_YELLOW\t3\n#define COLOR_BLUE\t4\n#define COLOR_MAGENTA\t5\n#define COLOR_CYAN\t6\n#define COLOR_WHITE\t7\n\n/* line graphics */\n\n#if 0 || 0\nNCURSES_WRAPPED_VAR(chtype*, acs_map);\n#define acs_map (_nc_acs_map())\n#else\nextern NCURSES_EXPORT_VAR(chtype) acs_map[];\n#endif\n\n#define NCURSES_ACS(c)\t(acs_map[NCURSES_CAST(unsigned char,c)])\n\n/* VT100 symbols begin here */\n#define ACS_ULCORNER\tNCURSES_ACS('l') /* upper left corner */\n#define ACS_LLCORNER\tNCURSES_ACS('m') /* lower left corner */\n#define ACS_URCORNER\tNCURSES_ACS('k') /* upper right corner */\n#define ACS_LRCORNER\tNCURSES_ACS('j') /* lower right corner */\n#define ACS_LTEE\tNCURSES_ACS('t') /* tee pointing right */\n#define ACS_RTEE\tNCURSES_ACS('u') /* tee pointing left */\n#define ACS_BTEE\tNCURSES_ACS('v') /* tee pointing up */\n#define ACS_TTEE\tNCURSES_ACS('w') /* tee pointing down */\n#define ACS_HLINE\tNCURSES_ACS('q') /* horizontal line */\n#define ACS_VLINE\tNCURSES_ACS('x') /* vertical line */\n#define ACS_PLUS\tNCURSES_ACS('n') /* large plus or crossover */\n#define ACS_S1\t\tNCURSES_ACS('o') /* scan line 1 */\n#define ACS_S9\t\tNCURSES_ACS('s') /* scan line 9 */\n#define ACS_DIAMOND\tNCURSES_ACS('`') /* diamond */\n#define ACS_CKBOARD\tNCURSES_ACS('a') /* checker board (stipple) */\n#define ACS_DEGREE\tNCURSES_ACS('f') /* degree symbol */\n#define ACS_PLMINUS\tNCURSES_ACS('g') /* plus/minus */\n#define ACS_BULLET\tNCURSES_ACS('~') /* bullet */\n/* Teletype 5410v1 symbols begin here */\n#define ACS_LARROW\tNCURSES_ACS(',') /* arrow pointing left */\n#define ACS_RARROW\tNCURSES_ACS('+') /* arrow pointing right */\n#define ACS_DARROW\tNCURSES_ACS('.') /* arrow pointing down */\n#define ACS_UARROW\tNCURSES_ACS('-') /* arrow pointing up */\n#define ACS_BOARD\tNCURSES_ACS('h') /* board of squares */\n#define ACS_LANTERN\tNCURSES_ACS('i') /* lantern symbol */\n#define ACS_BLOCK\tNCURSES_ACS('0') /* solid square block */\n/*\n * These aren't documented, but a lot of System Vs have them anyway\n * (you can spot pprryyzz{{||}} in a lot of AT&T terminfo strings).\n * The ACS_names may not match AT&T's, our source didn't know them.\n */\n#define ACS_S3\t\tNCURSES_ACS('p') /* scan line 3 */\n#define ACS_S7\t\tNCURSES_ACS('r') /* scan line 7 */\n#define ACS_LEQUAL\tNCURSES_ACS('y') /* less/equal */\n#define ACS_GEQUAL\tNCURSES_ACS('z') /* greater/equal */\n#define ACS_PI\t\tNCURSES_ACS('{') /* Pi */\n#define ACS_NEQUAL\tNCURSES_ACS('|') /* not equal */\n#define ACS_STERLING\tNCURSES_ACS('}') /* UK pound sign */\n\n/*\n * Line drawing ACS names are of the form ACS_trbl, where t is the top, r\n * is the right, b is the bottom, and l is the left.  t, r, b, and l might\n * be B (blank), S (single), D (double), or T (thick).  The subset defined\n * here only uses B and S.\n */\n#define ACS_BSSB\tACS_ULCORNER\n#define ACS_SSBB\tACS_LLCORNER\n#define ACS_BBSS\tACS_URCORNER\n#define ACS_SBBS\tACS_LRCORNER\n#define ACS_SBSS\tACS_RTEE\n#define ACS_SSSB\tACS_LTEE\n#define ACS_SSBS\tACS_BTEE\n#define ACS_BSSS\tACS_TTEE\n#define ACS_BSBS\tACS_HLINE\n#define ACS_SBSB\tACS_VLINE\n#define ACS_SSSS\tACS_PLUS\n\n#undef\tERR\n#define ERR     (-1)\n\n#undef\tOK\n#define OK      (0)\n\n/* values for the _flags member */\n#define _SUBWIN         0x01\t/* is this a sub-window? */\n#define _ENDLINE        0x02\t/* is the window flush right? */\n#define _FULLWIN        0x04\t/* is the window full-screen? */\n#define _SCROLLWIN      0x08\t/* bottom edge is at screen bottom? */\n#define _ISPAD\t        0x10\t/* is this window a pad? */\n#define _HASMOVED       0x20\t/* has cursor moved since last refresh? */\n#define _WRAPPED        0x40\t/* cursor was just wrappped */\n\n/*\n * this value is used in the firstchar and lastchar fields to mark\n * unchanged lines\n */\n#define _NOCHANGE       -1\n\n/*\n * this value is used in the oldindex field to mark lines created by insertions\n * and scrolls.\n */\n#define _NEWINDEX\t-1\n\ntypedef struct screen  SCREEN;\ntypedef struct _win_st WINDOW;\n\ntypedef\tchtype\tattr_t;\t\t/* ...must be at least as wide as chtype */\n\n#ifdef _XOPEN_SOURCE_EXTENDED\n\n#if 0\n#ifdef mblen\t\t\t/* libutf8.h defines it w/o undefining first */\n#undef mblen\n#endif\n#include <libutf8.h>\n#endif\n\n#if 1\n#include <wchar.h>\t\t/* ...to get mbstate_t, etc. */\n#endif\n\n#if 0\ntypedef unsigned short wchar_t1;\n#endif\n\n#if 0\ntypedef unsigned int wint_t1;\n#endif\n\n#define CCHARW_MAX\t5\ntypedef struct\n{\n    attr_t\tattr;\n    wchar_t\tchars[CCHARW_MAX];\n#if 0\n#undef NCURSES_EXT_COLORS\n#define NCURSES_EXT_COLORS 20081102\n    int\t\text_color;\t/* color pair, must be more than 16-bits */\n#endif\n}\ncchar_t;\n\n#endif /* _XOPEN_SOURCE_EXTENDED */\n\n#if !NCURSES_OPAQUE\nstruct ldat;\n\nstruct _win_st\n{\n\tNCURSES_SIZE_T _cury, _curx; /* current cursor position */\n\n\t/* window location and size */\n\tNCURSES_SIZE_T _maxy, _maxx; /* maximums of x and y, NOT window size */\n\tNCURSES_SIZE_T _begy, _begx; /* screen coords of upper-left-hand corner */\n\n\tshort   _flags;\t\t/* window state flags */\n\n\t/* attribute tracking */\n\tattr_t  _attrs;\t\t/* current attribute for non-space character */\n\tchtype  _bkgd;\t\t/* current background char/attribute pair */\n\n\t/* option values set by user */\n\tbool\t_notimeout;\t/* no time out on function-key entry? */\n\tbool\t_clear;\t\t/* consider all data in the window invalid? */\n\tbool\t_leaveok;\t/* OK to not reset cursor on exit? */\n\tbool\t_scroll;\t/* OK to scroll this window? */\n\tbool\t_idlok;\t\t/* OK to use insert/delete line? */\n\tbool\t_idcok;\t\t/* OK to use insert/delete char? */\n\tbool\t_immed;\t\t/* window in immed mode? (not yet used) */\n\tbool\t_sync;\t\t/* window in sync mode? */\n\tbool\t_use_keypad;\t/* process function keys into KEY_ symbols? */\n\tint\t_delay;\t\t/* 0 = nodelay, <0 = blocking, >0 = delay */\n\n\tstruct ldat *_line;\t/* the actual line data */\n\n\t/* global screen state */\n\tNCURSES_SIZE_T _regtop;\t/* top line of scrolling region */\n\tNCURSES_SIZE_T _regbottom; /* bottom line of scrolling region */\n\n\t/* these are used only if this is a sub-window */\n\tint\t_parx;\t\t/* x coordinate of this window in parent */\n\tint\t_pary;\t\t/* y coordinate of this window in parent */\n\tWINDOW\t*_parent;\t/* pointer to parent if a sub-window */\n\n\t/* these are used only if this is a pad */\n\tstruct pdat\n\t{\n\t    NCURSES_SIZE_T _pad_y,      _pad_x;\n\t    NCURSES_SIZE_T _pad_top,    _pad_left;\n\t    NCURSES_SIZE_T _pad_bottom, _pad_right;\n\t} _pad;\n\n\tNCURSES_SIZE_T _yoffset; /* real begy is _begy + _yoffset */\n\n#ifdef _XOPEN_SOURCE_EXTENDED\n\tcchar_t  _bkgrnd;\t/* current background char/attribute pair */\n#if 0\n\tint\t_color;\t\t/* current color-pair for non-space character */\n#endif\n#endif\n};\n#endif /* NCURSES_OPAQUE */\n\n/*\n * This is an extension to support events...\n */\n#if 1\n#ifdef NCURSES_WGETCH_EVENTS\n#if !defined(__BEOS__) || defined(__HAIKU__)\n   /* Fix _nc_timed_wait() on BEOS... */\n#  define NCURSES_EVENT_VERSION\t1\n#endif\t/* !defined(__BEOS__) */\n\n/*\n * Bits to set in _nc_event.data.flags\n */\n#  define _NC_EVENT_TIMEOUT_MSEC\t1\n#  define _NC_EVENT_FILE\t\t2\n#  define _NC_EVENT_FILE_READABLE\t2\n#  if 0\t\t\t\t\t/* Not supported yet... */\n#    define _NC_EVENT_FILE_WRITABLE\t4\n#    define _NC_EVENT_FILE_EXCEPTION\t8\n#  endif\n\ntypedef struct\n{\n    int type;\n    union\n    {\n\tlong timeout_msec;\t/* _NC_EVENT_TIMEOUT_MSEC */\n\tstruct\n\t{\n\t    unsigned int flags;\n\t    int fd;\n\t    unsigned int result;\n\t} fev;\t\t\t\t/* _NC_EVENT_FILE */\n    } data;\n} _nc_event;\n\ntypedef struct\n{\n    int count;\n    int result_flags;\t/* _NC_EVENT_TIMEOUT_MSEC or _NC_EVENT_FILE_READABLE */\n    _nc_event *events[1];\n} _nc_eventlist;\n\nextern NCURSES_EXPORT(int) wgetch_events(WINDOW *, _nc_eventlist *);\t/* experimental */\nextern NCURSES_EXPORT(int) wgetnstr_events(WINDOW *,char *,int,_nc_eventlist *);/* experimental */\n\n#endif /* NCURSES_WGETCH_EVENTS */\n#endif /* NCURSES_EXT_FUNCS */\n\n/*\n * GCC (and some other compilers) define '__attribute__'; we're using this\n * macro to alert the compiler to flag inconsistencies in printf/scanf-like\n * function calls.  Just in case '__attribute__' isn't defined, make a dummy.\n * Old versions of G++ do not accept it anyway, at least not consistently with\n * GCC.\n */\n#if !(defined(__GNUC__) || defined(__GNUG__) || defined(__attribute__))\n#define __attribute__(p) /* nothing */\n#endif\n\n/*\n * We cannot define these in ncurses_cfg.h, since they require parameters to be\n * passed (that is non-portable).  If you happen to be using gcc with warnings\n * enabled, define\n *\tGCC_PRINTF\n *\tGCC_SCANF\n * to improve checking of calls to printw(), etc.\n */\n#ifndef GCC_PRINTFLIKE\n#if defined(GCC_PRINTF) && !defined(printf)\n#define GCC_PRINTFLIKE(fmt,var) __attribute__((format(printf,fmt,var)))\n#else\n#define GCC_PRINTFLIKE(fmt,var) /*nothing*/\n#endif\n#endif\n\n#ifndef GCC_SCANFLIKE\n#if defined(GCC_SCANF) && !defined(scanf)\n#define GCC_SCANFLIKE(fmt,var)  __attribute__((format(scanf,fmt,var)))\n#else\n#define GCC_SCANFLIKE(fmt,var)  /*nothing*/\n#endif\n#endif\n\n#ifndef\tGCC_NORETURN\n#define\tGCC_NORETURN /* nothing */\n#endif\n\n#ifndef\tGCC_UNUSED\n#define\tGCC_UNUSED /* nothing */\n#endif\n\n/*\n * Function prototypes.  This is the complete X/Open Curses list of required\n * functions.  Those marked `generated' will have sources generated from the\n * macro definitions later in this file, in order to satisfy XPG4.2\n * requirements.\n */\n\nextern NCURSES_EXPORT(int) addch (const chtype);\t\t\t/* generated */\nextern NCURSES_EXPORT(int) addchnstr (const chtype *, int);\t\t/* generated */\nextern NCURSES_EXPORT(int) addchstr (const chtype *);\t\t\t/* generated */\nextern NCURSES_EXPORT(int) addnstr (const char *, int);\t\t\t/* generated */\nextern NCURSES_EXPORT(int) addstr (const char *);\t\t\t/* generated */\nextern NCURSES_EXPORT(int) attroff (NCURSES_ATTR_T);\t\t\t/* generated */\nextern NCURSES_EXPORT(int) attron (NCURSES_ATTR_T);\t\t\t/* generated */\nextern NCURSES_EXPORT(int) attrset (NCURSES_ATTR_T);\t\t\t/* generated */\nextern NCURSES_EXPORT(int) attr_get (attr_t *, short *, void *);\t/* generated */\nextern NCURSES_EXPORT(int) attr_off (attr_t, void *);\t\t\t/* generated */\nextern NCURSES_EXPORT(int) attr_on (attr_t, void *);\t\t\t/* generated */\nextern NCURSES_EXPORT(int) attr_set (attr_t, short, void *);\t\t/* generated */\nextern NCURSES_EXPORT(int) baudrate (void);\t\t\t\t/* implemented */\nextern NCURSES_EXPORT(int) beep  (void);\t\t\t\t/* implemented */\nextern NCURSES_EXPORT(int) bkgd (chtype);\t\t\t\t/* generated */\nextern NCURSES_EXPORT(void) bkgdset (chtype);\t\t\t\t/* generated */\nextern NCURSES_EXPORT(int) border (chtype,chtype,chtype,chtype,chtype,chtype,chtype,chtype);\t/* generated */\nextern NCURSES_EXPORT(int) box (WINDOW *, chtype, chtype);\t\t/* generated */\nextern NCURSES_EXPORT(bool) can_change_color (void);\t\t\t/* implemented */\nextern NCURSES_EXPORT(int) cbreak (void);\t\t\t\t/* implemented */\nextern NCURSES_EXPORT(int) chgat (int, attr_t, short, const void *);\t/* generated */\nextern NCURSES_EXPORT(int) clear (void);\t\t\t\t/* generated */\nextern NCURSES_EXPORT(int) clearok (WINDOW *,bool);\t\t\t/* implemented */\nextern NCURSES_EXPORT(int) clrtobot (void);\t\t\t\t/* generated */\nextern NCURSES_EXPORT(int) clrtoeol (void);\t\t\t\t/* generated */\nextern NCURSES_EXPORT(int) color_content (short,short*,short*,short*);\t/* implemented */\nextern NCURSES_EXPORT(int) color_set (short,void*);\t\t\t/* generated */\nextern NCURSES_EXPORT(int) COLOR_PAIR (int);\t\t\t\t/* generated */\nextern NCURSES_EXPORT(int) copywin (const WINDOW*,WINDOW*,int,int,int,int,int,int,int);\t/* implemented */\nextern NCURSES_EXPORT(int) curs_set (int);\t\t\t\t/* implemented */\nextern NCURSES_EXPORT(int) def_prog_mode (void);\t\t\t/* implemented */\nextern NCURSES_EXPORT(int) def_shell_mode (void);\t\t\t/* implemented */\nextern NCURSES_EXPORT(int) delay_output (int);\t\t\t\t/* implemented */\nextern NCURSES_EXPORT(int) delch (void);\t\t\t\t/* generated */\nextern NCURSES_EXPORT(void) delscreen (SCREEN *);\t\t\t/* implemented */\nextern NCURSES_EXPORT(int) delwin (WINDOW *);\t\t\t\t/* implemented */\nextern NCURSES_EXPORT(int) deleteln (void);\t\t\t\t/* generated */\nextern NCURSES_EXPORT(WINDOW *) derwin (WINDOW *,int,int,int,int);\t/* implemented */\nextern NCURSES_EXPORT(int) doupdate (void);\t\t\t\t/* implemented */\nextern NCURSES_EXPORT(WINDOW *) dupwin (WINDOW *);\t\t\t/* implemented */\nextern NCURSES_EXPORT(int) echo (void);\t\t\t\t\t/* implemented */\nextern NCURSES_EXPORT(int) echochar (const chtype);\t\t\t/* generated */\nextern NCURSES_EXPORT(int) erase (void);\t\t\t\t/* generated */\nextern NCURSES_EXPORT(int) endwin (void);\t\t\t\t/* implemented */\nextern NCURSES_EXPORT(char) erasechar (void);\t\t\t\t/* implemented */\nextern NCURSES_EXPORT(void) filter (void);\t\t\t\t/* implemented */\nextern NCURSES_EXPORT(int) flash (void);\t\t\t\t/* implemented */\nextern NCURSES_EXPORT(int) flushinp (void);\t\t\t\t/* implemented */\nextern NCURSES_EXPORT(chtype) getbkgd (WINDOW *);\t\t\t/* generated */\nextern NCURSES_EXPORT(int) getch (void);\t\t\t\t/* generated */\nextern NCURSES_EXPORT(int) getnstr (char *, int);\t\t\t/* generated */\nextern NCURSES_EXPORT(int) getstr (char *);\t\t\t\t/* generated */\nextern NCURSES_EXPORT(WINDOW *) getwin (FILE *);\t\t\t/* implemented */\nextern NCURSES_EXPORT(int) halfdelay (int);\t\t\t\t/* implemented */\nextern NCURSES_EXPORT(bool) has_colors (void);\t\t\t\t/* implemented */\nextern NCURSES_EXPORT(bool) has_ic (void);\t\t\t\t/* implemented */\nextern NCURSES_EXPORT(bool) has_il (void);\t\t\t\t/* implemented */\nextern NCURSES_EXPORT(int) hline (chtype, int);\t\t\t\t/* generated */\nextern NCURSES_EXPORT(void) idcok (WINDOW *, bool);\t\t\t/* implemented */\nextern NCURSES_EXPORT(int) idlok (WINDOW *, bool);\t\t\t/* implemented */\nextern NCURSES_EXPORT(void) immedok (WINDOW *, bool);\t\t\t/* implemented */\nextern NCURSES_EXPORT(chtype) inch (void);\t\t\t\t/* generated */\nextern NCURSES_EXPORT(int) inchnstr (chtype *, int);\t\t\t/* generated */\nextern NCURSES_EXPORT(int) inchstr (chtype *);\t\t\t\t/* generated */\nextern NCURSES_EXPORT(WINDOW *) initscr (void);\t\t\t\t/* implemented */\nextern NCURSES_EXPORT(int) init_color (short,short,short,short);\t/* implemented */\nextern NCURSES_EXPORT(int) init_pair (short,short,short);\t\t/* implemented */\nextern NCURSES_EXPORT(int) innstr (char *, int);\t\t\t/* generated */\nextern NCURSES_EXPORT(int) insch (chtype);\t\t\t\t/* generated */\nextern NCURSES_EXPORT(int) insdelln (int);\t\t\t\t/* generated */\nextern NCURSES_EXPORT(int) insertln (void);\t\t\t\t/* generated */\nextern NCURSES_EXPORT(int) insnstr (const char *, int);\t\t\t/* generated */\nextern NCURSES_EXPORT(int) insstr (const char *);\t\t\t/* generated */\nextern NCURSES_EXPORT(int) instr (char *);\t\t\t\t/* generated */\nextern NCURSES_EXPORT(int) intrflush (WINDOW *,bool);\t\t\t/* implemented */\nextern NCURSES_EXPORT(bool) isendwin (void);\t\t\t\t/* implemented */\nextern NCURSES_EXPORT(bool) is_linetouched (WINDOW *,int);\t\t/* implemented */\nextern NCURSES_EXPORT(bool) is_wintouched (WINDOW *);\t\t\t/* implemented */\nextern NCURSES_EXPORT(NCURSES_CONST char *) keyname (int);\t\t/* implemented */\nextern NCURSES_EXPORT(int) keypad (WINDOW *,bool);\t\t\t/* implemented */\nextern NCURSES_EXPORT(char) killchar (void);\t\t\t\t/* implemented */\nextern NCURSES_EXPORT(int) leaveok (WINDOW *,bool);\t\t\t/* implemented */\nextern NCURSES_EXPORT(char *) longname (void);\t\t\t\t/* implemented */\nextern NCURSES_EXPORT(int) meta (WINDOW *,bool);\t\t\t/* implemented */\nextern NCURSES_EXPORT(int) move (int, int);\t\t\t\t/* generated */\nextern NCURSES_EXPORT(int) mvaddch (int, int, const chtype);\t\t/* generated */\nextern NCURSES_EXPORT(int) mvaddchnstr (int, int, const chtype *, int);\t/* generated */\nextern NCURSES_EXPORT(int) mvaddchstr (int, int, const chtype *);\t/* generated */\nextern NCURSES_EXPORT(int) mvaddnstr (int, int, const char *, int);\t/* generated */\nextern NCURSES_EXPORT(int) mvaddstr (int, int, const char *);\t\t/* generated */\nextern NCURSES_EXPORT(int) mvchgat (int, int, int, attr_t, short, const void *);\t/* generated */\nextern NCURSES_EXPORT(int) mvcur (int,int,int,int);\t\t\t/* implemented */\nextern NCURSES_EXPORT(int) mvdelch (int, int);\t\t\t\t/* generated */\nextern NCURSES_EXPORT(int) mvderwin (WINDOW *, int, int);\t\t/* implemented */\nextern NCURSES_EXPORT(int) mvgetch (int, int);\t\t\t\t/* generated */\nextern NCURSES_EXPORT(int) mvgetnstr (int, int, char *, int);\t\t/* generated */\nextern NCURSES_EXPORT(int) mvgetstr (int, int, char *);\t\t\t/* generated */\nextern NCURSES_EXPORT(int) mvhline (int, int, chtype, int);\t\t/* generated */\nextern NCURSES_EXPORT(chtype) mvinch (int, int);\t\t\t/* generated */\nextern NCURSES_EXPORT(int) mvinchnstr (int, int, chtype *, int);\t/* generated */\nextern NCURSES_EXPORT(int) mvinchstr (int, int, chtype *);\t\t/* generated */\nextern NCURSES_EXPORT(int) mvinnstr (int, int, char *, int);\t\t/* generated */\nextern NCURSES_EXPORT(int) mvinsch (int, int, chtype);\t\t\t/* generated */\nextern NCURSES_EXPORT(int) mvinsnstr (int, int, const char *, int);\t/* generated */\nextern NCURSES_EXPORT(int) mvinsstr (int, int, const char *);\t\t/* generated */\nextern NCURSES_EXPORT(int) mvinstr (int, int, char *);\t\t\t/* generated */\nextern NCURSES_EXPORT(int) mvprintw (int,int, const char *,...)\t\t/* implemented */\n\t\tGCC_PRINTFLIKE(3,4);\nextern NCURSES_EXPORT(int) mvscanw (int,int, NCURSES_CONST char *,...)\t/* implemented */\n\t\tGCC_SCANFLIKE(3,4);\nextern NCURSES_EXPORT(int) mvvline (int, int, chtype, int);\t\t/* generated */\nextern NCURSES_EXPORT(int) mvwaddch (WINDOW *, int, int, const chtype);\t/* generated */\nextern NCURSES_EXPORT(int) mvwaddchnstr (WINDOW *, int, int, const chtype *, int);/* generated */\nextern NCURSES_EXPORT(int) mvwaddchstr (WINDOW *, int, int, const chtype *);\t/* generated */\nextern NCURSES_EXPORT(int) mvwaddnstr (WINDOW *, int, int, const char *, int);\t/* generated */\nextern NCURSES_EXPORT(int) mvwaddstr (WINDOW *, int, int, const char *);\t/* generated */\nextern NCURSES_EXPORT(int) mvwchgat (WINDOW *, int, int, int, attr_t, short, const void *);/* generated */\nextern NCURSES_EXPORT(int) mvwdelch (WINDOW *, int, int);\t\t/* generated */\nextern NCURSES_EXPORT(int) mvwgetch (WINDOW *, int, int);\t\t/* generated */\nextern NCURSES_EXPORT(int) mvwgetnstr (WINDOW *, int, int, char *, int);\t/* generated */\nextern NCURSES_EXPORT(int) mvwgetstr (WINDOW *, int, int, char *);\t/* generated */\nextern NCURSES_EXPORT(int) mvwhline (WINDOW *, int, int, chtype, int);\t/* generated */\nextern NCURSES_EXPORT(int) mvwin (WINDOW *,int,int);\t\t\t/* implemented */\nextern NCURSES_EXPORT(chtype) mvwinch (WINDOW *, int, int);\t\t\t/* generated */\nextern NCURSES_EXPORT(int) mvwinchnstr (WINDOW *, int, int, chtype *, int);\t/* generated */\nextern NCURSES_EXPORT(int) mvwinchstr (WINDOW *, int, int, chtype *);\t\t/* generated */\nextern NCURSES_EXPORT(int) mvwinnstr (WINDOW *, int, int, char *, int);\t\t/* generated */\nextern NCURSES_EXPORT(int) mvwinsch (WINDOW *, int, int, chtype);\t\t/* generated */\nextern NCURSES_EXPORT(int) mvwinsnstr (WINDOW *, int, int, const char *, int);\t/* generated */\nextern NCURSES_EXPORT(int) mvwinsstr (WINDOW *, int, int, const char *);\t\t/* generated */\nextern NCURSES_EXPORT(int) mvwinstr (WINDOW *, int, int, char *);\t\t/* generated */\nextern NCURSES_EXPORT(int) mvwprintw (WINDOW*,int,int, const char *,...)\t/* implemented */\n\t\tGCC_PRINTFLIKE(4,5);\nextern NCURSES_EXPORT(int) mvwscanw (WINDOW *,int,int, NCURSES_CONST char *,...)\t/* implemented */\n\t\tGCC_SCANFLIKE(4,5);\nextern NCURSES_EXPORT(int) mvwvline (WINDOW *,int, int, chtype, int);\t/* generated */\nextern NCURSES_EXPORT(int) napms (int);\t\t\t\t\t/* implemented */\nextern NCURSES_EXPORT(WINDOW *) newpad (int,int);\t\t\t\t/* implemented */\nextern NCURSES_EXPORT(SCREEN *) newterm (NCURSES_CONST char *,FILE *,FILE *);\t/* implemented */\nextern NCURSES_EXPORT(WINDOW *) newwin (int,int,int,int);\t\t\t/* implemented */\nextern NCURSES_EXPORT(int) nl (void);\t\t\t\t\t/* implemented */\nextern NCURSES_EXPORT(int) nocbreak (void);\t\t\t\t/* implemented */\nextern NCURSES_EXPORT(int) nodelay (WINDOW *,bool);\t\t\t/* implemented */\nextern NCURSES_EXPORT(int) noecho (void);\t\t\t\t/* implemented */\nextern NCURSES_EXPORT(int) nonl (void);\t\t\t\t\t/* implemented */\nextern NCURSES_EXPORT(void) noqiflush (void);\t\t\t\t/* implemented */\nextern NCURSES_EXPORT(int) noraw (void);\t\t\t\t/* implemented */\nextern NCURSES_EXPORT(int) notimeout (WINDOW *,bool);\t\t\t/* implemented */\nextern NCURSES_EXPORT(int) overlay (const WINDOW*,WINDOW *);\t\t/* implemented */\nextern NCURSES_EXPORT(int) overwrite (const WINDOW*,WINDOW *);\t\t/* implemented */\nextern NCURSES_EXPORT(int) pair_content (short,short*,short*);\t\t/* implemented */\nextern NCURSES_EXPORT(int) PAIR_NUMBER (int);\t\t\t\t/* generated */\nextern NCURSES_EXPORT(int) pechochar (WINDOW *, const chtype);\t\t/* implemented */\nextern NCURSES_EXPORT(int) pnoutrefresh (WINDOW*,int,int,int,int,int,int);/* implemented */\nextern NCURSES_EXPORT(int) prefresh (WINDOW *,int,int,int,int,int,int);\t/* implemented */\nextern NCURSES_EXPORT(int) printw (const char *,...)\t\t\t/* implemented */\n\t\tGCC_PRINTFLIKE(1,2);\nextern NCURSES_EXPORT(int) putwin (WINDOW *, FILE *);\t\t\t/* implemented */\nextern NCURSES_EXPORT(void) qiflush (void);\t\t\t\t/* implemented */\nextern NCURSES_EXPORT(int) raw (void);\t\t\t\t\t/* implemented */\nextern NCURSES_EXPORT(int) redrawwin (WINDOW *);\t\t\t/* generated */\nextern NCURSES_EXPORT(int) refresh (void);\t\t\t\t/* generated */\nextern NCURSES_EXPORT(int) resetty (void);\t\t\t\t/* implemented */\nextern NCURSES_EXPORT(int) reset_prog_mode (void);\t\t\t/* implemented */\nextern NCURSES_EXPORT(int) reset_shell_mode (void);\t\t\t/* implemented */\nextern NCURSES_EXPORT(int) ripoffline (int, int (*)(WINDOW *, int));\t/* implemented */\nextern NCURSES_EXPORT(int) savetty (void);\t\t\t\t/* implemented */\nextern NCURSES_EXPORT(int) scanw (NCURSES_CONST char *,...)\t\t/* implemented */\n\t\tGCC_SCANFLIKE(1,2);\nextern NCURSES_EXPORT(int) scr_dump (const char *);\t\t\t/* implemented */\nextern NCURSES_EXPORT(int) scr_init (const char *);\t\t\t/* implemented */\nextern NCURSES_EXPORT(int) scrl (int);\t\t\t\t\t/* generated */\nextern NCURSES_EXPORT(int) scroll (WINDOW *);\t\t\t\t/* generated */\nextern NCURSES_EXPORT(int) scrollok (WINDOW *,bool);\t\t\t/* implemented */\nextern NCURSES_EXPORT(int) scr_restore (const char *);\t\t\t/* implemented */\nextern NCURSES_EXPORT(int) scr_set (const char *);\t\t\t/* implemented */\nextern NCURSES_EXPORT(int) setscrreg (int,int);\t\t\t\t/* generated */\nextern NCURSES_EXPORT(SCREEN *) set_term (SCREEN *);\t\t\t/* implemented */\nextern NCURSES_EXPORT(int) slk_attroff (const chtype);\t\t\t/* implemented */\nextern NCURSES_EXPORT(int) slk_attr_off (const attr_t, void *);\t\t/* generated:WIDEC */\nextern NCURSES_EXPORT(int) slk_attron (const chtype);\t\t\t/* implemented */\nextern NCURSES_EXPORT(int) slk_attr_on (attr_t,void*);\t\t\t/* generated:WIDEC */\nextern NCURSES_EXPORT(int) slk_attrset (const chtype);\t\t\t/* implemented */\nextern NCURSES_EXPORT(attr_t) slk_attr (void);\t\t\t\t/* implemented */\nextern NCURSES_EXPORT(int) slk_attr_set (const attr_t,short,void*);\t/* implemented */\nextern NCURSES_EXPORT(int) slk_clear (void);\t\t\t\t/* implemented */\nextern NCURSES_EXPORT(int) slk_color (short);\t\t\t\t/* implemented */\nextern NCURSES_EXPORT(int) slk_init (int);\t\t\t\t/* implemented */\nextern NCURSES_EXPORT(char *) slk_label (int);\t\t\t\t/* implemented */\nextern NCURSES_EXPORT(int) slk_noutrefresh (void);\t\t\t/* implemented */\nextern NCURSES_EXPORT(int) slk_refresh (void);\t\t\t\t/* implemented */\nextern NCURSES_EXPORT(int) slk_restore (void);\t\t\t\t/* implemented */\nextern NCURSES_EXPORT(int) slk_set (int,const char *,int);\t\t/* implemented */\nextern NCURSES_EXPORT(int) slk_touch (void);\t\t\t\t/* implemented */\nextern NCURSES_EXPORT(int) standout (void);\t\t\t\t/* generated */\nextern NCURSES_EXPORT(int) standend (void);\t\t\t\t/* generated */\nextern NCURSES_EXPORT(int) start_color (void);\t\t\t\t/* implemented */\nextern NCURSES_EXPORT(WINDOW *) subpad (WINDOW *, int, int, int, int);\t/* implemented */\nextern NCURSES_EXPORT(WINDOW *) subwin (WINDOW *, int, int, int, int);\t/* implemented */\nextern NCURSES_EXPORT(int) syncok (WINDOW *, bool);\t\t\t/* implemented */\nextern NCURSES_EXPORT(chtype) termattrs (void);\t\t\t\t/* implemented */\nextern NCURSES_EXPORT(char *) termname (void);\t\t\t\t/* implemented */\nextern NCURSES_EXPORT(void) timeout (int);\t\t\t\t/* generated */\nextern NCURSES_EXPORT(int) touchline (WINDOW *, int, int);\t\t/* generated */\nextern NCURSES_EXPORT(int) touchwin (WINDOW *);\t\t\t\t/* generated */\nextern NCURSES_EXPORT(int) typeahead (int);\t\t\t\t/* implemented */\nextern NCURSES_EXPORT(int) ungetch (int);\t\t\t\t/* implemented */\nextern NCURSES_EXPORT(int) untouchwin (WINDOW *);\t\t\t/* generated */\nextern NCURSES_EXPORT(void) use_env (bool);\t\t\t\t/* implemented */\nextern NCURSES_EXPORT(int) vidattr (chtype);\t\t\t\t/* implemented */\nextern NCURSES_EXPORT(int) vidputs (chtype, int (*)(int));\t\t/* implemented */\nextern NCURSES_EXPORT(int) vline (chtype, int);\t\t\t\t/* generated */\nextern NCURSES_EXPORT(int) vwprintw (WINDOW *, const char *,va_list);\t/* implemented */\nextern NCURSES_EXPORT(int) vw_printw (WINDOW *, const char *,va_list);\t/* generated */\nextern NCURSES_EXPORT(int) vwscanw (WINDOW *, NCURSES_CONST char *,va_list);\t/* implemented */\nextern NCURSES_EXPORT(int) vw_scanw (WINDOW *, NCURSES_CONST char *,va_list);\t/* generated */\nextern NCURSES_EXPORT(int) waddch (WINDOW *, const chtype);\t\t/* implemented */\nextern NCURSES_EXPORT(int) waddchnstr (WINDOW *,const chtype *,int);\t/* implemented */\nextern NCURSES_EXPORT(int) waddchstr (WINDOW *,const chtype *);\t\t/* generated */\nextern NCURSES_EXPORT(int) waddnstr (WINDOW *,const char *,int);\t/* implemented */\nextern NCURSES_EXPORT(int) waddstr (WINDOW *,const char *);\t\t/* generated */\nextern NCURSES_EXPORT(int) wattron (WINDOW *, int);\t\t\t/* generated */\nextern NCURSES_EXPORT(int) wattroff (WINDOW *, int);\t\t\t/* generated */\nextern NCURSES_EXPORT(int) wattrset (WINDOW *, int);\t\t\t/* generated */\nextern NCURSES_EXPORT(int) wattr_get (WINDOW *, attr_t *, short *, void *);\t/* generated */\nextern NCURSES_EXPORT(int) wattr_on (WINDOW *, attr_t, void *);\t\t/* implemented */\nextern NCURSES_EXPORT(int) wattr_off (WINDOW *, attr_t, void *);\t/* implemented */\nextern NCURSES_EXPORT(int) wattr_set (WINDOW *, attr_t, short, void *);\t/* generated */\nextern NCURSES_EXPORT(int) wbkgd (WINDOW *, chtype);\t\t\t/* implemented */\nextern NCURSES_EXPORT(void) wbkgdset (WINDOW *,chtype);\t\t\t/* implemented */\nextern NCURSES_EXPORT(int) wborder (WINDOW *,chtype,chtype,chtype,chtype,chtype,chtype,chtype,chtype);\t/* implemented */\nextern NCURSES_EXPORT(int) wchgat (WINDOW *, int, attr_t, short, const void *);/* implemented */\nextern NCURSES_EXPORT(int) wclear (WINDOW *);\t\t\t\t/* implemented */\nextern NCURSES_EXPORT(int) wclrtobot (WINDOW *);\t\t\t/* implemented */\nextern NCURSES_EXPORT(int) wclrtoeol (WINDOW *);\t\t\t/* implemented */\nextern NCURSES_EXPORT(int) wcolor_set (WINDOW*,short,void*);\t\t/* implemented */\nextern NCURSES_EXPORT(void) wcursyncup (WINDOW *);\t\t\t/* implemented */\nextern NCURSES_EXPORT(int) wdelch (WINDOW *);\t\t\t\t/* implemented */\nextern NCURSES_EXPORT(int) wdeleteln (WINDOW *);\t\t\t/* generated */\nextern NCURSES_EXPORT(int) wechochar (WINDOW *, const chtype);\t\t/* implemented */\nextern NCURSES_EXPORT(int) werase (WINDOW *);\t\t\t\t/* implemented */\nextern NCURSES_EXPORT(int) wgetch (WINDOW *);\t\t\t\t/* implemented */\nextern NCURSES_EXPORT(int) wgetnstr (WINDOW *,char *,int);\t\t/* implemented */\nextern NCURSES_EXPORT(int) wgetstr (WINDOW *, char *);\t\t\t/* generated */\nextern NCURSES_EXPORT(int) whline (WINDOW *, chtype, int);\t\t/* implemented */\nextern NCURSES_EXPORT(chtype) winch (WINDOW *);\t\t\t\t/* implemented */\nextern NCURSES_EXPORT(int) winchnstr (WINDOW *, chtype *, int);\t\t/* implemented */\nextern NCURSES_EXPORT(int) winchstr (WINDOW *, chtype *);\t\t/* generated */\nextern NCURSES_EXPORT(int) winnstr (WINDOW *, char *, int);\t\t/* implemented */\nextern NCURSES_EXPORT(int) winsch (WINDOW *, chtype);\t\t\t/* implemented */\nextern NCURSES_EXPORT(int) winsdelln (WINDOW *,int);\t\t\t/* implemented */\nextern NCURSES_EXPORT(int) winsertln (WINDOW *);\t\t\t/* generated */\nextern NCURSES_EXPORT(int) winsnstr (WINDOW *, const char *,int);\t/* implemented */\nextern NCURSES_EXPORT(int) winsstr (WINDOW *, const char *);\t\t/* generated */\nextern NCURSES_EXPORT(int) winstr (WINDOW *, char *);\t\t\t/* generated */\nextern NCURSES_EXPORT(int) wmove (WINDOW *,int,int);\t\t\t/* implemented */\nextern NCURSES_EXPORT(int) wnoutrefresh (WINDOW *);\t\t\t/* implemented */\nextern NCURSES_EXPORT(int) wprintw (WINDOW *, const char *,...)\t\t/* implemented */\n\t\tGCC_PRINTFLIKE(2,3);\nextern NCURSES_EXPORT(int) wredrawln (WINDOW *,int,int);\t\t/* implemented */\nextern NCURSES_EXPORT(int) wrefresh (WINDOW *);\t\t\t\t/* implemented */\nextern NCURSES_EXPORT(int) wscanw (WINDOW *, NCURSES_CONST char *,...)\t/* implemented */\n\t\tGCC_SCANFLIKE(2,3);\nextern NCURSES_EXPORT(int) wscrl (WINDOW *,int);\t\t\t/* implemented */\nextern NCURSES_EXPORT(int) wsetscrreg (WINDOW *,int,int);\t\t/* implemented */\nextern NCURSES_EXPORT(int) wstandout (WINDOW *);\t\t\t/* generated */\nextern NCURSES_EXPORT(int) wstandend (WINDOW *);\t\t\t/* generated */\nextern NCURSES_EXPORT(void) wsyncdown (WINDOW *);\t\t\t/* implemented */\nextern NCURSES_EXPORT(void) wsyncup (WINDOW *);\t\t\t\t/* implemented */\nextern NCURSES_EXPORT(void) wtimeout (WINDOW *,int);\t\t\t/* implemented */\nextern NCURSES_EXPORT(int) wtouchln (WINDOW *,int,int,int);\t\t/* implemented */\nextern NCURSES_EXPORT(int) wvline (WINDOW *,chtype,int);\t\t/* implemented */\n\n/*\n * These are also declared in <term.h>:\n */\nextern NCURSES_EXPORT(int) tigetflag (NCURSES_CONST char *);\t\t/* implemented */\nextern NCURSES_EXPORT(int) tigetnum (NCURSES_CONST char *);\t\t/* implemented */\nextern NCURSES_EXPORT(char *) tigetstr (NCURSES_CONST char *);\t\t/* implemented */\nextern NCURSES_EXPORT(int) putp (const char *);\t\t\t\t/* implemented */\n\n#if NCURSES_TPARM_VARARGS\nextern NCURSES_EXPORT(char *) tparm (NCURSES_CONST char *, ...);\t/* special */\n#else\nextern NCURSES_EXPORT(char *) tparm (NCURSES_CONST char *, long,long,long,long,long,long,long,long,long);\t/* special */\nextern NCURSES_EXPORT(char *) tparm_varargs (NCURSES_CONST char *, ...);\t/* special */\n#endif\n\n/*\n * These functions are not in X/Open, but we use them in macro definitions:\n */\nextern NCURSES_EXPORT(int) getattrs (const WINDOW *);\t\t\t/* generated */\nextern NCURSES_EXPORT(int) getcurx (const WINDOW *);\t\t\t/* generated */\nextern NCURSES_EXPORT(int) getcury (const WINDOW *);\t\t\t/* generated */\nextern NCURSES_EXPORT(int) getbegx (const WINDOW *);\t\t\t/* generated */\nextern NCURSES_EXPORT(int) getbegy (const WINDOW *);\t\t\t/* generated */\nextern NCURSES_EXPORT(int) getmaxx (const WINDOW *);\t\t\t/* generated */\nextern NCURSES_EXPORT(int) getmaxy (const WINDOW *);\t\t\t/* generated */\nextern NCURSES_EXPORT(int) getparx (const WINDOW *);\t\t\t/* generated */\nextern NCURSES_EXPORT(int) getpary (const WINDOW *);\t\t\t/* generated */\n\n/*\n * vid_attr() was implemented originally based on a draft of X/Open curses.\n */\n#ifndef _XOPEN_SOURCE_EXTENDED\n#define vid_attr(a,pair,opts) vidattr(a)\n#endif\n\n/*\n * These functions are extensions - not in X/Open Curses.\n */\n#if 1\n#undef  NCURSES_EXT_FUNCS\n#define NCURSES_EXT_FUNCS 20081102\ntypedef int (*NCURSES_WINDOW_CB)(WINDOW *, void *);\ntypedef int (*NCURSES_SCREEN_CB)(SCREEN *, void *);\nextern NCURSES_EXPORT(bool) is_term_resized (int, int);\nextern NCURSES_EXPORT(char *) keybound (int, int);\nextern NCURSES_EXPORT(const char *) curses_version (void);\nextern NCURSES_EXPORT(int) assume_default_colors (int, int);\nextern NCURSES_EXPORT(int) define_key (const char *, int);\nextern NCURSES_EXPORT(int) key_defined (const char *);\nextern NCURSES_EXPORT(int) keyok (int, bool);\nextern NCURSES_EXPORT(int) resize_term (int, int);\nextern NCURSES_EXPORT(int) resizeterm (int, int);\nextern NCURSES_EXPORT(int) set_escdelay (int);\nextern NCURSES_EXPORT(int) set_tabsize (int);\nextern NCURSES_EXPORT(int) use_default_colors (void);\nextern NCURSES_EXPORT(int) use_extended_names (bool);\nextern NCURSES_EXPORT(int) use_legacy_coding (int);\nextern NCURSES_EXPORT(int) use_screen (SCREEN *, NCURSES_SCREEN_CB, void *);\nextern NCURSES_EXPORT(int) use_window (WINDOW *, NCURSES_WINDOW_CB, void *);\nextern NCURSES_EXPORT(int) wresize (WINDOW *, int, int);\nextern NCURSES_EXPORT(void) nofilter(void);\n\n/*\n * These extensions provide access to information stored in the WINDOW even\n * when NCURSES_OPAQUE is set:\n */\nextern NCURSES_EXPORT(WINDOW *) wgetparent (const WINDOW *);\t/* generated */\nextern NCURSES_EXPORT(bool) is_cleared (const WINDOW *);\t/* generated */\nextern NCURSES_EXPORT(bool) is_idcok (const WINDOW *);\t\t/* generated */\nextern NCURSES_EXPORT(bool) is_idlok (const WINDOW *);\t\t/* generated */\nextern NCURSES_EXPORT(bool) is_immedok (const WINDOW *);\t/* generated */\nextern NCURSES_EXPORT(bool) is_keypad (const WINDOW *);\t\t/* generated */\nextern NCURSES_EXPORT(bool) is_leaveok (const WINDOW *);\t/* generated */\nextern NCURSES_EXPORT(bool) is_nodelay (const WINDOW *);\t/* generated */\nextern NCURSES_EXPORT(bool) is_notimeout (const WINDOW *);\t/* generated */\nextern NCURSES_EXPORT(bool) is_scrollok (const WINDOW *);\t/* generated */\nextern NCURSES_EXPORT(bool) is_syncok (const WINDOW *);\t\t/* generated */\nextern NCURSES_EXPORT(int) wgetscrreg (const WINDOW *, int *, int *); /* generated */\n\n#else\n#define curses_version() NCURSES_VERSION\n#endif\n\n/* attributes */\n\n#define NCURSES_ATTR_SHIFT       8\n#define NCURSES_BITS(mask,shift) ((mask) << ((shift) + NCURSES_ATTR_SHIFT))\n\n#define A_NORMAL\t(1UL - 1UL)\n#define A_ATTRIBUTES\tNCURSES_BITS(~(1UL - 1UL),0)\n#define A_CHARTEXT\t(NCURSES_BITS(1UL,0) - 1UL)\n#define A_COLOR\t\tNCURSES_BITS(((1UL) << 8) - 1UL,0)\n#define A_STANDOUT\tNCURSES_BITS(1UL,8)\n#define A_UNDERLINE\tNCURSES_BITS(1UL,9)\n#define A_REVERSE\tNCURSES_BITS(1UL,10)\n#define A_BLINK\t\tNCURSES_BITS(1UL,11)\n#define A_DIM\t\tNCURSES_BITS(1UL,12)\n#define A_BOLD\t\tNCURSES_BITS(1UL,13)\n#define A_ALTCHARSET\tNCURSES_BITS(1UL,14)\n#define A_INVIS\t\tNCURSES_BITS(1UL,15)\n#define A_PROTECT\tNCURSES_BITS(1UL,16)\n#define A_HORIZONTAL\tNCURSES_BITS(1UL,17)\n#define A_LEFT\t\tNCURSES_BITS(1UL,18)\n#define A_LOW\t\tNCURSES_BITS(1UL,19)\n#define A_RIGHT\t\tNCURSES_BITS(1UL,20)\n#define A_TOP\t\tNCURSES_BITS(1UL,21)\n#define A_VERTICAL\tNCURSES_BITS(1UL,22)\n\n/*\n * Most of the pseudo functions are macros that either provide compatibility\n * with older versions of curses, or provide inline functionality to improve\n * performance.\n */\n\n/*\n * These pseudo functions are always implemented as macros:\n */\n\n#define getyx(win,y,x)   \t(y = getcury(win), x = getcurx(win))\n#define getbegyx(win,y,x)\t(y = getbegy(win), x = getbegx(win))\n#define getmaxyx(win,y,x)\t(y = getmaxy(win), x = getmaxx(win))\n#define getparyx(win,y,x)\t(y = getpary(win), x = getparx(win))\n\n#define getsyx(y,x) do { if (newscr) { \\\n\t\t\t     if (is_leaveok(newscr)) \\\n\t\t\t\t(y) = (x) = -1; \\\n\t\t\t     else \\\n\t\t\t\t getyx(newscr,(y), (x)); \\\n\t\t\t} \\\n\t\t    } while(0)\n\n#define setsyx(y,x) do { if (newscr) { \\\n\t\t\t    if ((y) == -1 && (x) == -1) \\\n\t\t\t\tleaveok(newscr, TRUE); \\\n\t\t\t    else { \\\n\t\t\t\tleaveok(newscr, FALSE); \\\n\t\t\t\twmove(newscr, (y), (x)); \\\n\t\t\t    } \\\n\t\t\t} \\\n\t\t    } while(0)\n\n#ifndef NCURSES_NOMACROS\n\n/*\n * These miscellaneous pseudo functions are provided for compatibility:\n */\n\n#define wgetstr(w, s)\t\twgetnstr(w, s, -1)\n#define getnstr(s, n)\t\twgetnstr(stdscr, s, n)\n\n#define setterm(term)\t\tsetupterm(term, 1, (int *)0)\n\n#define fixterm()\t\treset_prog_mode()\n#define resetterm()\t\treset_shell_mode()\n#define saveterm()\t\tdef_prog_mode()\n#define crmode()\t\tcbreak()\n#define nocrmode()\t\tnocbreak()\n#define gettmode()\n\n/* It seems older SYSV curses versions define these */\n#if !NCURSES_OPAQUE\n#define getattrs(win)\t\t((win) ? (win)->_attrs : A_NORMAL)\n#define getcurx(win)\t\t((win) ? (win)->_curx : ERR)\n#define getcury(win)\t\t((win) ? (win)->_cury : ERR)\n#define getbegx(win)\t\t((win) ? (win)->_begx : ERR)\n#define getbegy(win)\t\t((win) ? (win)->_begy : ERR)\n#define getmaxx(win)\t\t((win) ? ((win)->_maxx + 1) : ERR)\n#define getmaxy(win)\t\t((win) ? ((win)->_maxy + 1) : ERR)\n#define getparx(win)\t\t((win) ? (win)->_parx : ERR)\n#define getpary(win)\t\t((win) ? (win)->_pary : ERR)\n#endif /* NCURSES_OPAQUE */\n\n#define wstandout(win)      \t(wattrset(win,A_STANDOUT))\n#define wstandend(win)      \t(wattrset(win,A_NORMAL))\n\n#define wattron(win,at)\t\twattr_on(win, NCURSES_CAST(attr_t, at), NULL)\n#define wattroff(win,at)\twattr_off(win, NCURSES_CAST(attr_t, at), NULL)\n\n#if !NCURSES_OPAQUE\n#if defined(_XOPEN_SOURCE_EXTENDED) && 0\n#define wattrset(win,at)\t((win)->_color = PAIR_NUMBER(at), \\\n\t\t\t\t (win)->_attrs = (at))\n#else\n#define wattrset(win,at)\t((win)->_attrs = (at))\n#endif\n#endif /* NCURSES_OPAQUE */\n\n#define scroll(win)\t\twscrl(win,1)\n\n#define touchwin(win)\t\twtouchln((win), 0, getmaxy(win), 1)\n#define touchline(win, s, c)\twtouchln((win), s, c, 1)\n#define untouchwin(win)\t\twtouchln((win), 0, getmaxy(win), 0)\n\n#define box(win, v, h)\t\twborder(win, v, v, h, h, 0, 0, 0, 0)\n#define border(ls, rs, ts, bs, tl, tr, bl, br)\twborder(stdscr, ls, rs, ts, bs, tl, tr, bl, br)\n#define hline(ch, n)\t\twhline(stdscr, ch, n)\n#define vline(ch, n)\t\twvline(stdscr, ch, n)\n\n#define winstr(w, s)\t\twinnstr(w, s, -1)\n#define winchstr(w, s)\t\twinchnstr(w, s, -1)\n#define winsstr(w, s)\t\twinsnstr(w, s, -1)\n\n#if !NCURSES_OPAQUE\n#define redrawwin(win)\t\twredrawln(win, 0, (win)->_maxy+1)\n#endif /* NCURSES_OPAQUE */\n\n#define waddstr(win,str)\twaddnstr(win,str,-1)\n#define waddchstr(win,str)\twaddchnstr(win,str,-1)\n\n/*\n * These apply to the first 256 color pairs.\n */\n#define COLOR_PAIR(n)\tNCURSES_BITS(n, 0)\n#define PAIR_NUMBER(a)\t(NCURSES_CAST(int,(((a) & A_COLOR) >> NCURSES_ATTR_SHIFT)))\n\n/*\n * pseudo functions for standard screen\n */\n\n#define addch(ch)\t\twaddch(stdscr,ch)\n#define addchnstr(str,n)\twaddchnstr(stdscr,str,n)\n#define addchstr(str)\t\twaddchstr(stdscr,str)\n#define addnstr(str,n)\t\twaddnstr(stdscr,str,n)\n#define addstr(str)\t\twaddnstr(stdscr,str,-1)\n#define attroff(at)\t\twattroff(stdscr,at)\n#define attron(at)\t\twattron(stdscr,at)\n#define attrset(at)\t\twattrset(stdscr,at)\n#define attr_get(ap,cp,o)\twattr_get(stdscr,ap,cp,o)\n#define attr_off(a,o)\t\twattr_off(stdscr,a,o)\n#define attr_on(a,o)\t\twattr_on(stdscr,a,o)\n#define attr_set(a,c,o)\t\twattr_set(stdscr,a,c,o)\n#define bkgd(ch)\t\twbkgd(stdscr,ch)\n#define bkgdset(ch)\t\twbkgdset(stdscr,ch)\n#define chgat(n,a,c,o)\t\twchgat(stdscr,n,a,c,o)\n#define clear()\t\t\twclear(stdscr)\n#define clrtobot()\t\twclrtobot(stdscr)\n#define clrtoeol()\t\twclrtoeol(stdscr)\n#define color_set(c,o)\t\twcolor_set(stdscr,c,o)\n#define delch()\t\t\twdelch(stdscr)\n#define deleteln()\t\twinsdelln(stdscr,-1)\n#define echochar(c)\t\twechochar(stdscr,c)\n#define erase()\t\t\twerase(stdscr)\n#define getch()\t\t\twgetch(stdscr)\n#define getstr(str)\t\twgetstr(stdscr,str)\n#define inch()\t\t\twinch(stdscr)\n#define inchnstr(s,n)\t\twinchnstr(stdscr,s,n)\n#define inchstr(s)\t\twinchstr(stdscr,s)\n#define innstr(s,n)\t\twinnstr(stdscr,s,n)\n#define insch(c)\t\twinsch(stdscr,c)\n#define insdelln(n)\t\twinsdelln(stdscr,n)\n#define insertln()\t\twinsdelln(stdscr,1)\n#define insnstr(s,n)\t\twinsnstr(stdscr,s,n)\n#define insstr(s)\t\twinsstr(stdscr,s)\n#define instr(s)\t\twinstr(stdscr,s)\n#define move(y,x)\t\twmove(stdscr,y,x)\n#define refresh()\t\twrefresh(stdscr)\n#define scrl(n)\t\t\twscrl(stdscr,n)\n#define setscrreg(t,b)\t\twsetscrreg(stdscr,t,b)\n#define standend()\t\twstandend(stdscr)\n#define standout()\t\twstandout(stdscr)\n#define timeout(delay)\t\twtimeout(stdscr,delay)\n#define wdeleteln(win)\t\twinsdelln(win,-1)\n#define winsertln(win)\t\twinsdelln(win,1)\n\n/*\n * mv functions\n */\n\n#define mvwaddch(win,y,x,ch)\t\t(wmove(win,y,x) == ERR ? ERR : waddch(win,ch))\n#define mvwaddchnstr(win,y,x,str,n)\t(wmove(win,y,x) == ERR ? ERR : waddchnstr(win,str,n))\n#define mvwaddchstr(win,y,x,str)\t(wmove(win,y,x) == ERR ? ERR : waddchnstr(win,str,-1))\n#define mvwaddnstr(win,y,x,str,n)\t(wmove(win,y,x) == ERR ? ERR : waddnstr(win,str,n))\n#define mvwaddstr(win,y,x,str)\t\t(wmove(win,y,x) == ERR ? ERR : waddnstr(win,str,-1))\n#define mvwdelch(win,y,x)\t\t(wmove(win,y,x) == ERR ? ERR : wdelch(win))\n#define mvwchgat(win,y,x,n,a,c,o)\t(wmove(win,y,x) == ERR ? ERR : wchgat(win,n,a,c,o))\n#define mvwgetch(win,y,x)\t\t(wmove(win,y,x) == ERR ? ERR : wgetch(win))\n#define mvwgetnstr(win,y,x,str,n)\t(wmove(win,y,x) == ERR ? ERR : wgetnstr(win,str,n))\n#define mvwgetstr(win,y,x,str)\t\t(wmove(win,y,x) == ERR ? ERR : wgetstr(win,str))\n#define mvwhline(win,y,x,c,n)\t\t(wmove(win,y,x) == ERR ? ERR : whline(win,c,n))\n#define mvwinch(win,y,x)\t\t(wmove(win,y,x) == ERR ? NCURSES_CAST(chtype, ERR) : winch(win))\n#define mvwinchnstr(win,y,x,s,n)\t(wmove(win,y,x) == ERR ? ERR : winchnstr(win,s,n))\n#define mvwinchstr(win,y,x,s)\t\t(wmove(win,y,x) == ERR ? ERR : winchstr(win,s))\n#define mvwinnstr(win,y,x,s,n)\t\t(wmove(win,y,x) == ERR ? ERR : winnstr(win,s,n))\n#define mvwinsch(win,y,x,c)\t\t(wmove(win,y,x) == ERR ? ERR : winsch(win,c))\n#define mvwinsnstr(win,y,x,s,n)\t\t(wmove(win,y,x) == ERR ? ERR : winsnstr(win,s,n))\n#define mvwinsstr(win,y,x,s)\t\t(wmove(win,y,x) == ERR ? ERR : winsstr(win,s))\n#define mvwinstr(win,y,x,s)\t\t(wmove(win,y,x) == ERR ? ERR : winstr(win,s))\n#define mvwvline(win,y,x,c,n)\t\t(wmove(win,y,x) == ERR ? ERR : wvline(win,c,n))\n\n#define mvaddch(y,x,ch)\t\t\tmvwaddch(stdscr,y,x,ch)\n#define mvaddchnstr(y,x,str,n)\t\tmvwaddchnstr(stdscr,y,x,str,n)\n#define mvaddchstr(y,x,str)\t\tmvwaddchstr(stdscr,y,x,str)\n#define mvaddnstr(y,x,str,n)\t\tmvwaddnstr(stdscr,y,x,str,n)\n#define mvaddstr(y,x,str)\t\tmvwaddstr(stdscr,y,x,str)\n#define mvchgat(y,x,n,a,c,o)\t\tmvwchgat(stdscr,y,x,n,a,c,o)\n#define mvdelch(y,x)\t\t\tmvwdelch(stdscr,y,x)\n#define mvgetch(y,x)\t\t\tmvwgetch(stdscr,y,x)\n#define mvgetnstr(y,x,str,n)\t\tmvwgetnstr(stdscr,y,x,str,n)\n#define mvgetstr(y,x,str)\t\tmvwgetstr(stdscr,y,x,str)\n#define mvhline(y,x,c,n)\t\tmvwhline(stdscr,y,x,c,n)\n#define mvinch(y,x)\t\t\tmvwinch(stdscr,y,x)\n#define mvinchnstr(y,x,s,n)\t\tmvwinchnstr(stdscr,y,x,s,n)\n#define mvinchstr(y,x,s)\t\tmvwinchstr(stdscr,y,x,s)\n#define mvinnstr(y,x,s,n)\t\tmvwinnstr(stdscr,y,x,s,n)\n#define mvinsch(y,x,c)\t\t\tmvwinsch(stdscr,y,x,c)\n#define mvinsnstr(y,x,s,n)\t\tmvwinsnstr(stdscr,y,x,s,n)\n#define mvinsstr(y,x,s)\t\t\tmvwinsstr(stdscr,y,x,s)\n#define mvinstr(y,x,s)\t\t\tmvwinstr(stdscr,y,x,s)\n#define mvvline(y,x,c,n)\t\tmvwvline(stdscr,y,x,c,n)\n\n/*\n * Some wide-character functions can be implemented without the extensions.\n */\n#if !NCURSES_OPAQUE\n#define getbkgd(win)                    ((win)->_bkgd)\n#endif /* NCURSES_OPAQUE */\n\n#define slk_attr_off(a,v)\t\t((v) ? ERR : slk_attroff(a))\n#define slk_attr_on(a,v)\t\t((v) ? ERR : slk_attron(a))\n\n#if !NCURSES_OPAQUE\n#if defined(_XOPEN_SOURCE_EXTENDED) && 0\n#define wattr_set(win,a,p,opts)\t\t((win)->_attrs = ((a) & ~A_COLOR), \\\n\t\t\t\t\t (win)->_color = (p), \\\n\t\t\t\t\t OK)\n#define wattr_get(win,a,p,opts)\t\t((void)((a) != (void *)0 && (*(a) = (win)->_attrs)), \\\n\t\t\t\t\t (void)((p) != (void *)0 && (*(p) = (win)->_color)), \\\n\t\t\t\t\t OK)\n#else\n#define wattr_set(win,a,p,opts)\t\t((win)->_attrs = (((a) & ~A_COLOR) | COLOR_PAIR(p)), OK)\n#define wattr_get(win,a,p,opts)\t\t((void)((a) != (void *)0 && (*(a) = (win)->_attrs)), \\\n\t\t\t\t\t (void)((p) != (void *)0 && (*(p) = PAIR_NUMBER((win)->_attrs))), \\\n\t\t\t\t\t OK)\n#endif\n#endif /* NCURSES_OPAQUE */\n\n/*\n * X/Open curses deprecates SVr4 vwprintw/vwscanw, which are supposed to use\n * varargs.h.  It adds new calls vw_printw/vw_scanw, which are supposed to\n * use POSIX stdarg.h.  The ncurses versions of vwprintw/vwscanw already\n * use stdarg.h, so...\n */\n#define vw_printw\t\tvwprintw\n#define vw_scanw\t\tvwscanw\n\n/*\n * Export fallback function for use in C++ binding.\n */\n#if !1\n#define vsscanf(a,b,c) _nc_vsscanf(a,b,c)\nNCURSES_EXPORT(int) vsscanf(const char *, const char *, va_list);\n#endif\n\n/*\n * These macros are extensions - not in X/Open Curses.\n */\n#if 1\n#if !NCURSES_OPAQUE\n#define is_cleared(win)\t\t((win)->_clear)\n#define is_idcok(win)\t\t((win)->_idcok)\n#define is_idlok(win)\t\t((win)->_idlok)\n#define is_immedok(win)\t\t((win)->_immed)\n#define is_keypad(win)\t\t((win)->_use_keypad)\n#define is_leaveok(win)\t\t((win)->_leaveok)\n#define is_nodelay(win)\t\t((win)->_delay == 0)\n#define is_notimeout(win)\t((win)->_notimeout)\n#define is_scrollok(win)\t((win)->_scroll)\n#define is_syncok(win)\t\t((win)->_sync)\n#define wgetparent(win)\t\t((win) ? (win)->_parent : 0)\n#define wgetscrreg(win,t,b)\t((win) ? (*(t) = (win)->_regtop, *(b) = (win)->_regbottom, OK) : ERR)\n#endif\n#endif\n\n#endif /* NCURSES_NOMACROS */\n\n/*\n * Public variables.\n *\n * Notes:\n *\ta. ESCDELAY was an undocumented feature under AIX curses.\n *\t   It gives the ESC expire time in milliseconds.\n *\tb. ttytype is needed for backward compatibility\n */\n#if 0\n\nNCURSES_WRAPPED_VAR(WINDOW *, curscr);\nNCURSES_WRAPPED_VAR(WINDOW *, newscr);\nNCURSES_WRAPPED_VAR(WINDOW *, stdscr);\nNCURSES_WRAPPED_VAR(char *, ttytype);\nNCURSES_WRAPPED_VAR(int, COLORS);\nNCURSES_WRAPPED_VAR(int, COLOR_PAIRS);\nNCURSES_WRAPPED_VAR(int, COLS);\nNCURSES_WRAPPED_VAR(int, ESCDELAY);\nNCURSES_WRAPPED_VAR(int, LINES);\nNCURSES_WRAPPED_VAR(int, TABSIZE);\n\n#define curscr      NCURSES_PUBLIC_VAR(curscr())\n#define newscr      NCURSES_PUBLIC_VAR(newscr())\n#define stdscr      NCURSES_PUBLIC_VAR(stdscr())\n#define ttytype     NCURSES_PUBLIC_VAR(ttytype())\n#define COLORS      NCURSES_PUBLIC_VAR(COLORS())\n#define COLOR_PAIRS NCURSES_PUBLIC_VAR(COLOR_PAIRS())\n#define COLS        NCURSES_PUBLIC_VAR(COLS())\n#define ESCDELAY    NCURSES_PUBLIC_VAR(ESCDELAY())\n#define LINES       NCURSES_PUBLIC_VAR(LINES())\n#define TABSIZE     NCURSES_PUBLIC_VAR(TABSIZE())\n\n#else\n\nextern NCURSES_EXPORT_VAR(WINDOW *) curscr;\nextern NCURSES_EXPORT_VAR(WINDOW *) newscr;\nextern NCURSES_EXPORT_VAR(WINDOW *) stdscr;\nextern NCURSES_EXPORT_VAR(char) ttytype[];\nextern NCURSES_EXPORT_VAR(int) COLORS;\nextern NCURSES_EXPORT_VAR(int) COLOR_PAIRS;\nextern NCURSES_EXPORT_VAR(int) COLS;\nextern NCURSES_EXPORT_VAR(int) ESCDELAY;\nextern NCURSES_EXPORT_VAR(int) LINES;\nextern NCURSES_EXPORT_VAR(int) TABSIZE;\n\n#endif\n\n/*\n * Pseudo-character tokens outside ASCII range.  The curses wgetch() function\n * will return any given one of these only if the corresponding k- capability\n * is defined in your terminal's terminfo entry.\n *\n * Some keys (KEY_A1, etc) are arranged like this:\n *\ta1     up    a3\n *\tleft   b2    right\n *\tc1     down  c3\n *\n * A few key codes do not depend upon the terminfo entry.\n */\n#define KEY_CODE_YES\t0400\t\t/* A wchar_t contains a key code */\n#define KEY_MIN\t\t0401\t\t/* Minimum curses key */\n#define KEY_BREAK\t0401\t\t/* Break key (unreliable) */\n#define KEY_SRESET\t0530\t\t/* Soft (partial) reset (unreliable) */\n#define KEY_RESET\t0531\t\t/* Reset or hard reset (unreliable) */\n/*\n * These definitions were generated by /usr/src/lib/ncurses/ncursesw/../../../contrib/ncurses/include/MKkey_defs.sh /usr/src/lib/ncurses/ncursesw/../../../contrib/ncurses/include/Caps\n */\n#define KEY_DOWN\t0402\t\t/* down-arrow key */\n#define KEY_UP\t\t0403\t\t/* up-arrow key */\n#define KEY_LEFT\t0404\t\t/* left-arrow key */\n#define KEY_RIGHT\t0405\t\t/* right-arrow key */\n#define KEY_HOME\t0406\t\t/* home key */\n#define KEY_BACKSPACE\t0407\t\t/* backspace key */\n#define KEY_F0\t\t0410\t\t/* Function keys.  Space for 64 */\n#define KEY_F(n)\t(KEY_F0+(n))\t/* Value of function key n */\n#define KEY_DL\t\t0510\t\t/* delete-line key */\n#define KEY_IL\t\t0511\t\t/* insert-line key */\n#define KEY_DC\t\t0512\t\t/* delete-character key */\n#define KEY_IC\t\t0513\t\t/* insert-character key */\n#define KEY_EIC\t\t0514\t\t/* sent by rmir or smir in insert mode */\n#define KEY_CLEAR\t0515\t\t/* clear-screen or erase key */\n#define KEY_EOS\t\t0516\t\t/* clear-to-end-of-screen key */\n#define KEY_EOL\t\t0517\t\t/* clear-to-end-of-line key */\n#define KEY_SF\t\t0520\t\t/* scroll-forward key */\n#define KEY_SR\t\t0521\t\t/* scroll-backward key */\n#define KEY_NPAGE\t0522\t\t/* next-page key */\n#define KEY_PPAGE\t0523\t\t/* previous-page key */\n#define KEY_STAB\t0524\t\t/* set-tab key */\n#define KEY_CTAB\t0525\t\t/* clear-tab key */\n#define KEY_CATAB\t0526\t\t/* clear-all-tabs key */\n#define KEY_ENTER\t0527\t\t/* enter/send key */\n#define KEY_PRINT\t0532\t\t/* print key */\n#define KEY_LL\t\t0533\t\t/* lower-left key (home down) */\n#define KEY_A1\t\t0534\t\t/* upper left of keypad */\n#define KEY_A3\t\t0535\t\t/* upper right of keypad */\n#define KEY_B2\t\t0536\t\t/* center of keypad */\n#define KEY_C1\t\t0537\t\t/* lower left of keypad */\n#define KEY_C3\t\t0540\t\t/* lower right of keypad */\n#define KEY_BTAB\t0541\t\t/* back-tab key */\n#define KEY_BEG\t\t0542\t\t/* begin key */\n#define KEY_CANCEL\t0543\t\t/* cancel key */\n#define KEY_CLOSE\t0544\t\t/* close key */\n#define KEY_COMMAND\t0545\t\t/* command key */\n#define KEY_COPY\t0546\t\t/* copy key */\n#define KEY_CREATE\t0547\t\t/* create key */\n#define KEY_END\t\t0550\t\t/* end key */\n#define KEY_EXIT\t0551\t\t/* exit key */\n#define KEY_FIND\t0552\t\t/* find key */\n#define KEY_HELP\t0553\t\t/* help key */\n#define KEY_MARK\t0554\t\t/* mark key */\n#define KEY_MESSAGE\t0555\t\t/* message key */\n#define KEY_MOVE\t0556\t\t/* move key */\n#define KEY_NEXT\t0557\t\t/* next key */\n#define KEY_OPEN\t0560\t\t/* open key */\n#define KEY_OPTIONS\t0561\t\t/* options key */\n#define KEY_PREVIOUS\t0562\t\t/* previous key */\n#define KEY_REDO\t0563\t\t/* redo key */\n#define KEY_REFERENCE\t0564\t\t/* reference key */\n#define KEY_REFRESH\t0565\t\t/* refresh key */\n#define KEY_REPLACE\t0566\t\t/* replace key */\n#define KEY_RESTART\t0567\t\t/* restart key */\n#define KEY_RESUME\t0570\t\t/* resume key */\n#define KEY_SAVE\t0571\t\t/* save key */\n#define KEY_SBEG\t0572\t\t/* shifted begin key */\n#define KEY_SCANCEL\t0573\t\t/* shifted cancel key */\n#define KEY_SCOMMAND\t0574\t\t/* shifted command key */\n#define KEY_SCOPY\t0575\t\t/* shifted copy key */\n#define KEY_SCREATE\t0576\t\t/* shifted create key */\n#define KEY_SDC\t\t0577\t\t/* shifted delete-character key */\n#define KEY_SDL\t\t0600\t\t/* shifted delete-line key */\n#define KEY_SELECT\t0601\t\t/* select key */\n#define KEY_SEND\t0602\t\t/* shifted end key */\n#define KEY_SEOL\t0603\t\t/* shifted clear-to-end-of-line key */\n#define KEY_SEXIT\t0604\t\t/* shifted exit key */\n#define KEY_SFIND\t0605\t\t/* shifted find key */\n#define KEY_SHELP\t0606\t\t/* shifted help key */\n#define KEY_SHOME\t0607\t\t/* shifted home key */\n#define KEY_SIC\t\t0610\t\t/* shifted insert-character key */\n#define KEY_SLEFT\t0611\t\t/* shifted left-arrow key */\n#define KEY_SMESSAGE\t0612\t\t/* shifted message key */\n#define KEY_SMOVE\t0613\t\t/* shifted move key */\n#define KEY_SNEXT\t0614\t\t/* shifted next key */\n#define KEY_SOPTIONS\t0615\t\t/* shifted options key */\n#define KEY_SPREVIOUS\t0616\t\t/* shifted previous key */\n#define KEY_SPRINT\t0617\t\t/* shifted print key */\n#define KEY_SREDO\t0620\t\t/* shifted redo key */\n#define KEY_SREPLACE\t0621\t\t/* shifted replace key */\n#define KEY_SRIGHT\t0622\t\t/* shifted right-arrow key */\n#define KEY_SRSUME\t0623\t\t/* shifted resume key */\n#define KEY_SSAVE\t0624\t\t/* shifted save key */\n#define KEY_SSUSPEND\t0625\t\t/* shifted suspend key */\n#define KEY_SUNDO\t0626\t\t/* shifted undo key */\n#define KEY_SUSPEND\t0627\t\t/* suspend key */\n#define KEY_UNDO\t0630\t\t/* undo key */\n#define KEY_MOUSE\t0631\t\t/* Mouse event has occurred */\n#define KEY_RESIZE\t0632\t\t/* Terminal resize event */\n#define KEY_EVENT\t0633\t\t/* We were interrupted by an event */\n\n#define KEY_MAX\t\t0777\t\t/* Maximum key value is 0633 */\n/* $Id: curses.wide,v 1.34 2007/03/10 17:52:23 tom Exp $ */\n/*\n * vile:cmode:\n * This file is part of ncurses, designed to be appended after curses.h.in\n * (see that file for the relevant copyright).\n */\n#ifdef _XOPEN_SOURCE_EXTENDED\n\nextern NCURSES_EXPORT_VAR(cchar_t *) _nc_wacs;\n\n#define NCURSES_WACS(c)\t(&_nc_wacs[(unsigned char)c])\n\n#define WACS_BSSB\tNCURSES_WACS('l')\n#define WACS_SSBB\tNCURSES_WACS('m')\n#define WACS_BBSS\tNCURSES_WACS('k')\n#define WACS_SBBS\tNCURSES_WACS('j')\n#define WACS_SBSS\tNCURSES_WACS('u')\n#define WACS_SSSB\tNCURSES_WACS('t')\n#define WACS_SSBS\tNCURSES_WACS('v')\n#define WACS_BSSS\tNCURSES_WACS('w')\n#define WACS_BSBS\tNCURSES_WACS('q')\n#define WACS_SBSB\tNCURSES_WACS('x')\n#define WACS_SSSS\tNCURSES_WACS('n')\n\n#define WACS_ULCORNER\tWACS_BSSB\n#define WACS_LLCORNER\tWACS_SSBB\n#define WACS_URCORNER\tWACS_BBSS\n#define WACS_LRCORNER\tWACS_SBBS\n#define WACS_RTEE\tWACS_SBSS\n#define WACS_LTEE\tWACS_SSSB\n#define WACS_BTEE\tWACS_SSBS\n#define WACS_TTEE\tWACS_BSSS\n#define WACS_HLINE\tWACS_BSBS\n#define WACS_VLINE\tWACS_SBSB\n#define WACS_PLUS\tWACS_SSSS\n\n#define WACS_S1\t\tNCURSES_WACS('o') /* scan line 1 */\n#define WACS_S9 \tNCURSES_WACS('s') /* scan line 9 */\n#define WACS_DIAMOND\tNCURSES_WACS('`') /* diamond */\n#define WACS_CKBOARD\tNCURSES_WACS('a') /* checker board */\n#define WACS_DEGREE\tNCURSES_WACS('f') /* degree symbol */\n#define WACS_PLMINUS\tNCURSES_WACS('g') /* plus/minus */\n#define WACS_BULLET\tNCURSES_WACS('~') /* bullet */\n\n\t/* Teletype 5410v1 symbols */\n#define WACS_LARROW\tNCURSES_WACS(',') /* arrow left */\n#define WACS_RARROW\tNCURSES_WACS('+') /* arrow right */\n#define WACS_DARROW\tNCURSES_WACS('.') /* arrow down */\n#define WACS_UARROW\tNCURSES_WACS('-') /* arrow up */\n#define WACS_BOARD\tNCURSES_WACS('h') /* board of squares */\n#define WACS_LANTERN\tNCURSES_WACS('i') /* lantern symbol */\n#define WACS_BLOCK\tNCURSES_WACS('0') /* solid square block */\n\n\t/* ncurses extensions */\n#define WACS_S3\t\tNCURSES_WACS('p') /* scan line 3 */\n#define WACS_S7\t\tNCURSES_WACS('r') /* scan line 7 */\n#define WACS_LEQUAL\tNCURSES_WACS('y') /* less/equal */\n#define WACS_GEQUAL\tNCURSES_WACS('z') /* greater/equal */\n#define WACS_PI\t\tNCURSES_WACS('{') /* Pi */\n#define WACS_NEQUAL\tNCURSES_WACS('|') /* not equal */\n#define WACS_STERLING\tNCURSES_WACS('}') /* UK pound sign */\n\n/*\n * Function prototypes for wide-character operations.\n *\n * \"generated\" comments should include \":WIDEC\" to make the corresponding\n * functions ifdef'd in lib_gen.c\n *\n * \"implemented\" comments do not need this marker.\n */\n\nextern NCURSES_EXPORT(int) add_wch (const cchar_t *);\t\t\t/* generated:WIDEC */\nextern NCURSES_EXPORT(int) add_wchnstr (const cchar_t *, int);\t\t/* generated:WIDEC */\nextern NCURSES_EXPORT(int) add_wchstr (const cchar_t *);\t\t/* generated:WIDEC */\nextern NCURSES_EXPORT(int) addnwstr (const wchar_t *, int);\t\t/* generated:WIDEC */\nextern NCURSES_EXPORT(int) addwstr (const wchar_t *);\t\t\t/* generated:WIDEC */\nextern NCURSES_EXPORT(int) bkgrnd (const cchar_t *);\t\t\t/* generated:WIDEC */\nextern NCURSES_EXPORT(void) bkgrndset (const cchar_t *);\t\t/* generated:WIDEC */\nextern 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 */\nextern NCURSES_EXPORT(int) box_set (WINDOW *, const cchar_t *, const cchar_t *);\t/* generated:WIDEC */\nextern NCURSES_EXPORT(int) echo_wchar (const cchar_t *);\t\t/* generated:WIDEC */\nextern NCURSES_EXPORT(int) erasewchar (wchar_t*);\t\t\t/* implemented */\nextern NCURSES_EXPORT(int) get_wch (wint_t *);\t\t\t\t/* generated:WIDEC */\nextern NCURSES_EXPORT(int) get_wstr (wint_t *);\t\t\t\t/* generated:WIDEC */\nextern NCURSES_EXPORT(int) getbkgrnd (cchar_t *);\t\t\t/* generated:WIDEC */\nextern NCURSES_EXPORT(int) getcchar (const cchar_t *, wchar_t*, attr_t*, short*, void*);\t/* implemented */\nextern NCURSES_EXPORT(int) getn_wstr (wint_t *, int);\t\t\t/* generated:WIDEC */\nextern NCURSES_EXPORT(int) hline_set (const cchar_t *, int);\t\t/* generated:WIDEC */\nextern NCURSES_EXPORT(int) in_wch (cchar_t *);\t\t\t\t/* generated:WIDEC */\nextern NCURSES_EXPORT(int) in_wchnstr (cchar_t *, int);\t\t\t/* generated:WIDEC */\nextern NCURSES_EXPORT(int) in_wchstr (cchar_t *);\t\t\t/* generated:WIDEC */\nextern NCURSES_EXPORT(int) innwstr (wchar_t *, int);\t\t\t/* generated:WIDEC */\nextern NCURSES_EXPORT(int) ins_nwstr (const wchar_t *, int);\t\t/* generated:WIDEC */\nextern NCURSES_EXPORT(int) ins_wch (const cchar_t *);\t\t\t/* generated:WIDEC */\nextern NCURSES_EXPORT(int) ins_wstr (const wchar_t *);\t\t\t/* generated:WIDEC */\nextern NCURSES_EXPORT(int) inwstr (wchar_t *);\t\t\t\t/* generated:WIDEC */\nextern NCURSES_EXPORT(NCURSES_CONST char*) key_name (wchar_t);\t\t/* implemented */\nextern NCURSES_EXPORT(int) killwchar (wchar_t *);\t\t\t/* implemented */\nextern NCURSES_EXPORT(int) mvadd_wch (int, int, const cchar_t *);\t/* generated:WIDEC */\nextern NCURSES_EXPORT(int) mvadd_wchnstr (int, int, const cchar_t *, int);/* generated:WIDEC */\nextern NCURSES_EXPORT(int) mvadd_wchstr (int, int, const cchar_t *);\t/* generated:WIDEC */\nextern NCURSES_EXPORT(int) mvaddnwstr (int, int, const wchar_t *, int);\t/* generated:WIDEC */\nextern NCURSES_EXPORT(int) mvaddwstr (int, int, const wchar_t *);\t/* generated:WIDEC */\nextern NCURSES_EXPORT(int) mvget_wch (int, int, wint_t *);\t\t/* generated:WIDEC */\nextern NCURSES_EXPORT(int) mvget_wstr (int, int, wint_t *);\t\t/* generated:WIDEC */\nextern NCURSES_EXPORT(int) mvgetn_wstr (int, int, wint_t *, int);\t/* generated:WIDEC */\nextern NCURSES_EXPORT(int) mvhline_set (int, int, const cchar_t *, int);\t/* generated:WIDEC */\nextern NCURSES_EXPORT(int) mvin_wch (int, int, cchar_t *);\t\t/* generated:WIDEC */\nextern NCURSES_EXPORT(int) mvin_wchnstr (int, int, cchar_t *, int);\t/* generated:WIDEC */\nextern NCURSES_EXPORT(int) mvin_wchstr (int, int, cchar_t *);\t\t/* generated:WIDEC */\nextern NCURSES_EXPORT(int) mvinnwstr (int, int, wchar_t *, int);\t/* generated:WIDEC */\nextern NCURSES_EXPORT(int) mvins_nwstr (int, int, const wchar_t *, int);\t/* generated:WIDEC */\nextern NCURSES_EXPORT(int) mvins_wch (int, int, const cchar_t *);\t/* generated:WIDEC */\nextern NCURSES_EXPORT(int) mvins_wstr (int, int, const wchar_t *);\t/* generated:WIDEC */\nextern NCURSES_EXPORT(int) mvinwstr (int, int, wchar_t *);\t\t/* generated:WIDEC */\nextern NCURSES_EXPORT(int) mvvline_set (int, int, const cchar_t *, int);\t/* generated:WIDEC */\nextern NCURSES_EXPORT(int) mvwadd_wch (WINDOW *, int, int, const cchar_t *);\t/* generated:WIDEC */\nextern NCURSES_EXPORT(int) mvwadd_wchnstr (WINDOW *, int, int, const cchar_t *, int); /* generated:WIDEC */\nextern NCURSES_EXPORT(int) mvwadd_wchstr (WINDOW *, int, int, const cchar_t *);\t/* generated:WIDEC */\nextern NCURSES_EXPORT(int) mvwaddnwstr (WINDOW *, int, int, const wchar_t *, int);/* generated:WIDEC */\nextern NCURSES_EXPORT(int) mvwaddwstr (WINDOW *, int, int, const wchar_t *);\t/* generated:WIDEC */\nextern NCURSES_EXPORT(int) mvwget_wch (WINDOW *, int, int, wint_t *);\t/* generated:WIDEC */\nextern NCURSES_EXPORT(int) mvwget_wstr (WINDOW *, int, int, wint_t *);\t/* generated:WIDEC */\nextern NCURSES_EXPORT(int) mvwgetn_wstr (WINDOW *, int, int, wint_t *, int);/* generated:WIDEC */\nextern NCURSES_EXPORT(int) mvwhline_set (WINDOW *, int, int, const cchar_t *, int);/* generated:WIDEC */\nextern NCURSES_EXPORT(int) mvwin_wch (WINDOW *, int, int, cchar_t *);\t/* generated:WIDEC */\nextern NCURSES_EXPORT(int) mvwin_wchnstr (WINDOW *, int,int, cchar_t *,int);\t/* generated:WIDEC */\nextern NCURSES_EXPORT(int) mvwin_wchstr (WINDOW *, int, int, cchar_t *);\t/* generated:WIDEC */\nextern NCURSES_EXPORT(int) mvwinnwstr (WINDOW *, int, int, wchar_t *, int);\t/* generated:WIDEC */\nextern NCURSES_EXPORT(int) mvwins_nwstr (WINDOW *, int,int, const wchar_t *,int); /* generated:WIDEC */\nextern NCURSES_EXPORT(int) mvwins_wch (WINDOW *, int, int, const cchar_t *);\t/* generated:WIDEC */\nextern NCURSES_EXPORT(int) mvwins_wstr (WINDOW *, int, int, const wchar_t *);\t/* generated:WIDEC */\nextern NCURSES_EXPORT(int) mvwinwstr (WINDOW *, int, int, wchar_t *);\t\t/* generated:WIDEC */\nextern NCURSES_EXPORT(int) mvwvline_set (WINDOW *, int,int, const cchar_t *,int); /* generated:WIDEC */\nextern NCURSES_EXPORT(int) pecho_wchar (WINDOW *, const cchar_t *);\t/* implemented */\nextern NCURSES_EXPORT(int) setcchar (cchar_t *, const wchar_t *, const attr_t, short, const void *);\t/* implemented */\nextern NCURSES_EXPORT(int) slk_wset (int, const wchar_t *, int);\t/* implemented */\nextern NCURSES_EXPORT(attr_t) term_attrs (void);\t\t\t/* implemented */\nextern NCURSES_EXPORT(int) unget_wch (const wchar_t);\t\t\t/* implemented */\nextern NCURSES_EXPORT(int) vid_attr (attr_t, short, void *);\t\t/* implemented */\nextern NCURSES_EXPORT(int) vid_puts (attr_t, short, void *, int (*)(int)); /* implemented */\nextern NCURSES_EXPORT(int) vline_set (const cchar_t *, int);\t\t/* generated:WIDEC */\nextern NCURSES_EXPORT(int) wadd_wch (WINDOW *,const cchar_t *);\t\t/* implemented */\nextern NCURSES_EXPORT(int) wadd_wchnstr (WINDOW *,const cchar_t *,int);\t/* implemented */\nextern NCURSES_EXPORT(int) wadd_wchstr (WINDOW *,const cchar_t *);\t/* generated:WIDEC */\nextern NCURSES_EXPORT(int) waddnwstr (WINDOW *,const wchar_t *,int);\t/* implemented */\nextern NCURSES_EXPORT(int) waddwstr (WINDOW *,const wchar_t *);\t\t/* generated:WIDEC */\nextern NCURSES_EXPORT(int) wbkgrnd (WINDOW *,const cchar_t *);\t\t/* implemented */\nextern NCURSES_EXPORT(void) wbkgrndset (WINDOW *,const cchar_t *);\t/* implemented */\nextern 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*);\t/* implemented */\nextern NCURSES_EXPORT(int) wecho_wchar (WINDOW *, const cchar_t *);\t/* implemented */\nextern NCURSES_EXPORT(int) wget_wch (WINDOW *, wint_t *);\t\t/* implemented */\nextern NCURSES_EXPORT(int) wget_wstr (WINDOW *, wint_t *);\t\t/* generated:WIDEC */\nextern NCURSES_EXPORT(int) wgetbkgrnd (WINDOW *, cchar_t *);\t\t/* generated:WIDEC */\nextern NCURSES_EXPORT(int) wgetn_wstr (WINDOW *,wint_t *, int);\t\t/* implemented */\nextern NCURSES_EXPORT(int) whline_set (WINDOW *, const cchar_t *, int);\t/* implemented */\nextern NCURSES_EXPORT(int) win_wch (WINDOW *, cchar_t *);\t\t/* implemented */\nextern NCURSES_EXPORT(int) win_wchnstr (WINDOW *, cchar_t *, int);\t/* implemented */\nextern NCURSES_EXPORT(int) win_wchstr (WINDOW *, cchar_t *);\t\t/* generated:WIDEC */\nextern NCURSES_EXPORT(int) winnwstr (WINDOW *, wchar_t *, int);\t\t/* implemented */\nextern NCURSES_EXPORT(int) wins_nwstr (WINDOW *, const wchar_t *, int);\t/* implemented */\nextern NCURSES_EXPORT(int) wins_wch (WINDOW *, const cchar_t *);\t/* implemented */\nextern NCURSES_EXPORT(int) wins_wstr (WINDOW *, const wchar_t *);\t/* generated:WIDEC */\nextern NCURSES_EXPORT(int) winwstr (WINDOW *, wchar_t *);\t\t/* implemented */\nextern NCURSES_EXPORT(wchar_t*) wunctrl (cchar_t *);\t\t\t/* implemented */\nextern NCURSES_EXPORT(int) wvline_set (WINDOW *, const cchar_t *, int);\t/* implemented */\n\n#ifndef NCURSES_NOMACROS\n\n/*\n * XSI curses macros for XPG4 conformance.\n */\n#define add_wch(c)\t\t\twadd_wch(stdscr,c)\n#define add_wchnstr(str,n)\t\twadd_wchnstr(stdscr,str,n)\n#define add_wchstr(str)\t\t\twadd_wchstr(stdscr,str)\n#define addnwstr(wstr,n)\t\twaddnwstr(stdscr,wstr,n)\n#define addwstr(wstr)\t\t\twaddwstr(stdscr,wstr)\n#define bkgrnd(c)\t\t\twbkgrnd(stdscr,c)\n#define bkgrndset(c)\t\t\twbkgrndset(stdscr,c)\n#define border_set(l,r,t,b,tl,tr,bl,br) wborder_set(stdscr,l,r,t,b,tl,tr,bl,br)\n#define box_set(w,v,h)\t\t\twborder_set(w,v,v,h,h,0,0,0,0)\n#define echo_wchar(c)\t\t\twecho_wchar(stdscr,c)\n#define get_wch(c)\t\t\twget_wch(stdscr,c)\n#define get_wstr(t)\t\t\twget_wstr(stdscr,t)\n#define getbkgrnd(wch)\t\t\twgetbkgrnd(stdscr,wch)\n#define getn_wstr(t,n)\t\t\twgetn_wstr(stdscr,t,n)\n#define hline_set(c,n)\t\t\twhline_set(stdscr,c,n)\n#define in_wch(c)\t\t\twin_wch(stdscr,c)\n#define in_wchnstr(c,n)\t\t\twin_wchnstr(stdscr,c,n)\n#define in_wchstr(c)\t\t\twin_wchstr(stdscr,c)\n#define innwstr(c,n)\t\t\twinnwstr(stdscr,c,n)\n#define ins_nwstr(t,n)\t\t\twins_nwstr(stdscr,t,n)\n#define ins_wch(c)\t\t\twins_wch(stdscr,c)\n#define ins_wstr(t)\t\t\twins_wstr(stdscr,t)\n#define inwstr(c)\t\t\twinwstr(stdscr,c)\n#define vline_set(c,n)\t\t\twvline_set(stdscr,c,n)\n#define wadd_wchstr(win,str)\t\twadd_wchnstr(win,str,-1)\n#define waddwstr(win,wstr)\t\twaddnwstr(win,wstr,-1)\n#define wget_wstr(w,t)\t\t\twgetn_wstr(w,t,-1)\n#define win_wchstr(w,c)\t\t\twin_wchnstr(w,c,-1)\n#define wins_wstr(w,t)\t\t\twins_nwstr(w,t,-1)\n\n#if !NCURSES_OPAQUE\n#define wgetbkgrnd(win,wch)\t\t(*wch = win->_bkgrnd, OK)\n#endif\n\n#define mvadd_wch(y,x,c)\t\tmvwadd_wch(stdscr,y,x,c)\n#define mvadd_wchnstr(y,x,s,n)\t\tmvwadd_wchnstr(stdscr,y,x,s,n)\n#define mvadd_wchstr(y,x,s)\t\tmvwadd_wchstr(stdscr,y,x,s)\n#define mvaddnwstr(y,x,wstr,n)\t\tmvwaddnwstr(stdscr,y,x,wstr,n)\n#define mvaddwstr(y,x,wstr)\t\tmvwaddwstr(stdscr,y,x,wstr)\n#define mvget_wch(y,x,c)\t\tmvwget_wch(stdscr,y,x,c)\n#define mvget_wstr(y,x,t)\t\tmvwget_wstr(stdscr,y,x,t)\n#define mvgetn_wstr(y,x,t,n)\t\tmvwgetn_wstr(stdscr,y,x,t,n)\n#define mvhline_set(y,x,c,n)\t\tmvwhline_set(stdscr,y,x,c,n)\n#define mvin_wch(y,x,c)\t\t\tmvwin_wch(stdscr,y,x,c)\n#define mvin_wchnstr(y,x,c,n)\t\tmvwin_wchnstr(stdscr,y,x,c,n)\n#define mvin_wchstr(y,x,c)\t\tmvwin_wchstr(stdscr,y,x,c)\n#define mvinnwstr(y,x,c,n)\t\tmvwinnwstr(stdscr,y,x,c,n)\n#define mvins_nwstr(y,x,t,n)\t\tmvwins_nwstr(stdscr,y,x,t,n)\n#define mvins_wch(y,x,c)\t\tmvwins_wch(stdscr,y,x,c)\n#define mvins_wstr(y,x,t)\t\tmvwins_wstr(stdscr,y,x,t)\n#define mvinwstr(y,x,c)\t\t\tmvwinwstr(stdscr,y,x,c)\n#define mvvline_set(y,x,c,n)\t\tmvwvline_set(stdscr,y,x,c,n)\n\n#define mvwadd_wch(win,y,x,c)\t\t(wmove(win,y,x) == ERR ? ERR : wadd_wch(win,c))\n#define mvwadd_wchnstr(win,y,x,s,n)\t(wmove(win,y,x) == ERR ? ERR : wadd_wchnstr(win,s,n))\n#define mvwadd_wchstr(win,y,x,s)\t(wmove(win,y,x) == ERR ? ERR : wadd_wchstr(win,s))\n#define mvwaddnwstr(win,y,x,wstr,n)\t(wmove(win,y,x) == ERR ? ERR : waddnwstr(win,wstr,n))\n#define mvwaddwstr(win,y,x,wstr)\t(wmove(win,y,x) == ERR ? ERR : waddwstr(win,wstr))\n#define mvwget_wch(win,y,x,c)\t\t(wmove(win,y,x) == ERR ? ERR : wget_wch(win,c))\n#define mvwget_wstr(win,y,x,t)\t\t(wmove(win,y,x) == ERR ? ERR : wget_wstr(win,t))\n#define mvwgetn_wstr(win,y,x,t,n)\t(wmove(win,y,x) == ERR ? ERR : wgetn_wstr(win,t,n))\n#define mvwhline_set(win,y,x,c,n)\t(wmove(win,y,x) == ERR ? ERR : whline_set(win,c,n))\n#define mvwin_wch(win,y,x,c)\t\t(wmove(win,y,x) == ERR ? ERR : win_wch(win,c))\n#define mvwin_wchnstr(win,y,x,c,n)\t(wmove(win,y,x) == ERR ? ERR : win_wchnstr(win,c,n))\n#define mvwin_wchstr(win,y,x,c)\t\t(wmove(win,y,x) == ERR ? ERR : win_wchstr(win,c))\n#define mvwinnwstr(win,y,x,c,n)\t\t(wmove(win,y,x) == ERR ? ERR : winnwstr(win,c,n))\n#define mvwins_nwstr(win,y,x,t,n)\t(wmove(win,y,x) == ERR ? ERR : wins_nwstr(win,t,n))\n#define mvwins_wch(win,y,x,c)\t\t(wmove(win,y,x) == ERR ? ERR : wins_wch(win,c))\n#define mvwins_wstr(win,y,x,t)\t\t(wmove(win,y,x) == ERR ? ERR : wins_wstr(win,t))\n#define mvwinwstr(win,y,x,c)\t\t(wmove(win,y,x) == ERR ? ERR : winwstr(win,c))\n#define mvwvline_set(win,y,x,c,n)\t(wmove(win,y,x) == ERR ? ERR : wvline_set(win,c,n))\n\n#endif /* NCURSES_NOMACROS */\n\n#if defined(TRACE) || defined(NCURSES_TEST)\nextern NCURSES_EXPORT(const char *) _nc_viswbuf(const wchar_t *);\nextern NCURSES_EXPORT(const char *) _nc_viswibuf(const wint_t *);\n#endif\n\n#endif /* _XOPEN_SOURCE_EXTENDED */\n/* $Id: curses.tail,v 1.16 2008/07/05 20:20:38 tom Exp $ */\n/*\n * vile:cmode:\n * This file is part of ncurses, designed to be appended after curses.h.in\n * (see that file for the relevant copyright).\n */\n\n/* mouse interface */\n\n#if NCURSES_MOUSE_VERSION > 1\n#define NCURSES_MOUSE_MASK(b,m) ((m) << (((b) - 1) * 5))\n#else\n#define NCURSES_MOUSE_MASK(b,m) ((m) << (((b) - 1) * 6))\n#endif\n\n#define\tNCURSES_BUTTON_RELEASED\t001L\n#define\tNCURSES_BUTTON_PRESSED\t002L\n#define\tNCURSES_BUTTON_CLICKED\t004L\n#define\tNCURSES_DOUBLE_CLICKED\t010L\n#define\tNCURSES_TRIPLE_CLICKED\t020L\n#define\tNCURSES_RESERVED_EVENT\t040L\n\n/* event masks */\n#define\tBUTTON1_RELEASED\tNCURSES_MOUSE_MASK(1, NCURSES_BUTTON_RELEASED)\n#define\tBUTTON1_PRESSED\t\tNCURSES_MOUSE_MASK(1, NCURSES_BUTTON_PRESSED)\n#define\tBUTTON1_CLICKED\t\tNCURSES_MOUSE_MASK(1, NCURSES_BUTTON_CLICKED)\n#define\tBUTTON1_DOUBLE_CLICKED\tNCURSES_MOUSE_MASK(1, NCURSES_DOUBLE_CLICKED)\n#define\tBUTTON1_TRIPLE_CLICKED\tNCURSES_MOUSE_MASK(1, NCURSES_TRIPLE_CLICKED)\n\n#define\tBUTTON2_RELEASED\tNCURSES_MOUSE_MASK(2, NCURSES_BUTTON_RELEASED)\n#define\tBUTTON2_PRESSED\t\tNCURSES_MOUSE_MASK(2, NCURSES_BUTTON_PRESSED)\n#define\tBUTTON2_CLICKED\t\tNCURSES_MOUSE_MASK(2, NCURSES_BUTTON_CLICKED)\n#define\tBUTTON2_DOUBLE_CLICKED\tNCURSES_MOUSE_MASK(2, NCURSES_DOUBLE_CLICKED)\n#define\tBUTTON2_TRIPLE_CLICKED\tNCURSES_MOUSE_MASK(2, NCURSES_TRIPLE_CLICKED)\n\n#define\tBUTTON3_RELEASED\tNCURSES_MOUSE_MASK(3, NCURSES_BUTTON_RELEASED)\n#define\tBUTTON3_PRESSED\t\tNCURSES_MOUSE_MASK(3, NCURSES_BUTTON_PRESSED)\n#define\tBUTTON3_CLICKED\t\tNCURSES_MOUSE_MASK(3, NCURSES_BUTTON_CLICKED)\n#define\tBUTTON3_DOUBLE_CLICKED\tNCURSES_MOUSE_MASK(3, NCURSES_DOUBLE_CLICKED)\n#define\tBUTTON3_TRIPLE_CLICKED\tNCURSES_MOUSE_MASK(3, NCURSES_TRIPLE_CLICKED)\n\n#define\tBUTTON4_RELEASED\tNCURSES_MOUSE_MASK(4, NCURSES_BUTTON_RELEASED)\n#define\tBUTTON4_PRESSED\t\tNCURSES_MOUSE_MASK(4, NCURSES_BUTTON_PRESSED)\n#define\tBUTTON4_CLICKED\t\tNCURSES_MOUSE_MASK(4, NCURSES_BUTTON_CLICKED)\n#define\tBUTTON4_DOUBLE_CLICKED\tNCURSES_MOUSE_MASK(4, NCURSES_DOUBLE_CLICKED)\n#define\tBUTTON4_TRIPLE_CLICKED\tNCURSES_MOUSE_MASK(4, NCURSES_TRIPLE_CLICKED)\n\n/*\n * In 32 bits the version-1 scheme does not provide enough space for a 5th\n * button, unless we choose to change the ABI by omitting the reserved-events.\n */\n#if NCURSES_MOUSE_VERSION > 1\n\n#define\tBUTTON5_RELEASED\tNCURSES_MOUSE_MASK(5, NCURSES_BUTTON_RELEASED)\n#define\tBUTTON5_PRESSED\t\tNCURSES_MOUSE_MASK(5, NCURSES_BUTTON_PRESSED)\n#define\tBUTTON5_CLICKED\t\tNCURSES_MOUSE_MASK(5, NCURSES_BUTTON_CLICKED)\n#define\tBUTTON5_DOUBLE_CLICKED\tNCURSES_MOUSE_MASK(5, NCURSES_DOUBLE_CLICKED)\n#define\tBUTTON5_TRIPLE_CLICKED\tNCURSES_MOUSE_MASK(5, NCURSES_TRIPLE_CLICKED)\n\n#define\tBUTTON_CTRL\t\tNCURSES_MOUSE_MASK(6, 0001L)\n#define\tBUTTON_SHIFT\t\tNCURSES_MOUSE_MASK(6, 0002L)\n#define\tBUTTON_ALT\t\tNCURSES_MOUSE_MASK(6, 0004L)\n#define\tREPORT_MOUSE_POSITION\tNCURSES_MOUSE_MASK(6, 0010L)\n\n#else\n\n#define\tBUTTON1_RESERVED_EVENT\tNCURSES_MOUSE_MASK(1, NCURSES_RESERVED_EVENT)\n#define\tBUTTON2_RESERVED_EVENT\tNCURSES_MOUSE_MASK(2, NCURSES_RESERVED_EVENT)\n#define\tBUTTON3_RESERVED_EVENT\tNCURSES_MOUSE_MASK(3, NCURSES_RESERVED_EVENT)\n#define\tBUTTON4_RESERVED_EVENT\tNCURSES_MOUSE_MASK(4, NCURSES_RESERVED_EVENT)\n\n#define\tBUTTON_CTRL\t\tNCURSES_MOUSE_MASK(5, 0001L)\n#define\tBUTTON_SHIFT\t\tNCURSES_MOUSE_MASK(5, 0002L)\n#define\tBUTTON_ALT\t\tNCURSES_MOUSE_MASK(5, 0004L)\n#define\tREPORT_MOUSE_POSITION\tNCURSES_MOUSE_MASK(5, 0010L)\n\n#endif\n\n#define\tALL_MOUSE_EVENTS\t(REPORT_MOUSE_POSITION - 1)\n\n/* macros to extract single event-bits from masks */\n#define\tBUTTON_RELEASE(e, x)\t\t((e) & NCURSES_MOUSE_MASK(x, 001))\n#define\tBUTTON_PRESS(e, x)\t\t((e) & NCURSES_MOUSE_MASK(x, 002))\n#define\tBUTTON_CLICK(e, x)\t\t((e) & NCURSES_MOUSE_MASK(x, 004))\n#define\tBUTTON_DOUBLE_CLICK(e, x)\t((e) & NCURSES_MOUSE_MASK(x, 010))\n#define\tBUTTON_TRIPLE_CLICK(e, x)\t((e) & NCURSES_MOUSE_MASK(x, 020))\n#define\tBUTTON_RESERVED_EVENT(e, x)\t((e) & NCURSES_MOUSE_MASK(x, 040))\n\ntypedef struct\n{\n    short id;\t\t/* ID to distinguish multiple devices */\n    int x, y, z;\t/* event coordinates (character-cell) */\n    mmask_t bstate;\t/* button state bits */\n}\nMEVENT;\n\nextern NCURSES_EXPORT(int) getmouse (MEVENT *);\nextern NCURSES_EXPORT(int) ungetmouse (MEVENT *);\nextern NCURSES_EXPORT(mmask_t) mousemask (mmask_t, mmask_t *);\nextern NCURSES_EXPORT(bool) wenclose (const WINDOW *, int, int);\nextern NCURSES_EXPORT(int) mouseinterval (int);\nextern NCURSES_EXPORT(bool) wmouse_trafo (const WINDOW*, int*, int*, bool);\nextern NCURSES_EXPORT(bool) mouse_trafo (int*, int*, bool);              /* generated */\n\n#define mouse_trafo(y,x,to_screen) wmouse_trafo(stdscr,y,x,to_screen)\n\n/* other non-XSI functions */\n\nextern NCURSES_EXPORT(int) mcprint (char *, int);\t/* direct data to printer */\nextern NCURSES_EXPORT(int) has_key (int);\t\t/* do we have given key? */\n\n/* Debugging : use with libncurses_g.a */\n\nextern NCURSES_EXPORT(void) _tracef (const char *, ...) GCC_PRINTFLIKE(1,2);\nextern NCURSES_EXPORT(void) _tracedump (const char *, WINDOW *);\nextern NCURSES_EXPORT(char *) _traceattr (attr_t);\nextern NCURSES_EXPORT(char *) _traceattr2 (int, chtype);\nextern NCURSES_EXPORT(char *) _nc_tracebits (void);\nextern NCURSES_EXPORT(char *) _tracechar (int);\nextern NCURSES_EXPORT(char *) _tracechtype (chtype);\nextern NCURSES_EXPORT(char *) _tracechtype2 (int, chtype);\n#ifdef _XOPEN_SOURCE_EXTENDED\n#define _tracech_t\t\t_tracecchar_t\nextern NCURSES_EXPORT(char *) _tracecchar_t (const cchar_t *);\n#define _tracech_t2\t\t_tracecchar_t2\nextern NCURSES_EXPORT(char *) _tracecchar_t2 (int, const cchar_t *);\n#else\n#define _tracech_t\t\t_tracechtype\n#define _tracech_t2\t\t_tracechtype2\n#endif\nextern NCURSES_EXPORT(char *) _tracemouse (const MEVENT *);\nextern NCURSES_EXPORT(void) trace (const unsigned int);\n\n/* trace masks */\n#define TRACE_DISABLE\t0x0000\t/* turn off tracing */\n#define TRACE_TIMES\t0x0001\t/* trace user and system times of updates */\n#define TRACE_TPUTS\t0x0002\t/* trace tputs calls */\n#define TRACE_UPDATE\t0x0004\t/* trace update actions, old & new screens */\n#define TRACE_MOVE\t0x0008\t/* trace cursor moves and scrolls */\n#define TRACE_CHARPUT\t0x0010\t/* trace all character outputs */\n#define TRACE_ORDINARY\t0x001F\t/* trace all update actions */\n#define TRACE_CALLS\t0x0020\t/* trace all curses calls */\n#define TRACE_VIRTPUT\t0x0040\t/* trace virtual character puts */\n#define TRACE_IEVENT\t0x0080\t/* trace low-level input processing */\n#define TRACE_BITS\t0x0100\t/* trace state of TTY control bits */\n#define TRACE_ICALLS\t0x0200\t/* trace internal/nested calls */\n#define TRACE_CCALLS\t0x0400\t/* trace per-character calls */\n#define TRACE_DATABASE\t0x0800\t/* trace read/write of terminfo/termcap data */\n#define TRACE_ATTRS\t0x1000\t/* trace attribute updates */\n\n#define TRACE_SHIFT\t13\t/* number of bits in the trace masks */\n#define TRACE_MAXIMUM\t((1 << TRACE_SHIFT) - 1) /* maximum trace level */\n\n#if defined(TRACE) || defined(NCURSES_TEST)\nextern NCURSES_EXPORT_VAR(int) _nc_optimize_enable;\t\t/* enable optimizations */\nextern NCURSES_EXPORT(const char *) _nc_visbuf (const char *);\n#define OPTIMIZE_MVCUR\t\t0x01\t/* cursor movement optimization */\n#define OPTIMIZE_HASHMAP\t0x02\t/* diff hashing to detect scrolls */\n#define OPTIMIZE_SCROLL\t\t0x04\t/* scroll optimization */\n#define OPTIMIZE_ALL\t\t0xff\t/* enable all optimizations (dflt) */\n#endif\n\n#ifdef __cplusplus\n\n#ifndef NCURSES_NOMACROS\n\n/* these names conflict with STL */\n#undef box\n#undef clear\n#undef erase\n#undef move\n#undef refresh\n\n#endif /* NCURSES_NOMACROS */\n\n}\n#endif\n\n#endif /* __NCURSES_H */\n"
  },
  {
    "path": "freebsd-headers/db.h",
    "content": "/*-\n * Copyright (c) 1990, 1993, 1994\n *\tThe Regents of the University of California.  All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t@(#)db.h\t8.7 (Berkeley) 6/16/94\n * $FreeBSD: release/9.0.0/include/db.h 203964 2010-02-16 19:39:50Z imp $\n */\n\n#ifndef _DB_H_\n#define\t_DB_H_\n\n#include <sys/types.h>\n#include <sys/cdefs.h>\n\n#include <limits.h>\n\n#define\tRET_ERROR\t-1\t\t/* Return values. */\n#define\tRET_SUCCESS\t 0\n#define\tRET_SPECIAL\t 1\n\n#define\tMAX_PAGE_NUMBER\t0xffffffff\t/* >= # of pages in a file */\ntypedef uint32_t\tpgno_t;\n#define\tMAX_PAGE_OFFSET\t65535\t\t/* >= # of bytes in a page */\ntypedef uint16_t\tindx_t;\n#define\tMAX_REC_NUMBER\t0xffffffff\t/* >= # of records in a tree */\ntypedef uint32_t\trecno_t;\n\n/* Key/data structure -- a Data-Base Thang. */\ntypedef struct {\n\tvoid\t*data;\t\t\t/* data */\n\tsize_t\t size;\t\t\t/* data length */\n} DBT;\n\n/* Routine flags. */\n#define\tR_CURSOR\t1\t\t/* del, put, seq */\n#define\t__R_UNUSED\t2\t\t/* UNUSED */\n#define\tR_FIRST\t\t3\t\t/* seq */\n#define\tR_IAFTER\t4\t\t/* put (RECNO) */\n#define\tR_IBEFORE\t5\t\t/* put (RECNO) */\n#define\tR_LAST\t\t6\t\t/* seq (BTREE, RECNO) */\n#define\tR_NEXT\t\t7\t\t/* seq */\n#define\tR_NOOVERWRITE\t8\t\t/* put */\n#define\tR_PREV\t\t9\t\t/* seq (BTREE, RECNO) */\n#define\tR_SETCURSOR\t10\t\t/* put (RECNO) */\n#define\tR_RECNOSYNC\t11\t\t/* sync (RECNO) */\n\ntypedef enum { DB_BTREE, DB_HASH, DB_RECNO } DBTYPE;\n\n/*\n * !!!\n * The following flags are included in the dbopen(3) call as part of the\n * open(2) flags.  In order to avoid conflicts with the open flags, start\n * at the top of the 16 or 32-bit number space and work our way down.  If\n * the open flags were significantly expanded in the future, it could be\n * a problem.  Wish I'd left another flags word in the dbopen call.\n *\n * !!!\n * None of this stuff is implemented yet.  The only reason that it's here\n * is so that the access methods can skip copying the key/data pair when\n * the DB_LOCK flag isn't set.\n */\n#if UINT_MAX > 65535\n#define\tDB_LOCK\t\t0x20000000\t/* Do locking. */\n#define\tDB_SHMEM\t0x40000000\t/* Use shared memory. */\n#define\tDB_TXN\t\t0x80000000\t/* Do transactions. */\n#else\n#define\tDB_LOCK\t\t    0x2000\t/* Do locking. */\n#define\tDB_SHMEM\t    0x4000\t/* Use shared memory. */\n#define\tDB_TXN\t\t    0x8000\t/* Do transactions. */\n#endif\n\n/* Access method description structure. */\ntypedef struct __db {\n\tDBTYPE type;\t\t\t/* Underlying db type. */\n\tint (*close)(struct __db *);\n\tint (*del)(const struct __db *, const DBT *, unsigned int);\n\tint (*get)(const struct __db *, const DBT *, DBT *, unsigned int);\n\tint (*put)(const struct __db *, DBT *, const DBT *, unsigned int);\n\tint (*seq)(const struct __db *, DBT *, DBT *, unsigned int);\n\tint (*sync)(const struct __db *, unsigned int);\n\tvoid *internal;\t\t\t/* Access method private. */\n\tint (*fd)(const struct __db *);\n} DB;\n\n#define\tBTREEMAGIC\t0x053162\n#define\tBTREEVERSION\t3\n\n/* Structure used to pass parameters to the btree routines. */\ntypedef struct {\n#define\tR_DUP\t\t0x01\t/* duplicate keys */\n\tunsigned long\tflags;\n\tunsigned int\tcachesize;\t/* bytes to cache */\n\tint\t\tmaxkeypage;\t/* maximum keys per page */\n\tint\t\tminkeypage;\t/* minimum keys per page */\n\tunsigned int\tpsize;\t\t/* page size */\n\tint\t\t(*compare)\t/* comparison function */\n\t\t\t    (const DBT *, const DBT *);\n\tsize_t\t\t(*prefix)\t/* prefix function */\n\t\t\t    (const DBT *, const DBT *);\n\tint\t\tlorder;\t\t/* byte order */\n} BTREEINFO;\n\n#define\tHASHMAGIC\t0x061561\n#define\tHASHVERSION\t2\n\n/* Structure used to pass parameters to the hashing routines. */\ntypedef struct {\n\tunsigned int\tbsize;\t\t/* bucket size */\n\tunsigned int\tffactor;\t/* fill factor */\n\tunsigned int\tnelem;\t\t/* number of elements */\n\tunsigned int\tcachesize;\t/* bytes to cache */\n\tuint32_t\t\t\t/* hash function */\n\t\t(*hash)(const void *, size_t);\n\tint\tlorder;\t\t/* byte order */\n} HASHINFO;\n\n/* Structure used to pass parameters to the record routines. */\ntypedef struct {\n#define\tR_FIXEDLEN\t0x01\t/* fixed-length records */\n#define\tR_NOKEY\t\t0x02\t/* key not required */\n#define\tR_SNAPSHOT\t0x04\t/* snapshot the input */\n\tunsigned long\tflags;\n\tunsigned int\tcachesize; /* bytes to cache */\n\tunsigned int\tpsize;\t/* page size */\n\tint\t\tlorder;\t/* byte order */\n\tsize_t\t\treclen;\t/* record length (fixed-length records) */\n\tunsigned char\tbval;\t/* delimiting byte (variable-length records */\n\tchar\t*bfname;\t/* btree file name */ \n} RECNOINFO;\n\n#ifdef __DBINTERFACE_PRIVATE\n/*\n * Little endian <==> big endian 32-bit swap macros.\n *\tM_32_SWAP\tswap a memory location\n *\tP_32_SWAP\tswap a referenced memory location\n *\tP_32_COPY\tswap from one location to another\n */\n#define\tM_32_SWAP(a) {\t\t\t\t\t\t\t\\\n\tuint32_t _tmp = a;\t\t\t\t\t\t\\\n\t((char *)&a)[0] = ((char *)&_tmp)[3];\t\t\t\t\\\n\t((char *)&a)[1] = ((char *)&_tmp)[2];\t\t\t\t\\\n\t((char *)&a)[2] = ((char *)&_tmp)[1];\t\t\t\t\\\n\t((char *)&a)[3] = ((char *)&_tmp)[0];\t\t\t\t\\\n}\n#define\tP_32_SWAP(a) {\t\t\t\t\t\t\t\\\n\tuint32_t _tmp = *(uint32_t *)a;\t\t\t\t\t\\\n\t((char *)a)[0] = ((char *)&_tmp)[3];\t\t\t\t\\\n\t((char *)a)[1] = ((char *)&_tmp)[2];\t\t\t\t\\\n\t((char *)a)[2] = ((char *)&_tmp)[1];\t\t\t\t\\\n\t((char *)a)[3] = ((char *)&_tmp)[0];\t\t\t\t\\\n}\n#define\tP_32_COPY(a, b) {\t\t\t\t\t\t\\\n\t((char *)&(b))[0] = ((char *)&(a))[3];\t\t\t\t\\\n\t((char *)&(b))[1] = ((char *)&(a))[2];\t\t\t\t\\\n\t((char *)&(b))[2] = ((char *)&(a))[1];\t\t\t\t\\\n\t((char *)&(b))[3] = ((char *)&(a))[0];\t\t\t\t\\\n}\n\n/*\n * Little endian <==> big endian 16-bit swap macros.\n *\tM_16_SWAP\tswap a memory location\n *\tP_16_SWAP\tswap a referenced memory location\n *\tP_16_COPY\tswap from one location to another\n */\n#define\tM_16_SWAP(a) {\t\t\t\t\t\t\t\\\n\tuint16_t _tmp = a;\t\t\t\t\t\t\\\n\t((char *)&a)[0] = ((char *)&_tmp)[1];\t\t\t\t\\\n\t((char *)&a)[1] = ((char *)&_tmp)[0];\t\t\t\t\\\n}\n#define\tP_16_SWAP(a) {\t\t\t\t\t\t\t\\\n\tuint16_t _tmp = *(uint16_t *)a;\t\t\t\t\t\\\n\t((char *)a)[0] = ((char *)&_tmp)[1];\t\t\t\t\\\n\t((char *)a)[1] = ((char *)&_tmp)[0];\t\t\t\t\\\n}\n#define\tP_16_COPY(a, b) {\t\t\t\t\t\t\\\n\t((char *)&(b))[0] = ((char *)&(a))[1];\t\t\t\t\\\n\t((char *)&(b))[1] = ((char *)&(a))[0];\t\t\t\t\\\n}\n#endif\n\n__BEGIN_DECLS\n#if __BSD_VISIBLE\nDB *dbopen(const char *, int, int, DBTYPE, const void *);\n#endif\n\n#ifdef __DBINTERFACE_PRIVATE\nDB\t*__bt_open(const char *, int, int, const BTREEINFO *, int);\nDB\t*__hash_open(const char *, int, int, const HASHINFO *, int);\nDB\t*__rec_open(const char *, int, int, const RECNOINFO *, int);\nvoid\t __dbpanic(DB *dbp);\n#endif\n__END_DECLS\n#endif /* !_DB_H_ */\n"
  },
  {
    "path": "freebsd-headers/dev/acpica/acpiio.h",
    "content": "/*-\n * Copyright (c) 1999 Takanori Watanabe <takawata@jp.freebsd.org>\n * Copyright (c) 1999 Mitsuru IWASAKI <iwasaki@FreeBSD.org>\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/dev/acpica/acpiio.h 216503 2010-12-17 16:21:30Z avg $\n */\n\n#ifndef _ACPIIO_H_\n#define _ACPIIO_H_\n\n/*\n * Core ACPI subsystem ioctls\n */\n#define ACPIIO_SETSLPSTATE\t_IOW('P', 3, int) /* DEPRECATED */\n\n/* Request S1-5 sleep state. User is notified and then sleep proceeds. */\n#define ACPIIO_REQSLPSTATE\t_IOW('P', 4, int)\n\n/* Allow suspend to continue (0) or abort it (errno). */\n#define ACPIIO_ACKSLPSTATE\t_IOW('P', 5, int)\n\nstruct acpi_battinfo {\n    int\t cap;\t\t\t\t/* percent */\n    int\t min;\t\t\t\t/* remaining time (in minutes) */\n    int\t state;\t\t\t\t/* battery state */\n    int\t rate;\t\t\t\t/* emptying rate */\n};\n\n#define ACPI_CMBAT_MAXSTRLEN 32\nstruct acpi_bif {\n    uint32_t units;\t\t\t/* Units (mW or mA). */\n#define ACPI_BIF_UNITS_MW\t0\t/* Capacity in mWh, rate in mW. */\n#define ACPI_BIF_UNITS_MA\t1\t/* Capacity in mAh, rate in mA. */\n    uint32_t dcap;\t\t\t/* Design Capacity */\n    uint32_t lfcap;\t\t\t/* Last Full capacity */\n    uint32_t btech;\t\t\t/* Battery Technology */\n    uint32_t dvol;\t\t\t/* Design voltage (mV) */\n    uint32_t wcap;\t\t\t/* WARN capacity */\n    uint32_t lcap;\t\t\t/* Low capacity */\n    uint32_t gra1;\t\t\t/* Granularity 1 (Warn to Low) */\n    uint32_t gra2;\t\t\t/* Granularity 2 (Full to Warn) */\n    char model[ACPI_CMBAT_MAXSTRLEN];\t/* model identifier */\n    char serial[ACPI_CMBAT_MAXSTRLEN];\t/* Serial number */\n    char type[ACPI_CMBAT_MAXSTRLEN];\t/* Type */\n    char oeminfo[ACPI_CMBAT_MAXSTRLEN];\t/* OEM infomation */\n};\n\nstruct acpi_bst {\n    uint32_t state;\t\t\t/* Battery State */\n    uint32_t rate;\t\t\t/* Present Rate */\n    uint32_t cap;\t\t\t/* Remaining Capacity */\n    uint32_t volt;\t\t\t/* Present Voltage */\n};\n\n/*\n * Note that the following definitions represent status bits for internal\n * driver state.  The first three of them (charging, discharging and critical)\n * conveninetly conform to ACPI specification of status returned by _BST\n * method.  Other definitions (not present, etc) are synthetic.\n * Also note that according to the specification the charging and discharging\n * status bits must not be set at the same time.\n */\n#define ACPI_BATT_STAT_DISCHARG\t\t0x0001\n#define ACPI_BATT_STAT_CHARGING\t\t0x0002\n#define ACPI_BATT_STAT_CRITICAL\t\t0x0004\n#define ACPI_BATT_STAT_INVALID\t\t\t\t\t\\\n    (ACPI_BATT_STAT_DISCHARG | ACPI_BATT_STAT_CHARGING)\n#define ACPI_BATT_STAT_BST_MASK\t\t\t\t\t\\\n    (ACPI_BATT_STAT_INVALID | ACPI_BATT_STAT_CRITICAL)\n#define ACPI_BATT_STAT_NOT_PRESENT\tACPI_BATT_STAT_BST_MASK\n\nunion acpi_battery_ioctl_arg {\n    int\t\t\t unit;\t/* Device unit or ACPI_BATTERY_ALL_UNITS. */\n\n    struct acpi_battinfo battinfo;\n\n    struct acpi_bif\t bif;\n    struct acpi_bst\t bst;\n};\n\n#define ACPI_BATTERY_ALL_UNITS \t(-1)\n#define ACPI_BATT_UNKNOWN \t0xffffffff /* _BST or _BIF value unknown. */\n\n/* Common battery ioctls */\n#define ACPIIO_BATT_GET_UNITS\t  _IOR('B', 0x01, int)\n#define ACPIIO_BATT_GET_BATTINFO _IOWR('B', 0x03, union acpi_battery_ioctl_arg)\n#define ACPIIO_BATT_GET_BIF\t _IOWR('B', 0x10, union acpi_battery_ioctl_arg)\n#define ACPIIO_BATT_GET_BST\t _IOWR('B', 0x11, union acpi_battery_ioctl_arg)\n\n/* Control Method battery ioctls (deprecated) */\n#define ACPIIO_CMBAT_GET_BIF\t ACPIIO_BATT_GET_BIF\n#define ACPIIO_CMBAT_GET_BST\t ACPIIO_BATT_GET_BST\n\n/* Get AC adapter status. */\n#define ACPIIO_ACAD_GET_STATUS\t  _IOR('A', 1, int)\n\n#ifdef _KERNEL\ntypedef int\t(*acpi_ioctl_fn)(u_long cmd, caddr_t addr, void *arg);\nextern int\tacpi_register_ioctl(u_long cmd, acpi_ioctl_fn fn, void *arg);\nextern void\tacpi_deregister_ioctl(u_long cmd, acpi_ioctl_fn fn);\n#endif\n\n#endif /* !_ACPIIO_H_ */\n"
  },
  {
    "path": "freebsd-headers/dev/an/if_aironet_ieee.h",
    "content": "/*-\n * Copyright (c) 1997, 1998, 1999\n *\tBill Paul <wpaul@ctr.columbia.edu>.  All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. All advertising materials mentioning features or use of this software\n *    must display the following acknowledgement:\n *\tThis product includes software developed by Bill Paul.\n * 4. Neither the name of the author nor the names of any co-contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY Bill Paul AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL Bill Paul OR THE VOICES IN HIS HEAD\n * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\n * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\n * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\n * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\n * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF\n * THE POSSIBILITY OF SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/dev/an/if_aironet_ieee.h 139749 2005-01-06 01:43:34Z imp $\n */\n\n#ifndef _IF_AIRONET_IEEE_H\n#define _IF_AIRONET_IEEE_H\n\n/*\n * This header defines a simple command interface to the FreeBSD\n * Aironet driver (an) driver, which is used to set certain\n * device-specific parameters which can't be easily managed through\n * ifconfig(8). No, sysctl(2) is not the answer. I said a _simple_\n * interface, didn't I.\n */\n\n#ifndef SIOCSAIRONET\n#define SIOCSAIRONET\tSIOCSIFGENERIC\n#endif\n\n#ifndef SIOCGAIRONET\n#define SIOCGAIRONET\tSIOCGIFGENERIC\n#endif\n\n/*\n * This is a make-predend RID value used only by the driver\n * to allow the user to set the speed.\n */\n#define AN_RID_TX_SPEED\t\t0x1234\n\n/*\n * Technically I don't think there's a limit to a record\n * length. The largest record is the one that contains the CIS\n * data, which is 240 words long, so 256 should be a safe\n * value.\n */\n#define AN_MAX_DATALEN\t4096\n\nstruct an_req {\n\tu_int16_t\tan_len;\n\tu_int16_t\tan_type;\n\tu_int16_t\tan_val[AN_MAX_DATALEN];\n};\n\n/*\n * Private LTV records (interpreted only by the driver). This is\n * a minor kludge to allow reading the interface statistics from\n * the driver.\n */\n#define AN_RID_IFACE_STATS\t0x0100\n#define AN_RID_MGMT_XMIT\t0x0200\n#ifdef ANCACHE\n#define AN_RID_ZERO_CACHE\t0x0300\n#define AN_RID_READ_CACHE\t0x0400\n#endif\n\n#define AN_FCTL_VERS\t\t0x0002\n#define AN_FCTL_FTYPE\t\t0x000C\n#define AN_FCTL_STYPE\t\t0x00F0\n#define AN_FCTL_TODS\t\t0x0100\n#define AN_FCTL_FROMDS\t\t0x0200\n#define AN_FCTL_MOREFRAGS\t0x0400\n#define AN_FCTL_RETRY\t\t0x0800\n#define AN_FCTL_PM\t\t0x1000\n#define AN_FCTL_MOREDATA\t0x2000\n#define AN_FCTL_WEP\t\t0x4000\n#define AN_FCTL_ORDER\t\t0x8000\n\n#define AN_FTYPE_MGMT\t\t0x0000\n#define AN_FTYPE_CTL\t\t0x0004\n#define AN_FTYPE_DATA\t\t0x0008\n\n#define AN_STYPE_MGMT_ASREQ\t0x0000\t/* association request */\n#define AN_STYPE_MGMT_ASRESP\t0x0010\t/* association response */\n#define AN_STYPE_MGMT_REASREQ\t0x0020\t/* reassociation request */\n#define AN_STYPE_MGMT_REASRESP\t0x0030\t/* reassociation response */\n#define AN_STYPE_MGMT_PROBEREQ\t0x0040\t/* probe request */\n#define AN_STYPE_MGMT_PROBERESP\t0x0050\t/* probe response */\n#define AN_STYPE_MGMT_BEACON\t0x0080\t/* beacon */\n#define AN_STYPE_MGMT_ATIM\t0x0090\t/* announcement traffic ind msg */\n#define AN_STYPE_MGMT_DISAS\t0x00A0\t/* disassociation */\n#define AN_STYPE_MGMT_AUTH\t0x00B0\t/* authentication */\n#define AN_STYPE_MGMT_DEAUTH\t0x00C0\t/* deauthentication */\n\n/*\n * Aironet IEEE signal strength cache\n *\n * driver keeps cache of last\n * MAXANCACHE packets to arrive including signal strength info.\n * daemons may read this via ioctl\n *\n * Each entry in the wi_sigcache has a unique macsrc.\n */\n#ifdef ANCACHE\n#define MAXANCACHE      10\n\nstruct an_sigcache {\n\tchar\tmacsrc[6];\t/* unique MAC address for entry */\n\tint\tipsrc;\t\t/* ip address associated with packet */\n\tint\tsignal;\t\t/* signal strength of the packet */\n\tint\tnoise;\t\t/* noise value */\n\tint\tquality;\t/* quality of the packet */\n};\n#endif\n\n/*\n * The card provides an 8-bit signal strength value (RSSI), which can\n * be converted to a dBm power value (or a percent) using a table in\n * the card's firmware (when available).  The tables are slightly\n * different in individual cards, even of the same model.  If the\n * table is not available, the mapping can be approximated by dBm =\n * RSSI - 100.  This approximation can be seen by plotting a few\n * tables, and also matches some info on the Intersil web site (I\n * think they make the RF front end for the cards.  However, the linux\n * driver uses the approximation dBm = RSSI/2 - 95.  I think that is\n * just wrong. \n */\n\nstruct an_rssi_entry {\n\tu_int8_t\tan_rss_pct;\n\tu_int8_t\tan_rss_dbm;\n};\n\n\nstruct an_ltv_key {\n\tu_int16_t\tan_len;\n\tu_int16_t\tan_type;\n\tu_int16_t       kindex;\n\tu_int8_t        mac[6];\n\tu_int16_t       klen;\n\tu_int8_t        key[16];  /* 128-bit keys */\n};\n\nstruct an_ltv_stats {\n\tu_int16_t\t\tan_fudge;\n\tu_int16_t\t\tan_len;\t\t\t/* 0x00 */\n\tu_int16_t\t\tan_type;\t\t/* 0xXX */\n\tu_int16_t\t\tan_spacer;\t\t/* 0x02 */\n\tu_int32_t\t\tan_rx_overruns;\t\t/* 0x04 */\n\tu_int32_t\t\tan_rx_plcp_csum_errs;\t/* 0x08 */\n\tu_int32_t\t\tan_rx_plcp_format_errs;\t/* 0x0C */\n\tu_int32_t\t\tan_rx_plcp_len_errs;\t/* 0x10 */\n\tu_int32_t\t\tan_rx_mac_crc_errs;\t/* 0x14 */\n\tu_int32_t\t\tan_rx_mac_crc_ok;\t/* 0x18 */\n\tu_int32_t\t\tan_rx_wep_errs;\t\t/* 0x1C */\n\tu_int32_t\t\tan_rx_wep_ok;\t\t/* 0x20 */\n\tu_int32_t\t\tan_retry_long;\t\t/* 0x24 */\n\tu_int32_t\t\tan_retry_short;\t\t/* 0x28 */\n\tu_int32_t\t\tan_retry_max;\t\t/* 0x2C */\n\tu_int32_t\t\tan_no_ack;\t\t/* 0x30 */\n\tu_int32_t\t\tan_no_cts;\t\t/* 0x34 */\n\tu_int32_t\t\tan_rx_ack_ok;\t\t/* 0x38 */\n\tu_int32_t\t\tan_rx_cts_ok;\t\t/* 0x3C */\n\tu_int32_t\t\tan_tx_ack_ok;\t\t/* 0x40 */\n\tu_int32_t\t\tan_tx_rts_ok;\t\t/* 0x44 */\n\tu_int32_t\t\tan_tx_cts_ok;\t\t/* 0x48 */\n\tu_int32_t\t\tan_tx_lmac_mcasts;\t/* 0x4C */\n\tu_int32_t\t\tan_tx_lmac_bcasts;\t/* 0x50 */\n\tu_int32_t\t\tan_tx_lmac_ucast_frags;\t/* 0x54 */\n\tu_int32_t\t\tan_tx_lmac_ucasts;\t/* 0x58 */\n\tu_int32_t\t\tan_tx_beacons;\t\t/* 0x5C */\n\tu_int32_t\t\tan_rx_beacons;\t\t/* 0x60 */\n\tu_int32_t\t\tan_tx_single_cols;\t/* 0x64 */\n\tu_int32_t\t\tan_tx_multi_cols;\t/* 0x68 */\n\tu_int32_t\t\tan_tx_defers_no;\t/* 0x6C */\n\tu_int32_t\t\tan_tx_defers_prot;\t/* 0x70 */\n\tu_int32_t\t\tan_tx_defers_energy;\t/* 0x74 */\n\tu_int32_t\t\tan_rx_dups;\t\t/* 0x78 */\n\tu_int32_t\t\tan_rx_partial;\t\t/* 0x7C */\n\tu_int32_t\t\tan_tx_too_old;\t\t/* 0x80 */\n\tu_int32_t\t\tan_rx_too_old;\t\t/* 0x84 */\n\tu_int32_t\t\tan_lostsync_max_retries;/* 0x88 */\n\tu_int32_t\t\tan_lostsync_missed_beacons;/* 0x8C */\n\tu_int32_t\t\tan_lostsync_arl_exceeded;/*0x90 */\n\tu_int32_t\t\tan_lostsync_deauthed;\t/* 0x94 */\n\tu_int32_t\t\tan_lostsync_disassociated;/*0x98 */\n\tu_int32_t\t\tan_lostsync_tsf_timing;\t/* 0x9C */\n\tu_int32_t\t\tan_tx_host_mcasts;\t/* 0xA0 */\n\tu_int32_t\t\tan_tx_host_bcasts;\t/* 0xA4 */\n\tu_int32_t\t\tan_tx_host_ucasts;\t/* 0xA8 */\n\tu_int32_t\t\tan_tx_host_failed;\t/* 0xAC */\n\tu_int32_t\t\tan_rx_host_mcasts;\t/* 0xB0 */\n\tu_int32_t\t\tan_rx_host_bcasts;\t/* 0xB4 */\n\tu_int32_t\t\tan_rx_host_ucasts;\t/* 0xB8 */\n\tu_int32_t\t\tan_rx_host_discarded;\t/* 0xBC */\n\tu_int32_t\t\tan_tx_hmac_mcasts;\t/* 0xC0 */\n\tu_int32_t\t\tan_tx_hmac_bcasts;\t/* 0xC4 */\n\tu_int32_t\t\tan_tx_hmac_ucasts;\t/* 0xC8 */\n\tu_int32_t\t\tan_tx_hmac_failed;\t/* 0xCC */\n\tu_int32_t\t\tan_rx_hmac_mcasts;\t/* 0xD0 */\n\tu_int32_t\t\tan_rx_hmac_bcasts;\t/* 0xD4 */\n\tu_int32_t\t\tan_rx_hmac_ucasts;\t/* 0xD8 */\n\tu_int32_t\t\tan_rx_hmac_discarded;\t/* 0xDC */\n\tu_int32_t\t\tan_tx_hmac_accepted;\t/* 0xE0 */\n\tu_int32_t\t\tan_ssid_mismatches;\t/* 0xE4 */\n\tu_int32_t\t\tan_ap_mismatches;\t/* 0xE8 */\n\tu_int32_t\t\tan_rates_mismatches;\t/* 0xEC */\n\tu_int32_t\t\tan_auth_rejects;\t/* 0xF0 */\n\tu_int32_t\t\tan_auth_timeouts;\t/* 0xF4 */\n\tu_int32_t\t\tan_assoc_rejects;\t/* 0xF8 */\n\tu_int32_t\t\tan_assoc_timeouts;\t/* 0xFC */\n\tu_int32_t\t\tan_reason_outside_table;/* 0x100 */\n\tu_int32_t\t\tan_reason1;\t\t/* 0x104 */\n\tu_int32_t\t\tan_reason2;\t\t/* 0x108 */\n\tu_int32_t\t\tan_reason3;\t\t/* 0x10C */\n\tu_int32_t\t\tan_reason4;\t\t/* 0x110 */\n\tu_int32_t\t\tan_reason5;\t\t/* 0x114 */\n\tu_int32_t\t\tan_reason6;\t\t/* 0x118 */\n\tu_int32_t\t\tan_reason7;\t\t/* 0x11C */\n\tu_int32_t\t\tan_reason8;\t\t/* 0x120 */\n\tu_int32_t\t\tan_reason9;\t\t/* 0x124 */\n\tu_int32_t\t\tan_reason10;\t\t/* 0x128 */\n\tu_int32_t\t\tan_reason11;\t\t/* 0x12C */\n\tu_int32_t\t\tan_reason12;\t\t/* 0x130 */\n\tu_int32_t\t\tan_reason13;\t\t/* 0x134 */\n\tu_int32_t\t\tan_reason14;\t\t/* 0x138 */\n\tu_int32_t\t\tan_reason15;\t\t/* 0x13C */\n\tu_int32_t\t\tan_reason16;\t\t/* 0x140 */\n\tu_int32_t\t\tan_reason17;\t\t/* 0x144 */\n\tu_int32_t\t\tan_reason18;\t\t/* 0x148 */\n\tu_int32_t\t\tan_reason19;\t\t/* 0x14C */\n\tu_int32_t\t\tan_rx_mgmt_pkts;\t/* 0x150 */\n\tu_int32_t\t\tan_tx_mgmt_pkts;\t/* 0x154 */\n\tu_int32_t\t\tan_rx_refresh_pkts;\t/* 0x158 */\n\tu_int32_t\t\tan_tx_refresh_pkts;\t/* 0x15C */\n\tu_int32_t\t\tan_rx_poll_pkts;\t/* 0x160 */\n\tu_int32_t\t\tan_tx_poll_pkts;\t/* 0x164 */\n\tu_int32_t\t\tan_host_retries;\t/* 0x168 */\n\tu_int32_t\t\tan_lostsync_hostreq;\t/* 0x16C */\n\tu_int32_t\t\tan_host_tx_bytes;\t/* 0x170 */\n\tu_int32_t\t\tan_host_rx_bytes;\t/* 0x174 */\n\tu_int32_t\t\tan_uptime_usecs;\t/* 0x178 */\n\tu_int32_t\t\tan_uptime_secs;\t\t/* 0x17C */\n\tu_int32_t\t\tan_lostsync_better_ap;\t/* 0x180 */\n\tu_int32_t\t\tan_rsvd[15];\n};\n\n/*\n * General configuration information.\n */\nstruct an_ltv_genconfig {\n\t/* General configuration. */\n\tu_int16_t\t\tan_len;\t\t\t/* 0x00 */\n\tu_int16_t\t\tan_type;\t\t/* XXXX */\n\tu_int16_t\t\tan_opmode;\t\t/* 0x02 */\n\tu_int16_t\t\tan_rxmode;\t\t/* 0x04 */\n\tu_int16_t\t\tan_fragthresh;\t\t/* 0x06 */\n\tu_int16_t\t\tan_rtsthresh;\t\t/* 0x08 */\n\tu_int8_t\t\tan_macaddr[6];\t\t/* 0x0A */\n\tu_int8_t\t\tan_rates[8];\t\t/* 0x10 */\n\tu_int16_t\t\tan_shortretry_limit;\t/* 0x18 */\n\tu_int16_t\t\tan_longretry_limit;\t/* 0x1A */\n\tu_int16_t\t\tan_tx_msdu_lifetime;\t/* 0x1C */\n\tu_int16_t\t\tan_rx_msdu_lifetime;\t/* 0x1E */\n\tu_int16_t\t\tan_stationary;\t\t/* 0x20 */\n\tu_int16_t\t\tan_ordering;\t\t/* 0x22 */\n\tu_int16_t\t\tan_devtype;\t\t/* 0x24 */\n\tu_int16_t\t\tan_rsvd0[5];\t\t/* 0x26 */\n\t/* Scanning associating. */\n\tu_int16_t\t\tan_scanmode;\t\t/* 0x30 */\n\tu_int16_t\t\tan_probedelay;\t\t/* 0x32 */\n\tu_int16_t\t\tan_probe_energy_timeout;/* 0x34 */\n\tu_int16_t\t\tan_probe_response_timeout;/*0x36 */\n\tu_int16_t\t\tan_beacon_listen_timeout;/*0x38 */\n\tu_int16_t\t\tan_ibss_join_net_timeout;/*0x3A */\n\tu_int16_t\t\tan_auth_timeout;\t/* 0x3C */\n\tu_int16_t\t\tan_authtype;\t\t/* 0x3E */\n\tu_int16_t\t\tan_assoc_timeout;\t/* 0x40 */\n\tu_int16_t\t\tan_specified_ap_timeout;/* 0x42 */\n\tu_int16_t\t\tan_offline_scan_interval;/*0x44 */\n\tu_int16_t\t\tan_offline_scan_duration;/*0x46 */\n\tu_int16_t\t\tan_link_loss_delay;\t/* 0x48 */\n\tu_int16_t\t\tan_max_beacon_lost_time;/* 0x4A */\n\tu_int16_t\t\tan_refresh_interval;\t/* 0x4C */\n\tu_int16_t\t\tan_rsvd1;\t\t/* 0x4E */\n\t/* Power save operation */\n\tu_int16_t\t\tan_psave_mode;\t\t/* 0x50 */\n\tu_int16_t\t\tan_sleep_for_dtims;\t/* 0x52 */\n\tu_int16_t\t\tan_listen_interval;\t/* 0x54 */\n\tu_int16_t\t\tan_fast_listen_interval;/* 0x56 */\n\tu_int16_t\t\tan_listen_decay;\t/* 0x58 */\n\tu_int16_t\t\tan_fast_listen_decay;\t/* 0x5A */\n\tu_int16_t\t\tan_rsvd2[2];\t\t/* 0x5C */\n\t/* Ad-hoc (or AP) operation. */\n\tu_int16_t\t\tan_beacon_period;\t/* 0x60 */\n\tu_int16_t\t\tan_atim_duration;\t/* 0x62 */\n\tu_int16_t\t\tan_rsvd3;\t\t/* 0x64 */\n\tu_int16_t\t\tan_ds_channel;\t\t/* 0x66 */\n\tu_int16_t\t\tan_rsvd4;\t\t/* 0x68 */\n\tu_int16_t\t\tan_dtim_period;\t\t/* 0x6A */\n\tu_int16_t\t\tan_rsvd5[2];\t\t/* 0x6C */\n\t/* Radio operation. */\n\tu_int16_t\t\tan_radiotype;\t\t/* 0x70 */\n\tu_int16_t\t\tan_diversity;\t\t/* 0x72 */\n\tu_int16_t\t\tan_tx_power;\t\t/* 0x74 */\n\tu_int16_t\t\tan_rss_thresh;\t\t/* 0x76 */\n\tu_int16_t\t\tan_modulation_type;\t/* 0x78 */\n\tu_int16_t\t\tan_short_preamble;\t/* 0x7A */\n\tu_int16_t\t\tan_home_product;\t/* 0x7C */\n\tu_int16_t\t\tan_rsvd6;\t\t/* 0x7E */\n\t/* Aironet extensions. */\n\tu_int8_t\t\tan_nodename[16];\t/* 0x80 */\n\tu_int16_t\t\tan_arl_thresh;\t\t/* 0x90 */\n\tu_int16_t\t\tan_arl_decay;\t\t/* 0x92 */\n\tu_int16_t\t\tan_arl_delay;\t\t/* 0x94 */\n\tu_int8_t\t\tan_rsvd7;\t\t/* 0x96 */\n\tu_int8_t\t\tan_rsvd8;\t\t/* 0x97 */\n\tu_int8_t\t\tan_magic_packet_action;\t/* 0x98 */\n\tu_int8_t\t\tan_magic_packet_ctl;\t/* 0x99 */\n\tu_int16_t\t\tan_rsvd9;\n\tu_int16_t\t\tan_spare[19];\n};\n\n#define AN_OPMODE_IBSS_ADHOC\t\t\t0x0000\n#define AN_OPMODE_INFRASTRUCTURE_STATION\t0x0001\n#define AN_OPMODE_AP\t\t\t\t0x0002\n#define AN_OPMODE_AP_REPEATER\t\t\t0x0003\n#define AN_OPMODE_UNMODIFIED_PAYLOAD\t\t0x0100\n#define AN_OPMODE_AIRONET_EXTENSIONS\t\t0x0200\n#define AN_OPMODE_AP_EXTENSIONS\t\t\t0x0400\n\n#define AN_RXMODE_BC_MC_ADDR\t\t\t0x0000\n#define AN_RXMODE_BC_ADDR\t\t\t0x0001\n#define AN_RXMODE_ADDR\t\t\t\t0x0002\n#define AN_RXMODE_80211_MONITOR_CURBSS\t\t0x0003\n#define AN_RXMODE_80211_MONITOR_ANYBSS\t\t0x0004\n#define AN_RXMODE_LAN_MONITOR_CURBSS\t\t0x0005\n#define AN_RXMODE_NO_8023_HEADER\t\t0x0100\n#define AN_RXMODE_NORMALIZED_RSSI\t\t0x0200\n\n#define AN_RATE_1MBPS\t\t\t\t0x0002\n#define AN_RATE_2MBPS\t\t\t\t0x0004\n#define AN_RATE_5_5MBPS\t\t\t\t0x000B\n#define AN_RATE_11MBPS\t\t\t\t0x0016\n\n#define AN_DEVTYPE_PC4500\t\t\t0x0065\n#define AN_DEVTYPE_PC4800\t\t\t0x006D\n\n#define AN_SCANMODE_ACTIVE\t\t\t0x0000\n#define AN_SCANMODE_PASSIVE\t\t\t0x0001\n#define AN_SCANMODE_AIRONET_ACTIVE\t\t0x0002\n\n#define AN_AUTHTYPE_NONE\t\t\t0x0000\n#define AN_AUTHTYPE_OPEN\t\t\t0x0001\n#define AN_AUTHTYPE_SHAREDKEY\t\t\t0x0002\n#define AN_AUTHTYPE_MASK                        0x00ff\n#define AN_AUTHTYPE_ENABLE\t\t\t0x0100\n#define AN_AUTHTYPE_PRIVACY_IN_USE\t\t0x0100\n#define AN_AUTHTYPE_ALLOW_UNENCRYPTED\t\t0x0200\n#define AN_AUTHTYPE_LEAP\t\t\t0x1000\n\n#define AN_PSAVE_NONE\t\t\t\t0x0000\n#define AN_PSAVE_CAM\t\t\t\t0x0001\n#define AN_PSAVE_PSP\t\t\t\t0x0002\n#define AN_PSAVE_PSP_CAM\t\t\t0x0003\n\n#define AN_RADIOTYPE_80211_FH\t\t\t0x0001\n#define AN_RADIOTYPE_80211_DS\t\t\t0x0002\n#define AN_RADIOTYPE_LM2000_DS\t\t\t0x0004\n\n#define AN_DIVERSITY_FACTORY_DEFAULT\t\t0x0000\n#define AN_DIVERSITY_ANTENNA_1_ONLY\t\t0x0001\n#define AN_DIVERSITY_ANTENNA_2_ONLY\t\t0x0002\n#define AN_DIVERSITY_ANTENNA_1_AND_2\t\t0x0003\n\n#define AN_TXPOWER_FACTORY_DEFAULT\t\t0x0000\n#define AN_TXPOWER_50MW\t\t\t\t50\n#define AN_TXPOWER_100MW\t\t\t100\n#define AN_TXPOWER_250MW\t\t\t250\n\n#define AN_HOME_NETWORK\t\t\t\t0x0001\n#define AN_HOME_INSTALL_AP\t\t\t0x0002\n\n/*\n * Valid SSID list. You can specify up to three SSIDs denoting\n * the service sets that you want to join. The first SSID always\n * defaults to \"tsunami\" which is a handy way to detect the\n * card.\n */\n\nstruct an_ltv_ssidlist {\n\tu_int16_t\t\tan_len;\n\tu_int16_t\t\tan_type;\n\tu_int16_t\t\tan_ssid1_len;\n\tchar\t\t\tan_ssid1[32];\n\tu_int16_t\t\tan_ssid2_len;\n\tchar\t\t\tan_ssid2[32];\n\tu_int16_t\t\tan_ssid3_len;\n\tchar\t\t\tan_ssid3[32];\n};\n\nstruct an_ltv_ssid_entry{\n\tu_int16_t\t\tan_len;\n\tchar\t\t\tan_ssid[32];\n};\n\n#define MAX_SSIDS 25\nstruct an_ltv_ssidlist_new {\n\tu_int16_t\t\tan_len;\n\tu_int16_t\t\tan_type;\n\tstruct an_ltv_ssid_entry an_entry[MAX_SSIDS];\n};\n\n/*\n * Valid AP list.\n */\nstruct an_ltv_aplist {\n\tu_int16_t\t\tan_len;\n\tu_int16_t\t\tan_type;\n\tu_int8_t\t\tan_ap1[8];\n\tu_int8_t\t\tan_ap2[8];\n\tu_int8_t\t\tan_ap3[8];\n\tu_int8_t\t\tan_ap4[8];\n};\n\n/*\n * Driver name.\n */\nstruct an_ltv_drvname {\n\tu_int16_t\t\tan_len;\n\tu_int16_t\t\tan_type;\n\tu_int8_t\t\tan_drvname[16];\n};\n\n/*\n * Frame encapsulation.\n */\nstruct an_rid_encap {\n\tu_int16_t\t\tan_len;\n\tu_int16_t\t\tan_type;\n\tu_int16_t\t\tan_ethertype_default;\n\tu_int16_t\t\tan_action_default;\n\tu_int16_t\t\tan_ethertype0;\n\tu_int16_t\t\tan_action0;\n\tu_int16_t\t\tan_ethertype1;\n\tu_int16_t\t\tan_action1;\n\tu_int16_t\t\tan_ethertype2;\n\tu_int16_t\t\tan_action2;\n\tu_int16_t\t\tan_ethertype3;\n\tu_int16_t\t\tan_action3;\n\tu_int16_t\t\tan_ethertype4;\n\tu_int16_t\t\tan_action4;\n\tu_int16_t\t\tan_ethertype5;\n\tu_int16_t\t\tan_action5;\n\tu_int16_t\t\tan_ethertype6;\n\tu_int16_t\t\tan_action6;\n};\n\n#define AN_ENCAP_ACTION_RX\t0x0001\n#define AN_ENCAP_ACTION_TX\t0x0002\n\n#define AN_RXENCAP_NONE\t\t0x0000\n#define AN_RXENCAP_RFC1024\t0x0001\n\n#define AN_TXENCAP_RFC1024\t0x0000\n#define AN_TXENCAP_80211\t0x0002\n\n/*\n * Card capabilities (read only).\n */\nstruct an_ltv_caps {\n\tu_int16_t\t\tan_len;\t\t\t/* 0x00 */\n\tu_int16_t\t\tan_type;\t\t/* XXXX */\n\tu_int8_t\t\tan_oui[3];\t\t/* 0x02 */\n\tu_int8_t\t\tan_rsvd0;\t\t/* 0x05 */\n\tu_int16_t\t\tan_prodnum;\t\t/* 0x06 */\n\tu_int8_t\t\tan_manufname[32];\t/* 0x08 */\n\tu_int8_t\t\tan_prodname[16];\t/* 0x28 */\n\tu_int8_t\t\tan_prodvers[8];\t\t/* 0x38 */\n\tu_int8_t\t\tan_oemaddr[6];\t\t/* 0x40 */\n\tu_int8_t\t\tan_aironetaddr[6];\t/* 0x46 */\n\tu_int16_t\t\tan_radiotype;\t\t/* 0x4C */\n\tu_int16_t\t\tan_regdomain;\t\t/* 0x4E */\n\tu_int8_t\t\tan_callid[6];\t\t/* 0x50 */\n\tu_int8_t\t\tan_rates[8];\t\t/* 0x56 */\n\tu_int8_t\t\tan_rx_diversity;\t/* 0x5E */\n\tu_int8_t\t\tan_tx_diversity;\t/* 0x5F */\n\tu_int16_t\t\tan_tx_powerlevels[8];\t/* 0x60 */\n\tu_int16_t\t\tan_hwrev;\t\t/* 0x70 */\n\tu_int16_t\t\tan_hwcaps;\t\t/* 0x72 */\n\tu_int16_t\t\tan_temprange;\t\t/* 0x74 */\n\tu_int16_t\t\tan_fwrev;\t\t/* 0x76 */\n\tu_int16_t\t\tan_fwsubrev;\t\t/* 0x78 */\n\tu_int16_t\t\tan_ifacerev;\t\t/* 0x7A */\n\tu_int16_t\t\tan_softcaps;\t\t/* 0x7C */\n\tu_int16_t\t\tan_bootblockrev;\t/* 0x7E */\n\tu_int16_t\t\tan_req_hw_support;\t/* 0x80 */\n\tu_int16_t\t\tan_unknown[31];\t\t/* 0x82 */\n};\n\n/*\n * Access point (read only)\n */\nstruct an_ltv_apinfo {\n\tu_int16_t\t\tan_len;\n\tu_int16_t\t\tan_type;\n\tu_int16_t\t\tan_tim_addr;\n\tu_int16_t\t\tan_airo_addr;\n};\n\n/*\n * Radio info (read only).\n */\nstruct an_ltv_radioinfo {\n\tu_int16_t\t\tan_len;\n\tu_int16_t\t\tan_type;\n\t/* ??? */\n};\n\n/* \n * RSSI map.  If available in the card's firmware, this can be used to\n * convert the 8-bit RSSI values from the card into dBm.\n */\nstruct an_ltv_rssi_map {\n\tu_int16_t\t\tan_len;\n\tu_int16_t\t\tan_type;\n\tstruct an_rssi_entry\tan_entries[256];\n};\n\n/*\n * Status (read only). Note: the manual claims this RID is 108 bytes\n * long (0x6A is the last datum, which is 2 bytes long) however when\n * this RID is read from the NIC, it returns a length of 110. To be\n * on the safe side, this structure is padded with an extra 16-bit\n * word. (There is a misprint in the manual which says the macaddr\n * field is 8 bytes long.)\n *\n * Also, the channel_set and current_channel fields appear to be\n * reversed. Either that, or the hop_period field is unused.\n */\nstruct an_ltv_status {\n\tu_int16_t\t\tan_len;\t\t\t/* 0x00 */\n\tu_int16_t\t\tan_type;\t\t/* 0xXX */\n\tu_int8_t\t\tan_macaddr[6];\t\t/* 0x02 */\n\tu_int16_t\t\tan_opmode;\t\t/* 0x08 */\n\tu_int16_t\t\tan_errcode;\t\t/* 0x0A */\n\tu_int16_t\t\tan_signal_quality;\t/* 0x0C */\n\tu_int16_t\t\tan_ssidlen;\t\t/* 0x0E */\n\tu_int8_t\t\tan_ssid[32];\t\t/* 0x10 */\n\tu_int8_t\t\tan_ap_name[16];\t\t/* 0x30 */\n\tu_int8_t\t\tan_cur_bssid[6];\t/* 0x40 */\n\tu_int8_t\t\tan_prev_bssid1[6];\t/* 0x46 */\n\tu_int8_t\t\tan_prev_bssid2[6];\t/* 0x4C */\n\tu_int8_t\t\tan_prev_bssid3[6];\t/* 0x52 */\n\tu_int16_t\t\tan_beacon_period;\t/* 0x58 */\n\tu_int16_t\t\tan_dtim_period;\t\t/* 0x5A */\n\tu_int16_t\t\tan_atim_duration;\t/* 0x5C */\n\tu_int16_t\t\tan_hop_period;\t\t/* 0x5E */\n\tu_int16_t\t\tan_cur_channel;\t\t/* 0x62 */\n\tu_int16_t\t\tan_channel_set;\t\t/* 0x60 */\n\tu_int16_t\t\tan_hops_to_backbone;\t/* 0x64 */\n\tu_int16_t\t\tan_ap_total_load;\t/* 0x66 */\n\tu_int16_t\t\tan_our_generated_load;\t/* 0x68 */\n\tu_int16_t\t\tan_accumulated_arl;\t/* 0x6A */\n\tu_int16_t\t\tan_cur_signal_quality;\t/* 0x6C */\n\tu_int16_t\t\tan_current_tx_rate;\t/* 0x6E */\n\tu_int16_t\t\tan_ap_device;\t\t/* 0x70 */\n\tu_int16_t\t\tan_normalized_strength;\t/* 0x72 */\n\tu_int16_t\t\tan_short_pre_in_use;\t/* 0x74 */\n\tu_int8_t\t\tan_ap_ip_addr[4];\t/* 0x76 */\n\tu_int8_t\t\tan_noise_prev_sec_pc;   /* 0x7A */\n\tu_int8_t\t\tan_noise_prev_sec_db;   /* 0x7B */\n\tu_int8_t\t\tan_avg_noise_prev_min_pc;       /* 0x7C */\n\tu_int8_t\t\tan_avg_noise_prev_min_db;       /* 0x7D */\n\tu_int8_t\t\tan_max_noise_prev_min_pc;       /* 0x7E */\n\tu_int8_t\t\tan_max_noise_prev_min_db;       /* 0x7F */\n\tu_int16_t\t\tan_spare[18];\n};\n\n#define AN_STATUS_OPMODE_CONFIGURED\t\t0x0001\n#define AN_STATUS_OPMODE_MAC_ENABLED\t\t0x0002\n#define AN_STATUS_OPMODE_RX_ENABLED\t\t0x0004\n#define AN_STATUS_OPMODE_IN_SYNC\t\t0x0010\n#define AN_STATUS_OPMODE_ASSOCIATED\t\t0x0020\n#define AN_STATUS_OPMODE_LEAP\t\t\t0x0040\n#define AN_STATUS_OPMODE_ERROR\t\t\t0x8000\n\n/*\n * WEP Key\n */\nstruct an_ltv_wepkey {\n\tu_int16_t\t\tan_len;\t\t\t/* 0x00 */\n\tu_int16_t\t\tan_type;\t\t/* 0xXX */\n\tu_int16_t\t\tan_key_index;\t\t/* 0x02 */\n\tu_int8_t\t\tan_mac_addr[6];\t\t/* 0x04 */\n\tu_int16_t\t\tan_key_len;\t\t/* 0x0A */\n\tu_int8_t\t\tan_key[13];\t\t/* 0x0C */\n};\n\n/*\n * Receive frame structure.\n */\nstruct an_rxframe {\n\tu_int32_t\t\tan_rx_time;\t\t/* 0x00 */\n\tu_int16_t\t\tan_rx_status;\t\t/* 0x04 */\n\tu_int16_t\t\tan_rx_payload_len;\t/* 0x06 */\n\tu_int8_t\t\tan_rsvd0;\t\t/* 0x08 */\n\tu_int8_t\t\tan_rx_signal_strength;\t/* 0x09 */\n\tu_int8_t\t\tan_rx_rate;\t\t/* 0x0A */\n\tu_int8_t\t\tan_rx_chan;\t\t/* 0x0B */\n\tu_int8_t\t\tan_rx_assoc_cnt;\t/* 0x0C */\n\tu_int8_t\t\tan_rsvd1[3];\t\t/* 0x0D */\n\tu_int8_t\t\tan_plcp_hdr[4];\t\t/* 0x10 */\n\tu_int16_t\t\tan_frame_ctl;\t\t/* 0x14 */\n\tu_int16_t\t\tan_duration;\t\t/* 0x16 */\n\tu_int8_t\t\tan_addr1[6];\t\t/* 0x18 */\n\tu_int8_t\t\tan_addr2[6];\t\t/* 0x1E */\n\tu_int8_t\t\tan_addr3[6];\t\t/* 0x24 */\n\tu_int16_t\t\tan_seq_ctl;\t\t/* 0x2A */\n\tu_int8_t\t\tan_addr4[6];\t\t/* 0x2C */\n\tu_int8_t\t\tan_gaplen;\t\t/* 0x32 */\n} __packed;\n\n\n/* Do not modify this unless you are modifying LEAP itself */\n#define LEAP_USERNAME_MAX 32\n#define LEAP_PASSWORD_MAX 32\n\n/*\n * LEAP Username\n */\nstruct an_ltv_leap_username {\n\tu_int16_t\t\tan_len;\t\t\t/* 0x00 */\n\tu_int16_t\t\tan_type;\t\t/* 0xXX */\n\tu_int16_t\t\tan_username_len;\t/* 0x02 */\n\tu_int8_t\t\tan_username[LEAP_USERNAME_MAX];\t/* 0x04 */\n};\n\n/*\n * LEAP Password\n */\nstruct an_ltv_leap_password {\n\tu_int16_t\t\tan_len;\t\t\t/* 0x00 */\n\tu_int16_t\t\tan_type;\t\t/* 0xXX */\n\tu_int16_t\t\tan_password_len;\t/* 0x02 */\n\tu_int8_t\t\tan_password[LEAP_PASSWORD_MAX];\t/* 0x04 */\n};\n\n/*\n * These are all the LTV record types that we can read or write\n * from the Aironet. Not all of them are temendously useful, but I\n * list as many as I know about here for completeness.\n */\n\n/*\n * Configuration (read/write)\n */\n#define AN_RID_GENCONFIG\t0xFF10\t/* General configuration info */\n#define AN_RID_SSIDLIST\t\t0xFF11\t/* Valid SSID list */\n#define AN_RID_APLIST\t\t0xFF12\t/* Valid AP list */\n#define AN_RID_DRVNAME\t\t0xFF13\t/* ID name of this node for diag */\n#define AN_RID_ENCAPPROTO\t0xFF14\t/* Payload encapsulation type */\n#define AN_RID_WEP_TEMP\t        0xFF15  /* Temporary Key */\n#define AN_RID_WEP_PERM\t        0xFF16  /* Perminant Key */\n#define AN_RID_ACTUALCFG\t0xFF20\t/* Current configuration settings */\n\n/*\n * Reporting (read only)\n */\n#define AN_RID_CAPABILITIES\t0xFF00\t/* PC 4500/4800 capabilities */\n#define AN_RID_AP_INFO\t\t0xFF01\t/* Access point info */\n#define AN_RID_RADIO_INFO\t0xFF02\t/* Radio info */\n#define AN_RID_RSSI_MAP         0xFF04  /* RSSI <-> dBm table */\n#define AN_RID_STATUS\t\t0xFF50\t/* Current status info */\n#define AN_RID_BEACONS_HST\t0xFF51\n#define AN_RID_BUSY_HST\t\t0xFF52\n#define AN_RID_RETRIES_HST\t0xFF53\n\n/*\n * Statistics\n */\n#define AN_RID_16BITS_CUM\t0xFF60\t/* Cumulative 16-bit stats counters */\n#define AN_RID_16BITS_DELTA\t0xFF61\t/* 16-bit stats (since last clear) */\n#define AN_RID_16BITS_DELTACLR\t0xFF62\t/* 16-bit stats, clear on read */\n#define AN_RID_32BITS_CUM\t0xFF68\t/* Cumulative 32-bit stats counters */\n#define AN_RID_32BITS_DELTA\t0xFF69\t/* 32-bit stats (since last clear) */\n#define AN_RID_32BITS_DELTACLR\t0xFF6A\t/* 32-bit stats, clear on read */\n\n/*\n * LEAP\n */\n\n#define AN_RID_LEAPUSERNAME\t0xFF23\t/* Username */\n#define AN_RID_LEAPPASSWORD\t0xFF24\t/* Password */\n\n/*\n * OTHER Unknonwn for now\n */\n\n#define AN_RID_MOD\t\t0xFF17\n#define AN_RID_OPTIONS\t\t0xFF18\n#define AN_RID_FACTORY_CONFIG\t0xFF18\n\n/*\n *   FreeBSD fake RID\n */\n\n#define AN_RID_MONITOR_MODE\t0x0001\t/* Set monitor mode for driver */\n#define AN_MONITOR\t\t\t 1\n#define AN_MONITOR_ANY_BSS\t\t 2\n#define AN_MONITOR_INCLUDE_BEACON\t 4\n#define AN_MONITOR_AIRONET_HEADER\t 8\n\n#define DLT_AIRONET_HEADER \t120\t/* Has been allocated at tcpdump.org */\n\n/*\n * from the Linux driver from Cisco ... no copyright header.\n * Removed duplicated information that already existed in the FreeBSD driver\n * provides emulation of the Cisco extensions to the Linux Aironet driver.\n */\n\n/*\n * Ioctl constants to be used in airo_ioctl.command\n */\n\n#define\tAIROGCAP\t0\t/* Capability rid */\n#define AIROGCFG\t1\t/* USED A LOT  */\n#define AIROGSLIST\t2\t/* System ID list  */\n#define AIROGVLIST\t3\t/* List of specified AP's */\n#define AIROGDRVNAM\t4\t/* NOTUSED */\n#define AIROGEHTENC\t5\t/* NOTUSED */\n#define AIROGWEPKTMP\t6\n#define AIROGWEPKNV\t7\n#define AIROGSTAT\t8\n#define AIROGSTATSC32\t9\n#define AIROGSTATSD32\t10\n\n/*\n * Leave gap of 40 commands after AIROGSTATSD32\n */\n\n#define AIROPCAP\tAIROGSTATSD32\t+ 40\n#define AIROPVLIST\tAIROPCAP\t+ 1\n#define AIROPSLIST\tAIROPVLIST\t+ 1\n#define AIROPCFG\tAIROPSLIST\t+ 1\n#define AIROPSIDS\tAIROPCFG\t+ 1\n#define AIROPAPLIST\tAIROPSIDS\t+ 1\n#define AIROPMACON\tAIROPAPLIST\t+ 1\t/* Enable mac  */\n#define AIROPMACOFF\tAIROPMACON\t+ 1\t/* Disable mac */\n#define AIROPSTCLR\tAIROPMACOFF\t+ 1\n#define AIROPWEPKEY\tAIROPSTCLR\t+ 1\n#define AIROPWEPKEYNV\tAIROPWEPKEY\t+ 1\n#define AIROPLEAPPWD\tAIROPWEPKEYNV\t+ 1\n#define AIROPLEAPUSR\tAIROPLEAPPWD\t+ 1\n\n/*\n * Another gap of 40 commands before flash codes\n */\n\n#define AIROFLSHRST\tAIROPWEPKEYNV\t+ 40\n#define AIROFLSHGCHR\tAIROFLSHRST\t+ 1\n#define AIROFLSHSTFL\tAIROFLSHGCHR\t+ 1\n#define AIROFLSHPCHR\tAIROFLSHSTFL\t+ 1\n#define AIROFLPUTBUF\tAIROFLSHPCHR\t+ 1\n#define AIRORESTART\tAIROFLPUTBUF\t+ 1\n\n/*\n * Struct to enable up to 65535 ioctl's\n */\n\n#define AIROMAGIC\t0xa55a\n\ntypedef struct aironet_ioctl {\n  unsigned short command;\t/* What to do */\n  unsigned short len;\t\t/* Len of data */\n  unsigned char *data;\t\t/* d-data */\n} airo_ioctl;\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/dev/an/if_anreg.h",
    "content": "/*-\n * Copyright (c) 1997, 1998, 1999\n *\tBill Paul <wpaul@ctr.columbia.edu>.  All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. All advertising materials mentioning features or use of this software\n *    must display the following acknowledgement:\n *\tThis product includes software developed by Bill Paul.\n * 4. Neither the name of the author nor the names of any co-contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY Bill Paul AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL Bill Paul OR THE VOICES IN HIS HEAD\n * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\n * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\n * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\n * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\n * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF\n * THE POSSIBILITY OF SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/dev/an/if_anreg.h 199757 2009-11-24 16:57:35Z jhb $\n */\n\n#define AN_TIMEOUT\t65536\n\n/* Default network name: <empty string> */\n#define AN_DEFAULT_NETNAME\t\"\"\n\n/* The nodename must be less than 16 bytes */\n#define AN_DEFAULT_NODENAME\t\"FreeBSD\"\n\n#define AN_DEFAULT_IBSS\t\t\"FreeBSD IBSS\"\n\n/*\n * register space access macros\n */\n#define CSR_WRITE_2(sc, reg, val)\tbus_write_2(sc->port_res, reg, val)\n\n#define CSR_READ_2(sc, reg)\t\tbus_read_2(sc->port_res, reg)\n\n#define CSR_WRITE_1(sc, reg, val)\tbus_write_1(sc->port_res, reg, val)\n\n#define CSR_READ_1(sc, reg)\t\tbus_read_1(sc->port_res, reg)\n\n/*\n * memory space access macros\n */\n#define CSR_MEM_WRITE_2(sc, reg, val)\tbus_write_2(sc->mem_res, reg, val)\n\n#define CSR_MEM_READ_2(sc, reg)\t\tbus_read_2(sc->mem_res, reg)\n\n#define CSR_MEM_WRITE_1(sc, reg, val)\tbus_write_1(sc->mem_res, reg, val)\n\n#define CSR_MEM_READ_1(sc, reg)\t\tbus_read_1(sc->mem_res, reg)\n\n/*\n * aux. memory space access macros\n */\n#define CSR_MEM_AUX_WRITE_4(sc, reg, val)\t\\\n\tbus_write_4(sc->mem_aux_res, reg, val)\n\n#define CSR_MEM_AUX_READ_4(sc, reg)\t\t\\\n\tbus_read_4(sc->mem_aux_res, reg)\n\n#define CSR_MEM_AUX_WRITE_1(sc, reg, val)\t\\\n\tbus_write_1(sc->mem_aux_res, reg, val)\n\n#define CSR_MEM_AUX_READ_1(sc, reg)\t\t\\\n\tbus_read_1(sc->mem_aux_res, reg)\n\n/*\n * Size of Aironet I/O space.\n */\n#define AN_IOSIZ\t\t0x40\n\n/*\n * Size of aux. memory space ... probably not needed DJA \n */\n#define AN_AUX_MEM_SIZE\t\t(256 * 1024)\n\n/*\n * Hermes register definitions and what little I know about them.\n */\n\n/* Hermes command/status registers. */\n#define AN_COMMAND(x)\t\t(x ? 0x00 : 0x00)\n#define AN_PARAM0(x)\t\t(x ? 0x04 : 0x02)\n#define AN_PARAM1(x)\t\t(x ? 0x08 : 0x04)\n#define AN_PARAM2(x)\t\t(x ? 0x0c : 0x06)\n#define AN_STATUS(x)\t\t(x ? 0x10 : 0x08)\n#define AN_RESP0(x)\t\t(x ? 0x14 : 0x0A)\n#define AN_RESP1(x)\t\t(x ? 0x18 : 0x0C)\n#define AN_RESP2(x)\t\t(x ? 0x1c : 0x0E)\n#define AN_LINKSTAT(x)\t\t(x ? 0x20 : 0x10)\n\n/* Command register */\n#define AN_CMD_BUSY\t\t0x8000 /* busy bit */\n#define AN_CMD_NO_ACK\t\t0x0080 /* don't acknowledge command */\n#define AN_CMD_CODE_MASK\t0x003F\n#define AN_CMD_QUAL_MASK\t0x7F00\n\n/* Command codes */\n#define AN_CMD_NOOP\t\t0x0000 /* no-op */\n#define AN_CMD_ENABLE\t\t0x0001 /* enable */\n#define AN_CMD_DISABLE\t\t0x0002 /* disable */\n#define AN_CMD_FORCE_SYNCLOSS\t0x0003 /* force loss of sync */\n#define AN_CMD_FW_RESTART\t0x0004 /* firmware restart */\n#define AN_CMD_HOST_SLEEP\t0x0005\n#define AN_CMD_MAGIC_PKT\t0x0006\n#define AN_CMD_READCFG\t\t0x0008\n#define AN_CMD_SET_MODE\t\t0x0009\n#define AN_CMD_ALLOC_MEM\t0x000A /* allocate NIC memory */\n#define AN_CMD_TX\t\t0x000B /* transmit */\n#define AN_CMD_DEALLOC_MEM\t0x000C\n#define AN_CMD_NOOP2\t\t0x0010\n#define AN_CMD_ALLOC_DESC\t0x0020\n#define AN_CMD_ACCESS\t\t0x0021\n#define AN_CMD_ALLOC_BUF\t0x0028\n#define AN_CMD_PSP_NODES\t0x0030\n#define AN_CMD_SET_PHYREG\t0x003E\n#define AN_CMD_TX_TEST\t\t0x003F\n#define AN_CMD_SLEEP\t\t0x0085\n#define AN_CMD_SAVECFG\t\t0x0108\n\n/*\n * MPI 350 DMA descriptor information\n */\n#define AN_DESCRIPTOR_TX\t0x01\n#define AN_DESCRIPTOR_RX\t0x02\n#define AN_DESCRIPTOR_TXCMP\t0x04\n#define AN_DESCRIPTOR_HOSTWRITE\t0x08\n#define AN_DESCRIPTOR_HOSTREAD\t0x10\n#define AN_DESCRIPTOR_HOSTRW\t0x20\n\n#define AN_MAX_RX_DESC 1\n#define AN_MAX_TX_DESC 1\n#define AN_HOSTBUFSIZ 1840\n\nstruct an_card_rid_desc\n{\n\tunsigned\tan_rid:16;\n\tunsigned\tan_len:15;\n\tunsigned\tan_valid:1;\n\tu_int64_t\tan_phys;\n};\n\nstruct an_card_rx_desc\n{\n\tunsigned\tan_ctrl:15;\n\tunsigned\tan_done:1;\n\tunsigned\tan_len:15;\n\tunsigned\tan_valid:1;\n\tu_int64_t\tan_phys;\n};\n\nstruct an_card_tx_desc\n{\n\tunsigned\tan_offset:15;\n\tunsigned\tan_eoc:1;\n\tunsigned\tan_len:15;\n\tunsigned\tan_valid:1;\n\tu_int64_t\tan_phys;\n};\n\n#define AN_RID_BUFFER_SIZE\tAN_MAX_DATALEN\n#define AN_RX_BUFFER_SIZE\tAN_HOSTBUFSIZ\n#define AN_TX_BUFFER_SIZE\tAN_HOSTBUFSIZ\n/*#define AN_HOST_DESC_OFFSET\t0xC sort of works */\n#define AN_HOST_DESC_OFFSET\t0x800\n#define AN_RX_DESC_OFFSET  (AN_HOST_DESC_OFFSET + \\\n    sizeof(struct an_card_rid_desc))\n#define AN_TX_DESC_OFFSET (AN_RX_DESC_OFFSET + \\\n    (AN_MAX_RX_DESC * sizeof(struct an_card_rx_desc)))\n\nstruct an_command {\n\tu_int16_t\tan_cmd;\n\tu_int16_t\tan_parm0;\n\tu_int16_t\tan_parm1;\n\tu_int16_t\tan_parm2;\n};\n\nstruct an_reply {\n\tu_int16_t\tan_status;\n\tu_int16_t\tan_resp0;\n\tu_int16_t\tan_resp1;\n\tu_int16_t\tan_resp2;\n};\n\n/*\n * Reclaim qualifier bit, applicable to the\n * TX command.\n */\n#define AN_RECLAIM\t\t0x0100 /* reclaim NIC memory */\n\n/*\n * ACCESS command qualifier bits.\n */\n#define AN_ACCESS_READ\t\t0x0000\n#define AN_ACCESS_WRITE\t\t0x0100\n\n/*\n * PROGRAM command qualifier bits.\n */\n#define AN_PROGRAM_DISABLE\t0x0000\n#define AN_PROGRAM_ENABLE_RAM\t0x0100\n#define AN_PROGRAM_ENABLE_NVRAM\t0x0200\n#define AN_PROGRAM_NVRAM\t0x0300\n\n/* Status register values */\n#define AN_STAT_CMD_CODE\t0x003F\n#define AN_STAT_CMD_RESULT\t0x7F00\n\n/* Linkstat register */\n#define AN_LINKSTAT_ASSOCIATED\t\t0x0400\n#define AN_LINKSTAT_AUTHFAIL\t\t0x0300\n#define AN_LINKSTAT_ASSOC_FAIL\t\t0x8400\n#define AN_LINKSTAT_DISASSOC\t\t0x8200\n#define AN_LINKSTAT_DEAUTH\t\t0x8100\n#define AN_LINKSTAT_SYNCLOST_TSF\t0x8004\n#define AN_LINKSTAT_SYNCLOST_HOSTREQ\t0x8003\n#define AN_LINKSTAT_SYNCLOST_AVGRETRY\t0x8002\n#define AN_LINKSTAT_SYNCLOST_MAXRETRY\t0x8001\n#define AN_LINKSTAT_SYNCLOST_MISSBEACON\t0x8000\n\n/* memory handle management registers */\n#define AN_RX_FID\t\t0x20\n#define AN_ALLOC_FID\t\t0x22\n#define AN_TX_CMP_FID(x)\t(x ? 0x1a : 0x24)\n\n/*\n * Buffer Access Path (BAP) registers.\n * These are I/O channels. I believe you can use each one for\n * any desired purpose independently of the other. In general\n * though, we use BAP1 for reading and writing LTV records and\n * reading received data frames, and BAP0 for writing transmit\n * frames. This is a convention though, not a rule.\n */\n#define AN_SEL0\t\t\t0x18\n#define AN_SEL1\t\t\t0x1A\n#define AN_OFF0\t\t\t0x1C\n#define AN_OFF1\t\t\t0x1E\n#define AN_DATA0\t\t0x36\n#define AN_DATA1\t\t0x38\n#define AN_BAP0\t\t\tAN_DATA0\n#define AN_BAP1\t\t\tAN_DATA1\n\n#define AN_OFF_BUSY\t\t0x8000\n#define AN_OFF_ERR\t\t0x4000\n#define AN_OFF_DONE\t\t0x2000\n#define AN_OFF_DATAOFF\t\t0x0FFF\n\n/* Event registers */\n#define AN_EVENT_STAT(x)\t(x ? 0x60 : 0x30)\t/* Event status */\n#define AN_INT_EN(x)\t\t(x ? 0x64 : 0x32)\t/* Interrupt enable/\n\t\t\t\t\t\t\t   disable */\n#define AN_EVENT_ACK(x)\t\t(x ? 0x68 : 0x34)\t/* Ack event */\n\n/* Events */\n#define AN_EV_CLR_STUCK_BUSY\t0x4000\t/* clear stuck busy bit */\n#define AN_EV_WAKEREQUEST\t0x2000\t/* awaken from PSP mode */\n#define AN_EV_MIC\t\t0x1000\t/* Message Integrity Check*/\n#define AN_EV_AWAKE\t\t0x0100\t/* station woke up from PSP mode*/\n#define AN_EV_LINKSTAT\t\t0x0080\t/* link status available */\n#define AN_EV_CMD\t\t0x0010\t/* command completed */\n#define AN_EV_ALLOC\t\t0x0008\t/* async alloc/reclaim completed */\n#define AN_EV_TX_CPY\t\t0x0400\n#define AN_EV_TX_EXC\t\t0x0004\t/* async xmit completed with failure */\n#define AN_EV_TX\t\t0x0002\t/* async xmit completed succesfully */\n#define AN_EV_RX\t\t0x0001\t/* async rx completed */\n\n#define AN_INTRS(x)\t\\\n\t( x ? (AN_EV_RX|AN_EV_TX|AN_EV_TX_EXC|AN_EV_TX_CPY|AN_EV_ALLOC \\\n\t       |AN_EV_LINKSTAT|AN_EV_MIC) \\\n\t  : \\\n\t      (AN_EV_RX|AN_EV_TX|AN_EV_TX_EXC|AN_EV_ALLOC \\\n\t       |AN_EV_LINKSTAT|AN_EV_MIC) \\\n\t      )\n\n/* Host software registers */\n#define AN_SW0(x)\t\t(x ? 0x50 : 0x28)\n#define AN_SW1(x)\t\t(x ? 0x54 : 0x2A)\n#define AN_SW2(x)\t\t(x ? 0x58 : 0x2C)\n#define AN_SW3(x)\t\t(x ? 0x5c : 0x2E)\n\n#define AN_CNTL\t\t\t0x14\n\n#define AN_CNTL_AUX_ENA\t\t0xC000\n#define AN_CNTL_AUX_ENA_STAT\t0xC000\n#define AN_CNTL_AUX_DIS_STAT\t0x0000\n#define AN_CNTL_AUX_ENA_CNTL\t0x8000\n#define AN_CNTL_AUX_DIS_CNTL\t0x4000\n\n#define AN_AUX_PAGE\t\t0x3A\n#define AN_AUX_OFFSET\t\t0x3C\n#define AN_AUX_DATA\t\t0x3E\n\n/*\n * Length, Type, Value (LTV) record definitions and RID values.\n */\nstruct an_ltv_gen {\n\tu_int16_t\t\tan_len;\n\tu_int16_t\t\tan_type;\n\tu_int16_t\t\tan_val;\n};\n\n#define AN_DEF_SSID_LEN\t\t7\n#define AN_DEF_SSID\t\t\"tsunami\"\n\n#define AN_RXGAP_MAX\t8\n\n/*\n * Transmit frame structure.\n */\nstruct an_txframe {\n\tu_int32_t\t\tan_tx_sw;\t\t/* 0x00 */\n\tu_int16_t\t\tan_tx_status;\t\t/* 0x04 */\n\tu_int16_t\t\tan_tx_payload_len;\t/* 0x06 */\n\tu_int16_t\t\tan_tx_ctl;\t\t/* 0x08 */\n\tu_int16_t\t\tan_tx_assoc_id;\t\t/* 0x0A */\n\tu_int16_t\t\tan_tx_retry;\t\t/* 0x0C */\n\tu_int8_t\t\tan_tx_assoc_cnt;\t/* 0x0E */\n\tu_int8_t\t\tan_tx_rate;\t\t/* 0x0F */\n\tu_int8_t\t\tan_tx_max_long_retries;\t/* 0x10 */\n\tu_int8_t\t\tan_tx_max_short_retries; /*0x11 */\n\tu_int8_t\t\tan_rsvd0[2];\t\t/* 0x12 */\n\tu_int16_t\t\tan_frame_ctl;\t\t/* 0x14 */\n\tu_int16_t\t\tan_duration;\t\t/* 0x16 */\n\tu_int8_t\t\tan_addr1[6];\t\t/* 0x18 */\n\tu_int8_t\t\tan_addr2[6];\t\t/* 0x1E */\n\tu_int8_t\t\tan_addr3[6];\t\t/* 0x24 */\n\tu_int16_t\t\tan_seq_ctl;\t\t/* 0x2A */\n\tu_int8_t\t\tan_addr4[6];\t\t/* 0x2C */\n\tu_int8_t\t\tan_gaplen;\t\t/* 0x32 */\n} __packed;\n\nstruct an_rxframe_802_3 {\n        u_int16_t\t\tan_rx_802_3_status;     /* 0x34 */\n\tu_int16_t\t\tan_rx_802_3_payload_len;/* 0x36 */\n\tu_int8_t\t\tan_rx_dst_addr[6];      /* 0x38 */\n\tu_int8_t\t\tan_rx_src_addr[6];      /* 0x3E */\n};\n#define AN_RXGAP_MAX\t8\n\n\nstruct an_txframe_802_3 {\n/*\n * Transmit 802.3 header structure.\n */\n        u_int16_t\t\tan_tx_802_3_status;     /* 0x34 */\n\tu_int16_t\t\tan_tx_802_3_payload_len;/* 0x36 */\n\tu_int8_t\t\tan_tx_dst_addr[6];      /* 0x38 */\n\tu_int8_t\t\tan_tx_src_addr[6];      /* 0x3E */\n};\n\n#define AN_TXSTAT_EXCESS_RETRY\t0x0002\n#define AN_TXSTAT_LIFE_EXCEEDED\t0x0004\n#define AN_TXSTAT_AID_FAIL\t0x0008\n#define AN_TXSTAT_MAC_DISABLED\t0x0010\n#define AN_TXSTAT_ASSOC_LOST\t0x0020\n\n#define AN_TXCTL_RSVD\t\t0x0001\n#define AN_TXCTL_TXOK_INTR\t0x0002\n#define AN_TXCTL_TXERR_INTR\t0x0004\n#define AN_TXCTL_HEADER_TYPE\t0x0008\n#define AN_TXCTL_PAYLOAD_TYPE\t0x0010\n#define AN_TXCTL_NORELEASE\t0x0020\n#define AN_TXCTL_NORETRIES\t0x0040\n#define AN_TXCTL_CLEAR_AID\t0x0080\n#define AN_TXCTL_STRICT_ORDER\t0x0100\n#define AN_TXCTL_USE_RTS\t0x0200\n\n#define AN_HEADERTYPE_8023\t0x0000\n#define AN_HEADERTYPE_80211\t0x0008\n\n#define AN_PAYLOADTYPE_ETHER\t0x0000\n#define AN_PAYLOADTYPE_LLC\t0x0010\n\n#define AN_TXCTL_80211\t\t(AN_HEADERTYPE_80211|AN_PAYLOADTYPE_LLC)\n\n#define AN_TXCTL_8023\t\t(AN_HEADERTYPE_8023|AN_PAYLOADTYPE_ETHER)\n\n/*\n * Additions to transmit control bits for MPI350\n */\n#define\tAN_TXCTL_HW(x)\t\\\n\t( x ? (AN_TXCTL_NORELEASE) \\\n\t  : \\\n\t      (AN_TXCTL_TXOK_INTR|AN_TXCTL_TXERR_INTR|AN_TXCTL_NORELEASE) \\\n\t      )\n\n#define AN_TXGAP_80211\t\t0\n#define AN_TXGAP_8023\t\t0\n\nstruct an_802_3_hdr {\n\tu_int16_t\t\tan_8023_status;\n\tu_int16_t\t\tan_8023_payload_len;\n\tu_int8_t\t\tan_8023_dst_addr[6];\n\tu_int8_t\t\tan_8023_src_addr[6];\n\tu_int16_t\t\tan_8023_dat[3];\t/* SNAP header */\n\tu_int16_t\t\tan_8023_type;\n};\n\nstruct an_snap_hdr {\n\tu_int16_t\t\tan_snap_dat[3];\t/* SNAP header */\n\tu_int16_t\t\tan_snap_type;\n};\n\nstruct an_dma_alloc {\n\tu_int32_t\t\tan_dma_paddr;\n\tcaddr_t\t\t\tan_dma_vaddr;\n\tbus_dmamap_t\t\tan_dma_map;\n\tbus_dma_segment_t\tan_dma_seg;\n\tbus_size_t\t\tan_dma_size;\n\tint\t\t\tan_dma_nseg;\n};\n\n#define AN_TX_RING_CNT\t\t4\n#define AN_INC(x, y)\t\t(x) = (x + 1) % y\n\nstruct an_tx_ring_data {\n\tu_int16_t\t\tan_tx_fids[AN_TX_RING_CNT];\n\tu_int16_t\t\tan_tx_ring[AN_TX_RING_CNT];\n\tint\t\t\tan_tx_prod;\n\tint\t\t\tan_tx_cons;\n\tint\t\t\tan_tx_empty;\n};\n\nstruct an_softc\t{\n\tstruct ifnet\t\t*an_ifp;\n\n\tint\tport_rid;\t/* resource id for port range */\n\tstruct resource* port_res; /* resource for port range */\n\tint     mem_rid;\t/* resource id for memory range */\n        int     mem_used;\t/* nonzero if memory used */\n\tstruct resource* mem_res; /* resource for memory range */\n\tint     mem_aux_rid;\t/* resource id for memory range */\n        int     mem_aux_used;\t/* nonzero if memory used */\n\tstruct resource* mem_aux_res; /* resource for memory range */\n\tint\tirq_rid;\t/* resource id for irq */\n\tvoid*\tirq_handle;\t/* handle for irq handler */\n\tstruct resource* irq_res; /* resource for irq */\n\n\tbus_space_handle_t\tan_mem_aux_bhandle;\n\tbus_space_tag_t\t\tan_mem_aux_btag;\n\tbus_dma_tag_t\t\tan_dtag;\n\tstruct an_ltv_genconfig\tan_config;\n\tstruct an_ltv_caps\tan_caps;\n\tstruct an_ltv_ssidlist_new\tan_ssidlist;\n\tstruct an_ltv_aplist\tan_aplist;\n        struct an_ltv_key\tan_temp_keys[4];\n\tint\t\t\tan_tx_rate;\n\tint\t\t\tan_rxmode;\n\tint\t\t\tan_gone;\n\tint\t\t\tan_if_flags;\n\tu_int8_t\t\tan_txbuf[1536];\n\tstruct an_tx_ring_data\tan_rdata;\n\tstruct an_ltv_stats\tan_stats;\n\tstruct an_ltv_status\tan_status;\n\tu_int8_t\t\tan_associated;\n#ifdef ANCACHE\n\tint\t\t\tan_sigitems;\n\tstruct an_sigcache\tan_sigcache[MAXANCACHE];\n\tint\t\t\tan_nextitem;\n\tint\t\t\tan_have_rssimap;\n\tstruct an_ltv_rssi_map\tan_rssimap;\n#endif\n\tstruct callout\t\tan_stat_ch;\n\tstruct mtx\t\tan_mtx;\n\tdevice_t\t\tan_dev;\n\tstruct ifmedia\t\tan_ifmedia;\n\tint\t\t        an_monitor;\n\tint\t\t        an_was_monitor;\n\tint\t\t\tan_timer;\n\tu_char\t\t\tbuf_802_11[MCLBYTES];\n\tstruct an_req\t\tareq;\n\tunsigned short*\t\tan_flash_buffer;\n\tint\t\t\tmpi350;\n\tstruct an_dma_alloc\tan_rid_buffer;\n\tstruct an_dma_alloc\tan_rx_buffer[AN_MAX_RX_DESC];\n\tstruct an_dma_alloc\tan_tx_buffer[AN_MAX_TX_DESC];\n};\n\n#define AN_LOCK(_sc)\t\tmtx_lock(&(_sc)->an_mtx)\n#define AN_UNLOCK(_sc)\t\tmtx_unlock(&(_sc)->an_mtx)\n#define AN_LOCK_ASSERT(_sc)\tmtx_assert(&(_sc)->an_mtx, MA_OWNED)\n\nvoid\tan_release_resources\t(device_t);\nint\tan_alloc_port\t\t(device_t, int, int);\nint\tan_alloc_memory\t\t(device_t, int, int);\nint\tan_alloc_aux_memory\t(device_t, int, int);\nint\tan_alloc_irq\t\t(device_t, int, int);\nint\tan_pci_probe\t(device_t);\nint\tan_probe\t(device_t);\nint\tan_shutdown\t(device_t);\nvoid\tan_resume\t(device_t);\nint\tan_attach\t\t(struct an_softc *, int);\nint\tan_detach\t(device_t);\nvoid    an_stop\t\t(struct an_softc *);\n\ndriver_intr_t\tan_intr;\n\n#define AN_802_3_OFFSET\t\t0x2E\n#define AN_802_11_OFFSET\t0x44\n#define AN_802_11_OFFSET_RAW\t0x3C\n\n#define AN_STAT_BADCRC\t\t0x0001\n#define AN_STAT_UNDECRYPTABLE\t0x0002\n#define AN_STAT_ERRSTAT\t\t0x0003\n#define AN_STAT_MAC_PORT\t0x0700\n#define AN_STAT_1042\t\t0x2000\t/* RFC1042 encoded */\n#define AN_STAT_TUNNEL\t\t0x4000\t/* Bridge-tunnel encoded */\n#define AN_STAT_WMP_MSG\t\t0x6000\t/* WaveLAN-II management protocol */\n#define AN_RXSTAT_MSG_TYPE\t0xE000\n\n#define AN_ENC_TX_802_3\t\t0x00\n#define AN_ENC_TX_802_11\t0x11\n#define AN_ENC_TX_E_II\t\t0x0E\n\n#define AN_ENC_TX_1042\t\t0x00\n#define AN_ENC_TX_TUNNEL\t0xF8\n\n#define AN_TXCNTL_MACPORT\t0x00FF\n#define AN_TXCNTL_STRUCTTYPE\t0xFF00\n\n/*\n * SNAP (sub-network access protocol) constants for transmission\n * of IP datagrams over IEEE 802 networks, taken from RFC1042.\n * We need these for the LLC/SNAP header fields in the TX/RX frame\n * structure.\n */\n#define AN_SNAP_K1\t\t0xaa\t/* assigned global SAP for SNAP */\n#define AN_SNAP_K2\t\t0x00\n#define AN_SNAP_CONTROL\t\t0x03\t/* unnumbered information format */\n#define AN_SNAP_WORD0\t\t(AN_SNAP_K1 | (AN_SNAP_K1 << 8))\n#define AN_SNAP_WORD1\t\t(AN_SNAP_K2 | (AN_SNAP_CONTROL << 8))\n#define AN_SNAPHDR_LEN\t\t0x6\n"
  },
  {
    "path": "freebsd-headers/dev/bktr/ioctl_bt848.h",
    "content": "/*\n * extensions to ioctl_meteor.h for the bt848 cards\n *\n * $FreeBSD: release/9.0.0/sys/dev/bktr/ioctl_bt848.h 205781 2010-03-28 00:10:09Z gibbs $\n */\n\n#ifndef  _DEV_BKTR_IOCTL_BT848_H_\n#define  _DEV_BKTR_IOCTL_BT848_H_\n\n/*\n * frequency sets\n */\n#define CHNLSET_NABCST\t\t1\n#define CHNLSET_CABLEIRC\t2\n#define CHNLSET_CABLEHRC\t3\n#define CHNLSET_WEUROPE\t\t4\n#define CHNLSET_JPNBCST         5\n#define CHNLSET_JPNCABLE        6\n#define CHNLSET_XUSSR           7\n#define CHNLSET_AUSTRALIA       8\n#define CHNLSET_FRANCE          9\n#define CHNLSET_MIN\t        CHNLSET_NABCST\n#define CHNLSET_MAX\t        CHNLSET_FRANCE\n\n\n/*\n * constants for various tuner registers\n */\n#define BT848_HUEMIN\t\t(-90)\n#define BT848_HUEMAX\t\t90\n#define BT848_HUECENTER\t\t0\n#define BT848_HUERANGE\t\t179.3\n#define BT848_HUEREGMIN\t\t(-128)\n#define BT848_HUEREGMAX\t\t127\n#define BT848_HUESTEPS\t\t256\n\n#define BT848_BRIGHTMIN\t\t(-50)\n#define BT848_BRIGHTMAX\t\t50\n#define BT848_BRIGHTCENTER\t0\n#define BT848_BRIGHTRANGE\t99.6\n#define BT848_BRIGHTREGMIN\t(-128)\n#define BT848_BRIGHTREGMAX\t127\n#define BT848_BRIGHTSTEPS\t256\n\n#define BT848_CONTRASTMIN\t0\n#define BT848_CONTRASTMAX\t237\n#define BT848_CONTRASTCENTER\t100\n#define BT848_CONTRASTRANGE\t236.57\n#define BT848_CONTRASTREGMIN\t0\n#define BT848_CONTRASTREGMAX\t511\n#define BT848_CONTRASTSTEPS\t512\n\n#define BT848_CHROMAMIN\t\t0\n#define BT848_CHROMAMAX\t\t284\n#define BT848_CHROMACENTER\t100\n#define BT848_CHROMARANGE\t283.89\n#define BT848_CHROMAREGMIN\t0\n#define BT848_CHROMAREGMAX\t511\n#define BT848_CHROMASTEPS\t512\n\n#define BT848_SATUMIN\t\t0\n#define BT848_SATUMAX\t\t202\n#define BT848_SATUCENTER\t100\n#define BT848_SATURANGE\t\t201.18\n#define BT848_SATUREGMIN\t0\n#define BT848_SATUREGMAX\t511\n#define BT848_SATUSTEPS\t\t512\n\n#define BT848_SATVMIN\t\t0\n#define BT848_SATVMAX\t\t284\n#define BT848_SATVCENTER\t100\n#define BT848_SATVRANGE\t\t283.89\n#define BT848_SATVREGMIN\t0\n#define BT848_SATVREGMAX\t511\n#define BT848_SATVSTEPS\t\t512\n\n\n/*\n * audio stuff\n */\n#define AUDIO_TUNER\t\t0x00\t/* command for the audio routine */\n#define AUDIO_EXTERN\t\t0x01\t/* don't confuse them with bit */\n#define AUDIO_INTERN\t\t0x02\t/* settings */\n#define AUDIO_MUTE\t\t0x80\n#define AUDIO_UNMUTE\t\t0x81\n\n\n/*\n * EEProm stuff\n */\nstruct eeProm {\n\tshort\t\toffset;\n\tshort\t\tcount;\n\tunsigned char\tbytes[ 256 ];\n};\n\n\n/*\n * XXX: this is a hack, should be in ioctl_meteor.h\n * here to avoid touching that file for now...\n */\n#define\tTVTUNER_SETCHNL    _IOW('x', 32, unsigned int)\t/* set channel */\n#define\tTVTUNER_GETCHNL    _IOR('x', 32, unsigned int)\t/* get channel */\n#define\tTVTUNER_SETTYPE    _IOW('x', 33, unsigned int)\t/* set tuner type */\n#define\tTVTUNER_GETTYPE    _IOR('x', 33, unsigned int)\t/* get tuner type */\n#define\tTVTUNER_GETSTATUS  _IOR('x', 34, unsigned int)\t/* get tuner status */\n#define\tTVTUNER_SETFREQ    _IOW('x', 35, unsigned int)\t/* set frequency */\n#define\tTVTUNER_GETFREQ    _IOR('x', 36, unsigned int)\t/* get frequency */\n \n\n#define BT848_SHUE\t_IOW('x', 37, int)\t\t/* set hue */\n#define BT848_GHUE\t_IOR('x', 37, int)\t\t/* get hue */\n#define\tBT848_SBRIG\t_IOW('x', 38, int)\t\t/* set brightness */\n#define BT848_GBRIG\t_IOR('x', 38, int)\t\t/* get brightness */\n#define\tBT848_SCSAT\t_IOW('x', 39, int)\t\t/* set chroma sat */\n#define BT848_GCSAT\t_IOR('x', 39, int)\t\t/* get UV saturation */\n#define\tBT848_SCONT\t_IOW('x', 40, int)\t\t/* set contrast */\n#define\tBT848_GCONT\t_IOR('x', 40, int)\t\t/* get contrast */\n#define\tBT848_SVSAT\t_IOW('x', 41, int)\t\t/* set chroma V sat */\n#define BT848_GVSAT\t_IOR('x', 41, int)\t\t/* get V saturation */\n#define\tBT848_SUSAT\t_IOW('x', 42, int)\t\t/* set chroma U sat */\n#define BT848_GUSAT\t_IOR('x', 42, int)\t\t/* get U saturation */\n\n#define\tBT848_SCBARS\t_IOR('x', 43, int)\t\t/* set colorbar */\n#define\tBT848_CCBARS\t_IOR('x', 44, int)\t\t/* clear colorbar */\n\n\n#define\tBT848_SAUDIO\t_IOW('x', 46, int)\t\t/* set audio channel */\n#define BT848_GAUDIO\t_IOR('x', 47, int)\t\t/* get audio channel */\n#define\tBT848_SBTSC\t_IOW('x', 48, int)\t\t/* set audio channel */\n\n#define\tBT848_GSTATUS\t_IOR('x', 49, unsigned int)\t/* reap status */\n\n#define\tBT848_WEEPROM\t_IOWR('x', 50, struct eeProm)\t/* write to EEProm */\n#define\tBT848_REEPROM\t_IOWR('x', 51, struct eeProm)\t/* read from EEProm */\n\n#define\tBT848_SIGNATURE\t_IOWR('x', 52, struct eeProm)\t/* read card sig */\n\n#define\tTVTUNER_SETAFC\t_IOW('x', 53, int)\t\t/* turn AFC on/off */\n#define TVTUNER_GETAFC\t_IOR('x', 54, int)\t\t/* query AFC on/off */\n#define BT848_SLNOTCH\t_IOW('x', 55, int)\t\t/* set luma notch */\n#define BT848_GLNOTCH\t_IOR('x', 56, int)\t\t/* get luma notch */\n\n/* Read/Write the BT848's I2C bus directly\n * b7-b0:    data (read/write)\n * b15-b8:   internal peripheral register (write)   \n * b23-b16:  i2c addr (write)\n * b31-b24:  1 = write, 0 = read \n */\n#define BT848_I2CWR     _IOWR('x', 57, unsigned long)    /* i2c read-write */\n\nstruct bktr_msp_control {\n\tunsigned char function;\n\tunsigned int  address;\n\tunsigned int  data;\n};\n\n#define BT848_MSP_RESET _IO('x', 76)\t\t\t\t/* MSP chip reset */\n#define BT848_MSP_READ  _IOWR('x', 77, struct bktr_msp_control)\t/* MSP chip read */\n#define BT848_MSP_WRITE _IOWR('x', 78, struct bktr_msp_control)\t/* MSP chip write */\n\n/* Support for radio tuner */\n#define RADIO_SETMODE\t _IOW('x', 58, unsigned int)  /* set radio modes */\n#define RADIO_GETMODE\t _IOR('x', 58, unsigned char)  /* get radio modes */\n#define   RADIO_AFC\t 0x01\t\t/* These modes will probably not */\n#define   RADIO_MONO\t 0x02\t\t/*  work on the FRxxxx. It does\t */\n#define   RADIO_MUTE\t 0x08\t\t/*  work on the FMxxxx.\t*/\n#define RADIO_SETFREQ    _IOW('x', 59, unsigned int)  /* set frequency   */\n#define RADIO_GETFREQ    _IOR('x', 59, unsigned int)  /* set frequency   */\n /*        Argument is frequency*100MHz  */\n\n/*\n * XXX: more bad magic,\n *      we need to fix the METEORGINPUT to return something public\n *      duplicate them here for now...\n */\n#define\tMETEOR_DEV0\t\t0x00001000\n#define\tMETEOR_DEV1\t\t0x00002000\n#define\tMETEOR_DEV2\t\t0x00004000\n#define\tMETEOR_DEV3\t\t0x00008000\n#define\tMETEOR_DEV_SVIDEO\t0x00006000\n/*\n * right now I don't know were to put these, but as they are suppose to be\n * a part of a common video capture interface, these should be relocated to\n * another place.  Probably most of the METEOR_xxx defines need to be\n * renamed and moved to a common header\n */\n\ntypedef enum { METEOR_PIXTYPE_RGB, METEOR_PIXTYPE_YUV,\n\t       METEOR_PIXTYPE_YUV_PACKED,\n\t       METEOR_PIXTYPE_YUV_12 } METEOR_PIXTYPE;\n\n\nstruct meteor_pixfmt {\n\tunsigned int   index;         /* Index in supported pixfmt list     */\n\tMETEOR_PIXTYPE type;          /* What's the board gonna feed us     */\n\tunsigned int   Bpp;           /* Bytes per pixel                    */\n\tunsigned long  masks[3];      /* R,G,B or Y,U,V masks, respectively */\n\tunsigned       swap_bytes :1; /* Bytes  swapped within shorts       */\n\tunsigned       swap_shorts:1; /* Shorts swapped within longs        */\n};\n\n\nstruct bktr_clip {\n    int          x_min;\n    int          x_max;\n    int          y_min;\n    int          y_max;\n};\n\n#define BT848_MAX_CLIP_NODE 100\nstruct _bktr_clip {\n    struct bktr_clip x[BT848_MAX_CLIP_NODE];\n};\n\n/*\n * I'm using METEOR_xxx just because that will be common to other interface\n * and less of a surprise\n */\n#define METEORSACTPIXFMT\t_IOW('x', 64, int )\n#define METEORGACTPIXFMT\t_IOR('x', 64, int )\n#define METEORGSUPPIXFMT\t_IOWR('x', 65, struct meteor_pixfmt)\n\n/* set clip list */\n#define BT848SCLIP     _IOW('x', 66, struct _bktr_clip )\n#define BT848GCLIP     _IOR('x', 66, struct _bktr_clip )\n\n\n/* set input format */\n#define BT848SFMT\t\t_IOW('x', 67, unsigned long )\n#define BT848GFMT\t\t_IOR('x', 67, unsigned long )\n\n/* set clear-buffer-on-start */\n#define BT848SCBUF\t_IOW('x', 68, int)\n#define BT848GCBUF\t_IOR('x', 68, int)\n\n/* set capture area */\n/* The capture area is the area of the video image which is grabbed */\n/* Usually the capture area is 640x480 (768x576 PAL) pixels */\n/* This area is then scaled to the dimensions the user requires */\n/* using the METEORGEO ioctl */\n/* However, the capture area could be 400x300 pixels from the top right */\n/* corner of the video image */\nstruct bktr_capture_area {\n   int      x_offset;\n   int      y_offset;\n   int      x_size;\n   int      y_size;\n};\n#define BT848_SCAPAREA   _IOW('x', 69, struct bktr_capture_area)\n#define BT848_GCAPAREA   _IOR('x', 69, struct bktr_capture_area)\n\n\n/* Get channel Set */\n#define BT848_MAX_CHNLSET_NAME_LEN 16\nstruct bktr_chnlset {\n       short   index;\n       short   max_channel;\n       char    name[BT848_MAX_CHNLSET_NAME_LEN];\n};\n#define\tTVTUNER_GETCHNLSET _IOWR('x', 70, struct bktr_chnlset)\n\n\n\n/* Infra Red Remote Control */\nstruct bktr_remote {\n       unsigned char data[3];\n};\n#define\tREMOTE_GETKEY      _IOR('x', 71, struct bktr_remote)/*read the remote */\n                                                            /*control receiver*/\n                                                            /*returns raw data*/\n\n \n/*\n * Direct access to GPIO pins. You must add BKTR_GPIO_ACCESS to your kernel\n * configuration file to use these \n */\n#define BT848_GPIO_SET_EN      _IOW('x', 72, int)      /* set gpio_out_en */\n#define BT848_GPIO_GET_EN      _IOR('x', 73, int)      /* get gpio_out_en */\n#define BT848_GPIO_SET_DATA    _IOW('x', 74, int)      /* set gpio_data */\n#define BT848_GPIO_GET_DATA    _IOR('x', 75, int)      /* get gpio_data */\n\n\n\n/*  XXX - Copied from /sys/pci/brktree_reg.h  */\n#define BT848_IFORM_FORMAT              (0x7<<0)\n# define BT848_IFORM_F_RSVD             (0x7)\n# define BT848_IFORM_F_SECAM            (0x6)\n# define BT848_IFORM_F_PALN             (0x5)\n# define BT848_IFORM_F_PALM             (0x4)\n# define BT848_IFORM_F_PALBDGHI         (0x3)\n# define BT848_IFORM_F_NTSCJ            (0x2)\n# define BT848_IFORM_F_NTSCM            (0x1)\n# define BT848_IFORM_F_AUTO             (0x0)\n\n\n#endif\t/* _DEV_BKTR_IOCTL_BT848_H_ */\n\n"
  },
  {
    "path": "freebsd-headers/dev/bktr/ioctl_meteor.h",
    "content": "/*-\n * Copyright (c) 1995 Mark Tinguely and Jim Lowe\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. All advertising materials mentioning features or use of this software\n *    must display the following acknowledgement:\n *\tThis product includes software developed by Mark Tinguely and Jim Lowe\n * 4. The name of the author may not be used to endorse or promote products \n *    derived from this software without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR\n * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\n * DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR\n * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,\n * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/dev/bktr/ioctl_meteor.h 205781 2010-03-28 00:10:09Z gibbs $\n */\n/*\n *\tioctl constants for Matrox Meteor Capture card.\n */\n\n#ifndef\t_DEV_BKTR_IOCTL_METEOR_H_\n#define\t_DEV_BKTR_IOCTL_METEOR_H_\n\n#ifndef _KERNEL\n#include <sys/types.h>\n#endif\n#include <sys/ioccom.h>\n\nstruct meteor_capframe {\n\tshort\tcommand;\t/* see below for valid METEORCAPFRM commands */\n\tshort\tlowat;\t\t/* start transfer if < this number */\n\tshort\thiwat;\t\t/* stop transfer if > this number */\n} ;\n\n/* structure for METEOR[GS]ETGEO - get/set geometry  */\nstruct meteor_geomet {\n\tunsigned short\t\trows;\n\tunsigned short\t\tcolumns;\n\tunsigned short\t\tframes;\n\tunsigned long\t\toformat;\n} ;\n\n/* structure for METEORGCOUNT-get count of frames, fifo errors and dma errors */\nstruct meteor_counts {\n\tunsigned long fifo_errors;\t/* count of fifo errors since open */\n\tunsigned long dma_errors;\t/* count of dma errors since open */\n\tunsigned long frames_captured;\t/* count of frames captured since open */\n\tunsigned long even_fields_captured; /* count of even fields captured */\n\tunsigned long odd_fields_captured; /* count of odd fields captured */\n} ;\n\n/* structure for getting and setting direct transfers to vram */\nstruct meteor_video {\n\tunsigned long\taddr;\t\t/* Address of location to dma to */\n\tunsigned long\twidth;\t\t/* Width of memory area */\n\tunsigned long\tbanksize;\t/* Size of Vram bank */\n\tunsigned long\tramsize;\t/* Size of Vram */\n};\n\n#define METEORCAPTUR _IOW('x', 1, int)\t\t\t /* capture a frame */\n#define METEORCAPFRM _IOW('x', 2, struct meteor_capframe)  /* sync capture */\n#define METEORSETGEO _IOW('x', 3, struct meteor_geomet)  /* set geometry */\n#define METEORGETGEO _IOR('x', 4, struct meteor_geomet)  /* get geometry */\n#define METEORSTATUS _IOR('x', 5, unsigned short)\t/* get status */\n#define METEORSHUE   _IOW('x', 6, signed char)\t\t/* set hue */\n#define METEORGHUE   _IOR('x', 6, signed char)\t\t/* get hue */\n#define METEORSFMT   _IOW('x', 7, unsigned long)\t/* set format */\n#define METEORGFMT   _IOR('x', 7, unsigned long)\t/* get format */\n#define METEORSINPUT _IOW('x', 8, unsigned long)\t/* set input dev */\n#define METEORGINPUT _IOR('x', 8, unsigned long)\t/* get input dev */\n#define\tMETEORSCHCV  _IOW('x', 9, unsigned char)\t/* set uv gain */\n#define\tMETEORGCHCV  _IOR('x', 9, unsigned char)\t/* get uv gain */\n#define\tMETEORSCOUNT _IOW('x',10, struct meteor_counts)\n#define\tMETEORGCOUNT _IOR('x',10, struct meteor_counts)\n#define METEORSFPS   _IOW('x',11, unsigned short)\t/* set fps */\n#define METEORGFPS   _IOR('x',11, unsigned short)\t/* get fps */\n#define METEORSSIGNAL _IOW('x', 12, unsigned int)\t/* set signal */\n#define METEORGSIGNAL _IOR('x', 12, unsigned int)\t/* get signal */\n#define\tMETEORSVIDEO _IOW('x', 13, struct meteor_video)\t/* set video */\n#define\tMETEORGVIDEO _IOR('x', 13, struct meteor_video)\t/* get video */\n#define\tMETEORSBRIG  _IOW('x', 14, unsigned char)\t/* set brightness */\n#define METEORGBRIG  _IOR('x', 14, unsigned char)\t/* get brightness */\n#define\tMETEORSCSAT  _IOW('x', 15, unsigned char)\t/* set chroma sat */\n#define METEORGCSAT  _IOR('x', 15, unsigned char)\t/* get uv saturation */\n#define\tMETEORSCONT  _IOW('x', 16, unsigned char)\t/* set contrast */\n#define\tMETEORGCONT  _IOR('x', 16, unsigned char)\t/* get contrast */\n#define METEORSBT254 _IOW('x', 17, unsigned short)\t/* set Bt254 reg */\n#define METEORGBT254 _IOR('x', 17, unsigned short)\t/* get Bt254 reg */\n#define METEORSHWS   _IOW('x', 18, unsigned char)\t/* set hor start reg */\n#define METEORGHWS   _IOR('x', 18, unsigned char)\t/* get hor start reg */\n#define METEORSVWS   _IOW('x', 19, unsigned char)\t/* set vert start reg */\n#define METEORGVWS   _IOR('x', 19, unsigned char)\t/* get vert start reg */\n#define\tMETEORSTS    _IOW('x', 20, unsigned char)\t/* set time stamp */\n#define\tMETEORGTS    _IOR('x', 20, unsigned char)\t/* get time stamp */\n\n#define\tMETEOR_STATUS_ID_MASK\t0xf000\t/* ID of 7196 */\n#define\tMETEOR_STATUS_DIR\t0x0800\t/* Direction of Expansion port YUV */\n#define\tMETEOR_STATUS_OEF\t0x0200\t/* Field detected: Even/Odd */\n#define\tMETEOR_STATUS_SVP\t0x0100\t/* State of VRAM Port:inactive/active */\n#define\tMETEOR_STATUS_STTC\t0x0080\t/* Time Constant: TV/VCR */\n#define\tMETEOR_STATUS_HCLK\t0x0040\t/* Horiz PLL: locked/unlocked */\n#define\tMETEOR_STATUS_FIDT\t0x0020\t/* Field detect: 50/60hz */\n#define\tMETEOR_STATUS_ALTD\t0x0002\t/* Line alt: no line alt/line alt */\n#define METEOR_STATUS_CODE\t0x0001\t/* Colour info: no colour/colour */\n\n\t\t\t\t/* METEORCAPTUR capture options */\n#define METEOR_CAP_SINGLE\t0x0001\t/* capture one frame */\n#define METEOR_CAP_CONTINOUS\t0x0002\t/* continuously capture */\n#define METEOR_CAP_STOP_CONT\t0x0004\t/* stop the continuous capture */\n\n\t\t\t\t/* METEORCAPFRM capture commands */\n#define METEOR_CAP_N_FRAMES\t0x0001\t/* capture N frames */\n#define METEOR_CAP_STOP_FRAMES\t0x0002\t/* stop capture N frames */\n#define\tMETEOR_HALT_N_FRAMES\t0x0003\t/* halt of capture N frames */\n#define METEOR_CONT_N_FRAMES\t0x0004\t/* continue after above halt */\n\n\t\t\t\t/* valid video input formats:  */\n#define METEOR_FMT_NTSC\t\t0x00100\t/* NTSC --  initialized default */\n#define METEOR_FMT_PAL\t\t0x00200\t/* PAL */\n#define METEOR_FMT_SECAM\t0x00400\t/* SECAM */\n#define METEOR_FMT_AUTOMODE\t0x00800 /* auto-mode */\n#define METEOR_INPUT_DEV0\t0x01000\t/* camera input 0 -- default */\n#define METEOR_INPUT_DEV_RCA\tMETEOR_INPUT_DEV0\n#define METEOR_INPUT_DEV1\t0x02000\t/* camera input 1 */\n#define METEOR_INPUT_DEV2\t0x04000\t/* camera input 2 */\n#define METEOR_INPUT_DEV3\t0x08000\t/* camera input 3 */\n#define METEOR_INPUT_DEV_RGB\t0x0a000\t/* for rgb version of meteor */\n#define METEOR_INPUT_DEV_SVIDEO\t0x06000 /* S-video input port */\n\n\t\t\t\t/* valid video output formats:  */\n#define METEOR_GEO_RGB16\t0x0010000 /* packed -- initialized default */\n#define METEOR_GEO_RGB24\t0x0020000 /* RBG 24 bits packed */\n\t\t\t\t\t  /* internally stored in 32 bits */\n#define METEOR_GEO_YUV_PACKED\t0x0040000 /* 4-2-2 YUV 16 bits packed */\n#define METEOR_GEO_YUV_PLANAR\t0x0080000 /* 4-2-2 YUV 16 bits planer */\n#define METEOR_GEO_YUV_PLANER\tMETEOR_GEO_YUV_PLANAR\n#define METEOR_GEO_UNSIGNED\t0x0400000 /* unsigned uv outputs */\n#define METEOR_GEO_EVEN_ONLY\t0x1000000 /* set for even only field capture */\n#define METEOR_GEO_ODD_ONLY\t0x2000000 /* set for odd only field capture */\n#define METEOR_GEO_FIELD_MASK\t0x3000000\n#define METEOR_GEO_YUV_422\t0x4000000 /* 4-2-2 YUV in Y-U-V combined */\n#define METEOR_GEO_OUTPUT_MASK\t0x40f0000\n#define METEOR_GEO_YUV_12\t0x10000000\t/* YUV 12 format */\n#define METEOR_GEO_YUV_9\t0x40000000\t/* YUV 9 format */\n\n#define\tMETEOR_FIELD_MODE\t0x80000000\t/* Field cap or Frame cap */\n\n#define\tMETEOR_SIG_MODE_MASK\t0xffff0000\n#define\tMETEOR_SIG_FRAME\t0x00000000\t/* signal every frame */\n#define\tMETEOR_SIG_FIELD\t0x00010000\t/* signal every field */\n\n\t/* following structure is used to coordinate the synchronous */\n\t   \nstruct meteor_mem {\n\t\t/* kernel write only  */\n\tint\tframe_size;\t /* row*columns*depth */\n\tunsigned num_bufs;\t /* number of frames in buffer (1-32) */\n\t\t/* user and kernel change these */\n\tint\tlowat;\t\t /* kernel starts capture if < this number */\n\tint\thiwat;\t\t /* kernel stops capture if > this number.\n\t\t\t\t    hiwat <= numbufs */\n\tunsigned active;\t /* bit mask of active frame buffers\n\t\t\t\t    kernel sets, user clears */\n\tint\tnum_active_bufs; /* count of active frame buffer\n\t\t\t\t    kernel increments, user decrements */\n\n\t\t/* reference to mmapped data */\n\tcaddr_t\tbuf;\t\t /* The real space (virtual addr) */\n} ;\n\n#endif /* !_DEV_BKTR_IOCTL_METEOR_H_ */\n"
  },
  {
    "path": "freebsd-headers/dev/ciss/cissio.h",
    "content": "/*-\n * Copyright (c) 2001 Michael Smith\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t$FreeBSD: release/9.0.0/sys/dev/ciss/cissio.h 180454 2008-07-11 21:20:51Z scottl $\n */\n\n/*\n * Driver ioctl interface.\n *\n * Note that this interface is API-compatible with the Linux implementation\n * except as noted, and thus this header bears a striking resemblance to \n * the Linux driver's cciss_ioctl.h.\n *\n */\n\n#include <sys/ioccom.h>\n\n#pragma pack(1)\n\ntypedef struct\n{\n    u_int8_t\tbus;\n    u_int8_t\tdev_fn;\n    u_int32_t\tboard_id;\n} cciss_pci_info_struct; \n\ntypedef struct\n{\n    u_int32_t\tdelay;\n    u_int32_t\tcount;\n} cciss_coalint_struct;\n\ntypedef char\t\tNodeName_type[16];\ntypedef u_int32_t\tHeartbeat_type;\n\n#define CISS_PARSCSIU2\t0x0001\n#define CISS_PARCSCIU3\t0x0002\n#define CISS_FIBRE1G\t0x0100\n#define CISS_FIBRE2G\t0x0200\ntypedef u_int32_t\tBusTypes_type;\n\ntypedef char\t\tFirmwareVer_type[4];\ntypedef u_int32_t\tDriverVer_type;\n\n/* passthrough command definitions */\n#define SENSEINFOBYTES          32\n#define CISS_MAX_LUN\t\t16\t\n#define LEVEL2LUN\t\t1\n#define LEVEL3LUN\t\t0\n\n/* command status value */\n#define CMD_SUCCESS\t\t0x0000\n#define CMD_TARGET_STATUS\t0x0001\n#define CMD_DATA_UNDERRUN\t0x0002\n#define CMD_DATA_OVERRUN\t0x0003\n#define CMD_INVALID\t\t0x0004\n#define CMD_PROTOCOL_ERR\t0x0005\n#define CMD_HARDWARE_ERR\t0x0006\n#define CMD_CONNECTION_LOST\t0x0007\n#define CMD_ABORTED\t\t0x0008\n#define CMD_ABORT_FAILED\t0x0009\n#define CMD_UNSOLICITED_ABORT\t0x000A\n#define CMD_TIMEOUT\t\t0x000B\n#define CMD_UNABORTABLE\t\t0x000C\n\n/* transfer direction */\n#define XFER_NONE\t\t0x00\n#define XFER_WRITE\t\t0x01\n#define XFER_READ\t\t0x02\n#define XFER_RSVD\t\t0x03\n\n/* task attribute */\n#define ATTR_UNTAGGED\t\t0x00\n#define ATTR_SIMPLE\t\t0x04\n#define ATTR_HEADOFQUEUE\t0x05\n#define ATTR_ORDERED\t\t0x06\n#define ATTR_ACA\t\t0x07\n\n/* CDB type */\n#define TYPE_CMD\t\t0x00\n#define TYPE_MSG\t\t0x01\n\n/* command list structure */\ntypedef union {\n    struct {\n\tu_int8_t\tDev;\n\tu_int8_t\tBus:6;\n\tu_int8_t\tMode:2;\n    } __packed PeripDev;\n    struct {\n\tu_int8_t\tDevLSB;\n\tu_int8_t\tDevMSB:6;\n\tu_int8_t\tMode:2;\n    } __packed LogDev;\n    struct {\n\tu_int8_t\tDev:5;\n\tu_int8_t\tBus:3;\n\tu_int8_t\tTarg:6;\n\tu_int8_t\tMode:2;\n    } __packed LogUnit;\n} SCSI3Addr_struct;\n\ntypedef struct {\n    u_int32_t\t\tTargetId:24;\n    u_int32_t\t\tBus:6;\n    u_int32_t\t\tMode:2;\n    SCSI3Addr_struct\tTarget[2];\n} __packed PhysDevAddr_struct;\n  \ntypedef struct {\n    u_int32_t\t\tVolId:30;\n    u_int32_t\t\tMode:2;\n    u_int8_t\t\treserved[4];\n} __packed LogDevAddr_struct;\n\ntypedef union {\n    u_int8_t\t\tLunAddrBytes[8];\n    SCSI3Addr_struct\tSCSI3Lun[4];\n    PhysDevAddr_struct\tPhysDev;\n    LogDevAddr_struct\tLogDev;\n} __packed LUNAddr_struct;\n\ntypedef struct {\n    u_int8_t\tCDBLen;\n    struct {\n\tu_int8_t\tType:3;\n\tu_int8_t\tAttribute:3;\n\tu_int8_t\tDirection:2;\n    } __packed Type;\n    u_int16_t\tTimeout;\n    u_int8_t\tCDB[16];\n} __packed RequestBlock_struct;\n\ntypedef union {\n    struct {\n\tu_int8_t\tReserved[3];\n\tu_int8_t\tType;\n\tu_int32_t\tErrorInfo;\n    } __packed Common_Info;\n    struct {\n\tu_int8_t\tReserved[2];\n\tu_int8_t\toffense_size;\n\tu_int8_t\toffense_num;\n\tu_int32_t\toffense_value;\n    } __packed Invalid_Cmd;\n} __packed MoreErrInfo_struct;\n\ntypedef struct {\n    u_int8_t\t\tScsiStatus;\n    u_int8_t\t\tSenseLen;\n    u_int16_t\t\tCommandStatus;\n    u_int32_t\t\tResidualCnt;\n    MoreErrInfo_struct\tMoreErrInfo;\n    u_int8_t\t\tSenseInfo[SENSEINFOBYTES];\n} __packed ErrorInfo_struct;\n\ntypedef struct {\n    LUNAddr_struct\tLUN_info;\t/* 8 */\n    RequestBlock_struct\tRequest;\t/* 20 */\n    ErrorInfo_struct\terror_info;\t/* 48 */\n    u_int16_t\t\tbuf_size;\t/* 2 */\n    u_int8_t\t\t*buf;\t\t/* 4 */\n} __packed IOCTL_Command_struct;\n\n#ifdef __amd64__\ntypedef struct {\n    LUNAddr_struct\tLUN_info;\t/* 8 */\n    RequestBlock_struct\tRequest;\t/* 20 */\n    ErrorInfo_struct\terror_info;\t/* 48 */\n    u_int16_t\t\tbuf_size;\t/* 2 */\n    u_int32_t\t\tbuf;\t\t/* 4 */\n} __packed IOCTL_Command_struct32;\n#endif\n\n/************************************************************************\n * Command queue statistics\n */\n\n#define CISSQ_FREE\t0\n#define CISSQ_NOTIFY\t1\n#define CISSQ_COUNT\t2\n\nstruct ciss_qstat {\n    uint32_t\t\tq_length;\n    uint32_t\t\tq_max;\n};\n\nunion ciss_statrequest {\n    uint32_t\t\tcs_item;\n    struct ciss_qstat\tcs_qstat;\n};\n\n/*\n * Note that we'd normally pass the struct in directly, but\n * this code is trying to be compatible with other drivers.\n */\n#define CCISS_GETPCIINFO\t_IOR ('C', 200, cciss_pci_info_struct)\n#define CCISS_GETINTINFO\t_IOR ('C', 201, cciss_coalint_struct)\n#define CCISS_SETINTINFO\t_IOW ('C', 202, cciss_coalint_struct)\n#define CCISS_GETNODENAME\t_IOR ('C', 203, NodeName_type)\n#define CCISS_SETNODENAME\t_IOW ('C', 204, NodeName_type)\n#define CCISS_GETHEARTBEAT\t_IOR ('C', 205, Heartbeat_type)\n#define CCISS_GETBUSTYPES\t_IOR ('C', 206, BusTypes_type)\n#define CCISS_GETFIRMVER\t_IOR ('C', 207, FirmwareVer_type)\n#define CCISS_GETDRIVERVER\t_IOR ('C', 208, DriverVer_type)\n#define CCISS_REVALIDVOLS\t_IO  ('C', 209)\n#define CCISS_PASSTHRU\t\t_IOWR ('C', 210, IOCTL_Command_struct)\n#ifdef __amd64\n#define CCISS_PASSTHRU32\t_IOWR ('C', 210, IOCTL_Command_struct32)\n#endif\n#define CCISS_GETQSTATS\t\t_IOWR ('C', 211, union ciss_statrequest)\n\n#pragma pack()\n"
  },
  {
    "path": "freebsd-headers/dev/ciss/cissreg.h",
    "content": "/*-\n * Copyright (c) 2001 Michael Smith\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t$FreeBSD: release/9.0.0/sys/dev/ciss/cissreg.h 197263 2009-09-16 23:27:14Z scottl $\n */\n\n/*\n * Structure and I/O definitions for the Command Interface for SCSI-3 Support.\n *\n * Data in command CDBs are in big-endian format.  All other data is little-endian.\n * This header only supports little-endian hosts at this time.\n */\n\nunion ciss_device_address\n{\n    struct \t\t\t\t/* MODE_PERIPHERAL and MODE_MASK_PERIPHERAL */\n    {\n\tu_int32_t\ttarget:24;\t/* SCSI target */\n\tu_int32_t\tbus:6;\t\t/* SCSI bus */\n\tu_int32_t\tmode:2;\t\t/* CISS_HDR_ADDRESS_MODE_* */\n\tu_int32_t\textra_address;\t/* SCSI-3 level-2 and level-3 address bytes */\n    } physical;\n    struct \t\t\t\t/* MODE_LOGICAL */\n    {\n\tu_int32_t\tlun:30;\t\t/* logical device ID */\n\tu_int32_t\tmode:2;\t\t/* CISS_HDR_ADDRESS_MODE_LOGICAL */\n\tu_int32_t\t:32;\t\t/* reserved */\n    } logical;\n    struct\n    {\n\tu_int32_t\t:30;\n\tu_int32_t\tmode:2;\n\tu_int32_t\t:32;\n    } mode;\n};\n#define CISS_HDR_ADDRESS_MODE_PERIPHERAL\t0x0\n#define CISS_HDR_ADDRESS_MODE_LOGICAL\t\t0x1\n#define CISS_HDR_ADDRESS_MODE_MASK_PERIPHERAL\t0x3\n\n#define CISS_EXTRA_MODE2(extra)\t\t((extra & 0xc0000000) >> 30)\n#define CISS_EXTRA_BUS2(extra)\t\t((extra & 0x3f000000) >> 24)\n#define CISS_EXTRA_TARGET2(extra)\t((extra & 0x00ff0000) >> 16)\n#define CISS_EXTRA_MODE3(extra)\t\t((extra & 0x0000c000) >> 14)\n#define CISS_EXTRA_BUS3(extra)\t\t((extra & 0x00003f00) >> 8)\n#define CISS_EXTRA_TARGET3(extra)\t((extra & 0x000000ff))\n\nstruct ciss_header\n{\n    u_int8_t\t:8;\t\t\t/* reserved */\n    u_int8_t\tsg_in_list;\t\t/* SG's in the command structure */\n    u_int16_t\tsg_total;\t\t/* total count of SGs for this command */\n    u_int32_t\thost_tag;\t\t/* host identifier, bits 0&1 must be clear */\n#define CISS_HDR_HOST_TAG_ERROR\t(1<<1)\n    u_int32_t\thost_tag_zeroes;\t/* tag is 64 bits, but interface only supports 32 */\n    union ciss_device_address address;\n} __packed;\n\nstruct ciss_cdb\n{\n    u_int8_t\tcdb_length;\t\t/* valid CDB bytes */\n    u_int8_t\ttype:3;\n#define CISS_CDB_TYPE_COMMAND\t\t\t0\n#define CISS_CDB_TYPE_MESSAGE\t\t\t1\n    u_int8_t\tattribute:3;\n#define CISS_CDB_ATTRIBUTE_UNTAGGED\t\t0\n#define CISS_CDB_ATTRIBUTE_SIMPLE\t\t4\n#define CISS_CDB_ATTRIBUTE_HEAD_OF_QUEUE\t5\n#define CISS_CDB_ATTRIBUTE_ORDERED\t\t6\n#define CISS_CDB_ATTRIBUTE_AUTO_CONTINGENT\t7\n    u_int8_t\tdirection:2;\n#define CISS_CDB_DIRECTION_NONE\t\t\t0\n#define CISS_CDB_DIRECTION_WRITE\t\t1\n#define CISS_CDB_DIRECTION_READ\t\t\t2\n    u_int16_t\ttimeout;\t\t/* seconds */\n#define CISS_CDB_BUFFER_SIZE\t16\n    u_int8_t\tcdb[CISS_CDB_BUFFER_SIZE];\n} __packed;\n\nstruct ciss_error_info_pointer\n{\n    u_int64_t\terror_info_address;\t/* points to ciss_error_info structure */\n    u_int32_t\terror_info_length;\n} __packed;\n\nstruct ciss_error_info\n{\n    u_int8_t\tscsi_status;\n#define CISS_SCSI_STATUS_GOOD\t\t\t0x00\t/* these are scsi-standard values */\n#define CISS_SCSI_STATUS_CHECK_CONDITION\t0x02\n#define CISS_SCSI_STATUS_CONDITION_MET\t\t0x04\n#define CISS_SCSI_STATUS_BUSY\t\t\t0x08\n#define CISS_SCSI_STATUS_INDETERMINATE\t\t0x10\n#define CISS_SCSI_STATUS_INDETERMINATE_CM\t0x14\n#define CISS_SCSI_STATUS_RESERVATION_CONFLICT\t0x18\n#define CISS_SCSI_STATUS_COMMAND_TERMINATED\t0x22\n#define CISS_SCSI_STATUS_QUEUE_FULL\t\t0x28\n#define CISS_SCSI_STATUS_ACA_ACTIVE\t\t0x30\n    u_int8_t\tsense_length;\n    u_int16_t\tcommand_status;\n#define CISS_CMD_STATUS_SUCCESS\t\t\t0\n#define CISS_CMD_STATUS_TARGET_STATUS\t\t1\n#define CISS_CMD_STATUS_DATA_UNDERRUN\t\t2\n#define CISS_CMD_STATUS_DATA_OVERRUN\t\t3\n#define CISS_CMD_STATUS_INVALID_COMMAND\t\t4\n#define CISS_CMD_STATUS_PROTOCOL_ERROR\t\t5\n#define CISS_CMD_STATUS_HARDWARE_ERROR\t\t6\n#define CISS_CMD_STATUS_CONNECTION_LOST\t\t7\n#define CISS_CMD_STATUS_ABORTED\t\t\t8\n#define CISS_CMD_STATUS_ABORT_FAILED\t\t9\n#define CISS_CMD_STATUS_UNSOLICITED_ABORT\t10\n#define CISS_CMD_STATUS_TIMEOUT\t\t\t11\n#define CISS_CMD_STATUS_UNABORTABLE\t\t12\n    u_int32_t\tresidual_count;\n    union {\n\tstruct {\n\t    u_int8_t\tres1[3];\n\t    u_int8_t\ttype;\n\t    u_int32_t\terror_info;\n\t} __packed common_info;\n\tstruct {\n\t    u_int8_t\tres1[2];\n\t    u_int8_t\toffense_size;\n\t    u_int8_t\toffense_offset;\n\t    u_int32_t\toffense_value;\n\t} __packed invalid_command;\n    } additional_error_info;\n    u_int8_t\tsense_info[0];\n} __packed;\n\nstruct ciss_sg_entry\n{\n    u_int64_t\taddress;\n#define CISS_SG_ADDRESS_BITBUCKET\t(~(u_int64_t)0)\n    u_int32_t\tlength;\n    u_int32_t\t:31;\n    u_int32_t\textension:1;\t\t/* address points to another s/g chain */\n} __packed;\n\nstruct ciss_command\n{\n    struct ciss_header\t\t\theader;\n    struct ciss_cdb\t\t\tcdb;\n    struct ciss_error_info_pointer\terror_info;\n    struct ciss_sg_entry\t\tsg[0];\n} __packed;\n\n#define CISS_OPCODE_REPORT_LOGICAL_LUNS\t\t0xc2\n#define CISS_OPCODE_REPORT_PHYSICAL_LUNS\t0xc3\n\nstruct ciss_lun_report\n{\n    u_int32_t\tlist_size;\t\t/* big-endian */\n    u_int32_t\t:32;\n    union ciss_device_address lun[0];\n} __packed;\n\n#define\tCISS_VPD_LOGICAL_DRIVE_GEOMETRY\t\t0xc1\nstruct ciss_ldrive_geometry\n{\n    u_int8_t\tperiph_qualifier:3;\n    u_int8_t\tperiph_devtype:5;\n    u_int8_t\tpage_code;\n    u_int8_t\tres1;\n    u_int8_t\tpage_length;\n    u_int16_t\tcylinders;\t\t/* big-endian */\n    u_int8_t\theads;\n    u_int8_t\tsectors;\n    u_int8_t\tfault_tolerance;\n    u_int8_t\tres2[3];\n} __attribute__ ((packed));\n\nstruct ciss_report_cdb\n{\n    u_int8_t\topcode;\n    u_int8_t\treserved[5];\n    u_int32_t\tlength;\t\t\t/* big-endian */\n    u_int8_t\t:8;\n    u_int8_t\tcontrol;\n} __packed;\n\n/*\n * Note that it's not clear whether we have to set the detail field to\n * the tag of the command to be aborted, or the tag field in the command itself;\n * documentation conflicts on this.\n */\n#define CISS_OPCODE_MESSAGE_ABORT\t\t0x00\n#define CISS_MESSAGE_ABORT_TASK\t\t\t0x00\n#define CISS_MESSAGE_ABORT_TASK_SET\t\t0x01\n#define CISS_MESSAGE_ABORT_CLEAR_ACA\t\t0x02\n#define CISS_MESSAGE_ABORT_CLEAR_TASK_SET\t0x03\n\n#define CISS_OPCODE_MESSAGE_RESET\t\t0x01\n#define CISS_MESSAGE_RESET_CONTROLLER\t\t0x00\n#define CISS_MESSAGE_RESET_BUS\t\t\t0x01\n#define CISS_MESSAGE_RESET_TARGET\t\t0x03\n#define CISS_MESSAGE_RESET_LOGICAL_UNIT\t\t0x04\n\n#define CISS_OPCODE_MESSAGE_SCAN\t\t0x02\n#define CISS_MESSAGE_SCAN_CONTROLLER\t\t0x00\n#define CISS_MESSAGE_SCAN_BUS\t\t\t0x01\n#define CISS_MESSAGE_SCAN_TARGET\t\t0x03\n#define CISS_MESSAGE_SCAN_LOGICAL_UNIT\t\t0x04\n\n#define CISS_OPCODE_MESSAGE_NOP\t\t\t0x03\n\nstruct ciss_message_cdb\n{\n    u_int8_t\topcode;\n    u_int8_t\ttype;\n    u_int16_t\t:16;\n    u_int32_t\tabort_tag;\t\t\t\t\t/* XXX endianness? */\n    u_int8_t\treserved[8];\n} __packed;\n\n/*\n * CISS vendor-specific commands/messages.\n *\n * Note that while messages and vendor-specific commands are\n * differentiated, they are handled in basically the same way and can\n * be considered to be basically the same thing, as long as the cdb\n * type field is set correctly.\n */\n#define CISS_OPCODE_READ\t\t0xc0\n#define CISS_OPCODE_WRITE\t\t0xc1\n#define CISS_COMMAND_NOTIFY_ON_EVENT\t0xd0\n#define CISS_COMMAND_ABORT_NOTIFY\t0xd1\n\nstruct ciss_notify_cdb\n{\n    u_int8_t\topcode;\n    u_int8_t\tcommand;\n    u_int8_t\tres1[2];\n    u_int16_t\ttimeout;\t\t/* seconds, little-endian */\n    u_int8_t\tres2;\t\t\t/* reserved */\n    u_int8_t\tsynchronous:1;\t\t/* return immediately */\n    u_int8_t\tordered:1;\t\t/* return events in recorded order */\n    u_int8_t\tseek_to_oldest:1;\t/* reset read counter to oldest event */\n    u_int8_t\tnew_only:1;\t\t/* ignore any queued events */\n    u_int8_t\t:4;\n    u_int32_t\tlength;\t\t\t/* must be 512, little-endian */\n#define CISS_NOTIFY_DATA_SIZE\t512\n    u_int8_t\tcontrol;\n} __packed;\n\n#define CISS_NOTIFY_NOTIFIER\t\t0\n#define CISS_NOTIFY_NOTIFIER_STATUS\t\t0\n#define CISS_NOTIFY_NOTIFIER_PROTOCOL\t\t1\n\n#define CISS_NOTIFY_HOTPLUG\t\t1\n#define CISS_NOTIFY_HOTPLUG_PHYSICAL\t\t0\n#define CISS_NOTIFY_HOTPLUG_POWERSUPPLY\t\t1\n#define CISS_NOTIFY_HOTPLUG_FAN\t\t\t2\n#define CISS_NOTIFY_HOTPLUG_POWER\t\t3\n#define CISS_NOTIFY_HOTPLUG_REDUNDANT\t\t4\n#define CISS_NOTIFY_HOTPLUG_NONDISK\t\t5\n\n#define CISS_NOTIFY_HARDWARE\t\t2\n#define CISS_NOTIFY_HARDWARE_CABLES\t\t0\n#define CISS_NOTIFY_HARDWARE_MEMORY\t\t1\n#define CISS_NOTIFY_HARDWARE_FAN\t\t2\n#define CISS_NOTIFY_HARDWARE_VRM\t\t3\n\n#define CISS_NOTIFY_ENVIRONMENT\t\t3\n#define CISS_NOTIFY_ENVIRONMENT_TEMPERATURE\t0\n#define CISS_NOTIFY_ENVIRONMENT_POWERSUPPLY\t1\n#define CISS_NOTIFY_ENVIRONMENT_CHASSIS\t\t2\n#define CISS_NOTIFY_ENVIRONMENT_POWER\t\t3\n\n#define CISS_NOTIFY_PHYSICAL\t\t4\n#define CISS_NOTIFY_PHYSICAL_STATE\t\t0\n\n#define CISS_NOTIFY_LOGICAL\t\t5\n#define CISS_NOTIFY_LOGICAL_STATUS\t\t0\n#define CISS_NOTIFY_LOGICAL_ERROR\t\t1\n#define CISS_NOTIFY_LOGICAL_SURFACE\t\t2\n\n#define CISS_NOTIFY_REDUNDANT\t\t6\n#define CISS_NOTIFY_REDUNDANT_STATUS\t\t0\n\n#define CISS_NOTIFY_CISS\t\t8\n#define CISS_NOTIFY_CISS_REDUNDANT_CHANGE\t0\n#define CISS_NOTIFY_CISS_PATH_STATUS\t\t1\n#define CISS_NOTIFY_CISS_HARDWARE_ERROR\t\t2\n#define CISS_NOTIFY_CISS_LOGICAL\t\t3\n\nstruct ciss_notify_drive\n{\n    u_int16_t\tphysical_drive_number;\n    u_int8_t\tconfigured_drive_flag;\n    u_int8_t\tspare_drive_flag;\n    u_int8_t\tbig_physical_drive_number;\n    u_int8_t\tenclosure_bay_number;\n} __packed;\n\nstruct ciss_notify_locator\n{\n    u_int16_t\tport;\n    u_int16_t\tid;\n    u_int16_t\tbox;\n} __packed;\n\nstruct ciss_notify_redundant_controller\n{\n    u_int16_t\tslot;\n} __packed;\n\nstruct ciss_notify_logical_status\n{\n    u_int16_t\tlogical_drive;\n    u_int8_t\tprevious_state;\n    u_int8_t\tnew_state;\n    u_int8_t\tspare_state;\n} __packed;\n\nstruct ciss_notify_rebuild_aborted\n{\n    u_int16_t\tlogical_drive;\n    u_int8_t\treplacement_drive;\n    u_int8_t\terror_drive;\n    u_int8_t\tbig_replacement_drive;\n    u_int8_t\tbig_error_drive;\n} __packed;\n\nstruct ciss_notify_io_error\n{\n    u_int16_t\tlogical_drive;\n    u_int32_t\tlba;\n    u_int16_t\tblock_count;\n    u_int8_t\tcommand;\n    u_int8_t\tfailure_bus;\n    u_int8_t\tfailure_drive;\n    u_int64_t\tbig_lba;\n} __packed;\n\nstruct ciss_notify_consistency_completed\n{\n    u_int16_t\tlogical_drive;\n} __packed;\n\nstruct ciss_notify\n{\n    u_int32_t\ttimestamp;\t\t/* seconds since controller power-on */\n    u_int16_t\tclass;\n    u_int16_t\tsubclass;\n    u_int16_t\tdetail;\n    union\n    {\n\tstruct ciss_notify_drive\t\tdrive;\n\tstruct ciss_notify_locator\t\tlocation;\n\tstruct ciss_notify_redundant_controller\tredundant_controller;\n\tstruct ciss_notify_logical_status\tlogical_status;\n\tstruct ciss_notify_rebuild_aborted\trebuild_aborted;\n\tstruct ciss_notify_io_error\t\tio_error;\n\tstruct ciss_notify_consistency_completed consistency_completed;\n\tu_int8_t\tdata[64];\n    } data;\n    char\tmessage[80];\n    u_int32_t\ttag;\n    u_int16_t\tdate;\n    u_int16_t\tyear;\n    u_int32_t\ttime;\n    u_int16_t\tpre_power_up_time;\n    union ciss_device_address\tdevice;\n    /* XXX pads to 512 bytes */\n} __packed;\n\n/*\n * CISS config table, which describes the controller's\n * supported interface(s) and capabilities.\n *\n * This is mapped directly via PCI.\n */\nstruct ciss_config_table\n{\n    char\tsignature[4];\t\t/* \"CISS\" */\n    u_int32_t\tvalence;\n    u_int32_t\tsupported_methods;\n#define CISS_TRANSPORT_METHOD_READY\t(1<<0)\n#define CISS_TRANSPORT_METHOD_SIMPLE\t(1<<1)\n#define CISS_TRANSPORT_METHOD_PERF\t(1<<2)\n    u_int32_t\tactive_method;\n    u_int32_t\trequested_method;\n    u_int32_t\tcommand_physlimit;\n    u_int32_t\tinterrupt_coalesce_delay;\n    u_int32_t\tinterrupt_coalesce_count;\n    u_int32_t\tmax_outstanding_commands;\n    u_int32_t\tbus_types;\n#define CISS_TRANSPORT_BUS_TYPE_ULTRA2\t(1<<0)\n#define CISS_TRANSPORT_BUS_TYPE_ULTRA3\t(1<<1)\n#define CISS_TRANSPORT_BUS_TYPE_FIBRE1\t(1<<8)\n#define CISS_TRANSPORT_BUS_TYPE_FIBRE2\t(1<<9)\n    u_int32_t\ttransport_offset;\n    char\tserver_name[16];\n    u_int32_t\theartbeat;\n    u_int32_t\thost_driver;\n#define CISS_DRIVER_SUPPORT_UNIT_ATTENTION\t(1<<0)\n#define CISS_DRIVER_QUICK_INIT\t\t\t(1<<1)\n#define CISS_DRIVER_INTERRUPT_ON_LOCKUP\t\t(1<<2)\n#define CISS_DRIVER_SUPPORT_MIXED_Q_TAGS\t(1<<3)\n#define CISS_DRIVER_HOST_IS_ALPHA\t\t(1<<4)\n#define CISS_DRIVER_MULTI_LUN_SUPPORT\t\t(1<<5)\n#define CISS_DRIVER_MESSAGE_REQUESTS_SUPPORTED\t(1<<7)\n#define CISS_DRIVER_DAUGHTER_ATTACHED\t\t(1<<8)\n#define CISS_DRIVER_SCSI_PREFETCH\t\t(1<<9)\n    u_int32_t\tmax_sg_length;\t\t/* 31 in older firmware */\n} __packed;\n\n/*\n * Configuration table for the Performant transport.  Only 4 request queues\n * are mentioned in this table, though apparently up to 256 can exist.\n */\nstruct ciss_perf_config {\n    uint32_t\tfetch_count[8];\n#define CISS_SG_FETCH_MAX\t0\n#define CISS_SG_FETCH_1\t\t1\n#define CISS_SG_FETCH_2\t\t2\n#define CISS_SG_FETCH_4\t\t3\n#define CISS_SG_FETCH_8\t\t4\n#define CISS_SG_FETCH_16\t5\n#define CISS_SG_FETCH_32\t6\n#define CISS_SG_FETCH_NONE\t7\n    uint32_t\trq_size;\n    uint32_t\trq_count;\n    uint32_t\trq_bank_lo;\n    uint32_t\trq_bank_hi;\n    struct {\n\tuint32_t\trq_addr_lo;\n\tuint32_t\trq_addr_hi;\n    } __packed rq[4];\n} __packed;\n\n/*\n * In a flagrant violation of what CISS seems to be meant to be about,\n * Compaq recycle a goodly portion of their previous generation's\n * command set (and all the legacy baggage related to a design\n * originally aimed at narrow SCSI) through the Array Controller Read\n * and Array Controller Write interface.\n *\n * Command ID values here can be looked up for in the\n * publically-available documentation for the older controllers; note\n * that the command layout is necessarily different to fit within the\n * CDB.\n */\n#define CISS_ARRAY_CONTROLLER_READ\t0x26\n#define CISS_ARRAY_CONTROLLER_WRITE\t0x27\n\n#define CISS_BMIC_ID_LDRIVE\t\t0x10\n#define CISS_BMIC_ID_CTLR\t\t0x11\n#define CISS_BMIC_ID_LSTATUS\t\t0x12\n#define CISS_BMIC_ID_PDRIVE\t\t0x15\n#define CISS_BMIC_BLINK_PDRIVE\t\t0x16\n#define CISS_BMIC_SENSE_BLINK_PDRIVE\t0x17\n#define CISS_BMIC_SOFT_RESET\t\t0x40\n#define CISS_BMIC_FLUSH_CACHE\t\t0xc2\n#define CISS_BMIC_ACCEPT_MEDIA\t\t0xe0\n\n/*\n * When numbering drives, the original design assumed that\n * drives 0-7 are on the first SCSI bus, 8-15 on the second,\n * and so forth.  In order to handle modern SCSI configurations,\n * the MSB is set in the drive ID field, in which case the\n * modulus changes from 8 to the number of supported drives\n * per SCSI bus (as obtained from the ID_CTLR command).\n * This feature is referred to as BIG_MAP support, and we assume\n * that all CISS controllers support it.\n */\n\n#define CISS_BIG_MAP_ID(sc, bus, target)\t\t\\\n\t(0x80 | \t\t\t\t\t\\\n\t ((sc)->ciss_id->drives_per_scsi_bus * (bus)) |\t\\\n\t (target))\n\n#define CISS_BIG_MAP_BUS(sc, id)\t\t\t\\\n\t(((id) & 0x80) ? (((id) & ~0x80) / (sc)->ciss_id->drives_per_scsi_bus) : -1)\n\n#define CISS_BIG_MAP_TARGET(sc, id)\t\t\t\\\n\t(((id) & 0x80) ? (((id) & ~0x80) % (sc)->ciss_id->drives_per_scsi_bus) : -1)\n\n#define CISS_BIG_MAP_ENTRIES\t128\t/* number of entries in a BIG_MAP */\n\n/*\n * In the device address of a logical volume, the bus number\n * is encoded into the logical lun volume number starting\n * at the second byte, with the first byte defining the\n * logical drive number.\n */\n#define CISS_LUN_TO_BUS(x)    (((x) >> 16) & 0xFF)\n#define CISS_LUN_TO_TARGET(x) ((x) & 0xFF)\n\n/*\n * BMIC CDB\n *\n * Note that the phys_drive/res1 field is nominally the 32-bit\n * \"block number\" field, but the only BMIC command(s) of interest\n * implemented overload the MSB (note big-endian format here)\n * to be the physical drive ID, so we define accordingly.\n */\nstruct ciss_bmic_cdb {\n    u_int8_t\topcode;\n    u_int8_t\tlog_drive;\n    u_int8_t\tphys_drive;\n    u_int8_t\tres1[3];\n    u_int8_t\tbmic_opcode;\n    u_int16_t\tsize;\t\t\t/* big-endian */\n    u_int8_t\tres2;\n} __packed;\n\n/*\n * BMIC command command/return structures.\n */\n\n/* CISS_BMIC_ID_LDRIVE */\nstruct ciss_bmic_id_ldrive {\n    u_int16_t\tblock_size;\n    u_int32_t\tblocks_available;\n    u_int8_t\tdrive_parameter_table[16];\t/* XXX define */\n    u_int8_t\tfault_tolerance;\n#define CISS_LDRIVE_RAID0\t0\n#define CISS_LDRIVE_RAID4\t1\n#define CISS_LDRIVE_RAID1\t2\n#define CISS_LDRIVE_RAID5\t3\n#define CISS_LDRIVE_RAID51\t4\n#define CISS_LDRIVE_RAIDADG\t5\n    u_int8_t\tres1;\n    u_int8_t\tbios_disable_flag;\n    u_int8_t\tres2;\n    u_int32_t\tlogical_drive_identifier;\n    char\tlogical_drive_label[64];\n    u_int64_t\tbig_blocks_available;\n    u_int8_t\tres3[410];\n} __packed;\n\n/* CISS_BMIC_ID_LSTATUS */\nstruct ciss_bmic_id_lstatus {\n    u_int8_t\tstatus;\n#define CISS_LSTATUS_OK\t\t\t\t0\n#define CISS_LSTATUS_FAILED\t\t\t1\n#define CISS_LSTATUS_NOT_CONFIGURED\t\t2\n#define CISS_LSTATUS_INTERIM_RECOVERY\t\t3\n#define CISS_LSTATUS_READY_RECOVERY\t\t4\n#define CISS_LSTATUS_RECOVERING\t\t\t5\n#define CISS_LSTATUS_WRONG_PDRIVE\t\t6\n#define CISS_LSTATUS_MISSING_PDRIVE\t\t7\n#define CISS_LSTATUS_EXPANDING\t\t\t10\n#define CISS_LSTATUS_BECOMING_READY\t\t11\n#define CISS_LSTATUS_QUEUED_FOR_EXPANSION\t12\n    u_int32_t\tdeprecated_drive_failure_map;\n    u_int8_t\tres1[416];\n    u_int32_t\tblocks_to_recover;\n    u_int8_t\tdeprecated_drive_rebuilding;\n    u_int16_t\tdeprecated_remap_count[32];\n    u_int32_t\tdeprecated_replacement_map;\n    u_int32_t\tdeprecated_active_spare_map;\n    u_int8_t\tspare_configured:1;\n    u_int8_t\tspare_rebuilding:1;\n    u_int8_t\tspare_rebuilt:1;\n    u_int8_t\tspare_failed:1;\n    u_int8_t\tspare_switched:1;\n    u_int8_t\tspare_available:1;\n    u_int8_t\tres2:2;\n    u_int8_t\tdeprecated_spare_to_replace_map[32];\n    u_int32_t\tdeprecated_replaced_marked_ok_map;\n    u_int8_t\tmedia_exchanged;\n    u_int8_t\tcache_failure;\n    u_int8_t\texpand_failure;\n    u_int8_t\trebuild_read_failure:1;\n    u_int8_t\trebuild_write_failure:1;\n    u_int8_t\tres3:6;\n    u_int8_t\tdrive_failure_map[CISS_BIG_MAP_ENTRIES / 8];\n    u_int16_t\tremap_count[CISS_BIG_MAP_ENTRIES];\n    u_int8_t\treplacement_map[CISS_BIG_MAP_ENTRIES / 8];\n    u_int8_t\tactive_spare_map[CISS_BIG_MAP_ENTRIES / 8];\n    u_int8_t\tspare_to_replace_map[CISS_BIG_MAP_ENTRIES];\n    u_int8_t\treplaced_marked_ok_map[CISS_BIG_MAP_ENTRIES / 8];\n    u_int8_t\tdrive_rebuilding;\n    u_int64_t\tbig_blocks_to_recover;\n    u_int8_t\tres4[28];\n} __packed;\n\n/* CISS_BMIC_ID_CTLR */\nstruct ciss_bmic_id_table {\n    u_int8_t\tconfigured_logical_drives;\n    u_int32_t\tconfig_signature;\n    char\trunning_firmware_revision[4];\n    char\tstored_firmware_revision[4];\n    u_int8_t\thardware_revision;\n    u_int8_t\tres1[4];\n    u_int32_t\tdeprecated_drive_present_map;\n    u_int32_t\tdeprecated_external_drive_present_map;\n    u_int32_t\tboard_id;\n    u_int8_t\tres2;\n    u_int32_t\tdeprecated_non_disk_map;\n    u_int8_t\tres3[5];\n    char\tmarketting_revision;\n    u_int8_t\tres4:3;\n    u_int8_t\tmore_than_seven_supported:1;\n    u_int8_t\tres5:3;\n    u_int8_t\tbig_map_supported:1;\t\t/* must be set! */\n    u_int8_t\tres6[2];\n    u_int8_t\tscsi_bus_count;\n    u_int32_t\tres7;\n    u_int32_t\tcontroller_clock;\n    u_int8_t\tdrives_per_scsi_bus;\n    u_int8_t\tbig_drive_present_map[CISS_BIG_MAP_ENTRIES / 8];\n    u_int8_t\tbig_external_drive_present_map[CISS_BIG_MAP_ENTRIES / 8];\n    u_int8_t\tbig_non_disk_map[CISS_BIG_MAP_ENTRIES / 8];\n} __packed;\n\n/* CISS_BMIC_ID_PDRIVE */\nstruct ciss_bmic_id_pdrive {\n    u_int8_t\tscsi_bus;\n    u_int8_t\tscsi_id;\n    u_int16_t\tblock_size;\n    u_int32_t\ttotal_blocks;\n    u_int32_t\treserved_blocks;\n    char\tmodel[40];\n    char\tserial[40];\n    char\trevision[8];\n    u_int8_t\tinquiry_bits;\n    u_int8_t\tres1[2];\n    u_int8_t\tdrive_present:1;\n    u_int8_t\tnon_disk:1;\n    u_int8_t\twide:1;\n    u_int8_t\tsynchronous:1;\n    u_int8_t\tnarrow:1;\n    u_int8_t\twide_downgraded_to_narrow:1;\n    u_int8_t\tultra:1;\n    u_int8_t\tultra2:1;\n    u_int8_t\tSMART:1;\n    u_int8_t\tSMART_errors_recorded:1;\n    u_int8_t\tSMART_errors_enabled:1;\n    u_int8_t\tSMART_errors_detected:1;\n    u_int8_t\texternal:1;\n    u_int8_t\tconfigured:1;\n    u_int8_t\tconfigured_spare:1;\n    u_int8_t\tcache_saved_enabled:1;\n    u_int8_t\tres2;\n    u_int8_t\tres3:6;\n    u_int8_t\tcache_currently_enabled:1;\n    u_int8_t\tcache_safe:1;\n    u_int8_t\tres4[5];\n    char\tconnector[2];\n    u_int8_t\tres5;\n    u_int8_t\tbay;\n    u_int16_t\trpm;\n    u_int8_t\tdrive_type;\n    u_int8_t\tres6[393];\n} __packed;\n\n/* CISS_BMIC_BLINK_PDRIVE */\n/* CISS_BMIC_SENSE_BLINK_PDRIVE */\nstruct ciss_bmic_blink_pdrive {\n    u_int32_t\tblink_duration;\t\t/* 10ths of a second */\n    u_int32_t\tduration_elapsed;\t/* only for sense command  */\n    u_int8_t\tblinktab[256];\n#define CISS_BMIC_BLINK_ALL\t1\n#define CISS_BMIC_BLINK_TIMED\t2\n    u_int8_t\tres2[248];\n} __packed;\n\n/* CISS_BMIC_FLUSH_CACHE */\nstruct ciss_bmic_flush_cache {\n    u_int16_t\tflag;\n#define CISS_BMIC_FLUSH_AND_ENABLE\t0\n#define CISS_BMIC_FLUSH_AND_DISABLE\t1\n    u_int8_t\tres1[510];\n} __packed;\n\n#ifdef _KERNEL\n/*\n * CISS \"simple\" transport layer.\n *\n * Note that there are two slightly different versions of this interface\n * with different interrupt mask bits.  There's nothing like consistency...\n */\n#define CISS_TL_SIMPLE_BAR_REGS\t0x10\t/* BAR pointing to register space */\n#define CISS_TL_SIMPLE_BAR_CFG\t0x14\t/* BAR pointing to space containing config table */\n\n#define CISS_TL_SIMPLE_IDBR\t0x20\t/* inbound doorbell register */\n#define CISS_TL_SIMPLE_IDBR_CFG_TABLE\t(1<<0)\t/* notify controller of config table update */\n\n#define CISS_TL_SIMPLE_ISR\t0x30\t/* interrupt status register */\n#define CISS_TL_SIMPLE_IMR\t0x34\t/* interrupt mask register */\n#define CISS_TL_SIMPLE_INTR_OPQ_SA5\t(1<<3)\t/* OPQ not empty interrupt, SA5 boards */\n#define CISS_TL_SIMPLE_INTR_OPQ_SA5B\t(1<<2)\t/* OPQ not empty interrupt, SA5B boards */\n\n#define CISS_TL_SIMPLE_IPQ\t0x40\t/* inbound post queue */\n#define CISS_TL_SIMPLE_OPQ\t0x44\t/* outbound post queue */\n#define CISS_TL_SIMPLE_OPQ_EMPTY\t(~(u_int32_t)0)\n\n#define CISS_TL_SIMPLE_OSR\t0x9c\t/* outbound status register */\n#define CISS_TL_SIMPLE_ODC\t0xa0\t/* outbound doorbell clear register */\n#define CISS_TL_SIMPLE_ODC_CLEAR\t(0x1)\n\n#define CISS_TL_SIMPLE_CFG_BAR\t0xb4\t/* should be 0x14 */\n#define CISS_TL_SIMPLE_CFG_OFF\t0xb8\t/* offset in BAR at which config table is located */\n\n/*\n * Register access primitives.\n */\n#define CISS_TL_SIMPLE_READ(sc, ofs) \\\n\tbus_space_read_4(sc->ciss_regs_btag, sc->ciss_regs_bhandle, ofs)\n#define CISS_TL_SIMPLE_WRITE(sc, ofs, val) \\\n\tbus_space_write_4(sc->ciss_regs_btag, sc->ciss_regs_bhandle, ofs, val)\n\n#define CISS_TL_SIMPLE_POST_CMD(sc, phys)\tCISS_TL_SIMPLE_WRITE(sc, CISS_TL_SIMPLE_IPQ, phys)\n#define CISS_TL_SIMPLE_FETCH_CMD(sc)\t\tCISS_TL_SIMPLE_READ(sc, CISS_TL_SIMPLE_OPQ)\n\n#define CISS_TL_PERF_INTR_OPQ\t(CISS_TL_SIMPLE_INTR_OPQ_SA5 | CISS_TL_SIMPLE_INTR_OPQ_SA5B)\n#define CISS_TL_PERF_INTR_MSI\t0x01\n\n#define CISS_TL_PERF_POST_CMD(sc, cr)\t\tCISS_TL_SIMPLE_WRITE(sc, CISS_TL_SIMPLE_IPQ, cr->cr_ccphys | (cr)->cr_sg_tag)\n#define CISS_TL_PERF_FLUSH_INT(sc)\t\tCISS_TL_SIMPLE_READ(sc, CISS_TL_SIMPLE_OSR)\n#define CISS_TL_PERF_CLEAR_INT(sc)\t\tCISS_TL_SIMPLE_WRITE(sc, CISS_TL_SIMPLE_ODC, CISS_TL_SIMPLE_ODC_CLEAR)\n#define CISS_CYCLE_MASK\t\t0x00000001\n\n/* Only need one MSI/MSI-X vector */\n#define CISS_MSI_COUNT\t1\n\n#define CISS_TL_SIMPLE_DISABLE_INTERRUPTS(sc) \\\n\tCISS_TL_SIMPLE_WRITE(sc, CISS_TL_SIMPLE_IMR, \\\n\t\t\t     CISS_TL_SIMPLE_READ(sc, CISS_TL_SIMPLE_IMR) | (sc)->ciss_interrupt_mask)\n#define CISS_TL_SIMPLE_ENABLE_INTERRUPTS(sc) \\\n\tCISS_TL_SIMPLE_WRITE(sc, CISS_TL_SIMPLE_IMR, \\\n\t\t\t     CISS_TL_SIMPLE_READ(sc, CISS_TL_SIMPLE_IMR) & ~(sc)->ciss_interrupt_mask)\n\n\n\n#endif /* _KERNEL */\n"
  },
  {
    "path": "freebsd-headers/dev/ciss/cissvar.h",
    "content": "/*-\n * Copyright (c) 2001 Michael Smith\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t$FreeBSD: release/9.0.0/sys/dev/ciss/cissvar.h 204648 2010-03-03 17:58:41Z mav $\n */\n\n/*\n * CISS adapter driver datastructures\n */\n\ntypedef STAILQ_HEAD(, ciss_request)\tcr_qhead_t;\n\n/************************************************************************\n * Tunable parameters\n */\n\n/*\n * There is no guaranteed upper bound on the number of concurrent\n * commands an adapter may claim to support.  Cap it at a reasonable\n * value.\n */\n#define CISS_MAX_REQUESTS\t1024\n\n/*\n * Maximum number of logical drives we support.\n */\n#define CISS_MAX_LOGICAL\t15\n\n/*\n * Maximum number of physical devices we support.\n */\n#define CISS_MAX_PHYSICAL\t1024\n\n/*\n * Interrupt reduction can be controlled by tuning the interrupt\n * coalesce delay and count paramters.  The delay (in microseconds)\n * defers delivery of interrupts to increase the chance of there being\n * more than one completed command ready when the interrupt is\n * delivered.  The count expedites the delivery of the interrupt when\n * the given number of commands are ready.\n *\n * If the delay is set to 0, interrupts are delivered immediately.\n */\n#define CISS_INTERRUPT_COALESCE_DELAY\t0\n#define CISS_INTERRUPT_COALESCE_COUNT\t16\n\n/*\n * Heartbeat routine timeout in seconds.  Note that since event\n * handling is performed on a callback basis, we don't need this to\n * run very often.\n */\n#define CISS_HEARTBEAT_RATE\t\t10\n\n/************************************************************************\n * Compatibility with older versions of FreeBSD\n */\n#if __FreeBSD_version < 440001\n#warning testing old-FreeBSD compat\ntypedef struct proc\td_thread_t;\n#endif\n\n/************************************************************************\n * Driver version.  Only really significant to the ACU interface.\n */\n#define CISS_DRIVER_VERSION\t20011201\n\n/************************************************************************\n * Driver data structures\n */\n\n/*\n * Each command issued to the adapter is managed by a request\n * structure.\n */\nstruct ciss_request\n{\n    STAILQ_ENTRY(ciss_request)\tcr_link;\n    int\t\t\t\tcr_onq;\t\t/* which queue we are on */\n\n    struct ciss_softc\t\t*cr_sc;\t\t/* controller softc */\n    void\t\t\t*cr_data;\t/* data buffer */\n    u_int32_t\t\t\tcr_length;\t/* data length */\n    bus_dmamap_t\t\tcr_datamap;\t/* DMA map for data */\n    struct ciss_command\t\t*cr_cc;\n    uint32_t\t\t\tcr_ccphys;\n    int\t\t\t\tcr_tag;\n    int\t\t\t\tcr_flags;\n#define CISS_REQ_MAPPED\t\t(1<<0)\t\t/* data mapped */\n#define CISS_REQ_SLEEP\t\t(1<<1)\t\t/* submitter sleeping */\n#define CISS_REQ_POLL\t\t(1<<2)\t\t/* submitter polling */\n#define CISS_REQ_DATAOUT\t(1<<3)\t\t/* data host->adapter */\n#define CISS_REQ_DATAIN\t\t(1<<4)\t\t/* data adapter->host */\n#define CISS_REQ_BUSY\t\t(1<<5)\t\t/* controller has req */\n\n    void\t\t\t(* cr_complete)(struct ciss_request *);\n    void\t\t\t*cr_private;\n    int\t\t\t\tcr_sg_tag;\n#define CISS_SG_MAX\t\t((CISS_SG_FETCH_MAX << 1) | 0x1)\n#define CISS_SG_1\t\t((CISS_SG_FETCH_1 << 1) | 0x01)\n#define CISS_SG_2\t\t((CISS_SG_FETCH_2 << 1) | 0x01)\n#define CISS_SG_4\t\t((CISS_SG_FETCH_4 << 1) | 0x01)\n#define CISS_SG_8\t\t((CISS_SG_FETCH_8 << 1) | 0x01)\n#define CISS_SG_16\t\t((CISS_SG_FETCH_16 << 1) | 0x01)\n#define CISS_SG_32\t\t((CISS_SG_FETCH_32 << 1) | 0x01)\n#define CISS_SG_NONE\t\t((CISS_SG_FETCH_NONE << 1) | 0x01)\n};\n\n/*\n * The adapter command structure is defined with a zero-length\n * scatter/gather list size.  In practise, we want space for a\n * scatter-gather list, and we also want to avoid having commands\n * cross page boundaries.\n *\n * The size of the ciss_command is 52 bytes.  65 s/g elements are reserved\n * to allow a max i/o size of 256k.  This gives a total command size of\n * 1120 bytes, including the 32 byte alignment padding.  Modern controllers\n * seem to saturate nicely at this value.\n */\n\n#define CISS_MAX_SG_ELEMENTS\t65\n#define CISS_COMMAND_ALIGN\t32\n#define CISS_COMMAND_SG_LENGTH\t(sizeof(struct ciss_sg_entry) * CISS_MAX_SG_ELEMENTS)\n#define CISS_COMMAND_ALLOC_SIZE\t\t(roundup2(sizeof(struct ciss_command) + CISS_COMMAND_SG_LENGTH, CISS_COMMAND_ALIGN))\n\n/*\n * Per-logical-drive data.\n */\nstruct ciss_ldrive\n{\n    union ciss_device_address\tcl_address;\n    union ciss_device_address\t*cl_controller;\n    int\t\t\t\tcl_status;\n#define CISS_LD_NONEXISTENT\t0\n#define CISS_LD_ONLINE\t\t1\n#define CISS_LD_OFFLINE\t\t2\n\n    int\t\t\t\tcl_update;\n\n    struct ciss_bmic_id_ldrive\t*cl_ldrive;\n    struct ciss_bmic_id_lstatus\t*cl_lstatus;\n    struct ciss_ldrive_geometry\tcl_geometry;\n\n    char\t\t\tcl_name[16];\t\t/* device name */\n};\n\n/*\n * Per-physical-drive data\n */\nstruct ciss_pdrive\n{\n    union ciss_device_address\tcp_address;\n    int\t\t\t\tcp_online;\n};\n\n#define CISS_PHYSICAL_SHIFT\t5\n#define CISS_PHYSICAL_BASE\t(1 << CISS_PHYSICAL_SHIFT)\n#define CISS_MAX_PHYSTGT\t256\n\n#define CISS_IS_PHYSICAL(bus)\t(bus >= CISS_PHYSICAL_BASE)\n#define CISS_CAM_TO_PBUS(bus)\t(bus - CISS_PHYSICAL_BASE)\n\n/*\n * Per-adapter data\n */\nstruct ciss_softc\n{\n    /* bus connections */\n    device_t\t\t\tciss_dev;\t\t/* bus attachment */\n    struct cdev *ciss_dev_t;\t\t/* control device */\n\n    struct resource\t\t*ciss_regs_resource;\t/* register interface window */\n    int\t\t\t\tciss_regs_rid;\t\t/* resource ID */\n    bus_space_handle_t\t\tciss_regs_bhandle;\t/* bus space handle */\n    bus_space_tag_t\t\tciss_regs_btag;\t\t/* bus space tag */\n\n    struct resource\t\t*ciss_cfg_resource;\t/* config struct interface window */\n    int\t\t\t\tciss_cfg_rid;\t\t/* resource ID */\n    struct ciss_config_table\t*ciss_cfg;\t\t/* config table in adapter memory */\n    struct ciss_perf_config\t*ciss_perf;\t\t/* config table for the performant */\n    struct ciss_bmic_id_table\t*ciss_id;\t\t/* ID table in host memory */\n    u_int32_t\t\t\tciss_heartbeat;\t\t/* last heartbeat value */\n    int\t\t\t\tciss_heart_attack;\t/* number of times we have seen this value */\n\n    int\t\t\t\tciss_msi;\n    struct resource\t\t*ciss_irq_resource;\t/* interrupt */\n    int\t\t\t\tciss_irq_rid[CISS_MSI_COUNT];\t\t/* resource ID */\n    void\t\t\t*ciss_intr;\t\t/* interrupt handle */\n\n    bus_dma_tag_t\t\tciss_parent_dmat;\t/* parent DMA tag */\n    bus_dma_tag_t\t\tciss_buffer_dmat;\t/* data buffer/command DMA tag */\n\n    u_int32_t\t\t\tciss_interrupt_mask;\t/* controller interrupt mask bits */\n\n    uint64_t\t\t\t*ciss_reply;\n    int\t\t\t\tciss_cycle;\n    int\t\t\t\tciss_rqidx;\n    bus_dma_tag_t\t\tciss_reply_dmat;\n    bus_dmamap_t\t\tciss_reply_map;\n    uint32_t\t\t\tciss_reply_phys;\n\n    int\t\t\t\tciss_max_requests;\n    struct ciss_request\t\tciss_request[CISS_MAX_REQUESTS];\t/* requests */\n    void\t\t\t*ciss_command;\t\t/* command structures */\n    bus_dma_tag_t\t\tciss_command_dmat;\t/* command DMA tag */\n    bus_dmamap_t\t\tciss_command_map;\t/* command DMA map */\n    u_int32_t\t\t\tciss_command_phys;\t/* command array base address */\n    cr_qhead_t\t\t\tciss_free;\t\t/* requests available for reuse */\n    cr_qhead_t\t\t\tciss_notify;\t\t/* requests which are defered for processing */\n    struct proc\t\t\t*ciss_notify_thread;\n\n    struct callout\t\tciss_periodic;\t\t/* periodic event handling */\n    struct ciss_request\t\t*ciss_periodic_notify;\t/* notify callback request */\n\n    struct mtx\t\t\tciss_mtx;\n    struct ciss_ldrive\t\t**ciss_logical;\n    struct ciss_pdrive\t\t**ciss_physical;\n    union ciss_device_address\t*ciss_controllers;\t/* controller address */\n    int\t\t\t\tciss_max_bus_number;\t/* maximum bus number */\n    int\t\t\t\tciss_max_logical_bus;\n    int\t\t\t\tciss_max_physical_bus;\n\n    struct cam_devq\t\t*ciss_cam_devq;\n    struct cam_sim\t\t**ciss_cam_sim;\n\n    int\t\t\t\tciss_soft_reset;\n\n    int\t\t\t\tciss_flags;\n#define CISS_FLAG_NOTIFY_OK\t(1<<0)\t\t/* notify command running OK */\n#define CISS_FLAG_CONTROL_OPEN\t(1<<1)\t\t/* control device is open */\n#define CISS_FLAG_ABORTING\t(1<<2)\t\t/* driver is going away */\n#define CISS_FLAG_RUNNING\t(1<<3)\t\t/* driver is running (interrupts usable) */\n#define CISS_FLAG_BUSY\t\t(1<<4)\t\t/* no free commands */\n\n#define CISS_FLAG_FAKE_SYNCH\t(1<<16)\t\t/* needs SYNCHRONISE_CACHE faked */\n#define CISS_FLAG_BMIC_ABORT\t(1<<17)\t\t/* use BMIC command to abort Notify on Event */\n#define CISS_FLAG_THREAD_SHUT\t(1<<20)\t\t/* shutdown the kthread */\n\n    struct ciss_qstat\t\tciss_qstat[CISSQ_COUNT];\t/* queue statistics */\n};\n\n/************************************************************************\n * Debugging/diagnostic output.\n */\n\n/*\n * Debugging levels:\n *  0 - quiet, only emit warnings\n *  1 - talkative, log major events, but nothing on the I/O path\n *  2 - noisy, log events on the I/O path\n *  3 - extremely noisy, log items in loops\n */\n#ifdef CISS_DEBUG\n# define debug(level, fmt, args...)\t\t\t\t\t\t\t\\\n\tdo {\t\t\t\t\t\t\t\t\t\t\\\n\t    if (level <= CISS_DEBUG) printf(\"%s: \" fmt \"\\n\", __func__ , ##args);\t\\\n\t} while(0)\n# define debug_called(level)\t\t\t\t\t\t\\\n\tdo {\t\t\t\t\t\t\t\t\\\n\t    if (level <= CISS_DEBUG) printf(\"%s: called\\n\", __func__);\t\\\n\t} while(0)\n# define debug_struct(s)\t\tprintf(\"  SIZE %s: %zu\\n\", #s, sizeof(struct s))\n# define debug_union(s)\t\t\tprintf(\"  SIZE %s: %zu\\n\", #s, sizeof(union s))\n# define debug_type(s)\t\t\tprintf(\"  SIZE %s: %zu\\n\", #s, sizeof(s))\n# define debug_field(s, f)\t\tprintf(\"  OFFSET %s.%s: %d\\n\", #s, #f, ((int)&(((struct s *)0)->f)))\n# define debug_const(c)\t\t\tprintf(\"  CONST %s %jd/0x%jx\\n\", #c, (intmax_t)c, (intmax_t)c);\n#else\n# define debug(level, fmt, args...)\n# define debug_called(level)\n# define debug_struct(s)\n# define debug_union(s)\n# define debug_type(s)\n# define debug_field(s, f)\n# define debug_const(c)\n#endif\n\n#define ciss_printf(sc, fmt, args...)\tdevice_printf(sc->ciss_dev, fmt , ##args)\n\n/************************************************************************\n * Queue primitives\n */\n\n#define CISSQ_ADD(sc, qname)\t\t\t\t\t\\\n\tdo {\t\t\t\t\t\t\t\\\n\t    struct ciss_qstat *qs = &(sc)->ciss_qstat[qname];\t\\\n\t\t\t\t\t\t\t\t\\\n\t    qs->q_length++;\t\t\t\t\t\\\n\t    if (qs->q_length > qs->q_max)\t\t\t\\\n\t\tqs->q_max = qs->q_length;\t\t\t\\\n\t} while(0)\n\n#define CISSQ_REMOVE(sc, qname)    (sc)->ciss_qstat[qname].q_length--\n#define CISSQ_INIT(sc, qname)\t\t\t\\\n\tdo {\t\t\t\t\t\\\n\t    sc->ciss_qstat[qname].q_length = 0;\t\\\n\t    sc->ciss_qstat[qname].q_max = 0;\t\\\n\t} while(0)\n\n\n#define CISSQ_REQUEST_QUEUE(name, index)\t\t\t\t\\\nstatic __inline void\t\t\t\t\t\t\t\\\nciss_initq_ ## name (struct ciss_softc *sc)\t\t\t\t\\\n{\t\t\t\t\t\t\t\t\t\\\n    STAILQ_INIT(&sc->ciss_ ## name);\t\t\t\t\t\\\n    CISSQ_INIT(sc, index);\t\t\t\t\t\t\\\n}\t\t\t\t\t\t\t\t\t\\\nstatic __inline void\t\t\t\t\t\t\t\\\nciss_enqueue_ ## name (struct ciss_request *cr)\t\t\t\t\\\n{\t\t\t\t\t\t\t\t\t\\\n\t\t\t\t\t\t\t\t\t\\\n    STAILQ_INSERT_TAIL(&cr->cr_sc->ciss_ ## name, cr, cr_link);\t\t\\\n    CISSQ_ADD(cr->cr_sc, index);\t\t\t\t\t\\\n    cr->cr_onq = index;\t\t\t\t\t\t\t\\\n}\t\t\t\t\t\t\t\t\t\\\nstatic __inline void\t\t\t\t\t\t\t\\\nciss_requeue_ ## name (struct ciss_request *cr)\t\t\t\t\\\n{\t\t\t\t\t\t\t\t\t\\\n\t\t\t\t\t\t\t\t\t\\\n    STAILQ_INSERT_HEAD(&cr->cr_sc->ciss_ ## name, cr, cr_link);\t\t\\\n    CISSQ_ADD(cr->cr_sc, index);\t\t\t\t\t\\\n    cr->cr_onq = index;\t\t\t\t\t\t\t\\\n}\t\t\t\t\t\t\t\t\t\\\nstatic __inline struct ciss_request *\t\t\t\t\t\\\nciss_dequeue_ ## name (struct ciss_softc *sc)\t\t\t\t\\\n{\t\t\t\t\t\t\t\t\t\\\n    struct ciss_request\t*cr;\t\t\t\t\t\t\\\n\t\t\t\t\t\t\t\t\t\\\n    if ((cr = STAILQ_FIRST(&sc->ciss_ ## name)) != NULL) {\t\t\\\n\tSTAILQ_REMOVE_HEAD(&sc->ciss_ ## name, cr_link);\t\t\\\n\tCISSQ_REMOVE(sc, index);\t\t\t\t\t\\\n\tcr->cr_onq = -1;\t\t\t\t\t\t\\\n    }\t\t\t\t\t\t\t\t\t\\\n    return(cr);\t\t\t\t\t\t\t\t\\\n}\t\t\t\t\t\t\t\t\t\\\nstruct hack\n\nCISSQ_REQUEST_QUEUE(free, CISSQ_FREE);\nCISSQ_REQUEST_QUEUE(notify, CISSQ_NOTIFY);\n\nstatic __inline void\nciss_enqueue_complete(struct ciss_request *ac, cr_qhead_t *head)\n{\n\n    STAILQ_INSERT_TAIL(head, ac, cr_link);\n}\n\nstatic __inline struct ciss_request *\nciss_dequeue_complete(struct ciss_softc *sc, cr_qhead_t *head)\n{\n    struct ciss_request  *ac;\n\n    if ((ac = STAILQ_FIRST(head)) != NULL)\n        STAILQ_REMOVE_HEAD(head, cr_link);\n    return(ac);\n}\n\n/********************************************************************************\n * space-fill a character string\n */\nstatic __inline void\npadstr(char *targ, const char *src, int len)\n{\n    while (len-- > 0) {\n\tif (*src != 0) {\n\t    *targ++ = *src++;\n\t} else {\n\t    *targ++ = ' ';\n\t}\n    }\n}\n\n#define ciss_report_request(a, b, c)\t\\\n\t_ciss_report_request(a, b, c, __FUNCTION__)\n"
  },
  {
    "path": "freebsd-headers/dev/firewire/firewire.h",
    "content": "/*-\n * Copyright (c) 2003 Hidetoshi Shimokawa\n * Copyright (c) 1998-2002 Katsushi Kobayashi and Hidetoshi Shimokawa\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. All advertising materials mentioning features or use of this software\n *    must display the acknowledgement as bellow:\n *\n *    This product includes software developed by K. Kobayashi and H. Shimokawa\n *\n * 4. The name of the author may not be used to endorse or promote products\n *    derived from this software without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR\n * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\n * DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR\n * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,\n * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n * \n * $FreeBSD: release/9.0.0/sys/dev/firewire/firewire.h 188726 2009-02-17 19:37:04Z sbruno $\n *\n */\n\n#ifndef _FIREWIRE_H\n#define _FIREWIRE_H 1\n\n#define\tDEV_DEF  0\n#define\tDEV_DV   2\n\nstruct fw_isochreq {\n\tunsigned char\tch:6,\n\t\t\ttag:2;\n};\n\nstruct fw_isobufreq {\n\tstruct fw_bufspec {\n\t\tunsigned int nchunk;\n\t\tunsigned int npacket;\n\t\tunsigned int psize;\n\t} tx, rx;\n};\n\nstruct fw_addr {\n\tuint32_t hi;\n\tuint32_t lo;\n};\n\nstruct fw_asybindreq {\n\tstruct fw_addr start;\n\tunsigned long len;\n};\n\nstruct fw_reg_req_t {\n\tuint32_t addr;\n\tuint32_t data;\n};\n\n#define MAXREC(x)\t(2 << (x))\n#define FWPMAX_S400 (2048 + 20)\t/* MAXREC plus space for control data */\n#define FWMAXQUEUE 128\n\n#define\tFWLOCALBUS\t0xffc0\n\n#define FWTCODE_WREQQ\t0\n#define FWTCODE_WREQB\t1\n#define FWTCODE_WRES\t2\n#define FWTCODE_RREQQ\t4\n#define FWTCODE_RREQB\t5\n#define FWTCODE_RRESQ\t6\n#define FWTCODE_RRESB\t7\n#define FWTCODE_CYCS\t8\n#define FWTCODE_LREQ\t9\n#define FWTCODE_STREAM\t0xa\n#define FWTCODE_LRES\t0xb\n#define FWTCODE_PHY\t0xe\n\n#define\tFWRETRY_1\t0\n#define\tFWRETRY_X\t1\n#define\tFWRETRY_A\t2\n#define\tFWRETRY_B\t3\n\n#define FWRCODE_COMPLETE\t0\n#define FWRCODE_ER_CONFL\t4\n#define FWRCODE_ER_DATA\t\t5\n#define FWRCODE_ER_TYPE\t\t6\n#define FWRCODE_ER_ADDR\t\t7\n\n/*\n * Defined 1394a-2000\n * Table 5B-1\n */\n#define FWSPD_S100\t0\n#define FWSPD_S200\t1\n#define FWSPD_S400\t2\n#define FWSPD_S800\t3\n#define FWSPD_S1600\t4\n#define FWSPD_S3200\t5\n\n#define\tFWP_TL_VALID (1 << 7)\n\nstruct fw_isohdr {\n\tuint32_t hdr[1];\n};\n\nstruct fw_asyhdr {\n\tuint32_t hdr[4];\n};\n\n#if BYTE_ORDER == BIG_ENDIAN\n#define BIT4x2(x,y)\t uint8_t  x:4, y:4\n#define BIT16x2(x,y)\tuint32_t x:16, y:16\n#else\n#define BIT4x2(x,y)\t uint8_t  y:4, x:4\n#define BIT16x2(x,y)\tuint32_t y:16, x:16\n#endif\n\n\n#if BYTE_ORDER == BIG_ENDIAN\n#define COMMON_HDR(a,b,c,d)\tuint32_t a:16,b:8,c:4,d:4\n#define COMMON_RES(a,b,c,d)\tuint32_t a:16,b:4,c:4,d:8\n#else\n#define COMMON_HDR(a,b,c,d)\tuint32_t d:4,c:4,b:8,a:16\n#define COMMON_RES(a,b,c,d)\tuint32_t d:8,c:4,b:4,a:16\n#endif\n\nstruct fw_pkt {\n\tunion {\n\t\tuint32_t ld[0];\n\t\tstruct {\n\t\t\tCOMMON_HDR(, , tcode, );\n\t\t} common;\n\t\tstruct {\n\t\t\tCOMMON_HDR(len, chtag, tcode, sy);\n\t\t\tuint32_t payload[0];\n\t\t} stream;\n\t\tstruct {\n\t\t\tCOMMON_HDR(dst, tlrt, tcode, pri);\n\t\t\tBIT16x2(src, );\n\t\t} hdr;\n\t\tstruct {\n\t\t\tCOMMON_HDR(dst, tlrt, tcode, pri);\n\t\t\tBIT16x2(src, dest_hi);\n\t\t\tuint32_t dest_lo;\n\t\t} rreqq;\n\t\tstruct {\n\t\t\tCOMMON_HDR(dst, tlrt, tcode, pri);\n\t\t\tCOMMON_RES(src, rtcode, , );\n\t\t\tuint32_t :32;\n\t\t} wres;\n\t\tstruct {\n\t\t\tCOMMON_HDR(dst, tlrt, tcode, pri);\n\t\t\tBIT16x2(src, dest_hi);\n\t\t\tuint32_t dest_lo;\n\t\t\tBIT16x2(len, extcode);\n\t\t} rreqb;\n\t\tstruct {\n\t\t\tCOMMON_HDR(dst, tlrt, tcode, pri);\n\t\t\tBIT16x2(src, dest_hi);\n\t\t\tuint32_t dest_lo;\n\t\t\tuint32_t data;\n\t\t} wreqq;\n\t\tstruct {\n\t\t\tCOMMON_HDR(dst, tlrt, tcode, pri);\n\t\t\tBIT16x2(src, dest_hi);\n\t\t\tuint32_t dest_lo;\n\t\t\tuint32_t data;\n\t\t} cyc;\n\t\tstruct {\n\t\t\tCOMMON_HDR(dst, tlrt, tcode, pri);\n\t\t\tCOMMON_RES(src, rtcode, , );\n\t\t\tuint32_t :32;\n\t\t\tuint32_t data;\n\t\t} rresq;\n\t\tstruct {\n\t\t\tCOMMON_HDR(dst, tlrt, tcode, pri);\n\t\t\tBIT16x2(src, dest_hi);\n\t\t\tuint32_t dest_lo;\n\t\t\tBIT16x2(len, extcode);\n\t\t\tuint32_t payload[0];\n\t\t} wreqb;\n\t\tstruct {\n\t\t\tCOMMON_HDR(dst, tlrt, tcode, pri);\n\t\t\tBIT16x2(src, dest_hi);\n\t\t\tuint32_t dest_lo;\n\t\t\tBIT16x2(len, extcode);\n\t\t\tuint32_t payload[0];\n\t\t} lreq;\n\t\tstruct {\n\t\t\tCOMMON_HDR(dst, tlrt, tcode, pri);\n\t\t\tCOMMON_RES(src, rtcode, , );\n\t\t\tuint32_t :32;\n\t\t\tBIT16x2(len, extcode);\n\t\t\tuint32_t payload[0];\n\t\t} rresb;\n\t\tstruct {\n\t\t\tCOMMON_HDR(dst, tlrt, tcode, pri);\n\t\t\tCOMMON_RES(src, rtcode, , );\n\t\t\tuint32_t :32;\n\t\t\tBIT16x2(len, extcode);\n\t\t\tuint32_t payload[0];\n\t\t} lres;\n\t} mode;\n};\n\n/*\n * Response code (rtcode)\n */\n/* The node has successfully completed the command. */\n#define\tRESP_CMP\t\t0\n/* A resource conflict was detected. The request may be retried. */\n#define\tRESP_CONFLICT_ERROR\t4\n/* Hardware error, data is unavailable. */\n#define\tRESP_DATA_ERROR\t\t5\n/* A field in the request packet header was set to an unsupported or incorrect\n * value, or an invalid transaction was attempted (e.g., a write to a read-only\n * address). */\n#define\tRESP_TYPE_ERROR\t\t6\n/* The destination offset field in the request was set to an address not\n * accessible in the destination node. */\n#define\tRESP_ADDRESS_ERROR\t7\n\n/*\n * Extended transaction code (extcode)\n */\n#define EXTCODE_MASK_SWAP\t1\n#define EXTCODE_CMP_SWAP\t2\n#define EXTCODE_FETCH_ADD\t3\n#define EXTCODE_LITTLE_ADD\t4\n#define EXTCODE_BOUNDED_ADD\t5\n#define EXTCODE_WRAP_ADD\t6\n\nstruct fw_eui64 {\n\tuint32_t hi, lo;\n};\n#define FW_EUI64_BYTE(eui, x) \\\n\t((((x)<4)?\t\t\t\t\\\n\t\t((eui)->hi >> (8*(3-(x)))): \t\\\n\t\t((eui)->lo >> (8*(7-(x))))\t\\\n\t) & 0xff)\n#define FW_EUI64_EQUAL(x, y) \\\n\t((x).hi == (y).hi && (x).lo == (y).lo)\n\nstruct fw_asyreq {\n\tstruct fw_asyreq_t{\n\t\tunsigned char sped;\n\t\tunsigned int type;\n#define FWASREQNODE\t0\n#define FWASREQEUI\t1\n#define FWASRESTL\t2\n#define FWASREQSTREAM\t3\n\t\tunsigned short len;\n\t\tunion {\n\t\t\tstruct fw_eui64 eui;\n\t\t}dst;\n\t}req;\n\tstruct fw_pkt pkt;\n\tuint32_t data[512];\n};\n\nstruct fw_devinfo {\n\tstruct fw_eui64 eui;\n\tuint16_t dst;\n\tuint16_t status;\n};\n\n#define FW_MAX_DEVLST 70\nstruct fw_devlstreq {\n\tuint16_t n;\n\tuint16_t info_len;\n\tstruct fw_devinfo dev[FW_MAX_DEVLST];\n};\n\n/*\n * Defined in IEEE 1394a-2000\n * 4.3.4.1\n */\n#define FW_SELF_ID_PORT_CONNECTED_TO_CHILD 3\n#define FW_SELF_ID_PORT_CONNECTED_TO_PARENT 2\n#define FW_SELF_ID_PORT_NOT_CONNECTED 1\n#define FW_SELF_ID_PORT_NOT_EXISTS 0\n\n#define FW_SELF_ID_PAGE0 0\n#define FW_SELF_ID_PAGE1 1\n\n#if BYTE_ORDER == BIG_ENDIAN\nunion fw_self_id {\n\tstruct {\n\t\tuint32_t  id:2,\n\t\t\t  phy_id:6,\n\t\t\t  sequel:1,\n\t\t\t  link_active:1,\n\t\t\t  gap_count:6,\n\t\t\t  phy_speed:2,\n\t\t\t  reserved:2,\n\t\t\t  contender:1,\n\t\t\t  power_class:3,\n\t\t\t  port0:2,\n\t\t\t  port1:2,\n\t\t\t  port2:2,\n\t\t\t  initiated_reset:1,\n\t\t\t  more_packets:1;\n\t} p0;\n\tstruct {\n\t\tuint32_t\n\t\t\t  id:2,\n\t\t\t  phy_id:6,\n\t\t\t  sequel:1,\n\t\t\t  sequence_num:3,\n\t\t\t  reserved2:2,\n\t\t\t  port3:2,\n\t\t\t  port4:2,\n\t\t\t  port5:2,\n\t\t\t  port6:2,\n\t\t\t  port7:2,\n\t\t\t  port8:2,\n\t\t\t  port9:2,\n\t\t\t  port10:2,\n\t\t\t  reserved1:1,\n\t\t\t  more_packets:1;\n\t} p1;\n\tstruct {\n\t\tuint32_t\n\t\t\t  id:2,\n\t\t\t  phy_id:6,\n\t\t\t  sequel:1,\n\t\t\t  sequence_num:3,\n\t\t\t  :2,\n\t\t\t  port11:2,\n\t\t\t  port12:2,\n\t\t\t  port13:2,\n\t\t\t  port14:2,\n\t\t\t  port15:2,\n\t\t\t  :8;\n\t} p2;\n};\n#else\nunion fw_self_id {\n\tstruct {\n\t\tuint32_t  more_packets:1,\n\t\t\t  initiated_reset:1,\n\t\t\t  port2:2,\n\t\t\t  port1:2,\n\t\t\t  port0:2,\n\t\t\t  power_class:3,\n\t\t\t  contender:1,\n\t\t\t  reserved:2,\n\t\t\t  phy_speed:2,\n\t\t\t  gap_count:6,\n\t\t\t  link_active:1,\n\t\t\t  sequel:1,\n\t\t\t  phy_id:6,\n\t\t\t  id:2;\n\t} p0;\n\tstruct {\n\t\tuint32_t  more_packets:1,\n\t\t\t  reserved1:1,\n\t\t\t  port10:2,\n\t\t\t  port9:2,\n\t\t\t  port8:2,\n\t\t\t  port7:2,\n\t\t\t  port6:2,\n\t\t\t  port5:2,\n\t\t\t  port4:2,\n\t\t\t  port3:2,\n\t\t\t  reserved2:2,\n\t\t\t  sequence_num:3,\n\t\t\t  sequel:1,\n\t\t\t  phy_id:6,\n\t\t\t  id:2;\n\t} p1;\n\tstruct {\n\t\tuint32_t\n\t\t\t  reserved3:8,\n\t\t\t  port15:2,\n\t\t\t  port14:2,\n\t\t\t  port13:2,\n\t\t\t  port12:2,\n\t\t\t  port11:2,\n\t\t\t  reserved4:2,\n\t\t\t  sequence_num:3,\n\t\t\t  sequel:1,\n\t\t\t  phy_id:6,\n\t\t\t  id:2;\n\t} p2;\n};\n#endif\n\n\nstruct fw_topology_map {\n\tuint32_t crc:16,\n\t\t crc_len:16;\n\tuint32_t generation;\n\tuint32_t self_id_count:16,\n\t\t node_count:16;\n\tunion fw_self_id self_id[4*64];\n};\n\nstruct fw_speed_map {\n\tuint32_t crc:16,\n\t\t crc_len:16;\n\tuint32_t generation;\n\tuint8_t  speed[64][64];\n};\n\nstruct fw_crom_buf {\n\tstruct fw_eui64 eui;\n\tuint32_t len;\n\tvoid *ptr;\n};\n\n/*\n * FireWire specific system requests.\n */\n#define\tFW_SSTBUF\t_IOWR('S', 86, struct fw_isobufreq)\n#define\tFW_GSTBUF\t_IOWR('S', 87, struct fw_isobufreq)\n#define\tFW_SRSTREAM\t_IOWR('S', 88, struct fw_isochreq)\n#define\tFW_GRSTREAM\t_IOWR('S', 89, struct fw_isochreq)\n#define\tFW_STSTREAM\t_IOWR('S', 90, struct fw_isochreq)\n#define\tFW_GTSTREAM\t_IOWR('S', 91, struct fw_isochreq)\n\n#define\tFW_ASYREQ\t_IOWR('S', 92, struct fw_asyreq)\n#define FW_IBUSRST\t_IOR('S', 1, unsigned int)\n#define FW_GDEVLST\t_IOWR('S', 2, struct fw_devlstreq)\n#define\tFW_SBINDADDR\t_IOWR('S', 3, struct fw_asybindreq)\n#define\tFW_CBINDADDR\t_IOWR('S', 4, struct fw_asybindreq)\n#define\tFW_GTPMAP\t_IOR('S', 5, struct fw_topology_map)\n#define\tFW_GCROM\t_IOWR('S', 7, struct fw_crom_buf)\n\n#define\tFW_SDEUI64\t_IOW('S', 20, struct fw_eui64)\n#define\tFW_GDEUI64\t_IOR('S', 21, struct fw_eui64)\n\n#define FWOHCI_RDREG\t_IOWR('S', 80, struct fw_reg_req_t)\n#define FWOHCI_WRREG\t_IOWR('S', 81, struct fw_reg_req_t)\n#define FWOHCI_RDPHYREG\t_IOWR('S', 82, struct fw_reg_req_t)\n#define FWOHCI_WRPHYREG\t_IOWR('S', 83, struct fw_reg_req_t)\n\n#define DUMPDMA\t\t_IOWR('S', 82, uint32_t)\n\n#ifdef _KERNEL\n\n#define FWMAXNDMA 0x100 /* 8 bits DMA channel id. in device No. */\n\n#if defined(__DragonFly__) || __FreeBSD_version < 500000\n#define dev2unit(x)\t((minor(x) & 0xff) | (minor(x) >> 8))\n#define unit2minor(x)\t(((x) & 0xff) | (((x) << 8) & ~0xffff))\n#endif\n\n#define MAKEMINOR(f, u, s)\t\\\n\t((f) | (((u) & 0xff) << 8) | (s & 0xff))\n#define DEV2UNIT(x)\t((dev2unit(x) & 0xff00) >> 8)\n#define DEV2SUB(x)\t(dev2unit(x) & 0xff)\n\n#define FWMEM_FLAG\t0x10000\n#define DEV_FWMEM(x)\t(dev2unit(x) & FWMEM_FLAG)\n#endif\n#endif\n"
  },
  {
    "path": "freebsd-headers/dev/firewire/firewire_phy.h",
    "content": "/*-\n * Copyright (c) 1998-2002 Katsushi Kobayashi and Hidetoshi Shimokawa\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. All advertising materials mentioning features or use of this software\n *    must display the acknowledgement as bellow:\n *\n *    This product includes software developed by K. Kobayashi and H. Shimokawa\n *\n * 4. The name of the author may not be used to endorse or promote products\n *    derived from this software without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR\n * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\n * DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR\n * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,\n * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n * \n * $FreeBSD: release/9.0.0/sys/dev/firewire/firewire_phy.h 139749 2005-01-06 01:43:34Z imp $\n *\n */\n\n#define\tFW_PHY_PHYSID_REG\t\t0x00\n#define\tFW_PHY_PHYSID\t\t\t(63<<2)\n#define\tFW_PHY_ROOT_REG\t\t\t0x00\n#define\tFW_PHY_ROOT\t\t\t(1<<1)\n#define\tFW_PHY_CPS_REG\t\t\t0x00\n#define\tFW_PHY_CPS\t\t\t(1<<0)\n\n#define\tFW_PHY_RHB_REG\t\t\t0x01\n#define\tFW_PHY_RHB\t\t\t(1<<7)\n#define\tFW_PHY_IBR_REG\t\t\t0x01\n#define\tFW_PHY_IBR\t\t\t(1<<6)\n#define\tFW_PHY_ISBR_REG\t\t\t0x05\n#define\tFW_PHY_ISBR\t\t\t(1<<6)\n#define\tFW_PHY_GC_REG\t\t\t0x01\n\n#define\tFW_PHY_SPD_REG\t\t\t0x02\n#define\tFW_PHY_SPD\t\t\t(3<<6)\n#define\tFW_PHY_REV_REG\t\t\t0x02\n#define\tFW_PHY_REV\t\t\t(3<<4)\n#define\tFW_PHY_NP_REG\t\t\t0x02\n#define\tFW_PHY_NP\t\t\t(15<<0)\n\n#define\tFW_PHY_P1_REG\t\t\t0x03\n#define\tFW_PHY_P2_REG\t\t\t0x04\n#define\tFW_PHY_P3_REG\t\t\t0x05\n\n#define\tFW_PHY_P_ASTAT\t\t\t(3<<6)\n#define\tFW_PHY_P_BSTAT\t\t\t(3<<4)\n#define\tFW_PHY_P_CH\t\t\t(1<<3)\n#define\tFW_PHY_P_CON\t\t\t(1<<2)\n\n#define FW_PHY_LOOPINT_REG\t\t0x06\n#define FW_PHY_LOOPINT\t\t\t(1<<7)\n#define FW_PHY_CPSINT_REG\t\t0x06\n#define FW_PHY_CPSNT\t\t\t(1<<6)\n/*\n#define FW_PHY_CPS_REG\t\t\t0x06\n#define FW_PHY_CPS\t\t\t(1<<5)\n*/\n#define FW_PHY_IR_REG\t\t\t0x06\n#define FW_PHY_IR\t\t\t(1<<4)\n#define FW_PHY_C_REG\t\t\t0x06\n#define FW_PHY_C\t\t\t(1<<0)\n\n#define FW_PHY_ESPD_REG\t\t\t0x03\n#define\tFW_PHY_ESPD\t\t\t(7<<5)\n\n#define FW_PHY_EDEL_REG\t\t\t0x03\n#define FW_PHY_EDEL\t\t\t15<<0\n"
  },
  {
    "path": "freebsd-headers/dev/firewire/firewirereg.h",
    "content": "/*-\n * Copyright (c) 2003 Hidetoshi Shimokawa\n * Copyright (c) 1998-2002 Katsushi Kobayashi and Hidetoshi Shimokawa\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. All advertising materials mentioning features or use of this software\n *    must display the acknowledgement as bellow:\n *\n *    This product includes software developed by K. Kobayashi and H. Shimokawa\n *\n * 4. The name of the author may not be used to endorse or promote products\n *    derived from this software without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR\n * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\n * DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR\n * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,\n * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n * \n * $FreeBSD: release/9.0.0/sys/dev/firewire/firewirereg.h 171513 2007-07-20 03:42:57Z simokawa $\n *\n */\n\n#ifdef __DragonFly__\ntypedef\td_thread_t fw_proc;\n#include <sys/select.h>\n#elif __FreeBSD_version >= 500000\ntypedef\tstruct thread fw_proc;\n#include <sys/selinfo.h>\n#else\ntypedef\tstruct proc fw_proc;\n#include <sys/select.h>\n#endif\n\n#include <sys/uio.h>\n#include <sys/mutex.h>\n#include <sys/taskqueue.h>\n\n#define\tsplfw splimp\n\nSTAILQ_HEAD(fw_xferlist, fw_xfer);\n\nstruct fw_device{\n\tuint16_t dst;\n\tstruct fw_eui64 eui;\n\tuint8_t speed;\n\tuint8_t maxrec;\n\tuint8_t nport;\n\tuint8_t power;\n#define CSRROMOFF 0x400\n#define CSRROMSIZE 0x400\n\tint rommax;\t/* offset from 0xffff f000 0000 */\n\tuint32_t csrrom[CSRROMSIZE/4];\n\tint rcnt;\n\tstruct firewire_comm *fc;\n\tuint32_t status;\n#define FWDEVINIT\t1\n#define FWDEVATTACHED\t2\n#define FWDEVINVAL\t3\n\tSTAILQ_ENTRY(fw_device) link;\n};\n\nstruct firewire_softc {\n#if defined(__FreeBSD__) && __FreeBSD_version >= 500000\n\tstruct cdev *dev;\n#endif\n\tstruct firewire_comm *fc;\n};\n\n#define FW_MAX_DMACH 0x20\n#define FW_MAX_DEVCH FW_MAX_DMACH\n#define FW_XFERTIMEOUT 1\n\nstruct firewire_dev_comm {\n\tdevice_t dev;\n\tstruct firewire_comm *fc;\n\tvoid (*post_busreset) (void *);\n\tvoid (*post_explore) (void *);\n};\n\nstruct tcode_info {\n\tu_char hdr_len;\t/* IEEE1394 header length */\n\tu_char flag;\n#define FWTI_REQ\t(1 << 0)\n#define FWTI_RES\t(1 << 1)\n#define FWTI_TLABEL\t(1 << 2)\n#define FWTI_BLOCK_STR\t(1 << 3)\n#define FWTI_BLOCK_ASY\t(1 << 4)\n\tu_char valid_res;\n};\n\nstruct firewire_comm{\n\tdevice_t dev;\n\tdevice_t bdev;\n\tuint16_t busid:10,\n\t\t  nodeid:6;\n\tu_int mode;\n\tu_int nport;\n\tu_int speed;\n\tu_int maxrec;\n\tu_int irm;\n\tu_int max_node;\n\tu_int max_hop;\n#define FWPHYASYST (1 << 0)\n\tuint32_t status;\n#define\tFWBUSDETACH\t(-2)\n#define\tFWBUSNOTREADY\t(-1)\n#define\tFWBUSRESET\t0\n#define\tFWBUSINIT\t1\n#define\tFWBUSCYMELECT\t2\n#define\tFWBUSMGRELECT\t3\n#define\tFWBUSMGRDONE\t4\n#define\tFWBUSEXPLORE\t5\n#define\tFWBUSPHYCONF\t6\n#define\tFWBUSEXPDONE\t7\n#define\tFWBUSCOMPLETION\t10\n\tint nisodma;\n\tstruct fw_eui64 eui;\n\tstruct fw_xferq\n\t\t*arq, *atq, *ars, *ats, *it[FW_MAX_DMACH],*ir[FW_MAX_DMACH];\n\tstruct fw_xferlist tlabels[0x40];\n\tu_char last_tlabel[0x40];\n\tstruct mtx tlabel_lock;\n\tSTAILQ_HEAD(, fw_bind) binds;\n\tSTAILQ_HEAD(, fw_device) devices;\n\tu_int  sid_cnt;\n#define CSRSIZE 0x4000\n\tuint32_t csr_arc[CSRSIZE/4];\n#define CROMSIZE 0x400\n\tuint32_t *config_rom;\n\tstruct crom_src_buf *crom_src_buf;\n\tstruct crom_src *crom_src;\n\tstruct crom_chunk *crom_root;\n\tstruct fw_topology_map *topology_map;\n\tstruct fw_speed_map *speed_map;\n\tstruct callout busprobe_callout;\n\tstruct callout bmr_callout;\n\tstruct callout timeout_callout;\n\tstruct task task_timeout;\n\tuint32_t (*cyctimer) (struct  firewire_comm *);\n\tvoid (*ibr) (struct firewire_comm *);\n\tuint32_t (*set_bmr) (struct firewire_comm *, uint32_t);\n\tint (*ioctl) (struct cdev *, u_long, caddr_t, int, fw_proc *);\n\tint (*irx_enable) (struct firewire_comm *, int);\n\tint (*irx_disable) (struct firewire_comm *, int);\n\tint (*itx_enable) (struct firewire_comm *, int);\n\tint (*itx_disable) (struct firewire_comm *, int);\n\tvoid (*timeout) (void *);\n\tvoid (*poll) (struct firewire_comm *, int, int);\n\tvoid (*set_intr) (struct firewire_comm *, int);\n\tvoid (*irx_post) (struct firewire_comm *, uint32_t *);\n\tvoid (*itx_post) (struct firewire_comm *, uint32_t *);\n\tstruct tcode_info *tcode;\n\tbus_dma_tag_t dmat;\n\tstruct mtx mtx;\n\tstruct mtx wait_lock;\n\tstruct taskqueue *taskqueue;\n\tstruct proc *probe_thread;\n};\n#define CSRARC(sc, offset) ((sc)->csr_arc[(offset)/4])\n\n#define FW_GMTX(fc)\t\t(&(fc)->mtx)\n#define FW_GLOCK(fc)\t\tmtx_lock(FW_GMTX(fc))\n#define FW_GUNLOCK(fc)\t\tmtx_unlock(FW_GMTX(fc))\n#define FW_GLOCK_ASSERT(fc)\tmtx_assert(FW_GMTX(fc), MA_OWNED)\n\nstruct fw_xferq {\n\tint flag;\n#define FWXFERQ_CHTAGMASK 0xff\n#define FWXFERQ_RUNNING (1 << 8)\n#define FWXFERQ_STREAM (1 << 9)\n\n#define FWXFERQ_BULK (1 << 11)\n#define FWXFERQ_MODEMASK (7 << 10)\n\n#define FWXFERQ_EXTBUF (1 << 13)\n#define FWXFERQ_OPEN (1 << 14)\n\n#define FWXFERQ_HANDLER (1 << 16)\n#define FWXFERQ_WAKEUP (1 << 17)\n\tvoid (*start) (struct firewire_comm*);\n\tint dmach;\n\tstruct fw_xferlist q;\n\tu_int queued;\n\tu_int maxq;\n\tu_int psize;\n\tstruct fwdma_alloc_multi *buf;\n\tu_int bnchunk;\n\tu_int bnpacket;\n\tstruct fw_bulkxfer *bulkxfer;\n\tSTAILQ_HEAD(, fw_bulkxfer) stvalid;\n\tSTAILQ_HEAD(, fw_bulkxfer) stfree;\n\tSTAILQ_HEAD(, fw_bulkxfer) stdma;\n\tstruct fw_bulkxfer *stproc;\n\tstruct selinfo rsel;\n\tcaddr_t sc;\n\tvoid (*hand) (struct fw_xferq *);\n};\n\nstruct fw_bulkxfer{\n\tint poffset;\n\tstruct mbuf *mbuf;\n\tSTAILQ_ENTRY(fw_bulkxfer) link;\n\tcaddr_t start;\n\tcaddr_t end;\n\tint resp;\n};\n\nstruct fw_bind{\n\tu_int64_t start;\n\tu_int64_t end;\n\tstruct fw_xferlist xferlist;\n\tSTAILQ_ENTRY(fw_bind) fclist;\n\tSTAILQ_ENTRY(fw_bind) chlist;\n\tvoid *sc;\n};\n\nstruct fw_xfer{\n\tcaddr_t sc;\n\tstruct firewire_comm *fc;\n\tstruct fw_xferq *q;\n\tstruct timeval tv;\n\tint8_t resp;\n#define FWXF_INIT\t0x00\n#define FWXF_INQ\t0x01\n#define FWXF_START\t0x02\n#define FWXF_SENT\t0x04\n#define FWXF_SENTERR\t0x08\n#define FWXF_BUSY\t0x10\n#define FWXF_RCVD\t0x20\n\n#define FWXF_WAKE\t0x80\n\tuint8_t flag;\n\tint8_t tl;\n\tvoid (*hand) (struct fw_xfer *);\n\tstruct {\n\t\tstruct fw_pkt hdr;\n\t\tuint32_t *payload;\n\t\tuint16_t pay_len;\n\t\tuint8_t spd;\n\t} send, recv;\n\tstruct mbuf *mbuf;\n\tSTAILQ_ENTRY(fw_xfer) link;\n\tSTAILQ_ENTRY(fw_xfer) tlabel;\n\tstruct malloc_type *malloc;\n};\n\nstruct fw_rcv_buf {\n\tstruct firewire_comm *fc;\n\tstruct fw_xfer *xfer;\n\tstruct iovec *vec;\n\tu_int nvec;\n\tuint8_t spd;\n};\n\nvoid fw_sidrcv (struct firewire_comm *, uint32_t *, u_int);\nvoid fw_rcv (struct fw_rcv_buf *);\nvoid fw_xfer_unload ( struct fw_xfer*);\nvoid fw_xfer_free_buf ( struct fw_xfer*);\nvoid fw_xfer_free ( struct fw_xfer*);\nstruct fw_xfer *fw_xfer_alloc (struct malloc_type *);\nstruct fw_xfer *fw_xfer_alloc_buf (struct malloc_type *, int, int);\nvoid fw_init (struct firewire_comm *);\nint fw_tbuf_update (struct firewire_comm *, int, int);\nint fw_rbuf_update (struct firewire_comm *, int, int);\nint fw_bindadd (struct firewire_comm *, struct fw_bind *);\nint fw_bindremove (struct firewire_comm *, struct fw_bind *);\nint fw_xferlist_add (struct fw_xferlist *, struct malloc_type *, int, int, int,\n    struct firewire_comm *, void *, void (*)(struct fw_xfer *));\nvoid fw_xferlist_remove (struct fw_xferlist *);\nint fw_asyreq (struct firewire_comm *, int, struct fw_xfer*);\nvoid fw_busreset (struct firewire_comm *, uint32_t);\nuint16_t fw_crc16 (uint32_t *, uint32_t);\nvoid fw_xfer_timeout (void *);\nvoid fw_xfer_done (struct fw_xfer *);\nvoid fw_xferwake (struct fw_xfer *);\nint fw_xferwait (struct fw_xfer *);\nvoid fw_asy_callback_free (struct fw_xfer *);\nstruct fw_device *fw_noderesolve_nodeid (struct firewire_comm *, int);\nstruct fw_device *fw_noderesolve_eui64 (struct firewire_comm *, struct fw_eui64 *);\nstruct fw_bind *fw_bindlookup (struct firewire_comm *, uint16_t, uint32_t);\nvoid fw_drain_txq (struct firewire_comm *);\nint fwdev_makedev (struct firewire_softc *);\nint fwdev_destroydev (struct firewire_softc *);\nvoid fwdev_clone (void *, struct ucred *, char *, int, struct cdev **);\nint fw_open_isodma(struct firewire_comm *, int);\n\nextern int firewire_debug;\nextern devclass_t firewire_devclass;\nextern int firewire_phydma_enable;\n\n#ifdef __DragonFly__\n#define\t\tFWPRI\t\tPCATCH\n#else\n#define\t\tFWPRI\t\t((PZERO+8)|PCATCH)\n#endif\n\n#if defined(__DragonFly__) || __FreeBSD_version < 500000\n#define CALLOUT_INIT(x) callout_init(x)\n#else\n#define CALLOUT_INIT(x) callout_init(x, 1 /* mpsafe */)\n#endif\n\n#if defined(__DragonFly__) || __FreeBSD_version < 500000\n/* compatibility shim for 4.X */\n#define bio buf\n#define bio_bcount b_bcount\n#define bio_cmd b_flags\n#define bio_count b_count\n#define bio_data b_data\n#define bio_dev b_dev\n#define bio_error b_error\n#define bio_flags b_flags\n#define bio_offset b_offset\n#define bio_resid b_resid\n#define BIO_ERROR B_ERROR\n#define BIO_READ B_READ\n#define BIO_WRITE B_WRITE\n#define MIN(a,b) (((a)<(b))?(a):(b))\n#define MAX(a,b) (((a)>(b))?(a):(b))\n#endif\n\nMALLOC_DECLARE(M_FW);\nMALLOC_DECLARE(M_FWXFER);\n"
  },
  {
    "path": "freebsd-headers/dev/firewire/fwdma.h",
    "content": "/*-\n * Copyright (C) 2003\n * \tHidetoshi Shimokawa. All rights reserved.\n * \n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. All advertising materials mentioning features or use of this software\n *    must display the following acknowledgement:\n *\n *\tThis product includes software developed by Hidetoshi Shimokawa.\n *\n * 4. Neither the name of the author nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n * \n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n * \n * $FreeBSD: release/9.0.0/sys/dev/firewire/fwdma.h 139749 2005-01-06 01:43:34Z imp $\n */\n\nstruct fwdma_alloc {\n\tbus_dma_tag_t\tdma_tag;\n\tbus_dmamap_t\tdma_map;\n\tvoid *\t\tv_addr;\n\tbus_addr_t\tbus_addr;\n};\n\nstruct fwdma_seg {\n\tbus_dmamap_t\tdma_map;\n\tvoid *\t\tv_addr;\n\tbus_addr_t\tbus_addr;\n};\n\nstruct fwdma_alloc_multi {\n\tbus_size_t\tssize;\n\tbus_size_t\tesize;\n\tint\t\tnseg;\n\tbus_dma_tag_t\tdma_tag;\n\tstruct fwdma_seg seg[0];\n};\n\nstatic __inline void *\nfwdma_v_addr(struct fwdma_alloc_multi *am, int index)\n{\n\tbus_size_t ssize = am->ssize;\n\tint offset = am->esize * index;\n\n\treturn ((caddr_t)am->seg[offset / ssize].v_addr + (offset % ssize));\n}\n\nstatic __inline bus_addr_t\nfwdma_bus_addr(struct fwdma_alloc_multi *am, int index)\n{\n\tbus_size_t ssize = am->ssize;\n\tint offset = am->esize * index;\n\n\treturn (am->seg[offset / ssize].bus_addr + (offset % ssize));\n}\n\nstatic __inline void\nfwdma_sync(struct fwdma_alloc *dma, bus_dmasync_op_t op)  \n{\n\tbus_dmamap_sync(dma->dma_tag, dma->dma_map, op);\n}\n\nstatic __inline void\nfwdma_sync_multiseg(struct fwdma_alloc_multi *am,\n\t\t\tint start, int end, bus_dmasync_op_t op)\n{\n\tstruct fwdma_seg *seg, *eseg;\n\n\tseg = &am->seg[am->esize * start / am->ssize];\n\teseg = &am->seg[am->esize * end / am->ssize];\n\tfor (; seg <= eseg; seg ++)\n\t\tbus_dmamap_sync(am->dma_tag, seg->dma_map, op);\n}\n\nstatic __inline void\nfwdma_sync_multiseg_all(struct fwdma_alloc_multi *am, bus_dmasync_op_t op)\n{\n\tstruct fwdma_seg *seg;\n\tint i;\n\n\tseg = &am->seg[0];\n\tfor (i = 0; i < am->nseg; i++, seg++)\n\t\tbus_dmamap_sync(am->dma_tag, seg->dma_map, op);\n}\n\nvoid *fwdma_malloc(struct firewire_comm *, int, bus_size_t, struct fwdma_alloc *, int);\nvoid fwdma_free(struct firewire_comm *, struct fwdma_alloc *);\nvoid *fwdma_malloc_size(bus_dma_tag_t, bus_dmamap_t *, bus_size_t, bus_addr_t *, int);\nvoid fwdma_free_size(bus_dma_tag_t, bus_dmamap_t, void *, bus_size_t);\nstruct fwdma_alloc_multi *fwdma_malloc_multiseg(struct firewire_comm *,\n\tint, int, int, int);\nvoid fwdma_free_multiseg(struct fwdma_alloc_multi *);\n\n"
  },
  {
    "path": "freebsd-headers/dev/firewire/fwmem.h",
    "content": "/*-\n * Copyright (C) 2002-2003\n * \tHidetoshi Shimokawa. All rights reserved.\n * \n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. All advertising materials mentioning features or use of this software\n *    must display the following acknowledgement:\n *\n *\tThis product includes software developed by Hidetoshi Shimokawa.\n *\n * 4. Neither the name of the author nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n * \n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n * \n * $FreeBSD: release/9.0.0/sys/dev/firewire/fwmem.h 139749 2005-01-06 01:43:34Z imp $\n */\n\nstruct fw_xfer *fwmem_read_quad(struct fw_device *, caddr_t, uint8_t,\n\tuint16_t, uint32_t, void *, void (*)(struct fw_xfer *));\nstruct fw_xfer *fwmem_write_quad(struct fw_device *, caddr_t, uint8_t,\n\tuint16_t, uint32_t, void *, void (*)(struct fw_xfer *));\nstruct fw_xfer *fwmem_read_block(struct fw_device *, caddr_t, uint8_t,\n\tuint16_t, uint32_t, int, void *, void (*)(struct fw_xfer *));\nstruct fw_xfer *fwmem_write_block(struct fw_device *, caddr_t, uint8_t,\n\tuint16_t, uint32_t, int, void *, void (*)(struct fw_xfer *));\n\nd_open_t\tfwmem_open;\nd_close_t\tfwmem_close;\nd_ioctl_t\tfwmem_ioctl;\nd_read_t\tfwmem_read;\nd_write_t\tfwmem_write;\nd_poll_t\tfwmem_poll;\nd_mmap_t\tfwmem_mmap;\nd_strategy_t\tfwmem_strategy;\n"
  },
  {
    "path": "freebsd-headers/dev/firewire/fwohcireg.h",
    "content": "/*-\n * Copyright (c) 2003 Hidetoshi Shimokawa\n * Copyright (c) 1998-2002 Katsushi Kobayashi and Hidetoshi Shimokawa\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. All advertising materials mentioning features or use of this software\n *    must display the acknowledgement as bellow:\n *\n *    This product includes software developed by K. Kobayashi and H. Shimokawa\n *\n * 4. The name of the author may not be used to endorse or promote products\n *    derived from this software without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR\n * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\n * DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR\n * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,\n * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n * \n * $FreeBSD: release/9.0.0/sys/dev/firewire/fwohcireg.h 188508 2009-02-12 03:05:42Z sbruno $\n *\n */\n#define\t\tPCI_CBMEM\t\tPCIR_BAR(0)\n\n#define\t\tFW_VENDORID_NATSEMI\t0x100B\n#define\t\tFW_VENDORID_NEC\t\t0x1033\n#define\t\tFW_VENDORID_SIS\t\t0x1039\n#define\t\tFW_VENDORID_TI\t\t0x104c\n#define\t\tFW_VENDORID_SONY\t0x104d\n#define\t\tFW_VENDORID_VIA\t\t0x1106\n#define\t\tFW_VENDORID_RICOH\t0x1180\n#define\t\tFW_VENDORID_APPLE\t0x106b\n#define\t\tFW_VENDORID_LUCENT\t0x11c1\n#define\t\tFW_VENDORID_INTEL\t0x8086\n#define\t\tFW_VENDORID_ADAPTEC\t0x9004\n#define\t\tFW_VENDORID_SUN\t\t0x108e\n\n#define\t\tFW_DEVICE_CS4210\t(0x000f << 16)\n#define\t\tFW_DEVICE_UPD861\t(0x0063 << 16)\n#define\t\tFW_DEVICE_UPD871\t(0x00ce << 16)\n#define\t\tFW_DEVICE_UPD72870\t(0x00cd << 16)\n#define\t\tFW_DEVICE_UPD72873\t(0x00e7 << 16)\n#define\t\tFW_DEVICE_UPD72874\t(0x00f2 << 16)\n#define\t\tFW_DEVICE_TITSB22\t(0x8009 << 16)\n#define\t\tFW_DEVICE_TITSB23\t(0x8019 << 16)\n#define\t\tFW_DEVICE_TITSB26\t(0x8020 << 16)\n#define\t\tFW_DEVICE_TITSB43\t(0x8021 << 16)\n#define\t\tFW_DEVICE_TITSB43A\t(0x8023 << 16)\n#define\t\tFW_DEVICE_TITSB43AB23\t(0x8024 << 16)\n#define\t\tFW_DEVICE_TITSB82AA2\t(0x8025 << 16)\n#define\t\tFW_DEVICE_TITSB43AB21\t(0x8026 << 16)\n#define\t\tFW_DEVICE_TIPCI4410A\t(0x8017 << 16)\n#define\t\tFW_DEVICE_TIPCI4450\t(0x8011 << 16)\n#define\t\tFW_DEVICE_TIPCI4451\t(0x8027 << 16)\n#define\t\tFW_DEVICE_CXD1947\t(0x8009 << 16)\n#define\t\tFW_DEVICE_CXD3222\t(0x8039 << 16)\n#define\t\tFW_DEVICE_VT6306\t(0x3044 << 16)\n#define\t\tFW_DEVICE_R5C551\t(0x0551 << 16)\n#define\t\tFW_DEVICE_R5C552\t(0x0552 << 16)\n#define\t\tFW_DEVICE_PANGEA\t(0x0030 << 16)\n#define\t\tFW_DEVICE_UNINORTH\t(0x0031 << 16)\n#define\t\tFW_DEVICE_AIC5800\t(0x5800 << 16)\n#define\t\tFW_DEVICE_FW322\t\t(0x5811 << 16)\n#define\t\tFW_DEVICE_7007\t\t(0x7007 << 16)\n#define\t\tFW_DEVICE_82372FB\t(0x7605 << 16)\n#define\t\tFW_DEVICE_PCIO2FW\t(0x1102 << 16)\n\n#define PCI_INTERFACE_OHCI\t0x10\n\n#define FW_OHCI_BASE_REG\t0x10\n\n#define\t\tOHCI_DMA_ITCH\t\t0x20\n#define\t\tOHCI_DMA_IRCH\t\t0x20\n\n#define\t\tOHCI_MAX_DMA_CH\t\t(0x4 + OHCI_DMA_ITCH + OHCI_DMA_IRCH)\n\n\ntypedef uint32_t \tfwohcireg_t;\n\n/* for PCI */\n#if BYTE_ORDER == BIG_ENDIAN\n#define FWOHCI_DMA_WRITE(x, y)\t((x) = htole32(y))\n#define FWOHCI_DMA_READ(x)\tle32toh(x)\n#define FWOHCI_DMA_SET(x, y)\t((x) |= htole32(y))\n#define FWOHCI_DMA_CLEAR(x, y)\t((x) &= htole32(~(y)))\n#else\n#define FWOHCI_DMA_WRITE(x, y)\t((x) = (y))\n#define FWOHCI_DMA_READ(x)\t(x)\n#define FWOHCI_DMA_SET(x, y)\t((x) |= (y))\n#define FWOHCI_DMA_CLEAR(x, y)\t((x) &= ~(y))\n#endif\n\nstruct fwohcidb {\n\tunion {\n\t\tstruct {\n\t\t\tuint32_t cmd;\n\t\t\tuint32_t addr;\n\t\t\tuint32_t depend;\n\t\t\tuint32_t res;\n\t\t} desc;\n\t\tuint32_t immed[4];\n\t} db;\n#define OHCI_STATUS_SHIFT\t16\n#define OHCI_COUNT_MASK\t\t0xffff\n#define OHCI_OUTPUT_MORE\t(0 << 28)\n#define OHCI_OUTPUT_LAST\t(1 << 28)\n#define OHCI_INPUT_MORE\t\t(2 << 28)\n#define OHCI_INPUT_LAST\t\t(3 << 28)\n#define OHCI_STORE_QUAD\t\t(4 << 28)\n#define OHCI_LOAD_QUAD\t\t(5 << 28)\n#define OHCI_NOP\t\t(6 << 28)\n#define OHCI_STOP\t\t(7 << 28)\n#define OHCI_STORE\t\t(8 << 28)\n#define OHCI_CMD_MASK\t\t(0xf << 28)\n\n#define\tOHCI_UPDATE\t\t(1 << 27)\n\n#define OHCI_KEY_ST0\t\t(0 << 24)\n#define OHCI_KEY_ST1\t\t(1 << 24)\n#define OHCI_KEY_ST2\t\t(2 << 24)\n#define OHCI_KEY_ST3\t\t(3 << 24)\n#define OHCI_KEY_REGS\t\t(5 << 24)\n#define OHCI_KEY_SYS\t\t(6 << 24)\n#define OHCI_KEY_DEVICE\t\t(7 << 24)\n#define OHCI_KEY_MASK\t\t(7 << 24)\n\n#define OHCI_INTERRUPT_NEVER\t(0 << 20)\n#define OHCI_INTERRUPT_TRUE\t(1 << 20)\n#define OHCI_INTERRUPT_FALSE\t(2 << 20)\n#define OHCI_INTERRUPT_ALWAYS\t(3 << 20)\n\n#define OHCI_BRANCH_NEVER\t(0 << 18)\n#define OHCI_BRANCH_TRUE\t(1 << 18)\n#define OHCI_BRANCH_FALSE\t(2 << 18)\n#define OHCI_BRANCH_ALWAYS\t(3 << 18)\n#define OHCI_BRANCH_MASK\t(3 << 18)\n\n#define OHCI_WAIT_NEVER\t\t(0 << 16)\n#define OHCI_WAIT_TRUE\t\t(1 << 16)\n#define OHCI_WAIT_FALSE\t\t(2 << 16)\n#define OHCI_WAIT_ALWAYS\t(3 << 16)\n};\n\n#define OHCI_SPD_S100 0x4\n#define OHCI_SPD_S200 0x1\n#define OHCI_SPD_S400 0x2\n\n\n#define FWOHCIEV_NOSTAT 0\n#define FWOHCIEV_LONGP 2\n#define FWOHCIEV_MISSACK 3\n#define FWOHCIEV_UNDRRUN 4\n#define FWOHCIEV_OVRRUN 5\n#define FWOHCIEV_DESCERR 6\n#define FWOHCIEV_DTRDERR 7\n#define FWOHCIEV_DTWRERR 8\n#define FWOHCIEV_BUSRST 9\n#define FWOHCIEV_TIMEOUT 0xa\n#define FWOHCIEV_TCODERR 0xb\n#define FWOHCIEV_UNKNOWN 0xe\n#define FWOHCIEV_FLUSHED 0xf\n#define FWOHCIEV_ACKCOMPL 0x11\n#define FWOHCIEV_ACKPEND 0x12\n#define FWOHCIEV_ACKBSX 0x14\n#define FWOHCIEV_ACKBSA 0x15\n#define FWOHCIEV_ACKBSB 0x16\n#define FWOHCIEV_ACKTARD 0x1b\n#define FWOHCIEV_ACKDERR 0x1d\n#define FWOHCIEV_ACKTERR 0x1e\n\n#define FWOHCIEV_MASK 0x1f\n\nstruct ohci_dma{\n\tfwohcireg_t\tcntl;\n\n#define\tOHCI_CNTL_CYCMATCH_S\t(0x1 << 31)\n\n#define\tOHCI_CNTL_BUFFIL\t(0x1 << 31)\n#define\tOHCI_CNTL_ISOHDR\t(0x1 << 30)\n#define\tOHCI_CNTL_CYCMATCH_R\t(0x1 << 29)\n#define\tOHCI_CNTL_MULTICH\t(0x1 << 28)\n\n#define\tOHCI_CNTL_DMA_RUN\t(0x1 << 15)\n#define\tOHCI_CNTL_DMA_WAKE\t(0x1 << 12)\n#define\tOHCI_CNTL_DMA_DEAD\t(0x1 << 11)\n#define\tOHCI_CNTL_DMA_ACTIVE\t(0x1 << 10)\n#define\tOHCI_CNTL_DMA_BT\t(0x1 << 8)\n#define\tOHCI_CNTL_DMA_BAD\t(0x1 << 7)\n#define\tOHCI_CNTL_DMA_STAT\t(0xff)\n\n\tfwohcireg_t\tcntl_clr;\n\tfwohcireg_t\tdummy0;\n\tfwohcireg_t\tcmd;\n\tfwohcireg_t\tmatch;\n\tfwohcireg_t\tdummy1;\n\tfwohcireg_t\tdummy2;\n\tfwohcireg_t\tdummy3;\n};\n\nstruct ohci_itdma{\n\tfwohcireg_t\tcntl;\n\tfwohcireg_t\tcntl_clr;\n\tfwohcireg_t\tdummy0;\n\tfwohcireg_t\tcmd;\n};\n\nstruct ohci_registers {\n\tfwohcireg_t\tver;\t\t/* Version No. 0x0 */\n\tfwohcireg_t\tguid;\t\t/* GUID_ROM No. 0x4 */\n\tfwohcireg_t\tretry;\t\t/* AT retries 0x8 */\n#define FWOHCI_RETRY\t0x8\n\tfwohcireg_t\tcsr_data;\t/* CSR data   0xc */\n\tfwohcireg_t\tcsr_cmp;\t/* CSR compare 0x10 */\n\tfwohcireg_t\tcsr_cntl;\t/* CSR compare 0x14 */\n\tfwohcireg_t\trom_hdr;\t/* config ROM ptr. 0x18 */\n\tfwohcireg_t\tbus_id;\t\t/* BUS_ID 0x1c */\n\tfwohcireg_t\tbus_opt;\t/* BUS option 0x20 */\n#define\tFWOHCIGUID_H\t0x24\n#define\tFWOHCIGUID_L\t0x28\n\tfwohcireg_t\tguid_hi;\t/* GUID hi 0x24 */\n\tfwohcireg_t\tguid_lo;\t/* GUID lo 0x28 */\n\tfwohcireg_t\tdummy0[2];\t/* dummy 0x2c-0x30 */\n\tfwohcireg_t\tconfig_rom;\t/* config ROM map 0x34 */\n\tfwohcireg_t\tpost_wr_lo;\t/* post write addr lo 0x38 */\n\tfwohcireg_t\tpost_wr_hi;\t/* post write addr hi 0x3c */\n\tfwohcireg_t\tvender;\t\t/* vender ID 0x40 */\n\tfwohcireg_t\tdummy1[3];\t/* dummy 0x44-0x4c */\n\tfwohcireg_t\thcc_cntl_set;\t/* HCC control set 0x50 */\n\tfwohcireg_t\thcc_cntl_clr;\t/* HCC control clr 0x54 */\n#define\tOHCI_HCC_BIBIV\t(1 << 31)\t/* BIBimage Valid */\n#define\tOHCI_HCC_BIGEND\t(1 << 30)\t/* noByteSwapData */\n#define\tOHCI_HCC_PRPHY\t(1 << 23)\t/* programPhyEnable */\n#define\tOHCI_HCC_PHYEN\t(1 << 22)\t/* aPhyEnhanceEnable */\n#define\tOHCI_HCC_LPS\t(1 << 19)\t/* LPS */\n#define\tOHCI_HCC_POSTWR\t(1 << 18)\t/* postedWriteEnable */\n#define\tOHCI_HCC_LINKEN\t(1 << 17)\t/* linkEnable */\n#define\tOHCI_HCC_RESET\t(1 << 16)\t/* softReset */\n\tfwohcireg_t\tdummy2[2];\t/* dummy 0x58-0x5c */\n\tfwohcireg_t\tdummy3[1];\t/* dummy 0x60 */\n\tfwohcireg_t\tsid_buf;\t/* self id buffer 0x64 */\n\tfwohcireg_t\tsid_cnt;\t/* self id count 0x68 */\n\tfwohcireg_t\tdummy4[1];\t/* dummy 0x6c */\n\tfwohcireg_t\tir_mask_hi_set;\t/* ir mask hi set 0x70 */\n\tfwohcireg_t\tir_mask_hi_clr;\t/* ir mask hi set 0x74 */\n\tfwohcireg_t\tir_mask_lo_set;\t/* ir mask hi set 0x78 */\n\tfwohcireg_t\tir_mask_lo_clr;\t/* ir mask hi set 0x7c */\n#define\tFWOHCI_INTSTAT\t\t0x80\n#define\tFWOHCI_INTSTATCLR\t0x84\n#define\tFWOHCI_INTMASK\t\t0x88\n#define\tFWOHCI_INTMASKCLR\t0x8c\n\tfwohcireg_t\tint_stat;   /*       0x80 */\n\tfwohcireg_t\tint_clear;  /*       0x84 */\n\tfwohcireg_t\tint_mask;   /*       0x88 */\n\tfwohcireg_t\tint_mask_clear;   /*       0x8c */\n\tfwohcireg_t\tit_int_stat;   /*       0x90 */\n\tfwohcireg_t\tit_int_clear;  /*       0x94 */\n\tfwohcireg_t\tit_int_mask;   /*       0x98 */\n\tfwohcireg_t\tit_mask_clear;   /*       0x9c */\n\tfwohcireg_t\tir_int_stat;   /*       0xa0 */\n\tfwohcireg_t\tir_int_clear;  /*       0xa4 */\n\tfwohcireg_t\tir_int_mask;   /*       0xa8 */\n\tfwohcireg_t\tir_mask_clear;   /*       0xac */\n\tfwohcireg_t\tdummy5[11];\t/* dummy 0xb0-d8 */\n\tfwohcireg_t\tfairness;   /* fairness control      0xdc */\n\tfwohcireg_t\tlink_cntl;\t\t/* Chip control 0xe0*/\n\tfwohcireg_t\tlink_cntl_clr;\t/* Chip control clear 0xe4*/\n#define FWOHCI_NODEID\t0xe8\n\tfwohcireg_t\tnode;\t\t/* Node ID 0xe8 */\n#define\tOHCI_NODE_VALID\t(1 << 31)\n#define\tOHCI_NODE_ROOT\t(1 << 30)\n\n#define\tOHCI_ASYSRCBUS\t1\n\n\tfwohcireg_t\tphy_access;\t/* PHY cntl 0xec */\n#define\tPHYDEV_RDDONE\t\t(1<<31)\n#define\tPHYDEV_RDCMD\t\t(1<<15)\n#define\tPHYDEV_WRCMD\t\t(1<<14)\n#define\tPHYDEV_REGADDR\t\t8\n#define\tPHYDEV_WRDATA\t\t0\n#define\tPHYDEV_RDADDR\t\t24\n#define\tPHYDEV_RDDATA\t\t16\n\n\tfwohcireg_t\tcycle_timer;\t/* Cycle Timer 0xf0 */\n\tfwohcireg_t\tdummy6[3];\t/* dummy 0xf4-fc */\n\tfwohcireg_t\tareq_hi;\t/* Async req. filter hi 0x100 */\n\tfwohcireg_t\tareq_hi_clr;\t/* Async req. filter hi 0x104 */\n\tfwohcireg_t\tareq_lo;\t/* Async req. filter lo 0x108 */\n\tfwohcireg_t\tareq_lo_clr;\t/* Async req. filter lo 0x10c */\n\tfwohcireg_t\tpreq_hi;\t/* Async req. filter hi 0x110 */\n\tfwohcireg_t\tpreq_hi_clr;\t/* Async req. filter hi 0x114 */\n\tfwohcireg_t\tpreq_lo;\t/* Async req. filter lo 0x118 */\n\tfwohcireg_t\tpreq_lo_clr;\t/* Async req. filter lo 0x11c */\n\n\tfwohcireg_t\tpys_upper;\t/* Physical Upper bound 0x120 */\n\n\tfwohcireg_t\tdummy7[23];\t/* dummy 0x124-0x17c */\n\t\n\t/*       0x180, 0x184, 0x188, 0x18c */\n\t/*       0x190, 0x194, 0x198, 0x19c */\n\t/*       0x1a0, 0x1a4, 0x1a8, 0x1ac */\n\t/*       0x1b0, 0x1b4, 0x1b8, 0x1bc */\n\t/*       0x1c0, 0x1c4, 0x1c8, 0x1cc */\n\t/*       0x1d0, 0x1d4, 0x1d8, 0x1dc */\n\t/*       0x1e0, 0x1e4, 0x1e8, 0x1ec */\n\t/*       0x1f0, 0x1f4, 0x1f8, 0x1fc */\n\tstruct ohci_dma dma_ch[0x4];\n\n\t/*       0x200, 0x204, 0x208, 0x20c */\n\t/*       0x210, 0x204, 0x208, 0x20c */\n\tstruct ohci_itdma dma_itch[0x20];\n\n\t/*       0x400, 0x404, 0x408, 0x40c */\n\t/*       0x410, 0x404, 0x408, 0x40c */\n\tstruct ohci_dma dma_irch[0x20];\n};\n\nstruct fwohcidb_tr{\n\tSTAILQ_ENTRY(fwohcidb_tr) link;\n\tstruct fw_xfer *xfer;\n\tstruct fwohcidb *db;\n\tbus_dmamap_t dma_map;\n\tcaddr_t buf;\n\tbus_addr_t bus_addr;\n\tint dbcnt;\n};\n\n/*\n * OHCI info structure.\n */\nstruct fwohci_txpkthdr{\n\tunion{\n\t\tuint32_t ld[4];\n\t\tstruct {\n#if BYTE_ORDER == BIG_ENDIAN\n\t\t\tuint32_t spd:16, /* XXX include reserved field */\n\t\t\t\t :8,\n\t\t\t\t tcode:4,\n\t\t\t\t :4;\n#else\n\t\t\tuint32_t :4,\n\t\t\t\t tcode:4,\n\t\t\t\t :8,\n\t\t\t\t spd:16; /* XXX include reserved fields */\n#endif\n\t\t}common;\n\t\tstruct {\n#if BYTE_ORDER == BIG_ENDIAN\n\t\t\tuint32_t :8,\n\t\t\t\t srcbus:1,\n\t\t\t\t :4,\n\t\t\t\t spd:3,\n\t\t\t\t tlrt:8,\n\t\t\t\t tcode:4,\n\t\t\t\t :4;\n#else\n\t\t\tuint32_t :4,\n\t\t\t\t tcode:4,\n\t\t\t\t tlrt:8,\n\t\t\t\t spd:3,\n\t\t\t\t :4,\n\t\t\t\t srcbus:1,\n\t\t\t\t :8;\n#endif\n\t\t\tBIT16x2(dst, );\n\t\t}asycomm;\n\t\tstruct {\n#if BYTE_ORDER == BIG_ENDIAN\n\t\t\tuint32_t :13,\n\t\t\t         spd:3,\n\t\t\t\t chtag:8,\n\t\t\t\t tcode:4,\n\t\t\t\t sy:4;\n#else\n\t\t\tuint32_t sy:4,\n\t\t\t\t tcode:4,\n\t\t\t\t chtag:8,\n\t\t\t         spd:3,\n\t\t\t\t :13;\n#endif\n\t\t\tBIT16x2(len, );\n\t\t}stream;\n\t}mode;\n};\nstruct fwohci_trailer{\n#if BYTE_ORDER == BIG_ENDIAN\n\tuint32_t stat:16,\n\t\t  time:16;\n#else\n\tuint32_t time:16,\n\t\t  stat:16;\n#endif\n};\n\n#define\tOHCI_CNTL_CYCSRC\t(0x1 << 22)\n#define\tOHCI_CNTL_CYCMTR\t(0x1 << 21)\n#define\tOHCI_CNTL_CYCTIMER\t(0x1 << 20)\n#define\tOHCI_CNTL_PHYPKT\t(0x1 << 10)\n#define\tOHCI_CNTL_SID\t\t(0x1 << 9)\n\n/*\n * defined in OHCI 1.1 \n * chapter 6.1\n */\n#define OHCI_INT_DMA_ATRQ\t(0x1 << 0)\n#define OHCI_INT_DMA_ATRS\t(0x1 << 1)\n#define OHCI_INT_DMA_ARRQ\t(0x1 << 2)\n#define OHCI_INT_DMA_ARRS\t(0x1 << 3)\n#define OHCI_INT_DMA_PRRQ\t(0x1 << 4)\n#define OHCI_INT_DMA_PRRS\t(0x1 << 5)\n#define OHCI_INT_DMA_IT \t(0x1 << 6)\n#define OHCI_INT_DMA_IR \t(0x1 << 7)\n#define OHCI_INT_PW_ERR \t(0x1 << 8)\n#define OHCI_INT_LR_ERR \t(0x1 << 9)\n#define OHCI_INT_PHY_SID\t(0x1 << 16)\n#define OHCI_INT_PHY_BUS_R\t(0x1 << 17)\n#define OHCI_INT_REG_FAIL\t(0x1 << 18)\n#define OHCI_INT_PHY_INT\t(0x1 << 19)\n#define OHCI_INT_CYC_START\t(0x1 << 20)\n#define OHCI_INT_CYC_64SECOND\t(0x1 << 21)\n#define OHCI_INT_CYC_LOST\t(0x1 << 22)\n#define OHCI_INT_CYC_ERR\t(0x1 << 23)\n#define OHCI_INT_ERR\t\t(0x1 << 24)\n#define OHCI_INT_CYC_LONG\t(0x1 << 25)\n#define OHCI_INT_PHY_REG\t(0x1 << 26)\n#define OHCI_INT_EN\t\t(0x1 << 31)\n\n#define IP_CHANNELS             0x0234\n#define FWOHCI_MAXREC\t\t2048\n\n#define\tOHCI_ISORA\t\t0x02\n#define\tOHCI_ISORB\t\t0x04\n\n#define FWOHCITCODE_PHY\t\t0xe\n"
  },
  {
    "path": "freebsd-headers/dev/firewire/fwohcivar.h",
    "content": "/*-\n * Copyright (c) 2003 Hidetoshi SHimokawa\n * Copyright (c) 1998-2002 Katsushi Kobayashi and Hidetoshi SHimokawa\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. All advertising materials mentioning features or use of this software\n *    must display the acknowledgement as bellow:\n *\n *    This product includes software developed by K. Kobayashi and H. Shimokawa\n *\n * 4. The name of the author may not be used to endorse or promote products\n *    derived from this software without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR\n * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\n * DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR\n * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,\n * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n * \n * $FreeBSD: release/9.0.0/sys/dev/firewire/fwohcivar.h 188079 2009-02-03 17:13:37Z sbruno $\n *\n */\n\n#include <sys/taskqueue.h>\n\ntypedef struct fwohci_softc {\n\tstruct firewire_comm fc;\n\tbus_space_tag_t bst;\n\tbus_space_handle_t bsh;\n\tvoid *ih;\n#if defined(__DragonFly__) || __FreeBSD_version < 500000\n\tvoid *ih_cam;\n\tvoid *ih_bio;\n#endif\n\tstruct resource *bsr;\n\tstruct resource *irq_res;\n\tstruct fwohci_dbch{\n\t\tu_int ndb;\n\t\tu_int ndesc;\n\t\tSTAILQ_HEAD(, fwohcidb_tr) db_trq;\n\t\tstruct fwohcidb_tr *top, *bottom, *pdb_tr;\n\t\tstruct fw_xferq xferq;\n\t\tint flags;\n#define\tFWOHCI_DBCH_INIT\t(1<<0)\n#define\tFWOHCI_DBCH_FULL\t(1<<1)\n\t\t/* used only in receive context */\n\t\tint buf_offset;\t/* signed */\n#define FWOHCI_DBCH_MAX_PAGES\t32\n\t\t/* Context programs buffer */\n\t\tstruct fwdma_alloc_multi *am;\n\t\tbus_dma_tag_t dmat;\n\t} arrq, arrs, atrq, atrs, it[OHCI_DMA_ITCH], ir[OHCI_DMA_IRCH];\n\tu_int maxrec;\n\tuint32_t *sid_buf;\n\tstruct fwdma_alloc sid_dma;\n\tstruct fwdma_alloc crom_dma;\n\tstruct fwdma_alloc dummy_dma;\n\tuint32_t intmask, irstat, itstat;\n\tuint32_t intstat;\n\tstruct task fwohci_task_busreset;\n\tstruct task fwohci_task_sid;\n\tstruct task fwohci_task_dma;\n\tint cycle_lost;\n} fwohci_softc_t;\n\nvoid fwohci_intr (void *arg);\nint fwohci_init (struct fwohci_softc *, device_t);\nvoid fwohci_poll (struct firewire_comm *, int, int);\nvoid fwohci_reset (struct fwohci_softc *, device_t);\nint fwohci_detach (struct fwohci_softc *, device_t);\nint fwohci_resume (struct fwohci_softc *, device_t);\nint fwohci_stop (struct fwohci_softc *, device_t dev);\n"
  },
  {
    "path": "freebsd-headers/dev/firewire/fwphyreg.h",
    "content": "/*-\n * Copyright (C) 2003\n * \tHidetoshi Shimokawa. All rights reserved.\n * \n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. All advertising materials mentioning features or use of this software\n *    must display the following acknowledgement:\n *\n *\tThis product includes software developed by Hidetoshi Shimokawa.\n *\n * 4. Neither the name of the author nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n * \n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n * \n * $FreeBSD: release/9.0.0/sys/dev/firewire/fwphyreg.h 188508 2009-02-12 03:05:42Z sbruno $\n */\n\n/*\n * IEEE 1394a\n * Figure 5B - 1\n */\nstruct phyreg_base {\n#if BYTE_ORDER == BIG_ENDIAN\n\tuint8_t\tphy_id:6,\n\t\tr:1,\n\t\tcps:1;\n\tuint8_t\trhb:1,\n\t\tibr:1,\n\t\tgap_count:6;\n\tuint8_t\textended:3,\n\t\tnum_ports:5;\n\tuint8_t\tphy_speed:3,\n\t\t:1,\n\t\tdelay:4;\n\tuint8_t\tlctrl:1,\n\t\tc:1,\n\t\tjitter:3,\n\t\tpwr_class:3;\n\tuint8_t\twdie:1,\n\t\tisbr:1,\n\t\tctoi:1,\n\t\tcpsi:1,\n\t\tstoi:1,\n\t\tpei:1,\n\t\teaa:1,\n\t\temc:1;\n\tuint8_t\tlegacy_spd:3,\n\t\tblink:1,\n\t\tbridge:2,\n\t\t:2;\n\tuint8_t\tpage_select:3,\n\t\t:1,\n\t\tport_select:4;\n#else\n\tuint8_t\tcps:1,\n\t\tr:1,\n\t\tphy_id:6;\n\tuint8_t\tgap_count:6,\n\t\tibr:1,\n\t\trhb:1;\n\tuint8_t\tnum_ports:5,\n\t\textended:3;\n\tuint8_t\tdelay:4,\n\t\t:1,\n\t\tphy_speed:3;\n\tuint8_t\tpwr_class:3,\n\t\tjitter:3,\n\t\tc:1,\n\t\tlctrl:1;\n\tuint8_t\temc:1,\n\t\teaa:1,\n\t\tpei:1,\n\t\tstoi:1,\n\t\tcpsi:1,\n\t\tctoi:1,\n\t\tisbr:1,\n\t\twdie:1;\n\tuint8_t\t:2,\n\t\tbridge:2,\n\t\tblink:1,\n\t\tlegacy_spd:3;\n\tuint8_t\tport_select:4,\n\t\t:1,\n\t\tpage_select:3;\n#endif\n};\n\n/*\n * IEEE 1394a\n * Figure 5B - 2\n */\nstruct phyreg_page0 {\n#if BYTE_ORDER == BIG_ENDIAN\n\tuint8_t\tastat:2,\n\t\tbstat:2,\n\t\tch:1,\n\t\tcon:1,\n\t\trxok:1,\n\t\tdis:1;\n\tuint8_t\tnegotiated_speed:3,\n\t\tpie:1,\n\t\tfault:1,\n\t\tstanby_fault:1,\n\t\tdisscrm:1,\n\t\tb_only:1;\n\tuint8_t\tdc_connected:1,\n\t\tmax_port_speed:3,\n\t\tlpp:1,\n\t\tcable_speed:3;\n\tuint8_t\tconnection_unreliable:1,\n\t\t:3,\n\t\tbeta_mode:1,\n\t\t:3;\n\tuint8_t\tport_error;\n\tuint8_t\t:5,\n\t\tloop_disable:1,\n\t\tin_standby:1,\n\t\thard_disable:1;\n\tuint8_t\t:8;\n\tuint8_t\t:8;\n#else\n\tuint8_t\tdis:1,\n\t\trxok:1,\n\t\tcon:1,\n\t\tch:1,\n\t\tbstat:2,\n\t\tastat:2;\n\tuint8_t\tb_only:1,\n\t\tdisscrm:1,\n\t\tstanby_fault:1,\n\t\tfault:1,\n\t\tpie:1,\n\t\tnegotiated_speed:3;\n\tuint8_t\tcable_speed:3,\n\t\tlpp:1,\n\t\tmax_port_speed:3,\n\t\tdc_connected:1;\n\tuint8_t\t:3,\n\t\tbeta_mode:1,\n\t\t:3,\n\t\tconnection_unreliable:1;\n\tuint8_t\tport_error;\n\tuint8_t\thard_disable:1,\n\t\tin_standby:1,\n\t\tloop_disable:1,\n\t\t:5;\n\tuint8_t\t:8;\n\tuint8_t\t:8;\n#endif\n};\n\n/* \n * IEEE 1394a\n * Figure 5B - 3\n */\nstruct phyreg_page1 {\n\tuint8_t\tcompliance;\n\tuint8_t\t:8;\n\tuint8_t\tvendor_id[3];\n\tuint8_t\tproduct_id[3];\n};\n"
  },
  {
    "path": "freebsd-headers/dev/firewire/iec13213.h",
    "content": "/*-\n * Copyright (c) 2003 Hidetoshi Shimokawa\n * Copyright (c) 1998-2002 Katsushi Kobayashi and Hidetoshi Shimokawa\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. All advertising materials mentioning features or use of this software\n *    must display the acknowledgement as bellow:\n *\n *    This product includes software developed by K. Kobayashi and H. Shimokawa\n *\n * 4. The name of the author may not be used to endorse or promote products\n *    derived from this software without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR\n * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\n * DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR\n * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,\n * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n * \n * $FreeBSD: release/9.0.0/sys/dev/firewire/iec13213.h 139749 2005-01-06 01:43:34Z imp $\n *\n */\n\n#define\tSTATE_CLEAR\t0x0000\n#define\tSTATE_SET\t0x0004\n#define\tNODE_IDS\t0x0008\n#define\tRESET_START\t0x000c\n#define\tSPLIT_TIMEOUT_HI\t0x0018\n#define\tSPLIT_TIMEOUT_LO\t0x001c\n#define\tCYCLE_TIME\t0x0200\n#define\tBUS_TIME\t0x0204\n#define\tBUSY_TIMEOUT\t0x0210\n#define\tPRIORITY_BUDGET 0x0218\n#define\tBUS_MGR_ID\t0x021c\n#define\tBANDWIDTH_AV\t0x0220\n#define\tCHANNELS_AV_HI\t0x0224\n#define\tCHANNELS_AV_LO\t0x0228\n#define\tIP_CHANNELS\t0x0234\n\n#define\tCONF_ROM\t0x0400\n\n#define\tTOPO_MAP\t0x1000\n#define\tSPED_MAP\t0x2000\n\n#define CSRTYPE_SHIFT\t6\n#define CSRTYPE_MASK\t(3 << CSRTYPE_SHIFT)\n#define CSRTYPE_I\t(0 << CSRTYPE_SHIFT) /* Immediate */\n#define CSRTYPE_C\t(1 << CSRTYPE_SHIFT) /* CSR offset */\n#define CSRTYPE_L\t(2 << CSRTYPE_SHIFT) /* Leaf */\n#define CSRTYPE_D\t(3 << CSRTYPE_SHIFT) /* Directory */\n\n/*\n * CSR keys\n * 00 - 2F: defined by CSR architecture standards.\n * 30 - 37: defined by BUS starndards\n * 38 - 3F: defined by Vendor/Specifier\n */\n#define CSRKEY_MASK\t0x3f\n#define CSRKEY_DESC\t0x01 /* Descriptor */\n#define CSRKEY_BDINFO\t0x02 /* Bus_Dependent_Info */\n#define CSRKEY_VENDOR\t0x03 /* Vendor */\n#define CSRKEY_HW\t0x04 /* Hardware_Version */\n#define CSRKEY_MODULE\t0x07 /* Module */\n#define CSRKEY_NCAP\t0x0c /* Node_Capabilities */\n#define CSRKEY_EUI64\t0x0d /* EUI_64 */\n#define CSRKEY_UNIT\t0x11 /* Unit */\n#define CSRKEY_SPEC\t0x12 /* Specifier_ID */\n#define CSRKEY_VER\t0x13 /* Version */\n#define CSRKEY_DINFO\t0x14 /* Dependent_Info */\n#define CSRKEY_ULOC\t0x15 /* Unit_Location */\n#define CSRKEY_MODEL\t0x17 /* Model */\n#define CSRKEY_INST\t0x18 /* Instance */\n#define CSRKEY_KEYW\t0x19 /* Keyword */\n#define CSRKEY_FEAT\t0x1a /* Feature */\n#define CSRKEY_EROM\t0x1b /* Extended_ROM */\n#define CSRKEY_EKSID\t0x1c /* Extended_Key_Specifier_ID */\n#define CSRKEY_EKEY\t0x1d /* Extended_Key */\n#define CSRKEY_EDATA\t0x1e /* Extended_Data */\n#define CSRKEY_MDESC\t0x1f /* Modifiable_Descriptor */\n#define CSRKEY_DID\t0x20 /* Directory_ID */\n#define CSRKEY_REV\t0x21 /* Revision */\n\n#define CSRKEY_FIRM_VER\t0x3c /* Firmware version */\n#define CSRKEY_UNIT_CH\t0x3a /* Unit characteristics */\n#define CSRKEY_COM_SPEC\t0x38 /* Command set revision */\n#define CSRKEY_COM_SET\t0x39 /* Command set */\n\n#define CROM_UDIR\t(CSRTYPE_D | CSRKEY_UNIT)  /* 0x81 Unit directory */\n#define CROM_TEXTLEAF\t(CSRTYPE_L | CSRKEY_DESC)  /* 0x81 Text leaf */\n#define CROM_LUN\t(CSRTYPE_I | CSRKEY_DINFO) /* 0x14 Logical unit num. */\n#define CROM_MGM\t(CSRTYPE_C | CSRKEY_DINFO) /* 0x54 Management agent */\n\n#define CSRVAL_VENDOR_PRIVATE\t0xacde48\n#define CSRVAL_1394TA\t0x00a02d\n#define CSRVAL_ANSIT10\t0x00609e\n#define CSRVAL_IETF\t0x00005e\n\n#define CSR_PROTAVC\t0x010001\n#define CSR_PROTCAL\t0x010002\n#define CSR_PROTEHS\t0x010004\n#define CSR_PROTHAVI\t0x010008\n#define CSR_PROTCAM104\t0x000100\n#define CSR_PROTCAM120\t0x000101\n#define CSR_PROTCAM130\t0x000102\n#define CSR_PROTDPP\t0x0a6be2\n#define CSR_PROTIICP\t0x4b661f\n\n#define CSRVAL_T10SBP2\t0x010483\n#define CSRVAL_SCSI\t0x0104d8\n\nstruct csrreg {\n#if BYTE_ORDER == BIG_ENDIAN\n\tuint32_t key:8,\n\t\t val:24;\n#else\n\tuint32_t val:24,\n\t\t key:8;\n#endif\n};\nstruct csrhdr {\n#if BYTE_ORDER == BIG_ENDIAN\n\tuint32_t info_len:8,\n\t\t crc_len:8,\n\t\t crc:16;\n#else\n\tuint32_t crc:16,\n\t\t crc_len:8,\n\t\t info_len:8;\n#endif\n};\nstruct csrdirectory {\n\tBIT16x2(crc_len, crc);\n\tstruct csrreg entry[0];\n};\nstruct csrtext {\n\tBIT16x2(crc_len, crc);\n#if BYTE_ORDER == BIG_ENDIAN\n\tuint32_t spec_type:8,\n\t\t spec_id:24;\n#else\n\tuint32_t spec_id:24,\n\t\t spec_type:8;\n#endif\n\tuint32_t lang_id;\n\tuint32_t text[0];\n};\n\nstruct bus_info {\n#define\tCSR_BUS_NAME_IEEE1394\t0x31333934\n\tuint32_t bus_name;\t\n#if BYTE_ORDER == BIG_ENDIAN\n\tuint32_t irmc:1,\t\t/* iso. resource manager capable */\n\t\t cmc:1,\t\t\t/* cycle master capable */\n\t\t isc:1,\t\t\t/* iso. operation support */\n\t\t bmc:1,\t\t\t/* bus manager capable */\n\t\t pmc:1,\t\t\t/* power manager capable */\n\t\t :3,\n\t\t cyc_clk_acc:8,\t\t/* 0 <= ppm <= 100 */\n\t\t max_rec:4,\t\t/* (2 << max_rec) bytes */\n\t\t :2,\n\t\t max_rom:2,\n\t\t generation:4,\n\t\t :1,\n\t\t link_spd:3;\n#else\n\tuint32_t link_spd:3,\n\t\t :1,\n\t\t generation:4,\n\t\t max_rom:2,\n\t\t :2,\n\t\t max_rec:4,\t\t/* (2 << max_rec) bytes */\n\t\t cyc_clk_acc:8,\t\t/* 0 <= ppm <= 100 */\n\t\t :3,\n\t\t pmc:1,\t\t\t/* power manager capable */\n\t\t bmc:1,\t\t\t/* bus manager capable */\n\t\t isc:1,\t\t\t/* iso. operation support */\n\t\t cmc:1,\t\t\t/* cycle master capable */\n\t\t irmc:1;\t\t/* iso. resource manager capable */\n#endif\n\tstruct fw_eui64 eui64;\n};\n/* max_rom */\n#define MAXROM_4\t0\n#define MAXROM_64\t1\n#define MAXROM_1024\t2\n\n#define CROM_MAX_DEPTH\t10\nstruct crom_ptr {\n\tstruct csrdirectory *dir;\n\tint index;\n};\n\nstruct crom_context {\n\tint depth;\n\tstruct crom_ptr stack[CROM_MAX_DEPTH];\n};\n\nvoid crom_init_context(struct crom_context *, uint32_t *);\nstruct csrreg *crom_get(struct crom_context *);\nvoid crom_next(struct crom_context *);\nvoid crom_parse_text(struct crom_context *, char *, int);\nuint16_t crom_crc(uint32_t *r, int);\nstruct csrreg *crom_search_key(struct crom_context *, uint8_t);\nint crom_has_specver(uint32_t *, uint32_t, uint32_t);\n\n#if !defined(_KERNEL) && !defined(_BOOT)\nchar *crom_desc(struct crom_context *, char *, int);\n#endif\n\n/* For CROM build */\n#if defined(_KERNEL) || defined(_BOOT) || defined(TEST)\n#define CROM_MAX_CHUNK_LEN 20\nstruct crom_src {\n\tstruct csrhdr hdr;\n\tstruct bus_info businfo;\n\tSTAILQ_HEAD(, crom_chunk) chunk_list;\n};\n\nstruct crom_chunk {\n\tSTAILQ_ENTRY(crom_chunk) link;\n\tstruct crom_chunk *ref_chunk; \n\tint ref_index; \n\tint offset;\n\tstruct {\n\t\tBIT16x2(crc_len, crc);\n\t\tuint32_t buf[CROM_MAX_CHUNK_LEN]; \n\t} data;\n};\n\nextern int crom_add_quad(struct crom_chunk *, uint32_t);\nextern int crom_add_entry(struct crom_chunk *, int, int);\nextern int crom_add_chunk(struct crom_src *src, struct crom_chunk *,\n\t\t\t\t\tstruct crom_chunk *, int);\nextern int crom_add_simple_text(struct crom_src *src, struct crom_chunk *,\n\t\t\t\t\tstruct crom_chunk *, char *);\nextern int crom_load(struct crom_src *, uint32_t *, int);\n#endif\n"
  },
  {
    "path": "freebsd-headers/dev/firewire/iec68113.h",
    "content": "/*-\n * Copyright (c) 2003 Hidetoshi Shimokawa\n * Copyright (c) 1998-2002 Katsushi Kobayashi and Hidetoshi Shimokawa\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. All advertising materials mentioning features or use of this software\n *    must display the acknowledgement as bellow:\n *\n *    This product includes software developed by K. Kobayashi and H. Shimokawa\n *\n * 4. The name of the author may not be used to endorse or promote products\n *    derived from this software without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR\n * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\n * DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR\n * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,\n * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n * \n * $FreeBSD: release/9.0.0/sys/dev/firewire/iec68113.h 139749 2005-01-06 01:43:34Z imp $\n *\n */\n\n#define\t\tDV_BROADCAST_ON (1<<30)\n#define\t\toMPR\t\t0x900\n#define\t\toPCR\t\t0x904\n#define\t\tiMPR\t\t0x980\n#define\t\tiPCR\t\t0x984\n\nstruct ciphdr {\n#if BYTE_ORDER == BIG_ENDIAN\n\tuint8_t eoh0:1,\t\t/* 0 */\n\t\tform0:1,\t/* 0 */\n\t\tsrc:6;\n#else\n\tuint8_t src:6,\n\t\tform0:1,\t/* 0 */\n\t\teoh0:1;\t\t/* 0 */\n#endif\n\tuint8_t len;\n#if BYTE_ORDER == BIG_ENDIAN\n\tuint8_t fn:2,\n\t\tqpc:3,\n\t\tsph:1,\n\t\t:2;\n#else\n\tuint8_t :2,\n\t\tsph:1,\n\t\tqpc:3,\n\t\tfn:2;\n#endif\n\tuint8_t dbc;\n#if BYTE_ORDER == BIG_ENDIAN\n\tuint8_t eoh1:1,\t\t/* 1 */\n\t\tform1:1,\t/* 0 */\n\t\tfmt:6;\n#else\n\tuint8_t fmt:6,\n\t\tform1:1,\t/* 0 */\n\t\teoh1:1;\t\t/* 1 */\n#endif\n#define CIP_FMT_DVCR\t0\n#define CIP_FMT_MPEG\t(1<<5)\n\tunion {\n\t\tstruct {\n#if BYTE_ORDER == BIG_ENDIAN\n\t\t\tuint8_t fs:1,\t\t/* 50/60 field system\n\t\t\t\t\t\t\t\tNTSC/PAL */\n\t\t\t\tstype:5,\n\t\t\t\t:2;\n#else\n\t\t\tuint8_t :2,\n\t\t\t\tstype:5,\n\t\t  \t\tfs:1;\t\t/* 50/60 field system\n\t\t\t\t\t\t\t\tNTSC/PAL */\n#endif\n#define\tCIP_STYPE_SD\t0\n#define\tCIP_STYPE_SDL\t1\n#define\tCIP_STYPE_HD\t2\n\t  \t\tuint16_t cyc:16;\t/* take care of byte order! */\n\t\t} __attribute__ ((packed)) dv;\n\t\tuint8_t bytes[3];\n\t} fdf;\n\n};\nstruct dvdbc{\n#if BYTE_ORDER == BIG_ENDIAN\n\tuint8_t sct:3,\t\t/* Section type */\n\t\t:1,\t\t/* Reserved */\n\t\tarb:4;\t\t/* Arbitrary bit */\n#else\n\tuint8_t arb:4,\t\t/* Arbitrary bit */\n\t\t:1,\t\t/* Reserved */\n\t\tsct:3;\t\t/* Section type */\n#endif\n#define\tDV_SCT_HEADER\t0\n#define\tDV_SCT_SUBCODE\t1\n#define\tDV_SCT_VAUX\t2\n#define\tDV_SCT_AUDIO\t3\n#define\tDV_SCT_VIDEO\t4\n#if BYTE_ORDER == BIG_ENDIAN\n\tuint8_t dseq:4,\t\t/* DIF sequence number */\n\t\tfsc:1,\t\t/* ID of a DIF block in each channel */\n\t\t:3;\n#else\n\tuint8_t :3,\n\t\tfsc:1,\t\t/* ID of a DIF block in each channel */\n\t\tdseq:4;\t\t/* DIF sequence number */\n#endif\n\tuint8_t dbn;\t\t/* DIF block number */\n\tuint8_t payload[77];\n#define\tDV_DSF_12\t0x80\t/* PAL: payload[0] in Header DIF */\n};\n"
  },
  {
    "path": "freebsd-headers/dev/firewire/if_fwevar.h",
    "content": "/*-\n * Copyright (c) 2002-2003\n * \tHidetoshi Shimokawa. All rights reserved.\n * \n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. All advertising materials mentioning features or use of this software\n *    must display the following acknowledgement:\n *\n *\tThis product includes software developed by Hidetoshi Shimokawa.\n *\n * 4. Neither the name of the author nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n * \n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n * \n * $FreeBSD: release/9.0.0/sys/dev/firewire/if_fwevar.h 170374 2007-06-06 14:31:36Z simokawa $\n */\n\n#ifndef _NET_IF_FWEVAR_H_\n#define _NET_IF_FWEVAR_H_\n\nstruct fwe_softc {\n\t/* XXX this must be the first for fd.post_explore() */\n\tstruct firewire_dev_comm fd;\n\tshort stream_ch;\n\tshort dma_ch;\n\tstruct fw_pkt pkt_hdr;\n\tSTAILQ_HEAD(, fw_xfer) xferlist;\n\tstruct fwe_eth_softc {\n\t\tstruct ifnet *ifp;\n\t\tstruct fwe_softc *fwe;\n\t} eth_softc;\n\tstruct mtx mtx;\n};\n#define FWE_LOCK(fwe)\tmtx_lock(&(fwe)->mtx)\n#define FWE_UNLOCK(fwe)\tmtx_unlock(&(fwe)->mtx)\n#endif /* !_NET_IF_FWEVAR_H_ */\n"
  },
  {
    "path": "freebsd-headers/dev/firewire/if_fwipvar.h",
    "content": "/*-\n * Copyright (c) 2004\n *\tDoug Rabson\n * Copyright (c) 2002-2003\n * \tHidetoshi Shimokawa. All rights reserved.\n * \n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. All advertising materials mentioning features or use of this software\n *    must display the following acknowledgement:\n *\n *\tThis product includes software developed by Hidetoshi Shimokawa.\n *\n * 4. Neither the name of the author nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n * \n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n * \n * $FreeBSD: release/9.0.0/sys/dev/firewire/if_fwipvar.h 170374 2007-06-06 14:31:36Z simokawa $\n */\n\n#ifndef _NET_IF_FWIPVAR_H_\n#define _NET_IF_FWIPVAR_H_\n\nstruct fwip_softc {\n\t/* XXX this must be first for fd.post_explore() */\n\tstruct firewire_dev_comm fd;\n\tshort dma_ch;\n\tstruct fw_bind fwb;\n\tstruct fw_eui64 last_dest;\n\tstruct fw_pkt last_hdr;\n\tstruct task start_send;\n\tSTAILQ_HEAD(, fw_xfer) xferlist;\n\tstruct crom_chunk unit4;\t/* unit directory for IPv4 */\n\tstruct crom_chunk spec4;\t/* specifier description IPv4 */\n\tstruct crom_chunk ver4;\t\t/* version description IPv4 */\n\tstruct crom_chunk unit6;\t/* unit directory for IPv6 */\n\tstruct crom_chunk spec6;\t/* specifier description IPv6 */\n\tstruct crom_chunk ver6;\t\t/* version description IPv6 */\n\tstruct fwip_eth_softc {\n\t\tstruct ifnet *fwip_ifp;\n\t\tstruct fwip_softc *fwip;\n\t} fw_softc;\n\tstruct mtx mtx;\n};\n#define FWIP_LOCK(fwip)   mtx_lock(&(fwip)->mtx)\n#define FWIP_UNLOCK(fwip) mtx_unlock(&(fwip)->mtx)\n#endif /* !_NET_IF_FWIPVAR_H_ */\n"
  },
  {
    "path": "freebsd-headers/dev/firewire/sbp.h",
    "content": "/*-\n * Copyright (c) 2003 Hidetoshi Shimokawa\n * Copyright (c) 1998-2002 Katsushi Kobayashi and Hidetoshi Shimokawa\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. All advertising materials mentioning features or use of this software\n *    must display the acknowledgement as bellow:\n *\n *    This product includes software developed by K. Kobayashi and H. Shimokawa\n *\n * 4. The name of the author may not be used to endorse or promote products\n *    derived from this software without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR\n * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\n * DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR\n * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,\n * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n * \n * $FreeBSD: release/9.0.0/sys/dev/firewire/sbp.h 190792 2009-04-07 02:33:46Z sbruno $\n *\n */\n\n#define ORB_NOTIFY\t(1 << 31)\n#define\tORB_FMT_STD\t(0 << 29)\n#define\tORB_FMT_VED\t(2 << 29)\n#define\tORB_FMT_NOP\t(3 << 29)\n#define\tORB_FMT_MSK\t(3 << 29)\n#define\tORB_EXV\t\t(1 << 28)\n/* */\n#define\tORB_CMD_IN\t(1 << 27)\n/* */\n#define\tORB_CMD_SPD(x)\t((x) << 24)\n#define\tORB_CMD_MAXP(x)\t((x) << 20)\n#define\tORB_RCN_TMO(x)\t((x) << 20)\n#define\tORB_CMD_PTBL\t(1 << 19)\n#define\tORB_CMD_PSZ(x)\t((x) << 16)\n\n#define\tORB_FUN_LGI\t(0 << 16)\n#define\tORB_FUN_QLG\t(1 << 16)\n#define\tORB_FUN_RCN\t(3 << 16)\n#define\tORB_FUN_LGO\t(7 << 16)\n#define\tORB_FUN_ATA\t(0xb << 16)\n#define\tORB_FUN_ATS\t(0xc << 16)\n#define\tORB_FUN_LUR\t(0xe << 16)\n#define\tORB_FUN_RST\t(0xf << 16)\n#define\tORB_FUN_MSK\t(0xf << 16)\n#define\tORB_FUN_RUNQUEUE 0xffff\n\n#define ORB_RES_CMPL 0\n#define ORB_RES_FAIL 1\n#define ORB_RES_ILLE 2\n#define ORB_RES_VEND 3\n\n#define SBP_DEBUG(x)\tif (debug > x) {\n#define END_DEBUG\t}\n\nstruct ind_ptr {\n\tuint32_t hi,lo;\n};\n\n\n#define SBP_RECV_LEN 32\n\nstruct sbp_login_res{\n\tuint16_t\tlen;\n\tuint16_t\tid;\n\tuint16_t\tres0;\n\tuint16_t\tcmd_hi;\n\tuint32_t\tcmd_lo;\n\tuint16_t\tres1;\n\tuint16_t\trecon_hold;\n};\n\nstruct sbp_status{\n#if BYTE_ORDER == BIG_ENDIAN\n\tuint8_t\t\tsrc:2,\n\t\t\tresp:2,\n\t\t\tdead:1,\n\t\t\tlen:3;\n#else\n\tuint8_t\t\tlen:3,\n\t\t\tdead:1,\n\t\t\tresp:2,\n\t\t\tsrc:2;\n#endif\n\tuint8_t\t\tstatus;\n\tuint16_t\torb_hi;\n\tuint32_t\torb_lo;\n\tuint32_t\tdata[6];\n};\n/* src */\n#define SRC_NEXT_EXISTS\t0\n#define SRC_NO_NEXT\t1\n#define SRC_UNSOL\t2\n\n/* resp */\n#define SBP_REQ_CMP\t0\t/* request complete */\n#define SBP_TRANS_FAIL\t1\t/* transport failure */\n#define SBP_ILLE_REQ\t2\t/* illegal request */\n#define SBP_VEND_DEP\t3\t/* vendor dependent */\n\n/* status (resp == 0) */\n/*   0: No additional Information to report */\n/*   1: Request Type not supported */\n/*   2: Speed not supported */\n/*   3: Page size not supported */\n/*   4: Access denied */\n#define STATUS_ACCESS_DENY\t4\n#define STATUS_LUR\t\t5\n/*   6: Maximum payload too small */\n/*   7: Reserved for future standardization */\n/*   8: Resource unavailabe */\n#define STATUS_RES_UNAVAIL\t8\n/*   9: Function Rejected */\n/*  10: Login ID not recognized */\n/*  11: Dummy ORB completed */\n/*  12: Request aborted */\n/* 255: Unspecified error */\n\n/* status (resp == 1) */\n/* Referenced object */\n#define OBJ_ORB\t\t(0 << 6)\t/* 0: ORB */\n#define OBJ_DATA\t(1 << 6)\t/* 1: Data buffer */\n#define OBJ_PT\t\t(2 << 6)\t/* 2: Page table */\n#define OBJ_UNSPEC\t(3 << 6)\t/* 3: Unable to specify */\n/* Serial bus error */\n/* 0: Missing acknowledge */\n/* 1: Reserved; not to be used */\n/* 2: Time-out error */\n#define SBE_TIMEOUT 2\n/* 3: Reserved; not to be used */\n/* 4: Busy retry limit exceeded: ack_busy_X */\n/* 5: Busy retry limit exceeded: ack_busy_A */\n/* 6: Busy retry limit exceeded: ack_busy_B */\n/* 7-A: Reserved for future standardization */\n/* B: Tardy retry limit exceeded */\n/* C: Confilict error */\n/* D: Data error */\n/* E: Type error */\n/* F: Address error */\n\n\nstruct sbp_cmd_status{\n#define SBP_SFMT_CURR 0\n#define SBP_SFMT_DEFER 1\n#if BYTE_ORDER == BIG_ENDIAN\n\tuint8_t\t\tsfmt:2,\n\t\t\tstatus:6;\n\tuint8_t\t\tvalid:1,\n\t\t\tmark:1,\n\t\t\teom:1,\n\t\t\till_len:1,\n\t\t\ts_key:4;\n#else\n\tuint8_t\t\tstatus:6,\n\t\t\tsfmt:2;\n\tuint8_t\t\ts_key:4,\n\t\t\till_len:1,\n\t\t\teom:1,\n\t\t\tmark:1,\n\t\t\tvalid:1;\n#endif\n\tuint8_t\t\ts_code;\n\tuint8_t\t\ts_qlfr;\n\tuint32_t\tinfo;\n\tuint32_t\tcdb;\n\tuint8_t\t\tfru;\n\tuint8_t\t\ts_keydep[3];\n\tuint32_t\tvend[2];\n};\n\n#define ORB_FUN_NAMES \\\n\t/* 0 */ \"LOGIN\", \\\n\t/* 1 */ \"QUERY LOGINS\", \\\n\t/* 2 */ \"Reserved\", \\\n\t/* 3 */ \"RECONNECT\", \\\n\t/* 4 */ \"SET PASSWORD\", \\\n\t/* 5 */ \"Reserved\", \\\n\t/* 6 */ \"Reserved\", \\\n\t/* 7 */ \"LOGOUT\", \\\n\t/* 8 */ \"Reserved\", \\\n\t/* 9 */ \"Reserved\", \\\n\t/* A */ \"Reserved\", \\\n\t/* B */ \"ABORT TASK\", \\\n\t/* C */ \"ABORT TASK SET\", \\\n\t/* D */ \"Reserved\", \\\n\t/* E */ \"LOGICAL UNIT RESET\", \\\n\t/* F */ \"TARGET RESET\"\n"
  },
  {
    "path": "freebsd-headers/dev/hwpmc/hwpmc_amd.h",
    "content": "/*-\n * Copyright (c) 2005, Joseph Koshy\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/dev/hwpmc/hwpmc_amd.h 184802 2008-11-09 17:37:54Z jkoshy $\n */\n\n/* Machine dependent interfaces */\n\n#ifndef _DEV_HWPMC_AMD_H_\n#define\t_DEV_HWPMC_AMD_H_ 1\n\n/* AMD K7 and K8 PMCs */\n\n#define\tAMD_PMC_EVSEL_0\t\t0xC0010000\n#define\tAMD_PMC_EVSEL_1\t\t0xC0010001\n#define\tAMD_PMC_EVSEL_2\t\t0xC0010002\n#define\tAMD_PMC_EVSEL_3\t\t0xC0010003\n\n#define\tAMD_PMC_PERFCTR_0\t0xC0010004\n#define\tAMD_PMC_PERFCTR_1\t0xC0010005\n#define\tAMD_PMC_PERFCTR_2\t0xC0010006\n#define\tAMD_PMC_PERFCTR_3\t0xC0010007\n\n\n#define\tAMD_NPMCS\t\t4\n\n#define\tAMD_PMC_COUNTERMASK\t0xFF000000\n#define\tAMD_PMC_TO_COUNTER(x)\t(((x) << 24) & AMD_PMC_COUNTERMASK)\n#define\tAMD_PMC_INVERT\t\t(1 << 23)\n#define\tAMD_PMC_ENABLE\t\t(1 << 22)\n#define\tAMD_PMC_INT\t\t(1 << 20)\n#define\tAMD_PMC_PC\t\t(1 << 19)\n#define\tAMD_PMC_EDGE\t\t(1 << 18)\n#define\tAMD_PMC_OS\t\t(1 << 17)\n#define\tAMD_PMC_USR\t\t(1 << 16)\n\n#define\tAMD_PMC_UNITMASK_M\t0x10\n#define\tAMD_PMC_UNITMASK_O\t0x08\n#define\tAMD_PMC_UNITMASK_E\t0x04\n#define\tAMD_PMC_UNITMASK_S\t0x02\n#define\tAMD_PMC_UNITMASK_I\t0x01\n#define\tAMD_PMC_UNITMASK_MOESI\t0x1F\n\n#define\tAMD_PMC_UNITMASK\t0xFF00\n#define\tAMD_PMC_EVENTMASK \t0x00FF\n\n#define\tAMD_PMC_TO_UNITMASK(x)\t(((x) << 8) & AMD_PMC_UNITMASK)\n#define\tAMD_PMC_TO_EVENTMASK(x)\t((x) & 0xFF)\n#define\tAMD_VALID_BITS\t\t(AMD_PMC_COUNTERMASK | AMD_PMC_INVERT |\t\\\n\tAMD_PMC_ENABLE | AMD_PMC_INT | AMD_PMC_PC | AMD_PMC_EDGE | \t\\\n\tAMD_PMC_OS | AMD_PMC_USR | AMD_PMC_UNITMASK | AMD_PMC_EVENTMASK)\n\n#define AMD_PMC_CAPS\t\t(PMC_CAP_INTERRUPT | PMC_CAP_USER | \t\\\n\tPMC_CAP_SYSTEM | PMC_CAP_EDGE | PMC_CAP_THRESHOLD | \t\t\\\n\tPMC_CAP_READ | PMC_CAP_WRITE | PMC_CAP_INVERT | PMC_CAP_QUALIFIER)\n\n#define AMD_PMC_IS_STOPPED(evsel) ((rdmsr((evsel)) & AMD_PMC_ENABLE) == 0)\n#define AMD_PMC_HAS_OVERFLOWED(pmc) ((rdpmc(pmc) & (1ULL << 47)) == 0)\n\n#define\tAMD_RELOAD_COUNT_TO_PERFCTR_VALUE(V)\t(-(V))\n#define\tAMD_PERFCTR_VALUE_TO_RELOAD_COUNT(P)\t(-(P))\n\nstruct pmc_md_amd_op_pmcallocate {\n\tuint32_t\tpm_amd_config;\n};\n\n#ifdef _KERNEL\n\n/* MD extension for 'struct pmc' */\nstruct pmc_md_amd_pmc {\n\tuint32_t\tpm_amd_evsel;\n};\n\n#endif /* _KERNEL */\n#endif /* _DEV_HWPMC_AMD_H_ */\n"
  },
  {
    "path": "freebsd-headers/dev/hwpmc/hwpmc_core.h",
    "content": "/*-\n * Copyright (c) 2008 Joseph Koshy\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/dev/hwpmc/hwpmc_core.h 210621 2010-07-29 17:52:23Z gnn $\n */\n\n#ifndef _DEV_HWPMC_CORE_H_\n#define\t_DEV_HWPMC_CORE_H_ 1\n\n/*\n * Fixed-function PMCs.\n */\nstruct pmc_md_iaf_op_pmcallocate {\n\tuint16_t\tpm_iaf_flags;\t/* additional flags */\n};\n\n#define\tIAF_OS\t\t0x1\n#define\tIAF_USR\t\t0x2\n#define\tIAF_ANY\t\t0x4\n#define\tIAF_PMI\t\t0x8\n\n/*\n * Programmable PMCs.\n */\nstruct pmc_md_iap_op_pmcallocate {\n\tuint32_t\tpm_iap_config;\n\tuint32_t\tpm_iap_rsp;\n};\n\n#define\tIAP_EVSEL(C)\t((C) & 0xFF)\n#define\tIAP_UMASK(C)\t((C) & 0xFF00)\n#define\tIAP_USR\t\t(1 << 16)\n#define\tIAP_OS\t\t(1 << 17)\n#define\tIAP_EDGE\t(1 << 18)\n#define\tIAP_INT\t\t(1 << 20)\n#define\tIAP_ANY\t\t(1 << 21)\n#define\tIAP_EN\t\t(1 << 22)\n#define\tIAP_INV\t\t(1 << 23)\n#define\tIAP_CMASK(C)\t(((C) & 0xFF) << 24)\n\n#define\tIA_OFFCORE_RSP_MASK\t0xF7FF\n\n#ifdef\t_KERNEL\n\n/*\n * Fixed-function counters.\n */\n\n#define\tIAF_MASK\t\t\t\t0xF\n\n#define\tIAF_COUNTER_MASK\t\t\t0x0000ffffffffffff\n#define\tIAF_CTR0\t\t\t\t0x309\n#define\tIAF_CTR1\t\t\t\t0x30A\n#define\tIAF_CTR2\t\t\t\t0x30B\n\n/*\n * The IAF_CTRL MSR is laid out in the following way.\n *\n * Bit Position    Use\n * 63 - 12         Reserved (do not touch)\n * 11              Ctr 2 PMI\n * 10              Reserved (do not touch)\n * 9-8             Ctr 2 Enable\n * 7               Ctr 1 PMI\n * 6               Reserved (do not touch)\n * 5-4             Ctr 1 Enable\n * 3               Ctr 0 PMI\n * 2               Reserved (do not touch)\n * 1-0             Ctr 0 Enable (3: All Levels, 2: User, 1: OS, 0: Disable)\n */\n\n#define\tIAF_OFFSET\t\t\t\t32\n#define\tIAF_CTRL\t\t\t\t0x38D\n#define\tIAF_CTRL_MASK\t\t\t\t0x0000000000000bbb\n\n/*\n * Programmable counters.\n */\n\n#define\tIAP_PMC0\t\t\t\t0x0C1\n\n/*\n * IAP_EVSEL(n) is laid out in the following way.\n *\n * Bit Position    Use\n * 63-31           Reserved (do not touch)\n * 31-24           Counter Mask\n * 23              Invert\n * 22              Enable\n * 21              Reserved (do not touch)\n * 20              APIC Interrupt Enable\n * 19              Pin Control\n * 18              Edge Detect\n * 17              OS\n * 16              User\n * 15-8            Unit Mask\n * 7-0             Event Select\n */\n\n#define\tIAP_EVSEL_MASK\t\t\t\t0x00000000ffdfffff\n#define\tIAP_EVSEL0\t\t\t\t0x186\n\n/*\n * Simplified programming interface in Intel Performance Architecture\n * v2 and later.\n */\n\n#define\tIA_GLOBAL_STATUS\t\t\t0x38E\n#define\tIA_GLOBAL_CTRL\t\t\t\t0x38F\n\n/*\n * IA_GLOBAL_CTRL is layed out in the following way.\n * \n * Bit Position    Use\n * 63-35           Reserved (do not touch)\n * 34              IAF Counter 2 Enable\n * 33              IAF Counter 1 Enable\n * 32              IAF Counter 0 Enable\n * 31-0            Depends on programmable counters\n */\n\n/* The mask is only for the fixed porttion of the register. */\n#define\tIAF_GLOBAL_CTRL_MASK\t\t\t0x0000000700000000\n\n/* The mask is only for the programmable porttion of the register. */\n#define IAP_GLOBAL_CTRL_MASK\t\t\t0x00000000ffffffff\n\n/* The mask is for both the fixed and programmable porttions of the register. */\n#define IA_GLOBAL_CTRL_MASK\t\t\t0x00000007ffffffff\n\n#define\tIA_GLOBAL_OVF_CTRL\t\t\t0x390\n\n#define\tIA_GLOBAL_STATUS_FLAG_CONDCHG\t\t(1ULL << 63)\n#define\tIA_GLOBAL_STATUS_FLAG_OVFBUF\t\t(1ULL << 62)\n\n/*\n * Offcore response configuration.\n */\n#define\tIA_OFFCORE_RSP0\t\t\t\t0x1A6\n#define\tIA_OFFCORE_RSP1\t\t\t\t0x1A7\n\nstruct pmc_md_iaf_pmc {\n\tuint64_t\tpm_iaf_ctrl;\n};\n\nstruct pmc_md_iap_pmc {\n\tuint32_t\tpm_iap_evsel;\n\tuint32_t\tpm_iap_rsp;\n};\n\n/*\n * Prototypes.\n */\n\nint\tpmc_core_initialize(struct pmc_mdep *_md, int _maxcpu);\nvoid\tpmc_core_finalize(struct pmc_mdep *_md);\n\nvoid\tpmc_core_mark_started(int _cpu, int _pmc);\n\nint\tpmc_iaf_initialize(struct pmc_mdep *_md, int _maxcpu, int _npmc, int _width);\nvoid\tpmc_iaf_finalize(struct pmc_mdep *_md);\n\nint\tpmc_iap_initialize(struct pmc_mdep *_md, int _maxcpu, int _npmc, int _width,\n\t    int _flags);\nvoid\tpmc_iap_finalize(struct pmc_mdep *_md);\n\n#endif\t/* _KERNEL */\n#endif\t/* _DEV_HWPMC_CORE_H */\n"
  },
  {
    "path": "freebsd-headers/dev/hwpmc/hwpmc_mips24k.h",
    "content": "/*-\n * Copyright (c) 2010 George V. Neville-Neil <gnn@freebsd.org>\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/dev/hwpmc/hwpmc_mips24k.h 204635 2010-03-03 15:05:58Z gnn $\n */\n\n#ifndef _DEV_HWPMC_MIPS24K_H_\n#define _DEV_HWPMC_MIPS24K_H_\n\n#define\tMIPS24K_PMC_CAPS\t(PMC_CAP_INTERRUPT | PMC_CAP_USER |     \\\n\t\t\t\t PMC_CAP_SYSTEM | PMC_CAP_EDGE |\t\\\n\t\t\t\t PMC_CAP_THRESHOLD | PMC_CAP_READ |\t\\\n\t\t\t\t PMC_CAP_WRITE | PMC_CAP_INVERT |\t\\\n\t\t\t\t PMC_CAP_QUALIFIER)\n\n\n#define MIPS24K_PMC_USER_ENABLE           0x08 /* Count in USER mode */\n#define MIPS24K_PMC_SUPER_ENABLE          0x04 /* Count in SUPERVISOR mode */\n#define MIPS24K_PMC_KERNEL_ENABLE         0x02 /* Count in KERNEL mode */\n#define MIPS24K_PMC_ENABLE (MIPS24K_PMC_USER_ENABLE |\t   \\\n\t\t\t    MIPS24K_PMC_SUPER_ENABLE |\t   \\\n\t\t\t    MIPS24K_PMC_KERNEL_ENABLE)\n\n\n#define\tMIPS24K_RELOAD_COUNT_TO_PERFCTR_VALUE(R)\t(-(R))\n#define\tMIPS24K_PERFCTR_VALUE_TO_RELOAD_COUNT(P)\t(-(P))\n\n#define MIPS24K_PMC_SELECT 0x4 /* Which bit position the event starts at. */\n#define MIPS24K_PMC_OFFSET 2   /* Control registers are 0, 2, 4, etc. */\n#define MIPS24K_PMC_MORE 0x800000 /* Test for more PMCs (bit 31) */\n\n#ifdef _KERNEL\n/* MD extension for 'struct pmc' */\nstruct pmc_md_mips24k_pmc {\n\tuint32_t\tpm_mips24k_evsel;\n};\n#endif /* _KERNEL */\n\n#endif /* _DEV_HWPMC_MIPS_H_ */\n"
  },
  {
    "path": "freebsd-headers/dev/hwpmc/hwpmc_pentium.h",
    "content": "/*-\n * Copyright (c) 2005, Joseph Koshy\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/dev/hwpmc/hwpmc_pentium.h 184802 2008-11-09 17:37:54Z jkoshy $\n */\n\n/* Machine dependent interfaces */\n\n#ifndef _DEV_HWPMC_PENTIUM_H_\n#define\t_DEV_HWPMC_PENTIUM_H_ 1\n\n/* Intel Pentium PMCs */\n\n#define\tPENTIUM_NPMCS\t2\n#define\tPENTIUM_CESR_PC1\t\t(1 << 25)\n#define\tPENTIUM_CESR_CC1_MASK\t\t0x01C00000\n#define\tPENTIUM_CESR_TO_CC1(C)\t\t(((C) & 0x07) << 22)\n#define\tPENTIUM_CESR_ES1_MASK\t\t0x003F0000\n#define\tPENTIUM_CESR_TO_ES1(E)\t\t(((E) & 0x3F) << 16)\n#define\tPENTIUM_CESR_PC0\t\t(1 << 9)\n#define\tPENTIUM_CESR_CC0_MASK\t\t0x000001C0\n#define\tPENTIUM_CESR_TO_CC0(C)\t\t(((C) & 0x07) << 6)\n#define\tPENTIUM_CESR_ES0_MASK\t\t0x0000003F\n#define\tPENTIUM_CESR_TO_ES0(E)\t\t((E) & 0x3F)\n#define\tPENTIUM_CESR_RESERVED\t\t0xFC00FC00\n\n#define\tPENTIUM_MSR_CESR\t\t0x11\n#define\tPENTIUM_MSR_CTR0\t\t0x12\n#define\tPENTIUM_MSR_CTR1\t\t0x13\n\nstruct pmc_md_pentium_op_pmcallocate {\n\tuint32_t\tpm_pentium_config;\n};\n\n#ifdef _KERNEL\n\n/* MD extension for 'struct pmc' */\nstruct pmc_md_pentium_pmc {\n\tuint32_t\tpm_pentium_cesr;\n};\n\n\n/*\n * Prototypes\n */\n\nint\tpmc_p5_initialize(struct pmc_mdep *_md, int _ncpus);\nvoid\tpmc_p5_finalize(struct pmc_mdep *_md);\n\n#endif /* _KERNEL */\n#endif /* _DEV_HWPMC_PENTIUM_H_ */\n"
  },
  {
    "path": "freebsd-headers/dev/hwpmc/hwpmc_piv.h",
    "content": "/*-\n * Copyright (c) 2005, Joseph Koshy\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/dev/hwpmc/hwpmc_piv.h 184802 2008-11-09 17:37:54Z jkoshy $\n */\n\n/* Machine dependent interfaces */\n\n#ifndef _DEV_HWPMC_PIV_H_\n#define\t_DEV_HWPMC_PIV_H_ 1\n\n/* Intel P4 PMCs */\n\n#define\tP4_NPMCS\t\t18\n#define\tP4_NESCR\t\t45\n#define\tP4_INVALID_PMC_INDEX\t-1\n#define\tP4_MAX_ESCR_PER_EVENT\t2\n#define\tP4_MAX_PMC_PER_ESCR\t3\n\n#define\tP4_CCCR_OVF\t\t\t(1 << 31)\n#define\tP4_CCCR_CASCADE\t\t\t(1 << 30)\n#define\tP4_CCCR_OVF_PMI_T1\t\t(1 << 27)\n#define\tP4_CCCR_OVF_PMI_T0\t\t(1 << 26)\n#define\tP4_CCCR_FORCE_OVF\t\t(1 << 25)\n#define\tP4_CCCR_EDGE\t\t\t(1 << 24)\n#define\tP4_CCCR_THRESHOLD_SHIFT\t\t20\n#define\tP4_CCCR_THRESHOLD_MASK\t\t0x00F00000\n#define\tP4_CCCR_TO_THRESHOLD(C)\t\t(((C) << P4_CCCR_THRESHOLD_SHIFT) & \\\n\tP4_CCCR_THRESHOLD_MASK)\n#define\tP4_CCCR_COMPLEMENT\t\t(1 << 19)\n#define\tP4_CCCR_COMPARE\t\t\t(1 << 18)\n#define\tP4_CCCR_ACTIVE_THREAD_SHIFT\t16\n#define\tP4_CCCR_ACTIVE_THREAD_MASK\t0x00030000\n#define\tP4_CCCR_TO_ACTIVE_THREAD(T)\t(((T) << P4_CCCR_ACTIVE_THREAD_SHIFT) & \\\n\tP4_CCCR_ACTIVE_THREAD_MASK)\n#define\tP4_CCCR_ESCR_SELECT_SHIFT\t13\n#define\tP4_CCCR_ESCR_SELECT_MASK\t0x0000E000\n#define\tP4_CCCR_TO_ESCR_SELECT(E)\t(((E) << P4_CCCR_ESCR_SELECT_SHIFT) & \\\n\tP4_CCCR_ESCR_SELECT_MASK)\n#define\tP4_CCCR_ENABLE\t\t\t(1 << 12)\n#define\tP4_CCCR_VALID_BITS\t\t(P4_CCCR_OVF | P4_CCCR_CASCADE | \\\n    P4_CCCR_OVF_PMI_T1 | P4_CCCR_OVF_PMI_T0 | P4_CCCR_FORCE_OVF | \t \\\n    P4_CCCR_EDGE | P4_CCCR_THRESHOLD_MASK | P4_CCCR_COMPLEMENT |\t \\\n    P4_CCCR_COMPARE | P4_CCCR_ESCR_SELECT_MASK | P4_CCCR_ENABLE)\n\n#define\tP4_ESCR_EVENT_SELECT_SHIFT\t25\n#define\tP4_ESCR_EVENT_SELECT_MASK\t0x7E000000\n#define\tP4_ESCR_TO_EVENT_SELECT(E)\t(((E) << P4_ESCR_EVENT_SELECT_SHIFT) & \\\n\tP4_ESCR_EVENT_SELECT_MASK)\n#define\tP4_ESCR_EVENT_MASK_SHIFT\t9\n#define\tP4_ESCR_EVENT_MASK_MASK\t\t0x01FFFE00\n#define\tP4_ESCR_TO_EVENT_MASK(M)\t(((M) << P4_ESCR_EVENT_MASK_SHIFT) & \\\n\tP4_ESCR_EVENT_MASK_MASK)\n#define\tP4_ESCR_TAG_VALUE_SHIFT\t\t5\n#define\tP4_ESCR_TAG_VALUE_MASK\t\t0x000001E0\n#define\tP4_ESCR_TO_TAG_VALUE(T)\t\t(((T) << P4_ESCR_TAG_VALUE_SHIFT) & \\\n\tP4_ESCR_TAG_VALUE_MASK)\n#define\tP4_ESCR_TAG_ENABLE \t\t0x00000010\n#define\tP4_ESCR_T0_OS\t\t\t0x00000008\n#define\tP4_ESCR_T0_USR\t\t\t0x00000004\n#define\tP4_ESCR_T1_OS\t\t\t0x00000002\n#define\tP4_ESCR_T1_USR\t\t\t0x00000001\n#define\tP4_ESCR_OS\t\t\tP4_ESCR_T0_OS\n#define\tP4_ESCR_USR\t\t\tP4_ESCR_T0_USR\n#define\tP4_ESCR_VALID_BITS\t\t(P4_ESCR_EVENT_SELECT_MASK |\t\\\n    P4_ESCR_EVENT_MASK_MASK | P4_ESCR_TAG_VALUE_MASK | \t\t\t\\\n    P4_ESCR_TAG_ENABLE | P4_ESCR_T0_OS | P4_ESCR_T0_USR | P4_ESCR_T1_OS \\\n    P4_ESCR_T1_USR)\n\n#define\tP4_PERFCTR_MASK\t\t\t0xFFFFFFFFFFLL /* 40 bits */\n#define\tP4_PERFCTR_OVERFLOWED(PMC)\t((rdpmc(PMC) & (1LL << 39)) == 0)\n\n#define\tP4_CCCR_MSR_FIRST\t\t0x360 /* MSR_BPU_CCCR0 */\n#define\tP4_PERFCTR_MSR_FIRST\t\t0x300 /* MSR_BPU_COUNTER0 */\n\n#define\tP4_RELOAD_COUNT_TO_PERFCTR_VALUE(V)\t(1 - (V))\n#define\tP4_PERFCTR_VALUE_TO_RELOAD_COUNT(P)\t(1 - (P))\n\nstruct pmc_md_p4_op_pmcallocate {\n\tuint32_t\tpm_p4_cccrconfig;\n\tuint32_t\tpm_p4_escrconfig;\n};\n\n#ifdef _KERNEL\n\n/* MD extension for 'struct pmc' */\nstruct pmc_md_p4_pmc {\n\tuint32_t\tpm_p4_cccrvalue;\n\tuint32_t\tpm_p4_escrvalue;\n\tuint32_t\tpm_p4_escr;\n\tuint32_t\tpm_p4_escrmsr;\n};\n\n\n/*\n * Prototypes\n */\n\nint\tpmc_p4_initialize(struct pmc_mdep *_md, int _ncpus);\nvoid\tpmc_p4_finalize(struct pmc_mdep *md);\n\n#endif /* _KERNEL */\n#endif /* _DEV_HWPMC_PIV_H_ */\n"
  },
  {
    "path": "freebsd-headers/dev/hwpmc/hwpmc_ppro.h",
    "content": "/*-\n * Copyright (c) 2005, Joseph Koshy\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/dev/hwpmc/hwpmc_ppro.h 184802 2008-11-09 17:37:54Z jkoshy $\n */\n\n/* Machine dependent interfaces */\n\n#ifndef _DEV_HWPMC_PPRO_H_\n#define\t_DEV_HWPMC_PPRO_H_\n\n/* Intel PPro, Celeron, P-II, P-III, Pentium-M PMCS */\n\n#define\tP6_NPMCS\t2\t\t/* 2 PMCs */\n\n#define\tP6_EVSEL_CMASK_MASK\t\t0xFF000000\n#define\tP6_EVSEL_TO_CMASK(C)\t\t(((C) & 0xFF) << 24)\n#define\tP6_EVSEL_INV\t\t\t(1 << 23)\n#define\tP6_EVSEL_EN\t\t\t(1 << 22)\n#define\tP6_EVSEL_INT\t\t\t(1 << 20)\n#define\tP6_EVSEL_PC\t\t\t(1 << 19)\n#define\tP6_EVSEL_E\t\t\t(1 << 18)\n#define\tP6_EVSEL_OS\t\t\t(1 << 17)\n#define\tP6_EVSEL_USR\t\t\t(1 << 16)\n#define\tP6_EVSEL_UMASK_MASK\t\t0x0000FF00\n#define\tP6_EVSEL_TO_UMASK(U)\t\t(((U) & 0xFF) << 8)\n#define\tP6_EVSEL_EVENT_SELECT(ES)\t((ES) & 0xFF)\n#define\tP6_EVSEL_RESERVED\t\t(1 << 21)\n\n#define\tP6_MSR_EVSEL0\t\t\t0x0186\n#define\tP6_MSR_EVSEL1\t\t\t0x0187\n#define\tP6_MSR_PERFCTR0\t\t\t0x00C1\n#define\tP6_MSR_PERFCTR1\t\t\t0x00C2\n\n#define\tP6_PERFCTR_READ_MASK\t\t0xFFFFFFFFFFLL\t/* 40 bits */\n#define\tP6_PERFCTR_WRITE_MASK\t\t0xFFFFFFFFU\t/* 32 bits */\n\n#define\tP6_RELOAD_COUNT_TO_PERFCTR_VALUE(R)\t(-(R))\n#define\tP6_PERFCTR_VALUE_TO_RELOAD_COUNT(P)\t(-(P))\n\n#define\tP6_PMC_HAS_OVERFLOWED(P)\t((rdpmc(P) & (1LL << 39)) == 0)\n\nstruct pmc_md_ppro_op_pmcallocate {\n\tuint32_t\tpm_ppro_config;\n};\n\n#ifdef _KERNEL\n\n/* MD extension for 'struct pmc' */\nstruct pmc_md_ppro_pmc {\n\tuint32_t\tpm_ppro_evsel;\n};\n\n/*\n * Prototypes\n */\n\nint\tpmc_p6_initialize(struct pmc_mdep *_md, int _ncpus);\nvoid\tpmc_p6_finalize(struct pmc_mdep *_md);\n\n#endif /* _KERNEL */\n#endif /* _DEV_HWPMC_PPRO_H_ */\n"
  },
  {
    "path": "freebsd-headers/dev/hwpmc/hwpmc_tsc.h",
    "content": "/*-\n * Copyright (c) 2008 Joseph Koshy\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/dev/hwpmc/hwpmc_tsc.h 184802 2008-11-09 17:37:54Z jkoshy $\n */\n\n#ifndef _DEV_HWPMC_TSC_H_\n#define\t_DEV_HWPMC_TSC_H_ 1\n\n#ifdef\t_KERNEL\n\n#define\tTSC_NPMCS\t1\n\n/*\n * Prototypes.\n */\n\nint\tpmc_tsc_initialize(struct pmc_mdep *_md, int _maxcpu);\nvoid\tpmc_tsc_finalize(struct pmc_mdep *_md);\n#endif\t/* _KERNEL */\n#endif\t/* _DEV_HWPMC_TSC_H */\n"
  },
  {
    "path": "freebsd-headers/dev/hwpmc/hwpmc_uncore.h",
    "content": "/*-\n * Copyright (c) 2010 Fabien Thomas\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/dev/hwpmc/hwpmc_uncore.h 206089 2010-04-02 13:23:49Z fabient $\n */\n\n#ifndef _DEV_HWPMC_UNCORE_H_\n#define\t_DEV_HWPMC_UNCORE_H_ 1\n\n/*\n * Fixed-function PMCs.\n */\nstruct pmc_md_ucf_op_pmcallocate {\n\tuint16_t\tpm_ucf_flags;\t/* additional flags */\n};\n\n#define\tUCF_EN\t\t0x1\n#define\tUCF_PMI\t\t0x4\n\n/*\n * Programmable PMCs.\n */\nstruct pmc_md_ucp_op_pmcallocate {\n\tuint32_t\tpm_ucp_config;\n};\n\n#define\tUCP_EVSEL(C)\t((C) & 0xFF)\n#define\tUCP_UMASK(C)\t((C) & 0xFF00)\n#define\tUCP_CTRR\t(1 << 17)\n#define\tUCP_EDGE\t(1 << 18)\n#define\tUCP_INT\t\t(1 << 20)\n#define\tUCP_EN\t\t(1 << 22)\n#define\tUCP_INV\t\t(1 << 23)\n#define\tUCP_CMASK(C)\t(((C) & 0xFF) << 24)\n\n#ifdef\t_KERNEL\n\n#define\tDCTL_FLAG_UNC_PMI\t(1ULL << 13)\n\n/*\n * Fixed-function counters.\n */\n\n#define\tUCF_MASK\t\t\t\t0xF\n\n#define\tUCF_CTR0\t\t\t\t0x394\n\n#define\tUCF_OFFSET\t\t\t\t32\n#define\tUCF_CTRL\t\t\t\t0x395\n\n/*\n * Programmable counters.\n */\n\n#define\tUCP_PMC0\t\t\t\t0x3B0\n#define\tUCP_EVSEL0\t\t\t\t0x3C0\n#define UCP_OPCODE_MATCH\t\t\t0x396\n\n/*\n * Simplified programming interface in Intel Performance Architecture\n * v2 and later.\n */\n\n#define\tUC_GLOBAL_STATUS\t\t\t0x392\n#define\tUC_GLOBAL_CTRL\t\t\t\t0x391\n#define\tUC_GLOBAL_OVF_CTRL\t\t\t0x393\n\n#define\tUC_GLOBAL_STATUS_FLAG_CLRCHG\t\t(1ULL << 63)\n#define\tUC_GLOBAL_STATUS_FLAG_OVFPMI\t\t(1ULL << 61)\n#define\tUC_GLOBAL_CTRL_FLAG_FRZ\t\t\t(1ULL << 63)\n#define\tUC_GLOBAL_CTRL_FLAG_ENPMICORE0\t\t(1ULL << 48)\n\nstruct pmc_md_ucf_pmc {\n\tuint64_t\tpm_ucf_ctrl;\n};\n\nstruct pmc_md_ucp_pmc {\n\tuint32_t\tpm_ucp_evsel;\n};\n\n/*\n * Prototypes.\n */\n\nint\tpmc_uncore_initialize(struct pmc_mdep *_md, int _maxcpu);\nvoid\tpmc_uncore_finalize(struct pmc_mdep *_md);\n\nvoid\tpmc_uncore_mark_started(int _cpu, int _pmc);\n\nint\tpmc_ucf_initialize(struct pmc_mdep *_md, int _maxcpu, int _npmc, int _width);\nvoid\tpmc_ucf_finalize(struct pmc_mdep *_md);\n\nint\tpmc_ucp_initialize(struct pmc_mdep *_md, int _maxcpu, int _npmc, int _width,\n\t    int _flags);\nvoid\tpmc_ucp_finalize(struct pmc_mdep *_md);\n\n#endif\t/* _KERNEL */\n#endif\t/* _DEV_HWPMC_UNCORE_H */\n"
  },
  {
    "path": "freebsd-headers/dev/hwpmc/hwpmc_xscale.h",
    "content": "/*-\n * Copyright (c) 2009 Rui Paulo <rpaulo@FreeBSD.org>\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/dev/hwpmc/hwpmc_xscale.h 200928 2009-12-23 23:16:54Z rpaulo $\n */\n\n#ifndef _DEV_HWPMC_XSCALE_H_\n#define _DEV_HWPMC_XSCALE_H_\n\n#define\tXSCALE_PMC_CAPS\t\t(PMC_CAP_INTERRUPT | PMC_CAP_USER |     \\\n\t\t\t\t PMC_CAP_SYSTEM | PMC_CAP_EDGE |\t\\\n\t\t\t\t PMC_CAP_THRESHOLD | PMC_CAP_READ |\t\\\n\t\t\t\t PMC_CAP_WRITE | PMC_CAP_INVERT |\t\\\n\t\t\t\t PMC_CAP_QUALIFIER)\n\n\n#define\tXSCALE_PMNC_ENABLE\t\t0x01\t/* Enable all Counters */\n#define\tXSCALE_PMNC_PMNRESET\t\t0x02\t/* Performance Counter Reset */\n#define\tXSCALE_PMNC_CCNTRESET\t\t0x04\t/* Clock Counter Reset */\n#define\tXSCALE_PMNC_CCNTDIV\t\t0x08\t/* Clock Counter Divider */\n/* IXP425 only -- first generation */\n#define\tXSCALE_PMNC_EVT0_MASK\t\t0x00ff000\n#define\tXSCALE_PMNC_EVT1_MASK\t\t0xff00000\n\n#define\tXSCALE_INTEN_CCNT\t\t0x01\t/* Enable Clock Counter Int. */\n#define\tXSCALE_INTEN_PMN0\t\t0x02\t/* Enable PMN0 Interrupts */\n#define\tXSCALE_INTEN_PMN1\t\t0x04\t/* Enable PMN1 Interrupts */\n#define\tXSCALE_INTEN_PMN2\t\t0x08\t/* Enable PMN2 Interrupts */\n#define\tXSCALE_INTEN_PMN3\t\t0x10\t/* Enable PMN3 Interrupts */\n\n#define\tXSCALE_EVTSEL_EVT0_MASK\t\t0x000000ff\n#define\tXSCALE_EVTSEL_EVT1_MASK\t\t0x0000ff00\n#define\tXSCALE_EVTSEL_EVT2_MASK\t\t0x00ff0000\n#define\tXSCALE_EVTSEL_EVT3_MASK\t\t0xff000000\n\n#define\tXSCALE_FLAG_CCNT_OVERFLOW\t0x01\n#define\tXSCALE_FLAG_PMN0_OVERFLOW\t0x02\n#define\tXSCALE_FLAG_PMN1_OVERFLOW\t0x04\n#define\tXSCALE_FLAG_PMN2_OVERFLOW\t0x08\n#define\tXSCALE_FLAG_PMN3_OVERFLOW\t0x10\n\n#define\tXSCALE_RELOAD_COUNT_TO_PERFCTR_VALUE(R)\t(-(R))\n#define\tXSCALE_PERFCTR_VALUE_TO_RELOAD_COUNT(P)\t(-(P))\n\n#ifdef _KERNEL\n/* MD extension for 'struct pmc' */\nstruct pmc_md_xscale_pmc {\n\tuint32_t\tpm_xscale_evsel;\n};\n#endif /* _KERNEL */\n#endif /* _DEV_HWPMC_XSCALE_H_ */\n"
  },
  {
    "path": "freebsd-headers/dev/hwpmc/pmc_events.h",
    "content": "/*-\n * Copyright (c) 2005  Joseph Koshy\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/dev/hwpmc/pmc_events.h 213409 2010-10-04 17:22:18Z gnn $\n */\n\n#ifndef _DEV_HWPMC_PMC_EVENTS_H_\n#define\t_DEV_HWPMC_PMC_EVENTS_H_\n\n/* \n * Note: Documentation on adding events can be found both in\n * the source tree at src/share/doc/papers/hwpmc/hwpmc.ms\n * as well as on-line at:\n *\n * http://wiki.freebsd.org/PmcTools/PmcHardwareHowTo\n *\n * Please refer to those resources before you attempt to modify\n * this file or the hwpmc driver/subsystem.\n */\n\n/* * PMC event codes.\n *\n * __PMC_EV(CLASS, SYMBOLIC-NAME)\n *\n */\n\n/*\n * AMD K7 Events, from \"The AMD Athlon(tm) Processor x86 Code\n * Optimization Guide\" [Doc#22007K, Feb 2002]\n */\n\n#define\t__PMC_EV_K7()\t\t\t\t\t\\\n__PMC_EV(K7, DC_ACCESSES)\t\t\t\t\\\n__PMC_EV(K7, DC_MISSES)\t\t\t\t\t\\\n__PMC_EV(K7, DC_REFILLS_FROM_L2)\t\t\t\\\n__PMC_EV(K7, DC_REFILLS_FROM_SYSTEM)\t\t\t\\\n__PMC_EV(K7, DC_WRITEBACKS)\t\t\t\t\\\n__PMC_EV(K7, L1_DTLB_MISS_AND_L2_DTLB_HITS)\t\t\\\n__PMC_EV(K7, L1_AND_L2_DTLB_MISSES)\t\t\t\\\n__PMC_EV(K7, MISALIGNED_REFERENCES)\t\t\t\\\n__PMC_EV(K7, IC_FETCHES)\t\t\t\t\\\n__PMC_EV(K7, IC_MISSES)\t\t\t\t\t\\\n__PMC_EV(K7, L1_ITLB_MISSES)\t\t\t\t\\\n__PMC_EV(K7, L1_L2_ITLB_MISSES)\t\t\t\t\\\n__PMC_EV(K7, RETIRED_INSTRUCTIONS)\t\t\t\\\n__PMC_EV(K7, RETIRED_OPS)\t\t\t\t\\\n__PMC_EV(K7, RETIRED_BRANCHES)\t\t\t\t\\\n__PMC_EV(K7, RETIRED_BRANCHES_MISPREDICTED)\t\t\\\n__PMC_EV(K7, RETIRED_TAKEN_BRANCHES)\t\t\t\\\n__PMC_EV(K7, RETIRED_TAKEN_BRANCHES_MISPREDICTED)\t\\\n__PMC_EV(K7, RETIRED_FAR_CONTROL_TRANSFERS)\t\t\\\n__PMC_EV(K7, RETIRED_RESYNC_BRANCHES)\t\t\t\\\n__PMC_EV(K7, INTERRUPTS_MASKED_CYCLES)\t\t\t\\\n__PMC_EV(K7, INTERRUPTS_MASKED_WHILE_PENDING_CYCLES)\t\\\n__PMC_EV(K7, HARDWARE_INTERRUPTS)\n\n#define\tPMC_EV_K7_FIRST\tPMC_EV_K7_DC_ACCESSES\n#define\tPMC_EV_K7_LAST\tPMC_EV_K7_HARDWARE_INTERRUPTS\n\n\n/*\n * Intel P4 Events, from \"IA-32 Intel(r) Architecture Software\n * Developer's Manual, Volume 3: System Programming Guide\" [245472-012]\n */\n\n#define\t__PMC_EV_P4()\t\t\t\t\\\n__PMC_EV(P4, TC_DELIVER_MODE)\t\t\t\\\n__PMC_EV(P4, BPU_FETCH_REQUEST)\t\t\t\\\n__PMC_EV(P4, ITLB_REFERENCE)\t\t\t\\\n__PMC_EV(P4, MEMORY_CANCEL)\t\t\t\\\n__PMC_EV(P4, MEMORY_COMPLETE)\t\t\t\\\n__PMC_EV(P4, LOAD_PORT_REPLAY)\t\t\t\\\n__PMC_EV(P4, STORE_PORT_REPLAY)\t\t\t\\\n__PMC_EV(P4, MOB_LOAD_REPLAY)\t\t\t\\\n__PMC_EV(P4, PAGE_WALK_TYPE)\t\t\t\\\n__PMC_EV(P4, BSQ_CACHE_REFERENCE)\t\t\\\n__PMC_EV(P4, IOQ_ALLOCATION)\t\t\t\\\n__PMC_EV(P4, IOQ_ACTIVE_ENTRIES)\t\t\\\n__PMC_EV(P4, FSB_DATA_ACTIVITY)\t\t\t\\\n__PMC_EV(P4, BSQ_ALLOCATION)\t\t\t\\\n__PMC_EV(P4, BSQ_ACTIVE_ENTRIES)\t\t\\\n__PMC_EV(P4, SSE_INPUT_ASSIST)\t\t\t\\\n__PMC_EV(P4, PACKED_SP_UOP)\t\t\t\\\n__PMC_EV(P4, PACKED_DP_UOP)\t\t\t\\\n__PMC_EV(P4, SCALAR_SP_UOP)\t\t\t\\\n__PMC_EV(P4, SCALAR_DP_UOP)\t\t\t\\\n__PMC_EV(P4, 64BIT_MMX_UOP)\t\t\t\\\n__PMC_EV(P4, 128BIT_MMX_UOP)\t\t\t\\\n__PMC_EV(P4, X87_FP_UOP)\t\t\t\\\n__PMC_EV(P4, X87_SIMD_MOVES_UOP)\t\t\\\n__PMC_EV(P4, GLOBAL_POWER_EVENTS)\t\t\\\n__PMC_EV(P4, TC_MS_XFER)\t\t\t\\\n__PMC_EV(P4, UOP_QUEUE_WRITES)\t\t\t\\\n__PMC_EV(P4, RETIRED_MISPRED_BRANCH_TYPE)\t\\\n__PMC_EV(P4, RETIRED_BRANCH_TYPE)\t\t\\\n__PMC_EV(P4, RESOURCE_STALL)\t\t\t\\\n__PMC_EV(P4, WC_BUFFER)\t\t\t\t\\\n__PMC_EV(P4, B2B_CYCLES)\t\t\t\\\n__PMC_EV(P4, BNR)\t\t\t\t\\\n__PMC_EV(P4, SNOOP)\t\t\t\t\\\n__PMC_EV(P4, RESPONSE)\t\t\t\t\\\n__PMC_EV(P4, FRONT_END_EVENT)\t\t\t\\\n__PMC_EV(P4, EXECUTION_EVENT)\t\t\t\\\n__PMC_EV(P4, REPLAY_EVENT)\t\t\t\\\n__PMC_EV(P4, INSTR_RETIRED)\t\t\t\\\n__PMC_EV(P4, UOPS_RETIRED)\t\t\t\\\n__PMC_EV(P4, UOP_TYPE)\t\t\t\t\\\n__PMC_EV(P4, BRANCH_RETIRED)\t\t\t\\\n__PMC_EV(P4, MISPRED_BRANCH_RETIRED)\t\t\\\n__PMC_EV(P4, X87_ASSIST)\t\t\t\\\n__PMC_EV(P4, MACHINE_CLEAR)\n\n#define\tPMC_EV_P4_FIRST PMC_EV_P4_TC_DELIVER_MODE\n#define\tPMC_EV_P4_LAST\tPMC_EV_P4_MACHINE_CLEAR\n\n/* Intel Pentium Pro, P-II, P-III and Pentium-M style events */\n\n#define\t__PMC_EV_P6()\t\t\t\t\\\n__PMC_EV(P6, DATA_MEM_REFS)\t\t\t\\\n__PMC_EV(P6, DCU_LINES_IN)\t\t\t\\\n__PMC_EV(P6, DCU_M_LINES_IN)\t\t\t\\\n__PMC_EV(P6, DCU_M_LINES_OUT)\t\t\t\\\n__PMC_EV(P6, DCU_MISS_OUTSTANDING)\t\t\\\n__PMC_EV(P6, IFU_FETCH)\t\t\t\t\\\n__PMC_EV(P6, IFU_FETCH_MISS)\t\t\t\\\n__PMC_EV(P6, ITLB_MISS)\t\t\t\t\\\n__PMC_EV(P6, IFU_MEM_STALL)\t\t\t\\\n__PMC_EV(P6, ILD_STALL)\t\t\t\t\\\n__PMC_EV(P6, L2_IFETCH)\t\t\t\t\\\n__PMC_EV(P6, L2_LD)\t\t\t\t\\\n__PMC_EV(P6, L2_ST)\t\t\t\t\\\n__PMC_EV(P6, L2_LINES_IN)\t\t\t\\\n__PMC_EV(P6, L2_LINES_OUT)\t\t\t\\\n__PMC_EV(P6, L2_M_LINES_INM)\t\t\t\\\n__PMC_EV(P6, L2_M_LINES_OUTM)\t\t\t\\\n__PMC_EV(P6, L2_RQSTS)\t\t\t\t\\\n__PMC_EV(P6, L2_ADS)\t\t\t\t\\\n__PMC_EV(P6, L2_DBUS_BUSY)\t\t\t\\\n__PMC_EV(P6, L2_DBUS_BUSY_RD)\t\t\t\\\n__PMC_EV(P6, BUS_DRDY_CLOCKS)\t\t\t\\\n__PMC_EV(P6, BUS_LOCK_CLOCKS)\t\t\t\\\n__PMC_EV(P6, BUS_REQ_OUTSTANDING)\t\t\\\n__PMC_EV(P6, BUS_TRAN_BRD)\t\t\t\\\n__PMC_EV(P6, BUS_TRAN_RFO)\t\t\t\\\n__PMC_EV(P6, BUS_TRANS_WB)\t\t\t\\\n__PMC_EV(P6, BUS_TRAN_IFETCH)\t\t\t\\\n__PMC_EV(P6, BUS_TRAN_INVAL)\t\t\t\\\n__PMC_EV(P6, BUS_TRAN_PWR)\t\t\t\\\n__PMC_EV(P6, BUS_TRANS_P)\t\t\t\\\n__PMC_EV(P6, BUS_TRANS_IO)\t\t\t\\\n__PMC_EV(P6, BUS_TRAN_DEF)\t\t\t\\\n__PMC_EV(P6, BUS_TRAN_BURST)\t\t\t\\\n__PMC_EV(P6, BUS_TRAN_ANY)\t\t\t\\\n__PMC_EV(P6, BUS_TRAN_MEM)\t\t\t\\\n__PMC_EV(P6, BUS_DATA_RCV)\t\t\t\\\n__PMC_EV(P6, BUS_BNR_DRV)\t\t\t\\\n__PMC_EV(P6, BUS_HIT_DRV)\t\t\t\\\n__PMC_EV(P6, BUS_HITM_DRV)\t\t\t\\\n__PMC_EV(P6, BUS_SNOOP_STALL)\t\t\t\\\n__PMC_EV(P6, FLOPS)\t\t\t\t\\\n__PMC_EV(P6, FP_COMPS_OPS_EXE)\t\t\t\\\n__PMC_EV(P6, FP_ASSIST)\t\t\t\t\\\n__PMC_EV(P6, MUL)\t\t\t\t\\\n__PMC_EV(P6, DIV)\t\t\t\t\\\n__PMC_EV(P6, CYCLES_DIV_BUSY)\t\t\t\\\n__PMC_EV(P6, LD_BLOCKS)\t\t\t\t\\\n__PMC_EV(P6, SB_DRAINS)\t\t\t\t\\\n__PMC_EV(P6, MISALIGN_MEM_REF)\t\t\t\\\n__PMC_EV(P6, EMON_KNI_PREF_DISPATCHED)\t\t\\\n__PMC_EV(P6, EMON_KNI_PREF_MISS)\t\t\\\n__PMC_EV(P6, INST_RETIRED)\t\t\t\\\n__PMC_EV(P6, UOPS_RETIRED)\t\t\t\\\n__PMC_EV(P6, INST_DECODED)\t\t\t\\\n__PMC_EV(P6, EMON_KNI_INST_RETIRED)\t\t\\\n__PMC_EV(P6, EMON_KNI_COMP_INST_RET)\t\t\\\n__PMC_EV(P6, HW_INT_RX)\t\t\t\t\\\n__PMC_EV(P6, CYCLES_INT_MASKED)\t\t\t\\\n__PMC_EV(P6, CYCLES_INT_PENDING_AND_MASKED)\t\\\n__PMC_EV(P6, BR_INST_RETIRED)\t\t\t\\\n__PMC_EV(P6, BR_MISS_PRED_RETIRED)\t\t\\\n__PMC_EV(P6, BR_TAKEN_RETIRED)\t\t\t\\\n__PMC_EV(P6, BR_MISS_PRED_TAKEN_RET)\t\t\\\n__PMC_EV(P6, BR_INST_DECODED)\t\t\t\\\n__PMC_EV(P6, BTB_MISSES)\t\t\t\\\n__PMC_EV(P6, BR_BOGUS)\t\t\t\t\\\n__PMC_EV(P6, BACLEARS)\t\t\t\t\\\n__PMC_EV(P6, RESOURCE_STALLS)\t\t\t\\\n__PMC_EV(P6, PARTIAL_RAT_STALLS)\t\t\\\n__PMC_EV(P6, SEGMENT_REG_LOADS)\t\t\t\\\n__PMC_EV(P6, CPU_CLK_UNHALTED)\t\t\t\\\n__PMC_EV(P6, MMX_INSTR_EXEC)\t\t\t\\\n__PMC_EV(P6, MMX_SAT_INSTR_EXEC)\t\t\\\n__PMC_EV(P6, MMX_UOPS_EXEC)\t\t\t\\\n__PMC_EV(P6, MMX_INSTR_TYPE_EXEC)\t\t\\\n__PMC_EV(P6, FP_MMX_TRANS)\t\t\t\\\n__PMC_EV(P6, MMX_ASSIST)\t\t\t\\\n__PMC_EV(P6, MMX_INSTR_RET)\t\t\t\\\n__PMC_EV(P6, SEG_RENAME_STALLS)\t\t\t\\\n__PMC_EV(P6, SEG_REG_RENAMES)\t\t\t\\\n__PMC_EV(P6, RET_SEG_RENAMES)\t\t\t\\\n__PMC_EV(P6, EMON_EST_TRANS)\t\t\t\\\n__PMC_EV(P6, EMON_THERMAL_TRIP)\t\t\t\\\n__PMC_EV(P6, BR_INST_EXEC)\t\t\t\\\n__PMC_EV(P6, BR_MISSP_EXEC)\t\t\t\\\n__PMC_EV(P6, BR_BAC_MISSP_EXEC)\t\t\t\\\n__PMC_EV(P6, BR_CND_EXEC)\t\t\t\\\n__PMC_EV(P6, BR_CND_MISSP_EXEC)\t\t\t\\\n__PMC_EV(P6, BR_IND_EXEC)\t\t\t\\\n__PMC_EV(P6, BR_IND_MISSP_EXEC)\t\t\t\\\n__PMC_EV(P6, BR_RET_EXEC)\t\t\t\\\n__PMC_EV(P6, BR_RET_MISSP_EXEC)\t\t\t\\\n__PMC_EV(P6, BR_RET_BAC_MISSP_EXEC)\t\t\\\n__PMC_EV(P6, BR_CALL_EXEC)\t\t\t\\\n__PMC_EV(P6, BR_CALL_MISSP_EXEC)\t\t\\\n__PMC_EV(P6, BR_IND_CALL_EXEC)\t\t\t\\\n__PMC_EV(P6, EMON_SIMD_INSTR_RETIRED)\t\t\\\n__PMC_EV(P6, EMON_SYNCH_UOPS)\t\t\t\\\n__PMC_EV(P6, EMON_ESP_UOPS)\t\t\t\\\n__PMC_EV(P6, EMON_FUSED_UOPS_RET)\t\t\\\n__PMC_EV(P6, EMON_UNFUSION)\t\t\t\\\n__PMC_EV(P6, EMON_PREF_RQSTS_UP)\t\t\\\n__PMC_EV(P6, EMON_PREF_RQSTS_DN)\t\t\\\n__PMC_EV(P6, EMON_SSE_SSE2_INST_RETIRED)\t\\\n__PMC_EV(P6, EMON_SSE_SSE2_COMP_INST_RETIRED)\n\n\n#define\tPMC_EV_P6_FIRST\tPMC_EV_P6_DATA_MEM_REFS\n#define\tPMC_EV_P6_LAST\tPMC_EV_P6_EMON_SSE_SSE2_COMP_INST_RETIRED\n\n/* AMD K8 PMCs */\n\n#define\t__PMC_EV_K8()\t\t\t\t\t\t\t\\\n__PMC_EV(K8, FP_DISPATCHED_FPU_OPS)\t\t\t\t\t\\\n__PMC_EV(K8, FP_CYCLES_WITH_NO_FPU_OPS_RETIRED)\t\t\t\t\\\n__PMC_EV(K8, FP_DISPATCHED_FPU_FAST_FLAG_OPS)\t\t\t\t\\\n__PMC_EV(K8, LS_SEGMENT_REGISTER_LOAD)\t\t\t\t\t\\\n__PMC_EV(K8, LS_MICROARCHITECTURAL_RESYNC_BY_SELF_MODIFYING_CODE)\t\\\n__PMC_EV(K8, LS_MICROARCHITECTURAL_RESYNC_BY_SNOOP)\t\t\t\\\n__PMC_EV(K8, LS_BUFFER2_FULL)\t\t\t\t\t\t\\\n__PMC_EV(K8, LS_LOCKED_OPERATION)\t\t\t\t\t\\\n__PMC_EV(K8, LS_MICROARCHITECTURAL_LATE_CANCEL)\t\t\t\t\\\n__PMC_EV(K8, LS_RETIRED_CFLUSH_INSTRUCTIONS)\t\t\t\t\\\n__PMC_EV(K8, LS_RETIRED_CPUID_INSTRUCTIONS)\t\t\t\t\\\n__PMC_EV(K8, DC_ACCESS)\t\t\t\t\t\t\t\\\n__PMC_EV(K8, DC_MISS)\t\t\t\t\t\t\t\\\n__PMC_EV(K8, DC_REFILL_FROM_L2)\t\t\t\t\t\t\\\n__PMC_EV(K8, DC_REFILL_FROM_SYSTEM)\t\t\t\t\t\\\n__PMC_EV(K8, DC_COPYBACK)\t\t\t\t\t\t\\\n__PMC_EV(K8, DC_L1_DTLB_MISS_AND_L2_DTLB_HIT)\t\t\t\t\\\n__PMC_EV(K8, DC_L1_DTLB_MISS_AND_L2_DTLB_MISS)\t\t\t\t\\\n__PMC_EV(K8, DC_MISALIGNED_DATA_REFERENCE)\t\t\t\t\\\n__PMC_EV(K8, DC_MICROARCHITECTURAL_LATE_CANCEL)\t\t\t\t\\\n__PMC_EV(K8, DC_MICROARCHITECTURAL_EARLY_CANCEL)\t\t\t\\\n__PMC_EV(K8, DC_ONE_BIT_ECC_ERROR)\t\t\t\t\t\\\n__PMC_EV(K8, DC_DISPATCHED_PREFETCH_INSTRUCTIONS)\t\t\t\\\n__PMC_EV(K8, DC_DCACHE_ACCESSES_BY_LOCKS)\t\t\t\t\\\n__PMC_EV(K8, BU_CPU_CLK_UNHALTED)\t\t\t\t\t\\\n__PMC_EV(K8, BU_INTERNAL_L2_REQUEST)\t\t\t\t\t\\\n__PMC_EV(K8, BU_FILL_REQUEST_L2_MISS)\t\t\t\t\t\\\n__PMC_EV(K8, BU_FILL_INTO_L2)\t\t\t\t\t\t\\\n__PMC_EV(K8, IC_FETCH)\t\t\t\t\t\t\t\\\n__PMC_EV(K8, IC_MISS)\t\t\t\t\t\t\t\\\n__PMC_EV(K8, IC_REFILL_FROM_L2)\t\t\t\t\t\t\\\n__PMC_EV(K8, IC_REFILL_FROM_SYSTEM)\t\t\t\t\t\\\n__PMC_EV(K8, IC_L1_ITLB_MISS_AND_L2_ITLB_HIT)\t\t\t\t\\\n__PMC_EV(K8, IC_L1_ITLB_MISS_AND_L2_ITLB_MISS)\t\t\t\t\\\n__PMC_EV(K8, IC_MICROARCHITECTURAL_RESYNC_BY_SNOOP)\t\t\t\\\n__PMC_EV(K8, IC_INSTRUCTION_FETCH_STALL)\t\t\t\t\\\n__PMC_EV(K8, IC_RETURN_STACK_HIT)\t\t\t\t\t\\\n__PMC_EV(K8, IC_RETURN_STACK_OVERFLOW)\t\t\t\t\t\\\n__PMC_EV(K8, FR_RETIRED_X86_INSTRUCTIONS)\t\t\t\t\\\n__PMC_EV(K8, FR_RETIRED_UOPS)\t\t\t\t\t\t\\\n__PMC_EV(K8, FR_RETIRED_BRANCHES)\t\t\t\t\t\\\n__PMC_EV(K8, FR_RETIRED_BRANCHES_MISPREDICTED)\t\t\t\t\\\n__PMC_EV(K8, FR_RETIRED_TAKEN_BRANCHES)\t\t\t\t\t\\\n__PMC_EV(K8, FR_RETIRED_TAKEN_BRANCHES_MISPREDICTED)\t\t\t\\\n__PMC_EV(K8, FR_RETIRED_FAR_CONTROL_TRANSFERS)\t\t\t\t\\\n__PMC_EV(K8, FR_RETIRED_RESYNCS)\t\t\t\t\t\\\n__PMC_EV(K8, FR_RETIRED_NEAR_RETURNS)\t\t\t\t\t\\\n__PMC_EV(K8, FR_RETIRED_NEAR_RETURNS_MISPREDICTED)\t\t\t\\\n__PMC_EV(K8, FR_RETIRED_TAKEN_BRANCHES_MISPREDICTED_BY_ADDR_MISCOMPARE)\t\\\n__PMC_EV(K8, FR_RETIRED_FPU_INSTRUCTIONS)\t\t\t\t\\\n__PMC_EV(K8, FR_RETIRED_FASTPATH_DOUBLE_OP_INSTRUCTIONS)\t\t\\\n__PMC_EV(K8, FR_INTERRUPTS_MASKED_CYCLES)\t\t\t\t\\\n__PMC_EV(K8, FR_INTERRUPTS_MASKED_WHILE_PENDING_CYCLES)\t\t\t\\\n__PMC_EV(K8, FR_TAKEN_HARDWARE_INTERRUPTS)\t\t\t\t\\\n__PMC_EV(K8, FR_DECODER_EMPTY)\t\t\t\t\t\t\\\n__PMC_EV(K8, FR_DISPATCH_STALLS)\t\t\t\t\t\\\n__PMC_EV(K8, FR_DISPATCH_STALL_FROM_BRANCH_ABORT_TO_RETIRE)\t\t\\\n__PMC_EV(K8, FR_DISPATCH_STALL_FOR_SERIALIZATION)\t\t\t\\\n__PMC_EV(K8, FR_DISPATCH_STALL_FOR_SEGMENT_LOAD)\t\t\t\\\n__PMC_EV(K8, FR_DISPATCH_STALL_WHEN_REORDER_BUFFER_IS_FULL)\t\t\\\n__PMC_EV(K8, FR_DISPATCH_STALL_WHEN_RESERVATION_STATIONS_ARE_FULL)\t\\\n__PMC_EV(K8, FR_DISPATCH_STALL_WHEN_FPU_IS_FULL)\t\t\t\\\n__PMC_EV(K8, FR_DISPATCH_STALL_WHEN_LS_IS_FULL)\t\t\t\t\\\n__PMC_EV(K8, FR_DISPATCH_STALL_WHEN_WAITING_FOR_ALL_TO_BE_QUIET)\t\\\n__PMC_EV(K8, FR_DISPATCH_STALL_WHEN_FAR_XFER_OR_RESYNC_BRANCH_PENDING)\t\\\n__PMC_EV(K8, FR_FPU_EXCEPTIONS)\t\t\t\t\t\t\\\n__PMC_EV(K8, FR_NUMBER_OF_BREAKPOINTS_FOR_DR0)\t\t\t\t\\\n__PMC_EV(K8, FR_NUMBER_OF_BREAKPOINTS_FOR_DR1)\t\t\t\t\\\n__PMC_EV(K8, FR_NUMBER_OF_BREAKPOINTS_FOR_DR2)\t\t\t\t\\\n__PMC_EV(K8, FR_NUMBER_OF_BREAKPOINTS_FOR_DR3)\t\t\t\t\\\n__PMC_EV(K8, NB_MEMORY_CONTROLLER_PAGE_ACCESS_EVENT)\t\t\t\\\n__PMC_EV(K8, NB_MEMORY_CONTROLLER_PAGE_TABLE_OVERFLOW)\t\t\t\\\n__PMC_EV(K8, NB_MEMORY_CONTROLLER_DRAM_COMMAND_SLOTS_MISSED)\t\t\\\n__PMC_EV(K8, NB_MEMORY_CONTROLLER_TURNAROUND)\t\t\t\t\\\n__PMC_EV(K8, NB_MEMORY_CONTROLLER_BYPASS_SATURATION)\t\t\t\\\n__PMC_EV(K8, NB_SIZED_COMMANDS)\t\t\t\t\t\t\\\n__PMC_EV(K8, NB_PROBE_RESULT)\t\t\t\t\t\t\\\n__PMC_EV(K8, NB_HT_BUS0_BANDWIDTH)\t\t\t\t\t\\\n__PMC_EV(K8, NB_HT_BUS1_BANDWIDTH)\t\t\t\t\t\\\n__PMC_EV(K8, NB_HT_BUS2_BANDWIDTH)\n\n#define\tPMC_EV_K8_FIRST\t\tPMC_EV_K8_FP_DISPATCHED_FPU_OPS\n#define\tPMC_EV_K8_LAST\t\tPMC_EV_K8_NB_HT_BUS2_BANDWIDTH\n\n\n/*\n * Intel Pentium and Pentium MMX events, from the \"Intel 64 and IA-32\n * Architectures Software Developer's Manual, Volume 3B: System Programming\n * Guide, Part 2, August 2007\".\n */\n#define\t__PMC_EV_P5()\t\t\t\t\t\t\t\\\n__PMC_EV(P5, DATA_READ)\t\t\t\t\t\t\t\\\n__PMC_EV(P5, DATA_WRITE)\t\t\t\t\t\t\\\n__PMC_EV(P5, DATA_TLB_MISS)\t\t\t\t\t\t\\\n__PMC_EV(P5, DATA_READ_MISS)\t\t\t\t\t\t\\\n__PMC_EV(P5, DATA_WRITE_MISS)\t\t\t\t\t\t\\\n__PMC_EV(P5, WRITE_HIT_TO_M_OR_E_STATE_LINES)\t\t\t\t\\\n__PMC_EV(P5, DATA_CACHE_LINES_WRITTEN_BACK)\t\t\t\t\\\n__PMC_EV(P5, EXTERNAL_SNOOPS)\t\t\t\t\t\t\\\n__PMC_EV(P5, EXTERNAL_DATA_CACHE_SNOOP_HITS)\t\t\t\t\\\n__PMC_EV(P5, MEMORY_ACCESSES_IN_BOTH_PIPES)\t\t\t\t\\\n__PMC_EV(P5, BANK_CONFLICTS)\t\t\t\t\t\t\\\n__PMC_EV(P5, MISALIGNED_DATA_OR_IO_REFERENCES)\t\t\t\t\\\n__PMC_EV(P5, CODE_READ)\t\t\t\t\t\t\t\\\n__PMC_EV(P5, CODE_TLB_MISS)\t\t\t\t\t\t\\\n__PMC_EV(P5, CODE_CACHE_MISS)\t\t\t\t\t\t\\\n__PMC_EV(P5, ANY_SEGMENT_REGISTER_LOADED)\t\t\t\t\\\n__PMC_EV(P5, BRANCHES)\t\t\t\t\t\t\t\\\n__PMC_EV(P5, BTB_HITS)\t\t\t\t\t\t\t\\\n__PMC_EV(P5, TAKEN_BRANCH_OR_BTB_HIT)\t\t\t\t\t\\\n__PMC_EV(P5, PIPELINE_FLUSHES)\t\t\t\t\t\t\\\n__PMC_EV(P5, INSTRUCTIONS_EXECUTED)\t\t\t\t\t\\\n__PMC_EV(P5, INSTRUCTIONS_EXECUTED_V_PIPE)\t\t\t\t\\\n__PMC_EV(P5, BUS_CYCLE_DURATION)\t\t\t\t\t\\\n__PMC_EV(P5, WRITE_BUFFER_FULL_STALL_DURATION)\t\t\t\t\\\n__PMC_EV(P5, WAITING_FOR_DATA_MEMORY_READ_STALL_DURATION)\t\t\\\n__PMC_EV(P5, STALL_ON_WRITE_TO_AN_E_OR_M_STATE_LINE)\t\t\t\\\n__PMC_EV(P5, LOCKED_BUS_CYCLE)\t\t\t\t\t\t\\\n__PMC_EV(P5, IO_READ_OR_WRITE_CYCLE)\t\t\t\t\t\\\n__PMC_EV(P5, NONCACHEABLE_MEMORY_READS)\t\t\t\t\t\\\n__PMC_EV(P5, PIPELINE_AGI_STALLS)\t\t\t\t\t\\\n__PMC_EV(P5, FLOPS)\t\t\t\t\t\t\t\\\n__PMC_EV(P5, BREAKPOINT_MATCH_ON_DR0_REGISTER)\t\t\t\t\\\n__PMC_EV(P5, BREAKPOINT_MATCH_ON_DR1_REGISTER)\t\t\t\t\\\n__PMC_EV(P5, BREAKPOINT_MATCH_ON_DR2_REGISTER)\t\t\t\t\\\n__PMC_EV(P5, BREAKPOINT_MATCH_ON_DR3_REGISTER)\t\t\t\t\\\n__PMC_EV(P5, HARDWARE_INTERRUPTS)\t\t\t\t\t\\\n__PMC_EV(P5, DATA_READ_OR_WRITE)\t\t\t\t\t\\\n__PMC_EV(P5, DATA_READ_MISS_OR_WRITE_MISS)\t\t\t\t\\\n__PMC_EV(P5, BUS_OWNERSHIP_LATENCY)\t\t\t\t\t\\\n__PMC_EV(P5, BUS_OWNERSHIP_TRANSFERS)\t\t\t\t\t\\\n__PMC_EV(P5, MMX_INSTRUCTIONS_EXECUTED_U_PIPE)\t\t\t\t\\\n__PMC_EV(P5, MMX_INSTRUCTIONS_EXECUTED_V_PIPE)\t\t\t\t\\\n__PMC_EV(P5, CACHE_M_LINE_SHARING)\t\t\t\t\t\\\n__PMC_EV(P5, CACHE_LINE_SHARING)\t\t\t\t\t\\\n__PMC_EV(P5, EMMS_INSTRUCTIONS_EXECUTED)\t\t\t\t\\\n__PMC_EV(P5, TRANSITIONS_BETWEEN_MMX_AND_FP_INSTRUCTIONS)\t\t\\\n__PMC_EV(P5, BUS_UTILIZATION_DUE_TO_PROCESSOR_ACTIVITY)\t\t\t\\\n__PMC_EV(P5, WRITES_TO_NONCACHEABLE_MEMORY)\t\t\t\t\\\n__PMC_EV(P5, SATURATING_MMX_INSTRUCTIONS_EXECUTED)\t\t\t\\\n__PMC_EV(P5, SATURATIONS_PERFORMED)\t\t\t\t\t\\\n__PMC_EV(P5, NUMBER_OF_CYCLES_NOT_IN_HALT_STATE)\t\t\t\\\n__PMC_EV(P5, DATA_CACHE_TLB_MISS_STALL_DURATION)\t\t\t\\\n__PMC_EV(P5, MMX_INSTRUCTION_DATA_READS)\t\t\t\t\\\n__PMC_EV(P5, MMX_INSTRUCTION_DATA_READ_MISSES)\t\t\t\t\\\n__PMC_EV(P5, FLOATING_POINT_STALLS_DURATION)\t\t\t\t\\\n__PMC_EV(P5, TAKEN_BRANCHES)\t\t\t\t\t\t\\\n__PMC_EV(P5, D1_STARVATION_AND_FIFO_IS_EMPTY)\t\t\t\t\\\n__PMC_EV(P5, D1_STARVATION_AND_ONLY_ONE_INSTRUCTION_IN_FIFO)\t\t\\\n__PMC_EV(P5, MMX_INSTRUCTION_DATA_WRITES)\t\t\t\t\\\n__PMC_EV(P5, MMX_INSTRUCTION_DATA_WRITE_MISSES)\t\t\t\t\\\n__PMC_EV(P5, PIPELINE_FLUSHES_DUE_TO_WRONG_BRANCH_PREDICTIONS)\t\t\\\n__PMC_EV(P5,\t\t\t\t\t\t\t\t\\\n    PIPELINE_FLUSHES_DUE_TO_WRONG_BRANCH_PREDICTIONS_RESOLVED_IN_WB_STAGE) \\\n__PMC_EV(P5, MISALIGNED_DATA_MEMORY_REFERENCE_ON_MMX_INSTRUCTIONS)\t\\\n__PMC_EV(P5, PIPELINE_STALL_FOR_MMX_INSTRUCTION_DATA_MEMORY_READS)\t\\\n__PMC_EV(P5, MISPREDICTED_OR_UNPREDICTED_RETURNS)\t\t\t\\\n__PMC_EV(P5, PREDICTED_RETURNS)\t\t\t\t\t\t\\\n__PMC_EV(P5, MMX_MULTIPLY_UNIT_INTERLOCK)\t\t\t\t\\\n__PMC_EV(P5, MOVD_MOVQ_STORE_STALL_DUE_TO_PREVIOUS_MMX_OPERATION)\t\\\n__PMC_EV(P5, RETURNS)\t\t\t\t\t\t\t\\\n__PMC_EV(P5, BTB_FALSE_ENTRIES)\t\t\t\t\t\t\\\n__PMC_EV(P5, BTB_MISS_PREDICTION_ON_NOT_TAKEN_BRANCH)\t\t\t\\\n__PMC_EV(P5,\t\t\t\t\t\t\t\t\\\n    FULL_WRITE_BUFFER_STALL_DURATION_WHILE_EXECUTING_MMX_INSTRUCTIONS)\t\\\n__PMC_EV(P5, STALL_ON_MMX_INSTRUCTION_WRITE_TO_E_OR_M_STATE_LINE)\n\n#define\tPMC_EV_P5_FIRST\t\tPMC_EV_P5_DATA_READ\n#define\tPMC_EV_P5_LAST\t        \\\n\tPMC_EV_P5_STALL_ON_MMX_INSTRUCTION_WRITE_TO_E_OR_M_STATE_LINE\n\n/*\n * Events supported by Intel architectural fixed function counters,\n * from the \"Intel 64 and IA-32 Architectures Software Developer's\n * Manual Volume 3B: System Programming Guide, Part 2\", July 2008.\n */\n#define\t__PMC_EV_IAF()\t\t\t\t\t\t\t\\\n__PMC_EV(IAF, INSTR_RETIRED_ANY)\t\t\t\t\t\\\n__PMC_EV(IAF, CPU_CLK_UNHALTED_CORE)\t\t\t\t\t\\\n__PMC_EV(IAF, CPU_CLK_UNHALTED_REF)\n\n#define\tPMC_EV_IAF_FIRST\tPMC_EV_IAF_INSTR_RETIRED_ANY\n#define\tPMC_EV_IAF_LAST\t\tPMC_EV_IAF_CPU_CLK_UNHALTED_REF\n\n#define\t__PMC_EV_ALIAS_IAF()\t\t\t\t\t\t\\\n__PMC_EV_ALIAS(\"instruction-retired\",\tIAF_INSTR_RETIRED_ANY)\t\t\\\n__PMC_EV_ALIAS(\"unhalted-core-cycles\",\tIAF_CPU_CLK_UNHALTED_CORE)\t\\\n__PMC_EV_ALIAS(\"unhalted-reference-cycles\", IAF_CPU_CLK_UNHALTED_REF)\n\n/*\n * Events supported by programmable function counters present in\n * Intel Atom, Core and Core2 CPUs, from the \"Intel 64 and IA-32\n * Architectures Software Developer's Manual Volume 3B: System Programming\n * Guide, Part 2\", July 2008.\n *\n * These PMCs select events with a combination of an event code and\n * unit mask.  Quirks that need to be taken care of include:\n * - The set of (event code, umask) combinations supported by a processor\n *   varies according to the processor model.\n * - A given (event code, umask) combination need not measure the same\n *   hardware event in all processor models.\n * - Event names in vendor documentation for an (event code, umask) pair\n *   may vary according to the CPU model.\n * - Identically named events can map to different (event code, umask)\n *   pairs on different CPUs.\n * - New (event code, umask) combinations continue to be added as CPUs\n *   evolve.  The interface between hwpmc(4) and libpmc(3) needs to be\n *   robust with respect to ABI changes.\n *\n * The IAP_EVENT_* symbols below define the ABI between userland and kernel.\n * New (event code, * umask) combinations used in new CPUs would be added\n * to the end of the list.  Vendor names for events are mapped to IAP_EVENT_*\n * symbols using aliases.  The final disambiguation of semantics based on\n * the CPU model happens inside hwpmc(4).\n */\n#define\t__PMC_EV_IAP()\t\t\t\t\\\n__PMC_EV(IAP, EVENT_02H_01H)\t\t\t\\\n__PMC_EV(IAP, EVENT_02H_81H)\t\t\t\\\n__PMC_EV(IAP, EVENT_03H_00H)\t\t\t\\\n__PMC_EV(IAP, EVENT_03H_01H)\t\t\t\\\n__PMC_EV(IAP, EVENT_03H_02H)\t\t\t\\\n__PMC_EV(IAP, EVENT_03H_04H)\t\t\t\\\n__PMC_EV(IAP, EVENT_03H_08H)\t\t\t\\\n__PMC_EV(IAP, EVENT_03H_10H)\t\t\t\\\n__PMC_EV(IAP, EVENT_03H_20H)\t\t\t\\\n__PMC_EV(IAP, EVENT_04H_00H)\t\t\t\\\n__PMC_EV(IAP, EVENT_04H_01H)\t\t\t\\\n__PMC_EV(IAP, EVENT_04H_02H)\t\t\t\\\n__PMC_EV(IAP, EVENT_04H_07H)\t\t\t\\\n__PMC_EV(IAP, EVENT_04H_08H)\t\t\t\\\n__PMC_EV(IAP, EVENT_05H_00H)\t\t\t\\\n__PMC_EV(IAP, EVENT_05H_01H)\t\t\t\\\n__PMC_EV(IAP, EVENT_05H_02H)\t\t\t\\\n__PMC_EV(IAP, EVENT_05H_03H)\t\t\t\\\n__PMC_EV(IAP, EVENT_06H_00H)\t\t\t\\\n__PMC_EV(IAP, EVENT_06H_01H)\t\t\t\\\n__PMC_EV(IAP, EVENT_06H_02H)\t\t\t\\\n__PMC_EV(IAP, EVENT_06H_04H)\t\t\t\\\n__PMC_EV(IAP, EVENT_06H_08H)\t\t\t\\\n__PMC_EV(IAP, EVENT_06H_0FH)\t\t\t\\\n__PMC_EV(IAP, EVENT_07H_00H)\t\t\t\\\n__PMC_EV(IAP, EVENT_07H_01H)\t\t\t\\\n__PMC_EV(IAP, EVENT_07H_02H)\t\t\t\\\n__PMC_EV(IAP, EVENT_07H_03H)\t\t\t\\\n__PMC_EV(IAP, EVENT_07H_06H)\t\t\t\\\n__PMC_EV(IAP, EVENT_07H_08H)\t\t\t\\\n__PMC_EV(IAP, EVENT_08H_01H)\t\t\t\\\n__PMC_EV(IAP, EVENT_08H_02H)\t\t\t\\\n__PMC_EV(IAP, EVENT_08H_04H)\t\t\t\\\n__PMC_EV(IAP, EVENT_08H_05H)\t\t\t\\\n__PMC_EV(IAP, EVENT_08H_06H)\t\t\t\\\n__PMC_EV(IAP, EVENT_08H_07H)\t\t\t\\\n__PMC_EV(IAP, EVENT_08H_08H)\t\t\t\\\n__PMC_EV(IAP, EVENT_08H_09H)\t\t\t\\\n__PMC_EV(IAP, EVENT_08H_10H)\t\t\t\\\n__PMC_EV(IAP, EVENT_08H_20H)\t\t\t\\\n__PMC_EV(IAP, EVENT_08H_40H)\t\t\t\\\n__PMC_EV(IAP, EVENT_08H_80H)\t\t\t\\\n__PMC_EV(IAP, EVENT_09H_01H)\t\t\t\\\n__PMC_EV(IAP, EVENT_09H_02H)\t\t\t\\\n__PMC_EV(IAP, EVENT_09H_04H)\t\t\t\\\n__PMC_EV(IAP, EVENT_09H_08H)\t\t\t\\\n__PMC_EV(IAP, EVENT_0BH_01H)\t\t\t\\\n__PMC_EV(IAP, EVENT_0BH_02H)\t\t\t\\\n__PMC_EV(IAP, EVENT_0BH_10H)\t\t\t\\\n__PMC_EV(IAP, EVENT_0CH_01H)\t\t\t\\\n__PMC_EV(IAP, EVENT_0CH_02H)\t\t\t\\\n__PMC_EV(IAP, EVENT_0CH_03H)\t\t\t\\\n__PMC_EV(IAP, EVENT_0EH_01H)\t\t\t\\\n__PMC_EV(IAP, EVENT_0EH_02H)\t\t\t\\\n__PMC_EV(IAP, EVENT_0FH_01H)\t\t\t\\\n__PMC_EV(IAP, EVENT_0FH_02H)\t\t\t\\\n__PMC_EV(IAP, EVENT_0FH_08H)\t\t\t\\\n__PMC_EV(IAP, EVENT_0FH_10H)\t\t\t\\\n__PMC_EV(IAP, EVENT_0FH_20H)\t\t\t\\\n__PMC_EV(IAP, EVENT_0FH_80H)\t\t\t\\\n__PMC_EV(IAP, EVENT_10H_00H)\t\t\t\\\n__PMC_EV(IAP, EVENT_10H_01H)\t\t\t\\\n__PMC_EV(IAP, EVENT_10H_02H)\t\t\t\\\n__PMC_EV(IAP, EVENT_10H_04H)\t\t\t\\\n__PMC_EV(IAP, EVENT_10H_08H)\t\t\t\\\n__PMC_EV(IAP, EVENT_10H_10H)\t\t\t\\\n__PMC_EV(IAP, EVENT_10H_20H)\t\t\t\\\n__PMC_EV(IAP, EVENT_10H_40H)\t\t\t\\\n__PMC_EV(IAP, EVENT_10H_80H)\t\t\t\\\n__PMC_EV(IAP, EVENT_10H_81H)\t\t\t\\\n__PMC_EV(IAP, EVENT_11H_00H)\t\t\t\\\n__PMC_EV(IAP, EVENT_11H_01H)\t\t\t\\\n__PMC_EV(IAP, EVENT_11H_81H)\t\t\t\\\n__PMC_EV(IAP, EVENT_12H_00H)\t\t\t\\\n__PMC_EV(IAP, EVENT_12H_01H)\t\t\t\\\n__PMC_EV(IAP, EVENT_12H_02H)\t\t\t\\\n__PMC_EV(IAP, EVENT_12H_04H)\t\t\t\\\n__PMC_EV(IAP, EVENT_12H_08H)\t\t\t\\\n__PMC_EV(IAP, EVENT_12H_10H)\t\t\t\\\n__PMC_EV(IAP, EVENT_12H_20H)\t\t\t\\\n__PMC_EV(IAP, EVENT_12H_40H)\t\t\t\\\n__PMC_EV(IAP, EVENT_12H_81H)\t\t\t\\\n__PMC_EV(IAP, EVENT_13H_00H)\t\t\t\\\n__PMC_EV(IAP, EVENT_13H_01H)\t\t\t\\\n__PMC_EV(IAP, EVENT_13H_02H)\t\t\t\\\n__PMC_EV(IAP, EVENT_13H_04H)\t\t\t\\\n__PMC_EV(IAP, EVENT_13H_07H)\t\t\t\\\n__PMC_EV(IAP, EVENT_13H_81H)\t\t\t\\\n__PMC_EV(IAP, EVENT_14H_00H)\t\t\t\\\n__PMC_EV(IAP, EVENT_14H_01H)\t\t\t\\\n__PMC_EV(IAP, EVENT_14H_02H)\t\t\t\\\n__PMC_EV(IAP, EVENT_17H_01H)\t\t\t\\\n__PMC_EV(IAP, EVENT_18H_00H)\t\t\t\\\n__PMC_EV(IAP, EVENT_18H_01H)\t\t\t\\\n__PMC_EV(IAP, EVENT_19H_00H)\t\t\t\\\n__PMC_EV(IAP, EVENT_19H_01H)\t\t\t\\\n__PMC_EV(IAP, EVENT_19H_02H)\t\t\t\\\n__PMC_EV(IAP, EVENT_1DH_01H)\t\t\t\\\n__PMC_EV(IAP, EVENT_1DH_02H)\t\t\t\\\n__PMC_EV(IAP, EVENT_1DH_04H)\t\t\t\\\n__PMC_EV(IAP, EVENT_1EH_01H)\t\t\t\\\n__PMC_EV(IAP, EVENT_20H_01H)\t\t\t\\\n__PMC_EV(IAP, EVENT_21H)\t\t\t\\\n__PMC_EV(IAP, EVENT_22H)\t\t\t\\\n__PMC_EV(IAP, EVENT_23H)\t\t\t\\\n__PMC_EV(IAP, EVENT_24H)\t\t\t\\\n__PMC_EV(IAP, EVENT_24H_01H)\t\t\t\\\n__PMC_EV(IAP, EVENT_24H_02H)\t\t\t\\\n__PMC_EV(IAP, EVENT_24H_03H)\t\t\t\\\n__PMC_EV(IAP, EVENT_24H_04H)\t\t\t\\\n__PMC_EV(IAP, EVENT_24H_08H)\t\t\t\\\n__PMC_EV(IAP, EVENT_24H_0CH)\t\t\t\\\n__PMC_EV(IAP, EVENT_24H_10H)\t\t\t\\\n__PMC_EV(IAP, EVENT_24H_20H)\t\t\t\\\n__PMC_EV(IAP, EVENT_24H_30H)\t\t\t\\\n__PMC_EV(IAP, EVENT_24H_40H)\t\t\t\\\n__PMC_EV(IAP, EVENT_24H_80H)\t\t\t\\\n__PMC_EV(IAP, EVENT_24H_AAH)\t\t\t\\\n__PMC_EV(IAP, EVENT_24H_C0H)\t\t\t\\\n__PMC_EV(IAP, EVENT_24H_FFH)\t\t\t\\\n__PMC_EV(IAP, EVENT_25H)\t\t\t\\\n__PMC_EV(IAP, EVENT_26H)\t\t\t\\\n__PMC_EV(IAP, EVENT_26H_01H)\t\t\t\\\n__PMC_EV(IAP, EVENT_26H_02H)\t\t\t\\\n__PMC_EV(IAP, EVENT_26H_04H)\t\t\t\\\n__PMC_EV(IAP, EVENT_26H_08H)\t\t\t\\\n__PMC_EV(IAP, EVENT_26H_0FH)\t\t\t\\\n__PMC_EV(IAP, EVENT_26H_10H)\t\t\t\\\n__PMC_EV(IAP, EVENT_26H_20H)\t\t\t\\\n__PMC_EV(IAP, EVENT_26H_40H)\t\t\t\\\n__PMC_EV(IAP, EVENT_26H_80H)\t\t\t\\\n__PMC_EV(IAP, EVENT_26H_F0H)\t\t\t\\\n__PMC_EV(IAP, EVENT_26H_FFH)\t\t\t\\\n__PMC_EV(IAP, EVENT_27H)\t\t\t\\\n__PMC_EV(IAP, EVENT_27H_01H)\t\t\t\\\n__PMC_EV(IAP, EVENT_27H_02H)\t\t\t\\\n__PMC_EV(IAP, EVENT_27H_04H)\t\t\t\\\n__PMC_EV(IAP, EVENT_27H_08H)\t\t\t\\\n__PMC_EV(IAP, EVENT_27H_0EH)\t\t\t\\\n__PMC_EV(IAP, EVENT_27H_0FH)\t\t\t\\\n__PMC_EV(IAP, EVENT_27H_10H)\t\t\t\\\n__PMC_EV(IAP, EVENT_27H_20H)\t\t\t\\\n__PMC_EV(IAP, EVENT_27H_40H)\t\t\t\\\n__PMC_EV(IAP, EVENT_27H_80H)\t\t\t\\\n__PMC_EV(IAP, EVENT_27H_E0H)\t\t\t\\\n__PMC_EV(IAP, EVENT_27H_F0H)\t\t\t\\\n__PMC_EV(IAP, EVENT_28H)\t\t\t\\\n__PMC_EV(IAP, EVENT_28H_01H)\t\t\t\\\n__PMC_EV(IAP, EVENT_28H_02H)\t\t\t\\\n__PMC_EV(IAP, EVENT_28H_04H)\t\t\t\\\n__PMC_EV(IAP, EVENT_28H_08H)\t\t\t\\\n__PMC_EV(IAP, EVENT_28H_0FH)\t\t\t\\\n__PMC_EV(IAP, EVENT_29H)\t\t\t\\\n__PMC_EV(IAP, EVENT_2AH)\t\t\t\\\n__PMC_EV(IAP, EVENT_2BH)\t\t\t\\\n__PMC_EV(IAP, EVENT_2EH)\t\t\t\\\n__PMC_EV(IAP, EVENT_2EH_01H)\t\t\t\\\n__PMC_EV(IAP, EVENT_2EH_02H)\t\t\t\\\n__PMC_EV(IAP, EVENT_2EH_41H)\t\t\t\\\n__PMC_EV(IAP, EVENT_2EH_4FH)\t\t\t\\\n__PMC_EV(IAP, EVENT_30H)\t\t\t\\\n__PMC_EV(IAP, EVENT_32H)\t\t\t\\\n__PMC_EV(IAP, EVENT_3AH)\t\t\t\\\n__PMC_EV(IAP, EVENT_3AH_00H)\t\t\t\\\n__PMC_EV(IAP, EVENT_3BH_C0H)\t\t\t\\\n__PMC_EV(IAP, EVENT_3CH_00H)\t\t\t\\\n__PMC_EV(IAP, EVENT_3CH_01H)\t\t\t\\\n__PMC_EV(IAP, EVENT_3CH_02H)\t\t\t\\\n__PMC_EV(IAP, EVENT_3DH_01H)\t\t\t\\\n__PMC_EV(IAP, EVENT_40H)\t\t\t\\\n__PMC_EV(IAP, EVENT_40H_01H)\t\t\t\\\n__PMC_EV(IAP, EVENT_40H_02H)\t\t\t\\\n__PMC_EV(IAP, EVENT_40H_04H)\t\t\t\\\n__PMC_EV(IAP, EVENT_40H_08H)\t\t\t\\\n__PMC_EV(IAP, EVENT_40H_0FH)\t\t\t\\\n__PMC_EV(IAP, EVENT_40H_21H)\t\t\t\\\n__PMC_EV(IAP, EVENT_41H)\t\t\t\\\n__PMC_EV(IAP, EVENT_41H_01H)\t\t\t\\\n__PMC_EV(IAP, EVENT_41H_02H)\t\t\t\\\n__PMC_EV(IAP, EVENT_41H_04H)\t\t\t\\\n__PMC_EV(IAP, EVENT_41H_08H)\t\t\t\\\n__PMC_EV(IAP, EVENT_41H_0FH)\t\t\t\\\n__PMC_EV(IAP, EVENT_41H_22H)\t\t\t\\\n__PMC_EV(IAP, EVENT_42H)\t\t\t\\\n__PMC_EV(IAP, EVENT_42H_01H)\t\t\t\\\n__PMC_EV(IAP, EVENT_42H_02H)\t\t\t\\\n__PMC_EV(IAP, EVENT_42H_04H)\t\t\t\\\n__PMC_EV(IAP, EVENT_42H_08H)\t\t\t\\\n__PMC_EV(IAP, EVENT_42H_10H)\t\t\t\\\n__PMC_EV(IAP, EVENT_43H_01H)\t\t\t\\\n__PMC_EV(IAP, EVENT_43H_02H)\t\t\t\\\n__PMC_EV(IAP, EVENT_44H_02H)\t\t\t\\\n__PMC_EV(IAP, EVENT_45H_0FH)\t\t\t\\\n__PMC_EV(IAP, EVENT_46H_00H)\t\t\t\\\n__PMC_EV(IAP, EVENT_47H_00H)\t\t\t\\\n__PMC_EV(IAP, EVENT_48H_00H)\t\t\t\\\n__PMC_EV(IAP, EVENT_48H_02H)\t\t\t\\\n__PMC_EV(IAP, EVENT_49H_00H)\t\t\t\\\n__PMC_EV(IAP, EVENT_49H_01H)\t\t\t\\\n__PMC_EV(IAP, EVENT_49H_02H)\t\t\t\\\n__PMC_EV(IAP, EVENT_49H_04H)\t\t\t\\\n__PMC_EV(IAP, EVENT_49H_10H)\t\t\t\\\n__PMC_EV(IAP, EVENT_49H_20H)\t\t\t\\\n__PMC_EV(IAP, EVENT_49H_40H)\t\t\t\\\n__PMC_EV(IAP, EVENT_49H_80H)\t\t\t\\\n__PMC_EV(IAP, EVENT_4BH_00H)\t\t\t\\\n__PMC_EV(IAP, EVENT_4BH_01H)\t\t\t\\\n__PMC_EV(IAP, EVENT_4BH_02H)\t\t\t\\\n__PMC_EV(IAP, EVENT_4BH_03H)\t\t\t\\\n__PMC_EV(IAP, EVENT_4BH_08H)\t\t\t\\\n__PMC_EV(IAP, EVENT_4CH_00H)\t\t\t\\\n__PMC_EV(IAP, EVENT_4CH_01H)\t\t\t\\\n__PMC_EV(IAP, EVENT_4DH_01H)\t\t\t\\\n__PMC_EV(IAP, EVENT_4EH_01H)\t\t\t\\\n__PMC_EV(IAP, EVENT_4EH_02H)\t\t\t\\\n__PMC_EV(IAP, EVENT_4EH_04H)\t\t\t\\\n__PMC_EV(IAP, EVENT_4EH_10H)\t\t\t\\\n__PMC_EV(IAP, EVENT_4FH_00H)\t\t\t\\\n__PMC_EV(IAP, EVENT_4FH_02H)\t\t\t\\\n__PMC_EV(IAP, EVENT_4FH_04H)\t\t\t\\\n__PMC_EV(IAP, EVENT_4FH_08H)\t\t\t\\\n__PMC_EV(IAP, EVENT_4FH_10H)\t\t\t\\\n__PMC_EV(IAP, EVENT_51H_01H)\t\t\t\\\n__PMC_EV(IAP, EVENT_51H_02H)\t\t\t\\\n__PMC_EV(IAP, EVENT_51H_04H)\t\t\t\\\n__PMC_EV(IAP, EVENT_51H_08H)\t\t\t\\\n__PMC_EV(IAP, EVENT_52H_01H)\t\t\t\\\n__PMC_EV(IAP, EVENT_53H_01H)\t\t\t\\\n__PMC_EV(IAP, EVENT_60H)\t\t\t\\\n__PMC_EV(IAP, EVENT_60H_01H)\t\t\t\\\n__PMC_EV(IAP, EVENT_60H_02H)\t\t\t\\\n__PMC_EV(IAP, EVENT_60H_04H)\t\t\t\\\n__PMC_EV(IAP, EVENT_60H_08H)\t\t\t\\\n__PMC_EV(IAP, EVENT_61H)\t\t\t\\\n__PMC_EV(IAP, EVENT_61H_00H)\t\t\t\\\n__PMC_EV(IAP, EVENT_62H)\t\t\t\\\n__PMC_EV(IAP, EVENT_62H_00H)\t\t\t\\\n__PMC_EV(IAP, EVENT_63H)\t\t\t\\\n__PMC_EV(IAP, EVENT_63H_01H)\t\t\t\\\n__PMC_EV(IAP, EVENT_63H_02H)\t\t\t\\\n__PMC_EV(IAP, EVENT_64H)\t\t\t\\\n__PMC_EV(IAP, EVENT_64H_40H)\t\t\t\\\n__PMC_EV(IAP, EVENT_65H)\t\t\t\\\n__PMC_EV(IAP, EVENT_66H)\t\t\t\\\n__PMC_EV(IAP, EVENT_67H)\t\t\t\\\n__PMC_EV(IAP, EVENT_68H)\t\t\t\\\n__PMC_EV(IAP, EVENT_69H)\t\t\t\\\n__PMC_EV(IAP, EVENT_6AH)\t\t\t\\\n__PMC_EV(IAP, EVENT_6BH)\t\t\t\\\n__PMC_EV(IAP, EVENT_6CH)\t\t\t\\\n__PMC_EV(IAP, EVENT_6CH_01H)\t\t\t\\\n__PMC_EV(IAP, EVENT_6DH)\t\t\t\\\n__PMC_EV(IAP, EVENT_6EH)\t\t\t\\\n__PMC_EV(IAP, EVENT_6FH)\t\t\t\\\n__PMC_EV(IAP, EVENT_70H)\t\t\t\\\n__PMC_EV(IAP, EVENT_77H)\t\t\t\\\n__PMC_EV(IAP, EVENT_78H)\t\t\t\\\n__PMC_EV(IAP, EVENT_7AH)\t\t\t\\\n__PMC_EV(IAP, EVENT_7BH)\t\t\t\\\n__PMC_EV(IAP, EVENT_7DH)\t\t\t\\\n__PMC_EV(IAP, EVENT_7EH)\t\t\t\\\n__PMC_EV(IAP, EVENT_7EH_00H)\t\t\t\\\n__PMC_EV(IAP, EVENT_7FH)\t\t\t\\\n__PMC_EV(IAP, EVENT_80H_00H)\t\t\t\\\n__PMC_EV(IAP, EVENT_80H_01H)\t\t\t\\\n__PMC_EV(IAP, EVENT_80H_02H)\t\t\t\\\n__PMC_EV(IAP, EVENT_80H_03H)\t\t\t\\\n__PMC_EV(IAP, EVENT_80H_04H)\t\t\t\\\n__PMC_EV(IAP, EVENT_80H_10H)\t\t\t\\\n__PMC_EV(IAP, EVENT_81H_00H)\t\t\t\\\n__PMC_EV(IAP, EVENT_81H_01H)\t\t\t\\\n__PMC_EV(IAP, EVENT_81H_02H)\t\t\t\\\n__PMC_EV(IAP, EVENT_82H_01H)\t\t\t\\\n__PMC_EV(IAP, EVENT_82H_02H)\t\t\t\\\n__PMC_EV(IAP, EVENT_82H_04H)\t\t\t\\\n__PMC_EV(IAP, EVENT_82H_10H)\t\t\t\\\n__PMC_EV(IAP, EVENT_82H_12H)\t\t\t\\\n__PMC_EV(IAP, EVENT_82H_40H)\t\t\t\\\n__PMC_EV(IAP, EVENT_83H_01H)\t\t\t\\\n__PMC_EV(IAP, EVENT_83H_02H)\t\t\t\\\n__PMC_EV(IAP, EVENT_85H_00H)\t\t\t\\\n__PMC_EV(IAP, EVENT_85H_01H)\t\t\t\\\n__PMC_EV(IAP, EVENT_85H_02H)\t\t\t\\\n__PMC_EV(IAP, EVENT_85H_04H)\t\t\t\\\n__PMC_EV(IAP, EVENT_85H_10H)\t\t\t\\\n__PMC_EV(IAP, EVENT_85H_20H)\t\t\t\\\n__PMC_EV(IAP, EVENT_85H_40H)\t\t\t\\\n__PMC_EV(IAP, EVENT_85H_80H)\t\t\t\\\n__PMC_EV(IAP, EVENT_86H_00H)\t\t\t\\\n__PMC_EV(IAP, EVENT_87H_00H)\t\t\t\\\n__PMC_EV(IAP, EVENT_87H_01H)\t\t\t\\\n__PMC_EV(IAP, EVENT_87H_02H)\t\t\t\\\n__PMC_EV(IAP, EVENT_87H_04H)\t\t\t\\\n__PMC_EV(IAP, EVENT_87H_08H)\t\t\t\\\n__PMC_EV(IAP, EVENT_87H_0FH)\t\t\t\\\n__PMC_EV(IAP, EVENT_88H_00H)\t\t\t\\\n__PMC_EV(IAP, EVENT_88H_01H)\t\t\t\\\n__PMC_EV(IAP, EVENT_88H_02H)\t\t\t\\\n__PMC_EV(IAP, EVENT_88H_04H)\t\t\t\\\n__PMC_EV(IAP, EVENT_88H_07H)\t\t\t\\\n__PMC_EV(IAP, EVENT_88H_08H)\t\t\t\\\n__PMC_EV(IAP, EVENT_88H_10H)\t\t\t\\\n__PMC_EV(IAP, EVENT_88H_20H)\t\t\t\\\n__PMC_EV(IAP, EVENT_88H_30H)\t\t\t\\\n__PMC_EV(IAP, EVENT_88H_40H)\t\t\t\\\n__PMC_EV(IAP, EVENT_88H_7FH)\t\t\t\\\n__PMC_EV(IAP, EVENT_89H_00H)\t\t\t\\\n__PMC_EV(IAP, EVENT_89H_01H)\t\t\t\\\n__PMC_EV(IAP, EVENT_89H_02H)\t\t\t\\\n__PMC_EV(IAP, EVENT_89H_04H)\t\t\t\\\n__PMC_EV(IAP, EVENT_89H_07H)\t\t\t\\\n__PMC_EV(IAP, EVENT_89H_08H)\t\t\t\\\n__PMC_EV(IAP, EVENT_89H_10H)\t\t\t\\\n__PMC_EV(IAP, EVENT_89H_20H)\t\t\t\\\n__PMC_EV(IAP, EVENT_89H_30H)\t\t\t\\\n__PMC_EV(IAP, EVENT_89H_40H)\t\t\t\\\n__PMC_EV(IAP, EVENT_89H_7FH)\t\t\t\\\n__PMC_EV(IAP, EVENT_8AH_00H)\t\t\t\\\n__PMC_EV(IAP, EVENT_8BH_00H)\t\t\t\\\n__PMC_EV(IAP, EVENT_8CH_00H)\t\t\t\\\n__PMC_EV(IAP, EVENT_8DH_00H)\t\t\t\\\n__PMC_EV(IAP, EVENT_8EH_00H)\t\t\t\\\n__PMC_EV(IAP, EVENT_8FH_00H)\t\t\t\\\n__PMC_EV(IAP, EVENT_90H_00H)\t\t\t\\\n__PMC_EV(IAP, EVENT_91H_00H)\t\t\t\\\n__PMC_EV(IAP, EVENT_92H_00H)\t\t\t\\\n__PMC_EV(IAP, EVENT_93H_00H)\t\t\t\\\n__PMC_EV(IAP, EVENT_94H_00H)\t\t\t\\\n__PMC_EV(IAP, EVENT_97H_00H)\t\t\t\\\n__PMC_EV(IAP, EVENT_98H_00H)\t\t\t\\\n__PMC_EV(IAP, EVENT_A0H_00H)\t\t\t\\\n__PMC_EV(IAP, EVENT_A1H_01H)\t\t\t\\\n__PMC_EV(IAP, EVENT_A1H_02H)\t\t\t\\\n__PMC_EV(IAP, EVENT_A1H_04H)\t\t\t\\\n__PMC_EV(IAP, EVENT_A1H_08H)\t\t\t\\\n__PMC_EV(IAP, EVENT_A1H_10H)\t\t\t\\\n__PMC_EV(IAP, EVENT_A1H_20H)\t\t\t\\\n__PMC_EV(IAP, EVENT_A2H_00H)\t\t\t\\\n__PMC_EV(IAP, EVENT_A2H_01H)\t\t\t\\\n__PMC_EV(IAP, EVENT_A2H_02H)\t\t\t\\\n__PMC_EV(IAP, EVENT_A2H_04H)\t\t\t\\\n__PMC_EV(IAP, EVENT_A2H_08H)\t\t\t\\\n__PMC_EV(IAP, EVENT_A2H_10H)\t\t\t\\\n__PMC_EV(IAP, EVENT_A2H_20H)\t\t\t\\\n__PMC_EV(IAP, EVENT_A2H_40H)\t\t\t\\\n__PMC_EV(IAP, EVENT_A2H_80H)\t\t\t\\\n__PMC_EV(IAP, EVENT_A6H_01H)\t\t\t\\\n__PMC_EV(IAP, EVENT_A7H_01H)\t\t\t\\\n__PMC_EV(IAP, EVENT_A8H_01H)\t\t\t\\\n__PMC_EV(IAP, EVENT_AAH_01H)\t\t\t\\\n__PMC_EV(IAP, EVENT_AAH_02H)\t\t\t\\\n__PMC_EV(IAP, EVENT_AAH_03H)\t\t\t\\\n__PMC_EV(IAP, EVENT_AAH_08H)\t\t\t\\\n__PMC_EV(IAP, EVENT_ABH_01H)\t\t\t\\\n__PMC_EV(IAP, EVENT_ABH_02H)\t\t\t\\\n__PMC_EV(IAP, EVENT_AEH_01H)\t\t\t\\\n__PMC_EV(IAP, EVENT_B0H_00H)\t\t\t\\\n__PMC_EV(IAP, EVENT_B0H_01H)\t\t\t\\\n__PMC_EV(IAP, EVENT_B0H_02H)\t\t\t\\\n__PMC_EV(IAP, EVENT_B0H_04H)\t\t\t\\\n__PMC_EV(IAP, EVENT_B0H_08H)\t\t\t\\\n__PMC_EV(IAP, EVENT_B0H_10H)\t\t\t\\\n__PMC_EV(IAP, EVENT_B0H_20H)\t\t\t\\\n__PMC_EV(IAP, EVENT_B0H_40H)\t\t\t\\\n__PMC_EV(IAP, EVENT_B0H_80H)\t\t\t\\\n__PMC_EV(IAP, EVENT_B1H_00H)\t\t\t\\\n__PMC_EV(IAP, EVENT_B1H_01H)\t\t\t\\\n__PMC_EV(IAP, EVENT_B1H_02H)\t\t\t\\\n__PMC_EV(IAP, EVENT_B1H_04H)\t\t\t\\\n__PMC_EV(IAP, EVENT_B1H_08H)\t\t\t\\\n__PMC_EV(IAP, EVENT_B1H_10H)\t\t\t\\\n__PMC_EV(IAP, EVENT_B1H_1FH)\t\t\t\\\n__PMC_EV(IAP, EVENT_B1H_20H)\t\t\t\\\n__PMC_EV(IAP, EVENT_B1H_3FH)\t\t\t\\\n__PMC_EV(IAP, EVENT_B1H_40H)\t\t\t\\\n__PMC_EV(IAP, EVENT_B1H_80H)\t\t\t\\\n__PMC_EV(IAP, EVENT_B2H_01H)\t\t\t\\\n__PMC_EV(IAP, EVENT_B3H_01H)\t\t\t\\\n__PMC_EV(IAP, EVENT_B3H_02H)\t\t\t\\\n__PMC_EV(IAP, EVENT_B3H_04H)\t\t\t\\\n__PMC_EV(IAP, EVENT_B3H_08H)\t\t\t\\\n__PMC_EV(IAP, EVENT_B3H_10H)\t\t\t\\\n__PMC_EV(IAP, EVENT_B3H_20H)\t\t\t\\\n__PMC_EV(IAP, EVENT_B3H_81H)\t\t\t\\\n__PMC_EV(IAP, EVENT_B3H_82H)\t\t\t\\\n__PMC_EV(IAP, EVENT_B3H_84H)\t\t\t\\\n__PMC_EV(IAP, EVENT_B3H_88H)\t\t\t\\\n__PMC_EV(IAP, EVENT_B3H_90H)\t\t\t\\\n__PMC_EV(IAP, EVENT_B3H_A0H)\t\t\t\\\n__PMC_EV(IAP, EVENT_B4H_01H)\t\t\t\\\n__PMC_EV(IAP, EVENT_B4H_02H)\t\t\t\\\n__PMC_EV(IAP, EVENT_B4H_04H)\t\t\t\\\n__PMC_EV(IAP, EVENT_B7H_01H)\t\t\t\\\n__PMC_EV(IAP, EVENT_B8H_01H)\t\t\t\\\n__PMC_EV(IAP, EVENT_B8H_02H)\t\t\t\\\n__PMC_EV(IAP, EVENT_B8H_04H)\t\t\t\\\n__PMC_EV(IAP, EVENT_BAH_01H)\t\t\t\\\n__PMC_EV(IAP, EVENT_BAH_02H)\t\t\t\\\n__PMC_EV(IAP, EVENT_BBH_01H)\t\t\t\\\n__PMC_EV(IAP, EVENT_C0H_00H)\t\t\t\\\n__PMC_EV(IAP, EVENT_C0H_01H)\t\t\t\\\n__PMC_EV(IAP, EVENT_C0H_02H)\t\t\t\\\n__PMC_EV(IAP, EVENT_C0H_04H)\t\t\t\\\n__PMC_EV(IAP, EVENT_C0H_08H)\t\t\t\\\n__PMC_EV(IAP, EVENT_C1H_00H)\t\t\t\\\n__PMC_EV(IAP, EVENT_C1H_01H)\t\t\t\\\n__PMC_EV(IAP, EVENT_C1H_FEH)\t\t\t\\\n__PMC_EV(IAP, EVENT_C2H_00H)\t\t\t\\\n__PMC_EV(IAP, EVENT_C2H_01H)\t\t\t\\\n__PMC_EV(IAP, EVENT_C2H_02H)\t\t\t\\\n__PMC_EV(IAP, EVENT_C2H_04H)\t\t\t\\\n__PMC_EV(IAP, EVENT_C2H_07H)\t\t\t\\\n__PMC_EV(IAP, EVENT_C2H_08H)\t\t\t\\\n__PMC_EV(IAP, EVENT_C2H_0FH)\t\t\t\\\n__PMC_EV(IAP, EVENT_C2H_10H)\t\t\t\\\n__PMC_EV(IAP, EVENT_C3H_00H)\t\t\t\\\n__PMC_EV(IAP, EVENT_C3H_01H)\t\t\t\\\n__PMC_EV(IAP, EVENT_C3H_02H)\t\t\t\\\n__PMC_EV(IAP, EVENT_C3H_04H)\t\t\t\\\n__PMC_EV(IAP, EVENT_C3H_10H)\t\t\t\\\n__PMC_EV(IAP, EVENT_C4H_00H)\t\t\t\\\n__PMC_EV(IAP, EVENT_C4H_01H)\t\t\t\\\n__PMC_EV(IAP, EVENT_C4H_02H)\t\t\t\\\n__PMC_EV(IAP, EVENT_C4H_04H)\t\t\t\\\n__PMC_EV(IAP, EVENT_C4H_08H)\t\t\t\\\n__PMC_EV(IAP, EVENT_C4H_0CH)\t\t\t\\\n__PMC_EV(IAP, EVENT_C4H_0FH)\t\t\t\\\n__PMC_EV(IAP, EVENT_C5H_00H)\t\t\t\\\n__PMC_EV(IAP, EVENT_C5H_01H)\t\t\t\\\n__PMC_EV(IAP, EVENT_C5H_02H)\t\t\t\\\n__PMC_EV(IAP, EVENT_C5H_04H)\t\t\t\\\n__PMC_EV(IAP, EVENT_C6H_00H)\t\t\t\\\n__PMC_EV(IAP, EVENT_C6H_01H)\t\t\t\\\n__PMC_EV(IAP, EVENT_C6H_02H)\t\t\t\\\n__PMC_EV(IAP, EVENT_C7H_00H)\t\t\t\\\n__PMC_EV(IAP, EVENT_C7H_01H)\t\t\t\\\n__PMC_EV(IAP, EVENT_C7H_02H)\t\t\t\\\n__PMC_EV(IAP, EVENT_C7H_04H)\t\t\t\\\n__PMC_EV(IAP, EVENT_C7H_08H)\t\t\t\\\n__PMC_EV(IAP, EVENT_C7H_10H)\t\t\t\\\n__PMC_EV(IAP, EVENT_C7H_1FH)\t\t\t\\\n__PMC_EV(IAP, EVENT_C8H_00H)\t\t\t\\\n__PMC_EV(IAP, EVENT_C8H_20H)\t\t\t\\\n__PMC_EV(IAP, EVENT_C9H_00H)\t\t\t\\\n__PMC_EV(IAP, EVENT_CAH_00H)\t\t\t\\\n__PMC_EV(IAP, EVENT_CAH_01H)\t\t\t\\\n__PMC_EV(IAP, EVENT_CAH_02H)\t\t\t\\\n__PMC_EV(IAP, EVENT_CAH_04H)\t\t\t\\\n__PMC_EV(IAP, EVENT_CAH_08H)\t\t\t\\\n__PMC_EV(IAP, EVENT_CBH_01H)\t\t\t\\\n__PMC_EV(IAP, EVENT_CBH_02H)\t\t\t\\\n__PMC_EV(IAP, EVENT_CBH_04H)\t\t\t\\\n__PMC_EV(IAP, EVENT_CBH_08H)\t\t\t\\\n__PMC_EV(IAP, EVENT_CBH_10H)\t\t\t\\\n__PMC_EV(IAP, EVENT_CBH_40H)\t\t\t\\\n__PMC_EV(IAP, EVENT_CBH_80H)\t\t\t\\\n__PMC_EV(IAP, EVENT_CCH_00H)\t\t\t\\\n__PMC_EV(IAP, EVENT_CCH_01H)\t\t\t\\\n__PMC_EV(IAP, EVENT_CCH_02H)\t\t\t\\\n__PMC_EV(IAP, EVENT_CCH_03H)\t\t\t\\\n__PMC_EV(IAP, EVENT_CDH_00H)\t\t\t\\\n__PMC_EV(IAP, EVENT_CEH_00H)\t\t\t\\\n__PMC_EV(IAP, EVENT_CFH_00H)\t\t\t\\\n__PMC_EV(IAP, EVENT_D0H_00H)\t\t\t\\\n__PMC_EV(IAP, EVENT_D0H_01H)\t\t\t\\\n__PMC_EV(IAP, EVENT_D1H_01H)\t\t\t\\\n__PMC_EV(IAP, EVENT_D1H_02H)\t\t\t\\\n__PMC_EV(IAP, EVENT_D1H_04H)\t\t\t\\\n__PMC_EV(IAP, EVENT_D1H_08H)\t\t\t\\\n__PMC_EV(IAP, EVENT_D2H_01H)\t\t\t\\\n__PMC_EV(IAP, EVENT_D2H_02H)\t\t\t\\\n__PMC_EV(IAP, EVENT_D2H_04H)\t\t\t\\\n__PMC_EV(IAP, EVENT_D2H_08H)\t\t\t\\\n__PMC_EV(IAP, EVENT_D2H_0FH)\t\t\t\\\n__PMC_EV(IAP, EVENT_D2H_10H)\t\t\t\\\n__PMC_EV(IAP, EVENT_D4H_01H)\t\t\t\\\n__PMC_EV(IAP, EVENT_D4H_02H)\t\t\t\\\n__PMC_EV(IAP, EVENT_D4H_04H)\t\t\t\\\n__PMC_EV(IAP, EVENT_D4H_08H)\t\t\t\\\n__PMC_EV(IAP, EVENT_D4H_0FH)\t\t\t\\\n__PMC_EV(IAP, EVENT_D5H_01H)\t\t\t\\\n__PMC_EV(IAP, EVENT_D5H_02H)\t\t\t\\\n__PMC_EV(IAP, EVENT_D5H_04H)\t\t\t\\\n__PMC_EV(IAP, EVENT_D5H_08H)\t\t\t\\\n__PMC_EV(IAP, EVENT_D5H_0FH)\t\t\t\\\n__PMC_EV(IAP, EVENT_D7H_00H)\t\t\t\\\n__PMC_EV(IAP, EVENT_D8H_00H)\t\t\t\\\n__PMC_EV(IAP, EVENT_D8H_01H)\t\t\t\\\n__PMC_EV(IAP, EVENT_D8H_02H)\t\t\t\\\n__PMC_EV(IAP, EVENT_D8H_03H)\t\t\t\\\n__PMC_EV(IAP, EVENT_D8H_04H)\t\t\t\\\n__PMC_EV(IAP, EVENT_D9H_00H)\t\t\t\\\n__PMC_EV(IAP, EVENT_D9H_01H)\t\t\t\\\n__PMC_EV(IAP, EVENT_D9H_02H)\t\t\t\\\n__PMC_EV(IAP, EVENT_D9H_03H)\t\t\t\\\n__PMC_EV(IAP, EVENT_DAH_00H)\t\t\t\\\n__PMC_EV(IAP, EVENT_DAH_01H)\t\t\t\\\n__PMC_EV(IAP, EVENT_DAH_02H)\t\t\t\\\n__PMC_EV(IAP, EVENT_DBH_00H)\t\t\t\\\n__PMC_EV(IAP, EVENT_DBH_01H)\t\t\t\\\n__PMC_EV(IAP, EVENT_DCH_01H)\t\t\t\\\n__PMC_EV(IAP, EVENT_DCH_02H)\t\t\t\\\n__PMC_EV(IAP, EVENT_DCH_04H)\t\t\t\\\n__PMC_EV(IAP, EVENT_DCH_08H)\t\t\t\\\n__PMC_EV(IAP, EVENT_DCH_10H)\t\t\t\\\n__PMC_EV(IAP, EVENT_DCH_1FH)\t\t\t\\\n__PMC_EV(IAP, EVENT_E0H_00H)\t\t\t\\\n__PMC_EV(IAP, EVENT_E0H_01H)\t\t\t\\\n__PMC_EV(IAP, EVENT_E2H_00H)\t\t\t\\\n__PMC_EV(IAP, EVENT_E4H_00H)\t\t\t\\\n__PMC_EV(IAP, EVENT_E4H_01H)\t\t\t\\\n__PMC_EV(IAP, EVENT_E5H_01H)\t\t\t\\\n__PMC_EV(IAP, EVENT_E6H_00H)\t\t\t\\\n__PMC_EV(IAP, EVENT_E6H_01H)\t\t\t\\\n__PMC_EV(IAP, EVENT_E6H_02H)\t\t\t\\\n__PMC_EV(IAP, EVENT_E8H_01H)\t\t\t\\\n__PMC_EV(IAP, EVENT_E8H_02H)\t\t\t\\\n__PMC_EV(IAP, EVENT_E8H_03H)\t\t\t\\\n__PMC_EV(IAP, EVENT_ECH_01H)\t\t\t\\\n__PMC_EV(IAP, EVENT_F0H_00H)\t\t\t\\\n__PMC_EV(IAP, EVENT_F0H_01H)\t\t\t\\\n__PMC_EV(IAP, EVENT_F0H_02H)\t\t\t\\\n__PMC_EV(IAP, EVENT_F0H_04H)\t\t\t\\\n__PMC_EV(IAP, EVENT_F0H_08H)\t\t\t\\\n__PMC_EV(IAP, EVENT_F0H_10H)\t\t\t\\\n__PMC_EV(IAP, EVENT_F0H_20H)\t\t\t\\\n__PMC_EV(IAP, EVENT_F0H_40H)\t\t\t\\\n__PMC_EV(IAP, EVENT_F0H_80H)\t\t\t\\\n__PMC_EV(IAP, EVENT_F1H_02H)\t\t\t\\\n__PMC_EV(IAP, EVENT_F1H_04H)\t\t\t\\\n__PMC_EV(IAP, EVENT_F1H_07H)\t\t\t\\\n__PMC_EV(IAP, EVENT_F2H_01H)\t\t\t\\\n__PMC_EV(IAP, EVENT_F2H_02H)\t\t\t\\\n__PMC_EV(IAP, EVENT_F2H_04H)\t\t\t\\\n__PMC_EV(IAP, EVENT_F2H_08H)\t\t\t\\\n__PMC_EV(IAP, EVENT_F2H_0FH)\t\t\t\\\n__PMC_EV(IAP, EVENT_F3H_01H)\t\t\t\\\n__PMC_EV(IAP, EVENT_F3H_02H)\t\t\t\\\n__PMC_EV(IAP, EVENT_F3H_04H)\t\t\t\\\n__PMC_EV(IAP, EVENT_F3H_08H)\t\t\t\\\n__PMC_EV(IAP, EVENT_F3H_10H)\t\t\t\\\n__PMC_EV(IAP, EVENT_F3H_20H)\t\t\t\\\n__PMC_EV(IAP, EVENT_F4H_01H)\t\t\t\\\n__PMC_EV(IAP, EVENT_F4H_02H)\t\t\t\\\n__PMC_EV(IAP, EVENT_F4H_04H)\t\t\t\\\n__PMC_EV(IAP, EVENT_F4H_08H)\t\t\t\\\n__PMC_EV(IAP, EVENT_F4H_10H)\t\t\t\\\n__PMC_EV(IAP, EVENT_F6H_01H)\t\t\t\\\n__PMC_EV(IAP, EVENT_F7H_01H)\t\t\t\\\n__PMC_EV(IAP, EVENT_F7H_02H)\t\t\t\\\n__PMC_EV(IAP, EVENT_F7H_04H)\t\t\t\\\n__PMC_EV(IAP, EVENT_F8H_00H)\t\t\t\\\n__PMC_EV(IAP, EVENT_F8H_01H)\t\t\t\\\n__PMC_EV(IAP, EVENT_FDH_01H)\t\t\t\\\n__PMC_EV(IAP, EVENT_FDH_02H)\t\t\t\\\n__PMC_EV(IAP, EVENT_FDH_04H)\t\t\t\\\n__PMC_EV(IAP, EVENT_FDH_08H)\t\t\t\\\n__PMC_EV(IAP, EVENT_FDH_10H)\t\t\t\\\n__PMC_EV(IAP, EVENT_FDH_20H)\t\t\t\\\n__PMC_EV(IAP, EVENT_FDH_40H)\n\n#define\tPMC_EV_IAP_FIRST\tPMC_EV_IAP_EVENT_02H_01H\n#define\tPMC_EV_IAP_LAST\t\tPMC_EV_IAP_EVENT_FDH_40H\n\n/*\n * Map \"architectural\" event names to event ids.\n */\n#define\t__PMC_EV_ALIAS_INTEL_ARCHITECTURAL()\t\t\t\t\\\n__PMC_EV_ALIAS(\"branch-instruction-retired\",\tIAP_EVENT_C4H_00H)\t\\\n__PMC_EV_ALIAS(\"branch-misses-retired\",\t\tIAP_EVENT_C5H_00H)\t\\\n__PMC_EV_ALIAS(\"instruction-retired\",\t\tIAP_EVENT_C0H_00H)\t\\\n__PMC_EV_ALIAS(\"llc-misses\",\t\t\tIAP_EVENT_2EH_41H)\t\\\n__PMC_EV_ALIAS(\"llc-reference\",\t\t\tIAP_EVENT_2EH_4FH)\t\\\n__PMC_EV_ALIAS(\"unhalted-reference-cycles\",\tIAP_EVENT_3CH_01H)\t\\\n__PMC_EV_ALIAS(\"unhalted-core-cycles\",\t\tIAP_EVENT_3CH_00H)\n\n/*\n * Aliases for Atom PMCs.\n */\n#define\t__PMC_EV_ALIAS_ATOM()\t\t\t\t\t\t\\\n__PMC_EV_ALIAS_INTEL_ARCHITECTURAL()\t\t\t\t\t\\\n__PMC_EV_ALIAS(\"BACLEARS\",\t\t\tIAP_EVENT_E6H_01H)\t\\\n__PMC_EV_ALIAS(\"BOGUS_BR\",\t\t\tIAP_EVENT_E4H_00H)\t\\\n__PMC_EV_ALIAS(\"BR_BAC_MISSP_EXEC\",\t\tIAP_EVENT_8AH_00H)\t\\\n__PMC_EV_ALIAS(\"BR_CALL_EXEC\",\t\t\tIAP_EVENT_92H_00H)\t\\\n__PMC_EV_ALIAS(\"BR_CALL_MISSP_EXEC\",\t\tIAP_EVENT_93H_00H)\t\\\n__PMC_EV_ALIAS(\"BR_CND_EXEC\",\t\t\tIAP_EVENT_8BH_00H)\t\\\n__PMC_EV_ALIAS(\"BR_CND_MISSP_EXEC\",\t\tIAP_EVENT_8CH_00H)\t\\\n__PMC_EV_ALIAS(\"BR_IND_CALL_EXEC\",\t\tIAP_EVENT_94H_00H)\t\\\n__PMC_EV_ALIAS(\"BR_IND_EXEC\",\t\t\tIAP_EVENT_8DH_00H)\t\\\n__PMC_EV_ALIAS(\"BR_IND_MISSP_EXEC\",\t\tIAP_EVENT_8EH_00H)\t\\\n__PMC_EV_ALIAS(\"BR_INST_DECODED\",\t\tIAP_EVENT_E0H_01H)\t\\\n__PMC_EV_ALIAS(\"BR_INST_EXEC\",\t\t\tIAP_EVENT_88H_00H)\t\\\n__PMC_EV_ALIAS(\"BR_INST_RETIRED.ANY\",\t\tIAP_EVENT_C4H_00H)\t\\\n__PMC_EV_ALIAS(\"BR_INST_RETIRED.ANY1\",\t\tIAP_EVENT_C4H_0FH)\t\\\n__PMC_EV_ALIAS(\"BR_INST_RETIRED.MISPRED\",\tIAP_EVENT_C5H_00H)\t\\\n__PMC_EV_ALIAS(\"BR_INST_RETIRED.MISPRED_NOT_TAKEN\",\t\t\t\\\n    IAP_EVENT_C4H_02H)\t\t\t\t\t\t\t\\\n__PMC_EV_ALIAS(\"BR_INST_RETIRED.MISPRED_TAKEN\",\tIAP_EVENT_C4H_08H)\t\\\n__PMC_EV_ALIAS(\"BR_INST_RETIRED.PRED_NOT_TAKEN\",IAP_EVENT_C4H_01H)\t\\\n__PMC_EV_ALIAS(\"BR_INST_RETIRED.PRED_TAKEN\",\tIAP_EVENT_C4H_04H)\t\\\n__PMC_EV_ALIAS(\"BR_INST_RETIRED.TAKEN\",\t\tIAP_EVENT_C4H_0CH)\t\\\n__PMC_EV_ALIAS(\"BR_MISSP_EXEC\",\t\t\tIAP_EVENT_89H_00H)\t\\\n__PMC_EV_ALIAS(\"BR_RET_BAC_MISSP_EXEC\",\t\tIAP_EVENT_91H_00H)\t\\\n__PMC_EV_ALIAS(\"BR_RET_EXEC\",\t\t\tIAP_EVENT_8FH_00H)\t\\\n__PMC_EV_ALIAS(\"BR_RET_MISSP_EXEC\",\t\tIAP_EVENT_90H_00H)\t\\\n__PMC_EV_ALIAS(\"BR_TKN_BUBBLE_1\",\t\tIAP_EVENT_97H_00H)\t\\\n__PMC_EV_ALIAS(\"BR_TKN_BUBBLE_2\",\t\tIAP_EVENT_98H_00H)\t\\\n__PMC_EV_ALIAS(\"BUSQ_EMPTY\",\t\t\tIAP_EVENT_7DH)\t\t\\\n__PMC_EV_ALIAS(\"BUS_BNR_DRV\",\t\t\tIAP_EVENT_61H)\t\t\\\n__PMC_EV_ALIAS(\"BUS_DATA_RCV\",\t\t\tIAP_EVENT_64H)\t\t\\\n__PMC_EV_ALIAS(\"BUS_DRDY_CLOCKS\",\t\tIAP_EVENT_62H)\t\t\\\n__PMC_EV_ALIAS(\"BUS_HITM_DRV\",\t\t\tIAP_EVENT_7BH)\t\t\\\n__PMC_EV_ALIAS(\"BUS_HIT_DRV\",\t\t\tIAP_EVENT_7AH)\t\t\\\n__PMC_EV_ALIAS(\"BUS_IO_WAIT\",\t\t\tIAP_EVENT_7FH)\t\t\\\n__PMC_EV_ALIAS(\"BUS_LOCK_CLOCKS\",\t\tIAP_EVENT_63H)\t\t\\\n__PMC_EV_ALIAS(\"BUS_REQUEST_OUTSTANDING\",\tIAP_EVENT_60H)\t\t\\\n__PMC_EV_ALIAS(\"BUS_TRANS_ANY\",\t\t\tIAP_EVENT_70H)\t\t\\\n__PMC_EV_ALIAS(\"BUS_TRANS_BRD\",\t\t\tIAP_EVENT_65H)\t\t\\\n__PMC_EV_ALIAS(\"BUS_TRANS_BURST\",\t\tIAP_EVENT_6EH)\t\t\\\n__PMC_EV_ALIAS(\"BUS_TRANS_DEF\",\t\t\tIAP_EVENT_6DH)\t\t\\\n__PMC_EV_ALIAS(\"BUS_TRANS_IFETCH\",\t\tIAP_EVENT_68H)\t\t\\\n__PMC_EV_ALIAS(\"BUS_TRANS_INVAL\",\t\tIAP_EVENT_69H)\t\t\\\n__PMC_EV_ALIAS(\"BUS_TRANS_IO\",\t\t\tIAP_EVENT_6CH)\t\t\\\n__PMC_EV_ALIAS(\"BUS_TRANS_MEM\",\t\t\tIAP_EVENT_6FH)\t\t\\\n__PMC_EV_ALIAS(\"BUS_TRANS_P\",\t\t\tIAP_EVENT_6BH)\t\t\\\n__PMC_EV_ALIAS(\"BUS_TRANS_PWR\",\t\t\tIAP_EVENT_6AH)\t\t\\\n__PMC_EV_ALIAS(\"BUS_TRANS_RFO\",\t\t\tIAP_EVENT_66H)\t\t\\\n__PMC_EV_ALIAS(\"BUS_TRANS_WB\",\t\t\tIAP_EVENT_67H)\t\t\\\n__PMC_EV_ALIAS(\"CMP_SNOOP\",\t\t\tIAP_EVENT_78H)\t\t\\\n__PMC_EV_ALIAS(\"CPU_CLK_UNHALTED.BUS\",\t\tIAP_EVENT_3CH_01H)\t\\\n__PMC_EV_ALIAS(\"CPU_CLK_UNHALTED.CORE_P\",\tIAP_EVENT_3CH_00H)\t\\\n__PMC_EV_ALIAS(\"CPU_CLK_UNHALTED.NO_OTHER\",\tIAP_EVENT_3CH_02H)\t\\\n__PMC_EV_ALIAS(\"CYCLES_DIV_BUSY\",\t\tIAP_EVENT_14H_01H)\t\\\n__PMC_EV_ALIAS(\"CYCLES_INT_MASKED.CYCLES_INT_MASKED\",\t\t\t\\\n    IAP_EVENT_C6H_01H)\t\t\t\t\t\t\t\\\n__PMC_EV_ALIAS(\"CYCLES_INT_MASKED.CYCLES_INT_PENDING_AND_MASKED\",\t\\\n    IAP_EVENT_C6H_02H)\t\t\t\t\t\t\t\\\n__PMC_EV_ALIAS(\"CYCLES_L1I_MEM_STALLED\",\tIAP_EVENT_86H_00H)\t\\\n__PMC_EV_ALIAS(\"DATA_TLB_MISSES.DTLB_MISS\",\tIAP_EVENT_08H_07H)\t\\\n__PMC_EV_ALIAS(\"DATA_TLB_MISSES.DTLB_MISS_LD\",\tIAP_EVENT_08H_05H)\t\\\n__PMC_EV_ALIAS(\"DATA_TLB_MISSES.DTLB_MISS_ST\",\tIAP_EVENT_08H_06H)\t\\\n__PMC_EV_ALIAS(\"DATA_TLB_MISSES.UTLB_MISS_LD\",\tIAP_EVENT_08H_09H)\t\\\n__PMC_EV_ALIAS(\"DELAYED_BYPASS.FP\",\t\tIAP_EVENT_19H_00H)\t\\\n__PMC_EV_ALIAS(\"DELAYED_BYPASS.LOAD\",\t\tIAP_EVENT_19H_01H)\t\\\n__PMC_EV_ALIAS(\"DELAYED_BYPASS.SIMD\",\t\tIAP_EVENT_19H_02H)\t\\\n__PMC_EV_ALIAS(\"DIV\",\t\t\t\tIAP_EVENT_13H_00H)\t\\\n__PMC_EV_ALIAS(\"DIV.AR\",\t\t\tIAP_EVENT_13H_81H)\t\\\n__PMC_EV_ALIAS(\"DIV.S\",\t\t\t\tIAP_EVENT_13H_01H)\t\\\n__PMC_EV_ALIAS(\"DTLB_MISSES.ANY\",\t\tIAP_EVENT_08H_01H)\t\\\n__PMC_EV_ALIAS(\"DTLB_MISSES.L0_MISS_LD\",\tIAP_EVENT_08H_04H)\t\\\n__PMC_EV_ALIAS(\"DTLB_MISSES.MISS_LD\",\t\tIAP_EVENT_08H_02H)\t\\\n__PMC_EV_ALIAS(\"DTLB_MISSES.MISS_ST\",\t\tIAP_EVENT_08H_08H)\t\\\n__PMC_EV_ALIAS(\"EIST_TRANS\",\t\t\tIAP_EVENT_3AH_00H)\t\\\n__PMC_EV_ALIAS(\"ESP.ADDITIONS\",\t\t\tIAP_EVENT_ABH_02H)\t\\\n__PMC_EV_ALIAS(\"ESP.SYNCH\",\t\t\tIAP_EVENT_ABH_01H)\t\\\n__PMC_EV_ALIAS(\"EXT_SNOOP\",\t\t\tIAP_EVENT_77H)\t\t\\\n__PMC_EV_ALIAS(\"FP_ASSIST\",\t\t\tIAP_EVENT_11H_01H)\t\\\n__PMC_EV_ALIAS(\"FP_ASSIST.AR\",\t\t\tIAP_EVENT_11H_81H)\t\\\n__PMC_EV_ALIAS(\"FP_COMP_OPS_EXE\",\t\tIAP_EVENT_10H_00H)\t\\\n__PMC_EV_ALIAS(\"FP_MMX_TRANS_TO_FP\",\t\tIAP_EVENT_CCH_02H)\t\\\n__PMC_EV_ALIAS(\"FP_MMX_TRANS_TO_MMX\",\t\tIAP_EVENT_CCH_01H)\t\\\n__PMC_EV_ALIAS(\"HW_INT_RCV\",\t\t\tIAP_EVENT_C8H_00H)\t\\\n__PMC_EV_ALIAS(\"ICACHE.ACCESSES\",\t\tIAP_EVENT_80H_03H)\t\\\n__PMC_EV_ALIAS(\"ICACHE.MISSES\",\t\t\tIAP_EVENT_80H_02H)\t\\\n__PMC_EV_ALIAS(\"IDLE_DURING_DIV\",\t\tIAP_EVENT_18H_00H)\t\\\n__PMC_EV_ALIAS(\"ILD_STALL\",\t\t\tIAP_EVENT_87H_00H)\t\\\n__PMC_EV_ALIAS(\"INST_QUEUE.FULL\",\t\tIAP_EVENT_83H_02H)\t\\\n__PMC_EV_ALIAS(\"INST_RETIRED.ANY_P\",\t\tIAP_EVENT_C0H_00H)\t\\\n__PMC_EV_ALIAS(\"INST_RETIRED.LOADS\",\t\tIAP_EVENT_C0H_01H)\t\\\n__PMC_EV_ALIAS(\"INST_RETIRED.OTHER\",\t\tIAP_EVENT_C0H_04H)\t\\\n__PMC_EV_ALIAS(\"INST_RETIRED.STORES\",\t\tIAP_EVENT_C0H_02H)\t\\\n__PMC_EV_ALIAS(\"ITLB.FLUSH\",\t\t\tIAP_EVENT_82H_04H)\t\\\n__PMC_EV_ALIAS(\"ITLB.LARGE_MISS\",\t\tIAP_EVENT_82H_10H)\t\\\n__PMC_EV_ALIAS(\"ITLB.MISSES\",\t\t\tIAP_EVENT_82H_02H)\t\\\n__PMC_EV_ALIAS(\"ITLB.SMALL_MISS\",\t\tIAP_EVENT_82H_02H)\t\\\n__PMC_EV_ALIAS(\"ITLB_MISS_RETIRED\",\t\tIAP_EVENT_C9H_00H)\t\\\n__PMC_EV_ALIAS(\"L1D_ALL_CACHE_REF\",\t\tIAP_EVENT_43H_02H)\t\\\n__PMC_EV_ALIAS(\"L1D_ALL_REF\",\t\t\tIAP_EVENT_43H_01H)\t\\\n__PMC_EV_ALIAS(\"L1D_CACHE.LD\",\t\t\tIAP_EVENT_40H_21H)\t\\\n__PMC_EV_ALIAS(\"L1D_CACHE.ST\",\t\t\tIAP_EVENT_41H_22H)\t\\\n__PMC_EV_ALIAS(\"L1D_CACHE_LOCK\",\t\tIAP_EVENT_42H)\t\t\\\n__PMC_EV_ALIAS(\"L1D_CACHE_LOCK_DURATION\",\tIAP_EVENT_42H_10H)\t\\\n__PMC_EV_ALIAS(\"L1D_M_EVICT\",\t\t\tIAP_EVENT_47H_00H)\t\\\n__PMC_EV_ALIAS(\"L1D_M_REPL\",\t\t\tIAP_EVENT_46H_00H)\t\\\n__PMC_EV_ALIAS(\"L1D_PEND_MISS\",\t\t\tIAP_EVENT_48H_00H)\t\\\n__PMC_EV_ALIAS(\"L1D_PREFETCH.REQUESTS\",\t\tIAP_EVENT_4EH_10H)\t\\\n__PMC_EV_ALIAS(\"L1D_REPL\",\t\t\tIAP_EVENT_45H_0FH)\t\\\n__PMC_EV_ALIAS(\"L1D_SPLIT.LOADS\",\t\tIAP_EVENT_49H_01H)\t\\\n__PMC_EV_ALIAS(\"L1D_SPLIT.STORES\",\t\tIAP_EVENT_49H_02H)\t\\\n__PMC_EV_ALIAS(\"L1I_MISSES\",\t\t\tIAP_EVENT_81H_00H)\t\\\n__PMC_EV_ALIAS(\"L1I_READS\",\t\t\tIAP_EVENT_80H_00H)\t\\\n__PMC_EV_ALIAS(\"L2_ADS\",\t\t\tIAP_EVENT_21H)\t\t\\\n__PMC_EV_ALIAS(\"L2_DBUS_BUSY_RD\",\t\tIAP_EVENT_23H)\t\t\\\n__PMC_EV_ALIAS(\"L2_IFETCH\",\t\t\tIAP_EVENT_28H)\t\t\\\n__PMC_EV_ALIAS(\"L2_LD\",\t\t\t\tIAP_EVENT_29H)\t\t\\\n__PMC_EV_ALIAS(\"L2_LINES_IN\",\t\t\tIAP_EVENT_24H)\t\t\\\n__PMC_EV_ALIAS(\"L2_LINES_OUT\",\t\t\tIAP_EVENT_26H)\t\t\\\n__PMC_EV_ALIAS(\"L2_LOCK\",\t\t\tIAP_EVENT_2BH)\t\t\\\n__PMC_EV_ALIAS(\"L2_M_LINES_IN\",\t\t\tIAP_EVENT_25H)\t\t\\\n__PMC_EV_ALIAS(\"L2_M_LINES_OUT\",\t\tIAP_EVENT_27H)\t\t\\\n__PMC_EV_ALIAS(\"L2_NO_REQ\",\t\t\tIAP_EVENT_32H)\t\t\\\n__PMC_EV_ALIAS(\"L2_REJECT_BUSQ\",\t\tIAP_EVENT_30H)\t\t\\\n__PMC_EV_ALIAS(\"L2_RQSTS\",\t\t\tIAP_EVENT_2EH)\t\t\\\n__PMC_EV_ALIAS(\"L2_RQSTS.SELF.DEMAND.I_STATE\",\tIAP_EVENT_2EH_41H)\t\\\n__PMC_EV_ALIAS(\"L2_RQSTS.SELF.DEMAND.MESI\",\tIAP_EVENT_2EH_4FH)\t\\\n__PMC_EV_ALIAS(\"L2_ST\",\t\t\t\tIAP_EVENT_2AH)\t\t\\\n__PMC_EV_ALIAS(\"LOAD_BLOCK.L1D\",\t\tIAP_EVENT_03H_20H)\t\\\n__PMC_EV_ALIAS(\"LOAD_BLOCK.OVERLAP_STORE\",\tIAP_EVENT_03H_08H)\t\\\n__PMC_EV_ALIAS(\"LOAD_BLOCK.STA\",\t\tIAP_EVENT_03H_02H)\t\\\n__PMC_EV_ALIAS(\"LOAD_BLOCK.STD\",\t\tIAP_EVENT_03H_04H)\t\\\n__PMC_EV_ALIAS(\"LOAD_BLOCK.UNTIL_RETIRE\",\tIAP_EVENT_03H_10H)\t\\\n__PMC_EV_ALIAS(\"LOAD_HIT_PRE\",\t\t\tIAP_EVENT_4CH_00H)\t\\\n__PMC_EV_ALIAS(\"MACHINE_CLEARS.SMC\",\t\tIAP_EVENT_C3H_01H)\t\\\n__PMC_EV_ALIAS(\"MACHINE_NUKES.MEM_ORDER\",\tIAP_EVENT_C3H_04H)\t\\\n__PMC_EV_ALIAS(\"MACRO_INSTS.ALL_DECODED\",\tIAP_EVENT_AAH_03H)\t\\\n__PMC_EV_ALIAS(\"MACRO_INSTS.CISC_DECODED\",\tIAP_EVENT_AAH_02H)\t\\\n__PMC_EV_ALIAS(\"MEMORY_DISAMBIGUATION.RESET\",\tIAP_EVENT_09H_01H)\t\\\n__PMC_EV_ALIAS(\"MEMORY_DISAMBIGUATION.SUCCESS\",\tIAP_EVENT_09H_02H)\t\\\n__PMC_EV_ALIAS(\"MEM_LOAD_RETIRED.DTLB_MISS\",\tIAP_EVENT_CBH_04H)\t\\\n__PMC_EV_ALIAS(\"MEM_LOAD_RETIRED.L2_HIT\",\tIAP_EVENT_CBH_01H)\t\\\n__PMC_EV_ALIAS(\"MEM_LOAD_RETIRED.L2_LINE_MISS\",\tIAP_EVENT_CBH_08H)\t\\\n__PMC_EV_ALIAS(\"MEM_LOAD_RETIRED.L2_MISS\",\tIAP_EVENT_CBH_02H)\t\\\n__PMC_EV_ALIAS(\"MUL\",\t\t\t\tIAP_EVENT_12H_00H)\t\\\n__PMC_EV_ALIAS(\"MUL.AR\",\t\t\tIAP_EVENT_12H_81H)\t\\\n__PMC_EV_ALIAS(\"MUL.S\",\t\t\t\tIAP_EVENT_12H_01H)\t\\\n__PMC_EV_ALIAS(\"PAGE_WALKS.CYCLES\",\t\tIAP_EVENT_0CH_03H)\t\\\n__PMC_EV_ALIAS(\"PAGE_WALKS.WALKS\",\t\tIAP_EVENT_0CH_03H)\t\\\n__PMC_EV_ALIAS(\"PREFETCH.PREFETCHNTA\",\t\tIAP_EVENT_07H_08H)\t\\\n__PMC_EV_ALIAS(\"PREFETCH.PREFETCHT0\",\t\tIAP_EVENT_07H_01H)\t\\\n__PMC_EV_ALIAS(\"PREFETCH.SW_L2\",\t\tIAP_EVENT_07H_06H)\t\\\n__PMC_EV_ALIAS(\"PREF_RQSTS_DN\",\t\t\tIAP_EVENT_F8H_00H)\t\\\n__PMC_EV_ALIAS(\"PREF_RQSTS_UP\",\t\t\tIAP_EVENT_F0H_00H)\t\\\n__PMC_EV_ALIAS(\"RAT_STALLS.ANY\",\t\tIAP_EVENT_D2H_0FH)\t\\\n__PMC_EV_ALIAS(\"RAT_STALLS.FLAGS\",\t\tIAP_EVENT_D2H_04H)\t\\\n__PMC_EV_ALIAS(\"RAT_STALLS.FPSW\",\t\tIAP_EVENT_D2H_08H)\t\\\n__PMC_EV_ALIAS(\"RAT_STALLS.PARTIAL_CYCLES\",\tIAP_EVENT_D2H_02H)\t\\\n__PMC_EV_ALIAS(\"RAT_STALLS.ROB_READ_PORT\",\tIAP_EVENT_D2H_01H)\t\\\n__PMC_EV_ALIAS(\"RESOURCE_STALLS.ANY\",\t\tIAP_EVENT_DCH_1FH)\t\\\n__PMC_EV_ALIAS(\"RESOURCE_STALLS.BR_MISS_CLEAR\",\tIAP_EVENT_DCH_10H)\t\\\n__PMC_EV_ALIAS(\"RESOURCE_STALLS.FPCW\",\t\tIAP_EVENT_DCH_08H)\t\\\n__PMC_EV_ALIAS(\"RESOURCE_STALLS.LD_ST\",\t\tIAP_EVENT_DCH_04H)\t\\\n__PMC_EV_ALIAS(\"RESOURCE_STALLS.ROB_FULL\",\tIAP_EVENT_DCH_01H)\t\\\n__PMC_EV_ALIAS(\"RESOURCE_STALLS.RS_FULL\",\tIAP_EVENT_DCH_02H)\t\\\n__PMC_EV_ALIAS(\"RS_UOPS_DISPATCHED\",\t\tIAP_EVENT_A0H_00H)\t\\\n__PMC_EV_ALIAS(\"RS_UOPS_DISPATCHED.PORT0\",\tIAP_EVENT_A1H_01H)\t\\\n__PMC_EV_ALIAS(\"RS_UOPS_DISPATCHED.PORT1\",\tIAP_EVENT_A1H_02H)\t\\\n__PMC_EV_ALIAS(\"RS_UOPS_DISPATCHED.PORT2\",\tIAP_EVENT_A1H_04H)\t\\\n__PMC_EV_ALIAS(\"RS_UOPS_DISPATCHED.PORT3\",\tIAP_EVENT_A1H_08H)\t\\\n__PMC_EV_ALIAS(\"RS_UOPS_DISPATCHED.PORT4\",\tIAP_EVENT_A1H_10H)\t\\\n__PMC_EV_ALIAS(\"RS_UOPS_DISPATCHED.PORT5\",\tIAP_EVENT_A1H_20H)\t\\\n__PMC_EV_ALIAS(\"SB_DRAIN_CYCLES\",\t\tIAP_EVENT_04H_01H)\t\\\n__PMC_EV_ALIAS(\"SEGMENT_REG_LOADS.ANY\",\t\tIAP_EVENT_06H_00H)\t\\\n__PMC_EV_ALIAS(\"SEG_REG_RENAMES.ANY\",\t\tIAP_EVENT_D5H_0FH)\t\\\n__PMC_EV_ALIAS(\"SEG_REG_RENAMES.DS\",\t\tIAP_EVENT_D5H_02H)\t\\\n__PMC_EV_ALIAS(\"SEG_REG_RENAMES.ES\",\t\tIAP_EVENT_D5H_01H)\t\\\n__PMC_EV_ALIAS(\"SEG_REG_RENAMES.FS\",\t\tIAP_EVENT_D5H_04H)\t\\\n__PMC_EV_ALIAS(\"SEG_REG_RENAMES.GS\",\t\tIAP_EVENT_D5H_08H)\t\\\n__PMC_EV_ALIAS(\"SEG_RENAME_STALLS.ANY\",\t\tIAP_EVENT_D4H_0FH)\t\\\n__PMC_EV_ALIAS(\"SEG_RENAME_STALLS.DS\",\t\tIAP_EVENT_D4H_02H)\t\\\n__PMC_EV_ALIAS(\"SEG_RENAME_STALLS.ES\",\t\tIAP_EVENT_D4H_01H)\t\\\n__PMC_EV_ALIAS(\"SEG_RENAME_STALLS.FS\",\t\tIAP_EVENT_D4H_04H)\t\\\n__PMC_EV_ALIAS(\"SEG_RENAME_STALLS.GS\",\t\tIAP_EVENT_D4H_08H)\t\\\n__PMC_EV_ALIAS(\"SIMD_ASSIST\",\t\t\tIAP_EVENT_CDH_00H)\t\\\n__PMC_EV_ALIAS(\"SIMD_COMP_INST_RETIRED.PACKED_DOUBLE\",\t\t\t\\\n    IAP_EVENT_CAH_04H)\t\t\t\t\t\t\t\\\n__PMC_EV_ALIAS(\"SIMD_COMP_INST_RETIRED.PACKED_SINGLE\",\t\t\t\\\n    IAP_EVENT_CAH_01H)\t\t\t\t\t\t\t\\\n__PMC_EV_ALIAS(\"SIMD_COMP_INST_RETIRED.SCALAR_DOUBLE\",\t\t\t\\\n    IAP_EVENT_CAH_08H)\t\t\t\t\t\t\t\\\n__PMC_EV_ALIAS(\"SIMD_COMP_INST_RETIRED.SCALAR_SINGLE\",\t\t\t\\\n    IAP_EVENT_CAH_02H)\t\t\t\t\t\t\t\\\n__PMC_EV_ALIAS(\"SIMD_INSTR_RETIRED\",\t\tIAP_EVENT_CEH_00H)\t\\\n__PMC_EV_ALIAS(\"SIMD_INST_RETIRED.ANY\",\t\tIAP_EVENT_C7H_1FH)\t\\\n__PMC_EV_ALIAS(\"SIMD_INST_RETIRED.PACKED_DOUBLE\", IAP_EVENT_C7H_04H)\t\\\n__PMC_EV_ALIAS(\"SIMD_INST_RETIRED.PACKED_SINGLE\", IAP_EVENT_C7H_01H)\t\\\n__PMC_EV_ALIAS(\"SIMD_INST_RETIRED.SCALAR_DOUBLE\", IAP_EVENT_C7H_08H)\t\\\n__PMC_EV_ALIAS(\"SIMD_INST_RETIRED.SCALAR_SINGLE\", IAP_EVENT_C7H_02H)\t\\\n__PMC_EV_ALIAS(\"SIMD_INST_RETIRED.VECTOR\",\tIAP_EVENT_C7H_10H)\t\\\n__PMC_EV_ALIAS(\"SIMD_SAT_INSTR_RETIRED\",\tIAP_EVENT_CFH_00H)\t\\\n__PMC_EV_ALIAS(\"SIMD_SAT_UOP_EXEC.AR\",\t\tIAP_EVENT_B1H_80H)\t\\\n__PMC_EV_ALIAS(\"SIMD_SAT_UOP_EXEC.S\",\t\tIAP_EVENT_B1H_00H)\t\\\n__PMC_EV_ALIAS(\"SIMD_UOPS_EXEC.AR\",\t\tIAP_EVENT_B0H_80H)\t\\\n__PMC_EV_ALIAS(\"SIMD_UOPS_EXEC.S\",\t\tIAP_EVENT_B0H_00H)\t\\\n__PMC_EV_ALIAS(\"SIMD_UOP_TYPE_EXEC.ARITHMETIC.AR\", IAP_EVENT_B3H_A0H)\t\\\n__PMC_EV_ALIAS(\"SIMD_UOP_TYPE_EXEC.ARITHMETIC.S\",  IAP_EVENT_B3H_20H)\t\\\n__PMC_EV_ALIAS(\"SIMD_UOP_TYPE_EXEC.LOGICAL.AR\",\tIAP_EVENT_B3H_90H)\t\\\n__PMC_EV_ALIAS(\"SIMD_UOP_TYPE_EXEC.LOGICAL.S\",\tIAP_EVENT_B3H_10H)\t\\\n__PMC_EV_ALIAS(\"SIMD_UOP_TYPE_EXEC.MUL.AR\",\tIAP_EVENT_B3H_81H)\t\\\n__PMC_EV_ALIAS(\"SIMD_UOP_TYPE_EXEC.MUL.S\",\tIAP_EVENT_B3H_01H)\t\\\n__PMC_EV_ALIAS(\"SIMD_UOP_TYPE_EXEC.PACK.AR\",\tIAP_EVENT_B3H_84H)\t\\\n__PMC_EV_ALIAS(\"SIMD_UOP_TYPE_EXEC.PACK.S\",\tIAP_EVENT_B3H_04H)\t\\\n__PMC_EV_ALIAS(\"SIMD_UOP_TYPE_EXEC.SHIFT.AR\",\tIAP_EVENT_B3H_82H)\t\\\n__PMC_EV_ALIAS(\"SIMD_UOP_TYPE_EXEC.SHIFT.S\",\tIAP_EVENT_B3H_02H)\t\\\n__PMC_EV_ALIAS(\"SIMD_UOP_TYPE_EXEC.UNPACK.AR\",\tIAP_EVENT_B3H_88H)\t\\\n__PMC_EV_ALIAS(\"SIMD_UOP_TYPE_EXEC.UNPACK.S\",\tIAP_EVENT_B3H_08H)\t\\\n__PMC_EV_ALIAS(\"SNOOP_STALL_DRV\",\t\tIAP_EVENT_7EH)\t\t\\\n__PMC_EV_ALIAS(\"SSE_PRE_EXEC.L2\",\t\tIAP_EVENT_07H_02H)\t\\\n__PMC_EV_ALIAS(\"SSE_PRE_EXEC.STORES\",\t\tIAP_EVENT_07H_03H)\t\\\n__PMC_EV_ALIAS(\"SSE_PRE_MISS.L1\",\t\tIAP_EVENT_4BH_01H)\t\\\n__PMC_EV_ALIAS(\"SSE_PRE_MISS.L2\",\t\tIAP_EVENT_4BH_02H)\t\\\n__PMC_EV_ALIAS(\"SSE_PRE_MISS.NTA\",\t\tIAP_EVENT_4BH_00H)\t\\\n__PMC_EV_ALIAS(\"STORE_BLOCK.ORDER\",\t\tIAP_EVENT_04H_02H)\t\\\n__PMC_EV_ALIAS(\"STORE_BLOCK.SNOOP\",\t\tIAP_EVENT_04H_08H)\t\\\n__PMC_EV_ALIAS(\"STORE_FORWARDS.GOOD\",\t\tIAP_EVENT_02H_81H)\t\\\n__PMC_EV_ALIAS(\"THERMAL_TRIP\",\t\t\tIAP_EVENT_3BH_C0H)\t\\\n__PMC_EV_ALIAS(\"UOPS_RETIRED.ANY\",\t\tIAP_EVENT_C2H_10H)\t\\\n__PMC_EV_ALIAS(\"UOPS_RETIRED.FUSED\",\t\tIAP_EVENT_C2H_07H)\t\\\n__PMC_EV_ALIAS(\"UOPS_RETIRED.LD_IND_BR\",\tIAP_EVENT_C2H_01H)\t\\\n__PMC_EV_ALIAS(\"UOPS_RETIRED.MACRO_FUSION\",\tIAP_EVENT_C2H_04H)\t\\\n__PMC_EV_ALIAS(\"UOPS_RETIRED.NON_FUSED\",\tIAP_EVENT_C2H_08H)\t\\\n__PMC_EV_ALIAS(\"UOPS_RETIRED.STD_STA\",\t\tIAP_EVENT_C2H_02H)\t\\\n__PMC_EV_ALIAS(\"X87_COMP_OPS_EXE.ANY.AR\",\tIAP_EVENT_10H_81H)\t\\\n__PMC_EV_ALIAS(\"X87_COMP_OPS_EXE.ANY.S\",\tIAP_EVENT_10H_01H)\t\\\n__PMC_EV_ALIAS(\"X87_OPS_RETIRED.ANY\",\t\tIAP_EVENT_C1H_FEH)\t\\\n__PMC_EV_ALIAS(\"X87_OPS_RETIRED.FXCH\",\t\tIAP_EVENT_C1H_01H)\n\n/*\n * Aliases for Core PMC events.\n */\n#define\t__PMC_EV_ALIAS_CORE()\t\t\t\t\t\\\n__PMC_EV_ALIAS_INTEL_ARCHITECTURAL()\t\t\t\t\\\n__PMC_EV_ALIAS(\"BAClears\",\t\tIAP_EVENT_E6H_00H)\t\\\n__PMC_EV_ALIAS(\"BTB_Misses\",\t\tIAP_EVENT_E2H_00H)\t\\\n__PMC_EV_ALIAS(\"Br_BAC_Missp_Exec\",\tIAP_EVENT_8AH_00H)\t\\\n__PMC_EV_ALIAS(\"Br_Bogus\",\t\tIAP_EVENT_E4H_00H)\t\\\n__PMC_EV_ALIAS(\"Br_Call_Exec\",\t\tIAP_EVENT_92H_00H)\t\\\n__PMC_EV_ALIAS(\"Br_Call_Missp_Exec\",\tIAP_EVENT_93H_00H)\t\\\n__PMC_EV_ALIAS(\"Br_Cnd_Exec\",\t\tIAP_EVENT_8BH_00H)\t\\\n__PMC_EV_ALIAS(\"Br_Cnd_Missp_Exec\",\tIAP_EVENT_8CH_00H)\t\\\n__PMC_EV_ALIAS(\"Br_Ind_Call_Exec\",\tIAP_EVENT_94H_00H)\t\\\n__PMC_EV_ALIAS(\"Br_Ind_Exec\",\t\tIAP_EVENT_8DH_00H)\t\\\n__PMC_EV_ALIAS(\"Br_Ind_Missp_Exec\",\tIAP_EVENT_8EH_00H)\t\\\n__PMC_EV_ALIAS(\"Br_Inst_Exec\",\t\tIAP_EVENT_88H_00H)\t\\\n__PMC_EV_ALIAS(\"Br_Instr_Decoded\",\tIAP_EVENT_E0H_00H)\t\\\n__PMC_EV_ALIAS(\"Br_Instr_Ret\",\t\tIAP_EVENT_C4H_00H)\t\\\n__PMC_EV_ALIAS(\"Br_MisPred_Ret\",\tIAP_EVENT_C5H_00H)\t\\\n__PMC_EV_ALIAS(\"Br_MisPred_Taken_Ret\",\tIAP_EVENT_CAH_00H)\t\\\n__PMC_EV_ALIAS(\"Br_Missp_Exec\",\t\tIAP_EVENT_89H_00H)\t\\\n__PMC_EV_ALIAS(\"Br_Ret_BAC_Missp_Exec\",\tIAP_EVENT_91H_00H)\t\\\n__PMC_EV_ALIAS(\"Br_Ret_Exec\",\t\tIAP_EVENT_8FH_00H)\t\\\n__PMC_EV_ALIAS(\"Br_Ret_Missp_Exec\",\tIAP_EVENT_90H_00H)\t\\\n__PMC_EV_ALIAS(\"Br_Taken_Ret\",\t\tIAP_EVENT_C9H_00H)\t\\\n__PMC_EV_ALIAS(\"Bus_BNR_Clocks\",\tIAP_EVENT_61H_00H)\t\\\n__PMC_EV_ALIAS(\"Bus_DRDY_Clocks\",\tIAP_EVENT_62H_00H)\t\\\n__PMC_EV_ALIAS(\"Bus_Data_Rcv\",\t\tIAP_EVENT_64H_40H)\t\\\n__PMC_EV_ALIAS(\"Bus_Locks_Clocks\",\tIAP_EVENT_63H)\t\t\\\n__PMC_EV_ALIAS(\"Bus_Not_In_Use\",\tIAP_EVENT_7DH)\t\t\\\n__PMC_EV_ALIAS(\"Bus_Req_Outstanding\",\tIAP_EVENT_60H)\t\t\\\n__PMC_EV_ALIAS(\"Bus_Snoop_Stall\",\tIAP_EVENT_7EH_00H)\t\\\n__PMC_EV_ALIAS(\"Bus_Snoops\",\t\tIAP_EVENT_77H)\t\t\\\n__PMC_EV_ALIAS(\"Bus_Trans_Any\",\t\tIAP_EVENT_70H)\t\t\\\n__PMC_EV_ALIAS(\"Bus_Trans_Brd\",\t\tIAP_EVENT_65H)\t\t\\\n__PMC_EV_ALIAS(\"Bus_Trans_Burst\",\tIAP_EVENT_6EH)\t\t\\\n__PMC_EV_ALIAS(\"Bus_Trans_Def\",\t\tIAP_EVENT_6DH)\t\t\\\n__PMC_EV_ALIAS(\"Bus_Trans_IO\",\t\tIAP_EVENT_6CH)\t\t\\\n__PMC_EV_ALIAS(\"Bus_Trans_Ifetch\",\tIAP_EVENT_68H)\t\t\\\n__PMC_EV_ALIAS(\"Bus_Trans_Inval\",\tIAP_EVENT_69H)\t\t\\\n__PMC_EV_ALIAS(\"Bus_Trans_Mem\",\t\tIAP_EVENT_6FH)\t\t\\\n__PMC_EV_ALIAS(\"Bus_Trans_P\",\t\tIAP_EVENT_6BH)\t\t\\\n__PMC_EV_ALIAS(\"Bus_Trans_Pwr\",\t\tIAP_EVENT_6AH)\t\t\\\n__PMC_EV_ALIAS(\"Bus_Trans_RFO\",\t\tIAP_EVENT_66H)\t\t\\\n__PMC_EV_ALIAS(\"Bus_Trans_WB\",\t\tIAP_EVENT_67H)\t\t\\\n__PMC_EV_ALIAS(\"Cycles_Div_Busy\",\tIAP_EVENT_14H_00H)\t\\\n__PMC_EV_ALIAS(\"Cycles_Int_Masked\",\tIAP_EVENT_C6H_00H)\t\\\n__PMC_EV_ALIAS(\"Cycles_Int_Pending_Masked\", IAP_EVENT_C7H_00H)\t\\\n__PMC_EV_ALIAS(\"DCU_Snoop_To_Share\",\tIAP_EVENT_78H)\t\t\\\n__PMC_EV_ALIAS(\"DCache_Cache_LD\",\tIAP_EVENT_40H)\t\t\\\n__PMC_EV_ALIAS(\"DCache_Cache_Lock\",\tIAP_EVENT_42H)\t\t\\\n__PMC_EV_ALIAS(\"DCache_Cache_ST\",\tIAP_EVENT_41H)\t\t\\\n__PMC_EV_ALIAS(\"DCache_M_Evict\",\tIAP_EVENT_47H_00H)\t\\\n__PMC_EV_ALIAS(\"DCache_M_Repl\",\t\tIAP_EVENT_46H_00H)\t\\\n__PMC_EV_ALIAS(\"DCache_Pend_Miss\",\tIAP_EVENT_48H_00H)\t\\\n__PMC_EV_ALIAS(\"DCache_Repl\",\t\tIAP_EVENT_45H_0FH)\t\\\n__PMC_EV_ALIAS(\"Data_Mem_Cache_Ref\",\tIAP_EVENT_44H_02H)\t\\\n__PMC_EV_ALIAS(\"Data_Mem_Ref\",\t\tIAP_EVENT_43H_01H)\t\\\n__PMC_EV_ALIAS(\"Dbus_Busy\",\t\tIAP_EVENT_22H)\t\t\\\n__PMC_EV_ALIAS(\"Dbus_Busy_Rd\",\t\tIAP_EVENT_23H)\t\t\\\n__PMC_EV_ALIAS(\"Div\",\t\t\tIAP_EVENT_13H_00H)\t\\\n__PMC_EV_ALIAS(\"Dtlb_Miss\",\t\tIAP_EVENT_49H_00H)\t\\\n__PMC_EV_ALIAS(\"ESP_Uops\",\t\tIAP_EVENT_D7H_00H)\t\\\n__PMC_EV_ALIAS(\"EST_Trans\",\t\tIAP_EVENT_3AH)\t\t\\\n__PMC_EV_ALIAS(\"FP_Assist\",\t\tIAP_EVENT_11H_00H)\t\\\n__PMC_EV_ALIAS(\"FP_Comp_Instr_Ret\",\tIAP_EVENT_C1H_00H)\t\\\n__PMC_EV_ALIAS(\"FP_Comps_Op_Exe\",\tIAP_EVENT_10H_00H)\t\\\n__PMC_EV_ALIAS(\"FP_MMX_Trans\",\t\tIAP_EVENT_CCH_01H)\t\\\n__PMC_EV_ALIAS(\"Fused_Ld_Uops_Ret\",\tIAP_EVENT_DAH_01H)\t\\\n__PMC_EV_ALIAS(\"Fused_St_Uops_Ret\",\tIAP_EVENT_DAH_02H)\t\\\n__PMC_EV_ALIAS(\"Fused_Uops_Ret\",\tIAP_EVENT_DAH_00H)\t\\\n__PMC_EV_ALIAS(\"HW_Int_Rx\",\t\tIAP_EVENT_C8H_00H)\t\\\n__PMC_EV_ALIAS(\"ICache_Misses\",\t\tIAP_EVENT_81H_00H)\t\\\n__PMC_EV_ALIAS(\"ICache_Reads\",\t\tIAP_EVENT_80H_00H)\t\\\n__PMC_EV_ALIAS(\"IFU_Mem_Stall\",\t\tIAP_EVENT_86H_00H)\t\\\n__PMC_EV_ALIAS(\"ILD_Stall\",\t\tIAP_EVENT_87H_00H)\t\\\n__PMC_EV_ALIAS(\"ITLB_Misses\",\t\tIAP_EVENT_85H_00H)\t\\\n__PMC_EV_ALIAS(\"Instr_Decoded\",\t\tIAP_EVENT_D0H_00H)\t\\\n__PMC_EV_ALIAS(\"Instr_Ret\",\t\tIAP_EVENT_C0H_00H)\t\\\n__PMC_EV_ALIAS(\"L1_Pref_Req\",\t\tIAP_EVENT_4FH_00H)\t\\\n__PMC_EV_ALIAS(\"L2_ADS\",\t\tIAP_EVENT_21H)\t\t\\\n__PMC_EV_ALIAS(\"L2_IFetch\",\t\tIAP_EVENT_28H)\t\t\\\n__PMC_EV_ALIAS(\"L2_LD\",\t\t\tIAP_EVENT_29H)\t\t\\\n__PMC_EV_ALIAS(\"L2_Lines_In\",\t\tIAP_EVENT_24H)\t\t\\\n__PMC_EV_ALIAS(\"L2_Lines_Out\",\t\tIAP_EVENT_26H)\t\t\\\n__PMC_EV_ALIAS(\"L2_M_Lines_In\",\t\tIAP_EVENT_25H)\t\t\\\n__PMC_EV_ALIAS(\"L2_M_Lines_Out\",\tIAP_EVENT_27H)\t\t\\\n__PMC_EV_ALIAS(\"L2_No_Request_Cycles\",\tIAP_EVENT_32H)\t\t\\\n__PMC_EV_ALIAS(\"L2_Reject_Cycles\",\tIAP_EVENT_30H)\t\t\\\n__PMC_EV_ALIAS(\"L2_Rqsts\",\t\tIAP_EVENT_2EH)\t\t\\\n__PMC_EV_ALIAS(\"L2_ST\",\t\t\tIAP_EVENT_2AH)\t\t\\\n__PMC_EV_ALIAS(\"LD_Blocks\",\t\tIAP_EVENT_03H_00H)\t\\\n__PMC_EV_ALIAS(\"LLC_Misses\",\t\tIAP_EVENT_2EH_41H)\t\\\n__PMC_EV_ALIAS(\"LLC_Reference\",\t\tIAP_EVENT_2EH_4FH)\t\\\n__PMC_EV_ALIAS(\"MMX_Assist\",\t\tIAP_EVENT_CDH_00H)\t\\\n__PMC_EV_ALIAS(\"MMX_FP_Trans\",\t\tIAP_EVENT_CCH_00H)\t\\\n__PMC_EV_ALIAS(\"MMX_Instr_Exec\",\tIAP_EVENT_B0H_00H)\t\\\n__PMC_EV_ALIAS(\"MMX_Instr_Ret\",\t\tIAP_EVENT_CEH_00H)\t\\\n__PMC_EV_ALIAS(\"Misalign_Mem_Ref\",\tIAP_EVENT_05H_00H)\t\\\n__PMC_EV_ALIAS(\"Mul\",\t\t\tIAP_EVENT_12H_00H)\t\\\n__PMC_EV_ALIAS(\"NonHlt_Ref_Cycles\",\tIAP_EVENT_3CH_01H)\t\\\n__PMC_EV_ALIAS(\"Pref_Rqsts_Dn\",\t\tIAP_EVENT_F8H_00H)\t\\\n__PMC_EV_ALIAS(\"Pref_Rqsts_Up\",\t\tIAP_EVENT_F0H_00H)\t\\\n__PMC_EV_ALIAS(\"Resource_Stall\",\tIAP_EVENT_A2H_00H)\t\\\n__PMC_EV_ALIAS(\"SD_Drains\",\t\tIAP_EVENT_04H_00H)\t\\\n__PMC_EV_ALIAS(\"SIMD_FP_DP_P_Comp_Ret\",\tIAP_EVENT_D9H_02H)\t\\\n__PMC_EV_ALIAS(\"SIMD_FP_DP_P_Ret\",\tIAP_EVENT_D8H_02H)\t\\\n__PMC_EV_ALIAS(\"SIMD_FP_DP_S_Comp_Ret\",\tIAP_EVENT_D9H_03H)\t\\\n__PMC_EV_ALIAS(\"SIMD_FP_DP_S_Ret\",\tIAP_EVENT_D8H_03H)\t\\\n__PMC_EV_ALIAS(\"SIMD_FP_SP_P_Comp_Ret\",\tIAP_EVENT_D9H_00H)\t\\\n__PMC_EV_ALIAS(\"SIMD_FP_SP_Ret\",\tIAP_EVENT_D8H_00H)\t\\\n__PMC_EV_ALIAS(\"SIMD_FP_SP_S_Comp_Ret\",\tIAP_EVENT_D9H_01H)\t\\\n__PMC_EV_ALIAS(\"SIMD_FP_SP_S_Ret\",\tIAP_EVENT_D8H_01H)\t\\\n__PMC_EV_ALIAS(\"SIMD_Int_128_Ret\",\tIAP_EVENT_D8H_04H)\t\\\n__PMC_EV_ALIAS(\"SIMD_Int_Pari_Exec\",\tIAP_EVENT_B3H_20H)\t\\\n__PMC_EV_ALIAS(\"SIMD_Int_Pck_Exec\",\tIAP_EVENT_B3H_04H)\t\\\n__PMC_EV_ALIAS(\"SIMD_Int_Plog_Exec\",\tIAP_EVENT_B3H_10H)\t\\\n__PMC_EV_ALIAS(\"SIMD_Int_Pmul_Exec\",\tIAP_EVENT_B3H_01H)\t\\\n__PMC_EV_ALIAS(\"SIMD_Int_Psft_Exec\",\tIAP_EVENT_B3H_02H)\t\\\n__PMC_EV_ALIAS(\"SIMD_Int_Sat_Exec\",\tIAP_EVENT_B1H_00H)\t\\\n__PMC_EV_ALIAS(\"SIMD_Int_Upck_Exec\",\tIAP_EVENT_B3H_08H)\t\\\n__PMC_EV_ALIAS(\"SMC_Detected\",\t\tIAP_EVENT_C3H_00H)\t\\\n__PMC_EV_ALIAS(\"SSE_NTStores_Miss\",\tIAP_EVENT_4BH_03H)\t\\\n__PMC_EV_ALIAS(\"SSE_NTStores_Ret\",\tIAP_EVENT_07H_03H)\t\\\n__PMC_EV_ALIAS(\"SSE_PrefNta_Miss\",\tIAP_EVENT_4BH_00H)\t\\\n__PMC_EV_ALIAS(\"SSE_PrefNta_Ret\",\tIAP_EVENT_07H_00H)\t\\\n__PMC_EV_ALIAS(\"SSE_PrefT1_Miss\",\tIAP_EVENT_4BH_01H)\t\\\n__PMC_EV_ALIAS(\"SSE_PrefT1_Ret\",\tIAP_EVENT_07H_01H)\t\\\n__PMC_EV_ALIAS(\"SSE_PrefT2_Miss\",\tIAP_EVENT_4BH_02H)\t\\\n__PMC_EV_ALIAS(\"SSE_PrefT2_Ret\",\tIAP_EVENT_07H_02H)\t\\\n__PMC_EV_ALIAS(\"Seg_Reg_Loads\",\t\tIAP_EVENT_06H_00H)\t\\\n__PMC_EV_ALIAS(\"Serial_Execution_Cycles\", IAP_EVENT_3CH_02H)\t\\\n__PMC_EV_ALIAS(\"Thermal_Trip\",\t\tIAP_EVENT_3BH_C0H)\t\\\n__PMC_EV_ALIAS(\"Unfusion\",\t\tIAP_EVENT_DBH_00H)\t\\\n__PMC_EV_ALIAS(\"Unhalted_Core_Cycles\",\tIAP_EVENT_3CH_00H)\t\\\n__PMC_EV_ALIAS(\"Uops_Ret\",\t\tIAP_EVENT_C2H_00H)\n\n/*\n * Aliases for Core2 PMC events.\n */\n#define\t__PMC_EV_ALIAS_CORE2()\t\t\t\t\t\t\\\n__PMC_EV_ALIAS_INTEL_ARCHITECTURAL()\t\t\t\t\t\\\n__PMC_EV_ALIAS(\"BACLEARS\",\t\tIAP_EVENT_E6H_00H)\t\t\\\n__PMC_EV_ALIAS(\"BOGUS_BR\",\t\tIAP_EVENT_E4H_00H)\t\t\\\n__PMC_EV_ALIAS(\"BR_BAC_MISSP_EXEC\",\tIAP_EVENT_8AH_00H)\t\t\\\n__PMC_EV_ALIAS(\"BR_CALL_EXEC\",\t\tIAP_EVENT_92H_00H)\t\t\\\n__PMC_EV_ALIAS(\"BR_CALL_MISSP_EXEC\",\tIAP_EVENT_93H_00H)\t\t\\\n__PMC_EV_ALIAS(\"BR_CND_EXEC\",\t\tIAP_EVENT_8BH_00H)\t\t\\\n__PMC_EV_ALIAS(\"BR_CND_MISSP_EXEC\",\tIAP_EVENT_8CH_00H)\t\t\\\n__PMC_EV_ALIAS(\"BR_IND_CALL_EXEC\",\tIAP_EVENT_94H_00H)\t\t\\\n__PMC_EV_ALIAS(\"BR_IND_EXEC\",\t\tIAP_EVENT_8DH_00H)\t\t\\\n__PMC_EV_ALIAS(\"BR_IND_MISSP_EXEC\",\tIAP_EVENT_8EH_00H)\t\t\\\n__PMC_EV_ALIAS(\"BR_INST_DECODED\",\tIAP_EVENT_E0H_00H)\t\t\\\n__PMC_EV_ALIAS(\"BR_INST_EXEC\",\t\tIAP_EVENT_88H_00H)\t\t\\\n__PMC_EV_ALIAS(\"BR_INST_RETIRED.ANY\",\tIAP_EVENT_C4H_00H)\t\t\\\n__PMC_EV_ALIAS(\"BR_INST_RETIRED.MISPRED\", IAP_EVENT_C5H_00H)\t\t\\\n__PMC_EV_ALIAS(\"BR_INST_RETIRED.MISPRED_NOT_TAKEN\",\t\t\t\\\n    IAP_EVENT_C4H_02H)\t\t\t\t\t\t\t\\\n__PMC_EV_ALIAS(\"BR_INST_RETIRED.MISPRED_TAKEN\",\t\t\t\t\\\n    IAP_EVENT_C4H_08H)\t\t\t\t\t\t\t\\\n__PMC_EV_ALIAS(\"BR_INST_RETIRED.PRED_NOT_TAKEN\",\t\t\t\\\n    IAP_EVENT_C4H_01H)\t\t\t\t\t\t\t\\\n__PMC_EV_ALIAS(\"BR_INST_RETIRED.PRED_TAKEN\",\t\t\t\t\\\n    IAP_EVENT_C4H_04H)\t\t\t\t\t\t\t\\\n__PMC_EV_ALIAS(\"BR_INST_RETIRED.TAKEN\",\tIAP_EVENT_C4H_0CH)\t\t\\\n__PMC_EV_ALIAS(\"BR_MISSP_EXEC\",\t\tIAP_EVENT_89H_00H)\t\t\\\n__PMC_EV_ALIAS(\"BR_RET_BAC_MISSP_EXEC\",\tIAP_EVENT_91H_00H)\t\t\\\n__PMC_EV_ALIAS(\"BR_RET_EXEC\",\t\tIAP_EVENT_8FH_00H)\t\t\\\n__PMC_EV_ALIAS(\"BR_RET_MISSP_EXEC\",\tIAP_EVENT_90H_00H)\t\t\\\n__PMC_EV_ALIAS(\"BR_TKN_BUBBLE_1\",\tIAP_EVENT_97H_00H)\t\t\\\n__PMC_EV_ALIAS(\"BR_TKN_BUBBLE_2\",\tIAP_EVENT_98H_00H)\t\t\\\n__PMC_EV_ALIAS(\"BUSQ_EMPTY\",\t\tIAP_EVENT_7DH)\t\t\t\\\n__PMC_EV_ALIAS(\"BUS_BNR_DRV\",\t\tIAP_EVENT_61H)\t\t\t\\\n__PMC_EV_ALIAS(\"BUS_DATA_RCV\",\t\tIAP_EVENT_64H)\t\t\t\\\n__PMC_EV_ALIAS(\"BUS_DRDY_CLOCKS\",\tIAP_EVENT_62H)\t\t\t\\\n__PMC_EV_ALIAS(\"BUS_HITM_DRV\",\t\tIAP_EVENT_7BH)\t\t\t\\\n__PMC_EV_ALIAS(\"BUS_HIT_DRV\",\t\tIAP_EVENT_7AH)\t\t\t\\\n__PMC_EV_ALIAS(\"BUS_IO_WAIT\",\t\tIAP_EVENT_7FH)\t\t\t\\\n__PMC_EV_ALIAS(\"BUS_LOCK_CLOCKS\",\tIAP_EVENT_63H)\t\t\t\\\n__PMC_EV_ALIAS(\"BUS_REQUEST_OUTSTANDING\",\t\t\t\t\\\n    IAP_EVENT_60H)\t\t\t\t\t\t\t\\\n__PMC_EV_ALIAS(\"BUS_TRANS_ANY\",\t\tIAP_EVENT_70H)\t\t\t\\\n__PMC_EV_ALIAS(\"BUS_TRANS_BRD\",\t\tIAP_EVENT_65H)\t\t\t\\\n__PMC_EV_ALIAS(\"BUS_TRANS_BURST\",\tIAP_EVENT_6EH)\t\t\t\\\n__PMC_EV_ALIAS(\"BUS_TRANS_DEF\",\t\tIAP_EVENT_6DH)\t\t\t\\\n__PMC_EV_ALIAS(\"BUS_TRANS_IFETCH\",\tIAP_EVENT_68H)\t\t\t\\\n__PMC_EV_ALIAS(\"BUS_TRANS_INVAL\",\tIAP_EVENT_69H)\t\t\t\\\n__PMC_EV_ALIAS(\"BUS_TRANS_IO\",\t\tIAP_EVENT_6CH)\t\t\t\\\n__PMC_EV_ALIAS(\"BUS_TRANS_MEM\",\t\tIAP_EVENT_6FH)\t\t\t\\\n__PMC_EV_ALIAS(\"BUS_TRANS_P\",\t\tIAP_EVENT_6BH)\t\t\t\\\n__PMC_EV_ALIAS(\"BUS_TRANS_PWR\",\t\tIAP_EVENT_6AH)\t\t\t\\\n__PMC_EV_ALIAS(\"BUS_TRANS_RFO\",\t\tIAP_EVENT_66H)\t\t\t\\\n__PMC_EV_ALIAS(\"BUS_TRANS_WB\",\t\tIAP_EVENT_67H)\t\t\t\\\n__PMC_EV_ALIAS(\"CMP_SNOOP\",\t\tIAP_EVENT_78H)\t\t\t\\\n__PMC_EV_ALIAS(\"CPU_CLK_UNHALTED.BUS\",\tIAP_EVENT_3CH_01H)\t\t\\\n__PMC_EV_ALIAS(\"CPU_CLK_UNHALTED.CORE_P\",\t\t\t\t\\\n    IAP_EVENT_3CH_00H)\t\t\t\t\t\t\t\\\n__PMC_EV_ALIAS(\"CPU_CLK_UNHALTED.NO_OTHER\",\t\t\t\t\\\n    IAP_EVENT_3CH_02H)\t\t\t\t\t\t\t\\\n__PMC_EV_ALIAS(\"CYCLES_DIV_BUSY\",\tIAP_EVENT_14H_00H)\t\t\\\n__PMC_EV_ALIAS(\"CYCLES_INT_MASKED\",\tIAP_EVENT_C6H_01H)\t\t\\\n__PMC_EV_ALIAS(\"CYCLES_INT_PENDING_AND_MASKED\",\t\t\t\t\\\n    IAP_EVENT_C6H_02H)\t\t\t\t\t\t\t\\\n__PMC_EV_ALIAS(\"CYCLES_L1I_MEM_STALLED\", IAP_EVENT_86H_00H)\t\t\\\n__PMC_EV_ALIAS(\"DELAYED_BYPASS.FP\",\tIAP_EVENT_19H_00H)\t\t\\\n__PMC_EV_ALIAS(\"DELAYED_BYPASS.LOAD\",\tIAP_EVENT_19H_01H)\t\t\\\n__PMC_EV_ALIAS(\"DELAYED_BYPASS.SIMD\",\tIAP_EVENT_19H_02H)\t\t\\\n__PMC_EV_ALIAS(\"DIV\",\t\t\tIAP_EVENT_13H_00H)\t\t\\\n__PMC_EV_ALIAS(\"DTLB_MISSES.ANY\",\tIAP_EVENT_08H_01H)\t\t\\\n__PMC_EV_ALIAS(\"DTLB_MISSES.L0_MISS_LD\", IAP_EVENT_08H_04H)\t\t\\\n__PMC_EV_ALIAS(\"DTLB_MISSES.MISS_LD\",\tIAP_EVENT_08H_02H)\t\t\\\n__PMC_EV_ALIAS(\"DTLB_MISSES.MISS_ST\",\tIAP_EVENT_08H_08H)\t\t\\\n__PMC_EV_ALIAS(\"EIST_TRANS\",\t\tIAP_EVENT_3AH_00H)\t\t\\\n__PMC_EV_ALIAS(\"ESP.ADDITIONS\",\t\tIAP_EVENT_ABH_02H)\t\t\\\n__PMC_EV_ALIAS(\"ESP.SYNCH\",\t\tIAP_EVENT_ABH_01H)\t\t\\\n__PMC_EV_ALIAS(\"EXT_SNOOP\",\t\tIAP_EVENT_77H)\t\t\t\\\n__PMC_EV_ALIAS(\"FP_ASSIST\",\t\tIAP_EVENT_11H_00H)\t\t\\\n__PMC_EV_ALIAS(\"FP_COMP_OPS_EXE\",\tIAP_EVENT_10H_00H)\t\t\\\n__PMC_EV_ALIAS(\"FP_MMX_TRANS_TO_FP\",\tIAP_EVENT_CCH_02H)\t\t\\\n__PMC_EV_ALIAS(\"FP_MMX_TRANS_TO_MMX\",\tIAP_EVENT_CCH_01H)\t\t\\\n__PMC_EV_ALIAS(\"HW_INT_RCV\",\t\tIAP_EVENT_C8H_00H)\t\t\\\n__PMC_EV_ALIAS(\"IDLE_DURING_DIV\",\tIAP_EVENT_18H_00H)\t\t\\\n__PMC_EV_ALIAS(\"ILD_STALL\",\t\tIAP_EVENT_87H_00H)\t\t\\\n__PMC_EV_ALIAS(\"INST_QUEUE.FULL\",\tIAP_EVENT_83H_02H)\t\t\\\n__PMC_EV_ALIAS(\"INST_RETIRED.ANY_P\",\tIAP_EVENT_C0H_00H)\t\t\\\n__PMC_EV_ALIAS(\"INST_RETIRED.LOADS\",\tIAP_EVENT_C0H_01H)\t\t\\\n__PMC_EV_ALIAS(\"INST_RETIRED.OTHER\",\tIAP_EVENT_C0H_04H)\t\t\\\n__PMC_EV_ALIAS(\"INST_RETIRED.STORES\",\tIAP_EVENT_C0H_02H)\t\t\\\n__PMC_EV_ALIAS(\"INST_RETIRED.VM_H\",\tIAP_EVENT_C0H_08H)\t\t\\\n__PMC_EV_ALIAS(\"ITLB.FLUSH\",\t\tIAP_EVENT_82H_40H)\t\t\\\n__PMC_EV_ALIAS(\"ITLB.LARGE_MISS\",\tIAP_EVENT_82H_10H)\t\t\\\n__PMC_EV_ALIAS(\"ITLB.MISSES\",\t\tIAP_EVENT_82H_12H)\t\t\\\n__PMC_EV_ALIAS(\"ITLB.SMALL_MISS\",\tIAP_EVENT_82H_02H)\t\t\\\n__PMC_EV_ALIAS(\"ITLB_MISS_RETIRED\",\tIAP_EVENT_C9H_00H)\t\t\\\n__PMC_EV_ALIAS(\"L1D_ALL_CACHE_REF\",\tIAP_EVENT_43H_02H)\t\t\\\n__PMC_EV_ALIAS(\"L1D_ALL_REF\",\t\tIAP_EVENT_43H_01H)\t\t\\\n__PMC_EV_ALIAS(\"L1D_CACHE_LD\",\t\tIAP_EVENT_40H)\t\t\t\\\n__PMC_EV_ALIAS(\"L1D_CACHE_LOCK\",\tIAP_EVENT_42H)\t\t\t\\\n__PMC_EV_ALIAS(\"L1D_CACHE_LOCK_DURATION\", IAP_EVENT_42H_10H)\t\t\\\n__PMC_EV_ALIAS(\"L1D_CACHE_ST\",\t\tIAP_EVENT_41H)\t\t\t\\\n__PMC_EV_ALIAS(\"L1D_M_EVICT\",\t\tIAP_EVENT_47H_00H)\t\t\\\n__PMC_EV_ALIAS(\"L1D_M_REPL\",\t\tIAP_EVENT_46H_00H)\t\t\\\n__PMC_EV_ALIAS(\"L1D_PEND_MISS\",\t\tIAP_EVENT_48H_00H)\t\t\\\n__PMC_EV_ALIAS(\"L1D_PREFETCH.REQUESTS\",\tIAP_EVENT_4EH_10H)\t\t\\\n__PMC_EV_ALIAS(\"L1D_REPL\",\t\tIAP_EVENT_45H_0FH)\t\t\\\n__PMC_EV_ALIAS(\"L1D_SPLIT.LOADS\",\tIAP_EVENT_49H_01H)\t\t\\\n__PMC_EV_ALIAS(\"L1D_SPLIT.STORES\",\tIAP_EVENT_49H_02H)\t\t\\\n__PMC_EV_ALIAS(\"L1I_MISSES\",\t\tIAP_EVENT_81H_00H)\t\t\\\n__PMC_EV_ALIAS(\"L1I_READS\",\t\tIAP_EVENT_80H_00H)\t\t\\\n__PMC_EV_ALIAS(\"L2_ADS\",\t\tIAP_EVENT_21H)\t\t\t\\\n__PMC_EV_ALIAS(\"L2_DBUS_BUSY_RD\",\tIAP_EVENT_23H)\t\t\t\\\n__PMC_EV_ALIAS(\"L2_IFETCH\",\t\tIAP_EVENT_28H)\t\t\t\\\n__PMC_EV_ALIAS(\"L2_LD\",\t\t\tIAP_EVENT_29H)\t\t\t\\\n__PMC_EV_ALIAS(\"L2_LINES_IN\",\t\tIAP_EVENT_24H)\t\t\t\\\n__PMC_EV_ALIAS(\"L2_LINES_OUT\",\t\tIAP_EVENT_26H)\t\t\t\\\n__PMC_EV_ALIAS(\"L2_LOCK\",\t\tIAP_EVENT_2BH)\t\t\t\\\n__PMC_EV_ALIAS(\"L2_M_LINES_IN\",\t\tIAP_EVENT_25H)\t\t\t\\\n__PMC_EV_ALIAS(\"L2_M_LINES_OUT\",\tIAP_EVENT_27H)\t\t\t\\\n__PMC_EV_ALIAS(\"L2_NO_REQ\",\t\tIAP_EVENT_32H)\t\t\t\\\n__PMC_EV_ALIAS(\"L2_REJECT_BUSQ\",\tIAP_EVENT_30H)\t\t\t\\\n__PMC_EV_ALIAS(\"L2_RQSTS\",\t\tIAP_EVENT_2EH)\t\t\t\\\n__PMC_EV_ALIAS(\"L2_RQSTS.SELF.DEMAND.I_STATE\",\t\t\t\t\\\n    IAP_EVENT_2EH_41H)\t\t\t\t\t\t\t\\\n__PMC_EV_ALIAS(\"L2_RQSTS.SELF.DEMAND.MESI\",\t\t\t\t\\\n    IAP_EVENT_2EH_4FH)\t\t\t\t\t\t\t\\\n__PMC_EV_ALIAS(\"L2_ST\",\t\t\tIAP_EVENT_2AH)\t\t\t\\\n__PMC_EV_ALIAS(\"LOAD_BLOCK.L1D\",\tIAP_EVENT_03H_20H)\t\t\\\n__PMC_EV_ALIAS(\"LOAD_BLOCK.OVERLAP_STORE\",\t\t\t\t\\\n    IAP_EVENT_03H_08H)\t\t\t\t\t\t\t\\\n__PMC_EV_ALIAS(\"LOAD_BLOCK.STA\",\tIAP_EVENT_03H_02H)\t\t\\\n__PMC_EV_ALIAS(\"LOAD_BLOCK.STD\",\tIAP_EVENT_03H_04H)\t\t\\\n__PMC_EV_ALIAS(\"LOAD_BLOCK.UNTIL_RETIRE\", IAP_EVENT_03H_10H)\t\t\\\n__PMC_EV_ALIAS(\"LOAD_HIT_PRE\",\t\tIAP_EVENT_4CH_00H)\t\t\\\n__PMC_EV_ALIAS(\"MACHINE_NUKES.MEM_ORDER\", IAP_EVENT_C3H_04H)\t\t\\\n__PMC_EV_ALIAS(\"MACHINE_NUKES.SMC\",\tIAP_EVENT_C3H_01H)\t\t\\\n__PMC_EV_ALIAS(\"MACRO_INSTS.CISC_DECODED\", IAP_EVENT_AAH_08H)\t\t\\\n__PMC_EV_ALIAS(\"MACRO_INSTS.DECODED\",\tIAP_EVENT_AAH_01H)\t\t\\\n__PMC_EV_ALIAS(\"MEMORY_DISAMBIGUATION.RESET\",\t\t\t\t\\\n    IAP_EVENT_09H_01H)\t\t\t\t\t\t\t\\\n__PMC_EV_ALIAS(\"MEMORY_DISAMBIGUATION.SUCCESS\",\t\t\t\t\\\n    IAP_EVENT_09H_02H)\t\t\t\t\t\t\t\\\n__PMC_EV_ALIAS(\"MEM_LOAD_RETIRED.DTLB_MISS\",\t\t\t\t\\\n    IAP_EVENT_CBH_10H)\t\t\t\t\t\t\t\\\n__PMC_EV_ALIAS(\"MEM_LOAD_RETIRED.L1D_LINE_MISS\",\t\t\t\\\n    IAP_EVENT_CBH_02H)\t\t\t\t\t\t\t\\\n__PMC_EV_ALIAS(\"MEM_LOAD_RETIRED.L1D_MISS\",\t\t\t\t\\\n    IAP_EVENT_CBH_01H)\t\t\t\t\t\t\t\\\n__PMC_EV_ALIAS(\"MEM_LOAD_RETIRED.L2_LINE_MISS\",\t\t\t\t\\\n    IAP_EVENT_CBH_08H)\t\t\t\t\t\t\t\\\n__PMC_EV_ALIAS(\"MEM_LOAD_RETIRED.L2_MISS\",\t\t\t\t\\\n    IAP_EVENT_CBH_04H)\t\t\t\t\t\t\t\\\n__PMC_EV_ALIAS(\"MUL\",\t\t\tIAP_EVENT_12H_00H)\t\t\\\n__PMC_EV_ALIAS(\"PAGE_WALKS.COUNT\",\tIAP_EVENT_0CH_01H)\t\t\\\n__PMC_EV_ALIAS(\"PAGE_WALKS.CYCLES\",\tIAP_EVENT_0CH_02H)\t\t\\\n__PMC_EV_ALIAS(\"PREF_RQSTS_DN\",\t\tIAP_EVENT_F8H_00H)\t\t\\\n__PMC_EV_ALIAS(\"PREF_RQSTS_UP\",\t\tIAP_EVENT_F0H_00H)\t\t\\\n__PMC_EV_ALIAS(\"RAT_STALLS.ANY\",\tIAP_EVENT_D2H_0FH)\t\t\\\n__PMC_EV_ALIAS(\"RAT_STALLS.FLAGS\",\tIAP_EVENT_D2H_04H)\t\t\\\n__PMC_EV_ALIAS(\"RAT_STALLS.FPSW\",\tIAP_EVENT_D2H_08H)\t\t\\\n__PMC_EV_ALIAS(\"RAT_STALLS.OTHER_SERIALIZATION_STALLS\",\t\t\t\\\n    IAP_EVENT_D2H_10H)\t\t\t\t\t\t\t\\\n__PMC_EV_ALIAS(\"RAT_STALLS.PARTIAL_CYCLES\",\t\t\t\t\\\n    IAP_EVENT_D2H_02H)\t\t\t\t\t\t\t\\\n__PMC_EV_ALIAS(\"RAT_STALLS.ROB_READ_PORT\",\t\t\t\t\\\n    IAP_EVENT_D2H_01H)\t\t\t\t\t\t\t\\\n__PMC_EV_ALIAS(\"RESOURCE_STALLS.ANY\",\tIAP_EVENT_DCH_1FH)\t\t\\\n__PMC_EV_ALIAS(\"RESOURCE_STALLS.BR_MISS_CLEAR\",\t\t\t\t\\\n    IAP_EVENT_DCH_10H)\t\t\t\t\t\t\t\\\n__PMC_EV_ALIAS(\"RESOURCE_STALLS.FPCW\",\tIAP_EVENT_DCH_08H)\t\t\\\n__PMC_EV_ALIAS(\"RESOURCE_STALLS.LD_ST\",\tIAP_EVENT_DCH_04H)\t\t\\\n__PMC_EV_ALIAS(\"RESOURCE_STALLS.ROB_FULL\",\t\t\t\t\\\n    IAP_EVENT_DCH_01H)\t\t\t\t\t\t\t\\\n__PMC_EV_ALIAS(\"RESOURCE_STALLS.RS_FULL\", IAP_EVENT_DCH_02H)\t\t\\\n__PMC_EV_ALIAS(\"RS_UOPS_DISPATCHED\",\tIAP_EVENT_A0H_00H)\t\t\\\n__PMC_EV_ALIAS(\"RS_UOPS_DISPATCHED.PORT0\", IAP_EVENT_A1H_01H)\t\t\\\n__PMC_EV_ALIAS(\"RS_UOPS_DISPATCHED.PORT1\", IAP_EVENT_A1H_02H)\t\t\\\n__PMC_EV_ALIAS(\"RS_UOPS_DISPATCHED.PORT2\", IAP_EVENT_A1H_04H)\t\t\\\n__PMC_EV_ALIAS(\"RS_UOPS_DISPATCHED.PORT3\", IAP_EVENT_A1H_08H)\t\t\\\n__PMC_EV_ALIAS(\"RS_UOPS_DISPATCHED.PORT4\", IAP_EVENT_A1H_10H)\t\t\\\n__PMC_EV_ALIAS(\"RS_UOPS_DISPATCHED.PORT5\", IAP_EVENT_A1H_20H)\t\t\\\n__PMC_EV_ALIAS(\"SB_DRAIN_CYCLES\",\tIAP_EVENT_04H_01H)\t\t\\\n__PMC_EV_ALIAS(\"SEGMENT_REG_LOADS\",\tIAP_EVENT_06H_00H)\t\t\\\n__PMC_EV_ALIAS(\"SEG_REG_RENAMES.ANY\",\tIAP_EVENT_D5H_0FH)\t\t\\\n__PMC_EV_ALIAS(\"SEG_REG_RENAMES.DS\",\tIAP_EVENT_D5H_02H)\t\t\\\n__PMC_EV_ALIAS(\"SEG_REG_RENAMES.ES\",\tIAP_EVENT_D5H_01H)\t\t\\\n__PMC_EV_ALIAS(\"SEG_REG_RENAMES.FS\",\tIAP_EVENT_D5H_04H)\t\t\\\n__PMC_EV_ALIAS(\"SEG_REG_RENAMES.GS\",\tIAP_EVENT_D5H_08H)\t\t\\\n__PMC_EV_ALIAS(\"SEG_RENAME_STALLS.ANY\",\tIAP_EVENT_D4H_0FH)\t\t\\\n__PMC_EV_ALIAS(\"SEG_RENAME_STALLS.DS\",\tIAP_EVENT_D4H_02H)\t\t\\\n__PMC_EV_ALIAS(\"SEG_RENAME_STALLS.ES\",\tIAP_EVENT_D4H_01H)\t\t\\\n__PMC_EV_ALIAS(\"SEG_RENAME_STALLS.FS\",\tIAP_EVENT_D4H_04H)\t\t\\\n__PMC_EV_ALIAS(\"SEG_RENAME_STALLS.GS\",\tIAP_EVENT_D4H_08H)\t\t\\\n__PMC_EV_ALIAS(\"SIMD_ASSIST\",\t\tIAP_EVENT_CDH_00H)\t\t\\\n__PMC_EV_ALIAS(\"SIMD_COMP_INST_RETIRED.PACKED_DOUBLE\",\t\t\t\\\n    IAP_EVENT_CAH_04H)\t\t\t\t\t\t\t\\\n__PMC_EV_ALIAS(\"SIMD_COMP_INST_RETIRED.PACKED_SINGLE\",\t\t\t\\\n    IAP_EVENT_CAH_01H)\t\t\t\t\t\t\t\\\n__PMC_EV_ALIAS(\"SIMD_COMP_INST_RETIRED.SCALAR_DOUBLE\",\t\t\t\\\n    IAP_EVENT_CAH_08H)\t\t\t\t\t\t\t\\\n__PMC_EV_ALIAS(\"SIMD_COMP_INST_RETIRED.SCALAR_SINGLE\",\t\t\t\\\n    IAP_EVENT_CAH_02H)\t\t\t\t\t\t\t\\\n__PMC_EV_ALIAS(\"SIMD_INSTR_RETIRED\",\tIAP_EVENT_CEH_00H)\t\t\\\n__PMC_EV_ALIAS(\"SIMD_INST_RETIRED.ANY\",\tIAP_EVENT_C7H_1FH)\t\t\\\n__PMC_EV_ALIAS(\"SIMD_INST_RETIRED.PACKED_DOUBLE\",\t\t\t\\\n    IAP_EVENT_C7H_04H)\t\t\t\t\t\t\t\\\n__PMC_EV_ALIAS(\"SIMD_INST_RETIRED.PACKED_SINGLE\",\t\t\t\\\n    IAP_EVENT_C7H_01H)\t\t\t\t\t\t\t\\\n__PMC_EV_ALIAS(\"SIMD_INST_RETIRED.SCALAR_DOUBLE\",\t\t\t\\\n    IAP_EVENT_C7H_08H)\t\t\t\t\t\t\t\\\n__PMC_EV_ALIAS(\"SIMD_INST_RETIRED.SCALAR_SINGLE\",\t\t\t\\\n    IAP_EVENT_C7H_02H)\t\t\t\t\t\t\t\\\n__PMC_EV_ALIAS(\"SIMD_INST_RETIRED.VECTOR\",\tIAP_EVENT_C7H_10H)\t\\\n__PMC_EV_ALIAS(\"SIMD_SAT_INSTR_RETIRED\",\tIAP_EVENT_CFH_00H)\t\\\n__PMC_EV_ALIAS(\"SIMD_SAT_UOP_EXEC\",\t\tIAP_EVENT_B1H_00H)\t\\\n__PMC_EV_ALIAS(\"SIMD_UOPS_EXEC\",\t\tIAP_EVENT_B0H_00H)\t\\\n__PMC_EV_ALIAS(\"SIMD_UOP_TYPE_EXEC.ARITHMETIC\",\tIAP_EVENT_B3H_20H)\t\\\n__PMC_EV_ALIAS(\"SIMD_UOP_TYPE_EXEC.LOGICAL\",\tIAP_EVENT_B3H_10H)\t\\\n__PMC_EV_ALIAS(\"SIMD_UOP_TYPE_EXEC.MUL\",\tIAP_EVENT_B3H_01H)\t\\\n__PMC_EV_ALIAS(\"SIMD_UOP_TYPE_EXEC.PACK\",\tIAP_EVENT_B3H_04H)\t\\\n__PMC_EV_ALIAS(\"SIMD_UOP_TYPE_EXEC.SHIFT\",\tIAP_EVENT_B3H_02H)\t\\\n__PMC_EV_ALIAS(\"SIMD_UOP_TYPE_EXEC.UNPACK\",\tIAP_EVENT_B3H_08H)\t\\\n__PMC_EV_ALIAS(\"SNOOP_STALL_DRV\",\t\tIAP_EVENT_7EH)\t\t\\\n__PMC_EV_ALIAS(\"SSE_PRE_EXEC.L1\",\t\tIAP_EVENT_07H_01H)\t\\\n__PMC_EV_ALIAS(\"SSE_PRE_EXEC.L2\",\t\tIAP_EVENT_07H_02H)\t\\\n__PMC_EV_ALIAS(\"SSE_PRE_EXEC.NTA\",\t\tIAP_EVENT_07H_00H)\t\\\n__PMC_EV_ALIAS(\"SSE_PRE_EXEC.STORES\",\t\tIAP_EVENT_07H_03H)\t\\\n__PMC_EV_ALIAS(\"SSE_PRE_MISS.L1\",\t\tIAP_EVENT_4BH_01H)\t\\\n__PMC_EV_ALIAS(\"SSE_PRE_MISS.L2\",\t\tIAP_EVENT_4BH_02H)\t\\\n__PMC_EV_ALIAS(\"SSE_PRE_MISS.NTA\",\t\tIAP_EVENT_4BH_00H)\t\\\n__PMC_EV_ALIAS(\"STORE_BLOCK.ORDER\",\t\tIAP_EVENT_04H_02H)\t\\\n__PMC_EV_ALIAS(\"STORE_BLOCK.SNOOP\",\t\tIAP_EVENT_04H_08H)\t\\\n__PMC_EV_ALIAS(\"THERMAL_TRIP\",\t\t\tIAP_EVENT_3BH_C0H)\t\\\n__PMC_EV_ALIAS(\"UOPS_RETIRED.ANY\",\t\tIAP_EVENT_C2H_0FH)\t\\\n__PMC_EV_ALIAS(\"UOPS_RETIRED.FUSED\",\t\tIAP_EVENT_C2H_07H)\t\\\n__PMC_EV_ALIAS(\"UOPS_RETIRED.LD_IND_BR\",\tIAP_EVENT_C2H_01H)\t\\\n__PMC_EV_ALIAS(\"UOPS_RETIRED.MACRO_FUSION\",\tIAP_EVENT_C2H_04H)\t\\\n__PMC_EV_ALIAS(\"UOPS_RETIRED.NON_FUSED\",\tIAP_EVENT_C2H_08H)\t\\\n__PMC_EV_ALIAS(\"UOPS_RETIRED.STD_STA\",\t\tIAP_EVENT_C2H_02H)\t\\\n__PMC_EV_ALIAS(\"X87_OPS_RETIRED.ANY\",\t\tIAP_EVENT_C1H_FEH)\t\\\n__PMC_EV_ALIAS(\"X87_OPS_RETIRED.FXCH\",\t\tIAP_EVENT_C1H_01H)\n\n/*\n * Core i7 and Xeon 5500 events removed between 253669-031US June 2009\n * and 253669-033US December 2009.\n */\n#define\t__PMC_EV_ALIAS_COREI7_OLD()\t\t\t\t\t\\\n__PMC_EV_ALIAS(\"SB_FORWARD.ANY\", IAP_EVENT_02H_01H)\t\t\t\\\n__PMC_EV_ALIAS(\"LOAD_BLOCK.STD\", IAP_EVENT_03H_01H)\t\t\t\\\n__PMC_EV_ALIAS(\"LOAD_BLOCK.ADDRESS_OFFSET\", IAP_EVENT_03H_04H)\t\t\\\n__PMC_EV_ALIAS(\"SB_DRAIN.CYCLES\", IAP_EVENT_04H_01H)\t\t\t\\\n__PMC_EV_ALIAS(\"MISALIGN_MEM_REF.LOAD\", IAP_EVENT_05H_01H)\t\t\\\n__PMC_EV_ALIAS(\"MISALIGN_MEM_REF.STORE\", IAP_EVENT_05H_02H)\t\t\\\n__PMC_EV_ALIAS(\"MISALIGN_MEM_REF.ANY\", IAP_EVENT_05H_03H)\t\t\\\n__PMC_EV_ALIAS(\"STORE_BLOCKS.NOT_STA\", IAP_EVENT_06H_01H)\t\t\\\n__PMC_EV_ALIAS(\"STORE_BLOCKS.STA\", IAP_EVENT_06H_02H)\t\t\t\\\n__PMC_EV_ALIAS(\"STORE_BLOCKS.ANY\", IAP_EVENT_06H_0FH)\t\t\t\\\n__PMC_EV_ALIAS(\"MEMORY_DISAMBIGURATION.RESET\", IAP_EVENT_09H_01H)\t\\\n__PMC_EV_ALIAS(\"MEMORY_DISAMBIGURATION.SUCCESS\", IAP_EVENT_09H_02H)\t\\\n__PMC_EV_ALIAS(\"MEMORY_DISAMBIGURATION.WATCHDOG\", IAP_EVENT_09H_04H)\t\\\n__PMC_EV_ALIAS(\"MEMORY_DISAMBIGURATION.WATCH_CYCLES\", IAP_EVENT_09H_08H)\\\n__PMC_EV_ALIAS(\"HW_INT.RCV\", IAP_EVENT_1DH_01H)\t\t\t\t\\\n__PMC_EV_ALIAS(\"HW_INT.CYCLES_MASKED\", IAP_EVENT_1DH_02H)\t\t\\\n__PMC_EV_ALIAS(\"HW_INT.CYCLES_PENDING_AND_MASKED\", IAP_EVENT_1DH_04H)\t\\\n__PMC_EV_ALIAS(\"L2_WRITE.RFO.E_STATE\", IAP_EVENT_27H_04H)\t\t\\\n__PMC_EV_ALIAS(\"UOPS_DECODED.DEC0\", IAP_EVENT_3DH_01H)\t\t\t\\\n__PMC_EV_ALIAS(\"L1D_CACHE_ST.I_STATE\", IAP_EVENT_41H_01H)\t\t\\\n__PMC_EV_ALIAS(\"L1D_CACHE_ST.MESI\", IAP_EVENT_41H_0FH)\t\t\t\\\n__PMC_EV_ALIAS(\"DTLB_MISSES.PDE_MISS\", IAP_EVENT_49H_20H)\t\t\\\n__PMC_EV_ALIAS(\"DTLB_MISSES.PDP_MISS\", IAP_EVENT_49H_40H)\t\t\\\n__PMC_EV_ALIAS(\"DTLB_MISSES.LARGE_WALK_COMPLETED\", IAP_EVENT_49H_80H)\t\\\n__PMC_EV_ALIAS(\"SSE_MEM_EXEC.NTA\", IAP_EVENT_4BH_01H)\t\t\t\\\n__PMC_EV_ALIAS(\"SSE_MEM_EXEC.STREAMING_STORES\", IAP_EVENT_4BH_08H)\t\\\n__PMC_EV_ALIAS(\"SFENCE_CYCLES\", IAP_EVENT_4DH_01H)\t\t\t\\\n__PMC_EV_ALIAS(\"EPT.EPDE_MISS\", IAP_EVENT_4FH_02H)\t\t\t\\\n__PMC_EV_ALIAS(\"EPT.EPDPE_HIT\", IAP_EVENT_4FH_04H)\t\t\t\\\n__PMC_EV_ALIAS(\"EPT.EPDPE_MISS\", IAP_EVENT_4FH_08H)\t\t\t\\\n__PMC_EV_ALIAS(\"OFFCORE_REQUESTS_OUTSTANDING.DEMAND.READ_DATA\",\t\t\\\n    IAP_EVENT_60H_01H)\t\t\t\t\t\t\t\\\n__PMC_EV_ALIAS(\"OFFCORE_REQUESTS_OUTSTANDING.DEMAND.READ_CODE\",\t\t\\\n    IAP_EVENT_60H_02H)\t\t\t\t\t\t\t\\\n__PMC_EV_ALIAS(\"OFFCORE_REQUESTS_OUTSTANDING.DEMAND.RFO\",\t\t\\\n    IAP_EVENT_60H_04H)\t\t\t\t\t\t\t\\\n__PMC_EV_ALIAS(\"OFFCORE_REQUESTS_OUTSTANDING.ANY.READ\",\t\t\t\\\n    IAP_EVENT_60H_08H)\t\t\t\t\t\t\t\\\n__PMC_EV_ALIAS(\"IFU_IVC.FULL\", IAP_EVENT_81H_01H)\t\t\t\\\n__PMC_EV_ALIAS(\"IFU_IVC.L1I_EVICTION\", IAP_EVENT_81H_02H)\t\t\\\n__PMC_EV_ALIAS(\"L1I_OPPORTUNISTIC_HITS\", IAP_EVENT_83H_01H)\t\t\\\n__PMC_EV_ALIAS(\"ITLB_MISSES.WALK_CYCLES\", IAP_EVENT_85H_04H)\t\t\\\n__PMC_EV_ALIAS(\"ITLB_MISSES.PMH_BUSY_CYCLES\", IAP_EVENT_85H_04H)\t\\\n__PMC_EV_ALIAS(\"ITLB_MISSES.STLB_HIT\", IAP_EVENT_85H_10H)\t\t\\\n__PMC_EV_ALIAS(\"ITLB_MISSES.PDE_MISS\", IAP_EVENT_85H_20H)\t\t\\\n__PMC_EV_ALIAS(\"ITLB_MISSES.PDP_MISS\", IAP_EVENT_85H_40H)\t\t\\\n__PMC_EV_ALIAS(\"ITLB_MISSES.LARGE_WALK_COMPLETED\", IAP_EVENT_85H_80H)\t\\\n__PMC_EV_ALIAS(\"OFFCORE_REQUESTS.DEMAND.READ_DATA\", IAP_EVENT_B0H_01H)\t\\\n__PMC_EV_ALIAS(\"OFFCORE_REQUESTS.DEMAND.READ_CODE\", IAP_EVENT_B0H_02H)\t\\\n__PMC_EV_ALIAS(\"OFFCORE_REQUESTS.DEMAND.RFO\", IAP_EVENT_B0H_04H)\t\\\n__PMC_EV_ALIAS(\"OFFCORE_REQUESTS.ANY.READ\", IAP_EVENT_B0H_08H)\t\t\\\n__PMC_EV_ALIAS(\"OFFCORE_REQUESTS.ANY.RFO\", IAP_EVENT_B0H_10H)\t\t\\\n__PMC_EV_ALIAS(\"OFFCORE_REQUESTS.UNCACHED_MEM\", IAP_EVENT_B0H_20H)\t\\\n__PMC_EV_ALIAS(\"OFFCORE_REQUESTS.ANY\", IAP_EVENT_B0H_80H)\t\t\\\n__PMC_EV_ALIAS(\"SNOOPQ_REQUESTS_OUTSTANDING.DATA\", IAP_EVENT_B3H_01H)\t\\\n__PMC_EV_ALIAS(\"SNOOPQ_REQUESTS_OUTSTANDING.INVALIDATE\",\t\t\\\n    IAP_EVENT_B3H_02H)\t\t\t\t\t\t\t\\\n__PMC_EV_ALIAS(\"SNOOPQ_REQUESTS_OUTSTANDING.CODE\", IAP_EVENT_B3H_04H)\t\\\n__PMC_EV_ALIAS(\"PIC_ACCESSES.TPR_READS\", IAP_EVENT_BAH_01H)\t\t\\\n__PMC_EV_ALIAS(\"PIC_ACCESSES.TPR_WRITES\", IAP_EVENT_BAH_02H)\t\t\\\n__PMC_EV_ALIAS(\"MACHINE_CLEARS.FUSION_ASSIST\", IAP_EVENT_C3H_10H)\t\\\n__PMC_EV_ALIAS(\"BOGUS_BR\", IAP_EVENT_E4H_01H)\t\t\t\t\\\n__PMC_EV_ALIAS(\"L2_HW_PREFETCH.HIT\", IAP_EVENT_F3H_01H)\t\t\t\\\n__PMC_EV_ALIAS(\"L2_HW_PREFETCH.ALLOC\", IAP_EVENT_F3H_02H)\t\t\\\n__PMC_EV_ALIAS(\"L2_HW_PREFETCH.DATA_TRIGGER\", IAP_EVENT_F3H_04H)\t\\\n__PMC_EV_ALIAS(\"L2_HW_PREFETCH.CODE_TRIGGER\", IAP_EVENT_F3H_08H)\t\\\n__PMC_EV_ALIAS(\"L2_HW_PREFETCH.DCA_TRIGGER\", IAP_EVENT_F3H_10H)\t\t\\\n__PMC_EV_ALIAS(\"L2_HW_PREFETCH.KICK_START\", IAP_EVENT_F3H_20H)\t\t\\\n__PMC_EV_ALIAS(\"SQ_MISC.PROMOTION\", IAP_EVENT_F4H_01H)\t\t\t\\\n__PMC_EV_ALIAS(\"SQ_MISC.PROMOTION_POST_GO\", IAP_EVENT_F4H_02H)\t\t\\\n__PMC_EV_ALIAS(\"SQ_MISC.LRU_HINTS\", IAP_EVENT_F4H_04H)\t\t\t\\\n__PMC_EV_ALIAS(\"SQ_MISC.FILL_DROPPED\", IAP_EVENT_F4H_08H)\t\t\\\n__PMC_EV_ALIAS(\"SEGMENT_REG_LOADS\", IAP_EVENT_F8H_01H)\n\n/*\n * Aliases for Core i7 and Xeon 5500 PMC events (253669-033US December 2009)\n */\n#define\t__PMC_EV_ALIAS_COREI7()\t\t\t\t\t\t\\\n__PMC_EV_ALIAS_INTEL_ARCHITECTURAL()\t\t\t\t\t\\\n__PMC_EV_ALIAS(\"SB_DRAIN.ANY\", \tIAP_EVENT_04H_07H)\t\t\t\\\n__PMC_EV_ALIAS(\"STORE_BLOCKS.AT_RET\", IAP_EVENT_06H_04H)\t\t\\\n__PMC_EV_ALIAS(\"STORE_BLOCKS.L1D_BLOCK\", IAP_EVENT_06H_08H)\t\t\\\n__PMC_EV_ALIAS(\"PARTIAL_ADDRESS_ALIAS\", IAP_EVENT_07H_01H)\t\t\\\n__PMC_EV_ALIAS(\"DTLB_LOAD_MISSES.ANY\", IAP_EVENT_08H_01H)\t\t\\\n__PMC_EV_ALIAS(\"DTLB_LOAD_MISSES.WALK_COMPLETED\", IAP_EVENT_08H_02H)\t\\\n__PMC_EV_ALIAS(\"DTLB_LOAD_MISSES.STLB_HIT\", IAP_EVENT_08H_10H)\t\t\\\n__PMC_EV_ALIAS(\"DTLB_LOAD_MISSES.PDE_MISS\", IAP_EVENT_08H_20H)\t\t\\\n__PMC_EV_ALIAS(\"DTLB_LOAD_MISSES.PDP_MISS\", IAP_EVENT_08H_40H)\t\t\\\n__PMC_EV_ALIAS(\"DTLB_LOAD_MISSES.LARGE_WALK_COMPLETED\",\t\t\t\\\n    IAP_EVENT_08H_80H) \t\t\t\t\t\t\t\\\n__PMC_EV_ALIAS(\"MEM_INST_RETIRED.LOADS\", IAP_EVENT_0BH_01H)\t\t\\\n__PMC_EV_ALIAS(\"MEM_INST_RETIRED.STORES\", IAP_EVENT_0BH_02H)\t\t\\\n__PMC_EV_ALIAS(\"MEM_INST_RETIRED.LATENCY_ABOVE_THRESHOLD\",\t\t\\\n    IAP_EVENT_0BH_10H) \t\t\t\t\t\t\t\\\n__PMC_EV_ALIAS(\"MEM_STORE_RETIRED.DTLB_MISS\", IAP_EVENT_0CH_01H)\t\\\n__PMC_EV_ALIAS(\"UOPS_ISSUED.ANY\", IAP_EVENT_0EH_01H)\t\t\t\\\n__PMC_EV_ALIAS(\"UOPS_ISSUED.STALLED_CYCLES\", IAP_EVENT_0EH_01H)\t\t\\\n__PMC_EV_ALIAS(\"UOPS_ISSUED.FUSED\", IAP_EVENT_0EH_02H)\t\t\t\\\n__PMC_EV_ALIAS(\"MEM_UNCORE_RETIRED.L3_DATA_MISS_UNKNOWN\",\t\t\\\n    IAP_EVENT_0FH_01H)\t\t\t\t\t\t\t\\\n__PMC_EV_ALIAS(\"MEM_UNCORE_RETIRED.OTHER_CORE_L2_HITM\",\t\t\t\\\n    IAP_EVENT_0FH_02H)\t\t\t\t\t\t\t\\\n__PMC_EV_ALIAS(\"MEM_UNCORE_RETIRED.REMOTE_CACHE_LOCAL_HOME_HIT\",\t\\\n    IAP_EVENT_0FH_08H)\t\t\t\t\t\t\t\\\n__PMC_EV_ALIAS(\"MEM_UNCORE_RETIRED.REMOTE_DRAM\",\t\t\t\\\n    IAP_EVENT_0FH_10H)\t\t\t\t\t\t\t\\\n__PMC_EV_ALIAS(\"MEM_UNCORE_RETIRED.LOCAL_DRAM\", IAP_EVENT_0FH_20H)\t\\\n__PMC_EV_ALIAS(\"MEM_UNCORE_RETIRED.UNCACHEABLE\", IAP_EVENT_0FH_80H)\t\\\n__PMC_EV_ALIAS(\"FP_COMP_OPS_EXE.X87\", IAP_EVENT_10H_01H)\t\t\\\n__PMC_EV_ALIAS(\"FP_COMP_OPS_EXE.MMX\", IAP_EVENT_10H_02H)\t\t\\\n__PMC_EV_ALIAS(\"FP_COMP_OPS_EXE.SSE_FP\", IAP_EVENT_10H_04H)\t\t\\\n__PMC_EV_ALIAS(\"FP_COMP_OPS_EXE.SSE2_INTEGER\", IAP_EVENT_10H_08H)\t\\\n__PMC_EV_ALIAS(\"FP_COMP_OPS_EXE.SSE_FP_PACKED\", IAP_EVENT_10H_10H)\t\\\n__PMC_EV_ALIAS(\"FP_COMP_OPS_EXE.SSE_FP_SCALAR\", IAP_EVENT_10H_20H)\t\\\n__PMC_EV_ALIAS(\"FP_COMP_OPS_EXE.SSE_SINGLE_PRECISION\",\t\t\t\\\n    IAP_EVENT_10H_40H)\t\t\t\t\t\t\t\\\n__PMC_EV_ALIAS(\"FP_COMP_OPS_EXE.SSE_DOUBLE_PRECISION\",\t\t\t\\\n    IAP_EVENT_10H_80H)\t\t\t\t\t\t\t\\\n__PMC_EV_ALIAS(\"SIMD_INT_128.PACKED_MPY\", IAP_EVENT_12H_01H)\t\t\\\n__PMC_EV_ALIAS(\"SIMD_INT_128.PACKED_SHIFT\", IAP_EVENT_12H_02H)\t\t\\\n__PMC_EV_ALIAS(\"SIMD_INT_128.PACK\", IAP_EVENT_12H_04H)\t\t\t\\\n__PMC_EV_ALIAS(\"SIMD_INT_128.UNPACK\", IAP_EVENT_12H_08H)\t\t\\\n__PMC_EV_ALIAS(\"SIMD_INT_128.PACKED_LOGICAL\", IAP_EVENT_12H_10H)\t\\\n__PMC_EV_ALIAS(\"SIMD_INT_128.PACKED_ARITH\", IAP_EVENT_12H_20H)\t\t\\\n__PMC_EV_ALIAS(\"SIMD_INT_128.SHUFFLE_MOVE\", IAP_EVENT_12H_40H)\t\t\\\n__PMC_EV_ALIAS(\"LOAD_DISPATCH.RS\", IAP_EVENT_13H_01H)\t\t\t\\\n__PMC_EV_ALIAS(\"LOAD_DISPATCH.RS_DELAYED\", IAP_EVENT_13H_02H)\t\t\\\n__PMC_EV_ALIAS(\"LOAD_DISPATCH.MOB\", IAP_EVENT_13H_04H)\t\t\t\\\n__PMC_EV_ALIAS(\"LOAD_DISPATCH.ANY\", IAP_EVENT_13H_07H)\t\t\t\\\n__PMC_EV_ALIAS(\"ARITH.CYCLES_DIV_BUSY\", IAP_EVENT_14H_01H)\t\t\\\n__PMC_EV_ALIAS(\"ARITH.MUL\", IAP_EVENT_14H_02H)\t\t\t\t\\\n__PMC_EV_ALIAS(\"INST_QUEUE_WRITES\", IAP_EVENT_17H_01H)\t\t\t\\\n__PMC_EV_ALIAS(\"INST_DECODED.DEC0\", IAP_EVENT_18H_01H)\t\t\t\\\n__PMC_EV_ALIAS(\"TWO_UOP_INSTS_DECODED\", IAP_EVENT_19H_01H)\t\t\\\n__PMC_EV_ALIAS(\"INST_QUEUE_WRITE_CYCLES\", IAP_EVENT_1EH_01H)\t\t\\\n__PMC_EV_ALIAS(\"LSD_OVERFLOW\", IAP_EVENT_20H_01H)\t\t\t\\\n__PMC_EV_ALIAS(\"L2_RQSTS.LD_HIT\", IAP_EVENT_24H_01H)\t\t\t\\\n__PMC_EV_ALIAS(\"L2_RQSTS.LD_MISS\", IAP_EVENT_24H_02H)\t\t\t\\\n__PMC_EV_ALIAS(\"L2_RQSTS.LOADS\", IAP_EVENT_24H_03H)\t\t\t\\\n__PMC_EV_ALIAS(\"L2_RQSTS.RFO_HIT\", IAP_EVENT_24H_04H)\t\t\t\\\n__PMC_EV_ALIAS(\"L2_RQSTS.RFO_MISS\", IAP_EVENT_24H_08H)\t\t\t\\\n__PMC_EV_ALIAS(\"L2_RQSTS.RFOS\", IAP_EVENT_24H_0CH)\t\t\t\\\n__PMC_EV_ALIAS(\"L2_RQSTS.IFETCH_HIT\", IAP_EVENT_24H_10H)\t\t\\\n__PMC_EV_ALIAS(\"L2_RQSTS.IFETCH_MISS\", IAP_EVENT_24H_20H)\t\t\\\n__PMC_EV_ALIAS(\"L2_RQSTS.IFETCHES\", IAP_EVENT_24H_30H)\t\t\t\\\n__PMC_EV_ALIAS(\"L2_RQSTS.PREFETCH_HIT\", IAP_EVENT_24H_40H)\t\t\\\n__PMC_EV_ALIAS(\"L2_RQSTS.PREFETCH_MISS\", IAP_EVENT_24H_80H)\t\t\\\n__PMC_EV_ALIAS(\"L2_RQSTS.PREFETCHES\", IAP_EVENT_24H_C0H)\t\t\\\n__PMC_EV_ALIAS(\"L2_RQSTS.MISS\", IAP_EVENT_24H_AAH)\t\t\t\\\n__PMC_EV_ALIAS(\"L2_RQSTS.REFERENCES\", IAP_EVENT_24H_FFH)\t\t\\\n__PMC_EV_ALIAS(\"L2_DATA_RQSTS.DEMAND.I_STATE\", IAP_EVENT_26H_01H)\t\\\n__PMC_EV_ALIAS(\"L2_DATA_RQSTS.DEMAND.S_STATE\", IAP_EVENT_26H_02H)\t\\\n__PMC_EV_ALIAS(\"L2_DATA_RQSTS.DEMAND.E_STATE\", IAP_EVENT_26H_04H)\t\\\n__PMC_EV_ALIAS(\"L2_DATA_RQSTS.DEMAND.M_STATE\", IAP_EVENT_26H_08H)\t\\\n__PMC_EV_ALIAS(\"L2_DATA_RQSTS.DEMAND.MESI\", IAP_EVENT_26H_0FH)\t\t\\\n__PMC_EV_ALIAS(\"L2_DATA_RQSTS.PREFETCH.I_STATE\", IAP_EVENT_26H_10H)\t\\\n__PMC_EV_ALIAS(\"L2_DATA_RQSTS.PREFETCH.S_STATE\", IAP_EVENT_26H_20H)\t\\\n__PMC_EV_ALIAS(\"L2_DATA_RQSTS.PREFETCH.E_STATE\", IAP_EVENT_26H_40H)\t\\\n__PMC_EV_ALIAS(\"L2_DATA_RQSTS.PREFETCH.M_STATE\", IAP_EVENT_26H_80H)\t\\\n__PMC_EV_ALIAS(\"L2_DATA_RQSTS.PREFETCH.MESI\", IAP_EVENT_26H_F0H)\t\\\n__PMC_EV_ALIAS(\"L2_DATA_RQSTS.ANY\", IAP_EVENT_26H_FFH)\t\t\t\\\n__PMC_EV_ALIAS(\"L2_WRITE.RFO.I_STATE\", IAP_EVENT_27H_01H)\t\t\\\n__PMC_EV_ALIAS(\"L2_WRITE.RFO.S_STATE\", IAP_EVENT_27H_02H)\t\t\\\n__PMC_EV_ALIAS(\"L2_WRITE.RFO.M_STATE\", IAP_EVENT_27H_08H)\t\t\\\n__PMC_EV_ALIAS(\"L2_WRITE.RFO.HIT\", IAP_EVENT_27H_0EH)\t\t\t\\\n__PMC_EV_ALIAS(\"L2_WRITE.RFO.MESI\", IAP_EVENT_27H_0FH)\t\t\t\\\n__PMC_EV_ALIAS(\"L2_WRITE.LOCK.I_STATE\", IAP_EVENT_27H_10H)\t\t\\\n__PMC_EV_ALIAS(\"L2_WRITE.LOCK.S_STATE\", IAP_EVENT_27H_20H)\t\t\\\n__PMC_EV_ALIAS(\"L2_WRITE.LOCK.E_STATE\", IAP_EVENT_27H_40H)\t\t\\\n__PMC_EV_ALIAS(\"L2_WRITE.LOCK.M_STATE\", IAP_EVENT_27H_80H)\t\t\\\n__PMC_EV_ALIAS(\"L2_WRITE.LOCK.HIT\", IAP_EVENT_27H_E0H)\t\t\t\\\n__PMC_EV_ALIAS(\"L2_WRITE.LOCK.MESI\", IAP_EVENT_27H_F0H)\t\t\t\\\n__PMC_EV_ALIAS(\"L1D_WB_L2.I_STATE\", IAP_EVENT_28H_01H)\t\t\t\\\n__PMC_EV_ALIAS(\"L1D_WB_L2.S_STATE\", IAP_EVENT_28H_02H)\t\t\t\\\n__PMC_EV_ALIAS(\"L1D_WB_L2.E_STATE\", IAP_EVENT_28H_04H)\t\t\t\\\n__PMC_EV_ALIAS(\"L1D_WB_L2.M_STATE\", IAP_EVENT_28H_08H)\t\t\t\\\n__PMC_EV_ALIAS(\"L1D_WB_L2.MESI\", IAP_EVENT_28H_0FH)\t\t\t\\\n__PMC_EV_ALIAS(\"L3_LAT_CACHE.REFERENCE\", IAP_EVENT_2EH_4FH)\t\t\\\n__PMC_EV_ALIAS(\"L3_LAT_CACHE.MISS\", IAP_EVENT_2EH_41H)\t\t\t\\\n__PMC_EV_ALIAS(\"CPU_CLK_UNHALTED.THREAD_P\", IAP_EVENT_3CH_00H)\t\t\\\n__PMC_EV_ALIAS(\"CPU_CLK_UNHALTED.REF_P\", IAP_EVENT_3CH_01H)\t\t\\\n__PMC_EV_ALIAS(\"L1D_CACHE_LD.I_STATE\", IAP_EVENT_40H_01H)\t\t\\\n__PMC_EV_ALIAS(\"L1D_CACHE_LD.S_STATE\", IAP_EVENT_40H_02H)\t\t\\\n__PMC_EV_ALIAS(\"L1D_CACHE_LD.E_STATE\", IAP_EVENT_40H_04H)\t\t\\\n__PMC_EV_ALIAS(\"L1D_CACHE_LD.M_STATE\", IAP_EVENT_40H_08H)\t\t\\\n__PMC_EV_ALIAS(\"L1D_CACHE_LD.MESI\", IAP_EVENT_40H_0FH)\t\t\t\\\n__PMC_EV_ALIAS(\"L1D_CACHE_ST.S_STATE\", IAP_EVENT_41H_02H)\t\t\\\n__PMC_EV_ALIAS(\"L1D_CACHE_ST.E_STATE\", IAP_EVENT_41H_04H)\t\t\\\n__PMC_EV_ALIAS(\"L1D_CACHE_ST.M_STATE\", IAP_EVENT_41H_08H)\t\t\\\n__PMC_EV_ALIAS(\"L1D_CACHE_LOCK.HIT\", IAP_EVENT_42H_01H)\t\t\t\\\n__PMC_EV_ALIAS(\"L1D_CACHE_LOCK.S_STATE\", IAP_EVENT_42H_02H)\t\t\\\n__PMC_EV_ALIAS(\"L1D_CACHE_LOCK.E_STATE\", IAP_EVENT_42H_04H)\t\t\\\n__PMC_EV_ALIAS(\"L1D_CACHE_LOCK.M_STATE\", IAP_EVENT_42H_08H)\t\t\\\n__PMC_EV_ALIAS(\"L1D_ALL_REF.ANY\", IAP_EVENT_43H_01H)\t\t\t\\\n__PMC_EV_ALIAS(\"L1D_ALL_REF.CACHEABLE\", IAP_EVENT_43H_02H)\t\t\\\n__PMC_EV_ALIAS(\"L1D_PEND_MISS.LOAD_BUFFERS_FULL\", IAP_EVENT_48H_02H)\t\\\n__PMC_EV_ALIAS(\"DTLB_MISSES.ANY\", IAP_EVENT_49H_01H)\t\t\t\\\n__PMC_EV_ALIAS(\"DTLB_MISSES.WALK_COMPLETED\", IAP_EVENT_49H_02H)\t\t\\\n__PMC_EV_ALIAS(\"DTLB_MISSES.STLB_HIT\", IAP_EVENT_49H_10H)\t\t\\\n__PMC_EV_ALIAS(\"LOAD_HIT_PRE\", IAP_EVENT_4CH_01H)\t\t\t\\\n__PMC_EV_ALIAS(\"L1D_PREFETCH.REQUESTS\", IAP_EVENT_4EH_01H)\t\t\\\n__PMC_EV_ALIAS(\"L1D_PREFETCH.MISS\", IAP_EVENT_4EH_02H)\t\t\t\\\n__PMC_EV_ALIAS(\"L1D_PREFETCH.TRIGGERS\", IAP_EVENT_4EH_04H)\t\t\\\n__PMC_EV_ALIAS(\"L1D.REPL\", IAP_EVENT_51H_01H)\t\t\t\t\\\n__PMC_EV_ALIAS(\"L1D.M_REPL\", IAP_EVENT_51H_02H)\t\t\t\t\\\n__PMC_EV_ALIAS(\"L1D.M_EVICT\", IAP_EVENT_51H_04H)\t\t\t\\\n__PMC_EV_ALIAS(\"L1D.M_SNOOP_EVICT\", IAP_EVENT_51H_08H)\t\t\t\\\n__PMC_EV_ALIAS(\"L1D_CACHE_PREFETCH_LOCK_FB_HIT\", IAP_EVENT_52H_01H)\t\\\n__PMC_EV_ALIAS(\"L1D_CACHE_LOCK_FB_HIT\", IAP_EVENT_53H_01H)\t\t\\\n__PMC_EV_ALIAS(\"CACHE_LOCK_CYCLES.L1D_L2\", IAP_EVENT_63H_01H)\t\t\\\n__PMC_EV_ALIAS(\"CACHE_LOCK_CYCLES.L1D\", IAP_EVENT_63H_02H)\t\t\\\n__PMC_EV_ALIAS(\"IO_TRANSACTIONS\", IAP_EVENT_6CH_01H)\t\t\t\\\n__PMC_EV_ALIAS(\"L1I.HITS\", IAP_EVENT_80H_01H)\t\t\t\t\\\n__PMC_EV_ALIAS(\"L1I.MISSES\", IAP_EVENT_80H_02H)\t\t\t\t\\\n__PMC_EV_ALIAS(\"L1I.READS\", IAP_EVENT_80H_03H)\t\t\t\t\\\n__PMC_EV_ALIAS(\"L1I.CYCLES_STALLED\", IAP_EVENT_80H_04H)\t\t\t\\\n__PMC_EV_ALIAS(\"LARGE_ITLB.HIT\", IAP_EVENT_82H_01H)\t\t\t\\\n__PMC_EV_ALIAS(\"ITLB_MISSES.ANY\", IAP_EVENT_85H_01H)\t\t\t\\\n__PMC_EV_ALIAS(\"ITLB_MISSES.WALK_COMPLETED\", IAP_EVENT_85H_02H)\t\t\\\n__PMC_EV_ALIAS(\"ILD_STALL.LCP\", IAP_EVENT_87H_01H)\t\t\t\\\n__PMC_EV_ALIAS(\"ILD_STALL.MRU\", IAP_EVENT_87H_02H)\t\t\t\\\n__PMC_EV_ALIAS(\"ILD_STALL.IQ_FULL\", IAP_EVENT_87H_04H)\t\t\t\\\n__PMC_EV_ALIAS(\"ILD_STALL.REGEN\", IAP_EVENT_87H_08H)\t\t\t\\\n__PMC_EV_ALIAS(\"ILD_STALL.ANY\", IAP_EVENT_87H_0FH)\t\t\t\\\n__PMC_EV_ALIAS(\"BR_INST_EXEC.COND\", IAP_EVENT_88H_01H)\t\t\t\\\n__PMC_EV_ALIAS(\"BR_INST_EXEC.DIRECT\", IAP_EVENT_88H_02H)\t\t\\\n__PMC_EV_ALIAS(\"BR_INST_EXEC.INDIRECT_NON_CALL\", IAP_EVENT_88H_04H)\t\\\n__PMC_EV_ALIAS(\"BR_INST_EXEC.NON_CALLS\", IAP_EVENT_88H_07H)\t\t\\\n__PMC_EV_ALIAS(\"BR_INST_EXEC.RETURN_NEAR\", IAP_EVENT_88H_08H)\t\t\\\n__PMC_EV_ALIAS(\"BR_INST_EXEC.DIRECT_NEAR_CALL\", IAP_EVENT_88H_10H)\t\\\n__PMC_EV_ALIAS(\"BR_INST_EXEC.INDIRECT_NEAR_CALL\", IAP_EVENT_88H_20H)\t\\\n__PMC_EV_ALIAS(\"BR_INST_EXEC.NEAR_CALLS\", IAP_EVENT_88H_30H)\t\t\\\n__PMC_EV_ALIAS(\"BR_INST_EXEC.TAKEN\", IAP_EVENT_88H_40H)\t\t\t\\\n__PMC_EV_ALIAS(\"BR_INST_EXEC.ANY\", IAP_EVENT_88H_7FH)\t\t\t\\\n__PMC_EV_ALIAS(\"BR_MISP_EXEC.COND\", IAP_EVENT_89H_01H)\t\t\t\\\n__PMC_EV_ALIAS(\"BR_MISP_EXEC.DIRECT\", IAP_EVENT_89H_02H)\t\t\\\n__PMC_EV_ALIAS(\"BR_MISP_EXEC.INDIRECT_NON_CALL\", IAP_EVENT_89H_04H)\t\\\n__PMC_EV_ALIAS(\"BR_MISP_EXEC.NON_CALLS\", IAP_EVENT_89H_07H)\t\t\\\n__PMC_EV_ALIAS(\"BR_MISP_EXEC.RETURN_NEAR\", IAP_EVENT_89H_08H)\t\t\\\n__PMC_EV_ALIAS(\"BR_MISP_EXEC.DIRECT_NEAR_CALL\", IAP_EVENT_89H_10H)\t\\\n__PMC_EV_ALIAS(\"BR_MISP_EXEC.INDIRECT_NEAR_CALL\", IAP_EVENT_89H_20H)\t\\\n__PMC_EV_ALIAS(\"BR_MISP_EXEC.NEAR_CALLS\", IAP_EVENT_89H_30H)\t\t\\\n__PMC_EV_ALIAS(\"BR_MISP_EXEC.TAKEN\", IAP_EVENT_89H_40H)\t\t\t\\\n__PMC_EV_ALIAS(\"BR_MISP_EXEC.ANY\", IAP_EVENT_89H_7FH)\t\t\t\\\n__PMC_EV_ALIAS(\"RESOURCE_STALLS.ANY\", IAP_EVENT_A2H_01H)\t\t\\\n__PMC_EV_ALIAS(\"RESOURCE_STALLS.LOAD\", IAP_EVENT_A2H_02H)\t\t\\\n__PMC_EV_ALIAS(\"RESOURCE_STALLS.RS_FULL\", IAP_EVENT_A2H_04H)\t\t\\\n__PMC_EV_ALIAS(\"RESOURCE_STALLS.STORE\", IAP_EVENT_A2H_08H)\t\t\\\n__PMC_EV_ALIAS(\"RESOURCE_STALLS.ROB_FULL\", IAP_EVENT_A2H_10H)\t\t\\\n__PMC_EV_ALIAS(\"RESOURCE_STALLS.FPCW\", IAP_EVENT_A2H_20H)\t\t\\\n__PMC_EV_ALIAS(\"RESOURCE_STALLS.MXCSR\", IAP_EVENT_A2H_40H)\t\t\\\n__PMC_EV_ALIAS(\"RESOURCE_STALLS.OTHER\", IAP_EVENT_A2H_80H)\t\t\\\n__PMC_EV_ALIAS(\"MACRO_INSTS.FUSIONS_DECODED\", IAP_EVENT_A6H_01H)\t\\\n__PMC_EV_ALIAS(\"BACLEAR_FORCE_IQ\", IAP_EVENT_A7H_01H)\t\t\t\\\n__PMC_EV_ALIAS(\"LSD.UOPS\", IAP_EVENT_A8H_01H)\t\t\t\t\\\n__PMC_EV_ALIAS(\"ITLB_FLUSH\", IAP_EVENT_AEH_01H)\t\t\t\t\\\n__PMC_EV_ALIAS(\"OFFCORE_REQUESTS.L1D_WRITEBACK\", IAP_EVENT_B0H_40H)\t\\\n__PMC_EV_ALIAS(\"UOPS_EXECUTED.PORT0\", IAP_EVENT_B1H_01H)\t\t\\\n__PMC_EV_ALIAS(\"UOPS_EXECUTED.PORT1\", IAP_EVENT_B1H_02H)\t\t\\\n__PMC_EV_ALIAS(\"UOPS_EXECUTED.PORT2_CORE\", IAP_EVENT_B1H_04H)\t\t\\\n__PMC_EV_ALIAS(\"UOPS_EXECUTED.PORT3_CORE\", IAP_EVENT_B1H_08H)\t\t\\\n__PMC_EV_ALIAS(\"UOPS_EXECUTED.PORT4_CORE\", IAP_EVENT_B1H_10H)\t\t\\\n__PMC_EV_ALIAS(\"UOPS_EXECUTED.CORE_ACTIVE_CYCLES_NO_PORT5\",\t\t\\\n    IAP_EVENT_B1H_1FH)\t\t\t\t\t\t\t\\\n__PMC_EV_ALIAS(\"UOPS_EXECUTED.PORT5\", IAP_EVENT_B1H_20H)\t\t\\\n__PMC_EV_ALIAS(\"UOPS_EXECUTED.CORE_ACTIVE_CYCLES\", IAP_EVENT_B1H_3FH)\t\\\n__PMC_EV_ALIAS(\"UOPS_EXECUTED.PORT015\", IAP_EVENT_B1H_40H)\t\t\\\n__PMC_EV_ALIAS(\"UOPS_EXECUTED.PORT234\", IAP_EVENT_B1H_80H)\t\t\\\n__PMC_EV_ALIAS(\"OFFCORE_REQUESTS_SQ_FULL\", IAP_EVENT_B2H_01H)\t\t\\\n__PMC_EV_ALIAS(\"OFF_CORE_RESPONSE_0\", IAP_EVENT_B7H_01H)\t\t\\\n__PMC_EV_ALIAS(\"SNOOP_RESPONSE.HIT\", IAP_EVENT_B8H_01H)\t\t\t\\\n__PMC_EV_ALIAS(\"SNOOP_RESPONSE.HITE\", IAP_EVENT_B8H_02H)\t\t\\\n__PMC_EV_ALIAS(\"SNOOP_RESPONSE.HITM\", IAP_EVENT_B8H_04H)\t\t\\\n__PMC_EV_ALIAS(\"OFF_CORE_RESPONSE_1\", IAP_EVENT_BBH_01H)\t\t\\\n__PMC_EV_ALIAS(\"INST_RETIRED.ANY_P\", IAP_EVENT_C0H_01H)\t\t\t\\\n__PMC_EV_ALIAS(\"INST_RETIRED.X87\", IAP_EVENT_C0H_02H)\t\t\t\\\n__PMC_EV_ALIAS(\"INST_RETIRED.MMX\", IAP_EVENT_C0H_04H)\t\t\t\\\n__PMC_EV_ALIAS(\"UOPS_RETIRED.ANY\", IAP_EVENT_C2H_01H)\t\t\t\\\n__PMC_EV_ALIAS(\"UOPS_RETIRED.RETIRE_SLOTS\", IAP_EVENT_C2H_02H)\t\t\\\n__PMC_EV_ALIAS(\"UOPS_RETIRED.MACRO_FUSED\", IAP_EVENT_C2H_04H)\t\t\\\n__PMC_EV_ALIAS(\"MACHINE_CLEARS.CYCLES\", IAP_EVENT_C3H_01H)\t\t\\\n__PMC_EV_ALIAS(\"MACHINE_CLEARS.MEM_ORDER\", IAP_EVENT_C3H_02H)\t\t\\\n__PMC_EV_ALIAS(\"MACHINE_CLEARS.SMC\", IAP_EVENT_C3H_04H)\t\t\t\\\n__PMC_EV_ALIAS(\"BR_INST_RETIRED.ALL_BRANCHES\", IAP_EVENT_C4H_00H)\t\\\n__PMC_EV_ALIAS(\"BR_INST_RETIRED.CONDITIONAL\", IAP_EVENT_C4H_01H)\t\\\n__PMC_EV_ALIAS(\"BR_INST_RETIRED.NEAR_CALL\", IAP_EVENT_C4H_02H)\t\t\\\n__PMC_EV_ALIAS(\"BR_INST_RETIRED.ALL_BRANCHES\", IAP_EVENT_C4H_04H)\t\\\n__PMC_EV_ALIAS(\"BR_MISP_RETIRED.ALL_BRANCHES\", IAP_EVENT_C5H_00H)\t\\\n__PMC_EV_ALIAS(\"BR_MISP_RETIRED.NEAR_CALL\", IAP_EVENT_C5H_02H)\t\t\\\n__PMC_EV_ALIAS(\"SSEX_UOPS_RETIRED.PACKED_SINGLE\", IAP_EVENT_C7H_01H)\t\\\n__PMC_EV_ALIAS(\"SSEX_UOPS_RETIRED.SCALAR_SINGLE\", IAP_EVENT_C7H_02H)\t\\\n__PMC_EV_ALIAS(\"SSEX_UOPS_RETIRED.PACKED_DOUBLE\", IAP_EVENT_C7H_04H)\t\\\n__PMC_EV_ALIAS(\"SSEX_UOPS_RETIRED.SCALAR_DOUBLE\", IAP_EVENT_C7H_08H)\t\\\n__PMC_EV_ALIAS(\"SSEX_UOPS_RETIRED.VECTOR_INTEGER\", IAP_EVENT_C7H_10H)\t\\\n__PMC_EV_ALIAS(\"ITLB_MISS_RETIRED\", IAP_EVENT_C8H_20H)\t\t\t\\\n__PMC_EV_ALIAS(\"MEM_LOAD_RETIRED.L1D_HIT\", IAP_EVENT_CBH_01H)\t\t\\\n__PMC_EV_ALIAS(\"MEM_LOAD_RETIRED.L2_HIT\", IAP_EVENT_CBH_02H)\t\t\\\n__PMC_EV_ALIAS(\"MEM_LOAD_RETIRED.L3_UNSHARED_HIT\", IAP_EVENT_CBH_04H)\t\\\n__PMC_EV_ALIAS(\"MEM_LOAD_RETIRED.OTHER_CORE_L2_HIT_HITM\",\t\t\\\n    IAP_EVENT_CBH_08H)\t\t\t\t\t\t\t\\\n__PMC_EV_ALIAS(\"MEM_LOAD_RETIRED.L3_MISS\", IAP_EVENT_CBH_10H)\t\t\\\n__PMC_EV_ALIAS(\"MEM_LOAD_RETIRED.HIT_LFB\", IAP_EVENT_CBH_40H)\t\t\\\n__PMC_EV_ALIAS(\"MEM_LOAD_RETIRED.DTLB_MISS\", IAP_EVENT_CBH_80H)\t\t\\\n__PMC_EV_ALIAS(\"FP_MMX_TRANS.TO_FP\", IAP_EVENT_CCH_01H)\t\t\t\\\n__PMC_EV_ALIAS(\"FP_MMX_TRANS.TO_MMX\", IAP_EVENT_CCH_02H)\t\t\\\n__PMC_EV_ALIAS(\"FP_MMX_TRANS.ANY\", IAP_EVENT_CCH_03H)\t\t\t\\\n__PMC_EV_ALIAS(\"MACRO_INSTS.DECODED\", IAP_EVENT_D0H_01H)\t\t\\\n__PMC_EV_ALIAS(\"UOPS_DECODED.MS\", IAP_EVENT_D1H_02H)\t\t\t\\\n__PMC_EV_ALIAS(\"UOPS_DECODED.ESP_FOLDING\", IAP_EVENT_D1H_04H)\t\t\\\n__PMC_EV_ALIAS(\"UOPS_DECODED.ESP_SYNC\", IAP_EVENT_D1H_08H)\t\t\\\n__PMC_EV_ALIAS(\"RAT_STALLS.FLAGS\", IAP_EVENT_D2H_01H)\t\t\t\\\n__PMC_EV_ALIAS(\"RAT_STALLS.REGISTERS\", IAP_EVENT_D2H_02H)\t\t\\\n__PMC_EV_ALIAS(\"RAT_STALLS.ROB_READ_PORT\", IAP_EVENT_D2H_04H)\t\t\\\n__PMC_EV_ALIAS(\"RAT_STALLS.SCOREBOARD\", IAP_EVENT_D2H_08H)\t\t\\\n__PMC_EV_ALIAS(\"RAT_STALLS.ANY\", IAP_EVENT_D2H_0FH)\t\t\t\\\n__PMC_EV_ALIAS(\"SEG_RENAME_STALLS\", IAP_EVENT_D4H_01H)\t\t\t\\\n__PMC_EV_ALIAS(\"ES_REG_RENAMES\", IAP_EVENT_D5H_01H)\t\t\t\\\n__PMC_EV_ALIAS(\"UOP_UNFUSION\", IAP_EVENT_DBH_01H)\t\t\t\\\n__PMC_EV_ALIAS(\"BR_INST_DECODED\", IAP_EVENT_E0H_01H)\t\t\t\\\n__PMC_EV_ALIAS(\"BPU_MISSED_CALL_RET\", IAP_EVENT_E5H_01H)\t\t\\\n__PMC_EV_ALIAS(\"BACLEAR.CLEAR\", IAP_EVENT_E6H_01H)\t\t\t\\\n__PMC_EV_ALIAS(\"BACLEAR.BAD_TARGET\", IAP_EVENT_E6H_02H)\t\t\t\\\n__PMC_EV_ALIAS(\"BPU_CLEARS.EARLY\", IAP_EVENT_E8H_01H)\t\t\t\\\n__PMC_EV_ALIAS(\"BPU_CLEARS.LATE\", IAP_EVENT_E8H_02H)\t\t\t\\\n__PMC_EV_ALIAS(\"BPU_CLEARS.ANY\", IAP_EVENT_E8H_03H)\t\t\t\\\n__PMC_EV_ALIAS(\"L2_TRANSACTIONS.LOAD\", IAP_EVENT_F0H_01H)\t\t\\\n__PMC_EV_ALIAS(\"L2_TRANSACTIONS.RFO\", IAP_EVENT_F0H_02H)\t\t\\\n__PMC_EV_ALIAS(\"L2_TRANSACTIONS.IFETCH\", IAP_EVENT_F0H_04H)\t\t\\\n__PMC_EV_ALIAS(\"L2_TRANSACTIONS.PREFETCH\", IAP_EVENT_F0H_08H)\t\t\\\n__PMC_EV_ALIAS(\"L2_TRANSACTIONS.L1D_WB\", IAP_EVENT_F0H_10H)\t\t\\\n__PMC_EV_ALIAS(\"L2_TRANSACTIONS.FILL\", IAP_EVENT_F0H_20H)\t\t\\\n__PMC_EV_ALIAS(\"L2_TRANSACTIONS.WB\", IAP_EVENT_F0H_40H)\t\t\t\\\n__PMC_EV_ALIAS(\"L2_TRANSACTIONS.ANY\", IAP_EVENT_F0H_80H)\t\t\\\n__PMC_EV_ALIAS(\"L2_LINES_IN.S_STATE\", IAP_EVENT_F1H_02H)\t\t\\\n__PMC_EV_ALIAS(\"L2_LINES_IN.E_STATE\", IAP_EVENT_F1H_04H)\t\t\\\n__PMC_EV_ALIAS(\"L2_LINES_IN.ANY\", IAP_EVENT_F1H_07H)\t\t\t\\\n__PMC_EV_ALIAS(\"L2_LINES_OUT.DEMAND_CLEAN\", IAP_EVENT_F2H_01H)\t\t\\\n__PMC_EV_ALIAS(\"L2_LINES_OUT.DEMAND_DIRTY\", IAP_EVENT_F2H_02H)\t\t\\\n__PMC_EV_ALIAS(\"L2_LINES_OUT.PREFETCH_CLEAN\", IAP_EVENT_F2H_04H)\t\\\n__PMC_EV_ALIAS(\"L2_LINES_OUT.PREFETCH_DIRTY\", IAP_EVENT_F2H_08H)\t\\\n__PMC_EV_ALIAS(\"L2_LINES_OUT.ANY\", IAP_EVENT_F2H_0FH)\t\t\t\\\n__PMC_EV_ALIAS(\"SQ_MISC.SPLIT_LOCK\", IAP_EVENT_F4H_10H)\t\t\t\\\n__PMC_EV_ALIAS(\"SQ_FULL_STALL_CYCLES\", IAP_EVENT_F6H_01H)\t\t\\\n__PMC_EV_ALIAS(\"FP_ASSIST.ALL\", IAP_EVENT_F7H_01H)\t\t\t\\\n__PMC_EV_ALIAS(\"FP_ASSIST.OUTPUT\", IAP_EVENT_F7H_02H)\t\t\t\\\n__PMC_EV_ALIAS(\"FP_ASSIST.INPUT\", IAP_EVENT_F7H_04H)\t\t\t\\\n__PMC_EV_ALIAS(\"SIMD_INT_64.PACKED_MPY\", IAP_EVENT_FDH_01H)\t\t\\\n__PMC_EV_ALIAS(\"SIMD_INT_64.PACKED_SHIFT\", IAP_EVENT_FDH_02H)\t\t\\\n__PMC_EV_ALIAS(\"SIMD_INT_64.PACK\", IAP_EVENT_FDH_04H)\t\t\t\\\n__PMC_EV_ALIAS(\"SIMD_INT_64.UNPACK\", IAP_EVENT_FDH_08H)\t\t\t\\\n__PMC_EV_ALIAS(\"SIMD_INT_64.PACKED_LOGICAL\", IAP_EVENT_FDH_10H)\t\t\\\n__PMC_EV_ALIAS(\"SIMD_INT_64.PACKED_ARITH\", IAP_EVENT_FDH_20H)\t\t\\\n__PMC_EV_ALIAS(\"SIMD_INT_64.SHUFFLE_MOVE\", IAP_EVENT_FDH_40H)\t\t\\\n__PMC_EV_ALIAS_COREI7_OLD()\n\n/*\n * Aliases for Westmere PMC events (253669-033US December 2009)\n */\n#define\t__PMC_EV_ALIAS_WESTMERE()\t\t\t\t\t\\\n__PMC_EV_ALIAS_INTEL_ARCHITECTURAL()\t\t\t\t\t\\\n__PMC_EV_ALIAS(\"LOAD_BLOCK.OVERLAP_STORE\", IAP_EVENT_03H_02H)\t\t\\\n__PMC_EV_ALIAS(\"SB_DRAIN.ANY\", IAP_EVENT_04H_07H)\t\t\t\\\n__PMC_EV_ALIAS(\"MISALIGN_MEMORY.STORE\", IAP_EVENT_05H_02H)\t\t\\\n__PMC_EV_ALIAS(\"STORE_BLOCKS.AT_RET\", IAP_EVENT_06H_04H)\t\t\\\n__PMC_EV_ALIAS(\"STORE_BLOCKS.L1D_BLOCK\", IAP_EVENT_06H_08H)\t\t\\\n__PMC_EV_ALIAS(\"PARTIAL_ADDRESS_ALIAS\", IAP_EVENT_07H_01H)\t\t\\\n__PMC_EV_ALIAS(\"DTLB_LOAD_MISSES.ANY\", IAP_EVENT_08H_01H)\t\t\\\n__PMC_EV_ALIAS(\"DTLB_LOAD_MISSES.WALK_COMPLETED\", IAP_EVENT_08H_02H)\t\\\n__PMC_EV_ALIAS(\"DTLB_LOAD_MISSES.WALK_CYCLES\", IAP_EVENT_08H_04H)\t\\\n__PMC_EV_ALIAS(\"DTLB_LOAD_MISSES.STLB_HIT\", IAP_EVENT_08H_10H)\t\t\\\n__PMC_EV_ALIAS(\"DTLB_LOAD_MISSES.PDE_MISS\", IAP_EVENT_08H_20H)\t\t\\\n__PMC_EV_ALIAS(\"MEM_INST_RETIRED.LOADS\", IAP_EVENT_0BH_01H)\t\t\\\n__PMC_EV_ALIAS(\"MEM_INST_RETIRED.STORES\", IAP_EVENT_0BH_02H)\t\t\\\n__PMC_EV_ALIAS(\"MEM_INST_RETIRED.LATENCY_ABOVE_THRESHOLD\",\t\t\\\n    IAP_EVENT_0BH_10H)\t\t\t\t\t\t\t\\\n__PMC_EV_ALIAS(\"MEM_STORE_RETIRED.DTLB_MISS\", IAP_EVENT_0CH_01H)\t\\\n__PMC_EV_ALIAS(\"UOPS_ISSUED.ANY\", IAP_EVENT_0EH_01H)\t\t\t\\\n__PMC_EV_ALIAS(\"UOPS_ISSUED.STALLED_CYCLES\", IAP_EVENT_0EH_01H)\t\t\\\n__PMC_EV_ALIAS(\"UOPS_ISSUED.FUSED\", IAP_EVENT_0EH_02H)\t\t\t\\\n__PMC_EV_ALIAS(\"MEM_UNCORE_RETIRED.LOCAL_HITM\", IAP_EVENT_0FH_02H)\t\\\n__PMC_EV_ALIAS(\"MEM_UNCORE_RETIRED.LOCAL_DRAM_AND_REMOTE_CACHE_HIT\",\t\\\n    IAP_EVENT_0FH_08H)\t\t\t\t\t\t\t\\\n__PMC_EV_ALIAS(\"MEM_UNCORE_RETIRED.LOCAL_DRAM\", IAP_EVENT_0FH_10H)\t\\\n__PMC_EV_ALIAS(\"MEM_UNCORE_RETIRED.REMOTE_DRAM\", IAP_EVENT_0FH_20H)\t\\\n__PMC_EV_ALIAS(\"MEM_UNCORE_RETIRED.UNCACHEABLE\", IAP_EVENT_0FH_80H)\t\\\n__PMC_EV_ALIAS(\"FP_COMP_OPS_EXE.X87\", IAP_EVENT_10H_01H)\t\t\\\n__PMC_EV_ALIAS(\"FP_COMP_OPS_EXE.MMX\", IAP_EVENT_10H_02H)\t\t\\\n__PMC_EV_ALIAS(\"FP_COMP_OPS_EXE.SSE_FP\", IAP_EVENT_10H_04H)\t\t\\\n__PMC_EV_ALIAS(\"FP_COMP_OPS_EXE.SSE2_INTEGER\", IAP_EVENT_10H_08H)\t\\\n__PMC_EV_ALIAS(\"FP_COMP_OPS_EXE.SSE_FP_PACKED\", IAP_EVENT_10H_10H)\t\\\n__PMC_EV_ALIAS(\"FP_COMP_OPS_EXE.SSE_FP_SCALAR\", IAP_EVENT_10H_20H)\t\\\n__PMC_EV_ALIAS(\"FP_COMP_OPS_EXE.SSE_SINGLE_PRECISION\",\t\t\t\\\n    IAP_EVENT_10H_40H) \t\t\t\t\t\t\t\\\n__PMC_EV_ALIAS(\"FP_COMP_OPS_EXE.SSE_DOUBLE_PRECISION\",\t\t\t\\\n    IAP_EVENT_10H_80H)\t\t\t\t\t\t\t\\\n__PMC_EV_ALIAS(\"SIMD_INT_128.PACKED_MPY\", IAP_EVENT_12H_01H)\t\t\\\n__PMC_EV_ALIAS(\"SIMD_INT_128.PACKED_SHIFT\", IAP_EVENT_12H_02H)\t\t\\\n__PMC_EV_ALIAS(\"SIMD_INT_128.PACK\", IAP_EVENT_12H_04H)\t\t\t\\\n__PMC_EV_ALIAS(\"SIMD_INT_128.UNPACK\", IAP_EVENT_12H_08H)\t\t\\\n__PMC_EV_ALIAS(\"SIMD_INT_128.PACKED_LOGICAL\", IAP_EVENT_12H_10H)\t\\\n__PMC_EV_ALIAS(\"SIMD_INT_128.PACKED_ARITH\", IAP_EVENT_12H_20H)\t\t\\\n__PMC_EV_ALIAS(\"SIMD_INT_128.SHUFFLE_MOVE\", IAP_EVENT_12H_40H)\t\t\\\n__PMC_EV_ALIAS(\"LOAD_DISPATCH.RS\", IAP_EVENT_13H_01H)\t\t\t\\\n__PMC_EV_ALIAS(\"LOAD_DISPATCH.RS_DELAYED\", IAP_EVENT_13H_02H)\t\t\\\n__PMC_EV_ALIAS(\"LOAD_DISPATCH.MOB\", IAP_EVENT_13H_04H)\t\t\t\\\n__PMC_EV_ALIAS(\"LOAD_DISPATCH.ANY\", IAP_EVENT_13H_07H)\t\t\t\\\n__PMC_EV_ALIAS(\"ARITH.CYCLES_DIV_BUSY\", IAP_EVENT_14H_01H)\t\t\\\n__PMC_EV_ALIAS(\"ARITH.MUL\", IAP_EVENT_14H_02H)\t\t\t\t\\\n__PMC_EV_ALIAS(\"INST_QUEUE_WRITES\", IAP_EVENT_17H_01H)\t\t\t\\\n__PMC_EV_ALIAS(\"INST_DECODED.DEC0\", IAP_EVENT_18H_01H)\t\t\t\\\n__PMC_EV_ALIAS(\"TWO_UOP_INSTS_DECODED\", IAP_EVENT_19H_01H)\t\t\\\n__PMC_EV_ALIAS(\"INST_QUEUE_WRITE_CYCLES\", IAP_EVENT_1EH_01H)\t\t\\\n__PMC_EV_ALIAS(\"LSD_OVERFLOW\", IAP_EVENT_20H_01H)\t\t\t\\\n__PMC_EV_ALIAS(\"L2_RQSTS.LD_HIT\", IAP_EVENT_24H_01H)\t\t\t\\\n__PMC_EV_ALIAS(\"L2_RQSTS.LD_MISS\", IAP_EVENT_24H_02H)\t\t\t\\\n__PMC_EV_ALIAS(\"L2_RQSTS.LOADS\", IAP_EVENT_24H_03H)\t\t\t\\\n__PMC_EV_ALIAS(\"L2_RQSTS.RFO_HIT\", IAP_EVENT_24H_04H)\t\t\t\\\n__PMC_EV_ALIAS(\"L2_RQSTS.RFO_MISS\", IAP_EVENT_24H_08H)\t\t\t\\\n__PMC_EV_ALIAS(\"L2_RQSTS.RFOS\", IAP_EVENT_24H_0CH)\t\t\t\\\n__PMC_EV_ALIAS(\"L2_RQSTS.IFETCH_HIT\", IAP_EVENT_24H_10H)\t\t\\\n__PMC_EV_ALIAS(\"L2_RQSTS.IFETCH_MISS\", IAP_EVENT_24H_20H)\t\t\\\n__PMC_EV_ALIAS(\"L2_RQSTS.IFETCHES\", IAP_EVENT_24H_30H)\t\t\t\\\n__PMC_EV_ALIAS(\"L2_RQSTS.PREFETCH_HIT\", IAP_EVENT_24H_40H)\t\t\\\n__PMC_EV_ALIAS(\"L2_RQSTS.PREFETCH_MISS\", IAP_EVENT_24H_80H)\t\t\\\n__PMC_EV_ALIAS(\"L2_RQSTS.PREFETCHES\", IAP_EVENT_24H_C0H)\t\t\\\n__PMC_EV_ALIAS(\"L2_RQSTS.MISS\", IAP_EVENT_24H_AAH)\t\t\t\\\n__PMC_EV_ALIAS(\"L2_RQSTS.REFERENCES\", IAP_EVENT_24H_FFH)\t\t\\\n__PMC_EV_ALIAS(\"L2_DATA_RQSTS.DEMAND.I_STATE\", IAP_EVENT_26H_01H)\t\\\n__PMC_EV_ALIAS(\"L2_DATA_RQSTS.DEMAND.S_STATE\", IAP_EVENT_26H_02H)\t\\\n__PMC_EV_ALIAS(\"L2_DATA_RQSTS.DEMAND.E_STATE\", IAP_EVENT_26H_04H)\t\\\n__PMC_EV_ALIAS(\"L2_DATA_RQSTS.DEMAND.M_STATE\", IAP_EVENT_26H_08H)\t\\\n__PMC_EV_ALIAS(\"L2_DATA_RQSTS.DEMAND.MESI\", IAP_EVENT_26H_0FH)\t\t\\\n__PMC_EV_ALIAS(\"L2_DATA_RQSTS.PREFETCH.I_STATE\", IAP_EVENT_26H_10H)\t\\\n__PMC_EV_ALIAS(\"L2_DATA_RQSTS.PREFETCH.S_STATE\", IAP_EVENT_26H_20H)\t\\\n__PMC_EV_ALIAS(\"L2_DATA_RQSTS.PREFETCH.E_STATE\", IAP_EVENT_26H_40H)\t\\\n__PMC_EV_ALIAS(\"L2_DATA_RQSTS.PREFETCH.M_STATE\", IAP_EVENT_26H_80H)\t\\\n__PMC_EV_ALIAS(\"L2_DATA_RQSTS.PREFETCH.MESI\", IAP_EVENT_26H_F0H)\t\\\n__PMC_EV_ALIAS(\"L2_DATA_RQSTS.ANY\", IAP_EVENT_26H_FFH)\t\t\t\\\n__PMC_EV_ALIAS(\"L2_WRITE.RFO.I_STATE\", IAP_EVENT_27H_01H)\t\t\\\n__PMC_EV_ALIAS(\"L2_WRITE.RFO.S_STATE\", IAP_EVENT_27H_02H)\t\t\\\n__PMC_EV_ALIAS(\"L2_WRITE.RFO.M_STATE\", IAP_EVENT_27H_08H)\t\t\\\n__PMC_EV_ALIAS(\"L2_WRITE.RFO.HIT\", IAP_EVENT_27H_0EH)\t\t\t\\\n__PMC_EV_ALIAS(\"L2_WRITE.RFO.MESI\", IAP_EVENT_27H_0FH)\t\t\t\\\n__PMC_EV_ALIAS(\"L2_WRITE.LOCK.I_STATE\", IAP_EVENT_27H_10H)\t\t\\\n__PMC_EV_ALIAS(\"L2_WRITE.LOCK.S_STATE\", IAP_EVENT_27H_20H)\t\t\\\n__PMC_EV_ALIAS(\"L2_WRITE.LOCK.E_STATE\", IAP_EVENT_27H_40H)\t\t\\\n__PMC_EV_ALIAS(\"L2_WRITE.LOCK.M_STATE\", IAP_EVENT_27H_80H)\t\t\\\n__PMC_EV_ALIAS(\"L2_WRITE.LOCK.HIT\", IAP_EVENT_27H_E0H)\t\t\t\\\n__PMC_EV_ALIAS(\"L2_WRITE.LOCK.MESI\", IAP_EVENT_27H_F0H)\t\t\t\\\n__PMC_EV_ALIAS(\"L1D_WB_L2.I_STATE\", IAP_EVENT_28H_01H)\t\t\t\\\n__PMC_EV_ALIAS(\"L1D_WB_L2.S_STATE\", IAP_EVENT_28H_02H)\t\t\t\\\n__PMC_EV_ALIAS(\"L1D_WB_L2.E_STATE\", IAP_EVENT_28H_04H)\t\t\t\\\n__PMC_EV_ALIAS(\"L1D_WB_L2.M_STATE\", IAP_EVENT_28H_08H)\t\t\t\\\n__PMC_EV_ALIAS(\"L1D_WB_L2.MESI\", IAP_EVENT_28H_0FH)\t\t\t\\\n__PMC_EV_ALIAS(\"L3_LAT_CACHE.REFERENCE\", IAP_EVENT_2EH_02H)\t\t\\\n__PMC_EV_ALIAS(\"L3_LAT_CACHE.MISS\", IAP_EVENT_2EH_01H)\t\t\t\\\n__PMC_EV_ALIAS(\"CPU_CLK_UNHALTED.THREAD_P\", IAP_EVENT_3CH_00H)\t\t\\\n__PMC_EV_ALIAS(\"CPU_CLK_UNHALTED.REF_P\", IAP_EVENT_3CH_01H)\t\t\\\n__PMC_EV_ALIAS(\"DTLB_MISSES.ANY\", IAP_EVENT_49H_01H)\t\t\t\\\n__PMC_EV_ALIAS(\"DTLB_MISSES.WALK_COMPLETED\", IAP_EVENT_49H_02H)\t\t\\\n__PMC_EV_ALIAS(\"DTLB_MISSES.WALK_CYCLES\", IAP_EVENT_49H_04H)\t\t\\\n__PMC_EV_ALIAS(\"DTLB_MISSES.STLB_HIT\", IAP_EVENT_49H_10H)\t\t\\\n__PMC_EV_ALIAS(\"DTLB_MISSES.LARGE_WALK_COMPLETED\", IAP_EVENT_49H_80H)\t\\\n__PMC_EV_ALIAS(\"LOAD_HIT_PRE\", IAP_EVENT_4CH_01H)\t\t\t\\\n__PMC_EV_ALIAS(\"L1D_PREFETCH.REQUESTS\", IAP_EVENT_4EH_01H)\t\t\\\n__PMC_EV_ALIAS(\"L1D_PREFETCH.MISS\", IAP_EVENT_4EH_02H)\t\t\t\\\n__PMC_EV_ALIAS(\"L1D_PREFETCH.TRIGGERS\", IAP_EVENT_4EH_04H)\t\t\\\n__PMC_EV_ALIAS(\"EPT.WALK_CYCLES\", IAP_EVENT_4FH_10H)\t\t\t\\\n__PMC_EV_ALIAS(\"L1D.REPL\", IAP_EVENT_51H_01H)\t\t\t\t\\\n__PMC_EV_ALIAS(\"L1D.M_REPL\", IAP_EVENT_51H_02H)\t\t\t\t\\\n__PMC_EV_ALIAS(\"L1D.M_EVICT\", IAP_EVENT_51H_04H)\t\t\t\\\n__PMC_EV_ALIAS(\"L1D.M_SNOOP_EVICT\", IAP_EVENT_51H_08H)\t\t\t\\\n__PMC_EV_ALIAS(\"L1D_CACHE_PREFETCH_LOCK_FB_HIT\", IAP_EVENT_52H_01H)\t\\\n__PMC_EV_ALIAS(\"L1D_CACHE_LOCK_FB_HIT\", IAP_EVENT_53H_01H)\t\t\\\n__PMC_EV_ALIAS(\"OFFCORE_REQUESTS_OUTSTANDING.DEMAND.READ_DATA\",\t\t\\\n    IAP_EVENT_60H_01H)\t\t\t\t\t\t\t\\\n__PMC_EV_ALIAS(\"OFFCORE_REQUESTS_OUTSTANDING.DEMAND.READ_CODE\",\t\t\\\n    IAP_EVENT_60H_02H)\t\t\t\t\t\t\t\\\n__PMC_EV_ALIAS(\"OFFCORE_REQUESTS_OUTSTANDING.DEMAND.RFO\",\t\t\\\n    IAP_EVENT_60H_04H)\t\t\t\t\t\t\t\\\n__PMC_EV_ALIAS(\"OFFCORE_REQUESTS_OUTSTANDING.ANY.READ\",\t\t\t\\\n    IAP_EVENT_60H_08H)\t\t\t\t\t\t\t\\\n__PMC_EV_ALIAS(\"CACHE_LOCK_CYCLES.L1D_L2\", IAP_EVENT_63H_01H)\t\t\\\n__PMC_EV_ALIAS(\"CACHE_LOCK_CYCLES.L1D\", IAP_EVENT_63H_02H)\t\t\\\n__PMC_EV_ALIAS(\"IO_TRANSACTIONS\", IAP_EVENT_6CH_01H)\t\t\t\\\n__PMC_EV_ALIAS(\"L1I.HITS\", IAP_EVENT_80H_01H)\t\t\t\t\\\n__PMC_EV_ALIAS(\"L1I.MISSES\", IAP_EVENT_80H_02H)\t\t\t\t\\\n__PMC_EV_ALIAS(\"L1I.READS\", IAP_EVENT_80H_03H)\t\t\t\t\\\n__PMC_EV_ALIAS(\"L1I.CYCLES_STALLED\", IAP_EVENT_80H_04H)\t\t\t\\\n__PMC_EV_ALIAS(\"LARGE_ITLB.HIT\", IAP_EVENT_82H_01H)\t\t\t\\\n__PMC_EV_ALIAS(\"ITLB_MISSES.ANY\", IAP_EVENT_85H_01H)\t\t\t\\\n__PMC_EV_ALIAS(\"ITLB_MISSES.WALK_COMPLETED\", IAP_EVENT_85H_02H)\t\t\\\n__PMC_EV_ALIAS(\"ITLB_MISSES.WALK_CYCLES\", IAP_EVENT_85H_04H)\t\t\\\n__PMC_EV_ALIAS(\"ITLB_MISSES.LARGE_WALK_COMPLETED\", IAP_EVENT_85H_80H)\t\\\n__PMC_EV_ALIAS(\"ILD_STALL.LCP\", IAP_EVENT_87H_01H)\t\t\t\\\n__PMC_EV_ALIAS(\"ILD_STALL.MRU\", IAP_EVENT_87H_02H)\t\t\t\\\n__PMC_EV_ALIAS(\"ILD_STALL.IQ_FULL\", IAP_EVENT_87H_04H)\t\t\t\\\n__PMC_EV_ALIAS(\"ILD_STALL.REGEN\", IAP_EVENT_87H_08H)\t\t\t\\\n__PMC_EV_ALIAS(\"ILD_STALL.ANY\", IAP_EVENT_87H_0FH)\t\t\t\\\n__PMC_EV_ALIAS(\"BR_INST_EXEC.COND\", IAP_EVENT_88H_01H)\t\t\t\\\n__PMC_EV_ALIAS(\"BR_INST_EXEC.DIRECT\", IAP_EVENT_88H_02H)\t\t\\\n__PMC_EV_ALIAS(\"BR_INST_EXEC.INDIRECT_NON_CALL\", IAP_EVENT_88H_04H)\t\\\n__PMC_EV_ALIAS(\"BR_INST_EXEC.NON_CALLS\", IAP_EVENT_88H_07H)\t\t\\\n__PMC_EV_ALIAS(\"BR_INST_EXEC.RETURN_NEAR\", IAP_EVENT_88H_08H)\t\t\\\n__PMC_EV_ALIAS(\"BR_INST_EXEC.DIRECT_NEAR_CALL\", IAP_EVENT_88H_10H)\t\\\n__PMC_EV_ALIAS(\"BR_INST_EXEC.INDIRECT_NEAR_CALL\", IAP_EVENT_88H_20H)\t\\\n__PMC_EV_ALIAS(\"BR_INST_EXEC.NEAR_CALLS\", IAP_EVENT_88H_30H)\t\t\\\n__PMC_EV_ALIAS(\"BR_INST_EXEC.TAKEN\", IAP_EVENT_88H_40H)\t\t\t\\\n__PMC_EV_ALIAS(\"BR_INST_EXEC.ANY\", IAP_EVENT_88H_7FH)\t\t\t\\\n__PMC_EV_ALIAS(\"BR_MISP_EXEC.COND\", IAP_EVENT_89H_01H)\t\t\t\\\n__PMC_EV_ALIAS(\"BR_MISP_EXEC.DIRECT\", IAP_EVENT_89H_02H)\t\t\\\n__PMC_EV_ALIAS(\"BR_MISP_EXEC.INDIRECT_NON_CALL\", IAP_EVENT_89H_04H)\t\\\n__PMC_EV_ALIAS(\"BR_MISP_EXEC.NON_CALLS\", IAP_EVENT_89H_07H)\t\t\\\n__PMC_EV_ALIAS(\"BR_MISP_EXEC.RETURN_NEAR\", IAP_EVENT_89H_08H)\t\t\\\n__PMC_EV_ALIAS(\"BR_MISP_EXEC.DIRECT_NEAR_CALL\", IAP_EVENT_89H_10H)\t\\\n__PMC_EV_ALIAS(\"BR_MISP_EXEC.INDIRECT_NEAR_CALL\", IAP_EVENT_89H_20H)\t\\\n__PMC_EV_ALIAS(\"BR_MISP_EXEC.NEAR_CALLS\", IAP_EVENT_89H_30H)\t\t\\\n__PMC_EV_ALIAS(\"BR_MISP_EXEC.TAKEN\", IAP_EVENT_89H_40H)\t\t\t\\\n__PMC_EV_ALIAS(\"BR_MISP_EXEC.ANY\", IAP_EVENT_89H_7FH)\t\t\t\\\n__PMC_EV_ALIAS(\"RESOURCE_STALLS.ANY\", IAP_EVENT_A2H_01H)\t\t\\\n__PMC_EV_ALIAS(\"RESOURCE_STALLS.LOAD\", IAP_EVENT_A2H_02H)\t\t\\\n__PMC_EV_ALIAS(\"RESOURCE_STALLS.RS_FULL\", IAP_EVENT_A2H_04H)\t\t\\\n__PMC_EV_ALIAS(\"RESOURCE_STALLS.STORE\", IAP_EVENT_A2H_08H)\t\t\\\n__PMC_EV_ALIAS(\"RESOURCE_STALLS.ROB_FULL\", IAP_EVENT_A2H_10H)\t\t\\\n__PMC_EV_ALIAS(\"RESOURCE_STALLS.FPCW\", IAP_EVENT_A2H_20H)\t\t\\\n__PMC_EV_ALIAS(\"RESOURCE_STALLS.MXCSR\", IAP_EVENT_A2H_40H)\t\t\\\n__PMC_EV_ALIAS(\"RESOURCE_STALLS.OTHER\", IAP_EVENT_A2H_80H)\t\t\\\n__PMC_EV_ALIAS(\"MACRO_INSTS.FUSIONS_DECODED\", IAP_EVENT_A6H_01H)\t\\\n__PMC_EV_ALIAS(\"BACLEAR_FORCE_IQ\", IAP_EVENT_A7H_01H)\t\t\t\\\n__PMC_EV_ALIAS(\"LSD.UOPS\", IAP_EVENT_A8H_01H)\t\t\t\t\\\n__PMC_EV_ALIAS(\"ITLB_FLUSH\", IAP_EVENT_AEH_01H)\t\t\t\t\\\n__PMC_EV_ALIAS(\"OFFCORE_REQUESTS.DEMAND.READ_DATA\", IAP_EVENT_B0H_01H)\t\\\n__PMC_EV_ALIAS(\"OFFCORE_REQUESTS.DEMAND.READ_CODE\", IAP_EVENT_B0H_02H)\t\\\n__PMC_EV_ALIAS(\"OFFCORE_REQUESTS.DEMAND.RFO\", IAP_EVENT_B0H_04H)\t\\\n__PMC_EV_ALIAS(\"OFFCORE_REQUESTS.ANY.READ\", IAP_EVENT_B0H_08H)\t\t\\\n__PMC_EV_ALIAS(\"OFFCORE_REQUESTS.ANY.RFO\", IAP_EVENT_B0H_10H)\t\t\\\n__PMC_EV_ALIAS(\"OFFCORE_REQUESTS.L1D_WRITEBACK\", IAP_EVENT_B0H_40H)\t\\\n__PMC_EV_ALIAS(\"OFFCORE_REQUESTS.ANY\", IAP_EVENT_B0H_80H)\t\t\\\n__PMC_EV_ALIAS(\"UOPS_EXECUTED.PORT0\", IAP_EVENT_B1H_01H)\t\t\\\n__PMC_EV_ALIAS(\"UOPS_EXECUTED.PORT1\", IAP_EVENT_B1H_02H)\t\t\\\n__PMC_EV_ALIAS(\"UOPS_EXECUTED.PORT2_CORE\", IAP_EVENT_B1H_04H)\t\t\\\n__PMC_EV_ALIAS(\"UOPS_EXECUTED.PORT3_CORE\", IAP_EVENT_B1H_08H)\t\t\\\n__PMC_EV_ALIAS(\"UOPS_EXECUTED.PORT4_CORE\", IAP_EVENT_B1H_10H)\t\t\\\n__PMC_EV_ALIAS(\"UOPS_EXECUTED.CORE_ACTIVE_CYCLES_NO_PORT5\",\t\t\\\n    IAP_EVENT_B1H_1FH)\t\t\t\t\t\t\t\\\n__PMC_EV_ALIAS(\"UOPS_EXECUTED.PORT5\", IAP_EVENT_B1H_20H)\t\t\\\n__PMC_EV_ALIAS(\"UOPS_EXECUTED.CORE_ACTIVE_CYCLES\", IAP_EVENT_B1H_3FH)\t\\\n__PMC_EV_ALIAS(\"UOPS_EXECUTED.PORT015\", IAP_EVENT_B1H_40H)\t\t\\\n__PMC_EV_ALIAS(\"UOPS_EXECUTED.PORT234\", IAP_EVENT_B1H_80H)\t\t\\\n__PMC_EV_ALIAS(\"OFFCORE_REQUESTS_SQ_FULL\", IAP_EVENT_B2H_01H)\t\t\\\n__PMC_EV_ALIAS(\"SNOOPQ_REQUESTS_OUTSTANDING.DATA\", IAP_EVENT_B3H_01H)\t\\\n__PMC_EV_ALIAS(\"SNOOPQ_REQUESTS_OUTSTANDING.INVALIDATE\",\t\t\\\n    IAP_EVENT_B3H_02H)\t\t\t\t\t\t\t\\\n__PMC_EV_ALIAS(\"SNOOPQ_REQUESTS_OUTSTANDING.CODE\", IAP_EVENT_B3H_04H)\t\\\n__PMC_EV_ALIAS(\"SNOOPQ_REQUESTS.CODE\", IAP_EVENT_B4H_01H)\t\t\\\n__PMC_EV_ALIAS(\"SNOOPQ_REQUESTS.DATA\", IAP_EVENT_B4H_02H)\t\t\\\n__PMC_EV_ALIAS(\"SNOOPQ_REQUESTS.INVALIDATE\", IAP_EVENT_B4H_04H)\t\t\\\n__PMC_EV_ALIAS(\"OFF_CORE_RESPONSE_0\", IAP_EVENT_B7H_01H)\t\t\\\n__PMC_EV_ALIAS(\"SNOOP_RESPONSE.HIT\", IAP_EVENT_B8H_01H)\t\t\t\\\n__PMC_EV_ALIAS(\"SNOOP_RESPONSE.HITE\", IAP_EVENT_B8H_02H)\t\t\\\n__PMC_EV_ALIAS(\"SNOOP_RESPONSE.HITM\", IAP_EVENT_B8H_04H)\t\t\\\n__PMC_EV_ALIAS(\"OFF_CORE_RESPONSE_1\", IAP_EVENT_BBH_01H)\t\t\\\n__PMC_EV_ALIAS(\"INST_RETIRED.ANY_P\", IAP_EVENT_C0H_01H)\t\t\t\\\n__PMC_EV_ALIAS(\"INST_RETIRED.X87\", IAP_EVENT_C0H_02H)\t\t\t\\\n__PMC_EV_ALIAS(\"INST_RETIRED.MMX\", IAP_EVENT_C0H_04H)\t\t\t\\\n__PMC_EV_ALIAS(\"UOPS_RETIRED.ANY\", IAP_EVENT_C2H_01H)\t\t\t\\\n__PMC_EV_ALIAS(\"UOPS_RETIRED.RETIRE_SLOTS\", IAP_EVENT_C2H_02H)\t\t\\\n__PMC_EV_ALIAS(\"UOPS_RETIRED.MACRO_FUSED\", IAP_EVENT_C2H_04H)\t\t\\\n__PMC_EV_ALIAS(\"MACHINE_CLEARS.CYCLES\", IAP_EVENT_C3H_01H)\t\t\\\n__PMC_EV_ALIAS(\"MACHINE_CLEARS.MEM_ORDER\", IAP_EVENT_C3H_02H)\t\t\\\n__PMC_EV_ALIAS(\"MACHINE_CLEARS.SMC\", IAP_EVENT_C3H_04H)\t\t\t\\\n__PMC_EV_ALIAS(\"BR_INST_RETIRED.ANY_P\", IAP_EVENT_C4H_00H)\t\\\n__PMC_EV_ALIAS(\"BR_INST_RETIRED.CONDITIONAL\", IAP_EVENT_C4H_01H)\t\\\n__PMC_EV_ALIAS(\"BR_INST_RETIRED.NEAR_CALL\", IAP_EVENT_C4H_02H)\t\t\\\n__PMC_EV_ALIAS(\"BR_INST_RETIRED.ALL_BRANCHES\", IAP_EVENT_C4H_04H)\t\\\n__PMC_EV_ALIAS(\"BR_MISP_RETIRED.ANY_P\", IAP_EVENT_C5H_00H)\t\\\n__PMC_EV_ALIAS(\"BR_MISP_RETIRED.CONDITIONAL\", IAP_EVENT_C5H_01H)\t\\\n__PMC_EV_ALIAS(\"BR_MISP_RETIRED.NEAR_CALL\", IAP_EVENT_C5H_02H)\t\t\\\n__PMC_EV_ALIAS(\"BR_MISP_RETIRED.ALL_BRANCHES\", IAP_EVENT_C5H_04H)\t\\\n__PMC_EV_ALIAS(\"SSEX_UOPS_RETIRED.PACKED_SINGLE\", IAP_EVENT_C7H_01H)\t\\\n__PMC_EV_ALIAS(\"SSEX_UOPS_RETIRED.SCALAR_SINGLE\", IAP_EVENT_C7H_02H)\t\\\n__PMC_EV_ALIAS(\"SSEX_UOPS_RETIRED.PACKED_DOUBLE\", IAP_EVENT_C7H_04H)\t\\\n__PMC_EV_ALIAS(\"SSEX_UOPS_RETIRED.SCALAR_DOUBLE\", IAP_EVENT_C7H_08H)\t\\\n__PMC_EV_ALIAS(\"SSEX_UOPS_RETIRED.VECTOR_INTEGER\", IAP_EVENT_C7H_10H)\t\\\n__PMC_EV_ALIAS(\"ITLB_MISS_RETIRED\", IAP_EVENT_C8H_20H)\t\t\t\\\n__PMC_EV_ALIAS(\"MEM_LOAD_RETIRED.L1D_HIT\", IAP_EVENT_CBH_01H)\t\t\\\n__PMC_EV_ALIAS(\"MEM_LOAD_RETIRED.L2_HIT\", IAP_EVENT_CBH_02H)\t\t\\\n__PMC_EV_ALIAS(\"MEM_LOAD_RETIRED.L3_UNSHARED_HIT\", IAP_EVENT_CBH_04H)\t\\\n__PMC_EV_ALIAS(\"MEM_LOAD_RETIRED.OTHER_CORE_L2_HIT_HITM\",\t\t\\\n    IAP_EVENT_CBH_08H)\t\t\t\t\t\t\t\\\n__PMC_EV_ALIAS(\"MEM_LOAD_RETIRED.L3_MISS\", IAP_EVENT_CBH_10H)\t\t\\\n__PMC_EV_ALIAS(\"MEM_LOAD_RETIRED.HIT_LFB\", IAP_EVENT_CBH_40H)\t\t\\\n__PMC_EV_ALIAS(\"MEM_LOAD_RETIRED.DTLB_MISS\", IAP_EVENT_CBH_80H)\t\t\\\n__PMC_EV_ALIAS(\"FP_MMX_TRANS.TO_FP\", IAP_EVENT_CCH_01H)\t\t\t\\\n__PMC_EV_ALIAS(\"FP_MMX_TRANS.TO_MMX\", IAP_EVENT_CCH_02H)\t\t\\\n__PMC_EV_ALIAS(\"FP_MMX_TRANS.ANY\", IAP_EVENT_CCH_03H)\t\t\t\\\n__PMC_EV_ALIAS(\"MACRO_INSTS.DECODED\", IAP_EVENT_D0H_01H)\t\t\\\n__PMC_EV_ALIAS(\"UOPS_DECODED.STALL_CYCLES\", IAP_EVENT_D1H_01H)\t\t\\\n__PMC_EV_ALIAS(\"UOPS_DECODED.MS\", IAP_EVENT_D1H_02H)\t\t\t\\\n__PMC_EV_ALIAS(\"UOPS_DECODED.ESP_FOLDING\", IAP_EVENT_D1H_04H)\t\t\\\n__PMC_EV_ALIAS(\"UOPS_DECODED.ESP_SYNC\", IAP_EVENT_D1H_08H)\t\t\\\n__PMC_EV_ALIAS(\"RAT_STALLS.FLAGS\", IAP_EVENT_D2H_01H)\t\t\t\\\n__PMC_EV_ALIAS(\"RAT_STALLS.REGISTERS\", IAP_EVENT_D2H_02H)\t\t\\\n__PMC_EV_ALIAS(\"RAT_STALLS.ROB_READ_PORT\", IAP_EVENT_D2H_04H)\t\t\\\n__PMC_EV_ALIAS(\"RAT_STALLS.SCOREBOARD\", IAP_EVENT_D2H_08H)\t\t\\\n__PMC_EV_ALIAS(\"RAT_STALLS.ANY\", IAP_EVENT_D2H_0FH)\t\t\t\\\n__PMC_EV_ALIAS(\"SEG_RENAME_STALLS\", IAP_EVENT_D4H_01H)\t\t\t\\\n__PMC_EV_ALIAS(\"ES_REG_RENAMES\", IAP_EVENT_D5H_01H)\t\t\t\\\n__PMC_EV_ALIAS(\"UOP_UNFUSION\", IAP_EVENT_DBH_01H)\t\t\t\\\n__PMC_EV_ALIAS(\"BR_INST_DECODED\", IAP_EVENT_E0H_01H)\t\t\t\\\n__PMC_EV_ALIAS(\"BPU_MISSED_CALL_RET\", IAP_EVENT_E5H_01H)\t\t\\\n__PMC_EV_ALIAS(\"BACLEAR.CLEAR\", IAP_EVENT_E6H_01H)\t\t\t\\\n__PMC_EV_ALIAS(\"BACLEAR.BAD_TARGET\", IAP_EVENT_E6H_02H)\t\t\t\\\n__PMC_EV_ALIAS(\"BPU_CLEARS.EARLY\", IAP_EVENT_E8H_01H)\t\t\t\\\n__PMC_EV_ALIAS(\"BPU_CLEARS.LATE\", IAP_EVENT_E8H_02H)\t\t\t\\\n__PMC_EV_ALIAS(\"THREAD_ACTIVE\", IAP_EVENT_ECH_01H)\t\t\t\\\n__PMC_EV_ALIAS(\"L2_TRANSACTIONS.LOAD\", IAP_EVENT_F0H_01H)\t\t\\\n__PMC_EV_ALIAS(\"L2_TRANSACTIONS.RFO\", IAP_EVENT_F0H_02H)\t\t\\\n__PMC_EV_ALIAS(\"L2_TRANSACTIONS.IFETCH\", IAP_EVENT_F0H_04H)\t\t\\\n__PMC_EV_ALIAS(\"L2_TRANSACTIONS.PREFETCH\", IAP_EVENT_F0H_08H)\t\t\\\n__PMC_EV_ALIAS(\"L2_TRANSACTIONS.L1D_WB\", IAP_EVENT_F0H_10H)\t\t\\\n__PMC_EV_ALIAS(\"L2_TRANSACTIONS.FILL\", IAP_EVENT_F0H_20H)\t\t\\\n__PMC_EV_ALIAS(\"L2_TRANSACTIONS.WB\", IAP_EVENT_F0H_40H)\t\t\t\\\n__PMC_EV_ALIAS(\"L2_TRANSACTIONS.ANY\", IAP_EVENT_F0H_80H)\t\t\\\n__PMC_EV_ALIAS(\"L2_LINES_IN.S_STATE\", IAP_EVENT_F1H_02H)\t\t\\\n__PMC_EV_ALIAS(\"L2_LINES_IN.E_STATE\", IAP_EVENT_F1H_04H)\t\t\\\n__PMC_EV_ALIAS(\"L2_LINES_IN.ANY\", IAP_EVENT_F1H_07H)\t\t\t\\\n__PMC_EV_ALIAS(\"L2_LINES_OUT.DEMAND_CLEAN\", IAP_EVENT_F2H_01H)\t\t\\\n__PMC_EV_ALIAS(\"L2_LINES_OUT.DEMAND_DIRTY\", IAP_EVENT_F2H_02H)\t\t\\\n__PMC_EV_ALIAS(\"L2_LINES_OUT.PREFETCH_CLEAN\", IAP_EVENT_F2H_04H)\t\\\n__PMC_EV_ALIAS(\"L2_LINES_OUT.PREFETCH_DIRTY\", IAP_EVENT_F2H_08H)\t\\\n__PMC_EV_ALIAS(\"L2_LINES_OUT.ANY\", IAP_EVENT_F2H_0FH)\t\t\t\\\n__PMC_EV_ALIAS(\"SQ_MISC.LRU_HINTS\", IAP_EVENT_F4H_04H)\t\t\t\\\n__PMC_EV_ALIAS(\"SQ_MISC.SPLIT_LOCK\", IAP_EVENT_F4H_10H)\t\t\t\\\n__PMC_EV_ALIAS(\"SQ_FULL_STALL_CYCLES\", IAP_EVENT_F6H_01H)\t\t\\\n__PMC_EV_ALIAS(\"FP_ASSIST.ALL\", IAP_EVENT_F7H_01H)\t\t\t\\\n__PMC_EV_ALIAS(\"FP_ASSIST.OUTPUT\", IAP_EVENT_F7H_02H)\t\t\t\\\n__PMC_EV_ALIAS(\"FP_ASSIST.INPUT\", IAP_EVENT_F7H_04H)\t\t\t\\\n__PMC_EV_ALIAS(\"SIMD_INT_64.PACKED_MPY\", IAP_EVENT_FDH_01H)\t\t\\\n__PMC_EV_ALIAS(\"SIMD_INT_64.PACKED_SHIFT\", IAP_EVENT_FDH_02H)\t\t\\\n__PMC_EV_ALIAS(\"SIMD_INT_64.PACK\", IAP_EVENT_FDH_04H)\t\t\t\\\n__PMC_EV_ALIAS(\"SIMD_INT_64.UNPACK\", IAP_EVENT_FDH_08H)\t\t\t\\\n__PMC_EV_ALIAS(\"SIMD_INT_64.PACKED_LOGICAL\", IAP_EVENT_FDH_10H)\t\t\\\n__PMC_EV_ALIAS(\"SIMD_INT_64.PACKED_ARITH\", IAP_EVENT_FDH_20H)\t\t\\\n__PMC_EV_ALIAS(\"SIMD_INT_64.SHUFFLE_MOVE\", IAP_EVENT_FDH_40H)\n\n/* timestamp counters. */\n#define\t__PMC_EV_TSC()\t\t\t\t\t\t\t\\\n\t__PMC_EV(TSC, TSC)\n\n#define\tPMC_EV_TSC_FIRST\tPMC_EV_TSC_TSC\n#define\tPMC_EV_TSC_LAST\t\tPMC_EV_TSC_TSC\n\n#define\t__PMC_EV_UCF()\t\t\t\t\\\n__PMC_EV(UCF, UCLOCK)\n\n#define\tPMC_EV_UCF_FIRST\tPMC_EV_UCF_UCLOCK\n#define\tPMC_EV_UCF_LAST\t\tPMC_EV_UCF_UCLOCK\n\n#define\t__PMC_EV_UCP()\t\t\t\t\\\n__PMC_EV(UCP, EVENT_00H_01H)\t\t\t\\\n__PMC_EV(UCP, EVENT_00H_02H)\t\t\t\\\n__PMC_EV(UCP, EVENT_00H_04H)\t\t\t\\\n__PMC_EV(UCP, EVENT_01H_01H)\t\t\t\\\n__PMC_EV(UCP, EVENT_01H_02H)\t\t\t\\\n__PMC_EV(UCP, EVENT_01H_04H)\t\t\t\\\n__PMC_EV(UCP, EVENT_02H_01H)\t\t\t\\\n__PMC_EV(UCP, EVENT_03H_01H)\t\t\t\\\n__PMC_EV(UCP, EVENT_03H_02H)\t\t\t\\\n__PMC_EV(UCP, EVENT_03H_04H)\t\t\t\\\n__PMC_EV(UCP, EVENT_03H_08H)\t\t\t\\\n__PMC_EV(UCP, EVENT_03H_10H)\t\t\t\\\n__PMC_EV(UCP, EVENT_03H_20H)\t\t\t\\\n__PMC_EV(UCP, EVENT_03H_40H)\t\t\t\\\n__PMC_EV(UCP, EVENT_04H_01H)\t\t\t\\\n__PMC_EV(UCP, EVENT_04H_02H)\t\t\t\\\n__PMC_EV(UCP, EVENT_04H_04H)\t\t\t\\\n__PMC_EV(UCP, EVENT_04H_08H)\t\t\t\\\n__PMC_EV(UCP, EVENT_04H_10H)\t\t\t\\\n__PMC_EV(UCP, EVENT_05H_01H)\t\t\t\\\n__PMC_EV(UCP, EVENT_05H_02H)\t\t\t\\\n__PMC_EV(UCP, EVENT_05H_04H)\t\t\t\\\n__PMC_EV(UCP, EVENT_06H_01H)\t\t\t\\\n__PMC_EV(UCP, EVENT_06H_02H)\t\t\t\\\n__PMC_EV(UCP, EVENT_06H_04H)\t\t\t\\\n__PMC_EV(UCP, EVENT_06H_08H)\t\t\t\\\n__PMC_EV(UCP, EVENT_06H_10H)\t\t\t\\\n__PMC_EV(UCP, EVENT_06H_20H)\t\t\t\\\n__PMC_EV(UCP, EVENT_07H_01H)\t\t\t\\\n__PMC_EV(UCP, EVENT_07H_02H)\t\t\t\\\n__PMC_EV(UCP, EVENT_07H_04H)\t\t\t\\\n__PMC_EV(UCP, EVENT_07H_08H)\t\t\t\\\n__PMC_EV(UCP, EVENT_07H_10H)\t\t\t\\\n__PMC_EV(UCP, EVENT_07H_20H)\t\t\t\\\n__PMC_EV(UCP, EVENT_07H_24H)\t\t\t\\\n__PMC_EV(UCP, EVENT_08H_01H)\t\t\t\\\n__PMC_EV(UCP, EVENT_08H_02H)\t\t\t\\\n__PMC_EV(UCP, EVENT_08H_04H)\t\t\t\\\n__PMC_EV(UCP, EVENT_08H_03H)\t\t\t\\\n__PMC_EV(UCP, EVENT_09H_01H)\t\t\t\\\n__PMC_EV(UCP, EVENT_09H_02H)\t\t\t\\\n__PMC_EV(UCP, EVENT_09H_04H)\t\t\t\\\n__PMC_EV(UCP, EVENT_09H_03H)\t\t\t\\\n__PMC_EV(UCP, EVENT_0AH_01H)\t\t\t\\\n__PMC_EV(UCP, EVENT_0AH_02H)\t\t\t\\\n__PMC_EV(UCP, EVENT_0AH_04H)\t\t\t\\\n__PMC_EV(UCP, EVENT_0AH_08H)\t\t\t\\\n__PMC_EV(UCP, EVENT_0AH_0FH)\t\t\t\\\n__PMC_EV(UCP, EVENT_0BH_01H)\t\t\t\\\n__PMC_EV(UCP, EVENT_0BH_02H)\t\t\t\\\n__PMC_EV(UCP, EVENT_0BH_04H)\t\t\t\\\n__PMC_EV(UCP, EVENT_0BH_08H)\t\t\t\\\n__PMC_EV(UCP, EVENT_0BH_10H)\t\t\t\\\n__PMC_EV(UCP, EVENT_0BH_1FH)\t\t\t\\\n__PMC_EV(UCP, EVENT_0CH_01H)\t\t\t\\\n__PMC_EV(UCP, EVENT_0CH_02H)\t\t\t\\\n__PMC_EV(UCP, EVENT_0CH_04H)\t\t\t\\\n__PMC_EV(UCP, EVENT_0CH_08H)\t\t\t\\\n__PMC_EV(UCP, EVENT_20H_01H)\t\t\t\\\n__PMC_EV(UCP, EVENT_20H_02H)\t\t\t\\\n__PMC_EV(UCP, EVENT_20H_04H)\t\t\t\\\n__PMC_EV(UCP, EVENT_20H_08H)\t\t\t\\\n__PMC_EV(UCP, EVENT_20H_10H)\t\t\t\\\n__PMC_EV(UCP, EVENT_20H_20H)\t\t\t\\\n__PMC_EV(UCP, EVENT_21H_01H)\t\t\t\\\n__PMC_EV(UCP, EVENT_21H_02H)\t\t\t\\\n__PMC_EV(UCP, EVENT_21H_04H)\t\t\t\\\n__PMC_EV(UCP, EVENT_22H_01H)\t\t\t\\\n__PMC_EV(UCP, EVENT_22H_02H)\t\t\t\\\n__PMC_EV(UCP, EVENT_22H_04H)\t\t\t\\\n__PMC_EV(UCP, EVENT_23H_01H)\t\t\t\\\n__PMC_EV(UCP, EVENT_23H_02H)\t\t\t\\\n__PMC_EV(UCP, EVENT_23H_04H)\t\t\t\\\n__PMC_EV(UCP, EVENT_24H_02H)\t\t\t\\\n__PMC_EV(UCP, EVENT_24H_04H)\t\t\t\\\n__PMC_EV(UCP, EVENT_25H_01H)\t\t\t\\\n__PMC_EV(UCP, EVENT_25H_02H)\t\t\t\\\n__PMC_EV(UCP, EVENT_25H_04H)\t\t\t\\\n__PMC_EV(UCP, EVENT_26H_01H)\t\t\t\\\n__PMC_EV(UCP, EVENT_27H_01H)\t\t\t\\\n__PMC_EV(UCP, EVENT_27H_02H)\t\t\t\\\n__PMC_EV(UCP, EVENT_27H_04H)\t\t\t\\\n__PMC_EV(UCP, EVENT_27H_08H)\t\t\t\\\n__PMC_EV(UCP, EVENT_27H_10H)\t\t\t\\\n__PMC_EV(UCP, EVENT_27H_20H)\t\t\t\\\n__PMC_EV(UCP, EVENT_28H_01H)\t\t\t\\\n__PMC_EV(UCP, EVENT_28H_02H)\t\t\t\\\n__PMC_EV(UCP, EVENT_28H_04H)\t\t\t\\\n__PMC_EV(UCP, EVENT_28H_08H)\t\t\t\\\n__PMC_EV(UCP, EVENT_28H_10H)\t\t\t\\\n__PMC_EV(UCP, EVENT_28H_20H)\t\t\t\\\n__PMC_EV(UCP, EVENT_29H_01H)\t\t\t\\\n__PMC_EV(UCP, EVENT_29H_02H)\t\t\t\\\n__PMC_EV(UCP, EVENT_29H_04H)\t\t\t\\\n__PMC_EV(UCP, EVENT_29H_08H)\t\t\t\\\n__PMC_EV(UCP, EVENT_29H_10H)\t\t\t\\\n__PMC_EV(UCP, EVENT_29H_20H)\t\t\t\\\n__PMC_EV(UCP, EVENT_2AH_01H)\t\t\t\\\n__PMC_EV(UCP, EVENT_2AH_02H)\t\t\t\\\n__PMC_EV(UCP, EVENT_2AH_04H)\t\t\t\\\n__PMC_EV(UCP, EVENT_2AH_07H)\t\t\t\\\n__PMC_EV(UCP, EVENT_2BH_01H)\t\t\t\\\n__PMC_EV(UCP, EVENT_2BH_02H)\t\t\t\\\n__PMC_EV(UCP, EVENT_2BH_04H)\t\t\t\\\n__PMC_EV(UCP, EVENT_2BH_07H)\t\t\t\\\n__PMC_EV(UCP, EVENT_2CH_01H)\t\t\t\\\n__PMC_EV(UCP, EVENT_2CH_02H)\t\t\t\\\n__PMC_EV(UCP, EVENT_2CH_04H)\t\t\t\\\n__PMC_EV(UCP, EVENT_2CH_07H)\t\t\t\\\n__PMC_EV(UCP, EVENT_2DH_01H)\t\t\t\\\n__PMC_EV(UCP, EVENT_2DH_02H)\t\t\t\\\n__PMC_EV(UCP, EVENT_2DH_04H)\t\t\t\\\n__PMC_EV(UCP, EVENT_2DH_07H)\t\t\t\\\n__PMC_EV(UCP, EVENT_2EH_01H)\t\t\t\\\n__PMC_EV(UCP, EVENT_2EH_02H)\t\t\t\\\n__PMC_EV(UCP, EVENT_2EH_04H)\t\t\t\\\n__PMC_EV(UCP, EVENT_2EH_07H)\t\t\t\\\n__PMC_EV(UCP, EVENT_2FH_01H)\t\t\t\\\n__PMC_EV(UCP, EVENT_2FH_02H)\t\t\t\\\n__PMC_EV(UCP, EVENT_2FH_04H)\t\t\t\\\n__PMC_EV(UCP, EVENT_2FH_07H)\t\t\t\\\n__PMC_EV(UCP, EVENT_2FH_08H)\t\t\t\\\n__PMC_EV(UCP, EVENT_2FH_10H)\t\t\t\\\n__PMC_EV(UCP, EVENT_2FH_20H)\t\t\t\\\n__PMC_EV(UCP, EVENT_2FH_38H)\t\t\t\\\n__PMC_EV(UCP, EVENT_30H_01H)\t\t\t\\\n__PMC_EV(UCP, EVENT_30H_02H)\t\t\t\\\n__PMC_EV(UCP, EVENT_30H_04H)\t\t\t\\\n__PMC_EV(UCP, EVENT_30H_07H)\t\t\t\\\n__PMC_EV(UCP, EVENT_31H_01H)\t\t\t\\\n__PMC_EV(UCP, EVENT_31H_02H)\t\t\t\\\n__PMC_EV(UCP, EVENT_31H_04H)\t\t\t\\\n__PMC_EV(UCP, EVENT_31H_07H)\t\t\t\\\n__PMC_EV(UCP, EVENT_32H_01H)\t\t\t\\\n__PMC_EV(UCP, EVENT_32H_02H)\t\t\t\\\n__PMC_EV(UCP, EVENT_32H_04H)\t\t\t\\\n__PMC_EV(UCP, EVENT_32H_07H)\t\t\t\\\n__PMC_EV(UCP, EVENT_33H_01H)\t\t\t\\\n__PMC_EV(UCP, EVENT_33H_02H)\t\t\t\\\n__PMC_EV(UCP, EVENT_33H_04H)\t\t\t\\\n__PMC_EV(UCP, EVENT_33H_07H)\t\t\t\\\n__PMC_EV(UCP, EVENT_34H_01H)\t\t\t\\\n__PMC_EV(UCP, EVENT_34H_02H)\t\t\t\\\n__PMC_EV(UCP, EVENT_34H_04H)\t\t\t\\\n__PMC_EV(UCP, EVENT_34H_08H)\t\t\t\\\n__PMC_EV(UCP, EVENT_34H_10H)\t\t\t\\\n__PMC_EV(UCP, EVENT_34H_20H)\t\t\t\\\n__PMC_EV(UCP, EVENT_35H_01H)\t\t\t\\\n__PMC_EV(UCP, EVENT_35H_02H)\t\t\t\\\n__PMC_EV(UCP, EVENT_35H_04H)\t\t\t\\\n__PMC_EV(UCP, EVENT_40H_01H)\t\t\t\\\n__PMC_EV(UCP, EVENT_40H_02H)\t\t\t\\\n__PMC_EV(UCP, EVENT_40H_04H)\t\t\t\\\n__PMC_EV(UCP, EVENT_40H_08H)\t\t\t\\\n__PMC_EV(UCP, EVENT_40H_10H)\t\t\t\\\n__PMC_EV(UCP, EVENT_40H_20H)\t\t\t\\\n__PMC_EV(UCP, EVENT_40H_07H)\t\t\t\\\n__PMC_EV(UCP, EVENT_40H_38H)\t\t\t\\\n__PMC_EV(UCP, EVENT_41H_01H)\t\t\t\\\n__PMC_EV(UCP, EVENT_41H_02H)\t\t\t\\\n__PMC_EV(UCP, EVENT_41H_04H)\t\t\t\\\n__PMC_EV(UCP, EVENT_41H_08H)\t\t\t\\\n__PMC_EV(UCP, EVENT_41H_10H)\t\t\t\\\n__PMC_EV(UCP, EVENT_41H_20H)\t\t\t\\\n__PMC_EV(UCP, EVENT_41H_07H)\t\t\t\\\n__PMC_EV(UCP, EVENT_41H_38H)\t\t\t\\\n__PMC_EV(UCP, EVENT_42H_01H)\t\t\t\\\n__PMC_EV(UCP, EVENT_42H_02H)\t\t\t\\\n__PMC_EV(UCP, EVENT_42H_04H)\t\t\t\\\n__PMC_EV(UCP, EVENT_42H_08H)\t\t\t\\\n__PMC_EV(UCP, EVENT_43H_01H)\t\t\t\\\n__PMC_EV(UCP, EVENT_43H_02H)\t\t\t\\\n__PMC_EV(UCP, EVENT_60H_01H)\t\t\t\\\n__PMC_EV(UCP, EVENT_60H_02H)\t\t\t\\\n__PMC_EV(UCP, EVENT_60H_04H)\t\t\t\\\n__PMC_EV(UCP, EVENT_61H_01H)\t\t\t\\\n__PMC_EV(UCP, EVENT_61H_02H)\t\t\t\\\n__PMC_EV(UCP, EVENT_61H_04H)\t\t\t\\\n__PMC_EV(UCP, EVENT_62H_01H)\t\t\t\\\n__PMC_EV(UCP, EVENT_62H_02H)\t\t\t\\\n__PMC_EV(UCP, EVENT_62H_04H)\t\t\t\\\n__PMC_EV(UCP, EVENT_63H_01H)\t\t\t\\\n__PMC_EV(UCP, EVENT_63H_02H)\t\t\t\\\n__PMC_EV(UCP, EVENT_63H_04H)\t\t\t\\\n__PMC_EV(UCP, EVENT_63H_08H)\t\t\t\\\n__PMC_EV(UCP, EVENT_63H_10H)\t\t\t\\\n__PMC_EV(UCP, EVENT_63H_20H)\t\t\t\\\n__PMC_EV(UCP, EVENT_64H_01H)\t\t\t\\\n__PMC_EV(UCP, EVENT_64H_02H)\t\t\t\\\n__PMC_EV(UCP, EVENT_64H_04H)\t\t\t\\\n__PMC_EV(UCP, EVENT_64H_08H)\t\t\t\\\n__PMC_EV(UCP, EVENT_64H_10H)\t\t\t\\\n__PMC_EV(UCP, EVENT_64H_20H)\t\t\t\\\n__PMC_EV(UCP, EVENT_65H_01H)\t\t\t\\\n__PMC_EV(UCP, EVENT_65H_02H)\t\t\t\\\n__PMC_EV(UCP, EVENT_65H_04H)\t\t\t\\\n__PMC_EV(UCP, EVENT_66H_01H)\t\t\t\\\n__PMC_EV(UCP, EVENT_66H_02H)\t\t\t\\\n__PMC_EV(UCP, EVENT_66H_04H)\t\t\t\\\n__PMC_EV(UCP, EVENT_67H_01H)\t\t\t\\\n__PMC_EV(UCP, EVENT_80H_01H)\t\t\t\\\n__PMC_EV(UCP, EVENT_80H_02H)\t\t\t\\\n__PMC_EV(UCP, EVENT_80H_04H)\t\t\t\\\n__PMC_EV(UCP, EVENT_80H_08H)\t\t\t\\\n__PMC_EV(UCP, EVENT_81H_01H)\t\t\t\\\n__PMC_EV(UCP, EVENT_81H_02H)\t\t\t\\\n__PMC_EV(UCP, EVENT_81H_04H)\t\t\t\\\n__PMC_EV(UCP, EVENT_81H_08H)\t\t\t\\\n__PMC_EV(UCP, EVENT_82H_01H)\t\t\t\\\n__PMC_EV(UCP, EVENT_83H_01H)\t\t\t\\\n__PMC_EV(UCP, EVENT_83H_02H)\t\t\t\\\n__PMC_EV(UCP, EVENT_83H_04H)\t\t\t\\\n__PMC_EV(UCP, EVENT_83H_08H)\t\t\t\\\n__PMC_EV(UCP, EVENT_84H_01H)\t\t\t\\\n__PMC_EV(UCP, EVENT_84H_02H)\t\t\t\\\n__PMC_EV(UCP, EVENT_84H_04H)\t\t\t\\\n__PMC_EV(UCP, EVENT_84H_08H)\t\t\t\\\n__PMC_EV(UCP, EVENT_85H_02H)\t\t\t\\\n__PMC_EV(UCP, EVENT_86H_01H)\n\n#define\tPMC_EV_UCP_FIRST\tPMC_EV_UCP_EVENT_00H_01H\n#define\tPMC_EV_UCP_LAST\t\tPMC_EV_UCP_EVENT_86H_01H\n\n#define\t__PMC_EV_ALIAS_COREI7UC()\t\t\t\t\t\\\n__PMC_EV_ALIAS(\"GQ_CYCLES_FULL.READ_TRACKER\", UCP_EVENT_00H_01H)\t\\\n__PMC_EV_ALIAS(\"GQ_CYCLES_FULL.WRITE_TRACKER\", UCP_EVENT_00H_02H)\t\\\n__PMC_EV_ALIAS(\"GQ_CYCLES_FULL.PEER_PROBE_TRACKER\", UCP_EVENT_00H_04H)\t\\\n__PMC_EV_ALIAS(\"GQ_CYCLES_NOT_EMPTY.READ_TRACKER\", UCP_EVENT_01H_01H)\t\\\n__PMC_EV_ALIAS(\"GQ_CYCLES_NOT_EMPTY.WRITE_TRACKER\", UCP_EVENT_01H_02H)\t\\\n__PMC_EV_ALIAS(\"GQ_CYCLES_NOT_EMPTY.PEER_PROBE_TRACKER\", UCP_EVENT_01H_04H)\t\\\n__PMC_EV_ALIAS(\"GQ_ALLOC.READ_TRACKER\", UCP_EVENT_03H_01H)\t\\\n__PMC_EV_ALIAS(\"GQ_ALLOC.RT_L3_MISS\", UCP_EVENT_03H_02H)\t\\\n__PMC_EV_ALIAS(\"GQ_ALLOC.RT_TO_L3_RESP\", UCP_EVENT_03H_04H)\t\\\n__PMC_EV_ALIAS(\"GQ_ALLOC.RT_TO_RTID_ACQUIRED\", UCP_EVENT_03H_08H)\t\\\n__PMC_EV_ALIAS(\"GQ_ALLOC.WT_TO_RTID_ACQUIRED\", UCP_EVENT_03H_10H)\t\\\n__PMC_EV_ALIAS(\"GQ_ALLOC.WRITE_TRACKER\", UCP_EVENT_03H_20H)\t\\\n__PMC_EV_ALIAS(\"GQ_ALLOC.PEER_PROBE_TRACKER\", UCP_EVENT_03H_40H)\t\\\n__PMC_EV_ALIAS(\"GQ_DATA.FROM_QPI\", UCP_EVENT_04H_01H)\t\\\n__PMC_EV_ALIAS(\"GQ_DATA.FROM_QMC\", UCP_EVENT_04H_02H)\t\\\n__PMC_EV_ALIAS(\"GQ_DATA.FROM_L3\", UCP_EVENT_04H_04H)\t\\\n__PMC_EV_ALIAS(\"GQ_DATA.FROM_CORES_02\", UCP_EVENT_04H_08H)\t\\\n__PMC_EV_ALIAS(\"GQ_DATA.FROM_CORES_13\", UCP_EVENT_04H_10H)\t\\\n__PMC_EV_ALIAS(\"GQ_DATA.TO_QPI_QMC\", UCP_EVENT_05H_01H)\t\\\n__PMC_EV_ALIAS(\"GQ_DATA.TO_L3\", UCP_EVENT_05H_02H)\t\\\n__PMC_EV_ALIAS(\"GQ_DATA.TO_CORES\", UCP_EVENT_05H_04H)\t\\\n__PMC_EV_ALIAS(\"SNP_RESP_TO_LOCAL_HOME.I_STATE\", UCP_EVENT_06H_01H)\t\\\n__PMC_EV_ALIAS(\"SNP_RESP_TO_LOCAL_HOME.S_STATE\", UCP_EVENT_06H_02H)\t\\\n__PMC_EV_ALIAS(\"SNP_RESP_TO_LOCAL_HOME.FWD_S_STATE\", UCP_EVENT_06H_04H)\t\\\n__PMC_EV_ALIAS(\"SNP_RESP_TO_LOCAL_HOME.FWD_I_STATE\", UCP_EVENT_06H_08H)\t\\\n__PMC_EV_ALIAS(\"SNP_RESP_TO_LOCAL_HOME.CONFLICT\", UCP_EVENT_06H_10H)\t\\\n__PMC_EV_ALIAS(\"SNP_RESP_TO_LOCAL_HOME.WB\", UCP_EVENT_06H_20H)\t\\\n__PMC_EV_ALIAS(\"SNP_RESP_TO_REMOTE_HOME.I_STATE\", UCP_EVENT_07H_01H)\t\\\n__PMC_EV_ALIAS(\"SNP_RESP_TO_REMOTE_HOME.S_STATE\", UCP_EVENT_07H_02H)\t\\\n__PMC_EV_ALIAS(\"SNP_RESP_TO_REMOTE_HOME.FWD_S_STATE\", UCP_EVENT_07H_04H)\t\\\n__PMC_EV_ALIAS(\"SNP_RESP_TO_REMOTE_HOME.FWD_I_STATE\", UCP_EVENT_07H_08H)\t\\\n__PMC_EV_ALIAS(\"SNP_RESP_TO_REMOTE_HOME.CONFLICT\", UCP_EVENT_07H_10H)\t\\\n__PMC_EV_ALIAS(\"SNP_RESP_TO_REMOTE_HOME.WB\", UCP_EVENT_07H_20H)\t\\\n__PMC_EV_ALIAS(\"SNP_RESP_TO_REMOTE_HOME.HITM\", UCP_EVENT_07H_24H)\t\\\n__PMC_EV_ALIAS(\"L3_HITS.READ\", UCP_EVENT_08H_01H)\t\\\n__PMC_EV_ALIAS(\"L3_HITS.WRITE\", UCP_EVENT_08H_02H)\t\\\n__PMC_EV_ALIAS(\"L3_HITS.PROBE\", UCP_EVENT_08H_04H)\t\\\n__PMC_EV_ALIAS(\"L3_HITS.ANY\", UCP_EVENT_08H_03H)\t\\\n__PMC_EV_ALIAS(\"L3_MISS.READ\", UCP_EVENT_09H_01H)\t\\\n__PMC_EV_ALIAS(\"L3_MISS.WRITE\", UCP_EVENT_09H_02H)\t\\\n__PMC_EV_ALIAS(\"L3_MISS.PROBE\", UCP_EVENT_09H_04H)\t\\\n__PMC_EV_ALIAS(\"L3_MISS.ANY\", UCP_EVENT_09H_03H)\t\\\n__PMC_EV_ALIAS(\"L3_LINES_IN.M_STATE\", UCP_EVENT_0AH_01H)\t\\\n__PMC_EV_ALIAS(\"L3_LINES_IN.E_STATE\", UCP_EVENT_0AH_02H)\t\\\n__PMC_EV_ALIAS(\"L3_LINES_IN.S_STATE\", UCP_EVENT_0AH_04H)\t\\\n__PMC_EV_ALIAS(\"L3_LINES_IN.F_STATE\", UCP_EVENT_0AH_08H)\t\\\n__PMC_EV_ALIAS(\"L3_LINES_IN.ANY\", UCP_EVENT_0AH_0FH)\t\\\n__PMC_EV_ALIAS(\"L3_LINES_OUT.M_STATE\", UCP_EVENT_0BH_01H)\t\\\n__PMC_EV_ALIAS(\"L3_LINES_OUT.E_STATE\", UCP_EVENT_0BH_02H)\t\\\n__PMC_EV_ALIAS(\"L3_LINES_OUT.S_STATE\", UCP_EVENT_0BH_04H)\t\\\n__PMC_EV_ALIAS(\"L3_LINES_OUT.I_STATE\", UCP_EVENT_0BH_08H)\t\\\n__PMC_EV_ALIAS(\"L3_LINES_OUT.F_STATE\", UCP_EVENT_0BH_10H)\t\\\n__PMC_EV_ALIAS(\"L3_LINES_OUT.ANY\", UCP_EVENT_0BH_1FH)\t\\\n__PMC_EV_ALIAS(\"QHL_REQUESTS.IOH_READS\", UCP_EVENT_20H_01H)\t\\\n__PMC_EV_ALIAS(\"QHL_REQUESTS.IOH_WRITES\", UCP_EVENT_20H_02H)\t\\\n__PMC_EV_ALIAS(\"QHL_REQUESTS.REMOTE_READS\", UCP_EVENT_20H_04H)\t\\\n__PMC_EV_ALIAS(\"QHL_REQUESTS.REMOTE_WRITES\", UCP_EVENT_20H_08H)\t\\\n__PMC_EV_ALIAS(\"QHL_REQUESTS.LOCAL_READS\", UCP_EVENT_20H_10H)\t\\\n__PMC_EV_ALIAS(\"QHL_REQUESTS.LOCAL_WRITES\", UCP_EVENT_20H_20H)\t\\\n__PMC_EV_ALIAS(\"QHL_CYCLES_FULL.IOH\", UCP_EVENT_21H_01H)\t\\\n__PMC_EV_ALIAS(\"QHL_CYCLES_FULL.REMOTE\", UCP_EVENT_21H_02H)\t\\\n__PMC_EV_ALIAS(\"QHL_CYCLES_FULL.LOCAL\", UCP_EVENT_21H_04H)\t\\\n__PMC_EV_ALIAS(\"QHL_CYCLES_NOT_EMPTY.IOH\", UCP_EVENT_22H_01H)\t\\\n__PMC_EV_ALIAS(\"QHL_CYCLES_NOT_EMPTY.REMOTE\", UCP_EVENT_22H_02H)\t\\\n__PMC_EV_ALIAS(\"QHL_CYCLES_NOT_EMPTY.LOCAL\", UCP_EVENT_22H_04H)\t\\\n__PMC_EV_ALIAS(\"QHL_OCCUPANCY.IOH\", UCP_EVENT_23H_01H)\t\\\n__PMC_EV_ALIAS(\"QHL_OCCUPANCY.REMOTE\", UCP_EVENT_23H_02H)\t\\\n__PMC_EV_ALIAS(\"QHL_OCCUPANCY.LOCAL\", UCP_EVENT_23H_04H)\t\\\n__PMC_EV_ALIAS(\"QHL_ADDRESS_CONFLICTS.2WAY\", UCP_EVENT_24H_02H)\t\\\n__PMC_EV_ALIAS(\"QHL_ADDRESS_CONFLICTS.3WAY\", UCP_EVENT_24H_04H)\t\\\n__PMC_EV_ALIAS(\"QHL_CONFLICT_CYCLES.IOH\", UCP_EVENT_25H_01H)\t\\\n__PMC_EV_ALIAS(\"QHL_CONFLICT_CYCLES.REMOTE\", UCP_EVENT_25H_02H)\t\\\n__PMC_EV_ALIAS(\"QHL_CONFLICT_CYCLES.LOCAL\", UCP_EVENT_25H_04H)\t\\\n__PMC_EV_ALIAS(\"QHL_TO_QMC_BYPASS\", UCP_EVENT_26H_01H)\t\\\n__PMC_EV_ALIAS(\"QMC_NORMAL_FULL.READ.CH0\", UCP_EVENT_27H_01H)\t\\\n__PMC_EV_ALIAS(\"QMC_NORMAL_FULL.READ.CH1\", UCP_EVENT_27H_02H)\t\\\n__PMC_EV_ALIAS(\"QMC_NORMAL_FULL.READ.CH2\", UCP_EVENT_27H_04H)\t\\\n__PMC_EV_ALIAS(\"QMC_NORMAL_FULL.WRITE.CH0\", UCP_EVENT_27H_08H)\t\\\n__PMC_EV_ALIAS(\"QMC_NORMAL_FULL.WRITE.CH1\", UCP_EVENT_27H_10H)\t\\\n__PMC_EV_ALIAS(\"QMC_NORMAL_FULL.WRITE.CH2\", UCP_EVENT_27H_20H)\t\\\n__PMC_EV_ALIAS(\"QMC_ISOC_FULL.READ.CH0\", UCP_EVENT_28H_01H)\t\\\n__PMC_EV_ALIAS(\"QMC_ISOC_FULL.READ.CH1\", UCP_EVENT_28H_02H)\t\\\n__PMC_EV_ALIAS(\"QMC_ISOC_FULL.READ.CH2\", UCP_EVENT_28H_04H)\t\\\n__PMC_EV_ALIAS(\"QMC_ISOC_FULL.WRITE.CH0\", UCP_EVENT_28H_08H)\t\\\n__PMC_EV_ALIAS(\"QMC_ISOC_FULL.WRITE.CH1\", UCP_EVENT_28H_10H)\t\\\n__PMC_EV_ALIAS(\"QMC_ISOC_FULL.WRITE.CH2\", UCP_EVENT_28H_20H)\t\\\n__PMC_EV_ALIAS(\"QMC_BUSY.READ.CH0\", UCP_EVENT_29H_01H)\t\\\n__PMC_EV_ALIAS(\"QMC_BUSY.READ.CH1\", UCP_EVENT_29H_02H)\t\\\n__PMC_EV_ALIAS(\"QMC_BUSY.READ.CH2\", UCP_EVENT_29H_04H)\t\\\n__PMC_EV_ALIAS(\"QMC_BUSY.WRITE.CH0\", UCP_EVENT_29H_08H)\t\\\n__PMC_EV_ALIAS(\"QMC_BUSY.WRITE.CH1\", UCP_EVENT_29H_10H)\t\\\n__PMC_EV_ALIAS(\"QMC_BUSY.WRITE.CH2\", UCP_EVENT_29H_20H)\t\\\n__PMC_EV_ALIAS(\"QMC_OCCUPANCY.CH0\", UCP_EVENT_2AH_01H)\t\\\n__PMC_EV_ALIAS(\"QMC_OCCUPANCY.CH1\", UCP_EVENT_2AH_02H)\t\\\n__PMC_EV_ALIAS(\"QMC_OCCUPANCY.CH2\", UCP_EVENT_2AH_04H)\t\\\n__PMC_EV_ALIAS(\"QMC_ISSOC_OCCUPANCY.CH0\", UCP_EVENT_2BH_01H)\t\\\n__PMC_EV_ALIAS(\"QMC_ISSOC_OCCUPANCY.CH1\", UCP_EVENT_2BH_02H)\t\\\n__PMC_EV_ALIAS(\"QMC_ISSOC_OCCUPANCY.CH2\", UCP_EVENT_2BH_04H)\t\\\n__PMC_EV_ALIAS(\"QMC_ISSOC_READS.ANY\", UCP_EVENT_2BH_07H)\t\\\n__PMC_EV_ALIAS(\"QMC_NORMAL_READS.CH0\", UCP_EVENT_2CH_01H)\t\\\n__PMC_EV_ALIAS(\"QMC_NORMAL_READS.CH1\", UCP_EVENT_2CH_02H)\t\\\n__PMC_EV_ALIAS(\"QMC_NORMAL_READS.CH2\", UCP_EVENT_2CH_04H)\t\\\n__PMC_EV_ALIAS(\"QMC_NORMAL_READS.ANY\", UCP_EVENT_2CH_07H)\t\\\n__PMC_EV_ALIAS(\"QMC_HIGH_PRIORITY_READS.CH0\", UCP_EVENT_2DH_01H)\t\\\n__PMC_EV_ALIAS(\"QMC_HIGH_PRIORITY_READS.CH1\", UCP_EVENT_2DH_02H)\t\\\n__PMC_EV_ALIAS(\"QMC_HIGH_PRIORITY_READS.CH2\", UCP_EVENT_2DH_04H)\t\\\n__PMC_EV_ALIAS(\"QMC_HIGH_PRIORITY_READS.ANY\", UCP_EVENT_2DH_07H)\t\\\n__PMC_EV_ALIAS(\"QMC_CRITICAL_PRIORITY_READS.CH0\", UCP_EVENT_2EH_01H)\t\\\n__PMC_EV_ALIAS(\"QMC_CRITICAL_PRIORITY_READS.CH1\", UCP_EVENT_2EH_02H)\t\\\n__PMC_EV_ALIAS(\"QMC_CRITICAL_PRIORITY_READS.CH2\", UCP_EVENT_2EH_04H)\t\\\n__PMC_EV_ALIAS(\"QMC_CRITICAL_PRIORITY_READS.ANY\", UCP_EVENT_2EH_07H)\t\\\n__PMC_EV_ALIAS(\"QMC_WRITES.FULL.CH0\", UCP_EVENT_2FH_01H)\t\\\n__PMC_EV_ALIAS(\"QMC_WRITES.FULL.CH1\", UCP_EVENT_2FH_02H)\t\\\n__PMC_EV_ALIAS(\"QMC_WRITES.FULL.CH2\", UCP_EVENT_2FH_04H)\t\\\n__PMC_EV_ALIAS(\"QMC_WRITES.FULL.ANY\", UCP_EVENT_2FH_07H)\t\\\n__PMC_EV_ALIAS(\"QMC_WRITES.PARTIAL.CH0\", UCP_EVENT_2FH_08H)\t\\\n__PMC_EV_ALIAS(\"QMC_WRITES.PARTIAL.CH1\", UCP_EVENT_2FH_10H)\t\\\n__PMC_EV_ALIAS(\"QMC_WRITES.PARTIAL.CH2\", UCP_EVENT_2FH_20H)\t\\\n__PMC_EV_ALIAS(\"QMC_WRITES.PARTIAL.ANY\", UCP_EVENT_2FH_38H)\t\\\n__PMC_EV_ALIAS(\"QMC_CANCEL.CH0\", UCP_EVENT_30H_01H)\t\\\n__PMC_EV_ALIAS(\"QMC_CANCEL.CH1\", UCP_EVENT_30H_02H)\t\\\n__PMC_EV_ALIAS(\"QMC_CANCEL.CH2\", UCP_EVENT_30H_04H)\t\\\n__PMC_EV_ALIAS(\"QMC_CANCEL.ANY\", UCP_EVENT_30H_07H)\t\\\n__PMC_EV_ALIAS(\"QMC_PRIORITY_UPDATES.CH0\", UCP_EVENT_31H_01H)\t\\\n__PMC_EV_ALIAS(\"QMC_PRIORITY_UPDATES.CH1\", UCP_EVENT_31H_02H)\t\\\n__PMC_EV_ALIAS(\"QMC_PRIORITY_UPDATES.CH2\", UCP_EVENT_31H_04H)\t\\\n__PMC_EV_ALIAS(\"QMC_PRIORITY_UPDATES.ANY\", UCP_EVENT_31H_07H)\t\\\n__PMC_EV_ALIAS(\"QHL_FRC_ACK_CNFLTS.LOCAL\", UCP_EVENT_33H_04H)\t\\\n__PMC_EV_ALIAS(\"QPI_TX_STALLED_SINGLE_FLIT.HOME.LINK_0\", UCP_EVENT_40H_01H)\t\\\n__PMC_EV_ALIAS(\"QPI_TX_STALLED_SINGLE_FLIT.SNOOP.LINK_0\", UCP_EVENT_40H_02H)\t\\\n__PMC_EV_ALIAS(\"QPI_TX_STALLED_SINGLE_FLIT.NDR.LINK_0\", UCP_EVENT_40H_04H)\t\\\n__PMC_EV_ALIAS(\"QPI_TX_STALLED_SINGLE_FLIT.HOME.LINK_1\", UCP_EVENT_40H_08H)\t\\\n__PMC_EV_ALIAS(\"QPI_TX_STALLED_SINGLE_FLIT.SNOOP.LINK_1\", UCP_EVENT_40H_10H)\t\\\n__PMC_EV_ALIAS(\"QPI_TX_STALLED_SINGLE_FLIT.NDR.LINK_1\", UCP_EVENT_40H_20H)\t\\\n__PMC_EV_ALIAS(\"QPI_TX_STALLED_SINGLE_FLIT.LINK_0\", UCP_EVENT_40H_07H)\t\\\n__PMC_EV_ALIAS(\"QPI_TX_STALLED_SINGLE_FLIT.LINK_1\", UCP_EVENT_40H_38H)\t\\\n__PMC_EV_ALIAS(\"QPI_TX_STALLED_MULTI_FLIT.DRS.LINK_0\", UCP_EVENT_41H_01H)\t\\\n__PMC_EV_ALIAS(\"QPI_TX_STALLED_MULTI_FLIT.NCB.LINK_0\", UCP_EVENT_41H_02H)\t\\\n__PMC_EV_ALIAS(\"QPI_TX_STALLED_MULTI_FLIT.NCS.LINK_0\", UCP_EVENT_41H_04H)\t\\\n__PMC_EV_ALIAS(\"QPI_TX_STALLED_MULTI_FLIT.DRS.LINK_1\", UCP_EVENT_41H_08H)\t\\\n__PMC_EV_ALIAS(\"QPI_TX_STALLED_MULTI_FLIT.NCB.LINK_1\", UCP_EVENT_41H_10H)\t\\\n__PMC_EV_ALIAS(\"QPI_TX_STALLED_MULTI_FLIT.NCS.LINK_1\", UCP_EVENT_41H_20H)\t\\\n__PMC_EV_ALIAS(\"QPI_TX_STALLED_MULTI_FLIT.LINK_0\", UCP_EVENT_41H_07H)\t\\\n__PMC_EV_ALIAS(\"QPI_TX_STALLED_MULTI_FLIT.LINK_1\", UCP_EVENT_41H_38H)\t\\\n__PMC_EV_ALIAS(\"QPI_TX_HEADER.BUSY.LINK_0\", UCP_EVENT_42H_02H)\t\\\n__PMC_EV_ALIAS(\"QPI_TX_HEADER.BUSY.LINK_1\", UCP_EVENT_42H_08H)\t\\\n__PMC_EV_ALIAS(\"QPI_RX_NO_PPT_CREDIT.STALLS.LINK_0\", UCP_EVENT_43H_01H)\t\\\n__PMC_EV_ALIAS(\"QPI_RX_NO_PPT_CREDIT.STALLS.LINK_1\", UCP_EVENT_43H_02H)\t\\\n__PMC_EV_ALIAS(\"DRAM_OPEN.CH0\", UCP_EVENT_60H_01H)\t\\\n__PMC_EV_ALIAS(\"DRAM_OPEN.CH1\", UCP_EVENT_60H_02H)\t\\\n__PMC_EV_ALIAS(\"DRAM_OPEN.CH2\", UCP_EVENT_60H_04H)\t\\\n__PMC_EV_ALIAS(\"DRAM_PAGE_CLOSE.CH0\", UCP_EVENT_61H_01H)\t\\\n__PMC_EV_ALIAS(\"DRAM_PAGE_CLOSE.CH1\", UCP_EVENT_61H_02H)\t\\\n__PMC_EV_ALIAS(\"DRAM_PAGE_CLOSE.CH2\", UCP_EVENT_61H_04H)\t\\\n__PMC_EV_ALIAS(\"DRAM_PAGE_MISS.CH0\", UCP_EVENT_62H_01H)\t\\\n__PMC_EV_ALIAS(\"DRAM_PAGE_MISS.CH1\", UCP_EVENT_62H_02H)\t\\\n__PMC_EV_ALIAS(\"DRAM_PAGE_MISS.CH2\", UCP_EVENT_62H_04H)\t\\\n__PMC_EV_ALIAS(\"DRAM_READ_CAS.CH0\", UCP_EVENT_63H_01H)\t\\\n__PMC_EV_ALIAS(\"DRAM_READ_CAS.AUTOPRE_CH0\", UCP_EVENT_63H_02H)\t\\\n__PMC_EV_ALIAS(\"DRAM_READ_CAS.CH1\", UCP_EVENT_63H_04H)\t\\\n__PMC_EV_ALIAS(\"DRAM_READ_CAS.AUTOPRE_CH1\", UCP_EVENT_63H_08H)\t\\\n__PMC_EV_ALIAS(\"DRAM_READ_CAS.CH2\", UCP_EVENT_63H_10H)\t\\\n__PMC_EV_ALIAS(\"DRAM_READ_CAS.AUTOPRE_CH2\", UCP_EVENT_63H_20H)\t\\\n__PMC_EV_ALIAS(\"DRAM_WRITE_CAS.CH0\", UCP_EVENT_64H_01H)\t\\\n__PMC_EV_ALIAS(\"DRAM_WRITE_CAS.AUTOPRE_CH0\", UCP_EVENT_64H_02H)\t\\\n__PMC_EV_ALIAS(\"DRAM_WRITE_CAS.CH1\", UCP_EVENT_64H_04H)\t\\\n__PMC_EV_ALIAS(\"DRAM_WRITE_CAS.AUTOPRE_CH1\", UCP_EVENT_64H_08H)\t\\\n__PMC_EV_ALIAS(\"DRAM_WRITE_CAS.CH2\", UCP_EVENT_64H_10H)\t\\\n__PMC_EV_ALIAS(\"DRAM_WRITE_CAS.AUTOPRE_CH2\", UCP_EVENT_64H_20H)\t\\\n__PMC_EV_ALIAS(\"DRAM_REFRESH.CH0\", UCP_EVENT_65H_01H)\t\\\n__PMC_EV_ALIAS(\"DRAM_REFRESH.CH1\", UCP_EVENT_65H_02H)\t\\\n__PMC_EV_ALIAS(\"DRAM_REFRESH.CH2\", UCP_EVENT_65H_04H)\t\\\n__PMC_EV_ALIAS(\"DRAM_PRE_ALL.CH0\", UCP_EVENT_66H_01H)\t\\\n__PMC_EV_ALIAS(\"DRAM_PRE_ALL.CH1\", UCP_EVENT_66H_02H)\t\\\n__PMC_EV_ALIAS(\"DRAM_PRE_ALL.CH2\", UCP_EVENT_66H_04H)\n\n#define\t__PMC_EV_ALIAS_WESTMEREUC()\t\t\t\t\t\\\n__PMC_EV_ALIAS(\"GQ_CYCLES_FULL.READ_TRACKER\", UCP_EVENT_00H_01H)\t\\\n__PMC_EV_ALIAS(\"GQ_CYCLES_FULL.WRITE_TRACKER\", UCP_EVENT_00H_02H)\t\\\n__PMC_EV_ALIAS(\"GQ_CYCLES_FULL.PEER_PROBE_TRACKER\", UCP_EVENT_00H_04H)\t\\\n__PMC_EV_ALIAS(\"GQ_CYCLES_NOT_EMPTY.READ_TRACKER\", UCP_EVENT_01H_01H)\t\\\n__PMC_EV_ALIAS(\"GQ_CYCLES_NOT_EMPTY.WRITE_TRACKER\", UCP_EVENT_01H_02H)\t\\\n__PMC_EV_ALIAS(\"GQ_CYCLES_NOT_EMPTY.PEER_PROBE_TRACKER\", UCP_EVENT_01H_04H)\t\\\n__PMC_EV_ALIAS(\"GQ_OCCUPANCY.READ_TRACKER\", UCP_EVENT_02H_01H)\t\\\n__PMC_EV_ALIAS(\"GQ_ALLOC.READ_TRACKER\", UCP_EVENT_03H_01H)\t\\\n__PMC_EV_ALIAS(\"GQ_ALLOC.RT_L3_MISS\", UCP_EVENT_03H_02H)\t\\\n__PMC_EV_ALIAS(\"GQ_ALLOC.RT_TO_L3_RESP\", UCP_EVENT_03H_04H)\t\\\n__PMC_EV_ALIAS(\"GQ_ALLOC.RT_TO_RTID_ACQUIRED\", UCP_EVENT_03H_08H)\t\\\n__PMC_EV_ALIAS(\"GQ_ALLOC.WT_TO_RTID_ACQUIRED\", UCP_EVENT_03H_10H)\t\\\n__PMC_EV_ALIAS(\"GQ_ALLOC.WRITE_TRACKER\", UCP_EVENT_03H_20H)\t\\\n__PMC_EV_ALIAS(\"GQ_ALLOC.PEER_PROBE_TRACKER\", UCP_EVENT_03H_40H)\t\\\n__PMC_EV_ALIAS(\"GQ_DATA.FROM_QPI\", UCP_EVENT_04H_01H)\t\\\n__PMC_EV_ALIAS(\"GQ_DATA.FROM_QMC\", UCP_EVENT_04H_02H)\t\\\n__PMC_EV_ALIAS(\"GQ_DATA.FROM_L3\", UCP_EVENT_04H_04H)\t\\\n__PMC_EV_ALIAS(\"GQ_DATA.FROM_CORES_02\", UCP_EVENT_04H_08H)\t\\\n__PMC_EV_ALIAS(\"GQ_DATA.FROM_CORES_13\", UCP_EVENT_04H_10H)\t\\\n__PMC_EV_ALIAS(\"GQ_DATA.TO_QPI_QMC\", UCP_EVENT_05H_01H)\t\\\n__PMC_EV_ALIAS(\"GQ_DATA.TO_L3\", UCP_EVENT_05H_02H)\t\\\n__PMC_EV_ALIAS(\"GQ_DATA.TO_CORES\", UCP_EVENT_05H_04H)\t\\\n__PMC_EV_ALIAS(\"SNP_RESP_TO_LOCAL_HOME.I_STATE\", UCP_EVENT_06H_01H)\t\\\n__PMC_EV_ALIAS(\"SNP_RESP_TO_LOCAL_HOME.S_STATE\", UCP_EVENT_06H_02H)\t\\\n__PMC_EV_ALIAS(\"SNP_RESP_TO_LOCAL_HOME.FWD_S_STATE\", UCP_EVENT_06H_04H)\t\\\n__PMC_EV_ALIAS(\"SNP_RESP_TO_LOCAL_HOME.FWD_I_STATE\", UCP_EVENT_06H_08H)\t\\\n__PMC_EV_ALIAS(\"SNP_RESP_TO_LOCAL_HOME.CONFLICT\", UCP_EVENT_06H_10H)\t\\\n__PMC_EV_ALIAS(\"SNP_RESP_TO_LOCAL_HOME.WB\", UCP_EVENT_06H_20H)\t\\\n__PMC_EV_ALIAS(\"SNP_RESP_TO_REMOTE_HOME.I_STATE\", UCP_EVENT_07H_01H)\t\\\n__PMC_EV_ALIAS(\"SNP_RESP_TO_REMOTE_HOME.S_STATE\", UCP_EVENT_07H_02H)\t\\\n__PMC_EV_ALIAS(\"SNP_RESP_TO_REMOTE_HOME.FWD_S_STATE\", UCP_EVENT_07H_04H)\t\\\n__PMC_EV_ALIAS(\"SNP_RESP_TO_REMOTE_HOME.FWD_I_STATE\", UCP_EVENT_07H_08H)\t\\\n__PMC_EV_ALIAS(\"SNP_RESP_TO_REMOTE_HOME.CONFLICT\", UCP_EVENT_07H_10H)\t\\\n__PMC_EV_ALIAS(\"SNP_RESP_TO_REMOTE_HOME.WB\", UCP_EVENT_07H_20H)\t\\\n__PMC_EV_ALIAS(\"SNP_RESP_TO_REMOTE_HOME.HITM\", UCP_EVENT_07H_24H)\t\\\n__PMC_EV_ALIAS(\"L3_HITS.READ\", UCP_EVENT_08H_01H)\t\\\n__PMC_EV_ALIAS(\"L3_HITS.WRITE\", UCP_EVENT_08H_02H)\t\\\n__PMC_EV_ALIAS(\"L3_HITS.PROBE\", UCP_EVENT_08H_04H)\t\\\n__PMC_EV_ALIAS(\"L3_HITS.ANY\", UCP_EVENT_08H_03H)\t\\\n__PMC_EV_ALIAS(\"L3_MISS.READ\", UCP_EVENT_09H_01H)\t\\\n__PMC_EV_ALIAS(\"L3_MISS.WRITE\", UCP_EVENT_09H_02H)\t\\\n__PMC_EV_ALIAS(\"L3_MISS.PROBE\", UCP_EVENT_09H_04H)\t\\\n__PMC_EV_ALIAS(\"L3_MISS.ANY\", UCP_EVENT_09H_03H)\t\\\n__PMC_EV_ALIAS(\"L3_LINES_IN.M_STATE\", UCP_EVENT_0AH_01H)\t\\\n__PMC_EV_ALIAS(\"L3_LINES_IN.E_STATE\", UCP_EVENT_0AH_02H)\t\\\n__PMC_EV_ALIAS(\"L3_LINES_IN.S_STATE\", UCP_EVENT_0AH_04H)\t\\\n__PMC_EV_ALIAS(\"L3_LINES_IN.F_STATE\", UCP_EVENT_0AH_08H)\t\\\n__PMC_EV_ALIAS(\"L3_LINES_IN.ANY\", UCP_EVENT_0AH_0FH)\t\\\n__PMC_EV_ALIAS(\"L3_LINES_OUT.M_STATE\", UCP_EVENT_0BH_01H)\t\\\n__PMC_EV_ALIAS(\"L3_LINES_OUT.E_STATE\", UCP_EVENT_0BH_02H)\t\\\n__PMC_EV_ALIAS(\"L3_LINES_OUT.S_STATE\", UCP_EVENT_0BH_04H)\t\\\n__PMC_EV_ALIAS(\"L3_LINES_OUT.I_STATE\", UCP_EVENT_0BH_08H)\t\\\n__PMC_EV_ALIAS(\"L3_LINES_OUT.F_STATE\", UCP_EVENT_0BH_10H)\t\\\n__PMC_EV_ALIAS(\"L3_LINES_OUT.ANY\", UCP_EVENT_0BH_1FH)\t\\\n__PMC_EV_ALIAS(\"GQ_SNOOP.GOTO_S\", UCP_EVENT_0CH_01H)\t\\\n__PMC_EV_ALIAS(\"GQ_SNOOP.GOTO_I\", UCP_EVENT_0CH_02H)\t\\\n__PMC_EV_ALIAS(\"GQ_SNOOP.GOTO_S_HIT\", UCP_EVENT_0CH_04H)\t\\\n__PMC_EV_ALIAS(\"GQ_SNOOP.GOTO_I_HIT\", UCP_EVENT_0CH_08H)\t\\\n__PMC_EV_ALIAS(\"QHL_REQUESTS.IOH_READS\", UCP_EVENT_20H_01H)\t\\\n__PMC_EV_ALIAS(\"QHL_REQUESTS.IOH_WRITES\", UCP_EVENT_20H_02H)\t\\\n__PMC_EV_ALIAS(\"QHL_REQUESTS.REMOTE_READS\", UCP_EVENT_20H_04H)\t\\\n__PMC_EV_ALIAS(\"QHL_REQUESTS.REMOTE_WRITES\", UCP_EVENT_20H_08H)\t\\\n__PMC_EV_ALIAS(\"QHL_REQUESTS.LOCAL_READS\", UCP_EVENT_20H_10H)\t\\\n__PMC_EV_ALIAS(\"QHL_REQUESTS.LOCAL_WRITES\", UCP_EVENT_20H_20H)\t\\\n__PMC_EV_ALIAS(\"QHL_CYCLES_FULL.IOH\", UCP_EVENT_21H_01H)\t\\\n__PMC_EV_ALIAS(\"QHL_CYCLES_FULL.REMOTE\", UCP_EVENT_21H_02H)\t\\\n__PMC_EV_ALIAS(\"QHL_CYCLES_FULL.LOCAL\", UCP_EVENT_21H_04H)\t\\\n__PMC_EV_ALIAS(\"QHL_CYCLES_NOT_EMPTY.IOH\", UCP_EVENT_22H_01H)\t\\\n__PMC_EV_ALIAS(\"QHL_CYCLES_NOT_EMPTY.REMOTE\", UCP_EVENT_22H_02H)\t\\\n__PMC_EV_ALIAS(\"QHL_CYCLES_NOT_EMPTY.LOCAL\", UCP_EVENT_22H_04H)\t\\\n__PMC_EV_ALIAS(\"QHL_OCCUPANCY.IOH\", UCP_EVENT_23H_01H)\t\\\n__PMC_EV_ALIAS(\"QHL_OCCUPANCY.REMOTE\", UCP_EVENT_23H_02H)\t\\\n__PMC_EV_ALIAS(\"QHL_OCCUPANCY.LOCAL\", UCP_EVENT_23H_04H)\t\\\n__PMC_EV_ALIAS(\"QHL_ADDRESS_CONFLICTS.2WAY\", UCP_EVENT_24H_02H)\t\\\n__PMC_EV_ALIAS(\"QHL_ADDRESS_CONFLICTS.3WAY\", UCP_EVENT_24H_04H)\t\\\n__PMC_EV_ALIAS(\"QHL_CONFLICT_CYCLES.IOH\", UCP_EVENT_25H_01H)\t\\\n__PMC_EV_ALIAS(\"QHL_CONFLICT_CYCLES.REMOTE\", UCP_EVENT_25H_02H)\t\\\n__PMC_EV_ALIAS(\"QHL_CONFLICT_CYCLES.LOCAL\", UCP_EVENT_25H_04H)\t\\\n__PMC_EV_ALIAS(\"QHL_TO_QMC_BYPASS\", UCP_EVENT_26H_01H)\t\\\n__PMC_EV_ALIAS(\"QMC_ISOC_FULL.READ.CH0\", UCP_EVENT_28H_01H)\t\\\n__PMC_EV_ALIAS(\"QMC_ISOC_FULL.READ.CH1\", UCP_EVENT_28H_02H)\t\\\n__PMC_EV_ALIAS(\"QMC_ISOC_FULL.READ.CH2\", UCP_EVENT_28H_04H)\t\\\n__PMC_EV_ALIAS(\"QMC_ISOC_FULL.WRITE.CH0\", UCP_EVENT_28H_08H)\t\\\n__PMC_EV_ALIAS(\"QMC_ISOC_FULL.WRITE.CH1\", UCP_EVENT_28H_10H)\t\\\n__PMC_EV_ALIAS(\"QMC_ISOC_FULL.WRITE.CH2\", UCP_EVENT_28H_20H)\t\\\n__PMC_EV_ALIAS(\"QMC_BUSY.READ.CH0\", UCP_EVENT_29H_01H)\t\\\n__PMC_EV_ALIAS(\"QMC_BUSY.READ.CH1\", UCP_EVENT_29H_02H)\t\\\n__PMC_EV_ALIAS(\"QMC_BUSY.READ.CH2\", UCP_EVENT_29H_04H)\t\\\n__PMC_EV_ALIAS(\"QMC_BUSY.WRITE.CH0\", UCP_EVENT_29H_08H)\t\\\n__PMC_EV_ALIAS(\"QMC_BUSY.WRITE.CH1\", UCP_EVENT_29H_10H)\t\\\n__PMC_EV_ALIAS(\"QMC_BUSY.WRITE.CH2\", UCP_EVENT_29H_20H)\t\\\n__PMC_EV_ALIAS(\"QMC_OCCUPANCY.CH0\", UCP_EVENT_2AH_01H)\t\\\n__PMC_EV_ALIAS(\"QMC_OCCUPANCY.CH1\", UCP_EVENT_2AH_02H)\t\\\n__PMC_EV_ALIAS(\"QMC_OCCUPANCY.CH2\", UCP_EVENT_2AH_04H)\t\\\n__PMC_EV_ALIAS(\"QMC_OCCUPANCY.ANY\", UCP_EVENT_2AH_07H)\t\\\n__PMC_EV_ALIAS(\"QMC_ISSOC_OCCUPANCY.CH0\", UCP_EVENT_2BH_01H)\t\\\n__PMC_EV_ALIAS(\"QMC_ISSOC_OCCUPANCY.CH1\", UCP_EVENT_2BH_02H)\t\\\n__PMC_EV_ALIAS(\"QMC_ISSOC_OCCUPANCY.CH2\", UCP_EVENT_2BH_04H)\t\\\n__PMC_EV_ALIAS(\"QMC_ISSOC_READS.ANY\", UCP_EVENT_2BH_07H)\t\\\n__PMC_EV_ALIAS(\"QMC_NORMAL_READS.CH0\", UCP_EVENT_2CH_01H)\t\\\n__PMC_EV_ALIAS(\"QMC_NORMAL_READS.CH1\", UCP_EVENT_2CH_02H)\t\\\n__PMC_EV_ALIAS(\"QMC_NORMAL_READS.CH2\", UCP_EVENT_2CH_04H)\t\\\n__PMC_EV_ALIAS(\"QMC_NORMAL_READS.ANY\", UCP_EVENT_2CH_07H)\t\\\n__PMC_EV_ALIAS(\"QMC_HIGH_PRIORITY_READS.CH0\", UCP_EVENT_2DH_01H)\t\\\n__PMC_EV_ALIAS(\"QMC_HIGH_PRIORITY_READS.CH1\", UCP_EVENT_2DH_02H)\t\\\n__PMC_EV_ALIAS(\"QMC_HIGH_PRIORITY_READS.CH2\", UCP_EVENT_2DH_04H)\t\\\n__PMC_EV_ALIAS(\"QMC_HIGH_PRIORITY_READS.ANY\", UCP_EVENT_2DH_07H)\t\\\n__PMC_EV_ALIAS(\"QMC_CRITICAL_PRIORITY_READS.CH0\", UCP_EVENT_2EH_01H)\t\\\n__PMC_EV_ALIAS(\"QMC_CRITICAL_PRIORITY_READS.CH1\", UCP_EVENT_2EH_02H)\t\\\n__PMC_EV_ALIAS(\"QMC_CRITICAL_PRIORITY_READS.CH2\", UCP_EVENT_2EH_04H)\t\\\n__PMC_EV_ALIAS(\"QMC_CRITICAL_PRIORITY_READS.ANY\", UCP_EVENT_2EH_07H)\t\\\n__PMC_EV_ALIAS(\"QMC_WRITES.FULL.CH0\", UCP_EVENT_2FH_01H)\t\\\n__PMC_EV_ALIAS(\"QMC_WRITES.FULL.CH1\", UCP_EVENT_2FH_02H)\t\\\n__PMC_EV_ALIAS(\"QMC_WRITES.FULL.CH2\", UCP_EVENT_2FH_04H)\t\\\n__PMC_EV_ALIAS(\"QMC_WRITES.FULL.ANY\", UCP_EVENT_2FH_07H)\t\\\n__PMC_EV_ALIAS(\"QMC_WRITES.PARTIAL.CH0\", UCP_EVENT_2FH_08H)\t\\\n__PMC_EV_ALIAS(\"QMC_WRITES.PARTIAL.CH1\", UCP_EVENT_2FH_10H)\t\\\n__PMC_EV_ALIAS(\"QMC_WRITES.PARTIAL.CH2\", UCP_EVENT_2FH_20H)\t\\\n__PMC_EV_ALIAS(\"QMC_WRITES.PARTIAL.ANY\", UCP_EVENT_2FH_38H)\t\\\n__PMC_EV_ALIAS(\"QMC_CANCEL.CH0\", UCP_EVENT_30H_01H)\t\\\n__PMC_EV_ALIAS(\"QMC_CANCEL.CH1\", UCP_EVENT_30H_02H)\t\\\n__PMC_EV_ALIAS(\"QMC_CANCEL.CH2\", UCP_EVENT_30H_04H)\t\\\n__PMC_EV_ALIAS(\"QMC_CANCEL.ANY\", UCP_EVENT_30H_07H)\t\\\n__PMC_EV_ALIAS(\"QMC_PRIORITY_UPDATES.CH0\", UCP_EVENT_31H_01H)\t\\\n__PMC_EV_ALIAS(\"QMC_PRIORITY_UPDATES.CH1\", UCP_EVENT_31H_02H)\t\\\n__PMC_EV_ALIAS(\"QMC_PRIORITY_UPDATES.CH2\", UCP_EVENT_31H_04H)\t\\\n__PMC_EV_ALIAS(\"QMC_PRIORITY_UPDATES.ANY\", UCP_EVENT_31H_07H)\t\\\n__PMC_EV_ALIAS(\"IMC_RETRY.CH0\", UCP_EVENT_32H_01H)\t\\\n__PMC_EV_ALIAS(\"IMC_RETRY.CH1\", UCP_EVENT_32H_02H)\t\\\n__PMC_EV_ALIAS(\"IMC_RETRY.CH2\", UCP_EVENT_32H_04H)\t\\\n__PMC_EV_ALIAS(\"IMC_RETRY.ANY\", UCP_EVENT_32H_07H)\t\\\n__PMC_EV_ALIAS(\"QHL_FRC_ACK_CNFLTS.IOH\", UCP_EVENT_33H_01H)\t\\\n__PMC_EV_ALIAS(\"QHL_FRC_ACK_CNFLTS.REMOTE\", UCP_EVENT_33H_02H)\t\\\n__PMC_EV_ALIAS(\"QHL_FRC_ACK_CNFLTS.LOCAL\", UCP_EVENT_33H_04H)\t\\\n__PMC_EV_ALIAS(\"QHL_FRC_ACK_CNFLTS.ANY\", UCP_EVENT_33H_07H)\t\\\n__PMC_EV_ALIAS(\"QHL_SLEEPS.IOH_ORDER\", UCP_EVENT_34H_01H)\t\\\n__PMC_EV_ALIAS(\"QHL_SLEEPS.REMOTE_ORDER\", UCP_EVENT_34H_02H)\t\\\n__PMC_EV_ALIAS(\"QHL_SLEEPS.LOCAL_ORDER\", UCP_EVENT_34H_04H)\t\\\n__PMC_EV_ALIAS(\"QHL_SLEEPS.IOH_CONFLICT\", UCP_EVENT_34H_08H)\t\\\n__PMC_EV_ALIAS(\"QHL_SLEEPS.REMOTE_CONFLICT\", UCP_EVENT_34H_10H)\t\\\n__PMC_EV_ALIAS(\"QHL_SLEEPS.LOCAL_CONFLICT\", UCP_EVENT_34H_20H)\t\\\n__PMC_EV_ALIAS(\"ADDR_OPCODE_MATCH.IOH\", UCP_EVENT_35H_01H)\t\\\n__PMC_EV_ALIAS(\"ADDR_OPCODE_MATCH.REMOTE\", UCP_EVENT_35H_02H)\t\\\n__PMC_EV_ALIAS(\"ADDR_OPCODE_MATCH.LOCAL\", UCP_EVENT_35H_04H)\t\\\n__PMC_EV_ALIAS(\"QPI_TX_STALLED_SINGLE_FLIT.HOME.LINK_0\", UCP_EVENT_40H_01H)\t\\\n__PMC_EV_ALIAS(\"QPI_TX_STALLED_SINGLE_FLIT.SNOOP.LINK_0\", UCP_EVENT_40H_02H)\t\\\n__PMC_EV_ALIAS(\"QPI_TX_STALLED_SINGLE_FLIT.NDR.LINK_0\", UCP_EVENT_40H_04H)\t\\\n__PMC_EV_ALIAS(\"QPI_TX_STALLED_SINGLE_FLIT.HOME.LINK_1\", UCP_EVENT_40H_08H)\t\\\n__PMC_EV_ALIAS(\"QPI_TX_STALLED_SINGLE_FLIT.SNOOP.LINK_1\", UCP_EVENT_40H_10H)\t\\\n__PMC_EV_ALIAS(\"QPI_TX_STALLED_SINGLE_FLIT.NDR.LINK_1\", UCP_EVENT_40H_20H)\t\\\n__PMC_EV_ALIAS(\"QPI_TX_STALLED_SINGLE_FLIT.LINK_0\", UCP_EVENT_40H_07H)\t\\\n__PMC_EV_ALIAS(\"QPI_TX_STALLED_SINGLE_FLIT.LINK_1\", UCP_EVENT_40H_38H)\t\\\n__PMC_EV_ALIAS(\"QPI_TX_STALLED_MULTI_FLIT.DRS.LINK_0\", UCP_EVENT_41H_01H)\t\\\n__PMC_EV_ALIAS(\"QPI_TX_STALLED_MULTI_FLIT.NCB.LINK_0\", UCP_EVENT_41H_02H)\t\\\n__PMC_EV_ALIAS(\"QPI_TX_STALLED_MULTI_FLIT.NCS.LINK_0\", UCP_EVENT_41H_04H)\t\\\n__PMC_EV_ALIAS(\"QPI_TX_STALLED_MULTI_FLIT.DRS.LINK_1\", UCP_EVENT_41H_08H)\t\\\n__PMC_EV_ALIAS(\"QPI_TX_STALLED_MULTI_FLIT.NCB.LINK_1\", UCP_EVENT_41H_10H)\t\\\n__PMC_EV_ALIAS(\"QPI_TX_STALLED_MULTI_FLIT.NCS.LINK_1\", UCP_EVENT_41H_20H)\t\\\n__PMC_EV_ALIAS(\"QPI_TX_STALLED_MULTI_FLIT.LINK_0\", UCP_EVENT_41H_07H)\t\\\n__PMC_EV_ALIAS(\"QPI_TX_STALLED_MULTI_FLIT.LINK_1\", UCP_EVENT_41H_38H)\t\\\n__PMC_EV_ALIAS(\"QPI_TX_HEADER.FULL.LINK_0\", UCP_EVENT_42H_01H)\t\\\n__PMC_EV_ALIAS(\"QPI_TX_HEADER.BUSY.LINK_0\", UCP_EVENT_42H_02H)\t\\\n__PMC_EV_ALIAS(\"QPI_TX_HEADER.FULL.LINK_1\", UCP_EVENT_42H_04H)\t\\\n__PMC_EV_ALIAS(\"QPI_TX_HEADER.BUSY.LINK_1\", UCP_EVENT_42H_08H)\t\\\n__PMC_EV_ALIAS(\"QPI_RX_NO_PPT_CREDIT.STALLS.LINK_0\", UCP_EVENT_43H_01H)\t\\\n__PMC_EV_ALIAS(\"QPI_RX_NO_PPT_CREDIT.STALLS.LINK_1\", UCP_EVENT_43H_02H)\t\\\n__PMC_EV_ALIAS(\"DRAM_OPEN.CH0\", UCP_EVENT_60H_01H)\t\\\n__PMC_EV_ALIAS(\"DRAM_OPEN.CH1\", UCP_EVENT_60H_02H)\t\\\n__PMC_EV_ALIAS(\"DRAM_OPEN.CH2\", UCP_EVENT_60H_04H)\t\\\n__PMC_EV_ALIAS(\"DRAM_PAGE_CLOSE.CH0\", UCP_EVENT_61H_01H)\t\\\n__PMC_EV_ALIAS(\"DRAM_PAGE_CLOSE.CH1\", UCP_EVENT_61H_02H)\t\\\n__PMC_EV_ALIAS(\"DRAM_PAGE_CLOSE.CH2\", UCP_EVENT_61H_04H)\t\\\n__PMC_EV_ALIAS(\"DRAM_PAGE_MISS.CH0\", UCP_EVENT_62H_01H)\t\\\n__PMC_EV_ALIAS(\"DRAM_PAGE_MISS.CH1\", UCP_EVENT_62H_02H)\t\\\n__PMC_EV_ALIAS(\"DRAM_PAGE_MISS.CH2\", UCP_EVENT_62H_04H)\t\\\n__PMC_EV_ALIAS(\"DRAM_READ_CAS.CH0\", UCP_EVENT_63H_01H)\t\\\n__PMC_EV_ALIAS(\"DRAM_READ_CAS.AUTOPRE_CH0\", UCP_EVENT_63H_02H)\t\\\n__PMC_EV_ALIAS(\"DRAM_READ_CAS.CH1\", UCP_EVENT_63H_04H)\t\\\n__PMC_EV_ALIAS(\"DRAM_READ_CAS.AUTOPRE_CH1\", UCP_EVENT_63H_08H)\t\\\n__PMC_EV_ALIAS(\"DRAM_READ_CAS.CH2\", UCP_EVENT_63H_10H)\t\\\n__PMC_EV_ALIAS(\"DRAM_READ_CAS.AUTOPRE_CH2\", UCP_EVENT_63H_20H)\t\\\n__PMC_EV_ALIAS(\"DRAM_WRITE_CAS.CH0\", UCP_EVENT_64H_01H)\t\\\n__PMC_EV_ALIAS(\"DRAM_WRITE_CAS.AUTOPRE_CH0\", UCP_EVENT_64H_02H)\t\\\n__PMC_EV_ALIAS(\"DRAM_WRITE_CAS.CH1\", UCP_EVENT_64H_04H)\t\\\n__PMC_EV_ALIAS(\"DRAM_WRITE_CAS.AUTOPRE_CH1\", UCP_EVENT_64H_08H)\t\\\n__PMC_EV_ALIAS(\"DRAM_WRITE_CAS.CH2\", UCP_EVENT_64H_10H)\t\\\n__PMC_EV_ALIAS(\"DRAM_WRITE_CAS.AUTOPRE_CH2\", UCP_EVENT_64H_20H)\t\\\n__PMC_EV_ALIAS(\"DRAM_REFRESH.CH0\", UCP_EVENT_65H_01H)\t\\\n__PMC_EV_ALIAS(\"DRAM_REFRESH.CH1\", UCP_EVENT_65H_02H)\t\\\n__PMC_EV_ALIAS(\"DRAM_REFRESH.CH2\", UCP_EVENT_65H_04H)\t\\\n__PMC_EV_ALIAS(\"DRAM_PRE_ALL.CH0\", UCP_EVENT_66H_01H)\t\\\n__PMC_EV_ALIAS(\"DRAM_PRE_ALL.CH1\", UCP_EVENT_66H_02H)\t\\\n__PMC_EV_ALIAS(\"DRAM_PRE_ALL.CH2\", UCP_EVENT_66H_04H)\t\\\n__PMC_EV_ALIAS(\"DRAM_THERMAL_THROTTLED\", UCP_EVENT_67H_01H)\t\\\n__PMC_EV_ALIAS(\"THERMAL_THROTTLING_TEMP.CORE_0\", UCP_EVENT_80H_01H)\t\\\n__PMC_EV_ALIAS(\"THERMAL_THROTTLING_TEMP.CORE_1\", UCP_EVENT_80H_02H)\t\\\n__PMC_EV_ALIAS(\"THERMAL_THROTTLING_TEMP.CORE_2\", UCP_EVENT_80H_04H)\t\\\n__PMC_EV_ALIAS(\"THERMAL_THROTTLING_TEMP.CORE_3\", UCP_EVENT_80H_08H)\t\\\n__PMC_EV_ALIAS(\"THERMAL_THROTTLED_TEMP.CORE_0\", UCP_EVENT_81H_01H)\t\\\n__PMC_EV_ALIAS(\"THERMAL_THROTTLED_TEMP.CORE_1\", UCP_EVENT_81H_02H)\t\\\n__PMC_EV_ALIAS(\"THERMAL_THROTTLED_TEMP.CORE_2\", UCP_EVENT_81H_04H)\t\\\n__PMC_EV_ALIAS(\"THERMAL_THROTTLED_TEMP.CORE_3\", UCP_EVENT_81H_08H)\t\\\n__PMC_EV_ALIAS(\"PROCHOT_ASSERTION\", UCP_EVENT_82H_01H)\t\\\n__PMC_EV_ALIAS(\"THERMAL_THROTTLING_PROCHOT.CORE_0\", UCP_EVENT_83H_01H)\t\\\n__PMC_EV_ALIAS(\"THERMAL_THROTTLING_PROCHOT.CORE_1\", UCP_EVENT_83H_02H)\t\\\n__PMC_EV_ALIAS(\"THERMAL_THROTTLING_PROCHOT.CORE_2\", UCP_EVENT_83H_04H)\t\\\n__PMC_EV_ALIAS(\"THERMAL_THROTTLING_PROCHOT.CORE_3\", UCP_EVENT_83H_08H)\t\\\n__PMC_EV_ALIAS(\"TURBO_MODE.CORE_0\", UCP_EVENT_84H_01H)\t\\\n__PMC_EV_ALIAS(\"TURBO_MODE.CORE_1\", UCP_EVENT_84H_02H)\t\\\n__PMC_EV_ALIAS(\"TURBO_MODE.CORE_2\", UCP_EVENT_84H_04H)\t\\\n__PMC_EV_ALIAS(\"TURBO_MODE.CORE_3\", UCP_EVENT_84H_08H)\t\\\n__PMC_EV_ALIAS(\"CYCLES_UNHALTED_L3_FLL_ENABLE\", UCP_EVENT_85H_02H)\t\\\n__PMC_EV_ALIAS(\"CYCLES_UNHALTED_L3_FLL_DISABLE\", UCP_EVENT_86H_01H)\n\n/*\n * Intel XScale events from:\n *\n * Intel XScale Core Developer's Manual\n * January, 2004, #27347302\n *\n * 3rd Generation Intel XScale Microarchitecture\n * Developer's Manual\n * May 2007, #31628302\n *\n * First 14 events are for 1st and 2nd Generation Intel XScale cores. The\n * remaining are available only on 3rd Generation Intel XScale cores.\n */\n#define\t__PMC_EV_XSCALE()\t\t\t\t\\\n\t__PMC_EV(XSCALE, IC_FETCH)\t\t\t\\\n\t__PMC_EV(XSCALE, IC_MISS)\t\t\t\\\n\t__PMC_EV(XSCALE, DATA_DEPENDENCY_STALLED)\t\\\n\t__PMC_EV(XSCALE, ITLB_MISS)\t\t\t\\\n\t__PMC_EV(XSCALE, DTLB_MISS)\t\t\t\\\n\t__PMC_EV(XSCALE, BRANCH_RETIRED)\t\t\\\n\t__PMC_EV(XSCALE, BRANCH_MISPRED)\t\t\\\n\t__PMC_EV(XSCALE, INSTR_RETIRED)\t\t\t\\\n\t__PMC_EV(XSCALE, DC_FULL_CYCLE)\t\t\t\\\n\t__PMC_EV(XSCALE, DC_FULL_CONTIG)\t\t\\\n\t__PMC_EV(XSCALE, DC_ACCESS)\t\t\t\\\n\t__PMC_EV(XSCALE, DC_MISS)\t\t\t\\\n\t__PMC_EV(XSCALE, DC_WRITEBACK)\t\t\t\\\n\t__PMC_EV(XSCALE, PC_CHANGE)\t\t\t\\\n\t__PMC_EV(XSCALE, BRANCH_RETIRED_ALL)\t\t\\\n\t__PMC_EV(XSCALE, INSTR_CYCLE)\t\t\t\\\n\t__PMC_EV(XSCALE, CP_STALL)\t\t\t\\\n\t__PMC_EV(XSCALE, PC_CHANGE_ALL)\t\t\t\\\n\t__PMC_EV(XSCALE, PIPELINE_FLUSH)\t\t\\\n\t__PMC_EV(XSCALE, BACKEND_STALL)\t\t\t\\\n\t__PMC_EV(XSCALE, MULTIPLIER_USE)\t\t\\\n\t__PMC_EV(XSCALE, MULTIPLIER_STALLED)\t\t\\\n\t__PMC_EV(XSCALE, DATA_CACHE_STALLED)\t\t\\\n\t__PMC_EV(XSCALE, L2_CACHE_REQ)\t\t\t\\\n\t__PMC_EV(XSCALE, L2_CACHE_MISS)\t\t\t\\\n\t__PMC_EV(XSCALE, ADDRESS_BUS_TRANS)\t\t\\\n\t__PMC_EV(XSCALE, SELF_ADDRESS_BUS_TRANS)\t\\\n\t__PMC_EV(XSCALE, DATA_BUS_TRANS)\n\n#define\tPMC_EV_XSCALE_FIRST\tPMC_EV_XSCALE_IC_FETCH\n#define\tPMC_EV_XSCALE_LAST\tPMC_EV_XSCALE_DATA_BUS_TRANS\n\n/*\n * MIPS Events from \"Programming the MIPS32 24K Core Family\",\n * Document Number: MD00355 Revision 04.63 December 19, 2008\n * These events are kept in the order found in Table 7.4.\n * For counters which are different between the left hand\n * column (0/2) and the right hand column (1/3) the left\n * hand is given first, e.g. BRANCH_COMPLETED and BRANCH_MISPRED\n * in the definition below.\n */\n\n#define __PMC_EV_MIPS24K()                         \\\n\t__PMC_EV(MIPS24K, CYCLE)                   \\\n\t__PMC_EV(MIPS24K, INSTR_EXECUTED)          \\\n\t__PMC_EV(MIPS24K, BRANCH_COMPLETED)        \\\n\t__PMC_EV(MIPS24K, BRANCH_MISPRED)          \\\n\t__PMC_EV(MIPS24K, RETURN)                  \\\n\t__PMC_EV(MIPS24K, RETURN_MISPRED)          \\\n\t__PMC_EV(MIPS24K, RETURN_NOT_31)           \\\n\t__PMC_EV(MIPS24K, RETURN_NOTPRED)          \\\n\t__PMC_EV(MIPS24K, ITLB_ACCESS)             \\\n\t__PMC_EV(MIPS24K, ITLB_MISS)               \\\n\t__PMC_EV(MIPS24K, DTLB_ACCESS)             \\\n\t__PMC_EV(MIPS24K, DTLB_MISS)               \\\n\t__PMC_EV(MIPS24K, JTLB_IACCESS)            \\\n\t__PMC_EV(MIPS24K, JTLB_IMISS)              \\\n\t__PMC_EV(MIPS24K, JTLB_DACCESS)            \\\n\t__PMC_EV(MIPS24K, JTLB_DMISS)              \\\n\t__PMC_EV(MIPS24K, IC_FETCH)                \\\n\t__PMC_EV(MIPS24K, IC_MISS)                 \\\n\t__PMC_EV(MIPS24K, DC_LOADSTORE)            \\\n\t__PMC_EV(MIPS24K, DC_WRITEBACK)            \\\n\t__PMC_EV(MIPS24K, DC_MISS)                 \\\n\t__PMC_EV(MIPS24K, STORE_MISS)              \\\n\t__PMC_EV(MIPS24K, LOAD_MISS)               \\\n\t__PMC_EV(MIPS24K, INTEGER_COMPLETED)       \\\n\t__PMC_EV(MIPS24K, FP_COMPLETED)            \\\n\t__PMC_EV(MIPS24K, LOAD_COMPLETED)          \\\n\t__PMC_EV(MIPS24K, STORE_COMPLETED)         \\\n\t__PMC_EV(MIPS24K, BARRIER_COMPLETED)       \\\n\t__PMC_EV(MIPS24K, MIPS16_COMPLETED)        \\\n\t__PMC_EV(MIPS24K, NOP_COMPLETED)           \\\n\t__PMC_EV(MIPS24K, INTEGER_MULDIV_COMPLETED)\\\n\t__PMC_EV(MIPS24K, RF_STALL)                \\\n\t__PMC_EV(MIPS24K, INSTR_REFETCH)           \\\n\t__PMC_EV(MIPS24K, STORE_COND_COMPLETED)    \\\n\t__PMC_EV(MIPS24K, STORE_COND_FAILED)       \\\n\t__PMC_EV(MIPS24K, ICACHE_REQUESTS)         \\\n\t__PMC_EV(MIPS24K, ICACHE_HIT)              \\\n\t__PMC_EV(MIPS24K, L2_WRITEBACK)            \\\n\t__PMC_EV(MIPS24K, L2_ACCESS)               \\\n\t__PMC_EV(MIPS24K, L2_MISS)                 \\\n\t__PMC_EV(MIPS24K, L2_ERR_CORRECTED)        \\\n\t__PMC_EV(MIPS24K, EXCEPTIONS)              \\\n\t__PMC_EV(MIPS24K, RF_CYCLES_STALLED)       \\\n\t__PMC_EV(MIPS24K, IFU_CYCLES_STALLED)      \\\n\t__PMC_EV(MIPS24K, ALU_CYCLES_STALLED)      \\\n\t__PMC_EV(MIPS24K, UNCACHED_LOAD)           \\\n\t__PMC_EV(MIPS24K, UNCACHED_STORE)          \\\n\t__PMC_EV(MIPS24K, CP2_REG_TO_REG_COMPLETED)\\\n\t__PMC_EV(MIPS24K, MFTC_COMPLETED)          \\\n\t__PMC_EV(MIPS24K, IC_BLOCKED_CYCLES)       \\\n\t__PMC_EV(MIPS24K, DC_BLOCKED_CYCLES)       \\\n\t__PMC_EV(MIPS24K, L2_IMISS_STALL_CYCLES)   \\\n\t__PMC_EV(MIPS24K, L2_DMISS_STALL_CYCLES)   \\\n\t__PMC_EV(MIPS24K, DMISS_CYCLES)            \\\n\t__PMC_EV(MIPS24K, L2_MISS_CYCLES)          \\\n\t__PMC_EV(MIPS24K, UNCACHED_BLOCK_CYCLES)   \\\n\t__PMC_EV(MIPS24K, MDU_STALL_CYCLES)        \\\n\t__PMC_EV(MIPS24K, FPU_STALL_CYCLES)        \\\n\t__PMC_EV(MIPS24K, CP2_STALL_CYCLES)        \\\n\t__PMC_EV(MIPS24K, COREXTEND_STALL_CYCLES)  \\\n\t__PMC_EV(MIPS24K, ISPRAM_STALL_CYCLES)     \\\n\t__PMC_EV(MIPS24K, DSPRAM_STALL_CYCLES)     \\\n\t__PMC_EV(MIPS24K, CACHE_STALL_CYCLES)      \\\n\t__PMC_EV(MIPS24K, LOAD_TO_USE_STALLS)      \\\n\t__PMC_EV(MIPS24K, BASE_MISPRED_STALLS)     \\\n\t__PMC_EV(MIPS24K, CPO_READ_STALLS)         \\\n\t__PMC_EV(MIPS24K, BRANCH_MISPRED_CYCLES)   \\\n\t__PMC_EV(MIPS24K, IFETCH_BUFFER_FULL)      \\\n\t__PMC_EV(MIPS24K, FETCH_BUFFER_ALLOCATED)  \\\n\t__PMC_EV(MIPS24K, EJTAG_ITRIGGER)          \\\n\t__PMC_EV(MIPS24K, EJTAG_DTRIGGER)          \\\n\t__PMC_EV(MIPS24K, FSB_LT_QUARTER)          \\\n\t__PMC_EV(MIPS24K, FSB_QUARTER_TO_HALF)     \\\n\t__PMC_EV(MIPS24K, FSB_GT_HALF)             \\\n\t__PMC_EV(MIPS24K, FSB_FULL_PIPELINE_STALLS)\\\n\t__PMC_EV(MIPS24K, LDQ_LT_QUARTER)          \\\n\t__PMC_EV(MIPS24K, LDQ_QUARTER_TO_HALF)     \\\n\t__PMC_EV(MIPS24K, LDQ_GT_HALF)             \\\n\t__PMC_EV(MIPS24K, LDQ_FULL_PIPELINE_STALLS)\\\n\t__PMC_EV(MIPS24K, WBB_LT_QUARTER)          \\\n\t__PMC_EV(MIPS24K, WBB_QUARTER_TO_HALF)     \\\n\t__PMC_EV(MIPS24K, WBB_GT_HALF)             \\\n\t__PMC_EV(MIPS24K, WBB_FULL_PIPELINE_STALLS) \\\n\t__PMC_EV(MIPS24K, REQUEST_LATENCY)         \\\n\t__PMC_EV(MIPS24K, REQUEST_COUNT)\n\n#define\tPMC_EV_MIPS24K_FIRST\tPMC_EV_MIPS24K_CYCLE\n#define\tPMC_EV_MIPS24K_LAST\tPMC_EV_MIPS24K_WBB_FULL_PIPELINE_STALLS\n\n/*\n * All known PMC events.\n *\n * PMC event numbers are allocated sparsely to allow new PMC events to\n * be added to a PMC class without breaking ABI compatibility.  The\n * current allocation scheme is:\n *\n * START\t#EVENTS\t\tDESCRIPTION\n * 0\t\t0x1000\t\tReserved\n * 0x1000\t0x0001\t\tTSC\n * 0x2000\t0x0080\t\tAMD K7 events\n * 0x2080\t0x0100\t\tAMD K8 events\n * 0x10000\t0x0080\t\tINTEL architectural fixed-function events\n * 0x10080\t0x0F80\t\tINTEL architectural programmable events\n * 0x11000\t0x0080\t\tINTEL Pentium 4 events\n * 0x11080\t0x0080\t\tINTEL Pentium MMX events\n * 0x11100\t0x0100\t\tINTEL Pentium Pro/P-II/P-III/Pentium-M events\n * 0x11200\t0x00FF\t\tINTEL XScale events\n * 0x11300      0x00FF          MIPS 24K events\n */\n#define\t__PMC_EVENTS()\t\t\t\t\\\n\t__PMC_EV_BLOCK(TSC,\t0x01000)\t\\\n\t__PMC_EV_TSC()\t\t\t\t\\\n\t__PMC_EV_BLOCK(K7,\t0x2000)\t\t\\\n\t__PMC_EV_K7()\t\t\t\t\\\n\t__PMC_EV_BLOCK(K8,\t0x2080)\t\t\\\n\t__PMC_EV_K8()\t\t\t\t\\\n\t__PMC_EV_BLOCK(IAF,\t0x10000)\t\\\n\t__PMC_EV_IAF()\t\t\t\t\\\n\t__PMC_EV_BLOCK(IAP,\t0x10080)\t\\\n\t__PMC_EV_IAP()\t\t\t\t\\\n\t__PMC_EV_BLOCK(P4,\t0x11000)\t\\\n\t__PMC_EV_P4()\t\t\t\t\\\n\t__PMC_EV_BLOCK(P5,\t0x11080)\t\\\n\t__PMC_EV_P5()\t\t\t\t\\\n\t__PMC_EV_BLOCK(P6,\t0x11100)\t\\\n\t__PMC_EV_P6()\t\t\t\t\\\n\t__PMC_EV_BLOCK(XSCALE,\t0x11200)\t\\\n\t__PMC_EV_XSCALE()                       \\\n\t__PMC_EV_BLOCK(MIPS24K,\t0x11300)\t\\\n\t__PMC_EV_MIPS24K()\t\t\t\\\n\t__PMC_EV_BLOCK(UCF,\t0x12000)\t\\\n\t__PMC_EV_UCF()\t\t\t\t\\\n\t__PMC_EV_BLOCK(UCP,\t0x12080)\t\\\n\t__PMC_EV_UCP()\t\t\t\t\\\n\n#define\tPMC_EVENT_FIRST\tPMC_EV_TSC_TSC\n#define\tPMC_EVENT_LAST\tPMC_EV_UCP_LAST\n\n#endif /* _DEV_HWPMC_PMC_EVENTS_H_ */\n"
  },
  {
    "path": "freebsd-headers/dev/ic/cd1400.h",
    "content": "/*-\n * cyclades cyclom-y serial driver\n *\tAndrew Herbert <andrew@werple.apana.org.au>, 17 August 1993\n *\n * Copyright (c) 1993 Andrew Herbert.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. The name Andrew Herbert may not be used to endorse or promote products\n *    derived from this software without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY ``AS IS'' AND ANY EXPRESS OR IMPLIED\n * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF\n * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN\n * NO EVENT SHALL I BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,\n * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,\n * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF\n * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING\n * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\n * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/dev/ic/cd1400.h 50477 1999-08-28 01:08:13Z peter $\n */\n\n/*\n * Definitions for Cirrus Logic CD1400 serial/parallel chips.\n */\n\n#define\tCD1400_NO_OF_CHANNELS\t4\t/* 4 serial channels per chip */\n#define\tCD1400_RX_FIFO_SIZE\t12\n#define\tCD1400_TX_FIFO_SIZE\t12\n\n/*\n * Global registers.\n */\n#define\tCD1400_GFRCR\t\t0x40\t/* global firmware revision code */\n#define\tCD1400_CAR\t\t0x68\t/* channel access */\n#define\tCD1400_CAR_CHAN\t\t\t(3<<0)\t/* channel select */\n#define\tCD1400_GCR\t\t0x4B\t/* global configuration */\n#define\tCD1400_GCR_PARALLEL\t\t(1<<7)\t/* channel 0 is parallel */\n#define\tCD1400_SVRR\t\t0x67\t/* service request */\n#define\tCD1400_SVRR_MDMCH\t\t(1<<2)\n#define\tCD1400_SVRR_TXRDY\t\t(1<<1)\n#define\tCD1400_SVRR_RXRDY\t\t(1<<0)\n#define\tCD1400_RICR\t\t0x44\t/* receive interrupting channel */\n#define\tCD1400_TICR\t\t0x45\t/* transmit interrupting channel */\n#define\tCD1400_MICR\t\t0x46\t/* modem interrupting channel */\n#define\tCD1400_RIR\t\t0x6B\t/* receive interrupt status */\n#define\tCD1400_RIR_RDIREQ\t\t(1<<7)\t/* rx service required */\n#define\tCD1400_RIR_RBUSY\t\t(1<<6)\t/* rx service in progress */\n#define\tCD1400_RIR_CHAN\t\t\t(3<<0)\t/* channel select */\n#define\tCD1400_TIR\t\t0x6A\t/* transmit interrupt status */\n#define\tCD1400_TIR_RDIREQ\t\t(1<<7)\t/* tx service required */\n#define\tCD1400_TIR_RBUSY\t\t(1<<6)\t/* tx service in progress */\n#define\tCD1400_TIR_CHAN\t\t\t(3<<0)\t/* channel select */\n#define\tCD1400_MIR\t\t0x69\t/* modem interrupt status */\n#define\tCD1400_MIR_RDIREQ\t\t(1<<7)\t/* modem service required */\n#define\tCD1400_MIR_RBUSY\t\t(1<<6)\t/* modem service in progress */\n#define\tCD1400_MIR_CHAN\t\t\t(3<<0)\t/* channel select */\n#define\tCD1400_PPR\t\t0x7E\t/* prescaler period */\n#define\tCD1400_PPR_PRESCALER\t\t512\n\n/*\n * Virtual registers.\n */\n#define\tCD1400_RIVR\t\t0x43\t/* receive interrupt vector */\n#define\tCD1400_RIVR_EXCEPTION\t\t(1<<2)\t/* receive exception bit */\n#define\tCD1400_TIVR\t\t0x42\t/* transmit interrupt vector */\n#define\tCD1400_MIVR\t\t0x41\t/* modem interrupt vector */\n#define\tCD1400_TDR\t\t0x63\t/* transmit data */\n#define\tCD1400_RDSR\t\t0x62\t/* receive data/status */\n#define\tCD1400_RDSR_TIMEOUT\t\t(1<<7)\t/* rx timeout */\n#define\tCD1400_RDSR_SPECIAL_SHIFT\t4\t/* rx special char shift */\n#define\tCD1400_RDSR_SPECIAL\t\t(7<<4)\t/* rx special char */\n#define\tCD1400_RDSR_BREAK\t\t(1<<3)\t/* rx break */\n#define\tCD1400_RDSR_PE\t\t\t(1<<2)\t/* rx parity error */\n#define\tCD1400_RDSR_FE\t\t\t(1<<1)\t/* rx framing error */\n#define\tCD1400_RDSR_OE\t\t\t(1<<0)\t/* rx overrun error */\n#define\tCD1400_MISR\t\t0x4C\t/* modem interrupt status */\n#define\tCD1400_MISR_DSRd\t\t(1<<7)\t/* DSR delta */\n#define\tCD1400_MISR_CTSd\t\t(1<<6)\t/* CTS delta */\n#define\tCD1400_MISR_RId\t\t\t(1<<5)\t/* RI delta */\n#define\tCD1400_MISR_CDd\t\t\t(1<<4)\t/* CD delta */\n#define\tCD1400_EOSRR\t\t0x60\t/* end of service request */\n\n/*\n * Channel registers.\n */\n#define\tCD1400_LIVR\t\t0x18\t/* local interrupt vector */\n#define\tCD1400_CCR\t\t0x05\t/* channel control */\n#define\tCD1400_CCR_CMDRESET\t\t(1<<7)\t/* enables following: */\n#define\tCD1400_CCR_FTF\t\t\t\t(1<<1)\t/* flush tx fifo */\n#define\tCD1400_CCR_FULLRESET\t\t\t(1<<0)\t/* full reset */\n#define\tCD1400_CCR_CHANRESET\t\t\t0\t/*  current channel */\n#define\tCD1400_CCR_CMDCORCHG\t\t(1<<6)\t/* enables following: */\n#define\tCD1400_CCR_COR3\t\t\t\t(1<<3)\t/* COR3 changed */\n#define\tCD1400_CCR_COR2\t\t\t\t(1<<2)\t/* COR2 changed */\n#define\tCD1400_CCR_COR1\t\t\t\t(1<<1)\t/* COR1 changed */\n#define\tCD1400_CCR_CMDSENDSC\t\t(1<<5)\t/* enables following: */\n#define\tCD1400_CCR_SC\t\t\t\t(7<<0)\t/* special char 1-4 */\n#define\tCD1400_CCR_CMDCHANCTL\t\t(1<<4)\t/* enables following: */\n#define\tCD1400_CCR_XMTEN\t\t\t(1<<3)\t/* tx enable */\n#define\tCD1400_CCR_XMTDIS\t\t\t(1<<2)\t/* tx disable */\n#define\tCD1400_CCR_RCVEN\t\t\t(1<<1)\t/* rx enable */\n#define\tCD1400_CCR_RCVDIS\t\t\t(1<<0)\t/* rx disable */\n#define\tCD1400_SRER\t\t0x06\t/* service request enable */\n#define\tCD1400_SRER_MDMCH\t\t(1<<7)\t/* modem change */\n#define\tCD1400_SRER_RXDATA\t\t(1<<4)\t/* rx data */\n#define\tCD1400_SRER_TXRDY\t\t(1<<2)\t/* tx fifo empty */\n#define\tCD1400_SRER_TXMPTY\t\t(1<<1)\t/* tx shift reg empty */\n#define\tCD1400_SRER_NNDT\t\t(1<<0)\t/* no new data */\n#define\tCD1400_COR1\t\t0x08\t/* channel option 1 */\n#define\tCD1400_COR1_PARODD\t\t(1<<7)\n#define\tCD1400_COR1_PARNORMAL\t\t(2<<5)\n#define\tCD1400_COR1_PARFORCE\t\t(1<<5)\t/* odd/even = force 1/0 */\n#define\tCD1400_COR1_PARNONE\t\t(0<<5)\n#define\tCD1400_COR1_NOINPCK\t\t(1<<4)\n#define\tCD1400_COR1_STOP2\t\t(2<<2)\n#define\tCD1400_COR1_STOP15\t\t(1<<2)\t/* 1.5 stop bits */\n#define\tCD1400_COR1_STOP1\t\t(0<<2)\n#define\tCD1400_COR1_CS8\t\t\t(3<<0)\n#define\tCD1400_COR1_CS7\t\t\t(2<<0)\n#define\tCD1400_COR1_CS6\t\t\t(1<<0)\n#define\tCD1400_COR1_CS5\t\t\t(0<<0)\n#define\tCD1400_COR2\t\t0x09\t/* channel option 2 */\n#define\tCD1400_COR2_IXANY\t\t(1<<7)\t/* implied XON mode */\n#define\tCD1400_COR2_IXOFF\t\t(1<<6)\t/* in-band tx flow control */\n#define\tCD1400_COR2_ETC\t\t\t(1<<5)\t/* embedded tx command */\n#define\tCD1400_ETC_CMD\t\t\t\t0x00\t/* start an ETC */\n#define\tCD1400_ETC_SENDBREAK\t\t\t0x81\n#define\tCD1400_ETC_INSERTDELAY\t\t\t0x82\n#define\tCD1400_ETC_STOPBREAK\t\t\t0x83\n#define\tCD1400_COR2_LLM\t\t\t(1<<4)\t/* local loopback mode */\n#define\tCD1400_COR2_RLM\t\t\t(1<<3)\t/* remote loopback mode */\n#define\tCD1400_COR2_RTSAO\t\t(1<<2)\t/* RTS auto output */\n#define\tCD1400_COR2_CCTS_OFLOW\t\t(1<<1)\t/* CTS auto enable */\n#define\tCD1400_COR2_CDSR_OFLOW\t\t(1<<0)\t/* DSR auto enable */\n#define\tCD1400_COR3\t\t0x0A\t/* channel option 3 */\n#define\tCD1400_COR3_SCDRNG\t\t(1<<7)\t/* special char detect range */\n#define\tCD1400_COR3_SCD34\t\t(1<<6)\t/* special char detect 3-4 */\n#define\tCD1400_COR3_FTC\t\t\t(1<<5)\t/* flow control transparency */\n#define\tCD1400_COR3_SCD12\t\t(1<<4)\t/* special char detect 1-2 */\n#define\tCD1400_COR3_RXTH\t\t(15<<0)\t/* rx fifo threshold */\n#define\tCD1400_COR4\t\t0x1E\t/* channel option 4 */\n#define\tCD1400_COR4_IGNCR\t\t(1<<7)\n#define\tCD1400_COR4_ICRNL\t\t(1<<6)\n#define\tCD1400_COR4_INLCR\t\t(1<<5)\n#define\tCD1400_COR4_IGNBRK\t\t(1<<4)\n#define\tCD1400_COR4_NOBRKINT\t\t(1<<3)\n#define\tCD1400_COR4_PFO_ESC\t\t(4<<0)\t/* parity/framing/overrun... */\n#define\tCD1400_COR4_PFO_NUL\t\t(3<<0)\n#define\tCD1400_COR4_PFO_DISCARD\t\t(2<<0)\n#define\tCD1400_COR4_PFO_GOOD\t\t(1<<0)\n#define\tCD1400_COR4_PFO_EXCEPTION\t(0<<0)\n#define\tCD1400_COR5\t\t0x1F\t/* channel option 5 */\n#define\tCD1400_COR5_ISTRIP\t\t(1<<7)\n#define\tCD1400_COR5_LNEXT\t\t(1<<6)\n#define\tCD1400_COR5_CMOE\t\t(1<<5)\t/* char matching on error */\n#define\tCD1400_COR5_EBD\t\t\t(1<<2)\t/* end of break detected */\n#define\tCD1400_COR5_ONLCR\t\t(1<<1)\n#define\tCD1400_COR5_OCRNL\t\t(1<<0)\n#define\tCD1400_CCSR\t\t0x0B\t/* channel control status */\n#define\tCD1400_RDCR\t\t0x0E\t/* received data count */\n#define\tCD1400_SCHR1\t\t0x1A\t/* special character 1 */\n#define\tCD1400_SCHR2\t\t0x1B\t/* special character 2 */\n#define\tCD1400_SCHR3\t\t0x1C\t/* special character 3 */\n#define\tCD1400_SCHR4\t\t0x1D\t/* special character 4 */\n#define\tCD1400_SCRL\t\t0x22\t/* special character range, low */\n#define\tCD1400_SCRH\t\t0x23\t/* special character range, high */\n#define\tCD1400_LNC\t\t0x24\t/* lnext character */\n#define\tCD1400_MCOR1\t\t0x15\t/* modem change option 1 */\n#define\tCD1400_MCOR1_DSRzd\t\t(1<<7)\t/* DSR one-to-zero delta */\n#define\tCD1400_MCOR1_CTSzd\t\t(1<<6)\n#define\tCD1400_MCOR1_RIzd\t\t(1<<5)\n#define\tCD1400_MCOR1_CDzd\t\t(1<<4)\n#define\tCD1400_MCOR1_DTRth\t\t(15<<0)\t/* dtrflow threshold */\n#define\tCD1400_MCOR2\t\t0x16\t/* modem change option 2 */\n#define\tCD1400_MCOR2_DSRod\t\t(1<<7)\t/* DSR zero-to-one delta */\n#define\tCD1400_MCOR2_CTSod\t\t(1<<6)\n#define\tCD1400_MCOR2_RIod\t\t(1<<5)\n#define\tCD1400_MCOR2_CDod\t\t(1<<4)\n#define\tCD1400_RTPR\t\t0x21\t/* receive timeout period */\n#define\tCD1400_MSVR1\t\t0x6C\t/* modem signal value 1 */\n#define\tCD1400_MSVR1_RTS\t\t(1<<0)\t/* RTS line (r/w) */\n#define\tCD1400_MSVR2\t\t0x6D\t/* modem signal value 2 */\n#define\tCD1400_MSVR2_DSR\t\t(1<<7)\t/* !DSR line (r) */\n#define\tCD1400_MSVR2_CTS\t\t(1<<6)\t/* !CTS line (r) */\n#define\tCD1400_MSVR2_RI\t\t\t(1<<5)\t/* !RI line (r) */\n#define\tCD1400_MSVR2_CD\t\t\t(1<<4)\t/* !CD line (r) */\n#define\tCD1400_MSVR2_DTR\t\t(1<<1)\t/* DTR line (r/w) */\n#define\tCD1400_PSVR\t\t0x6F\t/* printer signal value */\n#define\tCD1400_RBPR\t\t0x78\t/* receive baud rate period */\n#define\tCD1400_RCOR\t\t0x7C\t/* receive clock option */\n#define\tCD1400_TBPR\t\t0x72\t/* transmit baud rate period */\n#define\tCD1400_TCOR\t\t0x76\t/* transmit clock option */\n"
  },
  {
    "path": "freebsd-headers/dev/ic/cd180.h",
    "content": "/*-\n * Copyright (C) 1995 by Pavel Antonov, Moscow, Russia.\n * Copyright (C) 1995 by Andrey A. Chernov, Moscow, Russia.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/dev/ic/cd180.h 139749 2005-01-06 01:43:34Z imp $\n */\n\n/*\n * Cirrus Logic CD180 registers\n */\n\n/* Global registers */\n#define CD180_GIVR      0x40    /* Global Interrupt Verctor Register      */\n#define CD180_GICR      0x41    /* Global Interrupting Channel Register   */\n#define CD180_PILR1     0x61    /* Priority Interrupt Level Register 1    */\n#define CD180_PILR2     0x62    /* Priority Interrupt Level Register 2    */\n#define CD180_PILR3     0x63    /* Priority Interrupt Level Register 3    */\n#define CD180_CAR       0x64    /* Channel Access Register                */\n#define CD180_GFRCR     0x6B    /* Global Firmware Revision Code Register */\n#define CD180_PPRH      0x70    /* Prescaler Period Register MSB          */\n#define CD180_PPRL      0x71    /* Prescaler Period Register LSB          */\n#define CD180_RDR       0x78    /* Receiver Data Register                 */\n#define CD180_RCSR      0x7A    /* Receiver Character Status Register     */\n#define CD180_TDR       0x7B    /* Transmit Data Register                 */\n#define CD180_EOIR      0x7F    /* End of Interrupt Register              */\n\n/* Channel Registers */\n#define CD180_CCR       0x01    /* Channel Command Register               */\n#define CD180_IER       0x02    /* Interrupt Enable Register              */\n#define CD180_COR1      0x03    /* Channel Option Register 1              */\n#define CD180_COR2      0x04    /* Channel Option Register 1              */\n#define CD180_COR3      0x05    /* Channel Option Register 1              */\n#define CD180_CCSR      0x06    /* Channel Control STatus Register        */\n#define CD180_RDCR      0x07    /* Receive Data Count Register            */\n#define CD180_SCHR1     0x09    /* Special Character Register 1           */\n#define CD180_SCHR2     0x0A    /* Special Character Register 2           */\n#define CD180_SCHR3     0x0B    /* Special Character Register 3           */\n#define CD180_SCHR4     0x0C    /* Special Character Register 4           */\n#define CD180_MCOR1     0x10    /* Modem Change Option 1 Register         */\n#define CD180_MCOR2     0x11    /* Modem Change Option 2 Register         */\n#define CD180_MCR       0x12    /* Modem Change Register                  */\n#define CD180_RTPR      0x18    /* Receive Timeout Period Register        */\n#define CD180_MSVR      0x28    /* Modem Signal Value Register            */\n#define CD180_RBPRH     0x31    /* Receive Baud Rate Period Register MSB  */\n#define CD180_RBPRL     0x32    /* Receive Baud Rate Period Register LSB  */\n#define CD180_TBPRH     0x39    /* Transmit Baud Rate Period Register MSB */\n#define CD180_TBPRL     0x3A    /* Transmit Baud Rate Period Register LSB */\n\n/** Register descritpions **/\n\n/* Global Interrupt Vector Register */\n#define GIVR_IT_MSCI    0x01    /* Modem Signal Change Interrupt          */\n#define GIVR_IT_TDI     0x02    /* Transmit Data Interrupt                */\n#define GIVR_IT_RGDI    0x03    /* Receive Good Data Interrupt            */\n#define GIVR_IT_REI     0x07    /* Receive Exception Interrupt            */\n\n/* Global Interrupt Channel Register */\n#define GICR_CHAN       0x1C    /* Channel Number Mask                    */\n#define GICR_LSH        2       /* Channel Number Shift                   */\n\n/* Channel Address Register */\n#define CAR_CHAN        0x07    /* Channel Number Mask                    */\n#define CAR_A7          0x08    /* Addres bit 7 (unused)                  */\n\n/* Receive Character Status Register */\n#define RCSR_OE         0x01    /* Overrun Error                          */\n#define RCSR_FE         0x02    /* Frame Error                            */\n#define RCSR_PE         0x04    /* Parity Error                           */\n#define RCSR_Break      0x08    /* Break detected                         */\n#define RCSR_Timeout    0x80    /* Rx Timeout                             */\n#define RCSR_SCMASK     0x70    /* Special Character Detected Mask        */\n#define RCSR_SC1        0x10    /* Special Char 1 (or 1 & 3 seq matched)  */\n#define RCSR_SC2        0x20    /* Special Char 2 (or 2 & 4 seq matched)  */\n#define RCSR_SC3        0x30    /* Special Char 3                         */\n#define RCSR_SC4        0x40    /* Special Char 4                         */\n\n/* Channel Command Register */\n#define CCR_ResetChan   0x80    /* Reset Channel                          */\n#define CCR_HWRESET     0x81    /* Hardware Reset (all channels)          */\n#define CCR_CORCHG1     0x42    /* Channel Option Register 1 Changed      */\n#define CCR_CORCHG2     0x44    /* Channel Option Register 2 Changed      */\n#define CCR_CORCHG3     0x48    /* Channel Option Register 3 Changed      */\n#define CCR_SENDSPCH1   0x21    /* Send Special Character 1               */\n#define CCR_SENDSPCH2   0x22    /* Send Special Character 2               */\n#define CCR_SENDSPCH3   0x23    /* Send Special Character 3               */\n#define CCR_SENDSPCH4   0x24    /* Send Special Character 4               */\n#define CCR_RCVRDIS     0x11    /* Receiver Disable                       */\n#define CCR_RCVREN      0x12    /* Receiver Enable                        */\n#define CCR_XMTRDIS     0x14    /* Transmitter Disable                    */\n#define CCR_XMTREN      0x18    /* Transmitter Enable                     */\n\n/* Interrupt Enable Register */\n#define IER_DSR         0x80    /* Enable interrupt on DSR change         */\n#define IER_CD          0x40    /* Enable interrupt on CD change          */\n#define IER_CTS         0x20    /* Enable interrupt on CTS change         */\n#define IER_RxData      0x10    /* Enable interrupt on Receive Data       */\n#define IER_RxSC        0x08    /* Enable interrupt on Receive Spec. Char */\n#define IER_TxRdy       0x04    /* Enable interrupt on TX FIFO empty      */\n#define IER_TxMpty      0x02    /* Enable interrupt on TX completely empty*/\n#define IER_RET         0x01    /* Enable interrupt on RX Except. Timeout */\n\n/* Channel Option Register 1 */\n#define COR1_ODDP       0x80    /* Odd Parity                             */\n#define COR1_ParMMASK   0x60    /* Parity Mode mask                       */\n#define COR1_NOPAR      0x02    /* No Parity                              */\n#define COR1_FORCEPAR   0x20    /* Force Parity                           */\n#define COR1_NORMPAR    0x40    /* Normal Parity                          */\n#define COR1_Ignore     0x10    /* Ignore Parity on RX                    */\n#define COR1_StopMASK   0x0C    /* Stop Bits mode mask                    */\n#define COR1_1SB        0x00    /* 1 Stop Bit                             */\n#define COR1_15SB       0x04    /* 1.5 Stop Bits                          */\n#define COR1_2SB        0x08    /* 2 Stop Bits                            */\n#define COR1_CHLMASK    0x03    /* Character Length mask                  */\n#define COR1_5BITS      0x00    /* 5 bits                                 */\n#define COR1_6BITS      0x01    /* 6 bits                                 */\n#define COR1_7BITS      0x02    /* 7 bits                                 */\n#define COR1_8BITS      0x03    /* 8 bits                                 */\n\n/* Channel Option Register 2 */\n#define COR2_IXM        0x80    /* Implied XON mode                       */\n#define COR2_TxIBE      0x40    /* Enable In-Band XON/XOFF Flow Control   */\n#define COR2_ETC        0x20    /* Embedded Tx Commands Enable            */\n#define COR2_LLM        0x10    /* Local Loopback Mode                    */\n#define COR2_RLM        0x08    /* Remote Loopback Mode                   */\n#define COR2_RtsAO      0x04    /* RTS Automatic Output Enable            */\n#define COR2_CtsAE      0x02    /* CTS Automatic Enable                   */\n#define COR2_DsrAE      0x01    /* DSR Automatic Enable                   */\n\n/* Channel Option Register 3 */\n#define COR3_XonCH      0x80    /* XON is a double seq (1 & 3)            */\n#define COR3_XoffCH     0x40    /* XOFF is a double seq (1 & 3)           */\n#define COR3_FCT        0x20    /* Flow-Control Transparency Mode         */\n#define COR3_SCDE       0x10    /* Special Character Detection Enable     */\n#define COR3_RxTHMASK   0x0F    /* RX FIFO Threshold value (1-8)          */\n\n/* Channel Control Status Register */\n#define CCSR_RxEn       0x80    /* Revceiver Enabled                      */\n#define CCSR_RxFloff    0x40    /* Receive Flow Off (XOFF sent)           */\n#define CCSR_RxFlon     0x20    /* Receive Flow On (XON sent)             */\n#define CCSR_TxEn       0x08    /* Transmitter Enabled                    */\n#define CCSR_TxFloff    0x04    /* Transmit Flow Off (got XOFF)           */\n#define CCSR_TxFlon     0x02    /* Transmit Flow On (got XON)             */\n\n/* Modem Change Option Register 1 */\n#define MCOR1_DSRzd     0x80    /* Detect 0->1 transition of DSR          */\n#define MCOR1_CDzd      0x40    /* Detect 0->1 transition of CD           */\n#define MCOR1_CTSzd     0x20    /* Detect 0->1 transition of CTS          */\n#define MCOR1_DTRthMASK 0x0F    /* Automatic DTR FC Threshold (1-8) chars */\n\n/* Modem Change Option Register 2 */\n#define MCOR2_DSRod     0x80    /* Detect 1->0 transition of DSR          */\n#define MCOR2_CDod      0x40    /* Detect 1->0 transition of CD           */\n#define MCOR2_CTSod     0x20    /* Detect 1->0 transition of CTS          */\n\n/* Modem Change Register */\n#define MCR_DSRchg      0x80    /* DSR Changed                            */\n#define MCR_CDchg       0x40    /* CD  Changed                            */\n#define MCR_CTSchg      0x20    /* CTS Changed                            */\n\n/* Modem Signal Value Register */\n#define MSVR_DSR        0x80    /* Current state of DSR input             */\n#define MSVR_CD         0x40    /* Current state of DSR input             */\n#define MSVR_CTS        0x20    /* Current state of CTS input             */\n#define MSVR_DTR        0x02    /* Current state of DTR output            */\n#define MSVR_RTS        0x01    /* Current state of RTS output            */\n\n/* Escape characters */\n#define CD180_C_ESC     0x00    /* Escape character                       */\n#define CD180_C_SBRK    0x81    /* Start sending BREAK                    */\n#define CD180_C_DELAY   0x82    /* Delay output                           */\n#define CD180_C_EBRK    0x83    /* Stop sending BREAK                     */\n\n/* Miscellaneous */\n#define CD180_NCHAN     8       /* 8 channels per chip                    */\n#define CD180_CTICKS    16      /* 16 ticks for character processing      */\n#define CD180_NFIFO     8       /* 8 bytes in FIFO                        */\n"
  },
  {
    "path": "freebsd-headers/dev/ic/esp.h",
    "content": "/*-\n * Copyright (c) 1995 Sean Eric Fagan.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. Neither the name of the author nor the names of contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/dev/ic/esp.h 77961 2001-06-10 04:20:37Z nyan $\n */\n\n#ifndef _IC_ESP_H_\n#define\t_IC_ESP_H_\n\n/*\n * Definitions for Hayes ESP serial cards.\n */\n\n/*\n * CMD1 and CMD2 are the command ports, offsets from <esp_iobase>.\n */\n#define\tESP_CMD1\t4\n#define\tESP_CMD2\t5\n\n/*\n * STAT1 and STAT2 are to get return values and status bytes;\n * they overload CMD1 and CMD2.\n */\n#define\tESP_STATUS1\tESP_CMD1\n#define\tESP_STATUS2\tESP_CMD2\n\n/*\n * Commands.  Commands are given by writing the command value to\n * ESP_CMD1 and then writing or reading some number of bytes from\n * ESP_CMD2 or ESP_STATUS2.\n */\n#define\tESP_GETTEST\t0x01\t/* self-test command (1 byte + extras) */\n#define\tESP_GETDIPS\t0x02\t/* get on-board DIP switches (1 byte) */\n#define\tESP_SETFLOWTYPE\t0x08\t/* set type of flow-control (2 bytes) */\n#define\tESP_SETRXFLOW\t0x0a\t/* set Rx FIFO flow control levels (4 bytes) */\n#define\tESP_SETMODE\t0x10\t/* set board mode (1 byte) */\n#define\tESP_SETCLOCK\t0x23\t/* set UART clock prescaler */\n\n/* Mode bits (ESP_SETMODE). */\n#define\tESP_MODE_FIFO\t0x02\t/* act like a 16550 (compatibility mode) */\n#define\tESP_MODE_RTS\t0x04\t/* use RTS hardware flow control */\n#define\tESP_MODE_SCALE\t0x80\t/* scale FIFO trigger levels */\n\n/* Flow control type bits (ESP_SETFLOWTYPE). */\n#define\tESP_FLOW_RTS\t0x04\t/* cmd1: local Rx sends RTS flow control */\n#define\tESP_FLOW_CTS\t0x10\t/* cmd2: local transmitter responds to CTS */\n\n/* Used by ESP_SETRXFLOW. */\n#define\tHIBYTE(w)\t(((w) >> 8) & 0xff)\n#define\tLOBYTE(w)\t((w) & 0xff)\n\n#endif /* !_IC_ESP_H_ */\n"
  },
  {
    "path": "freebsd-headers/dev/ic/hd64570.h",
    "content": "/*-\n * Copyright (c) 1995 John Hay.  All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. All advertising materials mentioning features or use of this software\n *    must display the following acknowledgement:\n *\tThis product includes software developed by [your name]\n *\tand [any other names deserving credit ]\n * 4. Neither the name of the author nor the names of any co-contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY [your name] AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/dev/ic/hd64570.h 139749 2005-01-06 01:43:34Z imp $\n */\n#ifndef _HD64570_H_\n#define _HD64570_H_\n\ntypedef struct msci_channel\n  {\n  union\n    {\n    unsigned short us_trb;    /* rw */\n    struct\n      {\n      unsigned char uc_trbl;\n      unsigned char uc_trbh;\n      }uc_trb;\n    }u_trb;\n  unsigned char st0;          /* ro */\n  unsigned char st1;          /* rw */\n  unsigned char st2;          /* rw */\n  unsigned char st3;          /* ro */\n  unsigned char fst;          /* rw */\n  unsigned char unused0;\n  unsigned char ie0;          /* rw */\n  unsigned char ie1;          /* rw */\n  unsigned char ie2;          /* rw */\n  unsigned char fie;          /* rw */\n  unsigned char cmd;          /* wo */\n  unsigned char unused1;\n  unsigned char md0;          /* rw */\n  unsigned char md1;          /* rw */\n  unsigned char md2;          /* rw */\n  unsigned char ctl;          /* rw */\n  unsigned char sa0;          /* rw */\n  unsigned char sa1;          /* rw */\n  unsigned char idl;          /* rw */\n  unsigned char tmc;          /* rw */\n  unsigned char rxs;          /* rw */\n  unsigned char txs;          /* rw */\n  unsigned char trc0;         /* rw */\n  unsigned char trc1;         /* rw */\n  unsigned char rrc;          /* rw */\n  unsigned char unused2;\n  unsigned char cst0;         /* rw */\n  unsigned char cst1;         /* rw */\n  unsigned char unused3[2];\n  }msci_channel;\n\n#define trb     u_trb.us_trb\n#define trbl    u_trb.uc_trb.uc_trbl\n#define trbh    u_trb.uc_trb.uc_trbh\n\ntypedef struct timer_channel\n  {\n  unsigned short tcnt;        /* rw */\n  unsigned short tconr;       /* wo */\n  unsigned char tcsr;         /* rw */\n  unsigned char tepr;         /* rw */\n  unsigned char unused[2];\n  }timer_channel;\n\ntypedef struct dmac_channel\n  {\n  unsigned short dar;         /* rw */\n  unsigned char darb;         /* rw */\n  unsigned char unused0;\n  unsigned short sar;         /* rw On odd numbered dmacs (tx) only */\n  unsigned char sarb;         /* rw */\n#define cpb sarb\n  unsigned char unused1;\n  unsigned short cda;         /* rw */\n  unsigned short eda;         /* rw */\n  unsigned short bfl;         /* rw On even numbered dmacs (rx) only */\n  unsigned short bcr;         /* rw */\n  unsigned char dsr;          /* rw */\n  unsigned char dmr;          /* rw */\n  unsigned char unused2;\n  unsigned char fct;          /* rw */\n  unsigned char dir;          /* rw */\n  unsigned char dcr;          /* rw */\n  unsigned char unused3[10];\n  }dmac_channel;\n\n/* x is the channel number. rx channels are even numbered and tx, odd. */\n#define DMAC_RXCH(x)            ((x*2) + 0)\n#define DMAC_TXCH(x)            ((x*2) + 1)\n\ntypedef struct sca_regs\n  {\n  unsigned char lpr;          /* rw */\n  unsigned char unused0;      /* -- */\n  /* Wait system */\n  unsigned char pabr0;        /* rw */\n  unsigned char pabr1;        /* rw */\n  unsigned char wcrl;         /* rw */\n  unsigned char wcrm;         /* rw */\n  unsigned char wcrh;         /* rw */\n  unsigned char unused1;\n  /* DMAC */\n  unsigned char pcr;          /* rw */\n  unsigned char dmer;         /* rw */\n  unsigned char unused2[6];\n  /* Interrupt */\n  unsigned char isr0;          /* ro */\n  unsigned char isr1;          /* ro */\n  unsigned char isr2;          /* ro */\n  unsigned char unused3;\n  unsigned char ier0;          /* rw */\n  unsigned char ier1;          /* rw */\n  unsigned char ier2;          /* rw */\n  unsigned char unused4;\n  unsigned char itcr;          /* rw */\n  unsigned char unused5;\n  unsigned char ivr;           /* rw */\n  unsigned char unused6;\n  unsigned char imvr;          /* rw */\n  unsigned char unused7[3];\n  /* MSCI Channel 0 */\n  msci_channel  msci[2];\n  timer_channel timer[4];\n  dmac_channel  dmac[4];\n  }sca_regs;\n\n#define SCA_CMD_TXRESET         0x01\n#define SCA_CMD_TXENABLE        0x02\n#define SCA_CMD_TXDISABLE       0x03\n#define SCA_CMD_TXCRCINIT       0x04\n#define SCA_CMD_TXCRCEXCL       0x05\n#define SCA_CMS_TXEOM           0x06\n#define SCA_CMD_TXABORT         0x07\n#define SCA_CMD_MPON            0x08\n#define SCA_CMD_TXBCLEAR        0x09\n\n#define SCA_CMD_RXRESET         0x11\n#define SCA_CMD_RXENABLE        0x12\n#define SCA_CMD_RXDISABLE       0x13\n#define SCA_CMD_RXCRCINIT       0x14\n#define SCA_CMD_RXMSGREJ        0x15\n#define SCA_CMD_MPSEARCH        0x16\n#define SCA_CMD_RXCRCEXCL       0x17\n#define SCA_CMD_RXCRCCALC       0x18\n\n#define SCA_CMD_NOP             0x00\n#define SCA_CMD_RESET           0x21\n#define SCA_CMD_SEARCH          0x31\n\n#define SCA_MD0_CRC_1           0x01\n#define SCA_MD0_CRC_CCITT       0x02\n#define SCA_MD0_CRC_ENABLE      0x04\n#define SCA_MD0_AUTO_ENABLE     0x10\n#define SCA_MD0_MODE_ASYNC      0x00\n#define SCA_MD0_MODE_BYTESYNC1  0x20\n#define SCA_MD0_MODE_BISYNC     0x40\n#define SCA_MD0_MODE_BYTESYNC2  0x60\n#define SCA_MD0_MODE_HDLC       0x80\n\n#define SCA_MD1_NOADDRCHK       0x00\n#define SCA_MD1_SNGLADDR1       0x40\n#define SCA_MD1_SNGLADDR2       0x80\n#define SCA_MD1_DUALADDR        0xC0\n\n#define SCA_MD2_DUPLEX          0x00\n#define SCA_MD2_ECHO            0x01\n#define SCA_MD2_LOOPBACK        0x03\n#define SCA_MD2_ADPLLx8         0x00\n#define SCA_MD2_ADPLLx16        0x08\n#define SCA_MD2_ADPLLx32        0x10\n#define SCA_MD2_NRZ             0x00\n#define SCA_MD2_NRZI            0x20\n#define SCA_MD2_MANCHESTER      0x80\n#define SCA_MD2_FM0             0xC0\n#define SCA_MD2_FM1             0xA0\n\n#define SCA_CTL_RTS             0x01\n#define SCA_CTL_IDLPAT          0x10\n#define SCA_CTL_UDRNC           0x20\n\n#define SCA_RXS_DIV_MASK        0x0F\n#define SCA_RXS_DIV1            0x00\n#define SCA_RXS_DIV2            0x01\n#define SCA_RXS_DIV4            0x02\n#define SCA_RXS_DIV8            0x03\n#define SCA_RXS_DIV16           0x04\n#define SCA_RXS_DIV32           0x05\n#define SCA_RXS_DIV64           0x06\n#define SCA_RXS_DIV128          0x07\n#define SCA_RXS_DIV256          0x08\n#define SCA_RXS_DIV512          0x09\n#define SCA_RXS_CLK_RXC0        0x00\n#define SCA_RXS_CLK_RXC1        0x20\n#define SCA_RXS_CLK_INT         0x40\n#define SCA_RXS_CLK_ADPLL_OUT   0x60\n#define SCA_RXS_CLK_ADPLL_IN    0x70\n\n#define SCA_TXS_DIV_MASK        0x0F\n#define SCA_TXS_DIV1            0x00\n#define SCA_TXS_DIV2            0x01\n#define SCA_TXS_DIV4            0x02\n#define SCA_TXS_DIV8            0x03\n#define SCA_TXS_DIV16           0x04\n#define SCA_TXS_DIV32           0x05\n#define SCA_TXS_DIV64           0x06\n#define SCA_TXS_DIV128          0x07\n#define SCA_TXS_DIV256          0x08\n#define SCA_TXS_DIV512          0x09\n#define SCA_TXS_CLK_TXC         0x00\n#define SCA_TXS_CLK_INT         0x40\n#define SCA_TXS_CLK_RX          0x60\n\n#define SCA_ST0_RXRDY           0x01\n#define SCA_ST0_TXRDY           0x02\n#define SCA_ST0_RXINT           0x40\n#define SCA_ST0_TXINT           0x80\n\n#define SCA_ST1_IDLST           0x01\n#define SCA_ST1_ABTST           0x02\n#define SCA_ST1_DCDCHG          0x04\n#define SCA_ST1_CTSCHG          0x08\n#define SCA_ST1_FLAG            0x10\n#define SCA_ST1_TXIDL           0x40\n#define SCA_ST1_UDRN            0x80\n\n/* ST2 and FST look the same */\n#define SCA_FST_CRCERR          0x04\n#define SCA_FST_OVRN            0x08\n#define SCA_FST_RESFRM          0x10\n#define SCA_FST_ABRT            0x20\n#define SCA_FST_SHRT            0x40\n#define SCA_FST_EOM             0x80\n\n#define SCA_ST3_RXENA           0x01\n#define SCA_ST3_TXENA           0x02\n#define SCA_ST3_DCD             0x04\n#define SCA_ST3_CTS             0x08\n#define SCA_ST3_ADPLLSRCH       0x10\n#define SCA_ST3_TXDATA          0x20\n\n#define SCA_FIE_EOMFE           0x80\n\n#define SCA_IE0_RXRDY           0x01\n#define SCA_IE0_TXRDY           0x02\n#define SCA_IE0_RXINT           0x40\n#define SCA_IE0_TXINT           0x80\n\n#define SCA_IE1_IDLDE           0x01\n#define SCA_IE1_ABTDE           0x02\n#define SCA_IE1_DCD             0x04\n#define SCA_IE1_CTS             0x08\n#define SCA_IE1_FLAG            0x10\n#define SCA_IE1_IDL             0x40\n#define SCA_IE1_UDRN            0x80\n\n#define SCA_IE2_CRCERR          0x04\n#define SCA_IE2_OVRN            0x08\n#define SCA_IE2_RESFRM          0x10\n#define SCA_IE2_ABRT            0x20\n#define SCA_IE2_SHRT            0x40\n#define SCA_IE2_EOM             0x80\n\n/* This is for RRC, TRC0 and TRC1. */\n#define SCA_RCR_MASK            0x1F\n\n#define SCA_IE1_\n\n#define SCA_IV_CHAN0            0x00\n#define SCA_IV_CHAN1            0x20\n\n#define SCA_IV_RXRDY            0x04\n#define SCA_IV_TXRDY            0x06\n#define SCA_IV_RXINT            0x08\n#define SCA_IV_TXINT            0x0A\n\n#define SCA_IV_DMACH0           0x00\n#define SCA_IV_DMACH1           0x08\n#define SCA_IV_DMACH2           0x20\n#define SCA_IV_DMACH3           0x28\n\n#define SCA_IV_DMIA             0x14\n#define SCA_IV_DMIB             0x16\n\n#define SCA_IV_TIMER0           0x1C\n#define SCA_IV_TIMER1           0x1E\n#define SCA_IV_TIMER2           0x3C\n#define SCA_IV_TIMER3           0x3E\n\n/*\n * DMA registers\n */\n#define SCA_DSR_EOT             0x80\n#define SCA_DSR_EOM             0x40\n#define SCA_DSR_BOF             0x20\n#define SCA_DSR_COF             0x10\n#define SCA_DSR_DE              0x02\n#define SCA_DSR_DWE             0x01\n\n#define SCA_DMR_TMOD            0x10\n#define SCA_DMR_NF              0x04\n#define SCA_DMR_CNTE            0x02\n\n#define SCA_DMER_EN             0x80\n\n#define SCA_DCR_ABRT            0x01\n#define SCA_DCR_FCCLR           0x02  /* Clear frame end intr counter */\n\n#define SCA_DIR_EOT             0x80\n#define SCA_DIR_EOM             0x40\n#define SCA_DIR_BOF             0x20\n#define SCA_DIR_COF             0x10\n\n#define SCA_PCR_BRC             0x10\n#define SCA_PCR_CCC             0x08\n#define SCA_PCR_PR2             0x04\n#define SCA_PCR_PR1             0x02\n#define SCA_PCR_PR0             0x01\n\ntypedef struct sca_descriptor\n  {\n  unsigned short cp;\n  unsigned short bp;\n  unsigned char  bpb;\n  unsigned char  unused0;\n  unsigned short len;\n  unsigned char  stat;\n  unsigned char  unused1;\n  }sca_descriptor;\n\n#define SCA_DESC_EOT            0x01\n#define SCA_DESC_CRC            0x04\n#define SCA_DESC_OVRN           0x08\n#define SCA_DESC_RESD           0x10\n#define SCA_DESC_ABORT          0x20\n#define SCA_DESC_SHRTFRM        0x40\n#define SCA_DESC_EOM            0x80\n#define SCA_DESC_ERRORS         0x7C\n\n/*\n***************************************************************************\n**                                 END\n***************************************************************************\n**/\n#endif /* _HD64570_H_ */\n\n"
  },
  {
    "path": "freebsd-headers/dev/ic/i8237.h",
    "content": "/*\n * Intel 8237 DMA Controller\n *\n * $FreeBSD: release/9.0.0/sys/dev/ic/i8237.h 146214 2005-05-14 10:14:56Z nyan $\n */\n\n#define\tDMA37MD_SINGLE\t0x40\t/* single pass mode */\n#define\tDMA37MD_CASCADE\t0xc0\t/* cascade mode */\n#define\tDMA37MD_AUTO\t0x50\t/* autoinitialise single pass mode */\n#define\tDMA37MD_WRITE\t0x04\t/* read the device, write memory operation */\n#define\tDMA37MD_READ\t0x08\t/* write the device, read memory operation */\n"
  },
  {
    "path": "freebsd-headers/dev/ic/i8251.h",
    "content": "/*-\n * Copyright (c) 1991 The Regents of the University of California.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 4. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/dev/ic/i8251.h 182835 2008-09-07 04:35:04Z nyan $\n */\n\n/*\n * modified for PC9801 by M.Ishii \n *\t\t\tKyoto University Microcomputer Club (KMC)\n *\n * modified for 8251(FIFO) by Seigo TANIMURA <tanimura@FreeBSD.org>\n */\n\n/* i8251 mode register */\n#define\tMOD8251_5BITS\t0x00\n#define\tMOD8251_6BITS\t0x04\n#define\tMOD8251_7BITS\t0x08\n#define\tMOD8251_8BITS\t0x0c\n#define\tMOD8251_PENAB\t0x10\t/* parity enable */\n#define\tMOD8251_PEVEN\t0x20\t/* parity even */\n#define\tMOD8251_STOP1\t0x40\t/* 1 stop bit */\n#define\tMOD8251_STOP15\t0x80\t/* 1.5 stop bit */\n#define\tMOD8251_STOP2\t0xc0\t/* 2 stop bit */\n#define\tMOD8251_CLKx1\t0x01\t/* x1 */\n#define\tMOD8251_CLKx16\t0x02\t/* x16 */\n#define\tMOD8251_CLKx64\t0x03\t/* x64 */\n\n/* i8251 command register */\n#define\tCMD8251_TxEN\t0x01\t/* transmit enable */\n#define\tCMD8251_DTR\t0x02\t/* assert DTR */\n#define\tCMD8251_RxEN\t0x04\t/* receive enable */\n#define\tCMD8251_SBRK\t0x08\t/* send break */\n#define\tCMD8251_ER\t0x10\t/* error reset */\n#define\tCMD8251_RTS\t0x20\t/* assert RTS */\n#define\tCMD8251_RESET\t0x40\t/* internal reset */\n#define\tCMD8251_EH\t0x80\t/* enter hunt mode */\n\n/* i8251 status register */\n#define\tSTS8251_TxRDY\t0x01\t/* transmit READY */\n#define\tSTS8251_RxRDY\t0x02\t/* data exists in receive buffer */\n#define\tSTS8251_TxEMP\t0x04\t/* transmit buffer EMPTY */\n#define\tSTS8251_PE\t0x08\t/* perity error */\n#define\tSTS8251_OE\t0x10\t/* overrun error */\n#define\tSTS8251_FE\t0x20\t/* framing error */\n#define\tSTS8251_BI\t0x40\t/* break detect */\n#define\tSTS8251_DSR\t0x80\t/* DSR is asserted */\n\n/* i8251F line status register */\n#define\tFLSR_TxEMP\t0x01\t/* transmit buffer EMPTY */\n#define\tFLSR_TxRDY\t0x02\t/* transmit READY */\n#define\tFLSR_RxRDY\t0x04\t/* data exists in receive buffer */\n#define\tFLSR_OE\t\t0x10\t/* overrun error */\n#define\tFLSR_PE\t\t0x20\t/* perity error */\n#define\tFLSR_BI\t\t0x80\t/* break detect */\n\n/* i8251F modem status register */\n#define\tMSR_DCD\t\t0x80\t/* Current Data Carrier Detect */\n#define\tMSR_RI\t\t0x40\t/* Current Ring Indicator */\n#define\tMSR_DSR\t\t0x20\t/* Current Data Set Ready */\n#define\tMSR_CTS\t\t0x10\t/* Current Clear to Send */\n#define\tMSR_DDCD\t0x08\t/* DCD has changed state */\n#define\tMSR_TERI\t0x04\t/* RI has toggled low to high */\n#define\tMSR_DDSR\t0x02\t/* DSR has changed state */\n#define\tMSR_DCTS\t0x01\t/* CTS has changed state */\n\n/* i8251F interrupt identification register */\n#define\tIIR_FIFO_CK1\t0x40\n#define\tIIR_FIFO_CK2\t0x20\n#define\tIIR_IMASK\t0x0f\n#define\tIIR_RXTOUT\t0x0c\t/* Receiver timeout */\n#define\tIIR_RLS\t\t0x06\t/* Line status change */\n#define\tIIR_RXRDY\t0x04\t/* Receiver ready */\n#define\tIIR_TXRDY\t0x02\t/* Transmitter ready */\n#define\tIIR_NOPEND\t0x01\t/* Transmitter ready */\n#define\tIIR_MLSC\t0x00\t/* Modem status */\n\n/* i8251F fifo control register */\n#define\tFIFO_ENABLE\t0x01\t/* Turn the FIFO on */\n#define\tFIFO_RCV_RST\t0x02\t/* Reset RX FIFO */\n#define\tFIFO_XMT_RST\t0x04\t/* Reset TX FIFO */\n#define\tFIFO_LSR_EN\t0x08\n#define\tFIFO_MSR_EN\t0x10\n#define\tFIFO_TRIGGER_1\t0x00\t/* Trigger RXRDY intr on 1 character */\n#define\tFIFO_TRIGGER_4\t0x40\t/* ibid 4 */\n#define\tFIFO_TRIGGER_8\t0x80\t/* ibid 8 */\n#define\tFIFO_TRIGGER_14\t0xc0\t/* ibid 14 */\n"
  },
  {
    "path": "freebsd-headers/dev/ic/i8253reg.h",
    "content": "/*-\n * Copyright (c) 1993 The Regents of the University of California.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 4. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\tfrom: Header: timerreg.h,v 1.2 93/02/28 15:08:58 mccanne Exp\n * $FreeBSD: release/9.0.0/sys/dev/ic/i8253reg.h 146215 2005-05-14 10:26:31Z nyan $\n */\n\n/*\n * Register definitions for the Intel 8253 Programmable Interval Timer.\n *\n * This chip has three independent 16-bit down counters that can be\n * read on the fly.  There are three mode registers and three countdown\n * registers.  The countdown registers are addressed directly, via the\n * first three I/O ports.  The three mode registers are accessed via\n * the fourth I/O port, with two bits in the mode byte indicating the\n * register.  (Why are hardware interfaces always so braindead?).\n *\n * To write a value into the countdown register, the mode register\n * is first programmed with a command indicating the which byte of\n * the two byte register is to be modified.  The three possibilities\n * are load msb (TMR_MR_MSB), load lsb (TMR_MR_LSB), or load lsb then\n * msb (TMR_MR_BOTH).\n *\n * To read the current value (\"on the fly\") from the countdown register,\n * you write a \"latch\" command into the mode register, then read the stable\n * value from the corresponding I/O port.  For example, you write\n * TMR_MR_LATCH into the corresponding mode register.  Presumably,\n * after doing this, a write operation to the I/O port would result\n * in undefined behavior (but hopefully not fry the chip).\n * Reading in this manner has no side effects.\n */\n\n/*\n * Macros for specifying values to be written into a mode register.\n */\n#define\tTIMER_REG_CNTR0\t0\t/* timer 0 counter port */\n#define\tTIMER_REG_CNTR1\t1\t/* timer 1 counter port */\n#define\tTIMER_REG_CNTR2\t2\t/* timer 2 counter port */\n#define\tTIMER_REG_MODE\t3\t/* timer mode port */\n#define\t\tTIMER_SEL0\t0x00\t/* select counter 0 */\n#define\t\tTIMER_SEL1\t0x40\t/* select counter 1 */\n#define\t\tTIMER_SEL2\t0x80\t/* select counter 2 */\n#define\t\tTIMER_INTTC\t0x00\t/* mode 0, intr on terminal cnt */\n#define\t\tTIMER_ONESHOT\t0x02\t/* mode 1, one shot */\n#define\t\tTIMER_RATEGEN\t0x04\t/* mode 2, rate generator */\n#define\t\tTIMER_SQWAVE\t0x06\t/* mode 3, square wave */\n#define\t\tTIMER_SWSTROBE\t0x08\t/* mode 4, s/w triggered strobe */\n#define\t\tTIMER_HWSTROBE\t0x0a\t/* mode 5, h/w triggered strobe */\n#define\t\tTIMER_LATCH\t0x00\t/* latch counter for reading */\n#define\t\tTIMER_LSB\t0x10\t/* r/w counter LSB */\n#define\t\tTIMER_MSB\t0x20\t/* r/w counter MSB */\n#define\t\tTIMER_16BIT\t0x30\t/* r/w counter 16 bits, LSB first */\n#define\t\tTIMER_BCD\t0x01\t/* count in BCD */\n"
  },
  {
    "path": "freebsd-headers/dev/ic/i8255.h",
    "content": "/*-\n * Copyright (c) 2008 TAKAHASHI Yoshihiro\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/dev/ic/i8255.h 182835 2008-09-07 04:35:04Z nyan $\n */\n\n#ifndef\t_DEV_IC_I8255_H_\n#define\t_DEV_IC_I8255_H_\n\n/*\n * modem status via SYSTM_PORTB\n */\n#define\tCICSCD_CD\t0x20\t/* CD */\n#define\tCICSCD_CS\t0x40\t/* CS */\n#define\tCICSCD_CI\t0x80\t/* CI */\n\n/*\n * control intrline via SYSTM_PORTC \n */\n#define\tIEN_Rx\t\t0x01\n#define\tIEN_TxEMP\t0x02\n#define\tIEN_Tx\t\t0x04\n\n#endif\t/* _DEV_IC_I8255_H_ */\n"
  },
  {
    "path": "freebsd-headers/dev/ic/i82586.h",
    "content": "/*-\n * Copyright (c) 1992, University of Vermont and State Agricultural College.\n * Copyright (c) 1992, Garrett A. Wollman.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. All advertising materials mentioning features or use of this software\n *    must display the following acknowledgement:\n *\tThis product includes software developed by the University of\n *\tVermont and State Agricultural College and Garrett A. Wollman.\n * 4. Neither the name of the University nor the name of the author\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE UNIVERSITY OR AUTHOR BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/dev/ic/i82586.h 112734 2003-03-28 06:27:08Z mdodd $\n */\n\n/*\n * Intel 82586 Ethernet chip\n * Register, bit, and structure definitions.\n *\n * Written by GAW with reference to the Clarkson Packet Driver code for this\n * chip written by Russ Nelson and others.\n */\n\nstruct ie_en_addr {\n\tu_char data[6];\n};\n\n/*\n * This is the master configuration block.  It tells the hardware where all\n * the rest of the stuff is.\n */\nstruct ie_sys_conf_ptr {\n\tu_short mbz;\t\t\t/* must be zero */\n\tu_char ie_bus_use;\t\t/* true if 8-bit only */\n\tu_char mbz2[5];\t\t\t/* must be zero */\n\tcaddr_t ie_iscp_ptr;\t\t/* 24-bit physaddr of ISCP */\n};\n\n/*\n * Note that this is wired in hardware; the SCP is always located here, no\n * matter what.\n */\n#define IE_SCP_ADDR 0xfffff4\n\n/*\n * The tells the hardware where all the rest of the stuff is, too.\n * FIXME: some of these should be re-commented after we figure out their\n * REAL function.\n */\nstruct ie_int_sys_conf_ptr {\n\tu_char ie_busy;\t\t\t/* zeroed after init */\n\tu_char mbz;\n\tu_short ie_scb_offset;\t\t/* 16-bit physaddr of next struct */\n\tcaddr_t ie_base;\t\t/* 24-bit physaddr for all 16-bit vars */\n};\n\n/*\n * This FINALLY tells the hardware what to do and where to put it.\n */\nstruct ie_sys_ctl_block {\n\tu_short ie_status;\t\t/* status word */\n\tu_short ie_command;\t\t/* command word */\n\tu_short ie_command_list;\t/* 16-pointer to command block list */\n\tu_short ie_recv_list;\t\t/* 16-pointer to receive frame list */\n\tu_short ie_err_crc;\t\t/* CRC errors */\n\tu_short ie_err_align;\t\t/* Alignment errors */\n\tu_short ie_err_resource;\t/* Resource errors */\n\tu_short ie_err_overrun;\t\t/* Overrun errors */\n};\n\n/* Command values */\n#define IE_RU_COMMAND\t0x0070\t/* mask for RU command */\n#define IE_RU_NOP\t0\t/* for completeness */\n#define IE_RU_START\t0x0010\t/* start receive unit command */\n#define IE_RU_ENABLE\t0x0020\t/* enable receiver command */\n#define IE_RU_DISABLE\t0x0030\t/* disable receiver command */\n#define IE_RU_ABORT\t0x0040\t/* abort current receive operation */\n\n#define IE_CU_COMMAND\t0x0700\t/* mask for CU command */\n#define IE_CU_NOP\t0\t/* included for completeness */\n#define IE_CU_START\t0x0100\t/* do-command command */\n#define IE_CU_RESUME\t0x0200\t/* resume a suspended cmd list */\n#define IE_CU_STOP\t0x0300\t/* SUSPEND was already taken */\n#define IE_CU_ABORT\t0x0400\t/* abort current command */\n\n#define IE_ACK_COMMAND\t0xf000\t/* mask for ACK command */\n#define IE_ACK_CX\t0x8000\t/* ack IE_ST_DONE */\n#define IE_ACK_FR\t0x4000\t/* ack IE_ST_RECV */\n#define IE_ACK_CNA\t0x2000\t/* ack IE_ST_ALLDONE */\n#define IE_ACK_RNR\t0x1000\t/* ack IE_ST_RNR */\n\n#define IE_ACTION_COMMAND(x) (((x) & IE_CU_COMMAND) == IE_CU_START)\n\t\t\t\t/* is this command an action command? */\n\n/* Status values */\n#define IE_ST_WHENCE\t0xf000\t/* mask for cause of interrupt */\n#define IE_ST_DONE\t0x8000\t/* command with I bit completed */\n#define IE_ST_RECV\t0x4000\t/* frame received */\n#define IE_ST_ALLDONE\t0x2000\t/* all commands completed */\n#define IE_ST_RNR\t0x1000\t/* receive not ready */\n\n#define IE_CU_STATUS\t0x700\t/* mask for command unit status */\n#define IE_CU_ACTIVE\t0x200\t/* command unit is active */\n#define IE_CU_SUSPEND\t0x100\t/* command unit is suspended */\n\n#define IE_RU_STATUS\t0x70\t/* mask for receiver unit status */\n#define IE_RU_SUSPEND\t0x10\t/* receiver is suspended */\n#define IE_RU_NOSPACE\t0x20\t/* receiver has no resources */\n#define IE_RU_READY\t0x40\t/* reveiver is ready */\n\n/*\n * This is filled in partially by the chip, partially by us.\n */\nstruct ie_recv_frame_desc {\n\tu_short ie_fd_status;\t\t/* status for this frame */\n\tu_short ie_fd_last;\t\t/* end of frame list flag */\n\tu_short ie_fd_next;\t\t/* 16-pointer to next RFD */\n\tu_short ie_fd_buf_desc;\t\t/* 16-pointer to list of buffer desc's */\n\tstruct ie_en_addr dest;\t\t/* destination ether */\n\tstruct ie_en_addr src;\t\t/* source ether */\n\tu_short ie_length;\t\t/* 802 length/Ether type */\n\tu_short mbz;\t\t\t/* must be zero */\n};\n\n#define IE_FD_LAST\t0x8000\t/* last rfd in list */\n#define IE_FD_SUSP\t0x4000\t/* suspend RU after receipt */\n\n#define IE_FD_COMPLETE\t0x8000\t/* frame is complete */\n#define IE_FD_BUSY\t0x4000\t/* frame is busy */\n#define IE_FD_OK\t0x2000\t/* frame is bad */\n#define IE_FD_RNR\t0x0200\t/* receiver out of resources here */\n\n/*\n * linked list of buffers...\n */\nstruct ie_recv_buf_desc {\n\tu_short ie_rbd_actual;\t\t/* status for this buffer */\n\tu_short ie_rbd_next;\t\t/* 16-pointer to next RBD */\n\tcaddr_t ie_rbd_buffer;\t\t/* 24-pointer to buffer for this RBD */\n\tu_short ie_rbd_length;\t\t/* length of the buffer */\n\tu_short mbz;\t\t\t/* must be zero */\n};\n\n#define IE_RBD_LAST\t0x8000\t/* last buffer */\n#define IE_RBD_USED\t0x4000\t/* this buffer has data */\n/*\n * All commands share this in common.\n */\nstruct ie_cmd_common {\n\tu_short ie_cmd_status;\t\t/* status of this command */\n\tu_short ie_cmd_cmd;\t\t/* command word */\n\tu_short ie_cmd_link;\t\t/* link to next command */\n};\n\n#define IE_STAT_COMPL\t0x8000\t/* command is completed */\n#define IE_STAT_BUSY\t0x4000\t/* command is running now */\n#define IE_STAT_OK\t0x2000\t/* command completed successfully */\n\n#define IE_CMD_NOP\t0x0000\t/* NOP */\n#define IE_CMD_IASETUP\t0x0001\t/* initial address setup */\n#define IE_CMD_CONFIG\t0x0002\t/* configure command */\n#define IE_CMD_MCAST\t0x0003\t/* multicast setup command */\n#define IE_CMD_XMIT\t0x0004\t/* transmit command */\n#define IE_CMD_TDR\t0x0005\t/* time-domain reflectometer command */\n#define IE_CMD_DUMP\t0x0006\t/* dump command */\n#define IE_CMD_DIAGNOSE\t0x0007\t/* diagnostics command */\n\n#define IE_CMD_LAST\t0x8000\t/* this is the last command in the list */\n#define IE_CMD_SUSPEND\t0x4000\t/* suspend CU after this command */\n#define IE_CMD_INTR\t0x2000\t/* post an interrupt after completion */\n\n/*\n * This is the command to transmit a frame.\n */\nstruct ie_xmit_cmd {\n\tstruct ie_cmd_common com;\t/* common part */\n#define ie_xmit_status com.ie_cmd_status\n\n\tu_short ie_xmit_desc;\t\t/* 16-pointer to buffer descriptor */\n\tstruct ie_en_addr ie_xmit_addr; /* destination address */\n\n\tu_short ie_xmit_length;\t\t/* 802.3 length/Ether type field */\n};\n\n#define IE_XS_MAXCOLL  \t0x000f\t/* number of collisions during transmit */\n#define IE_XS_EXCMAX\t0x0020\t/* exceeded maximum number of collisions */\n#define IE_XS_SQE\t0x0040\t/* SQE positive */\n#define IE_XS_DEFERRED\t0x0080\t/* transmission deferred */\n#define IE_XS_UNDERRUN\t0x0100\t/* DMA underrun */\n#define IE_XS_LOSTCTS\t0x0200\t/* Lost CTS */\n#define IE_XS_NOCARRIER\t0x0400\t/* No Carrier */\n#define IE_XS_LATECOLL\t0x0800\t/* Late collision */\n\n/*\n * This is a buffer descriptor for a frame to be transmitted.\n */\n\nstruct ie_xmit_buf {\n\tu_short ie_xmit_flags;\t\t/* see below */\n\tu_short ie_xmit_next;\t\t/* 16-pointer to next desc. */\n\tcaddr_t ie_xmit_buf;\t\t/* 24-pointer to the actual buffer */\n};\n\n#define IE_XMIT_LAST 0x8000\t/* this TBD is the last one */\n/* The rest of the `flags' word is actually the length. */\n\n/*\n * Multicast setup command.\n */\n\n#define MAXMCAST 50\t\t/* must fit in transmit buffer */\n\nstruct ie_mcast_cmd {\n\tstruct ie_cmd_common com;\t/* common part */\n#define ie_mcast_status com.ie_cmd_status\n\n\tu_short ie_mcast_bytes;\t/* size (in bytes) of multicast addresses */\n\tstruct ie_en_addr ie_mcast_addrs[MAXMCAST + 1];\t/* space for them */\n};\n\n/*\n * Time Domain Reflectometer command.\n */\n\nstruct ie_tdr_cmd {\n\tstruct ie_cmd_common com;\t/* common part */\n#define ie_tdr_status com.ie_cmd_status\n\n\tu_short ie_tdr_time;\t\t/* error bits and time */\n};\n\n#define IE_TDR_SUCCESS\t0x8000\t/* TDR succeeded without error */\n#define IE_TDR_XCVR\t0x4000\t/* detected a transceiver problem */\n#define IE_TDR_OPEN\t0x2000\t/* detected an open */\n#define IE_TDR_SHORT\t0x1000\t/* TDR detected a short */\n#define IE_TDR_TIME\t0x07ff\t/* mask for reflection time */\n\n/*\n * Initial Address Setup command\n */\nstruct ie_iasetup_cmd {\n\tstruct ie_cmd_common com;\n#define ie_iasetup_status com.ie_cmd_status\n\n\tstruct ie_en_addr ie_address;\n};\n\n/*\n * Configuration command\n */\nstruct ie_config_cmd {\n\tstruct ie_cmd_common com;\t/* common part */\n#define ie_config_status com.ie_cmd_status\n\n\tu_char ie_config_count;\t\t/* byte count (0x0c) */\n\tu_char ie_fifo;\t\t\t/* fifo (8) */\n\tu_char ie_save_bad;\t\t/* save bad frames (0x40) */\n\tu_char ie_addr_len;\t\t/* address length (0x2e) (AL-LOC == 1) */\n\tu_char ie_priority;\t\t/* priority and backoff (0x0) */\n\tu_char ie_ifs;\t\t\t/* inter-frame spacing (0x60) */\n\tu_char ie_slot_low;\t\t/* slot time, LSB (0x0) */\n\tu_char ie_slot_high;\t\t/* slot time, MSN, and retries (0xf2) */\n\tu_char ie_promisc;\t\t/* 1 if promiscuous, else 0 */\n\tu_char ie_crs_cdt;\t\t/* CSMA/CD parameters (0x0) */\n\tu_char ie_min_len;\t\t/* min frame length (0x40) */\n\tu_char ie_junk;\t\t\t/* stuff for 82596 (0xff) */\n};\n\n/*\n * Here are a few useful functions.  We could have done these as macros,\n * but since we have the inline facility, it makes sense to use that\n * instead.\n */\nstatic __inline void\nie_setup_config(volatile struct ie_config_cmd *cmd,\n\t\tint promiscuous, int manchester) {\n\tcmd->ie_config_count = 0x0c;\n\tcmd->ie_fifo = 8;\n\tcmd->ie_save_bad = 0x40;\n\tcmd->ie_addr_len = 0x2e;\n\tcmd->ie_priority = 0;\n\tcmd->ie_ifs = 0x60;\n\tcmd->ie_slot_low = 0;\n\tcmd->ie_slot_high = 0xf2;\n\tcmd->ie_promisc = !!promiscuous | manchester << 2;\n\tcmd->ie_crs_cdt = 0;\n\tcmd->ie_min_len = 64;\n\tcmd->ie_junk = 0xff;\n}\n\nstatic __inline void *\nAlign(void *ptr) {\n\tuintptr_t l = (uintptr_t)ptr;\n\tl = (l + 3) & ~3L;\n\treturn (void *)l;\n}\n\nstatic __inline volatile void *\nAlignvol(volatile void *ptr) {\n\tuintptr_t l = (uintptr_t)ptr;\n\tl = (l + 3) & ~3L;\n\treturn (volatile void *)l;\n}\n\n#if 0\nstatic __inline void\nie_ack(volatile struct ie_sys_ctl_block *scb,\n\t\t\t\t  u_int mask, int unit,\n\t\t\t\t  void (*ca)(int)) {\n\tscb->ie_command = scb->ie_status & mask;\n\t(*ca)(unit);\n}\n#endif\n"
  },
  {
    "path": "freebsd-headers/dev/ic/i8259.h",
    "content": "/*-\n * Copyright (c) 2003 Peter Wemm\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/dev/ic/i8259.h 151580 2005-10-23 09:05:51Z glebius $\n */\n\n/*\n * Register defintions for the i8259A programmable interrupt controller.\n */\n\n#ifndef _DEV_IC_I8259_H_\n#define\t_DEV_IC_I8259_H_\n\n/* Initialization control word 1. Written to even address. */\n#define\tICW1_IC4\t0x01\t\t/* ICW4 present */\n#define\tICW1_SNGL\t0x02\t\t/* 1 = single, 0 = cascaded */\n#define\tICW1_ADI\t0x04\t\t/* 1 = 4, 0 = 8 byte vectors */\n#define\tICW1_LTIM\t0x08\t\t/* 1 = level trigger, 0 = edge */\n#define\tICW1_RESET\t0x10\t\t/* must be 1 */\n/* 0x20 - 0x80 - in 8080/8085 mode only */\n\n/* Initialization control word 2. Written to the odd address. */\n/* No definitions, it is the base vector of the IDT for 8086 mode */\n\n/* Initialization control word 3. Written to the odd address. */\n/* For a master PIC, bitfield indicating a slave 8259 on given input */\n/* For slave, lower 3 bits are the slave's ID binary id on master */\n\n/* Initialization control word 4. Written to the odd address. */\n#define\tICW4_8086\t0x01\t\t/* 1 = 8086, 0 = 8080 */\n#define\tICW4_AEOI\t0x02\t\t/* 1 = Auto EOI */\n#define\tICW4_MS\t\t0x04\t\t/* 1 = buffered master, 0 = slave */\n#define\tICW4_BUF\t0x08\t\t/* 1 = enable buffer mode */\n#define\tICW4_SFNM\t0x10\t\t/* 1 = special fully nested mode */\n\n/* Operation control words.  Written after initialization. */\n\n/* Operation control word type 1 */\n/*\n * No definitions.  Written to the odd address.  Bitmask for interrupts.\n * 1 = disabled.\n */\n\n/* Operation control word type 2.  Bit 3 (0x08) must be zero. Even address. */\n#define\tOCW2_L0\t\t0x01\t\t/* Level */\n#define\tOCW2_L1\t\t0x02\n#define\tOCW2_L2\t\t0x04\n/* 0x08 must be 0 to select OCW2 vs OCW3 */\n/* 0x10 must be 0 to select OCW2 vs ICW1 */\n#define\tOCW2_EOI\t0x20\t\t/* 1 = EOI */\n#define\tOCW2_SL\t\t0x40\t\t/* EOI mode */\n#define\tOCW2_R\t\t0x80\t\t/* EOI mode */\n\n/* Operation control word type 3.  Bit 3 (0x08) must be set. Even address. */\n#define\tOCW3_RIS\t0x01\t\t/* 1 = read IS, 0 = read IR */\n#define\tOCW3_RR\t\t0x02\t\t/* register read */\n#define\tOCW3_P\t\t0x04\t\t/* poll mode command */\n/* 0x08 must be 1 to select OCW3 vs OCW2 */\n#define\tOCW3_SEL\t0x08\t\t/* must be 1 */\n/* 0x10 must be 0 to select OCW3 vs ICW1 */\n#define\tOCW3_SMM\t0x20\t\t/* special mode mask */\n#define\tOCW3_ESMM\t0x40\t\t/* enable SMM */\n\n#endif /* !_DEV_IC_I8259_H_ */\n"
  },
  {
    "path": "freebsd-headers/dev/ic/nec765.h",
    "content": "/*-\n * Copyright (c) 1991 The Regents of the University of California.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 4. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\tfrom: @(#)nec765.h\t7.1 (Berkeley) 5/9/91\n * $FreeBSD: release/9.0.0/sys/dev/ic/nec765.h 162165 2006-09-08 21:46:01Z jkim $\n */\n\n/*\n * Nec 765 floppy disc controller definitions\n */\n\n/* Main status register */\n#define NE7_DAB\t\t0x01\t/* Diskette drive A is seeking, thus busy */\n#define NE7_DBB\t\t0x02\t/* Diskette drive B is seeking, thus busy */\n#define NE7_CB\t\t0x10\t/* Diskette Controller Busy */\n#define NE7_NDM\t\t0x20\t/* Diskette Controller in Non Dma Mode */\n#define NE7_DIO\t\t0x40\t/* Diskette Controller Data register I/O */\n#define NE7_RQM\t\t0x80\t/* Diskette Controller ReQuest for Master */\n\n/* Status register ST0 */\n#define NE7_ST0BITS\t\"\\020\\010invld\\007abnrml\\006seek_cmplt\\005equ_chck\\004drive_notrdy\\003top_head\"\n\n#define NE7_ST0_IC\t0xc0\t/* interrupt completion code */\n\n#define NE7_ST0_IC_RC\t0xc0\t/* terminated due to ready changed, n/a */\n#define NE7_ST0_IC_IV\t0x80\t/* invalid command; must reset FDC */\n#define NE7_ST0_IC_AT\t0x40\t/* abnormal termination, check error stat */\n#define NE7_ST0_IC_NT\t0x00\t/* normal termination */\n\n#define NE7_ST0_SE\t0x20\t/* seek end */\n#define NE7_ST0_EC\t0x10\t/* equipment check, recalibrated but no trk0 */\n#define NE7_ST0_NR\t0x08\t/* not ready (n/a) */\n#define NE7_ST0_HD\t0x04\t/* upper head selected */\n#define NE7_ST0_DR\t0x03\t/* drive code */\n\n/* Status register ST1 */\n#define NE7_ST1BITS\t\"\\020\\010end_of_cyl\\006bad_crc\\005data_overrun\\003sec_not_fnd\\002write_protect\\001no_am\"\n\n#define NE7_ST1_EN\t0x80\t/* end of cylinder, access past last record */\n#define NE7_ST1_DE\t0x20\t/* data error, CRC fail in ID or data */\n#define NE7_ST1_OR\t0x10\t/* DMA overrun, DMA failed to do i/o quickly */\n#define NE7_ST1_ND\t0x04\t/* no data, sector not found or CRC in ID f. */\n#define NE7_ST1_NW\t0x02\t/* not writeable, attempt to violate WP */\n#define NE7_ST1_MA\t0x01\t/* missing address mark (in ID or data field)*/\n\n/* Status register ST2 */\n#define NE7_ST2BITS\t\"\\020\\007ctrl_mrk\\006bad_crc\\005wrong_cyl\\004scn_eq\\003scn_not_fnd\\002bad_cyl\\001no_dam\"\n\n#define NE7_ST2_CM\t0x40\t/* control mark; found deleted data */\n#define NE7_ST2_DD\t0x20\t/* data error in data field, CRC fail */\n#define NE7_ST2_WC\t0x10\t/* wrong cylinder, ID field mismatches cmd */\n#define NE7_ST2_SH\t0x08\t/* scan equal hit */\n#define NE7_ST2_SN\t0x04\t/* scan not satisfied */\n#define NE7_ST2_BC\t0x02\t/* bad cylinder, cylinder marked 0xff */\n#define NE7_ST2_MD\t0x01\t/* missing address mark in data field */\n\n/* Status register ST3 */\n#define NE7_ST3BITS\t\"\\020\\010fault\\007write_protect\\006drdy\\005tk0\\004two_side\\003side_sel\\002\"\n\n#define NE7_ST3_FT\t0x80\t/* fault; PC: n/a */\n#define NE7_ST3_WP\t0x40\t/* write protected */\n#define NE7_ST3_RD\t0x20\t/* ready; PC: always true */\n#define NE7_ST3_T0\t0x10\t/* track 0 */\n#define NE7_ST3_TS\t0x08\t/* two-sided; PC: n/a */\n#define NE7_ST3_HD\t0x04\t/* upper head select */\n#define NE7_ST3_US\t0x03\t/* unit select */\n\n/* Data Rate Select Register DSR (enhanced controller) */\n#define I8207X_DSR_SR\t0x80\t/* software reset */\n#define I8207X_DSR_LP\t0x40\t/* low power */\n#define I8207X_DSR_PS\t0x1c\t/* precompensation select */\n#define I8207X_DSR_RS\t0x03\t/* data rate select */\n\n/* Commands */\n/*\n * the top three bits -- where appropriate -- are set as follows:\n *\n * MT  - multi-track; allow both sides to be handled in single cmd\n * MFM - modified frequency modulation; use MFM encoding\n * SK  - skip; skip sectors marked as \"deleted\"\n */\n\n#define NE7CMD_MT\t0x80\t/* READ, WRITE, WRITEDEL, READDEL, SCAN* */\n#define NE7CMD_MFM\t0x40\t/* same as MT, plus READTRK, READID, FORMAT */\n#define NE7CMD_SK\t0x20\t/* READ, READDEL, SCAN* */\n\n#define NE7CMD_READTRK\t0x02\t/*  read whole track */\n#define NE7CMD_SPECIFY\t0x03\t/*  specify drive parameters - requires unit\n\t\t\t\t *  parameters byte */\n#define NE7CMD_SENSED\t0x04\t/*  sense drive - requires unit select byte */\n#define NE7CMD_WRITE\t0x05\t/*  write - requires eight additional bytes */\n#define NE7CMD_READ\t0x06\t/*  read - requires eight additional bytes */\n#define NE7CMD_RECAL\t0x07\t/*  recalibrate drive - requires\n\t\t\t\t *  unit select byte */\n#define NE7CMD_SENSEI\t0x08\t/*  sense controller interrupt status */\n#define NE7CMD_WRITEDEL\t0x09\t/*  write deleted data */\n#define NE7CMD_READID\t0x0a\t/*  read ID field */\n#define NE7CMD_READDEL\t0x0c\t/*  read deleted data */\n#define NE7CMD_FORMAT\t0x0d\t/*  format - requires five additional bytes */\n#define NE7CMD_SEEK\t0x0f\t/*  seek drive - requires unit select byte\n\t\t\t\t *  and new cyl byte */\n#define NE7CMD_VERSION\t0x10\t/*  get version */\n#define NE7CMD_SCNEQU\t0x11\t/*  scan equal */\n#define NE7CMD_SCNLE\t0x19\t/*  scan less or equal */\n#define NE7CMD_SCNGE\t0x1d\t/*  scan greater or equal */\n\n/*\n * Enhanced controller commands:\n */\n#define I8207X_DUMPREG\t0x0e\t/*  dump internal registers */\n#define I8207X_CONFIG\t0x13\t/*  configure enhanced features */\n\n/*\n * \"specify\" definitions\n *\n * acronyms (times are relative to a FDC clock of 8 MHz):\n * srt - step rate; PC usually 3 ms\n * hut - head unload time; PC usually maximum of 240 ms\n * hlt - head load time; PC usually minimum of 2 ms\n * nd  - no DMA flag; PC usually not set (0)\n */\n\n#define NE7_SPEC_1(srt, hut)\t(((16 - (srt)) << 4) | (((hut) / 16)))\n#define NE7_SPEC_2(hlt, nd)\t(((hlt) & 0xFE) | ((nd) & 1))\n"
  },
  {
    "path": "freebsd-headers/dev/ic/ns16550.h",
    "content": "/*-\n * Copyright (c) 1991 The Regents of the University of California.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 4. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\tfrom: @(#)ns16550.h\t7.1 (Berkeley) 5/9/91\n * $FreeBSD: release/9.0.0/sys/dev/ic/ns16550.h 202062 2010-01-11 04:13:06Z imp $\n */\n\n/*\n * NS8250... UART registers.\n */\n\n/* 8250 registers #[0-6]. */\n\n#define\tcom_data\t0\t/* data register (R/W) */\n#define\tREG_DATA\tcom_data\n\n#define\tcom_ier\t\t1\t/* interrupt enable register (W) */\n#define\tREG_IER\t\tcom_ier\n#define\tIER_ERXRDY\t0x1\n#define\tIER_ETXRDY\t0x2\n#define\tIER_ERLS\t0x4\n#define\tIER_EMSC\t0x8\n\n#define\tIER_BITS\t\"\\20\\1ERXRDY\\2ETXRDY\\3ERLS\\4EMSC\"\n\n#define\tcom_iir\t\t2\t/* interrupt identification register (R) */\n#define\tREG_IIR\t\tcom_iir\n#define\tIIR_IMASK\t0xf\n#define\tIIR_RXTOUT\t0xc\n#define\tIIR_BUSY\t0x7\n#define\tIIR_RLS\t\t0x6\n#define\tIIR_RXRDY\t0x4\n#define\tIIR_TXRDY\t0x2\n#define\tIIR_NOPEND\t0x1\n#define\tIIR_MLSC\t0x0\n#define\tIIR_FIFO_MASK\t0xc0\t/* set if FIFOs are enabled */\n\n#define\tIIR_BITS\t\"\\20\\1NOPEND\\2TXRDY\\3RXRDY\"\n\n#define\tcom_lcr\t\t3\t/* line control register (R/W) */\n#define\tcom_cfcr\tcom_lcr\t/* character format control register (R/W) */\n#define\tREG_LCR\t\tcom_lcr\n#define\tLCR_DLAB\t0x80\n#define\tCFCR_DLAB\tLCR_DLAB\n#define\tLCR_EFR_ENABLE\t0xbf\t/* magic to enable EFR on 16650 up */\n#define\tCFCR_EFR_ENABLE\tLCR_EFR_ENABLE\n#define\tLCR_SBREAK\t0x40\n#define\tCFCR_SBREAK\tLCR_SBREAK\n#define\tLCR_PZERO\t0x30\n#define\tCFCR_PZERO\tLCR_PZERO\n#define\tLCR_PONE\t0x20\n#define\tCFCR_PONE\tLCR_PONE\n#define\tLCR_PEVEN\t0x10\n#define\tCFCR_PEVEN\tLCR_PEVEN\n#define\tLCR_PODD\t0x00\n#define\tCFCR_PODD\tLCR_PODD\n#define\tLCR_PENAB\t0x08\n#define\tCFCR_PENAB\tLCR_PENAB\n#define\tLCR_STOPB\t0x04\n#define\tCFCR_STOPB\tLCR_STOPB\n#define\tLCR_8BITS\t0x03\n#define\tCFCR_8BITS\tLCR_8BITS\n#define\tLCR_7BITS\t0x02\n#define\tCFCR_7BITS\tLCR_7BITS\n#define\tLCR_6BITS\t0x01\n#define\tCFCR_6BITS\tLCR_6BITS\n#define\tLCR_5BITS\t0x00\n#define\tCFCR_5BITS\tLCR_5BITS\n\n#define\tcom_mcr\t\t4\t/* modem control register (R/W) */\n#define\tREG_MCR\t\tcom_mcr\n#define\tMCR_PRESCALE\t0x80\t/* only available on 16650 up */\n#define\tMCR_LOOPBACK\t0x10\n#define\tMCR_IE\t\t0x08\n#define\tMCR_IENABLE\tMCR_IE\n#define\tMCR_DRS\t\t0x04\n#define\tMCR_RTS\t\t0x02\n#define\tMCR_DTR\t\t0x01\n\n#define\tMCR_BITS\t\"\\20\\1DTR\\2RTS\\3DRS\\4IE\\5LOOPBACK\\10PRESCALE\"\n\n#define\tcom_lsr\t\t5\t/* line status register (R/W) */\n#define\tREG_LSR\t\tcom_lsr\n#define\tLSR_RCV_FIFO\t0x80\n#define\tLSR_TEMT\t0x40\n#define\tLSR_TSRE\tLSR_TEMT\n#define\tLSR_THRE\t0x20\n#define\tLSR_TXRDY\tLSR_THRE\n#define\tLSR_BI\t\t0x10\n#define\tLSR_FE\t\t0x08\n#define\tLSR_PE\t\t0x04\n#define\tLSR_OE\t\t0x02\n#define\tLSR_RXRDY\t0x01\n#define\tLSR_RCV_MASK\t0x1f\n\n#define\tLSR_BITS\t\"\\20\\1RXRDY\\2OE\\3PE\\4FE\\5BI\\6THRE\\7TEMT\\10RCV_FIFO\"\n\n#define\tcom_msr\t\t6\t/* modem status register (R/W) */\n#define\tREG_MSR\t\tcom_msr\n#define\tMSR_DCD\t\t0x80\n#define\tMSR_RI\t\t0x40\n#define\tMSR_DSR\t\t0x20\n#define\tMSR_CTS\t\t0x10\n#define\tMSR_DDCD\t0x08\n#define\tMSR_TERI\t0x04\n#define\tMSR_DDSR\t0x02\n#define\tMSR_DCTS\t0x01\n\n#define\tMSR_BITS\t\"\\20\\1DCTS\\2DDSR\\3TERI\\4DDCD\\5CTS\\6DSR\\7RI\\10DCD\"\n\n/* 8250 multiplexed registers #[0-1].  Access enabled by LCR[7]. */\n#define\tcom_dll\t\t0\t/* divisor latch low (R/W) */\n#define\tcom_dlbl\tcom_dll\n#define\tcom_dlm\t\t1\t/* divisor latch high (R/W) */\n#define\tcom_dlbh\tcom_dlm\n#define\tREG_DLL\t\tcom_dll\n#define\tREG_DLH\t\tcom_dlm\n\n/* 16450 register #7.  Not multiplexed. */\n#define\tcom_scr\t\t7\t/* scratch register (R/W) */\n\n/* 16550 register #2.  Not multiplexed. */\n#define\tcom_fcr\t\t2\t/* FIFO control register (W) */\n#define\tcom_fifo\tcom_fcr\n#define\tREG_FCR\t\tcom_fcr\n#define\tFCR_ENABLE\t0x01\n#define\tFIFO_ENABLE\tFCR_ENABLE\n#define\tFCR_RCV_RST\t0x02\n#define\tFIFO_RCV_RST\tFCR_RCV_RST\n#define\tFCR_XMT_RST\t0x04\n#define\tFIFO_XMT_RST\tFCR_XMT_RST\n#define\tFCR_DMA\t\t0x08\n#define\tFIFO_DMA_MODE\tFCR_DMA\n#define\tFCR_RX_LOW\t0x00\n#define\tFIFO_RX_LOW\tFCR_RX_LOW\n#define\tFCR_RX_MEDL\t0x40\n#define\tFIFO_RX_MEDL\tFCR_RX_MEDL\n#define\tFCR_RX_MEDH\t0x80\n#define\tFIFO_RX_MEDH\tFCR_RX_MEDH\n#define\tFCR_RX_HIGH\t0xc0\n#define\tFIFO_RX_HIGH\tFCR_RX_HIGH\n\n#define\tFCR_BITS\t\"\\20\\1ENABLE\\2RCV_RST\\3XMT_RST\\4DMA\"\n\n/* 16650 registers #2,[4-7].  Access enabled by LCR_EFR_ENABLE. */\n\n#define\tcom_efr\t\t2\t/* enhanced features register (R/W) */\n#define\tREG_EFR\t\tcom_efr\n#define\tEFR_CTS\t\t0x80\n#define\tEFR_AUTOCTS\tEFR_CTS\n#define\tEFR_RTS\t\t0x40\n#define\tEFR_AUTORTS\tEFR_RTS\n#define\tEFR_EFE\t\t0x10\t/* enhanced functions enable */\n\n#define\tcom_xon1\t4\t/* XON 1 character (R/W) */\n#define\tcom_xon2\t5\t/* XON 2 character (R/W) */\n#define\tcom_xoff1\t6\t/* XOFF 1 character (R/W) */\n#define\tcom_xoff2\t7\t/* XOFF 2 character (R/W) */\n\n#define com_usr\t\t39\t/* Octeon 16750/16550 Uart Status Reg */\n#define REG_USR\t\tcom_usr\n#define USR_TXFIFO_NOTFULL 2    /* Uart TX FIFO Not full */\n\n/* 16950 register #1.  Access enabled by ACR[7].  Also requires !LCR[7]. */\n#define\tcom_asr\t\t1\t/* additional status register (R[0-7]/W[0-1]) */\n\n/* 16950 register #3.  R/W access enabled by ACR[7]. */\n#define\tcom_rfl\t\t3\t/* receiver fifo level (R) */\n\n/*\n * 16950 register #4.  Access enabled by ACR[7].  Also requires\n * !LCR_EFR_ENABLE.\n */\n#define\tcom_tfl\t\t4\t/* transmitter fifo level (R) */\n\n/*\n * 16950 register #5.  Accessible if !LCR_EFR_ENABLE.  Read access also\n * requires ACR[6].\n */\n#define\tcom_icr\t\t5\t/* index control register (R/W) */\n\n/*\n * 16950 register #7.  It is the same as com_scr except it has a different\n * abbreviation in the manufacturer's data sheet and it also serves as an\n * index into the Indexed Control register set.\n */\n#define\tcom_spr\t\tcom_scr\t/* scratch pad (and index) register (R/W) */\n#define\tREG_SPR\t\tcom_scr\n\n/*\n * 16950 indexed control registers #[0-0x13].  Access is via index in SPR,\n * data in ICR (if ICR is accessible).\n */\n\n#define\tcom_acr\t\t0\t/* additional control register (R/W) */\n#define\tACR_ASE\t\t0x80\t/* ASR/RFL/TFL enable */\n#define\tACR_ICRE\t0x40\t/* ICR enable */\n#define\tACR_TLE\t\t0x20\t/* TTL/RTL enable */\n\n#define\tcom_cpr\t\t1\t/* clock prescaler register (R/W) */\n#define\tcom_tcr\t\t2\t/* times clock register (R/W) */\n#define\tcom_ttl\t\t4\t/* transmitter trigger level (R/W) */\n#define\tcom_rtl\t\t5\t/* receiver trigger level (R/W) */\n/* ... */\n\n/* Hardware extension mode register for RSB-2000/3000. */\n#define\tcom_emr\t\tcom_msr\n#define\tEMR_EXBUFF\t0x04\n#define\tEMR_CTSFLW\t0x08\n#define\tEMR_DSRFLW\t0x10\n#define\tEMR_RTSFLW\t0x20\n#define\tEMR_DTRFLW\t0x40\n#define\tEMR_EFMODE\t0x80\n"
  },
  {
    "path": "freebsd-headers/dev/ic/quicc.h",
    "content": "/*-\n * Copyright (c) 2006 Juniper Networks\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n *\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR\n * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES\n * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,\n * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF\n * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/dev/ic/quicc.h 176772 2008-03-03 18:20:17Z raj $\n */\n\n#ifndef _DEV_IC_QUICC_H_\n#define\t_DEV_IC_QUICC_H_\n\n/*\n * Device parameter RAM\n */\n#define\tQUICC_PRAM_BASE\t\t0x8000\n\n#define\tQUICC_PRAM_REV_NUM\t(QUICC_PRAM_BASE + 0xaf0)\n\n/* SCC parameter RAM. */\n#define\tQUICC_PRAM_SIZE_SCC\t256\n#define\tQUICC_PRAM_BASE_SCC(u)\t(QUICC_PRAM_BASE + QUICC_PRAM_SIZE_SCC * (u))\n\n/* SCC parameters that are common for all modes. */\n#define\tQUICC_PRAM_SCC_RBASE(u)\t(QUICC_PRAM_BASE_SCC(u) + 0x00)\n#define\tQUICC_PRAM_SCC_TBASE(u)\t(QUICC_PRAM_BASE_SCC(u) + 0x02)\n#define\tQUICC_PRAM_SCC_RFCR(u)\t(QUICC_PRAM_BASE_SCC(u) + 0x04)\n#define\tQUICC_PRAM_SCC_TFCR(u)\t(QUICC_PRAM_BASE_SCC(u) + 0x05)\n#define\tQUICC_PRAM_SCC_MRBLR(u)\t(QUICC_PRAM_BASE_SCC(u) + 0x06)\n#define\tQUICC_PRAM_SCC_RBPTR(u)\t(QUICC_PRAM_BASE_SCC(u) + 0x10)\n#define\tQUICC_PRAM_SCC_TBPTR(u)\t(QUICC_PRAM_BASE_SCC(u) + 0x20)\n\n/*\n * SCC parameters that are specific to UART/ASYNC mode.\n */\n#define\tQUICC_PRAM_SIZE_SCC_UART\t0x68\t/* Rounded up. */\n\n#define\tQUICC_PRAM_SCC_UART_MAX_IDL(u)\t(QUICC_PRAM_BASE_SCC(u) + 0x38)\n#define\tQUICC_PRAM_SCC_UART_IDLC(u)\t(QUICC_PRAM_BASE_SCC(u) + 0x3a)\n#define\tQUICC_PRAM_SCC_UART_BRKCR(u)\t(QUICC_PRAM_BASE_SCC(u) + 0x3c)\n#define\tQUICC_PRAM_SCC_UART_PAREC(u)\t(QUICC_PRAM_BASE_SCC(u) + 0x3e)\n#define\tQUICC_PRAM_SCC_UART_FRMEC(u)\t(QUICC_PRAM_BASE_SCC(u) + 0x40)\n#define\tQUICC_PRAM_SCC_UART_NOSEC(u)\t(QUICC_PRAM_BASE_SCC(u) + 0x42)\n#define\tQUICC_PRAM_SCC_UART_BRKEC(u)\t(QUICC_PRAM_BASE_SCC(u) + 0x44)\n#define\tQUICC_PRAM_SCC_UART_BRKLN(u)\t(QUICC_PRAM_BASE_SCC(u) + 0x46)\n#define\tQUICC_PRAM_SCC_UART_UADDR1(u)\t(QUICC_PRAM_BASE_SCC(u) + 0x48)\n#define\tQUICC_PRAM_SCC_UART_UADDR2(u)\t(QUICC_PRAM_BASE_SCC(u) + 0x4a)\n#define\tQUICC_PRAM_SCC_UART_TOSEQ(u)\t(QUICC_PRAM_BASE_SCC(u) + 0x4e)\n#define\tQUICC_PRAM_SCC_UART_CC(u,n)\t(QUICC_PRAM_BASE_SCC(u) + 0x50 + (n)*2)\n#define\tQUICC_PRAM_SCC_UART_RCCM(u)\t(QUICC_PRAM_BASE_SCC(u) + 0x60)\n#define\tQUICC_PRAM_SCC_UART_RCCR(u)\t(QUICC_PRAM_BASE_SCC(u) + 0x62)\n#define\tQUICC_PRAM_SCC_UART_RLBC(u)\t(QUICC_PRAM_BASE_SCC(u) + 0x64)\n\n/*\n * Interrupt controller.\n */\n#define\tQUICC_REG_SICR\t\t0x10c00\n#define\tQUICC_REG_SIVEC\t\t0x10c04\n#define\tQUICC_REG_SIPNR_H\t0x10c08\n#define\tQUICC_REG_SIPNR_L\t0x10c0c\n#define\tQUICC_REG_SCPRR_H\t0x10c14\n#define\tQUICC_REG_SCPRR_L\t0x10c18\n#define\tQUICC_REG_SIMR_H\t0x10c1c\n#define\tQUICC_REG_SIMR_L\t0x10c20\n#define\tQUICC_REG_SIEXR\t\t0x10c24\n\n/*\n * System clock control register.\n */\n#define\tQUICC_REG_SCCR\t\t0x10c80\n\n/*\n * Baudrate generator registers.\n */\n#define\tQUICC_REG_BRG(u)\t(0x119f0 + ((u) & 3) * 4 - ((u) & 4) * 0x100)\n\n/*\n * SCC registers.\n */\n#define\tQUICC_REG_SIZE_SCC\t0x20\n#define\tQUICC_REG_BASE_SCC(u)\t(0x11a00 + QUICC_REG_SIZE_SCC * (u))\n\n#define\tQUICC_REG_SCC_GSMR_L(u)\t(QUICC_REG_BASE_SCC(u) + 0x00)\n#define\tQUICC_REG_SCC_GSMR_H(u)\t(QUICC_REG_BASE_SCC(u) + 0x04)\n#define\tQUICC_REG_SCC_PSMR(u)\t(QUICC_REG_BASE_SCC(u) + 0x08)\n#define\tQUICC_REG_SCC_TODR(u)\t(QUICC_REG_BASE_SCC(u) + 0x0c)\n#define\tQUICC_REG_SCC_DSR(u)\t(QUICC_REG_BASE_SCC(u) + 0x0e)\n#define\tQUICC_REG_SCC_SCCE(u)\t(QUICC_REG_BASE_SCC(u) + 0x10)\n#define\tQUICC_REG_SCC_SCCM(u)\t(QUICC_REG_BASE_SCC(u) + 0x14)\n#define\tQUICC_REG_SCC_SCCS(u)\t(QUICC_REG_BASE_SCC(u) + 0x17)\n\n#endif /* _DEV_IC_QUICC_H_ */\n"
  },
  {
    "path": "freebsd-headers/dev/ic/rsa.h",
    "content": "/*-\n * Copyright (c) 1999 FreeBSD Inc.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/dev/ic/rsa.h 77962 2001-06-10 04:28:39Z nyan $\n */\n\n/*\n * RSA Mode Driver Data Sheet\n *\n * <<Register Map>>\n * Base + 0x00\n * Mode Select Register(Read/Write)\n * bit4=interrupt type(1: level, 0: edge)\n * bit3=Auto RTS-CTS Flow Control Enable\n * bit2=External FIFO Enable\n * bit1=Reserved(Default 0)Don't Change!!\n * bit0=Swap Upper 8byte and Lower 8byte in 16byte space.\n *\n * Base + 0x01\n * Interrupt Enable Register(Read/Write)\n * bit4=Hardware Timer Interrupt Enable\n * bit3=Character Time-Out Interrupt Enable\n * bit2=Tx FIFO Empty Interrupt Enable\n * bit1=Tx FIFO Half Full Interrupt Enable\n * bit0=Rx FIFO Half Full Interrupt Enable\n *\n * Base + 0x02\n * Status Read Register(Read)\n * bit7=Hardware  Time Out Interrupt Status(1: True, 0: False)\n * bit6=Character Time Out Interrupt Status\n * bit5=Rx FIFO Full Flag(0: True, 1: False)\n * bit4=Rx FIFO Half Full Flag\n * bit3=Rx FIFO Empty Flag\n * bit2=Tx FIFO Full Flag\n * bit1=Tx FIFO Half Full Flag\n * bit0=Tx FIFO Empty Flag\n *\n * Base + 0x02\n * FIFO Reset Register(Write)\n * Reset Extrnal FIFO\n *\n * Base + 0x03\n * Timer Interval Value Set Register(Read/Write)\n * Range of n: 1-255\n * Interval Value: n * 0.2ms\n *\n * Base + 0x04\n * Timer Control Register(Read/Write)\n * bit0=Timer Enable\n *\n * Base + 0x08 - 0x0f\n * Same as UART 16550\n *\n * Special Regisgter in RSA Mode\n * UART Data Register(Base + 0x08)\n * Data transfer between Extrnal FIFO\n *\n * UART MCR(Base + 0x0c)\n * bit3(OUT2[MCR_IENABLE])=1: Diable 16550   to Rx FIFO transfer\n * bit2(OUT1[MCR_DRS])=1:     Diable Tx FIFO to 16550   transfer\n *\n * <<Intrrupt and Intrrupt Reset>>\n * o Reciver Line Status(from UART16550)\n *   Reset: Read LSR\n *\n * o Modem Status(from UART16550)\n *   Reset: Read MSR\n *\n * o Rx FIFO Half Full(from Extrnal FIFO)\n *   Reset: Read Rx FIFO under Hall Full \n *\n * o Character Time Out(from Extrnal FIFO)\n *   Reset: Read Rx FIFO or SRR\n *\n * o Tx FIFO Empty(from Extrnal FIFO)\n *   Reset: Write Tx FIFO or Read SRR\n *\n * o Tx FIFO Half Full(from Extrnal FIFO)\n *   Reset: Write Tx FIFO until Hall Full or Read SRR\n * \n * o Hardware Timer(from Extrnal FIFO)\n *   Reset: Disable Timer in TCR\n *   Notes: If you want to use Timer for next intrrupt,\n *          you must enable Timer in TCR\n *\n * <<Used Setting>>\n * Auto RTS-CTS:    Enable or Disable\n * External FIFO:   Enable\n * Swap 8bytes:     Disable\n * Haredware Timer: Disable\n * interrupt type:  edge\n * interrupt source:\n *           Hareware Timer\n *           Character Time Out\n *           Tx FIFO Empty\n *           Rx FIFO Half Full\n *\n */\n\n/* I/O-DATA RSA Serise Exrension Register */\n#define rsa_msr\t\t0\t/* Mode Status Register (R/W) */\n#define\trsa_ier\t\t1\t/* Interrupt Enable Register (R/W) */\n#define\trsa_srr\t\t2\t/* Status Read Register (R) */\n#define\trsa_frr\t\t2\t/* FIFO Reset Register (W) */\n#define\trsa_tivsr\t3\t/* Timer Interval Value Set Register (R/W) */\n#define\trsa_tcr\t\t4\t/* Timer Control Register (W) */\n"
  },
  {
    "path": "freebsd-headers/dev/ic/sab82532.h",
    "content": "/*\t$OpenBSD: sab82532reg.h,v 1.2 2002/04/08 17:49:42 jason Exp $\t*/\n\n/*-\n * Copyright (c) 2001 Jason L. Wright (jason@thought.net)\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. All advertising materials mentioning features or use of this software\n *    must display the following acknowledgement:\n *\tThis product includes software developed by Jason L. Wright\n * 4. The name of the author may not be used to endorse or promote products\n *    derived from this software without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR\n * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\n * DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR\n * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,\n * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n *\n * Effort sponsored in part by the Defense Advanced Research Projects\n * Agency (DARPA) and Air Force Research Laboratory, Air Force\n * Materiel Command, USAF, under agreement number F30602-01-2-0537.\n *\n * $FreeBSD: release/9.0.0/sys/dev/ic/sab82532.h 139749 2005-01-06 01:43:34Z imp $\n */\n\n#ifndef _DEV_IC_SAB82532_H_\n#define\t_DEV_IC_SAB82532_H_\n\n/*\n * Register definitions for SAB82532 based on \"Enhanced Serial Communication\n * Controller ESCC2 Version 3.2 User's Manual 07.96\" from:\n * http://www.infineon.com\n */\n\n#define\tSAB_NCHAN\t2\t/* number of channels */\n#define\tSAB_CHANLEN\t0x40\t/* length of channel register set */\n\n#define\tSAB_CHAN_A\t0x00\t/* channel A register offset */\n#define\tSAB_CHAN_B\t0x40\t/* channel B register offset */\n\n#define\tSAB_RFIFO\t0x00\t/* r: rx fifo */\n#define\tSAB_XFIFO\t0x00\t/* w: tx fifo */\n#define\tSAB_STAR\t0x20\t/* r: status register */\n#define\tSAB_CMDR\t0x20\t/* w: command register */\n#define\tSAB_MODE\t0x22\t/* rw: mode register */\n#define\tSAB_TIMR\t0x23\t/* rw: timer register */\n#define\tSAB_XON\t\t0x24\t/* rw: xon character */\n#define\tSAB_XOFF\t0x25\t/* rw: xoff character */\n#define\tSAB_TCR\t\t0x26\t/* rw: termination character */\n#define\tSAB_DAFO\t0x27\t/* rw: data format */\n#define\tSAB_RFC\t\t0x28\t/* rw: rfifo control register */\n#define\tSAB_RBCL\t0x2a\t/* r: rx byte count low */\n#define\tSAB_TBCL\t0x2a\t/* w: tx byte count low */\n#define\tSAB_RBCH\t0x2b\t/* r: rx byte count high */\n#define\tSAB_XBCH\t0x2b\t/* w: tx byte count high */\n#define\tSAB_CCR0\t0x2c\t/* rw: channel configuration register 0 */\n#define\tSAB_CCR1\t0x2d\t/* rw: channel configuration register 1 */\n#define\tSAB_CCR2\t0x2e\t/* rw: channel configuration register 2 */\n#define\tSAB_CCR3\t0x2f\t/* rw: channel configuration register 3 */\n#define\tSAB_TSAX\t0x30\t/* w: time-slot assignment register tx */\n#define\tSAB_TSAR\t0x31\t/* w: time-slot assignment register rx */\n#define\tSAB_XCCR\t0x32\t/* w: tx channel capacity register */\n#define\tSAB_RCCR\t0x33\t/* w: receive channel capacity register */\n#define\tSAB_VSTR\t0x34\t/* r: version status */\n#define\tSAB_BGR\t\t0x34\t/* w: baud rate generator */\n#define\tSAB_TIC\t\t0x35\t/* w: transmit immediate character */\n#define\tSAB_MXN\t\t0x36\t/* w: mask xon character */\n#define\tSAB_MXF\t\t0x37\t/* w: mask xoff character */\n#define\tSAB_GIS\t\t0x38\t/* r: global interrupt status */\n#define\tSAB_IVA\t\t0x38\t/* w: interrupt vector address */\n#define\tSAB_IPC\t\t0x39\t/* rw: interrupt port configuration */\n#define\tSAB_ISR0\t0x3a\t/* r: interrupt status 0 */\n#define\tSAB_IMR0\t0x3a\t/* w: interrupt mask 0 */\n#define\tSAB_ISR1\t0x3b\t/* r: interrupt status 1 */\n#define\tSAB_IMR1\t0x3b\t/* w: interrupt mask 1 */\n#define\tSAB_PVR\t\t0x3c\t/* rw: port value register */\n#define\tSAB_PIS\t\t0x3d\t/* r: port interrupt status */\n#define\tSAB_PIM\t\t0x3d\t/* w: port interrupt mask */\n#define\tSAB_PCR\t\t0x3e\t/* w: port configuration register */\n#define\tSAB_CCR4\t0x3f\t/* rw: channel configuration register 4 */\n\n/* SAB_STAR: status register */\n#define\tSAB_STAR_XDOV\t0x80\t/* transmit data overflow */\n#define\tSAB_STAR_XFW\t0x40\t/* transmit fifo write enable */\n#define\tSAB_STAR_RFNE\t0x20\t/* rfifo not empty */\n#define\tSAB_STAR_FCS\t0x10\t/* flow control status */\n#define\tSAB_STAR_TEC\t0x08\t/* tx immediate char is executing */\n#define\tSAB_STAR_CEC\t0x04\t/* command is executing */\n#define\tSAB_STAR_CTS\t0x02\t/* cts status: 0:inactive/high,1:active/low */\n\n/* SAB_CMDR: command register */\n#define\tSAB_CMDR_RMC\t0x80\t/* receive message complete */\n#define\tSAB_CMDR_RRES\t0x40\t/* receiver reset */\n#define\tSAB_CMDR_RFRD\t0x20\t/* receive fifo read enable */\n#define\tSAB_CMDR_STI\t0x10\t/* start timer */\n#define\tSAB_CMDR_XF\t0x08\t/* transmit frame */\n#define\tSAB_CMDR_XRES\t0x01\t/* transmit reset */\n\n/* SAB_MODE: mode register */\n#define\tSAB_MODE_FRTS\t0x40\t/* flow control using rts */\n#define\tSAB_MODE_FCTS\t0x20\t/* flow control using cts */\n#define\tSAB_MODE_FLON\t0x10\t/* flow control on */\n#define\tSAB_MODE_RAC\t0x08\t/* receiver active */\n#define\tSAB_MODE_RTS\t0x04\t/* request to send */\n#define\tSAB_MODE_TRS\t0x02\t/* timer resolution */\n#define\tSAB_MODE_TLP\t0x01\t/* test loop */\n\n/* SAB_TIMR: timer register */\n#define\tSAB_TIMR_CNT\t0xe0\t/* count mask */\n#define\tSAB_TIMR_VAL\t0x1f\t/* value mask */\n\n/* SAB_DAFO: data format */\n#define\tSAB_DAFO_XBRK\t0x40\t/* transmit break */\n#define\tSAB_DAFO_STOP\t0x20\t/* stop bit: 0:1 bit, 1:2 bits */\n#define\tSAB_DAFO_PAR1\t0x10\t/* parity 1, see below */\n#define\tSAB_DAFO_PAR0\t0x08\t/* parity 0, see below */\n#define\tSAB_DAFO_PARE\t0x04\t/* parity enable */\n#define\tSAB_DAFO_CHL1\t0x02\t/* character length 1, see below */\n#define\tSAB_DAFO_CHL0\t0x01\t/* character length 0, see below */\n\n#define\tSAB_DAFO_CHL_CSIZE\t(SAB_DAFO_CHL1|SAB_DAFO_CHL0)\n#define\tSAB_DAFO_CHL_CS5\t(SAB_DAFO_CHL1|SAB_DAFO_CHL0)\n#define\tSAB_DAFO_CHL_CS6\t(SAB_DAFO_CHL1)\n#define\tSAB_DAFO_CHL_CS7\t(SAB_DAFO_CHL0)\n#define\tSAB_DAFO_CHL_CS8\t(0)\n\n#define\tSAB_DAFO_PARMASK\t(SAB_DAFO_PAR1|SAB_DAFO_PAR0|SAB_DAFO_PARE)\n#define\tSAB_DAFO_PAR_MARK\t(SAB_DAFO_PAR1|SAB_DAFO_PAR0|SAB_DAFO_PARE)\n#define\tSAB_DAFO_PAR_EVEN\t(SAB_DAFO_PAR1|SAB_DAFO_PARE)\n#define\tSAB_DAFO_PAR_ODD\t(SAB_DAFO_PAR0|SAB_DAFO_PARE)\n#define\tSAB_DAFO_PAR_SPACE\t(SAB_DAFO_PARE)\n#define\tSAB_DAFO_PAR_NONE\t(0)\n\n/* SAB_RFC: rfifo control register */\n#define\tSAB_RFC_DPS\t0x40\t/* disable parity storage */\n#define\tSAB_RFC_DXS\t0x20\t/* disable storage of xon/xoff characters */\n#define\tSAB_RFC_RFDF\t0x10\t/* rfifo data format: 0 data,1 data+stat */\n#define\tSAB_RFC_RFTH1\t0x08\t/* rfifo threshold level 1, see below */\n#define\tSAB_RFC_RFTH0\t0x04\t/* rfifo threshold level 0, see below */\n#define\tSAB_RFC_TCDE\t0x01\t/* termination character detection enable */\n\n#define\tSAB_RFC_RFTH_MASK\t(SAB_RFC_RFTH1|SAB_RFC_RFTH0)\n#define\tSAB_RFC_RFTH_32CHAR\t(SAB_RFC_RFTH1|SAB_RFC_RFTH0)\n#define\tSAB_RFC_RFTH_16CHAR\t(SAB_RFC_RFTH1)\n#define\tSAB_RFC_RFTH_4CHAR\t(SAB_RFC_RFTH0)\n#define\tSAB_RFC_RFTH_1CHAR\t(0)\n\n/* SAB_RBCH: received byte count high */\n#define\tSAB_RBCH_DMA\t0x80\t/* read back of XBCH DMA bit */\n#define\tSAB_RBCH_CAS\t0x20\t/* read back of XBCH CAS bit */\n#define\tSAB_RBCH_CNT\t0x0f\t/* ms 4 bits of rx byte count (not used) */\n\n/* SAB_XBCH: transmit byte count high */\n#define\tSAB_XBCH_DMA\t0x80\t/* dma mode: 1:dma, 0:interrupt */\n#define\tSAB_XBCH_CAS\t0x20\t/* carrier detect auto-start */\n#define\tSAB_XBCH_XC\t0x10\t/* transmit continuously */\n#define\tSAB_XBCH_CNT\t0x0f\t/* ms 4 bits of tx byte count */\n\n/* SAB_CCR0: channel configuration register 0 */\n#define\tSAB_CCR0_PU\t0x80\t/* 0:power-down, 1:power-up */\n#define\tSAB_CCR0_MCE\t0x40\t/* master clock enable */\n#define\tSAB_CCR0_SC2\t0x10\t/* serial port config 2, see below */\n#define\tSAB_CCR0_SC1\t0x08\t/* serial port config 1, see below */\n#define\tSAB_CCR0_SC0\t0x04\t/* serial port config 0, see below */\n#define\tSAB_CCR0_SM1\t0x02\t/* serial mode 1, see below */\n#define\tSAB_CCR0_SM0\t0x01\t/* serial mode 0, see below */\n\n#define\tSAB_CCR0_SC_MASK\t(SAB_CCR0_SC2|SAB_CCR0_SC1|SAB_CCR0_SC0)\n#define\tSAB_CCR0_SC_NRZ\t\t(0)\n#define\tSAB_CCR0_SC_NRZI\t(SAB_CCR0_SC1)\n#define\tSAB_CCR0_SC_FM0\t\t(SAB_CCR0_SC2)\n#define\tSAB_CCR0_SC_FM1\t\t(SAB_CCR0_SC2|SAB_CCR0_SC0)\n#define\tSAB_CCR0_SC_MANCHESTER\t(SAB_CCR0_SC2|SAB_CCR0_SC1)\n\n#define\tSAB_CCR0_SM_MASK\t(SAB_CCR0_SM1|SAB_CCR0_SM0)\n#define\tSAB_CCR0_SM_DLC\t\t(0)\n#define\tSAB_CCR0_SM_DLCLOOP\t(SAB_CCR0_SM0)\n#define\tSAB_CCR0_SM_BISYNC\t(SAB_CCR0_SM1)\n#define\tSAB_CCR0_SM_ASYNC\t(SAB_CCR0_SM1|SAB_CCR0_SM0)\n\n/* SAB_CCR1: channel configuration register 1 */\n#define\tSAB_CCR1_ODS\t0x10\t/* Output driver select:1:pushpull,0:odrain */\n#define\tSAB_CCR1_BCR\t0x08\t/* bit clock rate: 1:async, 0:isochronous */\n#define\tSAB_CCR1_CM2\t0x04\t/* clock mode 2, see below */\n#define\tSAB_CCR1_CM1\t0x02\t/* clock mode 1, see below */\n#define\tSAB_CCR1_CM0\t0x01\t/* clock mode 0, see below */\n\n#define\tSAB_CCR1_CM_MASK\t(SAB_CCR1_CM2|SAB_CCR1_CM1|SAB_CCR1_CM0)\n#define\tSAB_CCR1_CM_7\t\t(SAB_CCR1_CM2|SAB_CCR1_CM1|SAB_CCR1_CM0)\n\n/* SAB_CCR2: channel configuration register 2, depends on clock mode above */\n/* clock mode 0a, 1, 4, 5 */\n#define\tSAB_CCR2_SOC1\t0x80\t/* special output 1, below */\n#define\tSAB_CCR2_SOC0\t0x40\t/* special output 0, below */\n#define\tSAB_CCR2_SOC_MASK\t(SAB_CCR2_SOC1|SAB_CCR2_SOC0)\n#define\tSAB_CCR2_SOC_RTSHIGH\t(SAB_CCR2_SOC1)\n#define\tSAB_CCR2_SOC_RTSNORM\t(0)\n#define\tSAB_CCR2_SOC_RTSRX\t(SAB_CCR2_SOC1|SAB_CCR2_SOC0)\n/* clock mode 0b, 2, 3, 6, 7 */\n#define\tSAB_CCR2_BR9\t0x80\t/* baud rate bit 9 */\n#define\tSAB_CCR2_BR8\t0x40\t/* baud rate bit 8 */\n#define\tSAB_CCR2_BDF\t0x20\t/* baud rate division factor: 0:1: 1:BRG */\n#define\tSAB_CCR2_SSEL\t0x10\t/* clock source select */\n/* clock mode 5 */\n#define\tSAB_CCR2_XCS0\t0x20\t/* tx clock shift, bit 0 */\n#define\tSAB_CCR2_RCS0\t0x10\t/* rx clock shift, bit 0 */\n/* clock mode 0b, 2, 3, 4, 5, 6, 7 */\n#define\tSAB_CCR2_TOE\t0x08\t/* tx clock output enable */\n/* clock mode 0a, 0b, 1, 2, 3, 4, 5, 6, 7 */\n#define\tSAB_CCR2_RWX\t0x04\t/* read/write exchange (dma mode only) */\n#define\tSAB_CCR2_DIV\t0x01\t/* data inversion (nrz) */\n\n/* SAB_CCR3: channel configuration register 3 (v2 or greater) */\n#define\tSAB_CCR3_PSD\t0x01\t/* dpll phase shift disable (nrz/nrzi) */\n\n/* SAB_TSAX: time-slot assignment register transmit (clock mode 5 only) */\n#define\tSAB_TSAX_TSNX\t0xfc\t/* time-slot number transmit */\n#define\tSAB_TSAX_XCS2\t0x02\t/* transmit clock shift bit 2 */\n#define\tSAB_TSAX_XCS1\t0x01\t/* transmit clock shift bit 1 */\n\n/* SAB_TSAR: time-slot assignment register receive (clock mode 5 only) */\n#define\tSAB_TSAR_TSNR\t0xfc\t/* time-slot number receive */\n#define\tSAB_TSAR_RCS2\t0x02\t/* receive clock shift bit 2 */\n#define\tSAB_TSAR_RCS1\t0x01\t/* receive clock shift bit 1 */\n\n/* SAB_VSTR: version status register */\n#define\tSAB_VSTR_CD\t0x80\t/* carrier detect status */\n#define\tSAB_VSTR_DPLA\t0x40\t/* dpll asynchronous */\n#define\tSAB_VSTR_VMASK\t0x0f\t/* chip version mask: */\n#define\tSAB_VSTR_V_1\t0x00\t/*   version 1 */\n#define\tSAB_VSTR_V_2\t0x01\t/*   version 2 */\n#define\tSAB_VSTR_V_32\t0x02\t/*   version 3.2 */\n\n/* SAB_GIS: global interrupt status register */\n#define\tSAB_GIS_PI\t0x80\t/* universal port interrupt */\n#define\tSAB_GIS_ISA1\t0x08\t/* interrupt status a1 */\n#define\tSAB_GIS_ISA0\t0x04\t/* interrupt status a0 */\n#define\tSAB_GIS_ISB1\t0x02\t/* interrupt status b1 */\n#define\tSAB_GIS_ISB0\t0x01\t/* interrupt status b0 */\n\n/* SAB_IVA: interrupt vector address */\n#define\tSAB_IVA_MASK\t0xf8\t/* interrupt vector address mask */\n\n/* SAB_IPC: interrupt port configuration */\n#define\tSAB_IPC_VIS\t0x80\t/* masked interrupt bits visible */\n#define\tSAB_IPC_SLAMASK\t0x18\t/* slave address mask */\n#define\tSAB_IPC_CASM\t0x04\t/* cascading mode */\n#define\tSAB_IPC_ICMASK\t0x03\t/* port config mask: */\n#define\tSAB_IPC_ICOD\t0x00\t/*   open drain output */\n#define\tSAB_IPC_ICPL\t0x01\t/*   push/pull active low output */\n#define\tSAB_IPC_ICPH\t0x03\t/*   push/pull active high output */\n\n/* SAB_ISR0: interrupt status 0 */\n#define\tSAB_ISR0_TCD\t0x80\t/* termination character detected */\n#define\tSAB_ISR0_TIME\t0x40\t/* time-out limit exceeded */\n#define\tSAB_ISR0_PERR\t0x20\t/* parity error */\n#define\tSAB_ISR0_FERR\t0x10\t/* framing error */\n#define\tSAB_ISR0_PLLA\t0x08\t/* dpll asynchronous */\n#define\tSAB_ISR0_CDSC\t0x04\t/* carrier detect status change */\n#define\tSAB_ISR0_RFO\t0x02\t/* rfifo overflow */\n#define\tSAB_ISR0_RPF\t0x01\t/* receive pool full */\n\n/* SAB_ISR1: interrupt status 1 */\n#define\tSAB_ISR1_BRK\t0x80\t/* break detected */\n#define\tSAB_ISR1_BRKT\t0x40\t/* break terminated */\n#define\tSAB_ISR1_ALLS\t0x20\t/* all sent */\n#define\tSAB_ISR1_XOFF\t0x10\t/* xoff detected */\n#define\tSAB_ISR1_TIN\t0x08\t/* timer interrupt */\n#define\tSAB_ISR1_CSC\t0x04\t/* clear to send status change */\n#define\tSAB_ISR1_XON\t0x02\t/* xon detected */\n#define\tSAB_ISR1_XPR\t0x01\t/* transmit pool ready */\n\n/* SAB_IMR0: interrupt mask 0 */\n#define\tSAB_IMR0_TCD\t0x80\t/* termination character detected */\n#define\tSAB_IMR0_TIME\t0x40\t/* time-out limit exceeded */\n#define\tSAB_IMR0_PERR\t0x20\t/* parity error */\n#define\tSAB_IMR0_FERR\t0x10\t/* framing error */\n#define\tSAB_IMR0_PLLA\t0x08\t/* dpll asynchronous */\n#define\tSAB_IMR0_CDSC\t0x04\t/* carrier detect status change */\n#define\tSAB_IMR0_RFO\t0x02\t/* rfifo overflow */\n#define\tSAB_IMR0_RPF\t0x01\t/* receive pool full */\n\n/* SAB_ISR1: interrupt mask 1 */\n#define\tSAB_IMR1_BRK\t0x80\t/* break detected */\n#define\tSAB_IMR1_BRKT\t0x40\t/* break terminated */\n#define\tSAB_IMR1_ALLS\t0x20\t/* all sent */\n#define\tSAB_IMR1_XDU\t0x10\t/* xoff detected */\n#define\tSAB_IMR1_TIN\t0x08\t/* timer interrupt */\n#define\tSAB_IMR1_CSC\t0x04\t/* clear to send status change */\n#define\tSAB_IMR1_XMR\t0x02\t/* xon detected */\n#define\tSAB_IMR1_XPR\t0x01\t/* transmit pool ready */\n\n/* SAB_PVR: port value register */\n#define\tSAB_PVR_DSR_A\t0x01\t/* port A DSR */\n#define\tSAB_PVR_DTR_A\t0x02\t/* port A DTR */\n#define\tSAB_PVR_DTR_B\t0x04\t/* port B DTR */\n#define\tSAB_PVR_DSR_B\t0x08\t/* port B DSR */\n#define\tSAB_PVR_MAGIC\t0x10\t/* dunno... */\n\n/* SAB_CCR4: channel configuration register 4 */\n#define\tSAB_CCR4_MCK4\t0x80\t/* master clock divide by 4 */\n#define\tSAB_CCR4_EBRG\t0x40\t/* enhanced baud rate generator mode */\n#define\tSAB_CCR4_TST1\t0x20\t/* test pin */\n#define\tSAB_CCR4_ICD\t0x10\t/* invert polarity of carrier detect */\n\n/* Receive status byte */\n#define\tSAB_RSTAT_PE\t0x80\t/* parity error */\n#define\tSAB_RSTAT_FE\t0x40\t/* framing error */\n#define\tSAB_RSTAT_PAR\t0x01\t/* parity bit */\n\n#endif /* _DEV_IC_SAB82532_H_ */\n"
  },
  {
    "path": "freebsd-headers/dev/ic/via6522reg.h",
    "content": "/*\n * Copyright 2004 by Peter Grehan. All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. The name of the author may not be used to endorse or promote products\n *    derived from this software without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR\n * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES\n * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,\n * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,\n * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\n * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED\n * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,\n * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/dev/ic/via6522reg.h 153030 2005-12-02 22:36:14Z grehan $\n */\n\n#ifndef _VIA6522REG_H_\n#define _VIA6522REG_H_\n\n/* Registers */\n#define REG_OIRB\t0\t/* Input/output register B */\n#define REG_OIRA\t1\t/* Input/output register A */\n#define REG_DDRB\t2\t/* Data direction register B */\n#define REG_DDRA\t3\t/* Data direction register A */\n#define REG_T1CL\t4\t/* T1 low-order latch/low-order counter */\n#define REG_T1CH\t5\t/* T1 high-order counter */\n#define REG_T1LL\t6\t/* T1 low-order latches */\n#define REG_T1LH\t7\t/* T1 high-order latches */\n#define REG_T2CL\t8\t/* T2 low-order latch/low-order counter */\n#define REG_T2CH\t9\t/* T2 high-order counter */\n#define REG_SR\t\t10\t/* Shift register */\n#define REG_ACR\t\t11\t/* Auxiliary control register */\n#define REG_PCR\t\t12\t/* Peripheral control register */\n#define REG_IFR\t\t13\t/* Interrupt flag register */\n#define REG_IER\t\t14\t/* Interrupt-enable register */\n#define REG_OIRA_NH\t15\t/* Input/output register A: no handshake */\n\n\n/* Auxiliary control register (11) */\n#define ACR_SR_NONE\t0x0\t/* Disabled */\n#define ACR_SR_DIR\t0x4\t/* Bit for shift-register direction 1=out */\n#define ACR_SRI_T2\t0x1\t/* Shift in under control of T2 */\n#define ACR_SRI_PHI2\t0x2\t/*   \"    \"   \"     \"      \" PHI2 */\n#define ACR_SRI_EXTCLK\t0x3\t/*   \"    \"   \"     \"      \" external clk */\n#define ACR_SRO\t\t0x4\t/* Shift out free running at T2 rate */\n#define ACR_SRO_T2\t0x5\t/* Shift out under control of T2 */\n#define ACR_SRO_PHI2\t0x6\t/*   \"    \"   \"     \"      \"  PHI2 */\n#define ACR_SRO_EXTCLK\t0x7\t/*   \"    \"   \"     \"      \"  external clk */\n\n#define ACR_T1_SHIFT\t5\t/* bits 7-5 */\n#define ACR_SR_SHIFT\t2\t/* bits 4-2 */\n\n\n/* Peripheral control register (12) */\n#define PCR_INTCNTL\t0x01\t/* interrupt active edge: +ve=1, -ve=0 */\n\n#define PCR_CNTL_MASK\t0x3\t/* 3 bits */\n#define PCR_CNTL_NEDGE\t0x0\t/* Input - negative active edge */\n#define PCR_CNTL_INEDGE 0x1\t/* Interrupt - negative active edge */\n#define PCR_CNTL_PEDGE\t0x2\t/* Input - positive active edge */\n#define PCR_CNTL_IPEDGE 0x3\t/* Interrupt - positive active edge */\n#define PCR_CNTL_HSHAKE 0x4\t/* Handshake output */\n#define PCR_CNTL_PULSE\t0x5\t/* Pulse output */\n#define PCR_CNTL_LOW\t0x6\t/* Low output */\n#define PCR_CNTL_HIGH\t0x7\t/* High output */\n\n#define PCR_CB2_SHIFT\t5\t/* bits 7-5 */\n#define PCR_CB1_SHIFT\t4\t/* bit 4 */\n#define PCR_CA2_SHIFT\t1\t/* bits 3-1 */\n#define PCR_CA1_SHIFT\t0\t/* bit 0 */\n\n/* Interrupt flag register (13) */\n#define IFR_CA2\t\t0x01\n#define IFR_CA1\t\t0x02\n#define IFR_SR\t\t0x04\n#define IFR_CB2\t\t0x08\n#define IFR_CB1\t\t0x10\n#define IFR_T2\t\t0x20\n#define IFR_T1\t\t0x40\n#define IFR_IRQB       \t0x80\t/* status of IRQB output pin */\n\n/* Interrupt enable register (14) */\n#define IER_CA2\t\tIFR_CA2\n#define IER_CA1\t\tIFR_CA1\n#define IER_SR\t\tIFR_SR\n#define IER_CB2\t\tIFR_CB2\n#define IER_CB1\t\tIFR_CB1\n#define IER_T2\t\tIFR_T2\n#define IER_T1\t\tIFR_T1\n#define IER_IRQB\tIFR_IRQB\n\n#endif /* _VIA6522REG_H_ */\n"
  },
  {
    "path": "freebsd-headers/dev/ic/wd33c93reg.h",
    "content": "/* $FreeBSD: release/9.0.0/sys/dev/ic/wd33c93reg.h 139749 2005-01-06 01:43:34Z imp $ */\n/*\t$NecBSD: wd33c93reg.h,v 1.21.24.1 2001/06/13 05:52:05 honda Exp $\t*/\n/*\t$NetBSD$\t*/\n/*-\n * [NetBSD for NEC PC-98 series]\n *  Copyright (c) 1996, 1997, 1998\n *\tNetBSD/pc98 porting staff. All rights reserved.\n *  Copyright (c) 1996, 1997, 1998\n *\tNaofumi Honda. All rights reserved.\n * \n *  Redistribution and use in source and binary forms, with or without\n *  modification, are permitted provided that the following conditions\n *  are met:\n *  1. Redistributions of source code must retain the above copyright\n *     notice, this list of conditions and the following disclaimer.\n *  2. Redistributions in binary form must reproduce the above copyright\n *     notice, this list of conditions and the following disclaimer in the\n *     documentation and/or other materials provided with the distribution.\n *  3. The name of the author may not be used to endorse or promote products\n *     derived from this software without specific prior written permission.\n * \n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR\n * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\n * DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR\n * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,\n * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\n#ifndef\t_WD33C93REG_H_\n#define\t_WD33C93REG_H_\n\n/* wd33c93 register */\n#define\twd3s_oid\t\t0x00\n#define\tIDR_FS_16_20\t\t0x80\n#define\tIDR_FS_12_15\t\t0x40\n#define\tIDR_FS_8_10\t\t0x00\n#define\tIDR_RAF\t\t\t0x20\n#define\tIDR_EHP\t\t\t0x10\n#define\tIDR_EAF\t\t\t0x08\n#define\tIDR_IDM\t\t\t0x07\n\n#define\twd3s_ctrl\t\t0x01\n#define\tCR_DMA\t\t\t0x80\n#define\tCR_DMAD\t\t\t0x40\n#define\tCR_HLT_HOST_PARITY\t0x10\n#define\tCR_DIS_INT\t\t0x08\n#define\tCR_IDIS_INT\t\t0x04\n#define\tCR_HLT_ATN\t\t0x02\n#define\tCR_HLT_BUS_PARITY\t0x01\n#define\tCR_DEFAULT\t\t(CR_DIS_INT | CR_IDIS_INT)\n#define\tCR_DEFAULT_HP\t\t(CR_DEFAULT | CR_HLT_BUS_PARITY)\n\n#define\twd3s_tout\t\t0x02\n#define\twd3s_cdb\t\t0x03\n#define\twd3s_lun\t\t0x0f\n#define\twd3s_cph\t\t0x10\n#define\twd3s_synch\t\t0x11\n#define\twd3s_cnt\t\t0x12\n#define\twd3s_did\t\t0x15\n#define\tDIDR_SCC\t\t0x80\n#define\tDIDR_DPD\t\t0x40\n\n#define\twd3s_sid\t\t0x16\n#define\tSIDR_RESEL\t\t0x80\n#define\tSIDR_SEL\t\t0x40\n#define\tSIDR_VALID\t\t0x08\n#define\tSIDR_IDM\t\t0x07\n\n#define\twd3s_stat\t\t0x17\n\n#define\tBSR_CM\t\t\t0xf0\n#define\tBSR_CMDCPL\t\t0x10\n#define\tBSR_CMDABT\t\t0x20\n#define\tBSR_CMDERR\t\t0x40\n#define\tBSR_CMDREQ\t\t0x80\n\n#define\tBSR_SM\t\t\t0x0f\n#define\tBSR_PM\t\t\t0x07\n#define\tBSR_PHVALID\t\t0x08\n#define\tBSR_IOR\t\t\t0x01\n#define\tBSR_DATAOUT\t\t0x00\n#define\tBSR_DATAIN\t\t0x01\n#define\tBSR_CMDOUT\t\t0x02\n#define\tBSR_STATIN\t\t0x03\n#define\tBSR_UNSPINFO0\t\t0x04\n#define\tBSR_UNSPINFO1\t\t0x05\n#define\tBSR_MSGOUT\t\t0x06\n#define\tBSR_MSGIN\t\t0x07\n\n#define\tBSR_RESET\t\t0x00\n#define\tBSR_AFM_RESET\t\t0x01\n#define\tBSR_SELECTED\t\t0x11\n#define\tBSR_SATFIN\t\t0x16\n#define\tBSR_ACKREQ\t\t0x20\n#define\tBSR_SATSDP\t\t0x21\n#define\tBSR_RESEL\t\t0x80\n#define\tBSR_AFM_RESEL\t\t0x81\n#define\tBSR_DISC\t\t0x85\n\n#define\twd3s_cmd\t\t0x18\n#define\twd3s_data\t\t0x19\n#define\twd3s_qtag\t\t0x1a\n\n#define\twd3s_mbank\t\t0x30\n#define\tMBR_RST\t\t\t0x02\n#define\tMBR_IEN\t\t\t0x04\n\n#define\twd3s_mwin\t\t0x31\n#define\twd3s_auxc\t\t0x33\n#define\tAUXCR_HIDM\t\t0x07\n#define\tAUXCR_INTM\t\t0x38\n#define\tAUXCR_RRST\t\t0x80\n\n/* status port */\n#define\tSTR_INT\t\t\t0x80\n#define\tSTR_LCI\t\t\t0x40\n#define\tSTR_BSY\t\t\t0x20\n#define\tSTR_CIP\t\t\t0x10\n#define\tSTR_PE\t\t\t0x02\n#define\tSTR_DBR\t\t\t0x01\n#define\tSTR_BUSY\t\t0xf0\n\n/* cmd port */\n#define\tCMDP_DMES\t\t0x01\n#define\tCMDP_DMER\t\t0x02\n#define\tCMDP_TCMS\t\t0x04\n#define\tCMDP_TCMR\t\t0x08\n#define\tCMDP_TCIR\t\t0x10\n\n/* wd33c93 chip cmds */\n#define\tWD3S_SBT\t\t0x80\n#define\tWD3S_RESET\t\t0x00\n#define\tWD3S_ABORT\t\t0x01\n#define\tWD3S_ASSERT_ATN\t\t0x02\n#define\tWD3S_NEGATE_ACK\t\t0x03\n#define\tWD3S_DISCONNECT\t\t0x04\n#define\tWD3S_RESELECT\t\t0x05\n#define\tWD3S_SELECT_ATN\t\t0x06\n#define\tWD3S_SELECT_NO_ATN\t0x07\n#define\tWD3S_SELECT_ATN_TFR\t0x08\n#define\tWD3S_SELECT_NO_ATN_TFR\t0x09\n#define\tWD3S_RESELECT_RCV_DATA\t0x0a\n#define\tWD3S_RESELECT_SEND_DATA\t0x0b\n#define\tWD3S_WAIT_SELECT_RCV\t0x0c\n#define\tWD3S_CMD_COMPSEQ\t0x0d\n#define\tWD3S_SEND_DISC_MSG\t0x0e\n#define\tWD3S_SET_IDI\t\t0x0f\n#define\tWD3S_RCV_CMD\t\t0x10\n#define\tWD3S_RCV_DATA\t\t0x11\n#define\tWD3S_RCV_MSG_OUT\t0x12\n#define\tWD3S_RCV_UNSP_INFO_OUT\t0x13\n#define\tWD3S_SEND_STATUS\t0x14\n#define\tWD3S_SEND_DATA\t\t0x15\n#define\tWD3S_SEND_MSG_IN\t0x16\n#define\tWD3S_SEND_UNSP_INFO_IN\t0x17\n#define\tWD3S_TRANSLATE_ADDRESS\t0x18\n#define\tWD3S_TFR_INFO\t\t0x20\n\n#endif\t/* !_WD33C93REG_H_ */\n"
  },
  {
    "path": "freebsd-headers/dev/ic/z8530.h",
    "content": "/*-\n * Copyright (c) 2003 Marcel Moolenaar\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n *\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR\n * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES\n * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,\n * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF\n * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/dev/ic/z8530.h 155967 2006-02-24 02:03:35Z marcel $\n */\n\n#ifndef _DEV_IC_Z8530_H_\n#define\t_DEV_IC_Z8530_H_\n\n/*\n * Channel B control:\t0\n * Channel B data:\t1\n * Channel A control:\t2\n * Channel A data:\t3\n */\n\n/* The following apply when using a device-scoped bus handle */\n#define\tCHAN_A\t\t2\n#define\tCHAN_B\t\t0\n\n#define\tREG_CTRL\t0\n#define\tREG_DATA\t1\n\n/* Write registers. */\n#define\tWR_CR\t\t0\t/* Command Register. */\n#define\tWR_IDT\t\t1\t/* Interrupt and Data Transfer Mode. */\n#define\tWR_IV\t\t2\t/* Interrupt Vector (shared). */\n#define\tWR_RPC\t\t3\t/* Receive Parameters and Control. */\n#define\tWR_MPM\t\t4\t/* Miscellaneous Parameters and Modes. */\n#define\tWR_TPC\t\t5\t/* Transmit Parameters and Control. */\n#define\tWR_SCAF\t\t6\t/* Sync Character or (SDLC) Address Field. */\n#define\tWR_SCF\t\t7\t/* Sync Character or (SDCL) Flag. */\n#define\tWR_EFC\t\t7\t/* Extended Feature and FIFO Control. */\n#define\tWR_TB\t\t8\t/* Transmit Buffer. */\n#define\tWR_MIC\t\t9\t/* Master Interrupt Control (shared). */\n#define\tWR_MCB1\t\t10\t/* Miscellaneous Control Bits (part 1 :-). */\n#define\tWR_CMC\t\t11\t/* Clock Mode Control. */\n#define\tWR_TCL\t\t12\t/* BRG Time Constant Low. */\n#define\tWR_TCH\t\t13\t/* BRG Time Constant High. */\n#define\tWR_MCB2\t\t14\t/* Miscellaneous Control Bits (part 2 :-). */\n#define\tWR_IC\t\t15\t/* Interrupt Control. */\n\n/* Read registers. */\n#define\tRR_BES\t\t0\t/* Buffer and External Status. */\n#define\tRR_SRC\t\t1\t/* Special Receive Condition. */\n#define\tRR_IV\t\t2\t/* Interrupt Vector. */\n#define\tRR_IP\t\t3\t/* Interrupt Pending (ch A only). */\n#define\tRR_MPM\t\t4\t/* Miscellaneous Parameters and Modes. */\n#define\tRR_TPC\t\t5\t/* Transmit Parameters and Control. */\n#define\tRR_BCL\t\t6\t/* Byte Count Low. */\n#define\tRR_BCH\t\t7\t/* Byte Count High. */\n#define\tRR_RB\t\t8\t/* Receive Buffer. */\n#define\tRR_RPC\t\t9\t/* Receive Parameters and Control. */\n#define\tRR_MSB\t\t10\t/* Miscellaneous Status Bits. */\n#define\tRR_MCB1\t\t11\t/* Miscellaneous Control Bits (part 1). */\n#define\tRR_TCL\t\t12\t/* BRG Time Constant Low. */\n#define\tRR_TCH\t\t13\t/* BRG Time Constant High. */\n#define\tRR_EFC\t\t14\t/* Extended Feature and FIFO Control. */\n#define\tRR_IC\t\t15\t/* Interrupt Control. */\n\n/* Buffer and External Status (RR0). */\n#define\tBES_BRK\t\t0x80\t/* Break (Abort). */\n#define\tBES_TXU\t\t0x40\t/* Tx Underrun (EOM). */\n#define\tBES_CTS\t\t0x20\t/* CTS. */\n#define\tBES_SYNC\t0x10\t/* Sync. */\n#define\tBES_DCD\t\t0x08\t/* DCD. */\n#define\tBES_TXE\t\t0x04\t/* Tx Empty. */\n#define\tBES_ZC\t\t0x02\t/* Zero Count. */\n#define\tBES_RXA\t\t0x01\t/* Rx Available. */\n\n/* Clock Mode Control (WR11). */\n#define\tCMC_XTAL\t0x80\t/* -RTxC connects to quartz crystal. */\n#define\tCMC_RC_DPLL\t0x60\t/* Rx Clock from DPLL. */\n#define\tCMC_RC_BRG\t0x40\t/* Rx Clock from BRG. */\n#define\tCMC_RC_TRXC\t0x20\t/* Rx Clock from -TRxC. */\n#define\tCMC_RC_RTXC\t0x00\t/* Rx Clock from -RTxC. */\n#define\tCMC_TC_DPLL\t0x18\t/* Tx Clock from DPLL */\n#define\tCMC_TC_BRG\t0x10\t/* Tx Clock from BRG */\n#define\tCMC_TC_TRXC\t0x08\t/* Tx Clock from -TRxC. */\n#define\tCMC_TC_RTXC\t0x00\t/* Tx Clock from -RTxC. */\n#define\tCMC_TRXC_OUT\t0x04\t/* -TRxC is output. */\n#define\tCMC_TRXC_DPLL\t0x03\t/* -TRxC from DPLL */\n#define\tCMC_TRXC_BRG\t0x02\t/* -TRxC from BRG */\n#define\tCMC_TRXC_XMIT\t0x01\t/* -TRxC from Tx clock. */\n#define\tCMC_TRXC_XTAL\t0x00\t/* -TRxC from XTAL. */\n\n/* Command Register (WR0). */\n#define\tCR_RSTTXU\t0xc0\t/* Reset Tx. Underrun/EOM. */\n#define\tCR_RSTTXCRC\t0x80\t/* Reset Tx. CRC. */\n#define\tCR_RSTRXCRC\t0x40\t/* Reset Rx. CRC. */\n#define\tCR_RSTIUS\t0x38\t/* Reset Int. Under Service. */\n#define\tCR_RSTERR\t0x30\t/* Error Reset. */\n#define\tCR_RSTTXI\t0x28\t/* Reset Tx. Int. */\n#define\tCR_ENARXI\t0x20\t/* Enable Rx. Int. */\n#define\tCR_ABORT\t0x18\t/* Send Abort. */\n#define\tCR_RSTXSI\t0x10\t/* Reset Ext/Status Int. */\n\n/* Extended Feature and FIFO Control (WR7 prime). */\n#define\tEFC_ERE\t\t0x40\t/* Extended Read Enable. */\n#define\tEFC_FE\t\t0x20\t/* Transmit FIFO Empty. */\n#define\tEFC_RQT\t\t0x10\t/* Request Timing. */\n#define\tEFC_FHF\t\t0x08\t/* Receive FIFO Half Full. */\n#define\tEFC_RTS\t\t0x04\t/* Auto RTS Deactivation. */\n#define\tEFC_EOM\t\t0x02\t/* Auto EOM Reset. */\n#define\tEFC_FLAG\t0x01\t/* Auto SDLC Flag on Tx. */\n\n/* Interrupt Control (WR15). */\n#define\tIC_BRK\t\t0x80\t/* Break (Abort) IE. */\n#define\tIC_TXU\t\t0x40\t/* Tx Underrun IE. */\n#define\tIC_CTS\t\t0x20\t/* CTS IE. */\n#define\tIC_SYNC\t\t0x10\t/* Sync IE. */\n#define\tIC_DCD\t\t0x08\t/* DCD IE. */\n#define\tIC_FIFO\t\t0x04\t/* SDLC FIFO Enable. */\n#define\tIC_ZC\t\t0x02\t/* Zero Count IE. */\n#define\tIC_EF\t\t0x01\t/* Extended Feature Enable. */\n\n/* Interrupt and Data Transfer Mode (WR1). */\n#define\tIDT_WRE\t\t0x80\t/* Wait/DMA Request Enable. */\n#define\tIDT_REQ\t\t0x40\t/* DMA Request. */\n#define\tIDT_WRR\t\t0x20\t/* Wait/DMA Reuest on Receive. */\n#define\tIDT_RISC\t0x18\t/* Rx Int. on Special Condition Only. */\n#define\tIDT_RIA\t\t0x10\t/* Rx Int. on All Characters. */\n#define\tIDT_RIF\t\t0x08\t/* Rx Int. on First Character. */\n#define\tIDT_PSC\t\t0x04\t/* Parity is Special Condition. */\n#define\tIDT_TIE\t\t0x02\t/* Tx Int. Enable. */\n#define\tIDT_XIE\t\t0x01\t/* Ext. Int. Enable. */\n\n/* Interrupt Pending (RR3). */\n#define\tIP_RIA\t\t0x20\t/* Rx. Int. ch. A. */\n#define\tIP_TIA\t\t0x10\t/* Tx. Int. ch. A. */ \n#define\tIP_SIA\t\t0x08\t/* Ext/Status Int. ch. A. */\n#define\tIP_RIB\t\t0x04\t/* Rx. Int. ch. B. */\n#define\tIP_TIB\t\t0x02\t/* Tx. Int. ch. B. */\n#define\tIP_SIB\t\t0x01\t/* Ext/Status Int. ch. B. */\n\n/* Interrupt Vector Status Low (RR2). */\n#define\tIV_SCA\t\t0x0e\t/* Special Condition ch. A. */\n#define\tIV_RAA\t\t0x0c\t/* Receive Available ch. A. */\n#define\tIV_XSA\t\t0x0a\t/* External/Status Change ch. A. */\n#define\tIV_TEA\t\t0x08\t/* Transmitter Empty ch. A. */\n#define\tIV_SCB\t\t0x06\t/* Special Condition ch. B. */\n#define\tIV_RAB\t\t0x04\t/* Receive Available ch. B. */\n#define\tIV_XSB\t\t0x02\t/* External/Status Change ch. B. */\n#define\tIV_TEB\t\t0x00\t/* Transmitter Empty ch. B. */\n\n/* Miscellaneous Control Bits part 1 (WR10). */\n#define\tMCB1_CRC1\t0x80\t/* CRC presets to 1. */\n#define\tMCB1_FM0\t0x60\t/* FM0 Encoding. */\n#define\tMCB1_FM1\t0x40\t/* FM1 Encoding. */\n#define\tMCB1_NRZI\t0x20\t/* NRZI Encoding. */\n#define\tMCB1_NRZ\t0x00\t/* NRZ Encoding. */\n#define\tMCB1_AOP\t0x10\t/* Active On Poll. */\n#define\tMCB1_MI\t\t0x08\t/* Mark Idle. */\n#define\tMCB1_AOU\t0x04\t/* Abort On Underrun. */\n#define\tMCB1_LM\t\t0x02\t/* Loop Mode. */\n#define\tMCB1_SIX\t0x01\t/* 6 or 12 bit SYNC. */\n\n/* Miscellaneous Control Bits part 2 (WR14). */\n#define\tMCB2_NRZI\t0xe0\t/* DPLL - NRZI mode. */\n#define\tMCB2_FM\t\t0xc0\t/* DPLL - FM mode. */\n#define\tMCB2_RTXC\t0xa0\t/* DPLL - Clock from -RTxC. */\n#define\tMCB2_BRG\t0x80\t/* DPLL - Clock from BRG. */\n#define\tMCB2_OFF\t0x60\t/* DPLL - Disable. */\n#define\tMCB2_RMC\t0x40\t/* DPLL - Reset Missing Clock. */\n#define\tMCB2_ESM\t0x20\t/* DPLL - Enter Search Mode. */\n#define\tMCB2_LL\t\t0x10\t/* Local Loopback. */\n#define\tMCB2_AE\t\t0x08\t/* Auto Echo. */\n#define\tMCB2_REQ\t0x04\t/* Request Function. */\n#define\tMCB2_PCLK\t0x02\t/* BRG source is PCLK. */\n#define\tMCB2_BRGE\t0x01\t/* BRG enable. */\n\n/* Master Interrupt Control (WR9). */\n#define\tMIC_FHR\t\t0xc0\t/* Force Hardware Reset. */\n#define\tMIC_CRA\t\t0x80\t/* Channel Reset A. */\n#define\tMIC_CRB\t\t0x40\t/* Channel Reset B. */\n#define\tMIC_SIE\t\t0x20\t/* Software INTACK Enable. */\n#define\tMIC_SH\t\t0x10\t/* Status High. */\n#define\tMIC_MIE\t\t0x08\t/* Master Interrupt Enable. */\n#define\tMIC_DLC\t\t0x04\t/* Disable Lower Chain. */\n#define\tMIC_NV\t\t0x02\t/* No Vector. */\n#define\tMIC_VIS\t\t0x01\t/* Vector Includes Status. */\n\n/* Transmit/Receive Miscellaneous Parameters and Modes (WR4). */\n#define\tMPM_CM64\t0xc0\t/* X64 Clock Mode. */\n#define\tMPM_CM32\t0x80\t/* X32 Clock Mode. */\n#define\tMPM_CM16\t0x40\t/* X16 Clock Mode. */\n#define\tMPM_CM1\t\t0x00\t/* X1 Clock Mode. */\n#define\tMPM_EXT\t\t0x30\t/* External Sync Mode. */\n#define\tMPM_SDLC \t0x20\t/* SDLC mode. */\n#define\tMPM_BI\t\t0x10\t/* 16-bit Sync (bi-sync). */\n#define\tMPM_MONO\t0x00\t/* 8-bit Sync (mono-sync). */\n#define\tMPM_SB2 \t0x0c\t/* Async mode: 2 stopbits. */\n#define\tMPM_SB15 \t0x08\t/* Async mode: 1.5 stopbits. */\n#define\tMPM_SB1 \t0x04\t/* Async mode: 1 stopbit. */\n#define\tMPM_SYNC\t0x00\t/* Sync Mode Enable. */\n#define\tMPM_EVEN \t0x02\t/* Async mode: even parity. */\n#define\tMPM_PE\t\t0x01\t/* Async mode: parity enable. */\n\n/* Receive Parameters and Control (WR3). */\n#define\tRPC_RB8\t\t0xc0\t/* 8 databits. */\n#define\tRPC_RB6\t\t0x80\t/* 6 databits. */\n#define\tRPC_RB7\t\t0x40\t/* 7 databits. */\n#define\tRPC_RB5\t\t0x00\t/* 5 databits. */\n#define\tRPC_AE\t\t0x20\t/* Auto Enable. */\n#define\tRPC_EHM\t\t0x10\t/* Enter Hunt Mode. */\n#define\tRPC_CRC\t\t0x08\t/* CRC Enable. */\n#define\tRPC_ASM\t\t0x04\t/* Address Search Mode. */\n#define\tRPC_LI\t\t0x02\t/* SYNC Character Load Inhibit */\n#define\tRPC_RXE\t\t0x01\t/* Receiver Enable */\n\n/* Special Receive Condition (RR1). */\n#define\tSRC_EOF\t\t0x80\t/* End Of Frame. */\n#define\tSRC_FE\t\t0x40\t/* Framing Error. */\n#define\tSRC_OVR\t\t0x20\t/* Rx. Overrun. */\n#define\tSRC_PE\t\t0x10\t/* Parity Error. */\n#define\tSRC_RC0\t\t0x08\t/* Residue Code 0. */\n#define\tSRC_RC1\t\t0x04\t/* Residue Code 1. */\n#define\tSRC_RC2\t\t0x02\t/* Residue Code 2. */\n#define\tSRC_AS\t\t0x01\t/* All Sent. */\n\n/* Transmit Parameter and Control (WR5). */\n#define\tTPC_DTR\t\t0x80\t/* DTR. */\n#define\tTPC_TB8\t\t0x60\t/* 8 databits. */\n#define\tTPC_TB6\t\t0x40\t/* 6 databits. */\n#define\tTPC_TB7\t\t0x20\t/* 7 databits. */\n#define\tTPC_TB5\t\t0x00\t/* 5 or fewer databits. */\n#define\tTPC_BRK\t\t0x10\t/* Send break. */\n#define\tTPC_TXE\t\t0x08\t/* Transmitter Enable. */\n#define\tTPC_CRC16\t0x04\t/* CRC16. */\n#define\tTPC_RTS\t\t0x02\t/* RTS. */\n#define\tTPC_CRC\t\t0x01\t/* CRC Enable. */\n\n#endif /* _DEV_IC_Z8530_H_ */\n"
  },
  {
    "path": "freebsd-headers/dev/ieee488/ibfoo_int.h",
    "content": "/*-\n * Copyright (c) 2005 Poul-Henning Kamp\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * This file defines the ABI between the userland gpib library and the\n * kernel.  This file should not be used anywhere else.\n *\n * $FreeBSD: release/9.0.0/sys/dev/ieee488/ibfoo_int.h 141768 2005-02-12 21:07:09Z phk $\n */\n\n#include <sys/ioccom.h>\n\ntypedef void ibsrq_t(void);\nenum ibfoo_id {\n\t__ID_INVALID = 0,\n\t__ID_IBASK,\n\t__ID_IBBNA,\n\t__ID_IBCAC,\n\t__ID_IBCLR,\n\t__ID_IBCMD,\n\t__ID_IBCMDA,\n\t__ID_IBCONFIG,\n\t__ID_IBDEV,\n\t__ID_IBDIAG,\n\t__ID_IBDMA,\n\t__ID_IBEOS,\n\t__ID_IBEOT,\n\t__ID_IBEVENT,\n\t__ID_IBFIND,\n\t__ID_IBGTS,\n\t__ID_IBIST,\n\t__ID_IBLINES,\n\t__ID_IBLLO,\n\t__ID_IBLN,\n\t__ID_IBLOC,\n\t__ID_IBONL,\n\t__ID_IBPAD,\n\t__ID_IBPCT,\n\t__ID_IBPOKE,\n\t__ID_IBPPC,\n\t__ID_IBRD,\n\t__ID_IBRDA,\n\t__ID_IBRDF,\n\t__ID_IBRDKEY,\n\t__ID_IBRPP,\n\t__ID_IBRSC,\n\t__ID_IBRSP,\n\t__ID_IBRSV,\n\t__ID_IBSAD,\n\t__ID_IBSGNL,\n\t__ID_IBSIC,\n\t__ID_IBSRE,\n\t__ID_IBSRQ,\n\t__ID_IBSTOP,\n\t__ID_IBTMO,\n\t__ID_IBTRAP,\n\t__ID_IBTRG,\n\t__ID_IBWAIT,\n\t__ID_IBWRT,\n\t__ID_IBWRTA,\n\t__ID_IBWRTF,\n\t__ID_IBWRTKEY,\n\t__ID_IBXTRC\n};\n\n#define __F_HANDLE              (1 << 0)\n#define __F_SPR                 (1 << 1)\n#define __F_BUFFER              (1 << 2)\n#define __F_RETVAL              (1 << 3)\n#define __F_BDNAME              (1 << 4)\n#define __F_MASK                (1 << 5)\n#define __F_PADVAL              (1 << 6)\n#define __F_SADVAL              (1 << 7)\n#define __F_CNT                 (1 << 8)\n#define __F_TMO                 (1 << 9)\n#define __F_EOS                 (1 << 10)\n#define __F_PPR                 (1 << 11)\n#define __F_EOT                 (1 << 12)\n#define __F_V                   (1 << 13)\n#define __F_VALUE               (1 << 14)\n#define __F_SAD                 (1 << 15)\n#define __F_BOARDID             (1 << 16)\n#define __F_OPTION              (1 << 17)\n#define __F_FLNAME              (1 << 18)\n#define __F_FUNC                (1 << 19)\n#define __F_LINES               (1 << 20)\n#define __F_PAD                 (1 << 21)\n#define __F_MODE                (1 << 22)\n#define __F_LISTENFLAG          (1 << 23)\n#define __F_EVENT               (1 << 24)\n\nstruct ibarg {\n\tenum ibfoo_id       __ident;\n\tunsigned int        __field;\n\tint\t\t    __retval;\n\tint\t\t    __ibsta;\n\tint\t\t    __iberr;\n\tint\t\t    __ibcnt;\n\tint                 handle;\n\tchar *              spr;\n\tvoid *              buffer;\n\tint *               retval;\n\tchar *              bdname;\n\tint                 mask;\n\tint                 padval;\n\tint                 sadval;\n\tlong                cnt;\n\tint                 tmo;\n\tint                 eos;\n\tchar *              ppr;\n\tint                 eot;\n\tint                 v;\n\tint                 value;\n\tint                 sad;\n\tint                 boardID;\n\tint                 option;\n\tchar *              flname;\n\tibsrq_t *           func;\n\tshort *             lines;\n\tint                 pad;\n\tint                 mode;\n\tshort *             listenflag;\n\tshort *             event;\n};\n\n#define GPIB_IBFOO\t_IOWR(4, 0, struct ibarg)\n"
  },
  {
    "path": "freebsd-headers/dev/ieee488/tnt4882.h",
    "content": "/*-\n * Copyright (c) 2010 Joerg Wunsch\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/dev/ieee488/tnt4882.h 203360 2010-02-01 21:21:10Z joerg $\n */\n\nenum tnt4882reg {\n\tdir = 0x00,\n\tcdor = 0x00,\n\tisr1 = 0x02,\n\timr1 = 0x02,\n\tisr2 = 0x04,\n\timr2 = 0x04,\n\taccwr = 0x05,\n\tspsr = 0x06,\n\tspmr = 0x06,\n\tintr = 0x07,\n\tadsr = 0x08,\n\tadmr = 0x08,\n\tcnt2 = 0x09,\n\tcptr = 0x0a,\n\tauxmr = 0x0a,\n\ttauxcr = 0x0a,\t/* 9914 mode register */\n\tcnt3 = 0x0b,\n\tadr0 = 0x0c,\n\tadr = 0x0c,\n\thssel = 0x0d,\n\tadr1 = 0x0e,\n\teosr = 0x0e,\n\tsts1 = 0x10,\n\tcfg = 0x10,\n\tdsr = 0x11,\n\tsh_cnt = 0x11,\n\timr3 = 0x12,\n\thier = 0x13,\n\tcnt0 = 0x14,\n\tmisc = 0x15,\n\tcnt1 = 0x16,\n\tcsr = 0x17,\n\tkeyreg = 0x17,\n\tfifob = 0x18,\n\tfifoa = 0x19,\n\tisr3 = 0x1a,\n\tccr = 0x1a,\n\tsasr = 0x1b,\n\tdcr = 0x1b,\n\tsts2 = 0x1c,\n\tcmdr = 0x1c,\n\tisr0 = 0x1d,\n\timr0 = 0x1d,\n\ttimer = 0x1e,\n\tbsr = 0x1f,\n\tbcr = 0x1f\n};\n\n"
  },
  {
    "path": "freebsd-headers/dev/ieee488/ugpib.h",
    "content": "/*-\n * Copyright (c) 2005 Poul-Henning Kamp <phk@FreeBSD.org>\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/dev/ieee488/ugpib.h 141777 2005-02-12 23:52:44Z phk $\n *\n */\n\n#ifndef _DEV_IEEE488_UGPIB_H_\n#define _DEV_IEEE488_UGPIB_H_\n\n/* ibfoo() return values */\n#define EDVR\t0\t\t/* System error\t\t\t\t*/\n#define ECIC\t1\t\t/* Not Active Controller\t\t*/\n#define ENOL\t2\t\t/* Nobody listening\t\t\t*/\n#define EADR\t3\t\t/* Controller not addressed\t\t*/\n#define EARG\t4\t\t/* Invalid argument\t\t\t*/\n#define ESAC\t5\t\t/* Not System Controller\t\t*/\n#define EABO\t6\t\t/* I/O Aborted/Time out\t\t\t*/\n#define ENEB\t7\t\t/* No such controller\t\t\t*/\n#define EOIP\t10\t\t/* Async I/O in progress\t\t*/\n#define ECAP\t11\t\t/* No such capability\t\t\t*/\n#define EFSO\t12\t\t/* File system error\t\t\t*/\n#define EBUS\t14\t\t/* Command byte xfer error\t\t*/\n#define ESTB\t15\t\t/* Serial poll status byte lost\t\t*/\n#define ESRQ\t16\t\t/* SRQ line stuck\t\t\t*/\n#define ETAB\t20\t\t/* Table problem\t\t\t*/\n\n/* ibsta bits */\n#define ERR\t(1<<15)\t\t/* Error\t\t\t\t*/\n#define TIMO\t(1<<14)\t\t/* Timeout\t\t\t\t*/\n#define END\t(1<<13)\t\t/* EOI/EOS\t\t\t\t*/\n#define SRQI\t(1<<12)\t\t/* SRQ\t\t\t\t\t*/\n#define RQS\t(1<<11)\t\t/* Device requests service\t\t*/\n#define SPOLL\t(1<<10)\t\t/* Serial Poll\t\t\t\t*/\n#define EVENT\t(1<<9)\t\t/* Event occured\t\t\t*/\n#define CMPL\t(1<<8)\t\t/* I/O complete\t\t\t\t*/\n#define LOK\t(1<<7)\t\t/* Lockout\t\t\t\t*/\n#define REM\t(1<<6)\t\t/* Remote\t\t\t\t*/\n#define CIC\t(1<<5)\t\t/* CIC\t\t\t\t\t*/\n#define ATN\t(1<<4)\t\t/* ATN\t\t\t\t\t*/\n#define TACS\t(1<<3)\t\t/* Talker\t\t\t\t*/\n#define LACS\t(1<<2)\t\t/* Listener\t\t\t\t*/\n#define DTAS\t(1<<1)\t\t/* Device trigger status\t\t*/\n#define DCAS\t(1<<0)\t\t/* Device clear state\t\t\t*/\n\n/* Timeouts */\n#define TNONE\t0\n#define T10us\t1\n#define T30us\t2\n#define T100us\t3\n#define T300us\t4\n#define T1ms\t5\n#define T3ms\t6\n#define T10ms\t7\n#define T30ms\t8\n#define T100ms\t9\n#define T300ms\t10\n#define T1s\t11\n#define T3s\t12\n#define T10s\t13\n#define T30s\t14\n#define T100s\t15\n#define T300s\t16\n#define T1000s\t17\n\n/* EOS bits */\n#define REOS\t(1 << 10)\n#define XEOS\t(1 << 11)\n#define BIN\t(1 << 12)\n\n/* Bus commands */\n#define GTL\t0x01\t\t/* Go To Local\t\t\t\t*/\n#define SDC\t0x04\t\t/* Selected Device Clear\t\t*/\n#define GET\t0x08\t\t/* Group Execute Trigger\t\t*/\n#define LAD\t0x20\t\t/* Listen address\t\t\t*/\n#define UNL\t0x3F\t\t/* Unlisten\t\t\t\t*/\n#define TAD\t0x40\t\t/* Talk address\t\t\t\t*/\n#define UNT\t0x5F\t\t/* Untalk\t\t\t\t*/\n\n#ifndef _KERNEL\n\nextern int ibcnt, iberr, ibsta;\n\nint ibask(int handle, int option, int *retval);\nint ibbna(int handle, char *bdname);\nint ibcac(int handle, int v);\nint ibclr(int handle);\nint ibcmd(int handle, void *buffer, long cnt);\nint ibcmda(int handle, void *buffer, long cnt);\nint ibconfig(int handle, int option, int value);\nint ibdev(int boardID, int pad, int sad, int tmo, int eot, int eos);\nint ibdiag(int handle, void *buffer, long cnt);\nint ibdma(int handle, int v);\nint ibeos(int handle, int eos);\nint ibeot(int handle, int eot);\nint ibevent(int handle, short *event);\nint ibfind(char *bdname);\nint ibgts(int handle, int v);\nint ibist(int handle, int v);\nint iblines(int handle, short *lines);\nint ibllo(int handle);\nint ibln(int handle, int padval, int sadval, short *listenflag);\nint ibloc(int handle);\nint ibonl(int handle, int v);\nint ibpad(int handle, int pad);\nint ibpct(int handle);\nint ibpoke(int handle, int option, int value);\nint ibppc(int handle, int v);\nint ibrd(int handle, void *buffer, long cnt);\nint ibrda(int handle, void *buffer, long cnt);\nint ibrdf(int handle, char *flname);\nint ibrdkey(int handle, void *buffer, int cnt);\nint ibrpp(int handle, char *ppr);\nint ibrsc(int handle, int v);\nint ibrsp(int handle, char *spr);\nint ibrsv(int handle, int v);\nint ibsad(int handle, int sad);\nint ibsgnl(int handle, int v);\nint ibsic(int handle);\nint ibsre(int handle, int v);\nint ibsrq(void (*func)(void));\nint ibstop(int handle);\nint ibtmo(int handle, int tmo);\nint ibtrap(int  mask, int mode);\nint ibtrg(int handle);\nint ibwait(int handle, int mask);\nint ibwrt(int handle, const void *buffer, long cnt);\nint ibwrta(int handle, const void *buffer, long cnt);\nint ibwrtf(int handle, const char *flname);\nint ibwrtkey(int handle, const void *buffer, int cnt);\nint ibxtrc(int handle, void *buffer, long cnt);\n#endif /* _KERNEL */\n#endif /* _DEV_IEEE488_UGPIB_H_ */\n"
  },
  {
    "path": "freebsd-headers/dev/ieee488/upd7210.h",
    "content": "/*-\n * Copyright (c) 2005 Poul-Henning Kamp <phk@FreeBSD.org>\n * Copyright (c) 2010 Joerg Wunsch <joerg@FreeBSD.org>\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/dev/ieee488/upd7210.h 203360 2010-02-01 21:21:10Z joerg $\n *\n * Locating an actual PD7210 data book has proven quite impossible for me.\n * There are a fair number of newer chips which are supersets of the PD7210\n * but they are particular eager to comprehensively mark what the extensions\n * are and what is in the base set.  Some even give the registers and their\n * bits new names.\n *\n * The following information is based on a description of the PD7210 found\n * in an old manual for a VME board which used the chip.\n */\n\n#ifndef _DEV_IEEE488_UPD7210_H_\n#define _DEV_IEEE488_UPD7210_H_\n#ifdef _KERNEL\n\nstruct upd7210;\nstruct ibfoo;\n\n/* upd7210 interface definitions for HW drivers */\n\ntypedef int upd7210_irq_t(struct upd7210 *, int);\n\nstruct upd7210 {\n\tstruct resource\t\t*reg_res[8];\n\tstruct resource\t\t*irq_clear_res;\n\tu_int\t\t\treg_offset[8];\n\tint\t\t\tdmachan;\n\tint\t\t\tunit;\n\tint\t\t\tuse_fifo;\n\n\t/* private stuff */\n\tstruct mtx\t\tmutex;\n\tuint8_t\t\t\trreg[8];\n\tuint8_t\t\t\twreg[8 + 8];\n\n\tupd7210_irq_t\t\t*irq;\n\n\tint\t\t\tbusy;\n\tu_char\t\t\t*buf;\n\tsize_t\t\t\tbufsize;\n\tu_int\t\t\tbuf_wp;\n\tu_int\t\t\tbuf_rp;\n\tstruct cdev\t\t*cdev;\n\n\tstruct ibfoo\t\t*ibfoo;\n};\n\n#ifdef UPD7210_HW_DRIVER\nvoid upd7210intr(void *);\nvoid upd7210attach(struct upd7210 *);\nvoid upd7210detach(struct upd7210 *);\n#endif\n\n#ifdef UPD7210_SW_DRIVER\n\n/* upd7210 hardware definitions. */\n\n/* Write registers */\nenum upd7210_wreg {\n\tCDOR\t= 0,\t\t\t/* Command/Data Out Register\t*/\n\tIMR1\t= 1,\t\t\t/* Interrupt Mask Register 1\t*/\n\tIMR2\t= 2,\t\t\t/* Interrupt Mask Register 2\t*/\n\tSPMR\t= 3,\t\t\t/* Serial Poll Mode Register\t*/\n\tADMR\t= 4,\t\t\t/* ADdress Mode Register\t*/\n\tAUXMR\t= 5,\t\t\t/* AUXilliary Mode Register\t*/\n\tICR\t= 5,\t\t\t/* Internal Counter Register\t*/\n\tPPR\t= 5,\t\t\t/* Parallel Poll Register\t*/\n\tAUXRA\t= 5,\t\t\t/* AUXilliary Register A\t*/\n\tAUXRB\t= 5,\t\t\t/* AUXilliary Register B\t*/\n\tAUXRE\t= 5,\t\t\t/* AUXilliary Register E\t*/\n\tADR\t= 6,\t\t\t/* ADdress Register\t\t*/\n\tEOSR\t= 7,\t\t\t/* End-Of-String Register\t*/\n};\n\n/* Read registers */\nenum upd7210_rreg {\n\tDIR\t= 0,\t\t\t/* Data In Register\t\t*/\n\tISR1\t= 1,\t\t\t/* Interrupt Status Register 1\t*/\n\tISR2\t= 2,\t\t\t/* Interrupt Status Register 2\t*/\n\tSPSR\t= 3,\t\t\t/* Serial Poll Status Register\t*/\n\tADSR\t= 4,\t\t\t/* ADdress Status Register\t*/\n\tCPTR\t= 5,\t\t\t/* Command Pass Though Register\t*/\n\tADR0\t= 6,\t\t\t/* ADdress Register 0\t\t*/\n\tADR1\t= 7,\t\t\t/* ADdress Register 1\t\t*/\n};\n\n/* Bits for ISR1 and IMR1 */\n#define IXR1_DI\t\t(1 << 0)\t/* Data In\t\t\t*/\n#define IXR1_DO\t\t(1 << 1)\t/* Data Out\t\t\t*/\n#define IXR1_ERR\t(1 << 2)\t/* Error\t\t\t*/\n#define IXR1_DEC\t(1 << 3)\t/* Device Clear\t\t\t*/\n#define IXR1_ENDRX\t(1 << 4)\t/* End Received\t\t\t*/\n#define IXR1_DET\t(1 << 5)\t/* Device Execute Trigger\t*/\n#define IXR1_APT\t(1 << 6)\t/* Address Pass-Through\t\t*/\n#define IXR1_CPT\t(1 << 7)\t/* Command Pass-Through\t\t*/\n\n/* Bits for ISR2 and IMR2 */\n#define IXR2_ADSC\t(1 << 0)\t/* Addressed Status Change\t*/\n#define IXR2_REMC\t(1 << 1)\t/* Remote Change\t\t*/\n#define IXR2_LOKC\t(1 << 2)\t/* Lockout Change\t\t*/\n#define IXR2_CO\t\t(1 << 3)\t/* Command Out\t\t\t*/\n#define ISR2_REM\t(1 << 4)\t/* Remove\t\t\t*/\n#define IMR2_DMAI\t(1 << 4)\t/* DMA In Enable\t\t*/\n#define ISR2_LOK\t(1 << 5)\t/* Lockout\t\t\t*/\n#define IMR2_DMAO\t(1 << 5)\t/* DMA Out Enable\t\t*/\n#define IXR2_SRQI\t(1 << 6)\t/* Service Request Input\t*/\n#define ISR2_INT\t(1 << 7)\t/* Interrupt\t\t\t*/\n\n#define SPSR_PEND\t(1 << 6)\t/* Pending\t\t\t*/\n#define SPMR_RSV\t(1 << 6)\t/* Request SerVice\t\t*/\n\n#define ADSR_MJMN\t(1 << 0)\t/* MaJor MiNor\t\t\t*/\n#define ADSR_TA\t\t(1 << 1)\t/* Talker Active\t\t*/\n#define ADSR_LA\t\t(1 << 2)\t/* Listener Active\t\t*/\n#define ADSR_TPAS\t(1 << 3)\t/* Talker Primary Addr. State\t*/\n#define ADSR_LPAS\t(1 << 4)\t/* Listener Primary Addr. State\t*/\n#define ADSR_SPMS\t(1 << 5)\t/* Serial Poll Mode State\t*/\n#define ADSR_ATN\t(1 << 6)\t/* Attention\t\t\t*/\n#define ADSR_CIC\t(1 << 7)\t/* Controller In Charge\t\t*/\n\n#define ADMR_ADM0\t(1 << 0)\t/* Address Mode 0\t\t*/\n#define ADMR_ADM1\t(1 << 1)\t/* Address Mode 1\t\t*/\n#define ADMR_TRM0\t(1 << 4)\t/* Transmit/Receive Mode 0\t*/\n#define ADMR_TRM1\t(1 << 5)\t/* Transmit/Receive Mode 1\t*/\n#define ADMR_LON\t(1 << 6)\t/* Listen Only\t\t\t*/\n#define ADMR_TON\t(1 << 7)\t/* Talk Only\t\t\t*/\n\n/* Constant part of overloaded write registers */\n#define\tC_ICR\t\t0x20\n#define\tC_PPR\t\t0x60\n#define\tC_AUXA\t\t0x80\n#define\tC_AUXB\t\t0xa0\n#define\tC_AUXE\t\t0xc0\n\n#define AUXMR_PON\t0x00\t\t/* Immediate Execute pon\t*/\n#define AUXMR_CPP\t0x01\t\t/* Clear Parallel Poll\t\t*/\n#define AUXMR_CRST\t0x02\t\t/* Chip Reset\t\t\t*/\n#define AUXMR_RFD\t0x03\t\t/* Finish Handshake\t\t*/\n#define AUXMR_TRIG\t0x04\t\t/* Trigger\t\t\t*/\n#define AUXMR_RTL\t0x05\t\t/* Return to local\t\t*/\n#define AUXMR_SEOI\t0x06\t\t/* Send EOI\t\t\t*/\n#define AUXMR_NVSA\t0x07\t\t/* Non-Valid Secondary cmd/addr\t*/\n\t\t\t\t\t/* 0x08 undefined/unknown\t*/\n#define AUXMR_SPP\t0x09\t\t/* Set Parallel Poll\t\t*/\n\t\t\t\t\t/* 0x0a undefined/unknown\t*/\n\t\t\t\t\t/* 0x0b undefined/unknown\t*/\n\t\t\t\t\t/* 0x0c undefined/unknown\t*/\n\t\t\t\t\t/* 0x0d undefined/unknown\t*/\n\t\t\t\t\t/* 0x0e undefined/unknown\t*/\n#define AUXMR_VSA\t0x0f\t\t/* Valid Secondary cmd/addr\t*/\n#define AUXMR_GTS\t0x10\t\t/* Go to Standby\t\t*/\n#define AUXMR_TCA\t0x11\t\t/* Take Control Async (pulsed)\t*/\n#define AUXMR_TCS\t0x12\t\t/* Take Control Synchronously\t*/\n#define AUXMR_LISTEN\t0x13\t\t/* Listen\t\t\t*/\n#define AUXMR_DSC\t0x14\t\t/* Disable System Control\t*/\n\t\t\t\t\t/* 0x15 undefined/unknown\t*/\n#define AUXMR_SIFC\t0x16\t\t/* Set IFC\t\t\t*/\n#define AUXMR_CREN\t0x17\t\t/* Clear REN\t\t\t*/\n\t\t\t\t\t/* 0x18 undefined/unknown\t*/\n\t\t\t\t\t/* 0x19 undefined/unknown\t*/\n#define AUXMR_TCSE\t0x1a\t\t/* Take Control Sync on End\t*/\n#define AUXMR_LCM\t0x1b\t\t/* Listen Continuously Mode\t*/\n#define AUXMR_LUNL\t0x1c\t\t/* Local Unlisten\t\t*/\n#define AUXMR_EPP\t0x1d\t\t/* Execute Parallel Poll\t*/\n#define AUXMR_CIFC\t0x1e\t\t/* Clear IFC\t\t\t*/\n#define AUXMR_SREN\t0x1f\t\t/* Set REN\t\t\t*/\n\n#define PPR_U\t\t(1 << 4)\t/* Unconfigure\t\t\t*/\n#define PPR_S\t\t(1 << 3)\t/* Status Polarity\t\t*/\n\n#define AUXA_HLDA\t(1 << 0)\t/* Holdoff on All\t\t*/\n#define AUXA_HLDE\t(1 << 1)\t/* Holdoff on END\t\t*/\n#define AUXA_REOS\t(1 << 2)\t/* End on EOS received\t\t*/\n#define AUXA_XEOS\t(1 << 3)\t/* Transmit END with EOS\t*/\n#define AUXA_BIN\t(1 << 4)\t/* Binary\t\t\t*/\n\n#define AUXB_CPTE\t(1 << 0)\t/* Cmd Pass Through Enable\t*/\n#define AUXB_SPEOI\t(1 << 1)\t/* Send Serial Poll EOI\t\t*/\n#define AUXB_TRI\t(1 << 2)\t/* Three-State Timing\t\t*/\n#define AUXB_INV\t(1 << 3)\t/* Invert\t\t\t*/\n#define AUXB_ISS\t(1 << 4)\t/* Individual Status Select\t*/\n\n#define AUXE_DHDT\t(1 << 0)\t/* DAC Holdoff on DTAS\t\t*/\n#define AUXE_DHDC\t(1 << 1)\t/* DAC Holdoff on DCAS\t\t*/\n\n#define ADR0_DL0\t(1 << 5)\t/* Disable Listener 0\t\t*/\n#define ADR0_DT0\t(1 << 6)\t/* Disable Talker 0\t\t*/\n\n#define ADR_DL\t\t(1 << 5)\t/* Disable Listener\t\t*/\n#define ADR_DT\t\t(1 << 6)\t/* Disable Talker\t\t*/\n#define ADR_ARS\t\t(1 << 7)\t/* Address Register Select\t*/\n\n#define ADR1_DL1\t(1 << 5)\t/* Disable Listener 1\t\t*/\n#define ADR1_DT1\t(1 << 6)\t/* Disable Talker 1\t\t*/\n#define ADR1_EOI\t(1 << 7)\t/* End or Identify\t\t*/\n\n/* Stuff from software drivers */\nextern struct cdevsw gpib_ib_cdevsw;\n\n/* Stuff from upd7210.c */\nvoid upd7210_print_isr(u_int isr1, u_int isr2);\nu_int upd7210_rd(struct upd7210 *u, enum upd7210_rreg reg);\nvoid upd7210_wr(struct upd7210 *u, enum upd7210_wreg reg, u_int val);\nint upd7210_take_ctrl_async(struct upd7210 *u);\nint upd7210_goto_standby(struct upd7210 *u);\n\n#endif /* UPD7210_SW_DRIVER */\n\n#endif /* _KERNEL */\n#endif /* _DEV_IEEE488_UPD7210_H_ */\n"
  },
  {
    "path": "freebsd-headers/dev/iicbus/iic.h",
    "content": "/*-\n * Copyright (c) 1998 Nicolas Souchu\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/dev/iicbus/iic.h 210998 2010-08-07 08:31:32Z joel $\n *\n */\n#ifndef __IIC_H\n#define __IIC_H\n\n#include <sys/ioccom.h>\n\n/* Designed to be compatible with linux's struct i2c_msg */\nstruct iic_msg\n{\n\tuint16_t\tslave;\n\tuint16_t\tflags;\n#define\tIIC_M_WR\t0\t/* Fake flag for write */\n#define\tIIC_M_RD\t0x0001\t/* read vs write */\n#define\tIIC_M_NOSTOP\t0x0002\t/* do not send a I2C stop after message */\n#define\tIIC_M_NOSTART\t0x0004\t/* do not send a I2C start before message */\n\tuint16_t\tlen;\t/* msg length */\n\tuint8_t *\tbuf;\n};\n\nstruct iiccmd {\n\tu_char slave;\n\tint count;\n\tint last;\n\tchar *buf;\n};\n\nstruct iic_rdwr_data {\n\tstruct iic_msg *msgs;\n\tuint32_t nmsgs;\n};\n\n#define I2CSTART\t_IOW('i', 1, struct iiccmd)\t/* start condition */\n#define I2CSTOP\t\t_IO('i', 2)\t\t\t/* stop condition */\n#define I2CRSTCARD\t_IOW('i', 3, struct iiccmd)\t/* reset the card */\n#define I2CWRITE\t_IOW('i', 4, struct iiccmd)\t/* send data */\n#define I2CREAD\t\t_IOW('i', 5, struct iiccmd)\t/* receive data */\n#define I2CRDWR\t\t_IOW('i', 6, struct iic_rdwr_data)\t/* General read/write interface */\n#define I2CRPTSTART\t_IOW('i', 7, struct iiccmd)\t/* repeated start */\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/dev/iicbus/iicbus.h",
    "content": "/*-\n * Copyright (c) 1998 Nicolas Souchu\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/dev/iicbus/iicbus.h 181304 2008-08-04 21:03:06Z jhb $\n *\n */\n#ifndef __IICBUS_H\n#define __IICBUS_H\n\n#include <sys/_lock.h>\n#include <sys/_mutex.h>\n\n#define IICBUS_IVAR(d) (struct iicbus_ivar *) device_get_ivars(d)\n#define IICBUS_SOFTC(d) (struct iicbus_softc *) device_get_softc(d)\n\nstruct iicbus_softc\n{\n\tdevice_t dev;\t\t/* Myself */\n\tdevice_t owner;\t\t/* iicbus owner device structure */\n\tu_char started;\t\t/* address of the 'started' slave\n\t\t\t\t * 0 if no start condition succeeded */\n\tstruct mtx lock;\n};\n\nstruct iicbus_ivar\n{\n\tuint32_t\taddr;\n};\n\nenum {\n\tIICBUS_IVAR_ADDR\t\t/* Address or base address */\n};\n\n#define IICBUS_ACCESSOR(A, B, T)\t\t\t\t\t\\\n\t__BUS_ACCESSOR(iicbus, A, IICBUS, B, T)\n\t\nIICBUS_ACCESSOR(addr,\t\tADDR,\t\tuint32_t)\n\n#define\tIICBUS_LOCK(sc)\t\t\tmtx_lock(&(sc)->lock)\n#define\tIICBUS_UNLOCK(sc)      \t\tmtx_unlock(&(sc)->lock)\n#define\tIICBUS_ASSERT_LOCKED(sc)       \tmtx_assert(&(sc)->lock, MA_OWNED)\n\nextern int iicbus_generic_intr(device_t dev, int event, char *buf);\n\nextern driver_t iicbus_driver;\nextern devclass_t iicbus_devclass;\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/dev/iicbus/iiconf.h",
    "content": "/*-\n * Copyright (c) 1998, 2001 Nicolas Souchu\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/dev/iicbus/iiconf.h 164901 2006-12-05 06:19:36Z imp $\n */\n#ifndef __IICONF_H\n#define __IICONF_H\n\n#include <sys/queue.h>\n#include <dev/iicbus/iic.h>\n\n\n#define IICPRI (PZERO+8)\t\t/* XXX sleep/wakeup queue priority */\n\n#define LSB 0x1\n\n/*\n * How tsleep() is called in iic_request_bus().\n */\n#define IIC_DONTWAIT\t0\n#define IIC_NOINTR\t0\n#define IIC_WAIT\t0x1\n#define IIC_INTR\t0x2\n\n/*\n * i2c modes\n */\n#define IIC_MASTER\t0x1\n#define IIC_SLAVE\t0x2\n#define IIC_POLLED\t0x4\n\n/*\n * i2c speed\n */\n#define IIC_UNKNOWN\t0x0\n#define IIC_SLOW\t0x1\n#define IIC_FAST\t0x2\n#define IIC_FASTEST\t0x3\n\n#define IIC_LAST_READ\t0x1\n\n/*\n * callback index\n */\n#define IIC_REQUEST_BUS\t0x1\n#define IIC_RELEASE_BUS\t0x2\n\n/*\n * interrupt events\n */\n#define INTR_GENERAL\t0x1\t/* general call received */\n#define INTR_START\t0x2\t/* the I2C interface is addressed */\n#define INTR_STOP\t0x3\t/* stop condition received */\n#define INTR_RECEIVE\t0x4\t/* character received */\n#define INTR_TRANSMIT\t0x5\t/* character to transmit */\n#define INTR_ERROR\t0x6\t/* error */\n#define INTR_NOACK\t0x7\t/* no ack from master receiver */\n\n/*\n * adapter layer errors\n */\n#define IIC_NOERR\t0x0\t/* no error occured */\n#define IIC_EBUSERR\t0x1\t/* bus error */\n#define IIC_ENOACK\t0x2\t/* ack not received until timeout */\n#define IIC_ETIMEOUT\t0x3\t/* timeout */\n#define IIC_EBUSBSY\t0x4\t/* bus busy */\n#define IIC_ESTATUS\t0x5\t/* status error */\n#define IIC_EUNDERFLOW\t0x6\t/* slave ready for more data */\n#define IIC_EOVERFLOW\t0x7\t/* too much data */\n#define IIC_ENOTSUPP\t0x8\t/* request not supported */\n#define IIC_ENOADDR\t0x9\t/* no address assigned to the interface */\n\nextern int iicbus_request_bus(device_t, device_t, int);\nextern int iicbus_release_bus(device_t, device_t);\nextern device_t iicbus_alloc_bus(device_t);\n\nextern void iicbus_intr(device_t, int, char *);\n\nextern int iicbus_null_repeated_start(device_t, u_char);\nextern int iicbus_null_callback(device_t, int, caddr_t);\n\n#define iicbus_reset(bus,speed,addr,oldaddr) \\\n\t(IICBUS_RESET(device_get_parent(bus), speed, addr, oldaddr))\n\n/* basic I2C operations */\nextern int iicbus_started(device_t);\nextern int iicbus_start(device_t, u_char, int);\nextern int iicbus_stop(device_t);\nextern int iicbus_repeated_start(device_t, u_char, int);\nextern int iicbus_write(device_t, const char *, int, int *, int);\nextern int iicbus_read(device_t, char *, int, int *, int, int);\n\n/* single byte read/write functions, start/stop not managed */\nextern int iicbus_write_byte(device_t, char, int);\nextern int iicbus_read_byte(device_t, char *, int);\n\n/* Read/write operations with start/stop conditions managed */\nextern int iicbus_block_write(device_t, u_char, char *, int, int *);\nextern int iicbus_block_read(device_t, u_char, char *, int, int *);\n\n/* vectors of iic operations to pass to bridge */\nint iicbus_transfer(device_t bus, struct iic_msg *msgs, uint32_t nmsgs);\nint iicbus_transfer_gen(device_t bus, struct iic_msg *msgs, uint32_t nmsgs);\n\n#define IICBUS_MODVER\t1\n#define IICBUS_MINVER\t1\n#define IICBUS_MAXVER\t1\n#define IICBUS_PREFVER\tIICBUS_MODVER\n\nextern driver_t iicbb_driver;\nextern devclass_t iicbb_devclass;\n\n#define IICBB_MODVER\t1\n#define IICBB_MINVER\t1\n#define IICBB_MAXVER\t1\n#define IICBB_PREFVER\tIICBB_MODVER\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/dev/io/iodev.h",
    "content": "/*-\n * Copyright (c) 2010 Marcel Moolenaar\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/dev/io/iodev.h 207329 2010-04-28 15:38:01Z attilio $\n */\n\n#ifndef _DEV_IODEV_H_\n#define\t_DEV_IODEV_H_\n\n#define\tIODEV_PIO_READ\t\t0\n#define\tIODEV_PIO_WRITE\t\t1\n\nstruct iodev_pio_req {\n\tu_int access;\n\tu_int port;\n\tu_int width;\n\tu_int val;\n};\n\n#define\tIODEV_PIO\t_IOWR('I', 0, struct iodev_pio_req)\n\n#endif /* _DEV_IODEV_H_ */\n"
  },
  {
    "path": "freebsd-headers/dev/lmc/if_lmc.h",
    "content": "/*\n * $FreeBSD: release/9.0.0/sys/dev/lmc/if_lmc.h 199538 2009-11-19 18:21:51Z jhb $\n *\n * Copyright (c) 2002-2004 David Boggs. (boggs@boggs.palo-alto.ca.us)\n * All rights reserved.\n *\n * BSD License:\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * GNU General Public License:\n *\n * This program is free software; you can redistribute it and/or modify it \n * under the terms of the GNU General Public License as published by the Free \n * Software Foundation; either version 2 of the License, or (at your option) \n * any later version.\n * \n * This program is distributed in the hope that it will be useful, but WITHOUT \n * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or \n * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for \n * more details.\n *\n * You should have received a copy of the GNU General Public License along with\n * this program; if not, write to the Free Software Foundation, Inc., 59 \n * Temple Place - Suite 330, Boston, MA  02111-1307, USA.\n */\n\f\n#ifndef IF_LMC_H\n#define IF_LMC_H\n\n#define DEVICE_NAME\t\t\"lmc\"\n\n/* Linux RPM-style version information */\n#define DRIVER_MAJOR_VERSION\t2005\t/* year */\n#define DRIVER_MINOR_VERSION\t9\t/* month */\n#define DRIVER_SUB_VERSION\t29\t/* day */\n\n/* netgraph stuff */\n#define NG_LMC_NODE_TYPE\tDEVICE_NAME\n#define NGM_LMC_COOKIE\t\t1128054761\t/* date -u +'%s' */\n\n/* Tulip PCI configuration registers */\n#define\tTLP_CFID\t\t0x00\t\t/*  0: CFg ID register     */\n#define\tTLP_CFCS\t\t0x04\t\t/*  1: CFg Command/Status  */\n#define\tTLP_CFRV\t\t0x08\t\t/*  2: CFg ReVision        */\n#define\tTLP_CFLT\t\t0x0C\t\t/*  3: CFg Latency Timer   */\n#define\tTLP_CBIO\t\t0x10\t\t/*  4: Cfg Base IO address */\n#define\tTLP_CBMA\t\t0x14\t\t/*  5: Cfg Base Mem Addr   */\n#define TLP_CSID\t\t0x2C\t\t/* 11: Cfg Subsys ID reg   */\n#define\tTLP_CFIT\t\t0x3C\t\t/* 15: CFg InTerrupt       */\n#define\tTLP_CFDD\t\t0x40\t\t/* 16: CFg Driver Data     */\n\n#define TLP_CFID_TULIP\t\t0x00091011\t/* DEC 21140A Ethernet chip */\n\n#define TLP_CFCS_MSTR_ABORT\t0x20000000\n#define TLP_CFCS_TARG_ABORT\t0x10000000\n#define TLP_CFCS_SYS_ERROR\t0x00000100\n#define TLP_CFCS_PAR_ERROR\t0x00000040\n#define TLP_CFCS_MWI_ENABLE\t0x00000010\n#define TLP_CFCS_BUS_MASTER\t0x00000004\n#define TLP_CFCS_MEM_ENABLE\t0x00000002\n#define TLP_CFCS_IO_ENABLE\t0x00000001\n\n#define TLP_CFLT_LATENCY\t0x0000FF00\n#define TLP_CFLT_CACHE\t\t0x000000FF\n\n#define TLP_CSID_HSSI\t\t0x00031376\t/* LMC 5200 HSSI card */\n#define TLP_CSID_T3\t\t0x00041376\t/* LMC 5245 T3   card */\n#define TLP_CSID_SSI\t\t0x00051376\t/* LMC 1000 SSI  card */\n#define TLP_CSID_T1E1\t\t0x00061376\t/* LMC 1200 T1E1 card */\n#define TLP_CSID_HSSIc\t\t0x00071376\t/* LMC 5200 HSSI cPCI */\n#define TLP_CSID_SDSL\t\t0x00081376\t/* LMC 1168 SDSL card */\n\n#define TLP_CFIT_MAX_LAT\t0xFF000000\n\n#define TLP_CFDD_SLEEP\t\t0x80000000\n#define TLP_CFDD_SNOOZE\t\t0x40000000\n\n/* Tulip Control and Status Registers */\n#define TLP_CSR_STRIDE\t\t 8\t\t/* 64 bits */\n#define TLP_BUS_MODE\t\t 0 * TLP_CSR_STRIDE\n#define TLP_TX_POLL\t\t 1 * TLP_CSR_STRIDE\n#define TLP_RX_POLL\t\t 2 * TLP_CSR_STRIDE\n#define TLP_RX_LIST\t\t 3 * TLP_CSR_STRIDE\n#define TLP_TX_LIST\t\t 4 * TLP_CSR_STRIDE\n#define TLP_STATUS\t\t 5 * TLP_CSR_STRIDE\n#define TLP_OP_MODE\t\t 6 * TLP_CSR_STRIDE\n#define TLP_INT_ENBL\t\t 7 * TLP_CSR_STRIDE\n#define TLP_MISSED\t\t 8 * TLP_CSR_STRIDE\n#define TLP_SROM_MII\t\t 9 * TLP_CSR_STRIDE\n#define TLP_BIOS_ROM\t\t10 * TLP_CSR_STRIDE\n#define TLP_TIMER\t\t11 * TLP_CSR_STRIDE\n#define TLP_GPIO\t\t12 * TLP_CSR_STRIDE\n#define TLP_CSR13\t\t13 * TLP_CSR_STRIDE\n#define TLP_CSR14\t\t14 * TLP_CSR_STRIDE\n#define TLP_WDOG\t\t15 * TLP_CSR_STRIDE\n#define TLP_CSR_SIZE\t\t128\t\t/* IO bus space size */\n\n/* CSR 0 - PCI Bus Mode Register */\n#define TLP_BUS_WRITE_INVAL\t0x01000000 /* DONT USE! */\n#define TLP_BUS_READ_LINE\t0x00800000\n#define TLP_BUS_READ_MULT\t0x00200000\n#define TLP_BUS_DESC_BIGEND\t0x00100000\n#define TLP_BUS_TAP\t\t0x000E0000\n#define TLP_BUS_CAL\t\t0x0000C000\n#define TLP_BUS_PBL\t\t0x00003F00\n#define TLP_BUS_DATA_BIGEND\t0x00000080\n#define TLP_BUS_DSL\t\t0x0000007C\n#define TLP_BUS_ARB\t\t0x00000002\n#define TLP_BUS_RESET\t\t0x00000001\n#define TLP_BUS_CAL_SHIFT\t14\n#define TLP_BUS_PBL_SHIFT\t 8\n\n/* CSR 5 - Status Register */\n#define TLP_STAT_FATAL_BITS\t0x03800000\n#define TLP_STAT_TX_FSM\t\t0x00700000\n#define TLP_STAT_RX_FSM\t\t0x000E0000\n#define TLP_STAT_FATAL_ERROR\t0x00002000\n#define TLP_STAT_TX_UNDERRUN\t0x00000020\n#define TLP_STAT_FATAL_SHIFT\t23\n\n/* CSR 6 - Operating Mode Register */\n#define TLP_OP_RECEIVE_ALL\t0x40000000\n#define TLP_OP_MUST_BE_ONE\t0x02000000\n#define TLP_OP_NO_HEART_BEAT\t0x00080000\n#define TLP_OP_PORT_SELECT\t0x00040000\n#define TLP_OP_TX_THRESH\t0x0000C000\n#define TLP_OP_TX_RUN\t\t0x00002000\n#define TLP_OP_LOOP_MODE\t0x00000C00\n#define TLP_OP_EXT_LOOP\t\t0x00000800\n#define TLP_OP_INT_LOOP\t\t0x00000400\n#define TLP_OP_FULL_DUPLEX\t0x00000200\n#define TLP_OP_PROMISCUOUS\t0x00000040\n#define TLP_OP_PASS_BAD_PKT\t0x00000008\n#define TLP_OP_RX_RUN\t\t0x00000002\n#define TLP_OP_TR_SHIFT\t\t14\n#define TLP_OP_INIT\t\t(TLP_OP_PORT_SELECT   | \\\n\t\t\t\t TLP_OP_FULL_DUPLEX   | \\\n\t\t\t\t TLP_OP_MUST_BE_ONE   | \\\n\t\t\t\t TLP_OP_NO_HEART_BEAT | \\\n\t\t\t\t TLP_OP_RECEIVE_ALL   | \\\n\t\t\t\t TLP_OP_PROMISCUOUS   | \\\n\t\t\t\t TLP_OP_PASS_BAD_PKT  | \\\n\t\t\t\t TLP_OP_RX_RUN        | \\\n\t\t\t\t TLP_OP_TX_RUN)\n\n/* CSR 7 - Interrupt Enable Register */\n#define TLP_INT_NORMAL_INTR\t0x00010000\n#define TLP_INT_ABNRML_INTR\t0x00008000\n#define TLP_INT_FATAL_ERROR\t0x00002000\n#define TLP_INT_RX_NO_BUFS\t0x00000080\n#define TLP_INT_RX_INTR\t\t0x00000040\n#define TLP_INT_TX_UNDERRUN\t0x00000020\n#define TLP_INT_TX_INTR\t\t0x00000001\n#define TLP_INT_DISABLE\t\t0\n#define TLP_INT_TX\t\t(TLP_INT_NORMAL_INTR | \\\n\t\t\t\t TLP_INT_ABNRML_INTR | \\\n\t\t\t\t TLP_INT_FATAL_ERROR | \\\n\t\t\t\t TLP_INT_TX_UNDERRUN | \\\n\t\t\t\t TLP_INT_TX_INTR)\n#define TLP_INT_RX\t\t(TLP_INT_NORMAL_INTR | \\\n\t\t\t\t TLP_INT_ABNRML_INTR | \\\n\t\t\t\t TLP_INT_FATAL_ERROR | \\\n\t\t\t\t TLP_INT_RX_NO_BUFS  | \\\n\t\t\t\t TLP_INT_RX_INTR)\n#define TLP_INT_TXRX\t\t(TLP_INT_TX | TLP_INT_RX)\n\n/* CSR 8 - RX Missed Frames & Overrun Register */\n#define TLP_MISS_OCO\t\t0x10000000\n#define TLP_MISS_OVERRUN\t0x0FFE0000\n#define TLP_MISS_MFO\t\t0x00010000\n#define TLP_MISS_MISSED\t\t0x0000FFFF\n#define TLP_OVERRUN_SHIFT\t17\n\n/* CSR 9 - SROM & MII & Boot ROM Register */\n#define TLP_MII_MDIN\t\t0x00080000\n#define TLP_MII_MDOE\t\t0x00040000\n#define TLP_MII_MDOUT\t\t0x00020000\n#define TLP_MII_MDC\t\t0x00010000\n\n#define TLP_BIOS_RD\t\t0x00004000\n#define TLP_BIOS_WR\t\t0x00002000\n#define TLP_BIOS_SEL\t\t0x00001000\n\n#define TLP_SROM_RD\t\t0x00004000\n#define TLP_SROM_SEL\t\t0x00000800\n#define TLP_SROM_DOUT\t\t0x00000008\n#define TLP_SROM_DIN\t\t0x00000004\n#define TLP_SROM_CLK\t\t0x00000002\n#define TLP_SROM_CS\t\t0x00000001\n\n/* CSR 12 - General Purpose IO register */\n#define TLP_GPIO_DIR\t\t0x00000100\n\n/* CSR 15 - Watchdog Timer Register */\n#define TLP_WDOG_RX_OFF\t\t0x00000010\n#define TLP_WDOG_TX_OFF\t\t0x00000001\n#define TLP_WDOG_INIT\t\t(TLP_WDOG_TX_OFF | \\\n\t\t\t\t TLP_WDOG_RX_OFF)\n\n/* GPIO bits common to all cards */\n#define GPIO_INIT\t\t0x01\t/*    from Xilinx                  */\n#define GPIO_RESET\t\t0x02\t/* to      Xilinx                  */\n/* bits 2 and 3 vary with board type -- see below */\n#define GPIO_MODE\t\t0x10\t/* to      Xilinx                  */\n#define GPIO_DP\t\t\t0x20\t/* to/from Xilinx                  */\n#define GPIO_DATA\t\t0x40\t/* serial data                     */\n#define GPIO_CLK\t\t0x80\t/* serial clock                    */\n\n/* HSSI GPIO bits */\n#define GPIO_HSSI_ST\t\t0x04\t/* send timing sense (deprecated)  */\n#define GPIO_HSSI_TXCLK\t\t0x08\t/* clock source                    */\n\n/* HSSIc GPIO bits */\n#define GPIO_HSSI_SYNTH\t\t0x04\t/* Synth osc chip select           */\n#define GPIO_HSSI_DCE\t\t0x08\t/* provide clock on TXCLOCK output */\n\n/* T3   GPIO bits */\n#define GPIO_T3_DAC\t\t0x04\t/* DAC chip select                 */\n#define GPIO_T3_INTEN\t\t0x08\t/* Framer Interupt enable          */\n\n/* SSI  GPIO bits */\n#define GPIO_SSI_SYNTH\t\t0x04\t/* Synth osc chip select           */\n#define GPIO_SSI_DCE\t\t0x08\t/* provide clock on TXCLOCK output */\n\n/* T1E1 GPIO bits */\n#define GPIO_T1_INTEN\t\t0x08\t/* Framer Interupt enable          */\n\n/* MII register 16 bits common to all cards */\n/* NB: LEDs  for HSSI & SSI are in DIFFERENT bits than for T1E1 & T3; oops */\n/* NB: CRC32 for HSSI & SSI is  in DIFFERENT bit  than for T1E1 & T3; oops */\n#define MII16_LED_ALL\t\t0x0780\t/* RW: LED bit mask                */\n#define MII16_FIFO\t\t0x0800\t/* RW: 1=reset, 0=not reset        */\n\n/* MII register 16 bits for HSSI */\n#define MII16_HSSI_TA\t\t0x0001\t/* RW: host ready;  host->modem    */\n#define MII16_HSSI_CA\t\t0x0002\t/* RO: modem ready; modem->host    */\n#define MII16_HSSI_LA\t\t0x0004\t/* RW: loopback A;  host->modem    */\n#define MII16_HSSI_LB\t\t0x0008\t/* RW: loopback B;  host->modem    */\n#define MII16_HSSI_LC\t\t0x0010\t/* RO: loopback C;  modem->host    */\n#define MII16_HSSI_TM\t\t0x0020\t/* RO: test mode;   modem->host    */\n#define MII16_HSSI_CRC32\t0x0040\t/* RW: CRC length 16/32            */\n#define MII16_HSSI_LED_LL\t0x0080\t/* RW: lower left  - green         */\n#define MII16_HSSI_LED_LR\t0x0100\t/* RW: lower right - green         */\n#define MII16_HSSI_LED_UL\t0x0200\t/* RW: upper left  - green         */\n#define MII16_HSSI_LED_UR\t0x0400\t/* RW: upper right - red           */\n#define MII16_HSSI_FIFO\t\t0x0800\t/* RW: reset fifos                 */\n#define MII16_HSSI_FORCECA\t0x1000\t/* RW: [cPCI] force CA on          */\n#define MII16_HSSI_CLKMUX\t0x6000  /* RW: [cPCI] TX clock selection   */\n#define MII16_HSSI_LOOP\t\t0x8000\t/* RW: [cPCI] LOOP TX into RX      */\n#define MII16_HSSI_MODEM\t0x003F\t/* TA+CA+LA+LB+LC+TM               */\n\n/* MII register 16 bits for DS3 */\n#define MII16_DS3_ZERO\t\t0x0001\t/* RW: short/long cables           */\n#define MII16_DS3_TRLBK\t\t0x0002\t/* RW: loop towards host           */\n#define MII16_DS3_LNLBK\t\t0x0004\t/* RW: loop towards net            */\n#define MII16_DS3_RAIS\t\t0x0008\t/* RO: LIU receive AIS      (depr) */\n#define MII16_DS3_TAIS\t\t0x0010\t/* RW: LIU transmit AIS     (depr) */\n#define MII16_DS3_BIST\t\t0x0020\t/* RO: LIU QRSS patt match  (depr) */\n#define MII16_DS3_DLOS\t\t0x0040\t/* RO: LIU Digital LOS      (depr) */\n#define MII16_DS3_LED_BLU\t0x0080\t/* RW: lower right - blue          */\n#define MII16_DS3_LED_YEL\t0x0100\t/* RW: lower left  - yellow        */\n#define MII16_DS3_LED_RED\t0x0200\t/* RW: upper right - red           */\n#define MII16_DS3_LED_GRN\t0x0400\t/* RW: upper left  - green         */\n#define MII16_DS3_FIFO\t\t0x0800\t/* RW: reset fifos                 */\n#define MII16_DS3_CRC32\t\t0x1000\t/* RW: CRC length 16/32            */\n#define MII16_DS3_SCRAM\t\t0x2000\t/* RW: payload scrambler           */\n#define MII16_DS3_POLY\t\t0x4000\t/* RW: 1=Larse, 0=DigLink|Kentrox  */\n#define MII16_DS3_FRAME\t\t0x8000\t/* RW: 1=stop txframe pulses       */\n\n/* MII register 16 bits for SSI */\n#define MII16_SSI_DTR\t\t0x0001\t/* RW: DTR host->modem             */\n#define MII16_SSI_DSR\t\t0x0002\t/* RO: DSR modem->host             */\n#define MII16_SSI_RTS\t\t0x0004\t/* RW: RTS host->modem             */\n#define MII16_SSI_CTS\t\t0x0008\t/* RO: CTS modem->host             */\n#define MII16_SSI_DCD\t\t0x0010\t/* RW: DCD modem<->host            */\n#define MII16_SSI_RI\t\t0x0020\t/* RO: RI  modem->host             */\n#define MII16_SSI_CRC32\t\t0x0040\t/* RW: CRC length 16/32            */\n#define MII16_SSI_LED_LL\t0x0080\t/* RW: lower left  - green         */\n#define MII16_SSI_LED_LR\t0x0100\t/* RW: lower right - green         */\n#define MII16_SSI_LED_UL\t0x0200\t/* RW: upper left  - green         */\n#define MII16_SSI_LED_UR\t0x0400\t/* RW: upper right - red           */\n#define MII16_SSI_FIFO\t\t0x0800\t/* RW: reset fifos                 */\n#define MII16_SSI_LL\t\t0x1000\t/* RW: LL: host->modem             */\n#define MII16_SSI_RL\t\t0x2000\t/* RW: RL: host->modem             */\n#define MII16_SSI_TM\t\t0x4000\t/* RO: TM: modem->host             */\n#define MII16_SSI_LOOP\t\t0x8000\t/* RW: Loop at ext conn            */\n#define MII16_SSI_MODEM\t\t0x703F\t/* DTR+DSR+RTS+CTS+DCD+RI+LL+RL+TM */\n\n/* Mii register 17 has the SSI cable bits */\n#define MII17_SSI_CABLE_SHIFT\t3\t/* shift to get cable type         */\n#define MII17_SSI_CABLE_MASK\t0x0038\t/* RO: mask  to get cable type     */\n#define MII17_SSI_PRESCALE\t0x0040\t/* RW: divide by: 0=16; 1=512      */\n#define MII17_SSI_ITF\t\t0x0100\t/* RW: fill with: 0=flags; 1=ones  */\n#define MII17_SSI_NRZI\t\t0x0400\t/* RW: coding: NRZ= 0; NRZI=1      */\n\n/* MII register 16 bits for T1/E1 */\n#define MII16_T1_UNUSED1\t0x0001\n#define MII16_T1_INVERT\t\t0x0002\t/* RW: invert data (for SF/AMI)    */\n#define MII16_T1_XOE\t\t0x0004\t/* RW: TX Output Enable; 0=disable */\n#define MII16_T1_RST\t\t0x0008\t/* RW: Bt8370 chip reset           */\n#define MII16_T1_Z\t\t0x0010\t/* RW: output impedance T1=1 E1=0  */\n#define MII16_T1_INTR\t\t0x0020\t/* RO: interrupt from Bt8370       */\n#define MII16_T1_ONESEC\t\t0x0040\t/* RO: one second square wave      */\n#define MII16_T1_LED_BLU\t0x0080\t/* RW: lower right - blue          */\n#define MII16_T1_LED_YEL\t0x0100\t/* RW: lower left  - yellow        */\n#define MII16_T1_LED_RED\t0x0200\t/* RW: upper right - red           */\n#define MII16_T1_LED_GRN\t0x0400\t/* RW: upper left  - green         */\n#define MII16_T1_FIFO\t\t0x0800\t/* RW: reset fifos                 */\n#define MII16_T1_CRC32\t\t0x1000\t/* RW: CRC length 16/32            */\n#define MII16_T1_UNUSED2\t0xE000\n\n/* T3 framer:  RW=Read/Write;  RO=Read-Only;  RC=Read/Clr;  WO=Write-Only  */\n#define T3CSR_STAT0\t\t0x00\t/* RO: real-time status            */\n#define T3CSR_CTL1\t\t0x01\t/* RW: global control bits         */\n#define T3CSR_FEBE\t\t0x02\t/* RC: Far End Block Error Counter */\n#define T3CSR_CERR\t\t0x03\t/* RC: C-bit Parity Error Counter  */\n#define T3CSR_PERR\t\t0x04\t/* RC: P-bit Parity Error Counter  */\n#define T3CSR_TX_FEAC\t\t0x05\t/* RW: Far End Alarm & Control     */\n#define T3CSR_RX_FEAC\t\t0x06\t/* RO: Far End Alarm & Control     */\n#define T3CSR_STAT7\t\t0x07\t/* RL: latched real-time status    */\n#define T3CSR_CTL8\t\t0x08\t/* RW: extended global ctl bits    */\n#define T3CSR_STAT9\t\t0x09\t/* RL: extended status bits        */\n#define T3CSR_FERR\t\t0x0A\t/* RC: F-bit Error Counter         */\n#define T3CSR_MERR\t\t0x0B\t/* RC: M-bit Error Counter         */\n#define T3CSR_CTL12\t\t0x0C\t/* RW: more extended ctl bits      */\n#define T3CSR_DBL_FEAC\t\t0x0D\t/* RW: TX double FEAC              */\n#define T3CSR_CTL14\t\t0x0E\t/* RW: even more extended ctl bits */\n#define T3CSR_FEAC_STK\t\t0x0F\t/* RO: RX FEAC stack               */\n#define T3CSR_STAT16\t\t0x10\t/* RL: extended latched status     */\n#define T3CSR_INTEN\t\t0x11\t/* RW: interrupt enable            */\n#define T3CSR_CVLO\t\t0x12\t/* RC: coding violation cntr LSB   */\n#define T3CSR_CVHI\t\t0x13\t/* RC: coding violation cntr MSB   */\n#define T3CSR_CTL20\t\t0x14\t/* RW: yet more extended ctl bits  */\n\n#define CTL1_XTX\t\t0x01\t/* Transmit X-bit value            */\n#define CTL1_3LOOP\t\t0x02\t/* framer loop back                */\n#define CTL1_SER\t\t0x04\t/* SERial interface selected       */\n#define CTL1_M13MODE\t\t0x08\t/* M13 frame format                */\n#define CTL1_TXIDL\t\t0x10\t/* Transmit Idle signal            */\n#define CTL1_ENAIS\t\t0x20\t/* Enable AIS upon LOS             */\n#define CTL1_TXAIS\t\t0x40\t/* Transmit Alarm Indication Sig   */\n#define CTL1_NOFEBE\t\t0x80\t/* No Far End Block Errors         */\n\n#define CTL5_EMODE\t\t0x80\t/* rev B Extended features enabled */\n#define CTL5_START\t\t0x40\t/* transmit the FEAC msg now       */\n\n#define CTL8_FBEC\t\t0x80\t/* F-Bit Error Count control       */\n#define CTL8_TBLU\t\t0x20\t/* Transmit Blue signal            */\n\n#define STAT9_SEF\t\t0x80\t/* Severely Errored Frame          */\n#define STAT9_RBLU\t\t0x20\t/* Receive Blue signal             */\n\n#define CTL12_RTPLLEN\t\t0x80\t/* Rx-to-Tx Payload Lpbk Lock ENbl */\n#define CTL12_RTPLOOP\t\t0x40\t/* Rx-to-Tx Payload Loopback       */\n#define CTL12_DLCB1\t\t0x08\t/* Data Link C-Bits forced to 1    */\n#define CTL12_C21\t\t0x04\t/* C2 forced to 1                  */\n#define CTL12_MCB1\t\t0x02\t/* Most C-Bits forced to 1         */\n\n#define CTL13_DFEXEC\t\t0x40\t/* Execute Double FEAC             */\n\n#define CTL14_FEAC10\t\t0x80\t/* Transmit FEAC word 10 times     */\n#define CTL14_RGCEN\t\t0x20\t/* Receive Gapped Clock Out Enbl   */\n#define CTL14_TGCEN\t\t0x10\t/* Timing Gen Gapped Clk Out Enbl  */\n\n#define FEAC_STK_MORE\t\t0x80\t/* FEAC stack has more FEACs       */\n#define FEAC_STK_VALID\t\t0x40\t/* FEAC stack is valid             */\n#define FEAC_STK_FEAC\t\t0x3F\t/* FEAC stack FEAC data            */\n\n#define STAT16_XERR\t\t0x01\t/* X-bit Error                     */\n#define STAT16_SEF\t\t0x02    /* Severely Errored Frame          */\n#define STAT16_RTLOC\t\t0x04\t/* Rx/Tx Loss Of Clock             */\n#define STAT16_FEAC\t\t0x08\t/* new FEAC msg                    */\n#define STAT16_RIDL\t\t0x10\t/* channel IDLe signal             */\n#define STAT16_RAIS\t\t0x20\t/* Alarm Indication Signal         */\n#define STAT16_ROOF\t\t0x40\t/* Out Of Frame sync               */\n#define STAT16_RLOS\t\t0x80\t/* Loss Of Signal                  */\n\n#define CTL20_CVEN\t\t0x01\t/* Coding Violation Counter Enbl   */\n\n/* T1.107 Bit Oriented C-Bit Parity Far End Alarm Control and Status codes */\n#define T3BOP_OOF\t\t0x00\t/* Yellow alarm status             */\n#define T3BOP_LINE_UP\t\t0x07\t/* line loopback activate          */\n#define T3BOP_LINE_DOWN\t\t0x1C\t/* line loopback deactivate        */\n#define T3BOP_LOOP_DS3\t\t0x1B\t/* loopback full DS3               */\n#define T3BOP_IDLE\t\t0x1A\t/* IDLE alarm status               */\n#define T3BOP_AIS\t\t0x16\t/* AIS  alarm status               */\n#define T3BOP_LOS\t\t0x0E\t/* LOS  alarm status               */\n\n/* T1E1 regs;  RW=Read/Write;  RO=Read-Only;  RC=Read/Clr;  WO=Write-Only  */\n#define Bt8370_DID\t\t0x000\t/* RO: Device ID                   */\n#define Bt8370_CR0\t\t0x001\t/* RW; Primary Control Register    */\n#define Bt8370_JAT_CR\t\t0x002\t/* RW: Jitter Attenuator CR        */\n#define Bt8370_IRR\t\t0x003\t/* RO: Interrupt Request Reg       */\n#define Bt8370_ISR7\t\t0x004\t/* RC: Alarm 1 Interrupt Status    */\n#define Bt8370_ISR6\t\t0x005\t/* RC: Alarm 2 Interrupt Status    */\n#define Bt8370_ISR5\t\t0x006\t/* RC: Error Interrupt Status      */\n#define Bt8370_ISR4\t\t0x007\t/* RC; Cntr Ovfl Interrupt Status  */\n#define Bt8370_ISR3\t\t0x008\t/* RC: Timer Interrupt Status      */\n#define Bt8370_ISR2\t\t0x009\t/* RC: Data Link 1 Int Status      */\n#define Bt8370_ISR1\t\t0x00A\t/* RC: Data Link 2 Int Status      */\n#define Bt8370_ISR0\t\t0x00B\t/* RC: Pattrn Interrupt Status     */\n#define Bt8370_IER7\t\t0x00C\t/* RW: Alarm 1 Interrupt Enable    */\n#define Bt8370_IER6\t\t0x00D\t/* RW: Alarm 2 Interrupt Enable    */\n#define Bt8370_IER5\t\t0x00E\t/* RW: Error Interrupt Enable      */\n#define Bt8370_IER4\t\t0x00F\t/* RW: Cntr Ovfl Interrupt Enable  */\n\n#define Bt8370_IER3\t\t0x010\t/* RW: Timer Interrupt Enable      */\n#define Bt8370_IER2\t\t0x011\t/* RW: Data Link 1 Int Enable      */\n#define Bt8370_IER1\t\t0x012\t/* RW: Data Link 2 Int Enable      */\n#define Bt8370_IER0\t\t0x013\t/* RW: Pattern Interrupt Enable    */\n#define Bt8370_LOOP\t\t0x014\t/* RW: Loopback Config Reg         */\n#define Bt8370_DL3_TS\t\t0x015\t/* RW: External Data Link Channel  */\n#define Bt8370_DL3_BIT\t\t0x016\t/* RW: External Data Link Bit      */\n#define Bt8370_FSTAT\t\t0x017\t/* RO: Offline Framer Status       */\n#define Bt8370_PIO\t\t0x018\t/* RW: Programmable Input/Output   */\n#define Bt8370_POE\t\t0x019\t/* RW: Programmable Output Enable  */\n#define Bt8370_CMUX\t\t0x01A\t/* RW: Clock Input Mux             */\n#define Bt8370_TMUX\t\t0x01B\t/* RW: Test Mux Config             */\n#define Bt8370_TEST\t\t0x01C\t/* RW: Test Config                 */\n\n#define Bt8370_LIU_CR\t\t0x020\t/* RW: Line Intf Unit Config Reg   */\n#define Bt8370_RSTAT\t\t0x021\t/* RO; Receive LIU Status          */\n#define Bt8370_RLIU_CR\t\t0x022\t/* RW: Receive LIU Config          */\n#define Bt8370_LPF\t\t0x023\t/* RW: RPLL Low Pass Filter        */\n#define Bt8370_VGA_MAX\t\t0x024\t/* RW: Variable Gain Amplifier Max */\n#define Bt8370_EQ_DAT\t\t0x025\t/* RW: Equalizer Coeff Data Reg    */\n#define Bt8370_EQ_PTR\t\t0x026\t/* RW: Equzlizer Coeff Table Ptr   */\n#define Bt8370_DSLICE\t\t0x027\t/* RW: Data Slicer Threshold       */\n#define Bt8370_EQ_OUT\t\t0x028\t/* RW: Equalizer Output Levels     */\n#define Bt8370_VGA\t\t0x029\t/* RO: Variable Gain Ampl Status   */\n#define Bt8370_PRE_EQ\t\t0x02A\t/* RW: Pre-Equalizer               */\n\n#define Bt8370_COEFF0\t\t0x030\t/* RO: LMS Adj Eq Coeff Status     */\n#define Bt8370_GAIN0\t\t0x038\t/* RW: Equalizer Gain Thresh       */\n#define Bt8370_GAIN1\t\t0x039\t/* RW: Equalizer Gain Thresh       */\n#define Bt8370_GAIN2\t\t0x03A\t/* RW: Equalizer Gain Thresh       */\n#define Bt8370_GAIN3\t\t0x03B\t/* RW: Equalizer Gain Thresh       */\n#define Bt8370_GAIN4\t\t0x03C\t/* RW: Equalizer Gain Thresh       */\n\n#define Bt8370_RCR0\t\t0x040\t/* RW: Rx Configuration            */\n#define Bt8370_RPATT\t\t0x041\t/* RW: Rx Test Pattern Config      */\n#define Bt8370_RLB\t\t0x042\t/* RW: Rx Loopback Code Detr Conf  */\n#define Bt8370_LBA\t\t0x043\t/* RW: Loopback Activate Code Patt */\n#define Bt8370_LBD\t\t0x044\t/* RW: Loopback Deact Code Patt    */\n#define Bt8370_RALM\t\t0x045\t/* RW: Rx Alarm Signal Config      */\n#define Bt8370_LATCH\t\t0x046\t/* RW: Alarm/Err/Cntr Latch Config */\n#define Bt8370_ALM1\t\t0x047\t/* RO: Alarm 1 Status              */\n#define Bt8370_ALM2\t\t0x048\t/* RO: Alarm 2 Status              */\n#define Bt8370_ALM3\t\t0x049\t/* RO: Alarm 3 Status              */\n\n#define Bt8370_FERR_LO\t\t0x050\t/* RC: Framing Bit Error Cntr LSB  */\n#define Bt8370_FERR_HI\t\t0x051\t/* RC: Framing Bit Error Cntr MSB  */\n#define Bt8370_CRC_LO\t\t0x052\t/* RC: CRC    Error   Counter LSB  */\n#define Bt8370_CRC_HI\t\t0x053\t/* RC: CRC    Error   Counter MSB  */\n#define Bt8370_LCV_LO\t\t0x054\t/* RC: Line Code Viol Counter LSB  */\n#define Bt8370_LCV_HI\t\t0x055\t/* RC: Line Code Viol Counter MSB  */\n#define Bt8370_FEBE_LO\t\t0x056\t/* RC: Far End Block Err Cntr LSB  */\n#define Bt8370_FEBE_HI\t\t0x057\t/* RC: Far End Block Err Cntr MSB  */\n#define Bt8370_BERR_LO\t\t0x058\t/* RC: PRBS Bit Error Counter LSB  */\n#define Bt8370_BERR_HI\t\t0x059\t/* RC: PRBS Bit Error Counter MSB  */\n#define Bt8370_AERR\t\t0x05A\t/* RC: SEF/LOF/COFA counter        */\n#define Bt8370_RSA4\t\t0x05B\t/* RO: Rx Sa4 Byte Buffer          */\n#define Bt8370_RSA5\t\t0x05C\t/* RO: Rx Sa5 Byte Buffer          */\n#define Bt8370_RSA6\t\t0x05D\t/* RO: Rx Sa6 Byte Buffer          */\n#define Bt8370_RSA7\t\t0x05E\t/* RO: Rx Sa7 Byte Buffer          */\n#define Bt8370_RSA8\t\t0x05F\t/* RO: Rx Sa8 Byte Buffer          */\n\n#define Bt8370_SHAPE0\t\t0x060\t/* RW: Tx Pulse Shape Config       */\n#define Bt8370_TLIU_CR\t\t0x068\t/* RW: Tx LIU Config Reg           */\n\n#define Bt8370_TCR0\t\t0x070\t/* RW: Tx Framer Config            */\n#define Bt8370_TCR1\t\t0x071\t/* RW: Txter Configuration         */\n#define Bt8370_TFRM\t\t0x072\t/* RW: Tx Frame Format             */\n#define Bt8370_TERROR\t\t0x073\t/* RW: Tx Error Insert             */\n#define Bt8370_TMAN\t\t0x074\t/* RW: Tx Manual Sa/FEBE Config    */\n#define Bt8370_TALM\t\t0x075\t/* RW: Tx Alarm Signal Config      */\n#define Bt8370_TPATT\t\t0x076\t/* RW: Tx Test Pattern Config      */\n#define Bt8370_TLB\t\t0x077\t/* RW: Tx Inband Loopback Config   */\n#define Bt8370_LBP\t\t0x078\t/* RW: Tx Inband Loopback Patt     */\n#define Bt8370_TSA4\t\t0x07B\t/* RW: Tx Sa4 Byte Buffer          */\n#define Bt8370_TSA5\t\t0x07C\t/* RW: Tx Sa5 Byte Buffer          */\n#define Bt8370_TSA6\t\t0x07D\t/* RW: Tx Sa6 Byte Buffer          */\n#define Bt8370_TSA7\t\t0x07E\t/* RW: Tx Sa7 Byte Buffer          */\n#define Bt8370_TSA8\t\t0x07F\t/* RW: Tx Sa8 Byte Buffer          */\n\n#define Bt8370_CLAD_CR\t\t0x090\t/* RW: Clock Rate Adapter Config   */\n#define Bt8370_CSEL\t\t0x091\t/* RW: CLAD Frequency Select       */\n#define Bt8370_CPHASE\t\t0x092\t/* RW: CLAD Phase Det Scale Factor */\n#define Bt8370_CTEST\t\t0x093\t/* RW: CLAD Test                   */\n\n#define Bt8370_BOP\t\t0x0A0\t/* RW: Bit Oriented Protocol Xcvr  */\n#define Bt8370_TBOP\t\t0x0A1\t/* RW: Tx BOP Codeword             */\n#define Bt8370_RBOP\t\t0x0A2\t/* RO; Rx BOP Codeword             */\n#define Bt8370_BOP_STAT\t\t0x0A3\t/* RO: BOP Status                  */\n#define Bt8370_DL1_TS\t\t0x0A4\t/* RW: DL1 Time Slot Enable        */\n#define Bt8370_DL1_BIT\t\t0x0A5\t/* RW: DL1 Bit Enable              */\n#define Bt8370_DL1_CTL\t\t0x0A6\t/* RW: DL1 Control                 */\n#define Bt8370_RDL1_FFC\t\t0x0A7\t/* RW: RDL1 FIFO Fill Control      */\n#define Bt8370_RDL1\t\t0x0A8\t/* RO: RDL1 FIFO                   */\n#define Bt8370_RDL1_STAT\t0x0A9\t/* RO: RDL1 Status                 */\n#define Bt8370_PRM\t\t0x0AA\t/* RW: Performance Report Message  */\n#define Bt8370_TDL1_FEC\t\t0x0AB\t/* RW: TDL1 FIFO Empty Control     */\n#define Bt8370_TDL1_EOM\t\t0x0AC\t/* WO: TDL1 End Of Message Control */\n#define Bt8370_TDL1\t\t0x0AD\t/* RW: TDL1 FIFO                   */\n#define Bt8370_TDL1_STAT\t0x0AE\t/* RO: TDL1 Status                 */\n#define Bt8370_DL2_TS\t\t0x0AF\t/* RW: DL2 Time Slot Enable        */\n\n#define Bt8370_DL2_BIT\t\t0x0B0\t/* RW: DL2 Bit Enable              */\n#define Bt8370_DL2_CTL\t\t0x0B1\t/* RW: DL2 Control                 */\n#define Bt8370_RDL2_FFC\t\t0x0B2\t/* RW: RDL2 FIFO Fill Control      */\n#define Bt8370_RDL2\t\t0x0B3\t/* RO: RDL2 FIFO                   */\n#define Bt8370_RDL2_STAT\t0x0B4\t/* RO: RDL2 Status                 */\n#define Bt8370_TDL2_FEC\t\t0x0B6\t/* RW: TDL2 FIFO Empty Control     */\n#define Bt8370_TDL2_EOM\t\t0x0B7\t/* WO; TDL2 End Of Message Control */\n#define Bt8370_TDL2\t\t0x0B8\t/* RW: TDL2 FIFO                   */\n#define Bt8370_TDL2_STAT\t0x0B9\t/* RO: TDL2 Status                 */\n#define Bt8370_DL_TEST1\t\t0x0BA\t/* RW: DLINK Test Config           */\n#define Bt8370_DL_TEST2\t\t0x0BB\t/* RW: DLINK Test Status           */\n#define Bt8370_DL_TEST3\t\t0x0BC\t/* RW: DLINK Test Status           */\n#define Bt8370_DL_TEST4\t\t0x0BD\t/* RW: DLINK Test Control          */\n#define Bt8370_DL_TEST5\t\t0x0BE\t/* RW: DLINK Test Control          */\n\n#define Bt8370_SBI_CR\t\t0x0D0\t/* RW: System Bus Interface Config */\n#define Bt8370_RSB_CR\t\t0x0D1\t/* RW: Rx System Bus Config        */\n#define Bt8370_RSYNC_BIT\t0x0D2\t/* RW: Rx System Bus Sync Bit Offs */\n#define Bt8370_RSYNC_TS\t\t0x0D3\t/* RW: Rx System Bus Sync TS Offs  */\n#define Bt8370_TSB_CR\t\t0x0D4\t/* RW: Tx System Bus Config        */\n#define Bt8370_TSYNC_BIT\t0x0D5\t/* RW: Tx System Bus Sync Bit OFfs */\n#define Bt8370_TSYNC_TS\t\t0x0D6\t/* RW: Tx System Bus Sync TS Offs  */\n#define Bt8370_RSIG_CR\t\t0x0D7\t/* RW: Rx Siganalling Config       */\n#define Bt8370_RSYNC_FRM\t0x0D8\t/* RW: Sig Reinsertion Frame Offs  */\n#define Bt8370_SSTAT\t\t0x0D9\t/* RO: Slip Buffer Status          */\n#define Bt8370_STACK\t\t0x0DA\t/* RO: Rx Signalling Stack         */\n#define Bt8370_RPHASE\t\t0x0DB\t/* RO: RSLIP Phase Status          */\n#define Bt8370_TPHASE\t\t0x0DC\t/* RO: TSLIP Phase Status          */\n#define Bt8370_PERR\t\t0x0DD\t/* RO: RAM Parity Status           */\n\n#define Bt8370_SBCn\t\t0x0E0\t/* RW: System Bus Per-Channel Ctl  */\n#define Bt8370_TPCn\t\t0x100\t/* RW: Tx Per-Channel Control      */\n#define Bt8370_TSIGn\t\t0x120\t/* RW: Tx Signalling Buffer        */\n#define Bt8370_TSLIP_LOn\t0x140\t/* RW: Tx PCM Slip Buffer Lo       */\n#define Bt8370_TSLIP_HIn\t0x160\t/* RW: Tx PCM Slip Buffer Hi       */\n#define Bt8370_RPCn\t\t0x180\t/* RW: Rx Per-Channel Control      */\n#define Bt8370_RSIGn\t\t0x1A0\t/* RW: Rx Signalling Buffer        */\n#define Bt8370_RSLIP_LOn\t0x1C0\t/* RW: Rx PCM Slip Buffer Lo       */\n#define Bt8370_RSLIP_HIn\t0x1E0\t/* RW: Rx PCM Slip Buffer Hi       */\n\n/* Bt8370_LOOP (0x14) framer loopback control register bits */\n#define LOOP_ANALOG\t\t0x01\t/* inward  loop thru LIU           */\n#define LOOP_FRAMER\t\t0x02\t/* inward  loop thru framer        */\n#define LOOP_LINE\t\t0x04\t/* outward loop thru LIU           */\n#define LOOP_PAYLOAD\t\t0x08\t/* outward loop of payload         */\n#define LOOP_DUAL\t\t0x06\t/* inward framer + outward line    */\n\n/* Bt8370_ALM1 (0x47) receiver alarm status register bits */\n#define ALM1_SIGFRZ\t\t0x01\t/* Rx Signalling Freeze            */\n#define ALM1_RLOF\t\t0x02\t/* Rx loss of frame alignment      */\n#define ALM1_RLOS\t\t0x04\t/* Rx digital loss of signal       */\n#define ALM1_RALOS\t\t0x08\t/* Rx analog  loss of signal       */\n#define ALM1_RAIS\t\t0x10\t/* Rx Alarm Indication Signal      */\n#define ALM1_RYEL\t\t0x40\t/* Rx Yellow alarm indication      */\n#define ALM1_RMYEL\t\t0x80\t/* Rx multiframe YELLOW alarm      */\n\n/* Bt8370_ALM3 (0x49) receive framer status register bits */\n#define ALM3_FRED\t\t0x04\t/* Rx Out Of T1/FAS alignment      */\n#define ALM3_MRED\t\t0x08\t/* Rx Out Of MFAS alignment        */\n#define ALM3_SRED\t\t0x10\t/* Rx Out Of CAS alignment         */\n#define ALM3_SEF\t\t0x20\t/* Rx Severely Errored Frame       */\n#define ALM3_RMAIS\t\t0x40\t/* Rx TS16 AIS (CAS)               */\n\n/* Bt8370_TALM (0x75) transmit alarm control register bits */\n#define TALM_TAIS\t\t0x01\t/* Tx Alarm Indication Signal      */\n#define TALM_TYEL\t\t0x02\t/* Tx Yellow alarm                 */\n#define TALM_TMYEL\t\t0x04\t/* Tx Multiframe Yellow alarm      */\n#define TALM_AUTO_AIS\t\t0x08\t/* auto send AIS on LOS            */\n#define TALM_AUTO_YEL\t\t0x10\t/* auto send YEL on LOF            */\n#define TALM_AUTO_MYEL\t\t0x20\t/* auto send E1-Y16 on loss-of-CAS */\n\n/* 8370 BOP (Bit Oriented Protocol) command fragments */\n#define RBOP_OFF\t\t0x00\t/* BOP Rx disabled                 */\n#define RBOP_25\t\t\t0xE0\t/* BOP Rx requires 25 BOPs         */\n#define TBOP_OFF\t\t0x00\t/* BOP Tx disabled                 */\n#define TBOP_25\t\t\t0x0B\t/* BOP Tx sends 25 BOPs            */\n#define TBOP_CONT\t\t0x0F\t/* BOP Tx sends continuously       */\n\n/* T1.403 Bit-Oriented ESF Data-Link Message codes */\n#define T1BOP_OOF\t\t0x00\t/* Yellow alarm status             */\n#define T1BOP_LINE_UP\t\t0x07\t/* line loopback activate          */\n#define T1BOP_LINE_DOWN\t\t0x1C\t/* line loopback deactivate        */\n#define T1BOP_PAY_UP\t\t0x0A\t/* payload loopback activate       */\n#define T1BOP_PAY_DOWN\t\t0x19\t/* payload loopback deactivate     */\n#define T1BOP_NET_UP\t\t0x09\t/* network loopback activate       */\n#define T1BOP_NET_DOWN\t\t0x12\t/* network loopback deactivate     */\n\n/* Unix & Linux reserve 16 device-private IOCTLs */\n#if BSD\n# define LMCIOCGSTAT\t\t_IOWR('i', 240, struct status)\n# define LMCIOCGCFG\t\t_IOWR('i', 241, struct config)\n# define LMCIOCSCFG\t\t _IOW('i', 242, struct config)\n# define LMCIOCREAD\t\t_IOWR('i', 243, struct ioctl)\n# define LMCIOCWRITE\t\t _IOW('i', 244, struct ioctl)\n# define LMCIOCTL\t\t_IOWR('i', 245, struct ioctl)\n#elif defined(__linux__)  /* sigh */\n# define LMCIOCGSTAT\t\tSIOCDEVPRIVATE+0\n# define LMCIOCGCFG\t\tSIOCDEVPRIVATE+1\n# define LMCIOCSCFG\t\tSIOCDEVPRIVATE+2\n# define LMCIOCREAD\t\tSIOCDEVPRIVATE+3\n# define LMCIOCWRITE\t\tSIOCDEVPRIVATE+4\n# define LMCIOCTL\t\tSIOCDEVPRIVATE+5\n#endif\n\nstruct iohdr\t\t\t\t/* all LMCIOCs begin with this     */\n  {\n  char ifname[IFNAMSIZ];\t\t/* interface name, e.g. \"lmc0\"     */\n  u_int32_t cookie;\t\t\t/* interface version number        */\n  u_int16_t direction;\t\t\t/* missing in Linux IOCTL          */\n  u_int16_t length;\t\t\t/* missing in Linux IOCTL          */\n  struct iohdr *iohdr;\t\t\t/* missing in Linux IOCTL          */\n  u_int32_t spare;\t\t\t/* pad this struct to **32 bytes** */\n  };\n\n#define DIR_IO   0\n#define DIR_IOW  1\t\t\t/* copy data user->kernel          */\n#define DIR_IOR  2\t\t\t/* copy data kernel->user          */\n#define DIR_IOWR 3\t\t\t/* copy data kernel<->user         */\n\nstruct hssi_snmp\n  {\n  u_int16_t sigs;\t\t\t/* MII16_HSSI & MII16_HSSI_MODEM   */\n  };\n\nstruct ssi_snmp\n  {\n  u_int16_t sigs;\t\t\t/* MII16_SSI & MII16_SSI_MODEM     */\n  };\n\nstruct t3_snmp\n  {\n  u_int16_t febe;\t\t\t/*  8 bits - Far End Block err cnt */\n  u_int16_t lcv;\t\t\t/* 16 bits - BPV           err cnt */\n  u_int16_t pcv;\t\t\t/*  8 bits - P-bit         err cnt */\n  u_int16_t ccv;\t\t\t/*  8 bits - C-bit         err cnt */\n  u_int16_t line;\t\t\t/* line status bit vector          */\n  u_int16_t loop;\t\t\t/* loop status bit vector          */\n  };\n\nstruct t1_snmp\n  {\n  u_int16_t prm[4];\t\t\t/* T1.403 Performance Report Msg   */\n  u_int16_t febe;\t\t\t/* 10 bits - E1 FAR CRC    err cnt */\n  u_int16_t lcv;\t\t\t/* 16 bits - BPV + EXZ     err cnt */\n  u_int16_t fe;\t\t\t\t/* 12 bits - Ft/Fs/FPS/FAS err cnt */\n  u_int16_t crc;\t\t\t/* 10 bits - CRC6/CRC4     err cnt */\n  u_int16_t line;\t\t\t/* line status bit vector          */\n  u_int16_t loop;\t\t\t/* loop status bit vector          */\n  };\n\n/* SNMP trunk MIB Send codes */\n#define TSEND_NORMAL\t\t   1\t/* Send data (normal or looped)    */\n#define TSEND_LINE\t\t   2\t/* Send 'line loopback activate'   */\n#define TSEND_PAYLOAD\t\t   3\t/* Send 'payload loop activate'    */\n#define TSEND_RESET\t\t   4\t/* Send 'loopback deactivate'      */\n#define TSEND_QRS\t\t   5\t/* Send Quasi Random Signal        */\n\n/* ANSI T1.403 Performance Report Msg -- once a second from the far end    */\n#define T1PRM_FE\t\t0x8000\t/* Frame Sync Bit Error Event >= 1 */\n#define T1PRM_SE\t\t0x4000\t/* Severely Err Framing Event >= 1 */\n#define T1PRM_LB\t\t0x2000\t/* Payload Loopback Activated      */\n#define T1PRM_G1\t\t0x1000\t/* CRC Error Event = 1             */\n#define T1PRM_R\t\t\t0x0800  /* Reserved                        */\n#define T1PRM_G2\t\t0x0400\t/* 1 < CRC Error Event <= 5        */\n#define T1PRM_SEQ\t\t0x0300\t/* modulo 4 counter                */\n#define T1PRM_G3\t\t0x0080\t/* 5 < CRC Error Event <= 10       */\n#define T1PRM_LV\t\t0x0040\t/* Line Code Violation Event >= 1  */\n#define T1PRM_G4\t\t0x0020\t/* 10 < CRC Error Event <= 100     */\n#define T1PRM_U\t\t\t0x0018\t/* Under study for synchronization */\n#define T1PRM_G5\t\t0x0004\t/* 100 < CRC Error Event <= 319    */\n#define T1PRM_SL\t\t0x0002  /* Slip Event >= 1                 */\n#define T1PRM_G6\t\t0x0001\t/* CRC Error Event >= 320          */\n\n/* SNMP Line Status */\n#define TLINE_NORM\t\t0x0001\t/* no alarm present                */\n#define TLINE_RX_RAI\t\t0x0002\t/* receiving RAI = Yellow alarm    */\n#define TLINE_TX_RAI\t\t0x0004\t/* sending   RAI = Yellow alarm    */\n#define TLINE_RX_AIS\t\t0x0008  /* receiving AIS =  blue  alarm    */\n#define TLINE_TX_AIS\t\t0x0010\t/* sending   AIS =  blue  alarm    */\n#define TLINE_LOF\t\t0x0020\t/* near end  LOF =   red  alarm    */\n#define TLINE_LOS\t\t0x0040\t/* near end loss of Signal         */\n#define TLINE_LOOP\t\t0x0080\t/* near end is looped              */\n#define T1LINE_RX_TS16_AIS\t0x0100\t/* near end receiving TS16 AIS     */\n#define T1LINE_RX_TS16_LOMF\t0x0200\t/* near end sending   TS16 LOMF    */\n#define T1LINE_TX_TS16_LOMF\t0x0400\t/* near end receiving TS16 LOMF    */\n#define T1LINE_RX_TEST\t\t0x0800\t/* near end receiving QRS Signal   */\n#define T1LINE_SEF\t\t0x1000\t/* near end severely errored frame */\n#define T3LINE_RX_IDLE\t\t0x0100\t/* near end receiving IDLE signal  */\n#define T3LINE_SEF\t\t0x0200\t/* near end severely errored frame */\n\n/* SNMP Loopback Status */\n#define TLOOP_NONE\t\t0x01    /* no loopback                     */\n#define TLOOP_NEAR_PAYLOAD\t0x02\t/* near end payload loopback       */\n#define TLOOP_NEAR_LINE\t\t0x04\t/* near end line loopback          */\n#define TLOOP_NEAR_OTHER\t0x08\t/* near end looped somehow         */\n#define TLOOP_NEAR_INWARD\t0x10\t/* near end looped inward          */\n#define TLOOP_FAR_PAYLOAD\t0x20\t/* far  end payload loopback       */\n#define TLOOP_FAR_LINE\t\t0x40\t/* far  end line loopback          */\n\n/* event counters record interesting statistics */\nstruct event_cntrs\n  {\n  struct timeval reset_time;\t\t/* time when cntrs were reset      */\n  u_int64_t ibytes;\t\t\t/* Rx bytes   with good status     */\n  u_int64_t obytes;\t\t\t/* Tx bytes                        */\n  u_int64_t ipackets;\t\t\t/* Rx packets with good status     */\n  u_int64_t opackets;\t\t\t/* Tx packets                      */\n  u_int32_t ierrors;\t\t\t/* Rx packets with bad status      */\n  u_int32_t oerrors;\t\t\t/* Tx packets with bad status      */\n  u_int32_t idiscards;\t\t\t/* Rx packets discarded            */\n  u_int32_t odiscards;\t\t\t/* Tx packets discarded            */\n  u_int32_t fifo_over;\t\t\t/* Rx fifo overruns                */\n  u_int32_t fifo_under;\t\t\t/* Tx fifo underruns               */\n  u_int32_t missed;\t\t\t/* Rx pkts missed: no DMA descs    */\n  u_int32_t overruns;\t\t\t/* Rx pkts missed: fifo overrun    */\n  u_int32_t fdl_pkts;\t\t\t/* Rx T1 Facility Data Link pkts   */\n  u_int32_t crc_errs;\t\t\t/* Rx T1 frame CRC errors          */\n  u_int32_t lcv_errs;\t\t\t/* Rx T1 T3 Line Coding Violation  */\n  u_int32_t frm_errs;\t\t\t/* Rx T1 T3 Frame bit errors       */\n  u_int32_t febe_errs;\t\t\t/* Rx T1 T3 Far End Bit Errors     */\n  u_int32_t par_errs;\t\t\t/* Rx T3 P-bit parity errors       */\n  u_int32_t cpar_errs;\t\t\t/* Rx T3 C-bit parity errors       */\n  u_int32_t mfrm_errs;\t\t\t/* Rx T3 Multi-frame bit errors    */\n  u_int32_t rxdma;\t\t\t/* Rx out of kernel buffers        */\n  u_int32_t txdma;\t\t\t/* Tx out of DMA desciptors        */\n  u_int32_t lck_watch;\t\t\t/* try_lock conflict in watchdog   */\n  u_int32_t lck_ioctl;\t\t\t/* try_lock conflict in ioctl      */\n  u_int32_t lck_intr;\t\t\t/* try_lock conflict in interrupt  */\n  };\n\n/* sc->status is the READ ONLY status of the card.                         */\n/* Accessed using socket IO control calls or netgraph control messages.    */\nstruct status\n  {\n  struct iohdr iohdr;\t\t\t/* common ioctl header             */\n  u_int32_t card_type;\t\t\t/* PCI device number               */\n  u_int16_t ieee[3];\t\t\t/* IEEE MAC-addr from Tulip SROM   */\n  u_int16_t oper_status;\t\t/* actual state:  up, down, test   */\n  u_int32_t tx_speed;\t\t\t/* measured TX bits/sec            */\n  u_int32_t cable_type;\t\t\t/* SSI only: cable type            */\n  u_int32_t line_pkg;\t\t\t/* actual line pkg in use          */\n  u_int32_t line_prot;\t\t\t/* actual line proto in use        */\n  u_int32_t ticks;\t\t\t/* incremented by watchdog @ 1 Hz  */\n  struct event_cntrs cntrs;\t\t/* event counters                  */\n  union\n    {\n    struct hssi_snmp hssi;\t\t/* data for RFC-???? HSSI MIB      */\n    struct t3_snmp t3;\t\t\t/* data for RFC-2496 T3 MIB        */\n    struct ssi_snmp ssi;\t\t/* data for RFC-1659 RS232 MIB     */\n    struct t1_snmp t1;\t\t\t/* data for RFC-2495 T1 MIB        */\n    } snmp;\n  };\n\n/* line protocol package codes                                       fnobl */\n#define PKG_RAWIP\t\t   1\t/* driver                    yyyyy */\n#define PKG_SPPP\t\t   2\t/* fbsd, nbsd, obsd          yyynn */\n#define PKG_P2P\t\t\t   3\t/* bsd/os                    nnnyn */\n#define PKG_NG\t\t\t   4\t/* fbsd                      ynnnn */\n#define PKG_GEN_HDLC\t\t   5\t/* linux                     nnnny */\n\n/* line protocol codes                                               fnobl */\n#define PROT_PPP\t\t   1\t/* Point-to-Point Protocol   yyyyy */\n#define PROT_C_HDLC\t\t   2\t/* Cisco HDLC Protocol       yyyyy */\n#define PROT_FRM_RLY\t\t   3\t/* Frame Relay Protocol      ynnyy */\n#define PROT_X25\t\t   4\t/* X.25/LAPB Protocol        nnnny */\n#define PROT_ETH_HDLC\t\t   5\t/* raw Ether pkts in HDLC    nnnny */\n#define PROT_IP_HDLC\t\t   6\t/* raw IP4/6 pkts in HDLC    yyyyy */\n\n/* oper_status codes (same as SNMP status codes) */\n#define STATUS_UP\t\t   1\t/* may/will    tx/rx pkts          */\n#define STATUS_DOWN\t\t   2\t/* can't/won't tx/rx pkts          */\n#define STATUS_TEST\t\t   3\t/* currently not used              */\n\nstruct synth\t\t\t\t/* programmable oscillator params  */\n  {\n  unsigned n :7;\t\t\t/*   numerator (3..127)            */\n  unsigned m :7;\t\t\t/* denominator (3..127)            */\n  unsigned v :1;\t\t\t/* mul by 1|8                      */\n  unsigned x :2;\t\t\t/* div by 1|2|4|8                  */\n  unsigned r :2;\t\t\t/* div by 1|2|4|8                  */\n  unsigned prescale :13;\t\t/* log(final divisor): 2, 4 or 9   */\n  } __attribute__ ((packed));\n\n#define SYNTH_FREF\t        20e6\t/* reference xtal =  20 MHz        */\n#define SYNTH_FMIN\t        50e6\t/* internal VCO min  50 MHz        */\n#define SYNTH_FMAX\t       250e6\t/* internal VCO max 250 MHz        */\n\n/* sc->config is the READ/WRITE configuration of the card.                 */\n/* Accessed using socket IO control calls or netgraph control messages.    */\nstruct config\n  {\n  struct iohdr iohdr;\t\t\t/* common ioctl header             */\n  u_int32_t crc_len;\t\t\t/* ALL: CRC-16 or CRC-32 or none   */\n  u_int32_t loop_back;\t\t\t/* ALL: many kinds of loopbacks    */\n  u_int32_t tx_clk_src;\t\t\t/* T1, HSSI: ST, RT, int, ext      */\n  u_int32_t format;\t\t\t/* T3, T1: ckt framing format      */\n  u_int32_t time_slots;\t\t\t/* T1: 64Kb time slot config       */\n  u_int32_t cable_len;\t\t\t/* T3, T1: cable length in meters  */\n  u_int32_t scrambler;\t\t\t/* T3: payload scrambler config    */\n  u_int32_t dte_dce;\t\t\t/* SSI, HSSIc: drive TXCLK         */\n  struct synth synth;\t\t\t/* SSI, HSSIc: synth oscil params  */\n  u_int32_t rx_gain;\t\t\t/* T1: receiver gain limit 0-50 dB */\n  u_int32_t tx_pulse;\t\t\t/* T1: transmitter pulse shape     */\n  u_int32_t tx_lbo;\t\t\t/* T1: transmitter atten 0-22.5 dB */\n  u_int32_t debug;\t\t\t/* ALL: extra printout             */\n  u_int32_t line_pkg;\t\t\t/* ALL:  use this line pkg         */\n  u_int32_t line_prot;\t\t\t/* SPPP: use this line proto       */\n  u_int32_t keep_alive;\t\t\t/* SPPP: use keep-alive packets    */\n  };\n\n#define CFG_CRC_0\t\t   0\t/* no CRC                          */\n#define CFG_CRC_16\t\t   2    /* X^16+X^12+X^5+1 (default)       */\n#define CFG_CRC_32\t\t   4\t/* X^32+X^26+X^23+X^22+X^16+X^12+  */\n\t\t\t\t\t/* X^11+X^10+X^8+X^7+X^5+X^4+X^2+X+1 */\n#define CFG_LOOP_NONE\t\t   1\t/* SNMP don't loop back anything   */\n#define CFG_LOOP_PAYLOAD\t   2    /* SNMP loop outward thru framer   */\n#define CFG_LOOP_LINE\t\t   3\t/* SNMP loop outward thru LIU      */\n#define CFG_LOOP_OTHER\t\t   4\t/* SNMP loop  inward thru LIU      */\n#define CFG_LOOP_INWARD\t\t   5\t/* SNMP loop  inward thru framer   */\n#define CFG_LOOP_DUAL\t\t   6\t/* SNMP loop  inward & outward     */\n#define CFG_LOOP_TULIP\t\t  16\t/* ALL: loop  inward thru Tulip    */\n#define CFG_LOOP_PINS\t\t  17\t/* HSSIc, SSI: loop inward-pins    */\n#define CFG_LOOP_LL\t\t  18\t/* HSSI, SSI: assert LA/LL mdm pin */\n#define CFG_LOOP_RL\t\t  19\t/* HSSI, SSI: assert LB/RL mdm pin */\n\n#define CFG_CLKMUX_ST\t\t   1\t/* TX clk <- Send timing           */\n#define CFG_CLKMUX_INT\t\t   2\t/* TX clk <- internal source       */\n#define CFG_CLKMUX_RT\t\t   3\t/* TX clk <- Receive (loop) timing */\n#define CFG_CLKMUX_EXT\t\t   4    /* TX clk <- ext connector         */\n\n/* values 0-31 are Bt8370 CR0 register values (LSB is zero if E1).         */\n/* values 32-99 are reserved for other T1E1 formats, (even number if E1)   */\n/* values 100 and up are used for T3 frame formats.                        */\n#define CFG_FORMAT_T1SF\t\t   9\t/* T1-SF          AMI              */\n#define CFG_FORMAT_T1ESF\t  27\t/* T1-ESF+CRC     B8ZS     X^6+X+1 */\n#define CFG_FORMAT_E1FAS\t   0\t/* E1-FAS         HDB3 TS0         */\n#define CFG_FORMAT_E1FASCRC\t   8\t/* E1-FAS+CRC     HDB3 TS0 X^4+X+1 */\n#define CFG_FORMAT_E1FASCAS\t  16\t/* E1-FAS    +CAS HDB3 TS0 & TS16  */\n#define CFG_FORMAT_E1FASCRCCAS\t  24\t/* E1-FAS+CRC+CAS HDB3 TS0 & TS16  */\n#define CFG_FORMAT_E1NONE\t  32\t/* E1-NO framing  HDB3             */\n#define CFG_FORMAT_T3CPAR\t 100\t/* T3-C-Bit par   B3ZS             */\n#define CFG_FORMAT_T3M13\t 101\t/* T3-M13 format  B3ZS             */\n\n/* format aliases that improve code readability */\n#define FORMAT_T1ANY\t\t((sc->config.format & 1)==1)\n#define FORMAT_E1ANY\t\t((sc->config.format & 1)==0)\n#define FORMAT_E1CAS\t\t((sc->config.format & 0x11)==0x10)\n#define FORMAT_E1CRC\t\t((sc->config.format & 0x09)==0x08)\n#define FORMAT_E1NONE\t\t (sc->config.format == CFG_FORMAT_E1NONE)\n#define FORMAT_T1ESF\t\t (sc->config.format == CFG_FORMAT_T1ESF)\n#define FORMAT_T1SF\t\t (sc->config.format == CFG_FORMAT_T1SF)\n#define FORMAT_T3CPAR\t\t (sc->config.format == CFG_FORMAT_T3CPAR)\n\n#define CFG_SCRAM_OFF\t\t   1\t/* DS3 payload scrambler off       */\n#define CFG_SCRAM_DL_KEN\t   2\t/* DS3 DigitalLink/Kentrox X^43+1  */\n#define CFG_SCRAM_LARS\t\t   3\t/* DS3 Larscom X^20+X^17+1 w/28ZS  */\n\n#define CFG_DTE\t\t\t   1\t/* HSSIc, SSI: rcv TXCLK; rcv DCD  */\n#define CFG_DCE\t\t\t   2\t/* HSSIc, SSI: drv TXCLK; drv DCD  */\n\n#define CFG_GAIN_SHORT\t\t0x24\t/* 0-20 dB of equalized gain       */\n#define CFG_GAIN_MEDIUM\t\t0x2C\t/* 0-30 dB of equalized gain       */\n#define CFG_GAIN_LONG\t\t0x34\t/* 0-40 dB of equalized gain       */\n#define CFG_GAIN_EXTEND\t\t0x3F\t/* 0-64 dB of equalized gain       */\n#define CFG_GAIN_AUTO\t\t0xFF\t/* auto-set based on cable length  */\n\n#define CFG_PULSE_T1DSX0\t   0\t/* T1 DSX   0- 40 meters           */\n#define CFG_PULSE_T1DSX1\t   2\t/* T1 DSX  40- 80 meters           */\n#define CFG_PULSE_T1DSX2\t   4\t/* T1 DSX  80-120 meters           */\n#define CFG_PULSE_T1DSX3\t   6\t/* T1 DSX 120-160 meters           */\n#define CFG_PULSE_T1DSX4\t   8\t/* T1 DSX 160-200 meters           */\n#define CFG_PULSE_E1COAX\t  10\t/* E1  75 ohm coax pair            */\n#define CFG_PULSE_E1TWIST\t  12\t/* E1 120 ohm twisted pairs        */\n#define CFG_PULSE_T1CSU\t\t  14\t/* T1 CSU 200-2000 meters; set LBO */\n#define CFG_PULSE_AUTO\t\t0xFF\t/* auto-set based on cable length  */\n\n#define CFG_LBO_0DB\t\t   0\t/* T1CSU LBO =  0.0 dB; FCC opt A  */\n#define CFG_LBO_7DB\t\t  16\t/* T1CSU LBO =  7.5 dB; FCC opt B  */\n#define CFG_LBO_15DB\t\t  32\t/* T1CSU LBO = 15.0 dB; FCC opt C  */\n#define CFG_LBO_22DB\t\t  48\t/* T1CSU LBO = 22.5 dB; final span */\n#define CFG_LBO_AUTO\t\t0xFF\t/* auto-set based on cable length  */\n\nstruct ioctl\n  {\n  struct iohdr iohdr;\t\t\t/* common ioctl header             */\n  u_int32_t cmd;\t\t\t/* command\t\t\t   */\n  u_int32_t address;\t\t\t/* command address                 */\n  u_int32_t data;\t\t\t/* command data                    */\n  char *ucode;\t\t\t\t/* user-land address of ucode      */\n  };\n\n#define IOCTL_RW_PCI\t\t   1\t/* RW: Tulip PCI config registers  */\n#define IOCTL_RW_CSR\t\t   2\t/* RW: Tulip Control & Status Regs */\n#define IOCTL_RW_SROM\t\t   3\t/* RW: Tulip Serial Rom            */\n#define IOCTL_RW_BIOS\t\t   4\t/* RW: Tulip Boot rom              */\n#define IOCTL_RW_MII\t\t   5\t/* RW: MII registers               */\n#define IOCTL_RW_FRAME\t\t   6\t/* RW: Framer registers            */\n#define IOCTL_WO_SYNTH\t\t   7\t/* WO: Synthesized oscillator      */\n#define IOCTL_WO_DAC\t\t   8\t/* WO: Digital/Analog Converter    */\n\n#define IOCTL_XILINX_RESET\t  16\t/* reset Xilinx: all FFs set to 0  */\n#define IOCTL_XILINX_ROM\t  17\t/* load  Xilinx program from ROM   */\n#define IOCTL_XILINX_FILE\t  18\t/* load  Xilinx program from file  */\n\n#define IOCTL_SET_STATUS\t  50\t/* set mdm ctrl bits (internal use)*/\n#define IOCTL_SNMP_SEND\t\t  51\t/* trunk MIB send code             */\n#define IOCTL_SNMP_LOOP\t\t  52\t/* trunk MIB loop configuration    */\n#define IOCTL_SNMP_SIGS\t\t  53\t/* RS232-like modem control sigs   */\n#define IOCTL_RESET_CNTRS\t  54\t/* reset event counters            */\n\n/* storage for these strings is allocated here! */\nconst char *ssi_cables[] =\n  {\n  \"V.10/EIA423\",\n  \"V.11/EIA530A\",\n  \"RESERVED\",\n  \"X.21\",\n  \"V.35\",\n  \"V.36/EIA449\",\n  \"V.28/EIA232\",\n  \"NO CABLE\",\n  NULL,\n  };\n\n/***************************************************************************/\n/*    Declarations above here are shared with the user lmcconfig program.  */\n/*    Declarations below here are private to the kernel device driver.     */\n/***************************************************************************/\n\n#if (_KERNEL || KERNEL || __KERNEL__)\n\n#define SNDQ_MAXLEN\t32\t/* packets awaiting transmission */\n#define DESCS_PER_PKT\t 4\t/* DMA descriptors per TX pkt */\n#define\tNUM_TX_DESCS\t(DESCS_PER_PKT * SNDQ_MAXLEN)\n/* Increase DESCS_PER_PKT if status.cntrs.txdma increments. */\n\n/* A Tulip DMA descriptor can point to two chunks of memory.\n * Each chunk has a max length of 2047 bytes (ask the VMS guys...).\n * 2047 isn't a multiple of a cache line size (32 bytes typically).\n * So back off to 2048-32 = 2016 bytes per chunk (2 chunks per descr).\n */\n#define MAX_CHUNK_LEN\t2016\n#define MAX_DESC_LEN\t(2 * MAX_CHUNK_LEN)\n\n/* Tulip DMA descriptor; THIS STRUCT MUST MATCH THE HARDWARE */\nstruct dma_desc\n  {\n  u_int32_t status;\t\t/* hardware->to->software */\n#if (BYTE_ORDER == LITTLE_ENDIAN) /* left-to-right packing by compiler */\n  unsigned  length1:11;\t\t/* buffer1 length */\n  unsigned  length2:11;\t\t/* buffer2 length */\n  unsigned  control:10;\t\t/* software->to->hardware */\n#else /* right-to-left packing by compiler */\n  unsigned  control:10;\t\t/* software->to->hardware */\n  unsigned  length2:11;\t\t/* buffer2 length */\n  unsigned  length1:11;\t\t/* buffer1 length */\n#endif\n  u_int32_t address1;\t\t/* buffer1 bus address */\n  u_int32_t address2;\t\t/* buffer2 bus address */\n#if (defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__))\n  bus_dmamap_t map;\t\t/* bus dmamap for this descriptor */\n# define TLP_BUS_DSL_VAL\t(sizeof(bus_dmamap_t) & TLP_BUS_DSL)\n#else\n# define TLP_BUS_DSL_VAL\t0\n#endif\n  } __attribute__ ((packed));\n\n/* Tulip DMA descriptor status bits */\n#define TLP_DSTS_OWNER\t\t0x80000000\n#define TLP_DSTS_RX_DESC_ERR\t0x00004000\n#define TLP_DSTS_RX_FIRST_DESC\t0x00000200\n#define TLP_DSTS_RX_LAST_DESC\t0x00000100\n#define TLP_DSTS_RX_MII_ERR\t0x00000008\n#define TLP_DSTS_RX_DRIBBLE\t0x00000004\n#define TLP_DSTS_TX_UNDERRUN\t0x00000002\n#define TLP_DSTS_RX_OVERRUN\t0x00000001  /* not documented in rev AF */\n#define TLP_DSTS_RX_BAD\t\t(TLP_DSTS_RX_MII_ERR  | \\\n\t\t\t\t TLP_DSTS_RX_DRIBBLE  | \\\n\t\t\t\t TLP_DSTS_RX_DESC_ERR | \\\n\t\t\t\t TLP_DSTS_RX_OVERRUN)\n\n/* Tulip DMA descriptor control bits */\n#define TLP_DCTL_TX_INTERRUPT\t0x0200\n#define TLP_DCTL_TX_LAST_SEG\t0x0100\n#define TLP_DCTL_TX_FIRST_SEG\t0x0080\n#define TLP_DCTL_TX_NO_CRC\t0x0010\n#define TLP_DCTL_END_RING\t0x0008\n#define TLP_DCTL_TX_NO_PAD\t0x0002\n\n/* DMA descriptors are kept in a ring.\n * Ring is empty when (read == write).\n * Ring is full  when (read == wrap(write+1)),\n * The ring also contains a tailq of data buffers.\n */\nstruct desc_ring\n  {\n  struct dma_desc *read;\t/* next  descriptor to be read */\n  struct dma_desc *write;\t/* next  descriptor to be written */\n  struct dma_desc *first;\t/* first descriptor in ring */\n  struct dma_desc *last;\t/* last  descriptor in ring */\n  struct dma_desc *temp;\t/* temporary write pointer for tx */\n  u_int32_t dma_addr;\t\t/* bus address for desc array */\n  int size_descs;\t\t/* bus_dmamap_sync needs this */\n  int num_descs;\t\t/* used to set rx quota */\n#ifdef __linux__\n  struct sk_buff *head;\t\t/* tail-queue of skbuffs */\n  struct sk_buff *tail;\n#elif BSD\n  struct mbuf *head;\t\t/* tail-queue of mbufs */\n  struct mbuf *tail;\n# if (defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__))\n  bus_dma_tag_t tag;\t\t/* bus_dma tag for desc array */\n  bus_dmamap_t map;\t\t/* bus_dma map for desc array */\n  bus_dma_segment_t segs[2];\t/* bus_dmamap_load() or bus_dmamem_alloc() */\n  int nsegs;\t\t\t/* bus_dmamap_load() or bus_dmamem_alloc() */\n# endif\n#endif\n  };\n\n/* break circular definition */\ntypedef struct softc softc_t;\n\n/* card-dependent methods */\nstruct card\n  {\n  void (* config)(softc_t *);\n  void (* ident)(softc_t *);\n  int  (* watchdog)(softc_t *);\t\t/* must not sleep */\n  int  (* ioctl)(softc_t *, struct ioctl *); /* can sleep */\n  };\n\n/* flag bits in sc->flags */\n#define FLAG_IFNET\t\t0x00000002  /* IFNET is attached           */\n#define FLAG_NETDEV\t\t0x00000004  /* NETDEV is registered        */\n#define FLAG_NETGRAPH\t\t0x00000008  /* NETGRAPH is attached        */\n\n/* Accessing Tulip CSRs:\n * There are two ways: IO instruction (default) and memory reference.\n *  IO refs are used if IOREF_CSR is defined; otherwise memory refs are used.\n *  MEMORY REFERENCES DO NOT WORK in BSD/OS: page faults happen.\n */\n#define IOREF_CSR 1  /* access Tulip CSRs with IO cycles if 1 */\n\n#if (defined(__FreeBSD__) && defined(DEVICE_POLLING))\n# define DEV_POLL 1\n#else\n# define DEV_POLL 0\n#endif\n\n#if defined(ALTQ) && ALTQ\n# define ALTQ_PRESENT 1\n#else\n# define ALTQ_PRESENT 0\n#endif\n\n/* This is the instance data, or \"software context\" for the device driver. */\n/* NetBSD, OpenBSD and BSD/OS want struct device first in the softc. */\n/* FreeBSD wants struct ifnet first in the softc. */\nstruct softc\n  {\n#if (defined(__NetBSD__) || defined(__OpenBSD__))\n  struct device\tdev;\t\t/* base device -- must be first in softc   */\n  pcitag_t\tpa_tag;\t\t/* pci_conf_read/write need this           */\n  pci_chipset_tag_t pa_pc;\t/* pci_conf_read/write need this           */\n  bus_dma_tag_t\tpa_dmat;\t/* bus_dma needs this                      */\n  bus_space_tag_t csr_tag;\t/* bus_space needs this                    */\n  bus_space_handle_t csr_handle;/* bus_space needs this                    */\n  pci_intr_handle_t intr_handle;/* interrupt handle                        */\n  void\t\t*irq_cookie;\t/* pci_intr_disestablish needs this        */\n  void\t\t*sdh_cookie;\t/* shutdownhook_disestablish needs this    */\n  struct simplelock top_lock;\t/* lock card->watchdog vs core_ioctl       */\n  struct simplelock bottom_lock;/* lock for buf queues & descriptor rings  */\n  struct mbuf\t*tx_mbuf;\t/* hang mbuf here while building dma descs */\n#endif  /* __NetBSD__ || __OpenBSD__ */\n\n#ifdef __bsdi__\n  struct device\tdev;\t\t/* base device -- must be first in softc   */\n  struct isadev\tid;\t\t/* bus resource                            */\n  struct intrhand ih;\t\t/* interrupt vectoring                     */\n  struct atshutdown ats;\t/* shutdown hook                           */\n  pci_devaddr_t\tcfgbase;\t/* base address of PCI config regs         */\n  u_int16_t\t csr_iobase;\t/*     io base address of Tulip CSRs       */\n  u_int32_t\t*csr_membase;\t/* kv mem base address of Tulip CSRs       */\n  struct simplelock top_lock;\t/* lock card->watchdog vs core_ioctl       */\n  struct simplelock bottom_lock;/* lock for buf queues & descriptor rings  */\n  struct mbuf\t*tx_mbuf;\t/* hang mbuf here while building dma descs */\n#endif /* __bsdi__ */\n\n  /* State for kernel-resident Line Protocols */\n#if IFNET\n  struct ifnet *ifp;\n  struct ifmedia ifm;\t\t/* hooks for ifconfig(8) */\n# if NSPPP\n#  if (__FreeBSD_version < 600000)\n  struct sppp spppcom;\t\t/* must be first in sc for fbsd < 6 */\n#  endif\n  struct sppp *sppp;\n# elif P2P\n  struct p2pcom p2pcom;\n  struct p2pcom *p2p;\n# elif (__FreeBSD_version < 600000)\n  struct ifnet ifnet;\t\t/* must be first in sc for fbsd < 6 */\n# endif\n#endif\n\n#ifdef __linux__\n# if GEN_HDLC\n  hdlc_device\t*hdlc_dev;\t/* state for HDLC code                     */\n  sync_serial_settings hdlc_settings; /* state set by sethdlc program      */\n# else\n  struct net_device_stats net_stats; /* linux_stats storage                */\n# endif\n#endif\n\n#if NETGRAPH\n  node_p\tng_node;\t/* pointer to our node struct              */\n  hook_p\tng_hook;\t/* non-zero means NETGRAPH owns device     */\n# if (__FreeBSD_version >= 503000)\n  struct ifaltq\tng_sndq;\n  struct ifaltq ng_fastq;\n# else\n  struct ifqueue ng_sndq;\n  struct ifqueue ng_fastq;\n# endif\n#endif\n\n#ifdef __FreeBSD__\n  struct callout callout;\t/* watchdog needs this                  */\n  struct device\t*dev;\t\t/* base device pointer                     */\n  bus_space_tag_t csr_tag;\t/* bus_space needs this                    */\n  bus_space_handle_t csr_handle;/* bus_space_needs this                    */\n  void\t\t*irq_cookie;\t/* bus_teardown_intr needs this            */\n  struct resource *irq_res;\t/* bus_release_resource needs this         */\n  int\t\tirq_res_id;\t/* bus_release_resource needs this         */\n  struct resource *csr_res;\t/* bus_release_resource needs this         */\n  int\t\tcsr_res_id;\t/* bus_release resource needs this         */\n  int\t\tcsr_res_type;\t/* bus_release resource needs this         */\n  struct mbuf\t*tx_mbuf;\t/* hang mbuf here while building dma descs */\n# ifdef DEVICE_POLLING\n  int\t\tquota;\t\t/* used for incoming packet flow control   */\n# endif\n# if (__FreeBSD_version >= 500000)\n  struct mtx\ttop_mtx;\t/* lock card->watchdog vs core_ioctl       */\n  struct mtx\tbottom_mtx;\t/* lock for buf queues & descriptor rings  */\n# else /* FreeBSD-4 */\n  int\t\ttop_spl;\t/* lock card->watchdog vs core_ioctl       */\n  int\t\tbottom_spl;\t/* lock for buf queues & descriptor rings  */\n# endif\n#endif /* __FreeBSD__ */\n\n#ifdef __linux__\n  struct pci_dev    *pci_dev;\t/* READ/WRITE_PCI_CFG macros need this     */\n  struct net_device *net_dev;\t/* NAME_UNIT macro needs this              */\n  struct timer_list wd_timer;\t/* timer calls watchdog() once a second    */\n  u_int32_t\t csr_iobase;\t/*     io base address of Tulip CSRs       */\n  void\t\t*csr_membase;\t/* kv mem base address of Tulip CSRs       */\n  struct sk_buff *tx_skb;\t/* hang skb here while building dma descs  */\n  int\t\tquota;\t\t/* used for incoming packet flow control   */\n  struct semaphore top_lock;\t/* lock card->watchdog vs core_ioctl       */\n  spinlock_t\tbottom_lock;\t/* lock for buf queues & descriptor rings  */\n#endif  /* __linux__ */\n\n  /* Top-half state used by all card types; lock with top_lock,            */\n  const char\t*dev_desc;\t/* string describing type of board         */\n  struct status status;\t\t/* driver status lmcconfig can read        */\n  struct config\tconfig;\t\t/* driver config lmcconfig can read/write  */\n  struct card\t*card;\t\t/* card methods: config, ioctl, watchdog   */\n  u_int32_t\tgpio_dir;\t/* s/w copy of GPIO direction register     */\n  u_int16_t\tled_state;\t/* last value written to mii16             */\n  u_int32_t\tflags;\t\t/* driver-global flags                     */\n\n  /* Top-half state used by card-specific watchdogs; lock with top_lock.   */\n  u_int32_t\tlast_mii16;\t/* SSI, HSSI: MII reg 16 one second ago    */\n  u_int32_t\tlast_stat16;\t/* T3:     framer reg 16 one second ago    */\n  u_int32_t\tlast_alm1;\t/* T1E1:   framer reg 47 one second ago    */\n  u_int32_t\tlast_FEAC;\t/* last FEAC msg code received             */\n  u_int32_t\tloop_timer;\t/* seconds until loopback expires          */\n\n  /* Bottom-half state used by the interrupt code; lock with bottom_lock.  */\n  struct desc_ring txring;\t/* tx descriptor ring state                */\n  struct desc_ring rxring;\t/* rx descriptor ring state                */\n  };  /* end of softc */\n\n/* Hide the minor differences between OS versions */\n\n#ifdef __FreeBSD__\n  typedef void intr_return_t;\n# define  READ_PCI_CFG(sc, addr)       pci_read_config ((sc)->dev, addr, 4)\n# define WRITE_PCI_CFG(sc, addr, data) pci_write_config((sc)->dev, addr, data, 4)\n# define  READ_CSR(csr)\t\tbus_space_read_4 (sc->csr_tag, sc->csr_handle, csr)\n# define WRITE_CSR(csr, val)\tbus_space_write_4(sc->csr_tag, sc->csr_handle, csr, val)\n# define NAME_UNIT\t\tdevice_get_nameunit(sc->dev)\n# define DRIVER_DEBUG\t\t((sc->config.debug) || (sc->ifp->if_flags & IFF_DEBUG))\n# if (__FreeBSD_version >= 500000)\n#  define TOP_TRYLOCK\t\tmtx_trylock(&sc->top_mtx)\n#  define TOP_UNLOCK\t\tmtx_unlock (&sc->top_mtx)\n#  define BOTTOM_TRYLOCK\tmtx_trylock(&sc->bottom_mtx)\n#  define BOTTOM_UNLOCK\t\tmtx_unlock (&sc->bottom_mtx)\n#  if (__FreeBSD_version >= 700000)\n#   define CHECK_CAP\t\tpriv_check(curthread, PRIV_DRIVER)\n#  else\n#   define CHECK_CAP\t\tsuser(curthread)\n#  endif\n# else /* FreeBSD-4 */\n#  define TOP_TRYLOCK\t\t(sc->top_spl = splimp())\n#  define TOP_UNLOCK\t\tsplx(sc->top_spl)\n#  define BOTTOM_TRYLOCK\t1 /* giant_lock protects */\n#  define BOTTOM_UNLOCK\t\t/* nothing */\n#  define CHECK_CAP\t\tsuser(curproc)\n# endif\n# define DISABLE_INTR\t\t/* nothing */\n# define ENABLE_INTR\t\t/* nothing */\n# define IRQ_NONE\t\t/* nothing */\n# define IRQ_HANDLED\t\t/* nothing */\n# define IFP2SC(ifp)\t\t(ifp)->if_softc\n# define COPY_BREAK\t\tMHLEN\n# define SLEEP(usecs)\t\ttsleep(sc, PCATCH | PZERO, DEVICE_NAME, 1+(usecs/tick))\n# define DMA_SYNC(map, size, flags) bus_dmamap_sync(ring->tag, map, flags)\n# define DMA_LOAD(map, addr, size)  bus_dmamap_load(ring->tag, map, addr, size, fbsd_dmamap_load, ring, 0)\n# if (NBPFILTER != 0)\n#  if (__FreeBSD_version >= 500000)\n#   define LMC_BPF_MTAP(mbuf)\tBPF_MTAP(sc->ifp, mbuf)\n#  else  /* FreeBSD-4 */\n#   define LMC_BPF_MTAP(mbuf)\tif (sc->ifp->if_bpf) bpf_mtap(sc->ifp, mbuf)\n#  endif\n#  define LMC_BPF_ATTACH(dlt, len) bpfattach(sc->ifp, dlt, len)\n#  define LMC_BPF_DETACH\t   bpfdetach(sc->ifp)\n# endif\n# if (__FreeBSD_version >= 500000)\n#  define IF_DROP(ifq)\t\t_IF_DROP(ifq)\n#  define IF_QFULL(ifq)\t\t_IF_QFULL(ifq)\n# endif\n# if (__FreeBSD_version < 500000)\n#  define INTR_MPSAFE\t\t0\n#  define BUS_DMA_COHERENT\t0\n# endif\n# if (__FreeBSD_version >= 600000)\n#  define IFF_RUNNING\t\tIFF_DRV_RUNNING\n# endif\n#endif  /* __FreeBSD__ */\n\n#ifdef __NetBSD__\n  typedef int intr_return_t;\n# define  READ_PCI_CFG(sc, addr)       pci_conf_read ((sc)->pa_pc, (sc)->pa_tag, addr)\n# define WRITE_PCI_CFG(sc, addr, data) pci_conf_write((sc)->pa_pc, (sc)->pa_tag, addr, data)\n# define  READ_CSR(csr)\t\tbus_space_read_4 (sc->csr_tag, sc->csr_handle, csr)\n# define WRITE_CSR(csr, val)\tbus_space_write_4(sc->csr_tag, sc->csr_handle, csr, val)\n# define NAME_UNIT\t\tsc->dev.dv_xname\n# define DRIVER_DEBUG\t\t((sc->config.debug) || (sc->ifp->if_flags & IFF_DEBUG))\n# define TOP_TRYLOCK\t\tsimple_lock_try(&sc->top_lock)\n# define TOP_UNLOCK\t\tsimple_unlock  (&sc->top_lock)\n# define BOTTOM_TRYLOCK\t\tsimple_lock_try(&sc->bottom_lock)\n# define BOTTOM_UNLOCK\t\tsimple_unlock  (&sc->bottom_lock)\n# define CHECK_CAP\t\tsuser(curproc->p_ucred, &curproc->p_acflag)\n# define DISABLE_INTR\t\tint spl = splnet()\n# define ENABLE_INTR\t\tsplx(spl)\n# define IRQ_NONE\t\t0\n# define IRQ_HANDLED\t\t1\n# define IFP2SC(ifp)\t\t(ifp)->if_softc\n# define COPY_BREAK\t\tMHLEN\n# define SLEEP(usecs)\t\ttsleep(sc, PCATCH | PZERO, DEVICE_NAME, 1+(usecs/tick))\n# define DMA_SYNC(map, size, flags) bus_dmamap_sync(ring->tag, map, 0, size, flags)\n# define DMA_LOAD(map, addr, size)  bus_dmamap_load(ring->tag, map, addr, size, 0, BUS_DMA_NOWAIT)\n# if (NBPFILTER != 0)\n#  define LMC_BPF_MTAP(mbuf)\tif (sc->ifp->if_bpf) bpf_mtap(sc->ifp->if_bpf, mbuf)\n#  define LMC_BPF_ATTACH(dlt, len) bpfattach(sc->ifp, dlt, len)\n#  define LMC_BPF_DETACH\t   bpfdetach(sc->ifp)\n# endif\n#endif /* __NetBSD__ */\n\n#ifdef __OpenBSD__\n  typedef int intr_return_t;\n# define  READ_PCI_CFG(sc, addr)       pci_conf_read ((sc)->pa_pc, (sc)->pa_tag, addr)\n# define WRITE_PCI_CFG(sc, addr, data) pci_conf_write((sc)->pa_pc, (sc)->pa_tag, addr, data)\n# define  READ_CSR(csr)\t\tbus_space_read_4 (sc->csr_tag, sc->csr_handle, csr)\n# define WRITE_CSR(csr, val)\tbus_space_write_4(sc->csr_tag, sc->csr_handle, csr, val)\n# define NAME_UNIT\t\tsc->dev.dv_xname\n# define DRIVER_DEBUG\t\t((sc->config.debug) || (sc->ifp->if_flags & IFF_DEBUG))\n# define TOP_TRYLOCK\t\tsimple_lock_try(&sc->top_lock)\n# define TOP_UNLOCK\t\tsimple_unlock  (&sc->top_lock)\n# define BOTTOM_TRYLOCK\t\tsimple_lock_try(&sc->bottom_lock)\n# define BOTTOM_UNLOCK\t\tsimple_unlock  (&sc->bottom_lock)\n# define CHECK_CAP\t\tsuser(curproc, 0)\n# define DISABLE_INTR\t\tint spl = splnet()\n# define ENABLE_INTR\t\tsplx(spl)\n# define IRQ_NONE\t\t0\n# define IRQ_HANDLED\t\t1\n# define IFP2SC(ifp)\t\t(ifp)->if_softc\n# define COPY_BREAK\t\tMHLEN\n# define SLEEP(usecs)\t\ttsleep(sc, PCATCH | PZERO, DEVICE_NAME, 1+(usecs/tick))\n# define DMA_SYNC(map, size, flags) bus_dmamap_sync(ring->tag, map, 0, size, flags)\n# define DMA_LOAD(map, addr, size)  bus_dmamap_load(ring->tag, map, addr, size, 0, BUS_DMA_NOWAIT)\n# if (NBPFILTER != 0)\n#  define LMC_BPF_MTAP(mbuf)\tif (sc->ifp->if_bpf) bpf_mtap(sc->ifp->if_bpf, mbuf)\n#  define LMC_BPF_ATTACH(dlt, len) bpfattach(&sc->ifp->if_bpf, sc->ifp, dlt, len)\n#  define LMC_BPF_DETACH\t   bpfdetach(sc->ifp)\n# endif\n#endif /* __OpenBSD__ */\n\n#ifdef __bsdi__\n  typedef int intr_return_t;\n# define  READ_PCI_CFG(sc, addr)        pci_inl(&(sc)->cfgbase, addr)\n# define WRITE_PCI_CFG(sc, addr, data) pci_outl(&(sc)->cfgbase, addr, data)\n# if IOREF_CSR\n#  define  READ_CSR(csr)\t inl(sc->csr_iobase+(csr))\n#  define WRITE_CSR(csr, val)\toutl(sc->csr_iobase+(csr), (val))\n# else\n# error Memory refs to Tulip CSRs cause page faults in BSD/OS\n#  define  READ_CSR(csr)\t   (0 + *(sc->csr_membase+(csr)))\n#  define WRITE_CSR(csr, val)\t((void)(*(sc->csr_membase+(csr)) = (val)))\n# endif\n# define NAME_UNIT\t\tsc->dev.dv_xname\n# define DRIVER_DEBUG\t\t((sc->config.debug) || (sc->ifp->if_flags & IFF_DEBUG))\n# define TOP_TRYLOCK\t\tsimple_lock_try(&sc->top_lock)\n# define TOP_UNLOCK\t\tsimple_unlock  (&sc->top_lock)\n# define BOTTOM_TRYLOCK\t\tsimple_lock_try(&sc->bottom_lock)\n# define BOTTOM_UNLOCK\t\tsimple_unlock  (&sc->bottom_lock)\n# define CHECK_CAP\t\tsuser(PCPU(curproc)->p_ucred, &PCPU(curproc)->p_acflag)\n# define DISABLE_INTR\t\tint spl = splimp()\n# define ENABLE_INTR\t\tsplx(spl)\n# define IRQ_NONE\t\t1 /* XXX 0 */\n# define IRQ_HANDLED\t\t1\n# define IFP2SC(ifp)\t\t(ifp)->if_softc\n# define COPY_BREAK\t\tMHLEN\n# define SLEEP(usecs)\t\ttsleep(sc, PCATCH | PZERO, DEVICE_NAME, 1+(usecs/tick))\n# define DMA_SYNC(map, size, flags)   /* nothing */\n# define DMA_LOAD(map, addr, size)    0\n# define bus_dmamap_unload(tag, map)  /* nothing */\n# define bus_dmamap_destroy(tag, map) /* nothing */\n# if (NBPFILTER != 0)\n#  define LMC_BPF_MTAP(mbuf)\tif (sc->ifp->if_bpf) bpf_mtap(sc->ifp->if_bpf, mbuf)\n#  define LMC_BPF_ATTACH(dlt, len) bpfattach(&sc->ifp->if_bpf, sc->ifp, dlt, len)\n#  define LMC_BPF_DETACH\t/* bpfdetach(sc->ifp) */\n# endif\n# define memcpy(dst, src, len)  bcopy(src, dst, len)\n# define if_detach(ifp)\t\t/* nothing */\n\n/*  BSD/OS-4.1 doesn't have a back pointer to softc in struct ifnet, */\n/*  and it passes a unit number not a struct ifnet* to watchdog. */\n# if (_BSDI_VERSION <= 199910)\n   extern struct cfdriver\tlmccd;\n#  undef  IFP2SC\n#  define UNIT2SC(unit)\t\t((softc_t *)lmccd.cd_devs[unit])\n#  define IFP2SC(ifp)\t\t(UNIT2SC((ifp)->if_unit))\n# endif\n#endif /* __bsdi__ */\n\n#ifdef __linux__\nstatic u_int32_t /* inline? so rare it doesn't matter */\nREAD_PCI_CFG(softc_t *sc, u_int32_t addr)\n  {\n  u_int32_t data;\n  pci_read_config_dword(sc->pci_dev, addr, &data);\n  return data;\n  }\n# define WRITE_PCI_CFG(sc, addr, data) pci_write_config_dword(sc->pci_dev, addr, data)\n# if IOREF_CSR\n#  define  READ_CSR(csr)\t       inl((sc->csr_iobase+(csr)))\n#  define WRITE_CSR(csr, val)\toutl((val),(sc->csr_iobase+(csr)))\n# else\n#  define  READ_CSR(csr)\t       readl((sc->csr_membase+(csr)))\n#  define WRITE_CSR(csr, val)\twritel((val),(sc->csr_membase+(csr)))\n# endif\n# define NAME_UNIT\t\tsc->net_dev->name\n# define DRIVER_DEBUG\t\t((sc->config.debug) || (sc->net_dev->flags & IFF_DEBUG))\n# define TOP_TRYLOCK\t\t((down_trylock(&sc->top_lock)==0) ? 1:0)\n# define TOP_UNLOCK\t\tup(&sc->top_lock)\n# define BOTTOM_TRYLOCK\t\tspin_trylock_bh(&sc->bottom_lock)\n# define BOTTOM_UNLOCK\t\tspin_unlock_bh(&sc->bottom_lock)\n# define CHECK_CAP\t\tcapable(CAP_NET_ADMIN)? 0 : -EPERM\n# define DISABLE_INTR\t\t/* nothing */\n# define ENABLE_INTR\t\t/* nothing */\n# define COPY_BREAK\t\t200\n# define DELAY(usecs)\t\tudelay(usecs)\n# define SLEEP(usecs)\t\tdo { set_current_state(TASK_INTERRUPTIBLE);\\\n\t\t\t\tschedule_timeout(1+(usecs*HZ)/1000000UL); } while (0)\n# define printf\t\t\tprintk\n# define copyin(u, k, len)\tcopy_from_user(k, u, len)\n# define microtime(time)\tdo_gettimeofday(time)\n# define malloc(len, t, f)\tkmalloc(len, GFP_KERNEL)\n# define free(addr, t)\t\tkfree(addr)\n# define LITTLE_ENDIAN\t\t4321\n# define BIG_ENDIAN\t\t1234\n# if defined(__LITTLE_ENDIAN)\n#  define BYTE_ORDER LITTLE_ENDIAN\n# elif defined(__BIG_ENDIAN)\n#  define BYTE_ORDER BIG_ENDIAN\n# else\n#  error \"asm/byteorder.h is wrong\"\n# endif\n# if (GEN_HDLC == 0)\n#  define dev_to_hdlc(net_dev) net_dev\n#  define hdlc_set_carrier(val, net_dev) /* nothing */\n# endif\n#endif /* __linux__ */\n\n#if (NBPFILTER == 0)\n# define LMC_BPF_MTAP(mbuf)\t\t/* nothing */\n# define LMC_BPF_ATTACH(dlt, len)\t/* nothing */\n# define LMC_BPF_DETACH\t\t\t/* nothing */\n#endif\n\n#if (defined(__bsdi__) || /* unconditionally */ \\\n    (defined(__FreeBSD__) && (__FreeBSD_version < 503000)) || \\\n    (defined(__NetBSD__)  && (__NetBSD_Version__ < 106000000)) || \\\n    (defined(__OpenBSD__) && (  OpenBSD < 200111)))\n# define IFQ_ENQUEUE(ifq, m, pa, err)   \\\ndo {\t\t\t\t\t\\\n  if (pa==0); /* suppress warning */\t\\\n  if (IF_QFULL(ifq))\t\t\t\\\n    {\t\t\t\t\t\\\n    IF_DROP(ifq);\t\t\t\\\n    m_freem(m);\t\t\t\t\\\n    err = ENOBUFS;\t\t\t\\\n    }\t\t\t\t\t\\\n  else\t\t\t\t\t\\\n    {\t\t\t\t\t\\\n    IF_ENQUEUE(ifq, m);\t\t\t\\\n    err = 0;\t\t\t\t\\\n    }\t\t\t\t\t\\\n   } while (0)\n# define IFQ_DEQUEUE(ifq, m)\t\tdo { IF_DEQUEUE((ifq), m) } while (0)\n# define IFQ_IS_EMPTY(ifq)\t\t((ifq)->ifq_head == NULL)\n# define IFQ_SET_MAXLEN(ifq, len)\t(ifq)->ifq_maxlen = len\n# define IFQ_SET_READY(ifq)\t\t/* nothing */\n# define IFQ_PURGE(ifq)\t\t\t\\\ndo {\t\t\t\t\t\\\n  while ((ifq)->ifq_head != NULL)\t\\\n    {\t\t\t\t\t\\\n    struct mbuf *m;\t\t\t\\\n    IF_DEQUEUE(ifq, m);\t\t\t\\\n    m_freem(m);\t\t\t\t\\\n    }\t\t\t\t\t\\\n   } while (0)\n#endif\n\n#define HSSI_DESC \"SBE/LMC HSSI Card\"\n#define T3_DESC   \"SBE/LMC T3 Card\"\n#define SSI_DESC  \"SBE/LMC SSI Card\"\n#define T1E1_DESC \"SBE/LMC T1E1 Card\"\n\n/* procedure prototypes */\n\nstatic void shift_srom_bits(softc_t *, u_int32_t, u_int32_t);\nstatic u_int16_t read_srom(softc_t *, u_int8_t);\nstatic void write_srom(softc_t *, u_int8_t, u_int16_t);\n\nstatic u_int8_t read_bios(softc_t *, u_int32_t);\nstatic void write_bios_phys(softc_t *, u_int32_t, u_int8_t);\nstatic void write_bios(softc_t *, u_int32_t, u_int8_t);\nstatic void erase_bios(softc_t *);\n\nstatic void shift_mii_bits(softc_t *, u_int32_t, u_int32_t);\nstatic u_int16_t read_mii(softc_t *, u_int8_t);\nstatic void write_mii(softc_t *, u_int8_t, u_int16_t);\n\nstatic void set_mii16_bits(softc_t *, u_int16_t);\nstatic void clr_mii16_bits(softc_t *, u_int16_t);\nstatic void set_mii17_bits(softc_t *, u_int16_t);\nstatic void clr_mii17_bits(softc_t *, u_int16_t);\n\nstatic void led_off(softc_t *, u_int16_t);\nstatic void led_on(softc_t *, u_int16_t);\nstatic void led_inv(softc_t *, u_int16_t);\n\nstatic void write_framer(softc_t *, u_int16_t, u_int8_t);\nstatic u_int8_t read_framer(softc_t *, u_int16_t);\n\nstatic void make_gpio_input(softc_t *, u_int32_t);\nstatic void make_gpio_output(softc_t *, u_int32_t);\nstatic u_int32_t read_gpio(softc_t *);\nstatic void set_gpio_bits(softc_t *, u_int32_t);\nstatic void clr_gpio_bits(softc_t *, u_int32_t);\n\nstatic void reset_xilinx(softc_t *);\nstatic void  load_xilinx_from_rom(softc_t *);\nstatic int   load_xilinx_from_file(softc_t *, char *, u_int32_t);\n\nstatic void shift_synth_bits(softc_t *, u_int32_t, u_int32_t);\nstatic void write_synth(softc_t *, struct synth *);\n\nstatic void write_dac(softc_t *, u_int16_t);\n\nstatic void hssi_config(softc_t *);\nstatic void hssi_ident(softc_t *);\nstatic int  hssi_watchdog(softc_t *);\nstatic int  hssi_ioctl(softc_t *, struct ioctl *);\n\nstatic void t3_config(softc_t *);\nstatic void t3_ident(softc_t *);\nstatic int  t3_watchdog(softc_t *);\nstatic void t3_send_dbl_feac(softc_t *, int, int);\nstatic int  t3_ioctl(softc_t *, struct ioctl *);\n\nstatic void ssi_config(softc_t *);\nstatic void ssi_ident(softc_t *);\nstatic int  ssi_watchdog(softc_t *);\nstatic int  ssi_ioctl(softc_t *, struct ioctl *);\n\nstatic void t1_config(softc_t *);\nstatic void t1_ident(softc_t *);\nstatic int  t1_watchdog(softc_t *);\nstatic void t1_send_bop(softc_t *, int);\nstatic int  t1_ioctl(softc_t *, struct ioctl *);\n\n#if IFNET\n# if ((defined(__FreeBSD__) && (__FreeBSD_version < 500000)) ||\\\n        defined(__NetBSD__) || defined(__OpenBSD__) || defined(__bsdi__))\nstatic void netisr_dispatch(int, struct mbuf *);\n# endif\nstatic void lmc_raw_input(struct ifnet *, struct mbuf *);\n#endif /* IFNET */\n\n#if BSD\nstatic void mbuf_enqueue(struct desc_ring *, struct mbuf *);\nstatic struct mbuf* mbuf_dequeue(struct desc_ring *);\n# ifdef __FreeBSD__\nstatic void fbsd_dmamap_load(void *, bus_dma_segment_t *, int, int);\n# endif\nstatic int create_ring(softc_t *, struct desc_ring *, int);\nstatic void destroy_ring(softc_t *, struct desc_ring *);\nstatic int rxintr_cleanup(softc_t *);\nstatic int rxintr_setup(softc_t *);\nstatic int txintr_cleanup(softc_t *);\nstatic int txintr_setup_mbuf(softc_t *, struct mbuf *);\nstatic int txintr_setup(softc_t *);\n#endif /* BSD */\n\n#ifdef __linux__\nstatic void skbuff_enqueue(struct desc_ring *, struct sk_buff *);\nstatic struct sk_buff* skbuff_dequeue(struct desc_ring *);\nstatic int create_ring(softc_t *, struct desc_ring *, int);\nstatic void destroy_ring(softc_t *, struct desc_ring *);\nstatic int rxintr_cleanup(softc_t *);\nstatic int rxintr_setup(softc_t *);\nstatic int txintr_cleanup(softc_t *sc);\nstatic int txintr_setup_frag(softc_t *, char *, int);\nstatic int txintr_setup_skb(softc_t *, struct sk_buff *);\nstatic int txintr_setup(softc_t *);\n#endif /* __linux__ */\n\nstatic void check_intr_status(softc_t *);\nstatic void core_interrupt(void *, int);\nstatic void user_interrupt(softc_t *, int);\n#if BSD\n# if (defined(__FreeBSD__) && defined(DEVICE_POLLING))\nstatic int fbsd_poll(struct ifnet *, enum poll_cmd, int);\n# endif\nstatic intr_return_t bsd_interrupt(void *);\n#endif /* BSD */\n\nstatic void set_status(softc_t *, int);\n#if P2P\nstatic int p2p_getmdm(struct p2pcom *, caddr_t);\nstatic int p2p_mdmctl(struct p2pcom *, int);\n#endif\n#if NSPPP\nstatic void sppp_tls(struct sppp *);\nstatic void sppp_tlf(struct sppp *);\n#endif\n\nstatic void config_proto(softc_t *, struct config *);\nstatic int core_ioctl(softc_t *, u_long, caddr_t);\nstatic void core_watchdog(softc_t *);\n\n#if IFNET\nstatic int lmc_raw_ioctl(struct ifnet *, u_long, caddr_t);\nstatic int lmc_ifnet_ioctl(struct ifnet *, u_long, caddr_t);\nstatic void lmc_ifnet_start(struct ifnet *);\nstatic int lmc_raw_output(struct ifnet *, struct mbuf *,\n struct sockaddr *, struct route *);\n# ifdef __OpenBSD__\nstatic int ifmedia_change(struct ifnet *);\nstatic void ifmedia_status(struct ifnet *, struct ifmediareq *);\n# endif /* __OpenBSD__ */\nstatic void setup_ifnet(struct ifnet *);\nstatic int lmc_ifnet_attach(softc_t *);\nstatic void lmc_ifnet_detach(softc_t *);\n#endif /* IFNET */\n\n#if NETGRAPH\n# if (__FreeBSD_version >= 500000)\nstatic int ng_constructor(node_p);\n# else /* FreeBSD-4 */\nstatic int ng_constructor(node_p *);\n# endif\n# if (__FreeBSD_version >= 500000)\nstatic int ng_rcvmsg(node_p, item_p, hook_p);\n# else /* FreeBSD-4 */\nstatic int ng_rcvmsg(node_p, struct ng_mesg *,\n const char *,  struct ng_mesg **);\n# endif\nstatic int ng_shutdown(node_p);\nstatic int ng_newhook(node_p, hook_p, const char *);\nstatic int ng_connect(hook_p);\n# if (__FreeBSD_version >= 500000)\nstatic int ng_rcvdata(hook_p, item_p);\n# else /* FreeBSD-4 */\nstatic int ng_rcvdata(hook_p, struct mbuf *, meta_p);\n# endif\nstatic int ng_disconnect(hook_p);\n# if (IFNET == 0)\nstatic void ng_watchdog(void *);\n# endif\nstatic int ng_attach(softc_t *);\nstatic void ng_detach(softc_t *);\n#endif /* NETGRAPH */\n\nstatic int startup_card(softc_t *);\nstatic void shutdown_card(void *);\nstatic int attach_card(softc_t *, const char *);\nstatic void detach_card(softc_t *);\n\n#ifdef __FreeBSD__\nstatic int fbsd_probe(device_t);\nstatic int fbsd_detach(device_t);\nstatic int fbsd_shutdown(device_t);\nstatic int fbsd_attach(device_t);\n#endif /* __FreeBSD__ */\n\n#ifdef __NetBSD__\nstatic int nbsd_match(struct device *t, struct cfdata *, void *);\nstatic int nbsd_detach(struct device *, int);\nstatic void nbsd_attach(struct device *, struct device *, void *);\nstatic int lkm_nbsd_match(struct pci_attach_args *);\nint if_lmc_lkmentry(struct lkm_table *, int, int);\n#endif  /* __NetBSD__ */\n\n#ifdef __OpenBSD__\nstatic int obsd_match(struct device *, void *, void *);\nstatic int obsd_detach(struct device *, int);\nstatic void obsd_attach(struct device *, struct device *, void *);\nint if_lmc_lkmentry(struct lkm_table *, int, int);\n#endif  /* __OpenBSD__ */\n\n#ifdef __bsdi__\nstatic int bsdi_match(pci_devaddr_t *);\nstatic int bsdi_probe(struct device *, struct cfdata *, void *);\nstatic void bsdi_attach(struct device *, struct device *, void *);\n#endif  /* __bsdi__ */\n\n#ifdef __linux__\nstatic irqreturn_t linux_interrupt(int, void *, struct pt_regs *);\nstatic int linux_poll(struct net_device *, int *);\nstatic int linux_start(struct sk_buff *, struct net_device *);\nstatic void linux_timeout(struct net_device *);\nstatic int linux_ioctl(struct net_device *, struct ifreq *, int);\nstatic struct net_device_stats * linux_stats(struct net_device *);\nstatic void linux_watchdog(unsigned long);\nstatic int linux_stop(struct net_device *);\nstatic int linux_open(struct net_device *);\n# if GEN_HDLC\nstatic int hdlc_attach(struct net_device *,\n unsigned short, unsigned short);\n# endif\nstatic void __exit linux_remove(struct pci_dev *);\nstatic void setup_netdev(struct net_device *);\nstatic int __init linux_probe(struct pci_dev *, const struct pci_device_id *);\n#endif /* __linux__ */\n\n#endif /* KERNEL */\n\n#endif /* IF_LMC_H */\n"
  },
  {
    "path": "freebsd-headers/dev/mfi/mfi_ioctl.h",
    "content": "/*-\n * Copyright (c) 2006 IronPort Systems\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n */\n\n#include <sys/cdefs.h>\n__FBSDID(\"$FreeBSD: release/9.0.0/sys/dev/mfi/mfi_ioctl.h 196200 2009-08-13 23:18:45Z scottl $\");\n\n#include <dev/mfi/mfireg.h>\n\n#if defined(__amd64__) /* Assume amd64 wants 32 bit Linux */\nstruct iovec32 {\n\tu_int32_t\tiov_base;\n\tint\t\tiov_len;\n};\n#endif\n\n#define MFIQ_FREE\t0\n#define MFIQ_BIO\t1\n#define MFIQ_READY\t2\n#define MFIQ_BUSY\t3\n#define MFIQ_COUNT\t4\n\nstruct mfi_qstat {\n\tuint32_t\tq_length;\n\tuint32_t\tq_max;\n};\n\nunion mfi_statrequest {\n\tuint32_t\t\tms_item;\n\tstruct mfi_qstat\tms_qstat;\n};\n\n#define MAX_SPACE_FOR_SENSE_PTR\t\t32\nunion mfi_sense_ptr {\n\tuint8_t\t\tsense_ptr_data[MAX_SPACE_FOR_SENSE_PTR];\n\tvoid \t\t*user_space;\n\tstruct {\n\t\tuint32_t\tlow;\n\t\tuint32_t\thigh;\n\t} addr;\n} __packed;\n\n#define MAX_IOCTL_SGE\t16\n\nstruct mfi_ioc_packet {\n\tuint16_t\tmfi_adapter_no;\n\tuint16_t\tmfi_pad1;\n\tuint32_t\tmfi_sgl_off;\n\tuint32_t\tmfi_sge_count;\n\tuint32_t\tmfi_sense_off;\n\tuint32_t\tmfi_sense_len;\n\tunion {\n\t\tuint8_t raw[128];\n\t\tstruct mfi_frame_header hdr;\n\t} mfi_frame;\n\n\tstruct iovec mfi_sgl[MAX_IOCTL_SGE];\n} __packed;\n\n#ifdef __amd64__\nstruct mfi_ioc_packet32 {\n\tuint16_t\tmfi_adapter_no;\n\tuint16_t\tmfi_pad1;\n\tuint32_t\tmfi_sgl_off;\n\tuint32_t\tmfi_sge_count;\n\tuint32_t\tmfi_sense_off;\n\tuint32_t\tmfi_sense_len;\n\tunion {\n\t\tuint8_t raw[128];\n\t\tstruct mfi_frame_header hdr;\n\t} mfi_frame;\n\n\tstruct iovec32 mfi_sgl[MAX_IOCTL_SGE];\n} __packed;\n#endif\n\nstruct mfi_ioc_aen {\n\tuint16_t\taen_adapter_no;\n\tuint16_t\taen_pad1;\n\tuint32_t\taen_seq_num;\n\tuint32_t\taen_class_locale;\n} __packed;\n\n#define MFI_CMD\t\t_IOWR('M', 1, struct mfi_ioc_packet)\n#ifdef __amd64__\n#define MFI_CMD32\t_IOWR('M', 1, struct mfi_ioc_packet32)\n#endif\n#define MFI_SET_AEN\t_IOW('M', 3, struct mfi_ioc_aen)\n\n#define MAX_LINUX_IOCTL_SGE\t16\n\nstruct mfi_linux_ioc_packet {\n\tuint16_t\tlioc_adapter_no;\n\tuint16_t\tlioc_pad1;\n\tuint32_t\tlioc_sgl_off;\n\tuint32_t\tlioc_sge_count;\n\tuint32_t\tlioc_sense_off;\n\tuint32_t\tlioc_sense_len;\n\tunion {\n\t\tuint8_t raw[128];\n\t\tstruct mfi_frame_header hdr;\n\t} lioc_frame;\n\n#if defined(__amd64__) /* Assume amd64 wants 32 bit Linux */\n\tstruct iovec32 lioc_sgl[MAX_LINUX_IOCTL_SGE];\n#else\n\tstruct iovec lioc_sgl[MAX_LINUX_IOCTL_SGE];\n#endif\n} __packed;\n\nstruct mfi_ioc_passthru {\n\tstruct mfi_dcmd_frame\tioc_frame;\n\tuint32_t\t\tbuf_size;\n\tuint8_t\t\t\t*buf;\n} __packed;\n\n#ifdef __amd64__\nstruct mfi_ioc_passthru32 {\n\tstruct mfi_dcmd_frame\tioc_frame;\n\tuint32_t\t\tbuf_size;\n\tuint32_t\t\tbuf;\n} __packed;\n#endif\n\n#define MFIIO_STATS\t_IOWR('Q', 101, union mfi_statrequest)\n#define MFIIO_PASSTHRU\t_IOWR('C', 102, struct mfi_ioc_passthru)\n#ifdef __amd64__\n#define MFIIO_PASSTHRU32\t_IOWR('C', 102, struct mfi_ioc_passthru32)\n#endif\n\nstruct mfi_linux_ioc_aen {\n\tuint16_t\tlaen_adapter_no;\n\tuint16_t\tlaen_pad1;\n\tuint32_t\tlaen_seq_num;\n\tuint32_t\tlaen_class_locale;\n} __packed;\n\nstruct mfi_query_disk {\n\tuint8_t\tarray_id;\n\tuint8_t\tpresent;\n\tuint8_t\topen;\n\tuint8_t reserved;\t/* reserved for future use */\n\tchar\tdevname[SPECNAMELEN + 1];\n} __packed;\n\n#define MFIIO_QUERY_DISK\t_IOWR('Q', 102, struct mfi_query_disk)\n\n/*\n * Create a second set so the FreeBSD native ioctl doesn't\n * conflict in FreeBSD ioctl handler.  Translate in mfi_linux.c.\n */\n#define MFI_LINUX_CMD\t\t0xc1144d01\n#define MFI_LINUX_SET_AEN\t0x400c4d03\n#define MFI_LINUX_CMD_2\t\t0xc1144d02\n#define MFI_LINUX_SET_AEN_2\t0x400c4d04\n"
  },
  {
    "path": "freebsd-headers/dev/mfi/mfireg.h",
    "content": "/*-\n * Copyright (c) 2006 IronPort Systems\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n */\n/*-\n * Copyright (c) 2007 LSI Corp.\n * Copyright (c) 2007 Rajesh Prabhakaran.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n */\n\n#ifndef _MFIREG_H\n#define _MFIREG_H\n\n#include <sys/cdefs.h>\n__FBSDID(\"$FreeBSD: release/9.0.0/sys/dev/mfi/mfireg.h 224041 2011-07-14 20:20:33Z jhb $\");\n\n/*\n * MegaRAID SAS MFI firmware definitions\n *\n * Calling this driver 'MegaRAID SAS' is a bit misleading.  It's a completely\n * new firmware interface from the old AMI MegaRAID one, and there is no\n * reason why this interface should be limited to just SAS.  In any case, LSI\n * seems to also call this interface 'MFI', so that will be used here.\n */\n\n/*\n * Start with the register set.  All registers are 32 bits wide.\n * The usual Intel IOP style setup.\n */\n#define MFI_IMSG0\t0x10\t/* Inbound message 0 */\n#define MFI_IMSG1\t0x14\t/* Inbound message 1 */\n#define MFI_OMSG0\t0x18\t/* Outbound message 0 */\n#define MFI_OMSG1\t0x1c\t/* Outbound message 1 */\n#define MFI_IDB\t\t0x20\t/* Inbound doorbell */\n#define MFI_ISTS\t0x24\t/* Inbound interrupt status */\n#define MFI_IMSK\t0x28\t/* Inbound interrupt mask */\n#define MFI_ODB\t\t0x2c\t/* Outbound doorbell */\n#define MFI_OSTS\t0x30\t/* Outbound interrupt status */\n#define MFI_OMSK\t0x34\t/* Outbound interrupt mask */\n#define MFI_IQP\t\t0x40\t/* Inbound queue port */\n#define MFI_OQP\t\t0x44\t/* Outbound queue port */\n\n/*\n * 1078 specific related register\n */\n#define MFI_ODR0\t0x9c \t\t/* outbound doorbell register0 */\n#define MFI_ODCR0\t0xa0 \t\t/* outbound doorbell clear register0  */\n#define MFI_OSP0\t0xb0 \t\t/* outbound scratch pad0  */\n#define MFI_1078_EIM\t0x80000004 \t/* 1078 enable intrrupt mask  */\n#define MFI_RMI\t\t0x2 \t\t/* reply message interrupt  */       \n#define MFI_1078_RM\t0x80000000 \t/* reply 1078 message interrupt  */\n#define MFI_ODC\t\t0x4 \t\t/* outbound doorbell change interrupt */\n\n/*\n * GEN2 specific changes\n */\n#define MFI_GEN2_EIM\t0x00000005\t/* GEN2 enable interrupt mask */\n#define MFI_GEN2_RM\t0x00000001\t/* reply GEN2 message interrupt */\n\n/* Bits for MFI_OSTS */\n#define MFI_OSTS_INTR_VALID\t0x00000002\n\n/*\n * Firmware state values.  Found in OMSG0 during initialization.\n */\n#define MFI_FWSTATE_MASK\t\t0xf0000000\n#define MFI_FWSTATE_UNDEFINED\t\t0x00000000\n#define MFI_FWSTATE_BB_INIT\t\t0x10000000\n#define MFI_FWSTATE_FW_INIT\t\t0x40000000\n#define MFI_FWSTATE_WAIT_HANDSHAKE\t0x60000000\n#define MFI_FWSTATE_FW_INIT_2\t\t0x70000000\n#define MFI_FWSTATE_DEVICE_SCAN\t\t0x80000000\n#define MFI_FWSTATE_BOOT_MESSAGE_PENDING\t0x90000000\n#define MFI_FWSTATE_FLUSH_CACHE\t\t0xa0000000\n#define MFI_FWSTATE_READY\t\t0xb0000000\n#define MFI_FWSTATE_OPERATIONAL\t\t0xc0000000\n#define MFI_FWSTATE_FAULT\t\t0xf0000000\n#define MFI_FWSTATE_MAXSGL_MASK\t\t0x00ff0000\n#define MFI_FWSTATE_MAXCMD_MASK\t\t0x0000ffff\n\n/*\n * Control bits to drive the card to ready state.  These go into the IDB\n * register.\n */\n#define MFI_FWINIT_ABORT\t0x00000000 /* Abort all pending commands */\n#define MFI_FWINIT_READY\t0x00000002 /* Move from operational to ready */\n#define MFI_FWINIT_MFIMODE\t0x00000004 /* unknown */\n#define MFI_FWINIT_CLEAR_HANDSHAKE 0x00000008 /* Respond to WAIT_HANDSHAKE */\n#define MFI_FWINIT_HOTPLUG\t0x00000010\n\n/* MFI Commands */\ntypedef enum {\n\tMFI_CMD_INIT =\t\t0x00,\n\tMFI_CMD_LD_READ,\n\tMFI_CMD_LD_WRITE,\n\tMFI_CMD_LD_SCSI_IO,\n\tMFI_CMD_PD_SCSI_IO,\n\tMFI_CMD_DCMD,\n\tMFI_CMD_ABORT,\n\tMFI_CMD_SMP,\n\tMFI_CMD_STP\n} mfi_cmd_t;\n\n/* Direct commands */\ntypedef enum {\n\tMFI_DCMD_CTRL_GETINFO =\t\t0x01010000,\n\tMFI_DCMD_CTRL_MFC_DEFAULTS_GET =0x010e0201,\n\tMFI_DCMD_CTRL_MFC_DEFAULTS_SET =0x010e0202,\n\tMFI_DCMD_CTRL_FLUSHCACHE =\t0x01101000,\n\tMFI_DCMD_CTRL_SHUTDOWN =\t0x01050000,\n\tMFI_DCMD_CTRL_EVENT_GETINFO =\t0x01040100,\n\tMFI_DCMD_CTRL_EVENT_GET =\t0x01040300,\n\tMFI_DCMD_CTRL_EVENT_WAIT =\t0x01040500,\n\tMFI_DCMD_PR_GET_STATUS =\t0x01070100,\n\tMFI_DCMD_PR_GET_PROPERTIES =\t0x01070200,\n\tMFI_DCMD_PR_SET_PROPERTIES =\t0x01070300,\n\tMFI_DCMD_PR_START =\t\t0x01070400,\n\tMFI_DCMD_PR_STOP =\t\t0x01070500,\n\tMFI_DCMD_TIME_SECS_GET =\t0x01080201,\n\tMFI_DCMD_FLASH_FW_OPEN =\t0x010f0100,\n\tMFI_DCMD_FLASH_FW_DOWNLOAD =\t0x010f0200,\n\tMFI_DCMD_FLASH_FW_FLASH =\t0x010f0300,\n\tMFI_DCMD_FLASH_FW_CLOSE =\t0x010f0400,\n\tMFI_DCMD_PD_GET_LIST =\t\t0x02010000,\n\tMFI_DCMD_PD_GET_INFO = \t\t0x02020000,\n\tMFI_DCMD_PD_STATE_SET =\t\t0x02030100,\n\tMFI_DCMD_PD_REBUILD_START =\t0x02040100,\n\tMFI_DCMD_PD_REBUILD_ABORT =\t0x02040200,\n\tMFI_DCMD_PD_CLEAR_START =\t0x02050100,\n\tMFI_DCMD_PD_CLEAR_ABORT =\t0x02050200,\n\tMFI_DCMD_PD_GET_PROGRESS =\t0x02060000,\n\tMFI_DCMD_PD_LOCATE_START =\t0x02070100,\n\tMFI_DCMD_PD_LOCATE_STOP =\t0x02070200,\n\tMFI_DCMD_LD_GET_LIST =\t\t0x03010000,\n\tMFI_DCMD_LD_GET_INFO =\t\t0x03020000,\n\tMFI_DCMD_LD_GET_PROP =\t\t0x03030000,\n\tMFI_DCMD_LD_SET_PROP =\t\t0x03040000,\n\tMFI_DCMD_LD_INIT_START =\t0x03060100,\n\tMFI_DCMD_LD_DELETE =\t\t0x03090000,\n\tMFI_DCMD_CFG_READ =\t\t0x04010000,\n\tMFI_DCMD_CFG_ADD =\t\t0x04020000,\n\tMFI_DCMD_CFG_CLEAR =\t\t0x04030000,\n\tMFI_DCMD_CFG_MAKE_SPARE =\t0x04040000,\n\tMFI_DCMD_CFG_REMOVE_SPARE =\t0x04050000,\t\n\tMFI_DCMD_CFG_FOREIGN_IMPORT =\t0x04060400,\n\tMFI_DCMD_BBU_GET_STATUS =\t0x05010000,\n\tMFI_DCMD_BBU_GET_CAPACITY_INFO =0x05020000,\n\tMFI_DCMD_BBU_GET_DESIGN_INFO =\t0x05030000,\n\tMFI_DCMD_CLUSTER =\t\t0x08000000,\n\tMFI_DCMD_CLUSTER_RESET_ALL =\t0x08010100,\n\tMFI_DCMD_CLUSTER_RESET_LD =\t0x08010200\n} mfi_dcmd_t;\n\n/* Modifiers for MFI_DCMD_CTRL_FLUSHCACHE */\n#define MFI_FLUSHCACHE_CTRL\t0x01\n#define MFI_FLUSHCACHE_DISK\t0x02\n\n/* Modifiers for MFI_DCMD_CTRL_SHUTDOWN */\n#define MFI_SHUTDOWN_SPINDOWN\t0x01\n\n/*\n * MFI Frame flags\n */\n#define MFI_FRAME_POST_IN_REPLY_QUEUE\t\t0x0000\n#define MFI_FRAME_DONT_POST_IN_REPLY_QUEUE\t0x0001\n#define MFI_FRAME_SGL32\t\t\t\t0x0000\n#define MFI_FRAME_SGL64\t\t\t\t0x0002\n#define MFI_FRAME_SENSE32\t\t\t0x0000\n#define MFI_FRAME_SENSE64\t\t\t0x0004\n#define MFI_FRAME_DIR_NONE\t\t\t0x0000\n#define MFI_FRAME_DIR_WRITE\t\t\t0x0008\n#define MFI_FRAME_DIR_READ\t\t\t0x0010\n#define MFI_FRAME_DIR_BOTH\t\t\t0x0018\n\n/* MFI Status codes */\ntypedef enum {\n\tMFI_STAT_OK =\t\t\t0x00,\n\tMFI_STAT_INVALID_CMD,\n\tMFI_STAT_INVALID_DCMD,\n\tMFI_STAT_INVALID_PARAMETER,\n\tMFI_STAT_INVALID_SEQUENCE_NUMBER,\n\tMFI_STAT_ABORT_NOT_POSSIBLE,\n\tMFI_STAT_APP_HOST_CODE_NOT_FOUND,\n\tMFI_STAT_APP_IN_USE,\n\tMFI_STAT_APP_NOT_INITIALIZED,\n\tMFI_STAT_ARRAY_INDEX_INVALID,\n\tMFI_STAT_ARRAY_ROW_NOT_EMPTY,\n\tMFI_STAT_CONFIG_RESOURCE_CONFLICT,\n\tMFI_STAT_DEVICE_NOT_FOUND,\n\tMFI_STAT_DRIVE_TOO_SMALL,\n\tMFI_STAT_FLASH_ALLOC_FAIL,\n\tMFI_STAT_FLASH_BUSY,\n\tMFI_STAT_FLASH_ERROR =\t\t0x10,\n\tMFI_STAT_FLASH_IMAGE_BAD,\n\tMFI_STAT_FLASH_IMAGE_INCOMPLETE,\n\tMFI_STAT_FLASH_NOT_OPEN,\n\tMFI_STAT_FLASH_NOT_STARTED,\n\tMFI_STAT_FLUSH_FAILED,\n\tMFI_STAT_HOST_CODE_NOT_FOUNT,\n\tMFI_STAT_LD_CC_IN_PROGRESS,\n\tMFI_STAT_LD_INIT_IN_PROGRESS,\n\tMFI_STAT_LD_LBA_OUT_OF_RANGE,\n\tMFI_STAT_LD_MAX_CONFIGURED,\n\tMFI_STAT_LD_NOT_OPTIMAL,\n\tMFI_STAT_LD_RBLD_IN_PROGRESS,\n\tMFI_STAT_LD_RECON_IN_PROGRESS,\n\tMFI_STAT_LD_WRONG_RAID_LEVEL,\n\tMFI_STAT_MAX_SPARES_EXCEEDED,\n\tMFI_STAT_MEMORY_NOT_AVAILABLE =\t0x20,\n\tMFI_STAT_MFC_HW_ERROR,\n\tMFI_STAT_NO_HW_PRESENT,\n\tMFI_STAT_NOT_FOUND,\n\tMFI_STAT_NOT_IN_ENCL,\n\tMFI_STAT_PD_CLEAR_IN_PROGRESS,\n\tMFI_STAT_PD_TYPE_WRONG,\n\tMFI_STAT_PR_DISABLED,\n\tMFI_STAT_ROW_INDEX_INVALID,\n\tMFI_STAT_SAS_CONFIG_INVALID_ACTION,\n\tMFI_STAT_SAS_CONFIG_INVALID_DATA,\n\tMFI_STAT_SAS_CONFIG_INVALID_PAGE,\n\tMFI_STAT_SAS_CONFIG_INVALID_TYPE,\n\tMFI_STAT_SCSI_DONE_WITH_ERROR,\n\tMFI_STAT_SCSI_IO_FAILED,\n\tMFI_STAT_SCSI_RESERVATION_CONFLICT,\n\tMFI_STAT_SHUTDOWN_FAILED =\t0x30,\n\tMFI_STAT_TIME_NOT_SET,\n\tMFI_STAT_WRONG_STATE,\n\tMFI_STAT_LD_OFFLINE,\n\tMFI_STAT_PEER_NOTIFICATION_REJECTED,\n\tMFI_STAT_PEER_NOTIFICATION_FAILED,\n\tMFI_STAT_RESERVATION_IN_PROGRESS,\n\tMFI_STAT_I2C_ERRORS_DETECTED,\n\tMFI_STAT_PCI_ERRORS_DETECTED,\n\tMFI_STAT_DIAG_FAILED,\n\tMFI_STAT_BOOT_MSG_PENDING,\n\tMFI_STAT_FOREIGN_CONFIG_INCOMPLETE,\n\tMFI_STAT_INVALID_STATUS =\t0xFF\n} mfi_status_t;\n\ntypedef enum {\n\tMFI_EVT_CLASS_DEBUG =\t\t-2,\n\tMFI_EVT_CLASS_PROGRESS =\t-1,\n\tMFI_EVT_CLASS_INFO =\t\t0,\n\tMFI_EVT_CLASS_WARNING =\t\t1,\n\tMFI_EVT_CLASS_CRITICAL =\t2,\n\tMFI_EVT_CLASS_FATAL =\t\t3,\n\tMFI_EVT_CLASS_DEAD =\t\t4\n} mfi_evt_class_t;\n\ntypedef enum {\n\tMFI_EVT_LOCALE_LD =\t\t0x0001,\n\tMFI_EVT_LOCALE_PD =\t\t0x0002,\n\tMFI_EVT_LOCALE_ENCL =\t\t0x0004,\n\tMFI_EVT_LOCALE_BBU =\t\t0x0008,\n\tMFI_EVT_LOCALE_SAS =\t\t0x0010,\n\tMFI_EVT_LOCALE_CTRL =\t\t0x0020,\n\tMFI_EVT_LOCALE_CONFIG =\t\t0x0040,\n\tMFI_EVT_LOCALE_CLUSTER =\t0x0080,\n\tMFI_EVT_LOCALE_ALL =\t\t0xffff\n} mfi_evt_locale_t;\n\ntypedef enum {\n\tMR_EVT_ARGS_NONE =\t\t0x00,\n\tMR_EVT_ARGS_CDB_SENSE,\n\tMR_EVT_ARGS_LD,\n\tMR_EVT_ARGS_LD_COUNT,\n\tMR_EVT_ARGS_LD_LBA,\n\tMR_EVT_ARGS_LD_OWNER,\n\tMR_EVT_ARGS_LD_LBA_PD_LBA,\n\tMR_EVT_ARGS_LD_PROG,\n\tMR_EVT_ARGS_LD_STATE,\n\tMR_EVT_ARGS_LD_STRIP,\n\tMR_EVT_ARGS_PD,\n\tMR_EVT_ARGS_PD_ERR,\n\tMR_EVT_ARGS_PD_LBA,\n\tMR_EVT_ARGS_PD_LBA_LD,\n\tMR_EVT_ARGS_PD_PROG,\n\tMR_EVT_ARGS_PD_STATE,\n\tMR_EVT_ARGS_PCI,\n\tMR_EVT_ARGS_RATE,\n\tMR_EVT_ARGS_STR,\n\tMR_EVT_ARGS_TIME,\n\tMR_EVT_ARGS_ECC\n} mfi_evt_args;\n\ntypedef enum {\n\tMR_LD_CACHE_WRITE_BACK =\t0x01,\n\tMR_LD_CACHE_WRITE_ADAPTIVE =\t0x02,\n\tMR_LD_CACHE_READ_AHEAD =\t0x04,\n\tMR_LD_CACHE_READ_ADAPTIVE =\t0x08,\n\tMR_LD_CACHE_WRITE_CACHE_BAD_BBU=0x10,\n\tMR_LD_CACHE_ALLOW_WRITE_CACHE =\t0x20,\n\tMR_LD_CACHE_ALLOW_READ_CACHE =\t0x40\n} mfi_ld_cache;\n#define\tMR_LD_CACHE_MASK\t0x7f\n\n#define\tMR_LD_CACHE_POLICY_READ_AHEAD_NONE\t\t0\n#define\tMR_LD_CACHE_POLICY_READ_AHEAD_ALWAYS\t\tMR_LD_CACHE_READ_AHEAD\n#define\tMR_LD_CACHE_POLICY_READ_AHEAD_ADAPTIVE\t\t\\\n\t(MR_LD_CACHE_READ_AHEAD | MR_LD_CACHE_READ_ADAPTIVE)\n#define\tMR_LD_CACHE_POLICY_WRITE_THROUGH\t\t0\n#define\tMR_LD_CACHE_POLICY_WRITE_BACK\t\t\tMR_LD_CACHE_WRITE_BACK\n#define\tMR_LD_CACHE_POLICY_IO_CACHED\t\t\t\\\n\t(MR_LD_CACHE_ALLOW_WRITE_CACHE | MR_LD_CACHE_ALLOW_READ_CACHE)\n#define\tMR_LD_CACHE_POLICY_IO_DIRECT\t\t\t0\n\ntypedef enum {\n\tMR_PD_CACHE_UNCHANGED  =\t0,\n\tMR_PD_CACHE_ENABLE =\t\t1,\n\tMR_PD_CACHE_DISABLE =\t\t2\n} mfi_pd_cache;\n\n/*\n * Other propertities and definitions\n */\n#define MFI_MAX_PD_CHANNELS\t2\n#define MFI_MAX_LD_CHANNELS\t2\n#define MFI_MAX_CHANNELS\t(MFI_MAX_PD_CHANNELS + MFI_MAX_LD_CHANNELS)\n#define MFI_MAX_CHANNEL_DEVS\t128\n#define MFI_DEFAULT_ID\t\t-1\n#define MFI_MAX_LUN\t\t8\n#define MFI_MAX_LD\t\t64\n#define\tMFI_MAX_PD\t\t256\n\n#define MFI_FRAME_SIZE\t\t64\n#define MFI_MBOX_SIZE\t\t12\n\n/* Firmware flashing can take 40s */\n#define MFI_POLL_TIMEOUT_SECS\t50\n\n/* Allow for speedier math calculations */\n#define MFI_SECTOR_LEN\t\t512\n\n/* Scatter Gather elements */\nstruct mfi_sg32 {\n\tuint32_t\taddr;\n\tuint32_t\tlen;\n} __packed;\n\nstruct mfi_sg64 {\n\tuint64_t\taddr;\n\tuint32_t\tlen;\n} __packed;\n\nunion mfi_sgl {\n\tstruct mfi_sg32\tsg32[1];\n\tstruct mfi_sg64\tsg64[1];\n} __packed;\n\n/* Message frames.  All messages have a common header */\nstruct mfi_frame_header {\n\tuint8_t\t\tcmd;\n\tuint8_t\t\tsense_len;\n\tuint8_t\t\tcmd_status;\n\tuint8_t\t\tscsi_status;\n\tuint8_t\t\ttarget_id;\n\tuint8_t\t\tlun_id;\n\tuint8_t\t\tcdb_len;\n\tuint8_t\t\tsg_count;\n\tuint32_t\tcontext;\n\tuint32_t\tpad0;\n\tuint16_t\tflags;\n#define MFI_FRAME_DATAOUT\t0x08\n#define MFI_FRAME_DATAIN\t0x10\n\tuint16_t\ttimeout;\n\tuint32_t\tdata_len;\n} __packed;\n\nstruct mfi_init_frame {\n\tstruct mfi_frame_header\theader;\n\tuint32_t\tqinfo_new_addr_lo;\n\tuint32_t\tqinfo_new_addr_hi;\n\tuint32_t\tqinfo_old_addr_lo;\n\tuint32_t\tqinfo_old_addr_hi;\n\tuint32_t\treserved[6];\n} __packed;\n\n#define MFI_IO_FRAME_SIZE 40\nstruct mfi_io_frame {\n\tstruct mfi_frame_header\theader;\n\tuint32_t\tsense_addr_lo;\n\tuint32_t\tsense_addr_hi;\n\tuint32_t\tlba_lo;\n\tuint32_t\tlba_hi;\n\tunion mfi_sgl\tsgl;\n} __packed;\n\n#define MFI_PASS_FRAME_SIZE 48\nstruct mfi_pass_frame {\n\tstruct mfi_frame_header header;\n\tuint32_t\tsense_addr_lo;\n\tuint32_t\tsense_addr_hi;\n\tuint8_t\t\tcdb[16];\n\tunion mfi_sgl\tsgl;\n} __packed;\n\n#define MFI_DCMD_FRAME_SIZE 40\nstruct mfi_dcmd_frame {\n\tstruct mfi_frame_header header;\n\tuint32_t\topcode;\n\tuint8_t\t\tmbox[MFI_MBOX_SIZE];\n\tunion mfi_sgl\tsgl;\n} __packed;\n\nstruct mfi_abort_frame {\n\tstruct mfi_frame_header header;\n\tuint32_t\tabort_context;\n\tuint32_t\tpad;\n\tuint32_t\tabort_mfi_addr_lo;\n\tuint32_t\tabort_mfi_addr_hi;\n\tuint32_t\treserved[6];\n} __packed;\n\nstruct mfi_smp_frame {\n\tstruct mfi_frame_header header;\n\tuint64_t\tsas_addr;\n\tunion {\n\t\tstruct mfi_sg32 sg32[2];\n\t\tstruct mfi_sg64 sg64[2];\n\t} sgl;\n} __packed;\n\nstruct mfi_stp_frame {\n\tstruct mfi_frame_header header;\n\tuint16_t\tfis[10];\n\tuint32_t\tstp_flags;\n\tunion {\n\t\tstruct mfi_sg32 sg32[2];\n\t\tstruct mfi_sg64 sg64[2];\n\t} sgl;\n} __packed;\n\nunion mfi_frame {\n\tstruct mfi_frame_header header;\n\tstruct mfi_init_frame\tinit;\n\tstruct mfi_io_frame\tio;\n\tstruct mfi_pass_frame\tpass;\n\tstruct mfi_dcmd_frame\tdcmd;\n\tstruct mfi_abort_frame\tabort;\n\tstruct mfi_smp_frame\tsmp;\n\tstruct mfi_stp_frame\tstp;\n\tuint8_t\t\t\tbytes[MFI_FRAME_SIZE];\n};\n\n#define MFI_SENSE_LEN 128\nstruct mfi_sense {\n\tuint8_t\t\tdata[MFI_SENSE_LEN];\n};\n\n/* The queue init structure that is passed with the init message */\nstruct mfi_init_qinfo {\n\tuint32_t\tflags;\n\tuint32_t\trq_entries;\n\tuint32_t\trq_addr_lo;\n\tuint32_t\trq_addr_hi;\n\tuint32_t\tpi_addr_lo;\n\tuint32_t\tpi_addr_hi;\n\tuint32_t\tci_addr_lo;\n\tuint32_t\tci_addr_hi;\n} __packed;\n\n/* SAS (?) controller properties, part of mfi_ctrl_info */\nstruct mfi_ctrl_props {\n\tuint16_t\tseq_num;\n\tuint16_t\tpred_fail_poll_interval;\n\tuint16_t\tintr_throttle_cnt;\n\tuint16_t\tintr_throttle_timeout;\n\tuint8_t\t\trebuild_rate;\n\tuint8_t\t\tpatrol_read_rate;\n\tuint8_t\t\tbgi_rate;\n\tuint8_t\t\tcc_rate;\n\tuint8_t\t\trecon_rate;\n\tuint8_t\t\tcache_flush_interval;\n\tuint8_t\t\tspinup_drv_cnt;\n\tuint8_t\t\tspinup_delay;\n\tuint8_t\t\tcluster_enable;\n\tuint8_t\t\tcoercion_mode;\n\tuint8_t\t\talarm_enable;\n\tuint8_t\t\tdisable_auto_rebuild;\n\tuint8_t\t\tdisable_battery_warn;\n\tuint8_t\t\tecc_bucket_size;\n\tuint16_t\tecc_bucket_leak_rate;\n\tuint8_t\t\trestore_hotspare_on_insertion;\n\tuint8_t\t\texpose_encl_devices;\n\tuint8_t\t\treserved[38];\n} __packed;\n\n/* PCI information about the card. */\nstruct mfi_info_pci {\n\tuint16_t\tvendor;\n\tuint16_t\tdevice;\n\tuint16_t\tsubvendor;\n\tuint16_t\tsubdevice;\n\tuint8_t\t\treserved[24];\n} __packed;\n\n/* Host (front end) interface information */\nstruct mfi_info_host {\n\tuint8_t\t\ttype;\n#define MFI_INFO_HOST_PCIX\t0x01\n#define MFI_INFO_HOST_PCIE\t0x02\n#define MFI_INFO_HOST_ISCSI\t0x04\n#define MFI_INFO_HOST_SAS3G\t0x08\n\tuint8_t\t\treserved[6];\n\tuint8_t\t\tport_count;\n\tuint64_t\tport_addr[8];\n} __packed;\n\n/* Device (back end) interface information */\nstruct mfi_info_device {\n\tuint8_t\t\ttype;\n#define MFI_INFO_DEV_SPI\t0x01\n#define MFI_INFO_DEV_SAS3G\t0x02\n#define MFI_INFO_DEV_SATA1\t0x04\n#define MFI_INFO_DEV_SATA3G\t0x08\n\tuint8_t\t\treserved[6];\n\tuint8_t\t\tport_count;\n\tuint64_t\tport_addr[8];\n} __packed;\n\n/* Firmware component information */\nstruct mfi_info_component {\n\tchar\t\t name[8];\n\tchar\t\t version[32];\n\tchar\t\t build_date[16];\n\tchar\t\t build_time[16];\n} __packed;\n\n/* Controller default settings */\nstruct mfi_defaults {\n\tuint64_t\tsas_addr;\n\tuint8_t\t\tphy_polarity;\n\tuint8_t\t\tbackground_rate;\n\tuint8_t\t\tstripe_size;\n\tuint8_t\t\tflush_time;\n\tuint8_t\t\twrite_back;\n\tuint8_t\t\tread_ahead;\n\tuint8_t\t\tcache_when_bbu_bad;\n\tuint8_t\t\tcached_io;\n\tuint8_t\t\tsmart_mode;\n\tuint8_t\t\talarm_disable;\n\tuint8_t\t\tcoercion;\n\tuint8_t\t\tzrc_config;\n\tuint8_t\t\tdirty_led_shows_drive_activity;\n\tuint8_t\t\tbios_continue_on_error;\n\tuint8_t\t\tspindown_mode;\n\tuint8_t\t\tallowed_device_types;\n\tuint8_t\t\tallow_mix_in_enclosure;\n\tuint8_t\t\tallow_mix_in_ld;\n\tuint8_t\t\tallow_sata_in_cluster;\n\tuint8_t\t\tmax_chained_enclosures;\n\tuint8_t\t\tdisable_ctrl_r;\n\tuint8_t\t\tenabel_web_bios;\n\tuint8_t\t\tphy_polarity_split;\n\tuint8_t\t\tdirect_pd_mapping;\n\tuint8_t\t\tbios_enumerate_lds;\n\tuint8_t\t\trestored_hot_spare_on_insertion;\n\tuint8_t\t\texpose_enclosure_devices;\n\tuint8_t\t\tmaintain_pd_fail_history;\n\tuint8_t\t\tresv[28];\n} __packed;\n\n/* Controller default settings */\nstruct mfi_bios_data {\n\tuint16_t\tboot_target_id;\n\tuint8_t\t\tdo_not_int_13;\n\tuint8_t\t\tcontinue_on_error;\n\tuint8_t\t\tverbose;\n\tuint8_t\t\tgeometry;\n\tuint8_t\t\texpose_all_drives;\n\tuint8_t\t\treserved[56];\n\tuint8_t\t\tcheck_sum;\n} __packed;\n\n/* SAS (?) controller info, returned from MFI_DCMD_CTRL_GETINFO. */\nstruct mfi_ctrl_info {\n\tstruct mfi_info_pci\tpci;\n\tstruct mfi_info_host\thost;\n\tstruct mfi_info_device\tdevice;\n\n\t/* Firmware components that are present and active. */\n\tuint32_t\t\timage_check_word;\n\tuint32_t\t\timage_component_count;\n\tstruct mfi_info_component image_component[8];\n\n\t/* Firmware components that have been flashed but are inactive */\n\tuint32_t\t\tpending_image_component_count;\n\tstruct mfi_info_component pending_image_component[8];\n\n\tuint8_t\t\t\tmax_arms;\n\tuint8_t\t\t\tmax_spans;\n\tuint8_t\t\t\tmax_arrays;\n\tuint8_t\t\t\tmax_lds;\n\tchar\t\t\tproduct_name[80];\n\tchar\t\t\tserial_number[32];\n\tuint32_t\t\thw_present;\n#define MFI_INFO_HW_BBU\t\t0x01\n#define MFI_INFO_HW_ALARM\t0x02\n#define MFI_INFO_HW_NVRAM\t0x04\n#define MFI_INFO_HW_UART\t0x08\n\tuint32_t\t\tcurrent_fw_time;\n\tuint16_t\t\tmax_cmds;\n\tuint16_t\t\tmax_sg_elements;\n\tuint32_t\t\tmax_request_size;\n\tuint16_t\t\tlds_present;\n\tuint16_t\t\tlds_degraded;\n\tuint16_t\t\tlds_offline;\n\tuint16_t\t\tpd_present;\n\tuint16_t\t\tpd_disks_present;\n\tuint16_t\t\tpd_disks_pred_failure;\n\tuint16_t\t\tpd_disks_failed;\n\tuint16_t\t\tnvram_size;\n\tuint16_t\t\tmemory_size;\n\tuint16_t\t\tflash_size;\n\tuint16_t\t\tram_correctable_errors;\n\tuint16_t\t\tram_uncorrectable_errors;\n\tuint8_t\t\t\tcluster_allowed;\n\tuint8_t\t\t\tcluster_active;\n\tuint16_t\t\tmax_strips_per_io;\n\n\tuint32_t\t\traid_levels;\n#define MFI_INFO_RAID_0\t\t0x01\n#define MFI_INFO_RAID_1\t\t0x02\n#define MFI_INFO_RAID_5\t\t0x04\n#define MFI_INFO_RAID_1E\t0x08\n#define MFI_INFO_RAID_6\t\t0x10\n\n\tuint32_t\t\tadapter_ops;\n#define MFI_INFO_AOPS_RBLD_RATE\t\t0x0001\n#define MFI_INFO_AOPS_CC_RATE\t\t0x0002\n#define MFI_INFO_AOPS_BGI_RATE\t\t0x0004\n#define MFI_INFO_AOPS_RECON_RATE\t0x0008\n#define MFI_INFO_AOPS_PATROL_RATE\t0x0010\n#define MFI_INFO_AOPS_ALARM_CONTROL\t0x0020\n#define MFI_INFO_AOPS_CLUSTER_SUPPORTED\t0x0040\n#define MFI_INFO_AOPS_BBU\t\t0x0080\n#define MFI_INFO_AOPS_SPANNING_ALLOWED\t0x0100\n#define MFI_INFO_AOPS_DEDICATED_SPARES\t0x0200\n#define MFI_INFO_AOPS_REVERTIBLE_SPARES\t0x0400\n#define MFI_INFO_AOPS_FOREIGN_IMPORT\t0x0800\n#define MFI_INFO_AOPS_SELF_DIAGNOSTIC\t0x1000\n#define MFI_INFO_AOPS_MIXED_ARRAY\t0x2000\n#define MFI_INFO_AOPS_GLOBAL_SPARES\t0x4000\n\n\tuint32_t\t\tld_ops;\n#define MFI_INFO_LDOPS_READ_POLICY\t0x01\n#define MFI_INFO_LDOPS_WRITE_POLICY\t0x02\n#define MFI_INFO_LDOPS_IO_POLICY\t0x04\n#define MFI_INFO_LDOPS_ACCESS_POLICY\t0x08\n#define MFI_INFO_LDOPS_DISK_CACHE_POLICY 0x10\n\n\tstruct {\n\t\tuint8_t\t\tmin;\n\t\tuint8_t\t\tmax;\n\t\tuint8_t\t\treserved[2];\n\t} __packed stripe_sz_ops;\n\n\tuint32_t\t\tpd_ops;\n#define MFI_INFO_PDOPS_FORCE_ONLINE\t0x01\n#define MFI_INFO_PDOPS_FORCE_OFFLINE\t0x02\n#define MFI_INFO_PDOPS_FORCE_REBUILD\t0x04\n\n\tuint32_t\t\tpd_mix_support;\n#define MFI_INFO_PDMIX_SAS\t\t0x01\n#define MFI_INFO_PDMIX_SATA\t\t0x02\n#define MFI_INFO_PDMIX_ENCL\t\t0x04\n#define MFI_INFO_PDMIX_LD\t\t0x08\n#define MFI_INFO_PDMIX_SATA_CLUSTER\t0x10\n\n\tuint8_t\t\t\tecc_bucket_count;\n\tuint8_t\t\t\treserved2[11];\n\tstruct mfi_ctrl_props\tproperties;\n\tchar\t\t\tpackage_version[0x60];\n\tuint8_t\t\t\tpad[0x800 - 0x6a0];\n} __packed;\n\n/* keep track of an event. */\nunion mfi_evt {\n\tstruct {\n\t\tuint16_t\tlocale;\n\t\tuint8_t\t\treserved;\n\t\tint8_t\t\tevt_class;\n\t} members;\n\tuint32_t\t\tword;\n} __packed;\n\n/* event log state. */\nstruct mfi_evt_log_state {\n\tuint32_t\t\tnewest_seq_num;\n\tuint32_t\t\toldest_seq_num;\n\tuint32_t\t\tclear_seq_num;\n\tuint32_t\t\tshutdown_seq_num;\n\tuint32_t\t\tboot_seq_num;\n} __packed;\n\nstruct mfi_progress {\n\tuint16_t\t\tprogress;\n\tuint16_t\t\telapsed_seconds;\n} __packed;\n\nstruct mfi_evt_ld {\n\tuint16_t\t\ttarget_id;\n\tuint8_t\t\t\tld_index;\n\tuint8_t\t\t\treserved;\n} __packed;\n\nstruct mfi_evt_pd {\n\tuint16_t\t\tdevice_id;\n\tuint8_t\t\t\tenclosure_index;\n\tuint8_t\t\t\tslot_number;\n} __packed;\n\n/* SAS (?) event detail, returned from MFI_DCMD_CTRL_EVENT_WAIT. */\nstruct mfi_evt_detail {\n\tuint32_t\t\tseq;\n\tuint32_t\t\ttime;\n\tuint32_t\t\tcode;\n\tunion mfi_evt\t\tevt_class;\n\tuint8_t\t\t\targ_type;\n\tuint8_t\t\t\treserved1[15];\n\n\tunion {\n\t\tstruct {\n\t\t\tstruct mfi_evt_pd\tpd;\n\t\t\tuint8_t\t\t\tcdb_len;\n\t\t\tuint8_t\t\t\tsense_len;\n\t\t\tuint8_t\t\t\treserved[2];\n\t\t\tuint8_t\t\t\tcdb[16];\n\t\t\tuint8_t\t\t\tsense[64];\n\t\t} cdb_sense;\n\n\t\tstruct mfi_evt_ld\t\tld;\n\n\t\tstruct {\n\t\t\tstruct mfi_evt_ld\tld;\n\t\t\tuint64_t\t\tcount;\n\t\t} ld_count;\n\n\t\tstruct {\n\t\t\tuint64_t\t\tlba;\n\t\t\tstruct mfi_evt_ld\tld;\n\t\t} ld_lba;\n\n\t\tstruct {\n\t\t\tstruct mfi_evt_ld\tld;\n\t\t\tuint32_t\t\tpre_owner;\n\t\t\tuint32_t\t\tnew_owner;\n\t\t} ld_owner;\n\n\t\tstruct {\n\t\t\tuint64_t\t\tld_lba;\n\t\t\tuint64_t\t\tpd_lba;\n\t\t\tstruct mfi_evt_ld\tld;\n\t\t\tstruct mfi_evt_pd\tpd;\n\t\t} ld_lba_pd_lba;\n\n\t\tstruct {\n\t\t\tstruct mfi_evt_ld\tld;\n\t\t\tstruct mfi_progress\tprog;\n\t\t} ld_prog;\n\n\t\tstruct {\n\t\t\tstruct mfi_evt_ld\tld;\n\t\t\tuint32_t\t\tprev_state;\n\t\t\tuint32_t\t\tnew_state;\n\t\t} ld_state;\n\n\t\tstruct {\n\t\t\tuint64_t\t\tstrip;\n\t\t\tstruct mfi_evt_ld\tld;\n\t\t} ld_strip;\n\n\t\tstruct mfi_evt_pd\t\tpd;\n\n\t\tstruct {\n\t\t\tstruct mfi_evt_pd\tpd;\n\t\t\tuint32_t\t\terr;\n\t\t} pd_err;\n\n\t\tstruct {\n\t\t\tuint64_t\t\tlba;\n\t\t\tstruct mfi_evt_pd\tpd;\n\t\t} pd_lba;\n\n\t\tstruct {\n\t\t\tuint64_t\t\tlba;\n\t\t\tstruct mfi_evt_pd\tpd;\n\t\t\tstruct mfi_evt_ld\tld;\n\t\t} pd_lba_ld;\n\n\t\tstruct {\n\t\t\tstruct mfi_evt_pd\tpd;\n\t\t\tstruct mfi_progress\tprog;\n\t\t} pd_prog;\n\n\t\tstruct {\n\t\t\tstruct mfi_evt_pd\tld;\n\t\t\tuint32_t\t\tprev_state;\n\t\t\tuint32_t\t\tnew_state;\n\t\t} pd_state;\n\n\t\tstruct {\n\t\t\tuint16_t\t\tvenderId;\n\t\t\tuint16_t\t\tdeviceId;\n\t\t\tuint16_t\t\tsubVenderId;\n\t\t\tuint16_t\t\tsubDeviceId;\n\t\t} pci;\n\n\t\tuint32_t\t\t\trate;\n\n\t\tchar\t\t\t\tstr[96];\n\n\t\tstruct {\n\t\t\tuint32_t\t\trtc;\n\t\t\tuint16_t\t\telapsedSeconds;\n\t\t} time;\n\n\t\tstruct {\n\t\t\tuint32_t\t\tecar;\n\t\t\tuint32_t\t\telog;\n\t\t\tchar\t\t\tstr[64];\n\t\t} ecc;\n\n\t\tuint8_t\t\tb[96];\n\t\tuint16_t\ts[48];\n\t\tuint32_t\tw[24];\n\t\tuint64_t\td[12];\n\t} args;\n\n\tchar description[128];\n} __packed;\n\nstruct mfi_evt_list {\n\tuint32_t\t\tcount;\n\tuint32_t\t\treserved;\n\tstruct mfi_evt_detail\tevent[1];\n} __packed;\n\nunion mfi_pd_ref {\n\tstruct {\n\t\tuint16_t\tdevice_id;\n\t\tuint16_t\tseq_num;\n\t} v;\n\tuint32_t\tref;\n} __packed;\n\nunion mfi_pd_ddf_type {\n\tstruct {\n\t\tunion {\n\t\t\tstruct {\n\t\t\t\tuint16_t\tforced_pd_guid\t: 1;\n\t\t\t\tuint16_t\tin_vd\t\t: 1;\n\t\t\t\tuint16_t\tis_global_spare\t: 1;\n\t\t\t\tuint16_t\tis_spare\t: 1;\n\t\t\t\tuint16_t\tis_foreign\t: 1;\n\t\t\t\tuint16_t\treserved\t: 7;\n\t\t\t\tuint16_t\tintf\t\t: 4;\n\t\t\t} pd_type;\n\t\t\tuint16_t\ttype;\n\t\t} v;\n\t\tuint16_t\t\treserved;\n\t} ddf;\n\tstruct {\n\t\tuint32_t\t\treserved;\n\t} non_disk;\n\tuint32_t\t\t\ttype;\n} __packed;\n\nstruct mfi_pd_progress {\n\tuint32_t\t\t\tactive;\n#define\tMFI_PD_PROGRESS_REBUILD\t(1<<0)\n#define\tMFI_PD_PROGRESS_PATROL\t(1<<1)\n#define\tMFI_PD_PROGRESS_CLEAR\t(1<<2)\n\tstruct mfi_progress\t\trbld;\n\tstruct mfi_progress\t\tpatrol;\n\tstruct mfi_progress\t\tclear;\n\tstruct mfi_progress\t\treserved[4];\n} __packed;\n\nstruct mfi_pd_info {\n\tunion mfi_pd_ref\t\tref;\n\tuint8_t\t\t\t\tinquiry_data[96];\n\tuint8_t\t\t\t\tvpd_page83[64];\n\tuint8_t\t\t\t\tnot_supported;\n\tuint8_t\t\t\t\tscsi_dev_type;\n\tuint8_t\t\t\t\tconnected_port_bitmap;\n\tuint8_t\t\t\t\tdevice_speed;\n\tuint32_t\t\t\tmedia_err_count;\n\tuint32_t\t\t\tother_err_count;\n\tuint32_t\t\t\tpred_fail_count;\n\tuint32_t\t\t\tlast_pred_fail_event_seq_num;\n\tuint16_t\t\t\tfw_state;\t/* MFI_PD_STATE_* */\n\tuint8_t\t\t\t\tdisabled_for_removal;\n\tuint8_t\t\t\t\tlink_speed;\n\tunion mfi_pd_ddf_type\t\tstate;\n\tstruct {\n\t\tuint8_t\t\t\tcount;\n\t\tuint8_t\t\t\tis_path_broken;\n\t\tuint8_t\t\t\treserved[6];\n\t\tuint64_t\t\tsas_addr[4];\n\t} path_info;\n\tuint64_t\t\t\traw_size;\n\tuint64_t\t\t\tnon_coerced_size;\n\tuint64_t\t\t\tcoerced_size;\n\tuint16_t\t\t\tencl_device_id;\n\tuint8_t\t\t\t\tencl_index;\n\tuint8_t\t\t\t\tslot_number;\n\tstruct mfi_pd_progress\t\tprog_info;\n\tuint8_t\t\t\t\tbad_block_table_full;\n\tuint8_t\t\t\t\tunusable_in_current_config;\n\tuint8_t\t\t\t\tvpd_page83_ext[64];\n\tuint8_t\t\t\t\treserved[512-358];\n} __packed;\n\nstruct mfi_pd_address {\n\tuint16_t\t\tdevice_id;\n\tuint16_t\t\tencl_device_id;\n\tuint8_t\t\t\tencl_index;\n\tuint8_t\t\t\tslot_number;\n\tuint8_t\t\t\tscsi_dev_type;\t/* 0 = disk */\n\tuint8_t\t\t\tconnect_port_bitmap;\n\tuint64_t\t\tsas_addr[2];\n} __packed;\n\nstruct mfi_pd_list {\n\tuint32_t\t\tsize;\n\tuint32_t\t\tcount;\n\tstruct mfi_pd_address\taddr[0];\n} __packed;\n\nenum mfi_pd_state {\n\tMFI_PD_STATE_UNCONFIGURED_GOOD = 0x00,\n\tMFI_PD_STATE_UNCONFIGURED_BAD = 0x01,\n\tMFI_PD_STATE_HOT_SPARE = 0x02,\n\tMFI_PD_STATE_OFFLINE = 0x10,\n\tMFI_PD_STATE_FAILED = 0x11,\n\tMFI_PD_STATE_REBUILD = 0x14,\n\tMFI_PD_STATE_ONLINE = 0x18,\n\tMFI_PD_STATE_COPYBACK = 0x20,\n\tMFI_PD_STATE_SYSTEM = 0x40\n};\n\nunion mfi_ld_ref {\n\tstruct {\n\t\tuint8_t\t\ttarget_id;\n\t\tuint8_t\t\treserved;\n\t\tuint16_t\tseq;\n\t} v;\n\tuint32_t\t\tref;\n} __packed;\n\nstruct mfi_ld_list {\n\tuint32_t\t\tld_count;\n\tuint32_t\t\treserved1;\n\tstruct {\n\t\tunion mfi_ld_ref\tld;\n\t\tuint8_t\t\tstate;\n\t\tuint8_t\t\treserved2[3];\n\t\tuint64_t\tsize;\n\t} ld_list[MFI_MAX_LD];\n} __packed;\n\nenum mfi_ld_access {\n\tMFI_LD_ACCESS_RW =\t0,\n\tMFI_LD_ACCSSS_RO = \t2,\n\tMFI_LD_ACCESS_BLOCKED =\t3,\n};\n#define MFI_LD_ACCESS_MASK\t3\n\nenum mfi_ld_state {\n\tMFI_LD_STATE_OFFLINE =\t\t\t0,\n\tMFI_LD_STATE_PARTIALLY_DEGRADED =\t1,\n\tMFI_LD_STATE_DEGRADED =\t\t\t2,\n\tMFI_LD_STATE_OPTIMAL =\t\t\t3\n};\n\nstruct mfi_ld_props {\n\tunion mfi_ld_ref\tld;\n\tchar\t\t\tname[16];\n\tuint8_t\t\t\tdefault_cache_policy;\n\tuint8_t\t\t\taccess_policy;\n\tuint8_t\t\t\tdisk_cache_policy;\n\tuint8_t\t\t\tcurrent_cache_policy;\n\tuint8_t\t\t\tno_bgi;\n\tuint8_t\t\t\treserved[7];\n} __packed;\n\nstruct mfi_ld_params {\n\tuint8_t\t\t\tprimary_raid_level;\n\tuint8_t\t\t\traid_level_qualifier;\n\tuint8_t\t\t\tsecondary_raid_level;\n\tuint8_t\t\t\tstripe_size;\n\tuint8_t\t\t\tnum_drives;\n\tuint8_t\t\t\tspan_depth;\n\tuint8_t\t\t\tstate;\n\tuint8_t\t\t\tinit_state;\n#define\tMFI_LD_PARAMS_INIT_NO\t\t0\n#define\tMFI_LD_PARAMS_INIT_QUICK\t1\n#define\tMFI_LD_PARAMS_INIT_FULL\t\t2\n\tuint8_t\t\t\tis_consistent;\n\tuint8_t\t\t\treserved[23];\n} __packed;\n\nstruct mfi_ld_progress {\n\tuint32_t\t\tactive;\n#define\tMFI_LD_PROGRESS_CC\t(1<<0)\n#define\tMFI_LD_PROGRESS_BGI\t(1<<1)\n#define\tMFI_LD_PROGRESS_FGI\t(1<<2)\n#define\tMFI_LD_PROGRESS_RECON\t(1<<3)\n\tstruct mfi_progress\tcc;\n\tstruct mfi_progress\tbgi;\n\tstruct mfi_progress\tfgi;\n\tstruct mfi_progress\trecon;\n\tstruct mfi_progress\treserved[4];\n} __packed;\n\nstruct mfi_span {\n\tuint64_t\t\tstart_block;\n\tuint64_t\t\tnum_blocks;\n\tuint16_t\t\tarray_ref;\n\tuint8_t\t\t\treserved[6];\n} __packed;\n\n#define\tMFI_MAX_SPAN_DEPTH\t8\nstruct mfi_ld_config {\n\tstruct mfi_ld_props\tproperties;\n\tstruct mfi_ld_params\tparams;\n\tstruct mfi_span\t\tspan[MFI_MAX_SPAN_DEPTH];\n} __packed;\n\nstruct mfi_ld_info {\n\tstruct mfi_ld_config\tld_config;\n\tuint64_t\t\tsize;\n\tstruct mfi_ld_progress\tprogress;\n\tuint16_t\t\tcluster_owner;\n\tuint8_t\t\t\treconstruct_active;\n\tuint8_t\t\t\treserved1[1];\n\tuint8_t\t\t\tvpd_page83[64];\n\tuint8_t\t\t\treserved2[16];\n} __packed;\n\n#define MAX_ARRAYS 16\nstruct mfi_spare {\n\tunion mfi_pd_ref\tref;\n\tuint8_t\t\t\tspare_type;\n#define\tMFI_SPARE_DEDICATED\t(1 << 0)\n#define\tMFI_SPARE_REVERTIBLE\t(1 << 1)\n#define\tMFI_SPARE_ENCL_AFFINITY\t(1 << 2)\n\tuint8_t\t\t\treserved[2];\n\tuint8_t\t\t\tarray_count;\n\tuint16_t\t\tarray_ref[MAX_ARRAYS];\n} __packed;\n\nstruct mfi_array {\n\tuint64_t\t\t\tsize;\n\tuint8_t\t\t\t\tnum_drives;\n\tuint8_t\t\t\t\treserved;\n\tuint16_t\t\t\tarray_ref;\n\tuint8_t\t\t\t\tpad[20];\n\tstruct {\n\t\tunion mfi_pd_ref\tref;\t/* 0xffff == missing drive */\n\t\tuint16_t\t\tfw_state;\t/* MFI_PD_STATE_* */\n\t\tstruct {\n\t\t\tuint8_t\t\tpd;\n\t\t\tuint8_t\t\tslot;\n\t\t} encl;\n\t} pd[0];\n} __packed;\n\nstruct mfi_config_data {\n\tuint32_t\t\tsize;\n\tuint16_t\t\tarray_count;\n\tuint16_t\t\tarray_size;\n\tuint16_t\t\tlog_drv_count;\n\tuint16_t\t\tlog_drv_size;\n\tuint16_t\t\tspares_count;\n\tuint16_t\t\tspares_size;\n\tuint8_t\t\t\treserved[16];\n\tstruct mfi_array\tarray[0];\n\tstruct mfi_ld_config\tld[0];\n\tstruct mfi_spare\tspare[0];\n} __packed;\n\nstruct mfi_bbu_capacity_info {\n\tuint16_t\t\trelative_charge;\n\tuint16_t\t\tabsolute_charge;\n\tuint16_t\t\tremaining_capacity;\n\tuint16_t\t\tfull_charge_capacity;\n\tuint16_t\t\trun_time_to_empty;\n\tuint16_t\t\taverage_time_to_empty;\n\tuint16_t\t\taverage_time_to_full;\n\tuint16_t\t\tcycle_count;\n\tuint16_t\t\tmax_error;\n\tuint16_t\t\tremaining_capacity_alarm;\n\tuint16_t\t\tremaining_time_alarm;\n\tuint8_t\t\t\treserved[26];\n} __packed;\n\nstruct mfi_bbu_design_info {\n\tuint32_t\t\tmfg_date;\n\tuint16_t\t\tdesign_capacity;\n\tuint16_t\t\tdesign_voltage;\n\tuint16_t\t\tspec_info;\n\tuint16_t\t\tserial_number;\n\tuint16_t\t\tpack_stat_config;\n\tuint8_t\t\t\tmfg_name[12];\n\tuint8_t\t\t\tdevice_name[8];\n\tuint8_t\t\t\tdevice_chemistry[8];\n\tuint8_t\t\t\tmfg_data[8];\n\tuint8_t\t\t\treserved[17];\n} __packed;\n\nstruct mfi_ibbu_state {\n\tuint16_t\t\tgas_guage_status;\n\tuint16_t\t\trelative_charge;\n\tuint16_t\t\tcharger_system_state;\n\tuint16_t\t\tcharger_system_ctrl;\n\tuint16_t\t\tcharging_current;\n\tuint16_t\t\tabsolute_charge;\n\tuint16_t\t\tmax_error;\n\tuint8_t\t\t\treserved[18];\n} __packed;\n\nstruct mfi_bbu_state {\n\tuint16_t\t\tgas_guage_status;\n\tuint16_t\t\trelative_charge;\n\tuint16_t\t\tcharger_status;\n\tuint16_t\t\tremaining_capacity;\n\tuint16_t\t\tfull_charge_capacity;\n\tuint8_t\t\t\tis_SOH_good;\n\tuint8_t\t\t\treserved[21];\n} __packed;\n\nunion mfi_bbu_status_detail {\n\tstruct mfi_ibbu_state\tibbu;\n\tstruct mfi_bbu_state\tbbu;\n};\n\nstruct mfi_bbu_status {\n\tuint8_t\t\t\tbattery_type;\n#define\tMFI_BBU_TYPE_NONE\t0\n#define\tMFI_BBU_TYPE_IBBU\t1\n#define\tMFI_BBU_TYPE_BBU\t2\t\n\tuint8_t\t\t\treserved;\n\tuint16_t\t\tvoltage;\n\tint16_t\t\t\tcurrent;\n\tuint16_t\t\ttemperature;\n\tuint32_t\t\tfw_status;\n#define\tMFI_BBU_STATE_PACK_MISSING\t(1 << 0)\n#define\tMFI_BBU_STATE_VOLTAGE_LOW\t(1 << 1)\n#define\tMFI_BBU_STATE_TEMPERATURE_HIGH\t(1 << 2)\n#define\tMFI_BBU_STATE_CHARGE_ACTIVE\t(1 << 0)\n#define\tMFI_BBU_STATE_DISCHARGE_ACTIVE\t(1 << 0)\n\tuint8_t\t\t\tpad[20];\n\tunion mfi_bbu_status_detail detail;\n} __packed;\n\nenum mfi_pr_state {\n\tMFI_PR_STATE_STOPPED = 0,\n\tMFI_PR_STATE_READY = 1,\n\tMFI_PR_STATE_ACTIVE = 2,\n\tMFI_PR_STATE_ABORTED = 0xff\n};\n\nstruct mfi_pr_status {\n\tuint32_t\t\tnum_iteration;\n\tuint8_t\t\t\tstate;\n\tuint8_t\t\t\tnum_pd_done;\n\tuint8_t\t\t\treserved[10];\n};\n\nenum mfi_pr_opmode {\n\tMFI_PR_OPMODE_AUTO = 0,\n\tMFI_PR_OPMODE_MANUAL = 1,\n\tMFI_PR_OPMODE_DISABLED = 2\n};\n\nstruct mfi_pr_properties {\n\tuint8_t\t\t\top_mode;\n\tuint8_t\t\t\tmax_pd;\n\tuint8_t\t\t\treserved;\n\tuint8_t\t\t\texclude_ld_count;\n\tuint16_t\t\texcluded_ld[MFI_MAX_LD];\n\tuint8_t\t\t\tcur_pd_map[MFI_MAX_PD / 8];\n\tuint8_t\t\t\tlast_pd_map[MFI_MAX_PD / 8];\n\tuint32_t\t\tnext_exec;\n\tuint32_t\t\texec_freq;\n\tuint32_t\t\tclear_freq;\n};\n\n#define MFI_SCSI_MAX_TARGETS\t128\n#define MFI_SCSI_MAX_LUNS\t8\n#define MFI_SCSI_INITIATOR_ID\t255\n#define MFI_SCSI_MAX_CMDS\t8\n#define MFI_SCSI_MAX_CDB_LEN\t16\n\n#endif /* _MFIREG_H */\n"
  },
  {
    "path": "freebsd-headers/dev/mfi/mfivar.h",
    "content": "/*-\n * Copyright (c) 2006 IronPort Systems\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n */\n/*-\n * Copyright (c) 2007 LSI Corp.\n * Copyright (c) 2007 Rajesh Prabhakaran.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n */\n\n#ifndef _MFIVAR_H\n#define _MFIVAR_H\n\n#include <sys/cdefs.h>\n__FBSDID(\"$FreeBSD: release/9.0.0/sys/dev/mfi/mfivar.h 227117 2011-11-05 18:27:47Z kib $\");\n\n#include <sys/lock.h>\n#include <sys/sx.h>\n\n/*\n * SCSI structures and definitions are used from here, but no linking\n * requirements are made to CAM.\n */\n#include <cam/scsi/scsi_all.h>\n\nstruct mfi_hwcomms {\n\tuint32_t\t\thw_pi;\n\tuint32_t\t\thw_ci;\n\tuint32_t\t\thw_reply_q[1];\n};\n\nstruct mfi_softc;\nstruct disk;\nstruct ccb_hdr;\n\nstruct mfi_command {\n\tTAILQ_ENTRY(mfi_command) cm_link;\n\ttime_t\t\t\tcm_timestamp;\n\tstruct mfi_softc\t*cm_sc;\n\tunion mfi_frame\t\t*cm_frame;\n\tuint32_t\t\tcm_frame_busaddr;\n\tstruct mfi_sense\t*cm_sense;\n\tuint32_t\t\tcm_sense_busaddr;\n\tbus_dmamap_t\t\tcm_dmamap;\n\tunion mfi_sgl\t\t*cm_sg;\n\tvoid\t\t\t*cm_data;\n\tint\t\t\tcm_len;\n\tint\t\t\tcm_stp_len;\n\tint\t\t\tcm_total_frame_size;\n\tint\t\t\tcm_extra_frames;\n\tint\t\t\tcm_flags;\n#define MFI_CMD_MAPPED\t\t(1<<0)\n#define MFI_CMD_DATAIN\t\t(1<<1)\n#define MFI_CMD_DATAOUT\t\t(1<<2)\n#define MFI_CMD_COMPLETED\t(1<<3)\n#define MFI_CMD_POLLED\t\t(1<<4)\n#define MFI_ON_MFIQ_FREE\t(1<<5)\n#define MFI_ON_MFIQ_READY\t(1<<6)\n#define MFI_ON_MFIQ_BUSY\t(1<<7)\n#define MFI_ON_MFIQ_MASK\t((1<<5)|(1<<6)|(1<<7))\n\tint\t\t\tcm_aen_abort;\n\tvoid\t\t\t(* cm_complete)(struct mfi_command *cm);\n\tvoid\t\t\t*cm_private;\n\tint\t\t\tcm_index;\n\tint\t\t\tcm_error;\n};\n\nstruct mfi_disk {\n\tTAILQ_ENTRY(mfi_disk)\tld_link;\n\tdevice_t\tld_dev;\n\tint\t\tld_id;\n\tint\t\tld_unit;\n\tstruct mfi_softc *ld_controller;\n\tstruct mfi_ld_info\t*ld_info;\n\tstruct disk\t*ld_disk;\n\tint\t\tld_flags;\n#define MFI_DISK_FLAGS_OPEN\t0x01\n#define\tMFI_DISK_FLAGS_DISABLED\t0x02\n};\n\nstruct mfi_aen {\n\tTAILQ_ENTRY(mfi_aen) aen_link;\n\tstruct proc\t\t\t*p;\n};\n\nstruct mfi_softc {\n\tdevice_t\t\t\tmfi_dev;\n\tint\t\t\t\tmfi_flags;\n#define MFI_FLAGS_SG64\t\t(1<<0)\n#define MFI_FLAGS_QFRZN\t\t(1<<1)\n#define MFI_FLAGS_OPEN\t\t(1<<2)\n#define MFI_FLAGS_STOP\t\t(1<<3)\n#define MFI_FLAGS_1064R\t\t(1<<4)\n#define MFI_FLAGS_1078\t\t(1<<5)\n#define MFI_FLAGS_GEN2\t\t(1<<6)\n\n\tstruct mfi_hwcomms\t\t*mfi_comms;\n\tTAILQ_HEAD(,mfi_command)\tmfi_free;\n\tTAILQ_HEAD(,mfi_command)\tmfi_ready;\n\tTAILQ_HEAD(,mfi_command)\tmfi_busy;\n\tstruct bio_queue_head\t\tmfi_bioq;\n\tstruct mfi_qstat\t\tmfi_qstat[MFIQ_COUNT];\n\n\tstruct resource\t\t\t*mfi_regs_resource;\n\tbus_space_handle_t\t\tmfi_bhandle;\n\tbus_space_tag_t\t\t\tmfi_btag;\n\tint\t\t\t\tmfi_regs_rid;\n\n\tbus_dma_tag_t\t\t\tmfi_parent_dmat;\n\tbus_dma_tag_t\t\t\tmfi_buffer_dmat;\n\n\tbus_dma_tag_t\t\t\tmfi_comms_dmat;\n\tbus_dmamap_t\t\t\tmfi_comms_dmamap;\n\tuint32_t\t\t\tmfi_comms_busaddr;\n\n\tbus_dma_tag_t\t\t\tmfi_frames_dmat;\n\tbus_dmamap_t\t\t\tmfi_frames_dmamap;\n\tuint32_t\t\t\tmfi_frames_busaddr;\n\tunion mfi_frame\t\t\t*mfi_frames;\n\n\tTAILQ_HEAD(,mfi_aen)\t\tmfi_aen_pids;\n\tstruct mfi_command\t\t*mfi_aen_cm;\n\tuint32_t\t\t\tmfi_aen_triggered;\n\tuint32_t\t\t\tmfi_poll_waiting;\n\tstruct selinfo\t\t\tmfi_select;\n\tint\t\t\t\tmfi_delete_busy_volumes;\n\tint\t\t\t\tmfi_keep_deleted_volumes;\n\tint\t\t\t\tmfi_detaching;\n\n\tbus_dma_tag_t\t\t\tmfi_sense_dmat;\n\tbus_dmamap_t\t\t\tmfi_sense_dmamap;\n\tuint32_t\t\t\tmfi_sense_busaddr;\n\tstruct mfi_sense\t\t*mfi_sense;\n\n\tstruct resource\t\t\t*mfi_irq;\n\tvoid\t\t\t\t*mfi_intr;\n\tint\t\t\t\tmfi_irq_rid;\n\n\tstruct intr_config_hook\t\tmfi_ich;\n\teventhandler_tag\t\teh;\n\n\t/*\n\t * Allocation for the command array.  Used as an indexable array to\n\t * recover completed commands.\n\t */\n\tstruct mfi_command\t\t*mfi_commands;\n\t/*\n\t * How many commands were actually allocated\n\t */\n\tint\t\t\t\tmfi_total_cmds;\n\t/*\n\t * How many commands the firmware can handle.  Also how big the reply\n\t * queue is, minus 1.\n\t */\n\tint\t\t\t\tmfi_max_fw_cmds;\n\t/*\n\t * How many S/G elements we'll ever actually use \n\t */\n\tint\t\t\t\tmfi_max_sge;\n\t/*\n\t * How many bytes a compound frame is, including all of the extra frames\n\t * that are used for S/G elements.\n\t */\n\tint\t\t\t\tmfi_cmd_size;\n\t/*\n\t * How large an S/G element is.  Used to calculate the number of single\n\t * frames in a command.\n\t */\n\tint\t\t\t\tmfi_sge_size;\n\t/*\n\t * Max number of sectors that the firmware allows\n\t */\n\tuint32_t\t\t\tmfi_max_io;\n\n\tTAILQ_HEAD(,mfi_disk)\t\tmfi_ld_tqh;\n\teventhandler_tag\t\tmfi_eh;\n\tstruct cdev\t\t\t*mfi_cdev;\n\n\tTAILQ_HEAD(, ccb_hdr)\t\tmfi_cam_ccbq;\n\tstruct mfi_command *\t\t(* mfi_cam_start)(void *);\n\tstruct callout\t\t\tmfi_watchdog_callout;\n\tstruct mtx\t\t\tmfi_io_lock;\n\tstruct sx\t\t\tmfi_config_lock;\n\n\t/* Controller type specific interfaces */\n\tvoid\t(*mfi_enable_intr)(struct mfi_softc *sc);\n\tint32_t\t(*mfi_read_fw_status)(struct mfi_softc *sc);\n\tint\t(*mfi_check_clear_intr)(struct mfi_softc *sc);\n \tvoid\t(*mfi_issue_cmd)(struct mfi_softc *sc,uint32_t bus_add,uint32_t frame_cnt);\n};\n\nextern int mfi_attach(struct mfi_softc *);\nextern void mfi_free(struct mfi_softc *);\nextern int mfi_shutdown(struct mfi_softc *);\nextern void mfi_startio(struct mfi_softc *);\nextern void mfi_disk_complete(struct bio *);\nextern int mfi_disk_disable(struct mfi_disk *);\nextern void mfi_disk_enable(struct mfi_disk *);\nextern int mfi_dump_blocks(struct mfi_softc *, int id, uint64_t, void *, int);\n\n#define MFIQ_ADD(sc, qname)\t\t\t\t\t\\\n\tdo {\t\t\t\t\t\t\t\\\n\t\tstruct mfi_qstat *qs;\t\t\t\t\\\n\t\t\t\t\t\t\t\t\\\n\t\tqs = &(sc)->mfi_qstat[qname];\t\t\t\\\n\t\tqs->q_length++;\t\t\t\t\t\\\n\t\tif (qs->q_length > qs->q_max)\t\t\t\\\n\t\t\tqs->q_max = qs->q_length;\t\t\\\n\t} while (0)\n\n#define MFIQ_REMOVE(sc, qname)\t(sc)->mfi_qstat[qname].q_length--\n\n#define MFIQ_INIT(sc, qname)\t\t\t\t\t\\\n\tdo {\t\t\t\t\t\t\t\\\n\t\tsc->mfi_qstat[qname].q_length = 0;\t\t\\\n\t\tsc->mfi_qstat[qname].q_max = 0;\t\t\t\\\n\t} while (0)\n\n#define MFIQ_COMMAND_QUEUE(name, index)\t\t\t\t\t\\\n\tstatic __inline void\t\t\t\t\t\t\\\n\tmfi_initq_ ## name (struct mfi_softc *sc)\t\t\t\\\n\t{\t\t\t\t\t\t\t\t\\\n\t\tTAILQ_INIT(&sc->mfi_ ## name);\t\t\t\t\\\n\t\tMFIQ_INIT(sc, index);\t\t\t\t\t\\\n\t}\t\t\t\t\t\t\t\t\\\n\tstatic __inline void\t\t\t\t\t\t\\\n\tmfi_enqueue_ ## name (struct mfi_command *cm)\t\t\t\\\n\t{\t\t\t\t\t\t\t\t\\\n\t\tif ((cm->cm_flags & MFI_ON_MFIQ_MASK) != 0) {\t\t\\\n\t\t\tprintf(\"command %p is on another queue, \"\t\\\n\t\t\t    \"flags = %#x\\n\", cm, cm->cm_flags);\t\t\\\n\t\t\tpanic(\"command is on another queue\");\t\t\\\n\t\t}\t\t\t\t\t\t\t\\\n\t\tTAILQ_INSERT_TAIL(&cm->cm_sc->mfi_ ## name, cm, cm_link); \\\n\t\tcm->cm_flags |= MFI_ON_ ## index;\t\t\t\\\n\t\tMFIQ_ADD(cm->cm_sc, index);\t\t\t\t\\\n\t}\t\t\t\t\t\t\t\t\\\n\tstatic __inline void\t\t\t\t\t\t\\\n\tmfi_requeue_ ## name (struct mfi_command *cm)\t\t\t\\\n\t{\t\t\t\t\t\t\t\t\\\n\t\tif ((cm->cm_flags & MFI_ON_MFIQ_MASK) != 0) {\t\t\\\n\t\t\tprintf(\"command %p is on another queue, \"\t\\\n\t\t\t    \"flags = %#x\\n\", cm, cm->cm_flags);\t\t\\\n\t\t\tpanic(\"command is on another queue\");\t\t\\\n\t\t}\t\t\t\t\t\t\t\\\n\t\tTAILQ_INSERT_HEAD(&cm->cm_sc->mfi_ ## name, cm, cm_link); \\\n\t\tcm->cm_flags |= MFI_ON_ ## index;\t\t\t\\\n\t\tMFIQ_ADD(cm->cm_sc, index);\t\t\t\t\\\n\t}\t\t\t\t\t\t\t\t\\\n\tstatic __inline struct mfi_command *\t\t\t\t\\\n\tmfi_dequeue_ ## name (struct mfi_softc *sc)\t\t\t\\\n\t{\t\t\t\t\t\t\t\t\\\n\t\tstruct mfi_command *cm;\t\t\t\t\t\\\n\t\t\t\t\t\t\t\t\t\\\n\t\tif ((cm = TAILQ_FIRST(&sc->mfi_ ## name)) != NULL) {\t\\\n\t\t\tif ((cm->cm_flags & MFI_ON_ ## index) == 0) {\t\\\n\t\t\t\tprintf(\"command %p not in queue, \"\t\\\n\t\t\t\t    \"flags = %#x, bit = %#x\\n\", cm,\t\\\n\t\t\t\t    cm->cm_flags, MFI_ON_ ## index);\t\\\n\t\t\t\tpanic(\"command not in queue\");\t\t\\\n\t\t\t}\t\t\t\t\t\t\\\n\t\t\tTAILQ_REMOVE(&sc->mfi_ ## name, cm, cm_link);\t\\\n\t\t\tcm->cm_flags &= ~MFI_ON_ ## index;\t\t\\\n\t\t\tMFIQ_REMOVE(sc, index);\t\t\t\t\\\n\t\t}\t\t\t\t\t\t\t\\\n\t\treturn (cm);\t\t\t\t\t\t\\\n\t}\t\t\t\t\t\t\t\t\\\n\tstatic __inline void\t\t\t\t\t\t\\\n\tmfi_remove_ ## name (struct mfi_command *cm)\t\t\t\\\n\t{\t\t\t\t\t\t\t\t\\\n\t\tif ((cm->cm_flags & MFI_ON_ ## index) == 0) {\t\t\\\n\t\t\tprintf(\"command %p not in queue, flags = %#x, \" \\\n\t\t\t    \"bit = %#x\\n\", cm, cm->cm_flags,\t\t\\\n\t\t\t    MFI_ON_ ## index);\t\t\t\t\\\n\t\t\tpanic(\"command not in queue\");\t\t\t\\\n\t\t}\t\t\t\t\t\t\t\\\n\t\tTAILQ_REMOVE(&cm->cm_sc->mfi_ ## name, cm, cm_link);\t\\\n\t\tcm->cm_flags &= ~MFI_ON_ ## index;\t\t\t\\\n\t\tMFIQ_REMOVE(cm->cm_sc, index);\t\t\t\t\\\n\t}\t\t\t\t\t\t\t\t\\\nstruct hack\n\nMFIQ_COMMAND_QUEUE(free, MFIQ_FREE);\nMFIQ_COMMAND_QUEUE(ready, MFIQ_READY);\nMFIQ_COMMAND_QUEUE(busy, MFIQ_BUSY);\n\nstatic __inline void\nmfi_initq_bio(struct mfi_softc *sc)\n{\n\tbioq_init(&sc->mfi_bioq);\n\tMFIQ_INIT(sc, MFIQ_BIO);\n}\n\nstatic __inline void\nmfi_enqueue_bio(struct mfi_softc *sc, struct bio *bp)\n{\n\tbioq_insert_tail(&sc->mfi_bioq, bp);\n\tMFIQ_ADD(sc, MFIQ_BIO);\n}\n\nstatic __inline struct bio *\nmfi_dequeue_bio(struct mfi_softc *sc)\n{\n\tstruct bio *bp;\n\n\tif ((bp = bioq_first(&sc->mfi_bioq)) != NULL) {\n\t\tbioq_remove(&sc->mfi_bioq, bp);\n\t\tMFIQ_REMOVE(sc, MFIQ_BIO);\n\t}\n\treturn (bp);\n}\n\n/*\n * This is from the original scsi_extract_sense() in CAM.  It's copied\n * here because CAM now uses a non-inline version that follows more complex\n * additions to the SPC spec, and we don't want to force a dependency on\n * the CAM module for such a trivial action.\n */\nstatic __inline void\nmfi_extract_sense(struct scsi_sense_data_fixed *sense,\n    int *error_code, int *sense_key, int *asc, int *ascq)\n{\n\n\t*error_code = sense->error_code & SSD_ERRCODE;\n\t*sense_key = sense->flags & SSD_KEY;\n\t*asc = (sense->extra_len >= 5) ? sense->add_sense_code : 0;\n\t*ascq = (sense->extra_len >= 6) ? sense->add_sense_code_qual : 0;\n}\n\nstatic __inline void\nmfi_print_sense(struct mfi_softc *sc, void *sense)\n{\n\tint error, key, asc, ascq;\n\n\tmfi_extract_sense((struct scsi_sense_data_fixed *)sense,\n\t    &error, &key, &asc, &ascq);\n\tdevice_printf(sc->mfi_dev, \"sense error %d, sense_key %d, \"\n\t    \"asc %d, ascq %d\\n\", error, key, asc, ascq);\n}\n\n\n#define MFI_WRITE4(sc, reg, val)\tbus_space_write_4((sc)->mfi_btag, \\\n\tsc->mfi_bhandle, (reg), (val))\n#define MFI_READ4(sc, reg)\t\tbus_space_read_4((sc)->mfi_btag, \\\n\t(sc)->mfi_bhandle, (reg))\n#define MFI_WRITE2(sc, reg, val)\tbus_space_write_2((sc)->mfi_btag, \\\n\tsc->mfi_bhandle, (reg), (val))\n#define MFI_READ2(sc, reg)\t\tbus_space_read_2((sc)->mfi_btag, \\\n\t(sc)->mfi_bhandle, (reg))\n#define MFI_WRITE1(sc, reg, val)\tbus_space_write_1((sc)->mfi_btag, \\\n\tsc->mfi_bhandle, (reg), (val))\n#define MFI_READ1(sc, reg)\t\tbus_space_read_1((sc)->mfi_btag, \\\n\t(sc)->mfi_bhandle, (reg))\n\nMALLOC_DECLARE(M_MFIBUF);\n\n#define MFI_CMD_TIMEOUT 30\n#define MFI_MAXPHYS (128 * 1024)\n\n#ifdef MFI_DEBUG\nextern void mfi_print_cmd(struct mfi_command *cm);\nextern void mfi_dump_cmds(struct mfi_softc *sc);\nextern void mfi_validate_sg(struct mfi_softc *, struct mfi_command *, const char *, int );\n#define MFI_PRINT_CMD(cm)\tmfi_print_cmd(cm)\n#define MFI_DUMP_CMDS(sc)\tmfi_dump_cmds(sc)\n#define MFI_VALIDATE_CMD(sc, cm) mfi_validate_sg(sc, cm, __FUNCTION__, __LINE__)\n#else\n#define MFI_PRINT_CMD(cm)\n#define MFI_DUMP_CMDS(sc)\n#define MFI_VALIDATE_CMD(sc, cm)\n#endif\n\nextern void mfi_release_command(struct mfi_command *cm);\n\n#endif /* _MFIVAR_H */\n"
  },
  {
    "path": "freebsd-headers/dev/mpt/mpilib/mpi.h",
    "content": "/* $FreeBSD: release/9.0.0/sys/dev/mpt/mpilib/mpi.h 170251 2007-06-03 22:58:27Z scottl $ */\n/*-\n * Copyright (c) 2000-2005, LSI Logic Corporation and its contributors.\n * All rights reserved.\n * \n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions are\n * met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce at minimum a disclaimer\n *    substantially similar to the \"NO WARRANTY\" disclaimer below\n *    (\"Disclaimer\") and any redistribution must be conditioned upon including\n *    a substantially similar Disclaimer requirement for further binary\n *    redistribution.\n * 3. Neither the name of the LSI Logic Corporation nor the names of its\n *    contributors may be used to endorse or promote products derived from\n *    this software without specific prior written permission.\n * \n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\n * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE\n * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\n * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\n * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\n * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\n * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF THE COPYRIGHT\n * OWNER OR CONTRIBUTOR IS ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n *\n *           Name:  mpi.h\n *          Title:  MPI Message independent structures and definitions\n *  Creation Date:  July 27, 2000\n *\n *    mpi.h Version:  01.05.13\n *\n *  Version History\n *  ---------------\n *\n *  Date      Version   Description\n *  --------  --------  ------------------------------------------------------\n *  05-08-00  00.10.01  Original release for 0.10 spec dated 4/26/2000.\n *  05-24-00  00.10.02  Added MPI_IOCSTATUS_SCSI_RESIDUAL_MISMATCH definition.\n *  06-06-00  01.00.01  Update MPI_VERSION_MAJOR and MPI_VERSION_MINOR.\n *  06-22-00  01.00.02  Added MPI_IOCSTATUS_LAN_ definitions.\n *                      Removed LAN_SUSPEND function definition.\n *                      Added MPI_MSGFLAGS_CONTINUATION_REPLY definition.\n *  06-30-00  01.00.03  Added MPI_CONTEXT_REPLY_TYPE_LAN definition.\n *                      Added MPI_GET/SET_CONTEXT_REPLY_TYPE macros.\n *  07-27-00  01.00.04  Added MPI_FAULT_ definitions.\n *                      Removed MPI_IOCSTATUS_MSG/DATA_XFER_ERROR definitions.\n *                      Added MPI_IOCSTATUS_INTERNAL_ERROR definition.\n *                      Added MPI_IOCSTATUS_TARGET_XFER_COUNT_MISMATCH.\n *  11-02-00  01.01.01  Original release for post 1.0 work.\n *  12-04-00  01.01.02  Added new function codes.\n *  01-09-01  01.01.03  Added more definitions to the system interface section\n *                      Added MPI_IOCSTATUS_TARGET_STS_DATA_NOT_SENT.\n *  01-25-01  01.01.04  Changed MPI_VERSION_MINOR from 0x00 to 0x01.\n *  02-20-01  01.01.05  Started using MPI_POINTER.\n *                      Fixed value for MPI_DIAG_RW_ENABLE.\n *                      Added defines for MPI_DIAG_PREVENT_IOC_BOOT and\n *                      MPI_DIAG_CLEAR_FLASH_BAD_SIG.\n *                      Obsoleted MPI_IOCSTATUS_TARGET_FC_ defines.\n *  02-27-01  01.01.06  Removed MPI_HOST_INDEX_REGISTER define.\n *                      Added function codes for RAID.\n *  04-09-01  01.01.07  Added alternate define for MPI_DOORBELL_ACTIVE,\n *                      MPI_DOORBELL_USED, to better match the spec.\n *  08-08-01  01.02.01  Original release for v1.2 work.\n *                      Changed MPI_VERSION_MINOR from 0x01 to 0x02.\n *                      Added define MPI_FUNCTION_TOOLBOX.\n *  09-28-01  01.02.02  New function code MPI_SCSI_ENCLOSURE_PROCESSOR.\n *  11-01-01  01.02.03  Changed name to MPI_FUNCTION_SCSI_ENCLOSURE_PROCESSOR.\n *  03-14-02  01.02.04  Added MPI_HEADER_VERSION_ defines.\n *  05-31-02  01.02.05  Bumped MPI_HEADER_VERSION_UNIT.\n *  07-12-02  01.02.06  Added define for MPI_FUNCTION_MAILBOX.\n *  09-16-02  01.02.07  Bumped value for MPI_HEADER_VERSION_UNIT.\n *  11-15-02  01.02.08  Added define MPI_IOCSTATUS_TARGET_INVALID_IO_INDEX and\n *                      obsoleted define MPI_IOCSTATUS_TARGET_INVALID_IOCINDEX.\n *  04-01-03  01.02.09  New IOCStatus code: MPI_IOCSTATUS_FC_EXCHANGE_CANCELED\n *  06-26-03  01.02.10  Bumped MPI_HEADER_VERSION_UNIT value.\n *  01-16-04  01.02.11  Added define for MPI_IOCLOGINFO_TYPE_SHIFT.\n *  04-29-04  01.02.12  Added function codes for MPI_FUNCTION_DIAG_BUFFER_POST\n *                      and MPI_FUNCTION_DIAG_RELEASE.\n *                      Added MPI_IOCSTATUS_DIAGNOSTIC_RELEASED define.\n *                      Bumped MPI_HEADER_VERSION_UNIT value.\n *  05-11-04  01.03.01  Bumped MPI_VERSION_MINOR for MPI v1.3.\n *                      Added codes for Inband.\n *  08-19-04  01.05.01  Added defines for Host Buffer Access Control doorbell.\n *                      Added define for offset of High Priority Request Queue.\n *                      Added new function codes and new IOCStatus codes.\n *                      Added a IOCLogInfo type of SAS.\n *  12-07-04  01.05.02  Bumped MPI_HEADER_VERSION_UNIT.\n *  12-09-04  01.05.03  Bumped MPI_HEADER_VERSION_UNIT.\n *  01-15-05  01.05.04  Bumped MPI_HEADER_VERSION_UNIT.\n *  02-09-05  01.05.05  Bumped MPI_HEADER_VERSION_UNIT.\n *  02-22-05  01.05.06  Bumped MPI_HEADER_VERSION_UNIT.\n *  03-11-05  01.05.07  Removed function codes for SCSI IO 32 and\n *                      TargetAssistExtended requests.\n *                      Removed EEDP IOCStatus codes.\n *  06-24-05  01.05.08  Added function codes for SCSI IO 32 and\n *                      TargetAssistExtended requests.\n *                      Added EEDP IOCStatus codes.\n *  08-03-05  01.05.09  Bumped MPI_HEADER_VERSION_UNIT.\n *  08-30-05  01.05.10  Added 2 new IOCStatus codes for Target.\n *  03-27-06  01.05.11  Bumped MPI_HEADER_VERSION_UNIT.\n *  10-11-06  01.05.12  Bumped MPI_HEADER_VERSION_UNIT.\n *  05-24-07  01.05.13  Bumped MPI_HEADER_VERSION_UNIT.\n *  --------------------------------------------------------------------------\n */\n\n#ifndef MPI_H\n#define MPI_H\n\n\n/*****************************************************************************\n*\n*        M P I    V e r s i o n    D e f i n i t i o n s\n*\n*****************************************************************************/\n\n#define MPI_VERSION_MAJOR                   (0x01)\n#define MPI_VERSION_MINOR                   (0x05)\n#define MPI_VERSION_MAJOR_MASK              (0xFF00)\n#define MPI_VERSION_MAJOR_SHIFT             (8)\n#define MPI_VERSION_MINOR_MASK              (0x00FF)\n#define MPI_VERSION_MINOR_SHIFT             (0)\n#define MPI_VERSION ((MPI_VERSION_MAJOR << MPI_VERSION_MAJOR_SHIFT) |   \\\n                                      MPI_VERSION_MINOR)\n\n#define MPI_VERSION_01_00                   (0x0100)\n#define MPI_VERSION_01_01                   (0x0101)\n#define MPI_VERSION_01_02                   (0x0102)\n#define MPI_VERSION_01_03                   (0x0103)\n#define MPI_VERSION_01_05                   (0x0105)\n/* Note: The major versions of 0xe0 through 0xff are reserved */\n\n/* versioning for this MPI header set */\n#define MPI_HEADER_VERSION_UNIT             (0x10)\n#define MPI_HEADER_VERSION_DEV              (0x00)\n#define MPI_HEADER_VERSION_UNIT_MASK        (0xFF00)\n#define MPI_HEADER_VERSION_UNIT_SHIFT       (8)\n#define MPI_HEADER_VERSION_DEV_MASK         (0x00FF)\n#define MPI_HEADER_VERSION_DEV_SHIFT        (0)\n#define MPI_HEADER_VERSION ((MPI_HEADER_VERSION_UNIT << 8) | MPI_HEADER_VERSION_DEV)\n\n/*****************************************************************************\n*\n*        I O C    S t a t e    D e f i n i t i o n s\n*\n*****************************************************************************/\n\n#define MPI_IOC_STATE_RESET                 (0x00000000)\n#define MPI_IOC_STATE_READY                 (0x10000000)\n#define MPI_IOC_STATE_OPERATIONAL           (0x20000000)\n#define MPI_IOC_STATE_FAULT                 (0x40000000)\n\n#define MPI_IOC_STATE_MASK                  (0xF0000000)\n#define MPI_IOC_STATE_SHIFT                 (28)\n\n/* Fault state codes (product independent range 0x8000-0xFFFF) */\n\n#define MPI_FAULT_REQUEST_MESSAGE_PCI_PARITY_ERROR  (0x8111)\n#define MPI_FAULT_REQUEST_MESSAGE_PCI_BUS_FAULT     (0x8112)\n#define MPI_FAULT_REPLY_MESSAGE_PCI_PARITY_ERROR    (0x8113)\n#define MPI_FAULT_REPLY_MESSAGE_PCI_BUS_FAULT       (0x8114)\n#define MPI_FAULT_DATA_SEND_PCI_PARITY_ERROR        (0x8115)\n#define MPI_FAULT_DATA_SEND_PCI_BUS_FAULT           (0x8116)\n#define MPI_FAULT_DATA_RECEIVE_PCI_PARITY_ERROR     (0x8117)\n#define MPI_FAULT_DATA_RECEIVE_PCI_BUS_FAULT        (0x8118)\n\n\n/*****************************************************************************\n*\n*        P C I    S y s t e m    I n t e r f a c e    R e g i s t e r s\n*\n*****************************************************************************/\n\n/*\n * Defines for working with the System Doorbell register.\n * Values for doorbell function codes are included in the section that defines\n * all the function codes (further on in this file).\n */\n#define MPI_DOORBELL_OFFSET                 (0x00000000)\n#define MPI_DOORBELL_ACTIVE                 (0x08000000) /* DoorbellUsed */\n#define MPI_DOORBELL_USED                   (MPI_DOORBELL_ACTIVE)\n#define MPI_DOORBELL_ACTIVE_SHIFT           (27)\n#define MPI_DOORBELL_WHO_INIT_MASK          (0x07000000)\n#define MPI_DOORBELL_WHO_INIT_SHIFT         (24)\n#define MPI_DOORBELL_FUNCTION_MASK          (0xFF000000)\n#define MPI_DOORBELL_FUNCTION_SHIFT         (24)\n#define MPI_DOORBELL_ADD_DWORDS_MASK        (0x00FF0000)\n#define MPI_DOORBELL_ADD_DWORDS_SHIFT       (16)\n#define MPI_DOORBELL_DATA_MASK              (0x0000FFFF)\n#define MPI_DOORBELL_FUNCTION_SPECIFIC_MASK (0x0000FFFF)\n\n/* values for Host Buffer Access Control doorbell function */\n#define MPI_DB_HPBAC_VALUE_MASK             (0x0000F000)\n#define MPI_DB_HPBAC_ENABLE_ACCESS          (0x01)\n#define MPI_DB_HPBAC_DISABLE_ACCESS         (0x02)\n#define MPI_DB_HPBAC_FREE_BUFFER            (0x03)\n\n\n#define MPI_WRITE_SEQUENCE_OFFSET           (0x00000004)\n#define MPI_WRSEQ_KEY_VALUE_MASK            (0x0000000F)\n#define MPI_WRSEQ_1ST_KEY_VALUE             (0x04)\n#define MPI_WRSEQ_2ND_KEY_VALUE             (0x0B)\n#define MPI_WRSEQ_3RD_KEY_VALUE             (0x02)\n#define MPI_WRSEQ_4TH_KEY_VALUE             (0x07)\n#define MPI_WRSEQ_5TH_KEY_VALUE             (0x0D)\n\n#define MPI_DIAGNOSTIC_OFFSET               (0x00000008)\n#define MPI_DIAG_CLEAR_FLASH_BAD_SIG        (0x00000400)\n#define MPI_DIAG_PREVENT_IOC_BOOT           (0x00000200)\n#define MPI_DIAG_DRWE                       (0x00000080)\n#define MPI_DIAG_FLASH_BAD_SIG              (0x00000040)\n#define MPI_DIAG_RESET_HISTORY              (0x00000020)\n#define MPI_DIAG_RW_ENABLE                  (0x00000010)\n#define MPI_DIAG_RESET_ADAPTER              (0x00000004)\n#define MPI_DIAG_DISABLE_ARM                (0x00000002)\n#define MPI_DIAG_MEM_ENABLE                 (0x00000001)\n\n#define MPI_TEST_BASE_ADDRESS_OFFSET        (0x0000000C)\n\n#define MPI_DIAG_RW_DATA_OFFSET             (0x00000010)\n\n#define MPI_DIAG_RW_ADDRESS_OFFSET          (0x00000014)\n\n#define MPI_HOST_INTERRUPT_STATUS_OFFSET    (0x00000030)\n#define MPI_HIS_IOP_DOORBELL_STATUS         (0x80000000)\n#define MPI_HIS_REPLY_MESSAGE_INTERRUPT     (0x00000008)\n#define MPI_HIS_DOORBELL_INTERRUPT          (0x00000001)\n\n#define MPI_HOST_INTERRUPT_MASK_OFFSET      (0x00000034)\n#define MPI_HIM_RIM                         (0x00000008)\n#define MPI_HIM_DIM                         (0x00000001)\n\n#define MPI_REQUEST_QUEUE_OFFSET            (0x00000040)\n#define MPI_REQUEST_POST_FIFO_OFFSET        (0x00000040)\n\n#define MPI_REPLY_QUEUE_OFFSET              (0x00000044)\n#define MPI_REPLY_POST_FIFO_OFFSET          (0x00000044)\n#define MPI_REPLY_FREE_FIFO_OFFSET          (0x00000044)\n\n#define MPI_HI_PRI_REQUEST_QUEUE_OFFSET     (0x00000048)\n\n\n\n/*****************************************************************************\n*\n*        M e s s a g e    F r a m e    D e s c r i p t o r s\n*\n*****************************************************************************/\n\n#define MPI_REQ_MF_DESCRIPTOR_NB_MASK       (0x00000003)\n#define MPI_REQ_MF_DESCRIPTOR_F_BIT         (0x00000004)\n#define MPI_REQ_MF_DESCRIPTOR_ADDRESS_MASK  (0xFFFFFFF8)\n\n#define MPI_ADDRESS_REPLY_A_BIT             (0x80000000)\n#define MPI_ADDRESS_REPLY_ADDRESS_MASK      (0x7FFFFFFF)\n\n#define MPI_CONTEXT_REPLY_A_BIT             (0x80000000)\n#define MPI_CONTEXT_REPLY_TYPE_MASK         (0x60000000)\n#define MPI_CONTEXT_REPLY_TYPE_SCSI_INIT    (0x00)\n#define MPI_CONTEXT_REPLY_TYPE_SCSI_TARGET  (0x01)\n#define MPI_CONTEXT_REPLY_TYPE_LAN          (0x02)\n#define MPI_CONTEXT_REPLY_TYPE_SHIFT        (29)\n#define MPI_CONTEXT_REPLY_CONTEXT_MASK      (0x1FFFFFFF)\n\n\n/****************************************************************************/\n/* Context Reply macros                                                     */\n/****************************************************************************/\n\n#define MPI_GET_CONTEXT_REPLY_TYPE(x)  (((x) & MPI_CONTEXT_REPLY_TYPE_MASK) \\\n                                          >> MPI_CONTEXT_REPLY_TYPE_SHIFT)\n\n#define MPI_SET_CONTEXT_REPLY_TYPE(x, typ)                                  \\\n            ((x) = ((x) & ~MPI_CONTEXT_REPLY_TYPE_MASK) |                   \\\n                            (((typ) << MPI_CONTEXT_REPLY_TYPE_SHIFT) &      \\\n                                        MPI_CONTEXT_REPLY_TYPE_MASK))\n\n\n/*****************************************************************************\n*\n*        M e s s a g e    F u n c t i o n s\n*              0x80 -> 0x8F reserved for private message use per product\n*\n*\n*****************************************************************************/\n\n#define MPI_FUNCTION_SCSI_IO_REQUEST                (0x00)\n#define MPI_FUNCTION_SCSI_TASK_MGMT                 (0x01)\n#define MPI_FUNCTION_IOC_INIT                       (0x02)\n#define MPI_FUNCTION_IOC_FACTS                      (0x03)\n#define MPI_FUNCTION_CONFIG                         (0x04)\n#define MPI_FUNCTION_PORT_FACTS                     (0x05)\n#define MPI_FUNCTION_PORT_ENABLE                    (0x06)\n#define MPI_FUNCTION_EVENT_NOTIFICATION             (0x07)\n#define MPI_FUNCTION_EVENT_ACK                      (0x08)\n#define MPI_FUNCTION_FW_DOWNLOAD                    (0x09)\n#define MPI_FUNCTION_TARGET_CMD_BUFFER_POST         (0x0A)\n#define MPI_FUNCTION_TARGET_ASSIST                  (0x0B)\n#define MPI_FUNCTION_TARGET_STATUS_SEND             (0x0C)\n#define MPI_FUNCTION_TARGET_MODE_ABORT              (0x0D)\n#define MPI_FUNCTION_FC_LINK_SRVC_BUF_POST          (0x0E)\n#define MPI_FUNCTION_FC_LINK_SRVC_RSP               (0x0F)\n#define MPI_FUNCTION_FC_EX_LINK_SRVC_SEND           (0x10)\n#define MPI_FUNCTION_FC_ABORT                       (0x11)\n#define MPI_FUNCTION_FW_UPLOAD                      (0x12)\n#define MPI_FUNCTION_FC_COMMON_TRANSPORT_SEND       (0x13)\n#define MPI_FUNCTION_FC_PRIMITIVE_SEND              (0x14)\n\n#define MPI_FUNCTION_RAID_ACTION                    (0x15)\n#define MPI_FUNCTION_RAID_SCSI_IO_PASSTHROUGH       (0x16)\n\n#define MPI_FUNCTION_TOOLBOX                        (0x17)\n\n#define MPI_FUNCTION_SCSI_ENCLOSURE_PROCESSOR       (0x18)\n\n#define MPI_FUNCTION_MAILBOX                        (0x19)\n\n#define MPI_FUNCTION_SMP_PASSTHROUGH                (0x1A)\n#define MPI_FUNCTION_SAS_IO_UNIT_CONTROL            (0x1B)\n#define MPI_FUNCTION_SATA_PASSTHROUGH               (0x1C)\n\n#define MPI_FUNCTION_DIAG_BUFFER_POST               (0x1D)\n#define MPI_FUNCTION_DIAG_RELEASE                   (0x1E)\n\n#define MPI_FUNCTION_SCSI_IO_32                     (0x1F)\n\n#define MPI_FUNCTION_LAN_SEND                       (0x20)\n#define MPI_FUNCTION_LAN_RECEIVE                    (0x21)\n#define MPI_FUNCTION_LAN_RESET                      (0x22)\n\n#define MPI_FUNCTION_TARGET_ASSIST_EXTENDED         (0x23)\n#define MPI_FUNCTION_TARGET_CMD_BUF_BASE_POST       (0x24)\n#define MPI_FUNCTION_TARGET_CMD_BUF_LIST_POST       (0x25)\n\n#define MPI_FUNCTION_INBAND_BUFFER_POST             (0x28)\n#define MPI_FUNCTION_INBAND_SEND                    (0x29)\n#define MPI_FUNCTION_INBAND_RSP                     (0x2A)\n#define MPI_FUNCTION_INBAND_ABORT                   (0x2B)\n\n#define MPI_FUNCTION_IOC_MESSAGE_UNIT_RESET         (0x40)\n#define MPI_FUNCTION_IO_UNIT_RESET                  (0x41)\n#define MPI_FUNCTION_HANDSHAKE                      (0x42)\n#define MPI_FUNCTION_REPLY_FRAME_REMOVAL            (0x43)\n#define MPI_FUNCTION_HOST_PAGEBUF_ACCESS_CONTROL    (0x44)\n\n\n/* standard version format */\ntypedef struct _MPI_VERSION_STRUCT\n{\n    U8                      Dev;                        /* 00h */\n    U8                      Unit;                       /* 01h */\n    U8                      Minor;                      /* 02h */\n    U8                      Major;                      /* 03h */\n} MPI_VERSION_STRUCT, MPI_POINTER PTR_MPI_VERSION_STRUCT,\n  MpiVersionStruct_t, MPI_POINTER pMpiVersionStruct;\n\ntypedef union _MPI_VERSION_FORMAT\n{\n    MPI_VERSION_STRUCT      Struct;\n    U32                     Word;\n} MPI_VERSION_FORMAT, MPI_POINTER PTR_MPI_VERSION_FORMAT,\n  MpiVersionFormat_t, MPI_POINTER pMpiVersionFormat_t;\n\n\n/*****************************************************************************\n*\n*        S c a t t e r    G a t h e r    E l e m e n t s\n*\n*****************************************************************************/\n\n/****************************************************************************/\n/*  Simple element structures                                               */\n/****************************************************************************/\n\ntypedef struct _SGE_SIMPLE32\n{\n    U32                     FlagsLength;\n    U32                     Address;\n} SGE_SIMPLE32, MPI_POINTER PTR_SGE_SIMPLE32,\n  SGESimple32_t, MPI_POINTER pSGESimple32_t;\n\ntypedef struct _SGE_SIMPLE64\n{\n    U32                     FlagsLength;\n    U64                     Address;\n} SGE_SIMPLE64, MPI_POINTER PTR_SGE_SIMPLE64,\n  SGESimple64_t, MPI_POINTER pSGESimple64_t;\n\ntypedef struct _SGE_SIMPLE_UNION\n{\n    U32                     FlagsLength;\n    union\n    {\n        U32                 Address32;\n        U64                 Address64;\n    }u;\n} SGE_SIMPLE_UNION, MPI_POINTER PTR_SGE_SIMPLE_UNION,\n  SGESimpleUnion_t, MPI_POINTER pSGESimpleUnion_t;\n\n/****************************************************************************/\n/*  Chain element structures                                                */\n/****************************************************************************/\n\ntypedef struct _SGE_CHAIN32\n{\n    U16                     Length;\n    U8                      NextChainOffset;\n    U8                      Flags;\n    U32                     Address;\n} SGE_CHAIN32, MPI_POINTER PTR_SGE_CHAIN32,\n  SGEChain32_t, MPI_POINTER pSGEChain32_t;\n\ntypedef struct _SGE_CHAIN64\n{\n    U16                     Length;\n    U8                      NextChainOffset;\n    U8                      Flags;\n    U64                     Address;\n} SGE_CHAIN64, MPI_POINTER PTR_SGE_CHAIN64,\n  SGEChain64_t, MPI_POINTER pSGEChain64_t;\n\ntypedef struct _SGE_CHAIN_UNION\n{\n    U16                     Length;\n    U8                      NextChainOffset;\n    U8                      Flags;\n    union\n    {\n        U32                 Address32;\n        U64                 Address64;\n    }u;\n} SGE_CHAIN_UNION, MPI_POINTER PTR_SGE_CHAIN_UNION,\n  SGEChainUnion_t, MPI_POINTER pSGEChainUnion_t;\n\n/****************************************************************************/\n/*  Transaction Context element                                             */\n/****************************************************************************/\n\ntypedef struct _SGE_TRANSACTION32\n{\n    U8                      Reserved;\n    U8                      ContextSize;\n    U8                      DetailsLength;\n    U8                      Flags;\n    U32                     TransactionContext[1];\n    U32                     TransactionDetails[1];\n} SGE_TRANSACTION32, MPI_POINTER PTR_SGE_TRANSACTION32,\n  SGETransaction32_t, MPI_POINTER pSGETransaction32_t;\n\ntypedef struct _SGE_TRANSACTION64\n{\n    U8                      Reserved;\n    U8                      ContextSize;\n    U8                      DetailsLength;\n    U8                      Flags;\n    U32                     TransactionContext[2];\n    U32                     TransactionDetails[1];\n} SGE_TRANSACTION64, MPI_POINTER PTR_SGE_TRANSACTION64,\n  SGETransaction64_t, MPI_POINTER pSGETransaction64_t;\n\ntypedef struct _SGE_TRANSACTION96\n{\n    U8                      Reserved;\n    U8                      ContextSize;\n    U8                      DetailsLength;\n    U8                      Flags;\n    U32                     TransactionContext[3];\n    U32                     TransactionDetails[1];\n} SGE_TRANSACTION96, MPI_POINTER PTR_SGE_TRANSACTION96,\n  SGETransaction96_t, MPI_POINTER pSGETransaction96_t;\n\ntypedef struct _SGE_TRANSACTION128\n{\n    U8                      Reserved;\n    U8                      ContextSize;\n    U8                      DetailsLength;\n    U8                      Flags;\n    U32                     TransactionContext[4];\n    U32                     TransactionDetails[1];\n} SGE_TRANSACTION128, MPI_POINTER PTR_SGE_TRANSACTION128,\n  SGETransaction_t128, MPI_POINTER pSGETransaction_t128;\n\ntypedef struct _SGE_TRANSACTION_UNION\n{\n    U8                      Reserved;\n    U8                      ContextSize;\n    U8                      DetailsLength;\n    U8                      Flags;\n    union\n    {\n        U32                 TransactionContext32[1];\n        U32                 TransactionContext64[2];\n        U32                 TransactionContext96[3];\n        U32                 TransactionContext128[4];\n    }u;\n    U32                     TransactionDetails[1];\n} SGE_TRANSACTION_UNION, MPI_POINTER PTR_SGE_TRANSACTION_UNION,\n  SGETransactionUnion_t, MPI_POINTER pSGETransactionUnion_t;\n\n\n/****************************************************************************/\n/*  SGE IO types union  for IO SGL's                                        */\n/****************************************************************************/\n\ntypedef struct _SGE_IO_UNION\n{\n    union\n    {\n        SGE_SIMPLE_UNION    Simple;\n        SGE_CHAIN_UNION     Chain;\n    } u;\n} SGE_IO_UNION, MPI_POINTER PTR_SGE_IO_UNION,\n  SGEIOUnion_t, MPI_POINTER pSGEIOUnion_t;\n\n/****************************************************************************/\n/*  SGE union for SGL's with Simple and Transaction elements                */\n/****************************************************************************/\n\ntypedef struct _SGE_TRANS_SIMPLE_UNION\n{\n    union\n    {\n        SGE_SIMPLE_UNION        Simple;\n        SGE_TRANSACTION_UNION   Transaction;\n    } u;\n} SGE_TRANS_SIMPLE_UNION, MPI_POINTER PTR_SGE_TRANS_SIMPLE_UNION,\n  SGETransSimpleUnion_t, MPI_POINTER pSGETransSimpleUnion_t;\n\n/****************************************************************************/\n/*  All SGE types union                                                     */\n/****************************************************************************/\n\ntypedef struct _SGE_MPI_UNION\n{\n    union\n    {\n        SGE_SIMPLE_UNION        Simple;\n        SGE_CHAIN_UNION         Chain;\n        SGE_TRANSACTION_UNION   Transaction;\n    } u;\n} SGE_MPI_UNION, MPI_POINTER PTR_SGE_MPI_UNION,\n  MPI_SGE_UNION_t, MPI_POINTER pMPI_SGE_UNION_t,\n  SGEAllUnion_t, MPI_POINTER pSGEAllUnion_t;\n\n\n/****************************************************************************/\n/*  SGE field definition and masks                                          */\n/****************************************************************************/\n\n/* Flags field bit definitions */\n\n#define MPI_SGE_FLAGS_LAST_ELEMENT              (0x80)\n#define MPI_SGE_FLAGS_END_OF_BUFFER             (0x40)\n#define MPI_SGE_FLAGS_ELEMENT_TYPE_MASK         (0x30)\n#define MPI_SGE_FLAGS_LOCAL_ADDRESS             (0x08)\n#define MPI_SGE_FLAGS_DIRECTION                 (0x04)\n#define MPI_SGE_FLAGS_ADDRESS_SIZE              (0x02)\n#define MPI_SGE_FLAGS_END_OF_LIST               (0x01)\n\n#define MPI_SGE_FLAGS_SHIFT                     (24)\n\n#define MPI_SGE_LENGTH_MASK                     (0x00FFFFFF)\n#define MPI_SGE_CHAIN_LENGTH_MASK               (0x0000FFFF)\n\n/* Element Type */\n\n#define MPI_SGE_FLAGS_TRANSACTION_ELEMENT       (0x00)\n#define MPI_SGE_FLAGS_SIMPLE_ELEMENT            (0x10)\n#define MPI_SGE_FLAGS_CHAIN_ELEMENT             (0x30)\n#define MPI_SGE_FLAGS_ELEMENT_MASK              (0x30)\n\n/* Address location */\n\n#define MPI_SGE_FLAGS_SYSTEM_ADDRESS            (0x00)\n\n/* Direction */\n\n#define MPI_SGE_FLAGS_IOC_TO_HOST               (0x00)\n#define MPI_SGE_FLAGS_HOST_TO_IOC               (0x04)\n\n/* Address Size */\n\n#define MPI_SGE_FLAGS_32_BIT_ADDRESSING         (0x00)\n#define MPI_SGE_FLAGS_64_BIT_ADDRESSING         (0x02)\n\n/* Context Size */\n\n#define MPI_SGE_FLAGS_32_BIT_CONTEXT            (0x00)\n#define MPI_SGE_FLAGS_64_BIT_CONTEXT            (0x02)\n#define MPI_SGE_FLAGS_96_BIT_CONTEXT            (0x04)\n#define MPI_SGE_FLAGS_128_BIT_CONTEXT           (0x06)\n\n#define MPI_SGE_CHAIN_OFFSET_MASK               (0x00FF0000)\n#define MPI_SGE_CHAIN_OFFSET_SHIFT              (16)\n\n\n/****************************************************************************/\n/*  SGE operation Macros                                                    */\n/****************************************************************************/\n\n         /* SIMPLE FlagsLength manipulations... */\n#define  MPI_SGE_SET_FLAGS(f)           ((U32)(f) << MPI_SGE_FLAGS_SHIFT)\n#define  MPI_SGE_GET_FLAGS(fl)          (((fl) & ~MPI_SGE_LENGTH_MASK) >> MPI_SGE_FLAGS_SHIFT)\n#define  MPI_SGE_LENGTH(fl)             ((fl) & MPI_SGE_LENGTH_MASK)\n#define  MPI_SGE_CHAIN_LENGTH(fl)       ((fl) & MPI_SGE_CHAIN_LENGTH_MASK)\n\n#define  MPI_SGE_SET_FLAGS_LENGTH(f,l)  (MPI_SGE_SET_FLAGS(f) | MPI_SGE_LENGTH(l))\n\n#define  MPI_pSGE_GET_FLAGS(psg)        MPI_SGE_GET_FLAGS((psg)->FlagsLength)\n#define  MPI_pSGE_GET_LENGTH(psg)       MPI_SGE_LENGTH((psg)->FlagsLength)\n#define  MPI_pSGE_SET_FLAGS_LENGTH(psg,f,l)  (psg)->FlagsLength = MPI_SGE_SET_FLAGS_LENGTH(f,l)\n         /* CAUTION - The following are READ-MODIFY-WRITE! */\n#define  MPI_pSGE_SET_FLAGS(psg,f)      (psg)->FlagsLength |= MPI_SGE_SET_FLAGS(f)\n#define  MPI_pSGE_SET_LENGTH(psg,l)     (psg)->FlagsLength |= MPI_SGE_LENGTH(l)\n\n#define  MPI_GET_CHAIN_OFFSET(x) ((x&MPI_SGE_CHAIN_OFFSET_MASK)>>MPI_SGE_CHAIN_OFFSET_SHIFT)\n\n\n\n/*****************************************************************************\n*\n*        S t a n d a r d    M e s s a g e    S t r u c t u r e s\n*\n*****************************************************************************/\n\n/****************************************************************************/\n/* Standard message request header for all request messages                 */\n/****************************************************************************/\n\ntypedef struct _MSG_REQUEST_HEADER\n{\n    U8                      Reserved[2];      /* function specific */\n    U8                      ChainOffset;\n    U8                      Function;\n    U8                      Reserved1[3];     /* function specific */\n    U8                      MsgFlags;\n    U32                     MsgContext;\n} MSG_REQUEST_HEADER, MPI_POINTER PTR_MSG_REQUEST_HEADER,\n  MPIHeader_t, MPI_POINTER pMPIHeader_t;\n\n\n/****************************************************************************/\n/*  Default Reply                                                           */\n/****************************************************************************/\n\ntypedef struct _MSG_DEFAULT_REPLY\n{\n    U8                      Reserved[2];      /* function specific */\n    U8                      MsgLength;\n    U8                      Function;\n    U8                      Reserved1[3];     /* function specific */\n    U8                      MsgFlags;\n    U32                     MsgContext;\n    U8                      Reserved2[2];     /* function specific */\n    U16                     IOCStatus;\n    U32                     IOCLogInfo;\n} MSG_DEFAULT_REPLY, MPI_POINTER PTR_MSG_DEFAULT_REPLY,\n  MPIDefaultReply_t, MPI_POINTER pMPIDefaultReply_t;\n\n\n/* MsgFlags definition for all replies */\n\n#define MPI_MSGFLAGS_CONTINUATION_REPLY         (0x80)\n\n\n/*****************************************************************************\n*\n*               I O C    S t a t u s   V a l u e s\n*\n*****************************************************************************/\n\n/****************************************************************************/\n/*  Common IOCStatus values for all replies                                 */\n/****************************************************************************/\n\n#define MPI_IOCSTATUS_SUCCESS                   (0x0000)\n#define MPI_IOCSTATUS_INVALID_FUNCTION          (0x0001)\n#define MPI_IOCSTATUS_BUSY                      (0x0002)\n#define MPI_IOCSTATUS_INVALID_SGL               (0x0003)\n#define MPI_IOCSTATUS_INTERNAL_ERROR            (0x0004)\n#define MPI_IOCSTATUS_RESERVED                  (0x0005)\n#define MPI_IOCSTATUS_INSUFFICIENT_RESOURCES    (0x0006)\n#define MPI_IOCSTATUS_INVALID_FIELD             (0x0007)\n#define MPI_IOCSTATUS_INVALID_STATE             (0x0008)\n#define MPI_IOCSTATUS_OP_STATE_NOT_SUPPORTED    (0x0009)\n\n/****************************************************************************/\n/*  Config IOCStatus values                                                 */\n/****************************************************************************/\n\n#define MPI_IOCSTATUS_CONFIG_INVALID_ACTION     (0x0020)\n#define MPI_IOCSTATUS_CONFIG_INVALID_TYPE       (0x0021)\n#define MPI_IOCSTATUS_CONFIG_INVALID_PAGE       (0x0022)\n#define MPI_IOCSTATUS_CONFIG_INVALID_DATA       (0x0023)\n#define MPI_IOCSTATUS_CONFIG_NO_DEFAULTS        (0x0024)\n#define MPI_IOCSTATUS_CONFIG_CANT_COMMIT        (0x0025)\n\n/****************************************************************************/\n/*  SCSIIO Reply (SPI & FCP) initiator values                               */\n/****************************************************************************/\n\n#define MPI_IOCSTATUS_SCSI_RECOVERED_ERROR      (0x0040)\n#define MPI_IOCSTATUS_SCSI_INVALID_BUS          (0x0041)\n#define MPI_IOCSTATUS_SCSI_INVALID_TARGETID     (0x0042)\n#define MPI_IOCSTATUS_SCSI_DEVICE_NOT_THERE     (0x0043)\n#define MPI_IOCSTATUS_SCSI_DATA_OVERRUN         (0x0044)\n#define MPI_IOCSTATUS_SCSI_DATA_UNDERRUN        (0x0045)\n#define MPI_IOCSTATUS_SCSI_IO_DATA_ERROR        (0x0046)\n#define MPI_IOCSTATUS_SCSI_PROTOCOL_ERROR       (0x0047)\n#define MPI_IOCSTATUS_SCSI_TASK_TERMINATED      (0x0048)\n#define MPI_IOCSTATUS_SCSI_RESIDUAL_MISMATCH    (0x0049)\n#define MPI_IOCSTATUS_SCSI_TASK_MGMT_FAILED     (0x004A)\n#define MPI_IOCSTATUS_SCSI_IOC_TERMINATED       (0x004B)\n#define MPI_IOCSTATUS_SCSI_EXT_TERMINATED       (0x004C)\n\n/****************************************************************************/\n/*  For use by SCSI Initiator and SCSI Target end-to-end data protection    */\n/****************************************************************************/\n\n#define MPI_IOCSTATUS_EEDP_GUARD_ERROR          (0x004D)\n#define MPI_IOCSTATUS_EEDP_REF_TAG_ERROR        (0x004E)\n#define MPI_IOCSTATUS_EEDP_APP_TAG_ERROR        (0x004F)\n\n\n/****************************************************************************/\n/*  SCSI Target values                                                      */\n/****************************************************************************/\n\n#define MPI_IOCSTATUS_TARGET_PRIORITY_IO         (0x0060)\n#define MPI_IOCSTATUS_TARGET_INVALID_PORT        (0x0061)\n#define MPI_IOCSTATUS_TARGET_INVALID_IOCINDEX    (0x0062)   /* obsolete name */\n#define MPI_IOCSTATUS_TARGET_INVALID_IO_INDEX    (0x0062)\n#define MPI_IOCSTATUS_TARGET_ABORTED             (0x0063)\n#define MPI_IOCSTATUS_TARGET_NO_CONN_RETRYABLE   (0x0064)\n#define MPI_IOCSTATUS_TARGET_NO_CONNECTION       (0x0065)\n#define MPI_IOCSTATUS_TARGET_XFER_COUNT_MISMATCH (0x006A)\n#define MPI_IOCSTATUS_TARGET_STS_DATA_NOT_SENT   (0x006B)\n#define MPI_IOCSTATUS_TARGET_DATA_OFFSET_ERROR   (0x006D)\n#define MPI_IOCSTATUS_TARGET_TOO_MUCH_WRITE_DATA (0x006E)\n#define MPI_IOCSTATUS_TARGET_IU_TOO_SHORT        (0x006F)\n#define MPI_IOCSTATUS_TARGET_ACK_NAK_TIMEOUT     (0x0070)\n#define MPI_IOCSTATUS_TARGET_NAK_RECEIVED        (0x0071)\n\n/****************************************************************************/\n/*  Additional FCP target values (obsolete)                                 */\n/****************************************************************************/\n\n#define MPI_IOCSTATUS_TARGET_FC_ABORTED         (0x0066)    /* obsolete */\n#define MPI_IOCSTATUS_TARGET_FC_RX_ID_INVALID   (0x0067)    /* obsolete */\n#define MPI_IOCSTATUS_TARGET_FC_DID_INVALID     (0x0068)    /* obsolete */\n#define MPI_IOCSTATUS_TARGET_FC_NODE_LOGGED_OUT (0x0069)    /* obsolete */\n\n/****************************************************************************/\n/*  Fibre Channel Direct Access values                                      */\n/****************************************************************************/\n\n#define MPI_IOCSTATUS_FC_ABORTED                (0x0066)\n#define MPI_IOCSTATUS_FC_RX_ID_INVALID          (0x0067)\n#define MPI_IOCSTATUS_FC_DID_INVALID            (0x0068)\n#define MPI_IOCSTATUS_FC_NODE_LOGGED_OUT        (0x0069)\n#define MPI_IOCSTATUS_FC_EXCHANGE_CANCELED      (0x006C)\n\n/****************************************************************************/\n/*  LAN values                                                              */\n/****************************************************************************/\n\n#define MPI_IOCSTATUS_LAN_DEVICE_NOT_FOUND      (0x0080)\n#define MPI_IOCSTATUS_LAN_DEVICE_FAILURE        (0x0081)\n#define MPI_IOCSTATUS_LAN_TRANSMIT_ERROR        (0x0082)\n#define MPI_IOCSTATUS_LAN_TRANSMIT_ABORTED      (0x0083)\n#define MPI_IOCSTATUS_LAN_RECEIVE_ERROR         (0x0084)\n#define MPI_IOCSTATUS_LAN_RECEIVE_ABORTED       (0x0085)\n#define MPI_IOCSTATUS_LAN_PARTIAL_PACKET        (0x0086)\n#define MPI_IOCSTATUS_LAN_CANCELED              (0x0087)\n\n/****************************************************************************/\n/*  Serial Attached SCSI values                                             */\n/****************************************************************************/\n\n#define MPI_IOCSTATUS_SAS_SMP_REQUEST_FAILED    (0x0090)\n#define MPI_IOCSTATUS_SAS_SMP_DATA_OVERRUN      (0x0091)\n\n/****************************************************************************/\n/*  Inband values                                                           */\n/****************************************************************************/\n\n#define MPI_IOCSTATUS_INBAND_ABORTED            (0x0098)\n#define MPI_IOCSTATUS_INBAND_NO_CONNECTION      (0x0099)\n\n/****************************************************************************/\n/*  Diagnostic Tools values                                                 */\n/****************************************************************************/\n\n#define MPI_IOCSTATUS_DIAGNOSTIC_RELEASED       (0x00A0)\n\n\n/****************************************************************************/\n/*  IOCStatus flag to indicate that log info is available                   */\n/****************************************************************************/\n\n#define MPI_IOCSTATUS_FLAG_LOG_INFO_AVAILABLE   (0x8000)\n#define MPI_IOCSTATUS_MASK                      (0x7FFF)\n\n/****************************************************************************/\n/*  LogInfo Types                                                           */\n/****************************************************************************/\n\n#define MPI_IOCLOGINFO_TYPE_MASK                (0xF0000000)\n#define MPI_IOCLOGINFO_TYPE_SHIFT               (28)\n#define MPI_IOCLOGINFO_TYPE_NONE                (0x0)\n#define MPI_IOCLOGINFO_TYPE_SCSI                (0x1)\n#define MPI_IOCLOGINFO_TYPE_FC                  (0x2)\n#define MPI_IOCLOGINFO_TYPE_SAS                 (0x3)\n#define MPI_IOCLOGINFO_TYPE_ISCSI               (0x4)\n#define MPI_IOCLOGINFO_LOG_DATA_MASK            (0x0FFFFFFF)\n\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/dev/mpt/mpilib/mpi_cnfg.h",
    "content": "/* $FreeBSD: release/9.0.0/sys/dev/mpt/mpilib/mpi_cnfg.h 170251 2007-06-03 22:58:27Z scottl $ */\n/*-\n * Copyright (c) 2000-2005, LSI Logic Corporation and its contributors.\n * All rights reserved.\n * \n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions are\n * met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce at minimum a disclaimer\n *    substantially similar to the \"NO WARRANTY\" disclaimer below\n *    (\"Disclaimer\") and any redistribution must be conditioned upon including\n *    a substantially similar Disclaimer requirement for further binary\n *    redistribution.\n * 3. Neither the name of the LSI Logic Corporation nor the names of its\n *    contributors may be used to endorse or promote products derived from\n *    this software without specific prior written permission.\n * \n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\n * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE\n * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\n * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\n * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\n * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\n * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF THE COPYRIGHT\n * OWNER OR CONTRIBUTOR IS ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n *\n *           Name:  mpi_cnfg.h\n *          Title:  MPI Config message, structures, and Pages\n *  Creation Date:  July 27, 2000\n *\n *    mpi_cnfg.h Version:  01.05.15\n *\n *  Version History\n *  ---------------\n *\n *  Date      Version   Description\n *  --------  --------  ------------------------------------------------------\n *  05-08-00  00.10.01  Original release for 0.10 spec dated 4/26/2000.\n *  06-06-00  01.00.01  Update version number for 1.0 release.\n *  06-08-00  01.00.02  Added _PAGEVERSION definitions for all pages.\n *                      Added FcPhLowestVersion, FcPhHighestVersion, Reserved2\n *                      fields to FC_DEVICE_0 page, updated the page version.\n *                      Changed _FREE_RUNNING_CLOCK to _PACING_TRANSFERS in\n *                      SCSI_PORT_0, SCSI_DEVICE_0 and SCSI_DEVICE_1 pages\n *                      and updated the page versions.\n *                      Added _RESPONSE_ID_MASK definition to SCSI_PORT_1\n *                      page and updated the page version.\n *                      Added Information field and _INFO_PARAMS_NEGOTIATED\n *                      definitionto SCSI_DEVICE_0 page.\n *  06-22-00  01.00.03  Removed batch controls from LAN_0 page and updated the\n *                      page version.\n *                      Added BucketsRemaining to LAN_1 page, redefined the\n *                      state values, and updated the page version.\n *                      Revised bus width definitions in SCSI_PORT_0,\n *                      SCSI_DEVICE_0 and SCSI_DEVICE_1 pages.\n *  06-30-00  01.00.04  Added MaxReplySize to LAN_1 page and updated the page\n *                      version.\n *                      Moved FC_DEVICE_0 PageAddress description to spec.\n *  07-27-00  01.00.05  Corrected the SubsystemVendorID and SubsystemID field\n *                      widths in IOC_0 page and updated the page version.\n *  11-02-00  01.01.01  Original release for post 1.0 work\n *                      Added Manufacturing pages, IO Unit Page 2, SCSI SPI\n *                      Port Page 2, FC Port Page 4, FC Port Page 5\n *  11-15-00  01.01.02  Interim changes to match proposals\n *  12-04-00  01.01.03  Config page changes to match MPI rev 1.00.01.\n *  12-05-00  01.01.04  Modified config page actions.\n *  01-09-01  01.01.05  Added defines for page address formats.\n *                      Data size for Manufacturing pages 2 and 3 no longer\n *                      defined here.\n *                      Io Unit Page 2 size is fixed at 4 adapters and some\n *                      flags were changed.\n *                      SCSI Port Page 2 Device Settings modified.\n *                      New fields added to FC Port Page 0 and some flags\n *                      cleaned up.\n *                      Removed impedance flash from FC Port Page 1.\n *                      Added FC Port pages 6 and 7.\n *  01-25-01  01.01.06  Added MaxInitiators field to FcPortPage0.\n *  01-29-01  01.01.07  Changed some defines to make them 32 character unique.\n *                      Added some LinkType defines for FcPortPage0.\n *  02-20-01  01.01.08  Started using MPI_POINTER.\n *  02-27-01  01.01.09  Replaced MPI_CONFIG_PAGETYPE_SCSI_LUN with\n *                      MPI_CONFIG_PAGETYPE_RAID_VOLUME.\n *                      Added definitions and structures for IOC Page 2 and\n *                      RAID Volume Page 2.\n *  03-27-01  01.01.10  Added CONFIG_PAGE_FC_PORT_8 and CONFIG_PAGE_FC_PORT_9.\n *                      CONFIG_PAGE_FC_PORT_3 now supports persistent by DID.\n *                      Added VendorId and ProductRevLevel fields to\n *                      RAIDVOL2_IM_PHYS_ID struct.\n *                      Modified values for MPI_FCPORTPAGE0_FLAGS_ATTACH_\n *                      defines to make them compatible to MPI version 1.0.\n *                      Added structure offset comments.\n *  04-09-01  01.01.11  Added some new defines for the PageAddress field and\n *                      removed some obsolete ones.\n *                      Added IO Unit Page 3.\n *                      Modified defines for Scsi Port Page 2.\n *                      Modified RAID Volume Pages.\n *  08-08-01  01.02.01  Original release for v1.2 work.\n *                      Added SepID and SepBus to RVP2 IMPhysicalDisk struct.\n *                      Added defines for the SEP bits in RVP2 VolumeSettings.\n *                      Modified the DeviceSettings field in RVP2 to use the\n *                      proper structure.\n *                      Added defines for SES, SAF-TE, and cross channel for\n *                      IOCPage2 CapabilitiesFlags.\n *                      Removed define for MPI_IOUNITPAGE2_FLAGS_RAID_DISABLE.\n *                      Removed define for\n *                      MPI_SCSIPORTPAGE2_PORT_FLAGS_PARITY_ENABLE.\n *                      Added define for MPI_CONFIG_PAGEATTR_RO_PERSISTENT.\n *  08-29-01 01.02.02   Fixed value for MPI_MANUFACTPAGE_DEVID_53C1035.\n *                      Added defines for MPI_FCPORTPAGE1_FLAGS_HARD_ALPA_ONLY\n *                      and MPI_FCPORTPAGE1_FLAGS_IMMEDIATE_ERROR_REPLY.\n *                      Removed MPI_SCSIPORTPAGE0_CAP_PACING_TRANSFERS,\n *                      MPI_SCSIDEVPAGE0_NP_PACING_TRANSFERS, and\n *                      MPI_SCSIDEVPAGE1_RP_PACING_TRANSFERS, and\n *                      MPI_SCSIDEVPAGE1_CONF_PPR_ALLOWED.\n *                      Added defines for MPI_SCSIDEVPAGE1_CONF_WDTR_DISALLOWED\n *                      and MPI_SCSIDEVPAGE1_CONF_SDTR_DISALLOWED.\n *                      Added OnBusTimerValue to CONFIG_PAGE_SCSI_PORT_1.\n *                      Added rejected bits to SCSI Device Page 0 Information.\n *                      Increased size of ALPA array in FC Port Page 2 by one\n *                      and removed a one byte reserved field.\n *  09-28-01 01.02.03   Swapped NegWireSpeedLow and NegWireSpeedLow in\n *                      CONFIG_PAGE_LAN_1 to match preferred 64-bit ordering.\n *                      Added structures for Manufacturing Page 4, IO Unit\n *                      Page 3, IOC Page 3, IOC Page 4, RAID Volume Page 0, and\n *                      RAID PhysDisk Page 0.\n *  10-04-01 01.02.04   Added define for MPI_CONFIG_PAGETYPE_RAID_PHYSDISK.\n *                      Modified some of the new defines to make them 32\n *                      character unique.\n *                      Modified how variable length pages (arrays) are defined.\n *                      Added generic defines for hot spare pools and RAID\n *                      volume types.\n *  11-01-01 01.02.05   Added define for MPI_IOUNITPAGE1_DISABLE_IR.\n *  03-14-02 01.02.06   Added PCISlotNum field to CONFIG_PAGE_IOC_1 along with\n *                      related define, and bumped the page version define.\n *  05-31-02 01.02.07   Added a Flags field to CONFIG_PAGE_IOC_2_RAID_VOL in a\n *                      reserved byte and added a define.\n *                      Added define for\n *                      MPI_RAIDVOL0_STATUS_FLAG_VOLUME_INACTIVE.\n *                      Added new config page: CONFIG_PAGE_IOC_5.\n *                      Added MaxAliases, MaxHardAliases, and NumCurrentAliases\n *                      fields to CONFIG_PAGE_FC_PORT_0.\n *                      Added AltConnector and NumRequestedAliases fields to\n *                      CONFIG_PAGE_FC_PORT_1.\n *                      Added new config page: CONFIG_PAGE_FC_PORT_10.\n *  07-12-02 01.02.08   Added more MPI_MANUFACTPAGE_DEVID_ defines.\n *                      Added additional MPI_SCSIDEVPAGE0_NP_ defines.\n *                      Added more MPI_SCSIDEVPAGE1_RP_ defines.\n *                      Added define for\n *                      MPI_SCSIDEVPAGE1_CONF_EXTENDED_PARAMS_ENABLE.\n *                      Added new config page: CONFIG_PAGE_SCSI_DEVICE_3.\n *                      Modified MPI_FCPORTPAGE5_FLAGS_ defines.\n *  09-16-02 01.02.09   Added MPI_SCSIDEVPAGE1_CONF_FORCE_PPR_MSG define.\n *  11-15-02 01.02.10   Added ConnectedID defines for CONFIG_PAGE_SCSI_PORT_0.\n *                      Added more Flags defines for CONFIG_PAGE_FC_PORT_1.\n *                      Added more Flags defines for CONFIG_PAGE_FC_DEVICE_0.\n *  04-01-03 01.02.11   Added RR_TOV field and additional Flags defines for\n *                      CONFIG_PAGE_FC_PORT_1.\n *                      Added define MPI_FCPORTPAGE5_FLAGS_DISABLE to disable\n *                      an alias.\n *                      Added more device id defines.\n *  06-26-03 01.02.12   Added MPI_IOUNITPAGE1_IR_USE_STATIC_VOLUME_ID define.\n *                      Added TargetConfig and IDConfig fields to\n *                      CONFIG_PAGE_SCSI_PORT_1.\n *                      Added more PortFlags defines for CONFIG_PAGE_SCSI_PORT_2\n *                      to control DV.\n *                      Added more Flags defines for CONFIG_PAGE_FC_PORT_1.\n *                      In CONFIG_PAGE_FC_DEVICE_0, replaced Reserved1 field\n *                      with ADISCHardALPA.\n *                      Added MPI_FC_DEVICE_PAGE0_PROT_FCP_RETRY define.\n *  01-16-04 01.02.13   Added InitiatorDeviceTimeout and InitiatorIoPendTimeout\n *                      fields and related defines to CONFIG_PAGE_FC_PORT_1.\n *                      Added define for\n *                      MPI_FCPORTPAGE1_FLAGS_SOFT_ALPA_FALLBACK.\n *                      Added new fields to the substructures of\n *                      CONFIG_PAGE_FC_PORT_10.\n *  04-29-04 01.02.14   Added define for IDP bit for CONFIG_PAGE_SCSI_PORT_0,\n *                      CONFIG_PAGE_SCSI_DEVICE_0, and\n *                      CONFIG_PAGE_SCSI_DEVICE_1. Also bumped Page Version for\n *                      these pages.\n *  05-11-04 01.03.01   Added structure for CONFIG_PAGE_INBAND_0.\n *  08-19-04 01.05.01   Modified MSG_CONFIG request to support extended config\n *                      pages.\n *                      Added a new structure for extended config page header.\n *                      Added new extended config pages types and structures for\n *                      SAS IO Unit, SAS Expander, SAS Device, and SAS PHY.\n *                      Replaced a reserved byte in CONFIG_PAGE_MANUFACTURING_4\n *                      to add a Flags field.\n *                      Two new Manufacturing config pages (5 and 6).\n *                      Two new bits defined for IO Unit Page 1 Flags field.\n *                      Modified CONFIG_PAGE_IO_UNIT_2 to add three new fields\n *                      to specify the BIOS boot device.\n *                      Four new Flags bits defined for IO Unit Page 2.\n *                      Added IO Unit Page 4.\n *                      Added EEDP Flags settings to IOC Page 1.\n *                      Added new BIOS Page 1 config page.\n *  10-05-04 01.05.02   Added define for\n *                      MPI_IOCPAGE1_INITIATOR_CONTEXT_REPLY_DISABLE.\n *                      Added new Flags field to CONFIG_PAGE_MANUFACTURING_5 and\n *                      associated defines.\n *                      Added more defines for SAS IO Unit Page 0\n *                      DiscoveryStatus field.\n *                      Added define for MPI_SAS_IOUNIT0_DS_SUBTRACTIVE_LINK\n *                      and MPI_SAS_IOUNIT0_DS_TABLE_LINK.\n *                      Added defines for Physical Mapping Modes to SAS IO Unit\n *                      Page 2.\n *                      Added define for\n *                      MPI_SAS_DEVICE0_FLAGS_PORT_SELECTOR_ATTACH.\n *  10-27-04 01.05.03   Added defines for new SAS PHY page addressing mode.\n *                      Added defines for MaxTargetSpinUp to BIOS Page 1.\n *                      Added 5 new ControlFlags defines for SAS IO Unit\n *                      Page 1.\n *                      Added MaxNumPhysicalMappedIDs field to SAS IO Unit\n *                      Page 2.\n *                      Added AccessStatus field to SAS Device Page 0 and added\n *                      new Flags bits for supported SATA features.\n *  12-07-04  01.05.04  Added config page structures for BIOS Page 2, RAID\n *                      Volume Page 1, and RAID Physical Disk Page 1.\n *                      Replaced IO Unit Page 1 BootTargetID,BootBus, and\n *                      BootAdapterNum with reserved field.\n *                      Added DataScrubRate and ResyncRate to RAID Volume\n *                      Page 0.\n *                      Added MPI_SAS_IOUNIT2_FLAGS_RESERVE_ID_0_FOR_BOOT\n *                      define.\n *  12-09-04  01.05.05  Added Target Mode Large CDB Enable to FC Port Page 1\n *                      Flags field.\n *                      Added Auto Port Config flag define for SAS IOUNIT\n *                      Page 1 ControlFlags.\n *                      Added Disabled bad Phy define to Expander Page 1\n *                      Discovery Info field.\n *                      Added SAS/SATA device support to SAS IOUnit Page 1\n *                      ControlFlags.\n *                      Added Unsupported device to SAS Dev Page 0 Flags field\n *                      Added disable use SATA Hash Address for SAS IOUNIT\n *                      page 1 in ControlFields.\n *  01-15-05  01.05.06  Added defaults for data scrub rate and resync rate to\n *                      Manufacturing Page 4.\n *                      Added new defines for BIOS Page 1 IOCSettings field.\n *                      Added ExtDiskIdentifier field to RAID Physical Disk\n *                      Page 0.\n *                      Added new defines for SAS IO Unit Page 1 ControlFlags\n *                      and to SAS Device Page 0 Flags to control SATA devices.\n *                      Added defines and structures for the new Log Page 0, a\n *                      new type of configuration page.\n *  02-09-05  01.05.07  Added InactiveStatus field to RAID Volume Page 0.\n *                      Added WWID field to RAID Volume Page 1.\n *                      Added PhysicalPort field to SAS Expander pages 0 and 1.\n *  03-11-05  01.05.08  Removed the EEDP flags from IOC Page 1.\n *                      Added Enclosure/Slot boot device format to BIOS Page 2.\n *                      New status value for RAID Volume Page 0 VolumeStatus\n *                      (VolumeState subfield).\n *                      New value for RAID Physical Page 0 InactiveStatus.\n *                      Added Inactive Volume Member flag RAID Physical Disk\n *                      Page 0 PhysDiskStatus field.\n *                      New physical mapping mode in SAS IO Unit Page 2.\n *                      Added CONFIG_PAGE_SAS_ENCLOSURE_0.\n *                      Added Slot and Enclosure fields to SAS Device Page 0.\n *  06-24-05  01.05.09  Added EEDP defines to IOC Page 1.\n *                      Added more RAID type defines to IOC Page 2.\n *                      Added Port Enable Delay settings to BIOS Page 1.\n *                      Added Bad Block Table Full define to RAID Volume Page 0.\n *                      Added Previous State defines to RAID Physical Disk\n *                      Page 0.\n *                      Added Max Sata Targets define for DiscoveryStatus field\n *                      of SAS IO Unit Page 0.\n *                      Added Device Self Test to Control Flags of SAS IO Unit\n *                      Page 1.\n *                      Added Direct Attach Starting Slot Number define for SAS\n *                      IO Unit Page 2.\n *                      Added new fields in SAS Device Page 2 for enclosure\n *                      mapping.\n *                      Added OwnerDevHandle and Flags field to SAS PHY Page 0.\n *                      Added IOC GPIO Flags define to SAS Enclosure Page 0.\n *                      Fixed the value for MPI_SAS_IOUNIT1_CONTROL_DEV_SATA_SUPPORT.\n *  08-03-05  01.05.10  Removed ISDataScrubRate and ISResyncRate from\n *                      Manufacturing Page 4.\n *                      Added MPI_IOUNITPAGE1_SATA_WRITE_CACHE_DISABLE bit.\n *                      Added NumDevsPerEnclosure field to SAS IO Unit page 2.\n *                      Added MPI_SAS_IOUNIT2_FLAGS_HOST_ASSIGNED_PHYS_MAP\n *                      define.\n *                      Added EnclosureHandle field to SAS Expander page 0.\n *                      Removed redundant NumTableEntriesProg field from SAS\n *                      Expander Page 1.\n *  08-30-05  01.05.11  Added DeviceID for FC949E and changed the DeviceID for\n *                      SAS1078.\n *                      Added more defines for Manufacturing Page 4 Flags field.\n *                      Added more defines for IOCSettings and added\n *                      ExpanderSpinup field to Bios Page 1.\n *                      Added postpone SATA Init bit to SAS IO Unit Page 1\n *                      ControlFlags.\n *                      Changed LogEntry format for Log Page 0.\n *  03-27-06  01.05.12  Added two new Flags defines for Manufacturing Page 4.\n *                      Added Manufacturing Page 7.\n *                      Added MPI_IOCPAGE2_CAP_FLAGS_RAID_64_BIT_ADDRESSING.\n *                      Added IOC Page 6.\n *                      Added PrevBootDeviceForm field to CONFIG_PAGE_BIOS_2.\n *                      Added MaxLBAHigh field to RAID Volume Page 0.\n *                      Added Nvdata version fields to SAS IO Unit Page 0.\n *                      Added AdditionalControlFlags, MaxTargetPortConnectTime,\n *                      ReportDeviceMissingDelay, and IODeviceMissingDelay\n *                      fields to SAS IO Unit Page 1.\n *  10-11-06  01.05.13  Added NumForceWWID field and ForceWWID array to\n *                      Manufacturing Page 5.\n *                      Added Manufacturing pages 8 through 10.\n *                      Added defines for supported metadata size bits in\n *                      CapabilitiesFlags field of IOC Page 6.\n *                      Added defines for metadata size bits in VolumeSettings\n *                      field of RAID Volume Page 0.\n *                      Added SATA Link Reset settings, Enable SATA Asynchronous\n *                      Notification bit, and HideNonZeroAttachedPhyIdentifiers\n *                      bit to AdditionalControlFlags field of SAS IO Unit\n *                      Page 1.\n *                      Added defines for Enclosure Devices Unmapped and\n *                      Device Limit Exceeded bits in Status field of SAS IO\n *                      Unit Page 2.\n *                      Added more AccessStatus values for SAS Device Page 0.\n *                      Added bit for SATA Asynchronous Notification Support in\n *                      Flags field of SAS Device Page 0.\n *  02-28-07  01.05.14  Added ExtFlags field to Manufacturing Page 4.\n *                      Added Disable SMART Polling for CapabilitiesFlags of\n *                      IOC Page 6.\n *                      Added Disable SMART Polling to DeviceSettings of BIOS\n *                      Page 1.\n *                      Added Multi-Port Domain bit for DiscoveryStatus field\n *                      of SAS IO Unit Page.\n *                      Added Multi-Port Domain Illegal flag for SAS IO Unit\n *                      Page 1 AdditionalControlFlags field.\n *  05-24-07  01.05.15  Added Hide Physical Disks with Non-Integrated RAID\n *                      Metadata bit to Manufacturing Page 4 ExtFlags field.\n *                      Added Internal Connector to End Device Present bit to\n *                      Expander Page 0 Flags field.\n *                      Fixed define for\n *                      MPI_SAS_EXPANDER1_DISCINFO_BAD_PHY_DISABLED.\n *  --------------------------------------------------------------------------\n */\n\n#ifndef MPI_CNFG_H\n#define MPI_CNFG_H\n\n\n/*****************************************************************************\n*\n*       C o n f i g    M e s s a g e    a n d    S t r u c t u r e s\n*\n*****************************************************************************/\n\ntypedef struct _CONFIG_PAGE_HEADER\n{\n    U8                      PageVersion;                /* 00h */\n    U8                      PageLength;                 /* 01h */\n    U8                      PageNumber;                 /* 02h */\n    U8                      PageType;                   /* 03h */\n} CONFIG_PAGE_HEADER, MPI_POINTER PTR_CONFIG_PAGE_HEADER,\n  ConfigPageHeader_t, MPI_POINTER pConfigPageHeader_t;\n\ntypedef union _CONFIG_PAGE_HEADER_UNION\n{\n   ConfigPageHeader_t  Struct;\n   U8                  Bytes[4];\n   U16                 Word16[2];\n   U32                 Word32;\n} ConfigPageHeaderUnion, MPI_POINTER pConfigPageHeaderUnion,\n  CONFIG_PAGE_HEADER_UNION, MPI_POINTER PTR_CONFIG_PAGE_HEADER_UNION;\n\ntypedef struct _CONFIG_EXTENDED_PAGE_HEADER\n{\n    U8                  PageVersion;                /* 00h */\n    U8                  Reserved1;                  /* 01h */\n    U8                  PageNumber;                 /* 02h */\n    U8                  PageType;                   /* 03h */\n    U16                 ExtPageLength;              /* 04h */\n    U8                  ExtPageType;                /* 06h */\n    U8                  Reserved2;                  /* 07h */\n} CONFIG_EXTENDED_PAGE_HEADER, MPI_POINTER PTR_CONFIG_EXTENDED_PAGE_HEADER,\n  ConfigExtendedPageHeader_t, MPI_POINTER pConfigExtendedPageHeader_t;\n\n\n\n/****************************************************************************\n*   PageType field values\n****************************************************************************/\n#define MPI_CONFIG_PAGEATTR_READ_ONLY               (0x00)\n#define MPI_CONFIG_PAGEATTR_CHANGEABLE              (0x10)\n#define MPI_CONFIG_PAGEATTR_PERSISTENT              (0x20)\n#define MPI_CONFIG_PAGEATTR_RO_PERSISTENT           (0x30)\n#define MPI_CONFIG_PAGEATTR_MASK                    (0xF0)\n\n#define MPI_CONFIG_PAGETYPE_IO_UNIT                 (0x00)\n#define MPI_CONFIG_PAGETYPE_IOC                     (0x01)\n#define MPI_CONFIG_PAGETYPE_BIOS                    (0x02)\n#define MPI_CONFIG_PAGETYPE_SCSI_PORT               (0x03)\n#define MPI_CONFIG_PAGETYPE_SCSI_DEVICE             (0x04)\n#define MPI_CONFIG_PAGETYPE_FC_PORT                 (0x05)\n#define MPI_CONFIG_PAGETYPE_FC_DEVICE               (0x06)\n#define MPI_CONFIG_PAGETYPE_LAN                     (0x07)\n#define MPI_CONFIG_PAGETYPE_RAID_VOLUME             (0x08)\n#define MPI_CONFIG_PAGETYPE_MANUFACTURING           (0x09)\n#define MPI_CONFIG_PAGETYPE_RAID_PHYSDISK           (0x0A)\n#define MPI_CONFIG_PAGETYPE_INBAND                  (0x0B)\n#define MPI_CONFIG_PAGETYPE_EXTENDED                (0x0F)\n#define MPI_CONFIG_PAGETYPE_MASK                    (0x0F)\n\n#define MPI_CONFIG_TYPENUM_MASK                     (0x0FFF)\n\n\n/****************************************************************************\n*   ExtPageType field values\n****************************************************************************/\n#define MPI_CONFIG_EXTPAGETYPE_SAS_IO_UNIT          (0x10)\n#define MPI_CONFIG_EXTPAGETYPE_SAS_EXPANDER         (0x11)\n#define MPI_CONFIG_EXTPAGETYPE_SAS_DEVICE           (0x12)\n#define MPI_CONFIG_EXTPAGETYPE_SAS_PHY              (0x13)\n#define MPI_CONFIG_EXTPAGETYPE_LOG                  (0x14)\n#define MPI_CONFIG_EXTPAGETYPE_ENCLOSURE            (0x15)\n\n\n/****************************************************************************\n*   PageAddress field values\n****************************************************************************/\n#define MPI_SCSI_PORT_PGAD_PORT_MASK                (0x000000FF)\n\n#define MPI_SCSI_DEVICE_FORM_MASK                   (0xF0000000)\n#define MPI_SCSI_DEVICE_FORM_BUS_TID                (0x00000000)\n#define MPI_SCSI_DEVICE_TARGET_ID_MASK              (0x000000FF)\n#define MPI_SCSI_DEVICE_TARGET_ID_SHIFT             (0)\n#define MPI_SCSI_DEVICE_BUS_MASK                    (0x0000FF00)\n#define MPI_SCSI_DEVICE_BUS_SHIFT                   (8)\n#define MPI_SCSI_DEVICE_FORM_TARGET_MODE            (0x10000000)\n#define MPI_SCSI_DEVICE_TM_RESPOND_ID_MASK          (0x000000FF)\n#define MPI_SCSI_DEVICE_TM_RESPOND_ID_SHIFT         (0)\n#define MPI_SCSI_DEVICE_TM_BUS_MASK                 (0x0000FF00)\n#define MPI_SCSI_DEVICE_TM_BUS_SHIFT                (8)\n#define MPI_SCSI_DEVICE_TM_INIT_ID_MASK             (0x00FF0000)\n#define MPI_SCSI_DEVICE_TM_INIT_ID_SHIFT            (16)\n\n#define MPI_FC_PORT_PGAD_PORT_MASK                  (0xF0000000)\n#define MPI_FC_PORT_PGAD_PORT_SHIFT                 (28)\n#define MPI_FC_PORT_PGAD_FORM_MASK                  (0x0F000000)\n#define MPI_FC_PORT_PGAD_FORM_INDEX                 (0x01000000)\n#define MPI_FC_PORT_PGAD_INDEX_MASK                 (0x0000FFFF)\n#define MPI_FC_PORT_PGAD_INDEX_SHIFT                (0)\n\n#define MPI_FC_DEVICE_PGAD_PORT_MASK                (0xF0000000)\n#define MPI_FC_DEVICE_PGAD_PORT_SHIFT               (28)\n#define MPI_FC_DEVICE_PGAD_FORM_MASK                (0x0F000000)\n#define MPI_FC_DEVICE_PGAD_FORM_NEXT_DID            (0x00000000)\n#define MPI_FC_DEVICE_PGAD_ND_PORT_MASK             (0xF0000000)\n#define MPI_FC_DEVICE_PGAD_ND_PORT_SHIFT            (28)\n#define MPI_FC_DEVICE_PGAD_ND_DID_MASK              (0x00FFFFFF)\n#define MPI_FC_DEVICE_PGAD_ND_DID_SHIFT             (0)\n#define MPI_FC_DEVICE_PGAD_FORM_BUS_TID             (0x01000000)\n#define MPI_FC_DEVICE_PGAD_BT_BUS_MASK              (0x0000FF00)\n#define MPI_FC_DEVICE_PGAD_BT_BUS_SHIFT             (8)\n#define MPI_FC_DEVICE_PGAD_BT_TID_MASK              (0x000000FF)\n#define MPI_FC_DEVICE_PGAD_BT_TID_SHIFT             (0)\n\n#define MPI_PHYSDISK_PGAD_PHYSDISKNUM_MASK          (0x000000FF)\n#define MPI_PHYSDISK_PGAD_PHYSDISKNUM_SHIFT         (0)\n\n#define MPI_SAS_EXPAND_PGAD_FORM_MASK             (0xF0000000)\n#define MPI_SAS_EXPAND_PGAD_FORM_SHIFT            (28)\n#define MPI_SAS_EXPAND_PGAD_FORM_GET_NEXT_HANDLE  (0x00000000)\n#define MPI_SAS_EXPAND_PGAD_FORM_HANDLE_PHY_NUM   (0x00000001)\n#define MPI_SAS_EXPAND_PGAD_FORM_HANDLE           (0x00000002)\n#define MPI_SAS_EXPAND_PGAD_GNH_MASK_HANDLE       (0x0000FFFF)\n#define MPI_SAS_EXPAND_PGAD_GNH_SHIFT_HANDLE      (0)\n#define MPI_SAS_EXPAND_PGAD_HPN_MASK_PHY          (0x00FF0000)\n#define MPI_SAS_EXPAND_PGAD_HPN_SHIFT_PHY         (16)\n#define MPI_SAS_EXPAND_PGAD_HPN_MASK_HANDLE       (0x0000FFFF)\n#define MPI_SAS_EXPAND_PGAD_HPN_SHIFT_HANDLE      (0)\n#define MPI_SAS_EXPAND_PGAD_H_MASK_HANDLE         (0x0000FFFF)\n#define MPI_SAS_EXPAND_PGAD_H_SHIFT_HANDLE        (0)\n\n#define MPI_SAS_DEVICE_PGAD_FORM_MASK               (0xF0000000)\n#define MPI_SAS_DEVICE_PGAD_FORM_SHIFT              (28)\n#define MPI_SAS_DEVICE_PGAD_FORM_GET_NEXT_HANDLE    (0x00000000)\n#define MPI_SAS_DEVICE_PGAD_FORM_BUS_TARGET_ID      (0x00000001)\n#define MPI_SAS_DEVICE_PGAD_FORM_HANDLE             (0x00000002)\n#define MPI_SAS_DEVICE_PGAD_GNH_HANDLE_MASK         (0x0000FFFF)\n#define MPI_SAS_DEVICE_PGAD_GNH_HANDLE_SHIFT        (0)\n#define MPI_SAS_DEVICE_PGAD_BT_BUS_MASK             (0x0000FF00)\n#define MPI_SAS_DEVICE_PGAD_BT_BUS_SHIFT            (8)\n#define MPI_SAS_DEVICE_PGAD_BT_TID_MASK             (0x000000FF)\n#define MPI_SAS_DEVICE_PGAD_BT_TID_SHIFT            (0)\n#define MPI_SAS_DEVICE_PGAD_H_HANDLE_MASK           (0x0000FFFF)\n#define MPI_SAS_DEVICE_PGAD_H_HANDLE_SHIFT          (0)\n\n#define MPI_SAS_PHY_PGAD_FORM_MASK                  (0xF0000000)\n#define MPI_SAS_PHY_PGAD_FORM_SHIFT                 (28)\n#define MPI_SAS_PHY_PGAD_FORM_PHY_NUMBER            (0x0)\n#define MPI_SAS_PHY_PGAD_FORM_PHY_TBL_INDEX         (0x1)\n#define MPI_SAS_PHY_PGAD_PHY_NUMBER_MASK            (0x000000FF)\n#define MPI_SAS_PHY_PGAD_PHY_NUMBER_SHIFT           (0)\n#define MPI_SAS_PHY_PGAD_PHY_TBL_INDEX_MASK         (0x0000FFFF)\n#define MPI_SAS_PHY_PGAD_PHY_TBL_INDEX_SHIFT        (0)\n\n#define MPI_SAS_ENCLOS_PGAD_FORM_MASK               (0xF0000000)\n#define MPI_SAS_ENCLOS_PGAD_FORM_SHIFT              (28)\n#define MPI_SAS_ENCLOS_PGAD_FORM_GET_NEXT_HANDLE    (0x00000000)\n#define MPI_SAS_ENCLOS_PGAD_FORM_HANDLE             (0x00000001)\n#define MPI_SAS_ENCLOS_PGAD_GNH_HANDLE_MASK         (0x0000FFFF)\n#define MPI_SAS_ENCLOS_PGAD_GNH_HANDLE_SHIFT        (0)\n#define MPI_SAS_ENCLOS_PGAD_H_HANDLE_MASK           (0x0000FFFF)\n#define MPI_SAS_ENCLOS_PGAD_H_HANDLE_SHIFT          (0)\n\n\n\n/****************************************************************************\n*   Config Request Message\n****************************************************************************/\ntypedef struct _MSG_CONFIG\n{\n    U8                      Action;                     /* 00h */\n    U8                      Reserved;                   /* 01h */\n    U8                      ChainOffset;                /* 02h */\n    U8                      Function;                   /* 03h */\n    U16                     ExtPageLength;              /* 04h */\n    U8                      ExtPageType;                /* 06h */\n    U8                      MsgFlags;                   /* 07h */\n    U32                     MsgContext;                 /* 08h */\n    U8                      Reserved2[8];               /* 0Ch */\n    CONFIG_PAGE_HEADER      Header;                     /* 14h */\n    U32                     PageAddress;                /* 18h */\n    SGE_IO_UNION            PageBufferSGE;              /* 1Ch */\n} MSG_CONFIG, MPI_POINTER PTR_MSG_CONFIG,\n  Config_t, MPI_POINTER pConfig_t;\n\n\n/****************************************************************************\n*   Action field values\n****************************************************************************/\n#define MPI_CONFIG_ACTION_PAGE_HEADER               (0x00)\n#define MPI_CONFIG_ACTION_PAGE_READ_CURRENT         (0x01)\n#define MPI_CONFIG_ACTION_PAGE_WRITE_CURRENT        (0x02)\n#define MPI_CONFIG_ACTION_PAGE_DEFAULT              (0x03)\n#define MPI_CONFIG_ACTION_PAGE_WRITE_NVRAM          (0x04)\n#define MPI_CONFIG_ACTION_PAGE_READ_DEFAULT         (0x05)\n#define MPI_CONFIG_ACTION_PAGE_READ_NVRAM           (0x06)\n\n\n/* Config Reply Message */\ntypedef struct _MSG_CONFIG_REPLY\n{\n    U8                      Action;                     /* 00h */\n    U8                      Reserved;                   /* 01h */\n    U8                      MsgLength;                  /* 02h */\n    U8                      Function;                   /* 03h */\n    U16                     ExtPageLength;              /* 04h */\n    U8                      ExtPageType;                /* 06h */\n    U8                      MsgFlags;                   /* 07h */\n    U32                     MsgContext;                 /* 08h */\n    U8                      Reserved2[2];               /* 0Ch */\n    U16                     IOCStatus;                  /* 0Eh */\n    U32                     IOCLogInfo;                 /* 10h */\n    CONFIG_PAGE_HEADER      Header;                     /* 14h */\n} MSG_CONFIG_REPLY, MPI_POINTER PTR_MSG_CONFIG_REPLY,\n  ConfigReply_t, MPI_POINTER pConfigReply_t;\n\n\n\n/*****************************************************************************\n*\n*               C o n f i g u r a t i o n    P a g e s\n*\n*****************************************************************************/\n\n/****************************************************************************\n*   Manufacturing Config pages\n****************************************************************************/\n#define MPI_MANUFACTPAGE_VENDORID_LSILOGIC          (0x1000)\n/* Fibre Channel */\n#define MPI_MANUFACTPAGE_DEVICEID_FC909             (0x0621)\n#define MPI_MANUFACTPAGE_DEVICEID_FC919             (0x0624)\n#define MPI_MANUFACTPAGE_DEVICEID_FC929             (0x0622)\n#define MPI_MANUFACTPAGE_DEVICEID_FC919X            (0x0628)\n#define MPI_MANUFACTPAGE_DEVICEID_FC929X            (0x0626)\n#define MPI_MANUFACTPAGE_DEVICEID_FC939X            (0x0642)\n#define MPI_MANUFACTPAGE_DEVICEID_FC949X            (0x0640)\n#define MPI_MANUFACTPAGE_DEVICEID_FC949E            (0x0646)\n/* SCSI */\n#define MPI_MANUFACTPAGE_DEVID_53C1030              (0x0030)\n#define MPI_MANUFACTPAGE_DEVID_53C1030ZC            (0x0031)\n#define MPI_MANUFACTPAGE_DEVID_1030_53C1035         (0x0032)\n#define MPI_MANUFACTPAGE_DEVID_1030ZC_53C1035       (0x0033)\n#define MPI_MANUFACTPAGE_DEVID_53C1035              (0x0040)\n#define MPI_MANUFACTPAGE_DEVID_53C1035ZC            (0x0041)\n/* SAS */\n#define MPI_MANUFACTPAGE_DEVID_SAS1064              (0x0050)\n#define MPI_MANUFACTPAGE_DEVID_SAS1064A             (0x005C)\n#define MPI_MANUFACTPAGE_DEVID_SAS1064E             (0x0056)\n#define MPI_MANUFACTPAGE_DEVID_SAS1066              (0x005E)\n#define MPI_MANUFACTPAGE_DEVID_SAS1066E             (0x005A)\n#define MPI_MANUFACTPAGE_DEVID_SAS1068              (0x0054)\n#define MPI_MANUFACTPAGE_DEVID_SAS1068E             (0x0058)\n#define MPI_MANUFACTPAGE_DEVID_SAS1078              (0x0062)\n\n\ntypedef struct _CONFIG_PAGE_MANUFACTURING_0\n{\n    CONFIG_PAGE_HEADER      Header;                     /* 00h */\n    U8                      ChipName[16];               /* 04h */\n    U8                      ChipRevision[8];            /* 14h */\n    U8                      BoardName[16];              /* 1Ch */\n    U8                      BoardAssembly[16];          /* 2Ch */\n    U8                      BoardTracerNumber[16];      /* 3Ch */\n\n} CONFIG_PAGE_MANUFACTURING_0, MPI_POINTER PTR_CONFIG_PAGE_MANUFACTURING_0,\n  ManufacturingPage0_t, MPI_POINTER pManufacturingPage0_t;\n\n#define MPI_MANUFACTURING0_PAGEVERSION                 (0x00)\n\n\ntypedef struct _CONFIG_PAGE_MANUFACTURING_1\n{\n    CONFIG_PAGE_HEADER      Header;                     /* 00h */\n    U8                      VPD[256];                   /* 04h */\n} CONFIG_PAGE_MANUFACTURING_1, MPI_POINTER PTR_CONFIG_PAGE_MANUFACTURING_1,\n  ManufacturingPage1_t, MPI_POINTER pManufacturingPage1_t;\n\n#define MPI_MANUFACTURING1_PAGEVERSION                 (0x00)\n\n\ntypedef struct _MPI_CHIP_REVISION_ID\n{\n    U16 DeviceID;                                       /* 00h */\n    U8  PCIRevisionID;                                  /* 02h */\n    U8  Reserved;                                       /* 03h */\n} MPI_CHIP_REVISION_ID, MPI_POINTER PTR_MPI_CHIP_REVISION_ID,\n  MpiChipRevisionId_t, MPI_POINTER pMpiChipRevisionId_t;\n\n\n/*\n * Host code (drivers, BIOS, utilities, etc.) should leave this define set to\n * one and check Header.PageLength at runtime.\n */\n#ifndef MPI_MAN_PAGE_2_HW_SETTINGS_WORDS\n#define MPI_MAN_PAGE_2_HW_SETTINGS_WORDS    (1)\n#endif\n\ntypedef struct _CONFIG_PAGE_MANUFACTURING_2\n{\n    CONFIG_PAGE_HEADER      Header;                                 /* 00h */\n    MPI_CHIP_REVISION_ID    ChipId;                                 /* 04h */\n    U32                     HwSettings[MPI_MAN_PAGE_2_HW_SETTINGS_WORDS];/* 08h */\n} CONFIG_PAGE_MANUFACTURING_2, MPI_POINTER PTR_CONFIG_PAGE_MANUFACTURING_2,\n  ManufacturingPage2_t, MPI_POINTER pManufacturingPage2_t;\n\n#define MPI_MANUFACTURING2_PAGEVERSION                  (0x00)\n\n\n/*\n * Host code (drivers, BIOS, utilities, etc.) should leave this define set to\n * one and check Header.PageLength at runtime.\n */\n#ifndef MPI_MAN_PAGE_3_INFO_WORDS\n#define MPI_MAN_PAGE_3_INFO_WORDS           (1)\n#endif\n\ntypedef struct _CONFIG_PAGE_MANUFACTURING_3\n{\n    CONFIG_PAGE_HEADER                  Header;                     /* 00h */\n    MPI_CHIP_REVISION_ID                ChipId;                     /* 04h */\n    U32                                 Info[MPI_MAN_PAGE_3_INFO_WORDS];/* 08h */\n} CONFIG_PAGE_MANUFACTURING_3, MPI_POINTER PTR_CONFIG_PAGE_MANUFACTURING_3,\n  ManufacturingPage3_t, MPI_POINTER pManufacturingPage3_t;\n\n#define MPI_MANUFACTURING3_PAGEVERSION                  (0x00)\n\n\ntypedef struct _CONFIG_PAGE_MANUFACTURING_4\n{\n    CONFIG_PAGE_HEADER              Header;             /* 00h */\n    U32                             Reserved1;          /* 04h */\n    U8                              InfoOffset0;        /* 08h */\n    U8                              InfoSize0;          /* 09h */\n    U8                              InfoOffset1;        /* 0Ah */\n    U8                              InfoSize1;          /* 0Bh */\n    U8                              InquirySize;        /* 0Ch */\n    U8                              Flags;              /* 0Dh */\n    U16                             ExtFlags;           /* 0Eh */\n    U8                              InquiryData[56];    /* 10h */\n    U32                             ISVolumeSettings;   /* 48h */\n    U32                             IMEVolumeSettings;  /* 4Ch */\n    U32                             IMVolumeSettings;   /* 50h */\n    U32                             Reserved3;          /* 54h */\n    U32                             Reserved4;          /* 58h */\n    U32                             Reserved5;          /* 5Ch */\n    U8                              IMEDataScrubRate;   /* 60h */\n    U8                              IMEResyncRate;      /* 61h */\n    U16                             Reserved6;          /* 62h */\n    U8                              IMDataScrubRate;    /* 64h */\n    U8                              IMResyncRate;       /* 65h */\n    U16                             Reserved7;          /* 66h */\n    U32                             Reserved8;          /* 68h */\n    U32                             Reserved9;          /* 6Ch */\n} CONFIG_PAGE_MANUFACTURING_4, MPI_POINTER PTR_CONFIG_PAGE_MANUFACTURING_4,\n  ManufacturingPage4_t, MPI_POINTER pManufacturingPage4_t;\n\n#define MPI_MANUFACTURING4_PAGEVERSION                  (0x05)\n\n/* defines for the Flags field */\n#define MPI_MANPAGE4_FORCE_BAD_BLOCK_TABLE              (0x80)\n#define MPI_MANPAGE4_FORCE_OFFLINE_FAILOVER             (0x40)\n#define MPI_MANPAGE4_IME_DISABLE                        (0x20)\n#define MPI_MANPAGE4_IM_DISABLE                         (0x10)\n#define MPI_MANPAGE4_IS_DISABLE                         (0x08)\n#define MPI_MANPAGE4_IR_MODEPAGE8_DISABLE               (0x04)\n#define MPI_MANPAGE4_IM_RESYNC_CACHE_ENABLE             (0x02)\n#define MPI_MANPAGE4_IR_NO_MIX_SAS_SATA                 (0x01)\n\n/* defines for the ExtFlags field */\n#define MPI_MANPAGE4_EXTFLAGS_HIDE_NON_IR_METADATA      (0x0008)\n#define MPI_MANPAGE4_EXTFLAGS_SAS_CACHE_DISABLE         (0x0004)\n#define MPI_MANPAGE4_EXTFLAGS_SATA_CACHE_DISABLE        (0x0002)\n#define MPI_MANPAGE4_EXTFLAGS_LEGACY_MODE               (0x0001)\n\n\n#ifndef MPI_MANPAGE5_NUM_FORCEWWID\n#define MPI_MANPAGE5_NUM_FORCEWWID      (1)\n#endif\n\ntypedef struct _CONFIG_PAGE_MANUFACTURING_5\n{\n    CONFIG_PAGE_HEADER              Header;             /* 00h */\n    U64                             BaseWWID;           /* 04h */\n    U8                              Flags;              /* 0Ch */\n    U8                              NumForceWWID;       /* 0Dh */\n    U16                             Reserved2;          /* 0Eh */\n    U32                             Reserved3;          /* 10h */\n    U32                             Reserved4;          /* 14h */\n    U64                             ForceWWID[MPI_MANPAGE5_NUM_FORCEWWID]; /* 18h */\n} CONFIG_PAGE_MANUFACTURING_5, MPI_POINTER PTR_CONFIG_PAGE_MANUFACTURING_5,\n  ManufacturingPage5_t, MPI_POINTER pManufacturingPage5_t;\n\n#define MPI_MANUFACTURING5_PAGEVERSION                  (0x02)\n\n/* defines for the Flags field */\n#define MPI_MANPAGE5_TWO_WWID_PER_PHY                   (0x01)\n\n\ntypedef struct _CONFIG_PAGE_MANUFACTURING_6\n{\n    CONFIG_PAGE_HEADER              Header;             /* 00h */\n    U32                             ProductSpecificInfo;/* 04h */\n} CONFIG_PAGE_MANUFACTURING_6, MPI_POINTER PTR_CONFIG_PAGE_MANUFACTURING_6,\n  ManufacturingPage6_t, MPI_POINTER pManufacturingPage6_t;\n\n#define MPI_MANUFACTURING6_PAGEVERSION                  (0x00)\n\n\ntypedef struct _MPI_MANPAGE7_CONNECTOR_INFO\n{\n    U32                         Pinout;                 /* 00h */\n    U8                          Connector[16];          /* 04h */\n    U8                          Location;               /* 14h */\n    U8                          Reserved1;              /* 15h */\n    U16                         Slot;                   /* 16h */\n    U32                         Reserved2;              /* 18h */\n} MPI_MANPAGE7_CONNECTOR_INFO, MPI_POINTER PTR_MPI_MANPAGE7_CONNECTOR_INFO,\n  MpiManPage7ConnectorInfo_t, MPI_POINTER pMpiManPage7ConnectorInfo_t;\n\n/* defines for the Pinout field */\n#define MPI_MANPAGE7_PINOUT_SFF_8484_L4                 (0x00080000)\n#define MPI_MANPAGE7_PINOUT_SFF_8484_L3                 (0x00040000)\n#define MPI_MANPAGE7_PINOUT_SFF_8484_L2                 (0x00020000)\n#define MPI_MANPAGE7_PINOUT_SFF_8484_L1                 (0x00010000)\n#define MPI_MANPAGE7_PINOUT_SFF_8470_L4                 (0x00000800)\n#define MPI_MANPAGE7_PINOUT_SFF_8470_L3                 (0x00000400)\n#define MPI_MANPAGE7_PINOUT_SFF_8470_L2                 (0x00000200)\n#define MPI_MANPAGE7_PINOUT_SFF_8470_L1                 (0x00000100)\n#define MPI_MANPAGE7_PINOUT_SFF_8482                    (0x00000002)\n#define MPI_MANPAGE7_PINOUT_CONNECTION_UNKNOWN          (0x00000001)\n\n/* defines for the Location field */\n#define MPI_MANPAGE7_LOCATION_UNKNOWN                   (0x01)\n#define MPI_MANPAGE7_LOCATION_INTERNAL                  (0x02)\n#define MPI_MANPAGE7_LOCATION_EXTERNAL                  (0x04)\n#define MPI_MANPAGE7_LOCATION_SWITCHABLE                (0x08)\n#define MPI_MANPAGE7_LOCATION_AUTO                      (0x10)\n#define MPI_MANPAGE7_LOCATION_NOT_PRESENT               (0x20)\n#define MPI_MANPAGE7_LOCATION_NOT_CONNECTED             (0x80)\n\n/*\n * Host code (drivers, BIOS, utilities, etc.) should leave this define set to\n * one and check NumPhys at runtime.\n */\n#ifndef MPI_MANPAGE7_CONNECTOR_INFO_MAX\n#define MPI_MANPAGE7_CONNECTOR_INFO_MAX   (1)\n#endif\n\ntypedef struct _CONFIG_PAGE_MANUFACTURING_7\n{\n    CONFIG_PAGE_HEADER          Header;                 /* 00h */\n    U32                         Reserved1;              /* 04h */\n    U32                         Reserved2;              /* 08h */\n    U32                         Flags;                  /* 0Ch */\n    U8                          EnclosureName[16];      /* 10h */\n    U8                          NumPhys;                /* 20h */\n    U8                          Reserved3;              /* 21h */\n    U16                         Reserved4;              /* 22h */\n    MPI_MANPAGE7_CONNECTOR_INFO ConnectorInfo[MPI_MANPAGE7_CONNECTOR_INFO_MAX]; /* 24h */\n} CONFIG_PAGE_MANUFACTURING_7, MPI_POINTER PTR_CONFIG_PAGE_MANUFACTURING_7,\n  ManufacturingPage7_t, MPI_POINTER pManufacturingPage7_t;\n\n#define MPI_MANUFACTURING7_PAGEVERSION                  (0x00)\n\n/* defines for the Flags field */\n#define MPI_MANPAGE7_FLAG_USE_SLOT_INFO                 (0x00000001)\n\n\ntypedef struct _CONFIG_PAGE_MANUFACTURING_8\n{\n    CONFIG_PAGE_HEADER              Header;             /* 00h */\n    U32                             ProductSpecificInfo;/* 04h */\n} CONFIG_PAGE_MANUFACTURING_8, MPI_POINTER PTR_CONFIG_PAGE_MANUFACTURING_8,\n  ManufacturingPage8_t, MPI_POINTER pManufacturingPage8_t;\n\n#define MPI_MANUFACTURING8_PAGEVERSION                  (0x00)\n\n\ntypedef struct _CONFIG_PAGE_MANUFACTURING_9\n{\n    CONFIG_PAGE_HEADER              Header;             /* 00h */\n    U32                             ProductSpecificInfo;/* 04h */\n} CONFIG_PAGE_MANUFACTURING_9, MPI_POINTER PTR_CONFIG_PAGE_MANUFACTURING_9,\n  ManufacturingPage9_t, MPI_POINTER pManufacturingPage9_t;\n\n#define MPI_MANUFACTURING9_PAGEVERSION                  (0x00)\n\n\ntypedef struct _CONFIG_PAGE_MANUFACTURING_10\n{\n    CONFIG_PAGE_HEADER              Header;             /* 00h */\n    U32                             ProductSpecificInfo;/* 04h */\n} CONFIG_PAGE_MANUFACTURING_10, MPI_POINTER PTR_CONFIG_PAGE_MANUFACTURING_10,\n  ManufacturingPage10_t, MPI_POINTER pManufacturingPage10_t;\n\n#define MPI_MANUFACTURING10_PAGEVERSION                 (0x00)\n\n\n/****************************************************************************\n*   IO Unit Config Pages\n****************************************************************************/\n\ntypedef struct _CONFIG_PAGE_IO_UNIT_0\n{\n    CONFIG_PAGE_HEADER      Header;                     /* 00h */\n    U64                     UniqueValue;                /* 04h */\n} CONFIG_PAGE_IO_UNIT_0, MPI_POINTER PTR_CONFIG_PAGE_IO_UNIT_0,\n  IOUnitPage0_t, MPI_POINTER pIOUnitPage0_t;\n\n#define MPI_IOUNITPAGE0_PAGEVERSION                     (0x00)\n\n\ntypedef struct _CONFIG_PAGE_IO_UNIT_1\n{\n    CONFIG_PAGE_HEADER      Header;                     /* 00h */\n    U32                     Flags;                      /* 04h */\n} CONFIG_PAGE_IO_UNIT_1, MPI_POINTER PTR_CONFIG_PAGE_IO_UNIT_1,\n  IOUnitPage1_t, MPI_POINTER pIOUnitPage1_t;\n\n#define MPI_IOUNITPAGE1_PAGEVERSION                     (0x02)\n\n/* IO Unit Page 1 Flags defines */\n#define MPI_IOUNITPAGE1_MULTI_FUNCTION                  (0x00000000)\n#define MPI_IOUNITPAGE1_SINGLE_FUNCTION                 (0x00000001)\n#define MPI_IOUNITPAGE1_MULTI_PATHING                   (0x00000002)\n#define MPI_IOUNITPAGE1_SINGLE_PATHING                  (0x00000000)\n#define MPI_IOUNITPAGE1_IR_USE_STATIC_VOLUME_ID         (0x00000004)\n#define MPI_IOUNITPAGE1_DISABLE_QUEUE_FULL_HANDLING     (0x00000020)\n#define MPI_IOUNITPAGE1_DISABLE_IR                      (0x00000040)\n#define MPI_IOUNITPAGE1_FORCE_32                        (0x00000080)\n#define MPI_IOUNITPAGE1_NATIVE_COMMAND_Q_DISABLE        (0x00000100)\n#define MPI_IOUNITPAGE1_SATA_WRITE_CACHE_DISABLE        (0x00000200)\n\ntypedef struct _MPI_ADAPTER_INFO\n{\n    U8      PciBusNumber;                               /* 00h */\n    U8      PciDeviceAndFunctionNumber;                 /* 01h */\n    U16     AdapterFlags;                               /* 02h */\n} MPI_ADAPTER_INFO, MPI_POINTER PTR_MPI_ADAPTER_INFO,\n  MpiAdapterInfo_t, MPI_POINTER pMpiAdapterInfo_t;\n\n#define MPI_ADAPTER_INFO_FLAGS_EMBEDDED                 (0x0001)\n#define MPI_ADAPTER_INFO_FLAGS_INIT_STATUS              (0x0002)\n\ntypedef struct _CONFIG_PAGE_IO_UNIT_2\n{\n    CONFIG_PAGE_HEADER      Header;                     /* 00h */\n    U32                     Flags;                      /* 04h */\n    U32                     BiosVersion;                /* 08h */\n    MPI_ADAPTER_INFO        AdapterOrder[4];            /* 0Ch */\n    U32                     Reserved1;                  /* 1Ch */\n} CONFIG_PAGE_IO_UNIT_2, MPI_POINTER PTR_CONFIG_PAGE_IO_UNIT_2,\n  IOUnitPage2_t, MPI_POINTER pIOUnitPage2_t;\n\n#define MPI_IOUNITPAGE2_PAGEVERSION                     (0x02)\n\n#define MPI_IOUNITPAGE2_FLAGS_PAUSE_ON_ERROR            (0x00000002)\n#define MPI_IOUNITPAGE2_FLAGS_VERBOSE_ENABLE            (0x00000004)\n#define MPI_IOUNITPAGE2_FLAGS_COLOR_VIDEO_DISABLE       (0x00000008)\n#define MPI_IOUNITPAGE2_FLAGS_DONT_HOOK_INT_40          (0x00000010)\n\n#define MPI_IOUNITPAGE2_FLAGS_DEV_LIST_DISPLAY_MASK     (0x000000E0)\n#define MPI_IOUNITPAGE2_FLAGS_INSTALLED_DEV_DISPLAY     (0x00000000)\n#define MPI_IOUNITPAGE2_FLAGS_ADAPTER_DISPLAY           (0x00000020)\n#define MPI_IOUNITPAGE2_FLAGS_ADAPTER_DEV_DISPLAY       (0x00000040)\n\n\n/*\n * Host code (drivers, BIOS, utilities, etc.) should leave this define set to\n * one and check Header.PageLength at runtime.\n */\n#ifndef MPI_IO_UNIT_PAGE_3_GPIO_VAL_MAX\n#define MPI_IO_UNIT_PAGE_3_GPIO_VAL_MAX     (1)\n#endif\n\ntypedef struct _CONFIG_PAGE_IO_UNIT_3\n{\n    CONFIG_PAGE_HEADER      Header;                                   /* 00h */\n    U8                      GPIOCount;                                /* 04h */\n    U8                      Reserved1;                                /* 05h */\n    U16                     Reserved2;                                /* 06h */\n    U16                     GPIOVal[MPI_IO_UNIT_PAGE_3_GPIO_VAL_MAX]; /* 08h */\n} CONFIG_PAGE_IO_UNIT_3, MPI_POINTER PTR_CONFIG_PAGE_IO_UNIT_3,\n  IOUnitPage3_t, MPI_POINTER pIOUnitPage3_t;\n\n#define MPI_IOUNITPAGE3_PAGEVERSION                     (0x01)\n\n#define MPI_IOUNITPAGE3_GPIO_FUNCTION_MASK              (0xFC)\n#define MPI_IOUNITPAGE3_GPIO_FUNCTION_SHIFT             (2)\n#define MPI_IOUNITPAGE3_GPIO_SETTING_OFF                (0x00)\n#define MPI_IOUNITPAGE3_GPIO_SETTING_ON                 (0x01)\n\n\ntypedef struct _CONFIG_PAGE_IO_UNIT_4\n{\n    CONFIG_PAGE_HEADER      Header;                                   /* 00h */\n    U32                     Reserved1;                                /* 04h */\n    SGE_SIMPLE_UNION        FWImageSGE;                               /* 08h */\n} CONFIG_PAGE_IO_UNIT_4, MPI_POINTER PTR_CONFIG_PAGE_IO_UNIT_4,\n  IOUnitPage4_t, MPI_POINTER pIOUnitPage4_t;\n\n#define MPI_IOUNITPAGE4_PAGEVERSION                     (0x00)\n\n\n/****************************************************************************\n*   IOC Config Pages\n****************************************************************************/\n\ntypedef struct _CONFIG_PAGE_IOC_0\n{\n    CONFIG_PAGE_HEADER      Header;                     /* 00h */\n    U32                     TotalNVStore;               /* 04h */\n    U32                     FreeNVStore;                /* 08h */\n    U16                     VendorID;                   /* 0Ch */\n    U16                     DeviceID;                   /* 0Eh */\n    U8                      RevisionID;                 /* 10h */\n    U8                      Reserved[3];                /* 11h */\n    U32                     ClassCode;                  /* 14h */\n    U16                     SubsystemVendorID;          /* 18h */\n    U16                     SubsystemID;                /* 1Ah */\n} CONFIG_PAGE_IOC_0, MPI_POINTER PTR_CONFIG_PAGE_IOC_0,\n  IOCPage0_t, MPI_POINTER pIOCPage0_t;\n\n#define MPI_IOCPAGE0_PAGEVERSION                        (0x01)\n\n\ntypedef struct _CONFIG_PAGE_IOC_1\n{\n    CONFIG_PAGE_HEADER      Header;                     /* 00h */\n    U32                     Flags;                      /* 04h */\n    U32                     CoalescingTimeout;          /* 08h */\n    U8                      CoalescingDepth;            /* 0Ch */\n    U8                      PCISlotNum;                 /* 0Dh */\n    U8                      Reserved[2];                /* 0Eh */\n} CONFIG_PAGE_IOC_1, MPI_POINTER PTR_CONFIG_PAGE_IOC_1,\n  IOCPage1_t, MPI_POINTER pIOCPage1_t;\n\n#define MPI_IOCPAGE1_PAGEVERSION                        (0x03)\n\n/* defines for the Flags field */\n#define MPI_IOCPAGE1_EEDP_MODE_MASK                     (0x07000000)\n#define MPI_IOCPAGE1_EEDP_MODE_OFF                      (0x00000000)\n#define MPI_IOCPAGE1_EEDP_MODE_T10                      (0x01000000)\n#define MPI_IOCPAGE1_EEDP_MODE_LSI_1                    (0x02000000)\n#define MPI_IOCPAGE1_INITIATOR_CONTEXT_REPLY_DISABLE    (0x00000010)\n#define MPI_IOCPAGE1_REPLY_COALESCING                   (0x00000001)\n\n#define MPI_IOCPAGE1_PCISLOTNUM_UNKNOWN                 (0xFF)\n\n\ntypedef struct _CONFIG_PAGE_IOC_2_RAID_VOL\n{\n    U8                          VolumeID;               /* 00h */\n    U8                          VolumeBus;              /* 01h */\n    U8                          VolumeIOC;              /* 02h */\n    U8                          VolumePageNumber;       /* 03h */\n    U8                          VolumeType;             /* 04h */\n    U8                          Flags;                  /* 05h */\n    U16                         Reserved3;              /* 06h */\n} CONFIG_PAGE_IOC_2_RAID_VOL, MPI_POINTER PTR_CONFIG_PAGE_IOC_2_RAID_VOL,\n  ConfigPageIoc2RaidVol_t, MPI_POINTER pConfigPageIoc2RaidVol_t;\n\n/* IOC Page 2 Volume RAID Type values, also used in RAID Volume pages */\n\n#define MPI_RAID_VOL_TYPE_IS                        (0x00)\n#define MPI_RAID_VOL_TYPE_IME                       (0x01)\n#define MPI_RAID_VOL_TYPE_IM                        (0x02)\n#define MPI_RAID_VOL_TYPE_RAID_5                    (0x03)\n#define MPI_RAID_VOL_TYPE_RAID_6                    (0x04)\n#define MPI_RAID_VOL_TYPE_RAID_10                   (0x05)\n#define MPI_RAID_VOL_TYPE_RAID_50                   (0x06)\n#define MPI_RAID_VOL_TYPE_UNKNOWN                   (0xFF)\n\n/* IOC Page 2 Volume Flags values */\n\n#define MPI_IOCPAGE2_FLAG_VOLUME_INACTIVE           (0x08)\n\n/*\n * Host code (drivers, BIOS, utilities, etc.) should leave this define set to\n * one and check Header.PageLength at runtime.\n */\n#ifndef MPI_IOC_PAGE_2_RAID_VOLUME_MAX\n#define MPI_IOC_PAGE_2_RAID_VOLUME_MAX      (1)\n#endif\n\ntypedef struct _CONFIG_PAGE_IOC_2\n{\n    CONFIG_PAGE_HEADER          Header;                              /* 00h */\n    U32                         CapabilitiesFlags;                   /* 04h */\n    U8                          NumActiveVolumes;                    /* 08h */\n    U8                          MaxVolumes;                          /* 09h */\n    U8                          NumActivePhysDisks;                  /* 0Ah */\n    U8                          MaxPhysDisks;                        /* 0Bh */\n    CONFIG_PAGE_IOC_2_RAID_VOL  RaidVolume[MPI_IOC_PAGE_2_RAID_VOLUME_MAX];/* 0Ch */\n} CONFIG_PAGE_IOC_2, MPI_POINTER PTR_CONFIG_PAGE_IOC_2,\n  IOCPage2_t, MPI_POINTER pIOCPage2_t;\n\n#define MPI_IOCPAGE2_PAGEVERSION                        (0x04)\n\n/* IOC Page 2 Capabilities flags */\n\n#define MPI_IOCPAGE2_CAP_FLAGS_IS_SUPPORT               (0x00000001)\n#define MPI_IOCPAGE2_CAP_FLAGS_IME_SUPPORT              (0x00000002)\n#define MPI_IOCPAGE2_CAP_FLAGS_IM_SUPPORT               (0x00000004)\n#define MPI_IOCPAGE2_CAP_FLAGS_RAID_5_SUPPORT           (0x00000008)\n#define MPI_IOCPAGE2_CAP_FLAGS_RAID_6_SUPPORT           (0x00000010)\n#define MPI_IOCPAGE2_CAP_FLAGS_RAID_10_SUPPORT          (0x00000020)\n#define MPI_IOCPAGE2_CAP_FLAGS_RAID_50_SUPPORT          (0x00000040)\n#define MPI_IOCPAGE2_CAP_FLAGS_RAID_64_BIT_ADDRESSING   (0x10000000)\n#define MPI_IOCPAGE2_CAP_FLAGS_SES_SUPPORT              (0x20000000)\n#define MPI_IOCPAGE2_CAP_FLAGS_SAFTE_SUPPORT            (0x40000000)\n#define MPI_IOCPAGE2_CAP_FLAGS_CROSS_CHANNEL_SUPPORT    (0x80000000)\n\n\ntypedef struct _IOC_3_PHYS_DISK\n{\n    U8                          PhysDiskID;             /* 00h */\n    U8                          PhysDiskBus;            /* 01h */\n    U8                          PhysDiskIOC;            /* 02h */\n    U8                          PhysDiskNum;            /* 03h */\n} IOC_3_PHYS_DISK, MPI_POINTER PTR_IOC_3_PHYS_DISK,\n  Ioc3PhysDisk_t, MPI_POINTER pIoc3PhysDisk_t;\n\n/*\n * Host code (drivers, BIOS, utilities, etc.) should leave this define set to\n * one and check Header.PageLength at runtime.\n */\n#ifndef MPI_IOC_PAGE_3_PHYSDISK_MAX\n#define MPI_IOC_PAGE_3_PHYSDISK_MAX         (1)\n#endif\n\ntypedef struct _CONFIG_PAGE_IOC_3\n{\n    CONFIG_PAGE_HEADER          Header;                                /* 00h */\n    U8                          NumPhysDisks;                          /* 04h */\n    U8                          Reserved1;                             /* 05h */\n    U16                         Reserved2;                             /* 06h */\n    IOC_3_PHYS_DISK             PhysDisk[MPI_IOC_PAGE_3_PHYSDISK_MAX]; /* 08h */\n} CONFIG_PAGE_IOC_3, MPI_POINTER PTR_CONFIG_PAGE_IOC_3,\n  IOCPage3_t, MPI_POINTER pIOCPage3_t;\n\n#define MPI_IOCPAGE3_PAGEVERSION                        (0x00)\n\n\ntypedef struct _IOC_4_SEP\n{\n    U8                          SEPTargetID;            /* 00h */\n    U8                          SEPBus;                 /* 01h */\n    U16                         Reserved;               /* 02h */\n} IOC_4_SEP, MPI_POINTER PTR_IOC_4_SEP,\n  Ioc4Sep_t, MPI_POINTER pIoc4Sep_t;\n\n/*\n * Host code (drivers, BIOS, utilities, etc.) should leave this define set to\n * one and check Header.PageLength at runtime.\n */\n#ifndef MPI_IOC_PAGE_4_SEP_MAX\n#define MPI_IOC_PAGE_4_SEP_MAX              (1)\n#endif\n\ntypedef struct _CONFIG_PAGE_IOC_4\n{\n    CONFIG_PAGE_HEADER          Header;                         /* 00h */\n    U8                          ActiveSEP;                      /* 04h */\n    U8                          MaxSEP;                         /* 05h */\n    U16                         Reserved1;                      /* 06h */\n    IOC_4_SEP                   SEP[MPI_IOC_PAGE_4_SEP_MAX];    /* 08h */\n} CONFIG_PAGE_IOC_4, MPI_POINTER PTR_CONFIG_PAGE_IOC_4,\n  IOCPage4_t, MPI_POINTER pIOCPage4_t;\n\n#define MPI_IOCPAGE4_PAGEVERSION                        (0x00)\n\n\ntypedef struct _IOC_5_HOT_SPARE\n{\n    U8                          PhysDiskNum;            /* 00h */\n    U8                          Reserved;               /* 01h */\n    U8                          HotSparePool;           /* 02h */\n    U8                          Flags;                   /* 03h */\n} IOC_5_HOT_SPARE, MPI_POINTER PTR_IOC_5_HOT_SPARE,\n  Ioc5HotSpare_t, MPI_POINTER pIoc5HotSpare_t;\n\n/* IOC Page 5 HotSpare Flags */\n#define MPI_IOC_PAGE_5_HOT_SPARE_ACTIVE                 (0x01)\n\n/*\n * Host code (drivers, BIOS, utilities, etc.) should leave this define set to\n * one and check Header.PageLength at runtime.\n */\n#ifndef MPI_IOC_PAGE_5_HOT_SPARE_MAX\n#define MPI_IOC_PAGE_5_HOT_SPARE_MAX        (1)\n#endif\n\ntypedef struct _CONFIG_PAGE_IOC_5\n{\n    CONFIG_PAGE_HEADER          Header;                         /* 00h */\n    U32                         Reserved1;                      /* 04h */\n    U8                          NumHotSpares;                   /* 08h */\n    U8                          Reserved2;                      /* 09h */\n    U16                         Reserved3;                      /* 0Ah */\n    IOC_5_HOT_SPARE             HotSpare[MPI_IOC_PAGE_5_HOT_SPARE_MAX]; /* 0Ch */\n} CONFIG_PAGE_IOC_5, MPI_POINTER PTR_CONFIG_PAGE_IOC_5,\n  IOCPage5_t, MPI_POINTER pIOCPage5_t;\n\n#define MPI_IOCPAGE5_PAGEVERSION                        (0x00)\n\ntypedef struct _CONFIG_PAGE_IOC_6\n{\n    CONFIG_PAGE_HEADER          Header;                         /* 00h */\n    U32                         CapabilitiesFlags;              /* 04h */\n    U8                          MaxDrivesIS;                    /* 08h */\n    U8                          MaxDrivesIM;                    /* 09h */\n    U8                          MaxDrivesIME;                   /* 0Ah */\n    U8                          Reserved1;                      /* 0Bh */\n    U8                          MinDrivesIS;                    /* 0Ch */\n    U8                          MinDrivesIM;                    /* 0Dh */\n    U8                          MinDrivesIME;                   /* 0Eh */\n    U8                          Reserved2;                      /* 0Fh */\n    U8                          MaxGlobalHotSpares;             /* 10h */\n    U8                          Reserved3;                      /* 11h */\n    U16                         Reserved4;                      /* 12h */\n    U32                         Reserved5;                      /* 14h */\n    U32                         SupportedStripeSizeMapIS;       /* 18h */\n    U32                         SupportedStripeSizeMapIME;      /* 1Ch */\n    U32                         Reserved6;                      /* 20h */\n    U8                          MetadataSize;                   /* 24h */\n    U8                          Reserved7;                      /* 25h */\n    U16                         Reserved8;                      /* 26h */\n    U16                         MaxBadBlockTableEntries;        /* 28h */\n    U16                         Reserved9;                      /* 2Ah */\n    U16                         IRNvsramUsage;                  /* 2Ch */\n    U16                         Reserved10;                     /* 2Eh */\n    U32                         IRNvsramVersion;                /* 30h */\n    U32                         Reserved11;                     /* 34h */\n    U32                         Reserved12;                     /* 38h */\n} CONFIG_PAGE_IOC_6, MPI_POINTER PTR_CONFIG_PAGE_IOC_6,\n  IOCPage6_t, MPI_POINTER pIOCPage6_t;\n\n#define MPI_IOCPAGE6_PAGEVERSION                        (0x01)\n\n/* IOC Page 6 Capabilities Flags */\n\n#define MPI_IOCPAGE6_CAP_FLAGS_DISABLE_SMART_POLLING    (0x00000008)\n\n#define MPI_IOCPAGE6_CAP_FLAGS_MASK_METADATA_SIZE       (0x00000006)\n#define MPI_IOCPAGE6_CAP_FLAGS_64MB_METADATA_SIZE       (0x00000000)\n#define MPI_IOCPAGE6_CAP_FLAGS_512MB_METADATA_SIZE      (0x00000002)\n\n#define MPI_IOCPAGE6_CAP_FLAGS_GLOBAL_HOT_SPARE         (0x00000001)\n\n\n/****************************************************************************\n*   BIOS Config Pages\n****************************************************************************/\n\ntypedef struct _CONFIG_PAGE_BIOS_1\n{\n    CONFIG_PAGE_HEADER      Header;                     /* 00h */\n    U32                     BiosOptions;                /* 04h */\n    U32                     IOCSettings;                /* 08h */\n    U32                     Reserved1;                  /* 0Ch */\n    U32                     DeviceSettings;             /* 10h */\n    U16                     NumberOfDevices;            /* 14h */\n    U8                      ExpanderSpinup;             /* 16h */\n    U8                      Reserved2;                  /* 17h */\n    U16                     IOTimeoutBlockDevicesNonRM; /* 18h */\n    U16                     IOTimeoutSequential;        /* 1Ah */\n    U16                     IOTimeoutOther;             /* 1Ch */\n    U16                     IOTimeoutBlockDevicesRM;    /* 1Eh */\n} CONFIG_PAGE_BIOS_1, MPI_POINTER PTR_CONFIG_PAGE_BIOS_1,\n  BIOSPage1_t, MPI_POINTER pBIOSPage1_t;\n\n#define MPI_BIOSPAGE1_PAGEVERSION                       (0x03)\n\n/* values for the BiosOptions field */\n#define MPI_BIOSPAGE1_OPTIONS_SPI_ENABLE                (0x00000400)\n#define MPI_BIOSPAGE1_OPTIONS_FC_ENABLE                 (0x00000200)\n#define MPI_BIOSPAGE1_OPTIONS_SAS_ENABLE                (0x00000100)\n#define MPI_BIOSPAGE1_OPTIONS_DISABLE_BIOS              (0x00000001)\n\n/* values for the IOCSettings field */\n#define MPI_BIOSPAGE1_IOCSET_MASK_INITIAL_SPINUP_DELAY  (0x0F000000)\n#define MPI_BIOSPAGE1_IOCSET_SHIFT_INITIAL_SPINUP_DELAY (24)\n\n#define MPI_BIOSPAGE1_IOCSET_MASK_PORT_ENABLE_DELAY     (0x00F00000)\n#define MPI_BIOSPAGE1_IOCSET_SHIFT_PORT_ENABLE_DELAY    (20)\n\n#define MPI_BIOSPAGE1_IOCSET_AUTO_PORT_ENABLE           (0x00080000)\n#define MPI_BIOSPAGE1_IOCSET_DIRECT_ATTACH_SPINUP_MODE  (0x00040000)\n\n#define MPI_BIOSPAGE1_IOCSET_MASK_BOOT_PREFERENCE       (0x00030000)\n#define MPI_BIOSPAGE1_IOCSET_ENCLOSURE_SLOT_BOOT        (0x00000000)\n#define MPI_BIOSPAGE1_IOCSET_SAS_ADDRESS_BOOT           (0x00010000)\n\n#define MPI_BIOSPAGE1_IOCSET_MASK_MAX_TARGET_SPIN_UP    (0x0000F000)\n#define MPI_BIOSPAGE1_IOCSET_SHIFT_MAX_TARGET_SPIN_UP   (12)\n\n#define MPI_BIOSPAGE1_IOCSET_MASK_SPINUP_DELAY          (0x00000F00)\n#define MPI_BIOSPAGE1_IOCSET_SHIFT_SPINUP_DELAY         (8)\n\n#define MPI_BIOSPAGE1_IOCSET_MASK_RM_SETTING            (0x000000C0)\n#define MPI_BIOSPAGE1_IOCSET_NONE_RM_SETTING            (0x00000000)\n#define MPI_BIOSPAGE1_IOCSET_BOOT_RM_SETTING            (0x00000040)\n#define MPI_BIOSPAGE1_IOCSET_MEDIA_RM_SETTING           (0x00000080)\n\n#define MPI_BIOSPAGE1_IOCSET_MASK_ADAPTER_SUPPORT       (0x00000030)\n#define MPI_BIOSPAGE1_IOCSET_NO_SUPPORT                 (0x00000000)\n#define MPI_BIOSPAGE1_IOCSET_BIOS_SUPPORT               (0x00000010)\n#define MPI_BIOSPAGE1_IOCSET_OS_SUPPORT                 (0x00000020)\n#define MPI_BIOSPAGE1_IOCSET_ALL_SUPPORT                (0x00000030)\n\n#define MPI_BIOSPAGE1_IOCSET_ALTERNATE_CHS              (0x00000008)\n\n/* values for the DeviceSettings field */\n#define MPI_BIOSPAGE1_DEVSET_DISABLE_SMART_POLLING      (0x00000010)\n#define MPI_BIOSPAGE1_DEVSET_DISABLE_SEQ_LUN            (0x00000008)\n#define MPI_BIOSPAGE1_DEVSET_DISABLE_RM_LUN             (0x00000004)\n#define MPI_BIOSPAGE1_DEVSET_DISABLE_NON_RM_LUN         (0x00000002)\n#define MPI_BIOSPAGE1_DEVSET_DISABLE_OTHER_LUN          (0x00000001)\n\n/* defines for the ExpanderSpinup field */\n#define MPI_BIOSPAGE1_EXPSPINUP_MASK_MAX_TARGET         (0xF0)\n#define MPI_BIOSPAGE1_EXPSPINUP_SHIFT_MAX_TARGET        (4)\n#define MPI_BIOSPAGE1_EXPSPINUP_MASK_DELAY              (0x0F)\n\ntypedef struct _MPI_BOOT_DEVICE_ADAPTER_ORDER\n{\n    U32         Reserved1;                              /* 00h */\n    U32         Reserved2;                              /* 04h */\n    U32         Reserved3;                              /* 08h */\n    U32         Reserved4;                              /* 0Ch */\n    U32         Reserved5;                              /* 10h */\n    U32         Reserved6;                              /* 14h */\n    U32         Reserved7;                              /* 18h */\n    U32         Reserved8;                              /* 1Ch */\n    U32         Reserved9;                              /* 20h */\n    U32         Reserved10;                             /* 24h */\n    U32         Reserved11;                             /* 28h */\n    U32         Reserved12;                             /* 2Ch */\n    U32         Reserved13;                             /* 30h */\n    U32         Reserved14;                             /* 34h */\n    U32         Reserved15;                             /* 38h */\n    U32         Reserved16;                             /* 3Ch */\n    U32         Reserved17;                             /* 40h */\n} MPI_BOOT_DEVICE_ADAPTER_ORDER, MPI_POINTER PTR_MPI_BOOT_DEVICE_ADAPTER_ORDER;\n\ntypedef struct _MPI_BOOT_DEVICE_ADAPTER_NUMBER\n{\n    U8          TargetID;                               /* 00h */\n    U8          Bus;                                    /* 01h */\n    U8          AdapterNumber;                          /* 02h */\n    U8          Reserved1;                              /* 03h */\n    U32         Reserved2;                              /* 04h */\n    U32         Reserved3;                              /* 08h */\n    U32         Reserved4;                              /* 0Ch */\n    U8          LUN[8];                                 /* 10h */\n    U32         Reserved5;                              /* 18h */\n    U32         Reserved6;                              /* 1Ch */\n    U32         Reserved7;                              /* 20h */\n    U32         Reserved8;                              /* 24h */\n    U32         Reserved9;                              /* 28h */\n    U32         Reserved10;                             /* 2Ch */\n    U32         Reserved11;                             /* 30h */\n    U32         Reserved12;                             /* 34h */\n    U32         Reserved13;                             /* 38h */\n    U32         Reserved14;                             /* 3Ch */\n    U32         Reserved15;                             /* 40h */\n} MPI_BOOT_DEVICE_ADAPTER_NUMBER, MPI_POINTER PTR_MPI_BOOT_DEVICE_ADAPTER_NUMBER;\n\ntypedef struct _MPI_BOOT_DEVICE_PCI_ADDRESS\n{\n    U8          TargetID;                               /* 00h */\n    U8          Bus;                                    /* 01h */\n    U16         PCIAddress;                             /* 02h */\n    U32         Reserved1;                              /* 04h */\n    U32         Reserved2;                              /* 08h */\n    U32         Reserved3;                              /* 0Ch */\n    U8          LUN[8];                                 /* 10h */\n    U32         Reserved4;                              /* 18h */\n    U32         Reserved5;                              /* 1Ch */\n    U32         Reserved6;                              /* 20h */\n    U32         Reserved7;                              /* 24h */\n    U32         Reserved8;                              /* 28h */\n    U32         Reserved9;                              /* 2Ch */\n    U32         Reserved10;                             /* 30h */\n    U32         Reserved11;                             /* 34h */\n    U32         Reserved12;                             /* 38h */\n    U32         Reserved13;                             /* 3Ch */\n    U32         Reserved14;                             /* 40h */\n} MPI_BOOT_DEVICE_PCI_ADDRESS, MPI_POINTER PTR_MPI_BOOT_DEVICE_PCI_ADDRESS;\n\ntypedef struct _MPI_BOOT_DEVICE_SLOT_NUMBER\n{\n    U8          TargetID;                               /* 00h */\n    U8          Bus;                                    /* 01h */\n    U8          PCISlotNumber;                          /* 02h */\n    U8          Reserved1;                              /* 03h */\n    U32         Reserved2;                              /* 04h */\n    U32         Reserved3;                              /* 08h */\n    U32         Reserved4;                              /* 0Ch */\n    U8          LUN[8];                                 /* 10h */\n    U32         Reserved5;                              /* 18h */\n    U32         Reserved6;                              /* 1Ch */\n    U32         Reserved7;                              /* 20h */\n    U32         Reserved8;                              /* 24h */\n    U32         Reserved9;                              /* 28h */\n    U32         Reserved10;                             /* 2Ch */\n    U32         Reserved11;                             /* 30h */\n    U32         Reserved12;                             /* 34h */\n    U32         Reserved13;                             /* 38h */\n    U32         Reserved14;                             /* 3Ch */\n    U32         Reserved15;                             /* 40h */\n} MPI_BOOT_DEVICE_PCI_SLOT_NUMBER, MPI_POINTER PTR_MPI_BOOT_DEVICE_PCI_SLOT_NUMBER;\n\ntypedef struct _MPI_BOOT_DEVICE_FC_WWN\n{\n    U64         WWPN;                                   /* 00h */\n    U32         Reserved1;                              /* 08h */\n    U32         Reserved2;                              /* 0Ch */\n    U8          LUN[8];                                 /* 10h */\n    U32         Reserved3;                              /* 18h */\n    U32         Reserved4;                              /* 1Ch */\n    U32         Reserved5;                              /* 20h */\n    U32         Reserved6;                              /* 24h */\n    U32         Reserved7;                              /* 28h */\n    U32         Reserved8;                              /* 2Ch */\n    U32         Reserved9;                              /* 30h */\n    U32         Reserved10;                             /* 34h */\n    U32         Reserved11;                             /* 38h */\n    U32         Reserved12;                             /* 3Ch */\n    U32         Reserved13;                             /* 40h */\n} MPI_BOOT_DEVICE_FC_WWN, MPI_POINTER PTR_MPI_BOOT_DEVICE_FC_WWN;\n\ntypedef struct _MPI_BOOT_DEVICE_SAS_WWN\n{\n    U64         SASAddress;                             /* 00h */\n    U32         Reserved1;                              /* 08h */\n    U32         Reserved2;                              /* 0Ch */\n    U8          LUN[8];                                 /* 10h */\n    U32         Reserved3;                              /* 18h */\n    U32         Reserved4;                              /* 1Ch */\n    U32         Reserved5;                              /* 20h */\n    U32         Reserved6;                              /* 24h */\n    U32         Reserved7;                              /* 28h */\n    U32         Reserved8;                              /* 2Ch */\n    U32         Reserved9;                              /* 30h */\n    U32         Reserved10;                             /* 34h */\n    U32         Reserved11;                             /* 38h */\n    U32         Reserved12;                             /* 3Ch */\n    U32         Reserved13;                             /* 40h */\n} MPI_BOOT_DEVICE_SAS_WWN, MPI_POINTER PTR_MPI_BOOT_DEVICE_SAS_WWN;\n\ntypedef struct _MPI_BOOT_DEVICE_ENCLOSURE_SLOT\n{\n    U64         EnclosureLogicalID;                     /* 00h */\n    U32         Reserved1;                              /* 08h */\n    U32         Reserved2;                              /* 0Ch */\n    U8          LUN[8];                                 /* 10h */\n    U16         SlotNumber;                             /* 18h */\n    U16         Reserved3;                              /* 1Ah */\n    U32         Reserved4;                              /* 1Ch */\n    U32         Reserved5;                              /* 20h */\n    U32         Reserved6;                              /* 24h */\n    U32         Reserved7;                              /* 28h */\n    U32         Reserved8;                              /* 2Ch */\n    U32         Reserved9;                              /* 30h */\n    U32         Reserved10;                             /* 34h */\n    U32         Reserved11;                             /* 38h */\n    U32         Reserved12;                             /* 3Ch */\n    U32         Reserved13;                             /* 40h */\n} MPI_BOOT_DEVICE_ENCLOSURE_SLOT,\n  MPI_POINTER PTR_MPI_BOOT_DEVICE_ENCLOSURE_SLOT;\n\ntypedef union _MPI_BIOSPAGE2_BOOT_DEVICE\n{\n    MPI_BOOT_DEVICE_ADAPTER_ORDER   AdapterOrder;\n    MPI_BOOT_DEVICE_ADAPTER_NUMBER  AdapterNumber;\n    MPI_BOOT_DEVICE_PCI_ADDRESS     PCIAddress;\n    MPI_BOOT_DEVICE_PCI_SLOT_NUMBER PCISlotNumber;\n    MPI_BOOT_DEVICE_FC_WWN          FcWwn;\n    MPI_BOOT_DEVICE_SAS_WWN         SasWwn;\n    MPI_BOOT_DEVICE_ENCLOSURE_SLOT  EnclosureSlot;\n} MPI_BIOSPAGE2_BOOT_DEVICE, MPI_POINTER PTR_MPI_BIOSPAGE2_BOOT_DEVICE;\n\ntypedef struct _CONFIG_PAGE_BIOS_2\n{\n    CONFIG_PAGE_HEADER          Header;                 /* 00h */\n    U32                         Reserved1;              /* 04h */\n    U32                         Reserved2;              /* 08h */\n    U32                         Reserved3;              /* 0Ch */\n    U32                         Reserved4;              /* 10h */\n    U32                         Reserved5;              /* 14h */\n    U32                         Reserved6;              /* 18h */\n    U8                          BootDeviceForm;         /* 1Ch */\n    U8                          PrevBootDeviceForm;     /* 1Ch */\n    U16                         Reserved8;              /* 1Eh */\n    MPI_BIOSPAGE2_BOOT_DEVICE   BootDevice;             /* 20h */\n} CONFIG_PAGE_BIOS_2, MPI_POINTER PTR_CONFIG_PAGE_BIOS_2,\n  BIOSPage2_t, MPI_POINTER pBIOSPage2_t;\n\n#define MPI_BIOSPAGE2_PAGEVERSION                       (0x02)\n\n#define MPI_BIOSPAGE2_FORM_MASK                         (0x0F)\n#define MPI_BIOSPAGE2_FORM_ADAPTER_ORDER                (0x00)\n#define MPI_BIOSPAGE2_FORM_ADAPTER_NUMBER               (0x01)\n#define MPI_BIOSPAGE2_FORM_PCI_ADDRESS                  (0x02)\n#define MPI_BIOSPAGE2_FORM_PCI_SLOT_NUMBER              (0x03)\n#define MPI_BIOSPAGE2_FORM_FC_WWN                       (0x04)\n#define MPI_BIOSPAGE2_FORM_SAS_WWN                      (0x05)\n#define MPI_BIOSPAGE2_FORM_ENCLOSURE_SLOT               (0x06)\n\n\n/****************************************************************************\n*   SCSI Port Config Pages\n****************************************************************************/\n\ntypedef struct _CONFIG_PAGE_SCSI_PORT_0\n{\n    CONFIG_PAGE_HEADER      Header;                     /* 00h */\n    U32                     Capabilities;               /* 04h */\n    U32                     PhysicalInterface;          /* 08h */\n} CONFIG_PAGE_SCSI_PORT_0, MPI_POINTER PTR_CONFIG_PAGE_SCSI_PORT_0,\n  SCSIPortPage0_t, MPI_POINTER pSCSIPortPage0_t;\n\n#define MPI_SCSIPORTPAGE0_PAGEVERSION                   (0x02)\n\n#define MPI_SCSIPORTPAGE0_CAP_IU                        (0x00000001)\n#define MPI_SCSIPORTPAGE0_CAP_DT                        (0x00000002)\n#define MPI_SCSIPORTPAGE0_CAP_QAS                       (0x00000004)\n#define MPI_SCSIPORTPAGE0_CAP_MIN_SYNC_PERIOD_MASK      (0x0000FF00)\n#define MPI_SCSIPORTPAGE0_SYNC_ASYNC                    (0x00)\n#define MPI_SCSIPORTPAGE0_SYNC_5                        (0x32)\n#define MPI_SCSIPORTPAGE0_SYNC_10                       (0x19)\n#define MPI_SCSIPORTPAGE0_SYNC_20                       (0x0C)\n#define MPI_SCSIPORTPAGE0_SYNC_33_33                    (0x0B)\n#define MPI_SCSIPORTPAGE0_SYNC_40                       (0x0A)\n#define MPI_SCSIPORTPAGE0_SYNC_80                       (0x09)\n#define MPI_SCSIPORTPAGE0_SYNC_160                      (0x08)\n#define MPI_SCSIPORTPAGE0_SYNC_UNKNOWN                  (0xFF)\n\n#define MPI_SCSIPORTPAGE0_CAP_SHIFT_MIN_SYNC_PERIOD     (8)\n#define MPI_SCSIPORTPAGE0_CAP_GET_MIN_SYNC_PERIOD(Cap)      \\\n    (  ((Cap) & MPI_SCSIPORTPAGE0_CAP_MIN_SYNC_PERIOD_MASK) \\\n    >> MPI_SCSIPORTPAGE0_CAP_SHIFT_MIN_SYNC_PERIOD          \\\n    )\n#define MPI_SCSIPORTPAGE0_CAP_MAX_SYNC_OFFSET_MASK      (0x00FF0000)\n#define MPI_SCSIPORTPAGE0_CAP_SHIFT_MAX_SYNC_OFFSET     (16)\n#define MPI_SCSIPORTPAGE0_CAP_GET_MAX_SYNC_OFFSET(Cap)      \\\n    (  ((Cap) & MPI_SCSIPORTPAGE0_CAP_MAX_SYNC_OFFSET_MASK) \\\n    >> MPI_SCSIPORTPAGE0_CAP_SHIFT_MAX_SYNC_OFFSET          \\\n    )\n#define MPI_SCSIPORTPAGE0_CAP_IDP                       (0x08000000)\n#define MPI_SCSIPORTPAGE0_CAP_WIDE                      (0x20000000)\n#define MPI_SCSIPORTPAGE0_CAP_AIP                       (0x80000000)\n\n#define MPI_SCSIPORTPAGE0_PHY_SIGNAL_TYPE_MASK          (0x00000003)\n#define MPI_SCSIPORTPAGE0_PHY_SIGNAL_HVD                (0x01)\n#define MPI_SCSIPORTPAGE0_PHY_SIGNAL_SE                 (0x02)\n#define MPI_SCSIPORTPAGE0_PHY_SIGNAL_LVD                (0x03)\n#define MPI_SCSIPORTPAGE0_PHY_MASK_CONNECTED_ID         (0xFF000000)\n#define MPI_SCSIPORTPAGE0_PHY_SHIFT_CONNECTED_ID        (24)\n#define MPI_SCSIPORTPAGE0_PHY_BUS_FREE_CONNECTED_ID     (0xFE)\n#define MPI_SCSIPORTPAGE0_PHY_UNKNOWN_CONNECTED_ID      (0xFF)\n\n\ntypedef struct _CONFIG_PAGE_SCSI_PORT_1\n{\n    CONFIG_PAGE_HEADER      Header;                     /* 00h */\n    U32                     Configuration;              /* 04h */\n    U32                     OnBusTimerValue;            /* 08h */\n    U8                      TargetConfig;               /* 0Ch */\n    U8                      Reserved1;                  /* 0Dh */\n    U16                     IDConfig;                   /* 0Eh */\n} CONFIG_PAGE_SCSI_PORT_1, MPI_POINTER PTR_CONFIG_PAGE_SCSI_PORT_1,\n  SCSIPortPage1_t, MPI_POINTER pSCSIPortPage1_t;\n\n#define MPI_SCSIPORTPAGE1_PAGEVERSION                   (0x03)\n\n/* Configuration values */\n#define MPI_SCSIPORTPAGE1_CFG_PORT_SCSI_ID_MASK         (0x000000FF)\n#define MPI_SCSIPORTPAGE1_CFG_PORT_RESPONSE_ID_MASK     (0xFFFF0000)\n#define MPI_SCSIPORTPAGE1_CFG_SHIFT_PORT_RESPONSE_ID    (16)\n\n/* TargetConfig values */\n#define MPI_SCSIPORTPAGE1_TARGCONFIG_TARG_ONLY        (0x01)\n#define MPI_SCSIPORTPAGE1_TARGCONFIG_INIT_TARG        (0x02)\n\n\ntypedef struct _MPI_DEVICE_INFO\n{\n    U8      Timeout;                                    /* 00h */\n    U8      SyncFactor;                                 /* 01h */\n    U16     DeviceFlags;                                /* 02h */\n} MPI_DEVICE_INFO, MPI_POINTER PTR_MPI_DEVICE_INFO,\n  MpiDeviceInfo_t, MPI_POINTER pMpiDeviceInfo_t;\n\ntypedef struct _CONFIG_PAGE_SCSI_PORT_2\n{\n    CONFIG_PAGE_HEADER  Header;                         /* 00h */\n    U32                 PortFlags;                      /* 04h */\n    U32                 PortSettings;                   /* 08h */\n    MPI_DEVICE_INFO     DeviceSettings[16];             /* 0Ch */\n} CONFIG_PAGE_SCSI_PORT_2, MPI_POINTER PTR_CONFIG_PAGE_SCSI_PORT_2,\n  SCSIPortPage2_t, MPI_POINTER pSCSIPortPage2_t;\n\n#define MPI_SCSIPORTPAGE2_PAGEVERSION                       (0x02)\n\n/* PortFlags values */\n#define MPI_SCSIPORTPAGE2_PORT_FLAGS_SCAN_HIGH_TO_LOW       (0x00000001)\n#define MPI_SCSIPORTPAGE2_PORT_FLAGS_AVOID_SCSI_RESET       (0x00000004)\n#define MPI_SCSIPORTPAGE2_PORT_FLAGS_ALTERNATE_CHS          (0x00000008)\n#define MPI_SCSIPORTPAGE2_PORT_FLAGS_TERMINATION_DISABLE    (0x00000010)\n\n#define MPI_SCSIPORTPAGE2_PORT_FLAGS_DV_MASK                (0x00000060)\n#define MPI_SCSIPORTPAGE2_PORT_FLAGS_FULL_DV                (0x00000000)\n#define MPI_SCSIPORTPAGE2_PORT_FLAGS_BASIC_DV_ONLY          (0x00000020)\n#define MPI_SCSIPORTPAGE2_PORT_FLAGS_OFF_DV                 (0x00000060)\n\n\n/* PortSettings values */\n#define MPI_SCSIPORTPAGE2_PORT_HOST_ID_MASK                 (0x0000000F)\n#define MPI_SCSIPORTPAGE2_PORT_MASK_INIT_HBA                (0x00000030)\n#define MPI_SCSIPORTPAGE2_PORT_DISABLE_INIT_HBA             (0x00000000)\n#define MPI_SCSIPORTPAGE2_PORT_BIOS_INIT_HBA                (0x00000010)\n#define MPI_SCSIPORTPAGE2_PORT_OS_INIT_HBA                  (0x00000020)\n#define MPI_SCSIPORTPAGE2_PORT_BIOS_OS_INIT_HBA             (0x00000030)\n#define MPI_SCSIPORTPAGE2_PORT_REMOVABLE_MEDIA              (0x000000C0)\n#define MPI_SCSIPORTPAGE2_PORT_RM_NONE                      (0x00000000)\n#define MPI_SCSIPORTPAGE2_PORT_RM_BOOT_ONLY                 (0x00000040)\n#define MPI_SCSIPORTPAGE2_PORT_RM_WITH_MEDIA                (0x00000080)\n#define MPI_SCSIPORTPAGE2_PORT_SPINUP_DELAY_MASK            (0x00000F00)\n#define MPI_SCSIPORTPAGE2_PORT_SHIFT_SPINUP_DELAY           (8)\n#define MPI_SCSIPORTPAGE2_PORT_MASK_NEGO_MASTER_SETTINGS    (0x00003000)\n#define MPI_SCSIPORTPAGE2_PORT_NEGO_MASTER_SETTINGS         (0x00000000)\n#define MPI_SCSIPORTPAGE2_PORT_NONE_MASTER_SETTINGS         (0x00001000)\n#define MPI_SCSIPORTPAGE2_PORT_ALL_MASTER_SETTINGS          (0x00003000)\n\n#define MPI_SCSIPORTPAGE2_DEVICE_DISCONNECT_ENABLE          (0x0001)\n#define MPI_SCSIPORTPAGE2_DEVICE_ID_SCAN_ENABLE             (0x0002)\n#define MPI_SCSIPORTPAGE2_DEVICE_LUN_SCAN_ENABLE            (0x0004)\n#define MPI_SCSIPORTPAGE2_DEVICE_TAG_QUEUE_ENABLE           (0x0008)\n#define MPI_SCSIPORTPAGE2_DEVICE_WIDE_DISABLE               (0x0010)\n#define MPI_SCSIPORTPAGE2_DEVICE_BOOT_CHOICE                (0x0020)\n\n\n/****************************************************************************\n*   SCSI Target Device Config Pages\n****************************************************************************/\n\ntypedef struct _CONFIG_PAGE_SCSI_DEVICE_0\n{\n    CONFIG_PAGE_HEADER      Header;                     /* 00h */\n    U32                     NegotiatedParameters;       /* 04h */\n    U32                     Information;                /* 08h */\n} CONFIG_PAGE_SCSI_DEVICE_0, MPI_POINTER PTR_CONFIG_PAGE_SCSI_DEVICE_0,\n  SCSIDevicePage0_t, MPI_POINTER pSCSIDevicePage0_t;\n\n#define MPI_SCSIDEVPAGE0_PAGEVERSION                    (0x04)\n\n#define MPI_SCSIDEVPAGE0_NP_IU                          (0x00000001)\n#define MPI_SCSIDEVPAGE0_NP_DT                          (0x00000002)\n#define MPI_SCSIDEVPAGE0_NP_QAS                         (0x00000004)\n#define MPI_SCSIDEVPAGE0_NP_HOLD_MCS                    (0x00000008)\n#define MPI_SCSIDEVPAGE0_NP_WR_FLOW                     (0x00000010)\n#define MPI_SCSIDEVPAGE0_NP_RD_STRM                     (0x00000020)\n#define MPI_SCSIDEVPAGE0_NP_RTI                         (0x00000040)\n#define MPI_SCSIDEVPAGE0_NP_PCOMP_EN                    (0x00000080)\n#define MPI_SCSIDEVPAGE0_NP_NEG_SYNC_PERIOD_MASK        (0x0000FF00)\n#define MPI_SCSIDEVPAGE0_NP_SHIFT_SYNC_PERIOD           (8)\n#define MPI_SCSIDEVPAGE0_NP_NEG_SYNC_OFFSET_MASK        (0x00FF0000)\n#define MPI_SCSIDEVPAGE0_NP_SHIFT_SYNC_OFFSET           (16)\n#define MPI_SCSIDEVPAGE0_NP_IDP                         (0x08000000)\n#define MPI_SCSIDEVPAGE0_NP_WIDE                        (0x20000000)\n#define MPI_SCSIDEVPAGE0_NP_AIP                         (0x80000000)\n\n#define MPI_SCSIDEVPAGE0_INFO_PARAMS_NEGOTIATED         (0x00000001)\n#define MPI_SCSIDEVPAGE0_INFO_SDTR_REJECTED             (0x00000002)\n#define MPI_SCSIDEVPAGE0_INFO_WDTR_REJECTED             (0x00000004)\n#define MPI_SCSIDEVPAGE0_INFO_PPR_REJECTED              (0x00000008)\n\n\ntypedef struct _CONFIG_PAGE_SCSI_DEVICE_1\n{\n    CONFIG_PAGE_HEADER      Header;                     /* 00h */\n    U32                     RequestedParameters;        /* 04h */\n    U32                     Reserved;                   /* 08h */\n    U32                     Configuration;              /* 0Ch */\n} CONFIG_PAGE_SCSI_DEVICE_1, MPI_POINTER PTR_CONFIG_PAGE_SCSI_DEVICE_1,\n  SCSIDevicePage1_t, MPI_POINTER pSCSIDevicePage1_t;\n\n#define MPI_SCSIDEVPAGE1_PAGEVERSION                    (0x05)\n\n#define MPI_SCSIDEVPAGE1_RP_IU                          (0x00000001)\n#define MPI_SCSIDEVPAGE1_RP_DT                          (0x00000002)\n#define MPI_SCSIDEVPAGE1_RP_QAS                         (0x00000004)\n#define MPI_SCSIDEVPAGE1_RP_HOLD_MCS                    (0x00000008)\n#define MPI_SCSIDEVPAGE1_RP_WR_FLOW                     (0x00000010)\n#define MPI_SCSIDEVPAGE1_RP_RD_STRM                     (0x00000020)\n#define MPI_SCSIDEVPAGE1_RP_RTI                         (0x00000040)\n#define MPI_SCSIDEVPAGE1_RP_PCOMP_EN                    (0x00000080)\n#define MPI_SCSIDEVPAGE1_RP_MIN_SYNC_PERIOD_MASK        (0x0000FF00)\n#define MPI_SCSIDEVPAGE1_RP_SHIFT_MIN_SYNC_PERIOD       (8)\n#define MPI_SCSIDEVPAGE1_RP_MAX_SYNC_OFFSET_MASK        (0x00FF0000)\n#define MPI_SCSIDEVPAGE1_RP_SHIFT_MAX_SYNC_OFFSET       (16)\n#define MPI_SCSIDEVPAGE1_RP_IDP                         (0x08000000)\n#define MPI_SCSIDEVPAGE1_RP_WIDE                        (0x20000000)\n#define MPI_SCSIDEVPAGE1_RP_AIP                         (0x80000000)\n\n#define MPI_SCSIDEVPAGE1_CONF_WDTR_DISALLOWED           (0x00000002)\n#define MPI_SCSIDEVPAGE1_CONF_SDTR_DISALLOWED           (0x00000004)\n#define MPI_SCSIDEVPAGE1_CONF_EXTENDED_PARAMS_ENABLE    (0x00000008)\n#define MPI_SCSIDEVPAGE1_CONF_FORCE_PPR_MSG             (0x00000010)\n\n\ntypedef struct _CONFIG_PAGE_SCSI_DEVICE_2\n{\n    CONFIG_PAGE_HEADER      Header;                     /* 00h */\n    U32                     DomainValidation;           /* 04h */\n    U32                     ParityPipeSelect;           /* 08h */\n    U32                     DataPipeSelect;             /* 0Ch */\n} CONFIG_PAGE_SCSI_DEVICE_2, MPI_POINTER PTR_CONFIG_PAGE_SCSI_DEVICE_2,\n  SCSIDevicePage2_t, MPI_POINTER pSCSIDevicePage2_t;\n\n#define MPI_SCSIDEVPAGE2_PAGEVERSION                    (0x01)\n\n#define MPI_SCSIDEVPAGE2_DV_ISI_ENABLE                  (0x00000010)\n#define MPI_SCSIDEVPAGE2_DV_SECONDARY_DRIVER_ENABLE     (0x00000020)\n#define MPI_SCSIDEVPAGE2_DV_SLEW_RATE_CTRL              (0x00000380)\n#define MPI_SCSIDEVPAGE2_DV_PRIM_DRIVE_STR_CTRL         (0x00001C00)\n#define MPI_SCSIDEVPAGE2_DV_SECOND_DRIVE_STR_CTRL       (0x0000E000)\n#define MPI_SCSIDEVPAGE2_DV_XCLKH_ST                    (0x10000000)\n#define MPI_SCSIDEVPAGE2_DV_XCLKS_ST                    (0x20000000)\n#define MPI_SCSIDEVPAGE2_DV_XCLKH_DT                    (0x40000000)\n#define MPI_SCSIDEVPAGE2_DV_XCLKS_DT                    (0x80000000)\n\n#define MPI_SCSIDEVPAGE2_PPS_PPS_MASK                   (0x00000003)\n\n#define MPI_SCSIDEVPAGE2_DPS_BIT_0_PL_SELECT_MASK       (0x00000003)\n#define MPI_SCSIDEVPAGE2_DPS_BIT_1_PL_SELECT_MASK       (0x0000000C)\n#define MPI_SCSIDEVPAGE2_DPS_BIT_2_PL_SELECT_MASK       (0x00000030)\n#define MPI_SCSIDEVPAGE2_DPS_BIT_3_PL_SELECT_MASK       (0x000000C0)\n#define MPI_SCSIDEVPAGE2_DPS_BIT_4_PL_SELECT_MASK       (0x00000300)\n#define MPI_SCSIDEVPAGE2_DPS_BIT_5_PL_SELECT_MASK       (0x00000C00)\n#define MPI_SCSIDEVPAGE2_DPS_BIT_6_PL_SELECT_MASK       (0x00003000)\n#define MPI_SCSIDEVPAGE2_DPS_BIT_7_PL_SELECT_MASK       (0x0000C000)\n#define MPI_SCSIDEVPAGE2_DPS_BIT_8_PL_SELECT_MASK       (0x00030000)\n#define MPI_SCSIDEVPAGE2_DPS_BIT_9_PL_SELECT_MASK       (0x000C0000)\n#define MPI_SCSIDEVPAGE2_DPS_BIT_10_PL_SELECT_MASK      (0x00300000)\n#define MPI_SCSIDEVPAGE2_DPS_BIT_11_PL_SELECT_MASK      (0x00C00000)\n#define MPI_SCSIDEVPAGE2_DPS_BIT_12_PL_SELECT_MASK      (0x03000000)\n#define MPI_SCSIDEVPAGE2_DPS_BIT_13_PL_SELECT_MASK      (0x0C000000)\n#define MPI_SCSIDEVPAGE2_DPS_BIT_14_PL_SELECT_MASK      (0x30000000)\n#define MPI_SCSIDEVPAGE2_DPS_BIT_15_PL_SELECT_MASK      (0xC0000000)\n\n\ntypedef struct _CONFIG_PAGE_SCSI_DEVICE_3\n{\n    CONFIG_PAGE_HEADER      Header;                     /* 00h */\n    U16                     MsgRejectCount;             /* 04h */\n    U16                     PhaseErrorCount;            /* 06h */\n    U16                     ParityErrorCount;           /* 08h */\n    U16                     Reserved;                   /* 0Ah */\n} CONFIG_PAGE_SCSI_DEVICE_3, MPI_POINTER PTR_CONFIG_PAGE_SCSI_DEVICE_3,\n  SCSIDevicePage3_t, MPI_POINTER pSCSIDevicePage3_t;\n\n#define MPI_SCSIDEVPAGE3_PAGEVERSION                    (0x00)\n\n#define MPI_SCSIDEVPAGE3_MAX_COUNTER                    (0xFFFE)\n#define MPI_SCSIDEVPAGE3_UNSUPPORTED_COUNTER            (0xFFFF)\n\n\n/****************************************************************************\n*   FC Port Config Pages\n****************************************************************************/\n\ntypedef struct _CONFIG_PAGE_FC_PORT_0\n{\n    CONFIG_PAGE_HEADER      Header;                     /* 00h */\n    U32                     Flags;                      /* 04h */\n    U8                      MPIPortNumber;              /* 08h */\n    U8                      LinkType;                   /* 09h */\n    U8                      PortState;                  /* 0Ah */\n    U8                      Reserved;                   /* 0Bh */\n    U32                     PortIdentifier;             /* 0Ch */\n    U64                     WWNN;                       /* 10h */\n    U64                     WWPN;                       /* 18h */\n    U32                     SupportedServiceClass;      /* 20h */\n    U32                     SupportedSpeeds;            /* 24h */\n    U32                     CurrentSpeed;               /* 28h */\n    U32                     MaxFrameSize;               /* 2Ch */\n    U64                     FabricWWNN;                 /* 30h */\n    U64                     FabricWWPN;                 /* 38h */\n    U32                     DiscoveredPortsCount;       /* 40h */\n    U32                     MaxInitiators;              /* 44h */\n    U8                      MaxAliasesSupported;        /* 48h */\n    U8                      MaxHardAliasesSupported;    /* 49h */\n    U8                      NumCurrentAliases;          /* 4Ah */\n    U8                      Reserved1;                  /* 4Bh */\n} CONFIG_PAGE_FC_PORT_0, MPI_POINTER PTR_CONFIG_PAGE_FC_PORT_0,\n  FCPortPage0_t, MPI_POINTER pFCPortPage0_t;\n\n#define MPI_FCPORTPAGE0_PAGEVERSION                     (0x02)\n\n#define MPI_FCPORTPAGE0_FLAGS_PROT_MASK                 (0x0000000F)\n#define MPI_FCPORTPAGE0_FLAGS_PROT_FCP_INIT             (MPI_PORTFACTS_PROTOCOL_INITIATOR)\n#define MPI_FCPORTPAGE0_FLAGS_PROT_FCP_TARG             (MPI_PORTFACTS_PROTOCOL_TARGET)\n#define MPI_FCPORTPAGE0_FLAGS_PROT_LAN                  (MPI_PORTFACTS_PROTOCOL_LAN)\n#define MPI_FCPORTPAGE0_FLAGS_PROT_LOGBUSADDR           (MPI_PORTFACTS_PROTOCOL_LOGBUSADDR)\n\n#define MPI_FCPORTPAGE0_FLAGS_ALIAS_ALPA_SUPPORTED      (0x00000010)\n#define MPI_FCPORTPAGE0_FLAGS_ALIAS_WWN_SUPPORTED       (0x00000020)\n#define MPI_FCPORTPAGE0_FLAGS_FABRIC_WWN_VALID          (0x00000040)\n\n#define MPI_FCPORTPAGE0_FLAGS_ATTACH_TYPE_MASK          (0x00000F00)\n#define MPI_FCPORTPAGE0_FLAGS_ATTACH_NO_INIT            (0x00000000)\n#define MPI_FCPORTPAGE0_FLAGS_ATTACH_POINT_TO_POINT     (0x00000100)\n#define MPI_FCPORTPAGE0_FLAGS_ATTACH_PRIVATE_LOOP       (0x00000200)\n#define MPI_FCPORTPAGE0_FLAGS_ATTACH_FABRIC_DIRECT      (0x00000400)\n#define MPI_FCPORTPAGE0_FLAGS_ATTACH_PUBLIC_LOOP        (0x00000800)\n\n#define MPI_FCPORTPAGE0_LTYPE_RESERVED                  (0x00)\n#define MPI_FCPORTPAGE0_LTYPE_OTHER                     (0x01)\n#define MPI_FCPORTPAGE0_LTYPE_UNKNOWN                   (0x02)\n#define MPI_FCPORTPAGE0_LTYPE_COPPER                    (0x03)\n#define MPI_FCPORTPAGE0_LTYPE_SINGLE_1300               (0x04)\n#define MPI_FCPORTPAGE0_LTYPE_SINGLE_1500               (0x05)\n#define MPI_FCPORTPAGE0_LTYPE_50_LASER_MULTI            (0x06)\n#define MPI_FCPORTPAGE0_LTYPE_50_LED_MULTI              (0x07)\n#define MPI_FCPORTPAGE0_LTYPE_62_LASER_MULTI            (0x08)\n#define MPI_FCPORTPAGE0_LTYPE_62_LED_MULTI              (0x09)\n#define MPI_FCPORTPAGE0_LTYPE_MULTI_LONG_WAVE           (0x0A)\n#define MPI_FCPORTPAGE0_LTYPE_MULTI_SHORT_WAVE          (0x0B)\n#define MPI_FCPORTPAGE0_LTYPE_LASER_SHORT_WAVE          (0x0C)\n#define MPI_FCPORTPAGE0_LTYPE_LED_SHORT_WAVE            (0x0D)\n#define MPI_FCPORTPAGE0_LTYPE_1300_LONG_WAVE            (0x0E)\n#define MPI_FCPORTPAGE0_LTYPE_1500_LONG_WAVE            (0x0F)\n\n#define MPI_FCPORTPAGE0_PORTSTATE_UNKNOWN               (0x01)      /*(SNIA)HBA_PORTSTATE_UNKNOWN       1 Unknown */\n#define MPI_FCPORTPAGE0_PORTSTATE_ONLINE                (0x02)      /*(SNIA)HBA_PORTSTATE_ONLINE        2 Operational */\n#define MPI_FCPORTPAGE0_PORTSTATE_OFFLINE               (0x03)      /*(SNIA)HBA_PORTSTATE_OFFLINE       3 User Offline */\n#define MPI_FCPORTPAGE0_PORTSTATE_BYPASSED              (0x04)      /*(SNIA)HBA_PORTSTATE_BYPASSED      4 Bypassed */\n#define MPI_FCPORTPAGE0_PORTSTATE_DIAGNOST              (0x05)      /*(SNIA)HBA_PORTSTATE_DIAGNOSTICS   5 In diagnostics mode */\n#define MPI_FCPORTPAGE0_PORTSTATE_LINKDOWN              (0x06)      /*(SNIA)HBA_PORTSTATE_LINKDOWN      6 Link Down */\n#define MPI_FCPORTPAGE0_PORTSTATE_ERROR                 (0x07)      /*(SNIA)HBA_PORTSTATE_ERROR         7 Port Error */\n#define MPI_FCPORTPAGE0_PORTSTATE_LOOPBACK              (0x08)      /*(SNIA)HBA_PORTSTATE_LOOPBACK      8 Loopback */\n\n#define MPI_FCPORTPAGE0_SUPPORT_CLASS_1                 (0x00000001)\n#define MPI_FCPORTPAGE0_SUPPORT_CLASS_2                 (0x00000002)\n#define MPI_FCPORTPAGE0_SUPPORT_CLASS_3                 (0x00000004)\n\n#define MPI_FCPORTPAGE0_SUPPORT_SPEED_UKNOWN            (0x00000000) /* (SNIA)HBA_PORTSPEED_UNKNOWN 0   Unknown - transceiver incapable of reporting */\n#define MPI_FCPORTPAGE0_SUPPORT_1GBIT_SPEED             (0x00000001) /* (SNIA)HBA_PORTSPEED_1GBIT   1   1 GBit/sec */\n#define MPI_FCPORTPAGE0_SUPPORT_2GBIT_SPEED             (0x00000002) /* (SNIA)HBA_PORTSPEED_2GBIT   2   2 GBit/sec */\n#define MPI_FCPORTPAGE0_SUPPORT_10GBIT_SPEED            (0x00000004) /* (SNIA)HBA_PORTSPEED_10GBIT  4  10 GBit/sec */\n#define MPI_FCPORTPAGE0_SUPPORT_4GBIT_SPEED             (0x00000008) /* (SNIA)HBA_PORTSPEED_4GBIT   8   4 GBit/sec */\n\n#define MPI_FCPORTPAGE0_CURRENT_SPEED_UKNOWN            MPI_FCPORTPAGE0_SUPPORT_SPEED_UKNOWN\n#define MPI_FCPORTPAGE0_CURRENT_SPEED_1GBIT             MPI_FCPORTPAGE0_SUPPORT_1GBIT_SPEED\n#define MPI_FCPORTPAGE0_CURRENT_SPEED_2GBIT             MPI_FCPORTPAGE0_SUPPORT_2GBIT_SPEED\n#define MPI_FCPORTPAGE0_CURRENT_SPEED_10GBIT            MPI_FCPORTPAGE0_SUPPORT_10GBIT_SPEED\n#define MPI_FCPORTPAGE0_CURRENT_SPEED_4GBIT             MPI_FCPORTPAGE0_SUPPORT_4GBIT_SPEED\n#define MPI_FCPORTPAGE0_CURRENT_SPEED_NOT_NEGOTIATED    (0x00008000)        /* (SNIA)HBA_PORTSPEED_NOT_NEGOTIATED (1<<15) Speed not established */\n\n\ntypedef struct _CONFIG_PAGE_FC_PORT_1\n{\n    CONFIG_PAGE_HEADER      Header;                     /* 00h */\n    U32                     Flags;                      /* 04h */\n    U64                     NoSEEPROMWWNN;              /* 08h */\n    U64                     NoSEEPROMWWPN;              /* 10h */\n    U8                      HardALPA;                   /* 18h */\n    U8                      LinkConfig;                 /* 19h */\n    U8                      TopologyConfig;             /* 1Ah */\n    U8                      AltConnector;               /* 1Bh */\n    U8                      NumRequestedAliases;        /* 1Ch */\n    U8                      RR_TOV;                     /* 1Dh */\n    U8                      InitiatorDeviceTimeout;     /* 1Eh */\n    U8                      InitiatorIoPendTimeout;     /* 1Fh */\n} CONFIG_PAGE_FC_PORT_1, MPI_POINTER PTR_CONFIG_PAGE_FC_PORT_1,\n  FCPortPage1_t, MPI_POINTER pFCPortPage1_t;\n\n#define MPI_FCPORTPAGE1_PAGEVERSION                     (0x06)\n\n#define MPI_FCPORTPAGE1_FLAGS_EXT_FCP_STATUS_EN         (0x08000000)\n#define MPI_FCPORTPAGE1_FLAGS_IMMEDIATE_ERROR_REPLY     (0x04000000)\n#define MPI_FCPORTPAGE1_FLAGS_FORCE_USE_NOSEEPROM_WWNS  (0x02000000)\n#define MPI_FCPORTPAGE1_FLAGS_VERBOSE_RESCAN_EVENTS     (0x01000000)\n#define MPI_FCPORTPAGE1_FLAGS_TARGET_MODE_OXID          (0x00800000)\n#define MPI_FCPORTPAGE1_FLAGS_PORT_OFFLINE              (0x00400000)\n#define MPI_FCPORTPAGE1_FLAGS_SOFT_ALPA_FALLBACK        (0x00200000)\n#define MPI_FCPORTPAGE1_FLAGS_TARGET_LARGE_CDB_ENABLE   (0x00000080)\n#define MPI_FCPORTPAGE1_FLAGS_MASK_RR_TOV_UNITS         (0x00000070)\n#define MPI_FCPORTPAGE1_FLAGS_SUPPRESS_PROT_REG         (0x00000008)\n#define MPI_FCPORTPAGE1_FLAGS_PLOGI_ON_LOGO             (0x00000004)\n#define MPI_FCPORTPAGE1_FLAGS_MAINTAIN_LOGINS           (0x00000002)\n#define MPI_FCPORTPAGE1_FLAGS_SORT_BY_DID               (0x00000001)\n#define MPI_FCPORTPAGE1_FLAGS_SORT_BY_WWN               (0x00000000)\n\n#define MPI_FCPORTPAGE1_FLAGS_PROT_MASK                 (0xF0000000)\n#define MPI_FCPORTPAGE1_FLAGS_PROT_SHIFT                (28)\n#define MPI_FCPORTPAGE1_FLAGS_PROT_FCP_INIT             ((U32)MPI_PORTFACTS_PROTOCOL_INITIATOR << MPI_FCPORTPAGE1_FLAGS_PROT_SHIFT)\n#define MPI_FCPORTPAGE1_FLAGS_PROT_FCP_TARG             ((U32)MPI_PORTFACTS_PROTOCOL_TARGET << MPI_FCPORTPAGE1_FLAGS_PROT_SHIFT)\n#define MPI_FCPORTPAGE1_FLAGS_PROT_LAN                  ((U32)MPI_PORTFACTS_PROTOCOL_LAN << MPI_FCPORTPAGE1_FLAGS_PROT_SHIFT)\n#define MPI_FCPORTPAGE1_FLAGS_PROT_LOGBUSADDR           ((U32)MPI_PORTFACTS_PROTOCOL_LOGBUSADDR << MPI_FCPORTPAGE1_FLAGS_PROT_SHIFT)\n\n#define MPI_FCPORTPAGE1_FLAGS_NONE_RR_TOV_UNITS         (0x00000000)\n#define MPI_FCPORTPAGE1_FLAGS_THOUSANDTH_RR_TOV_UNITS   (0x00000010)\n#define MPI_FCPORTPAGE1_FLAGS_TENTH_RR_TOV_UNITS        (0x00000030)\n#define MPI_FCPORTPAGE1_FLAGS_TEN_RR_TOV_UNITS          (0x00000050)\n\n#define MPI_FCPORTPAGE1_HARD_ALPA_NOT_USED              (0xFF)\n\n#define MPI_FCPORTPAGE1_LCONFIG_SPEED_MASK              (0x0F)\n#define MPI_FCPORTPAGE1_LCONFIG_SPEED_1GIG              (0x00)\n#define MPI_FCPORTPAGE1_LCONFIG_SPEED_2GIG              (0x01)\n#define MPI_FCPORTPAGE1_LCONFIG_SPEED_4GIG              (0x02)\n#define MPI_FCPORTPAGE1_LCONFIG_SPEED_10GIG             (0x03)\n#define MPI_FCPORTPAGE1_LCONFIG_SPEED_AUTO              (0x0F)\n\n#define MPI_FCPORTPAGE1_TOPOLOGY_MASK                   (0x0F)\n#define MPI_FCPORTPAGE1_TOPOLOGY_NLPORT                 (0x01)\n#define MPI_FCPORTPAGE1_TOPOLOGY_NPORT                  (0x02)\n#define MPI_FCPORTPAGE1_TOPOLOGY_AUTO                   (0x0F)\n\n#define MPI_FCPORTPAGE1_ALT_CONN_UNKNOWN                (0x00)\n\n#define MPI_FCPORTPAGE1_INITIATOR_DEV_TIMEOUT_MASK      (0x7F)\n#define MPI_FCPORTPAGE1_INITIATOR_DEV_UNIT_16           (0x80)\n\n\ntypedef struct _CONFIG_PAGE_FC_PORT_2\n{\n    CONFIG_PAGE_HEADER      Header;                     /* 00h */\n    U8                      NumberActive;               /* 04h */\n    U8                      ALPA[127];                  /* 05h */\n} CONFIG_PAGE_FC_PORT_2, MPI_POINTER PTR_CONFIG_PAGE_FC_PORT_2,\n  FCPortPage2_t, MPI_POINTER pFCPortPage2_t;\n\n#define MPI_FCPORTPAGE2_PAGEVERSION                     (0x01)\n\n\ntypedef struct _WWN_FORMAT\n{\n    U64                     WWNN;                       /* 00h */\n    U64                     WWPN;                       /* 08h */\n} WWN_FORMAT, MPI_POINTER PTR_WWN_FORMAT,\n  WWNFormat, MPI_POINTER pWWNFormat;\n\ntypedef union _FC_PORT_PERSISTENT_PHYSICAL_ID\n{\n    WWN_FORMAT              WWN;\n    U32                     Did;\n} FC_PORT_PERSISTENT_PHYSICAL_ID, MPI_POINTER PTR_FC_PORT_PERSISTENT_PHYSICAL_ID,\n  PersistentPhysicalId_t, MPI_POINTER pPersistentPhysicalId_t;\n\ntypedef struct _FC_PORT_PERSISTENT\n{\n    FC_PORT_PERSISTENT_PHYSICAL_ID  PhysicalIdentifier; /* 00h */\n    U8                              TargetID;           /* 10h */\n    U8                              Bus;                /* 11h */\n    U16                             Flags;              /* 12h */\n} FC_PORT_PERSISTENT, MPI_POINTER PTR_FC_PORT_PERSISTENT,\n  PersistentData_t, MPI_POINTER pPersistentData_t;\n\n#define MPI_PERSISTENT_FLAGS_SHIFT                      (16)\n#define MPI_PERSISTENT_FLAGS_ENTRY_VALID                (0x0001)\n#define MPI_PERSISTENT_FLAGS_SCAN_ID                    (0x0002)\n#define MPI_PERSISTENT_FLAGS_SCAN_LUNS                  (0x0004)\n#define MPI_PERSISTENT_FLAGS_BOOT_DEVICE                (0x0008)\n#define MPI_PERSISTENT_FLAGS_BY_DID                     (0x0080)\n\n/*\n * Host code (drivers, BIOS, utilities, etc.) should leave this define set to\n * one and check Header.PageLength at runtime.\n */\n#ifndef MPI_FC_PORT_PAGE_3_ENTRY_MAX\n#define MPI_FC_PORT_PAGE_3_ENTRY_MAX        (1)\n#endif\n\ntypedef struct _CONFIG_PAGE_FC_PORT_3\n{\n    CONFIG_PAGE_HEADER      Header;                                 /* 00h */\n    FC_PORT_PERSISTENT      Entry[MPI_FC_PORT_PAGE_3_ENTRY_MAX];    /* 04h */\n} CONFIG_PAGE_FC_PORT_3, MPI_POINTER PTR_CONFIG_PAGE_FC_PORT_3,\n  FCPortPage3_t, MPI_POINTER pFCPortPage3_t;\n\n#define MPI_FCPORTPAGE3_PAGEVERSION                     (0x01)\n\n\ntypedef struct _CONFIG_PAGE_FC_PORT_4\n{\n    CONFIG_PAGE_HEADER      Header;                     /* 00h */\n    U32                     PortFlags;                  /* 04h */\n    U32                     PortSettings;               /* 08h */\n} CONFIG_PAGE_FC_PORT_4, MPI_POINTER PTR_CONFIG_PAGE_FC_PORT_4,\n  FCPortPage4_t, MPI_POINTER pFCPortPage4_t;\n\n#define MPI_FCPORTPAGE4_PAGEVERSION                     (0x00)\n\n#define MPI_FCPORTPAGE4_PORT_FLAGS_ALTERNATE_CHS        (0x00000008)\n\n#define MPI_FCPORTPAGE4_PORT_MASK_INIT_HBA              (0x00000030)\n#define MPI_FCPORTPAGE4_PORT_DISABLE_INIT_HBA           (0x00000000)\n#define MPI_FCPORTPAGE4_PORT_BIOS_INIT_HBA              (0x00000010)\n#define MPI_FCPORTPAGE4_PORT_OS_INIT_HBA                (0x00000020)\n#define MPI_FCPORTPAGE4_PORT_BIOS_OS_INIT_HBA           (0x00000030)\n#define MPI_FCPORTPAGE4_PORT_REMOVABLE_MEDIA            (0x000000C0)\n#define MPI_FCPORTPAGE4_PORT_SPINUP_DELAY_MASK          (0x00000F00)\n\n\ntypedef struct _CONFIG_PAGE_FC_PORT_5_ALIAS_INFO\n{\n    U8      Flags;                                      /* 00h */\n    U8      AliasAlpa;                                  /* 01h */\n    U16     Reserved;                                   /* 02h */\n    U64     AliasWWNN;                                  /* 04h */\n    U64     AliasWWPN;                                  /* 0Ch */\n} CONFIG_PAGE_FC_PORT_5_ALIAS_INFO,\n  MPI_POINTER PTR_CONFIG_PAGE_FC_PORT_5_ALIAS_INFO,\n  FcPortPage5AliasInfo_t, MPI_POINTER pFcPortPage5AliasInfo_t;\n\ntypedef struct _CONFIG_PAGE_FC_PORT_5\n{\n    CONFIG_PAGE_HEADER                  Header;         /* 00h */\n    CONFIG_PAGE_FC_PORT_5_ALIAS_INFO    AliasInfo;      /* 04h */\n} CONFIG_PAGE_FC_PORT_5, MPI_POINTER PTR_CONFIG_PAGE_FC_PORT_5,\n  FCPortPage5_t, MPI_POINTER pFCPortPage5_t;\n\n#define MPI_FCPORTPAGE5_PAGEVERSION                     (0x02)\n\n#define MPI_FCPORTPAGE5_FLAGS_ALPA_ACQUIRED             (0x01)\n#define MPI_FCPORTPAGE5_FLAGS_HARD_ALPA                 (0x02)\n#define MPI_FCPORTPAGE5_FLAGS_HARD_WWNN                 (0x04)\n#define MPI_FCPORTPAGE5_FLAGS_HARD_WWPN                 (0x08)\n#define MPI_FCPORTPAGE5_FLAGS_DISABLE                   (0x10)\n\ntypedef struct _CONFIG_PAGE_FC_PORT_6\n{\n    CONFIG_PAGE_HEADER      Header;                     /* 00h */\n    U32                     Reserved;                   /* 04h */\n    U64                     TimeSinceReset;             /* 08h */\n    U64                     TxFrames;                   /* 10h */\n    U64                     RxFrames;                   /* 18h */\n    U64                     TxWords;                    /* 20h */\n    U64                     RxWords;                    /* 28h */\n    U64                     LipCount;                   /* 30h */\n    U64                     NosCount;                   /* 38h */\n    U64                     ErrorFrames;                /* 40h */\n    U64                     DumpedFrames;               /* 48h */\n    U64                     LinkFailureCount;           /* 50h */\n    U64                     LossOfSyncCount;            /* 58h */\n    U64                     LossOfSignalCount;          /* 60h */\n    U64                     PrimativeSeqErrCount;       /* 68h */\n    U64                     InvalidTxWordCount;         /* 70h */\n    U64                     InvalidCrcCount;            /* 78h */\n    U64                     FcpInitiatorIoCount;        /* 80h */\n} CONFIG_PAGE_FC_PORT_6, MPI_POINTER PTR_CONFIG_PAGE_FC_PORT_6,\n  FCPortPage6_t, MPI_POINTER pFCPortPage6_t;\n\n#define MPI_FCPORTPAGE6_PAGEVERSION                     (0x00)\n\n\ntypedef struct _CONFIG_PAGE_FC_PORT_7\n{\n    CONFIG_PAGE_HEADER      Header;                     /* 00h */\n    U32                     Reserved;                   /* 04h */\n    U8                      PortSymbolicName[256];      /* 08h */\n} CONFIG_PAGE_FC_PORT_7, MPI_POINTER PTR_CONFIG_PAGE_FC_PORT_7,\n  FCPortPage7_t, MPI_POINTER pFCPortPage7_t;\n\n#define MPI_FCPORTPAGE7_PAGEVERSION                     (0x00)\n\n\ntypedef struct _CONFIG_PAGE_FC_PORT_8\n{\n    CONFIG_PAGE_HEADER      Header;                     /* 00h */\n    U32                     BitVector[8];               /* 04h */\n} CONFIG_PAGE_FC_PORT_8, MPI_POINTER PTR_CONFIG_PAGE_FC_PORT_8,\n  FCPortPage8_t, MPI_POINTER pFCPortPage8_t;\n\n#define MPI_FCPORTPAGE8_PAGEVERSION                     (0x00)\n\n\ntypedef struct _CONFIG_PAGE_FC_PORT_9\n{\n    CONFIG_PAGE_HEADER      Header;                     /* 00h */\n    U32                     Reserved;                   /* 04h */\n    U64                     GlobalWWPN;                 /* 08h */\n    U64                     GlobalWWNN;                 /* 10h */\n    U32                     UnitType;                   /* 18h */\n    U32                     PhysicalPortNumber;         /* 1Ch */\n    U32                     NumAttachedNodes;           /* 20h */\n    U16                     IPVersion;                  /* 24h */\n    U16                     UDPPortNumber;              /* 26h */\n    U8                      IPAddress[16];              /* 28h */\n    U16                     Reserved1;                  /* 38h */\n    U16                     TopologyDiscoveryFlags;     /* 3Ah */\n} CONFIG_PAGE_FC_PORT_9, MPI_POINTER PTR_CONFIG_PAGE_FC_PORT_9,\n  FCPortPage9_t, MPI_POINTER pFCPortPage9_t;\n\n#define MPI_FCPORTPAGE9_PAGEVERSION                     (0x00)\n\n\ntypedef struct _CONFIG_PAGE_FC_PORT_10_BASE_SFP_DATA\n{\n    U8                      Id;                         /* 10h */\n    U8                      ExtId;                      /* 11h */\n    U8                      Connector;                  /* 12h */\n    U8                      Transceiver[8];             /* 13h */\n    U8                      Encoding;                   /* 1Bh */\n    U8                      BitRate_100mbs;             /* 1Ch */\n    U8                      Reserved1;                  /* 1Dh */\n    U8                      Length9u_km;                /* 1Eh */\n    U8                      Length9u_100m;              /* 1Fh */\n    U8                      Length50u_10m;              /* 20h */\n    U8                      Length62p5u_10m;            /* 21h */\n    U8                      LengthCopper_m;             /* 22h */\n    U8                      Reseverved2;                /* 22h */\n    U8                      VendorName[16];             /* 24h */\n    U8                      Reserved3;                  /* 34h */\n    U8                      VendorOUI[3];               /* 35h */\n    U8                      VendorPN[16];               /* 38h */\n    U8                      VendorRev[4];               /* 48h */\n    U16                     Wavelength;                 /* 4Ch */\n    U8                      Reserved4;                  /* 4Eh */\n    U8                      CC_BASE;                    /* 4Fh */\n} CONFIG_PAGE_FC_PORT_10_BASE_SFP_DATA,\n  MPI_POINTER PTR_CONFIG_PAGE_FC_PORT_10_BASE_SFP_DATA,\n  FCPortPage10BaseSfpData_t, MPI_POINTER pFCPortPage10BaseSfpData_t;\n\n#define MPI_FCPORT10_BASE_ID_UNKNOWN        (0x00)\n#define MPI_FCPORT10_BASE_ID_GBIC           (0x01)\n#define MPI_FCPORT10_BASE_ID_FIXED          (0x02)\n#define MPI_FCPORT10_BASE_ID_SFP            (0x03)\n#define MPI_FCPORT10_BASE_ID_SFP_MIN        (0x04)\n#define MPI_FCPORT10_BASE_ID_SFP_MAX        (0x7F)\n#define MPI_FCPORT10_BASE_ID_VEND_SPEC_MASK (0x80)\n\n#define MPI_FCPORT10_BASE_EXTID_UNKNOWN     (0x00)\n#define MPI_FCPORT10_BASE_EXTID_MODDEF1     (0x01)\n#define MPI_FCPORT10_BASE_EXTID_MODDEF2     (0x02)\n#define MPI_FCPORT10_BASE_EXTID_MODDEF3     (0x03)\n#define MPI_FCPORT10_BASE_EXTID_SEEPROM     (0x04)\n#define MPI_FCPORT10_BASE_EXTID_MODDEF5     (0x05)\n#define MPI_FCPORT10_BASE_EXTID_MODDEF6     (0x06)\n#define MPI_FCPORT10_BASE_EXTID_MODDEF7     (0x07)\n#define MPI_FCPORT10_BASE_EXTID_VNDSPC_MASK (0x80)\n\n#define MPI_FCPORT10_BASE_CONN_UNKNOWN      (0x00)\n#define MPI_FCPORT10_BASE_CONN_SC           (0x01)\n#define MPI_FCPORT10_BASE_CONN_COPPER1      (0x02)\n#define MPI_FCPORT10_BASE_CONN_COPPER2      (0x03)\n#define MPI_FCPORT10_BASE_CONN_BNC_TNC      (0x04)\n#define MPI_FCPORT10_BASE_CONN_COAXIAL      (0x05)\n#define MPI_FCPORT10_BASE_CONN_FIBERJACK    (0x06)\n#define MPI_FCPORT10_BASE_CONN_LC           (0x07)\n#define MPI_FCPORT10_BASE_CONN_MT_RJ        (0x08)\n#define MPI_FCPORT10_BASE_CONN_MU           (0x09)\n#define MPI_FCPORT10_BASE_CONN_SG           (0x0A)\n#define MPI_FCPORT10_BASE_CONN_OPT_PIGT     (0x0B)\n#define MPI_FCPORT10_BASE_CONN_RSV1_MIN     (0x0C)\n#define MPI_FCPORT10_BASE_CONN_RSV1_MAX     (0x1F)\n#define MPI_FCPORT10_BASE_CONN_HSSDC_II     (0x20)\n#define MPI_FCPORT10_BASE_CONN_CPR_PIGT     (0x21)\n#define MPI_FCPORT10_BASE_CONN_RSV2_MIN     (0x22)\n#define MPI_FCPORT10_BASE_CONN_RSV2_MAX     (0x7F)\n#define MPI_FCPORT10_BASE_CONN_VNDSPC_MASK  (0x80)\n\n#define MPI_FCPORT10_BASE_ENCODE_UNSPEC     (0x00)\n#define MPI_FCPORT10_BASE_ENCODE_8B10B      (0x01)\n#define MPI_FCPORT10_BASE_ENCODE_4B5B       (0x02)\n#define MPI_FCPORT10_BASE_ENCODE_NRZ        (0x03)\n#define MPI_FCPORT10_BASE_ENCODE_MANCHESTER (0x04)\n\n\ntypedef struct _CONFIG_PAGE_FC_PORT_10_EXTENDED_SFP_DATA\n{\n    U8                      Options[2];                 /* 50h */\n    U8                      BitRateMax;                 /* 52h */\n    U8                      BitRateMin;                 /* 53h */\n    U8                      VendorSN[16];               /* 54h */\n    U8                      DateCode[8];                /* 64h */\n    U8                      DiagMonitoringType;         /* 6Ch */\n    U8                      EnhancedOptions;            /* 6Dh */\n    U8                      SFF8472Compliance;          /* 6Eh */\n    U8                      CC_EXT;                     /* 6Fh */\n} CONFIG_PAGE_FC_PORT_10_EXTENDED_SFP_DATA,\n  MPI_POINTER PTR_CONFIG_PAGE_FC_PORT_10_EXTENDED_SFP_DATA,\n  FCPortPage10ExtendedSfpData_t, MPI_POINTER pFCPortPage10ExtendedSfpData_t;\n\n#define MPI_FCPORT10_EXT_OPTION1_RATESEL    (0x20)\n#define MPI_FCPORT10_EXT_OPTION1_TX_DISABLE (0x10)\n#define MPI_FCPORT10_EXT_OPTION1_TX_FAULT   (0x08)\n#define MPI_FCPORT10_EXT_OPTION1_LOS_INVERT (0x04)\n#define MPI_FCPORT10_EXT_OPTION1_LOS        (0x02)\n\n\ntypedef struct _CONFIG_PAGE_FC_PORT_10\n{\n    CONFIG_PAGE_HEADER                          Header;             /* 00h */\n    U8                                          Flags;              /* 04h */\n    U8                                          Reserved1;          /* 05h */\n    U16                                         Reserved2;          /* 06h */\n    U32                                         HwConfig1;          /* 08h */\n    U32                                         HwConfig2;          /* 0Ch */\n    CONFIG_PAGE_FC_PORT_10_BASE_SFP_DATA        Base;               /* 10h */\n    CONFIG_PAGE_FC_PORT_10_EXTENDED_SFP_DATA    Extended;           /* 50h */\n    U8                                          VendorSpecific[32]; /* 70h */\n} CONFIG_PAGE_FC_PORT_10, MPI_POINTER PTR_CONFIG_PAGE_FC_PORT_10,\n  FCPortPage10_t, MPI_POINTER pFCPortPage10_t;\n\n#define MPI_FCPORTPAGE10_PAGEVERSION                    (0x01)\n\n/* standard MODDEF pin definitions (from GBIC spec.) */\n#define MPI_FCPORTPAGE10_FLAGS_MODDEF_MASK              (0x00000007)\n#define MPI_FCPORTPAGE10_FLAGS_MODDEF2                  (0x00000001)\n#define MPI_FCPORTPAGE10_FLAGS_MODDEF1                  (0x00000002)\n#define MPI_FCPORTPAGE10_FLAGS_MODDEF0                  (0x00000004)\n#define MPI_FCPORTPAGE10_FLAGS_MODDEF_NOGBIC            (0x00000007)\n#define MPI_FCPORTPAGE10_FLAGS_MODDEF_CPR_IEEE_CX       (0x00000006)\n#define MPI_FCPORTPAGE10_FLAGS_MODDEF_COPPER            (0x00000005)\n#define MPI_FCPORTPAGE10_FLAGS_MODDEF_OPTICAL_LW        (0x00000004)\n#define MPI_FCPORTPAGE10_FLAGS_MODDEF_SEEPROM           (0x00000003)\n#define MPI_FCPORTPAGE10_FLAGS_MODDEF_SW_OPTICAL        (0x00000002)\n#define MPI_FCPORTPAGE10_FLAGS_MODDEF_LX_IEEE_OPT_LW    (0x00000001)\n#define MPI_FCPORTPAGE10_FLAGS_MODDEF_SX_IEEE_OPT_SW    (0x00000000)\n\n#define MPI_FCPORTPAGE10_FLAGS_CC_BASE_OK               (0x00000010)\n#define MPI_FCPORTPAGE10_FLAGS_CC_EXT_OK                (0x00000020)\n\n\n/****************************************************************************\n*   FC Device Config Pages\n****************************************************************************/\n\ntypedef struct _CONFIG_PAGE_FC_DEVICE_0\n{\n    CONFIG_PAGE_HEADER      Header;                     /* 00h */\n    U64                     WWNN;                       /* 04h */\n    U64                     WWPN;                       /* 0Ch */\n    U32                     PortIdentifier;             /* 14h */\n    U8                      Protocol;                   /* 18h */\n    U8                      Flags;                      /* 19h */\n    U16                     BBCredit;                   /* 1Ah */\n    U16                     MaxRxFrameSize;             /* 1Ch */\n    U8                      ADISCHardALPA;              /* 1Eh */\n    U8                      PortNumber;                 /* 1Fh */\n    U8                      FcPhLowestVersion;          /* 20h */\n    U8                      FcPhHighestVersion;         /* 21h */\n    U8                      CurrentTargetID;            /* 22h */\n    U8                      CurrentBus;                 /* 23h */\n} CONFIG_PAGE_FC_DEVICE_0, MPI_POINTER PTR_CONFIG_PAGE_FC_DEVICE_0,\n  FCDevicePage0_t, MPI_POINTER pFCDevicePage0_t;\n\n#define MPI_FC_DEVICE_PAGE0_PAGEVERSION                 (0x03)\n\n#define MPI_FC_DEVICE_PAGE0_FLAGS_TARGETID_BUS_VALID    (0x01)\n#define MPI_FC_DEVICE_PAGE0_FLAGS_PLOGI_INVALID         (0x02)\n#define MPI_FC_DEVICE_PAGE0_FLAGS_PRLI_INVALID          (0x04)\n\n#define MPI_FC_DEVICE_PAGE0_PROT_IP                     (0x01)\n#define MPI_FC_DEVICE_PAGE0_PROT_FCP_TARGET             (0x02)\n#define MPI_FC_DEVICE_PAGE0_PROT_FCP_INITIATOR          (0x04)\n#define MPI_FC_DEVICE_PAGE0_PROT_FCP_RETRY              (0x08)\n\n#define MPI_FC_DEVICE_PAGE0_PGAD_PORT_MASK      (MPI_FC_DEVICE_PGAD_PORT_MASK)\n#define MPI_FC_DEVICE_PAGE0_PGAD_FORM_MASK      (MPI_FC_DEVICE_PGAD_FORM_MASK)\n#define MPI_FC_DEVICE_PAGE0_PGAD_FORM_NEXT_DID  (MPI_FC_DEVICE_PGAD_FORM_NEXT_DID)\n#define MPI_FC_DEVICE_PAGE0_PGAD_FORM_BUS_TID   (MPI_FC_DEVICE_PGAD_FORM_BUS_TID)\n#define MPI_FC_DEVICE_PAGE0_PGAD_DID_MASK       (MPI_FC_DEVICE_PGAD_ND_DID_MASK)\n#define MPI_FC_DEVICE_PAGE0_PGAD_BUS_MASK       (MPI_FC_DEVICE_PGAD_BT_BUS_MASK)\n#define MPI_FC_DEVICE_PAGE0_PGAD_BUS_SHIFT      (MPI_FC_DEVICE_PGAD_BT_BUS_SHIFT)\n#define MPI_FC_DEVICE_PAGE0_PGAD_TID_MASK       (MPI_FC_DEVICE_PGAD_BT_TID_MASK)\n\n#define MPI_FC_DEVICE_PAGE0_HARD_ALPA_UNKNOWN   (0xFF)\n\n/****************************************************************************\n*   RAID Volume Config Pages\n****************************************************************************/\n\ntypedef struct _RAID_VOL0_PHYS_DISK\n{\n    U16                         Reserved;               /* 00h */\n    U8                          PhysDiskMap;            /* 02h */\n    U8                          PhysDiskNum;            /* 03h */\n} RAID_VOL0_PHYS_DISK, MPI_POINTER PTR_RAID_VOL0_PHYS_DISK,\n  RaidVol0PhysDisk_t, MPI_POINTER pRaidVol0PhysDisk_t;\n\n#define MPI_RAIDVOL0_PHYSDISK_PRIMARY                   (0x01)\n#define MPI_RAIDVOL0_PHYSDISK_SECONDARY                 (0x02)\n\ntypedef struct _RAID_VOL0_STATUS\n{\n    U8                          Flags;                  /* 00h */\n    U8                          State;                  /* 01h */\n    U16                         Reserved;               /* 02h */\n} RAID_VOL0_STATUS, MPI_POINTER PTR_RAID_VOL0_STATUS,\n  RaidVol0Status_t, MPI_POINTER pRaidVol0Status_t;\n\n/* RAID Volume Page 0 VolumeStatus defines */\n#define MPI_RAIDVOL0_STATUS_FLAG_ENABLED                (0x01)\n#define MPI_RAIDVOL0_STATUS_FLAG_QUIESCED               (0x02)\n#define MPI_RAIDVOL0_STATUS_FLAG_RESYNC_IN_PROGRESS     (0x04)\n#define MPI_RAIDVOL0_STATUS_FLAG_VOLUME_INACTIVE        (0x08)\n#define MPI_RAIDVOL0_STATUS_FLAG_BAD_BLOCK_TABLE_FULL   (0x10)\n\n#define MPI_RAIDVOL0_STATUS_STATE_OPTIMAL               (0x00)\n#define MPI_RAIDVOL0_STATUS_STATE_DEGRADED              (0x01)\n#define MPI_RAIDVOL0_STATUS_STATE_FAILED                (0x02)\n#define MPI_RAIDVOL0_STATUS_STATE_MISSING               (0x03)\n\ntypedef struct _RAID_VOL0_SETTINGS\n{\n    U16                         Settings;       /* 00h */\n    U8                          HotSparePool;   /* 01h */ /* MPI_RAID_HOT_SPARE_POOL_ */\n    U8                          Reserved;       /* 02h */\n} RAID_VOL0_SETTINGS, MPI_POINTER PTR_RAID_VOL0_SETTINGS,\n  RaidVol0Settings, MPI_POINTER pRaidVol0Settings;\n\n/* RAID Volume Page 0 VolumeSettings defines */\n#define MPI_RAIDVOL0_SETTING_WRITE_CACHING_ENABLE       (0x0001)\n#define MPI_RAIDVOL0_SETTING_OFFLINE_ON_SMART           (0x0002)\n#define MPI_RAIDVOL0_SETTING_AUTO_CONFIGURE             (0x0004)\n#define MPI_RAIDVOL0_SETTING_PRIORITY_RESYNC            (0x0008)\n#define MPI_RAIDVOL0_SETTING_FAST_DATA_SCRUBBING_0102   (0x0020) /* obsolete */\n\n#define MPI_RAIDVOL0_SETTING_MASK_METADATA_SIZE         (0x00C0)\n#define MPI_RAIDVOL0_SETTING_64MB_METADATA_SIZE         (0x0000)\n#define MPI_RAIDVOL0_SETTING_512MB_METADATA_SIZE        (0x0040)\n\n#define MPI_RAIDVOL0_SETTING_USE_PRODUCT_ID_SUFFIX      (0x0010)\n#define MPI_RAIDVOL0_SETTING_USE_DEFAULTS               (0x8000)\n\n/* RAID Volume Page 0 HotSparePool defines, also used in RAID Physical Disk */\n#define MPI_RAID_HOT_SPARE_POOL_0                       (0x01)\n#define MPI_RAID_HOT_SPARE_POOL_1                       (0x02)\n#define MPI_RAID_HOT_SPARE_POOL_2                       (0x04)\n#define MPI_RAID_HOT_SPARE_POOL_3                       (0x08)\n#define MPI_RAID_HOT_SPARE_POOL_4                       (0x10)\n#define MPI_RAID_HOT_SPARE_POOL_5                       (0x20)\n#define MPI_RAID_HOT_SPARE_POOL_6                       (0x40)\n#define MPI_RAID_HOT_SPARE_POOL_7                       (0x80)\n\n/*\n * Host code (drivers, BIOS, utilities, etc.) should leave this define set to\n * one and check Header.PageLength at runtime.\n */\n#ifndef MPI_RAID_VOL_PAGE_0_PHYSDISK_MAX\n#define MPI_RAID_VOL_PAGE_0_PHYSDISK_MAX        (1)\n#endif\n\ntypedef struct _CONFIG_PAGE_RAID_VOL_0\n{\n    CONFIG_PAGE_HEADER      Header;         /* 00h */\n    U8                      VolumeID;       /* 04h */\n    U8                      VolumeBus;      /* 05h */\n    U8                      VolumeIOC;      /* 06h */\n    U8                      VolumeType;     /* 07h */ /* MPI_RAID_VOL_TYPE_ */\n    RAID_VOL0_STATUS        VolumeStatus;   /* 08h */\n    RAID_VOL0_SETTINGS      VolumeSettings; /* 0Ch */\n    U32                     MaxLBA;         /* 10h */\n    U32                     MaxLBAHigh;     /* 14h */\n    U32                     StripeSize;     /* 18h */\n    U32                     Reserved2;      /* 1Ch */\n    U32                     Reserved3;      /* 20h */\n    U8                      NumPhysDisks;   /* 24h */\n    U8                      DataScrubRate;  /* 25h */\n    U8                      ResyncRate;     /* 26h */\n    U8                      InactiveStatus; /* 27h */\n    RAID_VOL0_PHYS_DISK     PhysDisk[MPI_RAID_VOL_PAGE_0_PHYSDISK_MAX];/* 28h */\n} CONFIG_PAGE_RAID_VOL_0, MPI_POINTER PTR_CONFIG_PAGE_RAID_VOL_0,\n  RaidVolumePage0_t, MPI_POINTER pRaidVolumePage0_t;\n\n#define MPI_RAIDVOLPAGE0_PAGEVERSION                    (0x07)\n\n/* values for RAID Volume Page 0 InactiveStatus field */\n#define MPI_RAIDVOLPAGE0_UNKNOWN_INACTIVE               (0x00)\n#define MPI_RAIDVOLPAGE0_STALE_METADATA_INACTIVE        (0x01)\n#define MPI_RAIDVOLPAGE0_FOREIGN_VOLUME_INACTIVE        (0x02)\n#define MPI_RAIDVOLPAGE0_INSUFFICIENT_RESOURCE_INACTIVE (0x03)\n#define MPI_RAIDVOLPAGE0_CLONE_VOLUME_INACTIVE          (0x04)\n#define MPI_RAIDVOLPAGE0_INSUFFICIENT_METADATA_INACTIVE (0x05)\n#define MPI_RAIDVOLPAGE0_PREVIOUSLY_DELETED             (0x06)\n\n\ntypedef struct _CONFIG_PAGE_RAID_VOL_1\n{\n    CONFIG_PAGE_HEADER      Header;         /* 00h */\n    U8                      VolumeID;       /* 04h */\n    U8                      VolumeBus;      /* 05h */\n    U8                      VolumeIOC;      /* 06h */\n    U8                      Reserved0;      /* 07h */\n    U8                      GUID[24];       /* 08h */\n    U8                      Name[32];       /* 20h */\n    U64                     WWID;           /* 40h */\n    U32                     Reserved1;      /* 48h */\n    U32                     Reserved2;      /* 4Ch */\n} CONFIG_PAGE_RAID_VOL_1, MPI_POINTER PTR_CONFIG_PAGE_RAID_VOL_1,\n  RaidVolumePage1_t, MPI_POINTER pRaidVolumePage1_t;\n\n#define MPI_RAIDVOLPAGE1_PAGEVERSION                    (0x01)\n\n\n/****************************************************************************\n*   RAID Physical Disk Config Pages\n****************************************************************************/\n\ntypedef struct _RAID_PHYS_DISK0_ERROR_DATA\n{\n    U8                      ErrorCdbByte;               /* 00h */\n    U8                      ErrorSenseKey;              /* 01h */\n    U16                     Reserved;                   /* 02h */\n    U16                     ErrorCount;                 /* 04h */\n    U8                      ErrorASC;                   /* 06h */\n    U8                      ErrorASCQ;                  /* 07h */\n    U16                     SmartCount;                 /* 08h */\n    U8                      SmartASC;                   /* 0Ah */\n    U8                      SmartASCQ;                  /* 0Bh */\n} RAID_PHYS_DISK0_ERROR_DATA, MPI_POINTER PTR_RAID_PHYS_DISK0_ERROR_DATA,\n  RaidPhysDisk0ErrorData_t, MPI_POINTER pRaidPhysDisk0ErrorData_t;\n\ntypedef struct _RAID_PHYS_DISK_INQUIRY_DATA\n{\n    U8                          VendorID[8];            /* 00h */\n    U8                          ProductID[16];          /* 08h */\n    U8                          ProductRevLevel[4];     /* 18h */\n    U8                          Info[32];               /* 1Ch */\n} RAID_PHYS_DISK0_INQUIRY_DATA, MPI_POINTER PTR_RAID_PHYS_DISK0_INQUIRY_DATA,\n  RaidPhysDisk0InquiryData, MPI_POINTER pRaidPhysDisk0InquiryData;\n\ntypedef struct _RAID_PHYS_DISK0_SETTINGS\n{\n    U8              SepID;              /* 00h */\n    U8              SepBus;             /* 01h */\n    U8              HotSparePool;       /* 02h */ /* MPI_RAID_HOT_SPARE_POOL_ */\n    U8              PhysDiskSettings;   /* 03h */\n} RAID_PHYS_DISK0_SETTINGS, MPI_POINTER PTR_RAID_PHYS_DISK0_SETTINGS,\n  RaidPhysDiskSettings_t, MPI_POINTER pRaidPhysDiskSettings_t;\n\ntypedef struct _RAID_PHYS_DISK0_STATUS\n{\n    U8                              Flags;              /* 00h */\n    U8                              State;              /* 01h */\n    U16                             Reserved;           /* 02h */\n} RAID_PHYS_DISK0_STATUS, MPI_POINTER PTR_RAID_PHYS_DISK0_STATUS,\n  RaidPhysDiskStatus_t, MPI_POINTER pRaidPhysDiskStatus_t;\n\n/* RAID Physical Disk PhysDiskStatus flags */\n\n#define MPI_PHYSDISK0_STATUS_FLAG_OUT_OF_SYNC           (0x01)\n#define MPI_PHYSDISK0_STATUS_FLAG_QUIESCED              (0x02)\n#define MPI_PHYSDISK0_STATUS_FLAG_INACTIVE_VOLUME       (0x04)\n#define MPI_PHYSDISK0_STATUS_FLAG_OPTIMAL_PREVIOUS      (0x00)\n#define MPI_PHYSDISK0_STATUS_FLAG_NOT_OPTIMAL_PREVIOUS  (0x08)\n\n#define MPI_PHYSDISK0_STATUS_ONLINE                     (0x00)\n#define MPI_PHYSDISK0_STATUS_MISSING                    (0x01)\n#define MPI_PHYSDISK0_STATUS_NOT_COMPATIBLE             (0x02)\n#define MPI_PHYSDISK0_STATUS_FAILED                     (0x03)\n#define MPI_PHYSDISK0_STATUS_INITIALIZING               (0x04)\n#define MPI_PHYSDISK0_STATUS_OFFLINE_REQUESTED          (0x05)\n#define MPI_PHYSDISK0_STATUS_FAILED_REQUESTED           (0x06)\n#define MPI_PHYSDISK0_STATUS_OTHER_OFFLINE              (0xFF)\n\ntypedef struct _CONFIG_PAGE_RAID_PHYS_DISK_0\n{\n    CONFIG_PAGE_HEADER              Header;             /* 00h */\n    U8                              PhysDiskID;         /* 04h */\n    U8                              PhysDiskBus;        /* 05h */\n    U8                              PhysDiskIOC;        /* 06h */\n    U8                              PhysDiskNum;        /* 07h */\n    RAID_PHYS_DISK0_SETTINGS        PhysDiskSettings;   /* 08h */\n    U32                             Reserved1;          /* 0Ch */\n    U8                              ExtDiskIdentifier[8]; /* 10h */\n    U8                              DiskIdentifier[16]; /* 18h */\n    RAID_PHYS_DISK0_INQUIRY_DATA    InquiryData;        /* 28h */\n    RAID_PHYS_DISK0_STATUS          PhysDiskStatus;     /* 64h */\n    U32                             MaxLBA;             /* 68h */\n    RAID_PHYS_DISK0_ERROR_DATA      ErrorData;          /* 6Ch */\n} CONFIG_PAGE_RAID_PHYS_DISK_0, MPI_POINTER PTR_CONFIG_PAGE_RAID_PHYS_DISK_0,\n  RaidPhysDiskPage0_t, MPI_POINTER pRaidPhysDiskPage0_t;\n\n#define MPI_RAIDPHYSDISKPAGE0_PAGEVERSION           (0x02)\n\n\ntypedef struct _RAID_PHYS_DISK1_PATH\n{\n    U8                              PhysDiskID;         /* 00h */\n    U8                              PhysDiskBus;        /* 01h */\n    U16                             Reserved1;          /* 02h */\n    U64                             WWID;               /* 04h */\n    U64                             OwnerWWID;          /* 0Ch */\n    U8                              OwnerIdentifier;    /* 14h */\n    U8                              Reserved2;          /* 15h */\n    U16                             Flags;              /* 16h */\n} RAID_PHYS_DISK1_PATH, MPI_POINTER PTR_RAID_PHYS_DISK1_PATH,\n  RaidPhysDisk1Path_t, MPI_POINTER pRaidPhysDisk1Path_t;\n\n/* RAID Physical Disk Page 1 Flags field defines */\n#define MPI_RAID_PHYSDISK1_FLAG_BROKEN          (0x0002)\n#define MPI_RAID_PHYSDISK1_FLAG_INVALID         (0x0001)\n\ntypedef struct _CONFIG_PAGE_RAID_PHYS_DISK_1\n{\n    CONFIG_PAGE_HEADER              Header;             /* 00h */\n    U8                              NumPhysDiskPaths;   /* 04h */\n    U8                              PhysDiskNum;        /* 05h */\n    U16                             Reserved2;          /* 06h */\n    U32                             Reserved1;          /* 08h */\n    RAID_PHYS_DISK1_PATH            Path[1];            /* 0Ch */\n} CONFIG_PAGE_RAID_PHYS_DISK_1, MPI_POINTER PTR_CONFIG_PAGE_RAID_PHYS_DISK_1,\n  RaidPhysDiskPage1_t, MPI_POINTER pRaidPhysDiskPage1_t;\n\n#define MPI_RAIDPHYSDISKPAGE1_PAGEVERSION       (0x00)\n\n\n/****************************************************************************\n*   LAN Config Pages\n****************************************************************************/\n\ntypedef struct _CONFIG_PAGE_LAN_0\n{\n    ConfigPageHeader_t      Header;                     /* 00h */\n    U16                     TxRxModes;                  /* 04h */\n    U16                     Reserved;                   /* 06h */\n    U32                     PacketPrePad;               /* 08h */\n} CONFIG_PAGE_LAN_0, MPI_POINTER PTR_CONFIG_PAGE_LAN_0,\n  LANPage0_t, MPI_POINTER pLANPage0_t;\n\n#define MPI_LAN_PAGE0_PAGEVERSION                       (0x01)\n\n#define MPI_LAN_PAGE0_RETURN_LOOPBACK                   (0x0000)\n#define MPI_LAN_PAGE0_SUPPRESS_LOOPBACK                 (0x0001)\n#define MPI_LAN_PAGE0_LOOPBACK_MASK                     (0x0001)\n\ntypedef struct _CONFIG_PAGE_LAN_1\n{\n    ConfigPageHeader_t      Header;                     /* 00h */\n    U16                     Reserved;                   /* 04h */\n    U8                      CurrentDeviceState;         /* 06h */\n    U8                      Reserved1;                  /* 07h */\n    U32                     MinPacketSize;              /* 08h */\n    U32                     MaxPacketSize;              /* 0Ch */\n    U32                     HardwareAddressLow;         /* 10h */\n    U32                     HardwareAddressHigh;        /* 14h */\n    U32                     MaxWireSpeedLow;            /* 18h */\n    U32                     MaxWireSpeedHigh;           /* 1Ch */\n    U32                     BucketsRemaining;           /* 20h */\n    U32                     MaxReplySize;               /* 24h */\n    U32                     NegWireSpeedLow;            /* 28h */\n    U32                     NegWireSpeedHigh;           /* 2Ch */\n} CONFIG_PAGE_LAN_1, MPI_POINTER PTR_CONFIG_PAGE_LAN_1,\n  LANPage1_t, MPI_POINTER pLANPage1_t;\n\n#define MPI_LAN_PAGE1_PAGEVERSION                       (0x03)\n\n#define MPI_LAN_PAGE1_DEV_STATE_RESET                   (0x00)\n#define MPI_LAN_PAGE1_DEV_STATE_OPERATIONAL             (0x01)\n\n\n/****************************************************************************\n*   Inband Config Pages\n****************************************************************************/\n\ntypedef struct _CONFIG_PAGE_INBAND_0\n{\n    CONFIG_PAGE_HEADER      Header;                     /* 00h */\n    MPI_VERSION_FORMAT      InbandVersion;              /* 04h */\n    U16                     MaximumBuffers;             /* 08h */\n    U16                     Reserved1;                  /* 0Ah */\n} CONFIG_PAGE_INBAND_0, MPI_POINTER PTR_CONFIG_PAGE_INBAND_0,\n  InbandPage0_t, MPI_POINTER pInbandPage0_t;\n\n#define MPI_INBAND_PAGEVERSION          (0x00)\n\n\n\n/****************************************************************************\n*   SAS IO Unit Config Pages\n****************************************************************************/\n\ntypedef struct _MPI_SAS_IO_UNIT0_PHY_DATA\n{\n    U8          Port;                   /* 00h */\n    U8          PortFlags;              /* 01h */\n    U8          PhyFlags;               /* 02h */\n    U8          NegotiatedLinkRate;     /* 03h */\n    U32         ControllerPhyDeviceInfo;/* 04h */\n    U16         AttachedDeviceHandle;   /* 08h */\n    U16         ControllerDevHandle;    /* 0Ah */\n    U32         DiscoveryStatus;        /* 0Ch */\n} MPI_SAS_IO_UNIT0_PHY_DATA, MPI_POINTER PTR_MPI_SAS_IO_UNIT0_PHY_DATA,\n  SasIOUnit0PhyData, MPI_POINTER pSasIOUnit0PhyData;\n\n/*\n * Host code (drivers, BIOS, utilities, etc.) should leave this define set to\n * one and check Header.PageLength at runtime.\n */\n#ifndef MPI_SAS_IOUNIT0_PHY_MAX\n#define MPI_SAS_IOUNIT0_PHY_MAX         (1)\n#endif\n\ntypedef struct _CONFIG_PAGE_SAS_IO_UNIT_0\n{\n    CONFIG_EXTENDED_PAGE_HEADER     Header;                             /* 00h */\n    U16                             NvdataVersionDefault;               /* 08h */\n    U16                             NvdataVersionPersistent;            /* 0Ah */\n    U8                              NumPhys;                            /* 0Ch */\n    U8                              Reserved2;                          /* 0Dh */\n    U16                             Reserved3;                          /* 0Eh */\n    MPI_SAS_IO_UNIT0_PHY_DATA       PhyData[MPI_SAS_IOUNIT0_PHY_MAX];   /* 10h */\n} CONFIG_PAGE_SAS_IO_UNIT_0, MPI_POINTER PTR_CONFIG_PAGE_SAS_IO_UNIT_0,\n  SasIOUnitPage0_t, MPI_POINTER pSasIOUnitPage0_t;\n\n#define MPI_SASIOUNITPAGE0_PAGEVERSION      (0x04)\n\n/* values for SAS IO Unit Page 0 PortFlags */\n#define MPI_SAS_IOUNIT0_PORT_FLAGS_DISCOVERY_IN_PROGRESS    (0x08)\n#define MPI_SAS_IOUNIT0_PORT_FLAGS_0_TARGET_IOC_NUM         (0x00)\n#define MPI_SAS_IOUNIT0_PORT_FLAGS_1_TARGET_IOC_NUM         (0x04)\n#define MPI_SAS_IOUNIT0_PORT_FLAGS_AUTO_PORT_CONFIG         (0x01)\n\n/* values for SAS IO Unit Page 0 PhyFlags */\n#define MPI_SAS_IOUNIT0_PHY_FLAGS_PHY_DISABLED              (0x04)\n#define MPI_SAS_IOUNIT0_PHY_FLAGS_TX_INVERT                 (0x02)\n#define MPI_SAS_IOUNIT0_PHY_FLAGS_RX_INVERT                 (0x01)\n\n/* values for SAS IO Unit Page 0 NegotiatedLinkRate */\n#define MPI_SAS_IOUNIT0_RATE_UNKNOWN                        (0x00)\n#define MPI_SAS_IOUNIT0_RATE_PHY_DISABLED                   (0x01)\n#define MPI_SAS_IOUNIT0_RATE_FAILED_SPEED_NEGOTIATION       (0x02)\n#define MPI_SAS_IOUNIT0_RATE_SATA_OOB_COMPLETE              (0x03)\n#define MPI_SAS_IOUNIT0_RATE_1_5                            (0x08)\n#define MPI_SAS_IOUNIT0_RATE_3_0                            (0x09)\n\n/* see mpi_sas.h for values for SAS IO Unit Page 0 ControllerPhyDeviceInfo values */\n\n/* values for SAS IO Unit Page 0 DiscoveryStatus */\n#define MPI_SAS_IOUNIT0_DS_LOOP_DETECTED                    (0x00000001)\n#define MPI_SAS_IOUNIT0_DS_UNADDRESSABLE_DEVICE             (0x00000002)\n#define MPI_SAS_IOUNIT0_DS_MULTIPLE_PORTS                   (0x00000004)\n#define MPI_SAS_IOUNIT0_DS_EXPANDER_ERR                     (0x00000008)\n#define MPI_SAS_IOUNIT0_DS_SMP_TIMEOUT                      (0x00000010)\n#define MPI_SAS_IOUNIT0_DS_OUT_ROUTE_ENTRIES                (0x00000020)\n#define MPI_SAS_IOUNIT0_DS_INDEX_NOT_EXIST                  (0x00000040)\n#define MPI_SAS_IOUNIT0_DS_SMP_FUNCTION_FAILED              (0x00000080)\n#define MPI_SAS_IOUNIT0_DS_SMP_CRC_ERROR                    (0x00000100)\n#define MPI_SAS_IOUNIT0_DS_SUBTRACTIVE_LINK                 (0x00000200)\n#define MPI_SAS_IOUNIT0_DS_TABLE_LINK                       (0x00000400)\n#define MPI_SAS_IOUNIT0_DS_UNSUPPORTED_DEVICE               (0x00000800)\n#define MPI_SAS_IOUNIT0_DS_MAX_SATA_TARGETS                 (0x00001000)\n#define MPI_SAS_IOUNIT0_DS_MULTI_PORT_DOMAIN                (0x00002000)\n\n\ntypedef struct _MPI_SAS_IO_UNIT1_PHY_DATA\n{\n    U8          Port;                       /* 00h */\n    U8          PortFlags;                  /* 01h */\n    U8          PhyFlags;                   /* 02h */\n    U8          MaxMinLinkRate;             /* 03h */\n    U32         ControllerPhyDeviceInfo;    /* 04h */\n    U16         MaxTargetPortConnectTime;   /* 08h */\n    U16         Reserved1;                  /* 0Ah */\n} MPI_SAS_IO_UNIT1_PHY_DATA, MPI_POINTER PTR_MPI_SAS_IO_UNIT1_PHY_DATA,\n  SasIOUnit1PhyData, MPI_POINTER pSasIOUnit1PhyData;\n\n/*\n * Host code (drivers, BIOS, utilities, etc.) should leave this define set to\n * one and check Header.PageLength at runtime.\n */\n#ifndef MPI_SAS_IOUNIT1_PHY_MAX\n#define MPI_SAS_IOUNIT1_PHY_MAX         (1)\n#endif\n\ntypedef struct _CONFIG_PAGE_SAS_IO_UNIT_1\n{\n    CONFIG_EXTENDED_PAGE_HEADER Header;                             /* 00h */\n    U16                         ControlFlags;                       /* 08h */\n    U16                         MaxNumSATATargets;                  /* 0Ah */\n    U16                         AdditionalControlFlags;             /* 0Ch */\n    U16                         Reserved1;                          /* 0Eh */\n    U8                          NumPhys;                            /* 10h */\n    U8                          SATAMaxQDepth;                      /* 11h */\n    U8                          ReportDeviceMissingDelay;           /* 12h */\n    U8                          IODeviceMissingDelay;               /* 13h */\n    MPI_SAS_IO_UNIT1_PHY_DATA   PhyData[MPI_SAS_IOUNIT1_PHY_MAX];   /* 14h */\n} CONFIG_PAGE_SAS_IO_UNIT_1, MPI_POINTER PTR_CONFIG_PAGE_SAS_IO_UNIT_1,\n  SasIOUnitPage1_t, MPI_POINTER pSasIOUnitPage1_t;\n\n#define MPI_SASIOUNITPAGE1_PAGEVERSION      (0x07)\n\n/* values for SAS IO Unit Page 1 ControlFlags */\n#define MPI_SAS_IOUNIT1_CONTROL_DEVICE_SELF_TEST            (0x8000)\n#define MPI_SAS_IOUNIT1_CONTROL_SATA_3_0_MAX                (0x4000)\n#define MPI_SAS_IOUNIT1_CONTROL_SATA_1_5_MAX                (0x2000)\n#define MPI_SAS_IOUNIT1_CONTROL_SATA_SW_PRESERVE            (0x1000)\n#define MPI_SAS_IOUNIT1_CONTROL_DISABLE_SAS_HASH            (0x0800)\n\n#define MPI_SAS_IOUNIT1_CONTROL_MASK_DEV_SUPPORT            (0x0600)\n#define MPI_SAS_IOUNIT1_CONTROL_SHIFT_DEV_SUPPORT           (9)\n#define MPI_SAS_IOUNIT1_CONTROL_DEV_SUPPORT_BOTH            (0x00)\n#define MPI_SAS_IOUNIT1_CONTROL_DEV_SAS_SUPPORT             (0x01)\n#define MPI_SAS_IOUNIT1_CONTROL_DEV_SATA_SUPPORT            (0x02)\n\n#define MPI_SAS_IOUNIT1_CONTROL_POSTPONE_SATA_INIT          (0x0100)\n#define MPI_SAS_IOUNIT1_CONTROL_SATA_48BIT_LBA_REQUIRED     (0x0080)\n#define MPI_SAS_IOUNIT1_CONTROL_SATA_SMART_REQUIRED         (0x0040)\n#define MPI_SAS_IOUNIT1_CONTROL_SATA_NCQ_REQUIRED           (0x0020)\n#define MPI_SAS_IOUNIT1_CONTROL_SATA_FUA_REQUIRED           (0x0010)\n#define MPI_SAS_IOUNIT1_CONTROL_PHY_ENABLE_ORDER_HIGH       (0x0008)\n#define MPI_SAS_IOUNIT1_CONTROL_SUBTRACTIVE_ILLEGAL         (0x0004)\n#define MPI_SAS_IOUNIT1_CONTROL_FIRST_LVL_DISC_ONLY         (0x0002)\n#define MPI_SAS_IOUNIT1_CONTROL_CLEAR_AFFILIATION           (0x0001)\n\n/* values for SAS IO Unit Page 1 AdditionalControlFlags */\n#define MPI_SAS_IOUNIT1_ACONTROL_MULTI_PORT_DOMAIN_ILLEGAL          (0x0080)\n#define MPI_SAS_IOUNIT1_ACONTROL_SATA_ASYNCHROUNOUS_NOTIFICATION    (0x0040)\n#define MPI_SAS_IOUNIT1_ACONTROL_HIDE_NONZERO_ATTACHED_PHY_IDENT    (0x0020)\n#define MPI_SAS_IOUNIT1_ACONTROL_PORT_ENABLE_ONLY_SATA_LINK_RESET   (0x0010)\n#define MPI_SAS_IOUNIT1_ACONTROL_OTHER_AFFILIATION_SATA_LINK_RESET  (0x0008)\n#define MPI_SAS_IOUNIT1_ACONTROL_SELF_AFFILIATION_SATA_LINK_RESET   (0x0004)\n#define MPI_SAS_IOUNIT1_ACONTROL_NO_AFFILIATION_SATA_LINK_RESET     (0x0002)\n#define MPI_SAS_IOUNIT1_ACONTROL_ALLOW_TABLE_TO_TABLE               (0x0001)\n\n/* defines for SAS IO Unit Page 1 ReportDeviceMissingDelay */\n#define MPI_SAS_IOUNIT1_REPORT_MISSING_TIMEOUT_MASK         (0x7F)\n#define MPI_SAS_IOUNIT1_REPORT_MISSING_UNIT_16              (0x80)\n\n/* values for SAS IO Unit Page 1 PortFlags */\n#define MPI_SAS_IOUNIT1_PORT_FLAGS_0_TARGET_IOC_NUM         (0x00)\n#define MPI_SAS_IOUNIT1_PORT_FLAGS_1_TARGET_IOC_NUM         (0x04)\n#define MPI_SAS_IOUNIT1_PORT_FLAGS_AUTO_PORT_CONFIG         (0x01)\n\n/* values for SAS IO Unit Page 0 PhyFlags */\n#define MPI_SAS_IOUNIT1_PHY_FLAGS_PHY_DISABLE               (0x04)\n#define MPI_SAS_IOUNIT1_PHY_FLAGS_TX_INVERT                 (0x02)\n#define MPI_SAS_IOUNIT1_PHY_FLAGS_RX_INVERT                 (0x01)\n\n/* values for SAS IO Unit Page 0 MaxMinLinkRate */\n#define MPI_SAS_IOUNIT1_MAX_RATE_MASK                       (0xF0)\n#define MPI_SAS_IOUNIT1_MAX_RATE_1_5                        (0x80)\n#define MPI_SAS_IOUNIT1_MAX_RATE_3_0                        (0x90)\n#define MPI_SAS_IOUNIT1_MIN_RATE_MASK                       (0x0F)\n#define MPI_SAS_IOUNIT1_MIN_RATE_1_5                        (0x08)\n#define MPI_SAS_IOUNIT1_MIN_RATE_3_0                        (0x09)\n\n/* see mpi_sas.h for values for SAS IO Unit Page 1 ControllerPhyDeviceInfo values */\n\n\ntypedef struct _CONFIG_PAGE_SAS_IO_UNIT_2\n{\n    CONFIG_EXTENDED_PAGE_HEADER         Header;                 /* 00h */\n    U8                                  NumDevsPerEnclosure;    /* 08h */\n    U8                                  Reserved1;              /* 09h */\n    U16                                 Reserved2;              /* 0Ah */\n    U16                                 MaxPersistentIDs;       /* 0Ch */\n    U16                                 NumPersistentIDsUsed;   /* 0Eh */\n    U8                                  Status;                 /* 10h */\n    U8                                  Flags;                  /* 11h */\n    U16                                 MaxNumPhysicalMappedIDs;/* 12h */\n} CONFIG_PAGE_SAS_IO_UNIT_2, MPI_POINTER PTR_CONFIG_PAGE_SAS_IO_UNIT_2,\n  SasIOUnitPage2_t, MPI_POINTER pSasIOUnitPage2_t;\n\n#define MPI_SASIOUNITPAGE2_PAGEVERSION      (0x06)\n\n/* values for SAS IO Unit Page 2 Status field */\n#define MPI_SAS_IOUNIT2_STATUS_DEVICE_LIMIT_EXCEEDED        (0x08)\n#define MPI_SAS_IOUNIT2_STATUS_ENCLOSURE_DEVICES_UNMAPPED   (0x04)\n#define MPI_SAS_IOUNIT2_STATUS_DISABLED_PERSISTENT_MAPPINGS (0x02)\n#define MPI_SAS_IOUNIT2_STATUS_FULL_PERSISTENT_MAPPINGS     (0x01)\n\n/* values for SAS IO Unit Page 2 Flags field */\n#define MPI_SAS_IOUNIT2_FLAGS_DISABLE_PERSISTENT_MAPPINGS   (0x01)\n/* Physical Mapping Modes */\n#define MPI_SAS_IOUNIT2_FLAGS_MASK_PHYS_MAP_MODE            (0x0E)\n#define MPI_SAS_IOUNIT2_FLAGS_SHIFT_PHYS_MAP_MODE           (1)\n#define MPI_SAS_IOUNIT2_FLAGS_NO_PHYS_MAP                   (0x00)\n#define MPI_SAS_IOUNIT2_FLAGS_DIRECT_ATTACH_PHYS_MAP        (0x01)\n#define MPI_SAS_IOUNIT2_FLAGS_ENCLOSURE_SLOT_PHYS_MAP       (0x02)\n#define MPI_SAS_IOUNIT2_FLAGS_HOST_ASSIGNED_PHYS_MAP        (0x07)\n\n#define MPI_SAS_IOUNIT2_FLAGS_RESERVE_ID_0_FOR_BOOT         (0x10)\n#define MPI_SAS_IOUNIT2_FLAGS_DA_STARTING_SLOT              (0x20)\n\n\ntypedef struct _CONFIG_PAGE_SAS_IO_UNIT_3\n{\n    CONFIG_EXTENDED_PAGE_HEADER Header;                         /* 00h */\n    U32                         Reserved1;                      /* 08h */\n    U32                         MaxInvalidDwordCount;           /* 0Ch */\n    U32                         InvalidDwordCountTime;          /* 10h */\n    U32                         MaxRunningDisparityErrorCount;  /* 14h */\n    U32                         RunningDisparityErrorTime;      /* 18h */\n    U32                         MaxLossDwordSynchCount;         /* 1Ch */\n    U32                         LossDwordSynchCountTime;        /* 20h */\n    U32                         MaxPhyResetProblemCount;        /* 24h */\n    U32                         PhyResetProblemTime;            /* 28h */\n} CONFIG_PAGE_SAS_IO_UNIT_3, MPI_POINTER PTR_CONFIG_PAGE_SAS_IO_UNIT_3,\n  SasIOUnitPage3_t, MPI_POINTER pSasIOUnitPage3_t;\n\n#define MPI_SASIOUNITPAGE3_PAGEVERSION      (0x00)\n\n\n/****************************************************************************\n*   SAS Expander Config Pages\n****************************************************************************/\n\ntypedef struct _CONFIG_PAGE_SAS_EXPANDER_0\n{\n    CONFIG_EXTENDED_PAGE_HEADER         Header;                 /* 00h */\n    U8                                  PhysicalPort;           /* 08h */\n    U8                                  Reserved1;              /* 09h */\n    U16                                 EnclosureHandle;        /* 0Ah */\n    U64                                 SASAddress;             /* 0Ch */\n    U32                                 DiscoveryStatus;        /* 14h */\n    U16                                 DevHandle;              /* 18h */\n    U16                                 ParentDevHandle;        /* 1Ah */\n    U16                                 ExpanderChangeCount;    /* 1Ch */\n    U16                                 ExpanderRouteIndexes;   /* 1Eh */\n    U8                                  NumPhys;                /* 20h */\n    U8                                  SASLevel;               /* 21h */\n    U8                                  Flags;                  /* 22h */\n    U8                                  Reserved3;              /* 23h */\n} CONFIG_PAGE_SAS_EXPANDER_0, MPI_POINTER PTR_CONFIG_PAGE_SAS_EXPANDER_0,\n  SasExpanderPage0_t, MPI_POINTER pSasExpanderPage0_t;\n\n#define MPI_SASEXPANDER0_PAGEVERSION        (0x03)\n\n/* values for SAS Expander Page 0 DiscoveryStatus field */\n#define MPI_SAS_EXPANDER0_DS_LOOP_DETECTED              (0x00000001)\n#define MPI_SAS_EXPANDER0_DS_UNADDRESSABLE_DEVICE       (0x00000002)\n#define MPI_SAS_EXPANDER0_DS_MULTIPLE_PORTS             (0x00000004)\n#define MPI_SAS_EXPANDER0_DS_EXPANDER_ERR               (0x00000008)\n#define MPI_SAS_EXPANDER0_DS_SMP_TIMEOUT                (0x00000010)\n#define MPI_SAS_EXPANDER0_DS_OUT_ROUTE_ENTRIES          (0x00000020)\n#define MPI_SAS_EXPANDER0_DS_INDEX_NOT_EXIST            (0x00000040)\n#define MPI_SAS_EXPANDER0_DS_SMP_FUNCTION_FAILED        (0x00000080)\n#define MPI_SAS_EXPANDER0_DS_SMP_CRC_ERROR              (0x00000100)\n#define MPI_SAS_EXPANDER0_DS_SUBTRACTIVE_LINK           (0x00000200)\n#define MPI_SAS_EXPANDER0_DS_TABLE_LINK                 (0x00000400)\n#define MPI_SAS_EXPANDER0_DS_UNSUPPORTED_DEVICE         (0x00000800)\n\n/* values for SAS Expander Page 0 Flags field */\n#define MPI_SAS_EXPANDER0_FLAGS_CONNECTOR_END_DEVICE    (0x04)\n#define MPI_SAS_EXPANDER0_FLAGS_ROUTE_TABLE_CONFIG      (0x02)\n#define MPI_SAS_EXPANDER0_FLAGS_CONFIG_IN_PROGRESS      (0x01)\n\n\ntypedef struct _CONFIG_PAGE_SAS_EXPANDER_1\n{\n    CONFIG_EXTENDED_PAGE_HEADER Header;                 /* 00h */\n    U8                          PhysicalPort;           /* 08h */\n    U8                          Reserved1;              /* 09h */\n    U16                         Reserved2;              /* 0Ah */\n    U8                          NumPhys;                /* 0Ch */\n    U8                          Phy;                    /* 0Dh */\n    U16                         NumTableEntriesProgrammed; /* 0Eh */\n    U8                          ProgrammedLinkRate;     /* 10h */\n    U8                          HwLinkRate;             /* 11h */\n    U16                         AttachedDevHandle;      /* 12h */\n    U32                         PhyInfo;                /* 14h */\n    U32                         AttachedDeviceInfo;     /* 18h */\n    U16                         OwnerDevHandle;         /* 1Ch */\n    U8                          ChangeCount;            /* 1Eh */\n    U8                          NegotiatedLinkRate;     /* 1Fh */\n    U8                          PhyIdentifier;          /* 20h */\n    U8                          AttachedPhyIdentifier;  /* 21h */\n    U8                          Reserved3;              /* 22h */\n    U8                          DiscoveryInfo;          /* 23h */\n    U32                         Reserved4;              /* 24h */\n} CONFIG_PAGE_SAS_EXPANDER_1, MPI_POINTER PTR_CONFIG_PAGE_SAS_EXPANDER_1,\n  SasExpanderPage1_t, MPI_POINTER pSasExpanderPage1_t;\n\n#define MPI_SASEXPANDER1_PAGEVERSION        (0x01)\n\n/* use MPI_SAS_PHY0_PRATE_ defines for ProgrammedLinkRate */\n\n/* use MPI_SAS_PHY0_HWRATE_ defines for HwLinkRate */\n\n/* use MPI_SAS_PHY0_PHYINFO_ defines for PhyInfo */\n\n/* see mpi_sas.h for values for SAS Expander Page 1 AttachedDeviceInfo values */\n\n/* values for SAS Expander Page 1 DiscoveryInfo field */\n#define MPI_SAS_EXPANDER1_DISCINFO_BAD_PHY_DISABLED     (0x04)\n#define MPI_SAS_EXPANDER1_DISCINFO_LINK_STATUS_CHANGE   (0x02)\n#define MPI_SAS_EXPANDER1_DISCINFO_NO_ROUTING_ENTRIES   (0x01)\n\n/* values for SAS Expander Page 1 NegotiatedLinkRate field */\n#define MPI_SAS_EXPANDER1_NEG_RATE_UNKNOWN              (0x00)\n#define MPI_SAS_EXPANDER1_NEG_RATE_PHY_DISABLED         (0x01)\n#define MPI_SAS_EXPANDER1_NEG_RATE_FAILED_NEGOTIATION   (0x02)\n#define MPI_SAS_EXPANDER1_NEG_RATE_SATA_OOB_COMPLETE    (0x03)\n#define MPI_SAS_EXPANDER1_NEG_RATE_1_5                  (0x08)\n#define MPI_SAS_EXPANDER1_NEG_RATE_3_0                  (0x09)\n\n\n/****************************************************************************\n*   SAS Device Config Pages\n****************************************************************************/\n\ntypedef struct _CONFIG_PAGE_SAS_DEVICE_0\n{\n    CONFIG_EXTENDED_PAGE_HEADER         Header;                 /* 00h */\n    U16                                 Slot;                   /* 08h */\n    U16                                 EnclosureHandle;        /* 0Ah */\n    U64                                 SASAddress;             /* 0Ch */\n    U16                                 ParentDevHandle;        /* 14h */\n    U8                                  PhyNum;                 /* 16h */\n    U8                                  AccessStatus;           /* 17h */\n    U16                                 DevHandle;              /* 18h */\n    U8                                  TargetID;               /* 1Ah */\n    U8                                  Bus;                    /* 1Bh */\n    U32                                 DeviceInfo;             /* 1Ch */\n    U16                                 Flags;                  /* 20h */\n    U8                                  PhysicalPort;           /* 22h */\n    U8                                  Reserved2;              /* 23h */\n} CONFIG_PAGE_SAS_DEVICE_0, MPI_POINTER PTR_CONFIG_PAGE_SAS_DEVICE_0,\n  SasDevicePage0_t, MPI_POINTER pSasDevicePage0_t;\n\n#define MPI_SASDEVICE0_PAGEVERSION          (0x05)\n\n/* values for SAS Device Page 0 AccessStatus field */\n#define MPI_SAS_DEVICE0_ASTATUS_NO_ERRORS                   (0x00)\n#define MPI_SAS_DEVICE0_ASTATUS_SATA_INIT_FAILED            (0x01)\n#define MPI_SAS_DEVICE0_ASTATUS_SATA_CAPABILITY_FAILED      (0x02)\n#define MPI_SAS_DEVICE0_ASTATUS_SATA_AFFILIATION_CONFLICT   (0x03)\n/* specific values for SATA Init failures */\n#define MPI_SAS_DEVICE0_ASTATUS_SIF_UNKNOWN                 (0x10)\n#define MPI_SAS_DEVICE0_ASTATUS_SIF_AFFILIATION_CONFLICT    (0x11)\n#define MPI_SAS_DEVICE0_ASTATUS_SIF_DIAG                    (0x12)\n#define MPI_SAS_DEVICE0_ASTATUS_SIF_IDENTIFICATION          (0x13)\n#define MPI_SAS_DEVICE0_ASTATUS_SIF_CHECK_POWER             (0x14)\n#define MPI_SAS_DEVICE0_ASTATUS_SIF_PIO_SN                  (0x15)\n#define MPI_SAS_DEVICE0_ASTATUS_SIF_MDMA_SN                 (0x16)\n#define MPI_SAS_DEVICE0_ASTATUS_SIF_UDMA_SN                 (0x17)\n#define MPI_SAS_DEVICE0_ASTATUS_SIF_ZONING_VIOLATION        (0x18)\n#define MPI_SAS_DEVICE0_ASTATUS_SIF_NOT_ADDRESSABLE         (0x19)\n#define MPI_SAS_DEVICE0_ASTATUS_SIF_MAX                     (0x1F)\n\n/* values for SAS Device Page 0 Flags field */\n#define MPI_SAS_DEVICE0_FLAGS_SATA_ASYNCHRONOUS_NOTIFY      (0x0400)\n#define MPI_SAS_DEVICE0_FLAGS_SATA_SW_PRESERVE              (0x0200)\n#define MPI_SAS_DEVICE0_FLAGS_UNSUPPORTED_DEVICE            (0x0100)\n#define MPI_SAS_DEVICE0_FLAGS_SATA_48BIT_LBA_SUPPORTED      (0x0080)\n#define MPI_SAS_DEVICE0_FLAGS_SATA_SMART_SUPPORTED          (0x0040)\n#define MPI_SAS_DEVICE0_FLAGS_SATA_NCQ_SUPPORTED            (0x0020)\n#define MPI_SAS_DEVICE0_FLAGS_SATA_FUA_SUPPORTED            (0x0010)\n#define MPI_SAS_DEVICE0_FLAGS_PORT_SELECTOR_ATTACH          (0x0008)\n#define MPI_SAS_DEVICE0_FLAGS_MAPPING_PERSISTENT            (0x0004)\n#define MPI_SAS_DEVICE0_FLAGS_DEVICE_MAPPED                 (0x0002)\n#define MPI_SAS_DEVICE0_FLAGS_DEVICE_PRESENT                (0x0001)\n\n/* see mpi_sas.h for values for SAS Device Page 0 DeviceInfo values */\n\n\ntypedef struct _CONFIG_PAGE_SAS_DEVICE_1\n{\n    CONFIG_EXTENDED_PAGE_HEADER         Header;                 /* 00h */\n    U32                                 Reserved1;              /* 08h */\n    U64                                 SASAddress;             /* 0Ch */\n    U32                                 Reserved2;              /* 14h */\n    U16                                 DevHandle;              /* 18h */\n    U8                                  TargetID;               /* 1Ah */\n    U8                                  Bus;                    /* 1Bh */\n    U8                                  InitialRegDeviceFIS[20];/* 1Ch */\n} CONFIG_PAGE_SAS_DEVICE_1, MPI_POINTER PTR_CONFIG_PAGE_SAS_DEVICE_1,\n  SasDevicePage1_t, MPI_POINTER pSasDevicePage1_t;\n\n#define MPI_SASDEVICE1_PAGEVERSION          (0x00)\n\n\ntypedef struct _CONFIG_PAGE_SAS_DEVICE_2\n{\n    CONFIG_EXTENDED_PAGE_HEADER         Header;                 /* 00h */\n    U64                                 PhysicalIdentifier;     /* 08h */\n    U32                                 EnclosureMapping;       /* 10h */\n} CONFIG_PAGE_SAS_DEVICE_2, MPI_POINTER PTR_CONFIG_PAGE_SAS_DEVICE_2,\n  SasDevicePage2_t, MPI_POINTER pSasDevicePage2_t;\n\n#define MPI_SASDEVICE2_PAGEVERSION          (0x01)\n\n/* defines for SAS Device Page 2 EnclosureMapping field */\n#define MPI_SASDEVICE2_ENC_MAP_MASK_MISSING_COUNT       (0x0000000F)\n#define MPI_SASDEVICE2_ENC_MAP_SHIFT_MISSING_COUNT      (0)\n#define MPI_SASDEVICE2_ENC_MAP_MASK_NUM_SLOTS           (0x000007F0)\n#define MPI_SASDEVICE2_ENC_MAP_SHIFT_NUM_SLOTS          (4)\n#define MPI_SASDEVICE2_ENC_MAP_MASK_START_INDEX         (0x001FF800)\n#define MPI_SASDEVICE2_ENC_MAP_SHIFT_START_INDEX        (11)\n\n\n/****************************************************************************\n*   SAS PHY Config Pages\n****************************************************************************/\n\ntypedef struct _CONFIG_PAGE_SAS_PHY_0\n{\n    CONFIG_EXTENDED_PAGE_HEADER         Header;                 /* 00h */\n    U16                                 OwnerDevHandle;         /* 08h */\n    U16                                 Reserved1;              /* 0Ah */\n    U64                                 SASAddress;             /* 0Ch */\n    U16                                 AttachedDevHandle;      /* 14h */\n    U8                                  AttachedPhyIdentifier;  /* 16h */\n    U8                                  Reserved2;              /* 17h */\n    U32                                 AttachedDeviceInfo;     /* 18h */\n    U8                                  ProgrammedLinkRate;     /* 1Ch */\n    U8                                  HwLinkRate;             /* 1Dh */\n    U8                                  ChangeCount;            /* 1Eh */\n    U8                                  Flags;                  /* 1Fh */\n    U32                                 PhyInfo;                /* 20h */\n} CONFIG_PAGE_SAS_PHY_0, MPI_POINTER PTR_CONFIG_PAGE_SAS_PHY_0,\n  SasPhyPage0_t, MPI_POINTER pSasPhyPage0_t;\n\n#define MPI_SASPHY0_PAGEVERSION             (0x01)\n\n/* values for SAS PHY Page 0 ProgrammedLinkRate field */\n#define MPI_SAS_PHY0_PRATE_MAX_RATE_MASK                        (0xF0)\n#define MPI_SAS_PHY0_PRATE_MAX_RATE_NOT_PROGRAMMABLE            (0x00)\n#define MPI_SAS_PHY0_PRATE_MAX_RATE_1_5                         (0x80)\n#define MPI_SAS_PHY0_PRATE_MAX_RATE_3_0                         (0x90)\n#define MPI_SAS_PHY0_PRATE_MIN_RATE_MASK                        (0x0F)\n#define MPI_SAS_PHY0_PRATE_MIN_RATE_NOT_PROGRAMMABLE            (0x00)\n#define MPI_SAS_PHY0_PRATE_MIN_RATE_1_5                         (0x08)\n#define MPI_SAS_PHY0_PRATE_MIN_RATE_3_0                         (0x09)\n\n/* values for SAS PHY Page 0 HwLinkRate field */\n#define MPI_SAS_PHY0_HWRATE_MAX_RATE_MASK                       (0xF0)\n#define MPI_SAS_PHY0_HWRATE_MAX_RATE_1_5                        (0x80)\n#define MPI_SAS_PHY0_HWRATE_MAX_RATE_3_0                        (0x90)\n#define MPI_SAS_PHY0_HWRATE_MIN_RATE_MASK                       (0x0F)\n#define MPI_SAS_PHY0_HWRATE_MIN_RATE_1_5                        (0x08)\n#define MPI_SAS_PHY0_HWRATE_MIN_RATE_3_0                        (0x09)\n\n/* values for SAS PHY Page 0 Flags field */\n#define MPI_SAS_PHY0_FLAGS_SGPIO_DIRECT_ATTACH_ENC              (0x01)\n\n/* values for SAS PHY Page 0 PhyInfo field */\n#define MPI_SAS_PHY0_PHYINFO_SATA_PORT_ACTIVE                   (0x00004000)\n#define MPI_SAS_PHY0_PHYINFO_SATA_PORT_SELECTOR                 (0x00002000)\n#define MPI_SAS_PHY0_PHYINFO_VIRTUAL_PHY                        (0x00001000)\n\n#define MPI_SAS_PHY0_PHYINFO_MASK_PARTIAL_PATHWAY_TIME          (0x00000F00)\n#define MPI_SAS_PHY0_PHYINFO_SHIFT_PARTIAL_PATHWAY_TIME         (8)\n\n#define MPI_SAS_PHY0_PHYINFO_MASK_ROUTING_ATTRIBUTE             (0x000000F0)\n#define MPI_SAS_PHY0_PHYINFO_DIRECT_ROUTING                     (0x00000000)\n#define MPI_SAS_PHY0_PHYINFO_SUBTRACTIVE_ROUTING                (0x00000010)\n#define MPI_SAS_PHY0_PHYINFO_TABLE_ROUTING                      (0x00000020)\n\n#define MPI_SAS_PHY0_PHYINFO_MASK_LINK_RATE                     (0x0000000F)\n#define MPI_SAS_PHY0_PHYINFO_UNKNOWN_LINK_RATE                  (0x00000000)\n#define MPI_SAS_PHY0_PHYINFO_PHY_DISABLED                       (0x00000001)\n#define MPI_SAS_PHY0_PHYINFO_NEGOTIATION_FAILED                 (0x00000002)\n#define MPI_SAS_PHY0_PHYINFO_SATA_OOB_COMPLETE                  (0x00000003)\n#define MPI_SAS_PHY0_PHYINFO_RATE_1_5                           (0x00000008)\n#define MPI_SAS_PHY0_PHYINFO_RATE_3_0                           (0x00000009)\n\n\ntypedef struct _CONFIG_PAGE_SAS_PHY_1\n{\n    CONFIG_EXTENDED_PAGE_HEADER Header;                     /* 00h */\n    U32                         Reserved1;                  /* 08h */\n    U32                         InvalidDwordCount;          /* 0Ch */\n    U32                         RunningDisparityErrorCount; /* 10h */\n    U32                         LossDwordSynchCount;        /* 14h */\n    U32                         PhyResetProblemCount;       /* 18h */\n} CONFIG_PAGE_SAS_PHY_1, MPI_POINTER PTR_CONFIG_PAGE_SAS_PHY_1,\n  SasPhyPage1_t, MPI_POINTER pSasPhyPage1_t;\n\n#define MPI_SASPHY1_PAGEVERSION             (0x00)\n\n\n/****************************************************************************\n*   SAS Enclosure Config Pages\n****************************************************************************/\n\ntypedef struct _CONFIG_PAGE_SAS_ENCLOSURE_0\n{\n    CONFIG_EXTENDED_PAGE_HEADER         Header;                 /* 00h */\n    U32                                 Reserved1;              /* 08h */\n    U64                                 EnclosureLogicalID;     /* 0Ch */\n    U16                                 Flags;                  /* 14h */\n    U16                                 EnclosureHandle;        /* 16h */\n    U16                                 NumSlots;               /* 18h */\n    U16                                 StartSlot;              /* 1Ah */\n    U8                                  StartTargetID;          /* 1Ch */\n    U8                                  StartBus;               /* 1Dh */\n    U8                                  SEPTargetID;            /* 1Eh */\n    U8                                  SEPBus;                 /* 1Fh */\n    U32                                 Reserved2;              /* 20h */\n    U32                                 Reserved3;              /* 24h */\n} CONFIG_PAGE_SAS_ENCLOSURE_0, MPI_POINTER PTR_CONFIG_PAGE_SAS_ENCLOSURE_0,\n  SasEnclosurePage0_t, MPI_POINTER pSasEnclosurePage0_t;\n\n#define MPI_SASENCLOSURE0_PAGEVERSION       (0x01)\n\n/* values for SAS Enclosure Page 0 Flags field */\n#define MPI_SAS_ENCLS0_FLAGS_SEP_BUS_ID_VALID       (0x0020)\n#define MPI_SAS_ENCLS0_FLAGS_START_BUS_ID_VALID     (0x0010)\n\n#define MPI_SAS_ENCLS0_FLAGS_MNG_MASK               (0x000F)\n#define MPI_SAS_ENCLS0_FLAGS_MNG_UNKNOWN            (0x0000)\n#define MPI_SAS_ENCLS0_FLAGS_MNG_IOC_SES            (0x0001)\n#define MPI_SAS_ENCLS0_FLAGS_MNG_IOC_SGPIO          (0x0002)\n#define MPI_SAS_ENCLS0_FLAGS_MNG_EXP_SGPIO          (0x0003)\n#define MPI_SAS_ENCLS0_FLAGS_MNG_SES_ENCLOSURE      (0x0004)\n#define MPI_SAS_ENCLS0_FLAGS_MNG_IOC_GPIO           (0x0005)\n\n\n/****************************************************************************\n*   Log Config Pages\n****************************************************************************/\n/*\n * Host code (drivers, BIOS, utilities, etc.) should leave this define set to\n * one and check NumLogEntries at runtime.\n */\n#ifndef MPI_LOG_0_NUM_LOG_ENTRIES\n#define MPI_LOG_0_NUM_LOG_ENTRIES        (1)\n#endif\n\n#define MPI_LOG_0_LOG_DATA_LENGTH        (0x1C)\n\ntypedef struct _MPI_LOG_0_ENTRY\n{\n    U32         TimeStamp;                          /* 00h */\n    U32         Reserved1;                          /* 04h */\n    U16         LogSequence;                        /* 08h */\n    U16         LogEntryQualifier;                  /* 0Ah */\n    U8          LogData[MPI_LOG_0_LOG_DATA_LENGTH]; /* 0Ch */\n} MPI_LOG_0_ENTRY, MPI_POINTER PTR_MPI_LOG_0_ENTRY,\n  MpiLog0Entry_t, MPI_POINTER pMpiLog0Entry_t;\n\n/* values for Log Page 0 LogEntry LogEntryQualifier field */\n#define MPI_LOG_0_ENTRY_QUAL_ENTRY_UNUSED           (0x0000)\n#define MPI_LOG_0_ENTRY_QUAL_POWER_ON_RESET         (0x0001)\n\ntypedef struct _CONFIG_PAGE_LOG_0\n{\n    CONFIG_EXTENDED_PAGE_HEADER Header;                     /* 00h */\n    U32                         Reserved1;                  /* 08h */\n    U32                         Reserved2;                  /* 0Ch */\n    U16                         NumLogEntries;              /* 10h */\n    U16                         Reserved3;                  /* 12h */\n    MPI_LOG_0_ENTRY             LogEntry[MPI_LOG_0_NUM_LOG_ENTRIES]; /* 14h */\n} CONFIG_PAGE_LOG_0, MPI_POINTER PTR_CONFIG_PAGE_LOG_0,\n  LogPage0_t, MPI_POINTER pLogPage0_t;\n\n#define MPI_LOG_0_PAGEVERSION               (0x01)\n\n\n#endif\n\n"
  },
  {
    "path": "freebsd-headers/dev/mpt/mpilib/mpi_fc.h",
    "content": "/* $FreeBSD: release/9.0.0/sys/dev/mpt/mpilib/mpi_fc.h 154603 2006-01-21 00:29:52Z mjacob $ */\n/*-\n * Copyright (c) 2000-2005, LSI Logic Corporation and its contributors.\n * All rights reserved.\n * \n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions are\n * met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce at minimum a disclaimer\n *    substantially similar to the \"NO WARRANTY\" disclaimer below\n *    (\"Disclaimer\") and any redistribution must be conditioned upon including\n *    a substantially similar Disclaimer requirement for further binary\n *    redistribution.\n * 3. Neither the name of the LSI Logic Corporation nor the names of its\n *    contributors may be used to endorse or promote products derived from\n *    this software without specific prior written permission.\n * \n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\n * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE\n * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\n * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\n * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\n * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\n * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF THE COPYRIGHT\n * OWNER OR CONTRIBUTOR IS ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n * \n * \n *           Name:  mpi_fc.h\n *          Title:  MPI Fibre Channel messages and structures\n *  Creation Date:  June 12, 2000\n *\n *    mpi_fc.h Version:  01.05.01\n *\n *  Version History\n *  ---------------\n *\n *  Date      Version   Description\n *  --------  --------  ------------------------------------------------------\n *  05-08-00  00.10.01  Original release for 0.10 spec dated 4/26/2000.\n *  06-06-00  01.00.01  Update version number for 1.0 release.\n *  06-12-00  01.00.02  Added _MSG_FC_ABORT_REPLY structure.\n *  11-02-00  01.01.01  Original release for post 1.0 work\n *  12-04-00  01.01.02  Added messages for Common Transport Send and\n *                      Primitive Send.\n *  01-09-01  01.01.03  Modifed some of the new flags to have an MPI prefix\n *                      and modified the FcPrimitiveSend flags.\n *  01-25-01  01.01.04  Move InitiatorIndex in LinkServiceRsp reply to a larger\n *                      field.\n *                      Added FC_ABORT_TYPE_CT_SEND_REQUEST and\n *                      FC_ABORT_TYPE_EXLINKSEND_REQUEST for FcAbort request.\n *                      Added MPI_FC_PRIM_SEND_FLAGS_STOP_SEND.\n *  02-20-01  01.01.05  Started using MPI_POINTER.\n *  03-27-01  01.01.06  Added Flags field to MSG_LINK_SERVICE_BUFFER_POST_REPLY\n *                      and defined MPI_LS_BUF_POST_REPLY_FLAG_NO_RSP_NEEDED.\n *                      Added MPI_FC_PRIM_SEND_FLAGS_RESET_LINK define.\n *                      Added structure offset comments.\n *  04-09-01  01.01.07  Added RspLength field to MSG_LINK_SERVICE_RSP_REQUEST.\n *  08-08-01  01.02.01  Original release for v1.2 work.\n *  09-28-01  01.02.02  Change name of reserved field in\n *                      MSG_LINK_SERVICE_RSP_REPLY.\n *  05-31-02  01.02.03  Adding AliasIndex to FC Direct Access requests.\n *  01-16-04  01.02.04  Added define for MPI_FC_PRIM_SEND_FLAGS_ML_RESET_LINK.\n *  05-11-04  01.03.01  Original release for MPI v1.3.\n *  08-19-04  01.05.01  Original release for MPI v1.5.\n *  --------------------------------------------------------------------------\n */\n\n#ifndef MPI_FC_H\n#define MPI_FC_H\n\n\n/*****************************************************************************\n*\n*        F C    D i r e c t    A c c e s s     M e s s a g e s\n*\n*****************************************************************************/\n\n/****************************************************************************/\n/* Link Service Buffer Post messages                                        */\n/****************************************************************************/\n\ntypedef struct _MSG_LINK_SERVICE_BUFFER_POST_REQUEST\n{\n    U8                      BufferPostFlags;    /* 00h */\n    U8                      BufferCount;        /* 01h */\n    U8                      ChainOffset;        /* 02h */\n    U8                      Function;           /* 03h */\n    U16                     Reserved;           /* 04h */\n    U8                      Reserved1;          /* 06h */\n    U8                      MsgFlags;           /* 07h */\n    U32                     MsgContext;         /* 08h */\n    SGE_TRANS_SIMPLE_UNION  SGL;\n} MSG_LINK_SERVICE_BUFFER_POST_REQUEST,\n MPI_POINTER PTR_MSG_LINK_SERVICE_BUFFER_POST_REQUEST,\n  LinkServiceBufferPostRequest_t, MPI_POINTER pLinkServiceBufferPostRequest_t;\n\n#define LINK_SERVICE_BUFFER_POST_FLAGS_PORT_MASK (0x01)\n\ntypedef struct _WWNFORMAT\n{\n    U32                     PortNameHigh;       /* 00h */\n    U32                     PortNameLow;        /* 04h */\n    U32                     NodeNameHigh;       /* 08h */\n    U32                     NodeNameLow;        /* 0Ch */\n} WWNFORMAT,\n  WwnFormat_t;\n\n/* Link Service Buffer Post Reply */\ntypedef struct _MSG_LINK_SERVICE_BUFFER_POST_REPLY\n{\n    U8                      Flags;              /* 00h */\n    U8                      Reserved;           /* 01h */\n    U8                      MsgLength;          /* 02h */\n    U8                      Function;           /* 03h */\n    U16                     Reserved1;          /* 04h */\n    U8                      PortNumber;         /* 06h */\n    U8                      MsgFlags;           /* 07h */\n    U32                     MsgContext;         /* 08h */\n    U16                     Reserved2;          /* 0Ch */\n    U16                     IOCStatus;          /* 0Eh */\n    U32                     IOCLogInfo;         /* 10h */\n    U32                     TransferLength;     /* 14h */\n    U32                     TransactionContext; /* 18h */\n    U32                     Rctl_Did;           /* 1Ch */\n    U32                     Csctl_Sid;          /* 20h */\n    U32                     Type_Fctl;          /* 24h */\n    U16                     SeqCnt;             /* 28h */\n    U8                      Dfctl;              /* 2Ah */\n    U8                      SeqId;              /* 2Bh */\n    U16                     Rxid;               /* 2Ch */\n    U16                     Oxid;               /* 2Eh */\n    U32                     Parameter;          /* 30h */\n    WWNFORMAT               Wwn;                /* 34h */\n} MSG_LINK_SERVICE_BUFFER_POST_REPLY, MPI_POINTER PTR_MSG_LINK_SERVICE_BUFFER_POST_REPLY,\n  LinkServiceBufferPostReply_t, MPI_POINTER pLinkServiceBufferPostReply_t;\n\n#define MPI_LS_BUF_POST_REPLY_FLAG_NO_RSP_NEEDED    (0x80)\n\n#define MPI_FC_DID_MASK                             (0x00FFFFFF)\n#define MPI_FC_DID_SHIFT                            (0)\n#define MPI_FC_RCTL_MASK                            (0xFF000000)\n#define MPI_FC_RCTL_SHIFT                           (24)\n#define MPI_FC_SID_MASK                             (0x00FFFFFF)\n#define MPI_FC_SID_SHIFT                            (0)\n#define MPI_FC_CSCTL_MASK                           (0xFF000000)\n#define MPI_FC_CSCTL_SHIFT                          (24)\n#define MPI_FC_FCTL_MASK                            (0x00FFFFFF)\n#define MPI_FC_FCTL_SHIFT                           (0)\n#define MPI_FC_TYPE_MASK                            (0xFF000000)\n#define MPI_FC_TYPE_SHIFT                           (24)\n\n/* obsolete name for the above */\n#define FCP_TARGET_DID_MASK                         (0x00FFFFFF)\n#define FCP_TARGET_DID_SHIFT                        (0)\n#define FCP_TARGET_RCTL_MASK                        (0xFF000000)\n#define FCP_TARGET_RCTL_SHIFT                       (24)\n#define FCP_TARGET_SID_MASK                         (0x00FFFFFF)\n#define FCP_TARGET_SID_SHIFT                        (0)\n#define FCP_TARGET_CSCTL_MASK                       (0xFF000000)\n#define FCP_TARGET_CSCTL_SHIFT                      (24)\n#define FCP_TARGET_FCTL_MASK                        (0x00FFFFFF)\n#define FCP_TARGET_FCTL_SHIFT                       (0)\n#define FCP_TARGET_TYPE_MASK                        (0xFF000000)\n#define FCP_TARGET_TYPE_SHIFT                       (24)\n\n\n/****************************************************************************/\n/* Link Service Response messages                                           */\n/****************************************************************************/\n\ntypedef struct _MSG_LINK_SERVICE_RSP_REQUEST\n{\n    U8                      RspFlags;           /* 00h */\n    U8                      RspLength;          /* 01h */\n    U8                      ChainOffset;        /* 02h */\n    U8                      Function;           /* 03h */\n    U16                     Reserved1;          /* 04h */\n    U8                      Reserved2;          /* 06h */\n    U8                      MsgFlags;           /* 07h */\n    U32                     MsgContext;         /* 08h */\n    U32                     Rctl_Did;           /* 0Ch */\n    U32                     Csctl_Sid;          /* 10h */\n    U32                     Type_Fctl;          /* 14h */\n    U16                     SeqCnt;             /* 18h */\n    U8                      Dfctl;              /* 1Ah */\n    U8                      SeqId;              /* 1Bh */\n    U16                     Rxid;               /* 1Ch */\n    U16                     Oxid;               /* 1Eh */\n    U32                     Parameter;          /* 20h */\n    SGE_SIMPLE_UNION        SGL;                /* 24h */\n} MSG_LINK_SERVICE_RSP_REQUEST, MPI_POINTER PTR_MSG_LINK_SERVICE_RSP_REQUEST,\n  LinkServiceRspRequest_t, MPI_POINTER pLinkServiceRspRequest_t;\n\n#define LINK_SERVICE_RSP_FLAGS_IMMEDIATE        (0x80)\n#define LINK_SERVICE_RSP_FLAGS_PORT_MASK        (0x01)\n\n\n/* Link Service Response Reply  */\ntypedef struct _MSG_LINK_SERVICE_RSP_REPLY\n{\n    U16                     Reserved;           /* 00h */\n    U8                      MsgLength;          /* 02h */\n    U8                      Function;           /* 03h */\n    U16                     Reserved1;          /* 04h */\n    U8                      Reserved_0100_InitiatorIndex; /* 06h */ /* obsolete InitiatorIndex */\n    U8                      MsgFlags;           /* 07h */\n    U32                     MsgContext;         /* 08h */\n    U16                     Reserved3;          /* 0Ch */\n    U16                     IOCStatus;          /* 0Eh */\n    U32                     IOCLogInfo;         /* 10h */\n    U32                     InitiatorIndex;     /* 14h */\n} MSG_LINK_SERVICE_RSP_REPLY, MPI_POINTER PTR_MSG_LINK_SERVICE_RSP_REPLY,\n  LinkServiceRspReply_t, MPI_POINTER pLinkServiceRspReply_t;\n\n\n/****************************************************************************/\n/* Extended Link Service Send messages                                      */\n/****************************************************************************/\n\ntypedef struct _MSG_EXLINK_SERVICE_SEND_REQUEST\n{\n    U8                      SendFlags;          /* 00h */\n    U8                      AliasIndex;         /* 01h */\n    U8                      ChainOffset;        /* 02h */\n    U8                      Function;           /* 03h */\n    U32                     MsgFlags_Did;       /* 04h */\n    U32                     MsgContext;         /* 08h */\n    U32                     ElsCommandCode;     /* 0Ch */\n    SGE_SIMPLE_UNION        SGL;                /* 10h */\n} MSG_EXLINK_SERVICE_SEND_REQUEST, MPI_POINTER PTR_MSG_EXLINK_SERVICE_SEND_REQUEST,\n  ExLinkServiceSendRequest_t, MPI_POINTER pExLinkServiceSendRequest_t;\n\n#define EX_LINK_SERVICE_SEND_DID_MASK           (0x00FFFFFF)\n#define EX_LINK_SERVICE_SEND_DID_SHIFT          (0)\n#define EX_LINK_SERVICE_SEND_MSGFLAGS_MASK      (0xFF000000)\n#define EX_LINK_SERVICE_SEND_MSGFLAGS_SHIFT     (24)\n\n\n/* Extended Link Service Send Reply */\ntypedef struct _MSG_EXLINK_SERVICE_SEND_REPLY\n{\n    U8                      Reserved;           /* 00h */\n    U8                      AliasIndex;         /* 01h */\n    U8                      MsgLength;          /* 02h */\n    U8                      Function;           /* 03h */\n    U16                     Reserved1;          /* 04h */\n    U8                      Reserved2;          /* 06h */\n    U8                      MsgFlags;           /* 07h */\n    U32                     MsgContext;         /* 08h */\n    U16                     Reserved3;          /* 0Ch */\n    U16                     IOCStatus;          /* 0Eh */\n    U32                     IOCLogInfo;         /* 10h */\n    U32                     ResponseLength;     /* 14h */\n} MSG_EXLINK_SERVICE_SEND_REPLY, MPI_POINTER PTR_MSG_EXLINK_SERVICE_SEND_REPLY,\n  ExLinkServiceSendReply_t, MPI_POINTER pExLinkServiceSendReply_t;\n\n/****************************************************************************/\n/* FC Abort messages                                                        */\n/****************************************************************************/\n\ntypedef struct _MSG_FC_ABORT_REQUEST\n{\n    U8                      AbortFlags;                 /* 00h */\n    U8                      AbortType;                  /* 01h */\n    U8                      ChainOffset;                /* 02h */\n    U8                      Function;                   /* 03h */\n    U16                     Reserved1;                  /* 04h */\n    U8                      Reserved2;                  /* 06h */\n    U8                      MsgFlags;                   /* 07h */\n    U32                     MsgContext;                 /* 08h */\n    U32                     TransactionContextToAbort;  /* 0Ch */\n} MSG_FC_ABORT_REQUEST, MPI_POINTER PTR_MSG_FC_ABORT_REQUEST,\n  FcAbortRequest_t, MPI_POINTER pFcAbortRequest_t;\n\n#define FC_ABORT_FLAG_PORT_MASK                 (0x01)\n\n#define FC_ABORT_TYPE_ALL_FC_BUFFERS            (0x00)\n#define FC_ABORT_TYPE_EXACT_FC_BUFFER           (0x01)\n#define FC_ABORT_TYPE_CT_SEND_REQUEST           (0x02)\n#define FC_ABORT_TYPE_EXLINKSEND_REQUEST        (0x03)\n\n/* FC Abort Reply */\ntypedef struct _MSG_FC_ABORT_REPLY\n{\n    U16                     Reserved;           /* 00h */\n    U8                      MsgLength;          /* 02h */\n    U8                      Function;           /* 03h */\n    U16                     Reserved1;          /* 04h */\n    U8                      Reserved2;          /* 06h */\n    U8                      MsgFlags;           /* 07h */\n    U32                     MsgContext;         /* 08h */\n    U16                     Reserved3;          /* 0Ch */\n    U16                     IOCStatus;          /* 0Eh */\n    U32                     IOCLogInfo;         /* 10h */\n} MSG_FC_ABORT_REPLY, MPI_POINTER PTR_MSG_FC_ABORT_REPLY,\n  FcAbortReply_t, MPI_POINTER pFcAbortReply_t;\n\n\n/****************************************************************************/\n/* FC Common Transport Send messages                                        */\n/****************************************************************************/\n\ntypedef struct _MSG_FC_COMMON_TRANSPORT_SEND_REQUEST\n{\n    U8                      SendFlags;          /* 00h */\n    U8                      AliasIndex;         /* 01h */\n    U8                      ChainOffset;        /* 02h */\n    U8                      Function;           /* 03h */\n    U32                     MsgFlags_Did;       /* 04h */\n    U32                     MsgContext;         /* 08h */\n    U16                     CTCommandCode;      /* 0Ch */\n    U8                      FsType;             /* 0Eh */\n    U8                      Reserved1;          /* 0Fh */\n    SGE_SIMPLE_UNION        SGL;                /* 10h */\n} MSG_FC_COMMON_TRANSPORT_SEND_REQUEST,\n MPI_POINTER PTR_MSG_FC_COMMON_TRANSPORT_SEND_REQUEST,\n  FcCommonTransportSendRequest_t, MPI_POINTER pFcCommonTransportSendRequest_t;\n\n#define MPI_FC_CT_SEND_DID_MASK                 (0x00FFFFFF)\n#define MPI_FC_CT_SEND_DID_SHIFT                (0)\n#define MPI_FC_CT_SEND_MSGFLAGS_MASK            (0xFF000000)\n#define MPI_FC_CT_SEND_MSGFLAGS_SHIFT           (24)\n\n\n/* FC Common Transport Send Reply */\ntypedef struct _MSG_FC_COMMON_TRANSPORT_SEND_REPLY\n{\n    U8                      Reserved;           /* 00h */\n    U8                      AliasIndex;         /* 01h */\n    U8                      MsgLength;          /* 02h */\n    U8                      Function;           /* 03h */\n    U16                     Reserved1;          /* 04h */\n    U8                      Reserved2;          /* 06h */\n    U8                      MsgFlags;           /* 07h */\n    U32                     MsgContext;         /* 08h */\n    U16                     Reserved3;          /* 0Ch */\n    U16                     IOCStatus;          /* 0Eh */\n    U32                     IOCLogInfo;         /* 10h */\n    U32                     ResponseLength;     /* 14h */\n} MSG_FC_COMMON_TRANSPORT_SEND_REPLY, MPI_POINTER PTR_MSG_FC_COMMON_TRANSPORT_SEND_REPLY,\n  FcCommonTransportSendReply_t, MPI_POINTER pFcCommonTransportSendReply_t;\n\n\n/****************************************************************************/\n/* FC Primitive Send messages                                               */\n/****************************************************************************/\n\ntypedef struct _MSG_FC_PRIMITIVE_SEND_REQUEST\n{\n    U8                      SendFlags;          /* 00h */\n    U8                      Reserved;           /* 01h */\n    U8                      ChainOffset;        /* 02h */\n    U8                      Function;           /* 03h */\n    U16                     Reserved1;          /* 04h */\n    U8                      Reserved2;          /* 06h */\n    U8                      MsgFlags;           /* 07h */\n    U32                     MsgContext;         /* 08h */\n    U8                      FcPrimitive[4];     /* 0Ch */\n} MSG_FC_PRIMITIVE_SEND_REQUEST, MPI_POINTER PTR_MSG_FC_PRIMITIVE_SEND_REQUEST,\n  FcPrimitiveSendRequest_t, MPI_POINTER pFcPrimitiveSendRequest_t;\n\n#define MPI_FC_PRIM_SEND_FLAGS_PORT_MASK       (0x01)\n#define MPI_FC_PRIM_SEND_FLAGS_ML_RESET_LINK   (0x02)\n#define MPI_FC_PRIM_SEND_FLAGS_RESET_LINK      (0x04)\n#define MPI_FC_PRIM_SEND_FLAGS_STOP_SEND       (0x08)\n#define MPI_FC_PRIM_SEND_FLAGS_SEND_ONCE       (0x10)\n#define MPI_FC_PRIM_SEND_FLAGS_SEND_AROUND     (0x20)\n#define MPI_FC_PRIM_SEND_FLAGS_UNTIL_FULL      (0x40)\n#define MPI_FC_PRIM_SEND_FLAGS_FOREVER         (0x80)\n\n/* FC Primitive Send Reply */\ntypedef struct _MSG_FC_PRIMITIVE_SEND_REPLY\n{\n    U8                      SendFlags;          /* 00h */\n    U8                      Reserved;           /* 01h */\n    U8                      MsgLength;          /* 02h */\n    U8                      Function;           /* 03h */\n    U16                     Reserved1;          /* 04h */\n    U8                      Reserved2;          /* 06h */\n    U8                      MsgFlags;           /* 07h */\n    U32                     MsgContext;         /* 08h */\n    U16                     Reserved3;          /* 0Ch */\n    U16                     IOCStatus;          /* 0Eh */\n    U32                     IOCLogInfo;         /* 10h */\n} MSG_FC_PRIMITIVE_SEND_REPLY, MPI_POINTER PTR_MSG_FC_PRIMITIVE_SEND_REPLY,\n  FcPrimitiveSendReply_t, MPI_POINTER pFcPrimitiveSendReply_t;\n\n#endif\n\n"
  },
  {
    "path": "freebsd-headers/dev/mpt/mpilib/mpi_inb.h",
    "content": "/* $FreeBSD: release/9.0.0/sys/dev/mpt/mpilib/mpi_inb.h 154603 2006-01-21 00:29:52Z mjacob $ */\n/*-\n * Copyright (c) 2000-2005, LSI Logic Corporation and its contributors.\n * All rights reserved.\n * \n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions are\n * met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce at minimum a disclaimer\n *    substantially similar to the \"NO WARRANTY\" disclaimer below\n *    (\"Disclaimer\") and any redistribution must be conditioned upon including\n *    a substantially similar Disclaimer requirement for further binary\n *    redistribution.\n * 3. Neither the name of the LSI Logic Corporation nor the names of its\n *    contributors may be used to endorse or promote products derived from\n *    this software without specific prior written permission.\n * \n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\n * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE\n * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\n * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\n * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\n * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\n * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF THE COPYRIGHT\n * OWNER OR CONTRIBUTOR IS ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n/*\n *  Copyright (c) 2003-2004 LSI Logic Corporation.\n *\n *\n *           Name:  mpi_inb.h\n *          Title:  MPI Inband structures and definitions\n *  Creation Date:  September 30, 2003\n *\n *    mpi_inb.h Version:  01.05.01\n *\n *  Version History\n *  ---------------\n *\n *  Date      Version   Description\n *  --------  --------  ------------------------------------------------------\n *  05-11-04  01.03.01  Original release.\n *  08-19-04  01.05.01  Original release for MPI v1.5.\n *  --------------------------------------------------------------------------\n */\n\n#ifndef MPI_INB_H\n#define MPI_INB_H\n\n/******************************************************************************\n*\n*        I n b a n d    M e s s a g e s\n*\n*******************************************************************************/\n\n\n/****************************************************************************/\n/* Inband Buffer Post Request                                               */\n/****************************************************************************/\n\ntypedef struct _MSG_INBAND_BUFFER_POST_REQUEST\n{\n    U8                      Reserved1;          /* 00h */\n    U8                      BufferCount;        /* 01h */\n    U8                      ChainOffset;        /* 02h */\n    U8                      Function;           /* 03h */\n    U16                     Reserved2;          /* 04h */\n    U8                      Reserved3;          /* 06h */\n    U8                      MsgFlags;           /* 07h */\n    U32                     MsgContext;         /* 08h */\n    U32                     Reserved4;          /* 0Ch */\n    SGE_TRANS_SIMPLE_UNION  SGL;                /* 10h */\n} MSG_INBAND_BUFFER_POST_REQUEST, MPI_POINTER PTR_MSG_INBAND_BUFFER_POST_REQUEST,\n  MpiInbandBufferPostRequest_t , MPI_POINTER pMpiInbandBufferPostRequest_t;\n\n\ntypedef struct _WWN_FC_FORMAT\n{\n    U64                     NodeName;           /* 00h */\n    U64                     PortName;           /* 08h */\n} WWN_FC_FORMAT, MPI_POINTER PTR_WWN_FC_FORMAT,\n  WwnFcFormat_t, MPI_POINTER pWwnFcFormat_t;\n\ntypedef struct _WWN_SAS_FORMAT\n{\n    U64                     WorldWideID;        /* 00h */\n    U32                     Reserved1;          /* 08h */\n    U32                     Reserved2;          /* 0Ch */\n} WWN_SAS_FORMAT, MPI_POINTER PTR_WWN_SAS_FORMAT,\n  WwnSasFormat_t, MPI_POINTER pWwnSasFormat_t;\n\ntypedef union _WWN_INBAND_FORMAT\n{\n    WWN_FC_FORMAT           Fc;\n    WWN_SAS_FORMAT          Sas;\n} WWN_INBAND_FORMAT, MPI_POINTER PTR_WWN_INBAND_FORMAT,\n  WwnInbandFormat, MPI_POINTER pWwnInbandFormat;\n\n\n/* Inband Buffer Post reply message */\n\ntypedef struct _MSG_INBAND_BUFFER_POST_REPLY\n{\n    U16                     Reserved1;          /* 00h */\n    U8                      MsgLength;          /* 02h */\n    U8                      Function;           /* 03h */\n    U16                     Reserved2;          /* 04h */\n    U8                      Reserved3;          /* 06h */\n    U8                      MsgFlags;           /* 07h */\n    U32                     MsgContext;         /* 08h */\n    U16                     Reserved4;          /* 0Ch */\n    U16                     IOCStatus;          /* 0Eh */\n    U32                     IOCLogInfo;         /* 10h */\n    U32                     TransferLength;     /* 14h */\n    U32                     TransactionContext; /* 18h */\n    WWN_INBAND_FORMAT       Wwn;                /* 1Ch */\n    U32                     IOCIdentifier[4];   /* 2Ch */\n} MSG_INBAND_BUFFER_POST_REPLY, MPI_POINTER PTR_MSG_INBAND_BUFFER_POST_REPLY,\n  MpiInbandBufferPostReply_t, MPI_POINTER pMpiInbandBufferPostReply_t;\n\n\n/****************************************************************************/\n/* Inband Send Request                                                      */\n/****************************************************************************/\n\ntypedef struct _MSG_INBAND_SEND_REQUEST\n{\n    U16                     Reserved1;          /* 00h */\n    U8                      ChainOffset;        /* 02h */\n    U8                      Function;           /* 03h */\n    U16                     Reserved2;          /* 04h */\n    U8                      Reserved3;          /* 06h */\n    U8                      MsgFlags;           /* 07h */\n    U32                     MsgContext;         /* 08h */\n    U32                     Reserved4;          /* 0Ch */\n    WWN_INBAND_FORMAT       Wwn;                /* 10h */\n    U32                     Reserved5;          /* 20h */\n    SGE_IO_UNION            SGL;                /* 24h */\n} MSG_INBAND_SEND_REQUEST, MPI_POINTER PTR_MSG_INBAND_SEND_REQUEST,\n  MpiInbandSendRequest_t , MPI_POINTER pMpiInbandSendRequest_t;\n\n\n/* Inband Send reply message */\n\ntypedef struct _MSG_INBAND_SEND_REPLY\n{\n    U16                     Reserved1;          /* 00h */\n    U8                      MsgLength;          /* 02h */\n    U8                      Function;           /* 03h */\n    U16                     Reserved2;          /* 04h */\n    U8                      Reserved3;          /* 06h */\n    U8                      MsgFlags;           /* 07h */\n    U32                     MsgContext;         /* 08h */\n    U16                     Reserved4;          /* 0Ch */\n    U16                     IOCStatus;          /* 0Eh */\n    U32                     IOCLogInfo;         /* 10h */\n    U32                     ResponseLength;     /* 14h */\n} MSG_INBAND_SEND_REPLY, MPI_POINTER PTR_MSG_INBAND_SEND_REPLY,\n  MpiInbandSendReply_t, MPI_POINTER pMpiInbandSendReply_t;\n\n\n/****************************************************************************/\n/* Inband Response Request                                                  */\n/****************************************************************************/\n\ntypedef struct _MSG_INBAND_RSP_REQUEST\n{\n    U16                     Reserved1;          /* 00h */\n    U8                      ChainOffset;        /* 02h */\n    U8                      Function;           /* 03h */\n    U16                     Reserved2;          /* 04h */\n    U8                      Reserved3;          /* 06h */\n    U8                      MsgFlags;           /* 07h */\n    U32                     MsgContext;         /* 08h */\n    U32                     Reserved4;          /* 0Ch */\n    WWN_INBAND_FORMAT       Wwn;                /* 10h */\n    U32                     IOCIdentifier[4];   /* 20h */\n    U32                     ResponseLength;     /* 30h */\n    SGE_IO_UNION            SGL;                /* 34h */\n} MSG_INBAND_RSP_REQUEST, MPI_POINTER PTR_MSG_INBAND_RSP_REQUEST,\n  MpiInbandRspRequest_t , MPI_POINTER pMpiInbandRspRequest_t;\n\n\n/* Inband Response reply message */\n\ntypedef struct _MSG_INBAND_RSP_REPLY\n{\n    U16                     Reserved1;          /* 00h */\n    U8                      MsgLength;          /* 02h */\n    U8                      Function;           /* 03h */\n    U16                     Reserved2;          /* 04h */\n    U8                      Reserved3;          /* 06h */\n    U8                      MsgFlags;           /* 07h */\n    U32                     MsgContext;         /* 08h */\n    U16                     Reserved4;          /* 0Ch */\n    U16                     IOCStatus;          /* 0Eh */\n    U32                     IOCLogInfo;         /* 10h */\n} MSG_INBAND_RSP_REPLY, MPI_POINTER PTR_MSG_INBAND_RSP_REPLY,\n  MpiInbandRspReply_t, MPI_POINTER pMpiInbandRspReply_t;\n\n\n/****************************************************************************/\n/* Inband Abort Request                                                     */\n/****************************************************************************/\n\ntypedef struct _MSG_INBAND_ABORT_REQUEST\n{\n    U8                      Reserved1;          /* 00h */\n    U8                      AbortType;          /* 01h */\n    U8                      ChainOffset;        /* 02h */\n    U8                      Function;           /* 03h */\n    U16                     Reserved2;          /* 04h */\n    U8                      Reserved3;          /* 06h */\n    U8                      MsgFlags;           /* 07h */\n    U32                     MsgContext;         /* 08h */\n    U32                     Reserved4;          /* 0Ch */\n    U32                     ContextToAbort;     /* 10h */\n} MSG_INBAND_ABORT_REQUEST, MPI_POINTER PTR_MSG_INBAND_ABORT_REQUEST,\n  MpiInbandAbortRequest_t , MPI_POINTER pMpiInbandAbortRequest_t;\n\n#define MPI_INBAND_ABORT_TYPE_ALL_BUFFERS       (0x00)\n#define MPI_INBAND_ABORT_TYPE_EXACT_BUFFER      (0x01)\n#define MPI_INBAND_ABORT_TYPE_SEND_REQUEST      (0x02)\n#define MPI_INBAND_ABORT_TYPE_RESPONSE_REQUEST  (0x03)\n\n\n/* Inband Abort reply message */\n\ntypedef struct _MSG_INBAND_ABORT_REPLY\n{\n    U8                      Reserved1;          /* 00h */\n    U8                      AbortType;          /* 01h */\n    U8                      MsgLength;          /* 02h */\n    U8                      Function;           /* 03h */\n    U16                     Reserved2;          /* 04h */\n    U8                      Reserved3;          /* 06h */\n    U8                      MsgFlags;           /* 07h */\n    U32                     MsgContext;         /* 08h */\n    U16                     Reserved4;          /* 0Ch */\n    U16                     IOCStatus;          /* 0Eh */\n    U32                     IOCLogInfo;         /* 10h */\n} MSG_INBAND_ABORT_REPLY, MPI_POINTER PTR_MSG_INBAND_ABORT_REPLY,\n  MpiInbandAbortReply_t, MPI_POINTER pMpiInbandAbortReply_t;\n\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/dev/mpt/mpilib/mpi_init.h",
    "content": "/* $FreeBSD: release/9.0.0/sys/dev/mpt/mpilib/mpi_init.h 170251 2007-06-03 22:58:27Z scottl $ */\n/*-\n * Copyright (c) 2000-2005, LSI Logic Corporation and its contributors.\n * All rights reserved.\n * \n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions are\n * met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce at minimum a disclaimer\n *    substantially similar to the \"NO WARRANTY\" disclaimer below\n *    (\"Disclaimer\") and any redistribution must be conditioned upon including\n *    a substantially similar Disclaimer requirement for further binary\n *    redistribution.\n * 3. Neither the name of the LSI Logic Corporation nor the names of its\n *    contributors may be used to endorse or promote products derived from\n *    this software without specific prior written permission.\n * \n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\n * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE\n * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\n * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\n * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\n * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\n * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF THE COPYRIGHT\n * OWNER OR CONTRIBUTOR IS ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n *\n *           Name:  mpi_init.h\n *          Title:  MPI initiator mode messages and structures\n *  Creation Date:  June 8, 2000\n *\n *    mpi_init.h Version:  01.05.09\n *\n *  Version History\n *  ---------------\n *\n *  Date      Version   Description\n *  --------  --------  ------------------------------------------------------\n *  05-08-00  00.10.01  Original release for 0.10 spec dated 4/26/2000.\n *  05-24-00  00.10.02  Added SenseBufferLength to _MSG_SCSI_IO_REPLY.\n *  06-06-00  01.00.01  Update version number for 1.0 release.\n *  06-08-00  01.00.02  Added MPI_SCSI_RSP_INFO_ definitions.\n *  11-02-00  01.01.01  Original release for post 1.0 work.\n *  12-04-00  01.01.02  Added MPI_SCSIIO_CONTROL_NO_DISCONNECT.\n *  02-20-01  01.01.03  Started using MPI_POINTER.\n *  03-27-01  01.01.04  Added structure offset comments.\n *  04-10-01  01.01.05  Added new MsgFlag for MSG_SCSI_TASK_MGMT.\n *  08-08-01  01.02.01  Original release for v1.2 work.\n *  08-29-01  01.02.02  Added MPI_SCSITASKMGMT_TASKTYPE_LOGICAL_UNIT_RESET.\n *                      Added MPI_SCSI_STATE_QUEUE_TAG_REJECTED for\n *                      MSG_SCSI_IO_REPLY.\n *  09-28-01  01.02.03  Added structures and defines for SCSI Enclosure\n *                      Processor messages.\n *  10-04-01  01.02.04  Added defines for SEP request Action field.\n *  05-31-02  01.02.05  Added MPI_SCSIIO_MSGFLGS_CMD_DETERMINES_DATA_DIR define\n *                      for SCSI IO requests.\n *  11-15-02  01.02.06  Added special extended SCSI Status defines for FCP.\n *  06-26-03  01.02.07  Added MPI_SCSI_STATUS_FCPEXT_UNASSIGNED define.\n *  05-11-04  01.03.01  Original release for MPI v1.3.\n *  08-19-04  01.05.01  Added MsgFlags defines for EEDP to SCSI IO request.\n *                      Added new word to MSG_SCSI_IO_REPLY to add TaskTag field\n *                      and a reserved U16.\n *                      Added new MSG_SCSI_IO32_REQUEST structure.\n *                      Added a TaskType of Clear Task Set to SCSI\n *                      Task Management request.\n *  12-07-04  01.05.02  Added support for Task Management Query Task.\n *  01-15-05  01.05.03  Modified SCSI Enclosure Processor Request to support\n *                      WWID addressing.\n *  03-11-05  01.05.04  Removed EEDP flags from SCSI IO Request.\n *                      Removed SCSI IO 32 Request.\n *                      Modified SCSI Enclosure Processor Request and Reply to\n *                      support Enclosure/Slot addressing rather than WWID\n *                      addressing.\n *  06-24-05  01.05.05  Added SCSI IO 32 structures and defines.\n *                      Added four new defines for SEP SlotStatus.\n *  08-03-05  01.05.06  Fixed some MPI_SCSIIO32_MSGFLGS_ defines to make them\n *                      unique in the first 32 characters.\n *  03-27-06  01.05.07  Added Task Management type of Clear ACA.\n *  10-11-06  01.05.08  Shortened define for Task Management type of Clear ACA.\n *  02-28-07  01.05.09  Defined two new MsgFlags bits for SCSI Task Management\n *                      Request: Do Not Send Task IU and Soft Reset Option.\n *  --------------------------------------------------------------------------\n */\n\n#ifndef MPI_INIT_H\n#define MPI_INIT_H\n\n\n/*****************************************************************************\n*\n*               S C S I    I n i t i a t o r    M e s s a g e s\n*\n*****************************************************************************/\n\n/****************************************************************************/\n/*  SCSI IO messages and associated structures                              */\n/****************************************************************************/\n\ntypedef struct _MSG_SCSI_IO_REQUEST\n{\n    U8                      TargetID;           /* 00h */\n    U8                      Bus;                /* 01h */\n    U8                      ChainOffset;        /* 02h */\n    U8                      Function;           /* 03h */\n    U8                      CDBLength;          /* 04h */\n    U8                      SenseBufferLength;  /* 05h */\n    U8                      Reserved;           /* 06h */\n    U8                      MsgFlags;           /* 07h */\n    U32                     MsgContext;         /* 08h */\n    U8                      LUN[8];             /* 0Ch */\n    U32                     Control;            /* 14h */\n    U8                      CDB[16];            /* 18h */\n    U32                     DataLength;         /* 28h */\n    U32                     SenseBufferLowAddr; /* 2Ch */\n    SGE_IO_UNION            SGL;                /* 30h */\n} MSG_SCSI_IO_REQUEST, MPI_POINTER PTR_MSG_SCSI_IO_REQUEST,\n  SCSIIORequest_t, MPI_POINTER pSCSIIORequest_t;\n\n\n/* SCSI IO MsgFlags bits */\n\n#define MPI_SCSIIO_MSGFLGS_SENSE_WIDTH              (0x01)\n#define MPI_SCSIIO_MSGFLGS_SENSE_WIDTH_32           (0x00)\n#define MPI_SCSIIO_MSGFLGS_SENSE_WIDTH_64           (0x01)\n\n#define MPI_SCSIIO_MSGFLGS_SENSE_LOCATION           (0x02)\n#define MPI_SCSIIO_MSGFLGS_SENSE_LOC_HOST           (0x00)\n#define MPI_SCSIIO_MSGFLGS_SENSE_LOC_IOC            (0x02)\n\n#define MPI_SCSIIO_MSGFLGS_CMD_DETERMINES_DATA_DIR  (0x04)\n\n/* SCSI IO LUN fields */\n\n#define MPI_SCSIIO_LUN_FIRST_LEVEL_ADDRESSING   (0x0000FFFF)\n#define MPI_SCSIIO_LUN_SECOND_LEVEL_ADDRESSING  (0xFFFF0000)\n#define MPI_SCSIIO_LUN_THIRD_LEVEL_ADDRESSING   (0x0000FFFF)\n#define MPI_SCSIIO_LUN_FOURTH_LEVEL_ADDRESSING  (0xFFFF0000)\n#define MPI_SCSIIO_LUN_LEVEL_1_WORD             (0xFF00)\n#define MPI_SCSIIO_LUN_LEVEL_1_DWORD            (0x0000FF00)\n\n/* SCSI IO Control bits */\n\n#define MPI_SCSIIO_CONTROL_DATADIRECTION_MASK   (0x03000000)\n#define MPI_SCSIIO_CONTROL_NODATATRANSFER       (0x00000000)\n#define MPI_SCSIIO_CONTROL_WRITE                (0x01000000)\n#define MPI_SCSIIO_CONTROL_READ                 (0x02000000)\n\n#define MPI_SCSIIO_CONTROL_ADDCDBLEN_MASK       (0x3C000000)\n#define MPI_SCSIIO_CONTROL_ADDCDBLEN_SHIFT      (26)\n\n#define MPI_SCSIIO_CONTROL_TASKATTRIBUTE_MASK   (0x00000700)\n#define MPI_SCSIIO_CONTROL_SIMPLEQ              (0x00000000)\n#define MPI_SCSIIO_CONTROL_HEADOFQ              (0x00000100)\n#define MPI_SCSIIO_CONTROL_ORDEREDQ             (0x00000200)\n#define MPI_SCSIIO_CONTROL_ACAQ                 (0x00000400)\n#define MPI_SCSIIO_CONTROL_UNTAGGED             (0x00000500)\n#define MPI_SCSIIO_CONTROL_NO_DISCONNECT        (0x00000700)\n\n#define MPI_SCSIIO_CONTROL_TASKMANAGE_MASK      (0x00FF0000)\n#define MPI_SCSIIO_CONTROL_OBSOLETE             (0x00800000)\n#define MPI_SCSIIO_CONTROL_CLEAR_ACA_RSV        (0x00400000)\n#define MPI_SCSIIO_CONTROL_TARGET_RESET         (0x00200000)\n#define MPI_SCSIIO_CONTROL_LUN_RESET_RSV        (0x00100000)\n#define MPI_SCSIIO_CONTROL_RESERVED             (0x00080000)\n#define MPI_SCSIIO_CONTROL_CLR_TASK_SET_RSV     (0x00040000)\n#define MPI_SCSIIO_CONTROL_ABORT_TASK_SET       (0x00020000)\n#define MPI_SCSIIO_CONTROL_RESERVED2            (0x00010000)\n\n\n/* SCSI IO reply structure */\ntypedef struct _MSG_SCSI_IO_REPLY\n{\n    U8                      TargetID;           /* 00h */\n    U8                      Bus;                /* 01h */\n    U8                      MsgLength;          /* 02h */\n    U8                      Function;           /* 03h */\n    U8                      CDBLength;          /* 04h */\n    U8                      SenseBufferLength;  /* 05h */\n    U8                      Reserved;           /* 06h */\n    U8                      MsgFlags;           /* 07h */\n    U32                     MsgContext;         /* 08h */\n    U8                      SCSIStatus;         /* 0Ch */\n    U8                      SCSIState;          /* 0Dh */\n    U16                     IOCStatus;          /* 0Eh */\n    U32                     IOCLogInfo;         /* 10h */\n    U32                     TransferCount;      /* 14h */\n    U32                     SenseCount;         /* 18h */\n    U32                     ResponseInfo;       /* 1Ch */\n    U16                     TaskTag;            /* 20h */\n    U16                     Reserved1;          /* 22h */\n} MSG_SCSI_IO_REPLY, MPI_POINTER PTR_MSG_SCSI_IO_REPLY,\n  SCSIIOReply_t, MPI_POINTER pSCSIIOReply_t;\n\n\n/* SCSI IO Reply SCSIStatus values (SAM-2 status codes) */\n\n#define MPI_SCSI_STATUS_SUCCESS                 (0x00)\n#define MPI_SCSI_STATUS_CHECK_CONDITION         (0x02)\n#define MPI_SCSI_STATUS_CONDITION_MET           (0x04)\n#define MPI_SCSI_STATUS_BUSY                    (0x08)\n#define MPI_SCSI_STATUS_INTERMEDIATE            (0x10)\n#define MPI_SCSI_STATUS_INTERMEDIATE_CONDMET    (0x14)\n#define MPI_SCSI_STATUS_RESERVATION_CONFLICT    (0x18)\n#define MPI_SCSI_STATUS_COMMAND_TERMINATED      (0x22)\n#define MPI_SCSI_STATUS_TASK_SET_FULL           (0x28)\n#define MPI_SCSI_STATUS_ACA_ACTIVE              (0x30)\n\n#define MPI_SCSI_STATUS_FCPEXT_DEVICE_LOGGED_OUT    (0x80)\n#define MPI_SCSI_STATUS_FCPEXT_NO_LINK              (0x81)\n#define MPI_SCSI_STATUS_FCPEXT_UNASSIGNED           (0x82)\n\n\n/* SCSI IO Reply SCSIState values */\n\n#define MPI_SCSI_STATE_AUTOSENSE_VALID          (0x01)\n#define MPI_SCSI_STATE_AUTOSENSE_FAILED         (0x02)\n#define MPI_SCSI_STATE_NO_SCSI_STATUS           (0x04)\n#define MPI_SCSI_STATE_TERMINATED               (0x08)\n#define MPI_SCSI_STATE_RESPONSE_INFO_VALID      (0x10)\n#define MPI_SCSI_STATE_QUEUE_TAG_REJECTED       (0x20)\n\n/* SCSI IO Reply ResponseInfo values */\n/* (FCP-1 RSP_CODE values and SPI-3 Packetized Failure codes) */\n\n#define MPI_SCSI_RSP_INFO_FUNCTION_COMPLETE     (0x00000000)\n#define MPI_SCSI_RSP_INFO_FCP_BURST_LEN_ERROR   (0x01000000)\n#define MPI_SCSI_RSP_INFO_CMND_FIELDS_INVALID   (0x02000000)\n#define MPI_SCSI_RSP_INFO_FCP_DATA_RO_ERROR     (0x03000000)\n#define MPI_SCSI_RSP_INFO_TASK_MGMT_UNSUPPORTED (0x04000000)\n#define MPI_SCSI_RSP_INFO_TASK_MGMT_FAILED      (0x05000000)\n#define MPI_SCSI_RSP_INFO_SPI_LQ_INVALID_TYPE   (0x06000000)\n\n#define MPI_SCSI_TASKTAG_UNKNOWN                (0xFFFF)\n\n\n/****************************************************************************/\n/*  SCSI IO 32 messages and associated structures                           */\n/****************************************************************************/\n\ntypedef struct\n{\n    U8                      CDB[20];                    /* 00h */\n    U32                     PrimaryReferenceTag;        /* 14h */\n    U16                     PrimaryApplicationTag;      /* 18h */\n    U16                     PrimaryApplicationTagMask;  /* 1Ah */\n    U32                     TransferLength;             /* 1Ch */\n} MPI_SCSI_IO32_CDB_EEDP32, MPI_POINTER PTR_MPI_SCSI_IO32_CDB_EEDP32,\n  MpiScsiIo32CdbEedp32_t, MPI_POINTER pMpiScsiIo32CdbEedp32_t;\n\ntypedef struct\n{\n    U8                      CDB[16];                    /* 00h */\n    U32                     DataLength;                 /* 10h */\n    U32                     PrimaryReferenceTag;        /* 14h */\n    U16                     PrimaryApplicationTag;      /* 18h */\n    U16                     PrimaryApplicationTagMask;  /* 1Ah */\n    U32                     TransferLength;             /* 1Ch */\n} MPI_SCSI_IO32_CDB_EEDP16, MPI_POINTER PTR_MPI_SCSI_IO32_CDB_EEDP16,\n  MpiScsiIo32CdbEedp16_t, MPI_POINTER pMpiScsiIo32CdbEedp16_t;\n\ntypedef union\n{\n    U8                       CDB32[32];\n    MPI_SCSI_IO32_CDB_EEDP32 EEDP32;\n    MPI_SCSI_IO32_CDB_EEDP16 EEDP16;\n    SGE_SIMPLE_UNION         SGE;\n} MPI_SCSI_IO32_CDB_UNION, MPI_POINTER PTR_MPI_SCSI_IO32_CDB_UNION,\n  MpiScsiIo32Cdb_t, MPI_POINTER pMpiScsiIo32Cdb_t;\n\ntypedef struct\n{\n    U8                      TargetID;           /* 00h */\n    U8                      Bus;                /* 01h */\n    U16                     Reserved1;          /* 02h */\n    U32                     Reserved2;          /* 04h */\n} MPI_SCSI_IO32_BUS_TARGET_ID_FORM, MPI_POINTER PTR_MPI_SCSI_IO32_BUS_TARGET_ID_FORM,\n  MpiScsiIo32BusTargetIdForm_t, MPI_POINTER pMpiScsiIo32BusTargetIdForm_t;\n\ntypedef union\n{\n    MPI_SCSI_IO32_BUS_TARGET_ID_FORM    SCSIID;\n    U64                                 WWID;\n} MPI_SCSI_IO32_ADDRESS, MPI_POINTER PTR_MPI_SCSI_IO32_ADDRESS,\n  MpiScsiIo32Address_t, MPI_POINTER pMpiScsiIo32Address_t;\n\ntypedef struct _MSG_SCSI_IO32_REQUEST\n{\n    U8                          Port;                           /* 00h */\n    U8                          Reserved1;                      /* 01h */\n    U8                          ChainOffset;                    /* 02h */\n    U8                          Function;                       /* 03h */\n    U8                          CDBLength;                      /* 04h */\n    U8                          SenseBufferLength;              /* 05h */\n    U8                          Flags;                          /* 06h */\n    U8                          MsgFlags;                       /* 07h */\n    U32                         MsgContext;                     /* 08h */\n    U8                          LUN[8];                         /* 0Ch */\n    U32                         Control;                        /* 14h */\n    MPI_SCSI_IO32_CDB_UNION     CDB;                            /* 18h */\n    U32                         DataLength;                     /* 38h */\n    U32                         BidirectionalDataLength;        /* 3Ch */\n    U32                         SecondaryReferenceTag;          /* 40h */\n    U16                         SecondaryApplicationTag;        /* 44h */\n    U16                         Reserved2;                      /* 46h */\n    U16                         EEDPFlags;                      /* 48h */\n    U16                         ApplicationTagTranslationMask;  /* 4Ah */\n    U32                         EEDPBlockSize;                  /* 4Ch */\n    MPI_SCSI_IO32_ADDRESS       DeviceAddress;                  /* 50h */\n    U8                          SGLOffset0;                     /* 58h */\n    U8                          SGLOffset1;                     /* 59h */\n    U8                          SGLOffset2;                     /* 5Ah */\n    U8                          SGLOffset3;                     /* 5Bh */\n    U32                         Reserved3;                      /* 5Ch */\n    U32                         Reserved4;                      /* 60h */\n    U32                         SenseBufferLowAddr;             /* 64h */\n    SGE_IO_UNION                SGL;                            /* 68h */\n} MSG_SCSI_IO32_REQUEST, MPI_POINTER PTR_MSG_SCSI_IO32_REQUEST,\n  SCSIIO32Request_t, MPI_POINTER pSCSIIO32Request_t;\n\n/* SCSI IO 32 MsgFlags bits */\n#define MPI_SCSIIO32_MSGFLGS_SENSE_WIDTH                (0x01)\n#define MPI_SCSIIO32_MSGFLGS_32_SENSE_WIDTH             (0x00)\n#define MPI_SCSIIO32_MSGFLGS_64_SENSE_WIDTH             (0x01)\n\n#define MPI_SCSIIO32_MSGFLGS_SENSE_LOCATION             (0x02)\n#define MPI_SCSIIO32_MSGFLGS_SENSE_LOC_HOST             (0x00)\n#define MPI_SCSIIO32_MSGFLGS_SENSE_LOC_IOC              (0x02)\n\n#define MPI_SCSIIO32_MSGFLGS_CMD_DETERMINES_DATA_DIR    (0x04)\n#define MPI_SCSIIO32_MSGFLGS_SGL_OFFSETS_CHAINS         (0x08)\n#define MPI_SCSIIO32_MSGFLGS_MULTICAST                  (0x10)\n#define MPI_SCSIIO32_MSGFLGS_BIDIRECTIONAL              (0x20)\n#define MPI_SCSIIO32_MSGFLGS_LARGE_CDB                  (0x40)\n\n/* SCSI IO 32 Flags bits */\n#define MPI_SCSIIO32_FLAGS_FORM_MASK                    (0x03)\n#define MPI_SCSIIO32_FLAGS_FORM_SCSIID                  (0x00)\n#define MPI_SCSIIO32_FLAGS_FORM_WWID                    (0x01)\n\n/* SCSI IO 32 LUN fields */\n#define MPI_SCSIIO32_LUN_FIRST_LEVEL_ADDRESSING     (0x0000FFFF)\n#define MPI_SCSIIO32_LUN_SECOND_LEVEL_ADDRESSING    (0xFFFF0000)\n#define MPI_SCSIIO32_LUN_THIRD_LEVEL_ADDRESSING     (0x0000FFFF)\n#define MPI_SCSIIO32_LUN_FOURTH_LEVEL_ADDRESSING    (0xFFFF0000)\n#define MPI_SCSIIO32_LUN_LEVEL_1_WORD               (0xFF00)\n#define MPI_SCSIIO32_LUN_LEVEL_1_DWORD              (0x0000FF00)\n\n/* SCSI IO 32 Control bits */\n#define MPI_SCSIIO32_CONTROL_DATADIRECTION_MASK     (0x03000000)\n#define MPI_SCSIIO32_CONTROL_NODATATRANSFER         (0x00000000)\n#define MPI_SCSIIO32_CONTROL_WRITE                  (0x01000000)\n#define MPI_SCSIIO32_CONTROL_READ                   (0x02000000)\n#define MPI_SCSIIO32_CONTROL_BIDIRECTIONAL          (0x03000000)\n\n#define MPI_SCSIIO32_CONTROL_ADDCDBLEN_MASK         (0xFC000000)\n#define MPI_SCSIIO32_CONTROL_ADDCDBLEN_SHIFT        (26)\n\n#define MPI_SCSIIO32_CONTROL_TASKATTRIBUTE_MASK     (0x00000700)\n#define MPI_SCSIIO32_CONTROL_SIMPLEQ                (0x00000000)\n#define MPI_SCSIIO32_CONTROL_HEADOFQ                (0x00000100)\n#define MPI_SCSIIO32_CONTROL_ORDEREDQ               (0x00000200)\n#define MPI_SCSIIO32_CONTROL_ACAQ                   (0x00000400)\n#define MPI_SCSIIO32_CONTROL_UNTAGGED               (0x00000500)\n#define MPI_SCSIIO32_CONTROL_NO_DISCONNECT          (0x00000700)\n\n#define MPI_SCSIIO32_CONTROL_TASKMANAGE_MASK        (0x00FF0000)\n#define MPI_SCSIIO32_CONTROL_OBSOLETE               (0x00800000)\n#define MPI_SCSIIO32_CONTROL_CLEAR_ACA_RSV          (0x00400000)\n#define MPI_SCSIIO32_CONTROL_TARGET_RESET           (0x00200000)\n#define MPI_SCSIIO32_CONTROL_LUN_RESET_RSV          (0x00100000)\n#define MPI_SCSIIO32_CONTROL_RESERVED               (0x00080000)\n#define MPI_SCSIIO32_CONTROL_CLR_TASK_SET_RSV       (0x00040000)\n#define MPI_SCSIIO32_CONTROL_ABORT_TASK_SET         (0x00020000)\n#define MPI_SCSIIO32_CONTROL_RESERVED2              (0x00010000)\n\n/* SCSI IO 32 EEDPFlags */\n#define MPI_SCSIIO32_EEDPFLAGS_MASK_OP              (0x0007)\n#define MPI_SCSIIO32_EEDPFLAGS_NOOP_OP              (0x0000)\n#define MPI_SCSIIO32_EEDPFLAGS_CHK_OP               (0x0001)\n#define MPI_SCSIIO32_EEDPFLAGS_STRIP_OP             (0x0002)\n#define MPI_SCSIIO32_EEDPFLAGS_CHKRM_OP             (0x0003)\n#define MPI_SCSIIO32_EEDPFLAGS_INSERT_OP            (0x0004)\n#define MPI_SCSIIO32_EEDPFLAGS_REPLACE_OP           (0x0006)\n#define MPI_SCSIIO32_EEDPFLAGS_CHKREGEN_OP          (0x0007)\n\n#define MPI_SCSIIO32_EEDPFLAGS_PASS_REF_TAG         (0x0008)\n#define MPI_SCSIIO32_EEDPFLAGS_8_9THS_MODE          (0x0010)\n\n#define MPI_SCSIIO32_EEDPFLAGS_T10_CHK_MASK         (0x0700)\n#define MPI_SCSIIO32_EEDPFLAGS_T10_CHK_GUARD        (0x0100)\n#define MPI_SCSIIO32_EEDPFLAGS_T10_CHK_REFTAG       (0x0200)\n#define MPI_SCSIIO32_EEDPFLAGS_T10_CHK_LBATAG       (0x0400)\n#define MPI_SCSIIO32_EEDPFLAGS_T10_CHK_SHIFT        (8)\n\n#define MPI_SCSIIO32_EEDPFLAGS_INC_SEC_APPTAG       (0x1000)\n#define MPI_SCSIIO32_EEDPFLAGS_INC_PRI_APPTAG       (0x2000)\n#define MPI_SCSIIO32_EEDPFLAGS_INC_SEC_REFTAG       (0x4000)\n#define MPI_SCSIIO32_EEDPFLAGS_INC_PRI_REFTAG       (0x8000)\n\n\n/* SCSIIO32 IO reply structure */\ntypedef struct _MSG_SCSIIO32_IO_REPLY\n{\n    U8                      Port;                       /* 00h */\n    U8                      Reserved1;                  /* 01h */\n    U8                      MsgLength;                  /* 02h */\n    U8                      Function;                   /* 03h */\n    U8                      CDBLength;                  /* 04h */\n    U8                      SenseBufferLength;          /* 05h */\n    U8                      Flags;                      /* 06h */\n    U8                      MsgFlags;                   /* 07h */\n    U32                     MsgContext;                 /* 08h */\n    U8                      SCSIStatus;                 /* 0Ch */\n    U8                      SCSIState;                  /* 0Dh */\n    U16                     IOCStatus;                  /* 0Eh */\n    U32                     IOCLogInfo;                 /* 10h */\n    U32                     TransferCount;              /* 14h */\n    U32                     SenseCount;                 /* 18h */\n    U32                     ResponseInfo;               /* 1Ch */\n    U16                     TaskTag;                    /* 20h */\n    U16                     Reserved2;                  /* 22h */\n    U32                     BidirectionalTransferCount; /* 24h */\n} MSG_SCSIIO32_IO_REPLY, MPI_POINTER PTR_MSG_SCSIIO32_IO_REPLY,\n  SCSIIO32Reply_t, MPI_POINTER pSCSIIO32Reply_t;\n\n\n/****************************************************************************/\n/*  SCSI Task Management messages                                           */\n/****************************************************************************/\n\ntypedef struct _MSG_SCSI_TASK_MGMT\n{\n    U8                      TargetID;           /* 00h */\n    U8                      Bus;                /* 01h */\n    U8                      ChainOffset;        /* 02h */\n    U8                      Function;           /* 03h */\n    U8                      Reserved;           /* 04h */\n    U8                      TaskType;           /* 05h */\n    U8                      Reserved1;          /* 06h */\n    U8                      MsgFlags;           /* 07h */\n    U32                     MsgContext;         /* 08h */\n    U8                      LUN[8];             /* 0Ch */\n    U32                     Reserved2[7];       /* 14h */\n    U32                     TaskMsgContext;     /* 30h */\n} MSG_SCSI_TASK_MGMT, MPI_POINTER PTR_SCSI_TASK_MGMT,\n  SCSITaskMgmt_t, MPI_POINTER pSCSITaskMgmt_t;\n\n/* TaskType values */\n\n#define MPI_SCSITASKMGMT_TASKTYPE_ABORT_TASK            (0x01)\n#define MPI_SCSITASKMGMT_TASKTYPE_ABRT_TASK_SET         (0x02)\n#define MPI_SCSITASKMGMT_TASKTYPE_TARGET_RESET          (0x03)\n#define MPI_SCSITASKMGMT_TASKTYPE_RESET_BUS             (0x04)\n#define MPI_SCSITASKMGMT_TASKTYPE_LOGICAL_UNIT_RESET    (0x05)\n#define MPI_SCSITASKMGMT_TASKTYPE_CLEAR_TASK_SET        (0x06)\n#define MPI_SCSITASKMGMT_TASKTYPE_QUERY_TASK            (0x07)\n#define MPI_SCSITASKMGMT_TASKTYPE_CLR_ACA               (0x08)\n\n/* MsgFlags bits */\n#define MPI_SCSITASKMGMT_MSGFLAGS_DO_NOT_SEND_TASK_IU   (0x01)\n\n#define MPI_SCSITASKMGMT_MSGFLAGS_TARGET_RESET_OPTION   (0x00)\n#define MPI_SCSITASKMGMT_MSGFLAGS_LIP_RESET_OPTION      (0x02)\n#define MPI_SCSITASKMGMT_MSGFLAGS_LIPRESET_RESET_OPTION (0x04)\n\n#define MPI_SCSITASKMGMT_MSGFLAGS_SOFT_RESET_OPTION     (0x08)\n\n/* SCSI Task Management Reply */\ntypedef struct _MSG_SCSI_TASK_MGMT_REPLY\n{\n    U8                      TargetID;           /* 00h */\n    U8                      Bus;                /* 01h */\n    U8                      MsgLength;          /* 02h */\n    U8                      Function;           /* 03h */\n    U8                      ResponseCode;       /* 04h */\n    U8                      TaskType;           /* 05h */\n    U8                      Reserved1;          /* 06h */\n    U8                      MsgFlags;           /* 07h */\n    U32                     MsgContext;         /* 08h */\n    U8                      Reserved2[2];       /* 0Ch */\n    U16                     IOCStatus;          /* 0Eh */\n    U32                     IOCLogInfo;         /* 10h */\n    U32                     TerminationCount;   /* 14h */\n} MSG_SCSI_TASK_MGMT_REPLY, MPI_POINTER PTR_MSG_SCSI_TASK_MGMT_REPLY,\n  SCSITaskMgmtReply_t, MPI_POINTER pSCSITaskMgmtReply_t;\n\n/* ResponseCode values */\n#define MPI_SCSITASKMGMT_RSP_TM_COMPLETE                (0x00)\n#define MPI_SCSITASKMGMT_RSP_INVALID_FRAME              (0x02)\n#define MPI_SCSITASKMGMT_RSP_TM_NOT_SUPPORTED           (0x04)\n#define MPI_SCSITASKMGMT_RSP_TM_FAILED                  (0x05)\n#define MPI_SCSITASKMGMT_RSP_TM_SUCCEEDED               (0x08)\n#define MPI_SCSITASKMGMT_RSP_TM_INVALID_LUN             (0x09)\n#define MPI_SCSITASKMGMT_RSP_IO_QUEUED_ON_IOC           (0x80)\n\n\n/****************************************************************************/\n/*  SCSI Enclosure Processor messages                                       */\n/****************************************************************************/\n\ntypedef struct _MSG_SEP_REQUEST\n{\n    U8                      TargetID;           /* 00h */\n    U8                      Bus;                /* 01h */\n    U8                      ChainOffset;        /* 02h */\n    U8                      Function;           /* 03h */\n    U8                      Action;             /* 04h */\n    U8                      Flags;              /* 05h */\n    U8                      Reserved1;          /* 06h */\n    U8                      MsgFlags;           /* 07h */\n    U32                     MsgContext;         /* 08h */\n    U32                     SlotStatus;         /* 0Ch */\n    U32                     Reserved2;          /* 10h */\n    U32                     Reserved3;          /* 14h */\n    U32                     Reserved4;          /* 18h */\n    U16                     Slot;               /* 1Ch */\n    U16                     EnclosureHandle;    /* 1Eh */\n} MSG_SEP_REQUEST, MPI_POINTER PTR_MSG_SEP_REQUEST,\n  SEPRequest_t, MPI_POINTER pSEPRequest_t;\n\n/* Action defines */\n#define MPI_SEP_REQ_ACTION_WRITE_STATUS                 (0x00)\n#define MPI_SEP_REQ_ACTION_READ_STATUS                  (0x01)\n\n/* Flags defines */\n#define MPI_SEP_REQ_FLAGS_ENCLOSURE_SLOT_ADDRESS        (0x01)\n#define MPI_SEP_REQ_FLAGS_BUS_TARGETID_ADDRESS          (0x00)\n\n/* SlotStatus bits for MSG_SEP_REQUEST */\n#define MPI_SEP_REQ_SLOTSTATUS_NO_ERROR                 (0x00000001)\n#define MPI_SEP_REQ_SLOTSTATUS_DEV_FAULTY               (0x00000002)\n#define MPI_SEP_REQ_SLOTSTATUS_DEV_REBUILDING           (0x00000004)\n#define MPI_SEP_REQ_SLOTSTATUS_IN_FAILED_ARRAY          (0x00000008)\n#define MPI_SEP_REQ_SLOTSTATUS_IN_CRITICAL_ARRAY        (0x00000010)\n#define MPI_SEP_REQ_SLOTSTATUS_PARITY_CHECK             (0x00000020)\n#define MPI_SEP_REQ_SLOTSTATUS_PREDICTED_FAULT          (0x00000040)\n#define MPI_SEP_REQ_SLOTSTATUS_UNCONFIGURED             (0x00000080)\n#define MPI_SEP_REQ_SLOTSTATUS_HOT_SPARE                (0x00000100)\n#define MPI_SEP_REQ_SLOTSTATUS_REBUILD_STOPPED          (0x00000200)\n#define MPI_SEP_REQ_SLOTSTATUS_REQ_CONSISTENCY_CHECK    (0x00001000)\n#define MPI_SEP_REQ_SLOTSTATUS_DISABLE                  (0x00002000)\n#define MPI_SEP_REQ_SLOTSTATUS_REQ_RESERVED_DEVICE      (0x00004000)\n#define MPI_SEP_REQ_SLOTSTATUS_IDENTIFY_REQUEST         (0x00020000)\n#define MPI_SEP_REQ_SLOTSTATUS_REQUEST_REMOVE           (0x00040000)\n#define MPI_SEP_REQ_SLOTSTATUS_REQUEST_INSERT           (0x00080000)\n#define MPI_SEP_REQ_SLOTSTATUS_DO_NOT_MOVE              (0x00400000)\n#define MPI_SEP_REQ_SLOTSTATUS_ACTIVE                   (0x00800000)\n#define MPI_SEP_REQ_SLOTSTATUS_B_ENABLE_BYPASS          (0x04000000)\n#define MPI_SEP_REQ_SLOTSTATUS_A_ENABLE_BYPASS          (0x08000000)\n#define MPI_SEP_REQ_SLOTSTATUS_DEV_OFF                  (0x10000000)\n#define MPI_SEP_REQ_SLOTSTATUS_SWAP_RESET               (0x80000000)\n\n\ntypedef struct _MSG_SEP_REPLY\n{\n    U8                      TargetID;           /* 00h */\n    U8                      Bus;                /* 01h */\n    U8                      MsgLength;          /* 02h */\n    U8                      Function;           /* 03h */\n    U8                      Action;             /* 04h */\n    U8                      Reserved1;          /* 05h */\n    U8                      Reserved2;          /* 06h */\n    U8                      MsgFlags;           /* 07h */\n    U32                     MsgContext;         /* 08h */\n    U16                     Reserved3;          /* 0Ch */\n    U16                     IOCStatus;          /* 0Eh */\n    U32                     IOCLogInfo;         /* 10h */\n    U32                     SlotStatus;         /* 14h */\n    U32                     Reserved4;          /* 18h */\n    U16                     Slot;               /* 1Ch */\n    U16                     EnclosureHandle;    /* 1Eh */\n} MSG_SEP_REPLY, MPI_POINTER PTR_MSG_SEP_REPLY,\n  SEPReply_t, MPI_POINTER pSEPReply_t;\n\n/* SlotStatus bits for MSG_SEP_REPLY */\n#define MPI_SEP_REPLY_SLOTSTATUS_NO_ERROR               (0x00000001)\n#define MPI_SEP_REPLY_SLOTSTATUS_DEV_FAULTY             (0x00000002)\n#define MPI_SEP_REPLY_SLOTSTATUS_DEV_REBUILDING         (0x00000004)\n#define MPI_SEP_REPLY_SLOTSTATUS_IN_FAILED_ARRAY        (0x00000008)\n#define MPI_SEP_REPLY_SLOTSTATUS_IN_CRITICAL_ARRAY      (0x00000010)\n#define MPI_SEP_REPLY_SLOTSTATUS_PARITY_CHECK           (0x00000020)\n#define MPI_SEP_REPLY_SLOTSTATUS_PREDICTED_FAULT        (0x00000040)\n#define MPI_SEP_REPLY_SLOTSTATUS_UNCONFIGURED           (0x00000080)\n#define MPI_SEP_REPLY_SLOTSTATUS_HOT_SPARE              (0x00000100)\n#define MPI_SEP_REPLY_SLOTSTATUS_REBUILD_STOPPED        (0x00000200)\n#define MPI_SEP_REPLY_SLOTSTATUS_CONSISTENCY_CHECK      (0x00001000)\n#define MPI_SEP_REPLY_SLOTSTATUS_DISABLE                (0x00002000)\n#define MPI_SEP_REPLY_SLOTSTATUS_RESERVED_DEVICE        (0x00004000)\n#define MPI_SEP_REPLY_SLOTSTATUS_REPORT                 (0x00010000)\n#define MPI_SEP_REPLY_SLOTSTATUS_IDENTIFY_REQUEST       (0x00020000)\n#define MPI_SEP_REPLY_SLOTSTATUS_REMOVE_READY           (0x00040000)\n#define MPI_SEP_REPLY_SLOTSTATUS_INSERT_READY           (0x00080000)\n#define MPI_SEP_REPLY_SLOTSTATUS_DO_NOT_REMOVE          (0x00400000)\n#define MPI_SEP_REPLY_SLOTSTATUS_ACTIVE                 (0x00800000)\n#define MPI_SEP_REPLY_SLOTSTATUS_B_BYPASS_ENABLED       (0x01000000)\n#define MPI_SEP_REPLY_SLOTSTATUS_A_BYPASS_ENABLED       (0x02000000)\n#define MPI_SEP_REPLY_SLOTSTATUS_B_ENABLE_BYPASS        (0x04000000)\n#define MPI_SEP_REPLY_SLOTSTATUS_A_ENABLE_BYPASS        (0x08000000)\n#define MPI_SEP_REPLY_SLOTSTATUS_DEV_OFF                (0x10000000)\n#define MPI_SEP_REPLY_SLOTSTATUS_FAULT_SENSED           (0x40000000)\n#define MPI_SEP_REPLY_SLOTSTATUS_SWAPPED                (0x80000000)\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/dev/mpt/mpilib/mpi_ioc.h",
    "content": "/* $FreeBSD: release/9.0.0/sys/dev/mpt/mpilib/mpi_ioc.h 224761 2011-08-10 19:05:22Z marius $ */\n/*-\n * Copyright (c) 2000-2005, LSI Logic Corporation and its contributors.\n * All rights reserved.\n * \n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions are\n * met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce at minimum a disclaimer\n *    substantially similar to the \"NO WARRANTY\" disclaimer below\n *    (\"Disclaimer\") and any redistribution must be conditioned upon including\n *    a substantially similar Disclaimer requirement for further binary\n *    redistribution.\n * 3. Neither the name of the LSI Logic Corporation nor the names of its\n *    contributors may be used to endorse or promote products derived from\n *    this software without specific prior written permission.\n * \n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\n * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE\n * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\n * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\n * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\n * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\n * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF THE COPYRIGHT\n * OWNER OR CONTRIBUTOR IS ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n *\n *           Name:  mpi_ioc.h\n *          Title:  MPI IOC, Port, Event, FW Download, and FW Upload messages\n *  Creation Date:  August 11, 2000\n *\n *    mpi_ioc.h Version:  01.05.16\n *\n *  Version History\n *  ---------------\n *\n *  Date      Version   Description\n *  --------  --------  ------------------------------------------------------\n *  05-08-00  00.10.01  Original release for 0.10 spec dated 4/26/2000.\n *  05-24-00  00.10.02  Added _MSG_IOC_INIT_REPLY structure.\n *  06-06-00  01.00.01  Added CurReplyFrameSize field to _MSG_IOC_FACTS_REPLY.\n *  06-12-00  01.00.02  Added _MSG_PORT_ENABLE_REPLY structure.\n *                      Added _MSG_EVENT_ACK_REPLY structure.\n *                      Added _MSG_FW_DOWNLOAD_REPLY structure.\n *                      Added _MSG_TOOLBOX_REPLY structure.\n *  06-30-00  01.00.03  Added MaxLanBuckets to _PORT_FACT_REPLY structure.\n *  07-27-00  01.00.04  Added _EVENT_DATA structure definitions for _SCSI,\n *                      _LINK_STATUS, _LOOP_STATE and _LOGOUT.\n *  08-11-00  01.00.05  Switched positions of MsgLength and Function fields in\n *                      _MSG_EVENT_ACK_REPLY structure to match specification.\n *  11-02-00  01.01.01  Original release for post 1.0 work.\n *                      Added a value for Manufacturer to WhoInit.\n *  12-04-00  01.01.02  Modified IOCFacts reply, added FWUpload messages, and\n *                      removed toolbox message.\n *  01-09-01  01.01.03  Added event enabled and disabled defines.\n *                      Added structures for FwHeader and DataHeader.\n *                      Added ImageType to FwUpload reply.\n *  02-20-01  01.01.04  Started using MPI_POINTER.\n *  02-27-01  01.01.05  Added event for RAID status change and its event data.\n *                      Added IocNumber field to MSG_IOC_FACTS_REPLY.\n *  03-27-01  01.01.06  Added defines for ProductId field of MPI_FW_HEADER.\n *                      Added structure offset comments.\n *  04-09-01  01.01.07  Added structure EVENT_DATA_EVENT_CHANGE.\n *  08-08-01  01.02.01  Original release for v1.2 work.\n *                      New format for FWVersion and ProductId in\n *                      MSG_IOC_FACTS_REPLY and MPI_FW_HEADER.\n *  08-31-01  01.02.02  Addded event MPI_EVENT_SCSI_DEVICE_STATUS_CHANGE and\n *                      related structure and defines.\n *                      Added event MPI_EVENT_ON_BUS_TIMER_EXPIRED.\n *                      Added MPI_IOCINIT_FLAGS_DISCARD_FW_IMAGE.\n *                      Replaced a reserved field in MSG_IOC_FACTS_REPLY with\n *                      IOCExceptions and changed DataImageSize to reserved.\n *                      Added MPI_FW_DOWNLOAD_ITYPE_NVSTORE_DATA and\n *                      MPI_FW_UPLOAD_ITYPE_NVDATA.\n *  09-28-01  01.02.03  Modified Event Data for Integrated RAID.\n *  11-01-01  01.02.04  Added defines for MPI_EXT_IMAGE_HEADER ImageType field.\n *  03-14-02  01.02.05  Added HeaderVersion field to MSG_IOC_FACTS_REPLY.\n *  05-31-02  01.02.06  Added define for\n *                      MPI_IOCFACTS_EXCEPT_RAID_CONFIG_INVALID.\n *                      Added AliasIndex to EVENT_DATA_LOGOUT structure.\n *  04-01-03  01.02.07  Added defines for MPI_FW_HEADER_SIGNATURE_.\n *  06-26-03  01.02.08  Added new values to the product family defines.\n *  04-29-04  01.02.09  Added IOCCapabilities field to MSG_IOC_FACTS_REPLY and\n *                      added related defines.\n *  05-11-04  01.03.01  Original release for MPI v1.3.\n *  08-19-04  01.05.01  Added four new fields to MSG_IOC_INIT.\n *                      Added three new fields to MSG_IOC_FACTS_REPLY.\n *                      Defined four new bits for the IOCCapabilities field of\n *                      the IOCFacts reply.\n *                      Added two new PortTypes for the PortFacts reply.\n *                      Added six new events along with their EventData\n *                      structures.\n *                      Added a new MsgFlag to the FwDownload request to\n *                      indicate last segment.\n *                      Defined a new image type of boot loader.\n *                      Added FW family codes for SAS product families.\n *  10-05-04  01.05.02  Added ReplyFifoHostSignalingAddr field to\n *                      MSG_IOC_FACTS_REPLY.\n *  12-07-04  01.05.03  Added more defines for SAS Discovery Error event.\n *  12-09-04  01.05.04  Added Unsupported device to SAS Device event.\n *  01-15-05  01.05.05  Added event data for SAS SES Event.\n *  02-09-05  01.05.06  Added MPI_FW_UPLOAD_ITYPE_FW_BACKUP define.\n *  02-22-05  01.05.07  Added Host Page Buffer Persistent flag to IOC Facts\n *                      Reply and IOC Init Request.\n *  03-11-05  01.05.08  Added family code for 1068E family.\n *                      Removed IOCFacts Reply EEDP Capability bit.\n *  06-24-05  01.05.09  Added 5 new IOCFacts Reply IOCCapabilities bits.\n *                      Added Max SATA Targets to SAS Discovery Error event.\n *  08-30-05  01.05.10  Added 4 new events and their event data structures.\n *                      Added new ReasonCode value for SAS Device Status Change\n *                      event.\n *                      Added new family code for FC949E.\n *  03-27-06  01.05.11  Added MPI_IOCFACTS_CAPABILITY_TLR.\n *                      Added additional Reason Codes and more event data fields\n *                      to EVENT_DATA_SAS_DEVICE_STATUS_CHANGE.\n *                      Added EVENT_DATA_SAS_BROADCAST_PRIMITIVE structure and\n *                      new event.\n *                      Added MPI_EVENT_SAS_SMP_ERROR and event data structure.\n *                      Added MPI_EVENT_SAS_INIT_DEVICE_STATUS_CHANGE and event\n *                      data structure.\n *                      Added MPI_EVENT_SAS_INIT_TABLE_OVERFLOW and event\n *                      data structure.\n *                      Added MPI_EXT_IMAGE_TYPE_INITIALIZATION.\n *  10-11-06  01.05.12  Added MPI_IOCFACTS_EXCEPT_METADATA_UNSUPPORTED.\n *                      Added MaxInitiators field to PortFacts reply.\n *                      Added SAS Device Status Change ReasonCode for\n *                      asynchronous notificaiton.\n *                      Added MPI_EVENT_SAS_EXPANDER_STATUS_CHANGE and event\n *                      data structure.\n *                      Added new ImageType values for FWDownload and FWUpload\n *                      requests.\n *  02-28-07  01.05.13  Added MPI_EVENT_PRIMITIVE_ASYNCHRONOUS_EVENT for SAS\n *                      Broadcast Event Data (replacing _RESERVED2).\n *                      For Discovery Error Event Data DiscoveryStatus field,\n *                      replaced _MULTPL_PATHS with _UNSUPPORTED_DEVICE and\n *                      added _MULTI_PORT_DOMAIN.\n *  05-24-07  01.05.14  Added Common Boot Block type to FWDownload Request.\n *                      Added Common Boot Block type to FWUpload Request.\n *  08-07-07  01.05.15  Added MPI_EVENT_SAS_INIT_RC_REMOVED define.\n *                      Added MPI_EVENT_IR2_RC_DUAL_PORT_ADDED and\n *                      MPI_EVENT_IR2_RC_DUAL_PORT_REMOVED for IR2 event data.\n *                      Added SASAddress field to SAS Initiator Device Table\n *                      Overflow event data structure.\n *  03-28-08  01.05.16  Added two new ReasonCode values to SAS Device Status\n *                      Change Event data to indicate completion of internally\n *                      generated task management.\n *                      Added MPI_EVENT_DSCVRY_ERR_DS_SATA_INIT_FAILURE define.\n *                      Added MPI_EVENT_SAS_INIT_RC_INACCESSIBLE define.\n *  --------------------------------------------------------------------------\n */\n\n#ifndef MPI_IOC_H\n#define MPI_IOC_H\n\n\n/*****************************************************************************\n*\n*               I O C    M e s s a g e s\n*\n*****************************************************************************/\n\n/****************************************************************************/\n/*  IOCInit message                                                         */\n/****************************************************************************/\n\ntypedef struct _MSG_IOC_INIT\n{\n    U8                      WhoInit;                    /* 00h */\n    U8                      Reserved;                   /* 01h */\n    U8                      ChainOffset;                /* 02h */\n    U8                      Function;                   /* 03h */\n    U8                      Flags;                      /* 04h */\n    U8                      MaxDevices;                 /* 05h */\n    U8                      MaxBuses;                   /* 06h */\n    U8                      MsgFlags;                   /* 07h */\n    U32                     MsgContext;                 /* 08h */\n    U16                     ReplyFrameSize;             /* 0Ch */\n    U8                      Reserved1[2];               /* 0Eh */\n    U32                     HostMfaHighAddr;            /* 10h */\n    U32                     SenseBufferHighAddr;        /* 14h */\n    U32                     ReplyFifoHostSignalingAddr; /* 18h */\n    SGE_SIMPLE_UNION        HostPageBufferSGE;          /* 1Ch */\n    U16                     MsgVersion;                 /* 28h */\n    U16                     HeaderVersion;              /* 2Ah */\n} MSG_IOC_INIT, MPI_POINTER PTR_MSG_IOC_INIT,\n  IOCInit_t, MPI_POINTER pIOCInit_t;\n\n/* WhoInit values */\n#define MPI_WHOINIT_NO_ONE                              (0x00)\n#define MPI_WHOINIT_SYSTEM_BIOS                         (0x01)\n#define MPI_WHOINIT_ROM_BIOS                            (0x02)\n#define MPI_WHOINIT_PCI_PEER                            (0x03)\n#define MPI_WHOINIT_HOST_DRIVER                         (0x04)\n#define MPI_WHOINIT_MANUFACTURER                        (0x05)\n\n/* Flags values */\n#define MPI_IOCINIT_FLAGS_HOST_PAGE_BUFFER_PERSISTENT   (0x04)\n#define MPI_IOCINIT_FLAGS_REPLY_FIFO_HOST_SIGNAL        (0x02)\n#define MPI_IOCINIT_FLAGS_DISCARD_FW_IMAGE              (0x01)\n\n/* MsgVersion */\n#define MPI_IOCINIT_MSGVERSION_MAJOR_MASK               (0xFF00)\n#define MPI_IOCINIT_MSGVERSION_MAJOR_SHIFT              (8)\n#define MPI_IOCINIT_MSGVERSION_MINOR_MASK               (0x00FF)\n#define MPI_IOCINIT_MSGVERSION_MINOR_SHIFT              (0)\n\n/* HeaderVersion */\n#define MPI_IOCINIT_HEADERVERSION_UNIT_MASK             (0xFF00)\n#define MPI_IOCINIT_HEADERVERSION_UNIT_SHIFT            (8)\n#define MPI_IOCINIT_HEADERVERSION_DEV_MASK              (0x00FF)\n#define MPI_IOCINIT_HEADERVERSION_DEV_SHIFT             (0)\n\n\ntypedef struct _MSG_IOC_INIT_REPLY\n{\n    U8                      WhoInit;                    /* 00h */\n    U8                      Reserved;                   /* 01h */\n    U8                      MsgLength;                  /* 02h */\n    U8                      Function;                   /* 03h */\n    U8                      Flags;                      /* 04h */\n    U8                      MaxDevices;                 /* 05h */\n    U8                      MaxBuses;                   /* 06h */\n    U8                      MsgFlags;                   /* 07h */\n    U32                     MsgContext;                 /* 08h */\n    U16                     Reserved2;                  /* 0Ch */\n    U16                     IOCStatus;                  /* 0Eh */\n    U32                     IOCLogInfo;                 /* 10h */\n} MSG_IOC_INIT_REPLY, MPI_POINTER PTR_MSG_IOC_INIT_REPLY,\n  IOCInitReply_t, MPI_POINTER pIOCInitReply_t;\n\n\n\n/****************************************************************************/\n/*  IOC Facts message                                                       */\n/****************************************************************************/\n\ntypedef struct _MSG_IOC_FACTS\n{\n    U8                      Reserved[2];                /* 00h */\n    U8                      ChainOffset;                /* 01h */\n    U8                      Function;                   /* 02h */\n    U8                      Reserved1[3];               /* 03h */\n    U8                      MsgFlags;                   /* 04h */\n    U32                     MsgContext;                 /* 08h */\n} MSG_IOC_FACTS, MPI_POINTER PTR_IOC_FACTS,\n  IOCFacts_t, MPI_POINTER pIOCFacts_t;\n\ntypedef struct _MPI_FW_VERSION_STRUCT\n{\n    U8                      Dev;                        /* 00h */\n    U8                      Unit;                       /* 01h */\n    U8                      Minor;                      /* 02h */\n    U8                      Major;                      /* 03h */\n} MPI_FW_VERSION_STRUCT;\n\ntypedef union _MPI_FW_VERSION\n{\n    MPI_FW_VERSION_STRUCT   Struct;\n    U32                     Word;\n} MPI_FW_VERSION;\n\n/* IOC Facts Reply */\ntypedef struct _MSG_IOC_FACTS_REPLY\n{\n    U16                     MsgVersion;                 /* 00h */\n    U8                      MsgLength;                  /* 02h */\n    U8                      Function;                   /* 03h */\n    U16                     HeaderVersion;              /* 04h */\n    U8                      IOCNumber;                  /* 06h */\n    U8                      MsgFlags;                   /* 07h */\n    U32                     MsgContext;                 /* 08h */\n    U16                     IOCExceptions;              /* 0Ch */\n    U16                     IOCStatus;                  /* 0Eh */\n    U32                     IOCLogInfo;                 /* 10h */\n    U8                      MaxChainDepth;              /* 14h */\n    U8                      WhoInit;                    /* 15h */\n    U8                      BlockSize;                  /* 16h */\n    U8                      Flags;                      /* 17h */\n    U16                     ReplyQueueDepth;            /* 18h */\n    U16                     RequestFrameSize;           /* 1Ah */\n    U16                     Reserved_0101_FWVersion;    /* 1Ch */ /* obsolete 16-bit FWVersion */\n    U16                     ProductID;                  /* 1Eh */\n    U32                     CurrentHostMfaHighAddr;     /* 20h */\n    U16                     GlobalCredits;              /* 24h */\n    U8                      NumberOfPorts;              /* 26h */\n    U8                      EventState;                 /* 27h */\n    U32                     CurrentSenseBufferHighAddr; /* 28h */\n    U16                     CurReplyFrameSize;          /* 2Ch */\n    U8                      MaxDevices;                 /* 2Eh */\n    U8                      MaxBuses;                   /* 2Fh */\n    U32                     FWImageSize;                /* 30h */\n    U32                     IOCCapabilities;            /* 34h */\n    MPI_FW_VERSION          FWVersion;                  /* 38h */\n    U16                     HighPriorityQueueDepth;     /* 3Ch */\n    U16                     Reserved2;                  /* 3Eh */\n    SGE_SIMPLE_UNION        HostPageBufferSGE;          /* 40h */\n    U32                     ReplyFifoHostSignalingAddr; /* 4Ch */\n} MSG_IOC_FACTS_REPLY, MPI_POINTER PTR_MSG_IOC_FACTS_REPLY,\n  IOCFactsReply_t, MPI_POINTER pIOCFactsReply_t;\n\n#define MPI_IOCFACTS_MSGVERSION_MAJOR_MASK              (0xFF00)\n#define MPI_IOCFACTS_MSGVERSION_MAJOR_SHIFT             (8)\n#define MPI_IOCFACTS_MSGVERSION_MINOR_MASK              (0x00FF)\n#define MPI_IOCFACTS_MSGVERSION_MINOR_SHIFT             (0)\n\n#define MPI_IOCFACTS_HDRVERSION_UNIT_MASK               (0xFF00)\n#define MPI_IOCFACTS_HDRVERSION_UNIT_SHIFT              (8)\n#define MPI_IOCFACTS_HDRVERSION_DEV_MASK                (0x00FF)\n#define MPI_IOCFACTS_HDRVERSION_DEV_SHIFT               (0)\n\n#define MPI_IOCFACTS_EXCEPT_CONFIG_CHECKSUM_FAIL        (0x0001)\n#define MPI_IOCFACTS_EXCEPT_RAID_CONFIG_INVALID         (0x0002)\n#define MPI_IOCFACTS_EXCEPT_FW_CHECKSUM_FAIL            (0x0004)\n#define MPI_IOCFACTS_EXCEPT_PERSISTENT_TABLE_FULL       (0x0008)\n#define MPI_IOCFACTS_EXCEPT_METADATA_UNSUPPORTED        (0x0010)\n\n#define MPI_IOCFACTS_FLAGS_FW_DOWNLOAD_BOOT             (0x01)\n#define MPI_IOCFACTS_FLAGS_REPLY_FIFO_HOST_SIGNAL       (0x02)\n#define MPI_IOCFACTS_FLAGS_HOST_PAGE_BUFFER_PERSISTENT  (0x04)\n\n#define MPI_IOCFACTS_EVENTSTATE_DISABLED                (0x00)\n#define MPI_IOCFACTS_EVENTSTATE_ENABLED                 (0x01)\n\n#define MPI_IOCFACTS_CAPABILITY_HIGH_PRI_Q              (0x00000001)\n#define MPI_IOCFACTS_CAPABILITY_REPLY_HOST_SIGNAL       (0x00000002)\n#define MPI_IOCFACTS_CAPABILITY_QUEUE_FULL_HANDLING     (0x00000004)\n#define MPI_IOCFACTS_CAPABILITY_DIAG_TRACE_BUFFER       (0x00000008)\n#define MPI_IOCFACTS_CAPABILITY_SNAPSHOT_BUFFER         (0x00000010)\n#define MPI_IOCFACTS_CAPABILITY_EXTENDED_BUFFER         (0x00000020)\n#define MPI_IOCFACTS_CAPABILITY_EEDP                    (0x00000040)\n#define MPI_IOCFACTS_CAPABILITY_BIDIRECTIONAL           (0x00000080)\n#define MPI_IOCFACTS_CAPABILITY_MULTICAST               (0x00000100)\n#define MPI_IOCFACTS_CAPABILITY_SCSIIO32                (0x00000200)\n#define MPI_IOCFACTS_CAPABILITY_NO_SCSIIO16             (0x00000400)\n#define MPI_IOCFACTS_CAPABILITY_TLR                     (0x00000800)\n\n\n/*****************************************************************************\n*\n*               P o r t    M e s s a g e s\n*\n*****************************************************************************/\n\n/****************************************************************************/\n/*  Port Facts message and Reply                                            */\n/****************************************************************************/\n\ntypedef struct _MSG_PORT_FACTS\n{\n     U8                     Reserved[2];                /* 00h */\n     U8                     ChainOffset;                /* 02h */\n     U8                     Function;                   /* 03h */\n     U8                     Reserved1[2];               /* 04h */\n     U8                     PortNumber;                 /* 06h */\n     U8                     MsgFlags;                   /* 07h */\n     U32                    MsgContext;                 /* 08h */\n} MSG_PORT_FACTS, MPI_POINTER PTR_MSG_PORT_FACTS,\n  PortFacts_t, MPI_POINTER pPortFacts_t;\n\ntypedef struct _MSG_PORT_FACTS_REPLY\n{\n     U16                    Reserved;                   /* 00h */\n     U8                     MsgLength;                  /* 02h */\n     U8                     Function;                   /* 03h */\n     U16                    Reserved1;                  /* 04h */\n     U8                     PortNumber;                 /* 06h */\n     U8                     MsgFlags;                   /* 07h */\n     U32                    MsgContext;                 /* 08h */\n     U16                    Reserved2;                  /* 0Ch */\n     U16                    IOCStatus;                  /* 0Eh */\n     U32                    IOCLogInfo;                 /* 10h */\n     U8                     Reserved3;                  /* 14h */\n     U8                     PortType;                   /* 15h */\n     U16                    MaxDevices;                 /* 16h */\n     U16                    PortSCSIID;                 /* 18h */\n     U16                    ProtocolFlags;              /* 1Ah */\n     U16                    MaxPostedCmdBuffers;        /* 1Ch */\n     U16                    MaxPersistentIDs;           /* 1Eh */\n     U16                    MaxLanBuckets;              /* 20h */\n     U8                     MaxInitiators;              /* 22h */\n     U8                     Reserved4;                  /* 23h */\n     U32                    Reserved5;                  /* 24h */\n} MSG_PORT_FACTS_REPLY, MPI_POINTER PTR_MSG_PORT_FACTS_REPLY,\n  PortFactsReply_t, MPI_POINTER pPortFactsReply_t;\n\n\n/* PortTypes values */\n\n#define MPI_PORTFACTS_PORTTYPE_INACTIVE         (0x00)\n#define MPI_PORTFACTS_PORTTYPE_SCSI             (0x01)\n#define MPI_PORTFACTS_PORTTYPE_FC               (0x10)\n#define MPI_PORTFACTS_PORTTYPE_ISCSI            (0x20)\n#define MPI_PORTFACTS_PORTTYPE_SAS              (0x30)\n\n/* ProtocolFlags values */\n\n#define MPI_PORTFACTS_PROTOCOL_LOGBUSADDR       (0x01)\n#define MPI_PORTFACTS_PROTOCOL_LAN              (0x02)\n#define MPI_PORTFACTS_PROTOCOL_TARGET           (0x04)\n#define MPI_PORTFACTS_PROTOCOL_INITIATOR        (0x08)\n\n\n/****************************************************************************/\n/*  Port Enable Message                                                     */\n/****************************************************************************/\n\ntypedef struct _MSG_PORT_ENABLE\n{\n    U8                      Reserved[2];                /* 00h */\n    U8                      ChainOffset;                /* 02h */\n    U8                      Function;                   /* 03h */\n    U8                      Reserved1[2];               /* 04h */\n    U8                      PortNumber;                 /* 06h */\n    U8                      MsgFlags;                   /* 07h */\n    U32                     MsgContext;                 /* 08h */\n} MSG_PORT_ENABLE, MPI_POINTER PTR_MSG_PORT_ENABLE,\n  PortEnable_t, MPI_POINTER pPortEnable_t;\n\ntypedef struct _MSG_PORT_ENABLE_REPLY\n{\n    U8                      Reserved[2];                /* 00h */\n    U8                      MsgLength;                  /* 02h */\n    U8                      Function;                   /* 03h */\n    U8                      Reserved1[2];               /* 04h */\n    U8                      PortNumber;                 /* 05h */\n    U8                      MsgFlags;                   /* 07h */\n    U32                     MsgContext;                 /* 08h */\n    U16                     Reserved2;                  /* 0Ch */\n    U16                     IOCStatus;                  /* 0Eh */\n    U32                     IOCLogInfo;                 /* 10h */\n} MSG_PORT_ENABLE_REPLY, MPI_POINTER PTR_MSG_PORT_ENABLE_REPLY,\n  PortEnableReply_t, MPI_POINTER pPortEnableReply_t;\n\n\n/*****************************************************************************\n*\n*               E v e n t    M e s s a g e s\n*\n*****************************************************************************/\n\n/****************************************************************************/\n/*  Event Notification messages                                             */\n/****************************************************************************/\n\ntypedef struct _MSG_EVENT_NOTIFY\n{\n    U8                      Switch;                     /* 00h */\n    U8                      Reserved;                   /* 01h */\n    U8                      ChainOffset;                /* 02h */\n    U8                      Function;                   /* 03h */\n    U8                      Reserved1[3];               /* 04h */\n    U8                      MsgFlags;                   /* 07h */\n    U32                     MsgContext;                 /* 08h */\n} MSG_EVENT_NOTIFY, MPI_POINTER PTR_MSG_EVENT_NOTIFY,\n  EventNotification_t, MPI_POINTER pEventNotification_t;\n\n/* Event Notification Reply */\n\ntypedef struct _MSG_EVENT_NOTIFY_REPLY\n{\n     U16                    EventDataLength;            /* 00h */\n     U8                     MsgLength;                  /* 02h */\n     U8                     Function;                   /* 03h */\n     U8                     Reserved1[2];               /* 04h */\n     U8                     AckRequired;                /* 06h */\n     U8                     MsgFlags;                   /* 07h */\n     U32                    MsgContext;                 /* 08h */\n     U8                     Reserved2[2];               /* 0Ch */\n     U16                    IOCStatus;                  /* 0Eh */\n     U32                    IOCLogInfo;                 /* 10h */\n     U32                    Event;                      /* 14h */\n     U32                    EventContext;               /* 18h */\n     U32                    Data[1];                    /* 1Ch */\n} MSG_EVENT_NOTIFY_REPLY, MPI_POINTER PTR_MSG_EVENT_NOTIFY_REPLY,\n  EventNotificationReply_t, MPI_POINTER pEventNotificationReply_t;\n\n/* Event Acknowledge */\n\ntypedef struct _MSG_EVENT_ACK\n{\n    U8                      Reserved[2];                /* 00h */\n    U8                      ChainOffset;                /* 02h */\n    U8                      Function;                   /* 03h */\n    U8                      Reserved1[3];               /* 04h */\n    U8                      MsgFlags;                   /* 07h */\n    U32                     MsgContext;                 /* 08h */\n    U32                     Event;                      /* 0Ch */\n    U32                     EventContext;               /* 10h */\n} MSG_EVENT_ACK, MPI_POINTER PTR_MSG_EVENT_ACK,\n  EventAck_t, MPI_POINTER pEventAck_t;\n\ntypedef struct _MSG_EVENT_ACK_REPLY\n{\n    U8                      Reserved[2];                /* 00h */\n    U8                      MsgLength;                  /* 02h */\n    U8                      Function;                   /* 03h */\n    U8                      Reserved1[3];               /* 04h */\n    U8                      MsgFlags;                   /* 07h */\n    U32                     MsgContext;                 /* 08h */\n    U16                     Reserved2;                  /* 0Ch */\n    U16                     IOCStatus;                  /* 0Eh */\n    U32                     IOCLogInfo;                 /* 10h */\n} MSG_EVENT_ACK_REPLY, MPI_POINTER PTR_MSG_EVENT_ACK_REPLY,\n  EventAckReply_t, MPI_POINTER pEventAckReply_t;\n\n/* Switch */\n\n#define MPI_EVENT_NOTIFICATION_SWITCH_OFF   (0x00)\n#define MPI_EVENT_NOTIFICATION_SWITCH_ON    (0x01)\n\n/* Event */\n\n#define MPI_EVENT_NONE                          (0x00000000)\n#define MPI_EVENT_LOG_DATA                      (0x00000001)\n#define MPI_EVENT_STATE_CHANGE                  (0x00000002)\n#define MPI_EVENT_UNIT_ATTENTION                (0x00000003)\n#define MPI_EVENT_IOC_BUS_RESET                 (0x00000004)\n#define MPI_EVENT_EXT_BUS_RESET                 (0x00000005)\n#define MPI_EVENT_RESCAN                        (0x00000006)\n#define MPI_EVENT_LINK_STATUS_CHANGE            (0x00000007)\n#define MPI_EVENT_LOOP_STATE_CHANGE             (0x00000008)\n#define MPI_EVENT_LOGOUT                        (0x00000009)\n#define MPI_EVENT_EVENT_CHANGE                  (0x0000000A)\n#define MPI_EVENT_INTEGRATED_RAID               (0x0000000B)\n#define MPI_EVENT_SCSI_DEVICE_STATUS_CHANGE     (0x0000000C)\n#define MPI_EVENT_ON_BUS_TIMER_EXPIRED          (0x0000000D)\n#define MPI_EVENT_QUEUE_FULL                    (0x0000000E)\n#define MPI_EVENT_SAS_DEVICE_STATUS_CHANGE      (0x0000000F)\n#define MPI_EVENT_SAS_SES                       (0x00000010)\n#define MPI_EVENT_PERSISTENT_TABLE_FULL         (0x00000011)\n#define MPI_EVENT_SAS_PHY_LINK_STATUS           (0x00000012)\n#define MPI_EVENT_SAS_DISCOVERY_ERROR           (0x00000013)\n#define MPI_EVENT_IR_RESYNC_UPDATE              (0x00000014)\n#define MPI_EVENT_IR2                           (0x00000015)\n#define MPI_EVENT_SAS_DISCOVERY                 (0x00000016)\n#define MPI_EVENT_SAS_BROADCAST_PRIMITIVE       (0x00000017)\n#define MPI_EVENT_SAS_INIT_DEVICE_STATUS_CHANGE (0x00000018)\n#define MPI_EVENT_SAS_INIT_TABLE_OVERFLOW       (0x00000019)\n#define MPI_EVENT_SAS_SMP_ERROR                 (0x0000001A)\n#define MPI_EVENT_SAS_EXPANDER_STATUS_CHANGE    (0x0000001B)\n#define MPI_EVENT_LOG_ENTRY_ADDED               (0x00000021)\n\n/* AckRequired field values */\n\n#define MPI_EVENT_NOTIFICATION_ACK_NOT_REQUIRED (0x00)\n#define MPI_EVENT_NOTIFICATION_ACK_REQUIRED     (0x01)\n\n/* EventChange Event data */\n\ntypedef struct _EVENT_DATA_EVENT_CHANGE\n{\n    U8                      EventState;                 /* 00h */\n    U8                      Reserved;                   /* 01h */\n    U16                     Reserved1;                  /* 02h */\n} EVENT_DATA_EVENT_CHANGE, MPI_POINTER PTR_EVENT_DATA_EVENT_CHANGE,\n  EventDataEventChange_t, MPI_POINTER pEventDataEventChange_t;\n\n/* LogEntryAdded Event data */\n\n/* this structure matches MPI_LOG_0_ENTRY in mpi_cnfg.h */\n#define MPI_EVENT_DATA_LOG_ENTRY_DATA_LENGTH    (0x1C)\ntypedef struct _EVENT_DATA_LOG_ENTRY\n{\n    U32         TimeStamp;                          /* 00h */\n    U32         Reserved1;                          /* 04h */\n    U16         LogSequence;                        /* 08h */\n    U16         LogEntryQualifier;                  /* 0Ah */\n    U8          LogData[MPI_EVENT_DATA_LOG_ENTRY_DATA_LENGTH]; /* 0Ch */\n} EVENT_DATA_LOG_ENTRY, MPI_POINTER PTR_EVENT_DATA_LOG_ENTRY,\n  MpiEventDataLogEntry_t, MPI_POINTER pMpiEventDataLogEntry_t;\n\ntypedef struct _EVENT_DATA_LOG_ENTRY_ADDED\n{\n    U16                     LogSequence;            /* 00h */\n    U16                     Reserved1;              /* 02h */\n    U32                     Reserved2;              /* 04h */\n    EVENT_DATA_LOG_ENTRY    LogEntry;               /* 08h */\n} EVENT_DATA_LOG_ENTRY_ADDED, MPI_POINTER PTR_EVENT_DATA_LOG_ENTRY_ADDED,\n  MpiEventDataLogEntryAdded_t, MPI_POINTER pMpiEventDataLogEntryAdded_t;\n\n/* SCSI Event data for Port, Bus and Device forms */\n\ntypedef struct _EVENT_DATA_SCSI\n{\n    U8                      TargetID;                   /* 00h */\n    U8                      BusPort;                    /* 01h */\n    U16                     Reserved;                   /* 02h */\n} EVENT_DATA_SCSI, MPI_POINTER PTR_EVENT_DATA_SCSI,\n  EventDataScsi_t, MPI_POINTER pEventDataScsi_t;\n\n/* SCSI Device Status Change Event data */\n\ntypedef struct _EVENT_DATA_SCSI_DEVICE_STATUS_CHANGE\n{\n    U8                      TargetID;                   /* 00h */\n    U8                      Bus;                        /* 01h */\n    U8                      ReasonCode;                 /* 02h */\n    U8                      LUN;                        /* 03h */\n    U8                      ASC;                        /* 04h */\n    U8                      ASCQ;                       /* 05h */\n    U16                     Reserved;                   /* 06h */\n} EVENT_DATA_SCSI_DEVICE_STATUS_CHANGE,\n  MPI_POINTER PTR_EVENT_DATA_SCSI_DEVICE_STATUS_CHANGE,\n  MpiEventDataScsiDeviceStatusChange_t,\n  MPI_POINTER pMpiEventDataScsiDeviceStatusChange_t;\n\n/* MPI SCSI Device Status Change Event data ReasonCode values */\n#define MPI_EVENT_SCSI_DEV_STAT_RC_ADDED                (0x03)\n#define MPI_EVENT_SCSI_DEV_STAT_RC_NOT_RESPONDING       (0x04)\n#define MPI_EVENT_SCSI_DEV_STAT_RC_SMART_DATA           (0x05)\n\n/* SAS Device Status Change Event data */\n\ntypedef struct _EVENT_DATA_SAS_DEVICE_STATUS_CHANGE\n{\n    U8                      TargetID;                   /* 00h */\n    U8                      Bus;                        /* 01h */\n    U8                      ReasonCode;                 /* 02h */\n    U8                      Reserved;                   /* 03h */\n    U8                      ASC;                        /* 04h */\n    U8                      ASCQ;                       /* 05h */\n    U16                     DevHandle;                  /* 06h */\n    U32                     DeviceInfo;                 /* 08h */\n    U16                     ParentDevHandle;            /* 0Ch */\n    U8                      PhyNum;                     /* 0Eh */\n    U8                      Reserved1;                  /* 0Fh */\n    U64                     SASAddress;                 /* 10h */\n    U8                      LUN[8];                     /* 18h */\n    U16                     TaskTag;                    /* 20h */\n    U16                     Reserved2;                  /* 22h */\n} EVENT_DATA_SAS_DEVICE_STATUS_CHANGE,\n  MPI_POINTER PTR_EVENT_DATA_SAS_DEVICE_STATUS_CHANGE,\n  MpiEventDataSasDeviceStatusChange_t,\n  MPI_POINTER pMpiEventDataSasDeviceStatusChange_t;\n\n/* MPI SAS Device Status Change Event data ReasonCode values */\n#define MPI_EVENT_SAS_DEV_STAT_RC_ADDED                     (0x03)\n#define MPI_EVENT_SAS_DEV_STAT_RC_NOT_RESPONDING            (0x04)\n#define MPI_EVENT_SAS_DEV_STAT_RC_SMART_DATA                (0x05)\n#define MPI_EVENT_SAS_DEV_STAT_RC_NO_PERSIST_ADDED          (0x06)\n#define MPI_EVENT_SAS_DEV_STAT_RC_UNSUPPORTED               (0x07)\n#define MPI_EVENT_SAS_DEV_STAT_RC_INTERNAL_DEVICE_RESET     (0x08)\n#define MPI_EVENT_SAS_DEV_STAT_RC_TASK_ABORT_INTERNAL       (0x09)\n#define MPI_EVENT_SAS_DEV_STAT_RC_ABORT_TASK_SET_INTERNAL   (0x0A)\n#define MPI_EVENT_SAS_DEV_STAT_RC_CLEAR_TASK_SET_INTERNAL   (0x0B)\n#define MPI_EVENT_SAS_DEV_STAT_RC_QUERY_TASK_INTERNAL       (0x0C)\n#define MPI_EVENT_SAS_DEV_STAT_RC_ASYNC_NOTIFICATION        (0x0D)\n#define MPI_EVENT_SAS_DEV_STAT_RC_CMPL_INTERNAL_DEV_RESET   (0x0E)\n#define MPI_EVENT_SAS_DEV_STAT_RC_CMPL_TASK_ABORT_INTERNAL  (0x0F)\n\n\n/* SCSI Event data for Queue Full event */\n\ntypedef struct _EVENT_DATA_QUEUE_FULL\n{\n    U8                      TargetID;                   /* 00h */\n    U8                      Bus;                        /* 01h */\n    U16                     CurrentDepth;               /* 02h */\n} EVENT_DATA_QUEUE_FULL, MPI_POINTER PTR_EVENT_DATA_QUEUE_FULL,\n  EventDataQueueFull_t, MPI_POINTER pEventDataQueueFull_t;\n\n/* MPI Integrated RAID Event data */\n\ntypedef struct _EVENT_DATA_RAID\n{\n    U8                      VolumeID;                   /* 00h */\n    U8                      VolumeBus;                  /* 01h */\n    U8                      ReasonCode;                 /* 02h */\n    U8                      PhysDiskNum;                /* 03h */\n    U8                      ASC;                        /* 04h */\n    U8                      ASCQ;                       /* 05h */\n    U16                     Reserved;                   /* 06h */\n    U32                     SettingsStatus;             /* 08h */\n} EVENT_DATA_RAID, MPI_POINTER PTR_EVENT_DATA_RAID,\n  MpiEventDataRaid_t, MPI_POINTER pMpiEventDataRaid_t;\n\n/* MPI Integrated RAID Event data ReasonCode values */\n#define MPI_EVENT_RAID_RC_VOLUME_CREATED                (0x00)\n#define MPI_EVENT_RAID_RC_VOLUME_DELETED                (0x01)\n#define MPI_EVENT_RAID_RC_VOLUME_SETTINGS_CHANGED       (0x02)\n#define MPI_EVENT_RAID_RC_VOLUME_STATUS_CHANGED         (0x03)\n#define MPI_EVENT_RAID_RC_VOLUME_PHYSDISK_CHANGED       (0x04)\n#define MPI_EVENT_RAID_RC_PHYSDISK_CREATED              (0x05)\n#define MPI_EVENT_RAID_RC_PHYSDISK_DELETED              (0x06)\n#define MPI_EVENT_RAID_RC_PHYSDISK_SETTINGS_CHANGED     (0x07)\n#define MPI_EVENT_RAID_RC_PHYSDISK_STATUS_CHANGED       (0x08)\n#define MPI_EVENT_RAID_RC_DOMAIN_VAL_NEEDED             (0x09)\n#define MPI_EVENT_RAID_RC_SMART_DATA                    (0x0A)\n#define MPI_EVENT_RAID_RC_REPLACE_ACTION_STARTED        (0x0B)\n\n\n/* MPI Integrated RAID Resync Update Event data */\n\ntypedef struct _MPI_EVENT_DATA_IR_RESYNC_UPDATE\n{\n    U8                      VolumeID;                   /* 00h */\n    U8                      VolumeBus;                  /* 01h */\n    U8                      ResyncComplete;             /* 02h */\n    U8                      Reserved1;                  /* 03h */\n    U32                     Reserved2;                  /* 04h */\n} MPI_EVENT_DATA_IR_RESYNC_UPDATE,\n  MPI_POINTER PTR_MPI_EVENT_DATA_IR_RESYNC_UPDATE,\n  MpiEventDataIrResyncUpdate_t, MPI_POINTER pMpiEventDataIrResyncUpdate_t;\n\n/* MPI IR2 Event data */\n\n/* MPI_LD_STATE or MPI_PD_STATE */\ntypedef struct _IR2_STATE_CHANGED\n{\n    U16                 PreviousState;  /* 00h */\n    U16                 NewState;       /* 02h */\n} IR2_STATE_CHANGED, MPI_POINTER PTR_IR2_STATE_CHANGED;\n\ntypedef struct _IR2_PD_INFO\n{\n    U16                 DeviceHandle;           /* 00h */\n    U8                  TruncEnclosureHandle;   /* 02h */\n    U8                  TruncatedSlot;          /* 03h */\n} IR2_PD_INFO, MPI_POINTER PTR_IR2_PD_INFO;\n\ntypedef union _MPI_IR2_RC_EVENT_DATA\n{\n    IR2_STATE_CHANGED   StateChanged;\n    U32                 Lba;\n    IR2_PD_INFO         PdInfo;\n} MPI_IR2_RC_EVENT_DATA, MPI_POINTER PTR_MPI_IR2_RC_EVENT_DATA;\n\ntypedef struct _MPI_EVENT_DATA_IR2\n{\n    U8                      TargetID;             /* 00h */\n    U8                      Bus;                  /* 01h */\n    U8                      ReasonCode;           /* 02h */\n    U8                      PhysDiskNum;          /* 03h */\n    MPI_IR2_RC_EVENT_DATA   IR2EventData;         /* 04h */\n} MPI_EVENT_DATA_IR2, MPI_POINTER PTR_MPI_EVENT_DATA_IR2,\n  MpiEventDataIR2_t, MPI_POINTER pMpiEventDataIR2_t;\n\n/* MPI IR2 Event data ReasonCode values */\n#define MPI_EVENT_IR2_RC_LD_STATE_CHANGED           (0x01)\n#define MPI_EVENT_IR2_RC_PD_STATE_CHANGED           (0x02)\n#define MPI_EVENT_IR2_RC_BAD_BLOCK_TABLE_FULL       (0x03)\n#define MPI_EVENT_IR2_RC_PD_INSERTED                (0x04)\n#define MPI_EVENT_IR2_RC_PD_REMOVED                 (0x05)\n#define MPI_EVENT_IR2_RC_FOREIGN_CFG_DETECTED       (0x06)\n#define MPI_EVENT_IR2_RC_REBUILD_MEDIUM_ERROR       (0x07)\n#define MPI_EVENT_IR2_RC_DUAL_PORT_ADDED            (0x08)\n#define MPI_EVENT_IR2_RC_DUAL_PORT_REMOVED          (0x09)\n\n/* defines for logical disk states */\n#define MPI_LD_STATE_OPTIMAL                        (0x00)\n#define MPI_LD_STATE_DEGRADED                       (0x01)\n#define MPI_LD_STATE_FAILED                         (0x02)\n#define MPI_LD_STATE_MISSING                        (0x03)\n#define MPI_LD_STATE_OFFLINE                        (0x04)\n\n/* defines for physical disk states */\n#define MPI_PD_STATE_ONLINE                         (0x00)\n#define MPI_PD_STATE_MISSING                        (0x01)\n#define MPI_PD_STATE_NOT_COMPATIBLE                 (0x02)\n#define MPI_PD_STATE_FAILED                         (0x03)\n#define MPI_PD_STATE_INITIALIZING                   (0x04)\n#define MPI_PD_STATE_OFFLINE_AT_HOST_REQUEST        (0x05)\n#define MPI_PD_STATE_FAILED_AT_HOST_REQUEST         (0x06)\n#define MPI_PD_STATE_OFFLINE_FOR_ANOTHER_REASON     (0xFF)\n\n/* MPI Link Status Change Event data */\n\ntypedef struct _EVENT_DATA_LINK_STATUS\n{\n    U8                      State;                      /* 00h */\n    U8                      Reserved;                   /* 01h */\n    U16                     Reserved1;                  /* 02h */\n    U8                      Reserved2;                  /* 04h */\n    U8                      Port;                       /* 05h */\n    U16                     Reserved3;                  /* 06h */\n} EVENT_DATA_LINK_STATUS, MPI_POINTER PTR_EVENT_DATA_LINK_STATUS,\n  EventDataLinkStatus_t, MPI_POINTER pEventDataLinkStatus_t;\n\n#define MPI_EVENT_LINK_STATUS_FAILURE       (0x00000000)\n#define MPI_EVENT_LINK_STATUS_ACTIVE        (0x00000001)\n\n/* MPI Loop State Change Event data */\n\ntypedef struct _EVENT_DATA_LOOP_STATE\n{\n    U8                      Character4;                 /* 00h */\n    U8                      Character3;                 /* 01h */\n    U8                      Type;                       /* 02h */\n    U8                      Reserved;                   /* 03h */\n    U8                      Reserved1;                  /* 04h */\n    U8                      Port;                       /* 05h */\n    U16                     Reserved2;                  /* 06h */\n} EVENT_DATA_LOOP_STATE, MPI_POINTER PTR_EVENT_DATA_LOOP_STATE,\n  EventDataLoopState_t, MPI_POINTER pEventDataLoopState_t;\n\n#define MPI_EVENT_LOOP_STATE_CHANGE_LIP     (0x0001)\n#define MPI_EVENT_LOOP_STATE_CHANGE_LPE     (0x0002)\n#define MPI_EVENT_LOOP_STATE_CHANGE_LPB     (0x0003)\n\n/* MPI LOGOUT Event data */\n\ntypedef struct _EVENT_DATA_LOGOUT\n{\n    U32                     NPortID;                    /* 00h */\n    U8                      AliasIndex;                 /* 04h */\n    U8                      Port;                       /* 05h */\n    U16                     Reserved1;                  /* 06h */\n} EVENT_DATA_LOGOUT, MPI_POINTER PTR_EVENT_DATA_LOGOUT,\n  EventDataLogout_t, MPI_POINTER pEventDataLogout_t;\n\n#define MPI_EVENT_LOGOUT_ALL_ALIASES        (0xFF)\n\n/* SAS SES Event data */\n\ntypedef struct _EVENT_DATA_SAS_SES\n{\n    U8                      PhyNum;                     /* 00h */\n    U8                      Port;                       /* 01h */\n    U8                      PortWidth;                  /* 02h */\n    U8                      Reserved1;                  /* 04h */\n} EVENT_DATA_SAS_SES, MPI_POINTER PTR_EVENT_DATA_SAS_SES,\n  MpiEventDataSasSes_t, MPI_POINTER pMpiEventDataSasSes_t;\n\n/* SAS Broadcast Primitive Event data */\n\ntypedef struct _EVENT_DATA_SAS_BROADCAST_PRIMITIVE\n{\n    U8                      PhyNum;                     /* 00h */\n    U8                      Port;                       /* 01h */\n    U8                      PortWidth;                  /* 02h */\n    U8                      Primitive;                  /* 04h */\n} EVENT_DATA_SAS_BROADCAST_PRIMITIVE,\n  MPI_POINTER PTR_EVENT_DATA_SAS_BROADCAST_PRIMITIVE,\n  MpiEventDataSasBroadcastPrimitive_t,\n  MPI_POINTER pMpiEventDataSasBroadcastPrimitive_t;\n\n#define MPI_EVENT_PRIMITIVE_CHANGE              (0x01)\n#define MPI_EVENT_PRIMITIVE_EXPANDER            (0x03)\n#define MPI_EVENT_PRIMITIVE_ASYNCHRONOUS_EVENT  (0x04)\n#define MPI_EVENT_PRIMITIVE_RESERVED3           (0x05)\n#define MPI_EVENT_PRIMITIVE_RESERVED4           (0x06)\n#define MPI_EVENT_PRIMITIVE_CHANGE0_RESERVED    (0x07)\n#define MPI_EVENT_PRIMITIVE_CHANGE1_RESERVED    (0x08)\n\n/* SAS Phy Link Status Event data */\n\ntypedef struct _EVENT_DATA_SAS_PHY_LINK_STATUS\n{\n    U8                      PhyNum;                     /* 00h */\n    U8                      LinkRates;                  /* 01h */\n    U16                     DevHandle;                  /* 02h */\n    U64                     SASAddress;                 /* 04h */\n} EVENT_DATA_SAS_PHY_LINK_STATUS, MPI_POINTER PTR_EVENT_DATA_SAS_PHY_LINK_STATUS,\n  MpiEventDataSasPhyLinkStatus_t, MPI_POINTER pMpiEventDataSasPhyLinkStatus_t;\n\n/* defines for the LinkRates field of the SAS PHY Link Status event */\n#define MPI_EVENT_SAS_PLS_LR_CURRENT_MASK                   (0xF0)\n#define MPI_EVENT_SAS_PLS_LR_CURRENT_SHIFT                  (4)\n#define MPI_EVENT_SAS_PLS_LR_PREVIOUS_MASK                  (0x0F)\n#define MPI_EVENT_SAS_PLS_LR_PREVIOUS_SHIFT                 (0)\n#define MPI_EVENT_SAS_PLS_LR_RATE_UNKNOWN                   (0x00)\n#define MPI_EVENT_SAS_PLS_LR_RATE_PHY_DISABLED              (0x01)\n#define MPI_EVENT_SAS_PLS_LR_RATE_FAILED_SPEED_NEGOTIATION  (0x02)\n#define MPI_EVENT_SAS_PLS_LR_RATE_SATA_OOB_COMPLETE         (0x03)\n#define MPI_EVENT_SAS_PLS_LR_RATE_1_5                       (0x08)\n#define MPI_EVENT_SAS_PLS_LR_RATE_3_0                       (0x09)\n\n/* SAS Discovery Event data */\n\ntypedef struct _EVENT_DATA_SAS_DISCOVERY\n{\n    U32                     DiscoveryStatus;            /* 00h */\n    U32                     Reserved1;                  /* 04h */\n} EVENT_DATA_SAS_DISCOVERY, MPI_POINTER PTR_EVENT_DATA_SAS_DISCOVERY,\n  EventDataSasDiscovery_t, MPI_POINTER pEventDataSasDiscovery_t;\n\n#define MPI_EVENT_SAS_DSCVRY_COMPLETE                       (0x00000000)\n#define MPI_EVENT_SAS_DSCVRY_IN_PROGRESS                    (0x00000001)\n#define MPI_EVENT_SAS_DSCVRY_PHY_BITS_MASK                  (0xFFFF0000)\n#define MPI_EVENT_SAS_DSCVRY_PHY_BITS_SHIFT                 (16)\n\n/* SAS Discovery Errror Event data */\n\ntypedef struct _EVENT_DATA_DISCOVERY_ERROR\n{\n    U32                     DiscoveryStatus;            /* 00h */\n    U8                      Port;                       /* 04h */\n    U8                      Reserved1;                  /* 05h */\n    U16                     Reserved2;                  /* 06h */\n} EVENT_DATA_DISCOVERY_ERROR, MPI_POINTER PTR_EVENT_DATA_DISCOVERY_ERROR,\n  EventDataDiscoveryError_t, MPI_POINTER pEventDataDiscoveryError_t;\n\n#define MPI_EVENT_DSCVRY_ERR_DS_LOOP_DETECTED               (0x00000001)\n#define MPI_EVENT_DSCVRY_ERR_DS_UNADDRESSABLE_DEVICE        (0x00000002)\n#define MPI_EVENT_DSCVRY_ERR_DS_MULTIPLE_PORTS              (0x00000004)\n#define MPI_EVENT_DSCVRY_ERR_DS_EXPANDER_ERR                (0x00000008)\n#define MPI_EVENT_DSCVRY_ERR_DS_SMP_TIMEOUT                 (0x00000010)\n#define MPI_EVENT_DSCVRY_ERR_DS_OUT_ROUTE_ENTRIES           (0x00000020)\n#define MPI_EVENT_DSCVRY_ERR_DS_INDEX_NOT_EXIST             (0x00000040)\n#define MPI_EVENT_DSCVRY_ERR_DS_SMP_FUNCTION_FAILED         (0x00000080)\n#define MPI_EVENT_DSCVRY_ERR_DS_SMP_CRC_ERROR               (0x00000100)\n#define MPI_EVENT_DSCVRY_ERR_DS_MULTPL_SUBTRACTIVE          (0x00000200)\n#define MPI_EVENT_DSCVRY_ERR_DS_TABLE_TO_TABLE              (0x00000400)\n#define MPI_EVENT_DSCVRY_ERR_DS_UNSUPPORTED_DEVICE          (0x00000800)\n#define MPI_EVENT_DSCVRY_ERR_DS_MAX_SATA_TARGETS            (0x00001000)\n#define MPI_EVENT_DSCVRY_ERR_DS_MULTI_PORT_DOMAIN           (0x00002000)\n#define MPI_EVENT_DSCVRY_ERR_DS_SATA_INIT_FAILURE           (0x00004000)\n\n/* SAS SMP Error Event data */\n\ntypedef struct _EVENT_DATA_SAS_SMP_ERROR\n{\n    U8                      Status;                     /* 00h */\n    U8                      Port;                       /* 01h */\n    U8                      SMPFunctionResult;          /* 02h */\n    U8                      Reserved1;                  /* 03h */\n    U64                     SASAddress;                 /* 04h */\n} EVENT_DATA_SAS_SMP_ERROR, MPI_POINTER PTR_EVENT_DATA_SAS_SMP_ERROR,\n  MpiEventDataSasSmpError_t, MPI_POINTER pMpiEventDataSasSmpError_t;\n\n/* defines for the Status field of the SAS SMP Error event */\n#define MPI_EVENT_SAS_SMP_FUNCTION_RESULT_VALID         (0x00)\n#define MPI_EVENT_SAS_SMP_CRC_ERROR                     (0x01)\n#define MPI_EVENT_SAS_SMP_TIMEOUT                       (0x02)\n#define MPI_EVENT_SAS_SMP_NO_DESTINATION                (0x03)\n#define MPI_EVENT_SAS_SMP_BAD_DESTINATION               (0x04)\n\n/* SAS Initiator Device Status Change Event data */\n\ntypedef struct _EVENT_DATA_SAS_INIT_DEV_STATUS_CHANGE\n{\n    U8                      ReasonCode;                 /* 00h */\n    U8                      Port;                       /* 01h */\n    U16                     DevHandle;                  /* 02h */\n    U64                     SASAddress;                 /* 04h */\n} EVENT_DATA_SAS_INIT_DEV_STATUS_CHANGE,\n  MPI_POINTER PTR_EVENT_DATA_SAS_INIT_DEV_STATUS_CHANGE,\n  MpiEventDataSasInitDevStatusChange_t,\n  MPI_POINTER pMpiEventDataSasInitDevStatusChange_t;\n\n/* defines for the ReasonCode field of the SAS Initiator Device Status Change event */\n#define MPI_EVENT_SAS_INIT_RC_ADDED                 (0x01)\n#define MPI_EVENT_SAS_INIT_RC_REMOVED               (0x02)\n#define MPI_EVENT_SAS_INIT_RC_INACCESSIBLE          (0x03)\n\n/* SAS Initiator Device Table Overflow Event data */\n\ntypedef struct _EVENT_DATA_SAS_INIT_TABLE_OVERFLOW\n{\n    U8                      MaxInit;                    /* 00h */\n    U8                      CurrentInit;                /* 01h */\n    U16                     Reserved1;                  /* 02h */\n    U64                     SASAddress;                 /* 04h */\n} EVENT_DATA_SAS_INIT_TABLE_OVERFLOW,\n  MPI_POINTER PTR_EVENT_DATA_SAS_INIT_TABLE_OVERFLOW,\n  MpiEventDataSasInitTableOverflow_t,\n  MPI_POINTER pMpiEventDataSasInitTableOverflow_t;\n\n/* SAS Expander Status Change Event data */\n\ntypedef struct _EVENT_DATA_SAS_EXPANDER_STATUS_CHANGE\n{\n    U8                      ReasonCode;             /* 00h */\n    U8                      Reserved1;              /* 01h */\n    U16                     Reserved2;              /* 02h */\n    U8                      PhysicalPort;           /* 04h */\n    U8                      Reserved3;              /* 05h */\n    U16                     EnclosureHandle;        /* 06h */\n    U64                     SASAddress;             /* 08h */\n    U32                     DiscoveryStatus;        /* 10h */\n    U16                     DevHandle;              /* 14h */\n    U16                     ParentDevHandle;        /* 16h */\n    U16                     ExpanderChangeCount;    /* 18h */\n    U16                     ExpanderRouteIndexes;   /* 1Ah */\n    U8                      NumPhys;                /* 1Ch */\n    U8                      SASLevel;               /* 1Dh */\n    U8                      Flags;                  /* 1Eh */\n    U8                      Reserved4;              /* 1Fh */\n} EVENT_DATA_SAS_EXPANDER_STATUS_CHANGE,\n  MPI_POINTER PTR_EVENT_DATA_SAS_EXPANDER_STATUS_CHANGE,\n  MpiEventDataSasExpanderStatusChange_t,\n  MPI_POINTER pMpiEventDataSasExpanderStatusChange_t;\n\n/* values for ReasonCode field of SAS Expander Status Change Event data */\n#define MPI_EVENT_SAS_EXP_RC_ADDED                      (0x00)\n#define MPI_EVENT_SAS_EXP_RC_NOT_RESPONDING             (0x01)\n\n/* values for DiscoveryStatus field of SAS Expander Status Change Event data */\n#define MPI_EVENT_SAS_EXP_DS_LOOP_DETECTED              (0x00000001)\n#define MPI_EVENT_SAS_EXP_DS_UNADDRESSABLE_DEVICE       (0x00000002)\n#define MPI_EVENT_SAS_EXP_DS_MULTIPLE_PORTS             (0x00000004)\n#define MPI_EVENT_SAS_EXP_DS_EXPANDER_ERR               (0x00000008)\n#define MPI_EVENT_SAS_EXP_DS_SMP_TIMEOUT                (0x00000010)\n#define MPI_EVENT_SAS_EXP_DS_OUT_ROUTE_ENTRIES          (0x00000020)\n#define MPI_EVENT_SAS_EXP_DS_INDEX_NOT_EXIST            (0x00000040)\n#define MPI_EVENT_SAS_EXP_DS_SMP_FUNCTION_FAILED        (0x00000080)\n#define MPI_EVENT_SAS_EXP_DS_SMP_CRC_ERROR              (0x00000100)\n#define MPI_EVENT_SAS_EXP_DS_SUBTRACTIVE_LINK           (0x00000200)\n#define MPI_EVENT_SAS_EXP_DS_TABLE_LINK                 (0x00000400)\n#define MPI_EVENT_SAS_EXP_DS_UNSUPPORTED_DEVICE         (0x00000800)\n\n/* values for Flags field of SAS Expander Status Change Event data */\n#define MPI_EVENT_SAS_EXP_FLAGS_ROUTE_TABLE_CONFIG      (0x02)\n#define MPI_EVENT_SAS_EXP_FLAGS_CONFIG_IN_PROGRESS      (0x01)\n\n\n\n/*****************************************************************************\n*\n*               F i r m w a r e    L o a d    M e s s a g e s\n*\n*****************************************************************************/\n\n/****************************************************************************/\n/*  Firmware Download message and associated structures                     */\n/****************************************************************************/\n\ntypedef struct _MSG_FW_DOWNLOAD\n{\n    U8                      ImageType;                  /* 00h */\n    U8                      Reserved;                   /* 01h */\n    U8                      ChainOffset;                /* 02h */\n    U8                      Function;                   /* 03h */\n    U8                      Reserved1[3];               /* 04h */\n    U8                      MsgFlags;                   /* 07h */\n    U32                     MsgContext;                 /* 08h */\n    SGE_MPI_UNION           SGL;                        /* 0Ch */\n} MSG_FW_DOWNLOAD, MPI_POINTER PTR_MSG_FW_DOWNLOAD,\n  FWDownload_t, MPI_POINTER pFWDownload_t;\n\n#define MPI_FW_DOWNLOAD_MSGFLGS_LAST_SEGMENT    (0x01)\n\n#define MPI_FW_DOWNLOAD_ITYPE_RESERVED          (0x00)\n#define MPI_FW_DOWNLOAD_ITYPE_FW                (0x01)\n#define MPI_FW_DOWNLOAD_ITYPE_BIOS              (0x02)\n#define MPI_FW_DOWNLOAD_ITYPE_NVDATA            (0x03)\n#define MPI_FW_DOWNLOAD_ITYPE_BOOTLOADER        (0x04)\n#define MPI_FW_DOWNLOAD_ITYPE_MANUFACTURING     (0x06)\n#define MPI_FW_DOWNLOAD_ITYPE_CONFIG_1          (0x07)\n#define MPI_FW_DOWNLOAD_ITYPE_CONFIG_2          (0x08)\n#define MPI_FW_DOWNLOAD_ITYPE_MEGARAID          (0x09)\n#define MPI_FW_DOWNLOAD_ITYPE_COMMON_BOOT_BLOCK (0x0B)\n\n\ntypedef struct _FWDownloadTCSGE\n{\n    U8                      Reserved;                   /* 00h */\n    U8                      ContextSize;                /* 01h */\n    U8                      DetailsLength;              /* 02h */\n    U8                      Flags;                      /* 03h */\n    U32                     Reserved_0100_Checksum;     /* 04h */ /* obsolete Checksum */\n    U32                     ImageOffset;                /* 08h */\n    U32                     ImageSize;                  /* 0Ch */\n} FW_DOWNLOAD_TCSGE, MPI_POINTER PTR_FW_DOWNLOAD_TCSGE,\n  FWDownloadTCSGE_t, MPI_POINTER pFWDownloadTCSGE_t;\n\n/* Firmware Download reply */\ntypedef struct _MSG_FW_DOWNLOAD_REPLY\n{\n    U8                      ImageType;                  /* 00h */\n    U8                      Reserved;                   /* 01h */\n    U8                      MsgLength;                  /* 02h */\n    U8                      Function;                   /* 03h */\n    U8                      Reserved1[3];               /* 04h */\n    U8                      MsgFlags;                   /* 07h */\n    U32                     MsgContext;                 /* 08h */\n    U16                     Reserved2;                  /* 0Ch */\n    U16                     IOCStatus;                  /* 0Eh */\n    U32                     IOCLogInfo;                 /* 10h */\n} MSG_FW_DOWNLOAD_REPLY, MPI_POINTER PTR_MSG_FW_DOWNLOAD_REPLY,\n  FWDownloadReply_t, MPI_POINTER pFWDownloadReply_t;\n\n\n/****************************************************************************/\n/*  Firmware Upload message and associated structures                       */\n/****************************************************************************/\n\ntypedef struct _MSG_FW_UPLOAD\n{\n    U8                      ImageType;                  /* 00h */\n    U8                      Reserved;                   /* 01h */\n    U8                      ChainOffset;                /* 02h */\n    U8                      Function;                   /* 03h */\n    U8                      Reserved1[3];               /* 04h */\n    U8                      MsgFlags;                   /* 07h */\n    U32                     MsgContext;                 /* 08h */\n    SGE_MPI_UNION           SGL;                        /* 0Ch */\n} MSG_FW_UPLOAD, MPI_POINTER PTR_MSG_FW_UPLOAD,\n  FWUpload_t, MPI_POINTER pFWUpload_t;\n\n#define MPI_FW_UPLOAD_ITYPE_FW_IOC_MEM          (0x00)\n#define MPI_FW_UPLOAD_ITYPE_FW_FLASH            (0x01)\n#define MPI_FW_UPLOAD_ITYPE_BIOS_FLASH          (0x02)\n#define MPI_FW_UPLOAD_ITYPE_NVDATA              (0x03)\n#define MPI_FW_UPLOAD_ITYPE_BOOTLOADER          (0x04)\n#define MPI_FW_UPLOAD_ITYPE_FW_BACKUP           (0x05)\n#define MPI_FW_UPLOAD_ITYPE_MANUFACTURING       (0x06)\n#define MPI_FW_UPLOAD_ITYPE_CONFIG_1            (0x07)\n#define MPI_FW_UPLOAD_ITYPE_CONFIG_2            (0x08)\n#define MPI_FW_UPLOAD_ITYPE_MEGARAID            (0x09)\n#define MPI_FW_UPLOAD_ITYPE_COMPLETE            (0x0A)\n#define MPI_FW_UPLOAD_ITYPE_COMMON_BOOT_BLOCK   (0x0B)\n\ntypedef struct _FWUploadTCSGE\n{\n    U8                      Reserved;                   /* 00h */\n    U8                      ContextSize;                /* 01h */\n    U8                      DetailsLength;              /* 02h */\n    U8                      Flags;                      /* 03h */\n    U32                     Reserved1;                  /* 04h */\n    U32                     ImageOffset;                /* 08h */\n    U32                     ImageSize;                  /* 0Ch */\n} FW_UPLOAD_TCSGE, MPI_POINTER PTR_FW_UPLOAD_TCSGE,\n  FWUploadTCSGE_t, MPI_POINTER pFWUploadTCSGE_t;\n\n/* Firmware Upload reply */\ntypedef struct _MSG_FW_UPLOAD_REPLY\n{\n    U8                      ImageType;                  /* 00h */\n    U8                      Reserved;                   /* 01h */\n    U8                      MsgLength;                  /* 02h */\n    U8                      Function;                   /* 03h */\n    U8                      Reserved1[3];               /* 04h */\n    U8                      MsgFlags;                   /* 07h */\n    U32                     MsgContext;                 /* 08h */\n    U16                     Reserved2;                  /* 0Ch */\n    U16                     IOCStatus;                  /* 0Eh */\n    U32                     IOCLogInfo;                 /* 10h */\n    U32                     ActualImageSize;            /* 14h */\n} MSG_FW_UPLOAD_REPLY, MPI_POINTER PTR_MSG_FW_UPLOAD_REPLY,\n  FWUploadReply_t, MPI_POINTER pFWUploadReply_t;\n\n\ntypedef struct _MPI_FW_HEADER\n{\n    U32                     ArmBranchInstruction0;      /* 00h */\n    U32                     Signature0;                 /* 04h */\n    U32                     Signature1;                 /* 08h */\n    U32                     Signature2;                 /* 0Ch */\n    U32                     ArmBranchInstruction1;      /* 10h */\n    U32                     ArmBranchInstruction2;      /* 14h */\n    U32                     Reserved;                   /* 18h */\n    U32                     Checksum;                   /* 1Ch */\n    U16                     VendorId;                   /* 20h */\n    U16                     ProductId;                  /* 22h */\n    MPI_FW_VERSION          FWVersion;                  /* 24h */\n    U32                     SeqCodeVersion;             /* 28h */\n    U32                     ImageSize;                  /* 2Ch */\n    U32                     NextImageHeaderOffset;      /* 30h */\n    U32                     LoadStartAddress;           /* 34h */\n    U32                     IopResetVectorValue;        /* 38h */\n    U32                     IopResetRegAddr;            /* 3Ch */\n    U32                     VersionNameWhat;            /* 40h */\n    U8                      VersionName[32];            /* 44h */\n    U32                     VendorNameWhat;             /* 64h */\n    U8                      VendorName[32];             /* 68h */\n} MPI_FW_HEADER, MPI_POINTER PTR_MPI_FW_HEADER,\n  MpiFwHeader_t, MPI_POINTER pMpiFwHeader_t;\n\n#define MPI_FW_HEADER_WHAT_SIGNATURE        (0x29232840)\n\n/* defines for using the ProductId field */\n#define MPI_FW_HEADER_PID_TYPE_MASK             (0xF000)\n#define MPI_FW_HEADER_PID_TYPE_SCSI             (0x0000)\n#define MPI_FW_HEADER_PID_TYPE_FC               (0x1000)\n#define MPI_FW_HEADER_PID_TYPE_SAS              (0x2000)\n\n#define MPI_FW_HEADER_SIGNATURE_0               (0x5AEAA55A)\n#define MPI_FW_HEADER_SIGNATURE_1               (0xA55AEAA5)\n#define MPI_FW_HEADER_SIGNATURE_2               (0x5AA55AEA)\n\n#define MPI_FW_HEADER_PID_PROD_MASK                     (0x0F00)\n#define MPI_FW_HEADER_PID_PROD_INITIATOR_SCSI           (0x0100)\n#define MPI_FW_HEADER_PID_PROD_TARGET_INITIATOR_SCSI    (0x0200)\n#define MPI_FW_HEADER_PID_PROD_TARGET_SCSI              (0x0300)\n#define MPI_FW_HEADER_PID_PROD_IM_SCSI                  (0x0400)\n#define MPI_FW_HEADER_PID_PROD_IS_SCSI                  (0x0500)\n#define MPI_FW_HEADER_PID_PROD_CTX_SCSI                 (0x0600)\n#define MPI_FW_HEADER_PID_PROD_IR_SCSI                  (0x0700)\n\n#define MPI_FW_HEADER_PID_FAMILY_MASK           (0x00FF)\n/* SCSI */\n#define MPI_FW_HEADER_PID_FAMILY_1030A0_SCSI    (0x0001)\n#define MPI_FW_HEADER_PID_FAMILY_1030B0_SCSI    (0x0002)\n#define MPI_FW_HEADER_PID_FAMILY_1030B1_SCSI    (0x0003)\n#define MPI_FW_HEADER_PID_FAMILY_1030C0_SCSI    (0x0004)\n#define MPI_FW_HEADER_PID_FAMILY_1020A0_SCSI    (0x0005)\n#define MPI_FW_HEADER_PID_FAMILY_1020B0_SCSI    (0x0006)\n#define MPI_FW_HEADER_PID_FAMILY_1020B1_SCSI    (0x0007)\n#define MPI_FW_HEADER_PID_FAMILY_1020C0_SCSI    (0x0008)\n#define MPI_FW_HEADER_PID_FAMILY_1035A0_SCSI    (0x0009)\n#define MPI_FW_HEADER_PID_FAMILY_1035B0_SCSI    (0x000A)\n#define MPI_FW_HEADER_PID_FAMILY_1030TA0_SCSI   (0x000B)\n#define MPI_FW_HEADER_PID_FAMILY_1020TA0_SCSI   (0x000C)\n/* Fibre Channel */\n#define MPI_FW_HEADER_PID_FAMILY_909_FC         (0x0000)\n#define MPI_FW_HEADER_PID_FAMILY_919_FC         (0x0001) /* 919 and 929     */\n#define MPI_FW_HEADER_PID_FAMILY_919X_FC        (0x0002) /* 919X and 929X   */\n#define MPI_FW_HEADER_PID_FAMILY_919XL_FC       (0x0003) /* 919XL and 929XL */\n#define MPI_FW_HEADER_PID_FAMILY_939X_FC        (0x0004) /* 939X and 949X   */\n#define MPI_FW_HEADER_PID_FAMILY_959_FC         (0x0005)\n#define MPI_FW_HEADER_PID_FAMILY_949E_FC        (0x0006)\n/* SAS */\n#define MPI_FW_HEADER_PID_FAMILY_1064_SAS       (0x0001)\n#define MPI_FW_HEADER_PID_FAMILY_1068_SAS       (0x0002)\n#define MPI_FW_HEADER_PID_FAMILY_1078_SAS       (0x0003)\n#define MPI_FW_HEADER_PID_FAMILY_106xE_SAS      (0x0004) /* 1068E, 1066E, and 1064E */\n\ntypedef struct _MPI_EXT_IMAGE_HEADER\n{\n    U8                      ImageType;                  /* 00h */\n    U8                      Reserved;                   /* 01h */\n    U16                     Reserved1;                  /* 02h */\n    U32                     Checksum;                   /* 04h */\n    U32                     ImageSize;                  /* 08h */\n    U32                     NextImageHeaderOffset;      /* 0Ch */\n    U32                     LoadStartAddress;           /* 10h */\n    U32                     Reserved2;                  /* 14h */\n} MPI_EXT_IMAGE_HEADER, MPI_POINTER PTR_MPI_EXT_IMAGE_HEADER,\n  MpiExtImageHeader_t, MPI_POINTER pMpiExtImageHeader_t;\n\n/* defines for the ImageType field */\n#define MPI_EXT_IMAGE_TYPE_UNSPECIFIED          (0x00)\n#define MPI_EXT_IMAGE_TYPE_FW                   (0x01)\n#define MPI_EXT_IMAGE_TYPE_NVDATA               (0x03)\n#define MPI_EXT_IMAGE_TYPE_BOOTLOADER           (0x04)\n#define MPI_EXT_IMAGE_TYPE_INITIALIZATION       (0x05)\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/dev/mpt/mpilib/mpi_lan.h",
    "content": "/* $FreeBSD: release/9.0.0/sys/dev/mpt/mpilib/mpi_lan.h 154603 2006-01-21 00:29:52Z mjacob $ */\n/*-\n * Copyright (c) 2000-2005, LSI Logic Corporation and its contributors.\n * All rights reserved.\n * \n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions are\n * met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce at minimum a disclaimer\n *    substantially similar to the \"NO WARRANTY\" disclaimer below\n *    (\"Disclaimer\") and any redistribution must be conditioned upon including\n *    a substantially similar Disclaimer requirement for further binary\n *    redistribution.\n * 3. Neither the name of the LSI Logic Corporation nor the names of its\n *    contributors may be used to endorse or promote products derived from\n *    this software without specific prior written permission.\n * \n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\n * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE\n * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\n * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\n * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\n * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\n * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF THE COPYRIGHT\n * OWNER OR CONTRIBUTOR IS ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n * \n * \n *           Name:  mpi_lan.h\n *          Title:  MPI LAN messages and structures\n *  Creation Date:  June 30, 2000\n *\n *    mpi_lan.h Version:  01.05.01\n *\n *  Version History\n *  ---------------\n *\n *  Date      Version   Description\n *  --------  --------  ------------------------------------------------------\n *  05-08-00  00.10.01  Original release for 0.10 spec dated 4/26/2000.\n *  05-24-00  00.10.02  Added LANStatus field to _MSG_LAN_SEND_REPLY.\n *                      Added LANStatus field to _MSG_LAN_RECEIVE_POST_REPLY.\n *                      Moved ListCount field in _MSG_LAN_RECEIVE_POST_REPLY.\n *  06-06-00  01.00.01  Update version number for 1.0 release.\n *  06-12-00  01.00.02  Added MPI_ to BUCKETSTATUS_ definitions.\n *  06-22-00  01.00.03  Major changes to match new LAN definition in 1.0 spec.\n *  06-30-00  01.00.04  Added Context Reply definitions per revised proposal.\n *                      Changed transaction context usage to bucket/buffer.\n *  07-05-00  01.00.05  Removed LAN_RECEIVE_POST_BUCKET_CONTEXT_MASK definition\n *                      to lan private header file\n *  11-02-00  01.01.01  Original release for post 1.0 work\n *  02-20-01  01.01.02  Started using MPI_POINTER.\n *  03-27-01  01.01.03  Added structure offset comments.\n *  08-08-01  01.02.01  Original release for v1.2 work.\n *  05-11-04  01.03.01  Original release for MPI v1.3.\n *  08-19-04  01.05.01  Original release for MPI v1.5.\n *  --------------------------------------------------------------------------\n */\n\n#ifndef MPI_LAN_H\n#define MPI_LAN_H\n\n\n/******************************************************************************\n*\n*               L A N    M e s s a g e s\n*\n*******************************************************************************/\n\n/* LANSend messages */\n\ntypedef struct _MSG_LAN_SEND_REQUEST\n{\n    U16                     Reserved;           /* 00h */\n    U8                      ChainOffset;        /* 02h */\n    U8                      Function;           /* 03h */\n    U16                     Reserved2;          /* 04h */\n    U8                      PortNumber;         /* 06h */\n    U8                      MsgFlags;           /* 07h */\n    U32                     MsgContext;         /* 08h */\n    SGE_MPI_UNION           SG_List[1];         /* 0Ch */\n} MSG_LAN_SEND_REQUEST, MPI_POINTER PTR_MSG_LAN_SEND_REQUEST,\n  LANSendRequest_t, MPI_POINTER pLANSendRequest_t;\n\n\ntypedef struct _MSG_LAN_SEND_REPLY\n{\n    U16                     Reserved;           /* 00h */\n    U8                      MsgLength;          /* 02h */\n    U8                      Function;           /* 03h */\n    U8                      Reserved2;          /* 04h */\n    U8                      NumberOfContexts;   /* 05h */\n    U8                      PortNumber;         /* 06h */\n    U8                      MsgFlags;           /* 07h */\n    U32                     MsgContext;         /* 08h */\n    U16                     Reserved3;          /* 0Ch */\n    U16                     IOCStatus;          /* 0Eh */\n    U32                     IOCLogInfo;         /* 10h */\n    U32                     BufferContext;      /* 14h */\n} MSG_LAN_SEND_REPLY, MPI_POINTER PTR_MSG_LAN_SEND_REPLY,\n  LANSendReply_t, MPI_POINTER pLANSendReply_t;\n\n\n/* LANReceivePost */\n\ntypedef struct _MSG_LAN_RECEIVE_POST_REQUEST\n{\n    U16                     Reserved;           /* 00h */\n    U8                      ChainOffset;        /* 02h */\n    U8                      Function;           /* 03h */\n    U16                     Reserved2;          /* 04h */\n    U8                      PortNumber;         /* 06h */\n    U8                      MsgFlags;           /* 07h */\n    U32                     MsgContext;         /* 08h */\n    U32                     BucketCount;        /* 0Ch */\n    SGE_MPI_UNION           SG_List[1];         /* 10h */\n} MSG_LAN_RECEIVE_POST_REQUEST, MPI_POINTER PTR_MSG_LAN_RECEIVE_POST_REQUEST,\n  LANReceivePostRequest_t, MPI_POINTER pLANReceivePostRequest_t;\n\n\ntypedef struct _MSG_LAN_RECEIVE_POST_REPLY\n{\n    U16                     Reserved;           /* 00h */\n    U8                      MsgLength;          /* 02h */\n    U8                      Function;           /* 03h */\n    U8                      Reserved2;          /* 04h */\n    U8                      NumberOfContexts;   /* 05h */\n    U8                      PortNumber;         /* 06h */\n    U8                      MsgFlags;           /* 07h */\n    U32                     MsgContext;         /* 08h */\n    U16                     Reserved3;          /* 0Ch */\n    U16                     IOCStatus;          /* 0Eh */\n    U32                     IOCLogInfo;         /* 10h */\n    U32                     BucketsRemaining;   /* 14h */\n    U32                     PacketOffset;       /* 18h */\n    U32                     PacketLength;       /* 1Ch */\n    U32                     BucketContext[1];   /* 20h */\n} MSG_LAN_RECEIVE_POST_REPLY, MPI_POINTER PTR_MSG_LAN_RECEIVE_POST_REPLY,\n  LANReceivePostReply_t, MPI_POINTER pLANReceivePostReply_t;\n\n\n/* LANReset */\n\ntypedef struct _MSG_LAN_RESET_REQUEST\n{\n    U16                     Reserved;           /* 00h */\n    U8                      ChainOffset;        /* 02h */\n    U8                      Function;           /* 03h */\n    U16                     Reserved2;          /* 04h */\n    U8                      PortNumber;         /* 05h */\n    U8                      MsgFlags;           /* 07h */\n    U32                     MsgContext;         /* 08h */\n} MSG_LAN_RESET_REQUEST, MPI_POINTER PTR_MSG_LAN_RESET_REQUEST,\n  LANResetRequest_t, MPI_POINTER pLANResetRequest_t;\n\n\ntypedef struct _MSG_LAN_RESET_REPLY\n{\n    U16                     Reserved;           /* 00h */\n    U8                      MsgLength;          /* 02h */\n    U8                      Function;           /* 03h */\n    U16                     Reserved2;          /* 04h */\n    U8                      PortNumber;         /* 06h */\n    U8                      MsgFlags;           /* 07h */\n    U32                     MsgContext;         /* 08h */\n    U16                     Reserved3;          /* 0Ch */\n    U16                     IOCStatus;          /* 0Eh */\n    U32                     IOCLogInfo;         /* 10h */\n} MSG_LAN_RESET_REPLY, MPI_POINTER PTR_MSG_LAN_RESET_REPLY,\n  LANResetReply_t, MPI_POINTER pLANResetReply_t;\n\n\n/****************************************************************************/\n/* LAN Context Reply defines and macros                                     */\n/****************************************************************************/\n\n#define LAN_REPLY_PACKET_LENGTH_MASK            (0x0000FFFF)\n#define LAN_REPLY_PACKET_LENGTH_SHIFT           (0)\n#define LAN_REPLY_BUCKET_CONTEXT_MASK           (0x07FF0000)\n#define LAN_REPLY_BUCKET_CONTEXT_SHIFT          (16)\n#define LAN_REPLY_BUFFER_CONTEXT_MASK           (0x07FFFFFF)\n#define LAN_REPLY_BUFFER_CONTEXT_SHIFT          (0)\n#define LAN_REPLY_FORM_MASK                     (0x18000000)\n#define LAN_REPLY_FORM_RECEIVE_SINGLE           (0x00)\n#define LAN_REPLY_FORM_RECEIVE_MULTIPLE         (0x01)\n#define LAN_REPLY_FORM_SEND_SINGLE              (0x02)\n#define LAN_REPLY_FORM_MESSAGE_CONTEXT          (0x03)\n#define LAN_REPLY_FORM_SHIFT                    (27)\n\n#define GET_LAN_PACKET_LENGTH(x)    (((x) & LAN_REPLY_PACKET_LENGTH_MASK)   \\\n                                        >> LAN_REPLY_PACKET_LENGTH_SHIFT)\n\n#define SET_LAN_PACKET_LENGTH(x, lth)                                       \\\n            ((x) = ((x) & ~LAN_REPLY_PACKET_LENGTH_MASK) |                  \\\n                            (((lth) << LAN_REPLY_PACKET_LENGTH_SHIFT) &     \\\n                                        LAN_REPLY_PACKET_LENGTH_MASK))\n\n#define GET_LAN_BUCKET_CONTEXT(x)   (((x) & LAN_REPLY_BUCKET_CONTEXT_MASK)  \\\n                                        >> LAN_REPLY_BUCKET_CONTEXT_SHIFT)\n\n#define SET_LAN_BUCKET_CONTEXT(x, ctx)                                      \\\n            ((x) = ((x) & ~LAN_REPLY_BUCKET_CONTEXT_MASK) |                 \\\n                            (((ctx) << LAN_REPLY_BUCKET_CONTEXT_SHIFT) &    \\\n                                        LAN_REPLY_BUCKET_CONTEXT_MASK))\n\n#define GET_LAN_BUFFER_CONTEXT(x)   (((x) & LAN_REPLY_BUFFER_CONTEXT_MASK)  \\\n                                        >> LAN_REPLY_BUFFER_CONTEXT_SHIFT)\n\n#define SET_LAN_BUFFER_CONTEXT(x, ctx)                                      \\\n            ((x) = ((x) & ~LAN_REPLY_BUFFER_CONTEXT_MASK) |                 \\\n                            (((ctx) << LAN_REPLY_BUFFER_CONTEXT_SHIFT) &    \\\n                                        LAN_REPLY_BUFFER_CONTEXT_MASK))\n\n#define GET_LAN_FORM(x)             (((x) & LAN_REPLY_FORM_MASK)            \\\n                                        >> LAN_REPLY_FORM_SHIFT)\n\n#define SET_LAN_FORM(x, frm)                                                \\\n            ((x) = ((x) & ~LAN_REPLY_FORM_MASK) |                           \\\n                            (((frm) << LAN_REPLY_FORM_SHIFT) &              \\\n                                        LAN_REPLY_FORM_MASK))\n\n\n/****************************************************************************/\n/* LAN Current Device State defines                                         */\n/****************************************************************************/\n\n#define MPI_LAN_DEVICE_STATE_RESET                     (0x00)\n#define MPI_LAN_DEVICE_STATE_OPERATIONAL               (0x01)\n\n\n/****************************************************************************/\n/* LAN Loopback defines                                                     */\n/****************************************************************************/\n\n#define MPI_LAN_TX_MODES_ENABLE_LOOPBACK_SUPPRESSION   (0x01)\n\n#endif\n\n"
  },
  {
    "path": "freebsd-headers/dev/mpt/mpilib/mpi_raid.h",
    "content": "/* $FreeBSD: release/9.0.0/sys/dev/mpt/mpilib/mpi_raid.h 170251 2007-06-03 22:58:27Z scottl $ */\n/*-\n * Copyright (c) 2000-2005, LSI Logic Corporation and its contributors.\n * All rights reserved.\n * \n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions are\n * met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce at minimum a disclaimer\n *    substantially similar to the \"NO WARRANTY\" disclaimer below\n *    (\"Disclaimer\") and any redistribution must be conditioned upon including\n *    a substantially similar Disclaimer requirement for further binary\n *    redistribution.\n * 3. Neither the name of the LSI Logic Corporation nor the names of its\n *    contributors may be used to endorse or promote products derived from\n *    this software without specific prior written permission.\n * \n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\n * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE\n * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\n * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\n * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\n * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\n * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF THE COPYRIGHT\n * OWNER OR CONTRIBUTOR IS ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n *\n *           Name:  mpi_raid.h\n *          Title:  MPI RAID message and structures\n *  Creation Date:  February 27, 2001\n *\n *    mpi_raid.h Version:  01.05.03\n *\n *  Version History\n *  ---------------\n *\n *  Date      Version   Description\n *  --------  --------  ------------------------------------------------------\n *  02-27-01  01.01.01  Original release for this file.\n *  03-27-01  01.01.02  Added structure offset comments.\n *  08-08-01  01.02.01  Original release for v1.2 work.\n *  09-28-01  01.02.02  Major rework for MPI v1.2 Integrated RAID changes.\n *  10-04-01  01.02.03  Added ActionData defines for\n *                      MPI_RAID_ACTION_DELETE_VOLUME action.\n *  11-01-01  01.02.04  Added define for MPI_RAID_ACTION_ADATA_DO_NOT_SYNC.\n *  03-14-02  01.02.05  Added define for MPI_RAID_ACTION_ADATA_LOW_LEVEL_INIT.\n *  05-07-02  01.02.06  Added define for MPI_RAID_ACTION_ACTIVATE_VOLUME,\n *                      MPI_RAID_ACTION_INACTIVATE_VOLUME, and\n *                      MPI_RAID_ACTION_ADATA_INACTIVATE_ALL.\n *  07-12-02  01.02.07  Added structures for Mailbox request and reply.\n *  11-15-02  01.02.08  Added missing MsgContext field to MSG_MAILBOX_REQUEST.\n *  04-01-03  01.02.09  New action data option flag for\n *                      MPI_RAID_ACTION_DELETE_VOLUME.\n *  05-11-04  01.03.01  Original release for MPI v1.3.\n *  08-19-04  01.05.01  Original release for MPI v1.5.\n *  01-15-05  01.05.02  Added defines for the two new RAID Actions for\n *                      _SET_RESYNC_RATE and _SET_DATA_SCRUB_RATE.\n *  02-28-07  01.05.03  Added new RAID Action, Device FW Update Mode, and\n *                      associated defines.\n *  --------------------------------------------------------------------------\n */\n\n#ifndef MPI_RAID_H\n#define MPI_RAID_H\n\n\n/******************************************************************************\n*\n*        R A I D    M e s s a g e s\n*\n*******************************************************************************/\n\n\n/****************************************************************************/\n/* RAID Action Request                                                      */\n/****************************************************************************/\n\ntypedef struct _MSG_RAID_ACTION\n{\n    U8                      Action;             /* 00h */\n    U8                      Reserved1;          /* 01h */\n    U8                      ChainOffset;        /* 02h */\n    U8                      Function;           /* 03h */\n    U8                      VolumeID;           /* 04h */\n    U8                      VolumeBus;          /* 05h */\n    U8                      PhysDiskNum;        /* 06h */\n    U8                      MsgFlags;           /* 07h */\n    U32                     MsgContext;         /* 08h */\n    U32                     Reserved2;          /* 0Ch */\n    U32                     ActionDataWord;     /* 10h */\n    SGE_SIMPLE_UNION        ActionDataSGE;      /* 14h */\n} MSG_RAID_ACTION_REQUEST, MPI_POINTER PTR_MSG_RAID_ACTION_REQUEST,\n  MpiRaidActionRequest_t , MPI_POINTER pMpiRaidActionRequest_t;\n\n\n/* RAID Action request Action values */\n\n#define MPI_RAID_ACTION_STATUS                      (0x00)\n#define MPI_RAID_ACTION_INDICATOR_STRUCT            (0x01)\n#define MPI_RAID_ACTION_CREATE_VOLUME               (0x02)\n#define MPI_RAID_ACTION_DELETE_VOLUME               (0x03)\n#define MPI_RAID_ACTION_DISABLE_VOLUME              (0x04)\n#define MPI_RAID_ACTION_ENABLE_VOLUME               (0x05)\n#define MPI_RAID_ACTION_QUIESCE_PHYS_IO             (0x06)\n#define MPI_RAID_ACTION_ENABLE_PHYS_IO              (0x07)\n#define MPI_RAID_ACTION_CHANGE_VOLUME_SETTINGS      (0x08)\n#define MPI_RAID_ACTION_PHYSDISK_OFFLINE            (0x0A)\n#define MPI_RAID_ACTION_PHYSDISK_ONLINE             (0x0B)\n#define MPI_RAID_ACTION_CHANGE_PHYSDISK_SETTINGS    (0x0C)\n#define MPI_RAID_ACTION_CREATE_PHYSDISK             (0x0D)\n#define MPI_RAID_ACTION_DELETE_PHYSDISK             (0x0E)\n#define MPI_RAID_ACTION_FAIL_PHYSDISK               (0x0F)\n#define MPI_RAID_ACTION_REPLACE_PHYSDISK            (0x10)\n#define MPI_RAID_ACTION_ACTIVATE_VOLUME             (0x11)\n#define MPI_RAID_ACTION_INACTIVATE_VOLUME           (0x12)\n#define MPI_RAID_ACTION_SET_RESYNC_RATE             (0x13)\n#define MPI_RAID_ACTION_SET_DATA_SCRUB_RATE         (0x14)\n#define MPI_RAID_ACTION_DEVICE_FW_UPDATE_MODE       (0x15)\n\n/* ActionDataWord defines for use with MPI_RAID_ACTION_CREATE_VOLUME action */\n#define MPI_RAID_ACTION_ADATA_DO_NOT_SYNC           (0x00000001)\n#define MPI_RAID_ACTION_ADATA_LOW_LEVEL_INIT        (0x00000002)\n\n/* ActionDataWord defines for use with MPI_RAID_ACTION_DELETE_VOLUME action */\n#define MPI_RAID_ACTION_ADATA_KEEP_PHYS_DISKS       (0x00000000)\n#define MPI_RAID_ACTION_ADATA_DEL_PHYS_DISKS        (0x00000001)\n\n#define MPI_RAID_ACTION_ADATA_KEEP_LBA0             (0x00000000)\n#define MPI_RAID_ACTION_ADATA_ZERO_LBA0             (0x00000002)\n\n/* ActionDataWord defines for use with MPI_RAID_ACTION_ACTIVATE_VOLUME action */\n#define MPI_RAID_ACTION_ADATA_INACTIVATE_ALL        (0x00000001)\n\n/* ActionDataWord defines for use with MPI_RAID_ACTION_SET_RESYNC_RATE action */\n#define MPI_RAID_ACTION_ADATA_RESYNC_RATE_MASK      (0x000000FF)\n\n/* ActionDataWord defines for use with MPI_RAID_ACTION_SET_DATA_SCRUB_RATE action */\n#define MPI_RAID_ACTION_ADATA_DATA_SCRUB_RATE_MASK  (0x000000FF)\n\n/* ActionDataWord defines for use with MPI_RAID_ACTION_DEVICE_FW_UPDATE_MODE action */\n#define MPI_RAID_ACTION_ADATA_ENABLE_FW_UPDATE          (0x00000001)\n#define MPI_RAID_ACTION_ADATA_MASK_FW_UPDATE_TIMEOUT    (0x0000FF00)\n#define MPI_RAID_ACTION_ADATA_SHIFT_FW_UPDATE_TIMEOUT   (8)\n\n\n/* RAID Action reply message */\n\ntypedef struct _MSG_RAID_ACTION_REPLY\n{\n    U8                      Action;             /* 00h */\n    U8                      Reserved;           /* 01h */\n    U8                      MsgLength;          /* 02h */\n    U8                      Function;           /* 03h */\n    U8                      VolumeID;           /* 04h */\n    U8                      VolumeBus;          /* 05h */\n    U8                      PhysDiskNum;        /* 06h */\n    U8                      MsgFlags;           /* 07h */\n    U32                     MsgContext;         /* 08h */\n    U16                     ActionStatus;       /* 0Ch */\n    U16                     IOCStatus;          /* 0Eh */\n    U32                     IOCLogInfo;         /* 10h */\n    U32                     VolumeStatus;       /* 14h */\n    U32                     ActionData;         /* 18h */\n} MSG_RAID_ACTION_REPLY, MPI_POINTER PTR_MSG_RAID_ACTION_REPLY,\n  MpiRaidActionReply_t, MPI_POINTER pMpiRaidActionReply_t;\n\n\n/* RAID Volume reply ActionStatus values */\n\n#define MPI_RAID_ACTION_ASTATUS_SUCCESS             (0x0000)\n#define MPI_RAID_ACTION_ASTATUS_INVALID_ACTION      (0x0001)\n#define MPI_RAID_ACTION_ASTATUS_FAILURE             (0x0002)\n#define MPI_RAID_ACTION_ASTATUS_IN_PROGRESS         (0x0003)\n\n\n/* RAID Volume reply RAID Volume Indicator structure */\n\ntypedef struct _MPI_RAID_VOL_INDICATOR\n{\n    U64                     TotalBlocks;        /* 00h */\n    U64                     BlocksRemaining;    /* 08h */\n} MPI_RAID_VOL_INDICATOR, MPI_POINTER PTR_MPI_RAID_VOL_INDICATOR,\n  MpiRaidVolIndicator_t, MPI_POINTER pMpiRaidVolIndicator_t;\n\n\n/****************************************************************************/\n/* SCSI IO RAID Passthrough Request                                         */\n/****************************************************************************/\n\ntypedef struct _MSG_SCSI_IO_RAID_PT_REQUEST\n{\n    U8                      PhysDiskNum;        /* 00h */\n    U8                      Reserved1;          /* 01h */\n    U8                      ChainOffset;        /* 02h */\n    U8                      Function;           /* 03h */\n    U8                      CDBLength;          /* 04h */\n    U8                      SenseBufferLength;  /* 05h */\n    U8                      Reserved2;          /* 06h */\n    U8                      MsgFlags;           /* 07h */\n    U32                     MsgContext;         /* 08h */\n    U8                      LUN[8];             /* 0Ch */\n    U32                     Control;            /* 14h */\n    U8                      CDB[16];            /* 18h */\n    U32                     DataLength;         /* 28h */\n    U32                     SenseBufferLowAddr; /* 2Ch */\n    SGE_IO_UNION            SGL;                /* 30h */\n} MSG_SCSI_IO_RAID_PT_REQUEST, MPI_POINTER PTR_MSG_SCSI_IO_RAID_PT_REQUEST,\n  SCSIIORaidPassthroughRequest_t, MPI_POINTER pSCSIIORaidPassthroughRequest_t;\n\n\n/* SCSI IO RAID Passthrough reply structure */\n\ntypedef struct _MSG_SCSI_IO_RAID_PT_REPLY\n{\n    U8                      PhysDiskNum;        /* 00h */\n    U8                      Reserved1;          /* 01h */\n    U8                      MsgLength;          /* 02h */\n    U8                      Function;           /* 03h */\n    U8                      CDBLength;          /* 04h */\n    U8                      SenseBufferLength;  /* 05h */\n    U8                      Reserved2;          /* 06h */\n    U8                      MsgFlags;           /* 07h */\n    U32                     MsgContext;         /* 08h */\n    U8                      SCSIStatus;         /* 0Ch */\n    U8                      SCSIState;          /* 0Dh */\n    U16                     IOCStatus;          /* 0Eh */\n    U32                     IOCLogInfo;         /* 10h */\n    U32                     TransferCount;      /* 14h */\n    U32                     SenseCount;         /* 18h */\n    U32                     ResponseInfo;       /* 1Ch */\n} MSG_SCSI_IO_RAID_PT_REPLY, MPI_POINTER PTR_MSG_SCSI_IO_RAID_PT_REPLY,\n  SCSIIORaidPassthroughReply_t, MPI_POINTER pSCSIIORaidPassthroughReply_t;\n\n\n/****************************************************************************/\n/* Mailbox reqeust structure */\n/****************************************************************************/\n\ntypedef struct _MSG_MAILBOX_REQUEST\n{\n    U16                     Reserved1;\n    U8                      ChainOffset;\n    U8                      Function;\n    U16                     Reserved2;\n    U8                      Reserved3;\n    U8                      MsgFlags;\n    U32                     MsgContext;\n    U8                      Command[10];\n    U16                     Reserved4;\n    SGE_IO_UNION            SGL;\n} MSG_MAILBOX_REQUEST, MPI_POINTER PTR_MSG_MAILBOX_REQUEST,\n  MailboxRequest_t, MPI_POINTER pMailboxRequest_t;\n\n\n/* Mailbox reply structure */\ntypedef struct _MSG_MAILBOX_REPLY\n{\n    U16                     Reserved1;          /* 00h */\n    U8                      MsgLength;          /* 02h */\n    U8                      Function;           /* 03h */\n    U16                     Reserved2;          /* 04h */\n    U8                      Reserved3;          /* 06h */\n    U8                      MsgFlags;           /* 07h */\n    U32                     MsgContext;         /* 08h */\n    U16                     MailboxStatus;      /* 0Ch */\n    U16                     IOCStatus;          /* 0Eh */\n    U32                     IOCLogInfo;         /* 10h */\n    U32                     Reserved4;          /* 14h */\n} MSG_MAILBOX_REPLY, MPI_POINTER PTR_MSG_MAILBOX_REPLY,\n  MailboxReply_t, MPI_POINTER pMailboxReply_t;\n\n#endif\n\n\n\n"
  },
  {
    "path": "freebsd-headers/dev/mpt/mpilib/mpi_sas.h",
    "content": "/* $FreeBSD: release/9.0.0/sys/dev/mpt/mpilib/mpi_sas.h 170251 2007-06-03 22:58:27Z scottl $ */\n/*-\n * Copyright (c) 2000-2005, LSI Logic Corporation and its contributors.\n * All rights reserved.\n * \n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions are\n * met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce at minimum a disclaimer\n *    substantially similar to the \"NO WARRANTY\" disclaimer below\n *    (\"Disclaimer\") and any redistribution must be conditioned upon including\n *    a substantially similar Disclaimer requirement for further binary\n *    redistribution.\n * 3. Neither the name of the LSI Logic Corporation nor the names of its\n *    contributors may be used to endorse or promote products derived from\n *    this software without specific prior written permission.\n * \n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\n * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE\n * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\n * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\n * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\n * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\n * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF THE COPYRIGHT\n * OWNER OR CONTRIBUTOR IS ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n *\n *           Name:  mpi_sas.h\n *          Title:  MPI Serial Attached SCSI structures and definitions\n *  Creation Date:  August 19, 2004\n *\n *    mpi_sas.h Version:  01.05.04\n *\n *  Version History\n *  ---------------\n *\n *  Date      Version   Description\n *  --------  --------  ------------------------------------------------------\n *  08-19-04  01.05.01  Original release.\n *  08-30-05  01.05.02  Added DeviceInfo bit for SEP.\n *                      Added PrimFlags and Primitive field to SAS IO Unit\n *                      Control request, and added a new operation code.\n *  03-27-06  01.05.03  Added Force Full Discovery, Transmit Port Select Signal,\n *                      and Remove Device operations to SAS IO Unit Control.\n *                      Added DevHandle field to SAS IO Unit Control request and\n *                      reply.\n *  10-11-06  01.05.04  Fixed the name of a define for Operation field of SAS IO\n *                      Unit Control request.\n *  --------------------------------------------------------------------------\n */\n\n#ifndef MPI_SAS_H\n#define MPI_SAS_H\n\n\n/*\n * Values for SASStatus.\n */\n#define MPI_SASSTATUS_SUCCESS                           (0x00)\n#define MPI_SASSTATUS_UNKNOWN_ERROR                     (0x01)\n#define MPI_SASSTATUS_INVALID_FRAME                     (0x02)\n#define MPI_SASSTATUS_UTC_BAD_DEST                      (0x03)\n#define MPI_SASSTATUS_UTC_BREAK_RECEIVED                (0x04)\n#define MPI_SASSTATUS_UTC_CONNECT_RATE_NOT_SUPPORTED    (0x05)\n#define MPI_SASSTATUS_UTC_PORT_LAYER_REQUEST            (0x06)\n#define MPI_SASSTATUS_UTC_PROTOCOL_NOT_SUPPORTED        (0x07)\n#define MPI_SASSTATUS_UTC_STP_RESOURCES_BUSY            (0x08)\n#define MPI_SASSTATUS_UTC_WRONG_DESTINATION             (0x09)\n#define MPI_SASSTATUS_SHORT_INFORMATION_UNIT            (0x0A)\n#define MPI_SASSTATUS_LONG_INFORMATION_UNIT             (0x0B)\n#define MPI_SASSTATUS_XFER_RDY_INCORRECT_WRITE_DATA     (0x0C)\n#define MPI_SASSTATUS_XFER_RDY_REQUEST_OFFSET_ERROR     (0x0D)\n#define MPI_SASSTATUS_XFER_RDY_NOT_EXPECTED             (0x0E)\n#define MPI_SASSTATUS_DATA_INCORRECT_DATA_LENGTH        (0x0F)\n#define MPI_SASSTATUS_DATA_TOO_MUCH_READ_DATA           (0x10)\n#define MPI_SASSTATUS_DATA_OFFSET_ERROR                 (0x11)\n#define MPI_SASSTATUS_SDSF_NAK_RECEIVED                 (0x12)\n#define MPI_SASSTATUS_SDSF_CONNECTION_FAILED            (0x13)\n#define MPI_SASSTATUS_INITIATOR_RESPONSE_TIMEOUT        (0x14)\n\n\n/*\n * Values for the SAS DeviceInfo field used in SAS Device Status Change Event\n * data and SAS IO Unit Configuration pages.\n */\n#define MPI_SAS_DEVICE_INFO_SEP                 (0x00004000)\n#define MPI_SAS_DEVICE_INFO_ATAPI_DEVICE        (0x00002000)\n#define MPI_SAS_DEVICE_INFO_LSI_DEVICE          (0x00001000)\n#define MPI_SAS_DEVICE_INFO_DIRECT_ATTACH       (0x00000800)\n#define MPI_SAS_DEVICE_INFO_SSP_TARGET          (0x00000400)\n#define MPI_SAS_DEVICE_INFO_STP_TARGET          (0x00000200)\n#define MPI_SAS_DEVICE_INFO_SMP_TARGET          (0x00000100)\n#define MPI_SAS_DEVICE_INFO_SATA_DEVICE         (0x00000080)\n#define MPI_SAS_DEVICE_INFO_SSP_INITIATOR       (0x00000040)\n#define MPI_SAS_DEVICE_INFO_STP_INITIATOR       (0x00000020)\n#define MPI_SAS_DEVICE_INFO_SMP_INITIATOR       (0x00000010)\n#define MPI_SAS_DEVICE_INFO_SATA_HOST           (0x00000008)\n\n#define MPI_SAS_DEVICE_INFO_MASK_DEVICE_TYPE    (0x00000007)\n#define MPI_SAS_DEVICE_INFO_NO_DEVICE           (0x00000000)\n#define MPI_SAS_DEVICE_INFO_END_DEVICE          (0x00000001)\n#define MPI_SAS_DEVICE_INFO_EDGE_EXPANDER       (0x00000002)\n#define MPI_SAS_DEVICE_INFO_FANOUT_EXPANDER     (0x00000003)\n\n\n\n/*****************************************************************************\n*\n*        S e r i a l    A t t a c h e d    S C S I     M e s s a g e s\n*\n*****************************************************************************/\n\n/****************************************************************************/\n/* Serial Management Protocol Passthrough Request                           */\n/****************************************************************************/\n\ntypedef struct _MSG_SMP_PASSTHROUGH_REQUEST\n{\n    U8                      PassthroughFlags;   /* 00h */\n    U8                      PhysicalPort;       /* 01h */\n    U8                      ChainOffset;        /* 02h */\n    U8                      Function;           /* 03h */\n    U16                     RequestDataLength;  /* 04h */\n    U8                      ConnectionRate;     /* 06h */\n    U8                      MsgFlags;           /* 07h */\n    U32                     MsgContext;         /* 08h */\n    U32                     Reserved1;          /* 0Ch */\n    U64                     SASAddress;         /* 10h */\n    U32                     Reserved2;          /* 18h */\n    U32                     Reserved3;          /* 1Ch */\n    SGE_SIMPLE_UNION        SGL;                /* 20h */\n} MSG_SMP_PASSTHROUGH_REQUEST, MPI_POINTER PTR_MSG_SMP_PASSTHROUGH_REQUEST,\n  SmpPassthroughRequest_t, MPI_POINTER pSmpPassthroughRequest_t;\n\n/* values for PassthroughFlags field */\n#define MPI_SMP_PT_REQ_PT_FLAGS_IMMEDIATE       (0x80)\n\n/* values for ConnectionRate field */\n#define MPI_SMP_PT_REQ_CONNECT_RATE_NEGOTIATED  (0x00)\n#define MPI_SMP_PT_REQ_CONNECT_RATE_1_5         (0x08)\n#define MPI_SMP_PT_REQ_CONNECT_RATE_3_0         (0x09)\n\n\n/* Serial Management Protocol Passthrough Reply */\ntypedef struct _MSG_SMP_PASSTHROUGH_REPLY\n{\n    U8                      PassthroughFlags;   /* 00h */\n    U8                      PhysicalPort;       /* 01h */\n    U8                      MsgLength;          /* 02h */\n    U8                      Function;           /* 03h */\n    U16                     ResponseDataLength; /* 04h */\n    U8                      Reserved1;          /* 06h */\n    U8                      MsgFlags;           /* 07h */\n    U32                     MsgContext;         /* 08h */\n    U8                      Reserved2;          /* 0Ch */\n    U8                      SASStatus;          /* 0Dh */\n    U16                     IOCStatus;          /* 0Eh */\n    U32                     IOCLogInfo;         /* 10h */\n    U32                     Reserved3;          /* 14h */\n    U8                      ResponseData[4];    /* 18h */\n} MSG_SMP_PASSTHROUGH_REPLY, MPI_POINTER PTR_MSG_SMP_PASSTHROUGH_REPLY,\n  SmpPassthroughReply_t, MPI_POINTER pSmpPassthroughReply_t;\n\n#define MPI_SMP_PT_REPLY_PT_FLAGS_IMMEDIATE     (0x80)\n\n\n/****************************************************************************/\n/* SATA Passthrough Request                                                 */\n/****************************************************************************/\n\ntypedef struct _MSG_SATA_PASSTHROUGH_REQUEST\n{\n    U8                      TargetID;           /* 00h */\n    U8                      Bus;                /* 01h */\n    U8                      ChainOffset;        /* 02h */\n    U8                      Function;           /* 03h */\n    U16                     PassthroughFlags;   /* 04h */\n    U8                      ConnectionRate;     /* 06h */\n    U8                      MsgFlags;           /* 07h */\n    U32                     MsgContext;         /* 08h */\n    U32                     Reserved1;          /* 0Ch */\n    U32                     Reserved2;          /* 10h */\n    U32                     Reserved3;          /* 14h */\n    U32                     DataLength;         /* 18h */\n    U8                      CommandFIS[20];     /* 1Ch */\n    SGE_SIMPLE_UNION        SGL;                /* 30h */\n} MSG_SATA_PASSTHROUGH_REQUEST, MPI_POINTER PTR_MSG_SATA_PASSTHROUGH_REQUEST,\n  SataPassthroughRequest_t, MPI_POINTER pSataPassthroughRequest_t;\n\n/* values for PassthroughFlags field */\n#define MPI_SATA_PT_REQ_PT_FLAGS_RESET_DEVICE   (0x0200)\n#define MPI_SATA_PT_REQ_PT_FLAGS_EXECUTE_DIAG   (0x0100)\n#define MPI_SATA_PT_REQ_PT_FLAGS_DMA_QUEUED     (0x0080)\n#define MPI_SATA_PT_REQ_PT_FLAGS_PACKET_COMMAND (0x0040)\n#define MPI_SATA_PT_REQ_PT_FLAGS_DMA            (0x0020)\n#define MPI_SATA_PT_REQ_PT_FLAGS_PIO            (0x0010)\n#define MPI_SATA_PT_REQ_PT_FLAGS_UNSPECIFIED_VU (0x0004)\n#define MPI_SATA_PT_REQ_PT_FLAGS_WRITE          (0x0002)\n#define MPI_SATA_PT_REQ_PT_FLAGS_READ           (0x0001)\n\n/* values for ConnectionRate field */\n#define MPI_SATA_PT_REQ_CONNECT_RATE_NEGOTIATED (0x00)\n#define MPI_SATA_PT_REQ_CONNECT_RATE_1_5        (0x08)\n#define MPI_SATA_PT_REQ_CONNECT_RATE_3_0        (0x09)\n\n\n/* SATA Passthrough Reply */\ntypedef struct _MSG_SATA_PASSTHROUGH_REPLY\n{\n    U8                      TargetID;           /* 00h */\n    U8                      Bus;                /* 01h */\n    U8                      MsgLength;          /* 02h */\n    U8                      Function;           /* 03h */\n    U16                     PassthroughFlags;   /* 04h */\n    U8                      Reserved1;          /* 06h */\n    U8                      MsgFlags;           /* 07h */\n    U32                     MsgContext;         /* 08h */\n    U8                      Reserved2;          /* 0Ch */\n    U8                      SASStatus;          /* 0Dh */\n    U16                     IOCStatus;          /* 0Eh */\n    U32                     IOCLogInfo;         /* 10h */\n    U8                      StatusFIS[20];      /* 14h */\n    U32                     StatusControlRegisters; /* 28h */\n    U32                     TransferCount;      /* 2Ch */\n} MSG_SATA_PASSTHROUGH_REPLY, MPI_POINTER PTR_MSG_SATA_PASSTHROUGH_REPLY,\n  SataPassthroughReply_t, MPI_POINTER pSataPassthroughReply_t;\n\n\n\n\n/****************************************************************************/\n/* SAS IO Unit Control Request                                              */\n/****************************************************************************/\n\ntypedef struct _MSG_SAS_IOUNIT_CONTROL_REQUEST\n{\n    U8                      Operation;          /* 00h */\n    U8                      Reserved1;          /* 01h */\n    U8                      ChainOffset;        /* 02h */\n    U8                      Function;           /* 03h */\n    U16                     DevHandle;          /* 04h */\n    U8                      Reserved3;          /* 06h */\n    U8                      MsgFlags;           /* 07h */\n    U32                     MsgContext;         /* 08h */\n    U8                      TargetID;           /* 0Ch */\n    U8                      Bus;                /* 0Dh */\n    U8                      PhyNum;             /* 0Eh */\n    U8                      PrimFlags;          /* 0Fh */\n    U32                     Primitive;          /* 10h */\n    U64                     SASAddress;         /* 14h */\n    U32                     Reserved4;          /* 1Ch */\n} MSG_SAS_IOUNIT_CONTROL_REQUEST, MPI_POINTER PTR_MSG_SAS_IOUNIT_CONTROL_REQUEST,\n  SasIoUnitControlRequest_t, MPI_POINTER pSasIoUnitControlRequest_t;\n\n/* values for the Operation field */\n#define MPI_SAS_OP_CLEAR_NOT_PRESENT            (0x01)\n#define MPI_SAS_OP_CLEAR_ALL_PERSISTENT         (0x02)\n#define MPI_SAS_OP_PHY_LINK_RESET               (0x06)\n#define MPI_SAS_OP_PHY_HARD_RESET               (0x07)\n#define MPI_SAS_OP_PHY_CLEAR_ERROR_LOG          (0x08)\n#define MPI_SAS_OP_MAP_CURRENT                  (0x09)\n#define MPI_SAS_OP_SEND_PRIMITIVE               (0x0A)\n#define MPI_SAS_OP_FORCE_FULL_DISCOVERY         (0x0B)\n#define MPI_SAS_OP_TRANSMIT_PORT_SELECT_SIGNAL  (0x0C)\n#define MPI_SAS_OP_TRANSMIT_REMOVE_DEVICE       (0x0D)  /* obsolete name */\n#define MPI_SAS_OP_REMOVE_DEVICE                (0x0D)\n\n/* values for the PrimFlags field */\n#define MPI_SAS_PRIMFLAGS_SINGLE                (0x08)\n#define MPI_SAS_PRIMFLAGS_TRIPLE                (0x02)\n#define MPI_SAS_PRIMFLAGS_REDUNDANT             (0x01)\n\n\n/* SAS IO Unit Control Reply */\ntypedef struct _MSG_SAS_IOUNIT_CONTROL_REPLY\n{\n    U8                      Operation;          /* 00h */\n    U8                      Reserved1;          /* 01h */\n    U8                      MsgLength;          /* 02h */\n    U8                      Function;           /* 03h */\n    U16                     DevHandle;          /* 04h */\n    U8                      Reserved3;          /* 06h */\n    U8                      MsgFlags;           /* 07h */\n    U32                     MsgContext;         /* 08h */\n    U16                     Reserved4;          /* 0Ch */\n    U16                     IOCStatus;          /* 0Eh */\n    U32                     IOCLogInfo;         /* 10h */\n} MSG_SAS_IOUNIT_CONTROL_REPLY, MPI_POINTER PTR_MSG_SAS_IOUNIT_CONTROL_REPLY,\n  SasIoUnitControlReply_t, MPI_POINTER pSasIoUnitControlReply_t;\n\n#endif\n\n\n"
  },
  {
    "path": "freebsd-headers/dev/mpt/mpilib/mpi_targ.h",
    "content": "/* $FreeBSD: release/9.0.0/sys/dev/mpt/mpilib/mpi_targ.h 170251 2007-06-03 22:58:27Z scottl $ */\n/*-\n * Copyright (c) 2000-2005, LSI Logic Corporation and its contributors.\n * All rights reserved.\n * \n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions are\n * met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce at minimum a disclaimer\n *    substantially similar to the \"NO WARRANTY\" disclaimer below\n *    (\"Disclaimer\") and any redistribution must be conditioned upon including\n *    a substantially similar Disclaimer requirement for further binary\n *    redistribution.\n * 3. Neither the name of the LSI Logic Corporation nor the names of its\n *    contributors may be used to endorse or promote products derived from\n *    this software without specific prior written permission.\n * \n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\n * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE\n * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\n * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\n * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\n * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\n * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF THE COPYRIGHT\n * OWNER OR CONTRIBUTOR IS ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n *\n *           Name:  mpi_targ.h\n *          Title:  MPI Target mode messages and structures\n *  Creation Date:  June 22, 2000\n *\n *    mpi_targ.h Version:  01.05.06\n *\n *  Version History\n *  ---------------\n *\n *  Date      Version   Description\n *  --------  --------  ------------------------------------------------------\n *  05-08-00  00.10.01  Original release for 0.10 spec dated 4/26/2000.\n *  06-06-00  01.00.01  Update version number for 1.0 release.\n *  06-22-00  01.00.02  Added _MSG_TARGET_CMD_BUFFER_POST_REPLY structure.\n *                      Corrected DECSRIPTOR typo to DESCRIPTOR.\n *  11-02-00  01.01.01  Original release for post 1.0 work\n *                      Modified target mode to use IoIndex instead of\n *                      HostIndex and IocIndex. Added Alias.\n *  01-09-01  01.01.02  Added defines for TARGET_ASSIST_FLAGS_REPOST_CMD_BUFFER\n *                      and TARGET_STATUS_SEND_FLAGS_REPOST_CMD_BUFFER.\n *  02-20-01  01.01.03  Started using MPI_POINTER.\n *                      Added structures for MPI_TARGET_SCSI_SPI_CMD_BUFFER and\n *                      MPI_TARGET_FCP_CMD_BUFFER.\n *  03-27-01  01.01.04  Added structure offset comments.\n *  08-08-01  01.02.01  Original release for v1.2 work.\n *  09-28-01  01.02.02  Added structure for MPI_TARGET_SCSI_SPI_STATUS_IU.\n *                      Added PriorityReason field to some replies and\n *                      defined more PriorityReason codes.\n *                      Added some defines for to support previous version\n *                      of MPI.\n *  10-04-01  01.02.03  Added PriorityReason to MSG_TARGET_ERROR_REPLY.\n *  11-01-01  01.02.04  Added define for TARGET_STATUS_SEND_FLAGS_HIGH_PRIORITY.\n *  03-14-02  01.02.05  Modified MPI_TARGET_FCP_RSP_BUFFER to get the proper\n *                      byte ordering.\n *  05-31-02  01.02.06  Modified TARGET_MODE_REPLY_ALIAS_MASK to only include\n *                      one bit.\n *                      Added AliasIndex field to MPI_TARGET_FCP_CMD_BUFFER.\n *  09-16-02  01.02.07  Added flags for confirmed completion.\n *                      Added PRIORITY_REASON_TARGET_BUSY.\n *  11-15-02  01.02.08  Added AliasID field to MPI_TARGET_SCSI_SPI_CMD_BUFFER.\n *  04-01-03  01.02.09  Added OptionalOxid field to MPI_TARGET_FCP_CMD_BUFFER.\n *  05-11-04  01.03.01  Original release for MPI v1.3.\n *  08-19-04  01.05.01  Added new request message structures for\n *                      MSG_TARGET_CMD_BUF_POST_BASE_REQUEST,\n *                      MSG_TARGET_CMD_BUF_POST_LIST_REQUEST, and\n *                      MSG_TARGET_ASSIST_EXT_REQUEST.\n *                      Added new structures for SAS SSP Command buffer, SSP\n *                      Task buffer, and SSP Status IU.\n *  10-05-04  01.05.02  MSG_TARGET_CMD_BUFFER_POST_BASE_LIST_REPLY added.\n *  02-22-05  01.05.03  Changed a comment.\n *  03-11-05  01.05.04  Removed TargetAssistExtended Request.\n *  06-24-05  01.05.05  Added TargetAssistExtended structures and defines.\n *  03-27-06  01.05.06  Added a comment.\n *  --------------------------------------------------------------------------\n */\n\n#ifndef MPI_TARG_H\n#define MPI_TARG_H\n\n\n/******************************************************************************\n*\n*        S C S I    T a r g e t    M e s s a g e s\n*\n*******************************************************************************/\n\ntypedef struct _CMD_BUFFER_DESCRIPTOR\n{\n    U16                     IoIndex;                    /* 00h */\n    U16                     Reserved;                   /* 02h */\n    union                                               /* 04h */\n    {\n        U32                 PhysicalAddress32;\n        U64                 PhysicalAddress64;\n    } u;\n} CMD_BUFFER_DESCRIPTOR, MPI_POINTER PTR_CMD_BUFFER_DESCRIPTOR,\n  CmdBufferDescriptor_t, MPI_POINTER pCmdBufferDescriptor_t;\n\n\n/****************************************************************************/\n/* Target Command Buffer Post Request                                       */\n/****************************************************************************/\n\ntypedef struct _MSG_TARGET_CMD_BUFFER_POST_REQUEST\n{\n    U8                      BufferPostFlags;            /* 00h */\n    U8                      BufferCount;                /* 01h */\n    U8                      ChainOffset;                /* 02h */\n    U8                      Function;                   /* 03h */\n    U8                      BufferLength;               /* 04h */\n    U8                      Reserved;                   /* 05h */\n    U8                      Reserved1;                  /* 06h */\n    U8                      MsgFlags;                   /* 07h */\n    U32                     MsgContext;                 /* 08h */\n    CMD_BUFFER_DESCRIPTOR   Buffer[1];                  /* 0Ch */\n} MSG_TARGET_CMD_BUFFER_POST_REQUEST, MPI_POINTER PTR_MSG_TARGET_CMD_BUFFER_POST_REQUEST,\n  TargetCmdBufferPostRequest_t, MPI_POINTER pTargetCmdBufferPostRequest_t;\n\n#define CMD_BUFFER_POST_FLAGS_PORT_MASK         (0x01)\n#define CMD_BUFFER_POST_FLAGS_ADDR_MODE_MASK    (0x80)\n#define CMD_BUFFER_POST_FLAGS_ADDR_MODE_32      (0)\n#define CMD_BUFFER_POST_FLAGS_ADDR_MODE_64      (1)\n#define CMD_BUFFER_POST_FLAGS_64_BIT_ADDR       (0x80)\n\n#define CMD_BUFFER_POST_IO_INDEX_MASK           (0x00003FFF)\n#define CMD_BUFFER_POST_IO_INDEX_MASK_0100      (0x000003FF) /* obsolete */\n\n\ntypedef struct _MSG_TARGET_CMD_BUFFER_POST_REPLY\n{\n    U8                      BufferPostFlags;            /* 00h */\n    U8                      BufferCount;                /* 01h */\n    U8                      MsgLength;                  /* 02h */\n    U8                      Function;                   /* 03h */\n    U8                      BufferLength;               /* 04h */\n    U8                      Reserved;                   /* 05h */\n    U8                      Reserved1;                  /* 06h */\n    U8                      MsgFlags;                   /* 07h */\n    U32                     MsgContext;                 /* 08h */\n    U16                     Reserved2;                  /* 0Ch */\n    U16                     IOCStatus;                  /* 0Eh */\n    U32                     IOCLogInfo;                 /* 10h */\n} MSG_TARGET_CMD_BUFFER_POST_REPLY, MPI_POINTER PTR_MSG_TARGET_CMD_BUFFER_POST_REPLY,\n  TargetCmdBufferPostReply_t, MPI_POINTER pTargetCmdBufferPostReply_t;\n\n/* the following structure is obsolete as of MPI v1.2 */\ntypedef struct _MSG_PRIORITY_CMD_RECEIVED_REPLY\n{\n    U16                     Reserved;                   /* 00h */\n    U8                      MsgLength;                  /* 02h */\n    U8                      Function;                   /* 03h */\n    U16                     Reserved1;                  /* 04h */\n    U8                      Reserved2;                  /* 06h */\n    U8                      MsgFlags;                   /* 07h */\n    U32                     MsgContext;                 /* 08h */\n    U8                      PriorityReason;             /* 0Ch */\n    U8                      Reserved3;                  /* 0Dh */\n    U16                     IOCStatus;                  /* 0Eh */\n    U32                     IOCLogInfo;                 /* 10h */\n    U32                     ReplyWord;                  /* 14h */\n} MSG_PRIORITY_CMD_RECEIVED_REPLY, MPI_POINTER PTR_MSG_PRIORITY_CMD_RECEIVED_REPLY,\n  PriorityCommandReceivedReply_t, MPI_POINTER pPriorityCommandReceivedReply_t;\n\n\ntypedef struct _MSG_TARGET_CMD_BUFFER_POST_ERROR_REPLY\n{\n    U16                     Reserved;                   /* 00h */\n    U8                      MsgLength;                  /* 02h */\n    U8                      Function;                   /* 03h */\n    U16                     Reserved1;                  /* 04h */\n    U8                      Reserved2;                  /* 06h */\n    U8                      MsgFlags;                   /* 07h */\n    U32                     MsgContext;                 /* 08h */\n    U8                      PriorityReason;             /* 0Ch */\n    U8                      Reserved3;                  /* 0Dh */\n    U16                     IOCStatus;                  /* 0Eh */\n    U32                     IOCLogInfo;                 /* 10h */\n    U32                     ReplyWord;                  /* 14h */\n} MSG_TARGET_CMD_BUFFER_POST_ERROR_REPLY,\n  MPI_POINTER PTR_MSG_TARGET_CMD_BUFFER_POST_ERROR_REPLY,\n  TargetCmdBufferPostErrorReply_t, MPI_POINTER pTargetCmdBufferPostErrorReply_t;\n\n#define PRIORITY_REASON_NO_DISCONNECT           (0x00)\n#define PRIORITY_REASON_SCSI_TASK_MANAGEMENT    (0x01)\n#define PRIORITY_REASON_CMD_PARITY_ERR          (0x02)\n#define PRIORITY_REASON_MSG_OUT_PARITY_ERR      (0x03)\n#define PRIORITY_REASON_LQ_CRC_ERR              (0x04)\n#define PRIORITY_REASON_CMD_CRC_ERR             (0x05)\n#define PRIORITY_REASON_PROTOCOL_ERR            (0x06)\n#define PRIORITY_REASON_DATA_OUT_PARITY_ERR     (0x07)\n#define PRIORITY_REASON_DATA_OUT_CRC_ERR        (0x08)\n#define PRIORITY_REASON_TARGET_BUSY             (0x09)\n#define PRIORITY_REASON_UNKNOWN                 (0xFF)\n\n\n/****************************************************************************/\n/* Target Command Buffer Post Base Request                                  */\n/****************************************************************************/\n\ntypedef struct _MSG_TARGET_CMD_BUF_POST_BASE_REQUEST\n{\n    U8                      BufferPostFlags;            /* 00h */\n    U8                      PortNumber;                 /* 01h */\n    U8                      ChainOffset;                /* 02h */\n    U8                      Function;                   /* 03h */\n    U16                     TotalCmdBuffers;            /* 04h */\n    U8                      Reserved;                   /* 06h */\n    U8                      MsgFlags;                   /* 07h */\n    U32                     MsgContext;                 /* 08h */\n    U32                     Reserved1;                  /* 0Ch */\n    U16                     CmdBufferLength;            /* 10h */\n    U16                     NextCmdBufferOffset;        /* 12h */\n    U32                     BaseAddressLow;             /* 14h */\n    U32                     BaseAddressHigh;            /* 18h */\n} MSG_TARGET_CMD_BUF_POST_BASE_REQUEST,\n  MPI_POINTER PTR__MSG_TARGET_CMD_BUF_POST_BASE_REQUEST,\n  TargetCmdBufferPostBaseRequest_t,\n  MPI_POINTER pTargetCmdBufferPostBaseRequest_t;\n\n#define CMD_BUFFER_POST_BASE_FLAGS_AUTO_POST_ALL    (0x01)\n\n\ntypedef struct _MSG_TARGET_CMD_BUFFER_POST_BASE_LIST_REPLY\n{\n    U16                     Reserved;                   /* 00h */\n    U8                      MsgLength;                  /* 02h */\n    U8                      Function;                   /* 03h */\n    U16                     Reserved1;                  /* 04h */\n    U8                      Reserved2;                  /* 06h */\n    U8                      MsgFlags;                   /* 07h */\n    U32                     MsgContext;                 /* 08h */\n    U16                     Reserved3;                  /* 0Ch */\n    U16                     IOCStatus;                  /* 0Eh */\n    U32                     IOCLogInfo;                 /* 10h */\n} MSG_TARGET_CMD_BUFFER_POST_BASE_LIST_REPLY,\n  MPI_POINTER PTR_MSG_TARGET_CMD_BUFFER_POST_BASE_LIST_REPLY,\n  TargetCmdBufferPostBaseListReply_t,\n  MPI_POINTER pTargetCmdBufferPostBaseListReply_t;\n\n\n/****************************************************************************/\n/* Target Command Buffer Post List Request                                  */\n/****************************************************************************/\n\ntypedef struct _MSG_TARGET_CMD_BUF_POST_LIST_REQUEST\n{\n    U8                      Reserved;                   /* 00h */\n    U8                      PortNumber;                 /* 01h */\n    U8                      ChainOffset;                /* 02h */\n    U8                      Function;                   /* 03h */\n    U16                     CmdBufferCount;             /* 04h */\n    U8                      Reserved1;                  /* 06h */\n    U8                      MsgFlags;                   /* 07h */\n    U32                     MsgContext;                 /* 08h */\n    U32                     Reserved2;                  /* 0Ch */\n    U16                     IoIndex[2];                 /* 10h */\n} MSG_TARGET_CMD_BUF_POST_LIST_REQUEST,\n  MPI_POINTER PTR_MSG_TARGET_CMD_BUF_POST_LIST_REQUEST,\n  TargetCmdBufferPostListRequest_t,\n  MPI_POINTER pTargetCmdBufferPostListRequest_t;\n\n\n/****************************************************************************/\n/* Command Buffer Formats (with 16 byte CDB)                                */\n/****************************************************************************/\n\ntypedef struct _MPI_TARGET_FCP_CMD_BUFFER\n{\n    U8      FcpLun[8];                                  /* 00h */\n    U8      FcpCntl[4];                                 /* 08h */\n    U8      FcpCdb[16];                                 /* 0Ch */\n    U32     FcpDl;                                      /* 1Ch */\n    U8      AliasIndex;                                 /* 20h */\n    U8      Reserved1;                                  /* 21h */\n    U16     OptionalOxid;                               /* 22h */\n} MPI_TARGET_FCP_CMD_BUFFER, MPI_POINTER PTR_MPI_TARGET_FCP_CMD_BUFFER,\n  MpiTargetFcpCmdBuffer, MPI_POINTER pMpiTargetFcpCmdBuffer;\n\n\ntypedef struct _MPI_TARGET_SCSI_SPI_CMD_BUFFER\n{\n    /* SPI L_Q information unit */\n    U8      L_QType;                                    /* 00h */\n    U8      Reserved;                                   /* 01h */\n    U16     Tag;                                        /* 02h */\n    U8      LogicalUnitNumber[8];                       /* 04h */\n    U32     DataLength;                                 /* 0Ch */\n    /* SPI command information unit */\n    U8      ReservedFirstByteOfCommandIU;               /* 10h */\n    U8      TaskAttribute;                              /* 11h */\n    U8      TaskManagementFlags;                        /* 12h */\n    U8      AdditionalCDBLength;                        /* 13h */\n    U8      CDB[16];                                    /* 14h */\n    /* Alias ID */\n    U8      AliasID;                                    /* 24h */\n    U8      Reserved1;                                  /* 25h */\n    U16     Reserved2;                                  /* 26h */\n} MPI_TARGET_SCSI_SPI_CMD_BUFFER,\n  MPI_POINTER PTR_MPI_TARGET_SCSI_SPI_CMD_BUFFER,\n  MpiTargetScsiSpiCmdBuffer, MPI_POINTER pMpiTargetScsiSpiCmdBuffer;\n\n\ntypedef struct _MPI_TARGET_SSP_CMD_BUFFER\n{\n    U8      FrameType;                                  /* 00h */\n    U8      Reserved1;                                  /* 01h */\n    U16     Reserved2;                                  /* 02h */\n    U16     InitiatorTag;                               /* 04h */\n    U16     DevHandle;                                  /* 06h */\n    /* COMMAND information unit starts here */\n    U8      LogicalUnitNumber[8];                       /* 08h */\n    U8      Reserved3;                                  /* 10h */\n    U8      TaskAttribute; /* lower 3 bits */           /* 11h */\n    U8      Reserved4;                                  /* 12h */\n    U8      AdditionalCDBLength; /* upper 5 bits */     /* 13h */\n    U8      CDB[16];                                    /* 14h */\n    /* Additional CDB bytes extend past the CDB field */\n} MPI_TARGET_SSP_CMD_BUFFER, MPI_POINTER PTR_MPI_TARGET_SSP_CMD_BUFFER,\n  MpiTargetSspCmdBuffer, MPI_POINTER pMpiTargetSspCmdBuffer;\n\ntypedef struct _MPI_TARGET_SSP_TASK_BUFFER\n{\n    U8      FrameType;                                  /* 00h */\n    U8      Reserved1;                                  /* 01h */\n    U16     Reserved2;                                  /* 02h */\n    U16     InitiatorTag;                               /* 04h */\n    U16     DevHandle;                                  /* 06h */\n    /* TASK information unit starts here */\n    U8      LogicalUnitNumber[8];                       /* 08h */\n    U8      Reserved3;                                  /* 10h */\n    U8      Reserved4;                                  /* 11h */\n    U8      TaskManagementFunction;                     /* 12h */\n    U8      Reserved5;                                  /* 13h */\n    U16     ManagedTaskTag;                             /* 14h */\n    U16     Reserved6;                                  /* 16h */\n    U32     Reserved7;                                  /* 18h */\n    U32     Reserved8;                                  /* 1Ch */\n    U32     Reserved9;                                  /* 20h */\n} MPI_TARGET_SSP_TASK_BUFFER, MPI_POINTER PTR_MPI_TARGET_SSP_TASK_BUFFER,\n  MpiTargetSspTaskBuffer, MPI_POINTER pMpiTargetSspTaskBuffer;\n\n\n/****************************************************************************/\n/* Target Assist Request                                                    */\n/****************************************************************************/\n\ntypedef struct _MSG_TARGET_ASSIST_REQUEST\n{\n    U8                      StatusCode;                 /* 00h */\n    U8                      TargetAssistFlags;          /* 01h */\n    U8                      ChainOffset;                /* 02h */\n    U8                      Function;                   /* 03h */\n    U16                     QueueTag;                   /* 04h */\n    U8                      Reserved;                   /* 06h */\n    U8                      MsgFlags;                   /* 07h */\n    U32                     MsgContext;                 /* 08h */\n    U32                     ReplyWord;                  /* 0Ch */\n    U8                      LUN[8];                     /* 10h */\n    U32                     RelativeOffset;             /* 18h */\n    U32                     DataLength;                 /* 1Ch */\n    SGE_IO_UNION            SGL[1];                     /* 20h */\n} MSG_TARGET_ASSIST_REQUEST, MPI_POINTER PTR_MSG_TARGET_ASSIST_REQUEST,\n  TargetAssistRequest_t, MPI_POINTER pTargetAssistRequest_t;\n\n#define TARGET_ASSIST_FLAGS_DATA_DIRECTION          (0x01)\n#define TARGET_ASSIST_FLAGS_AUTO_STATUS             (0x02)\n#define TARGET_ASSIST_FLAGS_HIGH_PRIORITY           (0x04)\n#define TARGET_ASSIST_FLAGS_CONFIRMED               (0x08)\n#define TARGET_ASSIST_FLAGS_REPOST_CMD_BUFFER       (0x80)\n\n/* Standard Target Mode Reply message */\ntypedef struct _MSG_TARGET_ERROR_REPLY\n{\n    U16                     Reserved;                   /* 00h */\n    U8                      MsgLength;                  /* 02h */\n    U8                      Function;                   /* 03h */\n    U16                     Reserved1;                  /* 04h */\n    U8                      Reserved2;                  /* 06h */\n    U8                      MsgFlags;                   /* 07h */\n    U32                     MsgContext;                 /* 08h */\n    U8                      PriorityReason;             /* 0Ch */\n    U8                      Reserved3;                  /* 0Dh */\n    U16                     IOCStatus;                  /* 0Eh */\n    U32                     IOCLogInfo;                 /* 10h */\n    U32                     ReplyWord;                  /* 14h */\n    U32                     TransferCount;              /* 18h */\n} MSG_TARGET_ERROR_REPLY, MPI_POINTER PTR_MSG_TARGET_ERROR_REPLY,\n  TargetErrorReply_t, MPI_POINTER pTargetErrorReply_t;\n\n\n/****************************************************************************/\n/* Target Assist Extended Request                                           */\n/****************************************************************************/\n\ntypedef struct _MSG_TARGET_ASSIST_EXT_REQUEST\n{\n    U8                      StatusCode;                     /* 00h */\n    U8                      TargetAssistFlags;              /* 01h */\n    U8                      ChainOffset;                    /* 02h */\n    U8                      Function;                       /* 03h */\n    U16                     QueueTag;                       /* 04h */\n    U8                      Reserved1;                      /* 06h */\n    U8                      MsgFlags;                       /* 07h */\n    U32                     MsgContext;                     /* 08h */\n    U32                     ReplyWord;                      /* 0Ch */\n    U8                      LUN[8];                         /* 10h */\n    U32                     RelativeOffset;                 /* 18h */\n    U32                     Reserved2;                      /* 1Ch */\n    U32                     Reserved3;                      /* 20h */\n    U32                     PrimaryReferenceTag;            /* 24h */\n    U16                     PrimaryApplicationTag;          /* 28h */\n    U16                     PrimaryApplicationTagMask;      /* 2Ah */\n    U32                     Reserved4;                      /* 2Ch */\n    U32                     DataLength;                     /* 30h */\n    U32                     BidirectionalDataLength;        /* 34h */\n    U32                     SecondaryReferenceTag;          /* 38h */\n    U16                     SecondaryApplicationTag;        /* 3Ch */\n    U16                     Reserved5;                      /* 3Eh */\n    U16                     EEDPFlags;                      /* 40h */\n    U16                     ApplicationTagTranslationMask;  /* 42h */\n    U32                     EEDPBlockSize;                  /* 44h */\n    U8                      SGLOffset0;                     /* 48h */\n    U8                      SGLOffset1;                     /* 49h */\n    U8                      SGLOffset2;                     /* 4Ah */\n    U8                      SGLOffset3;                     /* 4Bh */\n    U32                     Reserved6;                      /* 4Ch */\n    SGE_IO_UNION            SGL[1];                         /* 50h */\n} MSG_TARGET_ASSIST_EXT_REQUEST, MPI_POINTER PTR_MSG_TARGET_ASSIST_EXT_REQUEST,\n  TargetAssistExtRequest_t, MPI_POINTER pTargetAssistExtRequest_t;\n\n/* see the defines after MSG_TARGET_ASSIST_REQUEST for TargetAssistFlags */\n\n/* defines for the MsgFlags field */\n#define TARGET_ASSIST_EXT_MSGFLAGS_BIDIRECTIONAL        (0x20)\n#define TARGET_ASSIST_EXT_MSGFLAGS_MULTICAST            (0x10)\n#define TARGET_ASSIST_EXT_MSGFLAGS_SGL_OFFSET_CHAINS    (0x08)\n\n/* defines for the EEDPFlags field */\n#define TARGET_ASSIST_EXT_EEDP_MASK_OP          (0x0007)\n#define TARGET_ASSIST_EXT_EEDP_NOOP_OP          (0x0000)\n#define TARGET_ASSIST_EXT_EEDP_CHK_OP           (0x0001)\n#define TARGET_ASSIST_EXT_EEDP_STRIP_OP         (0x0002)\n#define TARGET_ASSIST_EXT_EEDP_CHKRM_OP         (0x0003)\n#define TARGET_ASSIST_EXT_EEDP_INSERT_OP        (0x0004)\n#define TARGET_ASSIST_EXT_EEDP_REPLACE_OP       (0x0006)\n#define TARGET_ASSIST_EXT_EEDP_CHKREGEN_OP      (0x0007)\n\n#define TARGET_ASSIST_EXT_EEDP_PASS_REF_TAG     (0x0008)\n\n#define TARGET_ASSIST_EXT_EEDP_T10_CHK_MASK     (0x0700)\n#define TARGET_ASSIST_EXT_EEDP_T10_CHK_GUARD    (0x0100)\n#define TARGET_ASSIST_EXT_EEDP_T10_CHK_APPTAG   (0x0200)\n#define TARGET_ASSIST_EXT_EEDP_T10_CHK_REFTAG   (0x0400)\n#define TARGET_ASSIST_EXT_EEDP_T10_CHK_SHIFT    (8)\n\n#define TARGET_ASSIST_EXT_EEDP_INC_SEC_APPTAG   (0x1000)\n#define TARGET_ASSIST_EXT_EEDP_INC_PRI_APPTAG   (0x2000)\n#define TARGET_ASSIST_EXT_EEDP_INC_SEC_REFTAG   (0x4000)\n#define TARGET_ASSIST_EXT_EEDP_INC_PRI_REFTAG   (0x8000)\n\n\n/****************************************************************************/\n/* Target Status Send Request                                               */\n/****************************************************************************/\n\ntypedef struct _MSG_TARGET_STATUS_SEND_REQUEST\n{\n    U8                      StatusCode;                 /* 00h */\n    U8                      StatusFlags;                /* 01h */\n    U8                      ChainOffset;                /* 02h */\n    U8                      Function;                   /* 03h */\n    U16                     QueueTag;                   /* 04h */\n    U8                      Reserved;                   /* 06h */\n    U8                      MsgFlags;                   /* 07h */\n    U32                     MsgContext;                 /* 08h */\n    U32                     ReplyWord;                  /* 0Ch */\n    U8                      LUN[8];                     /* 10h */\n    SGE_SIMPLE_UNION        StatusDataSGE;              /* 18h */\n} MSG_TARGET_STATUS_SEND_REQUEST, MPI_POINTER PTR_MSG_TARGET_STATUS_SEND_REQUEST,\n  TargetStatusSendRequest_t, MPI_POINTER pTargetStatusSendRequest_t;\n\n#define TARGET_STATUS_SEND_FLAGS_AUTO_GOOD_STATUS   (0x01)\n#define TARGET_STATUS_SEND_FLAGS_HIGH_PRIORITY      (0x04)\n#define TARGET_STATUS_SEND_FLAGS_CONFIRMED          (0x08)\n#define TARGET_STATUS_SEND_FLAGS_REPOST_CMD_BUFFER  (0x80)\n\n/*\n * NOTE: FCP_RSP data is big-endian. When used on a little-endian system, this\n * structure properly orders the bytes.\n */\ntypedef struct _MPI_TARGET_FCP_RSP_BUFFER\n{\n    U8      Reserved0[8];                               /* 00h */\n    U8      Reserved1[2];                               /* 08h */\n    U8      FcpFlags;                                   /* 0Ah */\n    U8      FcpStatus;                                  /* 0Bh */\n    U32     FcpResid;                                   /* 0Ch */\n    U32     FcpSenseLength;                             /* 10h */\n    U32     FcpResponseLength;                          /* 14h */\n    U8      FcpResponseData[8];                         /* 18h */\n    U8      FcpSenseData[32]; /* Pad to 64 bytes */     /* 20h */\n} MPI_TARGET_FCP_RSP_BUFFER, MPI_POINTER PTR_MPI_TARGET_FCP_RSP_BUFFER,\n  MpiTargetFcpRspBuffer, MPI_POINTER pMpiTargetFcpRspBuffer;\n\n/*\n * NOTE: The SPI status IU is big-endian. When used on a little-endian system,\n * this structure properly orders the bytes.\n */\ntypedef struct _MPI_TARGET_SCSI_SPI_STATUS_IU\n{\n    U8      Reserved0;                                  /* 00h */\n    U8      Reserved1;                                  /* 01h */\n    U8      Valid;                                      /* 02h */\n    U8      Status;                                     /* 03h */\n    U32     SenseDataListLength;                        /* 04h */\n    U32     PktFailuresListLength;                      /* 08h */\n    U8      SenseData[52]; /* Pad the IU to 64 bytes */ /* 0Ch */\n} MPI_TARGET_SCSI_SPI_STATUS_IU, MPI_POINTER PTR_MPI_TARGET_SCSI_SPI_STATUS_IU,\n  TargetScsiSpiStatusIU_t, MPI_POINTER pTargetScsiSpiStatusIU_t;\n\n/*\n * NOTE: The SSP status IU is big-endian. When used on a little-endian system,\n * this structure properly orders the bytes.\n */\ntypedef struct _MPI_TARGET_SSP_RSP_IU\n{\n    U32     Reserved0[6]; /* reserved for SSP header */ /* 00h */\n    /* start of RESPONSE information unit */\n    U32     Reserved1;                                  /* 18h */\n    U32     Reserved2;                                  /* 1Ch */\n    U16     Reserved3;                                  /* 20h */\n    U8      DataPres; /* lower 2 bits */                /* 22h */\n    U8      Status;                                     /* 23h */\n    U32     Reserved4;                                  /* 24h */\n    U32     SenseDataLength;                            /* 28h */\n    U32     ResponseDataLength;                         /* 2Ch */\n    U8      ResponseSenseData[4];                       /* 30h */\n} MPI_TARGET_SSP_RSP_IU, MPI_POINTER PTR_MPI_TARGET_SSP_RSP_IU,\n  MpiTargetSspRspIu_t, MPI_POINTER pMpiTargetSspRspIu_t;\n\n\n/****************************************************************************/\n/* Target Mode Abort Request                                                */\n/****************************************************************************/\n\ntypedef struct _MSG_TARGET_MODE_ABORT_REQUEST\n{\n    U8                      AbortType;                  /* 00h */\n    U8                      Reserved;                   /* 01h */\n    U8                      ChainOffset;                /* 02h */\n    U8                      Function;                   /* 03h */\n    U16                     Reserved1;                  /* 04h */\n    U8                      Reserved2;                  /* 06h */\n    U8                      MsgFlags;                   /* 07h */\n    U32                     MsgContext;                 /* 08h */\n    U32                     ReplyWord;                  /* 0Ch */\n    U32                     MsgContextToAbort;          /* 10h */\n} MSG_TARGET_MODE_ABORT, MPI_POINTER PTR_MSG_TARGET_MODE_ABORT,\n  TargetModeAbort_t, MPI_POINTER pTargetModeAbort_t;\n\n#define TARGET_MODE_ABORT_TYPE_ALL_CMD_BUFFERS      (0x00)\n#define TARGET_MODE_ABORT_TYPE_ALL_IO               (0x01)\n#define TARGET_MODE_ABORT_TYPE_EXACT_IO             (0x02)\n#define TARGET_MODE_ABORT_TYPE_EXACT_IO_REQUEST     (0x03)\n\n/* Target Mode Abort Reply */\n\ntypedef struct _MSG_TARGET_MODE_ABORT_REPLY\n{\n    U16                     Reserved;                   /* 00h */\n    U8                      MsgLength;                  /* 02h */\n    U8                      Function;                   /* 03h */\n    U16                     Reserved1;                  /* 04h */\n    U8                      Reserved2;                  /* 06h */\n    U8                      MsgFlags;                   /* 07h */\n    U32                     MsgContext;                 /* 08h */\n    U16                     Reserved3;                  /* 0Ch */\n    U16                     IOCStatus;                  /* 0Eh */\n    U32                     IOCLogInfo;                 /* 10h */\n    U32                     AbortCount;                 /* 14h */\n} MSG_TARGET_MODE_ABORT_REPLY, MPI_POINTER PTR_MSG_TARGET_MODE_ABORT_REPLY,\n  TargetModeAbortReply_t, MPI_POINTER pTargetModeAbortReply_t;\n\n\n/****************************************************************************/\n/* Target Mode Context Reply                                                */\n/****************************************************************************/\n\n#define TARGET_MODE_REPLY_IO_INDEX_MASK         (0x00003FFF)\n#define TARGET_MODE_REPLY_IO_INDEX_SHIFT        (0)\n#define TARGET_MODE_REPLY_INITIATOR_INDEX_MASK  (0x03FFC000)\n#define TARGET_MODE_REPLY_INITIATOR_INDEX_SHIFT (14)\n#define TARGET_MODE_REPLY_ALIAS_MASK            (0x04000000)\n#define TARGET_MODE_REPLY_ALIAS_SHIFT           (26)\n#define TARGET_MODE_REPLY_PORT_MASK             (0x10000000)\n#define TARGET_MODE_REPLY_PORT_SHIFT            (28)\n\n\n#define GET_IO_INDEX(x)     (((x) & TARGET_MODE_REPLY_IO_INDEX_MASK)           \\\n                                    >> TARGET_MODE_REPLY_IO_INDEX_SHIFT)\n\n#define SET_IO_INDEX(t, i)                                                     \\\n            ((t) = ((t) & ~TARGET_MODE_REPLY_IO_INDEX_MASK) |                  \\\n                              (((i) << TARGET_MODE_REPLY_IO_INDEX_SHIFT) &     \\\n                                             TARGET_MODE_REPLY_IO_INDEX_MASK))\n\n#define GET_INITIATOR_INDEX(x) (((x) & TARGET_MODE_REPLY_INITIATOR_INDEX_MASK) \\\n                                   >> TARGET_MODE_REPLY_INITIATOR_INDEX_SHIFT)\n\n#define SET_INITIATOR_INDEX(t, ii)                                             \\\n        ((t) = ((t) & ~TARGET_MODE_REPLY_INITIATOR_INDEX_MASK) |               \\\n                        (((ii) << TARGET_MODE_REPLY_INITIATOR_INDEX_SHIFT) &   \\\n                                      TARGET_MODE_REPLY_INITIATOR_INDEX_MASK))\n\n#define GET_ALIAS(x) (((x) & TARGET_MODE_REPLY_ALIAS_MASK)                     \\\n                                               >> TARGET_MODE_REPLY_ALIAS_SHIFT)\n\n#define SET_ALIAS(t, a)  ((t) = ((t) & ~TARGET_MODE_REPLY_ALIAS_MASK) |        \\\n                                    (((a) << TARGET_MODE_REPLY_ALIAS_SHIFT) &  \\\n                                                 TARGET_MODE_REPLY_ALIAS_MASK))\n\n#define GET_PORT(x) (((x) & TARGET_MODE_REPLY_PORT_MASK)                       \\\n                                               >> TARGET_MODE_REPLY_PORT_SHIFT)\n\n#define SET_PORT(t, p)  ((t) = ((t) & ~TARGET_MODE_REPLY_PORT_MASK) |          \\\n                                    (((p) << TARGET_MODE_REPLY_PORT_SHIFT) &   \\\n                                                  TARGET_MODE_REPLY_PORT_MASK))\n\n/* the following obsolete values are for MPI v1.0 support */\n#define TARGET_MODE_REPLY_0100_MASK_HOST_INDEX       (0x000003FF)\n#define TARGET_MODE_REPLY_0100_SHIFT_HOST_INDEX      (0)\n#define TARGET_MODE_REPLY_0100_MASK_IOC_INDEX        (0x001FF800)\n#define TARGET_MODE_REPLY_0100_SHIFT_IOC_INDEX       (11)\n#define TARGET_MODE_REPLY_0100_PORT_MASK             (0x00400000)\n#define TARGET_MODE_REPLY_0100_PORT_SHIFT            (22)\n#define TARGET_MODE_REPLY_0100_MASK_INITIATOR_INDEX  (0x1F800000)\n#define TARGET_MODE_REPLY_0100_SHIFT_INITIATOR_INDEX (23)\n\n#define GET_HOST_INDEX_0100(x) (((x) & TARGET_MODE_REPLY_0100_MASK_HOST_INDEX) \\\n                                  >> TARGET_MODE_REPLY_0100_SHIFT_HOST_INDEX)\n\n#define SET_HOST_INDEX_0100(t, hi)                                             \\\n            ((t) = ((t) & ~TARGET_MODE_REPLY_0100_MASK_HOST_INDEX) |           \\\n                         (((hi) << TARGET_MODE_REPLY_0100_SHIFT_HOST_INDEX) &  \\\n                                      TARGET_MODE_REPLY_0100_MASK_HOST_INDEX))\n\n#define GET_IOC_INDEX_0100(x)   (((x) & TARGET_MODE_REPLY_0100_MASK_IOC_INDEX) \\\n                                  >> TARGET_MODE_REPLY_0100_SHIFT_IOC_INDEX)\n\n#define SET_IOC_INDEX_0100(t, ii)                                              \\\n            ((t) = ((t) & ~TARGET_MODE_REPLY_0100_MASK_IOC_INDEX) |            \\\n                        (((ii) << TARGET_MODE_REPLY_0100_SHIFT_IOC_INDEX) &    \\\n                                     TARGET_MODE_REPLY_0100_MASK_IOC_INDEX))\n\n#define GET_INITIATOR_INDEX_0100(x)                                            \\\n            (((x) & TARGET_MODE_REPLY_0100_MASK_INITIATOR_INDEX)               \\\n                              >> TARGET_MODE_REPLY_0100_SHIFT_INITIATOR_INDEX)\n\n#define SET_INITIATOR_INDEX_0100(t, ii)                                        \\\n        ((t) = ((t) & ~TARGET_MODE_REPLY_0100_MASK_INITIATOR_INDEX) |          \\\n                   (((ii) << TARGET_MODE_REPLY_0100_SHIFT_INITIATOR_INDEX) &   \\\n                                TARGET_MODE_REPLY_0100_MASK_INITIATOR_INDEX))\n\n\n#endif\n\n"
  },
  {
    "path": "freebsd-headers/dev/mpt/mpilib/mpi_tool.h",
    "content": "/* $FreeBSD: release/9.0.0/sys/dev/mpt/mpilib/mpi_tool.h 154603 2006-01-21 00:29:52Z mjacob $ */\n/*-\n * Copyright (c) 2000-2005, LSI Logic Corporation and its contributors.\n * All rights reserved.\n * \n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions are\n * met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce at minimum a disclaimer\n *    substantially similar to the \"NO WARRANTY\" disclaimer below\n *    (\"Disclaimer\") and any redistribution must be conditioned upon including\n *    a substantially similar Disclaimer requirement for further binary\n *    redistribution.\n * 3. Neither the name of the LSI Logic Corporation nor the names of its\n *    contributors may be used to endorse or promote products derived from\n *    this software without specific prior written permission.\n * \n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\n * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE\n * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\n * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\n * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\n * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\n * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF THE COPYRIGHT\n * OWNER OR CONTRIBUTOR IS ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n *\n *\n *           Name:  mpi_tool.h\n *          Title:  MPI Toolbox structures and definitions\n *  Creation Date:  July 30, 2001\n *\n *    mpi_tool.h Version:  01.05.03\n *\n *  Version History\n *  ---------------\n *\n *  Date      Version   Description\n *  --------  --------  ------------------------------------------------------\n *  08-08-01  01.02.01  Original release.\n *  08-29-01  01.02.02  Added DIAG_DATA_UPLOAD_HEADER and related defines.\n *  01-16-04  01.02.03  Added defines and structures for new tools\n *.                     MPI_TOOLBOX_ISTWI_READ_WRITE_TOOL and\n *                      MPI_TOOLBOX_FC_MANAGEMENT_TOOL.\n *  04-29-04  01.02.04  Added message structures for Diagnostic Buffer Post and\n *                      Diagnostic Release requests and replies.\n *  05-11-04  01.03.01  Original release for MPI v1.3.\n *  08-19-04  01.05.01  Original release for MPI v1.5.\n *  10-06-04  01.05.02  Added define for MPI_DIAG_BUF_TYPE_COUNT.\n *  02-09-05  01.05.03  Added frame size option to FC management tool.\n *                      Added Beacon tool to the Toolbox.\n *  --------------------------------------------------------------------------\n */\n\n#ifndef MPI_TOOL_H\n#define MPI_TOOL_H\n\n#define MPI_TOOLBOX_CLEAN_TOOL                      (0x00)\n#define MPI_TOOLBOX_MEMORY_MOVE_TOOL                (0x01)\n#define MPI_TOOLBOX_DIAG_DATA_UPLOAD_TOOL           (0x02)\n#define MPI_TOOLBOX_ISTWI_READ_WRITE_TOOL           (0x03)\n#define MPI_TOOLBOX_FC_MANAGEMENT_TOOL              (0x04)\n#define MPI_TOOLBOX_BEACON_TOOL                     (0x05)\n\n\n/****************************************************************************/\n/* Toolbox reply                                                            */\n/****************************************************************************/\n\ntypedef struct _MSG_TOOLBOX_REPLY\n{\n    U8                      Tool;                       /* 00h */\n    U8                      Reserved;                   /* 01h */\n    U8                      MsgLength;                  /* 02h */\n    U8                      Function;                   /* 03h */\n    U16                     Reserved1;                  /* 04h */\n    U8                      Reserved2;                  /* 06h */\n    U8                      MsgFlags;                   /* 07h */\n    U32                     MsgContext;                 /* 08h */\n    U16                     Reserved3;                  /* 0Ch */\n    U16                     IOCStatus;                  /* 0Eh */\n    U32                     IOCLogInfo;                 /* 10h */\n} MSG_TOOLBOX_REPLY, MPI_POINTER PTR_MSG_TOOLBOX_REPLY,\n  ToolboxReply_t, MPI_POINTER pToolboxReply_t;\n\n\n/****************************************************************************/\n/* Toolbox Clean Tool request                                               */\n/****************************************************************************/\n\ntypedef struct _MSG_TOOLBOX_CLEAN_REQUEST\n{\n    U8                      Tool;                       /* 00h */\n    U8                      Reserved;                   /* 01h */\n    U8                      ChainOffset;                /* 02h */\n    U8                      Function;                   /* 03h */\n    U16                     Reserved1;                  /* 04h */\n    U8                      Reserved2;                  /* 06h */\n    U8                      MsgFlags;                   /* 07h */\n    U32                     MsgContext;                 /* 08h */\n    U32                     Flags;                      /* 0Ch */\n} MSG_TOOLBOX_CLEAN_REQUEST, MPI_POINTER PTR_MSG_TOOLBOX_CLEAN_REQUEST,\n  ToolboxCleanRequest_t, MPI_POINTER pToolboxCleanRequest_t;\n\n#define MPI_TOOLBOX_CLEAN_NVSRAM                    (0x00000001)\n#define MPI_TOOLBOX_CLEAN_SEEPROM                   (0x00000002)\n#define MPI_TOOLBOX_CLEAN_FLASH                     (0x00000004)\n#define MPI_TOOLBOX_CLEAN_BOOTLOADER                (0x04000000)\n#define MPI_TOOLBOX_CLEAN_FW_BACKUP                 (0x08000000)\n#define MPI_TOOLBOX_CLEAN_FW_CURRENT                (0x10000000)\n#define MPI_TOOLBOX_CLEAN_OTHER_PERSIST_PAGES       (0x20000000)\n#define MPI_TOOLBOX_CLEAN_PERSIST_MANUFACT_PAGES    (0x40000000)\n#define MPI_TOOLBOX_CLEAN_BOOT_SERVICES             (0x80000000)\n\n\n/****************************************************************************/\n/* Toolbox Memory Move request                                              */\n/****************************************************************************/\n\ntypedef struct _MSG_TOOLBOX_MEM_MOVE_REQUEST\n{\n    U8                      Tool;                       /* 00h */\n    U8                      Reserved;                   /* 01h */\n    U8                      ChainOffset;                /* 02h */\n    U8                      Function;                   /* 03h */\n    U16                     Reserved1;                  /* 04h */\n    U8                      Reserved2;                  /* 06h */\n    U8                      MsgFlags;                   /* 07h */\n    U32                     MsgContext;                 /* 08h */\n    SGE_SIMPLE_UNION        SGL;                        /* 0Ch */\n} MSG_TOOLBOX_MEM_MOVE_REQUEST, MPI_POINTER PTR_MSG_TOOLBOX_MEM_MOVE_REQUEST,\n  ToolboxMemMoveRequest_t, MPI_POINTER pToolboxMemMoveRequest_t;\n\n\n/****************************************************************************/\n/* Toolbox Diagnostic Data Upload request                                   */\n/****************************************************************************/\n\ntypedef struct _MSG_TOOLBOX_DIAG_DATA_UPLOAD_REQUEST\n{\n    U8                      Tool;                       /* 00h */\n    U8                      Reserved;                   /* 01h */\n    U8                      ChainOffset;                /* 02h */\n    U8                      Function;                   /* 03h */\n    U16                     Reserved1;                  /* 04h */\n    U8                      Reserved2;                  /* 06h */\n    U8                      MsgFlags;                   /* 07h */\n    U32                     MsgContext;                 /* 08h */\n    U32                     Flags;                      /* 0Ch */\n    U32                     Reserved3;                  /* 10h */\n    SGE_SIMPLE_UNION        SGL;                        /* 14h */\n} MSG_TOOLBOX_DIAG_DATA_UPLOAD_REQUEST, MPI_POINTER PTR_MSG_TOOLBOX_DIAG_DATA_UPLOAD_REQUEST,\n  ToolboxDiagDataUploadRequest_t, MPI_POINTER pToolboxDiagDataUploadRequest_t;\n\ntypedef struct _DIAG_DATA_UPLOAD_HEADER\n{\n    U32                     DiagDataLength;             /* 00h */\n    U8                      FormatCode;                 /* 04h */\n    U8                      Reserved;                   /* 05h */\n    U16                     Reserved1;                  /* 06h */\n} DIAG_DATA_UPLOAD_HEADER, MPI_POINTER PTR_DIAG_DATA_UPLOAD_HEADER,\n  DiagDataUploadHeader_t, MPI_POINTER pDiagDataUploadHeader_t;\n\n#define MPI_TB_DIAG_FORMAT_SCSI_PRINTF_1            (0x01)\n#define MPI_TB_DIAG_FORMAT_SCSI_2                   (0x02)\n#define MPI_TB_DIAG_FORMAT_SCSI_3                   (0x03)\n#define MPI_TB_DIAG_FORMAT_FC_TRACE_1               (0x04)\n\n\n/****************************************************************************/\n/* Toolbox ISTWI Read Write request                                         */\n/****************************************************************************/\n\ntypedef struct _MSG_TOOLBOX_ISTWI_READ_WRITE_REQUEST\n{\n    U8                      Tool;                       /* 00h */\n    U8                      Reserved;                   /* 01h */\n    U8                      ChainOffset;                /* 02h */\n    U8                      Function;                   /* 03h */\n    U16                     Reserved1;                  /* 04h */\n    U8                      Reserved2;                  /* 06h */\n    U8                      MsgFlags;                   /* 07h */\n    U32                     MsgContext;                 /* 08h */\n    U8                      Flags;                      /* 0Ch */\n    U8                      BusNum;                     /* 0Dh */\n    U16                     Reserved3;                  /* 0Eh */\n    U8                      NumAddressBytes;            /* 10h */\n    U8                      Reserved4;                  /* 11h */\n    U16                     DataLength;                 /* 12h */\n    U8                      DeviceAddr;                 /* 14h */\n    U8                      Addr1;                      /* 15h */\n    U8                      Addr2;                      /* 16h */\n    U8                      Addr3;                      /* 17h */\n    U32                     Reserved5;                  /* 18h */\n    SGE_SIMPLE_UNION        SGL;                        /* 1Ch */\n} MSG_TOOLBOX_ISTWI_READ_WRITE_REQUEST, MPI_POINTER PTR_MSG_TOOLBOX_ISTWI_READ_WRITE_REQUEST,\n  ToolboxIstwiReadWriteRequest_t, MPI_POINTER pToolboxIstwiReadWriteRequest_t;\n\n#define MPI_TB_ISTWI_FLAGS_WRITE                    (0x00)\n#define MPI_TB_ISTWI_FLAGS_READ                     (0x01)\n\n\n/****************************************************************************/\n/* Toolbox FC Management request                                            */\n/****************************************************************************/\n\n/* ActionInfo for Bus and TargetId */\ntypedef struct _MPI_TB_FC_MANAGE_BUS_TID_AI\n{\n    U16                     Reserved;                   /* 00h */\n    U8                      Bus;                        /* 02h */\n    U8                      TargetId;                   /* 03h */\n} MPI_TB_FC_MANAGE_BUS_TID_AI, MPI_POINTER PTR_MPI_TB_FC_MANAGE_BUS_TID_AI,\n  MpiTbFcManageBusTidAi_t, MPI_POINTER pMpiTbFcManageBusTidAi_t;\n\n/* ActionInfo for port identifier */\ntypedef struct _MPI_TB_FC_MANAGE_PID_AI\n{\n    U32                     PortIdentifier;             /* 00h */\n} MPI_TB_FC_MANAGE_PID_AI, MPI_POINTER PTR_MPI_TB_FC_MANAGE_PID_AI,\n  MpiTbFcManagePidAi_t, MPI_POINTER pMpiTbFcManagePidAi_t;\n\n/* ActionInfo for set max frame size */\ntypedef struct _MPI_TB_FC_MANAGE_FRAME_SIZE_AI\n{\n    U16                     FrameSize;                  /* 00h */\n    U8                      PortNum;                    /* 02h */\n    U8                      Reserved1;                  /* 03h */\n} MPI_TB_FC_MANAGE_FRAME_SIZE_AI, MPI_POINTER PTR_MPI_TB_FC_MANAGE_FRAME_SIZE_AI,\n  MpiTbFcManageFrameSizeAi_t, MPI_POINTER pMpiTbFcManageFrameSizeAi_t;\n\n/* union of ActionInfo */\ntypedef union _MPI_TB_FC_MANAGE_AI_UNION\n{\n    MPI_TB_FC_MANAGE_BUS_TID_AI     BusTid;\n    MPI_TB_FC_MANAGE_PID_AI         Port;\n    MPI_TB_FC_MANAGE_FRAME_SIZE_AI  FrameSize;\n} MPI_TB_FC_MANAGE_AI_UNION, MPI_POINTER PTR_MPI_TB_FC_MANAGE_AI_UNION,\n  MpiTbFcManageAiUnion_t, MPI_POINTER pMpiTbFcManageAiUnion_t;\n\ntypedef struct _MSG_TOOLBOX_FC_MANAGE_REQUEST\n{\n    U8                          Tool;                   /* 00h */\n    U8                          Reserved;               /* 01h */\n    U8                          ChainOffset;            /* 02h */\n    U8                          Function;               /* 03h */\n    U16                         Reserved1;              /* 04h */\n    U8                          Reserved2;              /* 06h */\n    U8                          MsgFlags;               /* 07h */\n    U32                         MsgContext;             /* 08h */\n    U8                          Action;                 /* 0Ch */\n    U8                          Reserved3;              /* 0Dh */\n    U16                         Reserved4;              /* 0Eh */\n    MPI_TB_FC_MANAGE_AI_UNION   ActionInfo;             /* 10h */\n} MSG_TOOLBOX_FC_MANAGE_REQUEST, MPI_POINTER PTR_MSG_TOOLBOX_FC_MANAGE_REQUEST,\n  ToolboxFcManageRequest_t, MPI_POINTER pToolboxFcManageRequest_t;\n\n/* defines for the Action field */\n#define MPI_TB_FC_MANAGE_ACTION_DISC_ALL            (0x00)\n#define MPI_TB_FC_MANAGE_ACTION_DISC_PID            (0x01)\n#define MPI_TB_FC_MANAGE_ACTION_DISC_BUS_TID        (0x02)\n#define MPI_TB_FC_MANAGE_ACTION_SET_MAX_FRAME_SIZE  (0x03)\n\n\n/****************************************************************************/\n/* Toolbox Beacon Tool request                                               */\n/****************************************************************************/\n\ntypedef struct _MSG_TOOLBOX_BEACON_REQUEST\n{\n    U8                      Tool;                       /* 00h */\n    U8                      Reserved;                   /* 01h */\n    U8                      ChainOffset;                /* 02h */\n    U8                      Function;                   /* 03h */\n    U16                     Reserved1;                  /* 04h */\n    U8                      Reserved2;                  /* 06h */\n    U8                      MsgFlags;                   /* 07h */\n    U32                     MsgContext;                 /* 08h */\n    U8                      ConnectNum;                 /* 0Ch */\n    U8                      PortNum;                    /* 0Dh */\n    U8                      Reserved3;                  /* 0Eh */\n    U8                      Flags;                      /* 0Fh */\n} MSG_TOOLBOX_BEACON_REQUEST, MPI_POINTER PTR_MSG_TOOLBOX_BEACON_REQUEST,\n  ToolboxBeaconRequest_t, MPI_POINTER pToolboxBeaconRequest_t;\n\n#define MPI_TOOLBOX_FLAGS_BEACON_MODE_OFF       (0x00)\n#define MPI_TOOLBOX_FLAGS_BEACON_MODE_ON        (0x01)\n\n\n/****************************************************************************/\n/* Diagnostic Buffer Post request                                           */\n/****************************************************************************/\n\ntypedef struct _MSG_DIAG_BUFFER_POST_REQUEST\n{\n    U8                      TraceLevel;                 /* 00h */\n    U8                      BufferType;                 /* 01h */\n    U8                      ChainOffset;                /* 02h */\n    U8                      Function;                   /* 03h */\n    U16                     Reserved1;                  /* 04h */\n    U8                      Reserved2;                  /* 06h */\n    U8                      MsgFlags;                   /* 07h */\n    U32                     MsgContext;                 /* 08h */\n    U32                     ExtendedType;               /* 0Ch */\n    U32                     BufferLength;               /* 10h */\n    U32                     ProductSpecific[4];         /* 14h */\n    U32                     Reserved3;                  /* 24h */\n    U64                     BufferAddress;              /* 28h */\n} MSG_DIAG_BUFFER_POST_REQUEST, MPI_POINTER PTR_MSG_DIAG_BUFFER_POST_REQUEST,\n  DiagBufferPostRequest_t, MPI_POINTER pDiagBufferPostRequest_t;\n\n#define MPI_DIAG_BUF_TYPE_TRACE                     (0x00)\n#define MPI_DIAG_BUF_TYPE_SNAPSHOT                  (0x01)\n#define MPI_DIAG_BUF_TYPE_EXTENDED                  (0x02)\n/* count of the number of buffer types */\n#define MPI_DIAG_BUF_TYPE_COUNT                     (0x03)\n\n#define MPI_DIAG_EXTENDED_QTAG                      (0x00000001)\n\n\n/* Diagnostic Buffer Post reply */\ntypedef struct _MSG_DIAG_BUFFER_POST_REPLY\n{\n    U8                      Reserved1;                  /* 00h */\n    U8                      BufferType;                 /* 01h */\n    U8                      MsgLength;                  /* 02h */\n    U8                      Function;                   /* 03h */\n    U16                     Reserved2;                  /* 04h */\n    U8                      Reserved3;                  /* 06h */\n    U8                      MsgFlags;                   /* 07h */\n    U32                     MsgContext;                 /* 08h */\n    U16                     Reserved4;                  /* 0Ch */\n    U16                     IOCStatus;                  /* 0Eh */\n    U32                     IOCLogInfo;                 /* 10h */\n    U32                     TransferLength;             /* 14h */\n} MSG_DIAG_BUFFER_POST_REPLY, MPI_POINTER PTR_MSG_DIAG_BUFFER_POST_REPLY,\n  DiagBufferPostReply_t, MPI_POINTER pDiagBufferPostReply_t;\n\n\n/****************************************************************************/\n/* Diagnostic Release request                                               */\n/****************************************************************************/\n\ntypedef struct _MSG_DIAG_RELEASE_REQUEST\n{\n    U8                      Reserved1;                  /* 00h */\n    U8                      BufferType;                 /* 01h */\n    U8                      ChainOffset;                /* 02h */\n    U8                      Function;                   /* 03h */\n    U16                     Reserved2;                  /* 04h */\n    U8                      Reserved3;                  /* 06h */\n    U8                      MsgFlags;                   /* 07h */\n    U32                     MsgContext;                 /* 08h */\n} MSG_DIAG_RELEASE_REQUEST, MPI_POINTER PTR_MSG_DIAG_RELEASE_REQUEST,\n  DiagReleaseRequest_t, MPI_POINTER pDiagReleaseRequest_t;\n\n\n/* Diagnostic Release reply */\ntypedef struct _MSG_DIAG_RELEASE_REPLY\n{\n    U8                      Reserved1;                  /* 00h */\n    U8                      BufferType;                 /* 01h */\n    U8                      MsgLength;                  /* 02h */\n    U8                      Function;                   /* 03h */\n    U16                     Reserved2;                  /* 04h */\n    U8                      Reserved3;                  /* 06h */\n    U8                      MsgFlags;                   /* 07h */\n    U32                     MsgContext;                 /* 08h */\n    U16                     Reserved4;                  /* 0Ch */\n    U16                     IOCStatus;                  /* 0Eh */\n    U32                     IOCLogInfo;                 /* 10h */\n} MSG_DIAG_RELEASE_REPLY, MPI_POINTER PTR_MSG_DIAG_RELEASE_REPLY,\n  DiagReleaseReply_t, MPI_POINTER pDiagReleaseReply_t;\n\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/dev/mpt/mpilib/mpi_type.h",
    "content": "/* $FreeBSD: release/9.0.0/sys/dev/mpt/mpilib/mpi_type.h 156041 2006-02-26 22:50:14Z mjacob $ */\n/*\n * Copyright (c) 2000-2005, LSI Logic Corporation and its contributors.\n * All rights reserved.\n * \n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions are\n * met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce at minimum a disclaimer\n *    substantially similar to the \"NO WARRANTY\" disclaimer below\n *    (\"Disclaimer\") and any redistribution must be conditioned upon including\n *    a substantially similar Disclaimer requirement for further binary\n *    redistribution.\n * 3. Neither the name of the LSI Logic Corporation nor the names of its\n *    contributors may be used to endorse or promote products derived from\n *    this software without specific prior written permission.\n * \n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\n * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE\n * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\n * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\n * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\n * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\n * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF THE COPYRIGHT\n * OWNER OR CONTRIBUTOR IS ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n * \n * \n *           Name:  mpi_type.h\n *          Title:  MPI Basic type definitions\n *  Creation Date:  June 6, 2000\n *\n *    mpi_type.h Version:  01.05.02\n *\n *  Version History\n *  ---------------\n *\n *  Date      Version   Description\n *  --------  --------  ------------------------------------------------------\n *  05-08-00  00.10.01  Original release for 0.10 spec dated 4/26/2000.\n *  06-06-00  01.00.01  Update version number for 1.0 release.\n *  11-02-00  01.01.01  Original release for post 1.0 work\n *  02-20-01  01.01.02  Added define and ifdef for MPI_POINTER.\n *  08-08-01  01.02.01  Original release for v1.2 work.\n *  05-11-04  01.03.01  Original release for MPI v1.3.\n *  08-19-04  01.05.01  Original release for MPI v1.5.\n *  08-30-05  01.05.02  Added PowerPC option to #ifdef's.\n *  --------------------------------------------------------------------------\n */\n\n#ifndef MPI_TYPE_H\n#define MPI_TYPE_H\n\n\n/*******************************************************************************\n * Define MPI_POINTER if it hasn't already been defined. By default MPI_POINTER\n * is defined to be a near pointer. MPI_POINTER can be defined as a far pointer\n * by defining MPI_POINTER as \"far *\" before this header file is included.\n */\n#ifndef MPI_POINTER\n#define MPI_POINTER     *\n#endif\n\n\n/*****************************************************************************\n*\n*               B a s i c    T y p e s\n*\n*****************************************************************************/\n\ntypedef signed   char   S8;\ntypedef unsigned char   U8;\ntypedef signed   short  S16;\ntypedef unsigned short  U16;\n\n#ifdef\t__FreeBSD__\n\ntypedef int32_t  S32;\ntypedef uint32_t U32;\n\n#else\n\n#if defined(unix) || defined(__arm) || defined(ALPHA) || defined(__PPC__) || defined(__ppc)\n\n    typedef signed   int   S32;\n    typedef unsigned int   U32;\n\n#else\n\n    typedef signed   long  S32;\n    typedef unsigned long  U32;\n\n#endif\n#endif\n\n\ntypedef struct _S64\n{\n    U32          Low;\n    S32          High;\n} S64;\n\ntypedef struct _U64\n{\n    U32          Low;\n    U32          High;\n} U64;\n\n\n/****************************************************************************/\n/*  Pointers                                                                */\n/****************************************************************************/\n\ntypedef S8      *PS8;\ntypedef U8      *PU8;\ntypedef S16     *PS16;\ntypedef U16     *PU16;\ntypedef S32     *PS32;\ntypedef U32     *PU32;\ntypedef S64     *PS64;\ntypedef U64     *PU64;\n\n\n#endif\n\n"
  },
  {
    "path": "freebsd-headers/dev/ofw/ofw_bus.h",
    "content": "/*-\n * Copyright (c) 2001, 2003 by Thomas Moestl <tmm@FreeBSD.org>\n * Copyright (c) 2004 by Marius Strobl <marius@FreeBSD.org>\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR\n * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES\n * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR\n * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,\n * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE\n * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/dev/ofw/ofw_bus.h 133589 2004-08-12 17:41:33Z marius $\n */\n\n#ifndef\t_DEV_OFW_OFW_BUS_H_\n#define\t_DEV_OFW_OFW_BUS_H_\n\n#include <sys/bus.h>\n\n#include <dev/ofw/openfirm.h>\n\n#include \"ofw_bus_if.h\"\n\nstatic __inline const char *\nofw_bus_get_compat(device_t dev)\n{\n\n\treturn (OFW_BUS_GET_COMPAT(device_get_parent(dev), dev));\n}\n\nstatic __inline const char *\nofw_bus_get_model(device_t dev)\n{\n\n\treturn (OFW_BUS_GET_MODEL(device_get_parent(dev), dev));\n}\n\nstatic __inline const char *\nofw_bus_get_name(device_t dev)\n{\n\n\treturn (OFW_BUS_GET_NAME(device_get_parent(dev), dev));\n}\n\nstatic __inline phandle_t\nofw_bus_get_node(device_t dev)\n{\n\n\treturn (OFW_BUS_GET_NODE(device_get_parent(dev), dev));\n}\n\nstatic __inline const char *\nofw_bus_get_type(device_t dev)\n{\n\n\treturn (OFW_BUS_GET_TYPE(device_get_parent(dev), dev));\n}\n\n#endif /* !_DEV_OFW_OFW_BUS_H_ */\n"
  },
  {
    "path": "freebsd-headers/dev/ofw/ofw_bus_subr.h",
    "content": "/*-\n * Copyright (c) 2005 Marius Strobl <marius@FreeBSD.org>\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions, and the following disclaimer,\n *    without modification, immediately at the beginning of the file.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in\n *    the documentation and/or other materials provided with the\n *    distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR\n * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/dev/ofw/ofw_bus_subr.h 209298 2010-06-18 14:06:27Z nwhitehorn $\n */\n\n#ifndef\t_DEV_OFW_OFW_BUS_SUBR_H_\n#define\t_DEV_OFW_OFW_BUS_SUBR_H_\n\n#include <sys/bus.h>\n\n#include <dev/ofw/openfirm.h>\n\n#include \"ofw_bus_if.h\"\n\n#define\tORIP_NOINT\t-1\n#define\tORIR_NOTFOUND\t0xffffffff\n\nstruct ofw_bus_iinfo {\n\tuint8_t\t\t\t*opi_imap;\n\tuint8_t\t\t\t*opi_imapmsk;\n\tint\t\t\topi_imapsz;\n\tpcell_t\t\t\topi_addrc;\n};\n\n/* Generic implementation of ofw_bus_if.m methods and helper routines */\nint\tofw_bus_gen_setup_devinfo(struct ofw_bus_devinfo *, phandle_t);\nvoid\tofw_bus_gen_destroy_devinfo(struct ofw_bus_devinfo *);\n\nofw_bus_get_compat_t\tofw_bus_gen_get_compat;\nofw_bus_get_model_t\tofw_bus_gen_get_model;\nofw_bus_get_name_t\tofw_bus_gen_get_name;\nofw_bus_get_node_t\tofw_bus_gen_get_node;\nofw_bus_get_type_t\tofw_bus_gen_get_type;\n\n/* Helper method to report interesting OF properties in pnpinfo */\nbus_child_pnpinfo_str_t\tofw_bus_gen_child_pnpinfo_str;\n\n/* Routines for processing firmware interrupt maps */\nvoid\tofw_bus_setup_iinfo(phandle_t, struct ofw_bus_iinfo *, int);\nint\tofw_bus_lookup_imap(phandle_t, struct ofw_bus_iinfo *, void *, int,\n\t    void *, int, void *, int, phandle_t *, void *);\nint\tofw_bus_search_intrmap(void *, int, void *, int, void *, int, void *,\n\t    void *, void *, int, phandle_t *);\n\n/* Helper to get node's interrupt parent */\nvoid\tofw_bus_find_iparent(phandle_t);\n\n/* Helper routine for checking compat prop */\nint ofw_bus_is_compatible(device_t, const char *);\nint ofw_bus_is_compatible_strict(device_t, const char *);\n\n#endif /* !_DEV_OFW_OFW_BUS_SUBR_H_ */\n"
  },
  {
    "path": "freebsd-headers/dev/ofw/ofw_pci.h",
    "content": "/*-\n * Copyright (c) 1999 The NetBSD Foundation, Inc.\n * All rights reserved.\n *\n * This code is derived from software contributed to The NetBSD Foundation\n * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility,\n * NASA Ames Research Center.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS\n * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED\n * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\n * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS\n * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\n * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\n * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\n * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\n * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n *\n *\tfrom: NetBSD: ofw_pci.h,v 1.5 2003/10/22 09:04:39 mjl Exp\n *\n * $FreeBSD: release/9.0.0/sys/dev/ofw/ofw_pci.h 204520 2010-03-01 16:52:11Z joel $\n */\n\n#ifndef _DEV_OFW_OFW_PCI_H_\n#define\t_DEV_OFW_OFW_PCI_H_\n\n/*\n * PCI Bus Binding to:\n *\n * IEEE Std 1275-1994\n * Standard for Boot (Initialization Configuration) Firmware\n *\n * Revision 2.1\n */\n\n/*\n * Section 2.2.1. Physical Address Formats\n *\n * A PCI physical address is represented by 3 address cells:\n *\n *\tphys.hi cell:\tnpt000ss bbbbbbbb dddddfff rrrrrrrr\n *\tphys.mid cell:\thhhhhhhh hhhhhhhh hhhhhhhh hhhhhhhh\n *\tphys.lo cell:\tllllllll llllllll llllllll llllllll\n *\n *\tn\tnonrelocatable\n *\tp\tprefetchable\n *\tt\taliased below 1MB (memory) or 64k (i/o)\n *\tss\tspace code\n *\tb\tbus number\n *\td\tdevice number\n *\tf\tfunction number\n *\tr\tregister number\n *\th\thigh 32-bits of PCI address\n *\tl\tlow 32-bits of PCI address\n */\n\n#define\tOFW_PCI_PHYS_HI_NONRELOCATABLE\t0x80000000\n#define\tOFW_PCI_PHYS_HI_PREFETCHABLE\t0x40000000\n#define\tOFW_PCI_PHYS_HI_ALIASED\t\t0x20000000\n#define\tOFW_PCI_PHYS_HI_SPACEMASK\t0x03000000\n#define\tOFW_PCI_PHYS_HI_BUSMASK\t\t0x00ff0000\n#define\tOFW_PCI_PHYS_HI_BUSSHIFT\t16\n#define\tOFW_PCI_PHYS_HI_DEVICEMASK\t0x0000f800\n#define\tOFW_PCI_PHYS_HI_DEVICESHIFT\t11\n#define\tOFW_PCI_PHYS_HI_FUNCTIONMASK\t0x00000700\n#define\tOFW_PCI_PHYS_HI_FUNCTIONSHIFT\t8\n#define\tOFW_PCI_PHYS_HI_REGISTERMASK\t0x000000ff\n\n#define\tOFW_PCI_PHYS_HI_SPACE_CONFIG\t0x00000000\n#define\tOFW_PCI_PHYS_HI_SPACE_IO\t0x01000000\n#define\tOFW_PCI_PHYS_HI_SPACE_MEM32\t0x02000000\n#define\tOFW_PCI_PHYS_HI_SPACE_MEM64\t0x03000000\n\n#define OFW_PCI_PHYS_HI_BUS(hi) \\\n\t(((hi) & OFW_PCI_PHYS_HI_BUSMASK) >> OFW_PCI_PHYS_HI_BUSSHIFT)\n#define OFW_PCI_PHYS_HI_DEVICE(hi) \\\n\t(((hi) & OFW_PCI_PHYS_HI_DEVICEMASK) >> OFW_PCI_PHYS_HI_DEVICESHIFT)\n#define OFW_PCI_PHYS_HI_FUNCTION(hi) \\\n\t(((hi) & OFW_PCI_PHYS_HI_FUNCTIONMASK) >> OFW_PCI_PHYS_HI_FUNCTIONSHIFT)\n\n/*\n * This has the 3 32bit cell values, plus 2 more to make up a 64-bit size.\n */\nstruct ofw_pci_register {\n\tu_int32_t\tphys_hi;\n\tu_int32_t\tphys_mid;\n\tu_int32_t\tphys_lo;\n\tu_int32_t\tsize_hi;\n\tu_int32_t\tsize_lo;\n};\n\n#endif /* _DEV_OFW_OFW_PCI_H_ */\n"
  },
  {
    "path": "freebsd-headers/dev/ofw/ofwvar.h",
    "content": "/*-\n * Copyright (c) 2005 Peter Grehan\n * Copyright (c) 2008 Nathan Whitehorn\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/dev/ofw/ofwvar.h 194138 2009-06-14 00:05:38Z marius $\n */\n\n#ifndef _DEV_OFW_OFWVAR_H_\n#define\t_DEV_OFW_OFWVAR_H_\n\n/*\n * An Open Firmware client implementation is declared with a kernel object and\n * an associated method table, similar to a device driver.\n *\n * e.g.\n *\n * static ofw_method_t fdt_methods[] = {\n *\tOFWMETHOD(ofw_init,\t\tfdt_init),\n *\tOFWMETHOD(ofw_finddevice,\tfdt_finddevice),\n *  ...\n *\tOFWMETHOD(ofw_nextprop,\t\tfdt_nextprop),\n *\t{ 0, 0 }\n * };\n *\n * static ofw_def_t ofw_fdt = {\n *\t\"ofw_fdt\",\n *\tfdt_methods,\n *\tsizeof(fdt_softc),\t// or 0 if no softc\n * };\n *\n * OFW_DEF(ofw_fdt);\n */\n\n#include <sys/kobj.h>\n\nstruct ofw_kobj {\n\t/*\n\t * An OFW instance is a kernel object.\n\t */\n\tKOBJ_FIELDS;\n\n\t/*\n\t * Utility elements that an instance may use\n\t */\n\tstruct mtx\tofw_mtx;\t/* available for instance use */\n\tvoid\t\t*ofw_iptr;\t/* instance data pointer */\n\n\t/*\n\t * Opaque data that can be overlaid with an instance-private\n\t * structure.  OFW code can test that this is large enough at\n\t * compile time with a sizeof() test againt it's softc.  There\n\t * is also a run-time test when the MMU kernel object is\n\t * registered.\n\t */\n#define\tOFW_OPAQUESZ\t64\n\tu_int\t\tofw_opaque[OFW_OPAQUESZ];\n};\n\ntypedef struct ofw_kobj\t\t*ofw_t;\ntypedef struct kobj_class\tofw_def_t;\n\n#define\tofw_method_t\tkobj_method_t\n#define\tOFWMETHOD\tKOBJMETHOD\n\n#define\tOFW_DEF(name)\tDATA_SET(ofw_set, name)\n\n#endif /* _DEV_OFW_OFWVAR_H_ */\n"
  },
  {
    "path": "freebsd-headers/dev/ofw/openfirm.h",
    "content": "/*\t$NetBSD: openfirm.h,v 1.1 1998/05/15 10:16:00 tsubai Exp $\t*/\n\n/*-\n * Copyright (C) 1995, 1996 Wolfgang Solfrank.\n * Copyright (C) 1995, 1996 TooLs GmbH.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. All advertising materials mentioning features or use of this software\n *    must display the following acknowledgement:\n *\tThis product includes software developed by TooLs GmbH.\n * 4. The name of TooLs GmbH may not be used to endorse or promote products\n *    derived from this software without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY TOOLS GMBH ``AS IS'' AND ANY EXPRESS OR\n * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES\n * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL TOOLS GMBH BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,\n * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;\n * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR\n * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF\n * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n */\n/*\n * Copyright (C) 2000 Benno Rice.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY Benno Rice ``AS IS'' AND ANY EXPRESS OR\n * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES\n * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL TOOLS GMBH BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,\n * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;\n * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR\n * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF\n * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/dev/ofw/openfirm.h 209817 2010-07-08 18:15:06Z nwhitehorn $\n */\n\n#ifndef _DEV_OPENFIRM_H_\n#define _DEV_OPENFIRM_H_\n\n#include <sys/types.h>\n\n/*\n * Prototypes for Open Firmware Interface Routines\n */\n\ntypedef uint32_t\tihandle_t;\ntypedef uint32_t\tphandle_t;\ntypedef uint32_t\tpcell_t;\n\n#ifdef _KERNEL\n#include <sys/malloc.h>\n\n#include <machine/ofw_machdep.h>\n\nMALLOC_DECLARE(M_OFWPROP);\n\n/*\n * Open Firmware interface initialization.  OF_install installs the named\n * interface as the Open Firmware access mechanism, OF_init initializes it.\n */\n\nboolean_t\tOF_install(char *name, int prio);\nint\t\tOF_init(void *cookie);\n\n/*\n * Known Open Firmware interface names\n */\n\n#define\tOFW_STD_DIRECT\t\"ofw_std\"\t/* Standard OF interface */\n#define\tOFW_STD_REAL\t\"ofw_real\"\t/* Real-mode OF interface */\n#define\tOFW_STD_32BIT\t\"ofw_32bit\"\t/* 32-bit OF interface */\n#define\tOFW_FDT\t\t\"ofw_fdt\"\t/* Flattened Device Tree */\n\n/* Generic functions */\nint\t\tOF_test(const char *name);\nvoid\t\tOF_printf(const char *fmt, ...);\n\n/* Device tree functions */\nphandle_t\tOF_peer(phandle_t node);\nphandle_t\tOF_child(phandle_t node);\nphandle_t\tOF_parent(phandle_t node);\nssize_t\t\tOF_getproplen(phandle_t node, const char *propname);\nssize_t\t\tOF_getprop(phandle_t node, const char *propname, void *buf,\n\t\t    size_t len);\nssize_t\t\tOF_searchprop(phandle_t node, const char *propname, void *buf,\n\t\t    size_t len);\nssize_t\t\tOF_getprop_alloc(phandle_t node, const char *propname,\n\t\t    int elsz, void **buf);\nint\t\tOF_nextprop(phandle_t node, const char *propname, char *buf,\n\t\t    size_t len);\nint\t\tOF_setprop(phandle_t node, const char *name, const void *buf,\n\t\t    size_t len);\nssize_t\t\tOF_canon(const char *path, char *buf, size_t len);\nphandle_t\tOF_finddevice(const char *path);\nssize_t\t\tOF_package_to_path(phandle_t node, char *buf, size_t len);\n\n/* Device I/O functions */\nihandle_t\tOF_open(const char *path);\nvoid\t\tOF_close(ihandle_t instance);\nssize_t\t\tOF_read(ihandle_t instance, void *buf, size_t len);\nssize_t\t\tOF_write(ihandle_t instance, const void *buf, size_t len);\nint\t\tOF_seek(ihandle_t instance, uint64_t where);\n\nphandle_t\tOF_instance_to_package(ihandle_t instance);\nssize_t\t\tOF_instance_to_path(ihandle_t instance, char *buf, size_t len);\nint\t\tOF_call_method(const char *method, ihandle_t instance,\n\t\t    int nargs, int nreturns, ...);\n\n/* Memory functions */\nvoid\t\t*OF_claim(void *virtrequest, size_t size, u_int align);\nvoid\t\tOF_release(void *virt, size_t size);\n\n/* Control transfer functions */\nvoid\t\tOF_enter(void);\nvoid\t\tOF_exit(void) __attribute__((noreturn));\n\n/* User interface functions */\nint\t\tOF_interpret(const char *cmd, int nreturns, ...);\n\n#endif /* _KERNEL */\n#endif /* _DEV_OPENFIRM_H_ */\n"
  },
  {
    "path": "freebsd-headers/dev/ofw/openfirmio.h",
    "content": "/*\t$NetBSD: openfirmio.h,v 1.4 2002/09/06 13:23:19 gehenna Exp $ */\n\n/*-\n * Copyright (c) 1992, 1993\n *\tThe Regents of the University of California.  All rights reserved.\n *\n * This software was developed by the Computer Systems Engineering group\n * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and\n * contributed to Berkeley.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 4. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t@(#)openpromio.h\t8.1 (Berkeley) 6/11/93\n *\n * $FreeBSD: release/9.0.0/sys/dev/ofw/openfirmio.h 146400 2005-05-19 15:22:16Z marius $\n */\n\n#ifndef _DEV_OFW_OPENFIRMIO_H_\n#define _DEV_OFW_OPENFIRMIO_H_\n\n#include <dev/ofw/openfirm.h>\n\nstruct ofiocdesc {\n\tphandle_t\tof_nodeid;\t/* passed or returned node id */\n\tint\t\tof_namelen;\t/* length of of_name */\n\tconst char\t*of_name;\t/* pointer to field name */\n\tint\t\tof_buflen;\t/* length of of_buf (value-result) */\n\tchar\t\t*of_buf;\t/* pointer to field value */\n};\n\n#define\tOFIOC_BASE\t'O'\n\n/* Get openprom field. */\n#define\tOFIOCGET\t_IOWR(OFIOC_BASE, 1, struct ofiocdesc)\n/* Set openprom field. */\n#define\tOFIOCSET\t_IOWR(OFIOC_BASE, 2, struct ofiocdesc)\n/* Get next property. */\n#define\tOFIOCNEXTPROP\t_IOWR(OFIOC_BASE, 3, struct ofiocdesc)\n/* Get options node. */\n#define\tOFIOCGETOPTNODE\t_IOR(OFIOC_BASE, 4, phandle_t)\n/* Get next node of node. */\n#define\tOFIOCGETNEXT\t_IOWR(OFIOC_BASE, 5, phandle_t)\n/* Get first child of node. */\n#define\tOFIOCGETCHILD\t_IOWR(OFIOC_BASE, 6, phandle_t)\n/* Find a specific device. */\n#define\tOFIOCFINDDEVICE\t_IOWR(OFIOC_BASE, 7, struct ofiocdesc)\n/* Retrieve the size of a property. */\n#define\tOFIOCGETPROPLEN\t_IOWR(OFIOC_BASE, 8, struct ofiocdesc)\n\n/* Maximum accepted name length. */\n#define\tOFIOCMAXNAME\t8191\n/* Maximum accepted value length (maximum of nvramrc property). */\n#define\tOFIOCMAXVALUE\t8192\n\n#endif /* _DEV_OFW_OPENFIRMIO_H_ */\n"
  },
  {
    "path": "freebsd-headers/dev/ofw/openpromio.h",
    "content": "/*-\n * Copyright (c) 2003 Jake Burkholder.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/dev/ofw/openpromio.h 116551 2003-06-19 01:40:11Z jake $\n */\n\n#ifndef\t_DEV_OFW_OPENPROMIO_H_\n#define\t_DEV_OFW_OPENPROMIO_H_\n\n#include <sys/ioccom.h>\n\nstruct openpromio {\n\tuint32_t\toprom_size;\n\tchar\t\toprom_array[];\n};\n\n#define\tOPROMNEXT\t_IO('O', 1)\n#define\tOPROMCHILD\t_IO('O', 2)\n#define\tOPROMGETPROP\t_IO('O', 3)\n#define\tOPROMNXTPROP\t_IO('O', 4)\n\n#define\tOPROMMAXPARAM\t4096\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/dev/pbio/pbioio.h",
    "content": "/*-\n *  Copyright (c) 2000-2004\n *          Diomidis D. Spinellis, Athens, Greece\n *      All rights reserved.\n *\n *  Redistribution and use in source and binary forms, with or without\n *  modification, are permitted provided that the following conditions\n *  are met:\n *  1. Redistributions of source code must retain the above copyright\n *     notice, this list of conditions and the following disclaimer as\n *     the first lines of this file unmodified.\n *  2. Redistributions in binary form must reproduce the above copyright\n *     notice, this list of conditions and the following disclaimer in the\n *     documentation and/or other materials provided with the distribution.\n *\n *  THIS SOFTWARE IS PROVIDED BY Diomidis D. Spinellis ``AS IS'' AND ANY\n *  EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n *  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\n *  PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL Diomidis D. Spinellis BE\n *  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\n *  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\n *  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR\n *  BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n *  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE\n *  OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,\n *  EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/dev/pbio/pbioio.h 139749 2005-01-06 01:43:34Z imp $\n *\n */\n\n/*\n * Definitions needed to access the pbio device (ioctls etc)\n */\n#ifndef SYS_PBIO_H\n#define SYS_PBIO_H\n\n#ifndef KERNEL\n#include <sys/types.h>\n#endif\n#include <sys/ioccom.h>\n\n/*\n * ioctls\n */\n#define PBIO_SETDIFF\t_IOW('p', 0x01, int)\n#define PBIO_SETIPACE\t_IOW('p', 0x02, int)\n#define PBIO_SETOPACE\t_IOW('p', 0x03, int)\n#define PBIO_GETDIFF\t_IOR('p', 0x81, int)\n#define PBIO_GETIPACE\t_IOR('p', 0x82, int)\n#define PBIO_GETOPACE\t_IOR('p', 0x83, int)\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/dev/ppbus/lpt.h",
    "content": "/*-\n * Copyright (c) 1990 The Regents of the University of California.\n * All rights reserved.\n *\n * This code is derived from software contributed to Berkeley by\n * William Jolitz.\n *\n * Copyright (c) 1997, 1999 Nicolas Souchu\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * Distantly from :\n *\t@(#)lptreg.h      1.1 (Berkeley) 12/19/90\n *\tId: lptreg.h,v 1.6 1997/02/22 09:36:52 peter Exp\n *\tFrom Id: nlpt.h,v 1.3 1999/01/10 12:04:54 nsouch Exp\n *\n * $FreeBSD: release/9.0.0/sys/dev/ppbus/lpt.h 185003 2008-11-16 17:42:02Z jhb $\n */\n\n/*\n * AT Parallel Port (for lineprinter)\n * Interface port and bit definitions\n * Written by William Jolitz 12/18/90\n * Copyright (C) William Jolitz 1990\n */\n\n#ifndef __LPT_H\n#define\t__LPT_H\n\n/* machine independent definitions, it shall only depend on the ppbus\n * parallel port model */\n\n\t\t\t\t\t/* PIN */\n#define\tLPS_NERR\t\t0x08\t/* 15  printer no error */\n#define\tLPS_SEL\t\t\t0x10\t/* 13  printer selected */\n#define\tLPS_OUT\t\t\t0x20\t/* 12  printer out of paper */\n#define\tLPS_NACK\t\t0x40\t/* 10  printer no ack of data */\n#define\tLPS_NBSY\t\t0x80\t/* 11  printer busy */\n\n#define\tLPC_STB\t\t\t0x01\t/*  1  strobe data to printer */\n#define\tLPC_AUTOL\t\t0x02\t/* 14  automatic linefeed */\n#define\tLPC_NINIT\t\t0x04\t/* 16  initialize printer */\n#define\tLPC_SEL\t\t\t0x08\t/* 17  printer selected */\n#define\tLPC_ENA\t\t\t0x10\t/*  -  enable IRQ */\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/dev/ppbus/lptio.h",
    "content": "/*-\n *  Copyright (C) 1994 Geoffrey M. Rehmet\n *\n *  This program is free software; you may redistribute it and/or\n *  modify it, provided that it retain the above copyright notice\n *  and the following disclaimer.\n *\n *  This program is distributed in the hope that it will be useful,\n *  but WITHOUT ANY WARRANTY; without even the implied warranty of\n *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n *\n *\tGeoff Rehmet, Rhodes University, South Africa <csgr@cs.ru.ac.za>\n *\n * $FreeBSD: release/9.0.0/sys/dev/ppbus/lptio.h 139749 2005-01-06 01:43:34Z imp $\n */\n\n#ifndef\t_DEV_PPBUS_LPT_H_\n#define\t_DEV_PPBUS_LPT_H_\n\n#include <sys/ioccom.h>\n\n#define\tLPT_IRQ\t\t_IOW('p', 1, long)\t/* set interrupt status */\n\n#endif /* !_DEV_PPBUS_LPT_H_ */\n"
  },
  {
    "path": "freebsd-headers/dev/ppbus/ppb_1284.h",
    "content": "/*-\n * Copyright (c) 1997 Nicolas Souchu\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/dev/ppbus/ppb_1284.h 55957 2000-01-14 08:03:15Z nsouch $\n *\n */\n#ifndef __1284_H\n#define __1284_H\n\n/*\n * IEEE1284 signals\n */\n\n/* host driven signals */\n\n#define nHostClk\tSTROBE\n#define Write\t\tSTROBE\n\n#define nHostBusy\tAUTOFEED\n#define nHostAck\tAUTOFEED\n#define DStrb\t\tAUTOFEED\n\n#define nReveseRequest\tnINIT\n\n#define nActive1284\tSELECTIN\n#define AStrb\t\tSELECTIN\n\n/* peripheral driven signals */\n\n#define nDataAvail\tnFAULT\n#define nPeriphRequest\tnFAULT\n\n#define Xflag\t\tSELECT\n\n#define AckDataReq\tPERROR\n#define nAckReverse\tPERROR\n\n#define nPtrBusy\tnBUSY\n#define nPeriphAck\tnBUSY\n#define Wait\t\tnBUSY\n\n#define PtrClk\t\tnACK\n#define PeriphClk\tnACK\n#define Intr\t\tnACK\n\n/* request mode values */\n#define NIBBLE_1284_NORMAL\t0x0\n#define NIBBLE_1284_REQUEST_ID\t0x4\n#define BYTE_1284_NORMAL\t0x1\n#define BYTE_1284_REQUEST_ID\t0x5\n#define ECP_1284_NORMAL\t\t0x10\n#define ECP_1284_REQUEST_ID\t0x14\n#define ECP_1284_RLE\t\t0x30\n#define ECP_1284_RLE_REQUEST_ID\t0x34\n#define EPP_1284_NORMAL\t\t0x40\n#define EXT_LINK_1284_NORMAL\t0x80\n\n/* ieee1284 mode options */\n#define PPB_REQUEST_ID\t\t0x1\n#define PPB_USE_RLE\t\t0x2\n#define PPB_EXTENSIBILITY_LINK\t0x4\n\n/* ieee1284 errors */\n#define PPB_NO_ERROR\t\t0\n#define PPB_MODE_UNSUPPORTED\t1\t/* mode not supported by peripheral */\n#define PPB_NOT_IEEE1284\t2\t/* not an IEEE1284 compliant periph. */\n#define PPB_TIMEOUT\t\t3\t/* timeout */\n#define PPB_INVALID_MODE\t4\t/* current mode is incorrect */\n\n/* ieee1284 host side states */\n#define PPB_ERROR\t\t\t0\n#define PPB_FORWARD_IDLE\t\t1\n#define PPB_NEGOCIATION\t\t\t2\n#define PPB_SETUP\t\t\t3\n#define PPB_ECP_FORWARD_IDLE\t\t4\n#define PPB_FWD_TO_REVERSE\t\t5\n#define PPB_REVERSE_IDLE\t\t6\n#define PPB_REVERSE_TRANSFER\t\t7\n#define PPB_REVERSE_TO_FWD\t\t8\n#define PPB_EPP_IDLE\t\t\t9\n#define PPB_TERMINATION\t\t\t10\n\n/* peripheral side states */\n#define PPB_PERIPHERAL_NEGOCIATION\t11\n#define PPB_PERIPHERAL_IDLE\t\t12\n#define PPB_PERIPHERAL_TRANSFER\t\t13\n#define PPB_PERIPHERAL_TERMINATION\t14\n\nextern int nibble_1284_inbyte(device_t, char *);\nextern int byte_1284_inbyte(device_t, char *);\nextern int spp_1284_read(device_t, int, char *, int, int *);\n\nextern int ppb_1284_negociate(device_t, int, int);\nextern int ppb_1284_terminate(device_t);\nextern int ppb_1284_read_id(device_t, int, char *, int, int *);\nextern int ppb_1284_read(device_t, int, char *, int, int *);\nextern int ppb_1284_get_state(device_t bus);\nextern int ppb_1284_set_state(device_t bus, int state);\n\nextern int ppb_peripheral_terminate(device_t, int);\nextern int ppb_peripheral_negociate(device_t, int, int);\nextern int byte_peripheral_write(device_t, char *, int, int *);\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/dev/ppbus/ppb_msq.h",
    "content": "/*-\n * Copyright (c) 1998 Nicolas Souchu\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/dev/ppbus/ppb_msq.h 106696 2002-11-09 12:55:07Z alfred $\n *\n */\n#ifndef __PPB_MSQ_H\n#define __PPB_MSQ_H\n\n/*\n * Basic definitions\n */\n\n/* microsequence parameter descriptor */\n#define MS_INS_MASK\t0x00ff\t/* mask to retrieve the instruction position < 256\tXXX */\n#define MS_ARG_MASK\t0x0f00\t/* mask to retrieve the argument number */\n#define MS_TYP_MASK\t0xf000\t/* mask to retrieve the type of the param */\n\n/* offset of each mask (see above) */\n#define MS_INS_OFFSET\t0\n#define MS_ARG_OFFSET\t8\n#define MS_TYP_OFFSET\t12\n\n/* list of parameter types */\n#define MS_TYP_INT\t0x0\t/* integer */\n#define MS_TYP_CHA\t0x1\t/* character */\n#define MS_TYP_PTR\t0x2\t/* void pointer */\n#define MS_TYP_FUN\t0x3\t/* function pointer */\n\n#define MS_PARAM(ins,arg,typ) \\\n\t(((ins<<MS_INS_OFFSET) & MS_INS_MASK) | \\\n\t ((arg<<MS_ARG_OFFSET) & MS_ARG_MASK) | \\\n\t ((typ<<MS_TYP_OFFSET) & MS_TYP_MASK))\n\n#define MS_INS(param) ((param & MS_INS_MASK) >> MS_INS_OFFSET)\n#define MS_ARG(param) ((param & MS_ARG_MASK) >> MS_ARG_OFFSET)\n#define MS_TYP(param) ((param & MS_TYP_MASK) >> MS_TYP_OFFSET)\n\n/* microsequence opcodes - do not change! */\n#define MS_OP_GET       0\t/* get <ptr>, <len>\t\t\t*/\n#define MS_OP_PUT       1\t/* put <ptr>, <len>\t\t\t*/\n\n#define MS_OP_RFETCH\t2\t/* rfetch <reg>, <mask>, <ptr>\t\t*/\n#define MS_OP_RSET\t3\t/* rset <reg>, <mask>, <mask>\t\t*/\n#define MS_OP_RASSERT\t4\t/* rassert <reg>, <mask>\t\t*/\n#define MS_OP_DELAY     5\t/* delay <val>\t\t\t\t*/\n#define MS_OP_SET       6\t/* set <val>\t\t\t\t*/\n#define MS_OP_DBRA      7\t/* dbra <offset>\t\t\t*/\n#define MS_OP_BRSET     8\t/* brset <mask>, <offset>\t\t*/\n#define MS_OP_BRCLEAR   9\t/* brclear <mask>, <offset>\t\t*/\n#define MS_OP_RET       10\t/* ret <retcode>\t\t\t*/\n#define MS_OP_C_CALL\t11\t/* c_call <function>, <parameter>\t*/\n#define MS_OP_PTR\t12\t/* ptr <pointer>\t\t\t*/\n#define MS_OP_ADELAY\t13\t/* adelay <val>\t\t\t\t*/\n#define MS_OP_BRSTAT\t14\t/* brstat <mask>, <mask>, <offset>\t*/\n#define MS_OP_SUBRET\t15\t/* subret <code>\t\t\t*/\n#define MS_OP_CALL\t16\t/* call <microsequence>\t\t\t*/\n#define MS_OP_RASSERT_P\t17\t/* rassert_p <iter>, <reg>\t\t*/\n#define MS_OP_RFETCH_P\t18\t/* rfetch_p <iter>, <reg>, <mask>\t*/\n#define MS_OP_TRIG\t19\t/* trigger <reg>, <len>, <array>\t*/\n\n/* common masks */\n#define MS_CLEAR_ALL\t0x0\n#define MS_ASSERT_NONE\t0x0\n#define MS_ASSERT_ALL\t0xff\n#define MS_FETCH_ALL\t0xff\n\n/* undefined parameter value */\n#define MS_NULL\t\t0\n#define MS_UNKNOWN\tMS_NULL\n\n/* predifined parameters */\n#define MS_ACCUM\t-1\t/* use accum previously set by MS_OP_SET */\n\n/* these are register numbers according to our PC-like parallel port model */\n#define MS_REG_DTR\t0x0\n#define MS_REG_STR\t0x1\n#define MS_REG_CTR\t0x2\n#define MS_REG_EPP_A\t0x3\n#define MS_REG_EPP_D\t0x4\n\n/*\n * Microsequence macro abstraction level\n */\n\n/* register operations */\n#define MS_RSET(reg,assert,clear) { MS_OP_RSET, {{ (reg) }, { (assert) }, { (clear) }}}\n#define MS_RASSERT(reg,byte)\t  { MS_OP_RASSERT, { { (reg) }, { (byte) }}}\n#define MS_RCLR(reg,clear)\t  { MS_OP_RSET, {{ (reg) }, { MS_ASSERT_NONE }, { (clear) }}}\n\n#define MS_RFETCH(reg,mask,ptr) { MS_OP_RFETCH, {{ (reg) }, { (mask) }, { (ptr) }}}\n\n/* trigger the port with array[char, delay,...] */\n#define MS_TRIG(reg,len,array)\t{ MS_OP_TRIG, {{ (reg) }, { (len) }, { (array) }}}\n\n/* assert/fetch from/to ptr */\n#define MS_RASSERT_P(n,reg)\t  { MS_OP_RASSERT_P, {{ (n) }, { (reg) }}}\n#define MS_RFETCH_P(n,reg,mask)\t  { MS_OP_RFETCH_P, {{ (n) }, { (reg) }, { (mask) }}}\n\n/* ptr manipulation */\n#define MS_PTR(ptr)\t{ MS_OP_PTR, {{ (ptr) }}}\n\n#define MS_DASS(byte) MS_RASSERT(MS_REG_DTR,byte)\n#define MS_SASS(byte) MS_RASSERT(MS_REG_STR,byte)\n#define MS_CASS(byte) MS_RASSERT(MS_REG_CTR,byte)\n\n#define MS_SET(accum)\t\t{ MS_OP_SET, {{ (accum) }}}\n#define MS_BRSET(mask,offset)\t{ MS_OP_BRSET, {{ (mask) }, { (offset) }}}\n#define MS_DBRA(offset)\t\t{ MS_OP_DBRA, {{ (offset) }}}\n#define MS_BRCLEAR(mask,offset)\t{ MS_OP_BRCLEAR, {{ (mask) }, { (offset) }}}\n#define MS_BRSTAT(mask_set,mask_clr,offset) \\\n\t\t{ MS_OP_BRSTAT, {{ mask_set }, { mask_clr }, { (offset) }}}\n\n/* C function or submicrosequence call */\n#define MS_C_CALL(function,parameter) \\\n\t\t{ MS_OP_C_CALL, {{ (function) }, { (parameter) }}}\n#define MS_CALL(microseq) { MS_OP_CALL, {{ (microseq) }}}\n\n/* mode dependent read/write operations\n * ppb_MS_xxx_init() call required otherwise default is\n * IEEE1284 operating mode */\n#define MS_PUT(ptr,len) { MS_OP_PUT, {{ (ptr) }, { (len) }}}\n#define MS_GET(ptr,len) { MS_OP_GET, {{ (ptr) }, { (len) }}}\n\n/* delay in microseconds */\n#define MS_DELAY(udelay) { MS_OP_DELAY, {{ (udelay) }}}\n\n/* asynchroneous delay in ms */\n#define MS_ADELAY(mdelay) { MS_OP_ADELAY, {{ (mdelay) }}}\n\n/* return from submicrosequence execution or microseqence execution */\n#define MS_SUBRET(code)\t{ MS_OP_SUBRET,\t{{ (code) }}}\n#define MS_RET(code)\t{ MS_OP_RET, {{ (code) }}}\n\n/*\n * Function abstraction level\n */\n\n#define ppb_MS_GET_init(bus,dev,body) ppb_MS_init(bus, dev, body, MS_OP_GET)\n\n#define ppb_MS_PUT_init(bus,dev,body) ppb_MS_init(bus, dev, body, MS_OP_PUT)\n\nextern int ppb_MS_init(\n\t\tdevice_t,\t\t\t/* ppbus bus */\n\t\tdevice_t,\t\t\t/* ppbus device */\n\t\tstruct ppb_microseq *,\t\t/* loop msq to assign */\n\t\tint opcode\t\t\t/* MS_OP_GET, MS_OP_PUT */\n\t\t);\n\nextern int ppb_MS_init_msq(\n\t\tstruct ppb_microseq *,\n\t\tint,\t\t\t\t/* number of parameters */\n\t\t...\t\t\t\t/* descriptor, value, ... */\n\t\t);\n\nextern int ppb_MS_exec(\n\t\tdevice_t,\t\t\t/* ppbus bus */\n\t\tdevice_t,\t\t\t/* ppbus device */\n\t\tint,\t\t\t\t/* microseq opcode */\n\t\tunion ppb_insarg,\t\t/* param1 */\n\t\tunion ppb_insarg,\t\t/* param2 */\n\t\tunion ppb_insarg,\t\t/* param3 */\n\t\tint *\t\t\t\t/* returned value */\n\t\t);\n\nextern int ppb_MS_loop(\n\t\tdevice_t,\t\t\t/* ppbus bus */\n\t\tdevice_t,\t\t\t/* ppbus device */\n\t\tstruct ppb_microseq *,\t\t/* prologue msq of loop */\n\t\tstruct ppb_microseq *,\t\t/* body msq of loop */\n\t\tstruct ppb_microseq *,\t\t/* epilogue msq of loop */\n\t\tint,\t\t\t\t/* number of iter */\n\t\tint *\t\t\t\t/* returned value */\n\t\t);\n\nextern int ppb_MS_microseq(\n\t\tdevice_t,\t\t\t/* ppbus bus */\n\t\tdevice_t,\t\t\t/* ppbus device */\n\t\tstruct ppb_microseq *,\t\t/* msq to execute */\n\t\tint *\t\t\t\t/* returned value */\n\t\t);\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/dev/ppbus/ppbconf.h",
    "content": "/*-\n * Copyright (c) 1997, 1998, 1999 Nicolas Souchu\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/dev/ppbus/ppbconf.h 188093 2009-02-03 19:49:21Z jhb $\n *\n */\n#ifndef __PPBCONF_H\n#define __PPBCONF_H\n\n#define n(flags) (~(flags) & (flags))\n\n/*\n * Parallel Port Chipset control bits.\n */\n#define STROBE\t\t0x01\n#define AUTOFEED\t0x02\n#define nINIT\t\t0x04\n#define SELECTIN\t0x08\n#define IRQENABLE\t0x10\n#define PCD\t\t0x20\n\n#define nSTROBE\t\tn(STROBE)\n#define nAUTOFEED\tn(AUTOFEED)\n#define INIT\t\tn(nINIT)\n#define nSELECTIN\tn(SELECTIN)\n#define nPCD\t\tn(PCD)\n\n/*\n * Parallel Port Chipset status bits.\n */\n#define TIMEOUT\t\t0x01\n#define nFAULT\t\t0x08\n#define SELECT\t\t0x10\n#define PERROR\t\t0x20\n#define nACK\t\t0x40\n#define nBUSY\t\t0x80\n\n#ifdef _KERNEL\n#include <sys/queue.h>\n\n/*\n * Parallel Port Bus sleep/wakeup queue.\n */\n#define PPBPRI\t(PZERO+8)\n\n/*\n * Parallel Port Chipset mode masks.\n * NIBBLE mode is supposed to be available under each other modes.\n */\n#define PPB_COMPATIBLE\t0x0\t/* Centronics compatible mode */\n\n#define PPB_NIBBLE\t0x1\t/* reverse 4 bit mode */\n#define PPB_PS2\t\t0x2\t/* PS/2 byte mode */\n#define PPB_EPP\t\t0x4\t/* EPP mode, 32 bit */\n#define PPB_ECP\t\t0x8\t/* ECP mode */\n\n/* mode aliases */\n#define PPB_SPP\t\tPPB_NIBBLE|PPB_PS2\n#define PPB_BYTE\tPPB_PS2\n\n#define PPB_MASK\t\t0x0f\n#define PPB_OPTIONS_MASK\t0xf0\n\n#define PPB_IS_EPP(mode) (mode & PPB_EPP)\n#define PPB_IN_EPP_MODE(bus) (PPB_IS_EPP (ppb_get_mode (bus)))\n#define PPB_IN_NIBBLE_MODE(bus) (ppb_get_mode (bus) & PPB_NIBBLE)\n#define PPB_IN_PS2_MODE(bus) (ppb_get_mode (bus) & PPB_PS2)\n\n/*\n * Structure to store status information.\n */\nstruct ppb_status {\n\tunsigned char status;\n\n\tunsigned int timeout:1;\n\tunsigned int error:1;\n\tunsigned int select:1;\n\tunsigned int paper_end:1;\n\tunsigned int ack:1;\n\tunsigned int busy:1;\n};\n\n/* Parallel port bus I/O opcodes */\n#define PPB_OUTSB_EPP\t1\n#define PPB_OUTSW_EPP\t2\n#define PPB_OUTSL_EPP\t3\n#define PPB_INSB_EPP\t4\n#define PPB_INSW_EPP\t5\n#define PPB_INSL_EPP\t6\n#define PPB_RDTR\t7\n#define PPB_RSTR\t8\n#define PPB_RCTR\t9\n#define PPB_REPP_A\t10\n#define PPB_REPP_D\t11\n#define PPB_RECR\t12\n#define PPB_RFIFO\t13\n#define PPB_WDTR\t14\n#define PPB_WSTR\t15\n#define PPB_WCTR\t16\n#define PPB_WEPP_A\t17\n#define PPB_WEPP_D\t18\n#define PPB_WECR\t19\n#define PPB_WFIFO\t20\n\n/*\n * How tsleep() is called in ppb_request_bus().\n */\n#define PPB_DONTWAIT\t0\n#define PPB_NOINTR\t0\n#define PPB_WAIT\t0x1\n#define PPB_INTR\t0x2\n#define PPB_POLL\t0x4\n#define PPB_FOREVER\t-1\n\n/*\n * Microsequence stuff.\n */\n#define PPB_MS_MAXLEN\t64\t\t/* XXX according to MS_INS_MASK */\n#define PPB_MS_MAXARGS\t3\t\t/* according to MS_ARG_MASK */\n\n/* maximum number of mode dependent\n * submicrosequences for in/out operations\n */\n#define PPB_MAX_XFER\t6\n\nunion ppb_insarg {\n\tint\ti;\n\tvoid\t*p;\n\tchar\t*c;\n\tint\t(* f)(void *, char *);\n};\n\nstruct ppb_microseq {\n\tint\t\t\topcode;\t\t\t/* microins. opcode */\n\tunion ppb_insarg\targ[PPB_MS_MAXARGS];\t/* arguments */\n};\n\n/* microseqences used for GET/PUT operations */\nstruct ppb_xfer {\n\tstruct ppb_microseq *loop;\t\t/* the loop microsequence */\n};\n\n/*\n * Parallel Port Bus Device structure.\n */\nstruct ppb_data;\t\t\t/* see below */\n\nstruct ppb_context {\n\tint valid;\t\t\t/* 1 if the struct is valid */\n\tint mode;\t\t\t/* XXX chipset operating mode */\n\n\tstruct microseq *curpc;\t\t/* pc in curmsq */\n\tstruct microseq *curmsq;\t/* currently executed microseqence */\n};\n\n/*\n * List of IVARS available to ppb device drivers\n */\n#define PPBUS_IVAR_MODE 0\n\n/* other fields are reserved to the ppbus internals */\n\nstruct ppb_device {\n\n\tconst char *name;\t\t/* name of the device */\n\n\tu_int flags;\t\t\t/* flags */\n\n\tstruct ppb_context ctx;\t\t/* context of the device */\n\n\t\t\t\t\t/* mode dependent get msq. If NULL,\n\t\t\t\t\t * IEEE1284 code is used */\n\tstruct ppb_xfer\n\t\tget_xfer[PPB_MAX_XFER];\n\n\t\t\t\t\t/* mode dependent put msq. If NULL,\n\t\t\t\t\t * IEEE1284 code is used */\n\tstruct ppb_xfer\n\t\tput_xfer[PPB_MAX_XFER];\n\n\tdriver_intr_t *intr_hook;\n\tvoid *intr_arg;\n};\n\n/* EPP standards */\n#define EPP_1_9\t\t0x0\t\t\t/* default */\n#define EPP_1_7\t\t0x1\n\n/* Parallel Port Chipset IVARS */\t\t/* elsewhere XXX */\n#define PPC_IVAR_EPP_PROTO\t0\n#define PPC_IVAR_LOCK\t\t1\n#define PPC_IVAR_INTR_HANDLER\t2\n\n/*\n * Maximum size of the PnP info string\n */\n#define PPB_PnP_STRING_SIZE\t256\t\t\t/* XXX */\n\n/*\n * Parallel Port Bus structure.\n */\nstruct ppb_data {\n\n#define PPB_PnP_PRINTER\t0\n#define PPB_PnP_MODEM\t1\n#define PPB_PnP_NET\t2\n#define PPB_PnP_HDC\t3\n#define PPB_PnP_PCMCIA\t4\n#define PPB_PnP_MEDIA\t5\n#define PPB_PnP_FDC\t6\n#define PPB_PnP_PORTS\t7\n#define PPB_PnP_SCANNER\t8\n#define PPB_PnP_DIGICAM\t9\n#define PPB_PnP_UNKNOWN\t10\n\tint class_id;\t\t/* not a PnP device if class_id < 0 */\n\n\tint state;\t\t/* current IEEE1284 state */\n\tint error;\t\t/* last IEEE1284 error */\n\n\tint mode;\t\t/* IEEE 1284-1994 mode\n\t\t\t\t * NIBBLE, PS2, EPP or ECP */\n\n\tdevice_t ppb_owner;\t/* device which owns the bus */\n\n\tstruct mtx *ppc_lock;\t/* lock of parent device */\n\tstruct resource *ppc_irq_res;\n};\n\nstruct callout;\n\ntypedef int (*ppc_intr_handler)(void *);\n\nextern int ppb_attach_device(device_t);\nextern int ppb_request_bus(device_t, device_t, int);\nextern int ppb_release_bus(device_t, device_t);\n\n/* bus related functions */\nextern void ppb_lock(device_t);\nextern void ppb_unlock(device_t);\nextern void _ppb_assert_locked(device_t, const char *, int);\nextern void ppb_init_callout(device_t, struct callout *, int);\nextern int ppb_sleep(device_t, void *, int, const char *, int);\nextern int ppb_get_status(device_t, struct ppb_status *);\nextern int ppb_poll_bus(device_t, int, char, char, int);\nextern int ppb_reset_epp_timeout(device_t);\nextern int ppb_ecp_sync(device_t);\nextern int ppb_get_epp_protocol(device_t);\nextern int ppb_set_mode(device_t, int);\t\t/* returns old mode */\nextern int ppb_get_mode(device_t);\t\t/* returns current mode */\nextern int ppb_write(device_t, char *, int, int);\n\n#ifdef INVARIANTS\n#define ppb_assert_locked(dev)\t_ppb_assert_locked(dev, __FILE__, __LINE__)\n#else\n#define ppb_assert_locked(dev)\n#endif\n#endif /* _KERNEL */\n\n#endif /* !__PPBCONF_H */\n"
  },
  {
    "path": "freebsd-headers/dev/ppbus/ppbio.h",
    "content": "/*-\n * Copyright (c) 1999 Nicolas Souchu\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/dev/ppbus/ppbio.h 55939 2000-01-14 00:18:06Z nsouch $\n *\n */\n\n#ifndef __PPBIO_H\n#define __PPBIO_H\n\n/*\n * Set of ppbus i/o routines callable from ppbus device drivers\n */\n\n#define ppb_outsb_epp(dev,buf,cnt)\t\t\t\t\t    \\\n\t\t(PPBUS_IO(device_get_parent(dev), PPB_OUTSB_EPP, buf, cnt, 0))\n#define ppb_outsw_epp(dev,buf,cnt)\t\t\t\t\t    \\\n\t\t(PPBUS_IO(device_get_parent(dev), PPB_OUTSW_EPP, buf, cnt, 0))\n#define ppb_outsl_epp(dev,buf,cnt)\t\t\t\t\t    \\\n\t\t(PPBUS_IO(device_get_parent(dev), PPB_OUTSL_EPP, buf, cnt, 0))\n\n#define ppb_insb_epp(dev,buf,cnt)\t\t\t\t\t    \\\n\t\t(PPBUS_IO(device_get_parent(dev), PPB_INSB_EPP, buf, cnt, 0))\n#define ppb_insw_epp(dev,buf,cnt)\t\t\t\t\t    \\\n\t\t(PPBUS_IO(device_get_parent(dev), PPB_INSW_EPP, buf, cnt, 0))\n#define ppb_insl_epp(dev,buf,cnt)\t\t\t\t\t    \\\n\t\t(PPBUS_IO(device_get_parent(dev), PPB_INSL_EPP, buf, cnt, 0))\n\n#define ppb_repp_A(dev) \t\t\t\t\t\t    \\\n\t\t(PPBUS_IO(device_get_parent(dev), PPB_REPP_A, 0, 0, 0))\n#define ppb_repp_D(dev) \t\t\t\t\t\t    \\\n\t\t(PPBUS_IO(device_get_parent(dev), PPB_REPP_D, 0, 0, 0))\n#define ppb_recr(dev)\t\t\t\t\t\t    \t    \\\n\t\t(PPBUS_IO(device_get_parent(dev), PPB_RECR, 0, 0, 0))\n#define ppb_rfifo(dev)\t\t\t\t\t\t\t    \\\n\t\t(PPBUS_IO(device_get_parent(dev), PPB_RFIFO, 0, 0, 0))\n\n#define ppb_wepp_A(dev,byte)\t\t\t\t\t\t    \\\n\t\t(PPBUS_IO(device_get_parent(dev), PPB_WEPP_A, 0, 0, byte))\n#define ppb_wepp_D(dev,byte)\t\t\t\t\t\t    \\\n\t\t(PPBUS_IO(device_get_parent(dev), PPB_WEPP_D, 0, 0, byte))\n#define ppb_wecr(dev,byte)\t\t\t\t\t\t    \\\n\t\t(PPBUS_IO(device_get_parent(dev), PPB_WECR, 0, 0, byte))\n#define ppb_wfifo(dev,byte)\t\t\t\t\t\t    \\\n\t\t(PPBUS_IO(device_get_parent(dev), PPB_WFIFO, 0, 0, byte))\n\n#define ppb_rdtr(dev)\t\t\t\t\t\t\t    \\\n\t\t(PPBUS_IO(device_get_parent(dev), PPB_RDTR, 0, 0, 0))\n#define ppb_rstr(dev)\t\t\t\t\t\t\t    \\\n\t\t(PPBUS_IO(device_get_parent(dev), PPB_RSTR, 0, 0, 0))\n#define ppb_rctr(dev)\t\t\t\t\t\t\t    \\\n\t\t(PPBUS_IO(device_get_parent(dev), PPB_RCTR, 0, 0, 0))\n\n#define ppb_wdtr(dev,byte)\t\t\t\t\t\t    \\\n\t\t(PPBUS_IO(device_get_parent(dev), PPB_WDTR, 0, 0, byte))\n#define ppb_wstr(dev,byte)\t\t\t\t\t\t    \\\n\t\t(PPBUS_IO(device_get_parent(dev), PPB_WSTR, 0, 0, byte))\n#define ppb_wctr(dev,byte)\t\t\t\t\t\t    \\\n\t\t(PPBUS_IO(device_get_parent(dev), PPB_WCTR, 0, 0, byte))\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/dev/ppbus/ppi.h",
    "content": "/*-\n * Copyright (c) 1997 Nicolas Souchu\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/dev/ppbus/ppi.h 185003 2008-11-16 17:42:02Z jhb $\n *\n */\n#ifndef __PPI_H\n#define\t__PPI_H\n\n#ifndef _KERNEL\n# include <sys/types.h>\n#endif\n#include <sys/ioccom.h>\n\n#define\tPPIGDATA\t_IOR('P', 10, u_int8_t)\n#define\tPPIGSTATUS\t_IOR('P', 11, u_int8_t)\n#define\tPPIGCTRL\t_IOR('P', 12, u_int8_t)\n#define\tPPIGEPPD\t_IOR('P', 13, u_int8_t)\n#define\tPPIGECR\t\t_IOR('P', 14, u_int8_t)\n#define\tPPIGFIFO\t_IOR('P', 15, u_int8_t)\n\n#define\tPPISDATA\t_IOW('P', 16, u_int8_t)\n#define\tPPISSTATUS\t_IOW('P', 17, u_int8_t)\n#define\tPPISCTRL\t_IOW('P', 18, u_int8_t)\n#define\tPPISEPPD\t_IOW('P', 19, u_int8_t)\n#define\tPPISECR\t\t_IOW('P', 20, u_int8_t)\n#define\tPPISFIFO\t_IOW('P', 21, u_int8_t)\n\n#define\tPPIGEPPA\t_IOR('P', 22, u_int8_t)\n#define\tPPISEPPA\t_IOR('P', 23, u_int8_t)\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/dev/ppbus/vpoio.h",
    "content": "/*-\n * Copyright (c) 1998 Nicolas Souchu\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/dev/ppbus/vpoio.h 185003 2008-11-16 17:42:02Z jhb $\n *\n */\n#ifndef __VP0IO_H\n#define __VP0IO_H\n\n/*\n * The ZIP drive cannot act as an initiator.\n */\n#define VP0_INITIATOR\t0x7\n\n#define VP0_ESELECT_TIMEOUT\t1\n#define VP0_ECMD_TIMEOUT\t2\n#define VP0_ECONNECT\t\t3\n#define VP0_ESTATUS_TIMEOUT\t4\n#define VP0_EDATA_OVERFLOW\t5\n#define VP0_EDISCONNECT\t\t6\n#define VP0_EPPDATA_TIMEOUT\t7\n#define VP0_ENEGOCIATE\t\t8\n#define VP0_ENOPORT\t\t9\n#define VP0_EINITFAILED\t\t10\n#define VP0_EINTR\t\t12\n\n#define VP0_EOTHER\t\t13\n\n#define VP0_OPENNINGS\t1\n\n/*\n * Data structure used during microsequence execution\n * when characters are received in nibble mode\n */\nstruct vpo_nibble {\n\tchar h;\t\t\t/* most significant nibble */\n\tchar l;\t\t\t/* less significant nibble */\n};\n\n/* Mode found during initialisation */\n#define VP0_MODE_UNDEFINED\t0x0\n#define VP0_MODE_NIBBLE\t\t0x1\n#define VP0_MODE_PS2\t\t0x2\n#define VP0_MODE_EPP\t\t0x3\n\nstruct vpoio_data {\n\tint vpo_mode_found;\t\t/* Mode found during init */\n\n\tstruct vpo_nibble vpo_nibble;\n\n\t/* each device must have its own nibble inbyte microsequence */\n\tstruct ppb_microseq *vpo_nibble_inbyte_msq;\n\n\tdevice_t vpo_dev;\n};\n\nint vpoio_probe(device_t dev, struct vpoio_data *vpo);\n\nint vpoio_attach(struct vpoio_data *vpo);\nint vpoio_reset_bus(struct vpoio_data *vpo);\n\nint vpoio_do_scsi(struct vpoio_data *vpo, int host, int target, char *command,\n\t\tint clen, char *buffer, int blen, int *result, int *count,\n\t\tint *ret);\n\nint imm_probe(device_t dev, struct vpoio_data *vpo);\n\nint imm_attach(struct vpoio_data *vpo);\nint imm_reset_bus(struct vpoio_data *vpo);\n\nint imm_do_scsi(struct vpoio_data *vpo, int host, int target, char *command,\n\t\tint clen, char *buffer, int blen, int *result, int *count,\n\t\tint *ret);\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/dev/smbus/smb.h",
    "content": "/*-\n * Copyright (c) 1998 Nicolas Souchu\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/dev/smbus/smb.h 162234 2006-09-11 20:52:41Z jhb $\n *\n */\n#ifndef __SMB_H\n#define __SMB_H\n\n#include <sys/ioccom.h>\n\nstruct smbcmd {\n\tchar cmd;\n\tint count;\n\tu_char slave;\n\tunion {\n\t\tchar byte;\n\t\tshort word;\n\n\t\tchar *byte_ptr;\n\t\tshort *word_ptr;\n\n\t\tstruct {\n\t\t\tshort sdata;\n\t\t\tshort *rdata;\n\t\t} process;\n\t} data;\n};\n\n/*\n * SMBus spec 2.0 says block transfers may be at most 32 bytes.\n */\n#define SMB_MAXBLOCKSIZE\t32\n\n#define SMB_QUICK_WRITE\t_IOW('i', 1, struct smbcmd)\n#define SMB_QUICK_READ\t_IOW('i', 2, struct smbcmd)\n#define SMB_SENDB\t_IOW('i', 3, struct smbcmd)\n#define SMB_RECVB\t_IOWR('i', 4, struct smbcmd)\n#define SMB_WRITEB\t_IOW('i', 5, struct smbcmd)\n#define SMB_WRITEW\t_IOW('i', 6, struct smbcmd)\n#define SMB_READB\t_IOW('i', 7, struct smbcmd)\n#define SMB_READW\t_IOW('i', 8, struct smbcmd)\n#define SMB_PCALL\t_IOW('i', 9, struct smbcmd)\n#define SMB_BWRITE\t_IOW('i', 10, struct smbcmd)\n#define SMB_OLD_BREAD\t_IOW('i', 11, struct smbcmd)\n#define SMB_BREAD\t_IOWR('i', 11, struct smbcmd)\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/dev/smbus/smbconf.h",
    "content": "/*-\n * Copyright (c) 1998 Nicolas Souchu\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/dev/smbus/smbconf.h 162234 2006-09-11 20:52:41Z jhb $\n */\n#ifndef __SMBONF_H\n#define __SMBONF_H\n\n#include <sys/queue.h>\n\n#define SMBPRI (PZERO+8)\t\t/* XXX sleep/wakeup queue priority */\n\n#define n(flags) (~(flags) & (flags))\n\n/*\n * How tsleep() is called in smb_request_bus().\n */\n#define SMB_DONTWAIT\t0\n#define SMB_NOINTR\t0\n#define SMB_WAIT\t0x1\n#define SMB_INTR\t0x2\n\n/*\n * callback index\n */\n#define SMB_REQUEST_BUS\t0x1\n#define SMB_RELEASE_BUS\t0x2\n\n/*\n * SMB bus errors\n */\n#define SMB_ENOERR\t0x0\n#define SMB_EBUSERR\t0x1\n#define SMB_ENOTSUPP\t0x2\n#define SMB_ENOACK\t0x4\n#define SMB_ECOLLI\t0x8\n#define SMB_EABORT\t0x10\n#define SMB_ETIMEOUT\t0x20\n#define SMB_EBUSY\t0x40\n#define\tSMB_EINVAL\t0x100\n\n/*\n * How Quick command is executed\n */\n#define SMB_QWRITE\t0x0\n#define SMB_QREAD\t0x1\n\n/*\n * ivars codes\n */\n#define SMBUS_IVAR_ADDR\t0x1\t/* slave address of the device */\n\nint\tsmbus_request_bus(device_t, device_t, int);\nint\tsmbus_release_bus(device_t, device_t);\ndevice_t smbus_alloc_bus(device_t);\nint\tsmbus_error(int error);\n\nvoid\tsmbus_intr(device_t, u_char, char low, char high, int error);\n\nu_char\tsmbus_get_addr(device_t);\n\nextern driver_t smbus_driver;\nextern devclass_t smbus_devclass;\n\n#define smbus_quick(bus,slave,how) \\\n\t(SMBUS_QUICK(device_get_parent(bus), slave, how))\n#define smbus_sendb(bus,slave,byte) \\\n\t(SMBUS_SENDB(device_get_parent(bus), slave, byte))\n#define smbus_recvb(bus,slave,byte) \\\n\t(SMBUS_RECVB(device_get_parent(bus), slave, byte))\n#define smbus_writeb(bus,slave,cmd,byte) \\\n\t(SMBUS_WRITEB(device_get_parent(bus), slave, cmd, byte))\n#define smbus_writew(bus,slave,cmd,word) \\\n\t(SMBUS_WRITEW(device_get_parent(bus), slave, cmd, word))\n#define smbus_readb(bus,slave,cmd,byte) \\\n\t(SMBUS_READB(device_get_parent(bus), slave, cmd, byte))\n#define smbus_readw(bus,slave,cmd,word) \\\n\t(SMBUS_READW(device_get_parent(bus), slave, cmd, word))\n#define smbus_pcall(bus,slave,cmd,sdata,rdata) \\\n\t(SMBUS_PCALL(device_get_parent(bus), slave, cmd, sdata, rdata))\n#define smbus_bwrite(bus,slave,cmd,count,buf) \\\n\t(SMBUS_BWRITE(device_get_parent(bus), slave, cmd, count, buf))\n#define smbus_bread(bus,slave,cmd,count,buf) \\\n\t(SMBUS_BREAD(device_get_parent(bus), slave, cmd, count, buf))\n\n#define SMBUS_MODVER\t1\n#define SMBUS_MINVER\t1\n#define SMBUS_MAXVER\t1\n#define SMBUS_PREFVER\tSMBUS_MODVER\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/dev/smbus/smbus.h",
    "content": "/*-\n * Copyright (c) 1998 Nicolas Souchu\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/dev/smbus/smbus.h 189580 2009-03-09 13:30:00Z imp $\n *\n */\n#ifndef __SMBUS_H\n#define __SMBUS_H\n\nstruct smbus_softc {\n\tdevice_t owner;\t\t/* smbus owner device structure */\n\tstruct mtx lock;\n};\n\nvoid smbus_generic_intr(device_t dev, u_char devaddr, char low, char high, int err);\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/dev/speaker/speaker.h",
    "content": "/*\n * speaker.h -- interface definitions for speaker ioctl()\n *\n * v1.4 by Eric S. Raymond (esr@snark.thyrsus.com) Aug 1993\n *      modified for FreeBSD by Andrew A. Chernov <ache@astral.msk.su>\n *\n * $FreeBSD: release/9.0.0/sys/dev/speaker/speaker.h 152306 2005-11-11 09:57:32Z ru $\n */\n\n#ifndef\t_DEV_SPEAKER_SPEAKER_H_\n#define\t_DEV_SPEAKER_SPEAKER_H_\n\n#include <sys/ioccom.h>\n\n#define SPKRTONE        _IOW('S', 1, tone_t)    /* emit tone */\n#define SPKRTUNE        _IO('S', 2)             /* emit tone sequence*/\n\ntypedef struct\n{\n    int\tfrequency;\t/* in hertz */\n    int duration;\t/* in 1/100ths of a second */\n} tone_t;\n\n/*\n * Strings written to the speaker device are interpreted as tunes and played;\n * see the spkr(4) man page for details.\n */\n\n#endif /* !_DEV_SPEAKER_SPEAKER_H_ */\n"
  },
  {
    "path": "freebsd-headers/dev/usb/ufm_ioctl.h",
    "content": "/*-\n * Copyright (c) 2001 M. Warner Losh\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions, and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR\n * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * This code is based on ugen.c and ulpt.c developed by Lennart Augustsson.\n * This code includes software developed by the NetBSD Foundation, Inc. and\n * its contributors.\n */\n\n/*  $FreeBSD: release/9.0.0/sys/dev/usb/ufm_ioctl.h 196219 2009-08-14 20:03:53Z jhb $ */\n\n#include <sys/ioccom.h>\n\n#define\tFM_SET_FREQ\t_IOWR('U', 200, int)\n#define\tFM_GET_FREQ\t_IOWR('U', 201, int)\n#define\tFM_START\t_IOWR('U', 202, int)\n#define\tFM_STOP\t\t_IOWR('U', 203, int)\n#define\tFM_GET_STAT\t_IOWR('U', 204, int)\n"
  },
  {
    "path": "freebsd-headers/dev/usb/usb.h",
    "content": "/* $FreeBSD: release/9.0.0/sys/dev/usb/usb.h 226904 2011-10-29 12:39:05Z hselasky $ */\n/*-\n * Copyright (c) 2008 Hans Petter Selasky. All rights reserved.\n * Copyright (c) 1998 The NetBSD Foundation, Inc. All rights reserved.\n * Copyright (c) 1998 Lennart Augustsson. All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n */\n\n/*\n * This file contains standard definitions for the following USB\n * protocol versions:\n *\n * USB v1.0\n * USB v1.1\n * USB v2.0\n * USB v3.0\n */\n\n#ifndef _USB_STANDARD_H_\n#define\t_USB_STANDARD_H_\n\n#if defined(_KERNEL)\n#include \"opt_usb.h\"\n\n/* Declare parent SYSCTL USB node. */\n#ifdef SYSCTL_DECL\nSYSCTL_DECL(_hw_usb);\n#endif\n\n#include <sys/malloc.h>\n\nMALLOC_DECLARE(M_USB);\nMALLOC_DECLARE(M_USBDEV);\nMALLOC_DECLARE(M_USBHC);\n#endif /* _KERNEL */\n\n#include <dev/usb/usb_endian.h>\n#include <dev/usb/usb_freebsd.h>\n\n#define\tUSB_STACK_VERSION 2000\t\t/* 2.0 */\n\n/* Definition of some hardcoded USB constants. */\n\n#define\tUSB_MAX_IPACKET\t\t8\t/* initial USB packet size */\n#define\tUSB_EP_MAX (2*16)\t\t/* hardcoded */\n#define\tUSB_ROOT_HUB_ADDR 1\t\t/* index */\n#define\tUSB_MIN_DEVICES 2\t\t/* unused + root HUB */\n#define\tUSB_UNCONFIG_INDEX 0xFF\t\t/* internal use only */\n#define\tUSB_IFACE_INDEX_ANY 0xFF\t/* internal use only */\n#define\tUSB_START_ADDR 0\t\t/* default USB device BUS address\n\t\t\t\t\t * after USB bus reset */\n#define\tUSB_CONTROL_ENDPOINT 0\t\t/* default control endpoint */\n\n#define\tUSB_FRAMES_PER_SECOND_FS 1000\t/* full speed */\n#define\tUSB_FRAMES_PER_SECOND_HS 8000\t/* high speed */\n\n#define\tUSB_FS_BYTES_PER_HS_UFRAME 188\t/* bytes */\n#define\tUSB_HS_MICRO_FRAMES_MAX 8\t/* units */\n\n#define\tUSB_ISOC_TIME_MAX 128\t\t/* ms */\n\n/*\n * Minimum time a device needs to be powered down to go through a\n * power cycle. These values are not in the USB specification.\n */\n#define\tUSB_POWER_DOWN_TIME\t200\t/* ms */\n#define\tUSB_PORT_POWER_DOWN_TIME\t100\t/* ms */\n\n/* Definition of software USB power modes */\n#define\tUSB_POWER_MODE_OFF 0\t\t/* turn off device */\n#define\tUSB_POWER_MODE_ON 1\t\t/* always on */\n#define\tUSB_POWER_MODE_SAVE 2\t\t/* automatic suspend and resume */\n#define\tUSB_POWER_MODE_SUSPEND 3\t/* force suspend */\n#define\tUSB_POWER_MODE_RESUME 4\t\t/* force resume */\n\n#if 0\n/* These are the values from the USB specification. */\n#define\tUSB_PORT_RESET_DELAY\t10\t/* ms */\n#define\tUSB_PORT_ROOT_RESET_DELAY 50\t/* ms */\n#define\tUSB_PORT_RESET_RECOVERY\t10\t/* ms */\n#define\tUSB_PORT_POWERUP_DELAY\t100\t/* ms */\n#define\tUSB_PORT_RESUME_DELAY\t20\t/* ms */\n#define\tUSB_SET_ADDRESS_SETTLE\t2\t/* ms */\n#define\tUSB_RESUME_DELAY\t(20*5)\t/* ms */\n#define\tUSB_RESUME_WAIT\t\t10\t/* ms */\n#define\tUSB_RESUME_RECOVERY\t10\t/* ms */\n#define\tUSB_EXTRA_POWER_UP_TIME\t0\t/* ms */\n#else\n/* Allow for marginal and non-conforming devices. */\n#define\tUSB_PORT_RESET_DELAY\t50\t/* ms */\n#define\tUSB_PORT_ROOT_RESET_DELAY 250\t/* ms */\n#define\tUSB_PORT_RESET_RECOVERY\t250\t/* ms */\n#define\tUSB_PORT_POWERUP_DELAY\t300\t/* ms */\n#define\tUSB_PORT_RESUME_DELAY\t(20*2)\t/* ms */\n#define\tUSB_SET_ADDRESS_SETTLE\t10\t/* ms */\n#define\tUSB_RESUME_DELAY\t(50*5)\t/* ms */\n#define\tUSB_RESUME_WAIT\t\t50\t/* ms */\n#define\tUSB_RESUME_RECOVERY\t50\t/* ms */\n#define\tUSB_EXTRA_POWER_UP_TIME\t20\t/* ms */\n#endif\n\n#define\tUSB_MIN_POWER\t\t100\t/* mA */\n#define\tUSB_MAX_POWER\t\t500\t/* mA */\n\n#define\tUSB_BUS_RESET_DELAY\t100\t/* ms */\n\n/*\n * USB record layout in memory:\n *\n * - USB config 0\n *   - USB interfaces\n *     - USB alternative interfaces\n *       - USB endpoints\n *\n * - USB config 1\n *   - USB interfaces\n *     - USB alternative interfaces\n *       - USB endpoints\n */\n\n/* Declaration of USB records */\n\nstruct usb_device_request {\n\tuByte\tbmRequestType;\n\tuByte\tbRequest;\n\tuWord\twValue;\n\tuWord\twIndex;\n\tuWord\twLength;\n} __packed;\ntypedef struct usb_device_request usb_device_request_t;\n\n#define\tUT_WRITE\t\t0x00\n#define\tUT_READ\t\t\t0x80\n#define\tUT_STANDARD\t\t0x00\n#define\tUT_CLASS\t\t0x20\n#define\tUT_VENDOR\t\t0x40\n#define\tUT_DEVICE\t\t0x00\n#define\tUT_INTERFACE\t\t0x01\n#define\tUT_ENDPOINT\t\t0x02\n#define\tUT_OTHER\t\t0x03\n\n#define\tUT_READ_DEVICE\t\t(UT_READ  | UT_STANDARD | UT_DEVICE)\n#define\tUT_READ_INTERFACE\t(UT_READ  | UT_STANDARD | UT_INTERFACE)\n#define\tUT_READ_ENDPOINT\t(UT_READ  | UT_STANDARD | UT_ENDPOINT)\n#define\tUT_WRITE_DEVICE\t\t(UT_WRITE | UT_STANDARD | UT_DEVICE)\n#define\tUT_WRITE_INTERFACE\t(UT_WRITE | UT_STANDARD | UT_INTERFACE)\n#define\tUT_WRITE_ENDPOINT\t(UT_WRITE | UT_STANDARD | UT_ENDPOINT)\n#define\tUT_READ_CLASS_DEVICE\t(UT_READ  | UT_CLASS | UT_DEVICE)\n#define\tUT_READ_CLASS_INTERFACE\t(UT_READ  | UT_CLASS | UT_INTERFACE)\n#define\tUT_READ_CLASS_OTHER\t(UT_READ  | UT_CLASS | UT_OTHER)\n#define\tUT_READ_CLASS_ENDPOINT\t(UT_READ  | UT_CLASS | UT_ENDPOINT)\n#define\tUT_WRITE_CLASS_DEVICE\t(UT_WRITE | UT_CLASS | UT_DEVICE)\n#define\tUT_WRITE_CLASS_INTERFACE (UT_WRITE | UT_CLASS | UT_INTERFACE)\n#define\tUT_WRITE_CLASS_OTHER\t(UT_WRITE | UT_CLASS | UT_OTHER)\n#define\tUT_WRITE_CLASS_ENDPOINT\t(UT_WRITE | UT_CLASS | UT_ENDPOINT)\n#define\tUT_READ_VENDOR_DEVICE\t(UT_READ  | UT_VENDOR | UT_DEVICE)\n#define\tUT_READ_VENDOR_INTERFACE (UT_READ  | UT_VENDOR | UT_INTERFACE)\n#define\tUT_READ_VENDOR_OTHER\t(UT_READ  | UT_VENDOR | UT_OTHER)\n#define\tUT_READ_VENDOR_ENDPOINT\t(UT_READ  | UT_VENDOR | UT_ENDPOINT)\n#define\tUT_WRITE_VENDOR_DEVICE\t(UT_WRITE | UT_VENDOR | UT_DEVICE)\n#define\tUT_WRITE_VENDOR_INTERFACE (UT_WRITE | UT_VENDOR | UT_INTERFACE)\n#define\tUT_WRITE_VENDOR_OTHER\t(UT_WRITE | UT_VENDOR | UT_OTHER)\n#define\tUT_WRITE_VENDOR_ENDPOINT (UT_WRITE | UT_VENDOR | UT_ENDPOINT)\n\n/* Requests */\n#define\tUR_GET_STATUS\t\t0x00\n#define\tUR_CLEAR_FEATURE\t0x01\n#define\tUR_SET_FEATURE\t\t0x03\n#define\tUR_SET_ADDRESS\t\t0x05\n#define\tUR_GET_DESCRIPTOR\t0x06\n#define\tUDESC_DEVICE\t\t0x01\n#define\tUDESC_CONFIG\t\t0x02\n#define\tUDESC_STRING\t\t0x03\n#define\tUSB_LANGUAGE_TABLE\t0x00\t/* language ID string index */\n#define\tUDESC_INTERFACE\t\t0x04\n#define\tUDESC_ENDPOINT\t\t0x05\n#define\tUDESC_DEVICE_QUALIFIER\t0x06\n#define\tUDESC_OTHER_SPEED_CONFIGURATION 0x07\n#define\tUDESC_INTERFACE_POWER\t0x08\n#define\tUDESC_OTG\t\t0x09\n#define\tUDESC_DEBUG\t\t0x0A\n#define\tUDESC_IFACE_ASSOC\t0x0B\t/* interface association */\n#define\tUDESC_BOS\t\t0x0F\t/* binary object store */\n#define\tUDESC_DEVICE_CAPABILITY\t0x10\n#define\tUDESC_CS_DEVICE\t\t0x21\t/* class specific */\n#define\tUDESC_CS_CONFIG\t\t0x22\n#define\tUDESC_CS_STRING\t\t0x23\n#define\tUDESC_CS_INTERFACE\t0x24\n#define\tUDESC_CS_ENDPOINT\t0x25\n#define\tUDESC_HUB\t\t0x29\n#define\tUDESC_SS_HUB\t\t0x2A\t/* super speed */\n#define\tUDESC_ENDPOINT_SS_COMP\t0x30\t/* super speed */\n#define\tUR_SET_DESCRIPTOR\t0x07\n#define\tUR_GET_CONFIG\t\t0x08\n#define\tUR_SET_CONFIG\t\t0x09\n#define\tUR_GET_INTERFACE\t0x0a\n#define\tUR_SET_INTERFACE\t0x0b\n#define\tUR_SYNCH_FRAME\t\t0x0c\n#define\tUR_SET_SEL\t\t0x30\n#define\tUR_ISOCH_DELAY\t\t0x31\n\n/* HUB specific request */\n#define\tUR_GET_BUS_STATE\t0x02\n#define\tUR_CLEAR_TT_BUFFER\t0x08\n#define\tUR_RESET_TT\t\t0x09\n#define\tUR_GET_TT_STATE\t\t0x0a\n#define\tUR_STOP_TT\t\t0x0b\n#define\tUR_SET_HUB_DEPTH\t0x0c\n#define\tUSB_SS_HUB_DEPTH_MAX\t5\n#define\tUR_GET_PORT_ERR_COUNT\t0x0d\n\n/* Feature numbers */\n#define\tUF_ENDPOINT_HALT\t0\n#define\tUF_DEVICE_REMOTE_WAKEUP\t1\n#define\tUF_TEST_MODE\t\t2\n#define\tUF_U1_ENABLE\t\t0x30\n#define\tUF_U2_ENABLE\t\t0x31\n#define\tUF_LTM_ENABLE\t\t0x32\n\n/* HUB specific features */\n#define\tUHF_C_HUB_LOCAL_POWER\t0\n#define\tUHF_C_HUB_OVER_CURRENT\t1\n#define\tUHF_PORT_CONNECTION\t0\n#define\tUHF_PORT_ENABLE\t\t1\n#define\tUHF_PORT_SUSPEND\t2\n#define\tUHF_PORT_OVER_CURRENT\t3\n#define\tUHF_PORT_RESET\t\t4\n#define\tUHF_PORT_LINK_STATE\t5\n#define\tUHF_PORT_POWER\t\t8\n#define\tUHF_PORT_LOW_SPEED\t9\n#define\tUHF_C_PORT_CONNECTION\t16\n#define\tUHF_C_PORT_ENABLE\t17\n#define\tUHF_C_PORT_SUSPEND\t18\n#define\tUHF_C_PORT_OVER_CURRENT\t19\n#define\tUHF_C_PORT_RESET\t20\n#define\tUHF_PORT_TEST\t\t21\n#define\tUHF_PORT_INDICATOR\t22\n\n/* SuperSpeed HUB specific features */\n#define\tUHF_PORT_U1_TIMEOUT\t23\n#define\tUHF_PORT_U2_TIMEOUT\t24\n#define\tUHF_C_PORT_LINK_STATE\t25\n#define\tUHF_C_PORT_CONFIG_ERROR\t26\n#define\tUHF_PORT_REMOTE_WAKE_MASK\t27\n#define\tUHF_BH_PORT_RESET\t28\n#define\tUHF_C_BH_PORT_RESET\t29\n#define\tUHF_FORCE_LINKPM_ACCEPT\t30\n\nstruct usb_descriptor {\n\tuByte\tbLength;\n\tuByte\tbDescriptorType;\n\tuByte\tbDescriptorSubtype;\n} __packed;\ntypedef struct usb_descriptor usb_descriptor_t;\n\nstruct usb_device_descriptor {\n\tuByte\tbLength;\n\tuByte\tbDescriptorType;\n\tuWord\tbcdUSB;\n#define\tUD_USB_2_0\t\t0x0200\n#define\tUD_USB_3_0\t\t0x0300\n#define\tUD_IS_USB2(d) ((d)->bcdUSB[1] == 0x02)\n#define\tUD_IS_USB3(d) ((d)->bcdUSB[1] == 0x03)\n\tuByte\tbDeviceClass;\n\tuByte\tbDeviceSubClass;\n\tuByte\tbDeviceProtocol;\n\tuByte\tbMaxPacketSize;\n\t/* The fields below are not part of the initial descriptor. */\n\tuWord\tidVendor;\n\tuWord\tidProduct;\n\tuWord\tbcdDevice;\n\tuByte\tiManufacturer;\n\tuByte\tiProduct;\n\tuByte\tiSerialNumber;\n\tuByte\tbNumConfigurations;\n} __packed;\ntypedef struct usb_device_descriptor usb_device_descriptor_t;\n\n/* Binary Device Object Store (BOS) */\nstruct usb_bos_descriptor {\n\tuByte\tbLength;\n\tuByte\tbDescriptorType;\n\tuWord\twTotalLength;\n\tuByte\tbNumDeviceCaps;\n} __packed;\ntypedef struct usb_bos_descriptor usb_bos_descriptor_t;\n\n/* Binary Device Object Store Capability */\nstruct usb_bos_cap_descriptor {\n\tuByte\tbLength;\n\tuByte\tbDescriptorType;\n\tuByte\tbDevCapabilityType;\n#define\tUSB_DEVCAP_RESERVED\t0x00\n#define\tUSB_DEVCAP_WUSB\t\t0x01\n#define\tUSB_DEVCAP_USB2EXT\t0x02\n#define\tUSB_DEVCAP_SUPER_SPEED\t0x03\n#define\tUSB_DEVCAP_CONTAINER_ID\t0x04\n\t/* data ... */\n} __packed;\ntypedef struct usb_bos_cap_descriptor usb_bos_cap_descriptor_t;\n\nstruct usb_devcap_usb2ext_descriptor {\n\tuByte\tbLength;\n\tuByte\tbDescriptorType;\n\tuByte\tbDevCapabilityType;\n\tuByte\tbmAttributes;\n#define\tUSB_V2EXT_LPM 0x02\n} __packed;\ntypedef struct usb_devcap_usb2ext_descriptor usb_devcap_usb2ext_descriptor_t;\n\nstruct usb_devcap_ss_descriptor {\n\tuByte\tbLength;\n\tuByte\tbDescriptorType;\n\tuByte\tbDevCapabilityType;\n\tuByte\tbmAttributes;\n\tuWord\twSpeedsSupported;\n\tuByte\tbFunctionalitySupport;\n\tuByte\tbU1DevExitLat;\n\tuByte\tbU2DevExitLat;\n} __packed;\ntypedef struct usb_devcap_ss_descriptor usb_devcap_ss_descriptor_t;\n\nstruct usb_devcap_container_id_descriptor {\n\tuByte\tbLength;\n\tuByte\tbDescriptorType;\n\tuByte\tbDevCapabilityType;\n\tuByte\tbReserved;\n\tuByte\tbContainerID;\n} __packed;\ntypedef struct usb_devcap_container_id_descriptor\n\t\tusb_devcap_container_id_descriptor_t;\n\n/* Device class codes */\n#define\tUDCLASS_IN_INTERFACE\t0x00\n#define\tUDCLASS_COMM\t\t0x02\n#define\tUDCLASS_HUB\t\t0x09\n#define\tUDSUBCLASS_HUB\t\t0x00\n#define\tUDPROTO_FSHUB\t\t0x00\n#define\tUDPROTO_HSHUBSTT\t0x01\n#define\tUDPROTO_HSHUBMTT\t0x02\n#define\tUDPROTO_SSHUB\t\t0x03\n#define\tUDCLASS_DIAGNOSTIC\t0xdc\n#define\tUDCLASS_WIRELESS\t0xe0\n#define\tUDSUBCLASS_RF\t\t0x01\n#define\tUDPROTO_BLUETOOTH\t0x01\n#define\tUDCLASS_VENDOR\t\t0xff\n\nstruct usb_config_descriptor {\n\tuByte\tbLength;\n\tuByte\tbDescriptorType;\n\tuWord\twTotalLength;\n\tuByte\tbNumInterface;\n\tuByte\tbConfigurationValue;\n#define\tUSB_UNCONFIG_NO 0\n\tuByte\tiConfiguration;\n\tuByte\tbmAttributes;\n#define\tUC_BUS_POWERED\t\t0x80\n#define\tUC_SELF_POWERED\t\t0x40\n#define\tUC_REMOTE_WAKEUP\t0x20\n\tuByte\tbMaxPower;\t\t/* max current in 2 mA units */\n#define\tUC_POWER_FACTOR 2\n} __packed;\ntypedef struct usb_config_descriptor usb_config_descriptor_t;\n\nstruct usb_interface_descriptor {\n\tuByte\tbLength;\n\tuByte\tbDescriptorType;\n\tuByte\tbInterfaceNumber;\n\tuByte\tbAlternateSetting;\n\tuByte\tbNumEndpoints;\n\tuByte\tbInterfaceClass;\n\tuByte\tbInterfaceSubClass;\n\tuByte\tbInterfaceProtocol;\n\tuByte\tiInterface;\n} __packed;\ntypedef struct usb_interface_descriptor usb_interface_descriptor_t;\n\nstruct usb_interface_assoc_descriptor {\n\tuByte\tbLength;\n\tuByte\tbDescriptorType;\n\tuByte\tbFirstInterface;\n\tuByte\tbInterfaceCount;\n\tuByte\tbFunctionClass;\n\tuByte\tbFunctionSubClass;\n\tuByte\tbFunctionProtocol;\n\tuByte\tiFunction;\n} __packed;\ntypedef struct usb_interface_assoc_descriptor usb_interface_assoc_descriptor_t;\n\n/* Interface class codes */\n#define\tUICLASS_UNSPEC\t\t0x00\n#define\tUICLASS_AUDIO\t\t0x01\t/* audio */\n#define\tUISUBCLASS_AUDIOCONTROL\t1\n#define\tUISUBCLASS_AUDIOSTREAM\t\t2\n#define\tUISUBCLASS_MIDISTREAM\t\t3\n\n#define\tUICLASS_CDC\t\t0x02\t/* communication */\n#define\tUISUBCLASS_DIRECT_LINE_CONTROL_MODEL\t1\n#define\tUISUBCLASS_ABSTRACT_CONTROL_MODEL\t2\n#define\tUISUBCLASS_TELEPHONE_CONTROL_MODEL\t3\n#define\tUISUBCLASS_MULTICHANNEL_CONTROL_MODEL\t4\n#define\tUISUBCLASS_CAPI_CONTROLMODEL\t\t5\n#define\tUISUBCLASS_ETHERNET_NETWORKING_CONTROL_MODEL 6\n#define\tUISUBCLASS_ATM_NETWORKING_CONTROL_MODEL 7\n#define\tUISUBCLASS_WIRELESS_HANDSET_CM 8\n#define\tUISUBCLASS_DEVICE_MGMT 9\n#define\tUISUBCLASS_MOBILE_DIRECT_LINE_MODEL 10\n#define\tUISUBCLASS_OBEX 11\n#define\tUISUBCLASS_ETHERNET_EMULATION_MODEL 12\n#define\tUISUBCLASS_NETWORK_CONTROL_MODEL 13\n\n#define\tUIPROTO_CDC_AT\t\t\t1\n\n#define\tUICLASS_HID\t\t0x03\n#define\tUISUBCLASS_BOOT\t\t1\n#define\tUIPROTO_BOOT_KEYBOARD\t1\n#define\tUIPROTO_MOUSE\t\t2\n\n#define\tUICLASS_PHYSICAL\t0x05\n#define\tUICLASS_IMAGE\t\t0x06\n#define\tUISUBCLASS_SIC\t\t1\t/* still image class */\n#define\tUICLASS_PRINTER\t\t0x07\n#define\tUISUBCLASS_PRINTER\t1\n#define\tUIPROTO_PRINTER_UNI\t1\n#define\tUIPROTO_PRINTER_BI\t2\n#define\tUIPROTO_PRINTER_1284\t3\n\n#define\tUICLASS_MASS\t\t0x08\n#define\tUISUBCLASS_RBC\t\t1\n#define\tUISUBCLASS_SFF8020I\t2\n#define\tUISUBCLASS_QIC157\t3\n#define\tUISUBCLASS_UFI\t\t4\n#define\tUISUBCLASS_SFF8070I\t5\n#define\tUISUBCLASS_SCSI\t\t6\n#define\tUIPROTO_MASS_CBI_I\t0\n#define\tUIPROTO_MASS_CBI\t1\n#define\tUIPROTO_MASS_BBB_OLD\t2\t/* Not in the spec anymore */\n#define\tUIPROTO_MASS_BBB\t80\t/* 'P' for the Iomega Zip drive */\n\n#define\tUICLASS_HUB\t\t0x09\n#define\tUISUBCLASS_HUB\t\t0\n#define\tUIPROTO_FSHUB\t\t0\n#define\tUIPROTO_HSHUBSTT\t0\t/* Yes, same as previous */\n#define\tUIPROTO_HSHUBMTT\t1\n\n#define\tUICLASS_CDC_DATA\t0x0a\n#define\tUISUBCLASS_DATA\t\t0x00\n#define\tUIPROTO_DATA_ISDNBRI\t\t0x30\t/* Physical iface */\n#define\tUIPROTO_DATA_HDLC\t\t0x31\t/* HDLC */\n#define\tUIPROTO_DATA_TRANSPARENT\t0x32\t/* Transparent */\n#define\tUIPROTO_DATA_Q921M\t\t0x50\t/* Management for Q921 */\n#define\tUIPROTO_DATA_Q921\t\t0x51\t/* Data for Q921 */\n#define\tUIPROTO_DATA_Q921TM\t\t0x52\t/* TEI multiplexer for Q921 */\n#define\tUIPROTO_DATA_V42BIS\t\t0x90\t/* Data compression */\n#define\tUIPROTO_DATA_Q931\t\t0x91\t/* Euro-ISDN */\n#define\tUIPROTO_DATA_V120\t\t0x92\t/* V.24 rate adaption */\n#define\tUIPROTO_DATA_CAPI\t\t0x93\t/* CAPI 2.0 commands */\n#define\tUIPROTO_DATA_HOST_BASED\t\t0xfd\t/* Host based driver */\n#define\tUIPROTO_DATA_PUF\t\t0xfe\t/* see Prot. Unit Func. Desc. */\n#define\tUIPROTO_DATA_VENDOR\t\t0xff\t/* Vendor specific */\n#define\tUIPROTO_DATA_NCM\t\t0x01\t/* Network Control Model */\n\n#define\tUICLASS_SMARTCARD\t0x0b\n#define\tUICLASS_FIRM_UPD\t0x0c\n#define\tUICLASS_SECURITY\t0x0d\n#define\tUICLASS_DIAGNOSTIC\t0xdc\n#define\tUICLASS_WIRELESS\t0xe0\n#define\tUISUBCLASS_RF\t\t\t0x01\n#define\tUIPROTO_BLUETOOTH\t\t0x01\n\n#define\tUICLASS_IAD\t\t0xEF\t/* Interface Association Descriptor */\n\n#define\tUICLASS_APPL_SPEC\t0xfe\n#define\tUISUBCLASS_FIRMWARE_DOWNLOAD\t1\n#define\tUISUBCLASS_IRDA\t\t\t2\n#define\tUIPROTO_IRDA\t\t\t0\n\n#define\tUICLASS_VENDOR\t\t0xff\n#define\tUISUBCLASS_XBOX360_CONTROLLER\t0x5d\n#define\tUIPROTO_XBOX360_GAMEPAD\t0x01\n\nstruct usb_endpoint_descriptor {\n\tuByte\tbLength;\n\tuByte\tbDescriptorType;\n\tuByte\tbEndpointAddress;\n#define\tUE_GET_DIR(a)\t((a) & 0x80)\n#define\tUE_SET_DIR(a,d)\t((a) | (((d)&1) << 7))\n#define\tUE_DIR_IN\t0x80\t\t/* IN-token endpoint, fixed */\n#define\tUE_DIR_OUT\t0x00\t\t/* OUT-token endpoint, fixed */\n#define\tUE_DIR_RX\t0xfd\t\t/* for internal use only! */\n#define\tUE_DIR_TX\t0xfe\t\t/* for internal use only! */\n#define\tUE_DIR_ANY\t0xff\t\t/* for internal use only! */\n#define\tUE_ADDR\t\t0x0f\n#define\tUE_ADDR_ANY\t0xff\t\t/* for internal use only! */\n#define\tUE_GET_ADDR(a)\t((a) & UE_ADDR)\n\tuByte\tbmAttributes;\n#define\tUE_XFERTYPE\t0x03\n#define\tUE_CONTROL\t0x00\n#define\tUE_ISOCHRONOUS\t0x01\n#define\tUE_BULK\t0x02\n#define\tUE_INTERRUPT\t0x03\n#define\tUE_BULK_INTR\t0xfe\t\t/* for internal use only! */\n#define\tUE_TYPE_ANY\t0xff\t\t/* for internal use only! */\n#define\tUE_GET_XFERTYPE(a)\t((a) & UE_XFERTYPE)\n#define\tUE_ISO_TYPE\t0x0c\n#define\tUE_ISO_ASYNC\t0x04\n#define\tUE_ISO_ADAPT\t0x08\n#define\tUE_ISO_SYNC\t0x0c\n#define\tUE_GET_ISO_TYPE(a)\t((a) & UE_ISO_TYPE)\n\tuWord\twMaxPacketSize;\n#define\tUE_ZERO_MPS 0xFFFF\t\t/* for internal use only */\n\tuByte\tbInterval;\n} __packed;\ntypedef struct usb_endpoint_descriptor usb_endpoint_descriptor_t;\n\nstruct usb_endpoint_ss_comp_descriptor {\n\tuByte\tbLength;\n\tuByte\tbDescriptorType;\n\tuByte\tbMaxBurst;\n\tuByte\tbmAttributes;\n\tuWord\twBytesPerInterval;\n} __packed;\ntypedef struct usb_endpoint_ss_comp_descriptor\n\t\tusb_endpoint_ss_comp_descriptor_t;\n\nstruct usb_string_descriptor {\n\tuByte\tbLength;\n\tuByte\tbDescriptorType;\n\tuWord\tbString[126];\n\tuByte\tbUnused;\n} __packed;\ntypedef struct usb_string_descriptor usb_string_descriptor_t;\n\n#define\tUSB_MAKE_STRING_DESC(m,name)\t\\\nstruct name {\t\t\t\t\\\n  uByte bLength;\t\t\t\\\n  uByte bDescriptorType;\t\t\\\n  uByte bData[sizeof((uint8_t []){m})];\t\\\n} __packed;\t\t\t\t\\\nstatic const struct name name = {\t\\\n  .bLength = sizeof(struct name),\t\\\n  .bDescriptorType = UDESC_STRING,\t\\\n  .bData = { m },\t\t\t\\\n}\n\nstruct usb_hub_descriptor {\n\tuByte\tbDescLength;\n\tuByte\tbDescriptorType;\n\tuByte\tbNbrPorts;\n\tuWord\twHubCharacteristics;\n#define\tUHD_PWR\t\t\t0x0003\n#define\tUHD_PWR_GANGED\t\t0x0000\n#define\tUHD_PWR_INDIVIDUAL\t0x0001\n#define\tUHD_PWR_NO_SWITCH\t0x0002\n#define\tUHD_COMPOUND\t\t0x0004\n#define\tUHD_OC\t\t\t0x0018\n#define\tUHD_OC_GLOBAL\t\t0x0000\n#define\tUHD_OC_INDIVIDUAL\t0x0008\n#define\tUHD_OC_NONE\t\t0x0010\n#define\tUHD_TT_THINK\t\t0x0060\n#define\tUHD_TT_THINK_8\t\t0x0000\n#define\tUHD_TT_THINK_16\t\t0x0020\n#define\tUHD_TT_THINK_24\t\t0x0040\n#define\tUHD_TT_THINK_32\t\t0x0060\n#define\tUHD_PORT_IND\t\t0x0080\n\tuByte\tbPwrOn2PwrGood;\t\t/* delay in 2 ms units */\n#define\tUHD_PWRON_FACTOR 2\n\tuByte\tbHubContrCurrent;\n\tuByte\tDeviceRemovable[32];\t/* max 255 ports */\n#define\tUHD_NOT_REMOV(desc, i) \\\n    (((desc)->DeviceRemovable[(i)/8] >> ((i) % 8)) & 1)\n\tuByte\tPortPowerCtrlMask[1];\t/* deprecated */\n} __packed;\ntypedef struct usb_hub_descriptor usb_hub_descriptor_t;\n\nstruct usb_hub_ss_descriptor {\n\tuByte\tbLength;\n\tuByte\tbDescriptorType;\n\tuByte\tbNbrPorts;\n\tuWord\twHubCharacteristics;\n\tuByte\tbPwrOn2PwrGood;\t\t/* delay in 2 ms units */\n\tuByte\tbHubContrCurrent;\n\tuByte\tbHubHdrDecLat;\n\tuWord\twHubDelay;\n\tuByte\tDeviceRemovable[32];\t/* max 255 ports */\n} __packed;\ntypedef struct usb_hub_ss_descriptor usb_hub_ss_descriptor_t;\n\n/* minimum HUB descriptor (8-ports maximum) */\nstruct usb_hub_descriptor_min {\n\tuByte\tbDescLength;\n\tuByte\tbDescriptorType;\n\tuByte\tbNbrPorts;\n\tuWord\twHubCharacteristics;\n\tuByte\tbPwrOn2PwrGood;\n\tuByte\tbHubContrCurrent;\n\tuByte\tDeviceRemovable[1];\n\tuByte\tPortPowerCtrlMask[1];\n} __packed;\ntypedef struct usb_hub_descriptor_min usb_hub_descriptor_min_t;\n\nstruct usb_device_qualifier {\n\tuByte\tbLength;\n\tuByte\tbDescriptorType;\n\tuWord\tbcdUSB;\n\tuByte\tbDeviceClass;\n\tuByte\tbDeviceSubClass;\n\tuByte\tbDeviceProtocol;\n\tuByte\tbMaxPacketSize0;\n\tuByte\tbNumConfigurations;\n\tuByte\tbReserved;\n} __packed;\ntypedef struct usb_device_qualifier usb_device_qualifier_t;\n\nstruct usb_otg_descriptor {\n\tuByte\tbLength;\n\tuByte\tbDescriptorType;\n\tuByte\tbmAttributes;\n#define\tUOTG_SRP\t0x01\n#define\tUOTG_HNP\t0x02\n} __packed;\ntypedef struct usb_otg_descriptor usb_otg_descriptor_t;\n\n/* OTG feature selectors */\n#define\tUOTG_B_HNP_ENABLE\t3\n#define\tUOTG_A_HNP_SUPPORT\t4\n#define\tUOTG_A_ALT_HNP_SUPPORT\t5\n\nstruct usb_status {\n\tuWord\twStatus;\n/* Device status flags */\n#define\tUDS_SELF_POWERED\t\t0x0001\n#define\tUDS_REMOTE_WAKEUP\t\t0x0002\n/* Endpoint status flags */\n#define\tUES_HALT\t\t\t0x0001\n} __packed;\ntypedef struct usb_status usb_status_t;\n\nstruct usb_hub_status {\n\tuWord\twHubStatus;\n#define\tUHS_LOCAL_POWER\t\t\t0x0001\n#define\tUHS_OVER_CURRENT\t\t0x0002\n\tuWord\twHubChange;\n} __packed;\ntypedef struct usb_hub_status usb_hub_status_t;\n\nstruct usb_port_status {\n\tuWord\twPortStatus;\n#define\tUPS_CURRENT_CONNECT_STATUS\t0x0001\n#define\tUPS_PORT_ENABLED\t\t0x0002\n#define\tUPS_SUSPEND\t\t\t0x0004\n#define\tUPS_OVERCURRENT_INDICATOR\t0x0008\n#define\tUPS_RESET\t\t\t0x0010\n/* The link-state bits are valid for Super-Speed USB HUBs */\n#define\tUPS_PORT_LINK_STATE_GET(x)\t(((x) >> 5) & 0xF)\n#define\tUPS_PORT_LINK_STATE_SET(x)\t(((x) & 0xF) << 5)\n#define\tUPS_PORT_LS_U0\t\t0x00\n#define\tUPS_PORT_LS_U1\t\t0x01\n#define\tUPS_PORT_LS_U2\t\t0x02\n#define\tUPS_PORT_LS_U3\t\t0x03\n#define\tUPS_PORT_LS_SS_DIS\t0x04\n#define\tUPS_PORT_LS_RX_DET\t0x05\n#define\tUPS_PORT_LS_SS_INA\t0x06\n#define\tUPS_PORT_LS_POLL\t0x07\n#define\tUPS_PORT_LS_RECOVER\t0x08\n#define\tUPS_PORT_LS_HOT_RST\t0x09\n#define\tUPS_PORT_LS_COMP_MODE\t0x0A\n#define\tUPS_PORT_LS_LOOPBACK\t0x0B\n#define\tUPS_PORT_LS_RESUME\t0x0F\n#define\tUPS_PORT_POWER\t\t\t0x0100\n#define\tUPS_LOW_SPEED\t\t\t0x0200\n#define\tUPS_HIGH_SPEED\t\t\t0x0400\n#define\tUPS_OTHER_SPEED\t\t\t0x0600\t/* currently FreeBSD specific */\n#define\tUPS_PORT_TEST\t\t\t0x0800\n#define\tUPS_PORT_INDICATOR\t\t0x1000\n#define\tUPS_PORT_MODE_DEVICE\t\t0x8000\t/* currently FreeBSD specific */\n\tuWord\twPortChange;\n#define\tUPS_C_CONNECT_STATUS\t\t0x0001\n#define\tUPS_C_PORT_ENABLED\t\t0x0002\n#define\tUPS_C_SUSPEND\t\t\t0x0004\n#define\tUPS_C_OVERCURRENT_INDICATOR\t0x0008\n#define\tUPS_C_PORT_RESET\t\t0x0010\n#define\tUPS_C_BH_PORT_RESET\t\t0x0020\n#define\tUPS_C_PORT_LINK_STATE\t\t0x0040\n#define\tUPS_C_PORT_CONFIG_ERROR\t\t0x0080\n} __packed;\ntypedef struct usb_port_status usb_port_status_t;\n\n/*\n * The \"USB_SPEED\" macros defines all the supported USB speeds.\n */\nenum usb_dev_speed {\n\tUSB_SPEED_VARIABLE,\n\tUSB_SPEED_LOW,\n\tUSB_SPEED_FULL,\n\tUSB_SPEED_HIGH,\n\tUSB_SPEED_SUPER,\n};\n#define\tUSB_SPEED_MAX\t(USB_SPEED_SUPER+1)\n\n/*\n * The \"USB_REV\" macros defines all the supported USB revisions.\n */\nenum usb_revision {\n\tUSB_REV_UNKNOWN,\n\tUSB_REV_PRE_1_0,\n\tUSB_REV_1_0,\n\tUSB_REV_1_1,\n\tUSB_REV_2_0,\n\tUSB_REV_2_5,\n\tUSB_REV_3_0\n};\n#define\tUSB_REV_MAX\t(USB_REV_3_0+1)\n\n/*\n * Supported host contoller modes.\n */\nenum usb_hc_mode {\n\tUSB_MODE_HOST,\t\t/* initiates transfers */\n\tUSB_MODE_DEVICE,\t/* bus transfer target */\n\tUSB_MODE_DUAL\t\t/* can be host or device */\n};\n#define\tUSB_MODE_MAX\t(USB_MODE_DUAL+1)\n\n/*\n * The \"USB_MODE\" macros defines all the supported device states.\n */\nenum usb_dev_state {\n\tUSB_STATE_DETACHED,\n\tUSB_STATE_ATTACHED,\n\tUSB_STATE_POWERED,\n\tUSB_STATE_ADDRESSED,\n\tUSB_STATE_CONFIGURED,\n};\n#define\tUSB_STATE_MAX\t(USB_STATE_CONFIGURED+1)\n#endif\t\t\t\t\t/* _USB_STANDARD_H_ */\n"
  },
  {
    "path": "freebsd-headers/dev/usb/usb_bus.h",
    "content": "/* $FreeBSD: release/9.0.0/sys/dev/usb/usb_bus.h 215802 2010-11-24 19:11:32Z weongyo $ */\n/*-\n * Copyright (c) 2008 Hans Petter Selasky. All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n */\n\n#ifndef _USB_BUS_H_\n#define\t_USB_BUS_H_\n\n/*\n * The following structure defines the USB explore message sent to the USB\n * explore process.\n */\n\nstruct usb_bus_msg {\n\tstruct usb_proc_msg hdr;\n\tstruct usb_bus *bus;\n};\n\n/*\n * The following structure defines the USB statistics structure.\n */\nstruct usb_bus_stat {\n\tuint32_t uds_requests[4];\n};\n\n/*\n * The following structure defines an USB BUS. There is one USB BUS\n * for every Host or Device controller.\n */\nstruct usb_bus {\n\tstruct usb_bus_stat stats_err;\n\tstruct usb_bus_stat stats_ok;\n\tstruct root_hold_token *bus_roothold;\n\t/*\n\t * There are two callback processes. One for Giant locked\n\t * callbacks. One for non-Giant locked callbacks. This should\n\t * avoid congestion and reduce response time in most cases.\n\t */\n\tstruct usb_process giant_callback_proc;\n\tstruct usb_process non_giant_callback_proc;\n\n\t/* Explore process */\n\tstruct usb_process explore_proc;\n\n\t/* Control request process */\n\tstruct usb_process control_xfer_proc;\n\n\tstruct usb_bus_msg explore_msg[2];\n\tstruct usb_bus_msg detach_msg[2];\n\tstruct usb_bus_msg attach_msg[2];\n\t/*\n\t * This mutex protects the USB hardware:\n\t */\n\tstruct mtx bus_mtx;\n\tstruct usb_xfer_queue intr_q;\n\tstruct usb_callout power_wdog;\t/* power management */\n\n\tdevice_t parent;\n\tdevice_t bdev;\t\t\t/* filled by HC driver */\n\n#if USB_HAVE_BUSDMA\n\tstruct usb_dma_parent_tag dma_parent_tag[1];\n\tstruct usb_dma_tag dma_tags[USB_BUS_DMA_TAG_MAX];\n#endif\n\tstruct usb_bus_methods *methods;\t/* filled by HC driver */\n\tstruct usb_device **devices;\n\n\tstruct ifnet *ifp;\t/* only for USB Packet Filter */\n\n\tusb_power_mask_t hw_power_state;\t/* see USB_HW_POWER_XXX */\n\tusb_size_t uframe_usage[USB_HS_MICRO_FRAMES_MAX];\n\n\tuint16_t isoc_time_last;\t/* in milliseconds */\n\n\tuint8_t\talloc_failed;\t\t/* Set if memory allocation failed. */\n\tuint8_t\tdriver_added_refcount;\t/* Current driver generation count */\n\tenum usb_revision usbrev;\t/* USB revision. See \"USB_REV_XXX\". */\n\n\tuint8_t\tdevices_max;\t\t/* maximum number of USB devices */\n\tuint8_t\tdo_probe;\t\t/* set if USB BUS should be re-probed */\n\n\t/* \n\t * The scratch area can only be used inside the explore thread\n\t * belonging to the give serial bus.\n\t */\n\tunion {\n\t\tstruct usb_hw_ep_scratch hw_ep_scratch[1];\n\t\tstruct usb_temp_setup temp_setup[1];\n\t\tuint8_t\tdata[255];\n\t}\tscratch[1];\n};\n\n#endif\t\t\t\t\t/* _USB_BUS_H_ */\n"
  },
  {
    "path": "freebsd-headers/dev/usb/usb_busdma.h",
    "content": "/* $FreeBSD: release/9.0.0/sys/dev/usb/usb_busdma.h 196219 2009-08-14 20:03:53Z jhb $ */\n/*-\n * Copyright (c) 2008 Hans Petter Selasky. All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n */\n\n#ifndef _USB_BUSDMA_H_\n#define\t_USB_BUSDMA_H_\n\n#include <sys/uio.h>\n#include <sys/mbuf.h>\n\n#include <machine/bus.h>\n\n/* defines */\n\n#define\tUSB_PAGE_SIZE PAGE_SIZE\t\t/* use system PAGE_SIZE */\n\n#if (__FreeBSD_version >= 700020)\n#define\tUSB_GET_DMA_TAG(dev) bus_get_dma_tag(dev)\n#else\n#define\tUSB_GET_DMA_TAG(dev) NULL\t/* XXX */\n#endif\n\n/* structure prototypes */\n\nstruct usb_xfer_root;\nstruct usb_dma_parent_tag;\nstruct usb_dma_tag;\n\n/*\n * The following typedef defines the USB DMA load done callback.\n */\n\ntypedef void (usb_dma_callback_t)(struct usb_dma_parent_tag *udpt);\n\n/*\n * The following structure defines physical and non kernel virtual\n * address of a memory page having size USB_PAGE_SIZE.\n */\nstruct usb_page {\n#if USB_HAVE_BUSDMA\n\tbus_size_t physaddr;\n\tvoid   *buffer;\t\t\t/* non Kernel Virtual Address */\n#endif\n};\n\n/*\n * The following structure is used when needing the kernel virtual\n * pointer and the physical address belonging to an offset in an USB\n * page cache.\n */\nstruct usb_page_search {\n\tvoid   *buffer;\n#if USB_HAVE_BUSDMA\n\tbus_size_t physaddr;\n#endif\n\tusb_size_t length;\n};\n\n/*\n * The following structure is used to keep information about a DMA\n * memory allocation.\n */\nstruct usb_page_cache {\n\n#if USB_HAVE_BUSDMA\n\tbus_dma_tag_t tag;\n\tbus_dmamap_t map;\n\tstruct usb_page *page_start;\n#endif\n\tstruct usb_dma_parent_tag *tag_parent;\t/* always set */\n\tvoid   *buffer;\t\t\t/* virtual buffer pointer */\n#if USB_HAVE_BUSDMA\n\tusb_size_t page_offset_buf;\n\tusb_size_t page_offset_end;\n\tuint8_t\tisread:1;\t\t/* set if we are currently reading\n\t\t\t\t\t * from the memory. Else write. */\n\tuint8_t\tismultiseg:1;\t\t/* set if we can have multiple\n\t\t\t\t\t * segments */\n#endif\n};\n\n/*\n * The following structure describes the parent USB DMA tag.\n */\n#if USB_HAVE_BUSDMA\nstruct usb_dma_parent_tag {\n\tstruct cv cv[1];\t\t/* internal condition variable */\n\tbus_dma_tag_t tag;\t\t/* always set */\n\n\tstruct mtx *mtx;\t\t/* private mutex, always set */\n\tusb_dma_callback_t *func;\t/* load complete callback function */\n\tstruct usb_dma_tag *utag_first;/* pointer to first USB DMA tag */\n\tuint8_t\tdma_error;\t\t/* set if DMA load operation failed */\n\tuint8_t\tdma_bits;\t\t/* number of DMA address lines */\n\tuint8_t\tutag_max;\t\t/* number of USB DMA tags */\n};\n#else\nstruct usb_dma_parent_tag {};\t\t/* empty struct */\n#endif\n\n/*\n * The following structure describes an USB DMA tag.\n */\n#if USB_HAVE_BUSDMA\nstruct usb_dma_tag {\n\tstruct usb_dma_parent_tag *tag_parent;\n\tbus_dma_tag_t tag;\n\tusb_size_t align;\n\tusb_size_t size;\n};\n#else\nstruct usb_dma_tag {};\t\t\t/* empty struct */\n#endif\n\n/* function prototypes */\n\nint\tusb_uiomove(struct usb_page_cache *pc, struct uio *uio,\n\t    usb_frlength_t pc_offset, usb_frlength_t len);\nstruct usb_dma_tag *usb_dma_tag_find(struct usb_dma_parent_tag *udpt,\n\t    usb_size_t size, usb_size_t align);\nuint8_t\tusb_pc_alloc_mem(struct usb_page_cache *pc, struct usb_page *pg,\n\t    usb_size_t size, usb_size_t align);\nuint8_t\tusb_pc_dmamap_create(struct usb_page_cache *pc, usb_size_t size);\nuint8_t\tusb_pc_load_mem(struct usb_page_cache *pc, usb_size_t size,\n\t    uint8_t sync);\nvoid\tusb_bdma_done_event(struct usb_dma_parent_tag *udpt);\nvoid\tusb_bdma_post_sync(struct usb_xfer *xfer);\nvoid\tusb_bdma_pre_sync(struct usb_xfer *xfer);\nvoid\tusb_bdma_work_loop(struct usb_xfer_queue *pq);\nvoid\tusb_dma_tag_setup(struct usb_dma_parent_tag *udpt,\n\t    struct usb_dma_tag *udt, bus_dma_tag_t dmat, struct mtx *mtx,\n\t    usb_dma_callback_t *func, uint8_t ndmabits, uint8_t nudt);\nvoid\tusb_dma_tag_unsetup(struct usb_dma_parent_tag *udpt);\nvoid\tusb_pc_cpu_flush(struct usb_page_cache *pc);\nvoid\tusb_pc_cpu_invalidate(struct usb_page_cache *pc);\nvoid\tusb_pc_dmamap_destroy(struct usb_page_cache *pc);\nvoid\tusb_pc_free_mem(struct usb_page_cache *pc);\n\n#endif\t\t\t\t\t/* _USB_BUSDMA_H_ */\n"
  },
  {
    "path": "freebsd-headers/dev/usb/usb_cdc.h",
    "content": "/*\t$NetBSD: usbcdc.h,v 1.9 2004/10/23 13:24:24 augustss Exp $\t*/\n/*\t$FreeBSD: release/9.0.0/sys/dev/usb/usb_cdc.h 213809 2010-10-13 22:04:55Z hselasky $\t*/\n\n/*-\n * Copyright (c) 1998 The NetBSD Foundation, Inc.\n * All rights reserved.\n *\n * This code is derived from software contributed to The NetBSD Foundation\n * by Lennart Augustsson (lennart@augustsson.net) at\n * Carlstedt Research & Technology.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS\n * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED\n * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\n * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS\n * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\n * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\n * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\n * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\n * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\n#ifndef _USB_CDC_H_\n#define\t_USB_CDC_H_\n\n#define\tUDESCSUB_CDC_HEADER\t0\n#define\tUDESCSUB_CDC_CM\t\t1\t/* Call Management */\n#define\tUDESCSUB_CDC_ACM\t2\t/* Abstract Control Model */\n#define\tUDESCSUB_CDC_DLM\t3\t/* Direct Line Management */\n#define\tUDESCSUB_CDC_TRF\t4\t/* Telephone Ringer */\n#define\tUDESCSUB_CDC_TCLSR\t5\t/* Telephone Call */\n#define\tUDESCSUB_CDC_UNION\t6\n#define\tUDESCSUB_CDC_CS\t\t7\t/* Country Selection */\n#define\tUDESCSUB_CDC_TOM\t8\t/* Telephone Operational Modes */\n#define\tUDESCSUB_CDC_USBT\t9\t/* USB Terminal */\n#define\tUDESCSUB_CDC_NCT\t10\n#define\tUDESCSUB_CDC_PUF\t11\n#define\tUDESCSUB_CDC_EUF\t12\n#define\tUDESCSUB_CDC_MCMF\t13\n#define\tUDESCSUB_CDC_CCMF\t14\n#define\tUDESCSUB_CDC_ENF\t15\n#define\tUDESCSUB_CDC_ANF\t16\n\nstruct usb_cdc_header_descriptor {\n\tuByte\tbLength;\n\tuByte\tbDescriptorType;\n\tuByte\tbDescriptorSubtype;\n\tuWord\tbcdCDC;\n} __packed;\n\nstruct usb_cdc_cm_descriptor {\n\tuByte\tbLength;\n\tuByte\tbDescriptorType;\n\tuByte\tbDescriptorSubtype;\n\tuByte\tbmCapabilities;\n#define\tUSB_CDC_CM_DOES_CM\t\t0x01\n#define\tUSB_CDC_CM_OVER_DATA\t\t0x02\n\tuByte\tbDataInterface;\n} __packed;\n\nstruct usb_cdc_acm_descriptor {\n\tuByte\tbLength;\n\tuByte\tbDescriptorType;\n\tuByte\tbDescriptorSubtype;\n\tuByte\tbmCapabilities;\n#define\tUSB_CDC_ACM_HAS_FEATURE\t\t0x01\n#define\tUSB_CDC_ACM_HAS_LINE\t\t0x02\n#define\tUSB_CDC_ACM_HAS_BREAK\t\t0x04\n#define\tUSB_CDC_ACM_HAS_NETWORK_CONN\t0x08\n} __packed;\n\nstruct usb_cdc_union_descriptor {\n\tuByte\tbLength;\n\tuByte\tbDescriptorType;\n\tuByte\tbDescriptorSubtype;\n\tuByte\tbMasterInterface;\n\tuByte\tbSlaveInterface[1];\n} __packed;\n\nstruct usb_cdc_ethernet_descriptor {\n\tuByte\tbLength;\n\tuByte\tbDescriptorType;\n\tuByte\tbDescriptorSubtype;\n\tuByte\tiMacAddress;\n\tuDWord\tbmEthernetStatistics;\n\tuWord\twMaxSegmentSize;\n\tuWord\twNumberMCFilters;\n\tuByte\tbNumberPowerFilters;\n} __packed;\n\n#define\tUCDC_SEND_ENCAPSULATED_COMMAND\t0x00\n#define\tUCDC_GET_ENCAPSULATED_RESPONSE\t0x01\n#define\tUCDC_SET_COMM_FEATURE\t\t0x02\n#define\tUCDC_GET_COMM_FEATURE\t\t0x03\n#define\tUCDC_ABSTRACT_STATE\t\t0x01\n#define\tUCDC_COUNTRY_SETTING\t\t0x02\n#define\tUCDC_CLEAR_COMM_FEATURE\t\t0x04\n#define\tUCDC_SET_LINE_CODING\t\t0x20\n#define\tUCDC_GET_LINE_CODING\t\t0x21\n#define\tUCDC_SET_CONTROL_LINE_STATE\t0x22\n#define\tUCDC_LINE_DTR\t\t\t0x0001\n#define\tUCDC_LINE_RTS\t\t\t0x0002\n#define\tUCDC_SEND_BREAK\t\t\t0x23\n#define\tUCDC_BREAK_ON\t\t\t0xffff\n#define\tUCDC_BREAK_OFF\t\t\t0x0000\n\nstruct usb_cdc_abstract_state {\n\tuWord\twState;\n#define\tUCDC_IDLE_SETTING\t\t0x0001\n#define\tUCDC_DATA_MULTIPLEXED\t\t0x0002\n} __packed;\n\n#define\tUCDC_ABSTRACT_STATE_LENGTH\t2\n\nstruct usb_cdc_line_state {\n\tuDWord\tdwDTERate;\n\tuByte\tbCharFormat;\n#define\tUCDC_STOP_BIT_1\t\t\t0\n#define\tUCDC_STOP_BIT_1_5\t\t1\n#define\tUCDC_STOP_BIT_2\t\t\t2\n\tuByte\tbParityType;\n#define\tUCDC_PARITY_NONE\t\t0\n#define\tUCDC_PARITY_ODD\t\t\t1\n#define\tUCDC_PARITY_EVEN\t\t2\n#define\tUCDC_PARITY_MARK\t\t3\n#define\tUCDC_PARITY_SPACE\t\t4\n\tuByte\tbDataBits;\n} __packed;\n\n#define\tUCDC_LINE_STATE_LENGTH\t\t7\n\nstruct usb_cdc_notification {\n\tuByte\tbmRequestType;\n#define\tUCDC_NOTIFICATION\t\t0xa1\n\tuByte\tbNotification;\n#define\tUCDC_N_NETWORK_CONNECTION\t0x00\n#define\tUCDC_N_RESPONSE_AVAILABLE\t0x01\n#define\tUCDC_N_AUX_JACK_HOOK_STATE\t0x08\n#define\tUCDC_N_RING_DETECT\t\t0x09\n#define\tUCDC_N_SERIAL_STATE\t\t0x20\n#define\tUCDC_N_CALL_STATE_CHANGED\t0x28\n#define\tUCDC_N_LINE_STATE_CHANGED\t0x29\n#define\tUCDC_N_CONNECTION_SPEED_CHANGE\t0x2a\n\tuWord\twValue;\n\tuWord\twIndex;\n\tuWord\twLength;\n\tuByte\tdata[16];\n} __packed;\n\n#define\tUCDC_NOTIFICATION_LENGTH\t8\n\n/*\n * Bits set in the SERIAL STATE notifcation (first byte of data)\n */\n\n#define\tUCDC_N_SERIAL_OVERRUN\t\t0x40\n#define\tUCDC_N_SERIAL_PARITY\t\t0x20\n#define\tUCDC_N_SERIAL_FRAMING\t\t0x10\n#define\tUCDC_N_SERIAL_RI\t\t0x08\n#define\tUCDC_N_SERIAL_BREAK\t\t0x04\n#define\tUCDC_N_SERIAL_DSR\t\t0x02\n#define\tUCDC_N_SERIAL_DCD\t\t0x01\n\n/* Serial state bit masks */\n#define\tUCDC_MDM_RXCARRIER\t\t0x01\n#define\tUCDC_MDM_TXCARRIER\t\t0x02\n#define\tUCDC_MDM_BREAK\t\t\t0x04\n#define\tUCDC_MDM_RING\t\t\t0x08\n#define\tUCDC_MDM_FRAMING_ERR\t\t0x10\n#define\tUCDC_MDM_PARITY_ERR\t\t0x20\n#define\tUCDC_MDM_OVERRUN_ERR\t\t0x40\n\n/*\n * Network Control Model, NCM16 + NCM32, protocol definitions\n */\nstruct usb_ncm16_hdr {\n\tuDWord\tdwSignature;\n\tuWord\twHeaderLength;\n\tuWord\twSequence;\n\tuWord\twBlockLength;\n\tuWord\twDptIndex;\n} __packed;\n\nstruct usb_ncm16_dp {\n\tuWord\twFrameIndex;\n\tuWord\twFrameLength;\n} __packed;\n\nstruct usb_ncm16_dpt {\n\tuDWord\tdwSignature;\n\tuWord\twLength;\n\tuWord\twNextNdpIndex;\n\tstruct usb_ncm16_dp dp[0];\n} __packed;\n\nstruct usb_ncm32_hdr {\n\tuDWord\tdwSignature;\n\tuWord\twHeaderLength;\n\tuWord\twSequence;\n\tuDWord\tdwBlockLength;\n\tuDWord\tdwDptIndex;\n} __packed;\n\nstruct usb_ncm32_dp {\n\tuDWord\tdwFrameIndex;\n\tuDWord\tdwFrameLength;\n} __packed;\n\nstruct usb_ncm32_dpt {\n\tuDWord\tdwSignature;\n\tuWord\twLength;\n\tuWord\twReserved6;\n\tuDWord\tdwNextNdpIndex;\n\tuDWord\tdwReserved12;\n\tstruct usb_ncm32_dp dp[0];\n} __packed;\n\n/* Communications interface class specific descriptors */\n\n#define\tUCDC_NCM_FUNC_DESC_SUBTYPE\t0x1A\n\nstruct usb_ncm_func_descriptor {\n\tuByte\tbLength;\n\tuByte\tbDescriptorType;\n\tuByte\tbDescriptorSubtype;\n\tuByte\tbcdNcmVersion[2];\n\tuByte\tbmNetworkCapabilities;\n#define\tUCDC_NCM_CAP_FILTER\t0x01\n#define\tUCDC_NCM_CAP_MAC_ADDR\t0x02\n#define\tUCDC_NCM_CAP_ENCAP\t0x04\n#define\tUCDC_NCM_CAP_MAX_DATA\t0x08\n#define\tUCDC_NCM_CAP_CRCMODE\t0x10\n#define\tUCDC_NCM_CAP_MAX_DGRAM\t0x20\n} __packed;\n\n/* Communications interface specific class request codes */\n\n#define\tUCDC_NCM_SET_ETHERNET_MULTICAST_FILTERS\t\t\t0x40\n#define\tUCDC_NCM_SET_ETHERNET_POWER_MGMT_PATTERN_FILTER\t\t0x41\n#define\tUCDC_NCM_GET_ETHERNET_POWER_MGMT_PATTERN_FILTER\t\t0x42\n#define\tUCDC_NCM_SET_ETHERNET_PACKET_FILTER\t\t\t0x43\n#define\tUCDC_NCM_GET_ETHERNET_STATISTIC\t\t\t\t0x44\n#define\tUCDC_NCM_GET_NTB_PARAMETERS\t\t\t\t0x80\n#define\tUCDC_NCM_GET_NET_ADDRESS\t\t\t\t0x81\n#define\tUCDC_NCM_SET_NET_ADDRESS\t\t\t\t0x82\n#define\tUCDC_NCM_GET_NTB_FORMAT\t\t\t\t\t0x83\n#define\tUCDC_NCM_SET_NTB_FORMAT\t\t\t\t\t0x84\n#define\tUCDC_NCM_GET_NTB_INPUT_SIZE\t\t\t\t0x85\n#define\tUCDC_NCM_SET_NTB_INPUT_SIZE\t\t\t\t0x86\n#define\tUCDC_NCM_GET_MAX_DATAGRAM_SIZE\t\t\t\t0x87\n#define\tUCDC_NCM_SET_MAX_DATAGRAM_SIZE\t\t\t\t0x88\n#define\tUCDC_NCM_GET_CRC_MODE\t\t\t\t\t0x89\n#define\tUCDC_NCM_SET_CRC_MODE\t\t\t\t\t0x8A\n\nstruct usb_ncm_parameters {\n\tuWord\twLength;\n\tuWord\tbmNtbFormatsSupported;\n#define\tUCDC_NCM_FORMAT_NTB16\t0x0001\n#define\tUCDC_NCM_FORMAT_NTB32\t0x0002\n\tuDWord\tdwNtbInMaxSize;\n\tuWord\twNdpInDivisor;\n\tuWord\twNdpInPayloadRemainder;\n\tuWord\twNdpInAlignment;\n\tuWord\twReserved14;\n\tuDWord\tdwNtbOutMaxSize;\n\tuWord\twNdpOutDivisor;\n\tuWord\twNdpOutPayloadRemainder;\n\tuWord\twNdpOutAlignment;\n\tuWord\twNtbOutMaxDatagrams;\n} __packed;\n\n/* Communications interface specific class notification codes */\n#define\tUCDC_NCM_NOTIF_NETWORK_CONNECTION\t0x00\n#define\tUCDC_NCM_NOTIF_RESPONSE_AVAILABLE\t0x01\n#define\tUCDC_NCM_NOTIF_CONNECTION_SPEED_CHANGE\t0x2A\n\n#endif\t\t\t\t\t/* _USB_CDC_H_ */\n"
  },
  {
    "path": "freebsd-headers/dev/usb/usb_compat_linux.h",
    "content": "/* $FreeBSD: release/9.0.0/sys/dev/usb/usb_compat_linux.h 198776 2009-11-01 21:48:18Z thompsa $ */\n/*-\n * Copyright (c) 2007 Luigi Rizzo - Universita` di Pisa. All rights reserved.\n * Copyright (c) 2007 Hans Petter Selasky. All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n */\n\n#ifndef _USB_COMPAT_LINUX_H\n#define\t_USB_COMPAT_LINUX_H\n\nstruct usb_device;\nstruct usb_interface;\nstruct usb_driver;\nstruct urb;\n\ntypedef void *pm_message_t;\ntypedef void (usb_complete_t)(struct urb *);\n\n#define\tUSB_MAX_FULL_SPEED_ISOC_FRAMES (60 * 1)\n#define\tUSB_MAX_HIGH_SPEED_ISOC_FRAMES (60 * 8)\n\n#define\tUSB_DEVICE_ID_MATCH_DEVICE \\\n\t(USB_DEVICE_ID_MATCH_VENDOR | USB_DEVICE_ID_MATCH_PRODUCT)\n\n#define\tUSB_DEVICE(vend,prod) \\\n\t.match_flags = USB_DEVICE_ID_MATCH_DEVICE, .idVendor = (vend), \\\n\t.idProduct = (prod)\n\n/* The \"usb_driver\" structure holds the Linux USB device driver\n * callbacks, and a pointer to device ID's which this entry should\n * match against. Usually this entry is exposed to the USB emulation\n * layer using the \"USB_DRIVER_EXPORT()\" macro, which is defined\n * below.\n */\nstruct usb_driver {\n\tconst char *name;\n\n\tint     (*probe) (struct usb_interface *intf,\n\t    \tconst\tstruct usb_device_id *id);\n\n\tvoid    (*disconnect) (struct usb_interface *intf);\n\n\tint     (*ioctl) (struct usb_interface *intf, unsigned int code,\n\t    \tvoid  *buf);\n\n\tint     (*suspend) (struct usb_interface *intf, pm_message_t message);\n\tint     (*resume) (struct usb_interface *intf);\n\n\tconst struct usb_device_id *id_table;\n\n\tvoid    (*shutdown) (struct usb_interface *intf);\n\n\tLIST_ENTRY(usb_driver) linux_driver_list;\n};\n\n#define\tUSB_DRIVER_EXPORT(id,p_usb_drv) \\\n  SYSINIT(id,SI_SUB_KLD,SI_ORDER_FIRST,usb_linux_register,p_usb_drv); \\\n  SYSUNINIT(id,SI_SUB_KLD,SI_ORDER_ANY,usb_linux_deregister,p_usb_drv)\n\n#define\tUSB_DT_ENDPOINT_SIZE\t\t7\n#define\tUSB_DT_ENDPOINT_AUDIO_SIZE\t9\n\n/*\n * Endpoints\n */\n#define\tUSB_ENDPOINT_NUMBER_MASK\t0x0f\t/* in bEndpointAddress */\n#define\tUSB_ENDPOINT_DIR_MASK\t\t0x80\n\n#define\tUSB_ENDPOINT_XFERTYPE_MASK\t0x03\t/* in bmAttributes */\n#define\tUSB_ENDPOINT_XFER_CONTROL\t0\n#define\tUSB_ENDPOINT_XFER_ISOC\t\t1\n#define\tUSB_ENDPOINT_XFER_BULK\t\t2\n#define\tUSB_ENDPOINT_XFER_INT\t\t3\n#define\tUSB_ENDPOINT_MAX_ADJUSTABLE\t0x80\n\n/* CONTROL REQUEST SUPPORT */\n\n/*\n * Definition of direction mask for\n * \"bEndpointAddress\" and \"bmRequestType\":\n */\n#define\tUSB_DIR_MASK\t\t\t0x80\n#define\tUSB_DIR_OUT\t\t\t0x00\t/* write to USB device */\n#define\tUSB_DIR_IN\t\t\t0x80\t/* read from USB device */\n\n/*\n * Definition of type mask for\n * \"bmRequestType\":\n */\n#define\tUSB_TYPE_MASK\t\t\t(0x03 << 5)\n#define\tUSB_TYPE_STANDARD\t\t(0x00 << 5)\n#define\tUSB_TYPE_CLASS\t\t\t(0x01 << 5)\n#define\tUSB_TYPE_VENDOR\t\t\t(0x02 << 5)\n#define\tUSB_TYPE_RESERVED\t\t(0x03 << 5)\n\n/*\n * Definition of receiver mask for\n * \"bmRequestType\":\n */\n#define\tUSB_RECIP_MASK\t\t\t0x1f\n#define\tUSB_RECIP_DEVICE\t\t0x00\n#define\tUSB_RECIP_INTERFACE\t\t0x01\n#define\tUSB_RECIP_ENDPOINT\t\t0x02\n#define\tUSB_RECIP_OTHER\t\t\t0x03\n\n/*\n * Definition of standard request values for\n * \"bRequest\":\n */\n#define\tUSB_REQ_GET_STATUS\t\t0x00\n#define\tUSB_REQ_CLEAR_FEATURE\t\t0x01\n#define\tUSB_REQ_SET_FEATURE\t\t0x03\n#define\tUSB_REQ_SET_ADDRESS\t\t0x05\n#define\tUSB_REQ_GET_DESCRIPTOR\t\t0x06\n#define\tUSB_REQ_SET_DESCRIPTOR\t\t0x07\n#define\tUSB_REQ_GET_CONFIGURATION\t0x08\n#define\tUSB_REQ_SET_CONFIGURATION\t0x09\n#define\tUSB_REQ_GET_INTERFACE\t\t0x0A\n#define\tUSB_REQ_SET_INTERFACE\t\t0x0B\n#define\tUSB_REQ_SYNCH_FRAME\t\t0x0C\n\n#define\tUSB_REQ_SET_ENCRYPTION\t\t0x0D\t/* Wireless USB */\n#define\tUSB_REQ_GET_ENCRYPTION\t\t0x0E\n#define\tUSB_REQ_SET_HANDSHAKE\t\t0x0F\n#define\tUSB_REQ_GET_HANDSHAKE\t\t0x10\n#define\tUSB_REQ_SET_CONNECTION\t\t0x11\n#define\tUSB_REQ_SET_SECURITY_DATA\t0x12\n#define\tUSB_REQ_GET_SECURITY_DATA\t0x13\n#define\tUSB_REQ_SET_WUSB_DATA\t\t0x14\n#define\tUSB_REQ_LOOPBACK_DATA_WRITE\t0x15\n#define\tUSB_REQ_LOOPBACK_DATA_READ\t0x16\n#define\tUSB_REQ_SET_INTERFACE_DS\t0x17\n\n/*\n * USB feature flags are written using USB_REQ_{CLEAR,SET}_FEATURE, and\n * are read as a bit array returned by USB_REQ_GET_STATUS.  (So there\n * are at most sixteen features of each type.)\n */\n#define\tUSB_DEVICE_SELF_POWERED\t\t0\t/* (read only) */\n#define\tUSB_DEVICE_REMOTE_WAKEUP\t1\t/* dev may initiate wakeup */\n#define\tUSB_DEVICE_TEST_MODE\t\t2\t/* (wired high speed only) */\n#define\tUSB_DEVICE_BATTERY\t\t2\t/* (wireless) */\n#define\tUSB_DEVICE_B_HNP_ENABLE\t\t3\t/* (otg) dev may initiate HNP */\n#define\tUSB_DEVICE_WUSB_DEVICE\t\t3\t/* (wireless) */\n#define\tUSB_DEVICE_A_HNP_SUPPORT\t4\t/* (otg) RH port supports HNP */\n#define\tUSB_DEVICE_A_ALT_HNP_SUPPORT\t5\t/* (otg) other RH port does */\n#define\tUSB_DEVICE_DEBUG_MODE\t\t6\t/* (special devices only) */\n\n#define\tUSB_ENDPOINT_HALT\t\t0\t/* IN/OUT will STALL */\n\n#define\tPIPE_ISOCHRONOUS\t\t0x01\t/* UE_ISOCHRONOUS */\n#define\tPIPE_INTERRUPT\t\t\t0x03\t/* UE_INTERRUPT */\n#define\tPIPE_CONTROL\t\t\t0x00\t/* UE_CONTROL */\n#define\tPIPE_BULK\t\t\t0x02\t/* UE_BULK */\n\n/* Whenever Linux references an USB endpoint:\n * a) to initialize \"urb->endpoint\"\n * b) second argument passed to \"usb_control_msg()\"\n *\n * Then it uses one of the following macros. The \"endpoint\" argument\n * is the physical endpoint value masked by 0xF. The \"dev\" argument\n * is a pointer to \"struct usb_device\".\n */\n#define\tusb_sndctrlpipe(dev,endpoint) \\\n  usb_find_host_endpoint(dev, PIPE_CONTROL, (endpoint) | USB_DIR_OUT)\n\n#define\tusb_rcvctrlpipe(dev,endpoint) \\\n  usb_find_host_endpoint(dev, PIPE_CONTROL, (endpoint) | USB_DIR_IN)\n\n#define\tusb_sndisocpipe(dev,endpoint) \\\n  usb_find_host_endpoint(dev, PIPE_ISOCHRONOUS, (endpoint) | USB_DIR_OUT)\n\n#define\tusb_rcvisocpipe(dev,endpoint) \\\n  usb_find_host_endpoint(dev, PIPE_ISOCHRONOUS, (endpoint) | USB_DIR_IN)\n\n#define\tusb_sndbulkpipe(dev,endpoint) \\\n  usb_find_host_endpoint(dev, PIPE_BULK, (endpoint) | USB_DIR_OUT)\n\n#define\tusb_rcvbulkpipe(dev,endpoint) \\\n  usb_find_host_endpoint(dev, PIPE_BULK, (endpoint) | USB_DIR_IN)\n\n#define\tusb_sndintpipe(dev,endpoint) \\\n  usb_find_host_endpoint(dev, PIPE_INTERRUPT, (endpoint) | USB_DIR_OUT)\n\n#define\tusb_rcvintpipe(dev,endpoint) \\\n  usb_find_host_endpoint(dev, PIPE_INTERRUPT, (endpoint) | USB_DIR_IN)\n\n/*\n * The following structure is used to extend \"struct urb\" when we are\n * dealing with an isochronous endpoint. It contains information about\n * the data offset and data length of an isochronous packet.\n * The \"actual_length\" field is updated before the \"complete\"\n * callback in the \"urb\" structure is called.\n */\nstruct usb_iso_packet_descriptor {\n\tuint32_t offset;\t\t/* depreciated buffer offset (the\n\t\t\t\t\t * packets are usually back to back) */\n\tuint16_t length;\t\t/* expected length */\n\tuint16_t actual_length;\n\t int16_t status;\t\t/* transfer status */\n};\n\n/*\n * The following structure holds various information about an USB\n * transfer. This structure is used for all kinds of USB transfers.\n *\n * URB is short for USB Request Block.\n */\nstruct urb {\n\tTAILQ_ENTRY(urb) bsd_urb_list;\n\tstruct cv cv_wait;\n\n\tstruct usb_device *dev;\t\t/* (in) pointer to associated device */\n\tstruct usb_host_endpoint *endpoint;\t/* (in) pipe pointer */\n\tuint8_t *setup_packet;\t\t/* (in) setup packet (control only) */\n\tuint8_t *bsd_data_ptr;\n\tvoid   *transfer_buffer;\t/* (in) associated data buffer */\n\tvoid   *context;\t\t/* (in) context for completion */\n\tusb_complete_t *complete;\t/* (in) completion routine */\n\n\tusb_size_t transfer_buffer_length;/* (in) data buffer length */\n\tusb_size_t bsd_length_rem;\n\tusb_size_t actual_length;\t/* (return) actual transfer length */\n\tusb_timeout_t timeout;\t\t/* FreeBSD specific */\n\n\tuint16_t transfer_flags;\t/* (in) */\n#define\tURB_SHORT_NOT_OK\t0x0001\t/* report short transfers like errors */\n#define\tURB_ISO_ASAP\t\t0x0002\t/* ignore \"start_frame\" field */\n#define\tURB_ZERO_PACKET\t\t0x0004\t/* the USB transfer ends with a short\n\t\t\t\t\t * packet */\n#define\tURB_NO_TRANSFER_DMA_MAP 0x0008\t/* \"transfer_dma\" is valid on submit */\n#define\tURB_WAIT_WAKEUP\t\t0x0010\t/* custom flags */\n#define\tURB_IS_SLEEPING\t\t0x0020\t/* custom flags */\n\n\tusb_frcount_t start_frame;\t/* (modify) start frame (ISO) */\n\tusb_frcount_t number_of_packets;\t/* (in) number of ISO packets */\n\tuint16_t interval;\t\t/* (modify) transfer interval\n\t\t\t\t\t * (INT/ISO) */\n\tuint16_t error_count;\t\t/* (return) number of ISO errors */\n\tint16_t\tstatus;\t\t\t/* (return) status */\n\n\tuint8_t\tsetup_dma;\t\t/* (in) not used on FreeBSD */\n\tuint8_t\ttransfer_dma;\t\t/* (in) not used on FreeBSD */\n\tuint8_t\tbsd_isread;\n\tuint8_t kill_count;\t\t/* FreeBSD specific */\n\n\tstruct usb_iso_packet_descriptor iso_frame_desc[];\t/* (in) ISO ONLY */\n};\n\n/* various prototypes */\n\nint\tusb_submit_urb(struct urb *urb, uint16_t mem_flags);\nint\tusb_unlink_urb(struct urb *urb);\nint\tusb_clear_halt(struct usb_device *dev, struct usb_host_endpoint *uhe);\nint\tusb_control_msg(struct usb_device *dev, struct usb_host_endpoint *ep,\n\t    uint8_t request, uint8_t requesttype, uint16_t value,\n\t    uint16_t index, void *data, uint16_t size, usb_timeout_t timeout);\nint\tusb_set_interface(struct usb_device *dev, uint8_t ifnum,\n\t    uint8_t alternate);\nint\tusb_setup_endpoint(struct usb_device *dev,\n\t    struct usb_host_endpoint *uhe, usb_frlength_t bufsize);\n\nstruct usb_host_endpoint *usb_find_host_endpoint(struct usb_device *dev,\n\t    uint8_t type, uint8_t ep);\nstruct urb *usb_alloc_urb(uint16_t iso_packets, uint16_t mem_flags);\nstruct usb_host_interface *usb_altnum_to_altsetting(\n\t    const struct usb_interface *intf, uint8_t alt_index);\nstruct usb_interface *usb_ifnum_to_if(struct usb_device *dev, uint8_t iface_no);\n\nvoid   *usb_buffer_alloc(struct usb_device *dev, usb_size_t size,\n\t    uint16_t mem_flags, uint8_t *dma_addr);\nvoid   *usbd_get_intfdata(struct usb_interface *intf);\n\nvoid\tusb_buffer_free(struct usb_device *dev, usb_size_t size, void *addr, uint8_t dma_addr);\nvoid\tusb_free_urb(struct urb *urb);\nvoid\tusb_init_urb(struct urb *urb);\nvoid\tusb_kill_urb(struct urb *urb);\nvoid\tusb_set_intfdata(struct usb_interface *intf, void *data);\nvoid\tusb_linux_register(void *arg);\nvoid\tusb_linux_deregister(void *arg);\n\nvoid\tusb_fill_bulk_urb(struct urb *, struct usb_device *,\n\t    struct usb_host_endpoint *, void *, int, usb_complete_t, void *);\nint\tusb_bulk_msg(struct usb_device *, struct usb_host_endpoint *,\n\t    void *, int, uint16_t *, usb_timeout_t);\n\n#define\tinterface_to_usbdev(intf) (intf)->linux_udev\n#define\tinterface_to_bsddev(intf) (intf)->linux_udev\n\n#endif\t\t\t\t\t/* _USB_COMPAT_LINUX_H */\n"
  },
  {
    "path": "freebsd-headers/dev/usb/usb_controller.h",
    "content": "/* $FreeBSD: release/9.0.0/sys/dev/usb/usb_controller.h 215846 2010-11-25 22:56:26Z weongyo $ */\n/*-\n * Copyright (c) 2008 Hans Petter Selasky. All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n */\n\n#ifndef _USB_CONTROLLER_H_\n#define\t_USB_CONTROLLER_H_\n\n/* defines */\n\n#define\tUSB_BUS_DMA_TAG_MAX 8\n\n/* structure prototypes  */\n\nstruct usb_bus;\nstruct usb_page;\nstruct usb_endpoint;\nstruct usb_page_cache;\nstruct usb_setup_params;\nstruct usb_hw_ep_profile;\nstruct usb_fs_isoc_schedule;\nstruct usb_config_descriptor;\nstruct usb_endpoint_descriptor;\n\n/* typedefs */\n\ntypedef void (usb_bus_mem_sub_cb_t)(struct usb_bus *bus, struct usb_page_cache *pc, struct usb_page *pg, usb_size_t size, usb_size_t align);\ntypedef void (usb_bus_mem_cb_t)(struct usb_bus *bus, usb_bus_mem_sub_cb_t *scb);\n\n/*\n * The following structure is used to define all the USB BUS\n * callbacks.\n */\nstruct usb_bus_methods {\n\n\t/* USB Device and Host mode - Mandatory */\n\n\tusb_handle_req_t *roothub_exec;\n\n\tvoid    (*endpoint_init) (struct usb_device *,\n\t\t    struct usb_endpoint_descriptor *, struct usb_endpoint *);\n\tvoid    (*xfer_setup) (struct usb_setup_params *);\n\tvoid    (*xfer_unsetup) (struct usb_xfer *);\n\tvoid    (*get_dma_delay) (struct usb_device *, uint32_t *);\n\tvoid    (*device_suspend) (struct usb_device *);\n\tvoid    (*device_resume) (struct usb_device *);\n\tvoid    (*set_hw_power) (struct usb_bus *);\n\n\t/*\n\t * The following flag is set if one or more control transfers are\n\t * active:\n\t */\n#define\tUSB_HW_POWER_CONTROL\t0x01\n\t/*\n\t * The following flag is set if one or more bulk transfers are\n\t * active:\n\t */\n#define\tUSB_HW_POWER_BULK\t0x02\n\t/*\n\t * The following flag is set if one or more interrupt transfers are\n\t * active:\n\t */\n#define\tUSB_HW_POWER_INTERRUPT\t0x04\n\t/*\n\t * The following flag is set if one or more isochronous transfers\n\t * are active:\n\t */\n#define\tUSB_HW_POWER_ISOC\t0x08\n\t/*\n\t * The following flag is set if one or more non-root-HUB devices \n\t * are present on the given USB bus:\n\t */\n#define\tUSB_HW_POWER_NON_ROOT_HUB 0x10\n\n\t/* USB Device mode only - Mandatory */\n\n\tvoid    (*get_hw_ep_profile) (struct usb_device *udev, const struct usb_hw_ep_profile **ppf, uint8_t ep_addr);\n\tvoid    (*set_stall) (struct usb_device *udev, struct usb_xfer *xfer, struct usb_endpoint *ep, uint8_t *did_stall);\n\n\t/* USB Device mode mandatory. USB Host mode optional. */\n\n\tvoid    (*clear_stall) (struct usb_device *udev, struct usb_endpoint *ep);\n\n\t/* Optional transfer polling support */\n\n\tvoid\t(*xfer_poll) (struct usb_bus *);\n\n\t/* Optional fixed power mode support */\n\n\tvoid\t(*get_power_mode) (struct usb_device *udev, int8_t *pmode);\n\n\t/* Optional endpoint uninit */\n\n\tvoid    (*endpoint_uninit) (struct usb_device *, struct usb_endpoint *);\n\n\t/* Optional device init */\n\n\tusb_error_t\t(*device_init) (struct usb_device *);\n\n\t/* Optional device uninit */\n\n\tvoid\t(*device_uninit) (struct usb_device *);\n\n\t/* Optional for device and host mode */\n\n\tvoid\t(*start_dma_delay) (struct usb_xfer *);\n\n\tvoid\t(*device_state_change) (struct usb_device *);\n\n\t/* Optional for host mode */\n\n\tusb_error_t\t(*set_address) (struct usb_device *, struct mtx *, uint16_t);\n};\n\n/*\n * The following structure is used to define all the USB pipe\n * callbacks.\n */\nstruct usb_pipe_methods {\n\n\t/* Mandatory USB Device and Host mode callbacks: */\n\n\tvoid\t(*open)(struct usb_xfer *);\n\tvoid\t(*close)(struct usb_xfer *);\n\n\tvoid\t(*enter)(struct usb_xfer *);\n\tvoid\t(*start)(struct usb_xfer *);\n\n\t/* Optional */\n\n\tvoid   *info;\n};\n\n/*\n * The following structure keeps information about what a hardware USB\n * endpoint supports.\n */\nstruct usb_hw_ep_profile {\n\tuint16_t max_in_frame_size;\t/* IN-token direction */\n\tuint16_t max_out_frame_size;\t/* OUT-token direction */\n\tuint8_t\tis_simplex:1;\n\tuint8_t\tsupport_multi_buffer:1;\n\tuint8_t\tsupport_bulk:1;\n\tuint8_t\tsupport_control:1;\n\tuint8_t\tsupport_interrupt:1;\n\tuint8_t\tsupport_isochronous:1;\n\tuint8_t\tsupport_in:1;\t\t/* IN-token is supported */\n\tuint8_t\tsupport_out:1;\t\t/* OUT-token is supported */\n};\n\n/*\n * The following structure is used when trying to allocate hardware\n * endpoints for an USB configuration in USB device side mode.\n */\nstruct usb_hw_ep_scratch_sub {\n\tconst struct usb_hw_ep_profile *pf;\n\tuint16_t max_frame_size;\n\tuint8_t\thw_endpoint_out;\n\tuint8_t\thw_endpoint_in;\n\tuint8_t\tneeds_ep_type;\n\tuint8_t\tneeds_in:1;\n\tuint8_t\tneeds_out:1;\n};\n\n/*\n * The following structure is used when trying to allocate hardware\n * endpoints for an USB configuration in USB device side mode.\n */\nstruct usb_hw_ep_scratch {\n\tstruct usb_hw_ep_scratch_sub ep[USB_EP_MAX];\n\tstruct usb_hw_ep_scratch_sub *ep_max;\n\tstruct usb_config_descriptor *cd;\n\tstruct usb_device *udev;\n\tstruct usb_bus_methods *methods;\n\tuint8_t\tbmOutAlloc[(USB_EP_MAX + 15) / 16];\n\tuint8_t\tbmInAlloc[(USB_EP_MAX + 15) / 16];\n};\n\n/*\n * The following structure is used when generating USB descriptors\n * from USB templates.\n */\nstruct usb_temp_setup {\n\tvoid   *buf;\n\tusb_size_t size;\n\tenum usb_dev_speed\tusb_speed;\n\tuint8_t\tself_powered;\n\tuint8_t\tbNumEndpoints;\n\tuint8_t\tbInterfaceNumber;\n\tuint8_t\tbAlternateSetting;\n\tuint8_t\tbConfigurationValue;\n\tusb_error_t err;\n};\n\n/* prototypes */\n\nvoid\tusb_bus_mem_flush_all(struct usb_bus *bus, usb_bus_mem_cb_t *cb);\nuint8_t\tusb_bus_mem_alloc_all(struct usb_bus *bus, bus_dma_tag_t dmat, usb_bus_mem_cb_t *cb);\nvoid\tusb_bus_mem_free_all(struct usb_bus *bus, usb_bus_mem_cb_t *cb);\nuint16_t usb_isoc_time_expand(struct usb_bus *bus, uint16_t isoc_time_curr);\nuint16_t usbd_fs_isoc_schedule_isoc_time_expand(struct usb_device *udev, struct usb_fs_isoc_schedule **pp_start, struct usb_fs_isoc_schedule **pp_end, uint16_t isoc_time);\nuint8_t\tusbd_fs_isoc_schedule_alloc(struct usb_fs_isoc_schedule *fss, uint8_t *pstart, uint16_t len);\n\n#endif\t\t\t\t\t/* _USB_CONTROLLER_H_ */\n"
  },
  {
    "path": "freebsd-headers/dev/usb/usb_core.h",
    "content": "/* $FreeBSD: release/9.0.0/sys/dev/usb/usb_core.h 199672 2009-11-22 21:16:43Z thompsa $ */\n/*-\n * Copyright (c) 2008 Hans Petter Selasky. All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n */\n\n/*\n * Including this file is mandatory for all USB related c-files in the kernel.\n */\n\n#ifndef _USB_CORE_H_\n#define\t_USB_CORE_H_\n\n/*\n * The following macro will tell if an USB transfer is currently\n * receiving or transferring data.\n */\n#define\tUSB_GET_DATA_ISREAD(xfer) ((xfer)->flags_int.usb_mode == \\\n\tUSB_MODE_DEVICE ? (((xfer)->endpointno & UE_DIR_IN) ? 0 : 1) : \\\n\t(((xfer)->endpointno & UE_DIR_IN) ? 1 : 0))\n\n/* macros */\n\n#define\tUSB_BUS_LOCK(_b)\t\tmtx_lock(&(_b)->bus_mtx)\n#define\tUSB_BUS_UNLOCK(_b)\t\tmtx_unlock(&(_b)->bus_mtx)\n#define\tUSB_BUS_LOCK_ASSERT(_b, _t)\tmtx_assert(&(_b)->bus_mtx, _t)\n#define\tUSB_XFER_LOCK(_x)\t\tmtx_lock((_x)->xroot->xfer_mtx)\n#define\tUSB_XFER_UNLOCK(_x)\t\tmtx_unlock((_x)->xroot->xfer_mtx)\n#define\tUSB_XFER_LOCK_ASSERT(_x, _t)\tmtx_assert((_x)->xroot->xfer_mtx, _t)\n\n/* helper for converting pointers to integers */\n#define\tUSB_P2U(ptr) \\\n  (((const uint8_t *)(ptr)) - ((const uint8_t *)0))\n\n/* helper for computing offsets */\n#define\tUSB_ADD_BYTES(ptr,size) \\\n  ((void *)(USB_P2U(ptr) + (size)))\n\n/* debug macro */\n#define\tUSB_ASSERT KASSERT\n\n/* structure prototypes */\n\nstruct file;\nstruct usb_bus;\nstruct usb_device;\nstruct usb_device_request;\nstruct usb_page;\nstruct usb_page_cache;\nstruct usb_xfer;\nstruct usb_xfer_root;\n\n/* typedefs */\n\n/* structures */\n\n/*\n * The following structure defines a set of internal USB transfer\n * flags.\n */\nstruct usb_xfer_flags_int {\n\n\tenum usb_hc_mode usb_mode;\t/* shadow copy of \"udev->usb_mode\" */\n\tuint16_t control_rem;\t\t/* remainder in bytes */\n\n\tuint8_t\topen:1;\t\t\t/* set if USB pipe has been opened */\n\tuint8_t\ttransferring:1;\t\t/* set if an USB transfer is in\n\t\t\t\t\t * progress */\n\tuint8_t\tdid_dma_delay:1;\t/* set if we waited for HW DMA */\n\tuint8_t\tdid_close:1;\t\t/* set if we closed the USB transfer */\n\tuint8_t\tdraining:1;\t\t/* set if we are draining an USB\n\t\t\t\t\t * transfer */\n\tuint8_t\tstarted:1;\t\t/* keeps track of started or stopped */\n\tuint8_t\tbandwidth_reclaimed:1;\n\tuint8_t\tcontrol_xfr:1;\t\t/* set if control transfer */\n\tuint8_t\tcontrol_hdr:1;\t\t/* set if control header should be\n\t\t\t\t\t * sent */\n\tuint8_t\tcontrol_act:1;\t\t/* set if control transfer is active */\n\tuint8_t\tcontrol_stall:1;\t/* set if control transfer should be stalled */\n\n\tuint8_t\tshort_frames_ok:1;\t/* filtered version */\n\tuint8_t\tshort_xfer_ok:1;\t/* filtered version */\n#if USB_HAVE_BUSDMA\n\tuint8_t\tbdma_enable:1;\t\t/* filtered version (only set if\n\t\t\t\t\t * hardware supports DMA) */\n\tuint8_t\tbdma_no_post_sync:1;\t/* set if the USB callback wrapper\n\t\t\t\t\t * should not do the BUS-DMA post sync\n\t\t\t\t\t * operation */\n\tuint8_t\tbdma_setup:1;\t\t/* set if BUS-DMA has been setup */\n#endif\n\tuint8_t\tisochronous_xfr:1;\t/* set if isochronous transfer */\n\tuint8_t\tcurr_dma_set:1;\t\t/* used by USB HC/DC driver */\n\tuint8_t\tcan_cancel_immed:1;\t/* set if USB transfer can be\n\t\t\t\t\t * cancelled immediately */\n\tuint8_t\tdoing_callback:1;\t/* set if executing the callback */\n};\n\n/*\n * The following structure defines an USB transfer.\n */\nstruct usb_xfer {\n\tstruct usb_callout timeout_handle;\n\tTAILQ_ENTRY(usb_xfer) wait_entry;\t/* used at various places */\n\n\tstruct usb_page_cache *buf_fixup;\t/* fixup buffer(s) */\n\tstruct usb_xfer_queue *wait_queue;\t/* pointer to queue that we\n\t\t\t\t\t\t * are waiting on */\n\tstruct usb_page *dma_page_ptr;\n\tstruct usb_endpoint *endpoint;\t/* our USB endpoint */\n\tstruct usb_xfer_root *xroot;\t/* used by HC driver */\n\tvoid   *qh_start[2];\t\t/* used by HC driver */\n\tvoid   *td_start[2];\t\t/* used by HC driver */\n\tvoid   *td_transfer_first;\t/* used by HC driver */\n\tvoid   *td_transfer_last;\t/* used by HC driver */\n\tvoid   *td_transfer_cache;\t/* used by HC driver */\n\tvoid   *priv_sc;\t\t/* device driver data pointer 1 */\n\tvoid   *priv_fifo;\t\t/* device driver data pointer 2 */\n\tvoid   *local_buffer;\n\tusb_frlength_t *frlengths;\n\tstruct usb_page_cache *frbuffers;\n\tusb_callback_t *callback;\n\n\tusb_frlength_t max_hc_frame_size;\n\tusb_frlength_t max_data_length;\n\tusb_frlength_t sumlen;\t\t/* sum of all lengths in bytes */\n\tusb_frlength_t actlen;\t\t/* actual length in bytes */\n\tusb_timeout_t timeout;\t\t/* milliseconds */\n\n\tusb_frcount_t max_frame_count;\t/* initial value of \"nframes\" after\n\t\t\t\t\t * setup */\n\tusb_frcount_t nframes;\t\t/* number of USB frames to transfer */\n\tusb_frcount_t aframes;\t\t/* actual number of USB frames\n\t\t\t\t\t * transferred */\n\n\tuint16_t max_packet_size;\n\tuint16_t max_frame_size;\n\tuint16_t qh_pos;\n\tuint16_t isoc_time_complete;\t/* in ms */\n\tusb_timeout_t interval;\t/* milliseconds */\n\n\tuint8_t\taddress;\t\t/* physical USB address */\n\tuint8_t\tendpointno;\t\t/* physical USB endpoint */\n\tuint8_t\tmax_packet_count;\n\tuint8_t\tusb_state;\n\tuint8_t fps_shift;\t\t/* down shift of FPS, 0..3 */\n\n\tusb_error_t error;\n\n\tstruct usb_xfer_flags flags;\n\tstruct usb_xfer_flags_int flags_int;\n};\n\n/* external variables */\n\nextern struct mtx usb_ref_lock;\n\n/* typedefs */\n\ntypedef struct malloc_type *usb_malloc_type;\n\n/* prototypes */\n\n#endif\t\t\t\t\t/* _USB_CORE_H_ */\n"
  },
  {
    "path": "freebsd-headers/dev/usb/usb_debug.h",
    "content": "/* $FreeBSD: release/9.0.0/sys/dev/usb/usb_debug.h 207077 2010-04-22 21:31:34Z thompsa $ */\n/*-\n * Copyright (c) 2008 Hans Petter Selasky. All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n */\n\n/* This file contains various factored out debug macros. */\n\n#ifndef _USB_DEBUG_H_\n#define\t_USB_DEBUG_H_\n\n/* Declare global USB debug variable. */\nextern int usb_debug;\n\n/* Check if USB debugging is enabled. */\n#ifdef USB_DEBUG_VAR\n#ifdef USB_DEBUG\n#define\tDPRINTFN(n,fmt,...) do {\t\t\\\n  if ((USB_DEBUG_VAR) >= (n)) {\t\t\t\\\n    printf(\"%s: \" fmt,\t\t\t\t\\\n\t   __FUNCTION__,## __VA_ARGS__);\t\\\n  }\t\t\t\t\t\t\\\n} while (0)\n#define\tDPRINTF(...)\tDPRINTFN(1, __VA_ARGS__)\n#else\n#define\tDPRINTF(...) do { } while (0)\n#define\tDPRINTFN(...) do { } while (0)\n#endif\n#endif\n\nstruct usb_interface;\nstruct usb_device;\nstruct usb_endpoint;\nstruct usb_xfer;\n\nvoid\tusb_dump_iface(struct usb_interface *iface);\nvoid\tusb_dump_device(struct usb_device *udev);\nvoid\tusb_dump_queue(struct usb_endpoint *ep);\nvoid\tusb_dump_endpoint(struct usb_endpoint *ep);\nvoid\tusb_dump_xfer(struct usb_xfer *xfer);\n\n#endif\t\t\t\t\t/* _USB_DEBUG_H_ */\n"
  },
  {
    "path": "freebsd-headers/dev/usb/usb_dev.h",
    "content": "/* $FreeBSD: release/9.0.0/sys/dev/usb/usb_dev.h 196219 2009-08-14 20:03:53Z jhb $ */\n/*-\n * Copyright (c) 2008 Hans Petter Selasky. All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n */\n\n#ifndef _USB_DEV_H_\n#define\t_USB_DEV_H_\n\n#include <sys/file.h>\n#include <sys/selinfo.h>\n#include <sys/poll.h>\n#include <sys/signalvar.h>\n#include <sys/proc.h>\n\nstruct usb_fifo;\nstruct usb_mbuf;\n\nstruct usb_symlink {\n\tTAILQ_ENTRY(usb_symlink) sym_entry;\n\tchar\tsrc_path[32];\t\t/* Source path - including terminating\n\t\t\t\t\t * zero */\n\tchar\tdst_path[32];\t\t/* Destination path - including\n\t\t\t\t\t * terminating zero */\n\tuint8_t\tsrc_len;\t\t/* String length */\n\tuint8_t\tdst_len;\t\t/* String length */\n};\n\n/*\n * Private per-device information.\n */\nstruct usb_cdev_privdata {\n\tstruct usb_bus\t\t*bus;\n\tstruct usb_device\t*udev;\n\tstruct usb_interface\t*iface;\n\tint\t\t\tbus_index;\t/* bus index */\n\tint\t\t\tdev_index;\t/* device index */\n\tint\t\t\tep_addr;\t/* endpoint address */\n\tint\t\t\tfflags;\n\tuint8_t\t\t\tfifo_index;\t/* FIFO index */\n};\n\n/*\n * The following structure defines a minimum re-implementation of the\n * ifqueue structure in the kernel.\n */\nstruct usb_ifqueue {\n\tstruct usb_mbuf *ifq_head;\n\tstruct usb_mbuf *ifq_tail;\n\n\tusb_size_t ifq_len;\n\tusb_size_t ifq_maxlen;\n};\n\n/*\n * Private per-device and per-thread reference information\n */\nstruct usb_cdev_refdata {\n\tstruct usb_fifo\t\t*rxfifo;\n\tstruct usb_fifo\t\t*txfifo;\n\tuint8_t\t\t\tis_read;\t/* location has read access */\n\tuint8_t\t\t\tis_write;\t/* location has write access */\n\tuint8_t\t\t\tis_uref;\t/* USB refcount decr. needed */\n\tuint8_t\t\t\tis_usbfs;\t/* USB-FS is active */\n};\n\nstruct usb_fs_privdata {\n\tint bus_index;\n\tint dev_index;\n\tint ep_addr;\n\tint mode;\n\tint fifo_index;\n\tstruct cdev *cdev;\n\n\tLIST_ENTRY(usb_fs_privdata) pd_next;\n};\n\n/*\n * Most of the fields in the \"usb_fifo\" structure are used by the\n * generic USB access layer.\n */\nstruct usb_fifo {\n\tstruct usb_ifqueue free_q;\n\tstruct usb_ifqueue used_q;\n\tstruct selinfo selinfo;\n\tstruct cv cv_io;\n\tstruct cv cv_drain;\n\tstruct usb_fifo_methods *methods;\n\tstruct usb_symlink *symlink[2];/* our symlinks */\n\tstruct proc *async_p;\t\t/* process that wants SIGIO */\n\tstruct usb_fs_endpoint *fs_ep_ptr;\n\tstruct usb_device *udev;\n\tstruct usb_xfer *xfer[2];\n\tstruct usb_xfer **fs_xfer;\n\tstruct mtx *priv_mtx;\t\t/* client data */\n\t/* set if FIFO is opened by a FILE: */\n\tstruct usb_cdev_privdata *curr_cpd;\n\tvoid   *priv_sc0;\t\t/* client data */\n\tvoid   *priv_sc1;\t\t/* client data */\n\tvoid   *queue_data;\n\tusb_timeout_t timeout;\t\t/* timeout in milliseconds */\n\tusb_frlength_t bufsize;\t\t/* BULK and INTERRUPT buffer size */\n\tusb_frcount_t nframes;\t\t/* for isochronous mode */\n\tuint16_t dev_ep_index;\t\t/* our device endpoint index */\n\tuint8_t\tflag_sleeping;\t\t/* set if FIFO is sleeping */\n\tuint8_t\tflag_iscomplete;\t/* set if a USB transfer is complete */\n\tuint8_t\tflag_iserror;\t\t/* set if FIFO error happened */\n\tuint8_t\tflag_isselect;\t\t/* set if FIFO is selected */\n\tuint8_t\tflag_flushing;\t\t/* set if FIFO is flushing data */\n\tuint8_t\tflag_short;\t\t/* set if short_ok or force_short\n\t\t\t\t\t * transfer flags should be set */\n\tuint8_t\tflag_stall;\t\t/* set if clear stall should be run */\n\tuint8_t\tflag_write_defrag;\t/* set to defrag written data */\n\tuint8_t\tflag_have_fragment;\t/* set if defragging */\n\tuint8_t\tiface_index;\t\t/* set to the interface we belong to */\n\tuint8_t\tfifo_index;\t\t/* set to the FIFO index in \"struct\n\t\t\t\t\t * usb_device\" */\n\tuint8_t\tfs_ep_max;\n\tuint8_t\tfifo_zlp;\t\t/* zero length packet count */\n\tuint8_t\trefcount;\n#define\tUSB_FIFO_REF_MAX 0xFF\n};\n\nextern struct cdevsw usb_devsw;\n\nint\tusb_fifo_wait(struct usb_fifo *fifo);\nvoid\tusb_fifo_signal(struct usb_fifo *fifo);\nuint8_t\tusb_fifo_opened(struct usb_fifo *fifo);\nstruct usb_symlink *usb_alloc_symlink(const char *target);\nvoid\tusb_free_symlink(struct usb_symlink *ps);\nint\tusb_read_symlink(uint8_t *user_ptr, uint32_t startentry,\n\t    uint32_t user_len);\n\n#endif\t\t\t\t\t/* _USB_DEV_H_ */\n"
  },
  {
    "path": "freebsd-headers/dev/usb/usb_device.h",
    "content": "/* $FreeBSD: release/9.0.0/sys/dev/usb/usb_device.h 225350 2011-09-02 18:50:44Z hselasky $ */\n/*-\n * Copyright (c) 2008 Hans Petter Selasky. All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n */\n\n#ifndef _USB_DEVICE_H_\n#define\t_USB_DEVICE_H_\n\nstruct usb_symlink;\t\t/* UGEN */\nstruct usb_device;\t\t/* linux compat */\nstruct usb_fs_privdata;\n\n#define\tUSB_CTRL_XFER_MAX 2\n\n/* \"usb_parse_config()\" commands */\n\n#define\tUSB_CFG_ALLOC 0\n#define\tUSB_CFG_FREE 1\n#define\tUSB_CFG_INIT 2\n\n/* \"usb_unconfigure()\" flags */\n\n#define\tUSB_UNCFG_FLAG_NONE 0x00\n#define\tUSB_UNCFG_FLAG_FREE_EP0\t0x02\t\t/* endpoint zero is freed */\n\nstruct usb_clear_stall_msg {\n\tstruct usb_proc_msg hdr;\n\tstruct usb_device *udev;\n};\n\n/* The following four structures makes up a tree, where we have the\n * leaf structure, \"usb_host_endpoint\", first, and the root structure,\n * \"usb_device\", last. The four structures below mirror the structure\n * of the USB descriptors belonging to an USB configuration. Please\n * refer to the USB specification for a definition of \"endpoints\" and\n * \"interfaces\".\n */\nstruct usb_host_endpoint {\n\tstruct usb_endpoint_descriptor desc;\n\tTAILQ_HEAD(, urb) bsd_urb_list;\n\tstruct usb_xfer *bsd_xfer[2];\n\tuint8_t *extra;\t\t\t/* Extra descriptors */\n\tusb_frlength_t fbsd_buf_size;\n\tuint16_t extralen;\n\tuint8_t\tbsd_iface_index;\n} __aligned(USB_HOST_ALIGN);\n\nstruct usb_host_interface {\n\tstruct usb_interface_descriptor desc;\n\t/* the following array has size \"desc.bNumEndpoint\" */\n\tstruct usb_host_endpoint *endpoint;\n\tconst char *string;\t\t/* iInterface string, if present */\n\tuint8_t *extra;\t\t\t/* Extra descriptors */\n\tuint16_t extralen;\n\tuint8_t\tbsd_iface_index;\n} __aligned(USB_HOST_ALIGN);\n\n/*\n * The following structure defines the USB device flags.\n */\nstruct usb_device_flags {\n\tenum usb_hc_mode usb_mode;\t/* host or device mode */\n\tuint8_t\tself_powered:1;\t\t/* set if USB device is self powered */\n\tuint8_t\tno_strings:1;\t\t/* set if USB device does not support\n\t\t\t\t\t * strings */\n\tuint8_t\tremote_wakeup:1;\t/* set if remote wakeup is enabled */\n\tuint8_t\tuq_bus_powered:1;\t/* set if BUS powered quirk is present */\n\n\t/*\n\t * NOTE: Although the flags below will reach the same value\n\t * over time, but the instant values may differ, and\n\t * consequently the flags cannot be merged into one!\n\t */\n\tuint8_t peer_suspended:1;\t/* set if peer is suspended */\n\tuint8_t self_suspended:1;\t/* set if self is suspended */\n};\n\n/*\n * The following structure is used for power-save purposes. The data\n * in this structure is protected by the USB BUS lock.\n */\nstruct usb_power_save {\n\tusb_ticks_t last_xfer_time;\t/* copy of \"ticks\" */\n\tusb_size_t type_refs[4];\t/* transfer reference count */\n\tusb_size_t read_refs;\t\t/* data read references */\n\tusb_size_t write_refs;\t\t/* data write references */\n};\n\n/*\n * The following structure defines an USB device. There exists one of\n * these structures for every USB device.\n */\nstruct usb_device {\n\tstruct usb_clear_stall_msg cs_msg[2];\t/* generic clear stall\n\t\t\t\t\t\t * messages */\n\tstruct sx ctrl_sx;\n\tstruct sx enum_sx;\n\tstruct sx sr_sx;\n\tstruct mtx device_mtx;\n\tstruct cv ctrlreq_cv;\n\tstruct cv ref_cv;\n\tstruct usb_interface *ifaces;\n\tstruct usb_endpoint ctrl_ep;\t/* Control Endpoint 0 */\n\tstruct usb_endpoint *endpoints;\n\tstruct usb_power_save pwr_save;/* power save data */\n\tstruct usb_bus *bus;\t\t/* our USB BUS */\n\tdevice_t parent_dev;\t\t/* parent device */\n\tstruct usb_device *parent_hub;\n\tstruct usb_device *parent_hs_hub;\t/* high-speed parent HUB */\n\tstruct usb_config_descriptor *cdesc;\t/* full config descr */\n\tstruct usb_hub *hub;\t\t/* only if this is a hub */\n\tstruct usb_xfer *ctrl_xfer[USB_CTRL_XFER_MAX];\n\tstruct usb_temp_data *usb_template_ptr;\n\tstruct usb_endpoint *ep_curr;\t/* current clear stall endpoint */\n#if USB_HAVE_UGEN\n\tstruct usb_fifo *fifo[USB_FIFO_MAX];\n\tstruct usb_symlink *ugen_symlink;\t/* our generic symlink */\n\tstruct usb_fs_privdata *ctrl_dev;\t/* Control Endpoint 0 device node */\n\tLIST_HEAD(,usb_fs_privdata) pd_list;\n\tchar\tugen_name[20];\t\t/* name of ugenX.X device */\n#endif\n\tusb_ticks_t plugtime;\t\t/* copy of \"ticks\" */\n\n\tenum usb_dev_state state;\n\tenum usb_dev_speed speed;\n\tuint16_t refcount;\n#define\tUSB_DEV_REF_MAX 0xffff\n\n\tuint16_t power;\t\t\t/* mA the device uses */\n\tuint16_t langid;\t\t/* language for strings */\n\tuint16_t autoQuirk[USB_MAX_AUTO_QUIRK];\t\t/* dynamic quirks */\n\n\tuint8_t\taddress;\t\t/* device addess */\n\tuint8_t\tdevice_index;\t\t/* device index in \"bus->devices\" */\n\tuint8_t\tcontroller_slot_id;\t/* controller specific value */\n\tuint8_t\tcurr_config_index;\t/* current configuration index */\n\tuint8_t\tcurr_config_no;\t\t/* current configuration number */\n\tuint8_t\tdepth;\t\t\t/* distance from root HUB */\n\tuint8_t\tport_index;\t\t/* parent HUB port index */\n\tuint8_t\tport_no;\t\t/* parent HUB port number */\n\tuint8_t\ths_hub_addr;\t\t/* high-speed HUB address */\n\tuint8_t\ths_port_no;\t\t/* high-speed HUB port number */\n\tuint8_t\tdriver_added_refcount;\t/* our driver added generation count */\n\tuint8_t\tpower_mode;\t\t/* see USB_POWER_XXX */\n\tuint8_t re_enumerate_wait;\t/* set if re-enum. is in progress */\n\tuint8_t ifaces_max;\t\t/* number of interfaces present */\n\tuint8_t endpoints_max;\t\t/* number of endpoints present */\n\n\t/* the \"flags\" field is write-protected by \"bus->mtx\" */\n\n\tstruct usb_device_flags flags;\n\n\tstruct usb_endpoint_descriptor ctrl_ep_desc;\t/* for endpoint 0 */\n\tstruct usb_endpoint_ss_comp_descriptor ctrl_ep_comp_desc;\t/* for endpoint 0 */\n\tstruct usb_device_descriptor ddesc;\t/* device descriptor */\n\n\tchar\t*serial;\t\t/* serial number, can be NULL */\n\tchar\t*manufacturer;\t\t/* manufacturer string, can be NULL */\n\tchar\t*product;\t\t/* product string, can be NULL */\n\n#if USB_HAVE_COMPAT_LINUX\n\t/* Linux compat */\n\tstruct usb_device_descriptor descriptor;\n\tstruct usb_host_endpoint ep0;\n\tstruct usb_interface *linux_iface_start;\n\tstruct usb_interface *linux_iface_end;\n\tstruct usb_host_endpoint *linux_endpoint_start;\n\tstruct usb_host_endpoint *linux_endpoint_end;\n\tuint16_t devnum;\n#endif\n\n\tuint32_t clear_stall_errors;\t/* number of clear-stall failures */\n};\n\n/* globals */\n\nextern int usb_template;\n\n/* function prototypes */\n\nconst char *usb_statestr(enum usb_dev_state state);\nstruct usb_device *usb_alloc_device(device_t parent_dev, struct usb_bus *bus,\n\t\t    struct usb_device *parent_hub, uint8_t depth,\n\t\t    uint8_t port_index, uint8_t port_no,\n\t\t    enum usb_dev_speed speed, enum usb_hc_mode mode);\n#if USB_HAVE_UGEN\nstruct usb_fs_privdata *usb_make_dev(struct usb_device *, const char *,\n\t\t    int, int, int, uid_t, gid_t, int);\nvoid\tusb_destroy_dev(struct usb_fs_privdata *);\n#endif\nusb_error_t\tusb_probe_and_attach(struct usb_device *udev,\n\t\t    uint8_t iface_index);\nvoid\t\tusb_detach_device(struct usb_device *, uint8_t, uint8_t);\nusb_error_t\tusb_reset_iface_endpoints(struct usb_device *udev,\n\t\t    uint8_t iface_index);\nusb_error_t\tusbd_set_config_index(struct usb_device *udev, uint8_t index);\nusb_error_t\tusbd_set_endpoint_stall(struct usb_device *udev,\n\t\t    struct usb_endpoint *ep, uint8_t do_stall);\nusb_error_t\tusb_suspend_resume(struct usb_device *udev,\n\t\t    uint8_t do_suspend);\nvoid\tusb_devinfo(struct usb_device *udev, char *dst_ptr, uint16_t dst_len);\nvoid\tusb_free_device(struct usb_device *, uint8_t);\nvoid\tusb_linux_free_device(struct usb_device *dev);\nuint8_t\tusb_peer_can_wakeup(struct usb_device *udev);\nstruct usb_endpoint *usb_endpoint_foreach(struct usb_device *udev, struct usb_endpoint *ep);\nvoid\tusb_set_device_state(struct usb_device *, enum usb_dev_state);\nenum usb_dev_state usb_get_device_state(struct usb_device *);\n\nvoid\tusbd_enum_lock(struct usb_device *);\nvoid\tusbd_enum_unlock(struct usb_device *);\nvoid\tusbd_sr_lock(struct usb_device *);\nvoid\tusbd_sr_unlock(struct usb_device *);\nuint8_t usbd_enum_is_locked(struct usb_device *);\n\n#endif\t\t\t\t\t/* _USB_DEVICE_H_ */\n"
  },
  {
    "path": "freebsd-headers/dev/usb/usb_dynamic.h",
    "content": "/* $FreeBSD: release/9.0.0/sys/dev/usb/usb_dynamic.h 225469 2011-09-10 15:55:36Z hselasky $ */\n/*-\n * Copyright (c) 2008 Hans Petter Selasky. All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n */\n\n#ifndef _USB_DYNAMIC_H_\n#define\t_USB_DYNAMIC_H_\n\n/* prototypes */\n\nstruct usb_device;\nstruct usbd_lookup_info;\nstruct usb_device_request;\n\n/* typedefs */\n\ntypedef usb_error_t\t(usb_temp_setup_by_index_t)(struct usb_device *udev,\n\t\t\t    uint16_t index);\ntypedef uint8_t\t\t(usb_test_quirk_t)(const struct usbd_lookup_info *info,\n\t\t\t    uint16_t quirk);\ntypedef int\t\t(usb_quirk_ioctl_t)(unsigned long cmd, caddr_t data,\n\t\t\t    int fflag, struct thread *td);\ntypedef void\t\t(usb_temp_unsetup_t)(struct usb_device *udev);\n\n/* global function pointers */\n\nextern usb_handle_req_t *usb_temp_get_desc_p;\nextern usb_temp_setup_by_index_t *usb_temp_setup_by_index_p;\nextern usb_temp_unsetup_t *usb_temp_unsetup_p;\nextern usb_test_quirk_t *usb_test_quirk_p;\nextern usb_quirk_ioctl_t *usb_quirk_ioctl_p;\nextern devclass_t usb_devclass_ptr;\n\n/* function prototypes */\n\nvoid\tusb_temp_unload(void *);\nvoid\tusb_quirk_unload(void *);\nvoid\tusb_bus_unload(void *);\n\n#endif\t\t\t\t\t/* _USB_DYNAMIC_H_ */\n"
  },
  {
    "path": "freebsd-headers/dev/usb/usb_endian.h",
    "content": "/* $FreeBSD: release/9.0.0/sys/dev/usb/usb_endian.h 196219 2009-08-14 20:03:53Z jhb $ */\n/*\n * Copyright (c) 2008 Hans Petter Selasky. All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n */\n\n#ifndef _USB_ENDIAN_H_\n#define\t_USB_ENDIAN_H_\n\n#include <sys/stdint.h>\n#include <sys/endian.h>\n\n/*\n * Declare the basic USB record types. USB records have an alignment\n * of 1 byte and are always packed.\n */\ntypedef uint8_t uByte;\ntypedef uint8_t uWord[2];\ntypedef uint8_t uDWord[4];\ntypedef uint8_t uQWord[8];\n\n/*\n * Define a set of macros that can get and set data independent of\n * CPU endianness and CPU alignment requirements:\n */\n#define\tUGETB(w)\t\t\t\\\n  ((w)[0])\n\n#define\tUGETW(w)\t\t\t\\\n  ((w)[0] |\t\t\t\t\\\n  (((uint16_t)((w)[1])) << 8))\n\n#define\tUGETDW(w)\t\t\t\\\n  ((w)[0] |\t\t\t\t\\\n  (((uint16_t)((w)[1])) << 8) |\t\t\\\n  (((uint32_t)((w)[2])) << 16) |\t\\\n  (((uint32_t)((w)[3])) << 24))\n\n#define\tUGETQW(w)\t\t\t\\\n  ((w)[0] |\t\t\t\t\\\n  (((uint16_t)((w)[1])) << 8) |\t\t\\\n  (((uint32_t)((w)[2])) << 16) |\t\\\n  (((uint32_t)((w)[3])) << 24) |\t\\\n  (((uint64_t)((w)[4])) << 32) |\t\\\n  (((uint64_t)((w)[5])) << 40) |\t\\\n  (((uint64_t)((w)[6])) << 48) |\t\\\n  (((uint64_t)((w)[7])) << 56))\n\n#define\tUSETB(w,v) do {\t\t\t\\\n  (w)[0] = (uint8_t)(v);\t\t\\\n} while (0)\n\n#define\tUSETW(w,v) do {\t\t\t\\\n  (w)[0] = (uint8_t)(v);\t\t\\\n  (w)[1] = (uint8_t)((v) >> 8);\t\t\\\n} while (0)\n\n#define\tUSETDW(w,v) do {\t\t\\\n  (w)[0] = (uint8_t)(v);\t\t\\\n  (w)[1] = (uint8_t)((v) >> 8);\t\t\\\n  (w)[2] = (uint8_t)((v) >> 16);\t\\\n  (w)[3] = (uint8_t)((v) >> 24);\t\\\n} while (0)\n\n#define\tUSETQW(w,v) do {\t\t\\\n  (w)[0] = (uint8_t)(v);\t\t\\\n  (w)[1] = (uint8_t)((v) >> 8);\t\t\\\n  (w)[2] = (uint8_t)((v) >> 16);\t\\\n  (w)[3] = (uint8_t)((v) >> 24);\t\\\n  (w)[4] = (uint8_t)((v) >> 32);\t\\\n  (w)[5] = (uint8_t)((v) >> 40);\t\\\n  (w)[6] = (uint8_t)((v) >> 48);\t\\\n  (w)[7] = (uint8_t)((v) >> 56);\t\\\n} while (0)\n\n#define\tUSETW2(w,b1,b0) do {\t\t\\\n  (w)[0] = (uint8_t)(b0);\t\t\\\n  (w)[1] = (uint8_t)(b1);\t\t\\\n} while (0)\n\n#define\tUSETW4(w,b3,b2,b1,b0) do {\t\\\n  (w)[0] = (uint8_t)(b0);\t\t\\\n  (w)[1] = (uint8_t)(b1);\t\t\\\n  (w)[2] = (uint8_t)(b2);\t\t\\\n  (w)[3] = (uint8_t)(b3);\t\t\\\n} while (0)\n\n#define\tUSETW8(w,b7,b6,b5,b4,b3,b2,b1,b0) do {\t\\\n  (w)[0] = (uint8_t)(b0);\t\t\\\n  (w)[1] = (uint8_t)(b1);\t\t\\\n  (w)[2] = (uint8_t)(b2);\t\t\\\n  (w)[3] = (uint8_t)(b3);\t\t\\\n  (w)[4] = (uint8_t)(b4);\t\t\\\n  (w)[5] = (uint8_t)(b5);\t\t\\\n  (w)[6] = (uint8_t)(b6);\t\t\\\n  (w)[7] = (uint8_t)(b7);\t\t\\\n} while (0)\n\n#endif\t\t\t\t\t/* _USB_ENDIAN_H_ */\n"
  },
  {
    "path": "freebsd-headers/dev/usb/usb_freebsd.h",
    "content": "/* $FreeBSD: release/9.0.0/sys/dev/usb/usb_freebsd.h 225350 2011-09-02 18:50:44Z hselasky $ */\n/*-\n * Copyright (c) 2008 Hans Petter Selasky. All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n */\n\n/*\n * Including this file is mandatory for all USB related c-files in the kernel.\n */\n\n#ifndef _USB_FREEBSD_H_\n#define\t_USB_FREEBSD_H_\n\n/* Default USB configuration */\n#define\tUSB_HAVE_UGEN 1\n#define\tUSB_HAVE_DEVCTL 1\n#define\tUSB_HAVE_BUSDMA 1\n#define\tUSB_HAVE_COMPAT_LINUX 1\n#define\tUSB_HAVE_USER_IO 1\n#define\tUSB_HAVE_MBUF 1\n#define\tUSB_HAVE_TT_SUPPORT 1\n#define\tUSB_HAVE_POWERD 1\n#define\tUSB_HAVE_MSCTEST 1\n#define\tUSB_HAVE_PF 1\n\n#define\tUSB_TD_GET_PROC(td) (td)->td_proc\n#define\tUSB_PROC_GET_GID(td) (td)->p_pgid\n\n#if (!defined(USB_HOST_ALIGN)) || (USB_HOST_ALIGN <= 0)\n/* Use default value. */\n#undef USB_HOST_ALIGN\n#define\tUSB_HOST_ALIGN    8\t\t/* bytes, must be power of two */\n#endif\n/* Sanity check for USB_HOST_ALIGN: Verify power of two. */\n#if ((-USB_HOST_ALIGN) & USB_HOST_ALIGN) != USB_HOST_ALIGN\n#error \"USB_HOST_ALIGN is not power of two.\"\n#endif\n#define\tUSB_FS_ISOC_UFRAME_MAX 4\t/* exclusive unit */\n#define\tUSB_BUS_MAX 256\t\t\t/* units */\n#define\tUSB_MAX_DEVICES 128\t\t/* units */\n#define\tUSB_IFACE_MAX 32\t\t/* units */\n#define\tUSB_FIFO_MAX 128\t\t/* units */\n\n#define\tUSB_MAX_FS_ISOC_FRAMES_PER_XFER (120)\t/* units */\n#define\tUSB_MAX_HS_ISOC_FRAMES_PER_XFER (8*120)\t/* units */\n\n#define\tUSB_HUB_MAX_DEPTH\t5\n#define\tUSB_EP0_BUFSIZE\t\t1024\t/* bytes */\n#define\tUSB_CS_RESET_LIMIT\t20\t/* failures = 20 * 50 ms = 1sec */\n\n#define\tUSB_MAX_AUTO_QUIRK\t4\t/* maximum number of dynamic quirks */\n\ntypedef uint32_t usb_timeout_t;\t\t/* milliseconds */\ntypedef uint32_t usb_frlength_t;\t/* bytes */\ntypedef uint32_t usb_frcount_t;\t\t/* units */\ntypedef uint32_t usb_size_t;\t\t/* bytes */\ntypedef uint32_t usb_ticks_t;\t\t/* system defined */\ntypedef uint16_t usb_power_mask_t;\t/* see \"USB_HW_POWER_XXX\" */\n\n#endif\t/* _USB_FREEBSD_H_ */\n"
  },
  {
    "path": "freebsd-headers/dev/usb/usb_generic.h",
    "content": "/* $FreeBSD: release/9.0.0/sys/dev/usb/usb_generic.h 196219 2009-08-14 20:03:53Z jhb $ */\n/*-\n * Copyright (c) 2008 Hans Petter Selasky. All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n */\n\n#ifndef _USB_GENERIC_H_\n#define\t_USB_GENERIC_H_\n\nextern struct usb_fifo_methods usb_ugen_methods;\nint\tugen_do_request(struct usb_fifo *f, struct usb_ctl_request *ur);\n\n#endif\t\t\t\t\t/* _USB_GENERIC_H_ */\n"
  },
  {
    "path": "freebsd-headers/dev/usb/usb_hub.h",
    "content": "/* $FreeBSD: release/9.0.0/sys/dev/usb/usb_hub.h 213435 2010-10-04 23:18:05Z hselasky $ */\n/*-\n * Copyright (c) 2008 Hans Petter Selasky. All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n */\n\n#ifndef _USB_HUB_H_\n#define\t_USB_HUB_H_\n\n/*\n * The following structure defines an USB port. \n */\nstruct usb_port {\n\tuint8_t\trestartcnt;\n#define\tUSB_RESTART_MAX 5\n\tuint8_t\tdevice_index;\t\t/* zero means not valid */\n\tenum usb_hc_mode usb_mode;\t/* host or device mode */\n};\n\n/*\n * The following structure defines how many bytes are\n * left in an 1ms USB time slot.\n */\nstruct usb_fs_isoc_schedule {\n\tuint16_t total_bytes;\n\tuint8_t\tframe_bytes;\n\tuint8_t\tframe_slot;\n};\n\n/*\n * The following structure defines an USB HUB.\n */\nstruct usb_hub {\n#if USB_HAVE_TT_SUPPORT\n\tstruct usb_fs_isoc_schedule fs_isoc_schedule[USB_ISOC_TIME_MAX];\n#endif\n\tstruct usb_device *hubudev;\t/* the HUB device */\n\tusb_error_t (*explore) (struct usb_device *hub);\n\tvoid   *hubsoftc;\n\tusb_size_t uframe_usage[USB_HS_MICRO_FRAMES_MAX];\n\tuint16_t portpower;\t\t/* mA per USB port */\n\tuint8_t\tisoc_last_time;\n\tuint8_t\tnports;\n\tstruct usb_port ports[0];\n};\n\n/* function prototypes */\n\nvoid\tusb_hs_bandwidth_alloc(struct usb_xfer *xfer);\nvoid\tusb_hs_bandwidth_free(struct usb_xfer *xfer);\nvoid\tusbd_fs_isoc_schedule_init_all(struct usb_fs_isoc_schedule *fss);\nvoid\tusb_bus_port_set_device(struct usb_bus *bus, struct usb_port *up,\n\t    struct usb_device *udev, uint8_t device_index);\nstruct usb_device *usb_bus_port_get_device(struct usb_bus *bus,\n\t    struct usb_port *up);\nvoid\tusb_needs_explore(struct usb_bus *bus, uint8_t do_probe);\nvoid\tusb_needs_explore_all(void);\nvoid\tusb_bus_power_update(struct usb_bus *bus);\nvoid\tusb_bus_powerd(struct usb_bus *bus);\nvoid\tuhub_root_intr(struct usb_bus *, const uint8_t *, uint8_t);\nusb_error_t uhub_query_info(struct usb_device *, uint8_t *, uint8_t *);\n\n#endif\t\t\t\t\t/* _USB_HUB_H_ */\n"
  },
  {
    "path": "freebsd-headers/dev/usb/usb_ioctl.h",
    "content": "/* $FreeBSD: release/9.0.0/sys/dev/usb/usb_ioctl.h 223467 2011-06-23 07:54:03Z hselasky $ */\n/*-\n * Copyright (c) 2008 Hans Petter Selasky. All rights reserved.\n * Copyright (c) 1998 The NetBSD Foundation, Inc. All rights reserved.\n * Copyright (c) 1998 Lennart Augustsson. All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n */\n\n#ifndef _USB_IOCTL_H_\n#define\t_USB_IOCTL_H_\n\n#include <sys/ioccom.h>\n\n/* Building \"kdump\" depends on these includes */\n\n#include <dev/usb/usb_endian.h>\n#include <dev/usb/usb.h>\n\n#define\tUSB_DEVICE_NAME \"usbctl\"\n#define\tUSB_DEVICE_DIR \"usb\"\n#define\tUSB_GENERIC_NAME \"ugen\"\n#define\tUSB_TEMPLATE_SYSCTL \"hw.usb.template\"\t/* integer type */\n\n/* Definition of valid template sysctl values */\n\nenum {\n\tUSB_TEMP_MSC,\t\t/* USB Mass Storage */\n\tUSB_TEMP_CDCE,\t\t/* USB CDC Ethernet */\n\tUSB_TEMP_MTP,\t\t/* Message Transfer Protocol */\n\tUSB_TEMP_MODEM,\t\t/* USB CDC Modem */\n\tUSB_TEMP_AUDIO,\t\t/* USB Audio */\n\tUSB_TEMP_KBD,\t\t/* USB Keyboard */\n\tUSB_TEMP_MOUSE,\t\t/* USB Mouse */\n\tUSB_TEMP_MAX,\n};\n\nstruct usb_read_dir {\n#ifdef COMPAT_32BIT\n\tuint64_t urd_data;\n#else\n\tvoid   *urd_data;\n#endif\n\tuint32_t urd_startentry;\n\tuint32_t urd_maxlen;\n};\n\nstruct usb_ctl_request {\n#ifdef COMPAT_32BIT\n\tuint64_t ucr_data;\n#else\n\tvoid   *ucr_data;\n#endif\n\tuint16_t ucr_flags;\n\tuint16_t ucr_actlen;\t\t/* actual length transferred */\n\tuint8_t\tucr_addr;\t\t/* zero - currently not used */\n\tstruct usb_device_request ucr_request;\n};\n\nstruct usb_alt_interface {\n\tuint8_t\tuai_interface_index;\n\tuint8_t\tuai_alt_index;\n};\n\nstruct usb_gen_descriptor {\n#ifdef COMPAT_32BIT\n\tuint64_t ugd_data;\n#else\n\tvoid   *ugd_data;\n#endif\n\tuint16_t ugd_lang_id;\n\tuint16_t ugd_maxlen;\n\tuint16_t ugd_actlen;\n\tuint16_t ugd_offset;\n\tuint8_t\tugd_config_index;\n\tuint8_t\tugd_string_index;\n\tuint8_t\tugd_iface_index;\n\tuint8_t\tugd_altif_index;\n\tuint8_t\tugd_endpt_index;\n\tuint8_t\tugd_report_type;\n\tuint8_t\treserved[8];\n};\n\nstruct usb_device_info {\n\tuint16_t udi_productNo;\n\tuint16_t udi_vendorNo;\n\tuint16_t udi_releaseNo;\n\tuint16_t udi_power;\t\t/* power consumption in mA, 0 if\n\t\t\t\t\t * selfpowered */\n\tuint8_t\tudi_bus;\n\tuint8_t\tudi_addr;\t\t/* device address */\n\tuint8_t\tudi_index;\t\t/* device index */\n\tuint8_t\tudi_class;\n\tuint8_t\tudi_subclass;\n\tuint8_t\tudi_protocol;\n\tuint8_t\tudi_config_no;\t\t/* current config number */\n\tuint8_t\tudi_config_index;\t/* current config index */\n\tuint8_t\tudi_speed;\t\t/* see \"USB_SPEED_XXX\" */\n\tuint8_t\tudi_mode;\t\t/* see \"USB_MODE_XXX\" */\n\tuint8_t\tudi_nports;\n\tuint8_t\tudi_hubaddr;\t\t/* parent HUB address */\n\tuint8_t\tudi_hubindex;\t\t/* parent HUB device index */\n\tuint8_t\tudi_hubport;\t\t/* parent HUB port */\n\tuint8_t\tudi_power_mode;\t\t/* see \"USB_POWER_MODE_XXX\" */\n\tuint8_t\tudi_suspended;\t\t/* set if device is suspended */\n\tuint8_t\tudi_reserved[16];\t/* leave space for the future */\n\tchar\tudi_product[128];\n\tchar\tudi_vendor[128];\n\tchar\tudi_serial[64];\n\tchar\tudi_release[8];\n};\n\nstruct usb_device_stats {\n\tuint32_t uds_requests_ok[4];\t/* Indexed by transfer type UE_XXX */\n\tuint32_t uds_requests_fail[4];\t/* Indexed by transfer type UE_XXX */\n};\n\nstruct usb_fs_start {\n\tuint8_t\tep_index;\n};\n\nstruct usb_fs_stop {\n\tuint8_t\tep_index;\n};\n\nstruct usb_fs_complete {\n\tuint8_t\tep_index;\n};\n\n/* This structure is used for all endpoint types */\nstruct usb_fs_endpoint {\n\t/*\n\t * NOTE: isochronous USB transfer only use one buffer, but can have\n\t * multiple frame lengths !\n\t */\n#ifdef COMPAT_32BIT\n\tuint64_t ppBuffer;\n\tuint64_t pLength;\n#else\n\tvoid  **ppBuffer;\t\t/* pointer to userland buffers */\n\tuint32_t *pLength;\t\t/* pointer to frame lengths, updated\n\t\t\t\t\t * to actual length */\n#endif\n\tuint32_t nFrames;\t\t/* number of frames */\n\tuint32_t aFrames;\t\t/* actual number of frames */\n\tuint16_t flags;\n\t/* a single short frame will terminate */\n#define\tUSB_FS_FLAG_SINGLE_SHORT_OK 0x0001\n\t/* multiple short frames are allowed */\n#define\tUSB_FS_FLAG_MULTI_SHORT_OK 0x0002\n\t/* all frame(s) transmitted are short terminated */\n#define\tUSB_FS_FLAG_FORCE_SHORT 0x0004\n\t/* will do a clear-stall before xfer */\n#define\tUSB_FS_FLAG_CLEAR_STALL 0x0008\n\tuint16_t timeout;\t\t/* in milliseconds */\n\t/* isocronous completion time in milliseconds - used for echo cancel */\n\tuint16_t isoc_time_complete;\n\t/* timeout value for no timeout */\n#define\tUSB_FS_TIMEOUT_NONE 0\n\tint\tstatus;\t\t\t/* see USB_ERR_XXX */\n};\n\nstruct usb_fs_init {\n\t/* userland pointer to endpoints structure */\n#ifdef COMPAT_32BIT\n\tuint64_t pEndpoints;\n#else\n\tstruct usb_fs_endpoint *pEndpoints;\n#endif\n\t/* maximum number of endpoints */\n\tuint8_t\tep_index_max;\n};\n\nstruct usb_fs_uninit {\n\tuint8_t\tdummy;\t\t\t/* zero */\n};\n\nstruct usb_fs_open {\n#define\tUSB_FS_MAX_BUFSIZE (1 << 18)\n\tuint32_t max_bufsize;\n#define\tUSB_FS_MAX_FRAMES\t\t(1U << 12)\n#define\tUSB_FS_MAX_FRAMES_PRE_SCALE\t(1U << 31)\t/* for ISOCHRONOUS transfers */\n\tuint32_t max_frames;\t\t/* read and write */\n\tuint16_t max_packet_length;\t/* read only */\n\tuint8_t\tdev_index;\t\t/* currently unused */\n\tuint8_t\tep_index;\n\tuint8_t\tep_no;\t\t\t/* bEndpointNumber */\n};\n\nstruct usb_fs_close {\n\tuint8_t\tep_index;\n};\n\nstruct usb_fs_clear_stall_sync {\n\tuint8_t\tep_index;\n};\n\nstruct usb_gen_quirk {\n\tuint16_t index;\t\t\t/* Quirk Index */\n\tuint16_t vid;\t\t\t/* Vendor ID */\n\tuint16_t pid;\t\t\t/* Product ID */\n\tuint16_t bcdDeviceLow;\t\t/* Low Device Revision */\n\tuint16_t bcdDeviceHigh;\t\t/* High Device Revision */\n\tuint16_t reserved[2];\n\t/*\n\t * String version of quirk including terminating zero. See UQ_XXX in\n\t * \"usb_quirk.h\".\n\t */\n\tchar\tquirkname[64 - 14];\n};\n\n/* USB controller */\n#define\tUSB_REQUEST\t\t_IOWR('U', 1, struct usb_ctl_request)\n#define\tUSB_SETDEBUG\t\t_IOW ('U', 2, int)\n#define\tUSB_DISCOVER\t\t_IO  ('U', 3)\n#define\tUSB_DEVICEINFO\t\t_IOWR('U', 4, struct usb_device_info)\n#define\tUSB_DEVICESTATS\t\t_IOR ('U', 5, struct usb_device_stats)\n#define\tUSB_DEVICEENUMERATE\t_IOW ('U', 6, int)\n\n/* Generic HID device */\n#define\tUSB_GET_REPORT_DESC\t_IOWR('U', 21, struct usb_gen_descriptor)\n#define\tUSB_SET_IMMED\t\t_IOW ('U', 22, int)\n#define\tUSB_GET_REPORT\t\t_IOWR('U', 23, struct usb_gen_descriptor)\n#define\tUSB_SET_REPORT\t\t_IOW ('U', 24, struct usb_gen_descriptor)\n#define\tUSB_GET_REPORT_ID\t_IOR ('U', 25, int)\n\n/* Generic USB device */\n#define\tUSB_GET_CONFIG\t\t_IOR ('U', 100, int)\n#define\tUSB_SET_CONFIG\t\t_IOW ('U', 101, int)\n#define\tUSB_GET_ALTINTERFACE\t_IOWR('U', 102, struct usb_alt_interface)\n#define\tUSB_SET_ALTINTERFACE\t_IOWR('U', 103, struct usb_alt_interface)\n#define\tUSB_GET_DEVICE_DESC\t_IOR ('U', 105, struct usb_device_descriptor)\n#define\tUSB_GET_CONFIG_DESC\t_IOR ('U', 106, struct usb_config_descriptor)\n#define\tUSB_GET_RX_INTERFACE_DESC _IOR ('U', 107, struct usb_interface_descriptor)\n#define\tUSB_GET_RX_ENDPOINT_DESC _IOR ('U', 108, struct usb_endpoint_descriptor)\n#define\tUSB_GET_FULL_DESC\t_IOWR('U', 109, struct usb_gen_descriptor)\n#define\tUSB_GET_STRING_DESC\t_IOWR('U', 110, struct usb_gen_descriptor)\n#define\tUSB_DO_REQUEST\t\t_IOWR('U', 111, struct usb_ctl_request)\n#define\tUSB_GET_DEVICEINFO\t_IOR ('U', 112, struct usb_device_info)\n#define\tUSB_SET_RX_SHORT_XFER\t_IOW ('U', 113, int)\n#define\tUSB_SET_RX_TIMEOUT\t_IOW ('U', 114, int)\n#define\tUSB_GET_RX_FRAME_SIZE\t_IOR ('U', 115, int)\n#define\tUSB_GET_RX_BUFFER_SIZE\t_IOR ('U', 117, int)\n#define\tUSB_SET_RX_BUFFER_SIZE\t_IOW ('U', 118, int)\n#define\tUSB_SET_RX_STALL_FLAG\t_IOW ('U', 119, int)\n#define\tUSB_SET_TX_STALL_FLAG\t_IOW ('U', 120, int)\n#define\tUSB_GET_IFACE_DRIVER\t_IOWR('U', 121, struct usb_gen_descriptor)\n#define\tUSB_CLAIM_INTERFACE\t_IOW ('U', 122, int)\n#define\tUSB_RELEASE_INTERFACE\t_IOW ('U', 123, int)\n#define\tUSB_IFACE_DRIVER_ACTIVE\t_IOW ('U', 124, int)\n#define\tUSB_IFACE_DRIVER_DETACH\t_IOW ('U', 125, int)\n#define\tUSB_GET_PLUGTIME\t_IOR ('U', 126, uint32_t)\n#define\tUSB_READ_DIR\t\t_IOW ('U', 127, struct usb_read_dir)\n/* 128 - 135 unused */\n#define\tUSB_SET_TX_FORCE_SHORT\t_IOW ('U', 136, int)\n#define\tUSB_SET_TX_TIMEOUT\t_IOW ('U', 137, int)\n#define\tUSB_GET_TX_FRAME_SIZE\t_IOR ('U', 138, int)\n#define\tUSB_GET_TX_BUFFER_SIZE\t_IOR ('U', 139, int)\n#define\tUSB_SET_TX_BUFFER_SIZE\t_IOW ('U', 140, int)\n#define\tUSB_GET_TX_INTERFACE_DESC _IOR ('U', 141, struct usb_interface_descriptor)\n#define\tUSB_GET_TX_ENDPOINT_DESC _IOR ('U', 142, struct usb_endpoint_descriptor)\n#define\tUSB_SET_PORT_ENABLE\t_IOW ('U', 143, int)\n#define\tUSB_SET_PORT_DISABLE\t_IOW ('U', 144, int)\n#define\tUSB_SET_POWER_MODE\t_IOW ('U', 145, int)\n#define\tUSB_GET_POWER_MODE\t_IOR ('U', 146, int)\n#define\tUSB_SET_TEMPLATE\t_IOW ('U', 147, int)\n#define\tUSB_GET_TEMPLATE\t_IOR ('U', 148, int)\n\n/* Modem device */\n#define\tUSB_GET_CM_OVER_DATA\t_IOR ('U', 180, int)\n#define\tUSB_SET_CM_OVER_DATA\t_IOW ('U', 181, int)\n\n/* USB file system interface */\n#define\tUSB_FS_START\t\t_IOW ('U', 192, struct usb_fs_start)\n#define\tUSB_FS_STOP\t\t_IOW ('U', 193, struct usb_fs_stop)\n#define\tUSB_FS_COMPLETE\t\t_IOR ('U', 194, struct usb_fs_complete)\n#define\tUSB_FS_INIT\t\t_IOW ('U', 195, struct usb_fs_init)\n#define\tUSB_FS_UNINIT\t\t_IOW ('U', 196, struct usb_fs_uninit)\n#define\tUSB_FS_OPEN\t\t_IOWR('U', 197, struct usb_fs_open)\n#define\tUSB_FS_CLOSE\t\t_IOW ('U', 198, struct usb_fs_close)\n#define\tUSB_FS_CLEAR_STALL_SYNC _IOW ('U', 199, struct usb_fs_clear_stall_sync)\n\n/* USB quirk system interface */\n#define\tUSB_DEV_QUIRK_GET\t_IOWR('Q', 0, struct usb_gen_quirk)\n#define\tUSB_QUIRK_NAME_GET\t_IOWR('Q', 1, struct usb_gen_quirk)\n#define\tUSB_DEV_QUIRK_ADD\t_IOW ('Q', 2, struct usb_gen_quirk)\n#define\tUSB_DEV_QUIRK_REMOVE\t_IOW ('Q', 3, struct usb_gen_quirk)\n\n#endif\t\t\t\t\t/* _USB_IOCTL_H_ */\n"
  },
  {
    "path": "freebsd-headers/dev/usb/usb_mbuf.h",
    "content": "/* $FreeBSD: release/9.0.0/sys/dev/usb/usb_mbuf.h 196219 2009-08-14 20:03:53Z jhb $ */\n/*-\n * Copyright (c) 2008 Hans Petter Selasky. All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n */\n\n#ifndef _USB_MBUF_H_\n#define\t_USB_MBUF_H_\n\n/*\n * The following structure defines a minimum re-implementation of the\n * mbuf system in the kernel.\n */\nstruct usb_mbuf {\n\tuint8_t *cur_data_ptr;\n\tuint8_t *min_data_ptr;\n\tstruct usb_mbuf *usb_nextpkt;\n\tstruct usb_mbuf *usb_next;\n\n\tusb_size_t cur_data_len;\n\tusb_size_t max_data_len;\n\tuint8_t last_packet:1;\n\tuint8_t unused:7;\n};\n\n#define\tUSB_IF_ENQUEUE(ifq, m) do {\t\t\\\n    (m)->usb_nextpkt = NULL;\t\t\t\\\n    if ((ifq)->ifq_tail == NULL)\t\t\\\n        (ifq)->ifq_head = (m);\t\t\t\\\n    else\t\t\t\t\t\\\n        (ifq)->ifq_tail->usb_nextpkt = (m);\t\\\n    (ifq)->ifq_tail = (m);\t\t\t\\\n    (ifq)->ifq_len++;\t\t\t\t\\\n  } while (0)\n\n#define\tUSB_IF_DEQUEUE(ifq, m) do {\t\t\t\t\\\n    (m) = (ifq)->ifq_head;\t\t\t\t\t\\\n    if (m) {\t\t\t\t\t\t\t\\\n        if (((ifq)->ifq_head = (m)->usb_nextpkt) == NULL) {\t\\\n\t     (ifq)->ifq_tail = NULL;\t\t\t\t\\\n\t}\t\t\t\t\t\t\t\\\n\t(m)->usb_nextpkt = NULL;\t\t\t\t\\\n\t(ifq)->ifq_len--;\t\t\t\t\t\\\n    }\t\t\t\t\t\t\t\t\\\n  } while (0)\n\n#define\tUSB_IF_PREPEND(ifq, m) do {\t\t\\\n      (m)->usb_nextpkt = (ifq)->ifq_head;\t\\\n      if ((ifq)->ifq_tail == NULL) {\t\t\\\n\t  (ifq)->ifq_tail = (m);\t\t\\\n      }\t\t\t\t\t\t\\\n      (ifq)->ifq_head = (m);\t\t\t\\\n      (ifq)->ifq_len++;\t\t\t\t\\\n  } while (0)\n\n#define\tUSB_IF_QFULL(ifq)   ((ifq)->ifq_len >= (ifq)->ifq_maxlen)\n#define\tUSB_IF_QLEN(ifq)    ((ifq)->ifq_len)\n#define\tUSB_IF_POLL(ifq, m) ((m) = (ifq)->ifq_head)\n\n#define\tUSB_MBUF_RESET(m) do {\t\t\t\\\n    (m)->cur_data_ptr = (m)->min_data_ptr;\t\\\n    (m)->cur_data_len = (m)->max_data_len;\t\\\n    (m)->last_packet = 0;\t\t\t\\\n  } while (0)\n\n/* prototypes */\nvoid   *usb_alloc_mbufs(struct malloc_type *type, struct usb_ifqueue *ifq,\n\t    usb_size_t block_size, uint16_t nblocks);\n\n#endif\t\t\t\t\t/* _USB_MBUF_H_ */\n"
  },
  {
    "path": "freebsd-headers/dev/usb/usb_msctest.h",
    "content": "/* $FreeBSD: release/9.0.0/sys/dev/usb/usb_msctest.h 225350 2011-09-02 18:50:44Z hselasky $ */\n/*-\n * Copyright (c) 2008 Hans Petter Selasky. All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n */\n\n#ifndef _USB_MSCTEST_H_\n#define\t_USB_MSCTEST_H_\n\nenum {\n\tMSC_EJECT_STOPUNIT,\n\tMSC_EJECT_REZERO,\n\tMSC_EJECT_ZTESTOR,\n\tMSC_EJECT_CMOTECH,\n\tMSC_EJECT_HUAWEI,\n\tMSC_EJECT_TCT,\n};\n\nint usb_iface_is_cdrom(struct usb_device *udev,\n\t    uint8_t iface_index);\nusb_error_t usb_msc_eject(struct usb_device *udev,\n\t    uint8_t iface_index, int method);\nusb_error_t usb_msc_auto_quirk(struct usb_device *udev,\n\t    uint8_t iface_index);\n\n#endif\t\t\t\t\t/* _USB_MSCTEST_H_ */\n"
  },
  {
    "path": "freebsd-headers/dev/usb/usb_pci.h",
    "content": "/* $FreeBSD: release/9.0.0/sys/dev/usb/usb_pci.h 196219 2009-08-14 20:03:53Z jhb $ */\n/*-\n * Copyright (c) 2008 Hans Petter Selasky. All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n */\n\n#ifndef _USB_PCI_H_\n#define\t_USB_PCI_H_\n\n/*\n * We don't want the following files included everywhere, that's why\n * they are in a separate file.\n */\n#include <dev/pci/pcireg.h>\n#include <dev/pci/pcivar.h>\n\n#include <sys/rman.h>\n\n#endif\t\t\t\t\t/* _USB_PCI_H_ */\n"
  },
  {
    "path": "freebsd-headers/dev/usb/usb_pf.h",
    "content": "/*-\n * Copyright (c) 1990, 1991, 1993\n *\tThe Regents of the University of California.  All rights reserved.\n *\n * This code is derived from the Stanford/CMU enet packet filter,\n * (net/enet.c) distributed as part of 4.3BSD, and code contributed\n * to Berkeley by Steven McCanne and Van Jacobson both of Lawrence\n * Berkeley Laboratory.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 4. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/dev/usb/usb_pf.h 220301 2011-04-03 20:03:45Z hselasky $\n */\n\n#ifndef _DEV_USB_PF_H\n#define\t_DEV_USB_PF_H\n\nstruct usbpf_pkthdr {\n\tuint32_t\tup_totlen;\t/* Total length including all headers */\n\tuint32_t\tup_busunit;\t/* Host controller unit number */\n\tuint8_t\t\tup_address;\t/* USB device index */\n\tuint8_t\t\tup_mode;\t/* Mode of transfer */\n#define\tUSBPF_MODE_HOST\t\t0\n#define\tUSBPF_MODE_DEVICE\t1\n\tuint8_t\t\tup_type;\t/* points SUBMIT / DONE */\n\tuint8_t\t\tup_xfertype;\t/* Transfer type, see USB2.0 spec. */\n\tuint32_t\tup_flags;\t/* Transfer flags */\n#define\tUSBPF_FLAG_FORCE_SHORT_XFER\t(1 << 0)\n#define\tUSBPF_FLAG_SHORT_XFER_OK\t(1 << 1)\n#define\tUSBPF_FLAG_SHORT_FRAMES_OK\t(1 << 2)\n#define\tUSBPF_FLAG_PIPE_BOF\t\t(1 << 3)\n#define\tUSBPF_FLAG_PROXY_BUFFER\t\t(1 << 4)\n#define\tUSBPF_FLAG_EXT_BUFFER\t\t(1 << 5)\n#define\tUSBPF_FLAG_MANUAL_STATUS\t(1 << 6)\n#define\tUSBPF_FLAG_NO_PIPE_OK\t\t(1 << 7)\n#define\tUSBPF_FLAG_STALL_PIPE\t\t(1 << 8)\n\tuint32_t\tup_status;\t/* Transfer status */\n#define\tUSBPF_STATUS_OPEN\t\t(1 << 0)\n#define\tUSBPF_STATUS_TRANSFERRING\t(1 << 1)\n#define\tUSBPF_STATUS_DID_DMA_DELAY\t(1 << 2)\n#define\tUSBPF_STATUS_DID_CLOSE\t\t(1 << 3)\n#define\tUSBPF_STATUS_DRAINING\t\t(1 << 4)\n#define\tUSBPF_STATUS_STARTED\t\t(1 << 5)\n#define\tUSBPF_STATUS_BW_RECLAIMED\t(1 << 6)\n#define\tUSBPF_STATUS_CONTROL_XFR\t(1 << 7)\n#define\tUSBPF_STATUS_CONTROL_HDR\t(1 << 8)\n#define\tUSBPF_STATUS_CONTROL_ACT\t(1 << 9)\n#define\tUSBPF_STATUS_CONTROL_STALL\t(1 << 10)\n#define\tUSBPF_STATUS_SHORT_FRAMES_OK\t(1 << 11)\n#define\tUSBPF_STATUS_SHORT_XFER_OK\t(1 << 12)\n#define\tUSBPF_STATUS_BDMA_ENABLE\t(1 << 13)\n#define\tUSBPF_STATUS_BDMA_NO_POST_SYNC\t(1 << 14)\n#define\tUSBPF_STATUS_BDMA_SETUP\t\t(1 << 15)\n#define\tUSBPF_STATUS_ISOCHRONOUS_XFR\t(1 << 16)\n#define\tUSBPF_STATUS_CURR_DMA_SET\t(1 << 17)\n#define\tUSBPF_STATUS_CAN_CANCEL_IMMED\t(1 << 18)\n#define\tUSBPF_STATUS_DOING_CALLBACK\t(1 << 19)\n\tuint32_t\tup_error;\t/* USB error, see USB_ERR_XXX */\n\tuint32_t\tup_interval;\t/* For interrupt and isoc (ms) */\n\tuint32_t\tup_frames;\t/* Number of following frames */\n\tuint32_t\tup_packet_size;\t/* Packet size used */\n\tuint32_t\tup_packet_count;\t/* Packet count used */\n\tuint32_t\tup_endpoint;\t/* USB endpoint / stream ID */\n\tuint8_t\t\tup_speed;\t/* USB speed, see USB_SPEED_XXX */\n\t/* sizeof(struct usbpf_pkthdr) == 128 bytes */\n\tuint8_t\t\tup_reserved[83];\n};\n\nstruct usbpf_framehdr {\n\t/*\n\t * The frame length field excludes length of frame header and\n\t * any alignment.\n\t */\n\tuint32_t length;\n#define\tUSBPF_FRAME_ALIGN(x)\t\t(((x) + 3) & ~3)\n\tuint32_t flags;\n#define\tUSBPF_FRAMEFLAG_READ\t\t(1 << 0)\n#define\tUSBPF_FRAMEFLAG_DATA_FOLLOWS\t(1 << 1)\n};\n\n#define\tUSBPF_HDR_LEN\t\t128\t/* bytes */\n#define\tUSBPF_FRAME_HDR_LEN\t8\t/* bytes */\n\nextern uint8_t usbpf_pkthdr_size_ok[\n    (sizeof(struct usbpf_pkthdr) == USBPF_HDR_LEN) ? 1 : -1];\nextern uint8_t usbpf_framehdr_size_ok[\n    (sizeof(struct usbpf_framehdr) == USBPF_FRAME_HDR_LEN) ? 1 : -1];\n\n#define\tUSBPF_XFERTAP_SUBMIT\t0\n#define\tUSBPF_XFERTAP_DONE\t1\n\n#ifdef _KERNEL\nvoid\tusbpf_attach(struct usb_bus *);\nvoid\tusbpf_detach(struct usb_bus *);\nvoid\tusbpf_xfertap(struct usb_xfer *, int);\n#endif\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/dev/usb/usb_process.h",
    "content": "/* $FreeBSD: release/9.0.0/sys/dev/usb/usb_process.h 217350 2011-01-13 14:15:36Z jhb $ */\n/*-\n * Copyright (c) 2008 Hans Petter Selasky. All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n */\n\n#ifndef _USB_PROCESS_H_\n#define\t_USB_PROCESS_H_\n\n#include <sys/interrupt.h>\n#include <sys/priority.h>\n#include <sys/runq.h>\n\n/* defines */\n#define\tUSB_PRI_HIGH\tPI_SWI(SWI_NET)\n#define\tUSB_PRI_MED\tPI_SWI(SWI_CAMBIO)\n\n#define\tUSB_PROC_WAIT_TIMEOUT 2\n#define\tUSB_PROC_WAIT_DRAIN   1\n#define\tUSB_PROC_WAIT_NORMAL  0\n\n/* structure prototypes */\n\nstruct usb_proc_msg;\n\n/*\n * The following structure defines the USB process.\n */\nstruct usb_process {\n\tTAILQ_HEAD(, usb_proc_msg) up_qhead;\n\tstruct cv up_cv;\n\tstruct cv up_drain;\n\n#if (__FreeBSD_version >= 800000)\n\tstruct thread *up_ptr;\n#else\n\tstruct proc *up_ptr;\n#endif\n\tstruct thread *up_curtd;\n\tstruct mtx *up_mtx;\n\n\tusb_size_t up_msg_num;\n\n\tuint8_t\tup_prio;\n\tuint8_t\tup_gone;\n\tuint8_t\tup_msleep;\n\tuint8_t\tup_csleep;\n\tuint8_t\tup_dsleep;\n};\n\n/* prototypes */\n\nuint8_t\tusb_proc_is_gone(struct usb_process *up);\nint\tusb_proc_create(struct usb_process *up, struct mtx *p_mtx,\n\t    const char *pmesg, uint8_t prio);\nvoid\tusb_proc_drain(struct usb_process *up);\nvoid\tusb_proc_mwait(struct usb_process *up, void *pm0, void *pm1);\nvoid\tusb_proc_free(struct usb_process *up);\nvoid   *usb_proc_msignal(struct usb_process *up, void *pm0, void *pm1);\nvoid\tusb_proc_rewakeup(struct usb_process *up);\n\n#endif\t\t\t\t\t/* _USB_PROCESS_H_ */\n"
  },
  {
    "path": "freebsd-headers/dev/usb/usb_request.h",
    "content": "/* $FreeBSD: release/9.0.0/sys/dev/usb/usb_request.h 222786 2011-06-06 21:45:09Z hselasky $ */\n/*-\n * Copyright (c) 2008 Hans Petter Selasky. All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n */\n\n#ifndef _USB_REQUEST_H_\n#define\t_USB_REQUEST_H_\n\nstruct usb_process;\n\nusb_error_t usbd_req_clear_hub_feature(struct usb_device *udev,\n\t\t    struct mtx *mtx, uint16_t sel);\nusb_error_t usbd_req_clear_port_feature(struct usb_device *udev,\n\t\t    struct mtx *mtx, uint8_t port, uint16_t sel);\nusb_error_t usbd_req_get_alt_interface_no(struct usb_device *udev,\n\t\t    struct mtx *mtx, uint8_t *alt_iface_no,\n\t\t    uint8_t iface_index);\nusb_error_t usbd_req_get_config(struct usb_device *udev, struct mtx *mtx,\n\t\t    uint8_t *pconf);\nusb_error_t usbd_req_get_descriptor_ptr(struct usb_device *udev,\n\t\t    struct usb_config_descriptor **ppcd, uint16_t wValue);\nusb_error_t usbd_req_get_config_desc(struct usb_device *udev, struct mtx *mtx,\n\t\t    struct usb_config_descriptor *d, uint8_t conf_index);\nusb_error_t usbd_req_get_config_desc_full(struct usb_device *udev,\n\t\t    struct mtx *mtx, struct usb_config_descriptor **ppcd,\n\t\t    struct malloc_type *mtype, uint8_t conf_index);\nusb_error_t usbd_req_get_desc(struct usb_device *udev, struct mtx *mtx,\n\t\t    uint16_t *actlen, void *desc, uint16_t min_len,\n\t\t    uint16_t max_len, uint16_t id, uint8_t type,\n\t\t    uint8_t index, uint8_t retries);\nusb_error_t usbd_req_get_device_desc(struct usb_device *udev, struct mtx *mtx,\n\t\t    struct usb_device_descriptor *d);\nusb_error_t usbd_req_get_device_status(struct usb_device *udev,\n\t\t    struct mtx *mtx, struct usb_status *st);\nusb_error_t usbd_req_get_hub_descriptor(struct usb_device *udev,\n\t\t    struct mtx *mtx, struct usb_hub_descriptor *hd,\n\t\t    uint8_t nports);\nusb_error_t usbd_req_get_ss_hub_descriptor(struct usb_device *udev,\n\t\t    struct mtx *mtx, struct usb_hub_ss_descriptor *hd,\n\t\t    uint8_t nports);\nusb_error_t usbd_req_get_hub_status(struct usb_device *udev, struct mtx *mtx,\n\t\t    struct usb_hub_status *st);\nusb_error_t usbd_req_get_port_status(struct usb_device *udev, struct mtx *mtx,\n\t\t    struct usb_port_status *ps, uint8_t port);\nusb_error_t usbd_req_reset_port(struct usb_device *udev, struct mtx *mtx,\n\t\t    uint8_t port);\nusb_error_t usbd_req_warm_reset_port(struct usb_device *udev,\n\t\t    struct mtx *mtx, uint8_t port);\nusb_error_t usbd_req_set_address(struct usb_device *udev, struct mtx *mtx,\n\t\t    uint16_t addr);\nusb_error_t usbd_req_set_hub_feature(struct usb_device *udev, struct mtx *mtx,\n\t\t    uint16_t sel);\nusb_error_t usbd_req_set_port_feature(struct usb_device *udev,\n\t\t    struct mtx *mtx, uint8_t port, uint16_t sel);\nusb_error_t usbd_setup_device_desc(struct usb_device *udev, struct mtx *mtx);\nusb_error_t usbd_req_re_enumerate(struct usb_device *udev, struct mtx *mtx);\nusb_error_t usbd_req_clear_device_feature(struct usb_device *udev,\n\t\t    struct mtx *mtx, uint16_t sel);\nusb_error_t usbd_req_set_device_feature(struct usb_device *udev,\n\t\t    struct mtx *mtx, uint16_t sel);\nusb_error_t usbd_req_set_hub_u1_timeout(struct usb_device *udev,\n\t\t    struct mtx *mtx, uint8_t port, uint8_t timeout);\nusb_error_t usbd_req_set_hub_u2_timeout(struct usb_device *udev,\n\t\t    struct mtx *mtx, uint8_t port, uint8_t timeout);\nusb_error_t usbd_req_set_hub_depth(struct usb_device *udev,\n\t\t    struct mtx *mtx, uint16_t depth);\nusb_error_t usbd_req_reset_tt(struct usb_device *udev, struct mtx *mtx,\n\t\t    uint8_t port);\nusb_error_t usbd_req_clear_tt_buffer(struct usb_device *udev, struct mtx *mtx,\n\t\t    uint8_t port, uint8_t addr, uint8_t type, uint8_t endpoint);\n\n#endif\t\t\t\t\t/* _USB_REQUEST_H_ */\n"
  },
  {
    "path": "freebsd-headers/dev/usb/usb_transfer.h",
    "content": "/* $FreeBSD: release/9.0.0/sys/dev/usb/usb_transfer.h 213435 2010-10-04 23:18:05Z hselasky $ */\n/*-\n * Copyright (c) 2008 Hans Petter Selasky. All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n */\n\n#ifndef _USB_TRANSFER_H_\n#define\t_USB_TRANSFER_H_\n\n/*\n * The following structure defines the messages that is used to signal\n * the \"done_p\" USB process.\n */\nstruct usb_done_msg {\n\tstruct usb_proc_msg hdr;\n\tstruct usb_xfer_root *xroot;\n};\n\n#define\tUSB_DMATAG_TO_XROOT(dpt)\t\t\t\t\\\n  ((struct usb_xfer_root *)(\t\t\t\t\t\\\n   ((uint8_t *)(dpt)) -\t\t\t\t\t\t\\\n   ((uint8_t *)&((struct usb_xfer_root *)0)->dma_parent_tag)))\n\n/*\n * The following structure is used to keep information about memory\n * that should be automatically freed at the moment all USB transfers\n * have been freed.\n */\nstruct usb_xfer_root {\n\tstruct usb_dma_parent_tag dma_parent_tag;\n#if USB_HAVE_BUSDMA\n\tstruct usb_xfer_queue dma_q;\n#endif\n\tstruct usb_xfer_queue done_q;\n\tstruct usb_done_msg done_m[2];\n\tstruct cv cv_drain;\n\n\tstruct usb_process *done_p;\t/* pointer to callback process */\n\tvoid   *memory_base;\n\tstruct mtx *xfer_mtx;\t/* cannot be changed during operation */\n#if USB_HAVE_BUSDMA\n\tstruct usb_page_cache *dma_page_cache_start;\n\tstruct usb_page_cache *dma_page_cache_end;\n#endif\n\tstruct usb_page_cache *xfer_page_cache_start;\n\tstruct usb_page_cache *xfer_page_cache_end;\n\tstruct usb_bus *bus;\t\t/* pointer to USB bus (cached) */\n\tstruct usb_device *udev;\t/* pointer to USB device */\n\n\tusb_size_t memory_size;\n\tusb_size_t setup_refcount;\n#if USB_HAVE_BUSDMA\n\tusb_frcount_t dma_nframes;\t/* number of page caches to load */\n\tusb_frcount_t dma_currframe;\t/* currect page cache number */\n\tusb_frlength_t dma_frlength_0;\t/* length of page cache zero */\n\tuint8_t\tdma_error;\t\t/* set if virtual memory could not be\n\t\t\t\t\t * loaded */\n#endif\n\tuint8_t\tdone_sleep;\t\t/* set if done thread is sleeping */\n};\n\n/*\n * The following structure is used when setting up an array of USB\n * transfers.\n */\nstruct usb_setup_params {\n\tstruct usb_dma_tag *dma_tag_p;\n\tstruct usb_page *dma_page_ptr;\n\tstruct usb_page_cache *dma_page_cache_ptr;\t/* these will be\n\t\t\t\t\t\t\t * auto-freed */\n\tstruct usb_page_cache *xfer_page_cache_ptr;\t/* these will not be\n\t\t\t\t\t\t\t * auto-freed */\n\tstruct usb_device *udev;\n\tstruct usb_xfer *curr_xfer;\n\tconst struct usb_config *curr_setup;\n\tconst struct usb_pipe_methods *methods;\n\tvoid   *buf;\n\tusb_frlength_t *xfer_length_ptr;\n\n\tusb_size_t size[7];\n\tusb_frlength_t bufsize;\n\tusb_frlength_t bufsize_max;\n\n\tuint32_t hc_max_frame_size;\n\tuint16_t hc_max_packet_size;\n\tuint8_t\thc_max_packet_count;\n\tenum usb_dev_speed speed;\n\tuint8_t\tdma_tag_max;\n\tusb_error_t err;\n};\n\n/* function prototypes */\n\nuint8_t\tusbd_transfer_setup_sub_malloc(struct usb_setup_params *parm,\n\t    struct usb_page_cache **ppc, usb_size_t size, usb_size_t align,\n\t    usb_size_t count);\nvoid\tusb_dma_delay_done_cb(struct usb_xfer *);\nvoid\tusb_command_wrapper(struct usb_xfer_queue *pq,\n\t    struct usb_xfer *xfer);\nvoid\tusbd_pipe_enter(struct usb_xfer *xfer);\nvoid\tusbd_pipe_start(struct usb_xfer_queue *pq);\nvoid\tusbd_transfer_dequeue(struct usb_xfer *xfer);\nvoid\tusbd_transfer_done(struct usb_xfer *xfer, usb_error_t error);\nvoid\tusbd_transfer_enqueue(struct usb_xfer_queue *pq,\n\t    struct usb_xfer *xfer);\nvoid\tusbd_transfer_setup_sub(struct usb_setup_params *parm);\nvoid\tusbd_ctrl_transfer_setup(struct usb_device *udev);\nvoid\tusbd_clear_stall_locked(struct usb_device *udev,\n\t    struct usb_endpoint *ep);\nvoid\tusbd_clear_data_toggle(struct usb_device *udev,\n\t    struct usb_endpoint *ep);\nusb_callback_t usbd_do_request_callback;\nusb_callback_t usb_handle_request_callback;\nusb_callback_t usb_do_clear_stall_callback;\nvoid\tusbd_transfer_timeout_ms(struct usb_xfer *xfer,\n\t    void (*cb) (void *arg), usb_timeout_t ms);\nusb_timeout_t usbd_get_dma_delay(struct usb_device *udev);\nvoid\tusbd_transfer_power_ref(struct usb_xfer *xfer, int val);\n\n#endif\t\t\t\t\t/* _USB_TRANSFER_H_ */\n"
  },
  {
    "path": "freebsd-headers/dev/usb/usb_util.h",
    "content": "/* $FreeBSD: release/9.0.0/sys/dev/usb/usb_util.h 196219 2009-08-14 20:03:53Z jhb $ */\n/*-\n * Copyright (c) 2008 Hans Petter Selasky. All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n */\n\n#ifndef _USB_UTIL_H_\n#define\t_USB_UTIL_H_\n\nint\tdevice_delete_all_children(device_t dev);\nuint8_t\tusb_make_str_desc(void *ptr, uint16_t max_len, const char *s);\nvoid\tusb_printbcd(char *p, uint16_t p_len, uint16_t bcd);\nvoid\tusb_trim_spaces(char *p);\n\n#endif\t\t\t\t\t/* _USB_UTIL_H_ */\n"
  },
  {
    "path": "freebsd-headers/dev/usb/usbdi.h",
    "content": "/*-\n * Copyright (c) 2009 Andrew Thompson\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR\n * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES\n * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,\n * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF\n * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/dev/usb/usbdi.h 225469 2011-09-10 15:55:36Z hselasky $\n */\n#ifndef _USB_USBDI_H_\n#define _USB_USBDI_H_\n\nstruct usb_fifo;\nstruct usb_xfer;\nstruct usb_device;\nstruct usb_attach_arg;\nstruct usb_interface;\nstruct usb_endpoint;\nstruct usb_page_cache;\nstruct usb_page_search;\nstruct usb_process;\nstruct usb_proc_msg;\nstruct usb_mbuf;\nstruct usb_fs_privdata;\nstruct mbuf;\n\ntypedef enum {\t/* keep in sync with usb_errstr_table */\n\tUSB_ERR_NORMAL_COMPLETION = 0,\n\tUSB_ERR_PENDING_REQUESTS,\t/* 1 */\n\tUSB_ERR_NOT_STARTED,\t\t/* 2 */\n\tUSB_ERR_INVAL,\t\t\t/* 3 */\n\tUSB_ERR_NOMEM,\t\t\t/* 4 */\n\tUSB_ERR_CANCELLED,\t\t/* 5 */\n\tUSB_ERR_BAD_ADDRESS,\t\t/* 6 */\n\tUSB_ERR_BAD_BUFSIZE,\t\t/* 7 */\n\tUSB_ERR_BAD_FLAG,\t\t/* 8 */\n\tUSB_ERR_NO_CALLBACK,\t\t/* 9 */\n\tUSB_ERR_IN_USE,\t\t\t/* 10 */\n\tUSB_ERR_NO_ADDR,\t\t/* 11 */\n\tUSB_ERR_NO_PIPE,\t\t/* 12 */\n\tUSB_ERR_ZERO_NFRAMES,\t\t/* 13 */\n\tUSB_ERR_ZERO_MAXP,\t\t/* 14 */\n\tUSB_ERR_SET_ADDR_FAILED,\t/* 15 */\n\tUSB_ERR_NO_POWER,\t\t/* 16 */\n\tUSB_ERR_TOO_DEEP,\t\t/* 17 */\n\tUSB_ERR_IOERROR,\t\t/* 18 */\n\tUSB_ERR_NOT_CONFIGURED,\t\t/* 19 */\n\tUSB_ERR_TIMEOUT,\t\t/* 20 */\n\tUSB_ERR_SHORT_XFER,\t\t/* 21 */\n\tUSB_ERR_STALLED,\t\t/* 22 */\n\tUSB_ERR_INTERRUPTED,\t\t/* 23 */\n\tUSB_ERR_DMA_LOAD_FAILED,\t/* 24 */\n\tUSB_ERR_BAD_CONTEXT,\t\t/* 25 */\n\tUSB_ERR_NO_ROOT_HUB,\t\t/* 26 */\n\tUSB_ERR_NO_INTR_THREAD,\t\t/* 27 */\n\tUSB_ERR_NOT_LOCKED,\t\t/* 28 */\n\tUSB_ERR_MAX\n} usb_error_t;\n\n/*\n * Flags for transfers\n */\n#define\tUSB_FORCE_SHORT_XFER\t0x0001\t/* force a short transmit last */\n#define\tUSB_SHORT_XFER_OK\t0x0004\t/* allow short reads */\n#define\tUSB_DELAY_STATUS_STAGE\t0x0010\t/* insert delay before STATUS stage */\n#define\tUSB_USER_DATA_PTR\t0x0020\t/* internal flag */\n#define\tUSB_MULTI_SHORT_OK\t0x0040\t/* allow multiple short frames */\n#define\tUSB_MANUAL_STATUS\t0x0080\t/* manual ctrl status */\n\n#define\tUSB_NO_TIMEOUT 0\n#define\tUSB_DEFAULT_TIMEOUT 5000\t/* 5000 ms = 5 seconds */\n\n#if defined(_KERNEL)\n/* typedefs */\n\ntypedef void (usb_callback_t)(struct usb_xfer *, usb_error_t);\ntypedef void (usb_proc_callback_t)(struct usb_proc_msg *);\ntypedef usb_error_t (usb_handle_req_t)(struct usb_device *,\n    struct usb_device_request *, const void **, uint16_t *);\n\ntypedef int (usb_fifo_open_t)(struct usb_fifo *fifo, int fflags);\ntypedef void (usb_fifo_close_t)(struct usb_fifo *fifo, int fflags);\ntypedef int (usb_fifo_ioctl_t)(struct usb_fifo *fifo, u_long cmd, void *addr, int fflags);\ntypedef void (usb_fifo_cmd_t)(struct usb_fifo *fifo);\ntypedef void (usb_fifo_filter_t)(struct usb_fifo *fifo, struct usb_mbuf *m);\n\n\n/* USB events */\n#include <sys/eventhandler.h>\ntypedef void (*usb_dev_configured_t)(void *, struct usb_device *,\n    struct usb_attach_arg *);\nEVENTHANDLER_DECLARE(usb_dev_configured, usb_dev_configured_t);\n\n/*\n * The following macros are used used to convert milliseconds into\n * HZ. We use 1024 instead of 1000 milliseconds per second to save a\n * full division.\n */\n#define\tUSB_MS_HZ 1024\n\n#define\tUSB_MS_TO_TICKS(ms) \\\n  (((uint32_t)((((uint32_t)(ms)) * ((uint32_t)(hz))) + USB_MS_HZ - 1)) / USB_MS_HZ)\n\n/*\n * Common queue structure for USB transfers.\n */\nstruct usb_xfer_queue {\n\tTAILQ_HEAD(, usb_xfer) head;\n\tstruct usb_xfer *curr;\t\t/* current USB transfer processed */\n\tvoid    (*command) (struct usb_xfer_queue *pq);\n\tuint8_t\trecurse_1:1;\n\tuint8_t\trecurse_2:1;\n};\n\n/*\n * The following structure defines an USB endpoint\n * USB endpoint.\n */\nstruct usb_endpoint {\n\tstruct usb_xfer_queue endpoint_q;\t/* queue of USB transfers */\n\n\tstruct usb_endpoint_descriptor *edesc;\n\tstruct usb_endpoint_ss_comp_descriptor *ecomp;\n\tstruct usb_pipe_methods *methods;\t/* set by HC driver */\n\n\tuint16_t isoc_next;\n\n\tuint8_t\ttoggle_next:1;\t\t/* next data toggle value */\n\tuint8_t\tis_stalled:1;\t\t/* set if endpoint is stalled */\n\tuint8_t\tis_synced:1;\t\t/* set if we a synchronised */\n\tuint8_t\tunused:5;\n\tuint8_t\tiface_index;\t\t/* not used by \"default endpoint\" */\n\n\tuint8_t refcount_alloc;\t\t/* allocation refcount */\n\tuint8_t refcount_bw;\t\t/* bandwidth refcount */\n#define\tUSB_EP_REF_MAX 0x3f\n\n\t/* High-Speed resource allocation (valid if \"refcount_bw\" > 0) */\n\n\tuint8_t\tusb_smask;\t\t/* USB start mask */\n\tuint8_t\tusb_cmask;\t\t/* USB complete mask */\n\tuint8_t\tusb_uframe;\t\t/* USB microframe */\n};\n\n/*\n * The following structure defines an USB interface.\n */\nstruct usb_interface {\n\tstruct usb_interface_descriptor *idesc;\n\tdevice_t subdev;\n\tuint8_t\talt_index;\n\tuint8_t\tparent_iface_index;\n\n\t/* Linux compat */\n\tstruct usb_host_interface *altsetting;\n\tstruct usb_host_interface *cur_altsetting;\n\tstruct usb_device *linux_udev;\n\tvoid   *bsd_priv_sc;\t\t/* device specific information */\n\tchar   *pnpinfo;\t\t/* additional PnP-info for this interface */\n\tuint8_t\tnum_altsetting;\t\t/* number of alternate settings */\n\tuint8_t\tbsd_iface_index;\n};\n\n/*\n * The following structure defines a set of USB transfer flags.\n */\nstruct usb_xfer_flags {\n\tuint8_t\tforce_short_xfer:1;\t/* force a short transmit transfer\n\t\t\t\t\t * last */\n\tuint8_t\tshort_xfer_ok:1;\t/* allow short receive transfers */\n\tuint8_t\tshort_frames_ok:1;\t/* allow short frames */\n\tuint8_t\tpipe_bof:1;\t\t/* block pipe on failure */\n\tuint8_t\tproxy_buffer:1;\t\t/* makes buffer size a factor of\n\t\t\t\t\t * \"max_frame_size\" */\n\tuint8_t\text_buffer:1;\t\t/* uses external DMA buffer */\n\tuint8_t\tmanual_status:1;\t/* non automatic status stage on\n\t\t\t\t\t * control transfers */\n\tuint8_t\tno_pipe_ok:1;\t\t/* set if \"USB_ERR_NO_PIPE\" error can\n\t\t\t\t\t * be ignored */\n\tuint8_t\tstall_pipe:1;\t\t/* set if the endpoint belonging to\n\t\t\t\t\t * this USB transfer should be stalled\n\t\t\t\t\t * before starting this transfer! */\n\tuint8_t pre_scale_frames:1;\t/* \"usb_config->frames\" is\n\t\t\t\t\t * assumed to give the\n\t\t\t\t\t * buffering time in\n\t\t\t\t\t * milliseconds and is\n\t\t\t\t\t * converted into the nearest\n\t\t\t\t\t * number of frames when the\n\t\t\t\t\t * USB transfer is setup. This\n\t\t\t\t\t * option only has effect for\n\t\t\t\t\t * ISOCHRONOUS transfers.\n\t\t\t\t\t */\n};\n\n/*\n * The following structure define an USB configuration, that basically\n * is used when setting up an USB transfer.\n */\nstruct usb_config {\n\tusb_callback_t *callback;\t/* USB transfer callback */\n\tusb_frlength_t bufsize;\t/* total pipe buffer size in bytes */\n\tusb_frcount_t frames;\t\t/* maximum number of USB frames */\n\tusb_timeout_t interval;\t/* interval in milliseconds */\n#define\tUSB_DEFAULT_INTERVAL\t0\n\tusb_timeout_t timeout;\t\t/* transfer timeout in milliseconds */\n\tstruct usb_xfer_flags flags;\t/* transfer flags */\n\tenum usb_hc_mode usb_mode;\t/* host or device mode */\n\tuint8_t\ttype;\t\t\t/* pipe type */\n\tuint8_t\tendpoint;\t\t/* pipe number */\n\tuint8_t\tdirection;\t\t/* pipe direction */\n\tuint8_t\tep_index;\t\t/* pipe index match to use */\n\tuint8_t\tif_index;\t\t/* \"ifaces\" index to use */\n};\n\n/*\n * Use these macro when defining USB device ID arrays if you want to\n * have your driver module automatically loaded in host, device or\n * both modes respectivly:\n */\n#define\tSTRUCT_USB_HOST_ID \\\n    struct usb_device_id __section(\"usb_host_id\")\n#define\tSTRUCT_USB_DEVICE_ID \\\n    struct usb_device_id __section(\"usb_device_id\")\n#define\tSTRUCT_USB_DUAL_ID \\\n    struct usb_device_id __section(\"usb_dual_id\")\n\n/*\n * The following structure is used when looking up an USB driver for\n * an USB device. It is inspired by the Linux structure called\n * \"usb_device_id\".\n */\nstruct usb_device_id {\n\n\t/* Hook for driver specific information */\n\tunsigned long driver_info;\n\n\t/* Used for product specific matches; the BCD range is inclusive */\n\tuint16_t idVendor;\n\tuint16_t idProduct;\n\tuint16_t bcdDevice_lo;\n\tuint16_t bcdDevice_hi;\n\n\t/* Used for device class matches */\n\tuint8_t\tbDeviceClass;\n\tuint8_t\tbDeviceSubClass;\n\tuint8_t\tbDeviceProtocol;\n\n\t/* Used for interface class matches */\n\tuint8_t\tbInterfaceClass;\n\tuint8_t\tbInterfaceSubClass;\n\tuint8_t\tbInterfaceProtocol;\n\n\t/* Select which fields to match against */\n\tuint8_t\tmatch_flag_vendor:1;\n\tuint8_t\tmatch_flag_product:1;\n\tuint8_t\tmatch_flag_dev_lo:1;\n\tuint8_t\tmatch_flag_dev_hi:1;\n\n\tuint8_t\tmatch_flag_dev_class:1;\n\tuint8_t\tmatch_flag_dev_subclass:1;\n\tuint8_t\tmatch_flag_dev_protocol:1;\n\tuint8_t\tmatch_flag_int_class:1;\n\n\tuint8_t\tmatch_flag_int_subclass:1;\n\tuint8_t\tmatch_flag_int_protocol:1;\n\tuint8_t match_flag_unused:6;\n\n#if USB_HAVE_COMPAT_LINUX\n\t/* which fields to match against */\n\tuint16_t match_flags;\n#define\tUSB_DEVICE_ID_MATCH_VENDOR\t\t0x0001\n#define\tUSB_DEVICE_ID_MATCH_PRODUCT\t\t0x0002\n#define\tUSB_DEVICE_ID_MATCH_DEV_LO\t\t0x0004\n#define\tUSB_DEVICE_ID_MATCH_DEV_HI\t\t0x0008\n#define\tUSB_DEVICE_ID_MATCH_DEV_CLASS\t\t0x0010\n#define\tUSB_DEVICE_ID_MATCH_DEV_SUBCLASS\t0x0020\n#define\tUSB_DEVICE_ID_MATCH_DEV_PROTOCOL\t0x0040\n#define\tUSB_DEVICE_ID_MATCH_INT_CLASS\t\t0x0080\n#define\tUSB_DEVICE_ID_MATCH_INT_SUBCLASS\t0x0100\n#define\tUSB_DEVICE_ID_MATCH_INT_PROTOCOL\t0x0200\n#endif\n} __aligned(32);\n\n/* check that the size of the structure above is correct */\nextern char usb_device_id_assert[(sizeof(struct usb_device_id) == 32) ? 1 : -1];\n\n#define\tUSB_VENDOR(vend)\t\t\t\\\n  .match_flag_vendor = 1, .idVendor = (vend)\n\n#define\tUSB_PRODUCT(prod)\t\t\t\\\n  .match_flag_product = 1, .idProduct = (prod)\n\n#define\tUSB_VP(vend,prod)\t\t\t\\\n  USB_VENDOR(vend), USB_PRODUCT(prod)\n\n#define\tUSB_VPI(vend,prod,info)\t\t\t\\\n  USB_VENDOR(vend), USB_PRODUCT(prod), USB_DRIVER_INFO(info)\n\n#define\tUSB_DEV_BCD_GTEQ(lo)\t/* greater than or equal */ \\\n  .match_flag_dev_lo = 1, .bcdDevice_lo = (lo)\n\n#define\tUSB_DEV_BCD_LTEQ(hi)\t/* less than or equal */ \\\n  .match_flag_dev_hi = 1, .bcdDevice_hi = (hi)\n\n#define\tUSB_DEV_CLASS(dc)\t\t\t\\\n  .match_flag_dev_class = 1, .bDeviceClass = (dc)\n\n#define\tUSB_DEV_SUBCLASS(dsc)\t\t\t\\\n  .match_flag_dev_subclass = 1, .bDeviceSubClass = (dsc)\n\n#define\tUSB_DEV_PROTOCOL(dp)\t\t\t\\\n  .match_flag_dev_protocol = 1, .bDeviceProtocol = (dp)\n\n#define\tUSB_IFACE_CLASS(ic)\t\t\t\\\n  .match_flag_int_class = 1, .bInterfaceClass = (ic)\n\n#define\tUSB_IFACE_SUBCLASS(isc)\t\t\t\\\n  .match_flag_int_subclass = 1, .bInterfaceSubClass = (isc)\n\n#define\tUSB_IFACE_PROTOCOL(ip)\t\t\t\\\n  .match_flag_int_protocol = 1, .bInterfaceProtocol = (ip)\n\n#define\tUSB_IF_CSI(class,subclass,info)\t\t\t\\\n  USB_IFACE_CLASS(class), USB_IFACE_SUBCLASS(subclass), USB_DRIVER_INFO(info)\n\n#define\tUSB_DRIVER_INFO(n)\t\t\t\\\n  .driver_info = (n)\n\n#define\tUSB_GET_DRIVER_INFO(did)\t\t\\\n  (did)->driver_info\n\n/*\n * The following structure keeps information that is used to match\n * against an array of \"usb_device_id\" elements.\n */\nstruct usbd_lookup_info {\n\tuint16_t idVendor;\n\tuint16_t idProduct;\n\tuint16_t bcdDevice;\n\tuint8_t\tbDeviceClass;\n\tuint8_t\tbDeviceSubClass;\n\tuint8_t\tbDeviceProtocol;\n\tuint8_t\tbInterfaceClass;\n\tuint8_t\tbInterfaceSubClass;\n\tuint8_t\tbInterfaceProtocol;\n\tuint8_t\tbIfaceIndex;\n\tuint8_t\tbIfaceNum;\n\tuint8_t\tbConfigIndex;\n\tuint8_t\tbConfigNum;\n};\n\n/* Structure used by probe and attach */\n\nstruct usb_attach_arg {\n\tstruct usbd_lookup_info info;\n\tdevice_t temp_dev;\t\t/* for internal use */\n\tunsigned long driver_info;\t/* for internal use */\n\tvoid *driver_ivar;\n\tstruct usb_device *device;\t/* current device */\n\tstruct usb_interface *iface;\t/* current interface */\n\tenum usb_hc_mode usb_mode;\t/* host or device mode */\n\tuint8_t\tport;\n\tuint8_t dev_state;\n#define UAA_DEV_READY\t\t0\n#define UAA_DEV_DISABLED\t1\n#define UAA_DEV_EJECTING\t2\n};\n\n/*\n * The following is a wrapper for the callout structure to ease\n * porting the code to other platforms.\n */\nstruct usb_callout {\n\tstruct callout co;\n};\n#define\tusb_callout_init_mtx(c,m,f) callout_init_mtx(&(c)->co,m,f)\n#define\tusb_callout_reset(c,t,f,d) callout_reset(&(c)->co,t,f,d)\n#define\tusb_callout_stop(c) callout_stop(&(c)->co)\n#define\tusb_callout_drain(c) callout_drain(&(c)->co)\n#define\tusb_callout_pending(c) callout_pending(&(c)->co)\n\n/* USB transfer states */\n\n#define\tUSB_ST_SETUP       0\n#define\tUSB_ST_TRANSFERRED 1\n#define\tUSB_ST_ERROR       2\n\n/* USB handle request states */\n#define\tUSB_HR_NOT_COMPLETE\t0\n#define\tUSB_HR_COMPLETE_OK\t1\n#define\tUSB_HR_COMPLETE_ERR\t2\n\n/*\n * The following macro will return the current state of an USB\n * transfer like defined by the \"USB_ST_XXX\" enums.\n */\n#define\tUSB_GET_STATE(xfer) (usbd_xfer_state(xfer))\n\n/*\n * The following structure defines the USB process message header.\n */\nstruct usb_proc_msg {\n\tTAILQ_ENTRY(usb_proc_msg) pm_qentry;\n\tusb_proc_callback_t *pm_callback;\n\tusb_size_t pm_num;\n};\n\n#define\tUSB_FIFO_TX 0\n#define\tUSB_FIFO_RX 1\n\n/*\n * Locking note for the following functions.  All the\n * \"usb_fifo_cmd_t\" and \"usb_fifo_filter_t\" functions are called\n * locked. The others are called unlocked.\n */\nstruct usb_fifo_methods {\n\tusb_fifo_open_t *f_open;\n\tusb_fifo_close_t *f_close;\n\tusb_fifo_ioctl_t *f_ioctl;\n\t/*\n\t * NOTE: The post-ioctl callback is called after the USB reference\n\t * gets locked in the IOCTL handler:\n\t */\n\tusb_fifo_ioctl_t *f_ioctl_post;\n\tusb_fifo_cmd_t *f_start_read;\n\tusb_fifo_cmd_t *f_stop_read;\n\tusb_fifo_cmd_t *f_start_write;\n\tusb_fifo_cmd_t *f_stop_write;\n\tusb_fifo_filter_t *f_filter_read;\n\tusb_fifo_filter_t *f_filter_write;\n\tconst char *basename[4];\n\tconst char *postfix[4];\n};\n\nstruct usb_fifo_sc {\n\tstruct usb_fifo *fp[2];\n\tstruct usb_fs_privdata *dev;\n};\n\nconst char *usbd_errstr(usb_error_t error);\nvoid\t*usbd_find_descriptor(struct usb_device *udev, void *id,\n\t    uint8_t iface_index, uint8_t type, uint8_t type_mask,\n\t    uint8_t subtype, uint8_t subtype_mask);\nstruct usb_config_descriptor *usbd_get_config_descriptor(\n\t    struct usb_device *udev);\nstruct usb_device_descriptor *usbd_get_device_descriptor(\n\t    struct usb_device *udev);\nstruct usb_interface *usbd_get_iface(struct usb_device *udev,\n\t    uint8_t iface_index);\nstruct usb_interface_descriptor *usbd_get_interface_descriptor(\n\t    struct usb_interface *iface);\nstruct usb_endpoint *usbd_get_endpoint(struct usb_device *udev, uint8_t iface_index,\n\t\t    const struct usb_config *setup);\nstruct usb_endpoint *usbd_get_ep_by_addr(struct usb_device *udev, uint8_t ea_val);\nusb_error_t\tusbd_interface_count(struct usb_device *udev, uint8_t *count);\nenum usb_hc_mode usbd_get_mode(struct usb_device *udev);\nenum usb_dev_speed usbd_get_speed(struct usb_device *udev);\nvoid\tdevice_set_usb_desc(device_t dev);\nvoid\tusb_pause_mtx(struct mtx *mtx, int _ticks);\nusb_error_t\tusbd_set_pnpinfo(struct usb_device *udev,\n\t\t\tuint8_t iface_index, const char *pnpinfo);\nusb_error_t\tusbd_add_dynamic_quirk(struct usb_device *udev,\n\t\t\tuint16_t quirk);\n\nconst struct usb_device_id *usbd_lookup_id_by_info(\n\t    const struct usb_device_id *id, usb_size_t sizeof_id,\n\t    const struct usbd_lookup_info *info);\nint\tusbd_lookup_id_by_uaa(const struct usb_device_id *id,\n\t    usb_size_t sizeof_id, struct usb_attach_arg *uaa);\n\nusb_error_t usbd_do_request_flags(struct usb_device *udev, struct mtx *mtx,\n\t\t    struct usb_device_request *req, void *data, uint16_t flags,\n\t\t    uint16_t *actlen, usb_timeout_t timeout);\n#define\tusbd_do_request(u,m,r,d) \\\n  usbd_do_request_flags(u,m,r,d,0,NULL,USB_DEFAULT_TIMEOUT)\n\nuint8_t\tusbd_clear_stall_callback(struct usb_xfer *xfer1,\n\t    struct usb_xfer *xfer2);\nuint8_t\tusbd_get_interface_altindex(struct usb_interface *iface);\nusb_error_t usbd_set_alt_interface_index(struct usb_device *udev,\n\t    uint8_t iface_index, uint8_t alt_index);\nuint32_t usbd_get_isoc_fps(struct usb_device *udev);\nusb_error_t usbd_transfer_setup(struct usb_device *udev,\n\t    const uint8_t *ifaces, struct usb_xfer **pxfer,\n\t    const struct usb_config *setup_start, uint16_t n_setup,\n\t    void *priv_sc, struct mtx *priv_mtx);\nvoid\tusbd_transfer_submit(struct usb_xfer *xfer);\nvoid\tusbd_transfer_clear_stall(struct usb_xfer *xfer);\nvoid\tusbd_transfer_drain(struct usb_xfer *xfer);\nuint8_t\tusbd_transfer_pending(struct usb_xfer *xfer);\nvoid\tusbd_transfer_start(struct usb_xfer *xfer);\nvoid\tusbd_transfer_stop(struct usb_xfer *xfer);\nvoid\tusbd_transfer_unsetup(struct usb_xfer **pxfer, uint16_t n_setup);\nvoid\tusbd_transfer_poll(struct usb_xfer **ppxfer, uint16_t max);\nvoid\tusbd_set_parent_iface(struct usb_device *udev, uint8_t iface_index,\n\t    uint8_t parent_index);\nuint8_t\tusbd_get_bus_index(struct usb_device *udev);\nuint8_t\tusbd_get_device_index(struct usb_device *udev);\nvoid\tusbd_set_power_mode(struct usb_device *udev, uint8_t power_mode);\nuint8_t\tusbd_filter_power_mode(struct usb_device *udev, uint8_t power_mode);\nuint8_t\tusbd_device_attached(struct usb_device *udev);\n\nusb_frlength_t\n\tusbd_xfer_old_frame_length(struct usb_xfer *xfer, usb_frcount_t frindex);\nvoid\tusbd_xfer_status(struct usb_xfer *xfer, int *actlen, int *sumlen,\n\t    int *aframes, int *nframes);\nstruct usb_page_cache *usbd_xfer_get_frame(struct usb_xfer *xfer,\n\t    usb_frcount_t frindex);\nvoid\t*usbd_xfer_softc(struct usb_xfer *xfer);\nvoid\t*usbd_xfer_get_priv(struct usb_xfer *xfer);\nvoid\tusbd_xfer_set_priv(struct usb_xfer *xfer, void *);\nvoid\tusbd_xfer_set_interval(struct usb_xfer *xfer, int);\nuint8_t\tusbd_xfer_state(struct usb_xfer *xfer);\nvoid\tusbd_xfer_set_frame_data(struct usb_xfer *xfer, usb_frcount_t frindex,\n\t    void *ptr, usb_frlength_t len);\nvoid\tusbd_xfer_frame_data(struct usb_xfer *xfer, usb_frcount_t frindex,\n\t    void **ptr, int *len);\nvoid\tusbd_xfer_set_frame_offset(struct usb_xfer *xfer, usb_frlength_t offset,\n\t    usb_frcount_t frindex);\nusb_frlength_t usbd_xfer_max_len(struct usb_xfer *xfer);\nusb_frlength_t usbd_xfer_max_framelen(struct usb_xfer *xfer);\nusb_frcount_t usbd_xfer_max_frames(struct usb_xfer *xfer);\nuint8_t\tusbd_xfer_get_fps_shift(struct usb_xfer *xfer);\nusb_frlength_t usbd_xfer_frame_len(struct usb_xfer *xfer,\n\t    usb_frcount_t frindex);\nvoid\tusbd_xfer_set_frame_len(struct usb_xfer *xfer, usb_frcount_t frindex,\n\t    usb_frlength_t len);\nvoid\tusbd_xfer_set_timeout(struct usb_xfer *xfer, int timeout);\nvoid\tusbd_xfer_set_frames(struct usb_xfer *xfer, usb_frcount_t n);\nvoid\tusbd_xfer_set_stall(struct usb_xfer *xfer);\nint\tusbd_xfer_is_stalled(struct usb_xfer *xfer);\nvoid\tusbd_xfer_set_flag(struct usb_xfer *xfer, int flag);\nvoid\tusbd_xfer_clr_flag(struct usb_xfer *xfer, int flag);\nuint16_t usbd_xfer_get_timestamp(struct usb_xfer *xfer);\n\nvoid\tusbd_copy_in(struct usb_page_cache *cache, usb_frlength_t offset,\n\t    const void *ptr, usb_frlength_t len);\nint\tusbd_copy_in_user(struct usb_page_cache *cache, usb_frlength_t offset,\n\t    const void *ptr, usb_frlength_t len);\nvoid\tusbd_copy_out(struct usb_page_cache *cache, usb_frlength_t offset,\n\t    void *ptr, usb_frlength_t len);\nint\tusbd_copy_out_user(struct usb_page_cache *cache, usb_frlength_t offset,\n\t    void *ptr, usb_frlength_t len);\nvoid\tusbd_get_page(struct usb_page_cache *pc, usb_frlength_t offset,\n\t    struct usb_page_search *res);\nvoid\tusbd_m_copy_in(struct usb_page_cache *cache, usb_frlength_t dst_offset,\n\t    struct mbuf *m, usb_size_t src_offset, usb_frlength_t src_len);\nvoid\tusbd_frame_zero(struct usb_page_cache *cache, usb_frlength_t offset,\n\t    usb_frlength_t len);\nvoid\tusbd_start_re_enumerate(struct usb_device *udev);\n\nint\tusb_fifo_attach(struct usb_device *udev, void *priv_sc,\n\t    struct mtx *priv_mtx, struct usb_fifo_methods *pm,\n\t    struct usb_fifo_sc *f_sc, uint16_t unit, uint16_t subunit,\n\t    uint8_t iface_index, uid_t uid, gid_t gid, int mode);\nvoid\tusb_fifo_detach(struct usb_fifo_sc *f_sc);\nint\tusb_fifo_alloc_buffer(struct usb_fifo *f, uint32_t bufsize,\n\t    uint16_t nbuf);\nvoid\tusb_fifo_free_buffer(struct usb_fifo *f);\nuint32_t usb_fifo_put_bytes_max(struct usb_fifo *fifo);\nvoid\tusb_fifo_put_data(struct usb_fifo *fifo, struct usb_page_cache *pc,\n\t    usb_frlength_t offset, usb_frlength_t len, uint8_t what);\nvoid\tusb_fifo_put_data_linear(struct usb_fifo *fifo, void *ptr,\n\t    usb_size_t len, uint8_t what);\nuint8_t\tusb_fifo_put_data_buffer(struct usb_fifo *f, void *ptr, usb_size_t len);\nvoid\tusb_fifo_put_data_error(struct usb_fifo *fifo);\nuint8_t\tusb_fifo_get_data(struct usb_fifo *fifo, struct usb_page_cache *pc,\n\t    usb_frlength_t offset, usb_frlength_t len, usb_frlength_t *actlen,\n\t    uint8_t what);\nuint8_t\tusb_fifo_get_data_linear(struct usb_fifo *fifo, void *ptr,\n\t    usb_size_t len, usb_size_t *actlen, uint8_t what);\nuint8_t\tusb_fifo_get_data_buffer(struct usb_fifo *f, void **pptr,\n\t    usb_size_t *plen);\nvoid\tusb_fifo_reset(struct usb_fifo *f);\nvoid\tusb_fifo_wakeup(struct usb_fifo *f);\nvoid\tusb_fifo_get_data_error(struct usb_fifo *fifo);\nvoid\t*usb_fifo_softc(struct usb_fifo *fifo);\nvoid\tusb_fifo_set_close_zlp(struct usb_fifo *, uint8_t);\nvoid\tusb_fifo_set_write_defrag(struct usb_fifo *, uint8_t);\nvoid\tusb_fifo_free(struct usb_fifo *f);\n#endif /* _KERNEL */\n#endif /* _USB_USBDI_H_ */\n"
  },
  {
    "path": "freebsd-headers/dev/usb/usbdi_util.h",
    "content": "/*-\n * Copyright (c) 2009 Andrew Thompson\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR\n * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES\n * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,\n * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF\n * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/dev/usb/usbdi_util.h 213435 2010-10-04 23:18:05Z hselasky $\n */\n#ifndef _USB_USBDI_UTIL_H_\n#define _USB_USBDI_UTIL_H_\n\nstruct cv;\n\n/* structures */\n\nstruct usb_idesc_parse_state {\n\tstruct usb_descriptor *desc;\n\tuint8_t iface_index;\t\t/* current interface index */\n\tuint8_t iface_no_last;\n\tuint8_t iface_index_alt;\t/* current alternate setting */\n};\n\n/* prototypes */\n\nusb_error_t usbd_do_request_proc(struct usb_device *udev, struct usb_process *pproc,\n\t\t    struct usb_device_request *req, void *data, uint16_t flags,\n\t\t    uint16_t *actlen, usb_timeout_t timeout);\n\nstruct usb_descriptor *usb_desc_foreach(struct usb_config_descriptor *cd,\n\t    struct usb_descriptor *desc);\nstruct usb_interface_descriptor *usb_idesc_foreach(\n\t    struct usb_config_descriptor *cd,\n\t    struct usb_idesc_parse_state *ps);\nstruct usb_endpoint_descriptor *usb_edesc_foreach(\n\t    struct usb_config_descriptor *cd,\n\t    struct usb_endpoint_descriptor *ped);\nstruct usb_endpoint_ss_comp_descriptor *usb_ed_comp_foreach(\n\t    struct usb_config_descriptor *cd,\n\t    struct usb_endpoint_ss_comp_descriptor *ped);\nuint8_t usbd_get_no_descriptors(struct usb_config_descriptor *cd,\n\t    uint8_t type);\nuint8_t usbd_get_no_alts(struct usb_config_descriptor *cd,\n\t    struct usb_interface_descriptor *id);\n\nusb_error_t usbd_req_get_report(struct usb_device *udev, struct mtx *mtx,\n\t\t    void *data, uint16_t len, uint8_t iface_index, uint8_t type,\n\t\t    uint8_t id);\nusb_error_t usbd_req_get_report_descriptor(struct usb_device *udev,\n\t\t    struct mtx *mtx, void *d, uint16_t size,\n\t\t    uint8_t iface_index);\nusb_error_t usbd_req_get_string_any(struct usb_device *udev, struct mtx *mtx,\n\t\t    char *buf, uint16_t len, uint8_t string_index);\nusb_error_t usbd_req_get_string_desc(struct usb_device *udev, struct mtx *mtx,\n\t\t    void *sdesc, uint16_t max_len, uint16_t lang_id,\n\t\t    uint8_t string_index);\nusb_error_t usbd_req_set_config(struct usb_device *udev, struct mtx *mtx,\n\t\t    uint8_t conf);\nusb_error_t usbd_req_set_alt_interface_no(struct usb_device *udev,\n\t\t    struct mtx *mtx, uint8_t iface_index, uint8_t alt_no);\nusb_error_t usbd_req_set_idle(struct usb_device *udev, struct mtx *mtx,\n\t\t    uint8_t iface_index, uint8_t duration, uint8_t id);\nusb_error_t usbd_req_set_protocol(struct usb_device *udev, struct mtx *mtx,\n\t\t    uint8_t iface_index, uint16_t report);\nusb_error_t usbd_req_set_report(struct usb_device *udev, struct mtx *mtx,\n\t\t    void *data, uint16_t len, uint8_t iface_index,\n\t\t    uint8_t type, uint8_t id);\n\n/* The following functions will not return NULL strings. */\n\nconst char *usb_get_manufacturer(struct usb_device *);\nconst char *usb_get_product(struct usb_device *);\nconst char *usb_get_serial(struct usb_device *);\n\n#endif /* _USB_USBDI_UTIL_H_ */\n"
  },
  {
    "path": "freebsd-headers/dev/usb/usbhid.h",
    "content": "/* $FreeBSD: release/9.0.0/sys/dev/usb/usbhid.h 223755 2011-07-04 07:37:28Z hselasky $ */\n/*-\n * Copyright (c) 2008 Hans Petter Selasky. All rights reserved.\n * Copyright (c) 1998 The NetBSD Foundation, Inc. All rights reserved.\n * Copyright (c) 1998 Lennart Augustsson. All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n */\n\n#ifndef _USB_HID_H_\n#define\t_USB_HID_H_\n\n#include <dev/usb/usb_endian.h>\n\n#define\tUR_GET_HID_DESCRIPTOR\t0x06\n#define\tUDESC_HID\t\t0x21\n#define\tUDESC_REPORT\t\t0x22\n#define\tUDESC_PHYSICAL\t\t0x23\n#define\tUR_SET_HID_DESCRIPTOR\t0x07\n#define\tUR_GET_REPORT\t\t0x01\n#define\tUR_SET_REPORT\t\t0x09\n#define\tUR_GET_IDLE\t\t0x02\n#define\tUR_SET_IDLE\t\t0x0a\n#define\tUR_GET_PROTOCOL\t\t0x03\n#define\tUR_SET_PROTOCOL\t\t0x0b\n\nstruct usb_hid_descriptor {\n\tuByte\tbLength;\n\tuByte\tbDescriptorType;\n\tuWord\tbcdHID;\n\tuByte\tbCountryCode;\n\tuByte\tbNumDescriptors;\n\tstruct {\n\t\tuByte\tbDescriptorType;\n\t\tuWord\twDescriptorLength;\n\t}\tdescrs[1];\n} __packed;\n\n#define\tUSB_HID_DESCRIPTOR_SIZE(n) (9+((n)*3))\n\n/* Usage pages */\n#define\tHUP_UNDEFINED\t\t0x0000\n#define\tHUP_GENERIC_DESKTOP\t0x0001\n#define\tHUP_SIMULATION\t\t0x0002\n#define\tHUP_VR_CONTROLS\t\t0x0003\n#define\tHUP_SPORTS_CONTROLS\t0x0004\n#define\tHUP_GAMING_CONTROLS\t0x0005\n#define\tHUP_KEYBOARD\t\t0x0007\n#define\tHUP_LEDS\t\t0x0008\n#define\tHUP_BUTTON\t\t0x0009\n#define\tHUP_ORDINALS\t\t0x000a\n#define\tHUP_TELEPHONY\t\t0x000b\n#define\tHUP_CONSUMER\t\t0x000c\n#define\tHUP_DIGITIZERS\t\t0x000d\n#define\tHUP_PHYSICAL_IFACE\t0x000e\n#define\tHUP_UNICODE\t\t0x0010\n#define\tHUP_ALPHANUM_DISPLAY\t0x0014\n#define\tHUP_MONITOR\t\t0x0080\n#define\tHUP_MONITOR_ENUM_VAL\t0x0081\n#define\tHUP_VESA_VC\t\t0x0082\n#define\tHUP_VESA_CMD\t\t0x0083\n#define\tHUP_POWER\t\t0x0084\n#define\tHUP_BATTERY_SYSTEM\t0x0085\n#define\tHUP_BARCODE_SCANNER\t0x008b\n#define\tHUP_SCALE\t\t0x008c\n#define\tHUP_CAMERA_CONTROL\t0x0090\n#define\tHUP_ARCADE\t\t0x0091\n#define\tHUP_MICROSOFT\t\t0xff00\n\n/* Usages, generic desktop */\n#define\tHUG_POINTER\t\t0x0001\n#define\tHUG_MOUSE\t\t0x0002\n#define\tHUG_JOYSTICK\t\t0x0004\n#define\tHUG_GAME_PAD\t\t0x0005\n#define\tHUG_KEYBOARD\t\t0x0006\n#define\tHUG_KEYPAD\t\t0x0007\n#define\tHUG_X\t\t\t0x0030\n#define\tHUG_Y\t\t\t0x0031\n#define\tHUG_Z\t\t\t0x0032\n#define\tHUG_RX\t\t\t0x0033\n#define\tHUG_RY\t\t\t0x0034\n#define\tHUG_RZ\t\t\t0x0035\n#define\tHUG_SLIDER\t\t0x0036\n#define\tHUG_DIAL\t\t0x0037\n#define\tHUG_WHEEL\t\t0x0038\n#define\tHUG_HAT_SWITCH\t\t0x0039\n#define\tHUG_COUNTED_BUFFER\t0x003a\n#define\tHUG_BYTE_COUNT\t\t0x003b\n#define\tHUG_MOTION_WAKEUP\t0x003c\n#define\tHUG_VX\t\t\t0x0040\n#define\tHUG_VY\t\t\t0x0041\n#define\tHUG_VZ\t\t\t0x0042\n#define\tHUG_VBRX\t\t0x0043\n#define\tHUG_VBRY\t\t0x0044\n#define\tHUG_VBRZ\t\t0x0045\n#define\tHUG_VNO\t\t\t0x0046\n#define\tHUG_TWHEEL\t\t0x0048\t/* M$ Wireless Intellimouse Wheel */\n#define\tHUG_SYSTEM_CONTROL\t0x0080\n#define\tHUG_SYSTEM_POWER_DOWN\t0x0081\n#define\tHUG_SYSTEM_SLEEP\t0x0082\n#define\tHUG_SYSTEM_WAKEUP\t0x0083\n#define\tHUG_SYSTEM_CONTEXT_MENU\t0x0084\n#define\tHUG_SYSTEM_MAIN_MENU\t0x0085\n#define\tHUG_SYSTEM_APP_MENU\t0x0086\n#define\tHUG_SYSTEM_MENU_HELP\t0x0087\n#define\tHUG_SYSTEM_MENU_EXIT\t0x0088\n#define\tHUG_SYSTEM_MENU_SELECT\t0x0089\n#define\tHUG_SYSTEM_MENU_RIGHT\t0x008a\n#define\tHUG_SYSTEM_MENU_LEFT\t0x008b\n#define\tHUG_SYSTEM_MENU_UP\t0x008c\n#define\tHUG_SYSTEM_MENU_DOWN\t0x008d\n#define\tHUG_APPLE_EJECT\t\t0x00b8\n\n/* Usages Digitizers */\n#define\tHUD_UNDEFINED\t\t0x0000\n#define\tHUD_TIP_PRESSURE\t0x0030\n#define\tHUD_BARREL_PRESSURE\t0x0031\n#define\tHUD_IN_RANGE\t\t0x0032\n#define\tHUD_TOUCH\t\t0x0033\n#define\tHUD_UNTOUCH\t\t0x0034\n#define\tHUD_TAP\t\t\t0x0035\n#define\tHUD_QUALITY\t\t0x0036\n#define\tHUD_DATA_VALID\t\t0x0037\n#define\tHUD_TRANSDUCER_INDEX\t0x0038\n#define\tHUD_TABLET_FKEYS\t0x0039\n#define\tHUD_PROGRAM_CHANGE_KEYS\t0x003a\n#define\tHUD_BATTERY_STRENGTH\t0x003b\n#define\tHUD_INVERT\t\t0x003c\n#define\tHUD_X_TILT\t\t0x003d\n#define\tHUD_Y_TILT\t\t0x003e\n#define\tHUD_AZIMUTH\t\t0x003f\n#define\tHUD_ALTITUDE\t\t0x0040\n#define\tHUD_TWIST\t\t0x0041\n#define\tHUD_TIP_SWITCH\t\t0x0042\n#define\tHUD_SEC_TIP_SWITCH\t0x0043\n#define\tHUD_BARREL_SWITCH\t0x0044\n#define\tHUD_ERASER\t\t0x0045\n#define\tHUD_TABLET_PICK\t\t0x0046\n\n/* Usages, Consumer */\n#define\tHUC_AC_PAN\t\t0x0238\n\n#define\tHID_USAGE2(p,u) (((p) << 16) | (u))\n\n#define\tUHID_INPUT_REPORT 0x01\n#define\tUHID_OUTPUT_REPORT 0x02\n#define\tUHID_FEATURE_REPORT 0x03\n\n/* Bits in the input/output/feature items */\n#define\tHIO_CONST\t0x001\n#define\tHIO_VARIABLE\t0x002\n#define\tHIO_RELATIVE\t0x004\n#define\tHIO_WRAP\t0x008\n#define\tHIO_NONLINEAR\t0x010\n#define\tHIO_NOPREF\t0x020\n#define\tHIO_NULLSTATE\t0x040\n#define\tHIO_VOLATILE\t0x080\n#define\tHIO_BUFBYTES\t0x100\n\n#ifdef _KERNEL\nstruct usb_config_descriptor;\n\nenum hid_kind {\n\thid_input, hid_output, hid_feature, hid_collection, hid_endcollection\n};\n\nstruct hid_location {\n\tuint32_t size;\n\tuint32_t count;\n\tuint32_t pos;\n};\n\nstruct hid_item {\n\t/* Global */\n\tint32_t\t_usage_page;\n\tint32_t\tlogical_minimum;\n\tint32_t\tlogical_maximum;\n\tint32_t\tphysical_minimum;\n\tint32_t\tphysical_maximum;\n\tint32_t\tunit_exponent;\n\tint32_t\tunit;\n\tint32_t\treport_ID;\n\t/* Local */\n\tint32_t\tusage;\n\tint32_t\tusage_minimum;\n\tint32_t\tusage_maximum;\n\tint32_t\tdesignator_index;\n\tint32_t\tdesignator_minimum;\n\tint32_t\tdesignator_maximum;\n\tint32_t\tstring_index;\n\tint32_t\tstring_minimum;\n\tint32_t\tstring_maximum;\n\tint32_t\tset_delimiter;\n\t/* Misc */\n\tint32_t\tcollection;\n\tint\tcollevel;\n\tenum hid_kind kind;\n\tuint32_t flags;\n\t/* Location */\n\tstruct hid_location loc;\n};\n\n/* prototypes from \"usb_hid.c\" */\n\nstruct hid_data *hid_start_parse(const void *d, usb_size_t len, int kindset);\nvoid\thid_end_parse(struct hid_data *s);\nint\thid_get_item(struct hid_data *s, struct hid_item *h);\nint\thid_report_size(const void *buf, usb_size_t len, enum hid_kind k,\n\t    uint8_t *id);\nint\thid_locate(const void *desc, usb_size_t size, uint32_t usage,\n\t    enum hid_kind kind, uint8_t index, struct hid_location *loc,\n\t    uint32_t *flags, uint8_t *id);\nint32_t hid_get_data(const uint8_t *buf, usb_size_t len,\n\t    struct hid_location *loc);\nuint32_t hid_get_data_unsigned(const uint8_t *buf, usb_size_t len,\n\t    struct hid_location *loc);\nvoid hid_put_data_unsigned(uint8_t *buf, usb_size_t len,\n\t    struct hid_location *loc, unsigned int value);\nint\thid_is_collection(const void *desc, usb_size_t size, uint32_t usage);\nstruct usb_hid_descriptor *hid_get_descriptor_from_usb(\n\t    struct usb_config_descriptor *cd,\n\t    struct usb_interface_descriptor *id);\nusb_error_t usbd_req_get_hid_desc(struct usb_device *udev, struct mtx *mtx,\n\t    void **descp, uint16_t *sizep, struct malloc_type *mem,\n\t    uint8_t iface_index);\n#endif\t\t\t\t\t/* _KERNEL */\n#endif\t\t\t\t\t/* _USB_HID_H_ */\n"
  },
  {
    "path": "freebsd-headers/dev/utopia/idtphy.h",
    "content": "/*-\n * Copyright (c) 2003\n *\tFraunhofer Institute for Open Communication Systems (FhG Fokus).\n * \tAll rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * Author: Hartmut Brandt <harti@freebsd.org>\n *\n * $FreeBSD: release/9.0.0/sys/dev/utopia/idtphy.h 139749 2005-01-06 01:43:34Z imp $\n *\n * Register definitions for the following chips:\n *\tIDT 77105\n *\tIDT 77155\n */\n#ifndef _DEV_UTOPIA_IDTPHY_H\n#define\t_DEV_UTOPIA_IDTPHY_H\n\n#define\tIDTPHY_REGO_MCR\t\t0x00\n#define\tIDTPHY_REGN_MCR\t\t\"Master Control Register\"\n#define\tIDTPHY_REGX_MCR\t\t\"\\020\\010UPLO\\7DREC\\6ECEI\\5TDPC\\4DRIC\\3HALTTX\\2BYTEM\\1EI\"\n#define\tIDTPHY_REGM_MCR_UPL0\t0x80\n#define\tIDTPHY_REGM_MCR_DREC\t0x40\n#define\tIDTPHY_REGM_MCR_ECEI\t0x20\n#define\tIDTPHY_REGM_MCR_TDPC\t0x10\n#define\tIDTPHY_REGM_MCR_DRIC\t0x08\n#define\tIDTPHY_REGM_MCR_HALTTX\t0x04\n#define\tIDTPHY_REGM_MCR_BYTEM\t0x02\n#define\tIDTPHY_REGM_MCR_EI\t0x01\n\n#define\tIDTPHY_REGO_ISTAT\t0x01\n#define\tIDTPHY_REGN_ISTAT\t\"Interrupt Status\"\n#define\tIDTPHY_REGX_ISTAT\t\"\\020\\7GOOD\\6HECE\\5SCRE\\4TPE\\3RSCC\\2RSE\\1RFO\"\n#define\tIDTPHY_REGM_ISTAT_GOOD\t0x40\t/* good signal bit */\n#define\tIDTPHY_REGM_ISTAT_HECE\t0x20\t/* HEC error */\n#define\tIDTPHY_REGM_ISTAT_SCRE\t0x10\t/* short cell received error */\n#define\tIDTPHY_REGM_ISTAT_TPE\t0x08\t/* transmit parity error */\n#define\tIDTPHY_REGM_ISTAT_RSCC\t0x04\t/* receive signal condition change */\n#define\tIDTPHY_REGM_ISTAT_RSE\t0x02\t/* receive symbol error */\n#define\tIDTPHY_REGM_ISTAT_RFO\t0x01\t/* read FIFO overrun */\n\n#define\tIDTPHY_REGO_DIAG\t0x02\n#define\tIDTPHY_REGN_DIAG\t\"Diagnostic Control\"\n#define\tIDTPHY_REGX_DIAG\t\"\\020\\010FTD\\7ROS\\6MULTI\\5RFLUSH\\4ITPE\\3IHECE\\11\\3\\0NORM\\11\\3\\2PLOOP\\11\\3\\3LLOOP\"\n#define\tIDTPHY_REGM_DIAG_FTD\t0x80\t/* Force TxClav Deassert */\n#define\tIDTPHY_REGM_DIAG_ROS\t0x40\t/* RxClav Operation Select */\n#define\tIDTPHY_REGM_DIAG_MULTI\t0x20\t/* Multi-phy operation */\n#define\tIDTPHY_REGM_DIAG_RFLUSH\t0x10\t/* clear receive Fifo */\n#define\tIDTPHY_REGM_DIAG_ITPE\t0x08\t/* insert transmit payload error */\n#define\tIDTPHY_REGM_DIAG_IHECE\t0x04\t/* insert transmit HEC error */\n#define\tIDTPHY_REGM_DIAG_LOOP\t0x03\t/* loopback mode */\n#define\tIDTPHY_REGM_DIAG_LOOP_NONE\t0x00\t/* normal */\n#define\tIDTPHY_REGM_DIAG_LOOP_PHY\t0x02\t/* PHY loopback */\n#define\tIDTPHY_REGM_DIAG_LOOP_LINE\t0x03\t/* Line loopback */\n\n#define\tIDTPHY_REGO_LHEC\t0x03\n#define\tIDTPHY_REGN_LHEC\t\"LED Driver and HEC Status/Control\"\n#define\tIDTPHY_REGX_LHEC\t\"\\020\\7DRHEC\\6DTHEC\\11\\x18\\0CYC1\\11\\x18\\1CYC2\\11\\x18\\2CYC4\\11\\x18\\3CYC8\\3FIFOE\\2TXLED\\1RXLED\"\n#define\tIDTPHY_REGM_LHEC_DRHEC\t0x40\t/* disable receive HEC */\n#define\tIDTPHY_REGM_LHEC_DTHEC\t0x20\t/* disable transmit HEC */\n#define\tIDTPHY_REGM_LHEC_RXREF\t0x18\t/* RxRef pulse width */\n#define\tIDTPHY_REGM_LHEC_RXREF1\t0x00\t/* 1 pulse */\n#define\tIDTPHY_REGM_LHEC_RXREF2\t0x08\t/* 2 pulse */\n#define\tIDTPHY_REGM_LHEC_RXREF4\t0x10\t/* 4 pulse */\n#define\tIDTPHY_REGM_LHEC_RXREF8\t0x18\t/* 8 pulse */\n#define\tIDTPHY_REGM_LHEC_FIFOE\t0x04\t/* Fifo empty */\n#define\tIDTPHY_REGM_LHEC_TXLED\t0x02\t/* Tx LED status */\n#define\tIDTPHY_REGM_LHEC_RXLED\t0x01\t/* Rx LED status */\n\n#define\tIDTPHY_REGO_CNT\t\t0x04\t/* +0x05 */\n#define\tIDTPHY_REGN_CNT\t\t\"Counter\"\n\n#define\tIDTPHY_REGO_CNTS\t0x06\n#define\tIDTPHY_REGN_CNTS\t\"Counter select\"\n#define\tIDTPHY_REGX_CNTS\t\"\\020\\4SEC\\3TX\\2RX\\1HECE\"\n#define\tIDTPHY_REGM_CNTS_SEC\t0x08\t/* symbol error counter */\n#define\tIDTPHY_REGM_CNTS_TX\t0x04\t/* Tx cells */\n#define\tIDTPHY_REGM_CNTS_RX\t0x02\t/* Rx cells */\n#define\tIDTPHY_REGM_CNTS_HECE\t0x01\t/* HEC errors */\n\n#define\tIDTPHY_PRINT_77105\t\t\t\t\t\\\n\t{ /* 00 */\t\t\t\t\t\t\\\n\t  UTP_REGT_BITS,\tIDTPHY_REGO_MCR,\t\t\\\n\t  IDTPHY_REGN_MCR,\tIDTPHY_REGX_MCR },\t\t\\\n\t{ /* 01 */\t\t\t\t\t\t\\\n\t  UTP_REGT_BITS,\tIDTPHY_REGO_ISTAT,\t\t\\\n\t  IDTPHY_REGN_ISTAT,\tIDTPHY_REGX_ISTAT },\t\t\\\n\t{ /* 02 */\t\t\t\t\t\t\\\n\t  UTP_REGT_BITS,\tIDTPHY_REGO_DIAG,\t\t\\\n\t  IDTPHY_REGN_DIAG,\tIDTPHY_REGX_DIAG },\t\t\\\n\t{ /* 03 */\t\t\t\t\t\t\\\n\t  UTP_REGT_BITS,\tIDTPHY_REGO_LHEC,\t\t\\\n\t  IDTPHY_REGN_LHEC,\tIDTPHY_REGX_LHEC },\t\t\\\n\t{ /* 04, 05 */\t\t\t\t\t\t\\\n\t  UTP_REGT_INT16,\tIDTPHY_REGO_CNT,\t\t\\\n\t  IDTPHY_REGN_CNT,\tNULL },\t\t\t\t\\\n\t{ /* 06 */\t\t\t\t\t\t\\\n\t  UTP_REGT_BITS,\tIDTPHY_REGO_CNTS,\t\t\\\n\t  IDTPHY_REGN_CNTS,\tIDTPHY_REGX_CNTS }\n\n#define\tIDTPHY_REGO_MRID\t0x00\n#define\tIDTPHY_REGN_MRID\t\"Master Reset & ID\"\n#define\tIDTPHY_REGM_MRID_RESET\t0x80\t/* software reset */\n#define\tIDTPHY_REGM_MRID_TYPE\t0x70\t/* type */\n#define\tIDTPHY_REGM_MRID_155\t0x30\t/* idt77155 type */\n#define\tIDTPHY_REGM_MRID_ID\t0x0f\t/* revision */\n#define\tIDTPHY_REGX_MRID\t\\\n\t    \"\\020\\010mstReset\\12\\x70\\12type\\12\\xf\\12id\"\n\n#define\tIDTPHY_REGO_CONF\t0x01\n#define\tIDTPHY_REGN_CONF\t\"Configuration\"\n#define\tIDTPHY_REGM_CONF_AFEBE\t0x40\t/* autoFEBE */\n#define\tIDTPHY_REGM_CONF_ALRDI\t0x20\t/* autoLRDI */\n#define\tIDTPHY_REGM_CONF_APRDI\t0x10\t/* autoPRDI */\n#define\tIDTPHY_REGM_CONF_TCAIN\t0x08\t/* TCAInv */\n#define\tIDTPHY_REGM_CONF_RCAIN\t0x04\t/* RCAInv */\n#define\tIDTPHY_REGM_CONF_RXDIN\t0x02\t/* RXDInv */\n#define\tIDTPHY_REGM_CONF_RESV\t0x81\n#define\tIDTPHY_REGX_CONF\t\\\n\t    \"\\020\\07autoFEBE\\6autoLRDI\\5autoPRDI\\4TCAInv\\3RCAInv\\2RXDInv\"\n\n#define\tIDTPHY_REGO_INT\t\t0x02\n#define\tIDTPHY_REGN_INT\t\t\"Interrupt\"\n#define\tIDTPHY_REGM_INT_TXOOLI\t0x80\t/* txOOLInt */\n#define\tIDTPHY_REGM_INT_RXLOCI\t0x40\t/* rxLOCInt */\n#define\tIDTPHY_REGM_INT_RXOOLI\t0x20\t/* rxOOLInt */\n#define\tIDTPHY_REGM_INT_TXCDI\t0x10\t/* txCDi */\n#define\tIDTPHY_REGM_INT_RXCDI\t0x08\t/* rxCDi */\n#define\tIDTPHY_REGM_INT_RXPOHI\t0x04\t/* rxPOHi */\n#define\tIDTPHY_REGM_INT_RXLOHI\t0x02\t/* rxLOHi */\n#define\tIDTPHY_REGM_INT_RXSOHI\t0x01\t/* rxSOHi */\n#define\tIDTPHY_REGX_INT\t\t\\\n\t    \"\\020\\10txOOLInt\\7rxLOCInt\\6rxOOLInt\\5txCDi\\4rxCDi\\3rxPOHi\" \\\n\t    \"\\2rxLOHi\\1rxSOHi\"\n\n#define\tIDTPHY_REGO_MCM\t\t0x04\n#define\tIDTPHY_REGN_MCM\t\t\"Master Clock Monitor\"\n#define\tIDTPHY_REGM_MCM_RRCLK\t0x08\t/* rrclkReg */\n#define\tIDTPHY_REGM_MCM_TRCLK\t0x04\t/* trclkReg */\n#define\tIDTPHY_REGM_MCM_RCLK\t0x02\t/* rclkReg */\n#define\tIDTPHY_REGM_MCM_TCLK\t0x01\t/* tclkReg */\n#define\tIDTPHY_REGM_MCM_RESV\t0xf0\n#define\tIDTPHY_REGX_MCM\t\t\\\n\t    \"\\020\\4rrclkReg\\3trclkReg\\2rclkReg\\1tclkReg\"\n\n#define\tIDTPHY_REGO_MCTL\t0x05\n#define\tIDTPHY_REGN_MCTL\t\"Master Control\"\n#define\tIDTPHY_REGM_MCTL_LOCI\t0x80\t/* rxLOCIEn */\n#define\tIDTPHY_REGM_MCTL_LOC\t0x40\t/* LOC */\n#define\tIDTPHY_REGM_MCTL_FIXP\t0x20\t/* txFixptr */\n#define\tIDTPHY_REGM_MCTL_LLOOP\t0x04\t/* txLLoop */\n#define\tIDTPHY_REGM_MCTL_DLOOP\t0x02\t/* rxDLoop */\n#define\tIDTPHY_REGM_MCTL_TLOOP\t0x01\t/* rxLoopT */\n#define\tIDTPHY_REGM_MCTL_RESV\t0x18\n#define\tIDTPHY_REGX_MCTL\t\\\n\t    \"\\020\\10rxLOCIEn\\7LOC\\6txFixptr\\3txLLoop\\2rxDLoop\\1rxLoopT\"\n\n#define\tIDTPHY_REGO_TXC\t\t0x06\n#define\tIDTPHY_REGN_TXC\t\t\"Transmit Clock Synthesis C/S\"\n#define\tIDTPHY_REGM_TXC_TXOOL\t0x08\t/* txOOL */\n#define\tIDTPHY_REGM_TXC_TXOOLI\t0x02\t/* txOOLIEn */\n#define\tIDTPHY_REGM_TXC_TXREF\t0x01\t/* txrefSel */\n#define\tIDTPHY_REGM_TXC_RESV\t0xf4\n#define\tIDTPHY_REGX_TXC\t\t\\\n\t    \"\\020\\4txOOL\\2txOOLIEn\\1txrefSel\"\n\n#define\tIDTPHY_REGO_RXC\t\t0x07\n#define\tIDTPHY_REGN_RXC\t\t\"Receive Clock/Data Recovery C/S\"\n#define\tIDTPHY_REGM_RXC_RXOOL\t0x08\t/* rxOOL */\n#define\tIDTPHY_REGM_RXC_RXOOLI\t0x02\t/* rxOOLIEn */\n#define\tIDTPHY_REGM_RXC_RXREF\t0x01\t/* rxrefSel */\n#define\tIDTPHY_REGM_RXC_RESV\t0xf4\n#define\tIDTPHY_REGX_RXC\t\t\\\n\t    \"\\020\\4rxOOL\\2rxOOLIEn\\1rxrefSel\"\n\n#define\tIDTPHY_REGO_RSOC\t0x10\n#define\tIDTPHY_REGN_RSOC\t\"Receive Overhead Control\"\n#define\tIDTPHY_REGM_RSOC_DSCR\t0x40\t/* scrDis */\n#define\tIDTPHY_REGM_RSOC_FOOF\t0x20\t/* frcOOF */\n#define\tIDTPHY_REGM_RSOC_B1IE\t0x08\t/* B1ErrIEn */\n#define\tIDTPHY_REGM_RSOC_LOSI\t0x04\t/* LOSIEn */\n#define\tIDTPHY_REGM_RSOC_LOFI\t0x02\t/* LOFIEn */\n#define\tIDTPHY_REGM_RSOC_OOFI\t0x01\t/* OOFIEn */\n#define\tIDTPHY_REGM_RSOC_RESV\t0x90\n#define\tIDTPHY_REGX_RSOC\t\\\n\t    \"\\020\\7scrDis\\6frcOOF\\4B1ErrIEn\\3LOSIEn\\2LOFIEn\\1OOFIEn\"\n\n#define\tIDTPHY_REGO_RSOS\t0x11\n#define\tIDTPHY_REGN_RSOS\t\"Receive Overhead Status\"\n#define\tIDTPHY_REGM_RSOS_C1INT\t0x80\t/* C1Int */\n#define\tIDTPHY_REGM_RSOS_B1INT\t0x40\t/* B1ErrInt */\n#define\tIDTPHY_REGM_RSOS_LOSI\t0x20\t/* LOSInt */\n#define\tIDTPHY_REGM_RSOS_LOFI\t0x10\t/* LOFInt */\n#define\tIDTPHY_REGM_RSOS_OOFI\t0x08\t/* OOFInt */\n#define\tIDTPHY_REGM_RSOS_LOS\t0x04\t/* LOS */\n#define\tIDTPHY_REGM_RSOS_LOF\t0x02\t/* LOF */\n#define\tIDTPHY_REGM_RSOS_OOF\t0x01\t/* OOF */\n#define\tIDTPHY_REGX_RSOS\t\\\n\t    \"\\020\\10C1Int\\7B1ErrInt\\6LOSInt\\5LOFInt\\4OOFint\\3LOS\\2LOF\\1OOF\"\n\n#define\tIDTPHY_REGO_BIPC\t0x12\t/* + 0x13 LE */\n#define\tIDTPHY_REGN_BIPC\t\"Receive Section BIP Errors\"\n\n#define\tIDTPHY_REGO_TSOC\t0x14\n#define\tIDTPHY_REGN_TSOC\t\"Transmit Overhead Control\"\n#define\tIDTPHY_REGM_TSOC_DSCR\t0x40\t/* scrDis */\n#define\tIDTPHY_REGM_TSOC_LAISI\t0x01\t/* LAISIns */\n#define\tIDTPHY_REGM_TSOC_RESV\t0xbe\n#define\tIDTPHY_REGX_TSOC\t\\\n\t    \"\\020\\7scrDis\\1LAISIns\"\n\n#define\tIDTPHY_REGO_TSOC2\t0x15\n#define\tIDTPHY_REGN_TSOC2\t\"Transmit Overhead Control 2\"\n#define\tIDTPHY_REGM_TSOC2_LOSI\t0x04\t/* LOSIns */\n#define\tIDTPHY_REGM_TSOC2_B1INV\t0x02\t/* B1Inv */\n#define\tIDTPHY_REGM_TSOC2_IFE\t0x01\t/* frErrIns */\n#define\tIDTPHY_REGM_TSOC2_RESV\t0xf8\n#define\tIDTPHY_REGX_TSOC2\t\\\n\t    \"\\020\\3LOSIns\\2B1Inv\\1frErrIns\"\n\n#define\tIDTPHY_REGO_RLOS\t0x18\n#define\tIDTPHY_REGN_RLOS\t\"Receive Line Overhead Status\"\n#define\tIDTPHY_REGM_RLOS_B2W\t0x80\t/* B2Word */\n#define\tIDTPHY_REGM_RLOS_LAIS\t0x02\t/* LAIS */\n#define\tIDTPHY_REGM_RLOS_LRDI\t0x01\t/* LRDI */\n#define\tIDTPHY_REGM_RLOS_RESV\t0x7c\n#define\tIDTPHY_REGX_RLOS\t\\\n\t    \"\\020\\10B2Word\\2LAIS\\1LRDI\"\n\n#define\tIDTPHY_REGO_RLOI\t0x19\n#define\tIDTPHY_REGN_RLOI\t\"Receive Line Overhead Interrupt\"\n#define\tIDTPHY_REGM_RLOI_LFEBEE\t0x80\t/* LFEBEIEn */\n#define\tIDTPHY_REGM_RLOI_B2EE\t0x40\t/* B2ErrIEn */\n#define\tIDTPHY_REGM_RLOI_LAISE\t0x20\t/* LAISIEn */\n#define\tIDTPHY_REGM_RLOI_LRDIE\t0x10\t/* LRDIIEn */\n#define\tIDTPHY_REGM_RLOI_LFEBEI\t0x08\t/* LFEBEInt */\n#define\tIDTPHY_REGM_RLOI_B2EI\t0x04\t/* B2ErrInt */\n#define\tIDTPHY_REGM_RLOI_LAISI\t0x02\t/* LAISInt */\n#define\tIDTPHY_REGM_RLOI_LRDII\t0x01\t/* LRDIInt */\n#define\tIDTPHY_REGX_RLOI\t\\\n\t    \"\\020\\10LFEBEIEn\\7B2ErrIEn\\6LAISIEn\\5LRDIIEn\\4LFEBEInt\\3B2ErrInt\" \\\n\t    \"\\2LAISInt\\1LRDIInt\"\n\n#define\tIDTPHY_REGO_B2EC\t0x1a\t/* + 0x1b, 0x1c, 20bit LE */\n#define\tIDTPHY_REGN_B2EC\t\"B2 Errors\"\n\n#define\tIDTPHY_REGO_FEBEC\t0x1d\t/* + 0x1e, 0x1f, 20bit LE */\n#define\tIDTPHY_REGN_FEBEC\t\"Line FEBE Errors\"\n\n#define\tIDTPHY_REGO_TLOS\t0x20\n#define\tIDTPHY_REGN_TLOS\t\"Transmit Line Overhead Status\"\n#define\tIDTPHY_REGM_TLOS_LRDI\t0x01\t/* LRDI */\n#define\tIDTPHY_REGM_TLOS_RESV\t0xfe\n#define\tIDTPHY_REGX_TLOS\t\\\n\t    \"\\020\\1LRDI\"\n\n#define\tIDTPHY_REGO_TLOC\t0x21\n#define\tIDTPHY_REGN_TLOC\t\"Transmit Line Overhead Control\"\n#define\tIDTPHY_REGM_TLOC_B2INV\t0x01\t/* B2Inv */\n#define\tIDTPHY_REGM_TLOC_RESV\t0xfe\n#define\tIDTPHY_REGX_TLOC\t\\\n\t    \"\\020\\1B2Inv\"\n\n#define\tIDTPHY_REGO_TK1\t\t0x24\n#define\tIDTPHY_REGN_TK1\t\t\"Transmit K1\"\n\n#define\tIDTPHY_REGO_TK2\t\t0x25\n#define\tIDTPHY_REGN_TK2\t\t\"Transmit K2\"\n\n#define\tIDTPHY_REGO_RK1\t\t0x26\n#define\tIDTPHY_REGN_RK1\t\t\"Receive K1\"\n\n#define\tIDTPHY_REGO_RK2\t\t0x27\n#define\tIDTPHY_REGN_RK2\t\t\"Receive K2\"\n\n#define\tIDTPHY_REGO_RPOS\t0x30\n#define\tIDTPHY_REGN_RPOS\t\"Receive Path Overhead Status\"\n#define\tIDTPHY_REGM_RPOS_LOP\t0x20\t/* LOP */\n#define\tIDTPHY_REGM_RPOS_PAIS\t0x08\t/* PAIS */\n#define\tIDTPHY_REGM_RPOS_PRDI\t0x04\t/* PRDI */\n#define\tIDTPHY_REGM_RPOS_RESV\t0xd3\n#define\tIDTPHY_REGX_RPOS\t\\\n\t    \"\\020\\6LOP\\4PAIS\\3PRDI\"\n\n#define\tIDTPHY_REGO_RPOI\t0x31\n#define\tIDTPHY_REGN_RPOI\t\"Receive Path Overhead Interrupt\"\n#define\tIDTPHY_REGM_RPOI_C2I\t0x80\t/* C2Int */\n#define\tIDTPHY_REGM_RPOI_LOPI\t0x20\t/* LOPInt */\n#define\tIDTPHY_REGM_RPOI_PAISI\t0x08\t/* PAISInt */\n#define\tIDTPHY_REGM_RPOI_PRDII\t0x04\t/* PRDIInt */\n#define\tIDTPHY_REGM_RPOI_B3EI\t0x02\t/* B3ErrInt */\n#define\tIDTPHY_REGM_RPOI_PFEBEI\t0x01\t/* PFEBEInt */\n#define\tIDTPHY_REGM_RPOI_RESV\t0x50\n#define\tIDTPHY_REGX_RPOI\t\\\n\t    \"\\020\\10C2Int\\6LOPInt\\4PAISInt\\3PRDIInt\\2B3ErrInt\\1PFEBEInt\"\n\n#define\tIDTPHY_REGO_RPIE\t0x33\n#define\tIDTPHY_REGN_RPIE\t\"Receive Path Interrupt Enable\"\n#define\tIDTPHY_REGM_RPIE_C2E\t0x80\t/* C2IEn */\n#define\tIDTPHY_REGM_RPIE_LOPE\t0x20\t/* LOPIEn */\n#define\tIDTPHY_REGM_RPIE_PAISE\t0x08\t/* PAISIEn */\n#define\tIDTPHY_REGM_RPIE_PRDIE\t0x04\t/* PRDIIEn */\n#define\tIDTPHY_REGM_RPIE_B3EE\t0x02\t/* B3ErrIEn */\n#define\tIDTPHY_REGM_RPIE_PFEBEE\t0x01\t/* PFEBEIEn */\n#define\tIDTPHY_REGM_RPIE_RESV\t0x50\n#define\tIDTPHY_REGX_RPIE\t\\\n\t    \"\\020\\10CSIEn\\6LOPIEn\\4PAISIEn\\3PRDIIEn\\2B3ErrIEn\\1PFEBEIEn\"\n\n#define\tIDTPHY_REGO_RC2\t\t0x37\n#define\tIDTPHY_REGN_RC2\t\t\"Receive C2\"\n\n#define\tIDTPHY_REGO_B3EC\t0x38\t/* + 0x39, LE, 16bit */\n#define\tIDTPHY_REGN_B3EC\t\"B3 Errors\"\n\n#define\tIDTPHY_REGO_PFEBEC\t0x3a\t/* + 0x3b, LE, 16bit */\n#define\tIDTPHY_REGN_PFEBEC\t\"Path FEBE Errors\"\n\n#define\tIDTPHY_REGO_RPEC\t0x3d\n#define\tIDTPHY_REGN_RPEC\t\"Receive Path BIP Error Control\"\n#define\tIDTPHY_REGM_RPEC_B3C\t0x20\t/* blkBIP */\n#define\tIDTPHY_REGM_RPEC_RESV\t0xdf\n#define\tIDTPHY_REGX_RPEC\t\\\n\t    \"\\020\\6blkBIP\"\n\n#define\tIDTPHY_REGO_TPOC\t0x40\n#define\tIDTPHY_REGN_TPOC\t\"Transmit Path Control\"\n#define\tIDTPHY_REGM_TPOC_B3INV\t0x02\t/* B3Inv */\n#define\tIDTPHY_REGM_TPOC_PAISI\t0x01\t/* PAISIns */\n#define\tIDTPHY_REGM_TPOC_RESC\t0xfc\n#define\tIDTPHY_REGX_TPOC\t\\\n\t   \"\\020\\2B3Inv\\1PAISIns\"\n\n#define\tIDTPHY_REGO_TPTC\t0x41\n#define\tIDTPHY_REGN_TPTC\t\"Transmit Pointer Control\"\n#define\tIDTPHY_REGM_TPTC_FPTR\t0x40\t/* frcPtr */\n#define\tIDTPHY_REGM_TPTC_STUFF\t0x20\t/* stuffCtl */\n#define\tIDTPHY_REGM_TPTC_PTR\t0x10\t/* Ptr */\n#define\tIDTPHY_REGM_TPTC_NDF\t0x08\t/* NDF */\n#define\tIDTPHY_REGM_TPTC_DECP\t0x04\t/* decPtr */\n#define\tIDTPHY_REGM_TPTC_INCP\t0x02\t/* incPtr */\n#define\tIDTPHY_REGM_TPTC_RESV\t0x81\n#define\tIDTPHY_REGX_TPTC\t\\\n\t    \"\\020\\7frcPtr\\6stuffCtl\\5Ptr\\4NDF\\3decPtr\\2incPtr\"\n\n#define\tIDTPHY_REGO_PTRL\t0x45\n#define\tIDTPHY_REGN_PTRL\t\"Transmit Pointer LSB\"\n#define\tIDTPHY_REGX_PTRL\t\\\n\t    \"\\020\\12\\xff\\20arbPtr\"\n\n#define\tIDTPHY_REGO_PTRM\t0x46\n#define\tIDTPHY_REGN_PTRM\t\"Transmit Pointer MSB\"\n#define\tIDTPHY_REGM_PTRM_NDF\t0xf0\t/* NDFVal */\n#define\tIDTPHY_REGS_PTRM_NDF\t4\n#define\tIDTPHY_REGM_PTRM_SS\t0x0c\t/* ssBit */\n#define\tIDTPHY_REGM_PTRM_SONET\t0x00\n#define\tIDTPHY_REGM_PTRM_SDH\t0x08\n#define\tIDTPHY_REGM_PTRM_PTR\t0x03\n#define\tIDTPHY_REGX_PTRM\t\\\n\t    \"\\020\\12\\xf0\\20NDFVal\\12\\xc\\20ssBit\\12\\x3\\20arbPtr\"\n\n#define\tIDTPHY_REGO_TC2\t\t0x48\n#define\tIDTPHY_REGN_TC2\t\t\"Transmit C2\"\n\n#define\tIDTPHY_REGO_TPOC2\t0x49\n#define\tIDTPHY_REGN_TPOC2\t\"Transmit Path Control 2\"\n#define\tIDTPHY_REGM_TPOC2_FEBE\t0xf0\t/* PFEBEIns */\n#define\tIDTPHY_REGS_TPOC2_FEBE\t4\n#define\tIDTPHY_REGM_TPOC2_PRDII\t0x08\t/* PRDIIns */\n#define\tIDTPHY_REGM_TPOC2_G1\t0x07\t/* G1Ins */\n#define\tIDTPHY_REGX_TPOC2\t\\\n\t    \"\\020\\12\\xf0\\20PFEBEIns\\4PRDIIns\\12\\x7\\20G1Ins\"\n\n#define\tIDTPHY_REGO_RCC\t\t0x50\n#define\tIDTPHY_REGN_RCC\t\t\"Receive Cell Control\"\n#define\tIDTPHY_REGM_RCC_OCD\t0x80\t/* OCD */\n#define\tIDTPHY_REGM_RCC_PARTY\t0x40\t/* parity */\n#define\tIDTPHY_REGM_RCC_PASS\t0x20\t/* pass */\n#define\tIDTPHY_REGM_RCC_DCOR\t0x10\t/* corDis */\n#define\tIDTPHY_REGM_RCC_DHEC\t0x08\t/* HECdis */\n#define\tIDTPHY_REGM_RCC_ADD\t0x04\t/* csetAdd */\n#define\tIDTPHY_REGM_RCC_DSCR\t0x02\t/* scrDis */\n#define\tIDTPHY_REGM_RCC_RFIFO\t0x01\t/* rxFIFOrst */\n#define\tIDTPHY_REGX_RCC\t\t\\\n\t    \"\\020\\10OCD\\7parity\\6pass\\5corDis\\4HECdis\\3csetAdd\" \\\n\t    \"\\2scrDis\\1rxFIFOrst\"\n\n#define\tIDTPHY_REGO_RCI\t\t0x51\n#define\tIDTPHY_REGN_RCI\t\t\"Receive Cell Interrupt\"\n#define\tIDTPHY_REGM_RCI_OCDE\t0x80\t/* OCDIEn */\n#define\tIDTPHY_REGM_RCI_HECE\t0x40\t/* HECIEn */\n#define\tIDTPHY_REGM_RCI_OVFE\t0x20\t/* ovfIEn */\n#define\tIDTPHY_REGM_RCI_OCDI\t0x10\t/* OCDInt */\n#define\tIDTPHY_REGM_RCI_CORI\t0x08\t/* corInt */\n#define\tIDTPHY_REGM_RCI_UCORI\t0x04\t/* uncorInt */\n#define\tIDTPHY_REGM_RCI_OVFI\t0x02\t/* ovfInt */\n#define\tIDTPHY_REGM_RCI_RESV\t0x01\n#define\tIDTPHY_REGX_RCI\t\t\\\n\t    \"\\020\\10OCDIEn\\7HECIEn\\6ovfIEn\\5OCDInt\\4corInt\\3uncorInt\\2ovfInt\"\n\n#define\tIDTPHY_REGO_CMH\t\t0x52\n#define\tIDTPHY_REGN_CMH\t\t\"Receive Cell Match Header\"\n#define\tIDTPHY_REGM_CMH_GFC\t0xf0\t/* GFC */\n#define\tIDTPHY_REGS_CMH_GFC\t4\n#define\tIDTPHY_REGM_CMH_PTI\t0x0e\t/* PTI */\n#define\tIDTPHY_REGS_CMH_PTI\t1\n#define\tIDTPHY_REGM_CMH_CLP\t0x01\t/* CLP */\n#define\tIDTPHY_REGX_CMH\t\t\\\n\t    \"\\020\\12\\xf0\\20GFC\\12\\xe\\20PTI\\12\\x1\\20CLP\"\n\n#define\tIDTPHY_REGO_CMHM\t0x53\n#define\tIDTPHY_REGN_CMHM\t\"Receive Cell Match Header Mask\"\n#define\tIDTPHY_REGM_CMHM_GFC\t0xf0\t/* mskGFC */\n#define\tIDTPHY_REGS_CMHM_GFC\t4\n#define\tIDTPHY_REGM_CMHM_PTI\t0x0e\t/* mskPTI */\n#define\tIDTPHY_REGS_CMHM_PTI\t1\n#define\tIDTPHY_REGM_CMHM_CLP\t0x01\t/* mskCLP */\n#define\tIDTPHY_REGX_CMHM\t\\\n\t    \"\\020\\12\\xf0\\20mskGFC\\12\\xe\\20mskPTI\\12\\x1\\20mskCLP\"\n\n#define\tIDTPHY_REGO_CEC\t\t0x54\n#define\tIDTPHY_REGN_CEC\t\t\"Correctable Errors\"\n\n#define\tIDTPHY_REGO_UEC\t\t0x55\n#define\tIDTPHY_REGN_UEC\t\t\"Uncorrectable Errors\"\n\n#define\tIDTPHY_REGO_RCCNT\t0x56\t/* +0x57, 0x58, LE, 19bit */\n#define\tIDTPHY_REGN_RCCNT\t\"Receive Cells\"\n\n#define\tIDTPHY_REGO_RCCF\t0x59\n#define\tIDTPHY_REGN_RCCF\t\"Receive Cell Configuration\"\n#define\tIDTPHY_REGM_RCCF_GFCE\t0xf0\t/* GFCen */\n#define\tIDTPHY_REGS_RCCF_GFCE\t4\n#define\tIDTPHY_REGM_RCCF_FIXS\t0x08\t/* FixSen */\n#define\tIDTPHY_REGM_RCCF_RCAL\t0x04\t/* RCAlevel */\n#define\tIDTPHY_REGM_RCCF_HECF\t0x03\t/* HECftr */\n#define\tIDTPHY_REGX_RCCF\t\\\n\t    \"\\020\\12\\xf0\\20GFCen\\4FixSen\\3RCAlevel\\12\\x3\\20HECftr\"\n\n#define\tIDTPHY_REGO_RXID\t0x5a\n#define\tIDTPHY_REGN_RXID\t\"Receive ID Address\"\n#define\tIDTPHY_REGM_RXID_ID\t0x03\t/* IDAddr */\n#define\tIDTPHY_REGM_RXID_RESV\t0xfc\n#define\tIDTPHY_REGX_RXID\t\\\n\t    \"\\020\\12\\x3\\20IDAddr\"\n\n#define\tIDTPHY_REGO_TCC\t\t0x60\n#define\tIDTPHY_REGN_TCC\t\t\"Transmit Cell Control\"\n#define\tIDTPHY_REGM_TCC_FIFOE\t0x80\t/* fovrIEn */\n#define\tIDTPHY_REGM_TCC_SOCI\t0x40\t/* socInt */\n#define\tIDTPHY_REGM_TCC_FIFOI\t0x20\t/* fovrInt */\n#define\tIDTPHY_REGM_TCC_HECINV\t0x10\t/* HECInv */\n#define\tIDTPHY_REGM_TCC_HECDIS\t0x08\t/* HECDis */\n#define\tIDTPHY_REGM_TCC_ADD\t0x04\t/* csetAdd */\n#define\tIDTPHY_REGM_TCC_DSCR\t0x02\t/* scrDis */\n#define\tIDTPHY_REGM_TCC_FIFOR\t0x01\t/* txFIFOrst */\n#define\tIDTPHY_REGX_TCC\t\t\\\n\t    \"\\020\\10fovrIEn\\7socInt\\6fovrInt\\5HECInv\\4HECDis\\3csetAdd\" \\\n\t    \"\\2scrDis\\1txFIFOrst\"\n\n#define\tIDTPHY_REGO_TCHP\t0x61\n#define\tIDTPHY_REGN_TCHP\t\"Transmit Idle Cell Header\"\n#define\tIDTPHY_REGM_TCHP_GFC\t0xf0\t/* GFCtx */\n#define\tIDTPHY_REGS_TCHP_GFC\t4\n#define\tIDTPHY_REGM_TCHP_PTI\t0x0e\t/* PTItx */\n#define\tIDTPHY_REGS_TCHP_PTI\t1\n#define\tIDTPHY_REGM_TCHP_CLP\t0x01\t/* CLPtx */\n#define\tIDTPHY_REGX_TCHP\t\\\n\t    \"\\020\\12\\xf0\\20GFCtx\\12\\xe\\20PTItx\\12\\x1\\20CLPtx\"\n\n#define\tIDTPHY_REGO_TPLD\t0x62\n#define\tIDTPHY_REGN_TPLD\t\"Transmit Idle Cell Payload\"\n\n#define\tIDTPHY_REGO_TCC2\t0x63\n#define\tIDTPHY_REGN_TCC2\t\"Transmit Cell Configuration 2\"\n#define\tIDTPHY_REGM_TCC2_PARITY\t0x80\t/* parity */\n#define\tIDTPHY_REGM_TCC2_PARE\t0x40\t/* parIEn */\n#define\tIDTPHY_REGM_TCC2_PARI\t0x10\t/* parInt */\n#define\tIDTPHY_REGM_TCC2_FIFO\t0x0c\t/* FIFOdpth */\n#define\tIDTPHY_REGS_TCC2_FIFO\t2\n#define\tIDTPHY_REGM_TCC2_TCAL\t0x02\t/* TCAlevel */\n#define\tIDTPHY_REGM_TCC2_RESV\t0x01\n#define\tIDTPHY_REGX_TCC2\t\\\n\t    \"\\020\\10parity\\7parIEn\\5parInt\\12\\xc\\20FIFOdpth\\2TCAlevel\"\n\n#define\tIDTPHY_REGO_TXCNT\t0x64\t/* +65,66 LE 19bit */\n#define\tIDTPHY_REGN_TXCNT\t\"Transmit Cells\"\n\n#define\tIDTPHY_REGO_TCC3\t0x67\n#define\tIDTPHY_REGN_TCC3\t\"Transmit Cell Configuration 3\"\n#define\tIDTPHY_REGM_TCC3_GFCE\t0xf0\t/* txGFCen */\n#define\tIDTPHY_REGS_TCC3_GFCE\t4\n#define\tIDTPHY_REGM_TCC3_FIXE\t0x08\t/* txFixSen */\n#define\tIDTPHY_REGM_TCC3_H4ID\t0x04\t/* H4InsDis */\n#define\tIDTPHY_REGM_TCC3_FIXB\t0x03\t/* fixByte */\n#define\tIDTPHY_REGM_TCC3_FIX00\t0x00\t/* 0x00 */\n#define\tIDTPHY_REGM_TCC3_FIX55\t0x01\t/* 0x55 */\n#define\tIDTPHY_REGM_TCC3_FIXAA\t0x02\t/* 0xAA */\n#define\tIDTPHY_REGM_TCC3_FIXFF\t0x03\t/* 0xFF */\n#define\tIDTPHY_REGX_TCC3\t\\\n\t    \"\\020\\12\\xf0\\20txGFCen\\4txFixSen\\3H4InsDis\" \\\n\t    \"\\11\\x3\\x0FIX00\\11\\x3\\x1FIX55\\11\\x3\\x2FIXAA\\11\\x3\\x3FIXFF\"\n\n#define\tIDTPHY_REGO_TXID\t0x68\n#define\tIDTPHY_REGN_TXID\t\"Transmit ID Address\"\n#define\tIDTPHY_REGM_TXID_ID\t0x03\t/* txIDAddr */\n#define\tIDTPHY_REGM_TXID_RESV\t0xfc\n#define\tIDTPHY_REGX_TXID\t\\\n\t    \"\\020\\12\\x3\\20txIDAddr\"\n\n#define\tIDTPHY_REGO_RBER\t0x70\n#define\tIDTPHY_REGN_RBER\t\"Receive BER S/C\"\n#define\tIDTPHY_REGM_RBER_FAILE\t0x08\t/* FailIEn */\n#define\tIDTPHY_REGM_RBER_WARNE\t0x04\t/* WarnIEn */\n#define\tIDTPHY_REGM_RBER_FAIL\t0x02\t/* BERfail */\n#define\tIDTPHY_REGM_RBER_WARN\t0x01\t/* BERwarn */\n#define\tIDTPHY_REGM_RBER_RESV\t0xf0\n#define\tIDTPHY_REGX_RBER\t\\\n\t    \"\\020\\4FailIEn\\3WarnIEn\\2BERfail\\1BERwarn\"\n\n#define\tIDTPHY_REGO_BFTH\t0x71\n#define\tIDTPHY_REGN_BFTH\t\"Receive BER Fail Threshold\"\n\n#define\tIDTPHY_REGO_BFWIN\t0x72\n#define\tIDTPHY_REGN_BFWIN\t\"Receive BER Fail Window\"\n\n#define\tIDTPHY_REGO_BFDEN\t0x73\t/* +74, 16bit LE */\n#define\tIDTPHY_REGN_BFDEN\t\"Receive BER Fail Denominator\"\n\n#define\tIDTPHY_REGO_BWTH\t0x75\n#define\tIDTPHY_REGN_BWTH\t\"Receive BER Warn Threshold\"\n\n#define\tIDTPHY_REGO_BWWIN\t0x76\n#define\tIDTPHY_REGN_BWWIN\t\"Receive BER Warn Window\"\n\n#define\tIDTPHY_REGO_BWDEN\t0x77\t/* +78, 16bit LE */\n#define\tIDTPHY_REGN_BWDEN\t\"Receive BER Warn Denomiator\"\n\n#define\tIDTPHY_REGO_OPEC\t0x7f\n#define\tIDTPHY_REGN_OPEC\t\"Output PECL Control\"\n#define\tIDTPHY_REGM_OPEC_TXC\t0x04\t/* pcctl_tc */\n#define\tIDTPHY_REGM_OPEC_TXD\t0x02\t/* pcctl_td */\n#define\tIDTPHY_REGM_OPEC_RXDO\t0x01\t/* pcctl_r */\n#define\tIDTPHY_REGM_OPEC_RESV\t0xf8\n#define\tIDTPHY_REGX_OPEC\t\\\n\t    \"\\020\\3pctl_tc\\2pcctl_td\\1pcctl_r\"\n\n#define\tIDTPHY_PRINT_77155\t\t\t\t\t\\\n\t{ /* 00 */\t\t\t\t\t\t\\\n\t  UTP_REGT_BITS,\tIDTPHY_REGO_MRID,\t\t\\\n\t  IDTPHY_REGN_MRID,\tIDTPHY_REGX_MRID },\t\t\\\n\t{ /* 01 */\t\t\t\t\t\t\\\n\t  UTP_REGT_BITS,\tIDTPHY_REGO_CONF,\t\t\\\n\t  IDTPHY_REGN_CONF,\tIDTPHY_REGX_CONF },\t\t\\\n\t{ /* 02 */\t\t\t\t\t\t\\\n\t  UTP_REGT_BITS,\tIDTPHY_REGO_INT,\t\t\\\n\t  IDTPHY_REGN_INT,\tIDTPHY_REGX_INT },\t\t\\\n\t  /* 03 unused */\t\t\t\t\t\\\n\t{ /* 04 */\t\t\t\t\t\t\\\n\t  UTP_REGT_BITS,\tIDTPHY_REGO_MCM,\t\t\\\n\t  IDTPHY_REGN_MCM,\tIDTPHY_REGX_MCM },\t\t\\\n\t{ /* 05 */\t\t\t\t\t\t\\\n\t  UTP_REGT_BITS,\tIDTPHY_REGO_MCTL,\t\t\\\n\t  IDTPHY_REGN_MCTL,\tIDTPHY_REGX_MCTL },\t\t\\\n\t{ /* 06 */\t\t\t\t\t\t\\\n\t  UTP_REGT_BITS,\tIDTPHY_REGO_TXC,\t\t\\\n\t  IDTPHY_REGN_TXC,\tIDTPHY_REGX_TXC },\t\t\\\n\t{ /* 07 */\t\t\t\t\t\t\\\n\t  UTP_REGT_BITS,\tIDTPHY_REGO_RXC,\t\t\\\n\t  IDTPHY_REGN_RXC,\tIDTPHY_REGX_RXC },\t\t\\\n\t  /* 08-0f unused */\t\t\t\t\t\\\n\t{ /* 10 */\t\t\t\t\t\t\\\n\t  UTP_REGT_BITS,\tIDTPHY_REGO_RSOC,\t\t\\\n\t  IDTPHY_REGN_RSOC,\tIDTPHY_REGX_RSOC },\t\t\\\n\t{ /* 11 */\t\t\t\t\t\t\\\n\t  UTP_REGT_BITS,\tIDTPHY_REGO_RSOS,\t\t\\\n\t  IDTPHY_REGN_RSOS,\tIDTPHY_REGX_RSOS },\t\t\\\n\t{ /* 12, 13 */\t\t\t\t\t\t\\\n\t  UTP_REGT_INT16,\tIDTPHY_REGO_BIPC,\t\t\\\n\t  IDTPHY_REGN_BIPC,\tNULL },\t\t\t\t\\\n\t{ /* 14 */\t\t\t\t\t\t\\\n\t  UTP_REGT_BITS,\tIDTPHY_REGO_TSOC,\t\t\\\n\t  IDTPHY_REGN_TSOC,\tIDTPHY_REGX_TSOC },\t\t\\\n\t{ /* 15 */\t\t\t\t\t\t\\\n\t  UTP_REGT_BITS,\tIDTPHY_REGO_TSOC2,\t\t\\\n\t  IDTPHY_REGN_TSOC2,\tIDTPHY_REGX_TSOC2 },\t\t\\\n\t  /* 16, 17 unused */\t\t\t\t\t\\\n\t{ /* 18 */\t\t\t\t\t\t\\\n\t  UTP_REGT_BITS,\tIDTPHY_REGO_RLOS,\t\t\\\n\t  IDTPHY_REGN_RLOS,\tIDTPHY_REGX_RLOS },\t\t\\\n\t{ /* 19 */\t\t\t\t\t\t\\\n\t  UTP_REGT_BITS,\tIDTPHY_REGO_RLOI,\t\t\\\n\t  IDTPHY_REGN_RLOI,\tIDTPHY_REGX_RLOI },\t\t\\\n\t{ /* 1a-1c */\t\t\t\t\t\t\\\n\t  UTP_REGT_INT20,\tIDTPHY_REGO_B2EC,\t\t\\\n\t  IDTPHY_REGN_B2EC,\tNULL },\t\t\t\t\\\n\t{ /* 1d-1f */\t\t\t\t\t\t\\\n\t  UTP_REGT_INT20,\tIDTPHY_REGO_FEBEC,\t\t\\\n\t  IDTPHY_REGN_FEBEC,\tNULL },\t\t\t\t\\\n\t{ /* 20 */\t\t\t\t\t\t\\\n\t  UTP_REGT_BITS,\tIDTPHY_REGO_TLOS,\t\t\\\n\t  IDTPHY_REGN_TLOS,\tIDTPHY_REGX_TLOS },\t\t\\\n\t{ /* 21 */\t\t\t\t\t\t\\\n\t  UTP_REGT_BITS,\tIDTPHY_REGO_TLOC,\t\t\\\n\t  IDTPHY_REGN_TLOC,\tIDTPHY_REGX_TLOC },\t\t\\\n\t  /* 22, 23 unused */\t\t\t\t\t\\\n\t{ /* 24 */\t\t\t\t\t\t\\\n\t  UTP_REGT_INT8,\tIDTPHY_REGO_TK1,\t\t\\\n\t  IDTPHY_REGN_TK1,\tNULL },\t\t\t\t\\\n\t{ /* 25 */\t\t\t\t\t\t\\\n\t  UTP_REGT_INT8,\tIDTPHY_REGO_TK2,\t\t\\\n\t  IDTPHY_REGN_TK2,\tNULL },\t\t\t\t\\\n\t{ /* 26 */\t\t\t\t\t\t\\\n\t  UTP_REGT_INT8,\tIDTPHY_REGO_RK1,\t\t\\\n\t  IDTPHY_REGN_RK1,\tNULL },\t\t\t\t\\\n\t{ /* 27 */\t\t\t\t\t\t\\\n\t  UTP_REGT_INT8,\tIDTPHY_REGO_RK2,\t\t\\\n\t  IDTPHY_REGN_RK2,\tNULL },\t\t\t\t\\\n\t  /* 28-2f unused */\t\t\t\t\t\\\n\t{ /* 30 */\t\t\t\t\t\t\\\n\t  UTP_REGT_BITS,\tIDTPHY_REGO_RPOS,\t\t\\\n\t  IDTPHY_REGN_RPOS,\tIDTPHY_REGX_RPOS },\t\t\\\n\t{ /* 31 */\t\t\t\t\t\t\\\n\t  UTP_REGT_BITS,\tIDTPHY_REGO_RPOI,\t\t\\\n\t  IDTPHY_REGN_RPOI,\tIDTPHY_REGX_RPOI },\t\t\\\n\t  /* 32 unused */\t\t\t\t\t\\\n\t{ /* 33 */\t\t\t\t\t\t\\\n\t  UTP_REGT_BITS,\tIDTPHY_REGO_RPIE,\t\t\\\n\t  IDTPHY_REGN_RPIE,\tIDTPHY_REGX_RPIE },\t\t\\\n\t  /* 34-36 unused */\t\t\t\t\t\\\n\t{ /* 37 */\t\t\t\t\t\t\\\n\t  UTP_REGT_INT8,\tIDTPHY_REGO_RC2,\t\t\\\n\t  IDTPHY_REGN_RC2,\tNULL },\t\t\t\t\\\n\t{ /* 38-39 */\t\t\t\t\t\t\\\n\t  UTP_REGT_INT16,\tIDTPHY_REGO_B3EC,\t\t\\\n\t  IDTPHY_REGN_B3EC,\tNULL },\t\t\t\t\\\n\t{ /* 3a-3b */\t\t\t\t\t\t\\\n\t  UTP_REGT_INT16,\tIDTPHY_REGO_PFEBEC,\t\t\\\n\t  IDTPHY_REGN_PFEBEC,\tNULL },\t\t\t\t\\\n\t  /* 3c unused */\t\t\t\t\t\\\n\t{ /* 3d */\t\t\t\t\t\t\\\n\t  UTP_REGT_BITS,\tIDTPHY_REGO_RPEC,\t\t\\\n\t  IDTPHY_REGN_RPEC,\tIDTPHY_REGX_RPEC },\t\t\\\n\t  /* 3e, 3f unused */\t\t\t\t\t\\\n\t{ /* 40 */\t\t\t\t\t\t\\\n\t  UTP_REGT_BITS,\tIDTPHY_REGO_TPOC,\t\t\\\n\t  IDTPHY_REGN_TPOC,\tIDTPHY_REGX_TPOC },\t\t\\\n\t{ /* 41 */\t\t\t\t\t\t\\\n\t  UTP_REGT_BITS,\tIDTPHY_REGO_TPTC,\t\t\\\n\t  IDTPHY_REGN_TPTC,\tIDTPHY_REGX_TPTC },\t\t\\\n\t  /* 42-44 unused */\t\t\t\t\t\\\n\t{ /* 45 */\t\t\t\t\t\t\\\n\t  UTP_REGT_BITS,\tIDTPHY_REGO_PTRL,\t\t\\\n\t  IDTPHY_REGN_PTRL,\tIDTPHY_REGX_PTRL },\t\t\\\n\t{ /* 46 */\t\t\t\t\t\t\\\n\t  UTP_REGT_BITS,\tIDTPHY_REGO_PTRM,\t\t\\\n\t  IDTPHY_REGN_PTRM,\tIDTPHY_REGX_PTRM },\t\t\\\n\t  /* 47 unused */\t\t\t\t\t\\\n\t{ /* 48 */\t\t\t\t\t\t\\\n\t  UTP_REGT_INT8,\tIDTPHY_REGO_TC2,\t\t\\\n\t  IDTPHY_REGN_TC2,\tNULL },\t\t\t\t\\\n\t{ /* 49 */\t\t\t\t\t\t\\\n\t  UTP_REGT_BITS,\tIDTPHY_REGO_TPOC2,\t\t\\\n\t  IDTPHY_REGN_TPOC2,\tIDTPHY_REGX_TPOC2 },\t\t\\\n\t  /* 4a-4f unused */\t\t\t\t\t\\\n\t{ /* 50 */\t\t\t\t\t\t\\\n\t  UTP_REGT_BITS,\tIDTPHY_REGO_RCC,\t\t\\\n\t  IDTPHY_REGN_RCC,\tIDTPHY_REGX_RCC },\t\t\\\n\t{ /* 51 */\t\t\t\t\t\t\\\n\t  UTP_REGT_BITS,\tIDTPHY_REGO_RCI,\t\t\\\n\t  IDTPHY_REGN_RCI,\tIDTPHY_REGX_RCI },\t\t\\\n\t{ /* 52 */\t\t\t\t\t\t\\\n\t  UTP_REGT_BITS,\tIDTPHY_REGO_CMH,\t\t\\\n\t  IDTPHY_REGN_CMH,\tIDTPHY_REGX_CMH },\t\t\\\n\t{ /* 53 */\t\t\t\t\t\t\\\n\t  UTP_REGT_BITS,\tIDTPHY_REGO_CMHM,\t\t\\\n\t  IDTPHY_REGN_CMHM,\tIDTPHY_REGX_CMHM },\t\t\\\n\t{ /* 54 */\t\t\t\t\t\t\\\n\t  UTP_REGT_INT8,\tIDTPHY_REGO_CEC,\t\t\\\n\t  IDTPHY_REGN_CEC,\tNULL },\t\t\t\t\\\n\t{ /* 55 */\t\t\t\t\t\t\\\n\t  UTP_REGT_INT8,\tIDTPHY_REGO_UEC,\t\t\\\n\t  IDTPHY_REGN_UEC,\tNULL },\t\t\t\t\\\n\t{ /* 56-58 */\t\t\t\t\t\t\\\n\t  UTP_REGT_INT19,\tIDTPHY_REGO_RCCNT,\t\t\\\n\t  IDTPHY_REGN_RCCNT,\tNULL },\t\t\t\t\\\n\t{ /* 59 */\t\t\t\t\t\t\\\n\t  UTP_REGT_BITS,\tIDTPHY_REGO_RCCF,\t\t\\\n\t  IDTPHY_REGN_RCCF,\tIDTPHY_REGX_RCCF },\t\t\\\n\t{ /* 5a */\t\t\t\t\t\t\\\n\t  UTP_REGT_BITS,\tIDTPHY_REGO_RXID,\t\t\\\n\t  IDTPHY_REGN_RXID,\tIDTPHY_REGX_RXID },\t\t\\\n\t  /* 5b-5f unused */\t\t\t\t\t\\\n\t{ /* 60 */\t\t\t\t\t\t\\\n\t  UTP_REGT_BITS,\tIDTPHY_REGO_TCC,\t\t\\\n\t  IDTPHY_REGN_TCC,\tIDTPHY_REGX_TCC },\t\t\\\n\t{ /* 61 */\t\t\t\t\t\t\\\n\t  UTP_REGT_BITS,\tIDTPHY_REGO_TCHP,\t\t\\\n\t  IDTPHY_REGN_TCHP,\tIDTPHY_REGX_TCHP },\t\t\\\n\t{ /* 62 */\t\t\t\t\t\t\\\n\t  UTP_REGT_INT8,\tIDTPHY_REGO_TPLD,\t\t\\\n\t  IDTPHY_REGN_TPLD,\tNULL },\t\t\t\t\\\n\t{ /* 63 */\t\t\t\t\t\t\\\n\t  UTP_REGT_BITS,\tIDTPHY_REGO_TCC2,\t\t\\\n\t  IDTPHY_REGN_TCC2,\tIDTPHY_REGX_TCC2 },\t\t\\\n\t{ /* 64-66 */\t\t\t\t\t\t\\\n\t  UTP_REGT_INT19,\tIDTPHY_REGO_TXCNT,\t\t\\\n\t  IDTPHY_REGN_TXCNT,\tNULL },\t\t\t\t\\\n\t{ /* 67 */\t\t\t\t\t\t\\\n\t  UTP_REGT_BITS,\tIDTPHY_REGO_TCC3,\t\t\\\n\t  IDTPHY_REGN_TCC3,\tIDTPHY_REGX_TCC3 },\t\t\\\n\t{ /* 68 */\t\t\t\t\t\t\\\n\t  UTP_REGT_BITS,\tIDTPHY_REGO_TXID,\t\t\\\n\t  IDTPHY_REGN_TXID,\tIDTPHY_REGX_TXID },\t\t\\\n\t  /* 69-6f unused */\t\t\t\t\t\\\n\t{ /* 70 */\t\t\t\t\t\t\\\n\t  UTP_REGT_BITS,\tIDTPHY_REGO_RBER,\t\t\\\n\t  IDTPHY_REGN_RBER,\tIDTPHY_REGX_RBER },\t\t\\\n\t{ /* 71 */\t\t\t\t\t\t\\\n\t  UTP_REGT_INT8,\tIDTPHY_REGO_BFTH,\t\t\\\n\t  IDTPHY_REGN_BFTH,\tNULL },\t\t\t\t\\\n\t{ /* 72 */\t\t\t\t\t\t\\\n\t  UTP_REGT_INT8,\tIDTPHY_REGO_BFWIN,\t\t\\\n\t  IDTPHY_REGN_BFWIN,\tNULL },\t\t\t\t\\\n\t{ /* 73,74 */\t\t\t\t\t\t\\\n\t  UTP_REGT_INT16,\tIDTPHY_REGO_BFDEN,\t\t\\\n\t  IDTPHY_REGN_BFDEN,\tNULL },\t\t\t\t\\\n\t{ /* 75 */\t\t\t\t\t\t\\\n\t  UTP_REGT_INT8,\tIDTPHY_REGO_BWTH,\t\t\\\n\t  IDTPHY_REGN_BWTH,\tNULL },\t\t\t\t\\\n\t{ /* 76 */\t\t\t\t\t\t\\\n\t  UTP_REGT_INT8,\tIDTPHY_REGO_BWWIN,\t\t\\\n\t  IDTPHY_REGN_BWWIN,\tNULL },\t\t\t\t\\\n\t{ /* 77,78 */\t\t\t\t\t\t\\\n\t  UTP_REGT_INT16,\tIDTPHY_REGO_BWDEN,\t\t\\\n\t  IDTPHY_REGN_BWDEN,\tNULL },\t\t\t\t\\\n\t  /* 79-7e unused */\t\t\t\t\t\\\n\t{ /* 7f */\t\t\t\t\t\t\\\n\t  UTP_REGT_BITS,\tIDTPHY_REGO_OPEC,\t\t\\\n\t  IDTPHY_REGN_OPEC,\tIDTPHY_REGX_OPEC }\n\n\n#endif\t/* _DEV_UTOPIA_IDTPHY_H */\n"
  },
  {
    "path": "freebsd-headers/dev/utopia/suni.h",
    "content": "/*-\n * Copyright (c) 2003\n *\tFraunhofer Institute for Open Communication Systems (FhG Fokus).\n * \tAll rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * Author: Hartmut Brandt <harti@freebsd.org>\n *\n * $FreeBSD: release/9.0.0/sys/dev/utopia/suni.h 139749 2005-01-06 01:43:34Z imp $\n *\n * Register definitions for the following chips:\n *\tPMC-Sierra PMC-5346 (S/UNI-LITE)\n *\tPMC-Sierra PMC-5350 (S/UNI-ULTRA)\n *\tPMC-Sierra PMC-5355 (S/UNI-622)\n *\n * All definitions ending with _ULTRA are for the ULTRA chip only, all\n * definitions ending with _LITE are for the LITE chip only. Some registers\n * are only in the ULTRA and the definitions are not suffixed. All other\n * definitions are for all chips.\n */\n#ifndef _DEV_UTOPIA_SUNI_H\n#define\t_DEV_UTOPIA_SUNI_H\n\n/* lite, ultra, 622 */\n#define\tSUNI_REGN_MRESET \t\"Master Reset and Identity/Load Meters\"\n#define\tSUNI_REGO_MRESET\t\t0x00\n#define\tSUNI_REGM_MRESET_RESET\t\t0x80\n#define\tSUNI_REGM_MRESET_TYPE\t\t0x70\n#define\tSUNI_REGM_MRESET_TYPE_622\t0x10\n#define\tSUNI_REGM_MRESET_TYPE_LITE\t0x30\n#define\tSUNI_REGM_MRESET_TYPE_ULTRA\t0x70\n#define\tSUNI_REGM_MRESET_TIP_ULTRA\t0x08\n#define\tSUNI_REGM_MRESET_ID_ULTRA\t0x07\n#define\tSUNI_REGM_MRESET_ID_LITE\t0x0f\n#define\tSUNI_REGM_MRESET_ID_622\t\t0x0f\n#define\tSUNI_REGX_MRESET_ULTRA\t\"\\020\\10RESET\\12\\x70\\12TYPE\\4TIP\\12\\7\\12ID\"\n#define\tSUNI_REGX_MRESET_LITE\t\"\\020\\10RESET\\12\\x70\\12TYPE\\12\\xf\\12ID\"\n#define\tSUNI_REGX_MRESET_622\t\"\\020\\10RESET\\12\\x70\\12TYPE\\12\\xf\\12ID\"\n\n/* lite, ultra */\n#define\tSUNI_REGN_MCONFIG \"Master Configuration\"\n#define\tSUNI_REGO_MCONFIG\t\t0x01\n#define\tSUNI_REGM_MCONFIG_AUTOFEBE\t0x40\n#define\tSUNI_REGM_MCONFIG_AUTOLRDI\t0x20\n#define\tSUNI_REGM_MCONFIG_AUTOPRDI\t0x10\n#define\tSUNI_REGM_MCONFIG_TCAINV\t0x08\n#define\tSUNI_REGM_MCONFIG_RCAINV\t0x04\n#define\tSUNI_REGM_MCONFIG_RXDINV_LITE\t0x02\n#define\tSUNI_REGM_MCONFIG_TFP_IN_ULTRA\t0x01\n#define\tSUNI_REGM_MCONFIG_RESERVED\t0x00\n#define\tSUNI_REGX_MCONFIG_LITE \"\\020\\7AUTOFEBE\\6AUTOLRDI\\5AUTOPRDI\\4TCAINV\\3RCAINV\\2RXDINV\"\n#define\tSUNI_REGX_MCONFIG_ULTRA \"\\020\\7AUTOFEBE\\6AUTOLRDI\\5AUTOPRDI\\4TCAINV\\3RCAINV\\1TFPI_IN\"\n\n/* 622 */\n#define\tSUNI_REGM_MCONFIG_TPTBEN_622\t0x80\n#define\tSUNI_REGM_MCONFIG_TSTBEN_622\t0x40\n#define\tSUNI_REGM_MCONFIG_SDH_C1_622\t0x20\n#define\tSUNI_REGM_MCONFIG_FIXPTR_622\t0x10\n#define\tSUNI_REGM_MCONFIG_TMODE_622\t0x0C\n#define\tSUNI_REGM_MCONFIG_TMODE_STS1_BYTE\t0x00\n#define\tSUNI_REGM_MCONFIG_TMODE_STS3c\t\t0x04\n#define\tSUNI_REGM_MCONFIG_TMODE_STS1_BIT\t0x08\n#define\tSUNI_REGM_MCONFIG_TMODE_STS12c\t\t0x0C\n#define\tSUNI_REGM_MCONFIG_RMODE_622\t0x03\n#define\tSUNI_REGM_MCONFIG_RMODE_STS1_BYTE\t0x00\n#define\tSUNI_REGM_MCONFIG_RMODE_STS3c\t\t0x01\n#define\tSUNI_REGM_MCONFIG_RMODE_STS1_BIT\t0x02\n#define\tSUNI_REGM_MCONFIG_RMODE_STS12c\t\t0x03\n#define\tSUNI_REGX_MCONFIG_622\t\"\\020\\10TPTBEN\\7TSTBEN\\6SDH_C1\\5FIXPTR\\11\\x0C\\0x00XSTS1BYTE\\11\\0x0C\\0x04XSTS3c\\11\\0x0C\\0x08XSTS1BIT\\11\\0x0C\\0x0CXSTS12c\\11\\0x03\\0x00RSTS1BYTE\\11\\0x03\\0x01RSTS3c\\11\\0x03\\0x02RSTS1BIT\\11\\0x03\\0x03RSTS12c\"\n\n/* lite, ultra, 622 */\n#define\tSUNI_REGN_MISTATUS \"Master Interrupt Status\"\n#define\tSUNI_REGO_MISTATUS\t\t0x02\n#define\tSUNI_REGM_MISTATUS_CSUI_ULTRA\t0x80\n#define\tSUNI_REGM_MISTATUS_TROOLI_LITE\t0x80\n#define\tSUNI_REGM_MISTATUS_SUNII_622\t0x80\n#define\tSUNI_REGM_MISTATUS_LCDI\t\t0x40\n#define\tSUNI_REGM_MISTATUS_STBI_622\t0x40\n#define\tSUNI_REGM_MISTATUS_CRUI_ULTRA\t0x20\n#define\tSUNI_REGM_MISTATUS_RDOOLI_LITE\t0x20\n#define\tSUNI_REGM_MISTATUS_RESERVED_622\t0x20\n#define\tSUNI_REGM_MISTATUS_TACPI\t0x10\n#define\tSUNI_REGM_MISTATUS_RACPI\t0x08\n#define\tSUNI_REGM_MISTATUS_RPOPI\t0x04\n#define\tSUNI_REGM_MISTATUS_RLOPI\t0x02\n#define\tSUNI_REGM_MISTATUS_RSOPI\t0x01\n#define\tSUNI_REGX_MISTATUS_LITE \"\\020\\10TROOLI\\7LCDI\\6RDOOLI\\5TACPI\\4RACPI\\3RPOPI\\2RLOPI\\1RSOPI\"\n#define\tSUNI_REGX_MISTATUS_ULTRA \"\\020\\10CSUI\\7LCDI\\6CRUI\\5TACPI\\4RACPI\\3RPOPI\\2RLOPI\\1RSOPI\"\n#define\tSUNI_REGX_MISTATUS_622\t\"\\020\\10S/UNII\\7STBI\\5TACPI\\4RACPI\\3RPOPI\\2RLOPI\\1RSOPI\"\n\n/* ultra */\n#define\tSUNI_REGN_MMCTRL\t\"Master Mode Control\"\n#define\tSUNI_REGO_MMCTRL\t\t0x03\n#define\tSUNI_REGM_MMCTRL_51\t\t0x02\n#define\tSUNI_REGM_MMCTRL_155\t\t0x03\n#define\tSUNI_REGX_MMCTRL\t\"\\020\\11\\3\\00251MBIT\\11\\3\\003155MBIT\"\n\n/* 622 */\n#define\tSUNI_REGN_PISO\t\t\"PISO Interrupt\"\n#define\tSUNI_REGO_PISO\t\t\t0x03\n#define\tSUNI_REGM_PISO_PAEE\t\t0x02\n#define\tSUNI_REGM_PISO_PAEI\t\t0x01\n#define\tSUNI_REGX_PISO\t\t\"\\020\\2PAEE\\1PAEI\"\n\n/* ultra/lite */\n#define\tSUNI_REGN_MCLKM\t\t\"Master Clock Monitor\"\n#define\tSUNI_REGO_MCLKM\t\t\t0x04\n#define\tSUNI_REGM_MCLKM_RFCLKA\t\t0x10\t/* ultra */\n#define\tSUNI_REGM_MCLKM_TFCLKA\t\t0x08\t/* ultra */\n#define\tSUNI_REGM_MCLKM_RRCLKA\t\t0x08\t/* lite */\n#define\tSUNI_REGM_MCLKM_REFCLKA\t\t0x04\t/* ultra */\n#define\tSUNI_REGM_MCLKM_TRCLKA\t\t0x04\t/* lite */\n#define\tSUNI_REGM_MCLKM_RCLKA\t\t0x02\n#define\tSUNI_REGM_MCLKM_TCLKA\t\t0x01\n#define\tSUNI_REGX_MCLKM_LITE\t\"\\020\\4RRCLKA\\3TRCLKA\\2RCLKA\\1TCLKA\"\n#define\tSUNI_REGX_MCLKM_ULTRA\t\"\\020\\5RFCLKA\\4TFCLKA\\3REFCLKA\\2RCLKA\\1TCLKA\"\n\n/* 622 */\n#define\tSUNI_REGN_MCTRLM\t\"Master Control/Monitor\"\n#define\tSUNI_REGO_MCTRLM\t\t0x04\n#define\tSUNI_REGM_MCTRLM_TCAINV\t\t0x80\n#define\tSUNI_REGM_MCTRLM_RCAINV\t\t0x40\n#define\tSUNI_REGM_MCTRLM_LLE\t\t0x20\n#define\tSUNI_REGM_MCTRLM_DLE\t\t0x10\n#define\tSUNI_REGM_MCTRLM_LOOPT\t\t0x08\n#define\tSUNI_REGM_MCTRLM_DPLE\t\t0x04\n#define\tSUNI_REGM_MCTRLM_PICLKA\t\t0x02\n#define\tSUNI_REGM_MCTRLM_TCLKA\t\t0x01\n#define\tSUNI_REGX_MCTRLM\t\"\\020\\10TCAINV\\7RCAINV\\6LLE\\5DLE\\4LOOPT\\3DPLE\\2PICLKA\\1TCLKA\"\n\n/* ultra/lite */\n#define\tSUNI_REGN_MCTRL\t\t\"Master Control\"\n#define\tSUNI_REGO_MCTRL\t\t\t0x05\n#define\tSUNI_REGM_MCTRL_LCDE\t\t0x80\n#define\tSUNI_REGM_MCTRL_LCDV\t\t0x40\n#define\tSUNI_REGM_MCTRL_FIXPTR\t\t0x20\n#define\tSUNI_REGM_MCTRL_TPLE\t\t0x10\t/* ultra */\n#define\tSUNI_REGM_MCTRL_PDLE\t\t0x08\t/* ultra */\n#define\tSUNI_REGM_MCTRL_LLE\t\t0x04\n#define\tSUNI_REGM_MCTRL_SDLE\t\t0x02\t/* ultra */\n#define\tSUNI_REGM_MCTRL_DLE\t\t0x02\t/* lite */\n#define\tSUNI_REGM_MCTRL_LOOPT\t\t0x01\n#define\tSUNI_REGX_MCTRL_ULTRA\t\"\\020\\10LCDE\\7LCDV\\6FIXPTR\\5TPLE\\4PDLE\\3LLE\\2SDLE\\1LOOPT\"\n#define\tSUNI_REGX_MCTRL_LITE\t\"\\020\\10LCDE\\7LCDV\\6FIXPTR\\3LLE\\2DLE\\1LOOPT\"\n\n/* 622 */\n#define\tSUNI_REGN_MALARM\t\"Master Auto Alarm\"\n#define\tSUNI_REGO_MALARM\t\t0x05\n#define\tSUNI_REGM_MALARM_AUTOFEBE\t0x04\n#define\tSUNI_REGM_MALARM_AUTOLRDI\t0x02\n#define\tSUNI_REGM_MALARM_AUTOPRDI\t0x01\n#define\tSUNI_REGX_MALARM\t\"\\020\\4AUTOFEBE\\2AUTOLRDI\\1AUTOPRDI\"\n\n/* ultra/lite */\n#define\tSUNI_REGN_CLKSYN\t\"Clock Synthesis Control and Status\"\n#define\tSUNI_REGO_CLKSYN\t\t0x06\n#define\tSUNI_REGM_CLKSYN_TROOLI\t\t0x20\t/* ultra */\n#define\tSUNI_REGM_CLKSYN_TROOLV\t\t0x08\n#define\tSUNI_REGM_CLKSYN_TROOLE\t\t0x02\n#define\tSUNI_REGM_CLKSYN_TREFSEL\t0x01\t/* lite */\n#define\tSUNI_REGM_CLKSYN_RESERVED\t0x00\n#define\tSUNI_REGX_CLKSYN_ULTRA\t\"\\020\\6TROOLI\\4TROOLV\\2TROOLE\"\n#define\tSUNI_REGX_CLKSYN_LITE\t\"\\020\\4TROOLV\\2TROOLE\\1TREFSEL\"\n\n/* 622 */\n#define\tSUNI_REGN_POUT\t\"Parallel Output Port\"\n#define\tSUNI_REGO_POUT\t\t\t0x06\n#define\tSUNI_REGM_POUT_POP\t\t0x3f\n#define\tSUNI_REGX_POUT\t\"\\020\\12\\x3f\\12POP\"\n\n/* ultra/lite */\n#define\tSUNI_REGN_CLKREC \"Clock Recovery Control and Status\"\n#define\tSUNI_REGO_CLKREC_LITE\t\t0x07\n#define\tSUNI_REGO_CLKREC_ULTRA\t\t0x08\n#define\tSUNI_REGM_CLKREC_RROOLI\t\t0x40\t/* ultra */\n#define\tSUNI_REGM_CLKREC_RDOOLI\t\t0x20\t/* ultra */\n#define\tSUNI_REGM_CLKREC_RROOLV\t\t0x10\n#define\tSUNI_REGM_CLKREC_RDOOLV\t\t0x08\n#define\tSUNI_REGM_CLKREC_RROOLE\t\t0x04\t/* ultra */\n#define\tSUNI_REGM_CLKREC_RDOOLE\t\t0x02\n#define\tSUNI_REGM_CLKREC_RREFSEL\t0x01\t/* lite */\n#define\tSUNI_REGM_CLKREC_RESERVED\t0x00\n#define\tSUNI_REGX_CLKREC_ULTRA \"\\020\\7RROOLI\\6RDOOLI\\5RROOLV\\4RDOOLV\\3RROOLE\\2RDOOLE\"\n#define\tSUNI_REGX_CLKREC_LITE \"\\020\\5RROOLV\\4RDOOLV\\2RDOOLE\\1RREFSEL\"\n\n/* 622 */\n#define\tSUNI_REGN_PIN\t\"Parallel Input Port\"\n#define\tSUNI_REGO_PIN\t\t\t0x07\n\n/* 622 */\n#define\tSUNI_REGN_PINV\t\"Parallel Input Port Value\"\n#define\tSUNI_REGO_PINV\t\t\t0x08\n#define\tSUNI_REGM_PINV_PIPV\t\t0x0f\n#define\tSUNI_REGX_PINV\t\"\\020\\12\\0x0f\\12PIPIV\"\n\n/* ultra */\n#define\tSUNI_REGN_CLKRECCFG\t\"Clock Recovery Configuration\"\n#define\tSUNI_REGO_CLKRECCFG\t\t0x09\n#define\tSUNI_REGM_CLKRECCFG_RESERVED\t0x07\n#define\tSUNI_REGX_CLKRECCFG\t\"\\020\"\n\n/* 622 */\n#define\tSUNI_REGN_PINE\t\"Parallel Input Port Enable\"\n#define\tSUNI_REGO_PINE\t\t\t0x09\n\n/* ultra */\n#define\tSUNI_REGN_LTXCFG1 \"Line Transmitter Configuration 1\"\n#define\tSUNI_REGO_LTXCFG1\t\t0x0A\n#define\tSUNI_REGM_LTXCFG1_VREFSEL\t0x80\n#define\tSUNI_REGM_LTXCFG1_OEN\t\t0x20\n#define\tSUNI_REGM_LTXCFG1_OTQ\t\t0x10\n#define\tSUNI_REGM_LTXCFG1_RESERVED\t0x0C\n#define\tSUNI_REGX_LTXCFG1 \"\\020\\10VREFSEL\\6OEN\\5OTQ\"\n\n/* 622 */\n#define\tSUNI_REGN_XC1\t\"Transmit C1\"\n#define\tSUNI_REGO_XC1\t\t\t0x0A\n\n/* ultra */\n#define\tSUNI_REGN_LTXCFG2 \"Line Transmitter Configuration 2\"\n#define\tSUNI_REGO_LTXCFG2\t\t0x0B\n#define\tSUNI_REGM_LTXCFG2_RESERVED\t0xFF\n#define\tSUNI_REGX_LTXCFG2 \"\\020\"\n\n/* 622 */\n#define\tSUNI_REGN_APSCS\t\"APS Control/Status\"\n#define\tSUNI_REGO_APSCS\t\t\t0x0B\n#define\tSUNI_REGM_APSCS_PSBFE\t\t0x80\n#define\tSUNI_REGM_APSCS_COAPSE\t\t0x40\n#define\tSUNI_REGM_APSCS_Z1E\t\t0x20\n#define\tSUNI_REGM_APSCS_Zi1\t\t0x10\n#define\tSUNI_REGM_APSCS_PSBFI\t\t0x08\n#define\tSUNI_REGM_APSCS_COAPSI\t\t0x04\n#define\tSUNI_REGM_APSCS_RESERVED\t0x02\n#define\tSUNI_REGM_APSCS_PSBFV\t\t0x01\n#define\tSUNI_REGX_APSCS\t\"\\020\\10PSBFE\\7COAPSE\\6Z1E\\5Z1I\\4PSBFI\\3COAPSI\\1PSBFV\"\n\n/* ultra */\n#define\tSUNI_REGN_LRXCFG \"Line Receiver Configuration\"\n#define\tSUNI_REGO_LRXCFG\t\t0x0C\n#define\tSUNI_REGM_LRXCFG_RESERVED\t0x01\n#define\tSUNI_REGX_LRXCFG \"\\020\"\n\n/* 622 */\n#define\tSUNI_REGN_RK1\t\"Receive K1\"\n#define\tSUNI_REGO_RK1\t\t\t0x0C\n\n/* 622 */\n#define\tSUNI_REGN_RK2\t\"Receive K2\"\n#define\tSUNI_REGO_RK2\t\t\t0x0D\n\n/* 622 */\n#define\tSUNI_REGN_RZ1\t\"Receive Z1\"\n#define\tSUNI_REGO_RZ1\t\t\t0x0E\n\n/* 622 */\n#define\tSUNI_REGN_XZ1\t\"Transmit Z1\"\n#define\tSUNI_REGO_XZ1\t\t\t0x0F\n\n/* lite, ultra, 622 */\n#define\tSUNI_REGN_RSOPCIE \"RSOP Control/Interrupt Enable\"\n#define\tSUNI_REGO_RSOPCIE\t\t0x10\n#define\tSUNI_REGO_RSOPCIE_BIPWORD_622\t0x80\n#define\tSUNI_REGM_RSOPCIE_DDS\t\t0x40\n#define\tSUNI_REGM_RSOPCIE_FOOF\t\t0x20\n#define\tSUNI_REGM_RSOPCIE_RESV\t\t0x10\n#define\tSUNI_REGM_RSOPCIE_ALGO2_622\t0x10\n#define\tSUNI_REGM_RSOPCIE_BIPEE\t\t0x08\n#define\tSUNI_REGM_RSOPCIE_LOSE\t\t0x04\n#define\tSUNI_REGM_RSOPCIE_LOFE\t\t0x02\n#define\tSUNI_REGM_RSOPCIE_OOFE\t\t0x01\n#define\tSUNI_REGX_RSOPCIE\t\"\\020\\7DDS\\6FOOF\\4BIPEE\\3LOSE\\2LOFE\\1OOFE\"\n#define\tSUNI_REGX_RSOPCIE_622\t\"\\020\\10BIPWORD\\7DDS\\6FOOF\\5ALGO2\\4BIPEE\\3LOSE\\2LOFE\\1OOFE\"\n\n/* lite, ultra, 622 */\n#define\tSUNI_REGN_RSOPSIS \"RSOP Status/Interrupt Status\"\n#define\tSUNI_REGO_RSOPSIS\t\t0x11\n#define\tSUNI_REGM_RSOPSIS_BIPEI\t\t0x40\n#define\tSUNI_REGM_RSOPSIS_LOSI\t\t0x20\n#define\tSUNI_REGM_RSOPSIS_LOFI\t\t0x10\n#define\tSUNI_REGM_RSOPSIS_OOFI\t\t0x08\n#define\tSUNI_REGM_RSOPSIS_LOSV\t\t0x04\n#define\tSUNI_REGM_RSOPSIS_LOFV\t\t0x02\n#define\tSUNI_REGM_RSOPSIS_OOFV\t\t0x01\n#define\tSUNI_REGX_RSOPSIS \"\\020\\7BIPEI\\6LOSI\\5LOFI\\4OOFI\\3LOSV\\2LOFV\\1OOFV\"\n\n/* lite, ultra, 622 */\n#define\tSUNI_REGN_RSOP_BIP8 \"RSOP Section BIP-8\"\n#define\tSUNI_REGO_RSOP_BIP8\t\t0x12\t/* +0x13 */\n\n/* lite, ultra, 622 */\n#define\tSUNI_REGN_TSOPCTRL \"TSOP Control\"\n#define\tSUNI_REGO_TSOPCTRL\t\t0x14\n#define\tSUNI_REGM_TSOPCTRL_DS\t\t0x40\n#define\tSUNI_REGM_TSOPCTRL_LAIS\t\t0x01\n#define\tSUNI_REGM_TSOPCTRL_RESERVED\t0x00\n#define\tSUNI_REGX_TSOPCTRL \"\\020\\7DS\\1LAIS\"\n\n/* lite, ultra, 622 */\n#define\tSUNI_REGN_TSOPDIAG \"TSOP Diagnostics\"\n#define\tSUNI_REGO_TSOPDIAG\t\t0x15\n#define\tSUNI_REGM_TSOPDIAG_DLOS\t\t0x04\n#define\tSUNI_REGM_TSOPDIAG_DBIP8\t0x02\n#define\tSUNI_REGM_TSOPDIAG_DFP\t\t0x01\n#define\tSUNI_REGX_TSOPDIAG \"\\020\\3DLOS\\2DBIP8\\1DFP\"\n\n/* lite, ultra, 622 */\n#define\tSUNI_REGN_RLOPCTRL \"RLOP Control/Status\"\n#define\tSUNI_REGO_RLOPCTRL\t\t0x18\n#define\tSUNI_REGO_RLOPCTRL_BIPWORD\t0x80\n#define\tSUNI_REGO_RLOPCTRL_ALLONES_622\t0x40\n#define\tSUNI_REGO_RLOPCTRL_AISDET_622\t0x20\n#define\tSUNI_REGO_RLOPCTRL_LRDIDET_622\t0x10\n#define\tSUNI_REGO_RLOPCTRL_BIPWORDO_622\t0x08\n#define\tSUNI_REGO_RLOPCTRL_LAISV\t0x02\n#define\tSUNI_REGO_RLOPCTRL_RDIV\t\t0x01\n#define\tSUNI_REGO_RLOPCTRL_RESERVED\t0x00\n#define\tSUNI_REGX_RLOPCTRL\t\"\\020\\10BIPWORD\\2LAISV\\1RDIV\"\n#define\tSUNI_REGX_RLOPCTRL_622\t\"\\020\\10BIPWORD\\7ALLONES\\6AISDET\\5LRDIDET\\4BIPWORDO\\2LAISV\\1RDIV\"\n\n/* lite, ultra, 622 */\n#define\tSUNI_REGN_RLOPINTR \"RLOP Interrupt Enable/Interrupt Status\"\n#define\tSUNI_REGO_RLOPINTR\t\t0x19\n#define\tSUNI_REGO_RLOPINTR_FEBEE\t0x80\n#define\tSUNI_REGO_RLOPINTR_BIPEE\t0x40\n#define\tSUNI_REGO_RLOPINTR_LAISE\t0x20\n#define\tSUNI_REGO_RLOPINTR_RDIE\t\t0x10\n#define\tSUNI_REGO_RLOPINTR_FEBEI\t0x08\n#define\tSUNI_REGO_RLOPINTR_BIPEI\t0x04\n#define\tSUNI_REGO_RLOPINTR_LAISI\t0x02\n#define\tSUNI_REGO_RLOPINTR_RDII\t\t0x01\n#define\tSUNI_REGX_RLOPINTR \"\\020\\10FEBEE\\7BIPEE\\6LAISE\\5DRIE\\4FEBEI\\3BIPEI\\2LAISI\\1RDII\"\n\n/* lite, ultra */\n#define\tSUNI_REGN_RLOPBIP8_24 \"RLOP Line BIP-8/24\"\n#define\tSUNI_REGO_RLOPBIP8_24\t\t0x1A\t/* +1B,1C */\n#define\tSUNI_REGM_RLOPBIP8_24\t\t0x0F\n\n/* 622 */\n#define\tSUNI_REGN_RLOPBIP8_24_96 \"RLOP Line BIP-8/24/96\"\n#define\tSUNI_REGO_RLOPBIP8_24_96\t0x1A\t/* +1B,1C */\n#define\tSUNI_REGM_RLOPBIP8_24_96\t0x0F\n\n/* lite, ultra, 622 */\n#define\tSUNI_REGN_RLOPFEBE \"RLOP Line FEBE\"\n#define\tSUNI_REGO_RLOPFEBE\t\t0x1D\t/* +1E,1F */\n#define\tSUNI_REGM_RLOPFEBE\t\t0x0F\n\n/* lite, ultra, 622 */\n#define\tSUNI_REGN_TLOPCTRL \"TLOP Control\"\n#define\tSUNI_REGO_TLOPCTRL\t\t0x20\n#define\tSUNI_REGM_TLOPCTRL_APSREG_622\t0x20\n#define\tSUNI_REGM_TLOPCTRL_RDI\t\t0x01\n#define\tSUNI_REGM_TLOPCTRL_RESERVED\t0x00\n#define\tSUNI_REGX_TLOPCTRL\t\"\\020\\1RDI\"\n#define\tSUNI_REGX_TLOPCTRL_622\t\"\\020\\6APSREG\\1LRDI\"\n\n/* lite, ultra, 622 */\n#define\tSUNI_REGN_TLOPDIAG \"TLOP Diagnostics\"\n#define\tSUNI_REGO_TLOPDIAG\t\t0x21\n#define\tSUNI_REGM_TLOPDIAG_DBIP\t\t0x01\n#define\tSUNI_REGX_TLOPDIAG \"\\020\\1DBIP\"\n\n/* 622 */\n#define\tSUNI_REGN_TLOP_XK1\t\"TLOP Transmit K1\"\n#define\tSUNI_REGO_TLOP_XK1\t\t0x22\n\n/* 622 */\n#define\tSUNI_REGN_TLOP_XK2\t\"TLOP Transmit K2\"\n#define\tSUNI_REGO_TLOP_XK2\t\t0x23\n\n/* 622 */\n#define\tSUNI_REGN_SSTBCTRL\t\"SSTB Control\"\n#define\tSUNI_REGO_SSTBCTRL\t\t0x28\n#define\tSUNI_REGM_SSTBCTRL_RRAMACC\t0x40\n#define\tSUNI_REGM_SSTBCTRL_RTIUIE\t0x20\n#define\tSUNI_REGM_SSTBCTRL_RTIMIE\t0x10\n#define\tSUNI_REGM_SSTBCTRL_PER5\t\t0x08\n#define\tSUNI_REGM_SSTBCTRL_TNULL\t0x04\n#define\tSUNI_REGM_SSTBCTRL_NOSYNC\t0x02\n#define\tSUNI_REGM_SSTBCTRL_LEN16\t0x01\n#define\tSUNI_REGX_SSTBCTRL\t\"\\020\\7RRAMACC\\6RTIUIE\\5RTIMIE\\4PER5\\3TNULL\\2NOSYNC\\1LEN16\"\n\n/* 622 */\n#define\tSUNI_REGN_SSTBSTIS\t\"SSTB Section Trace Identifier Status\"\n#define\tSUNI_REGO_SSTBSTIS\t\t0x29\n#define\tSUNI_REGM_SSTBSTIS_BUSY\t\t0x80\n#define\tSUNI_REGM_SSTBSTIS_RTIUI\t0x08\n#define\tSUNI_REGM_SSTBSTIS_RTIUV\t0x04\n#define\tSUNI_REGM_SSTBSTIS_RTIMI\t0x02\n#define\tSUNI_REGM_SSTBSTIS_RTIMV\t0x01\n#define\tSUNI_REGX_SSTBSTIS\t\"\\020\\10BUSY\\4RTIUI\\3RTIUV\\2RTIMI\\1RTIMV\"\n\n/* 622 */\n#define\tSUNI_REGN_SSTBIAR\t\"SSTB Indirect Address Register\"\n#define\tSUNI_REGO_SSTBIAR\t\t0x2A\n#define\tSUNI_REGM_SSTBIAR_RWB\t\t0x80\n#define\tSUNI_REGM_SSTBIAR_A\t\t0x7F\n#define\tSUNI_REGX_SSTBIAR\t\"\\020\\10RWB\\12\\x7f\\20\"\n\n/* 622 */\n#define\tSUNI_REGN_SSTBIDR\t\"SSTB Indirect Data Register\"\n#define\tSUNI_REGO_SSTBIDR\t\t0x2B\n\n#if 0\t/* see chip errata */\n/* 622 */\n#define\tSUNI_REGN_SSTBECSM\t\"SSTB Expected Clock Synchronization Message\"\n#define\tSUNI_REGO_SSTBECSM\t\t0x2C\n#endif\n\n/* 622 */\n#define\tSUNI_REGN_SSTBCSMS\t\"SSTB Clock Synchronisation Message Status\"\n#define\tSUNI_REGO_SSTBCSMS\t\t0x2D\n#define\tSUNI_REGM_SSTBCSMS_RCSMUIE\t0x80\n#define\tSUNI_REGM_SSTBCSMS_RCSMMIE\t0x40\n#define\tSUNI_REGM_SSTBCSMS_RCSMUI\t0x08\n#define\tSUNI_REGM_SSTBCSMS_RCSMUV\t0x04\n#define\tSUNI_REGM_SSTBCSMS_RCSMMI\t0x02\n#define\tSUNI_REGM_SSTBCSMS_RCSMMV\t0x01\n#define\tSUNI_REGX_SSTBCSMS\t\"\\020\\10RCSMUIE\\7RCSMMIE\\4RCSMUI\\3RCSMUV\\2RCSMMI\\1RCSMMV\"\n\n/* lite, ultra, 622 */\n#define\tSUNI_REGN_RPOPCTRL\t\"RPOP Status/Control\"\n#define\tSUNI_REGO_RPOPCTRL\t\t0x30\n#define\tSUNI_REGM_RPOPCTRL_LOP\t\t0x20\n#define\tSUNI_REGM_RPOPCTRL_PAIS\t\t0x08\n#define\tSUNI_REGM_RPOPCTRL_PRDI\t\t0x04\n#define\tSUNI_REGM_RPOPCTRL_NEWPTRI_622\t0x02\n#define\tSUNI_REGM_RPOPCTRL_NEWPTRE_622\t0x01\n#define\tSUNI_REGM_RPOPCTRL_RESERVED\t0x00\n#define\tSUNI_REGX_RPOPCTRL\t\"\\020\\6LOP\\4PAIS\\3PRDI\"\n#define\tSUNI_REGX_RPOPCTRL_622\t\"\\020\\6LOP\\4PAIS\\3PRDI\\2NEWPTRI\\1NEWPTRE\"\n\n/* lite, ultra, 622 */\n#define\tSUNI_REGN_RPOPISTAT\t\"RPOP Interrupt Status\"\n#define\tSUNI_REGO_RPOPISTAT\t\t0x31\n#define\tSUNI_REGM_RPOPISTAT_PSLI\t0x80\n#define\tSUNI_REGM_RPOPISTAT_LOPI\t0x20\n#define\tSUNI_REGM_RPOPISTAT_PAISI\t0x08\n#define\tSUNI_REGM_RPOPISTAT_PRDII\t0x04\n#define\tSUNI_REGM_RPOPISTAT_BIPEI\t0x02\n#define\tSUNI_REGM_RPOPISTAT_FEBEI\t0x01\n#define\tSUNI_REGX_RPOPISTAT\t\"\\02010PSLI\\6LOPI\\4PAISI\\3PRDII\\2BIPEI\\1FEBEI\"\n\n/* 622 */\n#define\tSUNI_REGN_RPOPPIS\t\"RPOP Pointer Interrupt Status\"\n#define\tSUNI_REGO_RPOPPIS\t\t0x32\n#define\tSUNI_REGM_RPOPPIS_ILLJREQI\t0x80\n#define\tSUNI_REGM_RPOPPIS_DISCOPAI\t0x20\n#define\tSUNI_REGM_RPOPPIS_INVNDFI\t0x10\n#define\tSUNI_REGM_RPOPPIS_ILLPTRI\t0x08\n#define\tSUNI_REGM_RPOPPIS_NSEI\t\t0x04\n#define\tSUNI_REGM_RPOPPIS_PSEI\t\t0x02\n#define\tSUNI_REGM_RPOPPIS_NDFI\t\t0x01\n#define\tSUNI_REGX_RPOPPIS\t\"\\020\\10ILLJREQI\\6DISCOPAI\\5INVNDFI\\4ILLPTRI\\3NSEI\\2PSEI\\1NDFI\"\n\n/* lite, ultra, 622 */\n#define\tSUNI_REGN_RPOPIEN\t\"RPOP Interrupt Enable\"\n#define\tSUNI_REGO_RPOPIEN\t\t0x33\n#define\tSUNI_REGM_RPOPIEN_PSLE\t\t0x80\n#define\tSUNI_REGM_RPOPIEN_LOPE\t\t0x20\n#define\tSUNI_REGM_RPOPIEN_PAISE\t\t0x08\n#define\tSUNI_REGM_RPOPIEN_PRDIE\t\t0x04\n#define\tSUNI_REGM_RPOPIEN_BIPEE\t\t0x02\n#define\tSUNI_REGM_RPOPIEN_FEBEE\t\t0x01\n#define\tSUNI_REGM_RPOPIEN_RESERVED\t0x00\n#define\tSUNI_REGX_RPOPIEN\t\"\\02010PSLE\\6LOPE\\4PAISE\\3PRDIE\\2BIPEE\\1FEBEE\"\n\n/* 622 */\n#define\tSUNI_REGN_RPOPPIE\t\"RPOP Pointer Interrupt Enable\"\n#define\tSUNI_REGO_RPOPPIE\t\t0x34\n#define\tSUNI_REGM_RPOPPIE_ILLJREQE\t0x80\n#define\tSUNI_REGM_RPOPPIE_DISCOPAE\t0x20\n#define\tSUNI_REGM_RPOPPIE_INVNDFE\t0x10\n#define\tSUNI_REGM_RPOPPIE_ILLPTRE\t0x08\n#define\tSUNI_REGM_RPOPPIE_NSEE\t\t0x04\n#define\tSUNI_REGM_RPOPPIE_PSEE\t\t0x02\n#define\tSUNI_REGM_RPOPPIE_NDFE\t\t0x01\n#define\tSUNI_REGX_RPOPPIE\t\"\\020\\10ILLJREQE\\6DISCOPAE\\5INVNDFE\\4ILLPTRE\\3NSEE\\2PSEE\\1NDFE\"\n\n/* 622 */\n#define\tSUNI_REGN_RPOPPTR\t\"RPOP Pointer\"\n#define\tSUNI_REGO_RPOPPTR\t\t0x35\t/* +36 */\n#define\tSUNI_REGM_RPOPPTR_RDI10\t\t0x20\n#define\tSUNI_REGM_RPOPPTR_S\t\t0x0c\n#define\tSUNI_REGS_RPOPPTR_S\t\t2\n#define\tSUNI_REGM_RPOPPTR\t\t0x03\n#define\tSUNI_REGS_RPOPPTR\t\t0\n#define\tSUNI_REGX_RPOPPTR\t\t\"\\020\\6RDI10\\12\\xc\\20S\"\n\n/* lite, ultra, 622 */\n#define\tSUNI_REGN_RPOPPSL \"RPOP Path Signal Label\"\n#define\tSUNI_REGO_RPOPPSL\t\t0x37\n\n/* lite, ultra, 622 */\n#define\tSUNI_REGN_RPOPBIP8 \"RPOP Path BIP-8\"\n#define\tSUNI_REGO_RPOPBIP8\t\t0x38\t/* +39 */\n\n/* lite, ultra, 622 */\n#define\tSUNI_REGN_RPOPFEBE \"RPOP Path FEBE\"\n#define\tSUNI_REGO_RPOPFEBE\t\t0x3A\t/* +3B */\n\n/* 622 */\n#define\tSUNI_REGN_RPOPRDI\t\"RPOP RDI\"\n#define\tSUNI_REGO_RPOPRDI\t\t0x3C\n#define\tSUNI_REGM_RPOPRDI_BLKFEBE\t0x10\n#define\tSUNI_REGM_RPOPRDI_ARDIE\t\t0x02\n#define\tSUNI_REGM_RPOPRDI_ARDIV\t\t0x01\n#define\tSUNI_REGM_RPOPRDI_RESERVED\t0x00\n#define\tSUNI_REGX_RPOPRDI\t\"\\020\\5BLKFEBE\\2ARDIE\\1ARDIV\"\n\n/* lite, ultra */\n#define\tSUNI_REGN_RPOPBIP8CFG \t\"RPOP Path BIP-8 Configuration\"\n#define\tSUNI_REGO_RPOPBIP8CFG\t\t0x3D\n#define\tSUNI_REGM_RPOPBIP8CFG_BLKBIP\t0x20\n#define\tSUNI_REGM_RPOPBIP8CFG_RESERVED\t0x00\n#define\tSUNI_REGX_RPOPBIP8CFG \t\"\\020\\6BLKBIP\"\n\n/* 622 */\n#define\tSUNI_REGN_RPOPRING\t\"RPOP Ring Control\"\n#define\tSUNI_REGO_RPOPRING\t\t0x3D\n#define\tSUNI_REGM_RPOPRING_SOS\t\t0x80\n#define\tSUNI_REGM_RPOPRING_ENSS\t\t0x40\n#define\tSUNI_REGM_RPOPRING_BLKBIP\t0x20\n#define\tSUNI_REGM_RPOPRING_DISFS\t0x10\n#define\tSUNI_REGM_RPOPRING_BLKBIPO\t0x08\n#define\tSUNI_REGM_RPOPRING_RESERVED\t0x00\n#define\tSUNI_REGX_RPOPRING\t\"\\020\\10SOS\\7ENSS\\6BLKBIP\\5DISFS\\4BLKBIPO\"\n\n/* lite, ultra, 622 */\n#define\tSUNI_REGN_TPOPCTRL\t\"TPOP Control/Diagnostic\"\n#define\tSUNI_REGO_TPOPCTRL\t\t0x40\n#define\tSUNI_REGM_TPOPCTRL_EXCFS\t0x80\t/* 622 */\n#define\tSUNI_REGM_TPOPCTRL_DB3\t\t0x02\n#define\tSUNI_REGM_TPOPCTRL_PAIS\t\t0x01\n#define\tSUNI_REGM_TPOPCTRL_RESERVED\t0x00\n#define\tSUNI_REGX_TPOPCTRL\t\"\\020\\2DB3\\1PAIS\"\n#define\tSUNI_REGX_TPOPCTRL_622\t\"\\020\\4EXCFS\\2DB3\\1PAIS\"\n\n/* lite, ultra, 622 */\n#define\tSUNI_REGN_TPOPPTRC \"TPOP Pointer Control\"\n#define\tSUNI_REGO_TPOPPTRC\t\t0x41\n#define\tSUNI_REGM_TPOPPTRC_FTPTR\t0x40\n#define\tSUNI_REGM_TPOPPTRC_SOS\t\t0x20\n#define\tSUNI_REGM_TPOPPTRC_PLD\t\t0x10\n#define\tSUNI_REGM_TPOPPTRC_NDF\t\t0x08\n#define\tSUNI_REGM_TPOPPTRC_NSE\t\t0x04\n#define\tSUNI_REGM_TPOPPTRC_PSE\t\t0x02\n#define\tSUNI_REGM_TPOPPTRC_RESERVED\t0x00\n#define\tSUNI_REGX_TPOPPTRC \"\\020\\7FTPTR\\6SOS\\5PLD\\4NDF\\3NSE\\2PSE\"\n\n/* 622 */\n#define\tSUNI_REGN_TPOPCP\t\"TPOP Current Pointer\"\n#define\tSUNI_REGO_TPOPCP\t\t0x43\t/* +44 */\n#define\tSUNI_REGM_TPOPCP\t\t0x03\n#define\tSUNI_REGS_TPOPCP\t\t0\n#define\tSUNI_REGX_TPOPCP\t\"\\020\"\n\n/* lite, ultra, 622 */\n#define\tSUNI_REGN_TPOPAPTR \t\"TPOP Arbitrary Pointer\"\n#define\tSUNI_REGO_TPOPAPTR\t\t0x45\t/* +46 */\n#define\tSUNI_REGM_TPOPAPTR_NDF\t\t0xF0\n#define\tSUNI_REGS_TPOPAPTR_NDF\t\t4\n#define\tSUNI_REGM_TPOPAPTR_S\t\t0x0C\n#define\tSUNI_REGS_TPOPAPTR_S\t\t2\n#define\tSUNI_REGM_TPOPAPTR\t\t0x03\n#define\tSUNI_REGS_TPOPAPTR\t\t0\n#define\tSUNI_REGX_TPOPAPTR\t\"\\020\\12\\x0C\\12S\\12\\xF0\\12NDF\"\n\n#define\tSUNI_REGM_SONET\t\t\t0\n#define\tSUNI_REGM_SDH\t\t\t2\n\n/* 622 */\n#define\tSUNI_REGN_TPOPPT\t\"TPOP Path Trace\"\n#define\tSUNI_REGO_TPOPPT\t\t0x47\n\n/* lite, ultra, 622 */\n#define\tSUNI_REGN_TPOPPSL\t\"TPOP Path Signal Label\"\n#define\tSUNI_REGO_TPOPPSL\t\t0x48\n\n/* lite, ultra, 622 */\n#define\tSUNI_REGN_TPOPSTATUS \"TPOP Path Status\"\n#define\tSUNI_REGO_TPOPSTATUS\t\t0x49\n#define\tSUNI_REGM_TPOPSTATUS_FEBE\t0xF0\n#define\tSUNI_REGS_TPOPSTATUS_FEBE\t4\n#define\tSUNI_REGM_TPOPSTATUS_PRDI\t0x08\n#define\tSUNI_REGM_TPOPSTATUS_G1\t\t0x07\n#define\tSUNI_REGS_TPOPSTATUS_G1\t\t0\n#define\tSUNI_REGX_TPOPSTATUS \"\\020\\12\\xF0\\12FEBE\\4PRDI\\12\\x7\\12G\"\n\n/* 622 */\n#define\tSUNI_REGN_TPOPPUC\t\"TPOP Path User Channel\"\n#define\tSUNI_REGO_TPOPPUC\t\t0x4A\n\n/* 622 */\n#define\tSUNI_REGN_TPOPPG1\t\"TPOP Path Grow #1\"\n#define\tSUNI_REGO_TPOPPG1\t\t0x4B\n\n/* 622 */\n#define\tSUNI_REGN_TPOPPG2\t\"TPOP Path Grow #2\"\n#define\tSUNI_REGO_TPOPPG2\t\t0x4C\n\n/* 622 */\n#define\tSUNI_REGN_TPOPPG3\t\"TPOP Path Grow #3\"\n#define\tSUNI_REGO_TPOPPG3\t\t0x4D\n\n/* lite, ultra, 622 */\n#define\tSUNI_REGN_RACPCTRL\t\"RACP Control/Status\"\n#define\tSUNI_REGO_RACPCTRL\t\t0x50\n#define\tSUNI_REGM_RACPCTRL_OOCDV\t0x80\n#define\tSUNI_REGM_RACPCTRL_FSEN\t\t0x80\n#define\tSUNI_REGM_RACPCTRL_RXPTYP\t0x40\n#define\tSUNI_REGM_RACPCTRL_PASS\t\t0x20\n#define\tSUNI_REGM_RACPCTRL_DISCOR\t0x10\n#define\tSUNI_REGM_RACPCTRL_HCSPASS\t0x08\n#define\tSUNI_REGM_RACPCTRL_HCSADD\t0x04\n#define\tSUNI_REGM_RACPCTRL_DDSCR\t0x02\n#define\tSUNI_REGM_RACPCTRL_FIFORST\t0x01\n#define\tSUNI_REGX_RACPCTRL\t\"\\020\\10OOCDV\\7RXPTYP\\6PASS\\5DISCO\\4HCSPASS\\3HCSADD\\2DDSCR\\1FIFORST\"\n#define\tSUNI_REGX_RACPCTRL_622\t\"\\020\\10FSEN\\7RXPTYP\\6PASS\\5DISCO\\4HCSPASS\\3HCSADD\\2DDSCR\\1FIFORST\"\n\n/* lite, ultra */\n#define\tSUNI_REGN_RACPINTR \"RACP Interrupt Enable/Status\"\n#define\tSUNI_REGO_RACPINTR\t\t0x51\n#define\tSUNI_REGM_RACPINTR_OOCDE\t0x80\n#define\tSUNI_REGM_RACPINTR_HCSE\t\t0x40\n#define\tSUNI_REGM_RACPINTR_FIFOE\t0x20\n#define\tSUNI_REGM_RACPINTR_OOCDI\t0x10\n#define\tSUNI_REGM_RACPINTR_CHCSI\t0x08\n#define\tSUNI_REGM_RACPINTR_UHCSI\t0x04\n#define\tSUNI_REGM_RACPINTR_FOVRI\t0x02\n#define\tSUNI_REGX_RACPINTR \"\\020\\10OOCDE\\7HCSE\\6FIFOE\\5OOCDI\\4CHCSI\\3UHCSI\\2FOVRI\"\n\n/* 622 */\n#define\tSUNI_REGN_RACPIS\t\"RACP Interrupt Status\"\n#define\tSUNI_REGO_RACPIS\t\t0x51\n#define\tSUNI_REGM_RACPIS_OCDV\t\t0x80\n#define\tSUNI_REGM_RACPIS_LCDV\t\t0x40\n#define\tSUNI_REGM_RACPIS_OCDI\t\t0x20\n#define\tSUNI_REGM_RACPIS_LCDI\t\t0x10\n#define\tSUNI_REGM_RACPIS_CHCSI\t\t0x08\n#define\tSUNI_REGM_RACPIS_UHCSI\t\t0x04\n#define\tSUNI_REGM_RACPIS_FOVRI\t\t0x02\n#define\tSUNI_REGM_RACPIS_FUDRI\t\t0x01\n#define\tSUNI_REGX_RACPIS\t\"\\020\\10OCDV\\7LCDV\\6OCDI\\5LCDI\\4CHCSI\\3UHCSI\\2FOVRI\\1FUDRI\"\n\n/* lite, ultra */\n#define\tSUNI_REGN_RACPPATTERN \"RACP Match Header Pattern\"\n#define\tSUNI_REGO_RACPPATTERN\t\t0x52\n#define\tSUNI_REGM_RACPPATTERN_GFC\t0xF0\n#define\tSUNI_REGS_RACPPATTERN_GFC\t4\n#define\tSUNI_REGM_RACPPATTERN_PTI\t0x0E\n#define\tSUNI_REGS_RACPPATTERN_PTI\t1\n#define\tSUNI_REGM_RACPPATTERN_CLP\t0x01\n#define\tSUNI_REGS_RACPPATTERN_CLP\t0\n#define\tSUNI_REGX_RACPPATTERN \"\\020\\12\\xF0\\12GFC\\12\\x0E\\12PTI\\1CLP\"\n\n/* 622 */\n#define\tSUNI_REGN_RACPIEC\t\"RACP Interrupt Enable/Control\"\n#define\tSUNI_REGO_RACPIEC\t\t0x52\n#define\tSUNI_REGM_RACPIEC_OCDE\t\t0x80\n#define\tSUNI_REGM_RACPIEC_LCDE\t\t0x40\n#define\tSUNI_REGM_RACPIEC_HCSE\t\t0x20\n#define\tSUNI_REGM_RACPIEC_FIFOE\t\t0x10\n#define\tSUNI_REGM_RACPIEC_LCDDROP\t0x08\n#define\tSUNI_REGM_RACPIEC_RCALEVEL0\t0x04\n#define\tSUNI_REGM_RACPIEC_HCSFTR\t0x03\n#define\tSUNI_REGX_RACPIEC\t\"\\020\\10OCDE\\7LCDE\\6HCSE\\5FIFOE\\4LCDDROP\\3RCALEVEL0\\12\\0x3\\12HCSFTR\"\n\n/* lite, ultra */\n#define\tSUNI_REGN_RACPMASK \"RACP Match Header Mask\"\n#define\tSUNI_REGO_RACPMASK\t\t0x53\n#define\tSUNI_REGM_RACPMASK_MGFC\t\t0xF0\n#define\tSUNI_REGS_RACPMASK_MGFC\t\t4\n#define\tSUNI_REGM_RACPMASK_MPTI\t\t0x0E\n#define\tSUNI_REGS_RACPMASK_MPTI\t\t1\n#define\tSUNI_REGM_RACPMASK_MCLP\t\t0x01\n#define\tSUNI_REGS_RACPMASK_MCLP\t\t0\n#define\tSUNI_REGX_RACPMASK \"\\020\\12\\xF0\\12MGFC\\12\\x0E\\12MPTI\\1MCLP\"\n\n/* 622 */\n#define\tSUNI_REGO_RACPPATTERN_622\t0x53\n\n/* lite, ultra */\n#define\tSUNI_REGN_RACPCHCS \"RACP Correctable HCS Error Count\"\n#define\tSUNI_REGO_RACPCHCS\t\t0x54\n\n/* 622 */\n#define\tSUNI_REGO_RACPMASK_622\t\t0x54\n\n/* lite, ultra */\n#define\tSUNI_REGN_RACPUHCS \"RACP Uncorrectable HCS Error Count\"\n#define\tSUNI_REGO_RACPUHCS\t\t0x55\n\n/* 622 */\n#define\tSUNI_REGO_RACPCHCS_622\t\t0x55\t/* +56 */\n#define\tSUNI_REGM_RACPCHCS_622\t\t0x0f\n\n/* lite, ultra */\n#define\tSUNI_REGN_RACPCNT \"RACP Receive Cell Counter\"\n#define\tSUNI_REGO_RACPCNT\t\t0x56\t/* +57,58 */\n#define\tSUNI_REGM_RACPCNT\t\t0x07\n\n/* 622 */\n#define\tSUNI_REGO_RACPUHCS_622\t\t0x57\t/* +58 */\n#define\tSUNI_REGM_RACPUHCS_622\t\t0x0f\n\n/* 622 */\n#define\tSUNI_REGO_RACPCNT_622\t\t0x59\t/* +5A,5B */\n#define\tSUNI_REGM_RACPCNT_622\t\t0x1F\n\n/* lite, ultra */\n#define\tSUNI_REGN_RACPCFG \"RACP Configuration\"\n#define\tSUNI_REGO_RACPCFG\t\t0x59\n#define\tSUNI_REGM_RACPCFG_RGFCE\t\t0xF0\n#define\tSUNI_REGS_RACPCFG_RGFCE\t\t4\n#define\tSUNI_REGM_RACPCFG_FSEN\t\t0x08\n#define\tSUNI_REGM_RACPCFG_LEVEL0\t0x04\n#define\tSUNI_REGM_RACPCFG_HCSFTR\t0x03\n#define\tSUNI_REGS_RACPCFG_HCSFTR\t0\n#define\tSUNI_REGX_RACPCFG \"\\020\\12\\xF0\\20RGFCE\\4FSEN\\3RCALEVEL0\\12\\x03\\12HCSFTR\"\n\n/* 622 */\n#define\tSUNI_REGN_RACPGFC\t\"RACP GFC Control/Misc. Control\"\n#define\tSUNI_REGO_RACPGFC\t\t0x5C\n#define\tSUNI_REGM_RACPGFC_CDDIS\t\t0x80\n#define\tSUNI_REGM_RACPGFC_RXBYTEPRTY\t0x40\n#define\tSUNI_REGM_RACPGFC_RGFCE\t\t0x0f\n#define\tSUNI_REGX_RACPGFC\t\"\\020\\10CDDIS\\7RXBYTEPRTY\\12\\xf\\20\"\n\n/* lite, ultra, 622 */\n#define\tSUNI_REGN_TACPCTRL \"TACP Control/Status\"\n#define\tSUNI_REGO_TACPCTRL\t\t0x60\n#define\tSUNI_REGM_TACPCTRL_FIFOE\t0x80\n#define\tSUNI_REGM_TACPCTRL_TSOCI\t0x40\n#define\tSUNI_REGM_TACPCTRL_FOVRI\t0x20\n#define\tSUNI_REGM_TACPCTRL_DHCS\t\t0x10\n#define\tSUNI_REGM_TACPCTRL_HCSB\t\t0x08\t/* ultra, 622 */\n#define\tSUNI_REGM_TACPCTRL_HCSADD\t0x04\n#define\tSUNI_REGM_TACPCTRL_DSCR\t\t0x02\n#define\tSUNI_REGM_TACPCTRL_FIFORST\t0x01\n#define\tSUNI_REGX_TACPCTRL_LITE\t\t\"\\020\\10FIFOE\\7TSOCI\\6FOVRI\\5DHCS\\3HCSADD\\2DSCR\\1FIFORST\"\n#define\tSUNI_REGX_TACPCTRL_ULTRA\t\"\\020\\10FIFOE\\7TSOCI\\6FOVRI\\5DHCS\\4HCSB\\3HCSADD\\2DSCR\\1FIFORST\"\n#define\tSUNI_REGX_TACPCTRL_622\t\t\"\\020\\10FIFOE\\7TSOCI\\6FOVRI\\5DHCS\\4HCSB\\3HCSADD\\2DSCR\\1FIFORST\"\n\n/* lite, ultra, 622 */\n#define\tSUNI_REGN_TACPIDLEH \t\"TACP Idle/Unassigned Cell Header Pattern\"\n#define\tSUNI_REGO_TACPIDLEH\t\t0x61\n#define\tSUNI_REGM_TACPIDLEH_GFC\t\t0xF0\n#define\tSUNI_REGS_TACPIDLEH_GFC\t\t4\n#define\tSUNI_REGM_TACPIDLEH_PTI\t\t0x0E\n#define\tSUNI_REGS_TACPIDLEH_PTI\t\t1\n#define\tSUNI_REGM_TACPIDLEH_CLP\t\t0x01\n#define\tSUNI_REGS_TACPIDLEH_CLP\t\t0\n#define\tSUNI_REGX_TACPIDLEH \t\"\\020\\12\\xF0\\20GFC\\12\\x0E\\20PTI\\12\\x01\\20CLP\"\n\n/* lite, ultra, 622 */\n#define\tSUNI_REGN_TACPIDLEP \"TACP Idle/Unassigned Cell Payload Octet Pattern\"\n#define\tSUNI_REGO_TACPIDLEP\t\t0x62\n\n/* lite, ultra, 622 */\n#define\tSUNI_REGN_TACPFIFOC\t\t\"TACP FIFO Control\"\n#define\tSUNI_REGO_TACPFIFOC\t\t0x63\n#define\tSUNI_REGM_TACPFIFOC_TXPTYP\t0x80\n#define\tSUNI_REGM_TACPFIFOC_TXPRTYE\t0x40\n#define\tSUNI_REGM_TACPFIFOC_TXPRTYI\t0x10\n#define\tSUNI_REGM_TACPFIFOC_TXPRTYI_622\t0x30\n#define\tSUNI_REGS_TACPFIFOC_TXPRTYI_622\t4\n#define\tSUNI_REGM_TACPFIFOC_FIFODP\t0x0C\n#define\tSUNI_REGS_TACPFIFOC_FIFODP\t2\n#define\tSUNI_REGM_TACPFIFOC_TCALEVEL0\t0x02\n#define\tSUNI_REGM_TACPFIFOC_HCSCTLEB\t0x01\n#define\tSUNI_REGM_TACPFIFOC_RESERVED\t0x00\n#define\tSUNI_REGX_TACPFIFOC\t\t\"\\020\\10TXPTYP\\7TXPRTYE\\5TXPRTYI\\12\\x0C\\20FIFODP\\2TCALEVEL0\"\n#define\tSUNI_REGX_TACPFIFOC_622\t\t\"\\020\\10TXPTYP\\7TXPRTYE\\12\\x30\\12TXPRTYI\\12\\x0C\\20FIFODP\\2TCALEVEL0\\1HCSCTLEB\"\n\n/* lite, ultra, 622 */\n#define\tSUNI_REGN_TACPCNT \"TACP Transmit Cell Counter\"\n#define\tSUNI_REGO_TACPCNT\t\t0x64\t/* +65,66 */\n#define\tSUNI_REGM_TACPCNT\t\t0x07\n#define\tSUNI_REGM_TACPCNT_622\t\t0x1F\n\n/* lite, ultra */\n#define\tSUNI_REGN_TACPCFG \"TACP Configuration\"\n#define\tSUNI_REGO_TACPCFG\t\t0x67\n#define\tSUNI_REGM_TACPCFG_TGFCE\t\t0xF0\n#define\tSUNI_REGS_TACPCFG_TGFCE\t\t4\n#define\tSUNI_REGM_TACPCFG_FSEN\t\t0x08\n#define\tSUNI_REGM_TACPCFG_H4INSB\t0x04\n#define\tSUNI_REGM_TACPCFG_FIXBYTE\t0x03\n#define\tSUNI_REGS_TACPCFG_FIXBYTE\t0\n#define\tSUNI_REGX_TACPCFG \"\\020\\12\\xF0\\20TGFCE\\4FSEN\\3H4INSB\\12\\x03\\20FIXBYTE\"\n\n/* 622 */\n#define\tSUNI_REGN_TACPGFC\t\"TACP Fixed Stuff/GFC\"\n#define\tSUNI_REGO_TACPGFC\t\t0x67\n#define\tSUNI_REGO_TACPGFC_TGFCE\t\t0xf0\n#define\tSUNI_REGS_TACPGFC_TGFCE\t\t4\n#define\tSUNI_REGO_TACPGFC_FSEN\t\t0x08\n#define\tSUNI_REGO_TACPGFC_TXBYTEPRTY\t0x04\n#define\tSUNI_REGO_TACPGFC_FIXBYTE\t0x03\n#define\tSUNI_REGS_TACPGFC_FIXBYTE\t0\n#define\tSUNI_REGX_TACPGFC\t\"\\020\\12\\xf0\\20TGFCE\\4FSEN\\3TXBYTEPRTY\\12\\x3\\20FIXBYTE\"\n\n/* 622 */\n#define\tSUNI_REGN_SPTBCTRL\t\"SPTB Control\"\n#define\tSUNI_REGO_SPTBCTRL\t\t0x68\n#define\tSUNI_REGO_SPTBCTRL_RRAMACC\t0x40\n#define\tSUNI_REGO_SPTBCTRL_RTIUIE\t0x20\n#define\tSUNI_REGO_SPTBCTRL_RTIMIE\t0x10\n#define\tSUNI_REGO_SPTBCTRL_PER5\t\t0x08\n#define\tSUNI_REGO_SPTBCTRL_TNULL\t0x04\n#define\tSUNI_REGO_SPTBCTRL_NOSYNC\t0x02\n#define\tSUNI_REGO_SPTBCTRL_LEN16\t0x01\n#define\tSUNI_REGX_SPTBCTRL\t\"\\020\\7RRAMACC\\6RTIUIE\\5RTIMIE\\4PER5\\3TNULL\\2NOSYNC\\1LEN16\"\n\n/* 622 */\n#define\tSUNI_REGN_SPTBPTIS\t\"SPTB Path Trace Identifier Status\"\n#define\tSUNI_REGO_SPTBPTIS\t\t0x69\n#define\tSUNI_REGM_SPTBPTIS_BUSY\t\t0x80\n#define\tSUNI_REGM_SPTBPTIS_RTIUI\t0x08\n#define\tSUNI_REGM_SPTBPTIS_RTIUV\t0x04\n#define\tSUNI_REGM_SPTBPTIS_RTIMI\t0x02\n#define\tSUNI_REGM_SPTBPTIS_RTIMV\t0x01\n#define\tSUNI_REGX_SPTBPTIS\t\"\\020\\10BUSY\\4RTIUI\\3RTIUV\\2RTIMI\\1RTIMV\"\n\n/* 622 */\n#define\tSUNI_REGN_SPTBIAR\t\"SPTB Indirect Address Register\"\n#define\tSUNI_REGO_SPTBIAR\t\t0x6A\n#define\tSUNI_REGM_SPTBIAR_RWB\t\t0x80\n#define\tSUNI_REGM_SPTBIAR_A\t\t0x7f\n#define\tSUNI_REGX_SPTBIAR\t\"\\020\\10RWB\\12\\x7f\\20A\"\n\n/* 622 */\n#define\tSUNI_REGN_SPTBIDR\t\"SPTB Indirect Data Register\"\n#define\tSUNI_REGO_SPTBIDR\t\t0x6B\n\n/* 622 */\n#define\tSUNI_REGN_SPTBEPSL\t\"SPTB Expected Path Signal Label\"\n#define\tSUNI_REGO_SPTBEPSL\t\t0x6C\n\n/* 622 */\n#define\tSUNI_REGN_SPTBPSLS\t\"SPTB Path Signal Label Status\"\n#define\tSUNI_REGO_SPTBPSLS\t\t0x6D\n#define\tSUNI_REGM_SPTBPSLS_RPSLUIE\t0x80\n#define\tSUNI_REGM_SPTBPSLS_RPSLMIE\t0x40\n#define\tSUNI_REGM_SPTBPSLS_RPSLUI\t0x08\n#define\tSUNI_REGM_SPTBPSLS_RPSLUV\t0x04\n#define\tSUNI_REGM_SPTBPSLS_RPSLMI\t0x02\n#define\tSUNI_REGM_SPTBPSLS_RPSLMV\t0x01\n#define\tSUNI_REGX_SPTBPSLS\t\"\\020\\10RPSLUIE\\7RPSLMIE\\4RPSLUI\\3RPSLUV\\2RPSLMI\\1RPSLMV\"\n\n/* ultra */\n#define\tSUNI_REGN_POPCCTRL \"POPC Control\"\n#define\tSUNI_REGO_POPCCTRL\t\t0x68\n#define\tSUNI_REGM_POPCCTRL_PDAT\t\t0xC0\n#define\tSUNI_REGS_POPCCTRL_PDAT\t\t6\n#define\tSUNI_REGM_POPCCTRL_TOGGLE\t0x30\n#define\tSUNI_REGS_POPCCTRL_TOGGLE\t4\n#define\tSUNI_REGM_POPCCTRL_TRAFFIC\t0x02\n#define\tSUNI_REGM_POPCCTRL_ALARM\t0x01\n#define\tSUNI_REGX_POPCCTRL \"\\020\\12\\xC0\\20PDAT\\12\\x30\\20TOGGLE\\2TRAFFIC\\1ALARM\"\n\n/* ultra */\n#define\tSUNI_REGN_POPCSTROBE0 \"POPC Strobe Rate 0\"\n#define\tSUNI_REGO_POPCSTROBE0\t\t0x69\n\n/* ultra */\n#define\tSUNI_REGN_POPCSTROBE1 \"POPC Strobe Rate 1\"\n#define\tSUNI_REGO_POPCSTROBE1\t\t0x6A\n\n/* 622 */\n#define\tSUNI_REGN_BERMCTRL\t\"BERM Control\"\n#define\tSUNI_REGO_BERMCTRL\t\t0x70\n#define\tSUNI_REGM_BERMCTRL_BERTEN\t0x80\n#define\tSUNI_REGM_BERMCTRL_BERIE\t0x01\n#define\tSUNI_REGX_BERMCTRL\t\"\\020\\10BERTEN\\1BERIE\"\n\n/* 622 */\n#define\tSUNI_REGN_BERMINT\t\"BERM Interrupt\"\n#define\tSUNI_REGO_BERMINT\t\t0x71\n#define\tSUNI_REGM_BERMINT_TST\t\t0xf0\n#define\tSUNI_REGS_BERMINT_TST\t\t4\n#define\tSUNI_REGM_BERMINT_BERI\t\t0x01\n#define\tSUNI_REGX_BERMINT\t\"\\020\\12\\xf0\\20BERM_TST\\1BERI\"\n\n/* 622 */\n#define\tSUNI_REGN_BERMLAP\t\"BERM Line BIP Accumulation Period\"\n#define\tSUNI_REGO_BERMLAP\t\t0x72\t/* +73 */\n\n/* 622 */\n#define\tSUNI_REGN_BERMLT\t\"BERM Line BIP Threshold\"\n#define\tSUNI_REGO_BERMLT\t\t0x74\t/* +75 */\n\n/* lite, ultra, 622 */\n#define\tSUNI_REGN_MTEST \"Master Test\"\n#define\tSUNI_REGO_MTEST\t\t\t0x80\n#define\tSUNI_REGM_MTEST_DS27_53_622\t0x80\n#define\tSUNI_REGM_MTEST_BYPASS_ULTRA\t0x40\n#define\tSUNI_REGM_MTEST_PMCATST_ULTRA\t0x20\n#define\tSUNI_REGM_MTEST_PMCTST\t\t0x10\n#define\tSUNI_REGM_MTEST_DBCTRL\t\t0x08\n#define\tSUNI_REGM_MTEST_IOTST\t\t0x04\n#define\tSUNI_REGM_MTEST_HIZDATA\t\t0x02\n#define\tSUNI_REGM_MTEST_HIZIO\t\t0x01\n#define\tSUNI_REGX_MTEST_LITE\t\"\\020\\5PMCTST\\4DBCTRL\\3IOTST\\2HIZDATA\\1HIZIO\"\n#define\tSUNI_REGX_MTEST_ULTRA\t\"\\020\\7BYPASS\\6PMCATST\\5PMCTST\\4DBCTRL\\3IOTST\\2HIZDATA\\1HIZIO\"\n#define\tSUNI_REGX_MTEST_622\t\"\\020\\10DS27_53\\5PMCTST\\4DBCTRL\\3IOTST\\2HIZDATA\\1HIZIO\"\n\n/*\n * Printing support\n */\n#define\tSUNI_PRINT_LITE\t\t\t\t\t\t\t\\\n\t{ /* 00 */\t\t\t\t\t\t\t\\\n\t  UTP_REGT_BITS,\tSUNI_REGO_MRESET, \t\t\t\\\n\t  SUNI_REGN_MRESET,\tSUNI_REGX_MRESET_LITE },\t\t\\\n\t{ /* 01 */\t\t\t\t\t\t\t\\\n\t  UTP_REGT_BITS,\tSUNI_REGO_MCONFIG,\t\t\t\\\n\t  SUNI_REGN_MCONFIG,\tSUNI_REGX_MCONFIG_LITE },\t\t\\\n\t{ /* 02 */\t\t\t\t\t\t\t\\\n\t  UTP_REGT_BITS,\tSUNI_REGO_MISTATUS,\t\t\t\\\n\t  SUNI_REGN_MISTATUS,\tSUNI_REGX_MISTATUS_LITE },\t\t\\\n\t  /* 03 unused */\t\t\t\t\t\t\\\n\t{ /* 04 */\t\t\t\t\t\t\t\\\n\t  UTP_REGT_BITS,\tSUNI_REGO_MCLKM,\t\t\t\\\n\t  SUNI_REGN_MCLKM,\tSUNI_REGX_MCLKM_LITE },\t\t\t\\\n\t{ /* 05 */\t\t\t\t\t\t\t\\\n\t  UTP_REGT_BITS,\tSUNI_REGO_MCTRL,\t\t\t\\\n\t  SUNI_REGN_MCTRL,\tSUNI_REGX_MCTRL_LITE },\t\t\t\\\n\t{ /* 06 */\t\t\t\t\t\t\t\\\n\t  UTP_REGT_BITS,\tSUNI_REGO_CLKSYN,\t\t\t\\\n\t  SUNI_REGN_CLKSYN,\tSUNI_REGX_CLKSYN_LITE },\t\t\\\n\t{ /* 07 */\t\t\t\t\t\t\t\\\n\t  UTP_REGT_BITS,\tSUNI_REGO_CLKREC_LITE,\t\t\t\\\n\t  SUNI_REGN_CLKREC,\tSUNI_REGX_CLKREC_LITE },\t\t\\\n\t  /* 08-0F unused */\t\t\t\t\t\t\\\n\t{ /* 10 */\t\t\t\t\t\t\t\\\n\t  UTP_REGT_BITS,\tSUNI_REGO_RSOPCIE,\t\t\t\\\n\t  SUNI_REGN_RSOPCIE,\tSUNI_REGX_RSOPCIE },\t\t\t\\\n\t{ /* 11 */\t\t\t\t\t\t\t\\\n\t  UTP_REGT_BITS,\tSUNI_REGO_RSOPSIS,\t\t\t\\\n\t  SUNI_REGN_RSOPSIS,\tSUNI_REGX_RSOPSIS },\t\t\t\\\n\t{ /* 12, 13 */\t\t\t\t\t\t\t\\\n\t  UTP_REGT_INT16,\tSUNI_REGO_RSOP_BIP8,\t\t\t\\\n\t  SUNI_REGN_RSOP_BIP8,\tNULL },\t\t\t\t\t\\\n\t{ /* 14 */\t\t\t\t\t\t\t\\\n\t  UTP_REGT_BITS,\tSUNI_REGO_TSOPCTRL,\t\t\t\\\n\t  SUNI_REGN_TSOPCTRL,\tSUNI_REGX_TSOPCTRL },\t\t\t\\\n\t{ /* 15 */\t\t\t\t\t\t\t\\\n\t  UTP_REGT_BITS,\tSUNI_REGO_TSOPDIAG,\t\t\t\\\n\t  SUNI_REGN_TSOPDIAG,\tSUNI_REGX_TSOPDIAG },\t\t\t\\\n\t  /* 16-17 unused */\t\t\t\t\t\t\\\n\t{ /* 18 */\t\t\t\t\t\t\t\\\n\t  UTP_REGT_BITS,\tSUNI_REGO_RLOPCTRL,\t\t\t\\\n\t  SUNI_REGN_RLOPCTRL,\tSUNI_REGX_RLOPCTRL },\t\t\t\\\n\t{ /* 19 */\t\t\t\t\t\t\t\\\n\t  UTP_REGT_BITS,\tSUNI_REGO_RLOPINTR,\t\t\t\\\n\t  SUNI_REGN_RLOPINTR,\tSUNI_REGX_RLOPINTR },\t\t\t\\\n\t{ /* 1A, 1B, 1C */\t\t\t\t\t\t\\\n\t  UTP_REGT_INT20,\tSUNI_REGO_RLOPBIP8_24,\t\t\t\\\n\t  SUNI_REGN_RLOPBIP8_24, NULL },\t\t\t\t\\\n\t{ /* 1D, 1E, 1F */\t\t\t\t\t\t\\\n\t  UTP_REGT_INT20,\tSUNI_REGO_RLOPFEBE,\t\t\t\\\n\t  SUNI_REGN_RLOPFEBE,\tNULL },\t\t\t\t\t\\\n\t{ /* 20 */\t\t\t\t\t\t\t\\\n\t  UTP_REGT_BITS,\tSUNI_REGO_TLOPCTRL,\t\t\t\\\n\t  SUNI_REGN_TLOPCTRL,\tSUNI_REGX_TLOPCTRL },\t\t\t\\\n\t{ /* 21 */\t\t\t\t\t\t\t\\\n\t  UTP_REGT_BITS,\tSUNI_REGO_TLOPDIAG,\t\t\t\\\n\t  SUNI_REGN_TLOPDIAG,\tSUNI_REGX_TLOPDIAG },\t\t\t\\\n\t  /* 22-2F unused */\t\t\t\t\t\t\\\n\t{ /* 30 */\t\t\t\t\t\t\t\\\n\t  UTP_REGT_BITS,\tSUNI_REGO_RPOPCTRL,\t\t\t\\\n\t  SUNI_REGN_RPOPCTRL,\tSUNI_REGX_RPOPCTRL },\t\t\t\\\n\t{ /* 31 */\t\t\t\t\t\t\t\\\n\t  UTP_REGT_BITS,\tSUNI_REGO_RPOPISTAT,\t\t\t\\\n\t  SUNI_REGN_RPOPISTAT,\tSUNI_REGX_RPOPISTAT },\t\t\t\\\n\t  /* 32 unused */\t\t\t\t\t\t\\\n\t{ /* 33 */\t\t\t\t\t\t\t\\\n\t  UTP_REGT_BITS,\tSUNI_REGO_RPOPIEN,\t\t\t\\\n\t  SUNI_REGN_RPOPIEN,\tSUNI_REGX_RPOPIEN },\t\t\t\\\n\t  /* 34-36 unused */\t\t\t\t\t\t\\\n\t{ /* 37 */\t\t\t\t\t\t\t\\\n\t  UTP_REGT_INT8,\tSUNI_REGO_RPOPPSL,\t\t\t\\\n\t  SUNI_REGN_RPOPPSL,\tNULL },\t\t\t\t\t\\\n\t{ /* 38, 39 */\t\t\t\t\t\t\t\\\n\t  UTP_REGT_INT16,\tSUNI_REGO_RPOPBIP8,\t\t\t\\\n\t  SUNI_REGN_RPOPBIP8,\tNULL },\t\t\t\t\t\\\n\t{ /* 3A, 3B */\t\t\t\t\t\t\t\\\n\t  UTP_REGT_INT16,\tSUNI_REGO_RPOPFEBE,\t\t\t\\\n\t  SUNI_REGN_RPOPFEBE,\tNULL },\t\t\t\t\t\\\n\t  /* 3C unused */\t\t\t\t\t\t\\\n\t{ /* 3D */\t\t\t\t\t\t\t\\\n\t  UTP_REGT_BITS,\tSUNI_REGO_RPOPBIP8CFG,\t\t\t\\\n\t  SUNI_REGN_RPOPBIP8CFG, SUNI_REGX_RPOPBIP8CFG },\t\t\\\n\t  /* 3E-3F unused */\t\t\t\t\t\t\\\n\t{ /* 40 */\t\t\t\t\t\t\t\\\n\t  UTP_REGT_BITS,\tSUNI_REGO_TPOPCTRL,\t\t\t\\\n\t  SUNI_REGN_TPOPCTRL,\tSUNI_REGX_TPOPCTRL },\t\t\t\\\n\t{ /* 41 */\t\t\t\t\t\t\t\\\n\t  UTP_REGT_BITS,\tSUNI_REGO_TPOPPTRC,\t\t\t\\\n\t  SUNI_REGN_TPOPPTRC,\tSUNI_REGX_TPOPPTRC },\t\t\t\\\n\t  /* 42-44 unused */\t\t\t\t\t\t\\\n\t{ /* 45, 46 */\t\t\t\t\t\t\t\\\n\t  UTP_REGT_INT10BITS,\tSUNI_REGO_TPOPAPTR,\t\t\t\\\n\t  SUNI_REGN_TPOPAPTR,\tSUNI_REGX_TPOPAPTR },\t\t\t\\\n\t  /* 47 unused */\t\t\t\t\t\t\\\n\t{ /* 48 */\t\t\t\t\t\t\t\\\n\t  UTP_REGT_INT8,\tSUNI_REGO_TPOPPSL,\t\t\t\\\n\t  SUNI_REGN_TPOPPSL,\tNULL },\t\t\t\t\t\\\n\t{ /* 49 */\t\t\t\t\t\t\t\\\n\t  UTP_REGT_BITS,\tSUNI_REGO_TPOPSTATUS,\t\t\t\\\n\t  SUNI_REGN_TPOPSTATUS,\tSUNI_REGX_TPOPSTATUS },\t\t\t\\\n\t  /* 4A-4F unused */\t\t\t\t\t\t\\\n\t{ /* 50 */\t\t\t\t\t\t\t\\\n\t  UTP_REGT_BITS,\tSUNI_REGO_RACPCTRL,\t\t\t\\\n\t  SUNI_REGN_RACPCTRL,\tSUNI_REGX_RACPCTRL },\t\t\t\\\n\t{ /* 51 */\t\t\t\t\t\t\t\\\n\t  UTP_REGT_BITS,\tSUNI_REGO_RACPINTR,\t\t\t\\\n\t  SUNI_REGN_RACPINTR,\tSUNI_REGX_RACPINTR },\t\t\t\\\n\t{ /* 52 */\t\t\t\t\t\t\t\\\n\t  UTP_REGT_BITS,\tSUNI_REGO_RACPPATTERN,\t\t\t\\\n\t  SUNI_REGN_RACPPATTERN, SUNI_REGX_RACPPATTERN },\t\t\\\n\t{ /* 53 */\t\t\t\t\t\t\t\\\n\t  UTP_REGT_BITS,\tSUNI_REGO_RACPMASK,\t\t\t\\\n\t  SUNI_REGN_RACPMASK,\tSUNI_REGX_RACPMASK },\t\t\t\\\n\t{ /* 54 */\t\t\t\t\t\t\t\\\n\t  UTP_REGT_INT8,\tSUNI_REGO_RACPCHCS,\t\t\t\\\n\t  SUNI_REGN_RACPCHCS,\tNULL },\t\t\t\t\t\\\n\t{ /* 55 */\t\t\t\t\t\t\t\\\n\t  UTP_REGT_INT8,\tSUNI_REGO_RACPUHCS,\t\t\t\\\n\t  SUNI_REGN_RACPUHCS,\tNULL },\t\t\t\t\t\\\n\t{ /* 56, 57, 58 */\t\t\t\t\t\t\\\n\t  UTP_REGT_INT19,\tSUNI_REGO_RACPCNT,\t\t\t\\\n\t  SUNI_REGN_RACPCNT,\tNULL },\t\t\t\t\t\\\n\t{ /* 59 */\t\t\t\t\t\t\t\\\n\t  UTP_REGT_BITS,\tSUNI_REGO_RACPCFG,\t\t\t\\\n\t  SUNI_REGN_RACPCFG,\tSUNI_REGX_RACPCFG },\t\t\t\\\n\t  /* 5A-5F unused */\t\t\t\t\t\t\\\n\t{ /* 60 */\t\t\t\t\t\t\t\\\n\t  UTP_REGT_BITS,\tSUNI_REGO_TACPCTRL,\t\t\t\\\n\t  SUNI_REGN_TACPCTRL,\tSUNI_REGX_TACPCTRL_LITE },\t\t\\\n\t{ /* 61 */\t\t\t\t\t\t\t\\\n\t  UTP_REGT_BITS,\tSUNI_REGO_TACPIDLEH,\t\t\t\\\n\t  SUNI_REGN_TACPIDLEH,\tSUNI_REGX_TACPIDLEH },\t\t\t\\\n\t{ /* 62 */\t\t\t\t\t\t\t\\\n\t  UTP_REGT_INT8,\tSUNI_REGO_TACPIDLEP,\t\t\t\\\n\t  SUNI_REGN_TACPIDLEP,\tNULL },\t\t\t\t\t\\\n\t{ /* 63 */\t\t\t\t\t\t\t\\\n\t  UTP_REGT_BITS,\tSUNI_REGO_TACPFIFOC,\t\t\t\\\n\t  SUNI_REGN_TACPFIFOC,\tSUNI_REGX_TACPFIFOC },\t\t\t\\\n\t{ /* 64, 65, 66 */\t\t\t\t\t\t\\\n\t  UTP_REGT_INT19,\tSUNI_REGO_TACPCNT,\t\t\t\\\n\t  SUNI_REGN_TACPCNT,\tNULL },\t\t\t\t\t\\\n\t{ /* 67 */\t\t\t\t\t\t\t\\\n\t  UTP_REGT_BITS,\tSUNI_REGO_TACPGFC,\t\t\t\\\n\t  SUNI_REGN_TACPGFC,\tSUNI_REGX_TACPGFC },\t\t\t\\\n\t  /* 68-7f unused */\t\t\t\t\t\t\\\n\t{ /* 80 */\t\t\t\t\t\t\t\\\n\t  UTP_REGT_BITS,\tSUNI_REGO_MTEST,\t\t\t\\\n\t  SUNI_REGN_MTEST,\tSUNI_REGX_MTEST_LITE }\n\n#define\tSUNI_PRINT_ULTRA\t\t\t\t\t\t\\\n\t{ /* 00 */\t\t\t\t\t\t\t\\\n\t  UTP_REGT_BITS,\tSUNI_REGO_MRESET, \t\t\t\\\n\t  SUNI_REGN_MRESET,\tSUNI_REGX_MRESET_ULTRA },\t\t\\\n\t{ /* 01 */\t\t\t\t\t\t\t\\\n\t  UTP_REGT_BITS,\tSUNI_REGO_MCONFIG,\t\t\t\\\n\t  SUNI_REGN_MCONFIG,\tSUNI_REGX_MCONFIG_ULTRA },\t\t\\\n\t{ /* 02 */\t\t\t\t\t\t\t\\\n\t  UTP_REGT_BITS,\tSUNI_REGO_MISTATUS,\t\t\t\\\n\t  SUNI_REGN_MISTATUS,\tSUNI_REGX_MISTATUS_ULTRA },\t\t\\\n\t{ /* 03 */\t\t\t\t\t\t\t\\\n\t  UTP_REGT_BITS,\tSUNI_REGO_MMCTRL,\t\t\t\\\n\t  SUNI_REGN_MMCTRL,\tSUNI_REGX_MMCTRL },\t\t\t\\\n\t{ /* 04 */\t\t\t\t\t\t\t\\\n\t  UTP_REGT_BITS,\tSUNI_REGO_MCLKM,\t\t\t\\\n\t  SUNI_REGN_MCLKM,\tSUNI_REGX_MCLKM_ULTRA },\t\t\\\n\t{ /* 05 */\t\t\t\t\t\t\t\\\n\t  UTP_REGT_BITS,\tSUNI_REGO_MCTRL,\t\t\t\\\n\t  SUNI_REGN_MCTRL,\tSUNI_REGX_MCTRL_ULTRA },\t\t\\\n\t{ /* 06 */\t\t\t\t\t\t\t\\\n\t  UTP_REGT_BITS,\tSUNI_REGO_CLKSYN,\t\t\t\\\n\t  SUNI_REGN_CLKSYN,\tSUNI_REGX_CLKSYN_ULTRA },\t\t\\\n\t  /* 07 unused */\t\t\t\t\t\t\\\n\t{ /* 08 */\t\t\t\t\t\t\t\\\n\t  UTP_REGT_BITS,\tSUNI_REGO_CLKREC_ULTRA,\t\t\t\\\n\t  SUNI_REGN_CLKREC,\tSUNI_REGX_CLKREC_ULTRA },\t\t\\\n\t{ /* 09 */\t\t\t\t\t\t\t\\\n\t  UTP_REGT_BITS,\tSUNI_REGO_CLKRECCFG,\t\t\t\\\n\t  SUNI_REGN_CLKRECCFG,\tSUNI_REGX_CLKRECCFG },\t\t\t\\\n\t{ /* 0A */\t\t\t\t\t\t\t\\\n\t  UTP_REGT_BITS,\tSUNI_REGO_LTXCFG1,\t\t\t\\\n\t  SUNI_REGN_LTXCFG1,\tSUNI_REGX_LTXCFG1 },\t\t\t\\\n\t{ /* 0B */\t\t\t\t\t\t\t\\\n\t  UTP_REGT_BITS,\tSUNI_REGO_LTXCFG2,\t\t\t\\\n\t  SUNI_REGN_LTXCFG2,\tSUNI_REGX_LTXCFG2 },\t\t\t\\\n\t{ /* 0C */\t\t\t\t\t\t\t\\\n\t  UTP_REGT_BITS,\tSUNI_REGO_LRXCFG,\t\t\t\\\n\t  SUNI_REGN_LRXCFG,\tSUNI_REGX_LRXCFG },\t\t\t\\\n\t  /* 0D-0F unused */\t\t\t\t\t\t\\\n\t{ /* 10 */\t\t\t\t\t\t\t\\\n\t  UTP_REGT_BITS,\tSUNI_REGO_RSOPCIE,\t\t\t\\\n\t  SUNI_REGN_RSOPCIE,\tSUNI_REGX_RSOPCIE },\t\t\t\\\n\t{ /* 11 */\t\t\t\t\t\t\t\\\n\t  UTP_REGT_BITS,\tSUNI_REGO_RSOPSIS,\t\t\t\\\n\t  SUNI_REGN_RSOPSIS,\tSUNI_REGX_RSOPSIS },\t\t\t\\\n\t{ /* 12, 13 */\t\t\t\t\t\t\t\\\n\t  UTP_REGT_INT16,\tSUNI_REGO_RSOP_BIP8,\t\t\t\\\n\t  SUNI_REGN_RSOP_BIP8,\tNULL },\t\t\t\t\t\\\n\t{ /* 14 */\t\t\t\t\t\t\t\\\n\t  UTP_REGT_BITS,\tSUNI_REGO_TSOPCTRL,\t\t\t\\\n\t  SUNI_REGN_TSOPCTRL,\tSUNI_REGX_TSOPCTRL },\t\t\t\\\n\t{ /* 15 */\t\t\t\t\t\t\t\\\n\t  UTP_REGT_BITS,\tSUNI_REGO_TSOPDIAG,\t\t\t\\\n\t  SUNI_REGN_TSOPDIAG,\tSUNI_REGX_TSOPDIAG },\t\t\t\\\n\t  /* 16-17 unused */\t\t\t\t\t\t\\\n\t{ /* 18 */\t\t\t\t\t\t\t\\\n\t  UTP_REGT_BITS,\tSUNI_REGO_RLOPCTRL,\t\t\t\\\n\t  SUNI_REGN_RLOPCTRL,\tSUNI_REGX_RLOPCTRL },\t\t\t\\\n\t{ /* 19 */\t\t\t\t\t\t\t\\\n\t  UTP_REGT_BITS,\tSUNI_REGO_RLOPINTR,\t\t\t\\\n\t  SUNI_REGN_RLOPINTR,\tSUNI_REGX_RLOPINTR },\t\t\t\\\n\t{ /* 1A, 1B, 1C */\t\t\t\t\t\t\\\n\t  UTP_REGT_INT20,\tSUNI_REGO_RLOPBIP8_24,\t\t\t\\\n\t  SUNI_REGN_RLOPBIP8_24, NULL },\t\t\t\t\\\n\t{ /* 1D, 1E, 1F */\t\t\t\t\t\t\\\n\t  UTP_REGT_INT20,\tSUNI_REGO_RLOPFEBE,\t\t\t\\\n\t  SUNI_REGN_RLOPFEBE,\tNULL },\t\t\t\t\t\\\n\t{ /* 20 */\t\t\t\t\t\t\t\\\n\t  UTP_REGT_BITS,\tSUNI_REGO_TLOPCTRL,\t\t\t\\\n\t  SUNI_REGN_TLOPCTRL,\tSUNI_REGX_TLOPCTRL },\t\t\t\\\n\t{ /* 21 */\t\t\t\t\t\t\t\\\n\t  UTP_REGT_BITS,\tSUNI_REGO_TLOPDIAG,\t\t\t\\\n\t  SUNI_REGN_TLOPDIAG,\tSUNI_REGX_TLOPDIAG },\t\t\t\\\n\t  /* 22-2F unused */\t\t\t\t\t\t\\\n\t{ /* 30 */\t\t\t\t\t\t\t\\\n\t  UTP_REGT_BITS,\tSUNI_REGO_RPOPCTRL,\t\t\t\\\n\t  SUNI_REGN_RPOPCTRL,\tSUNI_REGX_RPOPCTRL },\t\t\t\\\n\t{ /* 31 */\t\t\t\t\t\t\t\\\n\t  UTP_REGT_BITS,\tSUNI_REGO_RPOPISTAT,\t\t\t\\\n\t  SUNI_REGN_RPOPISTAT,\tSUNI_REGX_RPOPISTAT },\t\t\t\\\n\t  /* 32 unused */\t\t\t\t\t\t\\\n\t{ /* 33 */\t\t\t\t\t\t\t\\\n\t  UTP_REGT_BITS,\tSUNI_REGO_RPOPIEN,\t\t\t\\\n\t  SUNI_REGN_RPOPIEN,\tSUNI_REGX_RPOPIEN },\t\t\t\\\n\t  /* 34-36 unused */\t\t\t\t\t\t\\\n\t{ /* 37 */\t\t\t\t\t\t\t\\\n\t  UTP_REGT_INT8,\tSUNI_REGO_RPOPPSL,\t\t\t\\\n\t  SUNI_REGN_RPOPPSL,\tNULL },\t\t\t\t\t\\\n\t{ /* 38, 39 */\t\t\t\t\t\t\t\\\n\t  UTP_REGT_INT16,\tSUNI_REGO_RPOPBIP8,\t\t\t\\\n\t  SUNI_REGN_RPOPBIP8,\tNULL },\t\t\t\t\t\\\n\t{ /* 3A, 3B */\t\t\t\t\t\t\t\\\n\t  UTP_REGT_INT16,\tSUNI_REGO_RPOPFEBE,\t\t\t\\\n\t  SUNI_REGN_RPOPFEBE,\tNULL },\t\t\t\t\t\\\n\t  /* 3C unused */\t\t\t\t\t\t\\\n\t{ /* 3D */\t\t\t\t\t\t\t\\\n\t  UTP_REGT_BITS,\tSUNI_REGO_RPOPBIP8CFG,\t\t\t\\\n\t  SUNI_REGN_RPOPBIP8CFG, SUNI_REGX_RPOPBIP8CFG },\t\t\\\n\t  /* 3E-3F unused */\t\t\t\t\t\t\\\n\t{ /* 40 */\t\t\t\t\t\t\t\\\n\t  UTP_REGT_BITS,\tSUNI_REGO_TPOPCTRL,\t\t\t\\\n\t  SUNI_REGN_TPOPCTRL,\tSUNI_REGX_TPOPCTRL },\t\t\t\\\n\t{ /* 41 */\t\t\t\t\t\t\t\\\n\t  UTP_REGT_BITS,\tSUNI_REGO_TPOPPTRC,\t\t\t\\\n\t  SUNI_REGN_TPOPPTRC,\tSUNI_REGX_TPOPPTRC },\t\t\t\\\n\t  /* 42-44 unused */\t\t\t\t\t\t\\\n\t{ /* 45, 46 */\t\t\t\t\t\t\t\\\n\t  UTP_REGT_INT10BITS,\tSUNI_REGO_TPOPAPTR,\t\t\t\\\n\t  SUNI_REGN_TPOPAPTR,\tSUNI_REGX_TPOPAPTR },\t\t\t\\\n\t  /* 47 unused */\t\t\t\t\t\t\\\n\t{ /* 48 */\t\t\t\t\t\t\t\\\n\t  UTP_REGT_INT8,\tSUNI_REGO_TPOPPSL,\t\t\t\\\n\t  SUNI_REGN_TPOPPSL,\tNULL },\t\t\t\t\t\\\n\t{ /* 49 */\t\t\t\t\t\t\t\\\n\t  UTP_REGT_BITS,\tSUNI_REGO_TPOPSTATUS,\t\t\t\\\n\t  SUNI_REGN_TPOPSTATUS,\tSUNI_REGX_TPOPSTATUS },\t\t\t\\\n\t  /* 4A-4F unused */\t\t\t\t\t\t\\\n\t{ /* 50 */\t\t\t\t\t\t\t\\\n\t  UTP_REGT_BITS,\tSUNI_REGO_RACPCTRL,\t\t\t\\\n\t  SUNI_REGN_RACPCTRL,\tSUNI_REGX_RACPCTRL },\t\t\t\\\n\t{ /* 51 */\t\t\t\t\t\t\t\\\n\t  UTP_REGT_BITS,\tSUNI_REGO_RACPINTR,\t\t\t\\\n\t  SUNI_REGN_RACPINTR,\tSUNI_REGX_RACPINTR },\t\t\t\\\n\t{ /* 52 */\t\t\t\t\t\t\t\\\n\t  UTP_REGT_BITS,\tSUNI_REGO_RACPPATTERN,\t\t\t\\\n\t  SUNI_REGN_RACPPATTERN, SUNI_REGX_RACPPATTERN },\t\t\\\n\t{ /* 53 */\t\t\t\t\t\t\t\\\n\t  UTP_REGT_BITS,\tSUNI_REGO_RACPMASK,\t\t\t\\\n\t  SUNI_REGN_RACPMASK,\tSUNI_REGX_RACPMASK },\t\t\t\\\n\t{ /* 54 */\t\t\t\t\t\t\t\\\n\t  UTP_REGT_INT8,\tSUNI_REGO_RACPCHCS,\t\t\t\\\n\t  SUNI_REGN_RACPCHCS,\tNULL },\t\t\t\t\t\\\n\t{ /* 55 */\t\t\t\t\t\t\t\\\n\t  UTP_REGT_INT8,\tSUNI_REGO_RACPUHCS,\t\t\t\\\n\t  SUNI_REGN_RACPUHCS,\tNULL },\t\t\t\t\t\\\n\t{ /* 56, 57, 58 */\t\t\t\t\t\t\\\n\t  UTP_REGT_INT19,\tSUNI_REGO_RACPCNT,\t\t\t\\\n\t  SUNI_REGN_RACPCNT,\tNULL },\t\t\t\t\t\\\n\t{ /* 59 */\t\t\t\t\t\t\t\\\n\t  UTP_REGT_BITS,\tSUNI_REGO_RACPCFG,\t\t\t\\\n\t  SUNI_REGN_RACPCFG,\tSUNI_REGX_RACPCFG },\t\t\t\\\n\t  /* 5A-5F unused */\t\t\t\t\t\t\\\n\t{ /* 60 */\t\t\t\t\t\t\t\\\n\t  UTP_REGT_BITS,\tSUNI_REGO_TACPCTRL,\t\t\t\\\n\t  SUNI_REGN_TACPCTRL,\tSUNI_REGX_TACPCTRL_ULTRA },\t\t\\\n\t{ /* 61 */\t\t\t\t\t\t\t\\\n\t  UTP_REGT_BITS,\tSUNI_REGO_TACPIDLEH,\t\t\t\\\n\t  SUNI_REGN_TACPIDLEH,\tSUNI_REGX_TACPIDLEH },\t\t\t\\\n\t{ /* 62 */\t\t\t\t\t\t\t\\\n\t  UTP_REGT_INT8,\tSUNI_REGO_TACPIDLEP,\t\t\t\\\n\t  SUNI_REGN_TACPIDLEP,\tNULL },\t\t\t\t\t\\\n\t{ /* 63 */\t\t\t\t\t\t\t\\\n\t  UTP_REGT_BITS,\tSUNI_REGO_TACPFIFOC,\t\t\t\\\n\t  SUNI_REGN_TACPFIFOC,\tSUNI_REGX_TACPFIFOC },\t\t\t\\\n\t{ /* 64, 65, 66 */\t\t\t\t\t\t\\\n\t  UTP_REGT_INT19,\tSUNI_REGO_TACPCNT,\t\t\t\\\n\t  SUNI_REGN_TACPCNT,\tNULL },\t\t\t\t\t\\\n\t{ /* 67 */\t\t\t\t\t\t\t\\\n\t  UTP_REGT_BITS,\tSUNI_REGO_TACPGFC,\t\t\t\\\n\t  SUNI_REGN_TACPGFC,\tSUNI_REGX_TACPGFC },\t\t\t\\\n\t{ /* 68 */\t\t\t\t\t\t\t\\\n\t  UTP_REGT_BITS,\tSUNI_REGO_POPCCTRL,\t\t\t\\\n\t  SUNI_REGN_POPCCTRL,\tSUNI_REGX_POPCCTRL },\t\t\t\\\n\t{ /* 69 */\t\t\t\t\t\t\t\\\n\t  UTP_REGT_INT8,\tSUNI_REGO_POPCSTROBE0,\t\t\t\\\n\t  SUNI_REGN_POPCSTROBE0, NULL },\t\t\t\t\\\n\t{ /* 6A */\t\t\t\t\t\t\t\\\n\t  UTP_REGT_INT8,\tSUNI_REGO_POPCSTROBE1,\t\t\t\\\n\t  SUNI_REGN_POPCSTROBE1, NULL },\t\t\t\t\\\n\t  /* 6B-7f unused */\t\t\t\t\t\t\\\n\t{ /* 80 */\t\t\t\t\t\t\t\\\n\t  UTP_REGT_BITS,\tSUNI_REGO_MTEST,\t\t\t\\\n\t  SUNI_REGN_MTEST,\tSUNI_REGX_MTEST_ULTRA }\n\n#define\tSUNI_PRINT_622 \t\t\t\t\t\t\t\\\n\t{ /* 00 */\t\t\t\t\t\t\t\\\n\t  UTP_REGT_BITS,\tSUNI_REGO_MRESET, \t\t\t\\\n\t  SUNI_REGN_MRESET,\tSUNI_REGX_MRESET_622 },\t\t\t\\\n\t{ /* 01 */\t\t\t\t\t\t\t\\\n\t  UTP_REGT_BITS,\tSUNI_REGO_MCONFIG,\t\t\t\\\n\t  SUNI_REGN_MCONFIG,\tSUNI_REGX_MCONFIG_622 },\t\t\\\n\t{ /* 02 */\t\t\t\t\t\t\t\\\n\t  UTP_REGT_BITS,\tSUNI_REGO_MISTATUS,\t\t\t\\\n\t  SUNI_REGN_MISTATUS,\tSUNI_REGX_MISTATUS_622 },\t\t\\\n\t{ /* 03 */\t\t\t\t\t\t\t\\\n\t  UTP_REGT_BITS,\tSUNI_REGO_PISO, \t\t\t\\\n\t  SUNI_REGN_PISO,\tSUNI_REGX_PISO },\t\t\t\\\n\t{ /* 04 */\t\t\t\t\t\t\t\\\n\t  UTP_REGT_BITS,\tSUNI_REGO_MCTRLM, \t\t\t\\\n\t  SUNI_REGN_MCTRLM,\tSUNI_REGX_MCTRLM },\t\t\t\\\n\t{ /* 05 */\t\t\t\t\t\t\t\\\n\t  UTP_REGT_BITS,\tSUNI_REGO_MALARM,\t\t\t\\\n\t  SUNI_REGN_MALARM,\tSUNI_REGX_MALARM },\t\t\t\\\n\t{ /* 06 */\t\t\t\t\t\t\t\\\n\t  UTP_REGT_BITS,\tSUNI_REGO_POUT,\t\t\t\t\\\n\t  SUNI_REGN_POUT,\tSUNI_REGX_POUT },\t\t\t\\\n\t{ /* 07 */\t\t\t\t\t\t\t\\\n\t  UTP_REGT_INT8,\tSUNI_REGO_PIN,\t\t\t\t\\\n\t  SUNI_REGN_PIN,\tNULL },\t\t\t\t\t\\\n\t{ /* 08 */\t\t\t\t\t\t\t\\\n\t  UTP_REGT_BITS,\tSUNI_REGO_PINV,\t\t\t\t\\\n\t  SUNI_REGN_PINV,\tSUNI_REGX_PINV },\t\t\t\\\n\t{ /* 09 */\t\t\t\t\t\t\t\\\n\t  UTP_REGT_INT8,\tSUNI_REGO_PINE,\t\t\t\t\\\n\t  SUNI_REGN_PINE,\tNULL },\t\t\t\t\t\\\n\t{ /* 0A */\t\t\t\t\t\t\t\\\n\t  UTP_REGT_INT8,\tSUNI_REGO_XC1,\t\t\t\t\\\n\t  SUNI_REGN_XC1,\tNULL },\t\t\t\t\t\\\n\t{ /* 0B */\t\t\t\t\t\t\t\\\n\t  UTP_REGT_BITS,\tSUNI_REGO_APSCS,\t\t\t\\\n\t  SUNI_REGN_APSCS,\tSUNI_REGX_APSCS },\t\t\t\\\n\t{ /* 0C */\t\t\t\t\t\t\t\\\n\t  UTP_REGT_INT8,\tSUNI_REGO_RK1,\t\t\t\t\\\n\t  SUNI_REGN_RK1,\tNULL },\t\t\t\t\t\\\n\t{ /* 0D */\t\t\t\t\t\t\t\\\n\t  UTP_REGT_INT8,\tSUNI_REGO_RK2,\t\t\t\t\\\n\t  SUNI_REGN_RK2,\tNULL },\t\t\t\t\t\\\n\t{ /* 0E */\t\t\t\t\t\t\t\\\n\t  UTP_REGT_INT8,\tSUNI_REGO_RZ1,\t\t\t\t\\\n\t  SUNI_REGN_RZ1,\tNULL },\t\t\t\t\t\\\n\t{ /* 0F */\t\t\t\t\t\t\t\\\n\t  UTP_REGT_INT8,\tSUNI_REGO_XZ1,\t\t\t\t\\\n\t  SUNI_REGN_XZ1,\tNULL },\t\t\t\t\t\\\n\t{ /* 10 */\t\t\t\t\t\t\t\\\n\t  UTP_REGT_BITS,\tSUNI_REGO_RSOPCIE,\t\t\t\\\n\t  SUNI_REGN_RSOPCIE,\tSUNI_REGX_RSOPCIE_622 },\t\t\\\n\t{ /* 11 */\t\t\t\t\t\t\t\\\n\t  UTP_REGT_BITS,\tSUNI_REGO_RSOPSIS,\t\t\t\\\n\t  SUNI_REGN_RSOPSIS,\tSUNI_REGX_RSOPSIS },\t\t\t\\\n\t{ /* 12, 13 */\t\t\t\t\t\t\t\\\n\t  UTP_REGT_INT16,\tSUNI_REGO_RSOP_BIP8,\t\t\t\\\n\t  SUNI_REGN_RSOP_BIP8,\tNULL },\t\t\t\t\t\\\n\t{ /* 14 */\t\t\t\t\t\t\t\\\n\t  UTP_REGT_BITS,\tSUNI_REGO_TSOPCTRL,\t\t\t\\\n\t  SUNI_REGN_TSOPCTRL,\tSUNI_REGX_TSOPCTRL },\t\t\t\\\n\t{ /* 15 */\t\t\t\t\t\t\t\\\n\t  UTP_REGT_BITS,\tSUNI_REGO_TSOPDIAG,\t\t\t\\\n\t  SUNI_REGN_TSOPDIAG,\tSUNI_REGX_TSOPDIAG },\t\t\t\\\n\t  /* 16-17 unused */\t\t\t\t\t\t\\\n\t{ /* 18 */\t\t\t\t\t\t\t\\\n\t  UTP_REGT_BITS,\tSUNI_REGO_RLOPCTRL,\t\t\t\\\n\t  SUNI_REGN_RLOPCTRL,\tSUNI_REGX_RLOPCTRL_622 },\t\t\\\n\t{ /* 19 */\t\t\t\t\t\t\t\\\n\t  UTP_REGT_BITS,\tSUNI_REGO_RLOPINTR,\t\t\t\\\n\t  SUNI_REGN_RLOPINTR,\tSUNI_REGX_RLOPINTR },\t\t\t\\\n\t{ /* 1A, 1B, 1C */\t\t\t\t\t\t\\\n\t  UTP_REGT_INT20,\tSUNI_REGO_RLOPBIP8_24_96,\t\t\\\n\t  SUNI_REGN_RLOPBIP8_24_96, NULL },\t\t\t\t\\\n\t{ /* 1D, 1E, 1F */\t\t\t\t\t\t\\\n\t  UTP_REGT_INT20,\tSUNI_REGO_RLOPFEBE,\t\t\t\\\n\t  SUNI_REGN_RLOPFEBE,\tNULL },\t\t\t\t\t\\\n\t{ /* 20 */\t\t\t\t\t\t\t\\\n\t  UTP_REGT_BITS,\tSUNI_REGO_TLOPCTRL,\t\t\t\\\n\t  SUNI_REGN_TLOPCTRL,\tSUNI_REGX_TLOPCTRL_622 },\t\t\\\n\t{ /* 21 */\t\t\t\t\t\t\t\\\n\t  UTP_REGT_BITS,\tSUNI_REGO_TLOPDIAG,\t\t\t\\\n\t  SUNI_REGN_TLOPDIAG,\tSUNI_REGX_TLOPDIAG },\t\t\t\\\n\t{ /* 22 */\t\t\t\t\t\t\t\\\n\t  UTP_REGT_INT8,\tSUNI_REGO_TLOP_XK1,\t\t\t\\\n\t  SUNI_REGN_TLOP_XK1,\tNULL },\t\t\t\t\t\\\n\t{ /* 23 */\t\t\t\t\t\t\t\\\n\t  UTP_REGT_INT8,\tSUNI_REGO_TLOP_XK2,\t\t\t\\\n\t  SUNI_REGN_TLOP_XK2,\tNULL },\t\t\t\t\t\\\n\t  /* 24-27 unused */\t\t\t\t\t\t\\\n\t{ /* 28 */\t\t\t\t\t\t\t\\\n\t  UTP_REGT_BITS,\tSUNI_REGO_SSTBCTRL,\t\t\t\\\n\t  SUNI_REGN_SSTBCTRL,\tSUNI_REGX_SSTBCTRL },\t\t\t\\\n\t{ /* 29 */\t\t\t\t\t\t\t\\\n\t  UTP_REGT_BITS,\tSUNI_REGO_SSTBSTIS,\t\t\t\\\n\t  SUNI_REGN_SSTBSTIS,\tSUNI_REGX_SSTBSTIS },\t\t\t\\\n\t{ /* 2A */\t\t\t\t\t\t\t\\\n\t  UTP_REGT_BITS,\tSUNI_REGO_SSTBIAR,\t\t\t\\\n\t  SUNI_REGN_SSTBIAR,\tSUNI_REGX_SSTBIAR },\t\t\t\\\n\t{ /* 2B */\t\t\t\t\t\t\t\\\n\t  UTP_REGT_INT8,\tSUNI_REGO_SSTBIDR,\t\t\t\\\n\t  SUNI_REGN_SSTBIDR,\tNULL },\t\t\t\t\t\\\n\t  /* 2C unused (see chip errata) */\t\t\t\t\\\n\t{ /* 2D */\t\t\t\t\t\t\t\\\n\t  UTP_REGT_BITS,\tSUNI_REGO_SSTBCSMS,\t\t\t\\\n\t  SUNI_REGN_SSTBCSMS,\tSUNI_REGX_SSTBCSMS },\t\t\t\\\n\t  /* 2E-2F unused */\t\t\t\t\t\t\\\n\t{ /* 30 */\t\t\t\t\t\t\t\\\n\t  UTP_REGT_BITS,\tSUNI_REGO_RPOPCTRL,\t\t\t\\\n\t  SUNI_REGN_RPOPCTRL,\tSUNI_REGX_RPOPCTRL_622 },\t\t\\\n\t{ /* 31 */\t\t\t\t\t\t\t\\\n\t  UTP_REGT_BITS,\tSUNI_REGO_RPOPISTAT,\t\t\t\\\n\t  SUNI_REGN_RPOPISTAT,\tSUNI_REGX_RPOPISTAT },\t\t\t\\\n\t{ /* 32 */\t\t\t\t\t\t\t\\\n\t  UTP_REGT_BITS,\tSUNI_REGO_RPOPPIS,\t\t\t\\\n\t  SUNI_REGN_RPOPPIS,\tSUNI_REGX_RPOPPIS },\t\t\t\\\n\t{ /* 33 */\t\t\t\t\t\t\t\\\n\t  UTP_REGT_BITS,\tSUNI_REGO_RPOPIEN,\t\t\t\\\n\t  SUNI_REGN_RPOPIEN,\tSUNI_REGX_RPOPIEN },\t\t\t\\\n\t{ /* 34 */\t\t\t\t\t\t\t\\\n\t  UTP_REGT_BITS,\tSUNI_REGO_RPOPPIE,\t\t\t\\\n\t  SUNI_REGN_RPOPPIE,\tSUNI_REGX_RPOPPIE },\t\t\t\\\n\t{ /* 35, 36 */\t\t\t\t\t\t\t\\\n\t  UTP_REGT_INT10BITS,\tSUNI_REGO_RPOPPTR,\t\t\t\\\n\t  SUNI_REGN_RPOPPTR,\tSUNI_REGX_RPOPPTR },\t\t\t\\\n\t{ /* 37 */\t\t\t\t\t\t\t\\\n\t  UTP_REGT_INT8,\tSUNI_REGO_RPOPPSL,\t\t\t\\\n\t  SUNI_REGN_RPOPPSL,\tNULL },\t\t\t\t\t\\\n\t{ /* 38, 39 */\t\t\t\t\t\t\t\\\n\t  UTP_REGT_INT16,\tSUNI_REGO_RPOPBIP8,\t\t\t\\\n\t  SUNI_REGN_RPOPBIP8,\tNULL },\t\t\t\t\t\\\n\t{ /* 3A, 3B */\t\t\t\t\t\t\t\\\n\t  UTP_REGT_INT16,\tSUNI_REGO_RPOPFEBE,\t\t\t\\\n\t  SUNI_REGN_RPOPFEBE,\tNULL },\t\t\t\t\t\\\n\t{ /* 3C */\t\t\t\t\t\t\t\\\n\t  UTP_REGT_BITS,\tSUNI_REGO_RPOPRDI,\t\t\t\\\n\t  SUNI_REGN_RPOPRDI,\tSUNI_REGX_RPOPRDI },\t\t\t\\\n\t{ /* 3D */\t\t\t\t\t\t\t\\\n\t  UTP_REGT_BITS,\tSUNI_REGO_RPOPRING,\t\t\t\\\n\t  SUNI_REGN_RPOPRING,\tSUNI_REGX_RPOPRING },\t\t\t\\\n\t  /* 3E-3F unused */\t\t\t\t\t\t\\\n\t{ /* 40 */\t\t\t\t\t\t\t\\\n\t  UTP_REGT_BITS,\tSUNI_REGO_TPOPCTRL,\t\t\t\\\n\t  SUNI_REGN_TPOPCTRL,\tSUNI_REGX_TPOPCTRL_622 },\t\t\\\n\t{ /* 41 */\t\t\t\t\t\t\t\\\n\t  UTP_REGT_BITS,\tSUNI_REGO_TPOPPTRC,\t\t\t\\\n\t  SUNI_REGN_TPOPPTRC,\tSUNI_REGX_TPOPPTRC },\t\t\t\\\n\t  /* 42 unused */\t\t\t\t\t\t\\\n\t{ /* 43, 44 */\t\t\t\t\t\t\t\\\n\t  UTP_REGT_INT10BITS,\tSUNI_REGO_TPOPCP,\t\t\t\\\n\t  SUNI_REGN_TPOPCP,\tSUNI_REGX_TPOPCP },\t\t\t\\\n\t{ /* 45, 46 */\t\t\t\t\t\t\t\\\n\t  UTP_REGT_INT10BITS,\tSUNI_REGO_TPOPAPTR,\t\t\t\\\n\t  SUNI_REGN_TPOPAPTR,\tSUNI_REGX_TPOPAPTR },\t\t\t\\\n\t{ /* 47 */\t\t\t\t\t\t\t\\\n\t  UTP_REGT_INT8,\tSUNI_REGO_TPOPPT,\t\t\t\\\n\t  SUNI_REGN_TPOPPT,\tNULL },\t\t\t\t\t\\\n\t{ /* 48 */\t\t\t\t\t\t\t\\\n\t  UTP_REGT_INT8,\tSUNI_REGO_TPOPPSL,\t\t\t\\\n\t  SUNI_REGN_TPOPPSL,\tNULL },\t\t\t\t\t\\\n\t{ /* 49 */\t\t\t\t\t\t\t\\\n\t  UTP_REGT_BITS,\tSUNI_REGO_TPOPSTATUS,\t\t\t\\\n\t  SUNI_REGN_TPOPSTATUS,\tSUNI_REGX_TPOPSTATUS },\t\t\t\\\n\t{ /* 4A */\t\t\t\t\t\t\t\\\n\t  UTP_REGT_INT8,\tSUNI_REGO_TPOPPUC,\t\t\t\\\n\t  SUNI_REGN_TPOPPUC,\tNULL },\t\t\t\t\t\\\n\t{ /* 4B */\t\t\t\t\t\t\t\\\n\t  UTP_REGT_INT8,\tSUNI_REGO_TPOPPG1,\t\t\t\\\n\t  SUNI_REGN_TPOPPG1,\tNULL },\t\t\t\t\t\\\n\t{ /* 4C */\t\t\t\t\t\t\t\\\n\t  UTP_REGT_INT8,\tSUNI_REGO_TPOPPG2,\t\t\t\\\n\t  SUNI_REGN_TPOPPG2,\tNULL },\t\t\t\t\t\\\n\t{ /* 4D */\t\t\t\t\t\t\t\\\n\t  UTP_REGT_INT8,\tSUNI_REGO_TPOPPG3,\t\t\t\\\n\t  SUNI_REGN_TPOPPG3,\tNULL },\t\t\t\t\t\\\n\t  /* 4E-4F unused */\t\t\t\t\t\t\\\n\t{ /* 50 */\t\t\t\t\t\t\t\\\n\t  UTP_REGT_BITS,\tSUNI_REGO_RACPCTRL,\t\t\t\\\n\t  SUNI_REGN_RACPCTRL,\tSUNI_REGX_RACPCTRL_622 },\t\t\\\n\t{ /* 51 */\t\t\t\t\t\t\t\\\n\t  UTP_REGT_BITS,\tSUNI_REGO_RACPIS,\t\t\t\\\n\t  SUNI_REGN_RACPIS,\tSUNI_REGX_RACPIS },\t\t\t\\\n\t{ /* 52 */\t\t\t\t\t\t\t\\\n\t  UTP_REGT_BITS,\tSUNI_REGO_RACPIEC,\t\t\t\\\n\t  SUNI_REGN_RACPIEC,\tSUNI_REGX_RACPIEC },\t\t\t\\\n\t{ /* 53 */\t\t\t\t\t\t\t\\\n\t  UTP_REGT_BITS,\tSUNI_REGO_RACPPATTERN_622,\t\t\\\n\t  SUNI_REGN_RACPPATTERN, SUNI_REGX_RACPPATTERN },\t\t\\\n\t{ /* 54 */\t\t\t\t\t\t\t\\\n\t  UTP_REGT_BITS,\tSUNI_REGO_RACPMASK_622,\t\t\t\\\n\t  SUNI_REGN_RACPMASK,\tSUNI_REGX_RACPMASK },\t\t\t\\\n\t{ /* 55, 56 */\t\t\t\t\t\t\t\\\n\t  UTP_REGT_INT12,\tSUNI_REGO_RACPCHCS_622,\t\t\t\\\n\t  SUNI_REGN_RACPCHCS,\tNULL },\t\t\t\t\t\\\n\t{ /* 57, 58 */\t\t\t\t\t\t\t\\\n\t  UTP_REGT_INT12,\tSUNI_REGO_RACPUHCS_622,\t\t\t\\\n\t  SUNI_REGN_RACPUHCS,\tNULL },\t\t\t\t\t\\\n\t{ /* 59, 5A, 5B */\t\t\t\t\t\t\\\n\t  UTP_REGT_INT21,\tSUNI_REGO_RACPCNT_622,\t\t\t\\\n\t  SUNI_REGN_RACPCNT,\tNULL },\t\t\t\t\t\\\n\t{ /* 5C */\t\t\t\t\t\t\t\\\n\t  UTP_REGT_BITS,\tSUNI_REGO_RACPGFC,\t\t\t\\\n\t  SUNI_REGN_RACPGFC,\tSUNI_REGX_RACPGFC },\t\t\t\\\n\t  /* 5D-5F unused */\t\t\t\t\t\t\\\n\t{ /* 60 */\t\t\t\t\t\t\t\\\n\t  UTP_REGT_BITS,\tSUNI_REGO_TACPCTRL,\t\t\t\\\n\t  SUNI_REGN_TACPCTRL,\tSUNI_REGX_TACPCTRL_622 },\t\t\\\n\t{ /* 61 */\t\t\t\t\t\t\t\\\n\t  UTP_REGT_BITS,\tSUNI_REGO_TACPIDLEH,\t\t\t\\\n\t  SUNI_REGN_TACPIDLEH,\tSUNI_REGX_TACPIDLEH },\t\t\t\\\n\t{ /* 62 */\t\t\t\t\t\t\t\\\n\t  UTP_REGT_INT8,\tSUNI_REGO_TACPIDLEP,\t\t\t\\\n\t  SUNI_REGN_TACPIDLEP,\tNULL },\t\t\t\t\t\\\n\t{ /* 63 */\t\t\t\t\t\t\t\\\n\t  UTP_REGT_BITS,\tSUNI_REGO_TACPFIFOC,\t\t\t\\\n\t  SUNI_REGN_TACPFIFOC,\tSUNI_REGX_TACPFIFOC_622 },\t\t\\\n\t{ /* 64, 65, 66 */\t\t\t\t\t\t\\\n\t  UTP_REGT_INT21,\tSUNI_REGO_TACPCNT,\t\t\t\\\n\t  SUNI_REGN_TACPCNT,\tNULL },\t\t\t\t\t\\\n\t{ /* 67 */\t\t\t\t\t\t\t\\\n\t  UTP_REGT_BITS,\tSUNI_REGO_TACPGFC,\t\t\t\\\n\t  SUNI_REGN_TACPGFC,\tSUNI_REGX_TACPGFC },\t\t\t\\\n\t{ /* 68 */\t\t\t\t\t\t\t\\\n\t  UTP_REGT_BITS,\tSUNI_REGO_SPTBCTRL,\t\t\t\\\n\t  SUNI_REGN_SPTBCTRL,\tSUNI_REGX_SPTBCTRL },\t\t\t\\\n\t{ /* 69 */\t\t\t\t\t\t\t\\\n\t  UTP_REGT_BITS,\tSUNI_REGO_SPTBPTIS,\t\t\t\\\n\t  SUNI_REGN_SPTBPTIS,\tSUNI_REGX_SPTBPTIS },\t\t\t\\\n\t{ /* 6A */\t\t\t\t\t\t\t\\\n\t  UTP_REGT_BITS,\tSUNI_REGO_SPTBIAR,\t\t\t\\\n\t  SUNI_REGN_SPTBIAR,\tSUNI_REGX_SPTBIAR },\t\t\t\\\n\t{ /* 6B */\t\t\t\t\t\t\t\\\n\t  UTP_REGT_INT8,\tSUNI_REGO_SPTBIDR,\t\t\t\\\n\t  SUNI_REGN_SPTBIDR,\tNULL },\t\t\t\t\t\\\n\t{ /* 6C */\t\t\t\t\t\t\t\\\n\t  UTP_REGT_INT8,\tSUNI_REGO_SPTBEPSL,\t\t\t\\\n\t  SUNI_REGN_SPTBEPSL,\tNULL },\t\t\t\t\t\\\n\t{ /* 6D */\t\t\t\t\t\t\t\\\n\t  UTP_REGT_BITS,\tSUNI_REGO_SPTBPSLS,\t\t\t\\\n\t  SUNI_REGN_SPTBPSLS,\tSUNI_REGX_SPTBPSLS },\t\t\t\\\n\t  /* 6E-6F unused */\t\t\t\t\t\t\\\n\t{ /* 70 */\t\t\t\t\t\t\t\\\n\t  UTP_REGT_BITS,\tSUNI_REGO_BERMCTRL,\t\t\t\\\n\t  SUNI_REGN_BERMCTRL,\tSUNI_REGX_BERMCTRL },\t\t\t\\\n\t{ /* 71 */\t\t\t\t\t\t\t\\\n\t  UTP_REGT_BITS,\tSUNI_REGO_BERMINT,\t\t\t\\\n\t  SUNI_REGN_BERMINT,\tSUNI_REGX_BERMINT },\t\t\t\\\n\t{ /* 72, 73 */\t\t\t\t\t\t\t\\\n\t  UTP_REGT_INT16,\tSUNI_REGO_BERMLAP,\t\t\t\\\n\t  SUNI_REGN_BERMLAP,\tNULL },\t\t\t\t\t\\\n\t{ /* 74, 75 */\t\t\t\t\t\t\t\\\n\t  UTP_REGT_INT16,\tSUNI_REGO_BERMLT,\t\t\t\\\n\t  SUNI_REGN_BERMLT,\tNULL },\t\t\t\t\t\\\n\t  /* 76-7f unused */\t\t\t\t\t\t\\\n\t{ /* 80 */\t\t\t\t\t\t\t\\\n\t  UTP_REGT_BITS,\tSUNI_REGO_MTEST,\t\t\t\\\n\t  SUNI_REGN_MTEST,\tSUNI_REGX_MTEST_622 }\n\n#endif /* _DEV_UTOPIA_SUNI_H */\n"
  },
  {
    "path": "freebsd-headers/dev/utopia/utopia.h",
    "content": "/*-\n * Copyright (c) 2003\n *\tFraunhofer Institute for Open Communication Systems (FhG Fokus).\n * \tAll rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * Author: Hartmut Brandt <harti@freebsd.org>\n *\n * $FreeBSD: release/9.0.0/sys/dev/utopia/utopia.h 142384 2005-02-24 16:56:36Z harti $\n */\n#ifndef _DEV_UTOPIA_UTOPIA_H\n#define\t_DEV_UTOPIA_UTOPIA_H\n\n/* Structure for user-level register formatting */\nstruct utopia_print {\n\tuint8_t\t\ttype;\t/* register type */\n\tuint8_t\t\treg;\t/* register number */\n\tconst char\t*name;\t/* register name */\n\tconst char\t*fmt;\t/* format for printing */\n};\n\n/*\n * Types of registers\n */\n#define\tUTP_REGT_BITS\t\t0x0\t/* use printb to print */\n#define\tUTP_REGT_INT8\t\t0x1\t/* 8 bit hex number */\n#define\tUTP_REGT_INT10BITS\t0x2\t/* 10 bit hex number + 6 bit printb */\n#define\tUTP_REGT_INT12\t\t0x3\t/* 12 bit LE hex */\n#define\tUTP_REGT_INT16\t\t0x4\t/* 16 bit LE hex */\n#define\tUTP_REGT_INT19\t\t0x5\t/* 19 bit LE hex */\n#define\tUTP_REGT_INT20\t\t0x6\t/* 20 bit LE hex */\n#define\tUTP_REGT_INT21\t\t0x7\t/* 21 bit LE hex */\n#define\tUTP_REGT_INT18\t\t0x8\t/* 18 bit LE hex */\n\n/* number of additional registers per type */\n#define\tUTP_REG_ADD\t0, 0, 1, 1, 1, 2, 2, 2, 2\n\n/* flags field */\n#define\tUTP_FL_NORESET\t\t0x0001\t/* cannot write MRESET register */\n#define\tUTP_FL_POLL_CARRIER\t0x0002\t/* need to poll for carrier */\n\n/* state field */\n#define\tUTP_ST_ACTIVE\t\t0x0001\t/* registers accessible */\n#define\tUTP_ST_SDH\t\t0x0002\t/* SDH or SONET */\n#define\tUTP_ST_UNASS\t\t0x0004\t/* produce unassigned cells */\n#define\tUTP_ST_NOSCRAMB\t\t0x0008\t/* no scrambling */\n#define\tUTP_ST_DETACH\t\t0x0010\t/* detaching */\n#define\tUTP_ST_ATTACHED\t\t0x0020\t/* successful attached */\n\n/* carrier field */\n#define\tUTP_CARR_UNKNOWN\t0\n#define\tUTP_CARR_OK\t\t1\n#define\tUTP_CARR_LOST\t\t2\n\n/* loopback field */\n#define\tUTP_LOOP_NONE\t\t0x0000\n#define\tUTP_LOOP_TIME\t\t0x0001\t/* timing source loopback */\n#define\tUTP_LOOP_DIAG\t\t0x0002\t/* diagnostic loopback */\n#define\tUTP_LOOP_LINE\t\t0x0004\t/* serial line loopback */\n#define\tUTP_LOOP_PARAL\t\t0x0008\t/* parallel diagnostic loopback */\n#define\tUTP_LOOP_TWIST\t\t0x0010\t/* twisted pair diagnostic loopback */\n#define\tUTP_LOOP_PATH\t\t0x0020\t/* diagnostic path loopback */\n\n/* type */\n#define\tUTP_TYPE_UNKNOWN\t0\n#define\tUTP_TYPE_SUNI_LITE\t1\n#define\tUTP_TYPE_SUNI_ULTRA\t2\n#define\tUTP_TYPE_SUNI_622\t3\n#define\tUTP_TYPE_IDT77105\t4\n#define\tUTP_TYPE_IDT77155\t5\n#define\tUTP_TYPE_CX28250\t6\n\n/*\n * Statistics. These structures are versioned.\n */\nstruct utopia_stats1 {\n\tuint32_t\tversion;\t/* version of this statistics struct */\n\tuint32_t\tfill;\n\n\tuint64_t\trx_sbip;\t/* rx section BIP errors */\n\tuint64_t\trx_lbip;\t/* rx line BIP errors */\n\tuint64_t\trx_lfebe;\t/* rx line far end block errors */\n\tuint64_t\trx_pbip;\t/* rx path BIP errors */\n\tuint64_t\trx_pfebe;\t/* rx path far end block errors */\n\tuint64_t\trx_cells;\t/* received cells */\n\tuint64_t\trx_corr;\t/* correctable cell errors */\n\tuint64_t\trx_uncorr;\t/* uncorrectable cell errors */\n\tuint64_t\trx_symerr;\t/* symbol errors */\n\n\tuint64_t\ttx_cells;\t/* transmitted cells */\n};\n\n#ifdef _KERNEL\n\n#include <sys/queue.h>\n\n/*\n * These must be implemented by the card driver\n */\nstruct utopia_methods {\n\t/* read at most n PHY registers starting at reg into val */\n\tint\t(*readregs)(struct ifatm *, u_int reg, uint8_t *val, u_int *n);\n\n\t/* change the bits given by mask to them in val in register reg */\n\tint\t(*writereg)(struct ifatm *, u_int reg, u_int mask, u_int val);\n};\n\n/*\n * Public state\n */\nstruct utopia {\n\tstruct ifatm\t*ifatm;\t\t/* driver data */\n\tstruct ifmedia\t*media;\t\t/* driver supplied */\n\tstruct mtx\t*lock;\t\t/* driver supplied */\n\tconst struct utopia_methods *methods;\n\tLIST_ENTRY(utopia) link;\t/* list of these structures */\n\tu_int\t\tflags;\t\t/* flags set by the driver */\n\tu_int\t\tstate;\t\t/* current state */\n\tu_int\t\tcarrier;\t/* carrier state */\n\tu_int\t\tloopback;\t/* loopback mode */\n\tconst struct utopia_chip *chip;\t/* chip operations */\n\tstruct utopia_stats1 stats;\t/* statistics */\n};\n\nstruct utopia_chip {\n\t/* type and name of the chip */\n\tu_int\ttype;\n\tconst char *const name;\n\n\t/* number of registers */\n\tu_int\tnregs;\n\n\t/* reset chip to known state */\n\tint\t(*reset)(struct utopia *);\n\n\t/* set SONET/SDH mode */\n\tint\t(*set_sdh)(struct utopia *, int sdh);\n\n\t/* set idle/unassigned cells */\n\tint\t(*set_unass)(struct utopia *, int unass);\n\n\t/* enable/disable scrambling */\n\tint\t(*set_noscramb)(struct utopia *, int noscramb);\n\n\t/* update carrier status */\n\tint\t(*update_carrier)(struct utopia *);\n\n\t/* set loopback mode */\n\tint\t(*set_loopback)(struct utopia *, u_int mode);\n\n\t/* handle interrupt */\n\tvoid\t(*intr)(struct utopia *);\n\n\t/* update statistics */\n\tvoid\t(*update_stats)(struct utopia *);\n};\n\n/*\n * These are implemented in the common utopia code\n */\nint utopia_attach(struct utopia *, struct ifatm *, struct ifmedia *,\n    struct mtx *, struct sysctl_ctx_list *, struct sysctl_oid_list *,\n    const struct utopia_methods *);\nvoid utopia_detach(struct utopia *);\n\nint utopia_start(struct utopia *);\nvoid utopia_stop(struct utopia *);\n\nvoid utopia_init_media(struct utopia *);\nvoid utopia_reset_media(struct utopia *);\n\n#define\tutopia_reset(S)\t\t\t((S)->chip->reset((S)))\n#define\tutopia_set_sdh(S, SDH)\t\t((S)->chip->set_sdh((S), (SDH)))\n#define\tutopia_set_unass(S, U)\t\t((S)->chip->set_unass((S), (U)))\n#define\tutopia_set_noscramb(S, N)\t((S)->chip->set_noscramb((S), (N)))\n#define\tutopia_update_carrier(S)\t((S)->chip->update_carrier((S)))\n#define\tutopia_update_stats(S)\t\t((S)->chip->update_stats((S)))\n#define\tutopia_set_loopback(S, L)\t((S)->chip->set_loopback((S), (L)))\n#define\tutopia_intr(S)\t\t\t((S)->chip->intr((S)))\n\n#endif /* _KERNEL */\n\n#endif\t/* _DEV_UTOPIA_UTOPIA_H */\n"
  },
  {
    "path": "freebsd-headers/dev/utopia/utopia_priv.h",
    "content": "/*-\n * Copyright (c) 2005\n *\tHartmut Brandt.\n * \tAll rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * Author: Hartmut Brandt <harti@freebsd.org>\n *\n * $FreeBSD: release/9.0.0/sys/dev/utopia/utopia_priv.h 142384 2005-02-24 16:56:36Z harti $\n *\n * Private include file for the interface between chip files and\n * the utopia main stuff.\n */\n\n#ifndef _DEV_UTOPIA_UTOPIA_PRIV_H\n#define\t_DEV_UTOPIA_UTOPIA_PRIV_H\n\n#define UTP_READREGS(UTOPIA, REG, VALP, NP)\t\t\t\t\\\n    (UTOPIA)->methods->readregs((UTOPIA)->ifatm, REG, VALP, NP)\n#define UTP_WRITEREG(UTOPIA, REG, MASK, VAL)\t\t\t\\\n    (UTOPIA)->methods->writereg((UTOPIA)->ifatm, REG, MASK, VAL)\n\nuint32_t utopia_update(struct utopia *, u_int, u_int, uint32_t);\nvoid utopia_check_carrier(struct utopia *, u_int);\n\n#endif\t/* _DEV_UTOPIA_UTOPIA_PRIV_H */\n"
  },
  {
    "path": "freebsd-headers/dev/vkbd/vkbd_var.h",
    "content": "/*-\n * vkbd_var.h\n *\n * Copyright (c) 2004 Maksim Yevmenkin <m_evmenkin@yahoo.com>\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $Id: vkbd_var.h,v 1.4 2004/08/17 17:43:14 max Exp $\n * $FreeBSD: release/9.0.0/sys/dev/vkbd/vkbd_var.h 139749 2005-01-06 01:43:34Z imp $\n */\n\n#ifndef _VKBD_VAR_H_\n#define _VKBD_VAR_H_\n\n#define\tVKBD_Q_SIZE\t64\t/* vkbd input queue size */\n\nstruct vkbd_status\n{\n\tint\tmode;\t\t/* keyboard mode */\n\tint\tleds;\t\t/* keyboard LEDs */\n\tint\tlock;\t\t/* keyboard lock key state */\n\tint\tdelay;\t\t/* keyboard delay */\n\tint\trate;\t\t/* keyboard rate */\n\tint\treserved[3];\n};\n\ntypedef struct vkbd_status\tvkbd_status_t;\ntypedef struct vkbd_status *\tvkbd_status_p;\n\n#endif /* ndef _VKBD_VAR_H_ */\n\n"
  },
  {
    "path": "freebsd-headers/dev/wi/if_wavelan_ieee.h",
    "content": "/*-\n * Copyright (c) 1997, 1998, 1999\n *\tBill Paul <wpaul@ctr.columbia.edu>.  All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. All advertising materials mentioning features or use of this software\n *    must display the following acknowledgement:\n *\tThis product includes software developed by Bill Paul.\n * 4. Neither the name of the author nor the names of any co-contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY Bill Paul AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL Bill Paul OR THE VOICES IN HIS HEAD\n * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\n * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\n * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\n * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\n * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF\n * THE POSSIBILITY OF SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/dev/wi/if_wavelan_ieee.h 192492 2009-05-20 22:28:55Z imp $\n */\n\n#ifndef _IF_WAVELAN_IEEE_H\n#define _IF_WAVELAN_IEEE_H\n\n/*\n * This header defines a simple command interface to the FreeBSD\n * WaveLAN/IEEE driver (wi) driver, which is used to set certain\n * device-specific parameters which can't be easily managed through\n * ifconfig(8). No, sysctl(2) is not the answer. I said a _simple_\n * interface, didn't I.\n */\n\n#ifndef SIOCSWAVELAN\n#define SIOCSWAVELAN\tSIOCSIFGENERIC\n#endif\n\n#ifndef SIOCGWAVELAN\n#define SIOCGWAVELAN\tSIOCGIFGENERIC\n#endif\n\n/*\n * Technically I don't think there's a limit to a record\n * length. The largest record is the one that contains the CIS\n * data, which is 240 words long, so 256 should be a safe\n * value.\n */\n#define WI_MAX_DATALEN\t512\n\n#if 0\nstruct wi_req {\n\tu_int16_t\twi_len;\n\tu_int16_t\twi_type;\n\tu_int16_t\twi_val[WI_MAX_DATALEN];\n};\n#endif\n\n/*\n * Private LTV records (interpreted only by the driver). This is\n * a minor kludge to allow reading the interface statistics from\n * the driver.\n */\n#define WI_RID_IFACE_STATS\t0x0100\n#define WI_RID_MGMT_XMIT\t0x0200\n#define WI_RID_ZERO_CACHE\t0x0300\n#define WI_RID_READ_CACHE\t0x0400\n#define WI_RID_FWDOWNLOAD\t0x0500\n#define WI_RID_MONITOR_MODE\t0x0600\n#define WI_RID_MIF\t\t0x0700\n#define\tWI_RID_SCAN_APS\t\t0x0800\n#define\tWI_RID_READ_APS\t\t0x0900\n\nstruct wi_80211_hdr {\n\tu_int16_t\t\tframe_ctl;\n\tu_int16_t\t\tdur_id;\n\tu_int8_t\t\taddr1[6];\n\tu_int8_t\t\taddr2[6];\n\tu_int8_t\t\taddr3[6];\n\tu_int16_t\t\tseq_ctl;\n\tu_int8_t\t\taddr4[6];\n};\n\n#define WI_FCTL_VERS\t\t0x0002\n#define WI_FCTL_FTYPE\t\t0x000C\n#define WI_FCTL_STYPE\t\t0x00F0\n#define WI_FCTL_TODS\t\t0x0100\n#define WI_FCTL_FROMDS\t\t0x0200\n#define WI_FCTL_MOREFRAGS\t0x0400\n#define WI_FCTL_RETRY\t\t0x0800\n#define WI_FCTL_PM\t\t0x1000\n#define WI_FCTL_MOREDATA\t0x2000\n#define WI_FCTL_WEP\t\t0x4000\n#define WI_FCTL_ORDER\t\t0x8000\n\n#define WI_FTYPE_MGMT\t\t0x0000\n#define WI_FTYPE_CTL\t\t0x0004\n#define WI_FTYPE_DATA\t\t0x0008\n\n#define WI_STYPE_MGMT_ASREQ\t0x0000\t/* association request */\n#define WI_STYPE_MGMT_ASRESP\t0x0010\t/* association response */\n#define WI_STYPE_MGMT_REASREQ\t0x0020\t/* reassociation request */\n#define WI_STYPE_MGMT_REASRESP\t0x0030\t/* reassociation response */\n#define WI_STYPE_MGMT_PROBEREQ\t0x0040\t/* probe request */\n#define WI_STYPE_MGMT_PROBERESP\t0x0050\t/* probe response */\n#define WI_STYPE_MGMT_BEACON\t0x0080\t/* beacon */\n#define WI_STYPE_MGMT_ATIM\t0x0090\t/* announcement traffic ind msg */\n#define WI_STYPE_MGMT_DISAS\t0x00A0\t/* disassociation */\n#define WI_STYPE_MGMT_AUTH\t0x00B0\t/* authentication */\n#define WI_STYPE_MGMT_DEAUTH\t0x00C0\t/* deauthentication */\n\n#define WI_STYPE_CTL_PSPOLL     0x00A0\n#define WI_STYPE_CTL_RTS        0x00B0\n#define WI_STYPE_CTL_CTS        0x00C0\n#define WI_STYPE_CTL_ACK        0x00D0\n#define WI_STYPE_CTL_CFEND      0x00E0\n#define WI_STYPE_CTL_CFENDACK   0x00F0\n\nstruct wi_mgmt_hdr {\n\tu_int16_t\t\tframe_ctl;\n\tu_int16_t\t\tduration;\n\tu_int8_t\t\tdst_addr[6];\n\tu_int8_t\t\tsrc_addr[6];\n\tu_int8_t\t\tbssid[6];\n\tu_int16_t\t\tseq_ctl;\n};\n\n/* \n * Lucent/wavelan IEEE signal strength cache\n *\n * driver keeps cache of last\n * MAXWICACHE packets to arrive including signal strength info.\n * daemons may read this via ioctl\n *\n * Each entry in the wi_sigcache has a unique macsrc.\n */\nstruct wi_sigcache {\n\tchar\tmacsrc[6];\t/* unique MAC address for entry */\n\tint\tipsrc;\t\t/* ip address associated with packet */\n\tint\tsignal;\t\t/* signal strength of the packet */\n\tint\tnoise;\t\t/* noise value */\n\tint\tquality;\t/* quality of the packet */\n};\n\n/*\n * Firmware downloading API.  We support downloading into RAM and into\n * flash.  We copy the entire .hex file for both the primary and secondary\n * firmware into the kernel, which is minorly gross, but matches the\n * format of the compiled in firmware.\n */\nstruct wi_fwdownload {\n\tint\ttype;\t\t/* What type of download. */\n#define WI_FW_RAM\t1\n#define WI_FW_FLASH\t2\n\tsize_t\tpri_len;\t/* Primary firmware length */\n\tsize_t\tsec_len;\t/* Secondary firmware length */\n\tcaddr_t\tpri_data;\t/* Pointer (user) to primary data */\n\tcaddr_t sec_data;\t/* Pointer (user) to secondary data */\n};\n\nstruct wi_counters {\n\tu_int32_t\t\twi_tx_unicast_frames;\n\tu_int32_t\t\twi_tx_multicast_frames;\n\tu_int32_t\t\twi_tx_fragments;\n\tu_int32_t\t\twi_tx_unicast_octets;\n\tu_int32_t\t\twi_tx_multicast_octets;\n\tu_int32_t\t\twi_tx_deferred_xmits;\n\tu_int32_t\t\twi_tx_single_retries;\n\tu_int32_t\t\twi_tx_multi_retries;\n\tu_int32_t\t\twi_tx_retry_limit;\n\tu_int32_t\t\twi_tx_discards;\n\tu_int32_t\t\twi_rx_unicast_frames;\n\tu_int32_t\t\twi_rx_multicast_frames;\n\tu_int32_t\t\twi_rx_fragments;\n\tu_int32_t\t\twi_rx_unicast_octets;\n\tu_int32_t\t\twi_rx_multicast_octets;\n\tu_int32_t\t\twi_rx_fcs_errors;\n\tu_int32_t\t\twi_rx_discards_nobuf;\n\tu_int32_t\t\twi_tx_discards_wrong_sa;\n\tu_int32_t\t\twi_rx_WEP_cant_decrypt;\n\tu_int32_t\t\twi_rx_msg_in_msg_frags;\n\tu_int32_t\t\twi_rx_msg_in_bad_msg_frags;\n};\n\n/*\n * Network parameters, static configuration entities.\n */\n#define WI_RID_PORTTYPE\t\t0xFC00 /* Connection control characteristics */\n#define WI_RID_MAC_NODE\t\t0xFC01 /* MAC address of this station */\n#define WI_RID_DESIRED_SSID\t0xFC02 /* Service Set ID for connection */\n#define WI_RID_OWN_CHNL\t\t0xFC03 /* Comm channel for BSS creation */\n#define WI_RID_OWN_SSID\t\t0xFC04 /* IBSS creation ID */\n#define WI_RID_OWN_ATIM_WIN\t0xFC05 /* ATIM window time for IBSS creation */\n#define WI_RID_SYSTEM_SCALE\t0xFC06 /* scale that specifies AP density */\n#define WI_RID_MAX_DATALEN\t0xFC07 /* Max len of MAC frame body data */\n#define WI_RID_MAC_WDS\t\t0xFC08 /* MAC addr of corresponding WDS node */\n#define WI_RID_PM_ENABLED\t0xFC09 /* ESS power management enable */\n#define WI_RID_PM_EPS\t\t0xFC0A /* PM EPS/PS mode */\n#define WI_RID_MCAST_RX\t\t0xFC0B /* ESS PM mcast reception */\n#define WI_RID_MAX_SLEEP\t0xFC0C /* max sleep time for ESS PM */\n#define WI_RID_HOLDOVER\t\t0xFC0D /* holdover time for ESS PM */\n#define WI_RID_NODENAME\t\t0xFC0E /* ID name of this node for diag */\n#define WI_RID_DTIM_PERIOD\t0xFC10 /* beacon interval between DTIMs */\n#define WI_RID_WDS_ADDR1\t0xFC11 /* port 1 MAC of WDS link node */\n#define WI_RID_WDS_ADDR2\t0xFC12 /* port 1 MAC of WDS link node */\n#define WI_RID_WDS_ADDR3\t0xFC13 /* port 1 MAC of WDS link node */\n#define WI_RID_WDS_ADDR4\t0xFC14 /* port 1 MAC of WDS link node */\n#define WI_RID_WDS_ADDR5\t0xFC15 /* port 1 MAC of WDS link node */\n#define WI_RID_WDS_ADDR6\t0xFC16 /* port 1 MAC of WDS link node */\n#define WI_RID_MCAST_PM_BUF\t0xFC17 /* PM buffering of mcast */\n#define WI_RID_ENCRYPTION\t0xFC20 /* enable/disable WEP */\n#define WI_RID_AUTHTYPE\t\t0xFC21 /* specify authentication type */\n#define WI_RID_P2_TX_CRYPT_KEY\t0xFC23\n#define WI_RID_P2_CRYPT_KEY0\t0xFC24\n#define WI_RID_P2_CRYPT_KEY1\t0xFC25\n#define WI_RID_MICROWAVE_OVEN\t0xFC25\n#define WI_RID_P2_CRYPT_KEY2\t0xFC26\n#define WI_RID_P2_CRYPT_KEY3\t0xFC27\n#define WI_RID_P2_ENCRYPTION\t0xFC28\n#define WI_RID_ALT_RETRY_CNT\t0xFC32\n#define\t PRIVACY_INVOKED\t0x01\n#define\t EXCLUDE_UNENCRYPTED\t0x02\n#define\t HOST_ENCRYPT\t\t0x10\n#define\t IV_EVERY_FRAME\t\t0x00\t/* IV = Initialization Vector */\n#define\t IV_EVERY10_FRAME\t0x20\t/* every 10 frame IV reuse */\n#define\t IV_EVERY50_FRAME\t0x40\t/* every 50 frame IV reuse */\n#define\t IV_EVERY100_FRAME\t0x60\t/* every 100 frame IV reuse */\n#define\t HOST_DECRYPT\t\t0x80\n#define WI_RID_WEP_MAPTABLE\t0xFC29\n#define WI_RID_CNFAUTHMODE\t0xFC2A\n#define WI_RID_ROAMING_MODE\t0xFC2D\n#define WI_RID_OWN_BEACON_INT\t0xFC33 /* beacon xmit time for BSS creation */\n#define\tWI_RID_ENH_SECURITY\t0xFC43 /* enhanced security (AP mode) */\n#define WI_RID_CNF_DBM_ADJUST\t0xFC46\n#define WI_RID_DBM_ADJUST\t0xFC46 /* RSSI - WI_RID_DBM_ADJUST ~ dBm */\n#define\tWI_RID_WPA_DATA\t\t0xFC48 /* WPA IE */\n#define WI_RID_BASIC_RATE\t0xFCB3\n#define WI_RID_SUPPORT_RATE\t0xFCB4\n#define\tWI_RID_WPA_HANDLING\t0xFCBB /* WPA handling procedures */\n\n/*\n * Network parameters, dynamic configuration entities\n */\n#define WI_RID_MCAST_LIST\t0xFC80 /* list of multicast addrs */\n#define WI_RID_CREATE_IBSS\t0xFC81 /* create IBSS */\n#define WI_RID_FRAG_THRESH\t0xFC82 /* frag len, unicast msg xmit */\n#define WI_RID_RTS_THRESH\t0xFC83 /* frame len for RTS/CTS handshake */\n#define WI_RID_TX_RATE\t\t0xFC84 /* data rate for message xmit\n \t\t\t\t\t* 0 == Fixed 1mbps\n \t\t\t\t\t* 1 == Fixed 2mbps\n \t\t\t\t\t* 2 == auto fallback\n\t\t\t\t\t*/\n#define WI_RID_PROMISC\t\t0xFC85 /* enable promisc mode */\n#define WI_RID_FRAG_THRESH0\t0xFC90\n#define WI_RID_FRAG_THRESH1\t0xFC91\n#define WI_RID_FRAG_THRESH2\t0xFC92\n#define WI_RID_FRAG_THRESH3\t0xFC93\n#define WI_RID_FRAG_THRESH4\t0xFC94\n#define WI_RID_FRAG_THRESH5\t0xFC95\n#define WI_RID_FRAG_THRESH6\t0xFC96\n#define WI_RID_RTS_THRESH0\t0xFC97\n#define WI_RID_RTS_THRESH1\t0xFC98\n#define WI_RID_RTS_THRESH2\t0xFC99\n#define WI_RID_RTS_THRESH3\t0xFC9A\n#define WI_RID_RTS_THRESH4\t0xFC9B\n#define WI_RID_RTS_THRESH5\t0xFC9C\n#define WI_RID_RTS_THRESH6\t0xFC9D\n#define WI_RID_TX_RATE0\t\t0xFC9E\n#define WI_RID_TX_RATE1\t\t0xFC9F\n#define WI_RID_TX_RATE2\t\t0xFCA0\n#define WI_RID_TX_RATE3\t\t0xFCA1\n#define WI_RID_TX_RATE4\t\t0xFCA2\n#define WI_RID_TX_RATE5\t\t0xFCA3\n#define WI_RID_TX_RATE6\t\t0xFCA4\n#define WI_RID_DEFLT_CRYPT_KEYS\t0xFCB0\n#define WI_RID_TX_CRYPT_KEY\t0xFCB1\n#define WI_RID_TICK_TIME\t0xFCE0\n\nstruct wi_key {\n\tu_int16_t\t\twi_keylen;\n\tu_int8_t\t\twi_keydat[14];\n};\n\n#define WI_NLTV_KEYS 4\nstruct wi_ltv_keys {\n\tu_int16_t\t\twi_len;\n\tu_int16_t\t\twi_type;\n\tstruct wi_key\t\twi_keys[WI_NLTV_KEYS];\n};\n\n/*\n * NIC information\n */\n#define WI_RID_DNLD_BUF\t\t0xFD01\n#define WI_RID_MEMSZ\t\t0xFD02 /* memory size info (XXX Lucent) */\n\t\t\t\t\t/* Looks like on lucnet pri firm too */\n#define\tWI_RID_PRI_IDENTITY\t0xFD02 /* primary funcs firmware ident (PRISM2) */\n#define WI_RID_PRI_SUP_RANGE\t0xFD03 /* primary supplier compatibility */\n#define WI_RID_CIF_ACT_RANGE\t0xFD04 /* controller sup. compatibility */\n#define WI_RID_SERIALNO\t\t0xFD0A /* card serial number */\n#define WI_RID_CARD_ID\t\t0xFD0B /* card identification */\n#define WI_RID_MFI_SUP_RANGE\t0xFD0C /* modem supplier compatibility */\n#define WI_RID_CFI_SUP_RANGE\t0xFD0D /* controller sup. compatibility */\n#define WI_RID_CHANNEL_LIST\t0xFD10 /* allowd comm. frequencies. */\n#define WI_RID_REG_DOMAINS\t0xFD11 /* list of intendted regulatory doms */\n#define WI_RID_TEMP_TYPE\t0xFD12 /* hw temp range code */\n#define WI_RID_CIS\t\t0xFD13 /* PC card info struct */\n#define WI_RID_STA_IDENTITY\t0xFD20 /* station funcs firmware ident */\n#define WI_RID_STA_SUP_RANGE\t0xFD21 /* station supplier compat */\n#define WI_RID_MFI_ACT_RANGE\t0xFD22\n#define WI_RID_SYMBOL_IDENTITY\t0xFD24\n#define WI_RID_CFI_ACT_RANGE\t0xFD33\n#define WI_RID_COMMQUAL\t\t0xFD43\n#define WI_RID_SCALETHRESH\t0xFD46\n#define WI_RID_PCF\t\t0xFD87\n\n/*\n * MAC information\n */\n#define WI_RID_PORT_STAT\t0xFD40 /* actual MAC port con control stat */\n#define WI_RID_CURRENT_SSID\t0xFD41 /* ID of actually connected SS */\n#define WI_RID_CURRENT_BSSID\t0xFD42 /* ID of actually connected BSS */\n#define WI_RID_COMMS_QUALITY\t0xFD43 /* quality of BSS connection */\n#define WI_RID_CUR_TX_RATE\t0xFD44 /* current TX rate */\n#define WI_RID_CUR_BEACON_INT\t0xFD45 /* current beacon interval */\n#define WI_RID_CUR_SCALE_THRESH\t0xFD46 /* actual system scane thresh setting */\n#define WI_RID_PROT_RESP_TIME\t0xFD47 /* time to wait for resp to req msg */\n#define WI_RID_SHORT_RTR_LIM\t0xFD48 /* max tx attempts for short frames */\n#define WI_RID_LONG_RTS_LIM\t0xFD49 /* max tx attempts for long frames */\n#define WI_RID_MAX_TX_LIFE\t0xFD4A /* max tx frame handling duration */\n#define WI_RID_MAX_RX_LIFE\t0xFD4B /* max rx frame handling duration */\n#define WI_RID_CF_POLL\t\t0xFD4C /* contention free pollable ind */\n#define WI_RID_AUTH_ALGS\t0xFD4D /* auth algorithms available */\n#define WI_RID_AUTH_TYPE\t0xFD4E /* availanle auth types */\n#define WI_RID_WEP_AVAIL\t0xFD4F /* WEP privacy option available */\n#define WI_RID_DBM_COMMS_QUAL\t0xFD51 /* CommQuality normalized to dBm */\n#define WI_RID_CUR_TX_RATE1\t0xFD80\n#define WI_RID_CUR_TX_RATE2\t0xFD81\n#define WI_RID_CUR_TX_RATE3\t0xFD82\n#define WI_RID_CUR_TX_RATE4\t0xFD83\n#define WI_RID_CUR_TX_RATE5\t0xFD84\n#define WI_RID_CUR_TX_RATE6\t0xFD85\n#define WI_RID_OWN_MAC\t\t0xFD86 /* unique local MAC addr */\n#define WI_RID_PCI_INFO\t\t0xFD87 /* point coordination func cap */\n\n/*\n * Scan Information\n */\n#define\tWI_RID_BCAST_SCAN_REQ\t0xFCAB /* Broadcast Scan request (Symbol) */\n#define\t BSCAN_5SEC\t\t0x01\n#define\t BSCAN_ONETIME\t\t0x02\n#define\t BSCAN_PASSIVE\t\t0x40\n#define\t BSCAN_BCAST\t\t0x80\n#define WI_RID_SCAN_REQ\t\t0xFCE1 /* Scan request (STA only) */\n#define WI_RID_JOIN_REQ\t\t0xFCE2 /* Join request (STA only) */\n#define\tWI_RID_AUTH_STATION\t0xFCE3 /* Authenticates Station (AP) */\n#define\tWI_RID_CHANNEL_REQ\t0xFCE4 /* Channel Information Request (AP) */\n#define WI_RID_SCAN_RESULTS\t0xFD88 /* Scan Results Table */\n\nstruct wi_apinfo {\n\tint\t\t\tscanreason;\t/* ScanReason */\n\tchar\t\t\tbssid[6];\t/* BSSID (mac address) */\n\tint\t\t\tchannel;\t/* Channel */\n\tint\t\t\tsignal;\t\t/* Signal level */\n\tint\t\t\tnoise;\t\t/* Average Noise Level*/\n\tint\t\t\tquality;\t/* Quality */\n\tint\t\t\tnamelen;\t/* Length of SSID string */\n\tchar\t\t\tname[32];\t/* SSID string */\n\tint\t\t\tcapinfo;\t/* Capability info. */ \n\tint\t\t\tinterval;\t/* BSS Beacon Interval */\n\tint\t\t\trate;\t\t/* Data Rate */\n};\n\n/*\n * Modem information\n */\n#define WI_RID_PHY_TYPE\t\t0xFDC0 /* phys layer type indication */\n#define WI_RID_CURRENT_CHAN\t0xFDC1 /* current frequency */\n#define WI_RID_PWR_STATE\t0xFDC2 /* pwr consumption status */\n#define WI_RID_CCA_MODE\t\t0xFDC3 /* clear chan assess mode indication */\n#define WI_RID_CCA_TIME\t\t0xFDC4 /* clear chan assess time */\n#define WI_RID_MAC_PROC_DELAY\t0xFDC5 /* MAC processing delay time */\n#define WI_RID_DATA_RATES\t0xFDC6 /* supported data rates */\n\n/*\n * bsd-airtools v0.2 - source-mods v0.2 [common.h]\n * by h1kari - (c) Dachb0den Labs 2001\n */\n\n/*\n * Copyright (c) 2001 Dachb0den Labs.\n *      David Hulton <h1kari@dachb0den.com>.  All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. All advertising materials mentioning features or use of this software\n *    must display the following acknowledgement:\n *      This product includes software developed by David Hulton.\n * 4. Neither the name of the author nor the names of any co-contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY David Hulton AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL David Hulton OR THE VOICES IN HIS HEAD\n * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\n * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\n * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\n * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\n * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF\n * THE POSSIBILITY OF SUCH DAMAGE.\n */\n\n/*\n * standard hermes recieve frame used by wavelan/prism2 cards\n */\nstruct wi_rx_frame {\n\t/*\n\t * hermes prefix header. supplies information on the current status of\n\t * the network and various other statistics gathered from the\n\t * management/control frames as used internally.\n\t */\n\tu_int16_t\twi_status;\n\tu_int16_t\twi_ts0;\n\tu_int16_t\twi_ts1;\n\tu_int8_t\twi_silence;\n\tu_int8_t\twi_signal;\n\tu_int8_t\twi_rate;\n\tu_int8_t\twi_rx_flow;\n\tu_int16_t\twi_rsvd0;\n\tu_int16_t\twi_rsvd1;\n\t/*\n\t * standard 80211 frame header. all packets have to use this header as\n\t * per the AN9900 from intersil, even management/control. for\n\t * management packets, they just threw the header into the data field,\n\t * but for control packets the headers are lost in translation and\n\t * therefore not all control packet info can be displayed.\n\t */\n\tu_int16_t\twi_frame_ctl;\n\tu_int16_t\twi_id;\n\tu_int8_t\twi_addr1[6];\n\tu_int8_t\twi_addr2[6];\n\tu_int8_t\twi_addr3[6];\n\tu_int16_t\twi_seq_ctl;\n\tu_int8_t\twi_addr4[6];\n\tu_int16_t\twi_dat_len;\n\t/*\n\t * another wierdity with the drivers. they append a 802.3 header which\n\t * is somewhat redundant, since all the same data is provided in the\n\t * 802.11 header.\n\t */\n\tu_int8_t\twi_dst_addr[6];\n\tu_int8_t\twi_src_addr[6];\n\tu_int16_t\twi_len;\n};\n#define WI_DATA_HDRLEN\t\t0x3C\n#define WI_MGMT_HDRLEN\t\t0x3C\n#define WI_CTL_HDRLEN\t\t0x3C\n\n\n/*\n * all data packets have a snap (sub-network access protocol) header that\n * isn't entirely definied, but added for ethernet compatibility.\n */\nstruct wi_snap_frame {\n\tu_int16_t\twi_dat[3];\n\tu_int16_t\twi_type;\n};\n\n\n/*\n * management frame headers\n * note: all management frames consist of a static header and variable length\n * fields.\n */\n\n/*\n * variable length field structure\n */\nstruct wi_mgmt_var_hdr {\n\tu_int8_t\twi_code;\n\tu_int8_t\twi_len;\n\tu_int8_t\twi_data[256];\n};\n\n/*\n * management beacon frame prefix\n */\nstruct wi_mgmt_beacon_hdr {\n\tu_int32_t\twi_ts0;\n\tu_int32_t\twi_ts1;\n\tu_int16_t\twi_interval;\n\tu_int16_t\twi_capinfo;\n};\n\n/*\n * ibss announcement traffic indication message (atim) frame\n * note: no parameters\n */\n\n/*\n * management disassociation frame\n */\nstruct wi_mgmt_disas_hdr {\n\tu_int16_t\twi_reason;\n};\n\n/*\n * management association request frame prefix\n */\nstruct wi_mgmt_asreq_hdr {\n\tu_int16_t\twi_capinfo;\n\tu_int16_t\twi_interval;\n};\n\n/*\n * management association response frame prefix\n */\nstruct wi_mgmt_asresp_hdr {\n\tu_int16_t\twi_capinfo;\n\tu_int16_t\twi_status;\n\tu_int16_t\twi_aid;\n};\n\n/*\n * management reassociation request frame prefix\n */\nstruct wi_mgmt_reasreq_hdr {\n\tu_int16_t\twi_capinfo;\n\tu_int16_t\twi_interval;\n\tu_int8_t\twi_currap[6];\n};\n\n/*\n * management reassociation response frame prefix\n */\nstruct wi_mgmt_reasresp_hdr {\n\tu_int16_t\twi_capinfo;\n\tu_int16_t\twi_status;\n\tu_int16_t\twi_aid;\n};\n\n/*\n * management probe request frame prefix\n * note: no static parameters, only variable length\n */\n\n/*\n * management probe response frame prefix\n */\nstruct wi_mgmt_proberesp_hdr {\n\tu_int32_t\twi_ts0;\n\tu_int32_t\twi_ts1;\n\tu_int16_t\twi_interval;\n\tu_int16_t\twi_capinfo;\n};\n\n/*\n * management authentication frame prefix\n */\nstruct wi_mgmt_auth_hdr {\n\tu_int16_t\twi_algo;\n\tu_int16_t\twi_seq;\n\tu_int16_t\twi_status;\n};\n\n/*\n * management deauthentication frame\n */\nstruct wi_mgmt_deauth_hdr {\n\tu_int16_t\twi_reason;\n};\n\n\n/*\n * rid configuration register definitions\n */\n#define WI_RID_SCAN_REQ\t\t0xFCE1 /* scan request information */\n#define WI_RID_SCAN_RES\t\t0xFD88 /* scan result information */\n\n#define WI_RID_PROCFRAME\t0x3137 /* Return full frame information */\n#define WI_RID_PRISM2\t\t0x3138 /* tell if we're a prism2 card or not */\n\n\n/*\n * 802.11 definitions\n */\n#define WI_STAT_BADCRC\t\t0x0001\n#define WI_STAT_UNDECRYPTABLE\t0x0002\n#define WI_STAT_ERRSTAT\t\t0x0003\n#define WI_STAT_MAC_PORT\t0x0700\n#define WI_STAT_1042\t\t0x2000\n#define WI_STAT_TUNNEL\t\t0x4000\n#define WI_STAT_WMP_MSG\t\t0x6000\n#define WI_RXSTAT_MSG_TYPE\t0xE000\n\n#define WI_FCTL_OPT_MASK\t0xFF00\n#define WI_AID_SET\t\t0xC000\n#define WI_AID_MASK\t\t0x3FFF\n#define WI_SCTL_FRAGNUM_MASK\t0x000F\n#define WI_SCTL_SEQNUM_MASK\t0xFFF0\n\n#define WI_STAT_UNSPEC_FAIL\t1\n#define WI_STAT_CAPINFO_FAIL\t10\n#define WI_STAT_REAS_DENY\t11\n#define WI_STAT_ASSOC_DENY\t12\n#define WI_STAT_ALGO_FAIL\t13\n#define WI_STAT_SEQ_FAIL\t14\n#define WI_STAT_CHAL_FAIL\t15\n#define WI_STAT_TOUT_FAIL\t16\n#define WI_STAT_OVERL_DENY\t17\n#define WI_STAT_RATE_DENY\t18\n\n#define WI_FTYPE_MGMT\t\t0x0000\n#define WI_FTYPE_CTL\t\t0x0004\n#define WI_FTYPE_DATA\t\t0x0008\n\n#define WI_FCTL_VERS\t\t0x0002\n#define WI_FCTL_FTYPE\t\t0x000C\n#define WI_FCTL_STYPE\t\t0x00F0\n#define WI_FCTL_TODS\t\t0x0100\n#define WI_FCTL_FROMDS\t\t0x0200\n#define WI_FCTL_MOREFRAGS\t0x0400\n#define WI_FCTL_RETRY\t\t0x0800\n#define WI_FCTL_PM\t\t0x1000\n#define WI_FCTL_MOREDATA\t0x2000\n#define WI_FCTL_WEP\t\t0x4000\n#define WI_FCTL_ORDER\t\t0x8000\n\n#define WI_FCS_LEN\t\t0x4 /* checksum length */\n\n\n/*\n * management definitions\n */\n#define WI_STYPE_MGMT_ASREQ\t0x0000\n#define WI_STYPE_MGMT_ASRESP\t0x0010\n#define WI_STYPE_MGMT_REASREQ\t0x0020\n#define WI_STYPE_MGMT_REASRESP\t0x0030\n#define WI_STYPE_MGMT_PROBEREQ\t0x0040\n#define WI_STYPE_MGMT_PROBERESP\t0x0050\n#define WI_STYPE_MGMT_BEACON\t0x0080\n#define WI_STYPE_MGMT_ATIM\t0x0090\n#define WI_STYPE_MGMT_DISAS\t0x00A0\n#define WI_STYPE_MGMT_AUTH\t0x00B0\n#define WI_STYPE_MGMT_DEAUTH\t0x00C0\n\n#define WI_CAPINFO_ESS\t\t0x01\n#define WI_CAPINFO_IBSS\t\t0x02\n#define WI_CAPINFO_CFPOLL\t0x04\n#define WI_CAPINFO_CFPOLLREQ\t0x08\n#define WI_CAPINFO_PRIV\t\t0x10\n\n#define WI_REASON_UNSPEC\t1\n#define WI_REASON_AUTH_INVALID\t2\n#define WI_REASON_DEAUTH_LEAVE\t3\n#define WI_REASON_DISAS_INACT\t4\n#define WI_REASON_DISAS_OVERL\t5\n#define WI_REASON_CLASS2\t6\n#define WI_REASON_CLASS3\t7\n#define WI_REASON_DISAS_LEAVE\t8\n#define WI_REASON_NOAUTH\t9\n\n#define WI_VAR_SSID\t\t0\n#define WI_VAR_SRATES\t\t1\n#define WI_VAR_FH\t\t2\n#define WI_VAR_DS\t\t3\n#define WI_VAR_CF\t\t4\n#define WI_VAR_TIM\t\t5\n#define WI_VAR_IBSS\t\t6\n#define WI_VAR_CHAL\t\t16\n\n#define WI_VAR_SRATES_MASK\t0x7F\n\n\n/*\n * control definitions\n */\n#define WI_STYPE_CTL_PSPOLL\t0x00A0\n#define WI_STYPE_CTL_RTS\t0x00B0\n#define WI_STYPE_CTL_CTS\t0x00C0\n#define WI_STYPE_CTL_ACK\t0x00D0\n#define WI_STYPE_CTL_CFEND\t0x00E0\n#define WI_STYPE_CTL_CFENDCFACK\t0x00F0\n\n\n/*\n * ap scanning structures\n */\nstruct wi_scan_res {\n\tu_int16_t\twi_chan;\n\tu_int16_t\twi_noise;\n\tu_int16_t\twi_signal;\n\tu_int8_t\twi_bssid[6];\n\tu_int16_t\twi_interval;\n\tu_int16_t\twi_capinfo;\n\tu_int16_t\twi_ssid_len;\n\tu_int8_t\twi_ssid[32];\n\tu_int8_t\twi_srates[10];\n\tu_int8_t\twi_rate;\n\tu_int8_t\twi_rsvd;\n};\n#define WI_WAVELAN_RES_SIZE\t50\n\nstruct wi_scan_p2_hdr {\n\tu_int16_t\twi_rsvd;\n\tu_int16_t\twi_reason;\n};\n#define WI_PRISM2_RES_SIZE\t62\n\n\n/*\n * prism2 debug mode definitions\n */\n#define SIOCSPRISM2DEBUG\t_IOW('i', 137, struct ifreq)\n#define SIOCGPRISM2DEBUG\t_IOWR('i', 138, struct ifreq)\n\n#define WI_DEBUG_RESET\t\t0x00\n#define WI_DEBUG_INIT\t\t0x01\n#define WI_DEBUG_SLEEP\t\t0x02\n#define WI_DEBUG_WAKE\t\t0x03\n#define WI_DEBUG_CHAN\t\t0x08\n#define WI_DEBUG_DELAYSUPP\t0x09\n#define WI_DEBUG_TXSUPP\t\t0x0A\n#define WI_DEBUG_MONITOR\t0x0B\n#define WI_DEBUG_LEDTEST\t0x0C\n#define WI_DEBUG_CONTTX\t\t0x0E\n#define WI_DEBUG_STOPTEST\t0x0F\n#define WI_DEBUG_CONTRX\t\t0x10\n#define WI_DEBUG_SIGSTATE\t0x11\n#define WI_DEBUG_CALENABLE\t0x13\n#define WI_DEBUG_CONFBITS\t0x15\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/dev/wi/if_wireg.h",
    "content": "/*-\n * Copyright (c) 1997, 1998, 1999\n *\tBill Paul <wpaul@ctr.columbia.edu>.  All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. All advertising materials mentioning features or use of this software\n *    must display the following acknowledgement:\n *\tThis product includes software developed by Bill Paul.\n * 4. Neither the name of the author nor the names of any co-contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY Bill Paul AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL Bill Paul OR THE VOICES IN HIS HEAD\n * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\n * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\n * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\n * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\n * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF\n * THE POSSIBILITY OF SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/dev/wi/if_wireg.h 192468 2009-05-20 20:00:40Z sam $\n */\n\n#define WI_DELAY\t5\n#define WI_TIMEOUT\t(500000/WI_DELAY)\t/* 500 ms */\n\n#define WI_PORT0\t(0 << 8)\n#define WI_PORT1\t(1 << 8)\n#define WI_PORT2\t(2 << 8)\n#define WI_PORT3\t(3 << 8)\n#define WI_PORT4\t(4 << 8)\n#define WI_PORT5\t(5 << 8)\n\n#define WI_PCI_LMEMRES\t0x10\t/* PCI Memory (native PCI implementations) */\n#define WI_PCI_LOCALRES\t0x14\t/* The PLX chip's local registers */\n#define WI_PCI_MEMRES\t0x18\t/* The PCCard's attribute memory */\n#define WI_PCI_IORES\t0x1C\t/* The PCCard's I/O space */\n\n#define WI_LOCAL_INTCSR\t\t0x4c\n#define WI_LOCAL_INTEN\t\t0x40\n#define WI_HFA384X_SWSUPPORT0_OFF\t0x28\n#define WI_PRISM2STA_MAGIC\t\t0x4A2D\n#define WI_PCICOR_OFF\t\t0x26\n#define WI_PCICOR_RESET\t\t0x0080\n\n/* Default port: 0 (only 0 exists on stations) */\n#define WI_DEFAULT_PORT\tWI_PORT0\n\n/* Default network name: ANY */\n/*\n * [sommerfeld 1999/07/15] Changed from \"ANY\" to \"\"; according to Bill Fenner,\n * ANY is used in MS driver user interfaces, while \"\" is used over the\n * wire..\n */\n#define WI_DEFAULT_NETNAME\t\"\"\n\n#define WI_DEFAULT_AP_DENSITY\t1\n\n#define WI_DEFAULT_RTS_THRESH\t2347\n\n#define WI_DEFAULT_DATALEN\t2304\n\n#define WI_DEFAULT_CREATE_IBSS\t0\n\n#define WI_DEFAULT_PM_ENABLED\t0\n\n#define WI_DEFAULT_MAX_SLEEP\t100\n\n#define WI_DEFAULT_ROAMING\t1\n\n#define WI_DEFAULT_AUTHTYPE\t1\n\n#ifdef __NetBSD__\n#define OS_STRING_NAME\t\"NetBSD\"\n#endif\n#ifdef __FreeBSD__\n#define OS_STRING_NAME\t\"FreeBSD\"\n#endif\n#ifdef __OpenBSD__\n#define OS_STRING_NAME\t\"OpenBSD\"\n#endif\n\n#define WI_DEFAULT_NODENAME\tOS_STRING_NAME \" WaveLAN/IEEE node\"\n\n#define WI_DEFAULT_IBSS\t\tOS_STRING_NAME \" IBSS\"\n\n#define WI_BUS_PCCARD\t\t0\t/* pccard device */\n#define WI_BUS_PCI_PLX\t\t1\t/* PCI card w/ PLX PCI/PCMICA bridge */\n#define WI_BUS_PCI_NATIVE\t2\t/* native PCI device (Prism 2.5) */\n\n/*\n * register space access macros\n */\n#define CSR_WRITE_4(sc, reg, val)\t\t\t\t\\\n\tbus_space_write_4((sc)->wi_btag, (sc)->wi_bhandle, \t\\\n\t    (sc)->wi_bus_type == WI_BUS_PCI_NATIVE ? (reg)*2 : (reg), val)\n#define CSR_WRITE_2(sc, reg, val)\t\t\t\t\\\n\tbus_space_write_2((sc)->wi_btag, (sc)->wi_bhandle,\t\\\n \t    (sc)->wi_bus_type == WI_BUS_PCI_NATIVE ? (reg)*2 : (reg), val)\n#define CSR_WRITE_1(sc, reg, val)\t\t\t\t\\\n\tbus_space_write_1((sc)->wi_btag, (sc)->wi_bhandle,\t\\\n \t    (sc)->wi_bus_type == WI_BUS_PCI_NATIVE ? (reg)*2 : (reg), val)\n\n#define CSR_READ_4(sc, reg)\t\t\t\t\t\\\n\tbus_space_read_4((sc)->wi_btag, (sc)->wi_bhandle,\t\\\n \t    (sc)->wi_bus_type == WI_BUS_PCI_NATIVE ? (reg)*2 : (reg))\n#define CSR_READ_2(sc, reg)\t\t\t\t\t\\\n\tbus_space_read_2((sc)->wi_btag, (sc)->wi_bhandle,\t\\\n \t    (sc)->wi_bus_type == WI_BUS_PCI_NATIVE ? (reg)*2 : (reg))\n#define CSR_READ_1(sc, reg)\t\t\t\t\t\\\n\tbus_space_read_1((sc)->wi_btag, (sc)->wi_bhandle,\t\\\n \t    (sc)->wi_bus_type == WI_BUS_PCI_NATIVE ? (reg)*2 : (reg))\n\n#define CSM_WRITE_1(sc, off, val)\t\\\n\tbus_space_write_1((sc)->wi_bmemtag, (sc)->wi_bmemhandle, off, val)\n\n#define CSM_READ_1(sc, off)\t\t\\\n\tbus_space_read_1((sc)->wi_bmemtag, (sc)->wi_bmemhandle, off)\n\n#define CSR_WRITE_STREAM_2(sc, reg, val)\t\\\n\tbus_space_write_stream_2(sc->wi_btag, sc->wi_bhandle,\t\\\n\t    (sc->wi_bus_type == WI_BUS_PCI_NATIVE ? (reg) * 2 : (reg)), val)\n#define CSR_WRITE_MULTI_STREAM_2(sc, reg, val, count)\t\\\n\tbus_space_write_multi_stream_2(sc->wi_btag, sc->wi_bhandle,\t\\\n\t    (sc->wi_bus_type == WI_BUS_PCI_NATIVE ? (reg) * 2 : (reg)), val, count)\n#define CSR_READ_STREAM_2(sc, reg)\t\t\\\n\tbus_space_read_stream_2(sc->wi_btag, sc->wi_bhandle,\t\\\n\t    (sc->wi_bus_type == WI_BUS_PCI_NATIVE ? (reg) * 2 : (reg)))\n#define CSR_READ_MULTI_STREAM_2(sc, reg, buf, count)\t\t\\\n\tbus_space_read_multi_stream_2(sc->wi_btag, sc->wi_bhandle,\t\\\n\t    (sc->wi_bus_type == WI_BUS_PCI_NATIVE ? (reg) * 2 : (reg)), buf, count)\n\n/*\n * The WaveLAN/IEEE cards contain an 802.11 MAC controller which Lucent\n * calls 'Hermes.' In typical fashion, getting documentation about this\n * controller is about as easy as squeezing blood from a stone. Here\n * is more or less what I know:\n *\n * - The Hermes controller is firmware driven, and the host interacts\n *   with the Hermes via a firmware interface, which can change.\n *\n * - The Hermes is described in a document called: \"Hermes Firmware\n *   WaveLAN/IEEE Station Functions,\" document #010245, which of course\n *   Lucent will not release without an NDA.\n *\n * - Lucent has created a library called HCF (Hardware Control Functions)\n *   though which it wants developers to interact with the card. The HCF\n *   is needlessly complex, ill conceived and badly documented. Actually,\n *   the comments in the HCP code itself aren't bad, but the publically\n *   available manual that comes with it is awful, probably due largely to\n *   the fact that it has been emasculated in order to hide information\n *   that Lucent wants to keep proprietary. The purpose of the HCF seems\n *   to be to insulate the driver programmer from the Hermes itself so that\n *   Lucent has an excuse not to release programming in for it.\n *\n * - Lucent only makes available documentation and code for 'HCF Light'\n *   which is a stripped down version of HCF with certain features not\n *   implemented, most notably support for 802.11 frames.\n *\n * - The HCF code which I have seen blows goats. Whoever decided to\n *   use a 132 column format should be shot.\n *\n * Rather than actually use the Lucent HCF library, I have stripped all\n * the useful information from it and used it to create a driver in the\n * usual BSD form. Note: I don't want to hear anybody whining about the\n * fact that the Lucent code is GPLed and mine isn't. I did not actually\n * put any of Lucent's code in this driver: I only used it as a reference\n * to obtain information about the underlying hardware. The Hermes\n * programming interface is not GPLed, so bite me.\n */\n\n/*\n * Size of Hermes & Prism2 I/O space.\n */\n#define WI_IOSIZ\t\t0x40\n\n/*\n * Hermes & Prism2 register definitions \n */\n\n/* Hermes command/status registers. */\n#define WI_COMMAND\t\t0x00\n#define WI_PARAM0\t\t0x02\n#define WI_PARAM1\t\t0x04\n#define WI_PARAM2\t\t0x06\n#define WI_STATUS\t\t0x08\n#define WI_RESP0\t\t0x0A\n#define WI_RESP1\t\t0x0C\n#define WI_RESP2\t\t0x0E\n\n/* Command register values. */\n#define WI_CMD_BUSY\t\t0x8000 /* busy bit */\n#define WI_CMD_INI\t\t0x0000 /* initialize */\n#define WI_CMD_ENABLE\t\t0x0001 /* enable */\n#define WI_CMD_DISABLE\t\t0x0002 /* disable */\n#define WI_CMD_DIAG\t\t0x0003\n#define WI_CMD_ALLOC_MEM\t0x000A /* allocate NIC memory */\n#define WI_CMD_TX\t\t0x000B /* transmit */\n#define WI_CMD_NOTIFY\t\t0x0010\n#define WI_CMD_INQUIRE\t\t0x0011\n#define WI_CMD_ACCESS\t\t0x0021\n#define WI_CMD_ACCESS_WRITE\t0x0121\n#define WI_CMD_PROGRAM\t\t0x0022\n#define WI_CMD_READEE\t\t0x0030\t/* symbol only */\n#define WI_CMD_READMIF\t\t0x0030\t/* prism2 */\n#define WI_CMD_WRITEMIF\t\t0x0031\t/* prism2 */\n#define WI_CMD_DEBUG\t\t0x0038\t/* Various test commands */\n\n#define WI_CMD_CODE_MASK\t0x003F\n\n/*\n * Various cmd test stuff.\n */\n#define WI_TEST_MONITOR\t\t0x0B\n#define WI_TEST_STOP\t\t0x0F\n#define WI_TEST_CFG_BITS\t0x15\n#define WI_TEST_CFG_BIT_ALC\t0x08\n\n/*\n * Reclaim qualifier bit, applicable to the\n * TX and INQUIRE commands.\n */\n#define WI_RECLAIM\t\t0x0100 /* reclaim NIC memory */\n\n/*\n * ACCESS command qualifier bits.\n */\n#define WI_ACCESS_READ\t\t0x0000\n#define WI_ACCESS_WRITE\t\t0x0100\n\n/*\n * PROGRAM command qualifier bits.\n */\n#define WI_PROGRAM_DISABLE\t0x0000\n#define WI_PROGRAM_ENABLE_RAM\t0x0100\n#define WI_PROGRAM_ENABLE_NVRAM\t0x0200\n#define WI_PROGRAM_NVRAM\t0x0300\n\n/* Status register values */\n#define WI_STAT_CMD_CODE\t0x003F\n#define WI_STAT_DIAG_ERR\t0x0100\n#define WI_STAT_INQ_ERR\t\t0x0500\n#define WI_STAT_CMD_RESULT\t0x7F00\n\n/* memory handle management registers */\n#define WI_INFO_FID\t\t0x10\n#define WI_RX_FID\t\t0x20\n#define WI_ALLOC_FID\t\t0x22\n#define WI_TX_CMP_FID\t\t0x24\n\n/*\n * Buffer Access Path (BAP) registers.\n * These are I/O channels. I believe you can use each one for\n * any desired purpose independently of the other. In general\n * though, we use BAP1 for reading and writing LTV records and\n * reading received data frames, and BAP0 for writing transmit\n * frames. This is a convention though, not a rule.\n */\n#define WI_SEL0\t\t\t0x18\n#define WI_SEL1\t\t\t0x1A\n#define WI_OFF0\t\t\t0x1C\n#define WI_OFF1\t\t\t0x1E\n#define WI_DATA0\t\t0x36\n#define WI_DATA1\t\t0x38\n#define WI_BAP0\t\t\tWI_DATA0\n#define WI_BAP1\t\t\tWI_DATA1\n\n#define WI_OFF_BUSY\t\t0x8000\n#define WI_OFF_ERR\t\t0x4000\n#define WI_OFF_DATAOFF\t\t0x0FFF\n\n/* Event registers */\n#define WI_EVENT_STAT\t\t0x30\t/* Event status */\n#define WI_INT_EN\t\t0x32\t/* Interrupt enable/disable */\n#define WI_EVENT_ACK\t\t0x34\t/* Ack event */\n\n/* Events */\n#define WI_EV_TICK\t\t0x8000\t/* aux timer tick */\n#define WI_EV_RES\t\t0x4000\t/* controller h/w error (time out) */\n#define WI_EV_INFO_DROP\t\t0x2000\t/* no RAM to build unsolicited frame */\n#define WI_EV_NO_CARD\t\t0x0800\t/* card removed (hunh?) */\n#define WI_EV_DUIF_RX\t\t0x0400\t/* wavelan management packet received */\n#define WI_EV_INFO\t\t0x0080\t/* async info frame */\n#define WI_EV_CMD\t\t0x0010\t/* command completed */\n#define WI_EV_ALLOC\t\t0x0008\t/* async alloc/reclaim completed */\n#define WI_EV_TX_EXC\t\t0x0004\t/* async xmit completed with failure */\n#define WI_EV_TX\t\t0x0002\t/* async xmit completed succesfully */\n#define WI_EV_RX\t\t0x0001\t/* async rx completed */\n\n/* Host software registers */\n#define WI_SW0\t\t\t0x28\n#define WI_SW1\t\t\t0x2A\n#define WI_SW2\t\t\t0x2C\n#define WI_SW3\t\t\t0x2E \t/* does not appear in Prism2 */\n\n#define WI_CNTL\t\t\t0x14\n\n#define WI_CNTL_AUX_ENA\t\t0xC000\n#define WI_CNTL_AUX_ENA_STAT\t0xC000\n#define WI_CNTL_AUX_DIS_STAT\t0x0000\n#define WI_CNTL_AUX_ENA_CNTL\t0x8000\n#define WI_CNTL_AUX_DIS_CNTL\t0x4000\n\n#define WI_AUX_PAGE\t\t0x3A\n#define WI_AUX_OFFSET\t\t0x3C\n#define WI_AUX_DATA\t\t0x3E\n\n#define WI_AUX_PGSZ\t\t128\n#define WI_AUX_KEY0\t\t0xfe01\n#define WI_AUX_KEY1\t\t0xdc23\n#define WI_AUX_KEY2\t\t0xba45\n\n#define WI_COR\t\t\t0x40\t/* only for Symbol */\n#define WI_COR_RESET\t\t0x0080\n#define WI_COR_IOMODE\t\t0x0041\n\n#define WI_HCR\t\t\t0x42\t/* only for Symbol */\n#define WI_HCR_4WIRE\t\t0x0010\n#define WI_HCR_RUN\t\t0x0007\n#define WI_HCR_HOLD\t\t0x000f\n#define WI_HCR_EEHOLD\t\t0x00ce\n\n#define WI_COR_OFFSET\t0x3e0\t/* OK for PCI, default COR for Prism PC Card */\n#define WI_COR_VALUE\t0x41\n\n/*\n * One form of communication with the Hermes is with what Lucent calls\n * LTV records, where LTV stands for Length, Type and Value. The length\n * and type are 16 bits and are in native byte order. The value is in\n * multiples of 16 bits and is in little endian byte order.\n */\nstruct wi_lt_hdr {\n\tu_int16_t\t\twi_len;\n\tu_int16_t\t\twi_type;\n\t/* value is vary depends on resource id */\n};\n\n/*\n * Download buffer location and length (0xFD01).\n */\nstruct wi_dnld_buf {\n\tu_int16_t\t\twi_buf_pg; /* page addr of intermediate dl buf*/\n\tu_int16_t\t\twi_buf_off; /* offset of idb */\n\tu_int16_t\t\twi_buf_len; /* len of idb */\n};\n\n/*\n * Mem sizes (0xFD02).\n */\nstruct wi_memsz {\n\tu_int16_t\t\twi_mem_ram;\n\tu_int16_t\t\twi_mem_nvram;\n};\n\n/*\n * NIC Identification (0xFD0B, 0xFD20)\n */\nstruct wi_ver {\n\tu_int16_t\t\twi_ver[4];\n};\n\n/* define card ident */\n#define\tWI_NIC_LUCENT_ID\t0x0001\n#define\tWI_NIC_LUCENT_STR\t\"Lucent Technologies, WaveLAN/IEEE\"\n\n#define\tWI_NIC_SONY_ID\t\t0x0002\n#define\tWI_NIC_SONY_STR\t\t\"Sony WaveLAN/IEEE\"\n\n#define\tWI_NIC_LUCENT_EMB_ID\t0x0005\n#define\tWI_NIC_LUCENT_EMB_STR\t\"Lucent Embedded WaveLAN/IEEE\"\n\n#define\tWI_NIC_EVB2_ID\t\t0x8000\n#define\tWI_NIC_EVB2_STR\t\t\"RF:PRISM2 MAC:HFA3841\"\n\n#define\tWI_NIC_HWB3763_ID\t0x8001\n#define\tWI_NIC_HWB3763_STR\t\"RF:PRISM2 MAC:HFA3841 CARD:HWB3763 rev.B\"\n\n#define\tWI_NIC_HWB3163_ID\t0x8002\n#define\tWI_NIC_HWB3163_STR\t\"RF:PRISM2 MAC:HFA3841 CARD:HWB3163 rev.A\"\n\n#define\tWI_NIC_HWB3163B_ID\t0x8003\n#define\tWI_NIC_HWB3163B_STR\t\"RF:PRISM2 MAC:HFA3841 CARD:HWB3163 rev.B\"\n\n#define\tWI_NIC_EVB3_ID\t\t0x8004\n#define\tWI_NIC_EVB3_STR\t\t\"RF:PRISM2 MAC:HFA3842 CARD:HFA3842 EVAL\"\n\n#define\tWI_NIC_HWB1153_ID\t0x8007\n#define\tWI_NIC_HWB1153_STR\t\"RF:PRISM1 MAC:HFA3841 CARD:HWB1153\"\n\n#define\tWI_NIC_P2_SST_ID\t0x8008\t/* Prism2 with SST flush */\n#define\tWI_NIC_P2_SST_STR\t\"RF:PRISM2 MAC:HFA3841 CARD:HWB3163-SST-flash\"\n\n#define\tWI_NIC_EVB2_SST_ID\t0x8009\n#define\tWI_NIC_EVB2_SST_STR\t\"RF:PRISM2 MAC:HFA3841 CARD:HWB3163-SST-flash\"\n\n#define\tWI_NIC_3842_EVA_ID\t0x800A\t/* 3842 Evaluation Board */\n#define\tWI_NIC_3842_EVA_STR\t\"RF:PRISM2 MAC:HFA3842 CARD:HFA3842 EVAL\"\n\n#define\tWI_NIC_3842_PCMCIA_AMD_ID\t0x800B\t/* Prism2.5 PCMCIA */\n#define\tWI_NIC_3842_PCMCIA_SST_ID\t0x800C\n#define\tWI_NIC_3842_PCMCIA_ATL_ID\t0x800D\n#define\tWI_NIC_3842_PCMCIA_ATS_ID\t0x800E\n#define\tWI_NIC_3842_PCMCIA_STR\t\t\"RF:PRISM2.5 MAC:ISL3873\"\n\n#define\tWI_NIC_3842_MINI_AMD_ID\t\t0x8012\t/* Prism2.5 Mini-PCI */\n#define\tWI_NIC_3842_MINI_SST_ID\t\t0x8013\n#define\tWI_NIC_3842_MINI_ATL_ID\t\t0x8014\n#define\tWI_NIC_3842_MINI_ATS_ID\t\t0x8015\n#define\tWI_NIC_3842_MINI_STR\t\t\"RF:PRISM2.5 MAC:ISL3874A(Mini-PCI)\"\n\n#define\tWI_NIC_3842_PCI_AMD_ID\t\t0x8016\t/* Prism2.5 PCI-bridge */\n#define\tWI_NIC_3842_PCI_SST_ID\t\t0x8017\n#define\tWI_NIC_3842_PCI_ATL_ID\t\t0x8018\n#define\tWI_NIC_3842_PCI_ATS_ID\t\t0x8019\n#define\tWI_NIC_3842_PCI_STR\t\t\"RF:PRISM2.5 MAC:ISL3874A(PCI-bridge)\"\n\n#define\tWI_NIC_P3_PCMCIA_AMD_ID\t\t0x801A\t/* Prism3 PCMCIA */\n#define\tWI_NIC_P3_PCMCIA_SST_ID\t\t0x801B\n#define\tWI_NIC_P3_PCMCIA_ATL_ID\t\t0x801C\n#define\tWI_NIC_P3_PCMCIA_ATS_ID\t\t0x801D\n#define\tWI_NIC_P3_PCMCIA_STR\t\t\"RF:PRISM3(PCMCIA)\"\n\n#define WI_NIC_P3_USB_AMD_ID\t\t0x801E\n#define WI_NIC_P3_USB_SST_ID\t\t0x801F\n#define\tWI_NIC_P3_USB_ATL_ID\t\t0x8020\n\n#define\tWI_NIC_P3_MINI_AMD_ID\t\t0x8021\t/* Prism3 Mini-PCI */\n#define\tWI_NIC_P3_MINI_SST_ID\t\t0x8022\n#define\tWI_NIC_P3_MINI_ATL_ID\t\t0x8023\n#define\tWI_NIC_P3_MINI_ATS_ID\t\t0x8024\n#define\tWI_NIC_P3_MINI_STR\t\t\"RF:PRISM3(Mini-PCI)\"\n\n/*\n * List of intended regulatory domains (0xFD11).\n */\nstruct wi_ltv_domains {\n\tu_int16_t\t\twi_len;\n\tu_int16_t\t\twi_type;\n\tu_int16_t\t\twi_num_dom;\n\tu_int8_t\t\twi_domains[10];\n};\n\n/*\n * CIS struct (0xFD13).\n */\nstruct wi_cis {\n\tu_int16_t\t\twi_cis[240];\n};\n\n/*\n * Communications quality (0xFD43).\n */\nstruct wi_commqual {\n\tu_int16_t\t\twi_coms_qual;\n\tu_int16_t\t\twi_sig_lvl;\n\tu_int16_t\t\twi_noise_lvl;\n};\n\n/*\n * Actual system scale thresholds (0xFC06, 0xFD46).\n */\nstruct wi_scalethresh {\n\tu_int16_t\t\twi_energy_detect;\n\tu_int16_t\t\twi_carrier_detect;\n\tu_int16_t\t\twi_defer;\n\tu_int16_t\t\twi_cell_search;\n\tu_int16_t\t\twi_out_of_range;\n\tu_int16_t\t\twi_delta_snr;\n};\n\n/*\n * PCF info struct (0xFD87).\n */\nstruct wi_pcf {\n\tu_int16_t\t\twi_medium_occupancy_limit;\n\tu_int16_t\t\twi_cfp_period;\n\tu_int16_t\t\twi_cfp_max_duration;\n};\n\n/*\n * Connection control characteristics. (0xFC00)\n * 0 == IBSS (802.11 compliant mode) (Only PRISM2)\n * 1 == Basic Service Set (BSS)\n * 2 == Wireless Distribudion System (WDS)\n * 3 == Pseudo IBSS \n *\t(Only PRISM2; not 802.11 compliant mode, testing use only)\n * 6 == HOST AP (Only PRISM2)\n */\n#define\tWI_PORTTYPE_IBSS\t0x0\n#define WI_PORTTYPE_BSS\t\t0x1\n#define WI_PORTTYPE_WDS\t\t0x2\n#define WI_PORTTYPE_ADHOC\t0x3\n#define WI_PORTTYPE_APSILENT\t0x5\n#define\tWI_PORTTYPE_HOSTAP\t0x6\n\n/*\n * Mac addresses. (0xFC01, 0xFC08)\n */\nstruct wi_macaddr {\n\tu_int8_t\t\twi_mac_addr[6];\n};\n\n/*\n * Station set identification (SSID). (0xFC02, 0xFC04)\n */\nstruct wi_ssid {\n\tu_int16_t\t\twi_len;\n\tu_int8_t\t\twi_ssid[32];\n};\n\n/*\n * Set our station name. (0xFC0E)\n */\nstruct wi_nodename {\n\tu_int16_t\t\twi_nodelen;\n\tu_int8_t\t\twi_nodename[32];\n};\n\n/*\n * Multicast addresses to be put in filter. We're\n * allowed up to 16 addresses in the filter. (0xFC80)\n */\nstruct wi_mcast {\n\tstruct ether_addr\twi_mcast[16];\n};\n\n/*\n * Join request. (0xFCE2)\n */\nstruct wi_joinreq {\n\tstruct ether_addr\twi_bssid;\n\tu_int16_t\t\twi_chan;\n};\n\n/*\n * supported rates. (0xFCB4)\n */\n#define WI_SUPPRATES_1M\t\t0x0001\n#define WI_SUPPRATES_2M\t\t0x0002\n#define WI_SUPPRATES_5M\t\t0x0004\n#define WI_SUPPRATES_11M\t0x0008\n#define\tWI_RATES_BITS\t\"\\20\\0011M\\0022M\\0035.5M\\00411M\"\n\n/*\n * Information frame types.\n */\n#define WI_INFO_NOTIFY\t\t0xF000\t/* Handover address */\n#define WI_INFO_COUNTERS\t0xF100\t/* Statistics counters */\n#define WI_INFO_SCAN_RESULTS\t0xF101\t/* Scan results */\n#define WI_INFO_HOST_SCAN_RESULTS\t0xF104\t/* Scan results */\n#define WI_INFO_LINK_STAT\t0xF200\t/* Link status */\n#define\tWI_INFO_LINK_STAT_CONNECTED\t1\n#define\tWI_INFO_LINK_STAT_DISCONNECTED\t2\n#define\tWI_INFO_LINK_STAT_AP_CHG\t3\t/* AP Change */\n#define\tWI_INFO_LINK_STAT_AP_OOR\t4\t/* AP Out Of Range */\n#define\tWI_INFO_LINK_STAT_AP_INR\t5\t/* AP In Range */\n#define\tWI_INFO_LINK_STAT_ASSOC_FAILED\t6\n#define WI_INFO_ASSOC_STAT\t0xF201\t/* Association status */\n#define\tWI_INFO_AUTH_REQUEST\t0xF202\t/* Authentication Request (AP) */\n#define\tWI_INFO_POWERSAVE_COUNT\t0xF203\t/* PowerSave User Count (AP) */\n\nstruct wi_assoc {\n\tu_int16_t\t\twi_assoc_stat;\t/* Association Status */\n#define\tASSOC\t\t1\n#define\tREASSOC\t\t2\n#define\tDISASSOC\t3\t\n#define\tASSOCFAIL\t4\n#define\tAUTHFAIL\t5\n\tu_int8_t\t\twi_assoc_sta[6];\t/* Station Address */\n\tu_int8_t\t\twi_assoc_osta[6];\t/* OLD Station Address */\n\tu_int16_t\t\twi_assoc_reason;\t/* Reason */\n\tu_int16_t\t\twi_assoc_reserve;\t/* Reserved */\n};\n\n/*\n * Scan Results of Prism2 chip\n */\n\nstruct wi_scan_header {\n\tu_int16_t\t\twi_reserve;\t/* future use */\n\tu_int16_t\t\twi_reason;\t/* The reason this scan was initiated\n\t\t\t\t\t\t   1: Host initiated\n\t\t\t\t\t\t   2: Firmware initiated\n\t\t\t\t\t\t   3: Inquiry request from host */\n};\n\nstruct wi_scan_data_p2 {\n\tu_int16_t\t\twi_chid;\t/* BSS Channel ID from Probe Res.(PR)*/\n\tu_int16_t\t\twi_noise;\t/* Average Noise Level of the PR */\n\tu_int16_t\t\twi_signal;\t/* Signal Level on the PR */\n\tu_int8_t\t\twi_bssid[6];\t/* MACaddress of BSS responder from PR */\n\tu_int16_t\t\twi_interval;\t/* BSS beacon interval */\n\tu_int16_t\t\twi_capinfo;\t/* BSS Capability Information\n\t\t\t\t\t\t   IEEE Std 802.11(1997) ,see 7.3.1.4 */\n\tu_int16_t\t\twi_namelen;\t/* Length of SSID strings */\n\tu_int8_t\t\twi_name[32];\t/* SSID strings */\n\tu_int16_t\t\twi_suprate[5];\t/* Supported Rates element from the PR\n\t\t\t\t\t\t   IEEE Std 802.11(1997) ,see 7.3.2.2 */\n\tu_int16_t\t\twi_rate;\t/* Data rate of the PR */\n#define\tWI_APRATE_1\t\t0x0A\t\t/* 1 Mbps */\n#define\tWI_APRATE_2\t\t0x14\t\t/* 2 Mbps */\n#define\tWI_APRATE_5\t\t0x37\t\t/* 5.5 Mbps */\n#define\tWI_APRATE_11\t\t0x6E\t\t/* 11 Mbps */\n};\n\n/*\n * Scan Results of Lucent chip\n */\nstruct wi_scan_data {\n\tu_int16_t\t\twi_chid;\t/* BSS Channel ID from PR */\n\tu_int16_t\t\twi_noise;\t/* Average Noise Level of the PR */\n\tu_int16_t\t\twi_signal;\t/* Signal Level on the PR */\n\tu_int8_t\t\twi_bssid[6];\t/* MACaddress of BSS responder from PR */\n\tu_int16_t\t\twi_interval;\t/* BSS beacon interval */\n\tu_int16_t\t\twi_capinfo;\t/* BSS Capability Information\n\t\t\t\t\t\t   IEEE Std 802.11(1997) ,see 7.3.1.4 */\n\tu_int16_t\t\twi_namelen;\t/* Length of SSID strings */\n\tu_int8_t\t\twi_name[32];\t/* SSID strings */\n};\n\n/*\n * transmit/receive frame structure\n */\nstruct wi_frame {\n\tu_int16_t\t\twi_status;\t/* 0x00 */\n\tu_int16_t\t\twi_rx_tstamp1;\t/* 0x02 */\n\tu_int16_t\t\twi_rx_tstamp0;\t/* 0x04 */\n\tu_int8_t\t\twi_rx_silence;\t/* 0x06 */\n\tu_int8_t\t\twi_rx_signal;\t/* 0x07 */\n\tu_int8_t\t\twi_rx_rate;\t/* 0x08 */\n\tu_int8_t\t\twi_rx_flow;\t/* 0x09 */\n\tu_int8_t\t\twi_tx_rtry;\t/* 0x0a */ /* Prism2 AP Only */\n\tu_int8_t\t\twi_tx_rate;\t/* 0x0b */ /* Prism2 AP Only */\n\tu_int16_t\t\twi_tx_ctl;\t/* 0x0c */\n\tstruct ieee80211_frame_addr4 wi_whdr;\t/* 0x0e */\n\tu_int16_t\t\twi_dat_len;\t/* 0x2c */\n\tstruct ether_header\twi_ehdr;\t/* 0x2e */\n} __attribute__((__packed__));\n\n/* Tx Status Field */\n#define\tWI_TXSTAT_RET_ERR\t0x0001\n#define\tWI_TXSTAT_AGED_ERR\t0x0002\n#define\tWI_TXSTAT_DISCONNECT\t0x0004\n#define\tWI_TXSTAT_FORM_ERR\t0x0008\n\n/* Rx Status Field */\n#define WI_STAT_BADCRC\t\t0x0001\n#define WI_STAT_UNDECRYPTABLE\t0x0002\n#define WI_STAT_ERRSTAT\t\t0x0003\n#define WI_STAT_MAC_PORT\t0x0700\n#define\tWI_STAT_PCF\t\t0x1000\n#define WI_RXSTAT_MSG_TYPE\t0xE000\n#define  WI_STAT_1042\t\t0x2000\t/* RFC1042 encoded */\n#define  WI_STAT_TUNNEL\t\t0x4000\t/* Bridge-tunnel encoded */\n#define  WI_STAT_WMP_MSG\t0x6000\t/* WaveLAN-II management protocol */\n#define\t WI_STAT_MGMT\t\t0x8000\t/* 802.11b management frames */\n\n#define WI_ENC_TX_E_II\t\t0x0E\n\n#define WI_ENC_TX_1042\t\t0x00\n#define WI_ENC_TX_TUNNEL\t0xF8\n\n/* TxControl Field (enhanced) */\n#define\tWI_TXCNTL_TX_OK\t\t0x0002\n#define\tWI_TXCNTL_TX_EX\t\t0x0004\n#define\tWI_TXCNTL_STRUCT_TYPE\t0x0018\n#define\t WI_ENC_TX_802_3\t0x00\n#define\t WI_ENC_TX_802_11\t0x08\n#define\tWI_TXCNTL_ALTRTRY\t0x0020\n#define\tWI_TXCNTL_NOCRYPT\t0x0080\n\n/*\n * HFA3861/3863 (BBP) Control Registers\n */\n#define WI_HFA386X_CR_A_D_TEST_MODES2 0x1A\n#define WI_HFA386X_CR_MANUAL_TX_POWER 0x3E\n\n#ifdef IEEE80211_RADIOTAP_F_CFP\n/*\n * Radio capture format for Prism.\n */\n#define WI_RX_RADIOTAP_PRESENT \\\n\t((1 << IEEE80211_RADIOTAP_TSFT) | \\\n\t (1 << IEEE80211_RADIOTAP_FLAGS) | \\\n\t (1 << IEEE80211_RADIOTAP_RATE) | \\\n\t (1 << IEEE80211_RADIOTAP_CHANNEL) | \\\n\t (1 << IEEE80211_RADIOTAP_DB_ANTSIGNAL) | \\\n\t (1 << IEEE80211_RADIOTAP_DB_ANTNOISE))\n\nstruct wi_rx_radiotap_header {\n\tstruct ieee80211_radiotap_header wr_ihdr;\n\tu_int64_t\twr_tsf;\n\tu_int8_t\twr_flags;\n\tu_int8_t\twr_rate;\n\tu_int16_t\twr_chan_freq;\n\tu_int16_t\twr_chan_flags;\n\tu_int8_t\twr_antsignal;\n\tu_int8_t\twr_antnoise;\n};\n\n#define WI_TX_RADIOTAP_PRESENT \\\n\t((1 << IEEE80211_RADIOTAP_FLAGS) | \\\n\t (1 << IEEE80211_RADIOTAP_RATE) | \\\n\t (1 << IEEE80211_RADIOTAP_CHANNEL))\n\nstruct wi_tx_radiotap_header {\n\tstruct ieee80211_radiotap_header wt_ihdr;\n\tu_int8_t\twt_flags;\n\tu_int8_t\twt_rate;\n\tu_int16_t\twt_chan_freq;\n\tu_int16_t\twt_chan_flags;\n};\n#endif /* IEEE80211_RADIOTAP_F_CFP */\n"
  },
  {
    "path": "freebsd-headers/dev/wi/if_wivar.h",
    "content": "/*-\n * Copyright (c) 2002\n *\tM Warner Losh <imp@freebsd.org>.  All rights reserved.\n * Copyright (c) 1997, 1998, 1999\n *\tBill Paul <wpaul@ctr.columbia.edu>.  All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. All advertising materials mentioning features or use of this software\n *    must display the following acknowledgement:\n *\tThis product includes software developed by Bill Paul.\n * 4. Neither the name of the author nor the names of any co-contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY Bill Paul AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL Bill Paul OR THE VOICES IN HIS HEAD\n * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\n * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\n * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\n * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\n * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF\n * THE POSSIBILITY OF SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/dev/wi/if_wivar.h 194023 2009-06-11 17:14:28Z avg $\n */\n\n/*\n * Encryption controls. We can enable or disable encryption as\n * well as specify up to 4 encryption keys. We can also specify\n * which of the four keys will be used for transmit encryption.\n */\n#define WI_RID_ENCRYPTION\t0xFC20\n#define WI_RID_AUTHTYPE\t\t0xFC21\n#define WI_RID_DEFLT_CRYPT_KEYS\t0xFCB0\n#define WI_RID_TX_CRYPT_KEY\t0xFCB1\n#define WI_RID_WEP_AVAIL\t0xFD4F\n#define WI_RID_P2_TX_CRYPT_KEY\t0xFC23\n#define WI_RID_P2_CRYPT_KEY0\t0xFC24\n#define WI_RID_P2_CRYPT_KEY1\t0xFC25\n#define WI_RID_MICROWAVE_OVEN\t0xFC25\n#define WI_RID_P2_CRYPT_KEY2\t0xFC26\n#define WI_RID_P2_CRYPT_KEY3\t0xFC27\n#define WI_RID_P2_ENCRYPTION\t0xFC28\n#define WI_RID_ROAMING_MODE\t0xFC2D\n#define WI_RID_CUR_TX_RATE\t0xFD44 /* current TX rate */\n\n#define\tWI_MAX_AID\t\t256\t/* max stations for ap operation */\n\nstruct wi_vap {\n\tstruct ieee80211vap\twv_vap;\n\tstruct ieee80211_beacon_offsets\twv_bo;\n\n\tvoid\t\t(*wv_recv_mgmt)(struct ieee80211_node *, struct mbuf *,\n\t\t\t    int, int, int);\n\tint\t\t(*wv_newstate)(struct ieee80211vap *,\n\t\t\t    enum ieee80211_state, int);\n};\n#define\tWI_VAP(vap)\t\t((struct wi_vap *)(vap))\n\nstruct wi_softc\t{\n\tstruct ifnet\t\t*sc_ifp;\n\tdevice_t\t\tsc_dev;\n\tstruct mtx\t\tsc_mtx;\n\tstruct callout\t\tsc_watchdog;\n\tint\t\t\tsc_unit;\n\tint\t\t\twi_gone;\n\tint\t\t\tsc_enabled;\n\tint\t\t\tsc_reset;\n\tint\t\t\tsc_firmware_type;\n#define WI_NOTYPE\t0\n#define\tWI_LUCENT\t1\n#define\tWI_INTERSIL\t2\n#define\tWI_SYMBOL\t3\n\tint\t\t\tsc_pri_firmware_ver;\t/* Primary firmware */\n\tint\t\t\tsc_sta_firmware_ver;\t/* Station firmware */\n\tunsigned int\t\tsc_nic_id;\t\t/* Type of NIC */\n\tchar *\t\t\tsc_nic_name;\n\n\tint\t\t\twi_bus_type;\t/* Bus attachment type */\n\tstruct resource *\tlocal;\n\tint\t\t\tlocal_rid;\n\tstruct resource *\tiobase;\n\tint\t\t\tiobase_rid;\n\tstruct resource *\tirq;\n\tint\t\t\tirq_rid;\n\tstruct resource *\tmem;\n\tint\t\t\tmem_rid;\n\tbus_space_handle_t\twi_localhandle;\n\tbus_space_tag_t\t\twi_localtag;\n\tbus_space_handle_t\twi_bhandle;\n\tbus_space_tag_t\t\twi_btag;\n\tbus_space_handle_t\twi_bmemhandle;\n\tbus_space_tag_t\t\twi_bmemtag;\n\tvoid *\t\t\twi_intrhand;\n\tstruct ieee80211_channel *wi_channel;\n\tint\t\t\twi_io_addr;\n\tint\t\t\twi_cmd_count;\n\n\tint\t\t\tsc_flags;\n\tint\t\t\tsc_if_flags;\n\tint\t\t\tsc_bap_id;\n\tint\t\t\tsc_bap_off;\n\n\tint\t\t\tsc_porttype;\n\tu_int16_t\t\tsc_portnum;\n\tu_int16_t\t\tsc_encryption;\n\tu_int16_t\t\tsc_monitor_port;\n\n\t/* RSSI interpretation */\n\tu_int16_t\t\tsc_min_rssi;\t/* clamp sc_min_rssi < RSSI */\n\tu_int16_t\t\tsc_max_rssi;\t/* clamp RSSI < sc_max_rssi */\n\tu_int16_t\t\tsc_dbm_offset;\t/* dBm ~ RSSI - sc_dbm_offset */\n\n\tint\t\t\tsc_buflen;\t\t/* TX buffer size */\n\tint\t\t\tsc_ntxbuf;\n#define\tWI_NTXBUF\t3\n\tstruct {\n\t\tint\t\td_fid;\n\t\tint\t\td_len;\n\t}\t\t\tsc_txd[WI_NTXBUF];\t/* TX buffers */\n\tint\t\t\tsc_txnext;\t\t/* index of next TX */\n\tint\t\t\tsc_txcur;\t\t/* index of current TX*/\n\tint\t\t\tsc_tx_timer;\n\n\tstruct wi_counters\tsc_stats;\n\tu_int16_t\t\tsc_ibss_port;\n\n\tstruct timeval\t\tsc_last_syn;\n\tint\t\t\tsc_false_syns;\n\n\tu_int16_t\t\tsc_txbuf[IEEE80211_MAX_LEN/2];\n\n\tstruct wi_tx_radiotap_header sc_tx_th;\n\tstruct wi_rx_radiotap_header sc_rx_th;\n};\n\n/* maximum consecutive false change-of-BSSID indications */\n#define\tWI_MAX_FALSE_SYNS\t\t10\t\n\n#define\tWI_FLAGS_HAS_ENHSECURITY\t0x0001\n#define\tWI_FLAGS_HAS_WPASUPPORT\t\t0x0002\n#define\tWI_FLAGS_HAS_ROAMING\t\t0x0020\n#define\tWI_FLAGS_HAS_FRAGTHR\t\t0x0200\n#define\tWI_FLAGS_HAS_DBMADJUST\t\t0x0400\n\nstruct wi_card_ident {\n\tu_int16_t\tcard_id;\n\tchar\t\t*card_name;\n\tu_int8_t\tfirm_type;\n};\n\n#define\tWI_PRISM_MIN_RSSI\t0x1b\n#define\tWI_PRISM_MAX_RSSI\t0x9a\n#define\tWI_PRISM_DBM_OFFSET\t100 /* XXX */\n\n#define\tWI_LUCENT_MIN_RSSI\t47\n#define\tWI_LUCENT_MAX_RSSI\t138\n#define\tWI_LUCENT_DBM_OFFSET\t149\n\n#define\tWI_RSSI_TO_DBM(sc, rssi) (MIN((sc)->sc_max_rssi, \\\n    MAX((sc)->sc_min_rssi, (rssi))) - (sc)->sc_dbm_offset)\n\n#define\tWI_LOCK(_sc) \t\tmtx_lock(&(_sc)->sc_mtx)\n#define\tWI_UNLOCK(_sc)\t\tmtx_unlock(&(_sc)->sc_mtx)\n#define\tWI_LOCK_ASSERT(_sc)\tmtx_assert(&(_sc)->sc_mtx, MA_OWNED)\n\nint\twi_attach(device_t);\nint\twi_detach(device_t);\nint\twi_shutdown(device_t);\nint\twi_alloc(device_t, int);\nvoid\twi_free(device_t);\nextern devclass_t wi_devclass;\nvoid\twi_init(void *);\nvoid\twi_intr(void *);\nint\twi_mgmt_xmit(struct wi_softc *, caddr_t, int);\nvoid\twi_stop(struct wi_softc *, int);\n"
  },
  {
    "path": "freebsd-headers/devinfo.h",
    "content": "/*-\n * Copyright (c) 2000 Michael Smith\n * Copyright (c) 2000 BSDi\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t$FreeBSD: release/9.0.0/lib/libdevinfo/devinfo.h 218505 2011-02-10 04:53:09Z imp $\n */\n\n#ifndef _DEVINFO_H_INCLUDED\n#define _DEVINFO_H_INCLUDED\n\n#include <sys/cdefs.h>\n#include <sys/types.h>\n#include <sys/bus.h>\n\ntypedef __uintptr_t\tdevinfo_handle_t;\n#define DEVINFO_ROOT_DEVICE\t((devinfo_handle_t)0)\n\ntypedef enum device_state devinfo_state_t;\n\nstruct devinfo_dev {\n\tdevinfo_handle_t\tdd_handle;\t/* device handle */\n\tdevinfo_handle_t\tdd_parent;\t/* parent handle */\n\n\tchar\t\t\t*dd_name;\t/* name of device */\n\tchar\t\t\t*dd_desc;\t/* device description */\n\tchar\t\t\t*dd_drivername;\t/* name of attached driver*/\n\tchar\t\t\t*dd_pnpinfo;\t/* pnp info from parent bus */\n\tchar\t\t\t*dd_location;\t/* Where bus thinks dev at */\n\tuint32_t\t\tdd_devflags;\t/* API flags */\n\tuint16_t\t\tdd_flags;\t/* internal dev flags */\n\tdevinfo_state_t\t\tdd_state;\t/* attacement state of dev */\n};\n\nstruct devinfo_rman {\n\tdevinfo_handle_t\tdm_handle;\t/* resource manager handle */\n\n\tunsigned long\t\tdm_start;\t/* resource start */\n\tunsigned long\t\tdm_size;\t/* resource size */\n    \n\tchar\t\t\t*dm_desc;\t/* resource description */\n};\n\nstruct devinfo_res {\n\tdevinfo_handle_t\tdr_handle;\t/* resource handle */\n\tdevinfo_handle_t\tdr_rman;\t/* resource manager handle */\n\tdevinfo_handle_t\tdr_device;\t/* owning device */\n\n\tunsigned long\t\tdr_start;\t/* region start */\n\tunsigned long\t\tdr_size;\t/* region size */\n\t/* XXX add flags */\n};\n\n__BEGIN_DECLS\n\n/*\n * Acquire a coherent copy of the kernel's device and resource tables.\n * This must return success (zero) before any other interfaces will\n * function.  Sets errno on failure.\n */\nextern int\tdevinfo_init(void);\n\n/*\n * Release the storage associated with the internal copy of the device\n * and resource tables. devinfo_init must be called before any attempt\n * is made to use any other interfaces.\n */\nextern void\tdevinfo_free(void);\n\n/*\n * Find a device/resource/resource manager by its handle.\n */\nextern struct devinfo_dev\n\t*devinfo_handle_to_device(devinfo_handle_t handle);\nextern struct devinfo_res\n\t*devinfo_handle_to_resource(devinfo_handle_t handle);\nextern struct devinfo_rman\n\t*devinfo_handle_to_rman(devinfo_handle_t handle);\n\n/*\n * Iterate over the children of a device, calling (fn) on each.  If\n * (fn) returns nonzero, abort the scan and return.\n */\nextern int\n\tdevinfo_foreach_device_child(struct devinfo_dev *parent, \n\t    int (* fn)(struct devinfo_dev *child, void *arg), \n\t    void *arg);\n\n/*\n * Iterate over all the resources owned by a device, calling (fn) on each.\n * If (fn) returns nonzero, abort the scan and return.\n */\nextern int\n\tdevinfo_foreach_device_resource(struct devinfo_dev *dev,\n\t    int (* fn)(struct devinfo_dev *dev, \n\t    struct devinfo_res *res, void *arg),\n\t    void *arg);\n\n/*\n * Iterate over all the resources owned by a resource manager, calling (fn)\n * on each.  If (fn) returns nonzero, abort the scan and return.\n */\nextern int\n\tdevinfo_foreach_rman_resource(struct devinfo_rman *rman,\n\t    int (* fn)(struct devinfo_res *res, void *arg),\n\t    void *arg);\n\n/*\n * Iterate over all the resource managers, calling (fn) on each.  If (fn)\n * returns nonzero, abort the scan and return.\n */\nextern int\n\tdevinfo_foreach_rman(int (* fn)(struct devinfo_rman *rman, void *arg),\n\t    void *arg);\n\n__END_DECLS\n\n#endif /* ! _DEVINFO_H_INCLUDED */\n"
  },
  {
    "path": "freebsd-headers/devstat.h",
    "content": "/*\n * Copyright (c) 1997, 1998 Kenneth D. Merry.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. The name of the author may not be used to endorse or promote products\n *    derived from this software without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/lib/libdevstat/devstat.h 175861 2008-01-31 16:55:12Z jhb $\n */\n\n#ifndef _DEVSTAT_H\n#define _DEVSTAT_H\n#include <sys/cdefs.h>\n#include <sys/devicestat.h>\n#include <sys/resource.h>\n\n#include <kvm.h>\n\n/*\n * Bumped every time we change the userland API.  Hopefully this doesn't\n * happen very often!  This should be bumped every time we have to\n * increment SHLIB_MAJOR in the libdevstat Makefile (for non-backwards\n * compatible API changes) and should also be bumped every time we make\n * backwards-compatible API changes, so application writers have a way to \n * determine when a particular feature is available.\n */\n#define\tDEVSTAT_USER_API_VER\t6\n\n#define DEVSTAT_ERRBUF_SIZE  2048 /* size of the devstat library error string */\n\nextern char devstat_errbuf[];\n\ntypedef enum {\n\tDEVSTAT_MATCH_NONE\t= 0x00,\n\tDEVSTAT_MATCH_TYPE\t= 0x01,\n\tDEVSTAT_MATCH_IF\t= 0x02,\n\tDEVSTAT_MATCH_PASS\t= 0x04\n} devstat_match_flags;\n\ntypedef enum {\n\tDSM_NONE,\n\tDSM_TOTAL_BYTES,\n\tDSM_TOTAL_BYTES_READ,\n\tDSM_TOTAL_BYTES_WRITE,\n\tDSM_TOTAL_TRANSFERS,\n\tDSM_TOTAL_TRANSFERS_READ,\n\tDSM_TOTAL_TRANSFERS_WRITE,\n\tDSM_TOTAL_TRANSFERS_OTHER,\n\tDSM_TOTAL_BLOCKS,\n\tDSM_TOTAL_BLOCKS_READ,\n\tDSM_TOTAL_BLOCKS_WRITE,\n\tDSM_KB_PER_TRANSFER,\n\tDSM_KB_PER_TRANSFER_READ,\n\tDSM_KB_PER_TRANSFER_WRITE,\n\tDSM_TRANSFERS_PER_SECOND,\n\tDSM_TRANSFERS_PER_SECOND_READ,\n\tDSM_TRANSFERS_PER_SECOND_WRITE,\n\tDSM_TRANSFERS_PER_SECOND_OTHER,\n\tDSM_MB_PER_SECOND,\n\tDSM_MB_PER_SECOND_READ,\n\tDSM_MB_PER_SECOND_WRITE,\n\tDSM_BLOCKS_PER_SECOND,\n\tDSM_BLOCKS_PER_SECOND_READ,\n\tDSM_BLOCKS_PER_SECOND_WRITE,\n\tDSM_MS_PER_TRANSACTION,\n\tDSM_MS_PER_TRANSACTION_READ,\n\tDSM_MS_PER_TRANSACTION_WRITE,\n\tDSM_SKIP,\n\tDSM_TOTAL_BYTES_FREE,\n\tDSM_TOTAL_TRANSFERS_FREE,\n\tDSM_TOTAL_BLOCKS_FREE,\n\tDSM_KB_PER_TRANSFER_FREE,\n\tDSM_MB_PER_SECOND_FREE,\n\tDSM_TRANSFERS_PER_SECOND_FREE,\n\tDSM_BLOCKS_PER_SECOND_FREE,\n\tDSM_MS_PER_TRANSACTION_OTHER,\n\tDSM_MS_PER_TRANSACTION_FREE,\n\tDSM_BUSY_PCT,\n\tDSM_QUEUE_LENGTH,\n\tDSM_MAX\n} devstat_metric;\n\nstruct devstat_match {\n\tdevstat_match_flags\tmatch_fields;\n\tdevstat_type_flags\tdevice_type;\n\tint\t\t\tnum_match_categories;\n};\n\nstruct devstat_match_table {\n\tconst char *\t\tmatch_str;\n\tdevstat_type_flags\ttype;\n\tdevstat_match_flags\tmatch_field;\n};\n\nstruct device_selection {\n\tu_int32_t\tdevice_number;\n\tchar\t\tdevice_name[DEVSTAT_NAME_LEN];\n\tint\t\tunit_number;\n\tint\t\tselected;\n\tu_int64_t\tbytes;\n\tint\t\tposition;\n};\n\nstruct devinfo {\n\tstruct devstat\t*devices;\n\tu_int8_t\t*mem_ptr;\n\tlong\t\tgeneration;\n\tint\t\tnumdevs;\n};\n\nstruct statinfo {\n\tlong\t\tcp_time[CPUSTATES];\n\tlong\t\ttk_nin;\n\tlong\t\ttk_nout;\n\tstruct devinfo\t*dinfo;\n\tlong double \tsnap_time;\n};\n\ntypedef enum {\n\tDS_SELECT_ADD,\n\tDS_SELECT_ONLY,\n\tDS_SELECT_REMOVE,\n\tDS_SELECT_ADDONLY\n} devstat_select_mode;\n\n__BEGIN_DECLS\n\nint devstat_getnumdevs(kvm_t *kd);\nlong devstat_getgeneration(kvm_t *kd);\nint devstat_getversion(kvm_t *kd);\nint devstat_checkversion(kvm_t *kd);\nint devstat_getdevs(kvm_t *kd, struct statinfo *stats);\nint devstat_selectdevs(struct device_selection **dev_select, int *num_selected,\n\t\t       int *num_selections, long *select_generation, \n\t\t       long current_generation, struct devstat *devices,\n\t\t       int numdevs, struct devstat_match *matches,\n\t\t       int num_matches, char **dev_selections,\n\t\t       int num_dev_selections, devstat_select_mode select_mode,\n\t\t       int maxshowdevs, int perf_select);\nint devstat_buildmatch(char *match_str, struct devstat_match **matches,\n\t\t       int *num_matches);\nint devstat_compute_statistics(struct devstat *current,\n\t\t\t       struct devstat *previous,\n\t\t\t       long double etime, ...);\nlong double devstat_compute_etime(struct bintime *cur_time,\n\t\t\t\t  struct bintime *prev_time);\n__END_DECLS\n\n#endif /* _DEVSTAT_H  */\n"
  },
  {
    "path": "freebsd-headers/dialog.h",
    "content": "/*\n *  $Id: dialog.h,v 1.231 2011/06/29 09:51:00 tom Exp $\n *\n *  dialog.h -- common declarations for all dialog modules\n *\n *  Copyright 2000-2010,2011\tThomas E. Dickey\n *\n *  This program is free software; you can redistribute it and/or modify\n *  it under the terms of the GNU Lesser General Public License, version 2.1\n *  as published by the Free Software Foundation.\n *\n *  This program is distributed in the hope that it will be useful, but\n *  WITHOUT ANY WARRANTY; without even the implied warranty of\n *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n *  Lesser General Public License for more details.\n *\n *  You should have received a copy of the GNU Lesser General Public\n *  License along with this program; if not, write to\n *\tFree Software Foundation, Inc.\n *\t51 Franklin St., Fifth Floor\n *\tBoston, MA 02110, USA.\n *\n *  An earlier version of this program lists as authors\n *\tSavio Lam (lam836@cs.cuhk.hk)\n */\n\n#ifndef DIALOG_H_included\n#define DIALOG_H_included 1\n/* *INDENT-OFF* */\n\n#include <dlg_config.h>\n\n#ifdef __hpux\n#define __HP_CURSES_COMPAT\t/* workaround for getattrs, etc. */\n#endif\n\n#include <sys/types.h>\n#include <fcntl.h>\n#include <unistd.h>\n#include <ctype.h>\n#include <stdlib.h>\n#include <stdarg.h>\n#include <string.h>\n#include <signal.h>\t/* fork() etc. */\n#include <math.h>\t/* sqrt() */\n\n/* header conflict with Solaris xpg4 versus <sys/regset.h> */\n#if defined(ERR) && (ERR == 13)\n#undef ERR\n#endif\n\n#if defined(HAVE_NCURSESW_NCURSES_H)\n#include <ncursesw/ncurses.h>\n#elif defined(HAVE_NCURSES_NCURSES_H)\n#include <ncurses/ncurses.h>\n#elif defined(HAVE_NCURSES_CURSES_H)\n#include <ncurses/curses.h>\n#elif defined(HAVE_NCURSES_H)\n#include <ncurses.h>\n#else\n#include <curses.h>\n#endif\n\n/* most curses.h headers include this, some do not */\n#if defined(HAVE_UNCTRL_H)\n#include <unctrl.h>\n#endif\n\n/* Solaris xpg4 renames these */\n#ifndef KEY_MAX\n#ifdef __KEY_MAX\n#define KEY_MAX __KEY_MAX\n#endif\n#endif\n\n#ifndef KEY_MIN\n#ifdef __KEY_MIN\n#define KEY_MIN __KEY_MIN\n#endif\n#endif\n\n/* possible conflicts with <term.h> which may be included in <curses.h> */\n#ifdef color_names\n#undef color_names\n#endif\n\n#ifdef buttons\n#undef buttons\n#endif\n\n#ifdef ENABLE_NLS\n#include <libintl.h>\n#include <langinfo.h>\n#define _(s) dgettext(PACKAGE, s)\n#else\n#undef _\n#define _(s) s\n#endif\n\n#ifndef GCC_NORETURN\n#define GCC_NORETURN /*nothing*/\n#endif\n\n#ifndef GCC_UNUSED\n#define GCC_UNUSED /*nothing*/\n#endif\n\n#ifndef HAVE_WGET_WCH\n#undef USE_WIDE_CURSES\n#endif\n\n/*\n * FIXME: a configure check would be useful\n */\n#ifdef __hpux\n#undef ACS_UARROW\n#undef ACS_DARROW\n#undef ACS_BLOCK\n#endif\n\n/*\n * Change these if you want\n */\n#define USE_SHADOW TRUE\n#define USE_COLORS TRUE\n\n#ifdef HAVE_COLOR\n#define SCOLS\t(COLS - (dialog_state.use_shadow ? 2 : 0))\n#define SLINES\t(LINES - (dialog_state.use_shadow ? 1 : 0))\n#else\n#define SCOLS\tCOLS\n#define SLINES\tLINES\n#endif\n\n#define DLG_EXIT_ESC\t\t255\n#define DLG_EXIT_UNKNOWN\t-2\t/* never return this (internal use) */\n#define DLG_EXIT_ERROR\t\t-1\t/* the shell sees this as 255 */\n#define DLG_EXIT_OK\t\t0\n#define DLG_EXIT_CANCEL\t\t1\n#define DLG_EXIT_HELP\t\t2\n#define DLG_EXIT_EXTRA\t\t3\n#define DLG_EXIT_ITEM_HELP\t4\t/* actually DLG_EXIT_HELP */\n\n#define DLG_CTRL(n)\t((n) & 0x1f)\t/* CTRL is preferred, but conflicts */\n\n#define CHR_HELP\tDLG_CTRL('E')\n#define CHR_BACKSPACE\tDLG_CTRL('H')\n#define CHR_REPAINT\tDLG_CTRL('L')\n#define CHR_KILL\tDLG_CTRL('U')\n#define CHR_LITERAL\tDLG_CTRL('V')\n#define CHR_DELETE\t127\n#define CHR_NEXT\tDLG_CTRL('N')\n#define CHR_PREVIOUS\tDLG_CTRL('P')\n#define CHR_TRACE\tDLG_CTRL('T')\n\n#define ESC\t\t27\n#define TAB\t\tDLG_CTRL('I')\n\n#define MARGIN 1\n#define GUTTER 2\n#define SHADOW_ROWS 1\n#define SHADOW_COLS 2\n#define ARROWS_COL  5\n\n#define MAX_LEN 2048\n#define BUF_SIZE (10L*1024)\n\n#undef  MIN\n#define MIN(x,y) ((x) < (y) ? (x) : (y))\n\n#undef  MAX\n#define MAX(x,y) ((x) > (y) ? (x) : (y))\n\n#define DEFAULT_SEPARATE_STR \"\\t\"\n#define DEFAULT_ASPECT_RATIO 9\n/* how many spaces is a tab long (default)? */\n#define TAB_LEN 8\n#define WTIMEOUT_VAL        10\t/* minimum amount of time needed for curses */\n\n#ifndef A_CHARTEXT\n#define A_CHARTEXT 0xff\n#endif\n\n#define CharOf(ch)  ((ch) & 0xff)\n\n#ifndef ACS_ULCORNER\n#define ACS_ULCORNER '+'\n#endif\n#ifndef ACS_LLCORNER\n#define ACS_LLCORNER '+'\n#endif\n#ifndef ACS_URCORNER\n#define ACS_URCORNER '+'\n#endif\n#ifndef ACS_LRCORNER\n#define ACS_LRCORNER '+'\n#endif\n#ifndef ACS_HLINE\n#define ACS_HLINE '-'\n#endif\n#ifndef ACS_VLINE\n#define ACS_VLINE '|'\n#endif\n#ifndef ACS_LTEE\n#define ACS_LTEE '+'\n#endif\n#ifndef ACS_RTEE\n#define ACS_RTEE '+'\n#endif\n#ifndef ACS_UARROW\n#define ACS_UARROW '^'\n#endif\n#ifndef ACS_DARROW\n#define ACS_DARROW 'v'\n#endif\n#ifndef ACS_BLOCK\n#define ACS_BLOCK '#'\n#endif\n\n/* these definitions may work for antique versions of curses */\n#ifndef HAVE_GETBEGYX\n#undef  getbegyx\n#define getbegyx(win,y,x)\t(y = (win)?(win)->_begy:ERR, x = (win)?(win)->_begx:ERR)\n#endif\n\n#ifndef HAVE_GETMAXYX\n#undef  getmaxyx\n#define getmaxyx(win,y,x)\t(y = (win)?(win)->_maxy:ERR, x = (win)?(win)->_maxx:ERR)\n#endif\n\n#ifndef HAVE_GETPARYX\n#undef  getparyx\n#define getparyx(win,y,x)\t(y = (win)?(win)->_pary:ERR, x = (win)?(win)->_parx:ERR)\n#endif\n\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\n/* these definitions may be needed for bleeding-edge curses implementations */\n#if !(defined(HAVE_GETBEGX) && defined(HAVE_GETBEGY))\n#undef getbegx\n#undef getbegy\n#define getbegx(win) dlg_getbegx(win)\n#define getbegy(win) dlg_getbegy(win)\nextern int dlg_getbegx(WINDOW * /*win*/);\nextern int dlg_getbegy(WINDOW * /*win*/);\n#endif\n\n#if !(defined(HAVE_GETCURX) && defined(HAVE_GETCURY))\n#undef getcurx\n#undef getcury\n#define getcurx(win) dlg_getcurx(win)\n#define getcury(win) dlg_getcury(win)\nextern int dlg_getcurx(WINDOW * /*win*/);\nextern int dlg_getcury(WINDOW * /*win*/);\n#endif\n\n#if !(defined(HAVE_GETMAXX) && defined(HAVE_GETMAXY))\n#undef getmaxx\n#undef getmaxy\n#define getmaxx(win) dlg_getmaxx(win)\n#define getmaxy(win) dlg_getmaxy(win)\nextern int dlg_getmaxx(WINDOW * /*win*/);\nextern int dlg_getmaxy(WINDOW * /*win*/);\n#endif\n\n#if !(defined(HAVE_GETPARX) && defined(HAVE_GETPARY))\n#undef getparx\n#undef getpary\n#define getparx(win) dlg_getparx(win)\n#define getpary(win) dlg_getpary(win)\nextern int dlg_getparx(WINDOW * /*win*/);\nextern int dlg_getpary(WINDOW * /*win*/);\n#endif\n\n/*\n * This is a list of \"old\" names, which should be helpful in updating\n * applications that use libdialog.  Starting with 2003/11/26, all exported\n * symbols from libdialog have \"dlg_\" prefix, or \"dialog_\" prefix or \"_dialog\"\n * suffix (or suffix \"_dialog\", e.g., init_dialog).\n */\n#ifdef __DIALOG_OLD_NAMES__\n#define color_table                       dlg_color_table\n#define attr_clear(win,h,w,a)             dlg_attr_clear(win,h,w,a)\n#define auto_size(t,s,h,w,xl,mc)          dlg_auto_size(t,s,h,w,xl,mc)\n#define auto_sizefile(t,f,h,w,xl,mc)      dlg_auto_sizefile(t,f,h,w,xl,mc)\n#define beeping()                         dlg_beeping()\n#define box_x_ordinate(w)                 dlg_box_x_ordinate(w)\n#define box_y_ordinate(h)                 dlg_box_y_ordinate(h)\n#define calc_listh(h,lh,in)               dlg_calc_listh(h,lh,in)\n#define calc_listw(in,items,group)        dlg_calc_listw(in,items,group)\n#define color_setup()                     dlg_color_setup()\n#define create_rc(f)                      dlg_create_rc(f)\n#define ctl_size(h,w)                     dlg_ctl_size(h,w)\n#define del_window(win)                   dlg_del_window(win)\n#define dialog_clear()                    dlg_clear()\n#define draw_bottom_box(win)              dlg_draw_bottom_box(win)\n#define draw_box(win,y,x,h,w,xc,bc)       dlg_draw_box(win,y,x,h,w,xc,bc)\n#define draw_shadow(win,h,w,y,x)          dlg_draw_shadow(win,h,w,y,x)\n#define draw_title(win,t)                 dlg_draw_title(win,t)\n#define exiterr                           dlg_exiterr\n#define killall_bg(n)                     dlg_killall_bg(n)\n#define mouse_bigregion(y,x)              dlg_mouse_bigregion(y,x)\n#define mouse_free_regions()              dlg_mouse_free_regions()\n#define mouse_mkbigregion(y,x,h,w,n,ix,iy,m) dlg_mouse_mkbigregion(y,x,h,w,n,ix,iy,m)\n#define mouse_mkregion(y,x,h,w,n)         dlg_mouse_mkregion(y,x,h,w,n)\n#define mouse_region(y,x)                 dlg_mouse_region(y,x)\n#define mouse_setbase(x,y)                dlg_mouse_setbase(x,y)\n#define mouse_wgetch(w,c)                 dlg_mouse_wgetch(w,c)\n#define new_window(h,w,y,x)               dlg_new_window(h,w,y,x)\n#define parse_rc()                        dlg_parse_rc()\n#define print_autowrap(win,s,h,w)         dlg_print_autowrap(win,s,h,w)\n#define print_size(h,w)                   dlg_print_size(h,w)\n#define put_backtitle()                   dlg_put_backtitle()\n#define strclone(cprompt)                 dlg_strclone(cprompt)\n#define sub_window(win,h,w,y,x)           dlg_sub_window(win,h,w,y,x)\n#define tab_correct_str(s)                dlg_tab_correct_str(s)\n#endif\n\n/*\n * Attribute names\n */\n#define DIALOG_ATR(n)                 dlg_color_table[n].atr\n\n#define screen_attr                   DIALOG_ATR(0)\n#define shadow_attr                   DIALOG_ATR(1)\n#define dialog_attr                   DIALOG_ATR(2)\n#define title_attr                    DIALOG_ATR(3)\n#define border_attr                   DIALOG_ATR(4)\n#define button_active_attr            DIALOG_ATR(5)\n#define button_inactive_attr          DIALOG_ATR(6)\n#define button_key_active_attr        DIALOG_ATR(7)\n#define button_key_inactive_attr      DIALOG_ATR(8)\n#define button_label_active_attr      DIALOG_ATR(9)\n#define button_label_inactive_attr    DIALOG_ATR(10)\n#define inputbox_attr                 DIALOG_ATR(11)\n#define inputbox_border_attr          DIALOG_ATR(12)\n#define searchbox_attr                DIALOG_ATR(13)\n#define searchbox_title_attr          DIALOG_ATR(14)\n#define searchbox_border_attr         DIALOG_ATR(15)\n#define position_indicator_attr       DIALOG_ATR(16)\n#define menubox_attr                  DIALOG_ATR(17)\n#define menubox_border_attr           DIALOG_ATR(18)\n#define item_attr                     DIALOG_ATR(19)\n#define item_selected_attr            DIALOG_ATR(20)\n#define tag_attr                      DIALOG_ATR(21)\n#define tag_selected_attr             DIALOG_ATR(22)\n#define tag_key_attr                  DIALOG_ATR(23)\n#define tag_key_selected_attr         DIALOG_ATR(24)\n#define check_attr                    DIALOG_ATR(25)\n#define check_selected_attr           DIALOG_ATR(26)\n#define uarrow_attr                   DIALOG_ATR(27)\n#define darrow_attr                   DIALOG_ATR(28)\n#define itemhelp_attr                 DIALOG_ATR(29)\n#define form_active_text_attr         DIALOG_ATR(30)\n#define form_text_attr                DIALOG_ATR(31)\n#define form_item_readonly_attr       DIALOG_ATR(32)\n#define gauge_attr                    DIALOG_ATR(33)\n\n#define DLGK_max (KEY_MAX + 256)\n\n/*\n * Callbacks are used to implement the \"background\" tailbox.\n */\nstruct _dlg_callback;\n\ntypedef void (*DIALOG_FREEBACK) (struct _dlg_callback * /* p */);\n\ntypedef struct _dlg_callback {\n    struct _dlg_callback *next;\n    FILE *input;\n    WINDOW *win;\n    bool keep_bg;\t/* keep in background, on exit */\n    bool bg_task;\t/* true if this is background task */\n    bool (*handle_getc)(struct _dlg_callback *p, int ch, int fkey, int *result);\n    bool keep_win;\t/* true to not erase window on exit */\n    /* data for dlg_add_callback_ref */\n    struct _dlg_callback **caller;\n    DIALOG_FREEBACK freeback;\n    /* 1.1-20110107 */\n    bool (*handle_input)(struct _dlg_callback *p);\n    bool input_ready;\n} DIALOG_CALLBACK;\n\ntypedef struct _dlg_windows {\n    struct _dlg_windows *next;\n    WINDOW *normal;\n    WINDOW *shadow;\n} DIALOG_WINDOWS;\n\n/*\n * Global variables, which are initialized as needed\n */\ntypedef struct {\n    DIALOG_CALLBACK *getc_callbacks;\n    DIALOG_CALLBACK *getc_redirect;\n    DIALOG_WINDOWS *all_windows;\n    FILE *output;\t\t/* option \"--output-fd fd\" */\n    FILE *pipe_input;\t\t/* used for gauge widget */\n    FILE *screen_output;\t/* newterm(), etc. */\n    bool screen_initialized;\n    bool use_colors;\t\t/* use colors by default? */\n    bool use_scrollbar;\t\t/* option \"--scrollbar\" */\n    bool use_shadow;\t\t/* shadow dialog boxes by default? */\n    bool visit_items;\t\t/* option \"--visit-items\" */\n    char *separate_str;\t\t/* option \"--separate-widget string\" */\n    int aspect_ratio;\t\t/* option \"--aspect ratio\" */\n    int output_count;\t\t/* # of widgets that may have done output */\n    int tab_len;\t\t/* option \"--tab-len n\" */\n    /* 1.0-20070227 */\n    FILE *input;\t\t/* option \"--input-fd fd\" */\n#ifdef HAVE_DLG_TRACE\n    FILE *trace_output;\t\t/* option \"--trace file\" */\n#endif\n    /* 1.1-20110106 */\n    bool no_mouse;\t\t/* option \"--no-mouse\" */\n} DIALOG_STATE;\n\nextern DIALOG_STATE dialog_state;\n\n/*\n * Global variables, which dialog resets before each widget\n */\ntypedef struct {\n    bool beep_after_signal;\t/* option \"--beep-after\" */\n    bool beep_signal;\t\t/* option \"--beep\" */\n    bool begin_set;\t\t/* option \"--begin y x\" was used */\n    bool cant_kill;\t\t/* option \"--no-kill\" */\n    bool colors;\t\t/* option \"--colors\" */\n    bool cr_wrap;\t\t/* option \"--cr-wrap\" */\n    bool defaultno;\t\t/* option \"--defaultno\" */\n    bool dlg_clear_screen;\t/* option \"--clear\" */\n    bool extra_button;\t\t/* option \"--extra-button\" */\n    bool help_button;\t\t/* option \"--help-button\" */\n    bool help_status;\t\t/* option \"--help-status\" */\n    bool input_menu;\t\t/* menu vs inputmenu widget */\n    bool insecure;\t\t/* option \"--insecure\" */\n    bool item_help;\t\t/* option \"--item-help\" */\n    bool keep_window;\t\t/* option \"--keep-window\" */\n    bool nocancel;\t\t/* option \"--no-cancel\" */\n    bool nocollapse;\t\t/* option \"--no-collapse\" */\n    bool print_siz;\t\t/* option \"--print-size\" */\n    bool separate_output;\t/* option \"--separate-output\" */\n    bool single_quoted;\t\t/* option \"--single-quoted\" */\n    bool size_err;\t\t/* option \"--size-err\" */\n    bool tab_correct;\t\t/* option \"--tab-correct\" */\n    bool trim_whitespace;\t/* option \"--trim\" */\n    char *backtitle;\t\t/* option \"--backtitle backtitle\" */\n    char *cancel_label;\t\t/* option \"--cancel-label string\" */\n    char *default_item;\t\t/* option \"--default-item string\" */\n    char *exit_label;\t\t/* option \"--exit-label string\" */\n    char *extra_label;\t\t/* option \"--extra-label string\" */\n    char *help_label;\t\t/* option \"--help-label string\" */\n    char *input_result;\n    char *no_label;\t\t/* option \"--no-label string\" */\n    char *ok_label;\t\t/* option \"--ok-label string\" */\n    char *title;\t\t/* option \"--title title\" */\n    char *yes_label;\t\t/* option \"--yes-label string\" */\n    int begin_x;\t\t/* option \"--begin y x\" (second value) */\n    int begin_y;\t\t/* option \"--begin y x\" (first value) */\n    int max_input;\t\t/* option \"--max-input size\" */\n    int scale_factor;\t\t/* RESERVED */\n    int sleep_secs;\t\t/* option \"--sleep secs\" */\n    int timeout_secs;\t\t/* option \"--timeout secs\" */\n    unsigned input_length;\t/* nonzero if input_result is allocated */\n    /* 1.0-20051207 */\n    unsigned formitem_type;\t/* DIALOG_FORMITEM.type in dialog_form() */\n    /* 1.1-20070227 */\n    bool keep_tite;\t\t/* option \"--keep-tite\" */\n    bool ascii_lines;\t\t/* option \"--ascii-lines\" */\n    bool no_lines;\t\t/* option \"--no-lines\" */\n    /* 1.1-20070930 */\n    bool nook;\t\t\t/* option \"--no-ok\" */\n    /* 1.1-20080727 */\n    bool quoted;\t\t/* option \"--quoted\" */\n    char *column_header;\t/* RESERVED \"--column-header\" */\n    char *column_separator;\t/* option \"--column-separator\" */\n    char *output_separator;\t/* option \"--output-separator\" */\n    /* 1.1-20100118 */\n    char *date_format;\t\t/* option \"--date-format\" */\n    char *time_format;\t\t/* option \"--time-format\" */\n    /* 1.1-20110629 */\n    char *help_line;\t\t/* option \"--hline\" */\n    char *help_file;\t\t/* option \"--hfile\" */\n    bool in_helpfile;\t\t/* flag to prevent recursion in --hfile */\n    bool no_nl_expand;\t\t/* option \"--no-nl-expand\" */\n} DIALOG_VARS;\n\n#define USE_ITEM_HELP(s)        (dialog_vars.item_help && (s) != 0)\n#define CHECKBOX_TAGS           (dialog_vars.item_help ? 4 : 3)\n#define MENUBOX_TAGS            (dialog_vars.item_help ? 3 : 2)\n#define FORMBOX_TAGS            (dialog_vars.item_help ? 9 : 8)\n#define MIXEDFORM_TAGS          (FORMBOX_TAGS + 1)\n#define MIXEDGAUGE_TAGS         2\n\nextern DIALOG_VARS dialog_vars;\n\n#ifndef HAVE_TYPE_CHTYPE\n#define chtype long\n#endif\n\n#define UCH(ch)\t\t\t((unsigned char)(ch))\n\n#define assert_ptr(ptr,msg) if ((ptr) == 0) dlg_exiterr(\"cannot allocate memory in \" msg)\n\n#define dlg_malloc(t,n)    (t *) malloc((size_t)(n) * sizeof(t))\n#define dlg_calloc(t,n)    (t *) calloc((size_t)(n), sizeof(t))\n#define dlg_realloc(t,n,p) (t *) realloc((p), (n) * sizeof(t))\n\n/*\n * Table for attribute- and color-values.\n */\ntypedef struct {\n    chtype atr;\n#ifdef HAVE_COLOR\n    int fg;\n    int bg;\n    int hilite;\n#endif\n#ifdef HAVE_RC_FILE\n    const char *name;\n    const char *comment;\n#endif\n} DIALOG_COLORS;\n\nextern DIALOG_COLORS dlg_color_table[];\n\n/*\n * Function prototypes\n */\nextern const char *dialog_version(void);\n\n/* widgets, each in separate files */\nextern int dialog_calendar(const char * /*title*/, const char * /*subtitle*/, int /*height*/, int /*width*/, int /*day*/, int /*month*/, int /*year*/);\nextern int dialog_checklist(const char * /*title*/, const char * /*cprompt*/, int /*height*/, int /*width*/, int /*list_height*/, int /*item_no*/, char ** /*items*/, int /*flag*/);\nextern int dialog_dselect(const char * /*title*/, const char * /*path*/, int /*height*/, int /*width*/);\nextern int dialog_editbox(const char * /*title*/, const char * /*file*/, int /*height*/, int /*width*/);\nextern int dialog_form(const char * /*title*/, const char * /*cprompt*/, int /*height*/, int /*width*/, int /*form_height*/, int /*item_no*/, char ** /*items*/);\nextern int dialog_fselect(const char * /*title*/, const char * /*path*/, int /*height*/, int /*width*/);\nextern int dialog_gauge(const char * /*title*/, const char * /*cprompt*/, int /*height*/, int /*width*/, int /*percent*/);\nextern int dialog_helpfile(const char * /*title*/, const char * /*file*/, int /*height*/, int /*width*/);\nextern int dialog_inputbox(const char * /*title*/, const char * /*cprompt*/, int /*height*/, int /*width*/, const char * /*init*/, const int /*password*/);\nextern int dialog_menu(const char * /*title*/, const char * /*cprompt*/, int /*height*/, int /*width*/, int /*menu_height*/, int /*item_no*/, char ** /*items*/);\nextern int dialog_mixedform(const char * /*title*/, const char * /*cprompt*/, int /*height*/, int /*width*/, int /*form_height*/, int /*item_no*/, char ** /*items*/);\nextern int dialog_mixedgauge(const char * /*title*/, const char * /*cprompt*/, int /*height*/, int /*width*/, int /*percent*/, int /*item_no*/, char ** /*items*/);\nextern int dialog_msgbox(const char * /*title*/, const char * /*cprompt*/, int /*height*/, int /*width*/, int /*pauseopt*/);\nextern int dialog_pause(const char * /*title*/, const char * /*cprompt*/, int /*height*/, int /*width*/, int /*seconds*/);\nextern int dialog_prgbox(const char * /*title*/, const char * /*cprompt*/, const char * /*command*/, int /*height*/, int /*width*/, int /*pauseopt*/);\nextern int dialog_progressbox(const char * /*title*/, const char * /*cprompt*/, int /*height*/, int /*width*/);\nextern int dialog_tailbox(const char * /*title*/, const char * /*file*/, int /*height*/, int /*width*/, int /*bg_task*/);\nextern int dialog_textbox(const char * /*title*/, const char * /*file*/, int /*height*/, int /*width*/);\nextern int dialog_timebox(const char * /*title*/, const char * /*subtitle*/, int /*height*/, int /*width*/, int /*hour*/, int /*minute*/, int /*second*/);\nextern int dialog_yesno(const char * /*title*/, const char * /*cprompt*/, int /*height*/, int /*width*/);\n\n/* some widgets have alternate entrypoints, to allow list manipulation */\ntypedef struct {\n    char *name;\n    char *text;\n    char *help;\n    int state;\n} DIALOG_LISTITEM;\n\ntypedef struct {\n    unsigned type;\t\t/* the field type (0=input, 1=password) */\n    char *name;\t\t\t/* the field label */\n    int name_len;\t\t/* ...its length */\n    int name_y;\t\t\t/* ...its y-ordinate */\n    int name_x;\t\t\t/* ...its x-ordinate */\n    bool name_free;\t\t/* ...true if .name can be freed */\n    char *text;\t\t\t/* the field contents */\n    int text_len;\t\t/* ...its length on the screen */\n    int text_y;\t\t\t/* ...its y-ordinate */\n    int text_x;\t\t\t/* ...its x-ordinate */\n    int text_flen;\t\t/* ...its length on screen, or 0 if no input allowed */\n    int text_ilen;\t\t/* ...its limit on amount to be entered */\n    bool text_free;\t\t/* ...true if .text can be freed */\n    char *help;\t\t\t/* help-message, if any */\n    bool help_free;\t\t/* ...true if .help can be freed */\n} DIALOG_FORMITEM;\n\ntypedef\tint (DIALOG_INPUTMENU) (DIALOG_LISTITEM * /*items*/, int /*current*/, char * /*newtext*/);\n\nextern int dlg_checklist(const char * /*title*/, const char * /*cprompt*/, int /*height*/, int /*width*/, int /*list_height*/, int /*item_no*/, DIALOG_LISTITEM * /*items*/, const char * /*states*/, int /*flag*/, int * /*current_item*/);\nextern int dlg_form(const char * /*title*/, const char * /*cprompt*/, int /*height*/, int /*width*/, int /*form_height*/, int /*item_no*/, DIALOG_FORMITEM * /*items*/, int * /*current_item*/);\nextern int dlg_menu(const char * /*title*/, const char * /*cprompt*/, int /*height*/, int /*width*/, int /*menu_height*/, int /*item_no*/, DIALOG_LISTITEM * /*items*/, int * /*current_item*/, DIALOG_INPUTMENU /*rename_menu*/);\nextern int dlg_progressbox(const char * /*title*/, const char * /*cprompt*/, int /*height*/, int /*width*/, int /*pauseopt*/, FILE * /* fp */);\n\n/* argv.c */\nextern char ** dlg_string_to_argv(char * /* blob */);\nextern int dlg_count_argv(char ** /* argv */);\nextern int dlg_eat_argv(int * /* argcp */, char *** /* argvp */, int /* start */, int /* count */);\n\n/* arrows.c */\nextern void dlg_draw_arrows(WINDOW * /*dialog*/, int /*top_arrow*/, int /*bottom_arrow*/, int /*x*/, int /*top*/, int /*bottom*/);\nextern void dlg_draw_arrows2(WINDOW * /*dialog*/, int /*top_arrow*/, int /*bottom_arrow*/, int /*x*/, int /*top*/, int /*bottom*/, chtype /*attr*/, chtype /*borderattr*/);\nextern void dlg_draw_helpline(WINDOW * /*dialog*/, bool /*decorations*/);\nextern void dlg_draw_scrollbar(WINDOW * /*dialog*/, long /* first_data */, long /* this_data */, long /* next_data */, long /* total_data */, int /* left */, int /* right */, int /*top*/, int /*bottom*/, chtype /*attr*/, chtype /*borderattr*/);\n\n/* buttons.c */\nextern const char ** dlg_exit_label(void);\nextern const char ** dlg_ok_label(void);\nextern const char ** dlg_ok_labels(void);\nextern const char ** dlg_yes_labels(void);\nextern int dlg_button_count(const char ** /*labels*/);\nextern int dlg_button_to_char(const char * /*label*/);\nextern int dlg_button_x_step(const char ** /*labels*/, int /*limit*/, int * /*gap*/, int * /*margin*/, int * /*step*/);\nextern int dlg_char_to_button(int /*ch*/, const char ** /*labels*/);\nextern int dlg_exit_buttoncode(int /*button*/);\nextern int dlg_match_char(int /*ch*/, const char * /*string*/);\nextern int dlg_next_button(const char ** /*labels*/, int /*button*/);\nextern int dlg_next_ok_buttonindex(int /*current*/, int /*extra*/);\nextern int dlg_ok_buttoncode(int /*button*/);\nextern int dlg_prev_button(const char ** /*labels*/, int /*button*/);\nextern int dlg_prev_ok_buttonindex(int /*current*/, int /*extra*/);\nextern int dlg_yes_buttoncode(int /*button*/);\nextern void dlg_button_layout(const char ** /*labels*/, int * /*limit*/);\nextern void dlg_button_sizes(const char ** /*labels*/, int /*vertical*/, int * /*longest*/, int * /*length*/);\nextern void dlg_draw_buttons(WINDOW * /*win*/, int /*y*/, int /*x*/, const char ** /*labels*/, int /*selected*/, int /*vertical*/, int /*limit*/);\n\n/* columns.c */\nextern void dlg_align_columns(char ** /* target */, int  /* per_row */, int /* num_rows */);\nextern void dlg_free_columns(char ** /* target */, int  /* per_row */, int /* num_rows */);\n\n/* editbox.c */\nextern int dlg_editbox(const char */*title*/, char ***/*list*/, int */*rows*/, int /*height*/, int /*width*/);\n\n/* formbox.c */\nextern int dlg_default_formitem(DIALOG_FORMITEM * /*items*/);\nextern int dlg_ordinate(const char * /*s*/);\nextern void dlg_free_formitems(DIALOG_FORMITEM * /*items*/);\n\n/* guage.c */\nextern void * dlg_allocate_gauge(const char * /* title */, const char * /* cprompt */, int /* height */, int /* width */, int /* percent */);\nextern void dlg_free_gauge(void * /* objptr */);\nextern void dlg_update_gauge(void * /* objptr */, int /* percent */);\n\n/* inputstr.c */\nextern bool dlg_edit_string(char * /*string*/, int * /*offset*/, int /*key*/, int /*fkey*/, bool /*force*/);\nextern const int * dlg_index_columns(const char * /*string*/);\nextern const int * dlg_index_wchars(const char * /*string*/);\nextern int dlg_count_columns(const char * /*string*/);\nextern int dlg_count_wchars(const char * /*string*/);\nextern int dlg_edit_offset(char * /*string*/, int /*offset*/, int /*x_last*/);\nextern int dlg_find_index(const int * /*list*/, int  /*limit*/, int /*to_find*/);\nextern int dlg_limit_columns(const char * /*string*/, int /*limit*/, int /*offset*/);\nextern void dlg_show_string(WINDOW * /*win*/, const char * /*string*/, int /*offset*/, chtype /*attr*/, int /*y_base*/, int /*x_base*/, int /*x_last*/, bool /*hidden*/, bool /*force*/);\n\n/* rc.c */\n#ifdef HAVE_RC_FILE\nextern int dlg_parse_rc(void);\nextern void dlg_create_rc(const char * /*filename*/);\n#endif\n\n/* ui_getc.c */\nextern int dlg_getc(WINDOW * /*win*/, int * /*fkey*/);\nextern int dlg_getc_callbacks(int /*ch*/, int /*fkey*/, int * /*result*/);\nextern int dlg_last_getc(void);\nextern void dlg_add_callback(DIALOG_CALLBACK * /*p*/);\nextern void dlg_add_callback_ref(DIALOG_CALLBACK ** /*p*/, DIALOG_FREEBACK /* cleanup */);\nextern void dlg_flush_getc(void);\nextern void dlg_remove_callback(DIALOG_CALLBACK * /*p*/);\nextern void dlg_killall_bg(int *retval);\n\n/* util.c */\nextern WINDOW * dlg_new_modal_window(WINDOW * /*parent*/, int /*height*/, int /*width*/, int /*y*/, int /*x*/);\nextern WINDOW * dlg_new_window(int /*height*/, int /*width*/, int /*y*/, int /*x*/);\nextern WINDOW * dlg_sub_window(WINDOW * /*win*/, int /*height*/, int /*width*/, int /*y*/, int /*x*/);\nextern bool dlg_need_separator(void);\nextern char * dlg_set_result(const char * /*string*/);\nextern char * dlg_strclone(const char * /*cprompt*/);\nextern char * dlg_strempty(void);\nextern chtype dlg_asciibox(chtype /*ch*/);\nextern chtype dlg_boxchar(chtype /*ch*/);\nextern chtype dlg_get_attrs(WINDOW * /*win*/);\nextern const char * dlg_print_line(WINDOW */*win*/, chtype */*attr*/, const char */*prompt*/, int /*lm*/, int /*rm*/, int */*x*/);\nextern int dlg_box_x_ordinate(int /*width*/);\nextern int dlg_box_y_ordinate(int /*height*/);\nextern int dlg_calc_list_width(int /*item_no*/, DIALOG_LISTITEM * /*items*/);\nextern int dlg_calc_listw(int /*item_no*/, char ** /*items*/, int /*group*/);\nextern int dlg_check_scrolled(int /* key */, int /* last */, int /* page */, bool */* show */, int */* offset */);\nextern int dlg_default_item(char ** /*items*/, int /*llen*/);\nextern int dlg_default_listitem(DIALOG_LISTITEM * /*items*/);\nextern int dlg_defaultno_button(void);\nextern int dlg_max_input(int /*max_len*/);\nextern int dlg_print_scrolled(WINDOW * /* win */, const char * /* prompt */, int /* offset */, int /* height */, int /* width */, int /* pauseopt */);\nextern void dlg_add_quoted(char * /*string*/);\nextern void dlg_add_result(const char * /*string*/);\nextern void dlg_add_separator(void);\nextern void dlg_add_string(char * /*string*/);\nextern void dlg_attr_clear(WINDOW * /*win*/, int /*height*/, int /*width*/, chtype /*attr*/);\nextern void dlg_auto_size(const char * /*title*/, const char * /*prompt*/, int * /*height*/, int * /*width*/, int /*boxlines*/, int /*mincols*/);\nextern void dlg_auto_sizefile(const char * /*title*/, const char * /*file*/, int * /*height*/, int * /*width*/, int /*boxlines*/, int /*mincols*/);\nextern void dlg_beeping(void);\nextern void dlg_calc_listh(int * /*height*/, int * /*list_height*/, int /*item_no*/);\nextern void dlg_clear(void);\nextern void dlg_clr_result(void);\nextern void dlg_ctl_size(int /*height*/, int /*width*/);\nextern void dlg_del_window(WINDOW * /*win*/);\nextern void dlg_does_output(void);\nextern void dlg_draw_bottom_box(WINDOW * /*win*/);\nextern void dlg_draw_box(WINDOW * /*win*/, int /*y*/, int /*x*/, int /*height*/, int /*width*/, chtype /*boxchar*/, chtype /*borderchar*/);\nextern void dlg_draw_title(WINDOW *win, const char *title);\nextern void dlg_exit(int /*code*/) GCC_NORETURN;\nextern void dlg_item_help(const char * /*txt*/);\nextern void dlg_print_autowrap(WINDOW * /*win*/, const char * /*prompt*/, int /*height*/, int /*width*/);\nextern void dlg_print_size(int /*height*/, int /*width*/);\nextern void dlg_print_text(WINDOW * /*win*/, const char * /*txt*/, int /*len*/, chtype * /*attr*/);\nextern void dlg_put_backtitle(void);\nextern void dlg_restore_vars(DIALOG_VARS * /* save */);\nextern void dlg_save_vars(DIALOG_VARS * /* save */);\nextern void dlg_set_focus(WINDOW * /*parent*/, WINDOW * /*win*/);\nextern void dlg_tab_correct_str(char * /*prompt*/);\nextern void dlg_trim_string(char * /*src*/);\nextern void end_dialog(void);\nextern void init_dialog(FILE * /*input*/, FILE * /*output*/);\n\nextern void dlg_exiterr(const char *, ...) GCC_NORETURN\n#if defined(__GNUC__) && !defined(printf)\n__attribute__((format(printf,1,2)))\n#endif\n;\n\n#ifdef HAVE_COLOR\nextern chtype dlg_color_pair(int /*foreground*/, int /*background*/);\nextern int dlg_color_count(void);\nextern void dlg_color_setup(void);\nextern void dlg_draw_shadow(WINDOW * /*win*/, int /*height*/, int /*width*/, int /*y*/, int /*x*/);\n#endif\n\n#ifdef HAVE_STRCASECMP\n#define dlg_strcmp(a,b) strcasecmp(a,b)\n#else\nextern int dlg_strcmp(const char * /*a*/, const char * /*b*/);\n#endif\n\n#ifdef HAVE_DLG_TRACE\n#define DLG_TRACE(params) dlg_trace_msg params\nextern void dlg_trace_msg(const char *fmt, ...)\n#ifdef GCC_PRINTF\n    __attribute__((format(printf,1,2)))\n#endif\n;\nextern void dlg_trace_win(WINDOW * /*win*/);\nextern void dlg_trace_chr(int /*ch*/, int /*fkey*/);\nextern void dlg_trace(const char * /*fname*/);\n#else\n#define DLG_TRACE(params) /* nothing */\n#define dlg_trace_win(win) /* nothing */\n#define dlg_trace_chr(ch,fkey) /* nothing */\n#define dlg_trace(fname) /* nothing */\n#endif\n\n#ifdef KEY_RESIZE\nextern void dlg_move_window(WINDOW * /*win*/, int /*height*/, int /*width*/, int /*y*/, int /*x*/);\n#endif\n\n/*\n * Normally \"enter\" means \"ok\".  Use this macro to handle the explicit\n * check for DLGK_ENTER:\n */\n#define dlg_enter_buttoncode(code) (dialog_vars.nook ? DLG_EXIT_OK : dlg_ok_buttoncode(code))\n\n/*\n * The following stuff is needed for mouse support\n */\ntypedef struct mseRegion {\n    int x, y, X, Y, code;\n    int mode, step_x, step_y;\n    struct mseRegion *next;\n} mseRegion;\n\n#if defined(NCURSES_MOUSE_VERSION)\n\n#define\tmouse_open() mousemask(BUTTON1_CLICKED, (mmask_t *) 0)\n#define\tmouse_close() mousemask(0, (mmask_t *) 0)\n\nextern mseRegion * dlg_mouse_mkregion (int /*y*/, int /*x*/, int /*height*/, int /*width*/, int /*code*/);\nextern void dlg_mouse_free_regions (void);\nextern void dlg_mouse_mkbigregion (int /*y*/, int /*x*/, int /*height*/, int /*width*/, int /*code*/, int /*step_x*/, int /*step_y*/, int /*mode*/);\nextern void dlg_mouse_setbase (int /*x*/, int /*y*/);\n\n#define USE_MOUSE 1\n\n#else\n\n#define\tmouse_open() /*nothing*/\n#define\tmouse_close() /*nothing*/\n#define dlg_mouse_free_regions() /* nothing */\n#define\tdlg_mouse_mkregion(y, x, height, width, code) /*nothing*/\n#define\tdlg_mouse_mkbigregion(y, x, height, width, code, step_x, step_y, mode) /*nothing*/\n#define\tdlg_mouse_setbase(x, y) /*nothing*/\n\n#define USE_MOUSE 0\n\n#endif\n\nextern mseRegion *dlg_mouse_region (int /*y*/, int /*x*/);\nextern mseRegion *dlg_mouse_bigregion (int /*y*/, int /*x*/);\nextern int dlg_mouse_wgetch (WINDOW * /*win*/, int * /*fkey*/);\nextern int dlg_mouse_wgetch_nowait (WINDOW * /*win*/, int * /*fkey*/);\n\n#define mouse_mkbutton(y,x,len,code) dlg_mouse_mkregion(y,x,1,len,code);\n\n/*\n * This is the base for fictitious keys, which activate\n * the buttons.\n *\n * Mouse-generated keys are the following:\n *   -- the first 32 are used as numbers, in addition to '0'-'9'\n *   -- uppercase chars are used to invoke the button (M_EVENT + 'O')\n */\n#define M_EVENT (DLGK_max + 1)\n\n/*\n * The `flag' parameter in checklist is used to select between\n * radiolist and checklist\n */\n#define FLAG_CHECK 1\n#define FLAG_RADIO 0\n\n/*\n * This is used only for debugging (FIXME: should have a separate header).\n */\n#ifdef NO_LEAKS\nextern void _dlg_inputstr_leaks(void);\n#if defined(NCURSES_VERSION) && defined(HAVE__NC_FREE_AND_EXIT)\nextern void _nc_free_and_exit(int);\t/* nc_alloc.h normally not installed */\n#endif\n#endif\n\n#ifdef __cplusplus\n}\n#endif\n/* *INDENT-ON* */\n\n#endif /* DIALOG_H_included */\n"
  },
  {
    "path": "freebsd-headers/digest_asn1.h",
    "content": "/* Generated from /usr/src/kerberos5/lib/libasn1/../../../crypto/heimdal/lib/asn1/digest.asn1 */\n/* Do not edit */\n\n#ifndef __digest_asn1_h__\n#define __digest_asn1_h__\n\n#include <stddef.h>\n#include <time.h>\n\n#ifndef __asn1_common_definitions__\n#define __asn1_common_definitions__\n\ntypedef struct heim_integer {\n  size_t length;\n  void *data;\n  int negative;\n} heim_integer;\n\ntypedef struct heim_octet_string {\n  size_t length;\n  void *data;\n} heim_octet_string;\n\ntypedef char *heim_general_string;\n\ntypedef char *heim_utf8_string;\n\ntypedef char *heim_printable_string;\n\ntypedef char *heim_ia5_string;\n\ntypedef struct heim_bmp_string {\n  size_t length;\n  uint16_t *data;\n} heim_bmp_string;\n\ntypedef struct heim_universal_string {\n  size_t length;\n  uint32_t *data;\n} heim_universal_string;\n\ntypedef char *heim_visible_string;\n\ntypedef struct heim_oid {\n  size_t length;\n  unsigned *components;\n} heim_oid;\n\ntypedef struct heim_bit_string {\n  size_t length;\n  void *data;\n} heim_bit_string;\n\ntypedef struct heim_octet_string heim_any;\ntypedef struct heim_octet_string heim_any_set;\n\n#define ASN1_MALLOC_ENCODE(T, B, BL, S, L, R)                  \\\n  do {                                                         \\\n    (BL) = length_##T((S));                                    \\\n    (B) = malloc((BL));                                        \\\n    if((B) == NULL) {                                          \\\n      (R) = ENOMEM;                                            \\\n    } else {                                                   \\\n      (R) = encode_##T(((unsigned char*)(B)) + (BL) - 1, (BL), \\\n                       (S), (L));                              \\\n      if((R) != 0) {                                           \\\n        free((B));                                             \\\n        (B) = NULL;                                            \\\n      }                                                        \\\n    }                                                          \\\n  } while (0)\n\nstruct units;\n\n#endif\n\n#include <krb5_asn1.h>\n/*\nDigestTypes ::= BIT STRING {\n  ntlm-v1(0),\n  ntlm-v1-session(1),\n  ntlm-v2(2),\n  digest-md5(3),\n  chap-md5(4),\n  ms-chap-v2(5)\n}\n*/\n\ntypedef struct DigestTypes {\n  unsigned int ntlm_v1:1;\n  unsigned int ntlm_v1_session:1;\n  unsigned int ntlm_v2:1;\n  unsigned int digest_md5:1;\n  unsigned int chap_md5:1;\n  unsigned int ms_chap_v2:1;\n} DigestTypes;\n\n\nint    encode_DigestTypes(unsigned char *, size_t, const DigestTypes *, size_t *);\nint    decode_DigestTypes(const unsigned char *, size_t, DigestTypes *, size_t *);\nvoid   free_DigestTypes  (DigestTypes *);\nsize_t length_DigestTypes(const DigestTypes *);\nint    copy_DigestTypes  (const DigestTypes *, DigestTypes *);\nunsigned DigestTypes2int(DigestTypes);\nDigestTypes int2DigestTypes(unsigned);\n#ifdef __PARSE_UNITS_H__\nconst struct units * asn1_DigestTypes_units(void);\n#endif\n\n\n/*\nDigestInit ::= SEQUENCE {\n  type              UTF8String,\n  channel         [0] SEQUENCE {\n    cb-type             UTF8String,\n    cb-binding          UTF8String,\n  } OPTIONAL,\n  hostname        [1]   UTF8String OPTIONAL,\n}\n*/\n\ntypedef struct DigestInit {\n  heim_utf8_string type;\n  struct  {\n    heim_utf8_string cb_type;\n    heim_utf8_string cb_binding;\n  } *channel;\n  heim_utf8_string *hostname;\n} DigestInit;\n\nint    encode_DigestInit(unsigned char *, size_t, const DigestInit *, size_t *);\nint    decode_DigestInit(const unsigned char *, size_t, DigestInit *, size_t *);\nvoid   free_DigestInit  (DigestInit *);\nsize_t length_DigestInit(const DigestInit *);\nint    copy_DigestInit  (const DigestInit *, DigestInit *);\n\n\n/*\nDigestInitReply ::= SEQUENCE {\n  nonce             UTF8String,\n  opaque            UTF8String,\n  identifier      [0]   UTF8String OPTIONAL,\n}\n*/\n\ntypedef struct DigestInitReply {\n  heim_utf8_string nonce;\n  heim_utf8_string opaque;\n  heim_utf8_string *identifier;\n} DigestInitReply;\n\nint    encode_DigestInitReply(unsigned char *, size_t, const DigestInitReply *, size_t *);\nint    decode_DigestInitReply(const unsigned char *, size_t, DigestInitReply *, size_t *);\nvoid   free_DigestInitReply  (DigestInitReply *);\nsize_t length_DigestInitReply(const DigestInitReply *);\nint    copy_DigestInitReply  (const DigestInitReply *, DigestInitReply *);\n\n\n/*\nDigestRequest ::= SEQUENCE {\n  type                    UTF8String,\n  digest                  UTF8String,\n  username                UTF8String,\n  responseData            UTF8String,\n  authid                [0]   UTF8String OPTIONAL,\n  authentication-user   [1] Principal OPTIONAL,\n  realm                 [2]   UTF8String OPTIONAL,\n  method                [3]   UTF8String OPTIONAL,\n  uri                   [4]   UTF8String OPTIONAL,\n  serverNonce             UTF8String,\n  clientNonce           [5]   UTF8String OPTIONAL,\n  nonceCount            [6]   UTF8String OPTIONAL,\n  qop                   [7]   UTF8String OPTIONAL,\n  identifier            [8]   UTF8String OPTIONAL,\n  hostname              [9]   UTF8String OPTIONAL,\n  opaque                  UTF8String,\n}\n*/\n\ntypedef struct DigestRequest {\n  heim_utf8_string type;\n  heim_utf8_string digest;\n  heim_utf8_string username;\n  heim_utf8_string responseData;\n  heim_utf8_string *authid;\n  Principal *authentication_user;\n  heim_utf8_string *realm;\n  heim_utf8_string *method;\n  heim_utf8_string *uri;\n  heim_utf8_string serverNonce;\n  heim_utf8_string *clientNonce;\n  heim_utf8_string *nonceCount;\n  heim_utf8_string *qop;\n  heim_utf8_string *identifier;\n  heim_utf8_string *hostname;\n  heim_utf8_string opaque;\n} DigestRequest;\n\nint    encode_DigestRequest(unsigned char *, size_t, const DigestRequest *, size_t *);\nint    decode_DigestRequest(const unsigned char *, size_t, DigestRequest *, size_t *);\nvoid   free_DigestRequest  (DigestRequest *);\nsize_t length_DigestRequest(const DigestRequest *);\nint    copy_DigestRequest  (const DigestRequest *, DigestRequest *);\n\n\n/*\nDigestError ::= SEQUENCE {\n  reason            UTF8String,\n  code            INTEGER (-2147483648..2147483647),\n}\n*/\n\ntypedef struct DigestError {\n  heim_utf8_string reason;\n  int code;\n} DigestError;\n\nint    encode_DigestError(unsigned char *, size_t, const DigestError *, size_t *);\nint    decode_DigestError(const unsigned char *, size_t, DigestError *, size_t *);\nvoid   free_DigestError  (DigestError *);\nsize_t length_DigestError(const DigestError *);\nint    copy_DigestError  (const DigestError *, DigestError *);\n\n\n/*\nDigestResponse ::= SEQUENCE {\n  success         BOOLEAN,\n  rsp             [0]   UTF8String OPTIONAL,\n  tickets         [1] SEQUENCE OF OCTET STRING OPTIONAL,\n  channel         [2] SEQUENCE {\n    cb-type             UTF8String,\n    cb-binding          UTF8String,\n  } OPTIONAL,\n  session-key     [3] OCTET STRING OPTIONAL,\n}\n*/\n\ntypedef struct DigestResponse {\n  int success;\n  heim_utf8_string *rsp;\n  struct  {\n    unsigned int len;\n    heim_octet_string *val;\n  } *tickets;\n  struct  {\n    heim_utf8_string cb_type;\n    heim_utf8_string cb_binding;\n  } *channel;\n  heim_octet_string *session_key;\n} DigestResponse;\n\nint    encode_DigestResponse(unsigned char *, size_t, const DigestResponse *, size_t *);\nint    decode_DigestResponse(const unsigned char *, size_t, DigestResponse *, size_t *);\nvoid   free_DigestResponse  (DigestResponse *);\nsize_t length_DigestResponse(const DigestResponse *);\nint    copy_DigestResponse  (const DigestResponse *, DigestResponse *);\n\n\n/*\nNTLMInit ::= SEQUENCE {\n  flags           [0] INTEGER (0..-1),\n  hostname        [1]   UTF8String OPTIONAL,\n  domain          [1]   UTF8String OPTIONAL,\n}\n*/\n\ntypedef struct NTLMInit {\n  unsigned int flags;\n  heim_utf8_string *hostname;\n  heim_utf8_string *domain;\n} NTLMInit;\n\nint    encode_NTLMInit(unsigned char *, size_t, const NTLMInit *, size_t *);\nint    decode_NTLMInit(const unsigned char *, size_t, NTLMInit *, size_t *);\nvoid   free_NTLMInit  (NTLMInit *);\nsize_t length_NTLMInit(const NTLMInit *);\nint    copy_NTLMInit  (const NTLMInit *, NTLMInit *);\n\n\n/*\nNTLMInitReply ::= SEQUENCE {\n  flags           [0] INTEGER (0..-1),\n  opaque          [1] OCTET STRING,\n  targetname      [2]   UTF8String,\n  challange       [3] OCTET STRING,\n  targetinfo      [4] OCTET STRING OPTIONAL,\n}\n*/\n\ntypedef struct NTLMInitReply {\n  unsigned int flags;\n  heim_octet_string opaque;\n  heim_utf8_string targetname;\n  heim_octet_string challange;\n  heim_octet_string *targetinfo;\n} NTLMInitReply;\n\nint    encode_NTLMInitReply(unsigned char *, size_t, const NTLMInitReply *, size_t *);\nint    decode_NTLMInitReply(const unsigned char *, size_t, NTLMInitReply *, size_t *);\nvoid   free_NTLMInitReply  (NTLMInitReply *);\nsize_t length_NTLMInitReply(const NTLMInitReply *);\nint    copy_NTLMInitReply  (const NTLMInitReply *, NTLMInitReply *);\n\n\n/*\nNTLMRequest ::= SEQUENCE {\n  flags           [0] INTEGER (0..-1),\n  opaque          [1] OCTET STRING,\n  username        [2]   UTF8String,\n  targetname      [3]   UTF8String,\n  targetinfo      [4] OCTET STRING OPTIONAL,\n  lm              [5] OCTET STRING,\n  ntlm            [6] OCTET STRING,\n  sessionkey      [7] OCTET STRING OPTIONAL,\n}\n*/\n\ntypedef struct NTLMRequest {\n  unsigned int flags;\n  heim_octet_string opaque;\n  heim_utf8_string username;\n  heim_utf8_string targetname;\n  heim_octet_string *targetinfo;\n  heim_octet_string lm;\n  heim_octet_string ntlm;\n  heim_octet_string *sessionkey;\n} NTLMRequest;\n\nint    encode_NTLMRequest(unsigned char *, size_t, const NTLMRequest *, size_t *);\nint    decode_NTLMRequest(const unsigned char *, size_t, NTLMRequest *, size_t *);\nvoid   free_NTLMRequest  (NTLMRequest *);\nsize_t length_NTLMRequest(const NTLMRequest *);\nint    copy_NTLMRequest  (const NTLMRequest *, NTLMRequest *);\n\n\n/*\nNTLMResponse ::= SEQUENCE {\n  success         [0] BOOLEAN,\n  flags           [1] INTEGER (0..-1),\n  sessionkey      [2] OCTET STRING OPTIONAL,\n  tickets         [3] SEQUENCE OF OCTET STRING OPTIONAL,\n}\n*/\n\ntypedef struct NTLMResponse {\n  int success;\n  unsigned int flags;\n  heim_octet_string *sessionkey;\n  struct  {\n    unsigned int len;\n    heim_octet_string *val;\n  } *tickets;\n} NTLMResponse;\n\nint    encode_NTLMResponse(unsigned char *, size_t, const NTLMResponse *, size_t *);\nint    decode_NTLMResponse(const unsigned char *, size_t, NTLMResponse *, size_t *);\nvoid   free_NTLMResponse  (NTLMResponse *);\nsize_t length_NTLMResponse(const NTLMResponse *);\nint    copy_NTLMResponse  (const NTLMResponse *, NTLMResponse *);\n\n\n/*\nDigestReqInner ::= CHOICE {\n  init             [0] DigestInit,\n  digestRequest    [1] DigestRequest,\n  ntlmInit         [2] NTLMInit,\n  ntlmRequest      [3] NTLMRequest,\n  supportedMechs   [4]   NULL,\n}\n*/\n\ntypedef struct DigestReqInner {\n  enum {\n    choice_DigestReqInner_init = 1,\n    choice_DigestReqInner_digestRequest,\n    choice_DigestReqInner_ntlmInit,\n    choice_DigestReqInner_ntlmRequest,\n    choice_DigestReqInner_supportedMechs\n  } element;\n  union {\n    DigestInit init;\n    DigestRequest digestRequest;\n    NTLMInit ntlmInit;\n    NTLMRequest ntlmRequest;\n    int supportedMechs;\n  } u;\n} DigestReqInner;\n\nint    encode_DigestReqInner(unsigned char *, size_t, const DigestReqInner *, size_t *);\nint    decode_DigestReqInner(const unsigned char *, size_t, DigestReqInner *, size_t *);\nvoid   free_DigestReqInner  (DigestReqInner *);\nsize_t length_DigestReqInner(const DigestReqInner *);\nint    copy_DigestReqInner  (const DigestReqInner *, DigestReqInner *);\n\n\n/*\nDigestREQ ::= [APPLICATION 128] SEQUENCE {\n  apReq           [0] OCTET STRING,\n  innerReq        [1] EncryptedData,\n}\n*/\n\ntypedef struct DigestREQ {\n  heim_octet_string apReq;\n  EncryptedData innerReq;\n} DigestREQ;\n\nint    encode_DigestREQ(unsigned char *, size_t, const DigestREQ *, size_t *);\nint    decode_DigestREQ(const unsigned char *, size_t, DigestREQ *, size_t *);\nvoid   free_DigestREQ  (DigestREQ *);\nsize_t length_DigestREQ(const DigestREQ *);\nint    copy_DigestREQ  (const DigestREQ *, DigestREQ *);\n\n\n/*\nDigestRepInner ::= CHOICE {\n  error            [0] DigestError,\n  initReply        [1] DigestInitReply,\n  response         [2] DigestResponse,\n  ntlmInitReply    [3] NTLMInitReply,\n  ntlmResponse     [4] NTLMResponse,\n  supportedMechs   [5] DigestTypes,\n  ...,\n}\n*/\n\ntypedef struct DigestRepInner {\n  enum {\n    choice_DigestRepInner_asn1_ellipsis = 0,\n    choice_DigestRepInner_error,\n    choice_DigestRepInner_initReply,\n    choice_DigestRepInner_response,\n    choice_DigestRepInner_ntlmInitReply,\n    choice_DigestRepInner_ntlmResponse,\n    choice_DigestRepInner_supportedMechs\n    /* ... */\n  } element;\n  union {\n    DigestError error;\n    DigestInitReply initReply;\n    DigestResponse response;\n    NTLMInitReply ntlmInitReply;\n    NTLMResponse ntlmResponse;\n    DigestTypes supportedMechs;\n    heim_octet_string asn1_ellipsis;\n  } u;\n} DigestRepInner;\n\nint    encode_DigestRepInner(unsigned char *, size_t, const DigestRepInner *, size_t *);\nint    decode_DigestRepInner(const unsigned char *, size_t, DigestRepInner *, size_t *);\nvoid   free_DigestRepInner  (DigestRepInner *);\nsize_t length_DigestRepInner(const DigestRepInner *);\nint    copy_DigestRepInner  (const DigestRepInner *, DigestRepInner *);\n\n\n/*\nDigestREP ::= [APPLICATION 129] SEQUENCE {\n  apRep           [0] OCTET STRING,\n  innerRep        [1] EncryptedData,\n}\n*/\n\ntypedef struct DigestREP {\n  heim_octet_string apRep;\n  EncryptedData innerRep;\n} DigestREP;\n\nint    encode_DigestREP(unsigned char *, size_t, const DigestREP *, size_t *);\nint    decode_DigestREP(const unsigned char *, size_t, DigestREP *, size_t *);\nvoid   free_DigestREP  (DigestREP *);\nsize_t length_DigestREP(const DigestREP *);\nint    copy_DigestREP  (const DigestREP *, DigestREP *);\n\n\n#endif /* __digest_asn1_h__ */\n"
  },
  {
    "path": "freebsd-headers/dirent.h",
    "content": "/*-\n * Copyright (c) 1989, 1993\n *\tThe Regents of the University of California.  All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t@(#)dirent.h\t8.2 (Berkeley) 7/28/94\n * $FreeBSD: release/9.0.0/include/dirent.h 203964 2010-02-16 19:39:50Z imp $\n */\n\n#ifndef _DIRENT_H_\n#define _DIRENT_H_\n\n/*\n * The kernel defines the format of directory entries returned by\n * the getdirentries(2) system call.\n */\n#include <sys/cdefs.h>\n#include <sys/dirent.h>\n\n#if __BSD_VISIBLE || __XSI_VISIBLE\n/*\n * XXX this is probably illegal in the __XSI_VISIBLE case, but brings us closer\n * to the specification.\n */\n#define\td_ino\t\td_fileno\t/* backward and XSI compatibility */\n#endif\n\n#if __BSD_VISIBLE\n\n#include <sys/_null.h>\n\n/* definitions for library routines operating on directories. */\n#define\tDIRBLKSIZ\t1024\n\nstruct _telldir;\t\t/* see telldir.h */\nstruct pthread_mutex;\n\n/* structure describing an open directory. */\ntypedef struct _dirdesc {\n\tint\tdd_fd;\t\t/* file descriptor associated with directory */\n\tlong\tdd_loc;\t\t/* offset in current buffer */\n\tlong\tdd_size;\t/* amount of data returned by getdirentries */\n\tchar\t*dd_buf;\t/* data buffer */\n\tint\tdd_len;\t\t/* size of data buffer */\n\tlong\tdd_seek;\t/* magic cookie returned by getdirentries */\n\tlong\tdd_rewind;\t/* magic cookie for rewinding */\n\tint\tdd_flags;\t/* flags for readdir */\n\tstruct pthread_mutex\t*dd_lock;\t/* lock */\n\tstruct _telldir *dd_td;\t/* telldir position recording */\n} DIR;\n\n#define\tdirfd(dirp)\t((dirp)->dd_fd)\n\n/* flags for opendir2 */\n#define DTF_HIDEW\t0x0001\t/* hide whiteout entries */\n#define DTF_NODUP\t0x0002\t/* don't return duplicate names */\n#define DTF_REWIND\t0x0004\t/* rewind after reading union stack */\n#define __DTF_READALL\t0x0008\t/* everything has been read */\n\n#else /* !__BSD_VISIBLE */\n\ntypedef\tvoid *\tDIR;\n\n#endif /* __BSD_VISIBLE */\n\n#ifndef _KERNEL\n\n__BEGIN_DECLS\n#if __POSIX_VISIBLE >= 200809 || __XSI_VISIBLE >= 700\nint\t alphasort(const struct dirent **, const struct dirent **);\n#endif\n#if __BSD_VISIBLE\nDIR\t*__opendir2(const char *, int);\nint\t getdents(int, char *, int);\nint\t getdirentries(int, char *, int, long *);\n#endif\nDIR\t*opendir(const char *);\nDIR\t*fdopendir(int);\nstruct dirent *\n\t readdir(DIR *);\n#if __POSIX_VISIBLE >= 199506 || __XSI_VISIBLE >= 500\nint\t readdir_r(DIR *, struct dirent *, struct dirent **);\n#endif\nvoid\t rewinddir(DIR *);\n#if __POSIX_VISIBLE >= 200809 || __XSI_VISIBLE >= 700\nint\t scandir(const char *, struct dirent ***,\n\t    int (*)(const struct dirent *), int (*)(const struct dirent **,\n\t    const struct dirent **));\n#endif\n#if __XSI_VISIBLE\nvoid\t seekdir(DIR *, long);\nlong\t telldir(DIR *);\n#endif\nint\t closedir(DIR *);\n__END_DECLS\n\n#endif /* !_KERNEL */\n\n#endif /* !_DIRENT_H_ */\n"
  },
  {
    "path": "freebsd-headers/dlfcn.h",
    "content": "/*-\n * Copyright (c) 1994\n *\tThe Regents of the University of California.  All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/include/dlfcn.h 205606 2010-03-24 15:59:51Z gahr $\n */\n\n#ifndef _DLFCN_H_\n#define\t_DLFCN_H_\n\n#include <sys/_types.h>\n\n/*\n * Modes and flags for dlopen().\n */\n#define\tRTLD_LAZY\t1\t/* Bind function calls lazily. */\n#define\tRTLD_NOW\t2\t/* Bind function calls immediately. */\n#define\tRTLD_MODEMASK\t0x3\n#define\tRTLD_GLOBAL\t0x100\t/* Make symbols globally available. */\n#define\tRTLD_LOCAL\t0\t/* Opposite of RTLD_GLOBAL, and the default. */\n#define\tRTLD_TRACE\t0x200\t/* Trace loaded objects and exit. */\n#define\tRTLD_NODELETE\t0x01000\t/* Do not remove members. */\n#define\tRTLD_NOLOAD\t0x02000\t/* Do not load if not already loaded. */\n\n/*\n * Request arguments for dlinfo().\n */\n#define\tRTLD_DI_LINKMAP\t\t2\t/* Obtain link map. */\n#define\tRTLD_DI_SERINFO\t\t4\t/* Obtain search path info. */\n#define\tRTLD_DI_SERINFOSIZE\t5\t/*  ... query for required space. */\n#define\tRTLD_DI_ORIGIN\t\t6\t/* Obtain object origin */\n#define\tRTLD_DI_MAX\t\tRTLD_DI_ORIGIN\n\n/*\n * Special handle arguments for dlsym()/dlinfo().\n */\n#define\tRTLD_NEXT\t((void *) -1)\t/* Search subsequent objects. */\n#define\tRTLD_DEFAULT\t((void *) -2)\t/* Use default search algorithm. */\n#define\tRTLD_SELF\t((void *) -3)\t/* Search the caller itself. */\n\n#if __BSD_VISIBLE\n\n#ifndef\t_SIZE_T_DECLARED\ntypedef __size_t        size_t;\n#define\t_SIZE_T_DECLARED\n#endif\n\n/*\n * Structure filled in by dladdr().\n */\ntypedef\tstruct dl_info {\n\tconst char\t*dli_fname;\t/* Pathname of shared object. */\n\tvoid\t\t*dli_fbase;\t/* Base address of shared object. */\n\tconst char\t*dli_sname;\t/* Name of nearest symbol. */\n\tvoid\t\t*dli_saddr;\t/* Address of nearest symbol. */\n} Dl_info;\n\n/*-\n * The actual type declared by this typedef is immaterial, provided that\n * it is a function pointer.  Its purpose is to provide a return type for\n * dlfunc() which can be cast to a function pointer type without depending\n * on behavior undefined by the C standard, which might trigger a compiler\n * diagnostic.  We intentionally declare a unique type signature to force\n * a diagnostic should the application not cast the return value of dlfunc()\n * appropriately.\n */\nstruct __dlfunc_arg {\n\tint\t__dlfunc_dummy;\n};\n\ntypedef\tvoid (*dlfunc_t)(struct __dlfunc_arg);\n\n/*\n * Structures, returned by the RTLD_DI_SERINFO dlinfo() request.\n */\ntypedef struct dl_serpath {\n\tchar *\t\tdls_name;\t/* single search path entry */\n\tunsigned int\tdls_flags;\t/* path information */\n} Dl_serpath;\n\ntypedef struct  dl_serinfo {\n        size_t\t\tdls_size;       /* total buffer size */\n        unsigned int\tdls_cnt;        /* number of path entries */\n        Dl_serpath\tdls_serpath[1]; /* there may be more than one */\n} Dl_serinfo;\n\n#endif /* __BSD_VISIBLE */\n\n__BEGIN_DECLS\n/* XSI functions first. */\nint\t dlclose(void *);\nchar\t*dlerror(void);\nvoid\t*dlopen(const char *, int);\nvoid\t*dlsym(void * __restrict, const char * __restrict);\n\n#if __BSD_VISIBLE\nint\t dladdr(const void * __restrict, Dl_info * __restrict);\ndlfunc_t dlfunc(void * __restrict, const char * __restrict);\nint\t dlinfo(void * __restrict, int, void * __restrict);\nvoid\t dllockinit(void *_context,\n\t    void *(*_lock_create)(void *_context),\n\t    void (*_rlock_acquire)(void *_lock),\n\t    void (*_wlock_acquire)(void *_lock),\n\t    void (*_lock_release)(void *_lock),\n\t    void (*_lock_destroy)(void *_lock),\n\t    void (*_context_destroy)(void *_context));\nvoid\t*dlvsym(void * __restrict, const char * __restrict,\n\t    const char * __restrict);\n#endif /* __BSD_VISIBLE */\n__END_DECLS\n\n#endif /* !_DLFCN_H_ */\n"
  },
  {
    "path": "freebsd-headers/dlg_colors.h",
    "content": "/*\n *  $Id: dlg_colors.h,v 1.16 2011/01/17 00:20:32 tom Exp $\n *\n *  colors.h -- color attribute definitions\n *\n *  Copyright 2000-2007,2011\tThomas E. Dickey\n *\n *  This program is free software; you can redistribute it and/or modify\n *  it under the terms of the GNU Lesser General Public License, version 2.1\n *  as published by the Free Software Foundation.\n *\n *  This program is distributed in the hope that it will be useful, but\n *  WITHOUT ANY WARRANTY; without even the implied warranty of\n *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n *  Lesser General Public License for more details.\n *\n *  You should have received a copy of the GNU Lesser General Public\n *  License along with this program; if not, write to\n *\tFree Software Foundation, Inc.\n *\t51 Franklin St., Fifth Floor\n *\tBoston, MA 02110, USA.\n *\n *  An earlier version of this program lists as authors\n *\tSavio Lam (lam836@cs.cuhk.hk)\n */\n\n#ifndef COLORS_H_included\n#define COLORS_H_included 1\n\n#include <dialog.h>\n\n/*\n *   Default color definitions (DLGC means \"Dialog Color\")\n *\n *   DLGC_FG_xxx = foreground for \"xxx\"\n *   DLGC_BG_xxx = background for \"xxx\"\n *   DLGC_HL_xxx = highlight for \"xxx\"\n */\n#define DLGC_FG_SCREEN                 COLOR_CYAN\n#define DLGC_BG_SCREEN                 COLOR_BLUE\n#define DLGC_HL_SCREEN                 TRUE\n\n#define DLGC_FG_SHADOW                 COLOR_BLACK\n#define DLGC_BG_SHADOW                 COLOR_BLACK\n#define DLGC_HL_SHADOW                 TRUE\n\n#define DLGC_FG_DIALOG                 COLOR_BLACK\n#define DLGC_BG_DIALOG                 COLOR_WHITE\n#define DLGC_HL_DIALOG                 FALSE\n\n#define DLGC_FG_TITLE                  COLOR_BLUE\n#define DLGC_BG_TITLE                  COLOR_WHITE\n#define DLGC_HL_TITLE                  TRUE\n\n#define DLGC_FG_BORDER                 COLOR_WHITE\n#define DLGC_BG_BORDER                 COLOR_WHITE\n#define DLGC_HL_BORDER                 TRUE\n\n#define DLGC_FG_BUTTON_ACTIVE          COLOR_WHITE\n#define DLGC_BG_BUTTON_ACTIVE          COLOR_BLUE\n#define DLGC_HL_BUTTON_ACTIVE          TRUE\n\n#define DLGC_FG_BUTTON_INACTIVE        COLOR_BLACK\n#define DLGC_BG_BUTTON_INACTIVE        COLOR_WHITE\n#define DLGC_HL_BUTTON_INACTIVE        FALSE\n\n#define DLGC_FG_BUTTON_KEY_ACTIVE      COLOR_WHITE\n#define DLGC_BG_BUTTON_KEY_ACTIVE      COLOR_BLUE\n#define DLGC_HL_BUTTON_KEY_ACTIVE      TRUE\n\n#define DLGC_FG_BUTTON_KEY_INACTIVE    COLOR_RED\n#define DLGC_BG_BUTTON_KEY_INACTIVE    COLOR_WHITE\n#define DLGC_HL_BUTTON_KEY_INACTIVE    FALSE\n\n#define DLGC_FG_BUTTON_LABEL_ACTIVE    COLOR_YELLOW\n#define DLGC_BG_BUTTON_LABEL_ACTIVE    COLOR_BLUE\n#define DLGC_HL_BUTTON_LABEL_ACTIVE    TRUE\n\n#define DLGC_FG_BUTTON_LABEL_INACTIVE  COLOR_BLACK\n#define DLGC_BG_BUTTON_LABEL_INACTIVE  COLOR_WHITE\n#define DLGC_HL_BUTTON_LABEL_INACTIVE  TRUE\n\n#define DLGC_FG_FORM_ITEM_READONLY     COLOR_CYAN\n#define DLGC_BG_FORM_ITEM_READONLY     COLOR_WHITE\n#define DLGC_HL_FORM_ITEM_READONLY     TRUE\n\n#define DLGC_FG_INPUTBOX               COLOR_BLACK\n#define DLGC_BG_INPUTBOX               COLOR_WHITE\n#define DLGC_HL_INPUTBOX               FALSE\n\n#define DLGC_FG_INPUTBOX_BORDER        COLOR_BLACK\n#define DLGC_BG_INPUTBOX_BORDER        COLOR_WHITE\n#define DLGC_HL_INPUTBOX_BORDER        FALSE\n\n#define DLGC_FG_SEARCHBOX              COLOR_BLACK\n#define DLGC_BG_SEARCHBOX              COLOR_WHITE\n#define DLGC_HL_SEARCHBOX              FALSE\n\n#define DLGC_FG_SEARCHBOX_TITLE        COLOR_BLUE\n#define DLGC_BG_SEARCHBOX_TITLE        COLOR_WHITE\n#define DLGC_HL_SEARCHBOX_TITLE        TRUE\n\n#define DLGC_FG_SEARCHBOX_BORDER       COLOR_WHITE\n#define DLGC_BG_SEARCHBOX_BORDER       COLOR_WHITE\n#define DLGC_HL_SEARCHBOX_BORDER       TRUE\n\n#define DLGC_FG_POSITION_INDICATOR     COLOR_BLUE\n#define DLGC_BG_POSITION_INDICATOR     COLOR_WHITE\n#define DLGC_HL_POSITION_INDICATOR     TRUE\n\n#define DLGC_FG_MENUBOX                COLOR_BLACK\n#define DLGC_BG_MENUBOX                COLOR_WHITE\n#define DLGC_HL_MENUBOX                FALSE\n\n#define DLGC_FG_MENUBOX_BORDER         COLOR_WHITE\n#define DLGC_BG_MENUBOX_BORDER         COLOR_WHITE\n#define DLGC_HL_MENUBOX_BORDER         TRUE\n\n#define DLGC_FG_ITEM                   COLOR_BLACK\n#define DLGC_BG_ITEM                   COLOR_WHITE\n#define DLGC_HL_ITEM                   FALSE\n\n#define DLGC_FG_ITEM_SELECTED          COLOR_WHITE\n#define DLGC_BG_ITEM_SELECTED          COLOR_BLUE\n#define DLGC_HL_ITEM_SELECTED          TRUE\n\n#define DLGC_FG_TAG                    COLOR_BLUE\n#define DLGC_BG_TAG                    COLOR_WHITE\n#define DLGC_HL_TAG                    TRUE\n\n#define DLGC_FG_TAG_SELECTED           COLOR_YELLOW\n#define DLGC_BG_TAG_SELECTED           COLOR_BLUE\n#define DLGC_HL_TAG_SELECTED           TRUE\n\n#define DLGC_FG_TAG_KEY                COLOR_RED\n#define DLGC_BG_TAG_KEY                COLOR_WHITE\n#define DLGC_HL_TAG_KEY                FALSE\n\n#define DLGC_FG_TAG_KEY_SELECTED       COLOR_RED\n#define DLGC_BG_TAG_KEY_SELECTED       COLOR_BLUE\n#define DLGC_HL_TAG_KEY_SELECTED       TRUE\n\n#define DLGC_FG_CHECK                  COLOR_BLACK\n#define DLGC_BG_CHECK                  COLOR_WHITE\n#define DLGC_HL_CHECK                  FALSE\n\n#define DLGC_FG_CHECK_SELECTED         COLOR_WHITE\n#define DLGC_BG_CHECK_SELECTED         COLOR_BLUE\n#define DLGC_HL_CHECK_SELECTED         TRUE\n\n#define DLGC_FG_UARROW                 COLOR_GREEN\n#define DLGC_BG_UARROW                 COLOR_WHITE\n#define DLGC_HL_UARROW                 TRUE\n\n#define DLGC_FG_DARROW                 COLOR_GREEN\n#define DLGC_BG_DARROW                 COLOR_WHITE\n#define DLGC_HL_DARROW                 TRUE\n\n#define DLGC_FG_ITEMHELP               COLOR_WHITE\n#define DLGC_BG_ITEMHELP               COLOR_BLACK\n#define DLGC_HL_ITEMHELP               FALSE\n\n#define DLGC_FG_FORM_ACTIVE_TEXT       COLOR_WHITE\n#define DLGC_BG_FORM_ACTIVE_TEXT       COLOR_BLUE\n#define DLGC_HL_FORM_ACTIVE_TEXT       TRUE\n\n#define DLGC_FG_FORM_TEXT              COLOR_WHITE\n#define DLGC_BG_FORM_TEXT              COLOR_CYAN\n#define DLGC_HL_FORM_TEXT              TRUE\n\n#define DLGC_FG_GAUGE                  COLOR_BLUE\n#define DLGC_BG_GAUGE                  COLOR_WHITE\n#define DLGC_HL_GAUGE                  TRUE\n\n/* End of default color definitions */\n\n/*\n * Global variables\n */\n\ntypedef struct {\n    const char *name;\n    int value;\n} color_names_st;\n\n#endif /* COLORS_H_included */\n"
  },
  {
    "path": "freebsd-headers/dlg_config.h",
    "content": "/* dlg_config.h.  Generated automatically by configure.  */\n/*\n * The configure script expands this as a set of definitions\n *\n * $FreeBSD: release/9.0.0/gnu/lib/libdialog/dlg_config.h 218331 2011-02-05 16:23:32Z nwhitehorn $\n */\n\n#define DIALOG_PATCHDATE 20100428\n#define DIALOG_VERSION \"1.1\"\n#define HAVE_ALLOCA 1\n#define HAVE_COLOR 1\n#define HAVE_DIRENT_H 1\n#define HAVE_DLG_FORMBOX 1\n#define HAVE_DLG_GAUGE 1\n#define HAVE_DLG_MIXEDFORM 1\n#define HAVE_DLG_TAILBOX 1\n#define HAVE_DLG_TRACE 1\n#define HAVE_FEOF_UNLOCKED 1\n#define HAVE_FLUSHINP 1\n#define HAVE_FSEEKO 1\n#define HAVE_GETBEGX 1\n#define HAVE_GETBEGY 1\n#define HAVE_GETBEGYX 1\n#define HAVE_GETCURX 1\n#define HAVE_GETCURY 1\n#define HAVE_GETCWD 1\n#define HAVE_GETEGID 1\n#define HAVE_GETEUID 1\n#define HAVE_GETGID 1\n#define HAVE_GETMAXX 1\n#define HAVE_GETMAXY 1\n#define HAVE_GETMAXYX 1\n#define HAVE_GETPAGESIZE 1\n#define HAVE_GETPARX 1\n#define HAVE_GETPARY 1\n#define HAVE_GETPARYX 1\n#define HAVE_GETUID 1\n#define HAVE_ICONV 1\n#define HAVE_INTTYPES_H 1\n#define HAVE_LANGINFO_CODESET 1\n#define HAVE_LC_MESSAGES 1\n#define HAVE_LIBNCURSESW 1\n#define HAVE_LIMITS_H 1\n#define HAVE_LOCALE_H 1\n#define HAVE_MBSTATE_T 1\n#define HAVE_MEMORY_H 1\n#define HAVE_MIXEDGAUGE 1\n#define HAVE_MMAP 1\n#define HAVE_MUNMAP 1\n#define HAVE_NL_TYPES_H 1\n#define HAVE_PUTENV 1\n#define HAVE_RC_FILE 1\n#define HAVE_SEARCH_H 1\n#define HAVE_SETENV 1\n#define HAVE_SETLOCALE 1\n#define HAVE_STDDEF_H 1\n#define HAVE_STDINT_H 1\n#define HAVE_STDLIB_H 1\n#define HAVE_STPCPY 1\n#define HAVE_STRCASECMP 1\n#define HAVE_STRCHR 1\n#define HAVE_STRDUP 1\n#define HAVE_STRFTIME 1\n#define HAVE_STRINGS_H 1\n#define HAVE_STRING_H 1\n#define HAVE_STRTOUL 1\n#define HAVE_SYS_PARAM_H 1\n#define HAVE_SYS_STAT_H 1\n#define HAVE_SYS_TYPES_H 1\n#define HAVE_SYS_WAIT_H 1\n#define HAVE_TERM_H 1\n#define HAVE_TSEARCH 1\n#define HAVE_TYPE_CHTYPE 1\n#define HAVE_UNCTRL_H 1\n#define HAVE_UNISTD_H 1\n#define HAVE_USE_DEFAULT_COLORS 1\n#define HAVE_WAITPID 1\n#define HAVE_WGET_WCH 1\n#define HAVE_XDIALOG 1\n#define HAVE__NC_FREE_AND_EXIT 1\n#define ICONV_CONST const\n#define MIXEDCASE_FILENAMES 1\n#define NCURSES 1\n#define NEED_WCHAR_H 1\n#define PACKAGE \"dialog\"\n#define RETSIGTYPE void\n#define STDC_HEADERS 1\n#define SYSTEM_NAME \"freebsd9.0\"\n#define TIME_WITH_SYS_TIME 1\n#define TYPE_CHTYPE_IS_SCALAR 1\n#define USE_WIDE_CURSES 1\n"
  },
  {
    "path": "freebsd-headers/dlg_keys.h",
    "content": "/*\n *  $Id: dlg_keys.h,v 1.26 2011/06/21 22:09:22 tom Exp $\n *\n *  dlg_keys.h -- runtime binding support for dialog\n *\n *  Copyright 2005-2010,2011 Thomas E.  Dickey\n *\n *  This program is free software; you can redistribute it and/or modify\n *  it under the terms of the GNU Lesser General Public License, version 2.1\n *  as published by the Free Software Foundation.\n *\n *  This program is distributed in the hope that it will be useful, but\n *  WITHOUT ANY WARRANTY; without even the implied warranty of\n *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n *  Lesser General Public License for more details.\n *\n *  You should have received a copy of the GNU Lesser General Public\n *  License along with this program; if not, write to\n *\tFree Software Foundation, Inc.\n *\t51 Franklin St., Fifth Floor\n *\tBoston, MA 02110, USA.\n */\n\n#ifndef DLG_KEYS_H_included\n#define DLG_KEYS_H_included 1\n\n#include <dialog.h>\n\n#ifdef USE_WIDE_CURSES\n#include <wctype.h>\n#define dlg_toupper(ch) towupper((wint_t)ch)\n#define dlg_isupper(ch) iswupper((wint_t)ch)\n#else\n#define dlg_toupper(ch) toupper(ch)\n#define dlg_isupper(ch) (isalpha(ch) && isupper(ch))\n#endif\n\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\ntypedef struct {\n    int is_function_key;\n    int\tcurses_key;\n    int dialog_key;\n} DLG_KEYS_BINDING;\n\n#define DLG_KEYS_DATA(dialog, curses)  { curses >= KEY_MIN, curses, dialog }\n\n#define END_KEYS_BINDING { -1, 0, 0 }\n\n/*\n * Define dialog's internal function-keys past the range used by curses.\n */\ntypedef enum {\n    DLGK_MIN = KEY_MAX + 1,\n    /* predefined buttons */\n    DLGK_OK,\n    DLGK_CANCEL,\n    DLGK_EXTRA,\n    DLGK_HELP,\n    DLGK_ESC,\n    /* moving from screen to screen (pages) */\n    DLGK_PAGE_FIRST,\n    DLGK_PAGE_LAST,\n    DLGK_PAGE_NEXT,\n    DLGK_PAGE_PREV,\n    /* moving within a list */\n    DLGK_ITEM_FIRST,\n    DLGK_ITEM_LAST,\n    DLGK_ITEM_NEXT,\n    DLGK_ITEM_PREV,\n    /* moving from field to field (or buttons) */\n    DLGK_FIELD_FIRST,\n    DLGK_FIELD_LAST,\n    DLGK_FIELD_NEXT,\n    DLGK_FIELD_PREV,\n    /* moving within a grid */\n    DLGK_GRID_UP,\n    DLGK_GRID_DOWN,\n    DLGK_GRID_LEFT,\n    DLGK_GRID_RIGHT,\n    /* delete */\n    DLGK_DELETE_LEFT,\n    DLGK_DELETE_RIGHT,\n    DLGK_DELETE_ALL,\n    /* special */\n    DLGK_ENTER,\n    DLGK_BEGIN,\n    DLGK_FINAL,\n    DLGK_SELECT,\n    DLGK_HELPFILE,\n    DLGK_TRACE\n} DLG_KEYS_ENUM;\n\n#define is_DLGK_MOUSE(code)\t((code) >= M_EVENT)\n#define DLGK_MOUSE(code)\t((code) + M_EVENT)\n\n#define HELPKEY_BINDINGS \\\n\tDLG_KEYS_DATA( DLGK_HELPFILE,\t   CHR_HELP ), \\\n\tDLG_KEYS_DATA( DLGK_HELPFILE,\t   KEY_F(1) ), \\\n\tDLG_KEYS_DATA( DLGK_HELPFILE,\t   KEY_HELP )\n\n#define ENTERKEY_BINDINGS \\\n\tDLG_KEYS_DATA( DLGK_ENTER,\t   '\\n' ), \\\n\tDLG_KEYS_DATA( DLGK_ENTER,\t   '\\r' ), \\\n\tDLG_KEYS_DATA( DLGK_ENTER,\t   KEY_ENTER )\n\n/* ^U == 21 */\n#define INPUTSTR_BINDINGS \\\n\tDLG_KEYS_DATA( DLGK_BEGIN,\t   KEY_HOME ), \\\n\tDLG_KEYS_DATA( DLGK_DELETE_ALL,    CHR_KILL ), \\\n\tDLG_KEYS_DATA( DLGK_DELETE_LEFT,   CHR_BACKSPACE ), \\\n\tDLG_KEYS_DATA( DLGK_DELETE_LEFT,   KEY_BACKSPACE ), \\\n\tDLG_KEYS_DATA( DLGK_DELETE_RIGHT,  CHR_DELETE ), \\\n\tDLG_KEYS_DATA( DLGK_DELETE_RIGHT,  KEY_DC ), \\\n\tDLG_KEYS_DATA( DLGK_FINAL,\t   KEY_END ), \\\n\tDLG_KEYS_DATA( DLGK_GRID_LEFT,\t   KEY_LEFT ), \\\n\tDLG_KEYS_DATA( DLGK_GRID_RIGHT,\t   KEY_RIGHT )\n\n#define SCROLLKEY_BINDINGS \\\n\tDLG_KEYS_DATA( DLGK_GRID_DOWN,\t'J' ), \\\n\tDLG_KEYS_DATA( DLGK_GRID_DOWN,\t'j' ), \\\n\tDLG_KEYS_DATA( DLGK_GRID_DOWN,\tKEY_DOWN ), \\\n\tDLG_KEYS_DATA( DLGK_GRID_UP,\t'K' ), \\\n\tDLG_KEYS_DATA( DLGK_GRID_UP,\t'k' ), \\\n\tDLG_KEYS_DATA( DLGK_GRID_UP,\tKEY_UP ), \\\n\tDLG_KEYS_DATA( DLGK_PAGE_FIRST,\t'g' ), \\\n\tDLG_KEYS_DATA( DLGK_PAGE_FIRST,\tKEY_HOME ), \\\n\tDLG_KEYS_DATA( DLGK_PAGE_LAST,\t'G' ), \\\n\tDLG_KEYS_DATA( DLGK_PAGE_LAST,\tKEY_END ), \\\n\tDLG_KEYS_DATA( DLGK_PAGE_NEXT,\t'F' ), \\\n\tDLG_KEYS_DATA( DLGK_PAGE_NEXT,\t'f' ), \\\n\tDLG_KEYS_DATA( DLGK_PAGE_NEXT,\tKEY_NPAGE ), \\\n\tDLG_KEYS_DATA( DLGK_PAGE_PREV,\t'B' ), \\\n\tDLG_KEYS_DATA( DLGK_PAGE_PREV,\t'b' ), \\\n\tDLG_KEYS_DATA( DLGK_PAGE_PREV,\tKEY_PPAGE )\n\nextern int dlg_lookup_key(WINDOW * /*win*/, int /*curses_key*/, int * /*dialog_key*/);\nextern int dlg_result_key(int /*dialog_key*/, int /*fkey*/, int * /*resultp*/);\nextern void dlg_register_buttons(WINDOW * /*win*/, const char * /*name*/, const char ** /*buttons*/);\nextern void dlg_register_window(WINDOW * /*win*/, const char * /*name*/, DLG_KEYS_BINDING * /*binding*/);\nextern void dlg_unregister_window(WINDOW * /*win*/);\n\n#ifdef HAVE_RC_FILE\nextern int dlg_parse_bindkey(char * /*params*/);\nextern void dlg_dump_keys(FILE * /*fp*/);\n#endif\n\n#ifdef __cplusplus\n}\n#endif\n\n#endif /* DLG_KEYS_H_included */\n"
  },
  {
    "path": "freebsd-headers/dwarf.h",
    "content": "/*-\n * Copyright (c) 2007 John Birrell (jb@freebsd.org)\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *notice, this list of conditions and the following disclaimer in the\n *documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/lib/libdwarf/dwarf.h 179187 2008-05-22 02:14:23Z jb $\n */\n\n#ifndef\t_DWARF_H_\n#define\t_DWARF_H_\n\n#define DW_TAG_array_type\t\t0x01\n#define DW_TAG_class_type\t\t0x02\n#define DW_TAG_entry_point\t\t0x03\n#define DW_TAG_enumeration_type\t\t0x04\n#define DW_TAG_formal_parameter\t\t0x05\n#define DW_TAG_imported_declaration\t0x08\n#define DW_TAG_label\t\t\t0x0a\n#define DW_TAG_lexical_block\t\t0x0b\n#define DW_TAG_member\t\t\t0x0d\n#define DW_TAG_pointer_type\t\t0x0f\n#define DW_TAG_reference_type\t\t0x10\n#define DW_TAG_compile_unit\t\t0x11\n#define DW_TAG_string_type\t\t0x12\n#define DW_TAG_structure_type\t\t0x13\n#define DW_TAG_subroutine_type\t\t0x15\n#define DW_TAG_typedef\t\t\t0x16\n#define DW_TAG_union_type\t\t0x17\n#define DW_TAG_unspecified_parameters\t0x18\n#define DW_TAG_variant\t\t\t0x19\n#define DW_TAG_common_block\t\t0x1a\n#define DW_TAG_common_inclusion\t\t0x1b\n#define DW_TAG_inheritance\t\t0x1c\n#define DW_TAG_inlined_subroutine\t0x1d\n#define DW_TAG_module\t\t\t0x1e\n#define DW_TAG_ptr_to_member_type\t0x1f\n#define DW_TAG_set_type\t\t\t0x20\n#define DW_TAG_subrange_type\t\t0x21\n#define DW_TAG_with_stmt\t\t0x22\n#define DW_TAG_access_declaration\t0x23\n#define DW_TAG_base_type\t\t0x24\n#define DW_TAG_catch_block\t\t0x25\n#define DW_TAG_const_type\t\t0x26\n#define DW_TAG_constant\t\t\t0x27\n#define DW_TAG_enumerator\t\t0x28\n#define DW_TAG_friend\t\t\t0x2a\n#define DW_TAG_namelist\t\t\t0x2b\n#define DW_TAG_namelist_item\t\t0x2c\n#define DW_TAG_packed_type\t\t0x2d\n#define DW_TAG_subprogram\t\t0x2e\n#define DW_TAG_template_type_parameter\t0x2f\n#define DW_TAG_template_type_param\t0x2f\n#define DW_TAG_template_value_parameter\t0x30\n#define DW_TAG_template_value_param\t0x30\n#define DW_TAG_thrown_type\t\t0x31\n#define DW_TAG_try_block\t\t0x32\n#define DW_TAG_variant_part\t\t0x33\n#define DW_TAG_variable\t\t\t0x34\n#define DW_TAG_volatile_type\t\t0x35\n#define DW_TAG_dwarf_procedure          0x36\n#define DW_TAG_restrict_type            0x37\n#define DW_TAG_interface_type           0x38\n#define DW_TAG_namespace                0x39\n#define DW_TAG_imported_module          0x3a\n#define DW_TAG_unspecified_type         0x3b\n#define DW_TAG_partial_unit             0x3c\n#define DW_TAG_imported_unit            0x3d\n#define DW_TAG_condition                0x3f\n#define DW_TAG_shared_type              0x40\n\n#define DW_TAG_lo_user\t\t\t0x4080\n\n#define DW_TAG_hi_user\t\t\t0xffff\n\n#define DW_CHILDREN_no\t\t\t0x00\n#define DW_CHILDREN_yes\t\t\t0x01\n\n#define DW_AT_sibling\t\t\t0x01\n#define DW_AT_location\t\t\t0x02\n#define DW_AT_name\t\t\t0x03\n#define DW_AT_ordering\t\t\t0x09\n#define DW_AT_subscr_data\t\t0x0a\n#define DW_AT_byte_size\t\t\t0x0b\n#define DW_AT_bit_offset\t\t0x0c\n#define DW_AT_bit_size\t\t\t0x0d\n#define DW_AT_element_list\t\t0x0f\n#define DW_AT_stmt_list\t\t\t0x10\n#define DW_AT_low_pc\t\t\t0x11\n#define DW_AT_high_pc\t\t\t0x12\n#define DW_AT_language\t\t\t0x13\n#define DW_AT_member\t\t\t0x14\n#define DW_AT_discr\t\t\t0x15\n#define DW_AT_discr_value\t\t0x16\n#define DW_AT_visibility\t\t0x17\n#define DW_AT_import\t\t\t0x18\n#define DW_AT_string_length\t\t0x19\n#define DW_AT_common_reference\t\t0x1a\n#define DW_AT_comp_dir\t\t\t0x1b\n#define DW_AT_const_value\t\t0x1c\n#define DW_AT_containing_type\t\t0x1d\n#define DW_AT_default_value\t\t0x1e\n#define DW_AT_inline\t\t\t0x20\n#define DW_AT_is_optional\t\t0x21\n#define DW_AT_lower_bound\t\t0x22\n#define DW_AT_producer\t\t\t0x25\n#define DW_AT_prototyped\t\t0x27\n#define DW_AT_return_addr\t\t0x2a\n#define DW_AT_start_scope\t\t0x2c\n#define DW_AT_bit_stride\t\t0x2e\n#define DW_AT_stride_size\t\t0x2e\n#define DW_AT_upper_bound\t\t0x2f\n#define DW_AT_abstract_origin\t\t0x31\n#define DW_AT_accessibility\t\t0x32\n#define DW_AT_address_class\t\t0x33\n#define DW_AT_artificial\t\t0x34\n#define DW_AT_base_types\t\t0x35\n#define DW_AT_calling_convention\t0x36\n#define DW_AT_count\t\t\t0x37\n#define DW_AT_data_member_location\t0x38\n#define DW_AT_decl_column\t\t0x39\n#define DW_AT_decl_file\t\t\t0x3a\n#define DW_AT_decl_line\t\t\t0x3b\n#define DW_AT_declaration\t\t0x3c\n#define DW_AT_discr_list\t\t0x3d\n#define DW_AT_encoding\t\t\t0x3e\n#define DW_AT_external\t\t\t0x3f\n#define DW_AT_frame_base\t\t0x40\n#define DW_AT_friend\t\t\t0x41\n#define DW_AT_identifier_case\t\t0x42\n#define DW_AT_macro_info\t\t0x43\n#define DW_AT_namelist_item\t\t0x44\n#define DW_AT_priority\t\t\t0x45\n#define DW_AT_segment\t\t\t0x46\n#define DW_AT_specification\t\t0x47\n#define DW_AT_static_link\t\t0x48\n#define DW_AT_type\t\t\t0x49\n#define DW_AT_use_location\t\t0x4a\n#define DW_AT_variable_parameter\t0x4b\n#define DW_AT_virtuality\t\t0x4c\n#define DW_AT_vtable_elem_location\t0x4d\n\n#define DW_AT_lo_user\t\t\t0x2000\n\n#define DW_AT_hi_user\t\t\t0x3fff\n\n#define DW_FORM_addr\t\t\t0x01\n#define DW_FORM_block2\t\t\t0x03\n#define DW_FORM_block4\t\t\t0x04\n#define DW_FORM_data2\t\t\t0x05\n#define DW_FORM_data4\t\t\t0x06\n#define DW_FORM_data8\t\t\t0x07\n#define DW_FORM_string\t\t\t0x08\n#define DW_FORM_block\t\t\t0x09\n#define DW_FORM_block1\t\t\t0x0a\n#define DW_FORM_data1\t\t\t0x0b\n#define DW_FORM_flag\t\t\t0x0c\n#define DW_FORM_sdata\t\t\t0x0d\n#define DW_FORM_strp\t\t\t0x0e\n#define DW_FORM_udata\t\t\t0x0f\n#define DW_FORM_ref_addr\t\t0x10\n#define DW_FORM_ref1\t\t\t0x11\n#define DW_FORM_ref2\t\t\t0x12\n#define DW_FORM_ref4\t\t\t0x13\n#define DW_FORM_ref8\t\t\t0x14\n#define DW_FORM_ref_udata\t\t0x15\n#define DW_FORM_indirect\t\t0x16\n\n#define DW_OP_addr\t\t\t0x03\n#define DW_OP_deref\t\t\t0x06\n#define DW_OP_const1u\t\t\t0x08\n#define DW_OP_const1s\t\t\t0x09\n#define DW_OP_const2u\t\t\t0x0a\n#define DW_OP_const2s\t\t\t0x0b\n#define DW_OP_const4u\t\t\t0x0c\n#define DW_OP_const4s\t\t\t0x0d\n#define DW_OP_const8u\t\t\t0x0e\n#define DW_OP_const8s\t\t\t0x0f\n#define DW_OP_constu\t\t\t0x10\n#define DW_OP_consts\t\t\t0x11\n#define DW_OP_dup\t\t\t0x12\n#define DW_OP_drop\t\t\t0x13\n#define DW_OP_over\t\t\t0x14\n#define DW_OP_pick\t\t\t0x15\n#define DW_OP_swap\t\t\t0x16\n#define DW_OP_rot\t\t\t0x17\n#define DW_OP_xderef\t\t\t0x18\n#define DW_OP_abs\t\t\t0x19\n#define DW_OP_and\t\t\t0x1a\n#define DW_OP_div\t\t\t0x1b\n#define DW_OP_minus\t\t\t0x1c\n#define DW_OP_mod\t\t\t0x1d\n#define DW_OP_mul\t\t\t0x1e\n#define DW_OP_neg\t\t\t0x1f\n#define DW_OP_not\t\t\t0x20\n#define DW_OP_or\t\t\t0x21\n#define DW_OP_plus\t\t\t0x22\n#define DW_OP_plus_uconst\t\t0x23\n#define DW_OP_shl\t\t\t0x24\n#define DW_OP_shr\t\t\t0x25\n#define DW_OP_shra\t\t\t0x26\n#define DW_OP_xor\t\t\t0x27\n#define DW_OP_bra\t\t\t0x28\n#define DW_OP_eq\t\t\t0x29\n#define DW_OP_ge\t\t\t0x2a\n#define DW_OP_gt\t\t\t0x2b\n#define DW_OP_le\t\t\t0x2c\n#define DW_OP_lt\t\t\t0x2d\n#define DW_OP_ne\t\t\t0x2e\n#define DW_OP_skip\t\t\t0x2f\n#define DW_OP_lit0\t\t\t0x30\n#define DW_OP_lit1\t\t\t0x31\n#define DW_OP_lit2\t\t\t0x32\n#define DW_OP_lit3\t\t\t0x33\n#define DW_OP_lit4\t\t\t0x34\n#define DW_OP_lit5\t\t\t0x35\n#define DW_OP_lit6\t\t\t0x36\n#define DW_OP_lit7\t\t\t0x37\n#define DW_OP_lit8\t\t\t0x38\n#define DW_OP_lit9\t\t\t0x39\n#define DW_OP_lit10\t\t\t0x3a\n#define DW_OP_lit11\t\t\t0x3b\n#define DW_OP_lit12\t\t\t0x3c\n#define DW_OP_lit13\t\t\t0x3d\n#define DW_OP_lit14\t\t\t0x3e\n#define DW_OP_lit15\t\t\t0x3f\n#define DW_OP_lit16\t\t\t0x40\n#define DW_OP_lit17\t\t\t0x41\n#define DW_OP_lit18\t\t\t0x42\n#define DW_OP_lit19\t\t\t0x43\n#define DW_OP_lit20\t\t\t0x44\n#define DW_OP_lit21\t\t\t0x45\n#define DW_OP_lit22\t\t\t0x46\n#define DW_OP_lit23\t\t\t0x47\n#define DW_OP_lit24\t\t\t0x48\n#define DW_OP_lit25\t\t\t0x49\n#define DW_OP_lit26\t\t\t0x4a\n#define DW_OP_lit27\t\t\t0x4b\n#define DW_OP_lit28\t\t\t0x4c\n#define DW_OP_lit29\t\t\t0x4d\n#define DW_OP_lit30\t\t\t0x4e\n#define DW_OP_lit31\t\t\t0x4f\n#define DW_OP_reg0\t\t\t0x50\n#define DW_OP_reg1\t\t\t0x51\n#define DW_OP_reg2\t\t\t0x52\n#define DW_OP_reg3\t\t\t0x53\n#define DW_OP_reg4\t\t\t0x54\n#define DW_OP_reg5\t\t\t0x55\n#define DW_OP_reg6\t\t\t0x56\n#define DW_OP_reg7\t\t\t0x57\n#define DW_OP_reg8\t\t\t0x58\n#define DW_OP_reg9\t\t\t0x59\n#define DW_OP_reg10\t\t\t0x5a\n#define DW_OP_reg11\t\t\t0x5b\n#define DW_OP_reg12\t\t\t0x5c\n#define DW_OP_reg13\t\t\t0x5d\n#define DW_OP_reg14\t\t\t0x5e\n#define DW_OP_reg15\t\t\t0x5f\n#define DW_OP_reg16\t\t\t0x60\n#define DW_OP_reg17\t\t\t0x61\n#define DW_OP_reg18\t\t\t0x62\n#define DW_OP_reg19\t\t\t0x63\n#define DW_OP_reg20\t\t\t0x64\n#define DW_OP_reg21\t\t\t0x65\n#define DW_OP_reg22\t\t\t0x66\n#define DW_OP_reg23\t\t\t0x67\n#define DW_OP_reg24\t\t\t0x68\n#define DW_OP_reg25\t\t\t0x69\n#define DW_OP_reg26\t\t\t0x6a\n#define DW_OP_reg27\t\t\t0x6b\n#define DW_OP_reg28\t\t\t0x6c\n#define DW_OP_reg29\t\t\t0x6d\n#define DW_OP_reg30\t\t\t0x6e\n#define DW_OP_reg31\t\t\t0x6f\n#define DW_OP_breg0\t\t\t0x70\n#define DW_OP_breg1\t\t\t0x71\n#define DW_OP_breg2\t\t\t0x72\n#define DW_OP_breg3\t\t\t0x73\n#define DW_OP_breg4\t\t\t0x74\n#define DW_OP_breg5\t\t\t0x75\n#define DW_OP_breg6\t\t\t0x76\n#define DW_OP_breg7\t\t\t0x77\n#define DW_OP_breg8\t\t\t0x78\n#define DW_OP_breg9\t\t\t0x79\n#define DW_OP_breg10\t\t\t0x7a\n#define DW_OP_breg11\t\t\t0x7b\n#define DW_OP_breg12\t\t\t0x7c\n#define DW_OP_breg13\t\t\t0x7d\n#define DW_OP_breg14\t\t\t0x7e\n#define DW_OP_breg15\t\t\t0x7f\n#define DW_OP_breg16\t\t\t0x80\n#define DW_OP_breg17\t\t\t0x81\n#define DW_OP_breg18\t\t\t0x82\n#define DW_OP_breg19\t\t\t0x83\n#define DW_OP_breg20\t\t\t0x84\n#define DW_OP_breg21\t\t\t0x85\n#define DW_OP_breg22\t\t\t0x86\n#define DW_OP_breg23\t\t\t0x87\n#define DW_OP_breg24\t\t\t0x88\n#define DW_OP_breg25\t\t\t0x89\n#define DW_OP_breg26\t\t\t0x8a\n#define DW_OP_breg27\t\t\t0x8b\n#define DW_OP_breg28\t\t\t0x8c\n#define DW_OP_breg29\t\t\t0x8d\n#define DW_OP_breg30\t\t\t0x8e\n#define DW_OP_breg31\t\t\t0x8f\n#define DW_OP_regx\t\t\t0x90\n#define DW_OP_fbreg\t\t\t0x91\n#define DW_OP_bregx\t\t\t0x92\n#define DW_OP_piece\t\t\t0x93\n#define DW_OP_deref_size\t\t0x94\n#define DW_OP_xderef_size\t\t0x95\n#define DW_OP_nop\t\t\t0x96\n\n#define DW_OP_lo_user\t\t \t0xe0\n\n#define DW_OP_hi_user\t\t \t0xff\n\n#define DW_ATE_address\t\t \t0x1\n#define DW_ATE_boolean\t\t \t0x2\n#define DW_ATE_complex_float\t \t0x3\n#define DW_ATE_float\t\t \t0x4\n#define DW_ATE_signed\t\t \t0x5\n#define DW_ATE_signed_char\t \t0x6\n#define DW_ATE_unsigned\t\t \t0x7\n#define DW_ATE_unsigned_char\t \t0x8\n#define DW_ATE_imaginary_float\t \t0x9\n#define DW_ATE_packed_decimal\t \t0xa\n#define DW_ATE_numeric_string\t \t0xb\n#define DW_ATE_edited\t\t \t0xc\n#define DW_ATE_signed_fixed\t \t0xd\n#define DW_ATE_unsigned_fixed\t \t0xe\n#define DW_ATE_decimal_float\t \t0xf\n\n#define DW_ATE_lo_user\t\t \t0x80\n\n#define DW_ATE_hi_user\t\t \t0xff\n\n#define DW_ACCESS_public\t\t0x01\n#define DW_ACCESS_protected\t \t0x02\n#define DW_ACCESS_private\t \t0x03\n\n#define DW_VIS_local\t\t \t0x01\n#define DW_VIS_exported\t\t \t0x02\n#define DW_VIS_qualified\t\t0x03\n\n#define DW_VIRTUALITY_none\t \t0x00\n#define DW_VIRTUALITY_virtual\t \t0x01\n#define DW_VIRTUALITY_pure_virtual \t0x02\n\n#define DW_LANG_C89\t\t \t0x0001\n#define DW_LANG_C\t\t \t0x0002\n#define DW_LANG_Ada83\t\t \t0x0003\n#define DW_LANG_C_plus_plus\t \t0x0004\n#define DW_LANG_Cobol74\t\t \t0x0005\n#define DW_LANG_Cobol85\t\t \t0x0006\n#define DW_LANG_Fortran77\t \t0x0007\n#define DW_LANG_Fortran90\t \t0x0008\n#define DW_LANG_Pascal83\t\t0x0009\n#define DW_LANG_Modula2\t\t \t0x000a\n#define DW_LANG_Java\t\t \t0x000b\n#define DW_LANG_C99\t\t \t0x000c\n#define DW_LANG_Ada95\t\t \t0x000d\n#define DW_LANG_Fortran95\t \t0x000e\n#define DW_LANG_PLI\t\t \t0x000f\n#define DW_LANG_ObjC\t\t \t0x0010\n#define DW_LANG_ObjC_plus_plus\t \t0x0011\n#define DW_LANG_UPC\t\t \t0x0012\n#define DW_LANG_D\t\t \t0x0013\n\n#define DW_LANG_lo_user\t\t \t0x8000\n\n#define DW_LANG_hi_user\t\t \t0xffff\n\n#define DW_ID_case_sensitive\t \t0x00\n#define DW_ID_up_case\t\t \t0x01\n#define DW_ID_down_case\t\t \t0x02\n#define DW_ID_case_insensitive\t \t0x03\n\n#define DW_CC_normal\t\t \t0x01\n#define DW_CC_program\t\t \t0x02\n#define DW_CC_nocall\t\t \t0x03\n\n#define DW_CC_lo_user\t\t \t0x40\n\n#define DW_CC_hi_user\t\t \t0xff\n\n#define DW_INL_not_inlined\t \t0x00\n#define DW_INL_inlined\t\t \t0x01\n#define DW_INL_declared_not_inlined \t0x02\n#define DW_INL_declared_inlined\t \t0x03\n\n#define DW_ORD_row_major\t\t0x00\n#define DW_ORD_col_major\t\t0x01\n\n#define DW_DSC_label\t\t \t0x00\n#define DW_DSC_range\t\t \t0x01\n\n#define DW_LNS_copy\t\t \t0x01\n#define DW_LNS_advance_pc\t \t0x02\n#define DW_LNS_advance_line\t \t0x03\n#define DW_LNS_set_file\t\t \t0x04\n#define DW_LNS_set_column\t \t0x05\n#define DW_LNS_negate_stmt\t \t0x06\n#define DW_LNS_set_basic_block\t \t0x07\n#define DW_LNS_const_add_pc\t \t0x08\n#define DW_LNS_fixed_advance_pc\t \t0x09\n#define DW_LNS_set_prologue_end\t \t0x0a\n#define DW_LNS_set_epilogue_begin \t0x0b\n#define DW_LNS_set_isa\t\t \t0x0c\n\n#define DW_LNE_end_sequence\t \t0x01\n#define DW_LNE_set_address\t \t0x02\n#define DW_LNE_define_file\t \t0x03\n\n#define DW_LNE_lo_user\t\t \t0x80\n\n#define DW_LNE_hi_user\t\t \t0xff\n\n#define DW_MACINFO_define\t \t0x01\n#define DW_MACINFO_undef\t\t0x02\n#define DW_MACINFO_start_file\t \t0x03\n#define DW_MACINFO_end_file\t \t0x04\n#define DW_MACINFO_vendor_ext\t \t0xff\n\n#define DW_CFA_advance_loc\t\t0x40\n#define DW_CFA_offset\t \t\t0x80\n#define DW_CFA_restore\t \t\t0xc0\n#define DW_CFA_extended\t\t\t0\n\n#define DW_CFA_nop\t \t\t0x00\n#define DW_CFA_set_loc\t \t\t0x01\n#define DW_CFA_advance_loc1 \t\t0x02\n#define DW_CFA_advance_loc2 \t\t0x03\n#define DW_CFA_advance_loc4 \t\t0x04\n#define DW_CFA_offset_extended \t\t0x05\n#define DW_CFA_restore_extended \t0x06\n#define DW_CFA_undefined\t\t0x07\n#define DW_CFA_same_value \t\t0x08\n#define DW_CFA_register\t \t\t0x09\n#define DW_CFA_remember_state \t\t0x0a\n#define DW_CFA_restore_state \t\t0x0b\n#define DW_CFA_def_cfa\t \t\t0x0c\n#define DW_CFA_def_cfa_register \t0x0d\n#define DW_CFA_def_cfa_offset \t\t0x0e\n#define DW_CFA_def_cfa_expression \t0x0f\n#define DW_CFA_expression \t\t0x10\n#define DW_CFA_cfa_offset_extended_sf \t0x11\n#define DW_CFA_def_cfa_sf \t\t0x12\n#define DW_CFA_def_cfa_offset_sf \t0x13\n#define DW_CFA_val_offset\t\t0x14\n#define DW_CFA_val_offset_sf \t\t0x15\n#define DW_CFA_val_expression \t\t0x16\n\n#define DW_CFA_lo_user\t \t\t0x1c\n\n#define DW_CFA_high_user\t \t0x3f\n\n#endif /* !_DWARF_H_ */\n"
  },
  {
    "path": "freebsd-headers/edit/readline/history.h",
    "content": "/*-\n * Copyright (c) 2011 David E. O'Brien\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. Neither the name of the author nor the names of contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/lib/libedit/edit/readline/history.h 220370 2011-04-05 18:41:01Z obrien $\n */\n\n#include <edit/readline/readline.h>\n"
  },
  {
    "path": "freebsd-headers/edit/readline/readline.h",
    "content": "/*\t$NetBSD: readline.h,v 1.31 2010/08/04 20:29:18 christos Exp $\t*/\n\n/*-\n * Copyright (c) 1997 The NetBSD Foundation, Inc.\n * All rights reserved.\n *\n * This code is derived from software contributed to The NetBSD Foundation\n * by Jaromir Dolecek.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS\n * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED\n * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\n * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS\n * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\n * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\n * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\n * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\n * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/lib/libedit/edit/readline/readline.h 220624 2011-04-14 15:42:15Z obrien $\n */\n#ifndef _READLINE_H_\n#define _READLINE_H_\n\n#include <sys/types.h>\n#include <stdio.h>\n\n/* list of readline stuff supported by editline library's readline wrapper */\n\n/* typedefs */\ntypedef int\t  Function(const char *, int);\ntypedef void\t  VFunction(void);\ntypedef void\t  VCPFunction(char *);\ntypedef char\t *CPFunction(const char *, int);\ntypedef char\t**CPPFunction(const char *, int, int);\ntypedef char     *rl_compentry_func_t(const char *, int);\ntypedef int\t  rl_command_func_t(int, int);\n\n/* only supports length */\ntypedef struct {\n\tint length;\n} HISTORY_STATE;\n\ntypedef void *histdata_t;\n\ntypedef struct _hist_entry {\n\tconst char\t*line;\n\thistdata_t \t data;\n} HIST_ENTRY;\n\ntypedef struct _keymap_entry {\n\tchar type;\n#define ISFUNC\t0\n#define ISKMAP\t1\n#define ISMACR\t2\n\tFunction *function;\n} KEYMAP_ENTRY;\n\n#define KEYMAP_SIZE\t256\n\ntypedef KEYMAP_ENTRY KEYMAP_ENTRY_ARRAY[KEYMAP_SIZE];\ntypedef KEYMAP_ENTRY *Keymap;\n\n#define control_character_threshold\t0x20\n#define control_character_bit\t\t0x40\n\n#ifndef CTRL\n#include <sys/ioctl.h>\n#if !defined(__sun) && !defined(__hpux) && !defined(_AIX)\n#include <sys/ttydefaults.h>\n#endif\n#ifndef CTRL\n#define CTRL(c)\t\t((c) & 037)\n#endif\n#endif\n#ifndef UNCTRL\n#define UNCTRL(c)\t(((c) - 'a' + 'A')|control_character_bit)\n#endif\n\n#define RUBOUT\t\t0x7f\n#define ABORT_CHAR\tCTRL('G')\n#define RL_READLINE_VERSION \t0x0402\n#define RL_PROMPT_START_IGNORE\t'\\1'\n#define RL_PROMPT_END_IGNORE\t'\\2'\n\n/* global variables used by readline enabled applications */\n#ifdef __cplusplus\nextern \"C\" {\n#endif\nextern const char\t*rl_library_version;\nextern int \t\trl_readline_version; \nextern char\t\t*rl_readline_name;\nextern FILE\t\t*rl_instream;\nextern FILE\t\t*rl_outstream;\nextern char\t\t*rl_line_buffer;\nextern int\t\t rl_point, rl_end;\nextern int\t\t history_base, history_length;\nextern int\t\t max_input_history;\nextern char\t\t*rl_basic_word_break_characters;\nextern char\t\t*rl_completer_word_break_characters;\nextern char\t\t*rl_completer_quote_characters;\nextern Function\t\t*rl_completion_entry_function;\nextern CPPFunction\t*rl_attempted_completion_function;\nextern int\t\t rl_attempted_completion_over;\nextern int\t\trl_completion_type;\nextern int\t\trl_completion_query_items;\nextern char\t\t*rl_special_prefixes;\nextern int\t\trl_completion_append_character;\nextern int\t\trl_inhibit_completion;\nextern Function\t\t*rl_pre_input_hook;\nextern Function\t\t*rl_startup_hook;\nextern char\t\t*rl_terminal_name;\nextern int\t\trl_already_prompted;\nextern char\t\t*rl_prompt;\n/*\n * The following is not implemented\n */\nextern KEYMAP_ENTRY_ARRAY emacs_standard_keymap,\n\t\t\temacs_meta_keymap,\n\t\t\temacs_ctlx_keymap;\nextern int\t\trl_filename_completion_desired;\nextern int\t\trl_ignore_completion_duplicates;\nextern int\t\t(*rl_getc_function)(FILE *);\nextern VFunction\t*rl_redisplay_function;\nextern VFunction\t*rl_completion_display_matches_hook;\nextern VFunction\t*rl_prep_term_function;\nextern VFunction\t*rl_deprep_term_function;\nextern int\t\treadline_echoing_p;\nextern int\t\t_rl_print_completions_horizontally;\n\n/* supported functions */\nchar\t\t*readline(const char *);\nint\t\t rl_initialize(void);\n\nvoid\t\t using_history(void);\nint\t\t add_history(const char *);\nvoid\t\t clear_history(void);\nvoid\t\t stifle_history(int);\nint\t\t unstifle_history(void);\nint\t\t history_is_stifled(void);\nint\t\t where_history(void);\nHIST_ENTRY\t*current_history(void);\nHIST_ENTRY\t*history_get(int);\nHIST_ENTRY\t*remove_history(int);\n/*###152 [lint] syntax error 'histdata_t' [249]%%%*/\nHIST_ENTRY\t*replace_history_entry(int, const char *, histdata_t);\nint\t\t history_total_bytes(void);\nint\t\t history_set_pos(int);\nHIST_ENTRY\t*previous_history(void);\nHIST_ENTRY\t*next_history(void);\nint\t\t history_search(const char *, int);\nint\t\t history_search_prefix(const char *, int);\nint\t\t history_search_pos(const char *, int, int);\nint\t\t read_history(const char *);\nint\t\t write_history(const char *);\nint\t\t history_truncate_file (const char *, int);\nint\t\t history_expand(char *, char **);\nchar\t       **history_tokenize(const char *);\nconst char\t*get_history_event(const char *, int *, int);\nchar\t\t*history_arg_extract(int, int, const char *);\n\nchar\t\t*tilde_expand(char *);\nchar\t\t*filename_completion_function(const char *, int);\nchar\t\t*username_completion_function(const char *, int);\nint\t\t rl_complete(int, int);\nint\t\t rl_read_key(void);\nchar\t       **completion_matches(const char *, CPFunction *);\nvoid\t\t rl_display_match_list(char **, int, int);\n\nint\t\t rl_insert(int, int);\nint\t\t rl_insert_text(const char *);\nvoid\t\t rl_reset_terminal(const char *);\nint\t\t rl_bind_key(int, rl_command_func_t *);\nint\t\t rl_newline(int, int);\nvoid\t\t rl_callback_read_char(void);\nvoid\t\t rl_callback_handler_install(const char *, VCPFunction *);\nvoid\t\t rl_callback_handler_remove(void);\nvoid\t\t rl_redisplay(void);\nint\t\t rl_get_previous_history(int, int);\nvoid\t\t rl_prep_terminal(int);\nvoid\t\t rl_deprep_terminal(void);\nint\t\t rl_read_init_file(const char *);\nint\t\t rl_parse_and_bind(const char *);\nint\t\t rl_variable_bind(const char *, const char *);\nvoid\t\t rl_stuff_char(int);\nint\t\t rl_add_defun(const char *, Function *, int);\nHISTORY_STATE\t*history_get_history_state(void);\nvoid\t\t rl_get_screen_size(int *, int *);\nvoid\t\t rl_set_screen_size(int, int);\nchar \t\t*rl_filename_completion_function (const char *, int);\nint\t\t _rl_abort_internal(void);\nint\t\t _rl_qsort_string_compare(char **, char **);\nchar \t       **rl_completion_matches(const char *, rl_compentry_func_t *);\nvoid\t\t rl_forced_update_display(void);\nint\t\t rl_set_prompt(const char *);\nint\t\t rl_on_new_line(void);\n\n/*\n * The following are not implemented\n */\nint\t\t rl_kill_text(int, int);\nKeymap\t\t rl_get_keymap(void);\nvoid\t\t rl_set_keymap(Keymap);\nKeymap\t\t rl_make_bare_keymap(void);\nint\t\t rl_generic_bind(int, const char *, const char *, Keymap);\nint\t\t rl_bind_key_in_map(int, rl_command_func_t *, Keymap);\nvoid\t\t rl_cleanup_after_signal(void);\nvoid\t\t rl_free_line_state(void);\n#ifdef __cplusplus\n}\n#endif\n\n#endif /* _READLINE_H_ */\n"
  },
  {
    "path": "freebsd-headers/elf-hints.h",
    "content": "/*-\n * Copyright (c) 1997 John D. Polstra.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/include/elf-hints.h 76224 2001-05-02 23:56:21Z obrien $\n */\n\n#ifndef\t_ELF_HINTS_H_\n#define\t_ELF_HINTS_H_\n\n/*\n * Hints file produced by ldconfig.\n */\nstruct elfhints_hdr {\n\tu_int32_t\tmagic;\t\t/* Magic number */\n\tu_int32_t\tversion;\t/* File version (1) */\n\tu_int32_t\tstrtab;\t\t/* Offset of string table in file */\n\tu_int32_t\tstrsize;\t/* Size of string table */\n\tu_int32_t\tdirlist;\t/* Offset of directory list in\n\t\t\t\t\t   string table */\n\tu_int32_t\tdirlistlen;\t/* strlen(dirlist) */\n\tu_int32_t\tspare[26];\t/* Room for expansion */\n};\n\n#define ELFHINTS_MAGIC\t0x746e6845\n\n#define _PATH_ELF_HINTS\t\"/var/run/ld-elf.so.hints\"\n\n#endif /* !_ELF_HINTS_H_ */\n"
  },
  {
    "path": "freebsd-headers/elf.h",
    "content": "/*-\n * Copyright (c) 2001 David E. O'Brien.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/include/elf.h 174044 2007-11-28 22:09:12Z jb $\n */\n\n/*\n * This is a Solaris compatibility header\n */\n\n#ifndef\t_ELF_H_\n#define\t_ELF_H_\n\n#include <sys/types.h>\n#include <machine/elf.h>\n#include <sys/elf32.h>\n#include <sys/elf64.h>\n\n#endif /* !_ELF_H_ */\n"
  },
  {
    "path": "freebsd-headers/err.h",
    "content": "/*-\n * Copyright (c) 1993\n *\tThe Regents of the University of California.  All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t@(#)err.h\t8.1 (Berkeley) 6/2/93\n * $FreeBSD: release/9.0.0/include/err.h 203964 2010-02-16 19:39:50Z imp $\n */\n\n#ifndef _ERR_H_\n#define\t_ERR_H_\n\n/*\n * Don't use va_list in the err/warn prototypes.   Va_list is typedef'd in two\n * places (<machine/varargs.h> and <machine/stdarg.h>), so if we include one\n * of them here we may collide with the utility's includes.  It's unreasonable\n * for utilities to have to include one of them to include err.h, so we get\n * __va_list from <sys/_types.h> and use it.\n */\n#include <sys/cdefs.h>\n#include <sys/_types.h>\n\n__BEGIN_DECLS\nvoid\terr(int, const char *, ...) __dead2 __printf0like(2, 3);\nvoid\tverr(int, const char *, __va_list) __dead2 __printf0like(2, 0);\nvoid\terrc(int, int, const char *, ...) __dead2 __printf0like(3, 4);\nvoid\tverrc(int, int, const char *, __va_list) __dead2\n\t    __printf0like(3, 0);\nvoid\terrx(int, const char *, ...) __dead2 __printf0like(2, 3);\nvoid\tverrx(int, const char *, __va_list) __dead2 __printf0like(2, 0);\nvoid\twarn(const char *, ...) __printf0like(1, 2);\nvoid\tvwarn(const char *, __va_list) __printf0like(1, 0);\nvoid\twarnc(int, const char *, ...) __printf0like(2, 3);\nvoid\tvwarnc(int, const char *, __va_list) __printf0like(2, 0);\nvoid\twarnx(const char *, ...) __printflike(1, 2);\nvoid\tvwarnx(const char *, __va_list) __printflike(1, 0);\nvoid\terr_set_file(void *);\nvoid\terr_set_exit(void (*)(int));\n__END_DECLS\n\n#endif /* !_ERR_H_ */\n"
  },
  {
    "path": "freebsd-headers/eti.h",
    "content": "/****************************************************************************\n * Copyright (c) 1998-2002,2003 Free Software Foundation, Inc.              *\n *                                                                          *\n * Permission is hereby granted, free of charge, to any person obtaining a  *\n * copy of this software and associated documentation files (the            *\n * \"Software\"), to deal in the Software without restriction, including      *\n * without limitation the rights to use, copy, modify, merge, publish,      *\n * distribute, distribute with modifications, sublicense, and/or sell       *\n * copies of the Software, and to permit persons to whom the Software is    *\n * furnished to do so, subject to the following conditions:                 *\n *                                                                          *\n * The above copyright notice and this permission notice shall be included  *\n * in all copies or substantial portions of the Software.                   *\n *                                                                          *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS  *\n * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF               *\n * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.   *\n * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,   *\n * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR    *\n * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR    *\n * THE USE OR OTHER DEALINGS IN THE SOFTWARE.                               *\n *                                                                          *\n * Except as contained in this notice, the name(s) of the above copyright   *\n * holders shall not be used in advertising or otherwise to promote the     *\n * sale, use or other dealings in this Software without prior written       *\n * authorization.                                                           *\n ****************************************************************************/\n\n/****************************************************************************\n *   Author:  Juergen Pfeifer, 1995,1997                                    *\n ****************************************************************************/\n\n/* $Id: eti.h,v 1.8 2003/10/25 15:24:29 tom Exp $ */\n\n#ifndef NCURSES_ETI_H_incl\n#define NCURSES_ETI_H_incl 1\n\n#define\tE_OK\t\t\t(0)\n#define\tE_SYSTEM_ERROR\t \t(-1)\n#define\tE_BAD_ARGUMENT\t \t(-2)\n#define\tE_POSTED\t \t(-3)\n#define\tE_CONNECTED\t \t(-4)\n#define\tE_BAD_STATE\t \t(-5)\n#define\tE_NO_ROOM\t \t(-6)\n#define\tE_NOT_POSTED\t\t(-7)\n#define\tE_UNKNOWN_COMMAND\t(-8)\n#define\tE_NO_MATCH\t\t(-9)\n#define\tE_NOT_SELECTABLE\t(-10)\n#define\tE_NOT_CONNECTED\t        (-11)\n#define\tE_REQUEST_DENIED\t(-12)\n#define\tE_INVALID_FIELD\t        (-13)\n#define\tE_CURRENT\t\t(-14)\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/fenv.h",
    "content": "/*-\n * Copyright (c) 2004-2005 David Schultz <das@FreeBSD.ORG>\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/lib/msun/amd64/fenv.h 203441 2010-02-03 20:23:47Z kib $\n */\n\n#ifndef\t_FENV_H_\n#define\t_FENV_H_\n\n#include <sys/cdefs.h>\n#include <sys/_types.h>\n\ntypedef struct {\n\tstruct {\n\t\t__uint32_t\t__control;\n\t\t__uint32_t\t__status;\n\t\t__uint32_t\t__tag;\n\t\tchar\t\t__other[16];\n\t} __x87;\n\t__uint32_t\t\t__mxcsr;\n} fenv_t;\n\ntypedef\t__uint16_t\tfexcept_t;\n\n/* Exception flags */\n#define\tFE_INVALID\t0x01\n#define\tFE_DENORMAL\t0x02\n#define\tFE_DIVBYZERO\t0x04\n#define\tFE_OVERFLOW\t0x08\n#define\tFE_UNDERFLOW\t0x10\n#define\tFE_INEXACT\t0x20\n#define\tFE_ALL_EXCEPT\t(FE_DIVBYZERO | FE_DENORMAL | FE_INEXACT | \\\n\t\t\t FE_INVALID | FE_OVERFLOW | FE_UNDERFLOW)\n\n/* Rounding modes */\n#define\tFE_TONEAREST\t0x0000\n#define\tFE_DOWNWARD\t0x0400\n#define\tFE_UPWARD\t0x0800\n#define\tFE_TOWARDZERO\t0x0c00\n#define\t_ROUND_MASK\t(FE_TONEAREST | FE_DOWNWARD | \\\n\t\t\t FE_UPWARD | FE_TOWARDZERO)\n\n/*\n * As compared to the x87 control word, the SSE unit's control word\n * has the rounding control bits offset by 3 and the exception mask\n * bits offset by 7.\n */\n#define\t_SSE_ROUND_SHIFT\t3\n#define\t_SSE_EMASK_SHIFT\t7\n\n__BEGIN_DECLS\n\n/* Default floating-point environment */\nextern const fenv_t\t__fe_dfl_env;\n#define\tFE_DFL_ENV\t(&__fe_dfl_env)\n\n#define\t__fldcw(__cw)\t\t__asm __volatile(\"fldcw %0\" : : \"m\" (__cw))\n#define\t__fldenv(__env)\t\t__asm __volatile(\"fldenv %0\" : : \"m\" (__env))\n#define\t__fldenvx(__env)\t__asm __volatile(\"fldenv %0\" : : \"m\" (__env)  \\\n\t\t\t\t: \"st\", \"st(1)\", \"st(2)\", \"st(3)\", \"st(4)\",   \\\n\t\t\t\t\"st(5)\", \"st(6)\", \"st(7)\")\n#define\t__fnclex()\t\t__asm __volatile(\"fnclex\")\n#define\t__fnstenv(__env)\t__asm __volatile(\"fnstenv %0\" : \"=m\" (*(__env)))\n#define\t__fnstcw(__cw)\t\t__asm __volatile(\"fnstcw %0\" : \"=m\" (*(__cw)))\n#define\t__fnstsw(__sw)\t\t__asm __volatile(\"fnstsw %0\" : \"=am\" (*(__sw)))\n#define\t__fwait()\t\t__asm __volatile(\"fwait\")\n#define\t__ldmxcsr(__csr)\t__asm __volatile(\"ldmxcsr %0\" : : \"m\" (__csr))\n#define\t__stmxcsr(__csr)\t__asm __volatile(\"stmxcsr %0\" : \"=m\" (*(__csr)))\n\nstatic __inline int\nfeclearexcept(int __excepts)\n{\n\tfenv_t __env;\n\n\tif (__excepts == FE_ALL_EXCEPT) {\n\t\t__fnclex();\n\t} else {\n\t\t__fnstenv(&__env.__x87);\n\t\t__env.__x87.__status &= ~__excepts;\n\t\t__fldenv(__env.__x87);\n\t}\n\t__stmxcsr(&__env.__mxcsr);\n\t__env.__mxcsr &= ~__excepts;\n\t__ldmxcsr(__env.__mxcsr);\n\treturn (0);\n}\n\nstatic __inline int\nfegetexceptflag(fexcept_t *__flagp, int __excepts)\n{\n\t__uint32_t __mxcsr;\n\t__uint16_t __status;\n\n\t__stmxcsr(&__mxcsr);\n\t__fnstsw(&__status);\n\t*__flagp = (__mxcsr | __status) & __excepts;\n\treturn (0);\n}\n\nint fesetexceptflag(const fexcept_t *__flagp, int __excepts);\nint feraiseexcept(int __excepts);\n\nstatic __inline int\nfetestexcept(int __excepts)\n{\n\t__uint32_t __mxcsr;\n\t__uint16_t __status;\n\n\t__stmxcsr(&__mxcsr);\n\t__fnstsw(&__status);\n\treturn ((__status | __mxcsr) & __excepts);\n}\n\nstatic __inline int\nfegetround(void)\n{\n\t__uint16_t __control;\n\n\t/*\n\t * We assume that the x87 and the SSE unit agree on the\n\t * rounding mode.  Reading the control word on the x87 turns\n\t * out to be about 5 times faster than reading it on the SSE\n\t * unit on an Opteron 244.\n\t */\n\t__fnstcw(&__control);\n\treturn (__control & _ROUND_MASK);\n}\n\nstatic __inline int\nfesetround(int __round)\n{\n\t__uint32_t __mxcsr;\n\t__uint16_t __control;\n\n\tif (__round & ~_ROUND_MASK)\n\t\treturn (-1);\n\n\t__fnstcw(&__control);\n\t__control &= ~_ROUND_MASK;\n\t__control |= __round;\n\t__fldcw(__control);\n\n\t__stmxcsr(&__mxcsr);\n\t__mxcsr &= ~(_ROUND_MASK << _SSE_ROUND_SHIFT);\n\t__mxcsr |= __round << _SSE_ROUND_SHIFT;\n\t__ldmxcsr(__mxcsr);\n\n\treturn (0);\n}\n\nint fegetenv(fenv_t *__envp);\nint feholdexcept(fenv_t *__envp);\n\nstatic __inline int\nfesetenv(const fenv_t *__envp)\n{\n\n\t/*\n\t * XXX Using fldenvx() instead of fldenv() tells the compiler that this\n\t * instruction clobbers the i387 register stack.  This happens because\n\t * we restore the tag word from the saved environment.  Normally, this\n\t * would happen anyway and we wouldn't care, because the ABI allows\n\t * function calls to clobber the i387 regs.  However, fesetenv() is\n\t * inlined, so we need to be more careful.\n\t */\n\t__fldenvx(__envp->__x87);\n\t__ldmxcsr(__envp->__mxcsr);\n\treturn (0);\n}\n\nint feupdateenv(const fenv_t *__envp);\n\n#if __BSD_VISIBLE\n\nint feenableexcept(int __mask);\nint fedisableexcept(int __mask);\n\nstatic __inline int\nfegetexcept(void)\n{\n\t__uint16_t __control;\n\n\t/*\n\t * We assume that the masks for the x87 and the SSE unit are\n\t * the same.\n\t */\n\t__fnstcw(&__control);\n\treturn (~__control & FE_ALL_EXCEPT);\n}\n\n#endif /* __BSD_VISIBLE */\n\n__END_DECLS\n\n#endif\t/* !_FENV_H_ */\n"
  },
  {
    "path": "freebsd-headers/fetch.h",
    "content": "/*-\n * Copyright (c) 1998-2004 Dag-Erling Codan Smrgrav\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer\n *    in this position and unchanged.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. The name of the author may not be used to endorse or promote products\n *    derived from this software without specific prior written permission\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR\n * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES\n * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,\n * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF\n * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/lib/libfetch/fetch.h 186124 2008-12-15 08:27:44Z murray $\n */\n\n#ifndef _FETCH_H_INCLUDED\n#define _FETCH_H_INCLUDED\n\n#define _LIBFETCH_VER \"libfetch/2.0\"\n\n#define URL_SCHEMELEN 16\n#define URL_USERLEN 256\n#define URL_PWDLEN 256\n\nstruct url {\n\tchar\t\t scheme[URL_SCHEMELEN+1];\n\tchar\t\t user[URL_USERLEN+1];\n\tchar\t\t pwd[URL_PWDLEN+1];\n\tchar\t\t host[MAXHOSTNAMELEN+1];\n\tint\t\t port;\n\tchar\t\t*doc;\n\toff_t\t\t offset;\n\tsize_t\t\t length;\n\ttime_t\t\t ims_time;\n};\n\nstruct url_stat {\n\toff_t\t\t size;\n\ttime_t\t\t atime;\n\ttime_t\t\t mtime;\n};\n\nstruct url_ent {\n\tchar\t\t name[PATH_MAX];\n\tstruct url_stat\t stat;\n};\n\n/* Recognized schemes */\n#define SCHEME_FTP\t\"ftp\"\n#define SCHEME_HTTP\t\"http\"\n#define SCHEME_HTTPS\t\"https\"\n#define SCHEME_FILE\t\"file\"\n\n/* Error codes */\n#define\tFETCH_ABORT\t 1\n#define\tFETCH_AUTH\t 2\n#define\tFETCH_DOWN\t 3\n#define\tFETCH_EXISTS\t 4\n#define\tFETCH_FULL\t 5\n#define\tFETCH_INFO\t 6\n#define\tFETCH_MEMORY\t 7\n#define\tFETCH_MOVED\t 8\n#define\tFETCH_NETWORK\t 9\n#define\tFETCH_OK\t10\n#define\tFETCH_PROTO\t11\n#define\tFETCH_RESOLV\t12\n#define\tFETCH_SERVER\t13\n#define\tFETCH_TEMP\t14\n#define\tFETCH_TIMEOUT\t15\n#define\tFETCH_UNAVAIL\t16\n#define\tFETCH_UNKNOWN\t17\n#define\tFETCH_URL\t18\n#define\tFETCH_VERBOSE\t19\n\n__BEGIN_DECLS\n\n/* FILE-specific functions */\nFILE\t\t*fetchXGetFile(struct url *, struct url_stat *, const char *);\nFILE\t\t*fetchGetFile(struct url *, const char *);\nFILE\t\t*fetchPutFile(struct url *, const char *);\nint\t\t fetchStatFile(struct url *, struct url_stat *, const char *);\nstruct url_ent\t*fetchListFile(struct url *, const char *);\n\n/* HTTP-specific functions */\nFILE\t\t*fetchXGetHTTP(struct url *, struct url_stat *, const char *);\nFILE\t\t*fetchGetHTTP(struct url *, const char *);\nFILE\t\t*fetchPutHTTP(struct url *, const char *);\nint\t\t fetchStatHTTP(struct url *, struct url_stat *, const char *);\nstruct url_ent\t*fetchListHTTP(struct url *, const char *);\n\n/* FTP-specific functions */\nFILE\t\t*fetchXGetFTP(struct url *, struct url_stat *, const char *);\nFILE\t\t*fetchGetFTP(struct url *, const char *);\nFILE\t\t*fetchPutFTP(struct url *, const char *);\nint\t\t fetchStatFTP(struct url *, struct url_stat *, const char *);\nstruct url_ent\t*fetchListFTP(struct url *, const char *);\n\n/* Generic functions */\nFILE\t\t*fetchXGetURL(const char *, struct url_stat *, const char *);\nFILE\t\t*fetchGetURL(const char *, const char *);\nFILE\t\t*fetchPutURL(const char *, const char *);\nint\t\t fetchStatURL(const char *, struct url_stat *, const char *);\nstruct url_ent\t*fetchListURL(const char *, const char *);\nFILE\t\t*fetchXGet(struct url *, struct url_stat *, const char *);\nFILE\t\t*fetchGet(struct url *, const char *);\nFILE\t\t*fetchPut(struct url *, const char *);\nint\t\t fetchStat(struct url *, struct url_stat *, const char *);\nstruct url_ent\t*fetchList(struct url *, const char *);\n\n/* URL parsing */\nstruct url\t*fetchMakeURL(const char *, const char *, int,\n\t\t     const char *, const char *, const char *);\nstruct url\t*fetchParseURL(const char *);\nvoid\t\t fetchFreeURL(struct url *);\n\n__END_DECLS\n\n/* Authentication */\ntypedef int (*auth_t)(struct url *);\nextern auth_t\t\t fetchAuthMethod;\n\n/* Last error code */\nextern int\t\t fetchLastErrCode;\n#define MAXERRSTRING 256\nextern char\t\t fetchLastErrString[MAXERRSTRING];\n\n/* I/O timeout */\nextern int\t\t fetchTimeout;\n\n/* Restart interrupted syscalls */\nextern int\t\t fetchRestartCalls;\n\n/* Extra verbosity */\nextern int\t\t fetchDebug;\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/fmtmsg.h",
    "content": "/*-\n * Copyright (c) 2002 Mike Barcroft <mike@FreeBSD.org>\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/include/fmtmsg.h 101390 2002-08-05 16:37:05Z mike $\n */\n\n#ifndef _FMTMSG_H_\n#define\t_FMTMSG_H_\n\n/* Source of condition is... */\n#define\tMM_HARD\t\t0x0001\t/* ...hardware. */\n#define\tMM_SOFT\t\t0x0002\t/* ...software. */\n#define\tMM_FIRM\t\t0x0004\t/* ...fireware. */\n\n/* Condition detected by... */\n#define\tMM_APPL\t\t0x0010\t/* ...application. */\n#define\tMM_UTIL\t\t0x0020\t/* ...utility. */\n#define\tMM_OPSYS\t0x0040\t/* ...operating system. */\n\n/* Display on... */\n#define\tMM_PRINT\t0x0100\t/* ...standard error. */\n#define\tMM_CONSOLE\t0x0200\t/* ...system console. */\n\n#define\tMM_RECOVER\t0x1000\t/* Recoverable error. */\n#define\tMM_NRECOV\t0x2000\t/* Non-recoverable error. */\n\n/* Severity levels. */\n#define\tMM_NOSEV\t0\t/* No severity level provided. */\n#define\tMM_HALT\t\t1\t/* Error causing application to halt. */\n#define\tMM_ERROR\t2\t/* Non-fault fault. */\n#define\tMM_WARNING\t3\t/* Unusual non-error condition. */\n#define\tMM_INFO\t\t4\t/* Informative message. */\n\n/* Null options. */\n#define\tMM_NULLLBL\t(char *)0\n#define\tMM_NULLSEV\t0\n#define\tMM_NULLMC\t0L\n#define\tMM_NULLTXT\t(char *)0\n#define\tMM_NULLACT\t(char *)0\n#define\tMM_NULLTAG\t(char *)0\n\n/* Return values. */\n#define\tMM_OK\t\t0\t/* Success. */\n#define\tMM_NOMSG\t1\t/* Failed to output to stderr. */\n#define\tMM_NOCON\t2\t/* Failed to output to console. */\n#define\tMM_NOTOK\t3\t/* Failed to output anything. */\n\nint\tfmtmsg(long, const char *, int, const char *, const char *,\n\t    const char *);\n\n#endif /* !_FMTMSG_H_ */\n"
  },
  {
    "path": "freebsd-headers/fnmatch.h",
    "content": "/*-\n * Copyright (c) 1992, 1993\n *\tThe Regents of the University of California.  All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/include/fnmatch.h 203964 2010-02-16 19:39:50Z imp $\n *\t@(#)fnmatch.h\t8.1 (Berkeley) 6/2/93\n */\n\n#ifndef\t_FNMATCH_H_\n#define\t_FNMATCH_H_\n\n#include <sys/cdefs.h>\n\n#define\tFNM_NOMATCH\t1\t/* Match failed. */\n\n#define\tFNM_NOESCAPE\t0x01\t/* Disable backslash escaping. */\n#define\tFNM_PATHNAME\t0x02\t/* Slash must be matched by slash. */\n#define\tFNM_PERIOD\t0x04\t/* Period must be matched by period. */\n\n#if __XSI_VISIBLE\n#define\tFNM_NOSYS\t(-1)\t/* Reserved. */\n#endif\n\n#if __BSD_VISIBLE\n#define\tFNM_LEADING_DIR\t0x08\t/* Ignore /<tail> after Imatch. */\n#define\tFNM_CASEFOLD\t0x10\t/* Case insensitive search. */\n#define\tFNM_IGNORECASE\tFNM_CASEFOLD\n#define\tFNM_FILE_NAME\tFNM_PATHNAME\n#endif\n\n__BEGIN_DECLS\nint\t fnmatch(const char *, const char *, int);\n__END_DECLS\n\n#endif /* !_FNMATCH_H_ */\n"
  },
  {
    "path": "freebsd-headers/form.h",
    "content": "/****************************************************************************\n * Copyright (c) 1998-2003,2004 Free Software Foundation, Inc.              *\n *                                                                          *\n * Permission is hereby granted, free of charge, to any person obtaining a  *\n * copy of this software and associated documentation files (the            *\n * \"Software\"), to deal in the Software without restriction, including      *\n * without limitation the rights to use, copy, modify, merge, publish,      *\n * distribute, distribute with modifications, sublicense, and/or sell       *\n * copies of the Software, and to permit persons to whom the Software is    *\n * furnished to do so, subject to the following conditions:                 *\n *                                                                          *\n * The above copyright notice and this permission notice shall be included  *\n * in all copies or substantial portions of the Software.                   *\n *                                                                          *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS  *\n * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF               *\n * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.   *\n * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,   *\n * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR    *\n * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR    *\n * THE USE OR OTHER DEALINGS IN THE SOFTWARE.                               *\n *                                                                          *\n * Except as contained in this notice, the name(s) of the above copyright   *\n * holders shall not be used in advertising or otherwise to promote the     *\n * sale, use or other dealings in this Software without prior written       *\n * authorization.                                                           *\n ****************************************************************************/\n\n/****************************************************************************\n *   Author:  Juergen Pfeifer, 1995,1997                                    *\n ****************************************************************************/\n\n/* $Id: form.h,v 0.20 2004/12/04 22:22:10 tom Exp $ */\n\n#ifndef FORM_H\n#define FORM_H\n\n#include <curses.h>\n#include <eti.h>\n\n#ifdef __cplusplus\n  extern \"C\" {\n#endif\n\n#ifndef FORM_PRIV_H\ntypedef void *FIELD_CELL;\n#endif\n\n#ifndef NCURSES_FIELD_INTERNALS\n#define NCURSES_FIELD_INTERNALS /* nothing */\n#endif\n\ntypedef int Form_Options;\ntypedef int Field_Options;\n\n\t/**********\n\t*  _PAGE  *\n\t**********/\n\ntypedef struct {\n  short pmin;\t\t/* index of first field on page\t\t\t*/\n  short pmax;\t\t/* index of last field on page\t\t\t*/\n  short smin;\t\t/* index of top leftmost field on page\t\t*/\n  short smax;\t\t/* index of bottom rightmost field on page\t*/\n} _PAGE;\n\n\t/**********\n\t*  FIELD  *\n\t**********/\n\ntypedef struct fieldnode {\n  unsigned short\tstatus;\t\t/* flags\t\t\t*/\n  short\t\t\trows;\t\t/* size in rows\t\t\t*/\n  short\t\t\tcols;\t\t/* size in cols\t\t\t*/\n  short\t\t\tfrow;\t\t/* first row\t\t\t*/\n  short\t\t\tfcol;\t\t/* first col\t\t\t*/\n  int\t\t\tdrows;\t\t/* dynamic rows\t\t\t*/\n  int\t\t\tdcols;\t\t/* dynamic cols\t\t\t*/\n  int\t\t\tmaxgrow;\t/* maximum field growth\t\t*/\n  int\t\t\tnrow;\t\t/* off-screen rows\t\t*/\n  short\t\t\tnbuf;\t\t/* additional buffers\t\t*/\n  short\t\t\tjust;\t\t/* justification\t\t*/\n  short\t\t\tpage;\t\t/* page on form\t\t\t*/\n  short\t\t\tindex;\t\t/* into form -> field\t\t*/\n  int\t\t\tpad;\t\t/* pad character\t\t*/\n  chtype\t\tfore;\t\t/* foreground attribute\t\t*/\n  chtype\t\tback;\t\t/* background attribute\t\t*/\n  Field_Options\t\topts;\t\t/* options\t\t\t*/\n  struct fieldnode *\tsnext;\t\t/* sorted order pointer\t\t*/\n  struct fieldnode *\tsprev;\t\t/* sorted order pointer\t\t*/\n  struct fieldnode *\tlink;\t\t/* linked field chain\t\t*/\n  struct formnode *\tform;\t\t/* containing form\t\t*/\n  struct typenode *\ttype;\t\t/* field type\t\t\t*/\n  void *\t\targ;\t\t/* argument for type\t\t*/\n  FIELD_CELL *\t\tbuf;\t\t/* field buffers\t\t*/\n  void *\t\tusrptr;\t\t/* user pointer\t\t\t*/\n  /*\n   * The wide-character configuration requires extra information.  Because\n   * there are existing applications that manipulate the members of FIELD\n   * directly, we cannot make the struct opaque.  Offsets of members up to\n   * this point are the same in the narrow- and wide-character configuration.\n   * But note that the type of buf depends on the configuration, and is made\n   * opaque for that reason.\n   */\n  NCURSES_FIELD_INTERNALS\n} FIELD;\n\n\t/**************\n\t*  FIELDTYPE  *\n\t**************/\n\ntypedef struct typenode {\n  unsigned short\tstatus;\t\t\t/* flags\t\t*/\n  long\t\t\tref;\t\t\t/* reference count\t*/\n  struct typenode *\tleft;\t\t\t/* ptr to operand for | */\n  struct typenode *\tright;\t\t\t/* ptr to operand for | */\n\n  void* (*makearg)(va_list *);\t\t\t/* make fieldtype arg\t*/\n  void* (*copyarg)(const void *);\t\t/* copy fieldtype arg\t*/\n  void\t(*freearg)(void *);\t\t\t/* free fieldtype arg\t*/\n\n  bool\t(*fcheck)(FIELD *,const void *);\t/* field validation\t*/\n  bool\t(*ccheck)(int,const void *);\t\t/* character validation */\n\n  bool\t(*next)(FIELD *,const void *);\t\t/* enumerate next value */\n  bool\t(*prev)(FIELD *,const void *);\t\t/* enumerate prev value */\n\n} FIELDTYPE;\n\n\t/*********\n\t*  FORM  *\n\t*********/\n\ntypedef struct formnode {\n  unsigned short\tstatus;\t\t/* flags\t\t\t*/\n  short\t\t\trows;\t\t/* size in rows\t\t\t*/\n  short\t\t\tcols;\t\t/* size in cols\t\t\t*/\n  int\t\t\tcurrow;\t\t/* current row in field window\t*/\n  int\t\t\tcurcol;\t\t/* current col in field window\t*/\n  int\t\t\ttoprow;\t\t/* in scrollable field window\t*/\n  int\t\t\tbegincol;\t/* in horiz. scrollable field\t*/\n  short\t\t\tmaxfield;\t/* number of fields\t\t*/\n  short\t\t\tmaxpage;\t/* number of pages\t\t*/\n  short\t\t\tcurpage;\t/* index into page\t\t*/\n  Form_Options\t\topts;\t\t/* options\t\t\t*/\n  WINDOW *\t\twin;\t\t/* window\t\t\t*/\n  WINDOW *\t\tsub;\t\t/* subwindow\t\t\t*/\n  WINDOW *\t\tw;\t\t/* window for current field\t*/\n  FIELD **\t\tfield;\t\t/* field [maxfield]\t\t*/\n  FIELD *\t\tcurrent;\t/* current field\t\t*/\n  _PAGE *\t\tpage;\t\t/* page [maxpage]\t\t*/\n  void *\t\tusrptr;\t\t/* user pointer\t\t\t*/\n\n  void\t\t\t(*forminit)(struct formnode *);\n  void\t\t\t(*formterm)(struct formnode *);\n  void\t\t\t(*fieldinit)(struct formnode *);\n  void\t\t\t(*fieldterm)(struct formnode *);\n\n} FORM;\n\ntypedef void (*Form_Hook)(FORM *);\n\n\t/***************************\n\t*  miscellaneous #defines  *\n\t***************************/\n\n/* field justification */\n#define NO_JUSTIFICATION\t(0)\n#define JUSTIFY_LEFT\t\t(1)\n#define JUSTIFY_CENTER\t\t(2)\n#define JUSTIFY_RIGHT\t\t(3)\n\n/* field options */\n#define O_VISIBLE\t\t(0x0001U)\n#define O_ACTIVE\t\t(0x0002U)\n#define O_PUBLIC\t\t(0x0004U)\n#define O_EDIT\t\t\t(0x0008U)\n#define O_WRAP\t\t\t(0x0010U)\n#define O_BLANK\t\t\t(0x0020U)\n#define O_AUTOSKIP\t\t(0x0040U)\n#define O_NULLOK\t\t(0x0080U)\n#define O_PASSOK\t\t(0x0100U)\n#define O_STATIC\t\t(0x0200U)\n\n/* form options */\n#define O_NL_OVERLOAD\t\t(0x0001U)\n#define O_BS_OVERLOAD\t\t(0x0002U)\n\n/* form driver commands */\n#define REQ_NEXT_PAGE\t (KEY_MAX + 1)\t/* move to next page\t\t*/\n#define REQ_PREV_PAGE\t (KEY_MAX + 2)\t/* move to previous page\t*/\n#define REQ_FIRST_PAGE\t (KEY_MAX + 3)\t/* move to first page\t\t*/\n#define REQ_LAST_PAGE\t (KEY_MAX + 4)\t/* move to last page\t\t*/\n\n#define REQ_NEXT_FIELD\t (KEY_MAX + 5)\t/* move to next field\t\t*/\n#define REQ_PREV_FIELD\t (KEY_MAX + 6)\t/* move to previous field\t*/\n#define REQ_FIRST_FIELD\t (KEY_MAX + 7)\t/* move to first field\t\t*/\n#define REQ_LAST_FIELD\t (KEY_MAX + 8)\t/* move to last field\t\t*/\n#define REQ_SNEXT_FIELD\t (KEY_MAX + 9)\t/* move to sorted next field\t*/\n#define REQ_SPREV_FIELD\t (KEY_MAX + 10)\t/* move to sorted prev field\t*/\n#define REQ_SFIRST_FIELD (KEY_MAX + 11)\t/* move to sorted first field\t*/\n#define REQ_SLAST_FIELD\t (KEY_MAX + 12)\t/* move to sorted last field\t*/\n#define REQ_LEFT_FIELD\t (KEY_MAX + 13)\t/* move to left to field\t*/\n#define REQ_RIGHT_FIELD\t (KEY_MAX + 14)\t/* move to right to field\t*/\n#define REQ_UP_FIELD\t (KEY_MAX + 15)\t/* move to up to field\t\t*/\n#define REQ_DOWN_FIELD\t (KEY_MAX + 16)\t/* move to down to field\t*/\n\n#define REQ_NEXT_CHAR\t (KEY_MAX + 17)\t/* move to next char in field\t*/\n#define REQ_PREV_CHAR\t (KEY_MAX + 18)\t/* move to prev char in field\t*/\n#define REQ_NEXT_LINE\t (KEY_MAX + 19)\t/* move to next line in field\t*/\n#define REQ_PREV_LINE\t (KEY_MAX + 20)\t/* move to prev line in field\t*/\n#define REQ_NEXT_WORD\t (KEY_MAX + 21)\t/* move to next word in field\t*/\n#define REQ_PREV_WORD\t (KEY_MAX + 22)\t/* move to prev word in field\t*/\n#define REQ_BEG_FIELD\t (KEY_MAX + 23)\t/* move to first char in field\t*/\n#define REQ_END_FIELD\t (KEY_MAX + 24)\t/* move after last char in fld\t*/\n#define REQ_BEG_LINE\t (KEY_MAX + 25)\t/* move to beginning of line\t*/\n#define REQ_END_LINE\t (KEY_MAX + 26)\t/* move after last char in line\t*/\n#define REQ_LEFT_CHAR\t (KEY_MAX + 27)\t/* move left in field\t\t*/\n#define REQ_RIGHT_CHAR\t (KEY_MAX + 28)\t/* move right in field\t\t*/\n#define REQ_UP_CHAR\t (KEY_MAX + 29)\t/* move up in field\t\t*/\n#define REQ_DOWN_CHAR\t (KEY_MAX + 30)\t/* move down in field\t\t*/\n\n#define REQ_NEW_LINE\t (KEY_MAX + 31)\t/* insert/overlay new line\t*/\n#define REQ_INS_CHAR\t (KEY_MAX + 32)\t/* insert blank char at cursor\t*/\n#define REQ_INS_LINE\t (KEY_MAX + 33)\t/* insert blank line at cursor\t*/\n#define REQ_DEL_CHAR\t (KEY_MAX + 34)\t/* delete char at cursor\t*/\n#define REQ_DEL_PREV\t (KEY_MAX + 35)\t/* delete char before cursor\t*/\n#define REQ_DEL_LINE\t (KEY_MAX + 36)\t/* delete line at cursor\t*/\n#define REQ_DEL_WORD\t (KEY_MAX + 37)\t/* delete word at cursor\t*/\n#define REQ_CLR_EOL\t (KEY_MAX + 38)\t/* clear to end of line\t\t*/\n#define REQ_CLR_EOF\t (KEY_MAX + 39)\t/* clear to end of field\t*/\n#define REQ_CLR_FIELD\t (KEY_MAX + 40)\t/* clear entire field\t\t*/\n#define REQ_OVL_MODE\t (KEY_MAX + 41)\t/* begin overlay mode\t\t*/\n#define REQ_INS_MODE\t (KEY_MAX + 42)\t/* begin insert mode\t\t*/\n#define REQ_SCR_FLINE\t (KEY_MAX + 43)\t/* scroll field forward a line\t*/\n#define REQ_SCR_BLINE\t (KEY_MAX + 44)\t/* scroll field backward a line\t*/\n#define REQ_SCR_FPAGE\t (KEY_MAX + 45)\t/* scroll field forward a page\t*/\n#define REQ_SCR_BPAGE\t (KEY_MAX + 46)\t/* scroll field backward a page\t*/\n#define REQ_SCR_FHPAGE\t (KEY_MAX + 47) /* scroll field forward\t half page */\n#define REQ_SCR_BHPAGE\t (KEY_MAX + 48) /* scroll field backward half page */\n#define REQ_SCR_FCHAR\t (KEY_MAX + 49) /* horizontal scroll char\t*/\n#define REQ_SCR_BCHAR\t (KEY_MAX + 50) /* horizontal scroll char\t*/\n#define REQ_SCR_HFLINE\t (KEY_MAX + 51) /* horizontal scroll line\t*/\n#define REQ_SCR_HBLINE\t (KEY_MAX + 52) /* horizontal scroll line\t*/\n#define REQ_SCR_HFHALF\t (KEY_MAX + 53) /* horizontal scroll half line\t*/\n#define REQ_SCR_HBHALF\t (KEY_MAX + 54) /* horizontal scroll half line\t*/\n\n#define REQ_VALIDATION\t (KEY_MAX + 55)\t/* validate field\t\t*/\n#define REQ_NEXT_CHOICE\t (KEY_MAX + 56)\t/* display next field choice\t*/\n#define REQ_PREV_CHOICE\t (KEY_MAX + 57)\t/* display prev field choice\t*/\n\n#define MIN_FORM_COMMAND (KEY_MAX + 1)\t/* used by form_driver\t\t*/\n#define MAX_FORM_COMMAND (KEY_MAX + 57)\t/* used by form_driver\t\t*/\n\n#if defined(MAX_COMMAND)\n#  if (MAX_FORM_COMMAND > MAX_COMMAND)\n#    error Something is wrong -- MAX_FORM_COMMAND is greater than MAX_COMMAND\n#  elif (MAX_COMMAND != (KEY_MAX + 128))\n#    error Something is wrong -- MAX_COMMAND is already inconsistently defined.\n#  endif\n#else\n#  define MAX_COMMAND (KEY_MAX + 128)\n#endif\n\n\t/*************************\n\t*  standard field types  *\n\t*************************/\nextern NCURSES_EXPORT_VAR(FIELDTYPE *) TYPE_ALPHA;\nextern NCURSES_EXPORT_VAR(FIELDTYPE *) TYPE_ALNUM;\nextern NCURSES_EXPORT_VAR(FIELDTYPE *) TYPE_ENUM;\nextern NCURSES_EXPORT_VAR(FIELDTYPE *) TYPE_INTEGER;\nextern NCURSES_EXPORT_VAR(FIELDTYPE *) TYPE_NUMERIC;\nextern NCURSES_EXPORT_VAR(FIELDTYPE *) TYPE_REGEXP;\n\n\t/************************************\n\t*  built-in additional field types  *\n\t*  They are not defined in SVr4     *\n\t************************************/\nextern NCURSES_EXPORT_VAR(FIELDTYPE *) TYPE_IPV4;      /* Internet IP Version 4 address */\n\n\t/***********************\n\t*   Default objects    *\n\t***********************/\nextern NCURSES_EXPORT_VAR(FORM *)\t_nc_Default_Form;\nextern NCURSES_EXPORT_VAR(FIELD *)\t_nc_Default_Field;\n\n\n\t/***********************\n\t*  FIELDTYPE routines  *\n\t***********************/\nextern NCURSES_EXPORT(FIELDTYPE *) new_fieldtype (\n\t\t    bool (* const field_check)(FIELD *,const void *),\n\t\t    bool (* const char_check)(int,const void *));\nextern NCURSES_EXPORT(FIELDTYPE *) link_fieldtype(\n\t\t    FIELDTYPE *, FIELDTYPE *);\n\nextern NCURSES_EXPORT(int)\tfree_fieldtype (FIELDTYPE *);\nextern NCURSES_EXPORT(int)\tset_fieldtype_arg (FIELDTYPE *,\n\t\t    void * (* const make_arg)(va_list *),\n\t\t    void * (* const copy_arg)(const void *),\n\t\t    void (* const free_arg)(void *));\nextern NCURSES_EXPORT(int)\t set_fieldtype_choice (FIELDTYPE *,\n\t\t    bool (* const next_choice)(FIELD *,const void *),\n\t      \t    bool (* const prev_choice)(FIELD *,const void *));\n\n\t/*******************\n\t*  FIELD routines  *\n\t*******************/\nextern NCURSES_EXPORT(FIELD *)\tnew_field (int,int,int,int,int,int);\nextern NCURSES_EXPORT(FIELD *)\tdup_field (FIELD *,int,int);\nextern NCURSES_EXPORT(FIELD *)\tlink_field (FIELD *,int,int);\n\nextern NCURSES_EXPORT(int)\tfree_field (FIELD *);\nextern NCURSES_EXPORT(int)\tfield_info (const FIELD *,int *,int *,int *,int *,int *,int *);\nextern NCURSES_EXPORT(int)\tdynamic_field_info (const FIELD *,int *,int *,int *);\nextern NCURSES_EXPORT(int)\tset_max_field ( FIELD *,int);\nextern NCURSES_EXPORT(int)\tmove_field (FIELD *,int,int);\nextern NCURSES_EXPORT(int)\tset_field_type (FIELD *,FIELDTYPE *,...);\nextern NCURSES_EXPORT(int)\tset_new_page (FIELD *,bool);\nextern NCURSES_EXPORT(int)\tset_field_just (FIELD *,int);\nextern NCURSES_EXPORT(int)\tfield_just (const FIELD *);\nextern NCURSES_EXPORT(int)\tset_field_fore (FIELD *,chtype);\nextern NCURSES_EXPORT(int)\tset_field_back (FIELD *,chtype);\nextern NCURSES_EXPORT(int)\tset_field_pad (FIELD *,int);\nextern NCURSES_EXPORT(int)\tfield_pad (const FIELD *);\nextern NCURSES_EXPORT(int)\tset_field_buffer (FIELD *,int,const char *);\nextern NCURSES_EXPORT(int)\tset_field_status (FIELD *,bool);\nextern NCURSES_EXPORT(int)\tset_field_userptr (FIELD *, void *);\nextern NCURSES_EXPORT(int)\tset_field_opts (FIELD *,Field_Options);\nextern NCURSES_EXPORT(int)\tfield_opts_on (FIELD *,Field_Options);\nextern NCURSES_EXPORT(int)\tfield_opts_off (FIELD *,Field_Options);\n\nextern NCURSES_EXPORT(chtype)\tfield_fore (const FIELD *);\nextern NCURSES_EXPORT(chtype)\tfield_back (const FIELD *);\n\nextern NCURSES_EXPORT(bool)\tnew_page (const FIELD *);\nextern NCURSES_EXPORT(bool)\tfield_status (const FIELD *);\n\nextern NCURSES_EXPORT(void *)\tfield_arg (const FIELD *);\n\nextern NCURSES_EXPORT(void *)\tfield_userptr (const FIELD *);\n\nextern NCURSES_EXPORT(FIELDTYPE *)\tfield_type (const FIELD *);\n\nextern NCURSES_EXPORT(char *)\tfield_buffer (const FIELD *,int);\n\nextern NCURSES_EXPORT(Field_Options)\tfield_opts (const FIELD *);\n\n\t/******************\n\t*  FORM routines  *\n\t******************/\n\nextern NCURSES_EXPORT(FORM *)\tnew_form (FIELD **);\n\nextern NCURSES_EXPORT(FIELD **)\tform_fields (const FORM *);\nextern NCURSES_EXPORT(FIELD *)\tcurrent_field (const FORM *);\n\nextern NCURSES_EXPORT(WINDOW *)\tform_win (const FORM *);\nextern NCURSES_EXPORT(WINDOW *)\tform_sub (const FORM *);\n\nextern NCURSES_EXPORT(Form_Hook)\tform_init (const FORM *);\nextern NCURSES_EXPORT(Form_Hook)\tform_term (const FORM *);\nextern NCURSES_EXPORT(Form_Hook)\tfield_init (const FORM *);\nextern NCURSES_EXPORT(Form_Hook)\tfield_term (const FORM *);\n\nextern NCURSES_EXPORT(int)\tfree_form (FORM *);\nextern NCURSES_EXPORT(int)\tset_form_fields (FORM *,FIELD **);\nextern NCURSES_EXPORT(int)\tfield_count (const FORM *);\nextern NCURSES_EXPORT(int)\tset_form_win (FORM *,WINDOW *);\nextern NCURSES_EXPORT(int)\tset_form_sub (FORM *,WINDOW *);\nextern NCURSES_EXPORT(int)\tset_current_field (FORM *,FIELD *);\nextern NCURSES_EXPORT(int)\tfield_index (const FIELD *);\nextern NCURSES_EXPORT(int)\tset_form_page (FORM *,int);\nextern NCURSES_EXPORT(int)\tform_page (const FORM *);\nextern NCURSES_EXPORT(int)\tscale_form (const FORM *,int *,int *);\nextern NCURSES_EXPORT(int)\tset_form_init (FORM *,Form_Hook);\nextern NCURSES_EXPORT(int)\tset_form_term (FORM *,Form_Hook);\nextern NCURSES_EXPORT(int)\tset_field_init (FORM *,Form_Hook);\nextern NCURSES_EXPORT(int)\tset_field_term (FORM *,Form_Hook);\nextern NCURSES_EXPORT(int)\tpost_form (FORM *);\nextern NCURSES_EXPORT(int)\tunpost_form (FORM *);\nextern NCURSES_EXPORT(int)\tpos_form_cursor (FORM *);\nextern NCURSES_EXPORT(int)\tform_driver (FORM *,int);\nextern NCURSES_EXPORT(int)\tset_form_userptr (FORM *,void *);\nextern NCURSES_EXPORT(int)\tset_form_opts (FORM *,Form_Options);\nextern NCURSES_EXPORT(int)\tform_opts_on (FORM *,Form_Options);\nextern NCURSES_EXPORT(int)\tform_opts_off (FORM *,Form_Options);\nextern NCURSES_EXPORT(int)\tform_request_by_name (const char *);\n\nextern NCURSES_EXPORT(const char *)\tform_request_name (int);\n\nextern NCURSES_EXPORT(void *)\tform_userptr (const FORM *);\n\nextern NCURSES_EXPORT(Form_Options)\tform_opts (const FORM *);\n\nextern NCURSES_EXPORT(bool)\tdata_ahead (const FORM *);\nextern NCURSES_EXPORT(bool)\tdata_behind (const FORM *);\n\n#ifdef __cplusplus\n  }\n#endif\n\n#endif\t/* FORM_H */\n"
  },
  {
    "path": "freebsd-headers/fs/devfs/devfs.h",
    "content": "/*-\n * Copyright (c) 1992, 1993\n *\tThe Regents of the University of California.  All rights reserved.\n * Copyright (c) 2000\n *\tPoul-Henning Kamp.  All rights reserved.\n * Copyright (c) 2002\n *\tDima Dorfman.  All rights reserved.\n *\n * This code is derived from software donated to Berkeley by\n * Jan-Simon Pendry.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t@(#)kernfs.h\t8.6 (Berkeley) 3/29/95\n * From: FreeBSD: src/sys/miscfs/kernfs/kernfs.h 1.14\n *\n * $FreeBSD: release/9.0.0/sys/fs/devfs/devfs.h 213725 2010-10-12 15:58:52Z jh $\n */\n\n#ifndef _FS_DEVFS_DEVFS_H_\n#define\t_FS_DEVFS_DEVFS_H_\n\n#define\tDEVFS_MAGIC\t0xdb0a087a\n\n/*\n * Identifiers.  The ruleset and rule numbers are 16-bit values.  The\n * \"rule ID\" is a combination of the ruleset and rule number; it\n * should be able to univocally describe a rule in the system.  In\n * this implementation, the upper 16 bits of the rule ID is the\n * ruleset number; the lower 16 bits, the rule number within the\n * aforementioned ruleset.\n */\ntypedef uint16_t devfs_rnum;\ntypedef uint16_t devfs_rsnum;\ntypedef uint32_t devfs_rid;\n\n/*\n * Identifier manipulators.\n */\n#define\trid2rsn(rid)\t((rid) >> 16)\n#define\trid2rn(rid)\t((rid) & 0xffff)\n#define\tmkrid(rsn, rn)\t((rn) | ((rsn) << 16))\n\n/*\n * Plain DEVFS rule.  This gets shared between kernel and userland\n * verbatim, so it shouldn't contain any pointers or other kernel- or\n * userland-specific values.\n */\nstruct devfs_rule {\n\tuint32_t dr_magic;\t\t\t/* Magic number. */\n\tdevfs_rid dr_id;\t\t\t/* Identifier. */\n\n\t/*\n\t * Conditions under which this rule should be applied.  These\n\t * are ANDed together since OR can be simulated by using\n\t * multiple rules.  dr_icond determines which of the other\n\t * variables we should process.\n\t */\n\tint\tdr_icond;\n#define\tDRC_DSWFLAGS\t0x001\n#define\tDRC_PATHPTRN\t0x002\n\tint\tdr_dswflags;\t\t\t/* cdevsw flags to match. */\n#define\tDEVFS_MAXPTRNLEN\t200\n\tchar\tdr_pathptrn[DEVFS_MAXPTRNLEN];\t/* Pattern to match path. */\n\n\t/*\n\t * Things to change.  dr_iacts determines which of the other\n\t * variables we should process.\n\t */\n\tint\tdr_iacts;\n#define\tDRA_BACTS\t0x001\n#define\tDRA_UID\t\t0x002\n#define\tDRA_GID\t\t0x004\n#define\tDRA_MODE\t0x008\n#define\tDRA_INCSET\t0x010\n\tint\tdr_bacts;\t\t\t/* Boolean (on/off) action. */\n#define\tDRB_HIDE\t0x001\t\t\t/* Hide entry (DE_WHITEOUT). */\n#define\tDRB_UNHIDE\t0x002\t\t\t/* Unhide entry. */\n\tuid_t\tdr_uid;\n\tgid_t\tdr_gid;\n\tmode_t\tdr_mode;\n\tdevfs_rsnum dr_incset;\t\t\t/* Included ruleset. */\n};\n\n/*\n * Rule-related ioctls.\n */\n#define\tDEVFSIO_RADD\t\t_IOWR('D', 0, struct devfs_rule)\n#define\tDEVFSIO_RDEL\t\t_IOW('D', 1, devfs_rid)\n#define\tDEVFSIO_RAPPLY\t\t_IOW('D', 2, struct devfs_rule)\n#define\tDEVFSIO_RAPPLYID\t_IOW('D', 3, devfs_rid)\n#define\tDEVFSIO_RGETNEXT       \t_IOWR('D', 4, struct devfs_rule)\n\n#define\tDEVFSIO_SUSE\t\t_IOW('D', 10, devfs_rsnum)\n#define\tDEVFSIO_SAPPLY\t\t_IOW('D', 11, devfs_rsnum)\n#define\tDEVFSIO_SGETNEXT\t_IOWR('D', 12, devfs_rsnum)\n\n/* XXX: DEVFSIO_RS_GET_INFO for refcount, active if any, etc. */\n\n#ifdef _KERNEL\n\n#ifdef MALLOC_DECLARE\nMALLOC_DECLARE(M_DEVFS);\n#endif\n\nstruct componentname;\n\nTAILQ_HEAD(devfs_dlist_head, devfs_dirent);\n\nstruct devfs_dirent {\n\tstruct cdev_priv\t*de_cdp;\n\tint\t\t\tde_inode;\n\tint\t\t\tde_flags;\n#define\tDE_WHITEOUT\t0x01\n#define\tDE_DOT\t\t0x02\n#define\tDE_DOTDOT\t0x04\n#define\tDE_DOOMED\t0x08\n#define\tDE_COVERED\t0x10\n#define\tDE_USER\t\t0x20\n\tint\t\t\tde_holdcnt;\n\tstruct dirent \t\t*de_dirent;\n\tTAILQ_ENTRY(devfs_dirent) de_list;\n\tstruct devfs_dlist_head\tde_dlist;\n\tstruct devfs_dirent\t*de_dir;\n\tint\t\t\tde_links;\n\tmode_t\t\t\tde_mode;\n\tuid_t\t\t\tde_uid;\n\tgid_t\t\t\tde_gid;\n\tstruct label\t\t*de_label;\n\tstruct timespec \tde_atime;\n\tstruct timespec \tde_mtime;\n\tstruct timespec \tde_ctime;\n\tstruct vnode \t\t*de_vnode;\n\tchar \t\t\t*de_symlink;\n};\n\nstruct devfs_mount {\n\tu_int\t\t\tdm_idx;\n\tstruct mount\t\t*dm_mount;\n\tstruct devfs_dirent\t*dm_rootdir;\n\tunsigned\t\tdm_generation;\n\tint\t\t\tdm_holdcnt;\n\tstruct sx\t\tdm_lock;\n\tdevfs_rsnum\t\tdm_ruleset;\n};\n\n#define DEVFS_ROOTINO 2\n\nextern unsigned devfs_rule_depth;\n\n#define VFSTODEVFS(mp)\t((struct devfs_mount *)((mp)->mnt_data))\n\n#define DEVFS_DE_HOLD(de)\t((de)->de_holdcnt++)\n#define DEVFS_DE_DROP(de)\t(--(de)->de_holdcnt == 0)\n\n#define DEVFS_DMP_HOLD(dmp)\t((dmp)->dm_holdcnt++)\n#define DEVFS_DMP_DROP(dmp)\t(--(dmp)->dm_holdcnt == 0)\n\n#define\tDEVFS_DEL_VNLOCKED\t0x01\n#define\tDEVFS_DEL_NORECURSE\t0x02\n\nvoid\tdevfs_rules_apply(struct devfs_mount *, struct devfs_dirent *);\nvoid\tdevfs_rules_cleanup(struct devfs_mount *);\nint\tdevfs_rules_ioctl(struct devfs_mount *, u_long, caddr_t,\n\t    struct thread *);\nint\tdevfs_allocv(struct devfs_dirent *, struct mount *, int,\n\t    struct vnode **);\nchar\t*devfs_fqpn(char *, struct devfs_mount *, struct devfs_dirent *,\n\t    struct componentname *);\nvoid\tdevfs_delete(struct devfs_mount *, struct devfs_dirent *, int);\nvoid\tdevfs_dirent_free(struct devfs_dirent *);\nvoid\tdevfs_populate(struct devfs_mount *);\nvoid\tdevfs_cleanup(struct devfs_mount *);\nvoid\tdevfs_unmount_final(struct devfs_mount *);\nstruct devfs_dirent\t*devfs_newdirent(char *, int);\nstruct devfs_dirent\t*devfs_parent_dirent(struct devfs_dirent *);\nstruct devfs_dirent\t*devfs_vmkdir(struct devfs_mount *, char *, int,\n\t\t\t    struct devfs_dirent *, u_int);\nstruct devfs_dirent\t*devfs_find(struct devfs_dirent *, const char *, int,\n\t\t\t    int);\n\n#endif /* _KERNEL */\n\n#endif /* !_FS_DEVFS_DEVFS_H_ */\n"
  },
  {
    "path": "freebsd-headers/fs/devfs/devfs_int.h",
    "content": "/*-\n * Copyright (c) 2005 Poul-Henning Kamp.  All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/fs/devfs/devfs_int.h 213725 2010-10-12 15:58:52Z jh $\n */\n\n/*\n * This file documents a private interface and it SHALL only be used\n * by kern/kern_conf.c and fs/devfs/...\n */\n\n#ifndef _FS_DEVFS_DEVFS_INT_H_\n#define\t_FS_DEVFS_DEVFS_INT_H_\n\n#include <sys/queue.h>\n\n#ifdef _KERNEL\n\nstruct devfs_dirent;\nstruct devfs_mount;\n\nstruct cdev_privdata {\n\tstruct file\t\t*cdpd_fp;\n\tvoid\t\t\t*cdpd_data;\n\tvoid\t\t\t(*cdpd_dtr)(void *);\n\tLIST_ENTRY(cdev_privdata) cdpd_list;\n};\n\nstruct cdev_priv {\n\tstruct cdev\t\tcdp_c;\n\tTAILQ_ENTRY(cdev_priv)\tcdp_list;\n\n\tu_int\t\t\tcdp_inode;\n\n\tu_int\t\t\tcdp_flags;\n#define CDP_ACTIVE\t\t(1 << 0)\n#define CDP_SCHED_DTR\t\t(1 << 1)\n\n\tu_int\t\t\tcdp_inuse;\n\tu_int\t\t\tcdp_maxdirent;\n\tstruct devfs_dirent\t**cdp_dirents;\n\tstruct devfs_dirent\t*cdp_dirent0;\n\n\tTAILQ_ENTRY(cdev_priv)\tcdp_dtr_list;\n\tvoid\t\t\t(*cdp_dtr_cb)(void *);\n\tvoid\t\t\t*cdp_dtr_cb_arg;\n\n\tLIST_HEAD(, cdev_privdata) cdp_fdpriv;\n};\n\n#define\tcdev2priv(c)\tmember2struct(cdev_priv, cdp_c, c)\n\nstruct cdev\t*devfs_alloc(int);\nint\tdevfs_dev_exists(const char *);\nvoid\tdevfs_free(struct cdev *);\nvoid\tdevfs_create(struct cdev *);\nvoid\tdevfs_destroy(struct cdev *);\nvoid\tdevfs_destroy_cdevpriv(struct cdev_privdata *);\n\nint\tdevfs_dir_find(const char *);\nvoid\tdevfs_dir_ref_de(struct devfs_mount *, struct devfs_dirent *);\nvoid\tdevfs_dir_unref_de(struct devfs_mount *, struct devfs_dirent *);\nint\tdevfs_pathpath(const char *, const char *);\n\nextern struct unrhdr *devfs_inos;\nextern struct mtx devmtx;\nextern struct mtx devfs_de_interlock;\nextern struct sx clone_drain_lock;\nextern struct mtx cdevpriv_mtx;\nextern TAILQ_HEAD(cdev_priv_list, cdev_priv) cdevp_list;\n\n#endif /* _KERNEL */\n\n#endif /* !_FS_DEVFS_DEVFS_INT_H_ */\n"
  },
  {
    "path": "freebsd-headers/fs/fdescfs/fdesc.h",
    "content": "/*-\n * Copyright (c) 1992, 1993\n *\tThe Regents of the University of California.  All rights reserved.\n *\n * This code is derived from software donated to Berkeley by\n * Jan-Simon Pendry.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 4. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t@(#)fdesc.h\t8.5 (Berkeley) 1/21/94\n *\n * $FreeBSD: release/9.0.0/sys/fs/fdescfs/fdesc.h 191990 2009-05-11 15:33:26Z attilio $\n */\n\n#ifdef _KERNEL\n/* Private mount flags for fdescfs. */\n#define FMNT_UNMOUNTF 0x01\nstruct fdescmount {\n\tstruct vnode\t*f_root;\t/* Root node */\n\tint flags;\n};\n\n#define FD_ROOT\t\t1\n#define FD_DESC\t\t3\n\ntypedef enum {\n\tFroot,\n\tFdesc\n} fdntype;\n\nstruct fdescnode {\n\tLIST_ENTRY(fdescnode) fd_hash;\t/* Hash list */\n\tstruct vnode\t*fd_vnode;\t/* Back ptr to vnode */\n\tfdntype\t\tfd_type;\t/* Type of this node */\n\tunsigned\tfd_fd;\t\t/* Fd to be dup'ed */\n\tint\t\tfd_ix;\t\t/* filesystem index */\n};\n\nextern struct mtx fdesc_hashmtx;\n#define VFSTOFDESC(mp)\t((struct fdescmount *)((mp)->mnt_data))\n#define\tVTOFDESC(vp) ((struct fdescnode *)(vp)->v_data)\n\nextern vfs_init_t fdesc_init;\nextern vfs_uninit_t fdesc_uninit;\nextern int fdesc_allocvp(fdntype, unsigned, int, struct mount *,\n    struct vnode **);\n#endif /* _KERNEL */\n"
  },
  {
    "path": "freebsd-headers/fs/fifofs/fifo.h",
    "content": "/*-\n * Copyright (c) 1991, 1993\n *\tThe Regents of the University of California.  All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 4. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t@(#)fifo.h\t8.6 (Berkeley) 5/21/95\n * $FreeBSD: release/9.0.0/sys/fs/fifofs/fifo.h 139776 2005-01-06 18:10:42Z imp $\n */\n\n/*\n * Prototypes for fifo operations on vnodes.\n */\nint\tfifo_vnoperate(struct vop_generic_args *);\nint\tfifo_printinfo(struct vnode *);\n\n"
  },
  {
    "path": "freebsd-headers/fs/msdosfs/bootsect.h",
    "content": "/* $FreeBSD: release/9.0.0/sys/fs/msdosfs/bootsect.h 203827 2010-02-13 12:41:07Z kib $ */\n/*\t$NetBSD: bootsect.h,v 1.9 1997/11/17 15:36:17 ws Exp $\t*/\n\n/*-\n * Written by Paul Popelka (paulp@uts.amdahl.com)\n *\n * You can do anything you want with this software, just don't say you wrote\n * it, and don't remove this notice.\n *\n * This software is provided \"as is\".\n *\n * The author supplies this software to be publicly redistributed on the\n * understanding that the author is not responsible for the correct\n * functioning of this software in any circumstances and is not liable for\n * any damages caused by this software.\n *\n * October 1992\n */\n#ifndef _FS_MSDOSFS_BOOTSECT_H_\n#define\t_FS_MSDOSFS_BOOTSECT_H_\n\n/*\n * Format of a boot sector.  This is the first sector on a DOS floppy disk\n * or the fist sector of a partition on a hard disk.  But, it is not the\n * first sector of a partitioned hard disk.\n */\nstruct bootsector33 {\n\tu_int8_t\tbsJump[3];\t\t/* jump inst E9xxxx or EBxx90 */\n\tint8_t\t\tbsOemName[8];\t\t/* OEM name and version */\n\tint8_t\t\tbsBPB[19];\t\t/* BIOS parameter block */\n\tint8_t\t\tbsDriveNumber;\t\t/* drive number (0x80) */\n\tint8_t\t\tbsBootCode[479];\t/* pad so struct is 512b */\n\tu_int8_t\tbsBootSectSig0;\n\tu_int8_t\tbsBootSectSig1;\n#define\tBOOTSIG0\t0x55\n#define\tBOOTSIG1\t0xaa\n};\n\nstruct extboot {\n\tint8_t\t\texDriveNumber;\t\t/* drive number (0x80) */\n\tint8_t\t\texReserved1;\t\t/* reserved */\n\tint8_t\t\texBootSignature;\t/* ext. boot signature (0x29) */\n#define\tEXBOOTSIG\t0x29\n\tint8_t\t\texVolumeID[4];\t\t/* volume ID number */\n\tint8_t\t\texVolumeLabel[11];\t/* volume label */\n\tint8_t\t\texFileSysType[8];\t/* fs type (FAT12 or FAT16) */\n};\n\nstruct bootsector50 {\n\tu_int8_t\tbsJump[3];\t\t/* jump inst E9xxxx or EBxx90 */\n\tint8_t\t\tbsOemName[8];\t\t/* OEM name and version */\n\tint8_t\t\tbsBPB[25];\t\t/* BIOS parameter block */\n\tint8_t\t\tbsExt[26];\t\t/* Bootsector Extension */\n\tint8_t\t\tbsBootCode[448];\t/* pad so structure is 512b */\n\tu_int8_t\tbsBootSectSig0;\n\tu_int8_t\tbsBootSectSig1;\n#define\tBOOTSIG0\t0x55\n#define\tBOOTSIG1\t0xaa\n};\n\nstruct bootsector710 {\n\tu_int8_t\tbsJump[3];\t\t/* jump inst E9xxxx or EBxx90 */\n\tint8_t\t\tbsOEMName[8];\t\t/* OEM name and version */\n\tint8_t\t\tbsBPB[53];\t\t/* BIOS parameter block */\n\tint8_t\t\tbsExt[26];\t\t/* Bootsector Extension */\n\tint8_t\t\tbsBootCode[420];\t/* pad so structure is 512b */\n\tu_int8_t\tbsBootSectSig0;\n\tu_int8_t\tbsBootSectSig1;\n#define\tBOOTSIG0\t0x55\n#define\tBOOTSIG1\t0xaa\n};\n\nunion bootsector {\n\tstruct bootsector33 bs33;\n\tstruct bootsector50 bs50;\n\tstruct bootsector710 bs710;\n};\n\n#if 0\n/*\n * Shorthand for fields in the bpb.\n */\n#define\tbsBytesPerSec\tbsBPB.bpbBytesPerSec\n#define\tbsSectPerClust\tbsBPB.bpbSectPerClust\n#define\tbsResSectors\tbsBPB.bpbResSectors\n#define\tbsFATS\t\tbsBPB.bpbFATS\n#define\tbsRootDirEnts\tbsBPB.bpbRootDirEnts\n#define\tbsSectors\tbsBPB.bpbSectors\n#define\tbsMedia\t\tbsBPB.bpbMedia\n#define\tbsFATsecs\tbsBPB.bpbFATsecs\n#define\tbsSectPerTrack\tbsBPB.bpbSectPerTrack\n#define\tbsHeads\t\tbsBPB.bpbHeads\n#define\tbsHiddenSecs\tbsBPB.bpbHiddenSecs\n#define\tbsHugeSectors\tbsBPB.bpbHugeSectors\n#endif\n\n#endif /* !_FS_MSDOSFS_BOOTSECT_H_ */\n"
  },
  {
    "path": "freebsd-headers/fs/msdosfs/bpb.h",
    "content": "/* $FreeBSD: release/9.0.0/sys/fs/msdosfs/bpb.h 203827 2010-02-13 12:41:07Z kib $ */\n/*\t$NetBSD: bpb.h,v 1.7 1997/11/17 15:36:24 ws Exp $\t*/\n\n/*-\n * Written by Paul Popelka (paulp@uts.amdahl.com)\n *\n * You can do anything you want with this software, just don't say you wrote\n * it, and don't remove this notice.\n *\n * This software is provided \"as is\".\n *\n * The author supplies this software to be publicly redistributed on the\n * understanding that the author is not responsible for the correct\n * functioning of this software in any circumstances and is not liable for\n * any damages caused by this software.\n *\n * October 1992\n */\n\n#ifndef _FS_MSDOSFS_BPB_H_\n#define\t_FS_MSDOSFS_BPB_H_\n\n/*\n * BIOS Parameter Block (BPB) for DOS 3.3\n */\nstruct bpb33 {\n\tu_int16_t\tbpbBytesPerSec;\t/* bytes per sector */\n\tu_int8_t\tbpbSecPerClust;\t/* sectors per cluster */\n\tu_int16_t\tbpbResSectors;\t/* number of reserved sectors */\n\tu_int8_t\tbpbFATs;\t/* number of FATs */\n\tu_int16_t\tbpbRootDirEnts;\t/* number of root directory entries */\n\tu_int16_t\tbpbSectors;\t/* total number of sectors */\n\tu_int8_t\tbpbMedia;\t/* media descriptor */\n\tu_int16_t\tbpbFATsecs;\t/* number of sectors per FAT */\n\tu_int16_t\tbpbSecPerTrack;\t/* sectors per track */\n\tu_int16_t\tbpbHeads;\t/* number of heads */\n\tu_int16_t\tbpbHiddenSecs;\t/* number of hidden sectors */\n};\n\n/*\n * BPB for DOS 5.0 The difference is bpbHiddenSecs is a short for DOS 3.3,\n * and bpbHugeSectors is not in the 3.3 bpb.\n */\nstruct bpb50 {\n\tu_int16_t\tbpbBytesPerSec;\t/* bytes per sector */\n\tu_int8_t\tbpbSecPerClust;\t/* sectors per cluster */\n\tu_int16_t\tbpbResSectors;\t/* number of reserved sectors */\n\tu_int8_t\tbpbFATs;\t/* number of FATs */\n\tu_int16_t\tbpbRootDirEnts;\t/* number of root directory entries */\n\tu_int16_t\tbpbSectors;\t/* total number of sectors */\n\tu_int8_t\tbpbMedia;\t/* media descriptor */\n\tu_int16_t\tbpbFATsecs;\t/* number of sectors per FAT */\n\tu_int16_t\tbpbSecPerTrack;\t/* sectors per track */\n\tu_int16_t\tbpbHeads;\t/* number of heads */\n\tu_int32_t\tbpbHiddenSecs;\t/* # of hidden sectors */\n\tu_int32_t\tbpbHugeSectors;\t/* # of sectors if bpbSectors == 0 */\n};\n\n/*\n * BPB for DOS 7.10 (FAT32).  This one has a few extensions to bpb50.\n */\nstruct bpb710 {\n\tu_int16_t\tbpbBytesPerSec;\t/* bytes per sector */\n\tu_int8_t\tbpbSecPerClust;\t/* sectors per cluster */\n\tu_int16_t\tbpbResSectors;\t/* number of reserved sectors */\n\tu_int8_t\tbpbFATs;\t/* number of FATs */\n\tu_int16_t\tbpbRootDirEnts;\t/* number of root directory entries */\n\tu_int16_t\tbpbSectors;\t/* total number of sectors */\n\tu_int8_t\tbpbMedia;\t/* media descriptor */\n\tu_int16_t\tbpbFATsecs;\t/* number of sectors per FAT */\n\tu_int16_t\tbpbSecPerTrack;\t/* sectors per track */\n\tu_int16_t\tbpbHeads;\t/* number of heads */\n\tu_int32_t\tbpbHiddenSecs;\t/* # of hidden sectors */\n\tu_int32_t\tbpbHugeSectors;\t/* # of sectors if bpbSectors == 0 */\n\tu_int32_t\tbpbBigFATsecs;\t/* like bpbFATsecs for FAT32 */\n\tu_int16_t\tbpbExtFlags;\t/* extended flags: */\n#define\tFATNUM\t\t0xf\t\t/* mask for numbering active FAT */\n#define\tFATMIRROR\t0x80\t\t/* FAT is mirrored (like it always was) */\n\tu_int16_t\tbpbFSVers;\t/* filesystem version */\n#define\tFSVERS\t\t0\t\t/* currently only 0 is understood */\n\tu_int32_t\tbpbRootClust;\t/* start cluster for root directory */\n\tu_int16_t\tbpbFSInfo;\t/* filesystem info structure sector */\n\tu_int16_t\tbpbBackup;\t/* backup boot sector */\n\tu_int8_t\tbpbReserved[12]; /* reserved for future expansion */\n};\n\n/*\n * The following structures represent how the bpb's look on disk.  shorts\n * and longs are just character arrays of the appropriate length.  This is\n * because the compiler forces shorts and longs to align on word or\n * halfword boundaries.\n */\n\n#include <sys/endian.h>\n\n#define\tgetushort(x)\tle16dec(x)\n#define\tgetulong(x)\tle32dec(x)\n#define\tputushort(p, v)\tle16enc(p, v)\n#define\tputulong(p, v)\tle32enc(p, v)\n\n/*\n * BIOS Parameter Block (BPB) for DOS 3.3\n */\nstruct byte_bpb33 {\n\tint8_t bpbBytesPerSec[2];\t/* bytes per sector */\n\tint8_t bpbSecPerClust;\t\t/* sectors per cluster */\n\tint8_t bpbResSectors[2];\t/* number of reserved sectors */\n\tint8_t bpbFATs;\t\t\t/* number of FATs */\n\tint8_t bpbRootDirEnts[2];\t/* number of root directory entries */\n\tint8_t bpbSectors[2];\t\t/* total number of sectors */\n\tint8_t bpbMedia;\t\t/* media descriptor */\n\tint8_t bpbFATsecs[2];\t\t/* number of sectors per FAT */\n\tint8_t bpbSecPerTrack[2];\t/* sectors per track */\n\tint8_t bpbHeads[2];\t\t/* number of heads */\n\tint8_t bpbHiddenSecs[2];\t/* number of hidden sectors */\n};\n\n/*\n * BPB for DOS 5.0 The difference is bpbHiddenSecs is a short for DOS 3.3,\n * and bpbHugeSectors is not in the 3.3 bpb.\n */\nstruct byte_bpb50 {\n\tint8_t bpbBytesPerSec[2];\t/* bytes per sector */\n\tint8_t bpbSecPerClust;\t\t/* sectors per cluster */\n\tint8_t bpbResSectors[2];\t/* number of reserved sectors */\n\tint8_t bpbFATs;\t\t\t/* number of FATs */\n\tint8_t bpbRootDirEnts[2];\t/* number of root directory entries */\n\tint8_t bpbSectors[2];\t\t/* total number of sectors */\n\tint8_t bpbMedia;\t\t/* media descriptor */\n\tint8_t bpbFATsecs[2];\t\t/* number of sectors per FAT */\n\tint8_t bpbSecPerTrack[2];\t/* sectors per track */\n\tint8_t bpbHeads[2];\t\t/* number of heads */\n\tint8_t bpbHiddenSecs[4];\t/* number of hidden sectors */\n\tint8_t bpbHugeSectors[4];\t/* # of sectors if bpbSectors == 0 */\n};\n\n/*\n * BPB for DOS 7.10 (FAT32).  This one has a few extensions to bpb50.\n */\nstruct byte_bpb710 {\n\tu_int8_t bpbBytesPerSec[2];\t/* bytes per sector */\n\tu_int8_t bpbSecPerClust;\t/* sectors per cluster */\n\tu_int8_t bpbResSectors[2];\t/* number of reserved sectors */\n\tu_int8_t bpbFATs;\t\t/* number of FATs */\n\tu_int8_t bpbRootDirEnts[2];\t/* number of root directory entries */\n\tu_int8_t bpbSectors[2];\t\t/* total number of sectors */\n\tu_int8_t bpbMedia;\t\t/* media descriptor */\n\tu_int8_t bpbFATsecs[2];\t\t/* number of sectors per FAT */\n\tu_int8_t bpbSecPerTrack[2];\t/* sectors per track */\n\tu_int8_t bpbHeads[2];\t\t/* number of heads */\n\tu_int8_t bpbHiddenSecs[4];\t/* # of hidden sectors */\n\tu_int8_t bpbHugeSectors[4];\t/* # of sectors if bpbSectors == 0 */\n\tu_int8_t bpbBigFATsecs[4];\t/* like bpbFATsecs for FAT32 */\n\tu_int8_t bpbExtFlags[2];\t/* extended flags: */\n\tu_int8_t bpbFSVers[2];\t\t/* filesystem version */\n\tu_int8_t bpbRootClust[4];\t/* start cluster for root directory */\n\tu_int8_t bpbFSInfo[2];\t\t/* filesystem info structure sector */\n\tu_int8_t bpbBackup[2];\t\t/* backup boot sector */\n\tu_int8_t bpbReserved[12];\t/* reserved for future expansion */\n};\n\n/*\n * FAT32 FSInfo block.\n */\nstruct fsinfo {\n\tu_int8_t fsisig1[4];\n\tu_int8_t fsifill1[480];\n\tu_int8_t fsisig2[4];\n\tu_int8_t fsinfree[4];\n\tu_int8_t fsinxtfree[4];\n\tu_int8_t fsifill2[12];\n\tu_int8_t fsisig3[4];\n};\n#endif /* !_FS_MSDOSFS_BPB_H_ */\n"
  },
  {
    "path": "freebsd-headers/fs/msdosfs/denode.h",
    "content": "/* $FreeBSD: release/9.0.0/sys/fs/msdosfs/denode.h 203822 2010-02-13 11:34:25Z kib $ */\n/*\t$NetBSD: denode.h,v 1.25 1997/11/17 15:36:28 ws Exp $\t*/\n\n/*-\n * Copyright (C) 1994, 1995, 1997 Wolfgang Solfrank.\n * Copyright (C) 1994, 1995, 1997 TooLs GmbH.\n * All rights reserved.\n * Original code by Paul Popelka (paulp@uts.amdahl.com) (see below).\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. All advertising materials mentioning features or use of this software\n *    must display the following acknowledgement:\n *\tThis product includes software developed by TooLs GmbH.\n * 4. The name of TooLs GmbH may not be used to endorse or promote products\n *    derived from this software without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY TOOLS GMBH ``AS IS'' AND ANY EXPRESS OR\n * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES\n * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL TOOLS GMBH BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,\n * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;\n * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR\n * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF\n * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n */\n/*-\n * Written by Paul Popelka (paulp@uts.amdahl.com)\n *\n * You can do anything you want with this software, just don't say you wrote\n * it, and don't remove this notice.\n *\n * This software is provided \"as is\".\n *\n * The author supplies this software to be publicly redistributed on the\n * understanding that the author is not responsible for the correct\n * functioning of this software in any circumstances and is not liable for\n * any damages caused by this software.\n *\n * October 1992\n */\n\n/*\n * This is the pc filesystem specific portion of the vnode structure.\n *\n * To describe a file uniquely the de_dirclust, de_diroffset, and\n * de_StartCluster fields are used.\n *\n * de_dirclust contains the cluster number of the directory cluster\n *\tcontaining the entry for a file or directory.\n * de_diroffset is the index into the cluster for the entry describing\n *\ta file or directory.\n * de_StartCluster is the number of the first cluster of the file or directory.\n *\n * Now to describe the quirks of the pc filesystem.\n * - Clusters 0 and 1 are reserved.\n * - The first allocatable cluster is 2.\n * - The root directory is of fixed size and all blocks that make it up\n *   are contiguous.\n * - Cluster 0 refers to the root directory when it is found in the\n *   startcluster field of a directory entry that points to another directory.\n * - Cluster 0 implies a 0 length file when found in the start cluster field\n *   of a directory entry that points to a file.\n * - You can't use the cluster number 0 to derive the address of the root\n *   directory.\n * - Multiple directory entries can point to a directory. The entry in the\n *   parent directory points to a child directory.  Any directories in the\n *   child directory contain a \"..\" entry that points back to the parent.\n *   The child directory itself contains a \".\" entry that points to itself.\n * - The root directory does not contain a \".\" or \"..\" entry.\n * - Directory entries for directories are never changed once they are created\n *   (except when removed).  The size stays 0, and the last modification time\n *   is never changed.  This is because so many directory entries can point to\n *   the physical clusters that make up a directory.  It would lead to an\n *   update nightmare.\n * - The length field in a directory entry pointing to a directory contains 0\n *   (always).  The only way to find the end of a directory is to follow the\n *   cluster chain until the \"last cluster\" marker is found.\n *\n * My extensions to make this house of cards work.  These apply only to the in\n * memory copy of the directory entry.\n * - A reference count for each denode will be kept since dos doesn't keep such\n *   things.\n */\n\n/*\n * Internal pseudo-offset for (nonexistent) directory entry for the root\n * dir in the root dir\n */\n#define\tMSDOSFSROOT_OFS\t0x1fffffff\n\n/*\n * The fat cache structure. fc_fsrcn is the filesystem relative cluster\n * number that corresponds to the file relative cluster number in this\n * structure (fc_frcn).\n */\nstruct fatcache {\n\tu_long fc_frcn;\t\t/* file relative cluster number */\n\tu_long fc_fsrcn;\t/* filesystem relative cluster number */\n};\n\n/*\n * The fat entry cache as it stands helps make extending files a \"quick\"\n * operation by avoiding having to scan the fat to discover the last\n * cluster of the file. The cache also helps sequential reads by\n * remembering the last cluster read from the file.  This also prevents us\n * from having to rescan the fat to find the next cluster to read.  This\n * cache is probably pretty worthless if a file is opened by multiple\n * processes.\n */\n#define\tFC_SIZE\t\t3\t/* number of entries in the cache */\n#define\tFC_LASTMAP\t0\t/* entry the last call to pcbmap() resolved\n\t\t\t\t * to */\n#define\tFC_LASTFC\t1\t/* entry for the last cluster in the file */\n#define\tFC_NEXTTOLASTFC\t2\t/* entry for a close to the last cluster in\n\t\t\t\t * the file */\n\n#define\tFCE_EMPTY\t0xffffffff\t/* doesn't represent an actual cluster # */\n\n/*\n * Set a slot in the fat cache.\n */\n#define\tfc_setcache(dep, slot, frcn, fsrcn) \\\n\t(dep)->de_fc[(slot)].fc_frcn = (frcn); \\\n\t(dep)->de_fc[(slot)].fc_fsrcn = (fsrcn);\n\n/*\n * This is the in memory variant of a dos directory entry.  It is usually\n * contained within a vnode.\n */\nstruct denode {\n\tstruct vnode *de_vnode;\t/* addr of vnode we are part of */\n\tu_long de_flag;\t\t/* flag bits */\n\tu_long de_dirclust;\t/* cluster of the directory file containing this entry */\n\tu_long de_diroffset;\t/* offset of this entry in the directory cluster */\n\tu_long de_fndoffset;\t/* offset of found dir entry */\n\tint de_fndcnt;\t\t/* number of slots before de_fndoffset */\n\tlong de_refcnt;\t\t/* reference count */\n\tstruct msdosfsmount *de_pmp;\t/* addr of our mount struct */\n\tu_char de_Name[12];\t/* name, from DOS directory entry */\n\tu_char de_Attributes;\t/* attributes, from directory entry */\n\tu_char de_LowerCase;\t/* NT VFAT lower case flags */\n\tu_char de_CHun;\t\t/* Hundredth of second of CTime*/\n\tu_short de_CTime;\t/* creation time */\n\tu_short de_CDate;\t/* creation date */\n\tu_short de_ADate;\t/* access date */\n\tu_short de_MTime;\t/* modification time */\n\tu_short de_MDate;\t/* modification date */\n\tu_long de_StartCluster; /* starting cluster of file */\n\tu_long de_FileSize;\t/* size of file in bytes */\n\tstruct fatcache de_fc[FC_SIZE];\t/* fat cache */\n\tu_quad_t de_modrev;\t/* Revision level for lease. */\n\tu_int64_t de_inode;\t/* Inode number (really byte offset of direntry) */\n};\n\n/*\n * Values for the de_flag field of the denode.\n */\n#define\tDE_UPDATE\t0x0004\t/* Modification time update request */\n#define\tDE_CREATE\t0x0008\t/* Creation time update */\n#define\tDE_ACCESS\t0x0010\t/* Access time update */\n#define\tDE_MODIFIED\t0x0020\t/* Denode has been modified */\n#define\tDE_RENAME\t0x0040\t/* Denode is in the process of being renamed */\n\n\n/*\n * Transfer directory entries between internal and external form.\n * dep is a struct denode * (internal form),\n * dp is a struct direntry * (external form).\n */\n#define DE_INTERNALIZE32(dep, dp)\t\t\t\\\n\t ((dep)->de_StartCluster |= getushort((dp)->deHighClust) << 16)\n#define DE_INTERNALIZE(dep, dp)\t\t\t\t\\\n\t(bcopy((dp)->deName, (dep)->de_Name, 11),\t\\\n\t (dep)->de_Attributes = (dp)->deAttributes,\t\\\n\t (dep)->de_LowerCase = (dp)->deLowerCase,\t\\\n\t (dep)->de_CHun = (dp)->deCHundredth,\t\t\\\n\t (dep)->de_CTime = getushort((dp)->deCTime),\t\\\n\t (dep)->de_CDate = getushort((dp)->deCDate),\t\\\n\t (dep)->de_ADate = getushort((dp)->deADate),\t\\\n\t (dep)->de_MTime = getushort((dp)->deMTime),\t\\\n\t (dep)->de_MDate = getushort((dp)->deMDate),\t\\\n\t (dep)->de_StartCluster = getushort((dp)->deStartCluster), \\\n\t (dep)->de_FileSize = getulong((dp)->deFileSize), \\\n\t (FAT32((dep)->de_pmp) ? DE_INTERNALIZE32((dep), (dp)) : 0))\n\n#define DE_EXTERNALIZE(dp, dep)\t\t\t\t\\\n\t(bcopy((dep)->de_Name, (dp)->deName, 11),\t\\\n\t (dp)->deAttributes = (dep)->de_Attributes,\t\\\n\t (dp)->deLowerCase = (dep)->de_LowerCase,\t\\\n\t (dp)->deCHundredth = (dep)->de_CHun,\t\t\\\n\t putushort((dp)->deCTime, (dep)->de_CTime),\t\\\n\t putushort((dp)->deCDate, (dep)->de_CDate),\t\\\n\t putushort((dp)->deADate, (dep)->de_ADate),\t\\\n\t putushort((dp)->deMTime, (dep)->de_MTime),\t\\\n\t putushort((dp)->deMDate, (dep)->de_MDate),\t\\\n\t putushort((dp)->deStartCluster, (dep)->de_StartCluster), \\\n\t putulong((dp)->deFileSize,\t\t\t\\\n\t     ((dep)->de_Attributes & ATTR_DIRECTORY) ? 0 : (dep)->de_FileSize), \\\n\t putushort((dp)->deHighClust, (dep)->de_StartCluster >> 16))\n\n#ifdef _KERNEL\n\n#define\tVTODE(vp)\t((struct denode *)(vp)->v_data)\n#define\tDETOV(de)\t((de)->de_vnode)\n\n#define\tDETIMES(dep, acc, mod, cre) do {\t\t\t\t\\\n\tif ((dep)->de_flag & DE_UPDATE) {\t\t\t\t\\\n\t\t(dep)->de_flag |= DE_MODIFIED;\t\t\t\t\\\n\t\ttimespec2fattime((mod), 0, &(dep)->de_MDate,\t\t\\\n\t\t    &(dep)->de_MTime, NULL);\t\t\t\t\\\n\t\t(dep)->de_Attributes |= ATTR_ARCHIVE;\t\t\t\\\n\t}\t\t\t\t\t\t\t\t\\\n\tif ((dep)->de_pmp->pm_flags & MSDOSFSMNT_NOWIN95) {\t\t\\\n\t\t(dep)->de_flag &= ~(DE_UPDATE | DE_CREATE | DE_ACCESS);\t\\\n\t\tbreak;\t\t\t\t\t\t\t\\\n\t}\t\t\t\t\t\t\t\t\\\n\tif ((dep)->de_flag & DE_ACCESS) {\t\t\t\t\\\n\t\tu_int16_t adate;\t\t\t\t\t\\\n\t\t\t\t\t\t\t\t\t\\\n\t\ttimespec2fattime((acc), 0, &adate, NULL, NULL);\t\t\\\n\t\tif (adate != (dep)->de_ADate) {\t\t\t\t\\\n\t\t\t(dep)->de_flag |= DE_MODIFIED;\t\t\t\\\n\t\t\t(dep)->de_ADate = adate;\t\t\t\\\n\t\t}\t\t\t\t\t\t\t\\\n\t}\t\t\t\t\t\t\t\t\\\n\tif ((dep)->de_flag & DE_CREATE) {\t\t\t\t\\\n\t\ttimespec2fattime((cre), 0, &(dep)->de_CDate,\t\t\\\n\t\t    &(dep)->de_CTime, &(dep)->de_CHun);\t\t\t\\\n\t\t(dep)->de_flag |= DE_MODIFIED;\t\t\t\t\\\n\t}\t\t\t\t\t\t\t\t\\\n\t(dep)->de_flag &= ~(DE_UPDATE | DE_CREATE | DE_ACCESS);\t\t\\\n} while (0)\n\n/*\n * This overlays the fid structure (see mount.h)\n */\nstruct defid {\n\tu_short defid_len;\t/* length of structure */\n\tu_short defid_pad;\t/* force long alignment */\n\n\tu_int32_t defid_dirclust; /* cluster this dir entry came from */\n\tu_int32_t defid_dirofs;\t/* offset of entry within the cluster */\n#if 0\n\tu_int32_t defid_gen;\t/* generation number */\n#endif\n};\n\nextern struct vop_vector msdosfs_vnodeops;\n\nint msdosfs_lookup(struct vop_cachedlookup_args *);\nint msdosfs_inactive(struct vop_inactive_args *);\nint msdosfs_reclaim(struct vop_reclaim_args *);\n\n/*\n * Internal service routine prototypes.\n */\nint deget(struct msdosfsmount *, u_long, u_long, struct denode **);\nint uniqdosname(struct denode *, struct componentname *, u_char *);\nint findwin95(struct denode *);\n\nint readep(struct msdosfsmount *pmp, u_long dirclu, u_long dirofs,  struct buf **bpp, struct direntry **epp);\nint readde(struct denode *dep, struct buf **bpp, struct direntry **epp);\nint deextend(struct denode *dep, u_long length, struct ucred *cred);\nint fillinusemap(struct msdosfsmount *pmp);\nvoid reinsert(struct denode *dep);\nint dosdirempty(struct denode *dep);\nint createde(struct denode *dep, struct denode *ddep, struct denode **depp, struct componentname *cnp);\nint deupdat(struct denode *dep, int waitfor);\nint removede(struct denode *pdep, struct denode *dep);\nint detrunc(struct denode *dep, u_long length, int flags, struct ucred *cred, struct thread *td);\nint doscheckpath( struct denode *source, struct denode *target);\n#endif\t/* _KERNEL */\n"
  },
  {
    "path": "freebsd-headers/fs/msdosfs/direntry.h",
    "content": "/* $FreeBSD: release/9.0.0/sys/fs/msdosfs/direntry.h 203827 2010-02-13 12:41:07Z kib $ */\n/*\t$NetBSD: direntry.h,v 1.14 1997/11/17 15:36:32 ws Exp $\t*/\n\n/*-\n * Copyright (C) 1994, 1995, 1997 Wolfgang Solfrank.\n * Copyright (C) 1994, 1995, 1997 TooLs GmbH.\n * All rights reserved.\n * Original code by Paul Popelka (paulp@uts.amdahl.com) (see below).\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. All advertising materials mentioning features or use of this software\n *    must display the following acknowledgement:\n *\tThis product includes software developed by TooLs GmbH.\n * 4. The name of TooLs GmbH may not be used to endorse or promote products\n *    derived from this software without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY TOOLS GMBH ``AS IS'' AND ANY EXPRESS OR\n * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES\n * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL TOOLS GMBH BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,\n * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;\n * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR\n * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF\n * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n */\n/*-\n * Written by Paul Popelka (paulp@uts.amdahl.com)\n *\n * You can do anything you want with this software, just don't say you wrote\n * it, and don't remove this notice.\n *\n * This software is provided \"as is\".\n *\n * The author supplies this software to be publicly redistributed on the\n * understanding that the author is not responsible for the correct\n * functioning of this software in any circumstances and is not liable for\n * any damages caused by this software.\n *\n * October 1992\n */\n#ifndef _FS_MSDOSFS_DIRENTRY_H_\n#define\t_FS_MSDOSFS_DIRENTRY_H_\n\n/*\n * Structure of a dos directory entry.\n */\nstruct direntry {\n\tu_int8_t\tdeName[11];\t/* filename, blank filled */\n#define\tSLOT_EMPTY\t0x00\t\t/* slot has never been used */\n#define\tSLOT_E5\t\t0x05\t\t/* the real value is 0xe5 */\n#define\tSLOT_DELETED\t0xe5\t\t/* file in this slot deleted */\n\tu_int8_t\tdeAttributes;\t/* file attributes */\n#define\tATTR_NORMAL\t0x00\t\t/* normal file */\n#define\tATTR_READONLY\t0x01\t\t/* file is readonly */\n#define\tATTR_HIDDEN\t0x02\t\t/* file is hidden */\n#define\tATTR_SYSTEM\t0x04\t\t/* file is a system file */\n#define\tATTR_VOLUME\t0x08\t\t/* entry is a volume label */\n#define\tATTR_DIRECTORY\t0x10\t\t/* entry is a directory name */\n#define\tATTR_ARCHIVE\t0x20\t\t/* file is new or modified */\n\tu_int8_t\tdeLowerCase;\t/* NT VFAT lower case flags */\n#define\tLCASE_BASE\t0x08\t\t/* filename base in lower case */\n#define\tLCASE_EXT\t0x10\t\t/* filename extension in lower case */\n\tu_int8_t\tdeCHundredth;\t/* hundredth of seconds in CTime */\n\tu_int8_t\tdeCTime[2];\t/* create time */\n\tu_int8_t\tdeCDate[2];\t/* create date */\n\tu_int8_t\tdeADate[2];\t/* access date */\n\tu_int8_t\tdeHighClust[2];\t/* high bytes of cluster number */\n\tu_int8_t\tdeMTime[2];\t/* last update time */\n\tu_int8_t\tdeMDate[2];\t/* last update date */\n\tu_int8_t\tdeStartCluster[2]; /* starting cluster of file */\n\tu_int8_t\tdeFileSize[4];\t/* size of file in bytes */\n};\n\n/*\n * Structure of a Win95 long name directory entry\n */\nstruct winentry {\n\tu_int8_t\tweCnt;\n#define\tWIN_LAST\t0x40\n#define\tWIN_CNT\t\t0x3f\n\tu_int8_t\twePart1[10];\n\tu_int8_t\tweAttributes;\n#define\tATTR_WIN95\t0x0f\n\tu_int8_t\tweReserved1;\n\tu_int8_t\tweChksum;\n\tu_int8_t\twePart2[12];\n\tu_int16_t\tweReserved2;\n\tu_int8_t\twePart3[4];\n};\n#define\tWIN_CHARS\t13\t/* Number of chars per winentry */\n\n/*\n * Maximum number of winentries for a filename.\n */\n#define\tWIN_MAXSUBENTRIES 20\n\n/*\n * Maximum filename length in Win95\n * Note: Must be < sizeof(dirent.d_name)\n */\n#define\tWIN_MAXLEN\t255\n\n/*\n * This is the format of the contents of the deTime field in the direntry\n * structure.\n * We don't use bitfields because we don't know how compilers for\n * arbitrary machines will lay them out.\n */\n#define DT_2SECONDS_MASK\t0x1F\t/* seconds divided by 2 */\n#define DT_2SECONDS_SHIFT\t0\n#define DT_MINUTES_MASK\t\t0x7E0\t/* minutes */\n#define DT_MINUTES_SHIFT\t5\n#define DT_HOURS_MASK\t\t0xF800\t/* hours */\n#define DT_HOURS_SHIFT\t\t11\n\n/*\n * This is the format of the contents of the deDate field in the direntry\n * structure.\n */\n#define DD_DAY_MASK\t\t0x1F\t/* day of month */\n#define DD_DAY_SHIFT\t\t0\n#define DD_MONTH_MASK\t\t0x1E0\t/* month */\n#define DD_MONTH_SHIFT\t\t5\n#define DD_YEAR_MASK\t\t0xFE00\t/* year - 1980 */\n#define DD_YEAR_SHIFT\t\t9\n\n#ifdef _KERNEL\nstruct mbnambuf {\n\tsize_t\tnb_len;\n\tint\tnb_last_id;\n\tchar\tnb_buf[WIN_MAXLEN + 1];\n};\n\nstruct dirent;\nstruct msdosfsmount;\n\nchar\t*mbnambuf_flush(struct mbnambuf *nbp, struct dirent *dp);\nvoid\tmbnambuf_init(struct mbnambuf *nbp);\nvoid\tmbnambuf_write(struct mbnambuf *nbp, char *name, int id);\nint\tdos2unixfn(u_char dn[11], u_char *un, int lower,\n\t    struct msdosfsmount *pmp);\nint\tunix2dosfn(const u_char *un, u_char dn[12], size_t unlen, u_int gen,\n\t    struct msdosfsmount *pmp);\nint\tunix2winfn(const u_char *un, size_t unlen, struct winentry *wep, int cnt,\n\t    int chksum, struct msdosfsmount *pmp);\nint\twinChkName(struct mbnambuf *nbp, const u_char *un, size_t unlen,\n\t    int chksum, struct msdosfsmount *pmp);\nint\twin2unixfn(struct mbnambuf *nbp, struct winentry *wep, int chksum,\n\t    struct msdosfsmount *pmp);\nu_int8_t winChksum(u_int8_t *name);\nint\twinSlotCnt(const u_char *un, size_t unlen, struct msdosfsmount *pmp);\nsize_t\twinLenFixup(const u_char *un, size_t unlen);\n#endif\t/* _KERNEL */\n#endif\t/* !_FS_MSDOSFS_DIRENTRY_H_ */\n"
  },
  {
    "path": "freebsd-headers/fs/msdosfs/fat.h",
    "content": "/* $FreeBSD: release/9.0.0/sys/fs/msdosfs/fat.h 139776 2005-01-06 18:10:42Z imp $ */\n/*\t$NetBSD: fat.h,v 1.12 1997/11/17 15:36:36 ws Exp $\t*/\n\n/*-\n * Copyright (C) 1994, 1997 Wolfgang Solfrank.\n * Copyright (C) 1994, 1997 TooLs GmbH.\n * All rights reserved.\n * Original code by Paul Popelka (paulp@uts.amdahl.com) (see below).\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. All advertising materials mentioning features or use of this software\n *    must display the following acknowledgement:\n *\tThis product includes software developed by TooLs GmbH.\n * 4. The name of TooLs GmbH may not be used to endorse or promote products\n *    derived from this software without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY TOOLS GMBH ``AS IS'' AND ANY EXPRESS OR\n * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES\n * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL TOOLS GMBH BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,\n * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;\n * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR\n * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF\n * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n */\n/*-\n * Written by Paul Popelka (paulp@uts.amdahl.com)\n *\n * You can do anything you want with this software, just don't say you wrote\n * it, and don't remove this notice.\n *\n * This software is provided \"as is\".\n *\n * The author supplies this software to be publicly redistributed on the\n * understanding that the author is not responsible for the correct\n * functioning of this software in any circumstances and is not liable for\n * any damages caused by this software.\n *\n * October 1992\n */\n\n/*\n * Some useful cluster numbers.\n */\n#define\tMSDOSFSROOT\t0\t\t/* cluster 0 means the root dir */\n#define\tCLUST_FREE\t0\t\t/* cluster 0 also means a free cluster */\n#define\tMSDOSFSFREE\tCLUST_FREE\n#define\tCLUST_FIRST\t2\t\t/* first legal cluster number */\n#define\tCLUST_RSRVD\t0xfffffff6\t/* reserved cluster range */\n#define\tCLUST_BAD\t0xfffffff7\t/* a cluster with a defect */\n#define\tCLUST_EOFS\t0xfffffff8\t/* start of eof cluster range */\n#define\tCLUST_EOFE\t0xffffffff\t/* end of eof cluster range */\n\n#define\tFAT12_MASK\t0x00000fff\t/* mask for 12 bit cluster numbers */\n#define\tFAT16_MASK\t0x0000ffff\t/* mask for 16 bit cluster numbers */\n#define\tFAT32_MASK\t0x0fffffff\t/* mask for FAT32 cluster numbers */\n\n/*\n * MSDOSFS:\n * Return true if filesystem uses 12 bit fats. Microsoft Programmer's\n * Reference says if the maximum cluster number in a filesystem is greater\n * than 4078 ((CLUST_RSRVS - CLUST_FIRST) & FAT12_MASK) then we've got a\n * 16 bit fat filesystem. While mounting, the result of this test is stored\n * in pm_fatentrysize.\n */\n#define\tFAT12(pmp)\t(pmp->pm_fatmask == FAT12_MASK)\n#define\tFAT16(pmp)\t(pmp->pm_fatmask == FAT16_MASK)\n#define\tFAT32(pmp)\t(pmp->pm_fatmask == FAT32_MASK)\n\n#define\tMSDOSFSEOF(pmp, cn)\t((((cn) | ~(pmp)->pm_fatmask) & CLUST_EOFS) == CLUST_EOFS)\n\n#ifdef _KERNEL\n/*\n * These are the values for the function argument to the function\n * fatentry().\n */\n#define\tFAT_GET\t\t0x0001\t/* get a fat entry */\n#define\tFAT_SET\t\t0x0002\t/* set a fat entry */\n#define\tFAT_GET_AND_SET\t(FAT_GET | FAT_SET)\n\n/*\n * Flags to extendfile:\n */\n#define\tDE_CLEAR\t1\t/* Zero out the blocks allocated */\n\nint pcbmap(struct denode *dep, u_long findcn, daddr_t *bnp, u_long *cnp, int* sp);\nint clusterfree(struct msdosfsmount *pmp, u_long cn, u_long *oldcnp);\nint clusteralloc(struct msdosfsmount *pmp, u_long start, u_long count, u_long fillwith, u_long *retcluster, u_long *got);\nint fatentry(int function, struct msdosfsmount *pmp, u_long cluster, u_long *oldcontents, u_long newcontents);\nint freeclusterchain(struct msdosfsmount *pmp, u_long startchain);\nint extendfile(struct denode *dep, u_long count, struct buf **bpp, u_long *ncp, int flags);\nvoid fc_purge(struct denode *dep, u_int frcn);\nint markvoldirty(struct msdosfsmount *pmp, int dirty);\n\n#endif\t/* _KERNEL */\n"
  },
  {
    "path": "freebsd-headers/fs/msdosfs/msdosfsmount.h",
    "content": "/* $FreeBSD: release/9.0.0/sys/fs/msdosfs/msdosfsmount.h 224290 2011-07-24 17:43:09Z mckusick $ */\n/*\t$NetBSD: msdosfsmount.h,v 1.17 1997/11/17 15:37:07 ws Exp $\t*/\n\n/*-\n * Copyright (C) 1994, 1995, 1997 Wolfgang Solfrank.\n * Copyright (C) 1994, 1995, 1997 TooLs GmbH.\n * All rights reserved.\n * Original code by Paul Popelka (paulp@uts.amdahl.com) (see below).\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. All advertising materials mentioning features or use of this software\n *    must display the following acknowledgement:\n *\tThis product includes software developed by TooLs GmbH.\n * 4. The name of TooLs GmbH may not be used to endorse or promote products\n *    derived from this software without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY TOOLS GMBH ``AS IS'' AND ANY EXPRESS OR\n * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES\n * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL TOOLS GMBH BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,\n * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;\n * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR\n * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF\n * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n */\n/*-\n * Written by Paul Popelka (paulp@uts.amdahl.com)\n *\n * You can do anything you want with this software, just don't say you wrote\n * it, and don't remove this notice.\n *\n * This software is provided \"as is\".\n *\n * The author supplies this software to be publicly redistributed on the\n * understanding that the author is not responsible for the correct\n * functioning of this software in any circumstances and is not liable for\n * any damages caused by this software.\n *\n * October 1992\n */\n\n#ifndef _MSDOSFS_MSDOSFSMOUNT_H_\n#define\t_MSDOSFS_MSDOSFSMOUNT_H_\n\n#ifdef _KERNEL\n\n#include <sys/types.h>\n#include <sys/lock.h>\n#include <sys/lockmgr.h>\n#include <sys/tree.h>\n\n#ifdef MALLOC_DECLARE\nMALLOC_DECLARE(M_MSDOSFSMNT);\n#endif\n\nstruct msdosfs_fileno;\n\n/*\n * Layout of the mount control block for a msdos filesystem.\n */\nstruct msdosfsmount {\n\tstruct mount *pm_mountp;/* vfs mount struct for this fs */\n\tstruct g_consumer *pm_cp;\n\tstruct bufobj *pm_bo;\n\tuid_t pm_uid;\t\t/* uid to set as owner of the files */\n\tgid_t pm_gid;\t\t/* gid to set as owner of the files */\n\tmode_t pm_mask;\t\t/* mask to and with file protection bits \n\t\t\t\t   for files */\n\tmode_t pm_dirmask;\t/* mask to and with file protection bits\n\t\t\t\t   for directories */\n\tstruct vnode *pm_devvp;\t/* vnode for character device mounted */\n\tstruct cdev *pm_dev;\t/* character device mounted */\n\tstruct bpb50 pm_bpb;\t/* BIOS parameter blk for this fs */\n\tu_long pm_BlkPerSec;\t/* How many DEV_BSIZE blocks fit inside a physical sector */\n\tu_long pm_FATsecs;\t/* actual number of fat sectors */\n\tu_long pm_fatblk;\t/* block # of first FAT */\n\tu_long pm_rootdirblk;\t/* block # (cluster # for FAT32) of root directory number */\n\tu_long pm_rootdirsize;\t/* size in blocks (not clusters) */\n\tu_long pm_firstcluster;\t/* block number of first cluster */\n\tu_long pm_maxcluster;\t/* maximum cluster number */\n\tu_long pm_freeclustercount;\t/* number of free clusters */\n\tu_long pm_cnshift;\t/* shift file offset right this amount to get a cluster number */\n\tu_long pm_crbomask;\t/* and a file offset with this mask to get cluster rel offset */\n\tu_long pm_bnshift;\t/* shift file offset right this amount to get a block number */\n\tu_long pm_bpcluster;\t/* bytes per cluster */\n\tu_long pm_fmod;\t\t/* ~0 if fs is modified, this can rollover to 0\t*/\n\tu_long pm_fatblocksize;\t/* size of fat blocks in bytes */\n\tu_long pm_fatblocksec;\t/* size of fat blocks in sectors */\n\tu_long pm_fatsize;\t/* size of fat in bytes */\n\tu_int32_t pm_fatmask;\t/* mask to use for fat numbers */\n\tu_long pm_fsinfo;\t/* fsinfo block number */\n\tu_long pm_nxtfree;\t/* next place to search for a free cluster */\n\tu_int pm_fatmult;\t/* these 2 values are used in fat */\n\tu_int pm_fatdiv;\t/*\toffset computation */\n\tu_int pm_curfat;\t/* current fat for FAT32 (0 otherwise) */\n\tu_int *pm_inusemap;\t/* ptr to bitmap of in-use clusters */\n\tuint64_t pm_flags;\t/* see below */\n\tvoid *pm_u2w;\t/* Local->Unicode iconv handle */\n\tvoid *pm_w2u;\t/* Unicode->Local iconv handle */\n\tvoid *pm_u2d;\t/* Unicode->DOS iconv handle */\n\tvoid *pm_d2u;\t/* DOS->Local iconv handle */\n\tu_int32_t pm_nfileno;\t/* next 32-bit fileno */\n\tRB_HEAD(msdosfs_filenotree, msdosfs_fileno)\n\t    pm_filenos; /* 64<->32-bit fileno mapping */\n\tstruct lock pm_fatlock;\t/* lockmgr protecting allocations and rb tree */\n};\n\n/*\n * A 64-bit file number and the 32-bit file number to which it is mapped,\n * in a red-black tree node.\n */\nstruct msdosfs_fileno {\n\tRB_ENTRY(msdosfs_fileno)\tmf_tree;\n\tuint32_t\t\t\tmf_fileno32;\n\tuint64_t\t\t\tmf_fileno64;\n};\n\n/* Byte offset in FAT on filesystem pmp, cluster cn */\n#define\tFATOFS(pmp, cn)\t((cn) * (pmp)->pm_fatmult / (pmp)->pm_fatdiv)\n\n\n#define\tVFSTOMSDOSFS(mp)\t((struct msdosfsmount *)mp->mnt_data)\n\n/* Number of bits in one pm_inusemap item: */\n#define\tN_INUSEBITS\t(8 * sizeof(u_int))\n\n/*\n * Shorthand for fields in the bpb contained in the msdosfsmount structure.\n */\n#define\tpm_BytesPerSec\tpm_bpb.bpbBytesPerSec\n#define\tpm_ResSectors\tpm_bpb.bpbResSectors\n#define\tpm_FATs\t\tpm_bpb.bpbFATs\n#define\tpm_RootDirEnts\tpm_bpb.bpbRootDirEnts\n#define\tpm_Sectors\tpm_bpb.bpbSectors\n#define\tpm_Media\tpm_bpb.bpbMedia\n#define\tpm_SecPerTrack\tpm_bpb.bpbSecPerTrack\n#define\tpm_Heads\tpm_bpb.bpbHeads\n#define\tpm_HiddenSects\tpm_bpb.bpbHiddenSecs\n#define\tpm_HugeSectors\tpm_bpb.bpbHugeSectors\n\n/*\n * Convert pointer to buffer -> pointer to direntry\n */\n#define\tbptoep(pmp, bp, dirofs) \\\n\t((struct direntry *)(((bp)->b_data)\t\\\n\t + ((dirofs) & (pmp)->pm_crbomask)))\n\n/*\n * Convert block number to cluster number\n */\n#define\tde_bn2cn(pmp, bn) \\\n\t((bn) >> ((pmp)->pm_cnshift - (pmp)->pm_bnshift))\n\n/*\n * Convert cluster number to block number\n */\n#define\tde_cn2bn(pmp, cn) \\\n\t((cn) << ((pmp)->pm_cnshift - (pmp)->pm_bnshift))\n\n/*\n * Convert file offset to cluster number\n */\n#define de_cluster(pmp, off) \\\n\t((off) >> (pmp)->pm_cnshift)\n\n/*\n * Clusters required to hold size bytes\n */\n#define\tde_clcount(pmp, size) \\\n\t(((size) + (pmp)->pm_bpcluster - 1) >> (pmp)->pm_cnshift)\n\n/*\n * Convert file offset to block number\n */\n#define de_blk(pmp, off) \\\n\t(de_cn2bn(pmp, de_cluster((pmp), (off))))\n\n/*\n * Convert cluster number to file offset\n */\n#define\tde_cn2off(pmp, cn) \\\n\t((cn) << (pmp)->pm_cnshift)\n\n/*\n * Convert block number to file offset\n */\n#define\tde_bn2off(pmp, bn) \\\n\t((bn) << (pmp)->pm_bnshift)\n/*\n * Map a cluster number into a filesystem relative block number.\n */\n#define\tcntobn(pmp, cn) \\\n\t(de_cn2bn((pmp), (cn)-CLUST_FIRST) + (pmp)->pm_firstcluster)\n\n/*\n * Calculate block number for directory entry in root dir, offset dirofs\n */\n#define\troottobn(pmp, dirofs) \\\n\t(de_blk((pmp), (dirofs)) + (pmp)->pm_rootdirblk)\n\n/*\n * Calculate block number for directory entry at cluster dirclu, offset\n * dirofs\n */\n#define\tdetobn(pmp, dirclu, dirofs) \\\n\t((dirclu) == MSDOSFSROOT \\\n\t ? roottobn((pmp), (dirofs)) \\\n\t : cntobn((pmp), (dirclu)))\n\nvoid msdosfs_fileno_init(struct mount *);\nvoid msdosfs_fileno_free(struct mount *);\nuint32_t msdosfs_fileno_map(struct mount *, uint64_t);\n\n#define\tMSDOSFS_LOCK_MP(pmp) \\\n\tlockmgr(&(pmp)->pm_fatlock, LK_EXCLUSIVE, NULL)\n#define\tMSDOSFS_UNLOCK_MP(pmp) \\\n\tlockmgr(&(pmp)->pm_fatlock, LK_RELEASE, NULL)\n#define\tMSDOSFS_ASSERT_MP_LOCKED(pmp) \\\n\tlockmgr_assert(&(pmp)->pm_fatlock, KA_XLOCKED)\n\n#endif /* _KERNEL */\n\n/*\n *  Arguments to mount MSDOS filesystems.\n */\nstruct msdosfs_args {\n\tchar\t*fspec;\t\t/* blocks special holding the fs to mount */\n\tstruct\toexport_args export;\t/* network export information */\n\tuid_t\tuid;\t\t/* uid that owns msdosfs files */\n\tgid_t\tgid;\t\t/* gid that owns msdosfs files */\n\tmode_t\tmask;\t\t/* file mask to be applied for msdosfs perms */\n\tint\tflags;\t\t/* see below */\n\tint magic;\t\t/* version number */\n\tu_int16_t u2w[128];     /* Local->Unicode table */\n\tchar\t*cs_win;\t/* Windows(Unicode) Charset */\n\tchar\t*cs_dos;\t/* DOS Charset */\n\tchar\t*cs_local;\t/* Local Charset */\n\tmode_t\tdirmask;\t/* dir  mask to be applied for msdosfs perms */\n};\n\n/*\n * Msdosfs mount options:\n */\n#define\tMSDOSFSMNT_SHORTNAME\t1\t/* Force old DOS short names only */\n#define\tMSDOSFSMNT_LONGNAME\t2\t/* Force Win'95 long names */\n#define\tMSDOSFSMNT_NOWIN95\t4\t/* Completely ignore Win95 entries */\n#define\tMSDOSFSMNT_KICONV\t0x10    /* Use libiconv to convert chars */\n/* All flags above: */\n#define\tMSDOSFSMNT_MNTOPT \\\n\t(MSDOSFSMNT_SHORTNAME|MSDOSFSMNT_LONGNAME|MSDOSFSMNT_NOWIN95 \\\n\t |MSDOSFSMNT_KICONV)\n#define\tMSDOSFSMNT_RONLY\t0x80000000\t/* mounted read-only\t*/\n#define\tMSDOSFSMNT_WAITONFAT\t0x40000000\t/* mounted synchronous\t*/\n#define\tMSDOSFS_FATMIRROR\t0x20000000\t/* FAT is mirrored */\n#define\tMSDOSFS_LARGEFS\t\t0x10000000\t/* perform fileno mapping */\n\n#define MSDOSFS_ARGSMAGIC\t0xe4eff300\n\n#endif /* !_MSDOSFS_MSDOSFSMOUNT_H_ */\n"
  },
  {
    "path": "freebsd-headers/fs/nfs/nfs.h",
    "content": "/*-\n * Copyright (c) 1989, 1993\n *\tThe Regents of the University of California.  All rights reserved.\n *\n * This code is derived from software contributed to Berkeley by\n * Rick Macklem at The University of Guelph.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 4. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/fs/nfs/nfs.h 221523 2011-05-06 13:11:50Z mav $\n */\n\n#ifndef _NFS_NFS_H_\n#define\t_NFS_NFS_H_\n/*\n * Tunable constants for nfs\n */\n\n#define\tNFS_MAXIOVEC\t34\n#define\tNFS_TICKINTVL\t500\t\t/* Desired time for a tick (msec) */\n#define\tNFS_HZ\t\t(hz / nfscl_ticks) /* Ticks/sec */\n#define\tNFS_TIMEO\t(1 * NFS_HZ)\t/* Default timeout = 1 second */\n#define\tNFS_MINTIMEO\t(1 * NFS_HZ)\t/* Min timeout to use */\n#define\tNFS_MAXTIMEO\t(60 * NFS_HZ)\t/* Max timeout to backoff to */\n#define\tNFS_TCPTIMEO\t300\t\t/* TCP timeout */\n#define\tNFS_MAXRCVTIMEO\t60\t\t/* 1 minute in seconds */\n#define\tNFS_MINIDEMTIMEO (5 * NFS_HZ)\t/* Min timeout for non-idempotent ops*/\n#define\tNFS_MAXREXMIT\t100\t\t/* Stop counting after this many */\n#define\tNFSV4_CALLBACKTIMEO (2 * NFS_HZ) /* Timeout in ticks */\n#define\tNFSV4_CALLBACKRETRY 5\t\t/* Number of retries before failure */\n#define\tNFSV4_CBRETRYCNT 4\t\t/* # of CBRecall retries upon err */\n#define\tNFSV4_UPCALLTIMEO (15 * NFS_HZ)\t/* Timeout in ticks for upcalls */\n\t\t\t\t\t/* to gssd or nfsuserd */\n#define\tNFSV4_UPCALLRETRY 4\t\t/* Number of retries before failure */\n#define\tNFS_MAXWINDOW\t1024\t\t/* Max number of outstanding requests */\n#define\tNFS_RETRANS\t10\t\t/* Num of retrans for soft mounts */\n#define\tNFS_RETRANS_TCP\t2\t\t/* Num of retrans for TCP soft mounts */\n#define\tNFS_MAXGRPS\t16\t\t/* Max. size of groups list */\n#define\tNFS_TRYLATERDEL\t15\t\t/* Maximum delay timeout (sec) */\n#ifndef NFS_REMOVETIMEO\n#define\tNFS_REMOVETIMEO 15  /* # sec to wait for delegret in local syscall */\n#endif\n#ifndef NFS_MINATTRTIMO\n#define\tNFS_MINATTRTIMO 5\t\t/* Attribute cache timeout in sec */\n#endif\n#ifndef NFS_MAXATTRTIMO\n#define\tNFS_MAXATTRTIMO 60\n#endif\n#define\tNFS_WSIZE\t8192\t\t/* Def. write data size <= 8192 */\n#define\tNFS_RSIZE\t8192\t\t/* Def. read data size <= 8192 */\n#define\tNFS_READDIRSIZE\t8192\t\t/* Def. readdir size */\n#define\tNFS_DEFRAHEAD\t1\t\t/* Def. read ahead # blocks */\n#define\tNFS_MAXRAHEAD\t16\t\t/* Max. read ahead # blocks */\n#define\tNFS_MAXASYNCDAEMON \t64\t/* Max. number async_daemons runnable */\n#define\tNFS_MAXUIDHASH\t64\t\t/* Max. # of hashed uid entries/mp */\n#ifndef\tNFSRV_LEASE\n#define\tNFSRV_LEASE\t\t120\t/* Lease time in seconds for V4 */\n#endif\t\t\t\t\t/* assigned to nfsrv_lease */\n#ifndef NFSRV_STALELEASE\n#define\tNFSRV_STALELEASE\t(5 * nfsrv_lease)\n#endif\n#ifndef NFSRV_MOULDYLEASE\n#define\tNFSRV_MOULDYLEASE\t604800\t/* One week (in sec) */\n#endif\n#ifndef NFSCLIENTHASHSIZE\n#define\tNFSCLIENTHASHSIZE\t20\t/* Size of server client hash table */\n#endif\n#ifndef NFSLOCKHASHSIZE\n#define\tNFSLOCKHASHSIZE\t\t20\t/* Size of server nfslock hash table */\n#endif\n#define\tNFSSTATEHASHSIZE\t10\t/* Size of server stateid hash table */\n#ifndef NFSUSERHASHSIZE\n#define\tNFSUSERHASHSIZE\t\t30\t/* Size of user id hash table */\n#endif\n#ifndef NFSGROUPHASHSIZE\n#define\tNFSGROUPHASHSIZE\t5\t/* Size of group id hash table */\n#endif\n#ifndef\tNFSCLDELEGHIGHWATER\n#define\tNFSCLDELEGHIGHWATER\t10000\t/* limit for client delegations */\n#endif\n#ifndef NFSNOOPEN\t\t\t/* Inactive open owner (sec) */\n#define\tNFSNOOPEN\t\t120\n#endif\n#define\tNFSRV_LEASEDELTA\t15\t/* # of seconds to delay beyond lease */\n#define\tNFS_IDMAXSIZE\t\t4\t/* max sizeof (in_addr_t) */\n#ifndef NFSRVCACHE_UDPTIMEOUT\n#define\tNFSRVCACHE_UDPTIMEOUT\t30\t/* # of sec to hold cached rpcs(udp) */\n#endif\n#ifndef NFSRVCACHE_UDPHIGHWATER\n#define\tNFSRVCACHE_UDPHIGHWATER\t500\t/* Max # of udp cache entries */\n#endif\n#ifndef NFSRVCACHE_TCPTIMEOUT\n#define\tNFSRVCACHE_TCPTIMEOUT\t(3600*12) /*#of sec to hold cached rpcs(tcp) */\n#endif\n#ifndef\tNFSRVCACHE_FLOODLEVEL\n#define\tNFSRVCACHE_FLOODLEVEL\t16384\t/* Very high water mark for cache */\n#endif\n#ifndef\tNFSRV_CLIENTHIGHWATER\n#define\tNFSRV_CLIENTHIGHWATER\t1000\n#endif\n#ifndef\tNFSRV_MAXDUMPLIST\n#define\tNFSRV_MAXDUMPLIST\t10000\n#endif\n#ifndef NFS_ACCESSCACHESIZE\n#define\tNFS_ACCESSCACHESIZE\t8\n#endif\n#define\tNFSV4_CBPORT\t7745\t\t/* Callback port for testing */\n\n/*\n * This macro defines the high water mark for issuing V4 delegations.\n * (It is currently set at a conservative 20% of NFSRV_V4STATELIMIT. This\n *  may want to increase when clients can make more effective use of\n *  delegations.)\n */\n#define\tNFSRV_V4DELEGLIMIT(c) (((c) * 5) > NFSRV_V4STATELIMIT)\n\n#define\tNFS_READDIRBLKSIZ\tDIRBLKSIZ\t/* Minimal nm_readdirsize */\n\n/*\n * Oddballs\n */\n#define\tNFS_CMPFH(n, f, s) \t\t\t\t\t\t\\\n    ((n)->n_fhp->nfh_len == (s) && !NFSBCMP((n)->n_fhp->nfh_fh, (caddr_t)(f), (s)))\n#define\tNFSRV_CMPFH(nf, ns, f, s) \t\t\t\t\t\\\n\t((ns) == (s) && !NFSBCMP((caddr_t)(nf), (caddr_t)(f), (s)))\n#define\tNFS_CMPTIME(t1, t2) \t\t\t\t\t\t\\\n\t((t1).tv_sec == (t2).tv_sec && (t1).tv_nsec == (t2).tv_nsec)\n#define\tNFS_SETTIME(t) do { \t\t\t\t\t\t\\\n\t(t).tv_sec = time.tv_sec; (t).tv_nsec = 1000 * time.tv_usec; } while (0)\n#define\tNFS_SRVMAXDATA(n) \t\t\t\t\t\t\\\n\t\t(((n)->nd_flag & (ND_NFSV3 | ND_NFSV4)) ? \t\t\\\n\t\t NFS_MAXDATA : NFS_V2MAXDATA)\n#define\tNFS64BITSSET\t0xffffffffffffffffull\n#define\tNFS64BITSMINUS1\t0xfffffffffffffffeull\n\n/*\n * Structures for the nfssvc(2) syscall. Not that anyone but nfsd, mount_nfs\n * and nfsloaduser should ever try and use it.\n */\nstruct nfsd_addsock_args {\n\tint\tsock;\t\t/* Socket to serve */\n\tcaddr_t\tname;\t\t/* Client addr for connection based sockets */\n\tint\tnamelen;\t/* Length of name */\n};\n\n/*\n * nfsd argument for new krpc.\n */\nstruct nfsd_nfsd_args {\n\tconst char *principal;\t/* GSS-API service principal name */\n\tint\tminthreads;\t/* minimum service thread count */\n\tint\tmaxthreads;\t/* maximum service thread count */\n};\n\n/*\n * Arguments for use by the callback daemon.\n */\nstruct nfsd_nfscbd_args {\n\tconst char *principal;\t/* GSS-API service principal name */\n};\n\nstruct nfscbd_args {\n\tint\tsock;\t\t/* Socket to serve */\n\tcaddr_t\tname;\t\t/* Client addr for connection based sockets */\n\tint\tnamelen;\t/* Length of name */\n\tu_short\tport;\t\t/* Port# for callbacks */\n};\n\nstruct nfsd_idargs {\n\tint\t\tnid_flag;\t/* Flags (see below) */\n\tuid_t\t\tnid_uid;\t/* user/group id */\n\tgid_t\t\tnid_gid;\n\tint\t\tnid_usermax;\t/* Upper bound on user name cache */\n\tint\t\tnid_usertimeout;/* User name timeout (minutes) */\n\tu_char\t\t*nid_name;\t/* Name */\n\tint\t\tnid_namelen;\t/* and its length */\n};\n\nstruct nfsd_clid {\n\tint\t\tnclid_idlen;\t/* Length of client id */\n\tu_char\t\tnclid_id[NFSV4_OPAQUELIMIT]; /* and name */\n};\n\nstruct nfsd_dumplist {\n\tint\t\tndl_size;\t/* Number of elements */\n\tvoid\t\t*ndl_list;\t/* and the list of elements */\n};\n\nstruct nfsd_dumpclients {\n\tu_int32_t\tndcl_flags;\t\t/* LCL_xxx flags */\n\tu_int32_t\tndcl_nopenowners;\t/* Number of openowners */\n\tu_int32_t\tndcl_nopens;\t\t/* and opens */\n\tu_int32_t\tndcl_nlockowners;\t/* and of lockowners */\n\tu_int32_t\tndcl_nlocks;\t\t/* and of locks */\n\tu_int32_t\tndcl_ndelegs;\t\t/* and of delegations */\n\tu_int32_t\tndcl_nolddelegs;\t/* and old delegations */\n\tsa_family_t\tndcl_addrfam;\t\t/* Callback address */\n\tunion {\n\t\tstruct in_addr sin_addr;\n\t\tstruct in6_addr sin6_addr;\n\t} ndcl_cbaddr;\n\tstruct nfsd_clid ndcl_clid;\t/* and client id */\n};\n\nstruct nfsd_dumplocklist {\n\tchar\t\t*ndllck_fname;\t/* File Name */\n\tint\t\tndllck_size;\t/* Number of elements */\n\tvoid\t\t*ndllck_list;\t/* and the list of elements */\n};\n\nstruct nfsd_dumplocks {\n\tu_int32_t\tndlck_flags;\t\t/* state flags NFSLCK_xxx */\n\tnfsv4stateid_t\tndlck_stateid;\t\t/* stateid */\n\tu_int64_t\tndlck_first;\t\t/* lock byte range */\n\tu_int64_t\tndlck_end;\n\tstruct nfsd_clid ndlck_owner;\t\t/* Owner of open/lock */\n\tsa_family_t\tndlck_addrfam;\t\t/* Callback address */\n\tunion {\n\t\tstruct in_addr sin_addr;\n\t\tstruct in6_addr sin6_addr;\n\t} ndlck_cbaddr;\n\tstruct nfsd_clid ndlck_clid;\t/* and client id */\n};\n\n/*\n * Structure for referral information.\n */\nstruct nfsreferral {\n\tu_char\t\t*nfr_srvlist;\t/* List of servers */\n\tint\t\tnfr_srvcnt;\t/* number of servers */\n\tvnode_t\t\tnfr_vp;\t/* vnode for referral */\n\tu_int32_t\tnfr_dfileno;\t/* assigned dir inode# */\n};\n\n/*\n * Flags for lc_flags and opsflags for nfsrv_getclient().\n */\n#define\tLCL_NEEDSCONFIRM\t0x00000001\n#define\tLCL_DONTCLEAN\t\t0x00000002\n#define\tLCL_WAKEUPWANTED\t0x00000004\n#define\tLCL_TCPCALLBACK\t\t0x00000008\n#define\tLCL_CALLBACKSON\t\t0x00000010\n#define\tLCL_INDEXNOTOK\t\t0x00000020\n#define\tLCL_STAMPEDSTABLE\t0x00000040\n#define\tLCL_EXPIREIT\t\t0x00000080\n#define\tLCL_CBDOWN\t\t0x00000100\n#define\tLCL_KERBV\t\t0x00000400\n#define\tLCL_NAME\t\t0x00000800\n#define\tLCL_NEEDSCBNULL\t\t0x00001000\n#define\tLCL_GSSINTEGRITY\t0x00002000\n#define\tLCL_GSSPRIVACY\t\t0x00004000\n#define\tLCL_ADMINREVOKED\t0x00008000\n\n#define\tLCL_GSS\t\tLCL_KERBV\t/* Or of all mechs */\n\n/*\n * Bits for flags in nfslock and nfsstate.\n * The access, deny, NFSLCK_READ and NFSLCK_WRITE bits must be defined as\n * below, in the correct order, so the shifts work for tests.\n */\n#define\tNFSLCK_READACCESS\t0x00000001\n#define\tNFSLCK_WRITEACCESS\t0x00000002\n#define\tNFSLCK_ACCESSBITS\t(NFSLCK_READACCESS | NFSLCK_WRITEACCESS)\n#define\tNFSLCK_SHIFT\t\t2\n#define\tNFSLCK_READDENY\t\t0x00000004\n#define\tNFSLCK_WRITEDENY\t0x00000008\n#define\tNFSLCK_DENYBITS\t\t(NFSLCK_READDENY | NFSLCK_WRITEDENY)\n#define\tNFSLCK_SHAREBITS \t\t\t\t\t\t\\\n    (NFSLCK_READACCESS|NFSLCK_WRITEACCESS|NFSLCK_READDENY|NFSLCK_WRITEDENY)\n#define\tNFSLCK_LOCKSHIFT\t4\n#define\tNFSLCK_READ\t\t0x00000010\n#define\tNFSLCK_WRITE\t\t0x00000020\n#define\tNFSLCK_BLOCKING\t\t0x00000040\n#define\tNFSLCK_RECLAIM\t\t0x00000080\n#define\tNFSLCK_OPENTOLOCK\t0x00000100\n#define\tNFSLCK_TEST\t\t0x00000200\n#define\tNFSLCK_LOCK\t\t0x00000400\n#define\tNFSLCK_UNLOCK\t\t0x00000800\n#define\tNFSLCK_OPEN\t\t0x00001000\n#define\tNFSLCK_CLOSE\t\t0x00002000\n#define\tNFSLCK_CHECK\t\t0x00004000\n#define\tNFSLCK_RELEASE\t\t0x00008000\n#define\tNFSLCK_NEEDSCONFIRM\t0x00010000\n#define\tNFSLCK_CONFIRM\t\t0x00020000\n#define\tNFSLCK_DOWNGRADE\t0x00040000\n#define\tNFSLCK_DELEGREAD\t0x00080000\n#define\tNFSLCK_DELEGWRITE\t0x00100000\n#define\tNFSLCK_DELEGCUR\t\t0x00200000\n#define\tNFSLCK_DELEGPREV\t0x00400000\n#define\tNFSLCK_OLDDELEG\t\t0x00800000\n#define\tNFSLCK_DELEGRECALL\t0x01000000\n#define\tNFSLCK_SETATTR\t\t0x02000000\n#define\tNFSLCK_DELEGPURGE\t0x04000000\n#define\tNFSLCK_DELEGRETURN\t0x08000000\n\n/* And bits for nid_flag */\n#define\tNFSID_INITIALIZE\t0x0001\n#define\tNFSID_ADDUID\t\t0x0002\n#define\tNFSID_DELUID\t\t0x0004\n#define\tNFSID_ADDUSERNAME\t0x0008\n#define\tNFSID_DELUSERNAME\t0x0010\n#define\tNFSID_ADDGID\t\t0x0020\n#define\tNFSID_DELGID\t\t0x0040\n#define\tNFSID_ADDGROUPNAME\t0x0080\n#define\tNFSID_DELGROUPNAME\t0x0100\n\n/*\n * fs.nfs sysctl(3) identifiers\n */\n#define\tNFS_NFSSTATS\t1\t\t/* struct: struct nfsstats */\n\n#define\tFS_NFS_NAMES { \t\t\t\t\t\t\t\\\n\t\t       { 0, 0 }, \t\t\t\t\t\\\n\t\t       { \"nfsstats\", CTLTYPE_STRUCT }, \t\t\t\\\n}\n\n/*\n * Here is the definition of the attribute bits array and macros that\n * manipulate it.\n * THE MACROS MUST BE MANUALLY MODIFIED IF NFSATTRBIT_MAXWORDS CHANGES!!\n * It is (NFSATTRBIT_MAX + 31) / 32.\n */\n#define\tNFSATTRBIT_MAXWORDS\t2\n\ntypedef struct {\n\tu_int32_t bits[NFSATTRBIT_MAXWORDS];\n} nfsattrbit_t;\n\n#define\tNFSZERO_ATTRBIT(b) do { (b)->bits[0] = 0; (b)->bits[1] = 0; } while (0)\n#define\tNFSSET_ATTRBIT(t, f) do { (t)->bits[0] = (f)->bits[0]; \t\t\\\n\t\t\t\t  (t)->bits[1] = (f)->bits[1]; } while (0)\n#define\tNFSSETSUPP_ATTRBIT(b) do { \t\t\t\t\t\\\n\t(b)->bits[0] = NFSATTRBIT_SUPP0; \t\t\t\t\\\n\t(b)->bits[1] = (NFSATTRBIT_SUPP1 | NFSATTRBIT_SUPPSETONLY); } while (0)\n#define\tNFSISSET_ATTRBIT(b, p)\t((b)->bits[(p) / 32] & (1 << ((p) % 32)))\n#define\tNFSSETBIT_ATTRBIT(b, p)\t((b)->bits[(p) / 32] |= (1 << ((p) % 32)))\n#define\tNFSCLRBIT_ATTRBIT(b, p)\t((b)->bits[(p) / 32] &= ~(1 << ((p) % 32)))\n#define\tNFSCLRALL_ATTRBIT(b, a)\tdo { \t\t\t\t\t\\\n\t\t(b)->bits[0] &= ~((a)->bits[0]); \t\t\t\\\n\t\t(b)->bits[1] &= ~((a)->bits[1]); \t\t\t\\\n\t\t} while (0)\n#define\tNFSCLRNOT_ATTRBIT(b, a)\tdo { \t\t\t\t\t\\\n\t\t(b)->bits[0] &= ((a)->bits[0]); \t\t\t\\\n\t\t(b)->bits[1] &= ((a)->bits[1]); \t\t\t\\\n\t\t} while (0)\n#define\tNFSCLRNOTFILLABLE_ATTRBIT(b) do { \t\t\t\t\\\n\t\t(b)->bits[0] &= NFSATTRBIT_SUPP0; \t\t\t\\\n\t\t(b)->bits[1] &= NFSATTRBIT_SUPP1; } while (0)\n#define\tNFSCLRNOTSETABLE_ATTRBIT(b) do { \t\t\t\t\\\n\t\t(b)->bits[0] &= NFSATTRBIT_SETABLE0; \t\t\t\\\n\t\t(b)->bits[1] &= NFSATTRBIT_SETABLE1; } while (0)\n#define\tNFSNONZERO_ATTRBIT(b)\t((b)->bits[0] || (b)->bits[1])\n#define\tNFSEQUAL_ATTRBIT(b, p)\t\t\t\t\t\t\\\n\t((b)->bits[0] == (p)->bits[0] && (b)->bits[1] == (p)->bits[1])\n#define\tNFSGETATTR_ATTRBIT(b) do { \t\t\t\t\t\\\n\t\t(b)->bits[0] = NFSATTRBIT_GETATTR0; \t\t\t\\\n\t\t(b)->bits[1] = NFSATTRBIT_GETATTR1; } while (0)\n#define\tNFSWCCATTR_ATTRBIT(b) do { \t\t\t\t\t\\\n\t\t(b)->bits[0] = NFSATTRBIT_WCCATTR0; \t\t\t\\\n\t\t(b)->bits[1] = NFSATTRBIT_WCCATTR1; } while (0)\n#define\tNFSWRITEGETATTR_ATTRBIT(b) do { \t\t\t\t\\\n\t\t(b)->bits[0] = NFSATTRBIT_WRITEGETATTR0;\t\t\\\n\t\t(b)->bits[1] = NFSATTRBIT_WRITEGETATTR1; } while (0)\n#define\tNFSCBGETATTR_ATTRBIT(b, c) do { \t\t\t\t\\\n\t(c)->bits[0] = ((b)->bits[0] & NFSATTRBIT_CBGETATTR0); \t\t\\\n\t(c)->bits[1] = ((b)->bits[1] & NFSATTRBIT_CBGETATTR1); } while (0)\n#define\tNFSPATHCONF_GETATTRBIT(b) do { \t\t\t\t\t\\\n\t\t(b)->bits[0] = NFSGETATTRBIT_PATHCONF0; \t\t\\\n\t\t(b)->bits[1] = NFSGETATTRBIT_PATHCONF1; } while (0)\n#define\tNFSSTATFS_GETATTRBIT(b)\tdo { \t\t\t\t\t\\\n\t\t(b)->bits[0] = NFSGETATTRBIT_STATFS0; \t\t\t\\\n\t\t(b)->bits[1] = NFSGETATTRBIT_STATFS1; } while (0)\n#define\tNFSISSETSTATFS_ATTRBIT(b) \t\t\t\t\t\\\n\t\t(((b)->bits[0] & NFSATTRBIT_STATFS0) || \t\t\\\n\t\t ((b)->bits[1] & NFSATTRBIT_STATFS1))\n#define\tNFSCLRSTATFS_ATTRBIT(b)\tdo { \t\t\t\t\t\\\n\t\t(b)->bits[0] &= ~NFSATTRBIT_STATFS0; \t\t\t\\\n\t\t(b)->bits[1] &= ~NFSATTRBIT_STATFS1; } while (0)\n#define\tNFSREADDIRPLUS_ATTRBIT(b) do { \t\t\t\t\t\\\n\t\t(b)->bits[0] = NFSATTRBIT_READDIRPLUS0; \t\t\\\n\t\t(b)->bits[1] = NFSATTRBIT_READDIRPLUS1; } while (0)\n#define\tNFSREFERRAL_ATTRBIT(b) do { \t\t\t\t\t\\\n\t\t(b)->bits[0] = NFSATTRBIT_REFERRAL0;\t \t\t\\\n\t\t(b)->bits[1] = NFSATTRBIT_REFERRAL1; } while (0)\n\n/*\n * Store uid, gid creds that were used when the stateid was acquired.\n * The RPC layer allows NFS_MAXGRPS + 1 groups to go out on the wire,\n * so that's how many gets stored here.\n */\nstruct nfscred {\n\tuid_t \t\tnfsc_uid;\n\tgid_t\t\tnfsc_groups[NFS_MAXGRPS + 1];\n\tint\t\tnfsc_ngroups;\n};\n\n/*\n * Constants that define the file handle for the V4 root directory.\n * (The FSID must never be used by other file systems that are exported.)\n */\n#define\tNFSV4ROOT_FSID0\t\t((int32_t) -1)\n#define\tNFSV4ROOT_FSID1\t\t((int32_t) -1)\n#define\tNFSV4ROOT_REFERRAL\t((int32_t) -2)\n#define\tNFSV4ROOT_INO\t\t2\t/* It's traditional */\n#define\tNFSV4ROOT_GEN\t\t1\n\n/*\n * The set of signals the interrupt an I/O in progress for NFSMNT_INT mounts.\n * What should be in this set is open to debate, but I believe that since\n * I/O system calls on ufs are never interrupted by signals the set should\n * be minimal. My reasoning is that many current programs that use signals\n * such as SIGALRM will not expect file I/O system calls to be interrupted\n * by them and break.\n */\n#if defined(_KERNEL) || defined(KERNEL)\n\nstruct uio; struct buf; struct vattr; struct nameidata;\t/* XXX */\n\n/*\n * Socket errors ignored for connectionless sockets?\n * For now, ignore them all\n */\n#define\tNFSIGNORE_SOERROR(s, e) \t\t\t\t\t\\\n\t\t((e) != EINTR && (e) != ERESTART && (e) != EWOULDBLOCK && \\\n\t\t((s) & PR_CONNREQUIRED) == 0)\n\n\n/*\n * This structure holds socket information for a connection. Used by the\n * client and the server for callbacks.\n */\nstruct nfssockreq {\n\tNFSSOCKADDR_T\tnr_nam;\n\tint\t\tnr_sotype;\n\tint\t\tnr_soproto;\n\tint\t\tnr_soflags;\n\tstruct ucred\t*nr_cred;\n\tint\t\tnr_lock;\n\tNFSMUTEX_T\tnr_mtx;\n\tu_int32_t\tnr_prog;\n\tu_int32_t\tnr_vers;\n\tstruct __rpc_client *nr_client;\n};\n\n/*\n * And associated nr_lock bits.\n */\n#define\tNFSR_SNDLOCK\t\t0x01\n#define\tNFSR_WANTSND\t\t0x02\n#define\tNFSR_RCVLOCK\t\t0x04\n#define\tNFSR_WANTRCV\t\t0x08\n#define\tNFSR_RESERVEDPORT\t0x10\n#define\tNFSR_LOCALHOST\t\t0x20\n\n/*\n * Queue head for nfsreq's\n */\nTAILQ_HEAD(nfsreqhead, nfsreq);\n\n/* This is the only nfsreq R_xxx flag still used. */\n#define\tR_DONTRECOVER\t0x00000100\t/* don't initiate recovery when this\n\t\t\t\t\t   rpc gets a stale state reply */\n\n/*\n * Network address hash list element\n */\nunion nethostaddr {\n\tstruct in_addr\thad_inet;\n\tstruct in6_addr had_inet6;\n};\n\n/*\n * Structure of list of mechanisms.\n */\nstruct nfsgss_mechlist {\n\tint\tlen;\n\tconst u_char\t*str;\n\tint\ttotlen;\n};\n#define\tKERBV_MECH\t0\t/* position in list */\n\n/*\n * This structure is used by the server for describing each request.\n */\nstruct nfsrv_descript {\n\tmbuf_t\t\t\tnd_mrep;\t/* Request mbuf list */\n\tmbuf_t\t\t\tnd_md;\t\t/* Current dissect mbuf */\n\tmbuf_t\t\t\tnd_mreq;\t/* Reply mbuf list */\n\tmbuf_t\t\t\tnd_mb;\t\t/* Current build mbuf */\n\tNFSSOCKADDR_T\t\tnd_nam;\t\t/* and socket addr */\n\tNFSSOCKADDR_T\t\tnd_nam2;\t/* return socket addr */\n\tcaddr_t\t\t\tnd_dpos;\t/* Current dissect pos */\n\tcaddr_t\t\t\tnd_bpos;\t/* Current build pos */\n\tu_int16_t\t\tnd_procnum;\t/* RPC # */\n\tu_int32_t\t\tnd_flag;\t/* nd_flag */\n\tu_int32_t\t\tnd_repstat;\t/* Reply status */\n\tint\t\t\t*nd_errp;\t/* Pointer to ret status */\n\tu_int32_t\t\tnd_retxid;\t/* Reply xid */\n\tstruct nfsrvcache\t*nd_rp;\t\t/* Assoc. cache entry */\n\tstruct timeval\t\tnd_starttime;\t/* Time RPC initiated */\n\tfhandle_t\t\tnd_fh;\t\t/* File handle */\n\tstruct ucred\t\t*nd_cred;\t/* Credentials */\n\tuid_t\t\t\tnd_saveduid;\t/* Saved uid */\n\tu_int64_t\t\tnd_sockref;\t/* Rcv socket ref# */\n\tu_int64_t\t\tnd_compref;\t/* Compound RPC ref# */\n\ttime_t\t\t\tnd_tcpconntime;\t/* Time TCP connection est. */\n\tnfsquad_t\t\tnd_clientid;\t/* Implied clientid */\n\tint\t\t\tnd_gssnamelen;\t/* principal name length */\n\tchar\t\t\t*nd_gssname;\t/* principal name */\n};\n\n#define\tnd_princlen\tnd_gssnamelen\n#define\tnd_principal\tnd_gssname\n\n/* Bits for \"nd_flag\" */\n#define\tND_DONTSAVEREPLY \t0x00000001\n#define\tND_SAVEREPLY\t\t0x00000002\n#define\tND_NFSV2\t\t0x00000004\n#define\tND_NFSV3\t\t0x00000008\n#define\tND_NFSV4\t\t0x00000010\n#define\tND_KERBV\t\t0x00000020\n#define\tND_GSSINTEGRITY\t\t0x00000040\n#define\tND_GSSPRIVACY\t\t0x00000080\n#define\tND_WINDOWVERF\t\t0x00000100\n#define\tND_GSSINITREPLY\t\t0x00000200\n#define\tND_STREAMSOCK\t\t0x00000400\n#define\tND_PUBLOOKUP\t\t0x00000800\n#define\tND_USEGSSNAME\t\t0x00001000\n#define\tND_SAMETCPCONN\t\t0x00002000\n#define\tND_IMPLIEDCLID\t\t0x00004000\n#define\tND_NOMOREDATA\t\t0x00008000\n#define\tND_V4WCCATTR\t\t0x00010000\n#define\tND_NFSCB\t\t0x00020000\n#define\tND_AUTHNONE\t\t0x00040000\n#define\tND_EXAUTHSYS\t\t0x00080000\n#define\tND_EXGSS\t\t0x00100000\n#define\tND_EXGSSINTEGRITY\t0x00200000\n#define\tND_EXGSSPRIVACY\t\t0x00400000\n#define\tND_INCRSEQID\t\t0x00800000\n\n/*\n * ND_GSS should be the \"or\" of all GSS type authentications.\n */\n#define\tND_GSS\t\t(ND_KERBV)\n\nstruct nfsv4_opflag {\n\tint\tretfh;\n\tint\tneedscfh;\n\tint\tsavereply;\n\tint\tmodifyfs;\n\tint\tlktype;\n};\n\n/*\n * Flags used to indicate what to do w.r.t. seqid checking.\n */\n#define\tNFSRVSEQID_FIRST\t0x01\n#define\tNFSRVSEQID_LAST\t\t0x02\n#define\tNFSRVSEQID_OPEN\t\t0x04\n\n/*\n * assign a doubly linked list to a new head\n * and prepend one list into another.\n */\n#define\tLIST_NEWHEAD(nhead, ohead, field) do { \t\t\t\t\\\n\tif (((nhead)->lh_first = (ohead)->lh_first) != NULL) \t\t\\\n\t\t(ohead)->lh_first->field.le_prev = &(nhead)->lh_first; \t\\\n\t(ohead)->lh_first = NULL; \t\t\t\t\t\\\n    } while (0)\n\n#define\tLIST_PREPEND(head, phead, lelm, field) do {\t\t\t\\\n\tif ((head)->lh_first != NULL) {\t\t\t\t\t\\\n\t\t(lelm)->field.le_next = (head)->lh_first;\t\t\\\n\t\t(lelm)->field.le_next->field.le_prev =\t\t\t\\\n\t\t    &(lelm)->field.le_next;\t\t\t\t\\\n\t}\t\t\t\t\t\t\t\t\\\n\t(head)->lh_first = (phead)->lh_first;\t\t\t\t\\\n\t(head)->lh_first->field.le_prev = &(head)->lh_first;\t\t\\\n    } while (0)\n\n/*\n * File handle structure for client. Malloc'd to the correct length with\n * malloc type M_NFSFH.\n */\nstruct nfsfh {\n\tu_int16_t\tnfh_len;\t/* Length of file handle */\n\tu_int8_t\tnfh_fh[1];\t/* and the file handle */\n};\n\n/*\n * File handle structure for server. The NFSRV_MAXFH constant is\n * set in nfsdport.h. I use a 32bit length, so that alignment is\n * preserved.\n */\nstruct nfsrvfh {\n\tu_int32_t\tnfsrvfh_len;\n\tu_int8_t\tnfsrvfh_data[NFSRV_MAXFH];\n};\n\n/*\n * This structure is used for sleep locks on the NFSv4 nfsd threads and\n * NFSv4 client data structures.\n */\nstruct nfsv4lock {\n\tu_int32_t\tnfslock_usecnt;\n\tu_int8_t\tnfslock_lock;\n};\n#define\tNFSV4LOCK_LOCK\t\t0x01\n#define\tNFSV4LOCK_LOCKWANTED\t0x02\n#define\tNFSV4LOCK_WANTED\t0x04\n\n/*\n * Values for the override argument for nfsvno_accchk().\n */\n#define\tNFSACCCHK_NOOVERRIDE\t\t0\n#define\tNFSACCCHK_ALLOWROOT\t\t1\n#define\tNFSACCCHK_ALLOWOWNER\t\t2\n\n/*\n * and values for the vpislocked argument for nfsvno_accchk().\n */\n#define\tNFSACCCHK_VPNOTLOCKED\t\t0\n#define\tNFSACCCHK_VPISLOCKED\t\t1\n\n#endif\t/* _KERNEL */\n\n#endif\t/* _NFS_NFS_H */\n"
  },
  {
    "path": "freebsd-headers/fs/nfs/nfs_var.h",
    "content": "/*-\n * Copyright (c) 1989, 1993\n *\tThe Regents of the University of California.  All rights reserved.\n *\n * This code is derived from software contributed to Berkeley by\n * Rick Macklem at The University of Guelph.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 4. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/fs/nfs/nfs_var.h 224078 2011-07-16 08:05:17Z zack $\n */\n\n/*\n * XXX needs <nfs/rpcv2.h> and <nfs/nfs.h> because of typedefs\n */\n\nstruct uio;\nstruct ucred;\nstruct nfscred;\nNFSPROC_T;\nstruct buf;\nstruct sockaddr_in;\nstruct nfs_dlmount;\nstruct file;\nstruct nfsmount;\nstruct socket;\nstruct nfsreq;\nstruct nfssockreq;\nstruct vattr;\nstruct nameidata;\nstruct nfsnode;\nstruct nfsfh;\nstruct sillyrename;\nstruct componentname;\nstruct nfsd_srvargs;\nstruct nfsrv_descript;\nstruct nfs_fattr;\nunion nethostaddr;\nstruct nfsstate;\nstruct nfslock;\nstruct nfsclient;\nstruct nfslockconflict;\nstruct nfsd_idargs;\nstruct nfsd_clid;\nstruct nfsusrgrp;\nstruct nfsclowner;\nstruct nfsclopen;\nstruct nfsclopenhead;\nstruct nfsclclient;\nstruct nfscllockowner;\nstruct nfscllock;\nstruct nfscldeleg;\nstruct nfsv4lock;\nstruct nfsvattr;\nstruct nfs_vattr;\nstruct NFSSVCARGS;\n#ifdef __FreeBSD__\nNFS_ACCESS_ARGS;\nNFS_OPEN_ARGS;\nNFS_GETATTR_ARGS;\nNFS_LOOKUP_ARGS;\nNFS_READDIR_ARGS;\n#endif\n\n/* nfs_nfsdstate.c */\nint nfsrv_setclient(struct nfsrv_descript *, struct nfsclient **,\n    nfsquad_t *, nfsquad_t *, NFSPROC_T *);\nint nfsrv_getclient(nfsquad_t, int, struct nfsclient **, nfsquad_t,\n    struct nfsrv_descript *, NFSPROC_T *);\nint nfsrv_adminrevoke(struct nfsd_clid *, NFSPROC_T *);\nvoid nfsrv_dumpclients(struct nfsd_dumpclients *, int);\nvoid nfsrv_dumplocks(vnode_t, struct nfsd_dumplocks *, int, NFSPROC_T *);\nint nfsrv_lockctrl(vnode_t, struct nfsstate **,\n    struct nfslock **, struct nfslockconflict *, nfsquad_t, nfsv4stateid_t *,\n    struct nfsexstuff *, struct nfsrv_descript *, NFSPROC_T *);\nint nfsrv_openctrl(struct nfsrv_descript *, vnode_t,\n    struct nfsstate **, nfsquad_t, nfsv4stateid_t *, nfsv4stateid_t *, \n    u_int32_t *, struct nfsexstuff *, NFSPROC_T *, u_quad_t);\nint nfsrv_opencheck(nfsquad_t, nfsv4stateid_t *, struct nfsstate *,\n    vnode_t, struct nfsrv_descript *, NFSPROC_T *, int);\nint nfsrv_openupdate(vnode_t, struct nfsstate *, nfsquad_t,\n    nfsv4stateid_t *, struct nfsrv_descript *, NFSPROC_T *);\nint nfsrv_delegupdate(nfsquad_t, nfsv4stateid_t *, vnode_t, int,\n    struct ucred *, NFSPROC_T *);\nint nfsrv_releaselckown(struct nfsstate *, nfsquad_t, NFSPROC_T *);\nvoid nfsrv_zapclient(struct nfsclient *, NFSPROC_T *);\nint nfssvc_idname(struct nfsd_idargs *);\nvoid nfsrv_servertimer(void);\nint nfsrv_getclientipaddr(struct nfsrv_descript *, struct nfsclient *);\nvoid nfsrv_setupstable(NFSPROC_T *);\nvoid nfsrv_updatestable(NFSPROC_T *);\nvoid nfsrv_writestable(u_char *, int, int, NFSPROC_T *);\nvoid nfsrv_throwawayopens(NFSPROC_T *);\nint nfsrv_checkremove(vnode_t, int, NFSPROC_T *);\nvoid nfsd_recalldelegation(vnode_t, NFSPROC_T *);\nvoid nfsd_disabledelegation(vnode_t, NFSPROC_T *);\nint nfsrv_checksetattr(vnode_t, struct nfsrv_descript *,\n    nfsv4stateid_t *, struct nfsvattr *, nfsattrbit_t *, struct nfsexstuff *,\n    NFSPROC_T *);\nint nfsrv_checkgetattr(struct nfsrv_descript *, vnode_t,\n    struct nfsvattr *, nfsattrbit_t *, struct ucred *, NFSPROC_T *);\nint nfsrv_nfsuserdport(u_short, NFSPROC_T *);\nvoid nfsrv_nfsuserddelport(void);\nvoid nfsrv_throwawayallstate(NFSPROC_T *);\n\n/* nfs_nfsdserv.c */\nint nfsrvd_access(struct nfsrv_descript *, int,\n    vnode_t, NFSPROC_T *, struct nfsexstuff *);\nint nfsrvd_getattr(struct nfsrv_descript *, int,\n    vnode_t, NFSPROC_T *, struct nfsexstuff *);\nint nfsrvd_setattr(struct nfsrv_descript *, int,\n    vnode_t, NFSPROC_T *, struct nfsexstuff *);\nint nfsrvd_lookup(struct nfsrv_descript *, int,\n    vnode_t, vnode_t *, fhandle_t *, NFSPROC_T *,\n    struct nfsexstuff *);\nint nfsrvd_readlink(struct nfsrv_descript *, int,\n    vnode_t, NFSPROC_T *, struct nfsexstuff *);\nint nfsrvd_read(struct nfsrv_descript *, int,\n    vnode_t, NFSPROC_T *, struct nfsexstuff *);\nint nfsrvd_write(struct nfsrv_descript *, int,\n    vnode_t, NFSPROC_T *, struct nfsexstuff *);\nint nfsrvd_create(struct nfsrv_descript *, int,\n    vnode_t, NFSPROC_T *, struct nfsexstuff *);\nint nfsrvd_mknod(struct nfsrv_descript *, int,\n    vnode_t, vnode_t *, fhandle_t *, NFSPROC_T *,\n    struct nfsexstuff *);\nint nfsrvd_remove(struct nfsrv_descript *, int,\n    vnode_t, NFSPROC_T *, struct nfsexstuff *);\nint nfsrvd_rename(struct nfsrv_descript *, int,\n    vnode_t, vnode_t, NFSPROC_T *, struct nfsexstuff *,\n    struct nfsexstuff *);\nint nfsrvd_link(struct nfsrv_descript *, int,\n    vnode_t, vnode_t, NFSPROC_T *, struct nfsexstuff *,\n    struct nfsexstuff *);\nint nfsrvd_symlink(struct nfsrv_descript *, int,\n    vnode_t, vnode_t *, fhandle_t *, NFSPROC_T *,\n    struct nfsexstuff *);\nint nfsrvd_mkdir(struct nfsrv_descript *, int,\n    vnode_t, vnode_t *, fhandle_t *, NFSPROC_T *,\n    struct nfsexstuff *);\nint nfsrvd_readdir(struct nfsrv_descript *, int,\n    vnode_t, NFSPROC_T *, struct nfsexstuff *);\nint nfsrvd_readdirplus(struct nfsrv_descript *, int,\n    vnode_t, NFSPROC_T *, struct nfsexstuff *);\nint nfsrvd_commit(struct nfsrv_descript *, int,\n    vnode_t, NFSPROC_T *, struct nfsexstuff *);\nint nfsrvd_statfs(struct nfsrv_descript *, int,\n    vnode_t, NFSPROC_T *, struct nfsexstuff *);\nint nfsrvd_fsinfo(struct nfsrv_descript *, int,\n    vnode_t, NFSPROC_T *, struct nfsexstuff *);\nint nfsrvd_close(struct nfsrv_descript *, int,\n    vnode_t, NFSPROC_T *, struct nfsexstuff *);\nint nfsrvd_delegpurge(struct nfsrv_descript *, int,\n    vnode_t, NFSPROC_T *, struct nfsexstuff *);\nint nfsrvd_delegreturn(struct nfsrv_descript *, int,\n    vnode_t, NFSPROC_T *, struct nfsexstuff *);\nint nfsrvd_getfh(struct nfsrv_descript *, int,\n    vnode_t, NFSPROC_T *, struct nfsexstuff *);\nint nfsrvd_lock(struct nfsrv_descript *, int,\n    vnode_t, NFSPROC_T *, struct nfsexstuff *);\nint nfsrvd_lockt(struct nfsrv_descript *, int,\n    vnode_t, NFSPROC_T *, struct nfsexstuff *);\nint nfsrvd_locku(struct nfsrv_descript *, int,\n    vnode_t, NFSPROC_T *, struct nfsexstuff *);\nint nfsrvd_openconfirm(struct nfsrv_descript *, int,\n    vnode_t, NFSPROC_T *, struct nfsexstuff *);\nint nfsrvd_opendowngrade(struct nfsrv_descript *, int,\n    vnode_t, NFSPROC_T *, struct nfsexstuff *);\nint nfsrvd_renew(struct nfsrv_descript *, int,\n    vnode_t, NFSPROC_T *, struct nfsexstuff *);\nint nfsrvd_secinfo(struct nfsrv_descript *, int,\n    vnode_t, NFSPROC_T *, struct nfsexstuff *);\nint nfsrvd_setclientid(struct nfsrv_descript *, int,\n    vnode_t, NFSPROC_T *, struct nfsexstuff *);\nint nfsrvd_setclientidcfrm(struct nfsrv_descript *, int,\n    vnode_t, NFSPROC_T *, struct nfsexstuff *);\nint nfsrvd_verify(struct nfsrv_descript *, int,\n    vnode_t, NFSPROC_T *, struct nfsexstuff *);\nint nfsrvd_open(struct nfsrv_descript *, int,\n    vnode_t, vnode_t *, fhandle_t *, NFSPROC_T *,\n    struct nfsexstuff *);\nint nfsrvd_openattr(struct nfsrv_descript *, int,\n    vnode_t, vnode_t *, fhandle_t *, NFSPROC_T *,\n    struct nfsexstuff *);\nint nfsrvd_releaselckown(struct nfsrv_descript *, int,\n    vnode_t, NFSPROC_T *, struct nfsexstuff *);\nint nfsrvd_pathconf(struct nfsrv_descript *, int,\n    vnode_t, NFSPROC_T *, struct nfsexstuff *);\n\n/* nfs_nfsdsocket.c */\nvoid nfsrvd_rephead(struct nfsrv_descript *);\nvoid nfsrvd_dorpc(struct nfsrv_descript *, int, NFSPROC_T *);\n\n/* nfs_nfsdcache.c */\nvoid nfsrvd_initcache(void);\nint nfsrvd_getcache(struct nfsrv_descript *, struct socket *);\nstruct nfsrvcache *nfsrvd_updatecache(struct nfsrv_descript *,\n    struct socket *);\nvoid nfsrvd_sentcache(struct nfsrvcache *, struct socket *, int);\nvoid nfsrvd_cleancache(void);\nvoid nfsrvd_refcache(struct nfsrvcache *);\nvoid nfsrvd_derefcache(struct nfsrvcache *);\nvoid nfsrvd_delcache(struct nfsrvcache *);\n\n/* nfs_commonsubs.c */\nvoid newnfs_init(void);\nint nfsaddr_match(int, union nethostaddr *, NFSSOCKADDR_T);\nint nfsaddr2_match(NFSSOCKADDR_T, NFSSOCKADDR_T);\nint nfsm_strtom(struct nfsrv_descript *, const char *, int);\nint nfsm_mbufuio(struct nfsrv_descript *, struct uio *, int);\nint nfsm_fhtom(struct nfsrv_descript *, u_int8_t *, int, int);\nint nfsm_advance(struct nfsrv_descript *, int, int);\nvoid *nfsm_dissct(struct nfsrv_descript *, int);\nvoid newnfs_trimleading(struct nfsrv_descript *);\nvoid newnfs_trimtrailing(struct nfsrv_descript *, mbuf_t,\n    caddr_t);\nvoid newnfs_copycred(struct nfscred *, struct ucred *);\nvoid newnfs_copyincred(struct ucred *, struct nfscred *);\nint nfsrv_dissectacl(struct nfsrv_descript *, NFSACL_T *, int *,\n    int *, NFSPROC_T *);\nint nfsrv_getattrbits(struct nfsrv_descript *, nfsattrbit_t *, int *,\n    int *);\nint nfsv4_loadattr(struct nfsrv_descript *, vnode_t,\n    struct nfsvattr *, struct nfsfh **, fhandle_t *, int,\n    struct nfsv3_pathconf *, struct statfs *, struct nfsstatfs *,\n    struct nfsfsinfo *, NFSACL_T *,\n    int, int *, u_int32_t *, u_int32_t *, NFSPROC_T *, struct ucred *);\nint nfsv4_lock(struct nfsv4lock *, int, int *, void *, struct mount *);\nvoid nfsv4_unlock(struct nfsv4lock *, int);\nvoid nfsv4_relref(struct nfsv4lock *);\nvoid nfsv4_getref(struct nfsv4lock *, int *, void *, struct mount *);\nint nfsv4_getref_nonblock(struct nfsv4lock *);\nint nfsv4_testlock(struct nfsv4lock *);\nint nfsrv_mtostr(struct nfsrv_descript *, char *, int);\nint nfsrv_checkutf8(u_int8_t *, int);\nint newnfs_sndlock(int *);\nvoid newnfs_sndunlock(int *);\n\n/* nfs_clcomsubs.c */\nvoid nfsm_uiombuf(struct nfsrv_descript *, struct uio *, int);\nvoid nfscl_reqstart(struct nfsrv_descript *, int, struct nfsmount *,\n    u_int8_t *, int, u_int32_t **);\nnfsuint64 *nfscl_getcookie(struct nfsnode *, off_t off, int);\nvoid nfscl_fillsattr(struct nfsrv_descript *, struct vattr *,\n      vnode_t, int, u_int32_t);\nu_int8_t *nfscl_getmyip(struct nfsmount *, int *);\nint nfsm_getfh(struct nfsrv_descript *, struct nfsfh **);\nint nfscl_mtofh(struct nfsrv_descript *, struct nfsfh **,\n        struct nfsvattr *, int *);\nint nfscl_postop_attr(struct nfsrv_descript *, struct nfsvattr *, int *,\n    void *);\nint nfscl_wcc_data(struct nfsrv_descript *, vnode_t,\n    struct nfsvattr *, int *, int *, void *);\nint nfsm_loadattr(struct nfsrv_descript *, struct nfsvattr *);\nint nfscl_request(struct nfsrv_descript *, vnode_t,\n         NFSPROC_T *, struct ucred *, void *);\nvoid nfsm_stateidtom(struct nfsrv_descript *, nfsv4stateid_t *, int);\n\n/* nfs_nfsdsubs.c */\nvoid nfsd_fhtovp(struct nfsrv_descript *, struct nfsrvfh *, int,\n    vnode_t *, struct nfsexstuff *,\n    mount_t *, int, NFSPROC_T *);\nint nfsd_excred(struct nfsrv_descript *, struct nfsexstuff *, struct ucred *);\nint nfsrv_mtofh(struct nfsrv_descript *, struct nfsrvfh *);\nint nfsrv_putattrbit(struct nfsrv_descript *, nfsattrbit_t *);\nvoid nfsrv_wcc(struct nfsrv_descript *, int, struct nfsvattr *, int,\n    struct nfsvattr *);\nint nfsv4_fillattr(struct nfsrv_descript *, struct mount *, vnode_t, NFSACL_T *,\n    struct vattr *, fhandle_t *, int, nfsattrbit_t *,\n    struct ucred *, NFSPROC_T *, int, int, int, int, uint64_t);\nvoid nfsrv_fillattr(struct nfsrv_descript *, struct nfsvattr *);\nvoid nfsrv_adj(mbuf_t, int, int);\nvoid nfsrv_postopattr(struct nfsrv_descript *, int, struct nfsvattr *);\nint nfsd_errmap(struct nfsrv_descript *);\nvoid nfsv4_uidtostr(uid_t, u_char **, int *, NFSPROC_T *);\nint nfsv4_strtouid(u_char *, int, uid_t *, NFSPROC_T *);\nvoid nfsv4_gidtostr(gid_t, u_char **, int *, NFSPROC_T *);\nint nfsv4_strtogid(u_char *, int, gid_t *, NFSPROC_T *);\nint nfsrv_checkuidgid(struct nfsrv_descript *, struct nfsvattr *);\nvoid nfsrv_fixattr(struct nfsrv_descript *, vnode_t,\n    struct nfsvattr *, NFSACL_T *, NFSPROC_T *, nfsattrbit_t *,\n    struct nfsexstuff *);\nint nfsrv_errmoved(int);\nint nfsrv_putreferralattr(struct nfsrv_descript *, nfsattrbit_t *,\n    struct nfsreferral *, int, int *);\nint nfsrv_parsename(struct nfsrv_descript *, char *, u_long *,\n    NFSPATHLEN_T *);\nvoid nfsd_init(void);\nint nfsd_checkrootexp(struct nfsrv_descript *);\n\n/* nfs_clvfsops.c */\n\n/* nfs_commonport.c */\nint nfsrv_checksockseqnum(struct socket *, tcp_seq);\nint nfsrv_getsockseqnum(struct socket *, tcp_seq *);\nint nfsrv_getsocksndseq(struct socket *, tcp_seq *, tcp_seq *);\nint nfsrv_lookupfilename(struct nameidata *, char *, NFSPROC_T *);\nvoid nfsrv_object_create(vnode_t, NFSPROC_T *);\nint nfsrv_mallocmget_limit(void);\nint nfsvno_v4rootexport(struct nfsrv_descript *);\nvoid newnfs_portinit(void);\nstruct ucred *newnfs_getcred(void);\nvoid newnfs_setroot(struct ucred *);\nint nfs_catnap(int, int, const char *);\nstruct nfsreferral *nfsv4root_getreferral(vnode_t, vnode_t, u_int32_t);\nint nfsvno_pathconf(vnode_t, int, register_t *, struct ucred *,\n    NFSPROC_T *);\nint nfsrv_atroot(vnode_t, long *);\nvoid newnfs_timer(void *);\nint nfs_supportsnfsv4acls(vnode_t);\n\n/* nfs_commonacl.c */\nint nfsrv_dissectace(struct nfsrv_descript *, struct acl_entry *,\n    int *, int *, NFSPROC_T *);\nint nfsrv_buildacl(struct nfsrv_descript *, NFSACL_T *, enum vtype,\n    NFSPROC_T *);\nint nfsrv_setacl(vnode_t, NFSACL_T *, struct ucred *,\n    NFSPROC_T *);\nint nfsrv_compareacl(NFSACL_T *, NFSACL_T *);\n\n/* nfs_clrpcops.c */\nint nfsrpc_null(vnode_t, struct ucred *, NFSPROC_T *);\nint nfsrpc_access(vnode_t, int, struct ucred *, NFSPROC_T *,\n    struct nfsvattr *, int *);\nint nfsrpc_accessrpc(vnode_t, u_int32_t, struct ucred *,\n    NFSPROC_T *, struct nfsvattr *, int *, u_int32_t *, void *);\nint nfsrpc_open(vnode_t, int, struct ucred *, NFSPROC_T *);\nint nfsrpc_openrpc(struct nfsmount *, vnode_t, u_int8_t *, int, u_int8_t *, int,\n    u_int32_t, struct nfsclopen *, u_int8_t *, int, struct nfscldeleg **, int,\n    u_int32_t, struct ucred *, NFSPROC_T *, int, int);\nint nfsrpc_opendowngrade(vnode_t, u_int32_t, struct nfsclopen *,\n    struct ucred *, NFSPROC_T *);\nint nfsrpc_close(vnode_t, int, NFSPROC_T *);\nint nfsrpc_closerpc(struct nfsrv_descript *, struct nfsmount *,\n    struct nfsclopen *, struct ucred *, NFSPROC_T *, int);\nint nfsrpc_openconfirm(vnode_t, u_int8_t *, int, struct nfsclopen *,\n    struct ucred *, NFSPROC_T *);\nint nfsrpc_setclient(struct nfsmount *, struct nfsclclient *,\n    struct ucred *, NFSPROC_T *);\nint nfsrpc_getattr(vnode_t, struct ucred *, NFSPROC_T *,\n    struct nfsvattr *, void *);\nint nfsrpc_getattrnovp(struct nfsmount *, u_int8_t *, int, int,\n    struct ucred *, NFSPROC_T *, struct nfsvattr *, u_int64_t *);\nint nfsrpc_setattr(vnode_t, struct vattr *, NFSACL_T *, struct ucred *,\n    NFSPROC_T *, struct nfsvattr *, int *, void *);\nint nfsrpc_lookup(vnode_t, char *, int, struct ucred *, NFSPROC_T *,\n    struct nfsvattr *, struct nfsvattr *, struct nfsfh **, int *, int *,\n    void *);\nint nfsrpc_readlink(vnode_t, struct uio *, struct ucred *,\n    NFSPROC_T *, struct nfsvattr *, int *, void *);\nint nfsrpc_read(vnode_t, struct uio *, struct ucred *, NFSPROC_T *,\n    struct nfsvattr *, int *, void *);\nint nfsrpc_write(vnode_t, struct uio *, int *, int *,\n    struct ucred *, NFSPROC_T *, struct nfsvattr *, int *, void *, int);\nint nfsrpc_mknod(vnode_t, char *, int, struct vattr *, u_int32_t,\n    enum vtype, struct ucred *, NFSPROC_T *, struct nfsvattr *,\n    struct nfsvattr *, struct nfsfh **, int *, int *, void *);\nint nfsrpc_create(vnode_t, char *, int, struct vattr *, nfsquad_t,\n    int, struct ucred *, NFSPROC_T *, struct nfsvattr *, struct nfsvattr *,\n    struct nfsfh **, int *, int *, void *);\nint nfsrpc_remove(vnode_t, char *, int, vnode_t, struct ucred *, NFSPROC_T *,\n    struct nfsvattr *, int *, void *);\nint nfsrpc_rename(vnode_t, vnode_t, char *, int, vnode_t, vnode_t, char *, int,\n    struct ucred *, NFSPROC_T *, struct nfsvattr *, struct nfsvattr *,\n    int *, int *, void *, void *);\nint nfsrpc_link(vnode_t, vnode_t, char *, int,\n    struct ucred *, NFSPROC_T *, struct nfsvattr *, struct nfsvattr *,\n    int *, int *, void *);\nint nfsrpc_symlink(vnode_t, char *, int, char *, struct vattr *,\n    struct ucred *, NFSPROC_T *, struct nfsvattr *, struct nfsvattr *,\n    struct nfsfh **, int *, int *, void *);\nint nfsrpc_mkdir(vnode_t, char *, int, struct vattr *,\n    struct ucred *, NFSPROC_T *, struct nfsvattr *, struct nfsvattr *,\n    struct nfsfh **, int *, int *, void *);\nint nfsrpc_rmdir(vnode_t, char *, int, struct ucred *, NFSPROC_T *,\n    struct nfsvattr *, int *, void *);\nint nfsrpc_readdir(vnode_t, struct uio *, nfsuint64 *, struct ucred *,\n    NFSPROC_T *, struct nfsvattr *, int *, int *, void *);\nint nfsrpc_readdirplus(vnode_t, struct uio *, nfsuint64 *, \n    struct ucred *, NFSPROC_T *, struct nfsvattr *, int *, int *, void *);\nint nfsrpc_commit(vnode_t, u_quad_t, int, struct ucred *,\n    NFSPROC_T *, u_char *, struct nfsvattr *, int *, void *);\nint nfsrpc_advlock(vnode_t, off_t, int, struct flock *, int,\n    struct ucred *, NFSPROC_T *, void *, int);\nint nfsrpc_lockt(struct nfsrv_descript *, vnode_t,\n    struct nfsclclient *, u_int64_t, u_int64_t, struct flock *,\n    struct ucred *, NFSPROC_T *, void *, int);\nint nfsrpc_lock(struct nfsrv_descript *, struct nfsmount *, vnode_t,\n    u_int8_t *, int, struct nfscllockowner *, int, int, u_int64_t,\n    u_int64_t, short, struct ucred *, NFSPROC_T *, int);\nint nfsrpc_statfs(vnode_t, struct nfsstatfs *, struct nfsfsinfo *,\n    struct ucred *, NFSPROC_T *, struct nfsvattr *, int *, void *);\nint nfsrpc_fsinfo(vnode_t, struct nfsfsinfo *, struct ucred *,\n    NFSPROC_T *, struct nfsvattr *, int *, void *);\nint nfsrpc_pathconf(vnode_t, struct nfsv3_pathconf *,\n    struct ucred *, NFSPROC_T *, struct nfsvattr *, int *, void *);\nint nfsrpc_renew(struct nfsclclient *, struct ucred *,\n    NFSPROC_T *);\nint nfsrpc_rellockown(struct nfsmount *, struct nfscllockowner *,\n    struct ucred *, NFSPROC_T *);\nint nfsrpc_getdirpath(struct nfsmount *, u_char *, struct ucred *,\n    NFSPROC_T *);\nint nfsrpc_delegreturn(struct nfscldeleg *, struct ucred *,\n    struct nfsmount *, NFSPROC_T *, int);\nint nfsrpc_getacl(vnode_t, struct ucred *, NFSPROC_T *, NFSACL_T *, void *);\nint nfsrpc_setacl(vnode_t, struct ucred *, NFSPROC_T *, NFSACL_T *, void *);\n\n/* nfs_clstate.c */\nint nfscl_open(vnode_t, u_int8_t *, int, u_int32_t, int,\n    struct ucred *, NFSPROC_T *, struct nfsclowner **, struct nfsclopen **,\n    int *, int *, int);\nint nfscl_getstateid(vnode_t, u_int8_t *, int, u_int32_t, struct ucred *,\n    NFSPROC_T *, nfsv4stateid_t *, void **);\nvoid nfscl_ownerrelease(struct nfsclowner *, int, int, int);\nvoid nfscl_openrelease(struct nfsclopen *, int, int);\nint nfscl_getcl(vnode_t, struct ucred *, NFSPROC_T *,\n    struct nfsclclient **);\nstruct nfsclclient *nfscl_findcl(struct nfsmount *);\nvoid nfscl_clientrelease(struct nfsclclient *);\nvoid nfscl_freelock(struct nfscllock *, int);\nvoid nfscl_freelockowner(struct nfscllockowner *, int);\nint nfscl_getbytelock(vnode_t, u_int64_t, u_int64_t, short,\n    struct ucred *, NFSPROC_T *, struct nfsclclient *, int, void *, int,\n    u_int8_t *, u_int8_t *, struct nfscllockowner **, int *, int *);\nint nfscl_relbytelock(vnode_t, u_int64_t, u_int64_t,\n    struct ucred *, NFSPROC_T *, int, struct nfsclclient *,\n    void *, int, struct nfscllockowner **, int *);\nint nfscl_checkwritelocked(vnode_t, struct flock *,\n    struct ucred *, NFSPROC_T *, void *, int);\nvoid nfscl_lockrelease(struct nfscllockowner *, int, int);\nvoid nfscl_fillclid(u_int64_t, char *, u_int8_t *, u_int16_t);\nvoid nfscl_filllockowner(void *, u_int8_t *, int);\nvoid nfscl_freeopen(struct nfsclopen *, int);\nvoid nfscl_umount(struct nfsmount *, NFSPROC_T *);\nvoid nfscl_renewthread(struct nfsclclient *, NFSPROC_T *);\nvoid nfscl_initiate_recovery(struct nfsclclient *);\nint nfscl_hasexpired(struct nfsclclient *, u_int32_t, NFSPROC_T *);\nvoid nfscl_dumpstate(struct nfsmount *, int, int, int, int);\nvoid nfscl_dupopen(vnode_t, int);\nint nfscl_getclose(vnode_t, struct nfsclclient **);\nint nfscl_doclose(vnode_t, struct nfsclclient **, NFSPROC_T *);\nvoid nfsrpc_doclose(struct nfsmount *, struct nfsclopen *, NFSPROC_T *);\nint nfscl_deleg(mount_t, struct nfsclclient *, u_int8_t *, int,\n    struct ucred *, NFSPROC_T *, struct nfscldeleg **);\nvoid nfscl_lockinit(struct nfsv4lock *);\nvoid nfscl_lockexcl(struct nfsv4lock *, void *);\nvoid nfscl_lockunlock(struct nfsv4lock *);\nvoid nfscl_lockderef(struct nfsv4lock *);\nvoid nfscl_docb(struct nfsrv_descript *, NFSPROC_T *);\nvoid nfscl_releasealllocks(struct nfsclclient *, vnode_t, NFSPROC_T *, void *,\n    int);\nint nfscl_lockt(vnode_t, struct nfsclclient *, u_int64_t,\n    u_int64_t, struct flock *, NFSPROC_T *, void *, int);\nint nfscl_mustflush(vnode_t);\nint nfscl_nodeleg(vnode_t, int);\nint nfscl_removedeleg(vnode_t, NFSPROC_T *, nfsv4stateid_t *);\nint nfscl_getref(struct nfsmount *);\nvoid nfscl_relref(struct nfsmount *);\nint nfscl_renamedeleg(vnode_t, nfsv4stateid_t *, int *, vnode_t,\n    nfsv4stateid_t *, int *, NFSPROC_T *);\nvoid nfscl_reclaimnode(vnode_t);\nvoid nfscl_newnode(vnode_t);\nvoid nfscl_delegmodtime(vnode_t);\nvoid nfscl_deleggetmodtime(vnode_t, struct timespec *);\nint nfscl_tryclose(struct nfsclopen *, struct ucred *,\n    struct nfsmount *, NFSPROC_T *);\nvoid nfscl_cleanup(NFSPROC_T *);\n\n/* nfs_clport.c */\nint nfscl_nget(mount_t, vnode_t, struct nfsfh *,\n    struct componentname *, NFSPROC_T *, struct nfsnode **, void *, int);\nNFSPROC_T *nfscl_getparent(NFSPROC_T *);\nvoid nfscl_start_renewthread(struct nfsclclient *);\nvoid nfscl_loadsbinfo(struct nfsmount *, struct nfsstatfs *, void *);\nvoid nfscl_loadfsinfo (struct nfsmount *, struct nfsfsinfo *);\nvoid nfscl_delegreturn(struct nfscldeleg *, int, struct nfsmount *,\n    struct ucred *, NFSPROC_T *);\nvoid nfsrvd_cbinit(int);\nint nfscl_checksattr(struct vattr *, struct nfsvattr *);\nint nfscl_ngetreopen(mount_t, u_int8_t *, int, NFSPROC_T *,\n    struct nfsnode **);\nint nfscl_procdoesntexist(u_int8_t *);\nint nfscl_maperr(NFSPROC_T *, int, uid_t, gid_t);\n\n/* nfs_clsubs.c */\nvoid nfscl_init(void);\n\n/* nfs_clbio.c */\nint ncl_flush(vnode_t, int, struct ucred *, NFSPROC_T *, int, int);\n\n/* nfs_clnode.c */\nvoid ncl_invalcaches(vnode_t);\n\n/* nfs_nfsdport.c */\nint nfsvno_getattr(vnode_t, struct nfsvattr *, struct ucred *,\n    NFSPROC_T *, int);\nint nfsvno_setattr(vnode_t, struct nfsvattr *, struct ucred *,\n    NFSPROC_T *, struct nfsexstuff *);\nint nfsvno_getfh(vnode_t, fhandle_t *, NFSPROC_T *);\nint nfsvno_accchk(vnode_t, accmode_t, struct ucred *,\n    struct nfsexstuff *, NFSPROC_T *, int, int, u_int32_t *);\nint nfsvno_namei(struct nfsrv_descript *, struct nameidata *,\n    vnode_t, int, struct nfsexstuff *, NFSPROC_T *, vnode_t *);\nvoid nfsvno_setpathbuf(struct nameidata *, char **, u_long **);\nvoid nfsvno_relpathbuf(struct nameidata *);\nint nfsvno_readlink(vnode_t, struct ucred *, NFSPROC_T *, mbuf_t *,\n    mbuf_t *, int *);\nint nfsvno_read(vnode_t, off_t, int, struct ucred *, NFSPROC_T *,\n    mbuf_t *, mbuf_t *);\nint nfsvno_write(vnode_t, off_t, int, int, int, mbuf_t,\n    char *, struct ucred *, NFSPROC_T *);\nint nfsvno_createsub(struct nfsrv_descript *, struct nameidata *,\n    vnode_t *, struct nfsvattr *, int *, int32_t *, NFSDEV_T, NFSPROC_T *,\n    struct nfsexstuff *);\nint nfsvno_mknod(struct nameidata *, struct nfsvattr *, struct ucred *,\n    NFSPROC_T *);\nint nfsvno_mkdir(struct nameidata *,\n    struct nfsvattr *, uid_t, struct ucred *, NFSPROC_T *,\n    struct nfsexstuff *);\nint nfsvno_symlink(struct nameidata *, struct nfsvattr *, char *, int, int,\n    uid_t, struct ucred *, NFSPROC_T *, struct nfsexstuff *);\nint nfsvno_getsymlink(struct nfsrv_descript *, struct nfsvattr *,\n    NFSPROC_T *, char **, int *);\nint nfsvno_removesub(struct nameidata *, int, struct ucred *, NFSPROC_T *,\n    struct nfsexstuff *);\nint nfsvno_rmdirsub(struct nameidata *, int, struct ucred *, NFSPROC_T *,\n    struct nfsexstuff *);\nint nfsvno_rename(struct nameidata *, struct nameidata *, u_int32_t,\n    u_int32_t, struct ucred *, NFSPROC_T *);\nint nfsvno_link(struct nameidata *, vnode_t, struct ucred *,\n    NFSPROC_T *, struct nfsexstuff *);\nint nfsvno_fsync(vnode_t, u_int64_t, int, struct ucred *, NFSPROC_T *);\nint nfsvno_statfs(vnode_t, struct statfs *);\nvoid nfsvno_getfs(struct nfsfsinfo *, int);\nvoid nfsvno_open(struct nfsrv_descript *, struct nameidata *, nfsquad_t,\n    nfsv4stateid_t *, struct nfsstate *, int *, struct nfsvattr *, int32_t *,\n    int, NFSACL_T *, nfsattrbit_t *, struct ucred *, NFSPROC_T *,\n    struct nfsexstuff *, vnode_t *);\nvoid nfsvno_updfilerev(vnode_t, struct nfsvattr *, struct ucred *,\n    NFSPROC_T *);\nint nfsvno_fillattr(struct nfsrv_descript *, struct mount *, vnode_t,\n    struct nfsvattr *, fhandle_t *, int, nfsattrbit_t *,\n    struct ucred *, NFSPROC_T *, int, int, int, int, uint64_t);\nint nfsrv_sattr(struct nfsrv_descript *, struct nfsvattr *, nfsattrbit_t *,\n    NFSACL_T *, NFSPROC_T *);\nint nfsv4_sattr(struct nfsrv_descript *, struct nfsvattr *, nfsattrbit_t *,\n    NFSACL_T *, NFSPROC_T *);\nint nfsvno_checkexp(mount_t, NFSSOCKADDR_T, struct nfsexstuff *,\n    struct ucred **);\nint nfsvno_fhtovp(mount_t, fhandle_t *, NFSSOCKADDR_T, int,\n    vnode_t *, struct nfsexstuff *, struct ucred **);\nvnode_t nfsvno_getvp(fhandle_t *);\nint nfsvno_advlock(vnode_t, int, u_int64_t, u_int64_t, NFSPROC_T *);\nint nfsrv_v4rootexport(void *, struct ucred *, NFSPROC_T *);\nint nfsvno_testexp(struct nfsrv_descript *, struct nfsexstuff *);\nuint32_t nfsrv_hashfh(fhandle_t *);\nvoid nfsrv_backupstable(void);\n\n/* nfs_commonkrpc.c */\nint newnfs_nmcancelreqs(struct nfsmount *);\nvoid newnfs_set_sigmask(struct thread *, sigset_t *);\nvoid newnfs_restore_sigmask(struct thread *, sigset_t *);\nint newnfs_msleep(struct thread *, void *, struct mtx *, int, char *, int);\nint newnfs_request(struct nfsrv_descript *, struct nfsmount *,\n    struct nfsclient *, struct nfssockreq *, vnode_t, NFSPROC_T *,\n    struct ucred *, u_int32_t, u_int32_t, u_char *, int, u_int64_t *);\nint newnfs_connect(struct nfsmount *, struct nfssockreq *,\n    struct ucred *, NFSPROC_T *, int);\nvoid newnfs_disconnect(struct nfssockreq *);\nint newnfs_sigintr(struct nfsmount *, NFSPROC_T *);\n\n/* nfs_nfsdkrpc.c */\nint nfsrvd_addsock(struct file *);\nint nfsrvd_nfsd(NFSPROC_T *, struct nfsd_nfsd_args *);\nvoid nfsrvd_init(int);\n\n/* nfs_clkrpc.c */\nint nfscbd_addsock(struct file *);\nint nfscbd_nfsd(NFSPROC_T *, struct nfsd_nfscbd_args *);\n\n"
  },
  {
    "path": "freebsd-headers/fs/nfs/nfscl.h",
    "content": "/*-\n * Copyright (c) 2009 Rick Macklem, University of Guelph\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/fs/nfs/nfscl.h 191783 2009-05-04 15:23:58Z rmacklem $\n */\n\n#ifndef\t_NFS_NFSCL_H\n#define\t_NFS_NFSCL_H\n\n/*\n * Extra stuff for a NFSv4 nfsnode.\n * MALLOC'd to the correct length for the name and file handle.\n * n4_data has the file handle, followed by the file name.\n * The macro NFS4NODENAME() returns a pointer to the start of the\n * name.\n */\nstruct nfsv4node {\n\tu_int16_t\tn4_fhlen;\n\tu_int16_t\tn4_namelen;\n\tu_int8_t\tn4_data[1];\n};\n\n#define\tNFS4NODENAME(n)\t(&((n)->n4_data[(n)->n4_fhlen]))\n\n/*\n * Just a macro to convert the nfscl_reqstart arguments.\n */\n#define\tNFSCL_REQSTART(n, p, v) \t\t\t\t\t\\\n\tnfscl_reqstart((n), (p), VFSTONFS((v)->v_mount), \t\t\\\n\t    VTONFS(v)->n_fhp->nfh_fh, VTONFS(v)->n_fhp->nfh_len, NULL)\n\n/*\n * These two macros convert between a lease duration and renew interval.\n * For now, just make the renew interval 1/2 the lease duration.\n * (They should be inverse operators.)\n */\n#define\tNFSCL_RENEW(l)\t(((l) < 2) ? 1 : ((l) / 2))\n#define\tNFSCL_LEASE(r)\t((r) * 2)\n\n/*\n * These flag bits are used for the argument to nfscl_fillsattr() to\n * indicate special handling of the attributes.\n */\n#define\tNFSSATTR_FULL\t\t0x1\n#define\tNFSSATTR_SIZE0\t\t0x2\n#define\tNFSSATTR_SIZENEG1\t0x4\n#define\tNFSSATTR_SIZERDEV\t0x8\n\n#endif\t/* _NFS_NFSCL_H */\n"
  },
  {
    "path": "freebsd-headers/fs/nfs/nfsclstate.h",
    "content": "/*-\n * Copyright (c) 2009 Rick Macklem, University of Guelph\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/fs/nfs/nfsclstate.h 214406 2010-10-26 23:18:37Z rmacklem $\n */\n\n#ifndef _NFS_NFSCLSTATE_H_\n#define\t_NFS_NFSCLSTATE_H_\n\n/*\n * Definitions for NFS V4 client state handling.\n */\nLIST_HEAD(nfsclopenhead, nfsclopen);\nLIST_HEAD(nfscllockownerhead, nfscllockowner);\nLIST_HEAD(nfscllockhead, nfscllock);\nLIST_HEAD(nfsclhead, nfsclclient);\nLIST_HEAD(nfsclownerhead, nfsclowner);\nTAILQ_HEAD(nfscldeleghead, nfscldeleg);\nLIST_HEAD(nfscldeleghash, nfscldeleg);\n#define\tNFSCLDELEGHASHSIZE\t256\n#define\tNFSCLDELEGHASH(c, f, l)\t\t\t\t\t\t\\\n\t(&((c)->nfsc_deleghash[ncl_hash((f), (l)) % NFSCLDELEGHASHSIZE]))\n\nstruct nfsclclient {\n\tLIST_ENTRY(nfsclclient) nfsc_list;\n\tstruct nfsclownerhead\tnfsc_owner;\n\tstruct nfscldeleghead\tnfsc_deleg;\n\tstruct nfscldeleghash\tnfsc_deleghash[NFSCLDELEGHASHSIZE];\n\tstruct nfscllockownerhead nfsc_defunctlockowner;\n\tstruct nfsv4lock nfsc_lock;\n\tstruct proc\t*nfsc_renewthread;\n\tstruct nfsmount\t*nfsc_nmp;\n\tnfsquad_t\tnfsc_clientid;\n\ttime_t\t\tnfsc_expire;\n\tu_int32_t\tnfsc_clientidrev;\n\tu_int32_t\tnfsc_renew;\n\tu_int32_t\tnfsc_cbident;\n\tu_int16_t\tnfsc_flags;\n\tu_int16_t\tnfsc_idlen;\n\tu_int8_t\tnfsc_id[1];\t/* Malloc'd to correct length */\n};\n\n/*\n * Bits for nfsc_flags.\n */\n#define\tNFSCLFLAGS_INITED\t0x0001\n#define\tNFSCLFLAGS_HASCLIENTID\t0x0002\n#define\tNFSCLFLAGS_RECOVER\t0x0004\n#define\tNFSCLFLAGS_UMOUNT\t0x0008\n#define\tNFSCLFLAGS_HASTHREAD\t0x0010\n#define\tNFSCLFLAGS_AFINET6\t0x0020\n#define\tNFSCLFLAGS_EXPIREIT\t0x0040\n#define\tNFSCLFLAGS_FIRSTDELEG\t0x0080\n#define\tNFSCLFLAGS_GOTDELEG\t0x0100\n#define\tNFSCLFLAGS_RECVRINPROG\t0x0200\n\nstruct nfsclowner {\n\tLIST_ENTRY(nfsclowner)\tnfsow_list;\n\tstruct nfsclopenhead\tnfsow_open;\n\tstruct nfsclclient\t*nfsow_clp;\n\tu_int32_t\t\tnfsow_seqid;\n\tu_int32_t\t\tnfsow_defunct;\n\tstruct nfsv4lock\tnfsow_rwlock;\n\tu_int8_t\t\tnfsow_owner[NFSV4CL_LOCKNAMELEN];\n};\n\n/*\n * MALLOC'd to the correct length to accommodate the file handle.\n */\nstruct nfscldeleg {\n\tTAILQ_ENTRY(nfscldeleg)\tnfsdl_list;\n\tLIST_ENTRY(nfscldeleg)\tnfsdl_hash;\n\tstruct nfsclownerhead\tnfsdl_owner;\t/* locally issued state */\n\tstruct nfscllockownerhead nfsdl_lock;\n\tnfsv4stateid_t\t\tnfsdl_stateid;\n\tstruct acl_entry\tnfsdl_ace;\t/* Delegation ace */\n\tstruct nfsclclient\t*nfsdl_clp;\n\tstruct nfsv4lock\tnfsdl_rwlock;\t/* for active I/O ops */\n\tstruct nfscred\t\tnfsdl_cred;\t/* Cred. used for Open */\n\ttime_t\t\t\tnfsdl_timestamp; /* used for stale cleanup */\n\tu_int64_t\t\tnfsdl_sizelimit; /* Limit for file growth */\n\tu_int64_t\t\tnfsdl_size;\t/* saved copy of file size */\n\tu_int64_t\t\tnfsdl_change;\t/* and change attribute */\n\tstruct timespec\t\tnfsdl_modtime;\t/* local modify time */\n\tu_int16_t\t\tnfsdl_fhlen;\n\tu_int8_t\t\tnfsdl_flags;\n\tu_int8_t\t\tnfsdl_fh[1];\t/* must be last */\n};\n\n/*\n * nfsdl_flags bits.\n */\n#define\tNFSCLDL_READ\t\t0x01\n#define\tNFSCLDL_WRITE\t\t0x02\n#define\tNFSCLDL_RECALL\t\t0x04\n#define\tNFSCLDL_NEEDRECLAIM\t0x08\n#define\tNFSCLDL_ZAPPED\t\t0x10\n#define\tNFSCLDL_MODTIMESET\t0x20\n#define\tNFSCLDL_DELEGRET\t0x40\n\n/*\n * MALLOC'd to the correct length to accommodate the file handle.\n */\nstruct nfsclopen {\n\tLIST_ENTRY(nfsclopen)\tnfso_list;\n\tstruct nfscllockownerhead nfso_lock;\n\tnfsv4stateid_t\t\tnfso_stateid;\n\tstruct nfsclowner\t*nfso_own;\n\tstruct nfscred\t\tnfso_cred;\t/* Cred. used for Open */\n\tu_int32_t\t\tnfso_mode;\n\tu_int32_t\t\tnfso_opencnt;\n\tu_int16_t\t\tnfso_fhlen;\n\tu_int8_t\t\tnfso_posixlock;\t/* 1 for POSIX type locking */\n\tu_int8_t\t\tnfso_fh[1];\t/* must be last */\n};\n\n/*\n * Return values for nfscl_open(). NFSCLOPEN_OK must == 0.\n */\n#define\tNFSCLOPEN_OK\t\t0\n#define\tNFSCLOPEN_DOOPEN\t1\n#define\tNFSCLOPEN_DOOPENDOWNGRADE 2\n#define\tNFSCLOPEN_SETCRED\t3\n\nstruct nfscllockowner {\n\tLIST_ENTRY(nfscllockowner) nfsl_list;\n\tstruct nfscllockhead\tnfsl_lock;\n\tstruct nfsclopen\t*nfsl_open;\n\tNFSPROC_T\t\t*nfsl_inprog;\n\tnfsv4stateid_t\t\tnfsl_stateid;\n\tu_int32_t\t\tnfsl_seqid;\n\tu_int32_t\t\tnfsl_defunct;\n\tstruct nfsv4lock\tnfsl_rwlock;\n\tu_int8_t\t\tnfsl_owner[NFSV4CL_LOCKNAMELEN];\n\tu_int8_t\t\tnfsl_openowner[NFSV4CL_LOCKNAMELEN];\n};\n\n/*\n * Byte range entry for the above lock owner.\n */\nstruct nfscllock {\n\tLIST_ENTRY(nfscllock)\tnfslo_list;\n\tu_int64_t\t\tnfslo_first;\n\tu_int64_t\t\tnfslo_end;\n\tshort\t\t\tnfslo_type;\n};\n\n/*\n * Macro for incrementing the seqid#.\n */\n#define\tNFSCL_INCRSEQID(s, n)\tdo { \t\t\t\t\t\\\n\t    if (((n)->nd_flag & ND_INCRSEQID))\t\t\t\t\\\n\t\t(s)++; \t\t\t\t\t\t\t\\\n\t} while (0)\n\n#endif\t/* _NFS_NFSCLSTATE_H_ */\n"
  },
  {
    "path": "freebsd-headers/fs/nfs/nfsdport.h",
    "content": "/*-\n * Copyright (c) 2009 Rick Macklem, University of Guelph\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/fs/nfs/nfsdport.h 224086 2011-07-16 08:51:09Z zack $\n */\n\n/*\n * These macros handle nfsvattr fields. They look a bit silly here, but\n * are quite different for the Darwin port.\n */\n#define\tNFSVNO_ATTRINIT(n)\t\t(VATTR_NULL(&((n)->na_vattr)))\n#define\tNFSVNO_SETATTRVAL(n, f, v)\t((n)->na_##f = (v))\n#define\tNFSVNO_SETACTIVE(n, f)\n#define\tNFSVNO_UNSET(n, f)\t\t((n)->na_##f = VNOVAL)\n#define\tNFSVNO_NOTSETMODE(n)\t\t((n)->na_mode == ((mode_t)VNOVAL))\n#define\tNFSVNO_ISSETMODE(n)\t\t((n)->na_mode != ((mode_t)VNOVAL))\n#define\tNFSVNO_NOTSETUID(n)\t\t((n)->na_uid == ((uid_t)VNOVAL))\n#define\tNFSVNO_ISSETUID(n)\t\t((n)->na_uid != ((uid_t)VNOVAL))\n#define\tNFSVNO_NOTSETGID(n)\t\t((n)->na_gid == ((gid_t)VNOVAL))\n#define\tNFSVNO_ISSETGID(n)\t\t((n)->na_gid != ((gid_t)VNOVAL))\n#define\tNFSVNO_NOTSETSIZE(n)\t\t((n)->na_size == VNOVAL)\n#define\tNFSVNO_ISSETSIZE(n)\t\t((n)->na_size != VNOVAL)\n#define\tNFSVNO_NOTSETATIME(n)\t\t((n)->na_atime.tv_sec == VNOVAL)\n#define\tNFSVNO_ISSETATIME(n)\t\t((n)->na_atime.tv_sec != VNOVAL)\n#define\tNFSVNO_NOTSETMTIME(n)\t\t((n)->na_mtime.tv_sec == VNOVAL)\n#define\tNFSVNO_ISSETMTIME(n)\t\t((n)->na_mtime.tv_sec != VNOVAL)\n\n/*\n * This structure acts as a \"catch-all\" for information that\n * needs to be returned by nfsd_fhtovp().\n */\nstruct nfsexstuff {\n\tint\tnes_exflag;\t\t\t/* export flags */\n\tint\tnes_numsecflavor;\t\t/* # of security flavors */\n\tint\tnes_secflavors[MAXSECFLAVORS];\t/* and the flavors */\n};\n\n/*\n * These are NO-OPS for BSD until Isilon upstreams EXITCODE support.\n * EXITCODE is an in-memory ring buffer that holds the routines failing status.\n * This is a valuable tool to use when debugging and analyzing issues.\n * In addition to recording a routine's failing status, it offers\n * logging of routines for call stack tracing.\n * EXITCODE should be used only in routines that return a true errno value, as\n * that value will be formatted to a displayable errno string.  Routines that \n * return regular int status that are not true errno should not set EXITCODE.\n * If you want to log routine tracing, you can add EXITCODE(0) to any routine.\n * NFS extended the EXITCODE with EXITCODE2 to record either the routine's\n * exit errno status or the nd_repstat.\n */\n#define\tNFSEXITCODE(error)\n#define\tNFSEXITCODE2(error, nd)\n\n#define\tNFSVNO_EXINIT(e)\t\t((e)->nes_exflag = 0)\n#define\tNFSVNO_EXPORTED(e)\t\t((e)->nes_exflag & MNT_EXPORTED)\n#define\tNFSVNO_EXRDONLY(e)\t\t((e)->nes_exflag & MNT_EXRDONLY)\n#define\tNFSVNO_EXPORTANON(e)\t\t((e)->nes_exflag & MNT_EXPORTANON)\n#define\tNFSVNO_EXSTRICTACCESS(e)\t((e)->nes_exflag & MNT_EXSTRICTACCESS)\n#define\tNFSVNO_EXV4ONLY(e)\t\t((e)->nes_exflag & MNT_EXV4ONLY)\n\n#define\tNFSVNO_SETEXRDONLY(e)\t((e)->nes_exflag = (MNT_EXPORTED|MNT_EXRDONLY))\n\n#define\tNFSVNO_CMPFH(f1, f2)\t\t\t\t\t\t\\\n    ((f1)->fh_fsid.val[0] == (f2)->fh_fsid.val[0] &&\t\t\t\\\n     (f1)->fh_fsid.val[1] == (f2)->fh_fsid.val[1] &&\t\t\t\\\n     bcmp(&(f1)->fh_fid, &(f2)->fh_fid, sizeof(struct fid)) == 0)\n\n#define\tNFSLOCKHASH(f) \t\t\t\t\t\t\t\\\n\t(&nfslockhash[nfsrv_hashfh(f) % NFSLOCKHASHSIZE])\n\n#define\tNFSFPVNODE(f)\t((struct vnode *)((f)->f_data))\n#define\tNFSFPCRED(f)\t((f)->f_cred)\n#define\tNFSFPFLAG(f)\t((f)->f_flag)\n\nint fp_getfvp(NFSPROC_T *, int, struct file **, struct vnode **);\n\n#define\tNFSNAMEICNDSET(n, c, o, f)\tdo {\t\t\t\t\\\n\t(n)->cn_cred = (c);\t\t\t\t\t\t\\\n\t(n)->cn_nameiop = (o);\t\t\t\t\t\t\\\n\t(n)->cn_flags = (f);\t\t\t\t\t\t\\\n    } while (0)\n\n/*\n * A little bit of Darwin vfs kpi.\n */\n#define\tvnode_mount(v)\t((v)->v_mount)\n#define\tvfs_statfs(m)\t(&((m)->mnt_stat))\n\n#define\tNFSPATHLEN_T\tsize_t\n\n/*\n * These are set to the minimum and maximum size of a server file\n * handle.\n */\n#define\tNFSRV_MINFH\t(sizeof (fhandle_t))\n#define\tNFSRV_MAXFH\t(sizeof (fhandle_t))\n\n"
  },
  {
    "path": "freebsd-headers/fs/nfs/nfskpiport.h",
    "content": "/*-\n * Copyright (c) 2009 Rick Macklem, University of Guelph\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/fs/nfs/nfskpiport.h 207785 2010-05-08 14:50:12Z rmacklem $\n */\n\n#ifndef _NFS_NFSKPIPORT_H_\n#define\t_NFS_NFSKPIPORT_H_\n/*\n * These definitions are needed since the generic code is now using Darwin8\n * KPI stuff. (I know, seems a bit silly, but I want the code to build on\n * Darwin8 and hopefully subsequent releases from Apple.)\n */\ntypedef\tstruct mount *\t\tmount_t;\n#define\tvfs_statfs(m)\t\t(&((m)->mnt_stat))\n#define\tvfs_flags(m)\t\t((m)->mnt_flag)\n\ntypedef struct vnode *\t\tvnode_t;\n#define\tvnode_mount(v)\t\t((v)->v_mount)\n#define\tvnode_vtype(v)\t\t((v)->v_type)\n\ntypedef struct mbuf *\t\tmbuf_t;\n#define\tmbuf_freem(m)\t\tm_freem(m)\n#define\tmbuf_data(m)\t\tmtod((m), void *)\n#define\tmbuf_len(m)\t\t((m)->m_len)\n#define\tmbuf_next(m)\t\t((m)->m_next)\n#define\tmbuf_setlen(m, l)\t((m)->m_len = (l))\n#define\tmbuf_setnext(m, p)\t((m)->m_next = (p))\n#define\tmbuf_pkthdr_len(m)\t((m)->m_pkthdr.len)\n#define\tmbuf_pkthdr_setlen(m, l) ((m)->m_pkthdr.len = (l))\n#define\tmbuf_pkthdr_setrcvif(m, p) ((m)->m_pkthdr.rcvif = (p))\n\n/*\n * This stuff is needed by Darwin for handling the uio structure.\n */\n#define\tCAST_USER_ADDR_T(a)\t(a)\n#define\tCAST_DOWN(c, a)\t\t((c) (a))\n#define\tuio_uio_resid(p)\t((p)->uio_resid)\n#define\tuio_uio_resid_add(p, v)\t((p)->uio_resid += (v))\n#define\tuio_uio_resid_set(p, v)\t((p)->uio_resid = (v))\n#define\tuio_iov_base(p)\t\t((p)->uio_iov->iov_base)\n#define\tuio_iov_base_add(p, v)\tdo {\t\t\t\t\t\\\n\tchar *pp;\t\t\t\t\t\t\t\\\n\tpp = (char *)(p)->uio_iov->iov_base;\t\t\t\t\\\n\tpp += (v);\t\t\t\t\t\t\t\\\n\t(p)->uio_iov->iov_base = (void *)pp;\t\t\t\t\\\n    } while (0)\n#define\tuio_iov_len(p)\t\t((p)->uio_iov->iov_len)\n#define\tuio_iov_len_add(p, v)\t((p)->uio_iov->iov_len += (v))\n\n#endif\t/* _NFS_NFSKPIPORT_H */\n"
  },
  {
    "path": "freebsd-headers/fs/nfs/nfsm_subs.h",
    "content": "/*-\n * Copyright (c) 1989, 1993\n *\tThe Regents of the University of California.  All rights reserved.\n *\n * This code is derived from software contributed to Berkeley by\n * Rick Macklem at The University of Guelph.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 4. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/fs/nfs/nfsm_subs.h 191783 2009-05-04 15:23:58Z rmacklem $\n */\n\n#ifndef _NFS_NFSM_SUBS_H_\n#define\t_NFS_NFSM_SUBS_H_\n\n\n/*\n * These macros do strange and peculiar things to mbuf chains for\n * the assistance of the nfs code. To attempt to use them for any\n * other purpose will be dangerous. (they make weird assumptions)\n */\n\n#ifndef APPLE\n/*\n * First define what the actual subs. return\n */\n#define\tM_HASCL(m)\t((m)->m_flags & M_EXT)\n#define\tNFSMINOFF(m) \t\t\t\t\t\t\t\\\n\t\tif (M_HASCL(m)) \t\t\t\t\t\\\n\t\t\t(m)->m_data = (m)->m_ext.ext_buf; \t\t\\\n\t\telse if ((m)->m_flags & M_PKTHDR) \t\t\t\\\n\t\t\t(m)->m_data = (m)->m_pktdat; \t\t\t\\\n\t\t\t\telse \t\t\t\t\t\\\n\t\t\t(m)->m_data = (m)->m_dat\n#define\tNFSMSIZ(m)\t((M_HASCL(m))?MCLBYTES: \t\t\t\\\n\t\t\t\t(((m)->m_flags & M_PKTHDR)?MHLEN:MLEN))\n#define\tNFSM_DATAP(m, s)\t(m)->m_data += (s)\n\n/*\n * Now for the macros that do the simple stuff and call the functions\n * for the hard stuff.\n * They use fields in struct nfsrv_descript to handle the mbuf queues.\n * Replace most of the macro with an inline function, to minimize\n * the machine code. The inline functions in lower case can be called\n * directly, bypassing the macro.\n */\nstatic __inline void *\nnfsm_build(struct nfsrv_descript *nd, int siz)\n{\n\tvoid *retp;\n\tstruct mbuf *mb2;\n\n\tif (siz > M_TRAILINGSPACE(nd->nd_mb)) {\n\t\tNFSMCLGET(mb2, M_DONTWAIT);\n\t\tif (siz > MLEN)\n\t\t\tpanic(\"build > MLEN\");\n\t\tmbuf_setlen(mb2, 0);\n\t\tnd->nd_bpos = NFSMTOD(mb2, caddr_t);\n\t\tnd->nd_mb->m_next = mb2;\n\t\tnd->nd_mb = mb2;\n\t}\n\tretp = (void *)(nd->nd_bpos);\n\tnd->nd_mb->m_len += siz;\n\tnd->nd_bpos += siz;\n\treturn (retp);\n}\n\n#define\tNFSM_BUILD(a, c, s)\t((a) = (c)nfsm_build(nd, (s)))\n\nstatic __inline void *\nnfsm_dissect(struct nfsrv_descript *nd, int siz)\n{\n\tint tt1; \n\tvoid *retp;\n\n\ttt1 = NFSMTOD(nd->nd_md, caddr_t) + nd->nd_md->m_len - nd->nd_dpos; \n\tif (tt1 >= siz) { \n\t\tretp = (void *)nd->nd_dpos; \n\t\tnd->nd_dpos += siz; \n\t} else { \n\t\tretp = nfsm_dissct(nd, siz); \n\t}\n\treturn (retp);\n}\n\n#define\tNFSM_DISSECT(a, c, s) \t\t\t\t\t\t\\\n\tdo {\t\t\t\t\t\t\t\t\\\n\t\t(a) = (c)nfsm_dissect(nd, (s));\t \t\t\t\\\n\t\tif ((a) == NULL) { \t\t\t\t\t\\\n\t\t\terror = EBADRPC; \t\t\t\t\\\n\t\t\tgoto nfsmout; \t\t\t\t\t\\\n\t\t}\t\t\t\t\t\t\t\\\n\t} while (0)\n#endif\t/* !APPLE */\n\n#define\tNFSM_STRSIZ(s, m)  \t\t\t\t\t\t\\\n\tdo {\t\t\t\t\t\t\t\t\\\n\t\ttl = (u_int32_t *)nfsm_dissect(nd, NFSX_UNSIGNED);\t\\\n\t\tif (!tl || ((s) = fxdr_unsigned(int32_t, *tl)) > (m)) { \\\n\t\t\terror = EBADRPC; \t\t\t\t\\\n\t\t\tgoto nfsmout; \t\t\t\t\t\\\n\t\t}\t\t\t\t\t\t\t\\\n\t} while (0)\n\n#define\tNFSM_RNDUP(a)\t(((a)+3)&(~0x3))\n\n#endif\t/* _NFS_NFSM_SUBS_H_ */\n"
  },
  {
    "path": "freebsd-headers/fs/nfs/nfsport.h",
    "content": "/*-\n * Copyright (c) 1989, 1993\n *\tThe Regents of the University of California.  All rights reserved.\n *\n * This code is derived from software contributed to Berkeley by\n * Rick Macklem at The University of Guelph.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 4. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/fs/nfs/nfsport.h 224080 2011-07-16 08:05:26Z zack $\n */\n\n#ifndef _NFS_NFSPORT_H_\n#define\t_NFS_NFSPORT_H_\n\n/*\n * In general, I'm not fond of #includes in .h files, but this seems\n * to be the cleanest way to handle #include files for the ports.\n */\n#ifdef _KERNEL\n#include <sys/unistd.h>\n#include <sys/param.h>\n#include <sys/systm.h>\n#include <sys/conf.h>\n#include <sys/dirent.h>\n#include <sys/domain.h>\n#include <sys/fcntl.h>\n#include <sys/file.h>\n#include <sys/filedesc.h>\n#include <sys/jail.h>\n#include <sys/kernel.h>\n#include <sys/lockf.h>\n#include <sys/malloc.h>\n#include <sys/mbuf.h>\n#include <sys/mount.h>\n#include <sys/namei.h>\n#include <sys/proc.h>\n#include <sys/protosw.h>\n#include <sys/reboot.h>\n#include <sys/resourcevar.h>\n#include <sys/signalvar.h>\n#include <sys/socket.h>\n#include <sys/socketvar.h>\n#include <sys/stat.h>\n#include <sys/syslog.h>\n#include <sys/sysproto.h>\n#include <sys/time.h>\n#include <sys/uio.h>\n#include <sys/vnode.h>\n#include <sys/bio.h>\n#include <sys/buf.h>\n#include <sys/acl.h>\n#include <sys/module.h>\n#include <sys/sysent.h>\n#include <sys/syscall.h>\n#include <sys/priv.h>\n#include <sys/kthread.h>\n#include <sys/syscallsubr.h>\n#include <fs/fifofs/fifo.h>\n#include <net/if.h>\n#include <net/radix.h>\n#include <net/route.h>\n#include <net/if_dl.h>\n#include <netinet/in.h>\n#include <netinet/in_pcb.h>\n#include <netinet/in_systm.h>\n#include <netinet/in_var.h>\n#include <netinet/ip.h>\n#include <netinet/ip_var.h>\n#include <netinet/tcp.h>\n#include <netinet/tcp_fsm.h>\n#include <netinet/tcp_seq.h>\n#include <netinet/tcp_timer.h>\n#include <netinet/tcp_var.h>\n#include <machine/in_cksum.h>\n#include <crypto/des/des.h>\n#include <sys/md5.h>\n#include <rpc/rpc.h>\n#include <rpc/rpcsec_gss.h>\n\n/*\n * For Darwin, these functions should be \"static\" when built in a kext.\n * (This is always defined as nil otherwise.)\n */\n#define\tAPPLESTATIC\n#include <ufs/ufs/dir.h>\n#include <ufs/ufs/quota.h>\n#include <ufs/ufs/inode.h>\n#include <ufs/ufs/extattr.h>\n#include <ufs/ufs/ufsmount.h>\n#include <vm/uma.h>\n#include <vm/vm.h>\n#include <vm/vm_object.h>\n#include <vm/vm_extern.h>\n#include <nfs/nfssvc.h>\n#include \"opt_nfs.h\"\n#include \"opt_ufs.h\"\n\n/*\n * These types must be defined before the nfs includes.\n */\n#define\tNFSSOCKADDR_T\tstruct sockaddr *\n#define\tNFSPROC_T\tstruct thread\n#define\tNFSDEV_T\tdev_t\n#define\tNFSSVCARGS\tnfssvc_args\n#define\tNFSACL_T\tstruct acl\n\n/*\n * These should be defined as the types used for the corresponding VOP's\n * argument type.\n */\n#define\tNFS_ACCESS_ARGS\t\tstruct vop_access_args\n#define\tNFS_OPEN_ARGS\t\tstruct vop_open_args\n#define\tNFS_GETATTR_ARGS\tstruct vop_getattr_args\n#define\tNFS_LOOKUP_ARGS\t\tstruct vop_lookup_args\n#define\tNFS_READDIR_ARGS\tstruct vop_readdir_args\n\n/*\n * Allocate mbufs. Must succeed and never set the mbuf ptr to NULL.\n */\n#define\tNFSMGET(m)\tdo { \t\t\t\t\t\\\n\t\tMGET((m), M_TRYWAIT, MT_DATA); \t\t\t\\\n\t\twhile ((m) == NULL ) { \t\t\t\t\\\n\t\t\t(void) nfs_catnap(PZERO, 0, \"nfsmget\");\t\\\n\t\t\tMGET((m), M_TRYWAIT, MT_DATA); \t\t\\\n\t\t} \t\t\t\t\t\t\\\n\t} while (0)\n#define\tNFSMGETHDR(m)\tdo { \t\t\t\t\t\\\n\t\tMGETHDR((m), M_TRYWAIT, MT_DATA);\t\t\\\n\t\twhile ((m) == NULL ) { \t\t\t\t\\\n\t\t\t(void) nfs_catnap(PZERO, 0, \"nfsmget\");\t\\\n\t\t\tMGETHDR((m), M_TRYWAIT, MT_DATA); \t\\\n\t\t} \t\t\t\t\t\t\\\n\t} while (0)\n#define\tNFSMCLGET(m, w)\tdo { \t\t\t\t\t\\\n\t\tMGET((m), M_TRYWAIT, MT_DATA); \t\t\t\\\n\t\twhile ((m) == NULL ) { \t\t\t\t\\\n\t\t\t(void) nfs_catnap(PZERO, 0, \"nfsmget\");\t\\\n\t\t\tMGET((m), M_TRYWAIT, MT_DATA); \t\t\\\n\t\t} \t\t\t\t\t\t\\\n\t\tMCLGET((m), (w));\t\t\t\t\\\n\t} while (0)\n#define\tNFSMCLGETHDR(m, w) do { \t\t\t\t\\\n\t\tMGETHDR((m), M_TRYWAIT, MT_DATA);\t\t\\\n\t\twhile ((m) == NULL ) { \t\t\t\t\\\n\t\t\t(void) nfs_catnap(PZERO, 0, \"nfsmget\");\t\\\n\t\t\tMGETHDR((m), M_TRYWAIT, MT_DATA); \t\\\n\t\t} \t\t\t\t\t\t\\\n\t} while (0)\n#define\tNFSMTOD\tmtod\n\n/*\n * Client side constant for size of a lockowner name.\n */\n#define\tNFSV4CL_LOCKNAMELEN\t12\n\n/*\n * Type for a mutex lock.\n */\n#define\tNFSMUTEX_T\t\tstruct mtx\n\n#endif\t/* _KERNEL */\n\n/*\n * NFSv4 Operation numbers.\n */\n#define\tNFSV4OP_ACCESS\t\t3\n#define\tNFSV4OP_CLOSE\t\t4\n#define\tNFSV4OP_COMMIT\t\t5\n#define\tNFSV4OP_CREATE\t\t6\n#define\tNFSV4OP_DELEGPURGE\t7\n#define\tNFSV4OP_DELEGRETURN\t8\n#define\tNFSV4OP_GETATTR\t\t9\n#define\tNFSV4OP_GETFH\t\t10\n#define\tNFSV4OP_LINK\t\t11\n#define\tNFSV4OP_LOCK\t\t12\n#define\tNFSV4OP_LOCKT\t\t13\n#define\tNFSV4OP_LOCKU\t\t14\n#define\tNFSV4OP_LOOKUP\t\t15\n#define\tNFSV4OP_LOOKUPP\t\t16\n#define\tNFSV4OP_NVERIFY\t\t17\n#define\tNFSV4OP_OPEN\t\t18\n#define\tNFSV4OP_OPENATTR\t19\n#define\tNFSV4OP_OPENCONFIRM\t20\n#define\tNFSV4OP_OPENDOWNGRADE\t21\n#define\tNFSV4OP_PUTFH\t\t22\n#define\tNFSV4OP_PUTPUBFH\t23\n#define\tNFSV4OP_PUTROOTFH\t24\n#define\tNFSV4OP_READ\t\t25\n#define\tNFSV4OP_READDIR\t\t26\n#define\tNFSV4OP_READLINK\t27\n#define\tNFSV4OP_REMOVE\t\t28\n#define\tNFSV4OP_RENAME\t\t29\n#define\tNFSV4OP_RENEW\t\t30\n#define\tNFSV4OP_RESTOREFH\t31\n#define\tNFSV4OP_SAVEFH\t\t32\n#define\tNFSV4OP_SECINFO\t\t33\n#define\tNFSV4OP_SETATTR\t\t34\n#define\tNFSV4OP_SETCLIENTID\t35\n#define\tNFSV4OP_SETCLIENTIDCFRM\t36\n#define\tNFSV4OP_VERIFY\t\t37\n#define\tNFSV4OP_WRITE\t\t38\n#define\tNFSV4OP_RELEASELCKOWN\t39\n\n/*\n * Must be one greater than the last Operation#.\n */\n#define\tNFSV4OP_NOPS\t\t40\n\n/* Quirky case if the illegal op code */\n#define\tNFSV4OP_OPILLEGAL\t10044\n\n/*\n * Fake NFSV4OP_xxx used for nfsstat. Start at NFSV4OP_NOPS.\n */\n#define\tNFSV4OP_SYMLINK\t\t(NFSV4OP_NOPS)\n#define\tNFSV4OP_MKDIR\t\t(NFSV4OP_NOPS + 1)\n#define\tNFSV4OP_RMDIR\t\t(NFSV4OP_NOPS + 2)\n#define\tNFSV4OP_READDIRPLUS\t(NFSV4OP_NOPS + 3)\n#define\tNFSV4OP_MKNOD\t\t(NFSV4OP_NOPS + 4)\n#define\tNFSV4OP_FSSTAT\t\t(NFSV4OP_NOPS + 5)\n#define\tNFSV4OP_FSINFO\t\t(NFSV4OP_NOPS + 6)\n#define\tNFSV4OP_PATHCONF\t(NFSV4OP_NOPS + 7)\n#define\tNFSV4OP_V3CREATE\t(NFSV4OP_NOPS + 8)\n\n/*\n * This is the count of the fake operations listed above.\n */\n#define\tNFSV4OP_FAKENOPS\t9\n\n/*\n * and the Callback OPs\n */\n#define\tNFSV4OP_CBGETATTR\t3\n#define\tNFSV4OP_CBRECALL\t4\n\n/*\n * Must be one greater than the last Callback Operation#.\n */\n#define\tNFSV4OP_CBNOPS\t\t5\n\n/*\n * The lower numbers -> 21 are used by NFSv2 and v3. These define higher\n * numbers used by NFSv4.\n * NFS_V3NPROCS is one greater than the last V3 op and NFS_NPROCS is\n * one greater than the last number.\n */\n#ifndef\tNFS_V3NPROCS\n#define\tNFS_V3NPROCS\t\t22\n\n#define\tNFSPROC_LOOKUPP\t\t22\n#define\tNFSPROC_SETCLIENTID\t23\n#define\tNFSPROC_SETCLIENTIDCFRM\t24\n#define\tNFSPROC_LOCK\t\t25\n#define\tNFSPROC_LOCKU\t\t26\n#define\tNFSPROC_OPEN\t\t27\n#define\tNFSPROC_CLOSE\t\t28\n#define\tNFSPROC_OPENCONFIRM\t29\n#define\tNFSPROC_LOCKT\t\t30\n#define\tNFSPROC_OPENDOWNGRADE\t31\n#define\tNFSPROC_RENEW\t\t32\n#define\tNFSPROC_PUTROOTFH\t33\n#define\tNFSPROC_RELEASELCKOWN\t34\n#define\tNFSPROC_DELEGRETURN\t35\n#define\tNFSPROC_RETDELEGREMOVE\t36\n#define\tNFSPROC_RETDELEGRENAME1\t37\n#define\tNFSPROC_RETDELEGRENAME2\t38\n#define\tNFSPROC_GETACL\t\t39\n#define\tNFSPROC_SETACL\t\t40\n\n/*\n * Must be defined as one higher than the last Proc# above.\n */\n#define\tNFSV4_NPROCS\t\t41\n#endif\t/* NFS_V3NPROCS */\n\n/*\n * Stats structure\n */\nstruct ext_nfsstats {\n\tint\tattrcache_hits;\n\tint\tattrcache_misses;\n\tint\tlookupcache_hits;\n\tint\tlookupcache_misses;\n\tint\tdireofcache_hits;\n\tint\tdireofcache_misses;\n\tint\taccesscache_hits;\n\tint\taccesscache_misses;\n\tint\tbiocache_reads;\n\tint\tread_bios;\n\tint\tread_physios;\n\tint\tbiocache_writes;\n\tint\twrite_bios;\n\tint\twrite_physios;\n\tint\tbiocache_readlinks;\n\tint\treadlink_bios;\n\tint\tbiocache_readdirs;\n\tint\treaddir_bios;\n\tint\trpccnt[NFSV4_NPROCS];\n\tint\trpcretries;\n\tint\tsrvrpccnt[NFSV4OP_NOPS + NFSV4OP_FAKENOPS];\n\tint\tsrvrpc_errs;\n\tint\tsrv_errs;\n\tint\trpcrequests;\n\tint\trpctimeouts;\n\tint\trpcunexpected;\n\tint\trpcinvalid;\n\tint\tsrvcache_inproghits;\n\tint\tsrvcache_idemdonehits;\n\tint\tsrvcache_nonidemdonehits;\n\tint\tsrvcache_misses;\n\tint\tsrvcache_tcppeak;\n\tint\tsrvcache_size;\n\tint\tsrvclients;\n\tint\tsrvopenowners;\n\tint\tsrvopens;\n\tint\tsrvlockowners;\n\tint\tsrvlocks;\n\tint\tsrvdelegates;\n\tint\tcbrpccnt[NFSV4OP_CBNOPS];\n\tint\tclopenowners;\n\tint\tclopens;\n\tint\tcllockowners;\n\tint\tcllocks;\n\tint\tcldelegates;\n\tint\tcllocalopenowners;\n\tint\tcllocalopens;\n\tint\tcllocallockowners;\n\tint\tcllocallocks;\n};\n\n#ifdef _KERNEL\n/*\n * Define the ext_nfsstats as nfsstats for the kernel code.\n */\n#define nfsstats\text_nfsstats\n\n/*\n * Define NFS_NPROCS as NFSV4_NPROCS for the experimental kernel code.\n */\n#ifndef\tNFS_NPROCS\n#define\tNFS_NPROCS\t\tNFSV4_NPROCS\n#endif\n\n#include <fs/nfs/nfskpiport.h>\n#include <fs/nfs/nfsdport.h>\n#include <fs/nfs/rpcv2.h>\n#include <fs/nfs/nfsproto.h>\n#include <fs/nfs/nfs.h>\n#include <fs/nfs/nfs_var.h>\n#include <fs/nfs/nfsm_subs.h>\n#include <fs/nfs/nfsrvcache.h>\n#include <fs/nfs/nfsrvstate.h>\n#include <fs/nfs/xdr_subs.h>\n#include <fs/nfs/nfscl.h>\n#include <fs/nfs/nfsclstate.h>\n#include <nfsclient/nfsargs.h>\n#include <fs/nfsclient/nfsmount.h>\n\n/*\n * Just to keep nfs_var.h happy.\n */\nstruct nfs_vattr {\n\tint\tjunk;\n};\n\nstruct nfsvattr {\n\tstruct vattr\tna_vattr;\n\tnfsattrbit_t\tna_suppattr;\n\tu_int32_t\tna_mntonfileno;\n\tu_int64_t\tna_filesid[2];\n};\n\n#define\tna_type\t\tna_vattr.va_type\n#define\tna_mode\t\tna_vattr.va_mode\n#define\tna_nlink\tna_vattr.va_nlink\n#define\tna_uid\t\tna_vattr.va_uid\n#define\tna_gid\t\tna_vattr.va_gid\n#define\tna_fsid\t\tna_vattr.va_fsid\n#define\tna_fileid\tna_vattr.va_fileid\n#define\tna_size\t\tna_vattr.va_size\n#define\tna_blocksize\tna_vattr.va_blocksize\n#define\tna_atime\tna_vattr.va_atime\n#define\tna_mtime\tna_vattr.va_mtime\n#define\tna_ctime\tna_vattr.va_ctime\n#define\tna_gen\t\tna_vattr.va_gen\n#define\tna_flags\tna_vattr.va_flags\n#define\tna_rdev\t\tna_vattr.va_rdev\n#define\tna_bytes\tna_vattr.va_bytes\n#define\tna_filerev\tna_vattr.va_filerev\n#define\tna_vaflags\tna_vattr.va_vaflags\n\n#include <fs/nfsclient/nfsnode.h>\n\n/*\n * This is the header structure used for the lists, etc. (It has the\n * above record in it.\n */\nstruct nfsrv_stablefirst {\n\tLIST_HEAD(, nfsrv_stable) nsf_head;\t/* Head of nfsrv_stable list */\n\ttime_t\t\tnsf_eograce;\t/* Time grace period ends */\n\ttime_t\t\t*nsf_bootvals;\t/* Previous boottime values */\n\tstruct file\t*nsf_fp;\t/* File table pointer */\n\tu_char\t\tnsf_flags;\t/* NFSNSF_ flags */\n\tstruct nfsf_rec\tnsf_rec;\t/* and above first record */\n};\n#define\tnsf_lease\tnsf_rec.lease\n#define\tnsf_numboots\tnsf_rec.numboots\n\n/* NFSNSF_xxx flags */\n#define\tNFSNSF_UPDATEDONE\t0x01\n#define\tNFSNSF_GRACEOVER\t0x02\n#define\tNFSNSF_NEEDLOCK\t\t0x04\n#define\tNFSNSF_EXPIREDCLIENT\t0x08\n#define\tNFSNSF_NOOPENS\t\t0x10\n#define\tNFSNSF_OK\t\t0x20\n\n/*\n * Maximum number of boot times allowed in record. Although there is\n * really no need for a fixed upper bound, this serves as a sanity check\n * for a corrupted file.\n */\n#define\tNFSNSF_MAXNUMBOOTS\t10000\n\n/*\n * This structure defines the other records in the file. The\n * nst_client array is actually the size of the client string name.\n */\nstruct nfst_rec {\n\tu_int16_t\tlen;\n\tu_char\t\tflag;\n\tu_char\t\tclient[1];\n};\n/* and the values for flag */\n#define\tNFSNST_NEWSTATE\t0x1\n#define\tNFSNST_REVOKE\t\t0x2\n#define\tNFSNST_GOTSTATE\t\t0x4\n\n/*\n * This structure is linked onto nfsrv_stablefirst for the duration of\n * reclaim.\n */\nstruct nfsrv_stable {\n\tLIST_ENTRY(nfsrv_stable) nst_list;\n\tstruct nfsclient\t*nst_clp;\n\tstruct nfst_rec\t\tnst_rec;\n};\n#define\tnst_timestamp\tnst_rec.timestamp\n#define\tnst_len\t\tnst_rec.len\n#define\tnst_flag\tnst_rec.flag\n#define\tnst_client\tnst_rec.client\n\n/*\n * At some point the server will run out of kernel storage for\n * state structures. For FreeBSD5.2, this results in a panic\n * kmem_map is full. It happens at well over 1000000 opens plus\n * locks on a PIII-800 with 256Mbytes, so that is where I've set\n * the limit. If your server panics due to too many opens/locks,\n * decrease the size of NFSRV_V4STATELIMIT. If you find the server\n * returning NFS4ERR_RESOURCE a lot and have lots of memory, try\n * increasing it.\n */\n#define\tNFSRV_V4STATELIMIT\t500000\t/* Max # of Opens + Locks */\n\n/*\n * The type required differs with BSDen (just the second arg).\n */\nvoid nfsrvd_rcv(struct socket *, void *, int);\n\n/*\n * Macros for handling socket addresses. (Hopefully this makes the code\n * more portable, since I've noticed some 'BSD don't have sockaddrs in\n * mbufs any more.)\n */\n#define\tNFSSOCKADDR(a, t)\t((t)(a))\n#define\tNFSSOCKADDRALLOC(a) \t\t\t\t\t\\\n    do {\t\t\t\t\t\t\t\\\n\tMALLOC((a), struct sockaddr *, sizeof (struct sockaddr), \\\n\t    M_SONAME, M_WAITOK); \t\t\t\t\\\n\tNFSBZERO((a), sizeof (struct sockaddr)); \t\t\\\n    } while (0)\n#define\tNFSSOCKADDRSIZE(a, s)\t\t((a)->sa_len = (s))\n#define\tNFSSOCKADDRFREE(a) \t\t\t\t\t\\\n\tdo { \t\t\t\t\t\t\t\\\n\t\tif (a) \t\t\t\t\t\t\\\n\t\t\tFREE((caddr_t)(a), M_SONAME); \t\t\\\n\t} while (0)\n\n/*\n * These should be defined as a process or thread structure, as required\n * for signal handling, etc.\n */\n#define\tNFSNEWCRED(c)\t\t(crdup(c))\n#define\tNFSPROCCRED(p)\t\t((p)->td_ucred)\n#define\tNFSFREECRED(c)\t\t(crfree(c))\n#define\tNFSUIOPROC(u, p)\t((u)->uio_td = NULL)\n#define\tNFSPROCP(p)\t\t((p)->td_proc)\n\n/*\n * Define these so that cn_hash and its length is ignored.\n */\n#define\tNFSCNHASHZERO(c)\n#define\tNFSCNHASH(c, v)\n#define\tNCHNAMLEN\t9999999\n\n/*\n * Define these to use the time of day clock.\n */\n#define\tNFSGETTIME(t)\t\t(getmicrotime(t))\n#define\tNFSGETNANOTIME(t)\t(getnanotime(t))\n\n/*\n * These macros are defined to initialize and set the timer routine.\n */\n#define\tNFS_TIMERINIT \\\n\tnewnfs_timer(NULL)\n\n/*\n * Handle SMP stuff:\n */\n#define\tNFSSTATESPINLOCK\textern struct mtx nfs_state_mutex\n#define\tNFSLOCKSTATE()\t\tmtx_lock(&nfs_state_mutex)\n#define\tNFSUNLOCKSTATE()\tmtx_unlock(&nfs_state_mutex)\n#define\tNFSSTATEMUTEXPTR\t(&nfs_state_mutex)\n#define\tNFSREQSPINLOCK\t\textern struct mtx nfs_req_mutex\n#define\tNFSLOCKREQ()\t\tmtx_lock(&nfs_req_mutex)\n#define\tNFSUNLOCKREQ()\t\tmtx_unlock(&nfs_req_mutex)\n#define\tNFSCACHEMUTEX\t\textern struct mtx nfs_cache_mutex\n#define\tNFSCACHEMUTEXPTR\t(&nfs_cache_mutex)\n#define\tNFSLOCKCACHE()\t\tmtx_lock(&nfs_cache_mutex)\n#define\tNFSUNLOCKCACHE()\tmtx_unlock(&nfs_cache_mutex)\n#define\tNFSCACHELOCKREQUIRED()\tmtx_assert(&nfs_cache_mutex, MA_OWNED)\n#define\tNFSSOCKMUTEX\t\textern struct mtx nfs_slock_mutex\n#define\tNFSSOCKMUTEXPTR\t\t(&nfs_slock_mutex)\n#define\tNFSLOCKSOCK()\t\tmtx_lock(&nfs_slock_mutex)\n#define\tNFSUNLOCKSOCK()\t\tmtx_unlock(&nfs_slock_mutex)\n#define\tNFSNAMEIDMUTEX\t\textern struct mtx nfs_nameid_mutex\n#define\tNFSLOCKNAMEID()\t\tmtx_lock(&nfs_nameid_mutex)\n#define\tNFSUNLOCKNAMEID()\tmtx_unlock(&nfs_nameid_mutex)\n#define\tNFSNAMEIDREQUIRED()\tmtx_assert(&nfs_nameid_mutex, MA_OWNED)\n#define\tNFSCLSTATEMUTEX\t\textern struct mtx nfs_clstate_mutex\n#define\tNFSCLSTATEMUTEXPTR\t(&nfs_clstate_mutex)\n#define\tNFSLOCKCLSTATE()\tmtx_lock(&nfs_clstate_mutex)\n#define\tNFSUNLOCKCLSTATE()\tmtx_unlock(&nfs_clstate_mutex)\n#define\tNFSDLOCKMUTEX\t\textern struct mtx newnfsd_mtx\n#define\tNFSDLOCKMUTEXPTR\t(&newnfsd_mtx)\n#define\tNFSD_LOCK()\t\tmtx_lock(&newnfsd_mtx)\n#define\tNFSD_UNLOCK()\t\tmtx_unlock(&newnfsd_mtx)\n#define\tNFSD_LOCK_ASSERT()\tmtx_assert(&newnfsd_mtx, MA_OWNED)\n#define\tNFSD_UNLOCK_ASSERT()\tmtx_assert(&newnfsd_mtx, MA_NOTOWNED)\n#define\tNFSV4ROOTLOCKMUTEX\textern struct mtx nfs_v4root_mutex\n#define\tNFSV4ROOTLOCKMUTEXPTR\t(&nfs_v4root_mutex)\n#define\tNFSLOCKV4ROOTMUTEX()\tmtx_lock(&nfs_v4root_mutex)\n#define\tNFSUNLOCKV4ROOTMUTEX()\tmtx_unlock(&nfs_v4root_mutex)\n#define\tNFSLOCKNODE(n)\t\tmtx_lock(&((n)->n_mtx))\n#define\tNFSUNLOCKNODE(n)\tmtx_unlock(&((n)->n_mtx))\n#define\tNFSLOCKMNT(m)\t\tmtx_lock(&((m)->nm_mtx))\n#define\tNFSUNLOCKMNT(m)\t\tmtx_unlock(&((m)->nm_mtx))\n#define\tNFSLOCKREQUEST(r)\tmtx_lock(&((r)->r_mtx))\n#define\tNFSUNLOCKREQUEST(r)\tmtx_unlock(&((r)->r_mtx))\n#define\tNFSPROCLISTLOCK()\tsx_slock(&allproc_lock)\n#define\tNFSPROCLISTUNLOCK()\tsx_sunlock(&allproc_lock)\n#define\tNFSLOCKSOCKREQ(r)\tmtx_lock(&((r)->nr_mtx))\n#define\tNFSUNLOCKSOCKREQ(r)\tmtx_unlock(&((r)->nr_mtx))\n\n/*\n * Use these macros to initialize/free a mutex.\n */\n#define\tNFSINITSOCKMUTEX(m)\tmtx_init((m), \"nfssock\", NULL, MTX_DEF)\n#define\tNFSFREEMUTEX(m)\t\tmtx_destroy((m))\n\nint nfsmsleep(void *, void *, int, const char *, struct timespec *);\n\n/*\n * And weird vm stuff in the nfs server.\n */\n#define\tPDIRUNLOCK\t0x0\n#define\tMAX_COMMIT_COUNT\t(1024 * 1024)\n\n/*\n * Define these to handle the type of va_rdev.\n */\n#define\tNFSMAKEDEV(m, n)\tmakedev((m), (n))\n#define\tNFSMAJOR(d)\t\tmajor(d)\n#define\tNFSMINOR(d)\t\tminor(d)\n\n/*\n * Define this to be the macro that returns the minimum size required\n * for a directory entry.\n */\n#define\tDIRENT_SIZE(dp)\t\tGENERIC_DIRSIZ(dp)\n\n/*\n * The vnode tag for nfsv4root.\n */\n#define\tVT_NFSV4ROOT\t\t\"nfsv4root\"\n\n/*\n * Define whatever it takes to do a vn_rdwr().\n */\n#define\tNFSD_RDWR(r, v, b, l, o, s, i, c, a, p) \\\n\tvn_rdwr((r), (v), (b), (l), (o), (s), (i), (c), NULL, (a), (p))\n\n/*\n * Macros for handling memory for different BSDen.\n * NFSBCOPY(src, dst, len) - copies len bytes, non-overlapping\n * NFSOVBCOPY(src, dst, len) - ditto, but data areas might overlap\n * NFSBCMP(cp1, cp2, len) - compare len bytes, return 0 if same\n * NFSBZERO(cp, len) - set len bytes to 0x0\n */\n#define\tNFSBCOPY(s, d, l)\tbcopy((s), (d), (l))\n#define\tNFSOVBCOPY(s, d, l)\tovbcopy((s), (d), (l))\n#define\tNFSBCMP(s, d, l)\tbcmp((s), (d), (l))\n#define\tNFSBZERO(s, l)\t\tbzero((s), (l))\n\n/*\n * Some queue.h files don't have these dfined in them.\n */\n#define\tLIST_END(head)\t\tNULL\n#define\tSLIST_END(head)\t\tNULL\n#define\tTAILQ_END(head)\t\tNULL\n\n/*\n * This must be defined to be a global variable that increments once\n * per second, but never stops or goes backwards, even when a \"date\"\n * command changes the TOD clock. It is used for delta times for\n * leases, etc.\n */\n#define\tNFSD_MONOSEC\t\ttime_uptime\n\n/*\n * Declare the malloc types.\n */\nMALLOC_DECLARE(M_NEWNFSRVCACHE);\nMALLOC_DECLARE(M_NEWNFSDCLIENT);\nMALLOC_DECLARE(M_NEWNFSDSTATE);\nMALLOC_DECLARE(M_NEWNFSDLOCK);\nMALLOC_DECLARE(M_NEWNFSDLOCKFILE);\nMALLOC_DECLARE(M_NEWNFSSTRING);\nMALLOC_DECLARE(M_NEWNFSUSERGROUP);\nMALLOC_DECLARE(M_NEWNFSDREQ);\nMALLOC_DECLARE(M_NEWNFSFH);\nMALLOC_DECLARE(M_NEWNFSCLOWNER);\nMALLOC_DECLARE(M_NEWNFSCLOPEN);\nMALLOC_DECLARE(M_NEWNFSCLDELEG);\nMALLOC_DECLARE(M_NEWNFSCLCLIENT);\nMALLOC_DECLARE(M_NEWNFSCLLOCKOWNER);\nMALLOC_DECLARE(M_NEWNFSCLLOCK);\nMALLOC_DECLARE(M_NEWNFSDIROFF);\nMALLOC_DECLARE(M_NEWNFSV4NODE);\nMALLOC_DECLARE(M_NEWNFSDIRECTIO);\nMALLOC_DECLARE(M_NEWNFSMNT);\nMALLOC_DECLARE(M_NEWNFSDROLLBACK);\n#define\tM_NFSRVCACHE\tM_NEWNFSRVCACHE\n#define\tM_NFSDCLIENT\tM_NEWNFSDCLIENT\n#define\tM_NFSDSTATE\tM_NEWNFSDSTATE\n#define\tM_NFSDLOCK\tM_NEWNFSDLOCK\n#define\tM_NFSDLOCKFILE\tM_NEWNFSDLOCKFILE\n#define\tM_NFSSTRING\tM_NEWNFSSTRING\n#define\tM_NFSUSERGROUP\tM_NEWNFSUSERGROUP\n#define\tM_NFSDREQ\tM_NEWNFSDREQ\n#define\tM_NFSFH\t\tM_NEWNFSFH\n#define\tM_NFSCLOWNER\tM_NEWNFSCLOWNER\n#define\tM_NFSCLOPEN\tM_NEWNFSCLOPEN\n#define\tM_NFSCLDELEG\tM_NEWNFSCLDELEG\n#define\tM_NFSCLCLIENT\tM_NEWNFSCLCLIENT\n#define\tM_NFSCLLOCKOWNER M_NEWNFSCLLOCKOWNER\n#define\tM_NFSCLLOCK\tM_NEWNFSCLLOCK\n#define\tM_NFSDIROFF\tM_NEWNFSDIROFF\n#define\tM_NFSV4NODE\tM_NEWNFSV4NODE\n#define\tM_NFSDIRECTIO\tM_NEWNFSDIRECTIO\n#define\tM_NFSDROLLBACK\tM_NEWNFSDROLLBACK\n\n#define\tNFSINT_SIGMASK(set) \t\t\t\t\t\t\\\n\t(SIGISMEMBER(set, SIGINT) || SIGISMEMBER(set, SIGTERM) ||\t\\\n\t SIGISMEMBER(set, SIGHUP) || SIGISMEMBER(set, SIGKILL) ||\t\\\n\t SIGISMEMBER(set, SIGQUIT))\n\n/*\n * Convert a quota block count to byte count.\n */\n#define\tNFSQUOTABLKTOBYTE(q, b)\t(q) *= (b)\n\n/*\n * Define this as the largest file size supported. (It should probably\n * be available via a VFS_xxx Op, but it isn't.\n */\n#define\tNFSRV_MAXFILESIZE\t((u_int64_t)0x800000000000)\n\n/*\n * Set this macro to index() or strchr(), whichever is supported.\n */\n#define\tSTRCHR(s, c)\tindex((s), (c))\n\n/*\n * Set the n_time in the client write rpc, as required.\n */\n#define\tNFSWRITERPC_SETTIME(w, n, v4)\t\t\t\t\t\\\n\tdo {\t\t\t\t\t\t\t\t\\\n\t\tif (w) {\t\t\t\t\t\t\\\n\t\t\t(n)->n_mtime = (n)->n_vattr.na_vattr.va_mtime; \\\n\t\t\tif (v4)\t\t\t\t\t\t\\\n\t\t\t    (n)->n_change = (n)->n_vattr.na_vattr.va_filerev; \\\n\t\t}\t\t\t\t\t\t\t\\\n\t} while (0)\n\n/*\n * Fake value, just to make the client work.\n */\n#define\tNFS_LATTR_NOSHRINK\t1\n\n/*\n * Prototypes for functions where the arguments vary for different ports.\n */\nint nfscl_loadattrcache(struct vnode **, struct nfsvattr *, void *, void *,\n    int, int);\nvoid newnfs_realign(struct mbuf **);\n\n/*\n * If the port runs on an SMP box that can enforce Atomic ops with low\n * overheads, define these as atomic increments/decrements. If not,\n * don't worry about it, since these are used for stats that can be\n * \"out by one\" without disastrous consequences.\n */\n#define\tNFSINCRGLOBAL(a)\t((a)++)\n\n/*\n * Assorted funky stuff to make things work under Darwin8.\n */\n/*\n * These macros checks for a field in vattr being set.\n */\n#define\tNFSATTRISSET(t, v, a)\t((v)->a != (t)VNOVAL)\n#define\tNFSATTRISSETTIME(v, a)\t((v)->a.tv_sec != VNOVAL)\n\n/*\n * Manipulate mount flags.\n */\n#define\tNFSSTA_HASWRITEVERF\t0x00040000  /* Has write verifier */\n#define\tNFSSTA_GOTFSINFO\t0x00100000  /* Got the fsinfo */\n#define\tNFSSTA_TIMEO\t\t0x10000000  /* Experiencing a timeout */\n#define\tNFSSTA_LOCKTIMEO\t0x20000000  /* Experiencing a lockd timeout */\n#define\tNFSSTA_HASSETFSID\t0x40000000  /* Has set the fsid */\n\n#define\tNFSHASNFSV3(n)\t\t((n)->nm_flag & NFSMNT_NFSV3)\n#define\tNFSHASNFSV4(n)\t\t((n)->nm_flag & NFSMNT_NFSV4)\n#define\tNFSHASNFSV3OR4(n)\t((n)->nm_flag & (NFSMNT_NFSV3 | NFSMNT_NFSV4))\n#define\tNFSHASGOTFSINFO(n)\t((n)->nm_state & NFSSTA_GOTFSINFO)\n#define\tNFSHASHASSETFSID(n)\t((n)->nm_state & NFSSTA_HASSETFSID)\n#define\tNFSHASSTRICT3530(n)\t((n)->nm_flag & NFSMNT_STRICT3530)\n#define\tNFSHASWRITEVERF(n)\t((n)->nm_state & NFSSTA_HASWRITEVERF)\n#define\tNFSHASINT(n)\t\t((n)->nm_flag & NFSMNT_INT)\n#define\tNFSHASSOFT(n)\t\t((n)->nm_flag & NFSMNT_SOFT)\n#define\tNFSHASINTORSOFT(n)\t((n)->nm_flag & (NFSMNT_INT | NFSMNT_SOFT))\n#define\tNFSHASDUMBTIMR(n)\t((n)->nm_flag & NFSMNT_DUMBTIMR)\n#define\tNFSHASNOCONN(n)\t\t((n)->nm_flag & NFSMNT_MNTD)\n#define\tNFSHASKERB(n)\t\t((n)->nm_flag & NFSMNT_KERB)\n#define\tNFSHASALLGSSNAME(n)\t((n)->nm_flag & NFSMNT_ALLGSSNAME)\n#define\tNFSHASINTEGRITY(n)\t((n)->nm_flag & NFSMNT_INTEGRITY)\n#define\tNFSHASPRIVACY(n)\t((n)->nm_flag & NFSMNT_PRIVACY)\n#define\tNFSSETWRITEVERF(n)\t((n)->nm_state |= NFSSTA_HASWRITEVERF)\n#define\tNFSSETHASSETFSID(n)\t((n)->nm_state |= NFSSTA_HASSETFSID)\n\n/*\n * Gets the stats field out of the mount structure.\n */\n#define\tvfs_statfs(m)\t(&((m)->mnt_stat))\n\n/*\n * Set boottime.\n */\n#define\tNFSSETBOOTTIME(b)\t((b) = boottime)\n\n/*\n * The size of directory blocks in the buffer cache.\n * MUST BE in the range of PAGE_SIZE <= NFS_DIRBLKSIZ <= MAXBSIZE!!\n */\n#define\tNFS_DIRBLKSIZ\t(16 * DIRBLKSIZ) /* Must be a multiple of DIRBLKSIZ */\n\n/*\n * Define these macros to access mnt_flag fields.\n */\n#define\tNFSMNT_RDONLY(m)\t((m)->mnt_flag & MNT_RDONLY)\n#endif\t/* _KERNEL */\n\n/*\n * Define a structure similar to ufs_args for use in exporting the V4 root.\n */\nstruct nfsex_args {\n\tchar\t*fspec;\n\tstruct export_args\texport;\n};\n\n/*\n * These export flags should be defined, but there are no bits left.\n * Maybe a separate mnt_exflag field could be added or the mnt_flag\n * field increased to 64 bits?\n */\n#ifndef\tMNT_EXSTRICTACCESS\n#define\tMNT_EXSTRICTACCESS\t0x0\n#endif\n#ifndef MNT_EXV4ONLY\n#define\tMNT_EXV4ONLY\t\t0x0\n#endif\n\n#ifdef _KERNEL\n/*\n * Define this to invalidate the attribute cache for the nfs node.\n */\n#define\tNFSINVALATTRCACHE(n)\t((n)->n_attrstamp = 0)\n\n/* Used for FreeBSD only */\nvoid nfsd_mntinit(void);\n\n/*\n * Define these for vnode lock/unlock ops.\n *\n * These are good abstractions to macro out, so that they can be added to\n * later, for debugging or stats, etc.\n */\n#define\tNFSVOPLOCK(v, f)\tvn_lock((v), (f))\n#define\tNFSVOPUNLOCK(v, f)\tVOP_UNLOCK((v), (f))\n#define\tNFSVOPISLOCKED(v)\tVOP_ISLOCKED((v))\n\n/*\n * Define ncl_hash().\n */\n#define\tncl_hash(f, l)\t(fnv_32_buf((f), (l), FNV1_32_INIT))\n\nint newnfs_iosize(struct nfsmount *);\n\n#ifdef NFS_DEBUG\n\nextern int nfs_debug;\n#define\tNFS_DEBUG_ASYNCIO\t1 /* asynchronous i/o */\n#define\tNFS_DEBUG_WG\t\t2 /* server write gathering */\n#define\tNFS_DEBUG_RC\t\t4 /* server request caching */\n\n#define\tNFS_DPF(cat, args)\t\t\t\t\t\\\n\tdo {\t\t\t\t\t\t\t\\\n\t\tif (nfs_debug & NFS_DEBUG_##cat) printf args;\t\\\n\t} while (0)\n\n#else\n\n#define\tNFS_DPF(cat, args)\n\n#endif\n\nint newnfs_vncmpf(struct vnode *, void *);\n\n#ifndef NFS_MINDIRATTRTIMO\n#define\tNFS_MINDIRATTRTIMO 3\t\t/* VDIR attrib cache timeout in sec */\n#endif\n#ifndef NFS_MAXDIRATTRTIMO\n#define\tNFS_MAXDIRATTRTIMO 60\n#endif\n\n/*\n * Nfs outstanding request list element\n */\nstruct nfsreq {\n\tTAILQ_ENTRY(nfsreq) r_chain;\n\tu_int32_t\tr_flags;\t/* flags on request, see below */\n\tstruct nfsmount *r_nmp;\t\t/* Client mnt ptr */\n\tstruct mtx\tr_mtx;\t\t/* Mutex lock for this structure */\n};\n\n#ifndef NFS_MAXBSIZE\n#define\tNFS_MAXBSIZE\tMAXBSIZE\n#endif\n\n/*\n * This macro checks to see if issuing of delegations is allowed for this\n * vnode.\n */\n#ifdef VV_DISABLEDELEG\n#define\tNFSVNO_DELEGOK(v)\t\t\t\t\t\t\\\n\t((v) == NULL || ((v)->v_vflag & VV_DISABLEDELEG) == 0)\n#else\n#define\tNFSVNO_DELEGOK(v)\t(1)\n#endif\n\n/*\n * Define this as the flags argument for msleep() when catching signals\n * while holding a resource that other threads would block for, such as\n * a vnode lock.\n */\n#define\tNFS_PCATCH\t(PCATCH | PBDRY)\n\n#endif\t/* _KERNEL */\n\n#endif\t/* _NFS_NFSPORT_H */\n"
  },
  {
    "path": "freebsd-headers/fs/nfs/nfsproto.h",
    "content": "/*-\n * Copyright (c) 1989, 1993\n *\tThe Regents of the University of California.  All rights reserved.\n *\n * This code is derived from software contributed to Berkeley by\n * Rick Macklem at The University of Guelph.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 4. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/fs/nfs/nfsproto.h 223657 2011-06-28 22:52:38Z rmacklem $\n */\n\n#ifndef _NFS_NFSPROTO_H_\n#define\t_NFS_NFSPROTO_H_\n\n/*\n * nfs definitions as per the Version 2, 3 and 4 specs\n */\n\n/*\n * Constants as defined in the NFS Version 2, 3 and 4 specs.\n * \"NFS: Network File System Protocol Specification\" RFC1094\n * and in the \"NFS: Network File System Version 3 Protocol\n * Specification\"\n */\n\n#define\tNFS_PORT\t2049\n#define\tNFS_PROG\t100003\n#define\tNFS_CALLBCKPROG\t0x40000000\t/* V4 only */\n#define\tNFS_VER2\t2\n#define\tNFS_VER3\t3\n#define\tNFS_VER4\t4\n#define\tNFS_V2MAXDATA\t8192\n#define\tNFS_MAXDGRAMDATA 16384\n#define\tNFS_MAXDATA\tNFS_MAXBSIZE\n#define\tNFS_MAXPATHLEN\t1024\n#define\tNFS_MAXNAMLEN\t255\n#define\tNFS_MAXPKTHDR\t404\n#define\tNFS_MAXPACKET\t(NFS_MAXDATA + 2048)\n#define\tNFS_MINPACKET\t20\n#define\tNFS_FABLKSIZE\t512\t/* Size in bytes of a block wrt fa_blocks */\n#define\tNFSV4_MINORVERSION\t0\t/* V4 Minor version */\n#define\tNFSV4_CBVERS\t\t1\t/* V4 CB Version */\n#define\tNFSV4_SMALLSTR\t50\t\t/* Strings small enough for stack */\n\n/* Stat numbers for rpc returns (version 2, 3 and 4) */\n/*\n * These numbers are hard-wired in the RFCs, so they can't be changed.\n * The code currently assumes that the ones < 10000 are the same as\n * sys/errno.h and that sys/errno.h will never go as high as 10000.\n * If the value in sys/errno.h of any entry listed below is changed,\n * the NFS code must be modified to do the mapping between them.\n * (You can ignore NFSERR_WFLUSH, since it is never actually used.)\n */\n#define\tNFSERR_OK\t\t0\n#define\tNFSERR_PERM\t\t1\n#define\tNFSERR_NOENT\t\t2\n#define\tNFSERR_IO\t\t5\n#define\tNFSERR_NXIO\t\t6\n#define\tNFSERR_ACCES\t\t13\n#define\tNFSERR_EXIST\t\t17\n#define\tNFSERR_XDEV\t\t18\t/* Version 3, 4 only */\n#define\tNFSERR_NODEV\t\t19\n#define\tNFSERR_NOTDIR\t\t20\n#define\tNFSERR_ISDIR\t\t21\n#define\tNFSERR_INVAL\t\t22\t/* Version 3, 4 only */\n#define\tNFSERR_FBIG\t\t27\n#define\tNFSERR_NOSPC\t\t28\n#define\tNFSERR_ROFS\t\t30\n#define\tNFSERR_MLINK\t\t31\t/* Version 3, 4 only */\n#define\tNFSERR_NAMETOL\t\t63\n#define\tNFSERR_NOTEMPTY\t\t66\n#define\tNFSERR_DQUOT\t\t69\n#define\tNFSERR_STALE\t\t70\n#define\tNFSERR_REMOTE\t\t71\t/* Version 3 only */\n#define\tNFSERR_WFLUSH\t\t99\t/* Version 2 only */\n#define\tNFSERR_BADHANDLE\t10001\t/* These are Version 3, 4 only */\n#define\tNFSERR_NOT_SYNC\t\t10002\t/* Version 3 Only */\n#define\tNFSERR_BAD_COOKIE\t10003\n#define\tNFSERR_NOTSUPP\t\t10004\n#define\tNFSERR_TOOSMALL\t\t10005\n#define\tNFSERR_SERVERFAULT\t10006\n#define\tNFSERR_BADTYPE\t\t10007\n#define\tNFSERR_DELAY\t\t10008\t/* Called NFSERR_JUKEBOX for V3 */\n#define\tNFSERR_SAME\t\t10009\t/* These are Version 4 only */\n#define\tNFSERR_DENIED\t\t10010\n#define\tNFSERR_EXPIRED\t\t10011\n#define\tNFSERR_LOCKED\t\t10012\n#define\tNFSERR_GRACE\t\t10013\n#define\tNFSERR_FHEXPIRED\t10014\n#define\tNFSERR_SHAREDENIED\t10015\n#define\tNFSERR_WRONGSEC\t\t10016\n#define\tNFSERR_CLIDINUSE\t10017\n#define\tNFSERR_RESOURCE\t\t10018\n#define\tNFSERR_MOVED\t\t10019\n#define\tNFSERR_NOFILEHANDLE\t10020\n#define\tNFSERR_MINORVERMISMATCH\t10021\n#define\tNFSERR_STALECLIENTID\t10022\n#define\tNFSERR_STALESTATEID\t10023\n#define\tNFSERR_OLDSTATEID\t10024\n#define\tNFSERR_BADSTATEID\t10025\n#define\tNFSERR_BADSEQID\t\t10026\n#define\tNFSERR_NOTSAME\t\t10027\n#define\tNFSERR_LOCKRANGE\t10028\n#define\tNFSERR_SYMLINK\t\t10029\n#define\tNFSERR_RESTOREFH\t10030\n#define\tNFSERR_LEASEMOVED\t10031\n#define\tNFSERR_ATTRNOTSUPP\t10032\n#define\tNFSERR_NOGRACE\t\t10033\n#define\tNFSERR_RECLAIMBAD\t10034\n#define\tNFSERR_RECLAIMCONFLICT\t10035\n#define\tNFSERR_BADXDR\t\t10036\n#define\tNFSERR_LOCKSHELD\t10037\n#define\tNFSERR_OPENMODE\t\t10038\n#define\tNFSERR_BADOWNER\t\t10039\n#define\tNFSERR_BADCHAR\t\t10040\n#define\tNFSERR_BADNAME\t\t10041\n#define\tNFSERR_BADRANGE\t\t10042\n#define\tNFSERR_LOCKNOTSUPP\t10043\n#define\tNFSERR_OPILLEGAL\t10044\n#define\tNFSERR_DEADLOCK\t\t10045\n#define\tNFSERR_FILEOPEN\t\t10046\n#define\tNFSERR_ADMINREVOKED\t10047\n#define\tNFSERR_CBPATHDOWN\t10048\n\n#define\tNFSERR_STALEWRITEVERF\t30001\t/* Fake return for nfs_commit() */\n#define\tNFSERR_DONTREPLY\t30003\t/* Don't process request */\n#define\tNFSERR_RETVOID\t\t30004\t/* Return void, not error */\n#define\tNFSERR_REPLYFROMCACHE\t30005\t/* Reply from recent request cache */\n#define\tNFSERR_STALEDONTRECOVER\t30006\t/* Don't initiate recovery */\n\n#define\tNFSERR_RPCERR\t\t0x40000000 /* Mark an RPC layer error */\n#define\tNFSERR_AUTHERR\t\t0x80000000 /* Mark an authentication error */\n\n#define\tNFSERR_RPCMISMATCH\t(NFSERR_RPCERR | RPC_MISMATCH)\n#define\tNFSERR_PROGUNAVAIL\t(NFSERR_RPCERR | RPC_PROGUNAVAIL)\n#define\tNFSERR_PROGMISMATCH\t(NFSERR_RPCERR | RPC_PROGMISMATCH)\n#define\tNFSERR_PROGNOTV4\t(NFSERR_RPCERR | 0xffff)\n#define\tNFSERR_PROCUNAVAIL\t(NFSERR_RPCERR | RPC_PROCUNAVAIL)\n#define\tNFSERR_GARBAGE\t\t(NFSERR_RPCERR | RPC_GARBAGE)\n\n/* Sizes in bytes of various nfs rpc components */\n#define\tNFSX_UNSIGNED\t4\n#define\tNFSX_HYPER\t(2 * NFSX_UNSIGNED)\n\n/* specific to NFS Version 2 */\n#define\tNFSX_V2FH\t32\n#define\tNFSX_V2FATTR\t68\n#define\tNFSX_V2SATTR\t32\n#define\tNFSX_V2COOKIE\t4\n#define\tNFSX_V2STATFS\t20\n\n/* specific to NFS Version 3 */\n#define\tNFSX_V3FHMAX\t\t64\t/* max. allowed by protocol */\n#define\tNFSX_V3FATTR\t\t84\n#define\tNFSX_V3SATTR\t\t60\t/* max. all fields filled in */\n#define\tNFSX_V3SRVSATTR\t\t(sizeof (struct nfsv3_sattr))\n#define\tNFSX_V3POSTOPATTR\t(NFSX_V3FATTR + NFSX_UNSIGNED)\n#define\tNFSX_V3WCCDATA\t\t(NFSX_V3POSTOPATTR + 8 * NFSX_UNSIGNED)\n#define\tNFSX_V3STATFS\t\t52\n#define\tNFSX_V3FSINFO\t\t48\n#define\tNFSX_V3PATHCONF\t\t24\n\n/* specific to NFS Version 4 */\n#define\tNFSX_V4FHMAX\t\t128\n#define\tNFSX_V4FSID\t\t(2 * NFSX_HYPER)\n#define\tNFSX_V4SPECDATA\t\t(2 * NFSX_UNSIGNED)\n#define\tNFSX_V4TIME\t\t(NFSX_HYPER + NFSX_UNSIGNED)\n#define\tNFSX_V4SETTIME\t\t(NFSX_UNSIGNED + NFSX_V4TIME)\n\n/* sizes common to multiple NFS versions */\n#define\tNFSX_FHMAX\t\t(NFSX_V4FHMAX)\n#define\tNFSX_MYFH\t\t(sizeof (fhandle_t)) /* size this server uses */\n#define\tNFSX_VERF \t\t8\n#define\tNFSX_STATEIDOTHER\t12\n#define\tNFSX_STATEID\t\t(NFSX_UNSIGNED + NFSX_STATEIDOTHER)\n#define\tNFSX_GSSH\t\t12\n\n/* variants for multiple versions */\n#define\tNFSX_STATFS(v3)\t\t((v3) ? NFSX_V3STATFS : NFSX_V2STATFS)\n\n/* nfs rpc procedure numbers (before version mapping) */\n#define\tNFSPROC_NULL\t\t0\n#define\tNFSPROC_GETATTR\t\t1\n#define\tNFSPROC_SETATTR\t\t2\n#define\tNFSPROC_LOOKUP\t\t3\n#define\tNFSPROC_ACCESS\t\t4\n#define\tNFSPROC_READLINK\t5\n#define\tNFSPROC_READ\t\t6\n#define\tNFSPROC_WRITE\t\t7\n#define\tNFSPROC_CREATE\t\t8\n#define\tNFSPROC_MKDIR\t\t9\n#define\tNFSPROC_SYMLINK\t\t10\n#define\tNFSPROC_MKNOD\t\t11\n#define\tNFSPROC_REMOVE\t\t12\n#define\tNFSPROC_RMDIR\t\t13\n#define\tNFSPROC_RENAME\t\t14\n#define\tNFSPROC_LINK\t\t15\n#define\tNFSPROC_READDIR\t\t16\n#define\tNFSPROC_READDIRPLUS\t17\n#define\tNFSPROC_FSSTAT\t\t18\n#define\tNFSPROC_FSINFO\t\t19\n#define\tNFSPROC_PATHCONF\t20\n#define\tNFSPROC_COMMIT\t\t21\n\n/*\n * The lower numbers -> 21 are used by NFSv2 and v3. These define higher\n * numbers used by NFSv4.\n * NFS_V3NPROCS is one greater than the last V3 op and NFS_NPROCS is\n * one greater than the last number.\n */\n#ifndef\tNFS_V3NPROCS\n#define\tNFS_V3NPROCS\t\t22\n\n#define\tNFSPROC_LOOKUPP\t\t22\n#define\tNFSPROC_SETCLIENTID\t23\n#define\tNFSPROC_SETCLIENTIDCFRM\t24\n#define\tNFSPROC_LOCK\t\t25\n#define\tNFSPROC_LOCKU\t\t26\n#define\tNFSPROC_OPEN\t\t27\n#define\tNFSPROC_CLOSE\t\t28\n#define\tNFSPROC_OPENCONFIRM\t29\n#define\tNFSPROC_LOCKT\t\t30\n#define\tNFSPROC_OPENDOWNGRADE\t31\n#define\tNFSPROC_RENEW\t\t32\n#define\tNFSPROC_PUTROOTFH\t33\n#define\tNFSPROC_RELEASELCKOWN\t34\n#define\tNFSPROC_DELEGRETURN\t35\n#define\tNFSPROC_RETDELEGREMOVE\t36\n#define\tNFSPROC_RETDELEGRENAME1\t37\n#define\tNFSPROC_RETDELEGRENAME2\t38\n#define\tNFSPROC_GETACL\t\t39\n#define\tNFSPROC_SETACL\t\t40\n\n/*\n * Must be defined as one higher than the last Proc# above.\n */\n#define\tNFSV4_NPROCS\t\t41\n#endif\t/* NFS_V3NPROCS */\n\n/*\n * Define NFS_NPROCS as NFSV4_NPROCS for the experimental kernel code.\n */\n#ifndef\tNFS_NPROCS\n#define\tNFS_NPROCS\t\tNFSV4_NPROCS\n#endif\n\n/*\n * NFSPROC_NOOP is a fake op# that can't be the same as any V2/3/4 Procedure\n * or Operation#. Since the NFS V4 Op #s go higher, use NFSV4OP_NOPS, which\n * is one greater than the highest Op#.\n */\n#define\tNFSPROC_NOOP\t\tNFSV4OP_NOPS\n\n/* Actual Version 2 procedure numbers */\n#define\tNFSV2PROC_NULL\t\t0\n#define\tNFSV2PROC_GETATTR\t1\n#define\tNFSV2PROC_SETATTR\t2\n#define\tNFSV2PROC_NOOP\t\t3\n#define\tNFSV2PROC_ROOT\t\tNFSV2PROC_NOOP\t/* Obsolete */\n#define\tNFSV2PROC_LOOKUP\t4\n#define\tNFSV2PROC_READLINK\t5\n#define\tNFSV2PROC_READ\t\t6\n#define\tNFSV2PROC_WRITECACHE\tNFSV2PROC_NOOP\t/* Obsolete */\n#define\tNFSV2PROC_WRITE\t\t8\n#define\tNFSV2PROC_CREATE\t9\n#define\tNFSV2PROC_REMOVE\t10\n#define\tNFSV2PROC_RENAME\t11\n#define\tNFSV2PROC_LINK\t\t12\n#define\tNFSV2PROC_SYMLINK\t13\n#define\tNFSV2PROC_MKDIR\t\t14\n#define\tNFSV2PROC_RMDIR\t\t15\n#define\tNFSV2PROC_READDIR\t16\n#define\tNFSV2PROC_STATFS\t17\n\n/*\n * V4 Procedure numbers\n */\n#define\tNFSV4PROC_COMPOUND\t1\n#define\tNFSV4PROC_CBNULL\t0\n#define\tNFSV4PROC_CBCOMPOUND\t1\n\n/*\n * Constants used by the Version 3 and 4 protocols for various RPCs\n */\n#define\tNFSV3SATTRTIME_DONTCHANGE\t0\n#define\tNFSV3SATTRTIME_TOSERVER\t\t1\n#define\tNFSV3SATTRTIME_TOCLIENT\t\t2\n\n#define\tNFSV4SATTRTIME_TOSERVER\t\t0\n#define\tNFSV4SATTRTIME_TOCLIENT\t\t1\n\n#define\tNFSV4LOCKT_READ\t\t\t1\n#define\tNFSV4LOCKT_WRITE\t\t2\n#define\tNFSV4LOCKT_READW\t\t3\n#define\tNFSV4LOCKT_WRITEW\t\t4\n#define\tNFSV4LOCKT_RELEASE\t\t5\n\n#define\tNFSV4OPEN_NOCREATE\t\t0\n#define\tNFSV4OPEN_CREATE\t\t1\n#define\tNFSV4OPEN_CLAIMNULL\t\t0\n#define\tNFSV4OPEN_CLAIMPREVIOUS\t\t1\n#define\tNFSV4OPEN_CLAIMDELEGATECUR\t2\n#define\tNFSV4OPEN_CLAIMDELEGATEPREV\t3\n#define\tNFSV4OPEN_DELEGATENONE\t\t0\n#define\tNFSV4OPEN_DELEGATEREAD\t\t1\n#define\tNFSV4OPEN_DELEGATEWRITE\t\t2\n#define\tNFSV4OPEN_LIMITSIZE\t\t1\n#define\tNFSV4OPEN_LIMITBLOCKS\t\t2\n\n/*\n * Nfs V4 ACE stuff\n */\n#define\tNFSV4ACE_ALLOWEDTYPE\t\t0x00000000\n#define\tNFSV4ACE_DENIEDTYPE\t\t0x00000001\n#define\tNFSV4ACE_AUDITTYPE\t\t0x00000002\n#define\tNFSV4ACE_ALARMTYPE\t\t0x00000003\n\n#define\tNFSV4ACE_SUPALLOWED\t\t0x00000001\n#define\tNFSV4ACE_SUPDENIED\t\t0x00000002\n#define\tNFSV4ACE_SUPAUDIT\t\t0x00000004\n#define\tNFSV4ACE_SUPALARM\t\t0x00000008\n\n#define\tNFSV4ACE_SUPTYPES\t(NFSV4ACE_SUPALLOWED | NFSV4ACE_SUPDENIED)\n\n#define\tNFSV4ACE_FILEINHERIT\t\t0x00000001\n#define\tNFSV4ACE_DIRECTORYINHERIT\t0x00000002\n#define\tNFSV4ACE_NOPROPAGATEINHERIT\t0x00000004\n#define\tNFSV4ACE_INHERITONLY\t\t0x00000008\n#define\tNFSV4ACE_SUCCESSFULACCESS\t0x00000010\n#define\tNFSV4ACE_FAILEDACCESS\t\t0x00000020\n#define\tNFSV4ACE_IDENTIFIERGROUP\t0x00000040\n\n#define\tNFSV4ACE_READDATA\t\t0x00000001\n#define\tNFSV4ACE_LISTDIRECTORY\t\t0x00000001\n#define\tNFSV4ACE_WRITEDATA\t\t0x00000002\n#define\tNFSV4ACE_ADDFILE\t\t0x00000002\n#define\tNFSV4ACE_APPENDDATA\t\t0x00000004\n#define\tNFSV4ACE_ADDSUBDIRECTORY\t0x00000004\n#define\tNFSV4ACE_READNAMEDATTR\t\t0x00000008\n#define\tNFSV4ACE_WRITENAMEDATTR\t\t0x00000010\n#define\tNFSV4ACE_EXECUTE\t\t0x00000020\n#define\tNFSV4ACE_SEARCH\t\t\t0x00000020\n#define\tNFSV4ACE_DELETECHILD\t\t0x00000040\n#define\tNFSV4ACE_READATTRIBUTES\t\t0x00000080\n#define\tNFSV4ACE_WRITEATTRIBUTES\t0x00000100\n#define\tNFSV4ACE_DELETE\t\t\t0x00010000\n#define\tNFSV4ACE_READACL\t\t0x00020000\n#define\tNFSV4ACE_WRITEACL\t\t0x00040000\n#define\tNFSV4ACE_WRITEOWNER\t\t0x00080000\n#define\tNFSV4ACE_SYNCHRONIZE\t\t0x00100000\n\n/*\n * Here are the mappings between mode bits and acl mask bits for\n * directories and other files.\n * (Named attributes have not been included, since named attributes are\n *  not yet supported.)\n * The mailing list seems to indicate that NFSV4ACE_EXECUTE refers to\n * searching a directory, although I can't find a statement of that in\n * the RFC.\n */\n#define\tNFSV4ACE_ALLFILESMASK\t(NFSV4ACE_READATTRIBUTES | NFSV4ACE_READACL)\n#define\tNFSV4ACE_OWNERMASK\t(NFSV4ACE_WRITEATTRIBUTES | NFSV4ACE_WRITEACL)\n#define\tNFSV4ACE_DIRREADMASK\tNFSV4ACE_LISTDIRECTORY\n#define\tNFSV4ACE_DIREXECUTEMASK\tNFSV4ACE_EXECUTE\n#define\tNFSV4ACE_DIRWRITEMASK\t(NFSV4ACE_ADDFILE | \t\t\t\\\n\t\tNFSV4ACE_ADDSUBDIRECTORY | NFSV4ACE_DELETECHILD)\n#define\tNFSV4ACE_READMASK\tNFSV4ACE_READDATA\n#define\tNFSV4ACE_WRITEMASK\t(NFSV4ACE_WRITEDATA | NFSV4ACE_APPENDDATA)\n#define\tNFSV4ACE_EXECUTEMASK\tNFSV4ACE_EXECUTE\n#define\tNFSV4ACE_ALLFILEBITS\t(NFSV4ACE_READMASK | NFSV4ACE_WRITEMASK | \\\n\tNFSV4ACE_EXECUTEMASK | NFSV4ACE_SYNCHRONIZE)\n#define\tNFSV4ACE_ALLDIRBITS\t(NFSV4ACE_DIRREADMASK | \t\t\\\n\tNFSV4ACE_DIRWRITEMASK | NFSV4ACE_DIREXECUTEMASK)\n#define\tNFSV4ACE_AUDITMASK\t0x0\n\n/*\n * These GENERIC masks are not used and are no longer believed to be useful.\n */\n#define\tNFSV4ACE_GENERICREAD\t\t0x00120081\n#define\tNFSV4ACE_GENERICWRITE\t\t0x00160106\n#define\tNFSV4ACE_GENERICEXECUTE\t\t0x001200a0\n\n#define\tNFSSTATEID_PUTALLZERO\t\t0\n#define\tNFSSTATEID_PUTALLONE\t\t1\n#define\tNFSSTATEID_PUTSTATEID\t\t2\n\n/*\n * Bits for share access and deny.\n */\n#define\tNFSV4OPEN_ACCESSREAD\t\t0x00000001\n#define\tNFSV4OPEN_ACCESSWRITE\t\t0x00000002\n#define\tNFSV4OPEN_ACCESSBOTH\t\t0x00000003\n\n#define\tNFSV4OPEN_DENYNONE\t\t0x00000000\n#define\tNFSV4OPEN_DENYREAD\t\t0x00000001\n#define\tNFSV4OPEN_DENYWRITE\t\t0x00000002\n#define\tNFSV4OPEN_DENYBOTH\t\t0x00000003\n\n/*\n * Open result flags\n * (The first two are in the spec. The rest are used internally.)\n */\n#define\tNFSV4OPEN_RESULTCONFIRM\t\t0x00000002\n#define\tNFSV4OPEN_LOCKTYPEPOSIX\t\t0x00000004\n#define\tNFSV4OPEN_RFLAGS \t\t\t\t\t\t\\\n\t\t(NFSV4OPEN_RESULTCONFIRM | NFSV4OPEN_LOCKTYPEPOSIX)\n#define\tNFSV4OPEN_RECALL\t\t0x00010000\n#define\tNFSV4OPEN_READDELEGATE\t\t0x00020000\n#define\tNFSV4OPEN_WRITEDELEGATE\t\t0x00040000\n\n/*\n * NFS V4 File Handle types\n */\n#define\tNFSV4FHTYPE_PERSISTENT\t\t0x0\n#define\tNFSV4FHTYPE_NOEXPIREWITHOPEN\t0x1\n#define\tNFSV4FHTYPE_VOLATILEANY\t\t0x2\n#define\tNFSV4FHTYPE_VOLATILEMIGRATE\t0x4\n#define\tNFSV4FHTYPE_VOLATILERENAME\t0x8\n\n/*\n * Maximum size of V4 opaque strings.\n */\n#define\tNFSV4_OPAQUELIMIT\t1024\n\n/*\n * These are the same for V3 and V4.\n */\n#define\tNFSACCESS_READ\t\t\t0x01\n#define\tNFSACCESS_LOOKUP\t\t0x02\n#define\tNFSACCESS_MODIFY\t\t0x04\n#define\tNFSACCESS_EXTEND\t\t0x08\n#define\tNFSACCESS_DELETE\t\t0x10\n#define\tNFSACCESS_EXECUTE\t\t0x20\n\n#define\tNFSWRITE_UNSTABLE\t\t0\n#define\tNFSWRITE_DATASYNC\t\t1\n#define\tNFSWRITE_FILESYNC\t\t2\n\n#define\tNFSCREATE_UNCHECKED\t\t0\n#define\tNFSCREATE_GUARDED\t\t1\n#define\tNFSCREATE_EXCLUSIVE\t\t2\n\n#define\tNFSV3FSINFO_LINK\t\t0x01\n#define\tNFSV3FSINFO_SYMLINK\t\t0x02\n#define\tNFSV3FSINFO_HOMOGENEOUS\t\t0x08\n#define\tNFSV3FSINFO_CANSETTIME\t\t0x10\n\n/* Conversion macros */\n#define\tvtonfsv2_mode(t,m) \t\t\t\t\t\t\\\n\t\ttxdr_unsigned(((t) == VFIFO) ? MAKEIMODE(VCHR, (m)) : \t\\\n\t\t\t\tMAKEIMODE((t), (m)))\n#define\tvtonfsv34_mode(m)\ttxdr_unsigned((m) & 07777)\n#define\tnfstov_mode(a)\t\t(fxdr_unsigned(u_int16_t, (a))&07777)\n#define\tvtonfsv2_type(a)  (((u_int32_t)(a)) >= 9 ? txdr_unsigned(NFNON) : \\\n\t\ttxdr_unsigned(newnfsv2_type[((u_int32_t)(a))]))\n#define\tvtonfsv34_type(a)  (((u_int32_t)(a)) >= 9 ? txdr_unsigned(NFNON) : \\\n\t\ttxdr_unsigned(nfsv34_type[((u_int32_t)(a))]))\n#define\tnfsv2tov_type(a)\tnewnv2tov_type[fxdr_unsigned(u_int32_t,(a))&0x7]\n#define\tnfsv34tov_type(a)\tnv34tov_type[fxdr_unsigned(u_int32_t,(a))&0x7]\n#define\tvtonfs_dtype(a)\t(((u_int32_t)(a)) >= 9 ? IFTODT(VTTOIF(VNON)) : \\\n\t\t\t IFTODT(VTTOIF(a)))\n\n/* File types */\ntypedef enum { NFNON=0, NFREG=1, NFDIR=2, NFBLK=3, NFCHR=4, NFLNK=5,\n\tNFSOCK=6, NFFIFO=7, NFATTRDIR=8, NFNAMEDATTR=9 } nfstype;\n\n/* Structs for common parts of the rpc's */\n\nstruct nfsv2_time {\n\tu_int32_t nfsv2_sec;\n\tu_int32_t nfsv2_usec;\n};\ntypedef struct nfsv2_time\tnfstime2;\n\nstruct nfsv3_time {\n\tu_int32_t nfsv3_sec;\n\tu_int32_t nfsv3_nsec;\n};\ntypedef struct nfsv3_time\tnfstime3;\n\nstruct nfsv4_time {\n\tu_int32_t nfsv4_highsec;\n\tu_int32_t nfsv4_sec;\n\tu_int32_t nfsv4_nsec;\n};\ntypedef struct nfsv4_time\tnfstime4;\n\n/*\n * Quads are defined as arrays of 2 longs to ensure dense packing for the\n * protocol and to facilitate xdr conversion.\n */\nstruct nfs_uquad {\n\tu_int32_t nfsuquad[2];\n};\ntypedef\tstruct nfs_uquad\tnfsuint64;\n\n/*\n * Used to convert between two u_longs and a u_quad_t.\n */\nunion nfs_quadconvert {\n\tu_int32_t lval[2];\n\tu_quad_t  qval;\n};\ntypedef union nfs_quadconvert\tnfsquad_t;\n\n/*\n * NFS Version 3 special file number.\n */\nstruct nfsv3_spec {\n\tu_int32_t specdata1;\n\tu_int32_t specdata2;\n};\ntypedef\tstruct nfsv3_spec\tnfsv3spec;\n\n/*\n * File attributes and setable attributes. These structures cover both\n * NFS version 2 and the version 3 protocol. Note that the union is only\n * used so that one pointer can refer to both variants. These structures\n * go out on the wire and must be densely packed, so no quad data types\n * are used. (all fields are longs or u_longs or structures of same)\n * NB: You can't do sizeof(struct nfs_fattr), you must use the\n *     NFSX_FATTR(v3) macro.\n */\nstruct nfs_fattr {\n\tu_int32_t fa_type;\n\tu_int32_t fa_mode;\n\tu_int32_t fa_nlink;\n\tu_int32_t fa_uid;\n\tu_int32_t fa_gid;\n\tunion {\n\t\tstruct {\n\t\t\tu_int32_t nfsv2fa_size;\n\t\t\tu_int32_t nfsv2fa_blocksize;\n\t\t\tu_int32_t nfsv2fa_rdev;\n\t\t\tu_int32_t nfsv2fa_blocks;\n\t\t\tu_int32_t nfsv2fa_fsid;\n\t\t\tu_int32_t nfsv2fa_fileid;\n\t\t\tnfstime2  nfsv2fa_atime;\n\t\t\tnfstime2  nfsv2fa_mtime;\n\t\t\tnfstime2  nfsv2fa_ctime;\n\t\t} fa_nfsv2;\n\t\tstruct {\n\t\t\tnfsuint64 nfsv3fa_size;\n\t\t\tnfsuint64 nfsv3fa_used;\n\t\t\tnfsv3spec nfsv3fa_rdev;\n\t\t\tnfsuint64 nfsv3fa_fsid;\n\t\t\tnfsuint64 nfsv3fa_fileid;\n\t\t\tnfstime3  nfsv3fa_atime;\n\t\t\tnfstime3  nfsv3fa_mtime;\n\t\t\tnfstime3  nfsv3fa_ctime;\n\t\t} fa_nfsv3;\n\t} fa_un;\n};\n\n/* and some ugly defines for accessing union components */\n#define\tfa2_size\t\tfa_un.fa_nfsv2.nfsv2fa_size\n#define\tfa2_blocksize\t\tfa_un.fa_nfsv2.nfsv2fa_blocksize\n#define\tfa2_rdev\t\tfa_un.fa_nfsv2.nfsv2fa_rdev\n#define\tfa2_blocks\t\tfa_un.fa_nfsv2.nfsv2fa_blocks\n#define\tfa2_fsid\t\tfa_un.fa_nfsv2.nfsv2fa_fsid\n#define\tfa2_fileid\t\tfa_un.fa_nfsv2.nfsv2fa_fileid\n#define\tfa2_atime\t\tfa_un.fa_nfsv2.nfsv2fa_atime\n#define\tfa2_mtime\t\tfa_un.fa_nfsv2.nfsv2fa_mtime\n#define\tfa2_ctime\t\tfa_un.fa_nfsv2.nfsv2fa_ctime\n#define\tfa3_size\t\tfa_un.fa_nfsv3.nfsv3fa_size\n#define\tfa3_used\t\tfa_un.fa_nfsv3.nfsv3fa_used\n#define\tfa3_rdev\t\tfa_un.fa_nfsv3.nfsv3fa_rdev\n#define\tfa3_fsid\t\tfa_un.fa_nfsv3.nfsv3fa_fsid\n#define\tfa3_fileid\t\tfa_un.fa_nfsv3.nfsv3fa_fileid\n#define\tfa3_atime\t\tfa_un.fa_nfsv3.nfsv3fa_atime\n#define\tfa3_mtime\t\tfa_un.fa_nfsv3.nfsv3fa_mtime\n#define\tfa3_ctime\t\tfa_un.fa_nfsv3.nfsv3fa_ctime\n\nstruct nfsv2_sattr {\n\tu_int32_t sa_mode;\n\tu_int32_t sa_uid;\n\tu_int32_t sa_gid;\n\tu_int32_t sa_size;\n\tnfstime2  sa_atime;\n\tnfstime2  sa_mtime;\n};\n\n/*\n * NFS Version 3 sattr structure for the new node creation case.\n */\nstruct nfsv3_sattr {\n\tu_int32_t sa_modetrue;\n\tu_int32_t sa_mode;\n\tu_int32_t sa_uidfalse;\n\tu_int32_t sa_gidfalse;\n\tu_int32_t sa_sizefalse;\n\tu_int32_t sa_atimetype;\n\tnfstime3  sa_atime;\n\tu_int32_t sa_mtimetype;\n\tnfstime3  sa_mtime;\n};\n\n/*\n * The attribute bits used for V4.\n * NFSATTRBIT_xxx defines the attribute# (and its bit position)\n * NFSATTRBM_xxx is a 32bit mask with the correct bit set within the\n *\tappropriate 32bit word.\n * NFSATTRBIT_MAX is one greater than the largest NFSATTRBIT_xxx\n */\n#define\tNFSATTRBIT_SUPPORTEDATTRS\t0\n#define\tNFSATTRBIT_TYPE\t\t\t1\n#define\tNFSATTRBIT_FHEXPIRETYPE\t\t2\n#define\tNFSATTRBIT_CHANGE\t\t3\n#define\tNFSATTRBIT_SIZE\t\t\t4\n#define\tNFSATTRBIT_LINKSUPPORT\t\t5\n#define\tNFSATTRBIT_SYMLINKSUPPORT\t6\n#define\tNFSATTRBIT_NAMEDATTR\t\t7\n#define\tNFSATTRBIT_FSID\t\t\t8\n#define\tNFSATTRBIT_UNIQUEHANDLES\t9\n#define\tNFSATTRBIT_LEASETIME\t\t10\n#define\tNFSATTRBIT_RDATTRERROR\t\t11\n#define\tNFSATTRBIT_ACL\t\t\t12\n#define\tNFSATTRBIT_ACLSUPPORT\t\t13\n#define\tNFSATTRBIT_ARCHIVE\t\t14\n#define\tNFSATTRBIT_CANSETTIME\t\t15\n#define\tNFSATTRBIT_CASEINSENSITIVE\t16\n#define\tNFSATTRBIT_CASEPRESERVING\t17\n#define\tNFSATTRBIT_CHOWNRESTRICTED\t18\n#define\tNFSATTRBIT_FILEHANDLE\t\t19\n#define\tNFSATTRBIT_FILEID\t\t20\n#define\tNFSATTRBIT_FILESAVAIL\t\t21\n#define\tNFSATTRBIT_FILESFREE\t\t22\n#define\tNFSATTRBIT_FILESTOTAL\t\t23\n#define\tNFSATTRBIT_FSLOCATIONS\t\t24\n#define\tNFSATTRBIT_HIDDEN\t\t25\n#define\tNFSATTRBIT_HOMOGENEOUS\t\t26\n#define\tNFSATTRBIT_MAXFILESIZE\t\t27\n#define\tNFSATTRBIT_MAXLINK\t\t28\n#define\tNFSATTRBIT_MAXNAME\t\t29\n#define\tNFSATTRBIT_MAXREAD\t\t30\n#define\tNFSATTRBIT_MAXWRITE\t\t31\n#define\tNFSATTRBIT_MIMETYPE\t\t32\n#define\tNFSATTRBIT_MODE\t\t\t33\n#define\tNFSATTRBIT_NOTRUNC\t\t34\n#define\tNFSATTRBIT_NUMLINKS\t\t35\n#define\tNFSATTRBIT_OWNER\t\t36\n#define\tNFSATTRBIT_OWNERGROUP\t\t37\n#define\tNFSATTRBIT_QUOTAHARD\t\t38\n#define\tNFSATTRBIT_QUOTASOFT\t\t39\n#define\tNFSATTRBIT_QUOTAUSED\t\t40\n#define\tNFSATTRBIT_RAWDEV\t\t41\n#define\tNFSATTRBIT_SPACEAVAIL\t\t42\n#define\tNFSATTRBIT_SPACEFREE\t\t43\n#define\tNFSATTRBIT_SPACETOTAL\t\t44\n#define\tNFSATTRBIT_SPACEUSED\t\t45\n#define\tNFSATTRBIT_SYSTEM\t\t46\n#define\tNFSATTRBIT_TIMEACCESS\t\t47\n#define\tNFSATTRBIT_TIMEACCESSSET\t48\n#define\tNFSATTRBIT_TIMEBACKUP\t\t49\n#define\tNFSATTRBIT_TIMECREATE\t\t50\n#define\tNFSATTRBIT_TIMEDELTA\t\t51\n#define\tNFSATTRBIT_TIMEMETADATA\t\t52\n#define\tNFSATTRBIT_TIMEMODIFY\t\t53\n#define\tNFSATTRBIT_TIMEMODIFYSET\t54\n#define\tNFSATTRBIT_MOUNTEDONFILEID\t55\n\n#define\tNFSATTRBM_SUPPORTEDATTRS\t0x00000001\n#define\tNFSATTRBM_TYPE\t\t\t0x00000002\n#define\tNFSATTRBM_FHEXPIRETYPE\t\t0x00000004\n#define\tNFSATTRBM_CHANGE\t\t0x00000008\n#define\tNFSATTRBM_SIZE\t\t\t0x00000010\n#define\tNFSATTRBM_LINKSUPPORT\t\t0x00000020\n#define\tNFSATTRBM_SYMLINKSUPPORT\t0x00000040\n#define\tNFSATTRBM_NAMEDATTR\t\t0x00000080\n#define\tNFSATTRBM_FSID\t\t\t0x00000100\n#define\tNFSATTRBM_UNIQUEHANDLES\t\t0x00000200\n#define\tNFSATTRBM_LEASETIME\t\t0x00000400\n#define\tNFSATTRBM_RDATTRERROR\t\t0x00000800\n#define\tNFSATTRBM_ACL\t\t\t0x00001000\n#define\tNFSATTRBM_ACLSUPPORT\t\t0x00002000\n#define\tNFSATTRBM_ARCHIVE\t\t0x00004000\n#define\tNFSATTRBM_CANSETTIME\t\t0x00008000\n#define\tNFSATTRBM_CASEINSENSITIVE\t0x00010000\n#define\tNFSATTRBM_CASEPRESERVING\t0x00020000\n#define\tNFSATTRBM_CHOWNRESTRICTED\t0x00040000\n#define\tNFSATTRBM_FILEHANDLE\t\t0x00080000\n#define\tNFSATTRBM_FILEID\t\t0x00100000\n#define\tNFSATTRBM_FILESAVAIL\t\t0x00200000\n#define\tNFSATTRBM_FILESFREE\t\t0x00400000\n#define\tNFSATTRBM_FILESTOTAL\t\t0x00800000\n#define\tNFSATTRBM_FSLOCATIONS\t\t0x01000000\n#define\tNFSATTRBM_HIDDEN\t\t0x02000000\n#define\tNFSATTRBM_HOMOGENEOUS\t\t0x04000000\n#define\tNFSATTRBM_MAXFILESIZE\t\t0x08000000\n#define\tNFSATTRBM_MAXLINK\t\t0x10000000\n#define\tNFSATTRBM_MAXNAME\t\t0x20000000\n#define\tNFSATTRBM_MAXREAD\t\t0x40000000\n#define\tNFSATTRBM_MAXWRITE\t\t0x80000000\n#define\tNFSATTRBM_MIMETYPE\t\t0x00000001\n#define\tNFSATTRBM_MODE\t\t\t0x00000002\n#define\tNFSATTRBM_NOTRUNC\t\t0x00000004\n#define\tNFSATTRBM_NUMLINKS\t\t0x00000008\n#define\tNFSATTRBM_OWNER\t\t\t0x00000010\n#define\tNFSATTRBM_OWNERGROUP\t\t0x00000020\n#define\tNFSATTRBM_QUOTAHARD\t\t0x00000040\n#define\tNFSATTRBM_QUOTASOFT\t\t0x00000080\n#define\tNFSATTRBM_QUOTAUSED\t\t0x00000100\n#define\tNFSATTRBM_RAWDEV\t\t0x00000200\n#define\tNFSATTRBM_SPACEAVAIL\t\t0x00000400\n#define\tNFSATTRBM_SPACEFREE\t\t0x00000800\n#define\tNFSATTRBM_SPACETOTAL\t\t0x00001000\n#define\tNFSATTRBM_SPACEUSED\t\t0x00002000\n#define\tNFSATTRBM_SYSTEM\t\t0x00004000\n#define\tNFSATTRBM_TIMEACCESS\t\t0x00008000\n#define\tNFSATTRBM_TIMEACCESSSET\t\t0x00010000\n#define\tNFSATTRBM_TIMEBACKUP\t\t0x00020000\n#define\tNFSATTRBM_TIMECREATE\t\t0x00040000\n#define\tNFSATTRBM_TIMEDELTA\t\t0x00080000\n#define\tNFSATTRBM_TIMEMETADATA\t\t0x00100000\n#define\tNFSATTRBM_TIMEMODIFY\t\t0x00200000\n#define\tNFSATTRBM_TIMEMODIFYSET\t\t0x00400000\n#define\tNFSATTRBM_MOUNTEDONFILEID\t0x00800000\n\n#define\tNFSATTRBIT_MAX\t\t\t56\n\n/*\n * Sets of attributes that are supported, by words in the bitmap.\n */\n/*\n * NFSATTRBIT_SUPPORTED - SUPP0 - bits 0<->31\n *\t\t\t  SUPP1 - bits 32<->63\n */\n#define\tNFSATTRBIT_SUPP0\t\t\t\t\t\t\\\n \t(NFSATTRBM_SUPPORTEDATTRS |\t\t\t\t\t\\\n \tNFSATTRBM_TYPE |\t\t\t\t\t\t\\\n \tNFSATTRBM_FHEXPIRETYPE |\t\t\t\t\t\\\n \tNFSATTRBM_CHANGE |\t\t\t\t\t\t\\\n \tNFSATTRBM_SIZE |\t\t\t\t\t\t\\\n \tNFSATTRBM_LINKSUPPORT |\t\t\t\t\t\t\\\n \tNFSATTRBM_SYMLINKSUPPORT |\t\t\t\t\t\\\n \tNFSATTRBM_NAMEDATTR |\t\t\t\t\t\t\\\n \tNFSATTRBM_FSID |\t\t\t\t\t\t\\\n \tNFSATTRBM_UNIQUEHANDLES |\t\t\t\t\t\\\n \tNFSATTRBM_LEASETIME |\t\t\t\t\t\t\\\n \tNFSATTRBM_RDATTRERROR |\t\t\t\t\t\t\\\n \tNFSATTRBM_ACL |\t\t\t\t\t\t\t\\\n \tNFSATTRBM_ACLSUPPORT |\t\t\t\t\t\t\\\n \tNFSATTRBM_CANSETTIME |\t\t\t\t\t\t\\\n \tNFSATTRBM_CASEINSENSITIVE |\t\t\t\t\t\\\n \tNFSATTRBM_CASEPRESERVING |\t\t\t\t\t\\\n \tNFSATTRBM_CHOWNRESTRICTED |\t\t\t\t\t\\\n \tNFSATTRBM_FILEHANDLE |\t\t\t\t\t\t\\\n \tNFSATTRBM_FILEID |\t\t\t\t\t\t\\\n \tNFSATTRBM_FILESAVAIL |\t\t\t\t\t\t\\\n \tNFSATTRBM_FILESFREE |\t\t\t\t\t\t\\\n \tNFSATTRBM_FILESTOTAL |\t\t\t\t\t\t\\\n\tNFSATTRBM_FSLOCATIONS |\t\t\t\t\t\t\\\n \tNFSATTRBM_HOMOGENEOUS |\t\t\t\t\t\t\\\n \tNFSATTRBM_MAXFILESIZE |\t\t\t\t\t\t\\\n \tNFSATTRBM_MAXLINK |\t\t\t\t\t\t\\\n \tNFSATTRBM_MAXNAME |\t\t\t\t\t\t\\\n \tNFSATTRBM_MAXREAD |\t\t\t\t\t\t\\\n \tNFSATTRBM_MAXWRITE)\n\n/*\n * NFSATTRBIT_S1 - subset of SUPP1 - OR of the following bits:\n */\n#define\tNFSATTRBIT_S1\t\t\t\t\t\t\t\\\n \t(NFSATTRBM_MODE |\t\t\t\t\t\t\\\n \tNFSATTRBM_NOTRUNC |\t\t\t\t\t\t\\\n \tNFSATTRBM_NUMLINKS |\t\t\t\t\t\t\\\n \tNFSATTRBM_OWNER |\t\t\t\t\t\t\\\n \tNFSATTRBM_OWNERGROUP |\t\t\t\t\t\t\\\n \tNFSATTRBM_RAWDEV |\t\t\t\t\t\t\\\n \tNFSATTRBM_SPACEAVAIL |\t\t\t\t\t\t\\\n \tNFSATTRBM_SPACEFREE |\t\t\t\t\t\t\\\n \tNFSATTRBM_SPACETOTAL |\t\t\t\t\t\t\\\n \tNFSATTRBM_SPACEUSED |\t\t\t\t\t\t\\\n \tNFSATTRBM_TIMEACCESS |\t\t\t\t\t\t\\\n \tNFSATTRBM_TIMEDELTA |\t\t\t\t\t\t\\\n \tNFSATTRBM_TIMEMETADATA |\t\t\t\t\t\\\n \tNFSATTRBM_TIMEMODIFY |\t\t\t\t\t\t\\\n \tNFSATTRBM_MOUNTEDONFILEID)\n\n#ifdef QUOTA\n/*\n * If QUOTA OR in NFSATTRBIT_QUOTAHARD, NFSATTRBIT_QUOTASOFT and\n * NFSATTRBIT_QUOTAUSED.\n */\n#define\tNFSATTRBIT_SUPP1\t(NFSATTRBIT_S1 |\t\t\t\\\n\t\t\t\tNFSATTRBM_QUOTAHARD |\t\t\t\\\n\t\t\t\tNFSATTRBM_QUOTASOFT |\t\t\t\\\n\t\t\t\tNFSATTRBM_QUOTAUSED)\n#else\n#define\tNFSATTRBIT_SUPP1\tNFSATTRBIT_S1\n#endif\n\n/*\n * NFSATTRBIT_SUPPSETONLY is the OR of NFSATTRBIT_TIMEACCESSSET and\n * NFSATTRBIT_TIMEMODIFYSET.\n */\n#define\tNFSATTRBIT_SUPPSETONLY\t (NFSATTRBM_TIMEACCESSSET |\t\t\\\n\t\t\t\t NFSATTRBM_TIMEMODIFYSET)\n\n/*\n * NFSATTRBIT_SETABLE - SETABLE0 - bits 0<->31\n *\t\t\tSETABLE1 - bits 32<->63\n */\n#define\tNFSATTRBIT_SETABLE0\t\t\t\t\t\t\\\n\t(NFSATTRBM_SIZE |\t\t\t\t\t\t\\\n\tNFSATTRBM_ACL)\n#define\tNFSATTRBIT_SETABLE1\t\t\t\t\t\t\\\n \t(NFSATTRBM_MODE |\t\t\t\t\t\t\\\n \tNFSATTRBM_OWNER |\t\t\t\t\t\t\\\n \tNFSATTRBM_OWNERGROUP |\t\t\t\t\t\t\\\n \tNFSATTRBM_TIMEACCESSSET |\t\t\t\t\t\\\n \tNFSATTRBM_TIMEMODIFYSET)\n\n/*\n * Set of attributes that the getattr vnode op needs.\n * OR of the following bits.\n * NFSATTRBIT_GETATTR0 - bits 0<->31\n */\n#define\tNFSATTRBIT_GETATTR0\t\t\t\t\t\t\\\n \t(NFSATTRBM_SUPPORTEDATTRS |\t\t\t\t\t\\\n \tNFSATTRBM_TYPE |\t\t\t\t\t\t\\\n \tNFSATTRBM_CHANGE |\t\t\t\t\t\t\\\n \tNFSATTRBM_SIZE |\t\t\t\t\t\t\\\n \tNFSATTRBM_FSID |\t\t\t\t\t\t\\\n \tNFSATTRBM_FILEID |\t\t\t\t\t\t\\\n \tNFSATTRBM_MAXREAD)\n\n/*\n * NFSATTRBIT_GETATTR1 - bits 32<->63\n */\n#define\tNFSATTRBIT_GETATTR1\t\t\t\t\t\t\\\n \t(NFSATTRBM_MODE |\t\t\t\t\t\t\\\n \tNFSATTRBM_NUMLINKS |\t\t\t\t\t\t\\\n \tNFSATTRBM_OWNER |\t\t\t\t\t\t\\\n \tNFSATTRBM_OWNERGROUP |\t\t\t\t\t\t\\\n \tNFSATTRBM_RAWDEV |\t\t\t\t\t\t\\\n \tNFSATTRBM_SPACEUSED |\t\t\t\t\t\t\\\n \tNFSATTRBM_TIMEACCESS |\t\t\t\t\t\t\\\n \tNFSATTRBM_TIMEMETADATA |\t\t\t\t\t\\\n \tNFSATTRBM_TIMEMODIFY)\n\n/*\n * Subset of the above that the Write RPC gets.\n * OR of the following bits.\n * NFSATTRBIT_WRITEGETATTR0 - bits 0<->31\n */\n#define\tNFSATTRBIT_WRITEGETATTR0\t\t\t\t\t\\\n \t(NFSATTRBM_SUPPORTEDATTRS |\t\t\t\t\t\\\n \tNFSATTRBM_TYPE |\t\t\t\t\t\t\\\n \tNFSATTRBM_CHANGE |\t\t\t\t\t\t\\\n \tNFSATTRBM_SIZE |\t\t\t\t\t\t\\\n \tNFSATTRBM_FSID |\t\t\t\t\t\t\\\n \tNFSATTRBM_FILEID |\t\t\t\t\t\t\\\n \tNFSATTRBM_MAXREAD)\n\n/*\n * NFSATTRBIT_WRITEGETATTR1 - bits 32<->63\n */\n#define\tNFSATTRBIT_WRITEGETATTR1\t\t\t\t\t\\\n \t(NFSATTRBM_MODE |\t\t\t\t\t\t\\\n \tNFSATTRBM_NUMLINKS |\t\t\t\t\t\t\\\n \tNFSATTRBM_RAWDEV |\t\t\t\t\t\t\\\n \tNFSATTRBM_SPACEUSED |\t\t\t\t\t\t\\\n \tNFSATTRBM_TIMEACCESS |\t\t\t\t\t\t\\\n \tNFSATTRBM_TIMEMETADATA |\t\t\t\t\t\\\n \tNFSATTRBM_TIMEMODIFY)\n\n/*\n * Set of attributes that the wccattr operation op needs.\n * OR of the following bits.\n * NFSATTRBIT_WCCATTR0 - bits 0<->31\n */\n#define\tNFSATTRBIT_WCCATTR0\t0\n\n/*\n * NFSATTRBIT_WCCATTR1 - bits 32<->63\n */\n#define\tNFSATTRBIT_WCCATTR1\t\t\t\t\t\t\\\n \t(NFSATTRBM_TIMEMODIFY)\n\n/*\n * NFSATTRBIT_CBGETATTR0 - bits 0<->31\n */\n#define\tNFSATTRBIT_CBGETATTR0\t(NFSATTRBM_CHANGE | NFSATTRBM_SIZE)\n\n/*\n * NFSATTRBIT_CBGETATTR1 - bits 32<->63\n */\n#define\tNFSATTRBIT_CBGETATTR1\t\t0x0\n\n/*\n * Sets of attributes that require a VFS_STATFS() call to get the\n * values of.\n * NFSATTRBIT_STATFS0 - bits 0<->31\n */\n#define\tNFSATTRBIT_STATFS0\t\t\t\t\t\t\\\n\t(NFSATTRBM_LINKSUPPORT |\t\t\t\t\t\\\n\tNFSATTRBM_SYMLINKSUPPORT |\t\t\t\t\t\\\n\tNFSATTRBM_CANSETTIME |\t\t\t\t\t\t\\\n \tNFSATTRBM_FILESAVAIL |\t\t\t\t\t\t\\\n \tNFSATTRBM_FILESFREE |\t\t\t\t\t\t\\\n \tNFSATTRBM_FILESTOTAL |\t\t\t\t\t\t\\\n \tNFSATTRBM_HOMOGENEOUS |\t\t\t\t\t\t\\\n \tNFSATTRBM_MAXFILESIZE |\t\t\t\t\t\t\\\n\tNFSATTRBM_MAXNAME |\t\t\t\t\t\t\\\n\tNFSATTRBM_MAXREAD |\t\t\t\t\t\t\\\n\tNFSATTRBM_MAXWRITE)\n\n/*\n * NFSATTRBIT_STATFS1 - bits 32<->63\n */\n#define\tNFSATTRBIT_STATFS1\t\t\t\t\t\t\\\n \t(NFSATTRBM_QUOTAHARD |\t\t\t\t\t\t\\\n \tNFSATTRBM_QUOTASOFT |\t\t\t\t\t\t\\\n \tNFSATTRBM_QUOTAUSED |\t\t\t\t\t\t\\\n \tNFSATTRBM_SPACEAVAIL |\t\t\t\t\t\t\\\n \tNFSATTRBM_SPACEFREE |\t\t\t\t\t\t\\\n \tNFSATTRBM_SPACETOTAL |\t\t\t\t\t\t\\\n \tNFSATTRBM_SPACEUSED |\t\t\t\t\t\t\\\n\tNFSATTRBM_TIMEDELTA)\n\n/*\n * These are the bits that are needed by the nfs_statfs() call.\n * (The regular getattr bits are or'd in so the vnode gets the correct\n *  type, etc.)\n * NFSGETATTRBIT_STATFS0 - bits 0<->31\n */\n#define\tNFSGETATTRBIT_STATFS0\t(NFSATTRBIT_GETATTR0 |\t\t\t\\\n\t\t\t\tNFSATTRBM_LINKSUPPORT |\t\t\t\\\n\t\t\t\tNFSATTRBM_SYMLINKSUPPORT |\t\t\\\n\t\t\t\tNFSATTRBM_CANSETTIME |\t\t\t\\\n\t\t\t\tNFSATTRBM_FILESFREE |\t\t\t\\\n\t\t\t\tNFSATTRBM_FILESTOTAL |\t\t\t\\\n\t\t\t\tNFSATTRBM_HOMOGENEOUS |\t\t\t\\\n\t\t\t\tNFSATTRBM_MAXFILESIZE |\t\t\t\\\n\t\t\t\tNFSATTRBM_MAXNAME |\t\t\t\\\n\t\t\t\tNFSATTRBM_MAXREAD |\t\t\t\\\n\t\t\t\tNFSATTRBM_MAXWRITE)\n\n/*\n * NFSGETATTRBIT_STATFS1 - bits 32<->63\n */\n#define\tNFSGETATTRBIT_STATFS1\t(NFSATTRBIT_GETATTR1 |\t\t\t\\\n\t\t\t\tNFSATTRBM_SPACEAVAIL |\t\t\t\\\n\t\t\t\tNFSATTRBM_SPACEFREE |\t\t\t\\\n\t\t\t\tNFSATTRBM_SPACETOTAL |\t\t\t\\\n\t\t\t\tNFSATTRBM_TIMEDELTA)\n\n/*\n * Set of attributes for the equivalent of an nfsv3 pathconf rpc.\n * NFSGETATTRBIT_PATHCONF0 - bits 0<->31\n */\n#define\tNFSGETATTRBIT_PATHCONF0\t(NFSATTRBIT_GETATTR0 |\t\t\t\\\n\t\t\t \tNFSATTRBM_CASEINSENSITIVE |\t\t\\\n\t\t\t \tNFSATTRBM_CASEPRESERVING |\t\t\\\n\t\t\t \tNFSATTRBM_CHOWNRESTRICTED |\t\t\\\n\t\t\t \tNFSATTRBM_MAXLINK |\t\t\t\\\n\t\t\t \tNFSATTRBM_MAXNAME)\n\n/*\n * NFSGETATTRBIT_PATHCONF1 - bits 32<->63\n */\n#define\tNFSGETATTRBIT_PATHCONF1\t(NFSATTRBIT_GETATTR1 |\t\t\t\\\n\t\t\t\tNFSATTRBM_NOTRUNC)\n\n/*\n * Sets of attributes required by readdir and readdirplus.\n * NFSATTRBIT_READDIRPLUS0\t(NFSATTRBIT_GETATTR0 | NFSATTRBIT_FILEHANDLE |\n *\t\t\t\t NFSATTRBIT_RDATTRERROR)\n */\n#define\tNFSATTRBIT_READDIRPLUS0\t(NFSATTRBIT_GETATTR0 | NFSATTRBM_FILEHANDLE | \\\n\t\t\t\tNFSATTRBM_RDATTRERROR)\n#define\tNFSATTRBIT_READDIRPLUS1\tNFSATTRBIT_GETATTR1\n\n/*\n * Set of attributes supported by Referral vnodes.\n */\n#define\tNFSATTRBIT_REFERRAL0\t(NFSATTRBM_TYPE | NFSATTRBM_FSID |\t\\\n\tNFSATTRBM_RDATTRERROR | NFSATTRBM_FSLOCATIONS)\n#define\tNFSATTRBIT_REFERRAL1\tNFSATTRBM_MOUNTEDONFILEID\n\n/*\n * Structure for data handled by the statfs rpc. Since some fields are\n * u_int64_t, this cannot be used for copying data on/off the wire, due\n * to alignment concerns.\n */\nstruct nfsstatfs {\n\tunion {\n\t\tstruct {\n\t\t\tu_int32_t nfsv2sf_tsize;\n\t\t\tu_int32_t nfsv2sf_bsize;\n\t\t\tu_int32_t nfsv2sf_blocks;\n\t\t\tu_int32_t nfsv2sf_bfree;\n\t\t\tu_int32_t nfsv2sf_bavail;\n\t\t} sf_nfsv2;\n\t\tstruct {\n\t\t\tu_int64_t nfsv3sf_tbytes;\n\t\t\tu_int64_t nfsv3sf_fbytes;\n\t\t\tu_int64_t nfsv3sf_abytes;\n\t\t\tu_int64_t nfsv3sf_tfiles;\n\t\t\tu_int64_t nfsv3sf_ffiles;\n\t\t\tu_int64_t nfsv3sf_afiles;\n\t\t\tu_int32_t nfsv3sf_invarsec;\n\t\t} sf_nfsv3;\n\t} sf_un;\n};\n\n#define\tsf_tsize\tsf_un.sf_nfsv2.nfsv2sf_tsize\n#define\tsf_bsize\tsf_un.sf_nfsv2.nfsv2sf_bsize\n#define\tsf_blocks\tsf_un.sf_nfsv2.nfsv2sf_blocks\n#define\tsf_bfree\tsf_un.sf_nfsv2.nfsv2sf_bfree\n#define\tsf_bavail\tsf_un.sf_nfsv2.nfsv2sf_bavail\n#define\tsf_tbytes\tsf_un.sf_nfsv3.nfsv3sf_tbytes\n#define\tsf_fbytes\tsf_un.sf_nfsv3.nfsv3sf_fbytes\n#define\tsf_abytes\tsf_un.sf_nfsv3.nfsv3sf_abytes\n#define\tsf_tfiles\tsf_un.sf_nfsv3.nfsv3sf_tfiles\n#define\tsf_ffiles\tsf_un.sf_nfsv3.nfsv3sf_ffiles\n#define\tsf_afiles\tsf_un.sf_nfsv3.nfsv3sf_afiles\n#define\tsf_invarsec\tsf_un.sf_nfsv3.nfsv3sf_invarsec\n\n/*\n * Now defined using u_int64_t for the 64 bit field(s).\n * (Cannot be used to move data on/off the wire, due to alignment concerns.)\n */\nstruct nfsfsinfo {\n\tu_int32_t fs_rtmax;\n\tu_int32_t fs_rtpref;\n\tu_int32_t fs_rtmult;\n\tu_int32_t fs_wtmax;\n\tu_int32_t fs_wtpref;\n\tu_int32_t fs_wtmult;\n\tu_int32_t fs_dtpref;\n\tu_int64_t fs_maxfilesize;\n\tstruct timespec fs_timedelta;\n\tu_int32_t fs_properties;\n};\n\n/*\n * Bits for fs_properties\n */\n#define\tNFSV3_FSFLINK\t\t0x1\n#define\tNFSV3_FSFSYMLINK\t0x2\n#define\tNFSV3_FSFHOMOGENEOUS\t0x4\n#define\tNFSV3_FSFCANSETTIME\t0x8\n\n/*\n * Yikes, overload fs_rtmult as fs_maxname for V4.\n */\n#define\tfs_maxname\tfs_rtmult\n\nstruct nfsv3_pathconf {\n\tu_int32_t pc_linkmax;\n\tu_int32_t pc_namemax;\n\tu_int32_t pc_notrunc;\n\tu_int32_t pc_chownrestricted;\n\tu_int32_t pc_caseinsensitive;\n\tu_int32_t pc_casepreserving;\n};\n\n/*\n * NFS V4 data structures.\n */\nstruct nfsv4stateid {\n\tu_int32_t\tseqid;\n\tu_int32_t\tother[NFSX_STATEIDOTHER / NFSX_UNSIGNED];\n};\ntypedef struct nfsv4stateid nfsv4stateid_t;\n\n#endif\t/* _NFS_NFSPROTO_H_ */\n"
  },
  {
    "path": "freebsd-headers/fs/nfs/nfsrvcache.h",
    "content": "/*-\n * Copyright (c) 1989, 1993\n *\tThe Regents of the University of California.  All rights reserved.\n *\n * This code is derived from software contributed to Berkeley by\n * Rick Macklem at The University of Guelph.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 4. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/fs/nfs/nfsrvcache.h 191783 2009-05-04 15:23:58Z rmacklem $\n */\n\n#ifndef _NFS_NFSRVCACHE_H_\n#define\t_NFS_NFSRVCACHE_H_\n\n/*\n * Definitions for the server recent request cache\n */\n#define\tNFSRVCACHE_MAX_SIZE\t2048\n#define\tNFSRVCACHE_MIN_SIZE\t  64\n\n#define\tNFSRVCACHE_HASHSIZE\t20\n\nstruct nfsrvcache {\n\tLIST_ENTRY(nfsrvcache) rc_hash;\t\t/* Hash chain */\n\tTAILQ_ENTRY(nfsrvcache)\trc_lru;\t\t/* UDP lru chain */\n\tu_int32_t\trc_xid;\t\t\t/* rpc id number */\n\ttime_t\t\trc_timestamp;\t\t/* Time done */\n\tunion {\n\t\tmbuf_t repmb;\t\t\t/* Reply mbuf list OR */\n\t\tint repstat;\t\t\t/* Reply status */\n\t} rc_un;\n\tunion {\n\t\tstruct {\n\t\t\tunion nethostaddr haddr; /* Host address */\n\t\t} udp;\n\t\tstruct {\n\t\t\tu_int64_t\tsockref;\n\t\t\tu_int32_t\tlen;\n\t\t\tu_int32_t\ttcpseq;\n\t\t\tint16_t\t\trefcnt;\n\t\t\tu_int16_t\tcksum;\n\t\t\ttime_t\t\tcachetime;\n\t\t} ot;\n\t} rc_un2;\n\tu_int16_t\trc_proc;\t\t/* rpc proc number */\n\tu_int16_t\trc_flag;\t\t/* Flag bits */\n};\n\n#define\trc_reply\trc_un.repmb\n#define\trc_status\trc_un.repstat\n#define\trc_inet\t\trc_un2.udp.haddr.had_inet.s_addr\n#define\trc_inet6\trc_un2.udp.haddr.had_inet6\n#define\trc_haddr\trc_un2.udp.haddr\n#define\trc_sockref\trc_un2.ot.sockref\n#define\trc_tcpseq\trc_un2.ot.tcpseq\n#define\trc_refcnt\trc_un2.ot.refcnt\n#define\trc_reqlen\trc_un2.ot.len\n#define\trc_cksum\trc_un2.ot.cksum\n#define\trc_cachetime\trc_un2.ot.cachetime\n\n/* Return values */\n#define\tRC_DROPIT\t\t0\n#define\tRC_REPLY\t\t1\n#define\tRC_DOIT\t\t\t2\n\n/* Flag bits */\n#define\tRC_LOCKED\t0x0001\n#define\tRC_WANTED\t0x0002\n#define\tRC_REPSTATUS\t0x0004\n#define\tRC_REPMBUF\t0x0008\n#define\tRC_UDP\t\t0x0010\n#define\tRC_INETIPV6\t0x0020\n#define\tRC_INPROG\t0x0040\n#define\tRC_TCPSEQ\t0x0080\n#define\tRC_NFSV2\t0x0100\n#define\tRC_NFSV3\t0x0200\n#define\tRC_NFSV4\t0x0400\n#define\tRC_NFSVERS\t(RC_NFSV2 | RC_NFSV3 | RC_NFSV4)\n#define\tRC_REFCNT\t0x0800\n#define\tRC_SAMETCPCONN\t0x1000\n\nLIST_HEAD(nfsrvhashhead, nfsrvcache);\n\n#endif\t/* _NFS_NFSRVCACHE_H_ */\n"
  },
  {
    "path": "freebsd-headers/fs/nfs/nfsrvstate.h",
    "content": "/*-\n * Copyright (c) 2009 Rick Macklem, University of Guelph\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/fs/nfs/nfsrvstate.h 205941 2010-03-30 23:11:50Z rmacklem $\n */\n\n#ifndef _NFS_NFSRVSTATE_H_\n#define\t_NFS_NFSRVSTATE_H_\n\n/*\n * Definitions for NFS V4 server state handling.\n */\n\n/*\n * List heads for nfsclient, nfsstate and nfslockfile.\n * (Some systems seem to like to dynamically size these things, but I\n *  don't see any point in doing so for these ones.)\n */\nLIST_HEAD(nfsclienthashhead, nfsclient);\nLIST_HEAD(nfsstatehead, nfsstate);\nLIST_HEAD(nfslockhead, nfslock);\nLIST_HEAD(nfslockhashhead, nfslockfile);\n\n/*\n * List head for nfsusrgrp.\n */\nLIST_HEAD(nfsuserhashhead, nfsusrgrp);\nTAILQ_HEAD(nfsuserlruhead, nfsusrgrp);\n\n#define\tNFSCLIENTHASH(id)\t\t\t\t\t\t\\\n\t(&nfsclienthash[(id).lval[1] % NFSCLIENTHASHSIZE])\n#define\tNFSSTATEHASH(clp, id)\t\t\t\t\t\t\\\n\t(&((clp)->lc_stateid[(id).other[2] % NFSSTATEHASHSIZE]))\n#define\tNFSUSERHASH(id)\t\t\t\t\t\t\t\\\n\t(&nfsuserhash[(id) % NFSUSERHASHSIZE])\n#define\tNFSUSERNAMEHASH(p, l)\t\t\t\t\t\t\\\n\t(&nfsusernamehash[((l)>=4?(*(p)+*((p)+1)+*((p)+2)+*((p)+3)):*(p)) \\\n\t\t% NFSUSERHASHSIZE])\n#define\tNFSGROUPHASH(id)\t\t\t\t\t\t\\\n\t(&nfsgrouphash[(id) % NFSGROUPHASHSIZE])\n#define\tNFSGROUPNAMEHASH(p, l)\t\t\t\t\t\t\\\n\t(&nfsgroupnamehash[((l)>=4?(*(p)+*((p)+1)+*((p)+2)+*((p)+3)):*(p)) \\\n\t\t% NFSGROUPHASHSIZE])\n\n/*\n * Client server structure for V4. It is doubly linked into two lists.\n * The first is a hash table based on the clientid and the second is a\n * list of all clients maintained in LRU order.\n * The actual size malloc'd is large enough to accomodate the id string.\n */\nstruct nfsclient {\n\tLIST_ENTRY(nfsclient) lc_hash;\t\t/* Clientid hash list */\n\tstruct nfsstatehead lc_stateid[NFSSTATEHASHSIZE]; /* stateid hash */\n\tstruct nfsstatehead lc_open;\t\t/* Open owner list */\n\tstruct nfsstatehead lc_deleg;\t\t/* Delegations */\n\tstruct nfsstatehead lc_olddeleg;\t/* and old delegations */\n\ttime_t\t\tlc_expiry;\t\t/* Expiry time (sec) */\n\ttime_t\t\tlc_delegtime;\t\t/* Old deleg expiry (sec) */\n\tnfsquad_t\tlc_clientid;\t\t/* 64 bit clientid */\n\tnfsquad_t\tlc_confirm;\t\t/* 64 bit confirm value */\n\tu_int32_t\tlc_program;\t\t/* RPC Program # */\n\tu_int32_t\tlc_callback;\t\t/* Callback id */\n\tu_int32_t\tlc_stateindex;\t\t/* Current state index# */\n\tu_int32_t\tlc_statemaxindex;\t/* Max state index# */\n\tu_int32_t\tlc_cbref;\t\t/* Cnt of callbacks */\n\tuid_t\t\tlc_uid;\t\t\t/* User credential */\n\tgid_t\t\tlc_gid;\n\tu_int16_t\tlc_namelen;\n\tu_char\t\t*lc_name;\n\tstruct nfssockreq lc_req;\t\t/* Callback info */\n\tu_short\t\tlc_idlen;\t\t/* Length of id string */\n\tu_int32_t\tlc_flags;\t\t/* LCL_ flag bits */\n\tu_char\t\tlc_verf[NFSX_VERF];\t /* client verifier */\n\tu_char\t\tlc_id[1];\t\t/* Malloc'd correct size */\n};\n\n#define\tCLOPS_CONFIRM\t\t0x0001\n#define\tCLOPS_RENEW\t\t0x0002\n#define\tCLOPS_RENEWOP\t\t0x0004\n\n/*\n * Nfs state structure. I couldn't resist overloading this one, since\n * it makes cleanup, etc. simpler. These structures are used in four ways:\n * - open_owner structures chained off of nfsclient\n * - open file structures chained off an open_owner structure\n * - lock_owner structures chained off an open file structure\n * - delegated file structures chained off of nfsclient and nfslockfile\n * - the ls_list field is used for the chain it is in\n * - the ls_head structure is used to chain off the sibling structure\n *   (it is a union between an nfsstate and nfslock structure head)\n *    If it is a lockowner stateid, nfslock structures hang off it.\n * For the open file and lockowner cases, it is in the hash table in\n * nfsclient for stateid.\n */\nstruct nfsstate {\n\tLIST_ENTRY(nfsstate)\tls_hash;\t/* Hash list entry */\n\tLIST_ENTRY(nfsstate)\tls_list;\t/* List of opens/delegs */\n\tLIST_ENTRY(nfsstate)\tls_file;\t/* Opens/Delegs for a file */\n\tunion {\n\t\tstruct nfsstatehead\topen; /* Opens list */\n\t\tstruct nfslockhead\tlock; /* Locks list */\n\t} ls_head;\n\tnfsv4stateid_t\t\tls_stateid;\t/* The state id */\n\tu_int32_t\t\tls_seq;\t\t/* seq id */\n\tuid_t\t\t\tls_uid;\t\t/* uid of locker */\n\tu_int32_t\t\tls_flags;\t/* Type of lock, etc. */\n\tunion {\n\t\tstruct nfsstate\t*openowner;\t/* Open only */\n\t\tu_int32_t\topentolockseq;\t/* Lock call only */\n\t\tu_int32_t\tnoopens;\t/* Openowner only */\n\t\tstruct {\n\t\t\tu_quad_t\tfilerev; /* Delegations only */\n\t\t\ttime_t\t\texpiry;\n\t\t\ttime_t\t\tlimit;\n\t\t\tu_int64_t\tcompref;\n\t\t} deleg;\n\t} ls_un;\n\tstruct nfslockfile\t*ls_lfp;\t/* Back pointer */\n\tstruct nfsrvcache\t*ls_op;\t\t/* Op cache reference */\n\tstruct nfsclient\t*ls_clp;\t/* Back pointer */\n\tu_short\t\t\tls_ownerlen;\t/* Length of ls_owner */\n\tu_char\t\t\tls_owner[1];\t/* malloc'd the correct size */\n};\n#define\tls_lock\t\t\tls_head.lock\n#define\tls_open\t\t\tls_head.open\n#define\tls_opentolockseq\tls_un.opentolockseq\n#define\tls_openowner\t\tls_un.openowner\n#define\tls_openstp\t\tls_un.openowner\n#define\tls_noopens\t\tls_un.noopens\n#define\tls_filerev\t\tls_un.deleg.filerev\n#define\tls_delegtime\t\tls_un.deleg.expiry\n#define\tls_delegtimelimit\tls_un.deleg.limit\n#define\tls_compref\t\tls_un.deleg.compref\n\n/*\n * Nfs lock structure.\n * This structure is chained off of the nfsstate (the lockowner) and\n * nfslockfile (the file) structures, for the file and owner it\n * refers to. It holds flags and a byte range.\n * It also has back pointers to the associated lock_owner and lockfile.\n */\nstruct nfslock {\n\tLIST_ENTRY(nfslock)\tlo_lckowner;\n\tLIST_ENTRY(nfslock)\tlo_lckfile;\n\tstruct nfsstate\t\t*lo_stp;\n\tstruct nfslockfile\t*lo_lfp;\n\tu_int64_t\t\tlo_first;\n\tu_int64_t\t\tlo_end;\n\tu_int32_t\t\tlo_flags;\n};\n\n/*\n * Structure used to return a conflicting lock. (Must be large\n * enough for the largest lock owner we can have.)\n */\nstruct nfslockconflict {\n\tnfsquad_t\t\tcl_clientid;\n\tu_int64_t\t\tcl_first;\n\tu_int64_t\t\tcl_end;\n\tu_int32_t\t\tcl_flags;\n\tu_short\t\t\tcl_ownerlen;\n\tu_char\t\t\tcl_owner[NFSV4_OPAQUELIMIT];\n};\n\n/*\n * This structure is used to keep track of local locks that might need\n * to be rolled back.\n */\nstruct nfsrollback {\n\tLIST_ENTRY(nfsrollback)\trlck_list;\n\tuint64_t\t\trlck_first;\n\tuint64_t\t\trlck_end;\n\tint\t\t\trlck_type;\n};\n\n/*\n * This structure refers to a file for which lock(s) and/or open(s) exist.\n * Searched via hash table on file handle or found via the back pointer from an\n * open or lock owner.\n */\nstruct nfslockfile {\n\tLIST_HEAD(, nfsstate)\tlf_open;\t/* Open list */\n\tLIST_HEAD(, nfsstate)\tlf_deleg;\t/* Delegation list */\n\tLIST_HEAD(, nfslock)\tlf_lock;\t/* Lock list */\n\tLIST_HEAD(, nfslock)\tlf_locallock;\t/* Local lock list */\n\tLIST_HEAD(, nfsrollback) lf_rollback;\t/* Local lock rollback list */\n\tLIST_ENTRY(nfslockfile)\tlf_hash;\t/* Hash list entry */\n\tfhandle_t\t\tlf_fh;\t\t/* The file handle */\n\tstruct nfsv4lock\tlf_locallock_lck; /* serialize local locking */\n\tint\t\t\tlf_usecount;\t/* Ref count for locking */\n};\n\n/*\n * This structure is malloc'd an chained off hash lists for user/group\n * names.\n */\nstruct nfsusrgrp {\n\tTAILQ_ENTRY(nfsusrgrp)\tlug_lru;\t/* LRU list */\n\tLIST_ENTRY(nfsusrgrp)\tlug_numhash;\t/* Hash by id# */\n\tLIST_ENTRY(nfsusrgrp)\tlug_namehash;\t/* and by name */\n\ttime_t\t\t\tlug_expiry;\t/* Expiry time in sec */\n\tunion {\n\t\tuid_t\t\tun_uid;\t\t/* id# */\n\t\tgid_t\t\tun_gid;\n\t} lug_un;\n\tint\t\t\tlug_namelen;\t/* Name length */\n\tu_char\t\t\tlug_name[1];\t/* malloc'd correct length */\n};\n#define\tlug_uid\t\tlug_un.un_uid\n#define\tlug_gid\t\tlug_un.un_gid\n\n/*\n * These structures are used for the stable storage restart stuff.\n */\n/*\n * Record at beginning of file.\n */\nstruct nfsf_rec {\n\tu_int32_t\tlease;\t\t\t/* Lease duration */\n\tu_int32_t\tnumboots;\t\t/* Number of boottimes */\n};\n\n#if defined(_KERNEL) || defined(KERNEL)\nvoid nfsrv_cleanclient(struct nfsclient *, NFSPROC_T *);\nvoid nfsrv_freedeleglist(struct nfsstatehead *);\n#endif\n\n#endif\t/* _NFS_NFSRVSTATE_H_ */\n"
  },
  {
    "path": "freebsd-headers/fs/nfs/nfsv4_errstr.h",
    "content": "/*-\n * Copyright (c) 2009 Rick Macklem, University of Guelph\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/fs/nfs/nfsv4_errstr.h 191783 2009-05-04 15:23:58Z rmacklem $\n */\n\n#ifndef _NFS_NFSV4ERRSTR_H_\n#define\t_NFS_NFSV4ERRSTR_H_\n\n/*\n * Defines static storage in the C file, but I can't be bothered creating\n * a library of one function for this, since it is only currently used by\n * mount_newnfs.c.\n */\nstatic const char *nfsv4_errstr[48] = {\n\t\"Illegal filehandle\",\n\t\"Undefined NFSv4 err\",\n\t\"READDIR cookie is stale\",\n\t\"operation not supported\",\n\t\"response limit exceeded\",\n\t\"undefined server error\",\n\t\"type invalid for CREATE\",\n\t\"file busy - retry\",\n\t\"nverify says attrs same\",\n\t\"lock unavailable\",\n\t\"lock lease expired\",\n\t\"I/O failed due to lock\",\n\t\"in grace period\",\n\t\"filehandle expired\",\n\t\"share reserve denied\",\n\t\"wrong security flavor\",\n\t\"clientid in use\",\n\t\"resource exhaustion\",\n\t\"filesystem relocated\",\n\t\"current FH is not set\",\n\t\"minor vers not supp\",\n\t\"server has rebooted\",\n\t\"server has rebooted\",\n\t\"state is out of sync\",\n\t\"incorrect stateid\",\n\t\"request is out of seq\",\n\t\"verify - attrs not same\",\n\t\"lock range not supported\",\n\t\"should be file/directory\",\n\t\"no saved filehandle\",\n\t\"some filesystem moved\",\n\t\"recommended attr not sup\",\n\t\"reclaim outside of grace\",\n\t\"reclaim error at server\",\n\t\"conflict on reclaim\",\n\t\"XDR decode failed\",\n\t\"file locks held at CLOSE\",\n\t\"conflict in OPEN and I/O\",\n\t\"owner translation bad\",\n\t\"utf-8 char not supported\",\n\t\"name not supported\",\n\t\"lock range not supported\",\n\t\"no atomic up/downgrade\",\n\t\"undefined operation\",\n\t\"file locking deadlock\",\n\t\"open file blocks op\",\n\t\"lockowner state revoked\",\n\t\"callback path down\"\n};\n\n/*\n * Return the error string for the NFS4ERR_xxx. The pointers returned are\n * static and must not be free'd.\n */\nstatic const char *\nnfsv4_geterrstr(int errval)\n{\n\n\tif (errval < NFSERR_BADHANDLE || errval > NFSERR_CBPATHDOWN)\n\t\treturn (NULL);\n\treturn (nfsv4_errstr[errval - NFSERR_BADHANDLE]);\n}\n\n#endif\t/* _NFS_NFSV4ERRSTR_H_ */\n"
  },
  {
    "path": "freebsd-headers/fs/nfs/rpcv2.h",
    "content": "/*-\n * Copyright (c) 1989, 1993\n *\tThe Regents of the University of California.  All rights reserved.\n *\n * This code is derived from software contributed to Berkeley by\n * Rick Macklem at The University of Guelph.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 4. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/fs/nfs/rpcv2.h 191783 2009-05-04 15:23:58Z rmacklem $\n */\n\n#ifndef _NFS_RPCV2_H_\n#define\t_NFS_RPCV2_H_\n\n/*\n * Definitions for Sun RPC Version 2, from\n * \"RPC: Remote Procedure Call Protocol Specification\" RFC1057\n */\n\n/* Version # */\n#define\tRPC_VER2\t\t2\n\n/* Authentication flavours */\n#define\tRPCAUTH_NULL\t\t\t0\n#define\tRPCAUTH_UNIX\t\t\t1\n#define\tRPCAUTH_SHORT\t\t\t2\n#define\tRPCAUTH_KERB4\t\t\t4\n#define\tRPCAUTH_GSS\t\t\t6\n#define\tRPCAUTH_GSSKRB5\t\t\t390003\n#define\tRPCAUTH_GSSKRB5INTEGRITY\t390004\n#define\tRPCAUTH_GSSKRB5PRIVACY\t\t390005\n\n#define\tRPCAUTH_MAXSIZ\t\t400\n#define\tRPCVERF_MAXSIZ\t12\t/* For Kerb, can actually be 400 */\n\n/*\n * RPCAUTH_UNIX defs.\n */\n#define\tRPCAUTHUNIX_MINSIZ\t(5 * NFSX_UNSIGNED)\n#define\tRPCAUTH_UNIXGIDS 16\n\n/*\n * RPCAUTH_GSS defs.\n */\n#define\tRPCAUTHGSS_VERS1\t1\n\n#define\tRPCAUTHGSS_DATA\t\t0\n#define\tRPCAUTHGSS_INIT\t\t1\n#define\tRPCAUTHGSS_CONTINIT\t2\n#define\tRPCAUTHGSS_DESTROY\t3\n\n#define\tRPCAUTHGSS_SVCNONE\t1\n#define\tRPCAUTHGSS_SVCINTEGRITY\t2\n#define\tRPCAUTHGSS_SVCPRIVACY\t3\n\n#define\tRPCAUTHGSS_MAXSEQ\t0x80000000\n\n#define\tRPCAUTHGSS_WINDOW\t64\t/* # of bits in u_int64_t */\n#define\tRPCAUTHGSS_SEQWINDOW\t(RPCAUTHGSS_WINDOW + 1)\n\n#define\tRPCAUTHGSS_MIC\t\t1\n#define\tRPCAUTHGSS_WRAP\t\t2\n\n/*\n * Qop values for the types of security services.\n */\n#define\tGSS_KERBV_QOP\t\t0\n\n/*\n * Sizes of GSS stuff.\n */\n#define\tRPCGSS_KEYSIZ\t\t8\n\n#define\tGSSX_AUTHHEAD\t(5 * NFSX_UNSIGNED)\n#define\tGSSX_MYHANDLE\t(sizeof (long) + sizeof (u_int64_t))\n#define\tGSSX_RPCHEADER\t(13 * NFSX_UNSIGNED + GSSX_MYHANDLE)\n#define\tGSSX_MINWRAP\t(2 * NFSX_UNSIGNED)\n#define\tGSSX_KERBVTOKEN\t24\n#define\tGSSX_LOCALHANDLE (sizeof (void *))\n\n/*\n * Stuff for the gssd.\n */\n#define\tRPCPROG_GSSD\t\t0x20101010\n#define\tRPCGSSD_VERS\t\t1\n#define\tRPCGSSD_INIT\t\t1\n#define\tRPCGSSD_CONTINIT\t2\n#define\tRPCGSSD_CONTINITDESTROY\t3\n#define\tRPCGSSD_CLINIT\t\t4\n#define\tRPCGSSD_CLINITUID\t5\n#define\tRPCGSSD_CLCONT\t\t6\n#define\tRPCGSSD_CLCONTUID\t7\n#define\tRPCGSSD_CLINITNAME\t8\n#define\tRPCGSSD_CLCONTNAME\t9\n\n/*\n * Stuff for the nfsuserd\n */\n#define\tRPCPROG_NFSUSERD\t0x21010101\n#define\tRPCNFSUSERD_VERS\t1\n#define\tRPCNFSUSERD_GETUID\t1\n#define\tRPCNFSUSERD_GETGID\t2\n#define\tRPCNFSUSERD_GETUSER\t3\n#define\tRPCNFSUSERD_GETGROUP\t4\n\n/*\n * Some major status codes.\n */\n#if !defined(_GSSAPI_H_) && !defined(GSSAPI_H_) && !defined(_GSSAPI_GSSAPI_H_) && !defined(_RPCSEC_GSS_H)\n#define\t GSS_S_COMPLETE                  0x00000000\n#define\t GSS_S_CONTINUE_NEEDED           0x00000001\n#define\t GSS_S_DUPLICATE_TOKEN           0x00000002\n#define\t GSS_S_OLD_TOKEN                 0x00000004\n#define\t GSS_S_UNSEQ_TOKEN               0x00000008\n#define\t GSS_S_GAP_TOKEN                 0x00000010\n#define\t GSS_S_BAD_MECH                  0x00010000\n#define\t GSS_S_BAD_NAME                  0x00020000\n#define\t GSS_S_BAD_NAMETYPE              0x00030000\n#define\t GSS_S_BAD_BINDINGS              0x00040000\n#define\t GSS_S_BAD_STATUS                0x00050000\n#define\t GSS_S_BAD_MIC                   0x00060000\n#define\t GSS_S_BAD_SIG                   0x00060000\n#define\t GSS_S_NO_CRED                   0x00070000\n#define\t GSS_S_NO_CONTEXT                0x00080000\n#define\t GSS_S_DEFECTIVE_TOKEN           0x00090000\n#define\t GSS_S_DEFECTIVE_CREDENTIAL      0x000a0000\n#define\t GSS_S_CREDENTIALS_EXPIRED       0x000b0000\n#define\t GSS_S_CONTEXT_EXPIRED           0x000c0000\n#define\t GSS_S_FAILURE                   0x000d0000\n#define\t GSS_S_BAD_QOP                   0x000e0000\n#define\t GSS_S_UNAUTHORIZED              0x000f0000\n#define\t GSS_S_UNAVAILABLE               0x00100000\n#define\t GSS_S_DUPLICATE_ELEMENT         0x00110000\n#define\t GSS_S_NAME_NOT_MN               0x00120000\n#define\t GSS_S_CALL_INACCESSIBLE_READ    0x01000000\n#define\t GSS_S_CALL_INACCESSIBLE_WRITE   0x02000000\n#define\t GSS_S_CALL_BAD_STRUCTURE        0x03000000\n#endif\t/* _GSSAPI_H_ */\n\n/* Rpc Constants */\n#define\tRPC_CALL\t0\n#define\tRPC_REPLY\t1\n#define\tRPC_MSGACCEPTED\t0\n#define\tRPC_MSGDENIED\t1\n#define\tRPC_PROGUNAVAIL\t1\n#define\tRPC_PROGMISMATCH\t2\n#define\tRPC_PROCUNAVAIL\t3\n#define\tRPC_GARBAGE\t4\t\t/* I like this one */\n#define\tRPC_MISMATCH\t0\n#define\tRPC_AUTHERR\t1\n\n/* Authentication failures */\n#define\tAUTH_BADCRED\t1\n#define\tAUTH_REJECTCRED\t2\n#define\tAUTH_BADVERF\t3\n#define\tAUTH_REJECTVERF\t4\n#define\tAUTH_TOOWEAK\t5\t\t/* Give em wheaties */\n#define\tAUTH_PROBCRED\t13\n#define\tAUTH_CTXCRED\t14\n\n/* Sizes of rpc header parts */\n#define\tRPC_SIZ\t\t24\n#define\tRPC_REPLYSIZ\t28\n\n/* RPC Prog definitions */\n#define\tRPCPROG_MNT\t100005\n#define\tRPCMNT_VER1\t1\n#define\tRPCMNT_VER3\t3\n#define\tRPCMNT_MOUNT\t1\n#define\tRPCMNT_DUMP\t2\n#define\tRPCMNT_UMOUNT\t3\n#define\tRPCMNT_UMNTALL\t4\n#define\tRPCMNT_EXPORT\t5\n#define\tRPCMNT_NAMELEN\t255\n#define\tRPCMNT_PATHLEN\t1024\n#define\tRPCPROG_NFS\t100003\n \n/* Structs for common parts of the rpc's */\nstruct rpcv2_time {\n\tu_int32_t rpc_sec;\n\tu_int32_t rpc_usec;\n};\n\n#endif\t/* _NFS_RPCV2_H_ */\n"
  },
  {
    "path": "freebsd-headers/fs/nfs/xdr_subs.h",
    "content": "/*-\n * Copyright (c) 1989, 1993\n *\tThe Regents of the University of California.  All rights reserved.\n *\n * This code is derived from software contributed to Berkeley by\n * Rick Macklem at The University of Guelph.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 4. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/fs/nfs/xdr_subs.h 191783 2009-05-04 15:23:58Z rmacklem $\n */\n\n#ifndef _NFS_XDR_SUBS_H_\n#define\t_NFS_XDR_SUBS_H_\n\n/*\n * Macros used for conversion to/from xdr representation by nfs...\n * These use the MACHINE DEPENDENT routines ntohl, htonl\n * As defined by \"XDR: External Data Representation Standard\" RFC1014\n *\n * To simplify the implementation, we use ntohl/htonl even on big-endian\n * machines, and count on them being `#define'd away.  Some of these\n * might be slightly more efficient as quad_t copies on a big-endian,\n * but we cannot count on their alignment anyway.\n */\n\n#define\tfxdr_unsigned(t, v)\t((t)ntohl((int32_t)(v)))\n#define\ttxdr_unsigned(v)\t(htonl((int32_t)(v)))\n\n#define\tfxdr_nfsv2time(f, t) do { \t\t\t\t\t\\\n    (t)->tv_sec = ntohl(((struct nfsv2_time *)(f))->nfsv2_sec); \t\\\n    if (((struct nfsv2_time *)(f))->nfsv2_usec != 0xffffffff) \t\t\\\n\t(t)->tv_nsec = 1000 * ntohl(((struct nfsv2_time *)(f))->nfsv2_usec); \\\n    else \t\t\t\t\t\t\t\t\\\n\t(t)->tv_nsec = 0; \t\t\t\t\t\t\\\n    } while (0)\n\n#define\ttxdr_nfsv2time(f, t) do { \t\t\t\t\t\\\n    ((struct nfsv2_time *)(t))->nfsv2_sec = htonl((f)->tv_sec); \t\\\n    if ((f)->tv_nsec != -1) \t\t\t\t\t\t\\\n\t((struct nfsv2_time *)(t))->nfsv2_usec = htonl((f)->tv_nsec / 1000); \\\n    else \t\t\t\t\t\t\t\t\\\n\t((struct nfsv2_time *)(t))->nfsv2_usec = 0xffffffff; \t\t\\\n    } while (0)\n\n#define\tfxdr_nfsv3time(f, t) do { \t\t\t\t\t\\\n\t(t)->tv_sec = ntohl(((struct nfsv3_time *)(f))->nfsv3_sec); \t\\\n\t(t)->tv_nsec = ntohl(((struct nfsv3_time *)(f))->nfsv3_nsec); \t\\\n    } while (0)\n\n#define\ttxdr_nfsv3time(f, t) do { \t\t\t\t\t\\\n\t((struct nfsv3_time *)(t))->nfsv3_sec = htonl((f)->tv_sec); \t\\\n\t((struct nfsv3_time *)(t))->nfsv3_nsec = htonl((f)->tv_nsec); \t\\\n    } while (0)\n\n#define\tfxdr_nfsv4time(f, t) do { \t\t\t\t\t\\\n\t(t)->tv_sec = ntohl(((struct nfsv4_time *)(f))->nfsv4_sec); \t\\\n\t(t)->tv_nsec = (ntohl(((struct nfsv4_time *)(f))->nfsv4_nsec) % \\\n\t\t1000000000); \t\t\t\t\t\t\\\n    } while (0)\n\n#define\ttxdr_nfsv4time(f, t) do { \t\t\t\t\t\\\n\t((struct nfsv4_time *)(t))->nfsv4_highsec = 0; \t\t\t\\\n\t((struct nfsv4_time *)(t))->nfsv4_sec = htonl((f)->tv_sec); \t\\\n\t((struct nfsv4_time *)(t))->nfsv4_nsec = htonl((f)->tv_nsec); \t\\\n    } while (0)\n\n#define\tfxdr_hyper(f) \t\t\t\t\t\t\t\\\n        ((((u_quad_t)ntohl(((u_int32_t *)(f))[0])) << 32) |\t\t\\\n\t (u_quad_t)(ntohl(((u_int32_t *)(f))[1])))\n\n#define\ttxdr_hyper(f, t) do {\t\t\t\t\t\t\\\n\t((u_int32_t *)(t))[0] = htonl((u_int32_t)((f) >> 32));\t\t\\\n\t((u_int32_t *)(t))[1] = htonl((u_int32_t)((f) & 0xffffffff));\t\\\n    } while (0)\n\n#endif\t/* _NFS_XDR_SUBS_H_ */\n"
  },
  {
    "path": "freebsd-headers/fs/ntfs/ntfs.h",
    "content": "/*\t$NetBSD: ntfs.h,v 1.9 1999/10/31 19:45:26 jdolecek Exp $\t*/\n\n/*-\n * Copyright (c) 1998, 1999 Semen Ustimenko\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/fs/ntfs/ntfs.h 224290 2011-07-24 17:43:09Z mckusick $\n */\n\n/*#define NTFS_DEBUG 1*/\n\ntypedef u_int64_t cn_t;\ntypedef u_int16_t wchar;\n\n#pragma pack(1)\n#define BBSIZE\t\t\t1024\n#define\tBBOFF\t\t\t((off_t)(0))\n#define\tBBLOCK\t\t\t((daddr_t)(0))\n#define\tNTFS_MFTINO\t\t0\n#define\tNTFS_VOLUMEINO\t\t3\n#define\tNTFS_ATTRDEFINO\t\t4\n#define\tNTFS_ROOTINO\t\t5\n#define\tNTFS_BITMAPINO\t\t6\n#define\tNTFS_BOOTINO\t\t7\n#define\tNTFS_BADCLUSINO\t\t8\n#define\tNTFS_UPCASEINO\t\t10\n#define NTFS_MAXFILENAME\t255\n\nstruct fixuphdr {\n\tu_int32_t       fh_magic;\n\tu_int16_t       fh_foff;\n\tu_int16_t       fh_fnum;\n};\n\n#define NTFS_AF_INRUN\t0x00000001\nstruct attrhdr {\n\tu_int32_t       a_type;\n\tu_int32_t       reclen;\n\tu_int8_t        a_flag;\n\tu_int8_t        a_namelen;\n\tu_int8_t        a_nameoff;\n\tu_int8_t        reserved1;\n\tu_int8_t        a_compression;\n\tu_int8_t        reserved2;\n\tu_int16_t       a_index;\n};\n#define NTFS_A_STD\t0x10\n#define NTFS_A_ATTRLIST\t0x20\n#define NTFS_A_NAME\t0x30\n#define NTFS_A_VOLUMENAME\t0x60\n#define NTFS_A_DATA\t0x80\n#define\tNTFS_A_INDXROOT\t0x90\n#define\tNTFS_A_INDX\t0xA0\n#define NTFS_A_INDXBITMAP 0xB0\n\n#define NTFS_MAXATTRNAME\t255\nstruct attr {\n\tstruct attrhdr  a_hdr;\n\tunion {\n\t\tstruct {\n\t\t\tu_int16_t       a_datalen;\n\t\t\tu_int16_t       reserved1;\n\t\t\tu_int16_t       a_dataoff;\n\t\t\tu_int16_t       a_indexed;\n\t\t}               a_S_r;\n\t\tstruct {\n\t\t\tcn_t            a_vcnstart;\n\t\t\tcn_t            a_vcnend;\n\t\t\tu_int16_t       a_dataoff;\n\t\t\tu_int16_t       a_compressalg;\n\t\t\tu_int32_t       reserved1;\n\t\t\tu_int64_t       a_allocated;\n\t\t\tu_int64_t       a_datalen;\n\t\t\tu_int64_t       a_initialized;\n\t\t}               a_S_nr;\n\t}               a_S;\n};\n#define a_r\ta_S.a_S_r\n#define a_nr\ta_S.a_S_nr\n\ntypedef struct {\n\tu_int64_t       t_create;\n\tu_int64_t       t_write;\n\tu_int64_t       t_mftwrite;\n\tu_int64_t       t_access;\n}               ntfs_times_t;\n\n#define NTFS_FFLAG_RDONLY\t0x01LL\n#define NTFS_FFLAG_HIDDEN\t0x02LL\n#define NTFS_FFLAG_SYSTEM\t0x04LL\n#define NTFS_FFLAG_ARCHIVE\t0x20LL\n#define NTFS_FFLAG_COMPRESSED\t0x0800LL\n#define NTFS_FFLAG_DIR\t\t0x10000000LL\n\nstruct attr_name {\n\tu_int32_t       n_pnumber;\t/* Parent ntnode */\n\tu_int32_t       reserved;\n\tntfs_times_t    n_times;\n\tu_int64_t       n_size;\n\tu_int64_t       n_attrsz;\n\tu_int64_t       n_flag;\n\tu_int8_t        n_namelen;\n\tu_int8_t        n_nametype;\n\tu_int16_t       n_name[1];\n};\n\n#define NTFS_IRFLAG_INDXALLOC\t0x00000001\nstruct attr_indexroot {\n\tu_int32_t       ir_unkn1;\t/* always 0x30 */\n\tu_int32_t       ir_unkn2;\t/* always 0x1 */\n\tu_int32_t       ir_size;/* ??? */\n\tu_int32_t       ir_unkn3;\t/* number of cluster */\n\tu_int32_t       ir_unkn4;\t/* always 0x10 */\n\tu_int32_t       ir_datalen;\t/* sizeof simething */\n\tu_int32_t       ir_allocated;\t/* same as above */\n\tu_int16_t       ir_flag;/* ?? always 1 */\n\tu_int16_t       ir_unkn7;\n};\n\nstruct attr_attrlist {\n\tu_int32_t       al_type;\t/* Attribute type */\n\tu_int16_t       reclen;\t\t/* length of this entry */\n\tu_int8_t        al_namelen;\t/* Attribute name len */\n\tu_int8_t        al_nameoff;\t/* Name offset from entry start */\n\tu_int64_t       al_vcnstart;\t/* VCN number */\n\tu_int32_t       al_inumber;\t/* Parent ntnode */\n\tu_int32_t       reserved;\n\tu_int16_t       al_index;\t/* Attribute index in MFT record */\n\tu_int16_t       al_name[1];\t/* Name */\n};\n\n#define\tNTFS_INDXMAGIC\t(u_int32_t)(0x58444E49)\nstruct attr_indexalloc {\n\tstruct fixuphdr ia_fixup;\n\tu_int64_t       unknown1;\n\tcn_t            ia_bufcn;\n\tu_int16_t       ia_hdrsize;\n\tu_int16_t       unknown2;\n\tu_int32_t       ia_inuse;\n\tu_int32_t       ia_allocated;\n};\n\n#define\tNTFS_IEFLAG_SUBNODE\t0x00000001\n#define\tNTFS_IEFLAG_LAST\t0x00000002\n\nstruct attr_indexentry {\n\tu_int32_t       ie_number;\n\tu_int32_t       unknown1;\n\tu_int16_t       reclen;\n\tu_int16_t       ie_size;\n\tu_int32_t       ie_flag;/* 1 - has subnodes, 2 - last */\n\tu_int32_t       ie_fpnumber;\n\tu_int32_t       unknown2;\n\tntfs_times_t    ie_ftimes;\n\tu_int64_t       ie_fallocated;\n\tu_int64_t       ie_fsize;\n\tu_int64_t       ie_fflag;\n\tu_int8_t        ie_fnamelen;\n\tu_int8_t        ie_fnametype;\n\twchar           ie_fname[NTFS_MAXFILENAME];\n\t/* cn_t\t\tie_bufcn;\t buffer with subnodes */\n};\n\n#define\tNTFS_FILEMAGIC\t(u_int32_t)(0x454C4946)\n#define\tNTFS_BLOCK_SIZE\t512\n#define\tNTFS_FRFLAG_DIR\t0x0002\nstruct filerec {\n\tstruct fixuphdr fr_fixup;\n\tu_int8_t        reserved[8];\n\tu_int16_t       fr_seqnum;\t/* Sequence number */\n\tu_int16_t       fr_nlink;\n\tu_int16_t       fr_attroff;\t/* offset to attributes */\n\tu_int16_t       fr_flags;\t/* 1-nonresident attr, 2-directory */\n\tu_int32_t       fr_size;/* hdr + attributes */\n\tu_int32_t       fr_allocated;\t/* allocated length of record */\n\tu_int64_t       fr_mainrec;\t/* main record */\n\tu_int16_t       fr_attrnum;\t/* maximum attr number + 1 ??? */\n};\n\n#define\tNTFS_ATTRNAME_MAXLEN\t0x40\n#define\tNTFS_ADFLAG_NONRES\t0x0080\t/* Attrib can be non resident */\n#define\tNTFS_ADFLAG_INDEX\t0x0002\t/* Attrib can be indexed */\nstruct attrdef {\n\twchar\t\tad_name[NTFS_ATTRNAME_MAXLEN];\n\tu_int32_t\tad_type;\n\tu_int32_t\treserved1[2];\n\tu_int32_t\tad_flag;\n\tu_int64_t\tad_minlen;\n\tu_int64_t\tad_maxlen;\t/* -1 for nonlimited */\n};\n\nstruct ntvattrdef {\n\tchar\t\tad_name[0x40];\n\tint\t\tad_namelen;\n\tu_int32_t\tad_type;\n};\n\n#define\tNTFS_BBID\t\"NTFS    \"\n#define\tNTFS_BBIDLEN\t8\nstruct bootfile {\n\tu_int8_t        reserved1[3];\t/* asm jmp near ... */\n\tu_int8_t        bf_sysid[8];\t/* 'NTFS    ' */\n\tu_int16_t       bf_bps;\t\t/* bytes per sector */\n\tu_int8_t        bf_spc;\t\t/* sectors per cluster */\n\tu_int8_t        reserved2[7];\t/* unused (zeroed) */\n\tu_int8_t        bf_media;\t/* media desc. (0xF8) */\n\tu_int8_t        reserved3[2];\n\tu_int16_t       bf_spt;\t\t/* sectors per track */\n\tu_int16_t       bf_heads;\t/* number of heads */\n\tu_int8_t        reserver4[12];\n\tu_int64_t       bf_spv;\t\t/* sectors per volume */\n\tcn_t            bf_mftcn;\t/* $MFT cluster number */\n\tcn_t            bf_mftmirrcn;\t/* $MFTMirr cn */\n\tu_int8_t        bf_mftrecsz;\t/* MFT record size (clust) */\n\t\t\t\t\t/* 0xF6 inducates 1/4 */\n\tu_int32_t       bf_ibsz;\t/* index buffer size */\n\tu_int32_t       bf_volsn;\t/* volume ser. num. */\n};\n\n#define\tNTFS_SYSNODESNUM\t0x0B\nstruct ntfsmount {\n\tstruct mount   *ntm_mountp;\t/* filesystem vfs structure */\n\tstruct bootfile ntm_bootfile;\n\tstruct g_consumer *ntm_cp;\n\tstruct bufobj  *ntm_bo;\n\tstruct vnode   *ntm_devvp;\t/* block device mounted vnode */\n\tstruct vnode   *ntm_sysvn[NTFS_SYSNODESNUM];\n\tu_int32_t       ntm_bpmftrec;\n\tuid_t           ntm_uid;\n\tgid_t           ntm_gid;\n\tmode_t          ntm_mode;\n\tuint64_t\tntm_flag;\n\tcn_t\t\tntm_cfree;\n\tstruct ntvattrdef *ntm_ad;\n\tint\t\tntm_adnum;\n \twchar *\t\tntm_82u;\t/* 8bit to Unicode */\n \tchar **\t\tntm_u28;\t/* Unicode to 8 bit */\n\tvoid *\t\tntm_ic_l2u;\t/* Local to Unicode (iconv) */\n\tvoid *\t\tntm_ic_u2l;\t/* Unicode to Local (iconv) */\n\tu_int8_t\tntm_multiplier; /* NTFS blockno to DEV_BSIZE sectorno */\n};\n\n#define ntm_mftcn\tntm_bootfile.bf_mftcn\n#define ntm_mftmirrcn\tntm_bootfile.bf_mftmirrcn\n#define\tntm_mftrecsz\tntm_bootfile.bf_mftrecsz\n#define\tntm_spc\t\tntm_bootfile.bf_spc\n#define\tntm_bps\t\tntm_bootfile.bf_bps\n\n#pragma pack()\n\n#define\tNTFS_NEXTREC(s, type) ((type)(((caddr_t) s) + (s)->reclen))\n\n/* Convert mount ptr to ntfsmount ptr. */\n#define VFSTONTFS(mp)\t((struct ntfsmount *)((mp)->mnt_data))\n#define VTONT(v)\tFTONT(VTOF(v))\n#define\tVTOF(v)\t\t((struct fnode *)((v)->v_data))\n#define\tFTOV(f)\t\t((f)->f_vp)\n#define\tFTONT(f)\t((f)->f_ip)\n#define ntfs_cntobn(cn)\t(daddr_t)((cn) * (ntmp->ntm_spc))\n#define ntfs_cntob(cn)\t(off_t)((cn) * (ntmp)->ntm_spc * (ntmp)->ntm_bps)\n#define ntfs_btocn(off)\t(cn_t)((off) / ((ntmp)->ntm_spc * (ntmp)->ntm_bps))\n#define ntfs_btocl(off)\t(cn_t)((off + ntfs_cntob(1) - 1) / ((ntmp)->ntm_spc * (ntmp)->ntm_bps))\n#define ntfs_btocnoff(off)\t(off_t)((off) % ((ntmp)->ntm_spc * (ntmp)->ntm_bps))\n#define ntfs_bntob(bn)\t(daddr_t)((bn) * (ntmp)->ntm_bps)\n\n#define\tntfs_bpbl\t(daddr_t)((ntmp)->ntm_bps)\n\n#ifdef MALLOC_DECLARE\nMALLOC_DECLARE(M_NTFSNTNODE);\nMALLOC_DECLARE(M_NTFSFNODE);\nMALLOC_DECLARE(M_NTFSDIR);\nMALLOC_DECLARE(M_NTFSNTHASH);\n#endif\n\n#if defined(NTFS_DEBUG)\n#define dprintf(a) printf a\n#if NTFS_DEBUG > 1\n#define ddprintf(a) printf a\n#else\n#define ddprintf(a)\t(void)0\n#endif\n#else\n#define dprintf(a)\t(void)0\n#define ddprintf(a)\t(void)0\n#endif\n\nextern struct vop_vector ntfs_vnodeops;\n"
  },
  {
    "path": "freebsd-headers/fs/ntfs/ntfs_compr.h",
    "content": "/*\t$NetBSD: ntfs_compr.h,v 1.3 1999/07/26 14:02:31 jdolecek Exp $\t*/\n\n/*-\n * Copyright (c) 1998, 1999 Semen Ustimenko\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/fs/ntfs/ntfs_compr.h 54095 1999-12-03 20:37:40Z semenu $\n */\n\n#define NTFS_COMPBLOCK_SIZE\t0x1000\n#define NTFS_COMPUNIT_CL\t16\n\nint\tntfs_uncompblock(u_int8_t *, u_int8_t *);\nint\tntfs_uncompunit(struct ntfsmount *, u_int8_t *, u_int8_t *);\n"
  },
  {
    "path": "freebsd-headers/fs/ntfs/ntfs_ihash.h",
    "content": "/*\t$NetBSD: ntfs_ihash.h,v 1.4 1999/09/30 16:56:40 jdolecek Exp $\t*/\n\n/*-\n * Copyright (c) 1998, 1999 Semen Ustimenko\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/fs/ntfs/ntfs_ihash.h 130585 2004-06-16 09:47:26Z phk $\n */\n\nextern struct lock ntfs_hashlock;\nvoid ntfs_nthashinit(void);\nvoid ntfs_nthashdestroy(void);\nstruct ntnode   *ntfs_nthashlookup(struct cdev *, ino_t);\nstruct ntnode   *ntfs_nthashget(struct cdev *, ino_t);\nvoid ntfs_nthashins(struct ntnode *);\nvoid ntfs_nthashrem(register struct ntnode *);\n"
  },
  {
    "path": "freebsd-headers/fs/ntfs/ntfs_inode.h",
    "content": "/*\t$NetBSD: ntfs_inode.h,v 1.8 1999/10/31 19:45:26 jdolecek Exp $\t*/\n\n/*-\n * Copyright (c) 1998, 1999 Semen Ustimenko\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/fs/ntfs/ntfs_inode.h 130585 2004-06-16 09:47:26Z phk $\n */\n\n/* These flags are kept in i_flag. */\n#define\tIN_ACCESS\t0x0001\t/* Access time update request. */\n#define\tIN_CHANGE\t0x0002\t/* Inode change time update request. */\n#define\tIN_UPDATE\t0x0004\t/* Modification time update request. */\n#define\tIN_MODIFIED\t0x0008\t/* Inode has been modified. */\n#define\tIN_RENAME\t0x0010\t/* Inode is being renamed. */\n#define\tIN_SHLOCK\t0x0020\t/* File has shared lock. */\n#define\tIN_EXLOCK\t0x0040\t/* File has exclusive lock. */\n#define\tIN_LAZYMOD\t0x0080\t/* Modified, but don't write yet. */\n#define\tIN_HASHED\t0x0800\t/* Inode is on hash list */\n#define\tIN_LOADED\t0x8000\t/* ntvattrs loaded */\n#define\tIN_PRELOADED\t0x4000\t/* loaded from directory entry */\n\nstruct ntnode {\n\tstruct vnode   *i_devvp;\t/* vnode of blk dev we live on */\n\tstruct cdev *i_dev;\t\t/* Device associated with the inode. */\n\n\tLIST_ENTRY(ntnode)\ti_hash;\n\tstruct ntnode  *i_next;\n\tstruct ntnode **i_prev;\n\tstruct ntfsmount       *i_mp;\n\tino_t           i_number;\n\tu_int32_t       i_flag;\n\n\t/* locking */\n\tstruct lock\ti_lock;\n\tstruct mtx\ti_interlock;\n\tint\t\ti_usecount;\n\n\tLIST_HEAD(,fnode)\ti_fnlist;\n\tLIST_HEAD(,ntvattr)\ti_valist;\n\n\tlong\t\ti_nlink;\t/* MFR */\n\tino_t\t\ti_mainrec;\t/* MFR */\n\tu_int32_t\ti_frflag;\t/* MFR */\n};\n\n#define\tFN_PRELOADED\t0x0001\n#define\tFN_VALID\t0x0002\n#define\tFN_AATTRNAME\t0x0004\t/* space allocated for f_attrname */\nstruct fnode {\n\tLIST_ENTRY(fnode) f_fnlist;\n\tstruct vnode   *f_vp;\t\t/* Associatied vnode */\n\tstruct ntnode  *f_ip;\t\t/* Associated ntnode */\n\tu_long\t\tf_flag;\n\n\tntfs_times_t\tf_times;\t/* $NAME/dirinfo */\n\tino_t\t\tf_pnumber;\t/* $NAME/dirinfo */\n\tu_int32_t       f_fflag;\t/* $NAME/dirinfo */\n\tu_int64_t\tf_size;\t\t/* defattr/dirinfo: */\n\tu_int64_t\tf_allocated;\t/* defattr/dirinfo */\n\n\tu_int32_t\tf_attrtype;\n\tchar\t       *f_attrname;\n\n\t/* for ntreaddir */\n\tu_int32_t       f_lastdattr;\n\tu_int32_t       f_lastdblnum;\n\tu_int32_t       f_lastdoff;\n\tu_int32_t       f_lastdnum;\n\tcaddr_t         f_dirblbuf;\n\tu_int32_t       f_dirblsz;\n};\n\n/* This overlays the fid structure (see <sys/mount.h>) */\nstruct ntfid {\n        u_int16_t ntfid_len;     /* Length of structure. */\n        u_int16_t ntfid_pad;     /* Force 32-bit alignment. */\n        ino_t     ntfid_ino;     /* File number (ino). */\n        int32_t   ntfid_gen;     /* Generation number. */\n};\n"
  },
  {
    "path": "freebsd-headers/fs/ntfs/ntfs_subr.h",
    "content": "/*\t$NetBSD: ntfs_subr.h,v 1.8 1999/10/10 14:48:37 jdolecek Exp $\t*/\n\n/*-\n * Copyright (c) 1998, 1999 Semen Ustimenko\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/fs/ntfs/ntfs_subr.h 164450 2006-11-20 19:28:36Z le $\n */\n\n#define\tVA_LOADED\t\t0x0001\n#define\tVA_PRELOADED\t\t0x0002\n\nstruct ntvattr {\n\tLIST_ENTRY(ntvattr) \tva_list;\n\n\tu_int32_t\t\tva_vflag;\n\tstruct vnode\t       *va_vp;\n\tstruct ntnode \t       *va_ip;\n\n\tu_int32_t\t\tva_flag;\n\tu_int32_t\t\tva_type;\n\tu_int8_t\t\tva_namelen;\n\tchar\t\t\tva_name[NTFS_MAXATTRNAME];\n\n\tu_int32_t\t\tva_compression;\n\tu_int32_t\t\tva_compressalg;\n\tu_int64_t\t\tva_datalen;\n\tu_int64_t\t\tva_allocated;\n\tcn_t\t \t\tva_vcnstart;\n\tcn_t\t \t\tva_vcnend;\n\tu_int16_t\t\tva_index;\n\tunion {\n\t\tstruct {\n\t\t\tcn_t *\t\tcn;\n\t\t\tcn_t *\t\tcl;\n\t\t\tu_long\t\tcnt;\n\t\t} vrun;\n\t\tcaddr_t\t\tdatap;\n\t\tstruct attr_name *name;\n\t\tstruct attr_indexroot *iroot;\n\t\tstruct attr_indexalloc *ialloc;\n\t} va_d;\n};\n#define\tva_vruncn\tva_d.vrun.cn\n#define va_vruncl\tva_d.vrun.cl\n#define va_vruncnt\tva_d.vrun.cnt\n#define va_datap\tva_d.datap\n#define va_a_name\tva_d.name\n#define va_a_iroot\tva_d.iroot\n#define va_a_ialloc\tva_d.ialloc\n\nstruct componentname;\nstruct fnode;\nstruct uio;\n\nint ntfs_procfixups( struct ntfsmount *, u_int32_t, caddr_t, size_t );\nint ntfs_parserun( cn_t *, cn_t *, u_int8_t *, u_long, u_long *);\nint ntfs_runtocn( cn_t *, struct ntfsmount *, u_int8_t *, u_long, cn_t);\nint ntfs_readntvattr_plain( struct ntfsmount *, struct ntnode *, struct ntvattr *, off_t, size_t, void *,size_t *, struct uio *);\nint ntfs_readattr_plain( struct ntfsmount *, struct ntnode *, u_int32_t, char *, off_t, size_t, void *,size_t *, struct uio *);\nint ntfs_readattr( struct ntfsmount *, struct ntnode *, u_int32_t, char *, off_t, size_t, void *, struct uio *);\nint ntfs_filesize( struct ntfsmount *, struct fnode *, u_int64_t *, u_int64_t *);\nint ntfs_times( struct ntfsmount *, struct ntnode *, ntfs_times_t *);\nstruct timespec\tntfs_nttimetounix( u_int64_t );\nint ntfs_ntreaddir( struct ntfsmount *, struct fnode *, u_int32_t, struct attr_indexentry **);\nint ntfs_runtovrun( cn_t **, cn_t **, u_long *, u_int8_t *);\nint ntfs_attrtontvattr( struct ntfsmount *, struct ntvattr **, struct attr * );\nvoid ntfs_freentvattr( struct ntvattr * );\nint ntfs_loadntvattrs( struct ntfsmount *, struct vnode *, caddr_t, struct ntvattr **);\nstruct ntvattr * ntfs_findntvattr( struct ntfsmount *, struct ntnode *, u_int32_t, cn_t );\nint ntfs_ntlookupfile(struct ntfsmount *, struct vnode *, struct componentname *, struct vnode **);\nint ntfs_isnamepermitted(struct ntfsmount *, struct attr_indexentry * );\nint ntfs_ntvattrrele(struct ntvattr * );\nint ntfs_ntvattrget(struct ntfsmount *, struct ntnode *, u_int32_t, const char *, cn_t , struct ntvattr **);\nint ntfs_ntlookup(struct ntfsmount *, ino_t, struct ntnode **);\nint ntfs_ntget(struct ntnode *);\nvoid ntfs_ntref(struct ntnode *);\nvoid ntfs_ntrele(struct ntnode *);\nvoid ntfs_ntput(struct ntnode *);\nint ntfs_loadntnode( struct ntfsmount *, struct ntnode * );\nint ntfs_writentvattr_plain(struct ntfsmount *, struct ntnode *, struct ntvattr *, off_t, size_t, void *, size_t *, struct uio *);\nint ntfs_writeattr_plain(struct ntfsmount *, struct ntnode *, u_int32_t, char *, off_t, size_t, void *, size_t *, struct uio *);\nvoid ntfs_toupper_init(void);\nvoid ntfs_toupper_destroy(void);\nint ntfs_toupper_use(struct mount *, struct ntfsmount *);\nvoid ntfs_toupper_unuse(void);\nint ntfs_fget(struct ntfsmount *, struct ntnode *, int, char *, struct fnode **);\nvoid ntfs_frele(struct fnode *);\n\nint ntfs_u28_init(struct ntfsmount *ntmp, wchar *u2w, char *cs_local, char *cs_ntfs);\nint ntfs_u28_uninit(struct ntfsmount *ntmp);\nint ntfs_82u_init(struct ntfsmount *ntmp, char *cs_local, char *cs_ntfs);\nint ntfs_82u_uninit(struct ntfsmount *ntmp);\nwchar ntfs_u28(struct ntfsmount *ntmp, wchar wc);\nwchar ntfs_82u(struct ntfsmount *ntmp, wchar wc, int *len);\n#define NTFS_U28(ch)\t\tntfs_u28(ntmp, (ch))\n#define NTFS_82U(ch, len)\tntfs_82u(ntmp, (ch), len)\n#define\tNTFS_UASTRCMP(ustr, ustrlen, astr, astrlen)\t\\\n\tntfs_uastrcmp(ntmp, (ustr), (ustrlen), (astr), (astrlen))\n#define\tNTFS_UASTRICMP(ustr, ustrlen, astr, astrlen)\t\\\n\tntfs_uastricmp(ntmp, (ustr), (ustrlen), (astr), (astrlen))\n"
  },
  {
    "path": "freebsd-headers/fs/ntfs/ntfs_vfsops.h",
    "content": "/*\t$NetBSD: ntfs_vfsops.h,v 1.4 1999/10/10 14:20:33 jdolecek Exp $\t*/\n\n/*-\n * Copyright (c) 1998, 1999 Semen Ustimenko (semenu@FreeBSD.org)\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/fs/ntfs/ntfs_vfsops.h 141623 2005-02-10 12:09:49Z phk $\n */\n#define VG_DONTLOADIN\t0x0001\t/* Tells ntfs_vgetex to do not call */\n\t\t\t\t/* ntfs_loadntnode() on ntnode, even if */\n\t\t\t\t/* ntnode not loaded */\n#define\tVG_DONTVALIDFN\t0x0002\t/* Tells ntfs_vgetex to do not validate */\n\t\t\t\t/* fnode */\n#define\tVG_EXT\t\t0x0004\t/* This is not main record */\n\nstruct mount;\nstruct ntfsmount;\nstruct thread;\nstruct vnode;\n\nint ntfs_vgetex(struct mount *, ino_t, u_int32_t, char *, u_long, u_long,\n\t\tstruct thread *, struct vnode **);\n"
  },
  {
    "path": "freebsd-headers/fs/ntfs/ntfsmount.h",
    "content": "/*\t$NetBSD: ntfsmount.h,v 1.3 1999/07/26 14:02:32 jdolecek Exp $\t*/\n\n/*-\n * Copyright (c) 1998, 1999 Semen Ustimenko\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/fs/ntfs/ntfsmount.h 213664 2010-10-10 07:05:47Z kib $\n */\n\n#define\tNTFS_MFLAG_CASEINS\t0x00000001\n#define\tNTFS_MFLAG_ALLNAMES\t0x00000002\n#define\tNTFS_MFLAG_KICONV\t0x00000004\n\nstruct ntfs_args {\n\tchar\t*fspec;\t\t\t/* block special device to mount */\n\tstruct\toexport_args export;\t/* network export information */\n\tuid_t\tuid;\t\t\t/* uid that owns ntfs files */\n\tgid_t\tgid;\t\t\t/* gid that owns ntfs files */\n\tmode_t\tmode;\t\t\t/* mask to be applied for ntfs perms */\n\tu_long\tflag;\t\t\t/* additional flags */\n\tchar\t*cs_ntfs;\t\t/* NTFS Charset */\n\tchar\t*cs_local;\t\t/* Local Charset */\n};\n"
  },
  {
    "path": "freebsd-headers/fs/nullfs/null.h",
    "content": "/*-\n * Copyright (c) 1992, 1993\n *\tThe Regents of the University of California.  All rights reserved.\n *\n * This code is derived from software donated to Berkeley by\n * Jan-Simon Pendry.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 4. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t@(#)null.h\t8.3 (Berkeley) 8/20/94\n *\n * $FreeBSD: release/9.0.0/sys/fs/nullfs/null.h 143642 2005-03-15 13:49:33Z jeff $\n */\n\nstruct null_mount {\n\tstruct mount\t*nullm_vfs;\n\tstruct vnode\t*nullm_rootvp;\t/* Reference to root null_node */\n};\n\n#ifdef _KERNEL\n/*\n * A cache of vnode references\n */\nstruct null_node {\n\tLIST_ENTRY(null_node)\tnull_hash;\t/* Hash list */\n\tstruct vnode\t        *null_lowervp;\t/* VREFed once */\n\tstruct vnode\t\t*null_vnode;\t/* Back pointer */\n};\n\n#define\tMOUNTTONULLMOUNT(mp) ((struct null_mount *)((mp)->mnt_data))\n#define\tVTONULL(vp) ((struct null_node *)(vp)->v_data)\n#define\tNULLTOV(xp) ((xp)->null_vnode)\n\nint nullfs_init(struct vfsconf *vfsp);\nint nullfs_uninit(struct vfsconf *vfsp);\nint null_nodeget(struct mount *mp, struct vnode *target, struct vnode **vpp);\nvoid null_hashrem(struct null_node *xp);\nint null_bypass(struct vop_generic_args *ap);\n\n#ifdef DIAGNOSTIC\nstruct vnode *null_checkvp(struct vnode *vp, char *fil, int lno);\n#define\tNULLVPTOLOWERVP(vp) null_checkvp((vp), __FILE__, __LINE__)\n#else\n#define\tNULLVPTOLOWERVP(vp) (VTONULL(vp)->null_lowervp)\n#endif\n\nextern struct vop_vector null_vnodeops;\n\n#ifdef MALLOC_DECLARE\nMALLOC_DECLARE(M_NULLFSNODE);\n#endif\n\n#ifdef NULLFS_DEBUG\n#define NULLFSDEBUG(format, args...) printf(format ,## args)\n#else\n#define NULLFSDEBUG(format, args...)\n#endif /* NULLFS_DEBUG */\n\n#endif /* _KERNEL */\n"
  },
  {
    "path": "freebsd-headers/fs/nwfs/nwfs.h",
    "content": "/*-\n * Copyright (c) 1999 Boris Popov\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/fs/nwfs/nwfs.h 206361 2010-04-07 16:50:38Z joel $\n */\n\n#ifndef _NWFS_H_\n#define _NWFS_H_\n\n#include <netncp/ncp.h>\n#include <fs/nwfs/nwfs_mount.h>\n\n#define NR_OPEN 0\n#define\tNW_NSB_DOS\t(1 << NW_NS_DOS)\n#define\tNW_NSB_MAC\t(1 << NW_NS_MAC)\n#define\tNW_NSB_NFS\t(1 << NW_NS_NFS)\n#define\tNW_NSB_FTAM\t(1 << NW_NS_FTAM)\n#define\tNW_NSB_OS2\t(1 << NW_NS_OS2)\n\n#define\tNWFSIOC_GETCONN\t\t_IOR('n',1,int)\n#define\tNWFSIOC_GETEINFO\t_IOR('n',2,struct nw_entry_info)\n#define\tNWFSIOC_GETNS\t\t_IOR('n',3,int)\n\n#ifdef _KERNEL\n\n#include <sys/vnode.h>\n#include <sys/mount.h>\n\nstruct nwfsnode;\n\nstruct nwmount {\n\tstruct nwfs_args m;\n\tstruct mount \t*mp;\n\tstruct ncp_handle *connh;\n\tint \t\tname_space;\n\tstruct nwnode\t*n_root;\n\tu_int32_t\tn_volume;\n\tncpfid\t\tn_rootent;\n\tint\t\tn_id;\n};\n\n#define VFSTONWFS(mntp)\t\t((struct nwmount *)((mntp)->mnt_data))\n#define NWFSTOVFS(mnp)\t\t((struct mount *)((mnp)->mount))\n#define VTOVFS(vp)\t\t((vp)->v_mount)\n#define\tVTONWFS(vp)\t\t(VFSTONWFS(VTOVFS(vp)))\n#define NWFSTOCONN(nmp)\t\t((nmp)->connh->nh_conn)\n\nint ncp_conn_logged_in(struct nwmount *);\nint nwfs_ioctl(struct vop_ioctl_args *ap);\nint nwfs_doio(struct vnode *vp, struct buf *bp, struct ucred *cr, struct thread *td);\nint nwfs_vinvalbuf(struct vnode *vp, struct thread *td);\n\nextern struct vop_vector nwfs_vnodeops;\n\n#endif\t/* _KERNEL */\n\n#endif /* _NWFS_H_ */\n"
  },
  {
    "path": "freebsd-headers/fs/nwfs/nwfs_mount.h",
    "content": "/*-\n * Copyright (c) 1999 Boris Popov\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/fs/nwfs/nwfs_mount.h 206361 2010-04-07 16:50:38Z joel $\n */\n#ifndef _NWFS_MOUNT_H_\n#define\t_NWFS_MOUNT_H_\n\n#ifndef _NCP_NCP_NLS_H_\n#include <netncp/ncp_nls.h>\n#endif\n\n#define NWFS_VERMAJ\t1\n#define NWFS_VERMIN\t3400\n#define NWFS_VERSION\t(NWFS_VERMAJ*100000 + NWFS_VERMIN)\n\n/* Values for flags */\n#define NWFS_MOUNT_SOFT\t\t0x0001\n#define WNFS_MOUNT_INTR\t\t0x0002\n#define NWFS_MOUNT_STRONG\t0x0004\n#define NWFS_MOUNT_NO_OS2\t0x0008\n#define NWFS_MOUNT_NO_NFS\t0x0010\n#define NWFS_MOUNT_NO_LONG\t0x0020\n#define\tNWFS_MOUNT_GET_SYSENT\t0x0040\t/* special case, look to vfsops :) */\n#define\tNWFS_MOUNT_HAVE_NLS\t0x0080\n\n#define\tNWFS_VOLNAME_LEN\t48\n\n\n/* Layout of the mount control block for a netware filesystem. */\nstruct nwfs_args {\n\tint\t\tconnRef;\t\t/* connection reference */\n\tchar\t\tmount_point[MAXPATHLEN];\n\tu_int\t\tflags;\n\tu_char\t\tmounted_vol[NWFS_VOLNAME_LEN + 1];\n\tu_char\t\troot_path[512+1];\n\tint\t\tversion;\n\tuid_t\t\tuid;\n\tgid_t \t\tgid;\n\tmode_t \t\tfile_mode;\n\tmode_t \t\tdir_mode;\n\tstruct ncp_nlstables nls;\n\tint\t\ttz;\n};\n\n#ifdef _KERNEL\n\n#ifdef MALLOC_DECLARE\nMALLOC_DECLARE(M_NWFSMNT);\n#endif\n\n#endif\n#endif /* !_NWFS_MOUNT_H_ */\n"
  },
  {
    "path": "freebsd-headers/fs/nwfs/nwfs_node.h",
    "content": "/*-\n * Copyright (c) 1999, 2000, 2001 Boris Popov\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/fs/nwfs/nwfs_node.h 206361 2010-04-07 16:50:38Z joel $\n */\n#ifndef _NWFS_NODE_H_\n#define _NWFS_NODE_H_\n\n#define\tNWFS_ROOT_INO\t0x7ffffffd\n\n/* Bits for nwnode.n_flag */\n#define\tNFLUSHINPROG\t0x0001\n#define\tNFLUSHWANT\t0x0002\t\t/* they should gone ... */\n#define\tNMODIFIED\t0x0004\t\t/* bogus, until async IO implemented */\n#define\tNREFPARENT\t0x0008\t\t/* vnode holds reference to a parent vnode */\n#define\tNVOLUME\t\t0x0010\t\t/* vnode references a volume */\n#define\tNSHOULDFREE\t0x0020\t\t/* vnode should be removed from hash */\n\nstruct nwnode {\n\tLIST_ENTRY(nwnode)\tn_hash;\n\tstruct vnode \t\t*n_vnode;\n\tstruct vattr\t\tn_vattr;\n\tstruct nwmount\t\t*n_mount;\n\ttime_t\t\t\tn_atime;\t/* attributes cache time*/\n\ttime_t\t\t\tn_ctime;\n\ttime_t\t\t\tn_mtime;\n\tint\t\t\tn_flag;\n\tncpfid\t\t\tn_parent;\n\tncpfid\t\t\tn_fid;\n\tu_long\t\t\tn_attr;\t\t/* LH */\n\tu_long\t\t\tn_size;\n\tu_long\t\t\tn_dosfid;\n\tint \t\t\topened;\n/*\tint \t\t\taccess;*/\n\tu_long \t\t\tn_origfh;\n\tncp_fh\t\t\tn_fh;\n\tstruct nw_search_seq\tn_seq;\n\tu_char\t\t\tn_nmlen;\n\tu_char\t\t\tn_name[256];\n};\n\n#define VTONW(vp)\t((struct nwnode *)(vp)->v_data)\n#define NWTOV(np)\t((struct vnode *)(np)->n_vnode)\n#define\tNWCMPF(f1,f2)\t((f1)->f_parent == (f2)->f_parent && \\\n\t\t\t (f1)->f_id == (f2)->f_id)\n#define\tNWCMPN(np1,np2)\tNWCMPF(&(np1)->n_fid, &(np2)->n_fid)\n#define NWCMPV(vp1,vp2)\tNWCMPN(VTONW(vp1),VTONW(vp2))\n\nstruct vop_getpages_args;\nstruct vop_inactive_args;\nstruct vop_putpages_args;\nstruct vop_reclaim_args;\nstruct ucred;\nstruct uio;\n\nvoid nwfs_hash_init(void);\nvoid nwfs_hash_free(void);\nint  nwfs_lookupnp(struct nwmount *nmp, ncpfid fid, struct thread *td,\n\tstruct nwnode **npp);\nint  nwfs_inactive(struct vop_inactive_args *);\nint  nwfs_reclaim(struct vop_reclaim_args *);\nint  nwfs_nget(struct mount *mp, ncpfid fid, struct nw_entry_info *fap,\n\tstruct vnode *dvp, struct vnode **vpp);\n\nint  nwfs_getpages(struct vop_getpages_args *);\nint  nwfs_putpages(struct vop_putpages_args *);\nint  nwfs_readvnode(struct vnode *vp, struct uio *uiop, struct ucred *cred);\nint  nwfs_writevnode(struct vnode *vp, struct uio *uiop, struct ucred *cred, int ioflag);\nvoid nwfs_attr_cacheenter(struct vnode *vp, struct nw_entry_info *fi);\nint  nwfs_attr_cachelookup(struct vnode *vp,struct vattr *va);\n\n#define nwfs_attr_cacheremove(vp)\tVTONW(vp)->n_atime = 0\n\n#endif /* _NWFS_NODE_H_ */\n"
  },
  {
    "path": "freebsd-headers/fs/nwfs/nwfs_subr.h",
    "content": "/*-\n * Copyright (c) 1999 Boris Popov\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/fs/nwfs/nwfs_subr.h 206361 2010-04-07 16:50:38Z joel $\n */\n#ifndef _NWFS_SUBR_H_\n#define _NWFS_SUBR_H_\n\nextern int nwfs_debuglevel;\n\n#ifdef MALLOC_DECLARE\nMALLOC_DECLARE(M_NWFSDATA);\n#endif\n\nstruct ncp_conn;\nstruct ncp_nlstables;\nstruct ncp_open_info;\nstruct nw_entry_info;\nstruct nw_search_info;\nstruct nwmount;\nstruct thread;\nstruct timespec;\nstruct ucred;\nstruct vattr;\nstruct vnode;\n\nint  ncp_initsearch(struct vnode *dvp,struct thread *td, struct ucred *cred);\nint  ncp_search_for_file_or_subdir(struct nwmount *nmp,struct nw_search_seq *seq,\n\t\tstruct nw_entry_info *target,\n\t\tstruct thread *td, struct ucred *cred);\nint  ncp_lookup(struct vnode *dvp, int len, char *name, struct nw_entry_info *fap,\n\t\tstruct thread *td, struct ucred *cred);\nint  ncp_lookup_volume(struct ncp_conn *conn, char *volname, \n\t\tu_char *volNum, u_int32_t *dirEnt,\n\t\tstruct thread *td, struct ucred *cred);\nint  ncp_close_file(struct ncp_conn *conn, ncp_fh *fh,\n\t\tstruct thread *td, struct ucred *cred);\nint  ncp_open_create_file_or_subdir(struct nwmount *nmp,struct vnode *dvp, int namelen,char *name,\n\t\tint open_create_mode, u_int32_t create_attributes,\n\t\tint desired_acc_rights, struct ncp_open_info *nop,\n\t\tstruct thread *td, struct ucred *cred);\nint  ncp_DeleteNSEntry(struct nwmount *nmp, \n\t\tu_int32_t dirent, int namelen, char *name,\n\t\tstruct thread *td, struct ucred *cred);\nint  ncp_nsrename(struct ncp_conn *conn, int volume, int ns, int oldtype, \n\tstruct ncp_nlstables *nt,\n\tnwdirent fdir, char *old_name, int oldlen,\n\tnwdirent tdir, char *new_name, int newlen,\n\tstruct thread *td, struct ucred *cred);\nint  ncp_obtain_info(struct nwmount *nmp, u_int32_t dirent,\n\t\tint namelen, char *path, struct nw_entry_info *target,\n\t\tstruct thread *td, struct ucred *cred);\nint  ncp_modify_file_or_subdir_dos_info(struct nwmount *nmp, struct vnode *vp, \n\t\tu_int32_t info_mask,\n\t\tstruct nw_modify_dos_info *info,\n\t\tstruct thread *td, struct ucred *cred);\nint  ncp_setattr(struct vnode *,struct vattr *,struct ucred *,struct thread *td);\nint  ncp_get_namespaces(struct ncp_conn *conn, u_int32_t volume, int *nsf,\n\t\tstruct thread *td, struct ucred *cred);\nint  ncp_get_volume_info_with_number(struct ncp_conn *conn, \n\t\tint n, struct ncp_volume_info *target,\n\t\tstruct thread *td, struct ucred *cred);\n\nvoid ncp_unix2dostime (struct timespec *tsp, int tz, u_int16_t *ddp, \n\t     u_int16_t *dtp, u_int8_t *dhp);\nvoid ncp_dos2unixtime (u_int dd, u_int dt, u_int dh, int tz, struct timespec *tsp);\n\n#endif /* !_NWFS_SUBR_H_ */\n"
  },
  {
    "path": "freebsd-headers/fs/portalfs/portal.h",
    "content": "/*-\n * Copyright (c) 1992, 1993\n *\tThe Regents of the University of California.  All rights reserved.\n *\n * This code is derived from software donated to Berkeley by\n * Jan-Simon Pendry.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 4. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t@(#)portal.h\t8.4 (Berkeley) 1/21/94\n *\n * $FreeBSD: release/9.0.0/sys/fs/portalfs/portal.h 194498 2009-06-19 17:10:35Z brooks $\n */\n\nstruct portal_args {\n\tchar\t\t*pa_config;\t/* Config file */\n\tint\t\tpa_socket;\t/* Socket to server */\n};\n\nstruct portal_cred {\n\tint\t\tpcr_flag;\t\t/* File open mode */\n\tuid_t\t\tpcr_uid;\t\t/* From ucred */\n\tshort\t\tpcr_ngroups;\t\t/* From ucred */\n\tgid_t\t\tpcr_groups[XU_NGROUPS];\t/* From ucred */\n};\n\n#ifdef _KERNEL\nstruct portalmount {\n\tstruct vnode\t*pm_root;\t/* Root node */\n\tstruct file\t*pm_server;\t/* Held reference to server socket */\n};\n\nstruct portalnode {\n\tint\t\tpt_size;\t/* Length of Arg */\n\tchar\t\t*pt_arg;\t/* Arg to send to server */\n\tint\t\tpt_fileid;\t/* cookie */\n};\n\n#define VFSTOPORTAL(mp)\t((struct portalmount *)((mp)->mnt_data))\n#define\tVTOPORTAL(vp) ((struct portalnode *)(vp)->v_data)\n\n#define PORTAL_ROOTFILEID\t2\n\nextern struct vop_vector portal_vnodeops;\n#endif /* _KERNEL */\n"
  },
  {
    "path": "freebsd-headers/fs/procfs/procfs.h",
    "content": "/*-\n * Copyright (c) 1993 Jan-Simon Pendry\n * Copyright (c) 1993\n *\tThe Regents of the University of California.  All rights reserved.\n *\n * This code is derived from software contributed to Berkeley by\n * Jan-Simon Pendry.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 4. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t@(#)procfs.h\t8.9 (Berkeley) 5/14/95\n *\n * From:\n * $FreeBSD: release/9.0.0/sys/fs/procfs/procfs.h 197428 2009-09-23 12:08:08Z kib $\n */\n\n#ifdef _KERNEL\n\nint\t procfs_docurproc(PFS_FILL_ARGS);\nint\t procfs_doosrel(PFS_FILL_ARGS);\nint\t procfs_doproccmdline(PFS_FILL_ARGS);\nint\t procfs_doprocctl(PFS_FILL_ARGS);\nint\t procfs_doprocdbregs(PFS_FILL_ARGS);\nint\t procfs_doprocfile(PFS_FILL_ARGS);\nint\t procfs_doprocfpregs(PFS_FILL_ARGS);\nint\t procfs_doprocmap(PFS_FILL_ARGS);\nint\t procfs_doprocmem(PFS_FILL_ARGS);\nint\t procfs_doprocnote(PFS_FILL_ARGS);\nint\t procfs_doprocregs(PFS_FILL_ARGS);\nint\t procfs_doprocrlimit(PFS_FILL_ARGS);\nint\t procfs_doprocstatus(PFS_FILL_ARGS);\nint\t procfs_doproctype(PFS_FILL_ARGS);\nint\t procfs_ioctl(PFS_IOCTL_ARGS);\nint\t procfs_close(PFS_CLOSE_ARGS);\n\n/* Attributes */\nint\t procfs_attr(PFS_ATTR_ARGS);\n\n/* Visibility */\nint\t procfs_notsystem(PFS_VIS_ARGS);\nint\t procfs_candebug(PFS_VIS_ARGS);\n\n#endif /* _KERNEL */\n"
  },
  {
    "path": "freebsd-headers/fs/smbfs/smbfs.h",
    "content": "/*-\n * Copyright (c) 2000-2001 Boris Popov\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/fs/smbfs/smbfs.h 224290 2011-07-24 17:43:09Z mckusick $\n */\n#ifndef _SMBFS_SMBFS_H_\n#define _SMBFS_SMBFS_H_\n\n#define SMBFS_VERMAJ\t1\n#define SMBFS_VERMIN\t1012\n#define SMBFS_VERSION\t(SMBFS_VERMAJ*100000 + SMBFS_VERMIN)\n#define\tSMBFS_VFSNAME\t\"smbfs\"\n\n/* Values for flags */\n#define SMBFS_MOUNT_SOFT\t0x0001\n#define SMBFS_MOUNT_INTR\t0x0002\n#define SMBFS_MOUNT_STRONG\t0x0004\n#define\tSMBFS_MOUNT_HAVE_NLS\t0x0008\n#define\tSMBFS_MOUNT_NO_LONG\t0x0010\n\n#define\tSMBFS_MAXPATHCOMP\t256\t/* maximum number of path components */\n\n\n/* Layout of the mount control block for an smb file system. */\nstruct smbfs_args {\n\tint\t\tversion;\n\tint\t\tdev;\n\tu_int\t\tflags;\n\tchar\t\tmount_point[MAXPATHLEN];\n\tu_char\t\troot_path[512+1];\n\tuid_t\t\tuid;\n\tgid_t \t\tgid;\n\tmode_t \t\tfile_mode;\n\tmode_t \t\tdir_mode;\n\tint\t\tcaseopt;\n};\n\n#ifdef _KERNEL\n\n#include <sys/_sx.h>\n\n#ifdef MALLOC_DECLARE\nMALLOC_DECLARE(M_SMBFSMNT);\n#endif\n\nstruct smbnode;\nstruct smb_share;\nstruct u_cred;\nstruct vop_ioctl_args;\nstruct buf;\n\nstruct smbmount {\n\t/* struct smbfs_args\tsm_args; */\n\tuid_t\t\t\tsm_uid;\n\tgid_t \t\t\tsm_gid;\n\tmode_t \t\t\tsm_file_mode;\n\tmode_t \t\t\tsm_dir_mode;\n\tstruct mount * \t\tsm_mp;\n\tstruct smbnode *\tsm_root;\n\tstruct ucred *\t\tsm_owner;\n\tuint64_t\t\tsm_flags;\n\tlong\t\t\tsm_nextino;\n\tstruct smb_share * \tsm_share;\n/*\tstruct simplelock\tsm_npslock;*/\n\tstruct smbnode *\tsm_npstack[SMBFS_MAXPATHCOMP];\n\tint\t\t\tsm_caseopt;\n\tstruct sx\t\tsm_hashlock;\n\tLIST_HEAD(smbnode_hashhead, smbnode) *sm_hash;\n\tu_long\t\t\tsm_hashlen;\n\tint\t\t\tsm_didrele;\n};\n\n#define VFSTOSMBFS(mp)\t\t((struct smbmount *)((mp)->mnt_data))\n#define SMBFSTOVFS(smp)\t\t((struct mount *)((smp)->sm_mp))\n#define VTOVFS(vp)\t\t((vp)->v_mount)\n#define\tVTOSMBFS(vp)\t\t(VFSTOSMBFS(VTOVFS(vp)))\n\nint smbfs_ioctl(struct vop_ioctl_args *ap);\nint smbfs_doio(struct vnode *vp, struct buf *bp, struct ucred *cr, struct thread *td);\nint smbfs_vinvalbuf(struct vnode *vp, struct thread *td);\n#endif\t/* KERNEL */\n\n#endif /* _SMBFS_SMBFS_H_ */\n"
  },
  {
    "path": "freebsd-headers/fs/smbfs/smbfs_node.h",
    "content": "/*-\n * Copyright (c) 2000-2001 Boris Popov\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/fs/smbfs/smbfs_node.h 206361 2010-04-07 16:50:38Z joel $\n */\n#ifndef _FS_SMBFS_NODE_H_\n#define _FS_SMBFS_NODE_H_\n\n#define\tSMBFS_ROOT_INO\t\t2\t/* just like in UFS */\n\n/* Bits for smbnode.n_flag */\n#define\tNFLUSHINPROG\t\t0x0001\n#define\tNFLUSHWANT\t\t0x0002\t/* they should gone ... */\n#define\tNMODIFIED\t\t0x0004\t/* bogus, until async IO implemented */\n/*efine\tNNEW\t\t\t0x0008*//* smb/vnode has been allocated */\n#define\tNREFPARENT\t\t0x0010\t/* node holds parent from recycling */\n#define\tNFLUSHWIRE\t\t0x1000\t/* pending flush request */\n#define\tNOPEN\t\t\t0x2000\t/* file is open */\n#define\tNGONE\t\t\t0x4000\t/* file has been removed/renamed */\n\nstruct smbfs_fctx;\n\nstruct smbnode {\n\tint\t\t\tn_flag;\n\tstruct vnode *\t\tn_parent;\n\tstruct vnode *\t\tn_vnode;\n\tstruct smbmount *\tn_mount;\n\ttime_t\t\t\tn_attrage;\t/* attributes cache time */\n/*\ttime_t\t\t\tn_ctime;*/\n\tstruct timespec\t\tn_mtime;\t/* modify time */\n\tstruct timespec\t\tn_atime;\t/* last access time */\n\tu_quad_t\t\tn_size;\n\tlong\t\t\tn_ino;\n\tint\t\t\tn_dosattr;\n\tu_int16_t\t\tn_fid;\t\t/* file handle */\n\tint\t\t\tn_rwstate;\t/* granted access mode */\n\tu_char\t\t\tn_nmlen;\n\tu_char *\t\tn_name;\n\tstruct smbfs_fctx *\tn_dirseq;\t/* ff context */\n\tlong\t\t\tn_dirofs;\t/* last ff offset */\n\tLIST_ENTRY(smbnode)\tn_hash;\n};\n\n#define VTOSMB(vp)\t((struct smbnode *)(vp)->v_data)\n#define SMBTOV(np)\t((struct vnode *)(np)->n_vnode)\n\nstruct vop_getpages_args;\nstruct vop_inactive_args;\nstruct vop_putpages_args;\nstruct vop_reclaim_args;\nstruct ucred;\nstruct uio;\nstruct smbfattr;\n\nint  smbfs_inactive(struct vop_inactive_args *);\nint  smbfs_reclaim(struct vop_reclaim_args *);\nint smbfs_nget(struct mount *mp, struct vnode *dvp, const char *name, int nmlen,\n\tstruct smbfattr *fap, struct vnode **vpp);\nu_int32_t smbfs_hash(const u_char *name, int nmlen);\n\nint  smbfs_getpages(struct vop_getpages_args *);\nint  smbfs_putpages(struct vop_putpages_args *);\nint  smbfs_readvnode(struct vnode *vp, struct uio *uiop, struct ucred *cred);\nint  smbfs_writevnode(struct vnode *vp, struct uio *uiop, struct ucred *cred, int ioflag);\nvoid smbfs_attr_cacheenter(struct vnode *vp, struct smbfattr *fap);\nint  smbfs_attr_cachelookup(struct vnode *vp ,struct vattr *va);\n\n#define smbfs_attr_cacheremove(vp)\tVTOSMB(vp)->n_attrage = 0\n\n#endif /* _FS_SMBFS_NODE_H_ */\n"
  },
  {
    "path": "freebsd-headers/fs/smbfs/smbfs_subr.h",
    "content": "/*-\n * Copyright (c) 2000-2001 Boris Popov\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/fs/smbfs/smbfs_subr.h 206361 2010-04-07 16:50:38Z joel $\n */\n#ifndef _FS_SMBFS_SMBFS_SUBR_H_\n#define _FS_SMBFS_SMBFS_SUBR_H_\n\n#ifdef MALLOC_DECLARE\nMALLOC_DECLARE(M_SMBFSDATA);\n#endif\n\n#define SMBFSERR(format, args...) printf(\"%s: \"format, __func__ ,## args)\n\n#ifdef SMB_VNODE_DEBUG\n#define SMBVDEBUG(format, args...) printf(\"%s: \"format, __func__ ,## args)\n#else\n#define SMBVDEBUG(format, args...)\n#endif\n\n/*\n * Possible lock commands\n */\n#define SMB_LOCK_EXCL\t\t0\n#define\tSMB_LOCK_SHARED\t\t1\n#define\tSMB_LOCK_RELEASE\t2\n\nstruct smbmount;\nstruct proc;\nstruct timespec;\nstruct ucred;\nstruct vattr;\nstruct vnode;\nstruct statfs;\n\nstruct smbfattr {\n\tint\t\tfa_attr;\n\tint64_t\t\tfa_size;\n\tstruct timespec\tfa_atime;\n\tstruct timespec\tfa_ctime;\n\tstruct timespec\tfa_mtime;\n\tlong\t\tfa_ino;\n};\n\n/*\n * Context to perform findfirst/findnext/findclose operations\n */\n#define\tSMBFS_RDD_FINDFIRST\t0x01\n#define\tSMBFS_RDD_EOF\t\t0x02\n#define\tSMBFS_RDD_FINDSINGLE\t0x04\n#define\tSMBFS_RDD_USESEARCH\t0x08\n#define\tSMBFS_RDD_NOCLOSE\t0x10\n#define\tSMBFS_RDD_GOTRNAME\t0x1000\n\n/*\n * Search context supplied by server\n */\n#define\tSMB_SKEYLEN\t\t21\t\t\t/* search context */\n#define SMB_DENTRYLEN\t\t(SMB_SKEYLEN + 22)\t/* entire entry */\n\nstruct smbfs_fctx {\n\t/*\n\t * Setable values\n\t */\n\tint\t\tf_flags;\t/* SMBFS_RDD_ */\n\t/*\n\t * Return values\n\t */\n\tstruct smbfattr\tf_attr;\t\t/* current attributes */\n\tchar *\t\tf_name;\t\t/* current file name */\n\tint\t\tf_nmlen;\t/* name len */\n\t/*\n\t * Internal variables\n\t */\n\tint\t\tf_limit;\t/* maximum number of entries */\n\tint\t\tf_attrmask;\t/* SMB_FA_ */\n\tint\t\tf_wclen;\n\tconst char *\tf_wildcard;\n\tstruct smbnode*\tf_dnp;\n\tstruct smb_cred*f_scred;\n\tstruct smb_share *f_ssp;\n\tunion {\n\t\tstruct smb_rq *\tuf_rq;\n\t\tstruct smb_t2rq * uf_t2;\n\t} f_urq;\n\tint\t\tf_left;\t\t/* entries left */\n\tint\t\tf_ecnt;\t\t/* entries left in the current reponse */\n\tint\t\tf_eofs;\t\t/* entry offset in the parameter block */\n\tu_char \t\tf_skey[SMB_SKEYLEN]; /* server side search context */\n\tu_char\t\tf_fname[8 + 1 + 3 + 1]; /* common case for 8.3 filenames */\n\tu_int16_t\tf_Sid;\n\tu_int16_t\tf_infolevel;\n\tint\t\tf_rnamelen;\n\tchar *\t\tf_rname;\t/* resume name/key */\n\tint\t\tf_rnameofs;\n};\n\n#define f_rq\tf_urq.uf_rq\n#define f_t2\tf_urq.uf_t2\n\n/*\n * smb level\n */\nint  smbfs_smb_lock(struct smbnode *np, int op, caddr_t id,\n\toff_t start, off_t end,\tstruct smb_cred *scred);\nint  smbfs_smb_statfs2(struct smb_share *ssp, struct statfs *sbp,\n\tstruct smb_cred *scred);\nint  smbfs_smb_statfs(struct smb_share *ssp, struct statfs *sbp,\n\tstruct smb_cred *scred);\nint  smbfs_smb_setfsize(struct smbnode *np, int newsize, struct smb_cred *scred);\n\nint  smbfs_smb_query_info(struct smbnode *np, const char *name, int len,\n\tstruct smbfattr *fap, struct smb_cred *scred);\nint  smbfs_smb_setpattr(struct smbnode *np, u_int16_t attr,\n\tstruct timespec *mtime, struct smb_cred *scred);\nint  smbfs_smb_setptime2(struct smbnode *np, struct timespec *mtime,\n\tstruct timespec *atime, int attr, struct smb_cred *scred);\nint  smbfs_smb_setpattrNT(struct smbnode *np, u_int16_t attr,\n\tstruct timespec *mtime, struct timespec *atime, struct smb_cred *scred);\n\nint  smbfs_smb_setftime(struct smbnode *np, struct timespec *mtime,\n\tstruct timespec *atime, struct smb_cred *scred);\nint  smbfs_smb_setfattrNT(struct smbnode *np, u_int16_t attr,\n\tstruct timespec *mtime,\tstruct timespec *atime, struct smb_cred *scred);\n\nint  smbfs_smb_open(struct smbnode *np, int accmode, struct smb_cred *scred);\nint  smbfs_smb_close(struct smb_share *ssp, u_int16_t fid,\n\t struct timespec *mtime, struct smb_cred *scred);\nint  smbfs_smb_create(struct smbnode *dnp, const char *name, int len,\n\tstruct smb_cred *scred);\nint  smbfs_smb_delete(struct smbnode *np, struct smb_cred *scred);\nint  smbfs_smb_flush(struct smbnode *np, struct smb_cred *scred);\nint  smbfs_smb_rename(struct smbnode *src, struct smbnode *tdnp,\n\tconst char *tname, int tnmlen, struct smb_cred *scred);\nint  smbfs_smb_move(struct smbnode *src, struct smbnode *tdnp,\n\tconst char *tname, int tnmlen, u_int16_t flags, struct smb_cred *scred);\nint  smbfs_smb_mkdir(struct smbnode *dnp, const char *name, int len,\n\tstruct smb_cred *scred);\nint  smbfs_smb_rmdir(struct smbnode *np, struct smb_cred *scred);\nint  smbfs_findopen(struct smbnode *dnp, const char *wildcard, int wclen,\n\tint attr, struct smb_cred *scred, struct smbfs_fctx **ctxpp);\nint  smbfs_findnext(struct smbfs_fctx *ctx, int limit, struct smb_cred *scred);\nint  smbfs_findclose(struct smbfs_fctx *ctx, struct smb_cred *scred);\nint  smbfs_fullpath(struct mbchain *mbp, struct smb_vc *vcp,\n\tstruct smbnode *dnp, const char *name, int nmlen);\nint  smbfs_smb_lookup(struct smbnode *dnp, const char *name, int nmlen,\n\tstruct smbfattr *fap, struct smb_cred *scred);\n\nint  smbfs_fname_tolocal(struct smb_vc *vcp, char *name, int *nmlen, int caseopt);\n\nvoid  smb_time_local2server(struct timespec *tsp, int tzoff, u_long *seconds);\nvoid  smb_time_server2local(u_long seconds, int tzoff, struct timespec *tsp);\nvoid  smb_time_NT2local(int64_t nsec, int tzoff, struct timespec *tsp);\nvoid  smb_time_local2NT(struct timespec *tsp, int tzoff, int64_t *nsec);\nvoid  smb_time_unix2dos(struct timespec *tsp, int tzoff, u_int16_t *ddp, \n\t     u_int16_t *dtp, u_int8_t *dhp);\nvoid smb_dos2unixtime (u_int dd, u_int dt, u_int dh, int tzoff, struct timespec *tsp);\n\n#endif /* !_FS_SMBFS_SMBFS_SUBR_H_ */\n"
  },
  {
    "path": "freebsd-headers/fs/udf/ecma167-udf.h",
    "content": "/*-\n * Copyright (c) 2001, 2002 Scott Long <scottl@freebsd.org>\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/fs/udf/ecma167-udf.h 188406 2009-02-09 20:42:51Z jhb $\n */\n\n/* ecma167-udf.h */\n/* Structure/definitions/constants a la ECMA 167 rev. 3 */\n\n/* Tag identifiers */\nenum {\n\tTAGID_PRI_VOL =\t\t1,\n\tTAGID_ANCHOR =\t\t2,\n\tTAGID_VOL = \t\t3,\n\tTAGID_IMP_VOL =\t\t4,\n\tTAGID_PARTITION =\t5,\n\tTAGID_LOGVOL =\t\t6,\n\tTAGID_UNALLOC_SPACE =\t7,\n\tTAGID_TERM =\t\t8,\n\tTAGID_LOGVOL_INTEGRITY = 9,\n\tTAGID_FSD =\t\t256,\n\tTAGID_FID =\t\t257,\n\tTAGID_FENTRY =\t\t261\n};\n\n/* Descriptor tag [3/7.2] */\nstruct desc_tag {\n\tuint16_t\tid;\n\tuint16_t\tdescriptor_ver;\n\tuint8_t\t\tcksum;\n\tuint8_t\t\treserved;\n\tuint16_t\tserial_num;\n\tuint16_t\tdesc_crc;\n\tuint16_t\tdesc_crc_len;\n\tuint32_t\ttag_loc;\n} __packed;\n\n/* Recorded Address [4/7.1] */\nstruct lb_addr {\n\tuint32_t\tlb_num;\n\tuint16_t\tpart_num;\n} __packed;\n\n/* Extent Descriptor [3/7.1] */\nstruct extent_ad {\n\tuint32_t\tlen;\n\tuint32_t\tloc;\n} __packed;\n\n/* Short Allocation Descriptor [4/14.14.1] */\nstruct short_ad {\n\tuint32_t\tlen;\n\tuint32_t\tpos;\n} __packed;\n\n/* Long Allocation Descriptor [4/14.14.2] */\nstruct long_ad {\n\tuint32_t\tlen;\n\tstruct lb_addr\tloc;\n\tuint16_t\tad_flags;\n\tuint32_t\tad_id;\n} __packed;\n\n/* Extended Allocation Descriptor [4/14.14.3] */\nstruct ext_ad {\n\tuint32_t\tex_len;\n\tuint32_t\trec_len;\n\tuint32_t\tinf_len;\n\tstruct lb_addr\tex_loc;\n\tuint8_t\t\treserved[2];\n} __packed;\n\nunion icb {\n\tstruct short_ad\ts_ad;\n\tstruct long_ad\tl_ad;\n\tstruct ext_ad\te_ad;\n};\n\n/* Character set spec [1/7.2.1] */\nstruct charspec {\n\tuint8_t\t\ttype;\n\tuint8_t\t\tinf[63];\n} __packed;\n\n/* Timestamp [1/7.3] */\nstruct timestamp {\n\tuint16_t\ttype_tz;\n\tuint16_t\tyear;\n\tuint8_t\t\tmonth;\n\tuint8_t\t\tday;\n\tuint8_t\t\thour;\n\tuint8_t\t\tminute;\n\tuint8_t\t\tsecond;\n\tuint8_t\t\tcentisec;\n\tuint8_t\t\thund_usec;\n\tuint8_t\t\tusec;\n} __packed;\n\n/* Entity Identifier [1/7.4] */\n#define\tUDF_REGID_ID_SIZE\t23\nstruct regid {\n\tuint8_t\t\tflags;\n\tuint8_t\t\tid[UDF_REGID_ID_SIZE];\n\tuint8_t\t\tid_suffix[8];\n} __packed;\n\n/* ICB Tag [4/14.6] */\nstruct icb_tag {\n\tuint32_t\tprev_num_dirs;\n\tuint16_t\tstrat_type;\n\tuint8_t\t\tstrat_param[2];\n\tuint16_t\tmax_num_entries;\n\tuint8_t\t\treserved;\n\tuint8_t\t\tfile_type;\n\tstruct lb_addr\tparent_icb;\n\tuint16_t\tflags;\n} __packed;\n#define\tUDF_ICB_TAG_FLAGS_SETUID\t0x40\n#define\tUDF_ICB_TAG_FLAGS_SETGID\t0x80\n#define\tUDF_ICB_TAG_FLAGS_STICKY\t0x100\n\n/* Anchor Volume Descriptor Pointer [3/10.2] */\nstruct anchor_vdp {\n\tstruct desc_tag\t\ttag;\n\tstruct extent_ad\tmain_vds_ex;\n\tstruct extent_ad\treserve_vds_ex;\n} __packed;\n\n/* Volume Descriptor Pointer [3/10.3] */\nstruct vol_desc_ptr {\n\tstruct desc_tag\t\ttag;\n\tuint32_t\t\tvds_number;\n\tstruct extent_ad\tnext_vds_ex;\n} __packed;\n\n/* Primary Volume Descriptor [3/10.1] */\nstruct pri_vol_desc {\n\tstruct desc_tag\t\ttag;\n\tuint32_t\t\tseq_num;\n\tuint32_t\t\tpdv_num;\n\tchar\t\t\tvol_id[32];\n\tuint16_t\t\tvds_num;\n\tuint16_t\t\tmax_vol_seq;\n\tuint16_t\t\tichg_lvl;\n\tuint16_t\t\tmax_ichg_lvl;\n\tuint32_t\t\tcharset_list;\n\tuint32_t\t\tmax_charset_list;\n\tchar\t\t\tvolset_id[128];\n\tstruct charspec\t\tdesc_charset;\n\tstruct charspec\t\texplanatory_charset;\n\tstruct extent_ad\tvol_abstract;\n\tstruct extent_ad\tvol_copyright;\n\tstruct regid\t\tapp_id;\n\tstruct timestamp\ttime;\n\tstruct regid\t\timp_id;\n\tuint8_t\t\t\timp_use[64];\n\tuint32_t\t\tprev_vds_lov;\n\tuint16_t\t\tflags;\n\tuint8_t\t\t\treserved[22];\n} __packed;\n\n/* Logical Volume Descriptor [3/10.6] */\nstruct logvol_desc {\n\tstruct desc_tag\t\ttag;\n\tuint32_t\t\tseq_num;\n\tstruct charspec\t\tdesc_charset;\n\tchar\t\t\tlogvol_id[128];\n\tuint32_t\t\tlb_size;\n\tstruct regid\t\tdomain_id;\n\tunion {\n\t\tstruct long_ad\tfsd_loc;\n\t\tuint8_t\t\tlogvol_content_use[16];\n\t} _lvd_use;\n\tuint32_t\t\tmt_l; /* Partition map length */\n\tuint32_t\t\tn_pm; /* Number of partition maps */\n\tstruct regid\t\timp_id;\n\tuint8_t\t\t\timp_use[128];\n\tstruct extent_ad\tintegrity_seq_id;\n\tuint8_t\t\t\tmaps[1];\n} __packed;\n\n/* Type 1 Partition Map [3/10.7.2] */\nstruct part_map_1 {\n\tuint8_t\t\t\ttype;\n\tuint8_t\t\t\tlen;\n\tuint16_t\t\tvol_seq_num;\n\tuint16_t\t\tpart_num;\n} __packed;\n\n#define\tUDF_PMAP_TYPE1_SIZE\t6\n\n/* Type 2 Partition Map [3/10.7.3] */\nstruct part_map_2 {\n\tuint8_t\t\t\ttype;\n\tuint8_t\t\t\tlen;\n\tuint8_t\t\t\tpart_id[62];\n} __packed;\n\n#define\tUDF_PMAP_TYPE2_SIZE\t64\n\n/* Virtual Partition Map [UDF 2.01/2.2.8] */\nstruct part_map_virt {\n\tuint8_t\t\t\ttype;\n\tuint8_t\t\t\tlen;\n\tuint8_t\t\t\treserved[2];\n\tstruct regid\t\tid;\n\tuint16_t\t\tvol_seq_num;\n\tuint16_t\t\tpart_num;\n\tuint8_t\t\t\treserved1[24];\n} __packed;\n\n/* Sparable Partition Map [UDF 2.01/2.2.9] */\nstruct part_map_spare {\n\tuint8_t\t\t\ttype;\n\tuint8_t\t\t\tlen;\n\tuint8_t\t\t\treserved[2];\n\tstruct regid\t\tid;\n\tuint16_t\t\tvol_seq_num;\n\tuint16_t\t\tpart_num;\n\tuint16_t\t\tpacket_len;\n\tuint8_t\t\t\tn_st;\t/* Number of Sparing Tables */\n\tuint8_t\t\t\treserved1;\n\tuint32_t\t\tst_size;\n\tuint32_t\t\tst_loc[1];\n} __packed;\n\nunion udf_pmap {\n\tstruct part_map_1\tpm1;\n\tstruct part_map_2\tpm2;\n\tstruct part_map_virt\tpmv;\n\tstruct part_map_spare\tpms;\n};\n\n/* Sparing Map Entry [UDF 2.01/2.2.11] */\nstruct spare_map_entry {\n\tuint32_t\t\torg;\n\tuint32_t\t\tmap;\n} __packed;\n\n/* Sparing Table [UDF 2.01/2.2.11] */\nstruct udf_sparing_table {\n\tstruct desc_tag\t\ttag;\n\tstruct regid\t\tid;\n\tuint16_t\t\trt_l;\t/* Relocation Table len */\n\tuint8_t\t\t\treserved[2];\n\tuint32_t\t\tseq_num;\n\tstruct spare_map_entry\tentries[1];\n} __packed;\n\n/* Partition Descriptor [3/10.5] */\nstruct part_desc {\n\tstruct desc_tag\ttag;\n\tuint32_t\tseq_num;\n\tuint16_t\tflags;\n\tuint16_t\tpart_num;\n\tstruct regid\tcontents;\n\tuint8_t\t\tcontents_use[128];\n\tuint32_t\taccess_type;\n\tuint32_t\tstart_loc;\n\tuint32_t\tpart_len;\n\tstruct regid\timp_id;\n\tuint8_t\t\timp_use[128];\n\tuint8_t\t\treserved[156];\n} __packed;\n\n/* File Set Descriptor [4/14.1] */\nstruct fileset_desc {\n\tstruct desc_tag\t\ttag;\n\tstruct timestamp\ttime;\n\tuint16_t\t\tichg_lvl;\n\tuint16_t\t\tmax_ichg_lvl;\n\tuint32_t\t\tcharset_list;\n\tuint32_t\t\tmax_charset_list;\n\tuint32_t\t\tfileset_num;\n\tuint32_t\t\tfileset_desc_num;\n\tstruct charspec\t\tlogvol_id_charset;\n\tchar\t\t\tlogvol_id[128];\n\tstruct charspec\t\tfileset_charset;\n\tchar\t\t\tfileset_id[32];\n\tchar\t\t\tcopyright_file_id[32];\n\tchar\t\t\tabstract_file_id[32];\n\tstruct long_ad\t\trootdir_icb;\n\tstruct regid\t\tdomain_id;\n\tstruct long_ad\t\tnext_ex;\n\tstruct long_ad\t\tstreamdir_icb;\n\tuint8_t\t\t\treserved[32];\n} __packed;\n\n/* File Identifier Descriptor [4/14.4] */\nstruct fileid_desc {\n\tstruct desc_tag\ttag;\n\tuint16_t\tfile_num;\n\tuint8_t\t\tfile_char;\n\tuint8_t\t\tl_fi;\t/* Length of file identifier area */\n\tstruct long_ad\ticb;\n\tuint16_t\tl_iu;\t/* Length of implementation use area */\n\tuint8_t\t\tdata[1];\n} __packed;\n#define\tUDF_FID_SIZE\t38\n#define\tUDF_FILE_CHAR_VIS\t(1 << 0) /* Visible */\n#define\tUDF_FILE_CHAR_DIR\t(1 << 1) /* Directory */\n#define\tUDF_FILE_CHAR_DEL\t(1 << 2) /* Deleted */\n#define\tUDF_FILE_CHAR_PAR\t(1 << 3) /* Parent Directory */\n#define\tUDF_FILE_CHAR_META\t(1 << 4) /* Stream metadata */\n\n/* File Entry [4/14.9] */\nstruct file_entry {\n\tstruct desc_tag\t\ttag;\n\tstruct icb_tag\t\ticbtag;\n\tuint32_t\t\tuid;\n\tuint32_t\t\tgid;\n\tuint32_t\t\tperm;\n\tuint16_t\t\tlink_cnt;\n\tuint8_t\t\t\trec_format;\n\tuint8_t\t\t\trec_disp_attr;\n\tuint32_t\t\trec_len;\n\tuint64_t\t\tinf_len;\n\tuint64_t\t\tlogblks_rec;\n\tstruct timestamp\tatime;\n\tstruct timestamp\tmtime;\n\tstruct timestamp\tattrtime;\n\tuint32_t\t\tckpoint;\n\tstruct long_ad\t\tex_attr_icb;\n\tstruct regid\t\timp_id;\n\tuint64_t\t\tunique_id;\n\tuint32_t\t\tl_ea;\t/* Length of extended attribute area */\n\tuint32_t\t\tl_ad;\t/* Length of allocation descriptors */\n\tuint8_t\t\t\tdata[1];\n} __packed;\n#define\tUDF_FENTRY_SIZE\t176\n#define\tUDF_FENTRY_PERM_USER_MASK\t0x07\n#define\tUDF_FENTRY_PERM_GRP_MASK\t0xE0\n#define\tUDF_FENTRY_PERM_OWNER_MASK\t0x1C00\n\n/* Path Component [4/14.16.1] */\nstruct path_component {\n\tuint8_t\t\t\ttype;\n\tuint8_t\t\t\tlength;\n\tuint16_t\t\tversion;\n\tuint8_t\t\t\tidentifier[1];\n} __packed;\n#define\tUDF_PATH_ROOT\t\t2\n#define\tUDF_PATH_DOTDOT\t\t3\n#define\tUDF_PATH_DOT\t\t4\n#define\tUDF_PATH_PATH\t\t5\n\nunion dscrptr {\n\tstruct desc_tag\t\ttag;\n\tstruct anchor_vdp\tavdp;\n\tstruct vol_desc_ptr\tvdp;\n\tstruct pri_vol_desc\tpvd;\n\tstruct logvol_desc\tlvd;\n\tstruct part_desc\tpd;\n\tstruct fileset_desc\tfsd;\n\tstruct fileid_desc\tfid;\n\tstruct file_entry\tfe;\n};\n\n/* Useful defines */\n\n#define\tGETICB(ad_type, fentry, offset)\t\\\n\t(struct ad_type *)&fentry->data[offset]\n\n#define\tGETICBLEN(ad_type, icb)\tle32toh(((struct ad_type *)(icb))->len)\n"
  },
  {
    "path": "freebsd-headers/fs/udf/osta.h",
    "content": "/*\n * Prototypes for the OSTA functions\n *\n * $FreeBSD: release/9.0.0/sys/fs/udf/osta.h 162255 2006-09-12 19:02:34Z imp $\n */\n\n/*-\n **********************************************************************\n * OSTA compliant Unicode compression, uncompression routines.\n * Copyright 1995 Micro Design International, Inc.\n * Written by Jason M. Rinn.\n * Micro Design International gives permission for the free use of the\n * following source code.\n */\n\n/*\n * Various routines from the OSTA 2.01 specs.  Copyrights are included with\n * each code segment.  Slight whitespace modifications have been made for\n * formatting purposes.  Typos/bugs have been fixed.\n */\n\n#ifndef UNIX\n#define\tUNIX\n#endif\n\n#ifndef MAXLEN\n#define\tMAXLEN\t255\n#endif\n\n/***********************************************************************\n * The following two typedef's are to remove compiler dependancies.\n * byte needs to be unsigned 8-bit, and unicode_t needs to be\n * unsigned 16-bit.\n */\ntypedef unsigned short unicode_t;\ntypedef unsigned char byte;\n\nint udf_UncompressUnicode(int, byte *, unicode_t *);\nint udf_UncompressUnicodeByte(int, byte *, byte *);\nint udf_CompressUnicode(int, int, unicode_t *, byte *);\nunsigned short udf_cksum(unsigned char *, int);\nunsigned short udf_unicode_cksum(unsigned short *, int);\nint UDFTransName(unicode_t *, unicode_t *, int);\n"
  },
  {
    "path": "freebsd-headers/fs/udf/udf.h",
    "content": "/*-\n * Copyright (c) 2001, 2002 Scott Long <scottl@freebsd.org>\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/fs/udf/udf.h 189082 2009-02-26 18:58:41Z avg $\n */\n\n#define UDF_HASHTBLSIZE 100\n\nstruct udf_node {\n\tstruct vnode\t*i_vnode;\n\tstruct udf_mnt\t*udfmp;\n\tino_t\t\thash_id;\n\tlong\t\tdiroff;\n\tstruct file_entry *fentry;\n};\n\nstruct udf_mnt {\n\tint\t\t\tim_flags;\n\tstruct mount\t\t*im_mountp;\n\tstruct g_consumer\t*im_cp;\n\tstruct bufobj\t\t*im_bo;\n\tstruct cdev *im_dev;\n\tstruct vnode\t\t*im_devvp;\n\tint\t\t\tbsize;\n\tint\t\t\tbshift;\n\tint\t\t\tbmask;\n\tuint32_t\t\tpart_start;\n\tuint32_t\t\tpart_len;\n\tuint64_t\t\troot_id;\n\tstruct long_ad\t\troot_icb;\n\tint\t\t\tp_sectors;\n\tint\t\t\ts_table_entries;\n\tstruct udf_sparing_table *s_table;\n\tvoid\t\t\t*im_d2l;\t/* disk->local iconv handle */\n#if 0\n\tvoid\t\t\t*im_l2d;\t/* local->disk iconv handle */\n#endif\n};\n\nstruct udf_dirstream {\n\tstruct udf_node\t*node;\n\tstruct udf_mnt\t*udfmp;\n\tstruct buf\t*bp;\n\tuint8_t\t\t*data;\n\tuint8_t\t\t*buf;\n\tint\t\tfsize;\n\tint\t\toff;\n\tint\t\tthis_off;\n\tint\t\toffset;\n\tint\t\tsize;\n\tint\t\terror;\n\tint\t\tfid_fragment;\n};\n\nstruct ifid {\n\tu_short\tifid_len;\n\tu_short\tifid_pad;\n\tint\tifid_ino;\n\tlong\tifid_start;\n};\n\n#define\tVFSTOUDFFS(mp)\t((struct udf_mnt *)((mp)->mnt_data))\n#define\tVTON(vp)\t((struct udf_node *)((vp)->v_data))\n\n/*\n * The block layer refers to things in terms of 512 byte blocks by default.\n * btodb() is expensive, so speed things up.\n * XXX Can the block layer be forced to use a different block size?\n */\n#define\tRDSECTOR(devvp, sector, size, bp) \\\n\tbread(devvp, sector << (udfmp->bshift - DEV_BSHIFT), size, NOCRED, bp)\n\nMALLOC_DECLARE(M_UDFFENTRY);\n\nstatic __inline int\nudf_readdevblks(struct udf_mnt *udfmp, int sector, int size, struct buf **bp)\n{\n\treturn (RDSECTOR(udfmp->im_devvp, sector,\n\t\t\t (size + udfmp->bmask) & ~udfmp->bmask, bp));\n}\n\n/*\n * Produce a suitable file number from an ICB.  The passed in ICB is expected\n * to be in little endian (meaning that it hasn't been swapped for big\n * endian machines yet).\n * XXX If the fileno resolves to 0, we might be in big trouble.\n * XXX Assumes the ICB is a long_ad.  This struct is compatible with short_ad,\n *     but not ext_ad.\n */\nstatic __inline ino_t\nudf_getid(struct long_ad *icb)\n{\n\treturn (le32toh(icb->loc.lb_num));\n}\n\nint udf_allocv(struct mount *, struct vnode **, struct thread *);\nint udf_checktag(struct desc_tag *, uint16_t);\nint udf_vget(struct mount *, ino_t, int, struct vnode **);\n\nextern uma_zone_t udf_zone_trans;\nextern uma_zone_t udf_zone_node;\nextern uma_zone_t udf_zone_ds;\n\nextern struct vop_vector udf_fifoops;\n"
  },
  {
    "path": "freebsd-headers/fs/udf/udf_mount.h",
    "content": "/*-\n * Copyright (c) 2003 Ryuichiro Imura\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/fs/udf/udf_mount.h 122102 2003-11-05 06:56:08Z scottl $\n */\n\n#define\tUDFMNT_KICONV\t0x00000001\n"
  },
  {
    "path": "freebsd-headers/fs/unionfs/union.h",
    "content": "/*-\n * Copyright (c) 1994 The Regents of the University of California.\n * Copyright (c) 1994 Jan-Simon Pendry.\n * Copyright (c) 2005, 2006 Masanori Ozawa <ozawa@ongs.co.jp>, ONGS Inc.\n * Copyright (c) 2006 Daichi Goto <daichi@freebsd.org>\n * All rights reserved.\n *\n * This code is derived from software donated to Berkeley by\n * Jan-Simon Pendry.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 4. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t@(#)union.h\t8.9 (Berkeley) 12/10/94\n * $FreeBSD: release/9.0.0/sys/fs/unionfs/union.h 185283 2008-11-25 03:18:35Z daichi $\n */\n\n#ifdef _KERNEL\n\n/* copy method of attr from lower to upper */\ntypedef enum _unionfs_copymode {\n\tUNIONFS_TRADITIONAL = 0,\n\tUNIONFS_TRANSPARENT,\n\tUNIONFS_MASQUERADE\n} unionfs_copymode;\n\n/* whiteout policy of upper layer */\ntypedef enum _unionfs_whitemode {\n       UNIONFS_WHITE_ALWAYS = 0,\n       UNIONFS_WHITE_WHENNEEDED\n} unionfs_whitemode;\n\nstruct unionfs_mount {\n\tstruct vnode   *um_lowervp;\t/* VREFed once */\n\tstruct vnode   *um_uppervp;\t/* VREFed once */\n\tstruct vnode   *um_rootvp;\t/* ROOT vnode */\n\tunionfs_copymode um_copymode;\n\tunionfs_whitemode um_whitemode;\n\tuid_t\t\tum_uid;\n\tgid_t\t\tum_gid;\n\tu_short\t\tum_udir;\n\tu_short\t\tum_ufile;\n};\n\n/* unionfs status list */\nstruct unionfs_node_status {\n\tLIST_ENTRY(unionfs_node_status) uns_list;\t/* Status list */\n\tpid_t\t\tuns_pid;\t\t/* current process id */\n\tint\t\tuns_node_flag;\t\t/* uns flag */\n\tint\t\tuns_lower_opencnt;\t/* open count of lower */\n\tint\t\tuns_upper_opencnt;\t/* open count of upper */\n\tint\t\tuns_lower_openmode;\t/* open mode of lower */\n\tint\t\tuns_readdir_status;\t/* read status of readdir */\n};\n\n/* union node status flags */\n#define\tUNS_OPENL_4_READDIR\t0x01\t/* open lower layer for readdir */\n\n/* A cache of vnode references */\nstruct unionfs_node {\n\tstruct vnode   *un_lowervp;\t\t/* lower side vnode */\n\tstruct vnode   *un_uppervp;\t\t/* upper side vnode */\n\tstruct vnode   *un_dvp;\t\t\t/* parent unionfs vnode */\n\tstruct vnode   *un_vnode;\t\t/* Back pointer */\n\tLIST_HEAD(, unionfs_node_status) un_unshead;\n\t\t\t\t\t\t/* unionfs status head */\n\tLIST_HEAD(unionfs_node_hashhead, unionfs_node) *un_hashtbl;\n\t\t\t\t\t\t/* dir vnode hash table */\n\tLIST_ENTRY(unionfs_node)   un_hash;\t/* hash list entry */\n\tu_long\t\tun_hashmask;\t\t/* bit mask */\n\tchar           *un_path;\t\t/* path */\n\tint\t\tun_flag;\t\t/* unionfs node flag */\n};\n\n/*\n * unionfs node flags\n * It needs the vnode with exclusive lock, when changing the un_flag variable.\n */\n#define UNIONFS_OPENEXTL\t0x01\t/* openextattr (lower) */\n#define UNIONFS_OPENEXTU\t0x02\t/* openextattr (upper) */\n\n#define\tMOUNTTOUNIONFSMOUNT(mp) ((struct unionfs_mount *)((mp)->mnt_data))\n#define\tVTOUNIONFS(vp) ((struct unionfs_node *)(vp)->v_data)\n#define\tUNIONFSTOV(xp) ((xp)->un_vnode)\n\nint unionfs_init(struct vfsconf *vfsp);\nint unionfs_uninit(struct vfsconf *vfsp);\nint unionfs_nodeget(struct mount *mp, struct vnode *uppervp, struct vnode *lowervp, struct vnode *dvp, struct vnode **vpp, struct componentname *cnp, struct thread *td);\nvoid unionfs_noderem(struct vnode *vp, struct thread *td);\nvoid unionfs_get_node_status(struct unionfs_node *unp, struct thread *td, struct unionfs_node_status **unspp);\nvoid unionfs_tryrem_node_status(struct unionfs_node *unp, struct unionfs_node_status *unsp);\n\nint unionfs_check_rmdir(struct vnode *vp, struct ucred *cred, struct thread *td);\nint unionfs_copyfile(struct unionfs_node *unp, int docopy, struct ucred *cred, struct thread *td);\nvoid unionfs_create_uppervattr_core(struct unionfs_mount *ump, struct vattr *lva, struct vattr *uva, struct thread *td);\nint unionfs_create_uppervattr(struct unionfs_mount *ump, struct vnode *lvp, struct vattr *uva, struct ucred *cred, struct thread *td);\nint unionfs_mkshadowdir(struct unionfs_mount *ump, struct vnode *duvp, struct unionfs_node *unp, struct componentname *cnp, struct thread *td);\nint unionfs_mkwhiteout(struct vnode *dvp, struct componentname *cnp, struct thread *td, char *path);\nint unionfs_relookup(struct vnode *dvp, struct vnode **vpp, struct componentname *cnp, struct componentname *cn, struct thread *td, char *path, int pathlen, u_long nameiop);\nint unionfs_relookup_for_create(struct vnode *dvp, struct componentname *cnp, struct thread *td);\nint unionfs_relookup_for_delete(struct vnode *dvp, struct componentname *cnp, struct thread *td);\nint unionfs_relookup_for_rename(struct vnode *dvp, struct componentname *cnp, struct thread *td);\n\n#ifdef DIAGNOSTIC\nstruct vnode   *unionfs_checklowervp(struct vnode *vp, char *fil, int lno);\nstruct vnode   *unionfs_checkuppervp(struct vnode *vp, char *fil, int lno);\n#define\tUNIONFSVPTOLOWERVP(vp) unionfs_checklowervp((vp), __FILE__, __LINE__)\n#define\tUNIONFSVPTOUPPERVP(vp) unionfs_checkuppervp((vp), __FILE__, __LINE__)\n#else\n#define\tUNIONFSVPTOLOWERVP(vp) (VTOUNIONFS(vp)->un_lowervp)\n#define\tUNIONFSVPTOUPPERVP(vp) (VTOUNIONFS(vp)->un_uppervp)\n#endif\n\nextern struct vop_vector unionfs_vnodeops;\n\n#ifdef MALLOC_DECLARE\nMALLOC_DECLARE(M_UNIONFSNODE);\nMALLOC_DECLARE(M_UNIONFSPATH);\n#endif\n\n#ifdef UNIONFS_DEBUG\n#define UNIONFSDEBUG(format, args...) printf(format ,## args)\n#else\n#define UNIONFSDEBUG(format, args...)\n#endif\t\t\t\t/* UNIONFS_DEBUG */\n\n#endif\t\t\t\t/* _KERNEL */\n"
  },
  {
    "path": "freebsd-headers/fstab.h",
    "content": "/*\n * Copyright (c) 1980, 1993\n *\tThe Regents of the University of California.  All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t@(#)fstab.h\t8.1 (Berkeley) 6/2/93\n * $FreeBSD: release/9.0.0/include/fstab.h 203964 2010-02-16 19:39:50Z imp $\n */\n\n#ifndef _FSTAB_H_\n#define _FSTAB_H_\n\n/*\n * File system table, see fstab(5).\n *\n * Used by dump, mount, umount, swapon, fsck, df, ...\n *\n * For ufs fs_spec field is the block special name.  Programs that want to\n * use the character special name must create that name by prepending a 'r'\n * after the right most slash.  Quota files are always named \"quotas\", so\n * if type is \"rq\", then use concatenation of fs_file and \"quotas\" to locate\n * quota file.\n */\n#define\t_PATH_FSTAB\t\"/etc/fstab\"\n#define\tFSTAB\t\t\"/etc/fstab\"\t/* deprecated */\n\n#define\tFSTAB_RW\t\"rw\"\t\t/* read/write device */\n#define\tFSTAB_RQ\t\"rq\"\t\t/* read/write with quotas */\n#define\tFSTAB_RO\t\"ro\"\t\t/* read-only device */\n#define\tFSTAB_SW\t\"sw\"\t\t/* swap device */\n#define\tFSTAB_XX\t\"xx\"\t\t/* ignore totally */\n\nstruct fstab {\n\tchar\t*fs_spec;\t\t/* block special device name */\n\tchar\t*fs_file;\t\t/* file system path prefix */\n\tchar\t*fs_vfstype;\t\t/* File system type, ufs, nfs */\n\tchar\t*fs_mntops;\t\t/* Mount options ala -o */\n\tchar\t*fs_type;\t\t/* FSTAB_* from fs_mntops */\n\tint\tfs_freq;\t\t/* dump frequency, in days */\n\tint\tfs_passno;\t\t/* pass number on parallel fsck */\n};\n\n#include <sys/cdefs.h>\n\n__BEGIN_DECLS\nstruct fstab *getfsent(void);\nstruct fstab *getfsspec(const char *);\nstruct fstab *getfsfile(const char *);\nint setfsent(void);\nvoid endfsent(void);\nvoid setfstab(const char *);\nconst char *getfstab(void);\n__END_DECLS\n\n#endif /* !_FSTAB_H_ */\n"
  },
  {
    "path": "freebsd-headers/ftpio.h",
    "content": "#ifndef _FTP_H_INCLUDE\n#define _FTP_H_INCLUDE\n\n#include <sys/types.h>\n#include <sys/cdefs.h>\n#include <stdio.h>\n#include <time.h>\n\n/*\n * ----------------------------------------------------------------------------\n * \"THE BEER-WARE LICENSE\" (Revision 42):\n * <phk@FreeBSD.org> wrote this file.  As long as you retain this notice you\n * can do whatever you want with this stuff. If we meet some day, and you think\n * this stuff is worth it, you can buy me a beer in return.   Poul-Henning Kamp\n * ----------------------------------------------------------------------------\n *\n * Major Changelog:\n *\n * Jordan K. Hubbard\n * 17 Jan 1996\n *\n * Turned inside out. Now returns xfers as new file ids, not as a special\n * `state' of FTP_t\n *\n * $FreeBSD: release/9.0.0/lib/libftpio/ftpio.h 93149 2002-03-25 13:52:45Z phk $\n */\n\n/* Internal housekeeping data structure for FTP sessions */\ntypedef struct {\n    enum { init, isopen, quit } con_state;\n    int\t\tfd_ctrl;\n    int\t\taddrtype;\n    char\t*host;\n    char\t*file;\n    int\t\terror;\n    int\t\tis_binary;\n    int\t\tis_passive;\n    int\t\tis_verbose;\n} *FTP_t;\n\n/* Structure we use to match FTP error codes with readable strings */\nstruct ftperr {\n  const int\tnum;\n  const char\t*string;\n};\n\n__BEGIN_DECLS\nextern struct\tftperr ftpErrList[];\nextern int\tconst ftpErrListLength;\n\n/* Exported routines - deal only with FILE* type */\nextern FILE\t*ftpLogin(char *host, char *user, char *passwd,\tint port, int verbose, int *retcode);\nextern int\tftpChdir(FILE *fp, char *dir);\nextern int\tftpErrno(FILE *fp);\nextern off_t\tftpGetSize(FILE *fp, char *file);\nextern FILE\t*ftpGet(FILE *fp, char *file, off_t *seekto);\nextern FILE\t*ftpPut(FILE *fp, char *file);\nextern int\tftpAscii(FILE *fp);\nextern int\tftpBinary(FILE *fp);\nextern int\tftpPassive(FILE *fp, int status);\nextern void\tftpVerbose(FILE *fp, int status);\nextern FILE\t*ftpGetURL(char\t*url, char *user, char *passwd,\tint *retcode);\nextern FILE\t*ftpPutURL(char\t*url, char *user, char *passwd,\tint *retcode);\nextern time_t\tftpGetModtime(FILE *fp, char *s);\nextern const\tchar *ftpErrString(int error);\nextern FILE\t*ftpLoginAf(char *host, int af, char *user, char *passwd,\tint port, int verbose, int *retcode);\nextern FILE\t*ftpGetURLAf(char *url, int af, char *user, char *passwd, int *retcode);\nextern FILE\t*ftpPutURLAf(char *url, int af, char *user, char *passwd, int *retcode);\n__END_DECLS\n\n#endif\t/* _FTP_H_INCLUDE */\n"
  },
  {
    "path": "freebsd-headers/fts.h",
    "content": "/*\n * Copyright (c) 1989, 1993\n *\tThe Regents of the University of California.  All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t@(#)fts.h\t8.3 (Berkeley) 8/14/94\n * $FreeBSD: release/9.0.0/include/fts.h 203964 2010-02-16 19:39:50Z imp $\n */\n\n#ifndef\t_FTS_H_\n#define\t_FTS_H_\n\ntypedef struct {\n\tstruct _ftsent *fts_cur;\t/* current node */\n\tstruct _ftsent *fts_child;\t/* linked list of children */\n\tstruct _ftsent **fts_array;\t/* sort array */\n\tdev_t fts_dev;\t\t\t/* starting device # */\n\tchar *fts_path;\t\t\t/* path for this descent */\n\tint fts_rfd;\t\t\t/* fd for root */\n\tsize_t fts_pathlen;\t\t/* sizeof(path) */\n\tsize_t fts_nitems;\t\t/* elements in the sort array */\n\tint (*fts_compar)\t\t/* compare function */\n\t    (const struct _ftsent * const *, const struct _ftsent * const *);\n\n#define\tFTS_COMFOLLOW\t0x001\t\t/* follow command line symlinks */\n#define\tFTS_LOGICAL\t0x002\t\t/* logical walk */\n#define\tFTS_NOCHDIR\t0x004\t\t/* don't change directories */\n#define\tFTS_NOSTAT\t0x008\t\t/* don't get stat info */\n#define\tFTS_PHYSICAL\t0x010\t\t/* physical walk */\n#define\tFTS_SEEDOT\t0x020\t\t/* return dot and dot-dot */\n#define\tFTS_XDEV\t0x040\t\t/* don't cross devices */\n#define\tFTS_WHITEOUT\t0x080\t\t/* return whiteout information */\n#define\tFTS_OPTIONMASK\t0x0ff\t\t/* valid user option mask */\n\n#define\tFTS_NAMEONLY\t0x100\t\t/* (private) child names only */\n#define\tFTS_STOP\t0x200\t\t/* (private) unrecoverable error */\n\tint fts_options;\t\t/* fts_open options, global flags */\n\tvoid *fts_clientptr;\t\t/* thunk for sort function */\n} FTS;\n\ntypedef struct _ftsent {\n\tstruct _ftsent *fts_cycle;\t/* cycle node */\n\tstruct _ftsent *fts_parent;\t/* parent directory */\n\tstruct _ftsent *fts_link;\t/* next file in directory */\n\tlong long fts_number;\t\t/* local numeric value */\n#define\tfts_bignum\tfts_number\t/* XXX non-std, should go away */\n\tvoid *fts_pointer;\t\t/* local address value */\n\tchar *fts_accpath;\t\t/* access path */\n\tchar *fts_path;\t\t\t/* root path */\n\tint fts_errno;\t\t\t/* errno for this node */\n\tint fts_symfd;\t\t\t/* fd for symlink */\n\tsize_t fts_pathlen;\t\t/* strlen(fts_path) */\n\tsize_t fts_namelen;\t\t/* strlen(fts_name) */\n\n\tino_t fts_ino;\t\t\t/* inode */\n\tdev_t fts_dev;\t\t\t/* device */\n\tnlink_t fts_nlink;\t\t/* link count */\n\n#define\tFTS_ROOTPARENTLEVEL\t-1\n#define\tFTS_ROOTLEVEL\t\t 0\n\tlong fts_level;\t\t\t/* depth (-1 to N) */\n\n#define\tFTS_D\t\t 1\t\t/* preorder directory */\n#define\tFTS_DC\t\t 2\t\t/* directory that causes cycles */\n#define\tFTS_DEFAULT\t 3\t\t/* none of the above */\n#define\tFTS_DNR\t\t 4\t\t/* unreadable directory */\n#define\tFTS_DOT\t\t 5\t\t/* dot or dot-dot */\n#define\tFTS_DP\t\t 6\t\t/* postorder directory */\n#define\tFTS_ERR\t\t 7\t\t/* error; errno is set */\n#define\tFTS_F\t\t 8\t\t/* regular file */\n#define\tFTS_INIT\t 9\t\t/* initialized only */\n#define\tFTS_NS\t\t10\t\t/* stat(2) failed */\n#define\tFTS_NSOK\t11\t\t/* no stat(2) requested */\n#define\tFTS_SL\t\t12\t\t/* symbolic link */\n#define\tFTS_SLNONE\t13\t\t/* symbolic link without target */\n#define\tFTS_W\t\t14\t\t/* whiteout object */\n\tint fts_info;\t\t\t/* user status for FTSENT structure */\n\n#define\tFTS_DONTCHDIR\t 0x01\t\t/* don't chdir .. to the parent */\n#define\tFTS_SYMFOLLOW\t 0x02\t\t/* followed a symlink to get here */\n#define\tFTS_ISW\t\t 0x04\t\t/* this is a whiteout object */\n\tunsigned fts_flags;\t\t/* private flags for FTSENT structure */\n\n#define\tFTS_AGAIN\t 1\t\t/* read node again */\n#define\tFTS_FOLLOW\t 2\t\t/* follow symbolic link */\n#define\tFTS_NOINSTR\t 3\t\t/* no instructions */\n#define\tFTS_SKIP\t 4\t\t/* discard node */\n\tint fts_instr;\t\t\t/* fts_set() instructions */\n\n\tstruct stat *fts_statp;\t\t/* stat(2) information */\n\tchar *fts_name;\t\t\t/* file name */\n\tFTS *fts_fts;\t\t\t/* back pointer to main FTS */\n} FTSENT;\n\n#include <sys/cdefs.h>\n\n__BEGIN_DECLS\nFTSENT\t*fts_children(FTS *, int);\nint\t fts_close(FTS *);\nvoid\t*fts_get_clientptr(FTS *);\n#define\t fts_get_clientptr(fts)\t((fts)->fts_clientptr)\nFTS\t*fts_get_stream(FTSENT *);\n#define\t fts_get_stream(ftsent)\t((ftsent)->fts_fts)\nFTS\t*fts_open(char * const *, int,\n\t    int (*)(const FTSENT * const *, const FTSENT * const *));\nFTSENT\t*fts_read(FTS *);\nint\t fts_set(FTS *, FTSENT *, int);\nvoid\t fts_set_clientptr(FTS *, void *);\n__END_DECLS\n\n#endif /* !_FTS_H_ */\n"
  },
  {
    "path": "freebsd-headers/ftw.h",
    "content": "/*\t$OpenBSD: ftw.h,v 1.1 2003/07/21 21:13:18 millert Exp $\t*/\n\n/*\n * Copyright (c) 2003 Todd C. Miller <Todd.Miller@courtesan.com>\n *\n * Permission to use, copy, modify, and distribute this software for any\n * purpose with or without fee is hereby granted, provided that the above\n * copyright notice and this permission notice appear in all copies.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES\n * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF\n * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR\n * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES\n * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN\n * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF\n * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.\n *\n * Sponsored in part by the Defense Advanced Research Projects\n * Agency (DARPA) and Air Force Research Laboratory, Air Force\n * Materiel Command, USAF, under agreement number F39502-99-1-0512.\n *\n * $FreeBSD: release/9.0.0/include/ftw.h 134244 2004-08-24 13:00:55Z tjr $\n */\n\n#ifndef\t_FTW_H\n#define\t_FTW_H\n\n#include <sys/types.h>\n#include <sys/stat.h>\n\n/*\n * Valid flags for the 3rd argument to the function that is passed as the\n * second argument to ftw(3) and nftw(3).  Say it three times fast!\n */\n#define\tFTW_F\t\t0\t/* File.  */\n#define\tFTW_D\t\t1\t/* Directory.  */\n#define\tFTW_DNR\t\t2\t/* Directory without read permission.  */\n#define\tFTW_DP\t\t3\t/* Directory with subdirectories visited.  */\n#define\tFTW_NS\t\t4\t/* Unknown type; stat() failed.  */\n#define\tFTW_SL\t\t5\t/* Symbolic link.  */\n#define\tFTW_SLN\t\t6\t/* Sym link that names a nonexistent file.  */\n\n/*\n * Flags for use as the 4th argument to nftw(3).  These may be ORed together.\n */\n#define\tFTW_PHYS\t0x01\t/* Physical walk, don't follow sym links.  */\n#define\tFTW_MOUNT\t0x02\t/* The walk does not cross a mount point.  */\n#define\tFTW_DEPTH\t0x04\t/* Subdirs visited before the dir itself. */\n#define\tFTW_CHDIR\t0x08\t/* Change to a directory before reading it. */\n\nstruct FTW {\n\tint base;\n\tint level;\n};\n\n__BEGIN_DECLS\nint\tftw(const char *, int (*)(const char *, const struct stat *, int), int);\nint\tnftw(const char *, int (*)(const char *, const struct stat *, int,\n\t    struct FTW *), int, int);\n__END_DECLS\n\n#endif\t/* !_FTW_H */\n"
  },
  {
    "path": "freebsd-headers/gcc/4.2/emmintrin.h",
    "content": "/* Copyright (C) 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc.\n\n   This file is part of GCC.\n\n   GCC is free software; you can redistribute it and/or modify\n   it under the terms of the GNU General Public License as published by\n   the Free Software Foundation; either version 2, or (at your option)\n   any later version.\n\n   GCC is distributed in the hope that it will be useful,\n   but WITHOUT ANY WARRANTY; without even the implied warranty of\n   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n   GNU General Public License for more details.\n\n   You should have received a copy of the GNU General Public License\n   along with GCC; see the file COPYING.  If not, write to\n   the Free Software Foundation, 51 Franklin Street, Fifth Floor,\n   Boston, MA 02110-1301, USA.  */\n\n/* As a special exception, if you include this header file into source\n   files compiled by GCC, this header file does not by itself cause\n   the resulting executable to be covered by the GNU General Public\n   License.  This exception does not however invalidate any other\n   reasons why the executable file might be covered by the GNU General\n   Public License.  */\n\n/* Implemented from the specification included in the Intel C++ Compiler\n   User Guide and Reference, version 9.0.  */\n\n#ifndef _EMMINTRIN_H_INCLUDED\n#define _EMMINTRIN_H_INCLUDED\n\n#ifdef __SSE2__\n#include <xmmintrin.h>\n\n/* SSE2 */\ntypedef double __v2df __attribute__ ((__vector_size__ (16)));\ntypedef long long __v2di __attribute__ ((__vector_size__ (16)));\ntypedef int __v4si __attribute__ ((__vector_size__ (16)));\ntypedef short __v8hi __attribute__ ((__vector_size__ (16)));\ntypedef char __v16qi __attribute__ ((__vector_size__ (16)));\n\n/* The Intel API is flexible enough that we must allow aliasing with other\n   vector types, and their scalar components.  */\ntypedef long long __m128i __attribute__ ((__vector_size__ (16), __may_alias__));\ntypedef double __m128d __attribute__ ((__vector_size__ (16), __may_alias__));\n\n/* Create a selector for use with the SHUFPD instruction.  */\n#define _MM_SHUFFLE2(fp1,fp0) \\\n (((fp1) << 1) | (fp0))\n\n/* Create a vector with element 0 as F and the rest zero.  */\nstatic __inline __m128d __attribute__((__always_inline__))\n_mm_set_sd (double __F)\n{\n  return __extension__ (__m128d){ __F, 0 };\n}\n\n/* Create a vector with both elements equal to F.  */\nstatic __inline __m128d __attribute__((__always_inline__))\n_mm_set1_pd (double __F)\n{\n  return __extension__ (__m128d){ __F, __F };\n}\n\nstatic __inline __m128d __attribute__((__always_inline__))\n_mm_set_pd1 (double __F)\n{\n  return _mm_set1_pd (__F);\n}\n\n/* Create a vector with the lower value X and upper value W.  */\nstatic __inline __m128d __attribute__((__always_inline__))\n_mm_set_pd (double __W, double __X)\n{\n  return __extension__ (__m128d){ __X, __W };\n}\n\n/* Create a vector with the lower value W and upper value X.  */\nstatic __inline __m128d __attribute__((__always_inline__))\n_mm_setr_pd (double __W, double __X)\n{\n  return __extension__ (__m128d){ __W, __X };\n}\n\n/* Create a vector of zeros.  */\nstatic __inline __m128d __attribute__((__always_inline__))\n_mm_setzero_pd (void)\n{\n  return __extension__ (__m128d){ 0.0, 0.0 };\n}\n\n/* Sets the low DPFP value of A from the low value of B.  */\nstatic __inline __m128d __attribute__((__always_inline__))\n_mm_move_sd (__m128d __A, __m128d __B)\n{\n  return (__m128d) __builtin_ia32_movsd ((__v2df)__A, (__v2df)__B);\n}\n\n/* Load two DPFP values from P.  The address must be 16-byte aligned.  */\nstatic __inline __m128d __attribute__((__always_inline__))\n_mm_load_pd (double const *__P)\n{\n  return *(__m128d *)__P;\n}\n\n/* Load two DPFP values from P.  The address need not be 16-byte aligned.  */\nstatic __inline __m128d __attribute__((__always_inline__))\n_mm_loadu_pd (double const *__P)\n{\n  return __builtin_ia32_loadupd (__P);\n}\n\n/* Create a vector with all two elements equal to *P.  */\nstatic __inline __m128d __attribute__((__always_inline__))\n_mm_load1_pd (double const *__P)\n{\n  return _mm_set1_pd (*__P);\n}\n\n/* Create a vector with element 0 as *P and the rest zero.  */\nstatic __inline __m128d __attribute__((__always_inline__))\n_mm_load_sd (double const *__P)\n{\n  return _mm_set_sd (*__P);\n}\n\nstatic __inline __m128d __attribute__((__always_inline__))\n_mm_load_pd1 (double const *__P)\n{\n  return _mm_load1_pd (__P);\n}\n\n/* Load two DPFP values in reverse order.  The address must be aligned.  */\nstatic __inline __m128d __attribute__((__always_inline__))\n_mm_loadr_pd (double const *__P)\n{\n  __m128d __tmp = _mm_load_pd (__P);\n  return __builtin_ia32_shufpd (__tmp, __tmp, _MM_SHUFFLE2 (0,1));\n}\n\n/* Store two DPFP values.  The address must be 16-byte aligned.  */\nstatic __inline void __attribute__((__always_inline__))\n_mm_store_pd (double *__P, __m128d __A)\n{\n  *(__m128d *)__P = __A;\n}\n\n/* Store two DPFP values.  The address need not be 16-byte aligned.  */\nstatic __inline void __attribute__((__always_inline__))\n_mm_storeu_pd (double *__P, __m128d __A)\n{\n  __builtin_ia32_storeupd (__P, __A);\n}\n\n/* Stores the lower DPFP value.  */\nstatic __inline void __attribute__((__always_inline__))\n_mm_store_sd (double *__P, __m128d __A)\n{\n  *__P = __builtin_ia32_vec_ext_v2df (__A, 0);\n}\n\nstatic __inline double __attribute__((__always_inline__))\n_mm_cvtsd_f64 (__m128d __A)\n{\n  return __builtin_ia32_vec_ext_v2df (__A, 0);\n}\n\nstatic __inline void __attribute__((__always_inline__))\n_mm_storel_pd (double *__P, __m128d __A)\n{\n  _mm_store_sd (__P, __A);\n}\n\n/* Stores the upper DPFP value.  */\nstatic __inline void __attribute__((__always_inline__))\n_mm_storeh_pd (double *__P, __m128d __A)\n{\n  *__P = __builtin_ia32_vec_ext_v2df (__A, 1);\n}\n\n/* Store the lower DPFP value across two words.\n   The address must be 16-byte aligned.  */\nstatic __inline void __attribute__((__always_inline__))\n_mm_store1_pd (double *__P, __m128d __A)\n{\n  _mm_store_pd (__P, __builtin_ia32_shufpd (__A, __A, _MM_SHUFFLE2 (0,0)));\n}\n\nstatic __inline void __attribute__((__always_inline__))\n_mm_store_pd1 (double *__P, __m128d __A)\n{\n  _mm_store1_pd (__P, __A);\n}\n\n/* Store two DPFP values in reverse order.  The address must be aligned.  */\nstatic __inline void __attribute__((__always_inline__))\n_mm_storer_pd (double *__P, __m128d __A)\n{\n  _mm_store_pd (__P, __builtin_ia32_shufpd (__A, __A, _MM_SHUFFLE2 (0,1)));\n}\n\nstatic __inline int __attribute__((__always_inline__))\n_mm_cvtsi128_si32 (__m128i __A)\n{\n  return __builtin_ia32_vec_ext_v4si ((__v4si)__A, 0);\n}\n\n#ifdef __x86_64__\n/* Intel intrinsic.  */\nstatic __inline long long __attribute__((__always_inline__))\n_mm_cvtsi128_si64 (__m128i __A)\n{\n  return __builtin_ia32_vec_ext_v2di ((__v2di)__A, 0);\n}\n\n/* Microsoft intrinsic.  */\nstatic __inline long long __attribute__((__always_inline__))\n_mm_cvtsi128_si64x (__m128i __A)\n{\n  return __builtin_ia32_vec_ext_v2di ((__v2di)__A, 0);\n}\n#endif\n\nstatic __inline __m128d __attribute__((__always_inline__))\n_mm_add_pd (__m128d __A, __m128d __B)\n{\n  return (__m128d)__builtin_ia32_addpd ((__v2df)__A, (__v2df)__B);\n}\n\nstatic __inline __m128d __attribute__((__always_inline__))\n_mm_add_sd (__m128d __A, __m128d __B)\n{\n  return (__m128d)__builtin_ia32_addsd ((__v2df)__A, (__v2df)__B);\n}\n\nstatic __inline __m128d __attribute__((__always_inline__))\n_mm_sub_pd (__m128d __A, __m128d __B)\n{\n  return (__m128d)__builtin_ia32_subpd ((__v2df)__A, (__v2df)__B);\n}\n\nstatic __inline __m128d __attribute__((__always_inline__))\n_mm_sub_sd (__m128d __A, __m128d __B)\n{\n  return (__m128d)__builtin_ia32_subsd ((__v2df)__A, (__v2df)__B);\n}\n\nstatic __inline __m128d __attribute__((__always_inline__))\n_mm_mul_pd (__m128d __A, __m128d __B)\n{\n  return (__m128d)__builtin_ia32_mulpd ((__v2df)__A, (__v2df)__B);\n}\n\nstatic __inline __m128d __attribute__((__always_inline__))\n_mm_mul_sd (__m128d __A, __m128d __B)\n{\n  return (__m128d)__builtin_ia32_mulsd ((__v2df)__A, (__v2df)__B);\n}\n\nstatic __inline __m128d __attribute__((__always_inline__))\n_mm_div_pd (__m128d __A, __m128d __B)\n{\n  return (__m128d)__builtin_ia32_divpd ((__v2df)__A, (__v2df)__B);\n}\n\nstatic __inline __m128d __attribute__((__always_inline__))\n_mm_div_sd (__m128d __A, __m128d __B)\n{\n  return (__m128d)__builtin_ia32_divsd ((__v2df)__A, (__v2df)__B);\n}\n\nstatic __inline __m128d __attribute__((__always_inline__))\n_mm_sqrt_pd (__m128d __A)\n{\n  return (__m128d)__builtin_ia32_sqrtpd ((__v2df)__A);\n}\n\n/* Return pair {sqrt (A[0), B[1]}.  */\nstatic __inline __m128d __attribute__((__always_inline__))\n_mm_sqrt_sd (__m128d __A, __m128d __B)\n{\n  __v2df __tmp = __builtin_ia32_movsd ((__v2df)__A, (__v2df)__B);\n  return (__m128d)__builtin_ia32_sqrtsd ((__v2df)__tmp);\n}\n\nstatic __inline __m128d __attribute__((__always_inline__))\n_mm_min_pd (__m128d __A, __m128d __B)\n{\n  return (__m128d)__builtin_ia32_minpd ((__v2df)__A, (__v2df)__B);\n}\n\nstatic __inline __m128d __attribute__((__always_inline__))\n_mm_min_sd (__m128d __A, __m128d __B)\n{\n  return (__m128d)__builtin_ia32_minsd ((__v2df)__A, (__v2df)__B);\n}\n\nstatic __inline __m128d __attribute__((__always_inline__))\n_mm_max_pd (__m128d __A, __m128d __B)\n{\n  return (__m128d)__builtin_ia32_maxpd ((__v2df)__A, (__v2df)__B);\n}\n\nstatic __inline __m128d __attribute__((__always_inline__))\n_mm_max_sd (__m128d __A, __m128d __B)\n{\n  return (__m128d)__builtin_ia32_maxsd ((__v2df)__A, (__v2df)__B);\n}\n\nstatic __inline __m128d __attribute__((__always_inline__))\n_mm_and_pd (__m128d __A, __m128d __B)\n{\n  return (__m128d)__builtin_ia32_andpd ((__v2df)__A, (__v2df)__B);\n}\n\nstatic __inline __m128d __attribute__((__always_inline__))\n_mm_andnot_pd (__m128d __A, __m128d __B)\n{\n  return (__m128d)__builtin_ia32_andnpd ((__v2df)__A, (__v2df)__B);\n}\n\nstatic __inline __m128d __attribute__((__always_inline__))\n_mm_or_pd (__m128d __A, __m128d __B)\n{\n  return (__m128d)__builtin_ia32_orpd ((__v2df)__A, (__v2df)__B);\n}\n\nstatic __inline __m128d __attribute__((__always_inline__))\n_mm_xor_pd (__m128d __A, __m128d __B)\n{\n  return (__m128d)__builtin_ia32_xorpd ((__v2df)__A, (__v2df)__B);\n}\n\nstatic __inline __m128d __attribute__((__always_inline__))\n_mm_cmpeq_pd (__m128d __A, __m128d __B)\n{\n  return (__m128d)__builtin_ia32_cmpeqpd ((__v2df)__A, (__v2df)__B);\n}\n\nstatic __inline __m128d __attribute__((__always_inline__))\n_mm_cmplt_pd (__m128d __A, __m128d __B)\n{\n  return (__m128d)__builtin_ia32_cmpltpd ((__v2df)__A, (__v2df)__B);\n}\n\nstatic __inline __m128d __attribute__((__always_inline__))\n_mm_cmple_pd (__m128d __A, __m128d __B)\n{\n  return (__m128d)__builtin_ia32_cmplepd ((__v2df)__A, (__v2df)__B);\n}\n\nstatic __inline __m128d __attribute__((__always_inline__))\n_mm_cmpgt_pd (__m128d __A, __m128d __B)\n{\n  return (__m128d)__builtin_ia32_cmpgtpd ((__v2df)__A, (__v2df)__B);\n}\n\nstatic __inline __m128d __attribute__((__always_inline__))\n_mm_cmpge_pd (__m128d __A, __m128d __B)\n{\n  return (__m128d)__builtin_ia32_cmpgepd ((__v2df)__A, (__v2df)__B);\n}\n\nstatic __inline __m128d __attribute__((__always_inline__))\n_mm_cmpneq_pd (__m128d __A, __m128d __B)\n{\n  return (__m128d)__builtin_ia32_cmpneqpd ((__v2df)__A, (__v2df)__B);\n}\n\nstatic __inline __m128d __attribute__((__always_inline__))\n_mm_cmpnlt_pd (__m128d __A, __m128d __B)\n{\n  return (__m128d)__builtin_ia32_cmpnltpd ((__v2df)__A, (__v2df)__B);\n}\n\nstatic __inline __m128d __attribute__((__always_inline__))\n_mm_cmpnle_pd (__m128d __A, __m128d __B)\n{\n  return (__m128d)__builtin_ia32_cmpnlepd ((__v2df)__A, (__v2df)__B);\n}\n\nstatic __inline __m128d __attribute__((__always_inline__))\n_mm_cmpngt_pd (__m128d __A, __m128d __B)\n{\n  return (__m128d)__builtin_ia32_cmpngtpd ((__v2df)__A, (__v2df)__B);\n}\n\nstatic __inline __m128d __attribute__((__always_inline__))\n_mm_cmpnge_pd (__m128d __A, __m128d __B)\n{\n  return (__m128d)__builtin_ia32_cmpngepd ((__v2df)__A, (__v2df)__B);\n}\n\nstatic __inline __m128d __attribute__((__always_inline__))\n_mm_cmpord_pd (__m128d __A, __m128d __B)\n{\n  return (__m128d)__builtin_ia32_cmpordpd ((__v2df)__A, (__v2df)__B);\n}\n\nstatic __inline __m128d __attribute__((__always_inline__))\n_mm_cmpunord_pd (__m128d __A, __m128d __B)\n{\n  return (__m128d)__builtin_ia32_cmpunordpd ((__v2df)__A, (__v2df)__B);\n}\n\nstatic __inline __m128d __attribute__((__always_inline__))\n_mm_cmpeq_sd (__m128d __A, __m128d __B)\n{\n  return (__m128d)__builtin_ia32_cmpeqsd ((__v2df)__A, (__v2df)__B);\n}\n\nstatic __inline __m128d __attribute__((__always_inline__))\n_mm_cmplt_sd (__m128d __A, __m128d __B)\n{\n  return (__m128d)__builtin_ia32_cmpltsd ((__v2df)__A, (__v2df)__B);\n}\n\nstatic __inline __m128d __attribute__((__always_inline__))\n_mm_cmple_sd (__m128d __A, __m128d __B)\n{\n  return (__m128d)__builtin_ia32_cmplesd ((__v2df)__A, (__v2df)__B);\n}\n\nstatic __inline __m128d __attribute__((__always_inline__))\n_mm_cmpgt_sd (__m128d __A, __m128d __B)\n{\n  return (__m128d) __builtin_ia32_movsd ((__v2df) __A,\n\t\t\t\t\t (__v2df)\n\t\t\t\t\t __builtin_ia32_cmpltsd ((__v2df) __B,\n\t\t\t\t\t\t\t\t (__v2df)\n\t\t\t\t\t\t\t\t __A));\n}\n\nstatic __inline __m128d __attribute__((__always_inline__))\n_mm_cmpge_sd (__m128d __A, __m128d __B)\n{\n  return (__m128d) __builtin_ia32_movsd ((__v2df) __A,\n\t\t\t\t\t (__v2df)\n\t\t\t\t\t __builtin_ia32_cmplesd ((__v2df) __B,\n\t\t\t\t\t\t\t\t (__v2df)\n\t\t\t\t\t\t\t\t __A));\n}\n\nstatic __inline __m128d __attribute__((__always_inline__))\n_mm_cmpneq_sd (__m128d __A, __m128d __B)\n{\n  return (__m128d)__builtin_ia32_cmpneqsd ((__v2df)__A, (__v2df)__B);\n}\n\nstatic __inline __m128d __attribute__((__always_inline__))\n_mm_cmpnlt_sd (__m128d __A, __m128d __B)\n{\n  return (__m128d)__builtin_ia32_cmpnltsd ((__v2df)__A, (__v2df)__B);\n}\n\nstatic __inline __m128d __attribute__((__always_inline__))\n_mm_cmpnle_sd (__m128d __A, __m128d __B)\n{\n  return (__m128d)__builtin_ia32_cmpnlesd ((__v2df)__A, (__v2df)__B);\n}\n\nstatic __inline __m128d __attribute__((__always_inline__))\n_mm_cmpngt_sd (__m128d __A, __m128d __B)\n{\n  return (__m128d) __builtin_ia32_movsd ((__v2df) __A,\n\t\t\t\t\t (__v2df)\n\t\t\t\t\t __builtin_ia32_cmpnltsd ((__v2df) __B,\n\t\t\t\t\t\t\t\t  (__v2df)\n\t\t\t\t\t\t\t\t  __A));\n}\n\nstatic __inline __m128d __attribute__((__always_inline__))\n_mm_cmpnge_sd (__m128d __A, __m128d __B)\n{\n  return (__m128d) __builtin_ia32_movsd ((__v2df) __A,\n\t\t\t\t\t (__v2df)\n\t\t\t\t\t __builtin_ia32_cmpnlesd ((__v2df) __B,\n\t\t\t\t\t\t\t\t  (__v2df)\n\t\t\t\t\t\t\t\t  __A));\n}\n\nstatic __inline __m128d __attribute__((__always_inline__))\n_mm_cmpord_sd (__m128d __A, __m128d __B)\n{\n  return (__m128d)__builtin_ia32_cmpordsd ((__v2df)__A, (__v2df)__B);\n}\n\nstatic __inline __m128d __attribute__((__always_inline__))\n_mm_cmpunord_sd (__m128d __A, __m128d __B)\n{\n  return (__m128d)__builtin_ia32_cmpunordsd ((__v2df)__A, (__v2df)__B);\n}\n\nstatic __inline int __attribute__((__always_inline__))\n_mm_comieq_sd (__m128d __A, __m128d __B)\n{\n  return __builtin_ia32_comisdeq ((__v2df)__A, (__v2df)__B);\n}\n\nstatic __inline int __attribute__((__always_inline__))\n_mm_comilt_sd (__m128d __A, __m128d __B)\n{\n  return __builtin_ia32_comisdlt ((__v2df)__A, (__v2df)__B);\n}\n\nstatic __inline int __attribute__((__always_inline__))\n_mm_comile_sd (__m128d __A, __m128d __B)\n{\n  return __builtin_ia32_comisdle ((__v2df)__A, (__v2df)__B);\n}\n\nstatic __inline int __attribute__((__always_inline__))\n_mm_comigt_sd (__m128d __A, __m128d __B)\n{\n  return __builtin_ia32_comisdgt ((__v2df)__A, (__v2df)__B);\n}\n\nstatic __inline int __attribute__((__always_inline__))\n_mm_comige_sd (__m128d __A, __m128d __B)\n{\n  return __builtin_ia32_comisdge ((__v2df)__A, (__v2df)__B);\n}\n\nstatic __inline int __attribute__((__always_inline__))\n_mm_comineq_sd (__m128d __A, __m128d __B)\n{\n  return __builtin_ia32_comisdneq ((__v2df)__A, (__v2df)__B);\n}\n\nstatic __inline int __attribute__((__always_inline__))\n_mm_ucomieq_sd (__m128d __A, __m128d __B)\n{\n  return __builtin_ia32_ucomisdeq ((__v2df)__A, (__v2df)__B);\n}\n\nstatic __inline int __attribute__((__always_inline__))\n_mm_ucomilt_sd (__m128d __A, __m128d __B)\n{\n  return __builtin_ia32_ucomisdlt ((__v2df)__A, (__v2df)__B);\n}\n\nstatic __inline int __attribute__((__always_inline__))\n_mm_ucomile_sd (__m128d __A, __m128d __B)\n{\n  return __builtin_ia32_ucomisdle ((__v2df)__A, (__v2df)__B);\n}\n\nstatic __inline int __attribute__((__always_inline__))\n_mm_ucomigt_sd (__m128d __A, __m128d __B)\n{\n  return __builtin_ia32_ucomisdgt ((__v2df)__A, (__v2df)__B);\n}\n\nstatic __inline int __attribute__((__always_inline__))\n_mm_ucomige_sd (__m128d __A, __m128d __B)\n{\n  return __builtin_ia32_ucomisdge ((__v2df)__A, (__v2df)__B);\n}\n\nstatic __inline int __attribute__((__always_inline__))\n_mm_ucomineq_sd (__m128d __A, __m128d __B)\n{\n  return __builtin_ia32_ucomisdneq ((__v2df)__A, (__v2df)__B);\n}\n\n/* Create a vector of Qi, where i is the element number.  */\n\nstatic __inline __m128i __attribute__((__always_inline__))\n_mm_set_epi64x (long long __q1, long long __q0)\n{\n  return __extension__ (__m128i)(__v2di){ __q0, __q1 };\n}\n\nstatic __inline __m128i __attribute__((__always_inline__))\n_mm_set_epi64 (__m64 __q1,  __m64 __q0)\n{\n  return _mm_set_epi64x ((long long)__q1, (long long)__q0);\n}\n\nstatic __inline __m128i __attribute__((__always_inline__))\n_mm_set_epi32 (int __q3, int __q2, int __q1, int __q0)\n{\n  return __extension__ (__m128i)(__v4si){ __q0, __q1, __q2, __q3 };\n}\n\nstatic __inline __m128i __attribute__((__always_inline__))\n_mm_set_epi16 (short __q7, short __q6, short __q5, short __q4,\n\t       short __q3, short __q2, short __q1, short __q0)\n{\n  return __extension__ (__m128i)(__v8hi){\n    __q0, __q1, __q2, __q3, __q4, __q5, __q6, __q7 };\n}\n\nstatic __inline __m128i __attribute__((__always_inline__))\n_mm_set_epi8 (char __q15, char __q14, char __q13, char __q12,\n\t      char __q11, char __q10, char __q09, char __q08,\n\t      char __q07, char __q06, char __q05, char __q04,\n\t      char __q03, char __q02, char __q01, char __q00)\n{\n  return __extension__ (__m128i)(__v16qi){\n    __q00, __q01, __q02, __q03, __q04, __q05, __q06, __q07,\n    __q08, __q09, __q10, __q11, __q12, __q13, __q14, __q15\n  };\n}\n\n/* Set all of the elements of the vector to A.  */\n\nstatic __inline __m128i __attribute__((__always_inline__))\n_mm_set1_epi64x (long long __A)\n{\n  return _mm_set_epi64x (__A, __A);\n}\n\nstatic __inline __m128i __attribute__((__always_inline__))\n_mm_set1_epi64 (__m64 __A)\n{\n  return _mm_set_epi64 (__A, __A);\n}\n\nstatic __inline __m128i __attribute__((__always_inline__))\n_mm_set1_epi32 (int __A)\n{\n  return _mm_set_epi32 (__A, __A, __A, __A);\n}\n\nstatic __inline __m128i __attribute__((__always_inline__))\n_mm_set1_epi16 (short __A)\n{\n  return _mm_set_epi16 (__A, __A, __A, __A, __A, __A, __A, __A);\n}\n\nstatic __inline __m128i __attribute__((__always_inline__))\n_mm_set1_epi8 (char __A)\n{\n  return _mm_set_epi8 (__A, __A, __A, __A, __A, __A, __A, __A,\n\t\t       __A, __A, __A, __A, __A, __A, __A, __A);\n}\n\n/* Create a vector of Qi, where i is the element number.\n   The parameter order is reversed from the _mm_set_epi* functions.  */\n\nstatic __inline __m128i __attribute__((__always_inline__))\n_mm_setr_epi64 (__m64 __q0, __m64 __q1)\n{\n  return _mm_set_epi64 (__q1, __q0);\n}\n\nstatic __inline __m128i __attribute__((__always_inline__))\n_mm_setr_epi32 (int __q0, int __q1, int __q2, int __q3)\n{\n  return _mm_set_epi32 (__q3, __q2, __q1, __q0);\n}\n\nstatic __inline __m128i __attribute__((__always_inline__))\n_mm_setr_epi16 (short __q0, short __q1, short __q2, short __q3,\n\t        short __q4, short __q5, short __q6, short __q7)\n{\n  return _mm_set_epi16 (__q7, __q6, __q5, __q4, __q3, __q2, __q1, __q0);\n}\n\nstatic __inline __m128i __attribute__((__always_inline__))\n_mm_setr_epi8 (char __q00, char __q01, char __q02, char __q03,\n\t       char __q04, char __q05, char __q06, char __q07,\n\t       char __q08, char __q09, char __q10, char __q11,\n\t       char __q12, char __q13, char __q14, char __q15)\n{\n  return _mm_set_epi8 (__q15, __q14, __q13, __q12, __q11, __q10, __q09, __q08,\n\t\t       __q07, __q06, __q05, __q04, __q03, __q02, __q01, __q00);\n}\n\n/* Create a vector with element 0 as *P and the rest zero.  */\n\nstatic __inline __m128i __attribute__((__always_inline__))\n_mm_load_si128 (__m128i const *__P)\n{\n  return *__P;\n}\n\nstatic __inline __m128i __attribute__((__always_inline__))\n_mm_loadu_si128 (__m128i const *__P)\n{\n  return (__m128i) __builtin_ia32_loaddqu ((char const *)__P);\n}\n\nstatic __inline __m128i __attribute__((__always_inline__))\n_mm_loadl_epi64 (__m128i const *__P)\n{\n  return _mm_set_epi64 ((__m64)0LL, *(__m64 *)__P);\n}\n\nstatic __inline void __attribute__((__always_inline__))\n_mm_store_si128 (__m128i *__P, __m128i __B)\n{\n  *__P = __B;\n}\n\nstatic __inline void __attribute__((__always_inline__))\n_mm_storeu_si128 (__m128i *__P, __m128i __B)\n{\n  __builtin_ia32_storedqu ((char *)__P, (__v16qi)__B);\n}\n\nstatic __inline void __attribute__((__always_inline__))\n_mm_storel_epi64 (__m128i *__P, __m128i __B)\n{\n  *(long long *)__P = __builtin_ia32_vec_ext_v2di ((__v2di)__B, 0);\n}\n\nstatic __inline __m64 __attribute__((__always_inline__))\n_mm_movepi64_pi64 (__m128i __B)\n{\n  return (__m64) __builtin_ia32_vec_ext_v2di ((__v2di)__B, 0);\n}\n\nstatic __inline __m128i __attribute__((__always_inline__))\n_mm_movpi64_epi64 (__m64 __A)\n{\n  return _mm_set_epi64 ((__m64)0LL, __A);\n}\n\nstatic __inline __m128i __attribute__((__always_inline__))\n_mm_move_epi64 (__m128i __A)\n{\n  return _mm_set_epi64 ((__m64)0LL, _mm_movepi64_pi64 (__A));\n}\n\n/* Create a vector of zeros.  */\nstatic __inline __m128i __attribute__((__always_inline__))\n_mm_setzero_si128 (void)\n{\n  return __extension__ (__m128i)(__v4si){ 0, 0, 0, 0 };\n}\n\nstatic __inline __m128d __attribute__((__always_inline__))\n_mm_cvtepi32_pd (__m128i __A)\n{\n  return (__m128d)__builtin_ia32_cvtdq2pd ((__v4si) __A);\n}\n\nstatic __inline __m128 __attribute__((__always_inline__))\n_mm_cvtepi32_ps (__m128i __A)\n{\n  return (__m128)__builtin_ia32_cvtdq2ps ((__v4si) __A);\n}\n\nstatic __inline __m128i __attribute__((__always_inline__))\n_mm_cvtpd_epi32 (__m128d __A)\n{\n  return (__m128i)__builtin_ia32_cvtpd2dq ((__v2df) __A);\n}\n\nstatic __inline __m64 __attribute__((__always_inline__))\n_mm_cvtpd_pi32 (__m128d __A)\n{\n  return (__m64)__builtin_ia32_cvtpd2pi ((__v2df) __A);\n}\n\nstatic __inline __m128 __attribute__((__always_inline__))\n_mm_cvtpd_ps (__m128d __A)\n{\n  return (__m128)__builtin_ia32_cvtpd2ps ((__v2df) __A);\n}\n\nstatic __inline __m128i __attribute__((__always_inline__))\n_mm_cvttpd_epi32 (__m128d __A)\n{\n  return (__m128i)__builtin_ia32_cvttpd2dq ((__v2df) __A);\n}\n\nstatic __inline __m64 __attribute__((__always_inline__))\n_mm_cvttpd_pi32 (__m128d __A)\n{\n  return (__m64)__builtin_ia32_cvttpd2pi ((__v2df) __A);\n}\n\nstatic __inline __m128d __attribute__((__always_inline__))\n_mm_cvtpi32_pd (__m64 __A)\n{\n  return (__m128d)__builtin_ia32_cvtpi2pd ((__v2si) __A);\n}\n\nstatic __inline __m128i __attribute__((__always_inline__))\n_mm_cvtps_epi32 (__m128 __A)\n{\n  return (__m128i)__builtin_ia32_cvtps2dq ((__v4sf) __A);\n}\n\nstatic __inline __m128i __attribute__((__always_inline__))\n_mm_cvttps_epi32 (__m128 __A)\n{\n  return (__m128i)__builtin_ia32_cvttps2dq ((__v4sf) __A);\n}\n\nstatic __inline __m128d __attribute__((__always_inline__))\n_mm_cvtps_pd (__m128 __A)\n{\n  return (__m128d)__builtin_ia32_cvtps2pd ((__v4sf) __A);\n}\n\nstatic __inline int __attribute__((__always_inline__))\n_mm_cvtsd_si32 (__m128d __A)\n{\n  return __builtin_ia32_cvtsd2si ((__v2df) __A);\n}\n\n#ifdef __x86_64__\n/* Intel intrinsic.  */\nstatic __inline long long __attribute__((__always_inline__))\n_mm_cvtsd_si64 (__m128d __A)\n{\n  return __builtin_ia32_cvtsd2si64 ((__v2df) __A);\n}\n\n/* Microsoft intrinsic.  */\nstatic __inline long long __attribute__((__always_inline__))\n_mm_cvtsd_si64x (__m128d __A)\n{\n  return __builtin_ia32_cvtsd2si64 ((__v2df) __A);\n}\n#endif\n\nstatic __inline int __attribute__((__always_inline__))\n_mm_cvttsd_si32 (__m128d __A)\n{\n  return __builtin_ia32_cvttsd2si ((__v2df) __A);\n}\n\n#ifdef __x86_64__\n/* Intel intrinsic.  */\nstatic __inline long long __attribute__((__always_inline__))\n_mm_cvttsd_si64 (__m128d __A)\n{\n  return __builtin_ia32_cvttsd2si64 ((__v2df) __A);\n}\n\n/* Microsoft intrinsic.  */\nstatic __inline long long __attribute__((__always_inline__))\n_mm_cvttsd_si64x (__m128d __A)\n{\n  return __builtin_ia32_cvttsd2si64 ((__v2df) __A);\n}\n#endif\n\nstatic __inline __m128 __attribute__((__always_inline__))\n_mm_cvtsd_ss (__m128 __A, __m128d __B)\n{\n  return (__m128)__builtin_ia32_cvtsd2ss ((__v4sf) __A, (__v2df) __B);\n}\n\nstatic __inline __m128d __attribute__((__always_inline__))\n_mm_cvtsi32_sd (__m128d __A, int __B)\n{\n  return (__m128d)__builtin_ia32_cvtsi2sd ((__v2df) __A, __B);\n}\n\n#ifdef __x86_64__\n/* Intel intrinsic.  */\nstatic __inline __m128d __attribute__((__always_inline__))\n_mm_cvtsi64_sd (__m128d __A, long long __B)\n{\n  return (__m128d)__builtin_ia32_cvtsi642sd ((__v2df) __A, __B);\n}\n\n/* Microsoft intrinsic.  */\nstatic __inline __m128d __attribute__((__always_inline__))\n_mm_cvtsi64x_sd (__m128d __A, long long __B)\n{\n  return (__m128d)__builtin_ia32_cvtsi642sd ((__v2df) __A, __B);\n}\n#endif\n\nstatic __inline __m128d __attribute__((__always_inline__))\n_mm_cvtss_sd (__m128d __A, __m128 __B)\n{\n  return (__m128d)__builtin_ia32_cvtss2sd ((__v2df) __A, (__v4sf)__B);\n}\n\n#define _mm_shuffle_pd(__A, __B, __C) ((__m128d)__builtin_ia32_shufpd ((__v2df)__A, (__v2df)__B, (__C)))\n\nstatic __inline __m128d __attribute__((__always_inline__))\n_mm_unpackhi_pd (__m128d __A, __m128d __B)\n{\n  return (__m128d)__builtin_ia32_unpckhpd ((__v2df)__A, (__v2df)__B);\n}\n\nstatic __inline __m128d __attribute__((__always_inline__))\n_mm_unpacklo_pd (__m128d __A, __m128d __B)\n{\n  return (__m128d)__builtin_ia32_unpcklpd ((__v2df)__A, (__v2df)__B);\n}\n\nstatic __inline __m128d __attribute__((__always_inline__))\n_mm_loadh_pd (__m128d __A, double const *__B)\n{\n  return (__m128d)__builtin_ia32_loadhpd ((__v2df)__A, __B);\n}\n\nstatic __inline __m128d __attribute__((__always_inline__))\n_mm_loadl_pd (__m128d __A, double const *__B)\n{\n  return (__m128d)__builtin_ia32_loadlpd ((__v2df)__A, __B);\n}\n\nstatic __inline int __attribute__((__always_inline__))\n_mm_movemask_pd (__m128d __A)\n{\n  return __builtin_ia32_movmskpd ((__v2df)__A);\n}\n\nstatic __inline __m128i __attribute__((__always_inline__))\n_mm_packs_epi16 (__m128i __A, __m128i __B)\n{\n  return (__m128i)__builtin_ia32_packsswb128 ((__v8hi)__A, (__v8hi)__B);\n}\n\nstatic __inline __m128i __attribute__((__always_inline__))\n_mm_packs_epi32 (__m128i __A, __m128i __B)\n{\n  return (__m128i)__builtin_ia32_packssdw128 ((__v4si)__A, (__v4si)__B);\n}\n\nstatic __inline __m128i __attribute__((__always_inline__))\n_mm_packus_epi16 (__m128i __A, __m128i __B)\n{\n  return (__m128i)__builtin_ia32_packuswb128 ((__v8hi)__A, (__v8hi)__B);\n}\n\nstatic __inline __m128i __attribute__((__always_inline__))\n_mm_unpackhi_epi8 (__m128i __A, __m128i __B)\n{\n  return (__m128i)__builtin_ia32_punpckhbw128 ((__v16qi)__A, (__v16qi)__B);\n}\n\nstatic __inline __m128i __attribute__((__always_inline__))\n_mm_unpackhi_epi16 (__m128i __A, __m128i __B)\n{\n  return (__m128i)__builtin_ia32_punpckhwd128 ((__v8hi)__A, (__v8hi)__B);\n}\n\nstatic __inline __m128i __attribute__((__always_inline__))\n_mm_unpackhi_epi32 (__m128i __A, __m128i __B)\n{\n  return (__m128i)__builtin_ia32_punpckhdq128 ((__v4si)__A, (__v4si)__B);\n}\n\nstatic __inline __m128i __attribute__((__always_inline__))\n_mm_unpackhi_epi64 (__m128i __A, __m128i __B)\n{\n  return (__m128i)__builtin_ia32_punpckhqdq128 ((__v2di)__A, (__v2di)__B);\n}\n\nstatic __inline __m128i __attribute__((__always_inline__))\n_mm_unpacklo_epi8 (__m128i __A, __m128i __B)\n{\n  return (__m128i)__builtin_ia32_punpcklbw128 ((__v16qi)__A, (__v16qi)__B);\n}\n\nstatic __inline __m128i __attribute__((__always_inline__))\n_mm_unpacklo_epi16 (__m128i __A, __m128i __B)\n{\n  return (__m128i)__builtin_ia32_punpcklwd128 ((__v8hi)__A, (__v8hi)__B);\n}\n\nstatic __inline __m128i __attribute__((__always_inline__))\n_mm_unpacklo_epi32 (__m128i __A, __m128i __B)\n{\n  return (__m128i)__builtin_ia32_punpckldq128 ((__v4si)__A, (__v4si)__B);\n}\n\nstatic __inline __m128i __attribute__((__always_inline__))\n_mm_unpacklo_epi64 (__m128i __A, __m128i __B)\n{\n  return (__m128i)__builtin_ia32_punpcklqdq128 ((__v2di)__A, (__v2di)__B);\n}\n\nstatic __inline __m128i __attribute__((__always_inline__))\n_mm_add_epi8 (__m128i __A, __m128i __B)\n{\n  return (__m128i)__builtin_ia32_paddb128 ((__v16qi)__A, (__v16qi)__B);\n}\n\nstatic __inline __m128i __attribute__((__always_inline__))\n_mm_add_epi16 (__m128i __A, __m128i __B)\n{\n  return (__m128i)__builtin_ia32_paddw128 ((__v8hi)__A, (__v8hi)__B);\n}\n\nstatic __inline __m128i __attribute__((__always_inline__))\n_mm_add_epi32 (__m128i __A, __m128i __B)\n{\n  return (__m128i)__builtin_ia32_paddd128 ((__v4si)__A, (__v4si)__B);\n}\n\nstatic __inline __m128i __attribute__((__always_inline__))\n_mm_add_epi64 (__m128i __A, __m128i __B)\n{\n  return (__m128i)__builtin_ia32_paddq128 ((__v2di)__A, (__v2di)__B);\n}\n\nstatic __inline __m128i __attribute__((__always_inline__))\n_mm_adds_epi8 (__m128i __A, __m128i __B)\n{\n  return (__m128i)__builtin_ia32_paddsb128 ((__v16qi)__A, (__v16qi)__B);\n}\n\nstatic __inline __m128i __attribute__((__always_inline__))\n_mm_adds_epi16 (__m128i __A, __m128i __B)\n{\n  return (__m128i)__builtin_ia32_paddsw128 ((__v8hi)__A, (__v8hi)__B);\n}\n\nstatic __inline __m128i __attribute__((__always_inline__))\n_mm_adds_epu8 (__m128i __A, __m128i __B)\n{\n  return (__m128i)__builtin_ia32_paddusb128 ((__v16qi)__A, (__v16qi)__B);\n}\n\nstatic __inline __m128i __attribute__((__always_inline__))\n_mm_adds_epu16 (__m128i __A, __m128i __B)\n{\n  return (__m128i)__builtin_ia32_paddusw128 ((__v8hi)__A, (__v8hi)__B);\n}\n\nstatic __inline __m128i __attribute__((__always_inline__))\n_mm_sub_epi8 (__m128i __A, __m128i __B)\n{\n  return (__m128i)__builtin_ia32_psubb128 ((__v16qi)__A, (__v16qi)__B);\n}\n\nstatic __inline __m128i __attribute__((__always_inline__))\n_mm_sub_epi16 (__m128i __A, __m128i __B)\n{\n  return (__m128i)__builtin_ia32_psubw128 ((__v8hi)__A, (__v8hi)__B);\n}\n\nstatic __inline __m128i __attribute__((__always_inline__))\n_mm_sub_epi32 (__m128i __A, __m128i __B)\n{\n  return (__m128i)__builtin_ia32_psubd128 ((__v4si)__A, (__v4si)__B);\n}\n\nstatic __inline __m128i __attribute__((__always_inline__))\n_mm_sub_epi64 (__m128i __A, __m128i __B)\n{\n  return (__m128i)__builtin_ia32_psubq128 ((__v2di)__A, (__v2di)__B);\n}\n\nstatic __inline __m128i __attribute__((__always_inline__))\n_mm_subs_epi8 (__m128i __A, __m128i __B)\n{\n  return (__m128i)__builtin_ia32_psubsb128 ((__v16qi)__A, (__v16qi)__B);\n}\n\nstatic __inline __m128i __attribute__((__always_inline__))\n_mm_subs_epi16 (__m128i __A, __m128i __B)\n{\n  return (__m128i)__builtin_ia32_psubsw128 ((__v8hi)__A, (__v8hi)__B);\n}\n\nstatic __inline __m128i __attribute__((__always_inline__))\n_mm_subs_epu8 (__m128i __A, __m128i __B)\n{\n  return (__m128i)__builtin_ia32_psubusb128 ((__v16qi)__A, (__v16qi)__B);\n}\n\nstatic __inline __m128i __attribute__((__always_inline__))\n_mm_subs_epu16 (__m128i __A, __m128i __B)\n{\n  return (__m128i)__builtin_ia32_psubusw128 ((__v8hi)__A, (__v8hi)__B);\n}\n\nstatic __inline __m128i __attribute__((__always_inline__))\n_mm_madd_epi16 (__m128i __A, __m128i __B)\n{\n  return (__m128i)__builtin_ia32_pmaddwd128 ((__v8hi)__A, (__v8hi)__B);\n}\n\nstatic __inline __m128i __attribute__((__always_inline__))\n_mm_mulhi_epi16 (__m128i __A, __m128i __B)\n{\n  return (__m128i)__builtin_ia32_pmulhw128 ((__v8hi)__A, (__v8hi)__B);\n}\n\nstatic __inline __m128i __attribute__((__always_inline__))\n_mm_mullo_epi16 (__m128i __A, __m128i __B)\n{\n  return (__m128i)__builtin_ia32_pmullw128 ((__v8hi)__A, (__v8hi)__B);\n}\n\nstatic __inline __m64 __attribute__((__always_inline__))\n_mm_mul_su32 (__m64 __A, __m64 __B)\n{\n  return (__m64)__builtin_ia32_pmuludq ((__v2si)__A, (__v2si)__B);\n}\n\nstatic __inline __m128i __attribute__((__always_inline__))\n_mm_mul_epu32 (__m128i __A, __m128i __B)\n{\n  return (__m128i)__builtin_ia32_pmuludq128 ((__v4si)__A, (__v4si)__B);\n}\n\n#if 0\nstatic __inline __m128i __attribute__((__always_inline__))\n_mm_slli_epi16 (__m128i __A, int __B)\n{\n  return (__m128i)__builtin_ia32_psllwi128 ((__v8hi)__A, __B);\n}\n\nstatic __inline __m128i __attribute__((__always_inline__))\n_mm_slli_epi32 (__m128i __A, int __B)\n{\n  return (__m128i)__builtin_ia32_pslldi128 ((__v4si)__A, __B);\n}\n\nstatic __inline __m128i __attribute__((__always_inline__))\n_mm_slli_epi64 (__m128i __A, int __B)\n{\n  return (__m128i)__builtin_ia32_psllqi128 ((__v2di)__A, __B);\n}\n#else\n#define _mm_slli_epi16(__A, __B) \\\n  ((__m128i)__builtin_ia32_psllwi128 ((__v8hi)(__A), __B))\n#define _mm_slli_epi32(__A, __B) \\\n  ((__m128i)__builtin_ia32_pslldi128 ((__v8hi)(__A), __B))\n#define _mm_slli_epi64(__A, __B) \\\n  ((__m128i)__builtin_ia32_psllqi128 ((__v8hi)(__A), __B))\n#endif\n\n#if 0\nstatic __inline __m128i __attribute__((__always_inline__))\n_mm_srai_epi16 (__m128i __A, int __B)\n{\n  return (__m128i)__builtin_ia32_psrawi128 ((__v8hi)__A, __B);\n}\n\nstatic __inline __m128i __attribute__((__always_inline__))\n_mm_srai_epi32 (__m128i __A, int __B)\n{\n  return (__m128i)__builtin_ia32_psradi128 ((__v4si)__A, __B);\n}\n#else\n#define _mm_srai_epi16(__A, __B) \\\n  ((__m128i)__builtin_ia32_psrawi128 ((__v8hi)(__A), __B))\n#define _mm_srai_epi32(__A, __B) \\\n  ((__m128i)__builtin_ia32_psradi128 ((__v8hi)(__A), __B))\n#endif\n\n#if 0\nstatic __m128i __attribute__((__always_inline__))\n_mm_srli_si128 (__m128i __A, int __B)\n{\n  return ((__m128i)__builtin_ia32_psrldqi128 (__A, __B * 8));\n}\n\nstatic __m128i __attribute__((__always_inline__))\n_mm_srli_si128 (__m128i __A, int __B)\n{\n  return ((__m128i)__builtin_ia32_pslldqi128 (__A, __B * 8));\n}\n#else\n#define _mm_srli_si128(__A, __B) \\\n  ((__m128i)__builtin_ia32_psrldqi128 (__A, (__B) * 8))\n#define _mm_slli_si128(__A, __B) \\\n  ((__m128i)__builtin_ia32_pslldqi128 (__A, (__B) * 8))\n#endif\n\n#if 0\nstatic __inline __m128i __attribute__((__always_inline__))\n_mm_srli_epi16 (__m128i __A, int __B)\n{\n  return (__m128i)__builtin_ia32_psrlwi128 ((__v8hi)__A, __B);\n}\n\nstatic __inline __m128i __attribute__((__always_inline__))\n_mm_srli_epi32 (__m128i __A, int __B)\n{\n  return (__m128i)__builtin_ia32_psrldi128 ((__v4si)__A, __B);\n}\n\nstatic __inline __m128i __attribute__((__always_inline__))\n_mm_srli_epi64 (__m128i __A, int __B)\n{\n  return (__m128i)__builtin_ia32_psrlqi128 ((__v2di)__A, __B);\n}\n#else\n#define _mm_srli_epi16(__A, __B) \\\n  ((__m128i)__builtin_ia32_psrlwi128 ((__v8hi)(__A), __B))\n#define _mm_srli_epi32(__A, __B) \\\n  ((__m128i)__builtin_ia32_psrldi128 ((__v4si)(__A), __B))\n#define _mm_srli_epi64(__A, __B) \\\n  ((__m128i)__builtin_ia32_psrlqi128 ((__v4si)(__A), __B))\n#endif\n\nstatic __inline __m128i __attribute__((__always_inline__))\n_mm_sll_epi16 (__m128i __A, __m128i __B)\n{\n  return (__m128i)__builtin_ia32_psllw128((__v8hi)__A, (__v8hi)__B);\n}\n\nstatic __inline __m128i __attribute__((__always_inline__))\n_mm_sll_epi32 (__m128i __A, __m128i __B)\n{\n  return (__m128i)__builtin_ia32_pslld128((__v4si)__A, (__v4si)__B);\n}\n\nstatic __inline __m128i __attribute__((__always_inline__))\n_mm_sll_epi64 (__m128i __A, __m128i __B)\n{\n  return (__m128i)__builtin_ia32_psllq128((__v2di)__A, (__v2di)__B);\n}\n\nstatic __inline __m128i __attribute__((__always_inline__))\n_mm_sra_epi16 (__m128i __A, __m128i __B)\n{\n  return (__m128i)__builtin_ia32_psraw128 ((__v8hi)__A, (__v8hi)__B);\n}\n\nstatic __inline __m128i __attribute__((__always_inline__))\n_mm_sra_epi32 (__m128i __A, __m128i __B)\n{\n  return (__m128i)__builtin_ia32_psrad128 ((__v4si)__A, (__v4si)__B);\n}\n\nstatic __inline __m128i __attribute__((__always_inline__))\n_mm_srl_epi16 (__m128i __A, __m128i __B)\n{\n  return (__m128i)__builtin_ia32_psrlw128 ((__v8hi)__A, (__v8hi)__B);\n}\n\nstatic __inline __m128i __attribute__((__always_inline__))\n_mm_srl_epi32 (__m128i __A, __m128i __B)\n{\n  return (__m128i)__builtin_ia32_psrld128 ((__v4si)__A, (__v4si)__B);\n}\n\nstatic __inline __m128i __attribute__((__always_inline__))\n_mm_srl_epi64 (__m128i __A, __m128i __B)\n{\n  return (__m128i)__builtin_ia32_psrlq128 ((__v2di)__A, (__v2di)__B);\n}\n\nstatic __inline __m128i __attribute__((__always_inline__))\n_mm_and_si128 (__m128i __A, __m128i __B)\n{\n  return (__m128i)__builtin_ia32_pand128 ((__v2di)__A, (__v2di)__B);\n}\n\nstatic __inline __m128i __attribute__((__always_inline__))\n_mm_andnot_si128 (__m128i __A, __m128i __B)\n{\n  return (__m128i)__builtin_ia32_pandn128 ((__v2di)__A, (__v2di)__B);\n}\n\nstatic __inline __m128i __attribute__((__always_inline__))\n_mm_or_si128 (__m128i __A, __m128i __B)\n{\n  return (__m128i)__builtin_ia32_por128 ((__v2di)__A, (__v2di)__B);\n}\n\nstatic __inline __m128i __attribute__((__always_inline__))\n_mm_xor_si128 (__m128i __A, __m128i __B)\n{\n  return (__m128i)__builtin_ia32_pxor128 ((__v2di)__A, (__v2di)__B);\n}\n\nstatic __inline __m128i __attribute__((__always_inline__))\n_mm_cmpeq_epi8 (__m128i __A, __m128i __B)\n{\n  return (__m128i)__builtin_ia32_pcmpeqb128 ((__v16qi)__A, (__v16qi)__B);\n}\n\nstatic __inline __m128i __attribute__((__always_inline__))\n_mm_cmpeq_epi16 (__m128i __A, __m128i __B)\n{\n  return (__m128i)__builtin_ia32_pcmpeqw128 ((__v8hi)__A, (__v8hi)__B);\n}\n\nstatic __inline __m128i __attribute__((__always_inline__))\n_mm_cmpeq_epi32 (__m128i __A, __m128i __B)\n{\n  return (__m128i)__builtin_ia32_pcmpeqd128 ((__v4si)__A, (__v4si)__B);\n}\n\nstatic __inline __m128i __attribute__((__always_inline__))\n_mm_cmplt_epi8 (__m128i __A, __m128i __B)\n{\n  return (__m128i)__builtin_ia32_pcmpgtb128 ((__v16qi)__B, (__v16qi)__A);\n}\n\nstatic __inline __m128i __attribute__((__always_inline__))\n_mm_cmplt_epi16 (__m128i __A, __m128i __B)\n{\n  return (__m128i)__builtin_ia32_pcmpgtw128 ((__v8hi)__B, (__v8hi)__A);\n}\n\nstatic __inline __m128i __attribute__((__always_inline__))\n_mm_cmplt_epi32 (__m128i __A, __m128i __B)\n{\n  return (__m128i)__builtin_ia32_pcmpgtd128 ((__v4si)__B, (__v4si)__A);\n}\n\nstatic __inline __m128i __attribute__((__always_inline__))\n_mm_cmpgt_epi8 (__m128i __A, __m128i __B)\n{\n  return (__m128i)__builtin_ia32_pcmpgtb128 ((__v16qi)__A, (__v16qi)__B);\n}\n\nstatic __inline __m128i __attribute__((__always_inline__))\n_mm_cmpgt_epi16 (__m128i __A, __m128i __B)\n{\n  return (__m128i)__builtin_ia32_pcmpgtw128 ((__v8hi)__A, (__v8hi)__B);\n}\n\nstatic __inline __m128i __attribute__((__always_inline__))\n_mm_cmpgt_epi32 (__m128i __A, __m128i __B)\n{\n  return (__m128i)__builtin_ia32_pcmpgtd128 ((__v4si)__A, (__v4si)__B);\n}\n\n#if 0\nstatic __inline int __attribute__((__always_inline__))\n_mm_extract_epi16 (__m128i const __A, int const __N)\n{\n  return __builtin_ia32_vec_ext_v8hi ((__v8hi)__A, __N);\n}\n\nstatic __inline __m128i __attribute__((__always_inline__))\n_mm_insert_epi16 (__m128i const __A, int const __D, int const __N)\n{\n  return (__m128i) __builtin_ia32_vec_set_v8hi ((__v8hi)__A, __D, __N);\n}\n#else\n#define _mm_extract_epi16(A, N) \\\n  ((int) __builtin_ia32_vec_ext_v8hi ((__v8hi)(A), (N)))\n#define _mm_insert_epi16(A, D, N) \\\n  ((__m128i) __builtin_ia32_vec_set_v8hi ((__v8hi)(A), (D), (N)))\n#endif\n\nstatic __inline __m128i __attribute__((__always_inline__))\n_mm_max_epi16 (__m128i __A, __m128i __B)\n{\n  return (__m128i)__builtin_ia32_pmaxsw128 ((__v8hi)__A, (__v8hi)__B);\n}\n\nstatic __inline __m128i __attribute__((__always_inline__))\n_mm_max_epu8 (__m128i __A, __m128i __B)\n{\n  return (__m128i)__builtin_ia32_pmaxub128 ((__v16qi)__A, (__v16qi)__B);\n}\n\nstatic __inline __m128i __attribute__((__always_inline__))\n_mm_min_epi16 (__m128i __A, __m128i __B)\n{\n  return (__m128i)__builtin_ia32_pminsw128 ((__v8hi)__A, (__v8hi)__B);\n}\n\nstatic __inline __m128i __attribute__((__always_inline__))\n_mm_min_epu8 (__m128i __A, __m128i __B)\n{\n  return (__m128i)__builtin_ia32_pminub128 ((__v16qi)__A, (__v16qi)__B);\n}\n\nstatic __inline int __attribute__((__always_inline__))\n_mm_movemask_epi8 (__m128i __A)\n{\n  return __builtin_ia32_pmovmskb128 ((__v16qi)__A);\n}\n\nstatic __inline __m128i __attribute__((__always_inline__))\n_mm_mulhi_epu16 (__m128i __A, __m128i __B)\n{\n  return (__m128i)__builtin_ia32_pmulhuw128 ((__v8hi)__A, (__v8hi)__B);\n}\n\n#define _mm_shufflehi_epi16(__A, __B) ((__m128i)__builtin_ia32_pshufhw ((__v8hi)__A, __B))\n#define _mm_shufflelo_epi16(__A, __B) ((__m128i)__builtin_ia32_pshuflw ((__v8hi)__A, __B))\n#define _mm_shuffle_epi32(__A, __B) ((__m128i)__builtin_ia32_pshufd ((__v4si)__A, __B))\n\nstatic __inline void __attribute__((__always_inline__))\n_mm_maskmoveu_si128 (__m128i __A, __m128i __B, char *__C)\n{\n  __builtin_ia32_maskmovdqu ((__v16qi)__A, (__v16qi)__B, __C);\n}\n\nstatic __inline __m128i __attribute__((__always_inline__))\n_mm_avg_epu8 (__m128i __A, __m128i __B)\n{\n  return (__m128i)__builtin_ia32_pavgb128 ((__v16qi)__A, (__v16qi)__B);\n}\n\nstatic __inline __m128i __attribute__((__always_inline__))\n_mm_avg_epu16 (__m128i __A, __m128i __B)\n{\n  return (__m128i)__builtin_ia32_pavgw128 ((__v8hi)__A, (__v8hi)__B);\n}\n\nstatic __inline __m128i __attribute__((__always_inline__))\n_mm_sad_epu8 (__m128i __A, __m128i __B)\n{\n  return (__m128i)__builtin_ia32_psadbw128 ((__v16qi)__A, (__v16qi)__B);\n}\n\nstatic __inline void __attribute__((__always_inline__))\n_mm_stream_si32 (int *__A, int __B)\n{\n  __builtin_ia32_movnti (__A, __B);\n}\n\nstatic __inline void __attribute__((__always_inline__))\n_mm_stream_si128 (__m128i *__A, __m128i __B)\n{\n  __builtin_ia32_movntdq ((__v2di *)__A, (__v2di)__B);\n}\n\nstatic __inline void __attribute__((__always_inline__))\n_mm_stream_pd (double *__A, __m128d __B)\n{\n  __builtin_ia32_movntpd (__A, (__v2df)__B);\n}\n\nstatic __inline void __attribute__((__always_inline__))\n_mm_clflush (void const *__A)\n{\n  __builtin_ia32_clflush (__A);\n}\n\nstatic __inline void __attribute__((__always_inline__))\n_mm_lfence (void)\n{\n  __builtin_ia32_lfence ();\n}\n\nstatic __inline void __attribute__((__always_inline__))\n_mm_mfence (void)\n{\n  __builtin_ia32_mfence ();\n}\n\nstatic __inline __m128i __attribute__((__always_inline__))\n_mm_cvtsi32_si128 (int __A)\n{\n  return _mm_set_epi32 (0, 0, 0, __A);\n}\n\n#ifdef __x86_64__\n/* Intel intrinsic.  */\nstatic __inline __m128i __attribute__((__always_inline__))\n_mm_cvtsi64_si128 (long long __A)\n{\n  return _mm_set_epi64x (0, __A);\n}\n\n/* Microsoft intrinsic.  */\nstatic __inline __m128i __attribute__((__always_inline__))\n_mm_cvtsi64x_si128 (long long __A)\n{\n  return _mm_set_epi64x (0, __A);\n}\n#endif\n\n/* Casts between various SP, DP, INT vector types.  Note that these do no\n   conversion of values, they just change the type.  */\nstatic __inline __m128 __attribute__((__always_inline__))\n_mm_castpd_ps(__m128d __A)\n{\n  return (__m128) __A;\n}\n\nstatic __inline __m128i __attribute__((__always_inline__))\n_mm_castpd_si128(__m128d __A)\n{\n  return (__m128i) __A;\n}\n\nstatic __inline __m128d __attribute__((__always_inline__))\n_mm_castps_pd(__m128 __A)\n{\n  return (__m128d) __A;\n}\n\nstatic __inline __m128i __attribute__((__always_inline__))\n_mm_castps_si128(__m128 __A)\n{\n  return (__m128i) __A;\n}\n\nstatic __inline __m128 __attribute__((__always_inline__))\n_mm_castsi128_ps(__m128i __A)\n{\n  return (__m128) __A;\n}\n\nstatic __inline __m128d __attribute__((__always_inline__))\n_mm_castsi128_pd(__m128i __A)\n{\n  return (__m128d) __A;\n}\n\n#endif /* __SSE2__  */\n\n#endif /* _EMMINTRIN_H_INCLUDED */\n"
  },
  {
    "path": "freebsd-headers/gcc/4.2/mm_malloc.h",
    "content": "/* Copyright (C) 2004, 2006 Free Software Foundation, Inc.\n\n   This file is part of GCC.\n\n   GCC is free software; you can redistribute it and/or modify\n   it under the terms of the GNU General Public License as published by\n   the Free Software Foundation; either version 2, or (at your option)\n   any later version.\n\n   GCC is distributed in the hope that it will be useful,\n   but WITHOUT ANY WARRANTY; without even the implied warranty of\n   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n   GNU General Public License for more details.\n\n   You should have received a copy of the GNU General Public License\n   along with GCC; see the file COPYING.  If not, write to\n   the Free Software Foundation, 51 Franklin Street, Fifth Floor,\n   Boston, MA 02110-1301, USA.  */\n\n/* As a special exception, if you include this header file into source\n   files compiled by GCC, this header file does not by itself cause\n   the resulting executable to be covered by the GNU General Public\n   License.  This exception does not however invalidate any other\n   reasons why the executable file might be covered by the GNU General\n   Public License.  */\n\n#ifndef _MM_MALLOC_H_INCLUDED\n#define _MM_MALLOC_H_INCLUDED\n\n#include <stdlib.h>\n\n/* We can't depend on <stdlib.h> since the prototype of posix_memalign\n   may not be visible.  */\n#ifndef __cplusplus\nextern int posix_memalign (void **, size_t, size_t);\n#else\nextern \"C\" int posix_memalign (void **, size_t, size_t) throw ();\n#endif\n\nstatic __inline void *\n_mm_malloc (size_t size, size_t alignment)\n{\n  void *ptr;\n  if (alignment == 1)\n    return malloc (size);\n  if (alignment == 2 || (sizeof (void *) == 8 && alignment == 4))\n    alignment = sizeof (void *);\n  if (posix_memalign (&ptr, alignment, size) == 0)\n    return ptr;\n  else\n    return NULL;\n}\n\nstatic __inline void\n_mm_free (void * ptr)\n{\n  free (ptr);\n}\n\n#endif /* _MM_MALLOC_H_INCLUDED */\n"
  },
  {
    "path": "freebsd-headers/gcc/4.2/mmintrin.h",
    "content": "/* Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007\n   Free Software Foundation, Inc.\n\n   This file is part of GCC.\n\n   GCC is free software; you can redistribute it and/or modify\n   it under the terms of the GNU General Public License as published by\n   the Free Software Foundation; either version 2, or (at your option)\n   any later version.\n\n   GCC is distributed in the hope that it will be useful,\n   but WITHOUT ANY WARRANTY; without even the implied warranty of\n   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n   GNU General Public License for more details.\n\n   You should have received a copy of the GNU General Public License\n   along with GCC; see the file COPYING.  If not, write to\n   the Free Software Foundation, 51 Franklin Street, Fifth Floor,\n   Boston, MA 02110-1301, USA.  */\n\n/* As a special exception, if you include this header file into source\n   files compiled by GCC, this header file does not by itself cause\n   the resulting executable to be covered by the GNU General Public\n   License.  This exception does not however invalidate any other\n   reasons why the executable file might be covered by the GNU General\n   Public License.  */\n\n/* Implemented from the specification included in the Intel C++ Compiler\n   User Guide and Reference, version 9.0.  */\n\n#ifndef _MMINTRIN_H_INCLUDED\n#define _MMINTRIN_H_INCLUDED\n\n#ifndef __MMX__\n# error \"MMX instruction set not enabled\"\n#else\n/* The Intel API is flexible enough that we must allow aliasing with other\n   vector types, and their scalar components.  */\ntypedef int __m64 __attribute__ ((__vector_size__ (8), __may_alias__));\n\n/* Internal data types for implementing the intrinsics.  */\ntypedef int __v2si __attribute__ ((__vector_size__ (8)));\ntypedef short __v4hi __attribute__ ((__vector_size__ (8)));\ntypedef char __v8qi __attribute__ ((__vector_size__ (8)));\n\n/* Empty the multimedia state.  */\nstatic __inline void __attribute__((__always_inline__))\n_mm_empty (void)\n{\n  __builtin_ia32_emms ();\n}\n\nstatic __inline void __attribute__((__always_inline__))\n_m_empty (void)\n{\n  _mm_empty ();\n}\n\n/* Convert I to a __m64 object.  The integer is zero-extended to 64-bits.  */\nstatic __inline __m64  __attribute__((__always_inline__))\n_mm_cvtsi32_si64 (int __i)\n{\n  return (__m64) __builtin_ia32_vec_init_v2si (__i, 0);\n}\n\nstatic __inline __m64  __attribute__((__always_inline__))\n_m_from_int (int __i)\n{\n  return _mm_cvtsi32_si64 (__i);\n}\n\n#ifdef __x86_64__\n/* Convert I to a __m64 object.  */\n\n/* Intel intrinsic.  */\nstatic __inline __m64  __attribute__((__always_inline__))\n_m_from_int64 (long long __i)\n{\n  return (__m64) __i;\n}\n\nstatic __inline __m64  __attribute__((__always_inline__))\n_mm_cvtsi64_m64 (long long __i)\n{\n  return (__m64) __i;\n}\n\n/* Microsoft intrinsic.  */\nstatic __inline __m64  __attribute__((__always_inline__))\n_mm_cvtsi64x_si64 (long long __i)\n{\n  return (__m64) __i;\n}\n\nstatic __inline __m64  __attribute__((__always_inline__))\n_mm_set_pi64x (long long __i)\n{\n  return (__m64) __i;\n}\n#endif\n\n/* Convert the lower 32 bits of the __m64 object into an integer.  */\nstatic __inline int __attribute__((__always_inline__))\n_mm_cvtsi64_si32 (__m64 __i)\n{\n  return __builtin_ia32_vec_ext_v2si ((__v2si)__i, 0);\n}\n\nstatic __inline int __attribute__((__always_inline__))\n_m_to_int (__m64 __i)\n{\n  return _mm_cvtsi64_si32 (__i);\n}\n\n#ifdef __x86_64__\n/* Convert the __m64 object to a 64bit integer.  */\n\n/* Intel intrinsic.  */\nstatic __inline long long __attribute__((__always_inline__))\n_m_to_int64 (__m64 __i)\n{\n  return (long long)__i;\n}\n\nstatic __inline long long __attribute__((__always_inline__))\n_mm_cvtm64_si64 (__m64 __i)\n{\n  return (long long)__i;\n}\n\n/* Microsoft intrinsic.  */\nstatic __inline long long __attribute__((__always_inline__))\n_mm_cvtsi64_si64x (__m64 __i)\n{\n  return (long long)__i;\n}\n#endif\n\n/* Pack the four 16-bit values from M1 into the lower four 8-bit values of\n   the result, and the four 16-bit values from M2 into the upper four 8-bit\n   values of the result, all with signed saturation.  */\nstatic __inline __m64 __attribute__((__always_inline__))\n_mm_packs_pi16 (__m64 __m1, __m64 __m2)\n{\n  return (__m64) __builtin_ia32_packsswb ((__v4hi)__m1, (__v4hi)__m2);\n}\n\nstatic __inline __m64 __attribute__((__always_inline__))\n_m_packsswb (__m64 __m1, __m64 __m2)\n{\n  return _mm_packs_pi16 (__m1, __m2);\n}\n\n/* Pack the two 32-bit values from M1 in to the lower two 16-bit values of\n   the result, and the two 32-bit values from M2 into the upper two 16-bit\n   values of the result, all with signed saturation.  */\nstatic __inline __m64 __attribute__((__always_inline__))\n_mm_packs_pi32 (__m64 __m1, __m64 __m2)\n{\n  return (__m64) __builtin_ia32_packssdw ((__v2si)__m1, (__v2si)__m2);\n}\n\nstatic __inline __m64 __attribute__((__always_inline__))\n_m_packssdw (__m64 __m1, __m64 __m2)\n{\n  return _mm_packs_pi32 (__m1, __m2);\n}\n\n/* Pack the four 16-bit values from M1 into the lower four 8-bit values of\n   the result, and the four 16-bit values from M2 into the upper four 8-bit\n   values of the result, all with unsigned saturation.  */\nstatic __inline __m64 __attribute__((__always_inline__))\n_mm_packs_pu16 (__m64 __m1, __m64 __m2)\n{\n  return (__m64) __builtin_ia32_packuswb ((__v4hi)__m1, (__v4hi)__m2);\n}\n\nstatic __inline __m64 __attribute__((__always_inline__))\n_m_packuswb (__m64 __m1, __m64 __m2)\n{\n  return _mm_packs_pu16 (__m1, __m2);\n}\n\n/* Interleave the four 8-bit values from the high half of M1 with the four\n   8-bit values from the high half of M2.  */\nstatic __inline __m64 __attribute__((__always_inline__))\n_mm_unpackhi_pi8 (__m64 __m1, __m64 __m2)\n{\n  return (__m64) __builtin_ia32_punpckhbw ((__v8qi)__m1, (__v8qi)__m2);\n}\n\nstatic __inline __m64 __attribute__((__always_inline__))\n_m_punpckhbw (__m64 __m1, __m64 __m2)\n{\n  return _mm_unpackhi_pi8 (__m1, __m2);\n}\n\n/* Interleave the two 16-bit values from the high half of M1 with the two\n   16-bit values from the high half of M2.  */\nstatic __inline __m64 __attribute__((__always_inline__))\n_mm_unpackhi_pi16 (__m64 __m1, __m64 __m2)\n{\n  return (__m64) __builtin_ia32_punpckhwd ((__v4hi)__m1, (__v4hi)__m2);\n}\n\nstatic __inline __m64 __attribute__((__always_inline__))\n_m_punpckhwd (__m64 __m1, __m64 __m2)\n{\n  return _mm_unpackhi_pi16 (__m1, __m2);\n}\n\n/* Interleave the 32-bit value from the high half of M1 with the 32-bit\n   value from the high half of M2.  */\nstatic __inline __m64 __attribute__((__always_inline__))\n_mm_unpackhi_pi32 (__m64 __m1, __m64 __m2)\n{\n  return (__m64) __builtin_ia32_punpckhdq ((__v2si)__m1, (__v2si)__m2);\n}\n\nstatic __inline __m64 __attribute__((__always_inline__))\n_m_punpckhdq (__m64 __m1, __m64 __m2)\n{\n  return _mm_unpackhi_pi32 (__m1, __m2);\n}\n\n/* Interleave the four 8-bit values from the low half of M1 with the four\n   8-bit values from the low half of M2.  */\nstatic __inline __m64 __attribute__((__always_inline__))\n_mm_unpacklo_pi8 (__m64 __m1, __m64 __m2)\n{\n  return (__m64) __builtin_ia32_punpcklbw ((__v8qi)__m1, (__v8qi)__m2);\n}\n\nstatic __inline __m64 __attribute__((__always_inline__))\n_m_punpcklbw (__m64 __m1, __m64 __m2)\n{\n  return _mm_unpacklo_pi8 (__m1, __m2);\n}\n\n/* Interleave the two 16-bit values from the low half of M1 with the two\n   16-bit values from the low half of M2.  */\nstatic __inline __m64 __attribute__((__always_inline__))\n_mm_unpacklo_pi16 (__m64 __m1, __m64 __m2)\n{\n  return (__m64) __builtin_ia32_punpcklwd ((__v4hi)__m1, (__v4hi)__m2);\n}\n\nstatic __inline __m64 __attribute__((__always_inline__))\n_m_punpcklwd (__m64 __m1, __m64 __m2)\n{\n  return _mm_unpacklo_pi16 (__m1, __m2);\n}\n\n/* Interleave the 32-bit value from the low half of M1 with the 32-bit\n   value from the low half of M2.  */\nstatic __inline __m64 __attribute__((__always_inline__))\n_mm_unpacklo_pi32 (__m64 __m1, __m64 __m2)\n{\n  return (__m64) __builtin_ia32_punpckldq ((__v2si)__m1, (__v2si)__m2);\n}\n\nstatic __inline __m64 __attribute__((__always_inline__))\n_m_punpckldq (__m64 __m1, __m64 __m2)\n{\n  return _mm_unpacklo_pi32 (__m1, __m2);\n}\n\n/* Add the 8-bit values in M1 to the 8-bit values in M2.  */\nstatic __inline __m64 __attribute__((__always_inline__))\n_mm_add_pi8 (__m64 __m1, __m64 __m2)\n{\n  return (__m64) __builtin_ia32_paddb ((__v8qi)__m1, (__v8qi)__m2);\n}\n\nstatic __inline __m64 __attribute__((__always_inline__))\n_m_paddb (__m64 __m1, __m64 __m2)\n{\n  return _mm_add_pi8 (__m1, __m2);\n}\n\n/* Add the 16-bit values in M1 to the 16-bit values in M2.  */\nstatic __inline __m64 __attribute__((__always_inline__))\n_mm_add_pi16 (__m64 __m1, __m64 __m2)\n{\n  return (__m64) __builtin_ia32_paddw ((__v4hi)__m1, (__v4hi)__m2);\n}\n\nstatic __inline __m64 __attribute__((__always_inline__))\n_m_paddw (__m64 __m1, __m64 __m2)\n{\n  return _mm_add_pi16 (__m1, __m2);\n}\n\n/* Add the 32-bit values in M1 to the 32-bit values in M2.  */\nstatic __inline __m64 __attribute__((__always_inline__))\n_mm_add_pi32 (__m64 __m1, __m64 __m2)\n{\n  return (__m64) __builtin_ia32_paddd ((__v2si)__m1, (__v2si)__m2);\n}\n\nstatic __inline __m64 __attribute__((__always_inline__))\n_m_paddd (__m64 __m1, __m64 __m2)\n{\n  return _mm_add_pi32 (__m1, __m2);\n}\n\n/* Add the 64-bit values in M1 to the 64-bit values in M2.  */\n#ifdef __SSE2__\nstatic __inline __m64 __attribute__((__always_inline__))\n_mm_add_si64 (__m64 __m1, __m64 __m2)\n{\n  return (__m64) __builtin_ia32_paddq ((long long)__m1, (long long)__m2);\n}\n#endif\n\n/* Add the 8-bit values in M1 to the 8-bit values in M2 using signed\n   saturated arithmetic.  */\nstatic __inline __m64 __attribute__((__always_inline__))\n_mm_adds_pi8 (__m64 __m1, __m64 __m2)\n{\n  return (__m64) __builtin_ia32_paddsb ((__v8qi)__m1, (__v8qi)__m2);\n}\n\nstatic __inline __m64 __attribute__((__always_inline__))\n_m_paddsb (__m64 __m1, __m64 __m2)\n{\n  return _mm_adds_pi8 (__m1, __m2);\n}\n\n/* Add the 16-bit values in M1 to the 16-bit values in M2 using signed\n   saturated arithmetic.  */\nstatic __inline __m64 __attribute__((__always_inline__))\n_mm_adds_pi16 (__m64 __m1, __m64 __m2)\n{\n  return (__m64) __builtin_ia32_paddsw ((__v4hi)__m1, (__v4hi)__m2);\n}\n\nstatic __inline __m64 __attribute__((__always_inline__))\n_m_paddsw (__m64 __m1, __m64 __m2)\n{\n  return _mm_adds_pi16 (__m1, __m2);\n}\n\n/* Add the 8-bit values in M1 to the 8-bit values in M2 using unsigned\n   saturated arithmetic.  */\nstatic __inline __m64 __attribute__((__always_inline__))\n_mm_adds_pu8 (__m64 __m1, __m64 __m2)\n{\n  return (__m64) __builtin_ia32_paddusb ((__v8qi)__m1, (__v8qi)__m2);\n}\n\nstatic __inline __m64 __attribute__((__always_inline__))\n_m_paddusb (__m64 __m1, __m64 __m2)\n{\n  return _mm_adds_pu8 (__m1, __m2);\n}\n\n/* Add the 16-bit values in M1 to the 16-bit values in M2 using unsigned\n   saturated arithmetic.  */\nstatic __inline __m64 __attribute__((__always_inline__))\n_mm_adds_pu16 (__m64 __m1, __m64 __m2)\n{\n  return (__m64) __builtin_ia32_paddusw ((__v4hi)__m1, (__v4hi)__m2);\n}\n\nstatic __inline __m64 __attribute__((__always_inline__))\n_m_paddusw (__m64 __m1, __m64 __m2)\n{\n  return _mm_adds_pu16 (__m1, __m2);\n}\n\n/* Subtract the 8-bit values in M2 from the 8-bit values in M1.  */\nstatic __inline __m64 __attribute__((__always_inline__))\n_mm_sub_pi8 (__m64 __m1, __m64 __m2)\n{\n  return (__m64) __builtin_ia32_psubb ((__v8qi)__m1, (__v8qi)__m2);\n}\n\nstatic __inline __m64 __attribute__((__always_inline__))\n_m_psubb (__m64 __m1, __m64 __m2)\n{\n  return _mm_sub_pi8 (__m1, __m2);\n}\n\n/* Subtract the 16-bit values in M2 from the 16-bit values in M1.  */\nstatic __inline __m64 __attribute__((__always_inline__))\n_mm_sub_pi16 (__m64 __m1, __m64 __m2)\n{\n  return (__m64) __builtin_ia32_psubw ((__v4hi)__m1, (__v4hi)__m2);\n}\n\nstatic __inline __m64 __attribute__((__always_inline__))\n_m_psubw (__m64 __m1, __m64 __m2)\n{\n  return _mm_sub_pi16 (__m1, __m2);\n}\n\n/* Subtract the 32-bit values in M2 from the 32-bit values in M1.  */\nstatic __inline __m64 __attribute__((__always_inline__))\n_mm_sub_pi32 (__m64 __m1, __m64 __m2)\n{\n  return (__m64) __builtin_ia32_psubd ((__v2si)__m1, (__v2si)__m2);\n}\n\nstatic __inline __m64 __attribute__((__always_inline__))\n_m_psubd (__m64 __m1, __m64 __m2)\n{\n  return _mm_sub_pi32 (__m1, __m2);\n}\n\n/* Add the 64-bit values in M1 to the 64-bit values in M2.  */\n#ifdef __SSE2__\nstatic __inline __m64 __attribute__((__always_inline__))\n_mm_sub_si64 (__m64 __m1, __m64 __m2)\n{\n  return (__m64) __builtin_ia32_psubq ((long long)__m1, (long long)__m2);\n}\n#endif\n\n/* Subtract the 8-bit values in M2 from the 8-bit values in M1 using signed\n   saturating arithmetic.  */\nstatic __inline __m64 __attribute__((__always_inline__))\n_mm_subs_pi8 (__m64 __m1, __m64 __m2)\n{\n  return (__m64) __builtin_ia32_psubsb ((__v8qi)__m1, (__v8qi)__m2);\n}\n\nstatic __inline __m64 __attribute__((__always_inline__))\n_m_psubsb (__m64 __m1, __m64 __m2)\n{\n  return _mm_subs_pi8 (__m1, __m2);\n}\n\n/* Subtract the 16-bit values in M2 from the 16-bit values in M1 using\n   signed saturating arithmetic.  */\nstatic __inline __m64 __attribute__((__always_inline__))\n_mm_subs_pi16 (__m64 __m1, __m64 __m2)\n{\n  return (__m64) __builtin_ia32_psubsw ((__v4hi)__m1, (__v4hi)__m2);\n}\n\nstatic __inline __m64 __attribute__((__always_inline__))\n_m_psubsw (__m64 __m1, __m64 __m2)\n{\n  return _mm_subs_pi16 (__m1, __m2);\n}\n\n/* Subtract the 8-bit values in M2 from the 8-bit values in M1 using\n   unsigned saturating arithmetic.  */\nstatic __inline __m64 __attribute__((__always_inline__))\n_mm_subs_pu8 (__m64 __m1, __m64 __m2)\n{\n  return (__m64) __builtin_ia32_psubusb ((__v8qi)__m1, (__v8qi)__m2);\n}\n\nstatic __inline __m64 __attribute__((__always_inline__))\n_m_psubusb (__m64 __m1, __m64 __m2)\n{\n  return _mm_subs_pu8 (__m1, __m2);\n}\n\n/* Subtract the 16-bit values in M2 from the 16-bit values in M1 using\n   unsigned saturating arithmetic.  */\nstatic __inline __m64 __attribute__((__always_inline__))\n_mm_subs_pu16 (__m64 __m1, __m64 __m2)\n{\n  return (__m64) __builtin_ia32_psubusw ((__v4hi)__m1, (__v4hi)__m2);\n}\n\nstatic __inline __m64 __attribute__((__always_inline__))\n_m_psubusw (__m64 __m1, __m64 __m2)\n{\n  return _mm_subs_pu16 (__m1, __m2);\n}\n\n/* Multiply four 16-bit values in M1 by four 16-bit values in M2 producing\n   four 32-bit intermediate results, which are then summed by pairs to\n   produce two 32-bit results.  */\nstatic __inline __m64 __attribute__((__always_inline__))\n_mm_madd_pi16 (__m64 __m1, __m64 __m2)\n{\n  return (__m64) __builtin_ia32_pmaddwd ((__v4hi)__m1, (__v4hi)__m2);\n}\n\nstatic __inline __m64 __attribute__((__always_inline__))\n_m_pmaddwd (__m64 __m1, __m64 __m2)\n{\n  return _mm_madd_pi16 (__m1, __m2);\n}\n\n/* Multiply four signed 16-bit values in M1 by four signed 16-bit values in\n   M2 and produce the high 16 bits of the 32-bit results.  */\nstatic __inline __m64 __attribute__((__always_inline__))\n_mm_mulhi_pi16 (__m64 __m1, __m64 __m2)\n{\n  return (__m64) __builtin_ia32_pmulhw ((__v4hi)__m1, (__v4hi)__m2);\n}\n\nstatic __inline __m64 __attribute__((__always_inline__))\n_m_pmulhw (__m64 __m1, __m64 __m2)\n{\n  return _mm_mulhi_pi16 (__m1, __m2);\n}\n\n/* Multiply four 16-bit values in M1 by four 16-bit values in M2 and produce\n   the low 16 bits of the results.  */\nstatic __inline __m64 __attribute__((__always_inline__))\n_mm_mullo_pi16 (__m64 __m1, __m64 __m2)\n{\n  return (__m64) __builtin_ia32_pmullw ((__v4hi)__m1, (__v4hi)__m2);\n}\n\nstatic __inline __m64 __attribute__((__always_inline__))\n_m_pmullw (__m64 __m1, __m64 __m2)\n{\n  return _mm_mullo_pi16 (__m1, __m2);\n}\n\n/* Shift four 16-bit values in M left by COUNT.  */\nstatic __inline __m64 __attribute__((__always_inline__))\n_mm_sll_pi16 (__m64 __m, __m64 __count)\n{\n  return (__m64) __builtin_ia32_psllw ((__v4hi)__m, (long long)__count);\n}\n\nstatic __inline __m64 __attribute__((__always_inline__))\n_m_psllw (__m64 __m, __m64 __count)\n{\n  return _mm_sll_pi16 (__m, __count);\n}\n\nstatic __inline __m64 __attribute__((__always_inline__))\n_mm_slli_pi16 (__m64 __m, int __count)\n{\n  return (__m64) __builtin_ia32_psllw ((__v4hi)__m, __count);\n}\n\nstatic __inline __m64 __attribute__((__always_inline__))\n_m_psllwi (__m64 __m, int __count)\n{\n  return _mm_slli_pi16 (__m, __count);\n}\n\n/* Shift two 32-bit values in M left by COUNT.  */\nstatic __inline __m64 __attribute__((__always_inline__))\n_mm_sll_pi32 (__m64 __m, __m64 __count)\n{\n  return (__m64) __builtin_ia32_pslld ((__v2si)__m, (long long)__count);\n}\n\nstatic __inline __m64 __attribute__((__always_inline__))\n_m_pslld (__m64 __m, __m64 __count)\n{\n  return _mm_sll_pi32 (__m, __count);\n}\n\nstatic __inline __m64 __attribute__((__always_inline__))\n_mm_slli_pi32 (__m64 __m, int __count)\n{\n  return (__m64) __builtin_ia32_pslld ((__v2si)__m, __count);\n}\n\nstatic __inline __m64 __attribute__((__always_inline__))\n_m_pslldi (__m64 __m, int __count)\n{\n  return _mm_slli_pi32 (__m, __count);\n}\n\n/* Shift the 64-bit value in M left by COUNT.  */\nstatic __inline __m64 __attribute__((__always_inline__))\n_mm_sll_si64 (__m64 __m, __m64 __count)\n{\n  return (__m64) __builtin_ia32_psllq ((long long)__m, (long long)__count);\n}\n\nstatic __inline __m64 __attribute__((__always_inline__))\n_m_psllq (__m64 __m, __m64 __count)\n{\n  return _mm_sll_si64 (__m, __count);\n}\n\nstatic __inline __m64 __attribute__((__always_inline__))\n_mm_slli_si64 (__m64 __m, int __count)\n{\n  return (__m64) __builtin_ia32_psllq ((long long)__m, (long long)__count);\n}\n\nstatic __inline __m64 __attribute__((__always_inline__))\n_m_psllqi (__m64 __m, int __count)\n{\n  return _mm_slli_si64 (__m, __count);\n}\n\n/* Shift four 16-bit values in M right by COUNT; shift in the sign bit.  */\nstatic __inline __m64 __attribute__((__always_inline__))\n_mm_sra_pi16 (__m64 __m, __m64 __count)\n{\n  return (__m64) __builtin_ia32_psraw ((__v4hi)__m, (long long)__count);\n}\n\nstatic __inline __m64 __attribute__((__always_inline__))\n_m_psraw (__m64 __m, __m64 __count)\n{\n  return _mm_sra_pi16 (__m, __count);\n}\n\nstatic __inline __m64 __attribute__((__always_inline__))\n_mm_srai_pi16 (__m64 __m, int __count)\n{\n  return (__m64) __builtin_ia32_psraw ((__v4hi)__m, __count);\n}\n\nstatic __inline __m64 __attribute__((__always_inline__))\n_m_psrawi (__m64 __m, int __count)\n{\n  return _mm_srai_pi16 (__m, __count);\n}\n\n/* Shift two 32-bit values in M right by COUNT; shift in the sign bit.  */\nstatic __inline __m64 __attribute__((__always_inline__))\n_mm_sra_pi32 (__m64 __m, __m64 __count)\n{\n  return (__m64) __builtin_ia32_psrad ((__v2si)__m, (long long)__count);\n}\n\nstatic __inline __m64 __attribute__((__always_inline__))\n_m_psrad (__m64 __m, __m64 __count)\n{\n  return _mm_sra_pi32 (__m, __count);\n}\n\nstatic __inline __m64 __attribute__((__always_inline__))\n_mm_srai_pi32 (__m64 __m, int __count)\n{\n  return (__m64) __builtin_ia32_psrad ((__v2si)__m, __count);\n}\n\nstatic __inline __m64 __attribute__((__always_inline__))\n_m_psradi (__m64 __m, int __count)\n{\n  return _mm_srai_pi32 (__m, __count);\n}\n\n/* Shift four 16-bit values in M right by COUNT; shift in zeros.  */\nstatic __inline __m64 __attribute__((__always_inline__))\n_mm_srl_pi16 (__m64 __m, __m64 __count)\n{\n  return (__m64) __builtin_ia32_psrlw ((__v4hi)__m, (long long)__count);\n}\n\nstatic __inline __m64 __attribute__((__always_inline__))\n_m_psrlw (__m64 __m, __m64 __count)\n{\n  return _mm_srl_pi16 (__m, __count);\n}\n\nstatic __inline __m64 __attribute__((__always_inline__))\n_mm_srli_pi16 (__m64 __m, int __count)\n{\n  return (__m64) __builtin_ia32_psrlw ((__v4hi)__m, __count);\n}\n\nstatic __inline __m64 __attribute__((__always_inline__))\n_m_psrlwi (__m64 __m, int __count)\n{\n  return _mm_srli_pi16 (__m, __count);\n}\n\n/* Shift two 32-bit values in M right by COUNT; shift in zeros.  */\nstatic __inline __m64 __attribute__((__always_inline__))\n_mm_srl_pi32 (__m64 __m, __m64 __count)\n{\n  return (__m64) __builtin_ia32_psrld ((__v2si)__m, (long long)__count);\n}\n\nstatic __inline __m64 __attribute__((__always_inline__))\n_m_psrld (__m64 __m, __m64 __count)\n{\n  return _mm_srl_pi32 (__m, __count);\n}\n\nstatic __inline __m64 __attribute__((__always_inline__))\n_mm_srli_pi32 (__m64 __m, int __count)\n{\n  return (__m64) __builtin_ia32_psrld ((__v2si)__m, __count);\n}\n\nstatic __inline __m64 __attribute__((__always_inline__))\n_m_psrldi (__m64 __m, int __count)\n{\n  return _mm_srli_pi32 (__m, __count);\n}\n\n/* Shift the 64-bit value in M left by COUNT; shift in zeros.  */\nstatic __inline __m64 __attribute__((__always_inline__))\n_mm_srl_si64 (__m64 __m, __m64 __count)\n{\n  return (__m64) __builtin_ia32_psrlq ((long long)__m, (long long)__count);\n}\n\nstatic __inline __m64 __attribute__((__always_inline__))\n_m_psrlq (__m64 __m, __m64 __count)\n{\n  return _mm_srl_si64 (__m, __count);\n}\n\nstatic __inline __m64 __attribute__((__always_inline__))\n_mm_srli_si64 (__m64 __m, int __count)\n{\n  return (__m64) __builtin_ia32_psrlq ((long long)__m, (long long)__count);\n}\n\nstatic __inline __m64 __attribute__((__always_inline__))\n_m_psrlqi (__m64 __m, int __count)\n{\n  return _mm_srli_si64 (__m, __count);\n}\n\n/* Bit-wise AND the 64-bit values in M1 and M2.  */\nstatic __inline __m64 __attribute__((__always_inline__))\n_mm_and_si64 (__m64 __m1, __m64 __m2)\n{\n  return __builtin_ia32_pand (__m1, __m2);\n}\n\nstatic __inline __m64 __attribute__((__always_inline__))\n_m_pand (__m64 __m1, __m64 __m2)\n{\n  return _mm_and_si64 (__m1, __m2);\n}\n\n/* Bit-wise complement the 64-bit value in M1 and bit-wise AND it with the\n   64-bit value in M2.  */\nstatic __inline __m64 __attribute__((__always_inline__))\n_mm_andnot_si64 (__m64 __m1, __m64 __m2)\n{\n  return __builtin_ia32_pandn (__m1, __m2);\n}\n\nstatic __inline __m64 __attribute__((__always_inline__))\n_m_pandn (__m64 __m1, __m64 __m2)\n{\n  return _mm_andnot_si64 (__m1, __m2);\n}\n\n/* Bit-wise inclusive OR the 64-bit values in M1 and M2.  */\nstatic __inline __m64 __attribute__((__always_inline__))\n_mm_or_si64 (__m64 __m1, __m64 __m2)\n{\n  return __builtin_ia32_por (__m1, __m2);\n}\n\nstatic __inline __m64 __attribute__((__always_inline__))\n_m_por (__m64 __m1, __m64 __m2)\n{\n  return _mm_or_si64 (__m1, __m2);\n}\n\n/* Bit-wise exclusive OR the 64-bit values in M1 and M2.  */\nstatic __inline __m64 __attribute__((__always_inline__))\n_mm_xor_si64 (__m64 __m1, __m64 __m2)\n{\n  return __builtin_ia32_pxor (__m1, __m2);\n}\n\nstatic __inline __m64 __attribute__((__always_inline__))\n_m_pxor (__m64 __m1, __m64 __m2)\n{\n  return _mm_xor_si64 (__m1, __m2);\n}\n\n/* Compare eight 8-bit values.  The result of the comparison is 0xFF if the\n   test is true and zero if false.  */\nstatic __inline __m64 __attribute__((__always_inline__))\n_mm_cmpeq_pi8 (__m64 __m1, __m64 __m2)\n{\n  return (__m64) __builtin_ia32_pcmpeqb ((__v8qi)__m1, (__v8qi)__m2);\n}\n\nstatic __inline __m64 __attribute__((__always_inline__))\n_m_pcmpeqb (__m64 __m1, __m64 __m2)\n{\n  return _mm_cmpeq_pi8 (__m1, __m2);\n}\n\nstatic __inline __m64 __attribute__((__always_inline__))\n_mm_cmpgt_pi8 (__m64 __m1, __m64 __m2)\n{\n  return (__m64) __builtin_ia32_pcmpgtb ((__v8qi)__m1, (__v8qi)__m2);\n}\n\nstatic __inline __m64 __attribute__((__always_inline__))\n_m_pcmpgtb (__m64 __m1, __m64 __m2)\n{\n  return _mm_cmpgt_pi8 (__m1, __m2);\n}\n\n/* Compare four 16-bit values.  The result of the comparison is 0xFFFF if\n   the test is true and zero if false.  */\nstatic __inline __m64 __attribute__((__always_inline__))\n_mm_cmpeq_pi16 (__m64 __m1, __m64 __m2)\n{\n  return (__m64) __builtin_ia32_pcmpeqw ((__v4hi)__m1, (__v4hi)__m2);\n}\n\nstatic __inline __m64 __attribute__((__always_inline__))\n_m_pcmpeqw (__m64 __m1, __m64 __m2)\n{\n  return _mm_cmpeq_pi16 (__m1, __m2);\n}\n\nstatic __inline __m64 __attribute__((__always_inline__))\n_mm_cmpgt_pi16 (__m64 __m1, __m64 __m2)\n{\n  return (__m64) __builtin_ia32_pcmpgtw ((__v4hi)__m1, (__v4hi)__m2);\n}\n\nstatic __inline __m64 __attribute__((__always_inline__))\n_m_pcmpgtw (__m64 __m1, __m64 __m2)\n{\n  return _mm_cmpgt_pi16 (__m1, __m2);\n}\n\n/* Compare two 32-bit values.  The result of the comparison is 0xFFFFFFFF if\n   the test is true and zero if false.  */\nstatic __inline __m64 __attribute__((__always_inline__))\n_mm_cmpeq_pi32 (__m64 __m1, __m64 __m2)\n{\n  return (__m64) __builtin_ia32_pcmpeqd ((__v2si)__m1, (__v2si)__m2);\n}\n\nstatic __inline __m64 __attribute__((__always_inline__))\n_m_pcmpeqd (__m64 __m1, __m64 __m2)\n{\n  return _mm_cmpeq_pi32 (__m1, __m2);\n}\n\nstatic __inline __m64 __attribute__((__always_inline__))\n_mm_cmpgt_pi32 (__m64 __m1, __m64 __m2)\n{\n  return (__m64) __builtin_ia32_pcmpgtd ((__v2si)__m1, (__v2si)__m2);\n}\n\nstatic __inline __m64 __attribute__((__always_inline__))\n_m_pcmpgtd (__m64 __m1, __m64 __m2)\n{\n  return _mm_cmpgt_pi32 (__m1, __m2);\n}\n\n/* Creates a 64-bit zero.  */\nstatic __inline __m64 __attribute__((__always_inline__))\n_mm_setzero_si64 (void)\n{\n  return (__m64)0LL;\n}\n\n/* Creates a vector of two 32-bit values; I0 is least significant.  */\nstatic __inline __m64 __attribute__((__always_inline__))\n_mm_set_pi32 (int __i1, int __i0)\n{\n  return (__m64) __builtin_ia32_vec_init_v2si (__i0, __i1);\n}\n\n/* Creates a vector of four 16-bit values; W0 is least significant.  */\nstatic __inline __m64 __attribute__((__always_inline__))\n_mm_set_pi16 (short __w3, short __w2, short __w1, short __w0)\n{\n  return (__m64) __builtin_ia32_vec_init_v4hi (__w0, __w1, __w2, __w3);\n}\n\n/* Creates a vector of eight 8-bit values; B0 is least significant.  */\nstatic __inline __m64 __attribute__((__always_inline__))\n_mm_set_pi8 (char __b7, char __b6, char __b5, char __b4,\n\t     char __b3, char __b2, char __b1, char __b0)\n{\n  return (__m64) __builtin_ia32_vec_init_v8qi (__b0, __b1, __b2, __b3,\n\t\t\t\t\t       __b4, __b5, __b6, __b7);\n}\n\n/* Similar, but with the arguments in reverse order.  */\nstatic __inline __m64 __attribute__((__always_inline__))\n_mm_setr_pi32 (int __i0, int __i1)\n{\n  return _mm_set_pi32 (__i1, __i0);\n}\n\nstatic __inline __m64 __attribute__((__always_inline__))\n_mm_setr_pi16 (short __w0, short __w1, short __w2, short __w3)\n{\n  return _mm_set_pi16 (__w3, __w2, __w1, __w0);\n}\n\nstatic __inline __m64 __attribute__((__always_inline__))\n_mm_setr_pi8 (char __b0, char __b1, char __b2, char __b3,\n\t      char __b4, char __b5, char __b6, char __b7)\n{\n  return _mm_set_pi8 (__b7, __b6, __b5, __b4, __b3, __b2, __b1, __b0);\n}\n\n/* Creates a vector of two 32-bit values, both elements containing I.  */\nstatic __inline __m64 __attribute__((__always_inline__))\n_mm_set1_pi32 (int __i)\n{\n  return _mm_set_pi32 (__i, __i);\n}\n\n/* Creates a vector of four 16-bit values, all elements containing W.  */\nstatic __inline __m64 __attribute__((__always_inline__))\n_mm_set1_pi16 (short __w)\n{\n  return _mm_set_pi16 (__w, __w, __w, __w);\n}\n\n/* Creates a vector of eight 8-bit values, all elements containing B.  */\nstatic __inline __m64 __attribute__((__always_inline__))\n_mm_set1_pi8 (char __b)\n{\n  return _mm_set_pi8 (__b, __b, __b, __b, __b, __b, __b, __b);\n}\n\n#endif /* __MMX__ */\n#endif /* _MMINTRIN_H_INCLUDED */\n"
  },
  {
    "path": "freebsd-headers/gcc/4.2/pmmintrin.h",
    "content": "/* Copyright (C) 2003, 2004, 2005, 2006 Free Software Foundation, Inc.\n\n   This file is part of GCC.\n\n   GCC is free software; you can redistribute it and/or modify\n   it under the terms of the GNU General Public License as published by\n   the Free Software Foundation; either version 2, or (at your option)\n   any later version.\n\n   GCC is distributed in the hope that it will be useful,\n   but WITHOUT ANY WARRANTY; without even the implied warranty of\n   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n   GNU General Public License for more details.\n\n   You should have received a copy of the GNU General Public License\n   along with GCC; see the file COPYING.  If not, write to\n   the Free Software Foundation, 51 Franklin Street, Fifth Floor,\n   Boston, MA 02110-1301, USA.  */\n\n/* As a special exception, if you include this header file into source\n   files compiled by GCC, this header file does not by itself cause\n   the resulting executable to be covered by the GNU General Public\n   License.  This exception does not however invalidate any other\n   reasons why the executable file might be covered by the GNU General\n   Public License.  */\n\n/* Implemented from the specification included in the Intel C++ Compiler\n   User Guide and Reference, version 9.0.  */\n\n#ifndef _PMMINTRIN_H_INCLUDED\n#define _PMMINTRIN_H_INCLUDED\n\n#ifdef __SSE3__\n#include <xmmintrin.h>\n#include <emmintrin.h>\n\n/* Additional bits in the MXCSR.  */\n#define _MM_DENORMALS_ZERO_MASK\t\t0x0040\n#define _MM_DENORMALS_ZERO_ON\t\t0x0040\n#define _MM_DENORMALS_ZERO_OFF\t\t0x0000\n\n#define _MM_SET_DENORMALS_ZERO_MODE(mode) \\\n  _mm_setcsr ((_mm_getcsr () & ~_MM_DENORMALS_ZERO_MASK) | (mode))\n#define _MM_GET_DENORMALS_ZERO_MODE() \\\n  (_mm_getcsr() & _MM_DENORMALS_ZERO_MASK)\n\nstatic __inline __m128 __attribute__((__always_inline__))\n_mm_addsub_ps (__m128 __X, __m128 __Y)\n{\n  return (__m128) __builtin_ia32_addsubps ((__v4sf)__X, (__v4sf)__Y);\n}\n\nstatic __inline __m128 __attribute__((__always_inline__))\n_mm_hadd_ps (__m128 __X, __m128 __Y)\n{\n  return (__m128) __builtin_ia32_haddps ((__v4sf)__X, (__v4sf)__Y);\n}\n\nstatic __inline __m128 __attribute__((__always_inline__))\n_mm_hsub_ps (__m128 __X, __m128 __Y)\n{\n  return (__m128) __builtin_ia32_hsubps ((__v4sf)__X, (__v4sf)__Y);\n}\n\nstatic __inline __m128 __attribute__((__always_inline__))\n_mm_movehdup_ps (__m128 __X)\n{\n  return (__m128) __builtin_ia32_movshdup ((__v4sf)__X);\n}\n\nstatic __inline __m128 __attribute__((__always_inline__))\n_mm_moveldup_ps (__m128 __X)\n{\n  return (__m128) __builtin_ia32_movsldup ((__v4sf)__X);\n}\n\nstatic __inline __m128d __attribute__((__always_inline__))\n_mm_addsub_pd (__m128d __X, __m128d __Y)\n{\n  return (__m128d) __builtin_ia32_addsubpd ((__v2df)__X, (__v2df)__Y);\n}\n\nstatic __inline __m128d __attribute__((__always_inline__))\n_mm_hadd_pd (__m128d __X, __m128d __Y)\n{\n  return (__m128d) __builtin_ia32_haddpd ((__v2df)__X, (__v2df)__Y);\n}\n\nstatic __inline __m128d __attribute__((__always_inline__))\n_mm_hsub_pd (__m128d __X, __m128d __Y)\n{\n  return (__m128d) __builtin_ia32_hsubpd ((__v2df)__X, (__v2df)__Y);\n}\n\nstatic __inline __m128d __attribute__((__always_inline__))\n_mm_loaddup_pd (double const *__P)\n{\n  return _mm_load1_pd (__P);\n}\n\nstatic __inline __m128d __attribute__((__always_inline__))\n_mm_movedup_pd (__m128d __X)\n{\n  return _mm_shuffle_pd (__X, __X, _MM_SHUFFLE2 (0,0));\n}\n\nstatic __inline __m128i __attribute__((__always_inline__))\n_mm_lddqu_si128 (__m128i const *__P)\n{\n  return (__m128i) __builtin_ia32_lddqu ((char const *)__P);\n}\n\nstatic __inline void __attribute__((__always_inline__))\n_mm_monitor (void const * __P, unsigned int __E, unsigned int __H)\n{\n  __builtin_ia32_monitor (__P, __E, __H);\n}\n\nstatic __inline void __attribute__((__always_inline__))\n_mm_mwait (unsigned int __E, unsigned int __H)\n{\n  __builtin_ia32_mwait (__E, __H);\n}\n\n#endif /* __SSE3__ */\n\n#endif /* _PMMINTRIN_H_INCLUDED */\n"
  },
  {
    "path": "freebsd-headers/gcc/4.2/tmmintrin.h",
    "content": "/* Copyright (C) 2006 Free Software Foundation, Inc.\n\n   This file is part of GCC.\n\n   GCC is free software; you can redistribute it and/or modify\n   it under the terms of the GNU General Public License as published by\n   the Free Software Foundation; either version 2, or (at your option)\n   any later version.\n\n   GCC is distributed in the hope that it will be useful,\n   but WITHOUT ANY WARRANTY; without even the implied warranty of\n   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n   GNU General Public License for more details.\n\n   You should have received a copy of the GNU General Public License\n   along with GCC; see the file COPYING.  If not, write to\n   the Free Software Foundation, 59 Temple Place - Suite 330,\n   Boston, MA 02111-1307, USA.  */\n\n/* As a special exception, if you include this header file into source\n   files compiled by GCC, this header file does not by itself cause\n   the resulting executable to be covered by the GNU General Public\n   License.  This exception does not however invalidate any other\n   reasons why the executable file might be covered by the GNU General\n   Public License.  */\n\n/* Implemented from the specification included in the Intel C++ Compiler\n   User Guide and Reference, version 9.1.  */\n\n#ifndef _TMMINTRIN_H_INCLUDED\n#define _TMMINTRIN_H_INCLUDED\n\n#ifdef __SSSE3__\n#include <pmmintrin.h>\n\nstatic __inline __m128i __attribute__((__always_inline__))\n_mm_hadd_epi16 (__m128i __X, __m128i __Y)\n{\n  return (__m128i) __builtin_ia32_phaddw128 ((__v8hi)__X, (__v8hi)__Y);\n}\n\nstatic __inline __m128i __attribute__((__always_inline__))\n_mm_hadd_epi32 (__m128i __X, __m128i __Y)\n{\n  return (__m128i) __builtin_ia32_phaddd128 ((__v4si)__X, (__v4si)__Y);\n}\n\nstatic __inline __m128i __attribute__((__always_inline__))\n_mm_hadds_epi16 (__m128i __X, __m128i __Y)\n{\n  return (__m128i) __builtin_ia32_phaddsw128 ((__v8hi)__X, (__v8hi)__Y);\n}\n\nstatic __inline __m64 __attribute__((__always_inline__))\n_mm_hadd_pi16 (__m64 __X, __m64 __Y)\n{\n  return (__m64) __builtin_ia32_phaddw ((__v4hi)__X, (__v4hi)__Y);\n}\n\nstatic __inline __m64 __attribute__((__always_inline__))\n_mm_hadd_pi32 (__m64 __X, __m64 __Y)\n{\n  return (__m64) __builtin_ia32_phaddd ((__v2si)__X, (__v2si)__Y);\n}\n\nstatic __inline __m64 __attribute__((__always_inline__))\n_mm_hadds_pi16 (__m64 __X, __m64 __Y)\n{\n  return (__m64) __builtin_ia32_phaddsw ((__v4hi)__X, (__v4hi)__Y);\n}\n\nstatic __inline __m128i __attribute__((__always_inline__))\n_mm_hsub_epi16 (__m128i __X, __m128i __Y)\n{\n  return (__m128i) __builtin_ia32_phsubw128 ((__v8hi)__X, (__v8hi)__Y);\n}\n\nstatic __inline __m128i __attribute__((__always_inline__))\n_mm_hsub_epi32 (__m128i __X, __m128i __Y)\n{\n  return (__m128i) __builtin_ia32_phsubd128 ((__v4si)__X, (__v4si)__Y);\n}\n\nstatic __inline __m128i __attribute__((__always_inline__))\n_mm_hsubs_epi16 (__m128i __X, __m128i __Y)\n{\n  return (__m128i) __builtin_ia32_phsubsw128 ((__v8hi)__X, (__v8hi)__Y);\n}\n\nstatic __inline __m64 __attribute__((__always_inline__))\n_mm_hsub_pi16 (__m64 __X, __m64 __Y)\n{\n  return (__m64) __builtin_ia32_phsubw ((__v4hi)__X, (__v4hi)__Y);\n}\n\nstatic __inline __m64 __attribute__((__always_inline__))\n_mm_hsub_pi32 (__m64 __X, __m64 __Y)\n{\n  return (__m64) __builtin_ia32_phsubd ((__v2si)__X, (__v2si)__Y);\n}\n\nstatic __inline __m64 __attribute__((__always_inline__))\n_mm_hsubs_pi16 (__m64 __X, __m64 __Y)\n{\n  return (__m64) __builtin_ia32_phsubsw ((__v4hi)__X, (__v4hi)__Y);\n}\n\nstatic __inline __m128i __attribute__((__always_inline__))\n_mm_maddubs_epi16 (__m128i __X, __m128i __Y)\n{\n  return (__m128i) __builtin_ia32_pmaddubsw128 ((__v16qi)__X, (__v16qi)__Y);\n}\n\nstatic __inline __m64 __attribute__((__always_inline__))\n_mm_maddubs_pi16 (__m64 __X, __m64 __Y)\n{\n  return (__m64) __builtin_ia32_pmaddubsw ((__v8qi)__X, (__v8qi)__Y);\n}\n\nstatic __inline __m128i __attribute__((__always_inline__))\n_mm_mulhrs_epi16 (__m128i __X, __m128i __Y)\n{\n  return (__m128i) __builtin_ia32_pmulhrsw128 ((__v8hi)__X, (__v8hi)__Y);\n}\n\nstatic __inline __m64 __attribute__((__always_inline__))\n_mm_mulhrs_pi16 (__m64 __X, __m64 __Y)\n{\n  return (__m64) __builtin_ia32_pmulhrsw ((__v4hi)__X, (__v4hi)__Y);\n}\n\nstatic __inline __m128i __attribute__((__always_inline__))\n_mm_shuffle_epi8 (__m128i __X, __m128i __Y)\n{\n  return (__m128i) __builtin_ia32_pshufb128 ((__v16qi)__X, (__v16qi)__Y);\n}\n\nstatic __inline __m64 __attribute__((__always_inline__))\n_mm_shuffle_pi8 (__m64 __X, __m64 __Y)\n{\n  return (__m64) __builtin_ia32_pshufb ((__v8qi)__X, (__v8qi)__Y);\n}\n\nstatic __inline __m128i __attribute__((__always_inline__))\n_mm_sign_epi8 (__m128i __X, __m128i __Y)\n{\n  return (__m128i) __builtin_ia32_psignb128 ((__v16qi)__X, (__v16qi)__Y);\n}\n\nstatic __inline __m128i __attribute__((__always_inline__))\n_mm_sign_epi16 (__m128i __X, __m128i __Y)\n{\n  return (__m128i) __builtin_ia32_psignw128 ((__v8hi)__X, (__v8hi)__Y);\n}\n\nstatic __inline __m128i __attribute__((__always_inline__))\n_mm_sign_epi32 (__m128i __X, __m128i __Y)\n{\n  return (__m128i) __builtin_ia32_psignd128 ((__v4si)__X, (__v4si)__Y);\n}\n\nstatic __inline __m64 __attribute__((__always_inline__))\n_mm_sign_pi8 (__m64 __X, __m64 __Y)\n{\n  return (__m64) __builtin_ia32_psignb ((__v8qi)__X, (__v8qi)__Y);\n}\n\nstatic __inline __m64 __attribute__((__always_inline__))\n_mm_sign_pi16 (__m64 __X, __m64 __Y)\n{\n  return (__m64) __builtin_ia32_psignw ((__v4hi)__X, (__v4hi)__Y);\n}\n\nstatic __inline __m64 __attribute__((__always_inline__))\n_mm_sign_pi32 (__m64 __X, __m64 __Y)\n{\n  return (__m64) __builtin_ia32_psignd ((__v2si)__X, (__v2si)__Y);\n}\n\n#define _mm_alignr_epi8(__X, __Y, __N) \\\n  ((__m128i)__builtin_ia32_palignr128 ((__v2di) __X, (__v2di) __Y, (__N) * 8))\n\n#define _mm_alignr_pi8(__X, __Y, __N) \\\n  ((__m64)__builtin_ia32_palignr ((long long) (__X), (long long) (__Y), (__N) * 8))\n\nstatic __inline __m128i __attribute__((__always_inline__))\n_mm_abs_epi8 (__m128i __X)\n{\n  return (__m128i) __builtin_ia32_pabsb128 ((__v16qi)__X);\n}\n\nstatic __inline __m128i __attribute__((__always_inline__))\n_mm_abs_epi16 (__m128i __X)\n{\n  return (__m128i) __builtin_ia32_pabsw128 ((__v8hi)__X);\n}\n\nstatic __inline __m128i __attribute__((__always_inline__))\n_mm_abs_epi32 (__m128i __X)\n{\n  return (__m128i) __builtin_ia32_pabsd128 ((__v4si)__X);\n}\n\nstatic __inline __m64 __attribute__((__always_inline__))\n_mm_abs_pi8 (__m64 __X)\n{\n  return (__m64) __builtin_ia32_pabsb ((__v8qi)__X);\n}\n\nstatic __inline __m64 __attribute__((__always_inline__))\n_mm_abs_pi16 (__m64 __X)\n{\n  return (__m64) __builtin_ia32_pabsw ((__v4hi)__X);\n}\n\nstatic __inline __m64 __attribute__((__always_inline__))\n_mm_abs_pi32 (__m64 __X)\n{\n  return (__m64) __builtin_ia32_pabsd ((__v2si)__X);\n}\n\n#endif /* __SSSE3__ */\n\n#endif /* _TMMINTRIN_H_INCLUDED */\n/* Copyright (C) 2006 Free Software Foundation, Inc.\n\n   This file is part of GCC.\n\n   GCC is free software; you can redistribute it and/or modify\n   it under the terms of the GNU General Public License as published by\n   the Free Software Foundation; either version 2, or (at your option)\n   any later version.\n\n   GCC is distributed in the hope that it will be useful,\n   but WITHOUT ANY WARRANTY; without even the implied warranty of\n   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n   GNU General Public License for more details.\n\n   You should have received a copy of the GNU General Public License\n   along with GCC; see the file COPYING.  If not, write to\n   the Free Software Foundation, 59 Temple Place - Suite 330,\n   Boston, MA 02111-1307, USA.  */\n\n/* As a special exception, if you include this header file into source\n   files compiled by GCC, this header file does not by itself cause\n   the resulting executable to be covered by the GNU General Public\n   License.  This exception does not however invalidate any other\n   reasons why the executable file might be covered by the GNU General\n   Public License.  */\n\n/* Implemented from the specification included in the Intel C++ Compiler\n   User Guide and Reference, version 9.1.  */\n\n#ifndef _TMMINTRIN_H_INCLUDED\n#define _TMMINTRIN_H_INCLUDED\n\n#ifdef __SSSE3__\n#include <pmmintrin.h>\n\nstatic __inline __m128i __attribute__((__always_inline__))\n_mm_hadd_epi16 (__m128i __X, __m128i __Y)\n{\n  return (__m128i) __builtin_ia32_phaddw128 ((__v8hi)__X, (__v8hi)__Y);\n}\n\nstatic __inline __m128i __attribute__((__always_inline__))\n_mm_hadd_epi32 (__m128i __X, __m128i __Y)\n{\n  return (__m128i) __builtin_ia32_phaddd128 ((__v4si)__X, (__v4si)__Y);\n}\n\nstatic __inline __m128i __attribute__((__always_inline__))\n_mm_hadds_epi16 (__m128i __X, __m128i __Y)\n{\n  return (__m128i) __builtin_ia32_phaddsw128 ((__v8hi)__X, (__v8hi)__Y);\n}\n\nstatic __inline __m64 __attribute__((__always_inline__))\n_mm_hadd_pi16 (__m64 __X, __m64 __Y)\n{\n  return (__m64) __builtin_ia32_phaddw ((__v4hi)__X, (__v4hi)__Y);\n}\n\nstatic __inline __m64 __attribute__((__always_inline__))\n_mm_hadd_pi32 (__m64 __X, __m64 __Y)\n{\n  return (__m64) __builtin_ia32_phaddd ((__v2si)__X, (__v2si)__Y);\n}\n\nstatic __inline __m64 __attribute__((__always_inline__))\n_mm_hadds_pi16 (__m64 __X, __m64 __Y)\n{\n  return (__m64) __builtin_ia32_phaddsw ((__v4hi)__X, (__v4hi)__Y);\n}\n\nstatic __inline __m128i __attribute__((__always_inline__))\n_mm_hsub_epi16 (__m128i __X, __m128i __Y)\n{\n  return (__m128i) __builtin_ia32_phsubw128 ((__v8hi)__X, (__v8hi)__Y);\n}\n\nstatic __inline __m128i __attribute__((__always_inline__))\n_mm_hsub_epi32 (__m128i __X, __m128i __Y)\n{\n  return (__m128i) __builtin_ia32_phsubd128 ((__v4si)__X, (__v4si)__Y);\n}\n\nstatic __inline __m128i __attribute__((__always_inline__))\n_mm_hsubs_epi16 (__m128i __X, __m128i __Y)\n{\n  return (__m128i) __builtin_ia32_phsubsw128 ((__v8hi)__X, (__v8hi)__Y);\n}\n\nstatic __inline __m64 __attribute__((__always_inline__))\n_mm_hsub_pi16 (__m64 __X, __m64 __Y)\n{\n  return (__m64) __builtin_ia32_phsubw ((__v4hi)__X, (__v4hi)__Y);\n}\n\nstatic __inline __m64 __attribute__((__always_inline__))\n_mm_hsub_pi32 (__m64 __X, __m64 __Y)\n{\n  return (__m64) __builtin_ia32_phsubd ((__v2si)__X, (__v2si)__Y);\n}\n\nstatic __inline __m64 __attribute__((__always_inline__))\n_mm_hsubs_pi16 (__m64 __X, __m64 __Y)\n{\n  return (__m64) __builtin_ia32_phsubsw ((__v4hi)__X, (__v4hi)__Y);\n}\n\nstatic __inline __m128i __attribute__((__always_inline__))\n_mm_maddubs_epi16 (__m128i __X, __m128i __Y)\n{\n  return (__m128i) __builtin_ia32_pmaddubsw128 ((__v16qi)__X, (__v16qi)__Y);\n}\n\nstatic __inline __m64 __attribute__((__always_inline__))\n_mm_maddubs_pi16 (__m64 __X, __m64 __Y)\n{\n  return (__m64) __builtin_ia32_pmaddubsw ((__v8qi)__X, (__v8qi)__Y);\n}\n\nstatic __inline __m128i __attribute__((__always_inline__))\n_mm_mulhrs_epi16 (__m128i __X, __m128i __Y)\n{\n  return (__m128i) __builtin_ia32_pmulhrsw128 ((__v8hi)__X, (__v8hi)__Y);\n}\n\nstatic __inline __m64 __attribute__((__always_inline__))\n_mm_mulhrs_pi16 (__m64 __X, __m64 __Y)\n{\n  return (__m64) __builtin_ia32_pmulhrsw ((__v4hi)__X, (__v4hi)__Y);\n}\n\nstatic __inline __m128i __attribute__((__always_inline__))\n_mm_shuffle_epi8 (__m128i __X, __m128i __Y)\n{\n  return (__m128i) __builtin_ia32_pshufb128 ((__v16qi)__X, (__v16qi)__Y);\n}\n\nstatic __inline __m64 __attribute__((__always_inline__))\n_mm_shuffle_pi8 (__m64 __X, __m64 __Y)\n{\n  return (__m64) __builtin_ia32_pshufb ((__v8qi)__X, (__v8qi)__Y);\n}\n\nstatic __inline __m128i __attribute__((__always_inline__))\n_mm_sign_epi8 (__m128i __X, __m128i __Y)\n{\n  return (__m128i) __builtin_ia32_psignb128 ((__v16qi)__X, (__v16qi)__Y);\n}\n\nstatic __inline __m128i __attribute__((__always_inline__))\n_mm_sign_epi16 (__m128i __X, __m128i __Y)\n{\n  return (__m128i) __builtin_ia32_psignw128 ((__v8hi)__X, (__v8hi)__Y);\n}\n\nstatic __inline __m128i __attribute__((__always_inline__))\n_mm_sign_epi32 (__m128i __X, __m128i __Y)\n{\n  return (__m128i) __builtin_ia32_psignd128 ((__v4si)__X, (__v4si)__Y);\n}\n\nstatic __inline __m64 __attribute__((__always_inline__))\n_mm_sign_pi8 (__m64 __X, __m64 __Y)\n{\n  return (__m64) __builtin_ia32_psignb ((__v8qi)__X, (__v8qi)__Y);\n}\n\nstatic __inline __m64 __attribute__((__always_inline__))\n_mm_sign_pi16 (__m64 __X, __m64 __Y)\n{\n  return (__m64) __builtin_ia32_psignw ((__v4hi)__X, (__v4hi)__Y);\n}\n\nstatic __inline __m64 __attribute__((__always_inline__))\n_mm_sign_pi32 (__m64 __X, __m64 __Y)\n{\n  return (__m64) __builtin_ia32_psignd ((__v2si)__X, (__v2si)__Y);\n}\n\n#define _mm_alignr_epi8(__X, __Y, __N) \\\n  ((__m128i)__builtin_ia32_palignr128 ((__v2di) __X, (__v2di) __Y, (__N) * 8))\n\n#define _mm_alignr_pi8(__X, __Y, __N) \\\n  ((__m64)__builtin_ia32_palignr ((long long) (__X), (long long) (__Y), (__N) * 8))\n\nstatic __inline __m128i __attribute__((__always_inline__))\n_mm_abs_epi8 (__m128i __X)\n{\n  return (__m128i) __builtin_ia32_pabsb128 ((__v16qi)__X);\n}\n\nstatic __inline __m128i __attribute__((__always_inline__))\n_mm_abs_epi16 (__m128i __X)\n{\n  return (__m128i) __builtin_ia32_pabsw128 ((__v8hi)__X);\n}\n\nstatic __inline __m128i __attribute__((__always_inline__))\n_mm_abs_epi32 (__m128i __X)\n{\n  return (__m128i) __builtin_ia32_pabsd128 ((__v4si)__X);\n}\n\nstatic __inline __m64 __attribute__((__always_inline__))\n_mm_abs_pi8 (__m64 __X)\n{\n  return (__m64) __builtin_ia32_pabsb ((__v8qi)__X);\n}\n\nstatic __inline __m64 __attribute__((__always_inline__))\n_mm_abs_pi16 (__m64 __X)\n{\n  return (__m64) __builtin_ia32_pabsw ((__v4hi)__X);\n}\n\nstatic __inline __m64 __attribute__((__always_inline__))\n_mm_abs_pi32 (__m64 __X)\n{\n  return (__m64) __builtin_ia32_pabsd ((__v2si)__X);\n}\n\n#endif /* __SSSE3__ */\n\n#endif /* _TMMINTRIN_H_INCLUDED */\n"
  },
  {
    "path": "freebsd-headers/gcc/4.2/xmmintrin.h",
    "content": "/* Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007\n   Free Software Foundation, Inc.\n\n   This file is part of GCC.\n\n   GCC is free software; you can redistribute it and/or modify\n   it under the terms of the GNU General Public License as published by\n   the Free Software Foundation; either version 2, or (at your option)\n   any later version.\n\n   GCC is distributed in the hope that it will be useful,\n   but WITHOUT ANY WARRANTY; without even the implied warranty of\n   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n   GNU General Public License for more details.\n\n   You should have received a copy of the GNU General Public License\n   along with GCC; see the file COPYING.  If not, write to\n   the Free Software Foundation, 51 Franklin Street, Fifth Floor,\n   Boston, MA 02110-1301, USA.  */\n\n/* As a special exception, if you include this header file into source\n   files compiled by GCC, this header file does not by itself cause\n   the resulting executable to be covered by the GNU General Public\n   License.  This exception does not however invalidate any other\n   reasons why the executable file might be covered by the GNU General\n   Public License.  */\n\n/* Implemented from the specification included in the Intel C++ Compiler\n   User Guide and Reference, version 9.0.  */\n\n#ifndef _XMMINTRIN_H_INCLUDED\n#define _XMMINTRIN_H_INCLUDED\n\n#ifndef __SSE__\n# error \"SSE instruction set not enabled\"\n#else\n\n/* We need type definitions from the MMX header file.  */\n#include <mmintrin.h>\n\n/* Get _mm_malloc () and _mm_free ().  */\n#include <mm_malloc.h>\n\n/* The Intel API is flexible enough that we must allow aliasing with other\n   vector types, and their scalar components.  */\ntypedef float __m128 __attribute__ ((__vector_size__ (16), __may_alias__));\n\n/* Internal data types for implementing the intrinsics.  */\ntypedef float __v4sf __attribute__ ((__vector_size__ (16)));\n\n/* Create a selector for use with the SHUFPS instruction.  */\n#define _MM_SHUFFLE(fp3,fp2,fp1,fp0) \\\n (((fp3) << 6) | ((fp2) << 4) | ((fp1) << 2) | (fp0))\n\n/* Constants for use with _mm_prefetch.  */\nenum _mm_hint\n{\n  _MM_HINT_T0 = 3,\n  _MM_HINT_T1 = 2,\n  _MM_HINT_T2 = 1,\n  _MM_HINT_NTA = 0\n};\n\n/* Bits in the MXCSR.  */\n#define _MM_EXCEPT_MASK       0x003f\n#define _MM_EXCEPT_INVALID    0x0001\n#define _MM_EXCEPT_DENORM     0x0002\n#define _MM_EXCEPT_DIV_ZERO   0x0004\n#define _MM_EXCEPT_OVERFLOW   0x0008\n#define _MM_EXCEPT_UNDERFLOW  0x0010\n#define _MM_EXCEPT_INEXACT    0x0020\n\n#define _MM_MASK_MASK         0x1f80\n#define _MM_MASK_INVALID      0x0080\n#define _MM_MASK_DENORM       0x0100\n#define _MM_MASK_DIV_ZERO     0x0200\n#define _MM_MASK_OVERFLOW     0x0400\n#define _MM_MASK_UNDERFLOW    0x0800\n#define _MM_MASK_INEXACT      0x1000\n\n#define _MM_ROUND_MASK        0x6000\n#define _MM_ROUND_NEAREST     0x0000\n#define _MM_ROUND_DOWN        0x2000\n#define _MM_ROUND_UP          0x4000\n#define _MM_ROUND_TOWARD_ZERO 0x6000\n\n#define _MM_FLUSH_ZERO_MASK   0x8000\n#define _MM_FLUSH_ZERO_ON     0x8000\n#define _MM_FLUSH_ZERO_OFF    0x0000\n\n/* Create a vector of zeros.  */\nstatic __inline __m128 __attribute__((__always_inline__))\n_mm_setzero_ps (void)\n{\n  return __extension__ (__m128){ 0.0f, 0.0f, 0.0f, 0.0f };\n}\n\n/* Perform the respective operation on the lower SPFP (single-precision\n   floating-point) values of A and B; the upper three SPFP values are\n   passed through from A.  */\n\nstatic __inline __m128 __attribute__((__always_inline__))\n_mm_add_ss (__m128 __A, __m128 __B)\n{\n  return (__m128) __builtin_ia32_addss ((__v4sf)__A, (__v4sf)__B);\n}\n\nstatic __inline __m128 __attribute__((__always_inline__))\n_mm_sub_ss (__m128 __A, __m128 __B)\n{\n  return (__m128) __builtin_ia32_subss ((__v4sf)__A, (__v4sf)__B);\n}\n\nstatic __inline __m128 __attribute__((__always_inline__))\n_mm_mul_ss (__m128 __A, __m128 __B)\n{\n  return (__m128) __builtin_ia32_mulss ((__v4sf)__A, (__v4sf)__B);\n}\n\nstatic __inline __m128 __attribute__((__always_inline__))\n_mm_div_ss (__m128 __A, __m128 __B)\n{\n  return (__m128) __builtin_ia32_divss ((__v4sf)__A, (__v4sf)__B);\n}\n\nstatic __inline __m128 __attribute__((__always_inline__))\n_mm_sqrt_ss (__m128 __A)\n{\n  return (__m128) __builtin_ia32_sqrtss ((__v4sf)__A);\n}\n\nstatic __inline __m128 __attribute__((__always_inline__))\n_mm_rcp_ss (__m128 __A)\n{\n  return (__m128) __builtin_ia32_rcpss ((__v4sf)__A);\n}\n\nstatic __inline __m128 __attribute__((__always_inline__))\n_mm_rsqrt_ss (__m128 __A)\n{\n  return (__m128) __builtin_ia32_rsqrtss ((__v4sf)__A);\n}\n\nstatic __inline __m128 __attribute__((__always_inline__))\n_mm_min_ss (__m128 __A, __m128 __B)\n{\n  return (__m128) __builtin_ia32_minss ((__v4sf)__A, (__v4sf)__B);\n}\n\nstatic __inline __m128 __attribute__((__always_inline__))\n_mm_max_ss (__m128 __A, __m128 __B)\n{\n  return (__m128) __builtin_ia32_maxss ((__v4sf)__A, (__v4sf)__B);\n}\n\n/* Perform the respective operation on the four SPFP values in A and B.  */\n\nstatic __inline __m128 __attribute__((__always_inline__))\n_mm_add_ps (__m128 __A, __m128 __B)\n{\n  return (__m128) __builtin_ia32_addps ((__v4sf)__A, (__v4sf)__B);\n}\n\nstatic __inline __m128 __attribute__((__always_inline__))\n_mm_sub_ps (__m128 __A, __m128 __B)\n{\n  return (__m128) __builtin_ia32_subps ((__v4sf)__A, (__v4sf)__B);\n}\n\nstatic __inline __m128 __attribute__((__always_inline__))\n_mm_mul_ps (__m128 __A, __m128 __B)\n{\n  return (__m128) __builtin_ia32_mulps ((__v4sf)__A, (__v4sf)__B);\n}\n\nstatic __inline __m128 __attribute__((__always_inline__))\n_mm_div_ps (__m128 __A, __m128 __B)\n{\n  return (__m128) __builtin_ia32_divps ((__v4sf)__A, (__v4sf)__B);\n}\n\nstatic __inline __m128 __attribute__((__always_inline__))\n_mm_sqrt_ps (__m128 __A)\n{\n  return (__m128) __builtin_ia32_sqrtps ((__v4sf)__A);\n}\n\nstatic __inline __m128 __attribute__((__always_inline__))\n_mm_rcp_ps (__m128 __A)\n{\n  return (__m128) __builtin_ia32_rcpps ((__v4sf)__A);\n}\n\nstatic __inline __m128 __attribute__((__always_inline__))\n_mm_rsqrt_ps (__m128 __A)\n{\n  return (__m128) __builtin_ia32_rsqrtps ((__v4sf)__A);\n}\n\nstatic __inline __m128 __attribute__((__always_inline__))\n_mm_min_ps (__m128 __A, __m128 __B)\n{\n  return (__m128) __builtin_ia32_minps ((__v4sf)__A, (__v4sf)__B);\n}\n\nstatic __inline __m128 __attribute__((__always_inline__))\n_mm_max_ps (__m128 __A, __m128 __B)\n{\n  return (__m128) __builtin_ia32_maxps ((__v4sf)__A, (__v4sf)__B);\n}\n\n/* Perform logical bit-wise operations on 128-bit values.  */\n\nstatic __inline __m128 __attribute__((__always_inline__))\n_mm_and_ps (__m128 __A, __m128 __B)\n{\n  return __builtin_ia32_andps (__A, __B);\n}\n\nstatic __inline __m128 __attribute__((__always_inline__))\n_mm_andnot_ps (__m128 __A, __m128 __B)\n{\n  return __builtin_ia32_andnps (__A, __B);\n}\n\nstatic __inline __m128 __attribute__((__always_inline__))\n_mm_or_ps (__m128 __A, __m128 __B)\n{\n  return __builtin_ia32_orps (__A, __B);\n}\n\nstatic __inline __m128 __attribute__((__always_inline__))\n_mm_xor_ps (__m128 __A, __m128 __B)\n{\n  return __builtin_ia32_xorps (__A, __B);\n}\n\n/* Perform a comparison on the lower SPFP values of A and B.  If the\n   comparison is true, place a mask of all ones in the result, otherwise a\n   mask of zeros.  The upper three SPFP values are passed through from A.  */\n\nstatic __inline __m128 __attribute__((__always_inline__))\n_mm_cmpeq_ss (__m128 __A, __m128 __B)\n{\n  return (__m128) __builtin_ia32_cmpeqss ((__v4sf)__A, (__v4sf)__B);\n}\n\nstatic __inline __m128 __attribute__((__always_inline__))\n_mm_cmplt_ss (__m128 __A, __m128 __B)\n{\n  return (__m128) __builtin_ia32_cmpltss ((__v4sf)__A, (__v4sf)__B);\n}\n\nstatic __inline __m128 __attribute__((__always_inline__))\n_mm_cmple_ss (__m128 __A, __m128 __B)\n{\n  return (__m128) __builtin_ia32_cmpless ((__v4sf)__A, (__v4sf)__B);\n}\n\nstatic __inline __m128 __attribute__((__always_inline__))\n_mm_cmpgt_ss (__m128 __A, __m128 __B)\n{\n  return (__m128) __builtin_ia32_movss ((__v4sf) __A,\n\t\t\t\t\t(__v4sf)\n\t\t\t\t\t__builtin_ia32_cmpltss ((__v4sf) __B,\n\t\t\t\t\t\t\t\t(__v4sf)\n\t\t\t\t\t\t\t\t__A));\n}\n\nstatic __inline __m128 __attribute__((__always_inline__))\n_mm_cmpge_ss (__m128 __A, __m128 __B)\n{\n  return (__m128) __builtin_ia32_movss ((__v4sf) __A,\n\t\t\t\t\t(__v4sf)\n\t\t\t\t\t__builtin_ia32_cmpless ((__v4sf) __B,\n\t\t\t\t\t\t\t\t(__v4sf)\n\t\t\t\t\t\t\t\t__A));\n}\n\nstatic __inline __m128 __attribute__((__always_inline__))\n_mm_cmpneq_ss (__m128 __A, __m128 __B)\n{\n  return (__m128) __builtin_ia32_cmpneqss ((__v4sf)__A, (__v4sf)__B);\n}\n\nstatic __inline __m128 __attribute__((__always_inline__))\n_mm_cmpnlt_ss (__m128 __A, __m128 __B)\n{\n  return (__m128) __builtin_ia32_cmpnltss ((__v4sf)__A, (__v4sf)__B);\n}\n\nstatic __inline __m128 __attribute__((__always_inline__))\n_mm_cmpnle_ss (__m128 __A, __m128 __B)\n{\n  return (__m128) __builtin_ia32_cmpnless ((__v4sf)__A, (__v4sf)__B);\n}\n\nstatic __inline __m128 __attribute__((__always_inline__))\n_mm_cmpngt_ss (__m128 __A, __m128 __B)\n{\n  return (__m128) __builtin_ia32_movss ((__v4sf) __A,\n\t\t\t\t\t(__v4sf)\n\t\t\t\t\t__builtin_ia32_cmpnltss ((__v4sf) __B,\n\t\t\t\t\t\t\t\t (__v4sf)\n\t\t\t\t\t\t\t\t __A));\n}\n\nstatic __inline __m128 __attribute__((__always_inline__))\n_mm_cmpnge_ss (__m128 __A, __m128 __B)\n{\n  return (__m128) __builtin_ia32_movss ((__v4sf) __A,\n\t\t\t\t\t(__v4sf)\n\t\t\t\t\t__builtin_ia32_cmpnless ((__v4sf) __B,\n\t\t\t\t\t\t\t\t (__v4sf)\n\t\t\t\t\t\t\t\t __A));\n}\n\nstatic __inline __m128 __attribute__((__always_inline__))\n_mm_cmpord_ss (__m128 __A, __m128 __B)\n{\n  return (__m128) __builtin_ia32_cmpordss ((__v4sf)__A, (__v4sf)__B);\n}\n\nstatic __inline __m128 __attribute__((__always_inline__))\n_mm_cmpunord_ss (__m128 __A, __m128 __B)\n{\n  return (__m128) __builtin_ia32_cmpunordss ((__v4sf)__A, (__v4sf)__B);\n}\n\n/* Perform a comparison on the four SPFP values of A and B.  For each\n   element, if the comparison is true, place a mask of all ones in the\n   result, otherwise a mask of zeros.  */\n\nstatic __inline __m128 __attribute__((__always_inline__))\n_mm_cmpeq_ps (__m128 __A, __m128 __B)\n{\n  return (__m128) __builtin_ia32_cmpeqps ((__v4sf)__A, (__v4sf)__B);\n}\n\nstatic __inline __m128 __attribute__((__always_inline__))\n_mm_cmplt_ps (__m128 __A, __m128 __B)\n{\n  return (__m128) __builtin_ia32_cmpltps ((__v4sf)__A, (__v4sf)__B);\n}\n\nstatic __inline __m128 __attribute__((__always_inline__))\n_mm_cmple_ps (__m128 __A, __m128 __B)\n{\n  return (__m128) __builtin_ia32_cmpleps ((__v4sf)__A, (__v4sf)__B);\n}\n\nstatic __inline __m128 __attribute__((__always_inline__))\n_mm_cmpgt_ps (__m128 __A, __m128 __B)\n{\n  return (__m128) __builtin_ia32_cmpgtps ((__v4sf)__A, (__v4sf)__B);\n}\n\nstatic __inline __m128 __attribute__((__always_inline__))\n_mm_cmpge_ps (__m128 __A, __m128 __B)\n{\n  return (__m128) __builtin_ia32_cmpgeps ((__v4sf)__A, (__v4sf)__B);\n}\n\nstatic __inline __m128 __attribute__((__always_inline__))\n_mm_cmpneq_ps (__m128 __A, __m128 __B)\n{\n  return (__m128) __builtin_ia32_cmpneqps ((__v4sf)__A, (__v4sf)__B);\n}\n\nstatic __inline __m128 __attribute__((__always_inline__))\n_mm_cmpnlt_ps (__m128 __A, __m128 __B)\n{\n  return (__m128) __builtin_ia32_cmpnltps ((__v4sf)__A, (__v4sf)__B);\n}\n\nstatic __inline __m128 __attribute__((__always_inline__))\n_mm_cmpnle_ps (__m128 __A, __m128 __B)\n{\n  return (__m128) __builtin_ia32_cmpnleps ((__v4sf)__A, (__v4sf)__B);\n}\n\nstatic __inline __m128 __attribute__((__always_inline__))\n_mm_cmpngt_ps (__m128 __A, __m128 __B)\n{\n  return (__m128) __builtin_ia32_cmpngtps ((__v4sf)__A, (__v4sf)__B);\n}\n\nstatic __inline __m128 __attribute__((__always_inline__))\n_mm_cmpnge_ps (__m128 __A, __m128 __B)\n{\n  return (__m128) __builtin_ia32_cmpngeps ((__v4sf)__A, (__v4sf)__B);\n}\n\nstatic __inline __m128 __attribute__((__always_inline__))\n_mm_cmpord_ps (__m128 __A, __m128 __B)\n{\n  return (__m128) __builtin_ia32_cmpordps ((__v4sf)__A, (__v4sf)__B);\n}\n\nstatic __inline __m128 __attribute__((__always_inline__))\n_mm_cmpunord_ps (__m128 __A, __m128 __B)\n{\n  return (__m128) __builtin_ia32_cmpunordps ((__v4sf)__A, (__v4sf)__B);\n}\n\n/* Compare the lower SPFP values of A and B and return 1 if true\n   and 0 if false.  */\n\nstatic __inline int __attribute__((__always_inline__))\n_mm_comieq_ss (__m128 __A, __m128 __B)\n{\n  return __builtin_ia32_comieq ((__v4sf)__A, (__v4sf)__B);\n}\n\nstatic __inline int __attribute__((__always_inline__))\n_mm_comilt_ss (__m128 __A, __m128 __B)\n{\n  return __builtin_ia32_comilt ((__v4sf)__A, (__v4sf)__B);\n}\n\nstatic __inline int __attribute__((__always_inline__))\n_mm_comile_ss (__m128 __A, __m128 __B)\n{\n  return __builtin_ia32_comile ((__v4sf)__A, (__v4sf)__B);\n}\n\nstatic __inline int __attribute__((__always_inline__))\n_mm_comigt_ss (__m128 __A, __m128 __B)\n{\n  return __builtin_ia32_comigt ((__v4sf)__A, (__v4sf)__B);\n}\n\nstatic __inline int __attribute__((__always_inline__))\n_mm_comige_ss (__m128 __A, __m128 __B)\n{\n  return __builtin_ia32_comige ((__v4sf)__A, (__v4sf)__B);\n}\n\nstatic __inline int __attribute__((__always_inline__))\n_mm_comineq_ss (__m128 __A, __m128 __B)\n{\n  return __builtin_ia32_comineq ((__v4sf)__A, (__v4sf)__B);\n}\n\nstatic __inline int __attribute__((__always_inline__))\n_mm_ucomieq_ss (__m128 __A, __m128 __B)\n{\n  return __builtin_ia32_ucomieq ((__v4sf)__A, (__v4sf)__B);\n}\n\nstatic __inline int __attribute__((__always_inline__))\n_mm_ucomilt_ss (__m128 __A, __m128 __B)\n{\n  return __builtin_ia32_ucomilt ((__v4sf)__A, (__v4sf)__B);\n}\n\nstatic __inline int __attribute__((__always_inline__))\n_mm_ucomile_ss (__m128 __A, __m128 __B)\n{\n  return __builtin_ia32_ucomile ((__v4sf)__A, (__v4sf)__B);\n}\n\nstatic __inline int __attribute__((__always_inline__))\n_mm_ucomigt_ss (__m128 __A, __m128 __B)\n{\n  return __builtin_ia32_ucomigt ((__v4sf)__A, (__v4sf)__B);\n}\n\nstatic __inline int __attribute__((__always_inline__))\n_mm_ucomige_ss (__m128 __A, __m128 __B)\n{\n  return __builtin_ia32_ucomige ((__v4sf)__A, (__v4sf)__B);\n}\n\nstatic __inline int __attribute__((__always_inline__))\n_mm_ucomineq_ss (__m128 __A, __m128 __B)\n{\n  return __builtin_ia32_ucomineq ((__v4sf)__A, (__v4sf)__B);\n}\n\n/* Convert the lower SPFP value to a 32-bit integer according to the current\n   rounding mode.  */\nstatic __inline int __attribute__((__always_inline__))\n_mm_cvtss_si32 (__m128 __A)\n{\n  return __builtin_ia32_cvtss2si ((__v4sf) __A);\n}\n\nstatic __inline int __attribute__((__always_inline__))\n_mm_cvt_ss2si (__m128 __A)\n{\n  return _mm_cvtss_si32 (__A);\n}\n\n#ifdef __x86_64__\n/* Convert the lower SPFP value to a 32-bit integer according to the\n   current rounding mode.  */\n\n/* Intel intrinsic.  */\nstatic __inline long long __attribute__((__always_inline__))\n_mm_cvtss_si64 (__m128 __A)\n{\n  return __builtin_ia32_cvtss2si64 ((__v4sf) __A);\n}\n\n/* Microsoft intrinsic.  */\nstatic __inline long long __attribute__((__always_inline__))\n_mm_cvtss_si64x (__m128 __A)\n{\n  return __builtin_ia32_cvtss2si64 ((__v4sf) __A);\n}\n#endif\n\n/* Convert the two lower SPFP values to 32-bit integers according to the\n   current rounding mode.  Return the integers in packed form.  */\nstatic __inline __m64 __attribute__((__always_inline__))\n_mm_cvtps_pi32 (__m128 __A)\n{\n  return (__m64) __builtin_ia32_cvtps2pi ((__v4sf) __A);\n}\n\nstatic __inline __m64 __attribute__((__always_inline__))\n_mm_cvt_ps2pi (__m128 __A)\n{\n  return _mm_cvtps_pi32 (__A);\n}\n\n/* Truncate the lower SPFP value to a 32-bit integer.  */\nstatic __inline int __attribute__((__always_inline__))\n_mm_cvttss_si32 (__m128 __A)\n{\n  return __builtin_ia32_cvttss2si ((__v4sf) __A);\n}\n\nstatic __inline int __attribute__((__always_inline__))\n_mm_cvtt_ss2si (__m128 __A)\n{\n  return _mm_cvttss_si32 (__A);\n}\n\n#ifdef __x86_64__\n/* Truncate the lower SPFP value to a 32-bit integer.  */\n\n/* Intel intrinsic.  */\nstatic __inline long long __attribute__((__always_inline__))\n_mm_cvttss_si64 (__m128 __A)\n{\n  return __builtin_ia32_cvttss2si64 ((__v4sf) __A);\n}\n\n/* Microsoft intrinsic.  */\nstatic __inline long long __attribute__((__always_inline__))\n_mm_cvttss_si64x (__m128 __A)\n{\n  return __builtin_ia32_cvttss2si64 ((__v4sf) __A);\n}\n#endif\n\n/* Truncate the two lower SPFP values to 32-bit integers.  Return the\n   integers in packed form.  */\nstatic __inline __m64 __attribute__((__always_inline__))\n_mm_cvttps_pi32 (__m128 __A)\n{\n  return (__m64) __builtin_ia32_cvttps2pi ((__v4sf) __A);\n}\n\nstatic __inline __m64 __attribute__((__always_inline__))\n_mm_cvtt_ps2pi (__m128 __A)\n{\n  return _mm_cvttps_pi32 (__A);\n}\n\n/* Convert B to a SPFP value and insert it as element zero in A.  */\nstatic __inline __m128 __attribute__((__always_inline__))\n_mm_cvtsi32_ss (__m128 __A, int __B)\n{\n  return (__m128) __builtin_ia32_cvtsi2ss ((__v4sf) __A, __B);\n}\n\nstatic __inline __m128 __attribute__((__always_inline__))\n_mm_cvt_si2ss (__m128 __A, int __B)\n{\n  return _mm_cvtsi32_ss (__A, __B);\n}\n\n#ifdef __x86_64__\n/* Convert B to a SPFP value and insert it as element zero in A.  */\n\n/* Intel intrinsic.  */\nstatic __inline __m128 __attribute__((__always_inline__))\n_mm_cvtsi64_ss (__m128 __A, long long __B)\n{\n  return (__m128) __builtin_ia32_cvtsi642ss ((__v4sf) __A, __B);\n}\n\n/* Microsoft intrinsic.  */\nstatic __inline __m128 __attribute__((__always_inline__))\n_mm_cvtsi64x_ss (__m128 __A, long long __B)\n{\n  return (__m128) __builtin_ia32_cvtsi642ss ((__v4sf) __A, __B);\n}\n#endif\n\n/* Convert the two 32-bit values in B to SPFP form and insert them\n   as the two lower elements in A.  */\nstatic __inline __m128 __attribute__((__always_inline__))\n_mm_cvtpi32_ps (__m128 __A, __m64 __B)\n{\n  return (__m128) __builtin_ia32_cvtpi2ps ((__v4sf) __A, (__v2si)__B);\n}\n\nstatic __inline __m128 __attribute__((__always_inline__))\n_mm_cvt_pi2ps (__m128 __A, __m64 __B)\n{\n  return _mm_cvtpi32_ps (__A, __B);\n}\n\n/* Convert the four signed 16-bit values in A to SPFP form.  */\nstatic __inline __m128 __attribute__((__always_inline__))\n_mm_cvtpi16_ps (__m64 __A)\n{\n  __v4hi __sign;\n  __v2si __hisi, __losi;\n  __v4sf __r;\n\n  /* This comparison against zero gives us a mask that can be used to\n     fill in the missing sign bits in the unpack operations below, so\n     that we get signed values after unpacking.  */\n  __sign = __builtin_ia32_pcmpgtw ((__v4hi)0LL, (__v4hi)__A);\n\n  /* Convert the four words to doublewords.  */\n  __hisi = (__v2si) __builtin_ia32_punpckhwd ((__v4hi)__A, __sign);\n  __losi = (__v2si) __builtin_ia32_punpcklwd ((__v4hi)__A, __sign);\n\n  /* Convert the doublewords to floating point two at a time.  */\n  __r = (__v4sf) _mm_setzero_ps ();\n  __r = __builtin_ia32_cvtpi2ps (__r, __hisi);\n  __r = __builtin_ia32_movlhps (__r, __r);\n  __r = __builtin_ia32_cvtpi2ps (__r, __losi);\n\n  return (__m128) __r;\n}\n\n/* Convert the four unsigned 16-bit values in A to SPFP form.  */\nstatic __inline __m128 __attribute__((__always_inline__))\n_mm_cvtpu16_ps (__m64 __A)\n{\n  __v2si __hisi, __losi;\n  __v4sf __r;\n\n  /* Convert the four words to doublewords.  */\n  __hisi = (__v2si) __builtin_ia32_punpckhwd ((__v4hi)__A, (__v4hi)0LL);\n  __losi = (__v2si) __builtin_ia32_punpcklwd ((__v4hi)__A, (__v4hi)0LL);\n\n  /* Convert the doublewords to floating point two at a time.  */\n  __r = (__v4sf) _mm_setzero_ps ();\n  __r = __builtin_ia32_cvtpi2ps (__r, __hisi);\n  __r = __builtin_ia32_movlhps (__r, __r);\n  __r = __builtin_ia32_cvtpi2ps (__r, __losi);\n\n  return (__m128) __r;\n}\n\n/* Convert the low four signed 8-bit values in A to SPFP form.  */\nstatic __inline __m128 __attribute__((__always_inline__))\n_mm_cvtpi8_ps (__m64 __A)\n{\n  __v8qi __sign;\n\n  /* This comparison against zero gives us a mask that can be used to\n     fill in the missing sign bits in the unpack operations below, so\n     that we get signed values after unpacking.  */\n  __sign = __builtin_ia32_pcmpgtb ((__v8qi)0LL, (__v8qi)__A);\n\n  /* Convert the four low bytes to words.  */\n  __A = (__m64) __builtin_ia32_punpcklbw ((__v8qi)__A, __sign);\n\n  return _mm_cvtpi16_ps(__A);\n}\n\n/* Convert the low four unsigned 8-bit values in A to SPFP form.  */\nstatic __inline __m128 __attribute__((__always_inline__))\n_mm_cvtpu8_ps(__m64 __A)\n{\n  __A = (__m64) __builtin_ia32_punpcklbw ((__v8qi)__A, (__v8qi)0LL);\n  return _mm_cvtpu16_ps(__A);\n}\n\n/* Convert the four signed 32-bit values in A and B to SPFP form.  */\nstatic __inline __m128 __attribute__((__always_inline__))\n_mm_cvtpi32x2_ps(__m64 __A, __m64 __B)\n{\n  __v4sf __zero = (__v4sf) _mm_setzero_ps ();\n  __v4sf __sfa = __builtin_ia32_cvtpi2ps (__zero, (__v2si)__A);\n  __v4sf __sfb = __builtin_ia32_cvtpi2ps (__zero, (__v2si)__B);\n  return (__m128) __builtin_ia32_movlhps (__sfa, __sfb);\n}\n\n/* Convert the four SPFP values in A to four signed 16-bit integers.  */\nstatic __inline __m64 __attribute__((__always_inline__))\n_mm_cvtps_pi16(__m128 __A)\n{\n  __v4sf __hisf = (__v4sf)__A;\n  __v4sf __losf = __builtin_ia32_movhlps (__hisf, __hisf);\n  __v2si __hisi = __builtin_ia32_cvtps2pi (__hisf);\n  __v2si __losi = __builtin_ia32_cvtps2pi (__losf);\n  return (__m64) __builtin_ia32_packssdw (__hisi, __losi);\n}\n\n/* Convert the four SPFP values in A to four signed 8-bit integers.  */\nstatic __inline __m64 __attribute__((__always_inline__))\n_mm_cvtps_pi8(__m128 __A)\n{\n  __v4hi __tmp = (__v4hi) _mm_cvtps_pi16 (__A);\n  return (__m64) __builtin_ia32_packsswb (__tmp, (__v4hi)0LL);\n}\n\n/* Selects four specific SPFP values from A and B based on MASK.  */\n#if 0\nstatic __inline __m128 __attribute__((__always_inline__))\n_mm_shuffle_ps (__m128 __A, __m128 __B, int __mask)\n{\n  return (__m128) __builtin_ia32_shufps ((__v4sf)__A, (__v4sf)__B, __mask);\n}\n#else\n#define _mm_shuffle_ps(A, B, MASK) \\\n ((__m128) __builtin_ia32_shufps ((__v4sf)(A), (__v4sf)(B), (MASK)))\n#endif\n\n\n/* Selects and interleaves the upper two SPFP values from A and B.  */\nstatic __inline __m128 __attribute__((__always_inline__))\n_mm_unpackhi_ps (__m128 __A, __m128 __B)\n{\n  return (__m128) __builtin_ia32_unpckhps ((__v4sf)__A, (__v4sf)__B);\n}\n\n/* Selects and interleaves the lower two SPFP values from A and B.  */\nstatic __inline __m128 __attribute__((__always_inline__))\n_mm_unpacklo_ps (__m128 __A, __m128 __B)\n{\n  return (__m128) __builtin_ia32_unpcklps ((__v4sf)__A, (__v4sf)__B);\n}\n\n/* Sets the upper two SPFP values with 64-bits of data loaded from P;\n   the lower two values are passed through from A.  */\nstatic __inline __m128 __attribute__((__always_inline__))\n_mm_loadh_pi (__m128 __A, __m64 const *__P)\n{\n  return (__m128) __builtin_ia32_loadhps ((__v4sf)__A, (__v2si *)__P);\n}\n\n/* Stores the upper two SPFP values of A into P.  */\nstatic __inline void __attribute__((__always_inline__))\n_mm_storeh_pi (__m64 *__P, __m128 __A)\n{\n  __builtin_ia32_storehps ((__v2si *)__P, (__v4sf)__A);\n}\n\n/* Moves the upper two values of B into the lower two values of A.  */\nstatic __inline __m128 __attribute__((__always_inline__))\n_mm_movehl_ps (__m128 __A, __m128 __B)\n{\n  return (__m128) __builtin_ia32_movhlps ((__v4sf)__A, (__v4sf)__B);\n}\n\n/* Moves the lower two values of B into the upper two values of A.  */\nstatic __inline __m128 __attribute__((__always_inline__))\n_mm_movelh_ps (__m128 __A, __m128 __B)\n{\n  return (__m128) __builtin_ia32_movlhps ((__v4sf)__A, (__v4sf)__B);\n}\n\n/* Sets the lower two SPFP values with 64-bits of data loaded from P;\n   the upper two values are passed through from A.  */\nstatic __inline __m128 __attribute__((__always_inline__))\n_mm_loadl_pi (__m128 __A, __m64 const *__P)\n{\n  return (__m128) __builtin_ia32_loadlps ((__v4sf)__A, (__v2si *)__P);\n}\n\n/* Stores the lower two SPFP values of A into P.  */\nstatic __inline void __attribute__((__always_inline__))\n_mm_storel_pi (__m64 *__P, __m128 __A)\n{\n  __builtin_ia32_storelps ((__v2si *)__P, (__v4sf)__A);\n}\n\n/* Creates a 4-bit mask from the most significant bits of the SPFP values.  */\nstatic __inline int __attribute__((__always_inline__))\n_mm_movemask_ps (__m128 __A)\n{\n  return __builtin_ia32_movmskps ((__v4sf)__A);\n}\n\n/* Return the contents of the control register.  */\nstatic __inline unsigned int __attribute__((__always_inline__))\n_mm_getcsr (void)\n{\n  return __builtin_ia32_stmxcsr ();\n}\n\n/* Read exception bits from the control register.  */\nstatic __inline unsigned int __attribute__((__always_inline__))\n_MM_GET_EXCEPTION_STATE (void)\n{\n  return _mm_getcsr() & _MM_EXCEPT_MASK;\n}\n\nstatic __inline unsigned int __attribute__((__always_inline__))\n_MM_GET_EXCEPTION_MASK (void)\n{\n  return _mm_getcsr() & _MM_MASK_MASK;\n}\n\nstatic __inline unsigned int __attribute__((__always_inline__))\n_MM_GET_ROUNDING_MODE (void)\n{\n  return _mm_getcsr() & _MM_ROUND_MASK;\n}\n\nstatic __inline unsigned int __attribute__((__always_inline__))\n_MM_GET_FLUSH_ZERO_MODE (void)\n{\n  return _mm_getcsr() & _MM_FLUSH_ZERO_MASK;\n}\n\n/* Set the control register to I.  */\nstatic __inline void __attribute__((__always_inline__))\n_mm_setcsr (unsigned int __I)\n{\n  __builtin_ia32_ldmxcsr (__I);\n}\n\n/* Set exception bits in the control register.  */\nstatic __inline void __attribute__((__always_inline__))\n_MM_SET_EXCEPTION_STATE(unsigned int __mask)\n{\n  _mm_setcsr((_mm_getcsr() & ~_MM_EXCEPT_MASK) | __mask);\n}\n\nstatic __inline void __attribute__((__always_inline__))\n_MM_SET_EXCEPTION_MASK (unsigned int __mask)\n{\n  _mm_setcsr((_mm_getcsr() & ~_MM_MASK_MASK) | __mask);\n}\n\nstatic __inline void __attribute__((__always_inline__))\n_MM_SET_ROUNDING_MODE (unsigned int __mode)\n{\n  _mm_setcsr((_mm_getcsr() & ~_MM_ROUND_MASK) | __mode);\n}\n\nstatic __inline void __attribute__((__always_inline__))\n_MM_SET_FLUSH_ZERO_MODE (unsigned int __mode)\n{\n  _mm_setcsr((_mm_getcsr() & ~_MM_FLUSH_ZERO_MASK) | __mode);\n}\n\n/* Create a vector with element 0 as F and the rest zero.  */\nstatic __inline __m128 __attribute__((__always_inline__))\n_mm_set_ss (float __F)\n{\n  return __extension__ (__m128)(__v4sf){ __F, 0, 0, 0 };\n}\n\n/* Create a vector with all four elements equal to F.  */\nstatic __inline __m128 __attribute__((__always_inline__))\n_mm_set1_ps (float __F)\n{\n  return __extension__ (__m128)(__v4sf){ __F, __F, __F, __F };\n}\n\nstatic __inline __m128 __attribute__((__always_inline__))\n_mm_set_ps1 (float __F)\n{\n  return _mm_set1_ps (__F);\n}\n\n/* Create a vector with element 0 as *P and the rest zero.  */\nstatic __inline __m128 __attribute__((__always_inline__))\n_mm_load_ss (float const *__P)\n{\n  return _mm_set_ss (*__P);\n}\n\n/* Create a vector with all four elements equal to *P.  */\nstatic __inline __m128 __attribute__((__always_inline__))\n_mm_load1_ps (float const *__P)\n{\n  return _mm_set1_ps (*__P);\n}\n\nstatic __inline __m128 __attribute__((__always_inline__))\n_mm_load_ps1 (float const *__P)\n{\n  return _mm_load1_ps (__P);\n}\n\n/* Load four SPFP values from P.  The address must be 16-byte aligned.  */\nstatic __inline __m128 __attribute__((__always_inline__))\n_mm_load_ps (float const *__P)\n{\n  return (__m128) *(__v4sf *)__P;\n}\n\n/* Load four SPFP values from P.  The address need not be 16-byte aligned.  */\nstatic __inline __m128 __attribute__((__always_inline__))\n_mm_loadu_ps (float const *__P)\n{\n  return (__m128) __builtin_ia32_loadups (__P);\n}\n\n/* Load four SPFP values in reverse order.  The address must be aligned.  */\nstatic __inline __m128 __attribute__((__always_inline__))\n_mm_loadr_ps (float const *__P)\n{\n  __v4sf __tmp = *(__v4sf *)__P;\n  return (__m128) __builtin_ia32_shufps (__tmp, __tmp, _MM_SHUFFLE (0,1,2,3));\n}\n\n/* Create the vector [Z Y X W].  */\nstatic __inline __m128 __attribute__((__always_inline__))\n_mm_set_ps (const float __Z, const float __Y, const float __X, const float __W)\n{\n  return __extension__ (__m128)(__v4sf){ __W, __X, __Y, __Z };\n}\n\n/* Create the vector [W X Y Z].  */\nstatic __inline __m128 __attribute__((__always_inline__))\n_mm_setr_ps (float __Z, float __Y, float __X, float __W)\n{\n  return __extension__ (__m128)(__v4sf){ __Z, __Y, __X, __W };\n}\n\n/* Stores the lower SPFP value.  */\nstatic __inline void __attribute__((__always_inline__))\n_mm_store_ss (float *__P, __m128 __A)\n{\n  *__P = __builtin_ia32_vec_ext_v4sf ((__v4sf)__A, 0);\n}\n\nstatic __inline float __attribute__((__always_inline__))\n_mm_cvtss_f32 (__m128 __A)\n{\n  return __builtin_ia32_vec_ext_v4sf ((__v4sf)__A, 0);\n}\n\n/* Store four SPFP values.  The address must be 16-byte aligned.  */\nstatic __inline void __attribute__((__always_inline__))\n_mm_store_ps (float *__P, __m128 __A)\n{\n  *(__v4sf *)__P = (__v4sf)__A;\n}\n\n/* Store four SPFP values.  The address need not be 16-byte aligned.  */\nstatic __inline void __attribute__((__always_inline__))\n_mm_storeu_ps (float *__P, __m128 __A)\n{\n  __builtin_ia32_storeups (__P, (__v4sf)__A);\n}\n\n/* Store the lower SPFP value across four words.  */\nstatic __inline void __attribute__((__always_inline__))\n_mm_store1_ps (float *__P, __m128 __A)\n{\n  __v4sf __va = (__v4sf)__A;\n  __v4sf __tmp = __builtin_ia32_shufps (__va, __va, _MM_SHUFFLE (0,0,0,0));\n  _mm_storeu_ps (__P, __tmp);\n}\n\nstatic __inline void __attribute__((__always_inline__))\n_mm_store_ps1 (float *__P, __m128 __A)\n{\n  _mm_store1_ps (__P, __A);\n}\n\n/* Store four SPFP values in reverse order.  The address must be aligned.  */\nstatic __inline void __attribute__((__always_inline__))\n_mm_storer_ps (float *__P, __m128 __A)\n{\n  __v4sf __va = (__v4sf)__A;\n  __v4sf __tmp = __builtin_ia32_shufps (__va, __va, _MM_SHUFFLE (0,1,2,3));\n  _mm_store_ps (__P, __tmp);\n}\n\n/* Sets the low SPFP value of A from the low value of B.  */\nstatic __inline __m128 __attribute__((__always_inline__))\n_mm_move_ss (__m128 __A, __m128 __B)\n{\n  return (__m128) __builtin_ia32_movss ((__v4sf)__A, (__v4sf)__B);\n}\n\n/* Extracts one of the four words of A.  The selector N must be immediate.  */\n#if 0\nstatic __inline int __attribute__((__always_inline__))\n_mm_extract_pi16 (__m64 const __A, int const __N)\n{\n  return __builtin_ia32_vec_ext_v4hi ((__v4hi)__A, __N);\n}\n\nstatic __inline int __attribute__((__always_inline__))\n_m_pextrw (__m64 const __A, int const __N)\n{\n  return _mm_extract_pi16 (__A, __N);\n}\n#else\n#define _mm_extract_pi16(A, N)\t__builtin_ia32_vec_ext_v4hi ((__v4hi)(A), (N))\n#define _m_pextrw(A, N)\t\t_mm_extract_pi16((A), (N))\n#endif\n\n/* Inserts word D into one of four words of A.  The selector N must be\n   immediate.  */\n#if 0\nstatic __inline __m64 __attribute__((__always_inline__))\n_mm_insert_pi16 (__m64 const __A, int const __D, int const __N)\n{\n  return (__m64) __builtin_ia32_vec_set_v4hi ((__v4hi)__A, __D, __N);\n}\n\nstatic __inline __m64 __attribute__((__always_inline__))\n_m_pinsrw (__m64 const __A, int const __D, int const __N)\n{\n  return _mm_insert_pi16 (__A, __D, __N);\n}\n#else\n#define _mm_insert_pi16(A, D, N) \\\n  ((__m64) __builtin_ia32_vec_set_v4hi ((__v4hi)(A), (D), (N)))\n#define _m_pinsrw(A, D, N)\t _mm_insert_pi16((A), (D), (N))\n#endif\n\n/* Compute the element-wise maximum of signed 16-bit values.  */\nstatic __inline __m64 __attribute__((__always_inline__))\n_mm_max_pi16 (__m64 __A, __m64 __B)\n{\n  return (__m64) __builtin_ia32_pmaxsw ((__v4hi)__A, (__v4hi)__B);\n}\n\nstatic __inline __m64 __attribute__((__always_inline__))\n_m_pmaxsw (__m64 __A, __m64 __B)\n{\n  return _mm_max_pi16 (__A, __B);\n}\n\n/* Compute the element-wise maximum of unsigned 8-bit values.  */\nstatic __inline __m64 __attribute__((__always_inline__))\n_mm_max_pu8 (__m64 __A, __m64 __B)\n{\n  return (__m64) __builtin_ia32_pmaxub ((__v8qi)__A, (__v8qi)__B);\n}\n\nstatic __inline __m64 __attribute__((__always_inline__))\n_m_pmaxub (__m64 __A, __m64 __B)\n{\n  return _mm_max_pu8 (__A, __B);\n}\n\n/* Compute the element-wise minimum of signed 16-bit values.  */\nstatic __inline __m64 __attribute__((__always_inline__))\n_mm_min_pi16 (__m64 __A, __m64 __B)\n{\n  return (__m64) __builtin_ia32_pminsw ((__v4hi)__A, (__v4hi)__B);\n}\n\nstatic __inline __m64 __attribute__((__always_inline__))\n_m_pminsw (__m64 __A, __m64 __B)\n{\n  return _mm_min_pi16 (__A, __B);\n}\n\n/* Compute the element-wise minimum of unsigned 8-bit values.  */\nstatic __inline __m64 __attribute__((__always_inline__))\n_mm_min_pu8 (__m64 __A, __m64 __B)\n{\n  return (__m64) __builtin_ia32_pminub ((__v8qi)__A, (__v8qi)__B);\n}\n\nstatic __inline __m64 __attribute__((__always_inline__))\n_m_pminub (__m64 __A, __m64 __B)\n{\n  return _mm_min_pu8 (__A, __B);\n}\n\n/* Create an 8-bit mask of the signs of 8-bit values.  */\nstatic __inline int __attribute__((__always_inline__))\n_mm_movemask_pi8 (__m64 __A)\n{\n  return __builtin_ia32_pmovmskb ((__v8qi)__A);\n}\n\nstatic __inline int __attribute__((__always_inline__))\n_m_pmovmskb (__m64 __A)\n{\n  return _mm_movemask_pi8 (__A);\n}\n\n/* Multiply four unsigned 16-bit values in A by four unsigned 16-bit values\n   in B and produce the high 16 bits of the 32-bit results.  */\nstatic __inline __m64 __attribute__((__always_inline__))\n_mm_mulhi_pu16 (__m64 __A, __m64 __B)\n{\n  return (__m64) __builtin_ia32_pmulhuw ((__v4hi)__A, (__v4hi)__B);\n}\n\nstatic __inline __m64 __attribute__((__always_inline__))\n_m_pmulhuw (__m64 __A, __m64 __B)\n{\n  return _mm_mulhi_pu16 (__A, __B);\n}\n\n/* Return a combination of the four 16-bit values in A.  The selector\n   must be an immediate.  */\n#if 0\nstatic __inline __m64 __attribute__((__always_inline__))\n_mm_shuffle_pi16 (__m64 __A, int __N)\n{\n  return (__m64) __builtin_ia32_pshufw ((__v4hi)__A, __N);\n}\n\nstatic __inline __m64 __attribute__((__always_inline__))\n_m_pshufw (__m64 __A, int __N)\n{\n  return _mm_shuffle_pi16 (__A, __N);\n}\n#else\n#define _mm_shuffle_pi16(A, N) \\\n  ((__m64) __builtin_ia32_pshufw ((__v4hi)(A), (N)))\n#define _m_pshufw(A, N)\t\t_mm_shuffle_pi16 ((A), (N))\n#endif\n\n/* Conditionally store byte elements of A into P.  The high bit of each\n   byte in the selector N determines whether the corresponding byte from\n   A is stored.  */\nstatic __inline void __attribute__((__always_inline__))\n_mm_maskmove_si64 (__m64 __A, __m64 __N, char *__P)\n{\n  __builtin_ia32_maskmovq ((__v8qi)__A, (__v8qi)__N, __P);\n}\n\nstatic __inline void __attribute__((__always_inline__))\n_m_maskmovq (__m64 __A, __m64 __N, char *__P)\n{\n  _mm_maskmove_si64 (__A, __N, __P);\n}\n\n/* Compute the rounded averages of the unsigned 8-bit values in A and B.  */\nstatic __inline __m64 __attribute__((__always_inline__))\n_mm_avg_pu8 (__m64 __A, __m64 __B)\n{\n  return (__m64) __builtin_ia32_pavgb ((__v8qi)__A, (__v8qi)__B);\n}\n\nstatic __inline __m64 __attribute__((__always_inline__))\n_m_pavgb (__m64 __A, __m64 __B)\n{\n  return _mm_avg_pu8 (__A, __B);\n}\n\n/* Compute the rounded averages of the unsigned 16-bit values in A and B.  */\nstatic __inline __m64 __attribute__((__always_inline__))\n_mm_avg_pu16 (__m64 __A, __m64 __B)\n{\n  return (__m64) __builtin_ia32_pavgw ((__v4hi)__A, (__v4hi)__B);\n}\n\nstatic __inline __m64 __attribute__((__always_inline__))\n_m_pavgw (__m64 __A, __m64 __B)\n{\n  return _mm_avg_pu16 (__A, __B);\n}\n\n/* Compute the sum of the absolute differences of the unsigned 8-bit\n   values in A and B.  Return the value in the lower 16-bit word; the\n   upper words are cleared.  */\nstatic __inline __m64 __attribute__((__always_inline__))\n_mm_sad_pu8 (__m64 __A, __m64 __B)\n{\n  return (__m64) __builtin_ia32_psadbw ((__v8qi)__A, (__v8qi)__B);\n}\n\nstatic __inline __m64 __attribute__((__always_inline__))\n_m_psadbw (__m64 __A, __m64 __B)\n{\n  return _mm_sad_pu8 (__A, __B);\n}\n\n/* Loads one cache line from address P to a location \"closer\" to the\n   processor.  The selector I specifies the type of prefetch operation.  */\n#if 0\nstatic __inline void __attribute__((__always_inline__))\n_mm_prefetch (void *__P, enum _mm_hint __I)\n{\n  __builtin_prefetch (__P, 0, __I);\n}\n#else\n#define _mm_prefetch(P, I) \\\n  __builtin_prefetch ((P), 0, (I))\n#endif\n\n/* Stores the data in A to the address P without polluting the caches.  */\nstatic __inline void __attribute__((__always_inline__))\n_mm_stream_pi (__m64 *__P, __m64 __A)\n{\n  __builtin_ia32_movntq ((unsigned long long *)__P, (unsigned long long)__A);\n}\n\n/* Likewise.  The address must be 16-byte aligned.  */\nstatic __inline void __attribute__((__always_inline__))\n_mm_stream_ps (float *__P, __m128 __A)\n{\n  __builtin_ia32_movntps (__P, (__v4sf)__A);\n}\n\n/* Guarantees that every preceding store is globally visible before\n   any subsequent store.  */\nstatic __inline void __attribute__((__always_inline__))\n_mm_sfence (void)\n{\n  __builtin_ia32_sfence ();\n}\n\n/* The execution of the next instruction is delayed by an implementation\n   specific amount of time.  The instruction does not modify the\n   architectural state.  */\nstatic __inline void __attribute__((__always_inline__))\n_mm_pause (void)\n{\n  __asm__ __volatile__ (\"rep; nop\" : : );\n}\n\n/* Transpose the 4x4 matrix composed of row[0-3].  */\n#define _MM_TRANSPOSE4_PS(row0, row1, row2, row3)\t\t\t\\\ndo {\t\t\t\t\t\t\t\t\t\\\n  __v4sf __r0 = (row0), __r1 = (row1), __r2 = (row2), __r3 = (row3);\t\\\n  __v4sf __t0 = __builtin_ia32_unpcklps (__r0, __r1);\t\t\t\\\n  __v4sf __t1 = __builtin_ia32_unpcklps (__r2, __r3);\t\t\t\\\n  __v4sf __t2 = __builtin_ia32_unpckhps (__r0, __r1);\t\t\t\\\n  __v4sf __t3 = __builtin_ia32_unpckhps (__r2, __r3);\t\t\t\\\n  (row0) = __builtin_ia32_movlhps (__t0, __t1);\t\t\t\t\\\n  (row1) = __builtin_ia32_movhlps (__t1, __t0);\t\t\t\t\\\n  (row2) = __builtin_ia32_movlhps (__t2, __t3);\t\t\t\t\\\n  (row3) = __builtin_ia32_movhlps (__t3, __t2);\t\t\t\t\\\n} while (0)\n\n/* For backward source compatibility.  */\n#ifdef __SSE2__\n#include <emmintrin.h>\n#endif\n\n#endif /* __SSE__ */\n#endif /* _XMMINTRIN_H_INCLUDED */\n"
  },
  {
    "path": "freebsd-headers/gelf.h",
    "content": "/*-\n * Copyright (c) 2006 Joseph Koshy\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/lib/libelf/gelf.h 167315 2007-03-08 04:01:30Z jkoshy $\n */\n\n#ifndef\t_GELF_H_\n#define\t_GELF_H_\n\n#include <sys/cdefs.h>\n\n#include <libelf.h>\n#include <osreldate.h>\n\ntypedef Elf64_Addr\tGElf_Addr;\t/* Addresses */\ntypedef Elf64_Half\tGElf_Half;\t/* Half words (16 bit) */\ntypedef Elf64_Off\tGElf_Off;\t/* Offsets */\ntypedef Elf64_Sword\tGElf_Sword;\t/* Signed words (32 bit) */\ntypedef Elf64_Sxword\tGElf_Sxword;\t/* Signed long words (64 bit) */\ntypedef Elf64_Word\tGElf_Word;\t/* Unsigned words (32 bit) */\ntypedef Elf64_Xword\tGElf_Xword;\t/* Unsigned long words (64 bit) */\n\ntypedef Elf64_Dyn\tGElf_Dyn;\t/* \".dynamic\" section entries */\ntypedef Elf64_Ehdr\tGElf_Ehdr;\t/* ELF header */\ntypedef Elf64_Phdr\tGElf_Phdr;\t/* Program header */\ntypedef Elf64_Shdr\tGElf_Shdr;\t/* Section header */\ntypedef Elf64_Sym\tGElf_Sym;\t/* Symbol table entries */\ntypedef Elf64_Rel\tGElf_Rel;\t/* Relocation entries */\ntypedef Elf64_Rela\tGElf_Rela;\t/* Relocation entries with addend */\n\n#if\t__FreeBSD_version >= 700025\ntypedef\tElf64_Cap\tGElf_Cap;\t/* SW/HW capabilities */\ntypedef Elf64_Move\tGElf_Move;\t/* Move entries */\ntypedef Elf64_Syminfo\tGElf_Syminfo;\t/* Symbol information */\n#endif\n\n#define\tGELF_M_INFO\t\t\tELF64_M_INFO\n#define\tGELF_M_SIZE\t\t\tELF64_M_SIZE\n#define\tGELF_M_SYM\t\t\tELF64_M_SYM\n\n#define\tGELF_R_INFO\t\t\tELF64_R_INFO\n#define\tGELF_R_SYM\t\t\tELF64_R_SYM\n#define\tGELF_R_TYPE\t\t\tELF64_R_TYPE\n#define\tGELF_R_TYPE_DATA\t\tELF64_R_TYPE_DATA\n#define\tGELF_R_TYPE_ID\t\t\tELF64_R_TYPE_ID\n#define\tGELF_R_TYPE_INFO\t\tELF64_R_TYPE_INFO\n\n#define\tGELF_ST_BIND\t\t\tELF64_ST_BIND\n#define\tGELF_ST_INFO\t\t\tELF64_ST_INFO\n#define\tGELF_ST_TYPE\t\t\tELF64_ST_TYPE\n#define\tGELF_ST_VISIBILITY\t\tELF64_ST_VISIBILITY\n\n__BEGIN_DECLS\nlong\t\tgelf_checksum(Elf *_elf);\nsize_t\t\tgelf_fsize(Elf *_elf, Elf_Type _type, size_t _count,\n\t\t\tunsigned int _version);\nint\t\tgelf_getclass(Elf *_elf);\nGElf_Dyn\t*gelf_getdyn(Elf_Data *_data, int _index, GElf_Dyn *_dst);\nGElf_Ehdr\t*gelf_getehdr(Elf *_elf, GElf_Ehdr *_dst);\nGElf_Phdr\t*gelf_getphdr(Elf *_elf, int _index, GElf_Phdr *_dst);\nGElf_Rel\t*gelf_getrel(Elf_Data *_src, int _index, GElf_Rel *_dst);\nGElf_Rela\t*gelf_getrela(Elf_Data *_src, int _index, GElf_Rela *_dst);\nGElf_Shdr\t*gelf_getshdr(Elf_Scn *_scn, GElf_Shdr *_dst);\nGElf_Sym\t*gelf_getsym(Elf_Data *_src, int _index, GElf_Sym *_dst);\nGElf_Sym\t*gelf_getsymshndx(Elf_Data *_src, Elf_Data *_shindexsrc,\n\t\t\tint _index, GElf_Sym *_dst, Elf32_Word *_shindexdst);\nvoid *\t\tgelf_newehdr(Elf *_elf, int _class);\nvoid *\t\tgelf_newphdr(Elf *_elf, size_t _phnum);\nint\t\tgelf_update_dyn(Elf_Data *_dst, int _index, GElf_Dyn *_src);\nint\t\tgelf_update_ehdr(Elf *_elf, GElf_Ehdr *_src);\nint\t\tgelf_update_phdr(Elf *_elf, int _index, GElf_Phdr *_src);\nint\t\tgelf_update_rel(Elf_Data *_dst, int _index, GElf_Rel *_src);\nint\t\tgelf_update_rela(Elf_Data *_dst, int _index, GElf_Rela *_src);\nint\t\tgelf_update_shdr(Elf_Scn *_dst, GElf_Shdr *_src);\nint\t\tgelf_update_sym(Elf_Data *_dst, int _index, GElf_Sym *_src);\nint\t\tgelf_update_symshndx(Elf_Data *_symdst, Elf_Data *_shindexdst,\n\t\t\tint _index, GElf_Sym *_symsrc, Elf32_Word _shindexsrc);\nElf_Data \t*gelf_xlatetof(Elf *_elf, Elf_Data *_dst, const Elf_Data *_src, unsigned int _encode);\nElf_Data \t*gelf_xlatetom(Elf *_elf, Elf_Data *_dst, const Elf_Data *_src, unsigned int _encode);\n\n#if\t__FreeBSD_version >= 700025\nGElf_Cap\t*gelf_getcap(Elf_Data *_data, int _index, GElf_Cap *_cap);\nGElf_Move\t*gelf_getmove(Elf_Data *_src, int _index, GElf_Move *_dst);\nGElf_Syminfo\t*gelf_getsyminfo(Elf_Data *_src, int _index, GElf_Syminfo *_dst);\nint\t\tgelf_update_cap(Elf_Data *_dst, int _index, GElf_Cap *_src);\nint\t\tgelf_update_move(Elf_Data *_dst, int _index, GElf_Move *_src);\nint\t\tgelf_update_syminfo(Elf_Data *_dst, int _index, GElf_Syminfo *_src);\n#endif\n__END_DECLS\n\n#endif\t/* _GELF_H_ */\n"
  },
  {
    "path": "freebsd-headers/geom/cache/g_cache.h",
    "content": "/*-\n * Copyright (c) 2006 Ruslan Ermilov <ru@FreeBSD.org>\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/geom/cache/g_cache.h 210046 2010-07-14 08:22:00Z ru $\n */\n\n#ifndef\t_G_CACHE_H_\n#define\t_G_CACHE_H_\n\n#include <sys/endian.h>\n\n#define\tG_CACHE_CLASS_NAME\t\"CACHE\"\n#define\tG_CACHE_MAGIC\t\t\"GEOM::CACHE\"\n#define\tG_CACHE_VERSION\t\t1\n\n#ifdef _KERNEL\n#define\tG_CACHE_TYPE_MANUAL\t0\n#define\tG_CACHE_TYPE_AUTOMATIC\t1\n\n#define\tG_CACHE_DEBUG(lvl, ...)\tdo {\t\t\t\t\t\\\n\tif (g_cache_debug >= (lvl)) {\t\t\t\t\t\\\n\t\tprintf(\"GEOM_CACHE\");\t\t\t\t\t\\\n\t\tif (g_cache_debug > 0)\t\t\t\t\t\\\n\t\t\tprintf(\"[%u]\", lvl);\t\t\t\t\\\n\t\tprintf(\": \");\t\t\t\t\t\t\\\n\t\tprintf(__VA_ARGS__);\t\t\t\t\t\\\n\t\tprintf(\"\\n\");\t\t\t\t\t\t\\\n\t}\t\t\t\t\t\t\t\t\\\n} while (0)\n#define\tG_CACHE_LOGREQ(bp, ...)\tdo {\t\t\t\t\t\\\n\tif (g_cache_debug >= 2) {\t\t\t\t\t\\\n\t\tprintf(\"GEOM_CACHE[2]: \");\t\t\t\t\\\n\t\tprintf(__VA_ARGS__);\t\t\t\t\t\\\n\t\tprintf(\" \");\t\t\t\t\t\t\\\n\t\tg_print_bio(bp);\t\t\t\t\t\\\n\t\tprintf(\"\\n\");\t\t\t\t\t\t\\\n\t}\t\t\t\t\t\t\t\t\\\n} while (0)\n\n#define\tG_CACHE_BUCKETS\t\t(1 << 3)\n#define\tG_CACHE_BUCKET(bno)\t((bno) & (G_CACHE_BUCKETS - 1))\n\nstruct g_cache_softc {\n\tstruct g_geom\t*sc_geom;\n\tint\t\tsc_type;\n\tu_int\t\tsc_bshift;\n\tu_int\t\tsc_bsize;\n\toff_t\t\tsc_tail;\n\tstruct mtx\tsc_mtx;\n\tstruct callout\tsc_callout;\n\tLIST_HEAD(, g_cache_desc) sc_desclist[G_CACHE_BUCKETS];\n\tTAILQ_HEAD(, g_cache_desc) sc_usedlist;\n\tuma_zone_t\tsc_zone;\n\n\tu_int\t\tsc_maxent;\t\t/* max entries */\n\tu_int\t\tsc_nent;\t\t/* allocated entries */\n\tu_int\t\tsc_nused;\t\t/* re-useable entries */\n\tu_int\t\tsc_invalid;\t\t/* invalid entries */\n\n\tuintmax_t\tsc_reads;\t\t/* #reads */\n\tuintmax_t\tsc_readbytes;\t\t/* bytes read */\n\tuintmax_t\tsc_cachereads;\t\t/* #reads from cache */\n\tuintmax_t\tsc_cachereadbytes;\t/* bytes read from cache */\n\tuintmax_t\tsc_cachehits;\t\t/* cache hits */\n\tuintmax_t\tsc_cachemisses;\t\t/* cache misses */\n\tuintmax_t\tsc_cachefull;\t\t/* #times a cache was full */\n\tuintmax_t\tsc_writes;\t\t/* #writes */\n\tuintmax_t\tsc_wrotebytes;\t\t/* bytes written */\n};\n#define\tsc_name\tsc_geom->name\n\nstruct g_cache_desc {\n\toff_t\t\td_bno;\t\t\t/* block number */\n\tcaddr_t\t\td_data;\t\t\t/* data area */\n\tstruct bio\t*d_biolist;\t\t/* waiters */\n\ttime_t\t\td_atime;\t\t/* access time */\n\tint\t\td_flags;\t\t/* flags */\n#define\tD_FLAG_USED\t(1 << 0)\t\t\t/* can be reused */\n#define\tD_FLAG_INVALID\t(1 << 1)\t\t\t/* invalid */\n\tLIST_ENTRY(g_cache_desc) d_next;\t/* list */\n\tTAILQ_ENTRY(g_cache_desc) d_used;\t/* used list */\n};\n\n#define\tG_CACHE_NEXT_BIO1(bp)\t(bp)->bio_driver1\n#define\tG_CACHE_NEXT_BIO2(bp)\t(bp)->bio_driver2\n#define\tG_CACHE_DESC1(bp)\t(bp)->bio_caller1\n#define\tG_CACHE_DESC2(bp)\t(bp)->bio_caller2\n\n#endif\t/* _KERNEL */\n\nstruct g_cache_metadata {\n\tchar\t\tmd_magic[16];\t\t/* Magic value. */\n\tuint32_t\tmd_version;\t\t/* Version number. */\n\tchar\t\tmd_name[16];\t\t/* Cache value. */\n\tuint32_t\tmd_bsize;\t\t/* Cache block size. */\n\tuint32_t\tmd_size;\t\t/* Cache size. */\n\tuint64_t\tmd_provsize;\t\t/* Provider's size. */\n};\n\nstatic __inline void\ncache_metadata_encode(const struct g_cache_metadata *md, u_char *data)\n{\n\n\tbcopy(md->md_magic, data, sizeof(md->md_magic));\n\tle32enc(data + 16, md->md_version);\n\tbcopy(md->md_name, data + 20, sizeof(md->md_name));\n\tle32enc(data + 36, md->md_bsize);\n\tle32enc(data + 40, md->md_size);\n\tle64enc(data + 44, md->md_provsize);\n}\n\nstatic __inline void\ncache_metadata_decode(const u_char *data, struct g_cache_metadata *md)\n{\n\n\tbcopy(data, md->md_magic, sizeof(md->md_magic));\n\tmd->md_version = le32dec(data + 16);\n\tbcopy(data + 20, md->md_name, sizeof(md->md_name));\n\tmd->md_bsize = le32dec(data + 36);\n\tmd->md_size = le32dec(data + 40);\n\tmd->md_provsize = le64dec(data + 44);\n}\n\n#endif\t/* _G_CACHE_H_ */\n"
  },
  {
    "path": "freebsd-headers/geom/concat/g_concat.h",
    "content": "/*-\n * Copyright (c) 2004-2005 Pawel Jakub Dawidek <pjd@FreeBSD.org>\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/geom/concat/g_concat.h 155174 2006-02-01 12:06:01Z pjd $\n */\n\n#ifndef\t_G_CONCAT_H_\n#define\t_G_CONCAT_H_\n\n#include <sys/endian.h>\n\n#define\tG_CONCAT_CLASS_NAME\t\"CONCAT\"\n\n#define\tG_CONCAT_MAGIC\t\t\"GEOM::CONCAT\"\n/*\n * Version history:\n * 1 - Initial version number.\n * 2 - Added 'stop' command to gconcat(8).\n * 3 - Added md_provider field to metadata and '-h' option to gconcat(8).\n * 4 - Added md_provsize field to metadata.\n */\n#define\tG_CONCAT_VERSION\t4\n\n#ifdef _KERNEL\n#define\tG_CONCAT_TYPE_MANUAL\t0\n#define\tG_CONCAT_TYPE_AUTOMATIC\t1\n\n#define\tG_CONCAT_DEBUG(lvl, ...)\tdo {\t\t\t\t\\\n\tif (g_concat_debug >= (lvl)) {\t\t\t\t\t\\\n\t\tprintf(\"GEOM_CONCAT\");\t\t\t\t\t\\\n\t\tif (g_concat_debug > 0)\t\t\t\t\t\\\n\t\t\tprintf(\"[%u]\", lvl);\t\t\t\t\\\n\t\tprintf(\": \");\t\t\t\t\t\t\\\n\t\tprintf(__VA_ARGS__);\t\t\t\t\t\\\n\t\tprintf(\"\\n\");\t\t\t\t\t\t\\\n\t}\t\t\t\t\t\t\t\t\\\n} while (0)\n#define\tG_CONCAT_LOGREQ(bp, ...)\tdo {\t\t\t\t\\\n\tif (g_concat_debug >= 2) {\t\t\t\t\t\\\n\t\tprintf(\"GEOM_CONCAT[2]: \");\t\t\t\t\\\n\t\tprintf(__VA_ARGS__);\t\t\t\t\t\\\n\t\tprintf(\" \");\t\t\t\t\t\t\\\n\t\tg_print_bio(bp);\t\t\t\t\t\\\n\t\tprintf(\"\\n\");\t\t\t\t\t\t\\\n\t}\t\t\t\t\t\t\t\t\\\n} while (0)\n\nstruct g_concat_disk {\n\tstruct g_consumer\t*d_consumer;\n\tstruct g_concat_softc\t*d_softc;\n\toff_t\t\t\t d_start;\n\toff_t\t\t\t d_end;\n};\n\nstruct g_concat_softc {\n\tu_int\t\t sc_type;\t/* provider type */\n\tstruct g_geom\t*sc_geom;\n\tstruct g_provider *sc_provider;\n\tuint32_t\t sc_id;\t\t/* concat unique ID */\n\n\tstruct g_concat_disk *sc_disks;\n\tuint16_t\t sc_ndisks;\n};\n#define\tsc_name\tsc_geom->name\n#endif\t/* _KERNEL */\n\nstruct g_concat_metadata {\n\tchar\t\tmd_magic[16];\t/* Magic value. */\n\tuint32_t\tmd_version;\t/* Version number. */\n\tchar\t\tmd_name[16];\t/* Concat name. */\n\tuint32_t\tmd_id;\t\t/* Unique ID. */\n\tuint16_t\tmd_no;\t\t/* Disk number. */\n\tuint16_t\tmd_all;\t\t/* Number of all disks. */\n\tchar\t\tmd_provider[16]; /* Hardcoded provider. */\n\tuint64_t\tmd_provsize;\t/* Provider's size. */\n};\nstatic __inline void\nconcat_metadata_encode(const struct g_concat_metadata *md, u_char *data)\n{\n\n\tbcopy(md->md_magic, data, sizeof(md->md_magic));\n\tle32enc(data + 16, md->md_version);\n\tbcopy(md->md_name, data + 20, sizeof(md->md_name));\n\tle32enc(data + 36, md->md_id);\n\tle16enc(data + 40, md->md_no);\n\tle16enc(data + 42, md->md_all);\n\tbcopy(md->md_provider, data + 44, sizeof(md->md_provider));\n\tle64enc(data + 60, md->md_provsize);\n}\nstatic __inline void\nconcat_metadata_decode(const u_char *data, struct g_concat_metadata *md)\n{\n\n\tbcopy(data, md->md_magic, sizeof(md->md_magic));\n\tmd->md_version = le32dec(data + 16);\n\tbcopy(data + 20, md->md_name, sizeof(md->md_name));\n\tmd->md_id = le32dec(data + 36);\n\tmd->md_no = le16dec(data + 40);\n\tmd->md_all = le16dec(data + 42);\n\tbcopy(data + 44, md->md_provider, sizeof(md->md_provider));\n\tmd->md_provsize = le64dec(data + 60);\n}\n#endif\t/* _G_CONCAT_H_ */\n"
  },
  {
    "path": "freebsd-headers/geom/eli/g_eli.h",
    "content": "/*-\n * Copyright (c) 2005-2011 Pawel Jakub Dawidek <pawel@dawidek.net>\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/geom/eli/g_eli.h 221629 2011-05-08 09:25:16Z pjd $\n */\n\n#ifndef\t_G_ELI_H_\n#define\t_G_ELI_H_\n\n#include <sys/endian.h>\n#include <sys/errno.h>\n#include <sys/malloc.h>\n#include <crypto/sha2/sha2.h>\n#include <opencrypto/cryptodev.h>\n#ifdef _KERNEL\n#include <sys/bio.h>\n#include <sys/libkern.h>\n#include <sys/lock.h>\n#include <sys/mutex.h>\n#include <sys/queue.h>\n#include <sys/tree.h>\n#include <geom/geom.h>\n#else\n#include <stdio.h>\n#include <string.h>\n#include <strings.h>\n#endif\n#ifndef _OpenSSL_\n#include <sys/md5.h>\n#endif\n\n#define\tG_ELI_CLASS_NAME\t\"ELI\"\n#define\tG_ELI_MAGIC\t\t\"GEOM::ELI\"\n#define\tG_ELI_SUFFIX\t\t\".eli\"\n\n/*\n * Version history:\n * 0 - Initial version number.\n * 1 - Added data authentication support (md_aalgo field and\n *     G_ELI_FLAG_AUTH flag).\n * 2 - Added G_ELI_FLAG_READONLY.\n * 3 - Added 'configure' subcommand.\n * 4 - IV is generated from offset converted to little-endian\n *     (the G_ELI_FLAG_NATIVE_BYTE_ORDER flag will be set for older versions).\n * 5 - Added multiple encrypton keys and AES-XTS support.\n * 6 - Fixed usage of multiple keys for authenticated providers (the\n *     G_ELI_FLAG_FIRST_KEY flag will be set for older versions).\n */\n#define\tG_ELI_VERSION_00\t0\n#define\tG_ELI_VERSION_01\t1\n#define\tG_ELI_VERSION_02\t2\n#define\tG_ELI_VERSION_03\t3\n#define\tG_ELI_VERSION_04\t4\n#define\tG_ELI_VERSION_05\t5\n#define\tG_ELI_VERSION_06\t6\n#define\tG_ELI_VERSION\t\tG_ELI_VERSION_06\n\n/* ON DISK FLAGS. */\n/* Use random, onetime keys. */\n#define\tG_ELI_FLAG_ONETIME\t\t0x00000001\n/* Ask for the passphrase from the kernel, before mounting root. */\n#define\tG_ELI_FLAG_BOOT\t\t\t0x00000002\n/* Detach on last close, if we were open for writing. */\n#define\tG_ELI_FLAG_WO_DETACH\t\t0x00000004\n/* Detach on last close. */\n#define\tG_ELI_FLAG_RW_DETACH\t\t0x00000008\n/* Provide data authentication. */\n#define\tG_ELI_FLAG_AUTH\t\t\t0x00000010\n/* Provider is read-only, we should deny all write attempts. */\n#define\tG_ELI_FLAG_RO\t\t\t0x00000020\n/* RUNTIME FLAGS. */\n/* Provider was open for writing. */\n#define\tG_ELI_FLAG_WOPEN\t\t0x00010000\n/* Destroy device. */\n#define\tG_ELI_FLAG_DESTROY\t\t0x00020000\n/* Provider uses native byte-order for IV generation. */\n#define\tG_ELI_FLAG_NATIVE_BYTE_ORDER\t0x00040000\n/* Provider uses single encryption key. */\n#define\tG_ELI_FLAG_SINGLE_KEY\t\t0x00080000\n/* Device suspended. */\n#define\tG_ELI_FLAG_SUSPEND\t\t0x00100000\n/* Provider uses first encryption key. */\n#define\tG_ELI_FLAG_FIRST_KEY\t\t0x00200000\n\n#define\tG_ELI_NEW_BIO\t255\n\n#define\tSHA512_MDLEN\t\t64\n#define\tG_ELI_AUTH_SECKEYLEN\tSHA256_DIGEST_LENGTH\n\n#define\tG_ELI_MAXMKEYS\t\t2\n#define\tG_ELI_MAXKEYLEN\t\t64\n#define\tG_ELI_USERKEYLEN\tG_ELI_MAXKEYLEN\n#define\tG_ELI_DATAKEYLEN\tG_ELI_MAXKEYLEN\n#define\tG_ELI_AUTHKEYLEN\tG_ELI_MAXKEYLEN\n#define\tG_ELI_IVKEYLEN\t\tG_ELI_MAXKEYLEN\n#define\tG_ELI_SALTLEN\t\t64\n#define\tG_ELI_DATAIVKEYLEN\t(G_ELI_DATAKEYLEN + G_ELI_IVKEYLEN)\n/* Data-Key, IV-Key, HMAC_SHA512(Derived-Key, Data-Key+IV-Key) */\n#define\tG_ELI_MKEYLEN\t\t(G_ELI_DATAIVKEYLEN + SHA512_MDLEN)\n#define\tG_ELI_OVERWRITES\t5\n/* Switch data encryption key every 2^20 blocks. */\n#define\tG_ELI_KEY_SHIFT\t\t20\n\n#ifdef _KERNEL\nextern int g_eli_debug;\nextern u_int g_eli_overwrites;\nextern u_int g_eli_batch;\n\n#define\tG_ELI_CRYPTO_UNKNOWN\t0\n#define\tG_ELI_CRYPTO_HW\t\t1\n#define\tG_ELI_CRYPTO_SW\t\t2\n\n#define\tG_ELI_DEBUG(lvl, ...)\tdo {\t\t\t\t\t\\\n\tif (g_eli_debug >= (lvl)) {\t\t\t\t\t\\\n\t\tprintf(\"GEOM_ELI\");\t\t\t\t\t\\\n\t\tif (g_eli_debug > 0)\t\t\t\t\t\\\n\t\t\tprintf(\"[%u]\", lvl);\t\t\t\t\\\n\t\tprintf(\": \");\t\t\t\t\t\t\\\n\t\tprintf(__VA_ARGS__);\t\t\t\t\t\\\n\t\tprintf(\"\\n\");\t\t\t\t\t\t\\\n\t}\t\t\t\t\t\t\t\t\\\n} while (0)\n#define\tG_ELI_LOGREQ(lvl, bp, ...)\tdo {\t\t\t\t\\\n\tif (g_eli_debug >= (lvl)) {\t\t\t\t\t\\\n\t\tprintf(\"GEOM_ELI\");\t\t\t\t\t\\\n\t\tif (g_eli_debug > 0)\t\t\t\t\t\\\n\t\t\tprintf(\"[%u]\", lvl);\t\t\t\t\\\n\t\tprintf(\": \");\t\t\t\t\t\t\\\n\t\tprintf(__VA_ARGS__);\t\t\t\t\t\\\n\t\tprintf(\" \");\t\t\t\t\t\t\\\n\t\tg_print_bio(bp);\t\t\t\t\t\\\n\t\tprintf(\"\\n\");\t\t\t\t\t\t\\\n\t}\t\t\t\t\t\t\t\t\\\n} while (0)\n\nstruct g_eli_worker {\n\tstruct g_eli_softc\t*w_softc;\n\tstruct proc\t\t*w_proc;\n\tu_int\t\t\t w_number;\n\tuint64_t\t\t w_sid;\n\tboolean_t\t\t w_active;\n\tLIST_ENTRY(g_eli_worker) w_next;\n};\n\nstruct g_eli_softc {\n\tstruct g_geom\t*sc_geom;\n\tu_int\t\t sc_crypto;\n\tuint8_t\t\t sc_mkey[G_ELI_DATAIVKEYLEN];\n\tuint8_t\t\t sc_ekey[G_ELI_DATAKEYLEN];\n\tTAILQ_HEAD(, g_eli_key) sc_ekeys_queue;\n\tRB_HEAD(g_eli_key_tree, g_eli_key) sc_ekeys_tree;\n\tstruct mtx\t sc_ekeys_lock;\n\tuint64_t\t sc_ekeys_total;\n\tuint64_t\t sc_ekeys_allocated;\n\tu_int\t\t sc_ealgo;\n\tu_int\t\t sc_ekeylen;\n\tuint8_t\t\t sc_akey[G_ELI_AUTHKEYLEN];\n\tu_int\t\t sc_aalgo;\n\tu_int\t\t sc_akeylen;\n\tu_int\t\t sc_alen;\n\tSHA256_CTX\t sc_akeyctx;\n\tuint8_t\t\t sc_ivkey[G_ELI_IVKEYLEN];\n\tSHA256_CTX\t sc_ivctx;\n\tint\t\t sc_nkey;\n\tuint32_t\t sc_flags;\n\tint\t\t sc_inflight;\n\toff_t\t\t sc_mediasize;\n\tsize_t\t\t sc_sectorsize;\n\tu_int\t\t sc_bytes_per_sector;\n\tu_int\t\t sc_data_per_sector;\n\n\t/* Only for software cryptography. */\n\tstruct bio_queue_head sc_queue;\n\tstruct mtx\t sc_queue_mtx;\n\tLIST_HEAD(, g_eli_worker) sc_workers;\n};\n#define\tsc_name\t\t sc_geom->name\n#endif\t/* _KERNEL */\n\nstruct g_eli_metadata {\n\tchar\t\tmd_magic[16];\t/* Magic value. */\n\tuint32_t\tmd_version;\t/* Version number. */\n\tuint32_t\tmd_flags;\t/* Additional flags. */\n\tuint16_t\tmd_ealgo;\t/* Encryption algorithm. */\n\tuint16_t\tmd_keylen;\t/* Key length. */\n\tuint16_t\tmd_aalgo;\t/* Authentication algorithm. */\n\tuint64_t\tmd_provsize;\t/* Provider's size. */\n\tuint32_t\tmd_sectorsize;\t/* Sector size. */\n\tuint8_t\t\tmd_keys;\t/* Available keys. */\n\tint32_t\t\tmd_iterations;\t/* Number of iterations for PKCS#5v2. */\n\tuint8_t\t\tmd_salt[G_ELI_SALTLEN]; /* Salt. */\n\t\t\t/* Encrypted master key (IV-key, Data-key, HMAC). */\n\tuint8_t\t\tmd_mkeys[G_ELI_MAXMKEYS * G_ELI_MKEYLEN];\n\tu_char\t\tmd_hash[16];\t/* MD5 hash. */\n} __packed;\n#ifndef _OpenSSL_\nstatic __inline void\neli_metadata_encode(struct g_eli_metadata *md, u_char *data)\n{\n\tMD5_CTX ctx;\n\tu_char *p;\n\n\tp = data;\n\tbcopy(md->md_magic, p, sizeof(md->md_magic)); p += sizeof(md->md_magic);\n\tle32enc(p, md->md_version);\tp += sizeof(md->md_version);\n\tle32enc(p, md->md_flags);\tp += sizeof(md->md_flags);\n\tle16enc(p, md->md_ealgo);\tp += sizeof(md->md_ealgo);\n\tle16enc(p, md->md_keylen);\tp += sizeof(md->md_keylen);\n\tle16enc(p, md->md_aalgo);\tp += sizeof(md->md_aalgo);\n\tle64enc(p, md->md_provsize);\tp += sizeof(md->md_provsize);\n\tle32enc(p, md->md_sectorsize);\tp += sizeof(md->md_sectorsize);\n\t*p = md->md_keys;\t\tp += sizeof(md->md_keys);\n\tle32enc(p, md->md_iterations);\tp += sizeof(md->md_iterations);\n\tbcopy(md->md_salt, p, sizeof(md->md_salt)); p += sizeof(md->md_salt);\n\tbcopy(md->md_mkeys, p, sizeof(md->md_mkeys)); p += sizeof(md->md_mkeys);\n\tMD5Init(&ctx);\n\tMD5Update(&ctx, data, p - data);\n\tMD5Final(md->md_hash, &ctx);\n\tbcopy(md->md_hash, p, sizeof(md->md_hash));\n}\nstatic __inline int\neli_metadata_decode_v0(const u_char *data, struct g_eli_metadata *md)\n{\n\tMD5_CTX ctx;\n\tconst u_char *p;\n\n\tp = data + sizeof(md->md_magic) + sizeof(md->md_version);\n\tmd->md_flags = le32dec(p);\tp += sizeof(md->md_flags);\n\tmd->md_ealgo = le16dec(p);\tp += sizeof(md->md_ealgo);\n\tmd->md_keylen = le16dec(p);\tp += sizeof(md->md_keylen);\n\tmd->md_provsize = le64dec(p);\tp += sizeof(md->md_provsize);\n\tmd->md_sectorsize = le32dec(p);\tp += sizeof(md->md_sectorsize);\n\tmd->md_keys = *p;\t\tp += sizeof(md->md_keys);\n\tmd->md_iterations = le32dec(p);\tp += sizeof(md->md_iterations);\n\tbcopy(p, md->md_salt, sizeof(md->md_salt)); p += sizeof(md->md_salt);\n\tbcopy(p, md->md_mkeys, sizeof(md->md_mkeys)); p += sizeof(md->md_mkeys);\n\tMD5Init(&ctx);\n\tMD5Update(&ctx, data, p - data);\n\tMD5Final(md->md_hash, &ctx);\n\tif (bcmp(md->md_hash, p, 16) != 0)\n\t\treturn (EINVAL);\n\treturn (0);\n}\n\nstatic __inline int\neli_metadata_decode_v1v2v3v4v5v6(const u_char *data, struct g_eli_metadata *md)\n{\n\tMD5_CTX ctx;\n\tconst u_char *p;\n\n\tp = data + sizeof(md->md_magic) + sizeof(md->md_version);\n\tmd->md_flags = le32dec(p);\tp += sizeof(md->md_flags);\n\tmd->md_ealgo = le16dec(p);\tp += sizeof(md->md_ealgo);\n\tmd->md_keylen = le16dec(p);\tp += sizeof(md->md_keylen);\n\tmd->md_aalgo = le16dec(p);\tp += sizeof(md->md_aalgo);\n\tmd->md_provsize = le64dec(p);\tp += sizeof(md->md_provsize);\n\tmd->md_sectorsize = le32dec(p);\tp += sizeof(md->md_sectorsize);\n\tmd->md_keys = *p;\t\tp += sizeof(md->md_keys);\n\tmd->md_iterations = le32dec(p);\tp += sizeof(md->md_iterations);\n\tbcopy(p, md->md_salt, sizeof(md->md_salt)); p += sizeof(md->md_salt);\n\tbcopy(p, md->md_mkeys, sizeof(md->md_mkeys)); p += sizeof(md->md_mkeys);\n\tMD5Init(&ctx);\n\tMD5Update(&ctx, data, p - data);\n\tMD5Final(md->md_hash, &ctx);\n\tif (bcmp(md->md_hash, p, 16) != 0)\n\t\treturn (EINVAL);\n\treturn (0);\n}\nstatic __inline int\neli_metadata_decode(const u_char *data, struct g_eli_metadata *md)\n{\n\tint error;\n\n\tbcopy(data, md->md_magic, sizeof(md->md_magic));\n\tmd->md_version = le32dec(data + sizeof(md->md_magic));\n\tswitch (md->md_version) {\n\tcase G_ELI_VERSION_00:\n\t\terror = eli_metadata_decode_v0(data, md);\n\t\tbreak;\n\tcase G_ELI_VERSION_01:\n\tcase G_ELI_VERSION_02:\n\tcase G_ELI_VERSION_03:\n\tcase G_ELI_VERSION_04:\n\tcase G_ELI_VERSION_05:\n\tcase G_ELI_VERSION_06:\n\t\terror = eli_metadata_decode_v1v2v3v4v5v6(data, md);\n\t\tbreak;\n\tdefault:\n\t\terror = EINVAL;\n\t\tbreak;\n\t}\n\treturn (error);\n}\n#endif\t/* !_OpenSSL */\n\nstatic __inline u_int\ng_eli_str2ealgo(const char *name)\n{\n\n\tif (strcasecmp(\"null\", name) == 0)\n\t\treturn (CRYPTO_NULL_CBC);\n\telse if (strcasecmp(\"null-cbc\", name) == 0)\n\t\treturn (CRYPTO_NULL_CBC);\n\telse if (strcasecmp(\"aes\", name) == 0)\n\t\treturn (CRYPTO_AES_XTS);\n\telse if (strcasecmp(\"aes-cbc\", name) == 0)\n\t\treturn (CRYPTO_AES_CBC);\n\telse if (strcasecmp(\"aes-xts\", name) == 0)\n\t\treturn (CRYPTO_AES_XTS);\n\telse if (strcasecmp(\"blowfish\", name) == 0)\n\t\treturn (CRYPTO_BLF_CBC);\n\telse if (strcasecmp(\"blowfish-cbc\", name) == 0)\n\t\treturn (CRYPTO_BLF_CBC);\n\telse if (strcasecmp(\"camellia\", name) == 0)\n\t\treturn (CRYPTO_CAMELLIA_CBC);\n\telse if (strcasecmp(\"camellia-cbc\", name) == 0)\n\t\treturn (CRYPTO_CAMELLIA_CBC);\n\telse if (strcasecmp(\"3des\", name) == 0)\n\t\treturn (CRYPTO_3DES_CBC);\n\telse if (strcasecmp(\"3des-cbc\", name) == 0)\n\t\treturn (CRYPTO_3DES_CBC);\n\treturn (CRYPTO_ALGORITHM_MIN - 1);\n}\n\nstatic __inline u_int\ng_eli_str2aalgo(const char *name)\n{\n\n\tif (strcasecmp(\"hmac/md5\", name) == 0)\n\t\treturn (CRYPTO_MD5_HMAC);\n\telse if (strcasecmp(\"hmac/sha1\", name) == 0)\n\t\treturn (CRYPTO_SHA1_HMAC);\n\telse if (strcasecmp(\"hmac/ripemd160\", name) == 0)\n\t\treturn (CRYPTO_RIPEMD160_HMAC);\n\telse if (strcasecmp(\"hmac/sha256\", name) == 0)\n\t\treturn (CRYPTO_SHA2_256_HMAC);\n\telse if (strcasecmp(\"hmac/sha384\", name) == 0)\n\t\treturn (CRYPTO_SHA2_384_HMAC);\n\telse if (strcasecmp(\"hmac/sha512\", name) == 0)\n\t\treturn (CRYPTO_SHA2_512_HMAC);\n\treturn (CRYPTO_ALGORITHM_MIN - 1);\n}\n\nstatic __inline const char *\ng_eli_algo2str(u_int algo)\n{\n\n\tswitch (algo) {\n\tcase CRYPTO_NULL_CBC:\n\t\treturn (\"NULL\");\n\tcase CRYPTO_AES_CBC:\n\t\treturn (\"AES-CBC\");\n\tcase CRYPTO_AES_XTS:\n\t\treturn (\"AES-XTS\");\n\tcase CRYPTO_BLF_CBC:\n\t\treturn (\"Blowfish-CBC\");\n\tcase CRYPTO_CAMELLIA_CBC:\n\t\treturn (\"CAMELLIA-CBC\");\n\tcase CRYPTO_3DES_CBC:\n\t\treturn (\"3DES-CBC\");\n\tcase CRYPTO_MD5_HMAC:\n\t\treturn (\"HMAC/MD5\");\n\tcase CRYPTO_SHA1_HMAC:\n\t\treturn (\"HMAC/SHA1\");\n\tcase CRYPTO_RIPEMD160_HMAC:\n\t\treturn (\"HMAC/RIPEMD160\");\n\tcase CRYPTO_SHA2_256_HMAC:\n\t\treturn (\"HMAC/SHA256\");\n\tcase CRYPTO_SHA2_384_HMAC:\n\t\treturn (\"HMAC/SHA384\");\n\tcase CRYPTO_SHA2_512_HMAC:\n\t\treturn (\"HMAC/SHA512\");\n\t}\n\treturn (\"unknown\");\n}\n\nstatic __inline void\neli_metadata_dump(const struct g_eli_metadata *md)\n{\n\tstatic const char hex[] = \"0123456789abcdef\";\n\tchar str[sizeof(md->md_mkeys) * 2 + 1];\n\tu_int i;\n\n\tprintf(\"     magic: %s\\n\", md->md_magic);\n\tprintf(\"   version: %u\\n\", (u_int)md->md_version);\n\tprintf(\"     flags: 0x%x\\n\", (u_int)md->md_flags);\n\tprintf(\"     ealgo: %s\\n\", g_eli_algo2str(md->md_ealgo));\n\tprintf(\"    keylen: %u\\n\", (u_int)md->md_keylen);\n\tif (md->md_flags & G_ELI_FLAG_AUTH)\n\t\tprintf(\"     aalgo: %s\\n\", g_eli_algo2str(md->md_aalgo));\n\tprintf(\"  provsize: %ju\\n\", (uintmax_t)md->md_provsize);\n\tprintf(\"sectorsize: %u\\n\", (u_int)md->md_sectorsize);\n\tprintf(\"      keys: 0x%02x\\n\", (u_int)md->md_keys);\n\tprintf(\"iterations: %u\\n\", (u_int)md->md_iterations);\n\tbzero(str, sizeof(str));\n\tfor (i = 0; i < sizeof(md->md_salt); i++) {\n\t\tstr[i * 2] = hex[md->md_salt[i] >> 4];\n\t\tstr[i * 2 + 1] = hex[md->md_salt[i] & 0x0f];\n\t}\n\tprintf(\"      Salt: %s\\n\", str);\n\tbzero(str, sizeof(str));\n\tfor (i = 0; i < sizeof(md->md_mkeys); i++) {\n\t\tstr[i * 2] = hex[md->md_mkeys[i] >> 4];\n\t\tstr[i * 2 + 1] = hex[md->md_mkeys[i] & 0x0f];\n\t}\n\tprintf(\"Master Key: %s\\n\", str);\n\tbzero(str, sizeof(str));\n\tfor (i = 0; i < 16; i++) {\n\t\tstr[i * 2] = hex[md->md_hash[i] >> 4];\n\t\tstr[i * 2 + 1] = hex[md->md_hash[i] & 0x0f];\n\t}\n\tprintf(\"  MD5 hash: %s\\n\", str);\n}\n\nstatic __inline u_int\ng_eli_keylen(u_int algo, u_int keylen)\n{\n\n\tswitch (algo) {\n\tcase CRYPTO_NULL_CBC:\n\t\tif (keylen == 0)\n\t\t\tkeylen = 64 * 8;\n\t\telse {\n\t\t\tif (keylen > 64 * 8)\n\t\t\t\tkeylen = 0;\n\t\t}\n\t\treturn (keylen);\n\tcase CRYPTO_AES_CBC:\n\tcase CRYPTO_CAMELLIA_CBC:\n\t\tswitch (keylen) {\n\t\tcase 0:\n\t\t\treturn (128);\n\t\tcase 128:\n\t\tcase 192:\n\t\tcase 256:\n\t\t\treturn (keylen);\n\t\tdefault:\n\t\t\treturn (0);\n\t\t}\n\tcase CRYPTO_AES_XTS:\n\t\tswitch (keylen) {\n\t\tcase 0:\n\t\t\treturn (128);\n\t\tcase 128:\n\t\tcase 256:\n\t\t\treturn (keylen);\n\t\tdefault:\n\t\t\treturn (0);\n\t\t}\n\tcase CRYPTO_BLF_CBC:\n\t\tif (keylen == 0)\n\t\t\treturn (128);\n\t\tif (keylen < 128 || keylen > 448)\n\t\t\treturn (0);\n\t\tif ((keylen % 32) != 0)\n\t\t\treturn (0);\n\t\treturn (keylen);\n\tcase CRYPTO_3DES_CBC:\n\t\tif (keylen == 0 || keylen == 192)\n\t\t\treturn (192);\n\t\treturn (0);\n\tdefault:\n\t\treturn (0);\n\t}\n}\n\nstatic __inline u_int\ng_eli_hashlen(u_int algo)\n{\n\n\tswitch (algo) {\n\tcase CRYPTO_MD5_HMAC:\n\t\treturn (16);\n\tcase CRYPTO_SHA1_HMAC:\n\t\treturn (20);\n\tcase CRYPTO_RIPEMD160_HMAC:\n\t\treturn (20);\n\tcase CRYPTO_SHA2_256_HMAC:\n\t\treturn (32);\n\tcase CRYPTO_SHA2_384_HMAC:\n\t\treturn (48);\n\tcase CRYPTO_SHA2_512_HMAC:\n\t\treturn (64);\n\t}\n\treturn (0);\n}\n\n#ifdef _KERNEL\nint g_eli_read_metadata(struct g_class *mp, struct g_provider *pp,\n    struct g_eli_metadata *md);\nstruct g_geom *g_eli_create(struct gctl_req *req, struct g_class *mp,\n    struct g_provider *bpp, const struct g_eli_metadata *md,\n    const u_char *mkey, int nkey);\nint g_eli_destroy(struct g_eli_softc *sc, boolean_t force);\n\nint g_eli_access(struct g_provider *pp, int dr, int dw, int de);\nvoid g_eli_config(struct gctl_req *req, struct g_class *mp, const char *verb);\n\nvoid g_eli_read_done(struct bio *bp);\nvoid g_eli_write_done(struct bio *bp);\nint g_eli_crypto_rerun(struct cryptop *crp);\nvoid g_eli_crypto_ivgen(struct g_eli_softc *sc, off_t offset, u_char *iv,\n    size_t size);\n\nvoid g_eli_crypto_read(struct g_eli_softc *sc, struct bio *bp, boolean_t fromworker);\nvoid g_eli_crypto_run(struct g_eli_worker *wr, struct bio *bp);\n\nvoid g_eli_auth_read(struct g_eli_softc *sc, struct bio *bp);\nvoid g_eli_auth_run(struct g_eli_worker *wr, struct bio *bp);\n#endif\n\nvoid g_eli_mkey_hmac(unsigned char *mkey, const unsigned char *key);\nint g_eli_mkey_decrypt(const struct g_eli_metadata *md,\n    const unsigned char *key, unsigned char *mkey, unsigned *nkeyp);\nint g_eli_mkey_encrypt(unsigned algo, const unsigned char *key, unsigned keylen,\n    unsigned char *mkey);\n#ifdef _KERNEL\nvoid g_eli_mkey_propagate(struct g_eli_softc *sc, const unsigned char *mkey);\n#endif\n\nint g_eli_crypto_encrypt(u_int algo, u_char *data, size_t datasize,\n    const u_char *key, size_t keysize);\nint g_eli_crypto_decrypt(u_int algo, u_char *data, size_t datasize,\n    const u_char *key, size_t keysize);\n\nstruct hmac_ctx {\n\tSHA512_CTX\tshactx;\n\tu_char\t\tk_opad[128];\n};\n\nvoid g_eli_crypto_hmac_init(struct hmac_ctx *ctx, const uint8_t *hkey,\n    size_t hkeylen);\nvoid g_eli_crypto_hmac_update(struct hmac_ctx *ctx, const uint8_t *data,\n    size_t datasize);\nvoid g_eli_crypto_hmac_final(struct hmac_ctx *ctx, uint8_t *md, size_t mdsize);\nvoid g_eli_crypto_hmac(const uint8_t *hkey, size_t hkeysize,\n    const uint8_t *data, size_t datasize, uint8_t *md, size_t mdsize);\n\n#ifdef _KERNEL\nvoid g_eli_key_init(struct g_eli_softc *sc);\nvoid g_eli_key_destroy(struct g_eli_softc *sc);\nuint8_t *g_eli_key_hold(struct g_eli_softc *sc, off_t offset, size_t blocksize);\nvoid g_eli_key_drop(struct g_eli_softc *sc, uint8_t *rawkey);\n#endif\n#endif\t/* !_G_ELI_H_ */\n"
  },
  {
    "path": "freebsd-headers/geom/eli/pkcs5v2.h",
    "content": "/*-\n * Copyright (c) 2005 Pawel Jakub Dawidek <pjd@FreeBSD.org>\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/geom/eli/pkcs5v2.h 155174 2006-02-01 12:06:01Z pjd $\n */\n\n#ifndef _PKCS5V2_H_\n#define\t_PKCS5V2_H_\nvoid pkcs5v2_genkey(uint8_t *key, unsigned keylen, const uint8_t *salt,\n    size_t saltsize, const char *passphrase, u_int iterations);\n#ifndef _KERNEL\nint pkcs5v2_calculate(int usecs);\n#endif\n#endif\t/* !_PKCS5V2_H_ */\n"
  },
  {
    "path": "freebsd-headers/geom/gate/g_gate.h",
    "content": "/*-\n * Copyright (c) 2004-2009 Pawel Jakub Dawidek <pjd@FreeBSD.org>\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/geom/gate/g_gate.h 220062 2011-03-27 19:56:55Z trociny $\n */\n\n#ifndef _G_GATE_H_\n#define _G_GATE_H_\n\n#include <sys/param.h>\n#include <sys/lock.h>\n#include <sys/mutex.h>\n#include <sys/queue.h>\n\n#include <geom/geom.h>\n\n#define\tG_GATE_CLASS_NAME\t\"GATE\"\n#define\tG_GATE_PROVIDER_NAME\t\"ggate\"\n#define\tG_GATE_MOD_NAME\t\t\"ggate\"\n#define\tG_GATE_CTL_NAME\t\t\"ggctl\"\n\n#define G_GATE_VERSION\t\t2\n\n/*\n * Maximum number of request that can be stored in\n * the queue when there are no workers.\n */\n#define\tG_GATE_MAX_QUEUE_SIZE\t4096\n\n#define\tG_GATE_FLAG_READONLY\t0x0001\n#define\tG_GATE_FLAG_WRITEONLY\t0x0002\n#define\tG_GATE_FLAG_DESTROY\t0x1000\n#define\tG_GATE_USERFLAGS\t(G_GATE_FLAG_READONLY | G_GATE_FLAG_WRITEONLY)\n\n/*\n * Pick unit number automatically in /dev/ggate<unit>.\n */\n#define\tG_GATE_UNIT_AUTO\t(-1)\n/*\n * Full provider name is given, so don't use ggate<unit>.\n */\n#define\tG_GATE_NAME_GIVEN\t(-2)\n\n#define G_GATE_CMD_CREATE\t_IOWR('m', 0, struct g_gate_ctl_create)\n#define G_GATE_CMD_DESTROY\t_IOWR('m', 1, struct g_gate_ctl_destroy)\n#define G_GATE_CMD_CANCEL\t_IOWR('m', 2, struct g_gate_ctl_cancel)\n#define G_GATE_CMD_START\t_IOWR('m', 3, struct g_gate_ctl_io)\n#define G_GATE_CMD_DONE\t\t_IOWR('m', 4, struct g_gate_ctl_io)\n\n#define\tG_GATE_INFOSIZE\t\t2048\n\n#ifdef _KERNEL\n/*\n * 'P:' means 'Protected by'.\n */\nstruct g_gate_softc {\n\tchar\t\t\t*sc_name;\t\t/* P: (read-only) */\n\tint\t\t\t sc_unit;\t\t/* P: (read-only) */\n\tint\t\t\t sc_ref;\t\t/* P: g_gate_list_mtx */\n\tstruct g_provider\t*sc_provider;\t\t/* P: (read-only) */\n\tuint32_t\t\t sc_flags;\t\t/* P: sc_queue_mtx */\n\n\tstruct bio_queue_head\t sc_inqueue;\t\t/* P: sc_queue_mtx */\n\tstruct bio_queue_head\t sc_outqueue;\t\t/* P: sc_queue_mtx */\n\tstruct mtx\t\t sc_queue_mtx;\n\tuint32_t\t\t sc_queue_count;\t/* P: sc_queue_mtx */\n\tuint32_t\t\t sc_queue_size;\t\t/* P: (read-only) */\n\tu_int\t\t\t sc_timeout;\t\t/* P: (read-only) */\n\tstruct callout\t\t sc_callout;\t\t/* P: (modified only\n\t\t\t\t\t\t\t       from callout\n\t\t\t\t\t\t\t       thread) */\n\tuintptr_t\t\t sc_seq;\t\t/* P: (modified only\n\t\t\t\t\t\t\t       from g_down\n\t\t\t\t\t\t\t       thread) */\n\tLIST_ENTRY(g_gate_softc) sc_next;\t\t/* P: g_gate_list_mtx */\n\tchar\t\t\t sc_info[G_GATE_INFOSIZE]; /* P: (read-only) */\n};\n\n#define\tG_GATE_DEBUG(lvl, ...)\tdo {\t\t\t\t\t\\\n\tif (g_gate_debug >= (lvl)) {\t\t\t\t\t\\\n\t\tprintf(\"GEOM_GATE\");\t\t\t\t\t\\\n\t\tif (g_gate_debug > 0)\t\t\t\t\t\\\n\t\t\tprintf(\"[%u]\", lvl);\t\t\t\t\\\n\t\tprintf(\": \");\t\t\t\t\t\t\\\n\t\tprintf(__VA_ARGS__);\t\t\t\t\t\\\n\t\tprintf(\"\\n\");\t\t\t\t\t\t\\\n\t}\t\t\t\t\t\t\t\t\\\n} while (0)\n#define\tG_GATE_LOGREQ(lvl, bp, ...)\tdo {\t\t\t\t\\\n\tif (g_gate_debug >= (lvl)) {\t\t\t\t\t\\\n\t\tprintf(\"GEOM_GATE\");\t\t\t\t\t\\\n\t\tif (g_gate_debug > 0)\t\t\t\t\t\\\n\t\t\tprintf(\"[%u]\", lvl);\t\t\t\t\\\n\t\tprintf(\": \");\t\t\t\t\t\t\\\n\t\tprintf(__VA_ARGS__);\t\t\t\t\t\\\n\t\tprintf(\" \");\t\t\t\t\t\t\\\n\t\tg_print_bio(bp);\t\t\t\t\t\\\n\t\tprintf(\"\\n\");\t\t\t\t\t\t\\\n\t}\t\t\t\t\t\t\t\t\\\n} while (0)\n#endif\t/* !_KERNEL */\n\nstruct g_gate_ctl_create {\n\tu_int\tgctl_version;\n\toff_t\tgctl_mediasize;\n\tu_int\tgctl_sectorsize;\n\tu_int\tgctl_flags;\n\tu_int\tgctl_maxcount;\n\tu_int\tgctl_timeout;\n\tchar\tgctl_name[NAME_MAX];\n\tchar\tgctl_info[G_GATE_INFOSIZE];\n\tint\tgctl_unit;\t/* in/out */\n};\n\nstruct g_gate_ctl_destroy {\n\tu_int\tgctl_version;\n\tint\tgctl_unit;\n\tint\tgctl_force;\n\tchar\tgctl_name[NAME_MAX];\n};\n\nstruct g_gate_ctl_cancel {\n\tu_int\t\tgctl_version;\n\tint\t\tgctl_unit;\n\tuintptr_t\tgctl_seq;\n\tchar\t\tgctl_name[NAME_MAX];\n};\n\nstruct g_gate_ctl_io {\n\tu_int\t\t gctl_version;\n\tint\t\t gctl_unit;\n\tuintptr_t\t gctl_seq;\n\tu_int\t\t gctl_cmd;\n\toff_t\t\t gctl_offset;\n\toff_t\t\t gctl_length;\n\tvoid\t\t*gctl_data;\n\tint\t\t gctl_error;\n};\n#endif\t/* !_G_GATE_H_ */\n"
  },
  {
    "path": "freebsd-headers/geom/geom.h",
    "content": "/*-\n * Copyright (c) 2002 Poul-Henning Kamp\n * Copyright (c) 2002 Networks Associates Technology, Inc.\n * All rights reserved.\n *\n * This software was developed for the FreeBSD Project by Poul-Henning Kamp\n * and NAI Labs, the Security Research Division of Network Associates, Inc.\n * under DARPA/SPAWAR contract N66001-01-C-8035 (\"CBOSS\"), as part of the\n * DARPA CHATS research program.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. The names of the authors may not be used to endorse or promote\n *    products derived from this software without specific prior written\n *    permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/geom/geom.h 224147 2011-07-17 20:35:30Z pjd $\n */\n\n#ifndef _GEOM_GEOM_H_\n#define _GEOM_GEOM_H_\n\n#include <sys/lock.h>\n#include <sys/mutex.h>\n#include <sys/sx.h>\n#include <sys/queue.h>\n#include <sys/ioccom.h>\n#include <sys/conf.h>\n#include <sys/module.h>\n\nstruct g_class;\nstruct g_geom;\nstruct g_consumer;\nstruct g_provider;\nstruct g_stat;\nstruct thread;\nstruct bio;\nstruct sbuf;\nstruct gctl_req;\nstruct g_configargs;\n\ntypedef int g_config_t (struct g_configargs *ca);\ntypedef void g_ctl_req_t (struct gctl_req *, struct g_class *cp, char const *verb);\ntypedef int g_ctl_create_geom_t (struct gctl_req *, struct g_class *cp, struct g_provider *pp);\ntypedef int g_ctl_destroy_geom_t (struct gctl_req *, struct g_class *cp, struct g_geom *gp);\ntypedef int g_ctl_config_geom_t (struct gctl_req *, struct g_geom *gp, const char *verb);\ntypedef void g_init_t (struct g_class *mp);\ntypedef void g_fini_t (struct g_class *mp);\ntypedef struct g_geom * g_taste_t (struct g_class *, struct g_provider *, int flags);\ntypedef int g_ioctl_t(struct g_provider *pp, u_long cmd, void *data, int fflag, struct thread *td);\n#define G_TF_NORMAL\t\t0\n#define G_TF_INSIST\t\t1\n#define G_TF_TRANSPARENT\t2\ntypedef int g_access_t (struct g_provider *, int, int, int);\n/* XXX: not sure about the thread arg */\ntypedef void g_orphan_t (struct g_consumer *);\n\ntypedef void g_start_t (struct bio *);\ntypedef void g_spoiled_t (struct g_consumer *);\ntypedef void g_attrchanged_t (struct g_consumer *, const char *attr);\ntypedef void g_dumpconf_t (struct sbuf *, const char *indent, struct g_geom *,\n    struct g_consumer *, struct g_provider *);\n\n/*\n * The g_class structure describes a transformation class.  In other words\n * all BSD disklabel handlers share one g_class, all MBR handlers share\n * one common g_class and so on.\n * Certain operations are instantiated on the class, most notably the\n * taste and config_geom functions.\n */\nstruct g_class {\n\tconst char\t\t*name;\n\tu_int\t\t\tversion;\n\tu_int\t\t\tspare0;\n\tg_taste_t\t\t*taste;\n\tg_config_t\t\t*config;\n\tg_ctl_req_t\t\t*ctlreq;\n\tg_init_t\t\t*init;\n\tg_fini_t\t\t*fini;\n\tg_ctl_destroy_geom_t\t*destroy_geom;\n\t/*\n\t * Default values for geom methods\n\t */\n\tg_start_t\t\t*start;\n\tg_spoiled_t\t\t*spoiled;\n\tg_attrchanged_t\t\t*attrchanged;\n\tg_dumpconf_t\t\t*dumpconf;\n\tg_access_t\t\t*access;\n\tg_orphan_t\t\t*orphan;\n\tg_ioctl_t\t\t*ioctl;\n\tvoid\t\t\t*spare1;\n\tvoid\t\t\t*spare2;\n\t/*\n\t * The remaining elements are private\n\t */\n\tLIST_ENTRY(g_class)\tclass;\n\tLIST_HEAD(,g_geom)\tgeom;\n};\n\n#define G_VERSION_00\t0x19950323\n#define G_VERSION_01\t0x20041207\t/* add fflag to g_ioctl_t */\n#define G_VERSION\tG_VERSION_01\n\n/*\n * The g_geom is an instance of a g_class.\n */\nstruct g_geom {\n\tchar\t\t\t*name;\n\tstruct g_class\t\t*class;\n\tLIST_ENTRY(g_geom)\tgeom;\n\tLIST_HEAD(,g_consumer)\tconsumer;\n\tLIST_HEAD(,g_provider)\tprovider;\n\tTAILQ_ENTRY(g_geom)\tgeoms;\t/* XXX: better name */\n\tint\t\t\trank;\n\tg_start_t\t\t*start;\n\tg_spoiled_t\t\t*spoiled;\n\tg_attrchanged_t\t\t*attrchanged;\n\tg_dumpconf_t\t\t*dumpconf;\n\tg_access_t\t\t*access;\n\tg_orphan_t\t\t*orphan;\n\tg_ioctl_t\t\t*ioctl;\n\tvoid\t\t\t*spare0;\n\tvoid\t\t\t*spare1;\n\tvoid\t\t\t*softc;\n\tunsigned\t\tflags;\n#define\tG_GEOM_WITHER\t\t1\n#define\tG_GEOM_VOLATILE_BIO\t2\n};\n\n/*\n * The g_bioq is a queue of struct bio's.\n * XXX: possibly collection point for statistics.\n * XXX: should (possibly) be collapsed with sys/bio.h::bio_queue_head.\n */\nstruct g_bioq {\n\tTAILQ_HEAD(, bio)\tbio_queue;\n\tstruct mtx\t\tbio_queue_lock;\n\tint\t\t\tbio_queue_length;\n};\n\n/*\n * A g_consumer is an attachment point for a g_provider.  One g_consumer\n * can only be attached to one g_provider, but multiple g_consumers\n * can be attached to one g_provider.\n */\n\nstruct g_consumer {\n\tstruct g_geom\t\t*geom;\n\tLIST_ENTRY(g_consumer)\tconsumer;\n\tstruct g_provider\t*provider;\n\tLIST_ENTRY(g_consumer)\tconsumers;\t/* XXX: better name */\n\tint\t\t\tacr, acw, ace;\n\tint\t\t\tspoiled;\n\tstruct devstat\t\t*stat;\n\tu_int\t\t\tnstart, nend;\n\n\t/* Two fields for the implementing class to use */\n\tvoid\t\t\t*private;\n\tu_int\t\t\tindex;\n};\n\n/*\n * A g_provider is a \"logical disk\".\n */\nstruct g_provider {\n\tchar\t\t\t*name;\n\tLIST_ENTRY(g_provider)\tprovider;\n\tstruct g_geom\t\t*geom;\n\tLIST_HEAD(,g_consumer)\tconsumers;\n\tint\t\t\tacr, acw, ace;\n\tint\t\t\terror;\n\tTAILQ_ENTRY(g_provider)\torphan;\n\toff_t\t\t\tmediasize;\n\tu_int\t\t\tsectorsize;\n\tu_int\t\t\tstripesize;\n\tu_int\t\t\tstripeoffset;\n\tstruct devstat\t\t*stat;\n\tu_int\t\t\tnstart, nend;\n\tu_int\t\t\tflags;\n#define G_PF_CANDELETE\t\t0x1\n#define G_PF_WITHER\t\t0x2\n#define G_PF_ORPHAN\t\t0x4\n\n\t/* Two fields for the implementing class to use */\n\tvoid\t\t\t*private;\n\tu_int\t\t\tindex;\n};\n\n/*\n * Descriptor of a classifier. We can register a function and\n * an argument, which is called by g_io_request() on bio's\n * that are not previously classified.\n */\nstruct g_classifier_hook {\n\tTAILQ_ENTRY(g_classifier_hook) link;\n\tint\t\t\t(*func)(void *arg, struct bio *bp);\n\tvoid\t\t\t*arg;\n};\n\n/* BIO_GETATTR(\"GEOM::setstate\") argument values. */\n#define G_STATE_FAILED\t\t0\n#define G_STATE_REBUILD\t\t1\n#define G_STATE_RESYNC\t\t2\n#define G_STATE_ACTIVE\t\t3\n\n/* geom_dev.c */\nstruct cdev;\nvoid g_dev_print(void);\nvoid g_dev_physpath_changed(void);\nstruct g_provider *g_dev_getprovider(struct cdev *dev);\n\n/* geom_dump.c */\nvoid g_trace(int level, const char *, ...);\n#\tdefine G_T_TOPOLOGY\t1\n#\tdefine G_T_BIO\t\t2\n#\tdefine G_T_ACCESS\t4\n\n\n/* geom_event.c */\ntypedef void g_event_t(void *, int flag);\n#define EV_CANCEL\t1\nint g_post_event(g_event_t *func, void *arg, int flag, ...);\nint g_waitfor_event(g_event_t *func, void *arg, int flag, ...);\nvoid g_cancel_event(void *ref);\nint g_attr_changed(struct g_provider *pp, const char *attr, int flag);\nvoid g_orphan_provider(struct g_provider *pp, int error);\nvoid g_waitidlelock(void);\n\n/* geom_subr.c */\nint g_access(struct g_consumer *cp, int nread, int nwrite, int nexcl);\nint g_attach(struct g_consumer *cp, struct g_provider *pp);\nint g_compare_names(const char *namea, const char *nameb);\nvoid g_destroy_consumer(struct g_consumer *cp);\nvoid g_destroy_geom(struct g_geom *pp);\nvoid g_destroy_provider(struct g_provider *pp);\nvoid g_detach(struct g_consumer *cp);\nvoid g_error_provider(struct g_provider *pp, int error);\nstruct g_provider *g_provider_by_name(char const *arg);\nint g_getattr__(const char *attr, struct g_consumer *cp, void *var, int len);\n#define g_getattr(a, c, v) g_getattr__((a), (c), (v), sizeof *(v))\nint g_handleattr(struct bio *bp, const char *attribute, const void *val,\n    int len);\nint g_handleattr_int(struct bio *bp, const char *attribute, int val);\nint g_handleattr_off_t(struct bio *bp, const char *attribute, off_t val);\nint g_handleattr_str(struct bio *bp, const char *attribute, const char *str);\nstruct g_consumer * g_new_consumer(struct g_geom *gp);\nstruct g_geom * g_new_geomf(struct g_class *mp, const char *fmt, ...);\nstruct g_provider * g_new_providerf(struct g_geom *gp, const char *fmt, ...);\nint g_retaste(struct g_class *mp);\nvoid g_spoil(struct g_provider *pp, struct g_consumer *cp);\nint g_std_access(struct g_provider *pp, int dr, int dw, int de);\nvoid g_std_done(struct bio *bp);\nvoid g_std_spoiled(struct g_consumer *cp);\nvoid g_wither_geom(struct g_geom *gp, int error);\nvoid g_wither_geom_close(struct g_geom *gp, int error);\nvoid g_wither_provider(struct g_provider *pp, int error);\n\n#if defined(DIAGNOSTIC) || defined(DDB)\nint g_valid_obj(void const *ptr);\n#endif\n#ifdef DIAGNOSTIC\n#define G_VALID_CLASS(foo) \\\n    KASSERT(g_valid_obj(foo) == 1, (\"%p is not a g_class\", foo))\n#define G_VALID_GEOM(foo) \\\n    KASSERT(g_valid_obj(foo) == 2, (\"%p is not a g_geom\", foo))\n#define G_VALID_CONSUMER(foo) \\\n    KASSERT(g_valid_obj(foo) == 3, (\"%p is not a g_consumer\", foo))\n#define G_VALID_PROVIDER(foo) \\\n    KASSERT(g_valid_obj(foo) == 4, (\"%p is not a g_provider\", foo))\n#else\n#define G_VALID_CLASS(foo) do { } while (0)\n#define G_VALID_GEOM(foo) do { } while (0)\n#define G_VALID_CONSUMER(foo) do { } while (0)\n#define G_VALID_PROVIDER(foo) do { } while (0)\n#endif\n\nint g_modevent(module_t, int, void *);\n\n/* geom_io.c */\nstruct bio * g_clone_bio(struct bio *);\nstruct bio * g_duplicate_bio(struct bio *);\nvoid g_destroy_bio(struct bio *);\nvoid g_io_deliver(struct bio *bp, int error);\nint g_io_getattr(const char *attr, struct g_consumer *cp, int *len, void *ptr);\nint g_io_flush(struct g_consumer *cp);\nint g_register_classifier(struct g_classifier_hook *hook);\nvoid g_unregister_classifier(struct g_classifier_hook *hook);\nvoid g_io_request(struct bio *bp, struct g_consumer *cp);\nstruct bio *g_new_bio(void);\nstruct bio *g_alloc_bio(void);\nvoid * g_read_data(struct g_consumer *cp, off_t offset, off_t length, int *error);\nint g_write_data(struct g_consumer *cp, off_t offset, void *ptr, off_t length);\nint g_delete_data(struct g_consumer *cp, off_t offset, off_t length);\nvoid g_print_bio(struct bio *bp);\n\n/* geom_kern.c / geom_kernsim.c */\n\n#ifdef _KERNEL\n\nextern struct sx topology_lock;\n\nstruct g_kerneldump {\n\toff_t\t\toffset;\n\toff_t\t\tlength;\n\tstruct dumperinfo di;\n};\n\nMALLOC_DECLARE(M_GEOM);\n\nstatic __inline void *\ng_malloc(int size, int flags)\n{\n\tvoid *p;\n\n\tp = malloc(size, M_GEOM, flags);\n\treturn (p);\n}\n\nstatic __inline void\ng_free(void *ptr)\n{\n\n#ifdef DIAGNOSTIC\n\tif (sx_xlocked(&topology_lock)) {\n\t\tKASSERT(g_valid_obj(ptr) == 0,\n\t\t    (\"g_free(%p) of live object, type %d\", ptr,\n\t\t    g_valid_obj(ptr)));\n\t}\n#endif\n\tfree(ptr, M_GEOM);\n}\n\n#define g_topology_lock() \t\t\t\t\t\\\n\tdo {\t\t\t\t\t\t\t\\\n\t\tmtx_assert(&Giant, MA_NOTOWNED);\t\t\\\n\t\tsx_xlock(&topology_lock);\t\t\t\\\n\t} while (0)\n\n#define g_topology_try_lock()\tsx_try_xlock(&topology_lock)\n\n#define g_topology_unlock()\t\t\t\t\t\\\n\tdo {\t\t\t\t\t\t\t\\\n\t\tsx_xunlock(&topology_lock);\t\t\t\\\n\t} while (0)\n\n#define g_topology_assert()\t\t\t\t\t\\\n\tdo {\t\t\t\t\t\t\t\\\n\t\tsx_assert(&topology_lock, SX_XLOCKED);\t\t\\\n\t} while (0)\n\n#define g_topology_assert_not()\t\t\t\t\t\\\n\tdo {\t\t\t\t\t\t\t\\\n\t\tsx_assert(&topology_lock, SX_UNLOCKED);\t\t\\\n\t} while (0)\n\n#define g_topology_sleep(chan, timo)\t\t\t\t\\\n\tsx_sleep(chan, &topology_lock, 0, \"gtopol\", timo)\n\n#define DECLARE_GEOM_CLASS(class, name) \t\t\t\\\n\tstatic moduledata_t name##_mod = {\t\t\t\\\n\t\t#name, g_modevent, &class\t\t\t\\\n\t};\t\t\t\t\t\t\t\\\n\tDECLARE_MODULE(name, name##_mod, SI_SUB_DRIVERS, SI_ORDER_FIRST);\n\n#endif /* _KERNEL */\n\n/* geom_ctl.c */\nint gctl_set_param(struct gctl_req *req, const char *param, void const *ptr, int len);\nvoid gctl_set_param_err(struct gctl_req *req, const char *param, void const *ptr, int len);\nvoid *gctl_get_param(struct gctl_req *req, const char *param, int *len);\nchar const *gctl_get_asciiparam(struct gctl_req *req, const char *param);\nvoid *gctl_get_paraml(struct gctl_req *req, const char *param, int len);\nint gctl_error(struct gctl_req *req, const char *fmt, ...) __printflike(2, 3);\nstruct g_class *gctl_get_class(struct gctl_req *req, char const *arg);\nstruct g_geom *gctl_get_geom(struct gctl_req *req, struct g_class *mpr, char const *arg);\nstruct g_provider *gctl_get_provider(struct gctl_req *req, char const *arg);\n\n#endif /* _GEOM_GEOM_H_ */\n"
  },
  {
    "path": "freebsd-headers/geom/geom_ctl.h",
    "content": "/*-\n * Copyright (c) 2003 Poul-Henning Kamp\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. The names of the authors may not be used to endorse or promote\n *    products derived from this software without specific prior written\n *    permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/geom/geom_ctl.h 115624 2003-06-01 13:47:51Z phk $\n */\n\n#ifndef _GEOM_GEOM_CTL_H_\n#define _GEOM_GEOM_CTL_H_\n\n#include <sys/ioccom.h>\n\n/*\n * Version number.  Used to check consistency between kernel and libgeom.\n */\n#define GCTL_VERSION\t2\n\nstruct gctl_req_arg {\n\tu_int\t\t\t\tnlen;\n\tchar\t\t\t\t*name;\n\toff_t\t\t\t\toffset;\n\tint\t\t\t\tflag;\n\tint\t\t\t\tlen;\n\tvoid\t\t\t\t*value;\n\t/* kernel only fields */\n\tvoid\t\t\t\t*kvalue;\n};\n\n#define GCTL_PARAM_RD\t\t1\t/* Must match VM_PROT_READ */\n#define GCTL_PARAM_WR\t\t2\t/* Must match VM_PROT_WRITE */\n#define GCTL_PARAM_RW\t\t(GCTL_PARAM_RD | GCTL_PARAM_WR)\n#define GCTL_PARAM_ASCII\t4\n\n/* These are used in the kernel only */\n#define GCTL_PARAM_NAMEKERNEL\t8\n#define GCTL_PARAM_VALUEKERNEL\t16\n#define GCTL_PARAM_CHANGED\t32\n\nstruct gctl_req {\n\tu_int\t\t\t\tversion;\n\tu_int\t\t\t\tserial;\n\tu_int\t\t\t\tnarg;\n\tstruct gctl_req_arg\t\t*arg;\n\tu_int\t\t\t\tlerror;\n\tchar\t\t\t\t*error;\n\tstruct gctl_req_table\t\t*reqt;\n\n\t/* kernel only fields */\n\tint\t\t\t\tnerror;\n\tstruct sbuf\t\t\t*serror;\n};\n\n#define GEOM_CTL\t_IOW('G', GCTL_VERSION, struct gctl_req)\n\n#define PATH_GEOM_CTL\t\"geom.ctl\"\n\n\n#endif /* _GEOM_GEOM_CTL_H_ */\n"
  },
  {
    "path": "freebsd-headers/geom/geom_disk.h",
    "content": "/*-\n * Copyright (c) 2003 Poul-Henning Kamp\n * All rights reserved.\n *\n * This software was developed for the FreeBSD Project by Poul-Henning Kamp\n * and NAI Labs, the Security Research Division of Network Associates, Inc.\n * under DARPA/SPAWAR contract N66001-01-C-8035 (\"CBOSS\"), as part of the\n * DARPA CHATS research program.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. The names of the authors may not be used to endorse or promote\n *    products derived from this software without specific prior written\n *    permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/geom/geom_disk.h 223089 2011-06-14 17:10:32Z gibbs $\n */\n\n#ifndef _GEOM_GEOM_DISK_H_\n#define _GEOM_GEOM_DISK_H_\n\n#ifdef _KERNEL \n\n#include <sys/queue.h>\n#include <sys/_lock.h>\n#include <sys/_mutex.h>\n#include <sys/disk.h>\n\nstruct disk;\n\ntypedef\tint\tdisk_open_t(struct disk *);\ntypedef\tint\tdisk_close_t(struct disk *);\ntypedef\tvoid\tdisk_strategy_t(struct bio *bp);\ntypedef\tint\tdisk_getattr_t(struct bio *bp);\ntypedef\tint\tdisk_ioctl_t(struct disk *, u_long cmd, void *data,\n\t\t\tint fflag, struct thread *td);\n\t\t/* NB: disk_ioctl_t SHALL be cast'able to d_ioctl_t */\n\nstruct g_geom;\nstruct devstat;\n\nstruct disk {\n\t/* Fields which are private to geom_disk */\n\tstruct g_geom\t\t*d_geom;\n\tstruct devstat\t\t*d_devstat;\n\tint\t\t\td_destroyed;\n\n\t/* Shared fields */\n\tu_int\t\t\td_flags;\n\tconst char\t\t*d_name;\n\tu_int\t\t\td_unit;\n\tstruct bio_queue_head\t*d_queue;\n\tstruct mtx\t\t*d_lock;\n\n\t/* Disk methods  */\n\tdisk_open_t\t\t*d_open;\n\tdisk_close_t\t\t*d_close;\n\tdisk_strategy_t\t\t*d_strategy;\n\tdisk_ioctl_t\t\t*d_ioctl;\n\tdumper_t\t\t*d_dump;\n\tdisk_getattr_t\t\t*d_getattr;\n\n\t/* Info fields from driver to geom_disk.c. Valid when open */\n\tu_int\t\t\td_sectorsize;\n\toff_t\t\t\td_mediasize;\n\tu_int\t\t\td_fwsectors;\n\tu_int\t\t\td_fwheads;\n\tu_int\t\t\td_maxsize;\n\tu_int\t\t\td_stripeoffset;\n\tu_int\t\t\td_stripesize;\n\tchar\t\t\td_ident[DISK_IDENT_SIZE];\n\tchar\t\t\td_descr[DISK_IDENT_SIZE];\n\tuint16_t\t\td_hba_vendor;\n\tuint16_t\t\td_hba_device;\n\tuint16_t\t\td_hba_subvendor;\n\tuint16_t\t\td_hba_subdevice;\n\n\t/* Fields private to the driver */\n\tvoid\t\t\t*d_drv1;\n};\n\n#define DISKFLAG_NEEDSGIANT\t0x1\n#define DISKFLAG_OPEN\t\t0x2\n#define DISKFLAG_CANDELETE\t0x4\n#define DISKFLAG_CANFLUSHCACHE\t0x8\n\nstruct disk *disk_alloc(void);\nvoid disk_create(struct disk *disk, int version);\nvoid disk_destroy(struct disk *disk);\nvoid disk_gone(struct disk *disk);\nvoid disk_attr_changed(struct disk *dp, const char *attr, int flag);\n\n#define DISK_VERSION_00\t\t0x58561059\n#define DISK_VERSION_01\t\t0x5856105a\n#define DISK_VERSION\t\tDISK_VERSION_01\n\n#endif /* _KERNEL */\n#endif /* _GEOM_GEOM_DISK_H_ */\n"
  },
  {
    "path": "freebsd-headers/geom/geom_int.h",
    "content": "/*-\n * Copyright (c) 2002 Poul-Henning Kamp\n * Copyright (c) 2002 Networks Associates Technology, Inc.\n * All rights reserved.\n *\n * This software was developed for the FreeBSD Project by Poul-Henning Kamp\n * and NAI Labs, the Security Research Division of Network Associates, Inc.\n * under DARPA/SPAWAR contract N66001-01-C-8035 (\"CBOSS\"), as part of the\n * DARPA CHATS research program.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. The names of the authors may not be used to endorse or promote\n *    products derived from this software without specific prior written\n *    permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/geom/geom_int.h 136946 2004-10-25 12:28:28Z phk $\n */\n\nLIST_HEAD(class_list_head, g_class);\nTAILQ_HEAD(g_tailq_head, g_geom);\n\nextern int g_collectstats;\nextern int g_debugflags;\n/*\n * 1\tG_T_TOPOLOGY\n * 2\tG_T_BIO\n * 4\tG_T_ACCESS\n * 8\t(unused)\n * 16\tAllow footshooting on rank#1 providers\n * 32\tG_T_DETAILS\n */\n#define G_F_DISKIOCTL\t64\n#define G_F_CTLDUMP\t128\n\n/* geom_dump.c */\nvoid g_confxml(void *, int flag);\nvoid g_conf_specific(struct sbuf *sb, struct g_class *mp, struct g_geom *gp, struct g_provider *pp, struct g_consumer *cp);\nvoid g_confdot(void *, int flag);\nvoid g_conftxt(void *, int flag);\n\n/* geom_event.c */\nvoid g_event_init(void);\nvoid g_run_events(void);\nvoid g_do_wither(void);\n\n/* geom_subr.c */\nextern struct class_list_head g_classes;\nextern char *g_wait_event, *g_wait_sim, *g_wait_up, *g_wait_down;\nint g_wither_washer(void);\n\n/* geom_io.c */\nvoid g_io_init(void);\nvoid g_io_schedule_down(struct thread *tp);\nvoid g_io_schedule_up(struct thread *tp);\n\n/* geom_kern.c / geom_kernsim.c */\nvoid g_init(void);\nextern int g_shutdown;\n\n/* geom_ctl.c */\nvoid g_ctl_init(void);\n"
  },
  {
    "path": "freebsd-headers/geom/geom_slice.h",
    "content": "/*-\n * Copyright (c) 2002 Poul-Henning Kamp\n * Copyright (c) 2002 Networks Associates Technology, Inc.\n * All rights reserved.\n *\n * This software was developed for the FreeBSD Project by Poul-Henning Kamp\n * and NAI Labs, the Security Research Division of Network Associates, Inc.\n * under DARPA/SPAWAR contract N66001-01-C-8035 (\"CBOSS\"), as part of the\n * DARPA CHATS research program.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. The names of the authors may not be used to endorse or promote\n *    products derived from this software without specific prior written\n *    permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/geom/geom_slice.h 155802 2006-02-18 11:21:17Z pjd $\n */\n\n#ifndef _GEOM_GEOM_SLICE_H_\n#define _GEOM_GEOM_SLICE_H_\n\nstruct g_slice {\n\toff_t\toffset;\n\toff_t\tlength;\n\tu_int\tsectorsize;\n\tstruct\tg_provider *provider;\n};\n\nstruct g_slice_hot {\n\toff_t\toffset;\n\toff_t\tlength;\n\tint\tract;\n\tint\tdact;\n\tint\twact;\n};\n\ntypedef int g_slice_start_t (struct bio *bp);\n\nstruct g_slicer {\n\tu_int\t\t\tnslice;\n\tu_int\t\t\tnprovider;\n\tstruct g_slice\t\t*slices;\n\n\tu_int\t\t\tnhotspot;\n\tstruct g_slice_hot\t*hotspot;\n\n\tvoid\t\t\t*softc;\n\tg_slice_start_t\t\t*start;\n\tg_event_t\t\t*hot;\n};\n\ng_dumpconf_t g_slice_dumpconf;\nint g_slice_config(struct g_geom *gp, u_int idx, int how, off_t offset, off_t length, u_int sectorsize, const char *fmt, ...);\nvoid g_slice_spoiled(struct g_consumer *cp);\nvoid g_slice_orphan(struct g_consumer *cp);\n#define G_SLICE_CONFIG_CHECK\t0\n#define G_SLICE_CONFIG_SET\t1\n#define G_SLICE_CONFIG_FORCE\t2\nstruct g_geom * g_slice_new(struct g_class *mp, u_int slices, struct g_provider *pp, struct g_consumer **cpp, void *extrap, int extra, g_slice_start_t *start);\n\nint g_slice_conf_hot(struct g_geom *gp, u_int idx, off_t offset, off_t length, int ract, int dact, int wact);\n#define G_SLICE_HOT_ALLOW\t1\n#define G_SLICE_HOT_DENY\t2\n#define G_SLICE_HOT_START\t4\n#define G_SLICE_HOT_CALL\t8\n\nint g_slice_destroy_geom(struct gctl_req *req, struct g_class *mp, struct g_geom *gp);\n\nvoid g_slice_finish_hot(struct bio *bp);\n\n#endif /* _GEOM_GEOM_SLICE_H_ */\n"
  },
  {
    "path": "freebsd-headers/geom/geom_vfs.h",
    "content": "/*-\n * Copyright (c) 2004 Poul-Henning Kamp\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/geom/geom_vfs.h 183754 2008-10-10 21:23:50Z attilio $\n */\n\n#ifndef _GEOM_GEOM_VFS_H_\n#define _GEOM_GEOM_VFS_H_\n\nstruct vnode;\nstruct bufobj;\nstruct buf;\n\nextern struct buf_ops *g_vfs_bufops;\n\nvoid g_vfs_strategy(struct bufobj *bo, struct buf *bp);\nint g_vfs_open(struct vnode *vp, struct g_consumer **cpp, const char *fsname, int wr);\nvoid g_vfs_close(struct g_consumer *cp);\n\n#endif /* _GEOM_GEOM_VFS_H_ */\n"
  },
  {
    "path": "freebsd-headers/geom/journal/g_journal.h",
    "content": "/*-\n * Copyright (c) 2005-2006 Pawel Jakub Dawidek <pjd@FreeBSD.org>\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/geom/journal/g_journal.h 185693 2008-12-06 11:33:10Z trasz $\n */\n\n#ifndef\t_G_JOURNAL_H_\n#define\t_G_JOURNAL_H_\n\n#include <sys/endian.h>\n#include <sys/md5.h>\n#ifdef _KERNEL\n#include <sys/bio.h>\n#endif\n\n#define\tG_JOURNAL_CLASS_NAME\t\"JOURNAL\"\n\n#define\tG_JOURNAL_MAGIC\t\t\"GEOM::JOURNAL\"\n/*\n * Version history:\n * 0 - Initial version number.\n */\n#define\tG_JOURNAL_VERSION\t0\n\n#ifdef _KERNEL\nextern int g_journal_debug;\n\n#define\tGJ_DEBUG(lvl, ...)\tdo {\t\t\t\t\t\\\n\tif (g_journal_debug >= (lvl)) {\t\t\t\t\t\\\n\t\tprintf(\"GEOM_JOURNAL\");\t\t\t\t\t\\\n\t\tif (g_journal_debug > 0)\t\t\t\t\\\n\t\t\tprintf(\"[%u]\", lvl);\t\t\t\t\\\n\t\tprintf(\": \");\t\t\t\t\t\t\\\n\t\tprintf(__VA_ARGS__);\t\t\t\t\t\\\n\t\tprintf(\"\\n\");\t\t\t\t\t\t\\\n\t}\t\t\t\t\t\t\t\t\\\n} while (0)\n#define\tGJ_LOGREQ(lvl, bp, ...)\tdo {\t\t\t\t\t\\\n\tif (g_journal_debug >= (lvl)) {\t\t\t\t\t\\\n\t\tprintf(\"GEOM_JOURNAL\");\t\t\t\t\t\\\n\t\tif (g_journal_debug > 0)\t\t\t\t\\\n\t\t\tprintf(\"[%u]\", lvl);\t\t\t\t\\\n\t\tprintf(\": \");\t\t\t\t\t\t\\\n\t\tprintf(__VA_ARGS__);\t\t\t\t\t\\\n\t\tprintf(\" \");\t\t\t\t\t\t\\\n\t\tg_print_bio(bp);\t\t\t\t\t\\\n\t\tprintf(\"\\n\");\t\t\t\t\t\t\\\n\t}\t\t\t\t\t\t\t\t\\\n} while (0)\n\n#define\tJEMPTY(sc)\t((sc)->sc_journal_offset -\t\t\t\\\n\t\t\t (sc)->sc_jprovider->sectorsize ==\t\t\\\n\t\t\t (sc)->sc_active.jj_offset &&\t\t\t\\\n\t\t\t (sc)->sc_current_count == 0)\n\n#define\tGJ_BIO_REGULAR\t\t0x00\n#define\tGJ_BIO_READ\t\t0x01\n#define\tGJ_BIO_JOURNAL\t\t0x02\n#define\tGJ_BIO_COPY\t\t0x03\n#define\tGJ_BIO_MASK\t\t0x0f\n\n#if 0\n#define\tGJF_BIO_DONT_FREE\t0x10\n#define\tGJF_BIO_MASK\t\t0xf0\n#endif\n\n#define\tGJF_DEVICE_HARDCODED\t\t0x0001\n#define\tGJF_DEVICE_DESTROY\t\t0x0010\n#define\tGJF_DEVICE_SWITCH\t\t0x0020\n#define\tGJF_DEVICE_BEFORE_SWITCH\t0x0040\n#define\tGJF_DEVICE_CLEAN\t\t0x0080\n#define\tGJF_DEVICE_CHECKSUM\t\t0x0100\n\n#define\tGJ_HARD_LIMIT\t\t64\n\n/*\n * We keep pointers to journaled data in bio structure and because we\n * need to store two off_t values (offset in data provider and offset in\n * journal), we have to borrow bio_completed field for this.\n */\n#define\tbio_joffset\tbio_completed\n/*\n * Use bio_caller1 field as a pointer in queue.\n */\n#define\tbio_next\tbio_caller1\n\n/*\n * There are two such structures maintained inside each journaled device.\n * One describes active part of the journal, were recent requests are stored.\n * The second describes the last consistent part of the journal with requests\n * that are copied to the destination provider.\n */\nstruct g_journal_journal {\n\tstruct bio\t*jj_queue;\t/* Cached journal entries. */\n\toff_t\t\t jj_offset;\t/* Journal's start offset. */\n};\n\nstruct g_journal_softc {\n\tuint32_t\t sc_id;\n\tuint8_t\t\t sc_type;\n\tuint8_t\t\t sc_orig_type;\n\tstruct g_geom\t*sc_geom;\n\tu_int\t\t sc_flags;\n\tstruct mtx\t sc_mtx;\n\toff_t\t\t sc_mediasize;\n\tu_int\t\t sc_sectorsize;\n#define\tGJ_FLUSH_DATA\t\t0x01\n#define\tGJ_FLUSH_JOURNAL\t0x02\n\tu_int\t\t sc_bio_flush;\n\n\tuint32_t\t sc_journal_id;\n\tuint32_t\t sc_journal_next_id;\n\tint\t\t sc_journal_copying;\n\toff_t\t\t sc_journal_offset;\n\toff_t\t\t sc_journal_previous_id;\n\n\tstruct bio_queue_head sc_back_queue;\n\tstruct bio_queue_head sc_regular_queue;\n\n\tstruct bio_queue_head sc_delayed_queue;\n\tint\t\t sc_delayed_count;\n\n\tstruct bio\t*sc_current_queue;\n\tint\t\t sc_current_count;\n\n\tstruct bio\t*sc_flush_queue;\n\tint\t\t sc_flush_count;\n\tint\t\t sc_flush_in_progress;\n\n\tstruct bio\t*sc_copy_queue;\n\tint\t\t sc_copy_in_progress;\n\n\tstruct g_consumer *sc_dconsumer;\n\tstruct g_consumer *sc_jconsumer;\n\n\tstruct g_journal_journal sc_inactive;\n\tstruct g_journal_journal sc_active;\n\n\toff_t\t\t sc_jstart;\t/* Journal space start offset. */\n\toff_t\t\t sc_jend;\t/* Journal space end offset. */\n\n\tstruct callout\t sc_callout;\n\tstruct proc\t*sc_worker;\n\n\tstruct root_hold_token *sc_rootmount;\n};\n#define\tsc_dprovider\tsc_dconsumer->provider\n#define\tsc_jprovider\tsc_jconsumer->provider\n#define\tsc_name\t\tsc_dprovider->name\n\n#define\tGJQ_INSERT_HEAD(head, bp)\tdo {\t\t\t\t\\\n\t(bp)->bio_next = (head);\t\t\t\t\t\\\n\t(head) = (bp);\t\t\t\t\t\t\t\\\n} while (0)\n#define\tGJQ_INSERT_AFTER(head, bp, pbp)\tdo {\t\t\t\t\\\n\tif ((pbp) == NULL)\t\t\t\t\t\t\\\n\t\tGJQ_INSERT_HEAD(head, bp);\t\t\t\t\\\n\telse {\t\t\t\t\t\t\t\t\\\n\t\t(bp)->bio_next = (pbp)->bio_next;\t\t\t\\\n\t\t(pbp)->bio_next = (bp);\t\t\t\t\t\\\n\t}\t\t\t\t\t\t\t\t\\\n} while (0)\n#define\tGJQ_FIRST(head)\t(head)\n#define\tGJQ_REMOVE(head, bp)\tdo {\t\t\t\t\t\\\n\tstruct bio *_bp;\t\t\t\t\t\t\\\n\t\t\t\t\t\t\t\t\t\\\n\tif ((head) == (bp)) {\t\t\t\t\t\t\\\n\t\t(head) = (bp)->bio_next;\t\t\t\t\\\n\t\t(bp)->bio_next = NULL;\t\t\t\t\t\\\n\t\tbreak;\t\t\t\t\t\t\t\\\n\t}\t\t\t\t\t\t\t\t\\\n\tfor (_bp = (head); _bp->bio_next != NULL; _bp = _bp->bio_next) {\\\n\t\tif (_bp->bio_next == (bp))\t\t\t\t\\\n\t\t\tbreak;\t\t\t\t\t\t\\\n\t}\t\t\t\t\t\t\t\t\\\n\tKASSERT(_bp->bio_next != NULL, (\"NULL bio_next\"));\t\t\\\n\tKASSERT(_bp->bio_next == (bp), (\"bio_next != bp\"));\t\t\\\n\t_bp->bio_next = (bp)->bio_next;\t\t\t\t\t\\\n\t(bp)->bio_next = NULL;\t\t\t\t\t\t\\\n} while (0)\n#define GJQ_FOREACH(head, bp)\t\t\t\t\t\t\\\n\tfor ((bp) = (head); (bp) != NULL; (bp) = (bp)->bio_next)\n\n#define\tGJ_HEADER_MAGIC\t\"GJHDR\"\n\nstruct g_journal_header {\n\tchar\t\tjh_magic[sizeof(GJ_HEADER_MAGIC)];\n\tuint32_t\tjh_journal_id;\n\tuint32_t\tjh_journal_next_id;\n} __packed;\n\nstruct g_journal_entry {\n\tuint64_t\tje_joffset;\n\tuint64_t\tje_offset;\n\tuint64_t\tje_length;\n} __packed;\n\n#define\tGJ_RECORD_HEADER_MAGIC\t\t\"GJRHDR\"\n#define\tGJ_RECORD_HEADER_NENTRIES\t(20)\n#define\tGJ_RECORD_MAX_SIZE(sc)\t\\\n\t((sc)->sc_jprovider->sectorsize + GJ_RECORD_HEADER_NENTRIES * MAXPHYS)\n#define\tGJ_VALIDATE_OFFSET(offset, sc)\tdo {\t\t\t\t\\\n\tif ((offset) + GJ_RECORD_MAX_SIZE(sc) >= (sc)->sc_jend) {\t\\\n\t\t(offset) = (sc)->sc_jstart;\t\t\t\t\\\n\t\tGJ_DEBUG(2, \"Starting from the begining (%s).\",\t\t\\\n\t\t    (sc)->sc_name);\t\t\t\t\t\\\n\t}\t\t\t\t\t\t\t\t\\\n} while (0)\n\nstruct g_journal_record_header {\n\tchar\t\tjrh_magic[sizeof(GJ_RECORD_HEADER_MAGIC)];\n\tuint32_t\tjrh_journal_id;\n\tuint16_t\tjrh_nentries;\n\tu_char\t\tjrh_sum[8];\n\tstruct g_journal_entry jrh_entries[GJ_RECORD_HEADER_NENTRIES];\n} __packed;\n\ntypedef int (g_journal_clean_t)(struct mount *mp);\ntypedef void (g_journal_dirty_t)(struct g_consumer *cp);\n\nstruct g_journal_desc {\n\tconst char\t\t*jd_fstype;\n\tg_journal_clean_t\t*jd_clean;\n\tg_journal_dirty_t\t*jd_dirty;\n};\n\n/* Supported file systems. */\nextern const struct g_journal_desc g_journal_ufs;\n\n#define\tGJ_TIMER_START(lvl, bt)\tdo {\t\t\t\t\t\\\n\tif (g_journal_debug >= (lvl))\t\t\t\t\t\\\n\t\tbinuptime(bt);\t\t\t\t\t\t\\\n} while (0)\n#define\tGJ_TIMER_STOP(lvl, bt, ...)\tdo {\t\t\t\t\\\n\tif (g_journal_debug >= (lvl)) {\t\t\t\t\t\\\n\t\tstruct bintime _bt2;\t\t\t\t\t\\\n\t\tstruct timeval _tv;\t\t\t\t\t\\\n\t\t\t\t\t\t\t\t\t\\\n\t\tbinuptime(&_bt2);\t\t\t\t\t\\\n\t\tbintime_sub(&_bt2, bt);\t\t\t\t\t\\\n\t\tbintime2timeval(&_bt2, &_tv);\t\t\t\t\\\n\t\tprintf(\"GEOM_JOURNAL\");\t\t\t\t\t\\\n\t\tif (g_journal_debug > 0)\t\t\t\t\\\n\t\t\tprintf(\"[%u]\", lvl);\t\t\t\t\\\n\t\tprintf(\": \");\t\t\t\t\t\t\\\n\t\tprintf(__VA_ARGS__);\t\t\t\t\t\\\n\t\tprintf(\": %jd.%06jds\\n\", (intmax_t)_tv.tv_sec,\t\t\\\n\t\t    (intmax_t)_tv.tv_usec);\t\t\t\t\\\n\t}\t\t\t\t\t\t\t\t\\\n} while (0)\n#endif\t/* _KERNEL */\n\n#define\tGJ_TYPE_DATA\t\t0x01\n#define\tGJ_TYPE_JOURNAL\t\t0x02\n#define\tGJ_TYPE_COMPLETE\t(GJ_TYPE_DATA|GJ_TYPE_JOURNAL)\n\n#define\tGJ_FLAG_CLEAN\t\t0x01\n#define\tGJ_FLAG_CHECKSUM\t0x02\n\nstruct g_journal_metadata {\n\tchar\t\tmd_magic[16];\t/* Magic value. */\n\tuint32_t\tmd_version;\t/* Version number. */\n\tuint32_t\tmd_id;\t\t/* Journal unique ID. */\n\tuint8_t\t\tmd_type;\t/* Provider type. */\n\tuint64_t\tmd_jstart;\t/* Journal space start offset. */\n\tuint64_t\tmd_jend;\t/* Journal space end offset. */\n\tuint64_t\tmd_joffset;\t/* Last known consistent journal offset. */\n\tuint32_t\tmd_jid;\t\t/* Last known consistent journal ID. */\n\tuint64_t\tmd_flags;\t/* Journal flags. */\n\tchar\t\tmd_provider[16]; /* Hardcoded provider. */\n\tuint64_t\tmd_provsize;\t/* Provider's size. */\n\tu_char\t\tmd_hash[16];\t/* MD5 hash. */\n};\nstatic __inline void\njournal_metadata_encode(struct g_journal_metadata *md, u_char *data)\n{\n\tMD5_CTX ctx;\n\n\tbcopy(md->md_magic, data, 16);\n\tle32enc(data + 16, md->md_version);\n\tle32enc(data + 20, md->md_id);\n\t*(data + 24) = md->md_type;\n\tle64enc(data + 25, md->md_jstart);\n\tle64enc(data + 33, md->md_jend);\n\tle64enc(data + 41, md->md_joffset);\n\tle32enc(data + 49, md->md_jid);\n\tle64enc(data + 53, md->md_flags);\n\tbcopy(md->md_provider, data + 61, 16);\n\tle64enc(data + 77, md->md_provsize);\n\tMD5Init(&ctx);\n\tMD5Update(&ctx, data, 85);\n\tMD5Final(md->md_hash, &ctx);\n\tbcopy(md->md_hash, data + 85, 16);\n}\nstatic __inline int\njournal_metadata_decode_v0(const u_char *data, struct g_journal_metadata *md)\n{\n\tMD5_CTX ctx;\n\n\tmd->md_id = le32dec(data + 20);\n\tmd->md_type = *(data + 24);\n\tmd->md_jstart = le64dec(data + 25);\n\tmd->md_jend = le64dec(data + 33);\n\tmd->md_joffset = le64dec(data + 41);\n\tmd->md_jid = le32dec(data + 49);\n\tmd->md_flags = le64dec(data + 53);\n\tbcopy(data + 61, md->md_provider, 16);\n\tmd->md_provsize = le64dec(data + 77);\n\tMD5Init(&ctx);\n\tMD5Update(&ctx, data, 85);\n\tMD5Final(md->md_hash, &ctx);\n\tif (bcmp(md->md_hash, data + 85, 16) != 0)\n\t\treturn (EINVAL);\n\treturn (0);\n}\nstatic __inline int\njournal_metadata_decode(const u_char *data, struct g_journal_metadata *md)\n{\n\tint error;\n\n\tbcopy(data, md->md_magic, 16);\n\tmd->md_version = le32dec(data + 16);\n\tswitch (md->md_version) {\n\tcase 0:\n\t\terror = journal_metadata_decode_v0(data, md);\n\t\tbreak;\n\tdefault:\n\t\terror = EINVAL;\n\t\tbreak;\n\t}\n\treturn (error);\n}\n\nstatic __inline void\njournal_metadata_dump(const struct g_journal_metadata *md)\n{\n\tstatic const char hex[] = \"0123456789abcdef\";\n\tchar hash[16 * 2 + 1];\n\tu_int i;\n\n\tprintf(\"     magic: %s\\n\", md->md_magic);\n\tprintf(\"   version: %u\\n\", (u_int)md->md_version);\n\tprintf(\"        id: %u\\n\", (u_int)md->md_id);\n\tprintf(\"      type: %u\\n\", (u_int)md->md_type);\n\tprintf(\"     start: %ju\\n\", (uintmax_t)md->md_jstart);\n\tprintf(\"       end: %ju\\n\", (uintmax_t)md->md_jend);\n\tprintf(\"   joffset: %ju\\n\", (uintmax_t)md->md_joffset);\n\tprintf(\"       jid: %u\\n\", (u_int)md->md_jid);\n\tprintf(\"     flags: %u\\n\", (u_int)md->md_flags);\n\tprintf(\"hcprovider: %s\\n\", md->md_provider);\n\tprintf(\"  provsize: %ju\\n\", (uintmax_t)md->md_provsize);\n\tbzero(hash, sizeof(hash));\n\tfor (i = 0; i < 16; i++) {\n\t\thash[i * 2] = hex[md->md_hash[i] >> 4];\n\t\thash[i * 2 + 1] = hex[md->md_hash[i] & 0x0f];\n\t}\n\tprintf(\"  MD5 hash: %s\\n\", hash);\n}\n#endif\t/* !_G_JOURNAL_H_ */\n"
  },
  {
    "path": "freebsd-headers/geom/label/g_label.h",
    "content": "/*-\n * Copyright (c) 2004-2005 Pawel Jakub Dawidek <pjd@FreeBSD.org>\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/geom/label/g_label.h 199875 2009-11-28 11:57:43Z trasz $\n */\n\n#ifndef\t_G_LABEL_H_\n#define\t_G_LABEL_H_\n\n#include <sys/endian.h>\n#ifdef _KERNEL\n#include <sys/sysctl.h>\n#endif\n\n#define\tG_LABEL_CLASS_NAME\t\"LABEL\"\n\n#define\tG_LABEL_MAGIC\t\t\"GEOM::LABEL\"\n/*\n * Version history:\n * 1 - Initial version number.\n * 2 - Added md_provsize field to metadata.\n */\n#define\tG_LABEL_VERSION\t\t2\n#define\tG_LABEL_DIR\t\t\"label\"\n\n#ifdef _KERNEL\nextern u_int g_label_debug;\n\n#define\tG_LABEL_DEBUG(lvl, ...)\tdo {\t\t\t\t\t\\\n\tif (g_label_debug >= (lvl)) {\t\t\t\t\t\\\n\t\tprintf(\"GEOM_LABEL\");\t\t\t\t\t\\\n\t\tif (g_label_debug > 0)\t\t\t\t\t\\\n\t\t\tprintf(\"[%u]\", lvl);\t\t\t\t\\\n\t\tprintf(\": \");\t\t\t\t\t\t\\\n\t\tprintf(__VA_ARGS__);\t\t\t\t\t\\\n\t\tprintf(\"\\n\");\t\t\t\t\t\t\\\n\t}\t\t\t\t\t\t\t\t\\\n} while (0)\n\nSYSCTL_DECL(_kern_geom_label);\n\n#define\tG_LABEL_INIT(kind, label, descr) \t\t\t\t\\\n\tSYSCTL_NODE(_kern_geom_label, OID_AUTO, kind, CTLFLAG_RD,\t\\\n\t    NULL, \"\");\t\t\t\t\t\t\t\\\n\tSYSCTL_INT(_kern_geom_label_##kind, OID_AUTO, enable, \t\t\\\n\t    CTLFLAG_RW, &label.ld_enabled, 1, descr);\t\t\t\\\n\tTUNABLE_INT(\"kern.geom.label.\" __XSTRING(kind) \".enable\",\t\\\n\t    &label.ld_enabled)\n\ntypedef void g_label_taste_t (struct g_consumer *cp, char *label, size_t size);\n\nstruct g_label_desc {\n\tg_label_taste_t\t*ld_taste;\n\tchar\t\t*ld_dir;\n\tint\t\t ld_enabled;\n};\n\n/* Supported labels. */\nextern struct g_label_desc g_label_ufs_id;\nextern struct g_label_desc g_label_ufs_volume;\nextern struct g_label_desc g_label_iso9660;\nextern struct g_label_desc g_label_msdosfs;\nextern struct g_label_desc g_label_ext2fs;\nextern struct g_label_desc g_label_reiserfs;\nextern struct g_label_desc g_label_ntfs;\nextern struct g_label_desc g_label_gpt;\nextern struct g_label_desc g_label_gpt_uuid;\n#endif\t/* _KERNEL */\n\nstruct g_label_metadata {\n\tchar\t\tmd_magic[16];\t/* Magic value. */\n\tuint32_t\tmd_version;\t/* Version number. */\n\tchar\t\tmd_label[16];\t/* Label. */\n\tuint64_t\tmd_provsize;\t/* Provider's size. */\n};\nstatic __inline void\nlabel_metadata_encode(const struct g_label_metadata *md, u_char *data)\n{\n\n\tbcopy(md->md_magic, data, sizeof(md->md_magic));\n\tle32enc(data + 16, md->md_version);\n\tbcopy(md->md_label, data + 20, sizeof(md->md_label));\n\tle64enc(data + 36, md->md_provsize);\n}\nstatic __inline void\nlabel_metadata_decode(const u_char *data, struct g_label_metadata *md)\n{\n\n\tbcopy(data, md->md_magic, sizeof(md->md_magic));\n\tmd->md_version = le32dec(data + 16);\n\tbcopy(data + 20, md->md_label, sizeof(md->md_label));\n\tmd->md_provsize = le64dec(data + 36);\n}\n#endif\t/* _G_LABEL_H_ */\n"
  },
  {
    "path": "freebsd-headers/geom/label/g_label_msdosfs.h",
    "content": "/*-\n * Copyright (c) 2006 Tobias Reifenberger\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/geom/label/g_label_msdosfs.h 162834 2006-09-30 08:16:49Z pjd $\n */\n\n#include <sys/types.h>\n\n/*\n * Conversion macros for little endian encoded unsigned integers\n * in byte streams to the local unsigned integer format.\n */\n#define UINT16BYTES(p) ((uint32_t)((p)[0] + (256*(p)[1])))\n#define UINT32BYTES(p) ((uint32_t)((p)[0] + (256*(p)[1]) +\t\t\\\n\t    (65536*(p)[2]) + (16777216*(p)[3])))\n\n/*\n * All following structures are according to:\n *\n * Microsoft Extensible Firmware Initiative FAT32 File System Specification\n * FAT: General Overview of On-Disk Format\n * Version 1.03, December 6, 2000\n * Microsoft Corporation\n */\n\n/*\n * FAT boot sector and boot parameter block for\n * FAT12 and FAT16 volumes\n */\ntypedef struct fat_bsbpb {\n\t/* common fields */\n\tuint8_t BS_jmpBoot[3];\n\tuint8_t BS_OEMName[8];\n\tuint8_t BPB_BytsPerSec[2];\n\tuint8_t BPB_SecPerClus;\n\tuint8_t BPB_RsvdSecCnt[2];\n\tuint8_t BPB_NumFATs;\n\tuint8_t BPB_RootEntCnt[2];\n\tuint8_t BPB_TotSec16[2];\n\tuint8_t BPB_Media;\n\tuint8_t BPB_FATSz16[2];\n\tuint8_t BPB_SecPerTrack[2];\n\tuint8_t BPB_NumHeads[2];\n\tuint8_t BPB_HiddSec[4];\n\tuint8_t BPB_TotSec32[4];\n\t/* FAT12/FAT16 only fields */\n\tuint8_t BS_DrvNum;\n\tuint8_t BS_Reserved1;\n\tuint8_t BS_BootSig;\n\tuint8_t BS_VolID[4];\n\tuint8_t BS_VolLab[11];\n\tuint8_t BS_FilSysType[8];\n} FAT_BSBPB; /* 62 bytes */\n\n/*\n * FAT boot sector and boot parameter block for\n * FAT32 volumes\n */\ntypedef struct fat32_bsbpb {\n\t/* common fields */\n\tuint8_t BS_jmpBoot[3];\n\tuint8_t BS_OEMName[8];\n\tuint8_t BPB_BytsPerSec[2];\n\tuint8_t BPB_SecPerClus;\n\tuint8_t BPB_RsvdSecCnt[2];\n\tuint8_t BPB_NumFATs;\n\tuint8_t BPB_RootEntCnt[2];\n\tuint8_t BPB_TotSec16[2];\n\tuint8_t BPB_Media;\n\tuint8_t BPB_FATSz16[2];\n\tuint8_t BPB_SecPerTrack[2];\n\tuint8_t BPB_NumHeads[2];\n\tuint8_t BPB_HiddSec[4];\n\tuint8_t BPB_TotSec32[4];\n\t/* FAT32 only fields */\n\tuint8_t BPB_FATSz32[4];\n\tuint8_t BPB_ExtFlags[2];\n\tuint8_t BPB_FSVer[2];\n\tuint8_t BPB_RootClus[4];\n\tuint8_t BPB_FSInfo[2];\n\tuint8_t BPB_BkBootSec[2];\n\tuint8_t BPB_Reserved[12];\n\tuint8_t BS_DrvNum;\n\tuint8_t BS_Reserved1;\n\tuint8_t BS_BootSig;\n\tuint8_t BS_VolID[4];\n\tuint8_t BS_VolLab[11];\n\tuint8_t BS_FilSysType[8];\n} FAT32_BSBPB; /* 90 bytes */\n\n/*\n * FAT directory entry structure\n */\n#define\tFAT_DES_ATTR_READ_ONLY\t0x01\n#define\tFAT_DES_ATTR_HIDDEN\t0x02\n#define\tFAT_DES_ATTR_SYSTEM\t0x04\n#define\tFAT_DES_ATTR_VOLUME_ID\t0x08\n#define\tFAT_DES_ATTR_DIRECTORY\t0x10\n#define\tFAT_DES_ATTR_ARCHIVE\t0x20\n#define\tFAT_DES_ATTR_LONG_NAME\t(FAT_DES_ATTR_READ_ONLY |\t\t\\\n\t\t\t\t FAT_DES_ATTR_HIDDEN |\t\t\t\\\n\t\t\t\t FAT_DES_ATTR_SYSTEM |\t\t\t\\\n\t\t\t\t FAT_DES_ATTR_VOLUME_ID)\n\ntypedef struct fat_des {\n\tuint8_t DIR_Name[11];\n\tuint8_t DIR_Attr;\n\tuint8_t DIR_NTRes;\n\tuint8_t DIR_CrtTimeTenth;\n\tuint8_t DIR_CrtTime[2];\n\tuint8_t DIR_CrtDate[2];\n\tuint8_t DIR_LstAccDate[2];\n\tuint8_t DIR_FstClusHI[2];\n\tuint8_t DIR_WrtTime[2];\n\tuint8_t DIR_WrtDate[2];\n\tuint8_t DIR_FstClusLO[2];\n\tuint8_t DIR_FileSize[4];\n} FAT_DES;\n"
  },
  {
    "path": "freebsd-headers/geom/mirror/g_mirror.h",
    "content": "/*-\n * Copyright (c) 2004-2006 Pawel Jakub Dawidek <pjd@FreeBSD.org>\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/geom/mirror/g_mirror.h 200086 2009-12-03 21:47:51Z mav $\n */\n\n#ifndef\t_G_MIRROR_H_\n#define\t_G_MIRROR_H_\n\n#include <sys/endian.h>\n#include <sys/md5.h>\n\n#define\tG_MIRROR_CLASS_NAME\t\"MIRROR\"\n\n#define\tG_MIRROR_MAGIC\t\t\"GEOM::MIRROR\"\n/*\n * Version history:\n * 0 - Initial version number.\n * 1 - Added 'prefer' balance algorithm.\n * 2 - Added md_genid field to metadata.\n * 3 - Added md_provsize field to metadata.\n * 4 - Added 'no failure synchronization' flag.\n */\n#define\tG_MIRROR_VERSION\t4\n\n#define\tG_MIRROR_BALANCE_NONE\t\t0\n#define\tG_MIRROR_BALANCE_ROUND_ROBIN\t1\n#define\tG_MIRROR_BALANCE_LOAD\t\t2\n#define\tG_MIRROR_BALANCE_SPLIT\t\t3\n#define\tG_MIRROR_BALANCE_PREFER\t\t4\n#define\tG_MIRROR_BALANCE_MIN\t\tG_MIRROR_BALANCE_NONE\n#define\tG_MIRROR_BALANCE_MAX\t\tG_MIRROR_BALANCE_PREFER\n\n#define\tG_MIRROR_DISK_FLAG_DIRTY\t\t0x0000000000000001ULL\n#define\tG_MIRROR_DISK_FLAG_SYNCHRONIZING\t0x0000000000000002ULL\n#define\tG_MIRROR_DISK_FLAG_FORCE_SYNC\t\t0x0000000000000004ULL\n#define\tG_MIRROR_DISK_FLAG_INACTIVE\t\t0x0000000000000008ULL\n#define\tG_MIRROR_DISK_FLAG_HARDCODED\t\t0x0000000000000010ULL\n#define\tG_MIRROR_DISK_FLAG_BROKEN\t\t0x0000000000000020ULL\n#define\tG_MIRROR_DISK_FLAG_MASK\t\t(G_MIRROR_DISK_FLAG_DIRTY |\t\\\n\t\t\t\t\t G_MIRROR_DISK_FLAG_SYNCHRONIZING | \\\n\t\t\t\t\t G_MIRROR_DISK_FLAG_FORCE_SYNC | \\\n\t\t\t\t\t G_MIRROR_DISK_FLAG_INACTIVE)\n\n#define\tG_MIRROR_DEVICE_FLAG_NOAUTOSYNC\t0x0000000000000001ULL\n#define\tG_MIRROR_DEVICE_FLAG_NOFAILSYNC\t0x0000000000000002ULL\n#define\tG_MIRROR_DEVICE_FLAG_MASK\t(G_MIRROR_DEVICE_FLAG_NOAUTOSYNC | \\\n\t\t\t\t\t G_MIRROR_DEVICE_FLAG_NOFAILSYNC)\n\n#ifdef _KERNEL\nextern u_int g_mirror_debug;\n\n#define\tG_MIRROR_DEBUG(lvl, ...)\tdo {\t\t\t\t\\\n\tif (g_mirror_debug >= (lvl)) {\t\t\t\t\t\\\n\t\tprintf(\"GEOM_MIRROR\");\t\t\t\t\t\\\n\t\tif (g_mirror_debug > 0)\t\t\t\t\t\\\n\t\t\tprintf(\"[%u]\", lvl);\t\t\t\t\\\n\t\tprintf(\": \");\t\t\t\t\t\t\\\n\t\tprintf(__VA_ARGS__);\t\t\t\t\t\\\n\t\tprintf(\"\\n\");\t\t\t\t\t\t\\\n\t}\t\t\t\t\t\t\t\t\\\n} while (0)\n#define\tG_MIRROR_LOGREQ(lvl, bp, ...)\tdo {\t\t\t\t\\\n\tif (g_mirror_debug >= (lvl)) {\t\t\t\t\t\\\n\t\tprintf(\"GEOM_MIRROR\");\t\t\t\t\t\\\n\t\tif (g_mirror_debug > 0)\t\t\t\t\t\\\n\t\t\tprintf(\"[%u]\", lvl);\t\t\t\t\\\n\t\tprintf(\": \");\t\t\t\t\t\t\\\n\t\tprintf(__VA_ARGS__);\t\t\t\t\t\\\n\t\tprintf(\" \");\t\t\t\t\t\t\\\n\t\tg_print_bio(bp);\t\t\t\t\t\\\n\t\tprintf(\"\\n\");\t\t\t\t\t\t\\\n\t}\t\t\t\t\t\t\t\t\\\n} while (0)\n\n#define\tG_MIRROR_BIO_FLAG_REGULAR\t0x01\n#define\tG_MIRROR_BIO_FLAG_SYNC\t\t0x02\n\n/*\n * Informations needed for synchronization.\n */\nstruct g_mirror_disk_sync {\n\tstruct g_consumer *ds_consumer;\t/* Consumer connected to our mirror. */\n\toff_t\t\t  ds_offset;\t/* Offset of next request to send. */\n\toff_t\t\t  ds_offset_done; /* Offset of already synchronized\n\t\t\t\t\t   region. */\n\tu_int\t\t  ds_syncid;\t/* Disk's synchronization ID. */\n\tu_int\t\t  ds_inflight;\t/* Number of in-flight sync requests. */\n\tstruct bio\t**ds_bios;\t/* BIOs for synchronization I/O. */\n};\n\n/*\n * Informations needed for synchronization.\n */\nstruct g_mirror_device_sync {\n\tstruct g_geom\t*ds_geom;\t/* Synchronization geom. */\n\tu_int\t\t ds_ndisks;\t/* Number of disks in SYNCHRONIZING\n\t\t\t\t\t   state. */\n};\n\n#define\tG_MIRROR_DISK_STATE_NONE\t\t0\n#define\tG_MIRROR_DISK_STATE_NEW\t\t\t1\n#define\tG_MIRROR_DISK_STATE_ACTIVE\t\t2\n#define\tG_MIRROR_DISK_STATE_STALE\t\t3\n#define\tG_MIRROR_DISK_STATE_SYNCHRONIZING\t4\n#define\tG_MIRROR_DISK_STATE_DISCONNECTED\t5\n#define\tG_MIRROR_DISK_STATE_DESTROY\t\t6\nstruct g_mirror_disk {\n\tuint32_t\t d_id;\t\t/* Disk ID. */\n\tstruct g_consumer *d_consumer;\t/* Consumer. */\n\tstruct g_mirror_softc\t*d_softc; /* Back-pointer to softc. */\n\tint\t\t d_state;\t/* Disk state. */\n\tu_int\t\t d_priority;\t/* Disk priority. */\n\tu_int\t\t load;\t\t/* Averaged queue length */\n\toff_t\t\t d_last_offset;\t/* Last read offset */\n\tuint64_t\t d_flags;\t/* Additional flags. */\n\tu_int\t\t d_genid;\t/* Disk's generation ID. */\n\tstruct g_mirror_disk_sync d_sync;/* Sync information. */\n\tLIST_ENTRY(g_mirror_disk) d_next;\n};\n#define\td_name\td_consumer->provider->name\n\n#define\tG_MIRROR_EVENT_DONTWAIT\t0x1\n#define\tG_MIRROR_EVENT_WAIT\t0x2\n#define\tG_MIRROR_EVENT_DEVICE\t0x4\n#define\tG_MIRROR_EVENT_DONE\t0x8\nstruct g_mirror_event {\n\tstruct g_mirror_disk\t*e_disk;\n\tint\t\t\t e_state;\n\tint\t\t\t e_flags;\n\tint\t\t\t e_error;\n\tTAILQ_ENTRY(g_mirror_event) e_next;\n};\n\n#define\tG_MIRROR_DEVICE_FLAG_DESTROY\t0x0100000000000000ULL\n#define\tG_MIRROR_DEVICE_FLAG_WAIT\t0x0200000000000000ULL\n#define\tG_MIRROR_DEVICE_FLAG_DESTROYING\t0x0400000000000000ULL\n\n#define\tG_MIRROR_DEVICE_STATE_STARTING\t\t0\n#define\tG_MIRROR_DEVICE_STATE_RUNNING\t\t1\n\n/* Bump syncid on first write. */\n#define\tG_MIRROR_BUMP_SYNCID\t0x1\n/* Bump genid immediately. */\n#define\tG_MIRROR_BUMP_GENID\t0x2\nstruct g_mirror_softc {\n\tu_int\t\tsc_state;\t/* Device state. */\n\tuint32_t\tsc_slice;\t/* Slice size. */\n\tuint8_t\t\tsc_balance;\t/* Balance algorithm. */\n\tuint64_t\tsc_mediasize;\t/* Device size. */\n\tuint32_t\tsc_sectorsize;\t/* Sector size. */\n\tuint64_t\tsc_flags;\t/* Additional flags. */\n\n\tstruct g_geom\t*sc_geom;\n\tstruct g_provider *sc_provider;\n\n\tuint32_t\tsc_id;\t\t/* Mirror unique ID. */\n\n\tstruct sx\t sc_lock;\n\tstruct bio_queue_head sc_queue;\n\tstruct mtx\t sc_queue_mtx;\n\tstruct proc\t*sc_worker;\n\tstruct bio_queue_head sc_regular_delayed; /* Delayed I/O requests due\n\t\t\t\t\t\t     collision with sync\n\t\t\t\t\t\t     requests. */\n\tstruct bio_queue_head sc_inflight; /* In-flight regular write\n\t\t\t\t\t      requests. */\n\tstruct bio_queue_head sc_sync_delayed; /* Delayed sync requests due\n\t\t\t\t\t\t  collision with regular\n\t\t\t\t\t\t  requests. */\n\n\tLIST_HEAD(, g_mirror_disk) sc_disks;\n\tu_int\t\tsc_ndisks;\t/* Number of disks. */\n\tstruct g_mirror_disk *sc_hint;\n\n\tu_int\t\tsc_genid;\t/* Generation ID. */\n\tu_int\t\tsc_syncid;\t/* Synchronization ID. */\n\tint\t\tsc_bump_id;\n\tstruct g_mirror_device_sync sc_sync;\n\tint\t\tsc_idle;\t/* DIRTY flags removed. */\n\ttime_t\t\tsc_last_write;\n\tu_int\t\tsc_writes;\n\n\tTAILQ_HEAD(, g_mirror_event) sc_events;\n\tstruct mtx\tsc_events_mtx;\n\n\tstruct callout\tsc_callout;\n\n\tstruct root_hold_token *sc_rootmount;\n};\n#define\tsc_name\tsc_geom->name\n\nu_int g_mirror_ndisks(struct g_mirror_softc *sc, int state);\n#define\tG_MIRROR_DESTROY_SOFT\t\t0\n#define\tG_MIRROR_DESTROY_DELAYED\t1\n#define\tG_MIRROR_DESTROY_HARD\t\t2\nint g_mirror_destroy(struct g_mirror_softc *sc, int how);\nint g_mirror_event_send(void *arg, int state, int flags);\nstruct g_mirror_metadata;\nint g_mirror_add_disk(struct g_mirror_softc *sc, struct g_provider *pp,\n    struct g_mirror_metadata *md);\nint g_mirror_read_metadata(struct g_consumer *cp, struct g_mirror_metadata *md);\nvoid g_mirror_fill_metadata(struct g_mirror_softc *sc,\n    struct g_mirror_disk *disk, struct g_mirror_metadata *md);\nvoid g_mirror_update_metadata(struct g_mirror_disk *disk);\n\ng_ctl_req_t g_mirror_config;\n#endif\t/* _KERNEL */\n\nstruct g_mirror_metadata {\n\tchar\t\tmd_magic[16];\t/* Magic value. */\n\tuint32_t\tmd_version;\t/* Version number. */\n\tchar\t\tmd_name[16];\t/* Mirror name. */\n\tuint32_t\tmd_mid;\t\t/* Mirror unique ID. */\n\tuint32_t\tmd_did;\t\t/* Disk unique ID. */\n\tuint8_t\t\tmd_all;\t\t/* Number of disks in mirror. */\n\tuint32_t\tmd_genid;\t/* Generation ID. */\n\tuint32_t\tmd_syncid;\t/* Synchronization ID. */\n\tuint8_t\t\tmd_priority;\t/* Disk priority. */\n\tuint32_t\tmd_slice;\t/* Slice size. */\n\tuint8_t\t\tmd_balance;\t/* Balance type. */\n\tuint64_t\tmd_mediasize;\t/* Size of the smallest\n\t\t\t\t\t   disk in mirror. */\n\tuint32_t\tmd_sectorsize;\t/* Sector size. */\n\tuint64_t\tmd_sync_offset;\t/* Synchronized offset. */\n\tuint64_t\tmd_mflags;\t/* Additional mirror flags. */\n\tuint64_t\tmd_dflags;\t/* Additional disk flags. */\n\tchar\t\tmd_provider[16]; /* Hardcoded provider. */\n\tuint64_t\tmd_provsize;\t/* Provider's size. */\n\tu_char\t\tmd_hash[16];\t/* MD5 hash. */\n};\nstatic __inline void\nmirror_metadata_encode(struct g_mirror_metadata *md, u_char *data)\n{\n\tMD5_CTX ctx;\n\n\tbcopy(md->md_magic, data, 16);\n\tle32enc(data + 16, md->md_version);\n\tbcopy(md->md_name, data + 20, 16);\n\tle32enc(data + 36, md->md_mid);\n\tle32enc(data + 40, md->md_did);\n\t*(data + 44) = md->md_all;\n\tle32enc(data + 45, md->md_genid);\n\tle32enc(data + 49, md->md_syncid);\n\t*(data + 53) = md->md_priority;\n\tle32enc(data + 54, md->md_slice);\n\t*(data + 58) = md->md_balance;\n\tle64enc(data + 59, md->md_mediasize);\n\tle32enc(data + 67, md->md_sectorsize);\n\tle64enc(data + 71, md->md_sync_offset);\n\tle64enc(data + 79, md->md_mflags);\n\tle64enc(data + 87, md->md_dflags);\n\tbcopy(md->md_provider, data + 95, 16);\n\tle64enc(data + 111, md->md_provsize);\n\tMD5Init(&ctx);\n\tMD5Update(&ctx, data, 119);\n\tMD5Final(md->md_hash, &ctx);\n\tbcopy(md->md_hash, data + 119, 16);\n}\nstatic __inline int\nmirror_metadata_decode_v0v1(const u_char *data, struct g_mirror_metadata *md)\n{\n\tMD5_CTX ctx;\n\n\tbcopy(data + 20, md->md_name, 16);\n\tmd->md_mid = le32dec(data + 36);\n\tmd->md_did = le32dec(data + 40);\n\tmd->md_all = *(data + 44);\n\tmd->md_syncid = le32dec(data + 45);\n\tmd->md_priority = *(data + 49);\n\tmd->md_slice = le32dec(data + 50);\n\tmd->md_balance = *(data + 54);\n\tmd->md_mediasize = le64dec(data + 55);\n\tmd->md_sectorsize = le32dec(data + 63);\n\tmd->md_sync_offset = le64dec(data + 67);\n\tmd->md_mflags = le64dec(data + 75);\n\tmd->md_dflags = le64dec(data + 83);\n\tbcopy(data + 91, md->md_provider, 16);\n\tbcopy(data + 107, md->md_hash, 16);\n\tMD5Init(&ctx);\n\tMD5Update(&ctx, data, 107);\n\tMD5Final(md->md_hash, &ctx);\n\tif (bcmp(md->md_hash, data + 107, 16) != 0)\n\t\treturn (EINVAL);\n\n\t/* New fields. */\n\tmd->md_genid = 0;\n\tmd->md_provsize = 0;\n\n\treturn (0);\n}\nstatic __inline int\nmirror_metadata_decode_v2(const u_char *data, struct g_mirror_metadata *md)\n{\n\tMD5_CTX ctx;\n\n\tbcopy(data + 20, md->md_name, 16);\n\tmd->md_mid = le32dec(data + 36);\n\tmd->md_did = le32dec(data + 40);\n\tmd->md_all = *(data + 44);\n\tmd->md_genid = le32dec(data + 45);\n\tmd->md_syncid = le32dec(data + 49);\n\tmd->md_priority = *(data + 53);\n\tmd->md_slice = le32dec(data + 54);\n\tmd->md_balance = *(data + 58);\n\tmd->md_mediasize = le64dec(data + 59);\n\tmd->md_sectorsize = le32dec(data + 67);\n\tmd->md_sync_offset = le64dec(data + 71);\n\tmd->md_mflags = le64dec(data + 79);\n\tmd->md_dflags = le64dec(data + 87);\n\tbcopy(data + 95, md->md_provider, 16);\n\tbcopy(data + 111, md->md_hash, 16);\n\tMD5Init(&ctx);\n\tMD5Update(&ctx, data, 111);\n\tMD5Final(md->md_hash, &ctx);\n\tif (bcmp(md->md_hash, data + 111, 16) != 0)\n\t\treturn (EINVAL);\n\n\t/* New fields. */\n\tmd->md_provsize = 0;\n\n\treturn (0);\n}\nstatic __inline int\nmirror_metadata_decode_v3v4(const u_char *data, struct g_mirror_metadata *md)\n{\n\tMD5_CTX ctx;\n\n\tbcopy(data + 20, md->md_name, 16);\n\tmd->md_mid = le32dec(data + 36);\n\tmd->md_did = le32dec(data + 40);\n\tmd->md_all = *(data + 44);\n\tmd->md_genid = le32dec(data + 45);\n\tmd->md_syncid = le32dec(data + 49);\n\tmd->md_priority = *(data + 53);\n\tmd->md_slice = le32dec(data + 54);\n\tmd->md_balance = *(data + 58);\n\tmd->md_mediasize = le64dec(data + 59);\n\tmd->md_sectorsize = le32dec(data + 67);\n\tmd->md_sync_offset = le64dec(data + 71);\n\tmd->md_mflags = le64dec(data + 79);\n\tmd->md_dflags = le64dec(data + 87);\n\tbcopy(data + 95, md->md_provider, 16);\n\tmd->md_provsize = le64dec(data + 111);\n\tbcopy(data + 119, md->md_hash, 16);\n\tMD5Init(&ctx);\n\tMD5Update(&ctx, data, 119);\n\tMD5Final(md->md_hash, &ctx);\n\tif (bcmp(md->md_hash, data + 119, 16) != 0)\n\t\treturn (EINVAL);\n\treturn (0);\n}\nstatic __inline int\nmirror_metadata_decode(const u_char *data, struct g_mirror_metadata *md)\n{\n\tint error;\n\n\tbcopy(data, md->md_magic, 16);\n\tmd->md_version = le32dec(data + 16);\n\tswitch (md->md_version) {\n\tcase 0:\n\tcase 1:\n\t\terror = mirror_metadata_decode_v0v1(data, md);\n\t\tbreak;\n\tcase 2:\n\t\terror = mirror_metadata_decode_v2(data, md);\n\t\tbreak;\n\tcase 3:\n\tcase 4:\n\t\terror = mirror_metadata_decode_v3v4(data, md);\n\t\tbreak;\n\tdefault:\n\t\terror = EINVAL;\n\t\tbreak;\n\t}\n\treturn (error);\n}\n\nstatic __inline const char *\nbalance_name(u_int balance)\n{\n\tstatic const char *algorithms[] = {\n\t\t[G_MIRROR_BALANCE_NONE] = \"none\",\n\t\t[G_MIRROR_BALANCE_ROUND_ROBIN] = \"round-robin\",\n\t\t[G_MIRROR_BALANCE_LOAD] = \"load\",\n\t\t[G_MIRROR_BALANCE_SPLIT] = \"split\",\n\t\t[G_MIRROR_BALANCE_PREFER] = \"prefer\",\n\t\t[G_MIRROR_BALANCE_MAX + 1] = \"unknown\"\n\t};\n\n\tif (balance > G_MIRROR_BALANCE_MAX)\n\t\tbalance = G_MIRROR_BALANCE_MAX + 1;\n\n\treturn (algorithms[balance]);\n}\n\nstatic __inline int\nbalance_id(const char *name)\n{\n\tstatic const char *algorithms[] = {\n\t\t[G_MIRROR_BALANCE_NONE] = \"none\",\n\t\t[G_MIRROR_BALANCE_ROUND_ROBIN] = \"round-robin\",\n\t\t[G_MIRROR_BALANCE_LOAD] = \"load\",\n\t\t[G_MIRROR_BALANCE_SPLIT] = \"split\",\n\t\t[G_MIRROR_BALANCE_PREFER] = \"prefer\"\n\t};\n\tint n;\n\n\tfor (n = G_MIRROR_BALANCE_MIN; n <= G_MIRROR_BALANCE_MAX; n++) {\n\t\tif (strcmp(name, algorithms[n]) == 0)\n\t\t\treturn (n);\n\t}\n\treturn (-1);\n}\n\nstatic __inline void\nmirror_metadata_dump(const struct g_mirror_metadata *md)\n{\n\tstatic const char hex[] = \"0123456789abcdef\";\n\tchar hash[16 * 2 + 1];\n\tu_int i;\n\n\tprintf(\"     magic: %s\\n\", md->md_magic);\n\tprintf(\"   version: %u\\n\", (u_int)md->md_version);\n\tprintf(\"      name: %s\\n\", md->md_name);\n\tprintf(\"       mid: %u\\n\", (u_int)md->md_mid);\n\tprintf(\"       did: %u\\n\", (u_int)md->md_did);\n\tprintf(\"       all: %u\\n\", (u_int)md->md_all);\n\tprintf(\"     genid: %u\\n\", (u_int)md->md_genid);\n\tprintf(\"    syncid: %u\\n\", (u_int)md->md_syncid);\n\tprintf(\"  priority: %u\\n\", (u_int)md->md_priority);\n\tprintf(\"     slice: %u\\n\", (u_int)md->md_slice);\n\tprintf(\"   balance: %s\\n\", balance_name((u_int)md->md_balance));\n\tprintf(\" mediasize: %jd\\n\", (intmax_t)md->md_mediasize);\n\tprintf(\"sectorsize: %u\\n\", (u_int)md->md_sectorsize);\n\tprintf(\"syncoffset: %jd\\n\", (intmax_t)md->md_sync_offset);\n\tprintf(\"    mflags:\");\n\tif (md->md_mflags == 0)\n\t\tprintf(\" NONE\");\n\telse {\n\t\tif ((md->md_mflags & G_MIRROR_DEVICE_FLAG_NOFAILSYNC) != 0)\n\t\t\tprintf(\" NOFAILSYNC\");\n\t\tif ((md->md_mflags & G_MIRROR_DEVICE_FLAG_NOAUTOSYNC) != 0)\n\t\t\tprintf(\" NOAUTOSYNC\");\n\t}\n\tprintf(\"\\n\");\n\tprintf(\"    dflags:\");\n\tif (md->md_dflags == 0)\n\t\tprintf(\" NONE\");\n\telse {\n\t\tif ((md->md_dflags & G_MIRROR_DISK_FLAG_DIRTY) != 0)\n\t\t\tprintf(\" DIRTY\");\n\t\tif ((md->md_dflags & G_MIRROR_DISK_FLAG_SYNCHRONIZING) != 0)\n\t\t\tprintf(\" SYNCHRONIZING\");\n\t\tif ((md->md_dflags & G_MIRROR_DISK_FLAG_FORCE_SYNC) != 0)\n\t\t\tprintf(\" FORCE_SYNC\");\n\t\tif ((md->md_dflags & G_MIRROR_DISK_FLAG_INACTIVE) != 0)\n\t\t\tprintf(\" INACTIVE\");\n\t}\n\tprintf(\"\\n\");\n\tprintf(\"hcprovider: %s\\n\", md->md_provider);\n\tprintf(\"  provsize: %ju\\n\", (uintmax_t)md->md_provsize);\n\tbzero(hash, sizeof(hash));\n\tfor (i = 0; i < 16; i++) {\n\t\thash[i * 2] = hex[md->md_hash[i] >> 4];\n\t\thash[i * 2 + 1] = hex[md->md_hash[i] & 0x0f];\n\t}\n\tprintf(\"  MD5 hash: %s\\n\", hash);\n}\n#endif\t/* !_G_MIRROR_H_ */\n"
  },
  {
    "path": "freebsd-headers/geom/mountver/g_mountver.h",
    "content": "/*-\n * Copyright (c) 2010 Edward Tomasz Napierala <trasz@FreeBSD.org>\n * Copyright (c) 2004-2006 Pawel Jakub Dawidek <pjd@FreeBSD.org>\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/geom/mountver/g_mountver.h 202437 2010-01-16 09:52:49Z trasz $\n */\n\n#ifndef\t_G_MOUNTVER_H_\n#define\t_G_MOUNTVER_H_\n\n#define\tG_MOUNTVER_CLASS_NAME\t\"MOUNTVER\"\n#define\tG_MOUNTVER_VERSION\t4\n#define\tG_MOUNTVER_SUFFIX\t\".mountver\"\n\n#ifdef _KERNEL\n\n#define\tG_MOUNTVER_DEBUG(lvl, ...)\tdo {\t\t\t\t\\\n\tif (g_mountver_debug >= (lvl)) {\t\t\t\t\\\n\t\tprintf(\"GEOM_MOUNTVER\");\t\t\t\t\\\n\t\tif (g_mountver_debug > 0)\t\t\t\t\\\n\t\t\tprintf(\"[%u]\", lvl);\t\t\t\t\\\n\t\tprintf(\": \");\t\t\t\t\t\t\\\n\t\tprintf(__VA_ARGS__);\t\t\t\t\t\\\n\t\tprintf(\"\\n\");\t\t\t\t\t\t\\\n\t}\t\t\t\t\t\t\t\t\\\n} while (0)\n#define\tG_MOUNTVER_LOGREQ(bp, ...)\tdo {\t\t\t\t\\\n\tif (g_mountver_debug >= 2) {\t\t\t\t\t\\\n\t\tprintf(\"GEOM_MOUNTVER[2]: \");\t\t\t\t\\\n\t\tprintf(__VA_ARGS__);\t\t\t\t\t\\\n\t\tprintf(\" \");\t\t\t\t\t\t\\\n\t\tg_print_bio(bp);\t\t\t\t\t\\\n\t\tprintf(\"\\n\");\t\t\t\t\t\t\\\n\t}\t\t\t\t\t\t\t\t\\\n} while (0)\n\nstruct g_mountver_softc {\n\tTAILQ_HEAD(, bio)\t\tsc_queue;\n\tstruct mtx\t\t\tsc_mtx;\n\tchar\t\t\t\t*sc_provider_name;\n\tchar\t\t\t\tsc_ident[DISK_IDENT_SIZE];\n\tint\t\t\t\tsc_orphaned;\n\tint\t\t\t\tsc_access_r;\n\tint\t\t\t\tsc_access_w;\n\tint\t\t\t\tsc_access_e;\n};\n#endif\t/* _KERNEL */\n\n#endif\t/* _G_MOUNTVER_H_ */\n"
  },
  {
    "path": "freebsd-headers/geom/multipath/g_multipath.h",
    "content": "/*-\n * Copyright (c) 2006-2007 Matthew Jacob <mjacob@FreeBSD.org>\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/geom/multipath/g_multipath.h 167050 2007-02-27 04:01:58Z mjacob $\n */\n/*\n * Based upon work by Pawel Jakub Dawidek <pjd@FreeBSD.org> for all of the\n * fine geom examples, and by Poul Henning Kamp <phk@FreeBSD.org> for GEOM\n * itself, all of which is most gratefully acknowledged.\n */\n\n#ifndef\t_G_MULTIPATH_H_\n#define\t_G_MULTIPATH_H_\n\n#define\tG_MULTIPATH_CLASS_NAME\t\"MULTIPATH\"\n#define\tG_MULTIPATH_VERSION\t1\n#define\tG_MULTIPATH_MAGIC\t\"GEOM::MULTIPATH\"\n\n#include <sys/endian.h>\n\n#ifdef\t_KERNEL\n\nstruct g_multipath_softc {\n\tstruct g_provider *\tpp;\n\tstruct g_consumer *\tcp_active;\n\tchar\t\t\tsc_name[16];\n\tchar\t\t\tsc_uuid[40];\n};\n#endif\t/* _KERNEL */\n\nstruct g_multipath_metadata {\n\tchar\t\tmd_magic[16];\t/* Magic Value */\n\tchar \t\tmd_uuid[40];\t/* more magic */\n\tchar\t\tmd_name[16];\t/* a friendly name */\n\tuint32_t\tmd_version;\t/* version */\n\tuint32_t\tmd_sectorsize;\t/* sectorsize of provider */\n\tuint64_t\tmd_size;\t/* absolute size of provider */\n};\n\nstatic __inline void\nmultipath_metadata_encode(const struct g_multipath_metadata *, u_char *);\n\nstatic __inline void\nmultipath_metadata_decode(u_char *, struct g_multipath_metadata *);\n\nstatic __inline void\nmultipath_metadata_encode(const struct g_multipath_metadata *md, u_char *data)\n{\n\tbcopy(md->md_magic, data, sizeof(md->md_magic));\n\tdata += sizeof(md->md_magic);\n\tbcopy(md->md_uuid, data, sizeof(md->md_uuid));\n\tdata += sizeof(md->md_uuid);\n\tbcopy(md->md_name, data, sizeof(md->md_name));\n\tdata += sizeof(md->md_name);\n\tle32enc(data, md->md_version);\n\tdata += sizeof(md->md_version);\n\tle32enc(data, md->md_sectorsize);\n\tdata += sizeof(md->md_sectorsize);\n\tle64enc(data, md->md_size);\n}\n\nstatic __inline void\nmultipath_metadata_decode(u_char *data, struct g_multipath_metadata *md)\n{\n\tbcopy(data, md->md_magic, sizeof(md->md_magic));\n\tdata += sizeof(md->md_magic);\n\tbcopy(data, md->md_uuid, sizeof(md->md_uuid));\n\tdata += sizeof(md->md_uuid);\n\tbcopy(data, md->md_name, sizeof(md->md_name));\n\tdata += sizeof(md->md_name);\n\tmd->md_version = le32dec(data);\n\tdata += sizeof(md->md_version);\n\tmd->md_sectorsize = le32dec(data);\n\tdata += sizeof(md->md_sectorsize);\n\tmd->md_size = le64dec(data);\n}\n#endif\t/* _G_MULTIPATH_H_ */\n"
  },
  {
    "path": "freebsd-headers/geom/nop/g_nop.h",
    "content": "/*-\n * Copyright (c) 2004-2006 Pawel Jakub Dawidek <pjd@FreeBSD.org>\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/geom/nop/g_nop.h 162834 2006-09-30 08:16:49Z pjd $\n */\n\n#ifndef\t_G_NOP_H_\n#define\t_G_NOP_H_\n\n#define\tG_NOP_CLASS_NAME\t\"NOP\"\n#define\tG_NOP_VERSION\t\t4\n#define\tG_NOP_SUFFIX\t\t\".nop\"\n\n#ifdef _KERNEL\n#define\tG_NOP_DEBUG(lvl, ...)\tdo {\t\t\t\t\t\\\n\tif (g_nop_debug >= (lvl)) {\t\t\t\t\t\\\n\t\tprintf(\"GEOM_NOP\");\t\t\t\t\t\\\n\t\tif (g_nop_debug > 0)\t\t\t\t\t\\\n\t\t\tprintf(\"[%u]\", lvl);\t\t\t\t\\\n\t\tprintf(\": \");\t\t\t\t\t\t\\\n\t\tprintf(__VA_ARGS__);\t\t\t\t\t\\\n\t\tprintf(\"\\n\");\t\t\t\t\t\t\\\n\t}\t\t\t\t\t\t\t\t\\\n} while (0)\n#define\tG_NOP_LOGREQ(bp, ...)\tdo {\t\t\t\t\t\\\n\tif (g_nop_debug >= 2) {\t\t\t\t\t\t\\\n\t\tprintf(\"GEOM_NOP[2]: \");\t\t\t\t\\\n\t\tprintf(__VA_ARGS__);\t\t\t\t\t\\\n\t\tprintf(\" \");\t\t\t\t\t\t\\\n\t\tg_print_bio(bp);\t\t\t\t\t\\\n\t\tprintf(\"\\n\");\t\t\t\t\t\t\\\n\t}\t\t\t\t\t\t\t\t\\\n} while (0)\n\nstruct g_nop_softc {\n\tint\t\tsc_error;\n\toff_t\t\tsc_offset;\n\tu_int\t\tsc_rfailprob;\n\tu_int\t\tsc_wfailprob;\n\tuintmax_t\tsc_reads;\n\tuintmax_t\tsc_writes;\n\tuintmax_t\tsc_readbytes;\n\tuintmax_t\tsc_wrotebytes;\n};\n#endif\t/* _KERNEL */\n\n#endif\t/* _G_NOP_H_ */\n"
  },
  {
    "path": "freebsd-headers/geom/raid/g_raid.h",
    "content": "/*-\n * Copyright (c) 2010 Alexander Motin <mav@FreeBSD.org>\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/geom/raid/g_raid.h 219974 2011-03-24 21:31:32Z mav $\n */\n\n#ifndef\t_G_RAID_H_\n#define\t_G_RAID_H_\n\n#include <sys/param.h>\n#include <sys/kobj.h>\n#include <sys/bio.h>\n#include <sys/time.h>\n\n#define\tG_RAID_CLASS_NAME\t\"RAID\"\n\n#define\tG_RAID_MAGIC\t\t\"GEOM::RAID\"\n\n#define\tG_RAID_VERSION\t\t0\n\nstruct g_raid_md_object;\nstruct g_raid_tr_object;\n\n#define\tG_RAID_DEVICE_FLAG_NOAUTOSYNC\t0x0000000000000001ULL\n#define\tG_RAID_DEVICE_FLAG_NOFAILSYNC\t0x0000000000000002ULL\n#define\tG_RAID_DEVICE_FLAG_MASK\t(G_RAID_DEVICE_FLAG_NOAUTOSYNC | \\\n\t\t\t\t\t G_RAID_DEVICE_FLAG_NOFAILSYNC)\n\n#ifdef _KERNEL\nextern u_int g_raid_aggressive_spare;\nextern u_int g_raid_debug;\nextern int g_raid_read_err_thresh;\nextern u_int g_raid_start_timeout;\nextern struct g_class g_raid_class;\n\n#define\tG_RAID_DEBUG(lvl, fmt, ...)\tdo {\t\t\t\t\\\n\tif (g_raid_debug >= (lvl)) {\t\t\t\t\t\\\n\t\tif (g_raid_debug > 0) {\t\t\t\t\t\\\n\t\t\tprintf(\"GEOM_RAID[%u]: \" fmt \"\\n\",\t\t\\\n\t\t\t    lvl, ## __VA_ARGS__);\t\t\t\\\n\t\t} else {\t\t\t\t\t\t\\\n\t\t\tprintf(\"GEOM_RAID: \" fmt \"\\n\",\t\t\t\\\n\t\t\t    ## __VA_ARGS__);\t\t\t\t\\\n\t\t}\t\t\t\t\t\t\t\\\n\t}\t\t\t\t\t\t\t\t\\\n} while (0)\n#define\tG_RAID_DEBUG1(lvl, sc, fmt, ...)\tdo {\t\t\t\\\n\tif (g_raid_debug >= (lvl)) {\t\t\t\t\t\\\n\t\tif (g_raid_debug > 0) {\t\t\t\t\t\\\n\t\t\tprintf(\"GEOM_RAID[%u]: %s: \" fmt \"\\n\",\t\t\\\n\t\t\t    lvl, (sc)->sc_name, ## __VA_ARGS__);\t\\\n\t\t} else {\t\t\t\t\t\t\\\n\t\t\tprintf(\"GEOM_RAID: %s: \" fmt \"\\n\",\t\t\\\n\t\t\t    (sc)->sc_name, ## __VA_ARGS__);\t\t\\\n\t\t}\t\t\t\t\t\t\t\\\n\t}\t\t\t\t\t\t\t\t\\\n} while (0)\n#define\tG_RAID_LOGREQ(lvl, bp, fmt, ...)\tdo {\t\t\t\\\n\tif (g_raid_debug >= (lvl)) {\t\t\t\t\t\\\n\t\tif (g_raid_debug > 0) {\t\t\t\t\t\\\n\t\t\tprintf(\"GEOM_RAID[%u]: \" fmt \" \",\t\t\\\n\t\t\t    lvl, ## __VA_ARGS__);\t\t\t\\\n\t\t} else\t\t\t\t\t\t\t\\\n\t\t\tprintf(\"GEOM_RAID: \" fmt \" \", ## __VA_ARGS__);\t\\\n\t\tg_print_bio(bp);\t\t\t\t\t\\\n\t\tprintf(\"\\n\");\t\t\t\t\t\t\\\n\t}\t\t\t\t\t\t\t\t\\\n} while (0)\n\n/*\n * Flags we use to distinguish I/O initiated by the TR layer to maintain\n * the volume's characteristics, fix subdisks, extra copies of data, etc.\n *\n * G_RAID_BIO_FLAG_SYNC\t\tI/O to update an extra copy of the data\n *\t\t\t\tfor RAID volumes that maintain extra data\n *\t\t\t\tand need to rebuild that data.\n * G_RAID_BIO_FLAG_REMAP\tI/O done to try to provoke a subdisk into\n *\t\t\t\tdoing some desirable action such as bad\n *\t\t\t\tblock remapping after we detect a bad part\n *\t\t\t\tof the disk.\n * G_RAID_BIO_FLAG_LOCKED\tI/O holds range lock that should re released.\n *\n * and the following meta item:\n * G_RAID_BIO_FLAG_SPECIAL\tAnd of the I/O flags that need to make it\n *\t\t\t\tthrough the range locking which would\n *\t\t\t\totherwise defer the I/O until after that\n *\t\t\t\trange is unlocked.\n */\n#define\tG_RAID_BIO_FLAG_SYNC\t\t0x01\n#define\tG_RAID_BIO_FLAG_REMAP\t\t0x02\n#define\tG_RAID_BIO_FLAG_SPECIAL \\\n\t\t(G_RAID_BIO_FLAG_SYNC|G_RAID_BIO_FLAG_REMAP)\n#define\tG_RAID_BIO_FLAG_LOCKED\t\t0x80\n\nstruct g_raid_lock {\n\toff_t\t\t\t l_offset;\n\toff_t\t\t\t l_length;\n\tvoid\t\t\t*l_callback_arg;\n\tint\t\t\t l_pending;\n\tLIST_ENTRY(g_raid_lock)\t l_next;\n};\n\n#define\tG_RAID_EVENT_WAIT\t0x01\n#define\tG_RAID_EVENT_VOLUME\t0x02\n#define\tG_RAID_EVENT_SUBDISK\t0x04\n#define\tG_RAID_EVENT_DISK\t0x08\n#define\tG_RAID_EVENT_DONE\t0x10\nstruct g_raid_event {\n\tvoid\t\t\t*e_tgt;\n\tint\t\t\t e_event;\n\tint\t\t\t e_flags;\n\tint\t\t\t e_error;\n\tTAILQ_ENTRY(g_raid_event) e_next;\n};\n#define G_RAID_DISK_S_NONE\t\t0x00\t/* State is unknown. */\n#define G_RAID_DISK_S_OFFLINE\t\t0x01\t/* Missing disk placeholder. */\n#define G_RAID_DISK_S_FAILED\t\t0x02\t/* Failed. */\n#define G_RAID_DISK_S_STALE_FAILED\t0x03\t/* Old failed. */\n#define G_RAID_DISK_S_SPARE\t\t0x04\t/* Hot-spare. */\n#define G_RAID_DISK_S_STALE\t\t0x05\t/* Old disk, unused now. */\n#define G_RAID_DISK_S_ACTIVE\t\t0x06\t/* Operational. */\n\n#define G_RAID_DISK_E_DISCONNECTED\t0x01\n\nstruct g_raid_disk {\n\tstruct g_raid_softc\t*d_softc;\t/* Back-pointer to softc. */\n\tstruct g_consumer\t*d_consumer;\t/* GEOM disk consumer. */\n\tvoid\t\t\t*d_md_data;\t/* Disk's metadata storage. */\n\tstruct g_kerneldump\t d_kd;\t\t/* Kernel dumping method/args. */\n\tuint64_t\t\t d_flags;\t/* Additional flags. */\n\tu_int\t\t\t d_state;\t/* Disk state. */\n\tu_int\t\t\t d_load;\t/* Disk average load. */\n\toff_t\t\t\t d_last_offset;\t/* Last head offset. */\n\tint\t\t\t d_read_errs;\t/* Count of the read errors */\n\tTAILQ_HEAD(, g_raid_subdisk)\t d_subdisks; /* List of subdisks. */\n\tTAILQ_ENTRY(g_raid_disk)\t d_next;\t/* Next disk in the node. */\n};\n\n#define G_RAID_SUBDISK_S_NONE\t\t0x00\t/* Absent. */\n#define G_RAID_SUBDISK_S_FAILED\t\t0x01\t/* Failed. */\n#define G_RAID_SUBDISK_S_NEW\t\t0x02\t/* Blank. */\n#define G_RAID_SUBDISK_S_REBUILD\t0x03\t/* Blank + rebuild. */\n#define G_RAID_SUBDISK_S_UNINITIALIZED\t0x04\t/* Disk of the new volume. */\n#define G_RAID_SUBDISK_S_STALE\t\t0x05\t/* Dirty. */\n#define G_RAID_SUBDISK_S_RESYNC\t\t0x06\t/* Dirty + check/repair. */\n#define G_RAID_SUBDISK_S_ACTIVE\t\t0x07\t/* Usable. */\n\n#define G_RAID_SUBDISK_E_NEW\t\t0x01\t/* A new subdisk has arrived */\n#define G_RAID_SUBDISK_E_FAILED\t\t0x02\t/* A subdisk failed, but remains in volume */\n#define G_RAID_SUBDISK_E_DISCONNECTED\t0x03\t/* A subdisk removed from volume. */\n#define G_RAID_SUBDISK_E_FIRST_TR_PRIVATE 0x80\t/* translation private events */\n\n#define G_RAID_SUBDISK_POS(sd)\t\t\t\t\t\t\\\n    ((sd)->sd_disk ? ((sd)->sd_disk->d_last_offset - (sd)->sd_offset) : 0)\n#define G_RAID_SUBDISK_TRACK_SIZE\t(1 * 1024 * 1024)\n#define G_RAID_SUBDISK_LOAD(sd)\t\t\t\t\t\t\\\n    ((sd)->sd_disk ? ((sd)->sd_disk->d_load) : 0)\n#define G_RAID_SUBDISK_LOAD_SCALE\t256\n\nstruct g_raid_subdisk {\n\tstruct g_raid_softc\t*sd_softc;\t/* Back-pointer to softc. */\n\tstruct g_raid_disk\t*sd_disk;\t/* Where this subdisk lives. */\n\tstruct g_raid_volume\t*sd_volume;\t/* Volume, sd is a part of. */\n\toff_t\t\t\t sd_offset;\t/* Offset on the disk. */\n\toff_t\t\t\t sd_size;\t/* Size on the disk. */\n\tu_int\t\t\t sd_pos;\t/* Position in volume. */\n\tu_int\t\t\t sd_state;\t/* Subdisk state. */\n\toff_t\t\t\t sd_rebuild_pos; /* Rebuild position. */\n\tint\t\t\t sd_recovery;\t/* Count of recovery reqs. */\n\tTAILQ_ENTRY(g_raid_subdisk)\t sd_next; /* Next subdisk on disk. */\n};\n\n#define G_RAID_MAX_SUBDISKS\t16\n#define G_RAID_MAX_VOLUMENAME\t32\n\n#define G_RAID_VOLUME_S_STARTING\t0x00\n#define G_RAID_VOLUME_S_BROKEN\t\t0x01\n#define G_RAID_VOLUME_S_DEGRADED\t0x02\n#define G_RAID_VOLUME_S_SUBOPTIMAL\t0x03\n#define G_RAID_VOLUME_S_OPTIMAL\t\t0x04\n#define G_RAID_VOLUME_S_UNSUPPORTED\t0x05\n#define G_RAID_VOLUME_S_STOPPED\t\t0x06\n\n#define G_RAID_VOLUME_S_ALIVE(s)\t\t\t\\\n    ((s) == G_RAID_VOLUME_S_DEGRADED ||\t\t\t\\\n     (s) == G_RAID_VOLUME_S_SUBOPTIMAL ||\t\t\\\n     (s) == G_RAID_VOLUME_S_OPTIMAL)\n\n#define G_RAID_VOLUME_E_DOWN\t\t0x00\n#define G_RAID_VOLUME_E_UP\t\t0x01\n#define G_RAID_VOLUME_E_START\t\t0x10\n#define G_RAID_VOLUME_E_STARTMD\t\t0x11\n\n#define G_RAID_VOLUME_RL_RAID0\t\t0x00\n#define G_RAID_VOLUME_RL_RAID1\t\t0x01\n#define G_RAID_VOLUME_RL_RAID3\t\t0x03\n#define G_RAID_VOLUME_RL_RAID4\t\t0x04\n#define G_RAID_VOLUME_RL_RAID5\t\t0x05\n#define G_RAID_VOLUME_RL_RAID6\t\t0x06\n#define G_RAID_VOLUME_RL_RAID1E\t\t0x11\n#define G_RAID_VOLUME_RL_SINGLE\t\t0x0f\n#define G_RAID_VOLUME_RL_CONCAT\t\t0x1f\n#define G_RAID_VOLUME_RL_RAID5E\t\t0x15\n#define G_RAID_VOLUME_RL_RAID5EE\t0x25\n#define G_RAID_VOLUME_RL_UNKNOWN\t0xff\n\n#define G_RAID_VOLUME_RLQ_NONE\t\t0x00\n#define G_RAID_VOLUME_RLQ_UNKNOWN\t0xff\n\nstruct g_raid_volume;\n\nstruct g_raid_volume {\n\tstruct g_raid_softc\t*v_softc;\t/* Back-pointer to softc. */\n\tstruct g_provider\t*v_provider;\t/* GEOM provider. */\n\tstruct g_raid_subdisk\t v_subdisks[G_RAID_MAX_SUBDISKS];\n\t\t\t\t\t\t/* Subdisks of this volume. */\n\tvoid\t\t\t*v_md_data;\t/* Volume's metadata storage. */\n\tstruct g_raid_tr_object\t*v_tr;\t\t/* Transformation object. */\n\tchar\t\t\t v_name[G_RAID_MAX_VOLUMENAME];\n\t\t\t\t\t\t/* Volume name. */\n\tu_int\t\t\t v_state;\t/* Volume state. */\n\tu_int\t\t\t v_raid_level;\t/* Array RAID level. */\n\tu_int\t\t\t v_raid_level_qualifier; /* RAID level det. */\n\tu_int\t\t\t v_disks_count;\t/* Number of disks in array. */\n\tu_int\t\t\t v_strip_size;\t/* Array strip size. */\n\tu_int\t\t\t v_sectorsize;\t/* Volume sector size. */\n\toff_t\t\t\t v_mediasize;\t/* Volume media size.  */\n\tstruct bio_queue_head\t v_inflight;\t/* In-flight write requests. */\n\tstruct bio_queue_head\t v_locked;\t/* Blocked I/O requests. */\n\tLIST_HEAD(, g_raid_lock) v_locks;\t /* List of locked regions. */\n\tint\t\t\t v_pending_lock; /* writes to locked region */\n\tint\t\t\t v_dirty;\t/* Volume is DIRTY. */\n\tstruct timeval\t\t v_last_done;\t/* Time of the last I/O. */\n\ttime_t\t\t\t v_last_write;\t/* Time of the last write. */\n\tu_int\t\t\t v_writes;\t/* Number of active writes. */\n\tstruct root_hold_token\t*v_rootmount;\t/* Root mount delay token. */\n\tint\t\t\t v_starting;\t/* Volume is starting */\n\tint\t\t\t v_stopping;\t/* Volume is stopping */\n\tint\t\t\t v_provider_open; /* Number of opens. */\n\tint\t\t\t v_global_id;\t/* Global volume ID (rX). */\n\tTAILQ_ENTRY(g_raid_volume)\t v_next; /* List of volumes entry. */\n\tLIST_ENTRY(g_raid_volume)\t v_global_next; /* Global list entry. */\n};\n\n#define G_RAID_NODE_E_WAKE\t0x00\n#define G_RAID_NODE_E_START\t0x01\n\nstruct g_raid_softc {\n\tstruct g_raid_md_object\t*sc_md;\t\t/* Metadata object. */\n\tstruct g_geom\t\t*sc_geom;\t/* GEOM class instance. */\n\tuint64_t\t\t sc_flags;\t/* Additional flags. */\n\tTAILQ_HEAD(, g_raid_volume)\t sc_volumes;\t/* List of volumes. */\n\tTAILQ_HEAD(, g_raid_disk)\t sc_disks;\t/* List of disks. */\n\tstruct sx\t\t sc_lock;\t/* Main node lock. */\n\tstruct proc\t\t*sc_worker;\t/* Worker process. */\n\tstruct mtx\t\t sc_queue_mtx;\t/* Worker queues lock. */\n\tTAILQ_HEAD(, g_raid_event) sc_events;\t/* Worker events queue. */\n\tstruct bio_queue_head\t sc_queue;\t/* Worker I/O queue. */\n\tint\t\t\t sc_stopping;\t/* Node is stopping */\n};\n#define\tsc_name\tsc_geom->name\n\n/*\n * KOBJ parent class of metadata processing modules.\n */\nstruct g_raid_md_class {\n\tKOBJ_CLASS_FIELDS;\n\tint\t\t mdc_priority;\n\tLIST_ENTRY(g_raid_md_class) mdc_list;\n};\n\n/*\n * KOBJ instance of metadata processing module.\n */\nstruct g_raid_md_object {\n\tKOBJ_FIELDS;\n\tstruct g_raid_md_class\t*mdo_class;\n\tstruct g_raid_softc\t*mdo_softc;\t/* Back-pointer to softc. */\n};\n\nint g_raid_md_modevent(module_t, int, void *);\n\n#define\tG_RAID_MD_DECLARE(name)\t\t\t\t\t\\\n    static moduledata_t name##_mod = {\t\t\t\t\\\n\t#name,\t\t\t\t\t\t\t\\\n\tg_raid_md_modevent,\t\t\t\t\t\\\n\t&name##_class\t\t\t\t\t\t\\\n    };\t\t\t\t\t\t\t\t\\\n    DECLARE_MODULE(name, name##_mod, SI_SUB_DRIVERS, SI_ORDER_SECOND);\t\\\n    MODULE_DEPEND(name, geom_raid, 0, 0, 0)\n\n/*\n * KOBJ parent class of data transformation modules.\n */\nstruct g_raid_tr_class {\n\tKOBJ_CLASS_FIELDS;\n\tint\t\t trc_priority;\n\tLIST_ENTRY(g_raid_tr_class) trc_list;\n};\n\n/*\n * KOBJ instance of data transformation module.\n */\nstruct g_raid_tr_object {\n\tKOBJ_FIELDS;\n\tstruct g_raid_tr_class\t*tro_class;\n\tstruct g_raid_volume \t*tro_volume;\t/* Back-pointer to volume. */\n};\n\nint g_raid_tr_modevent(module_t, int, void *);\n\n#define\tG_RAID_TR_DECLARE(name)\t\t\t\t\t\\\n    static moduledata_t name##_mod = {\t\t\t\t\\\n\t#name,\t\t\t\t\t\t\t\\\n\tg_raid_tr_modevent,\t\t\t\t\t\\\n\t&name##_class\t\t\t\t\t\t\\\n    };\t\t\t\t\t\t\t\t\\\n    DECLARE_MODULE(name, name##_mod, SI_SUB_DRIVERS, SI_ORDER_FIRST);\t\\\n    MODULE_DEPEND(name, geom_raid, 0, 0, 0)\n\nconst char * g_raid_volume_level2str(int level, int qual);\nint g_raid_volume_str2level(const char *str, int *level, int *qual);\nconst char * g_raid_volume_state2str(int state);\nconst char * g_raid_subdisk_state2str(int state);\nconst char * g_raid_disk_state2str(int state);\n\nstruct g_raid_softc * g_raid_create_node(struct g_class *mp,\n    const char *name, struct g_raid_md_object *md);\nint g_raid_create_node_format(const char *format, struct g_geom **gp);\nstruct g_raid_volume * g_raid_create_volume(struct g_raid_softc *sc,\n    const char *name, int id);\nstruct g_raid_disk * g_raid_create_disk(struct g_raid_softc *sc);\nconst char * g_raid_get_diskname(struct g_raid_disk *disk);\n\nint g_raid_start_volume(struct g_raid_volume *vol);\n\nint g_raid_destroy_node(struct g_raid_softc *sc, int worker);\nint g_raid_destroy_volume(struct g_raid_volume *vol);\nint g_raid_destroy_disk(struct g_raid_disk *disk);\n\nvoid g_raid_iodone(struct bio *bp, int error);\nvoid g_raid_subdisk_iostart(struct g_raid_subdisk *sd, struct bio *bp);\nint g_raid_subdisk_kerneldump(struct g_raid_subdisk *sd,\n    void *virtual, vm_offset_t physical, off_t offset, size_t length);\n\nstruct g_consumer *g_raid_open_consumer(struct g_raid_softc *sc,\n    const char *name);\nvoid g_raid_kill_consumer(struct g_raid_softc *sc, struct g_consumer *cp);\n\nvoid g_raid_report_disk_state(struct g_raid_disk *disk);\nvoid g_raid_change_disk_state(struct g_raid_disk *disk, int state);\nvoid g_raid_change_subdisk_state(struct g_raid_subdisk *sd, int state);\nvoid g_raid_change_volume_state(struct g_raid_volume *vol, int state);\n\nvoid g_raid_write_metadata(struct g_raid_softc *sc, struct g_raid_volume *vol,\n    struct g_raid_subdisk *sd, struct g_raid_disk *disk);\nvoid g_raid_fail_disk(struct g_raid_softc *sc,\n    struct g_raid_subdisk *sd, struct g_raid_disk *disk);\n\nvoid g_raid_tr_flush_common(struct g_raid_tr_object *tr, struct bio *bp);\nint g_raid_tr_kerneldump_common(struct g_raid_tr_object *tr,\n    void *virtual, vm_offset_t physical, off_t offset, size_t length);\n\nu_int g_raid_ndisks(struct g_raid_softc *sc, int state);\nu_int g_raid_nsubdisks(struct g_raid_volume *vol, int state);\nu_int g_raid_nopens(struct g_raid_softc *sc);\nstruct g_raid_subdisk * g_raid_get_subdisk(struct g_raid_volume *vol,\n    int state);\n#define\tG_RAID_DESTROY_SOFT\t\t0\n#define\tG_RAID_DESTROY_DELAYED\t1\n#define\tG_RAID_DESTROY_HARD\t\t2\nint g_raid_destroy(struct g_raid_softc *sc, int how);\nint g_raid_event_send(void *arg, int event, int flags);\nint g_raid_lock_range(struct g_raid_volume *vol, off_t off, off_t len,\n    struct bio *ignore, void *argp);\nint g_raid_unlock_range(struct g_raid_volume *vol, off_t off, off_t len);\n\ng_ctl_req_t g_raid_ctl;\n#endif\t/* _KERNEL */\n\n#endif\t/* !_G_RAID_H_ */\n"
  },
  {
    "path": "freebsd-headers/geom/raid3/g_raid3.h",
    "content": "/*-\n * Copyright (c) 2004-2006 Pawel Jakub Dawidek <pjd@FreeBSD.org>\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/geom/raid3/g_raid3.h 200821 2009-12-21 23:31:03Z mav $\n */\n\n#ifndef\t_G_RAID3_H_\n#define\t_G_RAID3_H_\n\n#include <sys/endian.h>\n#include <sys/md5.h>\n\n#define\tG_RAID3_CLASS_NAME\t\"RAID3\"\n\n#define\tG_RAID3_MAGIC\t\t\"GEOM::RAID3\"\n/*\n * Version history:\n * 0 - Initial version number.\n * 1 - Added 'round-robin reading' algorithm.\n * 2 - Added 'verify reading' algorithm.\n * 3 - Added md_genid field to metadata.\n * 4 - Added md_provsize field to metadata.\n * 5 - Added 'no failure synchronization' flag.\n */\n#define\tG_RAID3_VERSION\t\t5\n\n#define\tG_RAID3_DISK_FLAG_DIRTY\t\t0x0000000000000001ULL\n#define\tG_RAID3_DISK_FLAG_SYNCHRONIZING\t0x0000000000000002ULL\n#define\tG_RAID3_DISK_FLAG_FORCE_SYNC\t0x0000000000000004ULL\n#define\tG_RAID3_DISK_FLAG_HARDCODED\t0x0000000000000008ULL\n#define\tG_RAID3_DISK_FLAG_BROKEN\t0x0000000000000010ULL\n#define\tG_RAID3_DISK_FLAG_MASK\t\t(G_RAID3_DISK_FLAG_DIRTY |\t\\\n\t\t\t\t\t G_RAID3_DISK_FLAG_SYNCHRONIZING | \\\n\t\t\t\t\t G_RAID3_DISK_FLAG_FORCE_SYNC)\n\n#define\tG_RAID3_DEVICE_FLAG_NOAUTOSYNC\t0x0000000000000001ULL\n#define\tG_RAID3_DEVICE_FLAG_ROUND_ROBIN\t0x0000000000000002ULL\n#define\tG_RAID3_DEVICE_FLAG_VERIFY\t0x0000000000000004ULL\n#define\tG_RAID3_DEVICE_FLAG_NOFAILSYNC\t0x0000000000000008ULL\n#define\tG_RAID3_DEVICE_FLAG_MASK\t(G_RAID3_DEVICE_FLAG_NOAUTOSYNC | \\\n\t\t\t\t\t G_RAID3_DEVICE_FLAG_ROUND_ROBIN | \\\n\t\t\t\t\t G_RAID3_DEVICE_FLAG_VERIFY | \\\n\t\t\t\t\t G_RAID3_DEVICE_FLAG_NOFAILSYNC)\n\n#ifdef _KERNEL\nextern u_int g_raid3_debug;\n\n#define\tG_RAID3_DEBUG(lvl, ...)\tdo {\t\t\t\t\t\\\n\tif (g_raid3_debug >= (lvl)) {\t\t\t\t\t\\\n\t\tprintf(\"GEOM_RAID3\");\t\t\t\t\t\\\n\t\tif (g_raid3_debug > 0)\t\t\t\t\t\\\n\t\t\tprintf(\"[%u]\", lvl);\t\t\t\t\\\n\t\tprintf(\": \");\t\t\t\t\t\t\\\n\t\tprintf(__VA_ARGS__);\t\t\t\t\t\\\n\t\tprintf(\"\\n\");\t\t\t\t\t\t\\\n\t}\t\t\t\t\t\t\t\t\\\n} while (0)\n#define\tG_RAID3_LOGREQ(lvl, bp, ...)\tdo {\t\t\t\t\\\n\tif (g_raid3_debug >= (lvl)) {\t\t\t\t\t\\\n\t\tprintf(\"GEOM_RAID3\");\t\t\t\t\t\\\n\t\tif (g_raid3_debug > 0)\t\t\t\t\t\\\n\t\t\tprintf(\"[%u]\", lvl);\t\t\t\t\\\n\t\tprintf(\": \");\t\t\t\t\t\t\\\n\t\tprintf(__VA_ARGS__);\t\t\t\t\t\\\n\t\tprintf(\" \");\t\t\t\t\t\t\\\n\t\tg_print_bio(bp);\t\t\t\t\t\\\n\t\tprintf(\"\\n\");\t\t\t\t\t\t\\\n\t}\t\t\t\t\t\t\t\t\\\n} while (0)\n\n#define\tG_RAID3_BIO_CFLAG_REGULAR\t0x01\n#define\tG_RAID3_BIO_CFLAG_SYNC\t\t0x02\n#define\tG_RAID3_BIO_CFLAG_PARITY\t0x04\n#define\tG_RAID3_BIO_CFLAG_NODISK\t0x08\n#define\tG_RAID3_BIO_CFLAG_REGSYNC\t0x10\n#define\tG_RAID3_BIO_CFLAG_MASK\t\t(G_RAID3_BIO_CFLAG_REGULAR |\t\\\n\t\t\t\t\t G_RAID3_BIO_CFLAG_SYNC |\t\\\n\t\t\t\t\t G_RAID3_BIO_CFLAG_PARITY |\t\\\n\t\t\t\t\t G_RAID3_BIO_CFLAG_NODISK |\t\\\n\t\t\t\t\t G_RAID3_BIO_CFLAG_REGSYNC)\n\n#define\tG_RAID3_BIO_PFLAG_DEGRADED\t0x01\n#define\tG_RAID3_BIO_PFLAG_NOPARITY\t0x02\n#define\tG_RAID3_BIO_PFLAG_VERIFY\t0x04\n#define\tG_RAID3_BIO_PFLAG_MASK\t\t(G_RAID3_BIO_PFLAG_DEGRADED |\t\\\n\t\t\t\t\t G_RAID3_BIO_PFLAG_NOPARITY |\t\\\n\t\t\t\t\t G_RAID3_BIO_PFLAG_VERIFY)\n\n/*\n * Informations needed for synchronization.\n */\nstruct g_raid3_disk_sync {\n\tstruct g_consumer *ds_consumer;\t/* Consumer connected to our device. */\n\toff_t\t\t  ds_offset;\t/* Offset of next request to send. */\n\toff_t\t\t  ds_offset_done; /* Offset of already synchronized\n\t\t\t\t\t   region. */\n\toff_t\t\t  ds_resync;\t/* Resynchronize from this offset. */\n\tu_int\t\t  ds_syncid;\t/* Disk's synchronization ID. */\n\tu_int\t\t  ds_inflight;\t/* Number of in-flight sync requests. */\n\tstruct bio\t**ds_bios;\t/* BIOs for synchronization I/O. */\n};\n\n/*\n * Informations needed for synchronization.\n */\nstruct g_raid3_device_sync {\n\tstruct g_geom\t*ds_geom;\t/* Synchronization geom. */\n};\n\n#define\tG_RAID3_DISK_STATE_NODISK\t\t0\n#define\tG_RAID3_DISK_STATE_NONE\t\t\t1\n#define\tG_RAID3_DISK_STATE_NEW\t\t\t2\n#define\tG_RAID3_DISK_STATE_ACTIVE\t\t3\n#define\tG_RAID3_DISK_STATE_STALE\t\t4\n#define\tG_RAID3_DISK_STATE_SYNCHRONIZING\t5\n#define\tG_RAID3_DISK_STATE_DISCONNECTED\t\t6\n#define\tG_RAID3_DISK_STATE_DESTROY\t\t7\nstruct g_raid3_disk {\n\tu_int\t\t d_no;\t\t/* Disk number. */\n\tstruct g_consumer *d_consumer;\t/* Consumer. */\n\tstruct g_raid3_softc *d_softc;\t/* Back-pointer to softc. */\n\tint\t\t d_state;\t/* Disk state. */\n\tuint64_t\t d_flags;\t/* Additional flags. */\n\tu_int\t\t d_genid;\t/* Disk's generation ID. */\n\tstruct g_raid3_disk_sync d_sync; /* Sync information. */\n\tLIST_ENTRY(g_raid3_disk) d_next;\n};\n#define\td_name\td_consumer->provider->name\n\n#define\tG_RAID3_EVENT_DONTWAIT\t0x1\n#define\tG_RAID3_EVENT_WAIT\t0x2\n#define\tG_RAID3_EVENT_DEVICE\t0x4\n#define\tG_RAID3_EVENT_DONE\t0x8\nstruct g_raid3_event {\n\tstruct g_raid3_disk\t*e_disk;\n\tint\t\t\t e_state;\n\tint\t\t\t e_flags;\n\tint\t\t\t e_error;\n\tTAILQ_ENTRY(g_raid3_event) e_next;\n};\n\n#define\tG_RAID3_DEVICE_FLAG_DESTROY\t0x0100000000000000ULL\n#define\tG_RAID3_DEVICE_FLAG_WAIT\t0x0200000000000000ULL\n#define\tG_RAID3_DEVICE_FLAG_DESTROYING\t0x0400000000000000ULL\n\n#define\tG_RAID3_DEVICE_STATE_STARTING\t\t0\n#define\tG_RAID3_DEVICE_STATE_DEGRADED\t\t1\n#define\tG_RAID3_DEVICE_STATE_COMPLETE\t\t2\n\n/* Bump syncid on first write. */\n#define\tG_RAID3_BUMP_SYNCID\t0x1\n/* Bump genid immediately. */\n#define\tG_RAID3_BUMP_GENID\t0x2\n\nenum g_raid3_zones {\n\tG_RAID3_ZONE_64K,\n\tG_RAID3_ZONE_16K,\n\tG_RAID3_ZONE_4K,\n\tG_RAID3_NUM_ZONES\n};\n\nstatic __inline enum g_raid3_zones\ng_raid3_zone(size_t nbytes) {\n\tif (nbytes > 65536)\n\t\treturn (G_RAID3_NUM_ZONES);\n\telse if (nbytes > 16384)\n\t\treturn (G_RAID3_ZONE_64K);\n\telse if (nbytes > 4096)\n\t\treturn (G_RAID3_ZONE_16K);\n\telse\n\t\treturn (G_RAID3_ZONE_4K);\n};\n\nstruct g_raid3_softc {\n\tu_int\t\tsc_state;\t/* Device state. */\n\tuint64_t\tsc_mediasize;\t/* Device size. */\n\tuint32_t\tsc_sectorsize;\t/* Sector size. */\n\tuint64_t\tsc_flags;\t/* Additional flags. */\n\n\tstruct g_geom\t*sc_geom;\n\tstruct g_provider *sc_provider;\n\n\tuint32_t\tsc_id;\t\t/* Device unique ID. */\n\n\tstruct sx\t sc_lock;\n\tstruct bio_queue_head sc_queue;\n\tstruct mtx\t sc_queue_mtx;\n\tstruct proc\t*sc_worker;\n\tstruct bio_queue_head sc_regular_delayed; /* Delayed I/O requests due\n\t\t\t\t\t\t     collision with sync\n\t\t\t\t\t\t     requests. */\n\tstruct bio_queue_head sc_inflight; /* In-flight regular write\n\t\t\t\t\t      requests. */\n\tstruct bio_queue_head sc_sync_delayed; /* Delayed sync requests due\n\t\t\t\t\t\t  collision with regular\n\t\t\t\t\t\t  requests. */\n\n\tstruct g_raid3_disk *sc_disks;\n\tu_int\t\tsc_ndisks;\t/* Number of disks. */\n\tu_int\t\tsc_round_robin;\n\tstruct g_raid3_disk *sc_syncdisk;\n\n\tstruct g_raid3_zone {\n\t\tuma_zone_t\tsz_zone;\n\t\tsize_t\t\tsz_inuse;\n\t\tsize_t\t\tsz_max;\n\t\tu_int\t\tsz_requested;\n\t\tu_int\t\tsz_failed;\n\t} sc_zones[G_RAID3_NUM_ZONES];\n\n\tu_int\t\tsc_genid;\t/* Generation ID. */\n\tu_int\t\tsc_syncid;\t/* Synchronization ID. */\n\tint\t\tsc_bump_id;\n\tstruct g_raid3_device_sync sc_sync;\n\tint\t\tsc_idle;\t/* DIRTY flags removed. */\n\ttime_t\t\tsc_last_write;\n\tu_int\t\tsc_writes;\n\n\tTAILQ_HEAD(, g_raid3_event) sc_events;\n\tstruct mtx\tsc_events_mtx;\n\n\tstruct callout\tsc_callout;\n\n\tstruct root_hold_token *sc_rootmount;\n};\n#define\tsc_name\tsc_geom->name\n\nconst char *g_raid3_get_diskname(struct g_raid3_disk *disk);\nu_int g_raid3_ndisks(struct g_raid3_softc *sc, int state);\n#define\tG_RAID3_DESTROY_SOFT\t0\n#define\tG_RAID3_DESTROY_DELAYED\t1\n#define\tG_RAID3_DESTROY_HARD\t2\nint g_raid3_destroy(struct g_raid3_softc *sc, int how);\nint g_raid3_event_send(void *arg, int state, int flags);\nstruct g_raid3_metadata;\nint g_raid3_add_disk(struct g_raid3_softc *sc, struct g_provider *pp,\n    struct g_raid3_metadata *md);\nint g_raid3_read_metadata(struct g_consumer *cp, struct g_raid3_metadata *md);\nvoid g_raid3_fill_metadata(struct g_raid3_disk *disk,\n    struct g_raid3_metadata *md);\nint g_raid3_clear_metadata(struct g_raid3_disk *disk);\nvoid g_raid3_update_metadata(struct g_raid3_disk *disk);\n\ng_ctl_req_t g_raid3_config;\n#endif\t/* _KERNEL */\n\nstruct g_raid3_metadata {\n\tchar\t\tmd_magic[16];\t/* Magic value. */\n\tuint32_t\tmd_version;\t/* Version number. */\n\tchar\t\tmd_name[16];\t/* Device name. */\n\tuint32_t\tmd_id;\t\t/* Device unique ID. */\n\tuint16_t\tmd_no;\t\t/* Component number. */\n\tuint16_t\tmd_all;\t\t/* Number of disks in device. */\n\tuint32_t\tmd_genid;\t/* Generation ID. */\n\tuint32_t\tmd_syncid;\t/* Synchronization ID. */\n\tuint64_t\tmd_mediasize;\t/* Size of whole device. */\n\tuint32_t\tmd_sectorsize;\t/* Sector size. */\n\tuint64_t\tmd_sync_offset;\t/* Synchronized offset. */\n\tuint64_t\tmd_mflags;\t/* Additional device flags. */\n\tuint64_t\tmd_dflags;\t/* Additional disk flags. */\n\tchar\t\tmd_provider[16]; /* Hardcoded provider. */\n\tuint64_t\tmd_provsize;\t/* Provider's size. */\n\tu_char\t\tmd_hash[16];\t/* MD5 hash. */\n};\nstatic __inline void\nraid3_metadata_encode(struct g_raid3_metadata *md, u_char *data)\n{\n\tMD5_CTX ctx;\n\n\tbcopy(md->md_magic, data, 16);\n\tle32enc(data + 16, md->md_version);\n\tbcopy(md->md_name, data + 20, 16);\n\tle32enc(data + 36, md->md_id);\n\tle16enc(data + 40, md->md_no);\n\tle16enc(data + 42, md->md_all);\n\tle32enc(data + 44, md->md_genid);\n\tle32enc(data + 48, md->md_syncid);\n\tle64enc(data + 52, md->md_mediasize);\n\tle32enc(data + 60, md->md_sectorsize);\n\tle64enc(data + 64, md->md_sync_offset);\n\tle64enc(data + 72, md->md_mflags);\n\tle64enc(data + 80, md->md_dflags);\n\tbcopy(md->md_provider, data + 88, 16);\n\tle64enc(data + 104, md->md_provsize);\n\tMD5Init(&ctx);\n\tMD5Update(&ctx, data, 112);\n\tMD5Final(md->md_hash, &ctx);\n\tbcopy(md->md_hash, data + 112, 16);\n}\nstatic __inline int\nraid3_metadata_decode_v0v1v2(const u_char *data, struct g_raid3_metadata *md)\n{\n\tMD5_CTX ctx;\n\n\tbcopy(data + 20, md->md_name, 16);\n\tmd->md_id = le32dec(data + 36);\n\tmd->md_no = le16dec(data + 40);\n\tmd->md_all = le16dec(data + 42);\n\tmd->md_syncid = le32dec(data + 44);\n\tmd->md_mediasize = le64dec(data + 48);\n\tmd->md_sectorsize = le32dec(data + 56);\n\tmd->md_sync_offset = le64dec(data + 60);\n\tmd->md_mflags = le64dec(data + 68);\n\tmd->md_dflags = le64dec(data + 76);\n\tbcopy(data + 84, md->md_provider, 16);\n\tbcopy(data + 100, md->md_hash, 16);\n\tMD5Init(&ctx);\n\tMD5Update(&ctx, data, 100);\n\tMD5Final(md->md_hash, &ctx);\n\tif (bcmp(md->md_hash, data + 100, 16) != 0)\n\t\treturn (EINVAL);\n\n\t/* New fields. */\n\tmd->md_genid = 0;\n\tmd->md_provsize = 0;\n\n\treturn (0);\n}\nstatic __inline int\nraid3_metadata_decode_v3(const u_char *data, struct g_raid3_metadata *md)\n{\n\tMD5_CTX ctx;\n\n\tbcopy(data + 20, md->md_name, 16);\n\tmd->md_id = le32dec(data + 36);\n\tmd->md_no = le16dec(data + 40);\n\tmd->md_all = le16dec(data + 42);\n\tmd->md_genid = le32dec(data + 44);\n\tmd->md_syncid = le32dec(data + 48);\n\tmd->md_mediasize = le64dec(data + 52);\n\tmd->md_sectorsize = le32dec(data + 60);\n\tmd->md_sync_offset = le64dec(data + 64);\n\tmd->md_mflags = le64dec(data + 72);\n\tmd->md_dflags = le64dec(data + 80);\n\tbcopy(data + 88, md->md_provider, 16);\n\tbcopy(data + 104, md->md_hash, 16);\n\tMD5Init(&ctx);\n\tMD5Update(&ctx, data, 104);\n\tMD5Final(md->md_hash, &ctx);\n\tif (bcmp(md->md_hash, data + 104, 16) != 0)\n\t\treturn (EINVAL);\n\n\t/* New fields. */\n\tmd->md_provsize = 0;\n\n\treturn (0);\n}\nstatic __inline int\nraid3_metadata_decode_v4v5(const u_char *data, struct g_raid3_metadata *md)\n{\n\tMD5_CTX ctx;\n\n\tbcopy(data + 20, md->md_name, 16);\n\tmd->md_id = le32dec(data + 36);\n\tmd->md_no = le16dec(data + 40);\n\tmd->md_all = le16dec(data + 42);\n\tmd->md_genid = le32dec(data + 44);\n\tmd->md_syncid = le32dec(data + 48);\n\tmd->md_mediasize = le64dec(data + 52);\n\tmd->md_sectorsize = le32dec(data + 60);\n\tmd->md_sync_offset = le64dec(data + 64);\n\tmd->md_mflags = le64dec(data + 72);\n\tmd->md_dflags = le64dec(data + 80);\n\tbcopy(data + 88, md->md_provider, 16);\n\tmd->md_provsize = le64dec(data + 104);\n\tbcopy(data + 112, md->md_hash, 16);\n\tMD5Init(&ctx);\n\tMD5Update(&ctx, data, 112);\n\tMD5Final(md->md_hash, &ctx);\n\tif (bcmp(md->md_hash, data + 112, 16) != 0)\n\t\treturn (EINVAL);\n\treturn (0);\n}\nstatic __inline int\nraid3_metadata_decode(const u_char *data, struct g_raid3_metadata *md)\n{\n\tint error;\n\n\tbcopy(data, md->md_magic, 16);\n\tmd->md_version = le32dec(data + 16);\n\tswitch (md->md_version) {\n\tcase 0:\n\tcase 1:\n\tcase 2:\n\t\terror = raid3_metadata_decode_v0v1v2(data, md);\n\t\tbreak;\n\tcase 3:\n\t\terror = raid3_metadata_decode_v3(data, md);\n\t\tbreak;\n\tcase 4:\n\tcase 5:\n\t\terror = raid3_metadata_decode_v4v5(data, md);\n\t\tbreak;\n\tdefault:\n\t\terror = EINVAL;\n\t\tbreak;\n\t}\n\treturn (error);\n}\n\nstatic __inline void\nraid3_metadata_dump(const struct g_raid3_metadata *md)\n{\n\tstatic const char hex[] = \"0123456789abcdef\";\n\tchar hash[16 * 2 + 1];\n\tu_int i;\n\n\tprintf(\"     magic: %s\\n\", md->md_magic);\n\tprintf(\"   version: %u\\n\", (u_int)md->md_version);\n\tprintf(\"      name: %s\\n\", md->md_name);\n\tprintf(\"        id: %u\\n\", (u_int)md->md_id);\n\tprintf(\"        no: %u\\n\", (u_int)md->md_no);\n\tprintf(\"       all: %u\\n\", (u_int)md->md_all);\n\tprintf(\"     genid: %u\\n\", (u_int)md->md_genid);\n\tprintf(\"    syncid: %u\\n\", (u_int)md->md_syncid);\n\tprintf(\" mediasize: %jd\\n\", (intmax_t)md->md_mediasize);\n\tprintf(\"sectorsize: %u\\n\", (u_int)md->md_sectorsize);\n\tprintf(\"syncoffset: %jd\\n\", (intmax_t)md->md_sync_offset);\n\tprintf(\"    mflags:\");\n\tif (md->md_mflags == 0)\n\t\tprintf(\" NONE\");\n\telse {\n\t\tif ((md->md_mflags & G_RAID3_DEVICE_FLAG_NOAUTOSYNC) != 0)\n\t\t\tprintf(\" NOAUTOSYNC\");\n\t\tif ((md->md_mflags & G_RAID3_DEVICE_FLAG_ROUND_ROBIN) != 0)\n\t\t\tprintf(\" ROUND-ROBIN\");\n\t\tif ((md->md_mflags & G_RAID3_DEVICE_FLAG_VERIFY) != 0)\n\t\t\tprintf(\" VERIFY\");\n\t\tif ((md->md_mflags & G_RAID3_DEVICE_FLAG_NOFAILSYNC) != 0)\n\t\t\tprintf(\" NOFAILSYNC\");\n\t}\n\tprintf(\"\\n\");\n\tprintf(\"    dflags:\");\n\tif (md->md_dflags == 0)\n\t\tprintf(\" NONE\");\n\telse {\n\t\tif ((md->md_dflags & G_RAID3_DISK_FLAG_DIRTY) != 0)\n\t\t\tprintf(\" DIRTY\");\n\t\tif ((md->md_dflags & G_RAID3_DISK_FLAG_SYNCHRONIZING) != 0)\n\t\t\tprintf(\" SYNCHRONIZING\");\n\t\tif ((md->md_dflags & G_RAID3_DISK_FLAG_FORCE_SYNC) != 0)\n\t\t\tprintf(\" FORCE_SYNC\");\n\t}\n\tprintf(\"\\n\");\n\tprintf(\"hcprovider: %s\\n\", md->md_provider);\n\tprintf(\"  provsize: %ju\\n\", (uintmax_t)md->md_provsize);\n\tbzero(hash, sizeof(hash));\n\tfor (i = 0; i < 16; i++) {\n\t\thash[i * 2] = hex[md->md_hash[i] >> 4];\n\t\thash[i * 2 + 1] = hex[md->md_hash[i] & 0x0f];\n\t}\n\tprintf(\"  MD5 hash: %s\\n\", hash);\n}\n#endif\t/* !_G_RAID3_H_ */\n"
  },
  {
    "path": "freebsd-headers/geom/shsec/g_shsec.h",
    "content": "/*-\n * Copyright (c) 2005 Pawel Jakub Dawidek <pjd@FreeBSD.org>\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/geom/shsec/g_shsec.h 155174 2006-02-01 12:06:01Z pjd $\n */\n\n#ifndef\t_G_SHSEC_H_\n#define\t_G_SHSEC_H_\n\n#include <sys/endian.h>\n\n#define\tG_SHSEC_CLASS_NAME\t\"SHSEC\"\n\n#define\tG_SHSEC_MAGIC\t\t\"GEOM::SHSEC\"\n/*\n * Version history:\n * 0 - Initial version number.\n * 1 - Added md_provsize field to metadata.\n */\n#define\tG_SHSEC_VERSION\t1\n\n#ifdef _KERNEL\n#define\tG_SHSEC_BFLAG_FIRST\t0x1\n\n#define\tG_SHSEC_DEBUG(lvl, ...)\tdo {\t\t\t\t\t\\\n\tif (g_shsec_debug >= (lvl)) {\t\t\t\t\t\\\n\t\tprintf(\"GEOM_SHSEC\");\t\t\t\t\t\\\n\t\tif (g_shsec_debug > 0)\t\t\t\t\t\\\n\t\t\tprintf(\"[%u]\", lvl);\t\t\t\t\\\n\t\tprintf(\": \");\t\t\t\t\t\t\\\n\t\tprintf(__VA_ARGS__);\t\t\t\t\t\\\n\t\tprintf(\"\\n\");\t\t\t\t\t\t\\\n\t}\t\t\t\t\t\t\t\t\\\n} while (0)\n#define\tG_SHSEC_LOGREQ(lvl, bp, ...)\tdo {\t\t\t\t\\\n\tif (g_shsec_debug >= (lvl)) {\t\t\t\t\t\\\n\t\tprintf(\"GEOM_SHSEC\");\t\t\t\t\t\\\n\t\tif (g_shsec_debug > 0)\t\t\t\t\t\\\n\t\t\tprintf(\"[%u]\", lvl);\t\t\t\t\\\n\t\tprintf(\": \");\t\t\t\t\t\t\\\n\t\tprintf(__VA_ARGS__);\t\t\t\t\t\\\n\t\tprintf(\" \");\t\t\t\t\t\t\\\n\t\tg_print_bio(bp);\t\t\t\t\t\\\n\t\tprintf(\"\\n\");\t\t\t\t\t\t\\\n\t}\t\t\t\t\t\t\t\t\\\n} while (0)\n\nstruct g_shsec_softc {\n\tu_int\t\t sc_type;\t/* provider type */\n\tstruct g_geom\t*sc_geom;\n\tstruct g_provider *sc_provider;\n\tuint32_t\t sc_id;\t\t/* device unique ID */\n\tstruct g_consumer **sc_disks;\n\tuint16_t\t sc_ndisks;\n};\n#define\tsc_name\tsc_geom->name\n#endif\t/* _KERNEL */\n\nstruct g_shsec_metadata {\n\tchar\t\tmd_magic[16];\t/* Magic value. */\n\tuint32_t\tmd_version;\t/* Version number. */\n\tchar\t\tmd_name[16];\t/* Stripe name. */\n\tuint32_t\tmd_id;\t\t/* Unique ID. */\n\tuint16_t\tmd_no;\t\t/* Disk number. */\n\tuint16_t\tmd_all;\t\t/* Number of all disks. */\n\tchar\t\tmd_provider[16]; /* Hardcoded provider. */\n\tuint64_t\tmd_provsize;\t/* Provider's size. */\n};\nstatic __inline void\nshsec_metadata_encode(const struct g_shsec_metadata *md, u_char *data)\n{\n\n\tbcopy(md->md_magic, data, sizeof(md->md_magic));\n\tle32enc(data + 16, md->md_version);\n\tbcopy(md->md_name, data + 20, sizeof(md->md_name));\n\tle32enc(data + 36, md->md_id);\n\tle16enc(data + 40, md->md_no);\n\tle16enc(data + 42, md->md_all);\n\tbcopy(md->md_provider, data + 44, sizeof(md->md_provider));\n\tle64enc(data + 60, md->md_provsize);\n}\nstatic __inline void\nshsec_metadata_decode(const u_char *data, struct g_shsec_metadata *md)\n{\n\n\tbcopy(data, md->md_magic, sizeof(md->md_magic));\n\tmd->md_version = le32dec(data + 16);\n\tbcopy(data + 20, md->md_name, sizeof(md->md_name));\n\tmd->md_id = le32dec(data + 36);\n\tmd->md_no = le16dec(data + 40);\n\tmd->md_all = le16dec(data + 42);\n\tbcopy(data + 44, md->md_provider, sizeof(md->md_provider));\n\tmd->md_provsize = le64dec(data + 60);\n}\n#endif\t/* _G_SHSEC_H_ */\n"
  },
  {
    "path": "freebsd-headers/geom/stripe/g_stripe.h",
    "content": "/*-\n * Copyright (c) 2004-2005 Pawel Jakub Dawidek <pjd@FreeBSD.org>\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/geom/stripe/g_stripe.h 155174 2006-02-01 12:06:01Z pjd $\n */\n\n#ifndef\t_G_STRIPE_H_\n#define\t_G_STRIPE_H_\n\n#include <sys/endian.h>\n\n#define\tG_STRIPE_CLASS_NAME\t\"STRIPE\"\n\n#define\tG_STRIPE_MAGIC\t\t\"GEOM::STRIPE\"\n/*\n * Version history:\n * 0 - Initial version number.\n * 1 - Added 'stop' command for gstripe(8).\n * 2 - Added md_provider field to metadata and '-h' option for gstripe(8).\n * 3 - Added md_provsize field to metadata.\n */\n#define\tG_STRIPE_VERSION\t3\n\n#ifdef _KERNEL\n#define\tG_STRIPE_TYPE_MANUAL\t0\n#define\tG_STRIPE_TYPE_AUTOMATIC\t1\n\n#define\tG_STRIPE_DEBUG(lvl, ...)\tdo {\t\t\t\t\\\n\tif (g_stripe_debug >= (lvl)) {\t\t\t\t\t\\\n\t\tprintf(\"GEOM_STRIPE\");\t\t\t\t\t\\\n\t\tif (g_stripe_debug > 0)\t\t\t\t\t\\\n\t\t\tprintf(\"[%u]\", lvl);\t\t\t\t\\\n\t\tprintf(\": \");\t\t\t\t\t\t\\\n\t\tprintf(__VA_ARGS__);\t\t\t\t\t\\\n\t\tprintf(\"\\n\");\t\t\t\t\t\t\\\n\t}\t\t\t\t\t\t\t\t\\\n} while (0)\n#define\tG_STRIPE_LOGREQ(bp, ...)\tdo {\t\t\t\t\\\n\tif (g_stripe_debug >= 2) {\t\t\t\t\t\\\n\t\tprintf(\"GEOM_STRIPE[2]: \");\t\t\t\t\\\n\t\tprintf(__VA_ARGS__);\t\t\t\t\t\\\n\t\tprintf(\" \");\t\t\t\t\t\t\\\n\t\tg_print_bio(bp);\t\t\t\t\t\\\n\t\tprintf(\"\\n\");\t\t\t\t\t\t\\\n\t}\t\t\t\t\t\t\t\t\\\n} while (0)\n\nstruct g_stripe_softc {\n\tu_int\t\t sc_type;\t/* provider type */\n\tstruct g_geom\t*sc_geom;\n\tstruct g_provider *sc_provider;\n\tuint32_t\t sc_id;\t\t/* stripe unique ID */\n\tstruct g_consumer **sc_disks;\n\tuint16_t\t sc_ndisks;\n\tuint32_t\t sc_stripesize;\n\tuint32_t\t sc_stripebits;\n};\n#define\tsc_name\tsc_geom->name\n#endif\t/* _KERNEL */\n\nstruct g_stripe_metadata {\n\tchar\t\tmd_magic[16];\t/* Magic value. */\n\tuint32_t\tmd_version;\t/* Version number. */\n\tchar\t\tmd_name[16];\t/* Stripe name. */\n\tuint32_t\tmd_id;\t\t/* Unique ID. */\n\tuint16_t\tmd_no;\t\t/* Disk number. */\n\tuint16_t\tmd_all;\t\t/* Number of all disks. */\n\tuint32_t\tmd_stripesize;\t/* Stripe size. */\n\tchar\t\tmd_provider[16]; /* Hardcoded provider. */\n\tuint64_t\tmd_provsize;\t/* Provider's size. */\n};\nstatic __inline void\nstripe_metadata_encode(const struct g_stripe_metadata *md, u_char *data)\n{\n\n\tbcopy(md->md_magic, data, sizeof(md->md_magic));\n\tle32enc(data + 16, md->md_version);\n\tbcopy(md->md_name, data + 20, sizeof(md->md_name));\n\tle32enc(data + 36, md->md_id);\n\tle16enc(data + 40, md->md_no);\n\tle16enc(data + 42, md->md_all);\n\tle32enc(data + 44, md->md_stripesize);\n\tbcopy(md->md_provider, data + 48, sizeof(md->md_provider));\n\tle64enc(data + 64, md->md_provsize);\n}\nstatic __inline void\nstripe_metadata_decode(const u_char *data, struct g_stripe_metadata *md)\n{\n\n\tbcopy(data, md->md_magic, sizeof(md->md_magic));\n\tmd->md_version = le32dec(data + 16);\n\tbcopy(data + 20, md->md_name, sizeof(md->md_name));\n\tmd->md_id = le32dec(data + 36);\n\tmd->md_no = le16dec(data + 40);\n\tmd->md_all = le16dec(data + 42);\n\tmd->md_stripesize = le32dec(data + 44);\n\tbcopy(data + 48, md->md_provider, sizeof(md->md_provider));\n\tmd->md_provsize = le64dec(data + 64);\n}\n\n#endif\t/* _G_STRIPE_H_ */\n"
  },
  {
    "path": "freebsd-headers/geom/virstor/binstream.h",
    "content": "/*-\n * Copyright (c) 2005 Ivan Voras <ivoras@gmail.com>\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/geom/virstor/binstream.h 172302 2007-09-23 07:34:23Z pjd $\n */\n\n// $Id: binstream.h,v 1.1 2006/07/05 10:47:54 ivoras Exp $\n\n\n#ifndef _BIN_STREAM_\n#define _BIN_STREAM_\n\n#ifndef uint8_t\n#define uint8_t unsigned char\n#endif\n\ntypedef struct {\n\tunsigned char  *data;\n\tint\t\tpos;\n}\tbin_stream_t;\n\n\n/* \"Open\" a binary stream for reading */\nvoid\t\tbs_open   (bin_stream_t * bs, void *data);\n\n/* \"Reset\" position in binary stream to zero */\nvoid\t\tbs_reset  (bin_stream_t * bs);\n\n\n/* Write a zero-terminated string; return next position */\nunsigned\tbs_write_str(bin_stream_t * bs, char *data);\n\n/* Write an arbitrary buffer; return next position */\nunsigned\tbs_write_buf(bin_stream_t * bs, char *data, unsigned data_size);\n\n/* Write a 8bit uint; return next position. */\nunsigned\tbs_write_u8(bin_stream_t * bs, uint8_t data);\n\n/* Write a 16bit uint; return next position. */\nunsigned\tbs_write_u16(bin_stream_t * bs, uint16_t data);\n\n/* Write a 32bit uint; return next position. */\nunsigned\tbs_write_u32(bin_stream_t * bs, uint32_t data);\n\n/* Write a 64bit uint; return next position. */\nunsigned\tbs_write_u64(bin_stream_t * bs, uint64_t data);\n\n\n/*\n * Read a null-terminated string from stream into a buffer; buf_size is size\n * of the buffer, including the final \\0. Returns buf pointer or NULL if\n * garbage input.\n */\nchar           *bs_read_str(bin_stream_t * bs, char *buf, unsigned buf_size);\n\n/* Read an arbitrary buffer. */\nvoid\t\tbs_read_buf(bin_stream_t * bs, char *buf, unsigned buf_size);\n\n/* Read a 8bit uint * return it */\nuint8_t\t\tbs_read_u8(bin_stream_t * bs);\n\n/* Read a 16bit uint * return it */\nuint16_t\tbs_read_u16(bin_stream_t * bs);\n\n/* Read a 8bit uint * return it */\nuint32_t\tbs_read_u32(bin_stream_t * bs);\n\n/* Read a 8bit uint * return it */\nuint64_t\tbs_read_u64(bin_stream_t * bs);\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/geom/virstor/g_virstor.h",
    "content": "/*-\n * Copyright (c) 2006-2007 Ivan Voras <ivoras@freebsd.org>\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/geom/virstor/g_virstor.h 172302 2007-09-23 07:34:23Z pjd $\n */\n\n#ifndef _G_VIRSTOR_H_\n#define _G_VIRSTOR_H_\n\n#define\tG_VIRSTOR_CLASS_NAME \"VIRSTOR\"\n\n\n#define VIRSTOR_MAP_ALLOCATED 1\nstruct virstor_map_entry {\n\tuint16_t\tflags;\n\tuint16_t\tprovider_no;\n\tuint32_t\tprovider_chunk;\n};\n\n#define\tVIRSTOR_MAP_ENTRY_SIZE (sizeof(struct virstor_map_entry))\n#define\tVIRSTOR_MAP_BLOCK_ENTRIES (MAXPHYS / VIRSTOR_MAP_ENTRY_SIZE)\n/* Struct size is guarded by CTASSERT in main source */\n\n#ifdef _KERNEL\n\n#define\tLOG_MSG(lvl, ...)       do {\t\t\t\t\t\\\n        if (g_virstor_debug >= (lvl)) {\t\t\t\t\t\\\n                printf(\"GEOM_\" G_VIRSTOR_CLASS_NAME);\t\t\t\\\n                if (lvl > 0)\t\t\t\t\t\t\\\n                        printf(\"[%u]\", lvl);\t\t\t\t\\\n                printf(\": \");\t\t\t\t\t\t\\\n                printf(__VA_ARGS__);\t\t\t\t\t\\\n                printf(\"\\n\");\t\t\t\t\t\t\\\n        }\t\t\t\t\t\t\t\t\\\n} while (0)\n#define\tLOG_MESSAGE LOG_MSG\n\n#define\tLOG_REQ(lvl, bp, ...)  do {\t\t\t\t\t\\\n        if (g_virstor_debug >= (lvl)) {\t\t\t\t\t\\\n                printf(\"GEOM_\" G_VIRSTOR_CLASS_NAME);\t\t\t\\\n                if (lvl > 0)\t\t\t\t\t\t\\\n                        printf(\"[%u]\", lvl);\t\t\t\t\\\n                printf(\": \");\t\t\t\t\t\t\\\n                printf(__VA_ARGS__);\t\t\t\t\t\\\n                printf(\" \");\t\t\t\t\t\t\\\n                g_print_bio(bp);\t\t\t\t\t\\\n                printf(\"\\n\");\t\t\t\t\t\t\\\n        }\t\t\t\t\t\t\t\t\\\n} while (0)\n#define\tLOG_REQUEST LOG_REQ\n\n/* \"critical\" system announcements (e.g. \"geom is up\") */\n#define\tLVL_ANNOUNCE\t0\n/* errors */\n#define\tLVL_ERROR\t1\n/* warnings */\n#define\tLVL_WARNING\t2\n/* info, noncritical for system operation (user doesn't have to see it */\n#define\tLVL_INFO\t5\n/* debug info */\n#define\tLVL_DEBUG\t10\n/* more debug info */\n#define\tLVL_DEBUG2\t12\n/* superfluous debug info (large volumes of data) */\n#define\tLVL_MOREDEBUG\t15\n\n\n/* Component data */\nstruct g_virstor_component {\n\tstruct g_consumer\t*gcons;\n\tstruct g_virstor_softc\t*sc;\n\tunsigned int\t\t index;\t\t/* Component index in array */\n\tunsigned int\t\t chunk_count;\n\tunsigned int\t\t chunk_next;\n\tunsigned int\t\t chunk_reserved;\n\tunsigned int\t\t flags;\n};\n\n\n/* Internal geom instance data */\nstruct g_virstor_softc {\n\tstruct g_geom\t\t*geom;\n\tstruct g_provider\t*provider;\n\tstruct g_virstor_component *components;\n\tu_int\t\t\t n_components;\n\tu_int\t\t\t curr_component; /* Component currently used */\n\tuint32_t\t\t id;\t\t/* Unique ID of this geom */\n\toff_t\t\t\t virsize;\t/* Total size of virstor */\n\toff_t\t\t\t sectorsize;\n\tsize_t\t\t\t chunk_size;\n\tsize_t\t\t\t chunk_count;\t/* governs map_size */\n\tstruct virstor_map_entry *map;\n\tsize_t\t\t\t map_size;\t/* (in bytes) */\n\tsize_t\t\t\t map_sectors;\t/* Size of map in sectors */\n\tsize_t\t\t\t me_per_sector;\t/* # map entries in a sector */\n\tSTAILQ_HEAD(, g_virstor_bio_q)\t delayed_bio_q;\t/* Queue of delayed BIOs */\n\tstruct mtx\t\t delayed_bio_q_mtx;\n};\n\n/* \"delayed BIOs\" Queue element */\nstruct g_virstor_bio_q {\n\tstruct bio\t\t*bio;\n\tSTAILQ_ENTRY(g_virstor_bio_q) linkage;\n};\n\n\n#endif\t/* _KERNEL */\n\n#ifndef _PATH_DEV\n#define _PATH_DEV \"/dev/\"\n#endif\n\n#endif\t/* !_G_VIRSTOR_H_ */\n"
  },
  {
    "path": "freebsd-headers/geom/virstor/g_virstor_md.h",
    "content": "/*-\n * Copyright (c) 2005 Ivan Voras <ivoras@gmail.com>\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/geom/virstor/g_virstor_md.h 172302 2007-09-23 07:34:23Z pjd $\n */\n\n\n#ifndef _G_VIRSTOR_MD_H_\n#define _G_VIRSTOR_MD_H_\n\n/*\n * Metadata declaration\n */\n\n#define\tG_VIRSTOR_MAGIC\t\t\"GEOM::VIRSTOR\"\n#define\tG_VIRSTOR_VERSION\t1\n\n/* flag: provider is allocated */\n#define\tVIRSTOR_PROVIDER_ALLOCATED\t1\n/* flag: provider is currently being filled (usually it's the last\n * provider with VIRSTOR_PROVIDER_ALLOCATED flag */\n#define VIRSTOR_PROVIDER_CURRENT\t2\n\nstruct g_virstor_metadata {\n\t/* Data global to the virstor device */\n\tchar\t\tmd_magic[16];\t\t/* Magic value. */\n\tuint32_t\tmd_version;\t\t/* Version number. */\n\tchar\t\tmd_name[16];\t\t/* Device name (e.g. \"mydata\") */\n\tuint32_t\tmd_id;\t\t\t/* Unique ID. */\n\tuint64_t\tmd_virsize;\t\t/* Virtual device's size */\n\tuint32_t\tmd_chunk_size;\t\t/* Chunk size in bytes */\n\tuint16_t\tmd_count;\t\t/* Total number of providers */\n\n\t/* Data local to this provider */\n\tchar\t\tprovider[16];\t\t/* Hardcoded provider name */\n\tuint16_t\tno;\t\t\t/* Provider number/index */\n\tuint64_t\tprovsize;\t\t/* Provider's size */\n\tuint32_t\tchunk_count;\t\t/* Number of chunks in this pr. */\n\tuint32_t\tchunk_next;\t\t/* Next chunk to allocate */\n\tuint16_t\tchunk_reserved;\t\t/* Count of \"reserved\" chunks */\n\tuint16_t\tflags;\t\t\t/* Provider's flags */\n};\n\nvoid virstor_metadata_encode(struct g_virstor_metadata *md, unsigned char *data);\nvoid virstor_metadata_decode(unsigned char *data, struct g_virstor_metadata *md);\n\n#endif\t/* !_G_VIRSTOR_H_ */\n"
  },
  {
    "path": "freebsd-headers/getopt.h",
    "content": "/*\t$NetBSD: getopt.h,v 1.4 2000/07/07 10:43:54 ad Exp $\t*/\n/*\t$FreeBSD: release/9.0.0/include/getopt.h 203963 2010-02-16 19:28:10Z imp $ */\n\n/*-\n * Copyright (c) 2000 The NetBSD Foundation, Inc.\n * All rights reserved.\n *\n * This code is derived from software contributed to The NetBSD Foundation\n * by Dieter Baron and Thomas Klausner.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS\n * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED\n * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\n * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS\n * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\n * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\n * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\n * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\n * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\n#ifndef _GETOPT_H_\n#define _GETOPT_H_\n\n#include <sys/cdefs.h>\n\n/*\n * GNU-like getopt_long()/getopt_long_only() with 4.4BSD optreset extension.\n * getopt() is declared here too for GNU programs.\n */\n#define no_argument        0\n#define required_argument  1\n#define optional_argument  2\n\nstruct option {\n\t/* name of long option */\n\tconst char *name;\n\t/*\n\t * one of no_argument, required_argument, and optional_argument:\n\t * whether option takes an argument\n\t */\n\tint has_arg;\n\t/* if not NULL, set *flag to val when option found */\n\tint *flag;\n\t/* if flag not NULL, value to set *flag to; else return value */\n\tint val;\n};\n\n__BEGIN_DECLS\nint\tgetopt_long(int, char * const *, const char *,\n\tconst struct option *, int *);\nint\tgetopt_long_only(int, char * const *, const char *,\n\tconst struct option *, int *);\n#ifndef _GETOPT_DECLARED\n#define\t_GETOPT_DECLARED\nint\t getopt(int, char * const [], const char *);\n\nextern char *optarg;\t\t\t/* getopt(3) external variables */\nextern int optind, opterr, optopt;\n#endif\n#ifndef _OPTRESET_DECLARED\n#define\t_OPTRESET_DECLARED\nextern int optreset;\t\t\t/* getopt(3) external variable */\n#endif\n__END_DECLS\n \n#endif /* !_GETOPT_H_ */\n"
  },
  {
    "path": "freebsd-headers/glob.h",
    "content": "/*\n * Copyright (c) 1989, 1993\n *\tThe Regents of the University of California.  All rights reserved.\n *\n * This code is derived from software contributed to Berkeley by\n * Guido van Rossum.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t@(#)glob.h\t8.1 (Berkeley) 6/2/93\n * $FreeBSD: release/9.0.0/include/glob.h 203964 2010-02-16 19:39:50Z imp $\n */\n\n#ifndef _GLOB_H_\n#define\t_GLOB_H_\n\n#include <sys/cdefs.h>\n#include <sys/_types.h>\n\n#ifndef\t_SIZE_T_DECLARED\ntypedef\t__size_t\tsize_t;\n#define\t_SIZE_T_DECLARED\n#endif\n\nstruct stat;\ntypedef struct {\n\tsize_t gl_pathc;\t/* Count of total paths so far. */\n\tsize_t gl_matchc;\t/* Count of paths matching pattern. */\n\tsize_t gl_offs;\t\t/* Reserved at beginning of gl_pathv. */\n\tint gl_flags;\t\t/* Copy of flags parameter to glob. */\n\tchar **gl_pathv;\t/* List of paths matching pattern. */\n\t\t\t\t/* Copy of errfunc parameter to glob. */\n\tint (*gl_errfunc)(const char *, int);\n\n\t/*\n\t * Alternate filesystem access methods for glob; replacement\n\t * versions of closedir(3), readdir(3), opendir(3), stat(2)\n\t * and lstat(2).\n\t */\n\tvoid (*gl_closedir)(void *);\n\tstruct dirent *(*gl_readdir)(void *);\n\tvoid *(*gl_opendir)(const char *);\n\tint (*gl_lstat)(const char *, struct stat *);\n\tint (*gl_stat)(const char *, struct stat *);\n} glob_t;\n\n#if __POSIX_VISIBLE >= 199209\n/* Believed to have been introduced in 1003.2-1992 */\n#define\tGLOB_APPEND\t0x0001\t/* Append to output from previous call. */\n#define\tGLOB_DOOFFS\t0x0002\t/* Use gl_offs. */\n#define\tGLOB_ERR\t0x0004\t/* Return on error. */\n#define\tGLOB_MARK\t0x0008\t/* Append / to matching directories. */\n#define\tGLOB_NOCHECK\t0x0010\t/* Return pattern itself if nothing matches. */\n#define\tGLOB_NOSORT\t0x0020\t/* Don't sort. */\n#define\tGLOB_NOESCAPE\t0x2000\t/* Disable backslash escaping. */\n\n/* Error values returned by glob(3) */\n#define\tGLOB_NOSPACE\t(-1)\t/* Malloc call failed. */\n#define\tGLOB_ABORTED\t(-2)\t/* Unignored error. */\n#define\tGLOB_NOMATCH\t(-3)\t/* No match and GLOB_NOCHECK was not set. */\n#define\tGLOB_NOSYS\t(-4)\t/* Obsolete: source comptability only. */\n#endif /* __POSIX_VISIBLE >= 199209 */\n\n#if __BSD_VISIBLE\n#define\tGLOB_ALTDIRFUNC\t0x0040\t/* Use alternately specified directory funcs. */\n#define\tGLOB_BRACE\t0x0080\t/* Expand braces ala csh. */\n#define\tGLOB_MAGCHAR\t0x0100\t/* Pattern had globbing characters. */\n#define\tGLOB_NOMAGIC\t0x0200\t/* GLOB_NOCHECK without magic chars (csh). */\n#define\tGLOB_QUOTE\t0x0400\t/* Quote special chars with \\. */\n#define\tGLOB_TILDE\t0x0800\t/* Expand tilde names from the passwd file. */\n#define\tGLOB_LIMIT\t0x1000\t/* limit number of returned paths */\n\n/* source compatibility, these are the old names */\n#define GLOB_MAXPATH\tGLOB_LIMIT\n#define\tGLOB_ABEND\tGLOB_ABORTED\n#endif /* __BSD_VISIBLE */\n\n__BEGIN_DECLS\nint\tglob(const char *, int, int (*)(const char *, int), glob_t *);\nvoid\tglobfree(glob_t *);\n__END_DECLS\n\n#endif /* !_GLOB_H_ */\n"
  },
  {
    "path": "freebsd-headers/gnu/posix/regex.h",
    "content": "/* Definitions for data structures and routines for the regular\n   expression library.\n   Copyright (C) 1985,1989-93,1995-98,2000,2001,2002,2003\n   Free Software Foundation, Inc.\n   This file is part of the GNU C Library.\n\n   The GNU C Library is free software; you can redistribute it and/or\n   modify it under the terms of the GNU Lesser General Public\n   License as published by the Free Software Foundation; either\n   version 2.1 of the License, or (at your option) any later version.\n\n   The GNU C Library is distributed in the hope that it will be useful,\n   but WITHOUT ANY WARRANTY; without even the implied warranty of\n   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n   Lesser General Public License for more details.\n\n   You should have received a copy of the GNU Lesser General Public\n   License along with the GNU C Library; if not, write to the Free\n   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA\n   02111-1307 USA.  */\n\n#ifndef _REGEX_H\n#define _REGEX_H 1\n\n#include <sys/types.h>\n\n/* Allow the use in C++ code.  */\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\n/* POSIX says that <sys/types.h> must be included (by the caller) before\n   <regex.h>.  */\n\n#if !defined _POSIX_C_SOURCE && !defined _POSIX_SOURCE && defined VMS\n/* VMS doesn't have `size_t' in <sys/types.h>, even though POSIX says it\n   should be there.  */\n# include <stddef.h>\n#endif\n\n/* The following two types have to be signed and unsigned integer type\n   wide enough to hold a value of a pointer.  For most ANSI compilers\n   ptrdiff_t and size_t should be likely OK.  Still size of these two\n   types is 2 for Microsoft C.  Ugh... */\ntypedef long int s_reg_t;\ntypedef unsigned long int active_reg_t;\n\n/* The following bits are used to determine the regexp syntax we\n   recognize.  The set/not-set meanings are chosen so that Emacs syntax\n   remains the value 0.  The bits are given in alphabetical order, and\n   the definitions shifted by one from the previous bit; thus, when we\n   add or remove a bit, only one other definition need change.  */\ntypedef unsigned long int reg_syntax_t;\n\n/* If this bit is not set, then \\ inside a bracket expression is literal.\n   If set, then such a \\ quotes the following character.  */\n#define RE_BACKSLASH_ESCAPE_IN_LISTS ((unsigned long int) 1)\n\n/* If this bit is not set, then + and ? are operators, and \\+ and \\? are\n     literals.\n   If set, then \\+ and \\? are operators and + and ? are literals.  */\n#define RE_BK_PLUS_QM (RE_BACKSLASH_ESCAPE_IN_LISTS << 1)\n\n/* If this bit is set, then character classes are supported.  They are:\n     [:alpha:], [:upper:], [:lower:],  [:digit:], [:alnum:], [:xdigit:],\n     [:space:], [:print:], [:punct:], [:graph:], and [:cntrl:].\n   If not set, then character classes are not supported.  */\n#define RE_CHAR_CLASSES (RE_BK_PLUS_QM << 1)\n\n/* If this bit is set, then ^ and $ are always anchors (outside bracket\n     expressions, of course).\n   If this bit is not set, then it depends:\n        ^  is an anchor if it is at the beginning of a regular\n           expression or after an open-group or an alternation operator;\n        $  is an anchor if it is at the end of a regular expression, or\n           before a close-group or an alternation operator.\n\n   This bit could be (re)combined with RE_CONTEXT_INDEP_OPS, because\n   POSIX draft 11.2 says that * etc. in leading positions is undefined.\n   We already implemented a previous draft which made those constructs\n   invalid, though, so we haven't changed the code back.  */\n#define RE_CONTEXT_INDEP_ANCHORS (RE_CHAR_CLASSES << 1)\n\n/* If this bit is set, then special characters are always special\n     regardless of where they are in the pattern.\n   If this bit is not set, then special characters are special only in\n     some contexts; otherwise they are ordinary.  Specifically,\n     * + ? and intervals are only special when not after the beginning,\n     open-group, or alternation operator.  */\n#define RE_CONTEXT_INDEP_OPS (RE_CONTEXT_INDEP_ANCHORS << 1)\n\n/* If this bit is set, then *, +, ?, and { cannot be first in an re or\n     immediately after an alternation or begin-group operator.  */\n#define RE_CONTEXT_INVALID_OPS (RE_CONTEXT_INDEP_OPS << 1)\n\n/* If this bit is set, then . matches newline.\n   If not set, then it doesn't.  */\n#define RE_DOT_NEWLINE (RE_CONTEXT_INVALID_OPS << 1)\n\n/* If this bit is set, then . doesn't match NUL.\n   If not set, then it does.  */\n#define RE_DOT_NOT_NULL (RE_DOT_NEWLINE << 1)\n\n/* If this bit is set, nonmatching lists [^...] do not match newline.\n   If not set, they do.  */\n#define RE_HAT_LISTS_NOT_NEWLINE (RE_DOT_NOT_NULL << 1)\n\n/* If this bit is set, either \\{...\\} or {...} defines an\n     interval, depending on RE_NO_BK_BRACES.\n   If not set, \\{, \\}, {, and } are literals.  */\n#define RE_INTERVALS (RE_HAT_LISTS_NOT_NEWLINE << 1)\n\n/* If this bit is set, +, ? and | aren't recognized as operators.\n   If not set, they are.  */\n#define RE_LIMITED_OPS (RE_INTERVALS << 1)\n\n/* If this bit is set, newline is an alternation operator.\n   If not set, newline is literal.  */\n#define RE_NEWLINE_ALT (RE_LIMITED_OPS << 1)\n\n/* If this bit is set, then `{...}' defines an interval, and \\{ and \\}\n     are literals.\n  If not set, then `\\{...\\}' defines an interval.  */\n#define RE_NO_BK_BRACES (RE_NEWLINE_ALT << 1)\n\n/* If this bit is set, (...) defines a group, and \\( and \\) are literals.\n   If not set, \\(...\\) defines a group, and ( and ) are literals.  */\n#define RE_NO_BK_PARENS (RE_NO_BK_BRACES << 1)\n\n/* If this bit is set, then \\<digit> matches <digit>.\n   If not set, then \\<digit> is a back-reference.  */\n#define RE_NO_BK_REFS (RE_NO_BK_PARENS << 1)\n\n/* If this bit is set, then | is an alternation operator, and \\| is literal.\n   If not set, then \\| is an alternation operator, and | is literal.  */\n#define RE_NO_BK_VBAR (RE_NO_BK_REFS << 1)\n\n/* If this bit is set, then an ending range point collating higher\n     than the starting range point, as in [z-a], is invalid.\n   If not set, then when ending range point collates higher than the\n     starting range point, the range is ignored.  */\n#define RE_NO_EMPTY_RANGES (RE_NO_BK_VBAR << 1)\n\n/* If this bit is set, then an unmatched ) is ordinary.\n   If not set, then an unmatched ) is invalid.  */\n#define RE_UNMATCHED_RIGHT_PAREN_ORD (RE_NO_EMPTY_RANGES << 1)\n\n/* If this bit is set, succeed as soon as we match the whole pattern,\n   without further backtracking.  */\n#define RE_NO_POSIX_BACKTRACKING (RE_UNMATCHED_RIGHT_PAREN_ORD << 1)\n\n/* If this bit is set, do not process the GNU regex operators.\n   If not set, then the GNU regex operators are recognized. */\n#define RE_NO_GNU_OPS (RE_NO_POSIX_BACKTRACKING << 1)\n\n/* If this bit is set, turn on internal regex debugging.\n   If not set, and debugging was on, turn it off.\n   This only works if regex.c is compiled -DDEBUG.\n   We define this bit always, so that all that's needed to turn on\n   debugging is to recompile regex.c; the calling code can always have\n   this bit set, and it won't affect anything in the normal case. */\n#define RE_DEBUG (RE_NO_GNU_OPS << 1)\n\n/* If this bit is set, a syntactically invalid interval is treated as\n   a string of ordinary characters.  For example, the ERE 'a{1' is\n   treated as 'a\\{1'.  */\n#define RE_INVALID_INTERVAL_ORD (RE_DEBUG << 1)\n\n/* If this bit is set, then ignore case when matching.\n   If not set, then case is significant.  */\n#define RE_ICASE (RE_INVALID_INTERVAL_ORD << 1)\n\n/* This bit is used internally like RE_CONTEXT_INDEP_ANCHORS but only\n   for ^, because it is difficult to scan the regex backwards to find\n   whether ^ should be special.  */\n#define RE_CARET_ANCHORS_HERE (RE_ICASE << 1)\n\n/* If this bit is set, then \\{ cannot be first in an bre or\n   immediately after an alternation or begin-group operator.  */\n#define RE_CONTEXT_INVALID_DUP (RE_CARET_ANCHORS_HERE << 1)\n\n/* If this bit is set, then no_sub will be set to 1 during\n   re_compile_pattern.  */\n#define RE_NO_SUB (RE_CONTEXT_INVALID_DUP << 1)\n\n/* This global variable defines the particular regexp syntax to use (for\n   some interfaces).  When a regexp is compiled, the syntax used is\n   stored in the pattern buffer, so changing this does not affect\n   already-compiled regexps.  */\nextern reg_syntax_t re_syntax_options;\n\f\n/* Define combinations of the above bits for the standard possibilities.\n   (The [[[ comments delimit what gets put into the Texinfo file, so\n   don't delete them!)  */\n/* [[[begin syntaxes]]] */\n#define RE_SYNTAX_EMACS 0\n\n#define RE_SYNTAX_AWK\t\t\t\t\t\t\t\\\n  (RE_BACKSLASH_ESCAPE_IN_LISTS   | RE_DOT_NOT_NULL\t\t\t\\\n   | RE_NO_BK_PARENS              | RE_NO_BK_REFS\t\t\t\\\n   | RE_NO_BK_VBAR                | RE_NO_EMPTY_RANGES\t\t\t\\\n   | RE_DOT_NEWLINE\t\t  | RE_CONTEXT_INDEP_ANCHORS\t\t\\\n   | RE_UNMATCHED_RIGHT_PAREN_ORD | RE_NO_GNU_OPS)\n\n#define RE_SYNTAX_GNU_AWK\t\t\t\t\t\t\\\n  ((RE_SYNTAX_POSIX_EXTENDED | RE_BACKSLASH_ESCAPE_IN_LISTS | RE_DEBUG)\t\\\n   & ~(RE_DOT_NOT_NULL | RE_INTERVALS | RE_CONTEXT_INDEP_OPS\t\t\\\n       | RE_CONTEXT_INVALID_OPS ))\n\n#define RE_SYNTAX_POSIX_AWK \t\t\t\t\t\t\\\n  (RE_SYNTAX_POSIX_EXTENDED | RE_BACKSLASH_ESCAPE_IN_LISTS\t\t\\\n   | RE_INTERVALS\t    | RE_NO_GNU_OPS)\n\n#define RE_SYNTAX_GREP\t\t\t\t\t\t\t\\\n  (RE_BK_PLUS_QM              | RE_CHAR_CLASSES\t\t\t\t\\\n   | RE_HAT_LISTS_NOT_NEWLINE | RE_INTERVALS\t\t\t\t\\\n   | RE_NEWLINE_ALT)\n\n#define RE_SYNTAX_EGREP\t\t\t\t\t\t\t\\\n  (RE_CHAR_CLASSES        | RE_CONTEXT_INDEP_ANCHORS\t\t\t\\\n   | RE_CONTEXT_INDEP_OPS | RE_HAT_LISTS_NOT_NEWLINE\t\t\t\\\n   | RE_NEWLINE_ALT       | RE_NO_BK_PARENS\t\t\t\t\\\n   | RE_NO_BK_VBAR)\n\n#define RE_SYNTAX_POSIX_EGREP\t\t\t\t\t\t\\\n  (RE_SYNTAX_EGREP | RE_INTERVALS | RE_NO_BK_BRACES\t\t\t\\\n   | RE_INVALID_INTERVAL_ORD)\n\n/* P1003.2/D11.2, section 4.20.7.1, lines 5078ff.  */\n#define RE_SYNTAX_ED RE_SYNTAX_POSIX_BASIC\n\n#define RE_SYNTAX_SED RE_SYNTAX_POSIX_BASIC\n\n/* Syntax bits common to both basic and extended POSIX regex syntax.  */\n#define _RE_SYNTAX_POSIX_COMMON\t\t\t\t\t\t\\\n  (RE_CHAR_CLASSES | RE_DOT_NEWLINE      | RE_DOT_NOT_NULL\t\t\\\n   | RE_INTERVALS  | RE_NO_EMPTY_RANGES)\n\n#define RE_SYNTAX_POSIX_BASIC\t\t\t\t\t\t\\\n  (_RE_SYNTAX_POSIX_COMMON | RE_BK_PLUS_QM | RE_CONTEXT_INVALID_DUP)\n\n/* Differs from ..._POSIX_BASIC only in that RE_BK_PLUS_QM becomes\n   RE_LIMITED_OPS, i.e., \\? \\+ \\| are not recognized.  Actually, this\n   isn't minimal, since other operators, such as \\`, aren't disabled.  */\n#define RE_SYNTAX_POSIX_MINIMAL_BASIC\t\t\t\t\t\\\n  (_RE_SYNTAX_POSIX_COMMON | RE_LIMITED_OPS)\n\n#define RE_SYNTAX_POSIX_EXTENDED\t\t\t\t\t\\\n  (_RE_SYNTAX_POSIX_COMMON  | RE_CONTEXT_INDEP_ANCHORS\t\t\t\\\n   | RE_CONTEXT_INDEP_OPS   | RE_NO_BK_BRACES\t\t\t\t\\\n   | RE_NO_BK_PARENS        | RE_NO_BK_VBAR\t\t\t\t\\\n   | RE_CONTEXT_INVALID_OPS | RE_UNMATCHED_RIGHT_PAREN_ORD)\n\n/* Differs from ..._POSIX_EXTENDED in that RE_CONTEXT_INDEP_OPS is\n   removed and RE_NO_BK_REFS is added.  */\n#define RE_SYNTAX_POSIX_MINIMAL_EXTENDED\t\t\t\t\\\n  (_RE_SYNTAX_POSIX_COMMON  | RE_CONTEXT_INDEP_ANCHORS\t\t\t\\\n   | RE_CONTEXT_INVALID_OPS | RE_NO_BK_BRACES\t\t\t\t\\\n   | RE_NO_BK_PARENS        | RE_NO_BK_REFS\t\t\t\t\\\n   | RE_NO_BK_VBAR\t    | RE_UNMATCHED_RIGHT_PAREN_ORD)\n/* [[[end syntaxes]]] */\n\f\n/* Maximum number of duplicates an interval can allow.  Some systems\n   (erroneously) define this in other header files, but we want our\n   value, so remove any previous define.  */\n#ifdef RE_DUP_MAX\n# undef RE_DUP_MAX\n#endif\n/* If sizeof(int) == 2, then ((1 << 15) - 1) overflows.  */\n#define RE_DUP_MAX (0x7fff)\n\n\n/* POSIX `cflags' bits (i.e., information for `regcomp').  */\n\n/* If this bit is set, then use extended regular expression syntax.\n   If not set, then use basic regular expression syntax.  */\n#define REG_EXTENDED 1\n\n/* If this bit is set, then ignore case when matching.\n   If not set, then case is significant.  */\n#define REG_ICASE (REG_EXTENDED << 1)\n\n/* If this bit is set, then anchors do not match at newline\n     characters in the string.\n   If not set, then anchors do match at newlines.  */\n#define REG_NEWLINE (REG_ICASE << 1)\n\n/* If this bit is set, then report only success or fail in regexec.\n   If not set, then returns differ between not matching and errors.  */\n#define REG_NOSUB (REG_NEWLINE << 1)\n\n\n/* POSIX `eflags' bits (i.e., information for regexec).  */\n\n/* If this bit is set, then the beginning-of-line operator doesn't match\n     the beginning of the string (presumably because it's not the\n     beginning of a line).\n   If not set, then the beginning-of-line operator does match the\n     beginning of the string.  */\n#define REG_NOTBOL 1\n\n/* Like REG_NOTBOL, except for the end-of-line.  */\n#define REG_NOTEOL (1 << 1)\n\n/* Use PMATCH[0] to delimit the start and end of the search in the\n   buffer.  */\n#define REG_STARTEND (1 << 2)\n\n\n/* If any error codes are removed, changed, or added, update the\n   `re_error_msg' table in regex.c.  */\ntypedef enum\n{\n#ifdef _XOPEN_SOURCE\n  REG_ENOSYS = -1,\t/* This will never happen for this implementation.  */\n#endif\n\n  REG_NOERROR = 0,\t/* Success.  */\n  REG_NOMATCH,\t\t/* Didn't find a match (for regexec).  */\n\n  /* POSIX regcomp return error codes.  (In the order listed in the\n     standard.)  */\n  REG_BADPAT,\t\t/* Invalid pattern.  */\n  REG_ECOLLATE,\t\t/* Inalid collating element.  */\n  REG_ECTYPE,\t\t/* Invalid character class name.  */\n  REG_EESCAPE,\t\t/* Trailing backslash.  */\n  REG_ESUBREG,\t\t/* Invalid back reference.  */\n  REG_EBRACK,\t\t/* Unmatched left bracket.  */\n  REG_EPAREN,\t\t/* Parenthesis imbalance.  */\n  REG_EBRACE,\t\t/* Unmatched \\{.  */\n  REG_BADBR,\t\t/* Invalid contents of \\{\\}.  */\n  REG_ERANGE,\t\t/* Invalid range end.  */\n  REG_ESPACE,\t\t/* Ran out of memory.  */\n  REG_BADRPT,\t\t/* No preceding re for repetition op.  */\n\n  /* Error codes we've added.  */\n  REG_EEND,\t\t/* Premature end.  */\n  REG_ESIZE,\t\t/* Compiled pattern bigger than 2^16 bytes.  */\n  REG_ERPAREN\t\t/* Unmatched ) or \\); not returned from regcomp.  */\n} reg_errcode_t;\n\f\n/* This data structure represents a compiled pattern.  Before calling\n   the pattern compiler, the fields `buffer', `allocated', `fastmap',\n   `translate', and `no_sub' can be set.  After the pattern has been\n   compiled, the `re_nsub' field is available.  All other fields are\n   private to the regex routines.  */\n\n#ifndef RE_TRANSLATE_TYPE\n# define RE_TRANSLATE_TYPE char *\n#endif\n\nstruct re_pattern_buffer\n{\n/* [[[begin pattern_buffer]]] */\n\t/* Space that holds the compiled pattern.  It is declared as\n          `unsigned char *' because its elements are\n           sometimes used as array indexes.  */\n  unsigned char *buffer;\n\n\t/* Number of bytes to which `buffer' points.  */\n  unsigned long int allocated;\n\n\t/* Number of bytes actually used in `buffer'.  */\n  unsigned long int used;\n\n        /* Syntax setting with which the pattern was compiled.  */\n  reg_syntax_t syntax;\n\n        /* Pointer to a fastmap, if any, otherwise zero.  re_search uses\n           the fastmap, if there is one, to skip over impossible\n           starting points for matches.  */\n  char *fastmap;\n\n        /* Either a translate table to apply to all characters before\n           comparing them, or zero for no translation.  The translation\n           is applied to a pattern when it is compiled and to a string\n           when it is matched.  */\n  RE_TRANSLATE_TYPE translate;\n\n\t/* Number of subexpressions found by the compiler.  */\n  size_t re_nsub;\n\n        /* Zero if this pattern cannot match the empty string, one else.\n           Well, in truth it's used only in `re_search_2', to see\n           whether or not we should use the fastmap, so we don't set\n           this absolutely perfectly; see `re_compile_fastmap' (the\n           `duplicate' case).  */\n  unsigned can_be_null : 1;\n\n        /* If REGS_UNALLOCATED, allocate space in the `regs' structure\n             for `max (RE_NREGS, re_nsub + 1)' groups.\n           If REGS_REALLOCATE, reallocate space if necessary.\n           If REGS_FIXED, use what's there.  */\n#define REGS_UNALLOCATED 0\n#define REGS_REALLOCATE 1\n#define REGS_FIXED 2\n  unsigned regs_allocated : 2;\n\n        /* Set to zero when `regex_compile' compiles a pattern; set to one\n           by `re_compile_fastmap' if it updates the fastmap.  */\n  unsigned fastmap_accurate : 1;\n\n        /* If set, `re_match_2' does not return information about\n           subexpressions.  */\n  unsigned no_sub : 1;\n\n        /* If set, a beginning-of-line anchor doesn't match at the\n           beginning of the string.  */\n  unsigned not_bol : 1;\n\n        /* Similarly for an end-of-line anchor.  */\n  unsigned not_eol : 1;\n\n        /* If true, an anchor at a newline matches.  */\n  unsigned newline_anchor : 1;\n\n/* [[[end pattern_buffer]]] */\n};\n\ntypedef struct re_pattern_buffer regex_t;\n\f\n/* Type for byte offsets within the string.  POSIX mandates this.  */\ntypedef int regoff_t;\n\n\n/* This is the structure we store register match data in.  See\n   regex.texinfo for a full description of what registers match.  */\nstruct re_registers\n{\n  unsigned num_regs;\n  regoff_t *start;\n  regoff_t *end;\n};\n\n\n/* If `regs_allocated' is REGS_UNALLOCATED in the pattern buffer,\n   `re_match_2' returns information about at least this many registers\n   the first time a `regs' structure is passed.  */\n#ifndef RE_NREGS\n# define RE_NREGS 30\n#endif\n\n\n/* POSIX specification for registers.  Aside from the different names than\n   `re_registers', POSIX uses an array of structures, instead of a\n   structure of arrays.  */\ntypedef struct\n{\n  regoff_t rm_so;  /* Byte offset from string's start to substring's start.  */\n  regoff_t rm_eo;  /* Byte offset from string's start to substring's end.  */\n} regmatch_t;\n\f\n/* Declarations for routines.  */\n\n/* To avoid duplicating every routine declaration -- once with a\n   prototype (if we are ANSI), and once without (if we aren't) -- we\n   use the following macro to declare argument types.  This\n   unfortunately clutters up the declarations a bit, but I think it's\n   worth it.  */\n\n#if __STDC__\n\n# define _RE_ARGS(args) args\n\n#else /* not __STDC__ */\n\n# define _RE_ARGS(args) ()\n\n#endif /* not __STDC__ */\n\n/* Sets the current default syntax to SYNTAX, and return the old syntax.\n   You can also simply assign to the `re_syntax_options' variable.  */\nextern reg_syntax_t re_set_syntax _RE_ARGS ((reg_syntax_t syntax));\n\n/* Compile the regular expression PATTERN, with length LENGTH\n   and syntax given by the global `re_syntax_options', into the buffer\n   BUFFER.  Return NULL if successful, and an error string if not.  */\nextern const char *re_compile_pattern\n  _RE_ARGS ((const char *pattern, size_t length,\n             struct re_pattern_buffer *buffer));\n\n\n/* Compile a fastmap for the compiled pattern in BUFFER; used to\n   accelerate searches.  Return 0 if successful and -2 if was an\n   internal error.  */\nextern int re_compile_fastmap _RE_ARGS ((struct re_pattern_buffer *buffer));\n\n\n/* Search in the string STRING (with length LENGTH) for the pattern\n   compiled into BUFFER.  Start searching at position START, for RANGE\n   characters.  Return the starting position of the match, -1 for no\n   match, or -2 for an internal error.  Also return register\n   information in REGS (if REGS and BUFFER->no_sub are nonzero).  */\nextern int re_search\n  _RE_ARGS ((struct re_pattern_buffer *buffer, const char *string,\n            int length, int start, int range, struct re_registers *regs));\n\n\n/* Like `re_search', but search in the concatenation of STRING1 and\n   STRING2.  Also, stop searching at index START + STOP.  */\nextern int re_search_2\n  _RE_ARGS ((struct re_pattern_buffer *buffer, const char *string1,\n             int length1, const char *string2, int length2,\n             int start, int range, struct re_registers *regs, int stop));\n\n\n/* Like `re_search', but return how many characters in STRING the regexp\n   in BUFFER matched, starting at position START.  */\nextern int re_match\n  _RE_ARGS ((struct re_pattern_buffer *buffer, const char *string,\n             int length, int start, struct re_registers *regs));\n\n\n/* Relates to `re_match' as `re_search_2' relates to `re_search'.  */\nextern int re_match_2\n  _RE_ARGS ((struct re_pattern_buffer *buffer, const char *string1,\n             int length1, const char *string2, int length2,\n             int start, struct re_registers *regs, int stop));\n\n\n/* Set REGS to hold NUM_REGS registers, storing them in STARTS and\n   ENDS.  Subsequent matches using BUFFER and REGS will use this memory\n   for recording register information.  STARTS and ENDS must be\n   allocated with malloc, and must each be at least `NUM_REGS * sizeof\n   (regoff_t)' bytes long.\n\n   If NUM_REGS == 0, then subsequent matches should allocate their own\n   register data.\n\n   Unless this function is called, the first search or match using\n   PATTERN_BUFFER will allocate its own register data, without\n   freeing the old data.  */\nextern void re_set_registers\n  _RE_ARGS ((struct re_pattern_buffer *buffer, struct re_registers *regs,\n             unsigned num_regs, regoff_t *starts, regoff_t *ends));\n\n#if defined _REGEX_RE_COMP || defined _LIBC\n# ifndef _CRAY\n/* 4.2 bsd compatibility.  */\nextern char *re_comp _RE_ARGS ((const char *));\nextern int re_exec _RE_ARGS ((const char *));\n# endif\n#endif\n\n/* GCC 2.95 and later have \"__restrict\"; C99 compilers have\n   \"restrict\", and \"configure\" may have defined \"restrict\".  */\n#ifndef __restrict\n# if ! (2 < __GNUC__ || (2 == __GNUC__ && 95 <= __GNUC_MINOR__))\n#  if defined restrict || 199901L <= __STDC_VERSION__\n#   define __restrict restrict\n#  else\n#   define __restrict\n#  endif\n# endif\n#endif\n/* gcc 3.1 and up support the [restrict] syntax.  */\n#ifndef __restrict_arr\n# if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1)\n#  define __restrict_arr __restrict\n# else\n#  define __restrict_arr\n# endif\n#endif\n\n/* POSIX compatibility.  */\nextern int regcomp _RE_ARGS ((regex_t *__restrict __preg,\n\t\t\t      const char *__restrict __pattern,\n\t\t\t      int __cflags));\n\nextern int regexec _RE_ARGS ((const regex_t *__restrict __preg,\n\t\t\t      const char *__restrict __string, size_t __nmatch,\n\t\t\t      regmatch_t __pmatch[__restrict_arr],\n\t\t\t      int __eflags));\n\nextern size_t regerror _RE_ARGS ((int __errcode, const regex_t *__preg,\n\t\t\t\t  char *__errbuf, size_t __errbuf_size));\n\nextern void regfree _RE_ARGS ((regex_t *__preg));\n\n\n#ifdef __cplusplus\n}\n#endif\t/* C++ */\n\n#endif /* regex.h */\n\f\n/*\nLocal variables:\nmake-backup-files: t\nversion-control: t\ntrim-versions-without-asking: nil\nEnd:\n*/\n"
  },
  {
    "path": "freebsd-headers/gnu/regex.h",
    "content": "/* $FreeBSD: release/9.0.0/gnu/lib/libregex/regex.h 126212 2004-02-25 02:39:10Z ache $ */\n#ifndef _REGEX_H\n#include <gnu/posix/regex.h>\n\n/* Document internal interfaces.  */\nextern reg_syntax_t __re_set_syntax _RE_ARGS ((reg_syntax_t syntax));\n\nextern const char *__re_compile_pattern\n  _RE_ARGS ((const char *pattern, size_t length,\n             struct re_pattern_buffer *buffer));\n\nextern int __re_compile_fastmap _RE_ARGS ((struct re_pattern_buffer *buffer));\n\nextern int __re_search\n  _RE_ARGS ((struct re_pattern_buffer *buffer, const char *string,\n            int length, int start, int range, struct re_registers *regs));\n\nextern int __re_search_2\n  _RE_ARGS ((struct re_pattern_buffer *buffer, const char *string1,\n             int length1, const char *string2, int length2,\n             int start, int range, struct re_registers *regs, int stop));\n\nextern int __re_match\n  _RE_ARGS ((struct re_pattern_buffer *buffer, const char *string,\n             int length, int start, struct re_registers *regs));\n\nextern int __re_match_2\n  _RE_ARGS ((struct re_pattern_buffer *buffer, const char *string1,\n             int length1, const char *string2, int length2,\n             int start, struct re_registers *regs, int stop));\n\nextern void __re_set_registers\n  _RE_ARGS ((struct re_pattern_buffer *buffer, struct re_registers *regs,\n             unsigned num_regs, regoff_t *starts, regoff_t *ends));\n\nextern int __regcomp _RE_ARGS ((regex_t *__preg, const char *__pattern,\n\t\t\t\tint __cflags));\n\nextern int __regexec _RE_ARGS ((const regex_t *__preg,\n\t\t\t\tconst char *__string, size_t __nmatch,\n\t\t\t\tregmatch_t __pmatch[], int __eflags));\n\nextern size_t __regerror _RE_ARGS ((int __errcode, const regex_t *__preg,\n\t\t\t\t    char *__errbuf, size_t __errbuf_size));\n\nextern void __regfree _RE_ARGS ((regex_t *__preg));\n#endif\n"
  },
  {
    "path": "freebsd-headers/gnuregex.h",
    "content": "/*-\n * Copyright (c) 2004 David E. O'Brien\n * Copyright (c) 2004 Andrey A. Chernov\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/gnu/lib/libregex/gnuregex.h 126224 2004-02-25 10:56:54Z ache $\n */\n\n#ifdef __GNUC__\n#warning \"Use -I/usr/include/gnu and <regex.h> instead of <gnuregex.h>\"\n#endif\n#include <gnu/regex.h>\n"
  },
  {
    "path": "freebsd-headers/gpib/gpib.h",
    "content": "/*-\n * Copyright (c) 2005 Poul-Henning Kamp\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * This file merely redirects to the file in <dev/ieee488/ugpib.h>\n *\n * $FreeBSD: release/9.0.0/lib/libgpib/gpib.h 141768 2005-02-12 21:07:09Z phk $\n */\n\n#include <dev/ieee488/ugpib.h>\n\n#define ibcntl\tibcnt\n"
  },
  {
    "path": "freebsd-headers/grp.h",
    "content": "/*-\n * Copyright (c) 1989, 1993\n *\tThe Regents of the University of California.  All rights reserved.\n * (c) UNIX System Laboratories, Inc.\n * All or some portions of this file are derived from material licensed\n * to the University of California by American Telephone and Telegraph\n * Co. or Unix System Laboratories, Inc. and are reproduced herein with\n * the permission of UNIX System Laboratories, Inc.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t@(#)grp.h\t8.2 (Berkeley) 1/21/94\n * $FreeBSD: release/9.0.0/include/grp.h 203964 2010-02-16 19:39:50Z imp $\n */\n\n#ifndef _GRP_H_\n#define\t_GRP_H_\n\n#include <sys/cdefs.h>\n#include <sys/_types.h>\n\n#define\t_PATH_GROUP\t\t\"/etc/group\"\n\n#ifndef _GID_T_DECLARED\ntypedef\t__gid_t\t\tgid_t;\n#define\t_GID_T_DECLARED\n#endif\n\n#ifndef _SIZE_T_DECLARED\ntypedef __size_t\tsize_t;\n#define _SIZE_T_DECLARED\n#endif\n\nstruct group {\n\tchar\t*gr_name;\t\t/* group name */\n\tchar\t*gr_passwd;\t\t/* group password */\n\tgid_t\tgr_gid;\t\t\t/* group id */\n\tchar\t**gr_mem;\t\t/* group members */\n};\n\n__BEGIN_DECLS\n#if __BSD_VISIBLE || __POSIX_VISIBLE >= 200112 || __XSI_VISIBLE\nvoid\t\t endgrent(void);\nstruct group\t*getgrent(void);\n#endif\nstruct group\t*getgrgid(gid_t);\nstruct group\t*getgrnam(const char *);\n#if __BSD_VISIBLE\nconst char\t*group_from_gid(gid_t, int);\n#endif\n#if __BSD_VISIBLE || __XSI_VISIBLE\n/* XXX IEEE Std 1003.1, 2003 specifies `void setgrent(void)' */\nint\t\t setgrent(void);\n#endif\n#if __BSD_VISIBLE || __POSIX_VISIBLE >= 200112 || __XSI_VISIBLE\nint\t\t getgrgid_r(gid_t, struct group *, char *, size_t,\n\t\t    struct group **);\nint\t\t getgrnam_r(const char *, struct group *, char *, size_t,\n\t\t    struct group **);\n#endif\n#if __BSD_VISIBLE\nint\t\t getgrent_r(struct group *, char *, size_t, struct group **);\nint\t\t setgroupent(int);\n#endif\n__END_DECLS\n\n#endif /* !_GRP_H_ */\n"
  },
  {
    "path": "freebsd-headers/gssapi/gssapi.h",
    "content": "/*\n * Copyright (C) The Internet Society (2000).  All Rights Reserved.\n *\n * This document and translations of it may be copied and furnished to\n * others, and derivative works that comment on or otherwise explain it\n * or assist in its implementation may be prepared, copied, published\n * and distributed, in whole or in part, without restriction of any\n * kind, provided that the above copyright notice and this paragraph are\n * included on all such copies and derivative works.  However, this\n * document itself may not be modified in any way, such as by removing\n * the copyright notice or references to the Internet Society or other\n * Internet organizations, except as needed for the purpose of\n * developing Internet standards in which case the procedures for\n * copyrights defined in the Internet Standards process must be\n * followed, or as required to translate it into languages other than\n * English.\n *\n * The limited permissions granted above are perpetual and will not be\n * revoked by the Internet Society or its successors or assigns.\n *\n * This document and the information contained herein is provided on an\n * \"AS IS\" basis and THE INTERNET SOCIETY AND THE INTERNET ENGINEERING\n * TASK FORCE DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING\n * BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION\n * HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED WARRANTIES OF\n * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.\n *\n * $FreeBSD: release/9.0.0/include/gssapi/gssapi.h 181344 2008-08-06 14:02:05Z dfr $\n */\n\n#ifndef _GSSAPI_GSSAPI_H_\n#define _GSSAPI_GSSAPI_H_\n\n/*\n * First, include stddef.h to get size_t defined.\n */\n#include <stddef.h>\n\n/*\n * Include stdint.h to get explicitly sized data types.\n */\n#include <stdint.h>\n\n#ifndef _SSIZE_T_DECLARED\ntypedef\t__ssize_t\tssize_t;\n#define\t_SSIZE_T_DECLARED\n#endif\n\n#if 0\n/*\n * If the platform supports the xom.h header file, it should be\n * included here.\n */\n#include <xom.h>\n#endif\n\n\n/*\n * Now define the three implementation-dependent types.\n */\ntypedef struct _gss_ctx_id_t *gss_ctx_id_t;\ntypedef struct _gss_cred_id_t *gss_cred_id_t;\ntypedef struct _gss_name_t *gss_name_t;\n\n/*\n * The following type must be defined as the smallest natural\n * unsigned integer supported by the platform that has at least\n * 32 bits of precision.\n */\ntypedef uint32_t gss_uint32;\n\n\n#ifdef OM_STRING\n/*\n * We have included the xom.h header file.  Verify that OM_uint32\n * is defined correctly.\n */\n\n#if sizeof(gss_uint32) != sizeof(OM_uint32)\n#error Incompatible definition of OM_uint32 from xom.h\n#endif\n\ntypedef OM_object_identifier gss_OID_desc, *gss_OID;\n\n#else\n\n/*\n * We can't use X/Open definitions, so roll our own.\n */\n\ntypedef gss_uint32 OM_uint32;\ntypedef uint64_t OM_uint64;\n\ntypedef struct gss_OID_desc_struct {\n  OM_uint32 length;\n  void      *elements;\n} gss_OID_desc, *gss_OID;\n\n#endif\n\ntypedef struct gss_OID_set_desc_struct  {\n  size_t     count;\n  gss_OID    elements;\n} gss_OID_set_desc, *gss_OID_set;\n\ntypedef struct gss_buffer_desc_struct {\n  size_t length;\n  void *value;\n} gss_buffer_desc, *gss_buffer_t;\n\ntypedef struct gss_channel_bindings_struct {\n  OM_uint32 initiator_addrtype;\n  gss_buffer_desc initiator_address;\n  OM_uint32 acceptor_addrtype;\n  gss_buffer_desc acceptor_address;\n  gss_buffer_desc application_data;\n} *gss_channel_bindings_t;\n\n/*\n * For now, define a QOP-type as an OM_uint32\n */\ntypedef OM_uint32 gss_qop_t;\n\ntypedef int gss_cred_usage_t;\n\n/*\n * Flag bits for context-level services.\n */\n#define GSS_C_DELEG_FLAG      1\n#define GSS_C_MUTUAL_FLAG     2\n#define GSS_C_REPLAY_FLAG     4\n#define GSS_C_SEQUENCE_FLAG   8\n#define GSS_C_CONF_FLAG       16\n#define GSS_C_INTEG_FLAG      32\n#define GSS_C_ANON_FLAG       64\n#define GSS_C_PROT_READY_FLAG 128\n#define GSS_C_TRANS_FLAG      256\n\n/*\n * Credential usage options\n */\n#define GSS_C_BOTH     0\n#define GSS_C_INITIATE 1\n#define GSS_C_ACCEPT   2\n\n/*\n * Status code types for gss_display_status\n */\n#define GSS_C_GSS_CODE  1\n#define GSS_C_MECH_CODE 2\n\n/*\n * The constant definitions for channel-bindings address families\n */\n#define GSS_C_AF_UNSPEC     0\n#define GSS_C_AF_LOCAL      1\n#define GSS_C_AF_INET       2\n#define GSS_C_AF_IMPLINK    3\n#define GSS_C_AF_PUP        4\n#define GSS_C_AF_CHAOS      5\n#define GSS_C_AF_NS         6\n#define GSS_C_AF_NBS        7\n#define GSS_C_AF_ECMA       8\n#define GSS_C_AF_DATAKIT    9\n#define GSS_C_AF_CCITT      10\n#define GSS_C_AF_SNA        11\n#define GSS_C_AF_DECnet     12\n#define GSS_C_AF_DLI        13\n#define GSS_C_AF_LAT        14\n#define GSS_C_AF_HYLINK     15\n#define GSS_C_AF_APPLETALK  16\n#define GSS_C_AF_BSC        17\n#define GSS_C_AF_DSS        18\n#define GSS_C_AF_OSI        19\n#define GSS_C_AF_X25        21\n#define GSS_C_AF_NULLADDR   255\n\n/*\n * Various Null values\n */\n#define GSS_C_NO_NAME ((gss_name_t) 0)\n#define GSS_C_NO_BUFFER ((gss_buffer_t) 0)\n#define GSS_C_NO_OID ((gss_OID) 0)\n#define GSS_C_NO_OID_SET ((gss_OID_set) 0)\n#define GSS_C_NO_CONTEXT ((gss_ctx_id_t) 0)\n#define GSS_C_NO_CREDENTIAL ((gss_cred_id_t) 0)\n#define GSS_C_NO_CHANNEL_BINDINGS ((gss_channel_bindings_t) 0)\n#define GSS_C_EMPTY_BUFFER {0, NULL}\n\n/*\n * Some alternate names for a couple of the above\n * values.  These are defined for V1 compatibility.\n */\n#define GSS_C_NULL_OID GSS_C_NO_OID\n#define GSS_C_NULL_OID_SET GSS_C_NO_OID_SET\n\n/*\n * Define the default Quality of Protection for per-message\n * services.  Note that an implementation that offers multiple\n * levels of QOP may define GSS_C_QOP_DEFAULT to be either zero\n * (as done here) to mean \"default protection\", or to a specific\n * explicit QOP value.  However, a value of 0 should always be\n * interpreted by a GSS-API implementation as a request for the\n * default protection level.\n */\n#define GSS_C_QOP_DEFAULT 0\n\n/*\n * Expiration time of 2^32-1 seconds means infinite lifetime for a\n * credential or security context\n */\n#define GSS_C_INDEFINITE 0xfffffffful\n\n/*\n * The implementation must reserve static storage for a\n * gss_OID_desc object containing the value\n * {10, (void *)\"\\x2a\\x86\\x48\\x86\\xf7\\x12\"\n * \"\\x01\\x02\\x01\\x01\"},\n * corresponding to an object-identifier value of\n * {iso(1) member-body(2) United States(840) mit(113554)\n * infosys(1) gssapi(2) generic(1) user_name(1)}.  The constant\n * GSS_C_NT_USER_NAME should be initialized to point\n * to that gss_OID_desc.\n */\nextern gss_OID GSS_C_NT_USER_NAME;\n\n/*\n * The implementation must reserve static storage for a\n * gss_OID_desc object containing the value\n * {10, (void *)\"\\x2a\\x86\\x48\\x86\\xf7\\x12\"\n *              \"\\x01\\x02\\x01\\x02\"},\n * corresponding to an object-identifier value of\n * {iso(1) member-body(2) United States(840) mit(113554)\n * infosys(1) gssapi(2) generic(1) machine_uid_name(2)}.\n * The constant GSS_C_NT_MACHINE_UID_NAME should be\n * initialized to point to that gss_OID_desc.\n */\nextern gss_OID GSS_C_NT_MACHINE_UID_NAME;\n\n/*\n * The implementation must reserve static storage for a\n * gss_OID_desc object containing the value\n * {10, (void *)\"\\x2a\\x86\\x48\\x86\\xf7\\x12\"\n *              \"\\x01\\x02\\x01\\x03\"},\n * corresponding to an object-identifier value of\n * {iso(1) member-body(2) United States(840) mit(113554)\n * infosys(1) gssapi(2) generic(1) string_uid_name(3)}.\n * The constant GSS_C_NT_STRING_UID_NAME should be\n * initialized to point to that gss_OID_desc.\n */\nextern gss_OID GSS_C_NT_STRING_UID_NAME;\n\n/*\n * The implementation must reserve static storage for a\n * gss_OID_desc object containing the value\n * {6, (void *)\"\\x2b\\x06\\x01\\x05\\x06\\x02\"},\n * corresponding to an object-identifier value of\n * {iso(1) org(3) dod(6) internet(1) security(5)\n * nametypes(6) gss-host-based-services(2)).  The constant\n * GSS_C_NT_HOSTBASED_SERVICE_X should be initialized to point\n * to that gss_OID_desc.  This is a deprecated OID value, and\n * implementations wishing to support hostbased-service names\n * should instead use the GSS_C_NT_HOSTBASED_SERVICE OID,\n * defined below, to identify such names;\n * GSS_C_NT_HOSTBASED_SERVICE_X should be accepted a synonym\n * for GSS_C_NT_HOSTBASED_SERVICE when presented as an input\n * parameter, but should not be emitted by GSS-API\n * implementations\n */\nextern gss_OID GSS_C_NT_HOSTBASED_SERVICE_X;\n\n/*\n * The implementation must reserve static storage for a\n * gss_OID_desc object containing the value\n * {10, (void *)\"\\x2a\\x86\\x48\\x86\\xf7\\x12\"\n *              \"\\x01\\x02\\x01\\x04\"}, corresponding to an\n * object-identifier value of {iso(1) member-body(2)\n * Unites States(840) mit(113554) infosys(1) gssapi(2)\n * generic(1) service_name(4)}.  The constant\n * GSS_C_NT_HOSTBASED_SERVICE should be initialized\n * to point to that gss_OID_desc.\n */\nextern gss_OID GSS_C_NT_HOSTBASED_SERVICE;\n\n/*\n * The implementation must reserve static storage for a\n * gss_OID_desc object containing the value\n * {6, (void *)\"\\x2b\\x06\\01\\x05\\x06\\x03\"},\n * corresponding to an object identifier value of\n * {1(iso), 3(org), 6(dod), 1(internet), 5(security),\n * 6(nametypes), 3(gss-anonymous-name)}.  The constant\n * and GSS_C_NT_ANONYMOUS should be initialized to point\n * to that gss_OID_desc.\n */\nextern gss_OID GSS_C_NT_ANONYMOUS;\n\n\n/*\n * The implementation must reserve static storage for a\n * gss_OID_desc object containing the value\n * {6, (void *)\"\\x2b\\x06\\x01\\x05\\x06\\x04\"},\n * corresponding to an object-identifier value of\n * {1(iso), 3(org), 6(dod), 1(internet), 5(security),\n * 6(nametypes), 4(gss-api-exported-name)}.  The constant\n * GSS_C_NT_EXPORT_NAME should be initialized to point\n * to that gss_OID_desc.\n */\nextern gss_OID GSS_C_NT_EXPORT_NAME;\n\n/*\n *   This name form shall be represented by the Object Identifier {iso(1)\n *   member-body(2) United States(840) mit(113554) infosys(1) gssapi(2)\n *   krb5(2) krb5_name(1)}.  The recommended symbolic name for this type\n *   is \"GSS_KRB5_NT_PRINCIPAL_NAME\".\n */\nextern gss_OID GSS_KRB5_NT_PRINCIPAL_NAME;\n\n/*\n * This name form shall be represented by the Object Identifier {iso(1)\n * member-body(2) United States(840) mit(113554) infosys(1) gssapi(2)\n * generic(1) user_name(1)}.  The recommended symbolic name for this\n * type is \"GSS_KRB5_NT_USER_NAME\".\n */\nextern gss_OID GSS_KRB5_NT_USER_NAME;\n\n/*\n * This name form shall be represented by the Object Identifier {iso(1)\n * member-body(2) United States(840) mit(113554) infosys(1) gssapi(2)\n * generic(1) machine_uid_name(2)}.  The recommended symbolic name for\n * this type is \"GSS_KRB5_NT_MACHINE_UID_NAME\".\n */\nextern gss_OID GSS_KRB5_NT_MACHINE_UID_NAME;\n\n/*\n * This name form shall be represented by the Object Identifier {iso(1)\n * member-body(2) United States(840) mit(113554) infosys(1) gssapi(2)\n * generic(1) string_uid_name(3)}.  The recommended symbolic name for\n * this type is \"GSS_KRB5_NT_STRING_UID_NAME\".\n */\nextern gss_OID GSS_KRB5_NT_STRING_UID_NAME;\n\n/* Major status codes */\n\n#define GSS_S_COMPLETE 0\n\n/*\n * Some \"helper\" definitions to make the status code macros obvious.\n */\n#define GSS_C_CALLING_ERROR_OFFSET 24\n#define GSS_C_ROUTINE_ERROR_OFFSET 16\n#define GSS_C_SUPPLEMENTARY_OFFSET 0\n#define GSS_C_CALLING_ERROR_MASK 0377ul\n#define GSS_C_ROUTINE_ERROR_MASK 0377ul\n#define GSS_C_SUPPLEMENTARY_MASK 0177777ul\n\n/*\n * The macros that test status codes for error conditions.\n * Note that the GSS_ERROR() macro has changed slightly from\n * the V1 GSS-API so that it now evaluates its argument\n * only once.\n */\n#define GSS_CALLING_ERROR(x) \\\n (x & (GSS_C_CALLING_ERROR_MASK << GSS_C_CALLING_ERROR_OFFSET))\n#define GSS_ROUTINE_ERROR(x) \\\n (x & (GSS_C_ROUTINE_ERROR_MASK << GSS_C_ROUTINE_ERROR_OFFSET))\n#define GSS_SUPPLEMENTARY_INFO(x) \\\n (x & (GSS_C_SUPPLEMENTARY_MASK << GSS_C_SUPPLEMENTARY_OFFSET))\n#define GSS_ERROR(x) \\\n (x & ((GSS_C_CALLING_ERROR_MASK << GSS_C_CALLING_ERROR_OFFSET) | \\\n       (GSS_C_ROUTINE_ERROR_MASK << GSS_C_ROUTINE_ERROR_OFFSET)))\n\n/*\n * Now the actual status code definitions\n */\n\n/*\n * Calling errors:\n */\n#define GSS_S_CALL_INACCESSIBLE_READ \\\n(1ul << GSS_C_CALLING_ERROR_OFFSET)\n#define GSS_S_CALL_INACCESSIBLE_WRITE \\\n(2ul << GSS_C_CALLING_ERROR_OFFSET)\n#define GSS_S_CALL_BAD_STRUCTURE \\\n(3ul << GSS_C_CALLING_ERROR_OFFSET)\n\n/*\n * Routine errors:\n */\n#define GSS_S_BAD_MECH             (1ul << GSS_C_ROUTINE_ERROR_OFFSET)\n#define GSS_S_BAD_NAME             (2ul << GSS_C_ROUTINE_ERROR_OFFSET)\n#define GSS_S_BAD_NAMETYPE         (3ul << GSS_C_ROUTINE_ERROR_OFFSET)\n#define GSS_S_BAD_BINDINGS         (4ul << GSS_C_ROUTINE_ERROR_OFFSET)\n#define GSS_S_BAD_STATUS           (5ul << GSS_C_ROUTINE_ERROR_OFFSET)\n#define GSS_S_BAD_SIG              (6ul << GSS_C_ROUTINE_ERROR_OFFSET)\n#define GSS_S_BAD_MIC\t\t   GSS_S_BAD_SIG\n#define GSS_S_NO_CRED              (7ul << GSS_C_ROUTINE_ERROR_OFFSET)\n#define GSS_S_NO_CONTEXT           (8ul << GSS_C_ROUTINE_ERROR_OFFSET)\n#define GSS_S_DEFECTIVE_TOKEN      (9ul << GSS_C_ROUTINE_ERROR_OFFSET)\n#define GSS_S_DEFECTIVE_CREDENTIAL (10ul << GSS_C_ROUTINE_ERROR_OFFSET)\n#define GSS_S_CREDENTIALS_EXPIRED  (11ul << GSS_C_ROUTINE_ERROR_OFFSET)\n#define GSS_S_CONTEXT_EXPIRED      (12ul << GSS_C_ROUTINE_ERROR_OFFSET)\n#define GSS_S_FAILURE              (13ul << GSS_C_ROUTINE_ERROR_OFFSET)\n#define GSS_S_BAD_QOP              (14ul << GSS_C_ROUTINE_ERROR_OFFSET)\n#define GSS_S_UNAUTHORIZED         (15ul << GSS_C_ROUTINE_ERROR_OFFSET)\n#define GSS_S_UNAVAILABLE          (16ul << GSS_C_ROUTINE_ERROR_OFFSET)\n#define GSS_S_DUPLICATE_ELEMENT    (17ul << GSS_C_ROUTINE_ERROR_OFFSET)\n#define GSS_S_NAME_NOT_MN          (18ul << GSS_C_ROUTINE_ERROR_OFFSET)\n\n/*\n * Supplementary info bits:\n */\n#define GSS_S_CONTINUE_NEEDED \\\n\t (1ul << (GSS_C_SUPPLEMENTARY_OFFSET + 0))\n#define GSS_S_DUPLICATE_TOKEN \\\n\t (1ul << (GSS_C_SUPPLEMENTARY_OFFSET + 1))\n#define GSS_S_OLD_TOKEN \\\n\t (1ul << (GSS_C_SUPPLEMENTARY_OFFSET + 2))\n#define GSS_S_UNSEQ_TOKEN \\\n\t (1ul << (GSS_C_SUPPLEMENTARY_OFFSET + 3))\n#define GSS_S_GAP_TOKEN \\\n\t (1ul << (GSS_C_SUPPLEMENTARY_OFFSET + 4))\n\n__BEGIN_DECLS\n\n/*\n * Finally, function prototypes for the GSS-API routines.\n */\nOM_uint32 gss_acquire_cred\n\t      (OM_uint32 *,            /* minor_status */\n\t       const gss_name_t,       /* desired_name */\n\t       OM_uint32,              /* time_req */\n\t       const gss_OID_set,      /* desired_mechs */\n\t       gss_cred_usage_t,       /* cred_usage */\n\t       gss_cred_id_t *,        /* output_cred_handle */\n\t       gss_OID_set *,          /* actual_mechs */\n\t       OM_uint32 *             /* time_rec */\n\t      );\n\nOM_uint32 gss_release_cred\n\t      (OM_uint32 *,            /* minor_status */\n\t       gss_cred_id_t *         /* cred_handle */\n\t      );\n\nOM_uint32 gss_init_sec_context\n\t      (OM_uint32 *,            /* minor_status */\n\t       const gss_cred_id_t,    /* initiator_cred_handle */\n\t       gss_ctx_id_t *,         /* context_handle */\n\t       const gss_name_t,       /* target_name */\n\t       const gss_OID,          /* mech_type */\n\t       OM_uint32,              /* req_flags */\n\t       OM_uint32,              /* time_req */\n\t       const gss_channel_bindings_t,\n\t\t\t\t       /* input_chan_bindings */\n\t       const gss_buffer_t,     /* input_token */\n\t       gss_OID *,              /* actual_mech_type */\n\t       gss_buffer_t,           /* output_token */\n\t       OM_uint32 *,            /* ret_flags */\n\t       OM_uint32 *             /* time_rec */\n\t      );\n\nOM_uint32 gss_accept_sec_context\n\t      (OM_uint32 *,            /* minor_status */\n\t       gss_ctx_id_t *,         /* context_handle */\n\t       const gss_cred_id_t,    /* acceptor_cred_handle */\n\t       const gss_buffer_t,     /* input_token_buffer */\n\t       const gss_channel_bindings_t,\n\t\t\t\t       /* input_chan_bindings */\n\t       gss_name_t *,           /* src_name */\n\t       gss_OID *,              /* mech_type */\n\t       gss_buffer_t,           /* output_token */\n\t       OM_uint32 *,            /* ret_flags */\n\t       OM_uint32 *,            /* time_rec */\n\t       gss_cred_id_t *         /* delegated_cred_handle */\n\t      );\n\nOM_uint32 gss_process_context_token\n\t      (OM_uint32 *,            /* minor_status */\n\t       const gss_ctx_id_t,     /* context_handle */\n\t       const gss_buffer_t      /* token_buffer */\n\t      );\n\nOM_uint32 gss_delete_sec_context\n\t      (OM_uint32 *,            /* minor_status */\n\t       gss_ctx_id_t *,         /* context_handle */\n\t       gss_buffer_t            /* output_token */\n\t      );\n\nOM_uint32 gss_context_time\n\t      (OM_uint32 *,            /* minor_status */\n\t       const gss_ctx_id_t,     /* context_handle */\n\t       OM_uint32 *             /* time_rec */\n\t      );\n\nOM_uint32 gss_get_mic\n\t      (OM_uint32 *,            /* minor_status */\n\t       const gss_ctx_id_t,     /* context_handle */\n\t       gss_qop_t,              /* qop_req */\n\t       const gss_buffer_t,     /* message_buffer */\n\t       gss_buffer_t            /* message_token */\n\t      );\n\nOM_uint32 gss_verify_mic\n\t      (OM_uint32 *,            /* minor_status */\n\t       const gss_ctx_id_t,     /* context_handle */\n\t       const gss_buffer_t,     /* message_buffer */\n\t       const gss_buffer_t,     /* token_buffer */\n\t       gss_qop_t *             /* qop_state */\n\t      );\n\nOM_uint32 gss_wrap\n\t      (OM_uint32 *,            /* minor_status */\n\t       const gss_ctx_id_t,     /* context_handle */\n\t       int,                    /* conf_req_flag */\n\t       gss_qop_t,              /* qop_req */\n\t       const gss_buffer_t,     /* input_message_buffer */\n\t       int *,                  /* conf_state */\n\t       gss_buffer_t            /* output_message_buffer */\n\t      );\n\nOM_uint32 gss_unwrap\n\t      (OM_uint32 *,            /* minor_status */\n\t       const gss_ctx_id_t,     /* context_handle */\n\t       const gss_buffer_t,     /* input_message_buffer */\n\t       gss_buffer_t,           /* output_message_buffer */\n\t       int *,                  /* conf_state */\n\t       gss_qop_t *             /* qop_state */\n\t      );\n\nOM_uint32 gss_display_status\n\t      (OM_uint32 *,            /* minor_status */\n\t       OM_uint32,              /* status_value */\n\t       int,                    /* status_type */\n\t       const gss_OID,          /* mech_type */\n\t       OM_uint32 *,            /* message_context */\n\t       gss_buffer_t            /* status_string */\n\t      );\n\nOM_uint32 gss_indicate_mechs\n\t      (OM_uint32 *,            /* minor_status */\n\t       gss_OID_set *           /* mech_set */\n\t      );\n\nOM_uint32 gss_compare_name\n\t      (OM_uint32 *,            /* minor_status */\n\t       const gss_name_t,       /* name1 */\n\t       const gss_name_t,       /* name2 */\n\t       int *                   /* name_equal */\n\t      );\n\nOM_uint32 gss_display_name\n\t      (OM_uint32 *,            /* minor_status */\n\t       const gss_name_t,       /* input_name */\n\t       gss_buffer_t,           /* output_name_buffer */\n\t       gss_OID *               /* output_name_type */\n\t      );\n\nOM_uint32 gss_import_name\n\t      (OM_uint32 *,            /* minor_status */\n\t       const gss_buffer_t,     /* input_name_buffer */\n\t       const gss_OID,          /* input_name_type */\n\t       gss_name_t *            /* output_name */\n\t      );\n\nOM_uint32 gss_export_name\n\t      (OM_uint32 *,            /* minor_status */\n\t       const gss_name_t,       /* input_name */\n\t       gss_buffer_t            /* exported_name */\n\t      );\n\nOM_uint32 gss_release_name\n\t      (OM_uint32 *,            /* minor_status */\n\t       gss_name_t *            /* input_name */\n\t      );\n\nOM_uint32 gss_release_buffer\n\t      (OM_uint32 *,            /* minor_status */\n\t       gss_buffer_t            /* buffer */\n\t      );\n\nOM_uint32 gss_release_oid_set\n\t      (OM_uint32 *,            /* minor_status */\n\t       gss_OID_set *           /* set */\n\t      );\n\nOM_uint32 gss_inquire_cred\n\t      (OM_uint32 *,            /* minor_status */\n\t       const gss_cred_id_t,    /* cred_handle */\n\t       gss_name_t *,           /* name */\n\t       OM_uint32 *,            /* lifetime */\n\t       gss_cred_usage_t *,     /* cred_usage */\n\t       gss_OID_set *           /* mechanisms */\n\t      );\n\nOM_uint32 gss_inquire_context (\n\t       OM_uint32 *,            /* minor_status */\n\t       const gss_ctx_id_t,     /* context_handle */\n\t       gss_name_t *,           /* src_name */\n\t       gss_name_t *,           /* targ_name */\n\t       OM_uint32 *,            /* lifetime_rec */\n\t       gss_OID *,              /* mech_type */\n\t       OM_uint32 *,            /* ctx_flags */\n\t       int *,                  /* locally_initiated */\n\t       int *                   /* open */\n\t      );\n\nOM_uint32 gss_wrap_size_limit (\n\t       OM_uint32 *,            /* minor_status */\n\t       const gss_ctx_id_t,     /* context_handle */\n\t       int,                    /* conf_req_flag */\n\t       gss_qop_t,              /* qop_req */\n\t       OM_uint32,              /* req_output_size */\n\t       OM_uint32 *             /* max_input_size */\n\t      );\n\nOM_uint32 gss_add_cred (\n\t       OM_uint32 *,            /* minor_status */\n\t       const gss_cred_id_t,    /* input_cred_handle */\n\t       const gss_name_t,       /* desired_name */\n\t       const gss_OID,          /* desired_mech */\n\t       gss_cred_usage_t,       /* cred_usage */\n\t       OM_uint32,              /* initiator_time_req */\n\t       OM_uint32,              /* acceptor_time_req */\n\t       gss_cred_id_t *,        /* output_cred_handle */\n\t       gss_OID_set *,          /* actual_mechs */\n\t       OM_uint32 *,            /* initiator_time_rec */\n\t       OM_uint32 *             /* acceptor_time_rec */\n\t      );\n\nOM_uint32 gss_inquire_cred_by_mech (\n\t       OM_uint32 *,            /* minor_status */\n\t       const gss_cred_id_t,    /* cred_handle */\n\t       const gss_OID,          /* mech_type */\n\t       gss_name_t *,           /* name */\n\t       OM_uint32 *,            /* initiator_lifetime */\n\t       OM_uint32 *,            /* acceptor_lifetime */\n\t       gss_cred_usage_t *      /* cred_usage */\n\t      );\n\nOM_uint32 gss_export_sec_context (\n\t       OM_uint32 *,            /* minor_status */\n\t       gss_ctx_id_t *,         /* context_handle */\n\t       gss_buffer_t            /* interprocess_token */\n\t      );\n\nOM_uint32 gss_import_sec_context (\n\t       OM_uint32 *,            /* minor_status */\n\t       const gss_buffer_t,     /* interprocess_token */\n\t       gss_ctx_id_t *          /* context_handle */\n\t      );\n\nOM_uint32 gss_create_empty_oid_set (\n\t       OM_uint32 *,            /* minor_status */\n\t       gss_OID_set *           /* oid_set */\n\t      );\n\nOM_uint32 gss_add_oid_set_member (\n\t       OM_uint32 *,            /* minor_status */\n\t       const gss_OID,          /* member_oid */\n\t       gss_OID_set *           /* oid_set */\n\t      );\n\nOM_uint32 gss_test_oid_set_member (\n\t       OM_uint32 *,            /* minor_status */\n\t       const gss_OID,          /* member */\n\t       const gss_OID_set,      /* set */\n\t       int *                   /* present */\n\t      );\n\nOM_uint32 gss_inquire_names_for_mech (\n\t       OM_uint32 *,            /* minor_status */\n\t       const gss_OID,          /* mechanism */\n\t       gss_OID_set *           /* name_types */\n\t      );\n\nOM_uint32 gss_inquire_mechs_for_name (\n\t       OM_uint32 *,            /* minor_status */\n\t       const gss_name_t,       /* input_name */\n\t       gss_OID_set *           /* mech_types */\n\t      );\n\nOM_uint32 gss_canonicalize_name (\n\t       OM_uint32 *,            /* minor_status */\n\t       const gss_name_t,       /* input_name */\n\t       const gss_OID,          /* mech_type */\n\t       gss_name_t *            /* output_name */\n\t      );\n\nOM_uint32 gss_duplicate_name (\n\t       OM_uint32 *,            /* minor_status */\n\t       const gss_name_t,       /* src_name */\n\t       gss_name_t *            /* dest_name */\n\t      );\n\n/*\n * The following routines are obsolete variants of gss_get_mic,\n * gss_verify_mic, gss_wrap and gss_unwrap.  They should be\n * provided by GSS-API V2 implementations for backwards\n * compatibility with V1 applications.  Distinct entrypoints\n * (as opposed to #defines) should be provided, both to allow\n * GSS-API V1 applications to link against GSS-API V2 implementations,\n * and to retain the slight parameter type differences between the\n * obsolete versions of these routines and their current forms.\n */\n\nOM_uint32 gss_sign\n\t      (OM_uint32 *,       /* minor_status */\n\t       gss_ctx_id_t,      /* context_handle */\n\t       int,               /* qop_req */\n\t       gss_buffer_t,      /* message_buffer */\n\t       gss_buffer_t       /* message_token */\n\t      );\n\n\nOM_uint32 gss_verify\n\t      (OM_uint32 *,       /* minor_status */\n\t       gss_ctx_id_t,      /* context_handle */\n\t       gss_buffer_t,      /* message_buffer */\n\t       gss_buffer_t,      /* token_buffer */\n\t       int *              /* qop_state */\n\t      );\n\nOM_uint32 gss_seal\n\t      (OM_uint32 *,       /* minor_status */\n\t       gss_ctx_id_t,      /* context_handle */\n\t       int,               /* conf_req_flag */\n\t       int,               /* qop_req */\n\t       gss_buffer_t,      /* input_message_buffer */\n\t       int *,             /* conf_state */\n\t       gss_buffer_t       /* output_message_buffer */\n\t      );\n\n\nOM_uint32 gss_unseal\n\t      (OM_uint32 *,       /* minor_status */\n\t       gss_ctx_id_t,      /* context_handle */\n\t       gss_buffer_t,      /* input_message_buffer */\n\t       gss_buffer_t,      /* output_message_buffer */\n\t       int *,             /* conf_state */\n\t       int *              /* qop_state */\n\t      );\n\n/*\n * Other extensions and helper functions.\n */\n\nint gss_oid_equal\n\t      (const gss_OID,\t  /* first OID to compare */\n\t       const gss_OID\t  /* second OID to compare */\n\t      );\n\nOM_uint32 gss_release_oid\n\t      (OM_uint32 *,\t  /* minor status */\n\t       gss_OID *\t  /* oid to free */\n\t      );\n\nOM_uint32 gss_decapsulate_token\n\t      (const gss_buffer_t,  /* mechanism independent token */\n\t       gss_OID,\t\t /* desired mechanism */\n\t       gss_buffer_t\t /* decapsulated mechanism dependant token */\n\t      );\n\nOM_uint32 gss_encapsulate_token\n\t      (const gss_buffer_t,  /* mechanism dependant token */\n\t       gss_OID,\t\t /* desired mechanism */\n\t       gss_buffer_t\t /* encapsulated mechanism independent token */\n\t      );\n\nOM_uint32 gss_duplicate_oid\n              (OM_uint32 *,\t/* minor status */\n\t       const gss_OID,\t/* oid to copy */\n\t       gss_OID *\t/* result */\n\t      );\n\nOM_uint32 gss_oid_to_str\n\t      (OM_uint32 *,\t/* minor status */\n\t       gss_OID,\t\t/* oid to convert */\n\t       gss_buffer_t\t/* buffer to contain string */\n\t      );\n\ntypedef struct gss_buffer_set_desc_struct  {\n  size_t\tcount;\n  gss_buffer_desc *elements;\n} gss_buffer_set_desc, *gss_buffer_set_t;\n\n#define GSS_C_NO_BUFFER_SET ((gss_buffer_set_t) 0)\n\nOM_uint32 gss_create_empty_buffer_set\n\t      (OM_uint32 *,\t\t/* minor status */\n\t       gss_buffer_set_t *\t/* location for new buffer set */\n\t      );\n\nOM_uint32 gss_add_buffer_set_member\n\t      (OM_uint32 *,\t\t/* minor status */\n\t       gss_buffer_t,\t\t/* buffer to add */\n\t       gss_buffer_set_t *\t/* set to add to */\n\t      );\n\nOM_uint32 gss_release_buffer_set\n\t      (OM_uint32 *,\t\t/* minor status */\n\t       gss_buffer_set_t *\t/* set to release */\n\t      );\n\nOM_uint32 gss_inquire_sec_context_by_oid\n\t      (OM_uint32 *,\t\t/* minor_status */\n\t       const gss_ctx_id_t,\t/* context_handle */\n\t       const gss_OID,\t\t/* desired_object */\n\t       gss_buffer_set_t *\t/* result */\n\t      );\n\nOM_uint32 gss_inquire_cred_by_oid\n\t      (OM_uint32 *,\t\t/* minor_status */\n\t       const gss_cred_id_t,\t/* cred_handle */\n\t       const gss_OID,\t\t/* desired_object */\n\t       gss_buffer_set_t *\t/* result */\n\t      );\n\nOM_uint32 gss_set_sec_context_option\n\t      (OM_uint32 *,\t\t/* minor status */\n\t       gss_ctx_id_t *,\t\t/* context */\n\t       const gss_OID,\t\t/* option to set */\n\t       const gss_buffer_t\t/* option value */\n\t      );\n\nOM_uint32 gss_set_cred_option\n\t      (OM_uint32 *,\t\t/* minor status */\n\t       gss_cred_id_t *,\t\t/* cred */\n\t       const gss_OID,\t\t/* option to set */\n\t       const gss_buffer_t\t/* option value */\n\t      );\n\nOM_uint32 gss_pseudo_random\n\t      (OM_uint32 *,\t\t/* minor status */\n\t       gss_ctx_id_t,\t\t/* context handle */\n\t       int prf_key,\t\t/* XXX */\n\t       const gss_buffer_t,\t/* data to seed generator */\n\t       ssize_t,\t\t\t/* amount of data required */\n\t       gss_buffer_t\t\t/* buffer for result */\n\t      );\n\n#ifdef _UID_T_DECLARED\nOM_uint32 gss_pname_to_uid\n\t      (OM_uint32 *,\t\t/* minor status */\n\t       const gss_name_t pname,\t/* principal name */\n\t       const gss_OID mech,\t/* mechanism to query */\n\t       uid_t *uidp\t\t/* pointer to UID for result */\n\t      );\n#endif\n\n__END_DECLS\n\n#endif /* _GSSAPI_GSSAPI_H_ */\n"
  },
  {
    "path": "freebsd-headers/gssapi/gssapi_krb5.h",
    "content": "/*\n * Copyright (c) 1997 - 2006 Kungliga Tekniska Hgskolan\n * (Royal Institute of Technology, Stockholm, Sweden). \n * All rights reserved. \n *\n * Redistribution and use in source and binary forms, with or without \n * modification, are permitted provided that the following conditions \n * are met: \n *\n * 1. Redistributions of source code must retain the above copyright \n *    notice, this list of conditions and the following disclaimer. \n *\n * 2. Redistributions in binary form must reproduce the above copyright \n *    notice, this list of conditions and the following disclaimer in the \n *    documentation and/or other materials provided with the distribution. \n *\n * 3. Neither the name of the Institute nor the names of its contributors \n *    may be used to endorse or promote products derived from this software \n *    without specific prior written permission. \n *\n * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND \n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE \n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE \n * ARE DISCLAIMED.  IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE \n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL \n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS \n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) \n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT \n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY \n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF \n * SUCH DAMAGE. \n */\n\n/* $Id: gssapi_krb5.h 20385 2007-04-18 08:51:32Z lha $ */\n\n#ifndef GSSAPI_KRB5_H_\n#define GSSAPI_KRB5_H_\n\n#include <gssapi/gssapi.h>\n\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\n/*\n * This is for kerberos5 names.\n */\n\nextern gss_OID GSS_KRB5_NT_PRINCIPAL_NAME;\nextern gss_OID GSS_KRB5_NT_USER_NAME;\nextern gss_OID GSS_KRB5_NT_MACHINE_UID_NAME;\nextern gss_OID GSS_KRB5_NT_STRING_UID_NAME;\n\nextern gss_OID GSS_KRB5_MECHANISM;\n\n/* for compatibility with MIT api */\n\n#define gss_mech_krb5 GSS_KRB5_MECHANISM\n#define gss_krb5_nt_general_name GSS_KRB5_NT_PRINCIPAL_NAME\n\n/* Extensions set contexts options */\nextern gss_OID GSS_KRB5_COPY_CCACHE_X;\nextern gss_OID GSS_KRB5_COMPAT_DES3_MIC_X;\nextern gss_OID GSS_KRB5_REGISTER_ACCEPTOR_IDENTITY_X;\nextern gss_OID GSS_KRB5_SET_DNS_CANONICALIZE_X;\nextern gss_OID GSS_KRB5_SEND_TO_KDC_X;\nextern gss_OID GSS_KRB5_SET_DEFAULT_REALM_X;\nextern gss_OID GSS_KRB5_CCACHE_NAME_X;\n/* Extensions inquire context */\nextern gss_OID GSS_KRB5_GET_TKT_FLAGS_X;\nextern gss_OID GSS_KRB5_EXTRACT_AUTHZ_DATA_FROM_SEC_CONTEXT_X;\nextern gss_OID GSS_C_PEER_HAS_UPDATED_SPNEGO;\nextern gss_OID GSS_KRB5_EXPORT_LUCID_CONTEXT_X;\nextern gss_OID GSS_KRB5_EXPORT_LUCID_CONTEXT_V1_X;\nextern gss_OID GSS_KRB5_GET_SUBKEY_X;\nextern gss_OID GSS_KRB5_GET_INITIATOR_SUBKEY_X;\nextern gss_OID GSS_KRB5_GET_ACCEPTOR_SUBKEY_X;\nextern gss_OID GSS_KRB5_GET_AUTHTIME_X;\nextern gss_OID GSS_KRB5_GET_SERVICE_KEYBLOCK_X;\n/* Extensions creds */\nextern gss_OID GSS_KRB5_IMPORT_CRED_X;\nextern gss_OID GSS_KRB5_SET_ALLOWABLE_ENCTYPES_X;\n\n/*\n * kerberos mechanism specific functions\n */\n\nstruct krb5_keytab_data;\nstruct krb5_ccache_data;\nstruct Principal;\n\nOM_uint32\ngss_krb5_ccache_name(OM_uint32 * /*minor_status*/, \n\t\t     const char * /*name */,\n\t\t     const char ** /*out_name */);\n\nOM_uint32 gsskrb5_register_acceptor_identity\n        (const char */*identity*/);\n\nOM_uint32 gss_krb5_copy_ccache\n\t(OM_uint32 */*minor*/,\n\t gss_cred_id_t /*cred*/,\n\t struct krb5_ccache_data */*out*/);\n\nOM_uint32\ngss_krb5_import_cred(OM_uint32 */*minor*/,\n\t\t     struct krb5_ccache_data * /*in*/,\n\t\t     struct Principal * /*keytab_principal*/,\n\t\t     struct krb5_keytab_data * /*keytab*/,\n\t\t     gss_cred_id_t */*out*/);\n\nOM_uint32 gss_krb5_get_tkt_flags\n\t(OM_uint32 */*minor*/,\n\t gss_ctx_id_t /*context_handle*/,\n\t OM_uint32 */*tkt_flags*/);\n\nOM_uint32\ngsskrb5_extract_authz_data_from_sec_context\n\t(OM_uint32 * /*minor_status*/,\n\t gss_ctx_id_t /*context_handle*/,\n\t int /*ad_type*/,\n\t gss_buffer_t /*ad_data*/);\n\nOM_uint32\ngsskrb5_set_dns_canonicalize(int);\n\nstruct gsskrb5_send_to_kdc {\n    void *func;\n    void *ptr;\n};\n\nOM_uint32\ngsskrb5_set_send_to_kdc(struct gsskrb5_send_to_kdc *);\n\nOM_uint32\ngsskrb5_set_default_realm(const char *);\n\nOM_uint32\ngsskrb5_extract_authtime_from_sec_context(OM_uint32 *, gss_ctx_id_t, time_t *);\n\nstruct EncryptionKey;\n\nOM_uint32 \ngsskrb5_extract_service_keyblock(OM_uint32 *minor_status,\n\t\t\t\t gss_ctx_id_t context_handle,\n\t\t\t\t struct EncryptionKey **out);\nOM_uint32 \ngsskrb5_get_initiator_subkey(OM_uint32 *minor_status,\n\t\t\t\t gss_ctx_id_t context_handle,\n\t\t\t\t struct EncryptionKey **out);\nOM_uint32 \ngsskrb5_get_subkey(OM_uint32 *minor_status,\n\t\t   gss_ctx_id_t context_handle,\n\t\t   struct EncryptionKey **out);\n\n/*\n * Lucid - NFSv4 interface to GSS-API KRB5 to expose key material to\n * do GSS content token handling in-kernel.\n */\n\ntypedef struct gss_krb5_lucid_key {\n\tOM_uint32\ttype;\n\tOM_uint32\tlength;\n\tvoid *\t\tdata;\n} gss_krb5_lucid_key_t;\n\ntypedef struct gss_krb5_rfc1964_keydata {\n\tOM_uint32\t\tsign_alg;\n\tOM_uint32\t\tseal_alg;\n\tgss_krb5_lucid_key_t\tctx_key;\n} gss_krb5_rfc1964_keydata_t;\n\ntypedef struct gss_krb5_cfx_keydata {\n\tOM_uint32\t\thave_acceptor_subkey;\n\tgss_krb5_lucid_key_t\tctx_key;\n\tgss_krb5_lucid_key_t\tacceptor_subkey;\n} gss_krb5_cfx_keydata_t;\n\ntypedef struct gss_krb5_lucid_context_v1 {\n\tOM_uint32\tversion;\n\tOM_uint32\tinitiate;\n\tOM_uint32\tendtime;\n\tOM_uint64\tsend_seq;\n\tOM_uint64\trecv_seq;\n\tOM_uint32\tprotocol;\n\tgss_krb5_rfc1964_keydata_t rfc1964_kd;\n\tgss_krb5_cfx_keydata_t\t   cfx_kd;\n} gss_krb5_lucid_context_v1_t;\n\ntypedef struct gss_krb5_lucid_context_version {\n\tOM_uint32\tversion;\t/* Structure version number */\n} gss_krb5_lucid_context_version_t;\n\n/*\n * Function declarations\n */\n\nOM_uint32\ngss_krb5_export_lucid_sec_context(OM_uint32 *minor_status,\n\t\t\t\t  gss_ctx_id_t *context_handle,\n\t\t\t\t  OM_uint32 version,\n\t\t\t\t  void **kctx);\n\n\nOM_uint32\ngss_krb5_free_lucid_sec_context(OM_uint32 *minor_status,\n\t\t\t\tvoid *kctx);\n\n\nOM_uint32\ngss_krb5_set_allowable_enctypes(OM_uint32 *minor_status, \n\t\t\t\tgss_cred_id_t cred,\n\t\t\t\tOM_uint32 num_enctypes,\n\t\t\t\tint32_t *enctypes);\n\n#ifdef __cplusplus\n}\n#endif\n\n#endif /* GSSAPI_SPNEGO_H_ */\n"
  },
  {
    "path": "freebsd-headers/gssapi.h",
    "content": "/* $FreeBSD: release/9.0.0/include/gssapi.h 153838 2005-12-29 14:40:22Z dfr $ */\n#ifdef __GNUC__\n#warning \"this file includes <gssapi.h> which is deprecated, use <gssapi/gssapi.h> instead\"\n#endif\n#include <gssapi/gssapi.h>\n"
  },
  {
    "path": "freebsd-headers/hdb-private.h",
    "content": "/* This is a generated file */\n#ifndef __hdb_private_h__\n#define __hdb_private_h__\n\n#include <stdarg.h>\n\nkrb5_error_code\n_hdb_fetch (\n\tkrb5_context /*context*/,\n\tHDB */*db*/,\n\tkrb5_const_principal /*principal*/,\n\tunsigned /*flags*/,\n\thdb_entry_ex */*entry*/);\n\nhdb_master_key\n_hdb_find_master_key (\n\tuint32_t */*mkvno*/,\n\thdb_master_key /*mkey*/);\n\nint\n_hdb_mkey_decrypt (\n\tkrb5_context /*context*/,\n\thdb_master_key /*key*/,\n\tkrb5_key_usage /*usage*/,\n\tvoid */*ptr*/,\n\tsize_t /*size*/,\n\tkrb5_data */*res*/);\n\nint\n_hdb_mkey_encrypt (\n\tkrb5_context /*context*/,\n\thdb_master_key /*key*/,\n\tkrb5_key_usage /*usage*/,\n\tconst void */*ptr*/,\n\tsize_t /*size*/,\n\tkrb5_data */*res*/);\n\nint\n_hdb_mkey_version (hdb_master_key /*mkey*/);\n\nkrb5_error_code\n_hdb_remove (\n\tkrb5_context /*context*/,\n\tHDB */*db*/,\n\tkrb5_const_principal /*principal*/);\n\nkrb5_error_code\n_hdb_store (\n\tkrb5_context /*context*/,\n\tHDB */*db*/,\n\tunsigned /*flags*/,\n\thdb_entry_ex */*entry*/);\n\n#endif /* __hdb_private_h__ */\n"
  },
  {
    "path": "freebsd-headers/hdb-protos.h",
    "content": "/* This is a generated file */\n#ifndef __hdb_protos_h__\n#define __hdb_protos_h__\n\n#include <stdarg.h>\n\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\nkrb5_error_code\nhdb_add_master_key (\n\tkrb5_context /*context*/,\n\tkrb5_keyblock */*key*/,\n\thdb_master_key */*inout*/);\n\nkrb5_error_code\nhdb_check_db_format (\n\tkrb5_context /*context*/,\n\tHDB */*db*/);\n\nkrb5_error_code\nhdb_clear_extension (\n\tkrb5_context /*context*/,\n\thdb_entry */*entry*/,\n\tint /*type*/);\n\nkrb5_error_code\nhdb_clear_master_key (\n\tkrb5_context /*context*/,\n\tHDB */*db*/);\n\nkrb5_error_code\nhdb_create (\n\tkrb5_context /*context*/,\n\tHDB **/*db*/,\n\tconst char */*filename*/);\n\nkrb5_error_code\nhdb_db_create (\n\tkrb5_context /*context*/,\n\tHDB **/*db*/,\n\tconst char */*filename*/);\n\nconst char *\nhdb_db_dir (krb5_context /*context*/);\n\nconst char *\nhdb_dbinfo_get_acl_file (\n\tkrb5_context /*context*/,\n\tstruct hdb_dbinfo */*dbp*/);\n\nconst krb5_config_binding *\nhdb_dbinfo_get_binding (\n\tkrb5_context /*context*/,\n\tstruct hdb_dbinfo */*dbp*/);\n\nconst char *\nhdb_dbinfo_get_dbname (\n\tkrb5_context /*context*/,\n\tstruct hdb_dbinfo */*dbp*/);\n\nconst char *\nhdb_dbinfo_get_label (\n\tkrb5_context /*context*/,\n\tstruct hdb_dbinfo */*dbp*/);\n\nconst char *\nhdb_dbinfo_get_log_file (\n\tkrb5_context /*context*/,\n\tstruct hdb_dbinfo */*dbp*/);\n\nconst char *\nhdb_dbinfo_get_mkey_file (\n\tkrb5_context /*context*/,\n\tstruct hdb_dbinfo */*dbp*/);\n\nstruct hdb_dbinfo *\nhdb_dbinfo_get_next (\n\tstruct hdb_dbinfo */*dbp*/,\n\tstruct hdb_dbinfo */*dbprevp*/);\n\nconst char *\nhdb_dbinfo_get_realm (\n\tkrb5_context /*context*/,\n\tstruct hdb_dbinfo */*dbp*/);\n\nconst char *\nhdb_default_db (krb5_context /*context*/);\n\nkrb5_error_code\nhdb_enctype2key (\n\tkrb5_context /*context*/,\n\thdb_entry */*e*/,\n\tkrb5_enctype /*enctype*/,\n\tKey **/*key*/);\n\nkrb5_error_code\nhdb_entry2string (\n\tkrb5_context /*context*/,\n\thdb_entry */*ent*/,\n\tchar **/*str*/);\n\nint\nhdb_entry2value (\n\tkrb5_context /*context*/,\n\tconst hdb_entry */*ent*/,\n\tkrb5_data */*value*/);\n\nint\nhdb_entry_alias2value (\n\tkrb5_context /*context*/,\n\tconst hdb_entry_alias */*alias*/,\n\tkrb5_data */*value*/);\n\nkrb5_error_code\nhdb_entry_check_mandatory (\n\tkrb5_context /*context*/,\n\tconst hdb_entry */*ent*/);\n\nint\nhdb_entry_clear_password (\n\tkrb5_context /*context*/,\n\thdb_entry */*entry*/);\n\nkrb5_error_code\nhdb_entry_get_ConstrainedDelegACL (\n\tconst hdb_entry */*entry*/,\n\tconst HDB_Ext_Constrained_delegation_acl **/*a*/);\n\nkrb5_error_code\nhdb_entry_get_aliases (\n\tconst hdb_entry */*entry*/,\n\tconst HDB_Ext_Aliases **/*a*/);\n\nint\nhdb_entry_get_password (\n\tkrb5_context /*context*/,\n\tHDB */*db*/,\n\tconst hdb_entry */*entry*/,\n\tchar **/*p*/);\n\nkrb5_error_code\nhdb_entry_get_pkinit_acl (\n\tconst hdb_entry */*entry*/,\n\tconst HDB_Ext_PKINIT_acl **/*a*/);\n\nkrb5_error_code\nhdb_entry_get_pkinit_hash (\n\tconst hdb_entry */*entry*/,\n\tconst HDB_Ext_PKINIT_hash **/*a*/);\n\nkrb5_error_code\nhdb_entry_get_pw_change_time (\n\tconst hdb_entry */*entry*/,\n\ttime_t */*t*/);\n\nint\nhdb_entry_set_password (\n\tkrb5_context /*context*/,\n\tHDB */*db*/,\n\thdb_entry */*entry*/,\n\tconst char */*p*/);\n\nkrb5_error_code\nhdb_entry_set_pw_change_time (\n\tkrb5_context /*context*/,\n\thdb_entry */*entry*/,\n\ttime_t /*t*/);\n\nHDB_extension *\nhdb_find_extension (\n\tconst hdb_entry */*entry*/,\n\tint /*type*/);\n\nkrb5_error_code\nhdb_foreach (\n\tkrb5_context /*context*/,\n\tHDB */*db*/,\n\tunsigned /*flags*/,\n\thdb_foreach_func_t /*func*/,\n\tvoid */*data*/);\n\nvoid\nhdb_free_dbinfo (\n\tkrb5_context /*context*/,\n\tstruct hdb_dbinfo **/*dbp*/);\n\nvoid\nhdb_free_entry (\n\tkrb5_context /*context*/,\n\thdb_entry_ex */*ent*/);\n\nvoid\nhdb_free_key (Key */*key*/);\n\nvoid\nhdb_free_keys (\n\tkrb5_context /*context*/,\n\tint /*len*/,\n\tKey */*keys*/);\n\nvoid\nhdb_free_master_key (\n\tkrb5_context /*context*/,\n\thdb_master_key /*mkey*/);\n\nkrb5_error_code\nhdb_generate_key_set (\n\tkrb5_context /*context*/,\n\tkrb5_principal /*principal*/,\n\tKey **/*ret_key_set*/,\n\tsize_t */*nkeyset*/,\n\tint /*no_salt*/);\n\nkrb5_error_code\nhdb_generate_key_set_password (\n\tkrb5_context /*context*/,\n\tkrb5_principal /*principal*/,\n\tconst char */*password*/,\n\tKey **/*keys*/,\n\tsize_t */*num_keys*/);\n\nint\nhdb_get_dbinfo (\n\tkrb5_context /*context*/,\n\tstruct hdb_dbinfo **/*dbp*/);\n\nkrb5_error_code\nhdb_init_db (\n\tkrb5_context /*context*/,\n\tHDB */*db*/);\n\nint\nhdb_key2principal (\n\tkrb5_context /*context*/,\n\tkrb5_data */*key*/,\n\tkrb5_principal /*p*/);\n\nkrb5_error_code\nhdb_ldap_common (\n\tkrb5_context /*context*/,\n\tHDB ** /*db*/,\n\tconst char */*search_base*/,\n\tconst char */*url*/);\n\nkrb5_error_code\nhdb_ldap_create (\n\tkrb5_context /*context*/,\n\tHDB ** /*db*/,\n\tconst char */*arg*/);\n\nkrb5_error_code\nhdb_ldapi_create (\n\tkrb5_context /*context*/,\n\tHDB ** /*db*/,\n\tconst char */*arg*/);\n\nkrb5_error_code\nhdb_list_builtin (\n\tkrb5_context /*context*/,\n\tchar **/*list*/);\n\nkrb5_error_code\nhdb_lock (\n\tint /*fd*/,\n\tint /*operation*/);\n\nkrb5_error_code\nhdb_ndbm_create (\n\tkrb5_context /*context*/,\n\tHDB **/*db*/,\n\tconst char */*filename*/);\n\nkrb5_error_code\nhdb_next_enctype2key (\n\tkrb5_context /*context*/,\n\tconst hdb_entry */*e*/,\n\tkrb5_enctype /*enctype*/,\n\tKey **/*key*/);\n\nint\nhdb_principal2key (\n\tkrb5_context /*context*/,\n\tkrb5_const_principal /*p*/,\n\tkrb5_data */*key*/);\n\nkrb5_error_code\nhdb_print_entry (\n\tkrb5_context /*context*/,\n\tHDB */*db*/,\n\thdb_entry_ex */*entry*/,\n\tvoid */*data*/);\n\nkrb5_error_code\nhdb_process_master_key (\n\tkrb5_context /*context*/,\n\tint /*kvno*/,\n\tkrb5_keyblock */*key*/,\n\tkrb5_enctype /*etype*/,\n\thdb_master_key */*mkey*/);\n\nkrb5_error_code\nhdb_read_master_key (\n\tkrb5_context /*context*/,\n\tconst char */*filename*/,\n\thdb_master_key */*mkey*/);\n\nkrb5_error_code\nhdb_replace_extension (\n\tkrb5_context /*context*/,\n\thdb_entry */*entry*/,\n\tconst HDB_extension */*ext*/);\n\nkrb5_error_code\nhdb_seal_key (\n\tkrb5_context /*context*/,\n\tHDB */*db*/,\n\tKey */*k*/);\n\nkrb5_error_code\nhdb_seal_key_mkey (\n\tkrb5_context /*context*/,\n\tKey */*k*/,\n\thdb_master_key /*mkey*/);\n\nkrb5_error_code\nhdb_seal_keys (\n\tkrb5_context /*context*/,\n\tHDB */*db*/,\n\thdb_entry */*ent*/);\n\nkrb5_error_code\nhdb_seal_keys_mkey (\n\tkrb5_context /*context*/,\n\thdb_entry */*ent*/,\n\thdb_master_key /*mkey*/);\n\nkrb5_error_code\nhdb_set_master_key (\n\tkrb5_context /*context*/,\n\tHDB */*db*/,\n\tkrb5_keyblock */*key*/);\n\nkrb5_error_code\nhdb_set_master_keyfile (\n\tkrb5_context /*context*/,\n\tHDB */*db*/,\n\tconst char */*keyfile*/);\n\nkrb5_error_code\nhdb_unlock (int /*fd*/);\n\nkrb5_error_code\nhdb_unseal_key (\n\tkrb5_context /*context*/,\n\tHDB */*db*/,\n\tKey */*k*/);\n\nkrb5_error_code\nhdb_unseal_key_mkey (\n\tkrb5_context /*context*/,\n\tKey */*k*/,\n\thdb_master_key /*mkey*/);\n\nkrb5_error_code\nhdb_unseal_keys (\n\tkrb5_context /*context*/,\n\tHDB */*db*/,\n\thdb_entry */*ent*/);\n\nkrb5_error_code\nhdb_unseal_keys_mkey (\n\tkrb5_context /*context*/,\n\thdb_entry */*ent*/,\n\thdb_master_key /*mkey*/);\n\nint\nhdb_value2entry (\n\tkrb5_context /*context*/,\n\tkrb5_data */*value*/,\n\thdb_entry */*ent*/);\n\nint\nhdb_value2entry_alias (\n\tkrb5_context /*context*/,\n\tkrb5_data */*value*/,\n\thdb_entry_alias */*ent*/);\n\nkrb5_error_code\nhdb_write_master_key (\n\tkrb5_context /*context*/,\n\tconst char */*filename*/,\n\thdb_master_key /*mkey*/);\n\n#ifdef __cplusplus\n}\n#endif\n\n#endif /* __hdb_protos_h__ */\n"
  },
  {
    "path": "freebsd-headers/hdb.h",
    "content": "/*\n * Copyright (c) 1997 - 2007 Kungliga Tekniska Hgskolan\n * (Royal Institute of Technology, Stockholm, Sweden). \n * All rights reserved. \n *\n * Redistribution and use in source and binary forms, with or without \n * modification, are permitted provided that the following conditions \n * are met: \n *\n * 1. Redistributions of source code must retain the above copyright \n *    notice, this list of conditions and the following disclaimer. \n *\n * 2. Redistributions in binary form must reproduce the above copyright \n *    notice, this list of conditions and the following disclaimer in the \n *    documentation and/or other materials provided with the distribution. \n *\n * 3. Neither the name of the Institute nor the names of its contributors \n *    may be used to endorse or promote products derived from this software \n *    without specific prior written permission. \n *\n * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND \n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE \n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE \n * ARE DISCLAIMED.  IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE \n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL \n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS \n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) \n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT \n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY \n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF \n * SUCH DAMAGE. \n */\n\n/* $Id: hdb.h 22198 2007-12-07 13:09:25Z lha $ */\n\n#ifndef __HDB_H__\n#define __HDB_H__\n\n#include <hdb_err.h>\n\n#include <heim_asn1.h>\n#include <hdb_asn1.h>\n\nstruct hdb_dbinfo;\n\nenum hdb_lockop{ HDB_RLOCK, HDB_WLOCK };\n\n/* flags for various functions */\n#define HDB_F_DECRYPT\t\t1\t/* decrypt keys */\n#define HDB_F_REPLACE\t\t2\t/* replace entry */\n#define HDB_F_GET_CLIENT\t4\t/* fetch client */\n#define HDB_F_GET_SERVER\t8\t/* fetch server */\n#define HDB_F_GET_KRBTGT\t16\t/* fetch krbtgt */\n#define HDB_F_GET_ANY\t\t28\t/* fetch any of client,server,krbtgt */\n#define HDB_F_CANON\t\t32\t/* want canonicalition */\n\n/* key usage for master key */\n#define HDB_KU_MKEY\t0x484442\n\ntypedef struct hdb_master_key_data *hdb_master_key;\n\ntypedef struct hdb_entry_ex {\n    void *ctx;\n    hdb_entry entry;\n    void (*free_entry)(krb5_context, struct hdb_entry_ex *);\n} hdb_entry_ex;\n\n\ntypedef struct HDB{\n    void *hdb_db;\n    void *hdb_dbc;\n    char *hdb_name;\n    int hdb_master_key_set;\n    hdb_master_key hdb_master_key;\n    int hdb_openp;\n\n    krb5_error_code (*hdb_open)(krb5_context,\n\t\t\t\tstruct HDB*,\n\t\t\t\tint,\n\t\t\t\tmode_t);\n    krb5_error_code (*hdb_close)(krb5_context, \n\t\t\t\t struct HDB*);\n    void\t    (*hdb_free)(krb5_context,\n\t\t\t\tstruct HDB*,\n\t\t\t\thdb_entry_ex*);\n    krb5_error_code (*hdb_fetch)(krb5_context,\n\t\t\t\t struct HDB*,\n\t\t\t\t krb5_const_principal,\n\t\t\t\t unsigned,\n\t\t\t\t hdb_entry_ex*);\n    krb5_error_code (*hdb_store)(krb5_context,\n\t\t\t\t struct HDB*,\n\t\t\t\t unsigned,\n\t\t\t\t hdb_entry_ex*);\n    krb5_error_code (*hdb_remove)(krb5_context,\n\t\t\t\t  struct HDB*,\n\t\t\t\t  krb5_const_principal);\n    krb5_error_code (*hdb_firstkey)(krb5_context,\n\t\t\t\t    struct HDB*,\n\t\t\t\t    unsigned,\n\t\t\t\t    hdb_entry_ex*);\n    krb5_error_code (*hdb_nextkey)(krb5_context,\n\t\t\t\t   struct HDB*,\n\t\t\t\t   unsigned,\n\t\t\t\t   hdb_entry_ex*);\n    krb5_error_code (*hdb_lock)(krb5_context,\n\t\t\t\tstruct HDB*,\n\t\t\t\tint operation);\n    krb5_error_code (*hdb_unlock)(krb5_context,\n\t\t\t\t  struct HDB*);\n    krb5_error_code (*hdb_rename)(krb5_context,\n\t\t\t\t  struct HDB*,\n\t\t\t\t  const char*);\n    krb5_error_code (*hdb__get)(krb5_context,\n\t\t\t\tstruct HDB*,\n\t\t\t\tkrb5_data,\n\t\t\t\tkrb5_data*);\n    krb5_error_code (*hdb__put)(krb5_context,\n\t\t\t\tstruct HDB*,\n\t\t\t\tint, \n\t\t\t\tkrb5_data,\n\t\t\t\tkrb5_data);\n    krb5_error_code (*hdb__del)(krb5_context, \n\t\t\t\tstruct HDB*,\n\t\t\t\tkrb5_data);\n    krb5_error_code (*hdb_destroy)(krb5_context,\n\t\t\t\t   struct HDB*);\n}HDB;\n\n#define HDB_INTERFACE_VERSION\t4\n\nstruct hdb_so_method {\n    int version;\n    const char *prefix;\n    krb5_error_code (*create)(krb5_context, HDB **, const char *filename);\n};\n\ntypedef krb5_error_code (*hdb_foreach_func_t)(krb5_context, HDB*,\n\t\t\t\t\t      hdb_entry_ex*, void*);\nextern krb5_kt_ops hdb_kt_ops;\n\n#include <hdb-protos.h>\n\n#endif /* __HDB_H__ */\n"
  },
  {
    "path": "freebsd-headers/hdb_asn1.h",
    "content": "/* Generated from /usr/src/kerberos5/lib/libhdb/../../../crypto/heimdal/lib/hdb/hdb.asn1 */\n/* Do not edit */\n\n#ifndef __hdb_asn1_h__\n#define __hdb_asn1_h__\n\n#include <stddef.h>\n#include <time.h>\n\n#ifndef __asn1_common_definitions__\n#define __asn1_common_definitions__\n\ntypedef struct heim_integer {\n  size_t length;\n  void *data;\n  int negative;\n} heim_integer;\n\ntypedef struct heim_octet_string {\n  size_t length;\n  void *data;\n} heim_octet_string;\n\ntypedef char *heim_general_string;\n\ntypedef char *heim_utf8_string;\n\ntypedef char *heim_printable_string;\n\ntypedef char *heim_ia5_string;\n\ntypedef struct heim_bmp_string {\n  size_t length;\n  uint16_t *data;\n} heim_bmp_string;\n\ntypedef struct heim_universal_string {\n  size_t length;\n  uint32_t *data;\n} heim_universal_string;\n\ntypedef char *heim_visible_string;\n\ntypedef struct heim_oid {\n  size_t length;\n  unsigned *components;\n} heim_oid;\n\ntypedef struct heim_bit_string {\n  size_t length;\n  void *data;\n} heim_bit_string;\n\ntypedef struct heim_octet_string heim_any;\ntypedef struct heim_octet_string heim_any_set;\n\n#define ASN1_MALLOC_ENCODE(T, B, BL, S, L, R)                  \\\n  do {                                                         \\\n    (BL) = length_##T((S));                                    \\\n    (B) = malloc((BL));                                        \\\n    if((B) == NULL) {                                          \\\n      (R) = ENOMEM;                                            \\\n    } else {                                                   \\\n      (R) = encode_##T(((unsigned char*)(B)) + (BL) - 1, (BL), \\\n                       (S), (L));                              \\\n      if((R) != 0) {                                           \\\n        free((B));                                             \\\n        (B) = NULL;                                            \\\n      }                                                        \\\n    }                                                          \\\n  } while (0)\n\nstruct units;\n\n#endif\n\n#include <krb5_asn1.h>\nenum { HDB_DB_FORMAT = 2 };\n\nenum { hdb_pw_salt = 3 };\n\nenum { hdb_afs3_salt = 10 };\n\n/*\nSalt ::= SEQUENCE {\n  type            [0] INTEGER (0..-1),\n  salt            [1] OCTET STRING,\n}\n*/\n\ntypedef struct Salt {\n  unsigned int type;\n  heim_octet_string salt;\n} Salt;\n\nint    encode_Salt(unsigned char *, size_t, const Salt *, size_t *);\nint    decode_Salt(const unsigned char *, size_t, Salt *, size_t *);\nvoid   free_Salt  (Salt *);\nsize_t length_Salt(const Salt *);\nint    copy_Salt  (const Salt *, Salt *);\n\n\n/*\nKey ::= SEQUENCE {\n  mkvno           [0] INTEGER (0..-1) OPTIONAL,\n  key             [1] EncryptionKey,\n  salt            [2] Salt OPTIONAL,\n}\n*/\n\ntypedef struct Key {\n  unsigned int *mkvno;\n  EncryptionKey key;\n  Salt *salt;\n} Key;\n\nint    encode_Key(unsigned char *, size_t, const Key *, size_t *);\nint    decode_Key(const unsigned char *, size_t, Key *, size_t *);\nvoid   free_Key  (Key *);\nsize_t length_Key(const Key *);\nint    copy_Key  (const Key *, Key *);\n\n\n/*\nEvent ::= SEQUENCE {\n  time            [0] KerberosTime,\n  principal       [1] Principal OPTIONAL,\n}\n*/\n\ntypedef struct Event {\n  KerberosTime time;\n  Principal *principal;\n} Event;\n\nint    encode_Event(unsigned char *, size_t, const Event *, size_t *);\nint    decode_Event(const unsigned char *, size_t, Event *, size_t *);\nvoid   free_Event  (Event *);\nsize_t length_Event(const Event *);\nint    copy_Event  (const Event *, Event *);\n\n\n/*\nHDBFlags ::= BIT STRING {\n  initial(0),\n  forwardable(1),\n  proxiable(2),\n  renewable(3),\n  postdate(4),\n  server(5),\n  client(6),\n  invalid(7),\n  require-preauth(8),\n  change-pw(9),\n  require-hwauth(10),\n  ok-as-delegate(11),\n  user-to-user(12),\n  immutable(13),\n  trusted-for-delegation(14),\n  allow-kerberos4(15),\n  allow-digest(16)\n}\n*/\n\ntypedef struct HDBFlags {\n  unsigned int initial:1;\n  unsigned int forwardable:1;\n  unsigned int proxiable:1;\n  unsigned int renewable:1;\n  unsigned int postdate:1;\n  unsigned int server:1;\n  unsigned int client:1;\n  unsigned int invalid:1;\n  unsigned int require_preauth:1;\n  unsigned int change_pw:1;\n  unsigned int require_hwauth:1;\n  unsigned int ok_as_delegate:1;\n  unsigned int user_to_user:1;\n  unsigned int immutable:1;\n  unsigned int trusted_for_delegation:1;\n  unsigned int allow_kerberos4:1;\n  unsigned int allow_digest:1;\n} HDBFlags;\n\n\nint    encode_HDBFlags(unsigned char *, size_t, const HDBFlags *, size_t *);\nint    decode_HDBFlags(const unsigned char *, size_t, HDBFlags *, size_t *);\nvoid   free_HDBFlags  (HDBFlags *);\nsize_t length_HDBFlags(const HDBFlags *);\nint    copy_HDBFlags  (const HDBFlags *, HDBFlags *);\nunsigned HDBFlags2int(HDBFlags);\nHDBFlags int2HDBFlags(unsigned);\n#ifdef __PARSE_UNITS_H__\nconst struct units * asn1_HDBFlags_units(void);\n#endif\n\n\n/*\nGENERATION ::= SEQUENCE {\n  time            [0] KerberosTime,\n  usec            [1] INTEGER (0..-1),\n  gen             [2] INTEGER (0..-1),\n}\n*/\n\ntypedef struct GENERATION {\n  KerberosTime time;\n  unsigned int usec;\n  unsigned int gen;\n} GENERATION;\n\nint    encode_GENERATION(unsigned char *, size_t, const GENERATION *, size_t *);\nint    decode_GENERATION(const unsigned char *, size_t, GENERATION *, size_t *);\nvoid   free_GENERATION  (GENERATION *);\nsize_t length_GENERATION(const GENERATION *);\nint    copy_GENERATION  (const GENERATION *, GENERATION *);\n\n\n/*\nHDB-Ext-PKINIT-acl ::= SEQUENCE OF SEQUENCE {\n  subject         [0]   UTF8String,\n  issuer          [1]   UTF8String OPTIONAL,\n  anchor          [2]   UTF8String OPTIONAL,\n}\n*/\n\ntypedef struct HDB_Ext_PKINIT_acl {\n  unsigned int len;\n  struct  {\n    heim_utf8_string subject;\n    heim_utf8_string *issuer;\n    heim_utf8_string *anchor;\n  } *val;\n} HDB_Ext_PKINIT_acl;\n\nint    encode_HDB_Ext_PKINIT_acl(unsigned char *, size_t, const HDB_Ext_PKINIT_acl *, size_t *);\nint    decode_HDB_Ext_PKINIT_acl(const unsigned char *, size_t, HDB_Ext_PKINIT_acl *, size_t *);\nvoid   free_HDB_Ext_PKINIT_acl  (HDB_Ext_PKINIT_acl *);\nsize_t length_HDB_Ext_PKINIT_acl(const HDB_Ext_PKINIT_acl *);\nint    copy_HDB_Ext_PKINIT_acl  (const HDB_Ext_PKINIT_acl *, HDB_Ext_PKINIT_acl *);\n\n\n/*\nHDB-Ext-PKINIT-hash ::= SEQUENCE OF SEQUENCE {\n  digest-type     [0]   OBJECT IDENTIFIER,\n  digest          [1] OCTET STRING,\n}\n*/\n\ntypedef struct HDB_Ext_PKINIT_hash {\n  unsigned int len;\n  struct  {\n    heim_oid digest_type;\n    heim_octet_string digest;\n  } *val;\n} HDB_Ext_PKINIT_hash;\n\nint    encode_HDB_Ext_PKINIT_hash(unsigned char *, size_t, const HDB_Ext_PKINIT_hash *, size_t *);\nint    decode_HDB_Ext_PKINIT_hash(const unsigned char *, size_t, HDB_Ext_PKINIT_hash *, size_t *);\nvoid   free_HDB_Ext_PKINIT_hash  (HDB_Ext_PKINIT_hash *);\nsize_t length_HDB_Ext_PKINIT_hash(const HDB_Ext_PKINIT_hash *);\nint    copy_HDB_Ext_PKINIT_hash  (const HDB_Ext_PKINIT_hash *, HDB_Ext_PKINIT_hash *);\n\n\n/*\nHDB-Ext-Constrained-delegation-acl ::= SEQUENCE OF Principal\n*/\n\ntypedef struct HDB_Ext_Constrained_delegation_acl {\n  unsigned int len;\n  Principal *val;\n} HDB_Ext_Constrained_delegation_acl;\n\nint    encode_HDB_Ext_Constrained_delegation_acl(unsigned char *, size_t, const HDB_Ext_Constrained_delegation_acl *, size_t *);\nint    decode_HDB_Ext_Constrained_delegation_acl(const unsigned char *, size_t, HDB_Ext_Constrained_delegation_acl *, size_t *);\nvoid   free_HDB_Ext_Constrained_delegation_acl  (HDB_Ext_Constrained_delegation_acl *);\nsize_t length_HDB_Ext_Constrained_delegation_acl(const HDB_Ext_Constrained_delegation_acl *);\nint    copy_HDB_Ext_Constrained_delegation_acl  (const HDB_Ext_Constrained_delegation_acl *, HDB_Ext_Constrained_delegation_acl *);\n\n\n/*\nHDB-Ext-Lan-Manager-OWF ::= OCTET STRING\n*/\n\ntypedef heim_octet_string HDB_Ext_Lan_Manager_OWF;\n\nint    encode_HDB_Ext_Lan_Manager_OWF(unsigned char *, size_t, const HDB_Ext_Lan_Manager_OWF *, size_t *);\nint    decode_HDB_Ext_Lan_Manager_OWF(const unsigned char *, size_t, HDB_Ext_Lan_Manager_OWF *, size_t *);\nvoid   free_HDB_Ext_Lan_Manager_OWF  (HDB_Ext_Lan_Manager_OWF *);\nsize_t length_HDB_Ext_Lan_Manager_OWF(const HDB_Ext_Lan_Manager_OWF *);\nint    copy_HDB_Ext_Lan_Manager_OWF  (const HDB_Ext_Lan_Manager_OWF *, HDB_Ext_Lan_Manager_OWF *);\n\n\n/*\nHDB-Ext-Password ::= SEQUENCE {\n  mkvno           [0] INTEGER (0..-1) OPTIONAL,\n  password        OCTET STRING,\n}\n*/\n\ntypedef struct HDB_Ext_Password {\n  unsigned int *mkvno;\n  heim_octet_string password;\n} HDB_Ext_Password;\n\nint    encode_HDB_Ext_Password(unsigned char *, size_t, const HDB_Ext_Password *, size_t *);\nint    decode_HDB_Ext_Password(const unsigned char *, size_t, HDB_Ext_Password *, size_t *);\nvoid   free_HDB_Ext_Password  (HDB_Ext_Password *);\nsize_t length_HDB_Ext_Password(const HDB_Ext_Password *);\nint    copy_HDB_Ext_Password  (const HDB_Ext_Password *, HDB_Ext_Password *);\n\n\n/*\nHDB-Ext-Aliases ::= SEQUENCE {\n  case-insensitive   [0] BOOLEAN,\n  aliases            [1] SEQUENCE OF Principal,\n}\n*/\n\ntypedef struct HDB_Ext_Aliases {\n  int case_insensitive;\n  struct  {\n    unsigned int len;\n    Principal *val;\n  } aliases;\n} HDB_Ext_Aliases;\n\nint    encode_HDB_Ext_Aliases(unsigned char *, size_t, const HDB_Ext_Aliases *, size_t *);\nint    decode_HDB_Ext_Aliases(const unsigned char *, size_t, HDB_Ext_Aliases *, size_t *);\nvoid   free_HDB_Ext_Aliases  (HDB_Ext_Aliases *);\nsize_t length_HDB_Ext_Aliases(const HDB_Ext_Aliases *);\nint    copy_HDB_Ext_Aliases  (const HDB_Ext_Aliases *, HDB_Ext_Aliases *);\n\n\n/*\nHDB-extension ::= SEQUENCE {\n  mandatory       [0] BOOLEAN,\n  data            [1] CHOICE {\n    pkinit-acl               [0] HDB-Ext-PKINIT-acl,\n    pkinit-cert-hash         [1] HDB-Ext-PKINIT-hash,\n    allowed-to-delegate-to   [2] HDB-Ext-Constrained-delegation-acl,\n    lm-owf                   [4] HDB-Ext-Lan-Manager-OWF,\n    password                 [5] HDB-Ext-Password,\n    aliases                  [6] HDB-Ext-Aliases,\n    last-pw-change           [7] KerberosTime,\n    ...,\n  },\n  ...,\n}\n*/\n\ntypedef struct HDB_extension {\n  int mandatory;\n  struct  {\n    enum {\n      choice_HDB_extension_data_asn1_ellipsis = 0,\n      choice_HDB_extension_data_pkinit_acl,\n      choice_HDB_extension_data_pkinit_cert_hash,\n      choice_HDB_extension_data_allowed_to_delegate_to,\n      choice_HDB_extension_data_lm_owf,\n      choice_HDB_extension_data_password,\n      choice_HDB_extension_data_aliases,\n      choice_HDB_extension_data_last_pw_change\n      /* ... */\n    } element;\n    union {\n      HDB_Ext_PKINIT_acl pkinit_acl;\n      HDB_Ext_PKINIT_hash pkinit_cert_hash;\n      HDB_Ext_Constrained_delegation_acl allowed_to_delegate_to;\n      HDB_Ext_Lan_Manager_OWF lm_owf;\n      HDB_Ext_Password password;\n      HDB_Ext_Aliases aliases;\n      KerberosTime last_pw_change;\n      heim_octet_string asn1_ellipsis;\n    } u;\n  } data;\n} HDB_extension;\n\nint    encode_HDB_extension(unsigned char *, size_t, const HDB_extension *, size_t *);\nint    decode_HDB_extension(const unsigned char *, size_t, HDB_extension *, size_t *);\nvoid   free_HDB_extension  (HDB_extension *);\nsize_t length_HDB_extension(const HDB_extension *);\nint    copy_HDB_extension  (const HDB_extension *, HDB_extension *);\n\n\n/*\nHDB-extensions ::= SEQUENCE OF HDB-extension\n*/\n\ntypedef struct HDB_extensions {\n  unsigned int len;\n  HDB_extension *val;\n} HDB_extensions;\n\nint    encode_HDB_extensions(unsigned char *, size_t, const HDB_extensions *, size_t *);\nint    decode_HDB_extensions(const unsigned char *, size_t, HDB_extensions *, size_t *);\nvoid   free_HDB_extensions  (HDB_extensions *);\nsize_t length_HDB_extensions(const HDB_extensions *);\nint    copy_HDB_extensions  (const HDB_extensions *, HDB_extensions *);\n\n\n/*\nhdb_entry ::= SEQUENCE {\n  principal       [0] Principal OPTIONAL,\n  kvno            [1] INTEGER (0..-1),\n  keys            [2] SEQUENCE OF Key,\n  created-by      [3] Event,\n  modified-by     [4] Event OPTIONAL,\n  valid-start     [5] KerberosTime OPTIONAL,\n  valid-end       [6] KerberosTime OPTIONAL,\n  pw-end          [7] KerberosTime OPTIONAL,\n  max-life        [8] INTEGER (0..-1) OPTIONAL,\n  max-renew       [9] INTEGER (0..-1) OPTIONAL,\n  flags           [10] HDBFlags,\n  etypes          [11] SEQUENCE OF INTEGER (0..-1) OPTIONAL,\n  generation      [12] GENERATION OPTIONAL,\n  extensions      [13] HDB-extensions OPTIONAL,\n}\n*/\n\ntypedef struct hdb_entry {\n  Principal *principal;\n  unsigned int kvno;\n  struct  {\n    unsigned int len;\n    Key *val;\n  } keys;\n  Event created_by;\n  Event *modified_by;\n  KerberosTime *valid_start;\n  KerberosTime *valid_end;\n  KerberosTime *pw_end;\n  unsigned int *max_life;\n  unsigned int *max_renew;\n  HDBFlags flags;\n  struct  {\n    unsigned int len;\n    unsigned int *val;\n  } *etypes;\n  GENERATION *generation;\n  HDB_extensions *extensions;\n} hdb_entry;\n\nint    encode_hdb_entry(unsigned char *, size_t, const hdb_entry *, size_t *);\nint    decode_hdb_entry(const unsigned char *, size_t, hdb_entry *, size_t *);\nvoid   free_hdb_entry  (hdb_entry *);\nsize_t length_hdb_entry(const hdb_entry *);\nint    copy_hdb_entry  (const hdb_entry *, hdb_entry *);\n\n\n/*\nhdb_entry_alias ::= [APPLICATION 0] SEQUENCE {\n  principal       [0] Principal OPTIONAL,\n}\n*/\n\ntypedef struct hdb_entry_alias {\n  Principal *principal;\n} hdb_entry_alias;\n\nint    encode_hdb_entry_alias(unsigned char *, size_t, const hdb_entry_alias *, size_t *);\nint    decode_hdb_entry_alias(const unsigned char *, size_t, hdb_entry_alias *, size_t *);\nvoid   free_hdb_entry_alias  (hdb_entry_alias *);\nsize_t length_hdb_entry_alias(const hdb_entry_alias *);\nint    copy_hdb_entry_alias  (const hdb_entry_alias *, hdb_entry_alias *);\n\n\n#endif /* __hdb_asn1_h__ */\n"
  },
  {
    "path": "freebsd-headers/hdb_err.h",
    "content": "/* Generated from /usr/src/kerberos5/lib/libhdb/../../../crypto/heimdal/lib/hdb/hdb_err.et */\n/* $Id: hdb_err.et 15878 2005-08-11 13:17:22Z lha $ */\n\n#ifndef __hdb_err_h__\n#define __hdb_err_h__\n\nstruct et_list;\n\nvoid initialize_hdb_error_table_r(struct et_list **);\n\nvoid initialize_hdb_error_table(void);\n#define init_hdb_err_tbl initialize_hdb_error_table\n\ntypedef enum hdb_error_number{\n\tHDB_ERR_UK_SERROR = 36150273,\n\tHDB_ERR_UK_RERROR = 36150274,\n\tHDB_ERR_NOENTRY = 36150275,\n\tHDB_ERR_DB_INUSE = 36150276,\n\tHDB_ERR_DB_CHANGED = 36150277,\n\tHDB_ERR_RECURSIVELOCK = 36150278,\n\tHDB_ERR_NOTLOCKED = 36150279,\n\tHDB_ERR_BADLOCKMODE = 36150280,\n\tHDB_ERR_CANT_LOCK_DB = 36150281,\n\tHDB_ERR_EXISTS = 36150282,\n\tHDB_ERR_BADVERSION = 36150283,\n\tHDB_ERR_NO_MKEY = 36150284,\n\tHDB_ERR_MANDATORY_OPTION = 36150285\n} hdb_error_number;\n\n#define ERROR_TABLE_BASE_hdb 36150272\n\n#endif /* __hdb_err_h__ */\n"
  },
  {
    "path": "freebsd-headers/heim_asn1.h",
    "content": "/*\n * Copyright (c) 2003-2005 Kungliga Tekniska Hgskolan\n * (Royal Institute of Technology, Stockholm, Sweden). \n * All rights reserved. \n *\n * Redistribution and use in source and binary forms, with or without \n * modification, are permitted provided that the following conditions \n * are met: \n *\n * 1. Redistributions of source code must retain the above copyright \n *    notice, this list of conditions and the following disclaimer. \n *\n * 2. Redistributions in binary form must reproduce the above copyright \n *    notice, this list of conditions and the following disclaimer in the \n *    documentation and/or other materials provided with the distribution. \n *\n * 3. Neither the name of the Institute nor the names of its contributors \n *    may be used to endorse or promote products derived from this software \n *    without specific prior written permission. \n *\n * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND \n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE \n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE \n * ARE DISCLAIMED.  IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE \n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL \n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS \n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) \n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT \n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY \n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF \n * SUCH DAMAGE. \n */\n\n#ifndef __HEIM_ANY_H__\n#define __HEIM_ANY_H__ 1\n\nint\tencode_heim_any(unsigned char *, size_t, const heim_any *, size_t *);\nint\tdecode_heim_any(const unsigned char *, size_t, heim_any *, size_t *);\nvoid\tfree_heim_any(heim_any *);\nsize_t\tlength_heim_any(const heim_any *);\nint\tcopy_heim_any(const heim_any *, heim_any *);\n\nint\tencode_heim_any_set(unsigned char *, size_t,\n\t\t\t    const heim_any_set *, size_t *);\nint\tdecode_heim_any_set(const unsigned char *, size_t,\n\t\t\t    heim_any_set *,size_t *);\nvoid\tfree_heim_any_set(heim_any_set *);\nsize_t\tlength_heim_any_set(const heim_any_set *);\nint\tcopy_heim_any_set(const heim_any_set *, heim_any_set *);\nint\theim_any_cmp(const heim_any_set *, const heim_any_set *);\n\n#endif /* __HEIM_ANY_H__ */\n"
  },
  {
    "path": "freebsd-headers/heim_err.h",
    "content": "/* Generated from /usr/src/kerberos5/lib/libkrb5/../../../crypto/heimdal/lib/krb5/heim_err.et */\n/* $Id: heim_err.et 13352 2004-02-13 16:23:40Z lha $ */\n\n#ifndef __heim_err_h__\n#define __heim_err_h__\n\nstruct et_list;\n\nvoid initialize_heim_error_table_r(struct et_list **);\n\nvoid initialize_heim_error_table(void);\n#define init_heim_err_tbl initialize_heim_error_table\n\ntypedef enum heim_error_number{\n\tHEIM_ERR_LOG_PARSE = -1980176640,\n\tHEIM_ERR_V4_PRINC_NO_CONV = -1980176639,\n\tHEIM_ERR_SALTTYPE_NOSUPP = -1980176638,\n\tHEIM_ERR_NOHOST = -1980176637,\n\tHEIM_ERR_OPNOTSUPP = -1980176636,\n\tHEIM_ERR_EOF = -1980176635,\n\tHEIM_ERR_BAD_MKEY = -1980176634,\n\tHEIM_ERR_SERVICE_NOMATCH = -1980176633,\n\tHEIM_PKINIT_NO_CERTIFICATE = -1980176576,\n\tHEIM_PKINIT_NO_PRIVATE_KEY = -1980176575,\n\tHEIM_PKINIT_NO_VALID_CA = -1980176574,\n\tHEIM_PKINIT_CERTIFICATE_INVALID = -1980176573,\n\tHEIM_PKINIT_PRIVATE_KEY_INVALID = -1980176572,\n\tHEIM_EAI_UNKNOWN = -1980176512,\n\tHEIM_EAI_ADDRFAMILY = -1980176511,\n\tHEIM_EAI_AGAIN = -1980176510,\n\tHEIM_EAI_BADFLAGS = -1980176509,\n\tHEIM_EAI_FAIL = -1980176508,\n\tHEIM_EAI_FAMILY = -1980176507,\n\tHEIM_EAI_MEMORY = -1980176506,\n\tHEIM_EAI_NODATA = -1980176505,\n\tHEIM_EAI_NONAME = -1980176504,\n\tHEIM_EAI_SERVICE = -1980176503,\n\tHEIM_EAI_SOCKTYPE = -1980176502,\n\tHEIM_EAI_SYSTEM = -1980176501\n} heim_error_number;\n\n#define ERROR_TABLE_BASE_heim -1980176640\n\n#endif /* __heim_err_h__ */\n"
  },
  {
    "path": "freebsd-headers/heim_threads.h",
    "content": "/*\n * Copyright (c) 2003 Kungliga Tekniska Hgskolan\n * (Royal Institute of Technology, Stockholm, Sweden). \n * All rights reserved. \n *\n * Redistribution and use in source and binary forms, with or without \n * modification, are permitted provided that the following conditions \n * are met: \n *\n * 1. Redistributions of source code must retain the above copyright \n *    notice, this list of conditions and the following disclaimer. \n *\n * 2. Redistributions in binary form must reproduce the above copyright \n *    notice, this list of conditions and the following disclaimer in the \n *    documentation and/or other materials provided with the distribution. \n *\n * 3. Neither the name of the Institute nor the names of its contributors \n *    may be used to endorse or promote products derived from this software \n *    without specific prior written permission. \n *\n * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND \n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE \n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE \n * ARE DISCLAIMED.  IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE \n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL \n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS \n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) \n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT \n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY \n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF \n * SUCH DAMAGE. \n */\n\n/* $Id: heim_threads.h 14409 2004-12-18 16:03:38Z lha $ */\n\n/*\n * Provide wrapper macros for thread synchronization primitives so we\n * can use native thread functions for those operating system that\n * supports it.\n *\n * This is so libkrb5.so (or more importantly, libgssapi.so) can have\n * thread support while the program that that dlopen(3)s the library\n * don't need to be linked to libpthread.\n */\n\n#ifndef HEIM_THREADS_H\n#define HEIM_THREADS_H 1\n\n/* assume headers already included */\n\n#if defined(__NetBSD__) && __NetBSD_Version__ >= 106120000 && __NetBSD_Version__< 299001200 && defined(ENABLE_PTHREAD_SUPPORT)\n\n/* \n * NetBSD have a thread lib that we can use that part of libc that\n * works regardless if application are linked to pthreads or not.\n * NetBSD newer then 2.99.11 just use pthread.h, and the same thing\n * will happen.\n */\n#include <threadlib.h>\n\n#define HEIMDAL_MUTEX mutex_t\n#define HEIMDAL_MUTEX_INITIALIZER MUTEX_INITIALIZER\n#define HEIMDAL_MUTEX_init(m) mutex_init(m, NULL)\n#define HEIMDAL_MUTEX_lock(m) mutex_lock(m)\n#define HEIMDAL_MUTEX_unlock(m) mutex_unlock(m)\n#define HEIMDAL_MUTEX_destroy(m) mutex_destroy(m)\n\n#define HEIMDAL_RWLOCK rwlock_t\n#define HEIMDAL_RWLOCK_INITIALIZER RWLOCK_INITIALIZER\n#define\tHEIMDAL_RWLOCK_init(l) rwlock_init(l, NULL)\t\n#define\tHEIMDAL_RWLOCK_rdlock(l) rwlock_rdlock(l)\t\n#define\tHEIMDAL_RWLOCK_wrlock(l) rwlock_wrlock(l)\t\n#define\tHEIMDAL_RWLOCK_tryrdlock(l) rwlock_tryrdlock(l)\t\n#define\tHEIMDAL_RWLOCK_trywrlock(l) rwlock_trywrlock(l)\t\n#define\tHEIMDAL_RWLOCK_unlock(l) rwlock_unlock(l)\t\n#define\tHEIMDAL_RWLOCK_destroy(l) rwlock_destroy(l)\t\n\n#define HEIMDAL_thread_key thread_key_t\n#define HEIMDAL_key_create(k,d,r) do { r = thr_keycreate(k,d); } while(0)\n#define HEIMDAL_setspecific(k,s,r) do { r = thr_setspecific(k,s); } while(0)\n#define HEIMDAL_getspecific(k) thr_getspecific(k)\n#define HEIMDAL_key_delete(k) thr_keydelete(k)\n\n#elif defined(ENABLE_PTHREAD_SUPPORT) && (!defined(__NetBSD__) || __NetBSD_Version__ >= 299001200)\n\n#include <pthread.h>\n\n#define HEIMDAL_MUTEX pthread_mutex_t\n#define HEIMDAL_MUTEX_INITIALIZER PTHREAD_MUTEX_INITIALIZER\n#define HEIMDAL_MUTEX_init(m) pthread_mutex_init(m, NULL)\n#define HEIMDAL_MUTEX_lock(m) pthread_mutex_lock(m)\n#define HEIMDAL_MUTEX_unlock(m) pthread_mutex_unlock(m)\n#define HEIMDAL_MUTEX_destroy(m) pthread_mutex_destroy(m)\n\n#define HEIMDAL_RWLOCK rwlock_t\n#define HEIMDAL_RWLOCK_INITIALIZER RWLOCK_INITIALIZER\n#define\tHEIMDAL_RWLOCK_init(l) pthread_rwlock_init(l, NULL)\t\n#define\tHEIMDAL_RWLOCK_rdlock(l) pthread_rwlock_rdlock(l)\t\n#define\tHEIMDAL_RWLOCK_wrlock(l) pthread_rwlock_wrlock(l)\t\n#define\tHEIMDAL_RWLOCK_tryrdlock(l) pthread_rwlock_tryrdlock(l)\t\n#define\tHEIMDAL_RWLOCK_trywrlock(l) pthread_rwlock_trywrlock(l)\t\n#define\tHEIMDAL_RWLOCK_unlock(l) pthread_rwlock_unlock(l)\t\n#define\tHEIMDAL_RWLOCK_destroy(l) pthread_rwlock_destroy(l)\t\n\n#define HEIMDAL_thread_key pthread_key_t\n#define HEIMDAL_key_create(k,d,r) do { r = pthread_key_create(k,d); } while(0)\n#define HEIMDAL_setspecific(k,s,r) do { r = pthread_setspecific(k,s); } while(0)\n#define HEIMDAL_getspecific(k) pthread_getspecific(k)\n#define HEIMDAL_key_delete(k) pthread_key_delete(k)\n\n#elif defined(HEIMDAL_DEBUG_THREADS)\n\n/* no threads support, just do consistency checks */\n#include <stdlib.h>\n\n#define HEIMDAL_MUTEX int\n#define HEIMDAL_MUTEX_INITIALIZER 0\n#define HEIMDAL_MUTEX_init(m)  do { (*(m)) = 0; } while(0)\n#define HEIMDAL_MUTEX_lock(m)  do { if ((*(m))++ != 0) abort(); } while(0)\n#define HEIMDAL_MUTEX_unlock(m) do { if ((*(m))-- != 1) abort(); } while(0)\n#define HEIMDAL_MUTEX_destroy(m) do {if ((*(m)) != 0) abort(); } while(0)\n\n#define HEIMDAL_RWLOCK rwlock_t int\n#define HEIMDAL_RWLOCK_INITIALIZER 0\n#define\tHEIMDAL_RWLOCK_init(l) do { } while(0)\n#define\tHEIMDAL_RWLOCK_rdlock(l) do { } while(0)\n#define\tHEIMDAL_RWLOCK_wrlock(l) do { } while(0)\n#define\tHEIMDAL_RWLOCK_tryrdlock(l) do { } while(0)\n#define\tHEIMDAL_RWLOCK_trywrlock(l) do { } while(0)\n#define\tHEIMDAL_RWLOCK_unlock(l) do { } while(0)\n#define\tHEIMDAL_RWLOCK_destroy(l) do { } while(0)\n\n#define HEIMDAL_internal_thread_key 1\n\n#else /* no thread support, no debug case */\n\n#define HEIMDAL_MUTEX int\n#define HEIMDAL_MUTEX_INITIALIZER 0\n#define HEIMDAL_MUTEX_init(m)  do { (void)(m); } while(0)\n#define HEIMDAL_MUTEX_lock(m)  do { (void)(m); } while(0)\n#define HEIMDAL_MUTEX_unlock(m) do { (void)(m); } while(0)\n#define HEIMDAL_MUTEX_destroy(m) do { (void)(m); } while(0)\n\n#define HEIMDAL_RWLOCK rwlock_t int\n#define HEIMDAL_RWLOCK_INITIALIZER 0\n#define\tHEIMDAL_RWLOCK_init(l) do { } while(0)\n#define\tHEIMDAL_RWLOCK_rdlock(l) do { } while(0)\n#define\tHEIMDAL_RWLOCK_wrlock(l) do { } while(0)\n#define\tHEIMDAL_RWLOCK_tryrdlock(l) do { } while(0)\n#define\tHEIMDAL_RWLOCK_trywrlock(l) do { } while(0)\n#define\tHEIMDAL_RWLOCK_unlock(l) do { } while(0)\n#define\tHEIMDAL_RWLOCK_destroy(l) do { } while(0)\n\n#define HEIMDAL_internal_thread_key 1\n\n#endif /* no thread support */\n\n#ifdef HEIMDAL_internal_thread_key\n\ntypedef struct heim_thread_key {\n    void *value;\n    void (*destructor)(void *);\n} heim_thread_key;\n\n#define HEIMDAL_thread_key heim_thread_key\n#define HEIMDAL_key_create(k,d,r) \\\n\tdo { (k)->value = NULL; (k)->destructor = (d); r = 0; } while(0)\n#define HEIMDAL_setspecific(k,s,r) do { (k).value = s ; r = 0; } while(0)\n#define HEIMDAL_getspecific(k) ((k).value)\n#define HEIMDAL_key_delete(k) do { (*(k).destructor)((k).value); } while(0)\n\n#undef HEIMDAL_internal_thread_key\n#endif /* HEIMDAL_internal_thread_key */\n\n#endif /* HEIM_THREADS_H */\n"
  },
  {
    "path": "freebsd-headers/heimntlm-protos.h",
    "content": "/* This is a generated file */\n#ifndef __heimntlm_protos_h__\n#define __heimntlm_protos_h__\n\n#include <stdarg.h>\n\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\nint\nheim_ntlm_build_ntlm1_master (\n\tvoid */*key*/,\n\tsize_t /*len*/,\n\tstruct ntlm_buf */*session*/,\n\tstruct ntlm_buf */*master*/);\n\nint\nheim_ntlm_calculate_ntlm1 (\n\tvoid */*key*/,\n\tsize_t /*len*/,\n\tunsigned char challange[8],\n\tstruct ntlm_buf */*answer*/);\n\nint\nheim_ntlm_calculate_ntlm2 (\n\tconst void */*key*/,\n\tsize_t /*len*/,\n\tconst char */*username*/,\n\tconst char */*target*/,\n\tconst unsigned char serverchallange[8],\n\tconst struct ntlm_buf */*infotarget*/,\n\tunsigned char ntlmv2[16],\n\tstruct ntlm_buf */*answer*/);\n\nint\nheim_ntlm_calculate_ntlm2_sess (\n\tconst unsigned char clnt_nonce[8],\n\tconst unsigned char svr_chal[8],\n\tconst unsigned char ntlm_hash[16],\n\tstruct ntlm_buf */*lm*/,\n\tstruct ntlm_buf */*ntlm*/);\n\nint\nheim_ntlm_decode_targetinfo (\n\tconst struct ntlm_buf */*data*/,\n\tint /*ucs2*/,\n\tstruct ntlm_targetinfo */*ti*/);\n\nint\nheim_ntlm_decode_type1 (\n\tconst struct ntlm_buf */*buf*/,\n\tstruct ntlm_type1 */*data*/);\n\nint\nheim_ntlm_decode_type2 (\n\tconst struct ntlm_buf */*buf*/,\n\tstruct ntlm_type2 */*type2*/);\n\nint\nheim_ntlm_decode_type3 (\n\tconst struct ntlm_buf */*buf*/,\n\tint /*ucs2*/,\n\tstruct ntlm_type3 */*type3*/);\n\nint\nheim_ntlm_encode_targetinfo (\n\tconst struct ntlm_targetinfo */*ti*/,\n\tint /*ucs2*/,\n\tstruct ntlm_buf */*data*/);\n\nint\nheim_ntlm_encode_type1 (\n\tconst struct ntlm_type1 */*type1*/,\n\tstruct ntlm_buf */*data*/);\n\nint\nheim_ntlm_encode_type2 (\n\tconst struct ntlm_type2 */*type2*/,\n\tstruct ntlm_buf */*data*/);\n\nint\nheim_ntlm_encode_type3 (\n\tconst struct ntlm_type3 */*type3*/,\n\tstruct ntlm_buf */*data*/);\n\nvoid\nheim_ntlm_free_buf (struct ntlm_buf */*p*/);\n\nvoid\nheim_ntlm_free_targetinfo (struct ntlm_targetinfo */*ti*/);\n\nvoid\nheim_ntlm_free_type1 (struct ntlm_type1 */*data*/);\n\nvoid\nheim_ntlm_free_type2 (struct ntlm_type2 */*data*/);\n\nvoid\nheim_ntlm_free_type3 (struct ntlm_type3 */*data*/);\n\nint\nheim_ntlm_nt_key (\n\tconst char */*password*/,\n\tstruct ntlm_buf */*key*/);\n\nvoid\nheim_ntlm_ntlmv2_key (\n\tconst void */*key*/,\n\tsize_t /*len*/,\n\tconst char */*username*/,\n\tconst char */*target*/,\n\tunsigned char ntlmv2[16]);\n\nint\nheim_ntlm_verify_ntlm2 (\n\tconst void */*key*/,\n\tsize_t /*len*/,\n\tconst char */*username*/,\n\tconst char */*target*/,\n\ttime_t /*now*/,\n\tconst unsigned char serverchallange[8],\n\tconst struct ntlm_buf */*answer*/,\n\tstruct ntlm_buf */*infotarget*/,\n\tunsigned char ntlmv2[16]);\n\n#ifdef __cplusplus\n}\n#endif\n\n#endif /* __heimntlm_protos_h__ */\n"
  },
  {
    "path": "freebsd-headers/heimntlm.h",
    "content": "/*\n * Copyright (c) 2006 Kungliga Tekniska Hgskolan\n * (Royal Institute of Technology, Stockholm, Sweden). \n * All rights reserved. \n *\n * Redistribution and use in source and binary forms, with or without \n * modification, are permitted provided that the following conditions \n * are met: \n *\n * 1. Redistributions of source code must retain the above copyright \n *    notice, this list of conditions and the following disclaimer. \n *\n * 2. Redistributions in binary form must reproduce the above copyright \n *    notice, this list of conditions and the following disclaimer in the \n *    documentation and/or other materials provided with the distribution. \n *\n * 3. Neither the name of the Institute nor the names of its contributors \n *    may be used to endorse or promote products derived from this software \n *    without specific prior written permission. \n *\n * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND \n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE \n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE \n * ARE DISCLAIMED.  IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE \n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL \n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS \n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) \n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT \n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY \n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF \n * SUCH DAMAGE. \n */\n\n/* $Id: heimntlm.h 22376 2007-12-28 18:38:23Z lha $ */\n\n#ifndef HEIM_NTLM_H\n#define HEIM_NTLM_H\n\n/**\n * Buffer for storing data in the NTLM library. When filled in by the\n * library it should be freed with heim_ntlm_free_buf().\n */\nstruct ntlm_buf {\n    size_t length; /**< length buffer data */\n    void *data; /**< pointer to the data itself */\n};\n\n#define NTLM_NEG_UNICODE\t\t0x00000001\n#define NTLM_NEG_TARGET\t\t\t0x00000004\n#define NTLM_NEG_SIGN\t\t\t0x00000010\n#define NTLM_NEG_SEAL\t\t\t0x00000020\n#define NTLM_NEG_NTLM\t\t\t0x00000200\n\n#define NTLM_SUPPLIED_DOMAIN\t\t0x00001000\n#define NTLM_SUPPLIED_WORKSTAION\t0x00002000\n\n#define NTLM_NEG_ALWAYS_SIGN\t\t0x00008000\n#define NTLM_NEG_NTLM2_SESSION\t\t0x00080000\n\n#define NTLM_TARGET_DOMAIN\t\t0x00010000\n#define NTLM_TARGET_SERVER\t\t0x00020000\n#define NTLM_ENC_128\t\t\t0x20000000\n#define NTLM_NEG_KEYEX\t\t\t0x40000000\n\n/**\n * Struct for the NTLM target info, the strings is assumed to be in\n * UTF8.  When filled in by the library it should be freed with\n * heim_ntlm_free_targetinfo().\n */\nstruct ntlm_targetinfo {\n    char *servername; /**< */\n    char *domainname; /**< */\n    char *dnsdomainname; /**< */\n    char *dnsservername; /**< */\n};\n\n/**\n * Struct for the NTLM type1 message info, the strings is assumed to\n * be in UTF8.  When filled in by the library it should be freed with\n * heim_ntlm_free_type1().\n */\n\nstruct ntlm_type1 {\n    uint32_t flags; /**< */\n    char *domain; /**< */\n    char *hostname; /**< */\n    uint32_t os[2]; /**< */\n};\n\n/**\n * Struct for the NTLM type2 message info, the strings is assumed to\n * be in UTF8.  When filled in by the library it should be freed with\n * heim_ntlm_free_type2().\n */\n\nstruct ntlm_type2 {\n    uint32_t flags; /**< */\n    char *targetname; /**< */\n    struct ntlm_buf targetinfo; /**< */\n    unsigned char challange[8]; /**< */\n    uint32_t context[2]; /**< */\n    uint32_t os[2]; /**< */\n};\n\n/**\n * Struct for the NTLM type3 message info, the strings is assumed to\n * be in UTF8.  When filled in by the library it should be freed with\n * heim_ntlm_free_type3().\n */\n\nstruct ntlm_type3 {\n    uint32_t flags; /**< */\n    char *username; /**< */\n    char *targetname; /**< */\n    struct ntlm_buf lm; /**< */\n    struct ntlm_buf ntlm; /**< */\n    struct ntlm_buf sessionkey; /**< */\n    char *ws; /**< */\n    uint32_t os[2]; /**< */\n};\n\n#include <heimntlm-protos.h>\n\n#endif /* NTLM_NTLM_H */\n"
  },
  {
    "path": "freebsd-headers/histedit.h",
    "content": "/*-\n * Copyright (c) 1992, 1993\n *\tThe Regents of the University of California.  All rights reserved.\n *\n * This code is derived from software contributed to Berkeley by\n * Christos Zoulas of Cornell University.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t@(#)histedit.h\t8.2 (Berkeley) 1/3/94\n *\t$NetBSD: histedit.h,v 1.32 2007/06/10 20:20:28 christos Exp $\n * $FreeBSD: release/9.0.0/lib/libedit/histedit.h 220370 2011-04-05 18:41:01Z obrien $\n */\n\n/*\n * histedit.h: Line editor and history interface.\n */\n#ifndef _HISTEDIT_H_\n#define\t_HISTEDIT_H_\n\n#include <sys/types.h>\n#include <stdio.h>\n\n__BEGIN_DECLS\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\n/*\n * ==== Editing ====\n */\n\ntypedef struct editline EditLine;\n\n/*\n * For user-defined function interface\n */\ntypedef struct lineinfo {\n\tconst char\t*buffer;\n\tconst char\t*cursor;\n\tconst char\t*lastchar;\n} LineInfo;\n\n/*\n * EditLine editor function return codes.\n * For user-defined function interface\n */\n#define\tCC_NORM\t\t0\n#define\tCC_NEWLINE\t1\n#define\tCC_EOF\t\t2\n#define\tCC_ARGHACK\t3\n#define\tCC_REFRESH\t4\n#define\tCC_CURSOR\t5\n#define\tCC_ERROR\t6\n#define\tCC_FATAL\t7\n#define\tCC_REDISPLAY\t8\n#define\tCC_REFRESH_BEEP\t9\n\n/*\n * Initialization, cleanup, and resetting\n */\nEditLine\t*el_init(const char *, FILE *, FILE *, FILE *);\nvoid\t\t el_end(EditLine *);\nvoid\t\t el_reset(EditLine *);\n\n/*\n * Get a line, a character or push a string back in the input queue\n */\nconst char\t*el_gets(EditLine *, int *);\nint\t\t el_getc(EditLine *, char *);\nvoid\t\t el_push(EditLine *, const char *);\n\n/*\n * Beep!\n */\nvoid\t\t el_beep(EditLine *);\n\n/*\n * High level function internals control\n * Parses argc, argv array and executes builtin editline commands\n */\nint\t\t el_parse(EditLine *, int, const char **);\n\n/*\n * Low level editline access functions\n */\nint\t\t el_set(EditLine *, int, ...);\nint\t\t el_get(EditLine *, int, ...);\nunsigned char\t_el_fn_complete(EditLine *, int);\nunsigned char\t_el_fn_sh_complete(EditLine *, int);\n\n/*\n * el_set/el_get parameters\n */\n#define\tEL_PROMPT\t0\t/* , el_pfunc_t);\t\t*/\n#define\tEL_TERMINAL\t1\t/* , const char *);\t\t*/\n#define\tEL_EDITOR\t2\t/* , const char *);\t\t*/\n#define\tEL_SIGNAL\t3\t/* , int);\t\t\t*/\n#define\tEL_BIND\t\t4\t/* , const char *, ..., NULL);\t*/\n#define\tEL_TELLTC\t5\t/* , const char *, ..., NULL);\t*/\n#define\tEL_SETTC\t6\t/* , const char *, ..., NULL);\t*/\n#define\tEL_ECHOTC\t7\t/* , const char *, ..., NULL);\t*/\n#define\tEL_SETTY\t8\t/* , const char *, ..., NULL);\t*/\n#define\tEL_ADDFN\t9\t/* , const char *, const char *\t*/\n\t\t\t\t/* , el_func_t);\t\t*/\n#define\tEL_HIST\t\t10\t/* , hist_fun_t, const char *);\t*/\n#define\tEL_EDITMODE\t11\t/* , int);\t\t\t*/\n#define\tEL_RPROMPT\t12\t/* , el_pfunc_t);\t\t*/\n#define\tEL_GETCFN\t13\t/* , el_rfunc_t);\t\t*/\n#define\tEL_CLIENTDATA\t14\t/* , void *);\t\t\t*/\n#define\tEL_UNBUFFERED\t15\t/* , int);\t\t\t*/\n#define\tEL_PREP_TERM    16      /* , int);                      */\n#define\tEL_GETTC\t17\t/* , const char *, ..., NULL);\t*/\n#define\tEL_GETFP\t18\t/* , int, FILE **)\t\t*/\n#define\tEL_SETFP\t19\t/* , int, FILE *)\t\t*/\n#define\tEL_REFRESH\t20\t/* , void);\t\t\t      set     */\n#define\tEL_PROMPT_ESC\t21\t/* , prompt_func, Char);\t      set/get */\n#define\tEL_RPROMPT_ESC\t22\t/* , prompt_func, Char);\t      set/get */\n#define\tEL_RESIZE\t23\t/* , el_zfunc_t, void *);\t      set     */\n\n#define\tEL_BUILTIN_GETCFN\t(NULL)\n\n/*\n * Source named file or $PWD/.editrc or $HOME/.editrc\n */\nint\t\tel_source(EditLine *, const char *);\n\n/*\n * Must be called when the terminal changes size; If EL_SIGNAL\n * is set this is done automatically otherwise it is the responsibility\n * of the application\n */\nvoid\t\t el_resize(EditLine *);\n\n\n/*\n * Set user private data.\n */\nvoid            el_data_set    __P((EditLine *, void *));\nvoid *          el_data_get    __P((EditLine *));\n\n/*\n * User-defined function interface.\n */\nconst LineInfo\t*el_line(EditLine *);\nint\t\t el_insertstr(EditLine *, const char *);\nvoid\t\t el_deletestr(EditLine *, int);\n\n\n/*\n * ==== History ====\n */\n\ntypedef struct history History;\n\ntypedef struct HistEvent {\n\tint\t\t num;\n\tconst char\t*str;\n} HistEvent;\n\n/*\n * History access functions.\n */\nHistory *\thistory_init(void);\nvoid\t\thistory_end(History *);\n\nint\t\thistory(History *, HistEvent *, int, ...);\n\n#define\tH_FUNC\t\t 0\t/* , UTSL\t\t*/\n#define\tH_SETSIZE\t 1\t/* , const int);\t*/\n#define\tH_EVENT\t\t 1\t/* , const int);\t*/\n#define\tH_GETSIZE\t 2\t/* , void);\t\t*/\n#define\tH_FIRST\t\t 3\t/* , void);\t\t*/\n#define\tH_LAST\t\t 4\t/* , void);\t\t*/\n#define\tH_PREV\t\t 5\t/* , void);\t\t*/\n#define\tH_NEXT\t\t 6\t/* , void);\t\t*/\n#define\tH_CURR\t\t 8\t/* , const int);\t*/\n#define\tH_SET\t\t 7\t/* , int);\t\t*/\n#define\tH_ADD\t\t 9\t/* , const char *);\t*/\n#define\tH_ENTER\t\t10\t/* , const char *);\t*/\n#define\tH_APPEND\t11\t/* , const char *);\t*/\n#define\tH_END\t\t12\t/* , void);\t\t*/\n#define\tH_NEXT_STR\t13\t/* , const char *);\t*/\n#define\tH_PREV_STR\t14\t/* , const char *);\t*/\n#define\tH_NEXT_EVENT\t15\t/* , const int);\t*/\n#define\tH_PREV_EVENT\t16\t/* , const int);\t*/\n#define\tH_LOAD\t\t17\t/* , const char *);\t*/\n#define\tH_SAVE\t\t18\t/* , const char *);\t*/\n#define\tH_CLEAR\t\t19\t/* , void);\t\t*/\n#define\tH_SETUNIQUE\t20\t/* , int);\t\t*/\n#define\tH_GETUNIQUE\t21\t/* , void);\t\t*/\n#define\tH_DEL\t\t22\t/* , int);\t\t*/\n#define\tH_NEXT_EVDATA\t23\t/* , const int, histdata_t *);\t*/\n#define\tH_DELDATA\t24\t/* , int, histdata_t *);*/\n#define\tH_REPLACE\t25\t/* , const char *, histdata_t);\t*/\n\n\n/*\n * ==== Tokenization ====\n */\n\ntypedef struct tokenizer Tokenizer;\n\n/*\n * String tokenization functions, using simplified sh(1) quoting rules\n */\nTokenizer\t*tok_init(const char *);\nvoid\t\t tok_end(Tokenizer *);\nvoid\t\t tok_reset(Tokenizer *);\nint\t\t tok_line(Tokenizer *, const LineInfo *,\n\t\t    int *, const char ***, int *, int *);\nint\t\t tok_str(Tokenizer *, const char *,\n\t\t    int *, const char ***);\n\n__END_DECLS\n#ifdef __cplusplus\n}\n#endif\n\n#endif /* _HISTEDIT_H_ */\n"
  },
  {
    "path": "freebsd-headers/hx509-private.h",
    "content": "/* This is a generated file */\n#ifndef __hx509_private_h__\n#define __hx509_private_h__\n\n#include <stdarg.h>\n\n#if !defined(__GNUC__) && !defined(__attribute__)\n#define __attribute__(x)\n#endif\n\nint\n_hx509_AlgorithmIdentifier_cmp (\n\tconst AlgorithmIdentifier */*p*/,\n\tconst AlgorithmIdentifier */*q*/);\n\nint\n_hx509_Certificate_cmp (\n\tconst Certificate */*p*/,\n\tconst Certificate */*q*/);\n\nint\n_hx509_Name_to_string (\n\tconst Name */*n*/,\n\tchar **/*str*/);\n\ntime_t\n_hx509_Time2time_t (const Time */*t*/);\n\nvoid\n_hx509_abort (\n\tconst char */*fmt*/,\n\t...)\n    __attribute__ ((noreturn, format (printf, 1, 2)));\n\nint\n_hx509_calculate_path (\n\thx509_context /*context*/,\n\tint /*flags*/,\n\ttime_t /*time_now*/,\n\thx509_certs /*anchors*/,\n\tunsigned int /*max_depth*/,\n\thx509_cert /*cert*/,\n\thx509_certs /*pool*/,\n\thx509_path */*path*/);\n\nint\n_hx509_cert_assign_key (\n\thx509_cert /*cert*/,\n\thx509_private_key /*private_key*/);\n\nint\n_hx509_cert_get_eku (\n\thx509_context /*context*/,\n\thx509_cert /*cert*/,\n\tExtKeyUsage */*e*/);\n\nint\n_hx509_cert_get_keyusage (\n\thx509_context /*context*/,\n\thx509_cert /*c*/,\n\tKeyUsage */*ku*/);\n\nint\n_hx509_cert_get_version (const Certificate */*t*/);\n\nint\n_hx509_cert_is_parent_cmp (\n\tconst Certificate */*subject*/,\n\tconst Certificate */*issuer*/,\n\tint /*allow_self_signed*/);\n\nint\n_hx509_cert_private_decrypt (\n\thx509_context /*context*/,\n\tconst heim_octet_string */*ciphertext*/,\n\tconst heim_oid */*encryption_oid*/,\n\thx509_cert /*p*/,\n\theim_octet_string */*cleartext*/);\n\nhx509_private_key\n_hx509_cert_private_key (hx509_cert /*p*/);\n\nint\n_hx509_cert_private_key_exportable (hx509_cert /*p*/);\n\nint\n_hx509_cert_public_encrypt (\n\thx509_context /*context*/,\n\tconst heim_octet_string */*cleartext*/,\n\tconst hx509_cert /*p*/,\n\theim_oid */*encryption_oid*/,\n\theim_octet_string */*ciphertext*/);\n\nvoid\n_hx509_cert_set_release (\n\thx509_cert /*cert*/,\n\t_hx509_cert_release_func /*release*/,\n\tvoid */*ctx*/);\n\nint\n_hx509_certs_keys_add (\n\thx509_context /*context*/,\n\thx509_certs /*certs*/,\n\thx509_private_key /*key*/);\n\nvoid\n_hx509_certs_keys_free (\n\thx509_context /*context*/,\n\thx509_private_key */*keys*/);\n\nint\n_hx509_certs_keys_get (\n\thx509_context /*context*/,\n\thx509_certs /*certs*/,\n\thx509_private_key **/*keys*/);\n\nhx509_certs\n_hx509_certs_ref (hx509_certs /*certs*/);\n\nint\n_hx509_check_key_usage (\n\thx509_context /*context*/,\n\thx509_cert /*cert*/,\n\tunsigned /*flags*/,\n\tint /*req_present*/);\n\nint\n_hx509_collector_alloc (\n\thx509_context /*context*/,\n\thx509_lock /*lock*/,\n\tstruct hx509_collector **/*collector*/);\n\nint\n_hx509_collector_certs_add (\n\thx509_context /*context*/,\n\tstruct hx509_collector */*c*/,\n\thx509_cert /*cert*/);\n\nint\n_hx509_collector_collect_certs (\n\thx509_context /*context*/,\n\tstruct hx509_collector */*c*/,\n\thx509_certs */*ret_certs*/);\n\nint\n_hx509_collector_collect_private_keys (\n\thx509_context /*context*/,\n\tstruct hx509_collector */*c*/,\n\thx509_private_key **/*keys*/);\n\nvoid\n_hx509_collector_free (struct hx509_collector */*c*/);\n\nhx509_lock\n_hx509_collector_get_lock (struct hx509_collector */*c*/);\n\nint\n_hx509_collector_private_key_add (\n\thx509_context /*context*/,\n\tstruct hx509_collector */*c*/,\n\tconst AlgorithmIdentifier */*alg*/,\n\thx509_private_key /*private_key*/,\n\tconst heim_octet_string */*key_data*/,\n\tconst heim_octet_string */*localKeyId*/);\n\nint\n_hx509_create_signature (\n\thx509_context /*context*/,\n\tconst hx509_private_key /*signer*/,\n\tconst AlgorithmIdentifier */*alg*/,\n\tconst heim_octet_string */*data*/,\n\tAlgorithmIdentifier */*signatureAlgorithm*/,\n\theim_octet_string */*sig*/);\n\nint\n_hx509_create_signature_bitstring (\n\thx509_context /*context*/,\n\tconst hx509_private_key /*signer*/,\n\tconst AlgorithmIdentifier */*alg*/,\n\tconst heim_octet_string */*data*/,\n\tAlgorithmIdentifier */*signatureAlgorithm*/,\n\theim_bit_string */*sig*/);\n\nint\n_hx509_find_extension_subject_key_id (\n\tconst Certificate */*issuer*/,\n\tSubjectKeyIdentifier */*si*/);\n\nint\n_hx509_generate_private_key (\n\thx509_context /*context*/,\n\tstruct hx509_generate_private_context */*ctx*/,\n\thx509_private_key */*private_key*/);\n\nint\n_hx509_generate_private_key_bits (\n\thx509_context /*context*/,\n\tstruct hx509_generate_private_context */*ctx*/,\n\tunsigned long /*bits*/);\n\nvoid\n_hx509_generate_private_key_free (struct hx509_generate_private_context **/*ctx*/);\n\nint\n_hx509_generate_private_key_init (\n\thx509_context /*context*/,\n\tconst heim_oid */*oid*/,\n\tstruct hx509_generate_private_context **/*ctx*/);\n\nint\n_hx509_generate_private_key_is_ca (\n\thx509_context /*context*/,\n\tstruct hx509_generate_private_context */*ctx*/);\n\nCertificate *\n_hx509_get_cert (hx509_cert /*cert*/);\n\nvoid\n_hx509_ks_dir_register (hx509_context /*context*/);\n\nvoid\n_hx509_ks_file_register (hx509_context /*context*/);\n\nvoid\n_hx509_ks_keychain_register (hx509_context /*context*/);\n\nvoid\n_hx509_ks_mem_register (hx509_context /*context*/);\n\nvoid\n_hx509_ks_null_register (hx509_context /*context*/);\n\nvoid\n_hx509_ks_pkcs11_register (hx509_context /*context*/);\n\nvoid\n_hx509_ks_pkcs12_register (hx509_context /*context*/);\n\nvoid\n_hx509_ks_register (\n\thx509_context /*context*/,\n\tstruct hx509_keyset_ops */*ops*/);\n\nint\n_hx509_lock_find_cert (\n\thx509_lock /*lock*/,\n\tconst hx509_query */*q*/,\n\thx509_cert */*c*/);\n\nconst struct _hx509_password *\n_hx509_lock_get_passwords (hx509_lock /*lock*/);\n\nhx509_certs\n_hx509_lock_unlock_certs (hx509_lock /*lock*/);\n\nint\n_hx509_map_file (\n\tconst char */*fn*/,\n\tvoid **/*data*/,\n\tsize_t */*length*/,\n\tstruct stat */*rsb*/);\n\nint\n_hx509_map_file_os (\n\tconst char */*fn*/,\n\theim_octet_string */*os*/,\n\tstruct stat */*rsb*/);\n\nint\n_hx509_match_keys (\n\thx509_cert /*c*/,\n\thx509_private_key /*private_key*/);\n\nint\n_hx509_name_cmp (\n\tconst Name */*n1*/,\n\tconst Name */*n2*/);\n\nint\n_hx509_name_ds_cmp (\n\tconst DirectoryString */*ds1*/,\n\tconst DirectoryString */*ds2*/);\n\nint\n_hx509_name_from_Name (\n\tconst Name */*n*/,\n\thx509_name */*name*/);\n\nint\n_hx509_name_modify (\n\thx509_context /*context*/,\n\tName */*name*/,\n\tint /*append*/,\n\tconst heim_oid */*oid*/,\n\tconst char */*str*/);\n\nint\n_hx509_parse_private_key (\n\thx509_context /*context*/,\n\tconst heim_oid */*key_oid*/,\n\tconst void */*data*/,\n\tsize_t /*len*/,\n\thx509_private_key */*private_key*/);\n\nint\n_hx509_path_append (\n\thx509_context /*context*/,\n\thx509_path */*path*/,\n\thx509_cert /*cert*/);\n\nvoid\n_hx509_path_free (hx509_path */*path*/);\n\nint\n_hx509_pbe_decrypt (\n\thx509_context /*context*/,\n\thx509_lock /*lock*/,\n\tconst AlgorithmIdentifier */*ai*/,\n\tconst heim_octet_string */*econtent*/,\n\theim_octet_string */*content*/);\n\nint\n_hx509_pbe_encrypt (\n\thx509_context /*context*/,\n\thx509_lock /*lock*/,\n\tconst AlgorithmIdentifier */*ai*/,\n\tconst heim_octet_string */*content*/,\n\theim_octet_string */*econtent*/);\n\nvoid\n_hx509_pi_printf (\n\tint (*/*func*/)(void *, const char *),\n\tvoid */*ctx*/,\n\tconst char */*fmt*/,\n\t...);\n\nint\n_hx509_private_key2SPKI (\n\thx509_context /*context*/,\n\thx509_private_key /*private_key*/,\n\tSubjectPublicKeyInfo */*spki*/);\n\nvoid\n_hx509_private_key_assign_rsa (\n\thx509_private_key /*key*/,\n\tvoid */*ptr*/);\n\nint\n_hx509_private_key_export (\n\thx509_context /*context*/,\n\tconst hx509_private_key /*key*/,\n\theim_octet_string */*data*/);\n\nint\n_hx509_private_key_exportable (hx509_private_key /*key*/);\n\nint\n_hx509_private_key_free (hx509_private_key */*key*/);\n\nBIGNUM *\n_hx509_private_key_get_internal (\n\thx509_context /*context*/,\n\thx509_private_key /*key*/,\n\tconst char */*type*/);\n\nint\n_hx509_private_key_init (\n\thx509_private_key */*key*/,\n\thx509_private_key_ops */*ops*/,\n\tvoid */*keydata*/);\n\nint\n_hx509_private_key_oid (\n\thx509_context /*context*/,\n\tconst hx509_private_key /*key*/,\n\theim_oid */*data*/);\n\nint\n_hx509_private_key_private_decrypt (\n\thx509_context /*context*/,\n\tconst heim_octet_string */*ciphertext*/,\n\tconst heim_oid */*encryption_oid*/,\n\thx509_private_key /*p*/,\n\theim_octet_string */*cleartext*/);\n\nhx509_private_key\n_hx509_private_key_ref (hx509_private_key /*key*/);\n\nconst char *\n_hx509_private_pem_name (hx509_private_key /*key*/);\n\nint\n_hx509_public_encrypt (\n\thx509_context /*context*/,\n\tconst heim_octet_string */*cleartext*/,\n\tconst Certificate */*cert*/,\n\theim_oid */*encryption_oid*/,\n\theim_octet_string */*ciphertext*/);\n\nvoid\n_hx509_query_clear (hx509_query */*q*/);\n\nint\n_hx509_query_match_cert (\n\thx509_context /*context*/,\n\tconst hx509_query */*q*/,\n\thx509_cert /*cert*/);\n\nvoid\n_hx509_query_statistic (\n\thx509_context /*context*/,\n\tint /*type*/,\n\tconst hx509_query */*q*/);\n\nint\n_hx509_request_add_dns_name (\n\thx509_context /*context*/,\n\thx509_request /*req*/,\n\tconst char */*hostname*/);\n\nint\n_hx509_request_add_eku (\n\thx509_context /*context*/,\n\thx509_request /*req*/,\n\tconst heim_oid */*oid*/);\n\nint\n_hx509_request_add_email (\n\thx509_context /*context*/,\n\thx509_request /*req*/,\n\tconst char */*email*/);\n\nvoid\n_hx509_request_free (hx509_request */*req*/);\n\nint\n_hx509_request_get_SubjectPublicKeyInfo (\n\thx509_context /*context*/,\n\thx509_request /*req*/,\n\tSubjectPublicKeyInfo */*key*/);\n\nint\n_hx509_request_get_name (\n\thx509_context /*context*/,\n\thx509_request /*req*/,\n\thx509_name */*name*/);\n\nint\n_hx509_request_init (\n\thx509_context /*context*/,\n\thx509_request */*req*/);\n\nint\n_hx509_request_parse (\n\thx509_context /*context*/,\n\tconst char */*path*/,\n\thx509_request */*req*/);\n\nint\n_hx509_request_print (\n\thx509_context /*context*/,\n\thx509_request /*req*/,\n\tFILE */*f*/);\n\nint\n_hx509_request_set_SubjectPublicKeyInfo (\n\thx509_context /*context*/,\n\thx509_request /*req*/,\n\tconst SubjectPublicKeyInfo */*key*/);\n\nint\n_hx509_request_set_name (\n\thx509_context /*context*/,\n\thx509_request /*req*/,\n\thx509_name /*name*/);\n\nint\n_hx509_request_to_pkcs10 (\n\thx509_context /*context*/,\n\tconst hx509_request /*req*/,\n\tconst hx509_private_key /*signer*/,\n\theim_octet_string */*request*/);\n\nhx509_revoke_ctx\n_hx509_revoke_ref (hx509_revoke_ctx /*ctx*/);\n\nint\n_hx509_set_cert_attribute (\n\thx509_context /*context*/,\n\thx509_cert /*cert*/,\n\tconst heim_oid */*oid*/,\n\tconst heim_octet_string */*attr*/);\n\nvoid\n_hx509_unmap_file (\n\tvoid */*data*/,\n\tsize_t /*len*/);\n\nvoid\n_hx509_unmap_file_os (heim_octet_string */*os*/);\n\nint\n_hx509_unparse_Name (\n\tconst Name */*aname*/,\n\tchar **/*str*/);\n\nint\n_hx509_verify_signature (\n\thx509_context /*context*/,\n\tconst Certificate */*signer*/,\n\tconst AlgorithmIdentifier */*alg*/,\n\tconst heim_octet_string */*data*/,\n\tconst heim_octet_string */*sig*/);\n\nint\n_hx509_verify_signature_bitstring (\n\thx509_context /*context*/,\n\tconst Certificate */*signer*/,\n\tconst AlgorithmIdentifier */*alg*/,\n\tconst heim_octet_string */*data*/,\n\tconst heim_bit_string */*sig*/);\n\nint\n_hx509_write_file (\n\tconst char */*fn*/,\n\tconst void */*data*/,\n\tsize_t /*length*/);\n\n#endif /* __hx509_private_h__ */\n"
  },
  {
    "path": "freebsd-headers/hx509-protos.h",
    "content": "/* This is a generated file */\n#ifndef __hx509_protos_h__\n#define __hx509_protos_h__\n\n#include <stdarg.h>\n\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\n#ifndef HX509_LIB_FUNCTION\n#if defined(_WIN32)\n#define HX509_LIB_FUNCTION _stdcall\n#else\n#define HX509_LIB_FUNCTION\n#endif\n#endif\n\nvoid\nhx509_bitstring_print (\n\tconst heim_bit_string */*b*/,\n\thx509_vprint_func /*func*/,\n\tvoid */*ctx*/);\n\nint\nhx509_ca_sign (\n\thx509_context /*context*/,\n\thx509_ca_tbs /*tbs*/,\n\thx509_cert /*signer*/,\n\thx509_cert */*certificate*/);\n\nint\nhx509_ca_sign_self (\n\thx509_context /*context*/,\n\thx509_ca_tbs /*tbs*/,\n\thx509_private_key /*signer*/,\n\thx509_cert */*certificate*/);\n\nint\nhx509_ca_tbs_add_crl_dp_uri (\n\thx509_context /*context*/,\n\thx509_ca_tbs /*tbs*/,\n\tconst char */*uri*/,\n\thx509_name /*issuername*/);\n\nint\nhx509_ca_tbs_add_eku (\n\thx509_context /*context*/,\n\thx509_ca_tbs /*tbs*/,\n\tconst heim_oid */*oid*/);\n\nint\nhx509_ca_tbs_add_san_hostname (\n\thx509_context /*context*/,\n\thx509_ca_tbs /*tbs*/,\n\tconst char */*dnsname*/);\n\nint\nhx509_ca_tbs_add_san_jid (\n\thx509_context /*context*/,\n\thx509_ca_tbs /*tbs*/,\n\tconst char */*jid*/);\n\nint\nhx509_ca_tbs_add_san_ms_upn (\n\thx509_context /*context*/,\n\thx509_ca_tbs /*tbs*/,\n\tconst char */*principal*/);\n\nint\nhx509_ca_tbs_add_san_otherName (\n\thx509_context /*context*/,\n\thx509_ca_tbs /*tbs*/,\n\tconst heim_oid */*oid*/,\n\tconst heim_octet_string */*os*/);\n\nint\nhx509_ca_tbs_add_san_pkinit (\n\thx509_context /*context*/,\n\thx509_ca_tbs /*tbs*/,\n\tconst char */*principal*/);\n\nint\nhx509_ca_tbs_add_san_rfc822name (\n\thx509_context /*context*/,\n\thx509_ca_tbs /*tbs*/,\n\tconst char */*rfc822Name*/);\n\nvoid\nhx509_ca_tbs_free (hx509_ca_tbs */*tbs*/);\n\nint\nhx509_ca_tbs_init (\n\thx509_context /*context*/,\n\thx509_ca_tbs */*tbs*/);\n\nint\nhx509_ca_tbs_set_ca (\n\thx509_context /*context*/,\n\thx509_ca_tbs /*tbs*/,\n\tint /*pathLenConstraint*/);\n\nint\nhx509_ca_tbs_set_domaincontroller (\n\thx509_context /*context*/,\n\thx509_ca_tbs /*tbs*/);\n\nint\nhx509_ca_tbs_set_notAfter (\n\thx509_context /*context*/,\n\thx509_ca_tbs /*tbs*/,\n\ttime_t /*t*/);\n\nint\nhx509_ca_tbs_set_notAfter_lifetime (\n\thx509_context /*context*/,\n\thx509_ca_tbs /*tbs*/,\n\ttime_t /*delta*/);\n\nint\nhx509_ca_tbs_set_notBefore (\n\thx509_context /*context*/,\n\thx509_ca_tbs /*tbs*/,\n\ttime_t /*t*/);\n\nint\nhx509_ca_tbs_set_proxy (\n\thx509_context /*context*/,\n\thx509_ca_tbs /*tbs*/,\n\tint /*pathLenConstraint*/);\n\nint\nhx509_ca_tbs_set_serialnumber (\n\thx509_context /*context*/,\n\thx509_ca_tbs /*tbs*/,\n\tconst heim_integer */*serialNumber*/);\n\nint\nhx509_ca_tbs_set_spki (\n\thx509_context /*context*/,\n\thx509_ca_tbs /*tbs*/,\n\tconst SubjectPublicKeyInfo */*spki*/);\n\nint\nhx509_ca_tbs_set_subject (\n\thx509_context /*context*/,\n\thx509_ca_tbs /*tbs*/,\n\thx509_name /*subject*/);\n\nint\nhx509_ca_tbs_set_template (\n\thx509_context /*context*/,\n\thx509_ca_tbs /*tbs*/,\n\tint /*flags*/,\n\thx509_cert /*cert*/);\n\nint\nhx509_ca_tbs_subject_expand (\n\thx509_context /*context*/,\n\thx509_ca_tbs /*tbs*/,\n\thx509_env /*env*/);\n\nconst struct units *\nhx509_ca_tbs_template_units (void);\n\nint\nhx509_cert_binary (\n\thx509_context /*context*/,\n\thx509_cert /*c*/,\n\theim_octet_string */*os*/);\n\nint\nhx509_cert_check_eku (\n\thx509_context /*context*/,\n\thx509_cert /*cert*/,\n\tconst heim_oid */*eku*/,\n\tint /*allow_any_eku*/);\n\nint\nhx509_cert_cmp (\n\thx509_cert /*p*/,\n\thx509_cert /*q*/);\n\nint\nhx509_cert_find_subjectAltName_otherName (\n\thx509_context /*context*/,\n\thx509_cert /*cert*/,\n\tconst heim_oid */*oid*/,\n\thx509_octet_string_list */*list*/);\n\nvoid\nhx509_cert_free (hx509_cert /*cert*/);\n\nint\nhx509_cert_get_SPKI (\n\thx509_context /*context*/,\n\thx509_cert /*p*/,\n\tSubjectPublicKeyInfo */*spki*/);\n\nint\nhx509_cert_get_SPKI_AlgorithmIdentifier (\n\thx509_context /*context*/,\n\thx509_cert /*p*/,\n\tAlgorithmIdentifier */*alg*/);\n\nhx509_cert_attribute\nhx509_cert_get_attribute (\n\thx509_cert /*cert*/,\n\tconst heim_oid */*oid*/);\n\nint\nhx509_cert_get_base_subject (\n\thx509_context /*context*/,\n\thx509_cert /*c*/,\n\thx509_name */*name*/);\n\nconst char *\nhx509_cert_get_friendly_name (hx509_cert /*cert*/);\n\nint\nhx509_cert_get_issuer (\n\thx509_cert /*p*/,\n\thx509_name */*name*/);\n\ntime_t\nhx509_cert_get_notAfter (hx509_cert /*p*/);\n\ntime_t\nhx509_cert_get_notBefore (hx509_cert /*p*/);\n\nint\nhx509_cert_get_serialnumber (\n\thx509_cert /*p*/,\n\theim_integer */*i*/);\n\nint\nhx509_cert_get_subject (\n\thx509_cert /*p*/,\n\thx509_name */*name*/);\n\nint\nhx509_cert_have_private_key (hx509_cert /*p*/);\n\nint\nhx509_cert_init (\n\thx509_context /*context*/,\n\tconst Certificate */*c*/,\n\thx509_cert */*cert*/);\n\nint\nhx509_cert_init_data (\n\thx509_context /*context*/,\n\tconst void */*ptr*/,\n\tsize_t /*len*/,\n\thx509_cert */*cert*/);\n\nint\nhx509_cert_keyusage_print (\n\thx509_context /*context*/,\n\thx509_cert /*c*/,\n\tchar **/*s*/);\n\nhx509_cert\nhx509_cert_ref (hx509_cert /*cert*/);\n\nint\nhx509_cert_set_friendly_name (\n\thx509_cert /*cert*/,\n\tconst char */*name*/);\n\nint\nhx509_certs_add (\n\thx509_context /*context*/,\n\thx509_certs /*certs*/,\n\thx509_cert /*cert*/);\n\nint\nhx509_certs_append (\n\thx509_context /*context*/,\n\thx509_certs /*to*/,\n\thx509_lock /*lock*/,\n\tconst char */*name*/);\n\nint\nhx509_certs_end_seq (\n\thx509_context /*context*/,\n\thx509_certs /*certs*/,\n\thx509_cursor /*cursor*/);\n\nint\nhx509_certs_find (\n\thx509_context /*context*/,\n\thx509_certs /*certs*/,\n\tconst hx509_query */*q*/,\n\thx509_cert */*r*/);\n\nvoid\nhx509_certs_free (hx509_certs */*certs*/);\n\nint\nhx509_certs_info (\n\thx509_context /*context*/,\n\thx509_certs /*certs*/,\n\tint (*/*func*/)(void *, const char *),\n\tvoid */*ctx*/);\n\nint\nhx509_certs_init (\n\thx509_context /*context*/,\n\tconst char */*name*/,\n\tint /*flags*/,\n\thx509_lock /*lock*/,\n\thx509_certs */*certs*/);\n\nint\nhx509_certs_iter (\n\thx509_context /*context*/,\n\thx509_certs /*certs*/,\n\tint (*/*func*/)(hx509_context, void *, hx509_cert),\n\tvoid */*ctx*/);\n\nint\nhx509_certs_merge (\n\thx509_context /*context*/,\n\thx509_certs /*to*/,\n\thx509_certs /*from*/);\n\nint\nhx509_certs_next_cert (\n\thx509_context /*context*/,\n\thx509_certs /*certs*/,\n\thx509_cursor /*cursor*/,\n\thx509_cert */*cert*/);\n\nint\nhx509_certs_start_seq (\n\thx509_context /*context*/,\n\thx509_certs /*certs*/,\n\thx509_cursor */*cursor*/);\n\nint\nhx509_certs_store (\n\thx509_context /*context*/,\n\thx509_certs /*certs*/,\n\tint /*flags*/,\n\thx509_lock /*lock*/);\n\nint\nhx509_ci_print_names (\n\thx509_context /*context*/,\n\tvoid */*ctx*/,\n\thx509_cert /*c*/);\n\nvoid\nhx509_clear_error_string (hx509_context /*context*/);\n\nint\nhx509_cms_create_signed_1 (\n\thx509_context /*context*/,\n\tint /*flags*/,\n\tconst heim_oid */*eContentType*/,\n\tconst void */*data*/,\n\tsize_t /*length*/,\n\tconst AlgorithmIdentifier */*digest_alg*/,\n\thx509_cert /*cert*/,\n\thx509_peer_info /*peer*/,\n\thx509_certs /*anchors*/,\n\thx509_certs /*pool*/,\n\theim_octet_string */*signed_data*/);\n\nint\nhx509_cms_decrypt_encrypted (\n\thx509_context /*context*/,\n\thx509_lock /*lock*/,\n\tconst void */*data*/,\n\tsize_t /*length*/,\n\theim_oid */*contentType*/,\n\theim_octet_string */*content*/);\n\nint\nhx509_cms_envelope_1 (\n\thx509_context /*context*/,\n\tint /*flags*/,\n\thx509_cert /*cert*/,\n\tconst void */*data*/,\n\tsize_t /*length*/,\n\tconst heim_oid */*encryption_type*/,\n\tconst heim_oid */*contentType*/,\n\theim_octet_string */*content*/);\n\nint\nhx509_cms_unenvelope (\n\thx509_context /*context*/,\n\thx509_certs /*certs*/,\n\tint /*flags*/,\n\tconst void */*data*/,\n\tsize_t /*length*/,\n\tconst heim_octet_string */*encryptedContent*/,\n\theim_oid */*contentType*/,\n\theim_octet_string */*content*/);\n\nint\nhx509_cms_unwrap_ContentInfo (\n\tconst heim_octet_string */*in*/,\n\theim_oid */*oid*/,\n\theim_octet_string */*out*/,\n\tint */*have_data*/);\n\nint\nhx509_cms_verify_signed (\n\thx509_context /*context*/,\n\thx509_verify_ctx /*ctx*/,\n\tconst void */*data*/,\n\tsize_t /*length*/,\n\tconst heim_octet_string */*signedContent*/,\n\thx509_certs /*pool*/,\n\theim_oid */*contentType*/,\n\theim_octet_string */*content*/,\n\thx509_certs */*signer_certs*/);\n\nint\nhx509_cms_wrap_ContentInfo (\n\tconst heim_oid */*oid*/,\n\tconst heim_octet_string */*buf*/,\n\theim_octet_string */*res*/);\n\nvoid\nhx509_context_free (hx509_context */*context*/);\n\nint\nhx509_context_init (hx509_context */*context*/);\n\nvoid\nhx509_context_set_missing_revoke (\n\thx509_context /*context*/,\n\tint /*flag*/);\n\nint\nhx509_crl_add_revoked_certs (\n\thx509_context /*context*/,\n\thx509_crl /*crl*/,\n\thx509_certs /*certs*/);\n\nint\nhx509_crl_alloc (\n\thx509_context /*context*/,\n\thx509_crl */*crl*/);\n\nvoid\nhx509_crl_free (\n\thx509_context /*context*/,\n\thx509_crl */*crl*/);\n\nint\nhx509_crl_lifetime (\n\thx509_context /*context*/,\n\thx509_crl /*crl*/,\n\tint /*delta*/);\n\nint\nhx509_crl_sign (\n\thx509_context /*context*/,\n\thx509_cert /*signer*/,\n\thx509_crl /*crl*/,\n\theim_octet_string */*os*/);\n\nconst AlgorithmIdentifier *\nhx509_crypto_aes128_cbc (void);\n\nconst AlgorithmIdentifier *\nhx509_crypto_aes256_cbc (void);\n\nint\nhx509_crypto_available (\n\thx509_context /*context*/,\n\tint /*type*/,\n\thx509_cert /*source*/,\n\tAlgorithmIdentifier **/*val*/,\n\tunsigned int */*plen*/);\n\nint\nhx509_crypto_decrypt (\n\thx509_crypto /*crypto*/,\n\tconst void */*data*/,\n\tconst size_t /*length*/,\n\theim_octet_string */*ivec*/,\n\theim_octet_string */*clear*/);\n\nconst AlgorithmIdentifier *\nhx509_crypto_des_rsdi_ede3_cbc (void);\n\nvoid\nhx509_crypto_destroy (hx509_crypto /*crypto*/);\n\nint\nhx509_crypto_encrypt (\n\thx509_crypto /*crypto*/,\n\tconst void */*data*/,\n\tconst size_t /*length*/,\n\tconst heim_octet_string */*ivec*/,\n\theim_octet_string **/*ciphertext*/);\n\nconst heim_oid *\nhx509_crypto_enctype_by_name (const char */*name*/);\n\nvoid\nhx509_crypto_free_algs (\n\tAlgorithmIdentifier */*val*/,\n\tunsigned int /*len*/);\n\nint\nhx509_crypto_get_params (\n\thx509_context /*context*/,\n\thx509_crypto /*crypto*/,\n\tconst heim_octet_string */*ivec*/,\n\theim_octet_string */*param*/);\n\nint\nhx509_crypto_init (\n\thx509_context /*context*/,\n\tconst char */*provider*/,\n\tconst heim_oid */*enctype*/,\n\thx509_crypto */*crypto*/);\n\nconst char *\nhx509_crypto_provider (hx509_crypto /*crypto*/);\n\nint\nhx509_crypto_random_iv (\n\thx509_crypto /*crypto*/,\n\theim_octet_string */*ivec*/);\n\nint\nhx509_crypto_select (\n\tconst hx509_context /*context*/,\n\tint /*type*/,\n\tconst hx509_private_key /*source*/,\n\thx509_peer_info /*peer*/,\n\tAlgorithmIdentifier */*selected*/);\n\nint\nhx509_crypto_set_key_data (\n\thx509_crypto /*crypto*/,\n\tconst void */*data*/,\n\tsize_t /*length*/);\n\nint\nhx509_crypto_set_key_name (\n\thx509_crypto /*crypto*/,\n\tconst char */*name*/);\n\nint\nhx509_crypto_set_params (\n\thx509_context /*context*/,\n\thx509_crypto /*crypto*/,\n\tconst heim_octet_string */*param*/,\n\theim_octet_string */*ivec*/);\n\nint\nhx509_crypto_set_random_key (\n\thx509_crypto /*crypto*/,\n\theim_octet_string */*key*/);\n\nint\nhx509_env_add (\n\thx509_context /*context*/,\n\thx509_env /*env*/,\n\tconst char */*key*/,\n\tconst char */*value*/);\n\nvoid\nhx509_env_free (hx509_env */*env*/);\n\nint\nhx509_env_init (\n\thx509_context /*context*/,\n\thx509_env */*env*/);\n\nconst char *\nhx509_env_lfind (\n\thx509_context /*context*/,\n\thx509_env /*env*/,\n\tconst char */*key*/,\n\tsize_t /*len*/);\n\nvoid\nhx509_err (\n\thx509_context /*context*/,\n\tint /*exit_code*/,\n\tint /*error_code*/,\n\tconst char */*fmt*/,\n\t...);\n\nvoid\nhx509_free_error_string (char */*str*/);\n\nvoid\nhx509_free_octet_string_list (hx509_octet_string_list */*list*/);\n\nint\nhx509_general_name_unparse (\n\tGeneralName */*name*/,\n\tchar **/*str*/);\n\nchar *\nhx509_get_error_string (\n\thx509_context /*context*/,\n\tint /*error_code*/);\n\nint\nhx509_get_one_cert (\n\thx509_context /*context*/,\n\thx509_certs /*certs*/,\n\thx509_cert */*c*/);\n\nint\nhx509_lock_add_cert (\n\thx509_context /*context*/,\n\thx509_lock /*lock*/,\n\thx509_cert /*cert*/);\n\nint\nhx509_lock_add_certs (\n\thx509_context /*context*/,\n\thx509_lock /*lock*/,\n\thx509_certs /*certs*/);\n\nint\nhx509_lock_add_password (\n\thx509_lock /*lock*/,\n\tconst char */*password*/);\n\nint\nhx509_lock_command_string (\n\thx509_lock /*lock*/,\n\tconst char */*string*/);\n\nvoid\nhx509_lock_free (hx509_lock /*lock*/);\n\nint\nhx509_lock_init (\n\thx509_context /*context*/,\n\thx509_lock */*lock*/);\n\nint\nhx509_lock_prompt (\n\thx509_lock /*lock*/,\n\thx509_prompt */*prompt*/);\n\nvoid\nhx509_lock_reset_certs (\n\thx509_context /*context*/,\n\thx509_lock /*lock*/);\n\nvoid\nhx509_lock_reset_passwords (hx509_lock /*lock*/);\n\nvoid\nhx509_lock_reset_promper (hx509_lock /*lock*/);\n\nint\nhx509_lock_set_prompter (\n\thx509_lock /*lock*/,\n\thx509_prompter_fct /*prompt*/,\n\tvoid */*data*/);\n\nint\nhx509_name_binary (\n\tconst hx509_name /*name*/,\n\theim_octet_string */*os*/);\n\nint\nhx509_name_cmp (\n\thx509_name /*n1*/,\n\thx509_name /*n2*/);\n\nint\nhx509_name_copy (\n\thx509_context /*context*/,\n\tconst hx509_name /*from*/,\n\thx509_name */*to*/);\n\nint\nhx509_name_expand (\n\thx509_context /*context*/,\n\thx509_name /*name*/,\n\thx509_env /*env*/);\n\nvoid\nhx509_name_free (hx509_name */*name*/);\n\nint\nhx509_name_is_null_p (const hx509_name /*name*/);\n\nint\nhx509_name_normalize (\n\thx509_context /*context*/,\n\thx509_name /*name*/);\n\nint\nhx509_name_to_Name (\n\tconst hx509_name /*from*/,\n\tName */*to*/);\n\nint\nhx509_name_to_string (\n\tconst hx509_name /*name*/,\n\tchar **/*str*/);\n\nint\nhx509_ocsp_request (\n\thx509_context /*context*/,\n\thx509_certs /*reqcerts*/,\n\thx509_certs /*pool*/,\n\thx509_cert /*signer*/,\n\tconst AlgorithmIdentifier */*digest*/,\n\theim_octet_string */*request*/,\n\theim_octet_string */*nonce*/);\n\nint\nhx509_ocsp_verify (\n\thx509_context /*context*/,\n\ttime_t /*now*/,\n\thx509_cert /*cert*/,\n\tint /*flags*/,\n\tconst void */*data*/,\n\tsize_t /*length*/,\n\ttime_t */*expiration*/);\n\nvoid\nhx509_oid_print (\n\tconst heim_oid */*oid*/,\n\thx509_vprint_func /*func*/,\n\tvoid */*ctx*/);\n\nint\nhx509_oid_sprint (\n\tconst heim_oid */*oid*/,\n\tchar **/*str*/);\n\nint\nhx509_parse_name (\n\thx509_context /*context*/,\n\tconst char */*str*/,\n\thx509_name */*name*/);\n\nint\nhx509_peer_info_alloc (\n\thx509_context /*context*/,\n\thx509_peer_info */*peer*/);\n\nvoid\nhx509_peer_info_free (hx509_peer_info /*peer*/);\n\nint\nhx509_peer_info_set_cert (\n\thx509_peer_info /*peer*/,\n\thx509_cert /*cert*/);\n\nint\nhx509_peer_info_set_cms_algs (\n\thx509_context /*context*/,\n\thx509_peer_info /*peer*/,\n\tconst AlgorithmIdentifier */*val*/,\n\tsize_t /*len*/);\n\nint\nhx509_pem_add_header (\n\thx509_pem_header **/*headers*/,\n\tconst char */*header*/,\n\tconst char */*value*/);\n\nconst char *\nhx509_pem_find_header (\n\tconst hx509_pem_header */*h*/,\n\tconst char */*header*/);\n\nvoid\nhx509_pem_free_header (hx509_pem_header */*headers*/);\n\nint\nhx509_pem_read (\n\thx509_context /*context*/,\n\tFILE */*f*/,\n\thx509_pem_read_func /*func*/,\n\tvoid */*ctx*/);\n\nint\nhx509_pem_write (\n\thx509_context /*context*/,\n\tconst char */*type*/,\n\thx509_pem_header */*headers*/,\n\tFILE */*f*/,\n\tconst void */*data*/,\n\tsize_t /*size*/);\n\nvoid\nhx509_print_stdout (\n\tvoid */*ctx*/,\n\tconst char */*fmt*/,\n\tva_list /*va*/);\n\nint\nhx509_prompt_hidden (hx509_prompt_type /*type*/);\n\nint\nhx509_query_alloc (\n\thx509_context /*context*/,\n\thx509_query **/*q*/);\n\nvoid\nhx509_query_free (\n\thx509_context /*context*/,\n\thx509_query */*q*/);\n\nint\nhx509_query_match_cmp_func (\n\thx509_query */*q*/,\n\tint (*/*func*/)(void *, hx509_cert),\n\tvoid */*ctx*/);\n\nint\nhx509_query_match_friendly_name (\n\thx509_query */*q*/,\n\tconst char */*name*/);\n\nint\nhx509_query_match_issuer_serial (\n\thx509_query */*q*/,\n\tconst Name */*issuer*/,\n\tconst heim_integer */*serialNumber*/);\n\nvoid\nhx509_query_match_option (\n\thx509_query */*q*/,\n\thx509_query_option /*option*/);\n\nvoid\nhx509_query_statistic_file (\n\thx509_context /*context*/,\n\tconst char */*fn*/);\n\nvoid\nhx509_query_unparse_stats (\n\thx509_context /*context*/,\n\tint /*printtype*/,\n\tFILE */*out*/);\n\nint\nhx509_revoke_add_crl (\n\thx509_context /*context*/,\n\thx509_revoke_ctx /*ctx*/,\n\tconst char */*path*/);\n\nint\nhx509_revoke_add_ocsp (\n\thx509_context /*context*/,\n\thx509_revoke_ctx /*ctx*/,\n\tconst char */*path*/);\n\nvoid\nhx509_revoke_free (hx509_revoke_ctx */*ctx*/);\n\nint\nhx509_revoke_init (\n\thx509_context /*context*/,\n\thx509_revoke_ctx */*ctx*/);\n\nint\nhx509_revoke_ocsp_print (\n\thx509_context /*context*/,\n\tconst char */*path*/,\n\tFILE */*out*/);\n\nint\nhx509_revoke_verify (\n\thx509_context /*context*/,\n\thx509_revoke_ctx /*ctx*/,\n\thx509_certs /*certs*/,\n\ttime_t /*now*/,\n\thx509_cert /*cert*/,\n\thx509_cert /*parent_cert*/);\n\nvoid\nhx509_set_error_string (\n\thx509_context /*context*/,\n\tint /*flags*/,\n\tint /*code*/,\n\tconst char */*fmt*/,\n\t...);\n\nvoid\nhx509_set_error_stringv (\n\thx509_context /*context*/,\n\tint /*flags*/,\n\tint /*code*/,\n\tconst char */*fmt*/,\n\tva_list /*ap*/);\n\nconst AlgorithmIdentifier *\nhx509_signature_md2 (void);\n\nconst AlgorithmIdentifier *\nhx509_signature_md5 (void);\n\nconst AlgorithmIdentifier *\nhx509_signature_rsa (void);\n\nconst AlgorithmIdentifier *\nhx509_signature_rsa_pkcs1_x509 (void);\n\nconst AlgorithmIdentifier *\nhx509_signature_rsa_with_md2 (void);\n\nconst AlgorithmIdentifier *\nhx509_signature_rsa_with_md5 (void);\n\nconst AlgorithmIdentifier *\nhx509_signature_rsa_with_sha1 (void);\n\nconst AlgorithmIdentifier *\nhx509_signature_rsa_with_sha256 (void);\n\nconst AlgorithmIdentifier *\nhx509_signature_rsa_with_sha384 (void);\n\nconst AlgorithmIdentifier *\nhx509_signature_rsa_with_sha512 (void);\n\nconst AlgorithmIdentifier *\nhx509_signature_sha1 (void);\n\nconst AlgorithmIdentifier *\nhx509_signature_sha256 (void);\n\nconst AlgorithmIdentifier *\nhx509_signature_sha384 (void);\n\nconst AlgorithmIdentifier *\nhx509_signature_sha512 (void);\n\nint\nhx509_unparse_der_name (\n\tconst void */*data*/,\n\tsize_t /*length*/,\n\tchar **/*str*/);\n\nint\nhx509_validate_cert (\n\thx509_context /*context*/,\n\thx509_validate_ctx /*ctx*/,\n\thx509_cert /*cert*/);\n\nvoid\nhx509_validate_ctx_add_flags (\n\thx509_validate_ctx /*ctx*/,\n\tint /*flags*/);\n\nvoid\nhx509_validate_ctx_free (hx509_validate_ctx /*ctx*/);\n\nint\nhx509_validate_ctx_init (\n\thx509_context /*context*/,\n\thx509_validate_ctx */*ctx*/);\n\nvoid\nhx509_validate_ctx_set_print (\n\thx509_validate_ctx /*ctx*/,\n\thx509_vprint_func /*func*/,\n\tvoid */*c*/);\n\nvoid\nhx509_verify_attach_anchors (\n\thx509_verify_ctx /*ctx*/,\n\thx509_certs /*set*/);\n\nvoid\nhx509_verify_attach_revoke (\n\thx509_verify_ctx /*ctx*/,\n\thx509_revoke_ctx /*revoke_ctx*/);\n\nvoid\nhx509_verify_ctx_f_allow_default_trustanchors (\n\thx509_verify_ctx /*ctx*/,\n\tint /*boolean*/);\n\nvoid\nhx509_verify_destroy_ctx (hx509_verify_ctx /*ctx*/);\n\nint\nhx509_verify_hostname (\n\thx509_context /*context*/,\n\tconst hx509_cert /*cert*/,\n\tint /*flags*/,\n\thx509_hostname_type /*type*/,\n\tconst char */*hostname*/,\n\tconst struct sockaddr */*sa*/,\n\tint /*sa_size*/);\n\nint\nhx509_verify_init_ctx (\n\thx509_context /*context*/,\n\thx509_verify_ctx */*ctx*/);\n\nint\nhx509_verify_path (\n\thx509_context /*context*/,\n\thx509_verify_ctx /*ctx*/,\n\thx509_cert /*cert*/,\n\thx509_certs /*pool*/);\n\nvoid\nhx509_verify_set_max_depth (\n\thx509_verify_ctx /*ctx*/,\n\tunsigned int /*max_depth*/);\n\nvoid\nhx509_verify_set_proxy_certificate (\n\thx509_verify_ctx /*ctx*/,\n\tint /*boolean*/);\n\nvoid\nhx509_verify_set_strict_rfc3280_verification (\n\thx509_verify_ctx /*ctx*/,\n\tint /*boolean*/);\n\nvoid\nhx509_verify_set_time (\n\thx509_verify_ctx /*ctx*/,\n\ttime_t /*t*/);\n\nint\nhx509_verify_signature (\n\thx509_context /*context*/,\n\tconst hx509_cert /*signer*/,\n\tconst AlgorithmIdentifier */*alg*/,\n\tconst heim_octet_string */*data*/,\n\tconst heim_octet_string */*sig*/);\n\nvoid\nhx509_xfree (void */*ptr*/);\n\n#ifdef __cplusplus\n}\n#endif\n\n#endif /* __hx509_protos_h__ */\n"
  },
  {
    "path": "freebsd-headers/hx509.h",
    "content": "/*\n * Copyright (c) 2004 - 2007 Kungliga Tekniska Hgskolan\n * (Royal Institute of Technology, Stockholm, Sweden). \n * All rights reserved. \n *\n * Redistribution and use in source and binary forms, with or without \n * modification, are permitted provided that the following conditions \n * are met: \n *\n * 1. Redistributions of source code must retain the above copyright \n *    notice, this list of conditions and the following disclaimer. \n *\n * 2. Redistributions in binary form must reproduce the above copyright \n *    notice, this list of conditions and the following disclaimer in the \n *    documentation and/or other materials provided with the distribution. \n *\n * 3. Neither the name of the Institute nor the names of its contributors \n *    may be used to endorse or promote products derived from this software \n *    without specific prior written permission. \n *\n * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND \n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE \n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE \n * ARE DISCLAIMED.  IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE \n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL \n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS \n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) \n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT \n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY \n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF \n * SUCH DAMAGE. \n */\n\n/* $Id: hx509.h 22464 2008-01-16 14:24:50Z lha $ */\n\ntypedef struct hx509_cert_attribute_data *hx509_cert_attribute;\ntypedef struct hx509_cert_data *hx509_cert;\ntypedef struct hx509_certs_data *hx509_certs;\ntypedef struct hx509_context_data *hx509_context;\ntypedef struct hx509_crypto_data *hx509_crypto;\ntypedef struct hx509_lock_data *hx509_lock;\ntypedef struct hx509_name_data *hx509_name;\ntypedef struct hx509_private_key *hx509_private_key;\ntypedef struct hx509_validate_ctx_data *hx509_validate_ctx;\ntypedef struct hx509_verify_ctx_data *hx509_verify_ctx;\ntypedef struct hx509_revoke_ctx_data *hx509_revoke_ctx;\ntypedef struct hx509_query_data hx509_query;\ntypedef void * hx509_cursor;\ntypedef struct hx509_request_data *hx509_request;\ntypedef struct hx509_error_data *hx509_error;\ntypedef struct hx509_peer_info *hx509_peer_info;\ntypedef struct hx509_ca_tbs *hx509_ca_tbs;\ntypedef struct hx509_env *hx509_env;\ntypedef struct hx509_crl *hx509_crl;\n\ntypedef void (*hx509_vprint_func)(void *, const char *, va_list);\n\nenum {\n    HX509_VHN_F_ALLOW_NO_MATCH = 1\n};\n\nenum {\n    HX509_VALIDATE_F_VALIDATE = 1,\n    HX509_VALIDATE_F_VERBOSE = 2\n};\n\nstruct hx509_cert_attribute_data {\n    heim_oid oid;\n    heim_octet_string data;\n};\n\ntypedef enum {\n    HX509_PROMPT_TYPE_PASSWORD\t\t= 0x1,\t/* password, hidden */\n    HX509_PROMPT_TYPE_QUESTION\t\t= 0x2,\t/* question, not hidden */\n    HX509_PROMPT_TYPE_INFO\t\t= 0x4\t/* infomation, reply doesn't matter */\n} hx509_prompt_type;\n\ntypedef struct hx509_prompt {\n    const char *prompt;\n    hx509_prompt_type type;\n    heim_octet_string reply;\n} hx509_prompt;\n\ntypedef int (*hx509_prompter_fct)(void *, const hx509_prompt *);\n\ntypedef struct hx509_octet_string_list {\n    size_t len;\n    heim_octet_string *val;\n} hx509_octet_string_list;\n\ntypedef struct hx509_pem_header {\n    struct hx509_pem_header *next;\n    char *header;\n    char *value;\n} hx509_pem_header;\n\ntypedef int\n(*hx509_pem_read_func)(hx509_context, const char *, const hx509_pem_header *,\n\t\t       const void *, size_t, void *ctx);\n\n/*\n * Options passed to hx509_query_match_option.\n */\ntypedef enum {\n    HX509_QUERY_OPTION_PRIVATE_KEY = 1,\n    HX509_QUERY_OPTION_KU_ENCIPHERMENT = 2,\n    HX509_QUERY_OPTION_KU_DIGITALSIGNATURE = 3,\n    HX509_QUERY_OPTION_KU_KEYCERTSIGN = 4,\n    HX509_QUERY_OPTION_END = 0xffff\n} hx509_query_option;\n\n/* flags to hx509_certs_init */\n#define HX509_CERTS_CREATE\t\t\t\t0x01\n#define HX509_CERTS_UNPROTECT_ALL\t\t\t0x02\n\n/* flags to hx509_set_error_string */\n#define HX509_ERROR_APPEND\t\t\t\t0x01\n\n/* flags to hx509_cms_unenvelope */\n#define HX509_CMS_UE_DONT_REQUIRE_KU_ENCIPHERMENT\t0x01\n\n/* selectors passed to hx509_crypto_select and hx509_crypto_available */\n#define HX509_SELECT_ALL 0\n#define HX509_SELECT_DIGEST 1\n#define HX509_SELECT_PUBLIC_SIG 2\n#define HX509_SELECT_PUBLIC_ENC 3\n#define HX509_SELECT_SECRET_ENC 4\n\n/* flags to hx509_ca_tbs_set_template */\n#define HX509_CA_TEMPLATE_SUBJECT 1\n#define HX509_CA_TEMPLATE_SERIAL 2\n#define HX509_CA_TEMPLATE_NOTBEFORE 4\n#define HX509_CA_TEMPLATE_NOTAFTER 8\n#define HX509_CA_TEMPLATE_SPKI 16\n#define HX509_CA_TEMPLATE_KU 32\n#define HX509_CA_TEMPLATE_EKU 64\n\n/* flags hx509_cms_create_signed* */\n#define HX509_CMS_SIGATURE_DETACHED 1\n#define HX509_CMS_SIGATURE_ID_NAME 2\n\n/* hx509_verify_hostname nametype */\ntypedef enum  {\n    HX509_HN_HOSTNAME = 0,\n    HX509_HN_DNSSRV\n} hx509_hostname_type;\n\n#include <hx509-protos.h>\n"
  },
  {
    "path": "freebsd-headers/hx509_err.h",
    "content": "/* Generated from /usr/src/kerberos5/lib/libhx509/../../../crypto/heimdal/lib/hx509/hx509_err.et */\n/* $Id: hx509_err.et 22329 2007-12-15 05:13:14Z lha $ */\n\n#ifndef __hx509_err_h__\n#define __hx509_err_h__\n\nstruct et_list;\n\nvoid initialize_hx_error_table_r(struct et_list **);\n\nvoid initialize_hx_error_table(void);\n#define init_hx_err_tbl initialize_hx_error_table\n\ntypedef enum hx_error_number{\n\tHX509_BAD_TIMEFORMAT = 569856,\n\tHX509_EXTENSION_NOT_FOUND = 569857,\n\tHX509_NO_PATH = 569858,\n\tHX509_PARENT_NOT_CA = 569859,\n\tHX509_CA_PATH_TOO_DEEP = 569860,\n\tHX509_SIG_ALG_NO_SUPPORTED = 569861,\n\tHX509_SIG_ALG_DONT_MATCH_KEY_ALG = 569862,\n\tHX509_CERT_USED_BEFORE_TIME = 569863,\n\tHX509_CERT_USED_AFTER_TIME = 569864,\n\tHX509_PRIVATE_KEY_MISSING = 569865,\n\tHX509_ALG_NOT_SUPP = 569866,\n\tHX509_ISSUER_NOT_FOUND = 569867,\n\tHX509_VERIFY_CONSTRAINTS = 569868,\n\tHX509_RANGE = 569869,\n\tHX509_NAME_CONSTRAINT_ERROR = 569870,\n\tHX509_PATH_TOO_LONG = 569871,\n\tHX509_KU_CERT_MISSING = 569872,\n\tHX509_CERT_NOT_FOUND = 569873,\n\tHX509_UNKNOWN_LOCK_COMMAND = 569874,\n\tHX509_PARENT_IS_CA = 569875,\n\tHX509_EXTRA_DATA_AFTER_STRUCTURE = 569876,\n\tHX509_PROXY_CERT_INVALID = 569877,\n\tHX509_PROXY_CERT_NAME_WRONG = 569878,\n\tHX509_NAME_MALFORMED = 569879,\n\tHX509_CERTIFICATE_MALFORMED = 569880,\n\tHX509_CERTIFICATE_MISSING_EKU = 569881,\n\tHX509_PROXY_CERTIFICATE_NOT_CANONICALIZED = 569882,\n\tHX509_CMS_FAILED_CREATE_SIGATURE = 569888,\n\tHX509_CMS_MISSING_SIGNER_DATA = 569889,\n\tHX509_CMS_SIGNER_NOT_FOUND = 569890,\n\tHX509_CMS_NO_DATA_AVAILABLE = 569891,\n\tHX509_CMS_INVALID_DATA = 569892,\n\tHX509_CMS_PADDING_ERROR = 569893,\n\tHX509_CMS_NO_RECIPIENT_CERTIFICATE = 569894,\n\tHX509_CMS_DATA_OID_MISMATCH = 569895,\n\tHX509_CRYPTO_INTERNAL_ERROR = 569920,\n\tHX509_CRYPTO_EXTERNAL_ERROR = 569921,\n\tHX509_CRYPTO_SIGNATURE_MISSING = 569922,\n\tHX509_CRYPTO_BAD_SIGNATURE = 569923,\n\tHX509_CRYPTO_SIG_NO_CONF = 569924,\n\tHX509_CRYPTO_SIG_INVALID_FORMAT = 569925,\n\tHX509_CRYPTO_OID_MISMATCH = 569926,\n\tHX509_CRYPTO_NO_PROMPTER = 569927,\n\tHX509_CRYPTO_SIGNATURE_WITHOUT_SIGNER = 569928,\n\tHX509_CRYPTO_RSA_PUBLIC_ENCRYPT = 569929,\n\tHX509_CRYPTO_RSA_PRIVATE_ENCRYPT = 569930,\n\tHX509_CRYPTO_RSA_PUBLIC_DECRYPT = 569931,\n\tHX509_CRYPTO_RSA_PRIVATE_DECRYPT = 569932,\n\tHX509_CRL_USED_BEFORE_TIME = 569952,\n\tHX509_CRL_USED_AFTER_TIME = 569953,\n\tHX509_CRL_INVALID_FORMAT = 569954,\n\tHX509_CERT_REVOKED = 569955,\n\tHX509_REVOKE_STATUS_MISSING = 569956,\n\tHX509_CRL_UNKNOWN_EXTENSION = 569957,\n\tHX509_REVOKE_WRONG_DATA = 569958,\n\tHX509_REVOKE_NOT_SAME_PARENT = 569959,\n\tHX509_CERT_NOT_IN_OCSP = 569960,\n\tHX509_LOCAL_ATTRIBUTE_MISSING = 569964,\n\tHX509_PARSING_KEY_FAILED = 569965,\n\tHX509_UNSUPPORTED_OPERATION = 569966,\n\tHX509_UNIMPLEMENTED_OPERATION = 569967,\n\tHX509_PARSING_NAME_FAILED = 569968,\n\tHX509_PKCS11_NO_SLOT = 569984,\n\tHX509_PKCS11_NO_TOKEN = 569985,\n\tHX509_PKCS11_NO_MECH = 569986,\n\tHX509_PKCS11_TOKEN_CONFUSED = 569987,\n\tHX509_PKCS11_OPEN_SESSION = 569988,\n\tHX509_PKCS11_LOGIN = 569989,\n\tHX509_PKCS11_LOAD = 569990\n} hx_error_number;\n\n#define ERROR_TABLE_BASE_hx 569856\n\n#endif /* __hx509_err_h__ */\n"
  },
  {
    "path": "freebsd-headers/ieeefp.h",
    "content": "/*\t$NetBSD: ieeefp.h,v 1.4 1998/01/09 08:03:43 perry Exp $\t*/\n/* $FreeBSD: release/9.0.0/include/ieeefp.h 109520 2003-01-19 06:01:33Z marcel $ */\n\n/* \n * Written by J.T. Conklin, Apr 6, 1995\n * Public domain.\n */\n\n#ifndef _IEEEFP_H_\n#define _IEEEFP_H_\n\n#include <sys/cdefs.h>\n#include <machine/ieeefp.h>\n\n#if !defined(_IEEEFP_INLINED_)\n__BEGIN_DECLS\nextern fp_rnd_t    fpgetround(void);\nextern fp_rnd_t    fpsetround(fp_rnd_t);\nextern fp_except_t fpgetmask(void);\nextern fp_except_t fpsetmask(fp_except_t);\nextern fp_except_t fpgetsticky(void);\nextern fp_except_t fpsetsticky(fp_except_t);\n__END_DECLS\n#endif /* !_IEEEFP_INLINED_ */\n\n#endif /* _IEEEFP_H_ */\n"
  },
  {
    "path": "freebsd-headers/ifaddrs.h",
    "content": "/*\t$FreeBSD: release/9.0.0/include/ifaddrs.h 122687 2003-11-14 18:53:22Z bms $\t*/\n\n/*\n * Copyright (c) 1995, 1999\n *\tBerkeley Software Design, Inc.  All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n *\n * THIS SOFTWARE IS PROVIDED BY Berkeley Software Design, Inc. ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL Berkeley Software Design, Inc. BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\tBSDI ifaddrs.h,v 2.5 2000/02/23 14:51:59 dab Exp\n */\n\n#ifndef\t_IFADDRS_H_\n#define\t_IFADDRS_H_\n\nstruct ifaddrs {\n\tstruct ifaddrs  *ifa_next;\n\tchar\t\t*ifa_name;\n\tu_int\t\t ifa_flags;\n\tstruct sockaddr\t*ifa_addr;\n\tstruct sockaddr\t*ifa_netmask;\n\tstruct sockaddr\t*ifa_dstaddr;\n\tvoid\t\t*ifa_data;\n};\n\n/*\n * This may have been defined in <net/if.h>.  Note that if <net/if.h> is\n * to be included it must be included before this header file.\n */\n#ifndef\tifa_broadaddr\n#define\tifa_broadaddr\tifa_dstaddr\t/* broadcast address interface */\n#endif\n\nstruct ifmaddrs {\n\tstruct ifmaddrs\t*ifma_next;\n\tstruct sockaddr\t*ifma_name;\n\tstruct sockaddr\t*ifma_addr;\n\tstruct sockaddr\t*ifma_lladdr;\n};\n\n#include <sys/cdefs.h>\n\n__BEGIN_DECLS\nextern int getifaddrs(struct ifaddrs **);\nextern void freeifaddrs(struct ifaddrs *);\nextern int getifmaddrs(struct ifmaddrs **);\nextern void freeifmaddrs(struct ifmaddrs *);\n__END_DECLS\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/inttypes.h",
    "content": "/*-\n * Copyright (c) 2001 Mike Barcroft <mike@FreeBSD.org>\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/include/inttypes.h 205954 2010-03-31 02:12:24Z jmallett $\n */\n\n#ifndef _INTTYPES_H_\n#define\t_INTTYPES_H_\n\n#include <machine/_inttypes.h>\n#include <sys/stdint.h>\n\n#ifndef\t__cplusplus\n#ifndef _WCHAR_T_DECLARED\ntypedef\t__wchar_t\twchar_t;\n#define\t_WCHAR_T_DECLARED\n#endif\n#endif\n\ntypedef struct {\n\tintmax_t\tquot;\t\t/* Quotient. */\n\tintmax_t\trem;\t\t/* Remainder. */\n} imaxdiv_t;\n\n__BEGIN_DECLS\nintmax_t\timaxabs(intmax_t) __pure2;\nimaxdiv_t\timaxdiv(intmax_t, intmax_t) __pure2;\n\nintmax_t\tstrtoimax(const char * __restrict, char ** __restrict, int);\nuintmax_t\tstrtoumax(const char * __restrict, char ** __restrict, int);\nintmax_t\twcstoimax(const wchar_t * __restrict,\n\t\t    wchar_t ** __restrict, int);\nuintmax_t\twcstoumax(const wchar_t * __restrict,\n\t\t    wchar_t ** __restrict, int);\n__END_DECLS\n\n#endif /* !_INTTYPES_H_ */\n"
  },
  {
    "path": "freebsd-headers/iso646.h",
    "content": "/*-\n * Copyright (c) 1998 Alex Nash\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/include/iso646.h 226036 2011-10-05 15:50:05Z jkim $\n */\n\n#ifndef _ISO646_H_\n#define\t_ISO646_H_\n\n#ifndef __cplusplus\n\n#define\tand\t&&\n#define\tand_eq\t&=\n#define\tbitand\t&\n#define\tbitor\t|\n#define\tcompl\t~\n#define\tnot\t!\n#define\tnot_eq\t!=\n#define\tor\t||\n#define\tor_eq\t|=\n#define\txor\t^\n#define\txor_eq\t^=\n\n#endif /* !__cplusplus */\n\n#endif /* !_ISO646_H_ */\n"
  },
  {
    "path": "freebsd-headers/isofs/cd9660/cd9660_mount.h",
    "content": "/*-\n * Copyright (c) 1995\n *\tThe Regents of the University of California.  All rights reserved.\n *\n * This code is derived from software contributed to Berkeley\n * by Pace Willisson (pace@blitz.com).  The Rock Ridge Extension\n * Support code is derived from software contributed to Berkeley\n * by Atsushi Murai (amurai@spec.co.jp).\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 4. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t@(#)cd9660_mount.h\t8.1 (Berkeley) 5/24/95\n * $FreeBSD: release/9.0.0/sys/fs/cd9660/cd9660_mount.h 213664 2010-10-10 07:05:47Z kib $\n */\n\n/*\n * Arguments to mount ISO 9660 filesystems.\n */\nstruct iso_args {\n\tchar\t*fspec;\t\t\t/* block special device to mount */\n\tstruct\toexport_args export;\t/* network export info */\n\tint\tflags;\t\t\t/* mounting flags, see below */\n\tint\tssector;\t\t/* starting sector, 0 for 1st session */\n\tchar\t*cs_disk;\t\t/* disk charset for Joliet cs conversion */\n\tchar\t*cs_local;\t\t/* local charset for Joliet cs conversion */\n};\n#define\tISOFSMNT_NORRIP\t0x00000001\t/* disable Rock Ridge Ext.*/\n#define\tISOFSMNT_GENS\t0x00000002\t/* enable generation numbers */\n#define\tISOFSMNT_EXTATT\t0x00000004\t/* enable extended attributes */\n#define ISOFSMNT_NOJOLIET 0x00000008\t/* disable Joliet Ext.*/\n#define ISOFSMNT_BROKENJOLIET 0x00000010/* allow broken Joliet disks */\n#define\tISOFSMNT_KICONV 0x00000020\t/* Use libiconv to convert chars */\n"
  },
  {
    "path": "freebsd-headers/isofs/cd9660/cd9660_node.h",
    "content": "/*-\n * Copyright (c) 1994\n *\tThe Regents of the University of California.  All rights reserved.\n *\n * This code is derived from software contributed to Berkeley\n * by Pace Willisson (pace@blitz.com).  The Rock Ridge Extension\n * Support code is derived from software contributed to Berkeley\n * by Atsushi Murai (amurai@spec.co.jp).\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 4. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t@(#)cd9660_node.h\t8.6 (Berkeley) 5/14/95\n * $FreeBSD: release/9.0.0/sys/fs/cd9660/cd9660_node.h 187838 2009-01-28 18:54:56Z jhb $\n */\n\n/*\n * Theoretically, directories can be more than 2Gb in length,\n * however, in practice this seems unlikely. So, we define\n * the type doff_t as a long to keep down the cost of doing\n * lookup on a 32-bit machine. If you are porting to a 64-bit\n * architecture, you should make doff_t the same as off_t.\n */\n#define doff_t\tlong\n\ntypedef\tstruct\t{\n\tstruct timespec\tiso_atime;\t/* time of last access */\n\tstruct timespec\tiso_mtime;\t/* time of last modification */\n\tstruct timespec\tiso_ctime;\t/* time file changed */\n\tu_short\t\tiso_mode;\t/* files access mode and type */\n\tuid_t\t\tiso_uid;\t/* owner user id */\n\tgid_t\t\tiso_gid;\t/* owner group id */\n\tshort\t\tiso_links;\t/* links of file */\n\tdev_t\t\tiso_rdev;\t/* Major/Minor number for special */\n} ISO_RRIP_INODE;\n\n\nstruct iso_node {\n\tstruct\tvnode *i_vnode;\t/* vnode associated with this inode */\n\tino_t\ti_number;\t/* the identity of the inode */\n\t\t\t\t/* we use the actual starting block of the file */\n\tstruct\tiso_mnt *i_mnt;\t/* filesystem associated with this inode */\n\tstruct\tlockf *i_lockf;\t/* head of byte-level lock list */\n\tdoff_t\ti_endoff;\t/* end of useful stuff in directory */\n\tdoff_t\ti_diroff;\t/* offset in dir, where we found last entry */\n\n\tlong iso_extent;\t/* extent of file */\n\tunsigned long i_size;\n\tlong iso_start;\t\t/* actual start of data of file (may be different */\n\t\t\t\t/* from iso_extent, if file has extended attributes) */\n\tISO_RRIP_INODE\tinode;\n};\n\n#define\ti_forw\t\ti_chain[0]\n#define\ti_back\t\ti_chain[1]\n\n#define VTOI(vp) ((struct iso_node *)(vp)->v_data)\n#define ITOV(ip) ((ip)->i_vnode)\n\n#ifdef _KERNEL\n\n#ifdef MALLOC_DECLARE\nMALLOC_DECLARE(M_ISOFSMNT);\nMALLOC_DECLARE(M_ISOFSNODE);\n#endif\n\nstruct buf;\nstruct vop_bmap_args;\nstruct vop_cachedlookup_args;\nstruct vop_inactive_args;\nstruct vop_reclaim_args;\n\n/*\n * Prototypes for ISOFS vnode operations\n */\nint cd9660_lookup(struct vop_cachedlookup_args *);\nint cd9660_inactive(struct vop_inactive_args *);\nint cd9660_reclaim(struct vop_reclaim_args *);\nint cd9660_bmap(struct vop_bmap_args *);\nint cd9660_blkatoff(struct vnode *vp, off_t offset, char **res, struct buf **bpp);\n\nvoid cd9660_defattr(struct iso_directory_record *,\n\t\t\tstruct iso_node *, struct buf *, enum ISO_FTYPE);\nvoid cd9660_deftstamp(struct iso_directory_record *,\n\t\t\tstruct iso_node *, struct buf *, enum ISO_FTYPE);\nint cd9660_tstamp_conv7(u_char *, struct timespec *, enum ISO_FTYPE);\nint cd9660_tstamp_conv17(u_char *, struct timespec *);\n\n#endif /* _KERNEL */\n"
  },
  {
    "path": "freebsd-headers/isofs/cd9660/cd9660_rrip.h",
    "content": "/*-\n * Copyright (c) 1993, 1994\n *\tThe Regents of the University of California.  All rights reserved.\n *\n * This code is derived from software contributed to Berkeley\n * by Pace Willisson (pace@blitz.com).  The Rock Ridge Extension\n * Support code is derived from software contributed to Berkeley\n * by Atsushi Murai (amurai@spec.co.jp).\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 4. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t@(#)cd9660_rrip.h\t8.2 (Berkeley) 12/5/94\n * $FreeBSD: release/9.0.0/sys/fs/cd9660/cd9660_rrip.h 166639 2007-02-11 13:54:25Z rodrigc $\n */\n\ntypedef struct {\n\tchar   type\t\t\t[ISODCL (  0,    1)];\n\tu_char length\t\t\t[ISODCL (  2,    2)]; /* 711 */\n\tu_char version\t\t\t[ISODCL (  3,    3)];\n} ISO_SUSP_HEADER;\n\ntypedef struct {\n\tISO_SUSP_HEADER\t\t\th;\n\tchar mode\t\t\t[ISODCL (  4,   11)]; /* 733 */\n\tchar links\t\t\t[ISODCL ( 12,   19)]; /* 733 */\n\tchar uid\t\t\t[ISODCL ( 20,   27)]; /* 733 */\n\tchar gid\t\t\t[ISODCL ( 28,   35)]; /* 733 */\n} ISO_RRIP_ATTR;\n\ntypedef struct {\n\tISO_SUSP_HEADER\t\t\th;\n\tchar dev_t_high\t\t\t[ISODCL (  4,   11)]; /* 733 */\n\tchar dev_t_low\t\t\t[ISODCL ( 12,   19)]; /* 733 */\n} ISO_RRIP_DEVICE;\n\n#define\tISO_SUSP_CFLAG_CONTINUE\t0x01\n#define\tISO_SUSP_CFLAG_CURRENT\t0x02\n#define\tISO_SUSP_CFLAG_PARENT\t0x04\n#define\tISO_SUSP_CFLAG_ROOT\t0x08\n#define\tISO_SUSP_CFLAG_VOLROOT\t0x10\n#define\tISO_SUSP_CFLAG_HOST\t0x20\n\ntypedef struct {\n\tu_char cflag\t\t\t[ISODCL (  1,    1)];\n\tu_char clen\t\t\t[ISODCL (  2,    2)];\n\tu_char name\t\t\t[1];\t\t\t/* XXX */\n} ISO_RRIP_SLINK_COMPONENT;\n#define\tISO_RRIP_SLSIZ\t2\n\ntypedef struct {\n\tISO_SUSP_HEADER\t\t\th;\n\tu_char flags\t\t\t[ISODCL (  4,\t 4)];\n\tu_char component\t\t[ISODCL (  5,\t 5)];\n} ISO_RRIP_SLINK;\n\ntypedef struct {\n\tISO_SUSP_HEADER\t\t\th;\n\tchar flags\t\t\t[ISODCL (  4,\t 4)];\n} ISO_RRIP_ALTNAME;\n\ntypedef struct {\n\tISO_SUSP_HEADER\t\t\th;\n\tchar dir_loc\t\t\t[ISODCL (  4,\t 11)]; /* 733 */\n} ISO_RRIP_CLINK;\n\ntypedef struct {\n\tISO_SUSP_HEADER\t\t\th;\n\tchar dir_loc\t\t\t[ISODCL (  4,\t 11)]; /* 733 */\n} ISO_RRIP_PLINK;\n\ntypedef struct {\n\tISO_SUSP_HEADER\t\t\th;\n} ISO_RRIP_RELDIR;\n\n#define\tISO_SUSP_TSTAMP_FORM17\t0x80\n#define\tISO_SUSP_TSTAMP_FORM7\t0x00\n#define\tISO_SUSP_TSTAMP_CREAT\t0x01\n#define\tISO_SUSP_TSTAMP_MODIFY\t0x02\n#define\tISO_SUSP_TSTAMP_ACCESS\t0x04\n#define\tISO_SUSP_TSTAMP_ATTR\t0x08\n#define\tISO_SUSP_TSTAMP_BACKUP\t0x10\n#define\tISO_SUSP_TSTAMP_EXPIRE\t0x20\n#define\tISO_SUSP_TSTAMP_EFFECT\t0x40\n\ntypedef struct {\n\tISO_SUSP_HEADER\t\t\th;\n\tu_char flags\t\t\t[ISODCL (  4,    4)];\n\tu_char time\t\t\t[ISODCL (  5,    5)];\n} ISO_RRIP_TSTAMP;\n\ntypedef struct {\n\tISO_SUSP_HEADER\t\t\th;\n\tu_char flags\t\t\t[ISODCL (  4,    4)];\n} ISO_RRIP_IDFLAG;\n\ntypedef struct {\n\tISO_SUSP_HEADER\t\t\th;\n\tchar len_id\t\t\t[ISODCL (  4,\t 4)];\n\tchar len_des\t\t\t[ISODCL (  5,\t 5)];\n\tchar len_src\t\t\t[ISODCL (  6,\t 6)];\n\tchar version\t\t\t[ISODCL (  7,\t 7)];\n} ISO_RRIP_EXTREF;\n\ntypedef struct {\n\tISO_SUSP_HEADER\t\t\th;\n\tchar check\t\t\t[ISODCL (  4,\t 5)];\n\tchar skip\t\t\t[ISODCL (  6,\t 6)];\n} ISO_RRIP_OFFSET;\n\ntypedef struct {\n\tISO_SUSP_HEADER\t\t\th;\n\tchar location\t\t\t[ISODCL (  4,\t11)];\n\tchar offset\t\t\t[ISODCL ( 12,\t19)];\n\tchar length\t\t\t[ISODCL ( 20,\t27)];\n} ISO_RRIP_CONT;\n"
  },
  {
    "path": "freebsd-headers/isofs/cd9660/iso.h",
    "content": "/*-\n * Copyright (c) 1994\n *\tThe Regents of the University of California.  All rights reserved.\n *\n * This code is derived from software contributed to Berkeley\n * by Pace Willisson (pace@blitz.com).  The Rock Ridge Extension\n * Support code is derived from software contributed to Berkeley\n * by Atsushi Murai (amurai@spec.co.jp).\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 4. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t@(#)iso.h\t8.6 (Berkeley) 5/10/95\n * $FreeBSD: release/9.0.0/sys/fs/cd9660/iso.h 224290 2011-07-24 17:43:09Z mckusick $\n */\n\n#define ISODCL(from, to) (to - from + 1)\n\nstruct iso_volume_descriptor {\n\tchar type[ISODCL(1,1)]; /* 711 */\n\tchar id[ISODCL(2,6)];\n\tchar version[ISODCL(7,7)];\n\tchar unused[ISODCL(8,8)];\n\tchar type_sierra[ISODCL(9,9)]; /* 711 */\n\tchar id_sierra[ISODCL(10,14)];\n\tchar version_sierra[ISODCL(15,15)];\n\tchar data[ISODCL(16,2048)];\n};\n\n/* volume descriptor types */\n#define ISO_VD_PRIMARY 1\n#define ISO_VD_SUPPLEMENTARY 2\n#define ISO_VD_END 255\n\n#define ISO_STANDARD_ID \"CD001\"\n#define ISO_ECMA_ID\t\"CDW01\"\n\n#define ISO_SIERRA_ID\t\"CDROM\"\n\nstruct iso_primary_descriptor {\n\tchar type\t\t\t[ISODCL (  1,\t1)]; /* 711 */\n\tchar id\t\t\t\t[ISODCL (  2,\t6)];\n\tchar version\t\t\t[ISODCL (  7,\t7)]; /* 711 */\n\tchar unused1\t\t\t[ISODCL (  8,\t8)];\n\tchar system_id\t\t\t[ISODCL (  9,  40)]; /* achars */\n\tchar volume_id\t\t\t[ISODCL ( 41,  72)]; /* dchars */\n\tchar unused2\t\t\t[ISODCL ( 73,  80)];\n\tchar volume_space_size\t\t[ISODCL ( 81,  88)]; /* 733 */\n\tchar unused3\t\t\t[ISODCL ( 89, 120)];\n\tchar volume_set_size\t\t[ISODCL (121, 124)]; /* 723 */\n\tchar volume_sequence_number\t[ISODCL (125, 128)]; /* 723 */\n\tchar logical_block_size\t\t[ISODCL (129, 132)]; /* 723 */\n\tchar path_table_size\t\t[ISODCL (133, 140)]; /* 733 */\n\tchar type_l_path_table\t\t[ISODCL (141, 144)]; /* 731 */\n\tchar opt_type_l_path_table\t[ISODCL (145, 148)]; /* 731 */\n\tchar type_m_path_table\t\t[ISODCL (149, 152)]; /* 732 */\n\tchar opt_type_m_path_table\t[ISODCL (153, 156)]; /* 732 */\n\tchar root_directory_record\t[ISODCL (157, 190)]; /* 9.1 */\n\tchar volume_set_id\t\t[ISODCL (191, 318)]; /* dchars */\n\tchar publisher_id\t\t[ISODCL (319, 446)]; /* achars */\n\tchar preparer_id\t\t[ISODCL (447, 574)]; /* achars */\n\tchar application_id\t\t[ISODCL (575, 702)]; /* achars */\n\tchar copyright_file_id\t\t[ISODCL (703, 739)]; /* 7.5 dchars */\n\tchar abstract_file_id\t\t[ISODCL (740, 776)]; /* 7.5 dchars */\n\tchar bibliographic_file_id\t[ISODCL (777, 813)]; /* 7.5 dchars */\n\tchar creation_date\t\t[ISODCL (814, 830)]; /* 8.4.26.1 */\n\tchar modification_date\t\t[ISODCL (831, 847)]; /* 8.4.26.1 */\n\tchar expiration_date\t\t[ISODCL (848, 864)]; /* 8.4.26.1 */\n\tchar effective_date\t\t[ISODCL (865, 881)]; /* 8.4.26.1 */\n\tchar file_structure_version\t[ISODCL (882, 882)]; /* 711 */\n\tchar unused4\t\t\t[ISODCL (883, 883)];\n\tchar application_data\t\t[ISODCL (884, 1395)];\n\tchar unused5\t\t\t[ISODCL (1396, 2048)];\n};\n#define ISO_DEFAULT_BLOCK_SIZE\t\t2048\n\n/*\n * Used by Microsoft Joliet extension to ISO9660. Almost the same\n * as PVD, but byte position 8 is a flag, and 89-120 is for escape.\n */\n\nstruct iso_supplementary_descriptor {\n      char type                       [ISODCL (  1,   1)]; /* 711 */\n      char id                         [ISODCL (  2,   6)];\n      char version                    [ISODCL (  7,   7)]; /* 711 */\n      char flags                      [ISODCL (  8,   8)]; /* 711? */\n      char system_id                  [ISODCL (  9,  40)]; /* achars */\n      char volume_id                  [ISODCL ( 41,  72)]; /* dchars */\n      char unused2                    [ISODCL ( 73,  80)];\n      char volume_space_size          [ISODCL ( 81,  88)]; /* 733 */\n      char escape                     [ISODCL ( 89, 120)];\n      char volume_set_size            [ISODCL (121, 124)]; /* 723 */\n      char volume_sequence_number     [ISODCL (125, 128)]; /* 723 */\n      char logical_block_size         [ISODCL (129, 132)]; /* 723 */\n      char path_table_size            [ISODCL (133, 140)]; /* 733 */\n      char type_l_path_table          [ISODCL (141, 144)]; /* 731 */\n      char opt_type_l_path_table      [ISODCL (145, 148)]; /* 731 */\n      char type_m_path_table          [ISODCL (149, 152)]; /* 732 */\n      char opt_type_m_path_table      [ISODCL (153, 156)]; /* 732 */\n      char root_directory_record      [ISODCL (157, 190)]; /* 9.1 */\n      char volume_set_id              [ISODCL (191, 318)]; /* dchars */\n      char publisher_id               [ISODCL (319, 446)]; /* achars */\n      char preparer_id                [ISODCL (447, 574)]; /* achars */\n      char application_id             [ISODCL (575, 702)]; /* achars */\n      char copyright_file_id          [ISODCL (703, 739)]; /* 7.5 dchars */\n      char abstract_file_id           [ISODCL (740, 776)]; /* 7.5 dchars */\n      char bibliographic_file_id      [ISODCL (777, 813)]; /* 7.5 dchars */\n      char creation_date              [ISODCL (814, 830)]; /* 8.4.26.1 */\n      char modification_date          [ISODCL (831, 847)]; /* 8.4.26.1 */\n      char expiration_date            [ISODCL (848, 864)]; /* 8.4.26.1 */\n      char effective_date             [ISODCL (865, 881)]; /* 8.4.26.1 */\n      char file_structure_version     [ISODCL (882, 882)]; /* 711 */\n      char unused4                    [ISODCL (883, 883)];\n      char application_data           [ISODCL (884, 1395)];\n      char unused5                    [ISODCL (1396, 2048)];\n};\n\nstruct iso_sierra_primary_descriptor {\n\tchar unknown1\t\t\t[ISODCL (  1,\t8)]; /* 733 */\n\tchar type\t\t\t[ISODCL (  9,\t9)]; /* 711 */\n\tchar id\t\t\t\t[ISODCL ( 10,  14)];\n\tchar version\t\t\t[ISODCL ( 15,  15)]; /* 711 */\n\tchar unused1\t\t\t[ISODCL ( 16,  16)];\n\tchar system_id\t\t\t[ISODCL ( 17,  48)]; /* achars */\n\tchar volume_id\t\t\t[ISODCL ( 49,  80)]; /* dchars */\n\tchar unused2\t\t\t[ISODCL ( 81,  88)];\n\tchar volume_space_size\t\t[ISODCL ( 89,  96)]; /* 733 */\n\tchar unused3\t\t\t[ISODCL ( 97, 128)];\n\tchar volume_set_size\t\t[ISODCL (129, 132)]; /* 723 */\n\tchar volume_sequence_number\t[ISODCL (133, 136)]; /* 723 */\n\tchar logical_block_size\t\t[ISODCL (137, 140)]; /* 723 */\n\tchar path_table_size\t\t[ISODCL (141, 148)]; /* 733 */\n\tchar type_l_path_table\t\t[ISODCL (149, 152)]; /* 731 */\n\tchar opt_type_l_path_table\t[ISODCL (153, 156)]; /* 731 */\n\tchar unknown2\t\t\t[ISODCL (157, 160)]; /* 731 */\n\tchar unknown3\t\t\t[ISODCL (161, 164)]; /* 731 */\n\tchar type_m_path_table\t\t[ISODCL (165, 168)]; /* 732 */\n\tchar opt_type_m_path_table\t[ISODCL (169, 172)]; /* 732 */\n\tchar unknown4\t\t\t[ISODCL (173, 176)]; /* 732 */\n\tchar unknown5\t\t\t[ISODCL (177, 180)]; /* 732 */\n\tchar root_directory_record\t[ISODCL (181, 214)]; /* 9.1 */\n\tchar volume_set_id\t\t[ISODCL (215, 342)]; /* dchars */\n\tchar publisher_id\t\t[ISODCL (343, 470)]; /* achars */\n\tchar preparer_id\t\t[ISODCL (471, 598)]; /* achars */\n\tchar application_id\t\t[ISODCL (599, 726)]; /* achars */\n\tchar copyright_id\t\t[ISODCL (727, 790)]; /* achars */\n\tchar creation_date\t\t[ISODCL (791, 806)]; /* ? */\n\tchar modification_date\t\t[ISODCL (807, 822)]; /* ? */\n\tchar expiration_date\t\t[ISODCL (823, 838)]; /* ? */\n\tchar effective_date\t\t[ISODCL (839, 854)]; /* ? */\n\tchar file_structure_version\t[ISODCL (855, 855)]; /* 711 */\n\tchar unused4\t\t\t[ISODCL (856, 2048)];\n};\n\nstruct iso_directory_record {\n\tchar length\t\t\t[ISODCL (1, 1)]; /* 711 */\n\tchar ext_attr_length\t\t[ISODCL (2, 2)]; /* 711 */\n\tu_char extent\t\t\t[ISODCL (3, 10)]; /* 733 */\n\tu_char size\t\t\t[ISODCL (11, 18)]; /* 733 */\n\tchar date\t\t\t[ISODCL (19, 25)]; /* 7 by 711 */\n\tchar flags\t\t\t[ISODCL (26, 26)];\n\tchar file_unit_size\t\t[ISODCL (27, 27)]; /* 711 */\n\tchar interleave\t\t\t[ISODCL (28, 28)]; /* 711 */\n\tchar volume_sequence_number\t[ISODCL (29, 32)]; /* 723 */\n\tchar name_len\t\t\t[ISODCL (33, 33)]; /* 711 */\n\tchar name\t\t\t[1];\t\t\t/* XXX */\n};\n/* can't take sizeof(iso_directory_record), because of possible alignment\n   of the last entry (34 instead of 33) */\n#define ISO_DIRECTORY_RECORD_SIZE\t33\n\nstruct iso_extended_attributes {\n\tu_char owner\t\t\t[ISODCL (1, 4)]; /* 723 */\n\tu_char group\t\t\t[ISODCL (5, 8)]; /* 723 */\n\tu_char perm\t\t\t[ISODCL (9, 10)]; /* 9.5.3 */\n\tchar ctime\t\t\t[ISODCL (11, 27)]; /* 8.4.26.1 */\n\tchar mtime\t\t\t[ISODCL (28, 44)]; /* 8.4.26.1 */\n\tchar xtime\t\t\t[ISODCL (45, 61)]; /* 8.4.26.1 */\n\tchar ftime\t\t\t[ISODCL (62, 78)]; /* 8.4.26.1 */\n\tchar recfmt\t\t\t[ISODCL (79, 79)]; /* 711 */\n\tchar recattr\t\t\t[ISODCL (80, 80)]; /* 711 */\n\tu_char reclen\t\t\t[ISODCL (81, 84)]; /* 723 */\n\tchar system_id\t\t\t[ISODCL (85, 116)]; /* achars */\n\tchar system_use\t\t\t[ISODCL (117, 180)];\n\tchar version\t\t\t[ISODCL (181, 181)]; /* 711 */\n\tchar len_esc\t\t\t[ISODCL (182, 182)]; /* 711 */\n\tchar reserved\t\t\t[ISODCL (183, 246)];\n\tu_char len_au\t\t\t[ISODCL (247, 250)]; /* 723 */\n};\n\n#ifdef _KERNEL\n\n/* CD-ROM Format type */\nenum ISO_FTYPE\t{ ISO_FTYPE_DEFAULT, ISO_FTYPE_9660, ISO_FTYPE_RRIP,\n\t\t  ISO_FTYPE_JOLIET, ISO_FTYPE_ECMA, ISO_FTYPE_HIGH_SIERRA };\n\n#ifndef\tISOFSMNT_ROOT\n#define\tISOFSMNT_ROOT\t0\n#endif\n\nstruct iso_mnt {\n\tuint64_t im_flags;\n\n\tstruct mount *im_mountp;\n\tstruct cdev *im_dev;\n\tstruct vnode *im_devvp;\n\n\tstruct g_consumer *im_cp;\n\tstruct bufobj *im_bo;\n\n\tint logical_block_size;\n\tint im_bshift;\n\tint im_bmask;\n\n\tint volume_space_size;\n\n\tchar root[ISODCL (157, 190)];\n\tint root_extent;\n\tint root_size;\n\tenum ISO_FTYPE\tiso_ftype;\n\n\tint rr_skip;\n\tint rr_skip0;\n\n\tint joliet_level;\n\n\tvoid *im_d2l;\n\tvoid *im_l2d;\n};\n\nstruct ifid {\n\tu_short\tifid_len;\n\tu_short\tifid_pad;\n\tint\tifid_ino;\n\tlong\tifid_start;\n};\n\n#define VFSTOISOFS(mp)\t((struct iso_mnt *)((mp)->mnt_data))\n\n#define blkoff(imp, loc)\t((loc) & (imp)->im_bmask)\n#define lblktosize(imp, blk)\t((blk) << (imp)->im_bshift)\n#define lblkno(imp, loc)\t((loc) >> (imp)->im_bshift)\n#define blksize(imp, ip, lbn)\t((imp)->logical_block_size)\n\nint cd9660_vget_internal(struct mount *, ino_t, int, struct vnode **, int,\n\t\t\t struct iso_directory_record *);\n#define cd9660_sysctl ((int (*)(int *, u_int, void *, size_t *, void *, \\\n\t\t\t\tsize_t, struct proc *))eopnotsupp)\n\nextern struct vop_vector cd9660_vnodeops;\nextern struct vop_vector cd9660_fifoops;\n\nint isochar(u_char *, u_char *, int, u_short *, int *, int, void *);\nint isofncmp(u_char *, int, u_char *, int, int, int, void *, void *);\nvoid isofntrans(u_char *, int, u_char *, u_short *, int, int, int, int, void *);\nino_t isodirino(struct iso_directory_record *, struct iso_mnt *);\nu_short sgetrune(const char *, size_t, char const **, int, void *);\n\n#endif /* _KERNEL */\n\n/*\n * The isonum_xxx functions are inlined anyway, and could come handy even\n * outside the kernel.  Thus we don't hide them here.\n */\n\n/*\n * 7xy\n *  x -> 1 = 8 bits, 2 = 16 bits, 3 = 32 bits\n *   y -> 1 = little-endian, 2 = big-endian, 3 = both (le then be)\n */\n\nstatic __inline uint8_t\nisonum_711(unsigned char *p)\n{\n\treturn p[0];\n}\n\nstatic __inline uint8_t\nisonum_712(unsigned char *p)\n{\n\treturn p[0];\n}\n\nstatic __inline uint8_t\nisonum_713(unsigned char *p)\n{\n\treturn p[0];\n}\n\nstatic __inline uint16_t\nisonum_721(unsigned char *p)\n{\n\treturn (p[0] | p[1] << 8);\n}\n\nstatic __inline uint16_t\nisonum_722(unsigned char *p)\n{\n\treturn (p[1] | p[0] << 8);\n}\n\nstatic __inline uint16_t\nisonum_723(unsigned char *p)\n{\n\treturn (p[0] | p[1] << 8);\n}\n\nstatic __inline uint32_t\nisonum_731(unsigned char *p)\n{\n\treturn (p[0] | p[1] << 8 | p[2] << 16 | p[3] << 24);\n}\n\nstatic __inline uint32_t\nisonum_732(unsigned char *p)\n{\n\treturn (p[3] | p[2] << 8 | p[1] << 16 | p[0] << 24);\n}\n\nstatic __inline uint32_t\nisonum_733(unsigned char *p)\n{\n\treturn (p[0] | p[1] << 8 | p[2] << 16 | p[3] << 24);\n}\n\n/*\n * Associated files have a leading '='.\n */\n#define\tASSOCCHAR\t'='\n"
  },
  {
    "path": "freebsd-headers/isofs/cd9660/iso_rrip.h",
    "content": "/*-\n * Copyright (c) 1993, 1994\n *\tThe Regents of the University of California.  All rights reserved.\n *\n * This code is derived from software contributed to Berkeley\n * by Pace Willisson (pace@blitz.com).  The Rock Ridge Extension\n * Support code is derived from software contributed to Berkeley\n * by Atsushi Murai (amurai@spec.co.jp).\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 4. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t@(#)iso_rrip.h\t8.2 (Berkeley) 1/23/94\n * $FreeBSD: release/9.0.0/sys/fs/cd9660/iso_rrip.h 166639 2007-02-11 13:54:25Z rodrigc $\n */\n\n\n/*\n *\tAnalyze function flag (similar to RR field bits)\n */\n#define\tISO_SUSP_ATTR\t\t0x0001\n#define\tISO_SUSP_DEVICE\t\t0x0002\n#define\tISO_SUSP_SLINK\t\t0x0004\n#define\tISO_SUSP_ALTNAME\t0x0008\n#define\tISO_SUSP_CLINK\t\t0x0010\n#define\tISO_SUSP_PLINK\t\t0x0020\n#define\tISO_SUSP_RELDIR\t\t0x0040\n#define\tISO_SUSP_TSTAMP\t\t0x0080\n#define\tISO_SUSP_IDFLAG\t\t0x0100\n#define\tISO_SUSP_EXTREF\t\t0x0200\n#define\tISO_SUSP_CONT\t\t0x0400\n#define\tISO_SUSP_OFFSET\t\t0x0800\n#define\tISO_SUSP_STOP\t\t0x1000\n#define\tISO_SUSP_UNKNOWN\t0x8000\n\ntypedef struct {\n\tstruct iso_node\t*inop;\n\tint\t\tfields;\t\t/* interesting fields in this analysis */\n\tdaddr_t\t\tiso_ce_blk;\t/* block of continuation area */\n\toff_t\t\tiso_ce_off;\t/* offset of continuation area */\n\tint\t\tiso_ce_len;\t/* length of continuation area */\n\tstruct iso_mnt\t*imp;\t\t/* mount structure */\n\tino_t\t\t*inump;\t\t/* inode number pointer */\n\tchar\t\t*outbuf;\t/* name/symbolic link output area */\n\tu_short\t\t*outlen;\t/* length of above */\n\tu_short\t\tmaxlen;\t\t/* maximum length of above */\n\tint\t\tcont;\t\t/* continuation of above */\n} ISO_RRIP_ANALYZE;\n\nstruct iso_directory_record;\n\nint cd9660_rrip_analyze(struct iso_directory_record *isodir,\n\t\t\t    struct iso_node *inop, struct iso_mnt *imp);\nint cd9660_rrip_getname(struct iso_directory_record *isodir,\n\t\t\t    char *outbuf, u_short *outlen,\n\t\t\t    ino_t *inump, struct iso_mnt *imp);\nint cd9660_rrip_getsymname(struct iso_directory_record *isodir,\n\t\t\t       char *outbuf, u_short *outlen,\n\t\t\t       struct iso_mnt *imp);\nint cd9660_rrip_offset(struct iso_directory_record *isodir,\n\t\t\t   struct iso_mnt *imp);\n"
  },
  {
    "path": "freebsd-headers/jail.h",
    "content": "/*-\n * Copyright (c) 2009 James Gritton.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/lib/libjail/jail.h 195870 2009-07-25 14:48:57Z jamie $\n */\n\n#ifndef _JAIL_H\n#define _JAIL_H\n\n#define\tJP_RAWVALUE\t0x01\n#define\tJP_BOOL\t\t0x02\n#define\tJP_NOBOOL\t0x04\n#define\tJP_JAILSYS\t0x08\n\n#define JAIL_ERRMSGLEN\t1024\n\nextern char jail_errmsg[];\n\nstruct jailparam {\n\tchar\t\t*jp_name;\n\tvoid\t\t*jp_value;\n\tsize_t\t\t jp_valuelen;\n\tsize_t\t\t jp_elemlen;\n\tint\t\t jp_ctltype;\n\tint\t\t jp_structtype;\n\tunsigned\t jp_flags;\n};\n\n__BEGIN_DECLS\nextern int jail_getid(const char *name);\nextern char *jail_getname(int jid);\nextern int jail_setv(int flags, ...);\nextern int jail_getv(int flags, ...);\nextern int jailparam_all(struct jailparam **jpp);\nextern int jailparam_init(struct jailparam *jp, const char *name);\nextern int jailparam_import(struct jailparam *jp, const char *value);\nextern int jailparam_import_raw(struct jailparam *jp, void *value,\n\t       size_t valuelen);\nextern int jailparam_set(struct jailparam *jp, unsigned njp, int flags);\nextern int jailparam_get(struct jailparam *jp, unsigned njp, int flags);\nextern char *jailparam_export(struct jailparam *jp);\nextern void jailparam_free(struct jailparam *jp, unsigned njp);\n__END_DECLS\n\n#endif /* _JAIL_H  */\n\n\n"
  },
  {
    "path": "freebsd-headers/k524_err.h",
    "content": "/* Generated from /usr/src/kerberos5/lib/libkrb5/../../../crypto/heimdal/lib/krb5/k524_err.et */\n/* $Id: k524_err.et 10141 2001-06-20 02:45:58Z joda $ */\n\n#ifndef __k524_err_h__\n#define __k524_err_h__\n\nstruct et_list;\n\nvoid initialize_k524_error_table_r(struct et_list **);\n\nvoid initialize_k524_error_table(void);\n#define init_k524_err_tbl initialize_k524_error_table\n\ntypedef enum k524_error_number{\n\tKRB524_BADKEY = -1750206208,\n\tKRB524_BADADDR = -1750206207,\n\tKRB524_BADPRINC = -1750206206,\n\tKRB524_BADREALM = -1750206205,\n\tKRB524_V4ERR = -1750206204,\n\tKRB524_ENCFULL = -1750206203,\n\tKRB524_DECEMPTY = -1750206202,\n\tKRB524_NOTRESP = -1750206201\n} k524_error_number;\n\n#define ERROR_TABLE_BASE_k524 -1750206208\n\n#endif /* __k524_err_h__ */\n"
  },
  {
    "path": "freebsd-headers/kadm5/admin.h",
    "content": "/*\n * Copyright (c) 1997-2000 Kungliga Tekniska Hgskolan\n * (Royal Institute of Technology, Stockholm, Sweden). \n * All rights reserved. \n *\n * Redistribution and use in source and binary forms, with or without \n * modification, are permitted provided that the following conditions \n * are met: \n *\n * 1. Redistributions of source code must retain the above copyright \n *    notice, this list of conditions and the following disclaimer. \n *\n * 2. Redistributions in binary form must reproduce the above copyright \n *    notice, this list of conditions and the following disclaimer in the \n *    documentation and/or other materials provided with the distribution. \n *\n * 3. Neither the name of the Institute nor the names of its contributors \n *    may be used to endorse or promote products derived from this software \n *    without specific prior written permission. \n *\n * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND \n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE \n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE \n * ARE DISCLAIMED.  IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE \n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL \n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS \n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) \n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT \n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY \n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF \n * SUCH DAMAGE. \n */\n/* $Id: admin.h 20237 2007-02-16 23:54:34Z lha $ */\n\n#ifndef __KADM5_ADMIN_H__\n#define __KADM5_ADMIN_H__\n\n#define KADM5_API_VERSION_1 1\n#define KADM5_API_VERSION_2 2\n\n#ifndef USE_KADM5_API_VERSION\n#define USE_KADM5_API_VERSION KADM5_API_VERSION_2\n#endif\n\n#if USE_KADM5_API_VERSION != KADM5_API_VERSION_2\n#error No support for API versions other than 2\n#endif\n\n#define KADM5_STRUCT_VERSION 0\n\n#include <krb5.h>\n\n#define KRB5_KDB_DISALLOW_POSTDATED\t0x00000001\n#define KRB5_KDB_DISALLOW_FORWARDABLE\t0x00000002\n#define KRB5_KDB_DISALLOW_TGT_BASED\t0x00000004\n#define KRB5_KDB_DISALLOW_RENEWABLE\t0x00000008\n#define KRB5_KDB_DISALLOW_PROXIABLE\t0x00000010\n#define KRB5_KDB_DISALLOW_DUP_SKEY\t0x00000020\n#define KRB5_KDB_DISALLOW_ALL_TIX\t0x00000040\n#define KRB5_KDB_REQUIRES_PRE_AUTH\t0x00000080\n#define KRB5_KDB_REQUIRES_HW_AUTH\t0x00000100\n#define KRB5_KDB_REQUIRES_PWCHANGE\t0x00000200\n#define KRB5_KDB_DISALLOW_SVR\t\t0x00001000\n#define KRB5_KDB_PWCHANGE_SERVICE\t0x00002000\n#define KRB5_KDB_SUPPORT_DESMD5\t\t0x00004000\n#define KRB5_KDB_NEW_PRINC\t\t0x00008000\n#define KRB5_KDB_OK_AS_DELEGATE\t\t0x00010000\n#define KRB5_KDB_TRUSTED_FOR_DELEGATION\t0x00020000\n#define KRB5_KDB_ALLOW_KERBEROS4\t0x00040000\n#define KRB5_KDB_ALLOW_DIGEST\t\t0x00080000\n\n#define KADM5_PRINCIPAL\t\t0x000001\n#define KADM5_PRINC_EXPIRE_TIME\t0x000002\n#define KADM5_PW_EXPIRATION\t0x000004\n#define KADM5_LAST_PWD_CHANGE\t0x000008\n#define KADM5_ATTRIBUTES\t0x000010\n#define KADM5_MAX_LIFE\t\t0x000020\n#define KADM5_MOD_TIME\t\t0x000040\n#define KADM5_MOD_NAME\t\t0x000080\n#define KADM5_KVNO\t\t0x000100\n#define KADM5_MKVNO\t\t0x000200\n#define KADM5_AUX_ATTRIBUTES\t0x000400\n#define KADM5_POLICY\t\t0x000800\n#define KADM5_POLICY_CLR\t0x001000\n#define KADM5_MAX_RLIFE\t\t0x002000\n#define KADM5_LAST_SUCCESS\t0x004000\n#define KADM5_LAST_FAILED\t0x008000\n#define KADM5_FAIL_AUTH_COUNT\t0x010000\n#define KADM5_KEY_DATA\t\t0x020000\n#define KADM5_TL_DATA\t\t0x040000\n\n#define KADM5_PRINCIPAL_NORMAL_MASK (~(KADM5_KEY_DATA | KADM5_TL_DATA))\n\n#define KADM5_PW_MAX_LIFE \t0x004000\n#define KADM5_PW_MIN_LIFE\t0x008000\n#define KADM5_PW_MIN_LENGTH \t0x010000\n#define KADM5_PW_MIN_CLASSES\t0x020000\n#define KADM5_PW_HISTORY_NUM\t0x040000\n#define KADM5_REF_COUNT\t\t0x080000\n\n#define KADM5_POLICY_NORMAL_MASK (~0)\n\n#define KADM5_ADMIN_SERVICE\t\"kadmin/admin\"\n#define KADM5_HIST_PRINCIPAL\t\"kadmin/history\"\n#define KADM5_CHANGEPW_SERVICE\t\"kadmin/changepw\"\n\ntypedef struct _krb5_key_data {\n    int16_t key_data_ver;\t/* Version */\n    int16_t key_data_kvno;\t/* Key Version */\n    int16_t key_data_type[2];\t/* Array of types */\n    int16_t key_data_length[2];\t/* Array of lengths */\n    void*   key_data_contents[2];/* Array of pointers */\n} krb5_key_data;\n\ntypedef struct _krb5_tl_data {\n    struct _krb5_tl_data* tl_data_next;\n    int16_t tl_data_type;         \n    int16_t tl_data_length;       \n    void*   tl_data_contents;     \n} krb5_tl_data;\n\n#define KRB5_TL_LAST_PWD_CHANGE\t\t0x0001\n#define KRB5_TL_MOD_PRINC\t\t0x0002\n#define KRB5_TL_KADM_DATA\t\t0x0003\n#define KRB5_TL_KADM5_E_DATA\t\t0x0004\n#define KRB5_TL_RB1_CHALLENGE\t\t0x0005\n#define KRB5_TL_SECURID_STATE           0x0006\n#define KRB5_TL_PASSWORD           \t0x0007\n#define KRB5_TL_EXTENSION           \t0x0008\n#define KRB5_TL_PKINIT_ACL           \t0x0009\n#define KRB5_TL_ALIASES           \t0x000a\n\ntypedef struct _kadm5_principal_ent_t {\n    krb5_principal principal;\n\n    krb5_timestamp princ_expire_time;\n    krb5_timestamp last_pwd_change;\n    krb5_timestamp pw_expiration;\n    krb5_deltat max_life;\n    krb5_principal mod_name;\n    krb5_timestamp mod_date;\n    krb5_flags attributes;\n    krb5_kvno kvno;\n    krb5_kvno mkvno;\n\n    char * policy;\n    uint32_t aux_attributes;\n\n    krb5_deltat max_renewable_life;\n    krb5_timestamp last_success;\n    krb5_timestamp last_failed;\n    krb5_kvno fail_auth_count;\n    int16_t n_key_data;\n    int16_t n_tl_data;\n    krb5_tl_data *tl_data;\n    krb5_key_data *key_data;\n} kadm5_principal_ent_rec, *kadm5_principal_ent_t;\n\ntypedef struct _kadm5_policy_ent_t {\n    char *policy;\n\n    uint32_t pw_min_life;\n    uint32_t pw_max_life;\n    uint32_t pw_min_length;\n    uint32_t pw_min_classes;\n    uint32_t pw_history_num;\n    uint32_t policy_refcnt;\n} kadm5_policy_ent_rec, *kadm5_policy_ent_t;\n\n#define KADM5_CONFIG_REALM\t\t\t(1 << 0)\n#define KADM5_CONFIG_PROFILE\t\t\t(1 << 1)\n#define KADM5_CONFIG_KADMIND_PORT\t\t(1 << 2)\n#define KADM5_CONFIG_ADMIN_SERVER\t\t(1 << 3)\n#define KADM5_CONFIG_DBNAME\t\t\t(1 << 4)\n#define KADM5_CONFIG_ADBNAME\t\t\t(1 << 5)\n#define KADM5_CONFIG_ADB_LOCKFILE\t\t(1 << 6)\n#define KADM5_CONFIG_ACL_FILE\t\t\t(1 << 7)\n#define KADM5_CONFIG_DICT_FILE\t\t\t(1 << 8)\n#define KADM5_CONFIG_ADMIN_KEYTAB\t\t(1 << 9)\n#define KADM5_CONFIG_MKEY_FROM_KEYBOARD\t\t(1 << 10)\n#define KADM5_CONFIG_STASH_FILE\t\t\t(1 << 11)\n#define KADM5_CONFIG_MKEY_NAME\t\t\t(1 << 12)\n#define KADM5_CONFIG_ENCTYPE\t\t\t(1 << 13)\n#define KADM5_CONFIG_MAX_LIFE\t\t\t(1 << 14)\n#define KADM5_CONFIG_MAX_RLIFE\t\t\t(1 << 15)\n#define KADM5_CONFIG_EXPIRATION\t\t\t(1 << 16)\n#define KADM5_CONFIG_FLAGS\t\t\t(1 << 17)\n#define KADM5_CONFIG_ENCTYPES\t\t\t(1 << 18)\n\n#define KADM5_PRIV_GET\t\t(1 << 0)\n#define KADM5_PRIV_ADD \t\t(1 << 1)\n#define KADM5_PRIV_MODIFY\t(1 << 2)\n#define KADM5_PRIV_DELETE\t(1 << 3)\n#define KADM5_PRIV_LIST\t\t(1 << 4)\n#define KADM5_PRIV_CPW\t\t(1 << 5)\n#define KADM5_PRIV_ALL\t\t(KADM5_PRIV_GET | KADM5_PRIV_ADD | KADM5_PRIV_MODIFY | KADM5_PRIV_DELETE | KADM5_PRIV_LIST | KADM5_PRIV_CPW)\n\ntypedef struct {\n    int XXX;\n}krb5_key_salt_tuple;\n\ntypedef struct _kadm5_config_params {\n    uint32_t mask;\n\n    /* Client and server fields */\n    char *realm;\n    int kadmind_port;\n\n    /* client fields */\n    char *admin_server;\n\n    /* server fields */\n    char *dbname;\n    char *acl_file;\n\n    /* server library (database) fields */\n    char *stash_file;\n} kadm5_config_params;\n\ntypedef krb5_error_code kadm5_ret_t;\n\n#include \"kadm5-protos.h\"\n\n#if 0\n/* unimplemented functions */\nkadm5_ret_t \nkadm5_decrypt_key(void *server_handle,\n\t\t  kadm5_principal_ent_t entry, int32_t\n\t\t  ktype, int32_t stype, int32_t\n\t\t  kvno, krb5_keyblock *keyblock,\n\t\t  krb5_keysalt *keysalt, int *kvnop);\n\nkadm5_ret_t\nkadm5_create_policy(void *server_handle,\n\t\t    kadm5_policy_ent_t policy, uint32_t mask); \n\nkadm5_ret_t\nkadm5_delete_policy(void *server_handle, char *policy);\n\n\nkadm5_ret_t\nkadm5_modify_policy(void *server_handle,\n\t\t    kadm5_policy_ent_t policy, \n\t\t    uint32_t mask);\n\nkadm5_ret_t\nkadm5_get_policy(void *server_handle, char *policy, kadm5_policy_ent_t ent); \n\nkadm5_ret_t\nkadm5_get_policies(void *server_handle, char *exp,\n\t\t   char ***pols, int *count);\n\nvoid \nkadm5_free_policy_ent(kadm5_policy_ent_t policy);\n\n#endif\n\n#endif /* __KADM5_ADMIN_H__ */\n"
  },
  {
    "path": "freebsd-headers/kadm5/kadm5-private.h",
    "content": "/* This is a generated file */\n#ifndef __kadm5_private_h__\n#define __kadm5_private_h__\n\n#include <stdarg.h>\n\nkadm5_ret_t\n_kadm5_acl_check_permission (\n\tkadm5_server_context */*context*/,\n\tunsigned /*op*/,\n\tkrb5_const_principal /*princ*/);\n\nkadm5_ret_t\n_kadm5_acl_init (kadm5_server_context */*context*/);\n\nkadm5_ret_t\n_kadm5_bump_pw_expire (\n\tkadm5_server_context */*context*/,\n\thdb_entry */*ent*/);\n\nkrb5_error_code\n_kadm5_c_get_cred_cache (\n\tkrb5_context /*context*/,\n\tconst char */*client_name*/,\n\tconst char */*server_name*/,\n\tconst char */*password*/,\n\tkrb5_prompter_fct /*prompter*/,\n\tconst char */*keytab*/,\n\tkrb5_ccache /*ccache*/,\n\tkrb5_ccache */*ret_cache*/);\n\nkadm5_ret_t\n_kadm5_c_init_context (\n\tkadm5_client_context **/*ctx*/,\n\tkadm5_config_params */*params*/,\n\tkrb5_context /*context*/);\n\nkadm5_ret_t\n_kadm5_client_recv (\n\tkadm5_client_context */*context*/,\n\tkrb5_data */*reply*/);\n\nkadm5_ret_t\n_kadm5_client_send (\n\tkadm5_client_context */*context*/,\n\tkrb5_storage */*sp*/);\n\nint\n_kadm5_cmp_keys (\n\tKey */*keys1*/,\n\tint /*len1*/,\n\tKey */*keys2*/,\n\tint /*len2*/);\n\nkadm5_ret_t\n_kadm5_connect (void */*handle*/);\n\nkadm5_ret_t\n_kadm5_error_code (kadm5_ret_t /*code*/);\n\nvoid\n_kadm5_free_keys (\n\tkrb5_context /*context*/,\n\tint /*len*/,\n\tKey */*keys*/);\n\nvoid\n_kadm5_init_keys (\n\tKey */*keys*/,\n\tint /*len*/);\n\nkadm5_ret_t\n_kadm5_marshal_params (\n\tkrb5_context /*context*/,\n\tkadm5_config_params */*params*/,\n\tkrb5_data */*out*/);\n\nkadm5_ret_t\n_kadm5_privs_to_string (\n\tuint32_t /*privs*/,\n\tchar */*string*/,\n\tsize_t /*len*/);\n\nHDB *\n_kadm5_s_get_db (void */*server_handle*/);\n\nkadm5_ret_t\n_kadm5_s_init_context (\n\tkadm5_server_context **/*ctx*/,\n\tkadm5_config_params */*params*/,\n\tkrb5_context /*context*/);\n\nkadm5_ret_t\n_kadm5_set_keys (\n\tkadm5_server_context */*context*/,\n\thdb_entry */*ent*/,\n\tconst char */*password*/);\n\nkadm5_ret_t\n_kadm5_set_keys2 (\n\tkadm5_server_context */*context*/,\n\thdb_entry */*ent*/,\n\tint16_t /*n_key_data*/,\n\tkrb5_key_data */*key_data*/);\n\nkadm5_ret_t\n_kadm5_set_keys3 (\n\tkadm5_server_context */*context*/,\n\thdb_entry */*ent*/,\n\tint /*n_keys*/,\n\tkrb5_keyblock */*keyblocks*/);\n\nkadm5_ret_t\n_kadm5_set_keys_randomly (\n\tkadm5_server_context */*context*/,\n\thdb_entry */*ent*/,\n\tkrb5_keyblock **/*new_keys*/,\n\tint */*n_keys*/);\n\nkadm5_ret_t\n_kadm5_set_modifier (\n\tkadm5_server_context */*context*/,\n\thdb_entry */*ent*/);\n\nkadm5_ret_t\n_kadm5_setup_entry (\n\tkadm5_server_context */*context*/,\n\thdb_entry_ex */*ent*/,\n\tuint32_t /*mask*/,\n\tkadm5_principal_ent_t /*princ*/,\n\tuint32_t /*princ_mask*/,\n\tkadm5_principal_ent_t /*def*/,\n\tuint32_t /*def_mask*/);\n\nkadm5_ret_t\n_kadm5_string_to_privs (\n\tconst char */*s*/,\n\tuint32_t* /*privs*/);\n\nkadm5_ret_t\n_kadm5_unmarshal_params (\n\tkrb5_context /*context*/,\n\tkrb5_data */*in*/,\n\tkadm5_config_params */*params*/);\n\nkadm5_ret_t\nkadm5_c_chpass_principal (\n\tvoid */*server_handle*/,\n\tkrb5_principal /*princ*/,\n\tconst char */*password*/);\n\nkadm5_ret_t\nkadm5_c_chpass_principal_with_key (\n\tvoid */*server_handle*/,\n\tkrb5_principal /*princ*/,\n\tint /*n_key_data*/,\n\tkrb5_key_data */*key_data*/);\n\nkadm5_ret_t\nkadm5_c_create_principal (\n\tvoid */*server_handle*/,\n\tkadm5_principal_ent_t /*princ*/,\n\tuint32_t /*mask*/,\n\tconst char */*password*/);\n\nkadm5_ret_t\nkadm5_c_delete_principal (\n\tvoid */*server_handle*/,\n\tkrb5_principal /*princ*/);\n\nkadm5_ret_t\nkadm5_c_destroy (void */*server_handle*/);\n\nkadm5_ret_t\nkadm5_c_flush (void */*server_handle*/);\n\nkadm5_ret_t\nkadm5_c_get_principal (\n\tvoid */*server_handle*/,\n\tkrb5_principal /*princ*/,\n\tkadm5_principal_ent_t /*out*/,\n\tuint32_t /*mask*/);\n\nkadm5_ret_t\nkadm5_c_get_principals (\n\tvoid */*server_handle*/,\n\tconst char */*expression*/,\n\tchar ***/*princs*/,\n\tint */*count*/);\n\nkadm5_ret_t\nkadm5_c_get_privs (\n\tvoid */*server_handle*/,\n\tuint32_t */*privs*/);\n\nkadm5_ret_t\nkadm5_c_init_with_creds (\n\tconst char */*client_name*/,\n\tkrb5_ccache /*ccache*/,\n\tconst char */*service_name*/,\n\tkadm5_config_params */*realm_params*/,\n\tunsigned long /*struct_version*/,\n\tunsigned long /*api_version*/,\n\tvoid **/*server_handle*/);\n\nkadm5_ret_t\nkadm5_c_init_with_creds_ctx (\n\tkrb5_context /*context*/,\n\tconst char */*client_name*/,\n\tkrb5_ccache /*ccache*/,\n\tconst char */*service_name*/,\n\tkadm5_config_params */*realm_params*/,\n\tunsigned long /*struct_version*/,\n\tunsigned long /*api_version*/,\n\tvoid **/*server_handle*/);\n\nkadm5_ret_t\nkadm5_c_init_with_password (\n\tconst char */*client_name*/,\n\tconst char */*password*/,\n\tconst char */*service_name*/,\n\tkadm5_config_params */*realm_params*/,\n\tunsigned long /*struct_version*/,\n\tunsigned long /*api_version*/,\n\tvoid **/*server_handle*/);\n\nkadm5_ret_t\nkadm5_c_init_with_password_ctx (\n\tkrb5_context /*context*/,\n\tconst char */*client_name*/,\n\tconst char */*password*/,\n\tconst char */*service_name*/,\n\tkadm5_config_params */*realm_params*/,\n\tunsigned long /*struct_version*/,\n\tunsigned long /*api_version*/,\n\tvoid **/*server_handle*/);\n\nkadm5_ret_t\nkadm5_c_init_with_skey (\n\tconst char */*client_name*/,\n\tconst char */*keytab*/,\n\tconst char */*service_name*/,\n\tkadm5_config_params */*realm_params*/,\n\tunsigned long /*struct_version*/,\n\tunsigned long /*api_version*/,\n\tvoid **/*server_handle*/);\n\nkadm5_ret_t\nkadm5_c_init_with_skey_ctx (\n\tkrb5_context /*context*/,\n\tconst char */*client_name*/,\n\tconst char */*keytab*/,\n\tconst char */*service_name*/,\n\tkadm5_config_params */*realm_params*/,\n\tunsigned long /*struct_version*/,\n\tunsigned long /*api_version*/,\n\tvoid **/*server_handle*/);\n\nkadm5_ret_t\nkadm5_c_modify_principal (\n\tvoid */*server_handle*/,\n\tkadm5_principal_ent_t /*princ*/,\n\tuint32_t /*mask*/);\n\nkadm5_ret_t\nkadm5_c_randkey_principal (\n\tvoid */*server_handle*/,\n\tkrb5_principal /*princ*/,\n\tkrb5_keyblock **/*new_keys*/,\n\tint */*n_keys*/);\n\nkadm5_ret_t\nkadm5_c_rename_principal (\n\tvoid */*server_handle*/,\n\tkrb5_principal /*source*/,\n\tkrb5_principal /*target*/);\n\nkadm5_ret_t\nkadm5_log_create (\n\tkadm5_server_context */*context*/,\n\thdb_entry */*ent*/);\n\nkadm5_ret_t\nkadm5_log_delete (\n\tkadm5_server_context */*context*/,\n\tkrb5_principal /*princ*/);\n\nkadm5_ret_t\nkadm5_log_end (kadm5_server_context */*context*/);\n\nkadm5_ret_t\nkadm5_log_foreach (\n\tkadm5_server_context */*context*/,\n\tvoid (*/*func*/)(kadm5_server_context *server_context, uint32_t ver, time_t timestamp, enum kadm_ops op, uint32_t len, krb5_storage *, void *),\n\tvoid */*ctx*/);\n\nkadm5_ret_t\nkadm5_log_get_version (\n\tkadm5_server_context */*context*/,\n\tuint32_t */*ver*/);\n\nkadm5_ret_t\nkadm5_log_get_version_fd (\n\tint /*fd*/,\n\tuint32_t */*ver*/);\n\nkrb5_storage *\nkadm5_log_goto_end (int /*fd*/);\n\nkadm5_ret_t\nkadm5_log_init (kadm5_server_context */*context*/);\n\nkadm5_ret_t\nkadm5_log_modify (\n\tkadm5_server_context */*context*/,\n\thdb_entry */*ent*/,\n\tuint32_t /*mask*/);\n\nkadm5_ret_t\nkadm5_log_nop (kadm5_server_context */*context*/);\n\nkadm5_ret_t\nkadm5_log_previous (\n\tkrb5_context /*context*/,\n\tkrb5_storage */*sp*/,\n\tuint32_t */*ver*/,\n\ttime_t */*timestamp*/,\n\tenum kadm_ops */*op*/,\n\tuint32_t */*len*/);\n\nkadm5_ret_t\nkadm5_log_reinit (kadm5_server_context */*context*/);\n\nkadm5_ret_t\nkadm5_log_rename (\n\tkadm5_server_context */*context*/,\n\tkrb5_principal /*source*/,\n\thdb_entry */*ent*/);\n\nkadm5_ret_t\nkadm5_log_replay (\n\tkadm5_server_context */*context*/,\n\tenum kadm_ops /*op*/,\n\tuint32_t /*ver*/,\n\tuint32_t /*len*/,\n\tkrb5_storage */*sp*/);\n\nkadm5_ret_t\nkadm5_log_set_version (\n\tkadm5_server_context */*context*/,\n\tuint32_t /*vno*/);\n\nconst char *\nkadm5_log_signal_socket (krb5_context /*context*/);\n\nkadm5_ret_t\nkadm5_log_truncate (kadm5_server_context */*server_context*/);\n\nkadm5_ret_t\nkadm5_s_chpass_principal (\n\tvoid */*server_handle*/,\n\tkrb5_principal /*princ*/,\n\tconst char */*password*/);\n\nkadm5_ret_t\nkadm5_s_chpass_principal_cond (\n\tvoid */*server_handle*/,\n\tkrb5_principal /*princ*/,\n\tconst char */*password*/);\n\nkadm5_ret_t\nkadm5_s_chpass_principal_with_key (\n\tvoid */*server_handle*/,\n\tkrb5_principal /*princ*/,\n\tint /*n_key_data*/,\n\tkrb5_key_data */*key_data*/);\n\nkadm5_ret_t\nkadm5_s_create_principal (\n\tvoid */*server_handle*/,\n\tkadm5_principal_ent_t /*princ*/,\n\tuint32_t /*mask*/,\n\tconst char */*password*/);\n\nkadm5_ret_t\nkadm5_s_create_principal_with_key (\n\tvoid */*server_handle*/,\n\tkadm5_principal_ent_t /*princ*/,\n\tuint32_t /*mask*/);\n\nkadm5_ret_t\nkadm5_s_delete_principal (\n\tvoid */*server_handle*/,\n\tkrb5_principal /*princ*/);\n\nkadm5_ret_t\nkadm5_s_destroy (void */*server_handle*/);\n\nkadm5_ret_t\nkadm5_s_flush (void */*server_handle*/);\n\nkadm5_ret_t\nkadm5_s_get_principal (\n\tvoid */*server_handle*/,\n\tkrb5_principal /*princ*/,\n\tkadm5_principal_ent_t /*out*/,\n\tuint32_t /*mask*/);\n\nkadm5_ret_t\nkadm5_s_get_principals (\n\tvoid */*server_handle*/,\n\tconst char */*expression*/,\n\tchar ***/*princs*/,\n\tint */*count*/);\n\nkadm5_ret_t\nkadm5_s_get_privs (\n\tvoid */*server_handle*/,\n\tuint32_t */*privs*/);\n\nkadm5_ret_t\nkadm5_s_init_with_creds (\n\tconst char */*client_name*/,\n\tkrb5_ccache /*ccache*/,\n\tconst char */*service_name*/,\n\tkadm5_config_params */*realm_params*/,\n\tunsigned long /*struct_version*/,\n\tunsigned long /*api_version*/,\n\tvoid **/*server_handle*/);\n\nkadm5_ret_t\nkadm5_s_init_with_creds_ctx (\n\tkrb5_context /*context*/,\n\tconst char */*client_name*/,\n\tkrb5_ccache /*ccache*/,\n\tconst char */*service_name*/,\n\tkadm5_config_params */*realm_params*/,\n\tunsigned long /*struct_version*/,\n\tunsigned long /*api_version*/,\n\tvoid **/*server_handle*/);\n\nkadm5_ret_t\nkadm5_s_init_with_password (\n\tconst char */*client_name*/,\n\tconst char */*password*/,\n\tconst char */*service_name*/,\n\tkadm5_config_params */*realm_params*/,\n\tunsigned long /*struct_version*/,\n\tunsigned long /*api_version*/,\n\tvoid **/*server_handle*/);\n\nkadm5_ret_t\nkadm5_s_init_with_password_ctx (\n\tkrb5_context /*context*/,\n\tconst char */*client_name*/,\n\tconst char */*password*/,\n\tconst char */*service_name*/,\n\tkadm5_config_params */*realm_params*/,\n\tunsigned long /*struct_version*/,\n\tunsigned long /*api_version*/,\n\tvoid **/*server_handle*/);\n\nkadm5_ret_t\nkadm5_s_init_with_skey (\n\tconst char */*client_name*/,\n\tconst char */*keytab*/,\n\tconst char */*service_name*/,\n\tkadm5_config_params */*realm_params*/,\n\tunsigned long /*struct_version*/,\n\tunsigned long /*api_version*/,\n\tvoid **/*server_handle*/);\n\nkadm5_ret_t\nkadm5_s_init_with_skey_ctx (\n\tkrb5_context /*context*/,\n\tconst char */*client_name*/,\n\tconst char */*keytab*/,\n\tconst char */*service_name*/,\n\tkadm5_config_params */*realm_params*/,\n\tunsigned long /*struct_version*/,\n\tunsigned long /*api_version*/,\n\tvoid **/*server_handle*/);\n\nkadm5_ret_t\nkadm5_s_modify_principal (\n\tvoid */*server_handle*/,\n\tkadm5_principal_ent_t /*princ*/,\n\tuint32_t /*mask*/);\n\nkadm5_ret_t\nkadm5_s_randkey_principal (\n\tvoid */*server_handle*/,\n\tkrb5_principal /*princ*/,\n\tkrb5_keyblock **/*new_keys*/,\n\tint */*n_keys*/);\n\nkadm5_ret_t\nkadm5_s_rename_principal (\n\tvoid */*server_handle*/,\n\tkrb5_principal /*source*/,\n\tkrb5_principal /*target*/);\n\n#endif /* __kadm5_private_h__ */\n"
  },
  {
    "path": "freebsd-headers/kadm5/kadm5-protos.h",
    "content": "/* This is a generated file */\n#ifndef __kadm5_protos_h__\n#define __kadm5_protos_h__\n\n#include <stdarg.h>\n\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\nkadm5_ret_t\nkadm5_ad_init_with_password (\n\tconst char */*client_name*/,\n\tconst char */*password*/,\n\tconst char */*service_name*/,\n\tkadm5_config_params */*realm_params*/,\n\tunsigned long /*struct_version*/,\n\tunsigned long /*api_version*/,\n\tvoid **/*server_handle*/);\n\nkadm5_ret_t\nkadm5_ad_init_with_password_ctx (\n\tkrb5_context /*context*/,\n\tconst char */*client_name*/,\n\tconst char */*password*/,\n\tconst char */*service_name*/,\n\tkadm5_config_params */*realm_params*/,\n\tunsigned long /*struct_version*/,\n\tunsigned long /*api_version*/,\n\tvoid **/*server_handle*/);\n\nkrb5_error_code\nkadm5_add_passwd_quality_verifier (\n\tkrb5_context /*context*/,\n\tconst char */*check_library*/);\n\nconst char *\nkadm5_check_password_quality (\n\tkrb5_context /*context*/,\n\tkrb5_principal /*principal*/,\n\tkrb5_data */*pwd_data*/);\n\nkadm5_ret_t\nkadm5_chpass_principal (\n\tvoid */*server_handle*/,\n\tkrb5_principal /*princ*/,\n\tconst char */*password*/);\n\nkadm5_ret_t\nkadm5_chpass_principal_with_key (\n\tvoid */*server_handle*/,\n\tkrb5_principal /*princ*/,\n\tint /*n_key_data*/,\n\tkrb5_key_data */*key_data*/);\n\nkadm5_ret_t\nkadm5_create_principal (\n\tvoid */*server_handle*/,\n\tkadm5_principal_ent_t /*princ*/,\n\tuint32_t /*mask*/,\n\tconst char */*password*/);\n\nkadm5_ret_t\nkadm5_delete_principal (\n\tvoid */*server_handle*/,\n\tkrb5_principal /*princ*/);\n\nkadm5_ret_t\nkadm5_destroy (void */*server_handle*/);\n\nkadm5_ret_t\nkadm5_flush (void */*server_handle*/);\n\nvoid\nkadm5_free_key_data (\n\tvoid */*server_handle*/,\n\tint16_t */*n_key_data*/,\n\tkrb5_key_data */*key_data*/);\n\nvoid\nkadm5_free_name_list (\n\tvoid */*server_handle*/,\n\tchar **/*names*/,\n\tint */*count*/);\n\nvoid\nkadm5_free_principal_ent (\n\tvoid */*server_handle*/,\n\tkadm5_principal_ent_t /*princ*/);\n\nkadm5_ret_t\nkadm5_get_principal (\n\tvoid */*server_handle*/,\n\tkrb5_principal /*princ*/,\n\tkadm5_principal_ent_t /*out*/,\n\tuint32_t /*mask*/);\n\nkadm5_ret_t\nkadm5_get_principals (\n\tvoid */*server_handle*/,\n\tconst char */*expression*/,\n\tchar ***/*princs*/,\n\tint */*count*/);\n\nkadm5_ret_t\nkadm5_get_privs (\n\tvoid */*server_handle*/,\n\tuint32_t */*privs*/);\n\nkadm5_ret_t\nkadm5_init_with_creds (\n\tconst char */*client_name*/,\n\tkrb5_ccache /*ccache*/,\n\tconst char */*service_name*/,\n\tkadm5_config_params */*realm_params*/,\n\tunsigned long /*struct_version*/,\n\tunsigned long /*api_version*/,\n\tvoid **/*server_handle*/);\n\nkadm5_ret_t\nkadm5_init_with_creds_ctx (\n\tkrb5_context /*context*/,\n\tconst char */*client_name*/,\n\tkrb5_ccache /*ccache*/,\n\tconst char */*service_name*/,\n\tkadm5_config_params */*realm_params*/,\n\tunsigned long /*struct_version*/,\n\tunsigned long /*api_version*/,\n\tvoid **/*server_handle*/);\n\nkadm5_ret_t\nkadm5_init_with_password (\n\tconst char */*client_name*/,\n\tconst char */*password*/,\n\tconst char */*service_name*/,\n\tkadm5_config_params */*realm_params*/,\n\tunsigned long /*struct_version*/,\n\tunsigned long /*api_version*/,\n\tvoid **/*server_handle*/);\n\nkadm5_ret_t\nkadm5_init_with_password_ctx (\n\tkrb5_context /*context*/,\n\tconst char */*client_name*/,\n\tconst char */*password*/,\n\tconst char */*service_name*/,\n\tkadm5_config_params */*realm_params*/,\n\tunsigned long /*struct_version*/,\n\tunsigned long /*api_version*/,\n\tvoid **/*server_handle*/);\n\nkadm5_ret_t\nkadm5_init_with_skey (\n\tconst char */*client_name*/,\n\tconst char */*keytab*/,\n\tconst char */*service_name*/,\n\tkadm5_config_params */*realm_params*/,\n\tunsigned long /*struct_version*/,\n\tunsigned long /*api_version*/,\n\tvoid **/*server_handle*/);\n\nkadm5_ret_t\nkadm5_init_with_skey_ctx (\n\tkrb5_context /*context*/,\n\tconst char */*client_name*/,\n\tconst char */*keytab*/,\n\tconst char */*service_name*/,\n\tkadm5_config_params */*realm_params*/,\n\tunsigned long /*struct_version*/,\n\tunsigned long /*api_version*/,\n\tvoid **/*server_handle*/);\n\nkadm5_ret_t\nkadm5_modify_principal (\n\tvoid */*server_handle*/,\n\tkadm5_principal_ent_t /*princ*/,\n\tuint32_t /*mask*/);\n\nkadm5_ret_t\nkadm5_randkey_principal (\n\tvoid */*server_handle*/,\n\tkrb5_principal /*princ*/,\n\tkrb5_keyblock **/*new_keys*/,\n\tint */*n_keys*/);\n\nkadm5_ret_t\nkadm5_rename_principal (\n\tvoid */*server_handle*/,\n\tkrb5_principal /*source*/,\n\tkrb5_principal /*target*/);\n\nkadm5_ret_t\nkadm5_ret_key_data (\n\tkrb5_storage */*sp*/,\n\tkrb5_key_data */*key*/);\n\nkadm5_ret_t\nkadm5_ret_principal_ent (\n\tkrb5_storage */*sp*/,\n\tkadm5_principal_ent_t /*princ*/);\n\nkadm5_ret_t\nkadm5_ret_principal_ent_mask (\n\tkrb5_storage */*sp*/,\n\tkadm5_principal_ent_t /*princ*/,\n\tuint32_t */*mask*/);\n\nkadm5_ret_t\nkadm5_ret_tl_data (\n\tkrb5_storage */*sp*/,\n\tkrb5_tl_data */*tl*/);\n\nvoid\nkadm5_setup_passwd_quality_check (\n\tkrb5_context /*context*/,\n\tconst char */*check_library*/,\n\tconst char */*check_function*/);\n\nkadm5_ret_t\nkadm5_store_key_data (\n\tkrb5_storage */*sp*/,\n\tkrb5_key_data */*key*/);\n\nkadm5_ret_t\nkadm5_store_principal_ent (\n\tkrb5_storage */*sp*/,\n\tkadm5_principal_ent_t /*princ*/);\n\nkadm5_ret_t\nkadm5_store_principal_ent_mask (\n\tkrb5_storage */*sp*/,\n\tkadm5_principal_ent_t /*princ*/,\n\tuint32_t /*mask*/);\n\nkadm5_ret_t\nkadm5_store_tl_data (\n\tkrb5_storage */*sp*/,\n\tkrb5_tl_data */*tl*/);\n\n#ifdef __cplusplus\n}\n#endif\n\n#endif /* __kadm5_protos_h__ */\n"
  },
  {
    "path": "freebsd-headers/kadm5/kadm5_err.h",
    "content": "/* Generated from /usr/src/kerberos5/lib/libkadm5clnt/../../../crypto/heimdal/lib/kadm5/kadm5_err.et */\n/* $Id: kadm5_err.et 16683 2006-02-02 13:11:47Z lha $ */\n\n#ifndef __kadm5_err_h__\n#define __kadm5_err_h__\n\nstruct et_list;\n\nvoid initialize_kadm5_error_table_r(struct et_list **);\n\nvoid initialize_kadm5_error_table(void);\n#define init_kadm5_err_tbl initialize_kadm5_error_table\n\ntypedef enum kadm5_error_number{\n\tKADM5_FAILURE = 43787520,\n\tKADM5_AUTH_GET = 43787521,\n\tKADM5_AUTH_ADD = 43787522,\n\tKADM5_AUTH_MODIFY = 43787523,\n\tKADM5_AUTH_DELETE = 43787524,\n\tKADM5_AUTH_INSUFFICIENT = 43787525,\n\tKADM5_BAD_DB = 43787526,\n\tKADM5_DUP = 43787527,\n\tKADM5_RPC_ERROR = 43787528,\n\tKADM5_NO_SRV = 43787529,\n\tKADM5_BAD_HIST_KEY = 43787530,\n\tKADM5_NOT_INIT = 43787531,\n\tKADM5_UNK_PRINC = 43787532,\n\tKADM5_UNK_POLICY = 43787533,\n\tKADM5_BAD_MASK = 43787534,\n\tKADM5_BAD_CLASS = 43787535,\n\tKADM5_BAD_LENGTH = 43787536,\n\tKADM5_BAD_POLICY = 43787537,\n\tKADM5_BAD_PRINCIPAL = 43787538,\n\tKADM5_BAD_AUX_ATTR = 43787539,\n\tKADM5_BAD_HISTORY = 43787540,\n\tKADM5_BAD_MIN_PASS_LIFE = 43787541,\n\tKADM5_PASS_Q_TOOSHORT = 43787542,\n\tKADM5_PASS_Q_CLASS = 43787543,\n\tKADM5_PASS_Q_DICT = 43787544,\n\tKADM5_PASS_REUSE = 43787545,\n\tKADM5_PASS_TOOSOON = 43787546,\n\tKADM5_POLICY_REF = 43787547,\n\tKADM5_INIT = 43787548,\n\tKADM5_BAD_PASSWORD = 43787549,\n\tKADM5_PROTECT_PRINCIPAL = 43787550,\n\tKADM5_BAD_SERVER_HANDLE = 43787551,\n\tKADM5_BAD_STRUCT_VERSION = 43787552,\n\tKADM5_OLD_STRUCT_VERSION = 43787553,\n\tKADM5_NEW_STRUCT_VERSION = 43787554,\n\tKADM5_BAD_API_VERSION = 43787555,\n\tKADM5_OLD_LIB_API_VERSION = 43787556,\n\tKADM5_OLD_SERVER_API_VERSION = 43787557,\n\tKADM5_NEW_LIB_API_VERSION = 43787558,\n\tKADM5_NEW_SERVER_API_VERSION = 43787559,\n\tKADM5_SECURE_PRINC_MISSING = 43787560,\n\tKADM5_NO_RENAME_SALT = 43787561,\n\tKADM5_BAD_CLIENT_PARAMS = 43787562,\n\tKADM5_BAD_SERVER_PARAMS = 43787563,\n\tKADM5_AUTH_LIST = 43787564,\n\tKADM5_AUTH_CHANGEPW = 43787565,\n\tKADM5_BAD_TL_TYPE = 43787566,\n\tKADM5_MISSING_CONF_PARAMS = 43787567,\n\tKADM5_BAD_SERVER_NAME = 43787568\n} kadm5_error_number;\n\n#define ERROR_TABLE_BASE_kadm5 43787520\n\n#endif /* __kadm5_err_h__ */\n"
  },
  {
    "path": "freebsd-headers/kadm5/private.h",
    "content": "/*\n * Copyright (c) 1997-2000 Kungliga Tekniska Hgskolan\n * (Royal Institute of Technology, Stockholm, Sweden). \n * All rights reserved. \n *\n * Redistribution and use in source and binary forms, with or without \n * modification, are permitted provided that the following conditions \n * are met: \n *\n * 1. Redistributions of source code must retain the above copyright \n *    notice, this list of conditions and the following disclaimer. \n *\n * 2. Redistributions in binary form must reproduce the above copyright \n *    notice, this list of conditions and the following disclaimer in the \n *    documentation and/or other materials provided with the distribution. \n *\n * 3. Neither the name of the Institute nor the names of its contributors \n *    may be used to endorse or promote products derived from this software \n *    without specific prior written permission. \n *\n * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND \n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE \n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE \n * ARE DISCLAIMED.  IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE \n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL \n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS \n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) \n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT \n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY \n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF \n * SUCH DAMAGE. \n */\n\n/* $Id: private.h 22211 2007-12-07 19:27:27Z lha $ */\n\n#ifndef __kadm5_privatex_h__\n#define __kadm5_privatex_h__\n\nstruct kadm_func {\n    kadm5_ret_t (*chpass_principal) (void *, krb5_principal, const char*);\n    kadm5_ret_t (*create_principal) (void*, kadm5_principal_ent_t, \n\t\t\t\t     uint32_t, const char*);\n    kadm5_ret_t (*delete_principal) (void*, krb5_principal);\n    kadm5_ret_t (*destroy) (void*);\n    kadm5_ret_t (*flush) (void*);\n    kadm5_ret_t (*get_principal) (void*, krb5_principal, \n\t\t\t\t  kadm5_principal_ent_t, uint32_t);\n    kadm5_ret_t (*get_principals) (void*, const char*, char***, int*);\n    kadm5_ret_t (*get_privs) (void*, uint32_t*);\n    kadm5_ret_t (*modify_principal) (void*, kadm5_principal_ent_t, uint32_t);\n    kadm5_ret_t (*randkey_principal) (void*, krb5_principal, \n\t\t\t\t      krb5_keyblock**, int*);\n    kadm5_ret_t (*rename_principal) (void*, krb5_principal, krb5_principal);\n    kadm5_ret_t (*chpass_principal_with_key) (void *, krb5_principal,\n\t\t\t\t\t      int, krb5_key_data *);\n};\n\n/* XXX should be integrated */\ntypedef struct kadm5_common_context {\n    krb5_context context;\n    krb5_boolean my_context;\n    struct kadm_func funcs;\n    void *data;\n}kadm5_common_context;\n\ntypedef struct kadm5_log_peer {\n    int fd;\n    char *name;\n    krb5_auth_context ac;\n    struct kadm5_log_peer *next;\n} kadm5_log_peer;\n\ntypedef struct kadm5_log_context {\n    char *log_file;\n    int log_fd;\n    uint32_t version;\n    struct sockaddr_un socket_name;\n    int socket_fd;\n} kadm5_log_context;\n\ntypedef struct kadm5_server_context {\n    krb5_context context;\n    krb5_boolean my_context;\n    struct kadm_func funcs;\n    /* */\n    kadm5_config_params config;\n    HDB *db;\n    krb5_principal caller;\n    unsigned acl_flags;\n    kadm5_log_context log_context;\n} kadm5_server_context;\n\ntypedef struct kadm5_client_context {\n    krb5_context context;\n    krb5_boolean my_context;\n    struct kadm_func funcs;\n    /* */\n    krb5_auth_context ac;\n    char *realm;\n    char *admin_server;\n    int kadmind_port;\n    int sock;\n    char *client_name;\n    char *service_name;\n    krb5_prompter_fct prompter;\n    const char *keytab;\n    krb5_ccache ccache;\n    kadm5_config_params *realm_params;\n}kadm5_client_context;\n\ntypedef struct kadm5_ad_context {\n    krb5_context context;\n    krb5_boolean my_context;\n    struct kadm_func funcs;\n    /* */\n    kadm5_config_params config;\n    krb5_principal caller;\n    krb5_ccache ccache;\n    char *client_name;\n    char *realm;\n    void *ldap_conn;\n    char *base_dn;\n} kadm5_ad_context;\n\nenum kadm_ops {\n    kadm_get,\n    kadm_delete,\n    kadm_create,\n    kadm_rename,\n    kadm_chpass,\n    kadm_modify,\n    kadm_randkey,\n    kadm_get_privs,\n    kadm_get_princs,\n    kadm_chpass_with_key,\n    kadm_nop\n};\n\n#define KADMIN_APPL_VERSION \"KADM0.1\"\n#define KADMIN_OLD_APPL_VERSION \"KADM0.0\"\n\n#include \"kadm5-private.h\"\n\n#endif /* __kadm5_privatex_h__ */\n"
  },
  {
    "path": "freebsd-headers/kafs.h",
    "content": "/*\n * Copyright (c) 1995 - 2001, 2003 Kungliga Tekniska Hgskolan\n * (Royal Institute of Technology, Stockholm, Sweden).\n * All rights reserved.\n * \n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * \n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * \n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * \n * 3. Neither the name of the Institute nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n * \n * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n */\n\n/* $Id: kafs.h 20652 2007-05-10 19:30:18Z lha $ */\n\n#ifndef __KAFS_H\n#define __KAFS_H\n\n/* XXX must include krb5.h or krb.h */\n\n/* sys/ioctl.h must be included manually before kafs.h */\n\n/*\n */\n#define AFSCALL_PIOCTL 20\n#define AFSCALL_SETPAG 21\n\n#ifndef _VICEIOCTL\n#define _VICEIOCTL(id)  ((unsigned int ) _IOW('V', id, struct ViceIoctl))\n#define _AFSCIOCTL(id)  ((unsigned int ) _IOW('C', id, struct ViceIoctl))\n#endif /* _VICEIOCTL */\n\n#define VIOCSETAL\t\t_VICEIOCTL(1)\n#define VIOCGETAL\t\t_VICEIOCTL(2)\n#define VIOCSETTOK\t\t_VICEIOCTL(3)\n#define VIOCGETVOLSTAT\t\t_VICEIOCTL(4)\n#define VIOCSETVOLSTAT\t\t_VICEIOCTL(5)\n#define VIOCFLUSH\t\t_VICEIOCTL(6)\n#define VIOCGETTOK\t\t_VICEIOCTL(8)\n#define VIOCUNLOG\t\t_VICEIOCTL(9)\n#define VIOCCKSERV\t\t_VICEIOCTL(10)\n#define VIOCCKBACK\t\t_VICEIOCTL(11)\n#define VIOCCKCONN\t\t_VICEIOCTL(12)\n#define VIOCWHEREIS\t\t_VICEIOCTL(14)\n#define VIOCACCESS\t\t_VICEIOCTL(20)\n#define VIOCUNPAG\t\t_VICEIOCTL(21)\n#define VIOCGETFID\t\t_VICEIOCTL(22)\n#define VIOCSETCACHESIZE\t_VICEIOCTL(24)\n#define VIOCFLUSHCB\t\t_VICEIOCTL(25)\n#define VIOCNEWCELL\t\t_VICEIOCTL(26)\n#define VIOCGETCELL\t\t_VICEIOCTL(27)\n#define VIOC_AFS_DELETE_MT_PT\t_VICEIOCTL(28)\n#define VIOC_AFS_STAT_MT_PT\t_VICEIOCTL(29)\n#define VIOC_FILE_CELL_NAME\t_VICEIOCTL(30)\n#define VIOC_GET_WS_CELL\t_VICEIOCTL(31)\n#define VIOC_AFS_MARINER_HOST\t_VICEIOCTL(32)\n#define VIOC_GET_PRIMARY_CELL\t_VICEIOCTL(33)\n#define VIOC_VENUSLOG\t\t_VICEIOCTL(34)\n#define VIOC_GETCELLSTATUS\t_VICEIOCTL(35)\n#define VIOC_SETCELLSTATUS\t_VICEIOCTL(36)\n#define VIOC_FLUSHVOLUME\t_VICEIOCTL(37)\n#define VIOC_AFS_SYSNAME\t_VICEIOCTL(38)\n#define VIOC_EXPORTAFS\t\t_VICEIOCTL(39)\n#define VIOCGETCACHEPARAMS\t_VICEIOCTL(40)\n#define VIOC_GCPAGS\t\t_VICEIOCTL(48) \n\n#define VIOCGETTOK2\t\t_AFSCIOCTL(7)\n#define VIOCSETTOK2\t\t_AFSCIOCTL(8)\n\nstruct ViceIoctl {\n  caddr_t in, out;\n  short in_size;\n  short out_size;\n};\n\nstruct ClearToken {\n  int32_t AuthHandle;\n  char HandShakeKey[8];\n  int32_t ViceId;\n  int32_t BeginTimestamp;\n  int32_t EndTimestamp;\n};\n\n/* Use k_hasafs() to probe if the machine supports AFS syscalls.\n   The other functions will generate a SIGSYS if AFS is not supported */\n\nint k_hasafs (void);\nint k_hasafs_recheck (void);\n\nint krb_afslog (const char *cell, const char *realm);\nint krb_afslog_uid (const char *cell, const char *realm, uid_t uid);\nint krb_afslog_home (const char *cell, const char *realm,\n\t\t\t const char *homedir);\nint krb_afslog_uid_home (const char *cell, const char *realm, uid_t uid,\n\t\t\t     const char *homedir);\n\nint krb_realm_of_cell (const char *cell, char **realm);\n\n/* compat */\n#define k_afsklog krb_afslog\n#define k_afsklog_uid krb_afslog_uid\n\nint k_pioctl (char *a_path,\n\t\t  int o_opcode,\n\t\t  struct ViceIoctl *a_paramsP,\n\t\t  int a_followSymlinks);\nint k_unlog (void);\nint k_setpag (void);\nint k_afs_cell_of_file (const char *path, char *cell, int len);\n\n\n\n/* XXX */\n#ifdef KFAILURE\n#define KRB_H_INCLUDED\n#endif\n\n#ifdef KRB5_RECVAUTH_IGNORE_VERSION\n#define KRB5_H_INCLUDED\n#endif\n\nvoid kafs_set_verbose (void (*kafs_verbose)(void *, const char *), void *);\nint kafs_settoken_rxkad (const char *, struct ClearToken *,\n\t\t\t     void *ticket, size_t ticket_len);\n#ifdef KRB_H_INCLUDED\nint kafs_settoken (const char*, uid_t, CREDENTIALS*);\n#endif\n#ifdef KRB5_H_INCLUDED\nint kafs_settoken5 (krb5_context, const char*, uid_t, krb5_creds*);\n#endif\n\n\n#ifdef KRB5_H_INCLUDED\nkrb5_error_code krb5_afslog_uid (krb5_context context,\n\t\t\t\t     krb5_ccache id,\n\t\t\t\t     const char *cell,\n\t\t\t\t     krb5_const_realm realm,\n\t\t\t\t     uid_t uid);\nkrb5_error_code krb5_afslog (krb5_context context,\n\t\t\t\t krb5_ccache id, \n\t\t\t\t const char *cell,\n\t\t\t\t krb5_const_realm realm);\nkrb5_error_code krb5_afslog_uid_home (krb5_context context,\n\t\t\t\t\t  krb5_ccache id,\n\t\t\t\t\t  const char *cell,\n\t\t\t\t\t  krb5_const_realm realm,\n\t\t\t\t\t  uid_t uid,\n\t\t\t\t\t  const char *homedir);\n\nkrb5_error_code krb5_afslog_home (krb5_context context,\n\t\t\t\t      krb5_ccache id,\n\t\t\t\t      const char *cell,\n\t\t\t\t      krb5_const_realm realm,\n\t\t\t\t      const char *homedir);\n\nkrb5_error_code krb5_realm_of_cell (const char *cell, char **realm);\n\n#endif\n\n\n#define _PATH_VICE\t\t\"/usr/vice/etc/\"\n#define _PATH_THISCELL \t\t_PATH_VICE \"ThisCell\"\n#define _PATH_CELLSERVDB \t_PATH_VICE \"CellServDB\"\n#define _PATH_THESECELLS\t_PATH_VICE \"TheseCells\"\n\n#define _PATH_ARLA_VICE\t\t\"/usr/arla/etc/\"\n#define _PATH_ARLA_THISCELL\t_PATH_ARLA_VICE \"ThisCell\"\n#define _PATH_ARLA_CELLSERVDB \t_PATH_ARLA_VICE \"CellServDB\"\n#define _PATH_ARLA_THESECELLS\t_PATH_ARLA_VICE \"TheseCells\"\n\n#define _PATH_OPENAFS_DEBIAN_VICE\t\t\"/etc/openafs/\"\n#define _PATH_OPENAFS_DEBIAN_THISCELL\t\t_PATH_OPENAFS_DEBIAN_VICE \"ThisCell\"\n#define _PATH_OPENAFS_DEBIAN_CELLSERVDB \t_PATH_OPENAFS_DEBIAN_VICE \"CellServDB\"\n#define _PATH_OPENAFS_DEBIAN_THESECELLS\t\t_PATH_OPENAFS_DEBIAN_VICE \"TheseCells\"\n\n#define _PATH_OPENAFS_MACOSX_VICE\t\t\"/var/db/openafs/etc/\"\n#define _PATH_OPENAFS_MACOSX_THISCELL\t\t_PATH_OPENAFS_MACOSX_VICE \"ThisCell\"\n#define _PATH_OPENAFS_MACOSX_CELLSERVDB\t\t_PATH_OPENAFS_MACOSX_VICE \"CellServDB\"\n#define _PATH_OPENAFS_MACOSX_THESECELLS\t\t_PATH_OPENAFS_MACOSX_VICE \"TheseCells\"\n\n#define _PATH_ARLA_DEBIAN_VICE\t\t\t\"/etc/arla/\"\n#define _PATH_ARLA_DEBIAN_THISCELL\t\t_PATH_ARLA_DEBIAN_VICE \"ThisCell\"\n#define _PATH_ARLA_DEBIAN_CELLSERVDB\t\t_PATH_ARLA_DEBIAN_VICE \"CellServDB\"\n#define _PATH_ARLA_DEBIAN_THESECELLS\t\t_PATH_ARLA_DEBIAN_VICE \"TheseCells\"\n\n#define _PATH_ARLA_OPENBSD_VICE\t\t\t\"/etc/afs/\"\n#define _PATH_ARLA_OPENBSD_THISCELL\t\t_PATH_ARLA_OPENBSD_VICE \"ThisCell\"\n#define _PATH_ARLA_OPENBSD_CELLSERVDB\t\t_PATH_ARLA_OPENBSD_VICE \"CellServDB\"\n#define _PATH_ARLA_OPENBSD_THESECELLS\t\t_PATH_ARLA_OPENBSD_VICE \"TheseCells\"\n\nextern int _kafs_debug;\n\n#endif /* __KAFS_H */\n"
  },
  {
    "path": "freebsd-headers/kenv.h",
    "content": "/*-\n * Copyright (c) 2002 Maxime Henrion <mux@FreeBSD.org>\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/include/kenv.h 152750 2005-11-24 07:20:26Z ru $\n */\n\n#ifndef _KENV_H_\n#define _KENV_H_\n\n#include <sys/cdefs.h>\n#include <sys/kenv.h>\n\n__BEGIN_DECLS\nint kenv(int, const char *, char *, int);\n__END_DECLS\n\n#endif /* !_KENV_H_ */\n"
  },
  {
    "path": "freebsd-headers/krb5-protos.h",
    "content": "/* This is a generated file */\n#ifndef __krb5_protos_h__\n#define __krb5_protos_h__\n\n#include <stdarg.h>\n\n#if !defined(__GNUC__) && !defined(__attribute__)\n#define __attribute__(x)\n#endif\n\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\n#ifndef KRB5_LIB_FUNCTION\n#if defined(_WIN32)\n#define KRB5_LIB_FUNCTION _stdcall\n#else\n#define KRB5_LIB_FUNCTION\n#endif\n#endif\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb524_convert_creds_kdc (\n\tkrb5_context /*context*/,\n\tkrb5_creds */*in_cred*/,\n\tstruct credentials */*v4creds*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb524_convert_creds_kdc_ccache (\n\tkrb5_context /*context*/,\n\tkrb5_ccache /*ccache*/,\n\tkrb5_creds */*in_cred*/,\n\tstruct credentials */*v4creds*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_425_conv_principal (\n\tkrb5_context /*context*/,\n\tconst char */*name*/,\n\tconst char */*instance*/,\n\tconst char */*realm*/,\n\tkrb5_principal */*princ*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_425_conv_principal_ext (\n\tkrb5_context /*context*/,\n\tconst char */*name*/,\n\tconst char */*instance*/,\n\tconst char */*realm*/,\n\tkrb5_boolean (*/*func*/)(krb5_context, krb5_principal),\n\tkrb5_boolean /*resolve*/,\n\tkrb5_principal */*principal*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_425_conv_principal_ext2 (\n\tkrb5_context /*context*/,\n\tconst char */*name*/,\n\tconst char */*instance*/,\n\tconst char */*realm*/,\n\tkrb5_boolean (*/*func*/)(krb5_context, void *, krb5_principal),\n\tvoid */*funcctx*/,\n\tkrb5_boolean /*resolve*/,\n\tkrb5_principal */*princ*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_524_conv_principal (\n\tkrb5_context /*context*/,\n\tconst krb5_principal /*principal*/,\n\tchar */*name*/,\n\tchar */*instance*/,\n\tchar */*realm*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_abort (\n\tkrb5_context /*context*/,\n\tkrb5_error_code /*code*/,\n\tconst char */*fmt*/,\n\t...)\n    __attribute__ ((noreturn, format (printf, 3, 4)));\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_abortx (\n\tkrb5_context /*context*/,\n\tconst char */*fmt*/,\n\t...)\n    __attribute__ ((noreturn, format (printf, 2, 3)));\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_acl_match_file (\n\tkrb5_context /*context*/,\n\tconst char */*file*/,\n\tconst char */*format*/,\n\t...);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_acl_match_string (\n\tkrb5_context /*context*/,\n\tconst char */*string*/,\n\tconst char */*format*/,\n\t...);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_add_et_list (\n\tkrb5_context /*context*/,\n\tvoid (*/*func*/)(struct et_list **));\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_add_extra_addresses (\n\tkrb5_context /*context*/,\n\tkrb5_addresses */*addresses*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_add_ignore_addresses (\n\tkrb5_context /*context*/,\n\tkrb5_addresses */*addresses*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_addlog_dest (\n\tkrb5_context /*context*/,\n\tkrb5_log_facility */*f*/,\n\tconst char */*orig*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_addlog_func (\n\tkrb5_context /*context*/,\n\tkrb5_log_facility */*fac*/,\n\tint /*min*/,\n\tint /*max*/,\n\tkrb5_log_log_func_t /*log_func*/,\n\tkrb5_log_close_func_t /*close_func*/,\n\tvoid */*data*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_addr2sockaddr (\n\tkrb5_context /*context*/,\n\tconst krb5_address */*addr*/,\n\tstruct sockaddr */*sa*/,\n\tkrb5_socklen_t */*sa_size*/,\n\tint /*port*/);\n\nkrb5_boolean KRB5_LIB_FUNCTION\nkrb5_address_compare (\n\tkrb5_context /*context*/,\n\tconst krb5_address */*addr1*/,\n\tconst krb5_address */*addr2*/);\n\nint KRB5_LIB_FUNCTION\nkrb5_address_order (\n\tkrb5_context /*context*/,\n\tconst krb5_address */*addr1*/,\n\tconst krb5_address */*addr2*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_address_prefixlen_boundary (\n\tkrb5_context /*context*/,\n\tconst krb5_address */*inaddr*/,\n\tunsigned long /*prefixlen*/,\n\tkrb5_address */*low*/,\n\tkrb5_address */*high*/);\n\nkrb5_boolean KRB5_LIB_FUNCTION\nkrb5_address_search (\n\tkrb5_context /*context*/,\n\tconst krb5_address */*addr*/,\n\tconst krb5_addresses */*addrlist*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_aname_to_localname (\n\tkrb5_context /*context*/,\n\tkrb5_const_principal /*aname*/,\n\tsize_t /*lnsize*/,\n\tchar */*lname*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_anyaddr (\n\tkrb5_context /*context*/,\n\tint /*af*/,\n\tstruct sockaddr */*sa*/,\n\tkrb5_socklen_t */*sa_size*/,\n\tint /*port*/);\n\nvoid KRB5_LIB_FUNCTION\nkrb5_appdefault_boolean (\n\tkrb5_context /*context*/,\n\tconst char */*appname*/,\n\tkrb5_const_realm /*realm*/,\n\tconst char */*option*/,\n\tkrb5_boolean /*def_val*/,\n\tkrb5_boolean */*ret_val*/);\n\nvoid KRB5_LIB_FUNCTION\nkrb5_appdefault_string (\n\tkrb5_context /*context*/,\n\tconst char */*appname*/,\n\tkrb5_const_realm /*realm*/,\n\tconst char */*option*/,\n\tconst char */*def_val*/,\n\tchar **/*ret_val*/);\n\nvoid KRB5_LIB_FUNCTION\nkrb5_appdefault_time (\n\tkrb5_context /*context*/,\n\tconst char */*appname*/,\n\tkrb5_const_realm /*realm*/,\n\tconst char */*option*/,\n\ttime_t /*def_val*/,\n\ttime_t */*ret_val*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_append_addresses (\n\tkrb5_context /*context*/,\n\tkrb5_addresses */*dest*/,\n\tconst krb5_addresses */*source*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_auth_con_addflags (\n\tkrb5_context /*context*/,\n\tkrb5_auth_context /*auth_context*/,\n\tint32_t /*addflags*/,\n\tint32_t */*flags*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_auth_con_free (\n\tkrb5_context /*context*/,\n\tkrb5_auth_context /*auth_context*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_auth_con_genaddrs (\n\tkrb5_context /*context*/,\n\tkrb5_auth_context /*auth_context*/,\n\tint /*fd*/,\n\tint /*flags*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_auth_con_generatelocalsubkey (\n\tkrb5_context /*context*/,\n\tkrb5_auth_context /*auth_context*/,\n\tkrb5_keyblock */*key*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_auth_con_getaddrs (\n\tkrb5_context /*context*/,\n\tkrb5_auth_context /*auth_context*/,\n\tkrb5_address **/*local_addr*/,\n\tkrb5_address **/*remote_addr*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_auth_con_getauthenticator (\n\tkrb5_context /*context*/,\n\tkrb5_auth_context /*auth_context*/,\n\tkrb5_authenticator */*authenticator*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_auth_con_getcksumtype (\n\tkrb5_context /*context*/,\n\tkrb5_auth_context /*auth_context*/,\n\tkrb5_cksumtype */*cksumtype*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_auth_con_getflags (\n\tkrb5_context /*context*/,\n\tkrb5_auth_context /*auth_context*/,\n\tint32_t */*flags*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_auth_con_getkey (\n\tkrb5_context /*context*/,\n\tkrb5_auth_context /*auth_context*/,\n\tkrb5_keyblock **/*keyblock*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_auth_con_getkeytype (\n\tkrb5_context /*context*/,\n\tkrb5_auth_context /*auth_context*/,\n\tkrb5_keytype */*keytype*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_auth_con_getlocalseqnumber (\n\tkrb5_context /*context*/,\n\tkrb5_auth_context /*auth_context*/,\n\tint32_t */*seqnumber*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_auth_con_getlocalsubkey (\n\tkrb5_context /*context*/,\n\tkrb5_auth_context /*auth_context*/,\n\tkrb5_keyblock **/*keyblock*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_auth_con_getrcache (\n\tkrb5_context /*context*/,\n\tkrb5_auth_context /*auth_context*/,\n\tkrb5_rcache */*rcache*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_auth_con_getremotesubkey (\n\tkrb5_context /*context*/,\n\tkrb5_auth_context /*auth_context*/,\n\tkrb5_keyblock **/*keyblock*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_auth_con_init (\n\tkrb5_context /*context*/,\n\tkrb5_auth_context */*auth_context*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_auth_con_removeflags (\n\tkrb5_context /*context*/,\n\tkrb5_auth_context /*auth_context*/,\n\tint32_t /*removeflags*/,\n\tint32_t */*flags*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_auth_con_setaddrs (\n\tkrb5_context /*context*/,\n\tkrb5_auth_context /*auth_context*/,\n\tkrb5_address */*local_addr*/,\n\tkrb5_address */*remote_addr*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_auth_con_setaddrs_from_fd (\n\tkrb5_context /*context*/,\n\tkrb5_auth_context /*auth_context*/,\n\tvoid */*p_fd*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_auth_con_setcksumtype (\n\tkrb5_context /*context*/,\n\tkrb5_auth_context /*auth_context*/,\n\tkrb5_cksumtype /*cksumtype*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_auth_con_setflags (\n\tkrb5_context /*context*/,\n\tkrb5_auth_context /*auth_context*/,\n\tint32_t /*flags*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_auth_con_setkey (\n\tkrb5_context /*context*/,\n\tkrb5_auth_context /*auth_context*/,\n\tkrb5_keyblock */*keyblock*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_auth_con_setkeytype (\n\tkrb5_context /*context*/,\n\tkrb5_auth_context /*auth_context*/,\n\tkrb5_keytype /*keytype*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_auth_con_setlocalseqnumber (\n\tkrb5_context /*context*/,\n\tkrb5_auth_context /*auth_context*/,\n\tint32_t /*seqnumber*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_auth_con_setlocalsubkey (\n\tkrb5_context /*context*/,\n\tkrb5_auth_context /*auth_context*/,\n\tkrb5_keyblock */*keyblock*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_auth_con_setrcache (\n\tkrb5_context /*context*/,\n\tkrb5_auth_context /*auth_context*/,\n\tkrb5_rcache /*rcache*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_auth_con_setremoteseqnumber (\n\tkrb5_context /*context*/,\n\tkrb5_auth_context /*auth_context*/,\n\tint32_t /*seqnumber*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_auth_con_setremotesubkey (\n\tkrb5_context /*context*/,\n\tkrb5_auth_context /*auth_context*/,\n\tkrb5_keyblock */*keyblock*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_auth_con_setuserkey (\n\tkrb5_context /*context*/,\n\tkrb5_auth_context /*auth_context*/,\n\tkrb5_keyblock */*keyblock*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_auth_getremoteseqnumber (\n\tkrb5_context /*context*/,\n\tkrb5_auth_context /*auth_context*/,\n\tint32_t */*seqnumber*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_build_ap_req (\n\tkrb5_context /*context*/,\n\tkrb5_enctype /*enctype*/,\n\tkrb5_creds */*cred*/,\n\tkrb5_flags /*ap_options*/,\n\tkrb5_data /*authenticator*/,\n\tkrb5_data */*retdata*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_build_authenticator (\n\tkrb5_context /*context*/,\n\tkrb5_auth_context /*auth_context*/,\n\tkrb5_enctype /*enctype*/,\n\tkrb5_creds */*cred*/,\n\tChecksum */*cksum*/,\n\tAuthenticator **/*auth_result*/,\n\tkrb5_data */*result*/,\n\tkrb5_key_usage /*usage*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_build_principal (\n\tkrb5_context /*context*/,\n\tkrb5_principal */*principal*/,\n\tint /*rlen*/,\n\tkrb5_const_realm /*realm*/,\n\t...);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_build_principal_ext (\n\tkrb5_context /*context*/,\n\tkrb5_principal */*principal*/,\n\tint /*rlen*/,\n\tkrb5_const_realm /*realm*/,\n\t...);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_build_principal_va (\n\tkrb5_context /*context*/,\n\tkrb5_principal */*principal*/,\n\tint /*rlen*/,\n\tkrb5_const_realm /*realm*/,\n\tva_list /*ap*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_build_principal_va_ext (\n\tkrb5_context /*context*/,\n\tkrb5_principal */*principal*/,\n\tint /*rlen*/,\n\tkrb5_const_realm /*realm*/,\n\tva_list /*ap*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_c_block_size (\n\tkrb5_context /*context*/,\n\tkrb5_enctype /*enctype*/,\n\tsize_t */*blocksize*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_c_checksum_length (\n\tkrb5_context /*context*/,\n\tkrb5_cksumtype /*cksumtype*/,\n\tsize_t */*length*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_c_decrypt (\n\tkrb5_context /*context*/,\n\tconst krb5_keyblock /*key*/,\n\tkrb5_keyusage /*usage*/,\n\tconst krb5_data */*ivec*/,\n\tkrb5_enc_data */*input*/,\n\tkrb5_data */*output*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_c_encrypt (\n\tkrb5_context /*context*/,\n\tconst krb5_keyblock */*key*/,\n\tkrb5_keyusage /*usage*/,\n\tconst krb5_data */*ivec*/,\n\tconst krb5_data */*input*/,\n\tkrb5_enc_data */*output*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_c_encrypt_length (\n\tkrb5_context /*context*/,\n\tkrb5_enctype /*enctype*/,\n\tsize_t /*inputlen*/,\n\tsize_t */*length*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_c_enctype_compare (\n\tkrb5_context /*context*/,\n\tkrb5_enctype /*e1*/,\n\tkrb5_enctype /*e2*/,\n\tkrb5_boolean */*similar*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_c_get_checksum (\n\tkrb5_context /*context*/,\n\tconst krb5_checksum */*cksum*/,\n\tkrb5_cksumtype */*type*/,\n\tkrb5_data **/*data*/);\n\nkrb5_boolean KRB5_LIB_FUNCTION\nkrb5_c_is_coll_proof_cksum (krb5_cksumtype /*ctype*/);\n\nkrb5_boolean KRB5_LIB_FUNCTION\nkrb5_c_is_keyed_cksum (krb5_cksumtype /*ctype*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_c_keylengths (\n\tkrb5_context /*context*/,\n\tkrb5_enctype /*enctype*/,\n\tsize_t */*ilen*/,\n\tsize_t */*keylen*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_c_make_checksum (\n\tkrb5_context /*context*/,\n\tkrb5_cksumtype /*cksumtype*/,\n\tconst krb5_keyblock */*key*/,\n\tkrb5_keyusage /*usage*/,\n\tconst krb5_data */*input*/,\n\tkrb5_checksum */*cksum*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_c_make_random_key (\n\tkrb5_context /*context*/,\n\tkrb5_enctype /*enctype*/,\n\tkrb5_keyblock */*random_key*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_c_prf (\n\tkrb5_context /*context*/,\n\tconst krb5_keyblock */*key*/,\n\tconst krb5_data */*input*/,\n\tkrb5_data */*output*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_c_prf_length (\n\tkrb5_context /*context*/,\n\tkrb5_enctype /*type*/,\n\tsize_t */*length*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_c_set_checksum (\n\tkrb5_context /*context*/,\n\tkrb5_checksum */*cksum*/,\n\tkrb5_cksumtype /*type*/,\n\tconst krb5_data */*data*/);\n\nkrb5_boolean KRB5_LIB_FUNCTION\nkrb5_c_valid_cksumtype (krb5_cksumtype /*ctype*/);\n\nkrb5_boolean KRB5_LIB_FUNCTION\nkrb5_c_valid_enctype (krb5_enctype /*etype*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_c_verify_checksum (\n\tkrb5_context /*context*/,\n\tconst krb5_keyblock */*key*/,\n\tkrb5_keyusage /*usage*/,\n\tconst krb5_data */*data*/,\n\tconst krb5_checksum */*cksum*/,\n\tkrb5_boolean */*valid*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_cc_cache_end_seq_get (\n\tkrb5_context /*context*/,\n\tkrb5_cc_cache_cursor /*cursor*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_cc_cache_get_first (\n\tkrb5_context /*context*/,\n\tconst char */*type*/,\n\tkrb5_cc_cache_cursor */*cursor*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_cc_cache_match (\n\tkrb5_context /*context*/,\n\tkrb5_principal /*client*/,\n\tconst char */*type*/,\n\tkrb5_ccache */*id*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_cc_cache_next (\n\tkrb5_context /*context*/,\n\tkrb5_cc_cache_cursor /*cursor*/,\n\tkrb5_ccache */*id*/);\n\nvoid KRB5_LIB_FUNCTION\nkrb5_cc_clear_mcred (krb5_creds */*mcred*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_cc_close (\n\tkrb5_context /*context*/,\n\tkrb5_ccache /*id*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_cc_copy_cache (\n\tkrb5_context /*context*/,\n\tconst krb5_ccache /*from*/,\n\tkrb5_ccache /*to*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_cc_copy_cache_match (\n\tkrb5_context /*context*/,\n\tconst krb5_ccache /*from*/,\n\tkrb5_ccache /*to*/,\n\tkrb5_flags /*whichfields*/,\n\tconst krb5_creds * /*mcreds*/,\n\tunsigned int */*matched*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_cc_default (\n\tkrb5_context /*context*/,\n\tkrb5_ccache */*id*/);\n\nconst char* KRB5_LIB_FUNCTION\nkrb5_cc_default_name (krb5_context /*context*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_cc_destroy (\n\tkrb5_context /*context*/,\n\tkrb5_ccache /*id*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_cc_end_seq_get (\n\tkrb5_context /*context*/,\n\tconst krb5_ccache /*id*/,\n\tkrb5_cc_cursor */*cursor*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_cc_gen_new (\n\tkrb5_context /*context*/,\n\tconst krb5_cc_ops */*ops*/,\n\tkrb5_ccache */*id*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_cc_get_full_name (\n\tkrb5_context /*context*/,\n\tkrb5_ccache /*id*/,\n\tchar **/*str*/);\n\nconst char* KRB5_LIB_FUNCTION\nkrb5_cc_get_name (\n\tkrb5_context /*context*/,\n\tkrb5_ccache /*id*/);\n\nconst krb5_cc_ops *\nkrb5_cc_get_ops (\n\tkrb5_context /*context*/,\n\tkrb5_ccache /*id*/);\n\nconst krb5_cc_ops *\nkrb5_cc_get_prefix_ops (\n\tkrb5_context /*context*/,\n\tconst char */*prefix*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_cc_get_principal (\n\tkrb5_context /*context*/,\n\tkrb5_ccache /*id*/,\n\tkrb5_principal */*principal*/);\n\nconst char* KRB5_LIB_FUNCTION\nkrb5_cc_get_type (\n\tkrb5_context /*context*/,\n\tkrb5_ccache /*id*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_cc_get_version (\n\tkrb5_context /*context*/,\n\tconst krb5_ccache /*id*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_cc_initialize (\n\tkrb5_context /*context*/,\n\tkrb5_ccache /*id*/,\n\tkrb5_principal /*primary_principal*/);\n\nkrb5_error_code\nkrb5_cc_move (\n\tkrb5_context /*context*/,\n\tkrb5_ccache /*from*/,\n\tkrb5_ccache /*to*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_cc_new_unique (\n\tkrb5_context /*context*/,\n\tconst char */*type*/,\n\tconst char */*hint*/,\n\tkrb5_ccache */*id*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_cc_next_cred (\n\tkrb5_context /*context*/,\n\tconst krb5_ccache /*id*/,\n\tkrb5_cc_cursor */*cursor*/,\n\tkrb5_creds */*creds*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_cc_next_cred_match (\n\tkrb5_context /*context*/,\n\tconst krb5_ccache /*id*/,\n\tkrb5_cc_cursor * /*cursor*/,\n\tkrb5_creds * /*creds*/,\n\tkrb5_flags /*whichfields*/,\n\tconst krb5_creds * /*mcreds*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_cc_register (\n\tkrb5_context /*context*/,\n\tconst krb5_cc_ops */*ops*/,\n\tkrb5_boolean /*override*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_cc_remove_cred (\n\tkrb5_context /*context*/,\n\tkrb5_ccache /*id*/,\n\tkrb5_flags /*which*/,\n\tkrb5_creds */*cred*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_cc_resolve (\n\tkrb5_context /*context*/,\n\tconst char */*name*/,\n\tkrb5_ccache */*id*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_cc_retrieve_cred (\n\tkrb5_context /*context*/,\n\tkrb5_ccache /*id*/,\n\tkrb5_flags /*whichfields*/,\n\tconst krb5_creds */*mcreds*/,\n\tkrb5_creds */*creds*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_cc_set_default_name (\n\tkrb5_context /*context*/,\n\tconst char */*name*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_cc_set_flags (\n\tkrb5_context /*context*/,\n\tkrb5_ccache /*id*/,\n\tkrb5_flags /*flags*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_cc_start_seq_get (\n\tkrb5_context /*context*/,\n\tconst krb5_ccache /*id*/,\n\tkrb5_cc_cursor */*cursor*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_cc_store_cred (\n\tkrb5_context /*context*/,\n\tkrb5_ccache /*id*/,\n\tkrb5_creds */*creds*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_change_password (\n\tkrb5_context /*context*/,\n\tkrb5_creds */*creds*/,\n\tconst char */*newpw*/,\n\tint */*result_code*/,\n\tkrb5_data */*result_code_string*/,\n\tkrb5_data */*result_string*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_check_transited (\n\tkrb5_context /*context*/,\n\tkrb5_const_realm /*client_realm*/,\n\tkrb5_const_realm /*server_realm*/,\n\tkrb5_realm */*realms*/,\n\tint /*num_realms*/,\n\tint */*bad_realm*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_check_transited_realms (\n\tkrb5_context /*context*/,\n\tconst char *const */*realms*/,\n\tint /*num_realms*/,\n\tint */*bad_realm*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_checksum_disable (\n\tkrb5_context /*context*/,\n\tkrb5_cksumtype /*type*/);\n\nvoid KRB5_LIB_FUNCTION\nkrb5_checksum_free (\n\tkrb5_context /*context*/,\n\tkrb5_checksum */*cksum*/);\n\nkrb5_boolean KRB5_LIB_FUNCTION\nkrb5_checksum_is_collision_proof (\n\tkrb5_context /*context*/,\n\tkrb5_cksumtype /*type*/);\n\nkrb5_boolean KRB5_LIB_FUNCTION\nkrb5_checksum_is_keyed (\n\tkrb5_context /*context*/,\n\tkrb5_cksumtype /*type*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_checksumsize (\n\tkrb5_context /*context*/,\n\tkrb5_cksumtype /*type*/,\n\tsize_t */*size*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_cksumtype_valid (\n\tkrb5_context /*context*/,\n\tkrb5_cksumtype /*ctype*/);\n\nvoid KRB5_LIB_FUNCTION\nkrb5_clear_error_string (krb5_context /*context*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_closelog (\n\tkrb5_context /*context*/,\n\tkrb5_log_facility */*fac*/);\n\nkrb5_boolean KRB5_LIB_FUNCTION\nkrb5_compare_creds (\n\tkrb5_context /*context*/,\n\tkrb5_flags /*whichfields*/,\n\tconst krb5_creds * /*mcreds*/,\n\tconst krb5_creds * /*creds*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_config_file_free (\n\tkrb5_context /*context*/,\n\tkrb5_config_section */*s*/);\n\nvoid KRB5_LIB_FUNCTION\nkrb5_config_free_strings (char **/*strings*/);\n\nconst void *\nkrb5_config_get (\n\tkrb5_context /*context*/,\n\tconst krb5_config_section */*c*/,\n\tint /*type*/,\n\t...);\n\nkrb5_boolean KRB5_LIB_FUNCTION\nkrb5_config_get_bool (\n\tkrb5_context /*context*/,\n\tconst krb5_config_section */*c*/,\n\t...);\n\nkrb5_boolean KRB5_LIB_FUNCTION\nkrb5_config_get_bool_default (\n\tkrb5_context /*context*/,\n\tconst krb5_config_section */*c*/,\n\tkrb5_boolean /*def_value*/,\n\t...);\n\nint KRB5_LIB_FUNCTION\nkrb5_config_get_int (\n\tkrb5_context /*context*/,\n\tconst krb5_config_section */*c*/,\n\t...);\n\nint KRB5_LIB_FUNCTION\nkrb5_config_get_int_default (\n\tkrb5_context /*context*/,\n\tconst krb5_config_section */*c*/,\n\tint /*def_value*/,\n\t...);\n\nconst krb5_config_binding *\nkrb5_config_get_list (\n\tkrb5_context /*context*/,\n\tconst krb5_config_section */*c*/,\n\t...);\n\nconst void *\nkrb5_config_get_next (\n\tkrb5_context /*context*/,\n\tconst krb5_config_section */*c*/,\n\tconst krb5_config_binding **/*pointer*/,\n\tint /*type*/,\n\t...);\n\nconst char* KRB5_LIB_FUNCTION\nkrb5_config_get_string (\n\tkrb5_context /*context*/,\n\tconst krb5_config_section */*c*/,\n\t...);\n\nconst char* KRB5_LIB_FUNCTION\nkrb5_config_get_string_default (\n\tkrb5_context /*context*/,\n\tconst krb5_config_section */*c*/,\n\tconst char */*def_value*/,\n\t...);\n\nchar**\nkrb5_config_get_strings (\n\tkrb5_context /*context*/,\n\tconst krb5_config_section */*c*/,\n\t...);\n\nint KRB5_LIB_FUNCTION\nkrb5_config_get_time (\n\tkrb5_context /*context*/,\n\tconst krb5_config_section */*c*/,\n\t...);\n\nint KRB5_LIB_FUNCTION\nkrb5_config_get_time_default (\n\tkrb5_context /*context*/,\n\tconst krb5_config_section */*c*/,\n\tint /*def_value*/,\n\t...);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_config_parse_file (\n\tkrb5_context /*context*/,\n\tconst char */*fname*/,\n\tkrb5_config_section **/*res*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_config_parse_file_multi (\n\tkrb5_context /*context*/,\n\tconst char */*fname*/,\n\tkrb5_config_section **/*res*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_config_parse_string_multi (\n\tkrb5_context /*context*/,\n\tconst char */*string*/,\n\tkrb5_config_section **/*res*/);\n\nconst void *\nkrb5_config_vget (\n\tkrb5_context /*context*/,\n\tconst krb5_config_section */*c*/,\n\tint /*type*/,\n\tva_list /*args*/);\n\nkrb5_boolean KRB5_LIB_FUNCTION\nkrb5_config_vget_bool (\n\tkrb5_context /*context*/,\n\tconst krb5_config_section */*c*/,\n\tva_list /*args*/);\n\nkrb5_boolean KRB5_LIB_FUNCTION\nkrb5_config_vget_bool_default (\n\tkrb5_context /*context*/,\n\tconst krb5_config_section */*c*/,\n\tkrb5_boolean /*def_value*/,\n\tva_list /*args*/);\n\nint KRB5_LIB_FUNCTION\nkrb5_config_vget_int (\n\tkrb5_context /*context*/,\n\tconst krb5_config_section */*c*/,\n\tva_list /*args*/);\n\nint KRB5_LIB_FUNCTION\nkrb5_config_vget_int_default (\n\tkrb5_context /*context*/,\n\tconst krb5_config_section */*c*/,\n\tint /*def_value*/,\n\tva_list /*args*/);\n\nconst krb5_config_binding *\nkrb5_config_vget_list (\n\tkrb5_context /*context*/,\n\tconst krb5_config_section */*c*/,\n\tva_list /*args*/);\n\nconst void *\nkrb5_config_vget_next (\n\tkrb5_context /*context*/,\n\tconst krb5_config_section */*c*/,\n\tconst krb5_config_binding **/*pointer*/,\n\tint /*type*/,\n\tva_list /*args*/);\n\nconst char* KRB5_LIB_FUNCTION\nkrb5_config_vget_string (\n\tkrb5_context /*context*/,\n\tconst krb5_config_section */*c*/,\n\tva_list /*args*/);\n\nconst char* KRB5_LIB_FUNCTION\nkrb5_config_vget_string_default (\n\tkrb5_context /*context*/,\n\tconst krb5_config_section */*c*/,\n\tconst char */*def_value*/,\n\tva_list /*args*/);\n\nchar ** KRB5_LIB_FUNCTION\nkrb5_config_vget_strings (\n\tkrb5_context /*context*/,\n\tconst krb5_config_section */*c*/,\n\tva_list /*args*/);\n\nint KRB5_LIB_FUNCTION\nkrb5_config_vget_time (\n\tkrb5_context /*context*/,\n\tconst krb5_config_section */*c*/,\n\tva_list /*args*/);\n\nint KRB5_LIB_FUNCTION\nkrb5_config_vget_time_default (\n\tkrb5_context /*context*/,\n\tconst krb5_config_section */*c*/,\n\tint /*def_value*/,\n\tva_list /*args*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_copy_address (\n\tkrb5_context /*context*/,\n\tconst krb5_address */*inaddr*/,\n\tkrb5_address */*outaddr*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_copy_addresses (\n\tkrb5_context /*context*/,\n\tconst krb5_addresses */*inaddr*/,\n\tkrb5_addresses */*outaddr*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_copy_checksum (\n\tkrb5_context /*context*/,\n\tconst krb5_checksum */*old*/,\n\tkrb5_checksum **/*new*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_copy_creds (\n\tkrb5_context /*context*/,\n\tconst krb5_creds */*incred*/,\n\tkrb5_creds **/*outcred*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_copy_creds_contents (\n\tkrb5_context /*context*/,\n\tconst krb5_creds */*incred*/,\n\tkrb5_creds */*c*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_copy_data (\n\tkrb5_context /*context*/,\n\tconst krb5_data */*indata*/,\n\tkrb5_data **/*outdata*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_copy_host_realm (\n\tkrb5_context /*context*/,\n\tconst krb5_realm */*from*/,\n\tkrb5_realm **/*to*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_copy_keyblock (\n\tkrb5_context /*context*/,\n\tconst krb5_keyblock */*inblock*/,\n\tkrb5_keyblock **/*to*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_copy_keyblock_contents (\n\tkrb5_context /*context*/,\n\tconst krb5_keyblock */*inblock*/,\n\tkrb5_keyblock */*to*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_copy_principal (\n\tkrb5_context /*context*/,\n\tkrb5_const_principal /*inprinc*/,\n\tkrb5_principal */*outprinc*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_copy_ticket (\n\tkrb5_context /*context*/,\n\tconst krb5_ticket */*from*/,\n\tkrb5_ticket **/*to*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_create_checksum (\n\tkrb5_context /*context*/,\n\tkrb5_crypto /*crypto*/,\n\tkrb5_key_usage /*usage*/,\n\tint /*type*/,\n\tvoid */*data*/,\n\tsize_t /*len*/,\n\tChecksum */*result*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_crypto_destroy (\n\tkrb5_context /*context*/,\n\tkrb5_crypto /*crypto*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_crypto_get_checksum_type (\n\tkrb5_context /*context*/,\n\tkrb5_crypto /*crypto*/,\n\tkrb5_cksumtype */*type*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_crypto_getblocksize (\n\tkrb5_context /*context*/,\n\tkrb5_crypto /*crypto*/,\n\tsize_t */*blocksize*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_crypto_getconfoundersize (\n\tkrb5_context /*context*/,\n\tkrb5_crypto /*crypto*/,\n\tsize_t */*confoundersize*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_crypto_getenctype (\n\tkrb5_context /*context*/,\n\tkrb5_crypto /*crypto*/,\n\tkrb5_enctype */*enctype*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_crypto_getpadsize (\n\tkrb5_context /*context*/,\n\tkrb5_crypto /*crypto*/,\n\tsize_t */*padsize*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_crypto_init (\n\tkrb5_context /*context*/,\n\tconst krb5_keyblock */*key*/,\n\tkrb5_enctype /*etype*/,\n\tkrb5_crypto */*crypto*/);\n\nsize_t\nkrb5_crypto_overhead (\n\tkrb5_context /*context*/,\n\tkrb5_crypto /*crypto*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_crypto_prf (\n\tkrb5_context /*context*/,\n\tconst krb5_crypto /*crypto*/,\n\tconst krb5_data */*input*/,\n\tkrb5_data */*output*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_crypto_prf_length (\n\tkrb5_context /*context*/,\n\tkrb5_enctype /*type*/,\n\tsize_t */*length*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_data_alloc (\n\tkrb5_data */*p*/,\n\tint /*len*/);\n\nint KRB5_LIB_FUNCTION\nkrb5_data_cmp (\n\tconst krb5_data */*data1*/,\n\tconst krb5_data */*data2*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_data_copy (\n\tkrb5_data */*p*/,\n\tconst void */*data*/,\n\tsize_t /*len*/);\n\nvoid KRB5_LIB_FUNCTION\nkrb5_data_free (krb5_data */*p*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_data_realloc (\n\tkrb5_data */*p*/,\n\tint /*len*/);\n\nvoid KRB5_LIB_FUNCTION\nkrb5_data_zero (krb5_data */*p*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_decode_Authenticator (\n\tkrb5_context /*context*/,\n\tconst void */*data*/,\n\tsize_t /*length*/,\n\tAuthenticator */*t*/,\n\tsize_t */*len*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_decode_ETYPE_INFO (\n\tkrb5_context /*context*/,\n\tconst void */*data*/,\n\tsize_t /*length*/,\n\tETYPE_INFO */*t*/,\n\tsize_t */*len*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_decode_ETYPE_INFO2 (\n\tkrb5_context /*context*/,\n\tconst void */*data*/,\n\tsize_t /*length*/,\n\tETYPE_INFO2 */*t*/,\n\tsize_t */*len*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_decode_EncAPRepPart (\n\tkrb5_context /*context*/,\n\tconst void */*data*/,\n\tsize_t /*length*/,\n\tEncAPRepPart */*t*/,\n\tsize_t */*len*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_decode_EncASRepPart (\n\tkrb5_context /*context*/,\n\tconst void */*data*/,\n\tsize_t /*length*/,\n\tEncASRepPart */*t*/,\n\tsize_t */*len*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_decode_EncKrbCredPart (\n\tkrb5_context /*context*/,\n\tconst void */*data*/,\n\tsize_t /*length*/,\n\tEncKrbCredPart */*t*/,\n\tsize_t */*len*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_decode_EncTGSRepPart (\n\tkrb5_context /*context*/,\n\tconst void */*data*/,\n\tsize_t /*length*/,\n\tEncTGSRepPart */*t*/,\n\tsize_t */*len*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_decode_EncTicketPart (\n\tkrb5_context /*context*/,\n\tconst void */*data*/,\n\tsize_t /*length*/,\n\tEncTicketPart */*t*/,\n\tsize_t */*len*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_decode_ap_req (\n\tkrb5_context /*context*/,\n\tconst krb5_data */*inbuf*/,\n\tkrb5_ap_req */*ap_req*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_decrypt (\n\tkrb5_context /*context*/,\n\tkrb5_crypto /*crypto*/,\n\tunsigned /*usage*/,\n\tvoid */*data*/,\n\tsize_t /*len*/,\n\tkrb5_data */*result*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_decrypt_EncryptedData (\n\tkrb5_context /*context*/,\n\tkrb5_crypto /*crypto*/,\n\tunsigned /*usage*/,\n\tconst EncryptedData */*e*/,\n\tkrb5_data */*result*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_decrypt_ivec (\n\tkrb5_context /*context*/,\n\tkrb5_crypto /*crypto*/,\n\tunsigned /*usage*/,\n\tvoid */*data*/,\n\tsize_t /*len*/,\n\tkrb5_data */*result*/,\n\tvoid */*ivec*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_decrypt_ticket (\n\tkrb5_context /*context*/,\n\tTicket */*ticket*/,\n\tkrb5_keyblock */*key*/,\n\tEncTicketPart */*out*/,\n\tkrb5_flags /*flags*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_derive_key (\n\tkrb5_context /*context*/,\n\tconst krb5_keyblock */*key*/,\n\tkrb5_enctype /*etype*/,\n\tconst void */*constant*/,\n\tsize_t /*constant_len*/,\n\tkrb5_keyblock **/*derived_key*/);\n\nkrb5_error_code\nkrb5_digest_alloc (\n\tkrb5_context /*context*/,\n\tkrb5_digest */*digest*/);\n\nvoid\nkrb5_digest_free (krb5_digest /*digest*/);\n\nkrb5_error_code\nkrb5_digest_get_client_binding (\n\tkrb5_context /*context*/,\n\tkrb5_digest /*digest*/,\n\tchar **/*type*/,\n\tchar **/*binding*/);\n\nconst char *\nkrb5_digest_get_identifier (\n\tkrb5_context /*context*/,\n\tkrb5_digest /*digest*/);\n\nconst char *\nkrb5_digest_get_opaque (\n\tkrb5_context /*context*/,\n\tkrb5_digest /*digest*/);\n\nconst char *\nkrb5_digest_get_rsp (\n\tkrb5_context /*context*/,\n\tkrb5_digest /*digest*/);\n\nconst char *\nkrb5_digest_get_server_nonce (\n\tkrb5_context /*context*/,\n\tkrb5_digest /*digest*/);\n\nkrb5_error_code\nkrb5_digest_get_session_key (\n\tkrb5_context /*context*/,\n\tkrb5_digest /*digest*/,\n\tkrb5_data */*data*/);\n\nkrb5_error_code\nkrb5_digest_get_tickets (\n\tkrb5_context /*context*/,\n\tkrb5_digest /*digest*/,\n\tTicket **/*tickets*/);\n\nkrb5_error_code\nkrb5_digest_init_request (\n\tkrb5_context /*context*/,\n\tkrb5_digest /*digest*/,\n\tkrb5_realm /*realm*/,\n\tkrb5_ccache /*ccache*/);\n\nkrb5_error_code\nkrb5_digest_probe (\n\tkrb5_context /*context*/,\n\tkrb5_realm /*realm*/,\n\tkrb5_ccache /*ccache*/,\n\tunsigned */*flags*/);\n\nkrb5_boolean\nkrb5_digest_rep_get_status (\n\tkrb5_context /*context*/,\n\tkrb5_digest /*digest*/);\n\nkrb5_error_code\nkrb5_digest_request (\n\tkrb5_context /*context*/,\n\tkrb5_digest /*digest*/,\n\tkrb5_realm /*realm*/,\n\tkrb5_ccache /*ccache*/);\n\nkrb5_error_code\nkrb5_digest_set_authentication_user (\n\tkrb5_context /*context*/,\n\tkrb5_digest /*digest*/,\n\tkrb5_principal /*authentication_user*/);\n\nkrb5_error_code\nkrb5_digest_set_authid (\n\tkrb5_context /*context*/,\n\tkrb5_digest /*digest*/,\n\tconst char */*authid*/);\n\nkrb5_error_code\nkrb5_digest_set_client_nonce (\n\tkrb5_context /*context*/,\n\tkrb5_digest /*digest*/,\n\tconst char */*nonce*/);\n\nkrb5_error_code\nkrb5_digest_set_digest (\n\tkrb5_context /*context*/,\n\tkrb5_digest /*digest*/,\n\tconst char */*dgst*/);\n\nkrb5_error_code\nkrb5_digest_set_hostname (\n\tkrb5_context /*context*/,\n\tkrb5_digest /*digest*/,\n\tconst char */*hostname*/);\n\nkrb5_error_code\nkrb5_digest_set_identifier (\n\tkrb5_context /*context*/,\n\tkrb5_digest /*digest*/,\n\tconst char */*id*/);\n\nkrb5_error_code\nkrb5_digest_set_method (\n\tkrb5_context /*context*/,\n\tkrb5_digest /*digest*/,\n\tconst char */*method*/);\n\nkrb5_error_code\nkrb5_digest_set_nonceCount (\n\tkrb5_context /*context*/,\n\tkrb5_digest /*digest*/,\n\tconst char */*nonce_count*/);\n\nkrb5_error_code\nkrb5_digest_set_opaque (\n\tkrb5_context /*context*/,\n\tkrb5_digest /*digest*/,\n\tconst char */*opaque*/);\n\nkrb5_error_code\nkrb5_digest_set_qop (\n\tkrb5_context /*context*/,\n\tkrb5_digest /*digest*/,\n\tconst char */*qop*/);\n\nkrb5_error_code\nkrb5_digest_set_realm (\n\tkrb5_context /*context*/,\n\tkrb5_digest /*digest*/,\n\tconst char */*realm*/);\n\nint\nkrb5_digest_set_responseData (\n\tkrb5_context /*context*/,\n\tkrb5_digest /*digest*/,\n\tconst char */*response*/);\n\nkrb5_error_code\nkrb5_digest_set_server_cb (\n\tkrb5_context /*context*/,\n\tkrb5_digest /*digest*/,\n\tconst char */*type*/,\n\tconst char */*binding*/);\n\nkrb5_error_code\nkrb5_digest_set_server_nonce (\n\tkrb5_context /*context*/,\n\tkrb5_digest /*digest*/,\n\tconst char */*nonce*/);\n\nkrb5_error_code\nkrb5_digest_set_type (\n\tkrb5_context /*context*/,\n\tkrb5_digest /*digest*/,\n\tconst char */*type*/);\n\nkrb5_error_code\nkrb5_digest_set_uri (\n\tkrb5_context /*context*/,\n\tkrb5_digest /*digest*/,\n\tconst char */*uri*/);\n\nkrb5_error_code\nkrb5_digest_set_username (\n\tkrb5_context /*context*/,\n\tkrb5_digest /*digest*/,\n\tconst char */*username*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_domain_x500_decode (\n\tkrb5_context /*context*/,\n\tkrb5_data /*tr*/,\n\tchar ***/*realms*/,\n\tint */*num_realms*/,\n\tconst char */*client_realm*/,\n\tconst char */*server_realm*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_domain_x500_encode (\n\tchar **/*realms*/,\n\tint /*num_realms*/,\n\tkrb5_data */*encoding*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_eai_to_heim_errno (\n\tint /*eai_errno*/,\n\tint /*system_error*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_encode_Authenticator (\n\tkrb5_context /*context*/,\n\tvoid */*data*/,\n\tsize_t /*length*/,\n\tAuthenticator */*t*/,\n\tsize_t */*len*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_encode_ETYPE_INFO (\n\tkrb5_context /*context*/,\n\tvoid */*data*/,\n\tsize_t /*length*/,\n\tETYPE_INFO */*t*/,\n\tsize_t */*len*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_encode_ETYPE_INFO2 (\n\tkrb5_context /*context*/,\n\tvoid */*data*/,\n\tsize_t /*length*/,\n\tETYPE_INFO2 */*t*/,\n\tsize_t */*len*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_encode_EncAPRepPart (\n\tkrb5_context /*context*/,\n\tvoid */*data*/,\n\tsize_t /*length*/,\n\tEncAPRepPart */*t*/,\n\tsize_t */*len*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_encode_EncASRepPart (\n\tkrb5_context /*context*/,\n\tvoid */*data*/,\n\tsize_t /*length*/,\n\tEncASRepPart */*t*/,\n\tsize_t */*len*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_encode_EncKrbCredPart (\n\tkrb5_context /*context*/,\n\tvoid */*data*/,\n\tsize_t /*length*/,\n\tEncKrbCredPart */*t*/,\n\tsize_t */*len*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_encode_EncTGSRepPart (\n\tkrb5_context /*context*/,\n\tvoid */*data*/,\n\tsize_t /*length*/,\n\tEncTGSRepPart */*t*/,\n\tsize_t */*len*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_encode_EncTicketPart (\n\tkrb5_context /*context*/,\n\tvoid */*data*/,\n\tsize_t /*length*/,\n\tEncTicketPart */*t*/,\n\tsize_t */*len*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_encrypt (\n\tkrb5_context /*context*/,\n\tkrb5_crypto /*crypto*/,\n\tunsigned /*usage*/,\n\tconst void */*data*/,\n\tsize_t /*len*/,\n\tkrb5_data */*result*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_encrypt_EncryptedData (\n\tkrb5_context /*context*/,\n\tkrb5_crypto /*crypto*/,\n\tunsigned /*usage*/,\n\tvoid */*data*/,\n\tsize_t /*len*/,\n\tint /*kvno*/,\n\tEncryptedData */*result*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_encrypt_ivec (\n\tkrb5_context /*context*/,\n\tkrb5_crypto /*crypto*/,\n\tunsigned /*usage*/,\n\tconst void */*data*/,\n\tsize_t /*len*/,\n\tkrb5_data */*result*/,\n\tvoid */*ivec*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_enctype_disable (\n\tkrb5_context /*context*/,\n\tkrb5_enctype /*enctype*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_enctype_keybits (\n\tkrb5_context /*context*/,\n\tkrb5_enctype /*type*/,\n\tsize_t */*keybits*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_enctype_keysize (\n\tkrb5_context /*context*/,\n\tkrb5_enctype /*type*/,\n\tsize_t */*keysize*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_enctype_to_keytype (\n\tkrb5_context /*context*/,\n\tkrb5_enctype /*etype*/,\n\tkrb5_keytype */*keytype*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_enctype_to_string (\n\tkrb5_context /*context*/,\n\tkrb5_enctype /*etype*/,\n\tchar **/*string*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_enctype_valid (\n\tkrb5_context /*context*/,\n\tkrb5_enctype /*etype*/);\n\nkrb5_boolean KRB5_LIB_FUNCTION\nkrb5_enctypes_compatible_keys (\n\tkrb5_context /*context*/,\n\tkrb5_enctype /*etype1*/,\n\tkrb5_enctype /*etype2*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_err (\n\tkrb5_context /*context*/,\n\tint /*eval*/,\n\tkrb5_error_code /*code*/,\n\tconst char */*fmt*/,\n\t...)\n    __attribute__ ((noreturn, format (printf, 4, 5)));\n\nkrb5_error_code KRB5_LIB_FUNCTION \n    __attribute__((deprecated)) krb5_free_creds_contents (krb5_context context, krb5_creds *c);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_error_from_rd_error (\n\tkrb5_context /*context*/,\n\tconst krb5_error */*error*/,\n\tconst krb5_creds */*creds*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_errx (\n\tkrb5_context /*context*/,\n\tint /*eval*/,\n\tconst char */*fmt*/,\n\t...)\n    __attribute__ ((noreturn, format (printf, 3, 4)));\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_expand_hostname (\n\tkrb5_context /*context*/,\n\tconst char */*orig_hostname*/,\n\tchar **/*new_hostname*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_expand_hostname_realms (\n\tkrb5_context /*context*/,\n\tconst char */*orig_hostname*/,\n\tchar **/*new_hostname*/,\n\tchar ***/*realms*/);\n\nPA_DATA *\nkrb5_find_padata (\n\tPA_DATA */*val*/,\n\tunsigned /*len*/,\n\tint /*type*/,\n\tint */*idx*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_format_time (\n\tkrb5_context /*context*/,\n\ttime_t /*t*/,\n\tchar */*s*/,\n\tsize_t /*len*/,\n\tkrb5_boolean /*include_time*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_free_address (\n\tkrb5_context /*context*/,\n\tkrb5_address */*address*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_free_addresses (\n\tkrb5_context /*context*/,\n\tkrb5_addresses */*addresses*/);\n\nvoid KRB5_LIB_FUNCTION\nkrb5_free_ap_rep_enc_part (\n\tkrb5_context /*context*/,\n\tkrb5_ap_rep_enc_part */*val*/);\n\nvoid KRB5_LIB_FUNCTION\nkrb5_free_authenticator (\n\tkrb5_context /*context*/,\n\tkrb5_authenticator */*authenticator*/);\n\nvoid KRB5_LIB_FUNCTION\nkrb5_free_checksum (\n\tkrb5_context /*context*/,\n\tkrb5_checksum */*cksum*/);\n\nvoid KRB5_LIB_FUNCTION\nkrb5_free_checksum_contents (\n\tkrb5_context /*context*/,\n\tkrb5_checksum */*cksum*/);\n\nvoid KRB5_LIB_FUNCTION\nkrb5_free_config_files (char **/*filenames*/);\n\nvoid KRB5_LIB_FUNCTION\nkrb5_free_context (krb5_context /*context*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_free_cred_contents (\n\tkrb5_context /*context*/,\n\tkrb5_creds */*c*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_free_creds (\n\tkrb5_context /*context*/,\n\tkrb5_creds */*c*/);\n\nvoid KRB5_LIB_FUNCTION\nkrb5_free_data (\n\tkrb5_context /*context*/,\n\tkrb5_data */*p*/);\n\nvoid KRB5_LIB_FUNCTION\nkrb5_free_data_contents (\n\tkrb5_context /*context*/,\n\tkrb5_data */*data*/);\n\nvoid KRB5_LIB_FUNCTION\nkrb5_free_error (\n\tkrb5_context /*context*/,\n\tkrb5_error */*error*/);\n\nvoid KRB5_LIB_FUNCTION\nkrb5_free_error_contents (\n\tkrb5_context /*context*/,\n\tkrb5_error */*error*/);\n\nvoid KRB5_LIB_FUNCTION\nkrb5_free_error_string (\n\tkrb5_context /*context*/,\n\tchar */*str*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_free_host_realm (\n\tkrb5_context /*context*/,\n\tkrb5_realm */*realmlist*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_free_kdc_rep (\n\tkrb5_context /*context*/,\n\tkrb5_kdc_rep */*rep*/);\n\nvoid KRB5_LIB_FUNCTION\nkrb5_free_keyblock (\n\tkrb5_context /*context*/,\n\tkrb5_keyblock */*keyblock*/);\n\nvoid KRB5_LIB_FUNCTION\nkrb5_free_keyblock_contents (\n\tkrb5_context /*context*/,\n\tkrb5_keyblock */*keyblock*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_free_krbhst (\n\tkrb5_context /*context*/,\n\tchar **/*hostlist*/);\n\nvoid KRB5_LIB_FUNCTION\nkrb5_free_principal (\n\tkrb5_context /*context*/,\n\tkrb5_principal /*p*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_free_salt (\n\tkrb5_context /*context*/,\n\tkrb5_salt /*salt*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_free_ticket (\n\tkrb5_context /*context*/,\n\tkrb5_ticket */*ticket*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_fwd_tgt_creds (\n\tkrb5_context /*context*/,\n\tkrb5_auth_context /*auth_context*/,\n\tconst char */*hostname*/,\n\tkrb5_principal /*client*/,\n\tkrb5_principal /*server*/,\n\tkrb5_ccache /*ccache*/,\n\tint /*forwardable*/,\n\tkrb5_data */*out_data*/);\n\nvoid KRB5_LIB_FUNCTION\nkrb5_generate_random_block (\n\tvoid */*buf*/,\n\tsize_t /*len*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_generate_random_keyblock (\n\tkrb5_context /*context*/,\n\tkrb5_enctype /*type*/,\n\tkrb5_keyblock */*key*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_generate_seq_number (\n\tkrb5_context /*context*/,\n\tconst krb5_keyblock */*key*/,\n\tuint32_t */*seqno*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_generate_subkey (\n\tkrb5_context /*context*/,\n\tconst krb5_keyblock */*key*/,\n\tkrb5_keyblock **/*subkey*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_generate_subkey_extended (\n\tkrb5_context /*context*/,\n\tconst krb5_keyblock */*key*/,\n\tkrb5_enctype /*etype*/,\n\tkrb5_keyblock **/*subkey*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_get_all_client_addrs (\n\tkrb5_context /*context*/,\n\tkrb5_addresses */*res*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_get_all_server_addrs (\n\tkrb5_context /*context*/,\n\tkrb5_addresses */*res*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_get_cred_from_kdc (\n\tkrb5_context /*context*/,\n\tkrb5_ccache /*ccache*/,\n\tkrb5_creds */*in_creds*/,\n\tkrb5_creds **/*out_creds*/,\n\tkrb5_creds ***/*ret_tgts*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_get_cred_from_kdc_opt (\n\tkrb5_context /*context*/,\n\tkrb5_ccache /*ccache*/,\n\tkrb5_creds */*in_creds*/,\n\tkrb5_creds **/*out_creds*/,\n\tkrb5_creds ***/*ret_tgts*/,\n\tkrb5_flags /*flags*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_get_credentials (\n\tkrb5_context /*context*/,\n\tkrb5_flags /*options*/,\n\tkrb5_ccache /*ccache*/,\n\tkrb5_creds */*in_creds*/,\n\tkrb5_creds **/*out_creds*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_get_credentials_with_flags (\n\tkrb5_context /*context*/,\n\tkrb5_flags /*options*/,\n\tkrb5_kdc_flags /*flags*/,\n\tkrb5_ccache /*ccache*/,\n\tkrb5_creds */*in_creds*/,\n\tkrb5_creds **/*out_creds*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_get_creds (\n\tkrb5_context /*context*/,\n\tkrb5_get_creds_opt /*opt*/,\n\tkrb5_ccache /*ccache*/,\n\tkrb5_const_principal /*inprinc*/,\n\tkrb5_creds **/*out_creds*/);\n\nvoid KRB5_LIB_FUNCTION\nkrb5_get_creds_opt_add_options (\n\tkrb5_context /*context*/,\n\tkrb5_get_creds_opt /*opt*/,\n\tkrb5_flags /*options*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_get_creds_opt_alloc (\n\tkrb5_context /*context*/,\n\tkrb5_get_creds_opt */*opt*/);\n\nvoid KRB5_LIB_FUNCTION\nkrb5_get_creds_opt_free (\n\tkrb5_context /*context*/,\n\tkrb5_get_creds_opt /*opt*/);\n\nvoid KRB5_LIB_FUNCTION\nkrb5_get_creds_opt_set_enctype (\n\tkrb5_context /*context*/,\n\tkrb5_get_creds_opt /*opt*/,\n\tkrb5_enctype /*enctype*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_get_creds_opt_set_impersonate (\n\tkrb5_context /*context*/,\n\tkrb5_get_creds_opt /*opt*/,\n\tkrb5_const_principal /*self*/);\n\nvoid KRB5_LIB_FUNCTION\nkrb5_get_creds_opt_set_options (\n\tkrb5_context /*context*/,\n\tkrb5_get_creds_opt /*opt*/,\n\tkrb5_flags /*options*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_get_creds_opt_set_ticket (\n\tkrb5_context /*context*/,\n\tkrb5_get_creds_opt /*opt*/,\n\tconst Ticket */*ticket*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_get_default_config_files (char ***/*pfilenames*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_get_default_in_tkt_etypes (\n\tkrb5_context /*context*/,\n\tkrb5_enctype **/*etypes*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_get_default_principal (\n\tkrb5_context /*context*/,\n\tkrb5_principal */*princ*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_get_default_realm (\n\tkrb5_context /*context*/,\n\tkrb5_realm */*realm*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_get_default_realms (\n\tkrb5_context /*context*/,\n\tkrb5_realm **/*realms*/);\n\nkrb5_boolean KRB5_LIB_FUNCTION\nkrb5_get_dns_canonicalize_hostname (krb5_context /*context*/);\n\nconst char* KRB5_LIB_FUNCTION\nkrb5_get_err_text (\n\tkrb5_context /*context*/,\n\tkrb5_error_code /*code*/);\n\nchar * KRB5_LIB_FUNCTION\nkrb5_get_error_message (\n\tkrb5_context /*context*/,\n\tkrb5_error_code /*code*/);\n\nchar * KRB5_LIB_FUNCTION\nkrb5_get_error_string (krb5_context /*context*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_get_extra_addresses (\n\tkrb5_context /*context*/,\n\tkrb5_addresses */*addresses*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_get_fcache_version (\n\tkrb5_context /*context*/,\n\tint */*version*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_get_forwarded_creds (\n\tkrb5_context /*context*/,\n\tkrb5_auth_context /*auth_context*/,\n\tkrb5_ccache /*ccache*/,\n\tkrb5_flags /*flags*/,\n\tconst char */*hostname*/,\n\tkrb5_creds */*in_creds*/,\n\tkrb5_data */*out_data*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_get_host_realm (\n\tkrb5_context /*context*/,\n\tconst char */*targethost*/,\n\tkrb5_realm **/*realms*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_get_ignore_addresses (\n\tkrb5_context /*context*/,\n\tkrb5_addresses */*addresses*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_get_in_cred (\n\tkrb5_context /*context*/,\n\tkrb5_flags /*options*/,\n\tconst krb5_addresses */*addrs*/,\n\tconst krb5_enctype */*etypes*/,\n\tconst krb5_preauthtype */*ptypes*/,\n\tconst krb5_preauthdata */*preauth*/,\n\tkrb5_key_proc /*key_proc*/,\n\tkrb5_const_pointer /*keyseed*/,\n\tkrb5_decrypt_proc /*decrypt_proc*/,\n\tkrb5_const_pointer /*decryptarg*/,\n\tkrb5_creds */*creds*/,\n\tkrb5_kdc_rep */*ret_as_reply*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_get_in_tkt (\n\tkrb5_context /*context*/,\n\tkrb5_flags /*options*/,\n\tconst krb5_addresses */*addrs*/,\n\tconst krb5_enctype */*etypes*/,\n\tconst krb5_preauthtype */*ptypes*/,\n\tkrb5_key_proc /*key_proc*/,\n\tkrb5_const_pointer /*keyseed*/,\n\tkrb5_decrypt_proc /*decrypt_proc*/,\n\tkrb5_const_pointer /*decryptarg*/,\n\tkrb5_creds */*creds*/,\n\tkrb5_ccache /*ccache*/,\n\tkrb5_kdc_rep */*ret_as_reply*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_get_in_tkt_with_keytab (\n\tkrb5_context /*context*/,\n\tkrb5_flags /*options*/,\n\tkrb5_addresses */*addrs*/,\n\tconst krb5_enctype */*etypes*/,\n\tconst krb5_preauthtype */*pre_auth_types*/,\n\tkrb5_keytab /*keytab*/,\n\tkrb5_ccache /*ccache*/,\n\tkrb5_creds */*creds*/,\n\tkrb5_kdc_rep */*ret_as_reply*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_get_in_tkt_with_password (\n\tkrb5_context /*context*/,\n\tkrb5_flags /*options*/,\n\tkrb5_addresses */*addrs*/,\n\tconst krb5_enctype */*etypes*/,\n\tconst krb5_preauthtype */*pre_auth_types*/,\n\tconst char */*password*/,\n\tkrb5_ccache /*ccache*/,\n\tkrb5_creds */*creds*/,\n\tkrb5_kdc_rep */*ret_as_reply*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_get_in_tkt_with_skey (\n\tkrb5_context /*context*/,\n\tkrb5_flags /*options*/,\n\tkrb5_addresses */*addrs*/,\n\tconst krb5_enctype */*etypes*/,\n\tconst krb5_preauthtype */*pre_auth_types*/,\n\tconst krb5_keyblock */*key*/,\n\tkrb5_ccache /*ccache*/,\n\tkrb5_creds */*creds*/,\n\tkrb5_kdc_rep */*ret_as_reply*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_get_init_creds (\n\tkrb5_context /*context*/,\n\tkrb5_creds */*creds*/,\n\tkrb5_principal /*client*/,\n\tkrb5_prompter_fct /*prompter*/,\n\tvoid */*data*/,\n\tkrb5_deltat /*start_time*/,\n\tconst char */*in_tkt_service*/,\n\tkrb5_get_init_creds_opt */*options*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_get_init_creds_keyblock (\n\tkrb5_context /*context*/,\n\tkrb5_creds */*creds*/,\n\tkrb5_principal /*client*/,\n\tkrb5_keyblock */*keyblock*/,\n\tkrb5_deltat /*start_time*/,\n\tconst char */*in_tkt_service*/,\n\tkrb5_get_init_creds_opt */*options*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_get_init_creds_keytab (\n\tkrb5_context /*context*/,\n\tkrb5_creds */*creds*/,\n\tkrb5_principal /*client*/,\n\tkrb5_keytab /*keytab*/,\n\tkrb5_deltat /*start_time*/,\n\tconst char */*in_tkt_service*/,\n\tkrb5_get_init_creds_opt */*options*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_get_init_creds_opt_alloc (\n\tkrb5_context /*context*/,\n\tkrb5_get_init_creds_opt **/*opt*/);\n\nvoid KRB5_LIB_FUNCTION\nkrb5_get_init_creds_opt_free (\n\tkrb5_context /*context*/,\n\tkrb5_get_init_creds_opt */*opt*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_get_init_creds_opt_get_error (\n\tkrb5_context /*context*/,\n\tkrb5_get_init_creds_opt */*opt*/,\n\tKRB_ERROR **/*error*/);\n\nvoid KRB5_LIB_FUNCTION\nkrb5_get_init_creds_opt_init (krb5_get_init_creds_opt */*opt*/);\n\nvoid KRB5_LIB_FUNCTION\nkrb5_get_init_creds_opt_set_address_list (\n\tkrb5_get_init_creds_opt */*opt*/,\n\tkrb5_addresses */*addresses*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_get_init_creds_opt_set_addressless (\n\tkrb5_context /*context*/,\n\tkrb5_get_init_creds_opt */*opt*/,\n\tkrb5_boolean /*addressless*/);\n\nvoid KRB5_LIB_FUNCTION\nkrb5_get_init_creds_opt_set_anonymous (\n\tkrb5_get_init_creds_opt */*opt*/,\n\tint /*anonymous*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_get_init_creds_opt_set_canonicalize (\n\tkrb5_context /*context*/,\n\tkrb5_get_init_creds_opt */*opt*/,\n\tkrb5_boolean /*req*/);\n\nvoid KRB5_LIB_FUNCTION\nkrb5_get_init_creds_opt_set_default_flags (\n\tkrb5_context /*context*/,\n\tconst char */*appname*/,\n\tkrb5_const_realm /*realm*/,\n\tkrb5_get_init_creds_opt */*opt*/);\n\nvoid KRB5_LIB_FUNCTION\nkrb5_get_init_creds_opt_set_etype_list (\n\tkrb5_get_init_creds_opt */*opt*/,\n\tkrb5_enctype */*etype_list*/,\n\tint /*etype_list_length*/);\n\nvoid KRB5_LIB_FUNCTION\nkrb5_get_init_creds_opt_set_forwardable (\n\tkrb5_get_init_creds_opt */*opt*/,\n\tint /*forwardable*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_get_init_creds_opt_set_pa_password (\n\tkrb5_context /*context*/,\n\tkrb5_get_init_creds_opt */*opt*/,\n\tconst char */*password*/,\n\tkrb5_s2k_proc /*key_proc*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_get_init_creds_opt_set_pac_request (\n\tkrb5_context /*context*/,\n\tkrb5_get_init_creds_opt */*opt*/,\n\tkrb5_boolean /*req_pac*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_get_init_creds_opt_set_pkinit (\n\tkrb5_context /*context*/,\n\tkrb5_get_init_creds_opt */*opt*/,\n\tkrb5_principal /*principal*/,\n\tconst char */*user_id*/,\n\tconst char */*x509_anchors*/,\n\tchar * const * /*pool*/,\n\tchar * const * /*pki_revoke*/,\n\tint /*flags*/,\n\tkrb5_prompter_fct /*prompter*/,\n\tvoid */*prompter_data*/,\n\tchar */*password*/);\n\nvoid KRB5_LIB_FUNCTION\nkrb5_get_init_creds_opt_set_preauth_list (\n\tkrb5_get_init_creds_opt */*opt*/,\n\tkrb5_preauthtype */*preauth_list*/,\n\tint /*preauth_list_length*/);\n\nvoid KRB5_LIB_FUNCTION\nkrb5_get_init_creds_opt_set_proxiable (\n\tkrb5_get_init_creds_opt */*opt*/,\n\tint /*proxiable*/);\n\nvoid KRB5_LIB_FUNCTION\nkrb5_get_init_creds_opt_set_renew_life (\n\tkrb5_get_init_creds_opt */*opt*/,\n\tkrb5_deltat /*renew_life*/);\n\nvoid KRB5_LIB_FUNCTION\nkrb5_get_init_creds_opt_set_salt (\n\tkrb5_get_init_creds_opt */*opt*/,\n\tkrb5_data */*salt*/);\n\nvoid KRB5_LIB_FUNCTION\nkrb5_get_init_creds_opt_set_tkt_life (\n\tkrb5_get_init_creds_opt */*opt*/,\n\tkrb5_deltat /*tkt_life*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_get_init_creds_opt_set_win2k (\n\tkrb5_context /*context*/,\n\tkrb5_get_init_creds_opt */*opt*/,\n\tkrb5_boolean /*req*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_get_init_creds_password (\n\tkrb5_context /*context*/,\n\tkrb5_creds */*creds*/,\n\tkrb5_principal /*client*/,\n\tconst char */*password*/,\n\tkrb5_prompter_fct /*prompter*/,\n\tvoid */*data*/,\n\tkrb5_deltat /*start_time*/,\n\tconst char */*in_tkt_service*/,\n\tkrb5_get_init_creds_opt */*in_options*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_get_kdc_cred (\n\tkrb5_context /*context*/,\n\tkrb5_ccache /*id*/,\n\tkrb5_kdc_flags /*flags*/,\n\tkrb5_addresses */*addresses*/,\n\tTicket */*second_ticket*/,\n\tkrb5_creds */*in_creds*/,\n\tkrb5_creds **out_creds );\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_get_kdc_sec_offset (\n\tkrb5_context /*context*/,\n\tint32_t */*sec*/,\n\tint32_t */*usec*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_get_krb524hst (\n\tkrb5_context /*context*/,\n\tconst krb5_realm */*realm*/,\n\tchar ***/*hostlist*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_get_krb_admin_hst (\n\tkrb5_context /*context*/,\n\tconst krb5_realm */*realm*/,\n\tchar ***/*hostlist*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_get_krb_changepw_hst (\n\tkrb5_context /*context*/,\n\tconst krb5_realm */*realm*/,\n\tchar ***/*hostlist*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_get_krbhst (\n\tkrb5_context /*context*/,\n\tconst krb5_realm */*realm*/,\n\tchar ***/*hostlist*/);\n\ntime_t KRB5_LIB_FUNCTION\nkrb5_get_max_time_skew (krb5_context /*context*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_get_pw_salt (\n\tkrb5_context /*context*/,\n\tkrb5_const_principal /*principal*/,\n\tkrb5_salt */*salt*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_get_renewed_creds (\n\tkrb5_context /*context*/,\n\tkrb5_creds */*creds*/,\n\tkrb5_const_principal /*client*/,\n\tkrb5_ccache /*ccache*/,\n\tconst char */*in_tkt_service*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_get_server_rcache (\n\tkrb5_context /*context*/,\n\tconst krb5_data */*piece*/,\n\tkrb5_rcache */*id*/);\n\nkrb5_boolean KRB5_LIB_FUNCTION\nkrb5_get_use_admin_kdc (krb5_context /*context*/);\n\nkrb5_log_facility * KRB5_LIB_FUNCTION\nkrb5_get_warn_dest (krb5_context /*context*/);\n\nsize_t\nkrb5_get_wrapped_length (\n\tkrb5_context /*context*/,\n\tkrb5_crypto /*crypto*/,\n\tsize_t /*data_len*/);\n\nint KRB5_LIB_FUNCTION\nkrb5_getportbyname (\n\tkrb5_context /*context*/,\n\tconst char */*service*/,\n\tconst char */*proto*/,\n\tint /*default_port*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_h_addr2addr (\n\tkrb5_context /*context*/,\n\tint /*af*/,\n\tconst char */*haddr*/,\n\tkrb5_address */*addr*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_h_addr2sockaddr (\n\tkrb5_context /*context*/,\n\tint /*af*/,\n\tconst char */*addr*/,\n\tstruct sockaddr */*sa*/,\n\tkrb5_socklen_t */*sa_size*/,\n\tint /*port*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_h_errno_to_heim_errno (int /*eai_errno*/);\n\nkrb5_boolean KRB5_LIB_FUNCTION\nkrb5_have_error_string (krb5_context /*context*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_hmac (\n\tkrb5_context /*context*/,\n\tkrb5_cksumtype /*cktype*/,\n\tconst void */*data*/,\n\tsize_t /*len*/,\n\tunsigned /*usage*/,\n\tkrb5_keyblock */*key*/,\n\tChecksum */*result*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_init_context (krb5_context */*context*/);\n\nvoid KRB5_LIB_FUNCTION\nkrb5_init_ets (krb5_context /*context*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_init_etype (\n\tkrb5_context /*context*/,\n\tunsigned */*len*/,\n\tkrb5_enctype **/*val*/,\n\tconst krb5_enctype */*etypes*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_initlog (\n\tkrb5_context /*context*/,\n\tconst char */*program*/,\n\tkrb5_log_facility **/*fac*/);\n\nkrb5_boolean KRB5_LIB_FUNCTION\nkrb5_is_thread_safe (void);\n\nconst krb5_enctype * KRB5_LIB_FUNCTION\nkrb5_kerberos_enctypes (krb5_context /*context*/);\n\nkrb5_enctype\nkrb5_keyblock_get_enctype (const krb5_keyblock */*block*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_keyblock_init (\n\tkrb5_context /*context*/,\n\tkrb5_enctype /*type*/,\n\tconst void */*data*/,\n\tsize_t /*size*/,\n\tkrb5_keyblock */*key*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_keyblock_key_proc (\n\tkrb5_context /*context*/,\n\tkrb5_keytype /*type*/,\n\tkrb5_data */*salt*/,\n\tkrb5_const_pointer /*keyseed*/,\n\tkrb5_keyblock **/*key*/);\n\nvoid KRB5_LIB_FUNCTION\nkrb5_keyblock_zero (krb5_keyblock */*keyblock*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_keytab_key_proc (\n\tkrb5_context /*context*/,\n\tkrb5_enctype /*enctype*/,\n\tkrb5_salt /*salt*/,\n\tkrb5_const_pointer /*keyseed*/,\n\tkrb5_keyblock **/*key*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_keytype_to_enctypes (\n\tkrb5_context /*context*/,\n\tkrb5_keytype /*keytype*/,\n\tunsigned */*len*/,\n\tkrb5_enctype **/*val*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_keytype_to_enctypes_default (\n\tkrb5_context /*context*/,\n\tkrb5_keytype /*keytype*/,\n\tunsigned */*len*/,\n\tkrb5_enctype **/*val*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_keytype_to_string (\n\tkrb5_context /*context*/,\n\tkrb5_keytype /*keytype*/,\n\tchar **/*string*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_krbhst_format_string (\n\tkrb5_context /*context*/,\n\tconst krb5_krbhst_info */*host*/,\n\tchar */*hostname*/,\n\tsize_t /*hostlen*/);\n\nvoid KRB5_LIB_FUNCTION\nkrb5_krbhst_free (\n\tkrb5_context /*context*/,\n\tkrb5_krbhst_handle /*handle*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_krbhst_get_addrinfo (\n\tkrb5_context /*context*/,\n\tkrb5_krbhst_info */*host*/,\n\tstruct addrinfo **/*ai*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_krbhst_init (\n\tkrb5_context /*context*/,\n\tconst char */*realm*/,\n\tunsigned int /*type*/,\n\tkrb5_krbhst_handle */*handle*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_krbhst_init_flags (\n\tkrb5_context /*context*/,\n\tconst char */*realm*/,\n\tunsigned int /*type*/,\n\tint /*flags*/,\n\tkrb5_krbhst_handle */*handle*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_krbhst_next (\n\tkrb5_context /*context*/,\n\tkrb5_krbhst_handle /*handle*/,\n\tkrb5_krbhst_info **/*host*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_krbhst_next_as_string (\n\tkrb5_context /*context*/,\n\tkrb5_krbhst_handle /*handle*/,\n\tchar */*hostname*/,\n\tsize_t /*hostlen*/);\n\nvoid KRB5_LIB_FUNCTION\nkrb5_krbhst_reset (\n\tkrb5_context /*context*/,\n\tkrb5_krbhst_handle /*handle*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_kt_add_entry (\n\tkrb5_context /*context*/,\n\tkrb5_keytab /*id*/,\n\tkrb5_keytab_entry */*entry*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_kt_close (\n\tkrb5_context /*context*/,\n\tkrb5_keytab /*id*/);\n\nkrb5_boolean KRB5_LIB_FUNCTION\nkrb5_kt_compare (\n\tkrb5_context /*context*/,\n\tkrb5_keytab_entry */*entry*/,\n\tkrb5_const_principal /*principal*/,\n\tkrb5_kvno /*vno*/,\n\tkrb5_enctype /*enctype*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_kt_copy_entry_contents (\n\tkrb5_context /*context*/,\n\tconst krb5_keytab_entry */*in*/,\n\tkrb5_keytab_entry */*out*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_kt_default (\n\tkrb5_context /*context*/,\n\tkrb5_keytab */*id*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_kt_default_modify_name (\n\tkrb5_context /*context*/,\n\tchar */*name*/,\n\tsize_t /*namesize*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_kt_default_name (\n\tkrb5_context /*context*/,\n\tchar */*name*/,\n\tsize_t /*namesize*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_kt_end_seq_get (\n\tkrb5_context /*context*/,\n\tkrb5_keytab /*id*/,\n\tkrb5_kt_cursor */*cursor*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_kt_free_entry (\n\tkrb5_context /*context*/,\n\tkrb5_keytab_entry */*entry*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_kt_get_entry (\n\tkrb5_context /*context*/,\n\tkrb5_keytab /*id*/,\n\tkrb5_const_principal /*principal*/,\n\tkrb5_kvno /*kvno*/,\n\tkrb5_enctype /*enctype*/,\n\tkrb5_keytab_entry */*entry*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_kt_get_full_name (\n\tkrb5_context /*context*/,\n\tkrb5_keytab /*keytab*/,\n\tchar **/*str*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_kt_get_name (\n\tkrb5_context /*context*/,\n\tkrb5_keytab /*keytab*/,\n\tchar */*name*/,\n\tsize_t /*namesize*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_kt_get_type (\n\tkrb5_context /*context*/,\n\tkrb5_keytab /*keytab*/,\n\tchar */*prefix*/,\n\tsize_t /*prefixsize*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_kt_next_entry (\n\tkrb5_context /*context*/,\n\tkrb5_keytab /*id*/,\n\tkrb5_keytab_entry */*entry*/,\n\tkrb5_kt_cursor */*cursor*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_kt_read_service_key (\n\tkrb5_context /*context*/,\n\tkrb5_pointer /*keyprocarg*/,\n\tkrb5_principal /*principal*/,\n\tkrb5_kvno /*vno*/,\n\tkrb5_enctype /*enctype*/,\n\tkrb5_keyblock **/*key*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_kt_register (\n\tkrb5_context /*context*/,\n\tconst krb5_kt_ops */*ops*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_kt_remove_entry (\n\tkrb5_context /*context*/,\n\tkrb5_keytab /*id*/,\n\tkrb5_keytab_entry */*entry*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_kt_resolve (\n\tkrb5_context /*context*/,\n\tconst char */*name*/,\n\tkrb5_keytab */*id*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_kt_start_seq_get (\n\tkrb5_context /*context*/,\n\tkrb5_keytab /*id*/,\n\tkrb5_kt_cursor */*cursor*/);\n\nkrb5_boolean KRB5_LIB_FUNCTION\nkrb5_kuserok (\n\tkrb5_context /*context*/,\n\tkrb5_principal /*principal*/,\n\tconst char */*luser*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_log (\n\tkrb5_context /*context*/,\n\tkrb5_log_facility */*fac*/,\n\tint /*level*/,\n\tconst char */*fmt*/,\n\t...)\n    __attribute__((format (printf, 4, 5)));\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_log_msg (\n\tkrb5_context /*context*/,\n\tkrb5_log_facility */*fac*/,\n\tint /*level*/,\n\tchar **/*reply*/,\n\tconst char */*fmt*/,\n\t...)\n    __attribute__((format (printf, 5, 6)));\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_make_addrport (\n\tkrb5_context /*context*/,\n\tkrb5_address **/*res*/,\n\tconst krb5_address */*addr*/,\n\tint16_t /*port*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_make_principal (\n\tkrb5_context /*context*/,\n\tkrb5_principal */*principal*/,\n\tkrb5_const_realm /*realm*/,\n\t...);\n\nsize_t KRB5_LIB_FUNCTION\nkrb5_max_sockaddr_size (void);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_mk_error (\n\tkrb5_context /*context*/,\n\tkrb5_error_code /*error_code*/,\n\tconst char */*e_text*/,\n\tconst krb5_data */*e_data*/,\n\tconst krb5_principal /*client*/,\n\tconst krb5_principal /*server*/,\n\ttime_t */*client_time*/,\n\tint */*client_usec*/,\n\tkrb5_data */*reply*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_mk_priv (\n\tkrb5_context /*context*/,\n\tkrb5_auth_context /*auth_context*/,\n\tconst krb5_data */*userdata*/,\n\tkrb5_data */*outbuf*/,\n\tkrb5_replay_data */*outdata*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_mk_rep (\n\tkrb5_context /*context*/,\n\tkrb5_auth_context /*auth_context*/,\n\tkrb5_data */*outbuf*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_mk_req (\n\tkrb5_context /*context*/,\n\tkrb5_auth_context */*auth_context*/,\n\tconst krb5_flags /*ap_req_options*/,\n\tconst char */*service*/,\n\tconst char */*hostname*/,\n\tkrb5_data */*in_data*/,\n\tkrb5_ccache /*ccache*/,\n\tkrb5_data */*outbuf*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_mk_req_exact (\n\tkrb5_context /*context*/,\n\tkrb5_auth_context */*auth_context*/,\n\tconst krb5_flags /*ap_req_options*/,\n\tconst krb5_principal /*server*/,\n\tkrb5_data */*in_data*/,\n\tkrb5_ccache /*ccache*/,\n\tkrb5_data */*outbuf*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_mk_req_extended (\n\tkrb5_context /*context*/,\n\tkrb5_auth_context */*auth_context*/,\n\tconst krb5_flags /*ap_req_options*/,\n\tkrb5_data */*in_data*/,\n\tkrb5_creds */*in_creds*/,\n\tkrb5_data */*outbuf*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_mk_safe (\n\tkrb5_context /*context*/,\n\tkrb5_auth_context /*auth_context*/,\n\tconst krb5_data */*userdata*/,\n\tkrb5_data */*outbuf*/,\n\tkrb5_replay_data */*outdata*/);\n\nkrb5_ssize_t KRB5_LIB_FUNCTION\nkrb5_net_read (\n\tkrb5_context /*context*/,\n\tvoid */*p_fd*/,\n\tvoid */*buf*/,\n\tsize_t /*len*/);\n\nkrb5_ssize_t KRB5_LIB_FUNCTION\nkrb5_net_write (\n\tkrb5_context /*context*/,\n\tvoid */*p_fd*/,\n\tconst void */*buf*/,\n\tsize_t /*len*/);\n\nkrb5_ssize_t KRB5_LIB_FUNCTION\nkrb5_net_write_block (\n\tkrb5_context /*context*/,\n\tvoid */*p_fd*/,\n\tconst void */*buf*/,\n\tsize_t /*len*/,\n\ttime_t /*timeout*/);\n\nkrb5_error_code\nkrb5_ntlm_alloc (\n\tkrb5_context /*context*/,\n\tkrb5_ntlm */*ntlm*/);\n\nkrb5_error_code\nkrb5_ntlm_free (\n\tkrb5_context /*context*/,\n\tkrb5_ntlm /*ntlm*/);\n\nkrb5_error_code\nkrb5_ntlm_init_get_challange (\n\tkrb5_context /*context*/,\n\tkrb5_ntlm /*ntlm*/,\n\tkrb5_data */*challange*/);\n\nkrb5_error_code\nkrb5_ntlm_init_get_flags (\n\tkrb5_context /*context*/,\n\tkrb5_ntlm /*ntlm*/,\n\tuint32_t */*flags*/);\n\nkrb5_error_code\nkrb5_ntlm_init_get_opaque (\n\tkrb5_context /*context*/,\n\tkrb5_ntlm /*ntlm*/,\n\tkrb5_data */*opaque*/);\n\nkrb5_error_code\nkrb5_ntlm_init_get_targetinfo (\n\tkrb5_context /*context*/,\n\tkrb5_ntlm /*ntlm*/,\n\tkrb5_data */*data*/);\n\nkrb5_error_code\nkrb5_ntlm_init_get_targetname (\n\tkrb5_context /*context*/,\n\tkrb5_ntlm /*ntlm*/,\n\tchar **/*name*/);\n\nkrb5_error_code\nkrb5_ntlm_init_request (\n\tkrb5_context /*context*/,\n\tkrb5_ntlm /*ntlm*/,\n\tkrb5_realm /*realm*/,\n\tkrb5_ccache /*ccache*/,\n\tuint32_t /*flags*/,\n\tconst char */*hostname*/,\n\tconst char */*domainname*/);\n\nkrb5_error_code\nkrb5_ntlm_rep_get_sessionkey (\n\tkrb5_context /*context*/,\n\tkrb5_ntlm /*ntlm*/,\n\tkrb5_data */*data*/);\n\nkrb5_boolean\nkrb5_ntlm_rep_get_status (\n\tkrb5_context /*context*/,\n\tkrb5_ntlm /*ntlm*/);\n\nkrb5_error_code\nkrb5_ntlm_req_set_flags (\n\tkrb5_context /*context*/,\n\tkrb5_ntlm /*ntlm*/,\n\tuint32_t /*flags*/);\n\nkrb5_error_code\nkrb5_ntlm_req_set_lm (\n\tkrb5_context /*context*/,\n\tkrb5_ntlm /*ntlm*/,\n\tvoid */*hash*/,\n\tsize_t /*len*/);\n\nkrb5_error_code\nkrb5_ntlm_req_set_ntlm (\n\tkrb5_context /*context*/,\n\tkrb5_ntlm /*ntlm*/,\n\tvoid */*hash*/,\n\tsize_t /*len*/);\n\nkrb5_error_code\nkrb5_ntlm_req_set_opaque (\n\tkrb5_context /*context*/,\n\tkrb5_ntlm /*ntlm*/,\n\tkrb5_data */*opaque*/);\n\nkrb5_error_code\nkrb5_ntlm_req_set_session (\n\tkrb5_context /*context*/,\n\tkrb5_ntlm /*ntlm*/,\n\tvoid */*sessionkey*/,\n\tsize_t /*length*/);\n\nkrb5_error_code\nkrb5_ntlm_req_set_targetname (\n\tkrb5_context /*context*/,\n\tkrb5_ntlm /*ntlm*/,\n\tconst char */*targetname*/);\n\nkrb5_error_code\nkrb5_ntlm_req_set_username (\n\tkrb5_context /*context*/,\n\tkrb5_ntlm /*ntlm*/,\n\tconst char */*username*/);\n\nkrb5_error_code\nkrb5_ntlm_request (\n\tkrb5_context /*context*/,\n\tkrb5_ntlm /*ntlm*/,\n\tkrb5_realm /*realm*/,\n\tkrb5_ccache /*ccache*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_openlog (\n\tkrb5_context /*context*/,\n\tconst char */*program*/,\n\tkrb5_log_facility **/*fac*/);\n\nkrb5_error_code\nkrb5_pac_add_buffer (\n\tkrb5_context /*context*/,\n\tkrb5_pac /*p*/,\n\tuint32_t /*type*/,\n\tconst krb5_data */*data*/);\n\nvoid\nkrb5_pac_free (\n\tkrb5_context /*context*/,\n\tkrb5_pac /*pac*/);\n\nkrb5_error_code\nkrb5_pac_get_buffer (\n\tkrb5_context /*context*/,\n\tkrb5_pac /*p*/,\n\tuint32_t /*type*/,\n\tkrb5_data */*data*/);\n\nkrb5_error_code\nkrb5_pac_get_types (\n\tkrb5_context /*context*/,\n\tkrb5_pac /*p*/,\n\tsize_t */*len*/,\n\tuint32_t **/*types*/);\n\nkrb5_error_code\nkrb5_pac_init (\n\tkrb5_context /*context*/,\n\tkrb5_pac */*pac*/);\n\nkrb5_error_code\nkrb5_pac_parse (\n\tkrb5_context /*context*/,\n\tconst void */*ptr*/,\n\tsize_t /*len*/,\n\tkrb5_pac */*pac*/);\n\nkrb5_error_code\nkrb5_pac_verify (\n\tkrb5_context /*context*/,\n\tconst krb5_pac /*pac*/,\n\ttime_t /*authtime*/,\n\tkrb5_const_principal /*principal*/,\n\tconst krb5_keyblock */*server*/,\n\tconst krb5_keyblock */*privsvr*/);\n\nint KRB5_LIB_FUNCTION\nkrb5_padata_add (\n\tkrb5_context /*context*/,\n\tMETHOD_DATA */*md*/,\n\tint /*type*/,\n\tvoid */*buf*/,\n\tsize_t /*len*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_parse_address (\n\tkrb5_context /*context*/,\n\tconst char */*string*/,\n\tkrb5_addresses */*addresses*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_parse_name (\n\tkrb5_context /*context*/,\n\tconst char */*name*/,\n\tkrb5_principal */*principal*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_parse_name_flags (\n\tkrb5_context /*context*/,\n\tconst char */*name*/,\n\tint /*flags*/,\n\tkrb5_principal */*principal*/);\n\nkrb5_error_code\nkrb5_parse_nametype (\n\tkrb5_context /*context*/,\n\tconst char */*str*/,\n\tint32_t */*nametype*/);\n\nconst char* KRB5_LIB_FUNCTION\nkrb5_passwd_result_to_string (\n\tkrb5_context /*context*/,\n\tint /*result*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_password_key_proc (\n\tkrb5_context /*context*/,\n\tkrb5_enctype /*type*/,\n\tkrb5_salt /*salt*/,\n\tkrb5_const_pointer /*keyseed*/,\n\tkrb5_keyblock **/*key*/);\n\nkrb5_error_code\nkrb5_plugin_register (\n\tkrb5_context /*context*/,\n\tenum krb5_plugin_type /*type*/,\n\tconst char */*name*/,\n\tvoid */*symbol*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_prepend_config_files (\n\tconst char */*filelist*/,\n\tchar **/*pq*/,\n\tchar ***/*ret_pp*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_prepend_config_files_default (\n\tconst char */*filelist*/,\n\tchar ***/*pfilenames*/);\n\nkrb5_realm * KRB5_LIB_FUNCTION\nkrb5_princ_realm (\n\tkrb5_context /*context*/,\n\tkrb5_principal /*principal*/);\n\nvoid KRB5_LIB_FUNCTION\nkrb5_princ_set_realm (\n\tkrb5_context /*context*/,\n\tkrb5_principal /*principal*/,\n\tkrb5_realm */*realm*/);\n\nkrb5_boolean KRB5_LIB_FUNCTION\nkrb5_principal_compare (\n\tkrb5_context /*context*/,\n\tkrb5_const_principal /*princ1*/,\n\tkrb5_const_principal /*princ2*/);\n\nkrb5_boolean KRB5_LIB_FUNCTION\nkrb5_principal_compare_any_realm (\n\tkrb5_context /*context*/,\n\tkrb5_const_principal /*princ1*/,\n\tkrb5_const_principal /*princ2*/);\n\nconst char* KRB5_LIB_FUNCTION\nkrb5_principal_get_comp_string (\n\tkrb5_context /*context*/,\n\tkrb5_const_principal /*principal*/,\n\tunsigned int /*component*/);\n\nconst char* KRB5_LIB_FUNCTION\nkrb5_principal_get_realm (\n\tkrb5_context /*context*/,\n\tkrb5_const_principal /*principal*/);\n\nint KRB5_LIB_FUNCTION\nkrb5_principal_get_type (\n\tkrb5_context /*context*/,\n\tkrb5_const_principal /*principal*/);\n\nkrb5_boolean KRB5_LIB_FUNCTION\nkrb5_principal_match (\n\tkrb5_context /*context*/,\n\tkrb5_const_principal /*princ*/,\n\tkrb5_const_principal /*pattern*/);\n\nvoid KRB5_LIB_FUNCTION\nkrb5_principal_set_type (\n\tkrb5_context /*context*/,\n\tkrb5_principal /*principal*/,\n\tint /*type*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_print_address (\n\tconst krb5_address */*addr*/,\n\tchar */*str*/,\n\tsize_t /*len*/,\n\tsize_t */*ret_len*/);\n\nint KRB5_LIB_FUNCTION\nkrb5_program_setup (\n\tkrb5_context */*context*/,\n\tint /*argc*/,\n\tchar **/*argv*/,\n\tstruct getargs */*args*/,\n\tint /*num_args*/,\n\tvoid (*/*usage*/)(int, struct getargs*, int));\n\nint KRB5_LIB_FUNCTION\nkrb5_prompter_posix (\n\tkrb5_context /*context*/,\n\tvoid */*data*/,\n\tconst char */*name*/,\n\tconst char */*banner*/,\n\tint /*num_prompts*/,\n\tkrb5_prompt prompts[]);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_random_to_key (\n\tkrb5_context /*context*/,\n\tkrb5_enctype /*type*/,\n\tconst void */*data*/,\n\tsize_t /*size*/,\n\tkrb5_keyblock */*key*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_rc_close (\n\tkrb5_context /*context*/,\n\tkrb5_rcache /*id*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_rc_default (\n\tkrb5_context /*context*/,\n\tkrb5_rcache */*id*/);\n\nconst char* KRB5_LIB_FUNCTION\nkrb5_rc_default_name (krb5_context /*context*/);\n\nconst char* KRB5_LIB_FUNCTION\nkrb5_rc_default_type (krb5_context /*context*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_rc_destroy (\n\tkrb5_context /*context*/,\n\tkrb5_rcache /*id*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_rc_expunge (\n\tkrb5_context /*context*/,\n\tkrb5_rcache /*id*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_rc_get_lifespan (\n\tkrb5_context /*context*/,\n\tkrb5_rcache /*id*/,\n\tkrb5_deltat */*auth_lifespan*/);\n\nconst char* KRB5_LIB_FUNCTION\nkrb5_rc_get_name (\n\tkrb5_context /*context*/,\n\tkrb5_rcache /*id*/);\n\nconst char* KRB5_LIB_FUNCTION\nkrb5_rc_get_type (\n\tkrb5_context /*context*/,\n\tkrb5_rcache /*id*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_rc_initialize (\n\tkrb5_context /*context*/,\n\tkrb5_rcache /*id*/,\n\tkrb5_deltat /*auth_lifespan*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_rc_recover (\n\tkrb5_context /*context*/,\n\tkrb5_rcache /*id*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_rc_resolve (\n\tkrb5_context /*context*/,\n\tkrb5_rcache /*id*/,\n\tconst char */*name*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_rc_resolve_full (\n\tkrb5_context /*context*/,\n\tkrb5_rcache */*id*/,\n\tconst char */*string_name*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_rc_resolve_type (\n\tkrb5_context /*context*/,\n\tkrb5_rcache */*id*/,\n\tconst char */*type*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_rc_store (\n\tkrb5_context /*context*/,\n\tkrb5_rcache /*id*/,\n\tkrb5_donot_replay */*rep*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_rd_cred (\n\tkrb5_context /*context*/,\n\tkrb5_auth_context /*auth_context*/,\n\tkrb5_data */*in_data*/,\n\tkrb5_creds ***/*ret_creds*/,\n\tkrb5_replay_data */*outdata*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_rd_cred2 (\n\tkrb5_context /*context*/,\n\tkrb5_auth_context /*auth_context*/,\n\tkrb5_ccache /*ccache*/,\n\tkrb5_data */*in_data*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_rd_error (\n\tkrb5_context /*context*/,\n\tconst krb5_data */*msg*/,\n\tKRB_ERROR */*result*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_rd_priv (\n\tkrb5_context /*context*/,\n\tkrb5_auth_context /*auth_context*/,\n\tconst krb5_data */*inbuf*/,\n\tkrb5_data */*outbuf*/,\n\tkrb5_replay_data */*outdata*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_rd_rep (\n\tkrb5_context /*context*/,\n\tkrb5_auth_context /*auth_context*/,\n\tconst krb5_data */*inbuf*/,\n\tkrb5_ap_rep_enc_part **/*repl*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_rd_req (\n\tkrb5_context /*context*/,\n\tkrb5_auth_context */*auth_context*/,\n\tconst krb5_data */*inbuf*/,\n\tkrb5_const_principal /*server*/,\n\tkrb5_keytab /*keytab*/,\n\tkrb5_flags */*ap_req_options*/,\n\tkrb5_ticket **/*ticket*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_rd_req_ctx (\n\tkrb5_context /*context*/,\n\tkrb5_auth_context */*auth_context*/,\n\tconst krb5_data */*inbuf*/,\n\tkrb5_const_principal /*server*/,\n\tkrb5_rd_req_in_ctx /*inctx*/,\n\tkrb5_rd_req_out_ctx */*outctx*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_rd_req_in_ctx_alloc (\n\tkrb5_context /*context*/,\n\tkrb5_rd_req_in_ctx */*ctx*/);\n\nvoid KRB5_LIB_FUNCTION\nkrb5_rd_req_in_ctx_free (\n\tkrb5_context /*context*/,\n\tkrb5_rd_req_in_ctx /*ctx*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_rd_req_in_set_keyblock (\n\tkrb5_context /*context*/,\n\tkrb5_rd_req_in_ctx /*in*/,\n\tkrb5_keyblock */*keyblock*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_rd_req_in_set_keytab (\n\tkrb5_context /*context*/,\n\tkrb5_rd_req_in_ctx /*in*/,\n\tkrb5_keytab /*keytab*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_rd_req_in_set_pac_check (\n\tkrb5_context /*context*/,\n\tkrb5_rd_req_in_ctx /*in*/,\n\tkrb5_boolean /*flag*/);\n\nvoid KRB5_LIB_FUNCTION\nkrb5_rd_req_out_ctx_free (\n\tkrb5_context /*context*/,\n\tkrb5_rd_req_out_ctx /*ctx*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_rd_req_out_get_ap_req_options (\n\tkrb5_context /*context*/,\n\tkrb5_rd_req_out_ctx /*out*/,\n\tkrb5_flags */*ap_req_options*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_rd_req_out_get_keyblock (\n\tkrb5_context /*context*/,\n\tkrb5_rd_req_out_ctx /*out*/,\n\tkrb5_keyblock **/*keyblock*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_rd_req_out_get_ticket (\n\tkrb5_context /*context*/,\n\tkrb5_rd_req_out_ctx /*out*/,\n\tkrb5_ticket **/*ticket*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_rd_req_with_keyblock (\n\tkrb5_context /*context*/,\n\tkrb5_auth_context */*auth_context*/,\n\tconst krb5_data */*inbuf*/,\n\tkrb5_const_principal /*server*/,\n\tkrb5_keyblock */*keyblock*/,\n\tkrb5_flags */*ap_req_options*/,\n\tkrb5_ticket **/*ticket*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_rd_safe (\n\tkrb5_context /*context*/,\n\tkrb5_auth_context /*auth_context*/,\n\tconst krb5_data */*inbuf*/,\n\tkrb5_data */*outbuf*/,\n\tkrb5_replay_data */*outdata*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_read_message (\n\tkrb5_context /*context*/,\n\tkrb5_pointer /*p_fd*/,\n\tkrb5_data */*data*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_read_priv_message (\n\tkrb5_context /*context*/,\n\tkrb5_auth_context /*ac*/,\n\tkrb5_pointer /*p_fd*/,\n\tkrb5_data */*data*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_read_safe_message (\n\tkrb5_context /*context*/,\n\tkrb5_auth_context /*ac*/,\n\tkrb5_pointer /*p_fd*/,\n\tkrb5_data */*data*/);\n\nkrb5_boolean KRB5_LIB_FUNCTION\nkrb5_realm_compare (\n\tkrb5_context /*context*/,\n\tkrb5_const_principal /*princ1*/,\n\tkrb5_const_principal /*princ2*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_recvauth (\n\tkrb5_context /*context*/,\n\tkrb5_auth_context */*auth_context*/,\n\tkrb5_pointer /*p_fd*/,\n\tconst char */*appl_version*/,\n\tkrb5_principal /*server*/,\n\tint32_t /*flags*/,\n\tkrb5_keytab /*keytab*/,\n\tkrb5_ticket **/*ticket*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_recvauth_match_version (\n\tkrb5_context /*context*/,\n\tkrb5_auth_context */*auth_context*/,\n\tkrb5_pointer /*p_fd*/,\n\tkrb5_boolean (*/*match_appl_version*/)(const void *, const char*),\n\tconst void */*match_data*/,\n\tkrb5_principal /*server*/,\n\tint32_t /*flags*/,\n\tkrb5_keytab /*keytab*/,\n\tkrb5_ticket **/*ticket*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_ret_address (\n\tkrb5_storage */*sp*/,\n\tkrb5_address */*adr*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_ret_addrs (\n\tkrb5_storage */*sp*/,\n\tkrb5_addresses */*adr*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_ret_authdata (\n\tkrb5_storage */*sp*/,\n\tkrb5_authdata */*auth*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_ret_creds (\n\tkrb5_storage */*sp*/,\n\tkrb5_creds */*creds*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_ret_creds_tag (\n\tkrb5_storage */*sp*/,\n\tkrb5_creds */*creds*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_ret_data (\n\tkrb5_storage */*sp*/,\n\tkrb5_data */*data*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_ret_int16 (\n\tkrb5_storage */*sp*/,\n\tint16_t */*value*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_ret_int32 (\n\tkrb5_storage */*sp*/,\n\tint32_t */*value*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_ret_int8 (\n\tkrb5_storage */*sp*/,\n\tint8_t */*value*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_ret_keyblock (\n\tkrb5_storage */*sp*/,\n\tkrb5_keyblock */*p*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_ret_principal (\n\tkrb5_storage */*sp*/,\n\tkrb5_principal */*princ*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_ret_string (\n\tkrb5_storage */*sp*/,\n\tchar **/*string*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_ret_stringnl (\n\tkrb5_storage */*sp*/,\n\tchar **/*string*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_ret_stringz (\n\tkrb5_storage */*sp*/,\n\tchar **/*string*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_ret_times (\n\tkrb5_storage */*sp*/,\n\tkrb5_times */*times*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_ret_uint16 (\n\tkrb5_storage */*sp*/,\n\tuint16_t */*value*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_ret_uint32 (\n\tkrb5_storage */*sp*/,\n\tuint32_t */*value*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_ret_uint8 (\n\tkrb5_storage */*sp*/,\n\tuint8_t */*value*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_salttype_to_string (\n\tkrb5_context /*context*/,\n\tkrb5_enctype /*etype*/,\n\tkrb5_salttype /*stype*/,\n\tchar **/*string*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_sendauth (\n\tkrb5_context /*context*/,\n\tkrb5_auth_context */*auth_context*/,\n\tkrb5_pointer /*p_fd*/,\n\tconst char */*appl_version*/,\n\tkrb5_principal /*client*/,\n\tkrb5_principal /*server*/,\n\tkrb5_flags /*ap_req_options*/,\n\tkrb5_data */*in_data*/,\n\tkrb5_creds */*in_creds*/,\n\tkrb5_ccache /*ccache*/,\n\tkrb5_error **/*ret_error*/,\n\tkrb5_ap_rep_enc_part **/*rep_result*/,\n\tkrb5_creds **/*out_creds*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_sendto (\n\tkrb5_context /*context*/,\n\tconst krb5_data */*send_data*/,\n\tkrb5_krbhst_handle /*handle*/,\n\tkrb5_data */*receive*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_sendto_context (\n\tkrb5_context /*context*/,\n\tkrb5_sendto_ctx /*ctx*/,\n\tconst krb5_data */*send_data*/,\n\tconst krb5_realm /*realm*/,\n\tkrb5_data */*receive*/);\n\nvoid KRB5_LIB_FUNCTION\nkrb5_sendto_ctx_add_flags (\n\tkrb5_sendto_ctx /*ctx*/,\n\tint /*flags*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_sendto_ctx_alloc (\n\tkrb5_context /*context*/,\n\tkrb5_sendto_ctx */*ctx*/);\n\nvoid KRB5_LIB_FUNCTION\nkrb5_sendto_ctx_free (\n\tkrb5_context /*context*/,\n\tkrb5_sendto_ctx /*ctx*/);\n\nint KRB5_LIB_FUNCTION\nkrb5_sendto_ctx_get_flags (krb5_sendto_ctx /*ctx*/);\n\nvoid KRB5_LIB_FUNCTION\nkrb5_sendto_ctx_set_func (\n\tkrb5_sendto_ctx /*ctx*/,\n\tkrb5_sendto_ctx_func /*func*/,\n\tvoid */*data*/);\n\nvoid KRB5_LIB_FUNCTION\nkrb5_sendto_ctx_set_type (\n\tkrb5_sendto_ctx /*ctx*/,\n\tint /*type*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_sendto_kdc (\n\tkrb5_context /*context*/,\n\tconst krb5_data */*send_data*/,\n\tconst krb5_realm */*realm*/,\n\tkrb5_data */*receive*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_sendto_kdc_flags (\n\tkrb5_context /*context*/,\n\tconst krb5_data */*send_data*/,\n\tconst krb5_realm */*realm*/,\n\tkrb5_data */*receive*/,\n\tint /*flags*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_set_config_files (\n\tkrb5_context /*context*/,\n\tchar **/*filenames*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_set_default_in_tkt_etypes (\n\tkrb5_context /*context*/,\n\tconst krb5_enctype */*etypes*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_set_default_realm (\n\tkrb5_context /*context*/,\n\tconst char */*realm*/);\n\nvoid KRB5_LIB_FUNCTION\nkrb5_set_dns_canonicalize_hostname (\n\tkrb5_context /*context*/,\n\tkrb5_boolean /*flag*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_set_error_string (\n\tkrb5_context /*context*/,\n\tconst char */*fmt*/,\n\t...)\n    __attribute__((format (printf, 2, 3)));\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_set_extra_addresses (\n\tkrb5_context /*context*/,\n\tconst krb5_addresses */*addresses*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_set_fcache_version (\n\tkrb5_context /*context*/,\n\tint /*version*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_set_ignore_addresses (\n\tkrb5_context /*context*/,\n\tconst krb5_addresses */*addresses*/);\n\nvoid KRB5_LIB_FUNCTION\nkrb5_set_max_time_skew (\n\tkrb5_context /*context*/,\n\ttime_t /*t*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_set_password (\n\tkrb5_context /*context*/,\n\tkrb5_creds */*creds*/,\n\tconst char */*newpw*/,\n\tkrb5_principal /*targprinc*/,\n\tint */*result_code*/,\n\tkrb5_data */*result_code_string*/,\n\tkrb5_data */*result_string*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_set_password_using_ccache (\n\tkrb5_context /*context*/,\n\tkrb5_ccache /*ccache*/,\n\tconst char */*newpw*/,\n\tkrb5_principal /*targprinc*/,\n\tint */*result_code*/,\n\tkrb5_data */*result_code_string*/,\n\tkrb5_data */*result_string*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_set_real_time (\n\tkrb5_context /*context*/,\n\tkrb5_timestamp /*sec*/,\n\tint32_t /*usec*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_set_send_to_kdc_func (\n\tkrb5_context /*context*/,\n\tkrb5_send_to_kdc_func /*func*/,\n\tvoid */*data*/);\n\nvoid KRB5_LIB_FUNCTION\nkrb5_set_use_admin_kdc (\n\tkrb5_context /*context*/,\n\tkrb5_boolean /*flag*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_set_warn_dest (\n\tkrb5_context /*context*/,\n\tkrb5_log_facility */*fac*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_sname_to_principal (\n\tkrb5_context /*context*/,\n\tconst char */*hostname*/,\n\tconst char */*sname*/,\n\tint32_t /*type*/,\n\tkrb5_principal */*ret_princ*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_sock_to_principal (\n\tkrb5_context /*context*/,\n\tint /*sock*/,\n\tconst char */*sname*/,\n\tint32_t /*type*/,\n\tkrb5_principal */*ret_princ*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_sockaddr2address (\n\tkrb5_context /*context*/,\n\tconst struct sockaddr */*sa*/,\n\tkrb5_address */*addr*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_sockaddr2port (\n\tkrb5_context /*context*/,\n\tconst struct sockaddr */*sa*/,\n\tint16_t */*port*/);\n\nkrb5_boolean KRB5_LIB_FUNCTION\nkrb5_sockaddr_uninteresting (const struct sockaddr */*sa*/);\n\nvoid KRB5_LIB_FUNCTION\nkrb5_std_usage (\n\tint /*code*/,\n\tstruct getargs */*args*/,\n\tint /*num_args*/);\n\nvoid KRB5_LIB_FUNCTION\nkrb5_storage_clear_flags (\n\tkrb5_storage */*sp*/,\n\tkrb5_flags /*flags*/);\n\nkrb5_storage * KRB5_LIB_FUNCTION\nkrb5_storage_emem (void);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_storage_free (krb5_storage */*sp*/);\n\nkrb5_storage * KRB5_LIB_FUNCTION\nkrb5_storage_from_data (krb5_data */*data*/);\n\nkrb5_storage * KRB5_LIB_FUNCTION\nkrb5_storage_from_fd (int /*fd*/);\n\nkrb5_storage * KRB5_LIB_FUNCTION\nkrb5_storage_from_mem (\n\tvoid */*buf*/,\n\tsize_t /*len*/);\n\nkrb5_storage * KRB5_LIB_FUNCTION\nkrb5_storage_from_readonly_mem (\n\tconst void */*buf*/,\n\tsize_t /*len*/);\n\nkrb5_flags KRB5_LIB_FUNCTION\nkrb5_storage_get_byteorder (\n\tkrb5_storage */*sp*/,\n\tkrb5_flags /*byteorder*/);\n\nkrb5_boolean KRB5_LIB_FUNCTION\nkrb5_storage_is_flags (\n\tkrb5_storage */*sp*/,\n\tkrb5_flags /*flags*/);\n\nkrb5_ssize_t KRB5_LIB_FUNCTION\nkrb5_storage_read (\n\tkrb5_storage */*sp*/,\n\tvoid */*buf*/,\n\tsize_t /*len*/);\n\noff_t KRB5_LIB_FUNCTION\nkrb5_storage_seek (\n\tkrb5_storage */*sp*/,\n\toff_t /*offset*/,\n\tint /*whence*/);\n\nvoid KRB5_LIB_FUNCTION\nkrb5_storage_set_byteorder (\n\tkrb5_storage */*sp*/,\n\tkrb5_flags /*byteorder*/);\n\nvoid KRB5_LIB_FUNCTION\nkrb5_storage_set_eof_code (\n\tkrb5_storage */*sp*/,\n\tint /*code*/);\n\nvoid KRB5_LIB_FUNCTION\nkrb5_storage_set_flags (\n\tkrb5_storage */*sp*/,\n\tkrb5_flags /*flags*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_storage_to_data (\n\tkrb5_storage */*sp*/,\n\tkrb5_data */*data*/);\n\nkrb5_ssize_t KRB5_LIB_FUNCTION\nkrb5_storage_write (\n\tkrb5_storage */*sp*/,\n\tconst void */*buf*/,\n\tsize_t /*len*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_store_address (\n\tkrb5_storage */*sp*/,\n\tkrb5_address /*p*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_store_addrs (\n\tkrb5_storage */*sp*/,\n\tkrb5_addresses /*p*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_store_authdata (\n\tkrb5_storage */*sp*/,\n\tkrb5_authdata /*auth*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_store_creds (\n\tkrb5_storage */*sp*/,\n\tkrb5_creds */*creds*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_store_creds_tag (\n\tkrb5_storage */*sp*/,\n\tkrb5_creds */*creds*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_store_data (\n\tkrb5_storage */*sp*/,\n\tkrb5_data /*data*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_store_int16 (\n\tkrb5_storage */*sp*/,\n\tint16_t /*value*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_store_int32 (\n\tkrb5_storage */*sp*/,\n\tint32_t /*value*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_store_int8 (\n\tkrb5_storage */*sp*/,\n\tint8_t /*value*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_store_keyblock (\n\tkrb5_storage */*sp*/,\n\tkrb5_keyblock /*p*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_store_principal (\n\tkrb5_storage */*sp*/,\n\tkrb5_const_principal /*p*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_store_string (\n\tkrb5_storage */*sp*/,\n\tconst char */*s*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_store_stringnl (\n\tkrb5_storage */*sp*/,\n\tconst char */*s*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_store_stringz (\n\tkrb5_storage */*sp*/,\n\tconst char */*s*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_store_times (\n\tkrb5_storage */*sp*/,\n\tkrb5_times /*times*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_store_uint16 (\n\tkrb5_storage */*sp*/,\n\tuint16_t /*value*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_store_uint32 (\n\tkrb5_storage */*sp*/,\n\tuint32_t /*value*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_store_uint8 (\n\tkrb5_storage */*sp*/,\n\tuint8_t /*value*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_string_to_deltat (\n\tconst char */*string*/,\n\tkrb5_deltat */*deltat*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_string_to_enctype (\n\tkrb5_context /*context*/,\n\tconst char */*string*/,\n\tkrb5_enctype */*etype*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_string_to_key (\n\tkrb5_context /*context*/,\n\tkrb5_enctype /*enctype*/,\n\tconst char */*password*/,\n\tkrb5_principal /*principal*/,\n\tkrb5_keyblock */*key*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_string_to_key_data (\n\tkrb5_context /*context*/,\n\tkrb5_enctype /*enctype*/,\n\tkrb5_data /*password*/,\n\tkrb5_principal /*principal*/,\n\tkrb5_keyblock */*key*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_string_to_key_data_salt (\n\tkrb5_context /*context*/,\n\tkrb5_enctype /*enctype*/,\n\tkrb5_data /*password*/,\n\tkrb5_salt /*salt*/,\n\tkrb5_keyblock */*key*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_string_to_key_data_salt_opaque (\n\tkrb5_context /*context*/,\n\tkrb5_enctype /*enctype*/,\n\tkrb5_data /*password*/,\n\tkrb5_salt /*salt*/,\n\tkrb5_data /*opaque*/,\n\tkrb5_keyblock */*key*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_string_to_key_derived (\n\tkrb5_context /*context*/,\n\tconst void */*str*/,\n\tsize_t /*len*/,\n\tkrb5_enctype /*etype*/,\n\tkrb5_keyblock */*key*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_string_to_key_salt (\n\tkrb5_context /*context*/,\n\tkrb5_enctype /*enctype*/,\n\tconst char */*password*/,\n\tkrb5_salt /*salt*/,\n\tkrb5_keyblock */*key*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_string_to_key_salt_opaque (\n\tkrb5_context /*context*/,\n\tkrb5_enctype /*enctype*/,\n\tconst char */*password*/,\n\tkrb5_salt /*salt*/,\n\tkrb5_data /*opaque*/,\n\tkrb5_keyblock */*key*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_string_to_keytype (\n\tkrb5_context /*context*/,\n\tconst char */*string*/,\n\tkrb5_keytype */*keytype*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_string_to_salttype (\n\tkrb5_context /*context*/,\n\tkrb5_enctype /*etype*/,\n\tconst char */*string*/,\n\tkrb5_salttype */*salttype*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_ticket_get_authorization_data_type (\n\tkrb5_context /*context*/,\n\tkrb5_ticket */*ticket*/,\n\tint /*type*/,\n\tkrb5_data */*data*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_ticket_get_client (\n\tkrb5_context /*context*/,\n\tconst krb5_ticket */*ticket*/,\n\tkrb5_principal */*client*/);\n\ntime_t KRB5_LIB_FUNCTION\nkrb5_ticket_get_endtime (\n\tkrb5_context /*context*/,\n\tconst krb5_ticket */*ticket*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_ticket_get_server (\n\tkrb5_context /*context*/,\n\tconst krb5_ticket */*ticket*/,\n\tkrb5_principal */*server*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_timeofday (\n\tkrb5_context /*context*/,\n\tkrb5_timestamp */*timeret*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_unparse_name (\n\tkrb5_context /*context*/,\n\tkrb5_const_principal /*principal*/,\n\tchar **/*name*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_unparse_name_fixed (\n\tkrb5_context /*context*/,\n\tkrb5_const_principal /*principal*/,\n\tchar */*name*/,\n\tsize_t /*len*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_unparse_name_fixed_flags (\n\tkrb5_context /*context*/,\n\tkrb5_const_principal /*principal*/,\n\tint /*flags*/,\n\tchar */*name*/,\n\tsize_t /*len*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_unparse_name_fixed_short (\n\tkrb5_context /*context*/,\n\tkrb5_const_principal /*principal*/,\n\tchar */*name*/,\n\tsize_t /*len*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_unparse_name_flags (\n\tkrb5_context /*context*/,\n\tkrb5_const_principal /*principal*/,\n\tint /*flags*/,\n\tchar **/*name*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_unparse_name_short (\n\tkrb5_context /*context*/,\n\tkrb5_const_principal /*principal*/,\n\tchar **/*name*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_us_timeofday (\n\tkrb5_context /*context*/,\n\tkrb5_timestamp */*sec*/,\n\tint32_t */*usec*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_vabort (\n\tkrb5_context /*context*/,\n\tkrb5_error_code /*code*/,\n\tconst char */*fmt*/,\n\tva_list /*ap*/)\n    __attribute__ ((noreturn, format (printf, 3, 0)));\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_vabortx (\n\tkrb5_context /*context*/,\n\tconst char */*fmt*/,\n\tva_list /*ap*/)\n    __attribute__ ((noreturn, format (printf, 2, 0)));\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_verify_ap_req (\n\tkrb5_context /*context*/,\n\tkrb5_auth_context */*auth_context*/,\n\tkrb5_ap_req */*ap_req*/,\n\tkrb5_const_principal /*server*/,\n\tkrb5_keyblock */*keyblock*/,\n\tkrb5_flags /*flags*/,\n\tkrb5_flags */*ap_req_options*/,\n\tkrb5_ticket **/*ticket*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_verify_ap_req2 (\n\tkrb5_context /*context*/,\n\tkrb5_auth_context */*auth_context*/,\n\tkrb5_ap_req */*ap_req*/,\n\tkrb5_const_principal /*server*/,\n\tkrb5_keyblock */*keyblock*/,\n\tkrb5_flags /*flags*/,\n\tkrb5_flags */*ap_req_options*/,\n\tkrb5_ticket **/*ticket*/,\n\tkrb5_key_usage /*usage*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_verify_authenticator_checksum (\n\tkrb5_context /*context*/,\n\tkrb5_auth_context /*ac*/,\n\tvoid */*data*/,\n\tsize_t /*len*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_verify_checksum (\n\tkrb5_context /*context*/,\n\tkrb5_crypto /*crypto*/,\n\tkrb5_key_usage /*usage*/,\n\tvoid */*data*/,\n\tsize_t /*len*/,\n\tChecksum */*cksum*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_verify_init_creds (\n\tkrb5_context /*context*/,\n\tkrb5_creds */*creds*/,\n\tkrb5_principal /*ap_req_server*/,\n\tkrb5_keytab /*ap_req_keytab*/,\n\tkrb5_ccache */*ccache*/,\n\tkrb5_verify_init_creds_opt */*options*/);\n\nvoid KRB5_LIB_FUNCTION\nkrb5_verify_init_creds_opt_init (krb5_verify_init_creds_opt */*options*/);\n\nvoid KRB5_LIB_FUNCTION\nkrb5_verify_init_creds_opt_set_ap_req_nofail (\n\tkrb5_verify_init_creds_opt */*options*/,\n\tint /*ap_req_nofail*/);\n\nint KRB5_LIB_FUNCTION\nkrb5_verify_opt_alloc (\n\tkrb5_context /*context*/,\n\tkrb5_verify_opt **/*opt*/);\n\nvoid KRB5_LIB_FUNCTION\nkrb5_verify_opt_free (krb5_verify_opt */*opt*/);\n\nvoid KRB5_LIB_FUNCTION\nkrb5_verify_opt_init (krb5_verify_opt */*opt*/);\n\nvoid KRB5_LIB_FUNCTION\nkrb5_verify_opt_set_ccache (\n\tkrb5_verify_opt */*opt*/,\n\tkrb5_ccache /*ccache*/);\n\nvoid KRB5_LIB_FUNCTION\nkrb5_verify_opt_set_flags (\n\tkrb5_verify_opt */*opt*/,\n\tunsigned int /*flags*/);\n\nvoid KRB5_LIB_FUNCTION\nkrb5_verify_opt_set_keytab (\n\tkrb5_verify_opt */*opt*/,\n\tkrb5_keytab /*keytab*/);\n\nvoid KRB5_LIB_FUNCTION\nkrb5_verify_opt_set_secure (\n\tkrb5_verify_opt */*opt*/,\n\tkrb5_boolean /*secure*/);\n\nvoid KRB5_LIB_FUNCTION\nkrb5_verify_opt_set_service (\n\tkrb5_verify_opt */*opt*/,\n\tconst char */*service*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_verify_user (\n\tkrb5_context /*context*/,\n\tkrb5_principal /*principal*/,\n\tkrb5_ccache /*ccache*/,\n\tconst char */*password*/,\n\tkrb5_boolean /*secure*/,\n\tconst char */*service*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_verify_user_lrealm (\n\tkrb5_context /*context*/,\n\tkrb5_principal /*principal*/,\n\tkrb5_ccache /*ccache*/,\n\tconst char */*password*/,\n\tkrb5_boolean /*secure*/,\n\tconst char */*service*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_verify_user_opt (\n\tkrb5_context /*context*/,\n\tkrb5_principal /*principal*/,\n\tconst char */*password*/,\n\tkrb5_verify_opt */*opt*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_verr (\n\tkrb5_context /*context*/,\n\tint /*eval*/,\n\tkrb5_error_code /*code*/,\n\tconst char */*fmt*/,\n\tva_list /*ap*/)\n    __attribute__ ((noreturn, format (printf, 4, 0)));\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_verrx (\n\tkrb5_context /*context*/,\n\tint /*eval*/,\n\tconst char */*fmt*/,\n\tva_list /*ap*/)\n    __attribute__ ((noreturn, format (printf, 3, 0)));\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_vlog (\n\tkrb5_context /*context*/,\n\tkrb5_log_facility */*fac*/,\n\tint /*level*/,\n\tconst char */*fmt*/,\n\tva_list /*ap*/)\n    __attribute__((format (printf, 4, 0)));\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_vlog_msg (\n\tkrb5_context /*context*/,\n\tkrb5_log_facility */*fac*/,\n\tchar **/*reply*/,\n\tint /*level*/,\n\tconst char */*fmt*/,\n\tva_list /*ap*/)\n    __attribute__((format (printf, 5, 0)));\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_vset_error_string (\n\tkrb5_context /*context*/,\n\tconst char */*fmt*/,\n\tva_list /*args*/)\n    __attribute__ ((format (printf, 2, 0)));\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_vwarn (\n\tkrb5_context /*context*/,\n\tkrb5_error_code /*code*/,\n\tconst char */*fmt*/,\n\tva_list /*ap*/)\n    __attribute__ ((format (printf, 3, 0)));\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_vwarnx (\n\tkrb5_context /*context*/,\n\tconst char */*fmt*/,\n\tva_list /*ap*/)\n    __attribute__ ((format (printf, 2, 0)));\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_warn (\n\tkrb5_context /*context*/,\n\tkrb5_error_code /*code*/,\n\tconst char */*fmt*/,\n\t...)\n    __attribute__ ((format (printf, 3, 4)));\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_warnx (\n\tkrb5_context /*context*/,\n\tconst char */*fmt*/,\n\t...)\n    __attribute__ ((format (printf, 2, 3)));\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_write_message (\n\tkrb5_context /*context*/,\n\tkrb5_pointer /*p_fd*/,\n\tkrb5_data */*data*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_write_priv_message (\n\tkrb5_context /*context*/,\n\tkrb5_auth_context /*ac*/,\n\tkrb5_pointer /*p_fd*/,\n\tkrb5_data */*data*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_write_safe_message (\n\tkrb5_context /*context*/,\n\tkrb5_auth_context /*ac*/,\n\tkrb5_pointer /*p_fd*/,\n\tkrb5_data */*data*/);\n\nkrb5_error_code KRB5_LIB_FUNCTION\nkrb5_xfree (void */*ptr*/);\n\n#ifdef __cplusplus\n}\n#endif\n\n#endif /* __krb5_protos_h__ */\n"
  },
  {
    "path": "freebsd-headers/krb5-types.h",
    "content": "/* krb5-types.h -- this file was generated for i386-unknown-freebsd5.0 by\n                   $Id: bits.c,v 1.22 2002/08/28 16:08:44 joda Exp $ */\n\n/* $FreeBSD: release/9.0.0/kerberos5/include/krb5-types.h 102649 2002-08-30 21:33:20Z nectar $ */\n\n#ifndef __krb5_types_h__\n#define __krb5_types_h__\n\n#include <inttypes.h>\n#include <sys/types.h>\n#include <sys/socket.h>\n\ntypedef socklen_t krb5_socklen_t;\n#include <unistd.h>\ntypedef ssize_t krb5_ssize_t;\n\n#endif /* __krb5_types_h__ */\n"
  },
  {
    "path": "freebsd-headers/krb5-v4compat.h",
    "content": "/*\n * Copyright (c) 1997 - 2003 Kungliga Tekniska Hgskolan\n * (Royal Institute of Technology, Stockholm, Sweden). \n * All rights reserved. \n *\n * Redistribution and use in source and binary forms, with or without \n * modification, are permitted provided that the following conditions \n * are met: \n *\n * 1. Redistributions of source code must retain the above copyright \n *    notice, this list of conditions and the following disclaimer. \n *\n * 2. Redistributions in binary form must reproduce the above copyright \n *    notice, this list of conditions and the following disclaimer in the \n *    documentation and/or other materials provided with the distribution. \n *\n * 3. Neither the name of the Institute nor the names of its contributors \n *    may be used to endorse or promote products derived from this software \n *    without specific prior written permission. \n *\n * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND \n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE \n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE \n * ARE DISCLAIMED.  IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE \n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL \n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS \n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) \n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT \n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY \n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF \n * SUCH DAMAGE. \n */\n\n/* $Id: krb5-v4compat.h 21575 2007-07-16 07:44:54Z lha $ */\n\n#ifndef __KRB5_V4COMPAT_H__\n#define __KRB5_V4COMPAT_H__\n\n#include \"krb_err.h\"\n\n/* \n * This file must only be included with v4 compat glue stuff in\n * heimdal sources.\n *\n * It MUST NOT be installed.\n */\n\n#define\t\tKRB_PROT_VERSION \t4\n\n#define\t\tAUTH_MSG_KDC_REQUEST\t\t\t (1<<1)\n#define \tAUTH_MSG_KDC_REPLY\t\t\t (2<<1)\n#define\t\tAUTH_MSG_APPL_REQUEST\t\t\t (3<<1)\n#define\t\tAUTH_MSG_APPL_REQUEST_MUTUAL\t\t (4<<1)\n#define\t\tAUTH_MSG_ERR_REPLY\t\t\t (5<<1)\n#define\t\tAUTH_MSG_PRIVATE\t\t\t (6<<1)\n#define\t\tAUTH_MSG_SAFE\t\t\t\t (7<<1)\n#define\t\tAUTH_MSG_APPL_ERR\t\t\t (8<<1)\n#define\t\tAUTH_MSG_KDC_FORWARD\t\t\t (9<<1)\n#define\t\tAUTH_MSG_KDC_RENEW\t\t\t(10<<1)\n#define \tAUTH_MSG_DIE\t\t\t\t(63<<1)\n\n/* General definitions */\n#define\t\tKSUCCESS\t0\n#define\t\tKFAILURE\t255\n\n/* */\n\n#define\t\tMAX_KTXT_LEN\t1250\n\n#define \tANAME_SZ\t40\n#define\t\tREALM_SZ\t40\n#define\t\tSNAME_SZ\t40\n#define\t\tINST_SZ\t\t40\n\nstruct ktext {\n    unsigned int length;\t\t/* Length of the text */\n    unsigned char dat[MAX_KTXT_LEN];\t/* The data itself */\n    uint32_t mbz;\t\t/* zero to catch runaway strings */\n};\n\nstruct credentials {\n    char    service[ANAME_SZ];\t/* Service name */\n    char    instance[INST_SZ];\t/* Instance */\n    char    realm[REALM_SZ];\t/* Auth domain */\n    char    session[8];\t\t/* Session key */\n    int     lifetime;\t\t/* Lifetime */\n    int     kvno;\t\t/* Key version number */\n    struct ktext ticket_st;\t/* The ticket itself */\n    int32_t    issue_date;\t/* The issue time */\n    char    pname[ANAME_SZ];\t/* Principal's name */\n    char    pinst[INST_SZ];\t/* Principal's instance */\n};\n\n#define TKTLIFENUMFIXED 64\n#define TKTLIFEMINFIXED 0x80\n#define TKTLIFEMAXFIXED 0xBF\n#define TKTLIFENOEXPIRE 0xFF\n#define MAXTKTLIFETIME\t(30*24*3600)\t/* 30 days */\n#ifndef NEVERDATE\n#define NEVERDATE ((time_t)0x7fffffffL)\n#endif\n\n#define\t\tKERB_ERR_NULL_KEY\t10\n\n#define \tCLOCK_SKEW\t5*60\n\n#ifndef TKT_ROOT\n#define TKT_ROOT \"/tmp/tkt\"\n#endif\n\nstruct _krb5_krb_auth_data {\n    int8_t  k_flags;\t\t/* Flags from ticket */\n    char    *pname;\t\t/* Principal's name */\n    char    *pinst;\t\t/* His Instance */\n    char    *prealm;\t\t/* His Realm */\n    uint32_t checksum;\t\t/* Data checksum (opt) */\n    krb5_keyblock session;\t/* Session Key */\n    unsigned char life;\t\t/* Life of ticket */\n    uint32_t time_sec;\t\t/* Time ticket issued */\n    uint32_t address;\t\t/* Address in ticket */\n};\n\ntime_t\t\t_krb5_krb_life_to_time (int, int);\nint\t\t_krb5_krb_time_to_life (time_t, time_t);\nkrb5_error_code\t_krb5_krb_tf_setup (krb5_context, struct credentials *,\n\t\t\t\t    const char *, int);\nkrb5_error_code\t_krb5_krb_dest_tkt(krb5_context, const char *);\n\n#define krb_time_to_life\t_krb5_krb_time_to_life\n#define krb_life_to_time\t_krb5_krb_life_to_time\n\n#endif /*  __KRB5_V4COMPAT_H__ */\n"
  },
  {
    "path": "freebsd-headers/krb5.h",
    "content": "/*\n * Copyright (c) 1997 - 2007 Kungliga Tekniska Hgskolan\n * (Royal Institute of Technology, Stockholm, Sweden). \n * All rights reserved. \n *\n * Redistribution and use in source and binary forms, with or without \n * modification, are permitted provided that the following conditions \n * are met: \n *\n * 1. Redistributions of source code must retain the above copyright \n *    notice, this list of conditions and the following disclaimer. \n *\n * 2. Redistributions in binary form must reproduce the above copyright \n *    notice, this list of conditions and the following disclaimer in the \n *    documentation and/or other materials provided with the distribution. \n *\n * 3. Neither the name of the Institute nor the names of its contributors \n *    may be used to endorse or promote products derived from this software \n *    without specific prior written permission. \n *\n * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND \n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE \n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE \n * ARE DISCLAIMED.  IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE \n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL \n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS \n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) \n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT \n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY \n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF \n * SUCH DAMAGE. \n */\n\n/* $Id: krb5.h 22100 2007-12-03 17:15:00Z lha $ */\n\n#ifndef __KRB5_H__\n#define __KRB5_H__\n\n#include <time.h>\n#include <krb5-types.h>\n\n#include <asn1_err.h>\n#include <krb5_err.h>\n#include <heim_err.h>\n#include <k524_err.h>\n\n#include <krb5_asn1.h>\n\n/* name confusion with MIT */\n#ifndef KRB5KDC_ERR_KEY_EXP\n#define KRB5KDC_ERR_KEY_EXP KRB5KDC_ERR_KEY_EXPIRED\n#endif\n\n/* simple constants */\n\n#ifndef TRUE\n#define TRUE  1\n#define FALSE 0\n#endif\n\ntypedef int krb5_boolean;\n\ntypedef int32_t krb5_error_code;\n\ntypedef int krb5_kvno;\n\ntypedef uint32_t krb5_flags;\n\ntypedef void *krb5_pointer;\ntypedef const void *krb5_const_pointer;\n\nstruct krb5_crypto_data;\ntypedef struct krb5_crypto_data *krb5_crypto;\n\nstruct krb5_get_creds_opt_data;\ntypedef struct krb5_get_creds_opt_data *krb5_get_creds_opt;\n\nstruct krb5_digest_data;\ntypedef struct krb5_digest_data *krb5_digest;\nstruct krb5_ntlm_data;\ntypedef struct krb5_ntlm_data *krb5_ntlm;\n\nstruct krb5_pac_data;\ntypedef struct krb5_pac_data *krb5_pac;\n\ntypedef struct krb5_rd_req_in_ctx_data *krb5_rd_req_in_ctx;\ntypedef struct krb5_rd_req_out_ctx_data *krb5_rd_req_out_ctx;\n\ntypedef CKSUMTYPE krb5_cksumtype;\n\ntypedef Checksum krb5_checksum;\n\ntypedef ENCTYPE krb5_enctype;\n\ntypedef heim_octet_string krb5_data;\n\n/* PKINIT related forward declarations */\nstruct ContentInfo;\nstruct krb5_pk_identity;\nstruct krb5_pk_cert;\n\n/* krb5_enc_data is a mit compat structure */\ntypedef struct krb5_enc_data {\n    krb5_enctype enctype;\n    krb5_kvno kvno;\n    krb5_data ciphertext;\n} krb5_enc_data;\n\n/* alternative names */\nenum {\n    ENCTYPE_NULL\t\t= ETYPE_NULL,\n    ENCTYPE_DES_CBC_CRC\t\t= ETYPE_DES_CBC_CRC,\n    ENCTYPE_DES_CBC_MD4\t\t= ETYPE_DES_CBC_MD4,\n    ENCTYPE_DES_CBC_MD5\t\t= ETYPE_DES_CBC_MD5,\n    ENCTYPE_DES3_CBC_MD5\t= ETYPE_DES3_CBC_MD5,\n    ENCTYPE_OLD_DES3_CBC_SHA1\t= ETYPE_OLD_DES3_CBC_SHA1,\n    ENCTYPE_SIGN_DSA_GENERATE\t= ETYPE_SIGN_DSA_GENERATE,\n    ENCTYPE_ENCRYPT_RSA_PRIV\t= ETYPE_ENCRYPT_RSA_PRIV,\n    ENCTYPE_ENCRYPT_RSA_PUB\t= ETYPE_ENCRYPT_RSA_PUB,\n    ENCTYPE_DES3_CBC_SHA1\t= ETYPE_DES3_CBC_SHA1,\n    ENCTYPE_AES128_CTS_HMAC_SHA1_96 = ETYPE_AES128_CTS_HMAC_SHA1_96,\n    ENCTYPE_AES256_CTS_HMAC_SHA1_96 = ETYPE_AES256_CTS_HMAC_SHA1_96,\n    ENCTYPE_ARCFOUR_HMAC\t= ETYPE_ARCFOUR_HMAC_MD5,\n    ENCTYPE_ARCFOUR_HMAC_MD5\t= ETYPE_ARCFOUR_HMAC_MD5,\n    ENCTYPE_ARCFOUR_HMAC_MD5_56\t= ETYPE_ARCFOUR_HMAC_MD5_56,\n    ENCTYPE_ENCTYPE_PK_CROSS\t= ETYPE_ENCTYPE_PK_CROSS,\n    ENCTYPE_DES_CBC_NONE\t= ETYPE_DES_CBC_NONE,\n    ENCTYPE_DES3_CBC_NONE\t= ETYPE_DES3_CBC_NONE,\n    ENCTYPE_DES_CFB64_NONE\t= ETYPE_DES_CFB64_NONE,\n    ENCTYPE_DES_PCBC_NONE\t= ETYPE_DES_PCBC_NONE\n};\n\ntypedef PADATA_TYPE krb5_preauthtype;\n\ntypedef enum krb5_key_usage {\n    KRB5_KU_PA_ENC_TIMESTAMP = 1,\n    /* AS-REQ PA-ENC-TIMESTAMP padata timestamp, encrypted with the\n       client key (section 5.4.1) */\n    KRB5_KU_TICKET = 2,\n    /* AS-REP Ticket and TGS-REP Ticket (includes tgs session key or\n       application session key), encrypted with the service key\n       (section 5.4.2) */\n    KRB5_KU_AS_REP_ENC_PART = 3,\n    /* AS-REP encrypted part (includes tgs session key or application\n       session key), encrypted with the client key (section 5.4.2) */\n    KRB5_KU_TGS_REQ_AUTH_DAT_SESSION = 4,\n    /* TGS-REQ KDC-REQ-BODY AuthorizationData, encrypted with the tgs\n       session key (section 5.4.1) */\n    KRB5_KU_TGS_REQ_AUTH_DAT_SUBKEY = 5,\n    /* TGS-REQ KDC-REQ-BODY AuthorizationData, encrypted with the tgs\n          authenticator subkey (section 5.4.1) */\n    KRB5_KU_TGS_REQ_AUTH_CKSUM = 6,\n    /* TGS-REQ PA-TGS-REQ padata AP-REQ Authenticator cksum, keyed\n       with the tgs session key (sections 5.3.2, 5.4.1) */\n    KRB5_KU_TGS_REQ_AUTH = 7,\n    /* TGS-REQ PA-TGS-REQ padata AP-REQ Authenticator (includes tgs\n       authenticator subkey), encrypted with the tgs session key\n       (section 5.3.2) */\n    KRB5_KU_TGS_REP_ENC_PART_SESSION = 8,\n    /* TGS-REP encrypted part (includes application session key),\n       encrypted with the tgs session key (section 5.4.2) */\n    KRB5_KU_TGS_REP_ENC_PART_SUB_KEY = 9,\n    /* TGS-REP encrypted part (includes application session key),\n       encrypted with the tgs authenticator subkey (section 5.4.2) */\n    KRB5_KU_AP_REQ_AUTH_CKSUM = 10,\n    /* AP-REQ Authenticator cksum, keyed with the application session\n       key (section 5.3.2) */\n    KRB5_KU_AP_REQ_AUTH = 11,\n    /* AP-REQ Authenticator (includes application authenticator\n       subkey), encrypted with the application session key (section\n       5.3.2) */\n    KRB5_KU_AP_REQ_ENC_PART = 12,\n    /* AP-REP encrypted part (includes application session subkey),\n       encrypted with the application session key (section 5.5.2) */\n    KRB5_KU_KRB_PRIV = 13,\n    /* KRB-PRIV encrypted part, encrypted with a key chosen by the\n       application (section 5.7.1) */\n    KRB5_KU_KRB_CRED = 14,\n    /* KRB-CRED encrypted part, encrypted with a key chosen by the\n       application (section 5.8.1) */\n    KRB5_KU_KRB_SAFE_CKSUM = 15,\n    /* KRB-SAFE cksum, keyed with a key chosen by the application\n       (section 5.6.1) */\n    KRB5_KU_OTHER_ENCRYPTED = 16,\n    /* Data which is defined in some specification outside of\n       Kerberos to be encrypted using an RFC1510 encryption type. */\n    KRB5_KU_OTHER_CKSUM = 17,\n    /* Data which is defined in some specification outside of\n       Kerberos to be checksummed using an RFC1510 checksum type. */\n    KRB5_KU_KRB_ERROR = 18,\n    /* Krb-error checksum */\n    KRB5_KU_AD_KDC_ISSUED = 19,\n    /* AD-KDCIssued checksum */\n    KRB5_KU_MANDATORY_TICKET_EXTENSION = 20,\n    /* Checksum for Mandatory Ticket Extensions */\n    KRB5_KU_AUTH_DATA_TICKET_EXTENSION = 21,\n    /* Checksum in Authorization Data in Ticket Extensions */\n    KRB5_KU_USAGE_SEAL = 22,\n    /* seal in GSSAPI krb5 mechanism */\n    KRB5_KU_USAGE_SIGN = 23,\n    /* sign in GSSAPI krb5 mechanism */\n    KRB5_KU_USAGE_SEQ = 24,\n    /* SEQ in GSSAPI krb5 mechanism */\n    KRB5_KU_USAGE_ACCEPTOR_SEAL = 22,\n    /* acceptor sign in GSSAPI CFX krb5 mechanism */\n    KRB5_KU_USAGE_ACCEPTOR_SIGN = 23,\n    /* acceptor seal in GSSAPI CFX krb5 mechanism */\n    KRB5_KU_USAGE_INITIATOR_SEAL = 24,       \n    /* initiator sign in GSSAPI CFX krb5 mechanism */\n    KRB5_KU_USAGE_INITIATOR_SIGN = 25,\n    /* initiator seal in GSSAPI CFX krb5 mechanism */\n    KRB5_KU_PA_SERVER_REFERRAL_DATA = 22,\n    /* encrypted server referral data */\n    KRB5_KU_SAM_CHECKSUM = 25,\n    /* Checksum for the SAM-CHECKSUM field */\n    KRB5_KU_SAM_ENC_TRACK_ID = 26,\n    /* Encryption of the SAM-TRACK-ID field */\n    KRB5_KU_PA_SERVER_REFERRAL = 26,\n    /* Keyusage for the server referral in a TGS req */\n    KRB5_KU_SAM_ENC_NONCE_SAD = 27,\n    /* Encryption of the SAM-NONCE-OR-SAD field */\n    KRB5_KU_DIGEST_ENCRYPT = -18,\n    /* Encryption key usage used in the digest encryption field */\n    KRB5_KU_DIGEST_OPAQUE = -19,\n    /* Checksum key usage used in the digest opaque field */\n    KRB5_KU_KRB5SIGNEDPATH = -21,\n    /* Checksum key usage on KRB5SignedPath */\n    KRB5_KU_CANONICALIZED_NAMES = -23\n    /* Checksum key usage on PA-CANONICALIZED */\n} krb5_key_usage;\n\ntypedef krb5_key_usage krb5_keyusage;\n\ntypedef enum krb5_salttype {\n    KRB5_PW_SALT = KRB5_PADATA_PW_SALT,\n    KRB5_AFS3_SALT = KRB5_PADATA_AFS3_SALT\n}krb5_salttype;\n\ntypedef struct krb5_salt {\n    krb5_salttype salttype;\n    krb5_data saltvalue;\n} krb5_salt;\n\ntypedef ETYPE_INFO krb5_preauthinfo;\n\ntypedef struct {\n    krb5_preauthtype type;\n    krb5_preauthinfo info; /* list of preauthinfo for this type */\n} krb5_preauthdata_entry;\n\ntypedef struct krb5_preauthdata {\n    unsigned len;\n    krb5_preauthdata_entry *val;\n}krb5_preauthdata;\n\ntypedef enum krb5_address_type { \n    KRB5_ADDRESS_INET     =   2,\n    KRB5_ADDRESS_NETBIOS  =  20,\n    KRB5_ADDRESS_INET6    =  24,\n    KRB5_ADDRESS_ADDRPORT = 256,\n    KRB5_ADDRESS_IPPORT   = 257\n} krb5_address_type;\n\nenum {\n  AP_OPTS_USE_SESSION_KEY = 1,\n  AP_OPTS_MUTUAL_REQUIRED = 2,\n  AP_OPTS_USE_SUBKEY = 4\t\t/* library internal */\n};\n\ntypedef HostAddress krb5_address;\n\ntypedef HostAddresses krb5_addresses;\n\ntypedef enum krb5_keytype { \n    KEYTYPE_NULL\t= 0,\n    KEYTYPE_DES\t\t= 1,\n    KEYTYPE_DES3\t= 7,\n    KEYTYPE_AES128\t= 17,\n    KEYTYPE_AES256\t= 18,\n    KEYTYPE_ARCFOUR\t= 23,\n    KEYTYPE_ARCFOUR_56\t= 24\n} krb5_keytype;\n\ntypedef EncryptionKey krb5_keyblock;\n\ntypedef AP_REQ krb5_ap_req;\n\nstruct krb5_cc_ops;\n\n#define KRB5_DEFAULT_CCFILE_ROOT \"/tmp/krb5cc_\"\n\n#define KRB5_DEFAULT_CCROOT \"FILE:\" KRB5_DEFAULT_CCFILE_ROOT\n\n#define KRB5_ACCEPT_NULL_ADDRESSES(C) \t\t\t\t\t \\\n    krb5_config_get_bool_default((C), NULL, TRUE, \t\t\t \\\n\t\t\t\t \"libdefaults\", \"accept_null_addresses\", \\\n\t\t\t\t NULL)\n\ntypedef void *krb5_cc_cursor;\n\ntypedef struct krb5_ccache_data {\n    const struct krb5_cc_ops *ops;\n    krb5_data data;\n}krb5_ccache_data;\n\ntypedef struct krb5_ccache_data *krb5_ccache;\n\ntypedef struct krb5_context_data *krb5_context;\n\ntypedef Realm krb5_realm;\ntypedef const char *krb5_const_realm; /* stupid language */\n\n#define krb5_realm_length(r) strlen(r)\n#define krb5_realm_data(r) (r)\n\ntypedef Principal krb5_principal_data;\ntypedef struct Principal *krb5_principal;\ntypedef const struct Principal *krb5_const_principal;\n\ntypedef time_t krb5_deltat;\ntypedef time_t krb5_timestamp;\n\ntypedef struct krb5_times {\n  krb5_timestamp authtime;\n  krb5_timestamp starttime;\n  krb5_timestamp endtime;\n  krb5_timestamp renew_till;\n} krb5_times;\n\ntypedef union {\n    TicketFlags b;\n    krb5_flags i;\n} krb5_ticket_flags;\n\n/* options for krb5_get_in_tkt() */\n#define KDC_OPT_FORWARDABLE\t\t(1 << 1)\n#define KDC_OPT_FORWARDED\t\t(1 << 2)\n#define KDC_OPT_PROXIABLE\t\t(1 << 3)\n#define KDC_OPT_PROXY\t\t\t(1 << 4)\n#define KDC_OPT_ALLOW_POSTDATE\t\t(1 << 5)\n#define KDC_OPT_POSTDATED\t\t(1 << 6)\n#define KDC_OPT_RENEWABLE\t\t(1 << 8)\n#define KDC_OPT_REQUEST_ANONYMOUS\t(1 << 14)\n#define KDC_OPT_DISABLE_TRANSITED_CHECK\t(1 << 26)\n#define KDC_OPT_RENEWABLE_OK\t\t(1 << 27)\n#define KDC_OPT_ENC_TKT_IN_SKEY\t\t(1 << 28)\n#define KDC_OPT_RENEW\t\t\t(1 << 30)\n#define KDC_OPT_VALIDATE\t\t(1 << 31)\n\ntypedef union {\n    KDCOptions b;\n    krb5_flags i;\n} krb5_kdc_flags;\n\n/* flags for krb5_verify_ap_req */\n\n#define KRB5_VERIFY_AP_REQ_IGNORE_INVALID\t(1 << 0)\n\n#define KRB5_GC_CACHED\t\t\t(1U << 0)\n#define KRB5_GC_USER_USER\t\t(1U << 1)\n#define KRB5_GC_EXPIRED_OK\t\t(1U << 2)\n#define KRB5_GC_NO_STORE\t\t(1U << 3)\n#define KRB5_GC_FORWARDABLE\t\t(1U << 4)\n#define KRB5_GC_NO_TRANSIT_CHECK\t(1U << 5)\n#define KRB5_GC_CONSTRAINED_DELEGATION\t(1U << 6)\n\n/* constants for compare_creds (and cc_retrieve_cred) */\n#define KRB5_TC_DONT_MATCH_REALM\t(1U << 31)\n#define KRB5_TC_MATCH_KEYTYPE\t\t(1U << 30)\n#define KRB5_TC_MATCH_KTYPE\t\tKRB5_TC_MATCH_KEYTYPE    /* MIT name */\n#define KRB5_TC_MATCH_SRV_NAMEONLY\t(1 << 29)\n#define KRB5_TC_MATCH_FLAGS_EXACT\t(1 << 28)\n#define KRB5_TC_MATCH_FLAGS\t\t(1 << 27)\n#define KRB5_TC_MATCH_TIMES_EXACT\t(1 << 26)\n#define KRB5_TC_MATCH_TIMES\t\t(1 << 25)\n#define KRB5_TC_MATCH_AUTHDATA\t\t(1 << 24)\n#define KRB5_TC_MATCH_2ND_TKT\t\t(1 << 23)\n#define KRB5_TC_MATCH_IS_SKEY\t\t(1 << 22)\n\ntypedef AuthorizationData krb5_authdata;\n\ntypedef KRB_ERROR krb5_error;\n\ntypedef struct krb5_creds {\n    krb5_principal client;\n    krb5_principal server;\n    krb5_keyblock session;\n    krb5_times times;\n    krb5_data ticket;\n    krb5_data second_ticket;\n    krb5_authdata authdata;\n    krb5_addresses addresses;\n    krb5_ticket_flags flags;\n} krb5_creds;\n\ntypedef struct krb5_cc_cache_cursor_data *krb5_cc_cache_cursor;\n\ntypedef struct krb5_cc_ops {\n    const char *prefix;\n    const char* (*get_name)(krb5_context, krb5_ccache);\n    krb5_error_code (*resolve)(krb5_context, krb5_ccache *, const char *);\n    krb5_error_code (*gen_new)(krb5_context, krb5_ccache *);\n    krb5_error_code (*init)(krb5_context, krb5_ccache, krb5_principal);\n    krb5_error_code (*destroy)(krb5_context, krb5_ccache);\n    krb5_error_code (*close)(krb5_context, krb5_ccache);\n    krb5_error_code (*store)(krb5_context, krb5_ccache, krb5_creds*);\n    krb5_error_code (*retrieve)(krb5_context, krb5_ccache, \n\t\t\t\tkrb5_flags, const krb5_creds*, krb5_creds *);\n    krb5_error_code (*get_princ)(krb5_context, krb5_ccache, krb5_principal*);\n    krb5_error_code (*get_first)(krb5_context, krb5_ccache, krb5_cc_cursor *);\n    krb5_error_code (*get_next)(krb5_context, krb5_ccache, \n\t\t\t\tkrb5_cc_cursor*, krb5_creds*);\n    krb5_error_code (*end_get)(krb5_context, krb5_ccache, krb5_cc_cursor*);\n    krb5_error_code (*remove_cred)(krb5_context, krb5_ccache, \n\t\t\t\t   krb5_flags, krb5_creds*);\n    krb5_error_code (*set_flags)(krb5_context, krb5_ccache, krb5_flags);\n    int (*get_version)(krb5_context, krb5_ccache);\n    krb5_error_code (*get_cache_first)(krb5_context, krb5_cc_cursor *);\n    krb5_error_code (*get_cache_next)(krb5_context, krb5_cc_cursor, krb5_ccache *);\n    krb5_error_code (*end_cache_get)(krb5_context, krb5_cc_cursor);\n    krb5_error_code (*move)(krb5_context, krb5_ccache, krb5_ccache);\n    krb5_error_code (*default_name)(krb5_context, char **);\n} krb5_cc_ops;\n\nstruct krb5_log_facility;\n\nstruct krb5_config_binding {\n    enum { krb5_config_string, krb5_config_list } type;\n    char *name;\n    struct krb5_config_binding *next;\n    union {\n\tchar *string;\n\tstruct krb5_config_binding *list;\n\tvoid *generic;\n    } u;\n};\n\ntypedef struct krb5_config_binding krb5_config_binding;\n\ntypedef krb5_config_binding krb5_config_section;\n\ntypedef struct krb5_ticket {\n    EncTicketPart ticket;\n    krb5_principal client;\n    krb5_principal server;\n} krb5_ticket;\n\ntypedef Authenticator krb5_authenticator_data;\n\ntypedef krb5_authenticator_data *krb5_authenticator;\n\nstruct krb5_rcache_data;\ntypedef struct krb5_rcache_data *krb5_rcache;\ntypedef Authenticator krb5_donot_replay;\n\n#define KRB5_STORAGE_HOST_BYTEORDER\t\t\t0x01 /* old */\n#define KRB5_STORAGE_PRINCIPAL_WRONG_NUM_COMPONENTS\t0x02\n#define KRB5_STORAGE_PRINCIPAL_NO_NAME_TYPE\t\t0x04\n#define KRB5_STORAGE_KEYBLOCK_KEYTYPE_TWICE\t\t0x08\n#define KRB5_STORAGE_BYTEORDER_MASK\t\t\t0x60\n#define KRB5_STORAGE_BYTEORDER_BE\t\t\t0x00 /* default */\n#define KRB5_STORAGE_BYTEORDER_LE\t\t\t0x20\n#define KRB5_STORAGE_BYTEORDER_HOST\t\t\t0x40\n#define KRB5_STORAGE_CREDS_FLAGS_WRONG_BITORDER\t\t0x80\n\nstruct krb5_storage_data;\ntypedef struct krb5_storage_data krb5_storage;\n\ntypedef struct krb5_keytab_entry {\n    krb5_principal principal;\n    krb5_kvno vno;\n    krb5_keyblock keyblock;\n    uint32_t timestamp;\n} krb5_keytab_entry;\n\ntypedef struct krb5_kt_cursor {\n    int fd;\n    krb5_storage *sp;\n    void *data;\n} krb5_kt_cursor;\n\nstruct krb5_keytab_data;\n\ntypedef struct krb5_keytab_data *krb5_keytab;\n\n#define KRB5_KT_PREFIX_MAX_LEN\t30\n\nstruct krb5_keytab_data {\n    const char *prefix;\n    krb5_error_code (*resolve)(krb5_context, const char*, krb5_keytab);\n    krb5_error_code (*get_name)(krb5_context, krb5_keytab, char*, size_t);\n    krb5_error_code (*close)(krb5_context, krb5_keytab);\n    krb5_error_code (*get)(krb5_context, krb5_keytab, krb5_const_principal, \n\t\t\t   krb5_kvno, krb5_enctype, krb5_keytab_entry*);\n    krb5_error_code (*start_seq_get)(krb5_context, krb5_keytab, krb5_kt_cursor*);\n    krb5_error_code (*next_entry)(krb5_context, krb5_keytab, \n\t\t\t\t  krb5_keytab_entry*, krb5_kt_cursor*);\n    krb5_error_code (*end_seq_get)(krb5_context, krb5_keytab, krb5_kt_cursor*);\n    krb5_error_code (*add)(krb5_context, krb5_keytab, krb5_keytab_entry*);\n    krb5_error_code (*remove)(krb5_context, krb5_keytab, krb5_keytab_entry*);\n    void *data;\n    int32_t version;\n};\n\ntypedef struct krb5_keytab_data krb5_kt_ops;\n\nstruct krb5_keytab_key_proc_args {\n    krb5_keytab keytab;\n    krb5_principal principal;\n};\n\ntypedef struct krb5_keytab_key_proc_args krb5_keytab_key_proc_args;\n\ntypedef struct krb5_replay_data {\n    krb5_timestamp timestamp;\n    int32_t usec;\n    uint32_t seq;\n} krb5_replay_data;\n\n/* flags for krb5_auth_con_setflags */\nenum {\n    KRB5_AUTH_CONTEXT_DO_TIME      \t\t= 1,\n    KRB5_AUTH_CONTEXT_RET_TIME     \t\t= 2,\n    KRB5_AUTH_CONTEXT_DO_SEQUENCE  \t\t= 4,\n    KRB5_AUTH_CONTEXT_RET_SEQUENCE \t\t= 8,\n    KRB5_AUTH_CONTEXT_PERMIT_ALL   \t\t= 16,\n    KRB5_AUTH_CONTEXT_USE_SUBKEY   \t\t= 32,\n    KRB5_AUTH_CONTEXT_CLEAR_FORWARDED_CRED\t= 64\n};\n\n/* flags for krb5_auth_con_genaddrs */\nenum {\n    KRB5_AUTH_CONTEXT_GENERATE_LOCAL_ADDR       = 1,\n    KRB5_AUTH_CONTEXT_GENERATE_LOCAL_FULL_ADDR  = 3,\n    KRB5_AUTH_CONTEXT_GENERATE_REMOTE_ADDR      = 4,\n    KRB5_AUTH_CONTEXT_GENERATE_REMOTE_FULL_ADDR = 12\n};\n\ntypedef struct krb5_auth_context_data {\n    unsigned int flags;\n\n    krb5_address *local_address;\n    krb5_address *remote_address;\n    int16_t local_port;\n    int16_t remote_port;\n    krb5_keyblock *keyblock;\n    krb5_keyblock *local_subkey;\n    krb5_keyblock *remote_subkey;\n\n    uint32_t local_seqnumber;\n    uint32_t remote_seqnumber;\n\n    krb5_authenticator authenticator;\n  \n    krb5_pointer i_vector;\n  \n    krb5_rcache rcache;\n\n    krb5_keytype keytype;\t/* requested key type ? */\n    krb5_cksumtype cksumtype;\t/* requested checksum type! */\n  \n}krb5_auth_context_data, *krb5_auth_context;\n\ntypedef struct {\n    KDC_REP kdc_rep;\n    EncKDCRepPart enc_part;\n    KRB_ERROR error;\n} krb5_kdc_rep;\n\nextern const char *heimdal_version, *heimdal_long_version;\n\ntypedef void (*krb5_log_log_func_t)(const char*, const char*, void*);\ntypedef void (*krb5_log_close_func_t)(void*);\n\ntypedef struct krb5_log_facility {\n    char *program;\n    int len;\n    struct facility *val;\n} krb5_log_facility;\n\ntypedef EncAPRepPart krb5_ap_rep_enc_part;\n\n#define KRB5_RECVAUTH_IGNORE_VERSION 1\n\n#define KRB5_SENDAUTH_VERSION \"KRB5_SENDAUTH_V1.0\"\n\n#define KRB5_TGS_NAME_SIZE (6)\n#define KRB5_TGS_NAME (\"krbtgt\")\n\n#define KRB5_DIGEST_NAME (\"digest\")\n\n/* variables */\n\nextern const char *krb5_config_file;\nextern const char *krb5_defkeyname;\n\ntypedef enum {\n    KRB5_PROMPT_TYPE_PASSWORD\t\t= 0x1,\n    KRB5_PROMPT_TYPE_NEW_PASSWORD\t= 0x2,\n    KRB5_PROMPT_TYPE_NEW_PASSWORD_AGAIN = 0x3,\n    KRB5_PROMPT_TYPE_PREAUTH\t\t= 0x4,\n    KRB5_PROMPT_TYPE_INFO\t\t= 0x5\n} krb5_prompt_type;\n\ntypedef struct _krb5_prompt {\n    const char *prompt;\n    int hidden;\n    krb5_data *reply;\n    krb5_prompt_type type;\n} krb5_prompt;\n\ntypedef int (*krb5_prompter_fct)(krb5_context /*context*/,\n\t\t\t\t void * /*data*/,\n\t\t\t\t const char * /*name*/,\n\t\t\t\t const char * /*banner*/,\n\t\t\t\t int /*num_prompts*/,\n\t\t\t\t krb5_prompt /*prompts*/[]);\ntypedef krb5_error_code (*krb5_key_proc)(krb5_context /*context*/,\n\t\t\t\t\t krb5_enctype /*type*/,\n\t\t\t\t\t krb5_salt /*salt*/,\n\t\t\t\t\t krb5_const_pointer /*keyseed*/,\n\t\t\t\t\t krb5_keyblock ** /*key*/);\ntypedef krb5_error_code (*krb5_decrypt_proc)(krb5_context /*context*/,\n\t\t\t\t\t     krb5_keyblock * /*key*/,\n\t\t\t\t\t     krb5_key_usage /*usage*/,\n\t\t\t\t\t     krb5_const_pointer /*decrypt_arg*/,\n\t\t\t\t\t     krb5_kdc_rep * /*dec_rep*/);\ntypedef krb5_error_code (*krb5_s2k_proc)(krb5_context /*context*/,\n\t\t\t\t\t krb5_enctype /*type*/,\n\t\t\t\t\t krb5_const_pointer /*keyseed*/,\n\t\t\t\t\t krb5_salt /*salt*/,\n\t\t\t\t\t krb5_data * /*s2kparms*/,\n\t\t\t\t\t krb5_keyblock ** /*key*/);\n\nstruct _krb5_get_init_creds_opt_private;\n\ntypedef struct _krb5_get_init_creds_opt {\n    krb5_flags flags;\n    krb5_deltat tkt_life;\n    krb5_deltat renew_life;\n    int forwardable;\n    int proxiable;\n    int anonymous;\n    krb5_enctype *etype_list;\n    int etype_list_length;\n    krb5_addresses *address_list;\n    /* XXX the next three should not be used, as they may be\n       removed later */\n    krb5_preauthtype *preauth_list;\n    int preauth_list_length;\n    krb5_data *salt;\n    struct _krb5_get_init_creds_opt_private *opt_private;\n} krb5_get_init_creds_opt;\n\n#define KRB5_GET_INIT_CREDS_OPT_TKT_LIFE\t0x0001\n#define KRB5_GET_INIT_CREDS_OPT_RENEW_LIFE\t0x0002\n#define KRB5_GET_INIT_CREDS_OPT_FORWARDABLE\t0x0004\n#define KRB5_GET_INIT_CREDS_OPT_PROXIABLE\t0x0008\n#define KRB5_GET_INIT_CREDS_OPT_ETYPE_LIST\t0x0010\n#define KRB5_GET_INIT_CREDS_OPT_ADDRESS_LIST\t0x0020\n#define KRB5_GET_INIT_CREDS_OPT_PREAUTH_LIST\t0x0040\n#define KRB5_GET_INIT_CREDS_OPT_SALT\t\t0x0080\n#define KRB5_GET_INIT_CREDS_OPT_ANONYMOUS\t0x0100\n#define KRB5_GET_INIT_CREDS_OPT_DISABLE_TRANSITED_CHECK\t0x0200\n\ntypedef struct _krb5_verify_init_creds_opt {\n    krb5_flags flags;\n    int ap_req_nofail;\n} krb5_verify_init_creds_opt;\n\n#define KRB5_VERIFY_INIT_CREDS_OPT_AP_REQ_NOFAIL\t0x0001\n\ntypedef struct krb5_verify_opt {\n    unsigned int flags;\n    krb5_ccache ccache;\n    krb5_keytab keytab;\n    krb5_boolean secure;\n    const char *service;\n} krb5_verify_opt;\n\n#define KRB5_VERIFY_LREALMS\t\t1\n#define KRB5_VERIFY_NO_ADDRESSES\t2\n\nextern const krb5_cc_ops krb5_acc_ops;\nextern const krb5_cc_ops krb5_fcc_ops;\nextern const krb5_cc_ops krb5_mcc_ops;\nextern const krb5_cc_ops krb5_kcm_ops;\n\nextern const krb5_kt_ops krb5_fkt_ops;\nextern const krb5_kt_ops krb5_wrfkt_ops;\nextern const krb5_kt_ops krb5_javakt_ops;\nextern const krb5_kt_ops krb5_mkt_ops;\nextern const krb5_kt_ops krb5_akf_ops;\nextern const krb5_kt_ops krb4_fkt_ops;\nextern const krb5_kt_ops krb5_srvtab_fkt_ops;\nextern const krb5_kt_ops krb5_any_ops;\n\n#define KRB5_KPASSWD_VERS_CHANGEPW      1\n#define KRB5_KPASSWD_VERS_SETPW         0xff80\n\n#define KRB5_KPASSWD_SUCCESS\t0\n#define KRB5_KPASSWD_MALFORMED\t1\n#define KRB5_KPASSWD_HARDERROR\t2\n#define KRB5_KPASSWD_AUTHERROR\t3\n#define KRB5_KPASSWD_SOFTERROR\t4\n#define KRB5_KPASSWD_ACCESSDENIED 5\n#define KRB5_KPASSWD_BAD_VERSION 6\n#define KRB5_KPASSWD_INITIAL_FLAG_NEEDED 7\n\n#define KPASSWD_PORT 464\n\n/* types for the new krbhst interface */\nstruct krb5_krbhst_data;\ntypedef struct krb5_krbhst_data *krb5_krbhst_handle;\n\n#define KRB5_KRBHST_KDC\t\t1\n#define KRB5_KRBHST_ADMIN\t2\n#define KRB5_KRBHST_CHANGEPW\t3\n#define KRB5_KRBHST_KRB524\t4\n#define KRB5_KRBHST_KCA\t\t5\n\ntypedef struct krb5_krbhst_info {\n    enum { KRB5_KRBHST_UDP,\n\t   KRB5_KRBHST_TCP,\n\t   KRB5_KRBHST_HTTP } proto;\n    unsigned short port;\n    unsigned short def_port;\n    struct addrinfo *ai;\n    struct krb5_krbhst_info *next;\n    char hostname[1]; /* has to come last */\n} krb5_krbhst_info;\n\n/* flags for krb5_krbhst_init_flags (and krb5_send_to_kdc_flags) */\nenum {\n    KRB5_KRBHST_FLAGS_MASTER      = 1,\n    KRB5_KRBHST_FLAGS_LARGE_MSG\t  = 2\n};\n\ntypedef krb5_error_code (*krb5_send_to_kdc_func)(krb5_context, \n\t\t\t\t\t\t void *, \n\t\t\t\t\t\t krb5_krbhst_info *,\n\t\t\t\t\t\t const krb5_data *,\n\t\t\t\t\t\t krb5_data *);\n\n/* flags for krb5_parse_name_flags */\nenum {\n    KRB5_PRINCIPAL_PARSE_NO_REALM = 1,\n    KRB5_PRINCIPAL_PARSE_MUST_REALM = 2,\n    KRB5_PRINCIPAL_PARSE_ENTERPRISE = 4\n};\n\n/* flags for krb5_unparse_name_flags */\nenum {\n    KRB5_PRINCIPAL_UNPARSE_SHORT = 1,\n    KRB5_PRINCIPAL_UNPARSE_NO_REALM = 2,\n    KRB5_PRINCIPAL_UNPARSE_DISPLAY = 4\n};\n\ntypedef struct krb5_sendto_ctx_data *krb5_sendto_ctx;\n\n#define KRB5_SENDTO_DONE\t0\n#define KRB5_SENDTO_RESTART\t1\n#define KRB5_SENDTO_CONTINUE\t2\n\ntypedef krb5_error_code (*krb5_sendto_ctx_func)(krb5_context, krb5_sendto_ctx, void *, const krb5_data *, int *);\n\nstruct krb5_plugin;\nenum krb5_plugin_type {\n    PLUGIN_TYPE_DATA = 1,\n    PLUGIN_TYPE_FUNC\n};\n\nstruct credentials; /* this is to keep the compiler happy */\nstruct getargs;\nstruct sockaddr;\n\n#include <krb5-protos.h>\n\n#endif /* __KRB5_H__ */\n\n"
  },
  {
    "path": "freebsd-headers/krb5_asn1.h",
    "content": "/* Generated from /usr/src/kerberos5/lib/libasn1/../../../crypto/heimdal/lib/asn1/k5.asn1 */\n/* Do not edit */\n\n#ifndef __krb5_asn1_h__\n#define __krb5_asn1_h__\n\n#include <stddef.h>\n#include <time.h>\n\n#ifndef __asn1_common_definitions__\n#define __asn1_common_definitions__\n\ntypedef struct heim_integer {\n  size_t length;\n  void *data;\n  int negative;\n} heim_integer;\n\ntypedef struct heim_octet_string {\n  size_t length;\n  void *data;\n} heim_octet_string;\n\ntypedef char *heim_general_string;\n\ntypedef char *heim_utf8_string;\n\ntypedef char *heim_printable_string;\n\ntypedef char *heim_ia5_string;\n\ntypedef struct heim_bmp_string {\n  size_t length;\n  uint16_t *data;\n} heim_bmp_string;\n\ntypedef struct heim_universal_string {\n  size_t length;\n  uint32_t *data;\n} heim_universal_string;\n\ntypedef char *heim_visible_string;\n\ntypedef struct heim_oid {\n  size_t length;\n  unsigned *components;\n} heim_oid;\n\ntypedef struct heim_bit_string {\n  size_t length;\n  void *data;\n} heim_bit_string;\n\ntypedef struct heim_octet_string heim_any;\ntypedef struct heim_octet_string heim_any_set;\n\n#define ASN1_MALLOC_ENCODE(T, B, BL, S, L, R)                  \\\n  do {                                                         \\\n    (BL) = length_##T((S));                                    \\\n    (B) = malloc((BL));                                        \\\n    if((B) == NULL) {                                          \\\n      (R) = ENOMEM;                                            \\\n    } else {                                                   \\\n      (R) = encode_##T(((unsigned char*)(B)) + (BL) - 1, (BL), \\\n                       (S), (L));                              \\\n      if((R) != 0) {                                           \\\n        free((B));                                             \\\n        (B) = NULL;                                            \\\n      }                                                        \\\n    }                                                          \\\n  } while (0)\n\nstruct units;\n\n#endif\n\n/*\nNAME-TYPE ::= INTEGER {\n  KRB5_NT_UNKNOWN(0),\n  KRB5_NT_PRINCIPAL(1),\n  KRB5_NT_SRV_INST(2),\n  KRB5_NT_SRV_HST(3),\n  KRB5_NT_SRV_XHST(4),\n  KRB5_NT_UID(5),\n  KRB5_NT_X500_PRINCIPAL(6),\n  KRB5_NT_SMTP_NAME(7),\n  KRB5_NT_ENTERPRISE_PRINCIPAL(10),\n  KRB5_NT_ENT_PRINCIPAL_AND_ID(-130),\n  KRB5_NT_MS_PRINCIPAL(-128),\n  KRB5_NT_MS_PRINCIPAL_AND_ID(-129)\n}\n*/\n\ntypedef enum NAME_TYPE {\n  KRB5_NT_UNKNOWN = 0,\n  KRB5_NT_PRINCIPAL = 1,\n  KRB5_NT_SRV_INST = 2,\n  KRB5_NT_SRV_HST = 3,\n  KRB5_NT_SRV_XHST = 4,\n  KRB5_NT_UID = 5,\n  KRB5_NT_X500_PRINCIPAL = 6,\n  KRB5_NT_SMTP_NAME = 7,\n  KRB5_NT_ENTERPRISE_PRINCIPAL = 10,\n  KRB5_NT_ENT_PRINCIPAL_AND_ID = -130,\n  KRB5_NT_MS_PRINCIPAL = -128,\n  KRB5_NT_MS_PRINCIPAL_AND_ID = -129\n} NAME_TYPE;\n\nint    encode_NAME_TYPE(unsigned char *, size_t, const NAME_TYPE *, size_t *);\nint    decode_NAME_TYPE(const unsigned char *, size_t, NAME_TYPE *, size_t *);\nvoid   free_NAME_TYPE  (NAME_TYPE *);\nsize_t length_NAME_TYPE(const NAME_TYPE *);\nint    copy_NAME_TYPE  (const NAME_TYPE *, NAME_TYPE *);\n\n\n/*\nMESSAGE-TYPE ::= INTEGER {\n  krb_as_req(10),\n  krb_as_rep(11),\n  krb_tgs_req(12),\n  krb_tgs_rep(13),\n  krb_ap_req(14),\n  krb_ap_rep(15),\n  krb_safe(20),\n  krb_priv(21),\n  krb_cred(22),\n  krb_error(30)\n}\n*/\n\ntypedef enum MESSAGE_TYPE {\n  krb_as_req = 10,\n  krb_as_rep = 11,\n  krb_tgs_req = 12,\n  krb_tgs_rep = 13,\n  krb_ap_req = 14,\n  krb_ap_rep = 15,\n  krb_safe = 20,\n  krb_priv = 21,\n  krb_cred = 22,\n  krb_error = 30\n} MESSAGE_TYPE;\n\nint    encode_MESSAGE_TYPE(unsigned char *, size_t, const MESSAGE_TYPE *, size_t *);\nint    decode_MESSAGE_TYPE(const unsigned char *, size_t, MESSAGE_TYPE *, size_t *);\nvoid   free_MESSAGE_TYPE  (MESSAGE_TYPE *);\nsize_t length_MESSAGE_TYPE(const MESSAGE_TYPE *);\nint    copy_MESSAGE_TYPE  (const MESSAGE_TYPE *, MESSAGE_TYPE *);\n\n\n/*\nPADATA-TYPE ::= INTEGER {\n  KRB5_PADATA_NONE(0),\n  KRB5_PADATA_TGS_REQ(1),\n  KRB5_PADATA_AP_REQ(1),\n  KRB5_PADATA_ENC_TIMESTAMP(2),\n  KRB5_PADATA_PW_SALT(3),\n  KRB5_PADATA_ENC_UNIX_TIME(5),\n  KRB5_PADATA_SANDIA_SECUREID(6),\n  KRB5_PADATA_SESAME(7),\n  KRB5_PADATA_OSF_DCE(8),\n  KRB5_PADATA_CYBERSAFE_SECUREID(9),\n  KRB5_PADATA_AFS3_SALT(10),\n  KRB5_PADATA_ETYPE_INFO(11),\n  KRB5_PADATA_SAM_CHALLENGE(12),\n  KRB5_PADATA_SAM_RESPONSE(13),\n  KRB5_PADATA_PK_AS_REQ_19(14),\n  KRB5_PADATA_PK_AS_REP_19(15),\n  KRB5_PADATA_PK_AS_REQ_WIN(15),\n  KRB5_PADATA_PK_AS_REQ(16),\n  KRB5_PADATA_PK_AS_REP(17),\n  KRB5_PADATA_PA_PK_OCSP_RESPONSE(18),\n  KRB5_PADATA_ETYPE_INFO2(19),\n  KRB5_PADATA_USE_SPECIFIED_KVNO(20),\n  KRB5_PADATA_SVR_REFERRAL_INFO(20),\n  KRB5_PADATA_SAM_REDIRECT(21),\n  KRB5_PADATA_GET_FROM_TYPED_DATA(22),\n  KRB5_PADATA_SAM_ETYPE_INFO(23),\n  KRB5_PADATA_SERVER_REFERRAL(25),\n  KRB5_PADATA_TD_KRB_PRINCIPAL(102),\n  KRB5_PADATA_PK_TD_TRUSTED_CERTIFIERS(104),\n  KRB5_PADATA_PK_TD_CERTIFICATE_INDEX(105),\n  KRB5_PADATA_TD_APP_DEFINED_ERROR(106),\n  KRB5_PADATA_TD_REQ_NONCE(107),\n  KRB5_PADATA_TD_REQ_SEQ(108),\n  KRB5_PADATA_PA_PAC_REQUEST(128),\n  KRB5_PADATA_S4U2SELF(129),\n  KRB5_PADATA_PK_AS_09_BINDING(132),\n  KRB5_PADATA_CLIENT_CANONICALIZED(133)\n}\n*/\n\ntypedef enum PADATA_TYPE {\n  KRB5_PADATA_NONE = 0,\n  KRB5_PADATA_TGS_REQ = 1,\n  KRB5_PADATA_AP_REQ = 1,\n  KRB5_PADATA_ENC_TIMESTAMP = 2,\n  KRB5_PADATA_PW_SALT = 3,\n  KRB5_PADATA_ENC_UNIX_TIME = 5,\n  KRB5_PADATA_SANDIA_SECUREID = 6,\n  KRB5_PADATA_SESAME = 7,\n  KRB5_PADATA_OSF_DCE = 8,\n  KRB5_PADATA_CYBERSAFE_SECUREID = 9,\n  KRB5_PADATA_AFS3_SALT = 10,\n  KRB5_PADATA_ETYPE_INFO = 11,\n  KRB5_PADATA_SAM_CHALLENGE = 12,\n  KRB5_PADATA_SAM_RESPONSE = 13,\n  KRB5_PADATA_PK_AS_REQ_19 = 14,\n  KRB5_PADATA_PK_AS_REP_19 = 15,\n  KRB5_PADATA_PK_AS_REQ_WIN = 15,\n  KRB5_PADATA_PK_AS_REQ = 16,\n  KRB5_PADATA_PK_AS_REP = 17,\n  KRB5_PADATA_PA_PK_OCSP_RESPONSE = 18,\n  KRB5_PADATA_ETYPE_INFO2 = 19,\n  KRB5_PADATA_USE_SPECIFIED_KVNO = 20,\n  KRB5_PADATA_SVR_REFERRAL_INFO = 20,\n  KRB5_PADATA_SAM_REDIRECT = 21,\n  KRB5_PADATA_GET_FROM_TYPED_DATA = 22,\n  KRB5_PADATA_SAM_ETYPE_INFO = 23,\n  KRB5_PADATA_SERVER_REFERRAL = 25,\n  KRB5_PADATA_TD_KRB_PRINCIPAL = 102,\n  KRB5_PADATA_PK_TD_TRUSTED_CERTIFIERS = 104,\n  KRB5_PADATA_PK_TD_CERTIFICATE_INDEX = 105,\n  KRB5_PADATA_TD_APP_DEFINED_ERROR = 106,\n  KRB5_PADATA_TD_REQ_NONCE = 107,\n  KRB5_PADATA_TD_REQ_SEQ = 108,\n  KRB5_PADATA_PA_PAC_REQUEST = 128,\n  KRB5_PADATA_S4U2SELF = 129,\n  KRB5_PADATA_PK_AS_09_BINDING = 132,\n  KRB5_PADATA_CLIENT_CANONICALIZED = 133\n} PADATA_TYPE;\n\nint    encode_PADATA_TYPE(unsigned char *, size_t, const PADATA_TYPE *, size_t *);\nint    decode_PADATA_TYPE(const unsigned char *, size_t, PADATA_TYPE *, size_t *);\nvoid   free_PADATA_TYPE  (PADATA_TYPE *);\nsize_t length_PADATA_TYPE(const PADATA_TYPE *);\nint    copy_PADATA_TYPE  (const PADATA_TYPE *, PADATA_TYPE *);\n\n\n/*\nAUTHDATA-TYPE ::= INTEGER {\n  KRB5_AUTHDATA_IF_RELEVANT(1),\n  KRB5_AUTHDATA_INTENDED_FOR_SERVER(2),\n  KRB5_AUTHDATA_INTENDED_FOR_APPLICATION_CLASS(3),\n  KRB5_AUTHDATA_KDC_ISSUED(4),\n  KRB5_AUTHDATA_AND_OR(5),\n  KRB5_AUTHDATA_MANDATORY_TICKET_EXTENSIONS(6),\n  KRB5_AUTHDATA_IN_TICKET_EXTENSIONS(7),\n  KRB5_AUTHDATA_MANDATORY_FOR_KDC(8),\n  KRB5_AUTHDATA_INITIAL_VERIFIED_CAS(9),\n  KRB5_AUTHDATA_OSF_DCE(64),\n  KRB5_AUTHDATA_SESAME(65),\n  KRB5_AUTHDATA_OSF_DCE_PKI_CERTID(66),\n  KRB5_AUTHDATA_WIN2K_PAC(128),\n  KRB5_AUTHDATA_GSS_API_ETYPE_NEGOTIATION(129),\n  KRB5_AUTHDATA_SIGNTICKET(-17)\n}\n*/\n\ntypedef enum AUTHDATA_TYPE {\n  KRB5_AUTHDATA_IF_RELEVANT = 1,\n  KRB5_AUTHDATA_INTENDED_FOR_SERVER = 2,\n  KRB5_AUTHDATA_INTENDED_FOR_APPLICATION_CLASS = 3,\n  KRB5_AUTHDATA_KDC_ISSUED = 4,\n  KRB5_AUTHDATA_AND_OR = 5,\n  KRB5_AUTHDATA_MANDATORY_TICKET_EXTENSIONS = 6,\n  KRB5_AUTHDATA_IN_TICKET_EXTENSIONS = 7,\n  KRB5_AUTHDATA_MANDATORY_FOR_KDC = 8,\n  KRB5_AUTHDATA_INITIAL_VERIFIED_CAS = 9,\n  KRB5_AUTHDATA_OSF_DCE = 64,\n  KRB5_AUTHDATA_SESAME = 65,\n  KRB5_AUTHDATA_OSF_DCE_PKI_CERTID = 66,\n  KRB5_AUTHDATA_WIN2K_PAC = 128,\n  KRB5_AUTHDATA_GSS_API_ETYPE_NEGOTIATION = 129,\n  KRB5_AUTHDATA_SIGNTICKET = -17\n} AUTHDATA_TYPE;\n\nint    encode_AUTHDATA_TYPE(unsigned char *, size_t, const AUTHDATA_TYPE *, size_t *);\nint    decode_AUTHDATA_TYPE(const unsigned char *, size_t, AUTHDATA_TYPE *, size_t *);\nvoid   free_AUTHDATA_TYPE  (AUTHDATA_TYPE *);\nsize_t length_AUTHDATA_TYPE(const AUTHDATA_TYPE *);\nint    copy_AUTHDATA_TYPE  (const AUTHDATA_TYPE *, AUTHDATA_TYPE *);\n\n\n/*\nCKSUMTYPE ::= INTEGER {\n  CKSUMTYPE_NONE(0),\n  CKSUMTYPE_CRC32(1),\n  CKSUMTYPE_RSA_MD4(2),\n  CKSUMTYPE_RSA_MD4_DES(3),\n  CKSUMTYPE_DES_MAC(4),\n  CKSUMTYPE_DES_MAC_K(5),\n  CKSUMTYPE_RSA_MD4_DES_K(6),\n  CKSUMTYPE_RSA_MD5(7),\n  CKSUMTYPE_RSA_MD5_DES(8),\n  CKSUMTYPE_RSA_MD5_DES3(9),\n  CKSUMTYPE_SHA1_OTHER(10),\n  CKSUMTYPE_HMAC_SHA1_DES3(12),\n  CKSUMTYPE_SHA1(14),\n  CKSUMTYPE_HMAC_SHA1_96_AES_128(15),\n  CKSUMTYPE_HMAC_SHA1_96_AES_256(16),\n  CKSUMTYPE_GSSAPI(32771),\n  CKSUMTYPE_HMAC_MD5(-138),\n  CKSUMTYPE_HMAC_MD5_ENC(-1138)\n}\n*/\n\ntypedef enum CKSUMTYPE {\n  CKSUMTYPE_NONE = 0,\n  CKSUMTYPE_CRC32 = 1,\n  CKSUMTYPE_RSA_MD4 = 2,\n  CKSUMTYPE_RSA_MD4_DES = 3,\n  CKSUMTYPE_DES_MAC = 4,\n  CKSUMTYPE_DES_MAC_K = 5,\n  CKSUMTYPE_RSA_MD4_DES_K = 6,\n  CKSUMTYPE_RSA_MD5 = 7,\n  CKSUMTYPE_RSA_MD5_DES = 8,\n  CKSUMTYPE_RSA_MD5_DES3 = 9,\n  CKSUMTYPE_SHA1_OTHER = 10,\n  CKSUMTYPE_HMAC_SHA1_DES3 = 12,\n  CKSUMTYPE_SHA1 = 14,\n  CKSUMTYPE_HMAC_SHA1_96_AES_128 = 15,\n  CKSUMTYPE_HMAC_SHA1_96_AES_256 = 16,\n  CKSUMTYPE_GSSAPI = 32771,\n  CKSUMTYPE_HMAC_MD5 = -138,\n  CKSUMTYPE_HMAC_MD5_ENC = -1138\n} CKSUMTYPE;\n\nint    encode_CKSUMTYPE(unsigned char *, size_t, const CKSUMTYPE *, size_t *);\nint    decode_CKSUMTYPE(const unsigned char *, size_t, CKSUMTYPE *, size_t *);\nvoid   free_CKSUMTYPE  (CKSUMTYPE *);\nsize_t length_CKSUMTYPE(const CKSUMTYPE *);\nint    copy_CKSUMTYPE  (const CKSUMTYPE *, CKSUMTYPE *);\n\n\n/*\nENCTYPE ::= INTEGER {\n  ETYPE_NULL(0),\n  ETYPE_DES_CBC_CRC(1),\n  ETYPE_DES_CBC_MD4(2),\n  ETYPE_DES_CBC_MD5(3),\n  ETYPE_DES3_CBC_MD5(5),\n  ETYPE_OLD_DES3_CBC_SHA1(7),\n  ETYPE_SIGN_DSA_GENERATE(8),\n  ETYPE_ENCRYPT_RSA_PRIV(9),\n  ETYPE_ENCRYPT_RSA_PUB(10),\n  ETYPE_DES3_CBC_SHA1(16),\n  ETYPE_AES128_CTS_HMAC_SHA1_96(17),\n  ETYPE_AES256_CTS_HMAC_SHA1_96(18),\n  ETYPE_ARCFOUR_HMAC_MD5(23),\n  ETYPE_ARCFOUR_HMAC_MD5_56(24),\n  ETYPE_ENCTYPE_PK_CROSS(48),\n  ETYPE_ARCFOUR_MD4(-128),\n  ETYPE_ARCFOUR_HMAC_OLD(-133),\n  ETYPE_ARCFOUR_HMAC_OLD_EXP(-135),\n  ETYPE_DES_CBC_NONE(-4096),\n  ETYPE_DES3_CBC_NONE(-4097),\n  ETYPE_DES_CFB64_NONE(-4098),\n  ETYPE_DES_PCBC_NONE(-4099),\n  ETYPE_DIGEST_MD5_NONE(-4100),\n  ETYPE_CRAM_MD5_NONE(-4101)\n}\n*/\n\ntypedef enum ENCTYPE {\n  ETYPE_NULL = 0,\n  ETYPE_DES_CBC_CRC = 1,\n  ETYPE_DES_CBC_MD4 = 2,\n  ETYPE_DES_CBC_MD5 = 3,\n  ETYPE_DES3_CBC_MD5 = 5,\n  ETYPE_OLD_DES3_CBC_SHA1 = 7,\n  ETYPE_SIGN_DSA_GENERATE = 8,\n  ETYPE_ENCRYPT_RSA_PRIV = 9,\n  ETYPE_ENCRYPT_RSA_PUB = 10,\n  ETYPE_DES3_CBC_SHA1 = 16,\n  ETYPE_AES128_CTS_HMAC_SHA1_96 = 17,\n  ETYPE_AES256_CTS_HMAC_SHA1_96 = 18,\n  ETYPE_ARCFOUR_HMAC_MD5 = 23,\n  ETYPE_ARCFOUR_HMAC_MD5_56 = 24,\n  ETYPE_ENCTYPE_PK_CROSS = 48,\n  ETYPE_ARCFOUR_MD4 = -128,\n  ETYPE_ARCFOUR_HMAC_OLD = -133,\n  ETYPE_ARCFOUR_HMAC_OLD_EXP = -135,\n  ETYPE_DES_CBC_NONE = -4096,\n  ETYPE_DES3_CBC_NONE = -4097,\n  ETYPE_DES_CFB64_NONE = -4098,\n  ETYPE_DES_PCBC_NONE = -4099,\n  ETYPE_DIGEST_MD5_NONE = -4100,\n  ETYPE_CRAM_MD5_NONE = -4101\n} ENCTYPE;\n\nint    encode_ENCTYPE(unsigned char *, size_t, const ENCTYPE *, size_t *);\nint    decode_ENCTYPE(const unsigned char *, size_t, ENCTYPE *, size_t *);\nvoid   free_ENCTYPE  (ENCTYPE *);\nsize_t length_ENCTYPE(const ENCTYPE *);\nint    copy_ENCTYPE  (const ENCTYPE *, ENCTYPE *);\n\n\n/*\nkrb5uint32 ::= INTEGER (0..-1)\n*/\n\ntypedef unsigned int krb5uint32;\n\nint    encode_krb5uint32(unsigned char *, size_t, const krb5uint32 *, size_t *);\nint    decode_krb5uint32(const unsigned char *, size_t, krb5uint32 *, size_t *);\nvoid   free_krb5uint32  (krb5uint32 *);\nsize_t length_krb5uint32(const krb5uint32 *);\nint    copy_krb5uint32  (const krb5uint32 *, krb5uint32 *);\n\n\n/*\nkrb5int32 ::= INTEGER (-2147483648..2147483647)\n*/\n\ntypedef int krb5int32;\n\nint    encode_krb5int32(unsigned char *, size_t, const krb5int32 *, size_t *);\nint    decode_krb5int32(const unsigned char *, size_t, krb5int32 *, size_t *);\nvoid   free_krb5int32  (krb5int32 *);\nsize_t length_krb5int32(const krb5int32 *);\nint    copy_krb5int32  (const krb5int32 *, krb5int32 *);\n\n\n/*\nKerberosString ::= GeneralString\n*/\n\ntypedef heim_general_string KerberosString;\n\nint    encode_KerberosString(unsigned char *, size_t, const KerberosString *, size_t *);\nint    decode_KerberosString(const unsigned char *, size_t, KerberosString *, size_t *);\nvoid   free_KerberosString  (KerberosString *);\nsize_t length_KerberosString(const KerberosString *);\nint    copy_KerberosString  (const KerberosString *, KerberosString *);\n\n\n/*\nRealm ::= GeneralString\n*/\n\ntypedef heim_general_string Realm;\n\nint    encode_Realm(unsigned char *, size_t, const Realm *, size_t *);\nint    decode_Realm(const unsigned char *, size_t, Realm *, size_t *);\nvoid   free_Realm  (Realm *);\nsize_t length_Realm(const Realm *);\nint    copy_Realm  (const Realm *, Realm *);\n\n\n/*\nPrincipalName ::= SEQUENCE {\n  name-type       [0] NAME-TYPE,\n  name-string     [1] SEQUENCE OF GeneralString,\n}\n*/\n\ntypedef struct PrincipalName {\n  NAME_TYPE name_type;\n  struct  {\n    unsigned int len;\n    heim_general_string *val;\n  } name_string;\n} PrincipalName;\n\nint    encode_PrincipalName(unsigned char *, size_t, const PrincipalName *, size_t *);\nint    decode_PrincipalName(const unsigned char *, size_t, PrincipalName *, size_t *);\nvoid   free_PrincipalName  (PrincipalName *);\nsize_t length_PrincipalName(const PrincipalName *);\nint    copy_PrincipalName  (const PrincipalName *, PrincipalName *);\n\n\n/*\nPrincipal ::= SEQUENCE {\n  name            [0] PrincipalName,\n  realm           [1] Realm,\n}\n*/\n\ntypedef struct Principal {\n  PrincipalName name;\n  Realm realm;\n} Principal;\n\nint    encode_Principal(unsigned char *, size_t, const Principal *, size_t *);\nint    decode_Principal(const unsigned char *, size_t, Principal *, size_t *);\nvoid   free_Principal  (Principal *);\nsize_t length_Principal(const Principal *);\nint    copy_Principal  (const Principal *, Principal *);\n\n\n/*\nHostAddress ::= SEQUENCE {\n  addr-type       [0] krb5int32,\n  address         [1] OCTET STRING,\n}\n*/\n\ntypedef struct HostAddress {\n  krb5int32 addr_type;\n  heim_octet_string address;\n} HostAddress;\n\nint    encode_HostAddress(unsigned char *, size_t, const HostAddress *, size_t *);\nint    decode_HostAddress(const unsigned char *, size_t, HostAddress *, size_t *);\nvoid   free_HostAddress  (HostAddress *);\nsize_t length_HostAddress(const HostAddress *);\nint    copy_HostAddress  (const HostAddress *, HostAddress *);\n\n\n/*\nHostAddresses ::= SEQUENCE OF HostAddress\n*/\n\ntypedef struct HostAddresses {\n  unsigned int len;\n  HostAddress *val;\n} HostAddresses;\n\nint    encode_HostAddresses(unsigned char *, size_t, const HostAddresses *, size_t *);\nint    decode_HostAddresses(const unsigned char *, size_t, HostAddresses *, size_t *);\nvoid   free_HostAddresses  (HostAddresses *);\nsize_t length_HostAddresses(const HostAddresses *);\nint    copy_HostAddresses  (const HostAddresses *, HostAddresses *);\n\n\n/*\nKerberosTime ::= GeneralizedTime\n*/\n\ntypedef time_t KerberosTime;\n\nint    encode_KerberosTime(unsigned char *, size_t, const KerberosTime *, size_t *);\nint    decode_KerberosTime(const unsigned char *, size_t, KerberosTime *, size_t *);\nvoid   free_KerberosTime  (KerberosTime *);\nsize_t length_KerberosTime(const KerberosTime *);\nint    copy_KerberosTime  (const KerberosTime *, KerberosTime *);\n\n\n/*\nAuthorizationDataElement ::= SEQUENCE {\n  ad-type         [0] krb5int32,\n  ad-data         [1] OCTET STRING,\n}\n*/\n\ntypedef struct AuthorizationDataElement {\n  krb5int32 ad_type;\n  heim_octet_string ad_data;\n} AuthorizationDataElement;\n\nint    encode_AuthorizationDataElement(unsigned char *, size_t, const AuthorizationDataElement *, size_t *);\nint    decode_AuthorizationDataElement(const unsigned char *, size_t, AuthorizationDataElement *, size_t *);\nvoid   free_AuthorizationDataElement  (AuthorizationDataElement *);\nsize_t length_AuthorizationDataElement(const AuthorizationDataElement *);\nint    copy_AuthorizationDataElement  (const AuthorizationDataElement *, AuthorizationDataElement *);\n\n\n/*\nAuthorizationData ::= SEQUENCE OF AuthorizationDataElement\n*/\n\ntypedef struct AuthorizationData {\n  unsigned int len;\n  AuthorizationDataElement *val;\n} AuthorizationData;\n\nint    encode_AuthorizationData(unsigned char *, size_t, const AuthorizationData *, size_t *);\nint    decode_AuthorizationData(const unsigned char *, size_t, AuthorizationData *, size_t *);\nvoid   free_AuthorizationData  (AuthorizationData *);\nsize_t length_AuthorizationData(const AuthorizationData *);\nint    copy_AuthorizationData  (const AuthorizationData *, AuthorizationData *);\nint   add_AuthorizationData  (AuthorizationData *, const AuthorizationDataElement *);\nint   remove_AuthorizationData  (AuthorizationData *, unsigned int);\n\n\n/*\nAPOptions ::= BIT STRING {\n  reserved(0),\n  use-session-key(1),\n  mutual-required(2)\n}\n*/\n\ntypedef struct APOptions {\n  unsigned int reserved:1;\n  unsigned int use_session_key:1;\n  unsigned int mutual_required:1;\n} APOptions;\n\n\nint    encode_APOptions(unsigned char *, size_t, const APOptions *, size_t *);\nint    decode_APOptions(const unsigned char *, size_t, APOptions *, size_t *);\nvoid   free_APOptions  (APOptions *);\nsize_t length_APOptions(const APOptions *);\nint    copy_APOptions  (const APOptions *, APOptions *);\nunsigned APOptions2int(APOptions);\nAPOptions int2APOptions(unsigned);\n#ifdef __PARSE_UNITS_H__\nconst struct units * asn1_APOptions_units(void);\n#endif\n\n\n/*\nTicketFlags ::= BIT STRING {\n  reserved(0),\n  forwardable(1),\n  forwarded(2),\n  proxiable(3),\n  proxy(4),\n  may-postdate(5),\n  postdated(6),\n  invalid(7),\n  renewable(8),\n  initial(9),\n  pre-authent(10),\n  hw-authent(11),\n  transited-policy-checked(12),\n  ok-as-delegate(13),\n  anonymous(14)\n}\n*/\n\ntypedef struct TicketFlags {\n  unsigned int reserved:1;\n  unsigned int forwardable:1;\n  unsigned int forwarded:1;\n  unsigned int proxiable:1;\n  unsigned int proxy:1;\n  unsigned int may_postdate:1;\n  unsigned int postdated:1;\n  unsigned int invalid:1;\n  unsigned int renewable:1;\n  unsigned int initial:1;\n  unsigned int pre_authent:1;\n  unsigned int hw_authent:1;\n  unsigned int transited_policy_checked:1;\n  unsigned int ok_as_delegate:1;\n  unsigned int anonymous:1;\n} TicketFlags;\n\n\nint    encode_TicketFlags(unsigned char *, size_t, const TicketFlags *, size_t *);\nint    decode_TicketFlags(const unsigned char *, size_t, TicketFlags *, size_t *);\nvoid   free_TicketFlags  (TicketFlags *);\nsize_t length_TicketFlags(const TicketFlags *);\nint    copy_TicketFlags  (const TicketFlags *, TicketFlags *);\nunsigned TicketFlags2int(TicketFlags);\nTicketFlags int2TicketFlags(unsigned);\n#ifdef __PARSE_UNITS_H__\nconst struct units * asn1_TicketFlags_units(void);\n#endif\n\n\n/*\nKDCOptions ::= BIT STRING {\n  reserved(0),\n  forwardable(1),\n  forwarded(2),\n  proxiable(3),\n  proxy(4),\n  allow-postdate(5),\n  postdated(6),\n  unused7(7),\n  renewable(8),\n  unused9(9),\n  unused10(10),\n  unused11(11),\n  request-anonymous(14),\n  canonicalize(15),\n  constrained-delegation(16),\n  disable-transited-check(26),\n  renewable-ok(27),\n  enc-tkt-in-skey(28),\n  renew(30),\n  validate(31)\n}\n*/\n\ntypedef struct KDCOptions {\n  unsigned int reserved:1;\n  unsigned int forwardable:1;\n  unsigned int forwarded:1;\n  unsigned int proxiable:1;\n  unsigned int proxy:1;\n  unsigned int allow_postdate:1;\n  unsigned int postdated:1;\n  unsigned int unused7:1;\n  unsigned int renewable:1;\n  unsigned int unused9:1;\n  unsigned int unused10:1;\n  unsigned int unused11:1;\n  unsigned int request_anonymous:1;\n  unsigned int canonicalize:1;\n  unsigned int constrained_delegation:1;\n  unsigned int disable_transited_check:1;\n  unsigned int renewable_ok:1;\n  unsigned int enc_tkt_in_skey:1;\n  unsigned int renew:1;\n  unsigned int validate:1;\n} KDCOptions;\n\n\nint    encode_KDCOptions(unsigned char *, size_t, const KDCOptions *, size_t *);\nint    decode_KDCOptions(const unsigned char *, size_t, KDCOptions *, size_t *);\nvoid   free_KDCOptions  (KDCOptions *);\nsize_t length_KDCOptions(const KDCOptions *);\nint    copy_KDCOptions  (const KDCOptions *, KDCOptions *);\nunsigned KDCOptions2int(KDCOptions);\nKDCOptions int2KDCOptions(unsigned);\n#ifdef __PARSE_UNITS_H__\nconst struct units * asn1_KDCOptions_units(void);\n#endif\n\n\n/*\nLR-TYPE ::= INTEGER {\n  LR_NONE(0),\n  LR_INITIAL_TGT(1),\n  LR_INITIAL(2),\n  LR_ISSUE_USE_TGT(3),\n  LR_RENEWAL(4),\n  LR_REQUEST(5),\n  LR_PW_EXPTIME(6),\n  LR_ACCT_EXPTIME(7)\n}\n*/\n\ntypedef enum LR_TYPE {\n  LR_NONE = 0,\n  LR_INITIAL_TGT = 1,\n  LR_INITIAL = 2,\n  LR_ISSUE_USE_TGT = 3,\n  LR_RENEWAL = 4,\n  LR_REQUEST = 5,\n  LR_PW_EXPTIME = 6,\n  LR_ACCT_EXPTIME = 7\n} LR_TYPE;\n\nint    encode_LR_TYPE(unsigned char *, size_t, const LR_TYPE *, size_t *);\nint    decode_LR_TYPE(const unsigned char *, size_t, LR_TYPE *, size_t *);\nvoid   free_LR_TYPE  (LR_TYPE *);\nsize_t length_LR_TYPE(const LR_TYPE *);\nint    copy_LR_TYPE  (const LR_TYPE *, LR_TYPE *);\n\n\n/*\nLastReq ::= SEQUENCE OF SEQUENCE {\n  lr-type         [0] LR-TYPE,\n  lr-value        [1] KerberosTime,\n}\n*/\n\ntypedef struct LastReq {\n  unsigned int len;\n  struct  {\n    LR_TYPE lr_type;\n    KerberosTime lr_value;\n  } *val;\n} LastReq;\n\nint    encode_LastReq(unsigned char *, size_t, const LastReq *, size_t *);\nint    decode_LastReq(const unsigned char *, size_t, LastReq *, size_t *);\nvoid   free_LastReq  (LastReq *);\nsize_t length_LastReq(const LastReq *);\nint    copy_LastReq  (const LastReq *, LastReq *);\n\n\n/*\nEncryptedData ::= SEQUENCE {\n  etype           [0] ENCTYPE,\n  kvno            [1] krb5int32 OPTIONAL,\n  cipher          [2] OCTET STRING,\n}\n*/\n\ntypedef struct EncryptedData {\n  ENCTYPE etype;\n  krb5int32 *kvno;\n  heim_octet_string cipher;\n} EncryptedData;\n\nint    encode_EncryptedData(unsigned char *, size_t, const EncryptedData *, size_t *);\nint    decode_EncryptedData(const unsigned char *, size_t, EncryptedData *, size_t *);\nvoid   free_EncryptedData  (EncryptedData *);\nsize_t length_EncryptedData(const EncryptedData *);\nint    copy_EncryptedData  (const EncryptedData *, EncryptedData *);\n\n\n/*\nEncryptionKey ::= SEQUENCE {\n  keytype         [0] krb5int32,\n  keyvalue        [1] OCTET STRING,\n}\n*/\n\ntypedef struct EncryptionKey {\n  krb5int32 keytype;\n  heim_octet_string keyvalue;\n} EncryptionKey;\n\nint    encode_EncryptionKey(unsigned char *, size_t, const EncryptionKey *, size_t *);\nint    decode_EncryptionKey(const unsigned char *, size_t, EncryptionKey *, size_t *);\nvoid   free_EncryptionKey  (EncryptionKey *);\nsize_t length_EncryptionKey(const EncryptionKey *);\nint    copy_EncryptionKey  (const EncryptionKey *, EncryptionKey *);\n\n\n/*\nTransitedEncoding ::= SEQUENCE {\n  tr-type         [0] krb5int32,\n  contents        [1] OCTET STRING,\n}\n*/\n\ntypedef struct TransitedEncoding {\n  krb5int32 tr_type;\n  heim_octet_string contents;\n} TransitedEncoding;\n\nint    encode_TransitedEncoding(unsigned char *, size_t, const TransitedEncoding *, size_t *);\nint    decode_TransitedEncoding(const unsigned char *, size_t, TransitedEncoding *, size_t *);\nvoid   free_TransitedEncoding  (TransitedEncoding *);\nsize_t length_TransitedEncoding(const TransitedEncoding *);\nint    copy_TransitedEncoding  (const TransitedEncoding *, TransitedEncoding *);\n\n\n/*\nTicket ::= [APPLICATION 1] SEQUENCE {\n  tkt-vno         [0] krb5int32,\n  realm           [1] Realm,\n  sname           [2] PrincipalName,\n  enc-part        [3] EncryptedData,\n}\n*/\n\ntypedef struct Ticket {\n  krb5int32 tkt_vno;\n  Realm realm;\n  PrincipalName sname;\n  EncryptedData enc_part;\n} Ticket;\n\nint    encode_Ticket(unsigned char *, size_t, const Ticket *, size_t *);\nint    decode_Ticket(const unsigned char *, size_t, Ticket *, size_t *);\nvoid   free_Ticket  (Ticket *);\nsize_t length_Ticket(const Ticket *);\nint    copy_Ticket  (const Ticket *, Ticket *);\n\n\n/*\nEncTicketPart ::= [APPLICATION 3] SEQUENCE {\n  flags                [0] TicketFlags,\n  key                  [1] EncryptionKey,\n  crealm               [2] Realm,\n  cname                [3] PrincipalName,\n  transited            [4] TransitedEncoding,\n  authtime             [5] KerberosTime,\n  starttime            [6] KerberosTime OPTIONAL,\n  endtime              [7] KerberosTime,\n  renew-till           [8] KerberosTime OPTIONAL,\n  caddr                [9] HostAddresses OPTIONAL,\n  authorization-data   [10] AuthorizationData OPTIONAL,\n}\n*/\n\ntypedef struct EncTicketPart {\n  TicketFlags flags;\n  EncryptionKey key;\n  Realm crealm;\n  PrincipalName cname;\n  TransitedEncoding transited;\n  KerberosTime authtime;\n  KerberosTime *starttime;\n  KerberosTime endtime;\n  KerberosTime *renew_till;\n  HostAddresses *caddr;\n  AuthorizationData *authorization_data;\n} EncTicketPart;\n\nint    encode_EncTicketPart(unsigned char *, size_t, const EncTicketPart *, size_t *);\nint    decode_EncTicketPart(const unsigned char *, size_t, EncTicketPart *, size_t *);\nvoid   free_EncTicketPart  (EncTicketPart *);\nsize_t length_EncTicketPart(const EncTicketPart *);\nint    copy_EncTicketPart  (const EncTicketPart *, EncTicketPart *);\n\n\n/*\nChecksum ::= SEQUENCE {\n  cksumtype       [0] CKSUMTYPE,\n  checksum        [1] OCTET STRING,\n}\n*/\n\ntypedef struct Checksum {\n  CKSUMTYPE cksumtype;\n  heim_octet_string checksum;\n} Checksum;\n\nint    encode_Checksum(unsigned char *, size_t, const Checksum *, size_t *);\nint    decode_Checksum(const unsigned char *, size_t, Checksum *, size_t *);\nvoid   free_Checksum  (Checksum *);\nsize_t length_Checksum(const Checksum *);\nint    copy_Checksum  (const Checksum *, Checksum *);\n\n\n/*\nAuthenticator ::= [APPLICATION 2] SEQUENCE {\n  authenticator-vno    [0] krb5int32,\n  crealm               [1] Realm,\n  cname                [2] PrincipalName,\n  cksum                [3] Checksum OPTIONAL,\n  cusec                [4] krb5int32,\n  ctime                [5] KerberosTime,\n  subkey               [6] EncryptionKey OPTIONAL,\n  seq-number           [7] krb5uint32 OPTIONAL,\n  authorization-data   [8] AuthorizationData OPTIONAL,\n}\n*/\n\ntypedef struct Authenticator {\n  krb5int32 authenticator_vno;\n  Realm crealm;\n  PrincipalName cname;\n  Checksum *cksum;\n  krb5int32 cusec;\n  KerberosTime ctime;\n  EncryptionKey *subkey;\n  krb5uint32 *seq_number;\n  AuthorizationData *authorization_data;\n} Authenticator;\n\nint    encode_Authenticator(unsigned char *, size_t, const Authenticator *, size_t *);\nint    decode_Authenticator(const unsigned char *, size_t, Authenticator *, size_t *);\nvoid   free_Authenticator  (Authenticator *);\nsize_t length_Authenticator(const Authenticator *);\nint    copy_Authenticator  (const Authenticator *, Authenticator *);\n\n\n/*\nPA-DATA ::= SEQUENCE {\n  padata-type     [1] PADATA-TYPE,\n  padata-value    [2] OCTET STRING,\n}\n*/\n\ntypedef struct PA_DATA {\n  PADATA_TYPE padata_type;\n  heim_octet_string padata_value;\n} PA_DATA;\n\nint    encode_PA_DATA(unsigned char *, size_t, const PA_DATA *, size_t *);\nint    decode_PA_DATA(const unsigned char *, size_t, PA_DATA *, size_t *);\nvoid   free_PA_DATA  (PA_DATA *);\nsize_t length_PA_DATA(const PA_DATA *);\nint    copy_PA_DATA  (const PA_DATA *, PA_DATA *);\n\n\n/*\nETYPE-INFO-ENTRY ::= SEQUENCE {\n  etype           [0] ENCTYPE,\n  salt            [1] OCTET STRING OPTIONAL,\n  salttype        [2] krb5int32 OPTIONAL,\n}\n*/\n\ntypedef struct ETYPE_INFO_ENTRY {\n  ENCTYPE etype;\n  heim_octet_string *salt;\n  krb5int32 *salttype;\n} ETYPE_INFO_ENTRY;\n\nint    encode_ETYPE_INFO_ENTRY(unsigned char *, size_t, const ETYPE_INFO_ENTRY *, size_t *);\nint    decode_ETYPE_INFO_ENTRY(const unsigned char *, size_t, ETYPE_INFO_ENTRY *, size_t *);\nvoid   free_ETYPE_INFO_ENTRY  (ETYPE_INFO_ENTRY *);\nsize_t length_ETYPE_INFO_ENTRY(const ETYPE_INFO_ENTRY *);\nint    copy_ETYPE_INFO_ENTRY  (const ETYPE_INFO_ENTRY *, ETYPE_INFO_ENTRY *);\n\n\n/*\nETYPE-INFO ::= SEQUENCE OF ETYPE-INFO-ENTRY\n*/\n\ntypedef struct ETYPE_INFO {\n  unsigned int len;\n  ETYPE_INFO_ENTRY *val;\n} ETYPE_INFO;\n\nint    encode_ETYPE_INFO(unsigned char *, size_t, const ETYPE_INFO *, size_t *);\nint    decode_ETYPE_INFO(const unsigned char *, size_t, ETYPE_INFO *, size_t *);\nvoid   free_ETYPE_INFO  (ETYPE_INFO *);\nsize_t length_ETYPE_INFO(const ETYPE_INFO *);\nint    copy_ETYPE_INFO  (const ETYPE_INFO *, ETYPE_INFO *);\nint   add_ETYPE_INFO  (ETYPE_INFO *, const ETYPE_INFO_ENTRY *);\nint   remove_ETYPE_INFO  (ETYPE_INFO *, unsigned int);\n\n\n/*\nETYPE-INFO2-ENTRY ::= SEQUENCE {\n  etype           [0] ENCTYPE,\n  salt            [1] KerberosString OPTIONAL,\n  s2kparams       [2] OCTET STRING OPTIONAL,\n}\n*/\n\ntypedef struct ETYPE_INFO2_ENTRY {\n  ENCTYPE etype;\n  KerberosString *salt;\n  heim_octet_string *s2kparams;\n} ETYPE_INFO2_ENTRY;\n\nint    encode_ETYPE_INFO2_ENTRY(unsigned char *, size_t, const ETYPE_INFO2_ENTRY *, size_t *);\nint    decode_ETYPE_INFO2_ENTRY(const unsigned char *, size_t, ETYPE_INFO2_ENTRY *, size_t *);\nvoid   free_ETYPE_INFO2_ENTRY  (ETYPE_INFO2_ENTRY *);\nsize_t length_ETYPE_INFO2_ENTRY(const ETYPE_INFO2_ENTRY *);\nint    copy_ETYPE_INFO2_ENTRY  (const ETYPE_INFO2_ENTRY *, ETYPE_INFO2_ENTRY *);\n\n\n/*\nETYPE-INFO2 ::= SEQUENCE OF ETYPE-INFO2-ENTRY\n*/\n\ntypedef struct ETYPE_INFO2 {\n  unsigned int len;\n  ETYPE_INFO2_ENTRY *val;\n} ETYPE_INFO2;\n\nint    encode_ETYPE_INFO2(unsigned char *, size_t, const ETYPE_INFO2 *, size_t *);\nint    decode_ETYPE_INFO2(const unsigned char *, size_t, ETYPE_INFO2 *, size_t *);\nvoid   free_ETYPE_INFO2  (ETYPE_INFO2 *);\nsize_t length_ETYPE_INFO2(const ETYPE_INFO2 *);\nint    copy_ETYPE_INFO2  (const ETYPE_INFO2 *, ETYPE_INFO2 *);\nint   add_ETYPE_INFO2  (ETYPE_INFO2 *, const ETYPE_INFO2_ENTRY *);\nint   remove_ETYPE_INFO2  (ETYPE_INFO2 *, unsigned int);\n\n\n/*\nMETHOD-DATA ::= SEQUENCE OF PA-DATA\n*/\n\ntypedef struct METHOD_DATA {\n  unsigned int len;\n  PA_DATA *val;\n} METHOD_DATA;\n\nint    encode_METHOD_DATA(unsigned char *, size_t, const METHOD_DATA *, size_t *);\nint    decode_METHOD_DATA(const unsigned char *, size_t, METHOD_DATA *, size_t *);\nvoid   free_METHOD_DATA  (METHOD_DATA *);\nsize_t length_METHOD_DATA(const METHOD_DATA *);\nint    copy_METHOD_DATA  (const METHOD_DATA *, METHOD_DATA *);\nint   add_METHOD_DATA  (METHOD_DATA *, const PA_DATA *);\nint   remove_METHOD_DATA  (METHOD_DATA *, unsigned int);\n\n\n/*\nTypedData ::= SEQUENCE {\n  data-type       [0] krb5int32,\n  data-value      [1] OCTET STRING OPTIONAL,\n}\n*/\n\ntypedef struct TypedData {\n  krb5int32 data_type;\n  heim_octet_string *data_value;\n} TypedData;\n\nint    encode_TypedData(unsigned char *, size_t, const TypedData *, size_t *);\nint    decode_TypedData(const unsigned char *, size_t, TypedData *, size_t *);\nvoid   free_TypedData  (TypedData *);\nsize_t length_TypedData(const TypedData *);\nint    copy_TypedData  (const TypedData *, TypedData *);\n\n\n/*\nTYPED-DATA ::= SEQUENCE OF TypedData\n*/\n\ntypedef struct TYPED_DATA {\n  unsigned int len;\n  TypedData *val;\n} TYPED_DATA;\n\nint    encode_TYPED_DATA(unsigned char *, size_t, const TYPED_DATA *, size_t *);\nint    decode_TYPED_DATA(const unsigned char *, size_t, TYPED_DATA *, size_t *);\nvoid   free_TYPED_DATA  (TYPED_DATA *);\nsize_t length_TYPED_DATA(const TYPED_DATA *);\nint    copy_TYPED_DATA  (const TYPED_DATA *, TYPED_DATA *);\n\n\n/*\nKDC-REQ-BODY ::= SEQUENCE {\n  kdc-options              [0] KDCOptions,\n  cname                    [1] PrincipalName OPTIONAL,\n  realm                    [2] Realm,\n  sname                    [3] PrincipalName OPTIONAL,\n  from                     [4] KerberosTime OPTIONAL,\n  till                     [5] KerberosTime OPTIONAL,\n  rtime                    [6] KerberosTime OPTIONAL,\n  nonce                    [7] krb5int32,\n  etype                    [8] SEQUENCE OF ENCTYPE,\n  addresses                [9] HostAddresses OPTIONAL,\n  enc-authorization-data   [10] EncryptedData OPTIONAL,\n  additional-tickets       [11] SEQUENCE OF Ticket OPTIONAL,\n}\n*/\n\ntypedef struct KDC_REQ_BODY {\n  KDCOptions kdc_options;\n  PrincipalName *cname;\n  Realm realm;\n  PrincipalName *sname;\n  KerberosTime *from;\n  KerberosTime *till;\n  KerberosTime *rtime;\n  krb5int32 nonce;\n  struct  {\n    unsigned int len;\n    ENCTYPE *val;\n  } etype;\n  HostAddresses *addresses;\n  EncryptedData *enc_authorization_data;\n  struct  {\n    unsigned int len;\n    Ticket *val;\n  } *additional_tickets;\n} KDC_REQ_BODY;\n\nint    encode_KDC_REQ_BODY(unsigned char *, size_t, const KDC_REQ_BODY *, size_t *);\nint    decode_KDC_REQ_BODY(const unsigned char *, size_t, KDC_REQ_BODY *, size_t *);\nvoid   free_KDC_REQ_BODY  (KDC_REQ_BODY *);\nsize_t length_KDC_REQ_BODY(const KDC_REQ_BODY *);\nint    copy_KDC_REQ_BODY  (const KDC_REQ_BODY *, KDC_REQ_BODY *);\n\n\n/*\nKDC-REQ ::= SEQUENCE {\n  pvno            [1] krb5int32,\n  msg-type        [2] MESSAGE-TYPE,\n  padata          [3] METHOD-DATA OPTIONAL,\n  req-body        [4] KDC-REQ-BODY,\n}\n*/\n\ntypedef struct KDC_REQ {\n  krb5int32 pvno;\n  MESSAGE_TYPE msg_type;\n  METHOD_DATA *padata;\n  KDC_REQ_BODY req_body;\n} KDC_REQ;\n\nint    encode_KDC_REQ(unsigned char *, size_t, const KDC_REQ *, size_t *);\nint    decode_KDC_REQ(const unsigned char *, size_t, KDC_REQ *, size_t *);\nvoid   free_KDC_REQ  (KDC_REQ *);\nsize_t length_KDC_REQ(const KDC_REQ *);\nint    copy_KDC_REQ  (const KDC_REQ *, KDC_REQ *);\n\n\n/*\nAS-REQ ::= [APPLICATION 10] KDC-REQ\n*/\n\ntypedef KDC_REQ AS_REQ;\n\nint    encode_AS_REQ(unsigned char *, size_t, const AS_REQ *, size_t *);\nint    decode_AS_REQ(const unsigned char *, size_t, AS_REQ *, size_t *);\nvoid   free_AS_REQ  (AS_REQ *);\nsize_t length_AS_REQ(const AS_REQ *);\nint    copy_AS_REQ  (const AS_REQ *, AS_REQ *);\n\n\n/*\nTGS-REQ ::= [APPLICATION 12] KDC-REQ\n*/\n\ntypedef KDC_REQ TGS_REQ;\n\nint    encode_TGS_REQ(unsigned char *, size_t, const TGS_REQ *, size_t *);\nint    decode_TGS_REQ(const unsigned char *, size_t, TGS_REQ *, size_t *);\nvoid   free_TGS_REQ  (TGS_REQ *);\nsize_t length_TGS_REQ(const TGS_REQ *);\nint    copy_TGS_REQ  (const TGS_REQ *, TGS_REQ *);\n\n\n/*\nPA-ENC-TS-ENC ::= SEQUENCE {\n  patimestamp     [0] KerberosTime,\n  pausec          [1] krb5int32 OPTIONAL,\n}\n*/\n\ntypedef struct PA_ENC_TS_ENC {\n  KerberosTime patimestamp;\n  krb5int32 *pausec;\n} PA_ENC_TS_ENC;\n\nint    encode_PA_ENC_TS_ENC(unsigned char *, size_t, const PA_ENC_TS_ENC *, size_t *);\nint    decode_PA_ENC_TS_ENC(const unsigned char *, size_t, PA_ENC_TS_ENC *, size_t *);\nvoid   free_PA_ENC_TS_ENC  (PA_ENC_TS_ENC *);\nsize_t length_PA_ENC_TS_ENC(const PA_ENC_TS_ENC *);\nint    copy_PA_ENC_TS_ENC  (const PA_ENC_TS_ENC *, PA_ENC_TS_ENC *);\n\n\n/*\nPA-PAC-REQUEST ::= SEQUENCE {\n  include-pac     [0] BOOLEAN,\n}\n*/\n\ntypedef struct PA_PAC_REQUEST {\n  int include_pac;\n} PA_PAC_REQUEST;\n\nint    encode_PA_PAC_REQUEST(unsigned char *, size_t, const PA_PAC_REQUEST *, size_t *);\nint    decode_PA_PAC_REQUEST(const unsigned char *, size_t, PA_PAC_REQUEST *, size_t *);\nvoid   free_PA_PAC_REQUEST  (PA_PAC_REQUEST *);\nsize_t length_PA_PAC_REQUEST(const PA_PAC_REQUEST *);\nint    copy_PA_PAC_REQUEST  (const PA_PAC_REQUEST *, PA_PAC_REQUEST *);\n\n\n/*\nPROV-SRV-LOCATION ::= GeneralString\n*/\n\ntypedef heim_general_string PROV_SRV_LOCATION;\n\nint    encode_PROV_SRV_LOCATION(unsigned char *, size_t, const PROV_SRV_LOCATION *, size_t *);\nint    decode_PROV_SRV_LOCATION(const unsigned char *, size_t, PROV_SRV_LOCATION *, size_t *);\nvoid   free_PROV_SRV_LOCATION  (PROV_SRV_LOCATION *);\nsize_t length_PROV_SRV_LOCATION(const PROV_SRV_LOCATION *);\nint    copy_PROV_SRV_LOCATION  (const PROV_SRV_LOCATION *, PROV_SRV_LOCATION *);\n\n\n/*\nKDC-REP ::= SEQUENCE {\n  pvno            [0] krb5int32,\n  msg-type        [1] MESSAGE-TYPE,\n  padata          [2] METHOD-DATA OPTIONAL,\n  crealm          [3] Realm,\n  cname           [4] PrincipalName,\n  ticket          [5] Ticket,\n  enc-part        [6] EncryptedData,\n}\n*/\n\ntypedef struct KDC_REP {\n  krb5int32 pvno;\n  MESSAGE_TYPE msg_type;\n  METHOD_DATA *padata;\n  Realm crealm;\n  PrincipalName cname;\n  Ticket ticket;\n  EncryptedData enc_part;\n} KDC_REP;\n\nint    encode_KDC_REP(unsigned char *, size_t, const KDC_REP *, size_t *);\nint    decode_KDC_REP(const unsigned char *, size_t, KDC_REP *, size_t *);\nvoid   free_KDC_REP  (KDC_REP *);\nsize_t length_KDC_REP(const KDC_REP *);\nint    copy_KDC_REP  (const KDC_REP *, KDC_REP *);\n\n\n/*\nAS-REP ::= [APPLICATION 11] KDC-REP\n*/\n\ntypedef KDC_REP AS_REP;\n\nint    encode_AS_REP(unsigned char *, size_t, const AS_REP *, size_t *);\nint    decode_AS_REP(const unsigned char *, size_t, AS_REP *, size_t *);\nvoid   free_AS_REP  (AS_REP *);\nsize_t length_AS_REP(const AS_REP *);\nint    copy_AS_REP  (const AS_REP *, AS_REP *);\n\n\n/*\nTGS-REP ::= [APPLICATION 13] KDC-REP\n*/\n\ntypedef KDC_REP TGS_REP;\n\nint    encode_TGS_REP(unsigned char *, size_t, const TGS_REP *, size_t *);\nint    decode_TGS_REP(const unsigned char *, size_t, TGS_REP *, size_t *);\nvoid   free_TGS_REP  (TGS_REP *);\nsize_t length_TGS_REP(const TGS_REP *);\nint    copy_TGS_REP  (const TGS_REP *, TGS_REP *);\n\n\n/*\nEncKDCRepPart ::= SEQUENCE {\n  key                 [0] EncryptionKey,\n  last-req            [1] LastReq,\n  nonce               [2] krb5int32,\n  key-expiration      [3] KerberosTime OPTIONAL,\n  flags               [4] TicketFlags,\n  authtime            [5] KerberosTime,\n  starttime           [6] KerberosTime OPTIONAL,\n  endtime             [7] KerberosTime,\n  renew-till          [8] KerberosTime OPTIONAL,\n  srealm              [9] Realm,\n  sname               [10] PrincipalName,\n  caddr               [11] HostAddresses OPTIONAL,\n  encrypted-pa-data   [12] METHOD-DATA OPTIONAL,\n}\n*/\n\ntypedef struct EncKDCRepPart {\n  EncryptionKey key;\n  LastReq last_req;\n  krb5int32 nonce;\n  KerberosTime *key_expiration;\n  TicketFlags flags;\n  KerberosTime authtime;\n  KerberosTime *starttime;\n  KerberosTime endtime;\n  KerberosTime *renew_till;\n  Realm srealm;\n  PrincipalName sname;\n  HostAddresses *caddr;\n  METHOD_DATA *encrypted_pa_data;\n} EncKDCRepPart;\n\nint    encode_EncKDCRepPart(unsigned char *, size_t, const EncKDCRepPart *, size_t *);\nint    decode_EncKDCRepPart(const unsigned char *, size_t, EncKDCRepPart *, size_t *);\nvoid   free_EncKDCRepPart  (EncKDCRepPart *);\nsize_t length_EncKDCRepPart(const EncKDCRepPart *);\nint    copy_EncKDCRepPart  (const EncKDCRepPart *, EncKDCRepPart *);\n\n\n/*\nEncASRepPart ::= [APPLICATION 25] EncKDCRepPart\n*/\n\ntypedef EncKDCRepPart EncASRepPart;\n\nint    encode_EncASRepPart(unsigned char *, size_t, const EncASRepPart *, size_t *);\nint    decode_EncASRepPart(const unsigned char *, size_t, EncASRepPart *, size_t *);\nvoid   free_EncASRepPart  (EncASRepPart *);\nsize_t length_EncASRepPart(const EncASRepPart *);\nint    copy_EncASRepPart  (const EncASRepPart *, EncASRepPart *);\n\n\n/*\nEncTGSRepPart ::= [APPLICATION 26] EncKDCRepPart\n*/\n\ntypedef EncKDCRepPart EncTGSRepPart;\n\nint    encode_EncTGSRepPart(unsigned char *, size_t, const EncTGSRepPart *, size_t *);\nint    decode_EncTGSRepPart(const unsigned char *, size_t, EncTGSRepPart *, size_t *);\nvoid   free_EncTGSRepPart  (EncTGSRepPart *);\nsize_t length_EncTGSRepPart(const EncTGSRepPart *);\nint    copy_EncTGSRepPart  (const EncTGSRepPart *, EncTGSRepPart *);\n\n\n/*\nAP-REQ ::= [APPLICATION 14] SEQUENCE {\n  pvno            [0] krb5int32,\n  msg-type        [1] MESSAGE-TYPE,\n  ap-options      [2] APOptions,\n  ticket          [3] Ticket,\n  authenticator   [4] EncryptedData,\n}\n*/\n\ntypedef struct AP_REQ {\n  krb5int32 pvno;\n  MESSAGE_TYPE msg_type;\n  APOptions ap_options;\n  Ticket ticket;\n  EncryptedData authenticator;\n} AP_REQ;\n\nint    encode_AP_REQ(unsigned char *, size_t, const AP_REQ *, size_t *);\nint    decode_AP_REQ(const unsigned char *, size_t, AP_REQ *, size_t *);\nvoid   free_AP_REQ  (AP_REQ *);\nsize_t length_AP_REQ(const AP_REQ *);\nint    copy_AP_REQ  (const AP_REQ *, AP_REQ *);\n\n\n/*\nAP-REP ::= [APPLICATION 15] SEQUENCE {\n  pvno            [0] krb5int32,\n  msg-type        [1] MESSAGE-TYPE,\n  enc-part        [2] EncryptedData,\n}\n*/\n\ntypedef struct AP_REP {\n  krb5int32 pvno;\n  MESSAGE_TYPE msg_type;\n  EncryptedData enc_part;\n} AP_REP;\n\nint    encode_AP_REP(unsigned char *, size_t, const AP_REP *, size_t *);\nint    decode_AP_REP(const unsigned char *, size_t, AP_REP *, size_t *);\nvoid   free_AP_REP  (AP_REP *);\nsize_t length_AP_REP(const AP_REP *);\nint    copy_AP_REP  (const AP_REP *, AP_REP *);\n\n\n/*\nEncAPRepPart ::= [APPLICATION 27] SEQUENCE {\n  ctime           [0] KerberosTime,\n  cusec           [1] krb5int32,\n  subkey          [2] EncryptionKey OPTIONAL,\n  seq-number      [3] krb5uint32 OPTIONAL,\n}\n*/\n\ntypedef struct EncAPRepPart {\n  KerberosTime ctime;\n  krb5int32 cusec;\n  EncryptionKey *subkey;\n  krb5uint32 *seq_number;\n} EncAPRepPart;\n\nint    encode_EncAPRepPart(unsigned char *, size_t, const EncAPRepPart *, size_t *);\nint    decode_EncAPRepPart(const unsigned char *, size_t, EncAPRepPart *, size_t *);\nvoid   free_EncAPRepPart  (EncAPRepPart *);\nsize_t length_EncAPRepPart(const EncAPRepPart *);\nint    copy_EncAPRepPart  (const EncAPRepPart *, EncAPRepPart *);\n\n\n/*\nKRB-SAFE-BODY ::= SEQUENCE {\n  user-data       [0] OCTET STRING,\n  timestamp       [1] KerberosTime OPTIONAL,\n  usec            [2] krb5int32 OPTIONAL,\n  seq-number      [3] krb5uint32 OPTIONAL,\n  s-address       [4] HostAddress OPTIONAL,\n  r-address       [5] HostAddress OPTIONAL,\n}\n*/\n\ntypedef struct KRB_SAFE_BODY {\n  heim_octet_string user_data;\n  KerberosTime *timestamp;\n  krb5int32 *usec;\n  krb5uint32 *seq_number;\n  HostAddress *s_address;\n  HostAddress *r_address;\n} KRB_SAFE_BODY;\n\nint    encode_KRB_SAFE_BODY(unsigned char *, size_t, const KRB_SAFE_BODY *, size_t *);\nint    decode_KRB_SAFE_BODY(const unsigned char *, size_t, KRB_SAFE_BODY *, size_t *);\nvoid   free_KRB_SAFE_BODY  (KRB_SAFE_BODY *);\nsize_t length_KRB_SAFE_BODY(const KRB_SAFE_BODY *);\nint    copy_KRB_SAFE_BODY  (const KRB_SAFE_BODY *, KRB_SAFE_BODY *);\n\n\n/*\nKRB-SAFE ::= [APPLICATION 20] SEQUENCE {\n  pvno            [0] krb5int32,\n  msg-type        [1] MESSAGE-TYPE,\n  safe-body       [2] KRB-SAFE-BODY,\n  cksum           [3] Checksum,\n}\n*/\n\ntypedef struct KRB_SAFE {\n  krb5int32 pvno;\n  MESSAGE_TYPE msg_type;\n  KRB_SAFE_BODY safe_body;\n  Checksum cksum;\n} KRB_SAFE;\n\nint    encode_KRB_SAFE(unsigned char *, size_t, const KRB_SAFE *, size_t *);\nint    decode_KRB_SAFE(const unsigned char *, size_t, KRB_SAFE *, size_t *);\nvoid   free_KRB_SAFE  (KRB_SAFE *);\nsize_t length_KRB_SAFE(const KRB_SAFE *);\nint    copy_KRB_SAFE  (const KRB_SAFE *, KRB_SAFE *);\n\n\n/*\nKRB-PRIV ::= [APPLICATION 21] SEQUENCE {\n  pvno            [0] krb5int32,\n  msg-type        [1] MESSAGE-TYPE,\n  enc-part        [3] EncryptedData,\n}\n*/\n\ntypedef struct KRB_PRIV {\n  krb5int32 pvno;\n  MESSAGE_TYPE msg_type;\n  EncryptedData enc_part;\n} KRB_PRIV;\n\nint    encode_KRB_PRIV(unsigned char *, size_t, const KRB_PRIV *, size_t *);\nint    decode_KRB_PRIV(const unsigned char *, size_t, KRB_PRIV *, size_t *);\nvoid   free_KRB_PRIV  (KRB_PRIV *);\nsize_t length_KRB_PRIV(const KRB_PRIV *);\nint    copy_KRB_PRIV  (const KRB_PRIV *, KRB_PRIV *);\n\n\n/*\nEncKrbPrivPart ::= [APPLICATION 28] SEQUENCE {\n  user-data       [0] OCTET STRING,\n  timestamp       [1] KerberosTime OPTIONAL,\n  usec            [2] krb5int32 OPTIONAL,\n  seq-number      [3] krb5uint32 OPTIONAL,\n  s-address       [4] HostAddress OPTIONAL,\n  r-address       [5] HostAddress OPTIONAL,\n}\n*/\n\ntypedef struct EncKrbPrivPart {\n  heim_octet_string user_data;\n  KerberosTime *timestamp;\n  krb5int32 *usec;\n  krb5uint32 *seq_number;\n  HostAddress *s_address;\n  HostAddress *r_address;\n} EncKrbPrivPart;\n\nint    encode_EncKrbPrivPart(unsigned char *, size_t, const EncKrbPrivPart *, size_t *);\nint    decode_EncKrbPrivPart(const unsigned char *, size_t, EncKrbPrivPart *, size_t *);\nvoid   free_EncKrbPrivPart  (EncKrbPrivPart *);\nsize_t length_EncKrbPrivPart(const EncKrbPrivPart *);\nint    copy_EncKrbPrivPart  (const EncKrbPrivPart *, EncKrbPrivPart *);\n\n\n/*\nKRB-CRED ::= [APPLICATION 22] SEQUENCE {\n  pvno            [0] krb5int32,\n  msg-type        [1] MESSAGE-TYPE,\n  tickets         [2] SEQUENCE OF Ticket,\n  enc-part        [3] EncryptedData,\n}\n*/\n\ntypedef struct KRB_CRED {\n  krb5int32 pvno;\n  MESSAGE_TYPE msg_type;\n  struct  {\n    unsigned int len;\n    Ticket *val;\n  } tickets;\n  EncryptedData enc_part;\n} KRB_CRED;\n\nint    encode_KRB_CRED(unsigned char *, size_t, const KRB_CRED *, size_t *);\nint    decode_KRB_CRED(const unsigned char *, size_t, KRB_CRED *, size_t *);\nvoid   free_KRB_CRED  (KRB_CRED *);\nsize_t length_KRB_CRED(const KRB_CRED *);\nint    copy_KRB_CRED  (const KRB_CRED *, KRB_CRED *);\n\n\n/*\nKrbCredInfo ::= SEQUENCE {\n  key             [0] EncryptionKey,\n  prealm          [1] Realm OPTIONAL,\n  pname           [2] PrincipalName OPTIONAL,\n  flags           [3] TicketFlags OPTIONAL,\n  authtime        [4] KerberosTime OPTIONAL,\n  starttime       [5] KerberosTime OPTIONAL,\n  endtime         [6] KerberosTime OPTIONAL,\n  renew-till      [7] KerberosTime OPTIONAL,\n  srealm          [8] Realm OPTIONAL,\n  sname           [9] PrincipalName OPTIONAL,\n  caddr           [10] HostAddresses OPTIONAL,\n}\n*/\n\ntypedef struct KrbCredInfo {\n  EncryptionKey key;\n  Realm *prealm;\n  PrincipalName *pname;\n  TicketFlags *flags;\n  KerberosTime *authtime;\n  KerberosTime *starttime;\n  KerberosTime *endtime;\n  KerberosTime *renew_till;\n  Realm *srealm;\n  PrincipalName *sname;\n  HostAddresses *caddr;\n} KrbCredInfo;\n\nint    encode_KrbCredInfo(unsigned char *, size_t, const KrbCredInfo *, size_t *);\nint    decode_KrbCredInfo(const unsigned char *, size_t, KrbCredInfo *, size_t *);\nvoid   free_KrbCredInfo  (KrbCredInfo *);\nsize_t length_KrbCredInfo(const KrbCredInfo *);\nint    copy_KrbCredInfo  (const KrbCredInfo *, KrbCredInfo *);\n\n\n/*\nEncKrbCredPart ::= [APPLICATION 29] SEQUENCE {\n  ticket-info     [0] SEQUENCE OF KrbCredInfo,\n  nonce           [1] krb5int32 OPTIONAL,\n  timestamp       [2] KerberosTime OPTIONAL,\n  usec            [3] krb5int32 OPTIONAL,\n  s-address       [4] HostAddress OPTIONAL,\n  r-address       [5] HostAddress OPTIONAL,\n}\n*/\n\ntypedef struct EncKrbCredPart {\n  struct  {\n    unsigned int len;\n    KrbCredInfo *val;\n  } ticket_info;\n  krb5int32 *nonce;\n  KerberosTime *timestamp;\n  krb5int32 *usec;\n  HostAddress *s_address;\n  HostAddress *r_address;\n} EncKrbCredPart;\n\nint    encode_EncKrbCredPart(unsigned char *, size_t, const EncKrbCredPart *, size_t *);\nint    decode_EncKrbCredPart(const unsigned char *, size_t, EncKrbCredPart *, size_t *);\nvoid   free_EncKrbCredPart  (EncKrbCredPart *);\nsize_t length_EncKrbCredPart(const EncKrbCredPart *);\nint    copy_EncKrbCredPart  (const EncKrbCredPart *, EncKrbCredPart *);\n\n\n/*\nKRB-ERROR ::= [APPLICATION 30] SEQUENCE {\n  pvno            [0] krb5int32,\n  msg-type        [1] MESSAGE-TYPE,\n  ctime           [2] KerberosTime OPTIONAL,\n  cusec           [3] krb5int32 OPTIONAL,\n  stime           [4] KerberosTime,\n  susec           [5] krb5int32,\n  error-code      [6] krb5int32,\n  crealm          [7] Realm OPTIONAL,\n  cname           [8] PrincipalName OPTIONAL,\n  realm           [9] Realm,\n  sname           [10] PrincipalName,\n  e-text          [11] GeneralString OPTIONAL,\n  e-data          [12] OCTET STRING OPTIONAL,\n}\n*/\n\ntypedef struct KRB_ERROR {\n  krb5int32 pvno;\n  MESSAGE_TYPE msg_type;\n  KerberosTime *ctime;\n  krb5int32 *cusec;\n  KerberosTime stime;\n  krb5int32 susec;\n  krb5int32 error_code;\n  Realm *crealm;\n  PrincipalName *cname;\n  Realm realm;\n  PrincipalName sname;\n  heim_general_string *e_text;\n  heim_octet_string *e_data;\n} KRB_ERROR;\n\nint    encode_KRB_ERROR(unsigned char *, size_t, const KRB_ERROR *, size_t *);\nint    decode_KRB_ERROR(const unsigned char *, size_t, KRB_ERROR *, size_t *);\nvoid   free_KRB_ERROR  (KRB_ERROR *);\nsize_t length_KRB_ERROR(const KRB_ERROR *);\nint    copy_KRB_ERROR  (const KRB_ERROR *, KRB_ERROR *);\n\n\n/*\nChangePasswdDataMS ::= SEQUENCE {\n  newpasswd       [0] OCTET STRING,\n  targname        [1] PrincipalName OPTIONAL,\n  targrealm       [2] Realm OPTIONAL,\n}\n*/\n\ntypedef struct ChangePasswdDataMS {\n  heim_octet_string newpasswd;\n  PrincipalName *targname;\n  Realm *targrealm;\n} ChangePasswdDataMS;\n\nint    encode_ChangePasswdDataMS(unsigned char *, size_t, const ChangePasswdDataMS *, size_t *);\nint    decode_ChangePasswdDataMS(const unsigned char *, size_t, ChangePasswdDataMS *, size_t *);\nvoid   free_ChangePasswdDataMS  (ChangePasswdDataMS *);\nsize_t length_ChangePasswdDataMS(const ChangePasswdDataMS *);\nint    copy_ChangePasswdDataMS  (const ChangePasswdDataMS *, ChangePasswdDataMS *);\n\n\n/*\nEtypeList ::= SEQUENCE OF krb5int32\n*/\n\ntypedef struct EtypeList {\n  unsigned int len;\n  krb5int32 *val;\n} EtypeList;\n\nint    encode_EtypeList(unsigned char *, size_t, const EtypeList *, size_t *);\nint    decode_EtypeList(const unsigned char *, size_t, EtypeList *, size_t *);\nvoid   free_EtypeList  (EtypeList *);\nsize_t length_EtypeList(const EtypeList *);\nint    copy_EtypeList  (const EtypeList *, EtypeList *);\n\n\nenum { krb5_pvno = 5 };\n\nenum { DOMAIN_X500_COMPRESS = 1 };\n\n/*\nAD-IF-RELEVANT ::= AuthorizationData\n*/\n\ntypedef AuthorizationData AD_IF_RELEVANT;\n\nint    encode_AD_IF_RELEVANT(unsigned char *, size_t, const AD_IF_RELEVANT *, size_t *);\nint    decode_AD_IF_RELEVANT(const unsigned char *, size_t, AD_IF_RELEVANT *, size_t *);\nvoid   free_AD_IF_RELEVANT  (AD_IF_RELEVANT *);\nsize_t length_AD_IF_RELEVANT(const AD_IF_RELEVANT *);\nint    copy_AD_IF_RELEVANT  (const AD_IF_RELEVANT *, AD_IF_RELEVANT *);\n\n\n/*\nAD-KDCIssued ::= SEQUENCE {\n  ad-checksum     [0] Checksum,\n  i-realm         [1] Realm OPTIONAL,\n  i-sname         [2] PrincipalName OPTIONAL,\n  elements        [3] AuthorizationData,\n}\n*/\n\ntypedef struct AD_KDCIssued {\n  Checksum ad_checksum;\n  Realm *i_realm;\n  PrincipalName *i_sname;\n  AuthorizationData elements;\n} AD_KDCIssued;\n\nint    encode_AD_KDCIssued(unsigned char *, size_t, const AD_KDCIssued *, size_t *);\nint    decode_AD_KDCIssued(const unsigned char *, size_t, AD_KDCIssued *, size_t *);\nvoid   free_AD_KDCIssued  (AD_KDCIssued *);\nsize_t length_AD_KDCIssued(const AD_KDCIssued *);\nint    copy_AD_KDCIssued  (const AD_KDCIssued *, AD_KDCIssued *);\n\n\n/*\nAD-AND-OR ::= SEQUENCE {\n  condition-count   [0] INTEGER,\n  elements          [1] AuthorizationData,\n}\n*/\n\ntypedef struct AD_AND_OR {\n  heim_integer condition_count;\n  AuthorizationData elements;\n} AD_AND_OR;\n\nint    encode_AD_AND_OR(unsigned char *, size_t, const AD_AND_OR *, size_t *);\nint    decode_AD_AND_OR(const unsigned char *, size_t, AD_AND_OR *, size_t *);\nvoid   free_AD_AND_OR  (AD_AND_OR *);\nsize_t length_AD_AND_OR(const AD_AND_OR *);\nint    copy_AD_AND_OR  (const AD_AND_OR *, AD_AND_OR *);\n\n\n/*\nAD-MANDATORY-FOR-KDC ::= AuthorizationData\n*/\n\ntypedef AuthorizationData AD_MANDATORY_FOR_KDC;\n\nint    encode_AD_MANDATORY_FOR_KDC(unsigned char *, size_t, const AD_MANDATORY_FOR_KDC *, size_t *);\nint    decode_AD_MANDATORY_FOR_KDC(const unsigned char *, size_t, AD_MANDATORY_FOR_KDC *, size_t *);\nvoid   free_AD_MANDATORY_FOR_KDC  (AD_MANDATORY_FOR_KDC *);\nsize_t length_AD_MANDATORY_FOR_KDC(const AD_MANDATORY_FOR_KDC *);\nint    copy_AD_MANDATORY_FOR_KDC  (const AD_MANDATORY_FOR_KDC *, AD_MANDATORY_FOR_KDC *);\n\n\n/*\nPA-SAM-TYPE ::= INTEGER {\n  PA_SAM_TYPE_ENIGMA(1),\n  PA_SAM_TYPE_DIGI_PATH(2),\n  PA_SAM_TYPE_SKEY_K0(3),\n  PA_SAM_TYPE_SKEY(4),\n  PA_SAM_TYPE_SECURID(5),\n  PA_SAM_TYPE_CRYPTOCARD(6)\n}\n*/\n\ntypedef enum PA_SAM_TYPE {\n  PA_SAM_TYPE_ENIGMA = 1,\n  PA_SAM_TYPE_DIGI_PATH = 2,\n  PA_SAM_TYPE_SKEY_K0 = 3,\n  PA_SAM_TYPE_SKEY = 4,\n  PA_SAM_TYPE_SECURID = 5,\n  PA_SAM_TYPE_CRYPTOCARD = 6\n} PA_SAM_TYPE;\n\nint    encode_PA_SAM_TYPE(unsigned char *, size_t, const PA_SAM_TYPE *, size_t *);\nint    decode_PA_SAM_TYPE(const unsigned char *, size_t, PA_SAM_TYPE *, size_t *);\nvoid   free_PA_SAM_TYPE  (PA_SAM_TYPE *);\nsize_t length_PA_SAM_TYPE(const PA_SAM_TYPE *);\nint    copy_PA_SAM_TYPE  (const PA_SAM_TYPE *, PA_SAM_TYPE *);\n\n\n/*\nPA-SAM-REDIRECT ::= HostAddresses\n*/\n\ntypedef HostAddresses PA_SAM_REDIRECT;\n\nint    encode_PA_SAM_REDIRECT(unsigned char *, size_t, const PA_SAM_REDIRECT *, size_t *);\nint    decode_PA_SAM_REDIRECT(const unsigned char *, size_t, PA_SAM_REDIRECT *, size_t *);\nvoid   free_PA_SAM_REDIRECT  (PA_SAM_REDIRECT *);\nsize_t length_PA_SAM_REDIRECT(const PA_SAM_REDIRECT *);\nint    copy_PA_SAM_REDIRECT  (const PA_SAM_REDIRECT *, PA_SAM_REDIRECT *);\n\n\n/*\nSAMFlags ::= BIT STRING {\n  use-sad-as-key(0),\n  send-encrypted-sad(1),\n  must-pk-encrypt-sad(2)\n}\n*/\n\ntypedef struct SAMFlags {\n  unsigned int use_sad_as_key:1;\n  unsigned int send_encrypted_sad:1;\n  unsigned int must_pk_encrypt_sad:1;\n} SAMFlags;\n\n\nint    encode_SAMFlags(unsigned char *, size_t, const SAMFlags *, size_t *);\nint    decode_SAMFlags(const unsigned char *, size_t, SAMFlags *, size_t *);\nvoid   free_SAMFlags  (SAMFlags *);\nsize_t length_SAMFlags(const SAMFlags *);\nint    copy_SAMFlags  (const SAMFlags *, SAMFlags *);\nunsigned SAMFlags2int(SAMFlags);\nSAMFlags int2SAMFlags(unsigned);\n#ifdef __PARSE_UNITS_H__\nconst struct units * asn1_SAMFlags_units(void);\n#endif\n\n\n/*\nPA-SAM-CHALLENGE-2-BODY ::= SEQUENCE {\n  sam-type              [0] krb5int32,\n  sam-flags             [1] SAMFlags,\n  sam-type-name         [2] GeneralString OPTIONAL,\n  sam-track-id          [3] GeneralString OPTIONAL,\n  sam-challenge-label   [4] GeneralString OPTIONAL,\n  sam-challenge         [5] GeneralString OPTIONAL,\n  sam-response-prompt   [6] GeneralString OPTIONAL,\n  sam-pk-for-sad        [7] EncryptionKey OPTIONAL,\n  sam-nonce             [8] krb5int32,\n  sam-etype             [9] krb5int32,\n  ...,\n}\n*/\n\ntypedef struct PA_SAM_CHALLENGE_2_BODY {\n  krb5int32 sam_type;\n  SAMFlags sam_flags;\n  heim_general_string *sam_type_name;\n  heim_general_string *sam_track_id;\n  heim_general_string *sam_challenge_label;\n  heim_general_string *sam_challenge;\n  heim_general_string *sam_response_prompt;\n  EncryptionKey *sam_pk_for_sad;\n  krb5int32 sam_nonce;\n  krb5int32 sam_etype;\n} PA_SAM_CHALLENGE_2_BODY;\n\nint    encode_PA_SAM_CHALLENGE_2_BODY(unsigned char *, size_t, const PA_SAM_CHALLENGE_2_BODY *, size_t *);\nint    decode_PA_SAM_CHALLENGE_2_BODY(const unsigned char *, size_t, PA_SAM_CHALLENGE_2_BODY *, size_t *);\nvoid   free_PA_SAM_CHALLENGE_2_BODY  (PA_SAM_CHALLENGE_2_BODY *);\nsize_t length_PA_SAM_CHALLENGE_2_BODY(const PA_SAM_CHALLENGE_2_BODY *);\nint    copy_PA_SAM_CHALLENGE_2_BODY  (const PA_SAM_CHALLENGE_2_BODY *, PA_SAM_CHALLENGE_2_BODY *);\n\n\n/*\nPA-SAM-CHALLENGE-2 ::= SEQUENCE {\n  sam-body        [0] PA-SAM-CHALLENGE-2-BODY,\n  sam-cksum       [1] SEQUENCE OF Checksum,\n  ...,\n}\n*/\n\ntypedef struct PA_SAM_CHALLENGE_2 {\n  PA_SAM_CHALLENGE_2_BODY sam_body;\n  struct  {\n    unsigned int len;\n    Checksum *val;\n  } sam_cksum;\n} PA_SAM_CHALLENGE_2;\n\nint    encode_PA_SAM_CHALLENGE_2(unsigned char *, size_t, const PA_SAM_CHALLENGE_2 *, size_t *);\nint    decode_PA_SAM_CHALLENGE_2(const unsigned char *, size_t, PA_SAM_CHALLENGE_2 *, size_t *);\nvoid   free_PA_SAM_CHALLENGE_2  (PA_SAM_CHALLENGE_2 *);\nsize_t length_PA_SAM_CHALLENGE_2(const PA_SAM_CHALLENGE_2 *);\nint    copy_PA_SAM_CHALLENGE_2  (const PA_SAM_CHALLENGE_2 *, PA_SAM_CHALLENGE_2 *);\n\n\n/*\nPA-SAM-RESPONSE-2 ::= SEQUENCE {\n  sam-type               [0] krb5int32,\n  sam-flags              [1] SAMFlags,\n  sam-track-id           [2] GeneralString OPTIONAL,\n  sam-enc-nonce-or-sad   [3] EncryptedData,\n  sam-nonce              [4] krb5int32,\n  ...,\n}\n*/\n\ntypedef struct PA_SAM_RESPONSE_2 {\n  krb5int32 sam_type;\n  SAMFlags sam_flags;\n  heim_general_string *sam_track_id;\n  EncryptedData sam_enc_nonce_or_sad;\n  krb5int32 sam_nonce;\n} PA_SAM_RESPONSE_2;\n\nint    encode_PA_SAM_RESPONSE_2(unsigned char *, size_t, const PA_SAM_RESPONSE_2 *, size_t *);\nint    decode_PA_SAM_RESPONSE_2(const unsigned char *, size_t, PA_SAM_RESPONSE_2 *, size_t *);\nvoid   free_PA_SAM_RESPONSE_2  (PA_SAM_RESPONSE_2 *);\nsize_t length_PA_SAM_RESPONSE_2(const PA_SAM_RESPONSE_2 *);\nint    copy_PA_SAM_RESPONSE_2  (const PA_SAM_RESPONSE_2 *, PA_SAM_RESPONSE_2 *);\n\n\n/*\nPA-ENC-SAM-RESPONSE-ENC ::= SEQUENCE {\n  sam-nonce       [0] krb5int32,\n  sam-sad         [1] GeneralString OPTIONAL,\n  ...,\n}\n*/\n\ntypedef struct PA_ENC_SAM_RESPONSE_ENC {\n  krb5int32 sam_nonce;\n  heim_general_string *sam_sad;\n} PA_ENC_SAM_RESPONSE_ENC;\n\nint    encode_PA_ENC_SAM_RESPONSE_ENC(unsigned char *, size_t, const PA_ENC_SAM_RESPONSE_ENC *, size_t *);\nint    decode_PA_ENC_SAM_RESPONSE_ENC(const unsigned char *, size_t, PA_ENC_SAM_RESPONSE_ENC *, size_t *);\nvoid   free_PA_ENC_SAM_RESPONSE_ENC  (PA_ENC_SAM_RESPONSE_ENC *);\nsize_t length_PA_ENC_SAM_RESPONSE_ENC(const PA_ENC_SAM_RESPONSE_ENC *);\nint    copy_PA_ENC_SAM_RESPONSE_ENC  (const PA_ENC_SAM_RESPONSE_ENC *, PA_ENC_SAM_RESPONSE_ENC *);\n\n\n/*\nPA-S4U2Self ::= SEQUENCE {\n  name            [0] PrincipalName,\n  realm           [1] Realm,\n  cksum           [2] Checksum,\n  auth            [3] GeneralString,\n}\n*/\n\ntypedef struct PA_S4U2Self {\n  PrincipalName name;\n  Realm realm;\n  Checksum cksum;\n  heim_general_string auth;\n} PA_S4U2Self;\n\nint    encode_PA_S4U2Self(unsigned char *, size_t, const PA_S4U2Self *, size_t *);\nint    decode_PA_S4U2Self(const unsigned char *, size_t, PA_S4U2Self *, size_t *);\nvoid   free_PA_S4U2Self  (PA_S4U2Self *);\nsize_t length_PA_S4U2Self(const PA_S4U2Self *);\nint    copy_PA_S4U2Self  (const PA_S4U2Self *, PA_S4U2Self *);\n\n\n/*\nKRB5SignedPathPrincipals ::= SEQUENCE OF Principal\n*/\n\ntypedef struct KRB5SignedPathPrincipals {\n  unsigned int len;\n  Principal *val;\n} KRB5SignedPathPrincipals;\n\nint    encode_KRB5SignedPathPrincipals(unsigned char *, size_t, const KRB5SignedPathPrincipals *, size_t *);\nint    decode_KRB5SignedPathPrincipals(const unsigned char *, size_t, KRB5SignedPathPrincipals *, size_t *);\nvoid   free_KRB5SignedPathPrincipals  (KRB5SignedPathPrincipals *);\nsize_t length_KRB5SignedPathPrincipals(const KRB5SignedPathPrincipals *);\nint    copy_KRB5SignedPathPrincipals  (const KRB5SignedPathPrincipals *, KRB5SignedPathPrincipals *);\nint   add_KRB5SignedPathPrincipals  (KRB5SignedPathPrincipals *, const Principal *);\nint   remove_KRB5SignedPathPrincipals  (KRB5SignedPathPrincipals *, unsigned int);\n\n\n/*\nKRB5SignedPathData ::= SEQUENCE {\n  encticket       [0] EncTicketPart,\n  delegated       [1] KRB5SignedPathPrincipals OPTIONAL,\n}\n*/\n\ntypedef struct KRB5SignedPathData {\n  EncTicketPart encticket;\n  KRB5SignedPathPrincipals *delegated;\n} KRB5SignedPathData;\n\nint    encode_KRB5SignedPathData(unsigned char *, size_t, const KRB5SignedPathData *, size_t *);\nint    decode_KRB5SignedPathData(const unsigned char *, size_t, KRB5SignedPathData *, size_t *);\nvoid   free_KRB5SignedPathData  (KRB5SignedPathData *);\nsize_t length_KRB5SignedPathData(const KRB5SignedPathData *);\nint    copy_KRB5SignedPathData  (const KRB5SignedPathData *, KRB5SignedPathData *);\n\n\n/*\nKRB5SignedPath ::= SEQUENCE {\n  etype           [0] ENCTYPE,\n  cksum           [1] Checksum,\n  delegated       [2] KRB5SignedPathPrincipals OPTIONAL,\n}\n*/\n\ntypedef struct KRB5SignedPath {\n  ENCTYPE etype;\n  Checksum cksum;\n  KRB5SignedPathPrincipals *delegated;\n} KRB5SignedPath;\n\nint    encode_KRB5SignedPath(unsigned char *, size_t, const KRB5SignedPath *, size_t *);\nint    decode_KRB5SignedPath(const unsigned char *, size_t, KRB5SignedPath *, size_t *);\nvoid   free_KRB5SignedPath  (KRB5SignedPath *);\nsize_t length_KRB5SignedPath(const KRB5SignedPath *);\nint    copy_KRB5SignedPath  (const KRB5SignedPath *, KRB5SignedPath *);\n\n\n/*\nPA-ClientCanonicalizedNames ::= SEQUENCE {\n  requested-name   [0] PrincipalName,\n  real-name        [1] PrincipalName,\n}\n*/\n\ntypedef struct PA_ClientCanonicalizedNames {\n  PrincipalName requested_name;\n  PrincipalName real_name;\n} PA_ClientCanonicalizedNames;\n\nint    encode_PA_ClientCanonicalizedNames(unsigned char *, size_t, const PA_ClientCanonicalizedNames *, size_t *);\nint    decode_PA_ClientCanonicalizedNames(const unsigned char *, size_t, PA_ClientCanonicalizedNames *, size_t *);\nvoid   free_PA_ClientCanonicalizedNames  (PA_ClientCanonicalizedNames *);\nsize_t length_PA_ClientCanonicalizedNames(const PA_ClientCanonicalizedNames *);\nint    copy_PA_ClientCanonicalizedNames  (const PA_ClientCanonicalizedNames *, PA_ClientCanonicalizedNames *);\n\n\n/*\nPA-ClientCanonicalized ::= SEQUENCE {\n  names            [0] PA-ClientCanonicalizedNames,\n  canon-checksum   [1] Checksum,\n}\n*/\n\ntypedef struct PA_ClientCanonicalized {\n  PA_ClientCanonicalizedNames names;\n  Checksum canon_checksum;\n} PA_ClientCanonicalized;\n\nint    encode_PA_ClientCanonicalized(unsigned char *, size_t, const PA_ClientCanonicalized *, size_t *);\nint    decode_PA_ClientCanonicalized(const unsigned char *, size_t, PA_ClientCanonicalized *, size_t *);\nvoid   free_PA_ClientCanonicalized  (PA_ClientCanonicalized *);\nsize_t length_PA_ClientCanonicalized(const PA_ClientCanonicalized *);\nint    copy_PA_ClientCanonicalized  (const PA_ClientCanonicalized *, PA_ClientCanonicalized *);\n\n\n/*\nAD-LoginAlias ::= SEQUENCE {\n  login-alias     [0] PrincipalName,\n  checksum        [1] Checksum,\n}\n*/\n\ntypedef struct AD_LoginAlias {\n  PrincipalName login_alias;\n  Checksum checksum;\n} AD_LoginAlias;\n\nint    encode_AD_LoginAlias(unsigned char *, size_t, const AD_LoginAlias *, size_t *);\nint    decode_AD_LoginAlias(const unsigned char *, size_t, AD_LoginAlias *, size_t *);\nvoid   free_AD_LoginAlias  (AD_LoginAlias *);\nsize_t length_AD_LoginAlias(const AD_LoginAlias *);\nint    copy_AD_LoginAlias  (const AD_LoginAlias *, AD_LoginAlias *);\n\n\n/*\nPA-SvrReferralData ::= SEQUENCE {\n  referred-name    [1] PrincipalName OPTIONAL,\n  referred-realm   [0] Realm,\n}\n*/\n\ntypedef struct PA_SvrReferralData {\n  PrincipalName *referred_name;\n  Realm referred_realm;\n} PA_SvrReferralData;\n\nint    encode_PA_SvrReferralData(unsigned char *, size_t, const PA_SvrReferralData *, size_t *);\nint    decode_PA_SvrReferralData(const unsigned char *, size_t, PA_SvrReferralData *, size_t *);\nvoid   free_PA_SvrReferralData  (PA_SvrReferralData *);\nsize_t length_PA_SvrReferralData(const PA_SvrReferralData *);\nint    copy_PA_SvrReferralData  (const PA_SvrReferralData *, PA_SvrReferralData *);\n\n\n#endif /* __krb5_asn1_h__ */\n"
  },
  {
    "path": "freebsd-headers/krb5_err.h",
    "content": "/* Generated from /usr/src/kerberos5/lib/libkrb5/../../../crypto/heimdal/lib/krb5/krb5_err.et */\n/* $Id: krb5_err.et 21050 2007-06-12 02:00:40Z lha $ */\n\n#ifndef __krb5_err_h__\n#define __krb5_err_h__\n\nstruct et_list;\n\nvoid initialize_krb5_error_table_r(struct et_list **);\n\nvoid initialize_krb5_error_table(void);\n#define init_krb5_err_tbl initialize_krb5_error_table\n\ntypedef enum krb5_error_number{\n\tKRB5KDC_ERR_NONE = -1765328384,\n\tKRB5KDC_ERR_NAME_EXP = -1765328383,\n\tKRB5KDC_ERR_SERVICE_EXP = -1765328382,\n\tKRB5KDC_ERR_BAD_PVNO = -1765328381,\n\tKRB5KDC_ERR_C_OLD_MAST_KVNO = -1765328380,\n\tKRB5KDC_ERR_S_OLD_MAST_KVNO = -1765328379,\n\tKRB5KDC_ERR_C_PRINCIPAL_UNKNOWN = -1765328378,\n\tKRB5KDC_ERR_S_PRINCIPAL_UNKNOWN = -1765328377,\n\tKRB5KDC_ERR_PRINCIPAL_NOT_UNIQUE = -1765328376,\n\tKRB5KDC_ERR_NULL_KEY = -1765328375,\n\tKRB5KDC_ERR_CANNOT_POSTDATE = -1765328374,\n\tKRB5KDC_ERR_NEVER_VALID = -1765328373,\n\tKRB5KDC_ERR_POLICY = -1765328372,\n\tKRB5KDC_ERR_BADOPTION = -1765328371,\n\tKRB5KDC_ERR_ETYPE_NOSUPP = -1765328370,\n\tKRB5KDC_ERR_SUMTYPE_NOSUPP = -1765328369,\n\tKRB5KDC_ERR_PADATA_TYPE_NOSUPP = -1765328368,\n\tKRB5KDC_ERR_TRTYPE_NOSUPP = -1765328367,\n\tKRB5KDC_ERR_CLIENT_REVOKED = -1765328366,\n\tKRB5KDC_ERR_SERVICE_REVOKED = -1765328365,\n\tKRB5KDC_ERR_TGT_REVOKED = -1765328364,\n\tKRB5KDC_ERR_CLIENT_NOTYET = -1765328363,\n\tKRB5KDC_ERR_SERVICE_NOTYET = -1765328362,\n\tKRB5KDC_ERR_KEY_EXPIRED = -1765328361,\n\tKRB5KDC_ERR_PREAUTH_FAILED = -1765328360,\n\tKRB5KDC_ERR_PREAUTH_REQUIRED = -1765328359,\n\tKRB5KDC_ERR_SERVER_NOMATCH = -1765328358,\n\tKRB5KDC_ERR_KDC_ERR_MUST_USE_USER2USER = -1765328357,\n\tKRB5KDC_ERR_PATH_NOT_ACCEPTED = -1765328356,\n\tKRB5KDC_ERR_SVC_UNAVAILABLE = -1765328355,\n\tKRB5KRB_AP_ERR_BAD_INTEGRITY = -1765328353,\n\tKRB5KRB_AP_ERR_TKT_EXPIRED = -1765328352,\n\tKRB5KRB_AP_ERR_TKT_NYV = -1765328351,\n\tKRB5KRB_AP_ERR_REPEAT = -1765328350,\n\tKRB5KRB_AP_ERR_NOT_US = -1765328349,\n\tKRB5KRB_AP_ERR_BADMATCH = -1765328348,\n\tKRB5KRB_AP_ERR_SKEW = -1765328347,\n\tKRB5KRB_AP_ERR_BADADDR = -1765328346,\n\tKRB5KRB_AP_ERR_BADVERSION = -1765328345,\n\tKRB5KRB_AP_ERR_MSG_TYPE = -1765328344,\n\tKRB5KRB_AP_ERR_MODIFIED = -1765328343,\n\tKRB5KRB_AP_ERR_BADORDER = -1765328342,\n\tKRB5KRB_AP_ERR_ILL_CR_TKT = -1765328341,\n\tKRB5KRB_AP_ERR_BADKEYVER = -1765328340,\n\tKRB5KRB_AP_ERR_NOKEY = -1765328339,\n\tKRB5KRB_AP_ERR_MUT_FAIL = -1765328338,\n\tKRB5KRB_AP_ERR_BADDIRECTION = -1765328337,\n\tKRB5KRB_AP_ERR_METHOD = -1765328336,\n\tKRB5KRB_AP_ERR_BADSEQ = -1765328335,\n\tKRB5KRB_AP_ERR_INAPP_CKSUM = -1765328334,\n\tKRB5KRB_AP_PATH_NOT_ACCEPTED = -1765328333,\n\tKRB5KRB_ERR_RESPONSE_TOO_BIG = -1765328332,\n\tKRB5KRB_ERR_GENERIC = -1765328324,\n\tKRB5KRB_ERR_FIELD_TOOLONG = -1765328323,\n\tKRB5_KDC_ERR_CLIENT_NOT_TRUSTED = -1765328322,\n\tKRB5_KDC_ERR_KDC_NOT_TRUSTED = -1765328321,\n\tKRB5_KDC_ERR_INVALID_SIG = -1765328320,\n\tKRB5_KDC_ERR_DH_KEY_PARAMETERS_NOT_ACCEPTED = -1765328319,\n\tKRB5_KDC_ERR_WRONG_REALM = -1765328316,\n\tKRB5_AP_ERR_USER_TO_USER_REQUIRED = -1765328315,\n\tKRB5_KDC_ERR_CANT_VERIFY_CERTIFICATE = -1765328314,\n\tKRB5_KDC_ERR_INVALID_CERTIFICATE = -1765328313,\n\tKRB5_KDC_ERR_REVOKED_CERTIFICATE = -1765328312,\n\tKRB5_KDC_ERR_REVOCATION_STATUS_UNKNOWN = -1765328311,\n\tKRB5_KDC_ERR_REVOCATION_STATUS_UNAVAILABLE = -1765328310,\n\tKRB5_KDC_ERR_CLIENT_NAME_MISMATCH = -1765328309,\n\tKRB5_KDC_ERR_INCONSISTENT_KEY_PURPOSE = -1765328308,\n\tKRB5_KDC_ERR_DIGEST_IN_CERT_NOT_ACCEPTED = -1765328307,\n\tKRB5_KDC_ERR_PA_CHECKSUM_MUST_BE_INCLUDED = -1765328306,\n\tKRB5_KDC_ERR_DIGEST_IN_SIGNED_DATA_NOT_ACCEPTED = -1765328305,\n\tKRB5_KDC_ERR_PUBLIC_KEY_ENCRYPTION_NOT_SUPPORTED = -1765328304,\n\tKRB5_ERR_RCSID = -1765328256,\n\tKRB5_LIBOS_BADLOCKFLAG = -1765328255,\n\tKRB5_LIBOS_CANTREADPWD = -1765328254,\n\tKRB5_LIBOS_BADPWDMATCH = -1765328253,\n\tKRB5_LIBOS_PWDINTR = -1765328252,\n\tKRB5_PARSE_ILLCHAR = -1765328251,\n\tKRB5_PARSE_MALFORMED = -1765328250,\n\tKRB5_CONFIG_CANTOPEN = -1765328249,\n\tKRB5_CONFIG_BADFORMAT = -1765328248,\n\tKRB5_CONFIG_NOTENUFSPACE = -1765328247,\n\tKRB5_BADMSGTYPE = -1765328246,\n\tKRB5_CC_BADNAME = -1765328245,\n\tKRB5_CC_UNKNOWN_TYPE = -1765328244,\n\tKRB5_CC_NOTFOUND = -1765328243,\n\tKRB5_CC_END = -1765328242,\n\tKRB5_NO_TKT_SUPPLIED = -1765328241,\n\tKRB5KRB_AP_WRONG_PRINC = -1765328240,\n\tKRB5KRB_AP_ERR_TKT_INVALID = -1765328239,\n\tKRB5_PRINC_NOMATCH = -1765328238,\n\tKRB5_KDCREP_MODIFIED = -1765328237,\n\tKRB5_KDCREP_SKEW = -1765328236,\n\tKRB5_IN_TKT_REALM_MISMATCH = -1765328235,\n\tKRB5_PROG_ETYPE_NOSUPP = -1765328234,\n\tKRB5_PROG_KEYTYPE_NOSUPP = -1765328233,\n\tKRB5_WRONG_ETYPE = -1765328232,\n\tKRB5_PROG_SUMTYPE_NOSUPP = -1765328231,\n\tKRB5_REALM_UNKNOWN = -1765328230,\n\tKRB5_SERVICE_UNKNOWN = -1765328229,\n\tKRB5_KDC_UNREACH = -1765328228,\n\tKRB5_NO_LOCALNAME = -1765328227,\n\tKRB5_MUTUAL_FAILED = -1765328226,\n\tKRB5_RC_TYPE_EXISTS = -1765328225,\n\tKRB5_RC_MALLOC = -1765328224,\n\tKRB5_RC_TYPE_NOTFOUND = -1765328223,\n\tKRB5_RC_UNKNOWN = -1765328222,\n\tKRB5_RC_REPLAY = -1765328221,\n\tKRB5_RC_IO = -1765328220,\n\tKRB5_RC_NOIO = -1765328219,\n\tKRB5_RC_PARSE = -1765328218,\n\tKRB5_RC_IO_EOF = -1765328217,\n\tKRB5_RC_IO_MALLOC = -1765328216,\n\tKRB5_RC_IO_PERM = -1765328215,\n\tKRB5_RC_IO_IO = -1765328214,\n\tKRB5_RC_IO_UNKNOWN = -1765328213,\n\tKRB5_RC_IO_SPACE = -1765328212,\n\tKRB5_TRANS_CANTOPEN = -1765328211,\n\tKRB5_TRANS_BADFORMAT = -1765328210,\n\tKRB5_LNAME_CANTOPEN = -1765328209,\n\tKRB5_LNAME_NOTRANS = -1765328208,\n\tKRB5_LNAME_BADFORMAT = -1765328207,\n\tKRB5_CRYPTO_INTERNAL = -1765328206,\n\tKRB5_KT_BADNAME = -1765328205,\n\tKRB5_KT_UNKNOWN_TYPE = -1765328204,\n\tKRB5_KT_NOTFOUND = -1765328203,\n\tKRB5_KT_END = -1765328202,\n\tKRB5_KT_NOWRITE = -1765328201,\n\tKRB5_KT_IOERR = -1765328200,\n\tKRB5_NO_TKT_IN_RLM = -1765328199,\n\tKRB5DES_BAD_KEYPAR = -1765328198,\n\tKRB5DES_WEAK_KEY = -1765328197,\n\tKRB5_BAD_ENCTYPE = -1765328196,\n\tKRB5_BAD_KEYSIZE = -1765328195,\n\tKRB5_BAD_MSIZE = -1765328194,\n\tKRB5_CC_TYPE_EXISTS = -1765328193,\n\tKRB5_KT_TYPE_EXISTS = -1765328192,\n\tKRB5_CC_IO = -1765328191,\n\tKRB5_FCC_PERM = -1765328190,\n\tKRB5_FCC_NOFILE = -1765328189,\n\tKRB5_FCC_INTERNAL = -1765328188,\n\tKRB5_CC_WRITE = -1765328187,\n\tKRB5_CC_NOMEM = -1765328186,\n\tKRB5_CC_FORMAT = -1765328185,\n\tKRB5_CC_NOT_KTYPE = -1765328184,\n\tKRB5_INVALID_FLAGS = -1765328183,\n\tKRB5_NO_2ND_TKT = -1765328182,\n\tKRB5_NOCREDS_SUPPLIED = -1765328181,\n\tKRB5_SENDAUTH_BADAUTHVERS = -1765328180,\n\tKRB5_SENDAUTH_BADAPPLVERS = -1765328179,\n\tKRB5_SENDAUTH_BADRESPONSE = -1765328178,\n\tKRB5_SENDAUTH_REJECTED = -1765328177,\n\tKRB5_PREAUTH_BAD_TYPE = -1765328176,\n\tKRB5_PREAUTH_NO_KEY = -1765328175,\n\tKRB5_PREAUTH_FAILED = -1765328174,\n\tKRB5_RCACHE_BADVNO = -1765328173,\n\tKRB5_CCACHE_BADVNO = -1765328172,\n\tKRB5_KEYTAB_BADVNO = -1765328171,\n\tKRB5_PROG_ATYPE_NOSUPP = -1765328170,\n\tKRB5_RC_REQUIRED = -1765328169,\n\tKRB5_ERR_BAD_HOSTNAME = -1765328168,\n\tKRB5_ERR_HOST_REALM_UNKNOWN = -1765328167,\n\tKRB5_SNAME_UNSUPP_NAMETYPE = -1765328166,\n\tKRB5KRB_AP_ERR_V4_REPLY = -1765328165,\n\tKRB5_REALM_CANT_RESOLVE = -1765328164,\n\tKRB5_TKT_NOT_FORWARDABLE = -1765328163,\n\tKRB5_FWD_BAD_PRINCIPAL = -1765328162,\n\tKRB5_GET_IN_TKT_LOOP = -1765328161,\n\tKRB5_CONFIG_NODEFREALM = -1765328160,\n\tKRB5_SAM_UNSUPPORTED = -1765328159,\n\tKRB5_SAM_INVALID_ETYPE = -1765328158,\n\tKRB5_SAM_NO_CHECKSUM = -1765328157,\n\tKRB5_SAM_BAD_CHECKSUM = -1765328156,\n\tKRB5_OBSOLETE_FN = -1765328146,\n\tKRB5_ERR_BAD_S2K_PARAMS = -1765328139,\n\tKRB5_ERR_NO_SERVICE = -1765328138,\n\tKRB5_CC_NOSUPP = -1765328137,\n\tKRB5_DELTAT_BADFORMAT = -1765328136\n} krb5_error_number;\n\n#define ERROR_TABLE_BASE_krb5 -1765328384\n\n#endif /* __krb5_err_h__ */\n"
  },
  {
    "path": "freebsd-headers/krb_err.h",
    "content": "/* Generated from /usr/src/kerberos5/lib/libkrb5/../../../crypto/heimdal/lib/krb5/krb_err.et */\n/* $Id: krb_err.et,v 1.7 1998/03/29 14:19:52 bg Exp $ */\n\n#ifndef __krb_err_h__\n#define __krb_err_h__\n\nstruct et_list;\n\nvoid initialize_krb_error_table_r(struct et_list **);\n\nvoid initialize_krb_error_table(void);\n#define init_krb_err_tbl initialize_krb_error_table\n\ntypedef enum krb_error_number{\n\tKRB4ET_KSUCCESS = 39525376,\n\tKRB4ET_KDC_NAME_EXP = 39525377,\n\tKRB4ET_KDC_SERVICE_EXP = 39525378,\n\tKRB4ET_KDC_AUTH_EXP = 39525379,\n\tKRB4ET_KDC_PKT_VER = 39525380,\n\tKRB4ET_KDC_P_MKEY_VER = 39525381,\n\tKRB4ET_KDC_S_MKEY_VER = 39525382,\n\tKRB4ET_KDC_BYTE_ORDER = 39525383,\n\tKRB4ET_KDC_PR_UNKNOWN = 39525384,\n\tKRB4ET_KDC_PR_N_UNIQUE = 39525385,\n\tKRB4ET_KDC_NULL_KEY = 39525386,\n\tKRB4ET_KDC_GEN_ERR = 39525396,\n\tKRB4ET_GC_TKFIL = 39525397,\n\tKRB4ET_GC_NOTKT = 39525398,\n\tKRB4ET_MK_AP_TGTEXP = 39525402,\n\tKRB4ET_RD_AP_UNDEC = 39525407,\n\tKRB4ET_RD_AP_EXP = 39525408,\n\tKRB4ET_RD_AP_NYV = 39525409,\n\tKRB4ET_RD_AP_REPEAT = 39525410,\n\tKRB4ET_RD_AP_NOT_US = 39525411,\n\tKRB4ET_RD_AP_INCON = 39525412,\n\tKRB4ET_RD_AP_TIME = 39525413,\n\tKRB4ET_RD_AP_BADD = 39525414,\n\tKRB4ET_RD_AP_VERSION = 39525415,\n\tKRB4ET_RD_AP_MSG_TYPE = 39525416,\n\tKRB4ET_RD_AP_MODIFIED = 39525417,\n\tKRB4ET_RD_AP_ORDER = 39525418,\n\tKRB4ET_RD_AP_UNAUTHOR = 39525419,\n\tKRB4ET_GT_PW_NULL = 39525427,\n\tKRB4ET_GT_PW_BADPW = 39525428,\n\tKRB4ET_GT_PW_PROT = 39525429,\n\tKRB4ET_GT_PW_KDCERR = 39525430,\n\tKRB4ET_GT_PW_NULLTKT = 39525431,\n\tKRB4ET_SKDC_RETRY = 39525432,\n\tKRB4ET_SKDC_CANT = 39525433,\n\tKRB4ET_INTK_W_NOTALL = 39525437,\n\tKRB4ET_INTK_BADPW = 39525438,\n\tKRB4ET_INTK_PROT = 39525439,\n\tKRB4ET_INTK_ERR = 39525446,\n\tKRB4ET_AD_NOTGT = 39525447,\n\tKRB4ET_NO_TKT_FIL = 39525452,\n\tKRB4ET_TKT_FIL_ACC = 39525453,\n\tKRB4ET_TKT_FIL_LCK = 39525454,\n\tKRB4ET_TKT_FIL_FMT = 39525455,\n\tKRB4ET_TKT_FIL_INI = 39525456,\n\tKRB4ET_KNAME_FMT = 39525457\n} krb_error_number;\n\n#define ERROR_TABLE_BASE_krb 39525376\n\n#endif /* __krb_err_h__ */\n"
  },
  {
    "path": "freebsd-headers/kvm.h",
    "content": "/*-\n * Copyright (c) 1989, 1993\n *\tThe Regents of the University of California.  All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 4. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t@(#)kvm.h\t8.1 (Berkeley) 6/2/93\n * $FreeBSD: release/9.0.0/lib/libkvm/kvm.h 217744 2011-01-23 11:08:28Z uqs $\n */\n\n#ifndef _KVM_H_\n#define\t_KVM_H_\n\n#include <sys/cdefs.h>\n#include <sys/_types.h>\n#include <nlist.h>\n\n/* Default version symbol. */\n#define\tVRS_SYM\t\t\"_version\"\n#define\tVRS_KEY\t\t\"VERSION\"\n\n#ifndef _SIZE_T_DECLARED\ntypedef\t__size_t\tsize_t;\n#define\t_SIZE_T_DECLARED\n#endif\n\n#ifndef _SSIZE_T_DECLARED\ntypedef\t__ssize_t\tssize_t;\n#define\t_SSIZE_T_DECLARED\n#endif\n\ntypedef struct __kvm kvm_t;\n\nstruct kinfo_proc;\nstruct proc;\n\nstruct kvm_swap {\n\tchar\tksw_devname[32];\n\tint\tksw_used;\n\tint\tksw_total;\n\tint\tksw_flags;\n\tint\tksw_reserved1;\n\tint\tksw_reserved2;\n};\n\n#define SWIF_DEV_PREFIX\t0x0002\n\n__BEGIN_DECLS\nint\t  kvm_close(kvm_t *);\nint\t  kvm_dpcpu_setcpu(kvm_t *, unsigned int);\nchar\t**kvm_getargv(kvm_t *, const struct kinfo_proc *, int);\nint\t  kvm_getcptime(kvm_t *, long *);\nchar\t**kvm_getenvv(kvm_t *, const struct kinfo_proc *, int);\nchar\t *kvm_geterr(kvm_t *);\nchar\t *kvm_getfiles(kvm_t *, int, int, int *);\nint\t  kvm_getloadavg(kvm_t *, double [], int);\nint\t  kvm_getmaxcpu(kvm_t *);\nvoid\t *kvm_getpcpu(kvm_t *, int);\nstruct kinfo_proc *\n\t  kvm_getprocs(kvm_t *, int, int, int *);\nint\t  kvm_getswapinfo(kvm_t *, struct kvm_swap *, int, int);\nint\t  kvm_nlist(kvm_t *, struct nlist *);\nkvm_t\t *kvm_open\n\t    (const char *, const char *, const char *, int, const char *);\nkvm_t\t *kvm_openfiles\n\t    (const char *, const char *, const char *, int, char *);\nssize_t\t  kvm_read(kvm_t *, unsigned long, void *, size_t);\nssize_t\t  kvm_uread\n\t    (kvm_t *, const struct kinfo_proc *, unsigned long, char *, size_t);\nssize_t\t  kvm_write(kvm_t *, unsigned long, const void *, size_t);\n__END_DECLS\n\n#endif /* !_KVM_H_ */\n"
  },
  {
    "path": "freebsd-headers/kx509_asn1.h",
    "content": "/* Generated from /usr/src/kerberos5/lib/libasn1/../../../crypto/heimdal/lib/asn1/kx509.asn1 */\n/* Do not edit */\n\n#ifndef __kx509_asn1_h__\n#define __kx509_asn1_h__\n\n#include <stddef.h>\n#include <time.h>\n\n#ifndef __asn1_common_definitions__\n#define __asn1_common_definitions__\n\ntypedef struct heim_integer {\n  size_t length;\n  void *data;\n  int negative;\n} heim_integer;\n\ntypedef struct heim_octet_string {\n  size_t length;\n  void *data;\n} heim_octet_string;\n\ntypedef char *heim_general_string;\n\ntypedef char *heim_utf8_string;\n\ntypedef char *heim_printable_string;\n\ntypedef char *heim_ia5_string;\n\ntypedef struct heim_bmp_string {\n  size_t length;\n  uint16_t *data;\n} heim_bmp_string;\n\ntypedef struct heim_universal_string {\n  size_t length;\n  uint32_t *data;\n} heim_universal_string;\n\ntypedef char *heim_visible_string;\n\ntypedef struct heim_oid {\n  size_t length;\n  unsigned *components;\n} heim_oid;\n\ntypedef struct heim_bit_string {\n  size_t length;\n  void *data;\n} heim_bit_string;\n\ntypedef struct heim_octet_string heim_any;\ntypedef struct heim_octet_string heim_any_set;\n\n#define ASN1_MALLOC_ENCODE(T, B, BL, S, L, R)                  \\\n  do {                                                         \\\n    (BL) = length_##T((S));                                    \\\n    (B) = malloc((BL));                                        \\\n    if((B) == NULL) {                                          \\\n      (R) = ENOMEM;                                            \\\n    } else {                                                   \\\n      (R) = encode_##T(((unsigned char*)(B)) + (BL) - 1, (BL), \\\n                       (S), (L));                              \\\n      if((R) != 0) {                                           \\\n        free((B));                                             \\\n        (B) = NULL;                                            \\\n      }                                                        \\\n    }                                                          \\\n  } while (0)\n\nstruct units;\n\n#endif\n\n/*\nKx509Request ::= SEQUENCE {\n  authenticator   OCTET STRING,\n  pk-hash         OCTET STRING,\n  pk-key          OCTET STRING,\n}\n*/\n\ntypedef struct Kx509Request {\n  heim_octet_string authenticator;\n  heim_octet_string pk_hash;\n  heim_octet_string pk_key;\n} Kx509Request;\n\nint    encode_Kx509Request(unsigned char *, size_t, const Kx509Request *, size_t *);\nint    decode_Kx509Request(const unsigned char *, size_t, Kx509Request *, size_t *);\nvoid   free_Kx509Request  (Kx509Request *);\nsize_t length_Kx509Request(const Kx509Request *);\nint    copy_Kx509Request  (const Kx509Request *, Kx509Request *);\n\n\n/*\nKx509Response ::= SEQUENCE {\n  error-code      [0] INTEGER (-2147483648..2147483647) OPTIONAL,\n  hash            [1] OCTET STRING OPTIONAL,\n  certificate     [2] OCTET STRING OPTIONAL,\n  e-text          [3]   VisibleString OPTIONAL,\n}\n*/\n\ntypedef struct Kx509Response {\n  int *error_code;\n  heim_octet_string *hash;\n  heim_octet_string *certificate;\n  heim_visible_string *e_text;\n} Kx509Response;\n\nint    encode_Kx509Response(unsigned char *, size_t, const Kx509Response *, size_t *);\nint    decode_Kx509Response(const unsigned char *, size_t, Kx509Response *, size_t *);\nvoid   free_Kx509Response  (Kx509Response *);\nsize_t length_Kx509Response(const Kx509Response *);\nint    copy_Kx509Response  (const Kx509Response *, Kx509Response *);\n\n\n#endif /* __kx509_asn1_h__ */\n"
  },
  {
    "path": "freebsd-headers/langinfo.h",
    "content": "/*-\n * Copyright (c) 2001 Alexey Zelkin <phantom@FreeBSD.org>\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/include/langinfo.h 197764 2009-10-05 07:11:19Z edwin $\n */\n\n#ifndef _LANGINFO_H_\n#define\t_LANGINFO_H_\n\n#include <sys/cdefs.h>\n#include <sys/_types.h>\n\n#ifndef _NL_ITEM_DECLARED\ntypedef\t__nl_item\tnl_item;\n#define\t_NL_ITEM_DECLARED\n#endif\n\n#define\tCODESET\t\t0\t/* codeset name */\n#define\tD_T_FMT\t\t1\t/* string for formatting date and time */\n#define\tD_FMT\t\t2\t/* date format string */\n#define\tT_FMT\t\t3\t/* time format string */\n#define\tT_FMT_AMPM\t4\t/* a.m. or p.m. time formatting string */\n#define\tAM_STR\t\t5\t/* Ante Meridian affix */\n#define\tPM_STR\t\t6\t/* Post Meridian affix */\n\n/* week day names */\n#define\tDAY_1\t\t7\n#define\tDAY_2\t\t8\n#define\tDAY_3\t\t9\n#define\tDAY_4\t\t10\n#define\tDAY_5\t\t11\n#define\tDAY_6\t\t12\n#define\tDAY_7\t\t13\n\n/* abbreviated week day names */\n#define\tABDAY_1\t\t14\n#define\tABDAY_2\t\t15\n#define\tABDAY_3\t\t16\n#define\tABDAY_4\t\t17\n#define\tABDAY_5\t\t18\n#define\tABDAY_6\t\t19\n#define\tABDAY_7\t\t20\n\n/* month names */\n#define\tMON_1\t\t21\n#define\tMON_2\t\t22\n#define\tMON_3\t\t23\n#define\tMON_4\t\t24\n#define\tMON_5\t\t25\n#define\tMON_6\t\t26\n#define\tMON_7\t\t27\n#define\tMON_8\t\t28\n#define\tMON_9\t\t29\n#define\tMON_10\t\t30\n#define\tMON_11\t\t31\n#define\tMON_12\t\t32\n\n/* abbreviated month names */\n#define\tABMON_1\t\t33\n#define\tABMON_2\t\t34\n#define\tABMON_3\t\t35\n#define\tABMON_4\t\t36\n#define\tABMON_5\t\t37\n#define\tABMON_6\t\t38\n#define\tABMON_7\t\t39\n#define\tABMON_8\t\t40\n#define\tABMON_9\t\t41\n#define\tABMON_10\t42\n#define\tABMON_11\t43\n#define\tABMON_12\t44\n\n#define\tERA\t\t45\t/* era description segments */\n#define\tERA_D_FMT\t46\t/* era date format string */\n#define\tERA_D_T_FMT\t47\t/* era date and time format string */\n#define\tERA_T_FMT\t48\t/* era time format string */\n#define\tALT_DIGITS\t49\t/* alternative symbols for digits */\n\n#define\tRADIXCHAR\t50\t/* radix char */\n#define\tTHOUSEP\t\t51\t/* separator for thousands */\n\n#define\tYESEXPR\t\t52\t/* affirmative response expression */\n#define\tNOEXPR\t\t53\t/* negative response expression */\n\n#if __BSD_VISIBLE || __XSI_VISIBLE <= 500\n#define\tYESSTR\t\t54\t/* affirmative response for yes/no queries */\n#define\tNOSTR\t\t55\t/* negative response for yes/no queries */\n#endif\n\n#define\tCRNCYSTR\t56\t/* currency symbol */\n\n#if __BSD_VISIBLE\n#define\tD_MD_ORDER\t57\t/* month/day order (local extension) */\n#endif\n\n/* standalone months forms for %OB */\n#define\tALTMON_1\t58\n#define\tALTMON_2\t59\n#define\tALTMON_3\t60\n#define\tALTMON_4\t61\n#define\tALTMON_5\t62\n#define\tALTMON_6\t63\n#define\tALTMON_7\t64\n#define\tALTMON_8\t65\n#define\tALTMON_9\t66\n#define\tALTMON_10\t67\n#define\tALTMON_11\t68\n#define\tALTMON_12\t69\n\n__BEGIN_DECLS\nchar\t*nl_langinfo(nl_item);\n__END_DECLS\n\n#endif /* !_LANGINFO_H_ */\n"
  },
  {
    "path": "freebsd-headers/libdisk.h",
    "content": "/*\n* ----------------------------------------------------------------------------\n* \"THE BEER-WARE LICENSE\" (Revision 42):\n* <phk@FreeBSD.org> wrote this file.  As long as you retain this notice you\n* can do whatever you want with this stuff. If we meet some day, and you think\n* this stuff is worth it, you can buy me a beer in return.   Poul-Henning Kamp\n* ----------------------------------------------------------------------------\n*\n* $FreeBSD: release/9.0.0/lib/libdisk/libdisk.h 178765 2008-05-04 22:24:40Z gonzo $\n*\n*/\n\n#ifndef _LIBDISK_H_\n#define _LIBDISK_H_\n\n/* #define DEBUG 1 */\n/* You can define a particular architecture here if you are debugging. */\n/* #define P_DEBUG p_sparc64 */\n\n#define MAX_NO_DISKS\t32\n/* Max # of disks Disk_Names() will return */\n\n#define MAX_SEC_SIZE    2048  /* maximum sector size that is supported */\n#define MIN_SEC_SIZE\t512   /* the sector size to end sensing at */\n\nenum platform {\n\tp_any,\t\t\t/* for debugging ! */\n\tp_alpha,\n\tp_i386,\n\tp_pc98,\n\tp_sparc64,\n\tp_ia64,\n\tp_ppc,\n\tp_amd64,\n\tp_arm,\n\tp_mips\n};\nextern const enum platform platform;\n\ntypedef enum {\n\twhole,\n\tunknown,\n\n\tsun,\n\tpc98,\n\tmbr,\n\tgpt,\n\n\tefi,\n\tfat,\n\tfreebsd,\n\textended,\n\tpart,\n\tspare,\n\tunused,\n\n\tapple\n} chunk_e;\n\n__BEGIN_DECLS\n#ifndef __ia64__\nstruct disk {\n\tchar\t\t*name;\n\tu_long\t\tbios_cyl;\n\tu_long\t\tbios_hd;\n\tu_long\t\tbios_sect;\n#ifdef PC98\n\tu_char\t\t*bootipl;\n\tsize_t\t\tbootipl_size;\n\tu_char\t\t*bootmenu;\n\tsize_t\t\tbootmenu_size;\n#else\n\tu_char\t\t*bootmgr;\n\tsize_t\t\tbootmgr_size;\n#endif\n\tu_char\t\t*boot1;\n#if defined(__i386__) || defined(__amd64__) /* the i386 needs extra help... */\n\tu_char\t\t*boot2;\n#endif\n\tstruct chunk\t*chunks;\n\tu_long\t\tsector_size; /* media sector size, a power of 2 */\n};\n#else\t/* !__ia64__ */\nstruct disk {\n\tchar\t\t*name;\n\tstruct chunk\t*chunks;\n\tu_long\t\tmedia_size;\n\tu_long\t\tsector_size;\n\tu_long\t\tlba_start;\n\tu_long\t\tlba_end;\n\tu_int\t\tgpt_size;\t/* Number of entries */\n};\n#endif\n\nstruct chunk {\n\tstruct chunk\t*next;\n\tstruct chunk\t*part;\n\tstruct disk\t*disk;\n\tdaddr_t\t\toffset;\n\tdaddr_t\t\tsize;\n\tdaddr_t\t\tend;\n\tchar\t\t*sname;\t\t/* PC98 field */\n\tchar\t\t*name;\n\tchar\t\t*oname;\n\t/* Used during Fixup_Names() to avoid renaming more than\n\t * absolutely needed.\n\t */\n\tchunk_e\t\ttype;\n\tint\t\tsubtype;\n\tu_long\t\tflags;\n\tvoid\t\t(*private_free)(void*);\n\tvoid\t\t*(*private_clone)(void*);\n\tvoid\t\t*private_data;\n\t/* For data private to the application, and the management\n\t * thereof.  If the functions are not provided, no storage\n\t * management is done, Cloning will just copy the pointer\n\t * and freeing will just forget it.\n\t */\n};\n\n/*\n * flags:\n *\n * ALIGN\t-\tThis chunk should be aligned\n * IS_ROOT\t-\tThis 'part' is a rootfs, allocate 'a'\n * ACTIVE\t-\tThis is the active slice in the MBR\n * FORCE_ALL\t-\tForce a dedicated disk for FreeBSD, bypassing\n *\t\t\tall BIOS geometry considerations\n * AUTO_SIZE\t-\tThis chunk was auto-sized and can fill-out a\n *\t\t\tfollowing chunk if the following chunk is deleted.\n * NEWFS\t-\tnewfs pending, used to enable auto-resizing on\n *\t\t\tdelete (along with AUTO_SIZE).\n */\n\n#define CHUNK_ALIGN\t\t0x0008\n#define CHUNK_IS_ROOT\t\t0x0010\n#define CHUNK_ACTIVE\t\t0x0020\n#define CHUNK_FORCE_ALL\t\t0x0040\t\n#define CHUNK_AUTO_SIZE\t\t0x0080\n#define CHUNK_NEWFS\t\t0x0100\n#define\tCHUNK_HAS_INDEX\t\t0x0200\n#define\tCHUNK_ITOF(i)\t\t((i & 0xFFFF) << 16)\n#define\tCHUNK_FTOI(f)\t\t((f >> 16) & 0xFFFF)\n\n#define DELCHUNK_NORMAL\t\t0x0000\n#define DELCHUNK_RECOVER\t0x0001\n\nconst char *chunk_name(chunk_e);\n\nconst char *\nslice_type_name(int, int);\n/* \"chunk_n\" for subtypes too */\n\nstruct disk *\nOpen_Disk(const char *);\n/* Will open the named disk, and return populated tree.  */\n\nvoid\nFree_Disk(struct disk *);\n/* Free a tree made with Open_Disk() or Clone_Disk() */\n\nvoid\nDebug_Disk(struct disk *);\n/* Print the content of the tree to stdout */\n\nvoid\nSet_Bios_Geom(struct disk *, u_long, u_long, u_long);\n/* Set the geometry the bios uses. */\n\nvoid\nSanitize_Bios_Geom(struct disk *);\n/* Set the bios geometry to something sane */\n\nint\nInsert_Chunk(struct chunk *, daddr_t, daddr_t, const char *, chunk_e, int,\n\tu_long, const char *);\n\nint\nDelete_Chunk2(struct disk *, struct chunk *, int);\n/* Free a chunk of disk_space modified by the passed flags. */\n\nint\nDelete_Chunk(struct disk *, struct chunk *);\n/* Free a chunk of disk_space */\n\nvoid\nCollapse_Disk(struct disk *);\n/* Experimental, do not use. */\n\nint\nCollapse_Chunk(struct disk *, struct chunk *);\n/* Experimental, do not use. */\n\nint\nCreate_Chunk(struct disk *, daddr_t, daddr_t, chunk_e, int, u_long, const char *);\n/* Create a chunk with the specified paramters */\n\nvoid\nAll_FreeBSD(struct disk *, int);\n/*\n * Make one FreeBSD chunk covering the entire disk;\n * if force_all is set, bypass all BIOS geometry\n * considerations.\n */\n\nchar *\nCheckRules(const struct disk *);\n/* Return char* to warnings about broken design rules in this disklayout */\n\nchar **\nDisk_Names(void);\n/*\n * Return char** with all disk's names (wd0, wd1 ...).  You must free\n * each pointer, as well as the array by hand\n */\n\n#ifdef PC98\nvoid\nSet_Boot_Mgr(struct disk *, const u_char *, const size_t, const u_char *,\n\tconst size_t);\n#else\nvoid\nSet_Boot_Mgr(struct disk *, const u_char *, const size_t);\n#endif\n/*\n * Use this boot-manager on this disk.  Gets written when Write_Disk()\n * is called\n */\n\nint\nSet_Boot_Blocks(struct disk *, const u_char *, const u_char *);\n/*\n * Use these boot-blocks on this disk.  Gets written when Write_Disk()\n * is called. Returns nonzero upon failure.\n */\n\nint\nWrite_Disk(const struct disk *);\n/* Write all the MBRs, disklabels, bootblocks and boot managers */\n\ndaddr_t\nNext_Cyl_Aligned(const struct disk *, daddr_t);\n/* Round offset up to next cylinder according to the bios-geometry */\n\ndaddr_t\nPrev_Cyl_Aligned(const struct disk *, daddr_t);\n/* Round offset down to previous cylinder according to the bios-geometry */\n\nint\nTrack_Aligned(const struct disk *, daddr_t);\n/* Check if offset is aligned on a track according to the bios geometry */\n\ndaddr_t\nNext_Track_Aligned(const struct disk *, daddr_t);\n/* Round offset up to next track according to the bios-geometry */\n\ndaddr_t\nPrev_Track_Aligned(const struct disk *, daddr_t);\n/* Check if offset is aligned on a track according to the bios geometry */\n\nstruct chunk *\nCreate_Chunk_DWIM(struct disk *, struct chunk *, daddr_t, chunk_e, int,\n\tu_long);\n/*\n * This one creates a partition inside the given parent of the given\n * size, and returns a pointer to it.  The first unused chunk big\n * enough is used.\n */\n\nchar *\nShowChunkFlags(struct chunk *);\n/* Return string to show flags. */\n\n/*\n * Implementation details  >>> DO NOT USE <<<\n */\n\nstruct disklabel;\n\nvoid Fill_Disklabel(struct disklabel *, const struct disk *,\n\tconst struct chunk *);\nvoid Debug_Chunk(struct chunk *);\nstruct chunk *New_Chunk(void);\nvoid Free_Chunk(struct chunk *);\nstruct chunk *Clone_Chunk(const struct chunk *);\nint Add_Chunk(struct disk *, daddr_t, daddr_t, const char *, chunk_e, int,\n\tu_long, const char *);\nvoid *read_block(int, daddr_t, u_long);\nint write_block(int, daddr_t, const void *, u_long);\nstruct disklabel *read_disklabel(int, daddr_t, u_long);\nstruct disk *Int_Open_Disk(const char *, char *);\nint Fixup_Names(struct disk *);\nint MakeDevChunk(const struct chunk *, const char *);\n__END_DECLS\n\n#define dprintf\tprintf\n\n/* TODO\n *\n * Need an error string mechanism from the functions instead of warn()\n *\n * Make sure only FreeBSD start at offset==0\n *\n * Collapse must align.\n *\n * Make Write_Disk(struct disk*)\n *\n * Consider booting from OnTrack'ed disks.\n *\n * Get Bios-geom, ST506 & OnTrack from driver (or otherwise)\n *\n * Make Create_DWIM().\n *\n * Make Is_Unchanged(struct disk *d1, struct chunk *c1)\n *\n * don't rename slices unless we have to\n *\n *Sample output from tst01:\n *\n * Debug_Disk(wd0)  flags=0  bios_geom=0/0/0\n * >>        0x3d040          0    1411200    1411199 wd0      0 whole    0 0\n * >>>>      0x3d080          0     960120     960119 wd0s1    3 freebsd  0 8\n * >>>>>>    0x3d100          0      40960      40959 wd0s1a   5 part     0 0\n * >>>>>>    0x3d180      40960     131072     172031 wd0s1b   5 part     0 0\n * >>>>>>    0x3d1c0     172032     409600     581631 wd0s1e   5 part     0 0\n * >>>>>>    0x3d200     581632     378488     960119 wd0s1f   5 part     0 0\n * >>>>      0x3d140     960120       5670     965789 wd0s2    4 extended 0 8\n * >>>>>>    0x3d2c0     960120         63     960182 -        6 unused   0 0\n * >>>>>>    0x3d0c0     960183       5607     965789 wd0s5    2 fat      0 8\n * >>>>      0x3d280     965790       1890     967679 wd0s3    1 foo      -2 8\n * >>>>      0x3d300     967680     443520    1411199 wd0s4    3 freebsd  0 8\n * >>>>>>    0x3d340     967680     443520    1411199 wd0s4a   5 part     0 0\n *\n * ^            ^           ^          ^          ^     ^      ^ ^        ^ ^\n * level    chunkptr      start      size        end  name    type  subtype flags\n *\n * Underlying data structure:\n *\n *\tLegend:\n *\t\t<struct chunk> --> part\n *\t\t\t|\n *\t\t\tv next\n *\n *\t<wd0> --> <wd0s1> --> <wd0s1a>\n *\t\t     |           |\n *\t\t     |           v\n *\t\t     |        <wd0s1b>\n *\t\t     |           |\n *\t\t     |           v\n *\t\t     |        <wd0s1e>\n *\t\t     |           |\n *\t\t     |           v\n *\t\t     |        <wd0s1f>\n *\t\t     |\n *\t\t     v\n *\t\t  <wd0s2> --> <unused>\n *\t\t     |           |\n *\t\t     |           v\n *\t\t     |        <wd0s5>\n *\t\t     |\n *\t\t     v\n *\t\t  <wd0s3>\n *\t\t     |\n *\t\t     v\n *\t\t  <wd0s4> --> <wd0s4a>\n *\n *\n */\n\n#endif /* _LIBDISK_H_ */\n"
  },
  {
    "path": "freebsd-headers/libdwarf.h",
    "content": "/*-\n * Copyright (c) 2007 John Birrell (jb@freebsd.org)\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/lib/libdwarf/libdwarf.h 221569 2011-05-07 01:05:31Z obrien $\n */\n\n#ifndef\t_LIBDWARF_H_\n#define\t_LIBDWARF_H_\n\n#include <libelf.h>\n\ntypedef int\t\tDwarf_Bool;\ntypedef off_t\t\tDwarf_Off;\ntypedef uint64_t\tDwarf_Unsigned;\ntypedef uint16_t\tDwarf_Half;\ntypedef uint8_t\t\tDwarf_Small;\ntypedef int64_t\t\tDwarf_Signed;\ntypedef uint64_t\tDwarf_Addr;\ntypedef void\t\t*Dwarf_Ptr;\n\n/* Forward definitions. */\ntypedef struct _Dwarf_Abbrev\t*Dwarf_Abbrev;\ntypedef struct _Dwarf_Arange\t*Dwarf_Arange;\ntypedef struct _Dwarf_Attribute\t*Dwarf_Attribute;\ntypedef struct _Dwarf_AttrValue\t*Dwarf_AttrValue;\ntypedef struct _Dwarf_CU\t*Dwarf_CU;\ntypedef struct _Dwarf_Cie\t*Dwarf_Cie;\ntypedef struct _Dwarf_Debug\t*Dwarf_Debug;\ntypedef struct _Dwarf_Die\t*Dwarf_Die;\ntypedef struct _Dwarf_Fde\t*Dwarf_Fde;\ntypedef struct _Dwarf_Func\t*Dwarf_Func;\ntypedef struct _Dwarf_Inlined_Func *Dwarf_Inlined_Func;\ntypedef struct _Dwarf_Global\t*Dwarf_Global;\ntypedef struct _Dwarf_Line\t*Dwarf_Line;\ntypedef struct _Dwarf_Type\t*Dwarf_Type;\ntypedef struct _Dwarf_Var\t*Dwarf_Var;\ntypedef struct _Dwarf_Weak\t*Dwarf_Weak;\n\ntypedef struct {\n        Dwarf_Small\tlr_atom;\n        Dwarf_Unsigned\tlr_number;\n\tDwarf_Unsigned\tlr_number2;\n\tDwarf_Unsigned\tlr_offset;\n} Dwarf_Loc;\n\ntypedef struct {\n\tDwarf_Addr      ld_lopc;\n\tDwarf_Addr      ld_hipc;\n\tDwarf_Half      ld_cents;\n\tDwarf_Loc\t*ld_s;\n} Dwarf_Locdesc;\n\n/* receiver function for dwarf_function_iterate_inlined_instance() API */\ntypedef void (*Dwarf_Inlined_Callback)(Dwarf_Inlined_Func, void *);\n\n/*\n * Error numbers which are specific to this implementation.\n */\nenum {\n\tDWARF_E_NONE,\t\t\t/* No error. */\n\tDWARF_E_ERROR,\t\t\t/* An error! */\n\tDWARF_E_NO_ENTRY,\t\t/* No entry. */\n\tDWARF_E_ARGUMENT,\t\t/* Invalid argument. */\n\tDWARF_E_DEBUG_INFO,\t\t/* Debug info NULL. */\n\tDWARF_E_MEMORY,\t\t\t/* Insufficient memory. */\n\tDWARF_E_ELF,\t\t\t/* ELF error. */\n\tDWARF_E_INVALID_CU,\t\t/* Invalid compilation unit data. */\n\tDWARF_E_CU_VERSION,\t\t/* Wrong CU version. */\n\tDWARF_E_MISSING_ABBREV,\t\t/* Abbrev not found. */\n\tDWARF_E_NOT_IMPLEMENTED,\t/* Not implemented. */\n\tDWARF_E_CU_CURRENT,\t\t/* No current compilation unit. */\n\tDWARF_E_BAD_FORM,\t\t/* Wrong form type for attribute value. */\n\tDWARF_E_INVALID_EXPR,\t\t/* Invalid DWARF expression. */\n\tDWARF_E_NUM\t\t\t/* Max error number. */\n};\n\ntypedef struct _Dwarf_Error {\n\tint\t\terr_error;\t/* DWARF error. */\n\tint\t\telf_error;\t/* ELF error. */\n\tconst char\t*err_func;\t/* Function name where error occurred. */\n\tint\t\terr_line;\t/* Line number where error occurred. */\n\tchar\t\terr_msg[1024];\t/* Formatted error message. */\n} Dwarf_Error;\n\n/*\n * Return values which have to be compatible with other\n * implementations of libdwarf.\n */\n#define DW_DLV_NO_ENTRY\t\tDWARF_E_NO_ENTRY\n#define DW_DLV_OK\t\tDWARF_E_NONE\n#define DW_DLE_DEBUG_INFO_NULL\tDWARF_E_DEBUG_INFO\n\n#define DW_DLC_READ        \t0\t/* read only access */\n\n/* Function prototype definitions. */\n__BEGIN_DECLS\nDwarf_Abbrev\tdwarf_abbrev_find(Dwarf_CU, uint64_t);\nDwarf_AttrValue dwarf_attrval_find(Dwarf_Die, Dwarf_Half);\nDwarf_Die\tdwarf_die_find(Dwarf_Die, Dwarf_Unsigned);\nconst char\t*dwarf_errmsg(Dwarf_Error *);\nconst char\t*get_sht_desc(uint32_t);\nconst char\t*get_attr_desc(uint32_t);\nconst char\t*get_form_desc(uint32_t);\nconst char\t*get_tag_desc(uint32_t);\nint\t\tdwarf_abbrev_add(Dwarf_CU, uint64_t, uint64_t, uint8_t, Dwarf_Abbrev *, Dwarf_Error *);\nint\t\tdwarf_attr(Dwarf_Die, Dwarf_Half, Dwarf_Attribute *, Dwarf_Error *);\nint\t\tdwarf_attr_add(Dwarf_Abbrev, uint64_t, uint64_t, Dwarf_Attribute *, Dwarf_Error *);\nint\t\tdwarf_attrval(Dwarf_Die, Dwarf_Half, Dwarf_AttrValue *, Dwarf_Error *);\nint\t\tdwarf_attrval_add(Dwarf_Die, Dwarf_AttrValue, Dwarf_AttrValue *, Dwarf_Error *);\nint\t\tdwarf_attrval_flag(Dwarf_Die, uint64_t, Dwarf_Bool *, Dwarf_Error *);\nint\t\tdwarf_attrval_signed(Dwarf_Die, uint64_t, Dwarf_Signed *, Dwarf_Error *);\nint\t\tdwarf_attrval_string(Dwarf_Die, uint64_t, const char **, Dwarf_Error *);\nint\t\tdwarf_attrval_unsigned(Dwarf_Die, uint64_t, Dwarf_Unsigned *, Dwarf_Error *);\nint\t\tdwarf_child(Dwarf_Die, Dwarf_Die *, Dwarf_Error *);\nint\t\tdwarf_die_add(Dwarf_CU, int, uint64_t, uint64_t, Dwarf_Abbrev, Dwarf_Die *, Dwarf_Error *);\nint\t\tdwarf_dieoffset(Dwarf_Die, Dwarf_Off *, Dwarf_Error *);\nint\t\tdwarf_elf_init(Elf *, int, Dwarf_Debug *, Dwarf_Error *);\nint\t\tdwarf_errno(Dwarf_Error *);\nint\t\tdwarf_finish(Dwarf_Debug *, Dwarf_Error *);\nint\t\tdwarf_locdesc(Dwarf_Die, uint64_t, Dwarf_Locdesc **, Dwarf_Signed *, Dwarf_Error *);\nint\t\tdwarf_locdesc_free(Dwarf_Locdesc *, Dwarf_Error *);\nint\t\tdwarf_init(int, int, Dwarf_Debug *, Dwarf_Error *);\nint\t\tdwarf_next_cu_header(Dwarf_Debug, Dwarf_Unsigned *, Dwarf_Half *,\n\t\t    Dwarf_Unsigned *, Dwarf_Half *, Dwarf_Unsigned *, Dwarf_Error *);\nint\t\tdwarf_op_num(uint8_t, uint8_t *, int);\nint\t\tdwarf_siblingof(Dwarf_Debug, Dwarf_Die, Dwarf_Die *, Dwarf_Error *);\nint\t\tdwarf_tag(Dwarf_Die, Dwarf_Half *, Dwarf_Error *);\nint\t\tdwarf_whatform(Dwarf_Attribute, Dwarf_Half *, Dwarf_Error *);\nvoid\t\tdwarf_dealloc(Dwarf_Debug, Dwarf_Ptr, Dwarf_Unsigned);\nvoid\t\tdwarf_dump(Dwarf_Debug);\nvoid\t\tdwarf_dump_abbrev(Dwarf_Debug);\nvoid\t\tdwarf_dump_av(Dwarf_Die, Dwarf_AttrValue);\nvoid\t\tdwarf_dump_dbgstr(Dwarf_Debug);\nvoid\t\tdwarf_dump_die(Dwarf_Die);\nvoid\t\tdwarf_dump_die_at_offset(Dwarf_Debug, Dwarf_Off);\nvoid\t\tdwarf_dump_info(Dwarf_Debug);\nvoid\t\tdwarf_dump_shstrtab(Dwarf_Debug);\nvoid\t\tdwarf_dump_strtab(Dwarf_Debug);\nvoid\t\tdwarf_dump_symtab(Dwarf_Debug);\nvoid\t\tdwarf_dump_raw(Dwarf_Debug);\nvoid\t\tdwarf_dump_tree(Dwarf_Debug);\nDwarf_Func\tdwarf_find_function_by_offset(Dwarf_Debug dbg, Dwarf_Off off);\nDwarf_Func\tdwarf_find_function_by_name(Dwarf_Debug dbg, const char *name);\nint\t\tdwarf_function_get_addr_range(Dwarf_Func f,\n\t\t    Dwarf_Addr *low_pc, Dwarf_Addr *high_pc);\nint\t\tdwarf_function_is_inlined(Dwarf_Func f);\nvoid\t\tdwarf_function_iterate_inlined_instance(Dwarf_Func func,\n\t\t    Dwarf_Inlined_Callback f, void *data);\nint\t\tdwarf_inlined_function_get_addr_range(Dwarf_Inlined_Func f,\n\t\t    Dwarf_Addr *low_pc, Dwarf_Addr *high_pc);\n\n__END_DECLS\n\n#endif /* !_LIBDWARF_H_ */\n"
  },
  {
    "path": "freebsd-headers/libelf.h",
    "content": "/*-\n * Copyright (c) 2006 Joseph Koshy\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/lib/libelf/libelf.h 210345 2010-07-21 12:14:50Z kaiw $\n */\n\n#ifndef\t_LIBELF_H_\n#define\t_LIBELF_H_\n\n#include <sys/types.h>\n#include <sys/elf32.h>\n#include <sys/elf64.h>\n#include <sys/queue.h>\n\n/* Library private data structures */\ntypedef struct _Elf Elf;\ntypedef struct _Elf_Scn Elf_Scn;\n\n/* File types */\ntypedef enum {\n\tELF_K_NONE = 0,\n\tELF_K_AR,\t/* `ar' archives */\n\tELF_K_COFF,\t/* COFF files (unsupported) */\n\tELF_K_ELF,\t/* ELF files */\n\tELF_K_NUM\n} Elf_Kind;\n\n#define\tELF_K_FIRST\tELF_K_NONE\n#define\tELF_K_LAST\tELF_K_NUM\n\n/* Data types */\ntypedef enum {\n\tELF_T_ADDR,\n\tELF_T_BYTE,\n\tELF_T_CAP,\n\tELF_T_DYN,\n\tELF_T_EHDR,\n\tELF_T_HALF,\n\tELF_T_LWORD,\n\tELF_T_MOVE,\n\tELF_T_MOVEP,\n\tELF_T_NOTE,\n\tELF_T_OFF,\n\tELF_T_PHDR,\n\tELF_T_REL,\n\tELF_T_RELA,\n\tELF_T_SHDR,\n\tELF_T_SWORD,\n\tELF_T_SXWORD,\n\tELF_T_SYMINFO,\n\tELF_T_SYM,\n\tELF_T_VDEF,\n\tELF_T_VNEED,\n\tELF_T_WORD,\n\tELF_T_XWORD,\n\tELF_T_GNUHASH,\t/* GNU style hash tables. */\n\tELF_T_NUM\n} Elf_Type;\n\n#define\tELF_T_FIRST\tELF_T_ADDR\n#define\tELF_T_LAST\tELF_T_GNUHASH\n\n/* Commands */\ntypedef enum {\n\tELF_C_NULL = 0,\n\tELF_C_CLR,\n\tELF_C_FDDONE,\n\tELF_C_FDREAD,\n\tELF_C_RDWR,\n\tELF_C_READ,\n\tELF_C_SET,\n\tELF_C_WRITE,\n\tELF_C_NUM\n} Elf_Cmd;\n\n#define\tELF_C_FIRST\tELF_C_NULL\n#define\tELF_C_LAST\tELF_C_NUM\n\n/*\n * An `Elf_Data' structure describes data in an\n * ELF section.\n */\ntypedef struct _Elf_Data {\n\t/*\n\t * `Public' members that are part of the ELF(3) API.\n\t */\n\tuint64_t\td_align;\n\tvoid\t\t*d_buf;\n\tuint64_t\td_off;\n\tuint64_t\td_size;\n\tElf_Type\td_type;\n\tunsigned int\td_version;\n\n\t/*\n\t * Members that are not part of the public API.\n\t */\n\tElf_Scn\t\t*d_scn;\t\t/* containing section */\n\tunsigned int\td_flags;\n\tSTAILQ_ENTRY(_Elf_Data)\td_next;\n} Elf_Data;\n\n/*\n * An `Elf_Arhdr' structure describes an archive\n * header.\n */\ntypedef struct {\n\ttime_t\t\tar_date;\n\tchar\t\t*ar_name;\t/* archive member name */\n\tgid_t\t\tar_gid;\n\tmode_t\t\tar_mode;\n\tchar\t\t*ar_rawname;\t/* 'raw' member name */\n\tsize_t\t\tar_size;\n\tuid_t\t\tar_uid;\n} Elf_Arhdr;\n\n/*\n * An `Elf_Arsym' describes an entry in the archive\n * symbol table.\n */\ntypedef struct {\n\toff_t\t\tas_off;\t\t/* byte offset to member's header */\n\tunsigned long\tas_hash;\t/* elf_hash() value for name */\n\tchar\t\t*as_name; \t/* null terminated symbol name */\n} Elf_Arsym;\n\n/*\n * Error numbers.\n */\n\nenum Elf_Error {\n\tELF_E_NONE,\t/* No error */\n\tELF_E_ARCHIVE,\t/* Malformed ar(1) archive */\n\tELF_E_ARGUMENT,\t/* Invalid argument */\n\tELF_E_CLASS,\t/* Mismatched ELF class */\n\tELF_E_DATA,\t/* Invalid data descriptor */\n\tELF_E_HEADER,\t/* Missing or malformed ELF header */\n\tELF_E_IO,\t/* I/O error */\n\tELF_E_LAYOUT,\t/* Layout constraint violation */\n\tELF_E_MODE,\t/* Wrong mode for ELF descriptor */\n\tELF_E_RANGE,\t/* Value out of range */\n\tELF_E_RESOURCE,\t/* Resource exhaustion */\n\tELF_E_SECTION,\t/* Invalid section descriptor */\n\tELF_E_SEQUENCE,\t/* API calls out of sequence */\n\tELF_E_UNIMPL,\t/* Feature is unimplemented */\n\tELF_E_VERSION,\t/* Unknown API version */\n\tELF_E_NUM\t/* Max error number */\n};\n\n/*\n * Flags defined by the API.\n */\n\n#define\tELF_F_LAYOUT\t0x001U\t/* application will layout the file */\n#define\tELF_F_DIRTY\t0x002U\t/* a section or ELF file is dirty */\n\n__BEGIN_DECLS\nElf\t\t*elf_begin(int _fd, Elf_Cmd _cmd, Elf *_elf);\nint\t\telf_cntl(Elf *_elf, Elf_Cmd _cmd);\nint\t\telf_end(Elf *_elf);\nconst char\t*elf_errmsg(int _error);\nint\t\telf_errno(void);\nvoid\t\telf_fill(int _fill);\nunsigned int\telf_flagdata(Elf_Data *_data, Elf_Cmd _cmd, unsigned int _flags);\nunsigned int\telf_flagehdr(Elf *_elf, Elf_Cmd _cmd, unsigned int _flags);\nunsigned int\telf_flagelf(Elf *_elf, Elf_Cmd _cmd, unsigned int _flags);\nunsigned int\telf_flagphdr(Elf *_elf, Elf_Cmd _cmd, unsigned int _flags);\nunsigned int\telf_flagscn(Elf_Scn *_scn, Elf_Cmd _cmd, unsigned int _flags);\nunsigned int\telf_flagshdr(Elf_Scn *_scn, Elf_Cmd _cmd, unsigned int _flags);\nElf_Arhdr\t*elf_getarhdr(Elf *_elf);\nElf_Arsym\t*elf_getarsym(Elf *_elf, size_t *_ptr);\noff_t\t\telf_getbase(Elf *_elf);\nElf_Data\t*elf_getdata(Elf_Scn *, Elf_Data *);\nchar\t\t*elf_getident(Elf *_elf, size_t *_ptr);\nint\t\telf_getphdrnum(Elf *_elf, size_t *_dst);\nint\t\telf_getphnum(Elf *_elf, size_t *_dst);\t/* Deprecated */\nElf_Scn\t\t*elf_getscn(Elf *_elf, size_t _index);\nint\t\telf_getshdrnum(Elf *_elf, size_t *_dst);\nint\t\telf_getshnum(Elf *_elf, size_t *_dst);\t/* Deprecated */\nint\t\telf_getshdrstrndx(Elf *_elf, size_t *_dst);\nint\t\telf_getshstrndx(Elf *_elf, size_t *_dst); /* Deprecated */\nunsigned long\telf_hash(const char *_name);\nElf_Kind\telf_kind(Elf *_elf);\nElf\t\t*elf_memory(char *_image, size_t _size);\nsize_t\t\telf_ndxscn(Elf_Scn *_scn);\nElf_Data\t*elf_newdata(Elf_Scn *_scn);\nElf_Scn\t\t*elf_newscn(Elf *_elf);\nElf_Scn\t\t*elf_nextscn(Elf *_elf, Elf_Scn *_scn);\nElf_Cmd\t\telf_next(Elf *_elf);\noff_t\t\telf_rand(Elf *_elf, off_t _off);\nElf_Data\t*elf_rawdata(Elf_Scn *_scn, Elf_Data *_data);\nchar\t\t*elf_rawfile(Elf *_elf, size_t *_size);\nint\t\telf_setshstrndx(Elf *_elf, size_t _shnum);\nchar\t\t*elf_strptr(Elf *_elf, size_t _section, size_t _offset);\noff_t\t\telf_update(Elf *_elf, Elf_Cmd _cmd);\nunsigned int\telf_version(unsigned int _version);\n\nlong\t\telf32_checksum(Elf *_elf);\nsize_t\t\telf32_fsize(Elf_Type _type, size_t _count,\n\t\t\tunsigned int _version);\nElf32_Ehdr\t*elf32_getehdr(Elf *_elf);\nElf32_Phdr\t*elf32_getphdr(Elf *_elf);\nElf32_Shdr\t*elf32_getshdr(Elf_Scn *_scn);\nElf32_Ehdr\t*elf32_newehdr(Elf *_elf);\nElf32_Phdr\t*elf32_newphdr(Elf *_elf, size_t _count);\nElf_Data\t*elf32_xlatetof(Elf_Data *_dst, const Elf_Data *_src,\n\t\t\tunsigned int _enc);\nElf_Data\t*elf32_xlatetom(Elf_Data *_dst, const Elf_Data *_src,\n\t\t\tunsigned int _enc);\n\nlong\t\telf64_checksum(Elf *_elf);\nsize_t\t\telf64_fsize(Elf_Type _type, size_t _count,\n\t\t\tunsigned int _version);\nElf64_Ehdr\t*elf64_getehdr(Elf *_elf);\nElf64_Phdr\t*elf64_getphdr(Elf *_elf);\nElf64_Shdr\t*elf64_getshdr(Elf_Scn *_scn);\nElf64_Ehdr\t*elf64_newehdr(Elf *_elf);\nElf64_Phdr\t*elf64_newphdr(Elf *_elf, size_t _count);\nElf_Data\t*elf64_xlatetof(Elf_Data *_dst, const Elf_Data *_src,\n\t\t\tunsigned int _enc);\nElf_Data\t*elf64_xlatetom(Elf_Data *_dst, const Elf_Data *_src,\n\t\t\tunsigned int _enc);\n\n#if\tdefined(LIBELF_TEST_HOOKS)\nint\t\t_libelf_get_elf_class(Elf *_elf);\nint\t\t_libelf_get_max_error(void);\nconst char\t*_libelf_get_no_error_message(void);\nconst char\t*_libelf_get_unknown_error_message(void);\nvoid\t\t_libelf_set_elf_class(Elf *_elf, int _class);\nvoid\t\t_libelf_set_error(int _error);\n#endif\t/* LIBELF_TEST_HOOKS */\n__END_DECLS\n\n#endif\t/* _LIBELF_H_ */\n"
  },
  {
    "path": "freebsd-headers/libgen.h",
    "content": "/*\t$OpenBSD: libgen.h,v 1.4 1999/05/28 22:00:22 espie Exp $\t*/\n/*\t$FreeBSD: release/9.0.0/include/libgen.h 197804 2009-10-06 14:05:57Z rwatson $\t*/\n\n/*\n * Copyright (c) 1997 Todd C. Miller <Todd.Miller@courtesan.com>\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. The name of the author may not be used to endorse or promote products\n *    derived from this software without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,\n * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY\n * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL\n * THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,\n * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,\n * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;\n * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR\n * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF\n * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n */\n\n#ifndef _LIBGEN_H_\n#define _LIBGEN_H_\n\n#include <sys/cdefs.h>\n\n__BEGIN_DECLS\n\nchar\t*basename(const char *);\nchar\t*basename_r(const char *, char *);\nchar\t*dirname(const char *);\n#if 0\nchar\t*regcmp(const char *, ...);\nchar\t*regex(const char *, const char *, ...);\n\nextern char *__loc1;\n#endif\n\n__END_DECLS\n\n#endif /* _LIBGEN_H_ */\n"
  },
  {
    "path": "freebsd-headers/libgeom.h",
    "content": "/*-\n * Copyright (c) 2003 Poul-Henning Kamp\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. The names of the authors may not be used to endorse or promote\n *    products derived from this software without specific prior written\n *    permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/lib/libgeom/libgeom.h 202454 2010-01-17 06:20:30Z delphij $\n */\n#ifndef _LIBGEOM_H_\n#define _LIBGEOM_H_\n\n#include <sys/cdefs.h>\n\n#include <sys/queue.h>\n#include <sys/time.h>\n\n#include <geom/geom_ctl.h>\n\n__BEGIN_DECLS\n\nvoid geom_stats_close(void);\nvoid geom_stats_resync(void);\nint geom_stats_open(void);\nvoid *geom_stats_snapshot_get(void);\nvoid geom_stats_snapshot_free(void *);\nvoid geom_stats_snapshot_timestamp(void *, struct timespec *);\nvoid geom_stats_snapshot_reset(void *);\nstruct devstat *geom_stats_snapshot_next(void *);\n\nchar *geom_getxml(void);\n\n/* geom_xml2tree.c */\n\n/*\n * These structs are used to build the tree based on the XML.\n * they're named as the kernel variant without the first '_'.\n */\n\nstruct gclass;\nstruct ggeom;\nstruct gconsumer;\nstruct gprovider;\n\nLIST_HEAD(gconf, gconfig);\n\nstruct gident {\n\tvoid\t\t\t*lg_id;\n\tvoid\t\t\t*lg_ptr;\n\tenum {\tISCLASS,\n\t\tISGEOM,\n\t\tISPROVIDER,\n\t\tISCONSUMER }\tlg_what;\n};\n\nstruct gmesh {\n\tLIST_HEAD(, gclass)\tlg_class;\n\tstruct gident\t\t*lg_ident;\n};\n\nstruct gconfig {\n\tLIST_ENTRY(gconfig)\tlg_config;\n\tchar\t\t\t*lg_name;\n\tchar\t\t\t*lg_val;\n};\n\nstruct gclass {\n\tvoid\t\t\t*lg_id;\n\tchar\t\t\t*lg_name;\n\tLIST_ENTRY(gclass)\tlg_class;\n\tLIST_HEAD(, ggeom)\tlg_geom;\n\tstruct gconf\t\tlg_config;\n};\n\nstruct ggeom {\n\tvoid\t\t\t*lg_id;\n\tstruct gclass\t\t*lg_class;\n\tchar\t\t\t*lg_name;\n\tu_int\t\t\tlg_rank;\n\tLIST_ENTRY(ggeom)\tlg_geom;\n\tLIST_HEAD(, gconsumer)\tlg_consumer;\n\tLIST_HEAD(, gprovider)\tlg_provider;\n\tstruct gconf\t\tlg_config;\n};\n\nstruct gconsumer {\n\tvoid\t\t\t*lg_id;\n\tstruct ggeom\t\t*lg_geom;\n\tLIST_ENTRY(gconsumer)\tlg_consumer;\n\tstruct gprovider\t*lg_provider;\n\tLIST_ENTRY(gconsumer)\tlg_consumers;\n\tchar\t\t\t*lg_mode;\n\tstruct gconf\t\tlg_config;\n};\n\nstruct gprovider {\n\tvoid\t\t\t*lg_id;\n\tchar\t\t\t*lg_name;\n\tstruct ggeom\t\t*lg_geom;\n\tLIST_ENTRY(gprovider)\tlg_provider;\n\tLIST_HEAD(, gconsumer)\tlg_consumers;\n\tchar\t\t\t*lg_mode;\n\toff_t\t\t\tlg_mediasize;\n\tu_int\t\t\tlg_sectorsize;\n\toff_t\t\t\tlg_stripeoffset;\n\toff_t\t\t\tlg_stripesize;\n\tstruct gconf\t\tlg_config;\n};\n\nstruct gident * geom_lookupid(struct gmesh *, const void *);\nint geom_xml2tree(struct gmesh *, char *);\nint geom_gettree(struct gmesh *);\nvoid geom_deletetree(struct gmesh *);\n\n/* geom_ctl.c */\n\nstruct gctl_req;\n\n#ifdef _STDIO_H_\t\t\t/* limit #include pollution */\nvoid gctl_dump(struct gctl_req *, FILE *);\n#endif\nvoid gctl_free(struct gctl_req *);\nstruct gctl_req *gctl_get_handle(void);\nconst char *gctl_issue(struct gctl_req *);\nvoid gctl_ro_param(struct gctl_req *, const char *, int, const void *);\nvoid gctl_rw_param(struct gctl_req *, const char *, int, void *);\n\n/* geom_util.c */\nint g_open(const char *, int);\nint g_close(int);\noff_t g_mediasize(int);\nssize_t g_sectorsize(int);\noff_t g_stripeoffset(int);\noff_t g_stripesize(int);\nint g_flush(int);\nint g_delete(int, off_t, off_t);\nint g_get_ident(int, char *, size_t);\nint g_get_name(const char *, char *, size_t);\nint g_open_by_ident(const char *, int, char *, size_t);\nchar *g_device_path(const char *);\nchar *g_providername(int);\n\n__END_DECLS\n\n#endif /* _LIBGEOM_H_ */\n"
  },
  {
    "path": "freebsd-headers/libmilter/mfapi.h",
    "content": "/*\n * Copyright (c) 1999-2004, 2006, 2008 Sendmail, Inc. and its suppliers.\n *\tAll rights reserved.\n *\n * By using this file, you agree to the terms and conditions set\n * forth in the LICENSE file which can be found at the top level of\n * the sendmail distribution.\n *\n *\n *\t$Id: mfapi.h,v 8.80 2009/11/06 00:57:08 ca Exp $\n */\n\n/*\n**  MFAPI.H -- Global definitions for mail filter library and mail filters.\n*/\n\n#ifndef _LIBMILTER_MFAPI_H\n# define _LIBMILTER_MFAPI_H\t1\n\n#ifndef SMFI_VERSION\n# if _FFR_MDS_NEGOTIATE\n#  define SMFI_VERSION\t0x01000002\t/* libmilter version number */\n\n   /* first libmilter version that has MDS support */\n#  define SMFI_VERSION_MDS\t0x01000002\n# else /* _FFR_MDS_NEGOTIATE */\n#  define SMFI_VERSION\t0x01000001\t/* libmilter version number */\n# endif /* _FFR_MDS_NEGOTIATE */\n#endif /* ! SMFI_VERSION */\n\n#define SM_LM_VRS_MAJOR(v)\t(((v) & 0x7f000000) >> 24)\n#define SM_LM_VRS_MINOR(v)\t(((v) & 0x007fff00) >> 8)\n#define SM_LM_VRS_PLVL(v)\t((v) & 0x0000007f)\n\n# include <sys/types.h>\n# include <sys/socket.h>\n\n#include \"libmilter/mfdef.h\"\n\n# define LIBMILTER_API\t\textern\n\n\n/* Only need to export C interface if used by C++ source code */\n#ifdef __cplusplus\nextern \"C\" {\n#endif /* __cplusplus */\n\n#ifndef _SOCK_ADDR\n# define _SOCK_ADDR\tstruct sockaddr\n#endif /* ! _SOCK_ADDR */\n\n/*\n**  libmilter functions return one of the following to indicate\n**  success/failure(/continue):\n*/\n\n#define MI_SUCCESS\t0\n#define MI_FAILURE\t(-1)\n#if _FFR_WORKERS_POOL\n# define MI_CONTINUE\t1\n#endif /* _FFR_WORKERS_POOL */\n\n/* \"forward\" declarations */\ntypedef struct smfi_str SMFICTX;\ntypedef struct smfi_str *SMFICTX_PTR;\n\ntypedef struct smfiDesc smfiDesc_str;\ntypedef struct smfiDesc\t*smfiDesc_ptr;\n\n/*\n**  Type which callbacks should return to indicate message status.\n**  This may take on one of the SMFIS_* values listed below.\n*/\n\ntypedef int\tsfsistat;\n\n#if defined(__linux__) && defined(__GNUC__) && defined(__cplusplus) && __GNUC_MINOR__ >= 8\n# define SM__P(X)\t__PMT(X)\n#else /* __linux__ && __GNUC__ && __cplusplus && _GNUC_MINOR__ >= 8 */\n# define SM__P(X)\t__P(X)\n#endif /* __linux__ && __GNUC__ && __cplusplus && _GNUC_MINOR__ >= 8 */\n\n/* Some platforms don't define __P -- do it for them here: */\n#ifndef __P\n# ifdef __STDC__\n#  define __P(X) X\n# else /* __STDC__ */\n#  define __P(X) ()\n# endif /* __STDC__ */\n#endif /* __P */\n\n#if SM_CONF_STDBOOL_H\n# include <stdbool.h>\n#else /* SM_CONF_STDBOOL_H */\n# ifndef __cplusplus\n#  ifndef bool\n#   ifndef __bool_true_false_are_defined\ntypedef int\tbool;\n#    define __bool_true_false_are_defined\t1\n#   endif /* ! __bool_true_false_are_defined */\n#  endif /* bool */\n# endif /* ! __cplusplus */\n#endif /* SM_CONF_STDBOOL_H */\n\n/*\n**  structure describing one milter\n*/\n\nstruct smfiDesc\n{\n\tchar\t\t*xxfi_name;\t/* filter name */\n\tint\t\txxfi_version;\t/* version code -- do not change */\n\tunsigned long\txxfi_flags;\t/* flags */\n\n\t/* connection info filter */\n\tsfsistat\t(*xxfi_connect) SM__P((SMFICTX *, char *, _SOCK_ADDR *));\n\n\t/* SMTP HELO command filter */\n\tsfsistat\t(*xxfi_helo) SM__P((SMFICTX *, char *));\n\n\t/* envelope sender filter */\n\tsfsistat\t(*xxfi_envfrom) SM__P((SMFICTX *, char **));\n\n\t/* envelope recipient filter */\n\tsfsistat\t(*xxfi_envrcpt) SM__P((SMFICTX *, char **));\n\n\t/* header filter */\n\tsfsistat\t(*xxfi_header) SM__P((SMFICTX *, char *, char *));\n\n\t/* end of header */\n\tsfsistat\t(*xxfi_eoh) SM__P((SMFICTX *));\n\n\t/* body block */\n\tsfsistat\t(*xxfi_body) SM__P((SMFICTX *, unsigned char *, size_t));\n\n\t/* end of message */\n\tsfsistat\t(*xxfi_eom) SM__P((SMFICTX *));\n\n\t/* message aborted */\n\tsfsistat\t(*xxfi_abort) SM__P((SMFICTX *));\n\n\t/* connection cleanup */\n\tsfsistat\t(*xxfi_close) SM__P((SMFICTX *));\n\n\t/* any unrecognized or unimplemented command filter */\n\tsfsistat\t(*xxfi_unknown) SM__P((SMFICTX *, const char *));\n\n\t/* SMTP DATA command filter */\n\tsfsistat\t(*xxfi_data) SM__P((SMFICTX *));\n\n\t/* negotiation callback */\n\tsfsistat\t(*xxfi_negotiate) SM__P((SMFICTX *,\n\t\t\t\t\tunsigned long, unsigned long,\n\t\t\t\t\tunsigned long, unsigned long,\n\t\t\t\t\tunsigned long *, unsigned long *,\n\t\t\t\t\tunsigned long *, unsigned long *));\n\n#if 0\n\t/* signal handler callback, not yet implemented. */\n\tint\t\t(*xxfi_signal) SM__P((int));\n#endif\n\n};\n\nLIBMILTER_API int smfi_opensocket __P((bool));\nLIBMILTER_API int smfi_register __P((struct smfiDesc));\nLIBMILTER_API int smfi_main __P((void));\nLIBMILTER_API int smfi_setbacklog __P((int));\nLIBMILTER_API int smfi_setdbg __P((int));\nLIBMILTER_API int smfi_settimeout __P((int));\nLIBMILTER_API int smfi_setconn __P((char *));\nLIBMILTER_API int smfi_stop __P((void));\nLIBMILTER_API size_t smfi_setmaxdatasize __P((size_t));\nLIBMILTER_API int smfi_version __P((unsigned int *, unsigned int *, unsigned int *));\n\n/*\n**  What the filter might do -- values to be ORed together for\n**  smfiDesc.xxfi_flags.\n*/\n\n#define SMFIF_NONE\t0x00000000L\t/* no flags */\n#define SMFIF_ADDHDRS\t0x00000001L\t/* filter may add headers */\n#define SMFIF_CHGBODY\t0x00000002L\t/* filter may replace body */\n#define SMFIF_MODBODY\tSMFIF_CHGBODY\t/* backwards compatible */\n#define SMFIF_ADDRCPT\t0x00000004L\t/* filter may add recipients */\n#define SMFIF_DELRCPT\t0x00000008L\t/* filter may delete recipients */\n#define SMFIF_CHGHDRS\t0x00000010L\t/* filter may change/delete headers */\n#define SMFIF_QUARANTINE 0x00000020L\t/* filter may quarantine envelope */\n\n/* filter may change \"from\" (envelope sender) */\n#define SMFIF_CHGFROM\t0x00000040L\n#define SMFIF_ADDRCPT_PAR\t0x00000080L\t/* add recipients incl. args */\n\n/* filter can send set of symbols (macros) that it wants */\n#define SMFIF_SETSYMLIST\t0x00000100L\n\n\n/*\n**  Macro \"places\";\n**  Notes:\n**  - must be coordinated with libmilter/engine.c and sendmail/milter.c\n**  - the order MUST NOT be changed as it would break compatibility between\n**\tdifferent versions. It's ok to append new entries however\n**\t(hence the list is not sorted by the SMT protocol steps).\n*/\n\n#define SMFIM_FIRST\t0\t/* Do NOT use, internal marker only */\n#define SMFIM_CONNECT\t0\t/* connect */\n#define SMFIM_HELO\t1\t/* HELO/EHLO */\n#define SMFIM_ENVFROM\t2\t/* MAIL From */\n#define SMFIM_ENVRCPT\t3\t/* RCPT To */\n#define SMFIM_DATA\t4\t/* DATA */\n#define SMFIM_EOM\t5\t/* end of message (final dot) */\n#define SMFIM_EOH\t6\t/* end of header */\n#define SMFIM_LAST\t6\t/* Do NOT use, internal marker only */\n\n/*\n**  Continue processing message/connection.\n*/\n\n#define SMFIS_CONTINUE\t0\n\n/*\n**  Reject the message/connection.\n**  No further routines will be called for this message\n**  (or connection, if returned from a connection-oriented routine).\n*/\n\n#define SMFIS_REJECT\t1\n\n/*\n**  Accept the message,\n**  but silently discard the message.\n**  No further routines will be called for this message.\n**  This is only meaningful from message-oriented routines.\n*/\n\n#define SMFIS_DISCARD\t2\n\n/*\n**  Accept the message/connection.\n**  No further routines will be called for this message\n**  (or connection, if returned from a connection-oriented routine;\n**  in this case, it causes all messages on this connection\n**  to be accepted without filtering).\n*/\n\n#define SMFIS_ACCEPT\t3\n\n/*\n**  Return a temporary failure, i.e.,\n**  the corresponding SMTP command will return a 4xx status code.\n**  In some cases this may prevent further routines from\n**  being called on this message or connection,\n**  although in other cases (e.g., when processing an envelope\n**  recipient) processing of the message will continue.\n*/\n\n#define SMFIS_TEMPFAIL\t4\n\n/*\n**  Do not send a reply to the MTA\n*/\n\n#define SMFIS_NOREPLY\t7\n\n/*\n**  Skip over rest of same callbacks, e.g., body.\n*/\n\n#define SMFIS_SKIP\t8\n\n/* xxfi_negotiate: use all existing protocol options/actions */\n#define SMFIS_ALL_OPTS\t10\n\n#if 0\n/*\n**  Filter Routine Details\n*/\n\n/* connection info filter */\nextern sfsistat\txxfi_connect __P((SMFICTX *, char *, _SOCK_ADDR *));\n\n/*\n**  xxfi_connect(ctx, hostname, hostaddr) Invoked on each connection\n**\n**\tchar *hostname; Host domain name, as determined by a reverse lookup\n**\t\ton the host address.\n**\t_SOCK_ADDR *hostaddr; Host address, as determined by a getpeername\n**\t\tcall on the SMTP socket.\n*/\n\n/* SMTP HELO command filter */\nextern sfsistat\txxfi_helo __P((SMFICTX *, char *));\n\n/*\n**  xxfi_helo(ctx, helohost) Invoked on SMTP HELO/EHLO command\n**\n**\tchar *helohost; Value passed to HELO/EHLO command, which should be\n**\t\tthe domain name of the sending host (but is, in practice,\n**\t\tanything the sending host wants to send).\n*/\n\n/* envelope sender filter */\nextern sfsistat\txxfi_envfrom __P((SMFICTX *, char **));\n\n/*\n**  xxfi_envfrom(ctx, argv) Invoked on envelope from\n**\n**\tchar **argv; Null-terminated SMTP command arguments;\n**\t\targv[0] is guaranteed to be the sender address.\n**\t\tLater arguments are the ESMTP arguments.\n*/\n\n/* envelope recipient filter */\nextern sfsistat\txxfi_envrcpt __P((SMFICTX *, char **));\n\n/*\n**  xxfi_envrcpt(ctx, argv) Invoked on each envelope recipient\n**\n**\tchar **argv; Null-terminated SMTP command arguments;\n**\t\targv[0] is guaranteed to be the recipient address.\n**\t\tLater arguments are the ESMTP arguments.\n*/\n\n/* unknown command filter */\n\nextern sfsistat\t*xxfi_unknown __P((SMFICTX *, const char *));\n\n/*\n**  xxfi_unknown(ctx, arg) Invoked when SMTP command is not recognized or not\n**  implemented.\n**\tconst char *arg; Null-terminated SMTP command\n*/\n\n/* header filter */\nextern sfsistat\txxfi_header __P((SMFICTX *, char *, char *));\n\n/*\n**  xxfi_header(ctx, headerf, headerv) Invoked on each message header. The\n**  content of the header may have folded white space (that is, multiple\n**  lines with following white space) included.\n**\n**\tchar *headerf; Header field name\n**\tchar *headerv; Header field value\n*/\n\n/* end of header */\nextern sfsistat\txxfi_eoh __P((SMFICTX *));\n\n/*\n**  xxfi_eoh(ctx) Invoked at end of header\n*/\n\n/* body block */\nextern sfsistat\txxfi_body __P((SMFICTX *, unsigned char *, size_t));\n\n/*\n**  xxfi_body(ctx, bodyp, bodylen) Invoked for each body chunk. There may\n**  be multiple body chunks passed to the filter. End-of-lines are\n**  represented as received from SMTP (normally Carriage-Return/Line-Feed).\n**\n**\tunsigned char *bodyp; Pointer to body data\n**\tsize_t bodylen; Length of body data\n*/\n\n/* end of message */\nextern sfsistat\txxfi_eom __P((SMFICTX *));\n\n/*\n**  xxfi_eom(ctx) Invoked at end of message. This routine can perform\n**  special operations such as modifying the message header, body, or\n**  envelope.\n*/\n\n/* message aborted */\nextern sfsistat\txxfi_abort __P((SMFICTX *));\n\n/*\n**  xxfi_abort(ctx) Invoked if message is aborted outside of the control of\n**  the filter, for example, if the SMTP sender issues an RSET command. If\n**  xxfi_abort is called, xxfi_eom will not be called and vice versa.\n*/\n\n/* connection cleanup */\nextern sfsistat\txxfi_close __P((SMFICTX *));\n\n/*\n**  xxfi_close(ctx) Invoked at end of the connection. This is called on\n**  close even if the previous mail transaction was aborted.\n*/\n#endif /* 0 */\n\n/*\n**  Additional information is passed in to the vendor filter routines using\n**  symbols. Symbols correspond closely to sendmail macros. The symbols\n**  defined depend on the context. The value of a symbol is accessed using:\n*/\n\n/* Return the value of a symbol. */\nLIBMILTER_API char * smfi_getsymval __P((SMFICTX *, char *));\n\n/*\n**  Return the value of a symbol.\n**\n**\tSMFICTX *ctx; Opaque context structure\n**\tchar *symname; The name of the symbol to access.\n*/\n\n/*\n**  Vendor filter routines that want to pass additional information back to\n**  the MTA for use in SMTP replies may call smfi_setreply before returning.\n*/\n\nLIBMILTER_API int smfi_setreply __P((SMFICTX *, char *, char *, char *));\n\n/*\n**  Alternatively, smfi_setmlreply can be called if a multi-line SMTP reply\n**  is needed.\n*/\n\nLIBMILTER_API int smfi_setmlreply __P((SMFICTX *, const char *, const char *, ...));\n\n/*\n**  Set the specific reply code to be used in response to the active\n**  command. If not specified, a generic reply code is used.\n**\n**\tSMFICTX *ctx; Opaque context structure\n**\tchar *rcode; The three-digit (RFC 821) SMTP reply code to be\n**\t\treturned, e.g., ``551''.\n**\tchar *xcode; The extended (RFC 2034) reply code, e.g., ``5.7.6''.\n**\tchar *message; The text part of the SMTP reply.\n*/\n\n/*\n**  The xxfi_eom routine is called at the end of a message (essentially,\n**  after the final DATA dot). This routine can call some special routines\n**  to modify the envelope, header, or body of the message before the\n**  message is enqueued. These routines must not be called from any vendor\n**  routine other than xxfi_eom.\n*/\n\nLIBMILTER_API int smfi_addheader __P((SMFICTX *, char *, char *));\n\n/*\n**  Add a header to the message. It is not checked for standards\n**  compliance; the mail filter must ensure that no protocols are violated\n**  as a result of adding this header.\n**\n**\tSMFICTX *ctx; Opaque context structure\n**\tchar *headerf; Header field name\n**\tchar *headerv; Header field value\n*/\n\nLIBMILTER_API int smfi_chgheader __P((SMFICTX *, char *, int, char *));\n\n/*\n**  Change/delete a header in the message.  It is not checked for standards\n**  compliance; the mail filter must ensure that no protocols are violated\n**  as a result of adding this header.\n**\n**\tSMFICTX *ctx; Opaque context structure\n**\tchar *headerf; Header field name\n**\tint index; The Nth occurence of header field name\n**\tchar *headerv; New header field value (empty for delete header)\n*/\n\nLIBMILTER_API int smfi_insheader __P((SMFICTX *, int, char *, char *));\n\n/*\n**  Insert a header into the message.  It is not checked for standards\n**  compliance; the mail filter must ensure that no protocols are violated\n**  as a result of adding this header.\n**\n**\tSMFICTX *ctx; Opaque context structure\n**  \tint idx; index into the header list where the insertion should happen\n**\tchar *headerh; Header field name\n**\tchar *headerv; Header field value\n*/\n\nLIBMILTER_API int smfi_chgfrom __P((SMFICTX *, char *, char *));\n\n/*\n**  Modify envelope sender address\n**\n**\tSMFICTX *ctx; Opaque context structure\n**\tchar *mail; New envelope sender address\n**\tchar *args; ESMTP arguments\n*/\n\n\nLIBMILTER_API int smfi_addrcpt __P((SMFICTX *, char *));\n\n/*\n**  Add a recipient to the envelope\n**\n**\tSMFICTX *ctx; Opaque context structure\n**\tchar *rcpt; Recipient to be added\n*/\n\nLIBMILTER_API int smfi_addrcpt_par __P((SMFICTX *, char *, char *));\n\n/*\n**  Add a recipient to the envelope\n**\n**\tSMFICTX *ctx; Opaque context structure\n**\tchar *rcpt; Recipient to be added\n**\tchar *args; ESMTP arguments\n*/\n\n\nLIBMILTER_API int smfi_delrcpt __P((SMFICTX *, char *));\n\n/*\n**  Send a \"no-op\" up to the MTA to tell it we're still alive, so long\n**  milter-side operations don't time out.\n**\n**\tSMFICTX *ctx; Opaque context structure\n*/\n\nLIBMILTER_API int smfi_progress __P((SMFICTX *));\n\n/*\n**  Delete a recipient from the envelope\n**\n**\tSMFICTX *ctx; Opaque context structure\n**\tchar *rcpt; Envelope recipient to be deleted. This should be in\n**\t\texactly the form passed to xxfi_envrcpt or the address may\n**\t\tnot be deleted.\n*/\n\nLIBMILTER_API int smfi_replacebody __P((SMFICTX *, unsigned char *, int));\n\n/*\n**  Replace the body of the message. This routine may be called multiple\n**  times if the body is longer than convenient to send in one call. End of\n**  line should be represented as Carriage-Return/Line Feed.\n**\n**\tchar *bodyp; Pointer to block of body information to insert\n**\tint bodylen; Length of data pointed at by bodyp\n*/\n\n/*\n**  If the message is aborted (for example, if the SMTP sender sends the\n**  envelope but then does a QUIT or RSET before the data is sent),\n**  xxfi_abort is called. This can be used to reset state.\n*/\n\n/*\n**  Quarantine an envelope\n**\n**\tSMFICTX *ctx; Opaque context structure\n**\tchar *reason: explanation\n*/\n\nLIBMILTER_API int smfi_quarantine __P((SMFICTX *ctx, char *reason));\n\n/*\n**  Connection-private data (specific to an SMTP connection) can be\n**  allocated using the smfi_setpriv routine; routines can access private\n**  data using smfi_getpriv.\n*/\n\nLIBMILTER_API int smfi_setpriv __P((SMFICTX *, void *));\n\n/*\n**  Set the private data pointer\n**\n**\tSMFICTX *ctx; Opaque context structure\n**\tvoid *privatedata; Pointer to private data area\n*/\n\nLIBMILTER_API void *smfi_getpriv __P((SMFICTX *));\n\n/*\n**  Get the private data pointer\n**\n**\tSMFICTX *ctx; Opaque context structure\n**\tvoid *privatedata; Pointer to private data area\n*/\n\nLIBMILTER_API int smfi_setsymlist __P((SMFICTX *, int, char *));\n\n/*\n**  Set list of symbols (macros) to receive\n**\n**\tSMFICTX *ctx; Opaque context structure\n**\tint where; where in the SMTP dialogue should the macros be sent\n**\tchar *macros; list of macros (space separated)\n*/\n\n#if _FFR_THREAD_MONITOR\nLIBMILTER_API int smfi_set_max_exec_time __P((unsigned int));\n#endif /* _FFR_THREAD_MONITOR */\n\n#ifdef __cplusplus\n}\n#endif /* __cplusplus */\n\n#endif /* ! _LIBMILTER_MFAPI_H */\n"
  },
  {
    "path": "freebsd-headers/libmilter/mfdef.h",
    "content": "/*\n * Copyright (c) 1999-2007 Sendmail, Inc. and its suppliers.\n *\tAll rights reserved.\n *\n * By using this file, you agree to the terms and conditions set\n * forth in the LICENSE file which can be found at the top level of\n * the sendmail distribution.\n *\n *\n *\t$Id: mfdef.h,v 8.39 2009/11/06 00:57:08 ca Exp $\n */\n\n/*\n**  mfdef.h -- Global definitions for mail filter and MTA.\n*/\n\n#ifndef _LIBMILTER_MFDEF_H\n# define _LIBMILTER_MFDEF_H\t1\n\n#ifndef SMFI_PROT_VERSION\n# define SMFI_PROT_VERSION\t6\t/* MTA - libmilter protocol version */\n#endif /* SMFI_PROT_VERSION */\n\n/* Shared protocol constants */\n#define MILTER_LEN_BYTES\t4\t/* length of 32 bit integer in bytes */\n#define MILTER_OPTLEN\t(MILTER_LEN_BYTES * 3) /* length of options */\n#define MILTER_CHUNK_SIZE\t65535\t/* body chunk size */\n#define MILTER_MAX_DATA_SIZE\t65535\t/* default milter command data limit */\n\n#if _FFR_MDS_NEGOTIATE\n# define MILTER_MDS_64K\t((64 * 1024) - 1)\n# define MILTER_MDS_256K ((256 * 1024) - 1)\n# define MILTER_MDS_1M\t((1024 * 1024) - 1)\n#endif /* _FFR_MDS_NEGOTIATE */\n\n/* These apply to SMFIF_* flags */\n#define SMFI_V1_ACTS\t0x0000000FL\t/* The actions of V1 filter */\n#define SMFI_V2_ACTS\t0x0000003FL\t/* The actions of V2 filter */\n#define SMFI_CURR_ACTS\t0x000001FFL\t/* actions of current version */\n\n/* address families */\n#define SMFIA_UNKNOWN\t\t'U'\t/* unknown */\n#define SMFIA_UNIX\t\t'L'\t/* unix/local */\n#define SMFIA_INET\t\t'4'\t/* inet */\n#define SMFIA_INET6\t\t'6'\t/* inet6 */\n\n/* commands: don't use anything smaller than ' ' */\n#define SMFIC_ABORT\t\t'A'\t/* Abort */\n#define SMFIC_BODY\t\t'B'\t/* Body chunk */\n#define SMFIC_CONNECT\t\t'C'\t/* Connection information */\n#define SMFIC_MACRO\t\t'D'\t/* Define macro */\n#define SMFIC_BODYEOB\t\t'E'\t/* final body chunk (End) */\n#define SMFIC_HELO\t\t'H'\t/* HELO/EHLO */\n#define SMFIC_QUIT_NC\t\t'K'\t/* QUIT but new connection follows */\n#define SMFIC_HEADER\t\t'L'\t/* Header */\n#define SMFIC_MAIL\t\t'M'\t/* MAIL from */\n#define SMFIC_EOH\t\t'N'\t/* EOH */\n#define SMFIC_OPTNEG\t\t'O'\t/* Option negotiation */\n#define SMFIC_QUIT\t\t'Q'\t/* QUIT */\n#define SMFIC_RCPT\t\t'R'\t/* RCPT to */\n#define SMFIC_DATA\t\t'T'\t/* DATA */\n#define SMFIC_UNKNOWN\t\t'U'\t/* Any unknown command */\n\n/* actions (replies) */\n#define SMFIR_ADDRCPT\t\t'+'\t/* add recipient */\n#define SMFIR_DELRCPT\t\t'-'\t/* remove recipient */\n#define SMFIR_ADDRCPT_PAR\t'2'\t/* add recipient (incl. ESMTP args) */\n#define SMFIR_SHUTDOWN\t\t'4'\t/* 421: shutdown (internal to MTA) */\n#define SMFIR_ACCEPT\t\t'a'\t/* accept */\n#define SMFIR_REPLBODY\t\t'b'\t/* replace body (chunk) */\n#define SMFIR_CONTINUE\t\t'c'\t/* continue */\n#define SMFIR_DISCARD\t\t'd'\t/* discard */\n#define SMFIR_CHGFROM\t\t'e'\t/* change envelope sender (from) */\n#define SMFIR_CONN_FAIL\t\t'f'\t/* cause a connection failure */\n#define SMFIR_ADDHEADER\t\t'h'\t/* add header */\n#define SMFIR_INSHEADER\t\t'i'\t/* insert header */\n#define SMFIR_SETSYMLIST\t'l'\t/* set list of symbols (macros) */\n#define SMFIR_CHGHEADER\t\t'm'\t/* change header */\n#define SMFIR_PROGRESS\t\t'p'\t/* progress */\n#define SMFIR_QUARANTINE\t'q'\t/* quarantine */\n#define SMFIR_REJECT\t\t'r'\t/* reject */\n#define SMFIR_SKIP\t\t's'\t/* skip */\n#define SMFIR_TEMPFAIL\t\t't'\t/* tempfail */\n#define SMFIR_REPLYCODE\t\t'y'\t/* reply code etc */\n\n/* What the MTA can send/filter wants in protocol */\n#define SMFIP_NOCONNECT 0x00000001L\t/* MTA should not send connect info */\n#define SMFIP_NOHELO\t0x00000002L\t/* MTA should not send HELO info */\n#define SMFIP_NOMAIL\t0x00000004L\t/* MTA should not send MAIL info */\n#define SMFIP_NORCPT\t0x00000008L\t/* MTA should not send RCPT info */\n#define SMFIP_NOBODY\t0x00000010L\t/* MTA should not send body */\n#define SMFIP_NOHDRS\t0x00000020L\t/* MTA should not send headers */\n#define SMFIP_NOEOH\t0x00000040L\t/* MTA should not send EOH */\n#define SMFIP_NR_HDR\t0x00000080L\t/* No reply for headers */\n#define SMFIP_NOHREPL\tSMFIP_NR_HDR\t/* No reply for headers */\n#define SMFIP_NOUNKNOWN 0x00000100L /* MTA should not send unknown commands */\n#define SMFIP_NODATA    0x00000200L\t/* MTA should not send DATA */\n#define SMFIP_SKIP\t0x00000400L\t/* MTA understands SMFIS_SKIP */\n#define SMFIP_RCPT_REJ\t0x00000800L /* MTA should also send rejected RCPTs */\n#define SMFIP_NR_CONN\t0x00001000L\t/* No reply for connect */\n#define SMFIP_NR_HELO\t0x00002000L\t/* No reply for HELO */\n#define SMFIP_NR_MAIL\t0x00004000L\t/* No reply for MAIL */\n#define SMFIP_NR_RCPT\t0x00008000L\t/* No reply for RCPT */\n#define SMFIP_NR_DATA\t0x00010000L\t/* No reply for DATA */\n#define SMFIP_NR_UNKN\t0x00020000L\t/* No reply for UNKN */\n#define SMFIP_NR_EOH\t0x00040000L\t/* No reply for eoh */\n#define SMFIP_NR_BODY\t0x00080000L\t/* No reply for body chunk */\n#define SMFIP_HDR_LEADSPC 0x00100000L\t/* header value leading space */\n#define SMFIP_MDS_256K\t0x10000000L\t/* MILTER_MAX_DATA_SIZE=256K */\n#define SMFIP_MDS_1M\t0x20000000L\t/* MILTER_MAX_DATA_SIZE=1M */\n/* #define SMFIP_\t0x40000000L\treserved: see SMFI_INTERNAL*/\n\n#define SMFI_V1_PROT\t0x0000003FL\t/* The protocol of V1 filter */\n#define SMFI_V2_PROT\t0x0000007FL\t/* The protocol of V2 filter */\n\n/* all defined protocol bits */\n#define SMFI_CURR_PROT\t0x001FFFFFL\n\n/* internal flags: only used between MTA and libmilter */\n#define SMFI_INTERNAL\t0x70000000L\n\n#if _FFR_MILTER_CHECK\n# define SMFIP_TEST\t0x80000000L\n#endif /* _FFR_MILTER_CHECK */\n\n#endif /* !_LIBMILTER_MFDEF_H */\n"
  },
  {
    "path": "freebsd-headers/libproc.h",
    "content": "/*-\n * Copyright (c) 2010 The FreeBSD Foundation\n * Copyright (c) 2008 John Birrell (jb@freebsd.org)\n * All rights reserved.\n *\n * Portions of this software were developed by Rui Paulo under sponsorship\n * from the FreeBSD Foundation.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/lib/libproc/libproc.h 211184 2010-08-11 17:33:26Z rpaulo $\n */\n\n#ifndef\t_LIBPROC_H_\n#define\t_LIBPROC_H_\n\n#include <gelf.h>\n#include <rtld_db.h>\n#include <limits.h>\n\nstruct proc_handle;\n\ntypedef void (*proc_child_func)(void *);\n\n/* Values returned by proc_state(). */\n#define PS_IDLE\t\t1\n#define PS_STOP\t\t2\n#define PS_RUN\t\t3\n#define PS_UNDEAD\t4\n#define PS_DEAD\t\t5\n#define PS_LOST\t\t6\n\n/* Reason values for proc_detach(). */\n#define PRELEASE_HANG\t1\n#define PRELEASE_KILL\t2\n\ntypedef struct prmap {\n\tuintptr_t\tpr_vaddr;\t/* Virtual address. */\n\tsize_t\t\tpr_size;\t/* Mapping size in bytes */\n\tsize_t\t\tpr_offset;\t/* Mapping offset in object */\n\tchar\t\tpr_mapname[PATH_MAX];\t/* Mapping filename */\n\tuint8_t\t\tpr_mflags;\t/* Protection flags */\n#define\tMA_READ\t\t0x01\n#define\tMA_WRITE\t0x02\n#define\tMA_EXEC\t\t0x04\n#define\tMA_COW\t\t0x08\n#define MA_NEEDS_COPY\t0x10\n#define\tMA_NOCOREDUMP\t0x20\n} prmap_t;\n\ntypedef int proc_map_f(void *, const prmap_t *, const char *);\ntypedef int proc_sym_f(void *, const GElf_Sym *, const char *);\n\n/* Values for ELF sections */\n#define\tPR_SYMTAB\t1\n#define PR_DYNSYM\t2\n\n/* Values for the 'mask' parameter in the iteration functions */\n#define\tBIND_LOCAL\t0x0001\n#define BIND_GLOBAL\t0x0002\n#define BIND_WEAK\t0x0004\n#define BIND_ANY\t(BIND_LOCAL|BIND_GLOBAL|BIND_WEAK)\n#define TYPE_NOTYPE\t0x0100\n#define TYPE_OBJECT\t0x0200\n#define TYPE_FUNC\t0x0400\n#define TYPE_SECTION\t0x0800\n#define TYPE_FILE\t0x1000\n#define TYPE_ANY\t(TYPE_NOTYPE|TYPE_OBJECT|TYPE_FUNC|TYPE_SECTION|\\\n    \t\t\t TYPE_FILE)\n\ntypedef enum {\n\tREG_PC,\n\tREG_SP,\n\tREG_RVAL1,\n\tREG_RVAL2\n} proc_reg_t;\n\n#define SIG2STR_MAX\t8\n\ntypedef struct lwpstatus {\n\tint pr_why;\n#define PR_REQUESTED\t1\n#define PR_FAULTED\t2\n#define PR_SYSENTRY\t3\n#define PR_SYSEXIT\t4\n\tint pr_what;\n#define FLTBPT\t\t-1\n} lwpstatus_t;\n\n/* Function prototype definitions. */\n__BEGIN_DECLS\n\nprmap_t *proc_addr2map(struct proc_handle *, uintptr_t);\nprmap_t *proc_name2map(struct proc_handle *, const char *);\nchar\t*proc_objname(struct proc_handle *, uintptr_t, char *, size_t);\nprmap_t *proc_obj2map(struct proc_handle *, const char *);\nint\tproc_iter_objs(struct proc_handle *, proc_map_f *, void *);\nint\tproc_iter_symbyaddr(struct proc_handle *, const char *, int,\n\t     int, proc_sym_f *, void *);\nint\tproc_addr2sym(struct proc_handle *, uintptr_t, char *, size_t, GElf_Sym *);\nint\tproc_attach(pid_t pid, int flags, struct proc_handle **pphdl);\nint\tproc_continue(struct proc_handle *);\nint\tproc_clearflags(struct proc_handle *, int);\nint\tproc_create(const char *, char * const *, proc_child_func *, void *,\n\t    struct proc_handle **);\nint\tproc_detach(struct proc_handle *, int);\nint\tproc_getflags(struct proc_handle *);\nint\tproc_name2sym(struct proc_handle *, const char *, const char *, GElf_Sym *);\nint\tproc_setflags(struct proc_handle *, int);\nint\tproc_state(struct proc_handle *);\npid_t\tproc_getpid(struct proc_handle *);\nint\tproc_wstatus(struct proc_handle *);\nint\tproc_getwstat(struct proc_handle *);\nchar *\tproc_signame(int, char *, size_t);\nint\tproc_read(struct proc_handle *, void *, size_t, size_t);\nconst lwpstatus_t *\n\tproc_getlwpstatus(struct proc_handle *);\nvoid\tproc_free(struct proc_handle *);\nrd_agent_t *proc_rdagent(struct proc_handle *);\nvoid\tproc_updatesyms(struct proc_handle *);\nint\tproc_bkptset(struct proc_handle *, uintptr_t, unsigned long *);\nint\tproc_bkptdel(struct proc_handle *, uintptr_t, unsigned long);\nvoid\tproc_bkptregadj(unsigned long *);\nint\tproc_bkptexec(struct proc_handle *, unsigned long);\nint\tproc_regget(struct proc_handle *, proc_reg_t, unsigned long *);\nint\tproc_regset(struct proc_handle *, proc_reg_t, unsigned long);\n\n__END_DECLS\n\n#endif /* !_LIBPROC_H_ */\n"
  },
  {
    "path": "freebsd-headers/libprocstat.h",
    "content": "/*-\n * Copyright (c) 2009 Stanislav Sedov <stas@FreeBSD.org>\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/lib/libprocstat/libprocstat.h 224859 2011-08-14 00:42:09Z rwatson $\n */\n\n#ifndef _LIBPROCSTAT_H_\n#define\t_LIBPROCSTAT_H_\n\n/*\n * Vnode types.\n */\n#define\tPS_FST_VTYPE_VNON\t1\n#define\tPS_FST_VTYPE_VREG\t2\n#define\tPS_FST_VTYPE_VDIR\t3\n#define\tPS_FST_VTYPE_VBLK\t4\n#define\tPS_FST_VTYPE_VCHR\t5\n#define\tPS_FST_VTYPE_VLNK\t6\n#define\tPS_FST_VTYPE_VSOCK\t7\n#define\tPS_FST_VTYPE_VFIFO\t8\n#define\tPS_FST_VTYPE_VBAD\t9\n#define\tPS_FST_VTYPE_UNKNOWN\t255\n\n/*\n * Descriptor types.\n */\n#define\tPS_FST_TYPE_VNODE\t1\n#define\tPS_FST_TYPE_FIFO\t2\n#define\tPS_FST_TYPE_SOCKET\t3\n#define\tPS_FST_TYPE_PIPE\t4\n#define\tPS_FST_TYPE_PTS\t\t5\n#define\tPS_FST_TYPE_KQUEUE\t6\n#define\tPS_FST_TYPE_CRYPTO\t7\n#define\tPS_FST_TYPE_MQUEUE\t8\n#define\tPS_FST_TYPE_SHM\t\t9\n#define\tPS_FST_TYPE_SEM\t\t10\n#define\tPS_FST_TYPE_UNKNOWN\t11\n#define\tPS_FST_TYPE_NONE\t12\n\n/*\n * Special descriptor numbers.\n */\n#define\tPS_FST_UFLAG_RDIR\t0x0001\n#define\tPS_FST_UFLAG_CDIR\t0x0002\n#define\tPS_FST_UFLAG_JAIL\t0x0004\n#define\tPS_FST_UFLAG_TRACE\t0x0008\n#define\tPS_FST_UFLAG_TEXT\t0x0010\n#define\tPS_FST_UFLAG_MMAP\t0x0020\n#define\tPS_FST_UFLAG_CTTY\t0x0040\n\n/*\n * Descriptor flags.\n */\n#define PS_FST_FFLAG_READ\t0x0001\n#define PS_FST_FFLAG_WRITE\t0x0002\n#define\tPS_FST_FFLAG_NONBLOCK\t0x0004\n#define\tPS_FST_FFLAG_APPEND\t0x0008\n#define\tPS_FST_FFLAG_SHLOCK\t0x0010\n#define\tPS_FST_FFLAG_EXLOCK\t0x0020\n#define\tPS_FST_FFLAG_ASYNC\t0x0040\n#define\tPS_FST_FFLAG_SYNC\t0x0080\n#define\tPS_FST_FFLAG_NOFOLLOW\t0x0100\n#define\tPS_FST_FFLAG_CREAT\t0x0200\n#define\tPS_FST_FFLAG_TRUNC\t0x0400\n#define\tPS_FST_FFLAG_EXCL\t0x0800\n#define\tPS_FST_FFLAG_DIRECT\t0x1000\n#define\tPS_FST_FFLAG_EXEC\t0x2000\n#define\tPS_FST_FFLAG_HASLOCK\t0x4000\n#define\tPS_FST_FFLAG_CAPABILITY\t0x8000\n\nstruct procstat;\nstruct filestat {\n\tint\tfs_type;\t/* Descriptor type. */\n\tint\tfs_flags;\t/* filestat specific flags. */\n\tint\tfs_fflags;\t/* Descriptor access flags. */\n\tint\tfs_uflags;\t/* How this file is used. */\n\tint\tfs_fd;\t\t/* File descriptor number. */\n\tint\tfs_ref_count;\t/* Reference count. */\n\toff_t\tfs_offset;\t/* Seek location. */\n\tvoid\t*fs_typedep;\t/* Type dependent data. */\n\tchar\t*fs_path;\n\tSTAILQ_ENTRY(filestat)\tnext;\n\tcap_rights_t\tfs_cap_rights;\t/* Capability rights, if flag set. */\n};\nstruct vnstat {\n\tuint64_t\tvn_fileid;\n\tuint64_t\tvn_size;\n\tchar\t\t*vn_mntdir;\n\tuint32_t\tvn_dev;\n\tuint32_t\tvn_fsid;\n\tint\t\tvn_type;\n\tuint16_t\tvn_mode;\n\tchar\t\tvn_devname[SPECNAMELEN + 1];\n};\nstruct ptsstat {\n\tuint32_t\tdev;\n\tchar\t\tdevname[SPECNAMELEN + 1];\n};\nstruct pipestat {\n\tsize_t\t\tbuffer_cnt;\n\tuint64_t\taddr;\n\tuint64_t\tpeer;\n};\nstruct sockstat {\n\tuint64_t\tinp_ppcb;\n\tuint64_t\tso_addr;\n\tuint64_t\tso_pcb;\n\tuint64_t\tunp_conn;\n\tint\t\tdom_family;\n\tint\t\tproto;\n\tint\t\tso_rcv_sb_state;\n\tint\t\tso_snd_sb_state;\n\tstruct sockaddr_storage\tsa_local;\t/* Socket address. */\n\tstruct sockaddr_storage\tsa_peer;\t/* Peer address. */\n\tint\t\ttype;\n\tchar\t\tdname[32];\n};\n\nSTAILQ_HEAD(filestat_list, filestat);\n\nvoid\tprocstat_close(struct procstat *procstat);\nvoid\tprocstat_freeprocs(struct procstat *procstat, struct kinfo_proc *p);\nvoid\tprocstat_freefiles(struct procstat *procstat,\n    struct filestat_list *head);\nstruct filestat_list\t*procstat_getfiles(struct procstat *procstat,\n    struct kinfo_proc *kp, int mmapped);\nstruct kinfo_proc\t*procstat_getprocs(struct procstat *procstat,\n    int what, int arg, unsigned int *count);\nint\tprocstat_get_pipe_info(struct procstat *procstat, struct filestat *fst,\n    struct pipestat *pipe, char *errbuf);\nint\tprocstat_get_pts_info(struct procstat *procstat, struct filestat *fst,\n    struct ptsstat *pts, char *errbuf);\nint\tprocstat_get_socket_info(struct procstat *procstat, struct filestat *fst,\n    struct sockstat *sock, char *errbuf);\nint\tprocstat_get_vnode_info(struct procstat *procstat, struct filestat *fst,\n    struct vnstat *vn, char *errbuf);\nstruct procstat\t*procstat_open_sysctl(void);\nstruct procstat\t*procstat_open_kvm(const char *nlistf, const char *memf);\n\n#endif\t/* !_LIBPROCSTAT_H_ */\n"
  },
  {
    "path": "freebsd-headers/libufs.h",
    "content": "/*\n * Copyright (c) 2002 Juli Mallett.  All rights reserved.\n *\n * This software was written by Juli Mallett <jmallett@FreeBSD.org> for the\n * FreeBSD project.  Redistribution and use in source and binary forms, with\n * or without modification, are permitted provided that the following\n * conditions are met:\n *\n * 1. Redistribution of source code must retain the above copyright notice,\n *    this list of conditions and the following disclaimer.\n * 2. Redistribution in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR\n * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\n * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR\n * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,\n * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING\n * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/lib/libufs/libufs.h 218601 2011-02-12 12:46:00Z kib $\n */\n\n#ifndef\t__LIBUFS_H__\n#define\t__LIBUFS_H__\n\n/*\n * libufs structures.\n */\n\n/*\n * userland ufs disk.\n */\nstruct uufsd {\n\tconst char *d_name;\t/* disk name */\n\tint d_ufs;\t\t/* decimal UFS version */\n\tint d_fd;\t\t/* raw device file descriptor */\n\tlong d_bsize;\t\t/* device bsize */\n\tufs2_daddr_t d_sblock;\t/* superblock location */\n\tstruct csum *d_sbcsum;\t/* Superblock summary info */\n\tcaddr_t d_inoblock;\t/* inode block */\n\tino_t d_inomin;\t\t/* low inode */\n\tino_t d_inomax;\t\t/* high inode */\n\tunion {\n\t\tstruct fs d_fs;\t/* filesystem information */\n\t\tchar d_sb[MAXBSIZE];\n\t\t\t\t/* superblock as buffer */\n\t} d_sbunion;\n\tunion {\n\t\tstruct cg d_cg;\t/* cylinder group */\n\t\tchar d_buf[MAXBSIZE];\n\t\t\t\t/* cylinder group storage */\n\t} d_cgunion;\n\tint d_ccg;\t\t/* current cylinder group */\n\tint d_lcg;\t\t/* last cylinder group (in d_cg) */\n\tconst char *d_error;\t/* human readable disk error */\n\tint d_mine;\t\t/* internal flags */\n#define\td_fs\td_sbunion.d_fs\n#define\td_sb\td_sbunion.d_sb\n#define\td_cg\td_cgunion.d_cg\n};\n\n/*\n * libufs macros (internal, non-exported).\n */\n#ifdef\t_LIBUFS\n/*\n * Trace steps through libufs, to be used at entry and erroneous return.\n */\nstatic inline void\nERROR(struct uufsd *u, const char *str)\n{\n\n#ifdef\t_LIBUFS_DEBUGGING\n\tif (str != NULL) {\n\t\tfprintf(stderr, \"libufs: %s\", str);\n\t\tif (errno != 0)\n\t\t\tfprintf(stderr, \": %s\", strerror(errno));\n\t\tfprintf(stderr, \"\\n\");\n\t}\n#endif\n\tif (u != NULL)\n\t\tu->d_error = str;\n}\n#endif\t/* _LIBUFS */\n\n__BEGIN_DECLS\n\n/*\n * libufs prototypes.\n */\n\n/*\n * block.c\n */\nssize_t bread(struct uufsd *, ufs2_daddr_t, void *, size_t);\nssize_t bwrite(struct uufsd *, ufs2_daddr_t, const void *, size_t);\nint berase(struct uufsd *, ufs2_daddr_t, ufs2_daddr_t);\n\n/*\n * cgroup.c\n */\nufs2_daddr_t cgballoc(struct uufsd *);\nint cgbfree(struct uufsd *, ufs2_daddr_t, long);\nino_t cgialloc(struct uufsd *);\nint cgread(struct uufsd *);\nint cgread1(struct uufsd *, int);\nint cgwrite(struct uufsd *);\nint cgwrite1(struct uufsd *, int);\n\n/*\n * inode.c\n */\nint getino(struct uufsd *, void **, ino_t, int *);\nint putino(struct uufsd *);\n\n/*\n * sblock.c\n */\nint sbread(struct uufsd *);\nint sbwrite(struct uufsd *, int);\n\n/*\n * type.c\n */\nint ufs_disk_close(struct uufsd *);\nint ufs_disk_fillout(struct uufsd *, const char *);\nint ufs_disk_fillout_blank(struct uufsd *, const char *);\nint ufs_disk_write(struct uufsd *);\n\n/*\n * ffs_subr.c\n */\nvoid\tffs_clrblock(struct fs *, u_char *, ufs1_daddr_t);\nvoid\tffs_clusteracct(struct fs *, struct cg *, ufs1_daddr_t, int);\nvoid\tffs_fragacct(struct fs *, int, int32_t [], int);\nint\tffs_isblock(struct fs *, u_char *, ufs1_daddr_t);\nint\tffs_isfreeblock(struct fs *, u_char *, ufs1_daddr_t);\nvoid\tffs_setblock(struct fs *, u_char *, ufs1_daddr_t);\n\n__END_DECLS\n\n#endif\t/* __LIBUFS_H__ */\n"
  },
  {
    "path": "freebsd-headers/libusb.h",
    "content": "/* $FreeBSD: release/9.0.0/lib/libusb/libusb.h 225659 2011-09-19 08:52:06Z hselasky $ */\n/*-\n * Copyright (c) 2009 Sylvestre Gallon. All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n */\n\n#ifndef __LIBUSB_H__\n#define\t__LIBUSB_H__\n\n#include <sys/time.h>\n#include <sys/types.h>\n\n#ifdef __cplusplus\nextern\t\"C\" {\n#endif\n#if 0\n}\t\t\t\t\t/* indent fix */\n\n#endif\n\n/* libusb enums */\n\nenum libusb_class_code {\n\tLIBUSB_CLASS_PER_INTERFACE = 0,\n\tLIBUSB_CLASS_AUDIO = 1,\n\tLIBUSB_CLASS_COMM = 2,\n\tLIBUSB_CLASS_HID = 3,\n\tLIBUSB_CLASS_PTP = 6,\n\tLIBUSB_CLASS_PRINTER = 7,\n\tLIBUSB_CLASS_MASS_STORAGE = 8,\n\tLIBUSB_CLASS_HUB = 9,\n\tLIBUSB_CLASS_DATA = 10,\n\tLIBUSB_CLASS_VENDOR_SPEC = 0xff,\n};\n\nenum libusb_descriptor_type {\n\tLIBUSB_DT_DEVICE = 0x01,\n\tLIBUSB_DT_CONFIG = 0x02,\n\tLIBUSB_DT_STRING = 0x03,\n\tLIBUSB_DT_INTERFACE = 0x04,\n\tLIBUSB_DT_ENDPOINT = 0x05,\n\tLIBUSB_DT_HID = 0x21,\n\tLIBUSB_DT_REPORT = 0x22,\n\tLIBUSB_DT_PHYSICAL = 0x23,\n\tLIBUSB_DT_HUB = 0x29,\n};\n\n#define\tLIBUSB_DT_DEVICE_SIZE\t\t18\n#define\tLIBUSB_DT_CONFIG_SIZE\t\t9\n#define\tLIBUSB_DT_INTERFACE_SIZE\t9\n#define\tLIBUSB_DT_ENDPOINT_SIZE\t\t7\n#define\tLIBUSB_DT_ENDPOINT_AUDIO_SIZE\t9\n#define\tLIBUSB_DT_HUB_NONVAR_SIZE\t7\n\n#define\tLIBUSB_ENDPOINT_ADDRESS_MASK\t0x0f\n#define\tLIBUSB_ENDPOINT_DIR_MASK\t0x80\n\nenum libusb_endpoint_direction {\n\tLIBUSB_ENDPOINT_IN = 0x80,\n\tLIBUSB_ENDPOINT_OUT = 0x00,\n};\n\n#define\tLIBUSB_TRANSFER_TYPE_MASK\t0x03\n\nenum libusb_transfer_type {\n\tLIBUSB_TRANSFER_TYPE_CONTROL = 0,\n\tLIBUSB_TRANSFER_TYPE_ISOCHRONOUS = 1,\n\tLIBUSB_TRANSFER_TYPE_BULK = 2,\n\tLIBUSB_TRANSFER_TYPE_INTERRUPT = 3,\n};\n\nenum libusb_standard_request {\n\tLIBUSB_REQUEST_GET_STATUS = 0x00,\n\tLIBUSB_REQUEST_CLEAR_FEATURE = 0x01,\n\tLIBUSB_REQUEST_SET_FEATURE = 0x03,\n\tLIBUSB_REQUEST_SET_ADDRESS = 0x05,\n\tLIBUSB_REQUEST_GET_DESCRIPTOR = 0x06,\n\tLIBUSB_REQUEST_SET_DESCRIPTOR = 0x07,\n\tLIBUSB_REQUEST_GET_CONFIGURATION = 0x08,\n\tLIBUSB_REQUEST_SET_CONFIGURATION = 0x09,\n\tLIBUSB_REQUEST_GET_INTERFACE = 0x0A,\n\tLIBUSB_REQUEST_SET_INTERFACE = 0x0B,\n\tLIBUSB_REQUEST_SYNCH_FRAME = 0x0C,\n};\n\nenum libusb_request_type {\n\tLIBUSB_REQUEST_TYPE_STANDARD = (0x00 << 5),\n\tLIBUSB_REQUEST_TYPE_CLASS = (0x01 << 5),\n\tLIBUSB_REQUEST_TYPE_VENDOR = (0x02 << 5),\n\tLIBUSB_REQUEST_TYPE_RESERVED = (0x03 << 5),\n};\n\nenum libusb_request_recipient {\n\tLIBUSB_RECIPIENT_DEVICE = 0x00,\n\tLIBUSB_RECIPIENT_INTERFACE = 0x01,\n\tLIBUSB_RECIPIENT_ENDPOINT = 0x02,\n\tLIBUSB_RECIPIENT_OTHER = 0x03,\n};\n\n#define\tLIBUSB_ISO_SYNC_TYPE_MASK\t0x0C\n\nenum libusb_iso_sync_type {\n\tLIBUSB_ISO_SYNC_TYPE_NONE = 0,\n\tLIBUSB_ISO_SYNC_TYPE_ASYNC = 1,\n\tLIBUSB_ISO_SYNC_TYPE_ADAPTIVE = 2,\n\tLIBUSB_ISO_SYNC_TYPE_SYNC = 3,\n};\n\n#define\tLIBUSB_ISO_USAGE_TYPE_MASK 0x30\n\nenum libusb_iso_usage_type {\n\tLIBUSB_ISO_USAGE_TYPE_DATA = 0,\n\tLIBUSB_ISO_USAGE_TYPE_FEEDBACK = 1,\n\tLIBUSB_ISO_USAGE_TYPE_IMPLICIT = 2,\n};\n\nenum libusb_error {\n\tLIBUSB_SUCCESS = 0,\n\tLIBUSB_ERROR_IO = -1,\n\tLIBUSB_ERROR_INVALID_PARAM = -2,\n\tLIBUSB_ERROR_ACCESS = -3,\n\tLIBUSB_ERROR_NO_DEVICE = -4,\n\tLIBUSB_ERROR_NOT_FOUND = -5,\n\tLIBUSB_ERROR_BUSY = -6,\n\tLIBUSB_ERROR_TIMEOUT = -7,\n\tLIBUSB_ERROR_OVERFLOW = -8,\n\tLIBUSB_ERROR_PIPE = -9,\n\tLIBUSB_ERROR_INTERRUPTED = -10,\n\tLIBUSB_ERROR_NO_MEM = -11,\n\tLIBUSB_ERROR_NOT_SUPPORTED = -12,\n\tLIBUSB_ERROR_OTHER = -99,\n};\n\nenum libusb_speed {\n\tLIBUSB_SPEED_UNKNOWN = 0,\n\tLIBUSB_SPEED_LOW = 1,\n\tLIBUSB_SPEED_FULL = 2,\n\tLIBUSB_SPEED_HIGH = 3,\n\tLIBUSB_SPEED_SUPER = 4,\n};\n\nenum libusb_transfer_status {\n\tLIBUSB_TRANSFER_COMPLETED,\n\tLIBUSB_TRANSFER_ERROR,\n\tLIBUSB_TRANSFER_TIMED_OUT,\n\tLIBUSB_TRANSFER_CANCELLED,\n\tLIBUSB_TRANSFER_STALL,\n\tLIBUSB_TRANSFER_NO_DEVICE,\n\tLIBUSB_TRANSFER_OVERFLOW,\n};\n\nenum libusb_transfer_flags {\n\tLIBUSB_TRANSFER_SHORT_NOT_OK = 1 << 0,\n\tLIBUSB_TRANSFER_FREE_BUFFER = 1 << 1,\n\tLIBUSB_TRANSFER_FREE_TRANSFER = 1 << 2,\n};\n\nenum libusb_debug_level {\n\tLIBUSB_DEBUG_NO=0,\n\tLIBUSB_DEBUG_FUNCTION=1,\n\tLIBUSB_DEBUG_TRANSFER=2,\n};\n\n/* libusb structures */\n\nstruct libusb_context;\nstruct libusb_device;\nstruct libusb_transfer;\nstruct libusb_device_handle;\n\nstruct libusb_pollfd {\n\tint\tfd;\n\tshort\tevents;\n};\n\ntypedef struct libusb_context libusb_context;\ntypedef struct libusb_device libusb_device;\ntypedef struct libusb_device_handle libusb_device_handle;\ntypedef struct libusb_pollfd libusb_pollfd;\ntypedef void (*libusb_pollfd_added_cb) (int fd, short events, void *user_data);\ntypedef void (*libusb_pollfd_removed_cb) (int fd, void *user_data);\n\ntypedef struct libusb_device_descriptor {\n\tuint8_t\tbLength;\n\tuint8_t\tbDescriptorType;\n\tuint16_t bcdUSB;\n\tuint8_t\tbDeviceClass;\n\tuint8_t\tbDeviceSubClass;\n\tuint8_t\tbDeviceProtocol;\n\tuint8_t\tbMaxPacketSize0;\n\tuint16_t idVendor;\n\tuint16_t idProduct;\n\tuint16_t bcdDevice;\n\tuint8_t\tiManufacturer;\n\tuint8_t\tiProduct;\n\tuint8_t\tiSerialNumber;\n\tuint8_t\tbNumConfigurations;\n}\tlibusb_device_descriptor;\n\ntypedef struct libusb_endpoint_descriptor {\n\tuint8_t\tbLength;\n\tuint8_t\tbDescriptorType;\n\tuint8_t\tbEndpointAddress;\n\tuint8_t\tbmAttributes;\n\tuint16_t wMaxPacketSize;\n\tuint8_t\tbInterval;\n\tuint8_t\tbRefresh;\n\tuint8_t\tbSynchAddress;\n\tuint8_t *extra;\n\tint\textra_length;\n}\tlibusb_endpoint_descriptor __aligned(sizeof(void *));\n\ntypedef struct libusb_interface_descriptor {\n\tuint8_t\tbLength;\n\tuint8_t\tbDescriptorType;\n\tuint8_t\tbInterfaceNumber;\n\tuint8_t\tbAlternateSetting;\n\tuint8_t\tbNumEndpoints;\n\tuint8_t\tbInterfaceClass;\n\tuint8_t\tbInterfaceSubClass;\n\tuint8_t\tbInterfaceProtocol;\n\tuint8_t\tiInterface;\n\tstruct libusb_endpoint_descriptor *endpoint;\n\tuint8_t *extra;\n\tint\textra_length;\n}\tlibusb_interface_descriptor __aligned(sizeof(void *));\n\ntypedef struct libusb_interface {\n\tstruct libusb_interface_descriptor *altsetting;\n\tint\tnum_altsetting;\n}\tlibusb_interface __aligned(sizeof(void *));\n\ntypedef struct libusb_config_descriptor {\n\tuint8_t\tbLength;\n\tuint8_t\tbDescriptorType;\n\tuint16_t wTotalLength;\n\tuint8_t\tbNumInterfaces;\n\tuint8_t\tbConfigurationValue;\n\tuint8_t\tiConfiguration;\n\tuint8_t\tbmAttributes;\n\tuint8_t\tMaxPower;\n\tstruct libusb_interface *interface;\n\tuint8_t *extra;\n\tint\textra_length;\n}\tlibusb_config_descriptor __aligned(sizeof(void *));\n\ntypedef struct libusb_control_setup {\n\tuint8_t\tbmRequestType;\n\tuint8_t\tbRequest;\n\tuint16_t wValue;\n\tuint16_t wIndex;\n\tuint16_t wLength;\n}\tlibusb_control_setup;\n\n#define\tLIBUSB_CONTROL_SETUP_SIZE\t8\t/* bytes */\n\ntypedef struct libusb_iso_packet_descriptor {\n\tuint32_t length;\n\tuint32_t actual_length;\n\tenum libusb_transfer_status status;\n}\tlibusb_iso_packet_descriptor __aligned(sizeof(void *));\n\ntypedef void (*libusb_transfer_cb_fn) (struct libusb_transfer *transfer);\n\ntypedef struct libusb_transfer {\n\tlibusb_device_handle *dev_handle;\n\tuint8_t\tflags;\n\tuint32_t endpoint;\n\tuint8_t type;\n\tuint32_t timeout;\n\tenum libusb_transfer_status status;\n\tint\tlength;\n\tint\tactual_length;\n\tlibusb_transfer_cb_fn callback;\n\tvoid   *user_data;\n\tuint8_t *buffer;\n\tvoid *os_priv;\n\tint\tnum_iso_packets;\n\tstruct libusb_iso_packet_descriptor iso_packet_desc[0];\n}\tlibusb_transfer __aligned(sizeof(void *));\n\n/* Library initialisation */\n\nvoid\tlibusb_set_debug(libusb_context * ctx, int level);\nconst char *libusb_strerror(int code);\nconst char *libusb_error_name(int code);\nint\tlibusb_init(libusb_context ** context);\nvoid\tlibusb_exit(struct libusb_context *ctx);\n\n/* Device handling and enumeration */\n\nssize_t libusb_get_device_list(libusb_context * ctx, libusb_device *** list);\nvoid\tlibusb_free_device_list(libusb_device ** list, int unref_devices);\nuint8_t\tlibusb_get_bus_number(libusb_device * dev);\nuint8_t\tlibusb_get_device_address(libusb_device * dev);\nenum libusb_speed libusb_get_device_speed(libusb_device * dev);\nint\tlibusb_clear_halt(libusb_device_handle *devh, uint8_t endpoint);\nint\tlibusb_get_max_packet_size(libusb_device * dev, uint8_t endpoint);\nlibusb_device *libusb_ref_device(libusb_device * dev);\nvoid\tlibusb_unref_device(libusb_device * dev);\nint\tlibusb_open(libusb_device * dev, libusb_device_handle ** devh);\nlibusb_device_handle *libusb_open_device_with_vid_pid(libusb_context * ctx, uint16_t vendor_id, uint16_t product_id);\nvoid\tlibusb_close(libusb_device_handle * devh);\nlibusb_device *libusb_get_device(libusb_device_handle * devh);\nint\tlibusb_get_configuration(libusb_device_handle * devh, int *config);\nint\tlibusb_set_configuration(libusb_device_handle * devh, int configuration);\nint\tlibusb_claim_interface(libusb_device_handle * devh, int interface_number);\nint\tlibusb_release_interface(libusb_device_handle * devh, int interface_number);\nint\tlibusb_reset_device(libusb_device_handle * devh);\nint\tlibusb_check_connected(libusb_device_handle * devh);\nint \tlibusb_kernel_driver_active(libusb_device_handle * devh, int interface);\nint\tlibusb_get_driver_np(libusb_device_handle * devh, int interface, char *name, int namelen);\nint\tlibusb_get_driver(libusb_device_handle * devh, int interface, char *name, int namelen);\nint \tlibusb_detach_kernel_driver_np(libusb_device_handle * devh, int interface);\nint \tlibusb_detach_kernel_driver(libusb_device_handle * devh, int interface);\nint \tlibusb_attach_kernel_driver(libusb_device_handle * devh, int interface);\nint\tlibusb_set_interface_alt_setting(libusb_device_handle * devh, int interface_number, int alternate_setting);\n\n/* USB Descriptors */\n\nint\tlibusb_get_device_descriptor(libusb_device * dev, struct libusb_device_descriptor *desc);\nint\tlibusb_get_active_config_descriptor(libusb_device * dev, struct libusb_config_descriptor **config);\nint\tlibusb_get_config_descriptor(libusb_device * dev, uint8_t config_index, struct libusb_config_descriptor **config);\nint\tlibusb_get_config_descriptor_by_value(libusb_device * dev, uint8_t bConfigurationValue, struct libusb_config_descriptor **config);\nvoid\tlibusb_free_config_descriptor(struct libusb_config_descriptor *config);\nint\tlibusb_get_string_descriptor_ascii(libusb_device_handle * devh, uint8_t desc_index, uint8_t *data, int length);\nint\tlibusb_get_descriptor(libusb_device_handle * devh, uint8_t desc_type, uint8_t desc_index, uint8_t *data, int length);\n\n/* Asynchronous device I/O */\n\nstruct libusb_transfer *libusb_alloc_transfer(int iso_packets);\nvoid\tlibusb_free_transfer(struct libusb_transfer *transfer);\nint\tlibusb_submit_transfer(struct libusb_transfer *transfer);\nint\tlibusb_cancel_transfer(struct libusb_transfer *transfer);\nuint8_t *libusb_get_iso_packet_buffer(struct libusb_transfer *transfer, uint32_t index);\nuint8_t *libusb_get_iso_packet_buffer_simple(struct libusb_transfer *transfer, uint32_t index);\nvoid\tlibusb_set_iso_packet_lengths(struct libusb_transfer *transfer, uint32_t length);\nuint8_t *libusb_control_transfer_get_data(struct libusb_transfer *transfer);\nstruct libusb_control_setup *libusb_control_transfer_get_setup(struct libusb_transfer *transfer);\nvoid\tlibusb_fill_control_setup(uint8_t *buf, uint8_t bmRequestType, uint8_t bRequest, uint16_t wValue, uint16_t wIndex, uint16_t wLength);\nvoid\tlibusb_fill_control_transfer(struct libusb_transfer *transfer, libusb_device_handle *devh, uint8_t *buf, libusb_transfer_cb_fn callback, void *user_data, uint32_t timeout);\nvoid\tlibusb_fill_bulk_transfer(struct libusb_transfer *transfer, libusb_device_handle *devh, uint8_t endpoint, uint8_t *buf, int length, libusb_transfer_cb_fn callback, void *user_data, uint32_t timeout);\nvoid\tlibusb_fill_interrupt_transfer(struct libusb_transfer *transfer, libusb_device_handle *devh, uint8_t endpoint, uint8_t *buf, int length, libusb_transfer_cb_fn callback, void *user_data, uint32_t timeout);\nvoid\tlibusb_fill_iso_transfer(struct libusb_transfer *transfer, libusb_device_handle *devh, uint8_t endpoint, uint8_t *buf, int length, int npacket, libusb_transfer_cb_fn callback, void *user_data, uint32_t timeout);\n\n/* Polling and timing */\n\nint\tlibusb_try_lock_events(libusb_context * ctx);\nvoid\tlibusb_lock_events(libusb_context * ctx);\nvoid\tlibusb_unlock_events(libusb_context * ctx);\nint\tlibusb_event_handling_ok(libusb_context * ctx);\nint\tlibusb_event_handler_active(libusb_context * ctx);\nvoid\tlibusb_lock_event_waiters(libusb_context * ctx);\nvoid\tlibusb_unlock_event_waiters(libusb_context * ctx);\nint\tlibusb_wait_for_event(libusb_context * ctx, struct timeval *tv);\nint\tlibusb_handle_events_timeout(libusb_context * ctx, struct timeval *tv);\nint\tlibusb_handle_events(libusb_context * ctx);\nint\tlibusb_handle_events_locked(libusb_context * ctx, struct timeval *tv);\nint\tlibusb_get_next_timeout(libusb_context * ctx, struct timeval *tv);\nvoid\tlibusb_set_pollfd_notifiers(libusb_context * ctx, libusb_pollfd_added_cb added_cb, libusb_pollfd_removed_cb removed_cb, void *user_data);\nstruct libusb_pollfd **libusb_get_pollfds(libusb_context * ctx);\n\n/* Synchronous device I/O */\n\nint\tlibusb_control_transfer(libusb_device_handle * devh, uint8_t bmRequestType, uint8_t bRequest, uint16_t wValue, uint16_t wIndex, uint8_t *data, uint16_t wLength, uint32_t timeout);\nint\tlibusb_bulk_transfer(libusb_device_handle * devh, uint8_t endpoint, uint8_t *data, int length, int *transferred, uint32_t timeout);\nint\tlibusb_interrupt_transfer(libusb_device_handle * devh, uint8_t endpoint, uint8_t *data, int length, int *transferred, uint32_t timeout);\n\n/* Byte-order */\n\nuint16_t libusb_cpu_to_le16(uint16_t x);\nuint16_t libusb_le16_to_cpu(uint16_t x);\n\n#if 0\n{\t\t\t\t\t/* indent fix */\n#endif\n#ifdef __cplusplus\n}\n\n#endif\n\n#endif\t\t\t\t\t/* __LIBUSB_H__ */\n"
  },
  {
    "path": "freebsd-headers/libusb20.h",
    "content": "/* $FreeBSD: release/9.0.0/lib/libusb/libusb20.h 225659 2011-09-19 08:52:06Z hselasky $ */\n/*-\n * Copyright (c) 2008-2009 Hans Petter Selasky. All rights reserved.\n * Copyright (c) 2007-2008 Daniel Drake.  All rights reserved.\n * Copyright (c) 2001 Johannes Erdfelt.  All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n */\n\n#ifndef _LIBUSB20_H_\n#define\t_LIBUSB20_H_\n\n#include <sys/endian.h>\n#include <sys/time.h>\n#include <sys/types.h>\n\n#include <stdint.h>\n#include <string.h>\n#include <time.h>\n\n#ifdef __cplusplus\nextern\t\"C\" {\n#endif\n#if 0\n};\t\t\t\t\t/* style */\n\n#endif\n\n/** \\ingroup misc\n * Error codes. Most libusb20 functions return 0 on success or one of\n * these codes on failure.\n */\nenum libusb20_error {\n\t/** Success (no error) */\n\tLIBUSB20_SUCCESS = 0,\n\n\t/** Input/output error */\n\tLIBUSB20_ERROR_IO = -1,\n\n\t/** Invalid parameter */\n\tLIBUSB20_ERROR_INVALID_PARAM = -2,\n\n\t/** Access denied (insufficient permissions) */\n\tLIBUSB20_ERROR_ACCESS = -3,\n\n\t/** No such device (it may have been disconnected) */\n\tLIBUSB20_ERROR_NO_DEVICE = -4,\n\n\t/** Entity not found */\n\tLIBUSB20_ERROR_NOT_FOUND = -5,\n\n\t/** Resource busy */\n\tLIBUSB20_ERROR_BUSY = -6,\n\n\t/** Operation timed out */\n\tLIBUSB20_ERROR_TIMEOUT = -7,\n\n\t/** Overflow */\n\tLIBUSB20_ERROR_OVERFLOW = -8,\n\n\t/** Pipe error */\n\tLIBUSB20_ERROR_PIPE = -9,\n\n\t/** System call interrupted (perhaps due to signal) */\n\tLIBUSB20_ERROR_INTERRUPTED = -10,\n\n\t/** Insufficient memory */\n\tLIBUSB20_ERROR_NO_MEM = -11,\n\n\t/** Operation not supported or unimplemented on this platform */\n\tLIBUSB20_ERROR_NOT_SUPPORTED = -12,\n\n\t/** Other error */\n\tLIBUSB20_ERROR_OTHER = -99,\n};\n\n/** \\ingroup asyncio\n * libusb20_tr_get_status() values */\nenum libusb20_transfer_status {\n\t/** Transfer completed without error. Note that this does not\n\t * indicate that the entire amount of requested data was\n\t * transferred. */\n\tLIBUSB20_TRANSFER_COMPLETED,\n\n\t/** Callback code to start transfer */\n\tLIBUSB20_TRANSFER_START,\n\n\t/** Drain complete callback code */\n\tLIBUSB20_TRANSFER_DRAINED,\n\n\t/** Transfer failed */\n\tLIBUSB20_TRANSFER_ERROR,\n\n\t/** Transfer timed out */\n\tLIBUSB20_TRANSFER_TIMED_OUT,\n\n\t/** Transfer was cancelled */\n\tLIBUSB20_TRANSFER_CANCELLED,\n\n\t/** For bulk/interrupt endpoints: halt condition detected\n\t * (endpoint stalled). For control endpoints: control request\n\t * not supported. */\n\tLIBUSB20_TRANSFER_STALL,\n\n\t/** Device was disconnected */\n\tLIBUSB20_TRANSFER_NO_DEVICE,\n\n\t/** Device sent more data than requested */\n\tLIBUSB20_TRANSFER_OVERFLOW,\n};\n\n/** \\ingroup asyncio\n * libusb20_tr_set_flags() values */\nenum libusb20_transfer_flags {\n\t/** Report a short frame as error */\n\tLIBUSB20_TRANSFER_SINGLE_SHORT_NOT_OK = 0x0001,\n\n\t/** Multiple short frames are not allowed */\n\tLIBUSB20_TRANSFER_MULTI_SHORT_NOT_OK = 0x0002,\n\n\t/** All transmitted frames are short terminated */\n\tLIBUSB20_TRANSFER_FORCE_SHORT = 0x0004,\n\n\t/** Will do a clear-stall before xfer */\n\tLIBUSB20_TRANSFER_DO_CLEAR_STALL = 0x0008,\n};\n\n/** \\ingroup misc\n * libusb20_dev_get_mode() values\n */\nenum libusb20_device_mode {\n\tLIBUSB20_MODE_HOST,\t\t/* default */\n\tLIBUSB20_MODE_DEVICE,\n};\n\n/** \\ingroup misc\n * libusb20_dev_get_speed() values\n */\nenum {\n\tLIBUSB20_SPEED_UNKNOWN,\t\t/* default */\n\tLIBUSB20_SPEED_LOW,\n\tLIBUSB20_SPEED_FULL,\n\tLIBUSB20_SPEED_HIGH,\n\tLIBUSB20_SPEED_VARIABLE,\n\tLIBUSB20_SPEED_SUPER,\n};\n\n/** \\ingroup misc\n * libusb20_dev_set_power() values\n */\nenum {\n\tLIBUSB20_POWER_OFF,\n\tLIBUSB20_POWER_ON,\n\tLIBUSB20_POWER_SAVE,\n\tLIBUSB20_POWER_SUSPEND,\n\tLIBUSB20_POWER_RESUME,\n};\n\nstruct usb_device_info;\nstruct libusb20_transfer;\nstruct libusb20_backend;\nstruct libusb20_backend_methods;\nstruct libusb20_device;\nstruct libusb20_device_methods;\nstruct libusb20_config;\nstruct LIBUSB20_CONTROL_SETUP_DECODED;\nstruct LIBUSB20_DEVICE_DESC_DECODED;\n\ntypedef void (libusb20_tr_callback_t)(struct libusb20_transfer *xfer);\n\nstruct libusb20_quirk {\n\tuint16_t vid;\t\t\t/* vendor ID */\n\tuint16_t pid;\t\t\t/* product ID */\n\tuint16_t bcdDeviceLow;\t\t/* low revision value, inclusive */\n\tuint16_t bcdDeviceHigh;\t\t/* high revision value, inclusive */\n\tuint16_t reserved[2];\t\t/* for the future */\n\t/* quirk name, UQ_XXX, including terminating zero */\n\tchar\tquirkname[64 - 12];\n};\n\n#define\tLIBUSB20_MAX_FRAME_PRE_SCALE\t(1U << 31)\n\n/* USB transfer operations */\nint\tlibusb20_tr_close(struct libusb20_transfer *xfer);\nint\tlibusb20_tr_open(struct libusb20_transfer *xfer, uint32_t max_buf_size, uint32_t max_frame_count, uint8_t ep_no);\nstruct libusb20_transfer *libusb20_tr_get_pointer(struct libusb20_device *pdev, uint16_t tr_index);\nuint16_t libusb20_tr_get_time_complete(struct libusb20_transfer *xfer);\nuint32_t libusb20_tr_get_actual_frames(struct libusb20_transfer *xfer);\nuint32_t libusb20_tr_get_actual_length(struct libusb20_transfer *xfer);\nuint32_t libusb20_tr_get_max_frames(struct libusb20_transfer *xfer);\nuint32_t libusb20_tr_get_max_packet_length(struct libusb20_transfer *xfer);\nuint32_t libusb20_tr_get_max_total_length(struct libusb20_transfer *xfer);\nuint8_t\tlibusb20_tr_get_status(struct libusb20_transfer *xfer);\nuint8_t\tlibusb20_tr_pending(struct libusb20_transfer *xfer);\nvoid\tlibusb20_tr_callback_wrapper(struct libusb20_transfer *xfer);\nvoid\tlibusb20_tr_clear_stall_sync(struct libusb20_transfer *xfer);\nvoid\tlibusb20_tr_drain(struct libusb20_transfer *xfer);\nvoid\tlibusb20_tr_set_buffer(struct libusb20_transfer *xfer, void *buffer, uint16_t fr_index);\nvoid\tlibusb20_tr_set_callback(struct libusb20_transfer *xfer, libusb20_tr_callback_t *cb);\nvoid\tlibusb20_tr_set_flags(struct libusb20_transfer *xfer, uint8_t flags);\nuint32_t libusb20_tr_get_length(struct libusb20_transfer *xfer, uint16_t fr_index);\nvoid\tlibusb20_tr_set_length(struct libusb20_transfer *xfer, uint32_t length, uint16_t fr_index);\nvoid\tlibusb20_tr_set_priv_sc0(struct libusb20_transfer *xfer, void *sc0);\nvoid\tlibusb20_tr_set_priv_sc1(struct libusb20_transfer *xfer, void *sc1);\nvoid\tlibusb20_tr_set_timeout(struct libusb20_transfer *xfer, uint32_t timeout);\nvoid\tlibusb20_tr_set_total_frames(struct libusb20_transfer *xfer, uint32_t nFrames);\nvoid\tlibusb20_tr_setup_bulk(struct libusb20_transfer *xfer, void *pbuf, uint32_t length, uint32_t timeout);\nvoid\tlibusb20_tr_setup_control(struct libusb20_transfer *xfer, void *psetup, void *pbuf, uint32_t timeout);\nvoid\tlibusb20_tr_setup_intr(struct libusb20_transfer *xfer, void *pbuf, uint32_t length, uint32_t timeout);\nvoid\tlibusb20_tr_setup_isoc(struct libusb20_transfer *xfer, void *pbuf, uint32_t length, uint16_t fr_index);\nuint8_t\tlibusb20_tr_bulk_intr_sync(struct libusb20_transfer *xfer, void *pbuf, uint32_t length, uint32_t *pactlen, uint32_t timeout);\nvoid\tlibusb20_tr_start(struct libusb20_transfer *xfer);\nvoid\tlibusb20_tr_stop(struct libusb20_transfer *xfer);\nvoid\tlibusb20_tr_submit(struct libusb20_transfer *xfer);\nvoid   *libusb20_tr_get_priv_sc0(struct libusb20_transfer *xfer);\nvoid   *libusb20_tr_get_priv_sc1(struct libusb20_transfer *xfer);\n\n\n/* USB device operations */\n\nconst char *libusb20_dev_get_backend_name(struct libusb20_device *pdev);\nconst char *libusb20_dev_get_desc(struct libusb20_device *pdev);\nint\tlibusb20_dev_close(struct libusb20_device *pdev);\nint\tlibusb20_dev_detach_kernel_driver(struct libusb20_device *pdev, uint8_t iface_index);\nint\tlibusb20_dev_set_config_index(struct libusb20_device *pdev, uint8_t configIndex);\nint\tlibusb20_dev_get_debug(struct libusb20_device *pdev);\nint\tlibusb20_dev_get_fd(struct libusb20_device *pdev);\nint\tlibusb20_dev_kernel_driver_active(struct libusb20_device *pdev, uint8_t iface_index);\nint\tlibusb20_dev_open(struct libusb20_device *pdev, uint16_t transfer_max);\nint\tlibusb20_dev_process(struct libusb20_device *pdev);\nint\tlibusb20_dev_request_sync(struct libusb20_device *pdev, struct LIBUSB20_CONTROL_SETUP_DECODED *setup, void *data, uint16_t *pactlen, uint32_t timeout, uint8_t flags);\nint\tlibusb20_dev_req_string_sync(struct libusb20_device *pdev, uint8_t index, uint16_t langid, void *ptr, uint16_t len);\nint\tlibusb20_dev_req_string_simple_sync(struct libusb20_device *pdev, uint8_t index, void *ptr, uint16_t len);\nint\tlibusb20_dev_reset(struct libusb20_device *pdev);\nint\tlibusb20_dev_check_connected(struct libusb20_device *pdev);\nint\tlibusb20_dev_set_power_mode(struct libusb20_device *pdev, uint8_t power_mode);\nuint8_t\tlibusb20_dev_get_power_mode(struct libusb20_device *pdev);\nint\tlibusb20_dev_set_alt_index(struct libusb20_device *pdev, uint8_t iface_index, uint8_t alt_index);\nint\tlibusb20_dev_get_info(struct libusb20_device *pdev, struct usb_device_info *pinfo);\nint\tlibusb20_dev_get_iface_desc(struct libusb20_device *pdev, uint8_t iface_index, char *buf, uint8_t len);\n\nstruct LIBUSB20_DEVICE_DESC_DECODED *libusb20_dev_get_device_desc(struct libusb20_device *pdev);\nstruct libusb20_config *libusb20_dev_alloc_config(struct libusb20_device *pdev, uint8_t config_index);\nstruct libusb20_device *libusb20_dev_alloc(void);\nuint8_t\tlibusb20_dev_get_address(struct libusb20_device *pdev);\nuint8_t\tlibusb20_dev_get_parent_address(struct libusb20_device *pdev);\nuint8_t\tlibusb20_dev_get_parent_port(struct libusb20_device *pdev);\nuint8_t\tlibusb20_dev_get_bus_number(struct libusb20_device *pdev);\nuint8_t\tlibusb20_dev_get_mode(struct libusb20_device *pdev);\nuint8_t\tlibusb20_dev_get_speed(struct libusb20_device *pdev);\nuint8_t\tlibusb20_dev_get_config_index(struct libusb20_device *pdev);\nvoid\tlibusb20_dev_free(struct libusb20_device *pdev);\nvoid\tlibusb20_dev_set_debug(struct libusb20_device *pdev, int debug);\nvoid\tlibusb20_dev_wait_process(struct libusb20_device *pdev, int timeout);\n\n/* USB global operations */\n\nint\tlibusb20_be_get_dev_quirk(struct libusb20_backend *pbe, uint16_t index, struct libusb20_quirk *pq);\nint\tlibusb20_be_get_quirk_name(struct libusb20_backend *pbe, uint16_t index, struct libusb20_quirk *pq);\nint\tlibusb20_be_add_dev_quirk(struct libusb20_backend *pbe, struct libusb20_quirk *pq);\nint\tlibusb20_be_remove_dev_quirk(struct libusb20_backend *pbe, struct libusb20_quirk *pq);\nint\tlibusb20_be_get_template(struct libusb20_backend *pbe, int *ptemp);\nint\tlibusb20_be_set_template(struct libusb20_backend *pbe, int temp);\n\n/* USB backend operations */\n\nstruct libusb20_backend *libusb20_be_alloc(const struct libusb20_backend_methods *methods);\nstruct libusb20_backend *libusb20_be_alloc_default(void);\nstruct libusb20_backend *libusb20_be_alloc_freebsd(void);\nstruct libusb20_backend *libusb20_be_alloc_linux(void);\nstruct libusb20_backend *libusb20_be_alloc_ugen20(void);\nstruct libusb20_device *libusb20_be_device_foreach(struct libusb20_backend *pbe, struct libusb20_device *pdev);\nvoid\tlibusb20_be_dequeue_device(struct libusb20_backend *pbe, struct libusb20_device *pdev);\nvoid\tlibusb20_be_enqueue_device(struct libusb20_backend *pbe, struct libusb20_device *pdev);\nvoid\tlibusb20_be_free(struct libusb20_backend *pbe);\n\n/* USB debugging */\n\nconst char *libusb20_strerror(int);\nconst char *libusb20_error_name(int);\n\n#if 0\n{\t\t\t\t\t/* style */\n#endif\n#ifdef __cplusplus\n}\n\n#endif\n\n#endif\t\t\t\t\t/* _LIBUSB20_H_ */\n"
  },
  {
    "path": "freebsd-headers/libusb20_desc.h",
    "content": "/* $FreeBSD: release/9.0.0/lib/libusb/libusb20_desc.h 185087 2008-11-19 08:56:35Z alfred $ */\n/*-\n * Copyright (c) 2008 Hans Petter Selasky. All rights reserved.\n * Copyright (c) 2007-2008 Daniel Drake.  All rights reserved.\n * Copyright (c) 2001 Johannes Erdfelt.  All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n */\n\n/*\n * NOTE: This file contains the definition of some standard USB\n * structures. All structures which name ends by *DECODED use host byte\n * order.\n */\n\n/*\n * NOTE: This file uses a lot of macros. If you want to see what the\n * macros become when they are expanded then run the following\n * commands from your shell:\n *\n * cpp libusb20_desc.h > temp.h\n * indent temp.h\n * less temp.h\n */\n\n#ifndef _LIBUSB20_DESC_H_\n#define\t_LIBUSB20_DESC_H_\n\n#ifdef __cplusplus\nextern\t\"C\" {\n#endif\n#if 0\n};\t\t\t\t\t/* style */\n\n#endif\n/* basic macros */\n\n#define\tLIBUSB20__NOT(...) __VA_ARGS__\n#define\tLIBUSB20_NOT(arg) LIBUSB20__NOT(LIBUSB20_YES arg(() LIBUSB20_NO))\n#define\tLIBUSB20_YES(...) __VA_ARGS__\n#define\tLIBUSB20_NO(...)\n#define\tLIBUSB20_END(...) __VA_ARGS__\n#define\tLIBUSB20_MAX(a,b) (((a) > (b)) ? (a) : (b))\n#define\tLIBUSB20_MIN(a,b) (((a) < (b)) ? (a) : (b))\n\n#define\tLIBUSB20_ADD_BYTES(ptr,off) \\\n  ((void *)(((const uint8_t *)(ptr)) + (off) - ((const uint8_t *)0)))\n\n/* basic message elements */\nenum {\n\tLIBUSB20_ME_INT8,\n\tLIBUSB20_ME_INT16,\n\tLIBUSB20_ME_INT32,\n\tLIBUSB20_ME_INT64,\n\tLIBUSB20_ME_STRUCT,\n\tLIBUSB20_ME_MAX,\t\t/* used to indicate end */\n};\n\n/* basic message element modifiers */\nenum {\n\tLIBUSB20_ME_IS_UNSIGNED = 0x00,\n\tLIBUSB20_ME_IS_SIGNED = 0x80,\n\tLIBUSB20_ME_MASK = 0x7F,\n};\n\nenum {\n\tLIBUSB20_ME_IS_RAW,\t\t/* structure excludes length field\n\t\t\t\t\t * (hardcoded value) */\n\tLIBUSB20_ME_IS_ENCODED,\t\t/* structure includes length field */\n\tLIBUSB20_ME_IS_EMPTY,\t\t/* no structure */\n\tLIBUSB20_ME_IS_DECODED,\t\t/* structure is recursive */\n};\n\n/* basic helper structures and macros */\n\n#define\tLIBUSB20_ME_STRUCT_ALIGN sizeof(void *)\n\nstruct libusb20_me_struct {\n\tvoid   *ptr;\t\t\t/* data pointer */\n\tuint16_t len;\t\t\t/* defaults to zero */\n\tuint16_t type;\t\t\t/* defaults to LIBUSB20_ME_IS_EMPTY */\n} __aligned(LIBUSB20_ME_STRUCT_ALIGN);\n\nstruct libusb20_me_format {\n\tconst uint8_t *format;\t\t/* always set */\n\tconst char *desc;\t\t/* optionally set */\n\tconst char *fields;\t\t/* optionally set */\n};\n\n#define\tLIBUSB20_ME_STRUCT(n, field, arg, ismeta)\t\t\\\n  ismeta ( LIBUSB20_ME_STRUCT, 1, 0, )\t\t\t\\\n  LIBUSB20_NOT(ismeta) ( struct libusb20_me_struct field; )\n\n#define\tLIBUSB20_ME_STRUCT_ARRAY(n, field, arg, ismeta)\t\\\n  ismeta ( LIBUSB20_ME_STRUCT , (arg) & 0xFF,\t\t\\\n\t   ((arg) / 0x100) & 0xFF, )\t\t\t\\\n  LIBUSB20_NOT(ismeta) ( struct libusb20_me_struct field [arg]; )\n\n#define\tLIBUSB20_ME_INTEGER(n, field, ismeta, un, u, bits, a, size)\t\\\n  ismeta ( LIBUSB20_ME_INT##bits |\t\t\t\t\t\\\n\t   LIBUSB20_ME_IS_##un##SIGNED ,\t\t\t\t\\\n\t   (size) & 0xFF, ((size) / 0x100) & 0xFF, )\t\t\\\n  LIBUSB20_NOT(ismeta) ( u##int##bits##_t\t\t\t\t\\\n\t\t    __aligned((bits) / 8) field a; )\n\n#define\tLIBUSB20_ME_UINT8_T(n, field, arg, ismeta) \\\n  LIBUSB20_ME_INTEGER(n, field, ismeta, UN, u, 8, , 1)\n\n#define\tLIBUSB20_ME_UINT8_ARRAY_T(n, field, arg, ismeta) \\\n  LIBUSB20_ME_INTEGER(n, field, ismeta, UN, u, 8, [arg], arg)\n\n#define\tLIBUSB20_ME_SINT8_T(n, field, arg, ismeta) \\\n  LIBUSB20_ME_INTEGER(n, field, ismeta,,, 8, , 1)\n\n#define\tLIBUSB20_ME_SINT8_ARRAY_T(n, field, arg, ismeta) \\\n  LIBUSB20_ME_INTEGER(n, field, ismeta,,, 8, [arg], arg)\n\n#define\tLIBUSB20_ME_UINT16_T(n, field, arg, ismeta) \\\n  LIBUSB20_ME_INTEGER(n, field, ismeta, UN, u, 16, , 1)\n\n#define\tLIBUSB20_ME_UINT16_ARRAY_T(n, field, arg, ismeta) \\\n  LIBUSB20_ME_INTEGER(n, field, ismeta, UN, u, 16, [arg], arg)\n\n#define\tLIBUSB20_ME_SINT16_T(n, field, arg, ismeta) \\\n  LIBUSB20_ME_INTEGER(n, field, ismeta,,, 16, , 1)\n\n#define\tLIBUSB20_ME_SINT16_ARRAY_T(n, field, arg, ismeta) \\\n  LIBUSB20_ME_INTEGER(n, field, ismeta,,, 16, [arg], arg)\n\n#define\tLIBUSB20_ME_UINT32_T(n, field, arg, ismeta) \\\n  LIBUSB20_ME_INTEGER(n, field, ismeta, UN, u, 32, , 1)\n\n#define\tLIBUSB20_ME_UINT32_ARRAY_T(n, field, arg, ismeta) \\\n  LIBUSB20_ME_INTEGER(n, field, ismeta, UN, u, 32, [arg], arg)\n\n#define\tLIBUSB20_ME_SINT32_T(n, field, arg, ismeta) \\\n  LIBUSB20_ME_INTEGER(n, field, ismeta,,, 32, , 1)\n\n#define\tLIBUSB20_ME_SINT32_ARRAY_T(n, field, arg, ismeta) \\\n  LIBUSB20_ME_INTEGER(n, field, ismeta,,, 32, [arg], arg)\n\n#define\tLIBUSB20_ME_UINT64_T(n, field, arg, ismeta) \\\n  LIBUSB20_ME_INTEGER(n, field, ismeta, UN, u, 64, , 1)\n\n#define\tLIBUSB20_ME_UINT64_ARRAY_T(n, field, arg, ismeta) \\\n  LIBUSB20_ME_INTEGER(n, field, ismeta, UN, u, 64, [arg], arg)\n\n#define\tLIBUSB20_ME_SINT64_T(n, field, arg, ismeta) \\\n  LIBUSB20_ME_INTEGER(n, field, ismeta,,, 64, , 1)\n\n#define\tLIBUSB20_ME_SINT64_ARRAY_T(n, field, arg, ismeta) \\\n  LIBUSB20_ME_INTEGER(n, field, ismeta,,, 64, [arg], arg)\n\n#define\tLIBUSB20_MAKE_DECODED_FIELD(n, type, field, arg) \\\n  LIBUSB20_ME_##type (n, field, arg, LIBUSB20_NO)\n\n#define\tLIBUSB20_MAKE_STRUCT(name)\t\t\t\\\n  extern const struct libusb20_me_format\t\t\t\\\n\t name##_FORMAT[1];\t\t\t\t\\\n  struct name##_DECODED {\t\t\t\t\\\n    const struct libusb20_me_format *name##_FORMAT;\t\\\n    name (LIBUSB20_MAKE_DECODED_FIELD,)\t\t\t\\\n  }\n\n#define\tLIBUSB20_MAKE_STRUCT_FORMAT(name)\t\t\\\n  const struct libusb20_me_format\t\t\t\\\n    name##_FORMAT[1] = {{\t\t\t\\\n      .format = LIBUSB20_MAKE_FORMAT(name),\t\\\n      .desc = #name,\t\t\t\t\\\n      .fields = NULL,\t\t\t\t\\\n  }}\n\n#define\tLIBUSB20_MAKE_FORMAT_SUB(n, type, field, arg) \\\n  LIBUSB20_ME_##type (n, field, arg, LIBUSB20_YES)\n\n#define\tLIBUSB20_MAKE_FORMAT(what) (const uint8_t []) \\\n  { what (LIBUSB20_MAKE_FORMAT_SUB, ) LIBUSB20_ME_MAX, 0, 0 }\n\n#define\tLIBUSB20_INIT(what, ptr) do {\t\t\\\n    memset(ptr, 0, sizeof(*(ptr)));\t\t\\\n    (ptr)->what##_FORMAT = what##_FORMAT;\t\\\n} while (0)\n\n#define\tLIBUSB20_DEVICE_DESC(m,n) \\\n  m(n, UINT8_T, bLength, ) \\\n  m(n, UINT8_T, bDescriptorType, ) \\\n  m(n, UINT16_T, bcdUSB, ) \\\n  m(n, UINT8_T, bDeviceClass, ) \\\n  m(n, UINT8_T, bDeviceSubClass, ) \\\n  m(n, UINT8_T, bDeviceProtocol, ) \\\n  m(n, UINT8_T, bMaxPacketSize0, ) \\\n  m(n, UINT16_T, idVendor, ) \\\n  m(n, UINT16_T, idProduct, ) \\\n  m(n, UINT16_T, bcdDevice, ) \\\n  m(n, UINT8_T, iManufacturer, ) \\\n  m(n, UINT8_T, iProduct, ) \\\n  m(n, UINT8_T, iSerialNumber, ) \\\n  m(n, UINT8_T, bNumConfigurations, ) \\\n\nLIBUSB20_MAKE_STRUCT(LIBUSB20_DEVICE_DESC);\n\n#define\tLIBUSB20_ENDPOINT_DESC(m,n) \\\n  m(n, UINT8_T,  bLength, ) \\\n  m(n, UINT8_T,  bDescriptorType, ) \\\n  m(n, UINT8_T,  bEndpointAddress, ) \\\n  m(n, UINT8_T,  bmAttributes, ) \\\n  m(n, UINT16_T, wMaxPacketSize, ) \\\n  m(n, UINT8_T,  bInterval, ) \\\n  m(n, UINT8_T,  bRefresh, ) \\\n  m(n, UINT8_T,  bSynchAddress, ) \\\n\nLIBUSB20_MAKE_STRUCT(LIBUSB20_ENDPOINT_DESC);\n\n#define\tLIBUSB20_INTERFACE_DESC(m,n) \\\n  m(n, UINT8_T,  bLength, ) \\\n  m(n, UINT8_T,  bDescriptorType, ) \\\n  m(n, UINT8_T,  bInterfaceNumber, ) \\\n  m(n, UINT8_T,  bAlternateSetting, ) \\\n  m(n, UINT8_T,  bNumEndpoints, ) \\\n  m(n, UINT8_T,  bInterfaceClass, ) \\\n  m(n, UINT8_T,  bInterfaceSubClass, ) \\\n  m(n, UINT8_T,  bInterfaceProtocol, ) \\\n  m(n, UINT8_T,  iInterface, ) \\\n\nLIBUSB20_MAKE_STRUCT(LIBUSB20_INTERFACE_DESC);\n\n#define\tLIBUSB20_CONFIG_DESC(m,n) \\\n  m(n, UINT8_T,  bLength, ) \\\n  m(n, UINT8_T,  bDescriptorType, ) \\\n  m(n, UINT16_T, wTotalLength, ) \\\n  m(n, UINT8_T,  bNumInterfaces, ) \\\n  m(n, UINT8_T,  bConfigurationValue, ) \\\n  m(n, UINT8_T,  iConfiguration, ) \\\n  m(n, UINT8_T,  bmAttributes, ) \\\n  m(n, UINT8_T,  bMaxPower, ) \\\n\nLIBUSB20_MAKE_STRUCT(LIBUSB20_CONFIG_DESC);\n\n#define\tLIBUSB20_CONTROL_SETUP(m,n) \\\n  m(n, UINT8_T,  bmRequestType, ) \\\n  m(n, UINT8_T,  bRequest, ) \\\n  m(n, UINT16_T, wValue, ) \\\n  m(n, UINT16_T, wIndex, ) \\\n  m(n, UINT16_T, wLength, ) \\\n\nLIBUSB20_MAKE_STRUCT(LIBUSB20_CONTROL_SETUP);\n\n/* standard USB stuff */\n\n/** \\ingroup desc\n * Device and/or Interface Class codes */\nenum libusb20_class_code {\n\t/** In the context of a \\ref LIBUSB20_DEVICE_DESC \"device\n\t * descriptor\", this bDeviceClass value indicates that each\n\t * interface specifies its own class information and all\n\t * interfaces operate independently.\n\t */\n\tLIBUSB20_CLASS_PER_INTERFACE = 0,\n\n\t/** Audio class */\n\tLIBUSB20_CLASS_AUDIO = 1,\n\n\t/** Communications class */\n\tLIBUSB20_CLASS_COMM = 2,\n\n\t/** Human Interface Device class */\n\tLIBUSB20_CLASS_HID = 3,\n\n\t/** Printer dclass */\n\tLIBUSB20_CLASS_PRINTER = 7,\n\n\t/** Picture transfer protocol class */\n\tLIBUSB20_CLASS_PTP = 6,\n\n\t/** Mass storage class */\n\tLIBUSB20_CLASS_MASS_STORAGE = 8,\n\n\t/** Hub class */\n\tLIBUSB20_CLASS_HUB = 9,\n\n\t/** Data class */\n\tLIBUSB20_CLASS_DATA = 10,\n\n\t/** Class is vendor-specific */\n\tLIBUSB20_CLASS_VENDOR_SPEC = 0xff,\n};\n\n/** \\ingroup desc\n * Descriptor types as defined by the USB specification. */\nenum libusb20_descriptor_type {\n\t/** Device descriptor. See LIBUSB20_DEVICE_DESC. */\n\tLIBUSB20_DT_DEVICE = 0x01,\n\n\t/** Configuration descriptor. See LIBUSB20_CONFIG_DESC. */\n\tLIBUSB20_DT_CONFIG = 0x02,\n\n\t/** String descriptor */\n\tLIBUSB20_DT_STRING = 0x03,\n\n\t/** Interface descriptor. See LIBUSB20_INTERFACE_DESC. */\n\tLIBUSB20_DT_INTERFACE = 0x04,\n\n\t/** Endpoint descriptor. See LIBUSB20_ENDPOINT_DESC. */\n\tLIBUSB20_DT_ENDPOINT = 0x05,\n\n\t/** HID descriptor */\n\tLIBUSB20_DT_HID = 0x21,\n\n\t/** HID report descriptor */\n\tLIBUSB20_DT_REPORT = 0x22,\n\n\t/** Physical descriptor */\n\tLIBUSB20_DT_PHYSICAL = 0x23,\n\n\t/** Hub descriptor */\n\tLIBUSB20_DT_HUB = 0x29,\n};\n\n/* Descriptor sizes per descriptor type */\n#define\tLIBUSB20_DT_DEVICE_SIZE\t\t\t18\n#define\tLIBUSB20_DT_CONFIG_SIZE\t\t\t9\n#define\tLIBUSB20_DT_INTERFACE_SIZE\t\t9\n#define\tLIBUSB20_DT_ENDPOINT_SIZE\t\t7\n#define\tLIBUSB20_DT_ENDPOINT_AUDIO_SIZE\t\t9\t/* Audio extension */\n#define\tLIBUSB20_DT_HUB_NONVAR_SIZE\t\t7\n\n#define\tLIBUSB20_ENDPOINT_ADDRESS_MASK\t0x0f\t/* in bEndpointAddress */\n#define\tLIBUSB20_ENDPOINT_DIR_MASK\t0x80\n\n/** \\ingroup desc\n * Endpoint direction. Values for bit 7 of the\n * \\ref LIBUSB20_ENDPOINT_DESC::bEndpointAddress \"endpoint address\" scheme.\n */\nenum libusb20_endpoint_direction {\n\t/** In: device-to-host */\n\tLIBUSB20_ENDPOINT_IN = 0x80,\n\n\t/** Out: host-to-device */\n\tLIBUSB20_ENDPOINT_OUT = 0x00,\n};\n\n#define\tLIBUSB20_TRANSFER_TYPE_MASK\t0x03\t/* in bmAttributes */\n\n/** \\ingroup desc\n * Endpoint transfer type. Values for bits 0:1 of the\n * \\ref LIBUSB20_ENDPOINT_DESC::bmAttributes \"endpoint attributes\" field.\n */\nenum libusb20_transfer_type {\n\t/** Control endpoint */\n\tLIBUSB20_TRANSFER_TYPE_CONTROL = 0,\n\n\t/** Isochronous endpoint */\n\tLIBUSB20_TRANSFER_TYPE_ISOCHRONOUS = 1,\n\n\t/** Bulk endpoint */\n\tLIBUSB20_TRANSFER_TYPE_BULK = 2,\n\n\t/** Interrupt endpoint */\n\tLIBUSB20_TRANSFER_TYPE_INTERRUPT = 3,\n};\n\n/** \\ingroup misc\n * Standard requests, as defined in table 9-3 of the USB2 specifications */\nenum libusb20_standard_request {\n\t/** Request status of the specific recipient */\n\tLIBUSB20_REQUEST_GET_STATUS = 0x00,\n\n\t/** Clear or disable a specific feature */\n\tLIBUSB20_REQUEST_CLEAR_FEATURE = 0x01,\n\n\t/* 0x02 is reserved */\n\n\t/** Set or enable a specific feature */\n\tLIBUSB20_REQUEST_SET_FEATURE = 0x03,\n\n\t/* 0x04 is reserved */\n\n\t/** Set device address for all future accesses */\n\tLIBUSB20_REQUEST_SET_ADDRESS = 0x05,\n\n\t/** Get the specified descriptor */\n\tLIBUSB20_REQUEST_GET_DESCRIPTOR = 0x06,\n\n\t/** Used to update existing descriptors or add new descriptors */\n\tLIBUSB20_REQUEST_SET_DESCRIPTOR = 0x07,\n\n\t/** Get the current device configuration value */\n\tLIBUSB20_REQUEST_GET_CONFIGURATION = 0x08,\n\n\t/** Set device configuration */\n\tLIBUSB20_REQUEST_SET_CONFIGURATION = 0x09,\n\n\t/** Return the selected alternate setting for the specified\n\t * interface */\n\tLIBUSB20_REQUEST_GET_INTERFACE = 0x0A,\n\n\t/** Select an alternate interface for the specified interface */\n\tLIBUSB20_REQUEST_SET_INTERFACE = 0x0B,\n\n\t/** Set then report an endpoint's synchronization frame */\n\tLIBUSB20_REQUEST_SYNCH_FRAME = 0x0C,\n};\n\n/** \\ingroup misc\n * Request type bits of the\n * \\ref libusb20_control_setup::bmRequestType \"bmRequestType\" field in\n * control transfers. */\nenum libusb20_request_type {\n\t/** Standard */\n\tLIBUSB20_REQUEST_TYPE_STANDARD = (0x00 << 5),\n\n\t/** Class */\n\tLIBUSB20_REQUEST_TYPE_CLASS = (0x01 << 5),\n\n\t/** Vendor */\n\tLIBUSB20_REQUEST_TYPE_VENDOR = (0x02 << 5),\n\n\t/** Reserved */\n\tLIBUSB20_REQUEST_TYPE_RESERVED = (0x03 << 5),\n};\n\n/** \\ingroup misc\n * Recipient bits of the\n * \\ref libusb20_control_setup::bmRequestType \"bmRequestType\" field in\n * control transfers. Values 4 through 31 are reserved. */\nenum libusb20_request_recipient {\n\t/** Device */\n\tLIBUSB20_RECIPIENT_DEVICE = 0x00,\n\n\t/** Interface */\n\tLIBUSB20_RECIPIENT_INTERFACE = 0x01,\n\n\t/** Endpoint */\n\tLIBUSB20_RECIPIENT_ENDPOINT = 0x02,\n\n\t/** Other */\n\tLIBUSB20_RECIPIENT_OTHER = 0x03,\n};\n\n#define\tLIBUSB20_ISO_SYNC_TYPE_MASK\t\t0x0C\n\n/** \\ingroup desc\n * Synchronization type for isochronous endpoints. Values for bits 2:3\n * of the \\ref LIBUSB20_ENDPOINT_DESC::bmAttributes \"bmAttributes\"\n * field in LIBUSB20_ENDPOINT_DESC.\n */\nenum libusb20_iso_sync_type {\n\t/** No synchronization */\n\tLIBUSB20_ISO_SYNC_TYPE_NONE = 0,\n\n\t/** Asynchronous */\n\tLIBUSB20_ISO_SYNC_TYPE_ASYNC = 1,\n\n\t/** Adaptive */\n\tLIBUSB20_ISO_SYNC_TYPE_ADAPTIVE = 2,\n\n\t/** Synchronous */\n\tLIBUSB20_ISO_SYNC_TYPE_SYNC = 3,\n};\n\n#define\tLIBUSB20_ISO_USAGE_TYPE_MASK 0x30\n\n/** \\ingroup desc\n * Usage type for isochronous endpoints. Values for bits 4:5 of the\n * \\ref LIBUSB20_ENDPOINT_DESC::bmAttributes \"bmAttributes\" field in\n * LIBUSB20_ENDPOINT_DESC.\n */\nenum libusb20_iso_usage_type {\n\t/** Data endpoint */\n\tLIBUSB20_ISO_USAGE_TYPE_DATA = 0,\n\n\t/** Feedback endpoint */\n\tLIBUSB20_ISO_USAGE_TYPE_FEEDBACK = 1,\n\n\t/** Implicit feedback Data endpoint */\n\tLIBUSB20_ISO_USAGE_TYPE_IMPLICIT = 2,\n};\n\nstruct libusb20_endpoint {\n\tstruct LIBUSB20_ENDPOINT_DESC_DECODED desc;\n\tstruct libusb20_me_struct extra;\n} __aligned(sizeof(void *));\n\nstruct libusb20_interface {\n\tstruct LIBUSB20_INTERFACE_DESC_DECODED desc;\n\tstruct libusb20_me_struct extra;\n\tstruct libusb20_interface *altsetting;\n\tstruct libusb20_endpoint *endpoints;\n\tuint8_t\tnum_altsetting;\n\tuint8_t\tnum_endpoints;\n} __aligned(sizeof(void *));\n\nstruct libusb20_config {\n\tstruct LIBUSB20_CONFIG_DESC_DECODED desc;\n\tstruct libusb20_me_struct extra;\n\tstruct libusb20_interface *interface;\n\tuint8_t\tnum_interface;\n} __aligned(sizeof(void *));\n\nuint8_t\tlibusb20_me_get_1(const struct libusb20_me_struct *ie, uint16_t offset);\nuint16_t libusb20_me_get_2(const struct libusb20_me_struct *ie, uint16_t offset);\nuint16_t libusb20_me_encode(void *ptr, uint16_t len, const void *pd);\nuint16_t libusb20_me_decode(const void *ptr, uint16_t len, void *pd);\nconst uint8_t *libusb20_desc_foreach(const struct libusb20_me_struct *pdesc, const uint8_t *psubdesc);\nstruct libusb20_config *libusb20_parse_config_desc(const void *config_desc);\n\n#if 0\n{\t\t\t\t\t/* style */\n#endif\n#ifdef __cplusplus\n}\n\n#endif\n\n#endif\t\t\t\t\t/* _LIBUSB20_DESC_H_ */\n"
  },
  {
    "path": "freebsd-headers/libutil.h",
    "content": "/*\n * Copyright (c) 1996  Peter Wemm <peter@FreeBSD.org>.\n * All rights reserved.\n * Copyright (c) 2002 Networks Associates Technology, Inc.\n * All rights reserved.\n *\n * Portions of this software were developed for the FreeBSD Project by\n * ThinkSec AS and NAI Labs, the Security Research Division of Network\n * Associates, Inc.  under DARPA/SPAWAR contract N66001-01-C-8035\n * (\"CBOSS\"), as part of the DARPA CHATS research program.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, is permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. The name of the author may not be used to endorse or promote\n *    products derived from this software without specific prior written\n *    permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/lib/libutil/libutil.h 221807 2011-05-12 10:11:39Z stas $\n */\n\n#ifndef _LIBUTIL_H_\n#define\t_LIBUTIL_H_\n\n#include <sys/cdefs.h>\n#include <sys/_types.h>\n#include <sys/_stdint.h>\n\n#ifndef _GID_T_DECLARED\ntypedef\t__gid_t\t\tgid_t;\n#define\t_GID_T_DECLARED\n#endif\n\n#ifndef _PID_T_DECLARED\ntypedef\t__pid_t\t\tpid_t;\n#define\t_PID_T_DECLARED\n#endif\n\n#ifndef _SIZE_T_DECLARED\ntypedef\t__size_t\tsize_t;\n#define\t_SIZE_T_DECLARED\n#endif\n\n#ifndef _UID_T_DECLARED\ntypedef\t__uid_t\t\tuid_t;\n#define\t_UID_T_DECLARED\n#endif\n\n#define PROPERTY_MAX_NAME\t64\n#define PROPERTY_MAX_VALUE\t512\n\n/* for properties.c */\ntypedef struct _property {\n\tstruct _property *next;\n\tchar *name;\n\tchar *value;\n} *properties;\n\n#ifdef _SYS_PARAM_H_\n/* for pidfile.c */\nstruct pidfh {\n\tint\tpf_fd;\n\tchar\tpf_path[MAXPATHLEN + 1];\n\t__dev_t\tpf_dev;\n\tino_t\tpf_ino;\n};\n#endif\n\n/* Avoid pulling in all the include files for no need */\nstruct termios;\nstruct winsize;\nstruct in_addr;\nstruct kinfo_file;\nstruct kinfo_proc;\nstruct kinfo_vmentry;\n\n__BEGIN_DECLS\nvoid\tclean_environment(const char * const *_white,\n\t    const char * const *_more_white);\nint\textattr_namespace_to_string(int _attrnamespace, char **_string);\nint\textattr_string_to_namespace(const char *_string, int *_attrnamespace);\nint\tflopen(const char *_path, int _flags, ...);\nvoid\thexdump(const void *ptr, int length, const char *hdr, int flags);\nint\tlogin_tty(int _fd);\nvoid\ttrimdomain(char *_fullhost, int _hostsize);\nint\topenpty(int *_amaster, int *_aslave, char *_name,\n\t\t     struct termios *_termp, struct winsize *_winp);\nint\tforkpty(int *_amaster, char *_name,\n\t\t     struct termios *_termp, struct winsize *_winp);\nint\thumanize_number(char *_buf, size_t _len, int64_t _number,\n\t    const char *_suffix, int _scale, int _flags);\nint\texpand_number(const char *_buf, uint64_t *_num);\nconst char *uu_lockerr(int _uu_lockresult);\nint\tuu_lock(const char *_ttyname);\nint\tuu_unlock(const char *_ttyname);\nint\tuu_lock_txfr(const char *_ttyname, pid_t _pid);\nint\t_secure_path(const char *_path, uid_t _uid, gid_t _gid);\nproperties properties_read(int fd);\nvoid\tproperties_free(properties list);\nchar\t*property_find(properties list, const char *name);\nchar\t*auth_getval(const char *name);\nint\trealhostname(char *host, size_t hsize, const struct in_addr *ip);\nstruct sockaddr;\nint\trealhostname_sa(char *host, size_t hsize, struct sockaddr *addr,\n\t\t\t     int addrlen);\n\nint\tkld_isloaded(const char *name);\nint\tkld_load(const char *name);\nstruct kinfo_file *\n\tkinfo_getfile(pid_t _pid, int *_cntp);\nstruct kinfo_vmentry *\n\tkinfo_getvmmap(pid_t _pid, int *_cntp);\nstruct kinfo_proc *\n\tkinfo_getallproc(int *_cntp);\nstruct kinfo_proc *\n\tkinfo_getproc(pid_t _pid);\n\n#ifdef _STDIO_H_\t/* avoid adding new includes */\nchar   *fparseln(FILE *, size_t *, size_t *, const char[3], int);\n#endif\n\n#ifdef _PWD_H_\nint\tpw_copy(int _ffd, int _tfd, const struct passwd *_pw, struct passwd *_old_pw);\nstruct passwd *pw_dup(const struct passwd *_pw);\nint\tpw_edit(int _notsetuid);\nint\tpw_equal(const struct passwd *_pw1, const struct passwd *_pw2);\nvoid\tpw_fini(void);\nint\tpw_init(const char *_dir, const char *_master);\nchar\t*pw_make(const struct passwd *_pw);\nint\tpw_mkdb(const char *_user);\nint\tpw_lock(void);\nstruct passwd *pw_scan(const char *_line, int _flags);\nconst char *pw_tempname(void);\nint\tpw_tmp(int _mfd);\n#endif\n\n#ifdef _GRP_H_\nint\tgr_equal(const struct group *gr1, const struct group *gr2);\nchar\t*gr_make(const struct group *gr);\nstruct group *gr_dup(const struct group *gr);\nstruct group *gr_scan(const char *line);\n#endif\n\n#ifdef _SYS_PARAM_H_\nstruct pidfh *pidfile_open(const char *path, mode_t mode, pid_t *pidptr);\nint pidfile_write(struct pidfh *pfh);\nint pidfile_close(struct pidfh *pfh);\nint pidfile_remove(struct pidfh *pfh);\n#endif\n\n#ifdef _UFS_UFS_QUOTA_H_\nstruct quotafile;\nstruct fstab;\nstruct quotafile *quota_open(struct fstab *, int, int);\nvoid quota_close(struct quotafile *);\nint quota_on(struct quotafile *);\nint quota_off(struct quotafile *);\nconst char *quota_fsname(const struct quotafile *);\nconst char *quota_qfname(const struct quotafile *);\nint quota_maxid(struct quotafile *);\nint quota_check_path(const struct quotafile *, const char *path);\nint quota_read(struct quotafile *, struct dqblk *, int);\nint quota_write_limits(struct quotafile *, struct dqblk *, int);\nint quota_write_usage(struct quotafile *, struct dqblk *, int);\nint quota_convert(struct quotafile *, int);\n#endif\n\n__END_DECLS\n\n#define UU_LOCK_INUSE (1)\n#define UU_LOCK_OK (0)\n#define UU_LOCK_OPEN_ERR (-1)\n#define UU_LOCK_READ_ERR (-2)\n#define UU_LOCK_CREAT_ERR (-3)\n#define UU_LOCK_WRITE_ERR (-4)\n#define UU_LOCK_LINK_ERR (-5)\n#define UU_LOCK_TRY_ERR (-6)\n#define UU_LOCK_OWNER_ERR (-7)\n\n/* return values from realhostname() */\n#define HOSTNAME_FOUND\t\t(0)\n#define HOSTNAME_INCORRECTNAME\t(1)\n#define HOSTNAME_INVALIDADDR\t(2)\n#define HOSTNAME_INVALIDNAME\t(3)\n\n/* fparseln(3) */\n#define\tFPARSELN_UNESCESC\t0x01\n#define\tFPARSELN_UNESCCONT\t0x02\n#define\tFPARSELN_UNESCCOMM\t0x04\n#define\tFPARSELN_UNESCREST\t0x08\n#define\tFPARSELN_UNESCALL\t0x0f\n\n/* pw_scan() */\n#define PWSCAN_MASTER\t\t0x01\n#define PWSCAN_WARN\t\t0x02\n\n/* humanize_number(3) */\n#define HN_DECIMAL\t\t0x01\n#define HN_NOSPACE\t\t0x02\n#define HN_B\t\t\t0x04\n#define HN_DIVISOR_1000\t\t0x08\n#define HN_IEC_PREFIXES\t\t0x10\n\n/* maxscale = 0x07 */\n#define HN_GETSCALE\t\t0x10\n#define HN_AUTOSCALE\t\t0x20\n\n/* hexdump(3) */\n#define\tHD_COLUMN_MASK\t\t0xff\n#define\tHD_DELIM_MASK\t\t0xff00\n#define\tHD_OMIT_COUNT\t\t(1 << 16)\n#define\tHD_OMIT_HEX\t\t(1 << 17)\n#define\tHD_OMIT_CHARS\t\t(1 << 18)\n\n#endif /* !_LIBUTIL_H_ */\n"
  },
  {
    "path": "freebsd-headers/limits.h",
    "content": "/*-\n * Copyright (c) 1988, 1993\n *\tThe Regents of the University of California.  All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t@(#)limits.h\t8.2 (Berkeley) 1/4/94\n * $FreeBSD: release/9.0.0/include/limits.h 219271 2011-03-04 19:28:27Z jilles $\n */\n\n#ifndef _LIMITS_H_\n#define\t_LIMITS_H_\n\n#include <sys/cdefs.h>\n\n#if __POSIX_VISIBLE\n#define\t_POSIX_ARG_MAX\t\t4096\n#define\t_POSIX_LINK_MAX\t\t8\n#define\t_POSIX_MAX_CANON\t255\n#define\t_POSIX_MAX_INPUT\t255\n#define\t_POSIX_NAME_MAX\t\t14\n#define\t_POSIX_PIPE_BUF\t\t512\n#define\t_POSIX_SSIZE_MAX\t32767\n#define\t_POSIX_STREAM_MAX\t8\n\n#if __POSIX_VISIBLE >= 200112\n#define\t_POSIX_CHILD_MAX\t25\n#define\t_POSIX_NGROUPS_MAX\t8\n#define\t_POSIX_OPEN_MAX\t\t20\n#define\t_POSIX_PATH_MAX\t\t256\n#define\t_POSIX_TZNAME_MAX\t6\n#else\n#define\t_POSIX_CHILD_MAX\t6\n#define\t_POSIX_NGROUPS_MAX\t0\n#define\t_POSIX_OPEN_MAX\t\t16\n#define\t_POSIX_PATH_MAX\t\t255\n#define\t_POSIX_TZNAME_MAX\t3\n#endif\n\n#define\tBC_BASE_MAX\t\t   99\t/* max ibase/obase values in bc(1) */\n#define\tBC_DIM_MAX\t\t 2048\t/* max array elements in bc(1) */\n#define\tBC_SCALE_MAX\t\t   99\t/* max scale value in bc(1) */\n#define\tBC_STRING_MAX\t\t 1000\t/* max const string length in bc(1) */\n#define\tCOLL_WEIGHTS_MAX\t    0\t/* max weights for order keyword */\n#define\tEXPR_NEST_MAX\t\t   32\t/* max expressions nested in expr(1) */\n#define\tLINE_MAX\t\t 2048\t/* max bytes in an input line */\n#define\tRE_DUP_MAX\t\t  255\t/* max RE's in interval notation */\n\n#define\t_POSIX2_BC_BASE_MAX\t99\n#define\t_POSIX2_BC_DIM_MAX\t2048\n#define\t_POSIX2_BC_SCALE_MAX\t99\n#define\t_POSIX2_BC_STRING_MAX\t1000\n#define\t_POSIX2_EQUIV_CLASS_MAX\t2\n#define\t_POSIX2_EXPR_NEST_MAX\t32\n#define\t_POSIX2_LINE_MAX\t2048\n#define\t_POSIX2_RE_DUP_MAX\t255\n#endif\n\n#if __POSIX_VISIBLE >= 199309\n#define\t_POSIX_AIO_LISTIO_MAX\t2\n#define\t_POSIX_AIO_MAX\t\t1\n#define\t_POSIX_DELAYTIMER_MAX\t32\n#define\t_POSIX_MQ_OPEN_MAX\t8\n#define\t_POSIX_MQ_PRIO_MAX\t32\n#define\t_POSIX_RTSIG_MAX\t8\n#define\t_POSIX_SEM_NSEMS_MAX\t256\n#define\t_POSIX_SEM_VALUE_MAX\t32767\n#define\t_POSIX_SIGQUEUE_MAX\t32\n#define\t_POSIX_TIMER_MAX\t32\n\n#define\t_POSIX_CLOCKRES_MIN\t20000000\n#endif\n\n#if __POSIX_VISIBLE >= 199506\n#define\t_POSIX_THREAD_DESTRUCTOR_ITERATIONS 4\n#define\t_POSIX_THREAD_KEYS_MAX\t128\n#define\t_POSIX_THREAD_THREADS_MAX 64\n#endif\n\n#if __POSIX_VISIBLE >= 200112\n#define\t_POSIX_HOST_NAME_MAX\t255\n#define\t_POSIX_LOGIN_NAME_MAX\t9\n#define\t_POSIX_SS_REPL_MAX\t4\n#define\t_POSIX_SYMLINK_MAX\t255\n#define\t_POSIX_SYMLOOP_MAX\t8\n#define\t_POSIX_TRACE_EVENT_NAME_MAX 30\n#define\t_POSIX_TRACE_NAME_MAX\t8\n#define\t_POSIX_TRACE_SYS_MAX\t8\n#define\t_POSIX_TRACE_USER_EVENT_MAX 32\n#define\t_POSIX_TTY_NAME_MAX\t9\n#define\t_POSIX2_CHARCLASS_NAME_MAX 14\n#define\t_POSIX2_COLL_WEIGHTS_MAX 2\n\n#define\t_POSIX_RE_DUP_MAX\t_POSIX2_RE_DUP_MAX\n#endif\n\n#if __XSI_VISIBLE || __POSIX_VISIBLE >= 200809\n#define\tNL_ARGMAX\t\t99\t/* max # of position args for printf */\n#define\tNL_MSGMAX\t\t32767\n#define\tNL_SETMAX\t\t255\n#define\tNL_TEXTMAX\t\t2048\n#endif\n\n#if __XSI_VISIBLE\n#define\t_XOPEN_IOV_MAX\t\t16\n#define\t_XOPEN_NAME_MAX\t\t255\n#define\t_XOPEN_PATH_MAX\t\t1024\n#define\tPASS_MAX\t\t128\t/* _PASSWORD_LEN from <pwd.h> */\n\n#define\tNL_LANGMAX\t\t31\t/* max LANG name length */\n#define\tNL_NMAX\t\t\t1\n#endif\n\n#define\tMB_LEN_MAX\t\t6\t/* 31-bit UTF-8 */\n\n#include <sys/limits.h>\n\n#if __POSIX_VISIBLE\n#include <sys/syslimits.h>\n#endif\n\n#endif /* !_LIMITS_H_ */\n"
  },
  {
    "path": "freebsd-headers/link.h",
    "content": "/*\n * Copyright (c) 1993 Paul Kranenburg\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. All advertising materials mentioning features or use of this software\n *    must display the following acknowledgement:\n *      This product includes software developed by Paul Kranenburg.\n * 4. The name of the author may not be used to endorse or promote products\n *    derived from this software without specific prior written permission\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR\n * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES\n * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,\n * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF\n * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/include/link.h 103436 2002-09-17 01:49:00Z peter $\n */\n\n#include <sys/link_elf.h>\n"
  },
  {
    "path": "freebsd-headers/locale.h",
    "content": "/*\n * Copyright (c) 1991, 1993\n *\tThe Regents of the University of California.  All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t@(#)locale.h\t8.1 (Berkeley) 6/2/93\n * $FreeBSD: release/9.0.0/include/locale.h 203964 2010-02-16 19:39:50Z imp $\n */\n\n#ifndef _LOCALE_H_\n#define _LOCALE_H_\n\n#include <sys/_null.h>\n\nstruct lconv {\n\tchar\t*decimal_point;\n\tchar\t*thousands_sep;\n\tchar\t*grouping;\n\tchar\t*int_curr_symbol;\n\tchar\t*currency_symbol;\n\tchar\t*mon_decimal_point;\n\tchar\t*mon_thousands_sep;\n\tchar\t*mon_grouping;\n\tchar\t*positive_sign;\n\tchar\t*negative_sign;\n\tchar\tint_frac_digits;\n\tchar\tfrac_digits;\n\tchar\tp_cs_precedes;\n\tchar\tp_sep_by_space;\n\tchar\tn_cs_precedes;\n\tchar\tn_sep_by_space;\n\tchar\tp_sign_posn;\n\tchar\tn_sign_posn;\n\tchar\tint_p_cs_precedes;\n\tchar\tint_n_cs_precedes;\n\tchar\tint_p_sep_by_space;\n\tchar\tint_n_sep_by_space;\n\tchar\tint_p_sign_posn;\n\tchar\tint_n_sign_posn;\n};\n\n#define\tLC_ALL\t\t0\n#define\tLC_COLLATE\t1\n#define\tLC_CTYPE\t2\n#define\tLC_MONETARY\t3\n#define\tLC_NUMERIC\t4\n#define\tLC_TIME\t\t5\n#define\tLC_MESSAGES\t6\n\n#define\t_LC_LAST\t7\t\t/* marks end */\n\n#include <sys/cdefs.h>\n\n__BEGIN_DECLS\nstruct lconv\t*localeconv(void);\nchar\t\t*setlocale(int, const char *);\n__END_DECLS\n\n#endif /* _LOCALE_H_ */\n"
  },
  {
    "path": "freebsd-headers/login_cap.h",
    "content": "/*-\n * Copyright (c) 1996 by\n * Sean Eric Fagan <sef@kithrup.com>\n * David Nugent <davidn@blaze.net.au>\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, is permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice immediately at the beginning of the file, without modification,\n *    this list of conditions, and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. This work was done expressly for inclusion into FreeBSD.  Other use\n *    is permitted provided this notation is included.\n * 4. Absolutely no warranty of function or purpose is made by the authors.\n * 5. Modifications may be freely made to this file providing the above\n *    conditions are met.\n *\n * Low-level routines relating to the user capabilities database\n *\n *\tWas login_cap.h,v 1.9 1997/05/07 20:00:01 eivind Exp\n * $FreeBSD: release/9.0.0/lib/libutil/login_cap.h 219304 2011-03-05 12:40:35Z trasz $\n */\n\n#ifndef _LOGIN_CAP_H_\n#define _LOGIN_CAP_H_\n\n#define LOGIN_DEFCLASS\t\t\"default\"\n#define LOGIN_DEFROOTCLASS\t\"root\"\n#define LOGIN_MECLASS\t\t\"me\"\n#define LOGIN_DEFSTYLE\t\t\"passwd\"\n#define LOGIN_DEFSERVICE\t\"login\"\n#define LOGIN_DEFUMASK\t\t022\n#define LOGIN_DEFPRI\t\t0\n#define _PATH_LOGIN_CONF\t\"/etc/login.conf\"\n#define _FILE_LOGIN_CONF\t\".login_conf\"\n#define _PATH_AUTHPROG\t\t\"/usr/libexec/login_\"\n\n#define LOGIN_SETGROUP\t\t0x0001\t\t/* set group */\n#define LOGIN_SETLOGIN\t\t0x0002\t\t/* set login (via setlogin) */\n#define LOGIN_SETPATH\t\t0x0004\t\t/* set path */\n#define LOGIN_SETPRIORITY\t0x0008\t\t/* set priority */\n#define LOGIN_SETRESOURCES\t0x0010\t\t/* set resources (cputime, etc.) */\n#define LOGIN_SETUMASK\t\t0x0020\t\t/* set umask, obviously */\n#define LOGIN_SETUSER\t\t0x0040\t\t/* set user (via setuid) */\n#define LOGIN_SETENV\t\t0x0080\t\t/* set user environment */\n#define LOGIN_SETMAC\t\t0x0100\t\t/* set user default MAC label */\n#define LOGIN_SETCPUMASK\t0x0200\t\t/* set user cpumask */\n#define LOGIN_SETLOGINCLASS\t0x0400\t\t/* set login class in the kernel */\n#define LOGIN_SETALL\t\t0x07ff\t\t/* set everything */\n\n#define BI_AUTH\t\t\"authorize\"\t\t/* accepted authentication */\n#define BI_REJECT\t\"reject\"\t\t/* rejected authentication */\n#define BI_CHALLENG\t\"reject challenge\"\t/* reject with a challenge */\n#define BI_SILENT\t\"reject silent\"\t\t/* reject silently */\n#define BI_REMOVE\t\"remove\"\t\t/* remove file on error */\n#define BI_ROOTOKAY\t\"authorize root\"\t/* root authenticated */\n#define BI_SECURE\t\"authorize secure\"\t/* okay on non-secure line */\n#define BI_SETENV\t\"setenv\"\t\t/* set environment variable */\n#define BI_VALUE\t\"value\"\t\t\t/* set local variable */\n\n#define AUTH_OKAY\t\t0x01\t\t/* user authenticated */\n#define AUTH_ROOTOKAY\t\t0x02\t\t/* root login okay */\n#define AUTH_SECURE\t\t0x04\t\t/* secure login */\n#define AUTH_SILENT\t\t0x08\t\t/* silent rejection */\n#define AUTH_CHALLENGE\t\t0x10\t\t/* a chellenge was given */\n\n#define AUTH_ALLOW\t\t(AUTH_OKAY | AUTH_ROOTOKAY | AUTH_SECURE)\n\ntypedef struct login_cap {\n    char    *lc_class;\n    char    *lc_cap;\n    char    *lc_style;\n} login_cap_t;\n\ntypedef struct login_time {\n    u_short     lt_start;\t/* Start time */\n    u_short     lt_end;\t\t/* End time */\n#define LTM_NONE  0x00\n#define LTM_SUN   0x01\n#define LTM_MON   0x02\n#define LTM_TUE   0x04\n#define LTM_WED   0x08\n#define LTM_THU   0x10\n#define LTM_FRI   0x20\n#define LTM_SAT   0x40\n#define LTM_ANY   0x7F\n#define LTM_WK    0x3E\n#define LTM_WD    0x41\n    u_char\t lt_dow;\t/* Days of week */\n} login_time_t;\n\n#define LC_MAXTIMES 64\n\n#include <sys/cdefs.h>\n__BEGIN_DECLS\nstruct passwd;\n\nvoid login_close(login_cap_t *);\nlogin_cap_t *login_getclassbyname(const char *, const struct passwd *);\nlogin_cap_t *login_getclass(const char *);\nlogin_cap_t *login_getpwclass(const struct passwd *);\nlogin_cap_t *login_getuserclass(const struct passwd *);\n\nconst char *login_getcapstr(login_cap_t *, const char *, const char *,\n    const char *);\nconst char **login_getcaplist(login_cap_t *, const char *, const char *);\nconst char *login_getstyle(login_cap_t *, const char *, const char *);\nrlim_t login_getcaptime(login_cap_t *, const char *, rlim_t, rlim_t);\nrlim_t login_getcapnum(login_cap_t *, const char *, rlim_t, rlim_t);\nrlim_t login_getcapsize(login_cap_t *, const char *, rlim_t, rlim_t);\nconst char *login_getpath(login_cap_t *, const char *, const char *);\nint login_getcapbool(login_cap_t *, const char *, int);\nconst char *login_setcryptfmt(login_cap_t *, const char *, const char *);\n\nint setclasscontext(const char *, unsigned int);\nvoid setclasscpumask(login_cap_t *);\nint setusercontext(login_cap_t *, const struct passwd *, uid_t, unsigned int);\nvoid setclassresources(login_cap_t *);\nvoid setclassenvironment(login_cap_t *, const struct passwd *, int);\n\n/* Most of these functions are deprecated */\nint auth_approve(login_cap_t *, const char *, const char *);\nint auth_check(const char *, const char *, const char *, const char *, int *);\nvoid auth_env(void);\nchar *auth_mkvalue(const char *);\nint auth_response(const char *, const char *, const char *, const char *, int *,\n    const char *, const char *);\nvoid auth_rmfiles(void);\nint auth_scan(int);\nint auth_script(const char *, ...);\nint auth_script_data(const char *, int, const char *, ...);\nchar *auth_valud(const char *);\nint auth_setopt(const char *, const char *);\nvoid auth_clropts(void);\n\nvoid auth_checknologin(login_cap_t *);\nint auth_cat(const char *);\n\nint auth_ttyok(login_cap_t *, const char *);\nint auth_hostok(login_cap_t *, const char *, char const *);\nint auth_timeok(login_cap_t *, time_t);\n\nstruct tm;\n\nlogin_time_t parse_lt(const char *);\nint in_lt(const login_time_t *, time_t *);\nint in_ltm(const login_time_t *, struct tm *, time_t *);\nint in_ltms(const login_time_t *, struct tm *, time_t *);\nint in_lts(const login_time_t *, time_t *);\n\n/* helper functions */\n\nint login_strinlist(const char **, char const *, int);\nint login_str2inlist(const char **, const char *, const char *, int);\nlogin_time_t * login_timelist(login_cap_t *, char const *, int *,\n    login_time_t **);\nint login_ttyok(login_cap_t *, const char *, const char *, const char *);\nint login_hostok(login_cap_t *, const char *, const char *, const char *,\n    const char *);\n\n__END_DECLS\n\n#endif /* _LOGIN_CAP_H_ */\n"
  },
  {
    "path": "freebsd-headers/lwres/context.h",
    "content": "/*\n * Copyright (C) 2004-2008  Internet Systems Consortium, Inc. (\"ISC\")\n * Copyright (C) 2000, 2001  Internet Software Consortium.\n *\n * Permission to use, copy, modify, and/or distribute this software for any\n * purpose with or without fee is hereby granted, provided that the above\n * copyright notice and this permission notice appear in all copies.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\" AND ISC DISCLAIMS ALL WARRANTIES WITH\n * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\n * AND FITNESS.  IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,\n * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\n * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE\n * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\n * PERFORMANCE OF THIS SOFTWARE.\n */\n\n/* $Id: context.h,v 1.23 2008-12-17 23:47:58 tbox Exp $ */\n\n#ifndef LWRES_CONTEXT_H\n#define LWRES_CONTEXT_H 1\n\n/*! \\file lwres/context.h */\n\n#include <stddef.h>\n\n#include <lwres/lang.h>\n#include <lwres/int.h>\n#include <lwres/result.h>\n\n/*!\n * Used to set various options such as timeout, authentication, etc\n */\ntypedef struct lwres_context lwres_context_t;\n\nLWRES_LANG_BEGINDECLS\n\ntypedef void *(*lwres_malloc_t)(void *arg, size_t length);\ntypedef void (*lwres_free_t)(void *arg, void *mem, size_t length);\n\n/*\n * XXXMLG\n *\n * Make the server reload /etc/resolv.conf periodically.\n *\n * Make the server do sortlist/searchlist.\n *\n * Client side can disable the search/sortlist processing.\n *\n * Use an array of addresses/masks and searchlist for client-side, and\n * if added to the client disable the processing on the server.\n *\n * Share /etc/resolv.conf data between contexts.\n */\n\n/*!\n * _SERVERMODE\n *\tDon't allocate and connect a socket to the server, since the\n *\tcaller _is_ a server.\n *\n * _USEIPV4, _USEIPV6\n *\tUse IPv4 and IPv6 transactions with remote servers, respectively.\n *\tFor backward compatibility, regard both flags as being set when both\n *\tare cleared.\n */\n#define LWRES_CONTEXT_SERVERMODE\t0x00000001U\n#define LWRES_CONTEXT_USEIPV4\t\t0x00000002U\n#define LWRES_CONTEXT_USEIPV6\t\t0x00000004U\n\nlwres_result_t\nlwres_context_create(lwres_context_t **contextp, void *arg,\n\t\t     lwres_malloc_t malloc_function,\n\t\t     lwres_free_t free_function,\n\t\t     unsigned int flags);\n/**<\n * Allocate a lwres context.  This is used in all lwres calls.\n *\n * Memory management can be replaced here by passing in two functions.\n * If one is non-NULL, they must both be non-NULL.  \"arg\" is passed to\n * these functions.\n *\n * Contexts are not thread safe.  Document at the top of the file.\n * XXXMLG\n *\n * If they are NULL, the standard malloc() and free() will be used.\n *\n *\\pre\tcontextp != NULL && contextp == NULL.\n *\n *\\return\tReturns 0 on success, non-zero on failure.\n */\n\nvoid\nlwres_context_destroy(lwres_context_t **contextp);\n/**<\n * Frees all memory associated with a lwres context.\n *\n *\\pre\tcontextp != NULL && contextp == NULL.\n */\n\nlwres_uint32_t\nlwres_context_nextserial(lwres_context_t *ctx);\n/**<\n * XXXMLG Document\n */\n\nvoid\nlwres_context_initserial(lwres_context_t *ctx, lwres_uint32_t serial);\n\nvoid\nlwres_context_freemem(lwres_context_t *ctx, void *mem, size_t len);\n\nvoid *\nlwres_context_allocmem(lwres_context_t *ctx, size_t len);\n\nint\nlwres_context_getsocket(lwres_context_t *ctx);\n\nlwres_result_t\nlwres_context_send(lwres_context_t *ctx,\n\t\t   void *sendbase, int sendlen);\n\nlwres_result_t\nlwres_context_recv(lwres_context_t *ctx,\n\t\t   void *recvbase, int recvlen,\n\t\t   int *recvd_len);\n\nlwres_result_t\nlwres_context_sendrecv(lwres_context_t *ctx,\n\t\t       void *sendbase, int sendlen,\n\t\t       void *recvbase, int recvlen,\n\t\t       int *recvd_len);\n\nLWRES_LANG_ENDDECLS\n\n#endif /* LWRES_CONTEXT_H */\n\n"
  },
  {
    "path": "freebsd-headers/lwres/int.h",
    "content": "/*\n * Copyright (C) 2004-2007  Internet Systems Consortium, Inc. (\"ISC\")\n * Copyright (C) 2000, 2001  Internet Software Consortium.\n *\n * Permission to use, copy, modify, and/or distribute this software for any\n * purpose with or without fee is hereby granted, provided that the above\n * copyright notice and this permission notice appear in all copies.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\" AND ISC DISCLAIMS ALL WARRANTIES WITH\n * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\n * AND FITNESS.  IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,\n * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\n * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE\n * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\n * PERFORMANCE OF THIS SOFTWARE.\n */\n\n/* $Id: int.h,v 1.14 2007-06-19 23:47:23 tbox Exp $ */\n\n#ifndef LWRES_INT_H\n#define LWRES_INT_H 1\n\n/*! \\file lwres/int.h */\n\ntypedef char\t\t\t\tlwres_int8_t;\ntypedef unsigned char\t\t\tlwres_uint8_t;\ntypedef short\t\t\t\tlwres_int16_t;\ntypedef unsigned short\t\t\tlwres_uint16_t;\ntypedef int\t\t\t\tlwres_int32_t;\ntypedef unsigned int\t\t\tlwres_uint32_t;\ntypedef long long\t\t\tlwres_int64_t;\ntypedef unsigned long long\t\tlwres_uint64_t;\n\n#endif /* LWRES_INT_H */\n"
  },
  {
    "path": "freebsd-headers/lwres/ipv6.h",
    "content": "/*\n * Copyright (C) 2004-2007  Internet Systems Consortium, Inc. (\"ISC\")\n * Copyright (C) 2000, 2001  Internet Software Consortium.\n *\n * Permission to use, copy, modify, and/or distribute this software for any\n * purpose with or without fee is hereby granted, provided that the above\n * copyright notice and this permission notice appear in all copies.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\" AND ISC DISCLAIMS ALL WARRANTIES WITH\n * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\n * AND FITNESS.  IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,\n * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\n * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE\n * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\n * PERFORMANCE OF THIS SOFTWARE.\n */\n\n/* $Id: ipv6.h,v 1.16 2007-06-19 23:47:23 tbox Exp $ */\n\n#ifndef LWRES_IPV6_H\n#define LWRES_IPV6_H 1\n\n/*****\n ***** Module Info\n *****/\n\n/*! \\file lwres/ipv6.h\n * IPv6 definitions for systems which do not support IPv6.\n */\n\n/***\n *** Imports.\n ***/\n\n#include <lwres/int.h>\n#include <lwres/platform.h>\n\n/***\n *** Types.\n ***/\n\n/*% in6_addr structure */\nstruct in6_addr {\n        union {\n\t\tlwres_uint8_t\t_S6_u8[16];\n\t\tlwres_uint16_t\t_S6_u16[8];\n\t\tlwres_uint32_t\t_S6_u32[4];\n        } _S6_un;\n};\n/*@{*/\n/*% IP v6 types */\n#define s6_addr\t\t_S6_un._S6_u8\n#define s6_addr8\t_S6_un._S6_u8\n#define s6_addr16\t_S6_un._S6_u16\n#define s6_addr32\t_S6_un._S6_u32\n/*@}*/\n\n#define IN6ADDR_ANY_INIT \t{{{ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 }}}\n#define IN6ADDR_LOOPBACK_INIT \t{{{ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1 }}}\n\nLIBLWRES_EXTERNAL_DATA extern const struct in6_addr in6addr_any;\nLIBLWRES_EXTERNAL_DATA extern const struct in6_addr in6addr_loopback;\n\n/*% used in getaddrinfo.c and getnameinfo.c */\nstruct sockaddr_in6 {\n#ifdef LWRES_PLATFORM_HAVESALEN\n\tlwres_uint8_t\t\tsin6_len;\n\tlwres_uint8_t\t\tsin6_family;\n#else\n\tlwres_uint16_t\t\tsin6_family;\n#endif\n\tlwres_uint16_t\t\tsin6_port;\n\tlwres_uint32_t\t\tsin6_flowinfo;\n\tstruct in6_addr\t\tsin6_addr;\n\tlwres_uint32_t\t\tsin6_scope_id;\n};\n\n#ifdef LWRES_PLATFORM_HAVESALEN\n#define SIN6_LEN 1\n#endif\n\n/*% in6_pktinfo structure */\nstruct in6_pktinfo {\n\tstruct in6_addr ipi6_addr;    /*%< src/dst IPv6 address */\n\tunsigned int    ipi6_ifindex; /*%< send/recv interface index */\n};\n\n/*!\n * Unspecified IPv6 address\n */\n#define IN6_IS_ADDR_UNSPECIFIED(a)      \\\n        (((a)->s6_addr32[0] == 0) &&    \\\n         ((a)->s6_addr32[1] == 0) &&    \\\n         ((a)->s6_addr32[2] == 0) &&    \\\n         ((a)->s6_addr32[3] == 0))\n\n/*\n * Loopback\n */\n#define IN6_IS_ADDR_LOOPBACK(a)         \\\n        (((a)->s6_addr32[0] == 0) &&    \\\n         ((a)->s6_addr32[1] == 0) &&    \\\n         ((a)->s6_addr32[2] == 0) &&    \\\n         ((a)->s6_addr32[3] == htonl(1)))\n\n/*\n * IPv4 compatible\n */\n#define IN6_IS_ADDR_V4COMPAT(a)         \\\n        (((a)->s6_addr32[0] == 0) &&    \\\n         ((a)->s6_addr32[1] == 0) &&    \\\n         ((a)->s6_addr32[2] == 0) &&    \\\n         ((a)->s6_addr32[3] != 0) &&    \\\n         ((a)->s6_addr32[3] != htonl(1)))\n\n/*\n * Mapped\n */\n#define IN6_IS_ADDR_V4MAPPED(a)               \\\n        (((a)->s6_addr32[0] == 0) &&          \\\n         ((a)->s6_addr32[1] == 0) &&          \\\n         ((a)->s6_addr32[2] == htonl(0x0000ffff)))\n\n#endif /* LWRES_IPV6_H */\n"
  },
  {
    "path": "freebsd-headers/lwres/lang.h",
    "content": "/*\n * Copyright (C) 2004-2007  Internet Systems Consortium, Inc. (\"ISC\")\n * Copyright (C) 2000, 2001  Internet Software Consortium.\n *\n * Permission to use, copy, modify, and/or distribute this software for any\n * purpose with or without fee is hereby granted, provided that the above\n * copyright notice and this permission notice appear in all copies.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\" AND ISC DISCLAIMS ALL WARRANTIES WITH\n * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\n * AND FITNESS.  IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,\n * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\n * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE\n * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\n * PERFORMANCE OF THIS SOFTWARE.\n */\n\n/* $Id: lang.h,v 1.13 2007-06-19 23:47:23 tbox Exp $ */\n\n#ifndef LWRES_LANG_H\n#define LWRES_LANG_H 1\n\n/*! \\file lwres/lang.h */\n\n#ifdef __cplusplus\n#define LWRES_LANG_BEGINDECLS\textern \"C\" {\n#define LWRES_LANG_ENDDECLS\t}\n#else\n#define LWRES_LANG_BEGINDECLS\n#define LWRES_LANG_ENDDECLS\n#endif\n\n#endif /* LWRES_LANG_H */\n"
  },
  {
    "path": "freebsd-headers/lwres/list.h",
    "content": "/*\n * Copyright (C) 2004-2007  Internet Systems Consortium, Inc. (\"ISC\")\n * Copyright (C) 1997-2001  Internet Software Consortium.\n *\n * Permission to use, copy, modify, and/or distribute this software for any\n * purpose with or without fee is hereby granted, provided that the above\n * copyright notice and this permission notice appear in all copies.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\" AND ISC DISCLAIMS ALL WARRANTIES WITH\n * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\n * AND FITNESS.  IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,\n * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\n * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE\n * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\n * PERFORMANCE OF THIS SOFTWARE.\n */\n\n/* $Id: list.h,v 1.14 2007-06-19 23:47:23 tbox Exp $ */\n\n#ifndef LWRES_LIST_H\n#define LWRES_LIST_H 1\n\n/*! \\file lwres/list.h */\n\n#define LWRES_LIST(type) struct { type *head, *tail; }\n#define LWRES_LIST_INIT(list) \\\n\tdo { (list).head = NULL; (list).tail = NULL; } while (0)\n\n#define LWRES_LINK(type) struct { type *prev, *next; }\n#define LWRES_LINK_INIT(elt, link) \\\n\tdo { \\\n\t\t(elt)->link.prev = (void *)(-1); \\\n\t\t(elt)->link.next = (void *)(-1); \\\n\t} while (0)\n#define LWRES_LINK_LINKED(elt, link) \\\n\t((void *)((elt)->link.prev) != (void *)(-1))\n\n#define LWRES_LIST_HEAD(list) ((list).head)\n#define LWRES_LIST_TAIL(list) ((list).tail)\n#define LWRES_LIST_EMPTY(list) LWRES_TF((list).head == NULL)\n\n#define LWRES_LIST_PREPEND(list, elt, link) \\\n\tdo { \\\n\t\tif ((list).head != NULL) \\\n\t\t\t(list).head->link.prev = (elt); \\\n\t\telse \\\n\t\t\t(list).tail = (elt); \\\n\t\t(elt)->link.prev = NULL; \\\n\t\t(elt)->link.next = (list).head; \\\n\t\t(list).head = (elt); \\\n\t} while (0)\n\n#define LWRES_LIST_APPEND(list, elt, link) \\\n\tdo { \\\n\t\tif ((list).tail != NULL) \\\n\t\t\t(list).tail->link.next = (elt); \\\n\t\telse \\\n\t\t\t(list).head = (elt); \\\n\t\t(elt)->link.prev = (list).tail; \\\n\t\t(elt)->link.next = NULL; \\\n\t\t(list).tail = (elt); \\\n\t} while (0)\n\n#define LWRES_LIST_UNLINK(list, elt, link) \\\n\tdo { \\\n\t\tif ((elt)->link.next != NULL) \\\n\t\t\t(elt)->link.next->link.prev = (elt)->link.prev; \\\n\t\telse \\\n\t\t\t(list).tail = (elt)->link.prev; \\\n\t\tif ((elt)->link.prev != NULL) \\\n\t\t\t(elt)->link.prev->link.next = (elt)->link.next; \\\n\t\telse \\\n\t\t\t(list).head = (elt)->link.next; \\\n\t\t(elt)->link.prev = (void *)(-1); \\\n\t\t(elt)->link.next = (void *)(-1); \\\n\t} while (0)\n\n#define LWRES_LIST_PREV(elt, link) ((elt)->link.prev)\n#define LWRES_LIST_NEXT(elt, link) ((elt)->link.next)\n\n#define LWRES_LIST_INSERTBEFORE(list, before, elt, link) \\\n\tdo { \\\n\t\tif ((before)->link.prev == NULL) \\\n\t\t\tLWRES_LIST_PREPEND(list, elt, link); \\\n\t\telse { \\\n\t\t\t(elt)->link.prev = (before)->link.prev; \\\n\t\t\t(before)->link.prev = (elt); \\\n\t\t\t(elt)->link.prev->link.next = (elt); \\\n\t\t\t(elt)->link.next = (before); \\\n\t\t} \\\n\t} while (0)\n\n#define LWRES_LIST_INSERTAFTER(list, after, elt, link) \\\n\tdo { \\\n\t\tif ((after)->link.next == NULL) \\\n\t\t\tLWRES_LIST_APPEND(list, elt, link); \\\n\t\telse { \\\n\t\t\t(elt)->link.next = (after)->link.next; \\\n\t\t\t(after)->link.next = (elt); \\\n\t\t\t(elt)->link.next->link.prev = (elt); \\\n\t\t\t(elt)->link.prev = (after); \\\n\t\t} \\\n\t} while (0)\n\n#define LWRES_LIST_APPENDLIST(list1, list2, link) \\\n\tdo { \\\n\t\tif (LWRES_LIST_EMPTY(list1)) \\\n\t\t\t(list1) = (list2); \\\n\t\telse if (!LWRES_LIST_EMPTY(list2)) { \\\n\t\t\t(list1).tail->link.next = (list2).head; \\\n\t\t\t(list2).head->link.prev = (list1).tail; \\\n\t\t\t(list1).tail = (list2).tail; \\\n\t\t} \\\n\t\t(list2).head = NULL; \\\n\t\t(list2).tail = NULL; \\\n\t} while (0)\n\n#define LWRES_LIST_ENQUEUE(list, elt, link) LWRES_LIST_APPEND(list, elt, link)\n#define LWRES_LIST_DEQUEUE(list, elt, link) LWRES_LIST_UNLINK(list, elt, link)\n\n#endif /* LWRES_LIST_H */\n"
  },
  {
    "path": "freebsd-headers/lwres/lwbuffer.h",
    "content": "/*\n * Copyright (C) 2004-2007  Internet Systems Consortium, Inc. (\"ISC\")\n * Copyright (C) 2000, 2001  Internet Software Consortium.\n *\n * Permission to use, copy, modify, and/or distribute this software for any\n * purpose with or without fee is hereby granted, provided that the above\n * copyright notice and this permission notice appear in all copies.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\" AND ISC DISCLAIMS ALL WARRANTIES WITH\n * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\n * AND FITNESS.  IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,\n * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\n * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE\n * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\n * PERFORMANCE OF THIS SOFTWARE.\n */\n\n/* $Id: lwbuffer.h,v 1.22 2007-06-19 23:47:23 tbox Exp $ */\n\n\n/*! \\file lwres/lwbuffer.h\n *\n * A buffer is a region of memory, together with a set of related subregions.\n * Buffers are used for parsing and I/O operations.\n *\n * The 'used region' and the 'available' region are disjoint, and their\n * union is the buffer's region.  The used region extends from the beginning\n * of the buffer region to the last used byte.  The available region\n * extends from one byte greater than the last used byte to the end of the\n * buffer's region.  The size of the used region can be changed using various\n * buffer commands.  Initially, the used region is empty.\n *\n * The used region is further subdivided into two disjoint regions: the\n * 'consumed region' and the 'remaining region'.  The union of these two\n * regions is the used region.  The consumed region extends from the beginning\n * of the used region to the byte before the 'current' offset (if any).  The\n * 'remaining' region the current pointer to the end of the used\n * region.  The size of the consumed region can be changed using various\n * buffer commands.  Initially, the consumed region is empty.\n *\n * The 'active region' is an (optional) subregion of the remaining region.\n * It extends from the current offset to an offset in the remaining region\n * that is selected with lwres_buffer_setactive().  Initially, the active\n * region is empty.  If the current offset advances beyond the chosen offset,\n * the active region will also be empty.\n *\n * \\verbatim\n *  /----- used region -----\\/-- available --\\\n *  +----------------------------------------+\n *  | consumed  | remaining |                |\n *  +----------------------------------------+\n *  a           b     c     d                e\n *\n * a == base of buffer.\n * b == current pointer.  Can be anywhere between a and d.\n * c == active pointer.  Meaningful between b and d.\n * d == used pointer.\n * e == length of buffer.\n *\n * a-e == entire (length) of buffer.\n * a-d == used region.\n * a-b == consumed region.\n * b-d == remaining region.\n * b-c == optional active region.\n * \\endverbatim\n *\n * The following invariants are maintained by all routines:\n *\n *\\verbatim\n *\tlength > 0\n *\n *\tbase is a valid pointer to length bytes of memory\n *\n *\t0 <= used <= length\n *\n *\t0 <= current <= used\n *\n *\t0 <= active <= used\n *\t(although active < current implies empty active region)\n *\\endverbatim\n *\n * \\li MP:\n *\tBuffers have no synchronization.  Clients must ensure exclusive\n *\taccess.\n *\n * \\li Reliability:\n *\tNo anticipated impact.\n *\n * \\li Resources:\n *\tMemory: 1 pointer + 6 unsigned integers per buffer.\n *\n * \\li Security:\n *\tNo anticipated impact.\n *\n * \\li Standards:\n *\tNone.\n */\n\n#ifndef LWRES_LWBUFFER_H\n#define LWRES_LWBUFFER_H 1\n\n/***\n *** Imports\n ***/\n\n#include <lwres/lang.h>\n#include <lwres/int.h>\n\nLWRES_LANG_BEGINDECLS\n\n/***\n *** Magic numbers\n ***/\n#define LWRES_BUFFER_MAGIC\t\t0x4275663fU\t/* Buf?. */\n\n#define LWRES_BUFFER_VALID(b)\t\t((b) != NULL && \\\n\t\t\t\t\t (b)->magic == LWRES_BUFFER_MAGIC)\n\n/*!\n * The following macros MUST be used only on valid buffers.  It is the\n * caller's responsibility to ensure this by using the LWRES_BUFFER_VALID\n * check above, or by calling another lwres_buffer_*() function (rather than\n * another macro.)\n */\n\n/*!\n * Get the length of the used region of buffer \"b\"\n */\n#define LWRES_BUFFER_USEDCOUNT(b)\t((b)->used)\n\n/*!\n * Get the length of the available region of buffer \"b\"\n */\n#define LWRES_BUFFER_AVAILABLECOUNT(b)\t((b)->length - (b)->used)\n\n#define LWRES_BUFFER_REMAINING(b)\t((b)->used - (b)->current)\n\n/*!\n * Note that the buffer structure is public.  This is principally so buffer\n * operations can be implemented using macros.  Applications are strongly\n * discouraged from directly manipulating the structure.\n */\n\ntypedef struct lwres_buffer lwres_buffer_t;\n/*!\n * Buffer data structure\n */\nstruct lwres_buffer {\n\tunsigned int\t\tmagic;\n\tunsigned char \t       *base;\n\t/* The following integers are byte offsets from 'base'. */\n\tunsigned int\t\tlength;\n\tunsigned int\t\tused;\n\tunsigned int \t\tcurrent;\n\tunsigned int \t\tactive;\n};\n\n/***\n *** Functions\n ***/\n\nvoid\nlwres_buffer_init(lwres_buffer_t *b, void *base, unsigned int length);\n/**<\n * Make 'b' refer to the 'length'-byte region starting at base.\n *\n * Requires:\n *\n *\t'length' > 0\n *\n *\t'base' is a pointer to a sequence of 'length' bytes.\n *\n */\n\nvoid\nlwres_buffer_invalidate(lwres_buffer_t *b);\n/**<\n * Make 'b' an invalid buffer.\n *\n * Requires:\n *\t'b' is a valid buffer.\n *\n * Ensures:\n *\tIf assertion checking is enabled, future attempts to use 'b' without\n *\tcalling lwres_buffer_init() on it will cause an assertion failure.\n */\n\nvoid\nlwres_buffer_add(lwres_buffer_t *b, unsigned int n);\n/**<\n * Increase the 'used' region of 'b' by 'n' bytes.\n *\n * Requires:\n *\n *\t'b' is a valid buffer\n *\n *\tused + n <= length\n *\n */\n\nvoid\nlwres_buffer_subtract(lwres_buffer_t *b, unsigned int n);\n/**<\n * Decrease the 'used' region of 'b' by 'n' bytes.\n *\n * Requires:\n *\n *\t'b' is a valid buffer\n *\n *\tused >= n\n *\n */\n\nvoid\nlwres_buffer_clear(lwres_buffer_t *b);\n/**<\n * Make the used region empty.\n *\n * Requires:\n *\n *\t'b' is a valid buffer\n *\n * Ensures:\n *\n *\tused = 0\n *\n */\n\n\nvoid\nlwres_buffer_first(lwres_buffer_t *b);\n/**<\n * Make the consumed region empty.\n *\n * Requires:\n *\n *\t'b' is a valid buffer\n *\n * Ensures:\n *\n *\tcurrent == 0\n *\n */\n\nvoid\nlwres_buffer_forward(lwres_buffer_t *b, unsigned int n);\n/**<\n * Increase the 'consumed' region of 'b' by 'n' bytes.\n *\n * Requires:\n *\n *\t'b' is a valid buffer\n *\n *\tcurrent + n <= used\n *\n */\n\nvoid\nlwres_buffer_back(lwres_buffer_t *b, unsigned int n);\n/**<\n * Decrease the 'consumed' region of 'b' by 'n' bytes.\n *\n * Requires:\n *\n *\t'b' is a valid buffer\n *\n *\tn <= current\n *\n */\n\nlwres_uint8_t\nlwres_buffer_getuint8(lwres_buffer_t *b);\n/**<\n * Read an unsigned 8-bit integer from 'b' and return it.\n *\n * Requires:\n *\n *\t'b' is a valid buffer.\n *\n *\tThe length of the available region of 'b' is at least 1.\n *\n * Ensures:\n *\n *\tThe current pointer in 'b' is advanced by 1.\n *\n * Returns:\n *\n *\tA 8-bit unsigned integer.\n */\n\nvoid\nlwres_buffer_putuint8(lwres_buffer_t *b, lwres_uint8_t val);\n/**<\n * Store an unsigned 8-bit integer from 'val' into 'b'.\n *\n * Requires:\n *\t'b' is a valid buffer.\n *\n *\tThe length of the unused region of 'b' is at least 1.\n *\n * Ensures:\n *\tThe used pointer in 'b' is advanced by 1.\n */\n\nlwres_uint16_t\nlwres_buffer_getuint16(lwres_buffer_t *b);\n/**<\n * Read an unsigned 16-bit integer in network byte order from 'b', convert\n * it to host byte order, and return it.\n *\n * Requires:\n *\n *\t'b' is a valid buffer.\n *\n *\tThe length of the available region of 'b' is at least 2.\n *\n * Ensures:\n *\n *\tThe current pointer in 'b' is advanced by 2.\n *\n * Returns:\n *\n *\tA 16-bit unsigned integer.\n */\n\nvoid\nlwres_buffer_putuint16(lwres_buffer_t *b, lwres_uint16_t val);\n/**<\n * Store an unsigned 16-bit integer in host byte order from 'val'\n * into 'b' in network byte order.\n *\n * Requires:\n *\t'b' is a valid buffer.\n *\n *\tThe length of the unused region of 'b' is at least 2.\n *\n * Ensures:\n *\tThe used pointer in 'b' is advanced by 2.\n */\n\nlwres_uint32_t\nlwres_buffer_getuint32(lwres_buffer_t *b);\n/**<\n * Read an unsigned 32-bit integer in network byte order from 'b', convert\n * it to host byte order, and return it.\n *\n * Requires:\n *\n *\t'b' is a valid buffer.\n *\n *\tThe length of the available region of 'b' is at least 2.\n *\n * Ensures:\n *\n *\tThe current pointer in 'b' is advanced by 2.\n *\n * Returns:\n *\n *\tA 32-bit unsigned integer.\n */\n\nvoid\nlwres_buffer_putuint32(lwres_buffer_t *b, lwres_uint32_t val);\n/**<\n * Store an unsigned 32-bit integer in host byte order from 'val'\n * into 'b' in network byte order.\n *\n * Requires:\n *\t'b' is a valid buffer.\n *\n *\tThe length of the unused region of 'b' is at least 4.\n *\n * Ensures:\n *\tThe used pointer in 'b' is advanced by 4.\n */\n\nvoid\nlwres_buffer_putmem(lwres_buffer_t *b, const unsigned char *base,\n\t\t    unsigned int length);\n/**<\n * Copy 'length' bytes of memory at 'base' into 'b'.\n *\n * Requires:\n *\t'b' is a valid buffer.\n *\n *\t'base' points to 'length' bytes of valid memory.\n *\n */\n\nvoid\nlwres_buffer_getmem(lwres_buffer_t *b, unsigned char *base,\n\t\t    unsigned int length);\n/**<\n * Copy 'length' bytes of memory from 'b' into 'base'.\n *\n * Requires:\n *\t'b' is a valid buffer.\n *\n *\t'base' points to at least 'length' bytes of valid memory.\n *\n *\t'b' have at least 'length' bytes remaining.\n */\n\nLWRES_LANG_ENDDECLS\n\n#endif /* LWRES_LWBUFFER_H */\n"
  },
  {
    "path": "freebsd-headers/lwres/lwpacket.h",
    "content": "/*\n * Copyright (C) 2004-2007  Internet Systems Consortium, Inc. (\"ISC\")\n * Copyright (C) 1999-2001  Internet Software Consortium.\n *\n * Permission to use, copy, modify, and/or distribute this software for any\n * purpose with or without fee is hereby granted, provided that the above\n * copyright notice and this permission notice appear in all copies.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\" AND ISC DISCLAIMS ALL WARRANTIES WITH\n * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\n * AND FITNESS.  IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,\n * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\n * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE\n * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\n * PERFORMANCE OF THIS SOFTWARE.\n */\n\n/* $Id: lwpacket.h,v 1.24 2007-06-19 23:47:23 tbox Exp $ */\n\n#ifndef LWRES_LWPACKET_H\n#define LWRES_LWPACKET_H 1\n\n#include <lwres/lang.h>\n#include <lwres/lwbuffer.h>\n#include <lwres/result.h>\n\n/*% lwres_lwpacket_t */\ntypedef struct lwres_lwpacket lwres_lwpacket_t;\n\n/*% lwres_lwpacket structure */\nstruct lwres_lwpacket {\n\t/*! The overall packet length, including the \n\t *  entire packet header.\n\t *  This field is filled in by the\n\t *  \\link lwres_gabn.c lwres_gabn_*()\\endlink \n\t *  and \\link lwres_gnba.c lwres_gnba_*()\\endlink calls.\n\t */\n\tlwres_uint32_t\t\tlength;\n\t/*! Specifies the header format.  Currently, \n\t *  there is only one format, #LWRES_LWPACKETVERSION_0.\n\t *  This field is filled in by the\n\t *  \\link lwres_gabn.c lwres_gabn_*()\\endlink \n\t *  and \\link lwres_gnba.c lwres_gnba_*()\\endlink calls.\n         */\n\tlwres_uint16_t\t\tversion;\n \t/*! Specifies library-defined flags for this packet, such as\n\t *  whether the packet is a request or a reply.  None of \n\t *  these are definable by the caller, but library-defined values \n\t *  can be set by the caller.  For example, one bit in this field \n\t *  indicates if the packet is a request or a response.\n\t *  This field is filled in by\n\t *  the application wits the exception of the\n\t *  #LWRES_LWPACKETFLAG_RESPONSE bit, which is set by the library\n\t *  in the\n\t *  \\link lwres_gabn.c lwres_gabn_*()\\endlink \n\t *  and \\link lwres_gnba.c lwres_gnba_*()\\endlink calls.\n         */\n\tlwres_uint16_t\t\tpktflags;\n \t/*! Set by the requestor and is returned in all replies.  \n\t *  If two packets from the same source have the same serial \n\t *  number and are from the same source, they are assumed to \n\t *  be duplicates and the latter ones may be dropped.  \n\t *  (The library does not do this by default on replies, but\n \t * does so on requests.)\n         */\n\tlwres_uint32_t\t\tserial;\n \t/*! Opcodes between 0x04000000 and 0xffffffff\n \t *  are application defined.  Opcodes between \n\t *  0x00000000 and 0x03ffffff are\n \t * reserved for library use.\n\t *  This field is filled in by the\n\t *  \\link lwres_gabn.c lwres_gabn_*()\\endlink \n\t *  and \\link lwres_gnba.c lwres_gnba_*()\\endlink calls.\n\t */\n\tlwres_uint32_t\t\topcode;\n \t/*! Only valid for results.  \n\t *  Results between 0x04000000 and 0xffffffff are application \n\t *  defined.\n \t * Results between 0x00000000 and 0x03ffffff are reserved for \n\t * library use.\n \t * (This is the same reserved range defined in <isc/resultclass.h>, \n\t * so it\n \t * would be trivial to map ISC_R_* result codes into packet result \n\t * codes when appropriate.)\n\t *  This field is filled in by the\n\t *  \\link lwres_gabn.c lwres_gabn_*()\\endlink \n\t *  and \\link lwres_gnba.c lwres_gnba_*()\\endlink calls.\n\t */\n\tlwres_uint32_t\t\tresult;\n \t/*! Set to the maximum buffer size that the receiver can\n \t *  handle on requests, and the size of the buffer needed to \n\t *  satisfy a request\n \t *  when the buffer is too large for replies.\n\t *  This field is supplied by the application.\n\t */\n\tlwres_uint32_t\t\trecvlength;\n \t/*! The packet level auth type used.\n \t *  Authtypes between 0x1000 and 0xffff are application defined.  \n\t *  Authtypes\n \t *  between 0x0000 and 0x0fff are reserved for library use.  \n\t *  This is currently\n \t *  unused and MUST be set to zero.\n\t */\n\tlwres_uint16_t\t\tauthtype;\n \t/*! The length of the authentication data.  \n\t *  See the specific\n \t * authtypes for more information on what is contained \n\t * in this field.  This is currently unused, and \n\t * MUST be set to zero.\n\t */\n\tlwres_uint16_t\t\tauthlength;\n};\n\n#define LWRES_LWPACKET_LENGTH\t\t(4 * 5 + 2 * 4) /*%< Overall length. */\n\n#define LWRES_LWPACKETFLAG_RESPONSE\t0x0001U\t/*%< If set, pkt is a response. */\n\n\n#define LWRES_LWPACKETVERSION_0\t\t0\t/*%< Header format. */\n\n/*! \\file lwres/lwpacket.h\n *\n *\n * The remainder of the packet consists of two regions, one described by\n * \"authlen\" and one of \"length - authlen - sizeof(lwres_lwpacket_t)\".\n *\n * That is:\n *\n * \\code\n *\tpkt header\n *\tauthlen bytes of auth information\n *\tdata bytes\n * \\endcode\n *\n * Currently defined opcodes:\n *\n *\\li\t#LWRES_OPCODE_NOOP.  Success is always returned, with the packet contents echoed.\n *\n *\\li\t#LWRES_OPCODE_GETADDRSBYNAME.  Return all known addresses for a given name.\n *\t\tThis may return NIS or /etc/hosts info as well as DNS\n *\t\tinformation.  Flags will be provided to indicate ip4/ip6\n *\t\taddresses are desired.\n *\n *\\li\t#LWRES_OPCODE_GETNAMEBYADDR.\tReturn the hostname for the given address.  Once\n *\t\tagain, it will return data from multiple sources.\n */\n\nLWRES_LANG_BEGINDECLS\n\n/* XXXMLG document */\nlwres_result_t\nlwres_lwpacket_renderheader(lwres_buffer_t *b, lwres_lwpacket_t *pkt);\n\nlwres_result_t\nlwres_lwpacket_parseheader(lwres_buffer_t *b, lwres_lwpacket_t *pkt);\n\nLWRES_LANG_ENDDECLS\n\n#endif /* LWRES_LWPACKET_H */\n"
  },
  {
    "path": "freebsd-headers/lwres/lwres.h",
    "content": "/*\n * Copyright (C) 2004-2007  Internet Systems Consortium, Inc. (\"ISC\")\n * Copyright (C) 2000, 2001  Internet Software Consortium.\n *\n * Permission to use, copy, modify, and/or distribute this software for any\n * purpose with or without fee is hereby granted, provided that the above\n * copyright notice and this permission notice appear in all copies.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\" AND ISC DISCLAIMS ALL WARRANTIES WITH\n * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\n * AND FITNESS.  IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,\n * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\n * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE\n * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\n * PERFORMANCE OF THIS SOFTWARE.\n */\n\n/* $Id: lwres.h,v 1.57 2007-06-19 23:47:23 tbox Exp $ */\n\n#ifndef LWRES_LWRES_H\n#define LWRES_LWRES_H 1\n\n#include <stdio.h>\n\n#include <lwres/context.h>\n#include <lwres/lang.h>\n#include <lwres/list.h>\n#include <lwres/lwpacket.h>\n#include <lwres/platform.h>\n\n/*! \\file lwres/lwres.h */\n\n/*!\n * Design notes:\n *\n * Each opcode has two structures and three functions which operate on each\n * structure.  For example, using the \"no operation/ping\" opcode as an\n * example:\n *\n *\t<ul><li>lwres_nooprequest_t:\n *\n *\t\tlwres_nooprequest_render() takes a lwres_nooprequest_t and\n *\t\tand renders it into wire format, storing the allocated\n *\t\tbuffer information in a passed-in buffer.  When this buffer\n *\t\tis no longer needed, it must be freed by\n *\t\tlwres_context_freemem().  All other memory used by the\n *\t\tcaller must be freed manually, including the\n *\t\tlwres_nooprequest_t passed in.<br /><br />\n *\n *\t\tlwres_nooprequest_parse() takes a wire format message and\n *\t\tbreaks it out into a lwres_nooprequest_t.  The structure\n *\t\tmust be freed via lwres_nooprequest_free() when it is no longer\n *\t\tneeded.<br /><br />\n *\n *\t\tlwres_nooprequest_free() releases into the lwres_context_t\n *\t\tany space allocated during parsing.</li>\n *\n *\t<li>lwres_noopresponse_t:\n *\n *\t\tThe functions used are similar to the three used for\n *\t\trequests, just with different names.</li></ul>\n *\n * Typically, the client will use request_render, response_parse, and\n * response_free, while the daemon will use request_parse, response_render,\n * and request_free.\n *\n * The basic flow of a typical client is:\n *\n *\t\\li fill in a request_t, and call the render function.\n *\n *\t\\li Transmit the buffer returned to the daemon.\n *\n *\t\\li Wait for a response.\n *\n *\t\\li When a response is received, parse it into a response_t.\n *\n *\t\\li free the request buffer using lwres_context_freemem().\n *\n *\t\\li free the response structure and its associated buffer using\n *\tresponse_free().\n */\n\n#define LWRES_UDP_PORT\t\t921\t/*%< UDP Port Number */\n#define LWRES_RECVLENGTH\t16384 /*%< Maximum Packet Length */\n#define LWRES_ADDR_MAXLEN\t16\t/*%< changing this breaks ABI */\n#define LWRES_RESOLV_CONF\t\"/etc/resolv.conf\" /*%< Location of resolv.conf */\n\n/*% DNSSEC is not required (input).  Only relevant to rrset queries. */\n#define LWRES_FLAG_TRUSTNOTREQUIRED\t0x00000001U\n/*% The data was crypto-verified with DNSSEC (output). */\n#define LWRES_FLAG_SECUREDATA\t\t0x00000002U\n\n/*% no-op */\n#define LWRES_OPCODE_NOOP\t\t0x00000000U\n\n/*% lwres_nooprequest_t */\ntypedef struct {\n\t/* public */\n\tlwres_uint16_t\t\t\tdatalength;\n\tunsigned char\t\t       *data;\n} lwres_nooprequest_t;\n\n/*% lwres_noopresponse_t */\ntypedef struct {\n\t/* public */\n\tlwres_uint16_t\t\t\tdatalength;\n\tunsigned char\t\t       *data;\n} lwres_noopresponse_t;\n\n/*% get addresses by name */\n#define LWRES_OPCODE_GETADDRSBYNAME\t0x00010001U\n\n/*% lwres_addr_t */\ntypedef struct lwres_addr lwres_addr_t;\n\n/*% LWRES_LIST */\ntypedef LWRES_LIST(lwres_addr_t) lwres_addrlist_t;\n\n/*% lwres_addr */\nstruct lwres_addr {\n\tlwres_uint32_t\t\t\tfamily;\n\tlwres_uint16_t\t\t\tlength;\n\tunsigned char\t\t\taddress[LWRES_ADDR_MAXLEN];\n\tLWRES_LINK(lwres_addr_t)\tlink;\n};\n\n/*% lwres_gabnrequest_t */\ntypedef struct {\n\t/* public */\n\tlwres_uint32_t\t\t\tflags;\n\tlwres_uint32_t\t\t\taddrtypes;\n\tlwres_uint16_t\t\t\tnamelen;\n\tchar\t\t\t       *name;\n} lwres_gabnrequest_t;\n\n/*% lwres_gabnresponse_t */\ntypedef struct {\n\t/* public */\n\tlwres_uint32_t\t\t\tflags;\n\tlwres_uint16_t\t\t\tnaliases;\n\tlwres_uint16_t\t\t\tnaddrs;\n\tchar\t\t\t       *realname;\n\tchar\t\t\t      **aliases;\n\tlwres_uint16_t\t\t\trealnamelen;\n\tlwres_uint16_t\t\t       *aliaslen;\n\tlwres_addrlist_t\t\taddrs;\n\t/*! if base != NULL, it will be freed when this structure is freed. */\n\tvoid\t\t\t       *base;\n\tsize_t\t\t\t\tbaselen;\n} lwres_gabnresponse_t;\n\n/*% get name by address */\n#define LWRES_OPCODE_GETNAMEBYADDR\t0x00010002U\n\n/*% lwres_gnbarequest_t */\ntypedef struct {\n\t/* public */\n\tlwres_uint32_t\t\t\tflags;\n\tlwres_addr_t\t\t\taddr;\n} lwres_gnbarequest_t;\n\n/*% lwres_gnbaresponse_t */\ntypedef struct {\n\t/* public */\n\tlwres_uint32_t\t\t\tflags;\n\tlwres_uint16_t\t\t\tnaliases;\n\tchar\t\t\t       *realname;\n\tchar\t\t\t      **aliases;\n\tlwres_uint16_t\t\t\trealnamelen;\n\tlwres_uint16_t\t\t       *aliaslen;\n\t/*! if base != NULL, it will be freed when this structure is freed. */\n\tvoid\t\t\t       *base;\n\tsize_t\t\t\t\tbaselen;\n} lwres_gnbaresponse_t;\n\n/*% get rdata by name */\n#define LWRES_OPCODE_GETRDATABYNAME\t0x00010003U\n\n/*% lwres_grbnrequest_t */\ntypedef struct {\n\t/* public */\n\tlwres_uint32_t\t\t\tflags;\n\tlwres_uint16_t\t\t\trdclass;\n\tlwres_uint16_t\t\t\trdtype;\n\tlwres_uint16_t\t\t\tnamelen;\n\tchar\t\t\t       *name;\n} lwres_grbnrequest_t;\n\n/*% lwres_grbnresponse_t */\ntypedef struct {\n\t/* public */\n\tlwres_uint32_t\t\t\tflags;\n\tlwres_uint16_t\t\t\trdclass;\n\tlwres_uint16_t\t\t\trdtype;\n\tlwres_uint32_t\t\t\tttl;\n\tlwres_uint16_t\t\t\tnrdatas;\n\tlwres_uint16_t\t\t\tnsigs;\n\tchar\t\t\t       *realname;\n\tlwres_uint16_t\t\t\trealnamelen;\n\tunsigned char\t\t      **rdatas;\n\tlwres_uint16_t\t\t       *rdatalen;\n\tunsigned char\t\t      **sigs;\n\tlwres_uint16_t\t\t       *siglen;\n\t/*% if base != NULL, it will be freed when this structure is freed. */\n\tvoid\t\t\t       *base;\n\tsize_t\t\t\t\tbaselen;\n} lwres_grbnresponse_t;\n\n/*% Used by lwres_getrrsetbyname() */\n#define LWRDATA_VALIDATED\t0x00000001\n\n/*!\n * resolv.conf data\n */\n\n#define LWRES_CONFMAXNAMESERVERS 3\t/*%< max 3 \"nameserver\" entries */\n#define LWRES_CONFMAXLWSERVERS 1\t/*%< max 1 \"lwserver\" entry */\n#define LWRES_CONFMAXSEARCH 8\t\t/*%< max 8 domains in \"search\" entry */\n#define LWRES_CONFMAXLINELEN 256\t/*%< max size of a line */\n#define LWRES_CONFMAXSORTLIST 10\t/*%< max 10 */\n\n/*% lwres_conf_t */\ntypedef struct {\n\tlwres_context_t *lwctx;\n\tlwres_addr_t    nameservers[LWRES_CONFMAXNAMESERVERS];\n\tlwres_uint8_t\tnsnext;\t\t/*%< index for next free slot */\n\n\tlwres_addr_t\tlwservers[LWRES_CONFMAXLWSERVERS];\n\tlwres_uint8_t\tlwnext;\t\t/*%< index for next free slot */\n\n\tchar\t       *domainname;\n\n\tchar \t       *search[LWRES_CONFMAXSEARCH];\n\tlwres_uint8_t\tsearchnxt;\t/*%< index for next free slot */\n\n\tstruct {\n\t\tlwres_addr_t addr;\n\t\t/*% mask has a non-zero 'family' and 'length' if set */\n\t\tlwres_addr_t mask;\n\t} sortlist[LWRES_CONFMAXSORTLIST];\n\tlwres_uint8_t\tsortlistnxt;\n\n\tlwres_uint8_t\tresdebug;      /*%< non-zero if 'options debug' set */\n\tlwres_uint8_t\tndots;\t       /*%< set to n in 'options ndots:n' */\n\tlwres_uint8_t\tno_tld_query;  /*%< non-zero if 'options no_tld_query' */\n} lwres_conf_t;\n\n#define LWRES_ADDRTYPE_V4\t\t0x00000001U\t/*%< ipv4 */\n#define LWRES_ADDRTYPE_V6\t\t0x00000002U\t/*%< ipv6 */\n\n#define LWRES_MAX_ALIASES\t\t16\t\t/*%< max # of aliases */\n#define LWRES_MAX_ADDRS\t\t\t64\t\t/*%< max # of addrs */\n\nLWRES_LANG_BEGINDECLS\n\n/*% This is in host byte order. */\nLIBLWRES_EXTERNAL_DATA extern lwres_uint16_t lwres_udp_port;\n\nLIBLWRES_EXTERNAL_DATA extern const char *lwres_resolv_conf;\n\nlwres_result_t\nlwres_gabnrequest_render(lwres_context_t *ctx, lwres_gabnrequest_t *req,\n\t\t\t lwres_lwpacket_t *pkt, lwres_buffer_t *b);\n\nlwres_result_t\nlwres_gabnresponse_render(lwres_context_t *ctx, lwres_gabnresponse_t *req,\n\t\t\t  lwres_lwpacket_t *pkt, lwres_buffer_t *b);\n\nlwres_result_t\nlwres_gabnrequest_parse(lwres_context_t *ctx, lwres_buffer_t *b,\n\t\t\tlwres_lwpacket_t *pkt, lwres_gabnrequest_t **structp);\n\nlwres_result_t\nlwres_gabnresponse_parse(lwres_context_t *ctx, lwres_buffer_t *b,\n\t\t\t lwres_lwpacket_t *pkt,\n\t\t\t lwres_gabnresponse_t **structp);\n\nvoid\nlwres_gabnrequest_free(lwres_context_t *ctx, lwres_gabnrequest_t **structp);\n/**<\n * Frees any dynamically allocated memory for this structure.\n *\n * Requires:\n *\n *\tctx != NULL, and be a context returned via lwres_context_create().\n *\n *\tstructp != NULL && *structp != NULL.\n *\n * Ensures:\n *\n *\t*structp == NULL.\n *\n *\tAll memory allocated by this structure will be returned to the\n *\tsystem via the context's free function.\n */\n\nvoid\nlwres_gabnresponse_free(lwres_context_t *ctx, lwres_gabnresponse_t **structp);\n/**<\n * Frees any dynamically allocated memory for this structure.\n *\n * Requires:\n *\n *\tctx != NULL, and be a context returned via lwres_context_create().\n *\n *\tstructp != NULL && *structp != NULL.\n *\n * Ensures:\n *\n *\t*structp == NULL.\n *\n *\tAll memory allocated by this structure will be returned to the\n *\tsystem via the context's free function.\n */\n\n\nlwres_result_t\nlwres_gnbarequest_render(lwres_context_t *ctx, lwres_gnbarequest_t *req,\n\t\t\t lwres_lwpacket_t *pkt, lwres_buffer_t *b);\n\nlwres_result_t\nlwres_gnbaresponse_render(lwres_context_t *ctx, lwres_gnbaresponse_t *req,\n\t\t\t  lwres_lwpacket_t *pkt, lwres_buffer_t *b);\n\nlwres_result_t\nlwres_gnbarequest_parse(lwres_context_t *ctx, lwres_buffer_t *b,\n\t\t\tlwres_lwpacket_t *pkt, lwres_gnbarequest_t **structp);\n\nlwres_result_t\nlwres_gnbaresponse_parse(lwres_context_t *ctx, lwres_buffer_t *b,\n\t\t\t lwres_lwpacket_t *pkt,\n\t\t\t lwres_gnbaresponse_t **structp);\n\nvoid\nlwres_gnbarequest_free(lwres_context_t *ctx, lwres_gnbarequest_t **structp);\n/**<\n * Frees any dynamically allocated memory for this structure.\n *\n * Requires:\n *\n *\tctx != NULL, and be a context returned via lwres_context_create().\n *\n *\tstructp != NULL && *structp != NULL.\n *\n * Ensures:\n *\n *\t*structp == NULL.\n *\n *\tAll memory allocated by this structure will be returned to the\n *\tsystem via the context's free function.\n */\n\nvoid\nlwres_gnbaresponse_free(lwres_context_t *ctx, lwres_gnbaresponse_t **structp);\n/**<\n * Frees any dynamically allocated memory for this structure.\n *\n * Requires:\n *\n *\tctx != NULL, and be a context returned via lwres_context_create().\n *\n *\tstructp != NULL && *structp != NULL.\n *\n * Ensures:\n *\n *\t*structp == NULL.\n *\n *\tAll memory allocated by this structure will be returned to the\n *\tsystem via the context's free function.\n */\n\nlwres_result_t\nlwres_grbnrequest_render(lwres_context_t *ctx, lwres_grbnrequest_t *req,\n\t\t\t lwres_lwpacket_t *pkt, lwres_buffer_t *b);\n\nlwres_result_t\nlwres_grbnresponse_render(lwres_context_t *ctx, lwres_grbnresponse_t *req,\n\t\t\t  lwres_lwpacket_t *pkt, lwres_buffer_t *b);\n\nlwres_result_t\nlwres_grbnrequest_parse(lwres_context_t *ctx, lwres_buffer_t *b,\n\t\t\tlwres_lwpacket_t *pkt, lwres_grbnrequest_t **structp);\n\nlwres_result_t\nlwres_grbnresponse_parse(lwres_context_t *ctx, lwres_buffer_t *b,\n\t\t\t lwres_lwpacket_t *pkt,\n\t\t\t lwres_grbnresponse_t **structp);\n\nvoid\nlwres_grbnrequest_free(lwres_context_t *ctx, lwres_grbnrequest_t **structp);\n/**<\n * Frees any dynamically allocated memory for this structure.\n *\n * Requires:\n *\n *\tctx != NULL, and be a context returned via lwres_context_create().\n *\n *\tstructp != NULL && *structp != NULL.\n *\n * Ensures:\n *\n *\t*structp == NULL.\n *\n *\tAll memory allocated by this structure will be returned to the\n *\tsystem via the context's free function.\n */\n\nvoid\nlwres_grbnresponse_free(lwres_context_t *ctx, lwres_grbnresponse_t **structp);\n/**<\n * Frees any dynamically allocated memory for this structure.\n *\n * Requires:\n *\n *\tctx != NULL, and be a context returned via lwres_context_create().\n *\n *\tstructp != NULL && *structp != NULL.\n *\n * Ensures:\n *\n *\t*structp == NULL.\n *\n *\tAll memory allocated by this structure will be returned to the\n *\tsystem via the context's free function.\n */\n\nlwres_result_t\nlwres_nooprequest_render(lwres_context_t *ctx, lwres_nooprequest_t *req,\n\t\t\t lwres_lwpacket_t *pkt, lwres_buffer_t *b);\n/**<\n * Allocate space and render into wire format a noop request packet.\n *\n * Requires:\n *\n *\tctx != NULL, and be a context returned via lwres_context_create().\n *\n *\tb != NULL, and points to a lwres_buffer_t.  The contents of the\n *\tbuffer structure will be initialized to contain the wire-format\n *\tnoop request packet.\n *\n *\tCaller needs to fill in parts of \"pkt\" before calling:\n *\t\tserial, maxrecv, result.\n *\n * Returns:\n *\n *\tReturns 0 on success, non-zero on failure.\n *\n *\tOn successful return, *b will contain data about the wire-format\n *\tpacket.  It can be transmitted in any way, including lwres_sendblock().\n */\n\nlwres_result_t\nlwres_noopresponse_render(lwres_context_t *ctx, lwres_noopresponse_t *req,\n\t\t\t  lwres_lwpacket_t *pkt, lwres_buffer_t *b);\n\nlwres_result_t\nlwres_nooprequest_parse(lwres_context_t *ctx, lwres_buffer_t *b,\n\t\t\tlwres_lwpacket_t *pkt, lwres_nooprequest_t **structp);\n/**<\n * Parse a noop request.  Note that to get here, the lwpacket must have\n * already been parsed and removed by the caller, otherwise it would be\n * pretty hard for it to know this is the right function to call.\n *\n * The function verifies bits of the header, but does not modify it.\n */\n\nlwres_result_t\nlwres_noopresponse_parse(lwres_context_t *ctx, lwres_buffer_t *b,\n\t\t\t lwres_lwpacket_t *pkt,\n\t\t\t lwres_noopresponse_t **structp);\n\nvoid\nlwres_nooprequest_free(lwres_context_t *ctx, lwres_nooprequest_t **structp);\n\nvoid\nlwres_noopresponse_free(lwres_context_t *ctx, lwres_noopresponse_t **structp);\n\n/**<\n * Frees any dynamically allocated memory for this structure.\n *\n * Requires:\n *\n *\tctx != NULL, and be a context returned via lwres_context_create().\n *\n *\tstructp != NULL && *structp != NULL.\n *\n * Ensures:\n *\n *\t*structp == NULL.\n *\n *\tAll memory allocated by this structure will be returned to the\n *\tsystem via the context's free function.\n */\n\nlwres_result_t\nlwres_conf_parse(lwres_context_t *ctx, const char *filename);\n/**<\n * parses a resolv.conf-format file and stores the results in the structure\n * pointed to by *ctx.\n *\n * Requires:\n *\tctx != NULL\n *\tfilename != NULL && strlen(filename) > 0\n *\n * Returns:\n *\tLWRES_R_SUCCESS on a successful parse.\n *\tAnything else on error, although the structure may be partially filled\n *\tin.\n */\n\nlwres_result_t\nlwres_conf_print(lwres_context_t *ctx, FILE *fp);\n/**<\n * Prints a resolv.conf-format of confdata output to fp.\n *\n * Requires:\n *\tctx != NULL\n */\n\nvoid\nlwres_conf_init(lwres_context_t *ctx);\n/**<\n * sets all internal fields to a default state. Used to initialize a new\n * lwres_conf_t structure (not reset a used on).\n *\n * Requires:\n *\tctx != NULL\n */\n\nvoid\nlwres_conf_clear(lwres_context_t *ctx);\n/**<\n * frees all internally allocated memory in confdata. Uses the memory\n * routines supplied by ctx.\n *\n * Requires:\n *\tctx != NULL\n */\n\nlwres_conf_t *\nlwres_conf_get(lwres_context_t *ctx);\n/**<\n * Be extremely cautions in modifying the contents of this structure; it\n * needs an API to return the various bits of data, walk lists, etc.\n *\n * Requires:\n *\tctx != NULL\n */\n\n/*\n * Helper functions\n */\n\nlwres_result_t\nlwres_data_parse(lwres_buffer_t *b, unsigned char **p, lwres_uint16_t *len);\n\nlwres_result_t\nlwres_string_parse(lwres_buffer_t *b, char **c, lwres_uint16_t *len);\n\nlwres_result_t\nlwres_addr_parse(lwres_buffer_t *b, lwres_addr_t *addr);\n\nlwres_result_t\nlwres_getaddrsbyname(lwres_context_t *ctx, const char *name,\n\t\t     lwres_uint32_t addrtypes, lwres_gabnresponse_t **structp);\n\nlwres_result_t\nlwres_getnamebyaddr(lwres_context_t *ctx, lwres_uint32_t addrtype,\n\t\t    lwres_uint16_t addrlen, const unsigned char *addr,\n\t\t    lwres_gnbaresponse_t **structp);\n\nlwres_result_t\nlwres_getrdatabyname(lwres_context_t *ctx, const char *name,\n\t\t     lwres_uint16_t rdclass, lwres_uint16_t rdtype,\n\t\t     lwres_uint32_t flags, lwres_grbnresponse_t **structp);\n\nLWRES_LANG_ENDDECLS\n\n#endif /* LWRES_LWRES_H */\n"
  },
  {
    "path": "freebsd-headers/lwres/net.h",
    "content": "/*\n * Copyright (C) 2004, 2005, 2007  Internet Systems Consortium, Inc. (\"ISC\")\n * Copyright (C) 2000-2002  Internet Software Consortium.\n *\n * Permission to use, copy, modify, and/or distribute this software for any\n * purpose with or without fee is hereby granted, provided that the above\n * copyright notice and this permission notice appear in all copies.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\" AND ISC DISCLAIMS ALL WARRANTIES WITH\n * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\n * AND FITNESS.  IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,\n * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\n * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE\n * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\n * PERFORMANCE OF THIS SOFTWARE.\n */\n\n/* $Id: net.h,v 1.9 2007-06-19 23:47:23 tbox Exp $ */\n\n#ifndef LWRES_NET_H\n#define LWRES_NET_H 1\n\n/*****\n ***** Module Info\n *****/\n\n/*! \\file net.h\n * This module is responsible for defining the following basic networking\n * types:\n *\n *\\li\t\tstruct in_addr\n *\\li\t\tstruct in6_addr\n *\\li\t\tstruct sockaddr\n *\\li\t\tstruct sockaddr_in\n *\\li\t\tstruct sockaddr_in6\n *\n * It ensures that the AF_ and PF_ macros are defined.\n *\n * It declares ntoh[sl]() and hton[sl]().\n *\n * It declares lwres_net_aton(), lwres_net_ntop(), and lwres_net_pton().\n *\n * It ensures that #INADDR_LOOPBACK, #INADDR_ANY and #IN6ADDR_ANY_INIT\n * are defined.\n */\n\n/***\n *** Imports.\n ***/\n\n#include <lwres/platform.h>\t/* Required for LWRES_PLATFORM_*. */\n\n#include <unistd.h>\n#include <sys/types.h>\n#include <sys/socket.h>\t\t/* Contractual promise. */\n#include <sys/ioctl.h>\n#include <sys/time.h>\n#include <sys/un.h>\n\n#include <netinet/in.h>\t\t/* Contractual promise. */\n#include <arpa/inet.h>\t\t/* Contractual promise. */\n#ifdef LWRES_PLATFORM_NEEDNETINETIN6H\n#include <netinet/in6.h>\t/* Required on UnixWare. */\n#endif\n#ifdef LWRES_PLATFORM_NEEDNETINET6IN6H\n#include <netinet6/in6.h>\t/* Required on BSD/OS for in6_pktinfo. */\n#endif\n#include <net/if.h>\t\n\n#include <lwres/lang.h>\n\n#ifndef LWRES_PLATFORM_HAVEIPV6\n#include <lwres/ipv6.h>\t\t/* Contractual promise. */\n#endif\n\n#ifdef LWRES_PLATFORM_HAVEINADDR6\n#define in6_addr in_addr6\t/* Required for pre RFC2133 implementations. */\n#endif\n\n/*!\n * Required for some pre RFC2133 implementations.\n * IN6ADDR_ANY_INIT and IN6ADDR_LOOPBACK_INIT were added in\n * draft-ietf-ipngwg-bsd-api-04.txt or draft-ietf-ipngwg-bsd-api-05.txt.  \n * If 's6_addr' is defined then assume that there is a union and three\n * levels otherwise assume two levels required.\n */\n#ifndef IN6ADDR_ANY_INIT\n#ifdef s6_addr\n#define IN6ADDR_ANY_INIT { { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } } }\n#else\n#define IN6ADDR_ANY_INIT { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } }\n#endif\n#endif\n\n/*!\n * Initialize address loopback.  See IN6ADDR_ANY_INIT\n */\n#ifndef IN6ADDR_LOOPBACK_INIT\n#ifdef s6_addr\n#define IN6ADDR_LOOPBACK_INIT { { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1 } } }\n#else\n#define IN6ADDR_LOOPBACK_INIT { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1 } }\n#endif\n#endif\n\n/*% Used by AI_ALL */\n#ifndef AF_INET6\n#define AF_INET6 99\n#endif\n\n\n/*% Used to return IPV6 address types. */\n#ifndef PF_INET6\n#define PF_INET6 AF_INET6\n#endif\n\n/*% inaddr Loopback */\n#ifndef INADDR_LOOPBACK\n#define INADDR_LOOPBACK 0x7f000001UL\n#endif\n\nLWRES_LANG_BEGINDECLS\n\nconst char *\nlwres_net_ntop(int af, const void *src, char *dst, size_t size);\n\nint\nlwres_net_pton(int af, const char *src, void *dst);\n\nint\nlwres_net_aton(const char *cp, struct in_addr *addr);\n\nLWRES_LANG_ENDDECLS\n\n#endif /* LWRES_NET_H */\n"
  },
  {
    "path": "freebsd-headers/lwres/netdb.h",
    "content": "/* $FreeBSD: release/9.0.0/lib/bind/lwres/lwres/netdb.h 224093 2011-07-16 11:20:54Z dougb $ */\n\n/*\n * Copyright (C) 2004, 2005, 2007, 2009  Internet Systems Consortium, Inc. (\"ISC\")\n * Copyright (C) 2000, 2001  Internet Software Consortium.\n *\n * Permission to use, copy, modify, and/or distribute this software for any\n * purpose with or without fee is hereby granted, provided that the above\n * copyright notice and this permission notice appear in all copies.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\" AND ISC DISCLAIMS ALL WARRANTIES WITH\n * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\n * AND FITNESS.  IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,\n * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\n * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE\n * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\n * PERFORMANCE OF THIS SOFTWARE.\n */\n\n/* $Id: netdb.h.in,v 1.41 2009-01-18 23:48:14 tbox Exp $ */\n\n/*! \\file */\n\n#ifndef LWRES_NETDB_H\n#define LWRES_NETDB_H 1\n\n#include <stddef.h>\t/* Required on FreeBSD (and  others?) for size_t. */\n#include <netdb.h>\t/* Contractual provision. */\n\n#include <lwres/lang.h>\n\n/*\n * Define if <netdb.h> does not declare struct addrinfo.\n */\n#undef ISC_LWRES_NEEDADDRINFO\n\n#ifdef ISC_LWRES_NEEDADDRINFO\nstruct addrinfo {\n\tint\t\tai_flags;      /* AI_PASSIVE, AI_CANONNAME */\n\tint\t\tai_family;     /* PF_xxx */\n\tint\t\tai_socktype;   /* SOCK_xxx */\n\tint\t\tai_protocol;   /* 0 or IPPROTO_xxx for IPv4 and IPv6 */\n\tsize_t\t\tai_addrlen;    /* Length of ai_addr */\n\tchar\t\t*ai_canonname; /* Canonical name for hostname */\n\tstruct sockaddr\t*ai_addr;      /* Binary address */\n\tstruct addrinfo\t*ai_next;      /* Next structure in linked list */\n};\n#endif\n\n/*\n * Undefine all #defines we are interested in as <netdb.h> may or may not have\n * defined them.\n */\n\n/*\n * Error return codes from gethostbyname() and gethostbyaddr()\n * (left in extern int h_errno).\n */\n\n#undef\tNETDB_INTERNAL\n#undef\tNETDB_SUCCESS\n#undef\tHOST_NOT_FOUND\n#undef\tTRY_AGAIN\n#undef\tNO_RECOVERY\n#undef\tNO_DATA\n#undef\tNO_ADDRESS\n\n#define\tNETDB_INTERNAL\t-1\t/* see errno */\n#define\tNETDB_SUCCESS\t0\t/* no problem */\n#define\tHOST_NOT_FOUND\t1 /* Authoritative Answer Host not found */\n#define\tTRY_AGAIN\t2 /* Non-Authoritative Host not found, or SERVERFAIL */\n#define\tNO_RECOVERY\t3 /* Non recoverable errors, FORMERR, REFUSED, NOTIMP */\n#define\tNO_DATA\t\t4 /* Valid name, no data record of requested type */\n#define\tNO_ADDRESS\tNO_DATA\t\t/* no address, look for MX record */\n\n/*\n * Error return codes from getaddrinfo()\n */\n\n#undef\tEAI_ADDRFAMILY\n#undef\tEAI_AGAIN\n#undef\tEAI_BADFLAGS\n#undef\tEAI_FAIL\n#undef\tEAI_FAMILY\n#undef\tEAI_MEMORY\n#undef\tEAI_NODATA\n#undef\tEAI_NONAME\n#undef\tEAI_SERVICE\n#undef\tEAI_SOCKTYPE\n#undef\tEAI_SYSTEM\n#undef\tEAI_BADHINTS\n#undef\tEAI_PROTOCOL\n#undef\tEAI_MAX\n\n#define\tEAI_ADDRFAMILY\t 1\t/* address family for hostname not supported */\n#define\tEAI_AGAIN\t 2\t/* temporary failure in name resolution */\n#define\tEAI_BADFLAGS\t 3\t/* invalid value for ai_flags */\n#define\tEAI_FAIL\t 4\t/* non-recoverable failure in name resolution */\n#define\tEAI_FAMILY\t 5\t/* ai_family not supported */\n#define\tEAI_MEMORY\t 6\t/* memory allocation failure */\n#define\tEAI_NODATA\t 7\t/* no address associated with hostname */\n#define\tEAI_NONAME\t 8\t/* hostname nor servname provided, or not known */\n#define\tEAI_SERVICE\t 9\t/* servname not supported for ai_socktype */\n#define\tEAI_SOCKTYPE\t10\t/* ai_socktype not supported */\n#define\tEAI_SYSTEM\t11\t/* system error returned in errno */\n#define EAI_BADHINTS\t12\n#define EAI_PROTOCOL\t13\n#define EAI_MAX\t\t14\n\n/*\n * Flag values for getaddrinfo()\n */\n#undef\tAI_PASSIVE\n#undef\tAI_CANONNAME\n#undef\tAI_NUMERICHOST\n\n#define\tAI_PASSIVE\t0x00000001\n#define\tAI_CANONNAME\t0x00000002\n#define AI_NUMERICHOST\t0x00000004\n\n/*\n * Flag values for getipnodebyname()\n */\n#undef AI_V4MAPPED\n#undef AI_ALL\n#undef AI_ADDRCONFIG\n#undef AI_DEFAULT\n\n#define AI_V4MAPPED\t0x00000008\n#define AI_ALL\t\t0x00000010\n#define AI_ADDRCONFIG\t0x00000020\n#define AI_DEFAULT\t(AI_V4MAPPED|AI_ADDRCONFIG)\n\n/*\n * Constants for lwres_getnameinfo()\n */\n#undef\tNI_MAXHOST\n#undef\tNI_MAXSERV\n\n#define\tNI_MAXHOST\t1025\n#define\tNI_MAXSERV\t32\n\n/*\n * Flag values for lwres_getnameinfo()\n */\n#undef\tNI_NOFQDN\n#undef\tNI_NUMERICHOST\n#undef\tNI_NAMEREQD\n#undef\tNI_NUMERICSERV\n#undef\tNI_DGRAM\n#undef\tNI_NUMERICSCOPE\n\n#define\tNI_NOFQDN\t0x00000001\n#define\tNI_NUMERICHOST\t0x00000002\n#define\tNI_NAMEREQD\t0x00000004\n#define\tNI_NUMERICSERV\t0x00000008\n#define\tNI_DGRAM\t0x00000010\n#define\tNI_NUMERICSCOPE\t0x00000020\t/*2553bis-00*/\n\n/*\n * Define if <netdb.h> does not declare struct rrsetinfo.\n */\n#define ISC_LWRES_NEEDRRSETINFO 1\n\n#ifdef ISC_LWRES_NEEDRRSETINFO\n/*\n * Structures for getrrsetbyname()\n */\nstruct rdatainfo {\n\tunsigned int\t\trdi_length;\n\tunsigned char\t\t*rdi_data;\n};\n\nstruct rrsetinfo {\n\tunsigned int\t\trri_flags;\n\tint\t\t\trri_rdclass;\n\tint\t\t\trri_rdtype;\n\tunsigned int\t\trri_ttl;\n\tunsigned int\t\trri_nrdatas;\n\tunsigned int\t\trri_nsigs;\n\tchar\t\t\t*rri_name;\n\tstruct rdatainfo\t*rri_rdatas;\n\tstruct rdatainfo\t*rri_sigs;\n};\n\n/*\n * Flags for getrrsetbyname()\n */\n#define RRSET_VALIDATED\t\t0x00000001\n\t/* Set was dnssec validated */\n\n/*\n * Return codes for getrrsetbyname()\n */\n#define ERRSET_SUCCESS\t\t0\n#define ERRSET_NOMEMORY\t\t1\n#define ERRSET_FAIL\t\t2\n#define ERRSET_INVAL\t\t3\n#define\tERRSET_NONAME\t \t4\n#define\tERRSET_NODATA\t \t5\n#endif\n\n/*\n * Define to map into lwres_ namespace.\n */\n\n#define LWRES_NAMESPACE\n\n#ifdef LWRES_NAMESPACE\n\n/*\n * Use our versions not the ones from the C library.\n */\n\n#ifdef getnameinfo\n#undef getnameinfo\n#endif\n#define getnameinfo lwres_getnameinfo\n\n#ifdef getaddrinfo\n#undef getaddrinfo\n#endif\n#define getaddrinfo lwres_getaddrinfo\n\n#ifdef freeaddrinfo\n#undef freeaddrinfo\n#endif\n#define freeaddrinfo lwres_freeaddrinfo\n\n#ifdef gai_strerror\n#undef gai_strerror\n#endif\n#define gai_strerror lwres_gai_strerror\n\n#ifdef herror\n#undef herror\n#endif\n#define herror lwres_herror\n\n#ifdef hstrerror\n#undef hstrerror\n#endif\n#define hstrerror lwres_hstrerror\n\n#ifdef getipnodebyname\n#undef getipnodebyname\n#endif\n#define getipnodebyname lwres_getipnodebyname\n\n#ifdef getipnodebyaddr\n#undef getipnodebyaddr\n#endif\n#define getipnodebyaddr lwres_getipnodebyaddr\n\n#ifdef freehostent\n#undef freehostent\n#endif\n#define freehostent lwres_freehostent\n\n#ifdef gethostbyname\n#undef gethostbyname\n#endif\n#define gethostbyname lwres_gethostbyname\n\n#ifdef gethostbyname2\n#undef gethostbyname2\n#endif\n#define gethostbyname2 lwres_gethostbyname2\n\n#ifdef gethostbyaddr\n#undef gethostbyaddr\n#endif\n#define gethostbyaddr lwres_gethostbyaddr\n\n#ifdef gethostent\n#undef gethostent\n#endif\n#define gethostent lwres_gethostent\n\n#ifdef sethostent\n#undef sethostent\n#endif\n#define sethostent lwres_sethostent\n\n#ifdef endhostent\n#undef endhostent\n#endif\n#define endhostent lwres_endhostent\n\n/* #define sethostfile lwres_sethostfile */\n\n#ifdef gethostbyname_r\n#undef gethostbyname_r\n#endif\n#define gethostbyname_r lwres_gethostbyname_r\n\n#ifdef gethostbyaddr_r\n#undef gethostbyaddr_r\n#endif\n#define gethostbyaddr_r lwres_gethostbyaddr_r\n\n#ifdef gethostent_r\n#undef gethostent_r\n#endif\n#define gethostent_r lwres_gethostent_r\n\n#ifdef sethostent_r\n#undef sethostent_r\n#endif\n#define sethostent_r lwres_sethostent_r\n\n#ifdef endhostent_r\n#undef endhostent_r\n#endif\n#define endhostent_r lwres_endhostent_r\n\n#ifdef getrrsetbyname\n#undef getrrsetbyname\n#endif\n#define getrrsetbyname lwres_getrrsetbyname\n\n#ifdef freerrset\n#undef freerrset\n#endif\n#define freerrset lwres_freerrset\n\n#ifdef notyet\n#define getservbyname lwres_getservbyname\n#define getservbyport lwres_getservbyport\n#define getservent lwres_getservent\n#define setservent lwres_setservent\n#define endservent lwres_endservent\n\n#define getservbyname_r lwres_getservbyname_r\n#define getservbyport_r lwres_getservbyport_r\n#define getservent_r lwres_getservent_r\n#define setservent_r lwres_setservent_r\n#define endservent_r lwres_endservent_r\n\n#define getprotobyname lwres_getprotobyname\n#define getprotobynumber lwres_getprotobynumber\n#define getprotoent lwres_getprotoent\n#define setprotoent lwres_setprotoent\n#define endprotoent lwres_endprotoent\n\n#define getprotobyname_r lwres_getprotobyname_r\n#define getprotobynumber_r lwres_getprotobynumber_r\n#define getprotoent_r lwres_getprotoent_r\n#define setprotoent_r lwres_setprotoent_r\n#define endprotoent_r lwres_endprotoent_r\n\n#ifdef getnetbyname\n#undef getnetbyname\n#endif\n#define getnetbyname lwres_getnetbyname\n\n#ifdef getnetbyaddr\n#undef getnetbyaddr\n#endif\n#define getnetbyaddr lwres_getnetbyaddr\n\n#ifdef getnetent\n#undef getnetent\n#endif\n#define getnetent lwres_getnetent\n\n#ifdef setnetent\n#undef setnetent\n#endif\n#define setnetent lwres_setnetent\n\n#ifdef endnetent\n#undef endnetent\n#endif\n#define endnetent lwres_endnetent\n\n\n#ifdef getnetbyname_r\n#undef getnetbyname_r\n#endif\n#define getnetbyname_r lwres_getnetbyname_r\n\n#ifdef getnetbyaddr_r\n#undef getnetbyaddr_r\n#endif\n#define getnetbyaddr_r lwres_getnetbyaddr_r\n\n#ifdef getnetent_r\n#undef getnetent_r\n#endif\n#define getnetent_r lwres_getnetent_r\n\n#ifdef setnetent_r\n#undef setnetent_r\n#endif\n#define setnetent_r lwres_setnetent_r\n\n#ifdef endnetent_r\n#undef endnetent_r\n#endif\n#define endnetent_r lwres_endnetent_r\n#endif\t/* notyet */\n\n#ifdef h_errno\n#undef h_errno\n#endif\n#define h_errno lwres_h_errno\n\n#endif\t/* LWRES_NAMESPACE */\n\nLWRES_LANG_BEGINDECLS\n\nextern int lwres_h_errno;\n\nint\t\tlwres_getaddrinfo(const char *, const char *,\n\t\t\t\t const struct addrinfo *, struct addrinfo **);\nint\t\tlwres_getnameinfo(const struct sockaddr *, size_t, char *,\n\t\t\t\t size_t, char *, size_t, int);\nvoid\t\tlwres_freeaddrinfo(struct addrinfo *);\nchar\t\t*lwres_gai_strerror(int);\n\nstruct hostent\t*lwres_gethostbyaddr(const char *, int, int);\nstruct hostent\t*lwres_gethostbyname(const char *);\nstruct hostent\t*lwres_gethostbyname2(const char *, int);\nstruct hostent\t*lwres_gethostent(void);\nstruct hostent\t*lwres_getipnodebyname(const char *, int, int, int *);\nstruct hostent\t*lwres_getipnodebyaddr(const void *, size_t, int, int *);\nvoid\t\tlwres_endhostent(void);\nvoid\t\tlwres_sethostent(int);\n/* void\t\tlwres_sethostfile(const char *); */\nvoid\t\tlwres_freehostent(struct hostent *);\n\nint\t\tlwres_getrrsetbyname(const char *, unsigned int, unsigned int,\n\t\t\t\t     unsigned int, struct rrsetinfo **);\nvoid\t\tlwres_freerrset(struct rrsetinfo *);\n\n#ifdef notyet\nstruct netent\t*lwres_getnetbyaddr(unsigned long, int);\nstruct netent\t*lwres_getnetbyname(const char *);\nstruct netent\t*lwres_getnetent(void);\nvoid\t\tlwres_endnetent(void);\nvoid\t\tlwres_setnetent(int);\n\nstruct protoent\t*lwres_getprotobyname(const char *);\nstruct protoent\t*lwres_getprotobynumber(int);\nstruct protoent\t*lwres_getprotoent(void);\nvoid\t\tlwres_endprotoent(void);\nvoid\t\tlwres_setprotoent(int);\n\nstruct servent\t*lwres_getservbyname(const char *, const char *);\nstruct servent\t*lwres_getservbyport(int, const char *);\nstruct servent\t*lwres_getservent(void);\nvoid\t\tlwres_endservent(void);\nvoid\t\tlwres_setservent(int);\n#endif /* notyet */\n\nvoid\t\tlwres_herror(const char *);\nconst char\t*lwres_hstrerror(int);\n\n\nstruct hostent\t*lwres_gethostbyaddr_r(const char *, int, int, struct hostent *,\n\t\t\t\t\tchar *, int, int *);\nstruct hostent\t*lwres_gethostbyname_r(const char *, struct hostent *,\n\t\t\t\t\tchar *, int, int *);\nstruct hostent\t*lwres_gethostent_r(struct hostent *, char *, int, int *);\nvoid\t\tlwres_sethostent_r(int);\nvoid\t\tlwres_endhostent_r(void);\n\n#ifdef notyet\nstruct netent\t*lwres_getnetbyname_r(const char *, struct netent *,\n\t\t\t\t\tchar *, int);\nstruct netent\t*lwres_getnetbyaddr_r(long, int, struct netent *,\n\t\t\t\t\tchar *, int);\nstruct netent\t*lwres_getnetent_r(struct netent *, char *, int);\nvoid\t\tlwres_setnetent_r(int);\nvoid\t\tlwres_endnetent_r(void);\n\nstruct protoent\t*lwres_getprotobyname_r(const char *,\n\t\t\t\tstruct protoent *, char *, int);\nstruct protoent\t*lwres_getprotobynumber_r(int,\n\t\t\t\tstruct protoent *, char *, int);\nstruct protoent\t*lwres_getprotoent_r(struct protoent *, char *, int);\nvoid\t\tlwres_setprotoent_r(int);\nvoid\t\tlwres_endprotoent_r(void);\n\nstruct servent\t*lwres_getservbyname_r(const char *name, const char *,\n\t\t\t\t\tstruct servent *, char *, int);\nstruct servent\t*lwres_getservbyport_r(int port, const char *,\n\t\t\t\t\tstruct servent *, char *, int);\nstruct servent\t*lwres_getservent_r(struct servent *, char *, int);\nvoid\t\tlwres_setservent_r(int);\nvoid\t\tlwres_endservent_r(void);\n#endif\t/* notyet */\n\nLWRES_LANG_ENDDECLS\n\n#ifdef notyet\n/* This is nec'y to make this include file properly replace the sun version. */\n#ifdef sun\n#ifdef __GNU_LIBRARY__\n#include <rpc/netdb.h>\t\t/* Required. */\n#else /* !__GNU_LIBRARY__ */\nstruct rpcent {\n\tchar\t*r_name;\t/* name of server for this rpc program */\n\tchar\t**r_aliases;\t/* alias list */\n\tint\tr_number;\t/* rpc program number */\n};\nstruct rpcent\t*lwres_getrpcbyname();\nstruct rpcent\t*lwres_getrpcbynumber(),\nstruct rpcent\t*lwres_getrpcent();\n#endif /* __GNU_LIBRARY__ */\n#endif /* sun */\n#endif /* notyet */\n\n/*\n * Tell Emacs to use C mode on this file.\n * Local variables:\n * mode: c\n * End:\n */\n\n#endif /* LWRES_NETDB_H */\n"
  },
  {
    "path": "freebsd-headers/lwres/platform.h",
    "content": "/* $FreeBSD: release/9.0.0/lib/bind/lwres/lwres/platform.h 224093 2011-07-16 11:20:54Z dougb $ */\n\n/*\n * Copyright (C) 2004, 2005, 2007  Internet Systems Consortium, Inc. (\"ISC\")\n * Copyright (C) 2000, 2001  Internet Software Consortium.\n *\n * Permission to use, copy, modify, and/or distribute this software for any\n * purpose with or without fee is hereby granted, provided that the above\n * copyright notice and this permission notice appear in all copies.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\" AND ISC DISCLAIMS ALL WARRANTIES WITH\n * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\n * AND FITNESS.  IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,\n * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\n * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE\n * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\n * PERFORMANCE OF THIS SOFTWARE.\n */\n\n/* $Id: platform.h.in,v 1.21 2007-06-19 23:47:23 tbox Exp $ */\n\n/*! \\file */\n\n#ifndef LWRES_PLATFORM_H\n#define LWRES_PLATFORM_H 1\n\n/*****\n ***** Platform-dependent defines.\n *****/\n\n/***\n *** Network.\n ***/\n\n/*\n * Define if this system needs the <netinet/in6.h> header file for IPv6.\n */\n#undef LWRES_PLATFORM_NEEDNETINETIN6H\n\n/*\n * Define if this system needs the <netinet6/in6.h> header file for IPv6.\n */\n#undef LWRES_PLATFORM_NEEDNETINET6IN6H\n\n/*\n * If sockaddrs on this system have an sa_len field, LWRES_PLATFORM_HAVESALEN\n * will be defined.\n */\n#define LWRES_PLATFORM_HAVESALEN 1\n\n/*\n * If this system has the IPv6 structure definitions, LWRES_PLATFORM_HAVEIPV6\n * will be defined.\n */\n#define LWRES_PLATFORM_HAVEIPV6 1\n\n/*\n * If this system is missing in6addr_any, LWRES_PLATFORM_NEEDIN6ADDRANY will\n * be defined.\n */\n#undef LWRES_PLATFORM_NEEDIN6ADDRANY\n\n/*\n * If this system is missing in6addr_loopback, \n * LWRES_PLATFORM_NEEDIN6ADDRLOOPBACK will be defined.\n */\n#undef LWRES_PLATFORM_NEEDIN6ADDRLOOPBACK\n\n/*\n * If this system has in_addr6, rather than in6_addr,\n * LWRES_PLATFORM_HAVEINADDR6 will be defined.\n */\n#undef LWRES_PLATFORM_HAVEINADDR6\n\n/*\n * Defined if unistd.h does not cause fd_set to be delared.\n */\n#undef LWRES_PLATFORM_NEEDSYSSELECTH\n\n/*\n * Used to control how extern data is linked; needed for Win32 platforms.\n */\n#undef LWRES_PLATFORM_USEDECLSPEC\n\n/*\n * Defined this system needs vsnprintf() and snprintf().\n */\n#undef LWRES_PLATFORM_NEEDVSNPRINTF\n \n/*\n * If this system need a modern sprintf() that returns (int) not (char*).\n */\n#undef LWRES_PLATFORM_NEEDSPRINTF\n\n/*\n * The printf format string modifier to use with lwres_uint64_t values.\n */\n#define LWRES_PLATFORM_QUADFORMAT \"ll\"\n\n/*! \\brief\n * Define if this system needs strtoul.\n */\n#undef LWRES_PLATFORM_NEEDSTRTOUL\n\n#ifndef LWRES_PLATFORM_USEDECLSPEC\n#define LIBLWRES_EXTERNAL_DATA\n#else\n#ifdef LIBLWRES_EXPORTS\n#define LIBLWRES_EXTERNAL_DATA __declspec(dllexport)\n#else\n#define LIBLWRES_EXTERNAL_DATA __declspec(dllimport)\n#endif\n#endif\n\n/*\n * Tell Emacs to use C mode on this file.\n * Local Variables:\n * mode: c\n * End:\n */\n\n#endif /* LWRES_PLATFORM_H */\n"
  },
  {
    "path": "freebsd-headers/lwres/result.h",
    "content": "/*\n * Copyright (C) 2004-2007  Internet Systems Consortium, Inc. (\"ISC\")\n * Copyright (C) 2000, 2001  Internet Software Consortium.\n *\n * Permission to use, copy, modify, and/or distribute this software for any\n * purpose with or without fee is hereby granted, provided that the above\n * copyright notice and this permission notice appear in all copies.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\" AND ISC DISCLAIMS ALL WARRANTIES WITH\n * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\n * AND FITNESS.  IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,\n * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\n * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE\n * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\n * PERFORMANCE OF THIS SOFTWARE.\n */\n\n/* $Id: result.h,v 1.21 2007-06-19 23:47:23 tbox Exp $ */\n\n#ifndef LWRES_RESULT_H\n#define LWRES_RESULT_H 1\n\n/*! \\file lwres/result.h */\n\ntypedef unsigned int lwres_result_t;\n\n#define LWRES_R_SUCCESS\t\t\t0\n#define LWRES_R_NOMEMORY\t\t1\n#define LWRES_R_TIMEOUT\t\t\t2\n#define LWRES_R_NOTFOUND\t\t3\n#define LWRES_R_UNEXPECTEDEND\t\t4\t/* unexpected end of input */\n#define LWRES_R_FAILURE\t\t\t5\t/* generic failure */\n#define LWRES_R_IOERROR\t\t\t6\n#define LWRES_R_NOTIMPLEMENTED\t\t7\n#define LWRES_R_UNEXPECTED\t\t8\n#define LWRES_R_TRAILINGDATA\t\t9\n#define LWRES_R_INCOMPLETE\t\t10\n#define LWRES_R_RETRY\t\t\t11\n#define LWRES_R_TYPENOTFOUND\t\t12\n#define LWRES_R_TOOLARGE\t\t13\n\n#endif /* LWRES_RESULT_H */\n"
  },
  {
    "path": "freebsd-headers/lwres/version.h",
    "content": "/*\n * Copyright (C) 2004-2007  Internet Systems Consortium, Inc. (\"ISC\")\n * Copyright (C) 2001  Internet Software Consortium.\n *\n * Permission to use, copy, modify, and/or distribute this software for any\n * purpose with or without fee is hereby granted, provided that the above\n * copyright notice and this permission notice appear in all copies.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\" AND ISC DISCLAIMS ALL WARRANTIES WITH\n * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\n * AND FITNESS.  IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,\n * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\n * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE\n * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\n * PERFORMANCE OF THIS SOFTWARE.\n */\n\n/* $Id: version.h,v 1.9 2007-06-19 23:47:23 tbox Exp $ */\n\n/*! \\file lwres/version.h */\n\n#include <lwres/platform.h>\n\nLIBLWRES_EXTERNAL_DATA extern const char lwres_version[];\n\nLIBLWRES_EXTERNAL_DATA extern const unsigned int lwres_libinterface;\nLIBLWRES_EXTERNAL_DATA extern const unsigned int lwres_librevision;\nLIBLWRES_EXTERNAL_DATA extern const unsigned int lwres_libage;\n"
  },
  {
    "path": "freebsd-headers/lzma/base.h",
    "content": "/**\n * \\file        lzma/base.h\n * \\brief       Data types and functions used in many places in liblzma API\n */\n\n/*\n * Author: Lasse Collin\n *\n * This file has been put into the public domain.\n * You can do whatever you want with this file.\n *\n * See ../lzma.h for information about liblzma as a whole.\n */\n\n#ifndef LZMA_H_INTERNAL\n#\terror Never include this file directly. Use <lzma.h> instead.\n#endif\n\n\n/**\n * \\brief       Boolean\n *\n * This is here because C89 doesn't have stdbool.h. To set a value for\n * variables having type lzma_bool, you can use\n *   - C99's `true' and `false' from stdbool.h;\n *   - C++'s internal `true' and `false'; or\n *   - integers one (true) and zero (false).\n */\ntypedef unsigned char lzma_bool;\n\n\n/**\n * \\brief       Type of reserved enumeration variable in structures\n *\n * To avoid breaking library ABI when new features are added, several\n * structures contain extra variables that may be used in future. Since\n * sizeof(enum) can be different than sizeof(int), and sizeof(enum) may\n * even vary depending on the range of enumeration constants, we specify\n * a separate type to be used for reserved enumeration variables. All\n * enumeration constants in liblzma API will be non-negative and less\n * than 128, which should guarantee that the ABI won't break even when\n * new constants are added to existing enumerations.\n */\ntypedef enum {\n\tLZMA_RESERVED_ENUM      = 0\n} lzma_reserved_enum;\n\n\n/**\n * \\brief       Return values used by several functions in liblzma\n *\n * Check the descriptions of specific functions to find out which return\n * values they can return. With some functions the return values may have\n * more specific meanings than described here; those differences are\n * described per-function basis.\n */\ntypedef enum {\n\tLZMA_OK                 = 0,\n\t\t/**<\n\t\t * \\brief       Operation completed successfully\n\t\t */\n\n\tLZMA_STREAM_END         = 1,\n\t\t/**<\n\t\t * \\brief       End of stream was reached\n\t\t *\n\t\t * In encoder, LZMA_SYNC_FLUSH, LZMA_FULL_FLUSH, or\n\t\t * LZMA_FINISH was finished. In decoder, this indicates\n\t\t * that all the data was successfully decoded.\n\t\t *\n\t\t * In all cases, when LZMA_STREAM_END is returned, the last\n\t\t * output bytes should be picked from strm->next_out.\n\t\t */\n\n\tLZMA_NO_CHECK           = 2,\n\t\t/**<\n\t\t * \\brief       Input stream has no integrity check\n\t\t *\n\t\t * This return value can be returned only if the\n\t\t * LZMA_TELL_NO_CHECK flag was used when initializing\n\t\t * the decoder. LZMA_NO_CHECK is just a warning, and\n\t\t * the decoding can be continued normally.\n\t\t *\n\t\t * It is possible to call lzma_get_check() immediately after\n\t\t * lzma_code has returned LZMA_NO_CHECK. The result will\n\t\t * naturally be LZMA_CHECK_NONE, but the possibility to call\n\t\t * lzma_get_check() may be convenient in some applications.\n\t\t */\n\n\tLZMA_UNSUPPORTED_CHECK  = 3,\n\t\t/**<\n\t\t * \\brief       Cannot calculate the integrity check\n\t\t *\n\t\t * The usage of this return value is different in encoders\n\t\t * and decoders.\n\t\t *\n\t\t * Encoders can return this value only from the initialization\n\t\t * function. If initialization fails with this value, the\n\t\t * encoding cannot be done, because there's no way to produce\n\t\t * output with the correct integrity check.\n\t\t *\n\t\t * Decoders can return this value only from lzma_code() and\n\t\t * only if the LZMA_TELL_UNSUPPORTED_CHECK flag was used when\n\t\t * initializing the decoder. The decoding can still be\n\t\t * continued normally even if the check type is unsupported,\n\t\t * but naturally the check will not be validated, and possible\n\t\t * errors may go undetected.\n\t\t *\n\t\t * With decoder, it is possible to call lzma_get_check()\n\t\t * immediately after lzma_code() has returned\n\t\t * LZMA_UNSUPPORTED_CHECK. This way it is possible to find\n\t\t * out what the unsupported Check ID was.\n\t\t */\n\n\tLZMA_GET_CHECK          = 4,\n\t\t/**<\n\t\t * \\brief       Integrity check type is now available\n\t\t *\n\t\t * This value can be returned only by the lzma_code() function\n\t\t * and only if the decoder was initialized with the\n\t\t * LZMA_TELL_ANY_CHECK flag. LZMA_GET_CHECK tells the\n\t\t * application that it may now call lzma_get_check() to find\n\t\t * out the Check ID. This can be used, for example, to\n\t\t * implement a decoder that accepts only files that have\n\t\t * strong enough integrity check.\n\t\t */\n\n\tLZMA_MEM_ERROR          = 5,\n\t\t/**<\n\t\t * \\brief       Cannot allocate memory\n\t\t *\n\t\t * Memory allocation failed, or the size of the allocation\n\t\t * would be greater than SIZE_MAX.\n\t\t *\n\t\t * Due to internal implementation reasons, the coding cannot\n\t\t * be continued even if more memory were made available after\n\t\t * LZMA_MEM_ERROR.\n\t\t */\n\n\tLZMA_MEMLIMIT_ERROR     = 6,\n\t\t/**\n\t\t * \\brief       Memory usage limit was reached\n\t\t *\n\t\t * Decoder would need more memory than allowed by the\n\t\t * specified memory usage limit. To continue decoding,\n\t\t * the memory usage limit has to be increased with\n\t\t * lzma_memlimit_set().\n\t\t */\n\n\tLZMA_FORMAT_ERROR       = 7,\n\t\t/**<\n\t\t * \\brief       File format not recognized\n\t\t *\n\t\t * The decoder did not recognize the input as supported file\n\t\t * format. This error can occur, for example, when trying to\n\t\t * decode .lzma format file with lzma_stream_decoder,\n\t\t * because lzma_stream_decoder accepts only the .xz format.\n\t\t */\n\n\tLZMA_OPTIONS_ERROR      = 8,\n\t\t/**<\n\t\t * \\brief       Invalid or unsupported options\n\t\t *\n\t\t * Invalid or unsupported options, for example\n\t\t *  - unsupported filter(s) or filter options; or\n\t\t *  - reserved bits set in headers (decoder only).\n\t\t *\n\t\t * Rebuilding liblzma with more features enabled, or\n\t\t * upgrading to a newer version of liblzma may help.\n\t\t */\n\n\tLZMA_DATA_ERROR         = 9,\n\t\t/**<\n\t\t * \\brief       Data is corrupt\n\t\t *\n\t\t * The usage of this return value is different in encoders\n\t\t * and decoders. In both encoder and decoder, the coding\n\t\t * cannot continue after this error.\n\t\t *\n\t\t * Encoders return this if size limits of the target file\n\t\t * format would be exceeded. These limits are huge, thus\n\t\t * getting this error from an encoder is mostly theoretical.\n\t\t * For example, the maximum compressed and uncompressed\n\t\t * size of a .xz Stream is roughly 8 EiB (2^63 bytes).\n\t\t *\n\t\t * Decoders return this error if the input data is corrupt.\n\t\t * This can mean, for example, invalid CRC32 in headers\n\t\t * or invalid check of uncompressed data.\n\t\t */\n\n\tLZMA_BUF_ERROR          = 10,\n\t\t/**<\n\t\t * \\brief       No progress is possible\n\t\t *\n\t\t * This error code is returned when the coder cannot consume\n\t\t * any new input and produce any new output. The most common\n\t\t * reason for this error is that the input stream being\n\t\t * decoded is truncated or corrupt.\n\t\t *\n\t\t * This error is not fatal. Coding can be continued normally\n\t\t * by providing more input and/or more output space, if\n\t\t * possible.\n\t\t *\n\t\t * Typically the first call to lzma_code() that can do no\n\t\t * progress returns LZMA_OK instead of LZMA_BUF_ERROR. Only\n\t\t * the second consecutive call doing no progress will return\n\t\t * LZMA_BUF_ERROR. This is intentional.\n\t\t *\n\t\t * With zlib, Z_BUF_ERROR may be returned even if the\n\t\t * application is doing nothing wrong, so apps will need\n\t\t * to handle Z_BUF_ERROR specially. The above hack\n\t\t * guarantees that liblzma never returns LZMA_BUF_ERROR\n\t\t * to properly written applications unless the input file\n\t\t * is truncated or corrupt. This should simplify the\n\t\t * applications a little.\n\t\t */\n\n\tLZMA_PROG_ERROR         = 11,\n\t\t/**<\n\t\t * \\brief       Programming error\n\t\t *\n\t\t * This indicates that the arguments given to the function are\n\t\t * invalid or the internal state of the decoder is corrupt.\n\t\t *   - Function arguments are invalid or the structures\n\t\t *     pointed by the argument pointers are invalid\n\t\t *     e.g. if strm->next_out has been set to NULL and\n\t\t *     strm->avail_out > 0 when calling lzma_code().\n\t\t *   - lzma_* functions have been called in wrong order\n\t\t *     e.g. lzma_code() was called right after lzma_end().\n\t\t *   - If errors occur randomly, the reason might be flaky\n\t\t *     hardware.\n\t\t *\n\t\t * If you think that your code is correct, this error code\n\t\t * can be a sign of a bug in liblzma. See the documentation\n\t\t * how to report bugs.\n\t\t */\n} lzma_ret;\n\n\n/**\n * \\brief       The `action' argument for lzma_code()\n *\n * After the first use of LZMA_SYNC_FLUSH, LZMA_FULL_FLUSH, or LZMA_FINISH,\n * the same `action' must is used until lzma_code() returns LZMA_STREAM_END.\n * Also, the amount of input (that is, strm->avail_in) must not be modified\n * by the application until lzma_code() returns LZMA_STREAM_END. Changing the\n * `action' or modifying the amount of input will make lzma_code() return\n * LZMA_PROG_ERROR.\n */\ntypedef enum {\n\tLZMA_RUN = 0,\n\t\t/**<\n\t\t * \\brief       Continue coding\n\t\t *\n\t\t * Encoder: Encode as much input as possible. Some internal\n\t\t * buffering will probably be done (depends on the filter\n\t\t * chain in use), which causes latency: the input used won't\n\t\t * usually be decodeable from the output of the same\n\t\t * lzma_code() call.\n\t\t *\n\t\t * Decoder: Decode as much input as possible and produce as\n\t\t * much output as possible.\n\t\t */\n\n\tLZMA_SYNC_FLUSH = 1,\n\t\t/**<\n\t\t * \\brief       Make all the input available at output\n\t\t *\n\t\t * Normally the encoder introduces some latency.\n\t\t * LZMA_SYNC_FLUSH forces all the buffered data to be\n\t\t * available at output without resetting the internal\n\t\t * state of the encoder. This way it is possible to use\n\t\t * compressed stream for example for communication over\n\t\t * network.\n\t\t *\n\t\t * Only some filters support LZMA_SYNC_FLUSH. Trying to use\n\t\t * LZMA_SYNC_FLUSH with filters that don't support it will\n\t\t * make lzma_code() return LZMA_OPTIONS_ERROR. For example,\n\t\t * LZMA1 doesn't support LZMA_SYNC_FLUSH but LZMA2 does.\n\t\t *\n\t\t * Using LZMA_SYNC_FLUSH very often can dramatically reduce\n\t\t * the compression ratio. With some filters (for example,\n\t\t * LZMA2), fine-tuning the compression options may help\n\t\t * mitigate this problem significantly (for example,\n\t\t * match finder with LZMA2).\n\t\t *\n\t\t * Decoders don't support LZMA_SYNC_FLUSH.\n\t\t */\n\n\tLZMA_FULL_FLUSH = 2,\n\t\t/**<\n\t\t * \\brief       Finish encoding of the current Block\n\t\t *\n\t\t * All the input data going to the current Block must have\n\t\t * been given to the encoder (the last bytes can still be\n\t\t * pending in* next_in). Call lzma_code() with LZMA_FULL_FLUSH\n\t\t * until it returns LZMA_STREAM_END. Then continue normally\n\t\t * with LZMA_RUN or finish the Stream with LZMA_FINISH.\n\t\t *\n\t\t * This action is currently supported only by Stream encoder\n\t\t * and easy encoder (which uses Stream encoder). If there is\n\t\t * no unfinished Block, no empty Block is created.\n\t\t */\n\n\tLZMA_FINISH = 3\n\t\t/**<\n\t\t * \\brief       Finish the coding operation\n\t\t *\n\t\t * All the input data must have been given to the encoder\n\t\t * (the last bytes can still be pending in next_in).\n\t\t * Call lzma_code() with LZMA_FINISH until it returns\n\t\t * LZMA_STREAM_END. Once LZMA_FINISH has been used,\n\t\t * the amount of input must no longer be changed by\n\t\t * the application.\n\t\t *\n\t\t * When decoding, using LZMA_FINISH is optional unless the\n\t\t * LZMA_CONCATENATED flag was used when the decoder was\n\t\t * initialized. When LZMA_CONCATENATED was not used, the only\n\t\t * effect of LZMA_FINISH is that the amount of input must not\n\t\t * be changed just like in the encoder.\n\t\t */\n} lzma_action;\n\n\n/**\n * \\brief       Custom functions for memory handling\n *\n * A pointer to lzma_allocator may be passed via lzma_stream structure\n * to liblzma, and some advanced functions take a pointer to lzma_allocator\n * as a separate function argument. The library will use the functions\n * specified in lzma_allocator for memory handling instead of the default\n * malloc() and free(). C++ users should note that the custom memory\n * handling functions must not throw exceptions.\n *\n * liblzma doesn't make an internal copy of lzma_allocator. Thus, it is\n * OK to change these function pointers in the middle of the coding\n * process, but obviously it must be done carefully to make sure that the\n * replacement `free' can deallocate memory allocated by the earlier\n * `alloc' function(s).\n */\ntypedef struct {\n\t/**\n\t * \\brief       Pointer to a custom memory allocation function\n\t *\n\t * If you don't want a custom allocator, but still want\n\t * custom free(), set this to NULL and liblzma will use\n\t * the standard malloc().\n\t *\n\t * \\param       opaque  lzma_allocator.opaque (see below)\n\t * \\param       nmemb   Number of elements like in calloc(). liblzma\n\t *                      will always set nmemb to 1, so it is safe to\n\t *                      ignore nmemb in a custom allocator if you like.\n\t *                      The nmemb argument exists only for\n\t *                      compatibility with zlib and libbzip2.\n\t * \\param       size    Size of an element in bytes.\n\t *                      liblzma never sets this to zero.\n\t *\n\t * \\return      Pointer to the beginning of a memory block of\n\t *              `size' bytes, or NULL if allocation fails\n\t *              for some reason. When allocation fails, functions\n\t *              of liblzma return LZMA_MEM_ERROR.\n\t *\n\t * The allocator should not waste time zeroing the allocated buffers.\n\t * This is not only about speed, but also memory usage, since the\n\t * operating system kernel doesn't necessarily allocate the requested\n\t * memory in physical memory until it is actually used. With small\n\t * input files, liblzma may actually need only a fraction of the\n\t * memory that it requested for allocation.\n\t *\n\t * \\note        LZMA_MEM_ERROR is also used when the size of the\n\t *              allocation would be greater than SIZE_MAX. Thus,\n\t *              don't assume that the custom allocator must have\n\t *              returned NULL if some function from liblzma\n\t *              returns LZMA_MEM_ERROR.\n\t */\n\tvoid *(LZMA_API_CALL *alloc)(void *opaque, size_t nmemb, size_t size);\n\n\t/**\n\t * \\brief       Pointer to a custom memory freeing function\n\t *\n\t * If you don't want a custom freeing function, but still\n\t * want a custom allocator, set this to NULL and liblzma\n\t * will use the standard free().\n\t *\n\t * \\param       opaque  lzma_allocator.opaque (see below)\n\t * \\param       ptr     Pointer returned by lzma_allocator.alloc(),\n\t *                      or when it is set to NULL, a pointer returned\n\t *                      by the standard malloc().\n\t */\n\tvoid (LZMA_API_CALL *free)(void *opaque, void *ptr);\n\n\t/**\n\t * \\brief       Pointer passed to .alloc() and .free()\n\t *\n\t * opaque is passed as the first argument to lzma_allocator.alloc()\n\t * and lzma_allocator.free(). This intended to ease implementing\n\t * custom memory allocation functions for use with liblzma.\n\t *\n\t * If you don't need this, you should set this to NULL.\n\t */\n\tvoid *opaque;\n\n} lzma_allocator;\n\n\n/**\n * \\brief       Internal data structure\n *\n * The contents of this structure is not visible outside the library.\n */\ntypedef struct lzma_internal_s lzma_internal;\n\n\n/**\n * \\brief       Passing data to and from liblzma\n *\n * The lzma_stream structure is used for\n *  - passing pointers to input and output buffers to liblzma;\n *  - defining custom memory hander functions; and\n *  - holding a pointer to coder-specific internal data structures.\n *\n * Typical usage:\n *\n *  - After allocating lzma_stream (on stack or with malloc()), it must be\n *    initialized to LZMA_STREAM_INIT (see LZMA_STREAM_INIT for details).\n *\n *  - Initialize a coder to the lzma_stream, for example by using\n *    lzma_easy_encoder() or lzma_auto_decoder(). Some notes:\n *      - In contrast to zlib, strm->next_in and strm->next_out are\n *        ignored by all initialization functions, thus it is safe\n *        to not initialize them yet.\n *      - The initialization functions always set strm->total_in and\n *        strm->total_out to zero.\n *      - If the initialization function fails, no memory is left allocated\n *        that would require freeing with lzma_end() even if some memory was\n *        associated with the lzma_stream structure when the initialization\n *        function was called.\n *\n *  - Use lzma_code() to do the actual work.\n *\n *  - Once the coding has been finished, the existing lzma_stream can be\n *    reused. It is OK to reuse lzma_stream with different initialization\n *    function without calling lzma_end() first. Old allocations are\n *    automatically freed.\n *\n *  - Finally, use lzma_end() to free the allocated memory. lzma_end() never\n *    frees the lzma_stream structure itself.\n *\n * Application may modify the values of total_in and total_out as it wants.\n * They are updated by liblzma to match the amount of data read and\n * written, but aren't used for anything else.\n */\ntypedef struct {\n\tconst uint8_t *next_in; /**< Pointer to the next input byte. */\n\tsize_t avail_in;    /**< Number of available input bytes in next_in. */\n\tuint64_t total_in;  /**< Total number of bytes read by liblzma. */\n\n\tuint8_t *next_out;  /**< Pointer to the next output position. */\n\tsize_t avail_out;   /**< Amount of free space in next_out. */\n\tuint64_t total_out; /**< Total number of bytes written by liblzma. */\n\n\t/**\n\t * \\brief       Custom memory allocation functions\n\t *\n\t * In most cases this is NULL which makes liblzma use\n\t * the standard malloc() and free().\n\t */\n\tlzma_allocator *allocator;\n\n\t/** Internal state is not visible to applications. */\n\tlzma_internal *internal;\n\n\t/*\n\t * Reserved space to allow possible future extensions without\n\t * breaking the ABI. Excluding the initialization of this structure,\n\t * you should not touch these, because the names of these variables\n\t * may change.\n\t */\n\tvoid *reserved_ptr1;\n\tvoid *reserved_ptr2;\n\tvoid *reserved_ptr3;\n\tvoid *reserved_ptr4;\n\tuint64_t reserved_int1;\n\tuint64_t reserved_int2;\n\tsize_t reserved_int3;\n\tsize_t reserved_int4;\n\tlzma_reserved_enum reserved_enum1;\n\tlzma_reserved_enum reserved_enum2;\n\n} lzma_stream;\n\n\n/**\n * \\brief       Initialization for lzma_stream\n *\n * When you declare an instance of lzma_stream, you can immediately\n * initialize it so that initialization functions know that no memory\n * has been allocated yet:\n *\n *     lzma_stream strm = LZMA_STREAM_INIT;\n *\n * If you need to initialize a dynamically allocated lzma_stream, you can use\n * memset(strm_pointer, 0, sizeof(lzma_stream)). Strictly speaking, this\n * violates the C standard since NULL may have different internal\n * representation than zero, but it should be portable enough in practice.\n * Anyway, for maximum portability, you can use something like this:\n *\n *     lzma_stream tmp = LZMA_STREAM_INIT;\n *     *strm = tmp;\n */\n#define LZMA_STREAM_INIT \\\n\t{ NULL, 0, 0, NULL, 0, 0, NULL, NULL, \\\n\tNULL, NULL, NULL, NULL, 0, 0, 0, 0, \\\n\tLZMA_RESERVED_ENUM, LZMA_RESERVED_ENUM }\n\n\n/**\n * \\brief       Encode or decode data\n *\n * Once the lzma_stream has been successfully initialized (e.g. with\n * lzma_stream_encoder()), the actual encoding or decoding is done\n * using this function. The application has to update strm->next_in,\n * strm->avail_in, strm->next_out, and strm->avail_out to pass input\n * to and get output from liblzma.\n *\n * See the description of the coder-specific initialization function to find\n * out what `action' values are supported by the coder.\n */\nextern LZMA_API(lzma_ret) lzma_code(lzma_stream *strm, lzma_action action)\n\t\tlzma_nothrow lzma_attr_warn_unused_result;\n\n\n/**\n * \\brief       Free memory allocated for the coder data structures\n *\n * \\param       strm    Pointer to lzma_stream that is at least initialized\n *                      with LZMA_STREAM_INIT.\n *\n * After lzma_end(strm), strm->internal is guaranteed to be NULL. No other\n * members of the lzma_stream structure are touched.\n *\n * \\note        zlib indicates an error if application end()s unfinished\n *              stream structure. liblzma doesn't do this, and assumes that\n *              application knows what it is doing.\n */\nextern LZMA_API(void) lzma_end(lzma_stream *strm) lzma_nothrow;\n\n\n/**\n * \\brief       Get the memory usage of decoder filter chain\n *\n * This function is currently supported only when *strm has been initialized\n * with a function that takes a memlimit argument. With other functions, you\n * should use e.g. lzma_raw_encoder_memusage() or lzma_raw_decoder_memusage()\n * to estimate the memory requirements.\n *\n * This function is useful e.g. after LZMA_MEMLIMIT_ERROR to find out how big\n * the memory usage limit should have been to decode the input. Note that\n * this may give misleading information if decoding .xz Streams that have\n * multiple Blocks, because each Block can have different memory requirements.\n *\n * \\return      How much memory is currently allocated for the filter\n *              decoders. If no filter chain is currently allocated,\n *              some non-zero value is still returned, which is less than\n *              or equal to what any filter chain would indicate as its\n *              memory requirement.\n *\n *              If this function isn't supported by *strm or some other error\n *              occurs, zero is returned.\n */\nextern LZMA_API(uint64_t) lzma_memusage(const lzma_stream *strm)\n\t\tlzma_nothrow lzma_attr_pure;\n\n\n/**\n * \\brief       Get the current memory usage limit\n *\n * This function is supported only when *strm has been initialized with\n * a function that takes a memlimit argument.\n *\n * \\return      On success, the current memory usage limit is returned\n *              (always non-zero). On error, zero is returned.\n */\nextern LZMA_API(uint64_t) lzma_memlimit_get(const lzma_stream *strm)\n\t\tlzma_nothrow lzma_attr_pure;\n\n\n/**\n * \\brief       Set the memory usage limit\n *\n * This function is supported only when *strm has been initialized with\n * a function that takes a memlimit argument.\n *\n * \\return      - LZMA_OK: New memory usage limit successfully set.\n *              - LZMA_MEMLIMIT_ERROR: The new limit is too small.\n *                The limit was not changed.\n *              - LZMA_PROG_ERROR: Invalid arguments, e.g. *strm doesn't\n *                support memory usage limit or memlimit was zero.\n */\nextern LZMA_API(lzma_ret) lzma_memlimit_set(\n\t\tlzma_stream *strm, uint64_t memlimit) lzma_nothrow;\n"
  },
  {
    "path": "freebsd-headers/lzma/bcj.h",
    "content": "/**\n * \\file        lzma/bcj.h\n * \\brief       Branch/Call/Jump conversion filters\n */\n\n/*\n * Author: Lasse Collin\n *\n * This file has been put into the public domain.\n * You can do whatever you want with this file.\n *\n * See ../lzma.h for information about liblzma as a whole.\n */\n\n#ifndef LZMA_H_INTERNAL\n#\terror Never include this file directly. Use <lzma.h> instead.\n#endif\n\n\n/* Filter IDs for lzma_filter.id */\n\n#define LZMA_FILTER_X86         LZMA_VLI_C(0x04)\n\t/**<\n\t * Filter for x86 binaries\n\t */\n\n#define LZMA_FILTER_POWERPC     LZMA_VLI_C(0x05)\n\t/**<\n\t * Filter for Big endian PowerPC binaries\n\t */\n\n#define LZMA_FILTER_IA64        LZMA_VLI_C(0x06)\n\t/**<\n\t * Filter for IA-64 (Itanium) binaries.\n\t */\n\n#define LZMA_FILTER_ARM         LZMA_VLI_C(0x07)\n\t/**<\n\t * Filter for ARM binaries.\n\t */\n\n#define LZMA_FILTER_ARMTHUMB    LZMA_VLI_C(0x08)\n\t/**<\n\t * Filter for ARM-Thumb binaries.\n\t */\n\n#define LZMA_FILTER_SPARC       LZMA_VLI_C(0x09)\n\t/**<\n\t * Filter for SPARC binaries.\n\t */\n\n\n/**\n * \\brief       Options for BCJ filters\n *\n * The BCJ filters never change the size of the data. Specifying options\n * for them is optional: if pointer to options is NULL, default value is\n * used. You probably never need to specify options to BCJ filters, so just\n * set the options pointer to NULL and be happy.\n *\n * If options with non-default values have been specified when encoding,\n * the same options must also be specified when decoding.\n *\n * \\note        At the moment, none of the BCJ filters support\n *              LZMA_SYNC_FLUSH. If LZMA_SYNC_FLUSH is specified,\n *              LZMA_OPTIONS_ERROR will be returned. If there is need,\n *              partial support for LZMA_SYNC_FLUSH can be added in future.\n *              Partial means that flushing would be possible only at\n *              offsets that are multiple of 2, 4, or 16 depending on\n *              the filter, except x86 which cannot be made to support\n *              LZMA_SYNC_FLUSH predictably.\n */\ntypedef struct {\n\t/**\n\t * \\brief       Start offset for conversions\n\t *\n\t * This setting is useful only when the same filter is used\n\t * _separately_ for multiple sections of the same executable file,\n\t * and the sections contain cross-section branch/call/jump\n\t * instructions. In that case it is beneficial to set the start\n\t * offset of the non-first sections so that the relative addresses\n\t * of the cross-section branch/call/jump instructions will use the\n\t * same absolute addresses as in the first section.\n\t *\n\t * When the pointer to options is NULL, the default value (zero)\n\t * is used.\n\t */\n\tuint32_t start_offset;\n\n} lzma_options_bcj;\n"
  },
  {
    "path": "freebsd-headers/lzma/block.h",
    "content": "/**\n * \\file        lzma/block.h\n * \\brief       .xz Block handling\n */\n\n/*\n * Author: Lasse Collin\n *\n * This file has been put into the public domain.\n * You can do whatever you want with this file.\n *\n * See ../lzma.h for information about liblzma as a whole.\n */\n\n#ifndef LZMA_H_INTERNAL\n#\terror Never include this file directly. Use <lzma.h> instead.\n#endif\n\n\n/**\n * \\brief       Options for the Block and Block Header encoders and decoders\n *\n * Different Block handling functions use different parts of this structure.\n * Some read some members, other functions write, and some do both. Only the\n * members listed for reading need to be initialized when the specified\n * functions are called. The members marked for writing will be assigned\n * new values at some point either by calling the given function or by\n * later calls to lzma_code().\n */\ntypedef struct {\n\t/**\n\t * \\brief       Block format version\n\t *\n\t * To prevent API and ABI breakages if new features are needed in\n\t * the Block field, a version number is used to indicate which\n\t * fields in this structure are in use. For now, version must always\n\t * be zero. With non-zero version, most Block related functions will\n\t * return LZMA_OPTIONS_ERROR.\n\t *\n\t * Read by:\n\t *  - All functions that take pointer to lzma_block as argument,\n\t *    including lzma_block_header_decode().\n\t *\n\t * Written by:\n\t *  - lzma_block_header_decode()\n\t */\n\tuint32_t version;\n\n\t/**\n\t * \\brief       Size of the Block Header field\n\t *\n\t * This is always a multiple of four.\n\t *\n\t * Read by:\n\t *  - lzma_block_header_encode()\n\t *  - lzma_block_header_decode()\n\t *  - lzma_block_compressed_size()\n\t *  - lzma_block_unpadded_size()\n\t *  - lzma_block_total_size()\n\t *  - lzma_block_decoder()\n\t *  - lzma_block_buffer_decode()\n\t *\n\t * Written by:\n\t *  - lzma_block_header_size()\n\t *  - lzma_block_buffer_encode()\n\t */\n\tuint32_t header_size;\n#\tdefine LZMA_BLOCK_HEADER_SIZE_MIN 8\n#\tdefine LZMA_BLOCK_HEADER_SIZE_MAX 1024\n\n\t/**\n\t * \\brief       Type of integrity Check\n\t *\n\t * The Check ID is not stored into the Block Header, thus its value\n\t * must be provided also when decoding.\n\t *\n\t * Read by:\n\t *  - lzma_block_header_encode()\n\t *  - lzma_block_header_decode()\n\t *  - lzma_block_compressed_size()\n\t *  - lzma_block_unpadded_size()\n\t *  - lzma_block_total_size()\n\t *  - lzma_block_encoder()\n\t *  - lzma_block_decoder()\n\t *  - lzma_block_buffer_encode()\n\t *  - lzma_block_buffer_decode()\n\t */\n\tlzma_check check;\n\n\t/**\n\t * \\brief       Size of the Compressed Data in bytes\n\t *\n\t * Encoding: If this is not LZMA_VLI_UNKNOWN, Block Header encoder\n\t * will store this value to the Block Header. Block encoder doesn't\n\t * care about this value, but will set it once the encoding has been\n\t * finished.\n\t *\n\t * Decoding: If this is not LZMA_VLI_UNKNOWN, Block decoder will\n\t * verify that the size of the Compressed Data field matches\n\t * compressed_size.\n\t *\n\t * Usually you don't know this value when encoding in streamed mode,\n\t * and thus cannot write this field into the Block Header.\n\t *\n\t * In non-streamed mode you can reserve space for this field before\n\t * encoding the actual Block. After encoding the data, finish the\n\t * Block by encoding the Block Header. Steps in detail:\n\t *\n\t *  - Set compressed_size to some big enough value. If you don't know\n\t *    better, use LZMA_VLI_MAX, but remember that bigger values take\n\t *    more space in Block Header.\n\t *\n\t *  - Call lzma_block_header_size() to see how much space you need to\n\t *    reserve for the Block Header.\n\t *\n\t *  - Encode the Block using lzma_block_encoder() and lzma_code().\n\t *    It sets compressed_size to the correct value.\n\t *\n\t *  - Use lzma_block_header_encode() to encode the Block Header.\n\t *    Because space was reserved in the first step, you don't need\n\t *    to call lzma_block_header_size() anymore, because due to\n\t *    reserving, header_size has to be big enough. If it is \"too big\",\n\t *    lzma_block_header_encode() will add enough Header Padding to\n\t *    make Block Header to match the size specified by header_size.\n\t *\n\t * Read by:\n\t *  - lzma_block_header_size()\n\t *  - lzma_block_header_encode()\n\t *  - lzma_block_compressed_size()\n\t *  - lzma_block_unpadded_size()\n\t *  - lzma_block_total_size()\n\t *  - lzma_block_decoder()\n\t *  - lzma_block_buffer_decode()\n\t *\n\t * Written by:\n\t *  - lzma_block_header_decode()\n\t *  - lzma_block_compressed_size()\n\t *  - lzma_block_encoder()\n\t *  - lzma_block_decoder()\n\t *  - lzma_block_buffer_encode()\n\t *  - lzma_block_buffer_decode()\n\t */\n\tlzma_vli compressed_size;\n\n\t/**\n\t * \\brief       Uncompressed Size in bytes\n\t *\n\t * This is handled very similarly to compressed_size above.\n\t *\n\t * uncompressed_size is needed by fewer functions than\n\t * compressed_size. This is because uncompressed_size isn't\n\t * needed to validate that Block stays within proper limits.\n\t *\n\t * Read by:\n\t *  - lzma_block_header_size()\n\t *  - lzma_block_header_encode()\n\t *  - lzma_block_decoder()\n\t *  - lzma_block_buffer_decode()\n\t *\n\t * Written by:\n\t *  - lzma_block_header_decode()\n\t *  - lzma_block_encoder()\n\t *  - lzma_block_decoder()\n\t *  - lzma_block_buffer_encode()\n\t *  - lzma_block_buffer_decode()\n\t */\n\tlzma_vli uncompressed_size;\n\n\t/**\n\t * \\brief       Array of filters\n\t *\n\t * There can be 1-4 filters. The end of the array is marked with\n\t * .id = LZMA_VLI_UNKNOWN.\n\t *\n\t * Read by:\n\t *  - lzma_block_header_size()\n\t *  - lzma_block_header_encode()\n\t *  - lzma_block_encoder()\n\t *  - lzma_block_decoder()\n\t *  - lzma_block_buffer_encode()\n\t *  - lzma_block_buffer_decode()\n\t *\n\t * Written by:\n\t *  - lzma_block_header_decode(): Note that this does NOT free()\n\t *    the old filter options structures. All unused filters[] will\n\t *    have .id == LZMA_VLI_UNKNOWN and .options == NULL. If\n\t *    decoding fails, all filters[] are guaranteed to be\n\t *    LZMA_VLI_UNKNOWN and NULL.\n\t *\n\t * \\note        Because of the array is terminated with\n\t *              .id = LZMA_VLI_UNKNOWN, the actual array must\n\t *              have LZMA_FILTERS_MAX + 1 members or the Block\n\t *              Header decoder will overflow the buffer.\n\t */\n\tlzma_filter *filters;\n\n\t/**\n\t * \\brief       Raw value stored in the Check field\n\t *\n\t * After successful coding, the first lzma_check_size(check) bytes\n\t * of this array contain the raw value stored in the Check field.\n\t *\n\t * Note that CRC32 and CRC64 are stored in little endian byte order.\n\t * Take it into account if you display the Check values to the user.\n\t *\n\t * Written by:\n\t *  - lzma_block_encoder()\n\t *  - lzma_block_decoder()\n\t *  - lzma_block_buffer_encode()\n\t *  - lzma_block_buffer_decode()\n\t */\n\tuint8_t raw_check[LZMA_CHECK_SIZE_MAX];\n\n\t/*\n\t * Reserved space to allow possible future extensions without\n\t * breaking the ABI. You should not touch these, because the names\n\t * of these variables may change. These are and will never be used\n\t * with the currently supported options, so it is safe to leave these\n\t * uninitialized.\n\t */\n\tvoid *reserved_ptr1;\n\tvoid *reserved_ptr2;\n\tvoid *reserved_ptr3;\n\tuint32_t reserved_int1;\n\tuint32_t reserved_int2;\n\tlzma_vli reserved_int3;\n\tlzma_vli reserved_int4;\n\tlzma_vli reserved_int5;\n\tlzma_vli reserved_int6;\n\tlzma_vli reserved_int7;\n\tlzma_vli reserved_int8;\n\tlzma_reserved_enum reserved_enum1;\n\tlzma_reserved_enum reserved_enum2;\n\tlzma_reserved_enum reserved_enum3;\n\tlzma_reserved_enum reserved_enum4;\n\tlzma_bool reserved_bool1;\n\tlzma_bool reserved_bool2;\n\tlzma_bool reserved_bool3;\n\tlzma_bool reserved_bool4;\n\tlzma_bool reserved_bool5;\n\tlzma_bool reserved_bool6;\n\tlzma_bool reserved_bool7;\n\tlzma_bool reserved_bool8;\n\n} lzma_block;\n\n\n/**\n * \\brief       Decode the Block Header Size field\n *\n * To decode Block Header using lzma_block_header_decode(), the size of the\n * Block Header has to be known and stored into lzma_block.header_size.\n * The size can be calculated from the first byte of a Block using this macro.\n * Note that if the first byte is 0x00, it indicates beginning of Index; use\n * this macro only when the byte is not 0x00.\n *\n * There is no encoding macro, because Block Header encoder is enough for that.\n */\n#define lzma_block_header_size_decode(b) (((uint32_t)(b) + 1) * 4)\n\n\n/**\n * \\brief       Calculate Block Header Size\n *\n * Calculate the minimum size needed for the Block Header field using the\n * settings specified in the lzma_block structure. Note that it is OK to\n * increase the calculated header_size value as long as it is a multiple of\n * four and doesn't exceed LZMA_BLOCK_HEADER_SIZE_MAX. Increasing header_size\n * just means that lzma_block_header_encode() will add Header Padding.\n *\n * \\return      - LZMA_OK: Size calculated successfully and stored to\n *                block->header_size.\n *              - LZMA_OPTIONS_ERROR: Unsupported version, filters or\n *                filter options.\n *              - LZMA_PROG_ERROR: Invalid values like compressed_size == 0.\n *\n * \\note        This doesn't check that all the options are valid i.e. this\n *              may return LZMA_OK even if lzma_block_header_encode() or\n *              lzma_block_encoder() would fail. If you want to validate the\n *              filter chain, consider using lzma_memlimit_encoder() which as\n *              a side-effect validates the filter chain.\n */\nextern LZMA_API(lzma_ret) lzma_block_header_size(lzma_block *block)\n\t\tlzma_nothrow lzma_attr_warn_unused_result;\n\n\n/**\n * \\brief       Encode Block Header\n *\n * The caller must have calculated the size of the Block Header already with\n * lzma_block_header_size(). If a value larger than the one calculated by\n * lzma_block_header_size() is used, the Block Header will be padded to the\n * specified size.\n *\n * \\param       out         Beginning of the output buffer. This must be\n *                          at least block->header_size bytes.\n * \\param       block       Block options to be encoded.\n *\n * \\return      - LZMA_OK: Encoding was successful. block->header_size\n *                bytes were written to output buffer.\n *              - LZMA_OPTIONS_ERROR: Invalid or unsupported options.\n *              - LZMA_PROG_ERROR: Invalid arguments, for example\n *                block->header_size is invalid or block->filters is NULL.\n */\nextern LZMA_API(lzma_ret) lzma_block_header_encode(\n\t\tconst lzma_block *block, uint8_t *out)\n\t\tlzma_nothrow lzma_attr_warn_unused_result;\n\n\n/**\n * \\brief       Decode Block Header\n *\n * block->version should be set to the highest value supported by the\n * application; currently the only possible version is zero. This function\n * will set version to the lowest value that still supports all the features\n * required by the Block Header.\n *\n * The size of the Block Header must have already been decoded with\n * lzma_block_header_size_decode() macro and stored to block->header_size.\n *\n * block->filters must have been allocated, but they don't need to be\n * initialized (possible existing filter options are not freed).\n *\n * \\param       block       Destination for Block options.\n * \\param       allocator   lzma_allocator for custom allocator functions.\n *                          Set to NULL to use malloc() (and also free()\n *                          if an error occurs).\n * \\param       in          Beginning of the input buffer. This must be\n *                          at least block->header_size bytes.\n *\n * \\return      - LZMA_OK: Decoding was successful. block->header_size\n *                bytes were read from the input buffer.\n *              - LZMA_OPTIONS_ERROR: The Block Header specifies some\n *                unsupported options such as unsupported filters. This can\n *                happen also if block->version was set to a too low value\n *                compared to what would be required to properly represent\n *                the information stored in the Block Header.\n *              - LZMA_DATA_ERROR: Block Header is corrupt, for example,\n *                the CRC32 doesn't match.\n *              - LZMA_PROG_ERROR: Invalid arguments, for example\n *                block->header_size is invalid or block->filters is NULL.\n */\nextern LZMA_API(lzma_ret) lzma_block_header_decode(lzma_block *block,\n\t\tlzma_allocator *allocator, const uint8_t *in)\n\t\tlzma_nothrow lzma_attr_warn_unused_result;\n\n\n/**\n * \\brief       Validate and set Compressed Size according to Unpadded Size\n *\n * Block Header stores Compressed Size, but Index has Unpadded Size. If the\n * application has already parsed the Index and is now decoding Blocks,\n * it can calculate Compressed Size from Unpadded Size. This function does\n * exactly that with error checking:\n *\n *  - Compressed Size calculated from Unpadded Size must be positive integer,\n *    that is, Unpadded Size must be big enough that after Block Header and\n *    Check fields there's still at least one byte for Compressed Size.\n *\n *  - If Compressed Size was present in Block Header, the new value\n *    calculated from Unpadded Size is compared against the value\n *    from Block Header.\n *\n * \\note        This function must be called _after_ decoding the Block Header\n *              field so that it can properly validate Compressed Size if it\n *              was present in Block Header.\n *\n * \\return      - LZMA_OK: block->compressed_size was set successfully.\n *              - LZMA_DATA_ERROR: unpadded_size is too small compared to\n *                block->header_size and lzma_check_size(block->check).\n *              - LZMA_PROG_ERROR: Some values are invalid. For example,\n *                block->header_size must be a multiple of four and\n *                between 8 and 1024 inclusive.\n */\nextern LZMA_API(lzma_ret) lzma_block_compressed_size(\n\t\tlzma_block *block, lzma_vli unpadded_size)\n\t\tlzma_nothrow lzma_attr_warn_unused_result;\n\n\n/**\n * \\brief       Calculate Unpadded Size\n *\n * The Index field stores Unpadded Size and Uncompressed Size. The latter\n * can be taken directly from the lzma_block structure after coding a Block,\n * but Unpadded Size needs to be calculated from Block Header Size,\n * Compressed Size, and size of the Check field. This is where this function\n * is needed.\n *\n * \\return      Unpadded Size on success, or zero on error.\n */\nextern LZMA_API(lzma_vli) lzma_block_unpadded_size(const lzma_block *block)\n\t\tlzma_nothrow lzma_attr_pure;\n\n\n/**\n * \\brief       Calculate the total encoded size of a Block\n *\n * This is equivalent to lzma_block_unpadded_size() except that the returned\n * value includes the size of the Block Padding field.\n *\n * \\return      On success, total encoded size of the Block. On error,\n *              zero is returned.\n */\nextern LZMA_API(lzma_vli) lzma_block_total_size(const lzma_block *block)\n\t\tlzma_nothrow lzma_attr_pure;\n\n\n/**\n * \\brief       Initialize .xz Block encoder\n *\n * Valid actions for lzma_code() are LZMA_RUN, LZMA_SYNC_FLUSH (only if the\n * filter chain supports it), and LZMA_FINISH.\n *\n * \\return      - LZMA_OK: All good, continue with lzma_code().\n *              - LZMA_MEM_ERROR\n *              - LZMA_OPTIONS_ERROR\n *              - LZMA_UNSUPPORTED_CHECK: block->check specifies a Check ID\n *                that is not supported by this buid of liblzma. Initializing\n *                the encoder failed.\n *              - LZMA_PROG_ERROR\n */\nextern LZMA_API(lzma_ret) lzma_block_encoder(\n\t\tlzma_stream *strm, lzma_block *block)\n\t\tlzma_nothrow lzma_attr_warn_unused_result;\n\n\n/**\n * \\brief       Initialize .xz Block decoder\n *\n * Valid actions for lzma_code() are LZMA_RUN and LZMA_FINISH. Using\n * LZMA_FINISH is not required. It is supported only for convenience.\n *\n * \\return      - LZMA_OK: All good, continue with lzma_code().\n *              - LZMA_UNSUPPORTED_CHECK: Initialization was successful, but\n *                the given Check ID is not supported, thus Check will be\n *                ignored.\n *              - LZMA_PROG_ERROR\n *              - LZMA_MEM_ERROR\n */\nextern LZMA_API(lzma_ret) lzma_block_decoder(\n\t\tlzma_stream *strm, lzma_block *block)\n\t\tlzma_nothrow lzma_attr_warn_unused_result;\n\n\n/**\n * \\brief       Calculate maximum output size for single-call Block encoding\n *\n * This is equivalent to lzma_stream_buffer_bound() but for .xz Blocks.\n * See the documentation of lzma_stream_buffer_bound().\n */\nextern LZMA_API(size_t) lzma_block_buffer_bound(size_t uncompressed_size)\n\t\tlzma_nothrow;\n\n\n/**\n * \\brief       Single-call .xz Block encoder\n *\n * In contrast to the multi-call encoder initialized with\n * lzma_block_encoder(), this function encodes also the Block Header. This\n * is required to make it possible to write appropriate Block Header also\n * in case the data isn't compressible, and different filter chain has to be\n * used to encode the data in uncompressed form using uncompressed chunks\n * of the LZMA2 filter.\n *\n * When the data isn't compressible, header_size, compressed_size, and\n * uncompressed_size are set just like when the data was compressible, but\n * it is possible that header_size is too small to hold the filter chain\n * specified in block->filters, because that isn't necessarily the filter\n * chain that was actually used to encode the data. lzma_block_unpadded_size()\n * still works normally, because it doesn't read the filters array.\n *\n * \\param       block       Block options: block->version, block->check,\n *                          and block->filters must have been initialized.\n * \\param       allocator   lzma_allocator for custom allocator functions.\n *                          Set to NULL to use malloc() and free().\n * \\param       in          Beginning of the input buffer\n * \\param       in_size     Size of the input buffer\n * \\param       out         Beginning of the output buffer\n * \\param       out_pos     The next byte will be written to out[*out_pos].\n *                          *out_pos is updated only if encoding succeeds.\n * \\param       out_size    Size of the out buffer; the first byte into\n *                          which no data is written to is out[out_size].\n *\n * \\return      - LZMA_OK: Encoding was successful.\n *              - LZMA_BUF_ERROR: Not enough output buffer space.\n *              - LZMA_UNSUPPORTED_CHECK\n *              - LZMA_OPTIONS_ERROR\n *              - LZMA_MEM_ERROR\n *              - LZMA_DATA_ERROR\n *              - LZMA_PROG_ERROR\n */\nextern LZMA_API(lzma_ret) lzma_block_buffer_encode(\n\t\tlzma_block *block, lzma_allocator *allocator,\n\t\tconst uint8_t *in, size_t in_size,\n\t\tuint8_t *out, size_t *out_pos, size_t out_size)\n\t\tlzma_nothrow lzma_attr_warn_unused_result;\n\n\n/**\n * \\brief       Single-call .xz Block decoder\n *\n * This is single-call equivalent of lzma_block_decoder(), and requires that\n * the caller has already decoded Block Header and checked its memory usage.\n *\n * \\param       block       Block options just like with lzma_block_decoder().\n * \\param       allocator   lzma_allocator for custom allocator functions.\n *                          Set to NULL to use malloc() and free().\n * \\param       in          Beginning of the input buffer\n * \\param       in_pos      The next byte will be read from in[*in_pos].\n *                          *in_pos is updated only if decoding succeeds.\n * \\param       in_size     Size of the input buffer; the first byte that\n *                          won't be read is in[in_size].\n * \\param       out         Beginning of the output buffer\n * \\param       out_pos     The next byte will be written to out[*out_pos].\n *                          *out_pos is updated only if encoding succeeds.\n * \\param       out_size    Size of the out buffer; the first byte into\n *                          which no data is written to is out[out_size].\n *\n * \\return      - LZMA_OK: Decoding was successful.\n *              - LZMA_OPTIONS_ERROR\n *              - LZMA_DATA_ERROR\n *              - LZMA_MEM_ERROR\n *              - LZMA_BUF_ERROR: Output buffer was too small.\n *              - LZMA_PROG_ERROR\n */\nextern LZMA_API(lzma_ret) lzma_block_buffer_decode(\n\t\tlzma_block *block, lzma_allocator *allocator,\n\t\tconst uint8_t *in, size_t *in_pos, size_t in_size,\n\t\tuint8_t *out, size_t *out_pos, size_t out_size)\n\t\tlzma_nothrow;\n"
  },
  {
    "path": "freebsd-headers/lzma/check.h",
    "content": "/**\n * \\file        lzma/check.h\n * \\brief       Integrity checks\n */\n\n/*\n * Author: Lasse Collin\n *\n * This file has been put into the public domain.\n * You can do whatever you want with this file.\n *\n * See ../lzma.h for information about liblzma as a whole.\n */\n\n#ifndef LZMA_H_INTERNAL\n#\terror Never include this file directly. Use <lzma.h> instead.\n#endif\n\n\n/**\n * \\brief       Type of the integrity check (Check ID)\n *\n * The .xz format supports multiple types of checks that are calculated\n * from the uncompressed data. They vary in both speed and ability to\n * detect errors.\n */\ntypedef enum {\n\tLZMA_CHECK_NONE     = 0,\n\t\t/**<\n\t\t * No Check is calculated.\n\t\t *\n\t\t * Size of the Check field: 0 bytes\n\t\t */\n\n\tLZMA_CHECK_CRC32    = 1,\n\t\t/**<\n\t\t * CRC32 using the polynomial from the IEEE 802.3 standard\n\t\t *\n\t\t * Size of the Check field: 4 bytes\n\t\t */\n\n\tLZMA_CHECK_CRC64    = 4,\n\t\t/**<\n\t\t * CRC64 using the polynomial from the ECMA-182 standard\n\t\t *\n\t\t * Size of the Check field: 8 bytes\n\t\t */\n\n\tLZMA_CHECK_SHA256   = 10\n\t\t/**<\n\t\t * SHA-256\n\t\t *\n\t\t * Size of the Check field: 32 bytes\n\t\t */\n} lzma_check;\n\n\n/**\n * \\brief       Maximum valid Check ID\n *\n * The .xz file format specification specifies 16 Check IDs (0-15). Some\n * of them are only reserved, that is, no actual Check algorithm has been\n * assigned. When decoding, liblzma still accepts unknown Check IDs for\n * future compatibility. If a valid but unsupported Check ID is detected,\n * liblzma can indicate a warning; see the flags LZMA_TELL_NO_CHECK,\n * LZMA_TELL_UNSUPPORTED_CHECK, and LZMA_TELL_ANY_CHECK in container.h.\n */\n#define LZMA_CHECK_ID_MAX 15\n\n\n/**\n * \\brief       Test if the given Check ID is supported\n *\n * Return true if the given Check ID is supported by this liblzma build.\n * Otherwise false is returned. It is safe to call this with a value that\n * is not in the range [0, 15]; in that case the return value is always false.\n *\n * You can assume that LZMA_CHECK_NONE and LZMA_CHECK_CRC32 are always\n * supported (even if liblzma is built with limited features).\n */\nextern LZMA_API(lzma_bool) lzma_check_is_supported(lzma_check check)\n\t\tlzma_nothrow lzma_attr_const;\n\n\n/**\n * \\brief       Get the size of the Check field with the given Check ID\n *\n * Although not all Check IDs have a check algorithm associated, the size of\n * every Check is already frozen. This function returns the size (in bytes) of\n * the Check field with the specified Check ID. The values are:\n * { 0, 4, 4, 4, 8, 8, 8, 16, 16, 16, 32, 32, 32, 64, 64, 64 }\n *\n * If the argument is not in the range [0, 15], UINT32_MAX is returned.\n */\nextern LZMA_API(uint32_t) lzma_check_size(lzma_check check)\n\t\tlzma_nothrow lzma_attr_const;\n\n\n/**\n * \\brief       Maximum size of a Check field\n */\n#define LZMA_CHECK_SIZE_MAX 64\n\n\n/**\n * \\brief       Calculate CRC32\n *\n * Calculate CRC32 using the polynomial from the IEEE 802.3 standard.\n *\n * \\param       buf     Pointer to the input buffer\n * \\param       size    Size of the input buffer\n * \\param       crc     Previously returned CRC value. This is used to\n *                      calculate the CRC of a big buffer in smaller chunks.\n *                      Set to zero when starting a new calculation.\n *\n * \\return      Updated CRC value, which can be passed to this function\n *              again to continue CRC calculation.\n */\nextern LZMA_API(uint32_t) lzma_crc32(\n\t\tconst uint8_t *buf, size_t size, uint32_t crc)\n\t\tlzma_nothrow lzma_attr_pure;\n\n\n/**\n * \\brief       Calculate CRC64\n *\n * Calculate CRC64 using the polynomial from the ECMA-182 standard.\n *\n * This function is used similarly to lzma_crc32(). See its documentation.\n */\nextern LZMA_API(uint64_t) lzma_crc64(\n\t\tconst uint8_t *buf, size_t size, uint64_t crc)\n\t\tlzma_nothrow lzma_attr_pure;\n\n\n/*\n * SHA-256 functions are currently not exported to public API.\n * Contact Lasse Collin if you think it should be.\n */\n\n\n/**\n * \\brief       Get the type of the integrity check\n *\n * This function can be called only immediately after lzma_code() has\n * returned LZMA_NO_CHECK, LZMA_UNSUPPORTED_CHECK, or LZMA_GET_CHECK.\n * Calling this function in any other situation has undefined behavior.\n */\nextern LZMA_API(lzma_check) lzma_get_check(const lzma_stream *strm)\n\t\tlzma_nothrow;\n"
  },
  {
    "path": "freebsd-headers/lzma/container.h",
    "content": "/**\n * \\file        lzma/container.h\n * \\brief       File formats\n */\n\n/*\n * Author: Lasse Collin\n *\n * This file has been put into the public domain.\n * You can do whatever you want with this file.\n *\n * See ../lzma.h for information about liblzma as a whole.\n */\n\n#ifndef LZMA_H_INTERNAL\n#\terror Never include this file directly. Use <lzma.h> instead.\n#endif\n\n\n/************\n * Encoding *\n ************/\n\n/**\n * \\brief       Default compression preset\n *\n * It's not straightforward to recommend a default preset, because in some\n * cases keeping the resource usage relatively low is more important that\n * getting the maximum compression ratio.\n */\n#define LZMA_PRESET_DEFAULT     UINT32_C(6)\n\n\n/**\n * \\brief       Mask for preset level\n *\n * This is useful only if you need to extract the level from the preset\n * variable. That should be rare.\n */\n#define LZMA_PRESET_LEVEL_MASK  UINT32_C(0x1F)\n\n\n/*\n * Preset flags\n *\n * Currently only one flag is defined.\n */\n\n/**\n * \\brief       Extreme compression preset\n *\n * This flag modifies the preset to make the encoding significantly slower\n * while improving the compression ratio only marginally. This is useful\n * when you don't mind wasting time to get as small result as possible.\n *\n * This flag doesn't affect the memory usage requirements of the decoder (at\n * least not significantly). The memory usage of the encoder may be increased\n * a little but only at the lowest preset levels (0-3).\n */\n#define LZMA_PRESET_EXTREME       (UINT32_C(1) << 31)\n\n\n/**\n * \\brief       Calculate approximate memory usage of easy encoder\n *\n * This function is a wrapper for lzma_raw_encoder_memusage().\n *\n * \\param       preset  Compression preset (level and possible flags)\n *\n * \\return      Number of bytes of memory required for the given\n *              preset when encoding. If an error occurs, for example\n *              due to unsupported preset, UINT64_MAX is returned.\n */\nextern LZMA_API(uint64_t) lzma_easy_encoder_memusage(uint32_t preset)\n\t\tlzma_nothrow lzma_attr_pure;\n\n\n/**\n * \\brief       Calculate approximate decoder memory usage of a preset\n *\n * This function is a wrapper for lzma_raw_decoder_memusage().\n *\n * \\param       preset  Compression preset (level and possible flags)\n *\n * \\return      Number of bytes of memory required to decompress a file\n *              that was compressed using the given preset. If an error\n *              occurs, for example due to unsupported preset, UINT64_MAX\n *              is returned.\n */\nextern LZMA_API(uint64_t) lzma_easy_decoder_memusage(uint32_t preset)\n\t\tlzma_nothrow lzma_attr_pure;\n\n\n/**\n * \\brief       Initialize .xz Stream encoder using a preset number\n *\n * This function is intended for those who just want to use the basic features\n * if liblzma (that is, most developers out there).\n *\n * \\param       strm    Pointer to lzma_stream that is at least initialized\n *                      with LZMA_STREAM_INIT.\n * \\param       preset  Compression preset to use. A preset consist of level\n *                      number and zero or more flags. Usually flags aren't\n *                      used, so preset is simply a number [0, 9] which match\n *                      the options -0 ... -9 of the xz command line tool.\n *                      Additional flags can be be set using bitwise-or with\n *                      the preset level number, e.g. 6 | LZMA_PRESET_EXTREME.\n * \\param       check   Integrity check type to use. See check.h for available\n *                      checks. The xz command line tool defaults to\n *                      LZMA_CHECK_CRC64, which is a good choice if you are\n *                      unsure. LZMA_CHECK_CRC32 is good too as long as the\n *                      uncompressed file is not many gigabytes.\n *\n * \\return      - LZMA_OK: Initialization succeeded. Use lzma_code() to\n *                encode your data.\n *              - LZMA_MEM_ERROR: Memory allocation failed.\n *              - LZMA_OPTIONS_ERROR: The given compression preset is not\n *                supported by this build of liblzma.\n *              - LZMA_UNSUPPORTED_CHECK: The given check type is not\n *                supported by this liblzma build.\n *              - LZMA_PROG_ERROR: One or more of the parameters have values\n *                that will never be valid. For example, strm == NULL.\n *\n * If initialization fails (return value is not LZMA_OK), all the memory\n * allocated for *strm by liblzma is always freed. Thus, there is no need\n * to call lzma_end() after failed initialization.\n *\n * If initialization succeeds, use lzma_code() to do the actual encoding.\n * Valid values for `action' (the second argument of lzma_code()) are\n * LZMA_RUN, LZMA_SYNC_FLUSH, LZMA_FULL_FLUSH, and LZMA_FINISH. In future,\n * there may be compression levels or flags that don't support LZMA_SYNC_FLUSH.\n */\nextern LZMA_API(lzma_ret) lzma_easy_encoder(\n\t\tlzma_stream *strm, uint32_t preset, lzma_check check)\n\t\tlzma_nothrow lzma_attr_warn_unused_result;\n\n\n/**\n * \\brief       Single-call .xz Stream encoding using a preset number\n *\n * The maximum required output buffer size can be calculated with\n * lzma_stream_buffer_bound().\n *\n * \\param       preset      Compression preset to use. See the description\n *                          in lzma_easy_encoder().\n * \\param       check       Type of the integrity check to calculate from\n *                          uncompressed data.\n * \\param       allocator   lzma_allocator for custom allocator functions.\n *                          Set to NULL to use malloc() and free().\n * \\param       in          Beginning of the input buffer\n * \\param       in_size     Size of the input buffer\n * \\param       out         Beginning of the output buffer\n * \\param       out_pos     The next byte will be written to out[*out_pos].\n *                          *out_pos is updated only if encoding succeeds.\n * \\param       out_size    Size of the out buffer; the first byte into\n *                          which no data is written to is out[out_size].\n *\n * \\return      - LZMA_OK: Encoding was successful.\n *              - LZMA_BUF_ERROR: Not enough output buffer space.\n *              - LZMA_UNSUPPORTED_CHECK\n *              - LZMA_OPTIONS_ERROR\n *              - LZMA_MEM_ERROR\n *              - LZMA_DATA_ERROR\n *              - LZMA_PROG_ERROR\n */\nextern LZMA_API(lzma_ret) lzma_easy_buffer_encode(\n\t\tuint32_t preset, lzma_check check,\n\t\tlzma_allocator *allocator, const uint8_t *in, size_t in_size,\n\t\tuint8_t *out, size_t *out_pos, size_t out_size) lzma_nothrow;\n\n\n/**\n * \\brief       Initialize .xz Stream encoder using a custom filter chain\n *\n * \\param       strm    Pointer to properly prepared lzma_stream\n * \\param       filters Array of filters. This must be terminated with\n *                      filters[n].id = LZMA_VLI_UNKNOWN. See filter.h for\n *                      more information.\n * \\param       check   Type of the integrity check to calculate from\n *                      uncompressed data.\n *\n * \\return      - LZMA_OK: Initialization was successful.\n *              - LZMA_MEM_ERROR\n *              - LZMA_UNSUPPORTED_CHECK\n *              - LZMA_OPTIONS_ERROR\n *              - LZMA_PROG_ERROR\n */\nextern LZMA_API(lzma_ret) lzma_stream_encoder(lzma_stream *strm,\n\t\tconst lzma_filter *filters, lzma_check check)\n\t\tlzma_nothrow lzma_attr_warn_unused_result;\n\n\n/**\n * \\brief       Initialize .lzma encoder (legacy file format)\n *\n * The .lzma format is sometimes called the LZMA_Alone format, which is the\n * reason for the name of this function. The .lzma format supports only the\n * LZMA1 filter. There is no support for integrity checks like CRC32.\n *\n * Use this function if and only if you need to create files readable by\n * legacy LZMA tools such as LZMA Utils 4.32.x. Moving to the .xz format\n * is strongly recommended.\n *\n * The valid action values for lzma_code() are LZMA_RUN and LZMA_FINISH.\n * No kind of flushing is supported, because the file format doesn't make\n * it possible.\n *\n * \\return      - LZMA_OK\n *              - LZMA_MEM_ERROR\n *              - LZMA_OPTIONS_ERROR\n *              - LZMA_PROG_ERROR\n */\nextern LZMA_API(lzma_ret) lzma_alone_encoder(\n\t\tlzma_stream *strm, const lzma_options_lzma *options)\n\t\tlzma_nothrow lzma_attr_warn_unused_result;\n\n\n/**\n * \\brief       Calculate output buffer size for single-call Stream encoder\n *\n * When trying to compress uncompressible data, the encoded size will be\n * slightly bigger than the input data. This function calculates how much\n * output buffer space is required to be sure that lzma_stream_buffer_encode()\n * doesn't return LZMA_BUF_ERROR.\n *\n * The calculated value is not exact, but it is guaranteed to be big enough.\n * The actual maximum output space required may be slightly smaller (up to\n * about 100 bytes). This should not be a problem in practice.\n *\n * If the calculated maximum size doesn't fit into size_t or would make the\n * Stream grow past LZMA_VLI_MAX (which should never happen in practice),\n * zero is returned to indicate the error.\n *\n * \\note        The limit calculated by this function applies only to\n *              single-call encoding. Multi-call encoding may (and probably\n *              will) have larger maximum expansion when encoding\n *              uncompressible data. Currently there is no function to\n *              calculate the maximum expansion of multi-call encoding.\n */\nextern LZMA_API(size_t) lzma_stream_buffer_bound(size_t uncompressed_size)\n\t\tlzma_nothrow;\n\n\n/**\n * \\brief       Single-call .xz Stream encoder\n *\n * \\param       filters     Array of filters. This must be terminated with\n *                          filters[n].id = LZMA_VLI_UNKNOWN. See filter.h\n *                          for more information.\n * \\param       check       Type of the integrity check to calculate from\n *                          uncompressed data.\n * \\param       allocator   lzma_allocator for custom allocator functions.\n *                          Set to NULL to use malloc() and free().\n * \\param       in          Beginning of the input buffer\n * \\param       in_size     Size of the input buffer\n * \\param       out         Beginning of the output buffer\n * \\param       out_pos     The next byte will be written to out[*out_pos].\n *                          *out_pos is updated only if encoding succeeds.\n * \\param       out_size    Size of the out buffer; the first byte into\n *                          which no data is written to is out[out_size].\n *\n * \\return      - LZMA_OK: Encoding was successful.\n *              - LZMA_BUF_ERROR: Not enough output buffer space.\n *              - LZMA_UNSUPPORTED_CHECK\n *              - LZMA_OPTIONS_ERROR\n *              - LZMA_MEM_ERROR\n *              - LZMA_DATA_ERROR\n *              - LZMA_PROG_ERROR\n */\nextern LZMA_API(lzma_ret) lzma_stream_buffer_encode(\n\t\tlzma_filter *filters, lzma_check check,\n\t\tlzma_allocator *allocator, const uint8_t *in, size_t in_size,\n\t\tuint8_t *out, size_t *out_pos, size_t out_size)\n\t\tlzma_nothrow lzma_attr_warn_unused_result;\n\n\n/************\n * Decoding *\n ************/\n\n/**\n * This flag makes lzma_code() return LZMA_NO_CHECK if the input stream\n * being decoded has no integrity check. Note that when used with\n * lzma_auto_decoder(), all .lzma files will trigger LZMA_NO_CHECK\n * if LZMA_TELL_NO_CHECK is used.\n */\n#define LZMA_TELL_NO_CHECK              UINT32_C(0x01)\n\n\n/**\n * This flag makes lzma_code() return LZMA_UNSUPPORTED_CHECK if the input\n * stream has an integrity check, but the type of the integrity check is not\n * supported by this liblzma version or build. Such files can still be\n * decoded, but the integrity check cannot be verified.\n */\n#define LZMA_TELL_UNSUPPORTED_CHECK     UINT32_C(0x02)\n\n\n/**\n * This flag makes lzma_code() return LZMA_GET_CHECK as soon as the type\n * of the integrity check is known. The type can then be got with\n * lzma_get_check().\n */\n#define LZMA_TELL_ANY_CHECK             UINT32_C(0x04)\n\n\n/**\n * This flag enables decoding of concatenated files with file formats that\n * allow concatenating compressed files as is. From the formats currently\n * supported by liblzma, only the .xz format allows concatenated files.\n * Concatenated files are not allowed with the legacy .lzma format.\n *\n * This flag also affects the usage of the `action' argument for lzma_code().\n * When LZMA_CONCATENATED is used, lzma_code() won't return LZMA_STREAM_END\n * unless LZMA_FINISH is used as `action'. Thus, the application has to set\n * LZMA_FINISH in the same way as it does when encoding.\n *\n * If LZMA_CONCATENATED is not used, the decoders still accept LZMA_FINISH\n * as `action' for lzma_code(), but the usage of LZMA_FINISH isn't required.\n */\n#define LZMA_CONCATENATED               UINT32_C(0x08)\n\n\n/**\n * \\brief       Initialize .xz Stream decoder\n *\n * \\param       strm        Pointer to properly prepared lzma_stream\n * \\param       memlimit    Memory usage limit as bytes. Use UINT64_MAX\n *                          to effectively disable the limiter.\n * \\param       flags       Bitwise-or of zero or more of the decoder flags:\n *                          LZMA_TELL_NO_CHECK, LZMA_TELL_UNSUPPORTED_CHECK,\n *                          LZMA_TELL_ANY_CHECK, LZMA_CONCATENATED\n *\n * \\return      - LZMA_OK: Initialization was successful.\n *              - LZMA_MEM_ERROR: Cannot allocate memory.\n *              - LZMA_OPTIONS_ERROR: Unsupported flags\n *              - LZMA_PROG_ERROR\n */\nextern LZMA_API(lzma_ret) lzma_stream_decoder(\n\t\tlzma_stream *strm, uint64_t memlimit, uint32_t flags)\n\t\tlzma_nothrow lzma_attr_warn_unused_result;\n\n\n/**\n * \\brief       Decode .xz Streams and .lzma files with autodetection\n *\n * This decoder autodetects between the .xz and .lzma file formats, and\n * calls lzma_stream_decoder() or lzma_alone_decoder() once the type\n * of the input file has been detected.\n *\n * \\param       strm        Pointer to properly prepared lzma_stream\n * \\param       memlimit    Memory usage limit as bytes. Use UINT64_MAX\n *                          to effectively disable the limiter.\n * \\param       flags       Bitwise-or of flags, or zero for no flags.\n *\n * \\return      - LZMA_OK: Initialization was successful.\n *              - LZMA_MEM_ERROR: Cannot allocate memory.\n *              - LZMA_OPTIONS_ERROR: Unsupported flags\n *              - LZMA_PROG_ERROR\n */\nextern LZMA_API(lzma_ret) lzma_auto_decoder(\n\t\tlzma_stream *strm, uint64_t memlimit, uint32_t flags)\n\t\tlzma_nothrow lzma_attr_warn_unused_result;\n\n\n/**\n * \\brief       Initialize .lzma decoder (legacy file format)\n *\n * Valid `action' arguments to lzma_code() are LZMA_RUN and LZMA_FINISH.\n * There is no need to use LZMA_FINISH, but allowing it may simplify\n * certain types of applications.\n *\n * \\return      - LZMA_OK\n *              - LZMA_MEM_ERROR\n *              - LZMA_PROG_ERROR\n */\nextern LZMA_API(lzma_ret) lzma_alone_decoder(\n\t\tlzma_stream *strm, uint64_t memlimit)\n\t\tlzma_nothrow lzma_attr_warn_unused_result;\n\n\n/**\n * \\brief       Single-call .xz Stream decoder\n *\n * \\param       memlimit    Pointer to how much memory the decoder is allowed\n *                          to allocate. The value pointed by this pointer is\n *                          modified if and only if LZMA_MEMLIMIT_ERROR is\n *                          returned.\n * \\param       flags       Bitwise-or of zero or more of the decoder flags:\n *                          LZMA_TELL_NO_CHECK, LZMA_TELL_UNSUPPORTED_CHECK,\n *                          LZMA_CONCATENATED. Note that LZMA_TELL_ANY_CHECK\n *                          is not allowed and will return LZMA_PROG_ERROR.\n * \\param       allocator   lzma_allocator for custom allocator functions.\n *                          Set to NULL to use malloc() and free().\n * \\param       in          Beginning of the input buffer\n * \\param       in_pos      The next byte will be read from in[*in_pos].\n *                          *in_pos is updated only if decoding succeeds.\n * \\param       in_size     Size of the input buffer; the first byte that\n *                          won't be read is in[in_size].\n * \\param       out         Beginning of the output buffer\n * \\param       out_pos     The next byte will be written to out[*out_pos].\n *                          *out_pos is updated only if decoding succeeds.\n * \\param       out_size    Size of the out buffer; the first byte into\n *                          which no data is written to is out[out_size].\n *\n * \\return      - LZMA_OK: Decoding was successful.\n *              - LZMA_FORMAT_ERROR\n *              - LZMA_OPTIONS_ERROR\n *              - LZMA_DATA_ERROR\n *              - LZMA_NO_CHECK: This can be returned only if using\n *                the LZMA_TELL_NO_CHECK flag.\n *              - LZMA_UNSUPPORTED_CHECK: This can be returned only if using\n *                the LZMA_TELL_UNSUPPORTED_CHECK flag.\n *              - LZMA_MEM_ERROR\n *              - LZMA_MEMLIMIT_ERROR: Memory usage limit was reached.\n *                The minimum required memlimit value was stored to *memlimit.\n *              - LZMA_BUF_ERROR: Output buffer was too small.\n *              - LZMA_PROG_ERROR\n */\nextern LZMA_API(lzma_ret) lzma_stream_buffer_decode(\n\t\tuint64_t *memlimit, uint32_t flags, lzma_allocator *allocator,\n\t\tconst uint8_t *in, size_t *in_pos, size_t in_size,\n\t\tuint8_t *out, size_t *out_pos, size_t out_size)\n\t\tlzma_nothrow lzma_attr_warn_unused_result;\n"
  },
  {
    "path": "freebsd-headers/lzma/delta.h",
    "content": "/**\n * \\file        lzma/delta.h\n * \\brief       Delta filter\n */\n\n/*\n * Author: Lasse Collin\n *\n * This file has been put into the public domain.\n * You can do whatever you want with this file.\n *\n * See ../lzma.h for information about liblzma as a whole.\n */\n\n#ifndef LZMA_H_INTERNAL\n#\terror Never include this file directly. Use <lzma.h> instead.\n#endif\n\n\n/**\n * \\brief       Filter ID\n *\n * Filter ID of the Delta filter. This is used as lzma_filter.id.\n */\n#define LZMA_FILTER_DELTA       LZMA_VLI_C(0x03)\n\n\n/**\n * \\brief       Type of the delta calculation\n *\n * Currently only byte-wise delta is supported. Other possible types could\n * be, for example, delta of 16/32/64-bit little/big endian integers, but\n * these are not currently planned since byte-wise delta is almost as good.\n */\ntypedef enum {\n\tLZMA_DELTA_TYPE_BYTE\n} lzma_delta_type;\n\n\n/**\n * \\brief       Options for the Delta filter\n *\n * These options are needed by both encoder and decoder.\n */\ntypedef struct {\n\t/** For now, this must always be LZMA_DELTA_TYPE_BYTE. */\n\tlzma_delta_type type;\n\n\t/**\n\t * \\brief       Delta distance\n\t *\n\t * With the only currently supported type, LZMA_DELTA_TYPE_BYTE,\n\t * the distance is as bytes.\n\t *\n\t * Examples:\n\t *  - 16-bit stereo audio: distance = 4 bytes\n\t *  - 24-bit RGB image data: distance = 3 bytes\n\t */\n\tuint32_t dist;\n#\tdefine LZMA_DELTA_DIST_MIN 1\n#\tdefine LZMA_DELTA_DIST_MAX 256\n\n\t/*\n\t * Reserved space to allow possible future extensions without\n\t * breaking the ABI. You should not touch these, because the names\n\t * of these variables may change. These are and will never be used\n\t * when type is LZMA_DELTA_TYPE_BYTE, so it is safe to leave these\n\t * uninitialized.\n\t */\n\tuint32_t reserved_int1;\n\tuint32_t reserved_int2;\n\tuint32_t reserved_int3;\n\tuint32_t reserved_int4;\n\tvoid *reserved_ptr1;\n\tvoid *reserved_ptr2;\n\n} lzma_options_delta;\n"
  },
  {
    "path": "freebsd-headers/lzma/filter.h",
    "content": "/**\n * \\file        lzma/filter.h\n * \\brief       Common filter related types and functions\n */\n\n/*\n * Author: Lasse Collin\n *\n * This file has been put into the public domain.\n * You can do whatever you want with this file.\n *\n * See ../lzma.h for information about liblzma as a whole.\n */\n\n#ifndef LZMA_H_INTERNAL\n#\terror Never include this file directly. Use <lzma.h> instead.\n#endif\n\n\n/**\n * \\brief       Maximum number of filters in a chain\n *\n * A filter chain can have 1-4 filters, of which three are allowed to change\n * the size of the data. Usually only one or two filters are needed.\n */\n#define LZMA_FILTERS_MAX 4\n\n\n/**\n * \\brief       Filter options\n *\n * This structure is used to pass Filter ID and a pointer filter's\n * options to liblzma. A few functions work with a single lzma_filter\n * structure, while most functions expect a filter chain.\n *\n * A filter chain is indicated with an array of lzma_filter structures.\n * The array is terminated with .id = LZMA_VLI_UNKNOWN. Thus, the filter\n * array must have LZMA_FILTERS_MAX + 1 elements (that is, five) to\n * be able to hold any arbitrary filter chain. This is important when\n * using lzma_block_header_decode() from block.h, because too small\n * array would make liblzma write past the end of the filters array.\n */\ntypedef struct {\n\t/**\n\t * \\brief       Filter ID\n\t *\n\t * Use constants whose name begin with `LZMA_FILTER_' to specify\n\t * different filters. In an array of lzma_filter structures, use\n\t * LZMA_VLI_UNKNOWN to indicate end of filters.\n\t *\n\t * \\note        This is not an enum, because on some systems enums\n\t *              cannot be 64-bit.\n\t */\n\tlzma_vli id;\n\n\t/**\n\t * \\brief       Pointer to filter-specific options structure\n\t *\n\t * If the filter doesn't need options, set this to NULL. If id is\n\t * set to LZMA_VLI_UNKNOWN, options is ignored, and thus\n\t * doesn't need be initialized.\n\t */\n\tvoid *options;\n\n} lzma_filter;\n\n\n/**\n * \\brief       Test if the given Filter ID is supported for encoding\n *\n * Return true if the give Filter ID is supported for encoding by this\n * liblzma build. Otherwise false is returned.\n *\n * There is no way to list which filters are available in this particular\n * liblzma version and build. It would be useless, because the application\n * couldn't know what kind of options the filter would need.\n */\nextern LZMA_API(lzma_bool) lzma_filter_encoder_is_supported(lzma_vli id)\n\t\tlzma_nothrow lzma_attr_const;\n\n\n/**\n * \\brief       Test if the given Filter ID is supported for decoding\n *\n * Return true if the give Filter ID is supported for decoding by this\n * liblzma build. Otherwise false is returned.\n */\nextern LZMA_API(lzma_bool) lzma_filter_decoder_is_supported(lzma_vli id)\n\t\tlzma_nothrow lzma_attr_const;\n\n\n/**\n * \\brief       Copy the filters array\n *\n * Copy the Filter IDs and filter-specific options from src to dest.\n * Up to LZMA_FILTERS_MAX filters are copied, plus the terminating\n * .id == LZMA_VLI_UNKNOWN. Thus, dest should have at least\n * LZMA_FILTERS_MAX + 1 elements space unless the caller knows that\n * src is smaller than that.\n *\n * Unless the filter-specific options is NULL, the Filter ID has to be\n * supported by liblzma, because liblzma needs to know the size of every\n * filter-specific options structure. The filter-specific options are not\n * validated. If options is NULL, any unsupported Filter IDs are copied\n * without returning an error.\n *\n * Old filter-specific options in dest are not freed, so dest doesn't\n * need to be initialized by the caller in any way.\n *\n * If an error occurs, memory possibly already allocated by this function\n * is always freed.\n *\n * \\return      - LZMA_OK\n *              - LZMA_MEM_ERROR\n *              - LZMA_OPTIONS_ERROR: Unsupported Filter ID and its options\n *                is not NULL.\n *              - LZMA_PROG_ERROR: src or dest is NULL.\n */\nextern LZMA_API(lzma_ret) lzma_filters_copy(const lzma_filter *src,\n\t\tlzma_filter *dest, lzma_allocator *allocator) lzma_nothrow;\n\n\n/**\n * \\brief       Calculate approximate memory requirements for raw encoder\n *\n * This function can be used to calculate the memory requirements for\n * Block and Stream encoders too because Block and Stream encoders don't\n * need significantly more memory than raw encoder.\n *\n * \\param       filters     Array of filters terminated with\n *                          .id == LZMA_VLI_UNKNOWN.\n *\n * \\return      Number of bytes of memory required for the given\n *              filter chain when encoding. If an error occurs,\n *              for example due to unsupported filter chain,\n *              UINT64_MAX is returned.\n */\nextern LZMA_API(uint64_t) lzma_raw_encoder_memusage(const lzma_filter *filters)\n\t\tlzma_nothrow lzma_attr_pure;\n\n\n/**\n * \\brief       Calculate approximate memory requirements for raw decoder\n *\n * This function can be used to calculate the memory requirements for\n * Block and Stream decoders too because Block and Stream decoders don't\n * need significantly more memory than raw decoder.\n *\n * \\param       filters     Array of filters terminated with\n *                          .id == LZMA_VLI_UNKNOWN.\n *\n * \\return      Number of bytes of memory required for the given\n *              filter chain when decoding. If an error occurs,\n *              for example due to unsupported filter chain,\n *              UINT64_MAX is returned.\n */\nextern LZMA_API(uint64_t) lzma_raw_decoder_memusage(const lzma_filter *filters)\n\t\tlzma_nothrow lzma_attr_pure;\n\n\n/**\n * \\brief       Initialize raw encoder\n *\n * This function may be useful when implementing custom file formats.\n *\n * \\param       strm    Pointer to properly prepared lzma_stream\n * \\param       filters Array of lzma_filter structures. The end of the\n *                      array must be marked with .id = LZMA_VLI_UNKNOWN.\n *\n * The `action' with lzma_code() can be LZMA_RUN, LZMA_SYNC_FLUSH (if the\n * filter chain supports it), or LZMA_FINISH.\n *\n * \\return      - LZMA_OK\n *              - LZMA_MEM_ERROR\n *              - LZMA_OPTIONS_ERROR\n *              - LZMA_PROG_ERROR\n */\nextern LZMA_API(lzma_ret) lzma_raw_encoder(\n\t\tlzma_stream *strm, const lzma_filter *filters)\n\t\tlzma_nothrow lzma_attr_warn_unused_result;\n\n\n/**\n * \\brief       Initialize raw decoder\n *\n * The initialization of raw decoder goes similarly to raw encoder.\n *\n * The `action' with lzma_code() can be LZMA_RUN or LZMA_FINISH. Using\n * LZMA_FINISH is not required, it is supported just for convenience.\n *\n * \\return      - LZMA_OK\n *              - LZMA_MEM_ERROR\n *              - LZMA_OPTIONS_ERROR\n *              - LZMA_PROG_ERROR\n */\nextern LZMA_API(lzma_ret) lzma_raw_decoder(\n\t\tlzma_stream *strm, const lzma_filter *filters)\n\t\tlzma_nothrow lzma_attr_warn_unused_result;\n\n\n/**\n * \\brief       Update the filter chain in the encoder\n *\n * This function is for advanced users only. This function has two slightly\n * different purposes:\n *\n *  - After LZMA_FULL_FLUSH when using Stream encoder: Set a new filter\n *    chain, which will be used starting from the next Block.\n *\n *  - After LZMA_SYNC_FLUSH using Raw, Block, or Stream encoder: Change\n *    the filter-specific options in the middle of encoding. The actual\n *    filters in the chain (Filter IDs) cannot be changed. In the future,\n *    it might become possible to change the filter options without\n *    using LZMA_SYNC_FLUSH.\n *\n * While rarely useful, this function may be called also when no data has\n * been compressed yet. In that case, this function will behave as if\n * LZMA_FULL_FLUSH (Stream encoder) or LZMA_SYNC_FLUSH (Raw or Block\n * encoder) had been used right before calling this function.\n *\n * \\return      - LZMA_OK\n *              - LZMA_MEM_ERROR\n *              - LZMA_MEMLIMIT_ERROR\n *              - LZMA_OPTIONS_ERROR\n *              - LZMA_PROG_ERROR\n */\nextern LZMA_API(lzma_ret) lzma_filters_update(\n\t\tlzma_stream *strm, const lzma_filter *filters) lzma_nothrow;\n\n\n/**\n * \\brief       Single-call raw encoder\n *\n * \\param       filters     Array of lzma_filter structures. The end of the\n *                          array must be marked with .id = LZMA_VLI_UNKNOWN.\n * \\param       allocator   lzma_allocator for custom allocator functions.\n *                          Set to NULL to use malloc() and free().\n * \\param       in          Beginning of the input buffer\n * \\param       in_size     Size of the input buffer\n * \\param       out         Beginning of the output buffer\n * \\param       out_pos     The next byte will be written to out[*out_pos].\n *                          *out_pos is updated only if encoding succeeds.\n * \\param       out_size    Size of the out buffer; the first byte into\n *                          which no data is written to is out[out_size].\n *\n * \\return      - LZMA_OK: Encoding was successful.\n *              - LZMA_BUF_ERROR: Not enough output buffer space.\n *              - LZMA_OPTIONS_ERROR\n *              - LZMA_MEM_ERROR\n *              - LZMA_DATA_ERROR\n *              - LZMA_PROG_ERROR\n *\n * \\note        There is no function to calculate how big output buffer\n *              would surely be big enough. (lzma_stream_buffer_bound()\n *              works only for lzma_stream_buffer_encode(); raw encoder\n *              won't necessarily meet that bound.)\n */\nextern LZMA_API(lzma_ret) lzma_raw_buffer_encode(\n\t\tconst lzma_filter *filters, lzma_allocator *allocator,\n\t\tconst uint8_t *in, size_t in_size, uint8_t *out,\n\t\tsize_t *out_pos, size_t out_size) lzma_nothrow;\n\n\n/**\n * \\brief       Single-call raw decoder\n *\n * \\param       filters     Array of lzma_filter structures. The end of the\n *                          array must be marked with .id = LZMA_VLI_UNKNOWN.\n * \\param       allocator   lzma_allocator for custom allocator functions.\n *                          Set to NULL to use malloc() and free().\n * \\param       in          Beginning of the input buffer\n * \\param       in_pos      The next byte will be read from in[*in_pos].\n *                          *in_pos is updated only if decoding succeeds.\n * \\param       in_size     Size of the input buffer; the first byte that\n *                          won't be read is in[in_size].\n * \\param       out         Beginning of the output buffer\n * \\param       out_pos     The next byte will be written to out[*out_pos].\n *                          *out_pos is updated only if encoding succeeds.\n * \\param       out_size    Size of the out buffer; the first byte into\n *                          which no data is written to is out[out_size].\n */\nextern LZMA_API(lzma_ret) lzma_raw_buffer_decode(\n\t\tconst lzma_filter *filters, lzma_allocator *allocator,\n\t\tconst uint8_t *in, size_t *in_pos, size_t in_size,\n\t\tuint8_t *out, size_t *out_pos, size_t out_size) lzma_nothrow;\n\n\n/**\n * \\brief       Get the size of the Filter Properties field\n *\n * This function may be useful when implementing custom file formats\n * using the raw encoder and decoder.\n *\n * \\param       size    Pointer to uint32_t to hold the size of the properties\n * \\param       filter  Filter ID and options (the size of the properties may\n *                      vary depending on the options)\n *\n * \\return      - LZMA_OK\n *              - LZMA_OPTIONS_ERROR\n *              - LZMA_PROG_ERROR\n *\n * \\note        This function validates the Filter ID, but does not\n *              necessarily validate the options. Thus, it is possible\n *              that this returns LZMA_OK while the following call to\n *              lzma_properties_encode() returns LZMA_OPTIONS_ERROR.\n */\nextern LZMA_API(lzma_ret) lzma_properties_size(\n\t\tuint32_t *size, const lzma_filter *filter) lzma_nothrow;\n\n\n/**\n * \\brief       Encode the Filter Properties field\n *\n * \\param       filter  Filter ID and options\n * \\param       props   Buffer to hold the encoded options. The size of\n *                      buffer must have been already determined with\n *                      lzma_properties_size().\n *\n * \\return      - LZMA_OK\n *              - LZMA_OPTIONS_ERROR\n *              - LZMA_PROG_ERROR\n *\n * \\note        Even this function won't validate more options than actually\n *              necessary. Thus, it is possible that encoding the properties\n *              succeeds but using the same options to initialize the encoder\n *              will fail.\n *\n * \\note        If lzma_properties_size() indicated that the size\n *              of the Filter Properties field is zero, calling\n *              lzma_properties_encode() is not required, but it\n *              won't do any harm either.\n */\nextern LZMA_API(lzma_ret) lzma_properties_encode(\n\t\tconst lzma_filter *filter, uint8_t *props) lzma_nothrow;\n\n\n/**\n * \\brief       Decode the Filter Properties field\n *\n * \\param       filter      filter->id must have been set to the correct\n *                          Filter ID. filter->options doesn't need to be\n *                          initialized (it's not freed by this function). The\n *                          decoded options will be stored to filter->options.\n *                          filter->options is set to NULL if there are no\n *                          properties or if an error occurs.\n * \\param       allocator   Custom memory allocator used to allocate the\n *                          options. Set to NULL to use the default malloc(),\n *                          and in case of an error, also free().\n * \\param       props       Input buffer containing the properties.\n * \\param       props_size  Size of the properties. This must be the exact\n *                          size; giving too much or too little input will\n *                          return LZMA_OPTIONS_ERROR.\n *\n * \\return      - LZMA_OK\n *              - LZMA_OPTIONS_ERROR\n *              - LZMA_MEM_ERROR\n */\nextern LZMA_API(lzma_ret) lzma_properties_decode(\n\t\tlzma_filter *filter, lzma_allocator *allocator,\n\t\tconst uint8_t *props, size_t props_size) lzma_nothrow;\n\n\n/**\n * \\brief       Calculate encoded size of a Filter Flags field\n *\n * Knowing the size of Filter Flags is useful to know when allocating\n * memory to hold the encoded Filter Flags.\n *\n * \\param       size    Pointer to integer to hold the calculated size\n * \\param       filter  Filter ID and associated options whose encoded\n *                      size is to be calculated\n *\n * \\return      - LZMA_OK: *size set successfully. Note that this doesn't\n *                guarantee that filter->options is valid, thus\n *                lzma_filter_flags_encode() may still fail.\n *              - LZMA_OPTIONS_ERROR: Unknown Filter ID or unsupported options.\n *              - LZMA_PROG_ERROR: Invalid options\n *\n * \\note        If you need to calculate size of List of Filter Flags,\n *              you need to loop over every lzma_filter entry.\n */\nextern LZMA_API(lzma_ret) lzma_filter_flags_size(\n\t\tuint32_t *size, const lzma_filter *filter)\n\t\tlzma_nothrow lzma_attr_warn_unused_result;\n\n\n/**\n * \\brief       Encode Filter Flags into given buffer\n *\n * In contrast to some functions, this doesn't allocate the needed buffer.\n * This is due to how this function is used internally by liblzma.\n *\n * \\param       filter      Filter ID and options to be encoded\n * \\param       out         Beginning of the output buffer\n * \\param       out_pos     out[*out_pos] is the next write position. This\n *                          is updated by the encoder.\n * \\param       out_size    out[out_size] is the first byte to not write.\n *\n * \\return      - LZMA_OK: Encoding was successful.\n *              - LZMA_OPTIONS_ERROR: Invalid or unsupported options.\n *              - LZMA_PROG_ERROR: Invalid options or not enough output\n *                buffer space (you should have checked it with\n *                lzma_filter_flags_size()).\n */\nextern LZMA_API(lzma_ret) lzma_filter_flags_encode(const lzma_filter *filter,\n\t\tuint8_t *out, size_t *out_pos, size_t out_size)\n\t\tlzma_nothrow lzma_attr_warn_unused_result;\n\n\n/**\n * \\brief       Decode Filter Flags from given buffer\n *\n * The decoded result is stored into *filter. The old value of\n * filter->options is not free()d.\n *\n * \\return      - LZMA_OK\n *              - LZMA_OPTIONS_ERROR\n *              - LZMA_MEM_ERROR\n *              - LZMA_PROG_ERROR\n */\nextern LZMA_API(lzma_ret) lzma_filter_flags_decode(\n\t\tlzma_filter *filter, lzma_allocator *allocator,\n\t\tconst uint8_t *in, size_t *in_pos, size_t in_size)\n\t\tlzma_nothrow lzma_attr_warn_unused_result;\n"
  },
  {
    "path": "freebsd-headers/lzma/hardware.h",
    "content": "/**\n * \\file        lzma/hardware.h\n * \\brief       Hardware information\n *\n * Since liblzma can consume a lot of system resources, it also provides\n * ways to limit the resource usage. Applications linking against liblzma\n * need to do the actual decisions how much resources to let liblzma to use.\n * To ease making these decisions, liblzma provides functions to find out\n * the relevant capabilities of the underlaying hardware. Currently there\n * is only a function to find out the amount of RAM, but in the future there\n * will be also a function to detect how many concurrent threads the system\n * can run.\n *\n * \\note        On some operating systems, these function may temporarily\n *              load a shared library or open file descriptor(s) to find out\n *              the requested hardware information. Unless the application\n *              assumes that specific file descriptors are not touched by\n *              other threads, this should have no effect on thread safety.\n *              Possible operations involving file descriptors will restart\n *              the syscalls if they return EINTR.\n */\n\n/*\n * Author: Lasse Collin\n *\n * This file has been put into the public domain.\n * You can do whatever you want with this file.\n *\n * See ../lzma.h for information about liblzma as a whole.\n */\n\n#ifndef LZMA_H_INTERNAL\n#\terror Never include this file directly. Use <lzma.h> instead.\n#endif\n\n\n/**\n * \\brief       Get the total amount of physical memory (RAM) in bytes\n *\n * This function may be useful when determining a reasonable memory\n * usage limit for decompressing or how much memory it is OK to use\n * for compressing.\n *\n * \\return      On success, the total amount of physical memory in bytes\n *              is returned. If the amount of RAM cannot be determined,\n *              zero is returned. This can happen if an error occurs\n *              or if there is no code in liblzma to detect the amount\n *              of RAM on the specific operating system.\n */\nextern LZMA_API(uint64_t) lzma_physmem(void) lzma_nothrow;\n"
  },
  {
    "path": "freebsd-headers/lzma/index.h",
    "content": "/**\n * \\file        lzma/index.h\n * \\brief       Handling of .xz Index and related information\n */\n\n/*\n * Author: Lasse Collin\n *\n * This file has been put into the public domain.\n * You can do whatever you want with this file.\n *\n * See ../lzma.h for information about liblzma as a whole.\n */\n\n#ifndef LZMA_H_INTERNAL\n#\terror Never include this file directly. Use <lzma.h> instead.\n#endif\n\n\n/**\n * \\brief       Opaque data type to hold the Index(es) and other information\n *\n * lzma_index often holds just one .xz Index and possibly the Stream Flags\n * of the same Stream and size of the Stream Padding field. However,\n * multiple lzma_indexes can be concatenated with lzma_index_cat() and then\n * there may be information about multiple Streams in the same lzma_index.\n *\n * Notes about thread safety: Only one thread may modify lzma_index at\n * a time. All functions that take non-const pointer to lzma_index\n * modify it. As long as no thread is modifying the lzma_index, getting\n * information from the same lzma_index can be done from multiple threads\n * at the same time with functions that take a const pointer to\n * lzma_index or use lzma_index_iter. The same iterator must be used\n * only by one thread at a time, of course, but there can be as many\n * iterators for the same lzma_index as needed.\n */\ntypedef struct lzma_index_s lzma_index;\n\n\n/**\n * \\brief       Iterator to get information about Blocks and Streams\n */\ntypedef struct {\n\tstruct {\n\t\t/**\n\t\t * \\brief       Pointer to Stream Flags\n\t\t *\n\t\t * This is NULL if Stream Flags have not been set for\n\t\t * this Stream with lzma_index_stream_flags().\n\t\t */\n\t\tconst lzma_stream_flags *flags;\n\n\t\tconst void *reserved_ptr1;\n\t\tconst void *reserved_ptr2;\n\t\tconst void *reserved_ptr3;\n\n\t\t/**\n\t\t * \\brief       Stream number in the lzma_index\n\t\t *\n\t\t * The first Stream is 1.\n\t\t */\n\t\tlzma_vli number;\n\n\t\t/**\n\t\t * \\brief       Number of Blocks in the Stream\n\t\t *\n\t\t * If this is zero, the block structure below has\n\t\t * undefined values.\n\t\t */\n\t\tlzma_vli block_count;\n\n\t\t/**\n\t\t * \\brief       Compressed start offset of this Stream\n\t\t *\n\t\t * The offset is relative to the beginning of the lzma_index\n\t\t * (i.e. usually the beginning of the .xz file).\n\t\t */\n\t\tlzma_vli compressed_offset;\n\n\t\t/**\n\t\t * \\brief       Uncompressed start offset of this Stream\n\t\t *\n\t\t * The offset is relative to the beginning of the lzma_index\n\t\t * (i.e. usually the beginning of the .xz file).\n\t\t */\n\t\tlzma_vli uncompressed_offset;\n\n\t\t/**\n\t\t * \\brief       Compressed size of this Stream\n\t\t *\n\t\t * This includes all headers except the possible\n\t\t * Stream Padding after this Stream.\n\t\t */\n\t\tlzma_vli compressed_size;\n\n\t\t/**\n\t\t * \\brief       Uncompressed size of this Stream\n\t\t */\n\t\tlzma_vli uncompressed_size;\n\n\t\t/**\n\t\t * \\brief       Size of Stream Padding after this Stream\n\t\t *\n\t\t * If it hasn't been set with lzma_index_stream_padding(),\n\t\t * this defaults to zero. Stream Padding is always\n\t\t * a multiple of four bytes.\n\t\t */\n\t\tlzma_vli padding;\n\n\t\tlzma_vli reserved_vli1;\n\t\tlzma_vli reserved_vli2;\n\t\tlzma_vli reserved_vli3;\n\t\tlzma_vli reserved_vli4;\n\t} stream;\n\n\tstruct {\n\t\t/**\n\t\t * \\brief       Block number in the file\n\t\t *\n\t\t * The first Block is 1.\n\t\t */\n\t\tlzma_vli number_in_file;\n\n\t\t/**\n\t\t * \\brief       Compressed start offset of this Block\n\t\t *\n\t\t * This offset is relative to the beginning of the\n\t\t * lzma_index (i.e. usually the beginning of the .xz file).\n\t\t * Normally this is where you should seek in the .xz file\n\t\t * to start decompressing this Block.\n\t\t */\n\t\tlzma_vli compressed_file_offset;\n\n\t\t/**\n\t\t * \\brief       Uncompressed start offset of this Block\n\t\t *\n\t\t * This offset is relative to the beginning of the lzma_index\n\t\t * (i.e. usually the beginning of the .xz file).\n\t\t *\n\t\t * When doing random-access reading, it is possible that\n\t\t * the target offset is not exactly at Block boundary. One\n\t\t * will need to compare the target offset against\n\t\t * uncompressed_file_offset or uncompressed_stream_offset,\n\t\t * and possibly decode and throw away some amount of data\n\t\t * before reaching the target offset.\n\t\t */\n\t\tlzma_vli uncompressed_file_offset;\n\n\t\t/**\n\t\t * \\brief       Block number in this Stream\n\t\t *\n\t\t * The first Block is 1.\n\t\t */\n\t\tlzma_vli number_in_stream;\n\n\t\t/**\n\t\t * \\brief       Compressed start offset of this Block\n\t\t *\n\t\t * This offset is relative to the beginning of the Stream\n\t\t * containing this Block.\n\t\t */\n\t\tlzma_vli compressed_stream_offset;\n\n\t\t/**\n\t\t * \\brief       Uncompressed start offset of this Block\n\t\t *\n\t\t * This offset is relative to the beginning of the Stream\n\t\t * containing this Block.\n\t\t */\n\t\tlzma_vli uncompressed_stream_offset;\n\n\t\t/**\n\t\t * \\brief       Uncompressed size of this Block\n\t\t *\n\t\t * You should pass this to the Block decoder if you will\n\t\t * decode this Block. It will allow the Block decoder to\n\t\t * validate the uncompressed size.\n\t\t */\n\t\tlzma_vli uncompressed_size;\n\n\t\t/**\n\t\t * \\brief       Unpadded size of this Block\n\t\t *\n\t\t * You should pass this to the Block decoder if you will\n\t\t * decode this Block. It will allow the Block decoder to\n\t\t * validate the unpadded size.\n\t\t */\n\t\tlzma_vli unpadded_size;\n\n\t\t/**\n\t\t * \\brief       Total compressed size\n\t\t *\n\t\t * This includes all headers and padding in this Block.\n\t\t * This is useful if you need to know how many bytes\n\t\t * the Block decoder will actually read.\n\t\t */\n\t\tlzma_vli total_size;\n\n\t\tlzma_vli reserved_vli1;\n\t\tlzma_vli reserved_vli2;\n\t\tlzma_vli reserved_vli3;\n\t\tlzma_vli reserved_vli4;\n\n\t\tconst void *reserved_ptr1;\n\t\tconst void *reserved_ptr2;\n\t\tconst void *reserved_ptr3;\n\t\tconst void *reserved_ptr4;\n\t} block;\n\n\t/*\n\t * Internal data which is used to store the state of the iterator.\n\t * The exact format may vary between liblzma versions, so don't\n\t * touch these in any way.\n\t */\n\tunion {\n\t\tconst void *p;\n\t\tsize_t s;\n\t\tlzma_vli v;\n\t} internal[6];\n} lzma_index_iter;\n\n\n/**\n * \\brief       Operation mode for lzma_index_iter_next()\n */\ntypedef enum {\n\tLZMA_INDEX_ITER_ANY             = 0,\n\t\t/**<\n\t\t * \\brief       Get the next Block or Stream\n\t\t *\n\t\t * Go to the next Block if the current Stream has at least\n\t\t * one Block left. Otherwise go to the next Stream even if\n\t\t * it has no Blocks. If the Stream has no Blocks\n\t\t * (lzma_index_iter.stream.block_count == 0),\n\t\t * lzma_index_iter.block will have undefined values.\n\t\t */\n\n\tLZMA_INDEX_ITER_STREAM          = 1,\n\t\t/**<\n\t\t * \\brief       Get the next Stream\n\t\t *\n\t\t * Go to the next Stream even if the current Stream has\n\t\t * unread Blocks left. If the next Stream has at least one\n\t\t * Block, the iterator will point to the first Block.\n\t\t * If there are no Blocks, lzma_index_iter.block will have\n\t\t * undefined values.\n\t\t */\n\n\tLZMA_INDEX_ITER_BLOCK           = 2,\n\t\t/**<\n\t\t * \\brief       Get the next Block\n\t\t *\n\t\t * Go to the next Block if the current Stream has at least\n\t\t * one Block left. If the current Stream has no Blocks left,\n\t\t * the next Stream with at least one Block is located and\n\t\t * the iterator will be made to point to the first Block of\n\t\t * that Stream.\n\t\t */\n\n\tLZMA_INDEX_ITER_NONEMPTY_BLOCK  = 3\n\t\t/**<\n\t\t * \\brief       Get the next non-empty Block\n\t\t *\n\t\t * This is like LZMA_INDEX_ITER_BLOCK except that it will\n\t\t * skip Blocks whose Uncompressed Size is zero.\n\t\t */\n\n} lzma_index_iter_mode;\n\n\n/**\n * \\brief       Calculate memory usage of lzma_index\n *\n * On disk, the size of the Index field depends on both the number of Records\n * stored and how big values the Records store (due to variable-length integer\n * encoding). When the Index is kept in lzma_index structure, the memory usage\n * depends only on the number of Records/Blocks stored in the Index(es), and\n * in case of concatenated lzma_indexes, the number of Streams. The size in\n * RAM is almost always significantly bigger than in the encoded form on disk.\n *\n * This function calculates an approximate amount of memory needed hold\n * the given number of Streams and Blocks in lzma_index structure. This\n * value may vary between CPU architectures and also between liblzma versions\n * if the internal implementation is modified.\n */\nextern LZMA_API(uint64_t) lzma_index_memusage(\n\t\tlzma_vli streams, lzma_vli blocks) lzma_nothrow;\n\n\n/**\n * \\brief       Calculate the memory usage of an existing lzma_index\n *\n * This is a shorthand for lzma_index_memusage(lzma_index_stream_count(i),\n * lzma_index_block_count(i)).\n */\nextern LZMA_API(uint64_t) lzma_index_memused(const lzma_index *i)\n\t\tlzma_nothrow;\n\n\n/**\n * \\brief       Allocate and initialize a new lzma_index structure\n *\n * \\return      On success, a pointer to an empty initialized lzma_index is\n *              returned. If allocation fails, NULL is returned.\n */\nextern LZMA_API(lzma_index *) lzma_index_init(lzma_allocator *allocator)\n\t\tlzma_nothrow;\n\n\n/**\n * \\brief       Deallocate lzma_index\n *\n * If i is NULL, this does nothing.\n */\nextern LZMA_API(void) lzma_index_end(lzma_index *i, lzma_allocator *allocator)\n\t\tlzma_nothrow;\n\n\n/**\n * \\brief       Add a new Block to lzma_index\n *\n * \\param       i                 Pointer to a lzma_index structure\n * \\param       allocator         Pointer to lzma_allocator, or NULL to\n *                                use malloc()\n * \\param       unpadded_size     Unpadded Size of a Block. This can be\n *                                calculated with lzma_block_unpadded_size()\n *                                after encoding or decoding the Block.\n * \\param       uncompressed_size Uncompressed Size of a Block. This can be\n *                                taken directly from lzma_block structure\n *                                after encoding or decoding the Block.\n *\n * Appending a new Block does not invalidate iterators. For example,\n * if an iterator was pointing to the end of the lzma_index, after\n * lzma_index_append() it is possible to read the next Block with\n * an existing iterator.\n *\n * \\return      - LZMA_OK\n *              - LZMA_MEM_ERROR\n *              - LZMA_DATA_ERROR: Compressed or uncompressed size of the\n *                Stream or size of the Index field would grow too big.\n *              - LZMA_PROG_ERROR\n */\nextern LZMA_API(lzma_ret) lzma_index_append(\n\t\tlzma_index *i, lzma_allocator *allocator,\n\t\tlzma_vli unpadded_size, lzma_vli uncompressed_size)\n\t\tlzma_nothrow lzma_attr_warn_unused_result;\n\n\n/**\n * \\brief       Set the Stream Flags\n *\n * Set the Stream Flags of the last (and typically the only) Stream\n * in lzma_index. This can be useful when reading information from the\n * lzma_index, because to decode Blocks, knowing the integrity check type\n * is needed.\n *\n * The given Stream Flags are copied into internal preallocated structure\n * in the lzma_index, thus the caller doesn't need to keep the *stream_flags\n * available after calling this function.\n *\n * \\return      - LZMA_OK\n *              - LZMA_OPTIONS_ERROR: Unsupported stream_flags->version.\n *              - LZMA_PROG_ERROR\n */\nextern LZMA_API(lzma_ret) lzma_index_stream_flags(\n\t\tlzma_index *i, const lzma_stream_flags *stream_flags)\n\t\tlzma_nothrow lzma_attr_warn_unused_result;\n\n\n/**\n * \\brief       Get the types of integrity Checks\n *\n * If lzma_index_stream_flags() is used to set the Stream Flags for\n * every Stream, lzma_index_checks() can be used to get a bitmask to\n * indicate which Check types have been used. It can be useful e.g. if\n * showing the Check types to the user.\n *\n * The bitmask is 1 << check_id, e.g. CRC32 is 1 << 1 and SHA-256 is 1 << 10.\n */\nextern LZMA_API(uint32_t) lzma_index_checks(const lzma_index *i)\n\t\tlzma_nothrow lzma_attr_pure;\n\n\n/**\n * \\brief       Set the amount of Stream Padding\n *\n * Set the amount of Stream Padding of the last (and typically the only)\n * Stream in the lzma_index. This is needed when planning to do random-access\n * reading within multiple concatenated Streams.\n *\n * By default, the amount of Stream Padding is assumed to be zero bytes.\n *\n * \\return      - LZMA_OK\n *              - LZMA_DATA_ERROR: The file size would grow too big.\n *              - LZMA_PROG_ERROR\n */\nextern LZMA_API(lzma_ret) lzma_index_stream_padding(\n\t\tlzma_index *i, lzma_vli stream_padding)\n\t\tlzma_nothrow lzma_attr_warn_unused_result;\n\n\n/**\n * \\brief       Get the number of Streams\n */\nextern LZMA_API(lzma_vli) lzma_index_stream_count(const lzma_index *i)\n\t\tlzma_nothrow lzma_attr_pure;\n\n\n/**\n * \\brief       Get the number of Blocks\n *\n * This returns the total number of Blocks in lzma_index. To get number\n * of Blocks in individual Streams, use lzma_index_iter.\n */\nextern LZMA_API(lzma_vli) lzma_index_block_count(const lzma_index *i)\n\t\tlzma_nothrow lzma_attr_pure;\n\n\n/**\n * \\brief       Get the size of the Index field as bytes\n *\n * This is needed to verify the Backward Size field in the Stream Footer.\n */\nextern LZMA_API(lzma_vli) lzma_index_size(const lzma_index *i)\n\t\tlzma_nothrow lzma_attr_pure;\n\n\n/**\n * \\brief       Get the total size of the Stream\n *\n * If multiple lzma_indexes have been combined, this works as if the Blocks\n * were in a single Stream. This is useful if you are going to combine\n * Blocks from multiple Streams into a single new Stream.\n */\nextern LZMA_API(lzma_vli) lzma_index_stream_size(const lzma_index *i)\n\t\tlzma_nothrow lzma_attr_pure;\n\n\n/**\n * \\brief       Get the total size of the Blocks\n *\n * This doesn't include the Stream Header, Stream Footer, Stream Padding,\n * or Index fields.\n */\nextern LZMA_API(lzma_vli) lzma_index_total_size(const lzma_index *i)\n\t\tlzma_nothrow lzma_attr_pure;\n\n\n/**\n * \\brief       Get the total size of the file\n *\n * When no lzma_indexes have been combined with lzma_index_cat() and there is\n * no Stream Padding, this function is identical to lzma_index_stream_size().\n * If multiple lzma_indexes have been combined, this includes also the headers\n * of each separate Stream and the possible Stream Padding fields.\n */\nextern LZMA_API(lzma_vli) lzma_index_file_size(const lzma_index *i)\n\t\tlzma_nothrow lzma_attr_pure;\n\n\n/**\n * \\brief       Get the uncompressed size of the file\n */\nextern LZMA_API(lzma_vli) lzma_index_uncompressed_size(const lzma_index *i)\n\t\tlzma_nothrow lzma_attr_pure;\n\n\n/**\n * \\brief       Initialize an iterator\n *\n * \\param       iter    Pointer to a lzma_index_iter structure\n * \\param       i       lzma_index to which the iterator will be associated\n *\n * This function associates the iterator with the given lzma_index, and calls\n * lzma_index_iter_rewind() on the iterator.\n *\n * This function doesn't allocate any memory, thus there is no\n * lzma_index_iter_end(). The iterator is valid as long as the\n * associated lzma_index is valid, that is, until lzma_index_end() or\n * using it as source in lzma_index_cat(). Specifically, lzma_index doesn't\n * become invalid if new Blocks are added to it with lzma_index_append() or\n * if it is used as the destination in lzma_index_cat().\n *\n * It is safe to make copies of an initialized lzma_index_iter, for example,\n * to easily restart reading at some particular position.\n */\nextern LZMA_API(void) lzma_index_iter_init(\n\t\tlzma_index_iter *iter, const lzma_index *i) lzma_nothrow;\n\n\n/**\n * \\brief       Rewind the iterator\n *\n * Rewind the iterator so that next call to lzma_index_iter_next() will\n * return the first Block or Stream.\n */\nextern LZMA_API(void) lzma_index_iter_rewind(lzma_index_iter *iter)\n\t\tlzma_nothrow;\n\n\n/**\n * \\brief       Get the next Block or Stream\n *\n * \\param       iter    Iterator initialized with lzma_index_iter_init()\n * \\param       mode    Specify what kind of information the caller wants\n *                      to get. See lzma_index_iter_mode for details.\n *\n * \\return      If next Block or Stream matching the mode was found, *iter\n *              is updated and this function returns false. If no Block or\n *              Stream matching the mode is found, *iter is not modified\n *              and this function returns true. If mode is set to an unknown\n *              value, *iter is not modified and this function returns true.\n */\nextern LZMA_API(lzma_bool) lzma_index_iter_next(\n\t\tlzma_index_iter *iter, lzma_index_iter_mode mode)\n\t\tlzma_nothrow lzma_attr_warn_unused_result;\n\n\n/**\n * \\brief       Locate a Block\n *\n * If it is possible to seek in the .xz file, it is possible to parse\n * the Index field(s) and use lzma_index_iter_locate() to do random-access\n * reading with granularity of Block size.\n *\n * \\param       iter    Iterator that was earlier initialized with\n *                      lzma_index_iter_init().\n * \\param       target  Uncompressed target offset which the caller would\n *                      like to locate from the Stream\n *\n * If the target is smaller than the uncompressed size of the Stream (can be\n * checked with lzma_index_uncompressed_size()):\n *  - Information about the Stream and Block containing the requested\n *    uncompressed offset is stored into *iter.\n *  - Internal state of the iterator is adjusted so that\n *    lzma_index_iter_next() can be used to read subsequent Blocks or Streams.\n *  - This function returns false.\n *\n * If target is greater than the uncompressed size of the Stream, *iter\n * is not modified, and this function returns true.\n */\nextern LZMA_API(lzma_bool) lzma_index_iter_locate(\n\t\tlzma_index_iter *iter, lzma_vli target) lzma_nothrow;\n\n\n/**\n * \\brief       Concatenate lzma_indexes\n *\n * Concatenating lzma_indexes is useful when doing random-access reading in\n * multi-Stream .xz file, or when combining multiple Streams into single\n * Stream.\n *\n * \\param       dest      lzma_index after which src is appended\n * \\param       src       lzma_index to be appended after dest. If this\n *                        function succeeds, the memory allocated for src\n *                        is freed or moved to be part of dest, and all\n *                        iterators pointing to src will become invalid.\n * \\param       allocator Custom memory allocator; can be NULL to use\n *                        malloc() and free().\n *\n * \\return      - LZMA_OK: lzma_indexes were concatenated successfully.\n *                src is now a dangling pointer.\n *              - LZMA_DATA_ERROR: *dest would grow too big.\n *              - LZMA_MEM_ERROR\n *              - LZMA_PROG_ERROR\n */\nextern LZMA_API(lzma_ret) lzma_index_cat(\n\t\tlzma_index *dest, lzma_index *src, lzma_allocator *allocator)\n\t\tlzma_nothrow lzma_attr_warn_unused_result;\n\n\n/**\n * \\brief       Duplicate lzma_index\n *\n * \\return      A copy of the lzma_index, or NULL if memory allocation failed.\n */\nextern LZMA_API(lzma_index *) lzma_index_dup(\n\t\tconst lzma_index *i, lzma_allocator *allocator)\n\t\tlzma_nothrow lzma_attr_warn_unused_result;\n\n\n/**\n * \\brief       Initialize .xz Index encoder\n *\n * \\param       strm        Pointer to properly prepared lzma_stream\n * \\param       i           Pointer to lzma_index which should be encoded.\n *\n * The valid `action' values for lzma_code() are LZMA_RUN and LZMA_FINISH.\n * It is enough to use only one of them (you can choose freely; use LZMA_RUN\n * to support liblzma versions older than 5.0.0).\n *\n * \\return      - LZMA_OK: Initialization succeeded, continue with lzma_code().\n *              - LZMA_MEM_ERROR\n *              - LZMA_PROG_ERROR\n */\nextern LZMA_API(lzma_ret) lzma_index_encoder(\n\t\tlzma_stream *strm, const lzma_index *i)\n\t\tlzma_nothrow lzma_attr_warn_unused_result;\n\n\n/**\n * \\brief       Initialize .xz Index decoder\n *\n * \\param       strm        Pointer to properly prepared lzma_stream\n * \\param       i           The decoded Index will be made available via\n *                          this pointer. Initially this function will\n *                          set *i to NULL (the old value is ignored). If\n *                          decoding succeeds (lzma_code() returns\n *                          LZMA_STREAM_END), *i will be set to point\n *                          to a new lzma_index, which the application\n *                          has to later free with lzma_index_end().\n * \\param       memlimit    How much memory the resulting lzma_index is\n *                          allowed to require.\n *\n * The valid `action' values for lzma_code() are LZMA_RUN and LZMA_FINISH.\n * It is enough to use only one of them (you can choose freely; use LZMA_RUN\n * to support liblzma versions older than 5.0.0).\n *\n * \\return      - LZMA_OK: Initialization succeeded, continue with lzma_code().\n *              - LZMA_MEM_ERROR\n *              - LZMA_MEMLIMIT_ERROR\n *              - LZMA_PROG_ERROR\n */\nextern LZMA_API(lzma_ret) lzma_index_decoder(\n\t\tlzma_stream *strm, lzma_index **i, uint64_t memlimit)\n\t\tlzma_nothrow lzma_attr_warn_unused_result;\n\n\n/**\n * \\brief       Single-call .xz Index encoder\n *\n * \\param       i         lzma_index to be encoded\n * \\param       out       Beginning of the output buffer\n * \\param       out_pos   The next byte will be written to out[*out_pos].\n *                        *out_pos is updated only if encoding succeeds.\n * \\param       out_size  Size of the out buffer; the first byte into\n *                        which no data is written to is out[out_size].\n *\n * \\return      - LZMA_OK: Encoding was successful.\n *              - LZMA_BUF_ERROR: Output buffer is too small. Use\n *                lzma_index_size() to find out how much output\n *                space is needed.\n *              - LZMA_PROG_ERROR\n *\n * \\note        This function doesn't take allocator argument since all\n *              the internal data is allocated on stack.\n */\nextern LZMA_API(lzma_ret) lzma_index_buffer_encode(const lzma_index *i,\n\t\tuint8_t *out, size_t *out_pos, size_t out_size) lzma_nothrow;\n\n\n/**\n * \\brief       Single-call .xz Index decoder\n *\n * \\param       i           If decoding succeeds, *i will point to a new\n *                          lzma_index, which the application has to\n *                          later free with lzma_index_end(). If an error\n *                          occurs, *i will be NULL. The old value of *i\n *                          is always ignored and thus doesn't need to be\n *                          initialized by the caller.\n * \\param       memlimit    Pointer to how much memory the resulting\n *                          lzma_index is allowed to require. The value\n *                          pointed by this pointer is modified if and only\n *                          if LZMA_MEMLIMIT_ERROR is returned.\n * \\param       allocator   Pointer to lzma_allocator, or NULL to use malloc()\n * \\param       in          Beginning of the input buffer\n * \\param       in_pos      The next byte will be read from in[*in_pos].\n *                          *in_pos is updated only if decoding succeeds.\n * \\param       in_size     Size of the input buffer; the first byte that\n *                          won't be read is in[in_size].\n *\n * \\return      - LZMA_OK: Decoding was successful.\n *              - LZMA_MEM_ERROR\n *              - LZMA_MEMLIMIT_ERROR: Memory usage limit was reached.\n *                The minimum required memlimit value was stored to *memlimit.\n *              - LZMA_DATA_ERROR\n *              - LZMA_PROG_ERROR\n */\nextern LZMA_API(lzma_ret) lzma_index_buffer_decode(lzma_index **i,\n\t\tuint64_t *memlimit, lzma_allocator *allocator,\n\t\tconst uint8_t *in, size_t *in_pos, size_t in_size)\n\t\tlzma_nothrow;\n"
  },
  {
    "path": "freebsd-headers/lzma/index_hash.h",
    "content": "/**\n * \\file        lzma/index_hash.h\n * \\brief       Validate Index by using a hash function\n *\n * Hashing makes it possible to use constant amount of memory to validate\n * Index of arbitrary size.\n */\n\n/*\n * Author: Lasse Collin\n *\n * This file has been put into the public domain.\n * You can do whatever you want with this file.\n *\n * See ../lzma.h for information about liblzma as a whole.\n */\n\n#ifndef LZMA_H_INTERNAL\n#\terror Never include this file directly. Use <lzma.h> instead.\n#endif\n\n/**\n * \\brief       Opaque data type to hold the Index hash\n */\ntypedef struct lzma_index_hash_s lzma_index_hash;\n\n\n/**\n * \\brief       Allocate and initialize a new lzma_index_hash structure\n *\n * If index_hash is NULL, a new lzma_index_hash structure is allocated,\n * initialized, and a pointer to it returned. If allocation fails, NULL\n * is returned.\n *\n * If index_hash is non-NULL, it is reinitialized and the same pointer\n * returned. In this case, return value cannot be NULL or a different\n * pointer than the index_hash that was given as an argument.\n */\nextern LZMA_API(lzma_index_hash *) lzma_index_hash_init(\n\t\tlzma_index_hash *index_hash, lzma_allocator *allocator)\n\t\tlzma_nothrow lzma_attr_warn_unused_result;\n\n\n/**\n * \\brief       Deallocate lzma_index_hash structure\n */\nextern LZMA_API(void) lzma_index_hash_end(\n\t\tlzma_index_hash *index_hash, lzma_allocator *allocator)\n\t\tlzma_nothrow;\n\n\n/**\n * \\brief       Add a new Record to an Index hash\n *\n * \\param       index             Pointer to a lzma_index_hash structure\n * \\param       unpadded_size     Unpadded Size of a Block\n * \\param       uncompressed_size Uncompressed Size of a Block\n *\n * \\return      - LZMA_OK\n *              - LZMA_DATA_ERROR: Compressed or uncompressed size of the\n *                Stream or size of the Index field would grow too big.\n *              - LZMA_PROG_ERROR: Invalid arguments or this function is being\n *                used when lzma_index_hash_decode() has already been used.\n */\nextern LZMA_API(lzma_ret) lzma_index_hash_append(lzma_index_hash *index_hash,\n\t\tlzma_vli unpadded_size, lzma_vli uncompressed_size)\n\t\tlzma_nothrow lzma_attr_warn_unused_result;\n\n\n/**\n * \\brief       Decode and validate the Index field\n *\n * After telling the sizes of all Blocks with lzma_index_hash_append(),\n * the actual Index field is decoded with this function. Specifically,\n * once decoding of the Index field has been started, no more Records\n * can be added using lzma_index_hash_append().\n *\n * This function doesn't use lzma_stream structure to pass the input data.\n * Instead, the input buffer is specified using three arguments. This is\n * because it matches better the internal APIs of liblzma.\n *\n * \\param       index_hash      Pointer to a lzma_index_hash structure\n * \\param       in              Pointer to the beginning of the input buffer\n * \\param       in_pos          in[*in_pos] is the next byte to process\n * \\param       in_size         in[in_size] is the first byte not to process\n *\n * \\return      - LZMA_OK: So far good, but more input is needed.\n *              - LZMA_STREAM_END: Index decoded successfully and it matches\n *                the Records given with lzma_index_hash_append().\n *              - LZMA_DATA_ERROR: Index is corrupt or doesn't match the\n *                information given with lzma_index_hash_append().\n *              - LZMA_BUF_ERROR: Cannot progress because *in_pos >= in_size.\n *              - LZMA_PROG_ERROR\n */\nextern LZMA_API(lzma_ret) lzma_index_hash_decode(lzma_index_hash *index_hash,\n\t\tconst uint8_t *in, size_t *in_pos, size_t in_size)\n\t\tlzma_nothrow lzma_attr_warn_unused_result;\n\n\n/**\n * \\brief       Get the size of the Index field as bytes\n *\n * This is needed to verify the Backward Size field in the Stream Footer.\n */\nextern LZMA_API(lzma_vli) lzma_index_hash_size(\n\t\tconst lzma_index_hash *index_hash)\n\t\tlzma_nothrow lzma_attr_pure;\n"
  },
  {
    "path": "freebsd-headers/lzma/lzma.h",
    "content": "/**\n * \\file        lzma/lzma.h\n * \\brief       LZMA1 and LZMA2 filters\n */\n\n/*\n * Author: Lasse Collin\n *\n * This file has been put into the public domain.\n * You can do whatever you want with this file.\n *\n * See ../lzma.h for information about liblzma as a whole.\n */\n\n#ifndef LZMA_H_INTERNAL\n#\terror Never include this file directly. Use <lzma.h> instead.\n#endif\n\n\n/**\n * \\brief       LZMA1 Filter ID\n *\n * LZMA1 is the very same thing as what was called just LZMA in LZMA Utils,\n * 7-Zip, and LZMA SDK. It's called LZMA1 here to prevent developers from\n * accidentally using LZMA when they actually want LZMA2.\n *\n * LZMA1 shouldn't be used for new applications unless you _really_ know\n * what you are doing. LZMA2 is almost always a better choice.\n */\n#define LZMA_FILTER_LZMA1       LZMA_VLI_C(0x4000000000000001)\n\n/**\n * \\brief       LZMA2 Filter ID\n *\n * Usually you want this instead of LZMA1. Compared to LZMA1, LZMA2 adds\n * support for LZMA_SYNC_FLUSH, uncompressed chunks (smaller expansion\n * when trying to compress uncompressible data), possibility to change\n * lc/lp/pb in the middle of encoding, and some other internal improvements.\n */\n#define LZMA_FILTER_LZMA2       LZMA_VLI_C(0x21)\n\n\n/**\n * \\brief       Match finders\n *\n * Match finder has major effect on both speed and compression ratio.\n * Usually hash chains are faster than binary trees.\n *\n * If you will use LZMA_SYNC_FLUSH often, the hash chains may be a better\n * choice, because binary trees get much higher compression ratio penalty\n * with LZMA_SYNC_FLUSH.\n *\n * The memory usage formulas are only rough estimates, which are closest to\n * reality when dict_size is a power of two. The formulas are  more complex\n * in reality, and can also change a little between liblzma versions. Use\n * lzma_raw_encoder_memusage() to get more accurate estimate of memory usage.\n */\ntypedef enum {\n\tLZMA_MF_HC3     = 0x03,\n\t\t/**<\n\t\t * \\brief       Hash Chain with 2- and 3-byte hashing\n\t\t *\n\t\t * Minimum nice_len: 3\n\t\t *\n\t\t * Memory usage:\n\t\t *  - dict_size <= 16 MiB: dict_size * 7.5\n\t\t *  - dict_size > 16 MiB: dict_size * 5.5 + 64 MiB\n\t\t */\n\n\tLZMA_MF_HC4     = 0x04,\n\t\t/**<\n\t\t * \\brief       Hash Chain with 2-, 3-, and 4-byte hashing\n\t\t *\n\t\t * Minimum nice_len: 4\n\t\t *\n\t\t * Memory usage:\n\t\t *  - dict_size <= 32 MiB: dict_size * 7.5\n\t\t *  - dict_size > 32 MiB: dict_size * 6.5\n\t\t */\n\n\tLZMA_MF_BT2     = 0x12,\n\t\t/**<\n\t\t * \\brief       Binary Tree with 2-byte hashing\n\t\t *\n\t\t * Minimum nice_len: 2\n\t\t *\n\t\t * Memory usage: dict_size * 9.5\n\t\t */\n\n\tLZMA_MF_BT3     = 0x13,\n\t\t/**<\n\t\t * \\brief       Binary Tree with 2- and 3-byte hashing\n\t\t *\n\t\t * Minimum nice_len: 3\n\t\t *\n\t\t * Memory usage:\n\t\t *  - dict_size <= 16 MiB: dict_size * 11.5\n\t\t *  - dict_size > 16 MiB: dict_size * 9.5 + 64 MiB\n\t\t */\n\n\tLZMA_MF_BT4     = 0x14\n\t\t/**<\n\t\t * \\brief       Binary Tree with 2-, 3-, and 4-byte hashing\n\t\t *\n\t\t * Minimum nice_len: 4\n\t\t *\n\t\t * Memory usage:\n\t\t *  - dict_size <= 32 MiB: dict_size * 11.5\n\t\t *  - dict_size > 32 MiB: dict_size * 10.5\n\t\t */\n} lzma_match_finder;\n\n\n/**\n * \\brief       Test if given match finder is supported\n *\n * Return true if the given match finder is supported by this liblzma build.\n * Otherwise false is returned. It is safe to call this with a value that\n * isn't listed in lzma_match_finder enumeration; the return value will be\n * false.\n *\n * There is no way to list which match finders are available in this\n * particular liblzma version and build. It would be useless, because\n * a new match finder, which the application developer wasn't aware,\n * could require giving additional options to the encoder that the older\n * match finders don't need.\n */\nextern LZMA_API(lzma_bool) lzma_mf_is_supported(lzma_match_finder match_finder)\n\t\tlzma_nothrow lzma_attr_const;\n\n\n/**\n * \\brief       Compression modes\n *\n * This selects the function used to analyze the data produced by the match\n * finder.\n */\ntypedef enum {\n\tLZMA_MODE_FAST = 1,\n\t\t/**<\n\t\t * \\brief       Fast compression\n\t\t *\n\t\t * Fast mode is usually at its best when combined with\n\t\t * a hash chain match finder.\n\t\t */\n\n\tLZMA_MODE_NORMAL = 2\n\t\t/**<\n\t\t * \\brief       Normal compression\n\t\t *\n\t\t * This is usually notably slower than fast mode. Use this\n\t\t * together with binary tree match finders to expose the\n\t\t * full potential of the LZMA1 or LZMA2 encoder.\n\t\t */\n} lzma_mode;\n\n\n/**\n * \\brief       Test if given compression mode is supported\n *\n * Return true if the given compression mode is supported by this liblzma\n * build. Otherwise false is returned. It is safe to call this with a value\n * that isn't listed in lzma_mode enumeration; the return value will be false.\n *\n * There is no way to list which modes are available in this particular\n * liblzma version and build. It would be useless, because a new compression\n * mode, which the application developer wasn't aware, could require giving\n * additional options to the encoder that the older modes don't need.\n */\nextern LZMA_API(lzma_bool) lzma_mode_is_supported(lzma_mode mode)\n\t\tlzma_nothrow lzma_attr_const;\n\n\n/**\n * \\brief       Options specific to the LZMA1 and LZMA2 filters\n *\n * Since LZMA1 and LZMA2 share most of the code, it's simplest to share\n * the options structure too. For encoding, all but the reserved variables\n * need to be initialized unless specifically mentioned otherwise.\n * lzma_lzma_preset() can be used to get a good starting point.\n *\n * For raw decoding, both LZMA1 and LZMA2 need dict_size, preset_dict, and\n * preset_dict_size (if preset_dict != NULL). LZMA1 needs also lc, lp, and pb.\n */\ntypedef struct {\n\t/**\n\t * \\brief       Dictionary size in bytes\n\t *\n\t * Dictionary size indicates how many bytes of the recently processed\n\t * uncompressed data is kept in memory. One method to reduce size of\n\t * the uncompressed data is to store distance-length pairs, which\n\t * indicate what data to repeat from the dictionary buffer. Thus,\n\t * the bigger the dictionary, the better the compression ratio\n\t * usually is.\n\t *\n\t * Maximum size of the dictionary depends on multiple things:\n\t *  - Memory usage limit\n\t *  - Available address space (not a problem on 64-bit systems)\n\t *  - Selected match finder (encoder only)\n\t *\n\t * Currently the maximum dictionary size for encoding is 1.5 GiB\n\t * (i.e. (UINT32_C(1) << 30) + (UINT32_C(1) << 29)) even on 64-bit\n\t * systems for certain match finder implementation reasons. In the\n\t * future, there may be match finders that support bigger\n\t * dictionaries.\n\t *\n\t * Decoder already supports dictionaries up to 4 GiB - 1 B (i.e.\n\t * UINT32_MAX), so increasing the maximum dictionary size of the\n\t * encoder won't cause problems for old decoders.\n\t *\n\t * Because extremely small dictionaries sizes would have unneeded\n\t * overhead in the decoder, the minimum dictionary size is 4096 bytes.\n\t *\n\t * \\note        When decoding, too big dictionary does no other harm\n\t *              than wasting memory.\n\t */\n\tuint32_t dict_size;\n#\tdefine LZMA_DICT_SIZE_MIN       UINT32_C(4096)\n#\tdefine LZMA_DICT_SIZE_DEFAULT   (UINT32_C(1) << 23)\n\n\t/**\n\t * \\brief       Pointer to an initial dictionary\n\t *\n\t * It is possible to initialize the LZ77 history window using\n\t * a preset dictionary. It is useful when compressing many\n\t * similar, relatively small chunks of data independently from\n\t * each other. The preset dictionary should contain typical\n\t * strings that occur in the files being compressed. The most\n\t * probable strings should be near the end of the preset dictionary.\n\t *\n\t * This feature should be used only in special situations. For\n\t * now, it works correctly only with raw encoding and decoding.\n\t * Currently none of the container formats supported by\n\t * liblzma allow preset dictionary when decoding, thus if\n\t * you create a .xz or .lzma file with preset dictionary, it\n\t * cannot be decoded with the regular decoder functions. In the\n\t * future, the .xz format will likely get support for preset\n\t * dictionary though.\n\t */\n\tconst uint8_t *preset_dict;\n\n\t/**\n\t * \\brief       Size of the preset dictionary\n\t *\n\t * Specifies the size of the preset dictionary. If the size is\n\t * bigger than dict_size, only the last dict_size bytes are\n\t * processed.\n\t *\n\t * This variable is read only when preset_dict is not NULL.\n\t * If preset_dict is not NULL but preset_dict_size is zero,\n\t * no preset dictionary is used (identical to only setting\n\t * preset_dict to NULL).\n\t */\n\tuint32_t preset_dict_size;\n\n\t/**\n\t * \\brief       Number of literal context bits\n\t *\n\t * How many of the highest bits of the previous uncompressed\n\t * eight-bit byte (also known as `literal') are taken into\n\t * account when predicting the bits of the next literal.\n\t *\n\t * E.g. in typical English text, an upper-case letter is\n\t * often followed by a lower-case letter, and a lower-case\n\t * letter is usually followed by another lower-case letter.\n\t * In the US-ASCII character set, the highest three bits are 010\n\t * for upper-case letters and 011 for lower-case letters.\n\t * When lc is at least 3, the literal coding can take advantage of\n\t * this property in the uncompressed data.\n\t *\n\t * There is a limit that applies to literal context bits and literal\n\t * position bits together: lc + lp <= 4. Without this limit the\n\t * decoding could become very slow, which could have security related\n\t * results in some cases like email servers doing virus scanning.\n\t * This limit also simplifies the internal implementation in liblzma.\n\t *\n\t * There may be LZMA1 streams that have lc + lp > 4 (maximum possible\n\t * lc would be 8). It is not possible to decode such streams with\n\t * liblzma.\n\t */\n\tuint32_t lc;\n#\tdefine LZMA_LCLP_MIN    0\n#\tdefine LZMA_LCLP_MAX    4\n#\tdefine LZMA_LC_DEFAULT  3\n\n\t/**\n\t * \\brief       Number of literal position bits\n\t *\n\t * lp affects what kind of alignment in the uncompressed data is\n\t * assumed when encoding literals. A literal is a single 8-bit byte.\n\t * See pb below for more information about alignment.\n\t */\n\tuint32_t lp;\n#\tdefine LZMA_LP_DEFAULT  0\n\n\t/**\n\t * \\brief       Number of position bits\n\t *\n\t * pb affects what kind of alignment in the uncompressed data is\n\t * assumed in general. The default means four-byte alignment\n\t * (2^ pb =2^2=4), which is often a good choice when there's\n\t * no better guess.\n\t *\n\t * When the aligment is known, setting pb accordingly may reduce\n\t * the file size a little. E.g. with text files having one-byte\n\t * alignment (US-ASCII, ISO-8859-*, UTF-8), setting pb=0 can\n\t * improve compression slightly. For UTF-16 text, pb=1 is a good\n\t * choice. If the alignment is an odd number like 3 bytes, pb=0\n\t * might be the best choice.\n\t *\n\t * Even though the assumed alignment can be adjusted with pb and\n\t * lp, LZMA1 and LZMA2 still slightly favor 16-byte alignment.\n\t * It might be worth taking into account when designing file formats\n\t * that are likely to be often compressed with LZMA1 or LZMA2.\n\t */\n\tuint32_t pb;\n#\tdefine LZMA_PB_MIN      0\n#\tdefine LZMA_PB_MAX      4\n#\tdefine LZMA_PB_DEFAULT  2\n\n\t/** Compression mode */\n\tlzma_mode mode;\n\n\t/**\n\t * \\brief       Nice length of a match\n\t *\n\t * This determines how many bytes the encoder compares from the match\n\t * candidates when looking for the best match. Once a match of at\n\t * least nice_len bytes long is found, the encoder stops looking for\n\t * better candidates and encodes the match. (Naturally, if the found\n\t * match is actually longer than nice_len, the actual length is\n\t * encoded; it's not truncated to nice_len.)\n\t *\n\t * Bigger values usually increase the compression ratio and\n\t * compression time. For most files, 32 to 128 is a good value,\n\t * which gives very good compression ratio at good speed.\n\t *\n\t * The exact minimum value depends on the match finder. The maximum\n\t * is 273, which is the maximum length of a match that LZMA1 and\n\t * LZMA2 can encode.\n\t */\n\tuint32_t nice_len;\n\n\t/** Match finder ID */\n\tlzma_match_finder mf;\n\n\t/**\n\t * \\brief       Maximum search depth in the match finder\n\t *\n\t * For every input byte, match finder searches through the hash chain\n\t * or binary tree in a loop, each iteration going one step deeper in\n\t * the chain or tree. The searching stops if\n\t *  - a match of at least nice_len bytes long is found;\n\t *  - all match candidates from the hash chain or binary tree have\n\t *    been checked; or\n\t *  - maximum search depth is reached.\n\t *\n\t * Maximum search depth is needed to prevent the match finder from\n\t * wasting too much time in case there are lots of short match\n\t * candidates. On the other hand, stopping the search before all\n\t * candidates have been checked can reduce compression ratio.\n\t *\n\t * Setting depth to zero tells liblzma to use an automatic default\n\t * value, that depends on the selected match finder and nice_len.\n\t * The default is in the range [4, 200] or so (it may vary between\n\t * liblzma versions).\n\t *\n\t * Using a bigger depth value than the default can increase\n\t * compression ratio in some cases. There is no strict maximum value,\n\t * but high values (thousands or millions) should be used with care:\n\t * the encoder could remain fast enough with typical input, but\n\t * malicious input could cause the match finder to slow down\n\t * dramatically, possibly creating a denial of service attack.\n\t */\n\tuint32_t depth;\n\n\t/*\n\t * Reserved space to allow possible future extensions without\n\t * breaking the ABI. You should not touch these, because the names\n\t * of these variables may change. These are and will never be used\n\t * with the currently supported options, so it is safe to leave these\n\t * uninitialized.\n\t */\n\tuint32_t reserved_int1;\n\tuint32_t reserved_int2;\n\tuint32_t reserved_int3;\n\tuint32_t reserved_int4;\n\tuint32_t reserved_int5;\n\tuint32_t reserved_int6;\n\tuint32_t reserved_int7;\n\tuint32_t reserved_int8;\n\tlzma_reserved_enum reserved_enum1;\n\tlzma_reserved_enum reserved_enum2;\n\tlzma_reserved_enum reserved_enum3;\n\tlzma_reserved_enum reserved_enum4;\n\tvoid *reserved_ptr1;\n\tvoid *reserved_ptr2;\n\n} lzma_options_lzma;\n\n\n/**\n * \\brief       Set a compression preset to lzma_options_lzma structure\n *\n * 0 is the fastest and 9 is the slowest. These match the switches -0 .. -9\n * of the xz command line tool. In addition, it is possible to bitwise-or\n * flags to the preset. Currently only LZMA_PRESET_EXTREME is supported.\n * The flags are defined in container.h, because the flags are used also\n * with lzma_easy_encoder().\n *\n * The preset values are subject to changes between liblzma versions.\n *\n * This function is available only if LZMA1 or LZMA2 encoder has been enabled\n * when building liblzma.\n *\n * \\return      On success, false is returned. If the preset is not\n *              supported, true is returned.\n */\nextern LZMA_API(lzma_bool) lzma_lzma_preset(\n\t\tlzma_options_lzma *options, uint32_t preset) lzma_nothrow;\n"
  },
  {
    "path": "freebsd-headers/lzma/stream_flags.h",
    "content": "/**\n * \\file        lzma/stream_flags.h\n * \\brief       .xz Stream Header and Stream Footer encoder and decoder\n */\n\n/*\n * Author: Lasse Collin\n *\n * This file has been put into the public domain.\n * You can do whatever you want with this file.\n *\n * See ../lzma.h for information about liblzma as a whole.\n */\n\n#ifndef LZMA_H_INTERNAL\n#\terror Never include this file directly. Use <lzma.h> instead.\n#endif\n\n\n/**\n * \\brief       Size of Stream Header and Stream Footer\n *\n * Stream Header and Stream Footer have the same size and they are not\n * going to change even if a newer version of the .xz file format is\n * developed in future.\n */\n#define LZMA_STREAM_HEADER_SIZE 12\n\n\n/**\n * \\brief       Options for encoding/decoding Stream Header and Stream Footer\n */\ntypedef struct {\n\t/**\n\t * \\brief       Stream Flags format version\n\t *\n\t * To prevent API and ABI breakages if new features are needed in\n\t * Stream Header or Stream Footer, a version number is used to\n\t * indicate which fields in this structure are in use. For now,\n\t * version must always be zero. With non-zero version, the\n\t * lzma_stream_header_encode() and lzma_stream_footer_encode()\n\t * will return LZMA_OPTIONS_ERROR.\n\t *\n\t * lzma_stream_header_decode() and lzma_stream_footer_decode()\n\t * will always set this to the lowest value that supports all the\n\t * features indicated by the Stream Flags field. The application\n\t * must check that the version number set by the decoding functions\n\t * is supported by the application. Otherwise it is possible that\n\t * the application will decode the Stream incorrectly.\n\t */\n\tuint32_t version;\n\n\t/**\n\t * \\brief       Backward Size\n\t *\n\t * Backward Size must be a multiple of four bytes. In this Stream\n\t * format version, Backward Size is the size of the Index field.\n\t *\n\t * Backward Size isn't actually part of the Stream Flags field, but\n\t * it is convenient to include in this structure anyway. Backward\n\t * Size is present only in the Stream Footer. There is no need to\n\t * initialize backward_size when encoding Stream Header.\n\t *\n\t * lzma_stream_header_decode() always sets backward_size to\n\t * LZMA_VLI_UNKNOWN so that it is convenient to use\n\t * lzma_stream_flags_compare() when both Stream Header and Stream\n\t * Footer have been decoded.\n\t */\n\tlzma_vli backward_size;\n#\tdefine LZMA_BACKWARD_SIZE_MIN 4\n#\tdefine LZMA_BACKWARD_SIZE_MAX (LZMA_VLI_C(1) << 34)\n\n\t/**\n\t * \\brief       Check ID\n\t *\n\t * This indicates the type of the integrity check calculated from\n\t * uncompressed data.\n\t */\n\tlzma_check check;\n\n\t/*\n\t * Reserved space to allow possible future extensions without\n\t * breaking the ABI. You should not touch these, because the\n\t * names of these variables may change.\n\t *\n\t * (We will never be able to use all of these since Stream Flags\n\t * is just two bytes plus Backward Size of four bytes. But it's\n\t * nice to have the proper types when they are needed.)\n\t */\n\tlzma_reserved_enum reserved_enum1;\n\tlzma_reserved_enum reserved_enum2;\n\tlzma_reserved_enum reserved_enum3;\n\tlzma_reserved_enum reserved_enum4;\n\tlzma_bool reserved_bool1;\n\tlzma_bool reserved_bool2;\n\tlzma_bool reserved_bool3;\n\tlzma_bool reserved_bool4;\n\tlzma_bool reserved_bool5;\n\tlzma_bool reserved_bool6;\n\tlzma_bool reserved_bool7;\n\tlzma_bool reserved_bool8;\n\tuint32_t reserved_int1;\n\tuint32_t reserved_int2;\n\n} lzma_stream_flags;\n\n\n/**\n * \\brief       Encode Stream Header\n *\n * \\param       options     Stream Header options to be encoded.\n *                          options->backward_size is ignored and doesn't\n *                          need to be initialized.\n * \\param       out         Beginning of the output buffer of\n *                          LZMA_STREAM_HEADER_SIZE bytes.\n *\n * \\return      - LZMA_OK: Encoding was successful.\n *              - LZMA_OPTIONS_ERROR: options->version is not supported by\n *                this liblzma version.\n *              - LZMA_PROG_ERROR: Invalid options.\n */\nextern LZMA_API(lzma_ret) lzma_stream_header_encode(\n\t\tconst lzma_stream_flags *options, uint8_t *out)\n\t\tlzma_nothrow lzma_attr_warn_unused_result;\n\n\n/**\n * \\brief       Encode Stream Footer\n *\n * \\param       options     Stream Footer options to be encoded.\n * \\param       out         Beginning of the output buffer of\n *                          LZMA_STREAM_HEADER_SIZE bytes.\n *\n * \\return      - LZMA_OK: Encoding was successful.\n *              - LZMA_OPTIONS_ERROR: options->version is not supported by\n *                this liblzma version.\n *              - LZMA_PROG_ERROR: Invalid options.\n */\nextern LZMA_API(lzma_ret) lzma_stream_footer_encode(\n\t\tconst lzma_stream_flags *options, uint8_t *out)\n\t\tlzma_nothrow lzma_attr_warn_unused_result;\n\n\n/**\n * \\brief       Decode Stream Header\n *\n * \\param       options     Target for the decoded Stream Header options.\n * \\param       in          Beginning of the input buffer of\n *                          LZMA_STREAM_HEADER_SIZE bytes.\n *\n * options->backward_size is always set to LZMA_VLI_UNKNOWN. This is to\n * help comparing Stream Flags from Stream Header and Stream Footer with\n * lzma_stream_flags_compare().\n *\n * \\return      - LZMA_OK: Decoding was successful.\n *              - LZMA_FORMAT_ERROR: Magic bytes don't match, thus the given\n *                buffer cannot be Stream Header.\n *              - LZMA_DATA_ERROR: CRC32 doesn't match, thus the header\n *                is corrupt.\n *              - LZMA_OPTIONS_ERROR: Unsupported options are present\n *                in the header.\n *\n * \\note        When decoding .xz files that contain multiple Streams, it may\n *              make sense to print \"file format not recognized\" only if\n *              decoding of the Stream Header of the _first_ Stream gives\n *              LZMA_FORMAT_ERROR. If non-first Stream Header gives\n *              LZMA_FORMAT_ERROR, the message used for LZMA_DATA_ERROR is\n *              probably more appropriate.\n *\n *              For example, Stream decoder in liblzma uses LZMA_DATA_ERROR if\n *              LZMA_FORMAT_ERROR is returned by lzma_stream_header_decode()\n *              when decoding non-first Stream.\n */\nextern LZMA_API(lzma_ret) lzma_stream_header_decode(\n\t\tlzma_stream_flags *options, const uint8_t *in)\n\t\tlzma_nothrow lzma_attr_warn_unused_result;\n\n\n/**\n * \\brief       Decode Stream Footer\n *\n * \\param       options     Target for the decoded Stream Header options.\n * \\param       in          Beginning of the input buffer of\n *                          LZMA_STREAM_HEADER_SIZE bytes.\n *\n * \\return      - LZMA_OK: Decoding was successful.\n *              - LZMA_FORMAT_ERROR: Magic bytes don't match, thus the given\n *                buffer cannot be Stream Footer.\n *              - LZMA_DATA_ERROR: CRC32 doesn't match, thus the Stream Footer\n *                is corrupt.\n *              - LZMA_OPTIONS_ERROR: Unsupported options are present\n *                in Stream Footer.\n *\n * \\note        If Stream Header was already decoded successfully, but\n *              decoding Stream Footer returns LZMA_FORMAT_ERROR, the\n *              application should probably report some other error message\n *              than \"file format not recognized\", since the file more likely\n *              is corrupt (possibly truncated). Stream decoder in liblzma\n *              uses LZMA_DATA_ERROR in this situation.\n */\nextern LZMA_API(lzma_ret) lzma_stream_footer_decode(\n\t\tlzma_stream_flags *options, const uint8_t *in)\n\t\tlzma_nothrow lzma_attr_warn_unused_result;\n\n\n/**\n * \\brief       Compare two lzma_stream_flags structures\n *\n * backward_size values are compared only if both are not\n * LZMA_VLI_UNKNOWN.\n *\n * \\return      - LZMA_OK: Both are equal. If either had backward_size set\n *                to LZMA_VLI_UNKNOWN, backward_size values were not\n *                compared or validated.\n *              - LZMA_DATA_ERROR: The structures differ.\n *              - LZMA_OPTIONS_ERROR: version in either structure is greater\n *                than the maximum supported version (currently zero).\n *              - LZMA_PROG_ERROR: Invalid value, e.g. invalid check or\n *                backward_size.\n */\nextern LZMA_API(lzma_ret) lzma_stream_flags_compare(\n\t\tconst lzma_stream_flags *a, const lzma_stream_flags *b)\n\t\tlzma_nothrow lzma_attr_pure;\n"
  },
  {
    "path": "freebsd-headers/lzma/version.h",
    "content": "/**\n * \\file        lzma/version.h\n * \\brief       Version number\n */\n\n/*\n * Author: Lasse Collin\n *\n * This file has been put into the public domain.\n * You can do whatever you want with this file.\n *\n * See ../lzma.h for information about liblzma as a whole.\n */\n\n#ifndef LZMA_H_INTERNAL\n#\terror Never include this file directly. Use <lzma.h> instead.\n#endif\n\n\n/*\n * Version number split into components\n */\n#define LZMA_VERSION_MAJOR 5\n#define LZMA_VERSION_MINOR 0\n#define LZMA_VERSION_PATCH 3\n#define LZMA_VERSION_STABILITY LZMA_VERSION_STABILITY_STABLE\n\n#ifndef LZMA_VERSION_COMMIT\n#\tdefine LZMA_VERSION_COMMIT \"\"\n#endif\n\n\n/*\n * Map symbolic stability levels to integers.\n */\n#define LZMA_VERSION_STABILITY_ALPHA 0\n#define LZMA_VERSION_STABILITY_BETA 1\n#define LZMA_VERSION_STABILITY_STABLE 2\n\n\n/**\n * \\brief       Compile-time version number\n *\n * The version number is of format xyyyzzzs where\n *  - x = major\n *  - yyy = minor\n *  - zzz = revision\n *  - s indicates stability: 0 = alpha, 1 = beta, 2 = stable\n *\n * The same xyyyzzz triplet is never reused with different stability levels.\n * For example, if 5.1.0alpha has been released, there will never be 5.1.0beta\n * or 5.1.0 stable.\n *\n * \\note        The version number of liblzma has nothing to with\n *              the version number of Igor Pavlov's LZMA SDK.\n */\n#define LZMA_VERSION (LZMA_VERSION_MAJOR * UINT32_C(10000000) \\\n\t\t+ LZMA_VERSION_MINOR * UINT32_C(10000) \\\n\t\t+ LZMA_VERSION_PATCH * UINT32_C(10) \\\n\t\t+ LZMA_VERSION_STABILITY)\n\n\n/*\n * Macros to construct the compile-time version string\n */\n#if LZMA_VERSION_STABILITY == LZMA_VERSION_STABILITY_ALPHA\n#\tdefine LZMA_VERSION_STABILITY_STRING \"alpha\"\n#elif LZMA_VERSION_STABILITY == LZMA_VERSION_STABILITY_BETA\n#\tdefine LZMA_VERSION_STABILITY_STRING \"beta\"\n#elif LZMA_VERSION_STABILITY == LZMA_VERSION_STABILITY_STABLE\n#\tdefine LZMA_VERSION_STABILITY_STRING \"\"\n#else\n#\terror Incorrect LZMA_VERSION_STABILITY\n#endif\n\n#define LZMA_VERSION_STRING_C_(major, minor, patch, stability, commit) \\\n\t\t#major \".\" #minor \".\" #patch stability commit\n\n#define LZMA_VERSION_STRING_C(major, minor, patch, stability, commit) \\\n\t\tLZMA_VERSION_STRING_C_(major, minor, patch, stability, commit)\n\n\n/**\n * \\brief       Compile-time version as a string\n *\n * This can be for example \"4.999.5alpha\", \"4.999.8beta\", or \"5.0.0\" (stable\n * versions don't have any \"stable\" suffix). In future, a snapshot built\n * from source code repository may include an additional suffix, for example\n * \"4.999.8beta-21-g1d92\". The commit ID won't be available in numeric form\n * in LZMA_VERSION macro.\n */\n#define LZMA_VERSION_STRING LZMA_VERSION_STRING_C( \\\n\t\tLZMA_VERSION_MAJOR, LZMA_VERSION_MINOR, \\\n\t\tLZMA_VERSION_PATCH, LZMA_VERSION_STABILITY_STRING, \\\n\t\tLZMA_VERSION_COMMIT)\n\n\n/* #ifndef is needed for use with windres (MinGW or Cygwin). */\n#ifndef LZMA_H_INTERNAL_RC\n\n/**\n * \\brief       Run-time version number as an integer\n *\n * Return the value of LZMA_VERSION macro at the compile time of liblzma.\n * This allows the application to compare if it was built against the same,\n * older, or newer version of liblzma that is currently running.\n */\nextern LZMA_API(uint32_t) lzma_version_number(void)\n\t\tlzma_nothrow lzma_attr_const;\n\n\n/**\n * \\brief       Run-time version as a string\n *\n * This function may be useful if you want to display which version of\n * liblzma your application is currently using.\n */\nextern LZMA_API(const char *) lzma_version_string(void)\n\t\tlzma_nothrow lzma_attr_const;\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/lzma/vli.h",
    "content": "/**\n * \\file        lzma/vli.h\n * \\brief       Variable-length integer handling\n *\n * In the .xz format, most integers are encoded in a variable-length\n * representation, which is sometimes called little endian base-128 encoding.\n * This saves space when smaller values are more likely than bigger values.\n *\n * The encoding scheme encodes seven bits to every byte, using minimum\n * number of bytes required to represent the given value. Encodings that use\n * non-minimum number of bytes are invalid, thus every integer has exactly\n * one encoded representation. The maximum number of bits in a VLI is 63,\n * thus the vli argument must be less than or equal to UINT64_MAX / 2. You\n * should use LZMA_VLI_MAX for clarity.\n */\n\n/*\n * Author: Lasse Collin\n *\n * This file has been put into the public domain.\n * You can do whatever you want with this file.\n *\n * See ../lzma.h for information about liblzma as a whole.\n */\n\n#ifndef LZMA_H_INTERNAL\n#\terror Never include this file directly. Use <lzma.h> instead.\n#endif\n\n\n/**\n * \\brief       Maximum supported value of a variable-length integer\n */\n#define LZMA_VLI_MAX (UINT64_MAX / 2)\n\n/**\n * \\brief       VLI value to denote that the value is unknown\n */\n#define LZMA_VLI_UNKNOWN UINT64_MAX\n\n/**\n * \\brief       Maximum supported encoded length of variable length integers\n */\n#define LZMA_VLI_BYTES_MAX 9\n\n/**\n * \\brief       VLI constant suffix\n */\n#define LZMA_VLI_C(n) UINT64_C(n)\n\n\n/**\n * \\brief       Variable-length integer type\n *\n * Valid VLI values are in the range [0, LZMA_VLI_MAX]. Unknown value is\n * indicated with LZMA_VLI_UNKNOWN, which is the maximum value of the\n * underlaying integer type.\n *\n * lzma_vli will be uint64_t for the foreseeable future. If a bigger size\n * is needed in the future, it is guaranteed that 2 * LZMA_VLI_MAX will\n * not overflow lzma_vli. This simplifies integer overflow detection.\n */\ntypedef uint64_t lzma_vli;\n\n\n/**\n * \\brief       Validate a variable-length integer\n *\n * This is useful to test that application has given acceptable values\n * for example in the uncompressed_size and compressed_size variables.\n *\n * \\return      True if the integer is representable as VLI or if it\n *              indicates unknown value.\n */\n#define lzma_vli_is_valid(vli) \\\n\t((vli) <= LZMA_VLI_MAX || (vli) == LZMA_VLI_UNKNOWN)\n\n\n/**\n * \\brief       Encode a variable-length integer\n *\n * This function has two modes: single-call and multi-call. Single-call mode\n * encodes the whole integer at once; it is an error if the output buffer is\n * too small. Multi-call mode saves the position in *vli_pos, and thus it is\n * possible to continue encoding if the buffer becomes full before the whole\n * integer has been encoded.\n *\n * \\param       vli       Integer to be encoded\n * \\param       vli_pos   How many VLI-encoded bytes have already been written\n *                        out. When starting to encode a new integer in\n *                        multi-call mode, *vli_pos must be set to zero.\n *                        To use single-call encoding, set vli_pos to NULL.\n * \\param       out       Beginning of the output buffer\n * \\param       out_pos   The next byte will be written to out[*out_pos].\n * \\param       out_size  Size of the out buffer; the first byte into\n *                        which no data is written to is out[out_size].\n *\n * \\return      Slightly different return values are used in multi-call and\n *              single-call modes.\n *\n *              Single-call (vli_pos == NULL):\n *              - LZMA_OK: Integer successfully encoded.\n *              - LZMA_PROG_ERROR: Arguments are not sane. This can be due\n *                to too little output space; single-call mode doesn't use\n *                LZMA_BUF_ERROR, since the application should have checked\n *                the encoded size with lzma_vli_size().\n *\n *              Multi-call (vli_pos != NULL):\n *              - LZMA_OK: So far all OK, but the integer is not\n *                completely written out yet.\n *              - LZMA_STREAM_END: Integer successfully encoded.\n *              - LZMA_BUF_ERROR: No output space was provided.\n *              - LZMA_PROG_ERROR: Arguments are not sane.\n */\nextern LZMA_API(lzma_ret) lzma_vli_encode(lzma_vli vli, size_t *vli_pos,\n\t\tuint8_t *out, size_t *out_pos, size_t out_size) lzma_nothrow;\n\n\n/**\n * \\brief       Decode a variable-length integer\n *\n * Like lzma_vli_encode(), this function has single-call and multi-call modes.\n *\n * \\param       vli       Pointer to decoded integer. The decoder will\n *                        initialize it to zero when *vli_pos == 0, so\n *                        application isn't required to initialize *vli.\n * \\param       vli_pos   How many bytes have already been decoded. When\n *                        starting to decode a new integer in multi-call\n *                        mode, *vli_pos must be initialized to zero. To\n *                        use single-call decoding, set vli_pos to NULL.\n * \\param       in        Beginning of the input buffer\n * \\param       in_pos    The next byte will be read from in[*in_pos].\n * \\param       in_size   Size of the input buffer; the first byte that\n *                        won't be read is in[in_size].\n *\n * \\return      Slightly different return values are used in multi-call and\n *              single-call modes.\n *\n *              Single-call (vli_pos == NULL):\n *              - LZMA_OK: Integer successfully decoded.\n *              - LZMA_DATA_ERROR: Integer is corrupt. This includes hitting\n *                the end of the input buffer before the whole integer was\n *                decoded; providing no input at all will use LZMA_DATA_ERROR.\n *              - LZMA_PROG_ERROR: Arguments are not sane.\n *\n *              Multi-call (vli_pos != NULL):\n *              - LZMA_OK: So far all OK, but the integer is not\n *                completely decoded yet.\n *              - LZMA_STREAM_END: Integer successfully decoded.\n *              - LZMA_DATA_ERROR: Integer is corrupt.\n *              - LZMA_BUF_ERROR: No input was provided.\n *              - LZMA_PROG_ERROR: Arguments are not sane.\n */\nextern LZMA_API(lzma_ret) lzma_vli_decode(lzma_vli *vli, size_t *vli_pos,\n\t\tconst uint8_t *in, size_t *in_pos, size_t in_size)\n\t\tlzma_nothrow;\n\n\n/**\n * \\brief       Get the number of bytes required to encode a VLI\n *\n * \\return      Number of bytes on success (1-9). If vli isn't valid,\n *              zero is returned.\n */\nextern LZMA_API(uint32_t) lzma_vli_size(lzma_vli vli)\n\t\tlzma_nothrow lzma_attr_pure;\n"
  },
  {
    "path": "freebsd-headers/lzma.h",
    "content": "/**\n * \\file        api/lzma.h\n * \\brief       The public API of liblzma data compression library\n *\n * liblzma is a public domain general-purpose data compression library with\n * a zlib-like API. The native file format is .xz, but also the old .lzma\n * format and raw (no headers) streams are supported. Multiple compression\n * algorithms (filters) are supported. Currently LZMA2 is the primary filter.\n *\n * liblzma is part of XZ Utils <http://tukaani.org/xz/>. XZ Utils includes\n * a gzip-like command line tool named xz and some other tools. XZ Utils\n * is developed and maintained by Lasse Collin.\n *\n * Major parts of liblzma are based on Igor Pavlov's public domain LZMA SDK\n * <http://7-zip.org/sdk.html>.\n *\n * The SHA-256 implementation is based on the public domain code found from\n * 7-Zip <http://7-zip.org/>, which has a modified version of the public\n * domain SHA-256 code found from Crypto++ <http://www.cryptopp.com/>.\n * The SHA-256 code in Crypto++ was written by Kevin Springle and Wei Dai.\n */\n\n/*\n * Author: Lasse Collin\n *\n * This file has been put into the public domain.\n * You can do whatever you want with this file.\n */\n\n#ifndef LZMA_H\n#define LZMA_H\n\n/*****************************\n * Required standard headers *\n *****************************/\n\n/*\n * liblzma API headers need some standard types and macros. To allow\n * including lzma.h without requiring the application to include other\n * headers first, lzma.h includes the required standard headers unless\n * they already seem to be included already or if LZMA_MANUAL_HEADERS\n * has been defined.\n *\n * Here's what types and macros are needed and from which headers:\n *  - stddef.h: size_t, NULL\n *  - stdint.h: uint8_t, uint32_t, uint64_t, UINT32_C(n), uint64_C(n),\n *    UINT32_MAX, UINT64_MAX\n *\n * However, inttypes.h is a little more portable than stdint.h, although\n * inttypes.h declares some unneeded things compared to plain stdint.h.\n *\n * The hacks below aren't perfect, specifically they assume that inttypes.h\n * exists and that it typedefs at least uint8_t, uint32_t, and uint64_t,\n * and that, in case of incomplete inttypes.h, unsigned int is 32-bit.\n * If the application already takes care of setting up all the types and\n * macros properly (for example by using gnulib's stdint.h or inttypes.h),\n * we try to detect that the macros are already defined and don't include\n * inttypes.h here again. However, you may define LZMA_MANUAL_HEADERS to\n * force this file to never include any system headers.\n *\n * Some could argue that liblzma API should provide all the required types,\n * for example lzma_uint64, LZMA_UINT64_C(n), and LZMA_UINT64_MAX. This was\n * seen as an unnecessary mess, since most systems already provide all the\n * necessary types and macros in the standard headers.\n *\n * Note that liblzma API still has lzma_bool, because using stdbool.h would\n * break C89 and C++ programs on many systems. sizeof(bool) in C99 isn't\n * necessarily the same as sizeof(bool) in C++.\n */\n\n#ifndef LZMA_MANUAL_HEADERS\n\t/*\n\t * I suppose this works portably also in C++. Note that in C++,\n\t * we need to get size_t into the global namespace.\n\t */\n#\tinclude <stddef.h>\n\n\t/*\n\t * Skip inttypes.h if we already have all the required macros. If we\n\t * have the macros, we assume that we have the matching typedefs too.\n\t */\n#\tif !defined(UINT32_C) || !defined(UINT64_C) \\\n\t\t\t|| !defined(UINT32_MAX) || !defined(UINT64_MAX)\n\t\t/*\n\t\t * MSVC has no C99 support, and thus it cannot be used to\n\t\t * compile liblzma. The liblzma API has to still be usable\n\t\t * from MSVC, so we need to define the required standard\n\t\t * integer types here.\n\t\t */\n#\t\tif defined(_WIN32) && defined(_MSC_VER)\n\t\t\ttypedef unsigned __int8 uint8_t;\n\t\t\ttypedef unsigned __int32 uint32_t;\n\t\t\ttypedef unsigned __int64 uint64_t;\n#\t\telse\n\t\t\t/* Use the standard inttypes.h. */\n#\t\t\tifdef __cplusplus\n\t\t\t\t/*\n\t\t\t\t * C99 sections 7.18.2 and 7.18.4 specify\n\t\t\t\t * that C++ implementations define the limit\n\t\t\t\t * and constant macros only if specifically\n\t\t\t\t * requested. Note that if you want the\n\t\t\t\t * format macros (PRIu64 etc.) too, you need\n\t\t\t\t * to define __STDC_FORMAT_MACROS before\n\t\t\t\t * including lzma.h, since re-including\n\t\t\t\t * inttypes.h with __STDC_FORMAT_MACROS\n\t\t\t\t * defined doesn't necessarily work.\n\t\t\t\t */\n#\t\t\t\tifndef __STDC_LIMIT_MACROS\n#\t\t\t\t\tdefine __STDC_LIMIT_MACROS 1\n#\t\t\t\tendif\n#\t\t\t\tifndef __STDC_CONSTANT_MACROS\n#\t\t\t\t\tdefine __STDC_CONSTANT_MACROS 1\n#\t\t\t\tendif\n#\t\t\tendif\n\n#\t\t\tinclude <inttypes.h>\n#\t\tendif\n\n\t\t/*\n\t\t * Some old systems have only the typedefs in inttypes.h, and\n\t\t * lack all the macros. For those systems, we need a few more\n\t\t * hacks. We assume that unsigned int is 32-bit and unsigned\n\t\t * long is either 32-bit or 64-bit. If these hacks aren't\n\t\t * enough, the application has to setup the types manually\n\t\t * before including lzma.h.\n\t\t */\n#\t\tifndef UINT32_C\n#\t\t\tif defined(_WIN32) && defined(_MSC_VER)\n#\t\t\t\tdefine UINT32_C(n) n ## UI32\n#\t\t\telse\n#\t\t\t\tdefine UINT32_C(n) n ## U\n#\t\t\tendif\n#\t\tendif\n\n#\t\tifndef UINT64_C\n#\t\t\tif defined(_WIN32) && defined(_MSC_VER)\n#\t\t\t\tdefine UINT64_C(n) n ## UI64\n#\t\t\telse\n\t\t\t\t/* Get ULONG_MAX. */\n#\t\t\t\tinclude <limits.h>\n#\t\t\t\tif ULONG_MAX == 4294967295UL\n#\t\t\t\t\tdefine UINT64_C(n) n ## ULL\n#\t\t\t\telse\n#\t\t\t\t\tdefine UINT64_C(n) n ## UL\n#\t\t\t\tendif\n#\t\t\tendif\n#\t\tendif\n\n#\t\tifndef UINT32_MAX\n#\t\t\tdefine UINT32_MAX (UINT32_C(4294967295))\n#\t\tendif\n\n#\t\tifndef UINT64_MAX\n#\t\t\tdefine UINT64_MAX (UINT64_C(18446744073709551615))\n#\t\tendif\n#\tendif\n#endif /* ifdef LZMA_MANUAL_HEADERS */\n\n\n/******************\n * LZMA_API macro *\n ******************/\n\n/*\n * Some systems require that the functions and function pointers are\n * declared specially in the headers. LZMA_API_IMPORT is for importing\n * symbols and LZMA_API_CALL is to specify the calling convention.\n *\n * By default it is assumed that the application will link dynamically\n * against liblzma. #define LZMA_API_STATIC in your application if you\n * want to link against static liblzma. If you don't care about portability\n * to operating systems like Windows, or at least don't care about linking\n * against static liblzma on them, don't worry about LZMA_API_STATIC. That\n * is, most developers will never need to use LZMA_API_STATIC.\n *\n * The GCC variants are a special case on Windows (Cygwin and MinGW).\n * We rely on GCC doing the right thing with its auto-import feature,\n * and thus don't use __declspec(dllimport). This way developers don't\n * need to worry about LZMA_API_STATIC. Also the calling convention is\n * omitted on Cygwin but not on MinGW.\n */\n#ifndef LZMA_API_IMPORT\n#\tif !defined(LZMA_API_STATIC) && defined(_WIN32) && !defined(__GNUC__)\n#\t\tdefine LZMA_API_IMPORT __declspec(dllimport)\n#\telse\n#\t\tdefine LZMA_API_IMPORT\n#\tendif\n#endif\n\n#ifndef LZMA_API_CALL\n#\tif defined(_WIN32) && !defined(__CYGWIN__)\n#\t\tdefine LZMA_API_CALL __cdecl\n#\telse\n#\t\tdefine LZMA_API_CALL\n#\tendif\n#endif\n\n#ifndef LZMA_API\n#\tdefine LZMA_API(type) LZMA_API_IMPORT type LZMA_API_CALL\n#endif\n\n\n/***********\n * nothrow *\n ***********/\n\n/*\n * None of the functions in liblzma may throw an exception. Even\n * the functions that use callback functions won't throw exceptions,\n * because liblzma would break if a callback function threw an exception.\n */\n#ifndef lzma_nothrow\n#\tif defined(__cplusplus)\n#\t\tdefine lzma_nothrow throw()\n#\telif __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3)\n#\t\tdefine lzma_nothrow __attribute__((__nothrow__))\n#\telse\n#\t\tdefine lzma_nothrow\n#\tendif\n#endif\n\n\n/********************\n * GNU C extensions *\n ********************/\n\n/*\n * GNU C extensions are used conditionally in the public API. It doesn't\n * break anything if these are sometimes enabled and sometimes not, only\n * affects warnings and optimizations.\n */\n#if __GNUC__ >= 3\n#\tifndef lzma_attribute\n#\t\tdefine lzma_attribute(attr) __attribute__(attr)\n#\tendif\n\n\t/* warn_unused_result was added in GCC 3.4. */\n#\tifndef lzma_attr_warn_unused_result\n#\t\tif __GNUC__ == 3 && __GNUC_MINOR__ < 4\n#\t\t\tdefine lzma_attr_warn_unused_result\n#\t\tendif\n#\tendif\n\n#else\n#\tifndef lzma_attribute\n#\t\tdefine lzma_attribute(attr)\n#\tendif\n#endif\n\n\n#ifndef lzma_attr_pure\n#\tdefine lzma_attr_pure lzma_attribute((__pure__))\n#endif\n\n#ifndef lzma_attr_const\n#\tdefine lzma_attr_const lzma_attribute((__const__))\n#endif\n\n#ifndef lzma_attr_warn_unused_result\n#\tdefine lzma_attr_warn_unused_result \\\n\t\tlzma_attribute((__warn_unused_result__))\n#endif\n\n\n/**************\n * Subheaders *\n **************/\n\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\n/*\n * Subheaders check that this is defined. It is to prevent including\n * them directly from applications.\n */\n#define LZMA_H_INTERNAL 1\n\n/* Basic features */\n#include \"lzma/version.h\"\n#include \"lzma/base.h\"\n#include \"lzma/vli.h\"\n#include \"lzma/check.h\"\n\n/* Filters */\n#include \"lzma/filter.h\"\n#include \"lzma/bcj.h\"\n#include \"lzma/delta.h\"\n#include \"lzma/lzma.h\"\n\n/* Container formats */\n#include \"lzma/container.h\"\n\n/* Advanced features */\n#include \"lzma/stream_flags.h\"\n#include \"lzma/block.h\"\n#include \"lzma/index.h\"\n#include \"lzma/index_hash.h\"\n\n/* Hardware information */\n#include \"lzma/hardware.h\"\n\n/*\n * All subheaders included. Undefine LZMA_H_INTERNAL to prevent applications\n * re-including the subheaders.\n */\n#undef LZMA_H_INTERNAL\n\n#ifdef __cplusplus\n}\n#endif\n\n#endif /* ifndef LZMA_H */\n"
  },
  {
    "path": "freebsd-headers/machine/_align.h",
    "content": "/*-\n * This file is in the public domain.\n */\n/* $FreeBSD: release/9.0.0/sys/amd64/include/_align.h 215856 2010-11-26 10:59:20Z tijl $ */\n\n#include <x86/_align.h>\n"
  },
  {
    "path": "freebsd-headers/machine/_bus.h",
    "content": "/*-\n * Copyright (c) 2005 M. Warner Losh.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions, and the following disclaimer,\n *    without modification, immediately at the beginning of the file.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in\n *    the documentation and/or other materials provided with the\n *    distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR\n * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/amd64/include/_bus.h 145253 2005-04-18 21:45:34Z imp $\n */\n\n#ifndef AMD64_INCLUDE__BUS_H\n#define AMD64_INCLUDE__BUS_H\n\n/*\n * Bus address and size types\n */\ntypedef uint64_t bus_addr_t;\ntypedef uint64_t bus_size_t;\n\n/*\n * Access methods for bus resources and address space.\n */\ntypedef\tuint64_t bus_space_tag_t;\ntypedef\tuint64_t bus_space_handle_t;\n\n#endif /* AMD64_INCLUDE__BUS_H */\n"
  },
  {
    "path": "freebsd-headers/machine/_inttypes.h",
    "content": "/*-\n * This file is in the public domain.\n */\n/* $FreeBSD: release/9.0.0/sys/amd64/include/_inttypes.h 217157 2011-01-08 18:09:48Z tijl $ */\n\n#include <x86/_inttypes.h>\n"
  },
  {
    "path": "freebsd-headers/machine/_limits.h",
    "content": "/*-\n * Copyright (c) 1988, 1993\n *\tThe Regents of the University of California.  All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 4. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t@(#)limits.h\t8.3 (Berkeley) 1/4/94\n * $FreeBSD: release/9.0.0/sys/amd64/include/_limits.h 217145 2011-01-08 11:13:34Z tijl $\n */\n\n#ifndef\t_MACHINE__LIMITS_H_\n#define\t_MACHINE__LIMITS_H_\n\n/*\n * According to ANSI (section 2.2.4.2), the values below must be usable by\n * #if preprocessing directives.  Additionally, the expression must have the\n * same type as would an expression that is an object of the corresponding\n * type converted according to the integral promotions.  The subtraction for\n * INT_MIN, etc., is so the value is not unsigned; e.g., 0x80000000 is an\n * unsigned int for 32-bit two's complement ANSI compilers (section 3.1.3.2).\n */\n\n#define\t__CHAR_BIT\t8\t\t/* number of bits in a char */\n\n#define\t__SCHAR_MAX\t0x7f\t\t/* max value for a signed char */\n#define\t__SCHAR_MIN\t(-0x7f - 1)\t/* min value for a signed char */\n\n#define\t__UCHAR_MAX\t0xff\t\t/* max value for an unsigned char */\n\n#define\t__USHRT_MAX\t0xffff\t\t/* max value for an unsigned short */\n#define\t__SHRT_MAX\t0x7fff\t\t/* max value for a short */\n#define\t__SHRT_MIN\t(-0x7fff - 1)\t/* min value for a short */\n\n#define\t__UINT_MAX\t0xffffffff\t/* max value for an unsigned int */\n#define\t__INT_MAX\t0x7fffffff\t/* max value for an int */\n#define\t__INT_MIN\t(-0x7fffffff - 1)\t/* min value for an int */\n\n#define\t__ULONG_MAX\t0xffffffffffffffff\t/* max for an unsigned long */\n#define\t__LONG_MAX\t0x7fffffffffffffff\t/* max for a long */\n#define\t__LONG_MIN\t(-0x7fffffffffffffff - 1) /* min for a long */\n\n\t\t\t/* max value for an unsigned long long */\n#define\t__ULLONG_MAX\t0xffffffffffffffffULL\n#define\t__LLONG_MAX\t0x7fffffffffffffffLL\t/* max value for a long long */\n#define\t__LLONG_MIN\t(-0x7fffffffffffffffLL - 1)  /* min for a long long */\n\n#define\t__SSIZE_MAX\t__LONG_MAX\t/* max value for a ssize_t */\n\n#define\t__SIZE_T_MAX\t__ULONG_MAX\t/* max value for a size_t */\n\n#define\t__OFF_MAX\t__LONG_MAX\t/* max value for an off_t */\n#define\t__OFF_MIN\t__LONG_MIN\t/* min value for an off_t */\n\n/* Quads and longs are the same on the amd64.  Ensure they stay in sync. */\n#define\t__UQUAD_MAX\t__ULONG_MAX\t/* max value for a uquad_t */\n#define\t__QUAD_MAX\t__LONG_MAX\t/* max value for a quad_t */\n#define\t__QUAD_MIN\t__LONG_MIN\t/* min value for a quad_t */\n\n#define\t__LONG_BIT\t64\n#define\t__WORD_BIT\t32\n\n/* Minimum signal stack size. */\n#define\t__MINSIGSTKSZ\t(512 * 4)\n\n#endif /* !_MACHINE__LIMITS_H_ */\n"
  },
  {
    "path": "freebsd-headers/machine/_stdint.h",
    "content": "/*-\n * Copyright (c) 2001, 2002 Mike Barcroft <mike@FreeBSD.org>\n * Copyright (c) 2001 The NetBSD Foundation, Inc.\n * All rights reserved.\n *\n * This code is derived from software contributed to The NetBSD Foundation\n * by Klaus Klein.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. All advertising materials mentioning features or use of this software\n *    must display the following acknowledgement:\n *        This product includes software developed by the NetBSD\n *        Foundation, Inc. and its contributors.\n * 4. Neither the name of The NetBSD Foundation nor the names of its\n *    contributors may be used to endorse or promote products derived\n *    from this software without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS\n * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED\n * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\n * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS\n * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\n * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\n * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\n * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\n * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/amd64/include/_stdint.h 217147 2011-01-08 12:43:05Z tijl $\n */\n\n#ifndef _MACHINE__STDINT_H_\n#define\t_MACHINE__STDINT_H_\n\n#if !defined(__cplusplus) || defined(__STDC_CONSTANT_MACROS)\n\n#define\tINT8_C(c)\t\t(c)\n#define\tINT16_C(c)\t\t(c)\n#define\tINT32_C(c)\t\t(c)\n#define\tINT64_C(c)\t\t(c ## L)\n\n#define\tUINT8_C(c)\t\t(c)\n#define\tUINT16_C(c)\t\t(c)\n#define\tUINT32_C(c)\t\t(c ## U)\n#define\tUINT64_C(c)\t\t(c ## UL)\n\n#define\tINTMAX_C(c)\t\tINT64_C(c)\n#define\tUINTMAX_C(c)\t\tUINT64_C(c)\n\n#endif /* !defined(__cplusplus) || defined(__STDC_CONSTANT_MACROS) */\n\n#if !defined(__cplusplus) || defined(__STDC_LIMIT_MACROS)\n\n/*\n * ISO/IEC 9899:1999\n * 7.18.2.1 Limits of exact-width integer types\n */\n/* Minimum values of exact-width signed integer types. */\n#define\tINT8_MIN\t(-0x7f-1)\n#define\tINT16_MIN\t(-0x7fff-1)\n#define\tINT32_MIN\t(-0x7fffffff-1)\n#define\tINT64_MIN\t(-0x7fffffffffffffffL-1)\n\n/* Maximum values of exact-width signed integer types. */\n#define\tINT8_MAX\t0x7f\n#define\tINT16_MAX\t0x7fff\n#define\tINT32_MAX\t0x7fffffff\n#define\tINT64_MAX\t0x7fffffffffffffffL\n\n/* Maximum values of exact-width unsigned integer types. */\n#define\tUINT8_MAX\t0xff\n#define\tUINT16_MAX\t0xffff\n#define\tUINT32_MAX\t0xffffffffU\n#define\tUINT64_MAX\t0xffffffffffffffffUL\n\n/*\n * ISO/IEC 9899:1999\n * 7.18.2.2  Limits of minimum-width integer types\n */\n/* Minimum values of minimum-width signed integer types. */\n#define\tINT_LEAST8_MIN\tINT8_MIN\n#define\tINT_LEAST16_MIN\tINT16_MIN\n#define\tINT_LEAST32_MIN\tINT32_MIN\n#define\tINT_LEAST64_MIN\tINT64_MIN\n\n/* Maximum values of minimum-width signed integer types. */\n#define\tINT_LEAST8_MAX\tINT8_MAX\n#define\tINT_LEAST16_MAX\tINT16_MAX\n#define\tINT_LEAST32_MAX\tINT32_MAX\n#define\tINT_LEAST64_MAX\tINT64_MAX\n\n/* Maximum values of minimum-width unsigned integer types. */\n#define\tUINT_LEAST8_MAX\t UINT8_MAX\n#define\tUINT_LEAST16_MAX UINT16_MAX\n#define\tUINT_LEAST32_MAX UINT32_MAX\n#define\tUINT_LEAST64_MAX UINT64_MAX\n\n/*\n * ISO/IEC 9899:1999\n * 7.18.2.3  Limits of fastest minimum-width integer types\n */\n/* Minimum values of fastest minimum-width signed integer types. */\n#define\tINT_FAST8_MIN\tINT32_MIN\n#define\tINT_FAST16_MIN\tINT32_MIN\n#define\tINT_FAST32_MIN\tINT32_MIN\n#define\tINT_FAST64_MIN\tINT64_MIN\n\n/* Maximum values of fastest minimum-width signed integer types. */\n#define\tINT_FAST8_MAX\tINT32_MAX\n#define\tINT_FAST16_MAX\tINT32_MAX\n#define\tINT_FAST32_MAX\tINT32_MAX\n#define\tINT_FAST64_MAX\tINT64_MAX\n\n/* Maximum values of fastest minimum-width unsigned integer types. */\n#define\tUINT_FAST8_MAX\tUINT32_MAX\n#define\tUINT_FAST16_MAX\tUINT32_MAX\n#define\tUINT_FAST32_MAX\tUINT32_MAX\n#define\tUINT_FAST64_MAX\tUINT64_MAX\n\n/*\n * ISO/IEC 9899:1999\n * 7.18.2.4  Limits of integer types capable of holding object pointers\n */\n#define\tINTPTR_MIN\tINT64_MIN\n#define\tINTPTR_MAX\tINT64_MAX\n#define\tUINTPTR_MAX\tUINT64_MAX\n\n/*\n * ISO/IEC 9899:1999\n * 7.18.2.5  Limits of greatest-width integer types\n */\n#define\tINTMAX_MIN\tINT64_MIN\n#define\tINTMAX_MAX\tINT64_MAX\n#define\tUINTMAX_MAX\tUINT64_MAX\n\n/*\n * ISO/IEC 9899:1999\n * 7.18.3  Limits of other integer types\n */\n/* Limits of ptrdiff_t. */\n#define\tPTRDIFF_MIN\tINT64_MIN\t\n#define\tPTRDIFF_MAX\tINT64_MAX\n\n/* Limits of sig_atomic_t. */\n#define\tSIG_ATOMIC_MIN\tINT32_MIN\n#define\tSIG_ATOMIC_MAX\tINT32_MAX\n\n/* Limit of size_t. */\n#define\tSIZE_MAX\tUINT64_MAX\n\n#ifndef WCHAR_MIN /* Also possibly defined in <wchar.h> */\n/* Limits of wchar_t. */\n#define\tWCHAR_MIN\tINT32_MIN\n#define\tWCHAR_MAX\tINT32_MAX\n#endif\n\n/* Limits of wint_t. */\n#define\tWINT_MIN\tINT32_MIN\n#define\tWINT_MAX\tINT32_MAX\n\n#endif /* !defined(__cplusplus) || defined(__STDC_LIMIT_MACROS) */\n\n#endif /* !_MACHINE__STDINT_H_ */\n"
  },
  {
    "path": "freebsd-headers/machine/_types.h",
    "content": "/*-\n * Copyright (c) 2002 Mike Barcroft <mike@FreeBSD.org>\n * Copyright (c) 1990, 1993\n *\tThe Regents of the University of California.  All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. All advertising materials mentioning features or use of this software\n *    must display the following acknowledgement:\n *\tThis product includes software developed by the University of\n *\tCalifornia, Berkeley and its contributors.\n * 4. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\tFrom: @(#)ansi.h\t8.2 (Berkeley) 1/4/94\n *\tFrom: @(#)types.h\t8.3 (Berkeley) 1/5/94\n * $FreeBSD: release/9.0.0/sys/amd64/include/_types.h 222813 2011-06-07 08:46:13Z attilio $\n */\n\n#ifndef _MACHINE__TYPES_H_\n#define\t_MACHINE__TYPES_H_\n\n#ifndef _SYS_CDEFS_H_\n#error this file needs sys/cdefs.h as a prerequisite\n#endif\n\n#define __NO_STRICT_ALIGNMENT\n\n/*\n * Basic types upon which most other types are built.\n */\ntypedef\t__signed char\t\t__int8_t;\ntypedef\tunsigned char\t\t__uint8_t;\ntypedef\tshort\t\t\t__int16_t;\ntypedef\tunsigned short\t\t__uint16_t;\ntypedef\tint\t\t\t__int32_t;\ntypedef\tunsigned int\t\t__uint32_t;\ntypedef\tlong\t\t\t__int64_t;\ntypedef\tunsigned long\t\t__uint64_t;\n\n/*\n * Standard type definitions.\n */\ntypedef\t__int32_t\t__clock_t;\t\t/* clock()... */\ntypedef\t__int64_t\t__critical_t;\ntypedef\tdouble\t\t__double_t;\ntypedef\tfloat\t\t__float_t;\ntypedef\t__int64_t\t__intfptr_t;\ntypedef\t__int64_t\t__intmax_t;\ntypedef\t__int64_t\t__intptr_t;\ntypedef\t__int32_t\t__int_fast8_t;\ntypedef\t__int32_t\t__int_fast16_t;\ntypedef\t__int32_t\t__int_fast32_t;\ntypedef\t__int64_t\t__int_fast64_t;\ntypedef\t__int8_t\t__int_least8_t;\ntypedef\t__int16_t\t__int_least16_t;\ntypedef\t__int32_t\t__int_least32_t;\ntypedef\t__int64_t\t__int_least64_t;\ntypedef\t__int64_t\t__ptrdiff_t;\t\t/* ptr1 - ptr2 */\ntypedef\t__int64_t\t__register_t;\ntypedef\t__int64_t\t__segsz_t;\t\t/* segment size (in pages) */\ntypedef\t__uint64_t\t__size_t;\t\t/* sizeof() */\ntypedef\t__int64_t\t__ssize_t;\t\t/* byte count or error */\ntypedef\t__int64_t\t__time_t;\t\t/* time()... */\ntypedef\t__uint64_t\t__uintfptr_t;\ntypedef\t__uint64_t\t__uintmax_t;\ntypedef\t__uint64_t\t__uintptr_t;\ntypedef\t__uint32_t\t__uint_fast8_t;\ntypedef\t__uint32_t\t__uint_fast16_t;\ntypedef\t__uint32_t\t__uint_fast32_t;\ntypedef\t__uint64_t\t__uint_fast64_t;\ntypedef\t__uint8_t\t__uint_least8_t;\ntypedef\t__uint16_t\t__uint_least16_t;\ntypedef\t__uint32_t\t__uint_least32_t;\ntypedef\t__uint64_t\t__uint_least64_t;\ntypedef\t__uint64_t\t__u_register_t;\ntypedef\t__uint64_t\t__vm_offset_t;\ntypedef\t__int64_t\t__vm_ooffset_t;\ntypedef\t__uint64_t\t__vm_paddr_t;\ntypedef\t__uint64_t\t__vm_pindex_t;\ntypedef\t__uint64_t\t__vm_size_t;\n\n/*\n * Unusual type definitions.\n */\n#ifdef __GNUCLIKE_BUILTIN_VARARGS\ntypedef\t__builtin_va_list\t__va_list;\t/* internally known to gcc */\n#elif defined(lint)\ntypedef\tchar *\t\t\t__va_list;\t/* pretend */\n#endif\n#if defined(__GNUC_VA_LIST_COMPATIBILITY) && !defined(__GNUC_VA_LIST) \\\n    && !defined(__NO_GNUC_VA_LIST)\n#define __GNUC_VA_LIST\ntypedef __va_list\t\t__gnuc_va_list;\t/* compatibility w/GNU headers*/\n#endif\n\n#endif /* !_MACHINE__TYPES_H_ */\n"
  },
  {
    "path": "freebsd-headers/machine/acpica_machdep.h",
    "content": "/*-\n * Copyright (c) 2002 Mitsuru IWASAKI\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/amd64/include/acpica_machdep.h 197439 2009-09-23 15:42:35Z jhb $\n */\n\n/******************************************************************************\n *\n * Name: acpica_machdep.h - arch-specific defines, etc.\n *       $Revision$\n *\n *****************************************************************************/\n\n#ifndef __ACPICA_MACHDEP_H__\n#define\t__ACPICA_MACHDEP_H__\n\n#ifdef _KERNEL\n/*\n * Calling conventions:\n *\n * ACPI_SYSTEM_XFACE        - Interfaces to host OS (handlers, threads)\n * ACPI_EXTERNAL_XFACE      - External ACPI interfaces \n * ACPI_INTERNAL_XFACE      - Internal ACPI interfaces\n * ACPI_INTERNAL_VAR_XFACE  - Internal variable-parameter list interfaces\n */\n#define\tACPI_SYSTEM_XFACE\n#define\tACPI_EXTERNAL_XFACE\n#define\tACPI_INTERNAL_XFACE\n#define\tACPI_INTERNAL_VAR_XFACE\n\n/* Asm macros */\n\n#define\tACPI_ASM_MACROS\n#define\tBREAKPOINT3\n#define\tACPI_DISABLE_IRQS() disable_intr()\n#define\tACPI_ENABLE_IRQS()  enable_intr()\n\n#define\tACPI_FLUSH_CPU_CACHE()\twbinvd()\n\n/* Section 5.2.9.1:  global lock acquire/release functions */\nextern int\tacpi_acquire_global_lock(uint32_t *lock);\nextern int\tacpi_release_global_lock(uint32_t *lock);\n#define\tACPI_ACQUIRE_GLOBAL_LOCK(GLptr, Acq)\tdo {\t\t\t\\\n\t(Acq) = acpi_acquire_global_lock(&((GLptr)->GlobalLock));\t\\\n} while (0)\n#define\tACPI_RELEASE_GLOBAL_LOCK(GLptr, Acq)\tdo {\t\t\t\\\n\t(Acq) = acpi_release_global_lock(&((GLptr)->GlobalLock));\t\\\n} while (0)\n \n#endif /* _KERNEL */\n\n#define\tACPI_MACHINE_WIDTH             64\n#define\tCOMPILER_DEPENDENT_INT64       long\n#define\tCOMPILER_DEPENDENT_UINT64      unsigned long\n\nvoid\tacpi_SetDefaultIntrModel(int model);\nvoid\tacpi_cpu_c1(void);\nvoid\t*acpi_map_table(vm_paddr_t pa, const char *sig);\nvoid\tacpi_unmap_table(void *table);\nvm_paddr_t acpi_find_table(const char *sig);\n\n#endif /* __ACPICA_MACHDEP_H__ */\n"
  },
  {
    "path": "freebsd-headers/machine/apicvar.h",
    "content": "/*-\n * Copyright (c) 2003 John Baldwin <jhb@FreeBSD.org>\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. Neither the name of the author nor the names of any co-contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/amd64/include/apicvar.h 212541 2010-09-13 07:25:35Z mav $\n */\n\n#ifndef _MACHINE_APICVAR_H_\n#define _MACHINE_APICVAR_H_\n\n#include <machine/segments.h>\n\n/*\n * Local && I/O APIC variable definitions.\n */\n\n/*\n * Layout of local APIC interrupt vectors:\n *\n *\t0xff (255)  +-------------+\n *                  |             | 15 (Spurious / IPIs / Local Interrupts)\n *\t0xf0 (240)  +-------------+\n *                  |             | 14 (I/O Interrupts / Timer)\n *\t0xe0 (224)  +-------------+\n *                  |             | 13 (I/O Interrupts)\n *\t0xd0 (208)  +-------------+\n *                  |             | 12 (I/O Interrupts)\n *\t0xc0 (192)  +-------------+\n *                  |             | 11 (I/O Interrupts)\n *\t0xb0 (176)  +-------------+\n *                  |             | 10 (I/O Interrupts)\n *\t0xa0 (160)  +-------------+\n *                  |             | 9 (I/O Interrupts)\n *\t0x90 (144)  +-------------+\n *                  |             | 8 (I/O Interrupts / System Calls)\n *\t0x80 (128)  +-------------+\n *                  |             | 7 (I/O Interrupts)\n *\t0x70 (112)  +-------------+\n *                  |             | 6 (I/O Interrupts)\n *\t0x60 (96)   +-------------+\n *                  |             | 5 (I/O Interrupts)\n *\t0x50 (80)   +-------------+\n *                  |             | 4 (I/O Interrupts)\n *\t0x40 (64)   +-------------+\n *                  |             | 3 (I/O Interrupts)\n *\t0x30 (48)   +-------------+\n *                  |             | 2 (ATPIC Interrupts)\n *\t0x20 (32)   +-------------+\n *                  |             | 1 (Exceptions, traps, faults, etc.)\n *\t0x10 (16)   +-------------+\n *                  |             | 0 (Exceptions, traps, faults, etc.)\n *\t0x00 (0)    +-------------+\n *\n * Note: 0x80 needs to be handled specially and not allocated to an\n * I/O device!\n */\n\n#define\tMAX_APIC_ID\t0xfe\n#define\tAPIC_ID_ALL\t0xff\n\n/* I/O Interrupts are used for external devices such as ISA, PCI, etc. */\n#define\tAPIC_IO_INTS\t(IDT_IO_INTS + 16)\n#define\tAPIC_NUM_IOINTS\t191\n\n/* The timer interrupt is used for clock handling and drives hardclock, etc. */\n#define\tAPIC_TIMER_INT\t(APIC_IO_INTS + APIC_NUM_IOINTS)\n\n/*  \n ********************* !!! WARNING !!! ******************************\n * Each local apic has an interrupt receive fifo that is two entries deep\n * for each interrupt priority class (higher 4 bits of interrupt vector).\n * Once the fifo is full the APIC can no longer receive interrupts for this\n * class and sending IPIs from other CPUs will be blocked.\n * To avoid deadlocks there should be no more than two IPI interrupts\n * pending at the same time.\n * Currently this is guaranteed by dividing the IPIs in two groups that have \n * each at most one IPI interrupt pending. The first group is protected by the\n * smp_ipi_mtx and waits for the completion of the IPI (Only one IPI user \n * at a time) The second group uses a single interrupt and a bitmap to avoid\n * redundant IPI interrupts.\n */ \n\n/* Interrupts for local APIC LVT entries other than the timer. */\n#define\tAPIC_LOCAL_INTS\t240\n#define\tAPIC_ERROR_INT\tAPIC_LOCAL_INTS\n#define\tAPIC_THERMAL_INT (APIC_LOCAL_INTS + 1)\n#define\tAPIC_CMC_INT\t(APIC_LOCAL_INTS + 2)\n\n#define\tAPIC_IPI_INTS\t(APIC_LOCAL_INTS + 3)\n#define\tIPI_RENDEZVOUS\t(APIC_IPI_INTS)\t\t/* Inter-CPU rendezvous. */\n#define\tIPI_INVLTLB\t(APIC_IPI_INTS + 1)\t/* TLB Shootdown IPIs */\n#define\tIPI_INVLPG\t(APIC_IPI_INTS + 2)\n#define\tIPI_INVLRNG\t(APIC_IPI_INTS + 3)\n#define\tIPI_INVLCACHE\t(APIC_IPI_INTS + 4)\n/* Vector to handle bitmap based IPIs */\n#define\tIPI_BITMAP_VECTOR\t(APIC_IPI_INTS + 6) \n\n/* IPIs handled by IPI_BITMAPED_VECTOR  (XXX ups is there a better place?) */\n#define\tIPI_AST\t\t0 \t/* Generate software trap. */\n#define IPI_PREEMPT     1\n#define IPI_HARDCLOCK   2\n#define IPI_BITMAP_LAST IPI_HARDCLOCK\n#define IPI_IS_BITMAPED(x) ((x) <= IPI_BITMAP_LAST)\n\n#define\tIPI_STOP\t(APIC_IPI_INTS + 7)\t/* Stop CPU until restarted. */\n#define\tIPI_SUSPEND\t(APIC_IPI_INTS + 8)\t/* Suspend CPU until restarted. */\n#define\tIPI_STOP_HARD\t(APIC_IPI_INTS + 9)\t/* Stop CPU with a NMI. */\n\n/*\n * The spurious interrupt can share the priority class with the IPIs since\n * it is not a normal interrupt. (Does not use the APIC's interrupt fifo)\n */\n#define\tAPIC_SPURIOUS_INT 255\n\n#define\tLVT_LINT0\t0\n#define\tLVT_LINT1\t1\n#define\tLVT_TIMER\t2\n#define\tLVT_ERROR\t3\n#define\tLVT_PMC\t\t4\n#define\tLVT_THERMAL\t5\n#define\tLVT_CMCI\t6\n#define\tLVT_MAX\t\tLVT_CMCI\n\n#ifndef LOCORE\n\n#define\tAPIC_IPI_DEST_SELF\t-1\n#define\tAPIC_IPI_DEST_ALL\t-2\n#define\tAPIC_IPI_DEST_OTHERS\t-3\n\n#define\tAPIC_BUS_UNKNOWN\t-1\n#define\tAPIC_BUS_ISA\t\t0\n#define\tAPIC_BUS_EISA\t\t1\n#define\tAPIC_BUS_PCI\t\t2\n#define\tAPIC_BUS_MAX\t\tAPIC_BUS_PCI\n\n/*\n * An APIC enumerator is a psuedo bus driver that enumerates APIC's including\n * CPU's and I/O APIC's.\n */\nstruct apic_enumerator {\n\tconst char *apic_name;\n\tint (*apic_probe)(void);\n\tint (*apic_probe_cpus)(void);\n\tint (*apic_setup_local)(void);\n\tint (*apic_setup_io)(void);\n\tSLIST_ENTRY(apic_enumerator) apic_next;\n};\n\ninthand_t\n\tIDTVEC(apic_isr1), IDTVEC(apic_isr2), IDTVEC(apic_isr3),\n\tIDTVEC(apic_isr4), IDTVEC(apic_isr5), IDTVEC(apic_isr6),\n\tIDTVEC(apic_isr7), IDTVEC(cmcint), IDTVEC(errorint),\n\tIDTVEC(spuriousint), IDTVEC(timerint);\n\nextern vm_paddr_t lapic_paddr;\nextern int apic_cpuids[];\n\nu_int\tapic_alloc_vector(u_int apic_id, u_int irq);\nu_int\tapic_alloc_vectors(u_int apic_id, u_int *irqs, u_int count,\n\t    u_int align);\nvoid\tapic_disable_vector(u_int apic_id, u_int vector);\nvoid\tapic_enable_vector(u_int apic_id, u_int vector);\nvoid\tapic_free_vector(u_int apic_id, u_int vector, u_int irq);\nu_int\tapic_idt_to_irq(u_int apic_id, u_int vector);\nvoid\tapic_register_enumerator(struct apic_enumerator *enumerator);\nu_int\tapic_cpuid(u_int apic_id);\nvoid\t*ioapic_create(vm_paddr_t addr, int32_t apic_id, int intbase);\nint\tioapic_disable_pin(void *cookie, u_int pin);\nint\tioapic_get_vector(void *cookie, u_int pin);\nvoid\tioapic_register(void *cookie);\nint\tioapic_remap_vector(void *cookie, u_int pin, int vector);\nint\tioapic_set_bus(void *cookie, u_int pin, int bus_type);\nint\tioapic_set_extint(void *cookie, u_int pin);\nint\tioapic_set_nmi(void *cookie, u_int pin);\nint\tioapic_set_polarity(void *cookie, u_int pin, enum intr_polarity pol);\nint\tioapic_set_triggermode(void *cookie, u_int pin,\n\t    enum intr_trigger trigger);\nint\tioapic_set_smi(void *cookie, u_int pin);\nvoid\tlapic_create(u_int apic_id, int boot_cpu);\nvoid\tlapic_disable(void);\nvoid\tlapic_disable_pmc(void);\nvoid\tlapic_dump(const char *str);\nvoid\tlapic_enable_cmc(void);\nint\tlapic_enable_pmc(void);\nvoid\tlapic_eoi(void);\nint\tlapic_id(void);\nvoid\tlapic_init(vm_paddr_t addr);\nint\tlapic_intr_pending(u_int vector);\nvoid\tlapic_ipi_raw(register_t icrlo, u_int dest);\nvoid\tlapic_ipi_vectored(u_int vector, int dest);\nint\tlapic_ipi_wait(int delay);\nvoid\tlapic_handle_cmc(void);\nvoid\tlapic_handle_error(void);\nvoid\tlapic_handle_intr(int vector, struct trapframe *frame);\nvoid\tlapic_handle_timer(struct trapframe *frame);\nvoid\tlapic_reenable_pmc(void);\nvoid\tlapic_set_logical_id(u_int apic_id, u_int cluster, u_int cluster_id);\nint\tlapic_set_lvt_mask(u_int apic_id, u_int lvt, u_char masked);\nint\tlapic_set_lvt_mode(u_int apic_id, u_int lvt, u_int32_t mode);\nint\tlapic_set_lvt_polarity(u_int apic_id, u_int lvt,\n\t    enum intr_polarity pol);\nint\tlapic_set_lvt_triggermode(u_int apic_id, u_int lvt,\n\t    enum intr_trigger trigger);\nvoid\tlapic_set_tpr(u_int vector);\nvoid\tlapic_setup(int boot);\n\n#endif /* !LOCORE */\n#endif /* _MACHINE_APICVAR_H_ */\n"
  },
  {
    "path": "freebsd-headers/machine/apm_bios.h",
    "content": "/*-\n * This file is in the public domain.\n */\n/* $FreeBSD: release/9.0.0/sys/amd64/include/apm_bios.h 215140 2010-11-11 19:36:21Z jkim $ */\n\n#include <x86/apm_bios.h>\n"
  },
  {
    "path": "freebsd-headers/machine/asm.h",
    "content": "/*-\n * Copyright (c) 1990 The Regents of the University of California.\n * All rights reserved.\n *\n * This code is derived from software contributed to Berkeley by\n * William Jolitz.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 4. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\tfrom: @(#)DEFS.h\t5.1 (Berkeley) 4/23/90\n * $FreeBSD: release/9.0.0/sys/amd64/include/asm.h 171914 2007-08-22 04:26:07Z jkoshy $\n */\n\n#ifndef _MACHINE_ASM_H_\n#define\t_MACHINE_ASM_H_\n\n#include <sys/cdefs.h>\n\n#ifdef PIC\n#define\tPIC_PLT(x)\tx@PLT\n#define\tPIC_GOT(x)\tx@GOTPCREL(%rip)\n#else\n#define\tPIC_PLT(x)\tx\n#define\tPIC_GOT(x)\tx\n#endif\n\n/*\n * CNAME and HIDENAME manage the relationship between symbol names in C\n * and the equivalent assembly language names.  CNAME is given a name as\n * it would be used in a C program.  It expands to the equivalent assembly\n * language name.  HIDENAME is given an assembly-language name, and expands\n * to a possibly-modified form that will be invisible to C programs.\n */\n#define CNAME(csym)\t\tcsym\n#define HIDENAME(asmsym)\t.asmsym\n\n#define _START_ENTRY\t.text; .p2align 4,0x90\n\n#define _ENTRY(x)\t_START_ENTRY; \\\n\t\t\t.globl CNAME(x); .type CNAME(x),@function; CNAME(x):\n\n#ifdef PROF\n#define\tALTENTRY(x)\t_ENTRY(x); \\\n\t\t\tpushq %rbp; movq %rsp,%rbp; \\\n\t\t\tcall PIC_PLT(HIDENAME(mcount)); \\\n\t\t\tpopq %rbp; \\\n\t\t\tjmp 9f\n#define\tENTRY(x)\t_ENTRY(x); \\\n\t\t\tpushq %rbp; movq %rsp,%rbp; \\\n\t\t\tcall PIC_PLT(HIDENAME(mcount)); \\\n\t\t\tpopq %rbp; \\\n\t\t\t9:\n#else\n#define\tALTENTRY(x)\t_ENTRY(x)\n#define\tENTRY(x)\t_ENTRY(x)\n#endif\n\n#define\tEND(x)\t\t.size x, . - x\n\n#define RCSID(x)\t.text; .asciz x\n\n#undef __FBSDID\n#if !defined(lint) && !defined(STRIP_FBSDID)\n#define __FBSDID(s)\t.ident s\n#else\n#define __FBSDID(s)\t/* nothing */\n#endif /* not lint and not STRIP_FBSDID */\n\n#endif /* !_MACHINE_ASM_H_ */\n"
  },
  {
    "path": "freebsd-headers/machine/asmacros.h",
    "content": "/*-\n * Copyright (c) 1993 The Regents of the University of California.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 4. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/amd64/include/asmacros.h 209483 2010-06-23 20:44:07Z kib $\n */\n\n#ifndef _MACHINE_ASMACROS_H_\n#define _MACHINE_ASMACROS_H_\n\n#include <sys/cdefs.h>\n\n/* XXX too much duplication in various asm*.h's. */\n\n/*\n * CNAME is used to manage the relationship between symbol names in C\n * and the equivalent assembly language names.  CNAME is given a name as\n * it would be used in a C program.  It expands to the equivalent assembly\n * language name.\n */\n#define CNAME(csym)\t\tcsym\n\n#define ALIGN_DATA\t.p2align 3\t/* 8 byte alignment, zero filled */\n#ifdef GPROF\n#define ALIGN_TEXT\t.p2align 4,0x90\t/* 16-byte alignment, nop filled */\n#else\n#define ALIGN_TEXT\t.p2align 4,0x90\t/* 16-byte alignment, nop filled */\n#endif\n#define SUPERALIGN_TEXT\t.p2align 4,0x90\t/* 16-byte alignment, nop filled */\n\n#define GEN_ENTRY(name)\t\tALIGN_TEXT; .globl CNAME(name); \\\n\t\t\t\t.type CNAME(name),@function; CNAME(name):\n#define NON_GPROF_ENTRY(name)\tGEN_ENTRY(name)\n#define NON_GPROF_RET\t\t.byte 0xc3\t/* opcode for `ret' */\n\n#define\tEND(name)\t\t.size name, . - name\n\n#ifdef GPROF\n/*\n * __mcount is like [.]mcount except that doesn't require its caller to set\n * up a frame pointer.  It must be called before pushing anything onto the\n * stack.  gcc should eventually generate code to call __mcount in most\n * cases.  This would make -pg in combination with -fomit-frame-pointer\n * useful.  gcc has a configuration variable PROFILE_BEFORE_PROLOGUE to\n * allow profiling before setting up the frame pointer, but this is\n * inadequate for good handling of special cases, e.g., -fpic works best\n * with profiling after the prologue.\n *\n * [.]mexitcount is a new function to support non-statistical profiling if an\n * accurate clock is available.  For C sources, calls to it are generated\n * by the FreeBSD extension `-mprofiler-epilogue' to gcc.  It is best to\n * call [.]mexitcount at the end of a function like the MEXITCOUNT macro does,\n * but gcc currently generates calls to it at the start of the epilogue to\n * avoid problems with -fpic.\n *\n * [.]mcount and __mcount may clobber the call-used registers and %ef.\n * [.]mexitcount may clobber %ecx and %ef.\n *\n * Cross-jumping makes non-statistical profiling timing more complicated.\n * It is handled in many cases by calling [.]mexitcount before jumping.  It\n * is handled for conditional jumps using CROSSJUMP() and CROSSJUMP_LABEL().\n * It is handled for some fault-handling jumps by not sharing the exit\n * routine.\n *\n * ALTENTRY() must be before a corresponding ENTRY() so that it can jump to\n * the main entry point.  Note that alt entries are counted twice.  They\n * have to be counted as ordinary entries for gprof to get the call times\n * right for the ordinary entries.\n *\n * High local labels are used in macros to avoid clashes with local labels\n * in functions.\n *\n * Ordinary `ret' is used instead of a macro `RET' because there are a lot\n * of `ret's.  0xc3 is the opcode for `ret' (`#define ret ... ret' can't\n * be used because this file is sometimes preprocessed in traditional mode).\n * `ret' clobbers eflags but this doesn't matter.\n */\n#define ALTENTRY(name)\t\tGEN_ENTRY(name) ; MCOUNT ; MEXITCOUNT ; jmp 9f\n#define\tCROSSJUMP(jtrue, label, jfalse) \\\n\tjfalse 8f; MEXITCOUNT; jmp __CONCAT(to,label); 8:\n#define CROSSJUMPTARGET(label) \\\n\tALIGN_TEXT; __CONCAT(to,label): ; MCOUNT; jmp label\n#define ENTRY(name)\t\tGEN_ENTRY(name) ; 9: ; MCOUNT\n#define FAKE_MCOUNT(caller)\tpushq caller ; call __mcount ; popq %rcx\n#define MCOUNT\t\t\tcall __mcount\n#define MCOUNT_LABEL(name)\tGEN_ENTRY(name) ; nop ; ALIGN_TEXT\n#ifdef GUPROF\n#define MEXITCOUNT\t\tcall .mexitcount\n#define ret\t\t\tMEXITCOUNT ; NON_GPROF_RET\n#else\n#define MEXITCOUNT\n#endif\n\n#else /* !GPROF */\n/*\n * ALTENTRY() has to align because it is before a corresponding ENTRY().\n * ENTRY() has to align to because there may be no ALTENTRY() before it.\n * If there is a previous ALTENTRY() then the alignment code for ENTRY()\n * is empty.\n */\n#define ALTENTRY(name)\t\tGEN_ENTRY(name)\n#define\tCROSSJUMP(jtrue, label, jfalse)\tjtrue label\n#define\tCROSSJUMPTARGET(label)\n#define ENTRY(name)\t\tGEN_ENTRY(name)\n#define FAKE_MCOUNT(caller)\n#define MCOUNT\n#define MCOUNT_LABEL(name)\n#define MEXITCOUNT\n#endif /* GPROF */\n\n#ifdef LOCORE\n/*\n * Convenience macro for declaring interrupt entry points.\n */\n#define\tIDTVEC(name)\tALIGN_TEXT; .globl __CONCAT(X,name); \\\n\t\t\t.type __CONCAT(X,name),@function; __CONCAT(X,name):\n\n/*\n * Macros to create and destroy a trap frame.\n */\n#define PUSH_FRAME\t\t\t\t\t\t\t\\\n\tsubq\t$TF_RIP,%rsp ;\t/* skip dummy tf_err and tf_trapno */\t\\\n\ttestb\t$SEL_RPL_MASK,TF_CS(%rsp) ; /* come from kernel? */\t\\\n\tjz\t1f ;\t\t/* Yes, dont swapgs again */\t\t\\\n\tswapgs ;\t\t\t\t\t\t\t\\\n1:\tmovq\t%rdi,TF_RDI(%rsp) ;\t\t\t\t\t\\\n\tmovq\t%rsi,TF_RSI(%rsp) ;\t\t\t\t\t\\\n\tmovq\t%rdx,TF_RDX(%rsp) ;\t\t\t\t\t\\\n\tmovq\t%rcx,TF_RCX(%rsp) ;\t\t\t\t\t\\\n\tmovq\t%r8,TF_R8(%rsp) ;\t\t\t\t\t\\\n\tmovq\t%r9,TF_R9(%rsp) ;\t\t\t\t\t\\\n\tmovq\t%rax,TF_RAX(%rsp) ;\t\t\t\t\t\\\n\tmovq\t%rbx,TF_RBX(%rsp) ;\t\t\t\t\t\\\n\tmovq\t%rbp,TF_RBP(%rsp) ;\t\t\t\t\t\\\n\tmovq\t%r10,TF_R10(%rsp) ;\t\t\t\t\t\\\n\tmovq\t%r11,TF_R11(%rsp) ;\t\t\t\t\t\\\n\tmovq\t%r12,TF_R12(%rsp) ;\t\t\t\t\t\\\n\tmovq\t%r13,TF_R13(%rsp) ;\t\t\t\t\t\\\n\tmovq\t%r14,TF_R14(%rsp) ;\t\t\t\t\t\\\n\tmovq\t%r15,TF_R15(%rsp) ;\t\t\t\t\t\\\n\tmovw\t%fs,TF_FS(%rsp) ;\t\t\t\t\t\\\n\tmovw\t%gs,TF_GS(%rsp) ;\t\t\t\t\t\\\n\tmovw\t%es,TF_ES(%rsp) ;\t\t\t\t\t\\\n\tmovw\t%ds,TF_DS(%rsp) ;\t\t\t\t\t\\\n\tmovl\t$TF_HASSEGS,TF_FLAGS(%rsp) ;\t\t\t\t\\\n\tcld\n\n#define POP_FRAME\t\t\t\t\t\t\t\\\n\tmovq\tTF_RDI(%rsp),%rdi ;\t\t\t\t\t\\\n\tmovq\tTF_RSI(%rsp),%rsi ;\t\t\t\t\t\\\n\tmovq\tTF_RDX(%rsp),%rdx ;\t\t\t\t\t\\\n\tmovq\tTF_RCX(%rsp),%rcx ;\t\t\t\t\t\\\n\tmovq\tTF_R8(%rsp),%r8 ;\t\t\t\t\t\\\n\tmovq\tTF_R9(%rsp),%r9 ;\t\t\t\t\t\\\n\tmovq\tTF_RAX(%rsp),%rax ;\t\t\t\t\t\\\n\tmovq\tTF_RBX(%rsp),%rbx ;\t\t\t\t\t\\\n\tmovq\tTF_RBP(%rsp),%rbp ;\t\t\t\t\t\\\n\tmovq\tTF_R10(%rsp),%r10 ;\t\t\t\t\t\\\n\tmovq\tTF_R11(%rsp),%r11 ;\t\t\t\t\t\\\n\tmovq\tTF_R12(%rsp),%r12 ;\t\t\t\t\t\\\n\tmovq\tTF_R13(%rsp),%r13 ;\t\t\t\t\t\\\n\tmovq\tTF_R14(%rsp),%r14 ;\t\t\t\t\t\\\n\tmovq\tTF_R15(%rsp),%r15 ;\t\t\t\t\t\\\n\ttestb\t$SEL_RPL_MASK,TF_CS(%rsp) ; /* come from kernel? */\t\\\n\tjz\t1f ;\t\t/* keep kernel GS.base */\t\t\\\n\tcli ;\t\t\t\t\t\t\t\t\\\n\tswapgs ;\t\t\t\t\t\t\t\\\n1:\taddq\t$TF_RIP,%rsp\t/* skip over tf_err, tf_trapno */\n\n/*\n * Access per-CPU data.\n */\n#define\tPCPU(member)\t%gs:PC_ ## member\n#define\tPCPU_ADDR(member, reg)\t\t\t\t\t\\\n\tmovq %gs:PC_PRVSPACE, reg ;\t\t\t\t\\\n\taddq $PC_ ## member, reg\n\n#endif /* LOCORE */\n\n#endif /* !_MACHINE_ASMACROS_H_ */\n"
  },
  {
    "path": "freebsd-headers/machine/atomic.h",
    "content": "/*-\n * Copyright (c) 1998 Doug Rabson\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/amd64/include/atomic.h 216524 2010-12-18 16:41:11Z kib $\n */\n#ifndef _MACHINE_ATOMIC_H_\n#define\t_MACHINE_ATOMIC_H_\n\n#ifndef _SYS_CDEFS_H_\n#error this file needs sys/cdefs.h as a prerequisite\n#endif\n\n#define\tmb()\t__asm __volatile(\"mfence;\" : : : \"memory\")\n#define\twmb()\t__asm __volatile(\"sfence;\" : : : \"memory\")\n#define\trmb()\t__asm __volatile(\"lfence;\" : : : \"memory\")\n\n/*\n * Various simple operations on memory, each of which is atomic in the\n * presence of interrupts and multiple processors.\n *\n * atomic_set_char(P, V)\t(*(u_char *)(P) |= (V))\n * atomic_clear_char(P, V)\t(*(u_char *)(P) &= ~(V))\n * atomic_add_char(P, V)\t(*(u_char *)(P) += (V))\n * atomic_subtract_char(P, V)\t(*(u_char *)(P) -= (V))\n *\n * atomic_set_short(P, V)\t(*(u_short *)(P) |= (V))\n * atomic_clear_short(P, V)\t(*(u_short *)(P) &= ~(V))\n * atomic_add_short(P, V)\t(*(u_short *)(P) += (V))\n * atomic_subtract_short(P, V)\t(*(u_short *)(P) -= (V))\n *\n * atomic_set_int(P, V)\t\t(*(u_int *)(P) |= (V))\n * atomic_clear_int(P, V)\t(*(u_int *)(P) &= ~(V))\n * atomic_add_int(P, V)\t\t(*(u_int *)(P) += (V))\n * atomic_subtract_int(P, V)\t(*(u_int *)(P) -= (V))\n * atomic_readandclear_int(P)\t(return (*(u_int *)(P)); *(u_int *)(P) = 0;)\n *\n * atomic_set_long(P, V)\t(*(u_long *)(P) |= (V))\n * atomic_clear_long(P, V)\t(*(u_long *)(P) &= ~(V))\n * atomic_add_long(P, V)\t(*(u_long *)(P) += (V))\n * atomic_subtract_long(P, V)\t(*(u_long *)(P) -= (V))\n * atomic_readandclear_long(P)\t(return (*(u_long *)(P)); *(u_long *)(P) = 0;)\n */\n\n/*\n * The above functions are expanded inline in the statically-linked\n * kernel.  Lock prefixes are generated if an SMP kernel is being\n * built.\n *\n * Kernel modules call real functions which are built into the kernel.\n * This allows kernel modules to be portable between UP and SMP systems.\n */\n#if defined(KLD_MODULE) || !defined(__GNUCLIKE_ASM)\n#define\tATOMIC_ASM(NAME, TYPE, OP, CONS, V)\t\t\t\\\nvoid atomic_##NAME##_##TYPE(volatile u_##TYPE *p, u_##TYPE v);\t\\\nvoid atomic_##NAME##_barr_##TYPE(volatile u_##TYPE *p, u_##TYPE v)\n\nint\tatomic_cmpset_int(volatile u_int *dst, u_int expect, u_int src);\nint\tatomic_cmpset_long(volatile u_long *dst, u_long expect, u_long src);\nu_int\tatomic_fetchadd_int(volatile u_int *p, u_int v);\nu_long\tatomic_fetchadd_long(volatile u_long *p, u_long v);\n\n#define\tATOMIC_STORE_LOAD(TYPE, LOP, SOP)\t\t\t\\\nu_##TYPE\tatomic_load_acq_##TYPE(volatile u_##TYPE *p);\t\\\nvoid\t\tatomic_store_rel_##TYPE(volatile u_##TYPE *p, u_##TYPE v)\n\n#else /* !KLD_MODULE && __GNUCLIKE_ASM */\n\n/*\n * For userland, always use lock prefixes so that the binaries will run\n * on both SMP and !SMP systems.\n */\n#if defined(SMP) || !defined(_KERNEL)\n#define\tMPLOCKED\t\"lock ; \"\n#else\n#define\tMPLOCKED\n#endif\n\n/*\n * The assembly is volatilized to avoid code chunk removal by the compiler.\n * GCC aggressively reorders operations and memory clobbering is necessary\n * in order to avoid that for memory barriers.\n */\n#define\tATOMIC_ASM(NAME, TYPE, OP, CONS, V)\t\t\\\nstatic __inline void\t\t\t\t\t\\\natomic_##NAME##_##TYPE(volatile u_##TYPE *p, u_##TYPE v)\\\n{\t\t\t\t\t\t\t\\\n\t__asm __volatile(MPLOCKED OP\t\t\t\\\n\t: \"=m\" (*p)\t\t\t\t\t\\\n\t: CONS (V), \"m\" (*p)\t\t\t\t\\\n\t: \"cc\");\t\t\t\t\t\\\n}\t\t\t\t\t\t\t\\\n\t\t\t\t\t\t\t\\\nstatic __inline void\t\t\t\t\t\\\natomic_##NAME##_barr_##TYPE(volatile u_##TYPE *p, u_##TYPE v)\\\n{\t\t\t\t\t\t\t\\\n\t__asm __volatile(MPLOCKED OP\t\t\t\\\n\t: \"=m\" (*p)\t\t\t\t\t\\\n\t: CONS (V), \"m\" (*p)\t\t\t\t\\\n\t: \"memory\", \"cc\");\t\t\t\t\\\n}\t\t\t\t\t\t\t\\\nstruct __hack\n\n/*\n * Atomic compare and set, used by the mutex functions\n *\n * if (*dst == expect) *dst = src (all 32 bit words)\n *\n * Returns 0 on failure, non-zero on success\n */\n\nstatic __inline int\natomic_cmpset_int(volatile u_int *dst, u_int expect, u_int src)\n{\n\tu_char res;\n\n\t__asm __volatile(\n\t\"\t\" MPLOCKED \"\t\t\"\n\t\"\tcmpxchgl %2,%1 ;\t\"\n\t\"       sete\t%0 ;\t\t\"\n\t\"1:\t\t\t\t\"\n\t\"# atomic_cmpset_int\"\n\t: \"=a\" (res),\t\t\t/* 0 */\n\t  \"=m\" (*dst)\t\t\t/* 1 */\n\t: \"r\" (src),\t\t\t/* 2 */\n\t  \"a\" (expect),\t\t\t/* 3 */\n\t  \"m\" (*dst)\t\t\t/* 4 */\n\t: \"memory\", \"cc\");\n\n\treturn (res);\n}\n\nstatic __inline int\natomic_cmpset_long(volatile u_long *dst, u_long expect, u_long src)\n{\n\tu_char res;\n\n\t__asm __volatile(\n\t\"\t\" MPLOCKED \"\t\t\"\n\t\"\tcmpxchgq %2,%1 ;\t\"\n\t\"       sete\t%0 ;\t\t\"\n\t\"1:\t\t\t\t\"\n\t\"# atomic_cmpset_long\"\n\t: \"=a\" (res),\t\t\t/* 0 */\n\t  \"=m\" (*dst)\t\t\t/* 1 */\n\t: \"r\" (src),\t\t\t/* 2 */\n\t  \"a\" (expect),\t\t\t/* 3 */\n\t  \"m\" (*dst)\t\t\t/* 4 */\n\t: \"memory\", \"cc\");\n\n\treturn (res);\n}\n\n/*\n * Atomically add the value of v to the integer pointed to by p and return\n * the previous value of *p.\n */\nstatic __inline u_int\natomic_fetchadd_int(volatile u_int *p, u_int v)\n{\n\n\t__asm __volatile(\n\t\"\t\" MPLOCKED \"\t\t\"\n\t\"\txaddl\t%0, %1 ;\t\"\n\t\"# atomic_fetchadd_int\"\n\t: \"+r\" (v),\t\t\t/* 0 (result) */\n\t  \"=m\" (*p)\t\t\t/* 1 */\n\t: \"m\" (*p)\t\t\t/* 2 */\n\t: \"cc\");\n\treturn (v);\n}\n\n/*\n * Atomically add the value of v to the long integer pointed to by p and return\n * the previous value of *p.\n */\nstatic __inline u_long\natomic_fetchadd_long(volatile u_long *p, u_long v)\n{\n\n\t__asm __volatile(\n\t\"\t\" MPLOCKED \"\t\t\"\n\t\"\txaddq\t%0, %1 ;\t\"\n\t\"# atomic_fetchadd_long\"\n\t: \"+r\" (v),\t\t\t/* 0 (result) */\n\t  \"=m\" (*p)\t\t\t/* 1 */\n\t: \"m\" (*p)\t\t\t/* 2 */\n\t: \"cc\");\n\treturn (v);\n}\n\n#if defined(_KERNEL) && !defined(SMP)\n\n/*\n * We assume that a = b will do atomic loads and stores.  However, on a\n * PentiumPro or higher, reads may pass writes, so for that case we have\n * to use a serializing instruction (i.e. with LOCK) to do the load in\n * SMP kernels.  For UP kernels, however, the cache of the single processor\n * is always consistent, so we only need to take care of compiler.\n */\n#define\tATOMIC_STORE_LOAD(TYPE, LOP, SOP)\t\t\\\nstatic __inline u_##TYPE\t\t\t\t\\\natomic_load_acq_##TYPE(volatile u_##TYPE *p)\t\t\\\n{\t\t\t\t\t\t\t\\\n\tu_##TYPE tmp;\t\t\t\t\t\\\n\t\t\t\t\t\t\t\\\n\ttmp = *p;\t\t\t\t\t\\\n\t__asm __volatile (\"\" : : : \"memory\");\t\t\\\n\treturn (tmp);\t\t\t\t\t\\\n}\t\t\t\t\t\t\t\\\n\t\t\t\t\t\t\t\\\nstatic __inline void\t\t\t\t\t\\\natomic_store_rel_##TYPE(volatile u_##TYPE *p, u_##TYPE v)\\\n{\t\t\t\t\t\t\t\\\n\t__asm __volatile (\"\" : : : \"memory\");\t\t\\\n\t*p = v;\t\t\t\t\t\t\\\n}\t\t\t\t\t\t\t\\\nstruct __hack\n\n#else /* !(_KERNEL && !SMP) */\n\n#define\tATOMIC_STORE_LOAD(TYPE, LOP, SOP)\t\t\\\nstatic __inline u_##TYPE\t\t\t\t\\\natomic_load_acq_##TYPE(volatile u_##TYPE *p)\t\t\\\n{\t\t\t\t\t\t\t\\\n\tu_##TYPE res;\t\t\t\t\t\\\n\t\t\t\t\t\t\t\\\n\t__asm __volatile(MPLOCKED LOP\t\t\t\\\n\t: \"=a\" (res),\t\t\t/* 0 */\t\t\\\n\t  \"=m\" (*p)\t\t\t/* 1 */\t\t\\\n\t: \"m\" (*p)\t\t\t/* 2 */\t\t\\\n\t: \"memory\", \"cc\");\t\t\t\t\\\n\t\t\t\t\t\t\t\\\n\treturn (res);\t\t\t\t\t\\\n}\t\t\t\t\t\t\t\\\n\t\t\t\t\t\t\t\\\n/*\t\t\t\t\t\t\t\\\n * The XCHG instruction asserts LOCK automagically.\t\\\n */\t\t\t\t\t\t\t\\\nstatic __inline void\t\t\t\t\t\\\natomic_store_rel_##TYPE(volatile u_##TYPE *p, u_##TYPE v)\\\n{\t\t\t\t\t\t\t\\\n\t__asm __volatile(SOP\t\t\t\t\\\n\t: \"=m\" (*p),\t\t\t/* 0 */\t\t\\\n\t  \"+r\" (v)\t\t\t/* 1 */\t\t\\\n\t: \"m\" (*p)\t\t\t/* 2 */\t\t\\\n\t: \"memory\");\t\t\t\t\t\\\n}\t\t\t\t\t\t\t\\\nstruct __hack\n\n#endif /* _KERNEL && !SMP */\n\n#endif /* KLD_MODULE || !__GNUCLIKE_ASM */\n\nATOMIC_ASM(set,\t     char,  \"orb %b1,%0\",  \"iq\",  v);\nATOMIC_ASM(clear,    char,  \"andb %b1,%0\", \"iq\", ~v);\nATOMIC_ASM(add,\t     char,  \"addb %b1,%0\", \"iq\",  v);\nATOMIC_ASM(subtract, char,  \"subb %b1,%0\", \"iq\",  v);\n\nATOMIC_ASM(set,\t     short, \"orw %w1,%0\",  \"ir\",  v);\nATOMIC_ASM(clear,    short, \"andw %w1,%0\", \"ir\", ~v);\nATOMIC_ASM(add,\t     short, \"addw %w1,%0\", \"ir\",  v);\nATOMIC_ASM(subtract, short, \"subw %w1,%0\", \"ir\",  v);\n\nATOMIC_ASM(set,\t     int,   \"orl %1,%0\",   \"ir\",  v);\nATOMIC_ASM(clear,    int,   \"andl %1,%0\",  \"ir\", ~v);\nATOMIC_ASM(add,\t     int,   \"addl %1,%0\",  \"ir\",  v);\nATOMIC_ASM(subtract, int,   \"subl %1,%0\",  \"ir\",  v);\n\nATOMIC_ASM(set,\t     long,  \"orq %1,%0\",   \"ir\",  v);\nATOMIC_ASM(clear,    long,  \"andq %1,%0\",  \"ir\", ~v);\nATOMIC_ASM(add,\t     long,  \"addq %1,%0\",  \"ir\",  v);\nATOMIC_ASM(subtract, long,  \"subq %1,%0\",  \"ir\",  v);\n\nATOMIC_STORE_LOAD(char,\t\"cmpxchgb %b0,%1\", \"xchgb %b1,%0\");\nATOMIC_STORE_LOAD(short,\"cmpxchgw %w0,%1\", \"xchgw %w1,%0\");\nATOMIC_STORE_LOAD(int,\t\"cmpxchgl %0,%1\",  \"xchgl %1,%0\");\nATOMIC_STORE_LOAD(long,\t\"cmpxchgq %0,%1\",  \"xchgq %1,%0\");\n\n#undef ATOMIC_ASM\n#undef ATOMIC_STORE_LOAD\n\n#ifndef WANT_FUNCTIONS\n\n/* Read the current value and store a zero in the destination. */\n#ifdef __GNUCLIKE_ASM\n\nstatic __inline u_int\natomic_readandclear_int(volatile u_int *addr)\n{\n\tu_int res;\n\n\tres = 0;\n\t__asm __volatile(\n\t\"\txchgl\t%1,%0 ;\t\t\"\n\t\"# atomic_readandclear_int\"\n\t: \"+r\" (res),\t\t\t/* 0 */\n\t  \"=m\" (*addr)\t\t\t/* 1 */\n\t: \"m\" (*addr));\n\n\treturn (res);\n}\n\nstatic __inline u_long\natomic_readandclear_long(volatile u_long *addr)\n{\n\tu_long res;\n\n\tres = 0;\n\t__asm __volatile(\n\t\"\txchgq\t%1,%0 ;\t\t\"\n\t\"# atomic_readandclear_long\"\n\t: \"+r\" (res),\t\t\t/* 0 */\n\t  \"=m\" (*addr)\t\t\t/* 1 */\n\t: \"m\" (*addr));\n\n\treturn (res);\n}\n\n#else /* !__GNUCLIKE_ASM */\n\nu_int\tatomic_readandclear_int(volatile u_int *addr);\nu_long\tatomic_readandclear_long(volatile u_long *addr);\n\n#endif /* __GNUCLIKE_ASM */\n\n#define\tatomic_set_acq_char\t\tatomic_set_barr_char\n#define\tatomic_set_rel_char\t\tatomic_set_barr_char\n#define\tatomic_clear_acq_char\t\tatomic_clear_barr_char\n#define\tatomic_clear_rel_char\t\tatomic_clear_barr_char\n#define\tatomic_add_acq_char\t\tatomic_add_barr_char\n#define\tatomic_add_rel_char\t\tatomic_add_barr_char\n#define\tatomic_subtract_acq_char\tatomic_subtract_barr_char\n#define\tatomic_subtract_rel_char\tatomic_subtract_barr_char\n\n#define\tatomic_set_acq_short\t\tatomic_set_barr_short\n#define\tatomic_set_rel_short\t\tatomic_set_barr_short\n#define\tatomic_clear_acq_short\t\tatomic_clear_barr_short\n#define\tatomic_clear_rel_short\t\tatomic_clear_barr_short\n#define\tatomic_add_acq_short\t\tatomic_add_barr_short\n#define\tatomic_add_rel_short\t\tatomic_add_barr_short\n#define\tatomic_subtract_acq_short\tatomic_subtract_barr_short\n#define\tatomic_subtract_rel_short\tatomic_subtract_barr_short\n\n#define\tatomic_set_acq_int\t\tatomic_set_barr_int\n#define\tatomic_set_rel_int\t\tatomic_set_barr_int\n#define\tatomic_clear_acq_int\t\tatomic_clear_barr_int\n#define\tatomic_clear_rel_int\t\tatomic_clear_barr_int\n#define\tatomic_add_acq_int\t\tatomic_add_barr_int\n#define\tatomic_add_rel_int\t\tatomic_add_barr_int\n#define\tatomic_subtract_acq_int\t\tatomic_subtract_barr_int\n#define\tatomic_subtract_rel_int\t\tatomic_subtract_barr_int\n#define\tatomic_cmpset_acq_int\t\tatomic_cmpset_int\n#define\tatomic_cmpset_rel_int\t\tatomic_cmpset_int\n\n#define\tatomic_set_acq_long\t\tatomic_set_barr_long\n#define\tatomic_set_rel_long\t\tatomic_set_barr_long\n#define\tatomic_clear_acq_long\t\tatomic_clear_barr_long\n#define\tatomic_clear_rel_long\t\tatomic_clear_barr_long\n#define\tatomic_add_acq_long\t\tatomic_add_barr_long\n#define\tatomic_add_rel_long\t\tatomic_add_barr_long\n#define\tatomic_subtract_acq_long\tatomic_subtract_barr_long\n#define\tatomic_subtract_rel_long\tatomic_subtract_barr_long\n#define\tatomic_cmpset_acq_long\t\tatomic_cmpset_long\n#define\tatomic_cmpset_rel_long\t\tatomic_cmpset_long\n\n/* Operations on 8-bit bytes. */\n#define\tatomic_set_8\t\tatomic_set_char\n#define\tatomic_set_acq_8\tatomic_set_acq_char\n#define\tatomic_set_rel_8\tatomic_set_rel_char\n#define\tatomic_clear_8\t\tatomic_clear_char\n#define\tatomic_clear_acq_8\tatomic_clear_acq_char\n#define\tatomic_clear_rel_8\tatomic_clear_rel_char\n#define\tatomic_add_8\t\tatomic_add_char\n#define\tatomic_add_acq_8\tatomic_add_acq_char\n#define\tatomic_add_rel_8\tatomic_add_rel_char\n#define\tatomic_subtract_8\tatomic_subtract_char\n#define\tatomic_subtract_acq_8\tatomic_subtract_acq_char\n#define\tatomic_subtract_rel_8\tatomic_subtract_rel_char\n#define\tatomic_load_acq_8\tatomic_load_acq_char\n#define\tatomic_store_rel_8\tatomic_store_rel_char\n\n/* Operations on 16-bit words. */\n#define\tatomic_set_16\t\tatomic_set_short\n#define\tatomic_set_acq_16\tatomic_set_acq_short\n#define\tatomic_set_rel_16\tatomic_set_rel_short\n#define\tatomic_clear_16\t\tatomic_clear_short\n#define\tatomic_clear_acq_16\tatomic_clear_acq_short\n#define\tatomic_clear_rel_16\tatomic_clear_rel_short\n#define\tatomic_add_16\t\tatomic_add_short\n#define\tatomic_add_acq_16\tatomic_add_acq_short\n#define\tatomic_add_rel_16\tatomic_add_rel_short\n#define\tatomic_subtract_16\tatomic_subtract_short\n#define\tatomic_subtract_acq_16\tatomic_subtract_acq_short\n#define\tatomic_subtract_rel_16\tatomic_subtract_rel_short\n#define\tatomic_load_acq_16\tatomic_load_acq_short\n#define\tatomic_store_rel_16\tatomic_store_rel_short\n\n/* Operations on 32-bit double words. */\n#define\tatomic_set_32\t\tatomic_set_int\n#define\tatomic_set_acq_32\tatomic_set_acq_int\n#define\tatomic_set_rel_32\tatomic_set_rel_int\n#define\tatomic_clear_32\t\tatomic_clear_int\n#define\tatomic_clear_acq_32\tatomic_clear_acq_int\n#define\tatomic_clear_rel_32\tatomic_clear_rel_int\n#define\tatomic_add_32\t\tatomic_add_int\n#define\tatomic_add_acq_32\tatomic_add_acq_int\n#define\tatomic_add_rel_32\tatomic_add_rel_int\n#define\tatomic_subtract_32\tatomic_subtract_int\n#define\tatomic_subtract_acq_32\tatomic_subtract_acq_int\n#define\tatomic_subtract_rel_32\tatomic_subtract_rel_int\n#define\tatomic_load_acq_32\tatomic_load_acq_int\n#define\tatomic_store_rel_32\tatomic_store_rel_int\n#define\tatomic_cmpset_32\tatomic_cmpset_int\n#define\tatomic_cmpset_acq_32\tatomic_cmpset_acq_int\n#define\tatomic_cmpset_rel_32\tatomic_cmpset_rel_int\n#define\tatomic_readandclear_32\tatomic_readandclear_int\n#define\tatomic_fetchadd_32\tatomic_fetchadd_int\n\n/* Operations on 64-bit quad words. */\n#define\tatomic_set_64\t\tatomic_set_long\n#define\tatomic_set_acq_64\tatomic_set_acq_long\n#define\tatomic_set_rel_64\tatomic_set_rel_long\n#define\tatomic_clear_64\t\tatomic_clear_long\n#define\tatomic_clear_acq_64\tatomic_clear_acq_long\n#define\tatomic_clear_rel_64\tatomic_clear_rel_long\n#define\tatomic_add_64\t\tatomic_add_long\n#define\tatomic_add_acq_64\tatomic_add_acq_long\n#define\tatomic_add_rel_64\tatomic_add_rel_long\n#define\tatomic_subtract_64\tatomic_subtract_long\n#define\tatomic_subtract_acq_64\tatomic_subtract_acq_long\n#define\tatomic_subtract_rel_64\tatomic_subtract_rel_long\n#define\tatomic_load_acq_64\tatomic_load_acq_long\n#define\tatomic_store_rel_64\tatomic_store_rel_long\n#define\tatomic_cmpset_64\tatomic_cmpset_long\n#define\tatomic_cmpset_acq_64\tatomic_cmpset_acq_long\n#define\tatomic_cmpset_rel_64\tatomic_cmpset_rel_long\n#define\tatomic_readandclear_64\tatomic_readandclear_long\n\n/* Operations on pointers. */\n#define\tatomic_set_ptr\t\tatomic_set_long\n#define\tatomic_set_acq_ptr\tatomic_set_acq_long\n#define\tatomic_set_rel_ptr\tatomic_set_rel_long\n#define\tatomic_clear_ptr\tatomic_clear_long\n#define\tatomic_clear_acq_ptr\tatomic_clear_acq_long\n#define\tatomic_clear_rel_ptr\tatomic_clear_rel_long\n#define\tatomic_add_ptr\t\tatomic_add_long\n#define\tatomic_add_acq_ptr\tatomic_add_acq_long\n#define\tatomic_add_rel_ptr\tatomic_add_rel_long\n#define\tatomic_subtract_ptr\tatomic_subtract_long\n#define\tatomic_subtract_acq_ptr\tatomic_subtract_acq_long\n#define\tatomic_subtract_rel_ptr\tatomic_subtract_rel_long\n#define\tatomic_load_acq_ptr\tatomic_load_acq_long\n#define\tatomic_store_rel_ptr\tatomic_store_rel_long\n#define\tatomic_cmpset_ptr\tatomic_cmpset_long\n#define\tatomic_cmpset_acq_ptr\tatomic_cmpset_acq_long\n#define\tatomic_cmpset_rel_ptr\tatomic_cmpset_rel_long\n#define\tatomic_readandclear_ptr\tatomic_readandclear_long\n\n#endif /* !WANT_FUNCTIONS */\n\n#endif /* !_MACHINE_ATOMIC_H_ */\n"
  },
  {
    "path": "freebsd-headers/machine/bus.h",
    "content": "/*-\n * This file is in the public domain.\n */\n/* $FreeBSD: release/9.0.0/sys/amd64/include/bus.h 216592 2010-12-20 16:39:43Z tijl $ */\n\n#include <x86/bus.h>\n"
  },
  {
    "path": "freebsd-headers/machine/bus_dma.h",
    "content": "/*-\n * Copyright (c) 2005 Scott Long\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/amd64/include/bus_dma.h 148275 2005-07-22 04:03:25Z obrien $\n */\n\n#ifndef _AMD64_BUS_DMA_H_\n#define _AMD64_BUS_DMA_H_\n\n#include <sys/bus_dma.h>\n\n#endif /* _AMD64_BUS_DMA_H_ */\n"
  },
  {
    "path": "freebsd-headers/machine/clock.h",
    "content": "/*-\n * Kernel interface to machine-dependent clock driver.\n * Garrett Wollman, September 1994.\n * This file is in the public domain.\n *\n * $FreeBSD: release/9.0.0/sys/amd64/include/clock.h 221703 2011-05-09 17:34:00Z jkim $\n */\n\n#ifndef _MACHINE_CLOCK_H_\n#define\t_MACHINE_CLOCK_H_\n\n#ifdef _KERNEL\n/*\n * i386 to clock driver interface.\n * XXX large parts of the driver and its interface are misplaced.\n */\nextern int\tclkintr_pending;\nextern u_int\ti8254_freq;\nextern int\ti8254_max_count;\nextern uint64_t\ttsc_freq;\nextern int\ttsc_is_invariant;\nextern int\ttsc_perf_stat;\n\nvoid\ti8254_init(void);\n\n/*\n * Driver to clock driver interface.\n */\n\nvoid\tstartrtclock(void);\nvoid\tinit_TSC(void);\n\n#define\tHAS_TIMER_SPKR 1\nint\ttimer_spkr_acquire(void);\nint\ttimer_spkr_release(void);\nvoid\ttimer_spkr_setfreq(int freq);\n\n#endif /* _KERNEL */\n\n#endif /* !_MACHINE_CLOCK_H_ */\n"
  },
  {
    "path": "freebsd-headers/machine/cpu.h",
    "content": "/*-\n * Copyright (c) 1990 The Regents of the University of California.\n * All rights reserved.\n *\n * This code is derived from software contributed to Berkeley by\n * William Jolitz.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 4. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\tfrom: @(#)cpu.h\t5.4 (Berkeley) 5/9/91\n * $FreeBSD: release/9.0.0/sys/amd64/include/cpu.h 219673 2011-03-15 17:19:52Z jkim $\n */\n\n#ifndef _MACHINE_CPU_H_\n#define\t_MACHINE_CPU_H_\n\n/*\n * Definitions unique to i386 cpu support.\n */\n#include <machine/psl.h>\n#include <machine/frame.h>\n#include <machine/segments.h>\n\n#define\tcpu_exec(p)\t/* nothing */\n#define\tcpu_swapin(p)\t/* nothing */\n#define\tcpu_getstack(td)\t\t((td)->td_frame->tf_rsp)\n#define\tcpu_setstack(td, ap)\t\t((td)->td_frame->tf_rsp = (ap))\n#define\tcpu_spinwait()\t\t\tia32_pause()\n\n#define\tTRAPF_USERMODE(framep) \\\n\t(ISPL((framep)->tf_cs) == SEL_UPL)\n#define\tTRAPF_PC(framep)\t((framep)->tf_rip)\n\n#ifdef _KERNEL\nextern char\tbtext[];\nextern char\tetext[];\n\nvoid\tcpu_halt(void);\nvoid\tcpu_reset(void);\nvoid\tfork_trampoline(void);\nvoid\tswi_vm(void *);\n\n/*\n * Return contents of in-cpu fast counter as a sort of \"bogo-time\"\n * for random-harvesting purposes.\n */\nstatic __inline u_int64_t\nget_cyclecount(void)\n{\n\n\treturn (rdtsc());\n}\n\n#endif\n\n#endif /* !_MACHINE_CPU_H_ */\n"
  },
  {
    "path": "freebsd-headers/machine/cpufunc.h",
    "content": "/*-\n * Copyright (c) 2003 Peter Wemm.\n * Copyright (c) 1993 The Regents of the University of California.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 4. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/amd64/include/cpufunc.h 223796 2011-07-05 18:42:10Z jkim $\n */\n\n/*\n * Functions to provide access to special i386 instructions.\n * This in included in sys/systm.h, and that file should be\n * used in preference to this.\n */\n\n#ifndef _MACHINE_CPUFUNC_H_\n#define\t_MACHINE_CPUFUNC_H_\n\n#ifndef _SYS_CDEFS_H_\n#error this file needs sys/cdefs.h as a prerequisite\n#endif\n\nstruct region_descriptor;\n\n#define readb(va)\t(*(volatile uint8_t *) (va))\n#define readw(va)\t(*(volatile uint16_t *) (va))\n#define readl(va)\t(*(volatile uint32_t *) (va))\n#define readq(va)\t(*(volatile uint64_t *) (va))\n\n#define writeb(va, d)\t(*(volatile uint8_t *) (va) = (d))\n#define writew(va, d)\t(*(volatile uint16_t *) (va) = (d))\n#define writel(va, d)\t(*(volatile uint32_t *) (va) = (d))\n#define writeq(va, d)\t(*(volatile uint64_t *) (va) = (d))\n\n#if defined(__GNUCLIKE_ASM) && defined(__CC_SUPPORTS___INLINE)\n\nstatic __inline void\nbreakpoint(void)\n{\n\t__asm __volatile(\"int $3\");\n}\n\nstatic __inline u_int\nbsfl(u_int mask)\n{\n\tu_int\tresult;\n\n\t__asm __volatile(\"bsfl %1,%0\" : \"=r\" (result) : \"rm\" (mask));\n\treturn (result);\n}\n\nstatic __inline u_long\nbsfq(u_long mask)\n{\n\tu_long\tresult;\n\n\t__asm __volatile(\"bsfq %1,%0\" : \"=r\" (result) : \"rm\" (mask));\n\treturn (result);\n}\n\nstatic __inline u_int\nbsrl(u_int mask)\n{\n\tu_int\tresult;\n\n\t__asm __volatile(\"bsrl %1,%0\" : \"=r\" (result) : \"rm\" (mask));\n\treturn (result);\n}\n\nstatic __inline u_long\nbsrq(u_long mask)\n{\n\tu_long\tresult;\n\n\t__asm __volatile(\"bsrq %1,%0\" : \"=r\" (result) : \"rm\" (mask));\n\treturn (result);\n}\n\nstatic __inline void\nclflush(u_long addr)\n{\n\n\t__asm __volatile(\"clflush %0\" : : \"m\" (*(char *)addr));\n}\n\nstatic __inline void\ndisable_intr(void)\n{\n\t__asm __volatile(\"cli\" : : : \"memory\");\n}\n\nstatic __inline void\ndo_cpuid(u_int ax, u_int *p)\n{\n\t__asm __volatile(\"cpuid\"\n\t\t\t : \"=a\" (p[0]), \"=b\" (p[1]), \"=c\" (p[2]), \"=d\" (p[3])\n\t\t\t :  \"0\" (ax));\n}\n\nstatic __inline void\ncpuid_count(u_int ax, u_int cx, u_int *p)\n{\n\t__asm __volatile(\"cpuid\"\n\t\t\t : \"=a\" (p[0]), \"=b\" (p[1]), \"=c\" (p[2]), \"=d\" (p[3])\n\t\t\t :  \"0\" (ax), \"c\" (cx));\n}\n\nstatic __inline void\nenable_intr(void)\n{\n\t__asm __volatile(\"sti\");\n}\n\n#ifdef _KERNEL\n\n#define\tHAVE_INLINE_FFS\n#define        ffs(x)  __builtin_ffs(x)\n\n#define\tHAVE_INLINE_FFSL\n\nstatic __inline int\nffsl(long mask)\n{\n\treturn (mask == 0 ? mask : (int)bsfq((u_long)mask) + 1);\n}\n\n#define\tHAVE_INLINE_FLS\n\nstatic __inline int\nfls(int mask)\n{\n\treturn (mask == 0 ? mask : (int)bsrl((u_int)mask) + 1);\n}\n\n#define\tHAVE_INLINE_FLSL\n\nstatic __inline int\nflsl(long mask)\n{\n\treturn (mask == 0 ? mask : (int)bsrq((u_long)mask) + 1);\n}\n\n#endif /* _KERNEL */\n\nstatic __inline void\nhalt(void)\n{\n\t__asm __volatile(\"hlt\");\n}\n\nstatic __inline u_char\ninb(u_int port)\n{\n\tu_char\tdata;\n\n\t__asm __volatile(\"inb %w1, %0\" : \"=a\" (data) : \"Nd\" (port));\n\treturn (data);\n}\n\nstatic __inline u_int\ninl(u_int port)\n{\n\tu_int\tdata;\n\n\t__asm __volatile(\"inl %w1, %0\" : \"=a\" (data) : \"Nd\" (port));\n\treturn (data);\n}\n\nstatic __inline void\ninsb(u_int port, void *addr, size_t count)\n{\n\t__asm __volatile(\"cld; rep; insb\"\n\t\t\t : \"+D\" (addr), \"+c\" (count)\n\t\t\t : \"d\" (port)\n\t\t\t : \"memory\");\n}\n\nstatic __inline void\ninsw(u_int port, void *addr, size_t count)\n{\n\t__asm __volatile(\"cld; rep; insw\"\n\t\t\t : \"+D\" (addr), \"+c\" (count)\n\t\t\t : \"d\" (port)\n\t\t\t : \"memory\");\n}\n\nstatic __inline void\ninsl(u_int port, void *addr, size_t count)\n{\n\t__asm __volatile(\"cld; rep; insl\"\n\t\t\t : \"+D\" (addr), \"+c\" (count)\n\t\t\t : \"d\" (port)\n\t\t\t : \"memory\");\n}\n\nstatic __inline void\ninvd(void)\n{\n\t__asm __volatile(\"invd\");\n}\n\nstatic __inline u_short\ninw(u_int port)\n{\n\tu_short\tdata;\n\n\t__asm __volatile(\"inw %w1, %0\" : \"=a\" (data) : \"Nd\" (port));\n\treturn (data);\n}\n\nstatic __inline void\noutb(u_int port, u_char data)\n{\n\t__asm __volatile(\"outb %0, %w1\" : : \"a\" (data), \"Nd\" (port));\n}\n\nstatic __inline void\noutl(u_int port, u_int data)\n{\n\t__asm __volatile(\"outl %0, %w1\" : : \"a\" (data), \"Nd\" (port));\n}\n\nstatic __inline void\noutsb(u_int port, const void *addr, size_t count)\n{\n\t__asm __volatile(\"cld; rep; outsb\"\n\t\t\t : \"+S\" (addr), \"+c\" (count)\n\t\t\t : \"d\" (port));\n}\n\nstatic __inline void\noutsw(u_int port, const void *addr, size_t count)\n{\n\t__asm __volatile(\"cld; rep; outsw\"\n\t\t\t : \"+S\" (addr), \"+c\" (count)\n\t\t\t : \"d\" (port));\n}\n\nstatic __inline void\noutsl(u_int port, const void *addr, size_t count)\n{\n\t__asm __volatile(\"cld; rep; outsl\"\n\t\t\t : \"+S\" (addr), \"+c\" (count)\n\t\t\t : \"d\" (port));\n}\n\nstatic __inline void\noutw(u_int port, u_short data)\n{\n\t__asm __volatile(\"outw %0, %w1\" : : \"a\" (data), \"Nd\" (port));\n}\n\nstatic __inline void\nmfence(void)\n{\n\n\t__asm __volatile(\"mfence\" : : : \"memory\");\n}\n\nstatic __inline void\nia32_pause(void)\n{\n\t__asm __volatile(\"pause\");\n}\n\nstatic __inline u_long\nread_rflags(void)\n{\n\tu_long\trf;\n\n\t__asm __volatile(\"pushfq; popq %0\" : \"=r\" (rf));\n\treturn (rf);\n}\n\nstatic __inline uint64_t\nrdmsr(u_int msr)\n{\n\tuint32_t low, high;\n\n\t__asm __volatile(\"rdmsr\" : \"=a\" (low), \"=d\" (high) : \"c\" (msr));\n\treturn (low | ((uint64_t)high << 32));\n}\n\nstatic __inline uint64_t\nrdpmc(u_int pmc)\n{\n\tuint32_t low, high;\n\n\t__asm __volatile(\"rdpmc\" : \"=a\" (low), \"=d\" (high) : \"c\" (pmc));\n\treturn (low | ((uint64_t)high << 32));\n}\n\nstatic __inline uint64_t\nrdtsc(void)\n{\n\tuint32_t low, high;\n\n\t__asm __volatile(\"rdtsc\" : \"=a\" (low), \"=d\" (high));\n\treturn (low | ((uint64_t)high << 32));\n}\n\nstatic __inline uint32_t\nrdtsc32(void)\n{\n\tuint32_t rv;\n\n\t__asm __volatile(\"rdtsc\" : \"=a\" (rv) : : \"edx\");\n\treturn (rv);\n}\n\nstatic __inline void\nwbinvd(void)\n{\n\t__asm __volatile(\"wbinvd\");\n}\n\nstatic __inline void\nwrite_rflags(u_long rf)\n{\n\t__asm __volatile(\"pushq %0;  popfq\" : : \"r\" (rf));\n}\n\nstatic __inline void\nwrmsr(u_int msr, uint64_t newval)\n{\n\tuint32_t low, high;\n\n\tlow = newval;\n\thigh = newval >> 32;\n\t__asm __volatile(\"wrmsr\" : : \"a\" (low), \"d\" (high), \"c\" (msr));\n}\n\nstatic __inline void\nload_cr0(u_long data)\n{\n\n\t__asm __volatile(\"movq %0,%%cr0\" : : \"r\" (data));\n}\n\nstatic __inline u_long\nrcr0(void)\n{\n\tu_long\tdata;\n\n\t__asm __volatile(\"movq %%cr0,%0\" : \"=r\" (data));\n\treturn (data);\n}\n\nstatic __inline u_long\nrcr2(void)\n{\n\tu_long\tdata;\n\n\t__asm __volatile(\"movq %%cr2,%0\" : \"=r\" (data));\n\treturn (data);\n}\n\nstatic __inline void\nload_cr3(u_long data)\n{\n\n\t__asm __volatile(\"movq %0,%%cr3\" : : \"r\" (data) : \"memory\");\n}\n\nstatic __inline u_long\nrcr3(void)\n{\n\tu_long\tdata;\n\n\t__asm __volatile(\"movq %%cr3,%0\" : \"=r\" (data));\n\treturn (data);\n}\n\nstatic __inline void\nload_cr4(u_long data)\n{\n\t__asm __volatile(\"movq %0,%%cr4\" : : \"r\" (data));\n}\n\nstatic __inline u_long\nrcr4(void)\n{\n\tu_long\tdata;\n\n\t__asm __volatile(\"movq %%cr4,%0\" : \"=r\" (data));\n\treturn (data);\n}\n\n/*\n * Global TLB flush (except for thise for pages marked PG_G)\n */\nstatic __inline void\ninvltlb(void)\n{\n\n\tload_cr3(rcr3());\n}\n\n/*\n * TLB flush for an individual page (even if it has PG_G).\n * Only works on 486+ CPUs (i386 does not have PG_G).\n */\nstatic __inline void\ninvlpg(u_long addr)\n{\n\n\t__asm __volatile(\"invlpg %0\" : : \"m\" (*(char *)addr) : \"memory\");\n}\n\nstatic __inline u_short\nrfs(void)\n{\n\tu_short sel;\n\t__asm __volatile(\"movw %%fs,%0\" : \"=rm\" (sel));\n\treturn (sel);\n}\n\nstatic __inline u_short\nrgs(void)\n{\n\tu_short sel;\n\t__asm __volatile(\"movw %%gs,%0\" : \"=rm\" (sel));\n\treturn (sel);\n}\n\nstatic __inline u_short\nrss(void)\n{\n\tu_short sel;\n\t__asm __volatile(\"movw %%ss,%0\" : \"=rm\" (sel));\n\treturn (sel);\n}\n\nstatic __inline void\nload_ds(u_short sel)\n{\n\t__asm __volatile(\"movw %0,%%ds\" : : \"rm\" (sel));\n}\n\nstatic __inline void\nload_es(u_short sel)\n{\n\t__asm __volatile(\"movw %0,%%es\" : : \"rm\" (sel));\n}\n\nstatic __inline void\ncpu_monitor(const void *addr, u_long extensions, u_int hints)\n{\n\n\t__asm __volatile(\"monitor\"\n\t    : : \"a\" (addr), \"c\" (extensions), \"d\" (hints));\n}\n\nstatic __inline void\ncpu_mwait(u_long extensions, u_int hints)\n{\n\n\t__asm __volatile(\"mwait\" : : \"a\" (hints), \"c\" (extensions));\n}\n\n#ifdef _KERNEL\n/* This is defined in <machine/specialreg.h> but is too painful to get to */\n#ifndef\tMSR_FSBASE\n#define\tMSR_FSBASE\t0xc0000100\n#endif\nstatic __inline void\nload_fs(u_short sel)\n{\n\t/* Preserve the fsbase value across the selector load */\n\t__asm __volatile(\"rdmsr; movw %0,%%fs; wrmsr\"\n\t    : : \"rm\" (sel), \"c\" (MSR_FSBASE) : \"eax\", \"edx\");\n}\n\n#ifndef\tMSR_GSBASE\n#define\tMSR_GSBASE\t0xc0000101\n#endif\nstatic __inline void\nload_gs(u_short sel)\n{\n\t/*\n\t * Preserve the gsbase value across the selector load.\n\t * Note that we have to disable interrupts because the gsbase\n\t * being trashed happens to be the kernel gsbase at the time.\n\t */\n\t__asm __volatile(\"pushfq; cli; rdmsr; movw %0,%%gs; wrmsr; popfq\"\n\t    : : \"rm\" (sel), \"c\" (MSR_GSBASE) : \"eax\", \"edx\");\n}\n#else\n/* Usable by userland */\nstatic __inline void\nload_fs(u_short sel)\n{\n\t__asm __volatile(\"movw %0,%%fs\" : : \"rm\" (sel));\n}\n\nstatic __inline void\nload_gs(u_short sel)\n{\n\t__asm __volatile(\"movw %0,%%gs\" : : \"rm\" (sel));\n}\n#endif\n\nstatic __inline void\nlidt(struct region_descriptor *addr)\n{\n\t__asm __volatile(\"lidt (%0)\" : : \"r\" (addr));\n}\n\nstatic __inline void\nlldt(u_short sel)\n{\n\t__asm __volatile(\"lldt %0\" : : \"r\" (sel));\n}\n\nstatic __inline void\nltr(u_short sel)\n{\n\t__asm __volatile(\"ltr %0\" : : \"r\" (sel));\n}\n\nstatic __inline uint64_t\nrdr0(void)\n{\n\tuint64_t data;\n\t__asm __volatile(\"movq %%dr0,%0\" : \"=r\" (data));\n\treturn (data);\n}\n\nstatic __inline void\nload_dr0(uint64_t dr0)\n{\n\t__asm __volatile(\"movq %0,%%dr0\" : : \"r\" (dr0));\n}\n\nstatic __inline uint64_t\nrdr1(void)\n{\n\tuint64_t data;\n\t__asm __volatile(\"movq %%dr1,%0\" : \"=r\" (data));\n\treturn (data);\n}\n\nstatic __inline void\nload_dr1(uint64_t dr1)\n{\n\t__asm __volatile(\"movq %0,%%dr1\" : : \"r\" (dr1));\n}\n\nstatic __inline uint64_t\nrdr2(void)\n{\n\tuint64_t data;\n\t__asm __volatile(\"movq %%dr2,%0\" : \"=r\" (data));\n\treturn (data);\n}\n\nstatic __inline void\nload_dr2(uint64_t dr2)\n{\n\t__asm __volatile(\"movq %0,%%dr2\" : : \"r\" (dr2));\n}\n\nstatic __inline uint64_t\nrdr3(void)\n{\n\tuint64_t data;\n\t__asm __volatile(\"movq %%dr3,%0\" : \"=r\" (data));\n\treturn (data);\n}\n\nstatic __inline void\nload_dr3(uint64_t dr3)\n{\n\t__asm __volatile(\"movq %0,%%dr3\" : : \"r\" (dr3));\n}\n\nstatic __inline uint64_t\nrdr4(void)\n{\n\tuint64_t data;\n\t__asm __volatile(\"movq %%dr4,%0\" : \"=r\" (data));\n\treturn (data);\n}\n\nstatic __inline void\nload_dr4(uint64_t dr4)\n{\n\t__asm __volatile(\"movq %0,%%dr4\" : : \"r\" (dr4));\n}\n\nstatic __inline uint64_t\nrdr5(void)\n{\n\tuint64_t data;\n\t__asm __volatile(\"movq %%dr5,%0\" : \"=r\" (data));\n\treturn (data);\n}\n\nstatic __inline void\nload_dr5(uint64_t dr5)\n{\n\t__asm __volatile(\"movq %0,%%dr5\" : : \"r\" (dr5));\n}\n\nstatic __inline uint64_t\nrdr6(void)\n{\n\tuint64_t data;\n\t__asm __volatile(\"movq %%dr6,%0\" : \"=r\" (data));\n\treturn (data);\n}\n\nstatic __inline void\nload_dr6(uint64_t dr6)\n{\n\t__asm __volatile(\"movq %0,%%dr6\" : : \"r\" (dr6));\n}\n\nstatic __inline uint64_t\nrdr7(void)\n{\n\tuint64_t data;\n\t__asm __volatile(\"movq %%dr7,%0\" : \"=r\" (data));\n\treturn (data);\n}\n\nstatic __inline void\nload_dr7(uint64_t dr7)\n{\n\t__asm __volatile(\"movq %0,%%dr7\" : : \"r\" (dr7));\n}\n\nstatic __inline register_t\nintr_disable(void)\n{\n\tregister_t rflags;\n\n\trflags = read_rflags();\n\tdisable_intr();\n\treturn (rflags);\n}\n\nstatic __inline void\nintr_restore(register_t rflags)\n{\n\twrite_rflags(rflags);\n}\n\n#else /* !(__GNUCLIKE_ASM && __CC_SUPPORTS___INLINE) */\n\nint\tbreakpoint(void);\nu_int\tbsfl(u_int mask);\nu_int\tbsrl(u_int mask);\nvoid\tdisable_intr(void);\nvoid\tdo_cpuid(u_int ax, u_int *p);\nvoid\tenable_intr(void);\nvoid\thalt(void);\nvoid\tia32_pause(void);\nu_char\tinb(u_int port);\nu_int\tinl(u_int port);\nvoid\tinsb(u_int port, void *addr, size_t count);\nvoid\tinsl(u_int port, void *addr, size_t count);\nvoid\tinsw(u_int port, void *addr, size_t count);\nregister_t\tintr_disable(void);\nvoid\tintr_restore(register_t rf);\nvoid\tinvd(void);\nvoid\tinvlpg(u_int addr);\nvoid\tinvltlb(void);\nu_short\tinw(u_int port);\nvoid\tlidt(struct region_descriptor *addr);\nvoid\tlldt(u_short sel);\nvoid\tload_cr0(u_long cr0);\nvoid\tload_cr3(u_long cr3);\nvoid\tload_cr4(u_long cr4);\nvoid\tload_dr0(uint64_t dr0);\nvoid\tload_dr1(uint64_t dr1);\nvoid\tload_dr2(uint64_t dr2);\nvoid\tload_dr3(uint64_t dr3);\nvoid\tload_dr4(uint64_t dr4);\nvoid\tload_dr5(uint64_t dr5);\nvoid\tload_dr6(uint64_t dr6);\nvoid\tload_dr7(uint64_t dr7);\nvoid\tload_fs(u_short sel);\nvoid\tload_gs(u_short sel);\nvoid\tltr(u_short sel);\nvoid\toutb(u_int port, u_char data);\nvoid\toutl(u_int port, u_int data);\nvoid\toutsb(u_int port, const void *addr, size_t count);\nvoid\toutsl(u_int port, const void *addr, size_t count);\nvoid\toutsw(u_int port, const void *addr, size_t count);\nvoid\toutw(u_int port, u_short data);\nu_long\trcr0(void);\nu_long\trcr2(void);\nu_long\trcr3(void);\nu_long\trcr4(void);\nuint64_t rdmsr(u_int msr);\nuint64_t rdpmc(u_int pmc);\nuint64_t rdr0(void);\nuint64_t rdr1(void);\nuint64_t rdr2(void);\nuint64_t rdr3(void);\nuint64_t rdr4(void);\nuint64_t rdr5(void);\nuint64_t rdr6(void);\nuint64_t rdr7(void);\nuint64_t rdtsc(void);\nu_int\tread_rflags(void);\nu_int\trfs(void);\nu_int\trgs(void);\nvoid\twbinvd(void);\nvoid\twrite_rflags(u_int rf);\nvoid\twrmsr(u_int msr, uint64_t newval);\n\n#endif\t/* __GNUCLIKE_ASM && __CC_SUPPORTS___INLINE */\n\nvoid\treset_dbregs(void);\n\n#ifdef _KERNEL\nint\trdmsr_safe(u_int msr, uint64_t *val);\nint\twrmsr_safe(u_int msr, uint64_t newval);\n#endif\n\n#endif /* !_MACHINE_CPUFUNC_H_ */\n"
  },
  {
    "path": "freebsd-headers/machine/cputypes.h",
    "content": "/*-\n * Copyright (c) 1993 Christopher G. Demetriou\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. The name of the author may not be used to endorse or promote products\n *    derived from this software without specific prior written permission\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR\n * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES\n * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,\n * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF\n * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/amd64/include/cputypes.h 186797 2009-01-05 21:51:49Z jkim $\n */\n\n#ifndef _MACHINE_CPUTYPES_H_\n#define\t_MACHINE_CPUTYPES_H_\n\n/*\n * Classes of processor.\n */\n#define\tCPUCLASS_X86\t\t0\t/* X86 */\n#define\tCPUCLASS_K8\t\t1\t/* K8 AMD64 class */\n\n/*\n * Kinds of processor.\n */\n#define\tCPU_X86\t\t\t0\t/* Intel */\n#define\tCPU_CLAWHAMMER\t\t1\t/* AMD Clawhammer */\n#define\tCPU_SLEDGEHAMMER\t2\t/* AMD Sledgehammer */\n\n/*\n * Vendors of processor.\n */\n#define\tCPU_VENDOR_AMD\t\t0x1022\t\t/* AMD */\n#define\tCPU_VENDOR_IDT\t\t0x111d\t\t/* Centaur/IDT/VIA */\n#define\tCPU_VENDOR_INTEL\t0x8086\t\t/* Intel */\n#define\tCPU_VENDOR_CENTAUR\tCPU_VENDOR_IDT\n\n#ifndef LOCORE\nextern int\tcpu;\nextern int\tcpu_class;\n#endif\n\n#endif /* !_MACHINE_CPUTYPES_H_ */\n"
  },
  {
    "path": "freebsd-headers/machine/db_machdep.h",
    "content": "/*-\n * Mach Operating System\n * Copyright (c) 1991,1990 Carnegie Mellon University\n * All Rights Reserved.\n *\n * Permission to use, copy, modify and distribute this software and its\n * documentation is hereby granted, provided that both the copyright\n * notice and this permission notice appear in all copies of the\n * software, derivative works or modified versions, and any portions\n * thereof, and that both notices appear in supporting documentation.\n *\n * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS \"AS IS\"\n * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR\n * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.\n *\n * Carnegie Mellon requests users of this software to return to\n *\n *  Software Distribution Coordinator  or  Software.Distribution@CS.CMU.EDU\n *  School of Computer Science\n *  Carnegie Mellon University\n *  Pittsburgh PA 15213-3890\n *\n * any improvements or extensions that they make and grant Carnegie Mellon\n * the rights to redistribute these changes.\n *\n * $FreeBSD: release/9.0.0/sys/amd64/include/db_machdep.h 139731 2005-01-05 20:17:21Z imp $\n */\n\n#ifndef _MACHINE_DB_MACHDEP_H_\n#define\t_MACHINE_DB_MACHDEP_H_\n\n#include <machine/frame.h>\n#include <machine/trap.h>\n\ntypedef\tvm_offset_t\tdb_addr_t;\t/* address - unsigned */\ntypedef\tlong\t\tdb_expr_t;\t/* expression - signed */\n\n#define\tPC_REGS()\t((db_addr_t)kdb_thrctx->pcb_rip)\n\n#define\tBKPT_INST\t0xcc\t\t/* breakpoint instruction */\n#define\tBKPT_SIZE\t(1)\t\t/* size of breakpoint inst */\n#define\tBKPT_SET(inst)\t(BKPT_INST)\n\n#define BKPT_SKIP\t\t\t\t\\\ndo {\t\t\t\t\t\t\\\n\tkdb_frame->tf_rip += 1;\t\t\t\\\n\tkdb_thrctx->pcb_rip += 1;\t\t\\\n} while(0)\n\n#define\tFIXUP_PC_AFTER_BREAK\t\t\t\\\ndo {\t\t\t\t\t\t\\\n\tkdb_frame->tf_rip -= 1;\t\t\t\\\n\tkdb_thrctx->pcb_rip -= 1;\t\t\\\n} while(0);\n\n#define\tdb_clear_single_step\tkdb_cpu_clear_singlestep\n#define\tdb_set_single_step\tkdb_cpu_set_singlestep\n\n#define\tIS_BREAKPOINT_TRAP(type, code)\t((type) == T_BPTFLT)\n/*\n * Watchpoints are not supported.  The debug exception type is in %dr6\n * and not yet in the args to this macro.\n */\n#define IS_WATCHPOINT_TRAP(type, code)\t0\n\n#define\tI_CALL\t\t0xe8\n#define\tI_CALLI\t\t0xff\n#define\tI_RET\t\t0xc3\n#define\tI_IRET\t\t0xcf\n\n#define\tinst_trap_return(ins)\t(((ins)&0xff) == I_IRET)\n#define\tinst_return(ins)\t(((ins)&0xff) == I_RET)\n#define\tinst_call(ins)\t\t(((ins)&0xff) == I_CALL || \\\n\t\t\t\t (((ins)&0xff) == I_CALLI && \\\n\t\t\t\t  ((ins)&0x3800) == 0x1000))\n#define inst_load(ins)\t\t0\n#define inst_store(ins)\t\t0\n\n/*\n * There no interesting addresses below _kstack = 0xefbfe000.  There\n * are small absolute values for GUPROF, but we don't want to see them.\n * Treat \"negative\" addresses below _kstack as non-small to allow for\n * future reductions of _kstack and to avoid sign extension problems.\n *\n * There is one interesting symbol above -db_maxoff = 0xffff0000,\n * namely _APTD = 0xfffff000.  Accepting this would mess up the\n * printing of small negative offsets.  The next largest symbol is\n * _APTmap = 0xffc00000.  Accepting this is OK (unless db_maxoff is\n * set to >= 0x400000 - (max stack offset)).\n */\n#define\tDB_SMALL_VALUE_MAX\t0x7fffffff\n#define\tDB_SMALL_VALUE_MIN\t(-0x400001)\n\n#endif /* !_MACHINE_DB_MACHDEP_H_ */\n"
  },
  {
    "path": "freebsd-headers/machine/elf.h",
    "content": "/*-\n * Copyright (c) 1996-1997 John D. Polstra.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/amd64/include/elf.h 217097 2011-01-07 14:22:34Z kib $\n */\n\n#ifndef _MACHINE_ELF_H_\n#define\t_MACHINE_ELF_H_ 1\n\n/*\n * ELF definitions for the AMD64 architecture.\n */\n\n\n#ifndef __ELF_WORD_SIZE\n#define\t__ELF_WORD_SIZE\t64\t/* Used by <sys/elf_generic.h> */\n#endif\n#include <sys/elf32.h>\t/* Definitions common to all 32 bit architectures. */\n#include <sys/elf64.h>\t/* Definitions common to all 64 bit architectures. */\n#include <sys/elf_generic.h>\n\n#define\tELF_ARCH\tEM_X86_64\n#define\tELF_ARCH32\tEM_386\n\n#define\tELF_MACHINE_OK(x) ((x) == EM_X86_64)\n\n/*\n * Auxiliary vector entries for passing information to the interpreter.\n *\n * The i386 supplement to the SVR4 ABI specification names this \"auxv_t\",\n * but POSIX lays claim to all symbols ending with \"_t\".\n */\ntypedef struct {\t/* Auxiliary vector entry on initial stack */\n\tint\ta_type;\t\t\t/* Entry type. */\n\tunion {\n\t\tint\ta_val;\t\t/* Integer value. */\n\t} a_un;\n} Elf32_Auxinfo;\n\n\ntypedef struct {\t/* Auxiliary vector entry on initial stack */\n\tlong\ta_type;\t\t\t/* Entry type. */\n\tunion {\n\t\tlong\ta_val;\t\t/* Integer value. */\n\t\tvoid\t*a_ptr;\t\t/* Address. */\n\t\tvoid\t(*a_fcn)(void);\t/* Function pointer (not used). */\n\t} a_un;\n} Elf64_Auxinfo;\n\n__ElfType(Auxinfo);\n\n/* Values for a_type. */\n#define\tAT_NULL\t\t0\t/* Terminates the vector. */\n#define\tAT_IGNORE\t1\t/* Ignored entry. */\n#define\tAT_EXECFD\t2\t/* File descriptor of program to load. */\n#define\tAT_PHDR\t\t3\t/* Program header of program already loaded. */\n#define\tAT_PHENT\t4\t/* Size of each program header entry. */\n#define\tAT_PHNUM\t5\t/* Number of program header entries. */\n#define\tAT_PAGESZ\t6\t/* Page size in bytes. */\n#define\tAT_BASE\t\t7\t/* Interpreter's base address. */\n#define\tAT_FLAGS\t8\t/* Flags (unused for i386). */\n#define\tAT_ENTRY\t9\t/* Where interpreter should transfer control. */\n#define\tAT_NOTELF\t10\t/* Program is not ELF ?? */\n#define\tAT_UID\t\t11\t/* Real uid. */\n#define\tAT_EUID\t\t12\t/* Effective uid. */\n#define\tAT_GID\t\t13\t/* Real gid. */\n#define\tAT_EGID\t\t14\t/* Effective gid. */\n#define\tAT_EXECPATH\t15\t/* Path to the executable. */\n#define\tAT_CANARY\t16\t/* Canary for SSP */\n#define\tAT_CANARYLEN\t17\t/* Length of the canary. */\n#define\tAT_OSRELDATE\t18\t/* OSRELDATE. */\n#define\tAT_NCPUS\t19\t/* Number of CPUs. */\n#define\tAT_PAGESIZES\t20\t/* Pagesizes. */\n#define\tAT_PAGESIZESLEN\t21\t/* Number of pagesizes. */\n#define\tAT_STACKPROT\t23\t/* Initial stack protection. */\n\n#define\tAT_COUNT\t24\t/* Count of defined aux entry types. */\n\n/*\n * Relocation types.\n */\n\n#define\tR_X86_64_COUNT\t24\t/* Count of defined relocation types. */\n\n/* Define \"machine\" characteristics */\n#if __ELF_WORD_SIZE == 32\n#define ELF_TARG_CLASS  ELFCLASS32\n#else\n#define ELF_TARG_CLASS  ELFCLASS64\n#endif\n#define\tELF_TARG_DATA\tELFDATA2LSB\n#define\tELF_TARG_MACH\tEM_X86_64\n#define\tELF_TARG_VER\t1\n\n#if __ELF_WORD_SIZE == 32\n#define\tET_DYN_LOAD_ADDR 0x01001000\n#else\n#define\tET_DYN_LOAD_ADDR 0x01021000\n#endif\n\n#endif /* !_MACHINE_ELF_H_ */\n"
  },
  {
    "path": "freebsd-headers/machine/endian.h",
    "content": "/*-\n * Copyright (c) 1987, 1991 Regents of the University of California.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 4. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t@(#)endian.h\t7.8 (Berkeley) 4/3/91\n * $FreeBSD: release/9.0.0/sys/amd64/include/endian.h 219819 2011-03-21 09:40:01Z jeff $\n */\n\n#ifndef _MACHINE_ENDIAN_H_\n#define\t_MACHINE_ENDIAN_H_\n\n#include <sys/cdefs.h>\n#include <sys/_types.h>\n\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\n/*\n * Define the order of 32-bit words in 64-bit words.\n */\n#define\t_QUAD_HIGHWORD 1\n#define\t_QUAD_LOWWORD 0\n\n/*\n * Definitions for byte order, according to byte significance from low\n * address to high.\n */\n#define\t_LITTLE_ENDIAN\t1234\t/* LSB first: i386, vax */\n#define\t_BIG_ENDIAN\t4321\t/* MSB first: 68000, ibm, net */\n#define\t_PDP_ENDIAN\t3412\t/* LSB first in word, MSW first in long */\n\n#define\t_BYTE_ORDER\t_LITTLE_ENDIAN\n\n/*\n * Deprecated variants that don't have enough underscores to be useful in more\n * strict namespaces.\n */\n#if __BSD_VISIBLE\n#define\tLITTLE_ENDIAN\t_LITTLE_ENDIAN\n#define\tBIG_ENDIAN\t_BIG_ENDIAN\n#define\tPDP_ENDIAN\t_PDP_ENDIAN\n#define\tBYTE_ORDER\t_BYTE_ORDER\n#endif\n\n#if defined(__GNUCLIKE_ASM) && defined(__GNUCLIKE_BUILTIN_CONSTANT_P)\n\n#define\t__bswap64_const(_x)\t\t\t\\\n\t(((_x) >> 56) |\t\t\t\t\\\n\t(((_x) >> 40) & (0xffUL << 8)) |\t\\\n\t(((_x) >> 24) & (0xffUL << 16)) |\t\\\n\t(((_x) >> 8) & (0xffUL << 24)) |\t\\\n\t(((_x) << 8) & (0xffUL << 32)) |\t\\\n\t(((_x) << 24) & (0xffUL << 40)) |\t\\\n\t(((_x) << 40) & (0xffUL << 48)) |\t\\\n\t((_x) << 56))\n\n#define\t__bswap32_const(_x)\t\t\t\\\n\t(((_x) >> 24) |\t\t\t\t\\\n\t(((_x) & (0xff << 16)) >> 8) |\t\t\\\n\t(((_x) & (0xff << 8)) << 8) |\t\t\\\n\t((_x) << 24))\n\n#define __bswap16_const(_x)\t(__uint16_t)((_x) << 8 | (_x) >> 8)\n\nstatic __inline __uint64_t\n__bswap64_var(__uint64_t _x)\n{\n\n\t__asm (\"bswap %0\" : \"+r\" (_x));\n\treturn (_x);\n}\n\nstatic __inline __uint32_t\n__bswap32_var(__uint32_t _x)\n{\n\n\t__asm (\"bswap %0\" : \"+r\" (_x));\n\treturn (_x);\n}\n\nstatic __inline __uint16_t\n__bswap16_var(__uint16_t _x)\n{\n\n\treturn (__bswap16_const(_x));\n}\n\n#define\t__bswap64(_x)\t\t\t\t\t\\\n\t(__builtin_constant_p(_x) ?\t\t\t\\\n\t    __bswap64_const((__uint64_t)(_x)) : __bswap64_var(_x))\n\n#define\t__bswap32(_x)\t\t\t\t\t\\\n\t(__builtin_constant_p(_x) ?\t\t\t\\\n\t    __bswap32_const((__uint32_t)(_x)) : __bswap32_var(_x))\n\n#define\t__bswap16(_x)\t\t\t\t\t\\\n\t(__builtin_constant_p(_x) ?\t\t\t\\\n\t    __bswap16_const((__uint16_t)(_x)) : __bswap16_var(_x))\n\n#define\t__htonl(x)\t__bswap32(x)\n#define\t__htons(x)\t__bswap16(x)\n#define\t__ntohl(x)\t__bswap32(x)\n#define\t__ntohs(x)\t__bswap16(x)\n\n#else /* !(__GNUCLIKE_ASM && __GNUCLIKE_BUILTIN_CONSTANT_P) */\n\n/*\n * No optimizations are available for this compiler.  Fall back to\n * non-optimized functions by defining the constant usually used to prevent\n * redefinition.\n */\n#define\t_BYTEORDER_FUNC_DEFINED\n\n#endif /* __GNUCLIKE_ASM && __GNUCLIKE_BUILTIN_CONSTANT_P */\n\n#ifdef __cplusplus\n}\n#endif\n\n#endif /* !_MACHINE_ENDIAN_H_ */\n"
  },
  {
    "path": "freebsd-headers/machine/exec.h",
    "content": "/*-\n * Copyright (c) 1992, 1993\n *\tThe Regents of the University of California.  All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 4. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t@(#)exec.h\t8.1 (Berkeley) 6/11/93\n * $FreeBSD: release/9.0.0/sys/amd64/include/exec.h 142107 2005-02-19 21:16:48Z ru $\n */\n\n#ifndef\t_MACHINE_EXEC_H_\n#define\t_MACHINE_EXEC_H_\n\n#define\t__LDPGSZ\t4096\n\n#endif /* !_MACHINE_EXEC_H_ */\n"
  },
  {
    "path": "freebsd-headers/machine/float.h",
    "content": "/*-\n * Copyright (c) 1989 Regents of the University of California.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 4. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\tfrom: @(#)float.h\t7.1 (Berkeley) 5/8/90\n * $FreeBSD: release/9.0.0/sys/amd64/include/float.h 175398 2008-01-17 13:12:46Z bde $\n */\n\n#ifndef _MACHINE_FLOAT_H_\n#define _MACHINE_FLOAT_H_ 1\n\n#include <sys/cdefs.h>\n\n__BEGIN_DECLS\nextern int __flt_rounds(void);\n__END_DECLS\n\n#define FLT_RADIX\t2\t\t/* b */\n#define FLT_ROUNDS\t__flt_rounds()\n#if __ISO_C_VISIBLE >= 1999\n#define\tFLT_EVAL_METHOD\t0\t\t/* no promotions */\n#define\tDECIMAL_DIG\t21\t\t/* max precision in decimal digits */\n#endif\n\n#define FLT_MANT_DIG\t24\t\t/* p */\n#define FLT_EPSILON\t1.19209290E-07F\t/* b**(1-p) */\n#define FLT_DIG\t\t6\t\t/* floor((p-1)*log10(b))+(b == 10) */\n#define FLT_MIN_EXP\t(-125)\t\t/* emin */\n#define FLT_MIN\t\t1.17549435E-38F\t/* b**(emin-1) */\n#define FLT_MIN_10_EXP\t(-37)\t\t/* ceil(log10(b**(emin-1))) */\n#define FLT_MAX_EXP\t128\t\t/* emax */\n#define FLT_MAX\t\t3.40282347E+38F\t/* (1-b**(-p))*b**emax */\n#define FLT_MAX_10_EXP\t38\t\t/* floor(log10((1-b**(-p))*b**emax)) */\n\n#define DBL_MANT_DIG\t53\n#define DBL_EPSILON\t2.2204460492503131E-16\n#define DBL_DIG\t\t15\n#define DBL_MIN_EXP\t(-1021)\n#define DBL_MIN\t\t2.2250738585072014E-308\n#define DBL_MIN_10_EXP\t(-307)\n#define DBL_MAX_EXP\t1024\n#define DBL_MAX\t\t1.7976931348623157E+308\n#define DBL_MAX_10_EXP\t308\n\n#define LDBL_MANT_DIG\t64\n#define LDBL_EPSILON\t1.0842021724855044340E-19L\n#define LDBL_DIG\t18\n#define LDBL_MIN_EXP\t(-16381)\n#define LDBL_MIN\t3.3621031431120935063E-4932L\n#define LDBL_MIN_10_EXP\t(-4931)\n#define LDBL_MAX_EXP\t16384\n#define LDBL_MAX\t1.1897314953572317650E+4932L\n#define LDBL_MAX_10_EXP\t4932\n#endif /* _MACHINE_FLOAT_H_ */\n"
  },
  {
    "path": "freebsd-headers/machine/floatingpoint.h",
    "content": "/*-\n * Copyright (c) 1993 Andrew Moore, Talke Studio\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. All advertising materials mentioning features or use of this software\n *    must display the following acknowledgement:\n *\tThis product includes software developed by the University of\n *\tCalifornia, Berkeley and its contributors.\n * 4. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\tfrom: @(#) floatingpoint.h\t1.0 (Berkeley) 9/23/93\n * $FreeBSD: release/9.0.0/sys/amd64/include/floatingpoint.h 144544 2005-04-02 17:31:42Z netchild $\n */\n\n#ifndef _FLOATINGPOINT_H_\n#define _FLOATINGPOINT_H_\n\n#include <sys/cdefs.h>\n#include <machine/ieeefp.h>\n\n#endif /* !_FLOATINGPOINT_H_ */\n"
  },
  {
    "path": "freebsd-headers/machine/fpu.h",
    "content": "/*-\n * Copyright (c) 1990 The Regents of the University of California.\n * All rights reserved.\n *\n * This code is derived from software contributed to Berkeley by\n * William Jolitz.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 4. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\tfrom: @(#)npx.h\t5.3 (Berkeley) 1/18/91\n * $FreeBSD: release/9.0.0/sys/amd64/include/fpu.h 215865 2010-11-26 14:50:42Z kib $\n */\n\n/*\n * Floating Point Data Structures and Constants\n * W. Jolitz 1/90\n */\n\n#ifndef _MACHINE_FPU_H_\n#define\t_MACHINE_FPU_H_\n\n/* Contents of each x87 floating point accumulator */\nstruct fpacc87 {\n\tu_char\tfp_bytes[10];\n};\n\n/* Contents of each SSE extended accumulator */\nstruct  xmmacc {\n\tu_char\txmm_bytes[16];\n};\n\nstruct  envxmm {\n\tu_int16_t\ten_cw;\t\t/* control word (16bits) */\n\tu_int16_t\ten_sw;\t\t/* status word (16bits) */\n\tu_int8_t\ten_tw;\t\t/* tag word (8bits) */\n\tu_int8_t\ten_zero;\n\tu_int16_t\ten_opcode;\t/* opcode last executed (11 bits ) */\n\tu_int64_t\ten_rip;\t\t/* floating point instruction pointer */\n\tu_int64_t\ten_rdp;\t\t/* floating operand pointer */\n\tu_int32_t\ten_mxcsr;\t/* SSE sontorol/status register */\n\tu_int32_t\ten_mxcsr_mask;\t/* valid bits in mxcsr */\n};\n\nstruct  savefpu {\n\tstruct\tenvxmm\tsv_env;\n\tstruct {\n\t\tstruct fpacc87\tfp_acc;\n\t\tu_char\t\tfp_pad[6];      /* padding */\n\t} sv_fp[8];\n\tstruct xmmacc\tsv_xmm[16];\n\tu_char sv_pad[96];\n} __aligned(16);\n\n#ifdef _KERNEL\nstruct fpu_kern_ctx {\n\tstruct savefpu hwstate;\n\tstruct savefpu *prev;\n\tuint32_t flags;\n};\n#define\tFPU_KERN_CTX_FPUINITDONE 0x01\n\n#define\tPCB_USER_FPU(pcb) (((pcb)->pcb_flags & PCB_KERNFPU) == 0)\n#endif\n\n/*\n * The hardware default control word for i387's and later coprocessors is\n * 0x37F, giving:\n *\n *\tround to nearest\n *\t64-bit precision\n *\tall exceptions masked.\n *\n * FreeBSD/i386 uses 53 bit precision for things like fadd/fsub/fsqrt etc\n * because of the difference between memory and fpu register stack arguments.\n * If its using an intermediate fpu register, it has 80/64 bits to work\n * with.  If it uses memory, it has 64/53 bits to work with.  However,\n * gcc is aware of this and goes to a fair bit of trouble to make the\n * best use of it.\n *\n * This is mostly academic for AMD64, because the ABI prefers the use\n * SSE2 based math.  For FreeBSD/amd64, we go with the default settings.\n */\n#define\t__INITIAL_FPUCW__\t0x037F\n#define\t__INITIAL_FPUCW_I386__\t0x127F\n#define\t__INITIAL_MXCSR__\t0x1F80\n#define\t__INITIAL_MXCSR_MASK__\t0xFFBF\n\n#ifdef _KERNEL\nvoid\tfpudna(void);\nvoid\tfpudrop(void);\nvoid\tfpuexit(struct thread *td);\nint\tfpuformat(void);\nint\tfpugetregs(struct thread *td);\nvoid\tfpuinit(void);\nvoid\tfpusetregs(struct thread *td, struct savefpu *addr);\nint\tfputrap(void);\nvoid\tfpuuserinited(struct thread *td);\nint\tfpu_kern_enter(struct thread *td, struct fpu_kern_ctx *ctx,\n\t    u_int flags);\nint\tfpu_kern_leave(struct thread *td, struct fpu_kern_ctx *ctx);\nint\tfpu_kern_thread(u_int flags);\nint\tis_fpu_kern_thread(u_int flags);\n\n/*\n * Flags for fpu_kern_enter() and fpu_kern_thread().\n */\n#define\tFPU_KERN_NORMAL\t0x0000\n\n#endif\n\n#endif /* !_MACHINE_FPU_H_ */\n"
  },
  {
    "path": "freebsd-headers/machine/frame.h",
    "content": "/*-\n * Copyright (c) 2003 Peter Wemm.\n * Copyright (c) 1990 The Regents of the University of California.\n * All rights reserved.\n *\n * This code is derived from software contributed to Berkeley by\n * William Jolitz.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 4. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\tfrom: @(#)frame.h\t5.2 (Berkeley) 1/18/91\n * $FreeBSD: release/9.0.0/sys/amd64/include/frame.h 190620 2009-04-01 13:09:26Z kib $\n */\n\n#ifndef _MACHINE_FRAME_H_\n#define _MACHINE_FRAME_H_ 1\n\n/*\n * System stack frames.\n */\n\n/*\n * Exception/Trap Stack Frame\n *\n * The ordering of this is specifically so that we can take first 6\n * the syscall arguments directly from the beginning of the frame.\n */\n\nstruct trapframe {\n\tregister_t\ttf_rdi;\n\tregister_t\ttf_rsi;\n\tregister_t\ttf_rdx;\n\tregister_t\ttf_rcx;\n\tregister_t\ttf_r8;\n\tregister_t\ttf_r9;\n\tregister_t\ttf_rax;\n\tregister_t\ttf_rbx;\n\tregister_t\ttf_rbp;\n\tregister_t\ttf_r10;\n\tregister_t\ttf_r11;\n\tregister_t\ttf_r12;\n\tregister_t\ttf_r13;\n\tregister_t\ttf_r14;\n\tregister_t\ttf_r15;\n\tuint32_t\ttf_trapno;\n\tuint16_t\ttf_fs;\n\tuint16_t\ttf_gs;\n\tregister_t\ttf_addr;\n\tuint32_t\ttf_flags;\n\tuint16_t\ttf_es;\n\tuint16_t\ttf_ds;\n\t/* below portion defined in hardware */\n\tregister_t\ttf_err;\n\tregister_t\ttf_rip;\n\tregister_t\ttf_cs;\n\tregister_t\ttf_rflags;\n\tregister_t\ttf_rsp;\n\tregister_t\ttf_ss;\n};\n\n#define\tTF_HASSEGS\t0x1\n/* #define\t_MC_HASBASES\t0x2 */\n\n#endif /* _MACHINE_FRAME_H_ */\n"
  },
  {
    "path": "freebsd-headers/machine/gdb_machdep.h",
    "content": "/*-\n * Copyright (c) 2004 Marcel Moolenaar\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n *\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR\n * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES\n * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,\n * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF\n * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/amd64/include/gdb_machdep.h 166520 2007-02-05 21:48:32Z jhb $\n */\n\n#ifndef _MACHINE_GDB_MACHDEP_H_\n#define\t_MACHINE_GDB_MACHDEP_H_\n\n#define\tGDB_BUFSZ\t(GDB_NREGS * 16)\n#define\tGDB_NREGS\t56\n#define\tGDB_REG_PC\t16\n\nstatic __inline size_t\ngdb_cpu_regsz(int regnum)\n{\n\treturn ((regnum > 16 && regnum < 24) ? 4 : 8);\n}\n\nstatic __inline int\ngdb_cpu_query(void)\n{\n\treturn (0);\n}\n\nvoid *gdb_cpu_getreg(int, size_t *);\nvoid gdb_cpu_setreg(int, void *);\nint gdb_cpu_signal(int, int);\n\n#endif /* !_MACHINE_GDB_MACHDEP_H_ */\n"
  },
  {
    "path": "freebsd-headers/machine/ieeefp.h",
    "content": "/*-\n * Copyright (c) 2003 Peter Wemm.\n * Copyright (c) 1990 Andrew Moore, Talke Studio\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. All advertising materials mentioning features or use of this software\n *    must display the following acknowledgement:\n *\tThis product includes software developed by the University of\n *\tCalifornia, Berkeley and its contributors.\n * 4. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * \tfrom: @(#) ieeefp.h \t1.0 (Berkeley) 9/23/93\n * $FreeBSD: release/9.0.0/sys/amd64/include/ieeefp.h 175231 2008-01-11 17:11:32Z bde $\n */\n\n#ifndef _MACHINE_IEEEFP_H_\n#define _MACHINE_IEEEFP_H_\n\n/*\n * IEEE floating point type, constant and function definitions.\n * XXX: {FP,SSE}*FLD and {FP,SSE}*OFF are undocumented pollution.\n */\n\n#ifndef _SYS_CDEFS_H_\n#error this file needs sys/cdefs.h as a prerequisite\n#endif\n\n/*\n * Rounding modes.\n */\ntypedef enum {\n\tFP_RN=0,\t/* round to nearest */\n\tFP_RM,\t\t/* round down towards minus infinity */\n\tFP_RP,\t\t/* round up towards plus infinity */\n\tFP_RZ\t\t/* truncate */\n} fp_rnd_t;\n\n/*\n * Precision (i.e., rounding precision) modes.\n */\ntypedef enum {\n\tFP_PS=0,\t/* 24 bit (single-precision) */\n\tFP_PRS,\t\t/* reserved */\n\tFP_PD,\t\t/* 53 bit (double-precision) */\n\tFP_PE\t\t/* 64 bit (extended-precision) */\n} fp_prec_t;\n\n#define fp_except_t\tint\n\n/*\n * Exception bit masks.\n */\n#define FP_X_INV\t0x01\t/* invalid operation */\n#define FP_X_DNML\t0x02\t/* denormal */\n#define FP_X_DZ\t\t0x04\t/* zero divide */\n#define FP_X_OFL\t0x08\t/* overflow */\n#define FP_X_UFL\t0x10\t/* underflow */\n#define FP_X_IMP\t0x20\t/* (im)precision */\n#define FP_X_STK\t0x40\t/* stack fault */\n\n/*\n * FPU control word bit-field masks.\n */\n#define FP_MSKS_FLD\t0x3f\t/* exception masks field */\n#define FP_PRC_FLD\t0x300\t/* precision control field */\n#define\tFP_RND_FLD\t0xc00\t/* rounding control field */\n\n/*\n * FPU status word bit-field masks.\n */\n#define FP_STKY_FLD\t0x3f\t/* sticky flags field */\n\n/*\n * SSE mxcsr register bit-field masks.\n */\n#define\tSSE_STKY_FLD\t0x3f\t/* exception flags */\n#define\tSSE_DAZ_FLD\t0x40\t/* Denormals are zero */\n#define\tSSE_MSKS_FLD\t0x1f80\t/* exception masks field */\n#define\tSSE_RND_FLD\t0x6000\t/* rounding control */\n#define\tSSE_FZ_FLD\t0x8000\t/* flush to zero on underflow */\n\n/*\n * FPU control word bit-field offsets (shift counts).\n */\n#define FP_MSKS_OFF\t0\t/* exception masks offset */\n#define FP_PRC_OFF\t8\t/* precision control offset */\n#define\tFP_RND_OFF\t10\t/* rounding control offset */\n\n/*\n * FPU status word bit-field offsets (shift counts).\n */\n#define FP_STKY_OFF\t0\t/* sticky flags offset */\n\n/*\n * SSE mxcsr register bit-field offsets (shift counts).\n */\n#define\tSSE_STKY_OFF\t0\t/* exception flags offset */\n#define\tSSE_DAZ_OFF\t6\t/* DAZ exception mask offset */\n#define\tSSE_MSKS_OFF\t7\t/* other exception masks offset */\n#define\tSSE_RND_OFF\t13\t/* rounding control offset */\n#define\tSSE_FZ_OFF\t15\t/* flush to zero offset */\n\n#ifdef __GNUCLIKE_ASM\n\n#define\t__fldcw(addr)\t__asm __volatile(\"fldcw %0\" : : \"m\" (*(addr)))\n#define\t__fldenv(addr)\t__asm __volatile(\"fldenv %0\" : : \"m\" (*(addr)))\n#define\t__fnstcw(addr)\t__asm __volatile(\"fnstcw %0\" : \"=m\" (*(addr)))\n#define\t__fnstenv(addr)\t__asm __volatile(\"fnstenv %0\" : \"=m\" (*(addr)))\n#define\t__fnstsw(addr)\t__asm __volatile(\"fnstsw %0\" : \"=m\" (*(addr)))\n#define\t__ldmxcsr(addr)\t__asm __volatile(\"ldmxcsr %0\" : : \"m\" (*(addr)))\n#define\t__stmxcsr(addr)\t__asm __volatile(\"stmxcsr %0\" : \"=m\" (*(addr)))\n\n/*\n * Load the control word.  Be careful not to trap if there is a currently\n * unmasked exception (ones that will become freshly unmasked are not a\n * problem).  This case must be handled by a save/restore of the\n * environment or even of the full x87 state.  Accessing the environment\n * is very inefficient, so only do it when necessary.\n */\nstatic __inline void\n__fnldcw(unsigned short _cw, unsigned short _newcw)\n{\n\tstruct {\n\t\tunsigned _cw;\n\t\tunsigned _other[6];\n\t} _env;\n\tunsigned short _sw;\n\n\tif ((_cw & FP_MSKS_FLD) != FP_MSKS_FLD) {\n\t\t__fnstsw(&_sw);\n\t\tif (((_sw & ~_cw) & FP_STKY_FLD) != 0) {\n\t\t\t__fnstenv(&_env);\n\t\t\t_env._cw = _newcw;\n\t\t\t__fldenv(&_env);\n\t\t\treturn;\n\t\t}\n\t}\n\t__fldcw(&_newcw);\n}\n\n/*\n * General notes about conflicting SSE vs FP status bits.\n * This code assumes that software will not fiddle with the control\n * bits of the SSE and x87 in such a way to get them out of sync and\n * still expect this to work.  Break this at your peril.\n * Because I based this on the i386 port, the x87 state is used for\n * the fpget*() functions, and is shadowed into the SSE state for\n * the fpset*() functions.  For dual source fpget*() functions, I\n * merge the two together.  I think.\n */\n\nstatic __inline fp_rnd_t\n__fpgetround(void)\n{\n\tunsigned short _cw;\n\n\t__fnstcw(&_cw);\n\treturn ((fp_rnd_t)((_cw & FP_RND_FLD) >> FP_RND_OFF));\n}\n\nstatic __inline fp_rnd_t\n__fpsetround(fp_rnd_t _m)\n{\n\tfp_rnd_t _p;\n\tunsigned _mxcsr;\n\tunsigned short _cw, _newcw;\n\n\t__fnstcw(&_cw);\n\t_p = (fp_rnd_t)((_cw & FP_RND_FLD) >> FP_RND_OFF);\n\t_newcw = _cw & ~FP_RND_FLD;\n\t_newcw |= (_m << FP_RND_OFF) & FP_RND_FLD;\n\t__fnldcw(_cw, _newcw);\n\t__stmxcsr(&_mxcsr);\n\t_mxcsr &= ~SSE_RND_FLD;\n\t_mxcsr |= (_m << SSE_RND_OFF) & SSE_RND_FLD;\n\t__ldmxcsr(&_mxcsr);\n\treturn (_p);\n}\n\n/*\n * Get or set the rounding precision for x87 arithmetic operations.\n * There is no equivalent SSE mode or control.\n */\n\nstatic __inline fp_prec_t\n__fpgetprec(void)\n{\n\tunsigned short _cw;\n\n\t__fnstcw(&_cw);\n\treturn ((fp_prec_t)((_cw & FP_PRC_FLD) >> FP_PRC_OFF));\n}\n\nstatic __inline fp_prec_t\n__fpsetprec(fp_prec_t _m)\n{\n\tfp_prec_t _p;\n\tunsigned short _cw, _newcw;\n\n\t__fnstcw(&_cw);\n\t_p = (fp_prec_t)((_cw & FP_PRC_FLD) >> FP_PRC_OFF);\n\t_newcw = _cw & ~FP_PRC_FLD;\n\t_newcw |= (_m << FP_PRC_OFF) & FP_PRC_FLD;\n\t__fnldcw(_cw, _newcw);\n\treturn (_p);\n}\n\n/*\n * Get or set the exception mask.\n * Note that the x87 mask bits are inverted by the API -- a mask bit of 1\n * means disable for x87 and SSE, but for fp*mask() it means enable.\n */\n\nstatic __inline fp_except_t\n__fpgetmask(void)\n{\n\tunsigned short _cw;\n\n\t__fnstcw(&_cw);\n\treturn ((~_cw & FP_MSKS_FLD) >> FP_MSKS_OFF);\n}\n\nstatic __inline fp_except_t\n__fpsetmask(fp_except_t _m)\n{\n\tfp_except_t _p;\n\tunsigned _mxcsr;\n\tunsigned short _cw, _newcw;\n\n\t__fnstcw(&_cw);\n\t_p = (~_cw & FP_MSKS_FLD) >> FP_MSKS_OFF;\n\t_newcw = _cw & ~FP_MSKS_FLD;\n\t_newcw |= (~_m << FP_MSKS_OFF) & FP_MSKS_FLD;\n\t__fnldcw(_cw, _newcw);\n\t__stmxcsr(&_mxcsr);\n\t/* XXX should we clear non-ieee SSE_DAZ_FLD and SSE_FZ_FLD ? */\n\t_mxcsr &= ~SSE_MSKS_FLD;\n\t_mxcsr |= (~_m << SSE_MSKS_OFF) & SSE_MSKS_FLD;\n\t__ldmxcsr(&_mxcsr);\n\treturn (_p);\n}\n\nstatic __inline fp_except_t\n__fpgetsticky(void)\n{\n\tunsigned _ex, _mxcsr;\n\tunsigned short _sw;\n\n\t__fnstsw(&_sw);\n\t_ex = (_sw & FP_STKY_FLD) >> FP_STKY_OFF;\n\t__stmxcsr(&_mxcsr);\n\t_ex |= (_mxcsr & SSE_STKY_FLD) >> SSE_STKY_OFF;\n\treturn ((fp_except_t)_ex);\n}\n\n#endif /* __GNUCLIKE_ASM */\n\n#if !defined(__IEEEFP_NOINLINES__) && defined(__GNUCLIKE_ASM)\n\n#define\tfpgetmask()\t__fpgetmask()\n#define\tfpgetprec()\t__fpgetprec()\n#define\tfpgetround()\t__fpgetround()\n#define\tfpgetsticky()\t__fpgetsticky()\n#define\tfpsetmask(m)\t__fpsetmask(m)\n#define\tfpsetprec(m)\t__fpsetprec(m)\n#define\tfpsetround(m)\t__fpsetround(m)\n\n/* Suppress prototypes in the MI header. */\n#define\t_IEEEFP_INLINED_\t1\n\n#else /* !(!__IEEEFP_NOINLINES__ && __GNUCLIKE_ASM) */\n\n/* Augment the userland declarations. */\n__BEGIN_DECLS\nfp_prec_t\tfpgetprec(void);\nfp_prec_t\tfpsetprec(fp_prec_t);\n__END_DECLS\n\n#endif /* !__IEEEFP_NOINLINES__ && __GNUCLIKE_ASM */\n\n#endif /* !_MACHINE_IEEEFP_H_ */\n"
  },
  {
    "path": "freebsd-headers/machine/in_cksum.h",
    "content": "/*-\n * Copyright (c) 1990 The Regents of the University of California.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 4. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\tfrom tahoe:\tin_cksum.c\t1.2\t86/01/05\n *\tfrom:\t\t@(#)in_cksum.c\t1.3 (Berkeley) 1/19/91\n *\tfrom: Id: in_cksum.c,v 1.8 1995/12/03 18:35:19 bde Exp\n * $FreeBSD: release/9.0.0/sys/amd64/include/in_cksum.h 143434 2005-03-11 22:16:09Z peter $\n */\n\n#ifndef _MACHINE_IN_CKSUM_H_\n#define\t_MACHINE_IN_CKSUM_H_\t1\n\n#ifndef _SYS_CDEFS_H_\n#error this file needs sys/cdefs.h as a prerequisite\n#endif\n\n#include <sys/cdefs.h>\n\n#define in_cksum(m, len)\tin_cksum_skip(m, len, 0)\n\n/*\n * It it useful to have an Internet checksum routine which is inlineable\n * and optimized specifically for the task of computing IP header checksums\n * in the normal case (where there are no options and the header length is\n * therefore always exactly five 32-bit words.\n */\n#ifdef __CC_SUPPORTS___INLINE\n\nstatic __inline void\nin_cksum_update(struct ip *ip)\n{\n\tint __tmpsum;\n\t__tmpsum = (int)ntohs(ip->ip_sum) + 256;\n\tip->ip_sum = htons(__tmpsum + (__tmpsum >> 16));\n}\n\n#else\n\n#define\tin_cksum_update(ip) \\\n\tdo { \\\n\t\tint __tmpsum; \\\n\t\t__tmpsum = (int)ntohs(ip->ip_sum) + 256; \\\n\t\tip->ip_sum = htons(__tmpsum + (__tmpsum >> 16)); \\\n\t} while(0)\n\n#endif\n\n#ifdef _KERNEL\nu_int in_cksum_hdr(const struct ip *ip);\nu_short\tin_addword(u_short sum, u_short b);\nu_short\tin_pseudo(u_int sum, u_int b, u_int c);\nu_short\tin_cksum_skip(struct mbuf *m, int len, int skip);\n#endif\n\n#endif /* _MACHINE_IN_CKSUM_H_ */\n"
  },
  {
    "path": "freebsd-headers/machine/intr_machdep.h",
    "content": "/*-\n * Copyright (c) 2003 John Baldwin <jhb@FreeBSD.org>\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/amd64/include/intr_machdep.h 198134 2009-10-15 14:54:35Z jhb $\n */\n\n#ifndef __MACHINE_INTR_MACHDEP_H__\n#define\t__MACHINE_INTR_MACHDEP_H__\n\n#ifdef _KERNEL\n\n/*\n * The maximum number of I/O interrupts we allow.  This number is rather\n * arbitrary as it is just the maximum IRQ resource value.  The interrupt\n * source for a given IRQ maps that I/O interrupt to device interrupt\n * source whether it be a pin on an interrupt controller or an MSI interrupt.\n * The 16 ISA IRQs are assigned fixed IDT vectors, but all other device\n * interrupts allocate IDT vectors on demand.  Currently we have 191 IDT\n * vectors available for device interrupts.  On many systems with I/O APICs,\n * a lot of the IRQs are not used, so this number can be much larger than\n * 191 and still be safe since only interrupt sources in actual use will\n * allocate IDT vectors.\n *\n * The first 255 IRQs (0 - 254) are reserved for ISA IRQs and PCI intline IRQs.\n * IRQ values beyond 256 are used by MSI.  We leave 255 unused to avoid\n * confusion since 255 is used in PCI to indicate an invalid IRQ.\n */\n#define\tNUM_MSI_INTS\t512\n#define\tFIRST_MSI_INT\t256\n#define\tNUM_IO_INTS\t(FIRST_MSI_INT + NUM_MSI_INTS)\n\n/*\n * Default base address for MSI messages on x86 platforms.\n */\n#define\tMSI_INTEL_ADDR_BASE\t\t0xfee00000\n\n/*\n * - 1 ??? dummy counter.\n * - 2 counters for each I/O interrupt.\n * - 1 counter for each CPU for lapic timer.\n * - 7 counters for each CPU for IPI counters for SMP.\n */\n#ifdef SMP\n#define\tINTRCNT_COUNT\t(1 + NUM_IO_INTS * 2 + (1 + 7) * MAXCPU)\n#else\n#define\tINTRCNT_COUNT\t(1 + NUM_IO_INTS * 2 + 1)\n#endif\n\n#ifndef LOCORE\n\ntypedef void inthand_t(u_int cs, u_int ef, u_int esp, u_int ss);\n\n#define\tIDTVEC(name)\t__CONCAT(X,name)\n\nstruct intsrc;\n\n/*\n * Methods that a PIC provides to mask/unmask a given interrupt source,\n * \"turn on\" the interrupt on the CPU side by setting up an IDT entry, and\n * return the vector associated with this source.\n */\nstruct pic {\n\tvoid (*pic_enable_source)(struct intsrc *);\n\tvoid (*pic_disable_source)(struct intsrc *, int);\n\tvoid (*pic_eoi_source)(struct intsrc *);\n\tvoid (*pic_enable_intr)(struct intsrc *);\n\tvoid (*pic_disable_intr)(struct intsrc *);\n\tint (*pic_vector)(struct intsrc *);\n\tint (*pic_source_pending)(struct intsrc *);\n\tvoid (*pic_suspend)(struct pic *);\n\tvoid (*pic_resume)(struct pic *);\n\tint (*pic_config_intr)(struct intsrc *, enum intr_trigger,\n\t    enum intr_polarity);\n\tint (*pic_assign_cpu)(struct intsrc *, u_int apic_id);\n\tSTAILQ_ENTRY(pic) pics;\n};\n\n/* Flags for pic_disable_source() */\nenum {\n\tPIC_EOI,\n\tPIC_NO_EOI,\n};\n\n/*\n * An interrupt source.  The upper-layer code uses the PIC methods to\n * control a given source.  The lower-layer PIC drivers can store additional\n * private data in a given interrupt source such as an interrupt pin number\n * or an I/O APIC pointer.\n */\nstruct intsrc {\n\tstruct pic *is_pic;\n\tstruct intr_event *is_event;\n\tu_long *is_count;\n\tu_long *is_straycount;\n\tu_int is_index;\n\tu_int is_handlers;\n};\n\nstruct trapframe;\n\n/*\n * The following data structure holds per-cpu data, and is placed just\n * above the top of the space used for the NMI stack.\n */\nstruct nmi_pcpu {\n\tregister_t\tnp_pcpu;\n\tregister_t\t__padding;\t/* pad to 16 bytes */\n};\n\nextern struct mtx icu_lock;\nextern int elcr_found;\n\n#ifndef DEV_ATPIC\nvoid\tatpic_reset(void);\n#endif\n/* XXX: The elcr_* prototypes probably belong somewhere else. */\nint\telcr_probe(void);\nenum intr_trigger elcr_read_trigger(u_int irq);\nvoid\telcr_resume(void);\nvoid\telcr_write_trigger(u_int irq, enum intr_trigger trigger);\n#ifdef SMP\nvoid\tintr_add_cpu(u_int cpu);\n#endif\nint\tintr_add_handler(const char *name, int vector, driver_filter_t filter, \n\t\t\t driver_intr_t handler, void *arg, enum intr_type flags, \n\t\t\t void **cookiep);    \n#ifdef SMP\nint\tintr_bind(u_int vector, u_char cpu);\n#endif\nint\tintr_config_intr(int vector, enum intr_trigger trig,\n    enum intr_polarity pol);\nint\tintr_describe(u_int vector, void *ih, const char *descr);\nvoid\tintr_execute_handlers(struct intsrc *isrc, struct trapframe *frame);\nu_int\tintr_next_cpu(void);\nstruct intsrc *intr_lookup_source(int vector);\nint\tintr_register_pic(struct pic *pic);\nint\tintr_register_source(struct intsrc *isrc);\nint\tintr_remove_handler(void *cookie);\nvoid\tintr_resume(void);\nvoid\tintr_suspend(void);\nvoid\tintrcnt_add(const char *name, u_long **countp);\nvoid\tnexus_add_irq(u_long irq);\nint\tmsi_alloc(device_t dev, int count, int maxcount, int *irqs);\nvoid\tmsi_init(void);\nint\tmsi_map(int irq, uint64_t *addr, uint32_t *data);\nint\tmsi_release(int *irqs, int count);\nint\tmsix_alloc(device_t dev, int *irq);\nint\tmsix_release(int irq);\n\n#endif\t/* !LOCORE */\n#endif\t/* _KERNEL */\n#endif\t/* !__MACHINE_INTR_MACHDEP_H__ */\n"
  },
  {
    "path": "freebsd-headers/machine/iodev.h",
    "content": "/*-\n * Copyright (c) 2004 Mark R V Murray\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer\n *    in this position and unchanged.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR\n * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES\n * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,\n * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF\n * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/amd64/include/iodev.h 207329 2010-04-28 15:38:01Z attilio $\n */\n#ifndef _MACHINE_IODEV_H_\n#define\t_MACHINE_IODEV_H_\n\n#ifdef _KERNEL\n#include <machine/cpufunc.h>\n\n#define\tiodev_read_1\tinb\n#define\tiodev_read_2\tinw\n#define\tiodev_read_4\tinl\n#define\tiodev_write_1\toutb\n#define\tiodev_write_2\toutw\n#define\tiodev_write_4\toutl\n\nint\t iodev_open(struct thread *td);\nint\t iodev_close(struct thread *td);\nint\t iodev_ioctl(u_long cmd, caddr_t data);\n\n#endif /* _KERNEL */\n#endif /* _MACHINE_IODEV_H_ */\n"
  },
  {
    "path": "freebsd-headers/machine/kdb.h",
    "content": "/*-\n * Copyright (c) 2004 Marcel Moolenaar\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n *\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR\n * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES\n * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,\n * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF\n * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/amd64/include/kdb.h 170473 2007-06-09 21:55:17Z marcel $\n */\n\n#ifndef _MACHINE_KDB_H_\n#define _MACHINE_KDB_H_\n\n#include <machine/frame.h>\n#include <machine/psl.h>\n\n#define\tKDB_STOPPEDPCB(pc)\t&stoppcbs[pc->pc_cpuid]\n\nstatic __inline void\nkdb_cpu_clear_singlestep(void)\n{\n\tkdb_frame->tf_rflags &= ~PSL_T;\n}\n\nstatic __inline void\nkdb_cpu_set_singlestep(void)\n{\n\tkdb_frame->tf_rflags |= PSL_T;\n}\n\nstatic __inline void\nkdb_cpu_sync_icache(unsigned char *addr, size_t size)\n{\n}\n\nstatic __inline void\nkdb_cpu_trap(int type, int code)\n{\n}\n\n#endif /* _MACHINE_KDB_H_ */\n"
  },
  {
    "path": "freebsd-headers/machine/legacyvar.h",
    "content": "/*-\n * Copyright (c) 2000 Peter Wemm <peter@FreeBSD.org>\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/amd64/include/legacyvar.h 188302 2009-02-08 07:03:34Z imp $\n */\n\n#ifndef _MACHINE_LEGACYVAR_H_\n#define\t_MACHINE_LEGACYVAR_H_\n\nenum legacy_device_ivars {\n\tLEGACY_IVAR_PCIDOMAIN,\n\tLEGACY_IVAR_PCIBUS\n};\n\n#define LEGACY_ACCESSOR(var, ivar, type)\t\t\t\t\\\n    __BUS_ACCESSOR(legacy, var, LEGACY, ivar, type)\n\nLEGACY_ACCESSOR(pcidomain,\t\tPCIDOMAIN,\tuint32_t)\nLEGACY_ACCESSOR(pcibus,\t\t\tPCIBUS,\t\tuint32_t)\n\n#undef LEGACY_ACCESSOR\n\nint\tlegacy_pcib_maxslots(device_t dev);\nuint32_t legacy_pcib_read_config(device_t dev, u_int bus, u_int slot,\n    u_int func, u_int reg, int bytes);\nint\tlegacy_pcib_read_ivar(device_t dev, device_t child, int which,\n    uintptr_t *result);\nvoid\tlegacy_pcib_write_config(device_t dev, u_int bus, u_int slot,\n    u_int func, u_int reg, uint32_t data, int bytes);\nint\tlegacy_pcib_write_ivar(device_t dev, device_t child, int which,\n    uintptr_t value);\nstruct resource *legacy_pcib_alloc_resource(device_t dev, device_t child,\n    int type, int *rid, u_long start, u_long end, u_long count, u_int flags);\n\n#endif /* !_MACHINE_LEGACYVAR_H_ */\n"
  },
  {
    "path": "freebsd-headers/machine/limits.h",
    "content": "/*-\n * Copyright (c) 1988, 1993\n *\tThe Regents of the University of California.  All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 4. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t@(#)limits.h\t8.3 (Berkeley) 1/4/94\n * $FreeBSD: release/9.0.0/sys/amd64/include/limits.h 143063 2005-03-02 21:33:29Z joerg $\n */\n\n#ifndef _MACHINE_LIMITS_H_\n#define\t_MACHINE_LIMITS_H_\n\n#include <sys/cdefs.h>\n\n#ifdef __CC_SUPPORTS_WARNING\n#warning \"machine/limits.h is deprecated.  Include sys/limits.h instead.\"\n#endif\n\n#include <sys/limits.h>\n\n#endif /* !_MACHINE_LIMITS_H_ */\n"
  },
  {
    "path": "freebsd-headers/machine/md_var.h",
    "content": "/*-\n * Copyright (c) 1995 Bruce D. Evans.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. Neither the name of the author nor the names of contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/amd64/include/md_var.h 225576 2011-09-15 09:54:07Z kib $\n */\n\n#ifndef _MACHINE_MD_VAR_H_\n#define\t_MACHINE_MD_VAR_H_\n\n/*\n * Miscellaneous machine-dependent declarations.\n */\n\nextern\tlong\tMaxmem;\nextern\tu_int\tbasemem;\nextern\tint\tbusdma_swi_pending;\nextern\tu_int\tcpu_exthigh;\nextern\tu_int\tcpu_feature;\nextern\tu_int\tcpu_feature2;\nextern\tu_int\tamd_feature;\nextern\tu_int\tamd_feature2;\nextern\tu_int\tamd_pminfo;\nextern\tu_int\tvia_feature_rng;\nextern\tu_int\tvia_feature_xcrypt;\nextern\tu_int\tcpu_clflush_line_size;\nextern\tu_int\tcpu_fxsr;\nextern\tu_int\tcpu_high;\nextern\tu_int\tcpu_id;\nextern\tu_int\tcpu_mxcsr_mask;\nextern\tu_int\tcpu_procinfo;\nextern\tu_int\tcpu_procinfo2;\nextern\tchar\tcpu_vendor[];\nextern\tu_int\tcpu_vendor_id;\nextern\tchar\tkstack[];\nextern\tchar\tsigcode[];\nextern\tint\tszsigcode;\nextern\tuint64_t *vm_page_dump;\nextern\tint\tvm_page_dump_size;\nextern\tint\tworkaround_erratum383;\nextern\tint\t_udatasel;\nextern\tint\t_ucodesel;\nextern\tint\t_ucode32sel;\nextern\tint\t_ufssel;\nextern\tint\t_ugssel;\n\ntypedef void alias_for_inthand_t(u_int cs, u_int ef, u_int esp, u_int ss);\nstruct\tthread;\nstruct\treg;\nstruct\tfpreg;\nstruct  dbreg;\nstruct\tdumperinfo;\n\nvoid\tamd64_syscall(struct thread *td, int traced);\nvoid\tbusdma_swi(void);\nvoid\tcpu_setregs(void);\nvoid\tdoreti_iret(void) __asm(__STRING(doreti_iret));\nvoid\tdoreti_iret_fault(void) __asm(__STRING(doreti_iret_fault));\nvoid\tld_ds(void) __asm(__STRING(ld_ds));\nvoid\tld_es(void) __asm(__STRING(ld_es));\nvoid\tld_fs(void) __asm(__STRING(ld_fs));\nvoid\tld_gs(void) __asm(__STRING(ld_gs));\nvoid\tld_fsbase(void) __asm(__STRING(ld_fsbase));\nvoid\tld_gsbase(void) __asm(__STRING(ld_gsbase));\nvoid\tds_load_fault(void) __asm(__STRING(ds_load_fault));\nvoid\tes_load_fault(void) __asm(__STRING(es_load_fault));\nvoid\tfs_load_fault(void) __asm(__STRING(fs_load_fault));\nvoid\tgs_load_fault(void) __asm(__STRING(gs_load_fault));\nvoid\tfsbase_load_fault(void) __asm(__STRING(fsbase_load_fault));\nvoid\tgsbase_load_fault(void) __asm(__STRING(gsbase_load_fault));\nvoid\tdump_add_page(vm_paddr_t);\nvoid\tdump_drop_page(vm_paddr_t);\nvoid\tinitializecpu(void);\nvoid\tinitializecpucache(void);\nvoid\tfillw(int /*u_short*/ pat, void *base, size_t cnt);\nvoid\tfpstate_drop(struct thread *td);\nint\tis_physical_memory(vm_paddr_t addr);\nint\tisa_nmi(int cd);\nvoid\tpagecopy(void *from, void *to);\nvoid\tpagezero(void *addr);\nvoid\tsetidt(int idx, alias_for_inthand_t *func, int typ, int dpl, int ist);\nint\tuser_dbreg_trap(void);\nvoid\tminidumpsys(struct dumperinfo *);\n\n#endif /* !_MACHINE_MD_VAR_H_ */\n"
  },
  {
    "path": "freebsd-headers/machine/memdev.h",
    "content": "/*-\n * Copyright (c) 2004 Mark R V Murray\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer\n *    in this position and unchanged.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR\n * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES\n * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,\n * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF\n * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/amd64/include/memdev.h 217515 2011-01-17 22:58:28Z jkim $\n */\n\n#ifndef _MACHINE_MEMDEV_H_\n#define\t_MACHINE_MEMDEV_H_\n\n#define\tCDEV_MINOR_MEM\t0\n#define\tCDEV_MINOR_KMEM\t1\n\nd_open_t\tmemopen;\nd_read_t\tmemrw;\nd_ioctl_t\tmemioctl;\nd_mmap_t\tmemmmap;\n\n#endif /* _MACHINE_MEMDEV_H_ */\n"
  },
  {
    "path": "freebsd-headers/machine/metadata.h",
    "content": "/*-\n * Copyright (c) 2003 Peter Wemm <peter@FreeBSD.org>\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/amd64/include/metadata.h 191111 2009-04-15 17:31:22Z jkim $\n */\n\n#ifndef _MACHINE_METADATA_H_\n#define\t_MACHINE_METADATA_H_\n\n#define\tMODINFOMD_SMAP\t\t0x1001\n#define\tMODINFOMD_SMAP_XATTR\t0x1002\n\n#endif /* !_MACHINE_METADATA_H_ */\n"
  },
  {
    "path": "freebsd-headers/machine/minidump.h",
    "content": "/*-\n * Copyright (c) 2006 Peter Wemm\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n *\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR\n * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES\n * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,\n * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF\n * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/amd64/include/minidump.h 215133 2010-11-11 18:35:28Z avg $\n */\n\n#ifndef\t_MACHINE_MINIDUMP_H_\n#define\t_MACHINE_MINIDUMP_H_ 1\n\n#define\tMINIDUMP_MAGIC\t\t\"minidump FreeBSD/amd64\"\n#define\tMINIDUMP_VERSION\t2\n\nstruct minidumphdr {\n\tchar magic[24];\n\tuint32_t version;\n\tuint32_t msgbufsize;\n\tuint32_t bitmapsize;\n\tuint32_t pmapsize;\n\tuint64_t kernbase;\n\tuint64_t dmapbase;\n\tuint64_t dmapend;\n};\n\n#endif /* _MACHINE_MINIDUMP_H_ */\n"
  },
  {
    "path": "freebsd-headers/machine/mp_watchdog.h",
    "content": "/*-\n * Copyright (c) 2004 Robert N. M. Watson\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/amd64/include/mp_watchdog.h 133759 2004-08-15 18:02:09Z rwatson $\n */\n\n#ifndef\t_MACHINE_MP_WATCHDOG_H_\n#define\t_MACHINE_MP_WATCHDOG_H_\n\nvoid\tap_watchdog(u_int cpuid);\n\n#endif /* !_MACHINE_MP_WATCHDOG_H_ */\n"
  },
  {
    "path": "freebsd-headers/machine/nexusvar.h",
    "content": "/*-\n * Copyright 1998 Massachusetts Institute of Technology\n *\n * Permission to use, copy, modify, and distribute this software and\n * its documentation for any purpose and without fee is hereby\n * granted, provided that both the above copyright notice and this\n * permission notice appear in all copies, that both the above\n * copyright notice and this permission notice appear in all\n * supporting documentation, and that the name of M.I.T. not be used\n * in advertising or publicity pertaining to distribution of the\n * software without specific, written prior permission.  M.I.T. makes\n * no representations about the suitability of this software for any\n * purpose.  It is provided \"as is\" without express or implied\n * warranty.\n *\n * THIS SOFTWARE IS PROVIDED BY M.I.T. ``AS IS''.  M.I.T. DISCLAIMS\n * ALL EXPRESS OR IMPLIED WARRANTIES WITH REGARD TO THIS SOFTWARE,\n * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF\n * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT\n * SHALL M.I.T. BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF\n * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\n * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,\n * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT\n * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/amd64/include/nexusvar.h 177157 2008-03-13 20:39:04Z jhb $\n */\n\n#ifndef _MACHINE_NEXUSVAR_H_\n#define\t_MACHINE_NEXUSVAR_H_\n\nstruct nexus_device {\n\tstruct resource_list\tnx_resources;\n};\n\nDECLARE_CLASS(nexus_driver);\n\nextern struct rman irq_rman, drq_rman, port_rman, mem_rman;\n\nvoid\tnexus_init_resources(void);\n\n#endif /* !_MACHINE_NEXUSVAR_H_ */\n"
  },
  {
    "path": "freebsd-headers/machine/param.h",
    "content": "/*-\n * Copyright (c) 2002 David E. O'Brien.  All rights reserved.\n * Copyright (c) 1992, 1993\n *\tThe Regents of the University of California.  All rights reserved.\n *\n * This code is derived from software contributed to Berkeley by\n * the Systems Programming Group of the University of Utah Computer\n * Science Department and Ralph Campbell.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. All advertising materials mentioning features or use of this software\n *    must display the following acknowledgement:\n *\tThis product includes software developed by the University of\n *\tCalifornia, Berkeley and its contributors.\n * 4. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t@(#)param.h\t8.1 (Berkeley) 6/10/93\n * $FreeBSD: release/9.0.0/sys/amd64/include/param.h 224217 2011-07-19 13:00:30Z attilio $\n */\n\n\n#ifndef _AMD64_INCLUDE_PARAM_H_\n#define\t_AMD64_INCLUDE_PARAM_H_\n\n#include <machine/_align.h>\n\n/*\n * Machine dependent constants for AMD64.\n */\n\n\n#define __HAVE_ACPI\n#define __PCI_REROUTE_INTERRUPT\n\n#ifndef MACHINE\n#define\tMACHINE\t\t\"amd64\"\n#endif\n#ifndef MACHINE_ARCH\n#define\tMACHINE_ARCH\t\"amd64\"\n#endif\n#ifndef MACHINE_ARCH32\n#define\tMACHINE_ARCH32\t\"i386\"\n#endif\n\n#if defined(SMP) || defined(KLD_MODULE)\n#ifndef MAXCPU\n#define MAXCPU\t\t64\n#endif\n#else\n#define MAXCPU\t\t1\n#endif\n\n#define\tALIGNBYTES\t\t_ALIGNBYTES\n#define\tALIGN(p)\t\t_ALIGN(p)\n/*\n * ALIGNED_POINTER is a boolean macro that checks whether an address\n * is valid to fetch data elements of type t from on this architecture.\n * This does not reflect the optimal alignment, just the possibility\n * (within reasonable limits). \n */\n#define\tALIGNED_POINTER(p, t)\t1\n\n/*\n * CACHE_LINE_SIZE is the compile-time maximum cache line size for an\n * architecture.  It should be used with appropriate caution.\n */\n#define\tCACHE_LINE_SHIFT\t7\n#define\tCACHE_LINE_SIZE\t\t(1 << CACHE_LINE_SHIFT)\n\n/* Size of the level 1 page table units */\n#define NPTEPG\t\t(PAGE_SIZE/(sizeof (pt_entry_t)))\n#define\tNPTEPGSHIFT\t9\t\t/* LOG2(NPTEPG) */\n#define PAGE_SHIFT\t12\t\t/* LOG2(PAGE_SIZE) */\n#define PAGE_SIZE\t(1<<PAGE_SHIFT)\t/* bytes/page */\n#define PAGE_MASK\t(PAGE_SIZE-1)\n/* Size of the level 2 page directory units */\n#define\tNPDEPG\t\t(PAGE_SIZE/(sizeof (pd_entry_t)))\n#define\tNPDEPGSHIFT\t9\t\t/* LOG2(NPDEPG) */\n#define\tPDRSHIFT\t21              /* LOG2(NBPDR) */\n#define\tNBPDR\t\t(1<<PDRSHIFT)   /* bytes/page dir */\n#define\tPDRMASK\t\t(NBPDR-1)\n/* Size of the level 3 page directory pointer table units */\n#define\tNPDPEPG\t\t(PAGE_SIZE/(sizeof (pdp_entry_t)))\n#define\tNPDPEPGSHIFT\t9\t\t/* LOG2(NPDPEPG) */\n#define\tPDPSHIFT\t30\t\t/* LOG2(NBPDP) */\n#define\tNBPDP\t\t(1<<PDPSHIFT)\t/* bytes/page dir ptr table */\n#define\tPDPMASK\t\t(NBPDP-1)\n/* Size of the level 4 page-map level-4 table units */\n#define\tNPML4EPG\t(PAGE_SIZE/(sizeof (pml4_entry_t)))\n#define\tNPML4EPGSHIFT\t9\t\t/* LOG2(NPML4EPG) */\n#define\tPML4SHIFT\t39\t\t/* LOG2(NBPML4) */\n#define\tNBPML4\t\t(1UL<<PML4SHIFT)/* bytes/page map lev4 table */\n#define\tPML4MASK\t(NBPML4-1)\n\n#define\tMAXPAGESIZES\t3\t/* maximum number of supported page sizes */\n\n#define IOPAGES\t2\t\t/* pages of i/o permission bitmap */\n\n#ifndef\tKSTACK_PAGES\n#define\tKSTACK_PAGES\t4\t/* pages of kstack (with pcb) */\n#endif\n#define\tKSTACK_GUARD_PAGES 1\t/* pages of kstack guard; 0 disables */\n\n/*\n * Ceiling on amount of swblock kva space, can be changed via\n * the kern.maxswzone /boot/loader.conf variable.\n */\n#ifndef VM_SWZONE_SIZE_MAX\n#define\tVM_SWZONE_SIZE_MAX\t(32 * 1024 * 1024)\n#endif\n\n/*\n * Mach derived conversion macros\n */\n#define\tround_page(x)\t((((unsigned long)(x)) + PAGE_MASK) & ~(PAGE_MASK))\n#define\ttrunc_page(x)\t((unsigned long)(x) & ~(PAGE_MASK))\n#define trunc_2mpage(x)\t((unsigned long)(x) & ~PDRMASK)\n#define round_2mpage(x)\t((((unsigned long)(x)) + PDRMASK) & ~PDRMASK)\n#define trunc_1gpage(x)\t((unsigned long)(x) & ~PDPMASK)\n\n#define\tatop(x)\t\t((unsigned long)(x) >> PAGE_SHIFT)\n#define\tptoa(x)\t\t((unsigned long)(x) << PAGE_SHIFT)\n\n#define\tamd64_btop(x)\t((unsigned long)(x) >> PAGE_SHIFT)\n#define\tamd64_ptob(x)\t((unsigned long)(x) << PAGE_SHIFT)\n\n#define\tpgtok(x)\t((unsigned long)(x) * (PAGE_SIZE / 1024)) \n\n#endif /* !_AMD64_INCLUDE_PARAM_H_ */\n"
  },
  {
    "path": "freebsd-headers/machine/pc/bios.h",
    "content": "/*-\n * Copyright (c) 1997 Michael Smith\n * Copyright (c) 1998 Jonathan Lemon\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/amd64/include/pc/bios.h 191111 2009-04-15 17:31:22Z jkim $\n */\n\n#ifndef _MACHINE_PC_BIOS_H_\n#define _MACHINE_PC_BIOS_H_\n\nextern u_int32_t\tbios_sigsearch(u_int32_t start, u_char *sig, int siglen, \n\t\t\t\t\t int paralen, int sigofs);\n\n#define BIOS_PADDRTOVADDR(x)\t((x) + KERNBASE)\n#define BIOS_VADDRTOPADDR(x)\t((x) - KERNBASE)\n\n/*\n * Int 15:E820 'SMAP' structure\n */\n\n#define SMAP_SIG\t0x534D4150\t\t\t/* 'SMAP' */\n\n#define\tSMAP_TYPE_MEMORY\t1\n#define\tSMAP_TYPE_RESERVED\t2\n#define\tSMAP_TYPE_ACPI_RECLAIM\t3\n#define\tSMAP_TYPE_ACPI_NVS\t4\n#define\tSMAP_TYPE_ACPI_ERROR\t5\n\n#define\tSMAP_XATTR_ENABLED\t0x00000001\n#define\tSMAP_XATTR_NON_VOLATILE\t0x00000002\n#define\tSMAP_XATTR_MASK\t\t(SMAP_XATTR_ENABLED | SMAP_XATTR_NON_VOLATILE)\n\nstruct bios_smap {\n    u_int64_t\tbase;\n    u_int64_t\tlength;\n    u_int32_t\ttype;\n} __packed;\n\nstruct bios_oem_signature {\n\tchar * anchor;\t\t/* search anchor string in BIOS memory */\n\tsize_t offset;\t\t/* offset from anchor (may be negative) */\n\tsize_t totlen;\t\t/* total length of BIOS string to copy */\n} __packed;\nstruct bios_oem_range {\n\tu_int from;\t\t/* shouldn't be below 0xe0000 */\n\tu_int to;\t\t/* shouldn't be above 0xfffff */\n} __packed;\nstruct bios_oem {\n\tstruct bios_oem_range range;\n\tstruct bios_oem_signature signature[];\n} __packed;\n\nextern int\nbios_oem_strings(struct bios_oem *oem, u_char *buffer, size_t maxlen);\n\n\n#endif /* _MACHINE_PC_BIOS_H_ */\n"
  },
  {
    "path": "freebsd-headers/machine/pc/display.h",
    "content": "/*\n * IBM PC display definitions\n *\n * $FreeBSD: release/9.0.0/sys/amd64/include/pc/display.h 139730 2005-01-05 20:11:13Z imp $\n */\n\n/* Color attributes for foreground text */\n\n#define\tFG_BLACK\t\t   0\n#define\tFG_BLUE\t\t\t   1\n#define\tFG_GREEN\t\t   2\n#define\tFG_CYAN\t\t\t   3\n#define\tFG_RED\t\t\t   4\n#define\tFG_MAGENTA\t\t   5\n#define\tFG_BROWN\t\t   6\n#define\tFG_LIGHTGREY\t\t   7\n#define\tFG_DARKGREY\t\t   8\n#define\tFG_LIGHTBLUE\t\t   9\n#define\tFG_LIGHTGREEN\t\t  10\n#define\tFG_LIGHTCYAN\t\t  11\n#define\tFG_LIGHTRED\t\t  12\n#define\tFG_LIGHTMAGENTA\t\t  13\n#define\tFG_YELLOW\t\t  14\n#define\tFG_WHITE\t\t  15\n#define\tFG_BLINK\t\t0x80\n\n/* Color attributes for text background */\n\n#define\tBG_BLACK\t\t0x00\n#define\tBG_BLUE\t\t\t0x10\n#define\tBG_GREEN\t\t0x20\n#define\tBG_CYAN\t\t\t0x30\n#define\tBG_RED\t\t\t0x40\n#define\tBG_MAGENTA\t\t0x50\n#define\tBG_BROWN\t\t0x60\n#define\tBG_LIGHTGREY\t\t0x70\n\n/* Monochrome attributes for foreground text */\n\n#define\tFG_UNDERLINE\t\t0x01\n#define\tFG_INTENSE\t\t0x08\n\n/* Monochrome attributes for text background */\n\n#define\tBG_INTENSE\t\t0x10\n"
  },
  {
    "path": "freebsd-headers/machine/pcb.h",
    "content": "/*-\n * Copyright (c) 2003 Peter Wemm.\n * Copyright (c) 1990 The Regents of the University of California.\n * All rights reserved.\n *\n * This code is derived from software contributed to Berkeley by\n * William Jolitz.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 4. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\tfrom: @(#)pcb.h\t5.10 (Berkeley) 5/12/91\n * $FreeBSD: release/9.0.0/sys/amd64/include/pcb.h 216673 2010-12-22 19:57:03Z jkim $\n */\n\n#ifndef _AMD64_PCB_H_\n#define _AMD64_PCB_H_\n\n/*\n * AMD64 process control block\n */\n#include <machine/fpu.h>\n#include <machine/segments.h>\n\nstruct pcb {\n\tregister_t\tpcb_r15;\n\tregister_t\tpcb_r14;\n\tregister_t\tpcb_r13;\n\tregister_t\tpcb_r12;\n\tregister_t\tpcb_rbp;\n\tregister_t\tpcb_rsp;\n\tregister_t\tpcb_rbx;\n\tregister_t\tpcb_rip;\n\tregister_t\tpcb_fsbase;\n\tregister_t\tpcb_gsbase;\n\tregister_t\tpcb_kgsbase;\n\tregister_t\tpcb_cr0;\n\tregister_t\tpcb_cr2;\n\tregister_t\tpcb_cr3;\n\tregister_t\tpcb_cr4;\n\tregister_t\tpcb_dr0;\n\tregister_t\tpcb_dr1;\n\tregister_t\tpcb_dr2;\n\tregister_t\tpcb_dr3;\n\tregister_t\tpcb_dr6;\n\tregister_t\tpcb_dr7;\n\n\tstruct region_descriptor pcb_gdt;\n\tstruct region_descriptor pcb_idt;\n\tstruct region_descriptor pcb_ldt;\n\tuint16_t\tpcb_tr;\n\n\tu_int\t\tpcb_flags;\n#define\tPCB_FULL_IRET\t0x01\t/* full iret is required */\n#define\tPCB_DBREGS\t0x02\t/* process using debug registers */\n#define\tPCB_KERNFPU\t0x04\t/* kernel uses fpu */\n#define\tPCB_FPUINITDONE\t0x08\t/* fpu state is initialized */\n#define\tPCB_USERFPUINITDONE 0x10 /* fpu user state is initialized */\n#define\tPCB_GS32BIT\t0x20\t/* linux gs switch */\n#define\tPCB_32BIT\t0x40\t/* process has 32 bit context (segs etc) */\n\n\tuint16_t\tpcb_initial_fpucw;\n\n\t/* copyin/out fault recovery */\n\tcaddr_t\t\tpcb_onfault;\n\n\t/* 32-bit segment descriptor */\n\tstruct user_segment_descriptor pcb_gs32sd;\n\n\t/* local tss, with i/o bitmap; NULL for common */\n\tstruct amd64tss *pcb_tssp;\n\n\tstruct savefpu\t*pcb_save;\n\tstruct savefpu\tpcb_user_save;\n};\n\n#ifdef _KERNEL\nstruct trapframe;\n\n/*\n * The pcb_flags is only modified by current thread, or by other threads\n * when current thread is stopped.  However, current thread may change it\n * from the interrupt context in cpu_switch(), or in the trap handler.\n * When we read-modify-write pcb_flags from C sources, compiler may generate\n * code that is not atomic regarding the interrupt handler.  If a trap or\n * interrupt happens and any flag is modified from the handler, it can be\n * clobbered with the cached value later.  Therefore, we implement setting\n * and clearing flags with single-instruction functions, which do not race\n * with possible modification of the flags from the trap or interrupt context,\n * because traps and interrupts are executed only on instruction boundary.\n */\nstatic __inline void\nset_pcb_flags(struct pcb *pcb, const u_int flags)\n{\n\n\t__asm __volatile(\"orl %1,%0\"\n\t    : \"=m\" (pcb->pcb_flags) : \"ir\" (flags), \"m\" (pcb->pcb_flags)\n\t    : \"cc\");\n}\n\nstatic __inline void\nclear_pcb_flags(struct pcb *pcb, const u_int flags)\n{\n\n\t__asm __volatile(\"andl %1,%0\"\n\t    : \"=m\" (pcb->pcb_flags) : \"ir\" (~flags), \"m\" (pcb->pcb_flags)\n\t    : \"cc\");\n}\n\nvoid\tmakectx(struct trapframe *, struct pcb *);\nint\tsavectx(struct pcb *);\n#endif\n\n#endif /* _AMD64_PCB_H_ */\n"
  },
  {
    "path": "freebsd-headers/machine/pci_cfgreg.h",
    "content": "/*-\n * This file is in the public domain.\n */\n/* $FreeBSD: release/9.0.0/sys/amd64/include/pci_cfgreg.h 223440 2011-06-22 21:04:13Z jhb $ */\n\n#include <x86/pci_cfgreg.h>\n"
  },
  {
    "path": "freebsd-headers/machine/pcpu.h",
    "content": "/*-\n * Copyright (c) Peter Wemm <peter@netplex.com.au>\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/amd64/include/pcpu.h 210623 2010-07-29 18:44:10Z jhb $\n */\n\n#ifndef _MACHINE_PCPU_H_\n#define\t_MACHINE_PCPU_H_\n\n#ifndef _SYS_CDEFS_H_\n#error \"sys/cdefs.h is a prerequisite for this file\"\n#endif\n\n#if defined(XEN) || defined(XENHVM)\n#ifndef NR_VIRQS\n#define\tNR_VIRQS\t24\n#endif\n#ifndef NR_IPIS\n#define\tNR_IPIS\t\t2\n#endif\n#endif\n\n#ifdef XENHVM\n#define PCPU_XEN_FIELDS\t\t\t\t\t\t\t\\\n\t;\t\t\t\t\t\t\t\t\\\n\tunsigned int pc_last_processed_l1i;\t\t\t\t\\\n\tunsigned int pc_last_processed_l2i\n#else\n#define PCPU_XEN_FIELDS\n#endif\n\n/*\n * The SMP parts are setup in pmap.c and locore.s for the BSP, and\n * mp_machdep.c sets up the data for the AP's to \"see\" when they awake.\n * The reason for doing it via a struct is so that an array of pointers\n * to each CPU's data can be set up for things like \"check curproc on all\n * other processors\"\n */\n#define\tPCPU_MD_FIELDS\t\t\t\t\t\t\t\\\n\tchar\tpc_monitorbuf[128] __aligned(128); /* cache line */\t\\\n\tstruct\tpcpu *pc_prvspace;\t/* Self-reference */\t\t\\\n\tstruct\tpmap *pc_curpmap;\t\t\t\t\t\\\n\tstruct\tamd64tss *pc_tssp;\t/* TSS segment active on CPU */\t\\\n\tstruct\tamd64tss *pc_commontssp;/* Common TSS for the CPU */\t\\\n\tregister_t pc_rsp0;\t\t\t\t\t\t\\\n\tregister_t pc_scratch_rsp;\t/* User %rsp in syscall */\t\\\n\tu_int\tpc_apic_id;\t\t\t\t\t\t\\\n\tu_int   pc_acpi_id;\t\t/* ACPI CPU id */\t\t\\\n\t/* Pointer to the CPU %fs descriptor */\t\t\t\t\\\n\tstruct user_segment_descriptor\t*pc_fs32p;\t\t\t\\\n\t/* Pointer to the CPU %gs descriptor */\t\t\t\t\\\n\tstruct user_segment_descriptor\t*pc_gs32p;\t\t\t\\\n\t/* Pointer to the CPU LDT descriptor */\t\t\t\t\\\n\tstruct system_segment_descriptor *pc_ldt;\t\t\t\\\n\t/* Pointer to the CPU TSS descriptor */\t\t\t\t\\\n\tstruct system_segment_descriptor *pc_tss;\t\t\t\\\n\tu_int\tpc_cmci_mask\t\t/* MCx banks for CMCI */\t\\\n\tPCPU_XEN_FIELDS\n\n#ifdef _KERNEL\n\n#ifdef lint\n\nextern struct pcpu *pcpup;\n\n#define\tPCPU_GET(member)\t(pcpup->pc_ ## member)\n#define\tPCPU_ADD(member, val)\t(pcpup->pc_ ## member += (val))\n#define\tPCPU_INC(member)\tPCPU_ADD(member, 1)\n#define\tPCPU_PTR(member)\t(&pcpup->pc_ ## member)\n#define\tPCPU_SET(member, val)\t(pcpup->pc_ ## member = (val))\n\n#elif defined(__GNUCLIKE_ASM) && defined(__GNUCLIKE___TYPEOF)\n\n/*\n * Evaluates to the byte offset of the per-cpu variable name.\n */\n#define\t__pcpu_offset(name)\t\t\t\t\t\t\\\n\t__offsetof(struct pcpu, name)\n\n/*\n * Evaluates to the type of the per-cpu variable name.\n */\n#define\t__pcpu_type(name)\t\t\t\t\t\t\\\n\t__typeof(((struct pcpu *)0)->name)\n\n/*\n * Evaluates to the address of the per-cpu variable name.\n */\n#define\t__PCPU_PTR(name) __extension__ ({\t\t\t\t\\\n\t__pcpu_type(name) *__p;\t\t\t\t\t\t\\\n\t\t\t\t\t\t\t\t\t\\\n\t__asm __volatile(\"movq %%gs:%1,%0; addq %2,%0\"\t\t\t\\\n\t    : \"=r\" (__p)\t\t\t\t\t\t\\\n\t    : \"m\" (*(struct pcpu *)(__pcpu_offset(pc_prvspace))),\t\\\n\t      \"i\" (__pcpu_offset(name)));\t\t\t\t\\\n\t\t\t\t\t\t\t\t\t\\\n\t__p;\t\t\t\t\t\t\t\t\\\n})\n\n/*\n * Evaluates to the value of the per-cpu variable name.\n */\n#define\t__PCPU_GET(name) __extension__ ({\t\t\t\t\\\n\t__pcpu_type(name) __res;\t\t\t\t\t\\\n\tstruct __s {\t\t\t\t\t\t\t\\\n\t\tu_char\t__b[MIN(sizeof(__pcpu_type(name)), 8)];\t\t\\\n\t} __s;\t\t\t\t\t\t\t\t\\\n\t\t\t\t\t\t\t\t\t\\\n\tif (sizeof(__res) == 1 || sizeof(__res) == 2 ||\t\t\t\\\n\t    sizeof(__res) == 4 || sizeof(__res) == 8) {\t\t\t\\\n\t\t__asm __volatile(\"mov %%gs:%1,%0\"\t\t\t\\\n\t\t    : \"=r\" (__s)\t\t\t\t\t\\\n\t\t    : \"m\" (*(struct __s *)(__pcpu_offset(name))));\t\\\n\t\t*(struct __s *)(void *)&__res = __s;\t\t\t\\\n\t} else {\t\t\t\t\t\t\t\\\n\t\t__res = *__PCPU_PTR(name);\t\t\t\t\\\n\t}\t\t\t\t\t\t\t\t\\\n\t__res;\t\t\t\t\t\t\t\t\\\n})\n\n/*\n * Adds the value to the per-cpu counter name.  The implementation\n * must be atomic with respect to interrupts.\n */\n#define\t__PCPU_ADD(name, val) do {\t\t\t\t\t\\\n\t__pcpu_type(name) __val;\t\t\t\t\t\\\n\tstruct __s {\t\t\t\t\t\t\t\\\n\t\tu_char\t__b[MIN(sizeof(__pcpu_type(name)), 8)];\t\t\\\n\t} __s;\t\t\t\t\t\t\t\t\\\n\t\t\t\t\t\t\t\t\t\\\n\t__val = (val);\t\t\t\t\t\t\t\\\n\tif (sizeof(__val) == 1 || sizeof(__val) == 2 ||\t\t\t\\\n\t    sizeof(__val) == 4 || sizeof(__val) == 8) {\t\t\t\\\n\t\t__s = *(struct __s *)(void *)&__val;\t\t\t\\\n\t\t__asm __volatile(\"add %1,%%gs:%0\"\t\t\t\\\n\t\t    : \"=m\" (*(struct __s *)(__pcpu_offset(name)))\t\\\n\t\t    : \"r\" (__s));\t\t\t\t\t\\\n\t} else\t\t\t\t\t\t\t\t\\\n\t\t*__PCPU_PTR(name) += __val;\t\t\t\t\\\n} while (0)\n\n/*\n * Increments the value of the per-cpu counter name.  The implementation\n * must be atomic with respect to interrupts.\n */\n#define\t__PCPU_INC(name) do {\t\t\t\t\t\t\\\n\tCTASSERT(sizeof(__pcpu_type(name)) == 1 ||\t\t\t\\\n\t    sizeof(__pcpu_type(name)) == 2 ||\t\t\t\t\\\n\t    sizeof(__pcpu_type(name)) == 4 ||\t\t\t\t\\\n\t    sizeof(__pcpu_type(name)) == 8);\t\t\t\t\\\n\tif (sizeof(__pcpu_type(name)) == 1) {\t\t\t\t\\\n\t\t__asm __volatile(\"incb %%gs:%0\"\t\t\t\t\\\n\t\t    : \"=m\" (*(__pcpu_type(name) *)(__pcpu_offset(name)))\\\n\t\t    : \"m\" (*(__pcpu_type(name) *)(__pcpu_offset(name))));\\\n\t} else if (sizeof(__pcpu_type(name)) == 2) {\t\t\t\\\n\t\t__asm __volatile(\"incw %%gs:%0\"\t\t\t\t\\\n\t\t    : \"=m\" (*(__pcpu_type(name) *)(__pcpu_offset(name)))\\\n\t\t    : \"m\" (*(__pcpu_type(name) *)(__pcpu_offset(name))));\\\n\t} else if (sizeof(__pcpu_type(name)) == 4) {\t\t\t\\\n\t\t__asm __volatile(\"incl %%gs:%0\"\t\t\t\t\\\n\t\t    : \"=m\" (*(__pcpu_type(name) *)(__pcpu_offset(name)))\\\n\t\t    : \"m\" (*(__pcpu_type(name) *)(__pcpu_offset(name))));\\\n\t} else if (sizeof(__pcpu_type(name)) == 8) {\t\t\t\\\n\t\t__asm __volatile(\"incq %%gs:%0\"\t\t\t\t\\\n\t\t    : \"=m\" (*(__pcpu_type(name) *)(__pcpu_offset(name)))\\\n\t\t    : \"m\" (*(__pcpu_type(name) *)(__pcpu_offset(name))));\\\n\t}\t\t\t\t\t\t\t\t\\\n} while (0)\n\n/*\n * Sets the value of the per-cpu variable name to value val.\n */\n#define\t__PCPU_SET(name, val) {\t\t\t\t\t\t\\\n\t__pcpu_type(name) __val;\t\t\t\t\t\\\n\tstruct __s {\t\t\t\t\t\t\t\\\n\t\tu_char\t__b[MIN(sizeof(__pcpu_type(name)), 8)];\t\t\\\n\t} __s;\t\t\t\t\t\t\t\t\\\n\t\t\t\t\t\t\t\t\t\\\n\t__val = (val);\t\t\t\t\t\t\t\\\n\tif (sizeof(__val) == 1 || sizeof(__val) == 2 ||\t\t\t\\\n\t    sizeof(__val) == 4 || sizeof(__val) == 8) {\t\t\t\\\n\t\t__s = *(struct __s *)(void *)&__val;\t\t\t\\\n\t\t__asm __volatile(\"mov %1,%%gs:%0\"\t\t\t\\\n\t\t    : \"=m\" (*(struct __s *)(__pcpu_offset(name)))\t\\\n\t\t    : \"r\" (__s));\t\t\t\t\t\\\n\t} else {\t\t\t\t\t\t\t\\\n\t\t*__PCPU_PTR(name) = __val;\t\t\t\t\\\n\t}\t\t\t\t\t\t\t\t\\\n}\n\n#define\tPCPU_GET(member)\t__PCPU_GET(pc_ ## member)\n#define\tPCPU_ADD(member, val)\t__PCPU_ADD(pc_ ## member, val)\n#define\tPCPU_INC(member)\t__PCPU_INC(pc_ ## member)\n#define\tPCPU_PTR(member)\t__PCPU_PTR(pc_ ## member)\n#define\tPCPU_SET(member, val)\t__PCPU_SET(pc_ ## member, val)\n\nstatic __inline __pure2 struct thread *\n__curthread(void)\n{\n\tstruct thread *td;\n\n\t__asm(\"movq %%gs:0,%0\" : \"=r\" (td));\n\treturn (td);\n}\n#define\tcurthread\t\t(__curthread())\n\n#else /* !lint || defined(__GNUCLIKE_ASM) && defined(__GNUCLIKE___TYPEOF) */\n\n#error \"this file needs to be ported to your compiler\"\n\n#endif /* lint, etc. */\n\n#endif /* _KERNEL */\n\n#endif /* !_MACHINE_PCPU_H_ */\n"
  },
  {
    "path": "freebsd-headers/machine/pmap.h",
    "content": "/*-\n * Copyright (c) 2003 Peter Wemm.\n * Copyright (c) 1991 Regents of the University of California.\n * All rights reserved.\n *\n * This code is derived from software contributed to Berkeley by\n * the Systems Programming Group of the University of Utah Computer\n * Science Department and William Jolitz of UUNET Technologies Inc.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 4. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * Derived from hp300 version by Mike Hibler, this version by William\n * Jolitz uses a recursive map [a pde points to the page directory] to\n * map the page tables using the pagetables themselves. This is done to\n * reduce the impact on kernel virtual memory for lots of sparse address\n * space, and to reduce the cost of memory to each process.\n *\n *\tfrom: hp300: @(#)pmap.h\t7.2 (Berkeley) 12/16/90\n *\tfrom: @(#)pmap.h\t7.4 (Berkeley) 5/12/91\n * $FreeBSD: release/9.0.0/sys/amd64/include/pmap.h 222813 2011-06-07 08:46:13Z attilio $\n */\n\n#ifndef _MACHINE_PMAP_H_\n#define\t_MACHINE_PMAP_H_\n\n/*\n * Page-directory and page-table entries follow this format, with a few\n * of the fields not present here and there, depending on a lot of things.\n */\n\t\t\t\t/* ---- Intel Nomenclature ---- */\n#define\tPG_V\t\t0x001\t/* P\tValid\t\t\t*/\n#define PG_RW\t\t0x002\t/* R/W\tRead/Write\t\t*/\n#define PG_U\t\t0x004\t/* U/S  User/Supervisor\t\t*/\n#define\tPG_NC_PWT\t0x008\t/* PWT\tWrite through\t\t*/\n#define\tPG_NC_PCD\t0x010\t/* PCD\tCache disable\t\t*/\n#define PG_A\t\t0x020\t/* A\tAccessed\t\t*/\n#define\tPG_M\t\t0x040\t/* D\tDirty\t\t\t*/\n#define\tPG_PS\t\t0x080\t/* PS\tPage size (0=4k,1=2M)\t*/\n#define\tPG_PTE_PAT\t0x080\t/* PAT\tPAT index\t\t*/\n#define\tPG_G\t\t0x100\t/* G\tGlobal\t\t\t*/\n#define\tPG_AVAIL1\t0x200\t/*    /\tAvailable for system\t*/\n#define\tPG_AVAIL2\t0x400\t/*   <\tprogrammers use\t\t*/\n#define\tPG_AVAIL3\t0x800\t/*    \\\t\t\t\t*/\n#define\tPG_PDE_PAT\t0x1000\t/* PAT\tPAT index\t\t*/\n#define\tPG_NX\t\t(1ul<<63) /* No-execute */\n\n\n/* Our various interpretations of the above */\n#define PG_W\t\tPG_AVAIL1\t/* \"Wired\" pseudoflag */\n#define\tPG_MANAGED\tPG_AVAIL2\n#define\tPG_FRAME\t(0x000ffffffffff000ul)\n#define\tPG_PS_FRAME\t(0x000fffffffe00000ul)\n#define\tPG_PROT\t\t(PG_RW|PG_U)\t/* all protection bits . */\n#define PG_N\t\t(PG_NC_PWT|PG_NC_PCD)\t/* Non-cacheable */\n\n/* Page level cache control fields used to determine the PAT type */\n#define PG_PDE_CACHE\t(PG_PDE_PAT | PG_NC_PWT | PG_NC_PCD)\n#define PG_PTE_CACHE\t(PG_PTE_PAT | PG_NC_PWT | PG_NC_PCD)\n\n/*\n * Promotion to a 2MB (PDE) page mapping requires that the corresponding 4KB\n * (PTE) page mappings have identical settings for the following fields:\n */\n#define\tPG_PTE_PROMOTE\t(PG_NX | PG_MANAGED | PG_W | PG_G | PG_PTE_PAT | \\\n\t    PG_M | PG_A | PG_NC_PCD | PG_NC_PWT | PG_U | PG_RW | PG_V)\n\n/*\n * Page Protection Exception bits\n */\n\n#define PGEX_P\t\t0x01\t/* Protection violation vs. not present */\n#define PGEX_W\t\t0x02\t/* during a Write cycle */\n#define PGEX_U\t\t0x04\t/* access from User mode (UPL) */\n#define PGEX_RSV\t0x08\t/* reserved PTE field is non-zero */\n#define PGEX_I\t\t0x10\t/* during an instruction fetch */\n\n/*\n * Pte related macros.  This is complicated by having to deal with\n * the sign extension of the 48th bit.\n */\n#define KVADDR(l4, l3, l2, l1) ( \\\n\t((unsigned long)-1 << 47) | \\\n\t((unsigned long)(l4) << PML4SHIFT) | \\\n\t((unsigned long)(l3) << PDPSHIFT) | \\\n\t((unsigned long)(l2) << PDRSHIFT) | \\\n\t((unsigned long)(l1) << PAGE_SHIFT))\n\n#define UVADDR(l4, l3, l2, l1) ( \\\n\t((unsigned long)(l4) << PML4SHIFT) | \\\n\t((unsigned long)(l3) << PDPSHIFT) | \\\n\t((unsigned long)(l2) << PDRSHIFT) | \\\n\t((unsigned long)(l1) << PAGE_SHIFT))\n\n/* Initial number of kernel page tables. */\n#ifndef NKPT\n#define\tNKPT\t\t32\n#endif\n\n#define NKPML4E\t\t1\t\t/* number of kernel PML4 slots */\n#define NKPDPE\t\thowmany(NKPT, NPDEPG)/* number of kernel PDP slots */\n\n#define\tNUPML4E\t\t(NPML4EPG/2)\t/* number of userland PML4 pages */\n#define\tNUPDPE\t\t(NUPML4E*NPDPEPG)/* number of userland PDP pages */\n#define\tNUPDE\t\t(NUPDPE*NPDEPG)\t/* number of userland PD entries */\n\n/*\n * NDMPML4E is the number of PML4 entries that are used to implement the\n * direct map.  It must be a power of two.\n */\n#define\tNDMPML4E\t2\n\n/*\n * The *PDI values control the layout of virtual memory.  The starting address\n * of the direct map, which is controlled by DMPML4I, must be a multiple of\n * its size.  (See the PHYS_TO_DMAP() and DMAP_TO_PHYS() macros.)\n */\n#define\tPML4PML4I\t(NPML4EPG/2)\t/* Index of recursive pml4 mapping */\n\n#define\tKPML4I\t\t(NPML4EPG-1)\t/* Top 512GB for KVM */\n#define\tDMPML4I\t\trounddown(KPML4I - NDMPML4E, NDMPML4E) /* Below KVM */\n\n#define\tKPDPI\t\t(NPDPEPG-2)\t/* kernbase at -2GB */\n\n/*\n * XXX doesn't really belong here I guess...\n */\n#define ISA_HOLE_START    0xa0000\n#define ISA_HOLE_LENGTH (0x100000-ISA_HOLE_START)\n\n#ifndef LOCORE\n\n#include <sys/queue.h>\n#include <sys/_cpuset.h>\n#include <sys/_lock.h>\n#include <sys/_mutex.h>\n\ntypedef u_int64_t pd_entry_t;\ntypedef u_int64_t pt_entry_t;\ntypedef u_int64_t pdp_entry_t;\ntypedef u_int64_t pml4_entry_t;\n\n#define\tPML4ESHIFT\t(3)\n#define\tPDPESHIFT\t(3)\n#define\tPTESHIFT\t(3)\n#define\tPDESHIFT\t(3)\n\n/*\n * Address of current address space page table maps and directories.\n */\n#ifdef _KERNEL\n#define\taddr_PTmap\t(KVADDR(PML4PML4I, 0, 0, 0))\n#define\taddr_PDmap\t(KVADDR(PML4PML4I, PML4PML4I, 0, 0))\n#define\taddr_PDPmap\t(KVADDR(PML4PML4I, PML4PML4I, PML4PML4I, 0))\n#define\taddr_PML4map\t(KVADDR(PML4PML4I, PML4PML4I, PML4PML4I, PML4PML4I))\n#define\taddr_PML4pml4e\t(addr_PML4map + (PML4PML4I * sizeof(pml4_entry_t)))\n#define\tPTmap\t\t((pt_entry_t *)(addr_PTmap))\n#define\tPDmap\t\t((pd_entry_t *)(addr_PDmap))\n#define\tPDPmap\t\t((pd_entry_t *)(addr_PDPmap))\n#define\tPML4map\t\t((pd_entry_t *)(addr_PML4map))\n#define\tPML4pml4e\t((pd_entry_t *)(addr_PML4pml4e))\n\nextern u_int64_t KPDPphys;\t/* physical address of kernel level 3 */\nextern u_int64_t KPML4phys;\t/* physical address of kernel level 4 */\n\n/*\n * virtual address to page table entry and\n * to physical address.\n * Note: these work recursively, thus vtopte of a pte will give\n * the corresponding pde that in turn maps it.\n */\npt_entry_t *vtopte(vm_offset_t);\n#define\tvtophys(va)\tpmap_kextract(((vm_offset_t) (va)))\n\nstatic __inline pt_entry_t\npte_load(pt_entry_t *ptep)\n{\n\tpt_entry_t r;\n\n\tr = *ptep;\n\treturn (r);\n}\n\nstatic __inline pt_entry_t\npte_load_store(pt_entry_t *ptep, pt_entry_t pte)\n{\n\tpt_entry_t r;\n\n\t__asm __volatile(\n\t    \"xchgq %0,%1\"\n\t    : \"=m\" (*ptep),\n\t      \"=r\" (r)\n\t    : \"1\" (pte),\n\t      \"m\" (*ptep));\n\treturn (r);\n}\n\n#define\tpte_load_clear(pte)\tatomic_readandclear_long(pte)\n\nstatic __inline void\npte_store(pt_entry_t *ptep, pt_entry_t pte)\n{\n\n\t*ptep = pte;\n}\n\n#define\tpte_clear(ptep)\t\tpte_store((ptep), (pt_entry_t)0ULL)\n\n#define\tpde_store(pdep, pde)\tpte_store((pdep), (pde))\n\nextern pt_entry_t pg_nx;\n\n#endif /* _KERNEL */\n\n/*\n * Pmap stuff\n */\nstruct\tpv_entry;\nstruct\tpv_chunk;\n\nstruct md_page {\n\tTAILQ_HEAD(,pv_entry)\tpv_list;\n\tint\t\t\tpat_mode;\n};\n\n/*\n * The kernel virtual address (KVA) of the level 4 page table page is always\n * within the direct map (DMAP) region.\n */\nstruct pmap {\n\tstruct mtx\t\tpm_mtx;\n\tpml4_entry_t\t\t*pm_pml4;\t/* KVA of level 4 page table */\n\tTAILQ_HEAD(,pv_chunk)\tpm_pvchunk;\t/* list of mappings in pmap */\n\tcpuset_t\t\tpm_active;\t/* active on cpus */\n\t/* spare u_int here due to padding */\n\tstruct pmap_statistics\tpm_stats;\t/* pmap statistics */\n\tvm_page_t\t\tpm_root;\t/* spare page table pages */\n};\n\ntypedef struct pmap\t*pmap_t;\n\n#ifdef _KERNEL\nextern struct pmap\tkernel_pmap_store;\n#define kernel_pmap\t(&kernel_pmap_store)\n\n#define\tPMAP_LOCK(pmap)\t\tmtx_lock(&(pmap)->pm_mtx)\n#define\tPMAP_LOCK_ASSERT(pmap, type) \\\n\t\t\t\tmtx_assert(&(pmap)->pm_mtx, (type))\n#define\tPMAP_LOCK_DESTROY(pmap)\tmtx_destroy(&(pmap)->pm_mtx)\n#define\tPMAP_LOCK_INIT(pmap)\tmtx_init(&(pmap)->pm_mtx, \"pmap\", \\\n\t\t\t\t    NULL, MTX_DEF | MTX_DUPOK)\n#define\tPMAP_LOCKED(pmap)\tmtx_owned(&(pmap)->pm_mtx)\n#define\tPMAP_MTX(pmap)\t\t(&(pmap)->pm_mtx)\n#define\tPMAP_TRYLOCK(pmap)\tmtx_trylock(&(pmap)->pm_mtx)\n#define\tPMAP_UNLOCK(pmap)\tmtx_unlock(&(pmap)->pm_mtx)\n#endif\n\n/*\n * For each vm_page_t, there is a list of all currently valid virtual\n * mappings of that page.  An entry is a pv_entry_t, the list is pv_list.\n */\ntypedef struct pv_entry {\n\tvm_offset_t\tpv_va;\t\t/* virtual address for mapping */\n\tTAILQ_ENTRY(pv_entry)\tpv_list;\n} *pv_entry_t;\n\n/*\n * pv_entries are allocated in chunks per-process.  This avoids the\n * need to track per-pmap assignments.\n */\n#define\t_NPCM\t3\n#define\t_NPCPV\t168\nstruct pv_chunk {\n\tpmap_t\t\t\tpc_pmap;\n\tTAILQ_ENTRY(pv_chunk)\tpc_list;\n\tuint64_t\t\tpc_map[_NPCM];\t/* bitmap; 1 = free */\n\tuint64_t\t\tpc_spare[2];\n\tstruct pv_entry\t\tpc_pventry[_NPCPV];\n};\n\n#ifdef\t_KERNEL\n\nextern caddr_t\tCADDR1;\nextern pt_entry_t *CMAP1;\nextern vm_paddr_t phys_avail[];\nextern vm_paddr_t dump_avail[];\nextern vm_offset_t virtual_avail;\nextern vm_offset_t virtual_end;\n\n#define\tpmap_page_get_memattr(m)\t((vm_memattr_t)(m)->md.pat_mode)\n#define\tpmap_unmapbios(va, sz)\tpmap_unmapdev((va), (sz))\n\nvoid\tpmap_bootstrap(vm_paddr_t *);\nint\tpmap_change_attr(vm_offset_t, vm_size_t, int);\nvoid\tpmap_demote_DMAP(vm_paddr_t base, vm_size_t len, boolean_t invalidate);\nvoid\tpmap_init_pat(void);\nvoid\tpmap_kenter(vm_offset_t va, vm_paddr_t pa);\nvoid\t*pmap_kenter_temporary(vm_paddr_t pa, int i);\nvm_paddr_t pmap_kextract(vm_offset_t);\nvoid\tpmap_kremove(vm_offset_t);\nvoid\t*pmap_mapbios(vm_paddr_t, vm_size_t);\nvoid\t*pmap_mapdev(vm_paddr_t, vm_size_t);\nvoid\t*pmap_mapdev_attr(vm_paddr_t, vm_size_t, int);\nboolean_t pmap_page_is_mapped(vm_page_t m);\nvoid\tpmap_page_set_memattr(vm_page_t m, vm_memattr_t ma);\nvoid\tpmap_unmapdev(vm_offset_t, vm_size_t);\nvoid\tpmap_invalidate_page(pmap_t, vm_offset_t);\nvoid\tpmap_invalidate_range(pmap_t, vm_offset_t, vm_offset_t);\nvoid\tpmap_invalidate_all(pmap_t);\nvoid\tpmap_invalidate_cache(void);\nvoid\tpmap_invalidate_cache_pages(vm_page_t *pages, int count);\nvoid\tpmap_invalidate_cache_range(vm_offset_t sva, vm_offset_t eva);\n\n#endif /* _KERNEL */\n\n#endif /* !LOCORE */\n\n#endif /* !_MACHINE_PMAP_H_ */\n"
  },
  {
    "path": "freebsd-headers/machine/pmc_mdep.h",
    "content": "/*-\n * Copyright (c) 2003-2008 Joseph Koshy\n * Copyright (c) 2007 The FreeBSD Foundation\n * All rights reserved.\n *\n * Portions of this software were developed by A. Joseph Koshy under\n * sponsorship from the FreeBSD Foundation and Google, Inc.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/amd64/include/pmc_mdep.h 206089 2010-04-02 13:23:49Z fabient $\n */\n\n/* Machine dependent interfaces */\n\n#ifndef _MACHINE_PMC_MDEP_H\n#define\t_MACHINE_PMC_MDEP_H 1\n\n#ifdef\t_KERNEL\nstruct pmc_mdep;\n#endif\n\n#include <dev/hwpmc/hwpmc_amd.h>\n#include <dev/hwpmc/hwpmc_core.h>\n#include <dev/hwpmc/hwpmc_piv.h>\n#include <dev/hwpmc/hwpmc_tsc.h>\n#include <dev/hwpmc/hwpmc_uncore.h>\n\n/*\n * Intel processors implementing V2 and later of the Intel performance\n * measurement architecture have PMCs of the following classes: TSC,\n * IAF, IAP, UCF and UCP.\n */\n#define\tPMC_MDEP_CLASS_INDEX_TSC\t0\n#define\tPMC_MDEP_CLASS_INDEX_K8\t\t1\n#define\tPMC_MDEP_CLASS_INDEX_P4\t\t1\n#define\tPMC_MDEP_CLASS_INDEX_IAP\t1\n#define\tPMC_MDEP_CLASS_INDEX_IAF\t2\n#define\tPMC_MDEP_CLASS_INDEX_UCP\t3\n#define\tPMC_MDEP_CLASS_INDEX_UCF\t4\n\n/*\n * On the amd64 platform we support the following PMCs.\n *\n * TSC\t\tThe timestamp counter\n * K8\t\tAMD Athlon64 and Opteron PMCs in 64 bit mode.\n * PIV\t\tIntel P4/HTT and P4/EMT64\n * IAP\t\tIntel Core/Core2/Atom CPUs in 64 bits mode.\n * IAF\t\tIntel fixed-function PMCs in Core2 and later CPUs.\n * UCP\t\tIntel Uncore programmable PMCs.\n * UCF\t\tIntel Uncore fixed-function PMCs.\n */\n\nunion pmc_md_op_pmcallocate  {\n\tstruct pmc_md_amd_op_pmcallocate\tpm_amd;\n\tstruct pmc_md_iaf_op_pmcallocate\tpm_iaf;\n\tstruct pmc_md_iap_op_pmcallocate\tpm_iap;\n\tstruct pmc_md_ucf_op_pmcallocate\tpm_ucf;\n\tstruct pmc_md_ucp_op_pmcallocate\tpm_ucp;\n\tstruct pmc_md_p4_op_pmcallocate\t\tpm_p4;\n\tuint64_t\t\t\t\t__pad[4];\n};\n\n/* Logging */\n#define\tPMCLOG_READADDR\t\tPMCLOG_READ64\n#define\tPMCLOG_EMITADDR\t\tPMCLOG_EMIT64\n\n#ifdef\t_KERNEL\n\nunion pmc_md_pmc {\n\tstruct pmc_md_amd_pmc\tpm_amd;\n\tstruct pmc_md_iaf_pmc\tpm_iaf;\n\tstruct pmc_md_iap_pmc\tpm_iap;\n\tstruct pmc_md_ucf_pmc\tpm_ucf;\n\tstruct pmc_md_ucp_pmc\tpm_ucp;\n\tstruct pmc_md_p4_pmc\tpm_p4;\n};\n\n#define\tPMC_TRAPFRAME_TO_PC(TF)\t((TF)->tf_rip)\n#define\tPMC_TRAPFRAME_TO_FP(TF)\t((TF)->tf_rbp)\n#define\tPMC_TRAPFRAME_TO_USER_SP(TF)\t((TF)->tf_rsp)\n#define\tPMC_TRAPFRAME_TO_KERNEL_SP(TF)\t((TF)->tf_rsp)\n\n#define\tPMC_AT_FUNCTION_PROLOGUE_PUSH_BP(I)\t\t\\\n\t(((I) & 0xffffffff) == 0xe5894855) /* pushq %rbp; movq %rsp,%rbp */\n#define\tPMC_AT_FUNCTION_PROLOGUE_MOV_SP_BP(I)\t\t\\\n\t(((I) & 0x00ffffff) == 0x00e58948) /* movq %rsp,%rbp */\n#define\tPMC_AT_FUNCTION_EPILOGUE_RET(I)\t\t\t\\\n\t(((I) & 0xFF) == 0xC3)\t\t   /* ret */\n\n#define\tPMC_IN_TRAP_HANDLER(PC) \t\t\t\\\n\t((PC) >= (uintptr_t) start_exceptions &&\t\\\n\t (PC) < (uintptr_t) end_exceptions)\n\n#define\tPMC_IN_KERNEL_STACK(S,START,END)\t\t\\\n\t((S) >= (START) && (S) < (END))\n#define\tPMC_IN_KERNEL(va) (((va) >= DMAP_MIN_ADDRESS &&\t\t\t\\\n\t(va) < DMAP_MAX_ADDRESS) || ((va) >= VM_MIN_KERNEL_ADDRESS &&\t\\\n\t(va) < VM_MAX_KERNEL_ADDRESS))\n\n#define\tPMC_IN_USERSPACE(va) ((va) <= VM_MAXUSER_ADDRESS)\n\n/*\n * Prototypes\n */\n\nvoid\tstart_exceptions(void), end_exceptions(void);\n\nstruct pmc_mdep *pmc_amd_initialize(void);\nvoid\tpmc_amd_finalize(struct pmc_mdep *_md);\nstruct pmc_mdep *pmc_intel_initialize(void);\nvoid\tpmc_intel_finalize(struct pmc_mdep *_md);\n\n#endif /* _KERNEL */\n#endif /* _MACHINE_PMC_MDEP_H */\n"
  },
  {
    "path": "freebsd-headers/machine/ppireg.h",
    "content": "/*-\n * Copyright (C) 2005 TAKAHASHI Yoshihiro. All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/amd64/include/ppireg.h 146211 2005-05-14 09:10:02Z nyan $\n */\n\n#ifndef _MACHINE_PPIREG_H_\n#define _MACHINE_PPIREG_H_\n\n#ifdef _KERNEL\n\n#define\tIO_PPI\t\t0x61\t/* Programmable Peripheral Interface */\n\n/*\n * PPI speaker control values\n */\n\n#define\tPIT_ENABLETMR2\t0x01\t/* Enable timer/counter 2 */\n#define\tPIT_SPKRDATA\t0x02\t/* Direct to speaker */\n\n#define\tPIT_SPKR\t(PIT_ENABLETMR2 | PIT_SPKRDATA)\n\n#define\tppi_spkr_on()\toutb(IO_PPI, inb(IO_PPI) | PIT_SPKR)\n#define\tppi_spkr_off()\toutb(IO_PPI, inb(IO_PPI) & ~PIT_SPKR)\n\n#endif /* _KERNEL */\n\n#endif /* _MACHINE_PPIREG_H_ */\n"
  },
  {
    "path": "freebsd-headers/machine/proc.h",
    "content": "/*-\n * Copyright (c) 1991 Regents of the University of California.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 4. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\tfrom: @(#)proc.h\t7.1 (Berkeley) 5/15/91\n * $FreeBSD: release/9.0.0/sys/amd64/include/proc.h 208453 2010-05-23 18:32:02Z kib $\n */\n\n#ifndef _MACHINE_PROC_H_\n#define\t_MACHINE_PROC_H_\n\n#include <machine/segments.h>\n\nstruct proc_ldt {\n\tcaddr_t ldt_base;\n\tint     ldt_refcnt;\n};\n\n/*\n * Machine-dependent part of the proc structure for AMD64.\n */\nstruct mdthread {\n\tint\tmd_spinlock_count;\t/* (k) */\n\tregister_t md_saved_flags;\t/* (k) */\n};\n\nstruct mdproc {\n\tstruct proc_ldt *md_ldt;\t/* (t) per-process ldt */\n\tstruct system_segment_descriptor md_ldt_sd;\n};\n\n#define\tKINFO_PROC_SIZE 1088\n#define\tKINFO_PROC32_SIZE 768\n\n#ifdef\t_KERNEL\n\n/* Get the current kernel thread stack usage. */\n#define GET_STACK_USAGE(total, used) do {\t\t\t\t\\\n\tstruct thread\t*td = curthread;\t\t\t\t\\\n\t(total) = td->td_kstack_pages * PAGE_SIZE;\t\t\t\\\n\t(used) = (char *)td->td_kstack +\t\t\t\t\\\n\t    td->td_kstack_pages * PAGE_SIZE -\t\t\t\t\\\n\t    (char *)&td;\t\t\t\t\t\t\\\n} while (0)\n\nvoid set_user_ldt(struct mdproc *);\nstruct proc_ldt *user_ldt_alloc(struct proc *, int);\nvoid user_ldt_free(struct thread *);\nvoid user_ldt_deref(struct proc_ldt *);\nstruct sysarch_args;\nint sysarch_ldt(struct thread *td, struct sysarch_args *uap, int uap_space);\nint amd64_set_ldt_data(struct thread *td, int start, int num,\n    struct user_segment_descriptor *descs);\n\nextern struct mtx dt_lock;\nextern int max_ldt_segment;\n\nstruct syscall_args {\n\tu_int code;\n\tstruct sysent *callp;\n\tregister_t args[8];\n\tint narg;\n};\n#define\tHAVE_SYSCALL_ARGS_DEF 1\n\n#endif  /* _KERNEL */\n\n#endif /* !_MACHINE_PROC_H_ */\n"
  },
  {
    "path": "freebsd-headers/machine/profile.h",
    "content": "/*-\n * Copyright (c) 1992, 1993\n *\tThe Regents of the University of California.  All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 4. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t@(#)profile.h\t8.1 (Berkeley) 6/11/93\n * $FreeBSD: release/9.0.0/sys/amd64/include/profile.h 214346 2010-10-25 15:28:03Z jhb $\n */\n\n#ifndef _MACHINE_PROFILE_H_\n#define\t_MACHINE_PROFILE_H_\n\n#ifndef _SYS_CDEFS_H_\n#error this file needs sys/cdefs.h as a prerequisite\n#endif\n\n#ifdef _KERNEL\n\n/*\n * Config generates something to tell the compiler to align functions on 16\n * byte boundaries.  A strict alignment is good for keeping the tables small.\n */\n#define\tFUNCTION_ALIGNMENT\t16\n\n/*\n * The kernel uses assembler stubs instead of unportable inlines.\n * This is mainly to save a little time when profiling is not enabled,\n * which is the usual case for the kernel.\n */\n#define\t_MCOUNT_DECL void mcount\n#define\tMCOUNT\n\n#ifdef GUPROF\n#define\tMCOUNT_DECL(s)\n#define\tMCOUNT_ENTER(s)\n#define\tMCOUNT_EXIT(s)\n#ifdef __GNUCLIKE_ASM\n#define\tMCOUNT_OVERHEAD(label)\t\t\t\t\t\t\\\n\t__asm __volatile(\"pushq %0; call __mcount; popq %%rcx\"\t\t\\\n\t\t\t :\t\t\t\t\t\t\\\n\t\t\t : \"i\" (label)\t\t\t\t\t\\\n\t\t\t : \"ax\", \"dx\", \"cx\", \"di\", \"si\", \"r8\", \"r9\", \"memory\")\n#define\tMEXITCOUNT_OVERHEAD()\t\t\t\t\t\t\\\n\t__asm __volatile(\"call .mexitcount; 1:\"\t\t\t\t\\\n\t\t\t : :\t\t\t\t\t\t\\\n\t\t\t : \"ax\", \"dx\", \"cx\", \"di\", \"si\", \"r8\", \"r9\", \"memory\")\n#define\tMEXITCOUNT_OVERHEAD_GETLABEL(labelp)\t\t\t\t\\\n\t__asm __volatile(\"movq $1b,%0\" : \"=rm\" (labelp))\n#elif defined(lint)\n#define\tMCOUNT_OVERHEAD(label)\n#define\tMEXITCOUNT_OVERHEAD()\n#define\tMEXITCOUNT_OVERHEAD_GETLABEL()\n#else\n#error this file needs to be ported to your compiler\n#endif /* !__GNUCLIKE_ASM */\n#else /* !GUPROF */\n#define\tMCOUNT_DECL(s)\tregister_t s;\n#ifdef SMP\nextern int\tmcount_lock;\n#define\tMCOUNT_ENTER(s)\t{ s = intr_disable(); \\\n \t\t\t  while (!atomic_cmpset_acq_int(&mcount_lock, 0, 1)) \\\n\t\t\t  \t/* nothing */ ; }\n#define\tMCOUNT_EXIT(s)\t{ atomic_store_rel_int(&mcount_lock, 0); \\\n\t\t\t  intr_restore(s); }\n#else\n#define\tMCOUNT_ENTER(s)\t{ s = intr_disable(); }\n#define\tMCOUNT_EXIT(s)\t(intr_restore(s))\n#endif\n#endif /* GUPROF */\n\nvoid bintr(void);\nvoid btrap(void);\nvoid eintr(void);\nvoid user(void);\n\n#define\tMCOUNT_FROMPC_USER(pc)\t\t\t\t\t\\\n\t((pc < (uintfptr_t)VM_MAXUSER_ADDRESS) ? (uintfptr_t)user : pc)\n\n#define\tMCOUNT_FROMPC_INTR(pc)\t\t\t\t\t\\\n\t((pc >= (uintfptr_t)btrap && pc < (uintfptr_t)eintr) ?\t\\\n\t    ((pc >= (uintfptr_t)bintr) ? (uintfptr_t)bintr :\t\\\n\t\t(uintfptr_t)btrap) : ~0UL)\n\n#else /* !_KERNEL */\n\n#define\tFUNCTION_ALIGNMENT\t4\n\n#define\t_MCOUNT_DECL \\\nstatic void _mcount(uintfptr_t frompc, uintfptr_t selfpc) __used; \\\nstatic void _mcount\n\n#ifdef __GNUCLIKE_ASM\n#define\tMCOUNT __asm(\"\t\t\t\\n\\\n\t.text\t\t\t\t\\n\\\n\t.p2align 4,0x90\t\t\t\\n\\\n\t.globl\t.mcount\t\t\t\\n\\\n\t.type\t.mcount,@function\t\\n\\\n.mcount:\t\t\t\t\\n\\\n\tpushq\t%rdi\t\t\t\\n\\\n\tpushq\t%rsi\t\t\t\\n\\\n\tpushq\t%rdx\t\t\t\\n\\\n\tpushq\t%rcx\t\t\t\\n\\\n\tpushq\t%r8\t\t\t\\n\\\n\tpushq\t%r9\t\t\t\\n\\\n\tpushq\t%rax\t\t\t\\n\\\n\tmovq\t8(%rbp),%rdi\t\t\\n\\\n\tmovq\t7*8(%rsp),%rsi\t\t\\n\\\n\tcall\t_mcount\t\t\t\\n\\\n\tpopq\t%rax\t\t\t\\n\\\n\tpopq\t%r9\t\t\t\\n\\\n\tpopq\t%r8\t\t\t\\n\\\n\tpopq\t%rcx\t\t\t\\n\\\n\tpopq\t%rdx\t\t\t\\n\\\n\tpopq\t%rsi\t\t\t\\n\\\n\tpopq\t%rdi\t\t\t\\n\\\n\tret\t\t\t\t\\n\\\n\t.size\t.mcount, . - .mcount\");\n#if 0\n/*\n * We could use this, except it doesn't preserve the registers that were\n * being passed with arguments to the function that we were inserted\n * into.  I've left it here as documentation of what the code above is\n * supposed to do.\n */\n#define\tMCOUNT\t\t\t\t\t\t\t\t\\\nvoid\t\t\t\t\t\t\t\t\t\\\nmcount()\t\t\t\t\t\t\t\t\\\n{\t\t\t\t\t\t\t\t\t\\\n\tuintfptr_t selfpc, frompc;\t\t\t\t\t\\\n\t/*\t\t\t\t\t\t\t\t\\\n\t * Find the return address for mcount,\t\t\t\t\\\n\t * and the return address for mcount's caller.\t\t\t\\\n\t *\t\t\t\t\t\t\t\t\\\n\t * selfpc = pc pushed by call to mcount\t\t\t\t\\\n\t */\t\t\t\t\t\t\t\t\\\n\t__asm(\"movq 8(%%rbp),%0\" : \"=r\" (selfpc));\t\t\t\\\n\t/*\t\t\t\t\t\t\t\t\\\n\t * frompc = pc pushed by call to mcount's caller.\t\t\\\n\t * The caller's stack frame has already been built, so %rbp is\t\\\n\t * the caller's frame pointer.  The caller's raddr is in the\t\\\n\t * caller's frame following the caller's caller's frame pointer.\\\n\t */\t\t\t\t\t\t\t\t\\\n\t__asm(\"movq (%%rbp),%0\" : \"=r\" (frompc));\t\t\t\\\n\tfrompc = ((uintfptr_t *)frompc)[1];\t\t\t\t\\\n\t_mcount(frompc, selfpc);\t\t\t\t\t\\\n}\n#endif\n#else /* !__GNUCLIKE_ASM */\n#define\tMCOUNT\n#endif /* __GNUCLIKE_ASM */\n\ntypedef\tu_long\tuintfptr_t;\n\n#endif /* _KERNEL */\n\n/*\n * An unsigned integral type that can hold non-negative difference between\n * function pointers.\n */\ntypedef\tu_long\tfptrdiff_t;\n\n#ifdef _KERNEL\n\nvoid\tmcount(uintfptr_t frompc, uintfptr_t selfpc);\n\n#else /* !_KERNEL */\n\n#include <sys/cdefs.h>\n\n__BEGIN_DECLS\n#ifdef __GNUCLIKE_ASM\nvoid\tmcount(void) __asm(\".mcount\");\n#endif\n__END_DECLS\n\n#endif /* _KERNEL */\n\n#endif /* !_MACHINE_PROFILE_H_ */\n"
  },
  {
    "path": "freebsd-headers/machine/psl.h",
    "content": "/*-\n * Copyright (c) 1990 The Regents of the University of California.\n * All rights reserved.\n *\n * This code is derived from software contributed to Berkeley by\n * William Jolitz.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 4. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\tfrom: @(#)psl.h\t5.2 (Berkeley) 1/18/91\n * $FreeBSD: release/9.0.0/sys/amd64/include/psl.h 127914 2004-04-05 21:29:41Z imp $\n */\n\n#ifndef _MACHINE_PSL_H_\n#define\t_MACHINE_PSL_H_\n\n/*\n * 386 processor status longword.\n */\n#define\tPSL_C\t\t0x00000001\t/* carry bit */\n#define\tPSL_PF\t\t0x00000004\t/* parity bit */\n#define\tPSL_AF\t\t0x00000010\t/* bcd carry bit */\n#define\tPSL_Z\t\t0x00000040\t/* zero bit */\n#define\tPSL_N\t\t0x00000080\t/* negative bit */\n#define\tPSL_T\t\t0x00000100\t/* trace enable bit */\n#define\tPSL_I\t\t0x00000200\t/* interrupt enable bit */\n#define\tPSL_D\t\t0x00000400\t/* string instruction direction bit */\n#define\tPSL_V\t\t0x00000800\t/* overflow bit */\n#define\tPSL_IOPL\t0x00003000\t/* i/o privilege level */\n#define\tPSL_NT\t\t0x00004000\t/* nested task bit */\n#define\tPSL_RF\t\t0x00010000\t/* resume flag bit */\n/* #define PSL_VM\t0x00020000 */\t/* virtual 8086 mode bit */\n#define\tPSL_AC\t\t0x00040000\t/* alignment checking */\n/* #define PSL_VIF\t0x00080000 */\t/* virtual interrupt enable */\n/* #define PSL_VIP\t0x00100000 */\t/* virtual interrupt pending */\n#define\tPSL_ID\t\t0x00200000\t/* identification bit */\n\n/*\n * The i486 manual says that we are not supposed to change reserved flags,\n * but this is too much trouble since the reserved flags depend on the cpu\n * and setting them to their historical values works in practice.\n */\n#define\tPSL_RESERVED_DEFAULT\t0x00000002\n\n/*\n * Initial flags for kernel and user mode.  The kernel later inherits\n * PSL_I and some other flags from user mode.\n */\n#define\tPSL_KERNEL\tPSL_RESERVED_DEFAULT\n#define\tPSL_USER\t(PSL_RESERVED_DEFAULT | PSL_I)\n\n/*\n * Bits that can be changed in user mode on 486's.  We allow these bits\n * to be changed using ptrace(), sigreturn() and procfs.  Setting PS_NT\n * is undesirable but it may as well be allowed since users can inflict\n * it on the kernel directly.  Changes to PSL_AC are silently ignored on\n * 386's.\n */\n#define\tPSL_USERCHANGE (PSL_C | PSL_PF | PSL_AF | PSL_Z | PSL_N | PSL_T \\\n\t\t\t| PSL_D | PSL_V | PSL_NT | PSL_AC | PSL_ID)\n\n#endif /* !_MACHINE_PSL_H_ */\n"
  },
  {
    "path": "freebsd-headers/machine/ptrace.h",
    "content": "/*-\n * Copyright (c) 1992, 1993\n *\tThe Regents of the University of California.  All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 4. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t@(#)ptrace.h\t8.1 (Berkeley) 6/11/93\n * $FreeBSD: release/9.0.0/sys/amd64/include/ptrace.h 139731 2005-01-05 20:17:21Z imp $\n */\n\n#ifndef _MACHINE_PTRACE_H_\n#define _MACHINE_PTRACE_H_\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/machine/reg.h",
    "content": "/*-\n * Copyright (c) 2003 Peter Wemm.\n * Copyright (c) 1990 The Regents of the University of California.\n * All rights reserved.\n *\n * This code is derived from software contributed to Berkeley by\n * William Jolitz.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 4. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\tfrom: @(#)reg.h\t5.5 (Berkeley) 1/18/91\n * $FreeBSD: release/9.0.0/sys/amd64/include/reg.h 218744 2011-02-16 17:50:21Z dchagin $\n */\n\n#ifndef _MACHINE_REG_H_\n#define\t_MACHINE_REG_H_\n\n#if defined(_KERNEL) && !defined(_STANDALONE)\n#include \"opt_compat.h\"\n#endif\n\n/*\n * Register set accessible via /proc/$pid/regs and PT_{SET,GET}REGS.\n */\nstruct reg {\n\tregister_t\tr_r15;\n\tregister_t\tr_r14;\n\tregister_t\tr_r13;\n\tregister_t\tr_r12;\n\tregister_t\tr_r11;\n\tregister_t\tr_r10;\n\tregister_t\tr_r9;\n\tregister_t\tr_r8;\n\tregister_t\tr_rdi;\n\tregister_t\tr_rsi;\n\tregister_t\tr_rbp;\n\tregister_t\tr_rbx;\n\tregister_t\tr_rdx;\n\tregister_t\tr_rcx;\n\tregister_t\tr_rax;\n\tuint32_t\tr_trapno;\n\tuint16_t\tr_fs;\n\tuint16_t\tr_gs;\n\tuint32_t\tr_err;\n\tuint16_t\tr_es;\n\tuint16_t\tr_ds;\n\tregister_t\tr_rip;\n\tregister_t\tr_cs;\n\tregister_t\tr_rflags;\n\tregister_t\tr_rsp;\n\tregister_t\tr_ss;\n};\n\n/*\n * Register set accessible via /proc/$pid/fpregs.\n */\nstruct fpreg {\n\t/*\n\t * XXX should get struct from fpu.h.  Here we give a slightly\n\t * simplified struct.  This may be too much detail.  Perhaps\n\t * an array of unsigned longs is best.\n\t */\n\tunsigned long\tfpr_env[4];\n\tunsigned char\tfpr_acc[8][16];\n\tunsigned char\tfpr_xacc[16][16];\n\tunsigned long\tfpr_spare[12];\n};\n\n/*\n * Register set accessible via /proc/$pid/dbregs.\n */\nstruct dbreg {\n\tunsigned long  dr[16];\t/* debug registers */\n\t\t\t\t/* Index 0-3: debug address registers */\n\t\t\t\t/* Index 4-5: reserved */\n\t\t\t\t/* Index 6: debug status */\n\t\t\t\t/* Index 7: debug control */\n\t\t\t\t/* Index 8-15: reserved */\n};\n\n#define\tDBREG_DR7_LOCAL_ENABLE\t0x01\n#define\tDBREG_DR7_GLOBAL_ENABLE\t0x02\n#define\tDBREG_DR7_LEN_1\t\t0x00\t/* 1 byte length          */\n#define\tDBREG_DR7_LEN_2\t\t0x01\n#define\tDBREG_DR7_LEN_4\t\t0x03\n#define\tDBREG_DR7_LEN_8\t\t0x02\n#define\tDBREG_DR7_EXEC\t\t0x00\t/* break on execute       */\n#define\tDBREG_DR7_WRONLY\t0x01\t/* break on write         */\n#define\tDBREG_DR7_RDWR\t\t0x03\t/* break on read or write */\n#define\tDBREG_DR7_MASK(i)\t(0xful << ((i) * 4 + 16) | 0x3 << (i) * 2)\n#define\tDBREG_DR7_SET(i, len, access, enable)\t\t\t\t\\\n\t((u_long)((len) << 2 | (access)) << ((i) * 4 + 16) | (enable) << (i) * 2)\n#define\tDBREG_DR7_GD\t\t0x2000\n#define\tDBREG_DR7_ENABLED(d, i)\t(((d) & 0x3 << (i) * 2) != 0)\n#define\tDBREG_DR7_ACCESS(d, i)\t((d) >> ((i) * 4 + 16) & 0x3)\n#define\tDBREG_DR7_LEN(d, i)\t((d) >> ((i) * 4 + 18) & 0x3)\n\n#define\tDBREG_DRX(d,x)\t((d)->dr[(x)])\t/* reference dr0 - dr15 by\n\t\t\t\t\t   register number */\n\n#ifdef COMPAT_FREEBSD32\n#include <machine/fpu.h>\n#include <compat/ia32/ia32_reg.h>\n#endif\n\n#ifdef _KERNEL\n/*\n * XXX these interfaces are MI, so they should be declared in a MI place.\n */\nint\tfill_regs(struct thread *, struct reg *);\nint\tfill_frame_regs(struct trapframe *, struct reg *);\nint\tset_regs(struct thread *, struct reg *);\nint\tfill_fpregs(struct thread *, struct fpreg *);\nint\tset_fpregs(struct thread *, struct fpreg *);\nint\tfill_dbregs(struct thread *, struct dbreg *);\nint\tset_dbregs(struct thread *, struct dbreg *);\n#endif\n\n#endif /* !_MACHINE_REG_H_ */\n"
  },
  {
    "path": "freebsd-headers/machine/reloc.h",
    "content": "/*-\n * Copyright (c) 1992, 1993\n *\tThe Regents of the University of California.  All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 4. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t@(#)reloc.h\t8.1 (Berkeley) 6/10/93\n * $FreeBSD: release/9.0.0/sys/amd64/include/reloc.h 127914 2004-04-05 21:29:41Z imp $\n */\n\n#ifndef _I386_MACHINE_RELOC_H_\n#define _I386_MACHINE_RELOC_H_\n\n/* Relocation format. */\nstruct relocation_info {\n\tint r_address;\t\t\t  /* offset in text or data segment */\n\tunsigned int   r_symbolnum : 24,  /* ordinal number of add symbol */\n\t\t\t   r_pcrel :  1,  /* 1 if value should be pc-relative */\n\t\t\t  r_length :  2,  /* log base 2 of value's width */\n\t\t\t  r_extern :  1,  /* 1 if need to add symbol to value */\n\t\t\t r_baserel :  1,  /* linkage table relative */\n\t\t\tr_jmptable :  1,  /* relocate to jump table */\n\t\t\tr_relative :  1,  /* load address relative */\n\t\t\t    r_copy :  1;  /* run time copy */\n};\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/machine/resource.h",
    "content": "/* $FreeBSD: release/9.0.0/sys/amd64/include/resource.h 139731 2005-01-05 20:17:21Z imp $ */\n/*-\n * Copyright 1998 Massachusetts Institute of Technology\n *\n * Permission to use, copy, modify, and distribute this software and\n * its documentation for any purpose and without fee is hereby\n * granted, provided that both the above copyright notice and this\n * permission notice appear in all copies, that both the above\n * copyright notice and this permission notice appear in all\n * supporting documentation, and that the name of M.I.T. not be used\n * in advertising or publicity pertaining to distribution of the\n * software without specific, written prior permission.  M.I.T. makes\n * no representations about the suitability of this software for any\n * purpose.  It is provided \"as is\" without express or implied\n * warranty.\n * \n * THIS SOFTWARE IS PROVIDED BY M.I.T. ``AS IS''.  M.I.T. DISCLAIMS\n * ALL EXPRESS OR IMPLIED WARRANTIES WITH REGARD TO THIS SOFTWARE,\n * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF\n * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT\n * SHALL M.I.T. BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF\n * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\n * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,\n * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT\n * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n */\n\n#ifndef _MACHINE_RESOURCE_H_\n#define\t_MACHINE_RESOURCE_H_\t1\n\n/*\n * Definitions of resource types for Intel Architecture machines\n * with support for legacy ISA devices and drivers.\n */\n\n#define\tSYS_RES_IRQ\t1\t/* interrupt lines */\n#define\tSYS_RES_DRQ\t2\t/* isa dma lines */\n#define\tSYS_RES_MEMORY\t3\t/* i/o memory */\n#define\tSYS_RES_IOPORT\t4\t/* i/o ports */\n\n#endif /* !_MACHINE_RESOURCE_H_ */\n"
  },
  {
    "path": "freebsd-headers/machine/runq.h",
    "content": "/*-\n * Copyright (c) 2001 Jake Burkholder <jake@FreeBSD.org>\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/amd64/include/runq.h 139731 2005-01-05 20:17:21Z imp $\n */\n\n#ifndef\t_MACHINE_RUNQ_H_\n#define\t_MACHINE_RUNQ_H_\n\n#define\tRQB_LEN\t\t(1)\t\t/* Number of priority status words. */\n#define\tRQB_L2BPW\t(6)\t\t/* Log2(sizeof(rqb_word_t) * NBBY)). */\n#define\tRQB_BPW\t\t(1<<RQB_L2BPW)\t/* Bits in an rqb_word_t. */\n\n#define\tRQB_BIT(pri)\t(1ul << ((pri) & (RQB_BPW - 1)))\n#define\tRQB_WORD(pri)\t((pri) >> RQB_L2BPW)\n\n#define\tRQB_FFS(word)\t(bsfq(word))\n\n/*\n * Type of run queue status word.\n */\ntypedef\tu_int64_t\trqb_word_t;\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/machine/segments.h",
    "content": "/*-\n * Copyright (c) 1989, 1990 William F. Jolitz\n * Copyright (c) 1990 The Regents of the University of California.\n * All rights reserved.\n *\n * This code is derived from software contributed to Berkeley by\n * William Jolitz.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 4. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\tfrom: @(#)segments.h\t7.1 (Berkeley) 5/9/91\n * $FreeBSD: release/9.0.0/sys/amd64/include/segments.h 227946 2011-11-24 18:44:14Z rstone $\n */\n\n#ifndef _MACHINE_SEGMENTS_H_\n#define\t_MACHINE_SEGMENTS_H_\n\n/*\n * AMD64 Segmentation Data Structures and definitions\n */\n\n/*\n * Selectors\n */\n\n#define\tSEL_RPL_MASK\t3\t/* requester priv level */\n#define\tISPL(s)\t((s)&3)\t\t/* what is the priority level of a selector */\n#define\tSEL_KPL\t0\t\t/* kernel priority level */\n#define\tSEL_UPL\t3\t\t/* user priority level */\n#define\tISLDT(s)\t((s)&SEL_LDT)\t/* is it local or global */\n#define\tSEL_LDT\t4\t\t/* local descriptor table */\n#define\tIDXSEL(s)\t(((s)>>3) & 0x1fff)\t\t/* index of selector */\n#define\tLSEL(s,r)\t(((s)<<3) | SEL_LDT | r)\t/* a local selector */\n#define\tGSEL(s,r)\t(((s)<<3) | r)\t\t\t/* a global selector */\n\n/*\n * User segment descriptors (%cs, %ds etc for compatability apps. 64 bit wide)\n * For long-mode apps, %cs only has the conforming bit in sd_type, the sd_dpl,\n * sd_p, sd_l and sd_def32 which must be zero).  %ds only has sd_p.\n */\nstruct\tuser_segment_descriptor {\n\tu_int64_t sd_lolimit:16;\t/* segment extent (lsb) */\n\tu_int64_t sd_lobase:24;\t\t/* segment base address (lsb) */\n\tu_int64_t sd_type:5;\t\t/* segment type */\n\tu_int64_t sd_dpl:2;\t\t/* segment descriptor priority level */\n\tu_int64_t sd_p:1;\t\t/* segment descriptor present */\n\tu_int64_t sd_hilimit:4;\t\t/* segment extent (msb) */\n\tu_int64_t sd_xx:1;\t\t/* unused */\n\tu_int64_t sd_long:1;\t\t/* long mode (cs only) */\n\tu_int64_t sd_def32:1;\t\t/* default 32 vs 16 bit size */\n\tu_int64_t sd_gran:1;\t\t/* limit granularity (byte/page units)*/\n\tu_int64_t sd_hibase:8;\t\t/* segment base address  (msb) */\n} __packed;\n\n#define\tUSD_GETBASE(sd)\t\t(((sd)->sd_lobase) | (sd)->sd_hibase << 24) \n#define\tUSD_SETBASE(sd, b)\t(sd)->sd_lobase = (b); \t\\\n\t\t\t\t(sd)->sd_hibase = ((b) >> 24);\n#define\tUSD_GETLIMIT(sd)\t(((sd)->sd_lolimit) | (sd)->sd_hilimit << 16)\n#define\tUSD_SETLIMIT(sd, l)\t(sd)->sd_lolimit = (l);\t\\\n\t\t\t\t(sd)->sd_hilimit = ((l) >> 16);\n\n/*\n * System segment descriptors (128 bit wide)\n */\nstruct\tsystem_segment_descriptor {\n\tu_int64_t sd_lolimit:16;\t/* segment extent (lsb) */\n\tu_int64_t sd_lobase:24;\t\t/* segment base address (lsb) */\n\tu_int64_t sd_type:5;\t\t/* segment type */\n\tu_int64_t sd_dpl:2;\t\t/* segment descriptor priority level */\n\tu_int64_t sd_p:1;\t\t/* segment descriptor present */\n\tu_int64_t sd_hilimit:4;\t\t/* segment extent (msb) */\n\tu_int64_t sd_xx0:3;\t\t/* unused */\n\tu_int64_t sd_gran:1;\t\t/* limit granularity (byte/page units)*/\n\tu_int64_t sd_hibase:40 __packed;/* segment base address  (msb) */\n\tu_int64_t sd_xx1:8;\n\tu_int64_t sd_mbz:5;\t\t/* MUST be zero */\n\tu_int64_t sd_xx2:19;\n} __packed;\n\n/*\n * Gate descriptors (e.g. indirect descriptors, trap, interrupt etc. 128 bit)\n * Only interrupt and trap gates have gd_ist.\n */\nstruct\tgate_descriptor {\n\tu_int64_t gd_looffset:16;\t/* gate offset (lsb) */\n\tu_int64_t gd_selector:16;\t/* gate segment selector */\n\tu_int64_t gd_ist:3;\t\t/* IST table index */\n\tu_int64_t gd_xx:5;\t\t/* unused */\n\tu_int64_t gd_type:5;\t\t/* segment type */\n\tu_int64_t gd_dpl:2;\t\t/* segment descriptor priority level */\n\tu_int64_t gd_p:1;\t\t/* segment descriptor present */\n\tu_int64_t gd_hioffset:48 __packed;\t/* gate offset (msb) */\n\tu_int64_t sd_xx1:32;\n} __packed;\n\n/*\n * Generic descriptor\n */\nunion\tdescriptor\t{\n\tstruct\tuser_segment_descriptor sd;\n\tstruct\tgate_descriptor gd;\n};\n\n\t/* system segments and gate types */\n#define\tSDT_SYSNULL\t 0\t/* system null */\n#define\tSDT_SYS286TSS\t 1\t/* system 286 TSS available */\n#define\tSDT_SYSLDT\t 2\t/* system 64 bit local descriptor table */\n#define\tSDT_SYS286BSY\t 3\t/* system 286 TSS busy */\n#define\tSDT_SYS286CGT\t 4\t/* system 286 call gate */\n#define\tSDT_SYSTASKGT\t 5\t/* system task gate */\n#define\tSDT_SYS286IGT\t 6\t/* system 286 interrupt gate */\n#define\tSDT_SYS286TGT\t 7\t/* system 286 trap gate */\n#define\tSDT_SYSNULL2\t 8\t/* system null again */\n#define\tSDT_SYSTSS\t 9\t/* system available 64 bit TSS */\n#define\tSDT_SYSNULL3\t10\t/* system null again */\n#define\tSDT_SYSBSY\t11\t/* system busy 64 bit TSS */\n#define\tSDT_SYSCGT\t12\t/* system 64 bit call gate */\n#define\tSDT_SYSNULL4\t13\t/* system null again */\n#define\tSDT_SYSIGT\t14\t/* system 64 bit interrupt gate */\n#define\tSDT_SYSTGT\t15\t/* system 64 bit trap gate */\n\n\t/* memory segment types */\n#define\tSDT_MEMRO\t16\t/* memory read only */\n#define\tSDT_MEMROA\t17\t/* memory read only accessed */\n#define\tSDT_MEMRW\t18\t/* memory read write */\n#define\tSDT_MEMRWA\t19\t/* memory read write accessed */\n#define\tSDT_MEMROD\t20\t/* memory read only expand dwn limit */\n#define\tSDT_MEMRODA\t21\t/* memory read only expand dwn limit accessed */\n#define\tSDT_MEMRWD\t22\t/* memory read write expand dwn limit */\n#define\tSDT_MEMRWDA\t23\t/* memory read write expand dwn limit accessed */\n#define\tSDT_MEME\t24\t/* memory execute only */\n#define\tSDT_MEMEA\t25\t/* memory execute only accessed */\n#define\tSDT_MEMER\t26\t/* memory execute read */\n#define\tSDT_MEMERA\t27\t/* memory execute read accessed */\n#define\tSDT_MEMEC\t28\t/* memory execute only conforming */\n#define\tSDT_MEMEAC\t29\t/* memory execute only accessed conforming */\n#define\tSDT_MEMERC\t30\t/* memory execute read conforming */\n#define\tSDT_MEMERAC\t31\t/* memory execute read accessed conforming */\n\n/*\n * Software definitions are in this convenient format,\n * which are translated into inconvenient segment descriptors\n * when needed to be used by the 386 hardware\n */\n\nstruct\tsoft_segment_descriptor {\n\tunsigned long ssd_base;\t\t/* segment base address  */\n\tunsigned long ssd_limit;\t/* segment extent */\n\tunsigned long ssd_type:5;\t/* segment type */\n\tunsigned long ssd_dpl:2;\t/* segment descriptor priority level */\n\tunsigned long ssd_p:1;\t\t/* segment descriptor present */\n\tunsigned long ssd_long:1;\t/* long mode (for %cs) */\n\tunsigned long ssd_def32:1;\t/* default 32 vs 16 bit size */\n\tunsigned long ssd_gran:1;\t/* limit granularity (byte/page units)*/\n} __packed;\n\n/*\n * region descriptors, used to load gdt/idt tables before segments yet exist.\n */\nstruct region_descriptor {\n\tunsigned long rd_limit:16;\t\t/* segment extent */\n\tunsigned long rd_base:64 __packed;\t/* base address  */\n} __packed;\n\n/*\n * Size of IDT table\n */\n#define\tNIDT\t256\t\t/* 32 reserved, 16 h/w, 0 s/w, linux's 0x80 */\n#define\tNRSVIDT\t32\t\t/* reserved entries for cpu exceptions */\n\n/*\n * Entries in the Interrupt Descriptor Table (IDT)\n */\n#define\tIDT_DE\t\t0\t/* #DE: Divide Error */\n#define\tIDT_DB\t\t1\t/* #DB: Debug */\n#define\tIDT_NMI\t\t2\t/* Nonmaskable External Interrupt */\n#define\tIDT_BP\t\t3\t/* #BP: Breakpoint */\n#define\tIDT_OF\t\t4\t/* #OF: Overflow */\n#define\tIDT_BR\t\t5\t/* #BR: Bound Range Exceeded */\n#define\tIDT_UD\t\t6\t/* #UD: Undefined/Invalid Opcode */\n#define\tIDT_NM\t\t7\t/* #NM: No Math Coprocessor */\n#define\tIDT_DF\t\t8\t/* #DF: Double Fault */\n#define\tIDT_FPUGP\t9\t/* Coprocessor Segment Overrun */\n#define\tIDT_TS\t\t10\t/* #TS: Invalid TSS */\n#define\tIDT_NP\t\t11\t/* #NP: Segment Not Present */\n#define\tIDT_SS\t\t12\t/* #SS: Stack Segment Fault */\n#define\tIDT_GP\t\t13\t/* #GP: General Protection Fault */\n#define\tIDT_PF\t\t14\t/* #PF: Page Fault */\n#define\tIDT_MF\t\t16\t/* #MF: FPU Floating-Point Error */\n#define\tIDT_AC\t\t17\t/* #AC: Alignment Check */\n#define\tIDT_MC\t\t18\t/* #MC: Machine Check */\n#define\tIDT_XF\t\t19\t/* #XF: SIMD Floating-Point Exception */\n#define\tIDT_IO_INTS\tNRSVIDT\t/* Base of IDT entries for I/O interrupts. */\n#define\tIDT_SYSCALL\t0x80\t/* System Call Interrupt Vector */\n#define\tIDT_DTRACE_RET\t0x20\t/* DTrace pid provider Interrupt Vector */\n\n/*\n * Entries in the Global Descriptor Table (GDT)\n */\n#define\tGNULL_SEL\t0\t/* Null Descriptor */\n#define\tGNULL2_SEL\t1\t/* Null Descriptor */\n#define\tGUFS32_SEL\t2\t/* User 32 bit %fs Descriptor */\n#define\tGUGS32_SEL\t3\t/* User 32 bit %gs Descriptor */\n#define\tGCODE_SEL\t4\t/* Kernel Code Descriptor */\n#define\tGDATA_SEL\t5\t/* Kernel Data Descriptor */\n#define\tGUCODE32_SEL\t6\t/* User 32 bit code Descriptor */\n#define\tGUDATA_SEL\t7\t/* User 32/64 bit Data Descriptor */\n#define\tGUCODE_SEL\t8\t/* User 64 bit Code Descriptor */\n#define\tGPROC0_SEL\t9\t/* TSS for entering kernel etc */\n/* slot 10 is second half of GPROC0_SEL */\n#define\tGUSERLDT_SEL\t11\t/* LDT */\n/* slot 11 is second half of GUSERLDT_SEL */\n#define\tNGDT \t\t13\n\n#ifdef _KERNEL\nextern struct user_segment_descriptor gdt[];\nextern struct soft_segment_descriptor gdt_segs[];\nextern struct gate_descriptor *idt;\nextern struct region_descriptor r_gdt, r_idt;\n\nvoid\tlgdt(struct region_descriptor *rdp);\nvoid\tsdtossd(struct user_segment_descriptor *sdp,\n\t    struct soft_segment_descriptor *ssdp);\nvoid\tssdtosd(struct soft_segment_descriptor *ssdp,\n\t    struct user_segment_descriptor *sdp);\nvoid\tssdtosyssd(struct soft_segment_descriptor *ssdp,\n\t    struct system_segment_descriptor *sdp);\nvoid\tupdate_gdt_gsbase(struct thread *td, uint32_t base);\nvoid\tupdate_gdt_fsbase(struct thread *td, uint32_t base);\n\n#endif /* _KERNEL */\n\n#endif /* !_MACHINE_SEGMENTS_H_ */\n"
  },
  {
    "path": "freebsd-headers/machine/setjmp.h",
    "content": "/*-\n * Copyright (c) 1998 John Birrell <jb@cimlogic.com.au>.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. Neither the name of the author nor the names of any co-contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY JOHN BIRRELL AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/amd64/include/setjmp.h 165967 2007-01-12 07:26:21Z imp $\n */\n\n#ifndef _MACHINE_SETJMP_H_\n#define\t_MACHINE_SETJMP_H_\n\n#include <sys/cdefs.h>\n\n#define\t_JBLEN\t12\t\t/* Size of the jmp_buf on AMD64. */\n\n/*\n * jmp_buf and sigjmp_buf are encapsulated in different structs to force\n * compile-time diagnostics for mismatches.  The structs are the same\n * internally to avoid some run-time errors for mismatches.\n */\n#if __BSD_VISIBLE || __POSIX_VISIBLE || __XSI_VISIBLE\ntypedef\tstruct _sigjmp_buf { long _sjb[_JBLEN]; } sigjmp_buf[1];\n#endif\n\ntypedef\tstruct _jmp_buf { long _jb[_JBLEN]; } jmp_buf[1];\n\n#endif /* !_MACHINE_SETJMP_H_ */\n"
  },
  {
    "path": "freebsd-headers/machine/sf_buf.h",
    "content": "/*-\n * Copyright (c) 2003, 2005 Alan L. Cox <alc@cs.rice.edu>\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/amd64/include/sf_buf.h 142840 2005-02-28 23:38:15Z peter $\n */\n\n#ifndef _MACHINE_SF_BUF_H_\n#define _MACHINE_SF_BUF_H_\n\n#include <vm/vm.h>\n#include <vm/vm_param.h>\n#include <vm/vm_page.h>\n\n/*\n * On this machine, the only purpose for which sf_buf is used is to implement\n * an opaque pointer required by the machine-independent parts of the kernel.\n * That pointer references the vm_page that is \"mapped\" by the sf_buf.  The\n * actual mapping is provided by the direct virtual-to-physical mapping.  \n */\nstruct sf_buf;\n\nstatic __inline vm_offset_t\nsf_buf_kva(struct sf_buf *sf)\n{\n\n\treturn (PHYS_TO_DMAP(VM_PAGE_TO_PHYS((vm_page_t)sf)));\n}\n\nstatic __inline vm_page_t\nsf_buf_page(struct sf_buf *sf)\n{\n\n\treturn ((vm_page_t)sf);\n}\n\n#endif /* !_MACHINE_SF_BUF_H_ */\n"
  },
  {
    "path": "freebsd-headers/machine/sigframe.h",
    "content": "/*-\n * Copyright (c) 1999 Marcel Moolenaar\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer \n *    in this position and unchanged.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. The name of the author may not be used to endorse or promote products\n *    derived from this software without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR\n * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES\n * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,\n * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF\n * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/amd64/include/sigframe.h 114349 2003-05-01 01:05:25Z peter $\n */\n\n#ifndef _MACHINE_SIGFRAME_H_\n#define\t_MACHINE_SIGFRAME_H_\n\n/*\n * Signal frames, arguments passed to application signal handlers.\n */\nstruct sigframe {\n\tunion {\n\t\t__siginfohandler_t\t*sf_action;\n\t\t__sighandler_t\t\t*sf_handler;\n\t} sf_ahu;\n\tucontext_t\tsf_uc;\t\t/* = *sf_ucontext */\n\tsiginfo_t\tsf_si;\t\t/* = *sf_siginfo (SA_SIGINFO case) */\n};\n\n#endif /* !_MACHINE_SIGFRAME_H_ */\n"
  },
  {
    "path": "freebsd-headers/machine/signal.h",
    "content": "/*-\n * Copyright (c) 2003 Peter Wemm.\n * Copyright (c) 1986, 1989, 1991, 1993\n *\tThe Regents of the University of California.  All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 4. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t@(#)signal.h\t8.1 (Berkeley) 6/11/93\n * $FreeBSD: release/9.0.0/sys/amd64/include/signal.h 190623 2009-04-01 13:44:28Z kib $\n */\n\n#ifndef _MACHINE_SIGNAL_H_\n#define\t_MACHINE_SIGNAL_H_\n\n#include <sys/cdefs.h>\n#include <sys/_sigset.h>\n\n/*\n * Machine-dependent signal definitions\n */\n\ntypedef long sig_atomic_t;\n\n#if __BSD_VISIBLE\n#include <machine/trap.h>\t/* codes for SIGILL, SIGFPE */\n\n/*\n * Only the kernel should need these old type definitions.\n */\n/*\n * Information pushed on stack when a signal is delivered.\n * This is used by the kernel to restore state following\n * execution of the signal handler.  It is also made available\n * to the handler to allow it to restore state properly if\n * a non-standard exit is performed.\n */\n/*\n * The sequence of the fields/registers in struct sigcontext should match\n * those in mcontext_t.\n */\nstruct sigcontext {\n\tstruct __sigset sc_mask;\t/* signal mask to restore */\n\tlong\tsc_onstack;\t\t/* sigstack state to restore */\n\tlong\tsc_rdi;\t\t/* machine state (struct trapframe) */\n\tlong\tsc_rsi;\n\tlong\tsc_rdx;\n\tlong\tsc_rcx;\n\tlong\tsc_r8;\n\tlong\tsc_r9;\n\tlong\tsc_rax;\n\tlong\tsc_rbx;\n\tlong\tsc_rbp;\n\tlong\tsc_r10;\n\tlong\tsc_r11;\n\tlong\tsc_r12;\n\tlong\tsc_r13;\n\tlong\tsc_r14;\n\tlong\tsc_r15;\n\tint\tsc_trapno;\n\tshort\tsc_fs;\n\tshort\tsc_gs;\n\tlong\tsc_addr;\n\tint\tsc_flags;\n\tshort\tsc_es;\n\tshort\tsc_ds;\n\tlong\tsc_err;\n\tlong\tsc_rip;\n\tlong\tsc_cs;\n\tlong\tsc_rflags;\n\tlong\tsc_rsp;\n\tlong\tsc_ss;\n\tlong\tsc_len;\t\t\t/* sizeof(mcontext_t) */\n\t/*\n\t * XXX - See <machine/ucontext.h> and <machine/fpu.h> for\n\t *       the following fields.\n\t */\n\tlong\tsc_fpformat;\n\tlong\tsc_ownedfp;\n\tlong\tsc_fpstate[64] __aligned(16);\n\n\tlong\tsc_fsbase;\n\tlong\tsc_gsbase;\n\n\tlong\tsc_spare[6];\n};\n#endif /* __BSD_VISIBLE */\n\n#endif /* !_MACHINE_SIGNAL_H_ */\n"
  },
  {
    "path": "freebsd-headers/machine/smp.h",
    "content": "/*-\n * ----------------------------------------------------------------------------\n * \"THE BEER-WARE LICENSE\" (Revision 42):\n * <phk@FreeBSD.org> wrote this file.  As long as you retain this notice you\n * can do whatever you want with this stuff. If we meet some day, and you think\n * this stuff is worth it, you can buy me a beer in return.   Poul-Henning Kamp\n * ----------------------------------------------------------------------------\n *\n * $FreeBSD: release/9.0.0/sys/amd64/include/smp.h 222853 2011-06-08 08:12:15Z avg $\n *\n */\n\n#ifndef _MACHINE_SMP_H_\n#define _MACHINE_SMP_H_\n\n#ifdef _KERNEL\n\n#ifdef SMP\n\n#ifndef LOCORE\n\n#include <sys/bus.h>\n#include <machine/frame.h>\n#include <machine/intr_machdep.h>\n#include <machine/apicvar.h>\n#include <machine/pcb.h>\n\n/* global symbols in mpboot.S */\nextern char\t\t\tmptramp_start[];\nextern char\t\t\tmptramp_end[];\nextern u_int32_t\t\tmptramp_pagetables;\n\n/* global data in mp_machdep.c */\nextern int\t\t\tmp_naps;\nextern int\t\t\tboot_cpu_id;\nextern struct pcb\t\tstoppcbs[];\nextern int\t\t\tcpu_apic_ids[];\n#ifdef COUNT_IPIS\nextern u_long *ipi_invltlb_counts[MAXCPU];\nextern u_long *ipi_invlrng_counts[MAXCPU];\nextern u_long *ipi_invlpg_counts[MAXCPU];\nextern u_long *ipi_invlcache_counts[MAXCPU];\nextern u_long *ipi_rendezvous_counts[MAXCPU];\n#endif\n\n/* IPI handlers */\ninthand_t\n\tIDTVEC(invltlb),\t/* TLB shootdowns - global */\n\tIDTVEC(invlpg),\t\t/* TLB shootdowns - 1 page */\n\tIDTVEC(invlrng),\t/* TLB shootdowns - page range */\n\tIDTVEC(invlcache),\t/* Write back and invalidate cache */\n\tIDTVEC(ipi_intr_bitmap_handler), /* Bitmap based IPIs */ \n\tIDTVEC(cpustop),\t/* CPU stops & waits to be restarted */\n\tIDTVEC(cpususpend),\t/* CPU suspends & waits to be resumed */\n\tIDTVEC(rendezvous);\t/* handle CPU rendezvous */\n\n/* functions in mp_machdep.c */\nvoid\tcpu_add(u_int apic_id, char boot_cpu);\nvoid\tcpustop_handler(void);\nvoid\tcpususpend_handler(void);\nvoid\tinit_secondary(void);\nvoid\tipi_all_but_self(u_int ipi);\nvoid \tipi_bitmap_handler(struct trapframe frame);\nvoid\tipi_cpu(int cpu, u_int ipi);\nint\tipi_nmi_handler(void);\nvoid\tipi_selected(cpuset_t cpus, u_int ipi);\nu_int\tmp_bootaddress(u_int);\nvoid\tsmp_cache_flush(void);\nvoid\tsmp_invlpg(vm_offset_t addr);\nvoid\tsmp_masked_invlpg(cpuset_t mask, vm_offset_t addr);\nvoid\tsmp_invlpg_range(vm_offset_t startva, vm_offset_t endva);\nvoid\tsmp_masked_invlpg_range(cpuset_t mask, vm_offset_t startva,\n\t    vm_offset_t endva);\nvoid\tsmp_invltlb(void);\nvoid\tsmp_masked_invltlb(cpuset_t mask);\n\n#endif /* !LOCORE */\n#endif /* SMP */\n\n#endif /* _KERNEL */\n#endif /* _MACHINE_SMP_H_ */\n"
  },
  {
    "path": "freebsd-headers/machine/specialreg.h",
    "content": "/*-\n * Copyright (c) 1991 The Regents of the University of California.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 4. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\tfrom: @(#)specialreg.h\t7.1 (Berkeley) 5/9/91\n * $FreeBSD: release/9.0.0/sys/amd64/include/specialreg.h 222043 2011-05-17 22:36:16Z jkim $\n */\n\n#ifndef _MACHINE_SPECIALREG_H_\n#define\t_MACHINE_SPECIALREG_H_\n\n/*\n * Bits in 386 special registers:\n */\n#define\tCR0_PE\t0x00000001\t/* Protected mode Enable */\n#define\tCR0_MP\t0x00000002\t/* \"Math\" (fpu) Present */\n#define\tCR0_EM\t0x00000004\t/* EMulate FPU instructions. (trap ESC only) */\n#define\tCR0_TS\t0x00000008\t/* Task Switched (if MP, trap ESC and WAIT) */\n#define\tCR0_PG\t0x80000000\t/* PaGing enable */\n\n/*\n * Bits in 486 special registers:\n */\n#define\tCR0_NE\t0x00000020\t/* Numeric Error enable (EX16 vs IRQ13) */\n#define\tCR0_WP\t0x00010000\t/* Write Protect (honor page protect in\n\t\t\t\t\t\t\t   all modes) */\n#define\tCR0_AM\t0x00040000\t/* Alignment Mask (set to enable AC flag) */\n#define\tCR0_NW  0x20000000\t/* Not Write-through */\n#define\tCR0_CD  0x40000000\t/* Cache Disable */\n\n/*\n * Bits in PPro special registers\n */\n#define\tCR4_VME\t0x00000001\t/* Virtual 8086 mode extensions */\n#define\tCR4_PVI\t0x00000002\t/* Protected-mode virtual interrupts */\n#define\tCR4_TSD\t0x00000004\t/* Time stamp disable */\n#define\tCR4_DE\t0x00000008\t/* Debugging extensions */\n#define\tCR4_PSE\t0x00000010\t/* Page size extensions */\n#define\tCR4_PAE\t0x00000020\t/* Physical address extension */\n#define\tCR4_MCE\t0x00000040\t/* Machine check enable */\n#define\tCR4_PGE\t0x00000080\t/* Page global enable */\n#define\tCR4_PCE\t0x00000100\t/* Performance monitoring counter enable */\n#define\tCR4_FXSR 0x00000200\t/* Fast FPU save/restore used by OS */\n#define\tCR4_XMM\t0x00000400\t/* enable SIMD/MMX2 to use except 16 */\n\n/*\n * Bits in AMD64 special registers.  EFER is 64 bits wide.\n */\n#define\tEFER_SCE 0x000000001\t/* System Call Extensions (R/W) */\n#define\tEFER_LME 0x000000100\t/* Long mode enable (R/W) */\n#define\tEFER_LMA 0x000000400\t/* Long mode active (R) */\n#define\tEFER_NXE 0x000000800\t/* PTE No-Execute bit enable (R/W) */\n\n/*\n * CPUID instruction features register\n */\n#define\tCPUID_FPU\t0x00000001\n#define\tCPUID_VME\t0x00000002\n#define\tCPUID_DE\t0x00000004\n#define\tCPUID_PSE\t0x00000008\n#define\tCPUID_TSC\t0x00000010\n#define\tCPUID_MSR\t0x00000020\n#define\tCPUID_PAE\t0x00000040\n#define\tCPUID_MCE\t0x00000080\n#define\tCPUID_CX8\t0x00000100\n#define\tCPUID_APIC\t0x00000200\n#define\tCPUID_B10\t0x00000400\n#define\tCPUID_SEP\t0x00000800\n#define\tCPUID_MTRR\t0x00001000\n#define\tCPUID_PGE\t0x00002000\n#define\tCPUID_MCA\t0x00004000\n#define\tCPUID_CMOV\t0x00008000\n#define\tCPUID_PAT\t0x00010000\n#define\tCPUID_PSE36\t0x00020000\n#define\tCPUID_PSN\t0x00040000\n#define\tCPUID_CLFSH\t0x00080000\n#define\tCPUID_B20\t0x00100000\n#define\tCPUID_DS\t0x00200000\n#define\tCPUID_ACPI\t0x00400000\n#define\tCPUID_MMX\t0x00800000\n#define\tCPUID_FXSR\t0x01000000\n#define\tCPUID_SSE\t0x02000000\n#define\tCPUID_XMM\t0x02000000\n#define\tCPUID_SSE2\t0x04000000\n#define\tCPUID_SS\t0x08000000\n#define\tCPUID_HTT\t0x10000000\n#define\tCPUID_TM\t0x20000000\n#define\tCPUID_IA64\t0x40000000\n#define\tCPUID_PBE\t0x80000000\n\n#define\tCPUID2_SSE3\t0x00000001\n#define\tCPUID2_PCLMULQDQ 0x00000002\n#define\tCPUID2_DTES64\t0x00000004\n#define\tCPUID2_MON\t0x00000008\n#define\tCPUID2_DS_CPL\t0x00000010\n#define\tCPUID2_VMX\t0x00000020\n#define\tCPUID2_SMX\t0x00000040\n#define\tCPUID2_EST\t0x00000080\n#define\tCPUID2_TM2\t0x00000100\n#define\tCPUID2_SSSE3\t0x00000200\n#define\tCPUID2_CNXTID\t0x00000400\n#define\tCPUID2_FMA\t0x00001000\n#define\tCPUID2_CX16\t0x00002000\n#define\tCPUID2_XTPR\t0x00004000\n#define\tCPUID2_PDCM\t0x00008000\n#define\tCPUID2_PCID\t0x00020000\n#define\tCPUID2_DCA\t0x00040000\n#define\tCPUID2_SSE41\t0x00080000\n#define\tCPUID2_SSE42\t0x00100000\n#define\tCPUID2_X2APIC\t0x00200000\n#define\tCPUID2_MOVBE\t0x00400000\n#define\tCPUID2_POPCNT\t0x00800000\n#define\tCPUID2_TSCDLT\t0x01000000\n#define\tCPUID2_AESNI\t0x02000000\n#define\tCPUID2_XSAVE\t0x04000000\n#define\tCPUID2_OSXSAVE\t0x08000000\n#define\tCPUID2_AVX\t0x10000000\n#define\tCPUID2_F16C\t0x20000000\n#define\tCPUID2_HV\t0x80000000\n\n/*\n * Important bits in the Thermal and Power Management flags\n * CPUID.6 EAX and ECX.\n */\n#define\tCPUTPM1_SENSOR\t0x00000001\n#define\tCPUTPM1_TURBO\t0x00000002\n#define\tCPUTPM1_ARAT\t0x00000004\n#define\tCPUTPM2_EFFREQ\t0x00000001\n\n/*\n * Important bits in the AMD extended cpuid flags\n */\n#define\tAMDID_SYSCALL\t0x00000800\n#define\tAMDID_MP\t0x00080000\n#define\tAMDID_NX\t0x00100000\n#define\tAMDID_EXT_MMX\t0x00400000\n#define\tAMDID_FFXSR\t0x01000000\n#define\tAMDID_PAGE1GB\t0x04000000\n#define\tAMDID_RDTSCP\t0x08000000\n#define\tAMDID_LM\t0x20000000\n#define\tAMDID_EXT_3DNOW\t0x40000000\n#define\tAMDID_3DNOW\t0x80000000\n\n#define\tAMDID2_LAHF\t0x00000001\n#define\tAMDID2_CMP\t0x00000002\n#define\tAMDID2_SVM\t0x00000004\n#define\tAMDID2_EXT_APIC\t0x00000008\n#define\tAMDID2_CR8\t0x00000010\n#define\tAMDID2_ABM\t0x00000020\n#define\tAMDID2_SSE4A\t0x00000040\n#define\tAMDID2_MAS\t0x00000080\n#define\tAMDID2_PREFETCH\t0x00000100\n#define\tAMDID2_OSVW\t0x00000200\n#define\tAMDID2_IBS\t0x00000400\n#define\tAMDID2_XOP\t0x00000800\n#define\tAMDID2_SKINIT\t0x00001000\n#define\tAMDID2_WDT\t0x00002000\n#define\tAMDID2_LWP\t0x00008000\n#define\tAMDID2_FMA4\t0x00010000\n#define\tAMDID2_NODE_ID\t0x00080000\n#define\tAMDID2_TBM\t0x00200000\n#define\tAMDID2_TOPOLOGY\t0x00400000\n\n/*\n * CPUID instruction 1 eax info\n */\n#define\tCPUID_STEPPING\t\t0x0000000f\n#define\tCPUID_MODEL\t\t0x000000f0\n#define\tCPUID_FAMILY\t\t0x00000f00\n#define\tCPUID_EXT_MODEL\t\t0x000f0000\n#define\tCPUID_EXT_FAMILY\t0x0ff00000\n#define\tCPUID_TO_MODEL(id) \\\n    ((((id) & CPUID_MODEL) >> 4) | \\\n    (((id) & CPUID_EXT_MODEL) >> 12))\n#define\tCPUID_TO_FAMILY(id) \\\n    ((((id) & CPUID_FAMILY) >> 8) + \\\n    (((id) & CPUID_EXT_FAMILY) >> 20))\n\n/*\n * CPUID instruction 1 ebx info\n */\n#define\tCPUID_BRAND_INDEX\t0x000000ff\n#define\tCPUID_CLFUSH_SIZE\t0x0000ff00\n#define\tCPUID_HTT_CORES\t\t0x00ff0000\n#define\tCPUID_LOCAL_APIC_ID\t0xff000000\n\n/*\n * CPUID instruction 6 ecx info\n */\n#define\tCPUID_PERF_STAT\t\t0x00000001\n#define\tCPUID_PERF_BIAS\t\t0x00000008\n\n/* \n * CPUID instruction 0xb ebx info.\n */\n#define\tCPUID_TYPE_INVAL\t0\n#define\tCPUID_TYPE_SMT\t\t1\n#define\tCPUID_TYPE_CORE\t\t2\n\n/*\n * AMD extended function 8000_0007h edx info\n */\n#define\tAMDPM_TS\t\t0x00000001\n#define\tAMDPM_FID\t\t0x00000002\n#define\tAMDPM_VID\t\t0x00000004\n#define\tAMDPM_TTP\t\t0x00000008\n#define\tAMDPM_TM\t\t0x00000010\n#define\tAMDPM_STC\t\t0x00000020\n#define\tAMDPM_100MHZ_STEPS\t0x00000040\n#define\tAMDPM_HW_PSTATE\t\t0x00000080\n#define\tAMDPM_TSC_INVARIANT\t0x00000100\n#define\tAMDPM_CPB\t\t0x00000200\n\n/*\n * AMD extended function 8000_0008h ecx info\n */\n#define\tAMDID_CMP_CORES\t\t0x000000ff\n#define\tAMDID_COREID_SIZE\t0x0000f000\n#define\tAMDID_COREID_SIZE_SHIFT\t12\n\n/*\n * CPUID manufacturers identifiers\n */\n#define\tAMD_VENDOR_ID\t\t\"AuthenticAMD\"\n#define\tCENTAUR_VENDOR_ID\t\"CentaurHauls\"\n#define\tINTEL_VENDOR_ID\t\t\"GenuineIntel\"\n\n/*\n * Model-specific registers for the i386 family\n */\n#define\tMSR_P5_MC_ADDR\t\t0x000\n#define\tMSR_P5_MC_TYPE\t\t0x001\n#define\tMSR_TSC\t\t\t0x010\n#define\tMSR_P5_CESR\t\t0x011\n#define\tMSR_P5_CTR0\t\t0x012\n#define\tMSR_P5_CTR1\t\t0x013\n#define\tMSR_IA32_PLATFORM_ID\t0x017\n#define\tMSR_APICBASE\t\t0x01b\n#define\tMSR_EBL_CR_POWERON\t0x02a\n#define\tMSR_TEST_CTL\t\t0x033\n#define\tMSR_BIOS_UPDT_TRIG\t0x079\n#define\tMSR_BBL_CR_D0\t\t0x088\n#define\tMSR_BBL_CR_D1\t\t0x089\n#define\tMSR_BBL_CR_D2\t\t0x08a\n#define\tMSR_BIOS_SIGN\t\t0x08b\n#define\tMSR_PERFCTR0\t\t0x0c1\n#define\tMSR_PERFCTR1\t\t0x0c2\n#define\tMSR_MPERF\t\t0x0e7\n#define\tMSR_APERF\t\t0x0e8\n#define\tMSR_IA32_EXT_CONFIG\t0x0ee\t/* Undocumented. Core Solo/Duo only */\n#define\tMSR_MTRRcap\t\t0x0fe\n#define\tMSR_BBL_CR_ADDR\t\t0x116\n#define\tMSR_BBL_CR_DECC\t\t0x118\n#define\tMSR_BBL_CR_CTL\t\t0x119\n#define\tMSR_BBL_CR_TRIG\t\t0x11a\n#define\tMSR_BBL_CR_BUSY\t\t0x11b\n#define\tMSR_BBL_CR_CTL3\t\t0x11e\n#define\tMSR_SYSENTER_CS_MSR\t0x174\n#define\tMSR_SYSENTER_ESP_MSR\t0x175\n#define\tMSR_SYSENTER_EIP_MSR\t0x176\n#define\tMSR_MCG_CAP\t\t0x179\n#define\tMSR_MCG_STATUS\t\t0x17a\n#define\tMSR_MCG_CTL\t\t0x17b\n#define\tMSR_EVNTSEL0\t\t0x186\n#define\tMSR_EVNTSEL1\t\t0x187\n#define\tMSR_THERM_CONTROL\t0x19a\n#define\tMSR_THERM_INTERRUPT\t0x19b\n#define\tMSR_THERM_STATUS\t0x19c\n#define\tMSR_IA32_MISC_ENABLE\t0x1a0\n#define\tMSR_IA32_TEMPERATURE_TARGET\t0x1a2\n#define\tMSR_DEBUGCTLMSR\t\t0x1d9\n#define\tMSR_LASTBRANCHFROMIP\t0x1db\n#define\tMSR_LASTBRANCHTOIP\t0x1dc\n#define\tMSR_LASTINTFROMIP\t0x1dd\n#define\tMSR_LASTINTTOIP\t\t0x1de\n#define\tMSR_ROB_CR_BKUPTMPDR6\t0x1e0\n#define\tMSR_MTRRVarBase\t\t0x200\n#define\tMSR_MTRR64kBase\t\t0x250\n#define\tMSR_MTRR16kBase\t\t0x258\n#define\tMSR_MTRR4kBase\t\t0x268\n#define\tMSR_PAT\t\t\t0x277\n#define\tMSR_MC0_CTL2\t\t0x280\n#define\tMSR_MTRRdefType\t\t0x2ff\n#define\tMSR_MC0_CTL\t\t0x400\n#define\tMSR_MC0_STATUS\t\t0x401\n#define\tMSR_MC0_ADDR\t\t0x402\n#define\tMSR_MC0_MISC\t\t0x403\n#define\tMSR_MC1_CTL\t\t0x404\n#define\tMSR_MC1_STATUS\t\t0x405\n#define\tMSR_MC1_ADDR\t\t0x406\n#define\tMSR_MC1_MISC\t\t0x407\n#define\tMSR_MC2_CTL\t\t0x408\n#define\tMSR_MC2_STATUS\t\t0x409\n#define\tMSR_MC2_ADDR\t\t0x40a\n#define\tMSR_MC2_MISC\t\t0x40b\n#define\tMSR_MC3_CTL\t\t0x40c\n#define\tMSR_MC3_STATUS\t\t0x40d\n#define\tMSR_MC3_ADDR\t\t0x40e\n#define\tMSR_MC3_MISC\t\t0x40f\n#define\tMSR_MC4_CTL\t\t0x410\n#define\tMSR_MC4_STATUS\t\t0x411\n#define\tMSR_MC4_ADDR\t\t0x412\n#define\tMSR_MC4_MISC\t\t0x413\n\n/*\n * Constants related to MSR's.\n */\n#define\tAPICBASE_RESERVED\t0x000006ff\n#define\tAPICBASE_BSP\t\t0x00000100\n#define\tAPICBASE_ENABLED\t0x00000800\n#define\tAPICBASE_ADDRESS\t0xfffff000\n\n/*\n * PAT modes.\n */\n#define\tPAT_UNCACHEABLE\t\t0x00\n#define\tPAT_WRITE_COMBINING\t0x01\n#define\tPAT_WRITE_THROUGH\t0x04\n#define\tPAT_WRITE_PROTECTED\t0x05\n#define\tPAT_WRITE_BACK\t\t0x06\n#define\tPAT_UNCACHED\t\t0x07\n#define\tPAT_VALUE(i, m)\t\t((long)(m) << (8 * (i)))\n#define\tPAT_MASK(i)\t\tPAT_VALUE(i, 0xff)\n\n/*\n * Constants related to MTRRs\n */\n#define\tMTRR_UNCACHEABLE\t0x00\n#define\tMTRR_WRITE_COMBINING\t0x01\n#define\tMTRR_WRITE_THROUGH\t0x04\n#define\tMTRR_WRITE_PROTECTED\t0x05\n#define\tMTRR_WRITE_BACK\t\t0x06\n#define\tMTRR_N64K\t\t8\t/* numbers of fixed-size entries */\n#define\tMTRR_N16K\t\t16\n#define\tMTRR_N4K\t\t64\n#define\tMTRR_CAP_WC\t\t0x0000000000000400\n#define\tMTRR_CAP_FIXED\t\t0x0000000000000100\n#define\tMTRR_CAP_VCNT\t\t0x00000000000000ff\n#define\tMTRR_DEF_ENABLE\t\t0x0000000000000800\n#define\tMTRR_DEF_FIXED_ENABLE\t0x0000000000000400\n#define\tMTRR_DEF_TYPE\t\t0x00000000000000ff\n#define\tMTRR_PHYSBASE_PHYSBASE\t0x000ffffffffff000\n#define\tMTRR_PHYSBASE_TYPE\t0x00000000000000ff\n#define\tMTRR_PHYSMASK_PHYSMASK\t0x000ffffffffff000\n#define\tMTRR_PHYSMASK_VALID\t0x0000000000000800\n\n/* Performance Control Register (5x86 only). */\n#define\tPCR0\t\t\t0x20\n#define\tPCR0_RSTK\t\t0x01\t/* Enables return stack */\n#define\tPCR0_BTB\t\t0x02\t/* Enables branch target buffer */\n#define\tPCR0_LOOP\t\t0x04\t/* Enables loop */\n#define\tPCR0_AIS\t\t0x08\t/* Enables all instrcutions stalled to\n\t\t\t\t\t\t\t\t   serialize pipe. */\n#define\tPCR0_MLR\t\t0x10\t/* Enables reordering of misaligned loads */\n#define\tPCR0_BTBRT\t\t0x40\t/* Enables BTB test register. */\n#define\tPCR0_LSSER\t\t0x80\t/* Disable reorder */\n\n/* Device Identification Registers */\n#define\tDIR0\t\t\t0xfe\n#define\tDIR1\t\t\t0xff\n\n/*\n * Machine Check register constants.\n */\n#define\tMCG_CAP_COUNT\t\t0x000000ff\n#define\tMCG_CAP_CTL_P\t\t0x00000100\n#define\tMCG_CAP_EXT_P\t\t0x00000200\n#define\tMCG_CAP_CMCI_P\t\t0x00000400\n#define\tMCG_CAP_TES_P\t\t0x00000800\n#define\tMCG_CAP_EXT_CNT\t\t0x00ff0000\n#define\tMCG_CAP_SER_P\t\t0x01000000\n#define\tMCG_STATUS_RIPV\t\t0x00000001\n#define\tMCG_STATUS_EIPV\t\t0x00000002\n#define\tMCG_STATUS_MCIP\t\t0x00000004\n#define\tMCG_CTL_ENABLE\t\t0xffffffffffffffff\n#define\tMCG_CTL_DISABLE\t\t0x0000000000000000\n#define\tMSR_MC_CTL(x)\t\t(MSR_MC0_CTL + (x) * 4)\n#define\tMSR_MC_STATUS(x)\t(MSR_MC0_STATUS + (x) * 4)\n#define\tMSR_MC_ADDR(x)\t\t(MSR_MC0_ADDR + (x) * 4)\n#define\tMSR_MC_MISC(x)\t\t(MSR_MC0_MISC + (x) * 4)\n#define\tMSR_MC_CTL2(x)\t\t(MSR_MC0_CTL2 + (x))\t/* If MCG_CAP_CMCI_P */\n#define\tMC_STATUS_MCA_ERROR\t0x000000000000ffff\n#define\tMC_STATUS_MODEL_ERROR\t0x00000000ffff0000\n#define\tMC_STATUS_OTHER_INFO\t0x01ffffff00000000\n#define\tMC_STATUS_COR_COUNT\t0x001fffc000000000\t/* If MCG_CAP_CMCI_P */\n#define\tMC_STATUS_TES_STATUS\t0x0060000000000000\t/* If MCG_CAP_TES_P */\n#define\tMC_STATUS_AR\t\t0x0080000000000000\t/* If MCG_CAP_TES_P */\n#define\tMC_STATUS_S\t\t0x0100000000000000\t/* If MCG_CAP_TES_P */\n#define\tMC_STATUS_PCC\t\t0x0200000000000000\n#define\tMC_STATUS_ADDRV\t\t0x0400000000000000\n#define\tMC_STATUS_MISCV\t\t0x0800000000000000\n#define\tMC_STATUS_EN\t\t0x1000000000000000\n#define\tMC_STATUS_UC\t\t0x2000000000000000\n#define\tMC_STATUS_OVER\t\t0x4000000000000000\n#define\tMC_STATUS_VAL\t\t0x8000000000000000\n#define\tMC_MISC_RA_LSB\t\t0x000000000000003f\t/* If MCG_CAP_SER_P */\n#define\tMC_MISC_ADDRESS_MODE\t0x00000000000001c0\t/* If MCG_CAP_SER_P */\n#define\tMC_CTL2_THRESHOLD\t0x0000000000007fff\n#define\tMC_CTL2_CMCI_EN\t\t0x0000000040000000\n\n/*\n * The following four 3-byte registers control the non-cacheable regions.\n * These registers must be written as three separate bytes.\n *\n * NCRx+0: A31-A24 of starting address\n * NCRx+1: A23-A16 of starting address\n * NCRx+2: A15-A12 of starting address | NCR_SIZE_xx.\n *\n * The non-cacheable region's starting address must be aligned to the\n * size indicated by the NCR_SIZE_xx field.\n */\n#define\tNCR1\t0xc4\n#define\tNCR2\t0xc7\n#define\tNCR3\t0xca\n#define\tNCR4\t0xcd\n\n#define\tNCR_SIZE_0K\t0\n#define\tNCR_SIZE_4K\t1\n#define\tNCR_SIZE_8K\t2\n#define\tNCR_SIZE_16K\t3\n#define\tNCR_SIZE_32K\t4\n#define\tNCR_SIZE_64K\t5\n#define\tNCR_SIZE_128K\t6\n#define\tNCR_SIZE_256K\t7\n#define\tNCR_SIZE_512K\t8\n#define\tNCR_SIZE_1M\t9\n#define\tNCR_SIZE_2M\t10\n#define\tNCR_SIZE_4M\t11\n#define\tNCR_SIZE_8M\t12\n#define\tNCR_SIZE_16M\t13\n#define\tNCR_SIZE_32M\t14\n#define\tNCR_SIZE_4G\t15\n\n/*\n * The address region registers are used to specify the location and\n * size for the eight address regions.\n *\n * ARRx + 0: A31-A24 of start address\n * ARRx + 1: A23-A16 of start address\n * ARRx + 2: A15-A12 of start address | ARR_SIZE_xx\n */\n#define\tARR0\t0xc4\n#define\tARR1\t0xc7\n#define\tARR2\t0xca\n#define\tARR3\t0xcd\n#define\tARR4\t0xd0\n#define\tARR5\t0xd3\n#define\tARR6\t0xd6\n#define\tARR7\t0xd9\n\n#define\tARR_SIZE_0K\t\t0\n#define\tARR_SIZE_4K\t\t1\n#define\tARR_SIZE_8K\t\t2\n#define\tARR_SIZE_16K\t3\n#define\tARR_SIZE_32K\t4\n#define\tARR_SIZE_64K\t5\n#define\tARR_SIZE_128K\t6\n#define\tARR_SIZE_256K\t7\n#define\tARR_SIZE_512K\t8\n#define\tARR_SIZE_1M\t\t9\n#define\tARR_SIZE_2M\t\t10\n#define\tARR_SIZE_4M\t\t11\n#define\tARR_SIZE_8M\t\t12\n#define\tARR_SIZE_16M\t13\n#define\tARR_SIZE_32M\t14\n#define\tARR_SIZE_4G\t\t15\n\n/*\n * The region control registers specify the attributes associated with\n * the ARRx addres regions.\n */\n#define\tRCR0\t0xdc\n#define\tRCR1\t0xdd\n#define\tRCR2\t0xde\n#define\tRCR3\t0xdf\n#define\tRCR4\t0xe0\n#define\tRCR5\t0xe1\n#define\tRCR6\t0xe2\n#define\tRCR7\t0xe3\n\n#define\tRCR_RCD\t0x01\t/* Disables caching for ARRx (x = 0-6). */\n#define\tRCR_RCE\t0x01\t/* Enables caching for ARR7. */\n#define\tRCR_WWO\t0x02\t/* Weak write ordering. */\n#define\tRCR_WL\t0x04\t/* Weak locking. */\n#define\tRCR_WG\t0x08\t/* Write gathering. */\n#define\tRCR_WT\t0x10\t/* Write-through. */\n#define\tRCR_NLB\t0x20\t/* LBA# pin is not asserted. */\n\n/* AMD Write Allocate Top-Of-Memory and Control Register */\n#define\tAMD_WT_ALLOC_TME\t0x40000\t/* top-of-memory enable */\n#define\tAMD_WT_ALLOC_PRE\t0x20000\t/* programmable range enable */\n#define\tAMD_WT_ALLOC_FRE\t0x10000\t/* fixed (A0000-FFFFF) range enable */\n\n/* AMD64 MSR's */\n#define\tMSR_EFER\t0xc0000080\t/* extended features */\n#define\tMSR_STAR\t0xc0000081\t/* legacy mode SYSCALL target/cs/ss */\n#define\tMSR_LSTAR\t0xc0000082\t/* long mode SYSCALL target rip */\n#define\tMSR_CSTAR\t0xc0000083\t/* compat mode SYSCALL target rip */\n#define\tMSR_SF_MASK\t0xc0000084\t/* syscall flags mask */\n#define\tMSR_FSBASE\t0xc0000100\t/* base address of the %fs \"segment\" */\n#define\tMSR_GSBASE\t0xc0000101\t/* base address of the %gs \"segment\" */\n#define\tMSR_KGSBASE\t0xc0000102\t/* base address of the kernel %gs */\n#define\tMSR_PERFEVSEL0\t0xc0010000\n#define\tMSR_PERFEVSEL1\t0xc0010001\n#define\tMSR_PERFEVSEL2\t0xc0010002\n#define\tMSR_PERFEVSEL3\t0xc0010003\n#undef MSR_PERFCTR0\n#undef MSR_PERFCTR1\n#define\tMSR_PERFCTR0\t0xc0010004\n#define\tMSR_PERFCTR1\t0xc0010005\n#define\tMSR_PERFCTR2\t0xc0010006\n#define\tMSR_PERFCTR3\t0xc0010007\n#define\tMSR_SYSCFG\t0xc0010010\n#define\tMSR_HWCR\t0xc0010015\n#define\tMSR_IORRBASE0\t0xc0010016\n#define\tMSR_IORRMASK0\t0xc0010017\n#define\tMSR_IORRBASE1\t0xc0010018\n#define\tMSR_IORRMASK1\t0xc0010019\n#define\tMSR_TOP_MEM\t0xc001001a\t/* boundary for ram below 4G */\n#define\tMSR_TOP_MEM2\t0xc001001d\t/* boundary for ram above 4G */\n#define\tMSR_K8_UCODE_UPDATE\t0xc0010020\t/* update microcode */\n#define\tMSR_MC0_CTL_MASK\t0xc0010044\n\n/* VIA ACE crypto featureset: for via_feature_rng */\n#define\tVIA_HAS_RNG\t\t1\t/* cpu has RNG */\n\n/* VIA ACE crypto featureset: for via_feature_xcrypt */\n#define\tVIA_HAS_AES\t\t1\t/* cpu has AES */\n#define\tVIA_HAS_SHA\t\t2\t/* cpu has SHA1 & SHA256 */\n#define\tVIA_HAS_MM\t\t4\t/* cpu has RSA instructions */\n#define\tVIA_HAS_AESCTR\t\t8\t/* cpu has AES-CTR instructions */\n\n/* Centaur Extended Feature flags */\n#define\tVIA_CPUID_HAS_RNG\t0x000004\n#define\tVIA_CPUID_DO_RNG\t0x000008\n#define\tVIA_CPUID_HAS_ACE\t0x000040\n#define\tVIA_CPUID_DO_ACE\t0x000080\n#define\tVIA_CPUID_HAS_ACE2\t0x000100\n#define\tVIA_CPUID_DO_ACE2\t0x000200\n#define\tVIA_CPUID_HAS_PHE\t0x000400\n#define\tVIA_CPUID_DO_PHE\t0x000800\n#define\tVIA_CPUID_HAS_PMM\t0x001000\n#define\tVIA_CPUID_DO_PMM\t0x002000\n\n/* VIA ACE xcrypt-* instruction context control options */\n#define\tVIA_CRYPT_CWLO_ROUND_M\t\t0x0000000f\n#define\tVIA_CRYPT_CWLO_ALG_M\t\t0x00000070\n#define\tVIA_CRYPT_CWLO_ALG_AES\t\t0x00000000\n#define\tVIA_CRYPT_CWLO_KEYGEN_M\t\t0x00000080\n#define\tVIA_CRYPT_CWLO_KEYGEN_HW\t0x00000000\n#define\tVIA_CRYPT_CWLO_KEYGEN_SW\t0x00000080\n#define\tVIA_CRYPT_CWLO_NORMAL\t\t0x00000000\n#define\tVIA_CRYPT_CWLO_INTERMEDIATE\t0x00000100\n#define\tVIA_CRYPT_CWLO_ENCRYPT\t\t0x00000000\n#define\tVIA_CRYPT_CWLO_DECRYPT\t\t0x00000200\n#define\tVIA_CRYPT_CWLO_KEY128\t\t0x0000000a\t/* 128bit, 10 rds */\n#define\tVIA_CRYPT_CWLO_KEY192\t\t0x0000040c\t/* 192bit, 12 rds */\n#define\tVIA_CRYPT_CWLO_KEY256\t\t0x0000080e\t/* 256bit, 15 rds */\n\n#endif /* !_MACHINE_SPECIALREG_H_ */\n"
  },
  {
    "path": "freebsd-headers/machine/stack.h",
    "content": "/*-\n * Mach Operating System\n * Copyright (c) 1991,1990 Carnegie Mellon University\n * All Rights Reserved.\n *\n * Permission to use, copy, modify and distribute this software and its\n * documentation is hereby granted, provided that both the copyright\n * notice and this permission notice appear in all copies of the\n * software, derivative works or modified versions, and any portions\n * thereof, and that both notices appear in supporting documentation.\n *\n * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS\n * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR\n * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.\n *\n * Carnegie Mellon requests users of this software to return to\n *\n *  Software Distribution Coordinator  or  Software.Distribution@CS.CMU.EDU\n *  School of Computer Science\n *  Carnegie Mellon University\n *  Pittsburgh PA 15213-3890\n *\n * any improvements or extensions that they make and grant Carnegie the\n * rights to redistribute these changes.\n *\n * $FreeBSD: release/9.0.0/sys/amd64/include/stack.h 179886 2008-06-20 05:22:09Z alc $\n */\n\n#ifndef _MACHINE_STACK_H_\n#define\t_MACHINE_STACK_H_\n\n/*\n * Stack trace.\n */\n#define\tINKERNEL(va) (((va) >= DMAP_MIN_ADDRESS && (va) < DMAP_MAX_ADDRESS) \\\n\t    || ((va) >= VM_MIN_KERNEL_ADDRESS && (va) < VM_MAX_KERNEL_ADDRESS))\n\nstruct amd64_frame {\n\tstruct amd64_frame\t*f_frame;\n\tlong\t\t\tf_retaddr;\n\tlong\t\t\tf_arg0;\n};\n\n#endif /* !_MACHINE_STACK_H_ */\n"
  },
  {
    "path": "freebsd-headers/machine/stdarg.h",
    "content": "/*-\n * Copyright (c) 2002 David E. O'Brien.  All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/amd64/include/stdarg.h 162487 2006-09-21 01:37:02Z kan $\n */\n\n#ifndef _MACHINE_STDARG_H_\n#define\t_MACHINE_STDARG_H_\n\n#include <sys/cdefs.h>\n#include <sys/_types.h>\n\n#ifndef _VA_LIST_DECLARED\n#define\t_VA_LIST_DECLARED\ntypedef\t__va_list\tva_list;\n#endif\n\n#ifdef __GNUCLIKE_BUILTIN_STDARG\n\n#define\tva_start(ap, last) \\\n\t__builtin_va_start((ap), (last))\n\n#define\tva_arg(ap, type) \\\n\t__builtin_va_arg((ap), type)\n\n#define\t__va_copy(dest, src) \\\n\t__builtin_va_copy((dest), (src))\n\n#if __ISO_C_VISIBLE >= 1999\n#define\tva_copy(dest, src) \\\n\t__va_copy(dest, src)\n#endif\n\n#define\tva_end(ap) \\\n\t__builtin_va_end(ap)\n\n#elif defined(lint)\n/* Provide a fake implementation for lint's benefit */\n#define\t__va_size(type) \\\n\t(((sizeof(type) + sizeof(long) - 1) / sizeof(long)) * sizeof(long))\n#define\tva_start(ap, last) \\\n\t((ap) = (va_list)&(last) + __va_size(last))\n#define\tva_arg(ap, type) \\\n\t(*(type *)((ap) += __va_size(type), (ap) - __va_size(type)))\n#define\tva_end(ap)\n\n#else\n#error this file needs to be ported to your compiler\n#endif\n\n#endif /* !_MACHINE_STDARG_H_ */\n"
  },
  {
    "path": "freebsd-headers/machine/sysarch.h",
    "content": "/*-\n * Copyright (c) 1993 The Regents of the University of California.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 4. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/amd64/include/sysarch.h 204120 2010-02-20 14:13:47Z ed $\n */\n\n/*\n * Architecture specific syscalls (AMD64)\n */\n#ifndef _MACHINE_SYSARCH_H_\n#define _MACHINE_SYSARCH_H_\n\n#include <sys/cdefs.h>\n\n#define I386_GET_LDT\t0\n#define I386_SET_LDT\t1\n#define\tLDT_AUTO_ALLOC\t0xffffffff\n\t\t\t\t/* I386_IOPL */\n#define I386_GET_IOPERM\t3\n#define I386_SET_IOPERM\t4\n\n/* XXX Not implementable #define I386_VM86\t6 */\n\n#define\tI386_GET_FSBASE\t\t7\n#define\tI386_SET_FSBASE\t\t8\n#define\tI386_GET_GSBASE\t\t9\n#define\tI386_SET_GSBASE\t\t10\n\n/* Leave space for 0-127 for to avoid translating syscalls */\n#define\tAMD64_GET_FSBASE\t128\n#define\tAMD64_SET_FSBASE\t129\n#define\tAMD64_GET_GSBASE\t130\n#define\tAMD64_SET_GSBASE\t131\n\nstruct i386_ldt_args {\n\tunsigned int start;\n\tstruct user_segment_descriptor *descs __packed;\n\tunsigned int num;\n};\n\nstruct i386_ioperm_args {\n\tunsigned int start;\n\tunsigned int length;\n\tint\tenable;\n};\n\n#ifndef _KERNEL\n__BEGIN_DECLS\nint amd64_get_fsbase(void **);\nint amd64_get_gsbase(void **);\nint amd64_set_fsbase(void *);\nint amd64_set_gsbase(void *);\nint sysarch(int, void *);\n__END_DECLS\n#else\nstruct thread;\nunion descriptor;\n\nint amd64_get_ldt(struct thread *, struct i386_ldt_args *);\nint amd64_set_ldt(struct thread *, struct i386_ldt_args *,\n    struct user_segment_descriptor *);\nint amd64_get_ioperm(struct thread *, struct i386_ioperm_args *);\nint amd64_set_ioperm(struct thread *, struct i386_ioperm_args *);\n#endif\n\n#endif /* !_MACHINE_SYSARCH_H_ */\n"
  },
  {
    "path": "freebsd-headers/machine/timerreg.h",
    "content": "/*-\n * Copyright (C) 2005 TAKAHASHI Yoshihiro. All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/amd64/include/timerreg.h 177642 2008-03-26 20:09:21Z phk $\n */\n\n/*\n * The outputs of the three timers are connected as follows:\n *\n *\t timer 0 -> irq 0\n *\t timer 1 -> dma chan 0 (for dram refresh)\n * \t timer 2 -> speaker (via keyboard controller)\n *\n * Timer 0 is used to call hardclock.\n * Timer 2 is used to generate console beeps.\n */\n\n#ifndef _MACHINE_TIMERREG_H_\n#define _MACHINE_TIMERREG_H_\n\n#ifdef _KERNEL\n\n#include <dev/ic/i8253reg.h>\n\n#define\tIO_TIMER1\t0x40\t\t/* 8253 Timer #1 */\n#define\tTIMER_CNTR0\t(IO_TIMER1 + TIMER_REG_CNTR0)\n#define\tTIMER_CNTR1\t(IO_TIMER1 + TIMER_REG_CNTR1)\n#define\tTIMER_CNTR2\t(IO_TIMER1 + TIMER_REG_CNTR2)\n#define\tTIMER_MODE\t(IO_TIMER1 + TIMER_REG_MODE)\n\n#endif /* _KERNEL */\n\n#endif /* _MACHINE_TIMERREG_H_ */\n"
  },
  {
    "path": "freebsd-headers/machine/trap.h",
    "content": "/*-\n * Copyright (c) 1990 The Regents of the University of California.\n * All rights reserved.\n *\n * This code is derived from software contributed to Berkeley by\n * William Jolitz.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 4. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\tfrom: @(#)trap.h\t5.4 (Berkeley) 5/9/91\n * $FreeBSD: release/9.0.0/sys/amd64/include/trap.h 227946 2011-11-24 18:44:14Z rstone $\n */\n\n#ifndef _MACHINE_TRAP_H_\n#define\t_MACHINE_TRAP_H_\n\n/*\n * Trap type values\n * also known in trap.c for name strings\n */\n\n#define\tT_PRIVINFLT\t1\t/* privileged instruction */\n#define\tT_BPTFLT\t3\t/* breakpoint instruction */\n#define\tT_ARITHTRAP\t6\t/* arithmetic trap */\n#define\tT_PROTFLT\t9\t/* protection fault */\n#define\tT_TRCTRAP\t10\t/* debug exception (sic) */\n#define\tT_PAGEFLT\t12\t/* page fault */\n#define\tT_ALIGNFLT\t14\t/* alignment fault */\n\n#define\tT_DIVIDE\t18\t/* integer divide fault */\n#define\tT_NMI\t\t19\t/* non-maskable trap */\n#define\tT_OFLOW\t\t20\t/* overflow trap */\n#define\tT_BOUND\t\t21\t/* bound instruction fault */\n#define\tT_DNA\t\t22\t/* device not available fault */\n#define\tT_DOUBLEFLT\t23\t/* double fault */\n#define\tT_FPOPFLT\t24\t/* fp coprocessor operand fetch fault */\n#define\tT_TSSFLT\t25\t/* invalid tss fault */\n#define\tT_SEGNPFLT\t26\t/* segment not present fault */\n#define\tT_STKFLT\t27\t/* stack fault */\n#define\tT_MCHK\t\t28\t/* machine check trap */\n#define\tT_XMMFLT\t29\t/* SIMD floating-point exception */\n#define\tT_RESERVED\t30\t/* reserved (unknown) */\n#define\tT_DTRACE_RET\t32\t/* DTrace pid return */\n#define\tT_DTRACE_PROBE\t33\t/* DTrace fasttrap probe */\n\n/* XXX most of the following codes aren't used, but could be. */\n\n/* definitions for <sys/signal.h> */\n#define\t    ILL_RESAD_FAULT\tT_RESADFLT\n#define\t    ILL_PRIVIN_FAULT\tT_PRIVINFLT\n#define\t    ILL_RESOP_FAULT\tT_RESOPFLT\n#define\t    ILL_ALIGN_FAULT\tT_ALIGNFLT\n#define\t    ILL_FPOP_FAULT\tT_FPOPFLT\t/* coprocessor operand fault */\n\n/* old FreeBSD macros, deprecated */\n#define\tFPE_INTOVF_TRAP\t0x1\t/* integer overflow */\n#define\tFPE_INTDIV_TRAP\t0x2\t/* integer divide by zero */\n#define\tFPE_FLTDIV_TRAP\t0x3\t/* floating/decimal divide by zero */\n#define\tFPE_FLTOVF_TRAP\t0x4\t/* floating overflow */\n#define\tFPE_FLTUND_TRAP\t0x5\t/* floating underflow */\n#define\tFPE_FPU_NP_TRAP\t0x6\t/* floating point unit not present  */\n#define\tFPE_SUBRNG_TRAP\t0x7\t/* subrange out of bounds */\n\n/* codes for SIGBUS */\n#define\t    BUS_PAGE_FAULT\tT_PAGEFLT\t/* page fault protection base */\n#define\t    BUS_SEGNP_FAULT\tT_SEGNPFLT\t/* segment not present */\n#define\t    BUS_STK_FAULT\tT_STKFLT\t/* stack segment */\n#define\t    BUS_SEGM_FAULT\tT_RESERVED\t/* segment protection base */\n\n/* Trap's coming from user mode */\n#define\tT_USER\t0x100\n\n#endif /* !_MACHINE_TRAP_H_ */\n"
  },
  {
    "path": "freebsd-headers/machine/tss.h",
    "content": "/*-\n * Copyright (c) 1990 The Regents of the University of California.\n * All rights reserved.\n *\n * This code is derived from software contributed to Berkeley by\n * William Jolitz.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 4. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\tfrom: @(#)tss.h\t5.4 (Berkeley) 1/18/91\n * $FreeBSD: release/9.0.0/sys/amd64/include/tss.h 145120 2005-04-15 18:39:31Z peter $\n */\n\n#ifndef _MACHINE_TSS_H_\n#define _MACHINE_TSS_H_ 1\n\n/*\n * amd64 Context Data Type\n *\n * The alignment is pretty messed up here due to reuse of the original 32 bit\n * fields.  It might be worth trying to set the tss on a +4 byte offset to\n * make the 64 bit fields aligned in practice.\n */\nstruct amd64tss {\n\tu_int32_t\ttss_rsvd0;\n\tu_int64_t\ttss_rsp0 __packed; \t/* kernel stack pointer ring 0 */\n\tu_int64_t\ttss_rsp1 __packed; \t/* kernel stack pointer ring 1 */\n\tu_int64_t\ttss_rsp2 __packed; \t/* kernel stack pointer ring 2 */\n\tu_int32_t\ttss_rsvd1;\n\tu_int32_t\ttss_rsvd2;\n\tu_int64_t\ttss_ist1 __packed;\t/* Interrupt stack table 1 */\n\tu_int64_t\ttss_ist2 __packed;\t/* Interrupt stack table 2 */\n\tu_int64_t\ttss_ist3 __packed;\t/* Interrupt stack table 3 */\n\tu_int64_t\ttss_ist4 __packed;\t/* Interrupt stack table 4 */\n\tu_int64_t\ttss_ist5 __packed;\t/* Interrupt stack table 5 */\n\tu_int64_t\ttss_ist6 __packed;\t/* Interrupt stack table 6 */\n\tu_int64_t\ttss_ist7 __packed;\t/* Interrupt stack table 7 */\n\tu_int32_t\ttss_rsvd3;\n\tu_int32_t\ttss_rsvd4;\n\tu_int16_t\ttss_rsvd5;\n\tu_int16_t\ttss_iobase;\t/* io bitmap offset */\n};\n\n#ifdef _KERNEL\nextern struct amd64tss common_tss[];\n#endif\n\n#endif /* _MACHINE_TSS_H_ */\n"
  },
  {
    "path": "freebsd-headers/machine/ucontext.h",
    "content": "/*-\n * Copyright (c) 2003 Peter Wemm\n * Copyright (c) 1999 Marcel Moolenaar\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer \n *    in this position and unchanged.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. The name of the author may not be used to endorse or promote products\n *    derived from this software without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR\n * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES\n * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,\n * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF\n * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/amd64/include/ucontext.h 190616 2009-04-01 12:44:17Z kib $\n */\n\n#ifndef _MACHINE_UCONTEXT_H_\n#define\t_MACHINE_UCONTEXT_H_\n\n/*\n * mc_trapno bits. Shall be in sync with TF_XXX.\n */\n#define\t_MC_HASSEGS\t0x1\n#define\t_MC_HASBASES\t0x2\n#define\t_MC_FLAG_MASK\t(_MC_HASSEGS | _MC_HASBASES)\n\ntypedef struct __mcontext {\n\t/*\n\t * The first 24 fields must match the definition of\n\t * sigcontext. So that we can support sigcontext\n\t * and ucontext_t at the same time.\n\t */\n\t__register_t\tmc_onstack;\t\t/* XXX - sigcontext compat. */\n\t__register_t\tmc_rdi;\t\t\t/* machine state (struct trapframe) */\n\t__register_t\tmc_rsi;\n\t__register_t\tmc_rdx;\n\t__register_t\tmc_rcx;\n\t__register_t\tmc_r8;\n\t__register_t\tmc_r9;\n\t__register_t\tmc_rax;\n\t__register_t\tmc_rbx;\n\t__register_t\tmc_rbp;\n\t__register_t\tmc_r10;\n\t__register_t\tmc_r11;\n\t__register_t\tmc_r12;\n\t__register_t\tmc_r13;\n\t__register_t\tmc_r14;\n\t__register_t\tmc_r15;\n\t__uint32_t\tmc_trapno;\n\t__uint16_t\tmc_fs;\n\t__uint16_t\tmc_gs;\n\t__register_t\tmc_addr;\n\t__uint32_t\tmc_flags;\n\t__uint16_t\tmc_es;\n\t__uint16_t\tmc_ds;\n\t__register_t\tmc_err;\n\t__register_t\tmc_rip;\n\t__register_t\tmc_cs;\n\t__register_t\tmc_rflags;\n\t__register_t\tmc_rsp;\n\t__register_t\tmc_ss;\n\n\tlong\tmc_len;\t\t\t/* sizeof(mcontext_t) */\n\n#define\t_MC_FPFMT_NODEV\t\t0x10000\t/* device not present or configured */\n#define\t_MC_FPFMT_XMM\t\t0x10002\n\tlong\tmc_fpformat;\n#define\t_MC_FPOWNED_NONE\t0x20000\t/* FP state not used */\n#define\t_MC_FPOWNED_FPU\t\t0x20001\t/* FP state came from FPU */\n#define\t_MC_FPOWNED_PCB\t\t0x20002\t/* FP state came from PCB */\n\tlong\tmc_ownedfp;\n\t/*\n\t * See <machine/fpu.h> for the internals of mc_fpstate[].\n\t */\n\tlong\tmc_fpstate[64] __aligned(16);\n\n\t__register_t\tmc_fsbase;\n\t__register_t\tmc_gsbase;\n\n\tlong\tmc_spare[6];\n} mcontext_t;\n\n#endif /* !_MACHINE_UCONTEXT_H_ */\n"
  },
  {
    "path": "freebsd-headers/machine/varargs.h",
    "content": "/*-\n * Copyright (c) 2002 David E. O'Brien.  All rights reserved.\n * Copyright (c) 1990, 1993\n *\tThe Regents of the University of California.  All rights reserved.\n * (c) UNIX System Laboratories, Inc.\n * All or some portions of this file are derived from material licensed\n * to the University of California by American Telephone and Telegraph\n * Co. or Unix System Laboratories, Inc. and are reproduced herein with\n * the permission of UNIX System Laboratories, Inc.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. All advertising materials mentioning features or use of this software\n *    must display the following acknowledgement:\n *\tThis product includes software developed by the University of\n *\tCalifornia, Berkeley and its contributors.\n * 4. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t@(#)varargs.h\t8.2 (Berkeley) 3/22/94\n * $FreeBSD: release/9.0.0/sys/amd64/include/varargs.h 143434 2005-03-11 22:16:09Z peter $\n */\n\n#ifndef _MACHINE_VARARGS_H_\n#define\t_MACHINE_VARARGS_H_\n\n#ifndef _SYS_CDEFS_H_\n#error this file needs sys/cdefs.h as a prerequisite\n#endif\n\n#ifdef __GNUCLIKE_BUILTIN_VARARGS\n\n#include <sys/_types.h>\n\n#ifndef _VA_LIST_DECLARED\n#define\t_VA_LIST_DECLARED\ntypedef\t__va_list\tva_list;\n#endif\n\ntypedef int __builtin_va_alist_t __attribute__((__mode__(__word__)));\n\n#define\tva_alist\t\t__builtin_va_alist\n#define\tva_dcl\t\t\t__builtin_va_alist_t __builtin_va_alist; ...\n#define\tva_start(ap)\t\t__builtin_varargs_start(ap)\n#define\tva_arg(ap, type)\t__builtin_va_arg((ap), type)\n#define\tva_end(ap)\t\t__builtin_va_end(ap)\n\n#else\t/* !__GNUCLIKE_BUILTIN_VARARGS */\n\ntypedef char *va_list;\n\n#define\t__va_size(type) \\\n\t(((sizeof(type) + sizeof(int) - 1) / sizeof(int)) * sizeof(int))\n\n#if defined(__GNUCLIKE_BUILTIN_VAALIST)\n#define\tva_alist\t__builtin_va_alist\n#endif\n#define\tva_dcl\tint va_alist; ...\n\n#define\tva_start(ap) \\\n\t((ap) = (va_list)&va_alist)\n\n#define\tva_arg(ap, type) \\\n\t(*(type *)((ap) += __va_size(type), (ap) - __va_size(type)))\n\n#define\tva_end(ap)\n\n#endif /* __GNUCLIKE_BUILTIN_VARARGS */\n\n#endif /* !_MACHINE_VARARGS_H_ */\n"
  },
  {
    "path": "freebsd-headers/machine/vm.h",
    "content": "/*-\n * Copyright (c) 2009 Advanced Computing Technologies LLC\n * Written by: John H. Baldwin <jhb@FreeBSD.org>\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/amd64/include/vm.h 195649 2009-07-12 23:31:20Z alc $\n */\n\n#ifndef _MACHINE_VM_H_\n#define\t_MACHINE_VM_H_\n\n#include <machine/specialreg.h>\n\n/* Memory attributes. */\n#define\tVM_MEMATTR_UNCACHEABLE\t\t((vm_memattr_t)PAT_UNCACHEABLE)\n#define\tVM_MEMATTR_WRITE_COMBINING\t((vm_memattr_t)PAT_WRITE_COMBINING)\n#define\tVM_MEMATTR_WRITE_THROUGH\t((vm_memattr_t)PAT_WRITE_THROUGH)\n#define\tVM_MEMATTR_WRITE_PROTECTED\t((vm_memattr_t)PAT_WRITE_PROTECTED)\n#define\tVM_MEMATTR_WRITE_BACK\t\t((vm_memattr_t)PAT_WRITE_BACK)\n#define\tVM_MEMATTR_UNCACHED\t\t((vm_memattr_t)PAT_UNCACHED)\n\n#define\tVM_MEMATTR_DEFAULT\t\tVM_MEMATTR_WRITE_BACK\n\n#endif /* !_MACHINE_VM_H_ */\n"
  },
  {
    "path": "freebsd-headers/machine/vmparam.h",
    "content": "/*-\n * Copyright (c) 1990 The Regents of the University of California.\n * All rights reserved.\n * Copyright (c) 1994 John S. Dyson\n * All rights reserved.\n * Copyright (c) 2003 Peter Wemm\n * All rights reserved.\n *\n * This code is derived from software contributed to Berkeley by\n * William Jolitz.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. All advertising materials mentioning features or use of this software\n *    must display the following acknowledgement:\n *\tThis product includes software developed by the University of\n *\tCalifornia, Berkeley and its contributors.\n * 4. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\tfrom: @(#)vmparam.h\t5.9 (Berkeley) 5/12/91\n * $FreeBSD: release/9.0.0/sys/amd64/include/vmparam.h 221855 2011-05-13 19:35:01Z mdf $\n */\n\n\n#ifndef _MACHINE_VMPARAM_H_\n#define\t_MACHINE_VMPARAM_H_ 1\n\n/*\n * Machine dependent constants for AMD64.\n */\n\n/*\n * Virtual memory related constants, all in bytes\n */\n#define\tMAXTSIZ\t\t(128UL*1024*1024)\t/* max text size */\n#ifndef DFLDSIZ\n#define\tDFLDSIZ\t\t(128UL*1024*1024)\t/* initial data size limit */\n#endif\n#ifndef MAXDSIZ\n#define\tMAXDSIZ\t\t(32768UL*1024*1024)\t/* max data size */\n#endif\n#ifndef\tDFLSSIZ\n#define\tDFLSSIZ\t\t(8UL*1024*1024)\t\t/* initial stack size limit */\n#endif\n#ifndef\tMAXSSIZ\n#define\tMAXSSIZ\t\t(512UL*1024*1024)\t/* max stack size */\n#endif\n#ifndef SGROWSIZ\n#define\tSGROWSIZ\t(128UL*1024)\t\t/* amount to grow stack */\n#endif\n\n/*\n * We provide a machine specific single page allocator through the use\n * of the direct mapped segment.  This uses 2MB pages for reduced\n * TLB pressure.\n */\n#define\tUMA_MD_SMALL_ALLOC\n\n/*\n * The physical address space is densely populated.\n */\n#define\tVM_PHYSSEG_DENSE\n\n/*\n * The number of PHYSSEG entries must be one greater than the number\n * of phys_avail entries because the phys_avail entry that spans the\n * largest physical address that is accessible by ISA DMA is split\n * into two PHYSSEG entries. \n */\n#define\tVM_PHYSSEG_MAX\t\t31\n\n/*\n * Create three free page pools: VM_FREEPOOL_DEFAULT is the default pool\n * from which physical pages are allocated and VM_FREEPOOL_DIRECT is\n * the pool from which physical pages for page tables and small UMA\n * objects are allocated.\n */\n#define\tVM_NFREEPOOL\t\t3\n#define\tVM_FREEPOOL_CACHE\t2\n#define\tVM_FREEPOOL_DEFAULT\t0\n#define\tVM_FREEPOOL_DIRECT\t1\n\n/*\n * Create two free page lists: VM_FREELIST_DEFAULT is for physical\n * pages that are above the largest physical address that is\n * accessible by ISA DMA and VM_FREELIST_ISADMA is for physical pages\n * that are below that address.\n */\n#define\tVM_NFREELIST\t\t2\n#define\tVM_FREELIST_DEFAULT\t0\n#define\tVM_FREELIST_ISADMA\t1\n\n/*\n * An allocation size of 16MB is supported in order to optimize the\n * use of the direct map by UMA.  Specifically, a cache line contains\n * at most 8 PDEs, collectively mapping 16MB of physical memory.  By\n * reducing the number of distinct 16MB \"pages\" that are used by UMA,\n * the physical memory allocator reduces the likelihood of both 2MB\n * page TLB misses and cache misses caused by 2MB page TLB misses.\n */\n#define\tVM_NFREEORDER\t\t13\n\n/*\n * Only one memory domain.\n */\n#ifndef VM_NDOMAIN\n#define\tVM_NDOMAIN\t\t1\n#endif\n\n/*\n * Enable superpage reservations: 1 level.\n */\n#ifndef\tVM_NRESERVLEVEL\n#define\tVM_NRESERVLEVEL\t\t1\n#endif\n\n/*\n * Level 0 reservations consist of 512 pages.\n */\n#ifndef\tVM_LEVEL_0_ORDER\n#define\tVM_LEVEL_0_ORDER\t9\n#endif\n\n#ifdef\tSMP\n#define\tPA_LOCK_COUNT\t256\n#endif\n\n/*\n * Virtual addresses of things.  Derived from the page directory and\n * page table indexes from pmap.h for precision.\n *\n * 0x0000000000000000 - 0x00007fffffffffff   user map\n * 0x0000800000000000 - 0xffff7fffffffffff   does not exist (hole)\n * 0xffff800000000000 - 0xffff804020100fff   recursive page table (512GB slot)\n * 0xffff804020101000 - 0xfffffdffffffffff   unused\n * 0xfffffe0000000000 - 0xfffffeffffffffff   1TB direct map\n * 0xffffff0000000000 - 0xffffff7fffffffff   unused\n * 0xffffff8000000000 - 0xffffffffffffffff   512GB kernel map\n *\n * Within the kernel map:\n *\n * 0xffffffff80000000                        KERNBASE\n */\n\n#define\tVM_MAX_KERNEL_ADDRESS\tKVADDR(KPML4I, NPDPEPG-1, NPDEPG-1, NPTEPG-1)\n#define\tVM_MIN_KERNEL_ADDRESS\tKVADDR(KPML4I, NPDPEPG-512, 0, 0)\n\n#define\tDMAP_MIN_ADDRESS\tKVADDR(DMPML4I, 0, 0, 0)\n#define\tDMAP_MAX_ADDRESS\tKVADDR(DMPML4I + NDMPML4E, 0, 0, 0)\n\n#define\tKERNBASE\t\tKVADDR(KPML4I, KPDPI, 0, 0)\n\n#define\tUPT_MAX_ADDRESS\t\tKVADDR(PML4PML4I, PML4PML4I, PML4PML4I, PML4PML4I)\n#define\tUPT_MIN_ADDRESS\t\tKVADDR(PML4PML4I, 0, 0, 0)\n\n#define\tVM_MAXUSER_ADDRESS\tUVADDR(NUPML4E, 0, 0, 0)\n\n#define\tSHAREDPAGE\t\t(VM_MAXUSER_ADDRESS - PAGE_SIZE)\n#define\tUSRSTACK\t\tSHAREDPAGE\n\n#define\tVM_MAX_ADDRESS\t\tUPT_MAX_ADDRESS\n#define\tVM_MIN_ADDRESS\t\t(0)\n\n#define\tPHYS_TO_DMAP(x)\t\t((x) | DMAP_MIN_ADDRESS)\n#define\tDMAP_TO_PHYS(x)\t\t((x) & ~DMAP_MIN_ADDRESS)\n\n/* virtual sizes (bytes) for various kernel submaps */\n#ifndef VM_KMEM_SIZE\n#define\tVM_KMEM_SIZE\t\t(12 * 1024 * 1024)\n#endif\n\n/*\n * How many physical pages per KVA page allocated.\n * min(max(max(VM_KMEM_SIZE, Physical memory/VM_KMEM_SIZE_SCALE),\n *     VM_KMEM_SIZE_MIN), VM_KMEM_SIZE_MAX)\n * is the total KVA space allocated for kmem_map.\n */\n#ifndef VM_KMEM_SIZE_SCALE\n#define\tVM_KMEM_SIZE_SCALE\t(1)\n#endif\n\n/*\n * Ceiling on amount of kmem_map kva space.\n */\n#ifndef VM_KMEM_SIZE_MAX\n#define\tVM_KMEM_SIZE_MAX\t((VM_MAX_KERNEL_ADDRESS - \\\n    VM_MIN_KERNEL_ADDRESS + 1) * 3 / 5)\n#endif\n\n/* initial pagein size of beginning of executable file */\n#ifndef VM_INITIAL_PAGEIN\n#define\tVM_INITIAL_PAGEIN\t16\n#endif\n\n#define\tZERO_REGION_SIZE\t(2 * 1024 * 1024)\t/* 2MB */\n\n#endif /* _MACHINE_VMPARAM_H_ */\n"
  },
  {
    "path": "freebsd-headers/magic.h",
    "content": "/*\n * Copyright (c) Christos Zoulas 2003.\n * All Rights Reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice immediately at the beginning of the file, without modification,\n *    this list of conditions, and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR\n * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n */\n#ifndef _MAGIC_H\n#define _MAGIC_H\n\n#include <sys/types.h>\n\n#define\tMAGIC_NONE\t\t0x000000 /* No flags */\n#define\tMAGIC_DEBUG\t\t0x000001 /* Turn on debugging */\n#define\tMAGIC_SYMLINK\t\t0x000002 /* Follow symlinks */\n#define\tMAGIC_COMPRESS\t\t0x000004 /* Check inside compressed files */\n#define\tMAGIC_DEVICES\t\t0x000008 /* Look at the contents of devices */\n#define\tMAGIC_MIME_TYPE\t\t0x000010 /* Return the MIME type */\n#define\tMAGIC_CONTINUE\t\t0x000020 /* Return all matches */\n#define\tMAGIC_CHECK\t\t0x000040 /* Print warnings to stderr */\n#define\tMAGIC_PRESERVE_ATIME\t0x000080 /* Restore access time on exit */\n#define\tMAGIC_RAW\t\t0x000100 /* Don't translate unprintable chars */\n#define\tMAGIC_ERROR\t\t0x000200 /* Handle ENOENT etc as real errors */\n#define\tMAGIC_MIME_ENCODING\t0x000400 /* Return the MIME encoding */\n#define MAGIC_MIME\t\t(MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)\n#define\tMAGIC_APPLE\t\t0x000800 /* Return the Apple creator and type */\n#define\tMAGIC_NO_CHECK_COMPRESS\t0x001000 /* Don't check for compressed files */\n#define\tMAGIC_NO_CHECK_TAR\t0x002000 /* Don't check for tar files */\n#define\tMAGIC_NO_CHECK_SOFT\t0x004000 /* Don't check magic entries */\n#define\tMAGIC_NO_CHECK_APPTYPE\t0x008000 /* Don't check application type */\n#define\tMAGIC_NO_CHECK_ELF\t0x010000 /* Don't check for elf details */\n#define\tMAGIC_NO_CHECK_TEXT\t0x020000 /* Don't check for text files */\n#define\tMAGIC_NO_CHECK_CDF\t0x040000 /* Don't check for cdf files */\n#define\tMAGIC_NO_CHECK_TOKENS\t0x100000 /* Don't check tokens */\n#define MAGIC_NO_CHECK_ENCODING 0x200000 /* Don't check text encodings */\n\n/* Defined for backwards compatibility (renamed) */\n#define\tMAGIC_NO_CHECK_ASCII\tMAGIC_NO_CHECK_TEXT\n\n/* Defined for backwards compatibility; do nothing */\n#define\tMAGIC_NO_CHECK_FORTRAN\t0x000000 /* Don't check ascii/fortran */\n#define\tMAGIC_NO_CHECK_TROFF\t0x000000 /* Don't check ascii/troff */\n\n\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\ntypedef struct magic_set *magic_t;\nmagic_t magic_open(int);\nvoid magic_close(magic_t);\n\nconst char *magic_file(magic_t, const char *);\nconst char *magic_descriptor(magic_t, int);\nconst char *magic_buffer(magic_t, const void *, size_t);\n\nconst char *magic_error(magic_t);\nint magic_setflags(magic_t, int);\n\nint magic_load(magic_t, const char *);\nint magic_compile(magic_t, const char *);\nint magic_check(magic_t, const char *);\nint magic_errno(magic_t);\n\n#ifdef __cplusplus\n};\n#endif\n\n#endif /* _MAGIC_H */\n"
  },
  {
    "path": "freebsd-headers/malloc.h",
    "content": "/* $FreeBSD: release/9.0.0/include/malloc.h 86178 2001-11-07 23:14:31Z obrien $ */\n#if __STDC__\n#error \"<malloc.h> has been replaced by <stdlib.h>\"\n#else\n#include <stdlib.h>\n#endif\n"
  },
  {
    "path": "freebsd-headers/malloc_np.h",
    "content": "/*-\n * Copyright (C) 2006 Jason Evans <jasone@FreeBSD.org>.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice(s), this list of conditions and the following disclaimer as\n *    the first lines of this file unmodified other than the possible\n *    addition of one or more copyright notices.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice(s), this list of conditions and the following disclaimer in\n *    the documentation and/or other materials provided with the\n *    distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\n * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE\n * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\n * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\n * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR\n * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE\n * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,\n * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/include/malloc_np.h 160056 2006-06-30 20:57:41Z jasone $\n */\n\n#ifndef _MALLOC_NP_H_\n#define\t_MALLOC_NP_H_\n#include <sys/cdefs.h>\n#include <sys/types.h>\n\n__BEGIN_DECLS\nsize_t\tmalloc_usable_size(const void *ptr);\n__END_DECLS\n\n#endif /* _MALLOC_NP_H_ */\n"
  },
  {
    "path": "freebsd-headers/math.h",
    "content": "/*\n * ====================================================\n * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.\n *\n * Developed at SunPro, a Sun Microsystems, Inc. business.\n * Permission to use, copy, modify, and distribute this\n * software is freely granted, provided that this notice\n * is preserved.\n * ====================================================\n */\n\n/*\n * from: @(#)fdlibm.h 5.1 93/09/24\n * $FreeBSD: release/9.0.0/lib/msun/src/math.h 219571 2011-03-12 16:50:39Z kargl $\n */\n\n#ifndef _MATH_H_\n#define\t_MATH_H_\n\n#include <sys/cdefs.h>\n#include <sys/_types.h>\n#include <machine/_limits.h>\n\n/*\n * ANSI/POSIX\n */\nextern const union __infinity_un {\n\tunsigned char\t__uc[8];\n\tdouble\t\t__ud;\n} __infinity;\n\nextern const union __nan_un {\n\tunsigned char\t__uc[sizeof(float)];\n\tfloat\t\t__uf;\n} __nan;\n\n#if __GNUC_PREREQ__(3, 3) || (defined(__INTEL_COMPILER) && __INTEL_COMPILER >= 800)\n#define\t__MATH_BUILTIN_CONSTANTS\n#endif\n\n#if __GNUC_PREREQ__(3, 0) && !defined(__INTEL_COMPILER)\n#define\t__MATH_BUILTIN_RELOPS\n#endif\n\n#ifdef __MATH_BUILTIN_CONSTANTS\n#define\tHUGE_VAL\t__builtin_huge_val()\n#else\n#define\tHUGE_VAL\t(__infinity.__ud)\n#endif\n\n#if __ISO_C_VISIBLE >= 1999\n#define\tFP_ILOGB0\t(-__INT_MAX)\n#define\tFP_ILOGBNAN\t__INT_MAX\n\n#ifdef __MATH_BUILTIN_CONSTANTS\n#define\tHUGE_VALF\t__builtin_huge_valf()\n#define\tHUGE_VALL\t__builtin_huge_vall()\n#define\tINFINITY\t__builtin_inff()\n#define\tNAN\t\t__builtin_nanf(\"\")\n#else\n#define\tHUGE_VALF\t(float)HUGE_VAL\n#define\tHUGE_VALL\t(long double)HUGE_VAL\n#define\tINFINITY\tHUGE_VALF\n#define\tNAN\t\t(__nan.__uf)\n#endif /* __MATH_BUILTIN_CONSTANTS */\n\n#define\tMATH_ERRNO\t1\n#define\tMATH_ERREXCEPT\t2\n#define\tmath_errhandling\tMATH_ERREXCEPT\n\n/* XXX We need a <machine/math.h>. */\n#if defined(__ia64__) || defined(__sparc64__)\n#define\tFP_FAST_FMA\t1\n#endif\n#ifdef __ia64__\n#define\tFP_FAST_FMAL\t1\n#endif\n#define\tFP_FAST_FMAF\t1\n\n/* Symbolic constants to classify floating point numbers. */\n#define\tFP_INFINITE\t0x01\n#define\tFP_NAN\t\t0x02\n#define\tFP_NORMAL\t0x04\n#define\tFP_SUBNORMAL\t0x08\n#define\tFP_ZERO\t\t0x10\n#define\tfpclassify(x) \\\n    ((sizeof (x) == sizeof (float)) ? __fpclassifyf(x) \\\n    : (sizeof (x) == sizeof (double)) ? __fpclassifyd(x) \\\n    : __fpclassifyl(x))\n\n#define\tisfinite(x)\t\t\t\t\t\\\n    ((sizeof (x) == sizeof (float)) ? __isfinitef(x)\t\\\n    : (sizeof (x) == sizeof (double)) ? __isfinite(x)\t\\\n    : __isfinitel(x))\n#define\tisinf(x)\t\t\t\t\t\\\n    ((sizeof (x) == sizeof (float)) ? __isinff(x)\t\\\n    : (sizeof (x) == sizeof (double)) ? isinf(x)\t\\\n    : __isinfl(x))\n#define\tisnan(x)\t\t\t\t\t\\\n    ((sizeof (x) == sizeof (float)) ? __isnanf(x)\t\\\n    : (sizeof (x) == sizeof (double)) ? isnan(x)\t\\\n    : __isnanl(x))\n#define\tisnormal(x)\t\t\t\t\t\\\n    ((sizeof (x) == sizeof (float)) ? __isnormalf(x)\t\\\n    : (sizeof (x) == sizeof (double)) ? __isnormal(x)\t\\\n    : __isnormall(x))\n\n#ifdef __MATH_BUILTIN_RELOPS\n#define\tisgreater(x, y)\t\t__builtin_isgreater((x), (y))\n#define\tisgreaterequal(x, y)\t__builtin_isgreaterequal((x), (y))\n#define\tisless(x, y)\t\t__builtin_isless((x), (y))\n#define\tislessequal(x, y)\t__builtin_islessequal((x), (y))\n#define\tislessgreater(x, y)\t__builtin_islessgreater((x), (y))\n#define\tisunordered(x, y)\t__builtin_isunordered((x), (y))\n#else\n#define\tisgreater(x, y)\t\t(!isunordered((x), (y)) && (x) > (y))\n#define\tisgreaterequal(x, y)\t(!isunordered((x), (y)) && (x) >= (y))\n#define\tisless(x, y)\t\t(!isunordered((x), (y)) && (x) < (y))\n#define\tislessequal(x, y)\t(!isunordered((x), (y)) && (x) <= (y))\n#define\tislessgreater(x, y)\t(!isunordered((x), (y)) && \\\n\t\t\t\t\t((x) > (y) || (y) > (x)))\n#define\tisunordered(x, y)\t(isnan(x) || isnan(y))\n#endif /* __MATH_BUILTIN_RELOPS */\n\n#define\tsignbit(x)\t\t\t\t\t\\\n    ((sizeof (x) == sizeof (float)) ? __signbitf(x)\t\\\n    : (sizeof (x) == sizeof (double)) ? __signbit(x)\t\\\n    : __signbitl(x))\n\ntypedef\t__double_t\tdouble_t;\ntypedef\t__float_t\tfloat_t;\n#endif /* __ISO_C_VISIBLE >= 1999 */\n\n/*\n * XOPEN/SVID\n */\n#if __BSD_VISIBLE || __XSI_VISIBLE\n#define\tM_E\t\t2.7182818284590452354\t/* e */\n#define\tM_LOG2E\t\t1.4426950408889634074\t/* log 2e */\n#define\tM_LOG10E\t0.43429448190325182765\t/* log 10e */\n#define\tM_LN2\t\t0.69314718055994530942\t/* log e2 */\n#define\tM_LN10\t\t2.30258509299404568402\t/* log e10 */\n#define\tM_PI\t\t3.14159265358979323846\t/* pi */\n#define\tM_PI_2\t\t1.57079632679489661923\t/* pi/2 */\n#define\tM_PI_4\t\t0.78539816339744830962\t/* pi/4 */\n#define\tM_1_PI\t\t0.31830988618379067154\t/* 1/pi */\n#define\tM_2_PI\t\t0.63661977236758134308\t/* 2/pi */\n#define\tM_2_SQRTPI\t1.12837916709551257390\t/* 2/sqrt(pi) */\n#define\tM_SQRT2\t\t1.41421356237309504880\t/* sqrt(2) */\n#define\tM_SQRT1_2\t0.70710678118654752440\t/* 1/sqrt(2) */\n\n#define\tMAXFLOAT\t((float)3.40282346638528860e+38)\nextern int signgam;\n#endif /* __BSD_VISIBLE || __XSI_VISIBLE */\n\n#if __BSD_VISIBLE\n#if 0\n/* Old value from 4.4BSD-Lite math.h; this is probably better. */\n#define\tHUGE\t\tHUGE_VAL\n#else\n#define\tHUGE\t\tMAXFLOAT\n#endif\n#endif /* __BSD_VISIBLE */\n\n/*\n * Most of these functions depend on the rounding mode and have the side\n * effect of raising floating-point exceptions, so they are not declared\n * as __pure2.  In C99, FENV_ACCESS affects the purity of these functions.\n */\n__BEGIN_DECLS\n/*\n * ANSI/POSIX\n */\nint\t__fpclassifyd(double) __pure2;\nint\t__fpclassifyf(float) __pure2;\nint\t__fpclassifyl(long double) __pure2;\nint\t__isfinitef(float) __pure2;\nint\t__isfinite(double) __pure2;\nint\t__isfinitel(long double) __pure2;\nint\t__isinff(float) __pure2;\nint\t__isinfl(long double) __pure2;\nint\t__isnanf(float) __pure2;\nint\t__isnanl(long double) __pure2;\nint\t__isnormalf(float) __pure2;\nint\t__isnormal(double) __pure2;\nint\t__isnormall(long double) __pure2;\nint\t__signbit(double) __pure2;\nint\t__signbitf(float) __pure2;\nint\t__signbitl(long double) __pure2;\n\ndouble\tacos(double);\ndouble\tasin(double);\ndouble\tatan(double);\ndouble\tatan2(double, double);\ndouble\tcos(double);\ndouble\tsin(double);\ndouble\ttan(double);\n\ndouble\tcosh(double);\ndouble\tsinh(double);\ndouble\ttanh(double);\n\ndouble\texp(double);\ndouble\tfrexp(double, int *);\t/* fundamentally !__pure2 */\ndouble\tldexp(double, int);\ndouble\tlog(double);\ndouble\tlog10(double);\ndouble\tmodf(double, double *);\t/* fundamentally !__pure2 */\n\ndouble\tpow(double, double);\ndouble\tsqrt(double);\n\ndouble\tceil(double);\ndouble\tfabs(double) __pure2;\ndouble\tfloor(double);\ndouble\tfmod(double, double);\n\n/*\n * These functions are not in C90.\n */\n#if __BSD_VISIBLE || __ISO_C_VISIBLE >= 1999 || __XSI_VISIBLE\ndouble\tacosh(double);\ndouble\tasinh(double);\ndouble\tatanh(double);\ndouble\tcbrt(double);\ndouble\terf(double);\ndouble\terfc(double);\ndouble\texp2(double);\ndouble\texpm1(double);\ndouble\tfma(double, double, double);\ndouble\thypot(double, double);\nint\tilogb(double) __pure2;\nint\t(isinf)(double) __pure2;\nint\t(isnan)(double) __pure2;\ndouble\tlgamma(double);\nlong long llrint(double);\nlong long llround(double);\ndouble\tlog1p(double);\ndouble\tlog2(double);\ndouble\tlogb(double);\nlong\tlrint(double);\nlong\tlround(double);\ndouble\tnan(const char *) __pure2;\ndouble\tnextafter(double, double);\ndouble\tremainder(double, double);\ndouble\tremquo(double, double, int *);\ndouble\trint(double);\n#endif /* __BSD_VISIBLE || __ISO_C_VISIBLE >= 1999 || __XSI_VISIBLE */\n\n#if __BSD_VISIBLE || __XSI_VISIBLE\ndouble\tj0(double);\ndouble\tj1(double);\ndouble\tjn(int, double);\ndouble\ty0(double);\ndouble\ty1(double);\ndouble\tyn(int, double);\n\n#if __XSI_VISIBLE <= 500 || __BSD_VISIBLE\ndouble\tgamma(double);\n#endif\n\n#if __XSI_VISIBLE <= 600 || __BSD_VISIBLE\ndouble\tscalb(double, double);\n#endif\n#endif /* __BSD_VISIBLE || __XSI_VISIBLE */\n\n#if __BSD_VISIBLE || __ISO_C_VISIBLE >= 1999\ndouble\tcopysign(double, double) __pure2;\ndouble\tfdim(double, double);\ndouble\tfmax(double, double) __pure2;\ndouble\tfmin(double, double) __pure2;\ndouble\tnearbyint(double);\ndouble\tround(double);\ndouble\tscalbln(double, long);\ndouble\tscalbn(double, int);\ndouble\ttgamma(double);\ndouble\ttrunc(double);\n#endif\n\n/*\n * BSD math library entry points\n */\n#if __BSD_VISIBLE\ndouble\tdrem(double, double);\nint\tfinite(double) __pure2;\nint\tisnanf(float) __pure2;\n\n/*\n * Reentrant version of gamma & lgamma; passes signgam back by reference\n * as the second argument; user must allocate space for signgam.\n */\ndouble\tgamma_r(double, int *);\ndouble\tlgamma_r(double, int *);\n\n/*\n * IEEE Test Vector\n */\ndouble\tsignificand(double);\n#endif /* __BSD_VISIBLE */\n\n/* float versions of ANSI/POSIX functions */\n#if __ISO_C_VISIBLE >= 1999\nfloat\tacosf(float);\nfloat\tasinf(float);\nfloat\tatanf(float);\nfloat\tatan2f(float, float);\nfloat\tcosf(float);\nfloat\tsinf(float);\nfloat\ttanf(float);\n\nfloat\tcoshf(float);\nfloat\tsinhf(float);\nfloat\ttanhf(float);\n\nfloat\texp2f(float);\nfloat\texpf(float);\nfloat\texpm1f(float);\nfloat\tfrexpf(float, int *);\t/* fundamentally !__pure2 */\nint\tilogbf(float) __pure2;\nfloat\tldexpf(float, int);\nfloat\tlog10f(float);\nfloat\tlog1pf(float);\nfloat\tlog2f(float);\nfloat\tlogf(float);\nfloat\tmodff(float, float *);\t/* fundamentally !__pure2 */\n\nfloat\tpowf(float, float);\nfloat\tsqrtf(float);\n\nfloat\tceilf(float);\nfloat\tfabsf(float) __pure2;\nfloat\tfloorf(float);\nfloat\tfmodf(float, float);\nfloat\troundf(float);\n\nfloat\terff(float);\nfloat\terfcf(float);\nfloat\thypotf(float, float);\nfloat\tlgammaf(float);\nfloat\ttgammaf(float);\n\nfloat\tacoshf(float);\nfloat\tasinhf(float);\nfloat\tatanhf(float);\nfloat\tcbrtf(float);\nfloat\tlogbf(float);\nfloat\tcopysignf(float, float) __pure2;\nlong long llrintf(float);\nlong long llroundf(float);\nlong\tlrintf(float);\nlong\tlroundf(float);\nfloat\tnanf(const char *) __pure2;\nfloat\tnearbyintf(float);\nfloat\tnextafterf(float, float);\nfloat\tremainderf(float, float);\nfloat\tremquof(float, float, int *);\nfloat\trintf(float);\nfloat\tscalblnf(float, long);\nfloat\tscalbnf(float, int);\nfloat\ttruncf(float);\n\nfloat\tfdimf(float, float);\nfloat\tfmaf(float, float, float);\nfloat\tfmaxf(float, float) __pure2;\nfloat\tfminf(float, float) __pure2;\n#endif\n\n/*\n * float versions of BSD math library entry points\n */\n#if __BSD_VISIBLE\nfloat\tdremf(float, float);\nint\tfinitef(float) __pure2;\nfloat\tgammaf(float);\nfloat\tj0f(float);\nfloat\tj1f(float);\nfloat\tjnf(int, float);\nfloat\tscalbf(float, float);\nfloat\ty0f(float);\nfloat\ty1f(float);\nfloat\tynf(int, float);\n\n/*\n * Float versions of reentrant version of gamma & lgamma; passes\n * signgam back by reference as the second argument; user must\n * allocate space for signgam.\n */\nfloat\tgammaf_r(float, int *);\nfloat\tlgammaf_r(float, int *);\n\n/*\n * float version of IEEE Test Vector\n */\nfloat\tsignificandf(float);\n#endif\t/* __BSD_VISIBLE */\n\n/*\n * long double versions of ISO/POSIX math functions\n */\n#if __ISO_C_VISIBLE >= 1999\n#if 0\nlong double\tacoshl(long double);\n#endif\nlong double\tacosl(long double);\n#if 0\nlong double\tasinhl(long double);\n#endif\nlong double\tasinl(long double);\nlong double\tatan2l(long double, long double);\n#if 0\nlong double\tatanhl(long double);\n#endif\nlong double\tatanl(long double);\nlong double\tcbrtl(long double);\nlong double\tceill(long double);\nlong double\tcopysignl(long double, long double) __pure2;\n#if 0\nlong double\tcoshl(long double);\n#endif\nlong double\tcosl(long double);\n#if 0\nlong double\terfcl(long double);\nlong double\terfl(long double);\n#endif\nlong double\texp2l(long double);\n#if 0\nlong double\texpl(long double);\nlong double\texpm1l(long double);\n#endif\nlong double\tfabsl(long double) __pure2;\nlong double\tfdiml(long double, long double);\nlong double\tfloorl(long double);\nlong double\tfmal(long double, long double, long double);\nlong double\tfmaxl(long double, long double) __pure2;\nlong double\tfminl(long double, long double) __pure2;\nlong double\tfmodl(long double, long double);\nlong double\tfrexpl(long double value, int *); /* fundamentally !__pure2 */\nlong double\thypotl(long double, long double);\nint\t\tilogbl(long double) __pure2;\nlong double\tldexpl(long double, int);\n#if 0\nlong double\tlgammal(long double);\n#endif\nlong long\tllrintl(long double);\nlong long\tllroundl(long double);\n#if 0\nlong double\tlog10l(long double);\nlong double\tlog1pl(long double);\nlong double\tlog2l(long double);\n#endif\nlong double\tlogbl(long double);\n#if 0\nlong double\tlogl(long double);\n#endif\nlong\t\tlrintl(long double);\nlong\t\tlroundl(long double);\nlong double\tmodfl(long double, long double *); /* fundamentally !__pure2 */\nlong double\tnanl(const char *) __pure2;\nlong double\tnearbyintl(long double);\nlong double\tnextafterl(long double, long double);\ndouble\t\tnexttoward(double, long double);\nfloat\t\tnexttowardf(float, long double);\nlong double\tnexttowardl(long double, long double);\n#if 0\nlong double\tpowl(long double, long double);\n#endif\nlong double\tremainderl(long double, long double);\nlong double\tremquol(long double, long double, int *);\nlong double\trintl(long double);\nlong double\troundl(long double);\nlong double\tscalblnl(long double, long);\nlong double\tscalbnl(long double, int);\n#if 0\nlong double\tsinhl(long double);\n#endif\nlong double\tsinl(long double);\nlong double\tsqrtl(long double);\n#if 0\nlong double\ttanhl(long double);\n#endif\nlong double\ttanl(long double);\n#if 0\nlong double\ttgammal(long double);\n#endif\nlong double\ttruncl(long double);\n\n#endif /* __ISO_C_VISIBLE >= 1999 */\n__END_DECLS\n\n#endif /* !_MATH_H_ */\n"
  },
  {
    "path": "freebsd-headers/md2.h",
    "content": "/* MD2.H - header file for MD2C.C\n * $FreeBSD: release/9.0.0/lib/libmd/md2.h 154479 2006-01-17 15:35:57Z phk $\n */\n\n/* Copyright (C) 1990-2, RSA Data Security, Inc. Created 1990. All\n   rights reserved.\n\n   License to copy and use this software is granted for\n   non-commercial Internet Privacy-Enhanced Mail provided that it is\n   identified as the \"RSA Data Security, Inc. MD2 Message Digest\n   Algorithm\" in all material mentioning or referencing this software\n   or this function.\n\n   RSA Data Security, Inc. makes no representations concerning either\n   the merchantability of this software or the suitability of this\n   software for any particular purpose. It is provided \"as is\"\n   without express or implied warranty of any kind.\n\n   These notices must be retained in any copies of any part of this\n   documentation and/or software.\n */\n\n#ifndef _MD2_H_\n#define _MD2_H_\n\ntypedef struct MD2Context {\n  unsigned char state[16];\t/* state */\n  unsigned char checksum[16];\t/* checksum */\n  unsigned int count;\t\t/* number of bytes, modulo 16 */\n  unsigned char buffer[16];\t/* input buffer */\n} MD2_CTX;\n\n#include <sys/cdefs.h>\n\n__BEGIN_DECLS\nvoid   MD2Init(MD2_CTX *);\nvoid   MD2Update(MD2_CTX *, const void *, unsigned int);\nvoid   MD2Pad(MD2_CTX *);\nvoid   MD2Final(unsigned char [16], MD2_CTX *);\nchar * MD2End(MD2_CTX *, char *);\nchar * MD2File(const char *, char *);\nchar * MD2FileChunk(const char *, char *, off_t, off_t);\nchar * MD2Data(const void *, unsigned int, char *);\n__END_DECLS\n\n#endif /* _MD2_H_ */\n"
  },
  {
    "path": "freebsd-headers/md4.h",
    "content": "/* MD4.H - header file for MD4C.C\n * $FreeBSD: release/9.0.0/lib/libmd/md4.h 154479 2006-01-17 15:35:57Z phk $\n */\n\n/* Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All\n   rights reserved.\n\n   License to copy and use this software is granted provided that it\n   is identified as the \"RSA Data Security, Inc. MD4 Message-Digest\n   Algorithm\" in all material mentioning or referencing this software\n   or this function.\n   License is also granted to make and use derivative works provided\n   that such works are identified as \"derived from the RSA Data\n   Security, Inc. MD4 Message-Digest Algorithm\" in all material\n   mentioning or referencing the derived work.\n\n   RSA Data Security, Inc. makes no representations concerning either\n   the merchantability of this software or the suitability of this\n   software for any particular purpose. It is provided \"as is\"\n   without express or implied warranty of any kind.\n\n   These notices must be retained in any copies of any part of this\n   documentation and/or software.\n */\n\n#ifndef _MD4_H_\n#define _MD4_H_\n/* MD4 context. */\ntypedef struct MD4Context {\n  u_int32_t state[4];\t/* state (ABCD) */\n  u_int32_t count[2];\t/* number of bits, modulo 2^64 (lsb first) */\n  unsigned char buffer[64];\t/* input buffer */\n} MD4_CTX;\n\n#include <sys/cdefs.h>\n\n__BEGIN_DECLS\nvoid   MD4Init(MD4_CTX *);\nvoid   MD4Update(MD4_CTX *, const void *, unsigned int);\nvoid   MD4Pad(MD4_CTX *);\nvoid   MD4Final(unsigned char [16], MD4_CTX *);\nchar * MD4End(MD4_CTX *, char *);\nchar * MD4File(const char *, char *);\nchar * MD4FileChunk(const char *, char *, off_t, off_t);\nchar * MD4Data(const void *, unsigned int, char *);\n__END_DECLS\n\n#endif /* _MD4_H_ */\n"
  },
  {
    "path": "freebsd-headers/md5.h",
    "content": "#ifndef _MD5_H_\n#define _MD5_H_\n#include <sys/md5.h>\n#endif /* _MD5_H_ */\n"
  },
  {
    "path": "freebsd-headers/memory.h",
    "content": "/*\n * Copyright (c) 1988, 1993\n *\tThe Regents of the University of California.  All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t@(#)memory.h\t8.1 (Berkeley) 6/2/93\n *\n * $FreeBSD: release/9.0.0/include/memory.h 203964 2010-02-16 19:39:50Z imp $\n */\n\n#include <string.h>\n"
  },
  {
    "path": "freebsd-headers/memstat.h",
    "content": "/*-\n * Copyright (c) 2005 Robert N. M. Watson\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/lib/libmemstat/memstat.h 224569 2011-08-01 09:43:35Z pluknet $\n */\n\n#ifndef _MEMSTAT_H_\n#define\t_MEMSTAT_H_\n\n/*\n * Amount of caller data to maintain for each caller data slot.  Applications\n * must not request more than this number of caller save data, or risk\n * corrupting internal libmemstat(3) data structures.  A compile time check\n * in the application is probably appropriate.\n */\n#define\tMEMSTAT_MAXCALLER\t16\n\n/*\n * libmemstat(3) is able to extract memory data from different allocators;\n * when it does so, it tags which allocator it got the data from so that\n * consumers can determine which fields are usable, as data returned varies\n * some.\n */\n#define\tALLOCATOR_UNKNOWN\t0\n#define\tALLOCATOR_MALLOC\t1\n#define\tALLOCATOR_UMA\t\t2\n#define\tALLOCATOR_ANY\t\t255\n\n/*\n * Library maximum type name.  Should be max(set of name maximums over\n * various allocators).\n */\n#define\tMEMTYPE_MAXNAME\t\t32\n\n/*\n * Library error conditions, mostly from the underlying data sources.  On\n * failure, functions typically return (-1) or (NULL); on success, (0) or a\n * valid data pointer.  The error from the last operation is stored in\n * struct memory_type_list, and accessed via memstat_get_error(list).\n */\n#define\tMEMSTAT_ERROR_UNDEFINED\t\t0\t/* Initialization value. */\n#define\tMEMSTAT_ERROR_NOMEMORY\t\t1\t/* Out of memory. */\n#define\tMEMSTAT_ERROR_VERSION\t\t2\t/* Unsupported version. */\n#define\tMEMSTAT_ERROR_PERMISSION\t3\t/* Permission denied. */\n#define\tMEMSTAT_ERROR_DATAERROR\t\t5\t/* Error in stat data. */\n#define\tMEMSTAT_ERROR_KVM\t\t6\t/* See kvm_geterr() for err. */\n#define\tMEMSTAT_ERROR_KVM_NOSYMBOL\t7\t/* Symbol not available. */\n#define\tMEMSTAT_ERROR_KVM_SHORTREAD\t8\t/* Short kvm_read return. */\n\n/*\n * Forward declare struct memory_type, which holds per-type properties and\n * statistics.  This is an opaque type, to be frobbed only from within the\n * library, in order to avoid building ABI assumptions into the application.\n * Accessor methods should be used to get and sometimes set the fields from\n * consumers of the library.\n */\nstruct memory_type;\n\n/*\n * struct memory_type_list is the head of a list of memory types and\n * statistics.\n */\nstruct memory_type_list;\n\n__BEGIN_DECLS\n/*\n * Functions that operate without memory type or memory type list context.\n */\nconst char\t*memstat_strerror(int error);\n\n/*\n * Functions for managing memory type and statistics data.\n */\nstruct memory_type_list\t*memstat_mtl_alloc(void);\nstruct memory_type\t*memstat_mtl_first(struct memory_type_list *list);\nstruct memory_type\t*memstat_mtl_next(struct memory_type *mtp);\nstruct memory_type\t*memstat_mtl_find(struct memory_type_list *list,\n\t\t\t    int allocator, const char *name);\nvoid\tmemstat_mtl_free(struct memory_type_list *list);\nint\tmemstat_mtl_geterror(struct memory_type_list *list);\n\n/*\n * Functions to retrieve data from a live kernel using sysctl.\n */\nint\tmemstat_sysctl_all(struct memory_type_list *list, int flags);\nint\tmemstat_sysctl_malloc(struct memory_type_list *list, int flags);\nint\tmemstat_sysctl_uma(struct memory_type_list *list, int flags);\n\n/*\n * Functions to retrieve data from a kernel core (or /dev/kmem).\n */\nint\tmemstat_kvm_all(struct memory_type_list *list, void *kvm_handle);\nint\tmemstat_kvm_malloc(struct memory_type_list *list, void *kvm_handle);\nint\tmemstat_kvm_uma(struct memory_type_list *list, void *kvm_handle);\n\n/*\n * Accessor methods for struct memory_type.\n */\nconst char\t*memstat_get_name(const struct memory_type *mtp);\nint\t\t memstat_get_allocator(const struct memory_type *mtp);\nuint64_t\t memstat_get_countlimit(const struct memory_type *mtp);\nuint64_t\t memstat_get_byteslimit(const struct memory_type *mtp);\nuint64_t\t memstat_get_sizemask(const struct memory_type *mtp);\nuint64_t\t memstat_get_size(const struct memory_type *mtp);\nuint64_t\t memstat_get_memalloced(const struct memory_type *mtp);\nuint64_t\t memstat_get_memfreed(const struct memory_type *mtp);\nuint64_t\t memstat_get_numallocs(const struct memory_type *mtp);\nuint64_t\t memstat_get_numfrees(const struct memory_type *mtp);\nuint64_t\t memstat_get_bytes(const struct memory_type *mtp);\nuint64_t\t memstat_get_count(const struct memory_type *mtp);\nuint64_t\t memstat_get_free(const struct memory_type *mtp);\nuint64_t\t memstat_get_failures(const struct memory_type *mtp);\nuint64_t\t memstat_get_sleeps(const struct memory_type *mtp);\nvoid\t\t*memstat_get_caller_pointer(const struct memory_type *mtp,\n\t\t    int index);\nvoid\t\t memstat_set_caller_pointer(struct memory_type *mtp,\n\t\t    int index, void *value);\nuint64_t\t memstat_get_caller_uint64(const struct memory_type *mtp,\n\t\t    int index);\nvoid\t\t memstat_set_caller_uint64(struct memory_type *mtp, int index,\n\t\t    uint64_t value);\nuint64_t\t memstat_get_zonefree(const struct memory_type *mtp);\nuint64_t\t memstat_get_kegfree(const struct memory_type *mtp);\nuint64_t\t memstat_get_percpu_memalloced(const struct memory_type *mtp,\n\t\t    int cpu);\nuint64_t\t memstat_get_percpu_memfreed(const struct memory_type *mtp,\n\t\t    int cpu);\nuint64_t\t memstat_get_percpu_numallocs(const struct memory_type *mtp,\n\t\t    int cpu);\nuint64_t\t memstat_get_percpu_numfrees(const struct memory_type *mtp,\n\t\t    int cpu);\nuint64_t\t memstat_get_percpu_sizemask(const struct memory_type *mtp,\n\t\t    int cpu);\nvoid\t\t*memstat_get_percpu_caller_pointer(\n\t\t    const struct memory_type *mtp, int cpu, int index);\nvoid\t\t memstat_set_percpu_caller_pointer(struct memory_type *mtp,\n\t\t    int cpu, int index, void *value);\nuint64_t\t memstat_get_percpu_caller_uint64(\n\t\t    const struct memory_type *mtp, int cpu, int index);\nvoid\t\t memstat_set_percpu_caller_uint64(struct memory_type *mtp,\n\t\t    int cpu, int index, uint64_t value);\nuint64_t\t memstat_get_percpu_free(const struct memory_type *mtp,\n\t\t    int cpu);\n__END_DECLS\n\n#endif /* !_MEMSTAT_H_ */\n"
  },
  {
    "path": "freebsd-headers/menu.h",
    "content": "/****************************************************************************\n * Copyright (c) 1998-2003,2007 Free Software Foundation, Inc.              *\n *                                                                          *\n * Permission is hereby granted, free of charge, to any person obtaining a  *\n * copy of this software and associated documentation files (the            *\n * \"Software\"), to deal in the Software without restriction, including      *\n * without limitation the rights to use, copy, modify, merge, publish,      *\n * distribute, distribute with modifications, sublicense, and/or sell       *\n * copies of the Software, and to permit persons to whom the Software is    *\n * furnished to do so, subject to the following conditions:                 *\n *                                                                          *\n * The above copyright notice and this permission notice shall be included  *\n * in all copies or substantial portions of the Software.                   *\n *                                                                          *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS  *\n * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF               *\n * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.   *\n * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,   *\n * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR    *\n * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR    *\n * THE USE OR OTHER DEALINGS IN THE SOFTWARE.                               *\n *                                                                          *\n * Except as contained in this notice, the name(s) of the above copyright   *\n * holders shall not be used in advertising or otherwise to promote the     *\n * sale, use or other dealings in this Software without prior written       *\n * authorization.                                                           *\n ****************************************************************************/\n\n/****************************************************************************\n *   Author:  Juergen Pfeifer, 1995,1997                                    *\n ****************************************************************************/\n\n/* $Id: menu.h,v 1.19 2007/02/24 17:32:13 tom Exp $ */\n\n#ifndef ETI_MENU\n#define ETI_MENU\n\n#ifdef AMIGA\n#define TEXT TEXT_ncurses\n#endif\n\n#include <curses.h>\n#include <eti.h>\n\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\ntypedef int Menu_Options;\ntypedef int Item_Options;\n\n/* Menu options: */\n#define O_ONEVALUE      (0x01)\n#define O_SHOWDESC      (0x02)\n#define O_ROWMAJOR      (0x04)\n#define O_IGNORECASE    (0x08)\n#define O_SHOWMATCH     (0x10)\n#define O_NONCYCLIC     (0x20)\n\n/* Item options: */\n#define O_SELECTABLE    (0x01)\n\ntypedef struct\n{\n  const char* str;\n  unsigned short length;\n} TEXT;\n\ntypedef struct tagITEM \n{\n  TEXT           name;        /* name of menu item                         */\n  TEXT           description; /* description of item, optional in display  */ \n  struct tagMENU *imenu;      /* Pointer to parent menu                    */\n  void           *userptr;    /* Pointer to user defined per item data     */ \n  Item_Options   opt;         /* Item options                              */ \n  short          index;       /* Item number if connected to a menu        */\n  short          y;           /* y and x location of item in menu          */\n  short          x;\n  bool           value;       /* Selection value                           */\n                             \n  struct tagITEM *left;       /* neighbor items                            */\n  struct tagITEM *right;\n  struct tagITEM *up;\n  struct tagITEM *down;\n\n} ITEM;\n\ntypedef void (*Menu_Hook)(struct tagMENU *);\n\ntypedef struct tagMENU \n{\n  short          height;                /* Nr. of chars high               */\n  short          width;                 /* Nr. of chars wide               */\n  short          rows;                  /* Nr. of items high               */\n  short          cols;                  /* Nr. of items wide               */\n  short          frows;                 /* Nr. of formatted items high     */\n  short          fcols;                 /* Nr. of formatted items wide     */\n  short          arows;                 /* Nr. of items high (actual)      */\n  short          namelen;               /* Max. name length                */\n  short          desclen;               /* Max. description length         */\n  short          marklen;               /* Length of mark, if any          */\n  short          itemlen;               /* Length of one item              */\n  short          spc_desc;              /* Spacing for descriptor          */\n  short          spc_cols;              /* Spacing for columns             */\n  short          spc_rows;              /* Spacing for rows                */ \n  char          *pattern;               /* Buffer to store match chars     */\n  short          pindex;                /* Index into pattern buffer       */\n  WINDOW        *win;                   /* Window containing menu          */\n  WINDOW        *sub;                   /* Subwindow for menu display      */\n  WINDOW        *userwin;               /* User's window                   */\n  WINDOW        *usersub;               /* User's subwindow                */\n  ITEM          **items;                /* array of items                  */ \n  short          nitems;                /* Nr. of items in menu            */\n  ITEM          *curitem;               /* Current item                    */\n  short          toprow;                /* Top row of menu                 */\n  chtype         fore;                  /* Selection attribute             */\n  chtype         back;                  /* Nonselection attribute          */\n  chtype         grey;                  /* Inactive attribute              */\n  unsigned char  pad;                   /* Pad character                   */\n\n  Menu_Hook      menuinit;              /* User hooks                      */\n  Menu_Hook      menuterm;\n  Menu_Hook      iteminit;\n  Menu_Hook      itemterm;\n\n  void          *userptr;               /* Pointer to menus user data      */\n  char          *mark;                  /* Pointer to marker string        */\n\n  Menu_Options   opt;                   /* Menu options                    */\n  unsigned short status;                /* Internal state of menu          */\n\n} MENU;\n\n\n/* Define keys */\n\n#define REQ_LEFT_ITEM           (KEY_MAX + 1)\n#define REQ_RIGHT_ITEM          (KEY_MAX + 2)\n#define REQ_UP_ITEM             (KEY_MAX + 3)\n#define REQ_DOWN_ITEM           (KEY_MAX + 4)\n#define REQ_SCR_ULINE           (KEY_MAX + 5)\n#define REQ_SCR_DLINE           (KEY_MAX + 6)\n#define REQ_SCR_DPAGE           (KEY_MAX + 7)\n#define REQ_SCR_UPAGE           (KEY_MAX + 8)\n#define REQ_FIRST_ITEM          (KEY_MAX + 9)\n#define REQ_LAST_ITEM           (KEY_MAX + 10)\n#define REQ_NEXT_ITEM           (KEY_MAX + 11)\n#define REQ_PREV_ITEM           (KEY_MAX + 12)\n#define REQ_TOGGLE_ITEM         (KEY_MAX + 13)\n#define REQ_CLEAR_PATTERN       (KEY_MAX + 14)\n#define REQ_BACK_PATTERN        (KEY_MAX + 15)\n#define REQ_NEXT_MATCH          (KEY_MAX + 16)\n#define REQ_PREV_MATCH          (KEY_MAX + 17)\n\n#define MIN_MENU_COMMAND        (KEY_MAX + 1)\n#define MAX_MENU_COMMAND        (KEY_MAX + 17)\n\n/*\n * Some AT&T code expects MAX_COMMAND to be out-of-band not\n * just for menu commands but for forms ones as well.\n */\n#if defined(MAX_COMMAND)\n#  if (MAX_MENU_COMMAND > MAX_COMMAND)\n#    error Something is wrong -- MAX_MENU_COMMAND is greater than MAX_COMMAND\n#  elif (MAX_COMMAND != (KEY_MAX + 128))\n#    error Something is wrong -- MAX_COMMAND is already inconsistently defined.\n#  endif\n#else\n#  define MAX_COMMAND (KEY_MAX + 128)\n#endif\n\n\n/* --------- prototypes for libmenu functions ----------------------------- */\n\nextern NCURSES_EXPORT(ITEM **)\tmenu_items (const MENU *);\nextern NCURSES_EXPORT(ITEM *)\tcurrent_item (const MENU *);\nextern NCURSES_EXPORT(ITEM *)\tnew_item (const char *,const char *);\n\nextern NCURSES_EXPORT(MENU *)\tnew_menu (ITEM **);\n\nextern NCURSES_EXPORT(Item_Options)\titem_opts (const ITEM *);\nextern NCURSES_EXPORT(Menu_Options)\tmenu_opts (const MENU *);\n\nextern NCURSES_EXPORT(Menu_Hook)\titem_init (const MENU *);\nextern NCURSES_EXPORT(Menu_Hook)\titem_term (const MENU *);\nextern NCURSES_EXPORT(Menu_Hook)\tmenu_init (const MENU *);\nextern NCURSES_EXPORT(Menu_Hook)\tmenu_term (const MENU *);\n\nextern NCURSES_EXPORT(WINDOW *)\tmenu_sub (const MENU *);\nextern NCURSES_EXPORT(WINDOW *)\tmenu_win (const MENU *);\n\nextern NCURSES_EXPORT(const char *)\titem_description (const ITEM *);\nextern NCURSES_EXPORT(const char *)\titem_name (const ITEM *);\nextern NCURSES_EXPORT(const char *)\tmenu_mark (const MENU *);\nextern NCURSES_EXPORT(const char *)\tmenu_request_name (int);\n\nextern NCURSES_EXPORT(char *)\tmenu_pattern (const MENU *);\n\nextern NCURSES_EXPORT(void *)\tmenu_userptr (const MENU *);\nextern NCURSES_EXPORT(void *)\titem_userptr (const ITEM *);\n\nextern NCURSES_EXPORT(chtype)\tmenu_back (const MENU *);\nextern NCURSES_EXPORT(chtype)\tmenu_fore (const MENU *);\nextern NCURSES_EXPORT(chtype)\tmenu_grey (const MENU *);\n\nextern NCURSES_EXPORT(int)\tfree_item (ITEM *);\nextern NCURSES_EXPORT(int)\tfree_menu (MENU *);\nextern NCURSES_EXPORT(int)\titem_count (const MENU *);\nextern NCURSES_EXPORT(int)\titem_index (const ITEM *);\nextern NCURSES_EXPORT(int)\titem_opts_off (ITEM *,Item_Options);\nextern NCURSES_EXPORT(int)\titem_opts_on (ITEM *,Item_Options);\nextern NCURSES_EXPORT(int)\tmenu_driver (MENU *,int);\nextern NCURSES_EXPORT(int)\tmenu_opts_off (MENU *,Menu_Options);\nextern NCURSES_EXPORT(int)\tmenu_opts_on (MENU *,Menu_Options);\nextern NCURSES_EXPORT(int)\tmenu_pad (const MENU *);\nextern NCURSES_EXPORT(int)\tpos_menu_cursor (const MENU *);\nextern NCURSES_EXPORT(int)\tpost_menu (MENU *);\nextern NCURSES_EXPORT(int)\tscale_menu (const MENU *,int *,int *);\nextern NCURSES_EXPORT(int)\tset_current_item (MENU *menu,ITEM *item);\nextern NCURSES_EXPORT(int)\tset_item_init (MENU *, Menu_Hook);\nextern NCURSES_EXPORT(int)\tset_item_opts (ITEM *,Item_Options);\nextern NCURSES_EXPORT(int)\tset_item_term (MENU *, Menu_Hook);\nextern NCURSES_EXPORT(int)\tset_item_userptr (ITEM *, void *);\nextern NCURSES_EXPORT(int)\tset_item_value (ITEM *,bool);\nextern NCURSES_EXPORT(int)\tset_menu_back (MENU *,chtype);\nextern NCURSES_EXPORT(int)\tset_menu_fore (MENU *,chtype);\nextern NCURSES_EXPORT(int)\tset_menu_format (MENU *,int,int);\nextern NCURSES_EXPORT(int)\tset_menu_grey (MENU *,chtype);\nextern NCURSES_EXPORT(int)\tset_menu_init (MENU *, Menu_Hook);\nextern NCURSES_EXPORT(int)\tset_menu_items (MENU *,ITEM **);\nextern NCURSES_EXPORT(int)\tset_menu_mark (MENU *, const char *);\nextern NCURSES_EXPORT(int)\tset_menu_opts (MENU *,Menu_Options);\nextern NCURSES_EXPORT(int)\tset_menu_pad (MENU *,int);\nextern NCURSES_EXPORT(int)\tset_menu_pattern (MENU *,const char *);\nextern NCURSES_EXPORT(int)\tset_menu_sub (MENU *,WINDOW *);\nextern NCURSES_EXPORT(int)\tset_menu_term (MENU *, Menu_Hook);\nextern NCURSES_EXPORT(int)\tset_menu_userptr (MENU *,void *);\nextern NCURSES_EXPORT(int)\tset_menu_win (MENU *,WINDOW *);\nextern NCURSES_EXPORT(int)\tset_top_row (MENU *,int);\nextern NCURSES_EXPORT(int)\ttop_row (const MENU *);\nextern NCURSES_EXPORT(int)\tunpost_menu (MENU *);\nextern NCURSES_EXPORT(int)\tmenu_request_by_name (const char *);\nextern NCURSES_EXPORT(int)\tset_menu_spacing (MENU *,int,int,int);\nextern NCURSES_EXPORT(int)\tmenu_spacing (const MENU *,int *,int *,int *);\n\n\nextern NCURSES_EXPORT(bool)\titem_value (const ITEM *);\nextern NCURSES_EXPORT(bool)\titem_visible (const ITEM *);\n\nextern NCURSES_EXPORT(void)\tmenu_format (const MENU *,int *,int *);\n\n#ifdef __cplusplus\n  }\n#endif\n\n#endif /* ETI_MENU */\n"
  },
  {
    "path": "freebsd-headers/monetary.h",
    "content": "/*-\n * Copyright (c) 2001 Alexey Zelkin <phantom@FreeBSD.org>\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/include/monetary.h 103667 2002-09-20 08:22:48Z mike $\n */\n\n#ifndef _MONETARY_H_\n#define\t_MONETARY_H_\n\n#include <sys/cdefs.h>\n#include <sys/_types.h>\n\n#ifndef _SIZE_T_DECLARED\ntypedef\t__size_t\tsize_t;\n#define\t_SIZE_T_DECLARED\n#endif\n\n#ifndef _SSIZE_T_DECLARED\ntypedef\t__ssize_t\tssize_t;\n#define\t_SSIZE_T_DECLARED\n#endif\n\n__BEGIN_DECLS\nssize_t\tstrfmon(char * __restrict, size_t, const char * __restrict, ...);\n__END_DECLS\n\n#endif /* !_MONETARY_H_ */\n"
  },
  {
    "path": "freebsd-headers/mp.h",
    "content": "/* $FreeBSD: release/9.0.0/lib/libmp/mp.h 189092 2009-02-26 21:43:15Z ed $ */\n\n#ifndef _MP_H_\n#define _MP_H_\n\n#ifndef HEADER_BN_H_\n#include <openssl/bn.h>\n#endif\n\ntypedef struct _mint {\n\tBIGNUM *bn;\n} MINT;\n\nvoid mp_gcd(const MINT *, const MINT *, MINT *);\nMINT *mp_itom(short);\nvoid mp_madd(const MINT *, const MINT *, MINT *);\nint mp_mcmp(const MINT *, const MINT *);\nvoid mp_mdiv(const MINT *, const MINT *, MINT *, MINT *);\nvoid mp_mfree(MINT *);\nvoid mp_min(MINT *);\nvoid mp_mout(const MINT *);\nvoid mp_move(const MINT *, MINT *);\nvoid mp_msqrt(const MINT *, MINT *, MINT *);\nvoid mp_msub(const MINT *, const MINT *, MINT *);\nchar *mp_mtox(const MINT *);\nvoid mp_mult(const MINT *, const MINT *, MINT *);\nvoid mp_pow(const MINT *, const MINT *, const MINT *, MINT *);\nvoid mp_rpow(const MINT *, short, MINT *);\nvoid mp_sdiv(const MINT *, short, MINT *, short *);\nMINT *mp_xtom(const char *);\n\n#endif /* !_MP_H_ */\n"
  },
  {
    "path": "freebsd-headers/mpool.h",
    "content": "/*-\n * Copyright (c) 1991, 1993, 1994\n *\tThe Regents of the University of California.  All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t@(#)mpool.h\t8.4 (Berkeley) 11/2/95\n * $FreeBSD: release/9.0.0/include/mpool.h 203964 2010-02-16 19:39:50Z imp $\n */\n\n#ifndef _MPOOL_H_\n#define _MPOOL_H_\n\n#include <sys/queue.h>\n\n/*\n * The memory pool scheme is a simple one.  Each in-memory page is referenced\n * by a bucket which is threaded in up to two of three ways.  All active pages\n * are threaded on a hash chain (hashed by page number) and an lru chain.\n * Inactive pages are threaded on a free chain.  Each reference to a memory\n * pool is handed an opaque MPOOL cookie which stores all of this information.\n */\n#define\tHASHSIZE\t128\n#define\tHASHKEY(pgno)\t((pgno - 1 + HASHSIZE) % HASHSIZE)\n\n/* The BKT structures are the elements of the queues. */\ntypedef struct _bkt {\n\tTAILQ_ENTRY(_bkt) hq;\t\t/* hash queue */\n\tTAILQ_ENTRY(_bkt) q;\t\t/* lru queue */\n\tvoid    *page;\t\t\t/* page */\n\tpgno_t   pgno;\t\t\t/* page number */\n\n#define\tMPOOL_DIRTY\t0x01\t\t/* page needs to be written */\n#define\tMPOOL_PINNED\t0x02\t\t/* page is pinned into memory */\n#define\tMPOOL_INUSE\t0x04\t\t/* page address is valid */\n\tu_int8_t flags;\t\t\t/* flags */\n} BKT;\n\ntypedef struct MPOOL {\n\tTAILQ_HEAD(_lqh, _bkt) lqh;\t/* lru queue head */\n\t\t\t\t\t/* hash queue array */\n\tTAILQ_HEAD(_hqh, _bkt) hqh[HASHSIZE];\n\tpgno_t\tcurcache;\t\t/* current number of cached pages */\n\tpgno_t\tmaxcache;\t\t/* max number of cached pages */\n\tpgno_t\tnpages;\t\t\t/* number of pages in the file */\n\tunsigned long\tpagesize;\t/* file page size */\n\tint\tfd;\t\t\t/* file descriptor */\n\t\t\t\t\t/* page in conversion routine */\n\tvoid    (*pgin)(void *, pgno_t, void *);\n\t\t\t\t\t/* page out conversion routine */\n\tvoid    (*pgout)(void *, pgno_t, void *);\n\tvoid\t*pgcookie;\t\t/* cookie for page in/out routines */\n#ifdef STATISTICS\n\tunsigned long\tcachehit;\n\tunsigned long\tcachemiss;\n\tunsigned long\tpagealloc;\n\tunsigned long\tpageflush;\n\tunsigned long\tpageget;\n\tunsigned long\tpagenew;\n\tunsigned long\tpageput;\n\tunsigned long\tpageread;\n\tunsigned long\tpagewrite;\n#endif\n} MPOOL;\n\n#define\tMPOOL_IGNOREPIN\t0x01\t\t/* Ignore if the page is pinned. */\n#define\tMPOOL_PAGE_REQUEST\t0x01\t/* Allocate a new page with a\n\t\t\t\t\t   specific page number. */\n#define\tMPOOL_PAGE_NEXT\t\t0x02\t/* Allocate a new page with the next\n\t\t\t\t\t  page number. */\n\n__BEGIN_DECLS\nMPOOL\t*mpool_open(void *, int, pgno_t, pgno_t);\nvoid\t mpool_filter(MPOOL *, void (*)(void *, pgno_t, void *),\n\t    void (*)(void *, pgno_t, void *), void *);\nvoid\t*mpool_new(MPOOL *, pgno_t *, unsigned int);\nvoid\t*mpool_get(MPOOL *, pgno_t, unsigned int);\nint\t mpool_delete(MPOOL *, void *);\nint\t mpool_put(MPOOL *, void *, unsigned int);\nint\t mpool_sync(MPOOL *);\nint\t mpool_close(MPOOL *);\n#ifdef STATISTICS\nvoid\t mpool_stat(MPOOL *);\n#endif\n__END_DECLS\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/mqueue.h",
    "content": "/*-\n * Copyright (c) 2005 David Xu <davidxu@freebsd.org>\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/include/mqueue.h 165828 2007-01-06 11:30:04Z davidxu $\n */\n\n#ifndef _MQUEUE_H_\n#define _MQUEUE_H_\n\n#include <sys/cdefs.h>\n#include <sys/types.h>\n#include <sys/mqueue.h>\n\nstruct sigevent;\nstruct timespec;\n\n__BEGIN_DECLS\nint\tmq_close(mqd_t);\nint\tmq_getattr(mqd_t, struct mq_attr *);\nint\tmq_notify(mqd_t, const struct sigevent *);\nmqd_t\tmq_open(const char *, int, ...);\nssize_t\tmq_receive(mqd_t, char *, size_t, unsigned *);\nint\tmq_send(mqd_t, const char *, size_t, unsigned);\nint\tmq_setattr(mqd_t, const struct mq_attr *__restrict,\n\t\tstruct mq_attr *__restrict);\nssize_t\tmq_timedreceive(mqd_t, char *__restrict, size_t,\n\t\tunsigned *__restrict, const struct timespec *__restrict);\nint\tmq_timedsend(mqd_t, const char *, size_t, unsigned,\n\t\tconst struct timespec *);\nint\tmq_unlink(const char *);\nint\t__mq_oshandle(mqd_t mqd);\n\n__END_DECLS\n#endif\n"
  },
  {
    "path": "freebsd-headers/ncurses_dll.h",
    "content": "/****************************************************************************\n * Copyright (c) 1998-2006,2007 Free Software Foundation, Inc.              *\n *                                                                          *\n * Permission is hereby granted, free of charge, to any person obtaining a  *\n * copy of this software and associated documentation files (the            *\n * \"Software\"), to deal in the Software without restriction, including      *\n * without limitation the rights to use, copy, modify, merge, publish,      *\n * distribute, distribute with modifications, sublicense, and/or sell       *\n * copies of the Software, and to permit persons to whom the Software is    *\n * furnished to do so, subject to the following conditions:                 *\n *                                                                          *\n * The above copyright notice and this permission notice shall be included  *\n * in all copies or substantial portions of the Software.                   *\n *                                                                          *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS  *\n * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF               *\n * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.   *\n * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,   *\n * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR    *\n * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR    *\n * THE USE OR OTHER DEALINGS IN THE SOFTWARE.                               *\n *                                                                          *\n * Except as contained in this notice, the name(s) of the above copyright   *\n * holders shall not be used in advertising or otherwise to promote the     *\n * sale, use or other dealings in this Software without prior written       *\n * authorization.                                                           *\n ****************************************************************************/\n/* $Id: ncurses_dll.h,v 1.6 2007/03/10 19:21:49 tom Exp $ */\n\n#ifndef NCURSES_DLL_H_incl\n#define NCURSES_DLL_H_incl 1\n\n/* no longer needed on cygwin or mingw, thanks to auto-import       */\n/* but this structure may be useful at some point for an MSVC build */\n/* so, for now unconditionally define the important flags           */\n/* \"the right way\" for proper static and dll+auto-import behavior   */\n#undef NCURSES_DLL\n#define NCURSES_STATIC\n\n#if defined(__CYGWIN__)\n#  if defined(NCURSES_DLL)\n#    if defined(NCURSES_STATIC)\n#      undef NCURSES_STATIC\n#    endif\n#  endif\n#  undef NCURSES_IMPEXP\n#  undef NCURSES_API\n#  undef NCURSES_EXPORT\n#  undef NCURSES_EXPORT_VAR\n#  if defined(NCURSES_DLL)\n/* building a DLL */\n#    define NCURSES_IMPEXP __declspec(dllexport)\n#  elif defined(NCURSES_STATIC)\n/* building or linking to a static library */\n#    define NCURSES_IMPEXP /* nothing */\n#  else\n/* linking to the DLL */\n#    define NCURSES_IMPEXP __declspec(dllimport)\n#  endif\n#  define NCURSES_API __cdecl\n#  define NCURSES_EXPORT(type) NCURSES_IMPEXP type NCURSES_API\n#  define NCURSES_EXPORT_VAR(type) NCURSES_IMPEXP type\n#endif\n\n/* Take care of non-cygwin platforms */\n#if !defined(NCURSES_IMPEXP)\n#  define NCURSES_IMPEXP /* nothing */\n#endif\n#if !defined(NCURSES_API)\n#  define NCURSES_API /* nothing */\n#endif\n#if !defined(NCURSES_EXPORT)\n#  define NCURSES_EXPORT(type) NCURSES_IMPEXP type NCURSES_API\n#endif\n#if !defined(NCURSES_EXPORT_VAR)\n#  define NCURSES_EXPORT_VAR(type) NCURSES_IMPEXP type\n#endif\n\n/*\n * For reentrant code, we map the various global variables into SCREEN by\n * using functions to access them.\n */\n#define NCURSES_PUBLIC_VAR(name) _nc_##name\n#define NCURSES_WRAPPED_VAR(type,name) extern type NCURSES_PUBLIC_VAR(name)(void)\n\n#endif /* NCURSES_DLL_H_incl */\n"
  },
  {
    "path": "freebsd-headers/ndbm.h",
    "content": "/*-\n * Copyright (c) 1990, 1993\n *\tThe Regents of the University of California.  All rights reserved.\n *\n * This code is derived from software contributed to Berkeley by\n * Margo Seltzer.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t@(#)ndbm.h\t8.1 (Berkeley) 6/2/93\n * $FreeBSD: release/9.0.0/include/ndbm.h 203964 2010-02-16 19:39:50Z imp $\n */\n\n#ifndef _NDBM_H_\n#define\t_NDBM_H_\n\n#include <db.h>\n\n/* Map dbm interface onto db(3). */\n#define DBM_RDONLY\tO_RDONLY\n\n/* Flags to dbm_store(). */\n#define DBM_INSERT      0\n#define DBM_REPLACE     1\n\n/*\n * The db(3) support for ndbm always appends this suffix to the\n * file name to avoid overwriting the user's original database.\n */\n#define\tDBM_SUFFIX\t\".db\"\n\ntypedef struct {\n\tchar *dptr;\n\tint dsize;\n} datum;\n\ntypedef DB DBM;\n#define\tdbm_pagfno(a)\tDBM_PAGFNO_NOT_AVAILABLE\n\n__BEGIN_DECLS\nint\t dbm_clearerr(DBM *);\nvoid\t dbm_close(DBM *);\nint\t dbm_delete(DBM *, datum);\nint\t dbm_error(DBM *);\ndatum\t dbm_fetch(DBM *, datum);\ndatum\t dbm_firstkey(DBM *);\n#if __BSD_VISIBLE\nlong\t dbm_forder(DBM *, datum);\n#endif\ndatum\t dbm_nextkey(DBM *);\nDBM\t*dbm_open(const char *, int, int);\nint\t dbm_store(DBM *, datum, datum, int);\n#if __BSD_VISIBLE\nint\t dbm_dirfno(DBM *);\n#endif\n__END_DECLS\n\n#endif /* !_NDBM_H_ */\n"
  },
  {
    "path": "freebsd-headers/net/bpf.h",
    "content": "/*-\n * Copyright (c) 1990, 1991, 1993\n *\tThe Regents of the University of California.  All rights reserved.\n *\n * This code is derived from the Stanford/CMU enet packet filter,\n * (net/enet.c) distributed as part of 4.3BSD, and code contributed\n * to Berkeley by Steven McCanne and Van Jacobson both of Lawrence\n * Berkeley Laboratory.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 4. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *      @(#)bpf.h\t8.1 (Berkeley) 6/10/93\n *\t@(#)bpf.h\t1.34 (LBL)     6/16/96\n *\n * $FreeBSD: release/9.0.0/sys/net/bpf.h 214517 2010-10-29 18:41:09Z rpaulo $\n */\n\n#ifndef _NET_BPF_H_\n#define _NET_BPF_H_\n\n/* BSD style release date */\n#define\tBPF_RELEASE 199606\n\ntypedef\tint32_t\t  bpf_int32;\ntypedef\tu_int32_t bpf_u_int32;\ntypedef\tint64_t\t  bpf_int64;\ntypedef\tu_int64_t bpf_u_int64;\n\n/*\n * Alignment macros.  BPF_WORDALIGN rounds up to the next\n * even multiple of BPF_ALIGNMENT.\n */\n#define BPF_ALIGNMENT sizeof(long)\n#define BPF_WORDALIGN(x) (((x)+(BPF_ALIGNMENT-1))&~(BPF_ALIGNMENT-1))\n\n#define BPF_MAXINSNS 512\n#define BPF_MAXBUFSIZE 0x80000\n#define BPF_MINBUFSIZE 32\n\n/*\n *  Structure for BIOCSETF.\n */\nstruct bpf_program {\n\tu_int bf_len;\n\tstruct bpf_insn *bf_insns;\n};\n\n/*\n * Struct returned by BIOCGSTATS.\n */\nstruct bpf_stat {\n\tu_int bs_recv;\t\t/* number of packets received */\n\tu_int bs_drop;\t\t/* number of packets dropped */\n};\n\n/*\n * Struct return by BIOCVERSION.  This represents the version number of\n * the filter language described by the instruction encodings below.\n * bpf understands a program iff kernel_major == filter_major &&\n * kernel_minor >= filter_minor, that is, if the value returned by the\n * running kernel has the same major number and a minor number equal\n * equal to or less than the filter being downloaded.  Otherwise, the\n * results are undefined, meaning an error may be returned or packets\n * may be accepted haphazardly.\n * It has nothing to do with the source code version.\n */\nstruct bpf_version {\n\tu_short bv_major;\n\tu_short bv_minor;\n};\n/* Current version number of filter architecture. */\n#define BPF_MAJOR_VERSION 1\n#define BPF_MINOR_VERSION 1\n\n/*\n * Historically, BPF has supported a single buffering model, first using mbuf\n * clusters in kernel, and later using malloc(9) buffers in kernel.  We now\n * support multiple buffering modes, which may be queried and set using\n * BIOCGETBUFMODE and BIOCSETBUFMODE.  So as to avoid handling the complexity\n * of changing modes while sniffing packets, the mode becomes fixed once an\n * interface has been attached to the BPF descriptor.\n */\n#define\tBPF_BUFMODE_BUFFER\t1\t/* Kernel buffers with read(). */\n#define\tBPF_BUFMODE_ZBUF\t2\t/* Zero-copy buffers. */\n\n/*-\n * Struct used by BIOCSETZBUF, BIOCROTZBUF: describes up to two zero-copy\n * buffer as used by BPF.\n */\nstruct bpf_zbuf {\n\tvoid\t*bz_bufa;\t/* Location of 'a' zero-copy buffer. */\n\tvoid\t*bz_bufb;\t/* Location of 'b' zero-copy buffer. */\n\tsize_t\t bz_buflen;\t/* Size of zero-copy buffers. */\n};\n\n#define\tBIOCGBLEN\t_IOR('B', 102, u_int)\n#define\tBIOCSBLEN\t_IOWR('B', 102, u_int)\n#define\tBIOCSETF\t_IOW('B', 103, struct bpf_program)\n#define\tBIOCFLUSH\t_IO('B', 104)\n#define\tBIOCPROMISC\t_IO('B', 105)\n#define\tBIOCGDLT\t_IOR('B', 106, u_int)\n#define\tBIOCGETIF\t_IOR('B', 107, struct ifreq)\n#define\tBIOCSETIF\t_IOW('B', 108, struct ifreq)\n#define\tBIOCSRTIMEOUT\t_IOW('B', 109, struct timeval)\n#define\tBIOCGRTIMEOUT\t_IOR('B', 110, struct timeval)\n#define\tBIOCGSTATS\t_IOR('B', 111, struct bpf_stat)\n#define\tBIOCIMMEDIATE\t_IOW('B', 112, u_int)\n#define\tBIOCVERSION\t_IOR('B', 113, struct bpf_version)\n#define\tBIOCGRSIG\t_IOR('B', 114, u_int)\n#define\tBIOCSRSIG\t_IOW('B', 115, u_int)\n#define\tBIOCGHDRCMPLT\t_IOR('B', 116, u_int)\n#define\tBIOCSHDRCMPLT\t_IOW('B', 117, u_int)\n#define\tBIOCGDIRECTION\t_IOR('B', 118, u_int)\n#define\tBIOCSDIRECTION\t_IOW('B', 119, u_int)\n#define\tBIOCSDLT\t_IOW('B', 120, u_int)\n#define\tBIOCGDLTLIST\t_IOWR('B', 121, struct bpf_dltlist)\n#define\tBIOCLOCK\t_IO('B', 122)\n#define\tBIOCSETWF\t_IOW('B', 123, struct bpf_program)\n#define\tBIOCFEEDBACK\t_IOW('B', 124, u_int)\n#define\tBIOCGETBUFMODE\t_IOR('B', 125, u_int)\n#define\tBIOCSETBUFMODE\t_IOW('B', 126, u_int)\n#define\tBIOCGETZMAX\t_IOR('B', 127, size_t)\n#define\tBIOCROTZBUF\t_IOR('B', 128, struct bpf_zbuf)\n#define\tBIOCSETZBUF\t_IOW('B', 129, struct bpf_zbuf)\n#define\tBIOCSETFNR\t_IOW('B', 130, struct bpf_program)\n#define\tBIOCGTSTAMP\t_IOR('B', 131, u_int)\n#define\tBIOCSTSTAMP\t_IOW('B', 132, u_int)\n\n/* Obsolete */\n#define\tBIOCGSEESENT\tBIOCGDIRECTION\n#define\tBIOCSSEESENT\tBIOCSDIRECTION\n\n/* Packet directions */\nenum bpf_direction {\n\tBPF_D_IN,\t/* See incoming packets */\n\tBPF_D_INOUT,\t/* See incoming and outgoing packets */\n\tBPF_D_OUT\t/* See outgoing packets */\n};\n\n/* Time stamping functions */\n#define\tBPF_T_MICROTIME\t\t0x0000\n#define\tBPF_T_NANOTIME\t\t0x0001\n#define\tBPF_T_BINTIME\t\t0x0002\n#define\tBPF_T_NONE\t\t0x0003\n#define\tBPF_T_FORMAT_MASK\t0x0003\n#define\tBPF_T_NORMAL\t\t0x0000\n#define\tBPF_T_FAST\t\t0x0100\n#define\tBPF_T_MONOTONIC\t\t0x0200\n#define\tBPF_T_MONOTONIC_FAST\t(BPF_T_FAST | BPF_T_MONOTONIC)\n#define\tBPF_T_FLAG_MASK\t\t0x0300\n#define\tBPF_T_FORMAT(t)\t\t((t) & BPF_T_FORMAT_MASK)\n#define\tBPF_T_FLAG(t)\t\t((t) & BPF_T_FLAG_MASK)\n#define\tBPF_T_VALID(t)\t\t\t\t\t\t\\\n    ((t) == BPF_T_NONE || (BPF_T_FORMAT(t) != BPF_T_NONE &&\t\\\n    ((t) & ~(BPF_T_FORMAT_MASK | BPF_T_FLAG_MASK)) == 0))\n\n#define\tBPF_T_MICROTIME_FAST\t\t(BPF_T_MICROTIME | BPF_T_FAST)\n#define\tBPF_T_NANOTIME_FAST\t\t(BPF_T_NANOTIME | BPF_T_FAST)\n#define\tBPF_T_BINTIME_FAST\t\t(BPF_T_BINTIME | BPF_T_FAST)\n#define\tBPF_T_MICROTIME_MONOTONIC\t(BPF_T_MICROTIME | BPF_T_MONOTONIC)\n#define\tBPF_T_NANOTIME_MONOTONIC\t(BPF_T_NANOTIME | BPF_T_MONOTONIC)\n#define\tBPF_T_BINTIME_MONOTONIC\t\t(BPF_T_BINTIME | BPF_T_MONOTONIC)\n#define\tBPF_T_MICROTIME_MONOTONIC_FAST\t(BPF_T_MICROTIME | BPF_T_MONOTONIC_FAST)\n#define\tBPF_T_NANOTIME_MONOTONIC_FAST\t(BPF_T_NANOTIME | BPF_T_MONOTONIC_FAST)\n#define\tBPF_T_BINTIME_MONOTONIC_FAST\t(BPF_T_BINTIME | BPF_T_MONOTONIC_FAST)\n\n/*\n * Structure prepended to each packet.\n */\nstruct bpf_ts {\n\tbpf_int64\tbt_sec;\t\t/* seconds */\n\tbpf_u_int64\tbt_frac;\t/* fraction */\n};\nstruct bpf_xhdr {\n\tstruct bpf_ts\tbh_tstamp;\t/* time stamp */\n\tbpf_u_int32\tbh_caplen;\t/* length of captured portion */\n\tbpf_u_int32\tbh_datalen;\t/* original length of packet */\n\tu_short\t\tbh_hdrlen;\t/* length of bpf header (this struct\n\t\t\t\t\t   plus alignment padding) */\n};\n/* Obsolete */\nstruct bpf_hdr {\n\tstruct timeval\tbh_tstamp;\t/* time stamp */\n\tbpf_u_int32\tbh_caplen;\t/* length of captured portion */\n\tbpf_u_int32\tbh_datalen;\t/* original length of packet */\n\tu_short\t\tbh_hdrlen;\t/* length of bpf header (this struct\n\t\t\t\t\t   plus alignment padding) */\n};\n#ifdef _KERNEL\n#define\tMTAG_BPF\t\t0x627066\n#define\tMTAG_BPF_TIMESTAMP\t0\n#endif\n\n/*\n * When using zero-copy BPF buffers, a shared memory header is present\n * allowing the kernel BPF implementation and user process to synchronize\n * without using system calls.  This structure defines that header.  When\n * accessing these fields, appropriate atomic operation and memory barriers\n * are required in order not to see stale or out-of-order data; see bpf(4)\n * for reference code to access these fields from userspace.\n *\n * The layout of this structure is critical, and must not be changed; if must\n * fit in a single page on all architectures.\n */\nstruct bpf_zbuf_header {\n\tvolatile u_int\tbzh_kernel_gen;\t/* Kernel generation number. */\n\tvolatile u_int\tbzh_kernel_len;\t/* Length of data in the buffer. */\n\tvolatile u_int\tbzh_user_gen;\t/* User generation number. */\n\tu_int _bzh_pad[5];\n};\n\n/*\n * Data-link level type codes.\n */\n#define DLT_NULL\t0\t/* BSD loopback encapsulation */\n#define DLT_EN10MB\t1\t/* Ethernet (10Mb) */\n#define DLT_EN3MB\t2\t/* Experimental Ethernet (3Mb) */\n#define DLT_AX25\t3\t/* Amateur Radio AX.25 */\n#define DLT_PRONET\t4\t/* Proteon ProNET Token Ring */\n#define DLT_CHAOS\t5\t/* Chaos */\n#define DLT_IEEE802\t6\t/* IEEE 802 Networks */\n#define DLT_ARCNET\t7\t/* ARCNET */\n#define DLT_SLIP\t8\t/* Serial Line IP */\n#define DLT_PPP\t\t9\t/* Point-to-point Protocol */\n#define DLT_FDDI\t10\t/* FDDI */\n#define DLT_ATM_RFC1483\t11\t/* LLC/SNAP encapsulated atm */\n#define DLT_RAW\t\t12\t/* raw IP */\n\n/*\n * These are values from BSD/OS's \"bpf.h\".\n * These are not the same as the values from the traditional libpcap\n * \"bpf.h\"; however, these values shouldn't be generated by any\n * OS other than BSD/OS, so the correct values to use here are the\n * BSD/OS values.\n *\n * Platforms that have already assigned these values to other\n * DLT_ codes, however, should give these codes the values\n * from that platform, so that programs that use these codes will\n * continue to compile - even though they won't correctly read\n * files of these types.\n */\n#define DLT_SLIP_BSDOS\t15\t/* BSD/OS Serial Line IP */\n#define DLT_PPP_BSDOS\t16\t/* BSD/OS Point-to-point Protocol */\n\n#define DLT_ATM_CLIP\t19\t/* Linux Classical-IP over ATM */\n\n/*\n * These values are defined by NetBSD; other platforms should refrain from\n * using them for other purposes, so that NetBSD savefiles with link\n * types of 50 or 51 can be read as this type on all platforms.\n */\n#define DLT_PPP_SERIAL\t50\t/* PPP over serial with HDLC encapsulation */\n#define DLT_PPP_ETHER\t51\t/* PPP over Ethernet */\n\n/*\n * Reserved for the Symantec Enterprise Firewall.\n */\n#define DLT_SYMANTEC_FIREWALL\t99\n\n\n/*\n * This value was defined by libpcap 0.5; platforms that have defined\n * it with a different value should define it here with that value -\n * a link type of 104 in a save file will be mapped to DLT_C_HDLC,\n * whatever value that happens to be, so programs will correctly\n * handle files with that link type regardless of the value of\n * DLT_C_HDLC.\n *\n * The name DLT_C_HDLC was used by BSD/OS; we use that name for source\n * compatibility with programs written for BSD/OS.\n *\n * libpcap 0.5 defined it as DLT_CHDLC; we define DLT_CHDLC as well,\n * for source compatibility with programs written for libpcap 0.5.\n */\n#define DLT_C_HDLC\t104\t/* Cisco HDLC */\n#define DLT_CHDLC\tDLT_C_HDLC\n\n#define DLT_IEEE802_11\t105\t/* IEEE 802.11 wireless */\n\n/*\n * Values between 106 and 107 are used in capture file headers as\n * link-layer types corresponding to DLT_ types that might differ\n * between platforms; don't use those values for new DLT_ new types.\n */\n\n/*\n * Frame Relay; BSD/OS has a DLT_FR with a value of 11, but that collides\n * with other values.\n * DLT_FR and DLT_FRELAY packets start with the Q.922 Frame Relay header\n * (DLCI, etc.).\n */\n#define DLT_FRELAY\t107\n\n/*\n * OpenBSD DLT_LOOP, for loopback devices; it's like DLT_NULL, except\n * that the AF_ type in the link-layer header is in network byte order.\n *\n * OpenBSD defines it as 12, but that collides with DLT_RAW, so we\n * define it as 108 here.  If OpenBSD picks up this file, it should\n * define DLT_LOOP as 12 in its version, as per the comment above -\n * and should not use 108 as a DLT_ value.\n */\n#define DLT_LOOP\t108\n\n/*\n * Values between 109 and 112 are used in capture file headers as\n * link-layer types corresponding to DLT_ types that might differ\n * between platforms; don't use those values for new DLT_ new types.\n */\n\n/*\n * Encapsulated packets for IPsec; DLT_ENC is 13 in OpenBSD, but that's\n * DLT_SLIP_BSDOS in NetBSD, so we don't use 13 for it in OSes other\n * than OpenBSD.\n */\n#define DLT_ENC\t109\n\n/*\n * This is for Linux cooked sockets.\n */\n#define DLT_LINUX_SLL\t113\n\n/*\n * Apple LocalTalk hardware.\n */\n#define DLT_LTALK\t114\n\n/*\n * Acorn Econet.\n */\n#define DLT_ECONET\t115\n\n/*\n * Reserved for use with OpenBSD ipfilter.\n */\n#define DLT_IPFILTER\t116\n\n/*\n * Reserved for use in capture-file headers as a link-layer type\n * corresponding to OpenBSD DLT_PFLOG; DLT_PFLOG is 17 in OpenBSD,\n * but that's DLT_LANE8023 in SuSE 6.3, so we can't use 17 for it\n * in capture-file headers.\n */\n#define DLT_PFLOG\t117\n\n/*\n * Registered for Cisco-internal use.\n */\n#define DLT_CISCO_IOS\t118\n\n/*\n * Reserved for 802.11 cards using the Prism II chips, with a link-layer\n * header including Prism monitor mode information plus an 802.11\n * header.\n */\n#define DLT_PRISM_HEADER\t119\n\n/*\n * Reserved for Aironet 802.11 cards, with an Aironet link-layer header\n * (see Doug Ambrisko's FreeBSD patches).\n */\n#define DLT_AIRONET_HEADER\t120\n\n/*\n * Reserved for use by OpenBSD's pfsync device.\n */\n#define DLT_PFSYNC\t121\n\n/*\n * Reserved for Siemens HiPath HDLC. XXX\n */\n#define DLT_HHDLC\t121\n\n/*\n * Reserved for RFC 2625 IP-over-Fibre Channel.\n */\n#define DLT_IP_OVER_FC\t122\n\n/*\n * Reserved for Full Frontal ATM on Solaris.\n */\n#define DLT_SUNATM\t123\n\n/*\n * Reserved as per request from Kent Dahlgren <kent@praesum.com>\n * for private use.\n */\n#define DLT_RIO\t\t124\t/* RapidIO */\n#define DLT_PCI_EXP\t125\t/* PCI Express */\n#define DLT_AURORA\t126\t/* Xilinx Aurora link layer */\n\n/*\n * BSD header for 802.11 plus a number of bits of link-layer information\n * including radio information.\n */\n#ifndef DLT_IEEE802_11_RADIO\n#define DLT_IEEE802_11_RADIO\t127\n#endif\n\n/*\n * Reserved for TZSP encapsulation.\n */\n#define DLT_TZSP\t\t128\t/* Tazmen Sniffer Protocol */\n\n/*\n * Reserved for Linux ARCNET.\n */\n#define DLT_ARCNET_LINUX\t129\n\n/*\n * Juniper-private data link types.\n */\n#define DLT_JUNIPER_MLPPP\t130\n#define DLT_JUNIPER_MLFR\t131\n#define DLT_JUNIPER_ES\t\t132\n#define DLT_JUNIPER_GGSN\t133\n#define DLT_JUNIPER_MFR\t\t134\n#define DLT_JUNIPER_ATM2\t135\n#define DLT_JUNIPER_SERVICES\t136\n#define DLT_JUNIPER_ATM1\t137\n\n/*\n * Apple IP-over-IEEE 1394, as per a request from Dieter Siegmund\n * <dieter@apple.com>.  The header that's presented is an Ethernet-like\n * header:\n *\n *\t#define FIREWIRE_EUI64_LEN\t8\n *\tstruct firewire_header {\n *\t\tu_char  firewire_dhost[FIREWIRE_EUI64_LEN];\n *\t\tu_char  firewire_shost[FIREWIRE_EUI64_LEN];\n *\t\tu_short firewire_type;\n *\t};\n *\n * with \"firewire_type\" being an Ethernet type value, rather than,\n * for example, raw GASP frames being handed up.\n */\n#define DLT_APPLE_IP_OVER_IEEE1394\t138\n\n/*\n * Various SS7 encapsulations, as per a request from Jeff Morriss\n * <jeff.morriss[AT]ulticom.com> and subsequent discussions.\n */\n#define DLT_MTP2_WITH_PHDR\t139\t/* pseudo-header with various info, followed by MTP2 */\n#define DLT_MTP2\t\t140\t/* MTP2, without pseudo-header */\n#define DLT_MTP3\t\t141\t/* MTP3, without pseudo-header or MTP2 */\n#define DLT_SCCP\t\t142\t/* SCCP, without pseudo-header or MTP2 or MTP3 */\n\n/*\n * Reserved for DOCSIS.\n */\n#define DLT_DOCSIS\t143\n\n/*\n * Reserved for Linux IrDA.\n */\n#define DLT_LINUX_IRDA\t144\n\n/*\n * Reserved for IBM SP switch and IBM Next Federation switch.\n */\n#define DLT_IBM_SP\t145\n#define DLT_IBM_SN\t146\n\n/*\n * Reserved for private use.  If you have some link-layer header type\n * that you want to use within your organization, with the capture files\n * using that link-layer header type not ever be sent outside your\n * organization, you can use these values.\n *\n * No libpcap release will use these for any purpose, nor will any\n * tcpdump release use them, either.\n *\n * Do *NOT* use these in capture files that you expect anybody not using\n * your private versions of capture-file-reading tools to read; in\n * particular, do *NOT* use them in products, otherwise you may find that\n * people won't be able to use tcpdump, or snort, or Ethereal, or... to\n * read capture files from your firewall/intrusion detection/traffic\n * monitoring/etc. appliance, or whatever product uses that DLT_ value,\n * and you may also find that the developers of those applications will\n * not accept patches to let them read those files.\n *\n * Also, do not use them if somebody might send you a capture using them\n * for *their* private type and tools using them for *your* private type\n * would have to read them.\n *\n * Instead, ask \"tcpdump-workers@tcpdump.org\" for a new DLT_ value,\n * as per the comment above, and use the type you're given.\n */\n#define DLT_USER0\t\t147\n#define DLT_USER1\t\t148\n#define DLT_USER2\t\t149\n#define DLT_USER3\t\t150\n#define DLT_USER4\t\t151\n#define DLT_USER5\t\t152\n#define DLT_USER6\t\t153\n#define DLT_USER7\t\t154\n#define DLT_USER8\t\t155\n#define DLT_USER9\t\t156\n#define DLT_USER10\t\t157\n#define DLT_USER11\t\t158\n#define DLT_USER12\t\t159\n#define DLT_USER13\t\t160\n#define DLT_USER14\t\t161\n#define DLT_USER15\t\t162\n\n/*\n * For future use with 802.11 captures - defined by AbsoluteValue\n * Systems to store a number of bits of link-layer information\n * including radio information:\n *\n *\thttp://www.shaftnet.org/~pizza/software/capturefrm.txt\n *\n * but it might be used by some non-AVS drivers now or in the\n * future.\n */\n#define DLT_IEEE802_11_RADIO_AVS 163\t/* 802.11 plus AVS radio header */\n\n/*\n * Juniper-private data link type, as per request from\n * Hannes Gredler <hannes@juniper.net>.  The DLT_s are used\n * for passing on chassis-internal metainformation such as\n * QOS profiles, etc..\n */\n#define DLT_JUNIPER_MONITOR     164\n\n/*\n * Reserved for BACnet MS/TP.\n */\n#define DLT_BACNET_MS_TP\t165\n\n/*\n * Another PPP variant as per request from Karsten Keil <kkeil@suse.de>.\n *\n * This is used in some OSes to allow a kernel socket filter to distinguish\n * between incoming and outgoing packets, on a socket intended to\n * supply pppd with outgoing packets so it can do dial-on-demand and\n * hangup-on-lack-of-demand; incoming packets are filtered out so they\n * don't cause pppd to hold the connection up (you don't want random\n * input packets such as port scans, packets from old lost connections,\n * etc. to force the connection to stay up).\n *\n * The first byte of the PPP header (0xff03) is modified to accomodate\n * the direction - 0x00 = IN, 0x01 = OUT.\n */\n#define DLT_PPP_PPPD\t\t166\n\n/*\n * Names for backwards compatibility with older versions of some PPP\n * software; new software should use DLT_PPP_PPPD.\n */\n#define DLT_PPP_WITH_DIRECTION\tDLT_PPP_PPPD\n#define DLT_LINUX_PPP_WITHDIRECTION\tDLT_PPP_PPPD\n\n/*\n * Juniper-private data link type, as per request from\n * Hannes Gredler <hannes@juniper.net>.  The DLT_s are used\n * for passing on chassis-internal metainformation such as\n * QOS profiles, cookies, etc..\n */\n#define DLT_JUNIPER_PPPOE       167\n#define DLT_JUNIPER_PPPOE_ATM   168\n\n#define DLT_GPRS_LLC\t\t169\t/* GPRS LLC */\n#define DLT_GPF_T\t\t170\t/* GPF-T (ITU-T G.7041/Y.1303) */\n#define DLT_GPF_F\t\t171\t/* GPF-F (ITU-T G.7041/Y.1303) */\n\n/*\n * Requested by Oolan Zimmer <oz@gcom.com> for use in Gcom's T1/E1 line\n * monitoring equipment.\n */\n#define DLT_GCOM_T1E1\t\t172\n#define DLT_GCOM_SERIAL\t\t173\n\n/*\n * Juniper-private data link type, as per request from\n * Hannes Gredler <hannes@juniper.net>.  The DLT_ is used\n * for internal communication to Physical Interface Cards (PIC)\n */\n#define DLT_JUNIPER_PIC_PEER    174\n\n/*\n * Link types requested by Gregor Maier <gregor@endace.com> of Endace\n * Measurement Systems.  They add an ERF header (see\n * http://www.endace.com/support/EndaceRecordFormat.pdf) in front of\n * the link-layer header.\n */\n#define DLT_ERF_ETH\t\t175\t/* Ethernet */\n#define DLT_ERF_POS\t\t176\t/* Packet-over-SONET */\n\n/*\n * Requested by Daniele Orlandi <daniele@orlandi.com> for raw LAPD\n * for vISDN (http://www.orlandi.com/visdn/).  Its link-layer header\n * includes additional information before the LAPD header, so it's\n * not necessarily a generic LAPD header.\n */\n#define DLT_LINUX_LAPD\t\t177\n\n/*\n * Juniper-private data link type, as per request from\n * Hannes Gredler <hannes@juniper.net>.\n * The DLT_ are used for prepending meta-information\n * like interface index, interface name\n * before standard Ethernet, PPP, Frelay & C-HDLC Frames\n */\n#define DLT_JUNIPER_ETHER       178\n#define DLT_JUNIPER_PPP         179\n#define DLT_JUNIPER_FRELAY      180\n#define DLT_JUNIPER_CHDLC       181\n\n/*\n * Multi Link Frame Relay (FRF.16)\n */\n#define DLT_MFR                 182\n\n/*\n * Juniper-private data link type, as per request from\n * Hannes Gredler <hannes@juniper.net>.\n * The DLT_ is used for internal communication with a\n * voice Adapter Card (PIC)\n */\n#define DLT_JUNIPER_VP          183\n\n/*\n * Arinc 429 frames.\n * DLT_ requested by Gianluca Varenni <gianluca.varenni@cacetech.com>.\n * Every frame contains a 32bit A429 label.\n * More documentation on Arinc 429 can be found at\n * http://www.condoreng.com/support/downloads/tutorials/ARINCTutorial.pdf\n */\n#define DLT_A429                184\n\n/*\n * Arinc 653 Interpartition Communication messages.\n * DLT_ requested by Gianluca Varenni <gianluca.varenni@cacetech.com>.\n * Please refer to the A653-1 standard for more information.\n */\n#define DLT_A653_ICM            185\n\n/*\n * USB packets, beginning with a USB setup header; requested by\n * Paolo Abeni <paolo.abeni@email.it>.\n */\n#define DLT_USB\t\t\t186\n\n/*\n * Bluetooth HCI UART transport layer (part H:4); requested by\n * Paolo Abeni.\n */\n#define DLT_BLUETOOTH_HCI_H4\t187\n\n/*\n * IEEE 802.16 MAC Common Part Sublayer; requested by Maria Cruz\n * <cruz_petagay@bah.com>.\n */\n#define DLT_IEEE802_16_MAC_CPS\t188\n\n/*\n * USB packets, beginning with a Linux USB header; requested by\n * Paolo Abeni <paolo.abeni@email.it>.\n */\n#define DLT_USB_LINUX\t\t189\n\n/*\n * Controller Area Network (CAN) v. 2.0B packets.\n * DLT_ requested by Gianluca Varenni <gianluca.varenni@cacetech.com>.\n * Used to dump CAN packets coming from a CAN Vector board.\n * More documentation on the CAN v2.0B frames can be found at\n * http://www.can-cia.org/downloads/?269\n */\n#define DLT_CAN20B              190\n\n/*\n * IEEE 802.15.4, with address fields padded, as is done by Linux\n * drivers; requested by Juergen Schimmer.\n */\n#define DLT_IEEE802_15_4_LINUX\t191\n\n/*\n * Per Packet Information encapsulated packets.\n * DLT_ requested by Gianluca Varenni <gianluca.varenni@cacetech.com>.\n */\n#define DLT_PPI\t\t\t192\n\n/*\n * Header for 802.16 MAC Common Part Sublayer plus a radiotap radio header;\n * requested by Charles Clancy.\n */\n#define DLT_IEEE802_16_MAC_CPS_RADIO\t193\n\n/*\n * Juniper-private data link type, as per request from\n * Hannes Gredler <hannes@juniper.net>.\n * The DLT_ is used for internal communication with a\n * integrated service module (ISM).\n */\n#define DLT_JUNIPER_ISM         194\n\n/*\n * IEEE 802.15.4, exactly as it appears in the spec (no padding, no\n * nothing); requested by Mikko Saarnivala <mikko.saarnivala@sensinode.com>.\n */\n#define DLT_IEEE802_15_4\t195\n\n/*\n * Various link-layer types, with a pseudo-header, for SITA\n * (http://www.sita.aero/); requested by Fulko Hew (fulko.hew@gmail.com).\n */\n#define DLT_SITA\t\t196\n\n/*\n * Various link-layer types, with a pseudo-header, for Endace DAG cards;\n * encapsulates Endace ERF records.  Requested by Stephen Donnelly\n * <stephen@endace.com>.\n */\n#define DLT_ERF\t\t\t197\n\n/*\n * Special header prepended to Ethernet packets when capturing from a\n * u10 Networks board.  Requested by Phil Mulholland\n * <phil@u10networks.com>.\n */\n#define DLT_RAIF1\t\t198\n\n/*\n * IPMB packet for IPMI, beginning with the I2C slave address, followed\n * by the netFn and LUN, etc..  Requested by Chanthy Toeung\n * <chanthy.toeung@ca.kontron.com>.\n */\n#define DLT_IPMB\t\t199\n\n/*\n * Juniper-private data link type, as per request from\n * Hannes Gredler <hannes@juniper.net>.\n * The DLT_ is used for capturing data on a secure tunnel interface.\n */\n#define DLT_JUNIPER_ST          200\n\n/*\n * Bluetooth HCI UART transport layer (part H:4), with pseudo-header\n * that includes direction information; requested by Paolo Abeni.\n */\n#define DLT_BLUETOOTH_HCI_H4_WITH_PHDR\t201\n\n/*\n * AX.25 packet with a 1-byte KISS header; see\n *\n *      http://www.ax25.net/kiss.htm\n *\n * as per Richard Stearn <richard@rns-stearn.demon.co.uk>.\n */\n#define DLT_AX25_KISS           202\n\n/*\n * LAPD packets from an ISDN channel, starting with the address field,\n * with no pseudo-header.\n * Requested by Varuna De Silva <varunax@gmail.com>.\n */\n#define DLT_LAPD                203\n\n/*\n * Variants of various link-layer headers, with a one-byte direction\n * pseudo-header prepended - zero means \"received by this host\",\n * non-zero (any non-zero value) means \"sent by this host\" - as per\n * Will Barker <w.barker@zen.co.uk>.\n */\n#define DLT_PPP_WITH_DIR        204     /* PPP - don't confuse with DLT_PPP_WITH_DIRECTION */\n#define DLT_C_HDLC_WITH_DIR     205     /* Cisco HDLC */\n#define DLT_FRELAY_WITH_DIR     206     /* Frame Relay */\n#define DLT_LAPB_WITH_DIR       207     /* LAPB */\n\n/*\n * 208 is reserved for an as-yet-unspecified proprietary link-layer\n * type, as requested by Will Barker.\n */\n\n/*\n * IPMB with a Linux-specific pseudo-header; as requested by Alexey Neyman\n * <avn@pigeonpoint.com>.\n */\n#define DLT_IPMB_LINUX          209\n\n/*\n * FlexRay automotive bus - http://www.flexray.com/ - as requested\n * by Hannes Kaelber <hannes.kaelber@x2e.de>.\n */\n#define DLT_FLEXRAY             210\n\n/*\n * Media Oriented Systems Transport (MOST) bus for multimedia\n * transport - http://www.mostcooperation.com/ - as requested\n * by Hannes Kaelber <hannes.kaelber@x2e.de>.\n */\n#define DLT_MOST                211\n\n/*\n * Local Interconnect Network (LIN) bus for vehicle networks -\n * http://www.lin-subbus.org/ - as requested by Hannes Kaelber\n * <hannes.kaelber@x2e.de>.\n */\n#define DLT_LIN                 212\n\n/*\n * X2E-private data link type used for serial line capture,\n * as requested by Hannes Kaelber <hannes.kaelber@x2e.de>.\n */\n#define DLT_X2E_SERIAL          213\n\n/*\n * X2E-private data link type used for the Xoraya data logger\n * family, as requested by Hannes Kaelber <hannes.kaelber@x2e.de>.\n */\n#define DLT_X2E_XORAYA          214\n\n/*\n * IEEE 802.15.4, exactly as it appears in the spec (no padding, no\n * nothing), but with the PHY-level data for non-ASK PHYs (4 octets\n * of 0 as preamble, one octet of SFD, one octet of frame length+\n * reserved bit, and then the MAC-layer data, starting with the\n * frame control field).\n *\n * Requested by Max Filippov <jcmvbkbc@gmail.com>.\n */\n#define DLT_IEEE802_15_4_NONASK_PHY     215\n\n/* \n * David Gibson <david@gibson.dropbear.id.au> requested this for\n * captures from the Linux kernel /dev/input/eventN devices. This\n * is used to communicate keystrokes and mouse movements from the\n * Linux kernel to display systems, such as Xorg. \n */\n#define\tDLT_LINUX_EVDEV\t\t216\n\n/*\n * GSM Um and Abis interfaces, preceded by a \"gsmtap\" header.\n *\n * Requested by Harald Welte <laforge@gnumonks.org>.\n */\n#define\tDLT_GSMTAP_UM\t\t217\n#define\tDLT_GSMTAP_ABIS\t\t218\n\n/*\n * MPLS, with an MPLS label as the link-layer header.\n * Requested by Michele Marchetto <michele@openbsd.org> on behalf\n * of OpenBSD.\n */\n#define\tDLT_MPLS\t\t219\n\n/*\n * USB packets, beginning with a Linux USB header, with the USB header\n * padded to 64 bytes; required for memory-mapped access.\n */\n#define\tDLT_USB_LINUX_MMAPPED\t220\n\n/*\n * DECT packets, with a pseudo-header; requested by\n * Matthias Wenzel <tcpdump@mazzoo.de>.\n */\n#define\tDLT_DECT\t\t221\n/*\n * From: \"Lidwa, Eric (GSFC-582.0)[SGT INC]\" <eric.lidwa-1@nasa.gov>\n * Date: Mon, 11 May 2009 11:18:30 -0500\n *\n * DLT_AOS. We need it for AOS Space Data Link Protocol.\n *   I have already written dissectors for but need an OK from\n *   legal before I can submit a patch.\n *\n */\n#define\tDLT_AOS\t\t\t222\n\n/*\n * Wireless HART (Highway Addressable Remote Transducer)\n * From the HART Communication Foundation\n * IES/PAS 62591\n *\n * Requested by Sam Roberts <vieuxtech@gmail.com>.\n */\n#define\tDLT_WIHART\t\t223\n\n/*\n * Fibre Channel FC-2 frames, beginning with a Frame_Header.\n * Requested by Kahou Lei <kahou82@gmail.com>.\n */\n#define\tDLT_FC_2\t\t224\n\n/*\n * Fibre Channel FC-2 frames, beginning with an encoding of the\n * SOF, and ending with an encoding of the EOF.\n *\n * The encodings represent the frame delimiters as 4-byte sequences\n * representing the corresponding ordered sets, with K28.5\n * represented as 0xBC, and the D symbols as the corresponding\n * byte values; for example, SOFi2, which is K28.5 - D21.5 - D1.2 - D21.2,\n * is represented as 0xBC 0xB5 0x55 0x55.\n *\n * Requested by Kahou Lei <kahou82@gmail.com>.\n */\n#define\tDLT_FC_2_WITH_FRAME_DELIMS\t225\n/*\n * Solaris ipnet pseudo-header; requested by Darren Reed <Darren.Reed@Sun.COM>.\n *\n * The pseudo-header starts with a one-byte version number; for version 2,\n * the pseudo-header is:\n *\n * struct dl_ipnetinfo {\n *     u_int8_t   dli_version;\n *     u_int8_t   dli_family;\n *     u_int16_t  dli_htype;\n *     u_int32_t  dli_pktlen;\n *     u_int32_t  dli_ifindex;\n *     u_int32_t  dli_grifindex;\n *     u_int32_t  dli_zsrc;\n *     u_int32_t  dli_zdst;\n * };\n *\n * dli_version is 2 for the current version of the pseudo-header.\n *\n * dli_family is a Solaris address family value, so it's 2 for IPv4\n * and 26 for IPv6.\n *\n * dli_htype is a \"hook type\" - 0 for incoming packets, 1 for outgoing\n * packets, and 2 for packets arriving from another zone on the same\n * machine.\n *\n * dli_pktlen is the length of the packet data following the pseudo-header\n * (so the captured length minus dli_pktlen is the length of the\n * pseudo-header, assuming the entire pseudo-header was captured).\n *\n * dli_ifindex is the interface index of the interface on which the\n * packet arrived.\n *\n * dli_grifindex is the group interface index number (for IPMP interfaces).\n *\n * dli_zsrc is the zone identifier for the source of the packet.\n *\n * dli_zdst is the zone identifier for the destination of the packet.\n *\n * A zone number of 0 is the global zone; a zone number of 0xffffffff\n * means that the packet arrived from another host on the network, not\n * from another zone on the same machine.\n *\n * An IPv4 or IPv6 datagram follows the pseudo-header; dli_family indicates\n * which of those it is.\n */\n#define\tDLT_IPNET\t\t\t226\n\n/*\n * CAN (Controller Area Network) frames, with a pseudo-header as supplied\n * by Linux SocketCAN.  See Documentation/networking/can.txt in the Linux\n * source.\n *\n * Requested by Felix Obenhuber <felix@obenhuber.de>.\n */\n#define\tDLT_CAN_SOCKETCAN\t\t227\n\n/*\n * Raw IPv4/IPv6; different from DLT_RAW in that the DLT_ value specifies\n * whether it's v4 or v6.  Requested by Darren Reed <Darren.Reed@Sun.COM>.\n */\n#define\tDLT_IPV4\t\t\t228\n#define\tDLT_IPV6\t\t\t229\n\n/*\n * DLT and savefile link type values are split into a class and\n * a member of that class.  A class value of 0 indicates a regular\n * DLT_/LINKTYPE_ value.\n */\n#define DLT_CLASS(x)            ((x) & 0x03ff0000)\n\n/*\n * The instruction encodings.\n */\n/* instruction classes */\n#define BPF_CLASS(code) ((code) & 0x07)\n#define\t\tBPF_LD\t\t0x00\n#define\t\tBPF_LDX\t\t0x01\n#define\t\tBPF_ST\t\t0x02\n#define\t\tBPF_STX\t\t0x03\n#define\t\tBPF_ALU\t\t0x04\n#define\t\tBPF_JMP\t\t0x05\n#define\t\tBPF_RET\t\t0x06\n#define\t\tBPF_MISC\t0x07\n\n/* ld/ldx fields */\n#define BPF_SIZE(code)\t((code) & 0x18)\n#define\t\tBPF_W\t\t0x00\n#define\t\tBPF_H\t\t0x08\n#define\t\tBPF_B\t\t0x10\n#define BPF_MODE(code)\t((code) & 0xe0)\n#define\t\tBPF_IMM \t0x00\n#define\t\tBPF_ABS\t\t0x20\n#define\t\tBPF_IND\t\t0x40\n#define\t\tBPF_MEM\t\t0x60\n#define\t\tBPF_LEN\t\t0x80\n#define\t\tBPF_MSH\t\t0xa0\n\n/* alu/jmp fields */\n#define BPF_OP(code)\t((code) & 0xf0)\n#define\t\tBPF_ADD\t\t0x00\n#define\t\tBPF_SUB\t\t0x10\n#define\t\tBPF_MUL\t\t0x20\n#define\t\tBPF_DIV\t\t0x30\n#define\t\tBPF_OR\t\t0x40\n#define\t\tBPF_AND\t\t0x50\n#define\t\tBPF_LSH\t\t0x60\n#define\t\tBPF_RSH\t\t0x70\n#define\t\tBPF_NEG\t\t0x80\n#define\t\tBPF_JA\t\t0x00\n#define\t\tBPF_JEQ\t\t0x10\n#define\t\tBPF_JGT\t\t0x20\n#define\t\tBPF_JGE\t\t0x30\n#define\t\tBPF_JSET\t0x40\n#define BPF_SRC(code)\t((code) & 0x08)\n#define\t\tBPF_K\t\t0x00\n#define\t\tBPF_X\t\t0x08\n\n/* ret - BPF_K and BPF_X also apply */\n#define BPF_RVAL(code)\t((code) & 0x18)\n#define\t\tBPF_A\t\t0x10\n\n/* misc */\n#define BPF_MISCOP(code) ((code) & 0xf8)\n#define\t\tBPF_TAX\t\t0x00\n#define\t\tBPF_TXA\t\t0x80\n\n/*\n * The instruction data structure.\n */\nstruct bpf_insn {\n\tu_short\t\tcode;\n\tu_char\t\tjt;\n\tu_char\t\tjf;\n\tbpf_u_int32\tk;\n};\n\n/*\n * Macros for insn array initializers.\n */\n#define BPF_STMT(code, k) { (u_short)(code), 0, 0, k }\n#define BPF_JUMP(code, k, jt, jf) { (u_short)(code), jt, jf, k }\n\n/*\n * Structure to retrieve available DLTs for the interface.\n */\nstruct bpf_dltlist {\n\tu_int\tbfl_len;\t/* number of bfd_list array */\n\tu_int\t*bfl_list;\t/* array of DLTs */\n};\n\n#ifdef _KERNEL\n#ifdef MALLOC_DECLARE\nMALLOC_DECLARE(M_BPF);\n#endif\n#ifdef SYSCTL_DECL\nSYSCTL_DECL(_net_bpf);\n#endif\n\n/*\n * Rotate the packet buffers in descriptor d.  Move the store buffer into the\n * hold slot, and the free buffer ino the store slot.  Zero the length of the\n * new store buffer.  Descriptor lock should be held.\n */\n#define\tROTATE_BUFFERS(d)\tdo {\t\t\t\t\t\\\n\t(d)->bd_hbuf = (d)->bd_sbuf;\t\t\t\t\t\\\n\t(d)->bd_hlen = (d)->bd_slen;\t\t\t\t\t\\\n\t(d)->bd_sbuf = (d)->bd_fbuf;\t\t\t\t\t\\\n\t(d)->bd_slen = 0;\t\t\t\t\t\t\\\n\t(d)->bd_fbuf = NULL;\t\t\t\t\t\t\\\n\tbpf_bufheld(d);\t\t\t\t\t\t\t\\\n} while (0)\n\n/*\n * Descriptor associated with each attached hardware interface.\n */\nstruct bpf_if {\n\tLIST_ENTRY(bpf_if)\tbif_next;\t/* list of all interfaces */\n\tLIST_HEAD(, bpf_d)\tbif_dlist;\t/* descriptor list */\n\tu_int bif_dlt;\t\t\t\t/* link layer type */\n\tu_int bif_hdrlen;\t\t/* length of link header */\n\tstruct ifnet *bif_ifp;\t\t/* corresponding interface */\n\tstruct mtx\tbif_mtx;\t/* mutex for interface */\n};\n\nvoid\t bpf_bufheld(struct bpf_d *d);\nint\t bpf_validate(const struct bpf_insn *, int);\nvoid\t bpf_tap(struct bpf_if *, u_char *, u_int);\nvoid\t bpf_mtap(struct bpf_if *, struct mbuf *);\nvoid\t bpf_mtap2(struct bpf_if *, void *, u_int, struct mbuf *);\nvoid\t bpfattach(struct ifnet *, u_int, u_int);\nvoid\t bpfattach2(struct ifnet *, u_int, u_int, struct bpf_if **);\nvoid\t bpfdetach(struct ifnet *);\n\nvoid\t bpfilterattach(int);\nu_int\t bpf_filter(const struct bpf_insn *, u_char *, u_int, u_int);\n\nstatic __inline int\nbpf_peers_present(struct bpf_if *bpf)\n{\n\n\tif (!LIST_EMPTY(&bpf->bif_dlist))\n\t\treturn (1);\n\treturn (0);\n}\n\n#define\tBPF_TAP(_ifp,_pkt,_pktlen) do {\t\t\t\t\\\n\tif (bpf_peers_present((_ifp)->if_bpf))\t\t\t\\\n\t\tbpf_tap((_ifp)->if_bpf, (_pkt), (_pktlen));\t\\\n} while (0)\n#define\tBPF_MTAP(_ifp,_m) do {\t\t\t\t\t\\\n\tif (bpf_peers_present((_ifp)->if_bpf)) {\t\t\\\n\t\tM_ASSERTVALID(_m);\t\t\t\t\\\n\t\tbpf_mtap((_ifp)->if_bpf, (_m));\t\t\t\\\n\t}\t\t\t\t\t\t\t\\\n} while (0)\n#define\tBPF_MTAP2(_ifp,_data,_dlen,_m) do {\t\t\t\\\n\tif (bpf_peers_present((_ifp)->if_bpf)) {\t\t\\\n\t\tM_ASSERTVALID(_m);\t\t\t\t\\\n\t\tbpf_mtap2((_ifp)->if_bpf,(_data),(_dlen),(_m));\t\\\n\t}\t\t\t\t\t\t\t\\\n} while (0)\n#endif\n\n/*\n * Number of scratch memory words (for BPF_LD|BPF_MEM and BPF_ST).\n */\n#define BPF_MEMWORDS 16\n\n#endif /* _NET_BPF_H_ */\n"
  },
  {
    "path": "freebsd-headers/net/bpf_buffer.h",
    "content": "/*-\n * Copyright (c) 2007 Seccuris Inc.\n * All rights reserved.\n *\n * This sofware was developed by Robert N. M. Watson under contract to\n * Seccuris Inc.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/net/bpf_buffer.h 177548 2008-03-24 13:49:17Z csjp $\n */\n\n#ifndef _NET_BPF_BUFFER_H_\n#define\t_NET_BPF_BUFFER_H_\n\n#ifndef _KERNEL\n#error \"no user-serviceable parts inside\"\n#endif\n\nvoid\tbpf_buffer_alloc(struct bpf_d *d);\nvoid\tbpf_buffer_append_bytes(struct bpf_d *d, caddr_t buf, u_int offset,\n\t    void *src, u_int len);\nvoid\tbpf_buffer_append_mbuf(struct bpf_d *d, caddr_t buf, u_int offset,\n\t    void *src, u_int len);\nvoid\tbpf_buffer_free(struct bpf_d *d);\nvoid\tbpf_buffer_init(struct bpf_d *d);\nint\tbpf_buffer_ioctl_sblen(struct bpf_d *d, u_int *i);\nint\tbpf_buffer_uiomove(struct bpf_d *d, caddr_t buf, u_int len,\n\t    struct uio *uio);\n\n#endif /* !_NET_BPF_BUFFER_H_ */\n"
  },
  {
    "path": "freebsd-headers/net/bpf_jitter.h",
    "content": "/*-\n * Copyright (C) 2002-2003 NetGroup, Politecnico di Torino (Italy)\n * Copyright (C) 2005-2009 Jung-uk Kim <jkim@FreeBSD.org>\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n *\n * 1. Redistributions of source code must retain the above copyright\n * notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n * notice, this list of conditions and the following disclaimer in the\n * documentation and/or other materials provided with the distribution.\n * 3. Neither the name of the Politecnico di Torino nor the names of its\n * contributors may be used to endorse or promote products derived from\n * this software without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n * \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/net/bpf_jitter.h 199603 2009-11-20 18:49:20Z jkim $\n */\n\n#ifndef _NET_BPF_JITTER_H_\n#define _NET_BPF_JITTER_H_\n\n#ifdef _KERNEL\nMALLOC_DECLARE(M_BPFJIT);\n#endif\n\nextern int bpf_jitter_enable;\n\n/*\n * Prototype of a filtering function created by the jitter.\n *\n * The syntax and the meaning of the parameters is analogous to the one of\n * bpf_filter(). Notice that the filter is not among the parameters because\n * it is hardwired in the function.\n */\ntypedef u_int (*bpf_filter_func)(u_char *, u_int, u_int);\n\n/* Structure describing a native filtering program created by the jitter. */\ntypedef struct bpf_jit_filter {\n\t/* The native filtering binary, in the form of a bpf_filter_func. */\n\tbpf_filter_func\tfunc;\n\tsize_t\t\tsize;\n} bpf_jit_filter;\n\n/*\n * BPF jitter, builds a machine function from a BPF program.\n *\n * param fp\tThe BPF pseudo-assembly filter that will be translated\n *\t\tinto native code.\n * param nins\tNumber of instructions of the input filter.\n * return\tThe bpf_jit_filter structure containing the native filtering\n *\t\tbinary.\n *\n * bpf_jitter allocates the buffers for the new native filter and\n * then translates the program pointed by fp calling bpf_jit_compile().\n */\nbpf_jit_filter\t*bpf_jitter(struct bpf_insn *fp, int nins);\n\n/*\n * Deletes a filtering function that was previously created by bpf_jitter().\n *\n * param filter\tThe filter to destroy.\n *\n * This function frees the variuos buffers (code, memory, etc.) associated\n * with a filtering function.\n */\nvoid\t\tbpf_destroy_jit_filter(bpf_jit_filter *filter);\n\n#endif\t/* _NET_BPF_JITTER_H_ */\n"
  },
  {
    "path": "freebsd-headers/net/bpf_zerocopy.h",
    "content": "/*-\n * Copyright (c) 2007 Seccuris Inc.\n * All rights reserved.\n *\n * This sofware was developed by Robert N. M. Watson under contract to\n * Seccuris Inc.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/net/bpf_zerocopy.h 180310 2008-07-05 20:11:28Z csjp $\n */\n\n#ifndef _NET_BPF_ZEROCOPY_H_\n#define\t_NET_BPF_ZEROCOPY_H_\n\n#ifndef _KERNEL\n#error \"no user-serviceable parts inside\"\n#endif\n\nvoid\tbpf_zerocopy_append_bytes(struct bpf_d *d, caddr_t buf, u_int offset,\n\t    void *src, u_int len);\nvoid\tbpf_zerocopy_append_mbuf(struct bpf_d *d, caddr_t buf, u_int offset,\n\t    void *src, u_int len);\nvoid\tbpf_zerocopy_buffull(struct bpf_d *);\nvoid\tbpf_zerocopy_bufheld(struct bpf_d *);\nvoid\tbpf_zerocopy_buf_reclaimed(struct bpf_d *);\nint\tbpf_zerocopy_canfreebuf(struct bpf_d *);\nint\tbpf_zerocopy_canwritebuf(struct bpf_d *);\nvoid\tbpf_zerocopy_free(struct bpf_d *d);\nint\tbpf_zerocopy_ioctl_getzmax(struct thread *td, struct bpf_d *d,\n\t    size_t *i);\nint\tbpf_zerocopy_ioctl_rotzbuf(struct thread *td, struct bpf_d *d,\n\t    struct bpf_zbuf *bz);\nint\tbpf_zerocopy_ioctl_setzbuf(struct thread *td, struct bpf_d *d,\n\t    struct bpf_zbuf *bz);\n\n#endif /* !_NET_BPF_ZEROCOPY_H_ */\n"
  },
  {
    "path": "freebsd-headers/net/bpfdesc.h",
    "content": "/*-\n * Copyright (c) 1990, 1991, 1993\n *\tThe Regents of the University of California.  All rights reserved.\n *\n * This code is derived from the Stanford/CMU enet packet filter,\n * (net/enet.c) distributed as part of 4.3BSD, and code contributed\n * to Berkeley by Steven McCanne and Van Jacobson both of Lawrence\n * Berkeley Laboratory.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 4. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *      @(#)bpfdesc.h\t8.1 (Berkeley) 6/10/93\n *\n * $FreeBSD: release/9.0.0/sys/net/bpfdesc.h 209216 2010-06-15 19:28:44Z jkim $\n */\n\n#ifndef _NET_BPFDESC_H_\n#define _NET_BPFDESC_H_\n\n#include <sys/callout.h>\n#include <sys/selinfo.h>\n#include <sys/queue.h>\n#include <sys/conf.h>\n#include <net/if.h>\n\n/*\n * Descriptor associated with each open bpf file.\n */\nstruct zbuf;\nstruct bpf_d {\n\tLIST_ENTRY(bpf_d) bd_next;\t/* Linked list of descriptors */\n\t/*\n\t * Buffer slots: two memory buffers store the incoming packets.\n\t *   The model has three slots.  Sbuf is always occupied.\n\t *   sbuf (store) - Receive interrupt puts packets here.\n\t *   hbuf (hold) - When sbuf is full, put buffer here and\n\t *                 wakeup read (replace sbuf with fbuf).\n\t *   fbuf (free) - When read is done, put buffer here.\n\t * On receiving, if sbuf is full and fbuf is 0, packet is dropped.\n\t */\n\tcaddr_t\t\tbd_sbuf;\t/* store slot */\n\tcaddr_t\t\tbd_hbuf;\t/* hold slot */\n\tcaddr_t\t\tbd_fbuf;\t/* free slot */\n\tint \t\tbd_slen;\t/* current length of store buffer */\n\tint \t\tbd_hlen;\t/* current length of hold buffer */\n\n\tint\t\tbd_bufsize;\t/* absolute length of buffers */\n\n\tstruct bpf_if *\tbd_bif;\t\t/* interface descriptor */\n\tu_long\t\tbd_rtout;\t/* Read timeout in 'ticks' */\n\tstruct bpf_insn *bd_rfilter; \t/* read filter code */\n\tstruct bpf_insn *bd_wfilter;\t/* write filter code */\n\tvoid\t\t*bd_bfilter;\t/* binary filter code */\n\tu_int64_t\tbd_rcount;\t/* number of packets received */\n\tu_int64_t\tbd_dcount;\t/* number of packets dropped */\n\n\tu_char\t\tbd_promisc;\t/* true if listening promiscuously */\n\tu_char\t\tbd_state;\t/* idle, waiting, or timed out */\n\tu_char\t\tbd_immediate;\t/* true to return on packet arrival */\n\tint\t\tbd_hdrcmplt;\t/* false to fill in src lladdr automatically */\n\tint\t\tbd_direction;\t/* select packet direction */\n\tint\t\tbd_tstamp;\t/* select time stamping function */\n\tint\t\tbd_feedback;\t/* true to feed back sent packets */\n\tint\t\tbd_async;\t/* non-zero if packet reception should generate signal */\n\tint\t\tbd_sig;\t\t/* signal to send upon packet reception */\n\tstruct sigio *\tbd_sigio;\t/* information for async I/O */\n\tstruct selinfo\tbd_sel;\t\t/* bsd select info */\n\tstruct mtx\tbd_mtx;\t\t/* mutex for this descriptor */\n\tstruct callout\tbd_callout;\t/* for BPF timeouts with select */\n\tstruct label\t*bd_label;\t/* MAC label for descriptor */\n\tu_int64_t\tbd_fcount;\t/* number of packets which matched filter */\n\tpid_t\t\tbd_pid;\t\t/* PID which created descriptor */\n\tint\t\tbd_locked;\t/* true if descriptor is locked */\n\tu_int\t\tbd_bufmode;\t/* Current buffer mode. */\n\tu_int64_t\tbd_wcount;\t/* number of packets written */\n\tu_int64_t\tbd_wfcount;\t/* number of packets that matched write filter */\n\tu_int64_t\tbd_wdcount;\t/* number of packets dropped during a write */\n\tu_int64_t\tbd_zcopy;\t/* number of zero copy operations */\n\tu_char\t\tbd_compat32;\t/* 32-bit stream on LP64 system */\n};\n\n/* Values for bd_state */\n#define BPF_IDLE\t0\t\t/* no select in progress */\n#define BPF_WAITING\t1\t\t/* waiting for read timeout in select */\n#define BPF_TIMED_OUT\t2\t\t/* read timeout has expired in select */\n\n#define BPFD_LOCK(bd)\t\tmtx_lock(&(bd)->bd_mtx)\n#define BPFD_UNLOCK(bd)\t\tmtx_unlock(&(bd)->bd_mtx)\n#define BPFD_LOCK_ASSERT(bd)\tmtx_assert(&(bd)->bd_mtx, MA_OWNED)\n\n/*\n * External representation of the bpf descriptor\n */\nstruct xbpf_d {\n\tu_int\t\tbd_structsize;\t/* Size of this structure. */\n\tu_char\t\tbd_promisc;\n\tu_char\t\tbd_immediate;\n\tu_char\t\t__bd_pad[6];\n\tint\t\tbd_hdrcmplt;\n\tint\t\tbd_direction;\n\tint\t\tbd_feedback;\n\tint\t\tbd_async;\n\tu_int64_t\tbd_rcount;\n\tu_int64_t\tbd_dcount;\n\tu_int64_t\tbd_fcount;\n\tint\t\tbd_sig;\n\tint\t\tbd_slen;\n\tint\t\tbd_hlen;\n\tint\t\tbd_bufsize;\n\tpid_t\t\tbd_pid;\n\tchar\t\tbd_ifname[IFNAMSIZ];\n\tint\t\tbd_locked;\n\tu_int64_t\tbd_wcount;\n\tu_int64_t\tbd_wfcount;\n\tu_int64_t\tbd_wdcount;\n\tu_int64_t\tbd_zcopy;\n\tint\t\tbd_bufmode;\n\t/*\n\t * Allocate 4 64 bit unsigned integers for future expansion so we do\n\t * not have to worry about breaking the ABI.\n\t */\n\tu_int64_t\tbd_spare[4];\n};\n\n#define BPFIF_LOCK(bif)\t\tmtx_lock(&(bif)->bif_mtx)\n#define BPFIF_UNLOCK(bif)\tmtx_unlock(&(bif)->bif_mtx)\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/net/bridgestp.h",
    "content": "/*\t$NetBSD: if_bridgevar.h,v 1.4 2003/07/08 07:13:50 itojun Exp $\t*/\n\n/*\n * Copyright 2001 Wasabi Systems, Inc.\n * All rights reserved.\n *\n * Written by Jason R. Thorpe for Wasabi Systems, Inc.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. All advertising materials mentioning features or use of this software\n *    must display the following acknowledgement:\n *\tThis product includes software developed for the NetBSD Project by\n *\tWasabi Systems, Inc.\n * 4. The name of Wasabi Systems, Inc. may not be used to endorse\n *    or promote products derived from this software without specific prior\n *    written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY WASABI SYSTEMS, INC. ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED\n * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\n * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL WASABI SYSTEMS, INC\n * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\n * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\n * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\n * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\n * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\n/*\n * Copyright (c) 1999, 2000 Jason L. Wright (jason@thought.net)\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. All advertising materials mentioning features or use of this software\n *    must display the following acknowledgement:\n *\tThis product includes software developed by Jason L. Wright\n * 4. The name of the author may not be used to endorse or promote products\n *    derived from this software without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR\n * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\n * DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR\n * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,\n * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n *\n * OpenBSD: if_bridge.h,v 1.14 2001/03/22 03:48:29 jason Exp\n *\n * $FreeBSD: release/9.0.0/sys/net/bridgestp.h 222834 2011-06-07 20:46:03Z zec $\n */\n\n/*\n * Data structure and control definitions for STP interfaces.\n */\n\n#include <sys/callout.h>\n#include <sys/queue.h>\n\n/* STP port states */\n#define\tBSTP_IFSTATE_DISABLED\t0\n#define\tBSTP_IFSTATE_LISTENING\t1\n#define\tBSTP_IFSTATE_LEARNING\t2\n#define\tBSTP_IFSTATE_FORWARDING\t3\n#define\tBSTP_IFSTATE_BLOCKING\t4\n#define\tBSTP_IFSTATE_DISCARDING\t5\n\n#define\tBSTP_TCSTATE_ACTIVE\t1\n#define\tBSTP_TCSTATE_DETECTED\t2\n#define\tBSTP_TCSTATE_INACTIVE\t3\n#define\tBSTP_TCSTATE_LEARNING\t4\n#define\tBSTP_TCSTATE_PROPAG\t5\n#define\tBSTP_TCSTATE_ACK\t6\n#define\tBSTP_TCSTATE_TC\t\t7\n#define\tBSTP_TCSTATE_TCN\t8\n\n#define\tBSTP_ROLE_DISABLED\t0\n#define\tBSTP_ROLE_ROOT\t\t1\n#define\tBSTP_ROLE_DESIGNATED\t2\n#define\tBSTP_ROLE_ALTERNATE\t3\n#define\tBSTP_ROLE_BACKUP\t4\n\n#ifdef _KERNEL\n\n/* STP port flags */\n#define\tBSTP_PORT_CANMIGRATE\t0x0001\n#define\tBSTP_PORT_NEWINFO\t0x0002\n#define\tBSTP_PORT_DISPUTED\t0x0004\n#define\tBSTP_PORT_ADMCOST\t0x0008\n#define\tBSTP_PORT_AUTOEDGE\t0x0010\n#define\tBSTP_PORT_AUTOPTP\t0x0020\n#define\tBSTP_PORT_ADMEDGE\t0x0040\n#define\tBSTP_PORT_PNDCOST\t0x0080\n\n/* BPDU priority */\n#define\tBSTP_PDU_SUPERIOR\t1\n#define\tBSTP_PDU_REPEATED\t2\n#define\tBSTP_PDU_INFERIOR\t3\n#define\tBSTP_PDU_INFERIORALT\t4\n#define\tBSTP_PDU_OTHER\t\t5\n\n/* BPDU flags */\n#define\tBSTP_PDU_PRMASK\t\t0x0c\t\t/* Port Role */\n#define\tBSTP_PDU_PRSHIFT\t2\t\t/* Port Role offset */\n#define\tBSTP_PDU_F_UNKN\t\t0x00\t\t/* Unknown port    (00) */\n#define\tBSTP_PDU_F_ALT\t\t0x01\t\t/* Alt/Backup port (01) */\n#define\tBSTP_PDU_F_ROOT\t\t0x02\t\t/* Root port       (10) */\n#define\tBSTP_PDU_F_DESG\t\t0x03\t\t/* Designated port (11) */\n\n#define\tBSTP_PDU_STPMASK\t0x81\t\t/* strip unused STP flags */\n#define\tBSTP_PDU_RSTPMASK\t0x7f\t\t/* strip unused RSTP flags */\n#define\tBSTP_PDU_F_TC\t\t0x01\t\t/* Topology change */\n#define\tBSTP_PDU_F_P\t\t0x02\t\t/* Proposal flag */\n#define\tBSTP_PDU_F_L\t\t0x10\t\t/* Learning flag */\n#define\tBSTP_PDU_F_F\t\t0x20\t\t/* Forwarding flag */\n#define\tBSTP_PDU_F_A\t\t0x40\t\t/* Agreement flag */\n#define\tBSTP_PDU_F_TCA\t\t0x80\t\t/* Topology change ack */\n\n/*\n * Spanning tree defaults.\n */\n#define\tBSTP_DEFAULT_MAX_AGE\t\t(20 * 256)\n#define\tBSTP_DEFAULT_HELLO_TIME\t\t(2 * 256)\n#define\tBSTP_DEFAULT_FORWARD_DELAY\t(15 * 256)\n#define\tBSTP_DEFAULT_HOLD_TIME\t\t(1 * 256)\n#define\tBSTP_DEFAULT_MIGRATE_DELAY\t(3 * 256)\n#define\tBSTP_DEFAULT_HOLD_COUNT\t\t6\n#define\tBSTP_DEFAULT_BRIDGE_PRIORITY\t0x8000\n#define\tBSTP_DEFAULT_PORT_PRIORITY\t0x80\n#define\tBSTP_DEFAULT_PATH_COST\t\t55\n#define\tBSTP_MIN_HELLO_TIME\t\t(1 * 256)\n#define\tBSTP_MIN_MAX_AGE\t\t(6 * 256)\n#define\tBSTP_MIN_FORWARD_DELAY\t\t(4 * 256)\n#define\tBSTP_MIN_HOLD_COUNT\t\t1\n#define\tBSTP_MAX_HELLO_TIME\t\t(2 * 256)\n#define\tBSTP_MAX_MAX_AGE\t\t(40 * 256)\n#define\tBSTP_MAX_FORWARD_DELAY\t\t(30 * 256)\n#define\tBSTP_MAX_HOLD_COUNT\t\t10\n#define\tBSTP_MAX_PRIORITY\t\t61440\n#define\tBSTP_MAX_PORT_PRIORITY\t\t240\n#define\tBSTP_MAX_PATH_COST\t\t200000000\n\n/* BPDU message types */\n#define\tBSTP_MSGTYPE_CFG\t0x00\t\t/* Configuration */\n#define\tBSTP_MSGTYPE_RSTP\t0x02\t\t/* Rapid STP */\n#define\tBSTP_MSGTYPE_TCN\t0x80\t\t/* Topology chg notification */\n\n/* Protocol versions */\n#define\tBSTP_PROTO_ID\t\t0x00\n#define\tBSTP_PROTO_STP\t\t0x00\n#define\tBSTP_PROTO_RSTP\t\t0x02\n#define\tBSTP_PROTO_MAX\t\tBSTP_PROTO_RSTP\n\n#define\tBSTP_INFO_RECEIVED\t1\n#define\tBSTP_INFO_MINE\t\t2\n#define\tBSTP_INFO_AGED\t\t3\n#define\tBSTP_INFO_DISABLED\t4\n\n\n#define\tBSTP_MESSAGE_AGE_INCR\t(1 * 256)\t/* in 256ths of a second */\n#define\tBSTP_TICK_VAL\t\t(1 * 256)\t/* in 256ths of a second */\n#define\tBSTP_LINK_TIMER\t\t(BSTP_TICK_VAL * 15)\n\n/*\n * Driver callbacks for STP state changes\n */\ntypedef void (*bstp_state_cb_t)(struct ifnet *, int);\ntypedef void (*bstp_rtage_cb_t)(struct ifnet *, int);\nstruct bstp_cb_ops {\n\tbstp_state_cb_t\tbcb_state;\n\tbstp_rtage_cb_t\tbcb_rtage;\n};\n\n/*\n * Because BPDU's do not make nicely aligned structures, two different\n * declarations are used: bstp_?bpdu (wire representation, packed) and\n * bstp_*_unit (internal, nicely aligned version).\n */\n\n/* configuration bridge protocol data unit */\nstruct bstp_cbpdu {\n\tuint8_t\t\tcbu_dsap;\t\t/* LLC: destination sap */\n\tuint8_t\t\tcbu_ssap;\t\t/* LLC: source sap */\n\tuint8_t\t\tcbu_ctl;\t\t/* LLC: control */\n\tuint16_t\tcbu_protoid;\t\t/* protocol id */\n\tuint8_t\t\tcbu_protover;\t\t/* protocol version */\n\tuint8_t\t\tcbu_bpdutype;\t\t/* message type */\n\tuint8_t\t\tcbu_flags;\t\t/* flags (below) */\n\n\t/* root id */\n\tuint16_t\tcbu_rootpri;\t\t/* root priority */\n\tuint8_t\t\tcbu_rootaddr[6];\t/* root address */\n\n\tuint32_t\tcbu_rootpathcost;\t/* root path cost */\n\n\t/* bridge id */\n\tuint16_t\tcbu_bridgepri;\t\t/* bridge priority */\n\tuint8_t\t\tcbu_bridgeaddr[6];\t/* bridge address */\n\n\tuint16_t\tcbu_portid;\t\t/* port id */\n\tuint16_t\tcbu_messageage;\t\t/* current message age */\n\tuint16_t\tcbu_maxage;\t\t/* maximum age */\n\tuint16_t\tcbu_hellotime;\t\t/* hello time */\n\tuint16_t\tcbu_forwarddelay;\t/* forwarding delay */\n\tuint8_t\t\tcbu_versionlen;\t\t/* version 1 length */\n} __packed;\n#define\tBSTP_BPDU_STP_LEN\t(3 + 35)\t/* LLC + STP pdu */\n#define\tBSTP_BPDU_RSTP_LEN\t(3 + 36)\t/* LLC + RSTP pdu */\n\n/* topology change notification bridge protocol data unit */\nstruct bstp_tbpdu {\n\tuint8_t\t\ttbu_dsap;\t\t/* LLC: destination sap */\n\tuint8_t\t\ttbu_ssap;\t\t/* LLC: source sap */\n\tuint8_t\t\ttbu_ctl;\t\t/* LLC: control */\n\tuint16_t\ttbu_protoid;\t\t/* protocol id */\n\tuint8_t\t\ttbu_protover;\t\t/* protocol version */\n\tuint8_t\t\ttbu_bpdutype;\t\t/* message type */\n} __packed;\n\n/*\n * Timekeeping structure used in spanning tree code.\n */\nstruct bstp_timer {\n\tint\t\tactive;\n\tint\t\tlatched;\n\tint\t\tvalue;\n};\n\nstruct bstp_pri_vector {\n\tuint64_t\t\tpv_root_id;\n\tuint32_t\t\tpv_cost;\n\tuint64_t\t\tpv_dbridge_id;\n\tuint16_t\t\tpv_dport_id;\n\tuint16_t\t\tpv_port_id;\n};\n\nstruct bstp_config_unit {\n\tstruct bstp_pri_vector\tcu_pv;\n\tuint16_t\tcu_message_age;\n\tuint16_t\tcu_max_age;\n\tuint16_t\tcu_forward_delay;\n\tuint16_t\tcu_hello_time;\n\tuint8_t\t\tcu_message_type;\n\tuint8_t\t\tcu_topology_change_ack;\n\tuint8_t\t\tcu_topology_change;\n\tuint8_t\t\tcu_proposal;\n\tuint8_t\t\tcu_agree;\n\tuint8_t\t\tcu_learning;\n\tuint8_t\t\tcu_forwarding;\n\tuint8_t\t\tcu_role;\n};\n\nstruct bstp_tcn_unit {\n\tuint8_t\t\ttu_message_type;\n};\n\nstruct bstp_port {\n\tLIST_ENTRY(bstp_port)\tbp_next;\n\tstruct ifnet\t\t*bp_ifp;\t/* parent if */\n\tstruct bstp_state\t*bp_bs;\n\tuint8_t\t\t\tbp_active;\n\tuint8_t\t\t\tbp_protover;\n\tuint32_t\t\tbp_flags;\n\tuint32_t\t\tbp_path_cost;\n\tuint16_t\t\tbp_port_msg_age;\n\tuint16_t\t\tbp_port_max_age;\n\tuint16_t\t\tbp_port_fdelay;\n\tuint16_t\t\tbp_port_htime;\n\tuint16_t\t\tbp_desg_msg_age;\n\tuint16_t\t\tbp_desg_max_age;\n\tuint16_t\t\tbp_desg_fdelay;\n\tuint16_t\t\tbp_desg_htime;\n\tstruct bstp_timer\tbp_edge_delay_timer;\n\tstruct bstp_timer\tbp_forward_delay_timer;\n\tstruct bstp_timer\tbp_hello_timer;\n\tstruct bstp_timer\tbp_message_age_timer;\n\tstruct bstp_timer\tbp_migrate_delay_timer;\n\tstruct bstp_timer\tbp_recent_backup_timer;\n\tstruct bstp_timer\tbp_recent_root_timer;\n\tstruct bstp_timer\tbp_tc_timer;\n\tstruct bstp_config_unit bp_msg_cu;\n\tstruct bstp_pri_vector\tbp_desg_pv;\n\tstruct bstp_pri_vector\tbp_port_pv;\n\tuint16_t\t\tbp_port_id;\n\tuint8_t\t\t\tbp_state;\n\tuint8_t\t\t\tbp_tcstate;\n\tuint8_t\t\t\tbp_role;\n\tuint8_t\t\t\tbp_infois;\n\tuint8_t\t\t\tbp_tc_ack;\n\tuint8_t\t\t\tbp_tc_prop;\n\tuint8_t\t\t\tbp_fdbflush;\n\tuint8_t\t\t\tbp_priority;\n\tuint8_t\t\t\tbp_ptp_link;\n\tuint8_t\t\t\tbp_agree;\n\tuint8_t\t\t\tbp_agreed;\n\tuint8_t\t\t\tbp_sync;\n\tuint8_t\t\t\tbp_synced;\n\tuint8_t\t\t\tbp_proposing;\n\tuint8_t\t\t\tbp_proposed;\n\tuint8_t\t\t\tbp_operedge;\n\tuint8_t\t\t\tbp_reroot;\n\tuint8_t\t\t\tbp_rcvdtc;\n\tuint8_t\t\t\tbp_rcvdtca;\n\tuint8_t\t\t\tbp_rcvdtcn;\n\tuint32_t\t\tbp_forward_transitions;\n\tuint8_t\t\t\tbp_txcount;\n\tstruct task\t\tbp_statetask;\n\tstruct task\t\tbp_rtagetask;\n};\n\n/*\n * Software state for each bridge STP.\n */\nstruct bstp_state {\n\tLIST_ENTRY(bstp_state)\tbs_list;\n\tuint8_t\t\t\tbs_running;\n\tstruct mtx\t\tbs_mtx;\n\tstruct bstp_pri_vector\tbs_bridge_pv;\n\tstruct bstp_pri_vector\tbs_root_pv;\n\tstruct bstp_port\t*bs_root_port;\n\tuint8_t\t\t\tbs_protover;\n\tuint16_t\t\tbs_migration_delay;\n\tuint16_t\t\tbs_edge_delay;\n\tuint16_t\t\tbs_bridge_max_age;\n\tuint16_t\t\tbs_bridge_fdelay;\n\tuint16_t\t\tbs_bridge_htime;\n\tuint16_t\t\tbs_root_msg_age;\n\tuint16_t\t\tbs_root_max_age;\n\tuint16_t\t\tbs_root_fdelay;\n\tuint16_t\t\tbs_root_htime;\n\tuint16_t\t\tbs_hold_time;\n\tuint16_t\t\tbs_bridge_priority;\n\tuint8_t\t\t\tbs_txholdcount;\n\tuint8_t\t\t\tbs_allsynced;\n\tstruct callout\t\tbs_bstpcallout;\t/* STP callout */\n\tstruct bstp_timer\tbs_link_timer;\n\tstruct timeval\t\tbs_last_tc_time;\n\tLIST_HEAD(, bstp_port)\tbs_bplist;\n\tbstp_state_cb_t\t\tbs_state_cb;\n\tbstp_rtage_cb_t\t\tbs_rtage_cb;\n\tstruct vnet\t\t*bs_vnet;\n};\n\n#define\tBSTP_LOCK_INIT(_bs)\tmtx_init(&(_bs)->bs_mtx, \"bstp\", NULL, MTX_DEF)\n#define\tBSTP_LOCK_DESTROY(_bs)\tmtx_destroy(&(_bs)->bs_mtx)\n#define\tBSTP_LOCK(_bs)\t\tmtx_lock(&(_bs)->bs_mtx)\n#define\tBSTP_UNLOCK(_bs)\tmtx_unlock(&(_bs)->bs_mtx)\n#define\tBSTP_LOCK_ASSERT(_bs)\tmtx_assert(&(_bs)->bs_mtx, MA_OWNED)\n\nextern const uint8_t bstp_etheraddr[];\n\nextern\tvoid (*bstp_linkstate_p)(struct ifnet *ifp, int state);\n\nvoid\tbstp_attach(struct bstp_state *, struct bstp_cb_ops *);\nvoid\tbstp_detach(struct bstp_state *);\nvoid\tbstp_init(struct bstp_state *);\nvoid\tbstp_stop(struct bstp_state *);\nint\tbstp_create(struct bstp_state *, struct bstp_port *, struct ifnet *);\nint\tbstp_enable(struct bstp_port *);\nvoid\tbstp_disable(struct bstp_port *);\nvoid\tbstp_destroy(struct bstp_port *);\nvoid\tbstp_linkstate(struct ifnet *, int);\nint\tbstp_set_htime(struct bstp_state *, int);\nint\tbstp_set_fdelay(struct bstp_state *, int);\nint\tbstp_set_maxage(struct bstp_state *, int);\nint\tbstp_set_holdcount(struct bstp_state *, int);\nint\tbstp_set_protocol(struct bstp_state *, int);\nint\tbstp_set_priority(struct bstp_state *, int);\nint\tbstp_set_port_priority(struct bstp_port *, int);\nint\tbstp_set_path_cost(struct bstp_port *, uint32_t);\nint\tbstp_set_edge(struct bstp_port *, int);\nint\tbstp_set_autoedge(struct bstp_port *, int);\nint\tbstp_set_ptp(struct bstp_port *, int);\nint\tbstp_set_autoptp(struct bstp_port *, int);\nstruct mbuf *bstp_input(struct bstp_port *, struct ifnet *, struct mbuf *);\n\n#endif /* _KERNEL */\n"
  },
  {
    "path": "freebsd-headers/net/ethernet.h",
    "content": "/*\n * Fundamental constants relating to ethernet.\n *\n * $FreeBSD: release/9.0.0/sys/net/ethernet.h 191148 2009-04-16 20:30:28Z kmacy $\n *\n */\n\n#ifndef _NET_ETHERNET_H_\n#define _NET_ETHERNET_H_\n\n/*\n * Some basic Ethernet constants.\n */\n#define\tETHER_ADDR_LEN\t\t6\t/* length of an Ethernet address */\n#define\tETHER_TYPE_LEN\t\t2\t/* length of the Ethernet type field */\n#define\tETHER_CRC_LEN\t\t4\t/* length of the Ethernet CRC */\n#define\tETHER_HDR_LEN\t\t(ETHER_ADDR_LEN*2+ETHER_TYPE_LEN)\n#define\tETHER_MIN_LEN\t\t64\t/* minimum frame len, including CRC */\n#define\tETHER_MAX_LEN\t\t1518\t/* maximum frame len, including CRC */\n#define\tETHER_MAX_LEN_JUMBO\t9018\t/* max jumbo frame len, including CRC */\n\n#define\tETHER_VLAN_ENCAP_LEN\t4\t/* len of 802.1Q VLAN encapsulation */\n/*\n * Mbuf adjust factor to force 32-bit alignment of IP header.\n * Drivers should do m_adj(m, ETHER_ALIGN) when setting up a\n * receive so the upper layers get the IP header properly aligned\n * past the 14-byte Ethernet header.\n */\n#define\tETHER_ALIGN\t\t2\t/* driver adjust for IP hdr alignment */\n\n/*\n * Compute the maximum frame size based on ethertype (i.e. possible\n * encapsulation) and whether or not an FCS is present.\n */\n#define\tETHER_MAX_FRAME(ifp, etype, hasfcs)\t\t\t\t\\\n\t((ifp)->if_mtu + ETHER_HDR_LEN +\t\t\t\t\\\n\t ((hasfcs) ? ETHER_CRC_LEN : 0) +\t\t\t\t\\\n\t (((etype) == ETHERTYPE_VLAN) ? ETHER_VLAN_ENCAP_LEN : 0))\n\n/*\n * Ethernet-specific mbuf flags.\n */\n#define\tM_HASFCS\tM_PROTO5\t/* FCS included at end of frame */\n\n/*\n * Ethernet CRC32 polynomials (big- and little-endian verions).\n */\n#define\tETHER_CRC_POLY_LE\t0xedb88320\n#define\tETHER_CRC_POLY_BE\t0x04c11db6\n\n/*\n * A macro to validate a length with\n */\n#define\tETHER_IS_VALID_LEN(foo)\t\\\n\t((foo) >= ETHER_MIN_LEN && (foo) <= ETHER_MAX_LEN)\n\n/*\n * Structure of a 10Mb/s Ethernet header.\n */\nstruct ether_header {\n\tu_char\tether_dhost[ETHER_ADDR_LEN];\n\tu_char\tether_shost[ETHER_ADDR_LEN];\n\tu_short\tether_type;\n} __packed;\n\n/*\n * Structure of a 48-bit Ethernet address.\n */\nstruct ether_addr {\n\tu_char octet[ETHER_ADDR_LEN];\n} __packed;\n\n#define\tETHER_IS_MULTICAST(addr) (*(addr) & 0x01) /* is address mcast/bcast? */\n\n/*\n *  NOTE: 0x0000-0x05DC (0..1500) are generally IEEE 802.3 length fields.\n *  However, there are some conflicts.\n */\n\n#define\tETHERTYPE_8023\t\t0x0004\t/* IEEE 802.3 packet */\n\t\t   /* 0x0101 .. 0x1FF\t   Experimental */\n#define\tETHERTYPE_PUP\t\t0x0200\t/* Xerox PUP protocol - see 0A00 */\n#define\tETHERTYPE_PUPAT\t\t0x0200\t/* PUP Address Translation - see 0A01 */\n#define\tETHERTYPE_SPRITE\t0x0500\t/* ??? */\n\t\t\t     /* 0x0400\t   Nixdorf */\n#define\tETHERTYPE_NS\t\t0x0600\t/* XNS */\n#define\tETHERTYPE_NSAT\t\t0x0601\t/* XNS Address Translation (3Mb only) */\n#define\tETHERTYPE_DLOG1 \t0x0660\t/* DLOG (?) */\n#define\tETHERTYPE_DLOG2 \t0x0661\t/* DLOG (?) */\n#define\tETHERTYPE_IP\t\t0x0800\t/* IP protocol */\n#define\tETHERTYPE_X75\t\t0x0801\t/* X.75 Internet */\n#define\tETHERTYPE_NBS\t\t0x0802\t/* NBS Internet */\n#define\tETHERTYPE_ECMA\t\t0x0803\t/* ECMA Internet */\n#define\tETHERTYPE_CHAOS \t0x0804\t/* CHAOSnet */\n#define\tETHERTYPE_X25\t\t0x0805\t/* X.25 Level 3 */\n#define\tETHERTYPE_ARP\t\t0x0806\t/* Address resolution protocol */\n#define\tETHERTYPE_NSCOMPAT\t0x0807\t/* XNS Compatibility */\n#define\tETHERTYPE_FRARP \t0x0808\t/* Frame Relay ARP (RFC1701) */\n\t\t\t     /* 0x081C\t   Symbolics Private */\n\t\t    /* 0x0888 - 0x088A\t   Xyplex */\n#define\tETHERTYPE_UBDEBUG\t0x0900\t/* Ungermann-Bass network debugger */\n#define\tETHERTYPE_IEEEPUP\t0x0A00\t/* Xerox IEEE802.3 PUP */\n#define\tETHERTYPE_IEEEPUPAT\t0x0A01\t/* Xerox IEEE802.3 PUP Address Translation */\n#define\tETHERTYPE_VINES \t0x0BAD\t/* Banyan VINES */\n#define\tETHERTYPE_VINESLOOP\t0x0BAE\t/* Banyan VINES Loopback */\n#define\tETHERTYPE_VINESECHO\t0x0BAF\t/* Banyan VINES Echo */\n\n/*\t\t       0x1000 - 0x100F\t   Berkeley Trailer */\n/*\n * The ETHERTYPE_NTRAILER packet types starting at ETHERTYPE_TRAIL have\n * (type-ETHERTYPE_TRAIL)*512 bytes of data followed\n * by an ETHER type (as given above) and then the (variable-length) header.\n */\n#define\tETHERTYPE_TRAIL\t\t0x1000\t/* Trailer packet */\n#define\tETHERTYPE_NTRAILER\t16\n\n#define\tETHERTYPE_DCA\t\t0x1234\t/* DCA - Multicast */\n#define\tETHERTYPE_VALID \t0x1600\t/* VALID system protocol */\n#define\tETHERTYPE_DOGFIGHT\t0x1989\t/* Artificial Horizons (\"Aviator\" dogfight simulator [on Sun]) */\n#define\tETHERTYPE_RCL\t\t0x1995\t/* Datapoint Corporation (RCL lan protocol) */\n\n\t\t\t\t\t/* The following 3C0x types\n\t\t\t\t\t   are unregistered: */\n#define\tETHERTYPE_NBPVCD\t0x3C00\t/* 3Com NBP virtual circuit datagram (like XNS SPP) not registered */\n#define\tETHERTYPE_NBPSCD\t0x3C01\t/* 3Com NBP System control datagram not registered */\n#define\tETHERTYPE_NBPCREQ\t0x3C02\t/* 3Com NBP Connect request (virtual cct) not registered */\n#define\tETHERTYPE_NBPCRSP\t0x3C03\t/* 3Com NBP Connect response not registered */\n#define\tETHERTYPE_NBPCC\t\t0x3C04\t/* 3Com NBP Connect complete not registered */\n#define\tETHERTYPE_NBPCLREQ\t0x3C05\t/* 3Com NBP Close request (virtual cct) not registered */\n#define\tETHERTYPE_NBPCLRSP\t0x3C06\t/* 3Com NBP Close response not registered */\n#define\tETHERTYPE_NBPDG\t\t0x3C07\t/* 3Com NBP Datagram (like XNS IDP) not registered */\n#define\tETHERTYPE_NBPDGB\t0x3C08\t/* 3Com NBP Datagram broadcast not registered */\n#define\tETHERTYPE_NBPCLAIM\t0x3C09\t/* 3Com NBP Claim NetBIOS name not registered */\n#define\tETHERTYPE_NBPDLTE\t0x3C0A\t/* 3Com NBP Delete NetBIOS name not registered */\n#define\tETHERTYPE_NBPRAS\t0x3C0B\t/* 3Com NBP Remote adaptor status request not registered */\n#define\tETHERTYPE_NBPRAR\t0x3C0C\t/* 3Com NBP Remote adaptor response not registered */\n#define\tETHERTYPE_NBPRST\t0x3C0D\t/* 3Com NBP Reset not registered */\n\n#define\tETHERTYPE_PCS\t\t0x4242\t/* PCS Basic Block Protocol */\n#define\tETHERTYPE_IMLBLDIAG\t0x424C\t/* Information Modes Little Big LAN diagnostic */\n#define\tETHERTYPE_DIDDLE\t0x4321\t/* THD - Diddle */\n#define\tETHERTYPE_IMLBL\t\t0x4C42\t/* Information Modes Little Big LAN */\n#define\tETHERTYPE_SIMNET\t0x5208\t/* BBN Simnet Private */\n#define\tETHERTYPE_DECEXPER\t0x6000\t/* DEC Unassigned, experimental */\n#define\tETHERTYPE_MOPDL\t\t0x6001\t/* DEC MOP dump/load */\n#define\tETHERTYPE_MOPRC\t\t0x6002\t/* DEC MOP remote console */\n#define\tETHERTYPE_DECnet\t0x6003\t/* DEC DECNET Phase IV route */\n#define\tETHERTYPE_DN\t\tETHERTYPE_DECnet\t/* libpcap, tcpdump */\n#define\tETHERTYPE_LAT\t\t0x6004\t/* DEC LAT */\n#define\tETHERTYPE_DECDIAG\t0x6005\t/* DEC diagnostic protocol (at interface initialization?) */\n#define\tETHERTYPE_DECCUST\t0x6006\t/* DEC customer protocol */\n#define\tETHERTYPE_SCA\t\t0x6007\t/* DEC LAVC, SCA */\n#define\tETHERTYPE_AMBER\t\t0x6008\t/* DEC AMBER */\n#define\tETHERTYPE_DECMUMPS\t0x6009\t/* DEC MUMPS */\n\t\t    /* 0x6010 - 0x6014\t   3Com Corporation */\n#define\tETHERTYPE_TRANSETHER\t0x6558\t/* Trans Ether Bridging (RFC1701)*/\n#define\tETHERTYPE_RAWFR\t\t0x6559\t/* Raw Frame Relay (RFC1701) */\n#define\tETHERTYPE_UBDL\t\t0x7000\t/* Ungermann-Bass download */\n#define\tETHERTYPE_UBNIU\t\t0x7001\t/* Ungermann-Bass NIUs */\n#define\tETHERTYPE_UBDIAGLOOP\t0x7002\t/* Ungermann-Bass diagnostic/loopback */\n#define\tETHERTYPE_UBNMC\t\t0x7003\t/* Ungermann-Bass ??? (NMC to/from UB Bridge) */\n#define\tETHERTYPE_UBBST\t\t0x7005\t/* Ungermann-Bass Bridge Spanning Tree */\n#define\tETHERTYPE_OS9\t\t0x7007\t/* OS/9 Microware */\n#define\tETHERTYPE_OS9NET\t0x7009\t/* OS/9 Net? */\n\t\t    /* 0x7020 - 0x7029\t   LRT (England) (now Sintrom) */\n#define\tETHERTYPE_RACAL\t\t0x7030\t/* Racal-Interlan */\n#define\tETHERTYPE_PRIMENTS\t0x7031\t/* Prime NTS (Network Terminal Service) */\n#define\tETHERTYPE_CABLETRON\t0x7034\t/* Cabletron */\n#define\tETHERTYPE_CRONUSVLN\t0x8003\t/* Cronus VLN */\n#define\tETHERTYPE_CRONUS\t0x8004\t/* Cronus Direct */\n#define\tETHERTYPE_HP\t\t0x8005\t/* HP Probe */\n#define\tETHERTYPE_NESTAR\t0x8006\t/* Nestar */\n#define\tETHERTYPE_ATTSTANFORD\t0x8008\t/* AT&T/Stanford (local use) */\n#define\tETHERTYPE_EXCELAN\t0x8010\t/* Excelan */\n#define\tETHERTYPE_SG_DIAG\t0x8013\t/* SGI diagnostic type */\n#define\tETHERTYPE_SG_NETGAMES\t0x8014\t/* SGI network games */\n#define\tETHERTYPE_SG_RESV\t0x8015\t/* SGI reserved type */\n#define\tETHERTYPE_SG_BOUNCE\t0x8016\t/* SGI bounce server */\n#define\tETHERTYPE_APOLLODOMAIN\t0x8019\t/* Apollo DOMAIN */\n#define\tETHERTYPE_TYMSHARE\t0x802E\t/* Tymeshare */\n#define\tETHERTYPE_TIGAN\t\t0x802F\t/* Tigan, Inc. */\n#define\tETHERTYPE_REVARP\t0x8035\t/* Reverse addr resolution protocol */\n#define\tETHERTYPE_AEONIC\t0x8036\t/* Aeonic Systems */\n#define\tETHERTYPE_IPXNEW\t0x8037\t/* IPX (Novell Netware?) */\n#define\tETHERTYPE_LANBRIDGE\t0x8038\t/* DEC LANBridge */\n#define\tETHERTYPE_DSMD\t0x8039\t/* DEC DSM/DDP */\n#define\tETHERTYPE_ARGONAUT\t0x803A\t/* DEC Argonaut Console */\n#define\tETHERTYPE_VAXELN\t0x803B\t/* DEC VAXELN */\n#define\tETHERTYPE_DECDNS\t0x803C\t/* DEC DNS Naming Service */\n#define\tETHERTYPE_ENCRYPT\t0x803D\t/* DEC Ethernet Encryption */\n#define\tETHERTYPE_DECDTS\t0x803E\t/* DEC Distributed Time Service */\n#define\tETHERTYPE_DECLTM\t0x803F\t/* DEC LAN Traffic Monitor */\n#define\tETHERTYPE_DECNETBIOS\t0x8040\t/* DEC PATHWORKS DECnet NETBIOS Emulation */\n#define\tETHERTYPE_DECLAST\t0x8041\t/* DEC Local Area System Transport */\n\t\t\t     /* 0x8042\t   DEC Unassigned */\n#define\tETHERTYPE_PLANNING\t0x8044\t/* Planning Research Corp. */\n\t\t    /* 0x8046 - 0x8047\t   AT&T */\n#define\tETHERTYPE_DECAM\t\t0x8048\t/* DEC Availability Manager for Distributed Systems DECamds (but someone at DEC says not) */\n#define\tETHERTYPE_EXPERDATA\t0x8049\t/* ExperData */\n#define\tETHERTYPE_VEXP\t\t0x805B\t/* Stanford V Kernel exp. */\n#define\tETHERTYPE_VPROD\t\t0x805C\t/* Stanford V Kernel prod. */\n#define\tETHERTYPE_ES\t\t0x805D\t/* Evans & Sutherland */\n#define\tETHERTYPE_LITTLE\t0x8060\t/* Little Machines */\n#define\tETHERTYPE_COUNTERPOINT\t0x8062\t/* Counterpoint Computers */\n\t\t    /* 0x8065 - 0x8066\t   Univ. of Mass @ Amherst */\n#define\tETHERTYPE_VEECO\t\t0x8067\t/* Veeco Integrated Auto. */\n#define\tETHERTYPE_GENDYN\t0x8068\t/* General Dynamics */\n#define\tETHERTYPE_ATT\t\t0x8069\t/* AT&T */\n#define\tETHERTYPE_AUTOPHON\t0x806A\t/* Autophon */\n#define\tETHERTYPE_COMDESIGN\t0x806C\t/* ComDesign */\n#define\tETHERTYPE_COMPUGRAPHIC\t0x806D\t/* Compugraphic Corporation */\n\t\t    /* 0x806E - 0x8077\t   Landmark Graphics Corp. */\n#define\tETHERTYPE_MATRA\t\t0x807A\t/* Matra */\n#define\tETHERTYPE_DDE\t\t0x807B\t/* Dansk Data Elektronik */\n#define\tETHERTYPE_MERIT\t\t0x807C\t/* Merit Internodal (or Univ of Michigan?) */\n\t\t    /* 0x807D - 0x807F\t   Vitalink Communications */\n#define\tETHERTYPE_VLTLMAN\t0x8080\t/* Vitalink TransLAN III Management */\n\t\t    /* 0x8081 - 0x8083\t   Counterpoint Computers */\n\t\t    /* 0x8088 - 0x808A\t   Xyplex */\n#define\tETHERTYPE_ATALK\t\t0x809B\t/* AppleTalk */\n#define\tETHERTYPE_AT\t\tETHERTYPE_ATALK\t\t/* old NetBSD */\n#define\tETHERTYPE_APPLETALK\tETHERTYPE_ATALK\t\t/* HP-UX */\n\t\t    /* 0x809C - 0x809E\t   Datability */\n#define\tETHERTYPE_SPIDER\t0x809F\t/* Spider Systems Ltd. */\n\t\t\t     /* 0x80A3\t   Nixdorf */\n\t\t    /* 0x80A4 - 0x80B3\t   Siemens Gammasonics Inc. */\n\t\t    /* 0x80C0 - 0x80C3\t   DCA (Digital Comm. Assoc.) Data Exchange Cluster */\n\t\t    /* 0x80C4 - 0x80C5\t   Banyan Systems */\n#define\tETHERTYPE_PACER\t\t0x80C6\t/* Pacer Software */\n#define\tETHERTYPE_APPLITEK\t0x80C7\t/* Applitek Corporation */\n\t\t    /* 0x80C8 - 0x80CC\t   Intergraph Corporation */\n\t\t    /* 0x80CD - 0x80CE\t   Harris Corporation */\n\t\t    /* 0x80CF - 0x80D2\t   Taylor Instrument */\n\t\t    /* 0x80D3 - 0x80D4\t   Rosemount Corporation */\n#define\tETHERTYPE_SNA\t\t0x80D5\t/* IBM SNA Services over Ethernet */\n#define\tETHERTYPE_VARIAN\t0x80DD\t/* Varian Associates */\n\t\t    /* 0x80DE - 0x80DF\t   TRFS (Integrated Solutions Transparent Remote File System) */\n\t\t    /* 0x80E0 - 0x80E3\t   Allen-Bradley */\n\t\t    /* 0x80E4 - 0x80F0\t   Datability */\n#define\tETHERTYPE_RETIX\t\t0x80F2\t/* Retix */\n#define\tETHERTYPE_AARP\t\t0x80F3\t/* AppleTalk AARP */\n\t\t    /* 0x80F4 - 0x80F5\t   Kinetics */\n#define\tETHERTYPE_APOLLO\t0x80F7\t/* Apollo Computer */\n#define ETHERTYPE_VLAN\t\t0x8100\t/* IEEE 802.1Q VLAN tagging (XXX conflicts) */\n\t\t    /* 0x80FF - 0x8101\t   Wellfleet Communications (XXX conflicts) */\n#define\tETHERTYPE_BOFL\t\t0x8102\t/* Wellfleet; BOFL (Breath OF Life) pkts [every 5-10 secs.] */\n#define\tETHERTYPE_WELLFLEET\t0x8103\t/* Wellfleet Communications */\n\t\t    /* 0x8107 - 0x8109\t   Symbolics Private */\n#define\tETHERTYPE_TALARIS\t0x812B\t/* Talaris */\n#define\tETHERTYPE_WATERLOO\t0x8130\t/* Waterloo Microsystems Inc. (XXX which?) */\n#define\tETHERTYPE_HAYES\t\t0x8130\t/* Hayes Microcomputers (XXX which?) */\n#define\tETHERTYPE_VGLAB\t\t0x8131\t/* VG Laboratory Systems */\n\t\t    /* 0x8132 - 0x8137\t   Bridge Communications */\n#define\tETHERTYPE_IPX\t\t0x8137\t/* Novell (old) NetWare IPX (ECONFIG E option) */\n#define\tETHERTYPE_NOVELL\t0x8138\t/* Novell, Inc. */\n\t\t    /* 0x8139 - 0x813D\t   KTI */\n#define\tETHERTYPE_MUMPS\t\t0x813F\t/* M/MUMPS data sharing */\n#define\tETHERTYPE_AMOEBA\t0x8145\t/* Vrije Universiteit (NL) Amoeba 4 RPC (obsolete) */\n#define\tETHERTYPE_FLIP\t\t0x8146\t/* Vrije Universiteit (NL) FLIP (Fast Local Internet Protocol) */\n#define\tETHERTYPE_VURESERVED\t0x8147\t/* Vrije Universiteit (NL) [reserved] */\n#define\tETHERTYPE_LOGICRAFT\t0x8148\t/* Logicraft */\n#define\tETHERTYPE_NCD\t\t0x8149\t/* Network Computing Devices */\n#define\tETHERTYPE_ALPHA\t\t0x814A\t/* Alpha Micro */\n#define\tETHERTYPE_SNMP\t\t0x814C\t/* SNMP over Ethernet (see RFC1089) */\n\t\t    /* 0x814D - 0x814E\t   BIIN */\n#define\tETHERTYPE_TEC\t0x814F\t/* Technically Elite Concepts */\n#define\tETHERTYPE_RATIONAL\t0x8150\t/* Rational Corp */\n\t\t    /* 0x8151 - 0x8153\t   Qualcomm */\n\t\t    /* 0x815C - 0x815E\t   Computer Protocol Pty Ltd */\n\t\t    /* 0x8164 - 0x8166\t   Charles River Data Systems */\n#define\tETHERTYPE_XTP\t\t0x817D\t/* Protocol Engines XTP */\n#define\tETHERTYPE_SGITW\t\t0x817E\t/* SGI/Time Warner prop. */\n#define\tETHERTYPE_HIPPI_FP\t0x8180\t/* HIPPI-FP encapsulation */\n#define\tETHERTYPE_STP\t\t0x8181\t/* Scheduled Transfer STP, HIPPI-ST */\n\t\t    /* 0x8182 - 0x8183\t   Reserved for HIPPI-6400 */\n\t\t    /* 0x8184 - 0x818C\t   SGI prop. */\n#define\tETHERTYPE_MOTOROLA\t0x818D\t/* Motorola */\n#define\tETHERTYPE_NETBEUI\t0x8191\t/* PowerLAN NetBIOS/NetBEUI (PC) */\n\t\t    /* 0x819A - 0x81A3\t   RAD Network Devices */\n\t\t    /* 0x81B7 - 0x81B9\t   Xyplex */\n\t\t    /* 0x81CC - 0x81D5\t   Apricot Computers */\n\t\t    /* 0x81D6 - 0x81DD\t   Artisoft Lantastic */\n\t\t    /* 0x81E6 - 0x81EF\t   Polygon */\n\t\t    /* 0x81F0 - 0x81F2\t   Comsat Labs */\n\t\t    /* 0x81F3 - 0x81F5\t   SAIC */\n\t\t    /* 0x81F6 - 0x81F8\t   VG Analytical */\n\t\t    /* 0x8203 - 0x8205\t   QNX Software Systems Ltd. */\n\t\t    /* 0x8221 - 0x8222\t   Ascom Banking Systems */\n\t\t    /* 0x823E - 0x8240\t   Advanced Encryption Systems */\n\t\t    /* 0x8263 - 0x826A\t   Charles River Data Systems */\n\t\t    /* 0x827F - 0x8282\t   Athena Programming */\n\t\t    /* 0x829A - 0x829B\t   Inst Ind Info Tech */\n\t\t    /* 0x829C - 0x82AB\t   Taurus Controls */\n\t\t    /* 0x82AC - 0x8693\t   Walker Richer & Quinn */\n#define\tETHERTYPE_ACCTON\t0x8390\t/* Accton Technologies (unregistered) */\n#define\tETHERTYPE_TALARISMC\t0x852B\t/* Talaris multicast */\n#define\tETHERTYPE_KALPANA\t0x8582\t/* Kalpana */\n\t\t    /* 0x8694 - 0x869D\t   Idea Courier */\n\t\t    /* 0x869E - 0x86A1\t   Computer Network Tech */\n\t\t    /* 0x86A3 - 0x86AC\t   Gateway Communications */\n#define\tETHERTYPE_SECTRA\t0x86DB\t/* SECTRA */\n#define\tETHERTYPE_IPV6\t\t0x86DD\t/* IP protocol version 6 */\n#define\tETHERTYPE_DELTACON\t0x86DE\t/* Delta Controls */\n#define\tETHERTYPE_ATOMIC\t0x86DF\t/* ATOMIC */\n\t\t    /* 0x86E0 - 0x86EF\t   Landis & Gyr Powers */\n\t\t    /* 0x8700 - 0x8710\t   Motorola */\n#define\tETHERTYPE_RDP\t\t0x8739\t/* Control Technology Inc. RDP Without IP */\n#define\tETHERTYPE_MICP\t\t0x873A\t/* Control Technology Inc. Mcast Industrial Ctrl Proto. */\n\t\t    /* 0x873B - 0x873C\t   Control Technology Inc. Proprietary */\n#define\tETHERTYPE_TCPCOMP\t0x876B\t/* TCP/IP Compression (RFC1701) */\n#define\tETHERTYPE_IPAS\t\t0x876C\t/* IP Autonomous Systems (RFC1701) */\n#define\tETHERTYPE_SECUREDATA\t0x876D\t/* Secure Data (RFC1701) */\n#define\tETHERTYPE_FLOWCONTROL\t0x8808\t/* 802.3x flow control packet */\n#define\tETHERTYPE_SLOW\t\t0x8809\t/* 802.3ad link aggregation (LACP) */\n#define\tETHERTYPE_PPP\t\t0x880B\t/* PPP (obsolete by PPPoE) */\n#define\tETHERTYPE_HITACHI\t0x8820\t/* Hitachi Cable (Optoelectronic Systems Laboratory) */\n#define\tETHERTYPE_MPLS\t\t0x8847\t/* MPLS Unicast */\n#define\tETHERTYPE_MPLS_MCAST\t0x8848\t/* MPLS Multicast */\n#define\tETHERTYPE_AXIS\t\t0x8856\t/* Axis Communications AB proprietary bootstrap/config */\n#define\tETHERTYPE_PPPOEDISC\t0x8863\t/* PPP Over Ethernet Discovery Stage */\n#define\tETHERTYPE_PPPOE\t\t0x8864\t/* PPP Over Ethernet Session Stage */\n#define\tETHERTYPE_LANPROBE\t0x8888\t/* HP LanProbe test? */\n#define\tETHERTYPE_PAE\t\t0x888e\t/* EAPOL PAE/802.1x */\n#define\tETHERTYPE_LOOPBACK\t0x9000\t/* Loopback: used to test interfaces */\n#define\tETHERTYPE_LBACK\t\tETHERTYPE_LOOPBACK\t/* DEC MOP loopback */\n#define\tETHERTYPE_XNSSM\t\t0x9001\t/* 3Com (Formerly Bridge Communications), XNS Systems Management */\n#define\tETHERTYPE_TCPSM\t\t0x9002\t/* 3Com (Formerly Bridge Communications), TCP/IP Systems Management */\n#define\tETHERTYPE_BCLOOP\t0x9003\t/* 3Com (Formerly Bridge Communications), loopback detection */\n#define\tETHERTYPE_DEBNI\t\t0xAAAA\t/* DECNET? Used by VAX 6220 DEBNI */\n#define\tETHERTYPE_SONIX\t\t0xFAF5\t/* Sonix Arpeggio */\n#define\tETHERTYPE_VITAL\t\t0xFF00\t/* BBN VITAL-LanBridge cache wakeups */\n\t\t    /* 0xFF00 - 0xFFOF\t   ISC Bunker Ramo */\n\n#define\tETHERTYPE_MAX\t\t0xFFFF\t/* Maximum valid ethernet type, reserved */\n\n/*\n * The ETHERTYPE_NTRAILER packet types starting at ETHERTYPE_TRAIL have\n * (type-ETHERTYPE_TRAIL)*512 bytes of data followed\n * by an ETHER type (as given above) and then the (variable-length) header.\n */\n#define\tETHERTYPE_TRAIL\t\t0x1000\t\t/* Trailer packet */\n#define\tETHERTYPE_NTRAILER\t16\n\n#define\tETHERMTU\t(ETHER_MAX_LEN-ETHER_HDR_LEN-ETHER_CRC_LEN)\n#define\tETHERMIN\t(ETHER_MIN_LEN-ETHER_HDR_LEN-ETHER_CRC_LEN)\n#define\tETHERMTU_JUMBO\t(ETHER_MAX_LEN_JUMBO - ETHER_HDR_LEN - ETHER_CRC_LEN)\n/*\n * The ETHER_BPF_MTAP macro should be used by drivers which support hardware\n * offload for VLAN tag processing.  It will check the mbuf to see if it has\n * M_VLANTAG set, and if it does, will pass the packet along to\n * ether_vlan_mtap.  This function will re-insert VLAN tags for the duration\n * of the tap, so they show up properly for network analyzers.\n */\n#define ETHER_BPF_MTAP(_ifp, _m) do {\t\t\t\t\t\\\n\tif (bpf_peers_present((_ifp)->if_bpf)) {\t\t\t\\\n\t\tM_ASSERTVALID(_m);\t\t\t\t\t\\\n\t\tif (((_m)->m_flags & M_VLANTAG) != 0)\t\t\t\\\n\t\t\tether_vlan_mtap((_ifp)->if_bpf, (_m), NULL, 0);\t\\\n\t\telse\t\t\t\t\t\t\t\\\n\t\t\tbpf_mtap((_ifp)->if_bpf, (_m));\t\t\t\\\n\t}\t\t\t\t\t\t\t\t\\\n} while (0)\n\n#ifdef _KERNEL\n\nstruct ifnet;\nstruct mbuf;\nstruct route;\nstruct sockaddr;\nstruct bpf_if;\n\nextern\tuint32_t ether_crc32_le(const uint8_t *, size_t);\nextern\tuint32_t ether_crc32_be(const uint8_t *, size_t);\nextern\tvoid ether_demux(struct ifnet *, struct mbuf *);\nextern\tvoid ether_ifattach(struct ifnet *, const u_int8_t *);\nextern\tvoid ether_ifdetach(struct ifnet *);\nextern\tint  ether_ioctl(struct ifnet *, u_long, caddr_t);\nextern\tint  ether_output(struct ifnet *,\n\t\t   struct mbuf *, struct sockaddr *, struct route *);\nextern\tint  ether_output_frame(struct ifnet *, struct mbuf *);\nextern\tchar *ether_sprintf(const u_int8_t *);\nvoid\tether_vlan_mtap(struct bpf_if *, struct mbuf *,\n\t    void *, u_int);\nstruct mbuf  *ether_vlanencap(struct mbuf *, uint16_t);\n\n#else /* _KERNEL */\n\n#include <sys/cdefs.h>\n\n/*\n * Ethernet address conversion/parsing routines.\n */\n__BEGIN_DECLS\nstruct\tether_addr *ether_aton(const char *);\nstruct\tether_addr *ether_aton_r(const char *, struct ether_addr *);\nint\tether_hostton(const char *, struct ether_addr *);\nint\tether_line(const char *, struct ether_addr *, char *);\nchar \t*ether_ntoa(const struct ether_addr *);\nchar \t*ether_ntoa_r(const struct ether_addr *, char *);\nint\tether_ntohost(char *, const struct ether_addr *);\n__END_DECLS\n\n#endif /* !_KERNEL */\n\n#endif /* !_NET_ETHERNET_H_ */\n"
  },
  {
    "path": "freebsd-headers/net/fddi.h",
    "content": "/*-\n * Copyright (c) 1982, 1986, 1993\n *\tThe Regents of the University of California.  All rights reserved.\n * Copyright (c) 1995 Matt Thomas (thomas@lkg.dec.com)\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. All advertising materials mentioning features or use of this software\n *    must display the following acknowledgement:\n *\tThis product includes software developed by the University of\n *\tCalifornia, Berkeley and its contributors.\n * 4. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t@(#)if_fddi.h\t8.1 (Berkeley) 6/10/93\n * $FreeBSD: release/9.0.0/sys/net/fddi.h 194581 2009-06-21 10:29:31Z rdivacky $\n */\n\n#ifndef _NETINET_IF_FDDI_H_\n#define _NETINET_IF_FDDI_H_\n\n#define\tFDDIIPMTU\t\t4352\n#define\tFDDIMTU\t\t\t4470\n#define\tFDDIMIN\t\t\t3\n\n#define\tFDDIFC_C\t\t0x80\t/* 0b10000000 */\n#define\tFDDIFC_L\t\t0x40\t/* 0b01000000 */\n#define\tFDDIFC_F\t\t0x30\t/* 0b00110000 */\n#define\tFDDIFC_Z\t\t0x0F\t/* 0b00001111 */\n#define\tFDDIFC_CLFF\t\t0xF0\t/* Class/Length/Format bits */\n#define\tFDDIFC_ZZZZ\t\t0x0F\t/* Control bits */\n\n/*\n * FDDI Frame Control values. (48-bit addressing only).\n */\n#define\tFDDIFC_VOID\t\t0x40\t/* Void frame */\n#define\tFDDIFC_NRT\t\t0x80\t/* Nonrestricted token */\n#define\tFDDIFC_RT\t\t0xc0\t/* Restricted token */\n#define\tFDDIFC_MAC_BEACON\t0xc2\t/* MAC Beacon frame */\n#define\tFDDIFC_MAC_CLAIM\t0xc3\t/* MAC Claim frame */\n#define\tFDDIFC_LLC_ASYNC\t0x50\n#define\tFDDIFC_LLC_PRIO0\t0\n#define\tFDDIFC_LLC_PRIO1\t1\n#define\tFDDIFC_LLC_PRIO2\t2\n#define\tFDDIFC_LLC_PRIO3\t3\n#define\tFDDIFC_LLC_PRIO4\t4\n#define\tFDDIFC_LLC_PRIO5\t5\n#define\tFDDIFC_LLC_PRIO6\t6\n#define\tFDDIFC_LLC_PRIO7\t7\n#define\tFDDIFC_LLC_SYNC\t\t0xd0\n#define\tFDDIFC_IMP_ASYNC\t0x60\t/* Implementor Async. */\n#define\tFDDIFC_IMP_SYNC\t\t0xe0\t/* Implementor Synch. */\n#define\tFDDIFC_SMT\t\t0x40\n#define\tFDDIFC_SMT_INFO\t\t0x41\t/* SMT Info */\n#define\tFDDIFC_SMT_NSA\t\t0x4F\t/* SMT Next station adrs */\n#define\tFDDIFC_MAC\t\t0xc0\t/* MAC frame */\n\n#define\tFDDI_ADDR_LEN\t\t6\n#define\tFDDI_HDR_LEN\t\t(sizeof(struct fddi_header))\n\n/*\n * Structure of an 100Mb/s FDDI header.\n */\nstruct fddi_header {\n\tu_char  fddi_fc;\n\tu_char  fddi_dhost[FDDI_ADDR_LEN];\n\tu_char  fddi_shost[FDDI_ADDR_LEN];\n};\n\n#if defined(_KERNEL)\n#define\tfddi_ipmulticast_min\tether_ipmulticast_min\n#define\tfddi_ipmulticast_max\tether_ipmulticast_max\n#define\tfddi_addmulti\t\tether_addmulti\n#define\tfddi_delmulti\t\tether_delmulti\n#define\tfddi_sprintf\t\tether_sprintf\n\n#define\tFDDI_BPF_UNSUPPORTED\t0\n#define\tFDDI_BPF_SUPPORTED\t1\n\nvoid\tfddi_ifattach(struct ifnet *, const u_int8_t *, int);\nvoid\tfddi_ifdetach(struct ifnet *, int);\nint\tfddi_ioctl(struct ifnet *, u_long, caddr_t);\n\n#endif\t/* _KERNEL */\n#endif\t/* _NET_FDDI_H_ */\n"
  },
  {
    "path": "freebsd-headers/net/firewire.h",
    "content": "/*-\n * Copyright (c) 2004 Doug Rabson\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t$FreeBSD: release/9.0.0/sys/net/firewire.h 194581 2009-06-21 10:29:31Z rdivacky $\n */\n\n#ifndef _NET_FIREWIRE_H_\n#define _NET_FIREWIRE_H_\n\n#define FW_ENCAP_UNFRAG\t\t0\n#define FW_ENCAP_FIRST\t\t1\n#define FW_ENCAP_LAST\t\t2\n#define FW_ENCAP_NEXT\t\t3\n\nunion fw_encap {\n\t\tuint32_t ul[2];\n\t\tstruct {\n#if BYTE_ORDER == BIG_ENDIAN\n\t\t\tuint32_t lf\t\t:2;\n\t\t\tuint32_t reserved\t:14;\n\t\t\tuint32_t ether_type\t:16;\n#else\n\t\t\tuint32_t ether_type\t:16;\n\t\t\tuint32_t reserved\t:14;\n\t\t\tuint32_t lf\t\t:2;\n#endif\n\t\t} unfrag;\n\t\tstruct {\n#if BYTE_ORDER == BIG_ENDIAN\n\t\t\tuint32_t lf\t\t:2;\n\t\t\tuint32_t reserved1\t:2;\n\t\t\tuint32_t datagram_size\t:12;\n\t\t\tuint32_t ether_type\t:16;\n\t\t\tuint32_t dgl\t\t:16;\n\t\t\tuint32_t reserved2\t:16;\n#else\n\t\t\tuint32_t ether_type\t:16;\n\t\t\tuint32_t datagram_size\t:12;\n\t\t\tuint32_t reserved1\t:2;\n\t\t\tuint32_t lf\t\t:2;\n\t\t\tuint32_t reserved2\t:16;\n\t\t\tuint32_t dgl\t\t:16;\n#endif\n\t\t} firstfrag;\n\t\tstruct {\n#if BYTE_ORDER == BIG_ENDIAN\n\t\t\tuint32_t lf\t\t:2;\n\t\t\tuint32_t reserved1\t:2;\n\t\t\tuint32_t datagram_size\t:12;\n\t\t\tuint32_t reserved2\t:4;\n\t\t\tuint32_t fragment_offset :12;\n\t\t\tuint32_t dgl\t\t:16;\n\t\t\tuint32_t reserved3\t:16;\n#else\n\t\t\tuint32_t fragment_offset :12;\n\t\t\tuint32_t reserved2\t:4;\n\t\t\tuint32_t datagram_size\t:12;\n\t\t\tuint32_t reserved1\t:2;\n\t\t\tuint32_t lf\t\t:2;\n\t\t\tuint32_t reserved3\t:16;\n\t\t\tuint32_t dgl\t\t:16;\n#endif\n\t\t} nextfrag;\n};\n\n#define MTAG_FIREWIRE\t\t\t1394\n#define MTAG_FIREWIRE_HWADDR\t\t0\n#define MTAG_FIREWIRE_SENDER_EUID\t1\n\nstruct fw_hwaddr {\n\tuint32_t\t\tsender_unique_ID_hi;\n\tuint32_t\t\tsender_unique_ID_lo;\n\tuint8_t\t\t\tsender_max_rec;\n\tuint8_t\t\t\tsspd;\n\tuint16_t\t\tsender_unicast_FIFO_hi;\n\tuint32_t\t\tsender_unicast_FIFO_lo;\n};\n\n/*\n * BPF wants to see one of these.\n */\nstruct fw_bpfhdr {\n\tuint8_t\t\t\tfirewire_dhost[8];\n\tuint8_t\t\t\tfirewire_shost[8];\n\tuint16_t\t\tfirewire_type;\n};\n\n#ifdef _KERNEL\n\n/*\n * A structure to track the reassembly of a link-level fragmented\n * datagram.\n */\nstruct fw_reass {\n\tSTAILQ_ENTRY(fw_reass)\tfr_link;\n\tuint32_t\t\tfr_id;\t\t/* host+dgl */\n\tstruct mbuf\t\t*fr_frags;\t/* chain of frags */\n};\nSTAILQ_HEAD(fw_reass_list, fw_reass);\n\nstruct fw_com {\n\tstruct ifnet\t\t*fc_ifp;\n\tstruct fw_hwaddr\tfc_hwaddr;\n\tstruct firewire_comm\t*fc_fc;\n\tuint8_t\t\t\tfc_broadcast_channel;\n\tuint8_t\t\t\tfc_speed;\t/* our speed */\n\tuint16_t\t\tfc_node;\t/* our nodeid */\n\tstruct fw_reass_list\tfc_frags;\t/* partial datagrams */\n};\n#define\tIFP2FWC(ifp)\t((struct fw_com *)(ifp)->if_l2com)\n\nextern\tvoid\tfirewire_input(struct ifnet *ifp, struct mbuf *m, uint16_t src);\nextern\tvoid\tfirewire_ifattach(struct ifnet *, struct fw_hwaddr *);\nextern\tvoid\tfirewire_ifdetach(struct ifnet *);\nextern\tvoid\tfirewire_busreset(struct ifnet *);\nextern\tint\tfirewire_ioctl(struct ifnet *, u_long, caddr_t);\n\n#endif /* !_KERNEL */\n\n#endif /* !_NET_FIREWIRE_H_ */\n"
  },
  {
    "path": "freebsd-headers/net/flowtable.h",
    "content": "/**************************************************************************\n\nCopyright (c) 2008-2010, BitGravity Inc.\nAll rights reserved.\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are met:\n\n 1. Redistributions of source code must retain the above copyright notice,\n    this list of conditions and the following disclaimer.\n\n 2. Neither the name of the BitGravity Corporation nor the names of its\n    contributors may be used to endorse or promote products derived from\n    this software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\nAND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\nIMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\nARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE\nLIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\nCONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\nSUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\nINTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\nCONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\nARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\nPOSSIBILITY OF SUCH DAMAGE.\n\n$FreeBSD: release/9.0.0/sys/net/flowtable.h 208171 2010-05-16 21:48:39Z kmacy $\n\n***************************************************************************/\n\n#ifndef\t_NET_FLOWTABLE_H_\n#define\t_NET_FLOWTABLE_H_\n\n#ifdef\t_KERNEL\n\n#define\tFL_HASH_ALL\t(1<<0)\t/* hash 4-tuple + protocol */\n#define\tFL_PCPU\t\t(1<<1)\t/* pcpu cache */\n#define\tFL_NOAUTO\t(1<<2)\t/* don't automatically add flentry on miss */\n#define FL_IPV6  \t(1<<9)\n\n#define\tFL_TCP\t\t(1<<11)\n#define\tFL_SCTP\t\t(1<<12)\n#define\tFL_UDP\t\t(1<<13)\n#define\tFL_DEBUG\t(1<<14)\n#define\tFL_DEBUG_ALL\t(1<<15)\n\nstruct flowtable;\nstruct flentry;\nstruct route;\nstruct route_in6;\n\nVNET_DECLARE(struct flowtable *, ip_ft);\n#define\tV_ip_ft\t\t\tVNET(ip_ft)\n\nVNET_DECLARE(struct flowtable *, ip6_ft);\n#define\tV_ip6_ft\t\tVNET(ip6_ft)\n\nstruct flowtable *flowtable_alloc(char *name, int nentry, int flags);\n\n/*\n * Given a flow table, look up the L3 and L2 information and\n * return it in the route.\n *\n */\nstruct flentry *flowtable_lookup_mbuf(struct flowtable *ft, struct mbuf *m, int af);\n\nstruct flentry *flowtable_lookup(struct flowtable *ft, struct sockaddr_storage *ssa,\n    struct sockaddr_storage *dsa, uint32_t fibnum, int flags);\n\nint kern_flowtable_insert(struct flowtable *ft, struct sockaddr_storage *ssa,\n    struct sockaddr_storage *dsa, struct route *ro, uint32_t fibnum, int flags);\n\nvoid flow_invalidate(struct flentry *fl);\nvoid flowtable_route_flush(struct flowtable *ft, struct rtentry *rt);\n\nvoid flow_to_route(struct flentry *fl, struct route *ro);\n\nvoid flow_to_route_in6(struct flentry *fl, struct route_in6 *ro);\n\n\n#endif /* _KERNEL */\n#endif\n"
  },
  {
    "path": "freebsd-headers/net/ieee8023ad_lacp.h",
    "content": "/*\t$NetBSD: ieee8023ad_impl.h,v 1.2 2005/12/10 23:21:39 elad Exp $\t*/\n\n/*-\n * Copyright (c)2005 YAMAMOTO Takashi,\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/net/ieee8023ad_lacp.h 177289 2008-03-17 01:26:44Z thompsa $\n */\n\n/*\n * IEEE802.3ad LACP\n *\n * implementation details.\n */\n\n#define\tLACP_TIMER_CURRENT_WHILE\t0\n#define\tLACP_TIMER_PERIODIC\t\t1\n#define\tLACP_TIMER_WAIT_WHILE\t\t2\n#define\tLACP_NTIMER\t\t\t3\n\n#define\tLACP_TIMER_ARM(port, timer, val) \\\n\t(port)->lp_timer[(timer)] = (val)\n#define\tLACP_TIMER_DISARM(port, timer) \\\n\t(port)->lp_timer[(timer)] = 0\n#define\tLACP_TIMER_ISARMED(port, timer) \\\n\t((port)->lp_timer[(timer)] > 0)\n\n/*\n * IEEE802.3ad LACP\n *\n * protocol definitions.\n */\n\n#define\tLACP_STATE_ACTIVITY\t(1<<0)\n#define\tLACP_STATE_TIMEOUT\t(1<<1)\n#define\tLACP_STATE_AGGREGATION\t(1<<2)\n#define\tLACP_STATE_SYNC\t\t(1<<3)\n#define\tLACP_STATE_COLLECTING\t(1<<4)\n#define\tLACP_STATE_DISTRIBUTING\t(1<<5)\n#define\tLACP_STATE_DEFAULTED\t(1<<6)\n#define\tLACP_STATE_EXPIRED\t(1<<7)\n\n#define\tLACP_PORT_NTT\t\t0x00000001\n#define\tLACP_PORT_MARK\t\t0x00000002\n\n#define\tLACP_STATE_BITS\t\t\\\n\t\"\\020\"\t\t\t\\\n\t\"\\001ACTIVITY\"\t\t\\\n\t\"\\002TIMEOUT\"\t\t\\\n\t\"\\003AGGREGATION\"\t\\\n\t\"\\004SYNC\"\t\t\\\n\t\"\\005COLLECTING\"\t\\\n\t\"\\006DISTRIBUTING\"\t\\\n\t\"\\007DEFAULTED\"\t\t\\\n\t\"\\010EXPIRED\"\n\n/*\n * IEEE802.3 slow protocols\n *\n * protocol (on-wire) definitions.\n *\n * XXX should be elsewhere.\n */\n\n#define\tSLOWPROTOCOLS_SUBTYPE_LACP\t1\n#define\tSLOWPROTOCOLS_SUBTYPE_MARKER\t2\n\nstruct slowprothdr {\n\tuint8_t\t\tsph_subtype;\n\tuint8_t\t\tsph_version;\n} __packed;\n\n/*\n * TLV on-wire structure.\n */\n\nstruct tlvhdr {\n\tuint8_t\t\ttlv_type;\n\tuint8_t\t\ttlv_length;\n\t/* uint8_t tlv_value[]; */\n} __packed;\n\n/*\n * ... and our implementation.\n */\n\n#define\tTLV_SET(tlv, type, length) \\\n\tdo { \\\n\t\t(tlv)->tlv_type = (type); \\\n\t\t(tlv)->tlv_length = sizeof(*tlv) + (length); \\\n\t} while (/*CONSTCOND*/0)\n\nstruct tlv_template {\n\tuint8_t\t\t\ttmpl_type;\n\tuint8_t\t\t\ttmpl_length;\n};\n\nstruct lacp_systemid {\n\tuint16_t\t\tlsi_prio;\n\tuint8_t\t\t\tlsi_mac[6];\n} __packed;\n\nstruct lacp_portid {\n\tuint16_t\t\tlpi_prio;\n\tuint16_t\t\tlpi_portno;\n} __packed;\n\nstruct lacp_peerinfo {\n\tstruct lacp_systemid\tlip_systemid;\n\tuint16_t\t\tlip_key;\n\tstruct lacp_portid\tlip_portid;\n\tuint8_t\t\t\tlip_state;\n\tuint8_t\t\t\tlip_resv[3];\n} __packed;\n\nstruct lacp_collectorinfo {\n\tuint16_t\t\tlci_maxdelay;\n\tuint8_t\t\t\tlci_resv[12];\n} __packed;\n\nstruct lacpdu {\n\tstruct ether_header\tldu_eh;\n\tstruct slowprothdr\tldu_sph;\n\n\tstruct tlvhdr\t\tldu_tlv_actor;\n\tstruct lacp_peerinfo\tldu_actor;\n\tstruct tlvhdr\t\tldu_tlv_partner;\n\tstruct lacp_peerinfo\tldu_partner;\n\tstruct tlvhdr\t\tldu_tlv_collector;\n\tstruct lacp_collectorinfo ldu_collector;\n\tstruct tlvhdr\t\tldu_tlv_term;\n\tuint8_t\t\t\tldu_resv[50];\n} __packed;\n\n/*\n * IEEE802.3ad marker protocol\n *\n * protocol (on-wire) definitions.\n */\nstruct lacp_markerinfo {\n\tuint16_t\t\tmi_rq_port;\n\tuint8_t\t\t\tmi_rq_system[ETHER_ADDR_LEN];\n\tuint32_t\t\tmi_rq_xid;\n\tuint8_t\t\t\tmi_pad[2];\n} __packed;\n\nstruct markerdu {\n\tstruct ether_header\tmdu_eh;\n\tstruct slowprothdr\tmdu_sph;\n\n\tstruct tlvhdr\t\tmdu_tlv;\n\tstruct lacp_markerinfo\tmdu_info;\n\tstruct tlvhdr\t\tmdu_tlv_term;\n\tuint8_t\t\t\tmdu_resv[90];\n} __packed;\n\n#define\tMARKER_TYPE_INFO\t0x01\n#define\tMARKER_TYPE_RESPONSE\t0x02\n\nenum lacp_selected {\n\tLACP_UNSELECTED,\n\tLACP_STANDBY,\t/* not used in this implementation */\n\tLACP_SELECTED,\n};\n\nenum lacp_mux_state {\n\tLACP_MUX_DETACHED,\n\tLACP_MUX_WAITING,\n\tLACP_MUX_ATTACHED,\n\tLACP_MUX_COLLECTING,\n\tLACP_MUX_DISTRIBUTING,\n};\n\n#define\tLACP_MAX_PORTS\t\t32\n\nstruct lacp_portmap {\n\tint\t\t\tpm_count;\n\tstruct lacp_port\t*pm_map[LACP_MAX_PORTS];\n};\n\nstruct lacp_port {\n\tTAILQ_ENTRY(lacp_port)\tlp_dist_q;\n\tLIST_ENTRY(lacp_port)\tlp_next;\n\tstruct lacp_softc\t*lp_lsc;\n\tstruct lagg_port\t*lp_lagg;\n\tstruct ifnet\t\t*lp_ifp;\n\tstruct lacp_peerinfo\tlp_partner;\n\tstruct lacp_peerinfo\tlp_actor;\n\tstruct lacp_markerinfo\tlp_marker;\n#define\tlp_state\tlp_actor.lip_state\n#define\tlp_key\t\tlp_actor.lip_key\n#define\tlp_systemid\tlp_actor.lip_systemid\n\tstruct timeval\t\tlp_last_lacpdu;\n\tint\t\t\tlp_lacpdu_sent;\n\tenum lacp_mux_state\tlp_mux_state;\n\tenum lacp_selected\tlp_selected;\n\tint\t\t\tlp_flags;\n\tu_int\t\t\tlp_media; /* XXX redundant */\n\tint\t\t\tlp_timer[LACP_NTIMER];\n\tstruct ifmultiaddr\t*lp_ifma;\n\n\tstruct lacp_aggregator\t*lp_aggregator;\n};\n\nstruct lacp_aggregator {\n\tTAILQ_ENTRY(lacp_aggregator)\tla_q;\n\tint\t\t\tla_refcnt; /* num of ports which selected us */\n\tint\t\t\tla_nports; /* num of distributing ports  */\n\tTAILQ_HEAD(, lacp_port)\tla_ports; /* distributing ports */\n\tstruct lacp_peerinfo\tla_partner;\n\tstruct lacp_peerinfo\tla_actor;\n\tint\t\t\tla_pending; /* number of ports in wait_while */\n};\n\nstruct lacp_softc {\n\tstruct lagg_softc\t*lsc_softc;\n\tstruct mtx\t\tlsc_mtx;\n\tstruct lacp_aggregator\t*lsc_active_aggregator;\n\tTAILQ_HEAD(, lacp_aggregator) lsc_aggregators;\n\tboolean_t\t\tlsc_suppress_distributing;\n\tstruct callout\t\tlsc_transit_callout;\n\tstruct callout\t\tlsc_callout;\n\tLIST_HEAD(, lacp_port)\tlsc_ports;\n\tstruct lacp_portmap\tlsc_pmap[2];\n\tvolatile u_int\t\tlsc_activemap;\n\tu_int32_t\t\tlsc_hashkey;\n};\n\n#define\tLACP_TYPE_ACTORINFO\t1\n#define\tLACP_TYPE_PARTNERINFO\t2\n#define\tLACP_TYPE_COLLECTORINFO\t3\n\n/* timeout values (in sec) */\n#define\tLACP_FAST_PERIODIC_TIME\t\t(1)\n#define\tLACP_SLOW_PERIODIC_TIME\t\t(30)\n#define\tLACP_SHORT_TIMEOUT_TIME\t\t(3 * LACP_FAST_PERIODIC_TIME)\n#define\tLACP_LONG_TIMEOUT_TIME\t\t(3 * LACP_SLOW_PERIODIC_TIME)\n#define\tLACP_CHURN_DETECTION_TIME\t(60)\n#define\tLACP_AGGREGATE_WAIT_TIME\t(2)\n#define\tLACP_TRANSIT_DELAY\t\t3000\t/* in msec */\n\n#define\tLACP_STATE_EQ(s1, s2, mask)\t\\\n\t((((s1) ^ (s2)) & (mask)) == 0)\n\n#define\tLACP_SYS_PRI(peer)\t(peer).lip_systemid.lsi_prio\n\n#define\tLACP_PORT(_lp)\t((struct lacp_port *)(_lp)->lp_psc)\n#define\tLACP_SOFTC(_sc)\t((struct lacp_softc *)(_sc)->sc_psc)\n\n#define LACP_LOCK_INIT(_lsc)\t\tmtx_init(&(_lsc)->lsc_mtx, \\\n\t\t\t\t\t    \"lacp mtx\", NULL, MTX_DEF)\n#define LACP_LOCK_DESTROY(_lsc)\t\tmtx_destroy(&(_lsc)->lsc_mtx)\n#define LACP_LOCK(_lsc)\t\t\tmtx_lock(&(_lsc)->lsc_mtx)\n#define LACP_UNLOCK(_lsc)\t\tmtx_unlock(&(_lsc)->lsc_mtx)\n#define LACP_LOCK_ASSERT(_lsc)\t\tmtx_assert(&(_lsc)->lsc_mtx, MA_OWNED)\n\nstruct mbuf\t*lacp_input(struct lagg_port *, struct mbuf *);\nstruct lagg_port *lacp_select_tx_port(struct lagg_softc *, struct mbuf *);\nint\t\tlacp_attach(struct lagg_softc *);\nint\t\tlacp_detach(struct lagg_softc *);\nvoid\t\tlacp_init(struct lagg_softc *);\nvoid\t\tlacp_stop(struct lagg_softc *);\nint\t\tlacp_port_create(struct lagg_port *);\nvoid\t\tlacp_port_destroy(struct lagg_port *);\nvoid\t\tlacp_linkstate(struct lagg_port *);\nvoid\t\tlacp_req(struct lagg_softc *, caddr_t);\nvoid\t\tlacp_portreq(struct lagg_port *, caddr_t);\n\nstatic __inline int\nlacp_isactive(struct lagg_port *lgp)\n{\n\tstruct lacp_port *lp = LACP_PORT(lgp);\n\tstruct lacp_softc *lsc = lp->lp_lsc;\n\tstruct lacp_aggregator *la = lp->lp_aggregator;\n\n\t/* This port is joined to the active aggregator */\n\tif (la != NULL && la == lsc->lsc_active_aggregator)\n\t\treturn (1);\n\n\treturn (0);\n}\n\nstatic __inline int\nlacp_iscollecting(struct lagg_port *lgp)\n{\n\tstruct lacp_port *lp = LACP_PORT(lgp);\n\n\treturn ((lp->lp_state & LACP_STATE_COLLECTING) != 0);\n}\n\nstatic __inline int\nlacp_isdistributing(struct lagg_port *lgp)\n{\n\tstruct lacp_port *lp = LACP_PORT(lgp);\n\n\treturn ((lp->lp_state & LACP_STATE_DISTRIBUTING) != 0);\n}\n\n/* following constants don't include terminating NUL */\n#define\tLACP_MACSTR_MAX\t\t(2*6 + 5)\n#define\tLACP_SYSTEMPRIOSTR_MAX\t(4)\n#define\tLACP_SYSTEMIDSTR_MAX\t(LACP_SYSTEMPRIOSTR_MAX + 1 + LACP_MACSTR_MAX)\n#define\tLACP_PORTPRIOSTR_MAX\t(4)\n#define\tLACP_PORTNOSTR_MAX\t(4)\n#define\tLACP_PORTIDSTR_MAX\t(LACP_PORTPRIOSTR_MAX + 1 + LACP_PORTNOSTR_MAX)\n#define\tLACP_KEYSTR_MAX\t\t(4)\n#define\tLACP_PARTNERSTR_MAX\t\\\n\t(1 + LACP_SYSTEMIDSTR_MAX + 1 + LACP_KEYSTR_MAX + 1 \\\n\t+ LACP_PORTIDSTR_MAX + 1)\n#define\tLACP_LAGIDSTR_MAX\t\\\n\t(1 + LACP_PARTNERSTR_MAX + 1 + LACP_PARTNERSTR_MAX + 1)\n#define\tLACP_STATESTR_MAX\t(255) /* XXX */\n"
  },
  {
    "path": "freebsd-headers/net/if.h",
    "content": "/*-\n * Copyright (c) 1982, 1986, 1989, 1993\n *\tThe Regents of the University of California.  All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 4. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t@(#)if.h\t8.1 (Berkeley) 6/10/93\n * $FreeBSD: release/9.0.0/sys/net/if.h 223735 2011-07-03 12:22:02Z bz $\n */\n\n#ifndef _NET_IF_H_\n#define\t_NET_IF_H_\n\n#include <sys/cdefs.h>\n\n#ifdef _KERNEL\n#include <sys/queue.h>\n#endif\n\n#if __BSD_VISIBLE\n/*\n * <net/if.h> does not depend on <sys/time.h> on most other systems.  This\n * helps userland compatibility.  (struct timeval ifi_lastchange)\n */\n#ifndef _KERNEL\n#include <sys/time.h>\n#endif\n\nstruct ifnet;\n#endif\n\n/*\n * Length of interface external name, including terminating '\\0'.\n * Note: this is the same size as a generic device's external name.\n */\n#define\t\tIF_NAMESIZE\t16\n#if __BSD_VISIBLE\n#define\t\tIFNAMSIZ\tIF_NAMESIZE\n#define\t\tIF_MAXUNIT\t0x7fff\t/* historical value */\n#endif\n#if __BSD_VISIBLE\n\n/*\n * Structure used to query names of interface cloners.\n */\n\nstruct if_clonereq {\n\tint\tifcr_total;\t\t/* total cloners (out) */\n\tint\tifcr_count;\t\t/* room for this many in user buffer */\n\tchar\t*ifcr_buffer;\t\t/* buffer for cloner names */\n};\n\n/*\n * Structure describing information about an interface\n * which may be of interest to management entities.\n */\nstruct if_data {\n\t/* generic interface information */\n\tu_char\tifi_type;\t\t/* ethernet, tokenring, etc */\n\tu_char\tifi_physical;\t\t/* e.g., AUI, Thinnet, 10base-T, etc */\n\tu_char\tifi_addrlen;\t\t/* media address length */\n\tu_char\tifi_hdrlen;\t\t/* media header length */\n\tu_char\tifi_link_state;\t\t/* current link state */\n\tu_char\tifi_spare_char1;\t/* spare byte */\n\tu_char\tifi_spare_char2;\t/* spare byte */\n\tu_char\tifi_datalen;\t\t/* length of this data struct */\n\tu_long\tifi_mtu;\t\t/* maximum transmission unit */\n\tu_long\tifi_metric;\t\t/* routing metric (external only) */\n\tu_long\tifi_baudrate;\t\t/* linespeed */\n\t/* volatile statistics */\n\tu_long\tifi_ipackets;\t\t/* packets received on interface */\n\tu_long\tifi_ierrors;\t\t/* input errors on interface */\n\tu_long\tifi_opackets;\t\t/* packets sent on interface */\n\tu_long\tifi_oerrors;\t\t/* output errors on interface */\n\tu_long\tifi_collisions;\t\t/* collisions on csma interfaces */\n\tu_long\tifi_ibytes;\t\t/* total number of octets received */\n\tu_long\tifi_obytes;\t\t/* total number of octets sent */\n\tu_long\tifi_imcasts;\t\t/* packets received via multicast */\n\tu_long\tifi_omcasts;\t\t/* packets sent via multicast */\n\tu_long\tifi_iqdrops;\t\t/* dropped on input, this interface */\n\tu_long\tifi_noproto;\t\t/* destined for unsupported protocol */\n\tu_long\tifi_hwassist;\t\t/* HW offload capabilities, see IFCAP */\n\ttime_t\tifi_epoch;\t\t/* uptime at attach or stat reset */\n\tstruct\ttimeval ifi_lastchange;\t/* time of last administrative change */\n};\n\n/*-\n * Interface flags are of two types: network stack owned flags, and driver\n * owned flags.  Historically, these values were stored in the same ifnet\n * flags field, but with the advent of fine-grained locking, they have been\n * broken out such that the network stack is responsible for synchronizing\n * the stack-owned fields, and the device driver the device-owned fields.\n * Both halves can perform lockless reads of the other half's field, subject\n * to accepting the involved races.\n *\n * Both sets of flags come from the same number space, and should not be\n * permitted to conflict, as they are exposed to user space via a single\n * field.\n *\n * The following symbols identify read and write requirements for fields:\n *\n * (i) if_flags field set by device driver before attach, read-only there\n *     after.\n * (n) if_flags field written only by the network stack, read by either the\n *     stack or driver.\n * (d) if_drv_flags field written only by the device driver, read by either\n *     the stack or driver.\n */\n#define\tIFF_UP\t\t0x1\t\t/* (n) interface is up */\n#define\tIFF_BROADCAST\t0x2\t\t/* (i) broadcast address valid */\n#define\tIFF_DEBUG\t0x4\t\t/* (n) turn on debugging */\n#define\tIFF_LOOPBACK\t0x8\t\t/* (i) is a loopback net */\n#define\tIFF_POINTOPOINT\t0x10\t\t/* (i) is a point-to-point link */\n#define\tIFF_SMART\t0x20\t\t/* (i) interface manages own routes */\n#define\tIFF_DRV_RUNNING\t0x40\t\t/* (d) resources allocated */\n#define\tIFF_NOARP\t0x80\t\t/* (n) no address resolution protocol */\n#define\tIFF_PROMISC\t0x100\t\t/* (n) receive all packets */\n#define\tIFF_ALLMULTI\t0x200\t\t/* (n) receive all multicast packets */\n#define\tIFF_DRV_OACTIVE\t0x400\t\t/* (d) tx hardware queue is full */\n#define\tIFF_SIMPLEX\t0x800\t\t/* (i) can't hear own transmissions */\n#define\tIFF_LINK0\t0x1000\t\t/* per link layer defined bit */\n#define\tIFF_LINK1\t0x2000\t\t/* per link layer defined bit */\n#define\tIFF_LINK2\t0x4000\t\t/* per link layer defined bit */\n#define\tIFF_ALTPHYS\tIFF_LINK2\t/* use alternate physical connection */\n#define\tIFF_MULTICAST\t0x8000\t\t/* (i) supports multicast */\n#define\tIFF_CANTCONFIG\t0x10000\t\t/* (i) unconfigurable using ioctl(2) */\n#define\tIFF_PPROMISC\t0x20000\t\t/* (n) user-requested promisc mode */\n#define\tIFF_MONITOR\t0x40000\t\t/* (n) user-requested monitor mode */\n#define\tIFF_STATICARP\t0x80000\t\t/* (n) static ARP */\n#define\tIFF_DYING\t0x200000\t/* (n) interface is winding down */\n#define\tIFF_RENAMING\t0x400000\t/* (n) interface is being renamed */\n\n/*\n * Old names for driver flags so that user space tools can continue to use\n * the old (portable) names.\n */\n#ifndef _KERNEL\n#define\tIFF_RUNNING\tIFF_DRV_RUNNING\n#define\tIFF_OACTIVE\tIFF_DRV_OACTIVE\n#endif\n\n/* flags set internally only: */\n#define\tIFF_CANTCHANGE \\\n\t(IFF_BROADCAST|IFF_POINTOPOINT|IFF_DRV_RUNNING|IFF_DRV_OACTIVE|\\\n\t    IFF_SIMPLEX|IFF_MULTICAST|IFF_ALLMULTI|IFF_SMART|IFF_PROMISC|\\\n\t    IFF_DYING|IFF_CANTCONFIG)\n\n/*\n * Values for if_link_state.\n */\n#define\tLINK_STATE_UNKNOWN\t0\t/* link invalid/unknown */\n#define\tLINK_STATE_DOWN\t\t1\t/* link is down */\n#define\tLINK_STATE_UP\t\t2\t/* link is up */\n\n/*\n * Some convenience macros used for setting ifi_baudrate.\n * XXX 1000 vs. 1024? --thorpej@netbsd.org\n */\n#define\tIF_Kbps(x)\t((x) * 1000)\t\t/* kilobits/sec. */\n#define\tIF_Mbps(x)\t(IF_Kbps((x) * 1000))\t/* megabits/sec. */\n#define\tIF_Gbps(x)\t(IF_Mbps((x) * 1000))\t/* gigabits/sec. */\n\n/*\n * Capabilities that interfaces can advertise.\n *\n * struct ifnet.if_capabilities\n *   contains the optional features & capabilities a particular interface\n *   supports (not only the driver but also the detected hw revision).\n *   Capabilities are defined by IFCAP_* below.\n * struct ifnet.if_capenable\n *   contains the enabled (either by default or through ifconfig) optional\n *   features & capabilities on this interface.\n *   Capabilities are defined by IFCAP_* below.\n * struct if_data.ifi_hwassist in mbuf CSUM_ flag form, controlled by above\n *   contains the enabled optional feature & capabilites that can be used\n *   individually per packet and are specified in the mbuf pkthdr.csum_flags\n *   field.  IFCAP_* and CSUM_* do not match one to one and CSUM_* may be\n *   more detailed or differenciated than IFCAP_*.\n *   Hwassist features are defined CSUM_* in sys/mbuf.h\n *\n * Capabilities that cannot be arbitrarily changed with ifconfig/ioctl\n * are listed in IFCAP_CANTCHANGE, similar to IFF_CANTCHANGE.\n * This is not strictly necessary because the common code never\n * changes capabilities, and it is left to the individual driver\n * to do the right thing. However, having the filter here\n * avoids replication of the same code in all individual drivers.\n */\n#define\tIFCAP_RXCSUM\t\t0x00001  /* can offload checksum on RX */\n#define\tIFCAP_TXCSUM\t\t0x00002  /* can offload checksum on TX */\n#define\tIFCAP_NETCONS\t\t0x00004  /* can be a network console */\n#define\tIFCAP_VLAN_MTU\t\t0x00008\t/* VLAN-compatible MTU */\n#define\tIFCAP_VLAN_HWTAGGING\t0x00010\t/* hardware VLAN tag support */\n#define\tIFCAP_JUMBO_MTU\t\t0x00020\t/* 9000 byte MTU supported */\n#define\tIFCAP_POLLING\t\t0x00040\t/* driver supports polling */\n#define\tIFCAP_VLAN_HWCSUM\t0x00080\t/* can do IFCAP_HWCSUM on VLANs */\n#define\tIFCAP_TSO4\t\t0x00100\t/* can do TCP Segmentation Offload */\n#define\tIFCAP_TSO6\t\t0x00200\t/* can do TCP6 Segmentation Offload */\n#define\tIFCAP_LRO\t\t0x00400\t/* can do Large Receive Offload */\n#define\tIFCAP_WOL_UCAST\t\t0x00800\t/* wake on any unicast frame */\n#define\tIFCAP_WOL_MCAST\t\t0x01000\t/* wake on any multicast frame */\n#define\tIFCAP_WOL_MAGIC\t\t0x02000\t/* wake on any Magic Packet */\n#define\tIFCAP_TOE4\t\t0x04000\t/* interface can offload TCP */\n#define\tIFCAP_TOE6\t\t0x08000\t/* interface can offload TCP6 */\n#define\tIFCAP_VLAN_HWFILTER\t0x10000 /* interface hw can filter vlan tag */\n#define\tIFCAP_POLLING_NOCOUNT\t0x20000 /* polling ticks cannot be fragmented */\n#define\tIFCAP_VLAN_HWTSO\t0x40000 /* can do IFCAP_TSO on VLANs */\n#define\tIFCAP_LINKSTATE\t\t0x80000 /* the runtime link state is dynamic */\n#define\tIFCAP_NETMAP\t\t0x100000 /* netmap mode supported/enabled */\n\n#define IFCAP_HWCSUM\t(IFCAP_RXCSUM | IFCAP_TXCSUM)\n#define\tIFCAP_TSO\t(IFCAP_TSO4 | IFCAP_TSO6)\n#define\tIFCAP_WOL\t(IFCAP_WOL_UCAST | IFCAP_WOL_MCAST | IFCAP_WOL_MAGIC)\n#define\tIFCAP_TOE\t(IFCAP_TOE4 | IFCAP_TOE6)\n\n#define\tIFCAP_CANTCHANGE\t(IFCAP_NETMAP)\n\n#define\tIFQ_MAXLEN\t50\n#define\tIFNET_SLOWHZ\t1\t\t/* granularity is 1 second */\n\n/*\n * Message format for use in obtaining information about interfaces\n * from getkerninfo and the routing socket\n */\nstruct if_msghdr {\n\tu_short\tifm_msglen;\t/* to skip over non-understood messages */\n\tu_char\tifm_version;\t/* future binary compatibility */\n\tu_char\tifm_type;\t/* message type */\n\tint\tifm_addrs;\t/* like rtm_addrs */\n\tint\tifm_flags;\t/* value of if_flags */\n\tu_short\tifm_index;\t/* index for associated ifp */\n\tstruct\tif_data ifm_data;/* statistics and other data about if */\n};\n\n/*\n * Message format for use in obtaining information about interface addresses\n * from getkerninfo and the routing socket\n */\nstruct ifa_msghdr {\n\tu_short\tifam_msglen;\t/* to skip over non-understood messages */\n\tu_char\tifam_version;\t/* future binary compatibility */\n\tu_char\tifam_type;\t/* message type */\n\tint\tifam_addrs;\t/* like rtm_addrs */\n\tint\tifam_flags;\t/* value of ifa_flags */\n\tu_short\tifam_index;\t/* index for associated ifp */\n\tint\tifam_metric;\t/* value of ifa_metric */\n};\n\n/*\n * Message format for use in obtaining information about multicast addresses\n * from the routing socket\n */\nstruct ifma_msghdr {\n\tu_short\tifmam_msglen;\t/* to skip over non-understood messages */\n\tu_char\tifmam_version;\t/* future binary compatibility */\n\tu_char\tifmam_type;\t/* message type */\n\tint\tifmam_addrs;\t/* like rtm_addrs */\n\tint\tifmam_flags;\t/* value of ifa_flags */\n\tu_short\tifmam_index;\t/* index for associated ifp */\n};\n\n/*\n * Message format announcing the arrival or departure of a network interface.\n */\nstruct if_announcemsghdr {\n\tu_short\tifan_msglen;\t/* to skip over non-understood messages */\n\tu_char\tifan_version;\t/* future binary compatibility */\n\tu_char\tifan_type;\t/* message type */\n\tu_short\tifan_index;\t/* index for associated ifp */\n\tchar\tifan_name[IFNAMSIZ]; /* if name, e.g. \"en0\" */\n\tu_short\tifan_what;\t/* what type of announcement */\n};\n\n#define\tIFAN_ARRIVAL\t0\t/* interface arrival */\n#define\tIFAN_DEPARTURE\t1\t/* interface departure */\n\n/*\n * Buffer with length to be used in SIOCGIFDESCR/SIOCSIFDESCR requests\n */\nstruct ifreq_buffer {\n\tsize_t\tlength;\n\tvoid\t*buffer;\n};\n\n/*\n * Interface request structure used for socket\n * ioctl's.  All interface ioctl's must have parameter\n * definitions which begin with ifr_name.  The\n * remainder may be interface specific.\n */\nstruct\tifreq {\n\tchar\tifr_name[IFNAMSIZ];\t\t/* if name, e.g. \"en0\" */\n\tunion {\n\t\tstruct\tsockaddr ifru_addr;\n\t\tstruct\tsockaddr ifru_dstaddr;\n\t\tstruct\tsockaddr ifru_broadaddr;\n\t\tstruct\tifreq_buffer ifru_buffer;\n\t\tshort\tifru_flags[2];\n\t\tshort\tifru_index;\n\t\tint\tifru_jid;\n\t\tint\tifru_metric;\n\t\tint\tifru_mtu;\n\t\tint\tifru_phys;\n\t\tint\tifru_media;\n\t\tcaddr_t\tifru_data;\n\t\tint\tifru_cap[2];\n\t\tu_int\tifru_fib;\n\t} ifr_ifru;\n#define\tifr_addr\tifr_ifru.ifru_addr\t/* address */\n#define\tifr_dstaddr\tifr_ifru.ifru_dstaddr\t/* other end of p-to-p link */\n#define\tifr_broadaddr\tifr_ifru.ifru_broadaddr\t/* broadcast address */\n#define\tifr_buffer\tifr_ifru.ifru_buffer\t/* user supplied buffer with its length */\n#define\tifr_flags\tifr_ifru.ifru_flags[0]\t/* flags (low 16 bits) */\n#define\tifr_flagshigh\tifr_ifru.ifru_flags[1]\t/* flags (high 16 bits) */\n#define\tifr_jid\t\tifr_ifru.ifru_jid\t/* jail/vnet */\n#define\tifr_metric\tifr_ifru.ifru_metric\t/* metric */\n#define\tifr_mtu\t\tifr_ifru.ifru_mtu\t/* mtu */\n#define ifr_phys\tifr_ifru.ifru_phys\t/* physical wire */\n#define ifr_media\tifr_ifru.ifru_media\t/* physical media */\n#define\tifr_data\tifr_ifru.ifru_data\t/* for use by interface */\n#define\tifr_reqcap\tifr_ifru.ifru_cap[0]\t/* requested capabilities */\n#define\tifr_curcap\tifr_ifru.ifru_cap[1]\t/* current capabilities */\n#define\tifr_index\tifr_ifru.ifru_index\t/* interface index */\n#define\tifr_fib\t\tifr_ifru.ifru_fib\t/* interface fib */\n};\n\n#define\t_SIZEOF_ADDR_IFREQ(ifr) \\\n\t((ifr).ifr_addr.sa_len > sizeof(struct sockaddr) ? \\\n\t (sizeof(struct ifreq) - sizeof(struct sockaddr) + \\\n\t  (ifr).ifr_addr.sa_len) : sizeof(struct ifreq))\n\nstruct ifaliasreq {\n\tchar\tifra_name[IFNAMSIZ];\t\t/* if name, e.g. \"en0\" */\n\tstruct\tsockaddr ifra_addr;\n\tstruct\tsockaddr ifra_broadaddr;\n\tstruct\tsockaddr ifra_mask;\n};\n\nstruct ifmediareq {\n\tchar\tifm_name[IFNAMSIZ];\t/* if name, e.g. \"en0\" */\n\tint\tifm_current;\t\t/* current media options */\n\tint\tifm_mask;\t\t/* don't care mask */\n\tint\tifm_status;\t\t/* media status */\n\tint\tifm_active;\t\t/* active options */\n\tint\tifm_count;\t\t/* # entries in ifm_ulist array */\n\tint\t*ifm_ulist;\t\t/* media words */\n};\n\nstruct  ifdrv {\n\tchar            ifd_name[IFNAMSIZ];     /* if name, e.g. \"en0\" */\n\tunsigned long   ifd_cmd;\n\tsize_t          ifd_len;\n\tvoid            *ifd_data;\n};\n\n/* \n * Structure used to retrieve aux status data from interfaces.\n * Kernel suppliers to this interface should respect the formatting\n * needed by ifconfig(8): each line starts with a TAB and ends with\n * a newline.  The canonical example to copy and paste is in if_tun.c.\n */\n\n#define\tIFSTATMAX\t800\t\t/* 10 lines of text */\nstruct ifstat {\n\tchar\tifs_name[IFNAMSIZ];\t/* if name, e.g. \"en0\" */\n\tchar\tascii[IFSTATMAX + 1];\n};\n\n/*\n * Structure used in SIOCGIFCONF request.\n * Used to retrieve interface configuration\n * for machine (useful for programs which\n * must know all networks accessible).\n */\nstruct\tifconf {\n\tint\tifc_len;\t\t/* size of associated buffer */\n\tunion {\n\t\tcaddr_t\tifcu_buf;\n\t\tstruct\tifreq *ifcu_req;\n\t} ifc_ifcu;\n#define\tifc_buf\tifc_ifcu.ifcu_buf\t/* buffer address */\n#define\tifc_req\tifc_ifcu.ifcu_req\t/* array of structures returned */\n};\n\n/*\n * interface groups\n */\n\n#define\tIFG_ALL\t\t\"all\"\t\t/* group contains all interfaces */\n/* XXX: will we implement this? */\n#define\tIFG_EGRESS\t\"egress\"\t/* if(s) default route(s) point to */\n\nstruct ifg_req {\n\tunion {\n\t\tchar\t\t\t ifgrqu_group[IFNAMSIZ];\n\t\tchar\t\t\t ifgrqu_member[IFNAMSIZ];\n\t} ifgrq_ifgrqu;\n#define\tifgrq_group\tifgrq_ifgrqu.ifgrqu_group\n#define\tifgrq_member\tifgrq_ifgrqu.ifgrqu_member\n};\n\n/*\n * Used to lookup groups for an interface\n */\nstruct ifgroupreq {\n\tchar\tifgr_name[IFNAMSIZ];\n\tu_int\tifgr_len;\n\tunion {\n\t\tchar\tifgru_group[IFNAMSIZ];\n\t\tstruct\tifg_req *ifgru_groups;\n\t} ifgr_ifgru;\n#define ifgr_group\tifgr_ifgru.ifgru_group\n#define ifgr_groups\tifgr_ifgru.ifgru_groups\n};\n\n/*\n * Structure for SIOC[AGD]LIFADDR\n */\nstruct if_laddrreq {\n\tchar\tiflr_name[IFNAMSIZ];\n\tu_int\tflags;\n#define\tIFLR_PREFIX\t0x8000  /* in: prefix given  out: kernel fills id */\n\tu_int\tprefixlen;         /* in/out */\n\tstruct\tsockaddr_storage addr;   /* in/out */\n\tstruct\tsockaddr_storage dstaddr; /* out */\n};\n\n#endif /* __BSD_VISIBLE */\n\n#ifdef _KERNEL\n#ifdef MALLOC_DECLARE\nMALLOC_DECLARE(M_IFADDR);\nMALLOC_DECLARE(M_IFMADDR);\n#endif\n#endif\n\n#ifndef _KERNEL\nstruct if_nameindex {\n\tunsigned int\tif_index;\t/* 1, 2, ... */\n\tchar\t\t*if_name;\t/* null terminated name: \"le0\", ... */\n};\n\n__BEGIN_DECLS\nvoid\t\t\t if_freenameindex(struct if_nameindex *);\nchar\t\t\t*if_indextoname(unsigned int, char *);\nstruct if_nameindex\t*if_nameindex(void);\nunsigned int\t\t if_nametoindex(const char *);\n__END_DECLS\n#endif\n\n#ifdef _KERNEL\n/* XXX - this should go away soon. */\n#include <net/if_var.h>\n#endif\n\n#endif /* !_NET_IF_H_ */\n"
  },
  {
    "path": "freebsd-headers/net/if_arc.h",
    "content": "/*\t$NetBSD: if_arc.h,v 1.13 1999/11/19 20:41:19 thorpej Exp $\t*/\n/* $FreeBSD: release/9.0.0/sys/net/if_arc.h 194581 2009-06-21 10:29:31Z rdivacky $ */\n\n/*-\n * Copyright (c) 1982, 1986, 1993\n *\tThe Regents of the University of California.  All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 4. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * from: NetBSD: if_ether.h,v 1.10 1994/06/29 06:37:55 cgd Exp\n *       @(#)if_ether.h\t8.1 (Berkeley) 6/10/93\n */\n\n#ifndef _NET_IF_ARC_H_\n#define _NET_IF_ARC_H_\n\n/*\n * Arcnet address - 1 octets\n * don't know who uses this.\n */\nstruct arc_addr {\n\tu_int8_t  arc_addr_octet[1];\n} __packed;\n\n/*\n * Structure of a 2.5MB/s Arcnet header.\n * as given to interface code.\n */\nstruct\tarc_header {\n\tu_int8_t  arc_shost;\n\tu_int8_t  arc_dhost;\n\tu_int8_t  arc_type;\n\t/*\n\t * only present for newstyle encoding with LL fragmentation.\n\t * Don't use sizeof(anything), use ARC_HDR{,NEW}LEN instead.\n\t */\n\tu_int8_t  arc_flag;\n\tu_int16_t arc_seqid;\n\n\t/*\n\t * only present in exception packets (arc_flag == 0xff)\n\t */\n\tu_int8_t  arc_type2;\t/* same as arc_type */\n\tu_int8_t  arc_flag2;\t/* real flag value */\n\tu_int16_t arc_seqid2;\t/* real seqid value */\n} __packed;\n\n#define\tARC_ADDR_LEN\t\t1\n\n#define\tARC_HDRLEN\t\t3\n#define\tARC_HDRNEWLEN\t\t6\n#define\tARC_HDRNEWLEN_EXC\t10\n\n/* these lengths are data link layer length - 2 * ARC_ADDR_LEN */\n#define\tARC_MIN_LEN\t\t1\n#define\tARC_MIN_FORBID_LEN\t254\n#define\tARC_MAX_FORBID_LEN\t256\n#define\tARC_MAX_LEN\t\t508\n#define ARC_MAX_DATA\t\t504\n\n/* RFC 1051 */\n#define\tARCTYPE_IP_OLD\t\t240\t/* IP protocol */\n#define\tARCTYPE_ARP_OLD\t\t241\t/* address resolution protocol */\n\n/* RFC 1201 */\n#define\tARCTYPE_IP\t\t212\t/* IP protocol */\n#define\tARCTYPE_ARP\t\t213\t/* address resolution protocol */\n#define\tARCTYPE_REVARP\t\t214\t/* reverse addr resolution protocol */\n\n#define\tARCTYPE_ATALK\t\t221\t/* Appletalk */\n#define\tARCTYPE_BANIAN\t\t247\t/* Banyan Vines */\n#define\tARCTYPE_IPX\t\t250\t/* Novell IPX */\n\n#define ARCTYPE_INET6\t\t0xc4\t/* IPng */\n#define ARCTYPE_DIAGNOSE\t0x80\t/* as per ANSI/ATA 878.1 */\n\n#define\tARCMTU\t\t\t507\n#define\tARCMIN\t\t\t0\n\n#define ARC_PHDS_MAXMTU\t\t60480\n\nstruct\tarccom {\n\tstruct\t  ifnet *ac_ifp;\t/* network-visible interface */\n\n\tu_int16_t ac_seqid;\t\t/* seq. id used by PHDS encap. */\n\n\tu_int8_t  arc_shost;\n\tu_int8_t  arc_dhost;\n\tu_int8_t  arc_type;\n\n\tu_int8_t  dummy0;\n\tu_int16_t dummy1;\n\tint sflag, fsflag, rsflag;\n\tstruct mbuf *curr_frag;\n\n\tstruct ac_frag {\n\t\tu_int8_t  af_maxflag;\t/* from first packet */\n\t\tu_int8_t  af_lastseen;\t/* last split flag seen */\n\t\tu_int16_t af_seqid;\n\t\tstruct mbuf *af_packet;\n\t} ac_fragtab[256];\t\t/* indexed by sender ll address */\n};\n\n#ifdef _KERNEL\nextern u_int8_t arcbroadcastaddr;\nextern int arc_ipmtu;\t/* XXX new ip only, no RFC 1051! */\n\nvoid\tarc_ifattach(struct ifnet *, u_int8_t);\nvoid\tarc_ifdetach(struct ifnet *);\nvoid\tarc_storelladdr(struct ifnet *, u_int8_t);\nint\tarc_isphds(u_int8_t);\nvoid\tarc_input(struct ifnet *, struct mbuf *);\nint\tarc_output(struct ifnet *, struct mbuf *,\n\t    struct sockaddr *, struct route *);\nint\tarc_ioctl(struct ifnet *, u_long, caddr_t);\n\nvoid\t\tarc_frag_init(struct ifnet *);\nstruct mbuf *\tarc_frag_next(struct ifnet *);\n#endif\n\n#endif /* _NET_IF_ARC_H_ */\n"
  },
  {
    "path": "freebsd-headers/net/if_arp.h",
    "content": "/*-\n * Copyright (c) 1986, 1993\n *\tThe Regents of the University of California.  All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 4. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t@(#)if_arp.h\t8.1 (Berkeley) 6/10/93\n * $FreeBSD: release/9.0.0/sys/net/if_arp.h 219819 2011-03-21 09:40:01Z jeff $\n */\n\n#ifndef _NET_IF_ARP_H_\n#define\t_NET_IF_ARP_H_\n\n/*\n * Address Resolution Protocol.\n *\n * See RFC 826 for protocol description.  ARP packets are variable\n * in size; the arphdr structure defines the fixed-length portion.\n * Protocol type values are the same as those for 10 Mb/s Ethernet.\n * It is followed by the variable-sized fields ar_sha, arp_spa,\n * arp_tha and arp_tpa in that order, according to the lengths\n * specified.  Field names used correspond to RFC 826.\n */\nstruct\tarphdr {\n\tu_short\tar_hrd;\t\t/* format of hardware address */\n#define ARPHRD_ETHER \t1\t/* ethernet hardware format */\n#define ARPHRD_IEEE802\t6\t/* token-ring hardware format */\n#define ARPHRD_ARCNET\t7\t/* arcnet hardware format */\n#define ARPHRD_FRELAY \t15\t/* frame relay hardware format */\n#define ARPHRD_IEEE1394\t24\t/* firewire hardware format */\n#define ARPHRD_INFINIBAND 32\t/* infiniband hardware format */\n\tu_short\tar_pro;\t\t/* format of protocol address */\n\tu_char\tar_hln;\t\t/* length of hardware address */\n\tu_char\tar_pln;\t\t/* length of protocol address */\n\tu_short\tar_op;\t\t/* one of: */\n#define\tARPOP_REQUEST\t1\t/* request to resolve address */\n#define\tARPOP_REPLY\t2\t/* response to previous request */\n#define\tARPOP_REVREQUEST 3\t/* request protocol address given hardware */\n#define\tARPOP_REVREPLY\t4\t/* response giving protocol address */\n#define ARPOP_INVREQUEST 8 \t/* request to identify peer */\n#define ARPOP_INVREPLY\t9\t/* response identifying peer */\n/*\n * The remaining fields are variable in size,\n * according to the sizes above.\n */\n#ifdef COMMENT_ONLY\n\tu_char\tar_sha[];\t/* sender hardware address */\n\tu_char\tar_spa[];\t/* sender protocol address */\n\tu_char\tar_tha[];\t/* target hardware address */\n\tu_char\tar_tpa[];\t/* target protocol address */\n#endif\n};\n\n#define ar_sha(ap)\t(((caddr_t)((ap)+1)) +   0)\n#define ar_spa(ap)\t(((caddr_t)((ap)+1)) +   (ap)->ar_hln)\n#define ar_tha(ap)\t(((caddr_t)((ap)+1)) +   (ap)->ar_hln + (ap)->ar_pln)\n#define ar_tpa(ap)\t(((caddr_t)((ap)+1)) + 2*(ap)->ar_hln + (ap)->ar_pln)\n\n#define arphdr_len2(ar_hln, ar_pln)\t\t\t\t\t\\\n\t(sizeof(struct arphdr) + 2*(ar_hln) + 2*(ar_pln))\n#define arphdr_len(ap)\t(arphdr_len2((ap)->ar_hln, (ap)->ar_pln))\n\n/*\n * ARP ioctl request\n */\nstruct arpreq {\n\tstruct\tsockaddr arp_pa;\t\t/* protocol address */\n\tstruct\tsockaddr arp_ha;\t\t/* hardware address */\n\tint\tarp_flags;\t\t\t/* flags */\n};\n/*  arp_flags and at_flags field values */\n#define\tATF_INUSE\t0x01\t/* entry in use */\n#define ATF_COM\t\t0x02\t/* completed entry (enaddr valid) */\n#define\tATF_PERM\t0x04\t/* permanent entry */\n#define\tATF_PUBL\t0x08\t/* publish entry (respond for other host) */\n#define\tATF_USETRAILERS\t0x10\t/* has requested trailers */\n\n#ifdef _KERNEL\n/*\n * Structure shared between the ethernet driver modules and\n * the address resolution code.\n */\nstruct\tarpcom {\n\tstruct \tifnet *ac_ifp;\t\t/* network-visible interface */\n\tvoid\t*ac_netgraph;\t\t/* ng_ether(4) netgraph node info */\n};\n#define IFP2AC(ifp) ((struct arpcom *)(ifp->if_l2com))\n#define AC2IFP(ac) ((ac)->ac_ifp)\n\n#endif /* _KERNEL */\n\nstruct arpstat {\n\t/* Normal things that happen: */\n\tu_long txrequests;\t/* # of ARP requests sent by this host. */\n\tu_long txreplies;\t/* # of ARP replies sent by this host. */\n\tu_long rxrequests;\t/* # of ARP requests received by this host. */\n\tu_long rxreplies;\t/* # of ARP replies received by this host. */\n\tu_long received;\t/* # of ARP packets received by this host. */\n\n\tu_long arp_spares[4];\t/* For either the upper or lower half. */\n\t/* Abnormal event and error  counting: */\n\tu_long dropped;\t\t/* # of packets dropped waiting for a reply. */\n\tu_long timeouts;\t/* # of times with entries removed */\n\t\t\t\t/* due to timeout. */\n\tu_long dupips;\t\t/* # of duplicate IPs detected. */\n};\n\n/*\n * In-kernel consumers can use these accessor macros directly to update\n * stats.\n */\n#define\tARPSTAT_ADD(name, val)\tV_arpstat.name += (val)\n#define\tARPSTAT_SUB(name, val)\tV_arpstat.name -= (val)\n#define\tARPSTAT_INC(name)\tARPSTAT_ADD(name, 1)\n#define\tARPSTAT_DEC(name)\tARPSTAT_SUB(name, 1)\n\n#endif /* !_NET_IF_ARP_H_ */\n"
  },
  {
    "path": "freebsd-headers/net/if_atm.h",
    "content": "/*      $NetBSD: if_atm.h,v 1.7 1996/11/09 23:02:27 chuck Exp $       */\n/* $FreeBSD: release/9.0.0/sys/net/if_atm.h 191148 2009-04-16 20:30:28Z kmacy $ */\n\n/*-\n *\n * Copyright (c) 1996 Charles D. Cranor and Washington University.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. All advertising materials mentioning features or use of this software\n *    must display the following acknowledgement:\n *      This product includes software developed by Charles D. Cranor and\n *\tWashington University.\n * 4. The name of the author may not be used to endorse or promote products\n *    derived from this software without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR\n * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES\n * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,\n * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF\n * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n */\n\n/*\n * net/if_atm.h\n */\n\n/*\n * Classification of ATM cards.\n */\n#define\tATM_DEVICE_UNKNOWN\t0\n#define\tATM_DEVICE_PCA200E\t1\t/* Fore/Marconi PCA200-E */\n#define\tATM_DEVICE_HE155\t2\t/* Fore/Marconi HE155 */\n#define\tATM_DEVICE_HE622\t3\t/* Fore/Marconi HE622 */\n#define\tATM_DEVICE_ENI155P\t4\t/* Efficient networks 155p */\n#define\tATM_DEVICE_ADP155P\t5\t/* Adaptec 155p */\n#define\tATM_DEVICE_FORELE25\t6\t/* ForeRunnerLE 25 */\n#define\tATM_DEVICE_FORELE155\t7\t/* ForeRunnerLE 155 */\n#define\tATM_DEVICE_NICSTAR25\t8\t/* other 77211 25.6MBit */\n#define\tATM_DEVICE_NICSTAR155\t9\t/* other 77211 155MBit */\n#define\tATM_DEVICE_IDTABR25\t10\t/* 77252 based card 25MBit */\n#define\tATM_DEVICE_IDTABR155\t11\t/* 77252 based card 155MBit */\n#define\tATM_DEVICE_PROATM25\t12\t/* 77252 based ProSum card 25MBit */\n#define\tATM_DEVICE_PROATM155\t13\t/* 77252 based ProSum card 155MBit */\n#define\tATM_DEVICE_VIRTUAL\t14\t/* virtual ATM device (netgraph) */\n\n/* map to strings and vendors */\n#define\tATM_DEVICE_NAMES\t\t\t\t\t\t\\\n\t{ \"Unknown\",\t\t\"Unknown\" },\t\t\t\t\\\n\t{ \"PCA200-E\",\t\t\"Fore/Marconi\" },\t\t\t\\\n\t{ \"HE155\",\t\t\"Fore/Marconi\" },\t\t\t\\\n\t{ \"HE622\",\t\t\"Fore/Marconi\" },\t\t\t\\\n\t{ \"ENI155p\",\t\t\"Efficient Networks\" },\t\t\t\\\n\t{ \"ADP155p\",\t\t\"Adaptec\" },\t\t\t\t\\\n\t{ \"ForeRunnerLE25\",\t\"Fore/Marconi\" },\t\t\t\\\n\t{ \"ForeRunnerLE155\",\t\"Fore/Marconi\" },\t\t\t\\\n\t{ \"IDT77211/25\",\t\"IDT\" },\t\t\t\t\\\n\t{ \"IDT77211/155\",\t\"IDT\" },\t\t\t\t\\\n\t{ \"IDT77252/25\",\t\"IDT\" },\t\t\t\t\\\n\t{ \"IDT77252/155\",\t\"IDT\" },\t\t\t\t\\\n\t{ \"ProATM/25\",\t\t\"ProSum\" },\t\t\t\t\\\n\t{ \"ProATM/155\",\t\t\"ProSum\" },\t\t\t\t\\\n\t{ \"Virtual\",\t\t\"NetGraph\" },\n\n/*\n * This is the common link layer MIB for all ATM interfaces. Much of the\n * information here is needed for ILMI. This will be augmented by statistics\n * at some point.\n */\nstruct ifatm_mib {\n\t/* configuration data */\n\tuint8_t\t\tdevice;\t\t/* type of card */\n\tu_char\t\tesi[6];\t\t/* end system identifier (MAC) */\n\tuint32_t\tserial;\t\t/* card serial number */\n\tuint32_t\thw_version;\t/* card version */\n\tuint32_t\tsw_version;\t/* firmware version (if any) */\n\tuint32_t\tpcr;\t\t/* supported peak cell rate */\n\tuint32_t\tmedia;\t\t/* physical media */\n\tuint8_t\t\tvpi_bits;\t/* number of used bits in VPI field */\n\tuint8_t\t\tvci_bits;\t/* number of used bits in VCI field */\n\tuint16_t\tmax_vpcs;\t/* maximum number of VPCs */\n\tuint32_t\tmax_vccs;\t/* maximum number of VCCs */\n};\n\n/*\n * Traffic parameters for ATM connections. This contains all parameters\n * to accomodate UBR, UBR+MCR, CBR, VBR and ABR connections.\n *\n * Keep in sync with ng_atm.h\n */\nstruct atmio_tparam {\n\tuint32_t\tpcr;\t/* 24bit: Peak Cell Rate */\n\tuint32_t\tscr;\t/* 24bit: VBR Sustainable Cell Rate */\n\tuint32_t\tmbs;\t/* 24bit: VBR Maximum burst size */\n\tuint32_t\tmcr;\t/* 24bit: ABR/VBR/UBR+MCR MCR */\n\tuint32_t\ticr;\t/* 24bit: ABR ICR */\n\tuint32_t\ttbe;\t/* 24bit: ABR TBE (1...2^24-1) */\n\tuint8_t\t\tnrm;\t/*  3bit: ABR Nrm */\n\tuint8_t\t\ttrm;\t/*  3bit: ABR Trm */\n\tuint16_t\tadtf;\t/* 10bit: ABR ADTF */\n\tuint8_t\t\trif;\t/*  4bit: ABR RIF */\n\tuint8_t\t\trdf;\t/*  4bit: ABR RDF */\n\tuint8_t\t\tcdf;\t/*  3bit: ABR CDF */\n};\n\n/*\n * VCC parameters\n *\n * Keep in sync with ng_atm.h\n */\nstruct atmio_vcc {\n\tuint16_t\tflags;\t\t/* VCC flags */\n\tuint16_t\tvpi;\n\tuint16_t\tvci;\n\tuint16_t\trmtu;\t\t/* maximum receive PDU */\n\tuint16_t\ttmtu;\t\t/* maximum transmit PDU */\n\tuint8_t\t\taal;\t\t/* aal type */\n\tuint8_t\t\ttraffic;\t/* traffic type */\n\tstruct atmio_tparam tparam;\t/* traffic parameters */\n};\n\n/* VCC flags */\n#define\tATMIO_FLAG_LLCSNAP\t0x0002\t/* same as ATM_PH_LLCSNAP */\n#define\tATMIO_FLAG_NG\t\t0x0010\t/* owned by netgraph */\n#define\tATMIO_FLAG_HARP\t\t0x0020\t/* owned by HARP */\n#define\tATMIO_FLAG_NORX\t\t0x0100\t/* not receiving on this VCC */\n#define\tATMIO_FLAG_NOTX\t\t0x0200\t/* not transmitting on this VCC */\n#define\tATMIO_FLAG_PVC\t\t0x0400\t/* this is a PVC */\n#define\tATMIO_FLAG_ASYNC\t0x0800\t/* async open/close */\n#define\tATMIO_FLAGS\t\"\\020\\2LLCSNAP\\5NG\\6HARP\\11NORX\\12NOTX\\13PVC\\14ASYNC\"\n\n#define\tATMIO_AAL_0\t\t0\t/* pure cells */\n#define\tATMIO_AAL_34\t\t4\t/* AAL3 and 4 */\n#define\tATMIO_AAL_5\t\t5\t/* AAL5 */\n#define\tATMIO_AAL_RAW\t\t10\t/* whatever the card does */\n\n#define\tATMIO_TRAFFIC_UBR\t0\n#define\tATMIO_TRAFFIC_CBR\t1\n#define\tATMIO_TRAFFIC_ABR\t2\n#define\tATMIO_TRAFFIC_VBR\t3\n\n/*\n * VCC table\n *\n * Keep in sync with ng_atm.h\n */\nstruct atmio_vcctable {\n\tuint32_t\tcount;\t\t/* number of vccs */\n\tstruct atmio_vcc vccs[0];\t/* array of VCCs */\n};\n\n/*\n * Peak cell rates for various physical media. Note, that there are\n * different opinions on what the correct values are.\n */\n#define\tATM_RATE_25_6M\t\t59259\n#define\tATM_RATE_155M\t\t353208\n#define\tATM_RATE_622M\t\t1412830\n#define\tATM_RATE_2_4G\t\t5651320\n\n#ifdef _KERNEL\n/*\n * Common fields for all ATM interfaces. Each driver's softc must start with\n * this structure.\n */\nstruct ifatm {\n\tstruct ifnet\t*ifp;\n\tstruct ifatm_mib mib;\t\t/* exported data */\n\tvoid\t\t*phy;\t\t/* usually SUNI */\n\tvoid\t\t*ngpriv;\t/* netgraph link */\n};\n#define\tIFP2IFATM(ifp)\t((struct ifatm *)(ifp)->if_l2com)\n#endif\n\n/*\n * Keep structures in sync with ng_atm.h\n *\n * These are used by netgraph/harp to call the driver\n * NATM uses the atm_pseudoioctl instead.\n */\nstruct atmio_openvcc {\n\tvoid\t\t*rxhand;\t/* handle argument */\n\tstruct atmio_vcc param;\t\t/* parameters */\n};\n\nstruct atmio_closevcc {\n\tuint16_t\tvpi;\n\tuint16_t\tvci;\n};\n\n#if defined(__NetBSD__) || defined(__OpenBSD__) || defined(__bsdi__)\n#define\tRTALLOC1(A,B)\t\trtalloc1((A),(B))\n#elif defined(__FreeBSD__)\n#define\tRTALLOC1(A,B)\t\trtalloc1((A),(B),0UL)\n#endif\n\n/*\n * pseudo header for packet transmission\n */\nstruct atm_pseudohdr {\n\tuint8_t\t\tatm_ph[4];\t/* flags+VPI+VCI1(msb)+VCI2(lsb) */\n};\n\n#define\tATM_PH_FLAGS(X)\t((X)->atm_ph[0])\n#define\tATM_PH_VPI(X)\t((X)->atm_ph[1])\n#define\tATM_PH_VCI(X)\t((((X)->atm_ph[2]) << 8) | ((X)->atm_ph[3]))\n#define\tATM_PH_SETVCI(X,V) { \\\n\t(X)->atm_ph[2] = ((V) >> 8) & 0xff; \\\n\t(X)->atm_ph[3] = ((V) & 0xff); \\\n}\n\n/* use AAL5? (0 == aal0) */\n#define\tATM_PH_AAL5\t0x01\n/* use the LLC SNAP encoding (iff aal5) */\n#define\tATM_PH_LLCSNAP ATMIO_FLAG_LLCSNAP\n\n#define\tATM_PH_DRIVER7  0x40\t/* reserve for driver's use */\n#define\tATM_PH_DRIVER8  0x80\t/* reserve for driver's use */\n\n#define\tATMMTU\t\t9180\t/* ATM MTU size for IP */\n\t\t\t\t/* XXX: could be 9188 with LLC/SNAP according\n\t\t\t\t\tto comer */\n\n#define\tSIOCATMGETVCCS\t_IOW('a', 125, struct atmio_vcctable)\n#define\tSIOCATMOPENVCC\t_IOR('a', 126, struct atmio_openvcc)\n#define\tSIOCATMCLOSEVCC _IOR('a', 127, struct atmio_closevcc)\n\n#define\tSIOCATMGVCCS\t_IOWR('i', 230, struct ifreq)\n\n/*\n * XXX forget all the garbage in if_llc.h and do it the easy way\n */\n#define\tATMLLC_HDR \"\\252\\252\\3\\0\\0\\0\"\nstruct atmllc {\n\tuint8_t\t\tllchdr[6];\t/* aa.aa.03.00.00.00 */\n\tuint8_t\t\ttype[2];\t/* \"ethernet\" type */\n};\n\n/* ATM_LLC macros: note type code in host byte order */\n#define\tATM_LLC_TYPE(X) (((X)->type[0] << 8) | ((X)->type[1]))\n#define\tATM_LLC_SETTYPE(X, V) do {\t\t\\\n\t(X)->type[0] = ((V) >> 8) & 0xff;\t\\\n\t(X)->type[1] = ((V) & 0xff);\t\t\\\n    } while (0)\n\n/*\n * Events that are emitted by the driver. Currently the only consumer\n * of this is the netgraph node.\n */\n#define\tATMEV_FLOW_CONTROL\t0x0001\t/* channel busy state changed */\n#define\tATMEV_IFSTATE_CHANGED\t0x0002\t/* up/down or carrier */\n#define\tATMEV_VCC_CHANGED\t0x0003\t/* PVC deleted/create */\n#define\tATMEV_ACR_CHANGED\t0x0004\t/* ABR ACR has changed */\n\nstruct atmev_flow_control {\n\tuint16_t\tvpi;\t\t/* channel that is changed */\n\tuint16_t\tvci;\n\tu_int\t\tbusy : 1;\t/* != 0 -> ATM layer busy */\n};\n\nstruct atmev_ifstate_changed {\n\tu_int\t\trunning : 1;\t/* interface is running now */\n\tu_int\t\tcarrier : 1;\t/* carrier detected (or not) */\n};\n\nstruct atmev_vcc_changed {\n\tuint16_t\tvpi;\t\t/* channel that is changed */\n\tuint16_t\tvci;\n\tu_int\t\tup : 1;\t\t/* 1 - created, 0 - deleted */\n};\n\nstruct atmev_acr_changed {\n\tuint16_t\tvpi;\t\t/* channel that is changed */\n\tuint16_t\tvci;\n\tuint32_t\tacr;\t\t/* new ACR */\n};\n\n#ifdef _KERNEL\nvoid\tatm_ifattach(struct ifnet *);\nvoid\tatm_ifdetach(struct ifnet *);\nvoid\tatm_input(struct ifnet *, struct atm_pseudohdr *,\n\t    struct mbuf *, void *);\nint\tatm_output(struct ifnet *, struct mbuf *, struct sockaddr *, \n\t    struct route *);\nstruct atmio_vcctable *atm_getvccs(struct atmio_vcc **, u_int, u_int,\n\t    struct mtx *, int);\n\nvoid\tatm_event(struct ifnet *, u_int, void *);\n\n#define\tATMEV_SEND_FLOW_CONTROL(ATMIF, VPI, VCI, BUSY)\t\t\t\\\n\tdo {\t\t\t\t\t\t\t\t\\\n\t\tstruct atmev_flow_control _arg;\t\t\t\t\\\n\t\t_arg.vpi = (VPI);\t\t\t\t\t\\\n\t\t_arg.vci = (VCI);\t\t\t\t\t\\\n\t\t_arg.busy = (BUSY);\t\t\t\t\t\\\n\t\tatm_event((ATMIF)->ifp, ATMEV_FLOW_CONTROL, &_arg);\t\\\n\t} while (0)\n\n#define\tATMEV_SEND_VCC_CHANGED(ATMIF, VPI, VCI, UP)\t\t\t\\\n\tdo {\t\t\t\t\t\t\t\t\\\n\t\tstruct atmev_vcc_changed _arg;\t\t\t\t\\\n\t\t_arg.vpi = (VPI);\t\t\t\t\t\\\n\t\t_arg.vci = (VCI);\t\t\t\t\t\\\n\t\t_arg.up = (UP);\t\t\t\t\t\t\\\n\t\tatm_event((ATMIF)->ifp, ATMEV_VCC_CHANGED, &_arg);\t\\\n\t} while (0)\n\n#define\tATMEV_SEND_IFSTATE_CHANGED(ATMIF, CARRIER)\t\t\t\\\n\tdo {\t\t\t\t\t\t\t\t\\\n\t\tstruct atmev_ifstate_changed _arg;\t\t\t\\\n\t\t_arg.running = (((ATMIF)->ifp->if_drv_flags &\t\t\\\n\t\t    IFF_DRV_RUNNING) != 0);\t\t\t\t\\\n\t\t_arg.carrier = ((CARRIER) != 0);\t\t\t\\\n\t\tatm_event((ATMIF)->ifp, ATMEV_IFSTATE_CHANGED, &_arg); \\\n\t} while (0)\n\n#define\tATMEV_SEND_ACR_CHANGED(ATMIF, VPI, VCI, ACR)\t\t\t\\\n\tdo {\t\t\t\t\t\t\t\t\\\n\t\tstruct atmev_acr_changed _arg;\t\t\t\t\\\n\t\t_arg.vpi = (VPI);\t\t\t\t\t\\\n\t\t_arg.vci = (VCI);\t\t\t\t\t\\\n\t\t_arg.acr= (ACR);\t\t\t\t\t\\\n\t\tatm_event((ATMIF)->ifp, ATMEV_ACR_CHANGED, &_arg);\t\\\n\t} while (0)\n#endif\n"
  },
  {
    "path": "freebsd-headers/net/if_bridgevar.h",
    "content": "/*\t$NetBSD: if_bridgevar.h,v 1.4 2003/07/08 07:13:50 itojun Exp $\t*/\n\n/*\n * Copyright 2001 Wasabi Systems, Inc.\n * All rights reserved.\n *\n * Written by Jason R. Thorpe for Wasabi Systems, Inc.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. All advertising materials mentioning features or use of this software\n *    must display the following acknowledgement:\n *\tThis product includes software developed for the NetBSD Project by\n *\tWasabi Systems, Inc.\n * 4. The name of Wasabi Systems, Inc. may not be used to endorse\n *    or promote products derived from this software without specific prior\n *    written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY WASABI SYSTEMS, INC. ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED\n * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\n * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL WASABI SYSTEMS, INC\n * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\n * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\n * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\n * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\n * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\n/*\n * Copyright (c) 1999, 2000 Jason L. Wright (jason@thought.net)\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. All advertising materials mentioning features or use of this software\n *    must display the following acknowledgement:\n *\tThis product includes software developed by Jason L. Wright\n * 4. The name of the author may not be used to endorse or promote products\n *    derived from this software without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR\n * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\n * DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR\n * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,\n * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n *\n * OpenBSD: if_bridge.h,v 1.14 2001/03/22 03:48:29 jason Exp\n *\n * $FreeBSD: release/9.0.0/sys/net/if_bridgevar.h 173320 2007-11-04 08:32:27Z thompsa $\n */\n\n/*\n * Data structure and control definitions for bridge interfaces.\n */\n\n#include <sys/callout.h>\n#include <sys/queue.h>\n#include <sys/condvar.h>\n\n/*\n * Commands used in the SIOCSDRVSPEC ioctl.  Note the lookup of the\n * bridge interface itself is keyed off the ifdrv structure.\n */\n#define\tBRDGADD\t\t\t0\t/* add bridge member (ifbreq) */\n#define\tBRDGDEL\t\t\t1\t/* delete bridge member (ifbreq) */\n#define\tBRDGGIFFLGS\t\t2\t/* get member if flags (ifbreq) */\n#define\tBRDGSIFFLGS\t\t3\t/* set member if flags (ifbreq) */\n#define\tBRDGSCACHE\t\t4\t/* set cache size (ifbrparam) */\n#define\tBRDGGCACHE\t\t5\t/* get cache size (ifbrparam) */\n#define\tBRDGGIFS\t\t6\t/* get member list (ifbifconf) */\n#define\tBRDGRTS\t\t\t7\t/* get address list (ifbaconf) */\n#define\tBRDGSADDR\t\t8\t/* set static address (ifbareq) */\n#define\tBRDGSTO\t\t\t9\t/* set cache timeout (ifbrparam) */\n#define\tBRDGGTO\t\t\t10\t/* get cache timeout (ifbrparam) */\n#define\tBRDGDADDR\t\t11\t/* delete address (ifbareq) */\n#define\tBRDGFLUSH\t\t12\t/* flush address cache (ifbreq) */\n\n#define\tBRDGGPRI\t\t13\t/* get priority (ifbrparam) */\n#define\tBRDGSPRI\t\t14\t/* set priority (ifbrparam) */\n#define\tBRDGGHT\t\t\t15\t/* get hello time (ifbrparam) */\n#define\tBRDGSHT\t\t\t16\t/* set hello time (ifbrparam) */\n#define\tBRDGGFD\t\t\t17\t/* get forward delay (ifbrparam) */\n#define\tBRDGSFD\t\t\t18\t/* set forward delay (ifbrparam) */\n#define\tBRDGGMA\t\t\t19\t/* get max age (ifbrparam) */\n#define\tBRDGSMA\t\t\t20\t/* set max age (ifbrparam) */\n#define\tBRDGSIFPRIO\t\t21\t/* set if priority (ifbreq) */\n#define\tBRDGSIFCOST\t\t22\t/* set if path cost (ifbreq) */\n#define\tBRDGADDS\t\t23\t/* add bridge span member (ifbreq) */\n#define\tBRDGDELS\t\t24\t/* delete bridge span member (ifbreq) */\n#define\tBRDGPARAM\t\t25\t/* get bridge STP params (ifbropreq) */\n#define\tBRDGGRTE\t\t26\t/* get cache drops (ifbrparam) */\n#define\tBRDGGIFSSTP\t\t27\t/* get member STP params list\n\t\t\t\t\t * (ifbpstpconf) */\n#define\tBRDGSPROTO\t\t28\t/* set protocol (ifbrparam) */\n#define\tBRDGSTXHC\t\t29\t/* set tx hold count (ifbrparam) */\n#define\tBRDGSIFAMAX\t\t30\t/* set max interface addrs (ifbreq) */\n\n/*\n * Generic bridge control request.\n */\nstruct ifbreq {\n\tchar\t\tifbr_ifsname[IFNAMSIZ];\t/* member if name */\n\tuint32_t\tifbr_ifsflags;\t\t/* member if flags */\n\tuint32_t\tifbr_stpflags;\t\t/* member if STP flags */\n\tuint32_t\tifbr_path_cost;\t\t/* member if STP cost */\n\tuint8_t\t\tifbr_portno;\t\t/* member if port number */\n\tuint8_t\t\tifbr_priority;\t\t/* member if STP priority */\n\tuint8_t\t\tifbr_proto;\t\t/* member if STP protocol */\n\tuint8_t\t\tifbr_role;\t\t/* member if STP role */\n\tuint8_t\t\tifbr_state;\t\t/* member if STP state */\n\tuint32_t\tifbr_addrcnt;\t\t/* member if addr number */\n\tuint32_t\tifbr_addrmax;\t\t/* member if addr max */\n\tuint32_t\tifbr_addrexceeded;\t/* member if addr violations */\n\tuint8_t\t\tpad[32];\n};\n\n/* BRDGGIFFLAGS, BRDGSIFFLAGS */\n#define\tIFBIF_LEARNING\t\t0x0001\t/* if can learn */\n#define\tIFBIF_DISCOVER\t\t0x0002\t/* if sends packets w/ unknown dest. */\n#define\tIFBIF_STP\t\t0x0004\t/* if participates in spanning tree */\n#define\tIFBIF_SPAN\t\t0x0008\t/* if is a span port */\n#define\tIFBIF_STICKY\t\t0x0010\t/* if learned addresses stick */\n#define\tIFBIF_BSTP_EDGE\t\t0x0020\t/* member stp edge port */\n#define\tIFBIF_BSTP_AUTOEDGE\t0x0040\t/* member stp autoedge enabled */\n#define\tIFBIF_BSTP_PTP\t\t0x0080\t/* member stp point to point */\n#define\tIFBIF_BSTP_AUTOPTP\t0x0100\t/* member stp autoptp enabled */\n#define\tIFBIF_BSTP_ADMEDGE\t0x0200\t/* member stp admin edge enabled */\n#define\tIFBIF_BSTP_ADMCOST\t0x0400\t/* member stp admin path cost */\n#define\tIFBIF_PRIVATE\t\t0x0800\t/* if is a private segment */\n\n#define\tIFBIFBITS\t\"\\020\\001LEARNING\\002DISCOVER\\003STP\\004SPAN\" \\\n\t\t\t\"\\005STICKY\\014PRIVATE\\006EDGE\\007AUTOEDGE\\010PTP\" \\\n\t\t\t\"\\011AUTOPTP\"\n#define\tIFBIFMASK\t~(IFBIF_BSTP_EDGE|IFBIF_BSTP_AUTOEDGE|IFBIF_BSTP_PTP| \\\n\t\t\tIFBIF_BSTP_AUTOPTP|IFBIF_BSTP_ADMEDGE| \\\n\t\t\tIFBIF_BSTP_ADMCOST)\t/* not saved */\n\n/* BRDGFLUSH */\n#define\tIFBF_FLUSHDYN\t\t0x00\t/* flush learned addresses only */\n#define\tIFBF_FLUSHALL\t\t0x01\t/* flush all addresses */\n\n/*\n * Interface list structure.\n */\nstruct ifbifconf {\n\tuint32_t\tifbic_len;\t/* buffer size */\n\tunion {\n\t\tcaddr_t\tifbicu_buf;\n\t\tstruct ifbreq *ifbicu_req;\n\t} ifbic_ifbicu;\n#define\tifbic_buf\tifbic_ifbicu.ifbicu_buf\n#define\tifbic_req\tifbic_ifbicu.ifbicu_req\n};\n\n/*\n * Bridge address request.\n */\nstruct ifbareq {\n\tchar\t\tifba_ifsname[IFNAMSIZ];\t/* member if name */\n\tunsigned long\tifba_expire;\t\t/* address expire time */\n\tuint8_t\t\tifba_flags;\t\t/* address flags */\n\tuint8_t\t\tifba_dst[ETHER_ADDR_LEN];/* destination address */\n\tuint16_t\tifba_vlan;\t\t/* vlan id */\n};\n\n#define\tIFBAF_TYPEMASK\t0x03\t/* address type mask */\n#define\tIFBAF_DYNAMIC\t0x00\t/* dynamically learned address */\n#define\tIFBAF_STATIC\t0x01\t/* static address */\n#define\tIFBAF_STICKY\t0x02\t/* sticky address */\n\n#define\tIFBAFBITS\t\"\\020\\1STATIC\\2STICKY\"\n\n/*\n * Address list structure.\n */\nstruct ifbaconf {\n\tuint32_t\tifbac_len;\t/* buffer size */\n\tunion {\n\t\tcaddr_t ifbacu_buf;\n\t\tstruct ifbareq *ifbacu_req;\n\t} ifbac_ifbacu;\n#define\tifbac_buf\tifbac_ifbacu.ifbacu_buf\n#define\tifbac_req\tifbac_ifbacu.ifbacu_req\n};\n\n/*\n * Bridge parameter structure.\n */\nstruct ifbrparam {\n\tunion {\n\t\tuint32_t ifbrpu_int32;\n\t\tuint16_t ifbrpu_int16;\n\t\tuint8_t ifbrpu_int8;\n\t} ifbrp_ifbrpu;\n};\n#define\tifbrp_csize\tifbrp_ifbrpu.ifbrpu_int32\t/* cache size */\n#define\tifbrp_ctime\tifbrp_ifbrpu.ifbrpu_int32\t/* cache time (sec) */\n#define\tifbrp_prio\tifbrp_ifbrpu.ifbrpu_int16\t/* bridge priority */\n#define\tifbrp_proto\tifbrp_ifbrpu.ifbrpu_int8\t/* bridge protocol */\n#define\tifbrp_txhc\tifbrp_ifbrpu.ifbrpu_int8\t/* bpdu tx holdcount */\n#define\tifbrp_hellotime\tifbrp_ifbrpu.ifbrpu_int8\t/* hello time (sec) */\n#define\tifbrp_fwddelay\tifbrp_ifbrpu.ifbrpu_int8\t/* fwd time (sec) */\n#define\tifbrp_maxage\tifbrp_ifbrpu.ifbrpu_int8\t/* max age (sec) */\n#define\tifbrp_cexceeded ifbrp_ifbrpu.ifbrpu_int32\t/* # of cache dropped\n\t\t\t\t\t\t\t * adresses */\n/*\n * Bridge current operational parameters structure.\n */\nstruct ifbropreq {\n\tuint8_t\t\tifbop_holdcount;\n\tuint8_t\t\tifbop_maxage;\n\tuint8_t\t\tifbop_hellotime;\n\tuint8_t\t\tifbop_fwddelay;\n\tuint8_t\t\tifbop_protocol;\n\tuint16_t\tifbop_priority;\n\tuint16_t\tifbop_root_port;\n\tuint32_t\tifbop_root_path_cost;\n\tuint64_t\tifbop_bridgeid;\n\tuint64_t\tifbop_designated_root;\n\tuint64_t\tifbop_designated_bridge;\n\tstruct timeval\tifbop_last_tc_time;\n};\n\n/*\n * Bridge member operational STP params structure.\n */\nstruct ifbpstpreq {\n\tuint8_t\t\tifbp_portno;\t\t/* bp STP port number */\n\tuint32_t\tifbp_fwd_trans;\t\t/* bp STP fwd transitions */\n\tuint32_t\tifbp_design_cost;\t/* bp STP designated cost */\n\tuint32_t\tifbp_design_port;\t/* bp STP designated port */\n\tuint64_t\tifbp_design_bridge;\t/* bp STP designated bridge */\n\tuint64_t\tifbp_design_root;\t/* bp STP designated root */\n};\n\n/*\n * Bridge STP ports list structure.\n */\nstruct ifbpstpconf {\n\tuint32_t\tifbpstp_len;\t/* buffer size */\n\tunion {\n\t\tcaddr_t\tifbpstpu_buf;\n\t\tstruct ifbpstpreq *ifbpstpu_req;\n\t} ifbpstp_ifbpstpu;\n#define\tifbpstp_buf\tifbpstp_ifbpstpu.ifbpstpu_buf\n#define\tifbpstp_req\tifbpstp_ifbpstpu.ifbpstpu_req\n};\n\n#ifdef _KERNEL\n\n#define BRIDGE_LOCK_INIT(_sc)\t\tdo {\t\t\t\\\n\tmtx_init(&(_sc)->sc_mtx, \"if_bridge\", NULL, MTX_DEF);\t\\\n\tcv_init(&(_sc)->sc_cv, \"if_bridge_cv\");\t\t\t\\\n} while (0)\n#define BRIDGE_LOCK_DESTROY(_sc)\tdo {\t\\\n\tmtx_destroy(&(_sc)->sc_mtx);\t\t\\\n\tcv_destroy(&(_sc)->sc_cv);\t\t\\\n} while (0)\n#define BRIDGE_LOCK(_sc)\t\tmtx_lock(&(_sc)->sc_mtx)\n#define BRIDGE_UNLOCK(_sc)\t\tmtx_unlock(&(_sc)->sc_mtx)\n#define BRIDGE_LOCK_ASSERT(_sc)\t\tmtx_assert(&(_sc)->sc_mtx, MA_OWNED)\n#define\tBRIDGE_LOCK2REF(_sc, _err)\tdo {\t\\\n\tmtx_assert(&(_sc)->sc_mtx, MA_OWNED);\t\\\n\tif ((_sc)->sc_iflist_xcnt > 0)\t\t\\\n\t\t(_err) = EBUSY;\t\t\t\\\n\telse\t\t\t\t\t\\\n\t\t(_sc)->sc_iflist_ref++;\t\t\\\n\tmtx_unlock(&(_sc)->sc_mtx);\t\t\\\n} while (0)\n#define\tBRIDGE_UNREF(_sc)\t\tdo {\t\t\t\t\\\n\tmtx_lock(&(_sc)->sc_mtx);\t\t\t\t\t\\\n\t(_sc)->sc_iflist_ref--;\t\t\t\t\t\t\\\n\tif (((_sc)->sc_iflist_xcnt > 0) && ((_sc)->sc_iflist_ref == 0))\t\\\n\t\tcv_broadcast(&(_sc)->sc_cv);\t\t\t\t\\\n\tmtx_unlock(&(_sc)->sc_mtx);\t\t\t\t\t\\\n} while (0)\n#define\tBRIDGE_XLOCK(_sc)\t\tdo {\t\t\\\n\tmtx_assert(&(_sc)->sc_mtx, MA_OWNED);\t\t\\\n\t(_sc)->sc_iflist_xcnt++;\t\t\t\\\n\twhile ((_sc)->sc_iflist_ref > 0)\t\t\\\n\t\tcv_wait(&(_sc)->sc_cv, &(_sc)->sc_mtx);\t\\\n} while (0)\n#define\tBRIDGE_XDROP(_sc)\t\tdo {\t\\\n\tmtx_assert(&(_sc)->sc_mtx, MA_OWNED);\t\\\n\t(_sc)->sc_iflist_xcnt--;\t\t\\\n} while (0)\n\n#define BRIDGE_INPUT(_ifp, _m)\t\tdo {    \t\\\n\tKASSERT(bridge_input_p != NULL,\t\t\t\\\n\t    (\"%s: if_bridge not loaded!\", __func__));\t\\\n\t_m = (*bridge_input_p)(_ifp, _m);\t\t\\\n\tif (_m != NULL)\t\t\t\t\t\\\n\t\t_ifp = _m->m_pkthdr.rcvif;\t\t\\\n} while (0)\n\n#define BRIDGE_OUTPUT(_ifp, _m, _err)\tdo {    \t\t\\\n\tKASSERT(bridge_output_p != NULL,\t\t\t\\\n\t    (\"%s: if_bridge not loaded!\", __func__));\t\t\\\n\t_err = (*bridge_output_p)(_ifp, _m, NULL, NULL);\t\\\n} while (0)\n\nextern\tstruct mbuf *(*bridge_input_p)(struct ifnet *, struct mbuf *);\nextern\tint (*bridge_output_p)(struct ifnet *, struct mbuf *,\n\t\tstruct sockaddr *, struct rtentry *);\nextern\tvoid (*bridge_dn_p)(struct mbuf *, struct ifnet *);\n\n#endif /* _KERNEL */\n"
  },
  {
    "path": "freebsd-headers/net/if_clone.h",
    "content": "/*-\n * Copyright (c) 1982, 1986, 1989, 1993\n *\tThe Regents of the University of California.  All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 4. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\tFrom: @(#)if.h\t8.1 (Berkeley) 6/10/93\n * $FreeBSD: release/9.0.0/sys/net/if_clone.h 195837 2009-07-23 20:46:49Z rwatson $\n */\n\n#ifndef\t_NET_IF_CLONE_H_\n#define\t_NET_IF_CLONE_H_\n\n#ifdef _KERNEL\n\n#define IFC_CLONE_INITIALIZER(name, data, maxunit,\t\t\t\\\n    attach, match, create, destroy)\t\t\t\t\t\\\n    { { 0 }, name, maxunit, NULL, 0, data, attach, match, create, destroy }\n\n/*\n * Structure describing a `cloning' interface.\n *\n * List of locks\n * (c)\t\tconst until freeing\n * (d)\t\tdriver specific data, may need external protection.\n * (e)\t\tlocked by if_cloners_mtx\n * (i)\t\tlocked by ifc_mtx mtx\n */\nstruct if_clone {\n\tLIST_ENTRY(if_clone) ifc_list;\t/* (e) On list of cloners */\n\tconst char *ifc_name;\t\t/* (c) Name of device, e.g. `gif' */\n\tint ifc_maxunit;\t\t/* (c) Maximum unit number */\n\tunsigned char *ifc_units;\t/* (i) Bitmap to handle units. */\n\t\t\t\t\t/*     Considered private, access */\n\t\t\t\t\t/*     via ifc_(alloc|free)_unit(). */\n\tint ifc_bmlen;\t\t\t/* (c) Bitmap length. */\n\tvoid *ifc_data;\t\t\t/* (*) Data for ifc_* functions. */\n\n\t/* (c) Driver specific cloning functions.  Called with no locks held. */\n\tvoid\t(*ifc_attach)(struct if_clone *);\n\tint\t(*ifc_match)(struct if_clone *, const char *);\n\tint\t(*ifc_create)(struct if_clone *, char *, size_t, caddr_t);\n\tint\t(*ifc_destroy)(struct if_clone *, struct ifnet *);\n\n\tlong ifc_refcnt;\t\t/* (i) Refrence count. */\n\tstruct mtx ifc_mtx;\t\t/* Muted to protect members. */\n\tLIST_HEAD(, ifnet) ifc_iflist;\t/* (i) List of cloned interfaces */\n};\n\nvoid\tif_clone_init(void);\nvoid\tif_clone_attach(struct if_clone *);\nvoid\tif_clone_detach(struct if_clone *);\nvoid\tvnet_if_clone_init(void);\n\nint\tif_clone_create(char *, size_t, caddr_t);\nint\tif_clone_destroy(const char *);\nint\tif_clone_destroyif(struct if_clone *, struct ifnet *);\nint\tif_clone_list(struct if_clonereq *);\n\nint\tifc_name2unit(const char *name, int *unit);\nint\tifc_alloc_unit(struct if_clone *, int *);\nvoid\tifc_free_unit(struct if_clone *, int);\n\n/*\n * The ifc_simple functions, structures, and macros implement basic\n * cloning as in 5.[012].\n */\n\nstruct ifc_simple_data {\n\tint ifcs_minifs;\t\t/* minimum number of interfaces */\n\n\tint\t(*ifcs_create)(struct if_clone *, int, caddr_t);\n\tvoid\t(*ifcs_destroy)(struct ifnet *);\n};\n\n/* interface clone event */\ntypedef void (*if_clone_event_handler_t)(void *, struct if_clone *);\nEVENTHANDLER_DECLARE(if_clone_event, if_clone_event_handler_t);\n\n#define IFC_SIMPLE_DECLARE(name, minifs)\t\t\t\t\\\nstruct ifc_simple_data name##_cloner_data =\t\t\t\t\\\n    {minifs, name##_clone_create, name##_clone_destroy};\t\t\\\nstruct if_clone name##_cloner =\t\t\t\t\t\t\\\n    IFC_CLONE_INITIALIZER(#name, &name##_cloner_data, IF_MAXUNIT,\t\\\n    ifc_simple_attach, ifc_simple_match, ifc_simple_create, ifc_simple_destroy)\n\nvoid\tifc_simple_attach(struct if_clone *);\nint\tifc_simple_match(struct if_clone *, const char *);\nint\tifc_simple_create(struct if_clone *, char *, size_t, caddr_t);\nint\tifc_simple_destroy(struct if_clone *, struct ifnet *);\n\n#endif /* _KERNEL */\n\n#endif /* !_NET_IF_CLONE_H_ */\n"
  },
  {
    "path": "freebsd-headers/net/if_dl.h",
    "content": "/*-\n * Copyright (c) 1990, 1993\n *\tThe Regents of the University of California.  All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 4. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t@(#)if_dl.h\t8.1 (Berkeley) 6/10/93\n * $FreeBSD: release/9.0.0/sys/net/if_dl.h 139823 2005-01-07 01:45:51Z imp $\n */\n\n#ifndef _NET_IF_DL_H_\n#define _NET_IF_DL_H_\n\n/*\n * A Link-Level Sockaddr may specify the interface in one of two\n * ways: either by means of a system-provided index number (computed\n * anew and possibly differently on every reboot), or by a human-readable\n * string such as \"il0\" (for managerial convenience).\n *\n * Census taking actions, such as something akin to SIOCGCONF would return\n * both the index and the human name.\n *\n * High volume transactions (such as giving a link-level ``from'' address\n * in a recvfrom or recvmsg call) may be likely only to provide the indexed\n * form, (which requires fewer copy operations and less space).\n *\n * The form and interpretation  of the link-level address is purely a matter\n * of convention between the device driver and its consumers; however, it is\n * expected that all drivers for an interface of a given if_type will agree.\n */\n\n/*\n * Structure of a Link-Level sockaddr:\n */\nstruct sockaddr_dl {\n\tu_char\tsdl_len;\t/* Total length of sockaddr */\n\tu_char\tsdl_family;\t/* AF_LINK */\n\tu_short\tsdl_index;\t/* if != 0, system given index for interface */\n\tu_char\tsdl_type;\t/* interface type */\n\tu_char\tsdl_nlen;\t/* interface name length, no trailing 0 reqd. */\n\tu_char\tsdl_alen;\t/* link level address length */\n\tu_char\tsdl_slen;\t/* link layer selector length */\n\tchar\tsdl_data[46];\t/* minimum work area, can be larger;\n\t\t\t\t   contains both if name and ll address */\n};\n\n#define LLADDR(s) ((caddr_t)((s)->sdl_data + (s)->sdl_nlen))\n\n#ifndef _KERNEL\n\n#include <sys/cdefs.h>\n\n__BEGIN_DECLS\nvoid\tlink_addr(const char *, struct sockaddr_dl *);\nchar\t*link_ntoa(const struct sockaddr_dl *);\n__END_DECLS\n\n#endif /* !_KERNEL */\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/net/if_enc.h",
    "content": "/*-\n * Copyright (c) 2008 The FreeBSD Project.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n *\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/net/if_enc.h 181627 2008-08-12 09:05:01Z vanhu $\n */\n\n#ifndef _NET_IF_ENC_H\n#define _NET_IF_ENC_H\n\nextern struct ifnet\t*encif;\n\n#endif /* _NET_IF_ENC_H */\n"
  },
  {
    "path": "freebsd-headers/net/if_gif.h",
    "content": "/*\t$FreeBSD: release/9.0.0/sys/net/if_gif.h 207369 2010-04-29 11:52:42Z bz $\t*/\n/*\t$KAME: if_gif.h,v 1.17 2000/09/11 11:36:41 sumikawa Exp $\t*/\n\n/*-\n * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. Neither the name of the project nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n */\n\n/*\n * if_gif.h\n */\n\n#ifndef _NET_IF_GIF_H_\n#define _NET_IF_GIF_H_\n\n\n#ifdef _KERNEL\n#include \"opt_inet.h\"\n#include \"opt_inet6.h\"\n\n#include <netinet/in.h>\n/* xxx sigh, why route have struct route instead of pointer? */\n\nstruct encaptab;\n\nextern\tvoid (*ng_gif_input_p)(struct ifnet *ifp, struct mbuf **mp,\n\t\tint af);\nextern\tvoid (*ng_gif_input_orphan_p)(struct ifnet *ifp, struct mbuf *m,\n\t\tint af);\nextern\tint  (*ng_gif_output_p)(struct ifnet *ifp, struct mbuf **mp);\nextern\tvoid (*ng_gif_attach_p)(struct ifnet *ifp);\nextern\tvoid (*ng_gif_detach_p)(struct ifnet *ifp);\n\nstruct gif_softc {\n\tstruct ifnet\t*gif_ifp;\n\tstruct mtx\tgif_mtx;\n\tstruct sockaddr\t*gif_psrc; /* Physical src addr */\n\tstruct sockaddr\t*gif_pdst; /* Physical dst addr */\n\tunion {\n\t\tstruct route  gifscr_ro;    /* xxx */\n#ifdef INET6\n\t\tstruct route_in6 gifscr_ro6; /* xxx */\n#endif\n\t} gifsc_gifscr;\n\tint\t\tgif_flags;\n\tu_int\t\tgif_fibnum;\n\tconst struct encaptab *encap_cookie4;\n\tconst struct encaptab *encap_cookie6;\n\tvoid\t\t*gif_netgraph;\t/* ng_gif(4) netgraph node info */\n\tu_int\t\tgif_options;\n\tLIST_ENTRY(gif_softc) gif_list; /* all gif's are linked */\n};\n#define\tGIF2IFP(sc)\t((sc)->gif_ifp)\n#define\tGIF_LOCK_INIT(sc)\tmtx_init(&(sc)->gif_mtx, \"gif softc\",\t\\\n\t\t\t\t     NULL, MTX_DEF)\n#define\tGIF_LOCK_DESTROY(sc)\tmtx_destroy(&(sc)->gif_mtx)\n#define\tGIF_LOCK(sc)\t\tmtx_lock(&(sc)->gif_mtx)\n#define\tGIF_UNLOCK(sc)\t\tmtx_unlock(&(sc)->gif_mtx)\n#define\tGIF_LOCK_ASSERT(sc)\tmtx_assert(&(sc)->gif_mtx, MA_OWNED)\n\n#define gif_ro gifsc_gifscr.gifscr_ro\n#ifdef INET6\n#define gif_ro6 gifsc_gifscr.gifscr_ro6\n#endif\n\n#define GIF_MTU\t\t(1280)\t/* Default MTU */\n#define\tGIF_MTU_MIN\t(1280)\t/* Minimum MTU */\n#define\tGIF_MTU_MAX\t(8192)\t/* Maximum MTU */\n\n#define\tMTAG_GIF\t1080679712\n#define\tMTAG_GIF_CALLED\t0\n\nstruct etherip_header {\n#if BYTE_ORDER == LITTLE_ENDIAN\n\tu_int\teip_resvl:4,\t/* reserved */\n\t\teip_ver:4;\t/* version */\n#endif\n#if BYTE_ORDER == BIG_ENDIAN\n\tu_int\teip_ver:4,\t/* version */\n\t\teip_resvl:4;\t/* reserved */\n#endif\n\tu_int8_t eip_resvh;\t/* reserved */\n} __packed;\n\n#define ETHERIP_VERSION\t\t\t0x3\n/* mbuf adjust factor to force 32-bit alignment of IP header */\n#define\tETHERIP_ALIGN\t\t2\n\n/* Prototypes */\nvoid gif_input(struct mbuf *, int, struct ifnet *);\nint gif_output(struct ifnet *, struct mbuf *, struct sockaddr *,\n\t       struct route *);\nint gif_ioctl(struct ifnet *, u_long, caddr_t);\nint gif_set_tunnel(struct ifnet *, struct sockaddr *, struct sockaddr *);\nvoid gif_delete_tunnel(struct ifnet *);\nint gif_encapcheck(const struct mbuf *, int, int, void *);\n#endif /* _KERNEL */\n\n#define GIFGOPTS\t_IOWR('i', 150, struct ifreq)\n#define GIFSOPTS\t_IOW('i', 151, struct ifreq)\n\n#define\tGIF_ACCEPT_REVETHIP\t0x0001\n#define\tGIF_SEND_REVETHIP\t0x0010\n#define\tGIF_OPTMASK\t\t(GIF_ACCEPT_REVETHIP|GIF_SEND_REVETHIP)\n\n#endif /* _NET_IF_GIF_H_ */\n"
  },
  {
    "path": "freebsd-headers/net/if_gre.h",
    "content": "/*\t$NetBSD: if_gre.h,v 1.13 2003/11/10 08:51:52 wiz Exp $ */\n/*\t $FreeBSD: release/9.0.0/sys/net/if_gre.h 223223 2011-06-18 09:34:03Z bz $ */\n\n/*-\n * Copyright (c) 1998 The NetBSD Foundation, Inc.\n * All rights reserved\n *\n * This code is derived from software contributed to The NetBSD Foundation\n * by Heiko W.Rupp <hwr@pilhuhn.de>\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS\n * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED\n * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\n * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS\n * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\n * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\n * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\n * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\n * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\n#ifndef _NET_IF_GRE_H\n#define _NET_IF_GRE_H\n\n#include <sys/ioccom.h>\n#ifdef _KERNEL\n#include <sys/queue.h>\n\n/*\n * Version of the WCCP, need to be configured manually since\n * header for version 2 is the same but IP payload is prepended\n * with additional 4-bytes field.\n */\ntypedef enum {\n\tWCCP_V1 = 0,\n\tWCCP_V2\n} wccp_ver_t;\n\nstruct gre_softc {\n\tstruct ifnet *sc_ifp;\n\tLIST_ENTRY(gre_softc) sc_list;\n\tint gre_unit;\n\tint gre_flags;\n\tu_int\tgre_fibnum;\t/* use this fib for envelopes */\n\tstruct in_addr g_src;\t/* source address of gre packets */\n\tstruct in_addr g_dst;\t/* destination address of gre packets */\n\tstruct route route;\t/* routing entry that determines, where a\n\t\t\t\t   encapsulated packet should go */\n\tu_char g_proto;\t\t/* protocol of encapsulator */\n\n\tconst struct encaptab *encap;\t/* encapsulation cookie */\n\n\tuint32_t key;\t\t/* key included in outgoing GRE packets */\n\t\t\t\t/* zero means none */\n\n\twccp_ver_t wccp_ver;\t/* version of the WCCP */\n};\n#define\tGRE2IFP(sc)\t((sc)->sc_ifp)\n\n\nstruct gre_h {\n\tu_int16_t flags;\t/* GRE flags */\n\tu_int16_t ptype;\t/* protocol type of payload typically\n\t\t\t\t   Ether protocol type*/\n\tuint32_t options[0];\t/* optional options */\n/*\n *  from here on: fields are optional, presence indicated by flags\n *\n\tu_int_16 checksum\tchecksum (one-complements of GRE header\n\t\t\t\tand payload\n\t\t\t\tPresent if (ck_pres | rt_pres == 1).\n\t\t\t\tValid if (ck_pres == 1).\n\tu_int_16 offset\t\toffset from start of routing filed to\n\t\t\t\tfirst octet of active SRE (see below).\n\t\t\t\tPresent if (ck_pres | rt_pres == 1).\n\t\t\t\tValid if (rt_pres == 1).\n\tu_int_32 key\t\tinserted by encapsulator e.g. for\n\t\t\t\tauthentication\n\t\t\t\tPresent if (key_pres ==1 ).\n\tu_int_32 seq_num\tSequence number to allow for packet order\n\t\t\t\tPresent if (seq_pres ==1 ).\n\tstruct gre_sre[] routing Routing fileds (see below)\n\t\t\t\tPresent if (rt_pres == 1)\n */\n} __packed;\n\nstruct greip {\n\tstruct ip gi_i;\n\tstruct gre_h  gi_g;\n} __packed;\n\n#define gi_pr\t\tgi_i.ip_p\n#define gi_len\t\tgi_i.ip_len\n#define gi_src\t\tgi_i.ip_src\n#define gi_dst\t\tgi_i.ip_dst\n#define gi_ptype\tgi_g.ptype\n#define gi_flags\tgi_g.flags\n#define gi_options\tgi_g.options\n\n#define GRE_CP\t\t0x8000  /* Checksum Present */\n#define GRE_RP\t\t0x4000  /* Routing Present */\n#define GRE_KP\t\t0x2000  /* Key Present */\n#define GRE_SP\t\t0x1000  /* Sequence Present */\n#define GRE_SS\t\t0x0800\t/* Strict Source Route */\n\n/*\n * CISCO uses special type for GRE tunnel created as part of WCCP\n * connection, while in fact those packets are just IPv4 encapsulated\n * into GRE.\n */\n#define WCCP_PROTOCOL_TYPE\t0x883E\n\n/*\n * gre_sre defines a Source route Entry. These are needed if packets\n * should be routed over more than one tunnel hop by hop\n */\nstruct gre_sre {\n\tu_int16_t sre_family;\t/* address family */\n\tu_char\tsre_offset;\t/* offset to first octet of active entry */\n\tu_char\tsre_length;\t/* number of octets in the SRE.\n\t\t\t\t   sre_lengthl==0 -> last entry. */\n\tu_char\t*sre_rtinfo;\t/* the routing information */\n};\n\nstruct greioctl {\n\tint unit;\n\tstruct in_addr addr;\n};\n\n/* for mobile encaps */\n\nstruct mobile_h {\n\tu_int16_t proto;\t\t/* protocol and S-bit */\n\tu_int16_t hcrc;\t\t\t/* header checksum */\n\tu_int32_t odst;\t\t\t/* original destination address */\n\tu_int32_t osrc;\t\t\t/* original source addr, if S-bit set */\n} __packed;\n\nstruct mobip_h {\n\tstruct ip\tmi;\n\tstruct mobile_h\tmh;\n} __packed;\n\n\n#define MOB_H_SIZ_S\t\t(sizeof(struct mobile_h) - sizeof(u_int32_t))\n#define MOB_H_SIZ_L\t\t(sizeof(struct mobile_h))\n#define MOB_H_SBIT\t0x0080\n\n#define\tGRE_TTL\t30\n\n#endif /* _KERNEL */\n\n/*\n * ioctls needed to manipulate the interface\n */\n\n#define GRESADDRS\t_IOW('i', 101, struct ifreq)\n#define GRESADDRD\t_IOW('i', 102, struct ifreq)\n#define GREGADDRS\t_IOWR('i', 103, struct ifreq)\n#define GREGADDRD\t_IOWR('i', 104, struct ifreq)\n#define GRESPROTO\t_IOW('i' , 105, struct ifreq)\n#define GREGPROTO\t_IOWR('i', 106, struct ifreq)\n#define GREGKEY\t\t_IOWR('i', 107, struct ifreq)\n#define GRESKEY\t\t_IOW('i', 108, struct ifreq)\n\n#ifdef _KERNEL\nLIST_HEAD(gre_softc_head, gre_softc);\nextern struct mtx gre_mtx;\nextern struct gre_softc_head gre_softc_list;\n\nu_int16_t\tgre_in_cksum(u_int16_t *, u_int);\n#endif /* _KERNEL */\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/net/if_lagg.h",
    "content": "/*\t$OpenBSD: if_trunk.h,v 1.11 2007/01/31 06:20:19 reyk Exp $\t*/\n\n/*\n * Copyright (c) 2005, 2006 Reyk Floeter <reyk@openbsd.org>\n *\n * Permission to use, copy, modify, and distribute this software for any\n * purpose with or without fee is hereby granted, provided that the above\n * copyright notice and this permission notice appear in all copies.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES\n * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF\n * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR\n * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES\n * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN\n * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF\n * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.\n *\n * $FreeBSD: release/9.0.0/sys/net/if_lagg.h 203548 2010-02-06 13:49:35Z eri $\n */\n\n#ifndef _NET_LAGG_H\n#define _NET_LAGG_H\n\n/*\n * Global definitions\n */\n\n#define\tLAGG_MAX_PORTS\t\t32\t/* logically */\n#define\tLAGG_MAX_NAMESIZE\t32\t/* name of a protocol */\n#define\tLAGG_MAX_STACKING\t4\t/* maximum number of stacked laggs */\n\n/* Port flags */\n#define\tLAGG_PORT_SLAVE\t\t0x00000000\t/* normal enslaved port */\n#define\tLAGG_PORT_MASTER\t0x00000001\t/* primary port */\n#define\tLAGG_PORT_STACK\t\t0x00000002\t/* stacked lagg port */\n#define\tLAGG_PORT_ACTIVE\t0x00000004\t/* port is active */\n#define\tLAGG_PORT_COLLECTING\t0x00000008\t/* port is receiving frames */\n#define\tLAGG_PORT_DISTRIBUTING\t0x00000010\t/* port is sending frames */\n#define\tLAGG_PORT_DISABLED\t0x00000020\t/* port is disabled */\n#define\tLAGG_PORT_BITS\t\t\"\\20\\01MASTER\\02STACK\\03ACTIVE\\04COLLECTING\" \\\n\t\t\t\t  \"\\05DISTRIBUTING\\06DISABLED\"\n\n/* Supported lagg PROTOs */\n#define\tLAGG_PROTO_NONE\t\t0\t/* no lagg protocol defined */\n#define\tLAGG_PROTO_ROUNDROBIN\t1\t/* simple round robin */\n#define\tLAGG_PROTO_FAILOVER\t2\t/* active failover */\n#define\tLAGG_PROTO_LOADBALANCE\t3\t/* loadbalance */\n#define\tLAGG_PROTO_LACP\t\t4\t/* 802.3ad lacp */\n#define\tLAGG_PROTO_ETHERCHANNEL\t5\t/* Cisco FEC */\n#define\tLAGG_PROTO_MAX\t\t6\n\nstruct lagg_protos {\n\tconst char\t\t*lpr_name;\n\tint\t\t\tlpr_proto;\n};\n\n#define\tLAGG_PROTO_DEFAULT\tLAGG_PROTO_FAILOVER\n#define LAGG_PROTOS\t{\t\t\t\t\t\t\\\n\t{ \"failover\",\t\tLAGG_PROTO_FAILOVER },\t\t\t\\\n\t{ \"fec\",\t\tLAGG_PROTO_ETHERCHANNEL },\t\t\\\n\t{ \"lacp\",\t\tLAGG_PROTO_LACP },\t\t\t\\\n\t{ \"loadbalance\",\tLAGG_PROTO_LOADBALANCE },\t\t\\\n\t{ \"roundrobin\",\t\tLAGG_PROTO_ROUNDROBIN },\t\t\\\n\t{ \"none\",\t\tLAGG_PROTO_NONE },\t\t\t\\\n\t{ \"default\",\t\tLAGG_PROTO_DEFAULT }\t\t\t\\\n}\n\n/*\n * lagg ioctls.\n */\n\n/*\n * LACP current operational parameters structure.\n */\nstruct lacp_opreq {\n\tuint16_t\t\tactor_prio;\n\tuint8_t\t\t\tactor_mac[ETHER_ADDR_LEN];\n\tuint16_t\t\tactor_key;\n\tuint16_t\t\tactor_portprio;\n\tuint16_t\t\tactor_portno;\n\tuint8_t\t\t\tactor_state;\n\tuint16_t\t\tpartner_prio;\n\tuint8_t\t\t\tpartner_mac[ETHER_ADDR_LEN];\n\tuint16_t\t\tpartner_key;\n\tuint16_t\t\tpartner_portprio;\n\tuint16_t\t\tpartner_portno;\n\tuint8_t\t\t\tpartner_state;\n};\n\n/* lagg port settings */\nstruct lagg_reqport {\n\tchar\t\t\trp_ifname[IFNAMSIZ];\t/* name of the lagg */\n\tchar\t\t\trp_portname[IFNAMSIZ];\t/* name of the port */\n\tu_int32_t\t\trp_prio;\t\t/* port priority */\n\tu_int32_t\t\trp_flags;\t\t/* port flags */\n\tunion {\n\t\tstruct lacp_opreq rpsc_lacp;\n\t} rp_psc;\n#define rp_lacpreq\trp_psc.rpsc_lacp\n};\n\n#define\tSIOCGLAGGPORT\t\t_IOWR('i', 140, struct lagg_reqport)\n#define\tSIOCSLAGGPORT\t\t _IOW('i', 141, struct lagg_reqport)\n#define\tSIOCSLAGGDELPORT\t _IOW('i', 142, struct lagg_reqport)\n\n/* lagg, ports and options */\nstruct lagg_reqall {\n\tchar\t\t\tra_ifname[IFNAMSIZ];\t/* name of the lagg */\n\tu_int\t\t\tra_proto;\t\t/* lagg protocol */\n\n\tsize_t\t\t\tra_size;\t\t/* size of buffer */\n\tstruct lagg_reqport\t*ra_port;\t\t/* allocated buffer */\n\tint\t\t\tra_ports;\t\t/* total port count */\n\tunion {\n\t\tstruct lacp_opreq rpsc_lacp;\n\t} ra_psc;\n#define ra_lacpreq\tra_psc.rpsc_lacp\n};\n\n#define\tSIOCGLAGG\t\t_IOWR('i', 143, struct lagg_reqall)\n#define\tSIOCSLAGG\t\t _IOW('i', 144, struct lagg_reqall)\n\n#ifdef _KERNEL\n/*\n * Internal kernel part\n */\n\n#define\tlp_ifname\t\tlp_ifp->if_xname\t/* interface name */\n#define\tlp_link_state\t\tlp_ifp->if_link_state\t/* link state */\n\n#define\tLAGG_PORTACTIVE(_tp)\t(\t\t\t\t\t\\\n\t((_tp)->lp_link_state == LINK_STATE_UP) &&\t\t\t\\\n\t((_tp)->lp_ifp->if_flags & IFF_UP)\t\t\t\t\\\n)\n\nstruct lagg_ifreq {\n\tunion {\n\t\tstruct ifreq ifreq;\n\t\tstruct {\n\t\t\tchar ifr_name[IFNAMSIZ];\n\t\t\tstruct sockaddr_storage ifr_ss;\n\t\t} ifreq_storage;\n\t} ifreq;\n};\n\n#define\tsc_ifflags\t\tsc_ifp->if_flags\t\t/* flags */\n#define\tsc_ifname\t\tsc_ifp->if_xname\t\t/* name */\n#define\tsc_capabilities\t\tsc_ifp->if_capabilities\t/* capabilities */\n\n#define\tIFCAP_LAGG_MASK\t\t0xffff0000\t/* private capabilities */\n#define\tIFCAP_LAGG_FULLDUPLEX\t0x00010000\t/* full duplex with >1 ports */\n\n/* Private data used by the loadbalancing protocol */\nstruct lagg_lb {\n\tu_int32_t\t\tlb_key;\n\tstruct lagg_port\t*lb_ports[LAGG_MAX_PORTS];\n};\n\nstruct lagg_mc {\n\tstruct ifmultiaddr      *mc_ifma;\n\tSLIST_ENTRY(lagg_mc)\tmc_entries;\n};\n\n/* List of interfaces to have the MAC address modified */\nstruct lagg_llq {\n\tstruct ifnet\t\t*llq_ifp;\n\tuint8_t\t\t\tllq_lladdr[ETHER_ADDR_LEN];\n\tSLIST_ENTRY(lagg_llq)\tllq_entries;\n};\n\nstruct lagg_softc {\n\tstruct ifnet\t\t\t*sc_ifp;\t/* virtual interface */\n\tstruct rwlock\t\t\tsc_mtx;\n\tint\t\t\t\tsc_proto;\t/* lagg protocol */\n\tu_int\t\t\t\tsc_count;\t/* number of ports */\n\tstruct lagg_port\t\t*sc_primary;\t/* primary port */\n\tstruct ifmedia\t\t\tsc_media;\t/* media config */\n\tcaddr_t\t\t\t\tsc_psc;\t\t/* protocol data */\n\tuint32_t\t\t\tsc_seq;\t\t/* sequence counter */\n\n\tSLIST_HEAD(__tplhd, lagg_port)\tsc_ports;\t/* list of interfaces */\n\tSLIST_ENTRY(lagg_softc)\tsc_entries;\n\n\tstruct task\t\t\tsc_lladdr_task;\n\tSLIST_HEAD(__llqhd, lagg_llq)\tsc_llq_head;\t/* interfaces to program\n\t\t\t\t\t\t\t   the lladdr on */\n\n\t/* lagg protocol callbacks */\n\tint\t(*sc_detach)(struct lagg_softc *);\n\tint\t(*sc_start)(struct lagg_softc *, struct mbuf *);\n\tstruct mbuf *(*sc_input)(struct lagg_softc *, struct lagg_port *,\n\t\t    struct mbuf *);\n\tint\t(*sc_port_create)(struct lagg_port *);\n\tvoid\t(*sc_port_destroy)(struct lagg_port *);\n\tvoid\t(*sc_linkstate)(struct lagg_port *);\n\tvoid\t(*sc_init)(struct lagg_softc *);\n\tvoid\t(*sc_stop)(struct lagg_softc *);\n\tvoid\t(*sc_lladdr)(struct lagg_softc *);\n\tvoid\t(*sc_req)(struct lagg_softc *, caddr_t);\n\tvoid\t(*sc_portreq)(struct lagg_port *, caddr_t);\n#if __FreeBSD_version >= 800000\n\teventhandler_tag vlan_attach;\n\teventhandler_tag vlan_detach;\n#endif\n};\n\nstruct lagg_port {\n\tstruct ifnet\t\t\t*lp_ifp;\t/* physical interface */\n\tstruct lagg_softc\t\t*lp_softc;\t/* parent lagg */\n\tuint8_t\t\t\t\tlp_lladdr[ETHER_ADDR_LEN];\n\n\tu_char\t\t\t\tlp_iftype;\t/* interface type */\n\tuint32_t\t\t\tlp_prio;\t/* port priority */\n\tuint32_t\t\t\tlp_flags;\t/* port flags */\n\tint\t\t\t\tlp_ifflags;\t/* saved ifp flags */\n\tvoid\t\t\t\t*lh_cookie;\t/* if state hook */\n\tcaddr_t\t\t\t\tlp_psc;\t\t/* protocol data */\n\tint\t\t\t\tlp_detaching;\t/* ifnet is detaching */\n\n\tSLIST_HEAD(__mclhd, lagg_mc)\tlp_mc_head;\t/* multicast addresses */\n\n\t/* Redirected callbacks */\n\tint\t(*lp_ioctl)(struct ifnet *, u_long, caddr_t);\n\tint\t(*lp_output)(struct ifnet *, struct mbuf *, struct sockaddr *,\n\t\t     struct route *);\n\n\tSLIST_ENTRY(lagg_port)\t\tlp_entries;\n};\n\n#define\tLAGG_LOCK_INIT(_sc)\trw_init(&(_sc)->sc_mtx, \"if_lagg rwlock\")\n#define\tLAGG_LOCK_DESTROY(_sc)\trw_destroy(&(_sc)->sc_mtx)\n#define\tLAGG_RLOCK(_sc)\t\trw_rlock(&(_sc)->sc_mtx)\n#define\tLAGG_WLOCK(_sc)\t\trw_wlock(&(_sc)->sc_mtx)\n#define\tLAGG_RUNLOCK(_sc)\trw_runlock(&(_sc)->sc_mtx)\n#define\tLAGG_WUNLOCK(_sc)\trw_wunlock(&(_sc)->sc_mtx)\n#define\tLAGG_RLOCK_ASSERT(_sc)\trw_assert(&(_sc)->sc_mtx, RA_RLOCKED)\n#define\tLAGG_WLOCK_ASSERT(_sc)\trw_assert(&(_sc)->sc_mtx, RA_WLOCKED)\n\nextern struct mbuf *(*lagg_input_p)(struct ifnet *, struct mbuf *);\nextern void\t(*lagg_linkstate_p)(struct ifnet *, int );\n\nint\t\tlagg_enqueue(struct ifnet *, struct mbuf *);\nuint32_t\tlagg_hashmbuf(struct mbuf *, uint32_t);\n\n#endif /* _KERNEL */\n\n#endif /* _NET_LAGG_H */\n"
  },
  {
    "path": "freebsd-headers/net/if_llatbl.h",
    "content": "/*\n * Copyright (c) 2004 Luigi Rizzo, Alessandro Cerri. All rights reserved.\n * Copyright (c) 2004-2008 Qing Li. All rights reserved.\n * Copyright (c) 2008 Kip Macy. All rights reserved.\n * \n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * \n * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n */\n#include <sys/cdefs.h>\n__FBSDID(\"$FreeBSD: release/9.0.0/sys/net/if_llatbl.h 225698 2011-09-20 20:27:26Z kmacy $\");\n\n#ifndef\t_NET_IF_LLATBL_H_\n#define\t_NET_IF_LLATBL_H_\n\n#include \"opt_ofed.h\"\n\n#include <sys/_rwlock.h>\n#include <netinet/in.h>\n\nstruct ifnet;\nstruct sysctl_req;\nstruct rt_msghdr;\nstruct rt_addrinfo;\n\nstruct llentry;\nLIST_HEAD(llentries, llentry);\n\nextern struct rwlock lltable_rwlock;\n#define\tLLTABLE_RLOCK()\t\trw_rlock(&lltable_rwlock)\n#define\tLLTABLE_RUNLOCK()\trw_runlock(&lltable_rwlock)\n#define\tLLTABLE_WLOCK()\t\trw_wlock(&lltable_rwlock)\n#define\tLLTABLE_WUNLOCK()\trw_wunlock(&lltable_rwlock)\n#define\tLLTABLE_LOCK_ASSERT()\trw_assert(&lltable_rwlock, RA_LOCKED)\n\n/*\n * Code referencing llentry must at least hold\n * a shared lock\n */\nstruct llentry {\n\tLIST_ENTRY(llentry)\t lle_next;\n\tstruct rwlock\t\t lle_lock;\n\tstruct lltable\t\t *lle_tbl;\n\tstruct llentries\t *lle_head;\n\tvoid\t\t\t(*lle_free)(struct lltable *, struct llentry *);\n\tstruct mbuf\t\t *la_hold;\n\tint     \t\t la_numheld;  /* # of packets currently held */\n\ttime_t\t\t\t la_expire;\n\tuint16_t\t\t la_flags;    \n\tuint16_t\t\t la_asked;\n\tuint16_t\t\t la_preempt;\n\tuint16_t\t\t ln_byhint;\n\tint16_t\t\t\t ln_state;\t/* IPv6 has ND6_LLINFO_NOSTATE == -2 */\n\tuint16_t\t\t ln_router; \n\ttime_t\t\t\t ln_ntick;\n\tint\t\t\t lle_refcnt;\n\t\t\t\t \n\tunion {\n\t\tuint64_t\tmac_aligned;\n\t\tuint16_t\tmac16[3];\n#ifdef OFED\n\t\tuint8_t\t\tmac8[20];\t/* IB needs 20 bytes. */\n#endif\n\t} ll_addr;\n\n\t/* XXX af-private? */\n\tunion {\n\t\tstruct callout\tln_timer_ch;\n\t\tstruct callout  la_timer;\n\t} lle_timer;\n\t/* NB: struct sockaddr must immediately follow */\n};\n\n#define\tLLE_WLOCK(lle)\t\trw_wlock(&(lle)->lle_lock)\n#define\tLLE_RLOCK(lle)\t\trw_rlock(&(lle)->lle_lock)\n#define\tLLE_WUNLOCK(lle)\trw_wunlock(&(lle)->lle_lock)\n#define\tLLE_RUNLOCK(lle)\trw_runlock(&(lle)->lle_lock)\n#define\tLLE_DOWNGRADE(lle)\trw_downgrade(&(lle)->lle_lock)\n#define\tLLE_TRY_UPGRADE(lle)\trw_try_upgrade(&(lle)->lle_lock)\n#define\tLLE_LOCK_INIT(lle)\trw_init_flags(&(lle)->lle_lock, \"lle\", RW_DUPOK)\n#define\tLLE_LOCK_DESTROY(lle)\trw_destroy(&(lle)->lle_lock)\n#define\tLLE_WLOCK_ASSERT(lle)\trw_assert(&(lle)->lle_lock, RA_WLOCKED)\n\n#define LLE_IS_VALID(lle)\t(((lle) != NULL) && ((lle) != (void *)-1))\n\n#define\tLLE_ADDREF(lle) do {\t\t\t\t\t\\\n\tLLE_WLOCK_ASSERT(lle);\t\t\t\t\t\\\n\tKASSERT((lle)->lle_refcnt >= 0,\t\t\t\t\\\n\t\t(\"negative refcnt %d\", (lle)->lle_refcnt));\t\\\n\t(lle)->lle_refcnt++;\t\t\t\t\t\\\n} while (0)\n\n#define\tLLE_REMREF(lle)\tdo {\t\t\t\t\t\\\n\tLLE_WLOCK_ASSERT(lle);\t\t\t\t\t\\\n\tKASSERT((lle)->lle_refcnt > 1,\t\t\t\t\\\n\t\t(\"bogus refcnt %d\", (lle)->lle_refcnt));\t\\\n\t(lle)->lle_refcnt--;\t\t\t\t\t\\\n} while (0)\n\n#define\tLLE_FREE_LOCKED(lle) do {\t\t\t\t\\\n\tif ((lle)->lle_refcnt <= 1)\t\t\t\t\\\n\t\t(lle)->lle_tbl->llt_free((lle)->lle_tbl, (lle));\\\n\telse {\t\t\t\t\t\t\t\\\n\t\t(lle)->lle_refcnt--;\t\t\t\t\\\n\t\tLLE_WUNLOCK(lle);\t\t\t\t\\\n\t}\t\t\t\t\t\t\t\\\n\t/* guard against invalid refs */\t\t\t\\\n\tlle = NULL;\t\t\t\t\t\t\\\n} while (0)\n\n#define\tLLE_FREE(lle) do {\t\t\t\t\t\\\n\tLLE_WLOCK(lle);\t\t\t\t\t\t\\\n\tLLE_FREE_LOCKED(lle);\t\t\t\t\t\\\n} while (0)\n\n\n#define\tln_timer_ch\tlle_timer.ln_timer_ch\n#define\tla_timer\tlle_timer.la_timer\n\n/* XXX bad name */\n#define\tL3_ADDR(lle)\t((struct sockaddr *)(&lle[1]))\n#define\tL3_ADDR_LEN(lle)\t(((struct sockaddr *)(&lle[1]))->sa_len)\n\n#ifndef LLTBL_HASHTBL_SIZE\n#define\tLLTBL_HASHTBL_SIZE\t32\t/* default 32 ? */\n#endif\n\n#ifndef LLTBL_HASHMASK\n#define\tLLTBL_HASHMASK\t(LLTBL_HASHTBL_SIZE - 1)\n#endif\n\nstruct lltable {\n\tSLIST_ENTRY(lltable)\tllt_link;\n\tstruct llentries\tlle_head[LLTBL_HASHTBL_SIZE];\n\tint\t\t\tllt_af;\n\tstruct ifnet\t\t*llt_ifp;\n\n\tvoid\t\t\t(*llt_free)(struct lltable *, struct llentry *);\n\tvoid\t\t\t(*llt_prefix_free)(struct lltable *,\n\t\t\t\t    const struct sockaddr *prefix,\n\t\t\t\t    const struct sockaddr *mask,\n\t\t\t\t    u_int flags);\n\tstruct llentry *\t(*llt_lookup)(struct lltable *, u_int flags,\n\t\t\t\t    const struct sockaddr *l3addr);\n\tint\t\t\t(*llt_dump)(struct lltable *,\n\t\t\t\t     struct sysctl_req *);\n};\nMALLOC_DECLARE(M_LLTABLE);\n\n/*\n * flags to be passed to arplookup.\n */\n#define\tLLE_DELETED\t0x0001\t/* entry must be deleted */\n#define\tLLE_STATIC\t0x0002\t/* entry is static */\n#define\tLLE_IFADDR\t0x0004\t/* entry is interface addr */\n#define\tLLE_VALID\t0x0008\t/* ll_addr is valid */\n#define\tLLE_PROXY\t0x0010\t/* proxy entry ??? */\n#define\tLLE_PUB\t\t0x0020\t/* publish entry ??? */\n#define\tLLE_DELETE\t0x4000\t/* delete on a lookup - match LLE_IFADDR */\n#define\tLLE_CREATE\t0x8000\t/* create on a lookup miss */\n#define\tLLE_EXCLUSIVE\t0x2000\t/* return lle xlocked  */\n\n#define LLATBL_HASH(key, mask) \\\n\t(((((((key >> 8) ^ key) >> 8) ^ key) >> 8) ^ key) & mask)\n\nstruct lltable *lltable_init(struct ifnet *, int);\nvoid\t\tlltable_free(struct lltable *);\nvoid\t\tlltable_prefix_free(int, struct sockaddr *, \n                       struct sockaddr *, u_int);\n#if 0\nvoid\t\tlltable_drain(int);\n#endif\nint\t\tlltable_sysctl_dumparp(int, struct sysctl_req *);\n\nsize_t\t\tllentry_free(struct llentry *);\nint\t\tllentry_update(struct llentry **, struct lltable *,\n                       struct sockaddr_storage *, struct ifnet *);\n\n/*\n * Generic link layer address lookup function.\n */\nstatic __inline struct llentry *\nlla_lookup(struct lltable *llt, u_int flags, const struct sockaddr *l3addr)\n{\n\treturn llt->llt_lookup(llt, flags, l3addr);\n}\n\nint\t\tlla_rt_output(struct rt_msghdr *, struct rt_addrinfo *);\n#endif  /* _NET_IF_LLATBL_H_ */\n"
  },
  {
    "path": "freebsd-headers/net/if_llc.h",
    "content": "/*\t$NetBSD: if_llc.h,v 1.12 1999/11/19 20:41:19 thorpej Exp $\t*/\n\n/*-\n * Copyright (c) 1988, 1993\n *\tThe Regents of the University of California.  All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 4. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t@(#)if_llc.h\t8.1 (Berkeley) 6/10/93\n * $FreeBSD: release/9.0.0/sys/net/if_llc.h 164804 2006-12-01 17:50:11Z imp $\n */\n\n#ifndef _NET_IF_LLC_H_\n#define _NET_IF_LLC_H_\n\n/*\n * IEEE 802.2 Link Level Control headers, for use in conjunction with\n * 802.{3,4,5} media access control methods.\n *\n * Headers here do not use bit fields due to shortcommings in many\n * compilers.\n */\n\nstruct llc {\n\tu_int8_t llc_dsap;\n\tu_int8_t llc_ssap;\n\tunion {\n\t    struct {\n\t\tu_int8_t control;\n\t\tu_int8_t format_id;\n\t\tu_int8_t class;\n\t\tu_int8_t window_x2;\n\t    } __packed type_u;\n\t    struct {\n\t\tu_int8_t num_snd_x2;\n\t\tu_int8_t num_rcv_x2;\n\t    } __packed type_i;\n\t    struct {\n\t\tu_int8_t control;\n\t\tu_int8_t num_rcv_x2;\n\t    } __packed type_s;\n\t    struct {\n\t        u_int8_t control;\n\t\t/*\n\t\t * We cannot put the following fields in a structure because\n\t\t * the structure rounding might cause padding.\n\t\t */\n\t\tu_int8_t frmr_rej_pdu0;\n\t\tu_int8_t frmr_rej_pdu1;\n\t\tu_int8_t frmr_control;\n\t\tu_int8_t frmr_control_ext;\n\t\tu_int8_t frmr_cause;\n\t    } __packed type_frmr;\n\t    struct {\n\t\tu_int8_t  control;\n\t\tu_int8_t  org_code[3];\n\t\tu_int16_t ether_type;\n\t    } __packed type_snap;\n\t    struct {\n\t\tu_int8_t control;\n\t\tu_int8_t control_ext;\n\t    } __packed type_raw;\n\t} __packed llc_un;\n} __packed;\n\nstruct frmrinfo {\n\tu_int8_t frmr_rej_pdu0;\n\tu_int8_t frmr_rej_pdu1;\n\tu_int8_t frmr_control;\n\tu_int8_t frmr_control_ext;\n\tu_int8_t frmr_cause;\n} __packed;\n\n#define\tllc_control\t\tllc_un.type_u.control\n#define\tllc_control_ext\t\tllc_un.type_raw.control_ext\n#define\tllc_fid\t\t\tllc_un.type_u.format_id\n#define\tllc_class\t\tllc_un.type_u.class\n#define\tllc_window\t\tllc_un.type_u.window_x2\n#define\tllc_frmrinfo \t\tllc_un.type_frmr.frmr_rej_pdu0\n#define\tllc_frmr_pdu0\t\tllc_un.type_frmr.frmr_rej_pdu0\n#define\tllc_frmr_pdu1\t\tllc_un.type_frmr.frmr_rej_pdu1\n#define\tllc_frmr_control\tllc_un.type_frmr.frmr_control\n#define\tllc_frmr_control_ext\tllc_un.type_frmr.frmr_control_ext\n#define\tllc_frmr_cause\t\tllc_un.type_frmr.frmr_cause\n#define\tllc_snap\t\tllc_un.type_snap\n\n/*\n * Don't use sizeof(struct llc_un) for LLC header sizes\n */\n#define LLC_ISFRAMELEN 4\n#define LLC_UFRAMELEN  3\n#define LLC_FRMRLEN    7\n#define LLC_SNAPFRAMELEN 8\n\n#ifdef CTASSERT\nCTASSERT(sizeof (struct llc) == LLC_SNAPFRAMELEN);\n#endif\n\n/*\n * Unnumbered LLC format commands\n */\n#define LLC_UI\t\t0x3\n#define LLC_UI_P\t0x13\n#define LLC_DISC\t0x43\n#define\tLLC_DISC_P\t0x53\n#define LLC_UA\t\t0x63\n#define LLC_UA_P\t0x73\n#define LLC_TEST\t0xe3\n#define LLC_TEST_P\t0xf3\n#define LLC_FRMR\t0x87\n#define\tLLC_FRMR_P\t0x97\n#define LLC_DM\t\t0x0f\n#define\tLLC_DM_P\t0x1f\n#define LLC_XID\t\t0xaf\n#define LLC_XID_P\t0xbf\n#define LLC_SABME\t0x6f\n#define LLC_SABME_P\t0x7f\n\n/*\n * Supervisory LLC commands\n */\n#define\tLLC_RR\t\t0x01\n#define\tLLC_RNR\t\t0x05\n#define\tLLC_REJ\t\t0x09\n\n/*\n * Info format - dummy only\n */\n#define\tLLC_INFO\t0x00\n\n/*\n * ISO PDTR 10178 contains among others\n */\n#define LLC_8021D_LSAP\t0x42\n#define LLC_X25_LSAP\t0x7e\n#define LLC_SNAP_LSAP\t0xaa\n#define LLC_ISO_LSAP\t0xfe\n\n#endif /* _NET_IF_LLC_H_ */\n"
  },
  {
    "path": "freebsd-headers/net/if_media.h",
    "content": "/*\t$NetBSD: if_media.h,v 1.3 1997/03/26 01:19:27 thorpej Exp $\t*/\n/* $FreeBSD: release/9.0.0/sys/net/if_media.h 221955 2011-05-15 12:58:29Z marius $ */\n\n/*-\n * Copyright (c) 1997\n *\tJonathan Stone and Jason R. Thorpe.  All rights reserved.\n *\n * This software is derived from information provided by Matt Thomas.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. All advertising materials mentioning features or use of this software\n *    must display the following acknowledgement:\n *\tThis product includes software developed by Jonathan Stone\n *\tand Jason R. Thorpe for the NetBSD Project.\n * 4. The names of the authors may not be used to endorse or promote products\n *    derived from this software without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR\n * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES\n * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,\n * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,\n * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\n * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED\n * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,\n * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n */\n\n#ifndef _NET_IF_MEDIA_H_\n#define\t_NET_IF_MEDIA_H_\n\n/*\n * Prototypes and definitions for BSD/OS-compatible network interface\n * media selection.\n *\n * Where it is safe to do so, this code strays slightly from the BSD/OS\n * design.  Software which uses the API (device drivers, basically)\n * shouldn't notice any difference.\n *\n * Many thanks to Matt Thomas for providing the information necessary\n * to implement this interface.\n */\n\n#ifdef _KERNEL\n\n#include <sys/queue.h>\n\n/*\n * Driver callbacks for media status and change requests.\n */\ntypedef\tint (*ifm_change_cb_t)(struct ifnet *ifp);\ntypedef\tvoid (*ifm_stat_cb_t)(struct ifnet *ifp, struct ifmediareq *req);\n\n/*\n * In-kernel representation of a single supported media type.\n */\nstruct ifmedia_entry {\n\tLIST_ENTRY(ifmedia_entry) ifm_list;\n\tint\tifm_media;\t/* description of this media attachment */\n\tint\tifm_data;\t/* for driver-specific use */\n\tvoid\t*ifm_aux;\t/* for driver-specific use */\n};\n\n/*\n * One of these goes into a network interface's softc structure.\n * It is used to keep general media state.\n */\nstruct ifmedia {\n\tint\tifm_mask;\t/* mask of changes we don't care about */\n\tint\tifm_media;\t/* current user-set media word */\n\tstruct ifmedia_entry *ifm_cur;\t/* currently selected media */\n\tLIST_HEAD(, ifmedia_entry) ifm_list; /* list of all supported media */\n\tifm_change_cb_t\tifm_change;\t/* media change driver callback */\n\tifm_stat_cb_t\tifm_status;\t/* media status driver callback */\n};\n\n/* Initialize an interface's struct if_media field. */\nvoid\tifmedia_init(struct ifmedia *ifm, int dontcare_mask,\n\t    ifm_change_cb_t change_callback, ifm_stat_cb_t status_callback);\n\n/* Remove all mediums from a struct ifmedia.  */\nvoid\tifmedia_removeall( struct ifmedia *ifm);\n\n/* Add one supported medium to a struct ifmedia. */\nvoid\tifmedia_add(struct ifmedia *ifm, int mword, int data, void *aux);\n\n/* Add an array (of ifmedia_entry) media to a struct ifmedia. */\nvoid\tifmedia_list_add(struct ifmedia *mp, struct ifmedia_entry *lp,\n\t    int count);\n\n/* Set default media type on initialization. */\nvoid\tifmedia_set(struct ifmedia *ifm, int mword);\n\n/* Common ioctl function for getting/setting media, called by driver. */\nint\tifmedia_ioctl(struct ifnet *ifp, struct ifreq *ifr,\n\t    struct ifmedia *ifm, u_long cmd);\n\n/* Compute baudrate for a given media. */\nuint64_t\tifmedia_baudrate(int);\n\n#endif /*_KERNEL */\n\n/*\n * if_media Options word:\n *\tBits\tUse\n *\t----\t-------\n *\t0-4\tMedia variant\n *\t5-7\tMedia type\n *\t8-15\tType specific options\n *\t16-18\tMode (for multi-mode devices)\n *\t19\tRFU\n *\t20-27\tShared (global) options\n *\t28-31\tInstance\n */\n\n/*\n * Ethernet\n */\n#define\tIFM_ETHER\t0x00000020\n#define\tIFM_10_T\t3\t\t/* 10BaseT - RJ45 */\n#define\tIFM_10_2\t4\t\t/* 10Base2 - Thinnet */\n#define\tIFM_10_5\t5\t\t/* 10Base5 - AUI */\n#define\tIFM_100_TX\t6\t\t/* 100BaseTX - RJ45 */\n#define\tIFM_100_FX\t7\t\t/* 100BaseFX - Fiber */\n#define\tIFM_100_T4\t8\t\t/* 100BaseT4 - 4 pair cat 3 */\n#define\tIFM_100_VG\t9\t\t/* 100VG-AnyLAN */\n#define\tIFM_100_T2\t10\t\t/* 100BaseT2 */\n#define\tIFM_1000_SX\t11\t\t/* 1000BaseSX - multi-mode fiber */\n#define\tIFM_10_STP\t12\t\t/* 10BaseT over shielded TP */\n#define\tIFM_10_FL\t13\t\t/* 10BaseFL - Fiber */\n#define\tIFM_1000_LX\t14\t\t/* 1000baseLX - single-mode fiber */\n#define\tIFM_1000_CX\t15\t\t/* 1000baseCX - 150ohm STP */\n#define\tIFM_1000_T\t16\t\t/* 1000baseT - 4 pair cat 5 */\n#define\tIFM_HPNA_1\t17\t\t/* HomePNA 1.0 (1Mb/s) */\n#define\tIFM_10G_LR\t18\t\t/* 10GBase-LR 1310nm Single-mode */\n#define\tIFM_10G_SR\t19\t\t/* 10GBase-SR 850nm Multi-mode */\n#define\tIFM_10G_CX4\t20\t\t/* 10GBase CX4 copper */\n#define\tIFM_2500_SX\t21\t\t/* 2500BaseSX - multi-mode fiber */\n#define\tIFM_10G_TWINAX\t22\t\t/* 10GBase Twinax copper */\n#define\tIFM_10G_TWINAX_LONG\t23\t/* 10GBase Twinax Long copper */\n#define\tIFM_10G_LRM\t24\t\t/* 10GBase-LRM 850nm Multi-mode */\n#define\tIFM_UNKNOWN\t25\t\t/* media types not defined yet */\n#define\tIFM_10G_T\t26\t\t/* 10GBase-T - RJ45 */\n\n/* note 31 is the max! */\n\n#define\tIFM_ETH_MASTER\t0x00000100\t/* master mode (1000baseT) */\n#define\tIFM_ETH_RXPAUSE\t0x00000200\t/* receive PAUSE frames */\n#define\tIFM_ETH_TXPAUSE\t0x00000400\t/* transmit PAUSE frames */\n\n/*\n * Token ring\n */\n#define\tIFM_TOKEN\t0x00000040\n#define\tIFM_TOK_STP4\t3\t\t/* Shielded twisted pair 4m - DB9 */\n#define\tIFM_TOK_STP16\t4\t\t/* Shielded twisted pair 16m - DB9 */\n#define\tIFM_TOK_UTP4\t5\t\t/* Unshielded twisted pair 4m - RJ45 */\n#define\tIFM_TOK_UTP16\t6\t\t/* Unshielded twisted pair 16m - RJ45 */\n#define\tIFM_TOK_STP100  7\t\t/* Shielded twisted pair 100m - DB9 */\n#define\tIFM_TOK_UTP100  8\t\t/* Unshielded twisted pair 100m - RJ45 */\n#define\tIFM_TOK_ETR\t0x00000200\t/* Early token release */\n#define\tIFM_TOK_SRCRT\t0x00000400\t/* Enable source routing features */\n#define\tIFM_TOK_ALLR\t0x00000800\t/* All routes / Single route bcast */\n#define\tIFM_TOK_DTR\t0x00002000\t/* Dedicated token ring */\n#define\tIFM_TOK_CLASSIC\t0x00004000\t/* Classic token ring */\n#define\tIFM_TOK_AUTO\t0x00008000\t/* Automatic Dedicate/Classic token ring */\n\n/*\n * FDDI\n */\n#define\tIFM_FDDI\t0x00000060\n#define\tIFM_FDDI_SMF\t3\t\t/* Single-mode fiber */\n#define\tIFM_FDDI_MMF\t4\t\t/* Multi-mode fiber */\n#define\tIFM_FDDI_UTP\t5\t\t/* CDDI / UTP */\n#define\tIFM_FDDI_DA\t0x00000100\t/* Dual attach / single attach */\n\n/*\n * IEEE 802.11 Wireless\n */\n#define\tIFM_IEEE80211\t0x00000080\n/* NB: 0,1,2 are auto, manual, none defined below */\n#define\tIFM_IEEE80211_FH1\t3\t/* Frequency Hopping 1Mbps */\n#define\tIFM_IEEE80211_FH2\t4\t/* Frequency Hopping 2Mbps */\n#define\tIFM_IEEE80211_DS1\t5\t/* Direct Sequence 1Mbps */\n#define\tIFM_IEEE80211_DS2\t6\t/* Direct Sequence 2Mbps */\n#define\tIFM_IEEE80211_DS5\t7\t/* Direct Sequence 5.5Mbps */\n#define\tIFM_IEEE80211_DS11\t8\t/* Direct Sequence 11Mbps */\n#define\tIFM_IEEE80211_DS22\t9\t/* Direct Sequence 22Mbps */\n#define\tIFM_IEEE80211_OFDM6\t10\t/* OFDM 6Mbps */\n#define\tIFM_IEEE80211_OFDM9\t11\t/* OFDM 9Mbps */\n#define\tIFM_IEEE80211_OFDM12\t12\t/* OFDM 12Mbps */\n#define\tIFM_IEEE80211_OFDM18\t13\t/* OFDM 18Mbps */\n#define\tIFM_IEEE80211_OFDM24\t14\t/* OFDM 24Mbps */\n#define\tIFM_IEEE80211_OFDM36\t15\t/* OFDM 36Mbps */\n#define\tIFM_IEEE80211_OFDM48\t16\t/* OFDM 48Mbps */\n#define\tIFM_IEEE80211_OFDM54\t17\t/* OFDM 54Mbps */\n#define\tIFM_IEEE80211_OFDM72\t18\t/* OFDM 72Mbps */\n#define\tIFM_IEEE80211_DS354k\t19\t/* Direct Sequence 354Kbps */\n#define\tIFM_IEEE80211_DS512k\t20\t/* Direct Sequence 512Kbps */\n#define\tIFM_IEEE80211_OFDM3\t21\t/* OFDM 3Mbps */\n#define\tIFM_IEEE80211_OFDM4\t22\t/* OFDM 4.5Mbps */\n#define\tIFM_IEEE80211_OFDM27\t23\t/* OFDM 27Mbps */\n/* NB: not enough bits to express MCS fully */\n#define\tIFM_IEEE80211_MCS\t24\t/* HT MCS rate */\n\n#define\tIFM_IEEE80211_ADHOC\t0x00000100\t/* Operate in Adhoc mode */\n#define\tIFM_IEEE80211_HOSTAP\t0x00000200\t/* Operate in Host AP mode */\n#define\tIFM_IEEE80211_IBSS\t0x00000400\t/* Operate in IBSS mode */\n#define\tIFM_IEEE80211_WDS\t0x00000800\t/* Operate in WDS mode */\n#define\tIFM_IEEE80211_TURBO\t0x00001000\t/* Operate in turbo mode */\n#define\tIFM_IEEE80211_MONITOR\t0x00002000\t/* Operate in monitor mode */\n#define\tIFM_IEEE80211_MBSS\t0x00004000\t/* Operate in MBSS mode */\n\n/* operating mode for multi-mode devices */\n#define\tIFM_IEEE80211_11A\t0x00010000\t/* 5Ghz, OFDM mode */\n#define\tIFM_IEEE80211_11B\t0x00020000\t/* Direct Sequence mode */\n#define\tIFM_IEEE80211_11G\t0x00030000\t/* 2Ghz, CCK mode */\n#define\tIFM_IEEE80211_FH\t0x00040000\t/* 2Ghz, GFSK mode */\n#define\tIFM_IEEE80211_11NA\t0x00050000\t/* 5Ghz, HT mode */\n#define\tIFM_IEEE80211_11NG\t0x00060000\t/* 2Ghz, HT mode */\n\n/*\n * ATM\n */\n#define\tIFM_ATM\t0x000000a0\n#define\tIFM_ATM_UNKNOWN\t\t3\n#define\tIFM_ATM_UTP_25\t\t4\n#define\tIFM_ATM_TAXI_100\t5\n#define\tIFM_ATM_TAXI_140\t6\n#define\tIFM_ATM_MM_155\t\t7\n#define\tIFM_ATM_SM_155\t\t8\n#define\tIFM_ATM_UTP_155\t\t9\n#define\tIFM_ATM_MM_622\t\t10\n#define\tIFM_ATM_SM_622\t\t11\n#define\tIFM_ATM_VIRTUAL\t\t12\n#define\tIFM_ATM_SDH\t\t0x00000100\t/* SDH instead of SONET */\n#define\tIFM_ATM_NOSCRAMB\t0x00000200\t/* no scrambling */\n#define\tIFM_ATM_UNASSIGNED\t0x00000400\t/* unassigned cells */\n\n/*\n * CARP Common Address Redundancy Protocol\n */\n#define\tIFM_CARP\t0x000000c0\n\n/*\n * Shared media sub-types\n */\n#define\tIFM_AUTO\t0\t\t/* Autoselect best media */\n#define\tIFM_MANUAL\t1\t\t/* Jumper/dipswitch selects media */\n#define\tIFM_NONE\t2\t\t/* Deselect all media */\n\n/*\n * Shared options\n */\n#define\tIFM_FDX\t\t0x00100000\t/* Force full duplex */\n#define\tIFM_HDX\t\t0x00200000\t/* Force half duplex */\n#define\tIFM_FLOW\t0x00400000\t/* enable hardware flow control */\n#define\tIFM_FLAG0\t0x01000000\t/* Driver defined flag */\n#define\tIFM_FLAG1\t0x02000000\t/* Driver defined flag */\n#define\tIFM_FLAG2\t0x04000000\t/* Driver defined flag */\n#define\tIFM_LOOP\t0x08000000\t/* Put hardware in loopback */\n\n/*\n * Masks\n */\n#define\tIFM_NMASK\t0x000000e0\t/* Network type */\n#define\tIFM_TMASK\t0x0000001f\t/* Media sub-type */\n#define\tIFM_IMASK\t0xf0000000\t/* Instance */\n#define\tIFM_ISHIFT\t28\t\t/* Instance shift */\n#define\tIFM_OMASK\t0x0000ff00\t/* Type specific options */\n#define\tIFM_MMASK\t0x00070000\t/* Mode */\n#define\tIFM_MSHIFT\t16\t\t/* Mode shift */\n#define\tIFM_GMASK\t0x0ff00000\t/* Global options */\n\n/* Ethernet flow control mask */\n#define\tIFM_ETH_FMASK\t(IFM_FLOW | IFM_ETH_RXPAUSE | IFM_ETH_TXPAUSE)\n\n/*\n * Status bits\n */\n#define\tIFM_AVALID\t0x00000001\t/* Active bit valid */\n#define\tIFM_ACTIVE\t0x00000002\t/* Interface attached to working net */\n\n/* Mask of \"status valid\" bits, for ifconfig(8). */\n#define\tIFM_STATUS_VALID\tIFM_AVALID\n\n/* List of \"status valid\" bits, for ifconfig(8). */\n#define\tIFM_STATUS_VALID_LIST {\t\t\t\t\t\t\\\n\tIFM_AVALID,\t\t\t\t\t\t\t\\\n\t0\t\t\t\t\t\t\t\t\\\n}\n\n/*\n * Macros to extract various bits of information from the media word.\n */\n#define\tIFM_TYPE(x)\t\t((x) & IFM_NMASK)\n#define\tIFM_SUBTYPE(x)\t\t((x) & IFM_TMASK)\n#define\tIFM_TYPE_OPTIONS(x)\t((x) & IFM_OMASK)\n#define\tIFM_INST(x)\t\t(((x) & IFM_IMASK) >> IFM_ISHIFT)\n#define\tIFM_OPTIONS(x)\t\t((x) & (IFM_OMASK | IFM_GMASK))\n#define\tIFM_MODE(x)\t\t((x) & IFM_MMASK)\n\n#define\tIFM_INST_MAX\t\tIFM_INST(IFM_IMASK)\n\n/*\n * Macro to create a media word.\n */\n#define\tIFM_MAKEWORD(type, subtype, options, instance)\t\t\t\\\n\t((type) | (subtype) | (options) | ((instance) << IFM_ISHIFT))\n#define\tIFM_MAKEMODE(mode) \\\n\t(((mode) << IFM_MSHIFT) & IFM_MMASK)\n\n/*\n * NetBSD extension not defined in the BSDI API.  This is used in various\n * places to get the canonical description for a given type/subtype.\n *\n * NOTE: all but the top-level type descriptions must contain NO whitespace!\n * Otherwise, parsing these in ifconfig(8) would be a nightmare.\n */\nstruct ifmedia_description {\n\tint\tifmt_word;\t\t/* word value; may be masked */\n\tconst char *ifmt_string;\t/* description */\n};\n\n#define\tIFM_TYPE_DESCRIPTIONS {\t\t\t\t\t\t\\\n\t{ IFM_ETHER,\t\t\"Ethernet\" },\t\t\t\t\\\n\t{ IFM_TOKEN,\t\t\"Token ring\" },\t\t\t\t\\\n\t{ IFM_FDDI,\t\t\"FDDI\" },\t\t\t\t\\\n\t{ IFM_IEEE80211,\t\"IEEE 802.11 Wireless Ethernet\" },\t\\\n\t{ IFM_ATM,\t\t\"ATM\" },\t\t\t\t\\\n\t{ IFM_CARP,\t\t\"Common Address Redundancy Protocol\" }, \\\n\t{ 0, NULL },\t\t\t\t\t\t\t\\\n}\n\n#define\tIFM_SUBTYPE_ETHERNET_DESCRIPTIONS {\t\t\t\t\\\n\t{ IFM_10_T,\t\"10baseT/UTP\" },\t\t\t\t\\\n\t{ IFM_10_2,\t\"10base2/BNC\" },\t\t\t\t\\\n\t{ IFM_10_5,\t\"10base5/AUI\" },\t\t\t\t\\\n\t{ IFM_100_TX,\t\"100baseTX\" },\t\t\t\t\t\\\n\t{ IFM_100_FX,\t\"100baseFX\" },\t\t\t\t\t\\\n\t{ IFM_100_T4,\t\"100baseT4\" },\t\t\t\t\t\\\n\t{ IFM_100_VG,\t\"100baseVG\" },\t\t\t\t\t\\\n\t{ IFM_100_T2,\t\"100baseT2\" },\t\t\t\t\t\\\n\t{ IFM_10_STP,\t\"10baseSTP\" },\t\t\t\t\t\\\n\t{ IFM_10_FL,\t\"10baseFL\" },\t\t\t\t\t\\\n\t{ IFM_1000_SX,\t\"1000baseSX\" },\t\t\t\t\t\\\n\t{ IFM_1000_LX,\t\"1000baseLX\" },\t\t\t\t\t\\\n\t{ IFM_1000_CX,\t\"1000baseCX\" },\t\t\t\t\t\\\n\t{ IFM_1000_T,\t\"1000baseT\" },\t\t\t\t\t\\\n\t{ IFM_HPNA_1,\t\"homePNA\" },\t\t\t\t\t\\\n\t{ IFM_10G_LR,\t\"10Gbase-LR\" },\t\t\t\t\t\\\n\t{ IFM_10G_SR,\t\"10Gbase-SR\" },\t\t\t\t\t\\\n\t{ IFM_10G_CX4,\t\"10Gbase-CX4\" },\t\t\t\t\\\n\t{ IFM_2500_SX,\t\"2500BaseSX\" },\t\t\t\t\t\\\n\t{ IFM_10G_LRM,\t\"10Gbase-LRM\" },\t\t\t\t\\\n\t{ IFM_10G_TWINAX,\t\"10Gbase-Twinax\" },\t\t\t\\\n\t{ IFM_10G_TWINAX_LONG,\t\"10Gbase-Twinax-Long\" },\t\t\\\n\t{ IFM_UNKNOWN,\t\"Unknown\" },\t\t\t\t\t\\\n\t{ IFM_10G_T,\t\"10Gbase-T\" },\t\t\t\t\t\\\n\t{ 0, NULL },\t\t\t\t\t\t\t\\\n}\n\n#define\tIFM_SUBTYPE_ETHERNET_ALIASES {\t\t\t\t\t\\\n\t{ IFM_10_T,\t\"10baseT\" },\t\t\t\t\t\\\n\t{ IFM_10_T,\t\"UTP\" },\t\t\t\t\t\\\n\t{ IFM_10_T,\t\"10UTP\" },\t\t\t\t\t\\\n\t{ IFM_10_2,\t\"BNC\" },\t\t\t\t\t\\\n\t{ IFM_10_2,\t\"10BNC\" },\t\t\t\t\t\\\n\t{ IFM_10_5,\t\"AUI\" },\t\t\t\t\t\\\n\t{ IFM_10_5,\t\"10AUI\" },\t\t\t\t\t\\\n\t{ IFM_100_TX,\t\"100TX\" },\t\t\t\t\t\\\n\t{ IFM_100_T4,\t\"100T4\" },\t\t\t\t\t\\\n\t{ IFM_100_VG,\t\"100VG\" },\t\t\t\t\t\\\n\t{ IFM_100_T2,\t\"100T2\" },\t\t\t\t\t\\\n\t{ IFM_10_STP,\t\"10STP\" },\t\t\t\t\t\\\n\t{ IFM_10_FL,\t\"10FL\" },\t\t\t\t\t\\\n\t{ IFM_1000_SX,\t\"1000SX\" },\t\t\t\t\t\\\n\t{ IFM_1000_LX,\t\"1000LX\" },\t\t\t\t\t\\\n\t{ IFM_1000_CX,\t\"1000CX\" },\t\t\t\t\t\\\n\t{ IFM_1000_T,\t\"1000baseTX\" },\t\t\t\t\t\\\n\t{ IFM_1000_T,\t\"1000TX\" },\t\t\t\t\t\\\n\t{ IFM_1000_T,\t\"1000T\" },\t\t\t\t\t\\\n\t{ IFM_2500_SX,\t\"2500SX\" },\t\t\t\t\t\\\n\t\t\t\t\t\t\t\t\t\\\n\t/*\t\t\t\t\t\t\t\t\\\n\t * Shorthands for common media+option combinations as announced\t\\\n\t * by miibus(4)\t\t\t\t\t\t\t\\\n\t */\t\t\t\t\t\t\t\t\\\n\t{ IFM_10_T | IFM_FDX,\t\t\t\"10baseT-FDX\" },\t\\\n\t{ IFM_10_T | IFM_FDX | IFM_FLOW,\t\"10baseT-FDX-flow\" },\t\\\n\t{ IFM_100_TX | IFM_FDX,\t\t\t\"100baseTX-FDX\" },\t\\\n\t{ IFM_100_TX | IFM_FDX | IFM_FLOW,\t\"100baseTX-FDX-flow\" },\t\\\n\t{ IFM_1000_T | IFM_FDX,\t\t\t\"1000baseT-FDX\" },\t\\\n\t{ IFM_1000_T | IFM_FDX | IFM_FLOW,\t\"1000baseT-FDX-flow\" },\t\\\n\t{ IFM_1000_T | IFM_FDX | IFM_FLOW | IFM_ETH_MASTER,\t\t\\\n\t    \"1000baseT-FDX-flow-master\" },\t\t\t\t\\\n\t{ IFM_1000_T | IFM_FDX | IFM_ETH_MASTER,\t\t\t\\\n\t    \"1000baseT-FDX-master\" },\t\t\t\t\t\\\n\t{ IFM_1000_T | IFM_ETH_MASTER,\t\t\"1000baseT-master\" },\t\\\n\t\t\t\t\t\t\t\t\t\\\n\t{ 0, NULL },\t\t\t\t\t\t\t\\\n}\n\n#define\tIFM_SUBTYPE_ETHERNET_OPTION_DESCRIPTIONS {\t\t\t\\\n\t{ IFM_ETH_MASTER,\t\"master\" },\t\t\t\t\\\n\t{ IFM_ETH_RXPAUSE,\t\"rxpause\" },\t\t\t\t\\\n\t{ IFM_ETH_TXPAUSE,\t\"txpause\" },\t\t\t\t\\\n\t{ 0, NULL },\t\t\t\t\t\t\t\\\n}\n\n#define\tIFM_SUBTYPE_TOKENRING_DESCRIPTIONS {\t\t\t\t\\\n\t{ IFM_TOK_STP4,\t\"DB9/4Mbit\" },\t\t\t\t\t\\\n\t{ IFM_TOK_STP16, \"DB9/16Mbit\" },\t\t\t\t\\\n\t{ IFM_TOK_UTP4,\t\"UTP/4Mbit\" },\t\t\t\t\t\\\n\t{ IFM_TOK_UTP16, \"UTP/16Mbit\" },\t\t\t\t\\\n\t{ IFM_TOK_STP100, \"STP/100Mbit\" },\t\t\t\t\\\n\t{ IFM_TOK_UTP100, \"UTP/100Mbit\" },\t\t\t\t\\\n\t{ 0, NULL },\t\t\t\t\t\t\t\\\n}\n\n#define\tIFM_SUBTYPE_TOKENRING_ALIASES {\t\t\t\t\t\\\n\t{ IFM_TOK_STP4,\t\"4STP\" },\t\t\t\t\t\\\n\t{ IFM_TOK_STP16, \"16STP\" },\t\t\t\t\t\\\n\t{ IFM_TOK_UTP4,\t\"4UTP\" },\t\t\t\t\t\\\n\t{ IFM_TOK_UTP16, \"16UTP\" },\t\t\t\t\t\\\n\t{ IFM_TOK_STP100, \"100STP\" },\t\t\t\t\t\\\n\t{ IFM_TOK_UTP100, \"100UTP\" },\t\t\t\t\t\\\n\t{ 0, NULL },\t\t\t\t\t\t\t\\\n}\n\n#define\tIFM_SUBTYPE_TOKENRING_OPTION_DESCRIPTIONS {\t\t\t\\\n\t{ IFM_TOK_ETR,\t\"EarlyTokenRelease\" },\t\t\t\t\\\n\t{ IFM_TOK_SRCRT, \"SourceRouting\" },\t\t\t\t\\\n\t{ IFM_TOK_ALLR,\t\"AllRoutes\" },\t\t\t\t\t\\\n\t{ IFM_TOK_DTR,\t\"Dedicated\" },\t\t\t\t\t\\\n\t{ IFM_TOK_CLASSIC,\"Classic\" },\t\t\t\t\t\\\n\t{ IFM_TOK_AUTO,\t\" \" },\t\t\t\t\t\t\\\n\t{ 0, NULL },\t\t\t\t\t\t\t\\\n}\n\n#define\tIFM_SUBTYPE_FDDI_DESCRIPTIONS {\t\t\t\t\t\\\n\t{ IFM_FDDI_SMF, \"Single-mode\" },\t\t\t\t\\\n\t{ IFM_FDDI_MMF, \"Multi-mode\" },\t\t\t\t\t\\\n\t{ IFM_FDDI_UTP, \"UTP\" },\t\t\t\t\t\\\n\t{ 0, NULL },\t\t\t\t\t\t\t\\\n}\n\n#define\tIFM_SUBTYPE_FDDI_ALIASES {\t\t\t\t\t\\\n\t{ IFM_FDDI_SMF,\t\"SMF\" },\t\t\t\t\t\\\n\t{ IFM_FDDI_MMF,\t\"MMF\" },\t\t\t\t\t\\\n\t{ IFM_FDDI_UTP,\t\"CDDI\" },\t\t\t\t\t\\\n\t{ 0, NULL },\t\t\t\t\t\t\t\\\n}\n\n#define\tIFM_SUBTYPE_FDDI_OPTION_DESCRIPTIONS {\t\t\t\t\\\n\t{ IFM_FDDI_DA, \"Dual-attach\" },\t\t\t\t\t\\\n\t{ 0, NULL },\t\t\t\t\t\t\t\\\n}\n\n#define\tIFM_SUBTYPE_IEEE80211_DESCRIPTIONS {\t\t\t\t\\\n\t{ IFM_IEEE80211_FH1, \"FH/1Mbps\" },\t\t\t\t\\\n\t{ IFM_IEEE80211_FH2, \"FH/2Mbps\" },\t\t\t\t\\\n\t{ IFM_IEEE80211_DS1, \"DS/1Mbps\" },\t\t\t\t\\\n\t{ IFM_IEEE80211_DS2, \"DS/2Mbps\" },\t\t\t\t\\\n\t{ IFM_IEEE80211_DS5, \"DS/5.5Mbps\" },\t\t\t\t\\\n\t{ IFM_IEEE80211_DS11, \"DS/11Mbps\" },\t\t\t\t\\\n\t{ IFM_IEEE80211_DS22, \"DS/22Mbps\" },\t\t\t\t\\\n\t{ IFM_IEEE80211_OFDM6, \"OFDM/6Mbps\" },\t\t\t\t\\\n\t{ IFM_IEEE80211_OFDM9, \"OFDM/9Mbps\" },\t\t\t\t\\\n\t{ IFM_IEEE80211_OFDM12, \"OFDM/12Mbps\" },\t\t\t\\\n\t{ IFM_IEEE80211_OFDM18, \"OFDM/18Mbps\" },\t\t\t\\\n\t{ IFM_IEEE80211_OFDM24, \"OFDM/24Mbps\" },\t\t\t\\\n\t{ IFM_IEEE80211_OFDM36, \"OFDM/36Mbps\" },\t\t\t\\\n\t{ IFM_IEEE80211_OFDM48, \"OFDM/48Mbps\" },\t\t\t\\\n\t{ IFM_IEEE80211_OFDM54, \"OFDM/54Mbps\" },\t\t\t\\\n\t{ IFM_IEEE80211_OFDM72, \"OFDM/72Mbps\" },\t\t\t\\\n\t{ IFM_IEEE80211_DS354k, \"DS/354Kbps\" },\t\t\t\t\\\n\t{ IFM_IEEE80211_DS512k, \"DS/512Kbps\" },\t\t\t\t\\\n\t{ IFM_IEEE80211_OFDM3, \"OFDM/3Mbps\" },\t\t\t\t\\\n\t{ IFM_IEEE80211_OFDM4, \"OFDM/4.5Mbps\" },\t\t\t\\\n\t{ IFM_IEEE80211_OFDM27, \"OFDM/27Mbps\" },\t\t\t\\\n\t{ IFM_IEEE80211_MCS, \"MCS\" },\t\t\t\t\t\\\n\t{ 0, NULL },\t\t\t\t\t\t\t\\\n}\n\n#define\tIFM_SUBTYPE_IEEE80211_ALIASES {\t\t\t\t\t\\\n\t{ IFM_IEEE80211_FH1, \"FH1\" },\t\t\t\t\t\\\n\t{ IFM_IEEE80211_FH2, \"FH2\" },\t\t\t\t\t\\\n\t{ IFM_IEEE80211_FH1, \"FrequencyHopping/1Mbps\" },\t\t\\\n\t{ IFM_IEEE80211_FH2, \"FrequencyHopping/2Mbps\" },\t\t\\\n\t{ IFM_IEEE80211_DS1, \"DS1\" },\t\t\t\t\t\\\n\t{ IFM_IEEE80211_DS2, \"DS2\" },\t\t\t\t\t\\\n\t{ IFM_IEEE80211_DS5, \"DS5.5\" },\t\t\t\t\t\\\n\t{ IFM_IEEE80211_DS11, \"DS11\" },\t\t\t\t\t\\\n\t{ IFM_IEEE80211_DS22, \"DS22\" },\t\t\t\t\t\\\n\t{ IFM_IEEE80211_DS1, \"DirectSequence/1Mbps\" },\t\t\t\\\n\t{ IFM_IEEE80211_DS2, \"DirectSequence/2Mbps\" },\t\t\t\\\n\t{ IFM_IEEE80211_DS5, \"DirectSequence/5.5Mbps\" },\t\t\\\n\t{ IFM_IEEE80211_DS11, \"DirectSequence/11Mbps\" },\t\t\\\n\t{ IFM_IEEE80211_DS22, \"DirectSequence/22Mbps\" },\t\t\\\n\t{ IFM_IEEE80211_OFDM6, \"OFDM6\" },\t\t\t\t\\\n\t{ IFM_IEEE80211_OFDM9, \"OFDM9\" },\t\t\t\t\\\n\t{ IFM_IEEE80211_OFDM12, \"OFDM12\" },\t\t\t\t\\\n\t{ IFM_IEEE80211_OFDM18, \"OFDM18\" },\t\t\t\t\\\n\t{ IFM_IEEE80211_OFDM24, \"OFDM24\" },\t\t\t\t\\\n\t{ IFM_IEEE80211_OFDM36, \"OFDM36\" },\t\t\t\t\\\n\t{ IFM_IEEE80211_OFDM48, \"OFDM48\" },\t\t\t\t\\\n\t{ IFM_IEEE80211_OFDM54, \"OFDM54\" },\t\t\t\t\\\n\t{ IFM_IEEE80211_OFDM72, \"OFDM72\" },\t\t\t\t\\\n\t{ IFM_IEEE80211_DS1, \"CCK1\" },\t\t\t\t\t\\\n\t{ IFM_IEEE80211_DS2, \"CCK2\" },\t\t\t\t\t\\\n\t{ IFM_IEEE80211_DS5, \"CCK5.5\" },\t\t\t\t\\\n\t{ IFM_IEEE80211_DS11, \"CCK11\" },\t\t\t\t\\\n\t{ IFM_IEEE80211_DS354k, \"DS354K\" },\t\t\t\t\\\n\t{ IFM_IEEE80211_DS354k, \"DirectSequence/354Kbps\" },\t\t\\\n\t{ IFM_IEEE80211_DS512k, \"DS512K\" },\t\t\t\t\\\n\t{ IFM_IEEE80211_DS512k, \"DirectSequence/512Kbps\" },\t\t\\\n\t{ IFM_IEEE80211_OFDM3, \"OFDM3\" },\t\t\t\t\\\n\t{ IFM_IEEE80211_OFDM4, \"OFDM4.5\" },\t\t\t\t\\\n\t{ IFM_IEEE80211_OFDM27, \"OFDM27\" },\t\t\t\t\\\n\t{ IFM_IEEE80211_MCS, \"MCS\" },\t\t\t\t\t\\\n\t{ 0, NULL },\t\t\t\t\t\t\t\\\n}\n\n#define\tIFM_SUBTYPE_IEEE80211_OPTION_DESCRIPTIONS {\t\t\t\\\n\t{ IFM_IEEE80211_ADHOC, \"adhoc\" },\t\t\t\t\\\n\t{ IFM_IEEE80211_HOSTAP, \"hostap\" },\t\t\t\t\\\n\t{ IFM_IEEE80211_IBSS, \"ibss\" },\t\t\t\t\t\\\n\t{ IFM_IEEE80211_WDS, \"wds\" },\t\t\t\t\t\\\n\t{ IFM_IEEE80211_TURBO, \"turbo\" },\t\t\t\t\\\n\t{ IFM_IEEE80211_MONITOR, \"monitor\" },\t\t\t\t\\\n\t{ IFM_IEEE80211_MBSS, \"mesh\" },\t\t\t\t\t\\\n\t{ 0, NULL },\t\t\t\t\t\t\t\\\n}\n\n#define\tIFM_SUBTYPE_IEEE80211_MODE_DESCRIPTIONS {\t\t\t\\\n\t{ IFM_AUTO, \"autoselect\" },\t\t\t\t\t\\\n\t{ IFM_IEEE80211_11A, \"11a\" },\t\t\t\t\t\\\n\t{ IFM_IEEE80211_11B, \"11b\" },\t\t\t\t\t\\\n\t{ IFM_IEEE80211_11G, \"11g\" },\t\t\t\t\t\\\n\t{ IFM_IEEE80211_FH, \"fh\" },\t\t\t\t\t\\\n\t{ IFM_IEEE80211_11NA, \"11na\" },\t\t\t\t\t\\\n\t{ IFM_IEEE80211_11NG, \"11ng\" },\t\t\t\t\t\\\n\t{ 0, NULL },\t\t\t\t\t\t\t\\\n}\n\n#define\tIFM_SUBTYPE_IEEE80211_MODE_ALIASES {\t\t\t\t\\\n\t{ IFM_AUTO, \"auto\" },\t\t\t\t\t\t\\\n\t{ 0, NULL },\t\t\t\t\t\t\t\\\n}\n\n#define\tIFM_SUBTYPE_ATM_DESCRIPTIONS {\t\t\t\t\t\\\n\t{ IFM_ATM_UNKNOWN,\t\"Unknown\" },\t\t\t\t\\\n\t{ IFM_ATM_UTP_25,\t\"UTP/25.6MBit\" },\t\t\t\\\n\t{ IFM_ATM_TAXI_100,\t\"Taxi/100MBit\" },\t\t\t\\\n\t{ IFM_ATM_TAXI_140,\t\"Taxi/140MBit\" },\t\t\t\\\n\t{ IFM_ATM_MM_155,\t\"Multi-mode/155MBit\" },\t\t\t\\\n\t{ IFM_ATM_SM_155,\t\"Single-mode/155MBit\" },\t\t\\\n\t{ IFM_ATM_UTP_155,\t\"UTP/155MBit\" },\t\t\t\\\n\t{ IFM_ATM_MM_622,\t\"Multi-mode/622MBit\" },\t\t\t\\\n\t{ IFM_ATM_SM_622,\t\"Single-mode/622MBit\" },\t\t\\\n\t{ IFM_ATM_VIRTUAL,\t\"Virtual\" },\t\t\t\t\\\n\t{ 0, NULL },\t\t\t\t\t\t\t\\\n}\n\n#define\tIFM_SUBTYPE_ATM_ALIASES {\t\t\t\t\t\\\n\t{ IFM_ATM_UNKNOWN,\t\"UNKNOWN\" },\t\t\t\t\\\n\t{ IFM_ATM_UTP_25,\t\"UTP-25\" },\t\t\t\t\\\n\t{ IFM_ATM_TAXI_100,\t\"TAXI-100\" },\t\t\t\t\\\n\t{ IFM_ATM_TAXI_140,\t\"TAXI-140\" },\t\t\t\t\\\n\t{ IFM_ATM_MM_155,\t\"MM-155\" },\t\t\t\t\\\n\t{ IFM_ATM_SM_155,\t\"SM-155\" },\t\t\t\t\\\n\t{ IFM_ATM_UTP_155,\t\"UTP-155\" },\t\t\t\t\\\n\t{ IFM_ATM_MM_622,\t\"MM-622\" },\t\t\t\t\\\n\t{ IFM_ATM_SM_622,\t\"SM-622\" },\t\t\t\t\\\n\t{ IFM_ATM_VIRTUAL,\t\"VIRTUAL\" },\t\t\t\t\\\n\t{ 0, NULL },\t\t\t\t\t\t\t\\\n}\n\n#define\tIFM_SUBTYPE_ATM_OPTION_DESCRIPTIONS {\t\t\t\t\\\n\t{ IFM_ATM_SDH, \"SDH\" },\t\t\t\t\t\t\\\n\t{ IFM_ATM_NOSCRAMB, \"Noscramb\" },\t\t\t\t\\\n\t{ IFM_ATM_UNASSIGNED, \"Unassigned\" },\t\t\t\t\\\n\t{ 0, NULL },\t\t\t\t\t\t\t\\\n}\n\n#define\tIFM_SUBTYPE_SHARED_DESCRIPTIONS {\t\t\t\t\\\n\t{ IFM_AUTO,\t\"autoselect\" },\t\t\t\t\t\\\n\t{ IFM_MANUAL,\t\"manual\" },\t\t\t\t\t\\\n\t{ IFM_NONE,\t\"none\" },\t\t\t\t\t\\\n\t{ 0, NULL },\t\t\t\t\t\t\t\\\n}\n\n#define\tIFM_SUBTYPE_SHARED_ALIASES {\t\t\t\t\t\\\n\t{ IFM_AUTO,\t\"auto\" },\t\t\t\t\t\\\n\t\t\t\t\t\t\t\t\t\\\n\t/*\t\t\t\t\t\t\t\t\\\n\t * Shorthands for common media+option combinations as announced\t\\\n\t * by miibus(4)\t\t\t\t\t\t\t\\\n\t */\t\t\t\t\t\t\t\t\\\n\t{ IFM_AUTO | IFM_FLOW,\t\"auto-flow\" },\t\t\t\t\\\n\t\t\t\t\t\t\t\t\t\\\n\t{ 0, NULL },\t\t\t\t\t\t\t\\\n}\n\n#define\tIFM_SHARED_OPTION_DESCRIPTIONS {\t\t\t\t\\\n\t{ IFM_FDX,\t\"full-duplex\" },\t\t\t\t\\\n\t{ IFM_HDX,\t\"half-duplex\" },\t\t\t\t\\\n\t{ IFM_FLOW,\t\"flowcontrol\" },\t\t\t\t\\\n\t{ IFM_FLAG0,\t\"flag0\" },\t\t\t\t\t\\\n\t{ IFM_FLAG1,\t\"flag1\" },\t\t\t\t\t\\\n\t{ IFM_FLAG2,\t\"flag2\" },\t\t\t\t\t\\\n\t{ IFM_LOOP,\t\"hw-loopback\" },\t\t\t\t\\\n\t{ 0, NULL },\t\t\t\t\t\t\t\\\n}\n\n#define\tIFM_SHARED_OPTION_ALIASES {\t\t\t\t\t\\\n\t{ IFM_FDX,\t\"fdx\" },\t\t\t\t\t\\\n\t{ IFM_HDX,\t\"hdx\" },\t\t\t\t\t\\\n\t{ IFM_FLOW,\t\"flow\" },\t\t\t\t\t\\\n\t{ IFM_LOOP,\t\"loop\" },\t\t\t\t\t\\\n\t{ IFM_LOOP,\t\"loopback\" },\t\t\t\t\t\\\n\t{ 0, NULL },\t\t\t\t\t\t\t\\\n}\n\n/*\n * Baudrate descriptions for the various media types.\n */\nstruct ifmedia_baudrate {\n\tint\t\tifmb_word;\t\t/* media word */\n\tuint64_t\tifmb_baudrate;\t\t/* corresponding baudrate */\n};\n\n#define\tIFM_BAUDRATE_DESCRIPTIONS {\t\t\t\t\t\\\n\t{ IFM_ETHER | IFM_10_T,\t\tIF_Mbps(10) },\t\t\t\\\n\t{ IFM_ETHER | IFM_10_2,\t\tIF_Mbps(10) },\t\t\t\\\n\t{ IFM_ETHER | IFM_10_5,\t\tIF_Mbps(10) },\t\t\t\\\n\t{ IFM_ETHER | IFM_100_TX,\tIF_Mbps(100) },\t\t\t\\\n\t{ IFM_ETHER | IFM_100_FX,\tIF_Mbps(100) },\t\t\t\\\n\t{ IFM_ETHER | IFM_100_T4,\tIF_Mbps(100) },\t\t\t\\\n\t{ IFM_ETHER | IFM_100_VG,\tIF_Mbps(100) },\t\t\t\\\n\t{ IFM_ETHER | IFM_100_T2,\tIF_Mbps(100) },\t\t\t\\\n\t{ IFM_ETHER | IFM_1000_SX,\tIF_Mbps(1000) },\t\t\\\n\t{ IFM_ETHER | IFM_10_STP,\tIF_Mbps(10) },\t\t\t\\\n\t{ IFM_ETHER | IFM_10_FL,\tIF_Mbps(10) },\t\t\t\\\n\t{ IFM_ETHER | IFM_1000_LX,\tIF_Mbps(1000) },\t\t\\\n\t{ IFM_ETHER | IFM_1000_CX,\tIF_Mbps(1000) },\t\t\\\n\t{ IFM_ETHER | IFM_1000_T,\tIF_Mbps(1000) },\t\t\\\n\t{ IFM_ETHER | IFM_HPNA_1,\tIF_Mbps(1) },\t\t\t\\\n\t{ IFM_ETHER | IFM_10G_LR,\tIF_Gbps(10ULL) },\t\t\\\n\t{ IFM_ETHER | IFM_10G_SR,\tIF_Gbps(10ULL) },\t\t\\\n\t{ IFM_ETHER | IFM_10G_CX4,\tIF_Gbps(10ULL) },\t\t\\\n\t{ IFM_ETHER | IFM_2500_SX,\tIF_Mbps(2500ULL) },\t\t\\\n\t{ IFM_ETHER | IFM_10G_TWINAX,\tIF_Gbps(10ULL) },\t\t\\\n\t{ IFM_ETHER | IFM_10G_TWINAX_LONG,\tIF_Gbps(10ULL) },\t\\\n\t{ IFM_ETHER | IFM_10G_LRM,\tIF_Gbps(10ULL) },\t\t\\\n\t{ IFM_ETHER | IFM_10G_T,\tIF_Gbps(10ULL) },\t\t\\\n\t\t\t\t\t\t\t\t\t\\\n\t{ IFM_TOKEN | IFM_TOK_STP4,\tIF_Mbps(4) },\t\t\t\\\n\t{ IFM_TOKEN | IFM_TOK_STP16,\tIF_Mbps(16) },\t\t\t\\\n\t{ IFM_TOKEN | IFM_TOK_UTP4,\tIF_Mbps(4) },\t\t\t\\\n\t{ IFM_TOKEN | IFM_TOK_UTP16,\tIF_Mbps(16) },\t\t\t\\\n\t\t\t\t\t\t\t\t\t\\\n\t{ IFM_FDDI | IFM_FDDI_SMF,\tIF_Mbps(100) },\t\t\t\\\n\t{ IFM_FDDI | IFM_FDDI_MMF,\tIF_Mbps(100) },\t\t\t\\\n\t{ IFM_FDDI | IFM_FDDI_UTP,\tIF_Mbps(100) },\t\t\t\\\n\t\t\t\t\t\t\t\t\t\\\n\t{ IFM_IEEE80211 | IFM_IEEE80211_FH1,\tIF_Mbps(1) },\t\t\\\n\t{ IFM_IEEE80211 | IFM_IEEE80211_FH2,\tIF_Mbps(2) },\t\t\\\n\t{ IFM_IEEE80211 | IFM_IEEE80211_DS2,\tIF_Mbps(2) },\t\t\\\n\t{ IFM_IEEE80211 | IFM_IEEE80211_DS5,\tIF_Kbps(5500) },\t\\\n\t{ IFM_IEEE80211 | IFM_IEEE80211_DS11,\tIF_Mbps(11) },\t\t\\\n\t{ IFM_IEEE80211 | IFM_IEEE80211_DS1,\tIF_Mbps(1) },\t\t\\\n\t{ IFM_IEEE80211 | IFM_IEEE80211_DS22,\tIF_Mbps(22) },\t\t\\\n\t{ IFM_IEEE80211 | IFM_IEEE80211_OFDM6,\tIF_Mbps(6) },\t\t\\\n\t{ IFM_IEEE80211 | IFM_IEEE80211_OFDM9,\tIF_Mbps(9) },\t\t\\\n\t{ IFM_IEEE80211 | IFM_IEEE80211_OFDM12,\tIF_Mbps(12) },\t\t\\\n\t{ IFM_IEEE80211 | IFM_IEEE80211_OFDM18,\tIF_Mbps(18) },\t\t\\\n\t{ IFM_IEEE80211 | IFM_IEEE80211_OFDM24,\tIF_Mbps(24) },\t\t\\\n\t{ IFM_IEEE80211 | IFM_IEEE80211_OFDM36,\tIF_Mbps(36) },\t\t\\\n\t{ IFM_IEEE80211 | IFM_IEEE80211_OFDM48,\tIF_Mbps(48) },\t\t\\\n\t{ IFM_IEEE80211 | IFM_IEEE80211_OFDM54,\tIF_Mbps(54) },\t\t\\\n\t{ IFM_IEEE80211 | IFM_IEEE80211_OFDM72,\tIF_Mbps(72) },\t\t\\\n\t\t\t\t\t\t\t\t\t\\\n\t{ 0, 0 },\t\t\t\t\t\t\t\\\n}\n\n/*\n * Status descriptions for the various media types.\n */\nstruct ifmedia_status_description {\n\tint\t   ifms_type;\n\tint\t   ifms_valid;\n\tint\t   ifms_bit;\n\tconst char *ifms_string[2];\n};\n\n#define\tIFM_STATUS_DESC(ifms, bit)\t\t\t\t\t\\\n\t(ifms)->ifms_string[((ifms)->ifms_bit & (bit)) ? 1 : 0]\n\n#define\tIFM_STATUS_DESCRIPTIONS {\t\t\t\t\t\\\n\t{ IFM_ETHER,\t\tIFM_AVALID,\tIFM_ACTIVE,\t\t\\\n\t    { \"no carrier\", \"active\" } },\t\t\t\t\\\n\t{ IFM_FDDI,\t\tIFM_AVALID,\tIFM_ACTIVE,\t\t\\\n\t    { \"no ring\", \"inserted\" } },\t\t\t\t\\\n\t{ IFM_TOKEN,\t\tIFM_AVALID,\tIFM_ACTIVE,\t\t\\\n\t    { \"no ring\", \"inserted\" } },\t\t\t\t\\\n\t{ IFM_IEEE80211,\tIFM_AVALID,\tIFM_ACTIVE,\t\t\\\n\t    { \"no network\", \"active\" } },\t\t\t\t\\\n\t{ IFM_ATM,\t\tIFM_AVALID,\tIFM_ACTIVE,\t\t\\\n\t    { \"no network\", \"active\" } },\t\t\t\t\\\n\t{ IFM_CARP,\t\tIFM_AVALID,\tIFM_ACTIVE,\t\t\\\n\t    { \"backup\", \"master\" } },\t\t\t\t\t\\\n\t{ 0,\t\t\t0,\t\t0,\t\t\t\\\n\t    { NULL, NULL } }\t\t\t\t\t\t\\\n}\n#endif\t/* _NET_IF_MEDIA_H_ */\n"
  },
  {
    "path": "freebsd-headers/net/if_mib.h",
    "content": "/*-\n * Copyright 1996 Massachusetts Institute of Technology\n *\n * Permission to use, copy, modify, and distribute this software and\n * its documentation for any purpose and without fee is hereby\n * granted, provided that both the above copyright notice and this\n * permission notice appear in all copies, that both the above\n * copyright notice and this permission notice appear in all\n * supporting documentation, and that the name of M.I.T. not be used\n * in advertising or publicity pertaining to distribution of the\n * software without specific, written prior permission.  M.I.T. makes\n * no representations about the suitability of this software for any\n * purpose.  It is provided \"as is\" without express or implied\n * warranty.\n * \n * THIS SOFTWARE IS PROVIDED BY M.I.T. ``AS IS''.  M.I.T. DISCLAIMS\n * ALL EXPRESS OR IMPLIED WARRANTIES WITH REGARD TO THIS SOFTWARE,\n * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF\n * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT\n * SHALL M.I.T. BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF\n * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\n * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,\n * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT\n * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/net/if_mib.h 154023 2006-01-04 12:57:09Z harti $\n */\n\n#ifndef _NET_IF_MIB_H\n#define\t_NET_IF_MIB_H\t1\n\nstruct ifmibdata {\n\tchar\tifmd_name[IFNAMSIZ]; /* name of interface */\n\tint\tifmd_pcount;\t/* number of promiscuous listeners */\n\tint\tifmd_flags;\t/* interface flags */\n\tint\tifmd_snd_len;\t/* instantaneous length of send queue */\n\tint\tifmd_snd_maxlen; /* maximum length of send queue */\n\tint\tifmd_snd_drops;\t/* number of drops in send queue */\n\tint\tifmd_filler[4];\t/* for future expansion */\n\tstruct\tif_data ifmd_data; /* generic information and statistics */\n};\n\n/*\n * sysctl MIB tags at the net.link.generic level\n */\n#define\tIFMIB_SYSTEM\t1\t/* non-interface-specific */\n#define\tIFMIB_IFDATA\t2\t/* per-interface data table */\n\n/*\n * MIB tags for the various net.link.generic.ifdata tables\n */\n#define\tIFDATA_GENERAL\t1\t/* generic stats for all kinds of ifaces */\n#define\tIFDATA_LINKSPECIFIC\t2 /* specific to the type of interface */\n#define\tIFDATA_DRIVERNAME\t3 /* driver name and unit */\n\n/*\n * MIB tags at the net.link.generic.system level\n */\n#define\tIFMIB_IFCOUNT\t1\t/* number of interfaces configured */\n\n/*\n * MIB tags as the net.link level\n * All of the other values are IFT_* names defined in if_types.h.\n */\n#define\tNETLINK_GENERIC\t0\t/* functions not specific to a type of iface */\n\n/*\n * The reason why the IFDATA_LINKSPECIFIC stuff is not under the\n * net.link.<iftype> branches is twofold:\n *   1) It's easier to code this way, and doesn't require duplication.\n *   2) The fourth level under net.link.<iftype> is <pf>; that is to say,\n *\tthe net.link.<iftype> tree instruments the adaptation layers between\n *\t<iftype> and a particular protocol family (e.g., net.link.ether.inet\n *\tinstruments ARP).  This does not really leave room for anything else\n *\tthat needs to have a well-known number.\n */\n\n/*\n * Link-specific MIB structures for various link types.\n */\n\n/* For IFT_ETHER, IFT_ISO88023, and IFT_STARLAN, as used by RFC 1650 */\nstruct ifmib_iso_8802_3 {\n\tu_int32_t\tdot3StatsAlignmentErrors;\n\tu_int32_t\tdot3StatsFCSErrors;\n\tu_int32_t\tdot3StatsSingleCollisionFrames;\n\tu_int32_t\tdot3StatsMultipleCollisionFrames;\n\tu_int32_t\tdot3StatsSQETestErrors;\n\tu_int32_t\tdot3StatsDeferredTransmissions;\n\tu_int32_t\tdot3StatsLateCollisions;\n\tu_int32_t\tdot3StatsExcessiveCollisions;\n\tu_int32_t\tdot3StatsInternalMacTransmitErrors;\n\tu_int32_t\tdot3StatsCarrierSenseErrors;\n\tu_int32_t\tdot3StatsFrameTooLongs;\n\tu_int32_t\tdot3StatsInternalMacReceiveErrors;\n\tu_int32_t\tdot3StatsEtherChipSet;\n\t/* Matt Thomas wants this one, not included in RFC 1650: */\n\tu_int32_t\tdot3StatsMissedFrames;\n\n\tu_int32_t\tdot3StatsCollFrequencies[16]; /* NB: index origin */\n\n\tu_int32_t\tdot3Compliance;\n#define\tDOT3COMPLIANCE_STATS\t1\n#define\tDOT3COMPLIANCE_COLLS\t2\n};\n\n/*\n * Chipset identifiers are normally part of the vendor's enterprise MIB.\n * However, we don't want to be trying to represent arbitrary-length\n * OBJECT IDENTIFIERs here (ick!), and the right value is not necessarily\n * obvious to the driver implementor.  So, we define our own identification\n * mechanism here, and let the agent writer deal with the translation.\n */\n#define\tDOT3CHIPSET_VENDOR(x)\t((x) >> 16)\n#define\tDOT3CHIPSET_PART(x)\t((x) & 0xffff)\n#define\tDOT3CHIPSET(v,p)\t(((v) << 16) + ((p) & 0xffff))\n\n/* Driver writers!  Add your vendors here! */\nenum dot3Vendors {\n\tdot3VendorAMD = 1,\n\tdot3VendorIntel = 2,\n\tdot3VendorNational = 4,\n\tdot3VendorFujitsu = 5,\n\tdot3VendorDigital = 6,\n\tdot3VendorWesternDigital = 7\n};\n\n/* Driver writers!  Add your chipsets here! */\nenum {\n\tdot3ChipSetAMD7990 = 1,\n\tdot3ChipSetAMD79900 = 2,\n\tdot3ChipSetAMD79C940 = 3\n};\n\nenum {\n\tdot3ChipSetIntel82586 = 1,\n\tdot3ChipSetIntel82596 = 2,\n\tdot3ChipSetIntel82557 = 3\n};\n\nenum {\n\tdot3ChipSetNational8390 = 1,\n\tdot3ChipSetNationalSonic = 2\n};\n\nenum {\n\tdot3ChipSetFujitsu86950 = 1\n};\n\nenum {\n\tdot3ChipSetDigitalDC21040 = 1,\n\tdot3ChipSetDigitalDC21140 = 2,\n\tdot3ChipSetDigitalDC21041 = 3,\n\tdot3ChipSetDigitalDC21140A = 4,\n\tdot3ChipSetDigitalDC21142 = 5\n};\n\nenum {\n\tdot3ChipSetWesternDigital83C690 = 1,\n\tdot3ChipSetWesternDigital83C790 = 2\n};\n/* END of Ethernet-link MIB stuff */\n\n/*\n * Put other types of interface MIBs here, or in interface-specific\n * header files if convenient ones already exist.\n */\n#endif /* _NET_IF_MIB_H */\n"
  },
  {
    "path": "freebsd-headers/net/if_pflog.h",
    "content": "/* $OpenBSD: if_pflog.h,v 1.13 2006/10/23 12:46:09 henning Exp $ */\n/*\n * Copyright 2001 Niels Provos <provos@citi.umich.edu>\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR\n * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES\n * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,\n * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF\n * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n */\n\n#ifndef _NET_IF_PFLOG_H_\n#define\t_NET_IF_PFLOG_H_\n\n#define\tPFLOGIFS_MAX\t16\n\nstruct pflog_softc {\n#ifdef __FreeBSD__\n\tstruct ifnet\t\t*sc_ifp;\t/* the interface pointer */\n#else\n\tstruct ifnet\t\tsc_if;\t\t/* the interface */\n#endif\n\tint\t\t\tsc_unit;\n\tLIST_ENTRY(pflog_softc)\tsc_list;\n};\n\n#define\tPFLOG_RULESET_NAME_SIZE\t16\n\nstruct pfloghdr {\n\tu_int8_t\tlength;\n\tsa_family_t\taf;\n\tu_int8_t\taction;\n\tu_int8_t\treason;\n\tchar\t\tifname[IFNAMSIZ];\n\tchar\t\truleset[PFLOG_RULESET_NAME_SIZE];\n\tu_int32_t\trulenr;\n\tu_int32_t\tsubrulenr;\n\tuid_t\t\tuid;\n\tpid_t\t\tpid;\n\tuid_t\t\trule_uid;\n\tpid_t\t\trule_pid;\n\tu_int8_t\tdir;\n\tu_int8_t\tpad[3];\n};\n\n#define\tPFLOG_HDRLEN\t\tsizeof(struct pfloghdr)\n/* minus pad, also used as a signature */\n#define\tPFLOG_REAL_HDRLEN\toffsetof(struct pfloghdr, pad)\n\n/* XXX remove later when old format logs are no longer needed */\nstruct old_pfloghdr {\n\tu_int32_t af;\n\tchar ifname[IFNAMSIZ];\n\tshort rnr;\n\tu_short reason;\n\tu_short action;\n\tu_short dir;\n};\n#define\tOLD_PFLOG_HDRLEN\tsizeof(struct old_pfloghdr)\n\n#ifdef _KERNEL\n#ifdef __FreeBSD__\nstruct pf_rule;\nstruct pf_ruleset;\nstruct pfi_kif;\nstruct pf_pdesc;\n\n#if 0\ntypedef int pflog_packet_t(struct pfi_kif *, struct mbuf *, sa_family_t,\n    u_int8_t, u_int8_t, struct pf_rule *, struct pf_rule *,\n    struct pf_ruleset *, struct pf_pdesc *);\nextern pflog_packet_t *pflog_packet_ptr;\n#endif\n#define\tPFLOG_PACKET(i,x,a,b,c,d,e,f,g,h) do {\t\t\\\n\tif (pflog_packet_ptr != NULL)\t\t\t\\\n\t\tpflog_packet_ptr(i,a,b,c,d,e,f,g,h);    \\\n} while (0)\n#else /* ! __FreeBSD__ */\n#if NPFLOG > 0\n#define\tPFLOG_PACKET(i,x,a,b,c,d,e,f,g,h) pflog_packet(i,a,b,c,d,e,f,g,h)\n#else\n#define\tPFLOG_PACKET(i,x,a,b,c,d,e,f,g,h) ((void)0)\n#endif /* NPFLOG > 0 */\n#endif\n#endif /* _KERNEL */\n#endif /* _NET_IF_PFLOG_H_ */\n"
  },
  {
    "path": "freebsd-headers/net/if_pflow.h",
    "content": "/*\t$OpenBSD: if_pflow.h,v 1.5 2009/02/27 11:09:36 gollo Exp $\t*/\n\n/*\n * Copyright (c) 2008 Henning Brauer <henning@openbsd.org>\n * Copyright (c) 2008 Joerg Goltermann <jg@osn.de>\n *\n * Permission to use, copy, modify, and distribute this software for any\n * purpose with or without fee is hereby granted, provided that the above\n * copyright notice and this permission notice appear in all copies.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES\n * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF\n * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR\n * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES\n * WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER IN\n * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT\n * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.\n *\n * $FreeBSD: release/9.0.0/sys/contrib/pf/net/if_pflow.h 223637 2011-06-28 11:57:25Z bz $\n */\n\n#ifndef _NET_IF_PFLOW_H_\n#define\t_NET_IF_PFLOW_H_\n\n#define\tPFLOW_ID_LEN\tsizeof(u_int64_t)\n\n#define\tPFLOW_MAXFLOWS 30\n#define\tPFLOW_VERSION 5\n#define\tPFLOW_ENGINE_TYPE 42\n#define\tPFLOW_ENGINE_ID 42\n#define\tPFLOW_MAXBYTES 0xffffffff\n#define\tPFLOW_TIMEOUT 30\n\nstruct pflow_flow {\n\tu_int32_t\tsrc_ip;\n\tu_int32_t\tdest_ip;\n\tu_int32_t\tnexthop_ip;\n\tu_int16_t\tif_index_in;\n\tu_int16_t\tif_index_out;\n\tu_int32_t\tflow_packets;\n\tu_int32_t\tflow_octets;\n\tu_int32_t\tflow_start;\n\tu_int32_t\tflow_finish;\n\tu_int16_t\tsrc_port;\n\tu_int16_t\tdest_port;\n\tu_int8_t\tpad1;\n\tu_int8_t\ttcp_flags;\n\tu_int8_t\tprotocol;\n\tu_int8_t\ttos;\n\tu_int16_t\tsrc_as;\n\tu_int16_t\tdest_as;\n\tu_int8_t\tsrc_mask;\n\tu_int8_t\tdest_mask;\n\tu_int16_t\tpad2;\n} __packed;\n\n#ifdef _KERNEL\n\nextern int pflow_ok;\n\nstruct pflow_softc {\n\tstruct ifnet\t\t sc_if;\n\tstruct ifnet\t\t*sc_pflow_ifp;\n\n\tunsigned int\t\t sc_count;\n\tunsigned int\t\t sc_maxcount;\n\tu_int64_t\t\t sc_gcounter;\n\tstruct ip_moptions\t sc_imo;\n#ifdef __FreeBSD__\n\tstruct callout\t\t sc_tmo;\n#else\n\tstruct timeout\t\t sc_tmo;\n#endif\n\tstruct in_addr\t\t sc_sender_ip;\n\tu_int16_t\t\t sc_sender_port;\n\tstruct in_addr\t\t sc_receiver_ip;\n\tu_int16_t\t\t sc_receiver_port;\n\tstruct mbuf\t\t*sc_mbuf;\t/* current cumulative mbuf */\n\tSLIST_ENTRY(pflow_softc) sc_next;\n};\n\nextern struct pflow_softc\t*pflowif;\n\n#endif /* _KERNEL */\n\nstruct pflow_header {\n\tu_int16_t\tversion;\n\tu_int16_t\tcount;\n\tu_int32_t\tuptime_ms;\n\tu_int32_t\ttime_sec;\n\tu_int32_t\ttime_nanosec;\n\tu_int32_t\tflow_sequence;\n\tu_int8_t\tengine_type;\n\tu_int8_t\tengine_id;\n\tu_int8_t\treserved1;\n\tu_int8_t\treserved2;\n} __packed;\n\n#define\tPFLOW_HDRLEN sizeof(struct pflow_header)\n\nstruct pflowstats {\n\tu_int64_t\tpflow_flows;\n\tu_int64_t\tpflow_packets;\n\tu_int64_t\tpflow_onomem;\n\tu_int64_t\tpflow_oerrors;\n};\n\n/*\n * Configuration structure for SIOCSETPFLOW SIOCGETPFLOW\n */\nstruct pflowreq {\n\tstruct in_addr\t\tsender_ip;\n\tstruct in_addr\t\treceiver_ip;\n\tu_int16_t\t\treceiver_port;\n\tu_int16_t\t\taddrmask;\n#define\tPFLOW_MASK_SRCIP\t0x01\n#define\tPFLOW_MASK_DSTIP\t0x02\n#define\tPFLOW_MASK_DSTPRT\t0x04\n};\n\n#ifdef _KERNEL\nint export_pflow(struct pf_state *);\nint pflow_sysctl(int *, u_int,  void *, size_t *, void *, size_t);\n#endif /* _KERNEL */\n\n#endif /* _NET_IF_PFLOW_H_ */\n"
  },
  {
    "path": "freebsd-headers/net/if_pfsync.h",
    "content": "/*\t$OpenBSD: if_pfsync.h,v 1.35 2008/06/29 08:42:15 mcbride Exp $\t*/\n\n/*\n * Copyright (c) 2001 Michael Shalayeff\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR\n * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES\n * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE AUTHOR OR HIS RELATIVES BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR\n * SERVICES; LOSS OF MIND, USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,\n * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING\n * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF\n * THE POSSIBILITY OF SUCH DAMAGE.\n */\n\n/*\n * Copyright (c) 2008 David Gwynne <dlg@openbsd.org>\n *\n * Permission to use, copy, modify, and distribute this software for any\n * purpose with or without fee is hereby granted, provided that the above\n * copyright notice and this permission notice appear in all copies.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES\n * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF\n * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR\n * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES\n * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN\n * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF\n * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.\n */\n\n#ifndef _NET_IF_PFSYNC_H_\n#define\t_NET_IF_PFSYNC_H_\n\n#define\tPFSYNC_VERSION\t\t5\n#define\tPFSYNC_DFLTTL\t\t255\n\n#define\tPFSYNC_ACT_CLR\t\t0\t/* clear all states */\n#define\tPFSYNC_ACT_INS\t\t1\t/* insert state */\n#define\tPFSYNC_ACT_INS_ACK\t2\t/* ack of insterted state */\n#define\tPFSYNC_ACT_UPD\t\t3\t/* update state */\n#define\tPFSYNC_ACT_UPD_C\t4\t/* \"compressed\" update state */\n#define\tPFSYNC_ACT_UPD_REQ\t5\t/* request \"uncompressed\" state */\n#define\tPFSYNC_ACT_DEL\t\t6\t/* delete state */\n#define\tPFSYNC_ACT_DEL_C\t7\t/* \"compressed\" delete state */\n#define\tPFSYNC_ACT_INS_F\t8\t/* insert fragment */\n#define\tPFSYNC_ACT_DEL_F\t9\t/* delete fragments */\n#define\tPFSYNC_ACT_BUS\t\t10\t/* bulk update status */\n#define\tPFSYNC_ACT_TDB\t\t11\t/* TDB replay counter update */\n#define\tPFSYNC_ACT_EOF\t\t12\t/* end of frame */\n#define\tPFSYNC_ACT_MAX\t\t13\n\n#define\tPFSYNC_ACTIONS\t\t\"CLR ST\",\t\t\\\n\t\t\t\t\"INS ST\",\t\t\\\n\t\t\t\t\"INS ST ACK\",\t\t\\\n\t\t\t\t\"UPD ST\",\t\t\\\n\t\t\t\t\"UPD ST COMP\",\t\t\\\n\t\t\t\t\"UPD ST REQ\",\t\t\\\n\t\t\t\t\"DEL ST\",\t\t\\\n\t\t\t\t\"DEL ST COMP\",\t\t\\\n\t\t\t\t\"INS FR\",\t\t\\\n\t\t\t\t\"DEL FR\",\t\t\\\n\t\t\t\t\"BULK UPD STAT\",\t\\\n\t\t\t\t\"TDB UPD\",\t\t\\\n\t\t\t\t\"EOF\"\n\n#define\tPFSYNC_HMAC_LEN\t20\n\n/*\n * A pfsync frame is built from a header followed by several sections which\n * are all prefixed with their own subheaders. Frames must be terminated with\n * an EOF subheader.\n *\n * | ...\t\t\t|\n * | IP header\t\t\t|\n * +============================+\n * | pfsync_header\t\t|\n * +----------------------------+\n * | pfsync_subheader\t\t|\n * +----------------------------+\n * | first action fields\t|\n * | ...\t\t\t|\n * +----------------------------+\n * | pfsync_subheader\t\t|\n * +----------------------------+\n * | second action fields\t|\n * | ...\t\t\t|\n * +----------------------------+\n * | EOF pfsync_subheader\t|\n * +----------------------------+\n * | HMAC\t\t\t|\n * +============================+\n */\n\n/*\n * Frame header\n */\n\nstruct pfsync_header {\n\tu_int8_t\t\t\tversion;\n\tu_int8_t\t\t\t_pad;\n\tu_int16_t\t\t\tlen;\n\tu_int8_t\t\t\tpfcksum[PF_MD5_DIGEST_LENGTH];\n} __packed;\n\n/*\n * Frame region subheader\n */\n\nstruct pfsync_subheader {\n\tu_int8_t\t\t\taction;\n\tu_int8_t\t\t\t_pad;\n\tu_int16_t\t\t\tcount;\n} __packed;\n\n/*\n * CLR\n */\n\nstruct pfsync_clr {\n\tchar\t\t\t\tifname[IFNAMSIZ];\n\tu_int32_t\t\t\tcreatorid;\n} __packed;\n\n/*\n * INS, UPD, DEL\n */\n\n/* these use struct pfsync_state in pfvar.h */\n\n/*\n * INS_ACK\n */\n\nstruct pfsync_ins_ack {\n\tu_int64_t\t\t\tid;\n\tu_int32_t\t\t\tcreatorid;\n} __packed;\n\n/*\n * UPD_C\n */\n\nstruct pfsync_upd_c {\n\tu_int64_t\t\t\tid;\n\tstruct pfsync_state_peer\tsrc;\n\tstruct pfsync_state_peer\tdst;\n\tu_int32_t\t\t\tcreatorid;\n\tu_int32_t\t\t\texpire;\n\tu_int8_t\t\t\ttimeout;\n\tu_int8_t\t\t\t_pad[3];\n} __packed;\n\n/*\n * UPD_REQ\n */\n\nstruct pfsync_upd_req {\n\tu_int64_t\t\t\tid;\n\tu_int32_t\t\t\tcreatorid;\n} __packed;\n\n/*\n * DEL_C\n */\n\nstruct pfsync_del_c {\n\tu_int64_t\t\t\tid;\n\tu_int32_t\t\t\tcreatorid;\n} __packed;\n\n/* \n * INS_F, DEL_F\n */\n\n/* not implemented (yet) */\n\n/*\n * BUS\n */\n\nstruct pfsync_bus {\n\tu_int32_t\t\t\tcreatorid;\n\tu_int32_t\t\t\tendtime;\n\tu_int8_t\t\t\tstatus;\n#define\tPFSYNC_BUS_START\t\t\t1\n#define\tPFSYNC_BUS_END\t\t\t\t2\n\tu_int8_t\t\t\t_pad[3];\n} __packed;\n\n/*\n * TDB\n */\n\nstruct pfsync_tdb {\n\tu_int32_t\t\t\tspi;\n\tunion sockaddr_union\t\tdst;\n\tu_int32_t\t\t\trpl;\n\tu_int64_t\t\t\tcur_bytes;\n\tu_int8_t\t\t\tsproto;\n\tu_int8_t\t\t\tupdates;\n\tu_int8_t\t\t\t_pad[2];\n} __packed;\n\n/*\n * EOF\n */\n\nstruct pfsync_eof {\n\tu_int8_t\t\t\thmac[PFSYNC_HMAC_LEN];\n} __packed;\n\n#define\tPFSYNC_HDRLEN\t\tsizeof(struct pfsync_header)\n\n\n\n/*\n * Names for PFSYNC sysctl objects\n */\n#define\tPFSYNCCTL_STATS\t\t1\t/* PFSYNC stats */\n#define\tPFSYNCCTL_MAXID\t\t2\n\n#define\tPFSYNCCTL_NAMES { \\\n\t{ 0, 0 }, \\\n\t{ \"stats\", CTLTYPE_STRUCT }, \\\n}\n\nstruct pfsyncstats {\n\tu_int64_t\tpfsyncs_ipackets;\t/* total input packets, IPv4 */\n\tu_int64_t\tpfsyncs_ipackets6;\t/* total input packets, IPv6 */\n\tu_int64_t\tpfsyncs_badif;\t\t/* not the right interface */\n\tu_int64_t\tpfsyncs_badttl;\t\t/* TTL is not PFSYNC_DFLTTL */\n\tu_int64_t\tpfsyncs_hdrops;\t\t/* packets shorter than hdr */\n\tu_int64_t\tpfsyncs_badver;\t\t/* bad (incl unsupp) version */\n\tu_int64_t\tpfsyncs_badact;\t\t/* bad action */\n\tu_int64_t\tpfsyncs_badlen;\t\t/* data length does not match */\n\tu_int64_t\tpfsyncs_badauth;\t/* bad authentication */\n\tu_int64_t\tpfsyncs_stale;\t\t/* stale state */\n\tu_int64_t\tpfsyncs_badval;\t\t/* bad values */\n\tu_int64_t\tpfsyncs_badstate;\t/* insert/lookup failed */\n\n\tu_int64_t\tpfsyncs_opackets;\t/* total output packets, IPv4 */\n\tu_int64_t\tpfsyncs_opackets6;\t/* total output packets, IPv6 */\n\tu_int64_t\tpfsyncs_onomem;\t\t/* no memory for an mbuf */\n\tu_int64_t\tpfsyncs_oerrors;\t/* ip output error */\n};\n\n/*\n * Configuration structure for SIOCSETPFSYNC SIOCGETPFSYNC\n */\nstruct pfsyncreq {\n\tchar\t\t pfsyncr_syncdev[IFNAMSIZ];\n\tstruct in_addr\t pfsyncr_syncpeer;\n\tint\t\t pfsyncr_maxupdates;\n\tint\t\t pfsyncr_authlevel;\n};\n\n#ifdef __FreeBSD__\n#define\tSIOCSETPFSYNC   _IOW('i', 247, struct ifreq)\n#define\tSIOCGETPFSYNC   _IOWR('i', 248, struct ifreq)\n#endif\n\n#ifdef _KERNEL\n\n/*\n * this shows where a pf state is with respect to the syncing.\n */\n#define\tPFSYNC_S_INS\t0x00\n#define\tPFSYNC_S_IACK\t0x01\n#define\tPFSYNC_S_UPD\t0x02\n#define\tPFSYNC_S_UPD_C\t0x03\n#define\tPFSYNC_S_DEL\t0x04\n#define\tPFSYNC_S_COUNT\t0x05\n\n#define\tPFSYNC_S_DEFER\t0xfe\n#define\tPFSYNC_S_NONE\t0xff\n\n#ifdef __FreeBSD__\nvoid\t\t\tpfsync_input(struct mbuf *, __unused int);\n#else\nvoid\t\t\tpfsync_input(struct mbuf *, ...);\n#endif\nint\t\t\tpfsync_sysctl(int *, u_int,  void *, size_t *,\n\t\t\t    void *, size_t);\n\n#define\tPFSYNC_SI_IOCTL\t\t0x01\n#define\tPFSYNC_SI_CKSUM\t\t0x02\n#define\tPFSYNC_SI_ACK\t\t0x04\nint\t\t\tpfsync_state_import(struct pfsync_state *, u_int8_t);\n#ifndef __FreeBSD__\nvoid\t\t\tpfsync_state_export(struct pfsync_state *,\n\t\t\t    struct pf_state *);\n#endif\n\nvoid\t\t\tpfsync_insert_state(struct pf_state *);\nvoid\t\t\tpfsync_update_state(struct pf_state *);\nvoid\t\t\tpfsync_delete_state(struct pf_state *);\nvoid\t\t\tpfsync_clear_states(u_int32_t, const char *);\n\n#ifdef notyet\nvoid\t\t\tpfsync_update_tdb(struct tdb *, int);\nvoid\t\t\tpfsync_delete_tdb(struct tdb *);\n#endif\n\nint\t\t\tpfsync_defer(struct pf_state *, struct mbuf *);\n\nint\t\t\tpfsync_up(void);\nint\t\t\tpfsync_state_in_use(struct pf_state *);\n#endif\n\n#endif /* _NET_IF_PFSYNC_H_ */\n"
  },
  {
    "path": "freebsd-headers/net/if_sppp.h",
    "content": "/*\n * Defines for synchronous PPP/Cisco/Frame Relay link level subroutines.\n */\n/*-\n * Copyright (C) 1994-2000 Cronyx Engineering.\n * Author: Serge Vakulenko, <vak@cronyx.ru>\n *\n * Heavily revamped to conform to RFC 1661.\n * Copyright (C) 1997, Joerg Wunsch.\n *\n * This software is distributed with NO WARRANTIES, not even the implied\n * warranties for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n *\n * Authors grant any other persons or organizations permission to use\n * or modify this software as long as this message is kept with the software,\n * all derivative works or modified versions.\n *\n * From: Version 2.0, Fri Oct  6 20:39:21 MSK 1995\n *\n * $FreeBSD: release/9.0.0/sys/net/if_sppp.h 147256 2005-06-10 16:49:24Z brooks $\n */\n\n#ifndef _NET_IF_SPPP_H_\n#define _NET_IF_SPPP_H_ 1\n\n#define IDX_LCP 0\t\t/* idx into state table */\n\nstruct slcp {\n\tu_long\topts;\t\t/* LCP options to send (bitfield) */\n\tu_long  magic;          /* local magic number */\n\tu_long\tmru;\t\t/* our max receive unit */\n\tu_long\ttheir_mru;\t/* their max receive unit */\n\tu_long\tprotos;\t\t/* bitmask of protos that are started */\n\tu_char  echoid;         /* id of last keepalive echo request */\n\t/* restart max values, see RFC 1661 */\n\tint\ttimeout;\n\tint\tmax_terminate;\n\tint\tmax_configure;\n\tint\tmax_failure;\n};\n\n#define IDX_IPCP 1\t\t/* idx into state table */\n#define IDX_IPV6CP 2\t\t/* idx into state table */\n\nstruct sipcp {\n\tu_long\topts;\t\t/* IPCP options to send (bitfield) */\n\tu_int\tflags;\n#define IPCP_HISADDR_SEEN 1\t/* have seen his address already */\n#define IPCP_MYADDR_DYN   2\t/* my address is dynamically assigned */\n#define IPCP_MYADDR_SEEN  4\t/* have seen his address already */\n#ifdef notdef\n#define IPV6CP_MYIFID_DYN 8\t/* my ifid is dynamically assigned */\n#endif\n#define IPV6CP_MYIFID_SEEN 0x10\t/* have seen his ifid already */\n#define IPCP_VJ\t\t0x20\t/* can use VJ compression */\n\tint\tmax_state;\t/* VJ: Max-Slot-Id */\n\tint\tcompress_cid;\t/* VJ: Comp-Slot-Id */\n};\n\n#define AUTHNAMELEN\t64\n#define AUTHKEYLEN\t16\n\nstruct sauth {\n\tu_short\tproto;\t\t\t/* authentication protocol to use */\n\tu_short\tflags;\n#define AUTHFLAG_NOCALLOUT\t1\t/* do not require authentication on */\n\t\t\t\t\t/* callouts */\n#define AUTHFLAG_NORECHALLENGE\t2\t/* do not re-challenge CHAP */\n\tu_char\tname[AUTHNAMELEN];\t/* system identification name */\n\tu_char\tsecret[AUTHKEYLEN];\t/* secret password */\n\tu_char\tchallenge[AUTHKEYLEN];\t/* random challenge */\n};\n\n#define IDX_PAP\t\t3\n#define IDX_CHAP\t4\n\n#define IDX_COUNT (IDX_CHAP + 1) /* bump this when adding cp's! */\n\n/*\n * Don't change the order of this.  Ordering the phases this way allows\n * for a comparision of ``pp_phase >= PHASE_AUTHENTICATE'' in order to\n * know whether LCP is up.\n */\nenum ppp_phase {\n\tPHASE_DEAD, PHASE_ESTABLISH, PHASE_TERMINATE,\n\tPHASE_AUTHENTICATE, PHASE_NETWORK\n};\n\n#define PP_MTU          1500    /* default/minimal MRU */\n#define PP_MAX_MRU\t2048\t/* maximal MRU we want to negotiate */\n\n/*\n * This is a cut down struct sppp (see below) that can easily be\n * exported to/ imported from userland without the need to include\n * dozens of kernel-internal header files.  It is used by the\n * SPPPIO[GS]DEFS ioctl commands below.\n */\nstruct sppp_parms {\n\tenum ppp_phase pp_phase;\t/* phase we're currently in */\n\tint\tenable_vj;\t\t/* VJ header compression enabled */\n\tint\tenable_ipv6;\t\t/*\n\t\t\t\t\t * Enable IPv6 negotiations -- only\n\t\t\t\t\t * needed since each IPv4 i/f auto-\n\t\t\t\t\t * matically gets an IPv6 address\n\t\t\t\t\t * assigned, so we can't use this as\n\t\t\t\t\t * a decision.\n\t\t\t\t\t */\n\tstruct slcp lcp;\t\t/* LCP params */\n\tstruct sipcp ipcp;\t\t/* IPCP params */\n\tstruct sipcp ipv6cp;\t\t/* IPv6CP params */\n\tstruct sauth myauth;\t\t/* auth params, i'm peer */\n\tstruct sauth hisauth;\t\t/* auth params, i'm authenticator */\n};\n\n/*\n * Definitions to pass struct sppp_parms data down into the kernel\n * using the SIOC[SG]IFGENERIC ioctl interface.\n *\n * In order to use this, create a struct spppreq, fill in the cmd\n * field with SPPPIOGDEFS, and put the address of this structure into\n * the ifr_data portion of a struct ifreq.  Pass this struct to a\n * SIOCGIFGENERIC ioctl.  Then replace the cmd field by SPPPIOSDEFS,\n * modify the defs field as desired, and pass the struct ifreq now\n * to a SIOCSIFGENERIC ioctl.\n */\n\n#define SPPPIOGDEFS  ((caddr_t)(('S' << 24) + (1 << 16) +\\\n\tsizeof(struct sppp_parms)))\n#define SPPPIOSDEFS  ((caddr_t)(('S' << 24) + (2 << 16) +\\\n\tsizeof(struct sppp_parms)))\n\nstruct spppreq {\n\tint\tcmd;\n\tstruct sppp_parms defs;\n};\n\n#ifdef _KERNEL\nstruct sppp {\n\tstruct  ifnet *pp_ifp;    /* network interface data */\n\tstruct  ifqueue pp_fastq; /* fast output queue */\n\tstruct\tifqueue pp_cpq;\t/* PPP control protocol queue */\n\tstruct  sppp *pp_next;  /* next interface in keepalive list */\n\tu_int   pp_mode;        /* major protocol modes (cisco/ppp/...) */\n\tu_int   pp_flags;       /* sub modes */\n\tu_short pp_alivecnt;    /* keepalive packets counter */\n\tu_short pp_loopcnt;     /* loopback detection counter */\n\tu_long  pp_seq[IDX_COUNT];\t/* local sequence number */\n\tu_long  pp_rseq[IDX_COUNT];\t/* remote sequence number */\n\tenum ppp_phase pp_phase;\t/* phase we're currently in */\n\tint\tstate[IDX_COUNT];\t/* state machine */\n\tu_char  confid[IDX_COUNT];\t/* id of last configuration request */\n\tint\trst_counter[IDX_COUNT];\t/* restart counter */\n\tint\tfail_counter[IDX_COUNT]; /* negotiation failure counter */\n\tint\tconfflags;\t/* administrative configuration flags */\n#define CONF_ENABLE_VJ    0x01\t/* VJ header compression enabled */\n#define CONF_ENABLE_IPV6  0x02\t/* IPv6 administratively enabled */\n\ttime_t\tpp_last_recv;\t/* time last packet has been received */\n\ttime_t\tpp_last_sent;\t/* time last packet has been sent */\n\tstruct callout ch[IDX_COUNT];\t/* per-proto and if callouts */\n\tstruct callout pap_my_to_ch;\t/* PAP needs one more... */\n\tstruct callout keepalive_callout; /* keepalive callout */\n\tstruct slcp lcp;\t\t/* LCP params */\n\tstruct sipcp ipcp;\t\t/* IPCP params */\n\tstruct sipcp ipv6cp;\t\t/* IPv6CP params */\n\tstruct sauth myauth;\t\t/* auth params, i'm peer */\n\tstruct sauth hisauth;\t\t/* auth params, i'm authenticator */\n\tstruct slcompress *pp_comp;\t/* for VJ compression */\n\tu_short fr_dlci;\t\t/* Frame Relay DLCI number, 16..1023 */\n\tu_char fr_status;\t\t/* PVC status, active/new/delete */\n\t/*\n\t * These functions are filled in by sppp_attach(), and are\n\t * expected to be used by the lower layer (hardware) drivers\n\t * in order to communicate the (un)availability of the\n\t * communication link.  Lower layer drivers that are always\n\t * ready to communicate (like hardware HDLC) can shortcut\n\t * pp_up from pp_tls, and pp_down from pp_tlf.\n\t */\n\tvoid\t(*pp_up)(struct sppp *sp);\n\tvoid\t(*pp_down)(struct sppp *sp);\n\t/*\n\t * These functions need to be filled in by the lower layer\n\t * (hardware) drivers if they request notification from the\n\t * PPP layer whether the link is actually required.  They\n\t * correspond to the tls and tlf actions.\n\t */\n\tvoid\t(*pp_tls)(struct sppp *sp);\n\tvoid\t(*pp_tlf)(struct sppp *sp);\n\t/*\n\t * These (optional) functions may be filled by the hardware\n\t * driver if any notification of established connections\n\t * (currently: IPCP up) is desired (pp_con) or any internal\n\t * state change of the interface state machine should be\n\t * signaled for monitoring purposes (pp_chg).\n\t */\n\tvoid\t(*pp_con)(struct sppp *sp);\n\tvoid\t(*pp_chg)(struct sppp *sp, int new_state);\n\t/* These two fields are for use by the lower layer */\n\tvoid    *pp_lowerp;\n\tint     pp_loweri;\n\t/* Lock */\n\tstruct mtx\tmtx;\n\t/* if_start () wrapper */\n\tvoid\t(*if_start) (struct ifnet *);\n\tstruct callout ifstart_callout; /* if_start () scheduler */\n};\n#define IFP2SP(ifp)\t((struct sppp *)(ifp)->if_l2com)\n#define SP2IFP(sp)\t((sp)->pp_ifp)\n\n/* bits for pp_flags */\n#define PP_KEEPALIVE    0x01    /* use keepalive protocol */\n#define PP_FR\t\t0x04\t/* use Frame Relay protocol instead of PPP */\n\t\t\t\t/* 0x04 was PP_TIMO */\n#define PP_CALLIN\t0x08\t/* we are being called */\n#define PP_NEEDAUTH\t0x10\t/* remote requested authentication */\n\nvoid sppp_attach (struct ifnet *ifp);\nvoid sppp_detach (struct ifnet *ifp);\nvoid sppp_input (struct ifnet *ifp, struct mbuf *m);\nint sppp_ioctl (struct ifnet *ifp, u_long cmd, void *data);\nstruct mbuf *sppp_dequeue (struct ifnet *ifp);\nstruct mbuf *sppp_pick(struct ifnet *ifp);\nint sppp_isempty (struct ifnet *ifp);\nvoid sppp_flush (struct ifnet *ifp);\n\n/* Internal functions */\nvoid sppp_fr_input (struct sppp *sp, struct mbuf *m);\nstruct mbuf *sppp_fr_header (struct sppp *sp, struct mbuf *m, int fam);\nvoid sppp_fr_keepalive (struct sppp *sp);\nvoid sppp_get_ip_addrs(struct sppp *sp, u_long *src, u_long *dst,\n\t\t       u_long *srcmask);\n\n#endif\n\n#endif /* _NET_IF_SPPP_H_ */\n"
  },
  {
    "path": "freebsd-headers/net/if_stf.h",
    "content": "/*\t$FreeBSD: release/9.0.0/sys/net/if_stf.h 139823 2005-01-07 01:45:51Z imp $\t*/\n/*\t$KAME: if_stf.h,v 1.5 2001/10/12 10:09:17 keiichi Exp $\t*/\n\n/*-\n * Copyright (C) 2000 WIDE Project.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. Neither the name of the project nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n */\n\n#ifndef _NET_IF_STF_H_\n#define _NET_IF_STF_H_\n\nvoid in_stf_input(struct mbuf *, int);\n\n#endif /* _NET_IF_STF_H_ */\n"
  },
  {
    "path": "freebsd-headers/net/if_tap.h",
    "content": "/*-\n * Copyright (C) 1999-2000 by Maksim Yevmenkin <m_evmenkin@yahoo.com>\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * BASED ON:\n * -------------------------------------------------------------------------\n *\n * Copyright (c) 1988, Julian Onions <jpo@cs.nott.ac.uk>\n * Nottingham University 1987.\n */\n\n/*\n * $FreeBSD: release/9.0.0/sys/net/if_tap.h 182880 2008-09-08 22:43:55Z emax $\n * $Id: if_tap.h,v 0.7 2000/07/12 04:12:51 max Exp $\n */\n\n#ifndef _NET_IF_TAP_H_\n#define _NET_IF_TAP_H_\n\n/* refer to if_tapvar.h for the softc stuff */\n\n/* maximum receive packet size (hard limit) */\n#define\tTAPMRU\t\t16384\n\nstruct tapinfo {\n\tint\tbaudrate;\t/* linespeed                 */\n\tshort\tmtu;\t\t/* maximum transmission unit */\n\tu_char\ttype;\t\t/* ethernet, tokenring, etc. */\n\tu_char\tdummy;\t\t/* place holder              */\n};\n\n/* ioctl's for get/set debug */\n#define\tTAPSDEBUG\t\t_IOW('t', 90, int)\n#define\tTAPGDEBUG\t\t_IOR('t', 89, int)\n#define\tTAPSIFINFO\t\t_IOW('t', 91, struct tapinfo)\n#define\tTAPGIFINFO\t\t_IOR('t', 92, struct tapinfo)\n#define\tTAPGIFNAME\t\t_IOR('t', 93, struct ifreq)\n\n/* VMware ioctl's */\n#define VMIO_SIOCSIFFLAGS\t_IOWINT('V', 0)\n#define VMIO_SIOCSKEEP\t\t_IO('V', 1)\n#define VMIO_SIOCSIFBR\t\t_IO('V', 2)\n#define VMIO_SIOCSLADRF\t\t_IO('V', 3)\n\n/* XXX -- unimplemented */\n#define VMIO_SIOCSETMACADDR\t_IO('V', 4)\n\n/* XXX -- not used? */\n#define VMIO_SIOCPORT\t\t_IO('V', 5)\n#define VMIO_SIOCBRIDGE\t\t_IO('V', 6)\n#define VMIO_SIOCNETIF\t\t_IO('V', 7)\n\n#endif /* !_NET_IF_TAP_H_ */\n"
  },
  {
    "path": "freebsd-headers/net/if_tapvar.h",
    "content": "/*-\n * Copyright (C) 1999-2000 by Maksim Yevmenkin <m_evmenkin@yahoo.com>\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * BASED ON:\n * -------------------------------------------------------------------------\n *\n * Copyright (c) 1998 Brian Somers <brian@Awfulhak.org>\n * All rights reserved.\n *\n * Copyright (c) 1988, Julian Onions <jpo@cs.nott.ac.uk>\n * Nottingham University 1987.\n */\n\n/*\n * $FreeBSD: release/9.0.0/sys/net/if_tapvar.h 147256 2005-06-10 16:49:24Z brooks $\n * $Id: if_tapvar.h,v 0.6 2000/07/11 02:16:08 max Exp $\n */\n\n#ifndef _NET_IF_TAPVAR_H_\n#define _NET_IF_TAPVAR_H_\n\n/*\n * tap_mtx locks tap_flags, tap_pid.  tap_next locked with global tapmtx.\n * Other fields locked by owning subsystems.\n */\nstruct tap_softc {\n\tstruct ifnet\t*tap_ifp;\n\tu_short\t\ttap_flags;\t\t/* misc flags                */\n#define\tTAP_OPEN\t(1 << 0)\n#define\tTAP_INITED\t(1 << 1)\n#define\tTAP_RWAIT\t(1 << 2)\n#define\tTAP_ASYNC\t(1 << 3)\n#define TAP_READY       (TAP_OPEN|TAP_INITED)\n#define\tTAP_VMNET\t(1 << 4)\n\n\tu_int8_t \tether_addr[ETHER_ADDR_LEN]; /* ether addr of the remote side */\n\n\tpid_t\t\t tap_pid;\t\t/* PID of process to open    */\n\tstruct sigio\t*tap_sigio;\t\t/* information for async I/O */\n\tstruct selinfo\t tap_rsel;\t\t/* read select               */\n\n\tSLIST_ENTRY(tap_softc)\ttap_next;\t/* next device in chain      */\n\tstruct cdev *tap_dev;\n\tstruct mtx\t tap_mtx;\t\t/* per-softc mutex */\n};\n\n#endif /* !_NET_IF_TAPVAR_H_ */\n"
  },
  {
    "path": "freebsd-headers/net/if_tun.h",
    "content": "/*\t$NetBSD: if_tun.h,v 1.5 1994/06/29 06:36:27 cgd Exp $\t*/\n\n/*-\n * Copyright (c) 1988, Julian Onions <jpo@cs.nott.ac.uk>\n * Nottingham University 1987.\n *\n * This source may be freely distributed, however I would be interested\n * in any changes that are made.\n *\n * This driver takes packets off the IP i/f and hands them up to a\n * user process to have its wicked way with. This driver has it's\n * roots in a similar driver written by Phil Cockcroft (formerly) at\n * UCL. This driver is based much more on read/write/select mode of\n * operation though.\n *\n * $FreeBSD: release/9.0.0/sys/net/if_tun.h 139823 2005-01-07 01:45:51Z imp $\n */\n\n#ifndef _NET_IF_TUN_H_\n#define _NET_IF_TUN_H_\n\n/* Refer to if_tunvar.h for the softc stuff */\n\n/* Maximum transmit packet size (default) */\n#define\tTUNMTU\t\t1500\n\n/* Maximum receive packet size (hard limit) */\n#define\tTUNMRU\t\t16384\n\nstruct tuninfo {\n\tint\tbaudrate;\t\t/* linespeed */\n\tshort\tmtu;\t\t\t/* maximum transmission unit */\n\tu_char\ttype;\t\t\t/* ethernet, tokenring, etc. */\n\tu_char\tdummy;\t\t\t/* place holder */\n};\n\n/* ioctl's for get/set debug */\n#define\tTUNSDEBUG\t_IOW('t', 90, int)\n#define\tTUNGDEBUG\t_IOR('t', 89, int)\n#define\tTUNSIFINFO\t_IOW('t', 91, struct tuninfo)\n#define\tTUNGIFINFO\t_IOR('t', 92, struct tuninfo)\n#define\tTUNSLMODE\t_IOW('t', 93, int)\n#define\tTUNSIFMODE\t_IOW('t', 94, int)\n#define\tTUNSIFPID\t_IO('t', 95)\n#define\tTUNSIFHEAD\t_IOW('t', 96, int)\n#define\tTUNGIFHEAD\t_IOR('t', 97, int)\n\n#endif /* !_NET_IF_TUN_H_ */\n"
  },
  {
    "path": "freebsd-headers/net/if_types.h",
    "content": "/*-\n * Copyright (c) 1989, 1993, 1994\n *\tThe Regents of the University of California.  All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 4. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t@(#)if_types.h\t8.3 (Berkeley) 4/28/95\n * $FreeBSD: release/9.0.0/sys/net/if_types.h 219819 2011-03-21 09:40:01Z jeff $\n * $NetBSD: if_types.h,v 1.16 2000/04/19 06:30:53 itojun Exp $\n */\n\n#ifndef _NET_IF_TYPES_H_\n#define _NET_IF_TYPES_H_\n\n/*\n * Interface types for benefit of parsing media address headers.\n * This list is derived from the SNMP list of ifTypes, originally\n * documented in RFC1573, now maintained as:\n *\n * \thttp://www.iana.org/assignments/smi-numbers\n */\n\n#define\tIFT_OTHER\t0x1\t\t/* none of the following */\n#define\tIFT_1822\t0x2\t\t/* old-style arpanet imp */\n#define\tIFT_HDH1822\t0x3\t\t/* HDH arpanet imp */\n#define\tIFT_X25DDN\t0x4\t\t/* x25 to imp */\n#define\tIFT_X25\t\t0x5\t\t/* PDN X25 interface (RFC877) */\n#define\tIFT_ETHER\t0x6\t\t/* Ethernet CSMA/CD */\n#define\tIFT_ISO88023\t0x7\t\t/* CMSA/CD */\n#define\tIFT_ISO88024\t0x8\t\t/* Token Bus */\n#define\tIFT_ISO88025\t0x9\t\t/* Token Ring */\n#define\tIFT_ISO88026\t0xa\t\t/* MAN */\n#define\tIFT_STARLAN\t0xb\n#define\tIFT_P10\t\t0xc\t\t/* Proteon 10MBit ring */\n#define\tIFT_P80\t\t0xd\t\t/* Proteon 80MBit ring */\n#define\tIFT_HY\t\t0xe\t\t/* Hyperchannel */\n#define\tIFT_FDDI\t0xf\n#define\tIFT_LAPB\t0x10\n#define\tIFT_SDLC\t0x11\n#define\tIFT_T1\t\t0x12\n#define\tIFT_CEPT\t0x13\t\t/* E1 - european T1 */\n#define\tIFT_ISDNBASIC\t0x14\n#define\tIFT_ISDNPRIMARY\t0x15\n#define\tIFT_PTPSERIAL\t0x16\t\t/* Proprietary PTP serial */\n#define\tIFT_PPP\t\t0x17\t\t/* RFC 1331 */\n#define\tIFT_LOOP\t0x18\t\t/* loopback */\n#define\tIFT_EON\t\t0x19\t\t/* ISO over IP */\n#define\tIFT_XETHER\t0x1a\t\t/* obsolete 3MB experimental ethernet */\n#define\tIFT_NSIP\t0x1b\t\t/* XNS over IP */\n#define\tIFT_SLIP\t0x1c\t\t/* IP over generic TTY */\n#define\tIFT_ULTRA\t0x1d\t\t/* Ultra Technologies */\n#define\tIFT_DS3\t\t0x1e\t\t/* Generic T3 */\n#define\tIFT_SIP\t\t0x1f\t\t/* SMDS */\n#define\tIFT_FRELAY\t0x20\t\t/* Frame Relay DTE only */\n#define\tIFT_RS232\t0x21\n#define\tIFT_PARA\t0x22\t\t/* parallel-port */\n#define\tIFT_ARCNET\t0x23\n#define\tIFT_ARCNETPLUS\t0x24\n#define\tIFT_ATM\t\t0x25\t\t/* ATM cells */\n#define\tIFT_MIOX25\t0x26\n#define\tIFT_SONET\t0x27\t\t/* SONET or SDH */\n#define\tIFT_X25PLE\t0x28\n#define\tIFT_ISO88022LLC\t0x29\n#define\tIFT_LOCALTALK\t0x2a\n#define\tIFT_SMDSDXI\t0x2b\n#define\tIFT_FRELAYDCE\t0x2c\t\t/* Frame Relay DCE */\n#define\tIFT_V35\t\t0x2d\n#define\tIFT_HSSI\t0x2e\n#define\tIFT_HIPPI\t0x2f\n#define\tIFT_MODEM\t0x30\t\t/* Generic Modem */\n#define\tIFT_AAL5\t0x31\t\t/* AAL5 over ATM */\n#define\tIFT_SONETPATH\t0x32\n#define\tIFT_SONETVT\t0x33\n#define\tIFT_SMDSICIP\t0x34\t\t/* SMDS InterCarrier Interface */\n#define\tIFT_PROPVIRTUAL\t0x35\t\t/* Proprietary Virtual/internal */\n#define\tIFT_PROPMUX\t0x36\t\t/* Proprietary Multiplexing */\n#define\tIFT_IEEE80212\t\t   0x37 /* 100BaseVG */\n#define\tIFT_FIBRECHANNEL\t   0x38 /* Fibre Channel */\n#define\tIFT_HIPPIINTERFACE\t   0x39 /* HIPPI interfaces\t */\n#define\tIFT_FRAMERELAYINTERCONNECT 0x3a /* Obsolete, use either 0x20 or 0x2c */\n#define\tIFT_AFLANE8023\t\t   0x3b /* ATM Emulated LAN for 802.3 */\n#define\tIFT_AFLANE8025\t\t   0x3c /* ATM Emulated LAN for 802.5 */\n#define\tIFT_CCTEMUL\t\t   0x3d /* ATM Emulated circuit\t\t  */\n#define\tIFT_FASTETHER\t\t   0x3e /* Fast Ethernet (100BaseT) */\n#define\tIFT_ISDN\t\t   0x3f /* ISDN and X.25\t    */\n#define\tIFT_V11\t\t\t   0x40 /* CCITT V.11/X.21\t\t*/\n#define\tIFT_V36\t\t\t   0x41 /* CCITT V.36\t\t\t*/\n#define\tIFT_G703AT64K\t\t   0x42 /* CCITT G703 at 64Kbps */\n#define\tIFT_G703AT2MB\t\t   0x43 /* Obsolete see DS1-MIB */\n#define\tIFT_QLLC\t\t   0x44 /* SNA QLLC\t\t\t*/\n#define\tIFT_FASTETHERFX\t\t   0x45 /* Fast Ethernet (100BaseFX)\t*/\n#define\tIFT_CHANNEL\t\t   0x46 /* channel\t\t\t*/\n#define\tIFT_IEEE80211\t\t   0x47 /* radio spread spectrum\t*/\n#define\tIFT_IBM370PARCHAN\t   0x48 /* IBM System 360/370 OEMI Channel */\n#define\tIFT_ESCON\t\t   0x49 /* IBM Enterprise Systems Connection */\n#define\tIFT_DLSW\t\t   0x4a /* Data Link Switching */\n#define\tIFT_ISDNS\t\t   0x4b /* ISDN S/T interface */\n#define\tIFT_ISDNU\t\t   0x4c /* ISDN U interface */\n#define\tIFT_LAPD\t\t   0x4d /* Link Access Protocol D */\n#define\tIFT_IPSWITCH\t\t   0x4e /* IP Switching Objects */\n#define\tIFT_RSRB\t\t   0x4f /* Remote Source Route Bridging */\n#define\tIFT_ATMLOGICAL\t\t   0x50 /* ATM Logical Port */\n#define\tIFT_DS0\t\t\t   0x51 /* Digital Signal Level 0 */\n#define\tIFT_DS0BUNDLE\t\t   0x52 /* group of ds0s on the same ds1 */\n#define\tIFT_BSC\t\t\t   0x53 /* Bisynchronous Protocol */\n#define\tIFT_ASYNC\t\t   0x54 /* Asynchronous Protocol */\n#define\tIFT_CNR\t\t\t   0x55 /* Combat Net Radio */\n#define\tIFT_ISO88025DTR\t\t   0x56 /* ISO 802.5r DTR */\n#define\tIFT_EPLRS\t\t   0x57 /* Ext Pos Loc Report Sys */\n#define\tIFT_ARAP\t\t   0x58 /* Appletalk Remote Access Protocol */\n#define\tIFT_PROPCNLS\t\t   0x59 /* Proprietary Connectionless Protocol*/\n#define\tIFT_HOSTPAD\t\t   0x5a /* CCITT-ITU X.29 PAD Protocol */\n#define\tIFT_TERMPAD\t\t   0x5b /* CCITT-ITU X.3 PAD Facility */\n#define\tIFT_FRAMERELAYMPI\t   0x5c /* Multiproto Interconnect over FR */\n#define\tIFT_X213\t\t   0x5d /* CCITT-ITU X213 */\n#define\tIFT_ADSL\t\t   0x5e /* Asymmetric Digital Subscriber Loop */\n#define\tIFT_RADSL\t\t   0x5f /* Rate-Adapt. Digital Subscriber Loop*/\n#define\tIFT_SDSL\t\t   0x60 /* Symmetric Digital Subscriber Loop */\n#define\tIFT_VDSL\t\t   0x61 /* Very H-Speed Digital Subscrib. Loop*/\n#define\tIFT_ISO88025CRFPINT\t   0x62 /* ISO 802.5 CRFP */\n#define\tIFT_MYRINET\t\t   0x63 /* Myricom Myrinet */\n#define\tIFT_VOICEEM\t\t   0x64 /* voice recEive and transMit */\n#define\tIFT_VOICEFXO\t\t   0x65 /* voice Foreign Exchange Office */\n#define\tIFT_VOICEFXS\t\t   0x66 /* voice Foreign Exchange Station */\n#define\tIFT_VOICEENCAP\t\t   0x67 /* voice encapsulation */\n#define\tIFT_VOICEOVERIP\t\t   0x68 /* voice over IP encapsulation */\n#define\tIFT_ATMDXI\t\t   0x69 /* ATM DXI */\n#define\tIFT_ATMFUNI\t\t   0x6a /* ATM FUNI */\n#define\tIFT_ATMIMA\t\t   0x6b /* ATM IMA\t\t      */\n#define\tIFT_PPPMULTILINKBUNDLE\t   0x6c /* PPP Multilink Bundle */\n#define\tIFT_IPOVERCDLC\t\t   0x6d /* IBM ipOverCdlc */\n#define\tIFT_IPOVERCLAW\t\t   0x6e /* IBM Common Link Access to Workstn */\n#define\tIFT_STACKTOSTACK\t   0x6f /* IBM stackToStack */\n#define\tIFT_VIRTUALIPADDRESS\t   0x70 /* IBM VIPA */\n#define\tIFT_MPC\t\t\t   0x71 /* IBM multi-protocol channel support */\n#define\tIFT_IPOVERATM\t\t   0x72 /* IBM ipOverAtm */\n#define\tIFT_ISO88025FIBER\t   0x73 /* ISO 802.5j Fiber Token Ring */\n#define\tIFT_TDLC\t\t   0x74 /* IBM twinaxial data link control */\n#define\tIFT_GIGABITETHERNET\t   0x75 /* Gigabit Ethernet */\n#define\tIFT_HDLC\t\t   0x76 /* HDLC */\n#define\tIFT_LAPF\t\t   0x77 /* LAP F */\n#define\tIFT_V37\t\t\t   0x78 /* V.37 */\n#define\tIFT_X25MLP\t\t   0x79 /* Multi-Link Protocol */\n#define\tIFT_X25HUNTGROUP\t   0x7a /* X25 Hunt Group */\n#define\tIFT_TRANSPHDLC\t\t   0x7b /* Transp HDLC */\n#define\tIFT_INTERLEAVE\t\t   0x7c /* Interleave channel */\n#define\tIFT_FAST\t\t   0x7d /* Fast channel */\n#define\tIFT_IP\t\t\t   0x7e /* IP (for APPN HPR in IP networks) */\n#define\tIFT_DOCSCABLEMACLAYER\t   0x7f /* CATV Mac Layer */\n#define\tIFT_DOCSCABLEDOWNSTREAM\t   0x80 /* CATV Downstream interface */\n#define\tIFT_DOCSCABLEUPSTREAM\t   0x81 /* CATV Upstream interface */\n#define\tIFT_A12MPPSWITCH\t   0x82\t/* Avalon Parallel Processor */\n#define\tIFT_TUNNEL\t\t   0x83\t/* Encapsulation interface */\n#define\tIFT_COFFEE\t\t   0x84\t/* coffee pot */\n#define\tIFT_CES\t\t\t   0x85\t/* Circiut Emulation Service */\n#define\tIFT_ATMSUBINTERFACE\t   0x86\t/* (x)  ATM Sub Interface */\n#define\tIFT_L2VLAN\t\t   0x87\t/* Layer 2 Virtual LAN using 802.1Q */\n#define\tIFT_L3IPVLAN\t\t   0x88\t/* Layer 3 Virtual LAN - IP Protocol */\n#define\tIFT_L3IPXVLAN\t\t   0x89\t/* Layer 3 Virtual LAN - IPX Prot. */\n#define\tIFT_DIGITALPOWERLINE\t   0x8a\t/* IP over Power Lines */\n#define\tIFT_MEDIAMAILOVERIP\t   0x8b\t/* (xxx)  Multimedia Mail over IP */\n#define\tIFT_DTM\t\t\t   0x8c\t/* Dynamic synchronous Transfer Mode */\n#define\tIFT_DCN\t\t\t   0x8d\t/* Data Communications Network */\n#define\tIFT_IPFORWARD\t\t   0x8e\t/* IP Forwarding Interface */\n#define\tIFT_MSDSL\t\t   0x8f\t/* Multi-rate Symmetric DSL */\n#define\tIFT_IEEE1394\t\t   0x90\t/* IEEE1394 High Performance SerialBus*/\n#define\tIFT_IFGSN\t\t   0x91\t/* HIPPI-6400 */\n#define\tIFT_DVBRCCMACLAYER\t   0x92\t/* DVB-RCC MAC Layer */\n#define\tIFT_DVBRCCDOWNSTREAM\t   0x93\t/* DVB-RCC Downstream Channel */\n#define\tIFT_DVBRCCUPSTREAM\t   0x94\t/* DVB-RCC Upstream Channel */\n#define\tIFT_ATMVIRTUAL\t\t   0x95\t/* ATM Virtual Interface */\n#define\tIFT_MPLSTUNNEL\t\t   0x96\t/* MPLS Tunnel Virtual Interface */\n#define\tIFT_SRP\t\t\t   0x97\t/* Spatial Reuse Protocol */\n#define\tIFT_VOICEOVERATM\t   0x98\t/* Voice over ATM */\n#define\tIFT_VOICEOVERFRAMERELAY\t   0x99\t/* Voice Over Frame Relay */\n#define\tIFT_IDSL\t\t   0x9a\t/* Digital Subscriber Loop over ISDN */\n#define\tIFT_COMPOSITELINK\t   0x9b\t/* Avici Composite Link Interface */\n#define\tIFT_SS7SIGLINK\t\t   0x9c\t/* SS7 Signaling Link */\n#define\tIFT_PROPWIRELESSP2P\t   0x9d\t/* Prop. P2P wireless interface */\n#define\tIFT_FRFORWARD\t\t   0x9e\t/* Frame forward Interface */\n#define\tIFT_RFC1483\t\t   0x9f\t/* Multiprotocol over ATM AAL5 */\n#define\tIFT_USB\t\t\t   0xa0\t/* USB Interface */\n#define\tIFT_IEEE8023ADLAG\t   0xa1\t/* IEEE 802.3ad Link Aggregate*/\n#define\tIFT_BGPPOLICYACCOUNTING\t   0xa2\t/* BGP Policy Accounting */\n#define\tIFT_FRF16MFRBUNDLE\t   0xa3\t/* FRF.16 Multilik Frame Relay*/\n#define\tIFT_H323GATEKEEPER\t   0xa4\t/* H323 Gatekeeper */\n#define\tIFT_H323PROXY\t\t   0xa5\t/* H323 Voice and Video Proxy */\n#define\tIFT_MPLS\t\t   0xa6\t/* MPLS */\n#define\tIFT_MFSIGLINK\t\t   0xa7\t/* Multi-frequency signaling link */\n#define\tIFT_HDSL2\t\t   0xa8\t/* High Bit-Rate DSL, 2nd gen. */\n#define\tIFT_SHDSL\t\t   0xa9\t/* Multirate HDSL2 */\n#define\tIFT_DS1FDL\t\t   0xaa\t/* Facility Data Link (4Kbps) on a DS1*/\n#define\tIFT_POS\t\t\t   0xab\t/* Packet over SONET/SDH Interface */\n#define\tIFT_DVBASILN\t\t   0xac\t/* DVB-ASI Input */\n#define\tIFT_DVBASIOUT\t\t   0xad\t/* DVB-ASI Output */\n#define\tIFT_PLC\t\t\t   0xae\t/* Power Line Communications */\n#define\tIFT_NFAS\t\t   0xaf\t/* Non-Facility Associated Signaling */\n#define\tIFT_TR008\t\t   0xb0\t/* TROO8 */\n#define\tIFT_GR303RDT\t\t   0xb1\t/* Remote Digital Terminal */\n#define\tIFT_GR303IDT\t\t   0xb2\t/* Integrated Digital Terminal */\n#define\tIFT_ISUP\t\t   0xb3\t/* ISUP */\n#define\tIFT_PROPDOCSWIRELESSMACLAYER\t   0xb4\t/* prop/Wireless MAC Layer */\n#define\tIFT_PROPDOCSWIRELESSDOWNSTREAM\t   0xb5\t/* prop/Wireless Downstream */\n#define\tIFT_PROPDOCSWIRELESSUPSTREAM\t   0xb6\t/* prop/Wireless Upstream */\n#define\tIFT_HIPERLAN2\t\t   0xb7\t/* HIPERLAN Type 2 Radio Interface */\n#define\tIFT_PROPBWAP2MP\t\t   0xb8\t/* PropBroadbandWirelessAccess P2MP*/\n#define\tIFT_SONETOVERHEADCHANNEL   0xb9\t/* SONET Overhead Channel */\n#define\tIFT_DIGITALWRAPPEROVERHEADCHANNEL  0xba\t/* Digital Wrapper Overhead */\n#define\tIFT_AAL2\t\t   0xbb\t/* ATM adaptation layer 2 */\n#define\tIFT_RADIOMAC\t\t   0xbc\t/* MAC layer over radio links */\n#define\tIFT_ATMRADIO\t\t   0xbd\t/* ATM over radio links */\n#define\tIFT_IMT\t\t\t   0xbe /* Inter-Machine Trunks */\n#define\tIFT_MVL\t\t\t   0xbf /* Multiple Virtual Lines DSL */\n#define\tIFT_REACHDSL\t\t   0xc0 /* Long Reach DSL */\n#define\tIFT_FRDLCIENDPT\t\t   0xc1 /* Frame Relay DLCI End Point */\n#define\tIFT_ATMVCIENDPT\t\t   0xc2 /* ATM VCI End Point */\n#define\tIFT_OPTICALCHANNEL\t   0xc3 /* Optical Channel */\n#define\tIFT_OPTICALTRANSPORT\t   0xc4 /* Optical Transport */\n#define\tIFT_INFINIBAND\t\t   0xc7\t/* Infiniband */\n#define\tIFT_BRIDGE\t\t   0xd1 /* Transparent bridge interface */\n\n#define\tIFT_STF\t\t\t   0xd7\t/* 6to4 interface */\n\n/* not based on IANA assignments */\n#define\tIFT_GIF\t\t0xf0\n#define\tIFT_PVC\t\t0xf1\n#define\tIFT_FAITH\t0xf2\n#define\tIFT_ENC\t\t0xf4\n#define\tIFT_PFLOG\t0xf6\n#define\tIFT_PFSYNC\t0xf7\n#define\tIFT_CARP\t0xf8\t/* Common Address Redundancy Protocol */\n#define IFT_IPXIP\t0xf9\t/* IPX over IP tunneling; no longer used. */\n#endif /* !_NET_IF_TYPES_H_ */\n"
  },
  {
    "path": "freebsd-headers/net/if_var.h",
    "content": "/*-\n * Copyright (c) 1982, 1986, 1989, 1993\n *\tThe Regents of the University of California.  All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 4. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\tFrom: @(#)if.h\t8.1 (Berkeley) 6/10/93\n * $FreeBSD: release/9.0.0/sys/net/if_var.h 224151 2011-07-17 21:15:20Z bz $\n */\n\n#ifndef\t_NET_IF_VAR_H_\n#define\t_NET_IF_VAR_H_\n\n/*\n * Structures defining a network interface, providing a packet\n * transport mechanism (ala level 0 of the PUP protocols).\n *\n * Each interface accepts output datagrams of a specified maximum\n * length, and provides higher level routines with input datagrams\n * received from its medium.\n *\n * Output occurs when the routine if_output is called, with three parameters:\n *\t(*ifp->if_output)(ifp, m, dst, rt)\n * Here m is the mbuf chain to be sent and dst is the destination address.\n * The output routine encapsulates the supplied datagram if necessary,\n * and then transmits it on its medium.\n *\n * On input, each interface unwraps the data received by it, and either\n * places it on the input queue of an internetwork datagram routine\n * and posts the associated software interrupt, or passes the datagram to a raw\n * packet input routine.\n *\n * Routines exist for locating interfaces by their addresses\n * or for locating an interface on a certain network, as well as more general\n * routing and gateway routines maintaining information used to locate\n * interfaces.  These routines live in the files if.c and route.c\n */\n\n#ifdef __STDC__\n/*\n * Forward structure declarations for function prototypes [sic].\n */\nstruct\tmbuf;\nstruct\tthread;\nstruct\trtentry;\nstruct\trt_addrinfo;\nstruct\tsocket;\nstruct\tether_header;\nstruct\tcarp_if;\nstruct  ifvlantrunk;\nstruct\troute;\nstruct\tvnet;\n#endif\n\n#include <sys/queue.h>\t\t/* get TAILQ macros */\n\n#ifdef _KERNEL\n#include <sys/mbuf.h>\n#include <sys/eventhandler.h>\n#include <sys/buf_ring.h>\n#include <net/vnet.h>\n#endif /* _KERNEL */\n#include <sys/lock.h>\t\t/* XXX */\n#include <sys/mutex.h>\t\t/* XXX */\n#include <sys/rwlock.h>\t\t/* XXX */\n#include <sys/sx.h>\t\t/* XXX */\n#include <sys/event.h>\t\t/* XXX */\n#include <sys/_task.h>\n\n#define\tIF_DUNIT_NONE\t-1\n\n#include <altq/if_altq.h>\n\nTAILQ_HEAD(ifnethead, ifnet);\t/* we use TAILQs so that the order of */\nTAILQ_HEAD(ifaddrhead, ifaddr);\t/* instantiation is preserved in the list */\nTAILQ_HEAD(ifprefixhead, ifprefix);\nTAILQ_HEAD(ifmultihead, ifmultiaddr);\nTAILQ_HEAD(ifgrouphead, ifg_group);\n\n/*\n * Structure defining a queue for a network interface.\n */\nstruct\tifqueue {\n\tstruct\tmbuf *ifq_head;\n\tstruct\tmbuf *ifq_tail;\n\tint\tifq_len;\n\tint\tifq_maxlen;\n\tint\tifq_drops;\n\tstruct\tmtx ifq_mtx;\n};\n\n/*\n * Structure defining a network interface.\n *\n * (Would like to call this struct ``if'', but C isn't PL/1.)\n */\n\nstruct ifnet {\n\tvoid\t*if_softc;\t\t/* pointer to driver state */\n\tvoid\t*if_l2com;\t\t/* pointer to protocol bits */\n\tstruct vnet *if_vnet;\t\t/* pointer to network stack instance */\n\tTAILQ_ENTRY(ifnet) if_link; \t/* all struct ifnets are chained */\n\tchar\tif_xname[IFNAMSIZ];\t/* external name (name + unit) */\n\tconst char *if_dname;\t\t/* driver name */\n\tint\tif_dunit;\t\t/* unit or IF_DUNIT_NONE */\n\tu_int\tif_refcount;\t\t/* reference count */\n\tstruct\tifaddrhead if_addrhead;\t/* linked list of addresses per if */\n\t\t/*\n\t\t * if_addrhead is the list of all addresses associated to\n\t\t * an interface.\n\t\t * Some code in the kernel assumes that first element\n\t\t * of the list has type AF_LINK, and contains sockaddr_dl\n\t\t * addresses which store the link-level address and the name\n\t\t * of the interface.\n\t\t * However, access to the AF_LINK address through this\n\t\t * field is deprecated. Use if_addr or ifaddr_byindex() instead.\n\t\t */\n\tint\tif_pcount;\t\t/* number of promiscuous listeners */\n\tstruct\tcarp_if *if_carp;\t/* carp interface structure */\n\tstruct\tbpf_if *if_bpf;\t\t/* packet filter structure */\n\tu_short\tif_index;\t\t/* numeric abbreviation for this if  */\n\tshort\tif_index_reserved;\t/* spare space to grow if_index */\n\tstruct  ifvlantrunk *if_vlantrunk; /* pointer to 802.1q data */\n\tint\tif_flags;\t\t/* up/down, broadcast, etc. */\n\tint\tif_capabilities;\t/* interface features & capabilities */\n\tint\tif_capenable;\t\t/* enabled features & capabilities */\n\tvoid\t*if_linkmib;\t\t/* link-type-specific MIB data */\n\tsize_t\tif_linkmiblen;\t\t/* length of above data */\n\tstruct\tif_data if_data;\n\tstruct\tifmultihead if_multiaddrs; /* multicast addresses configured */\n\tint\tif_amcount;\t\t/* number of all-multicast requests */\n/* procedure handles */\n\tint\t(*if_output)\t\t/* output routine (enqueue) */\n\t\t(struct ifnet *, struct mbuf *, struct sockaddr *,\n\t\t     struct route *);\n\tvoid\t(*if_input)\t\t/* input routine (from h/w driver) */\n\t\t(struct ifnet *, struct mbuf *);\n\tvoid\t(*if_start)\t\t/* initiate output routine */\n\t\t(struct ifnet *);\n\tint\t(*if_ioctl)\t\t/* ioctl routine */\n\t\t(struct ifnet *, u_long, caddr_t);\n\tvoid\t(*if_init)\t\t/* Init routine */\n\t\t(void *);\n\tint\t(*if_resolvemulti)\t/* validate/resolve multicast */\n\t\t(struct ifnet *, struct sockaddr **, struct sockaddr *);\n\tvoid\t(*if_qflush)\t\t/* flush any queues */\n\t\t(struct ifnet *);\n\tint\t(*if_transmit)\t\t/* initiate output routine */\n\t\t(struct ifnet *, struct mbuf *);\n\tvoid\t(*if_reassign)\t\t/* reassign to vnet routine */\n\t\t(struct ifnet *, struct vnet *, char *);\n\tstruct\tvnet *if_home_vnet;\t/* where this ifnet originates from */\n\tstruct\tifaddr\t*if_addr;\t/* pointer to link-level address */\n\tvoid\t*if_llsoftc;\t\t/* link layer softc */\n\tint\tif_drv_flags;\t\t/* driver-managed status flags */\n\tstruct  ifaltq if_snd;\t\t/* output queue (includes altq) */\n\tconst u_int8_t *if_broadcastaddr; /* linklevel broadcast bytestring */\n\n\tvoid\t*if_bridge;\t\t/* bridge glue */\n\n\tstruct\tlabel *if_label;\t/* interface MAC label */\n\n\t/* these are only used by IPv6 */\n\tstruct\tifprefixhead if_prefixhead; /* list of prefixes per if */\n\tvoid\t*if_afdata[AF_MAX];\n\tint\tif_afdata_initialized;\n\tstruct\trwlock if_afdata_lock;\n\tstruct\ttask if_linktask;\t/* task for link change events */\n\tstruct\tmtx if_addr_mtx;\t/* mutex to protect address lists */\n\n\tLIST_ENTRY(ifnet) if_clones;\t/* interfaces of a cloner */\n\tTAILQ_HEAD(, ifg_list) if_groups; /* linked list of groups per if */\n\t\t\t\t\t/* protected by if_addr_mtx */\n\tvoid\t*if_pf_kif;\n\tvoid\t*if_lagg;\t\t/* lagg glue */\n\tchar\t*if_description;\t/* interface description */\n\tu_int\tif_fib;\t\t\t/* interface FIB */\n\tu_char\tif_alloctype;\t\t/* if_type at time of allocation */\n\n\t/*\n\t * Spare fields are added so that we can modify sensitive data\n\t * structures without changing the kernel binary interface, and must\n\t * be used with care where binary compatibility is required.\n\t */\n\tchar\tif_cspare[3];\n\tint\tif_ispare[4];\n\tvoid\t*if_pspare[8];\t\t/* 1 netmap, 7 TDB */\n};\n\ntypedef void if_init_f_t(void *);\n\n/*\n * XXX These aliases are terribly dangerous because they could apply\n * to anything.\n */\n#define\tif_mtu\t\tif_data.ifi_mtu\n#define\tif_type\t\tif_data.ifi_type\n#define if_physical\tif_data.ifi_physical\n#define\tif_addrlen\tif_data.ifi_addrlen\n#define\tif_hdrlen\tif_data.ifi_hdrlen\n#define\tif_metric\tif_data.ifi_metric\n#define\tif_link_state\tif_data.ifi_link_state\n#define\tif_baudrate\tif_data.ifi_baudrate\n#define\tif_hwassist\tif_data.ifi_hwassist\n#define\tif_ipackets\tif_data.ifi_ipackets\n#define\tif_ierrors\tif_data.ifi_ierrors\n#define\tif_opackets\tif_data.ifi_opackets\n#define\tif_oerrors\tif_data.ifi_oerrors\n#define\tif_collisions\tif_data.ifi_collisions\n#define\tif_ibytes\tif_data.ifi_ibytes\n#define\tif_obytes\tif_data.ifi_obytes\n#define\tif_imcasts\tif_data.ifi_imcasts\n#define\tif_omcasts\tif_data.ifi_omcasts\n#define\tif_iqdrops\tif_data.ifi_iqdrops\n#define\tif_noproto\tif_data.ifi_noproto\n#define\tif_lastchange\tif_data.ifi_lastchange\n\n/* for compatibility with other BSDs */\n#define\tif_addrlist\tif_addrhead\n#define\tif_list\t\tif_link\n#define\tif_name(ifp)\t((ifp)->if_xname)\n\n/*\n * Locks for address lists on the network interface.\n */\n#define\tIF_ADDR_LOCK_INIT(if)\tmtx_init(&(if)->if_addr_mtx,\t\t\\\n\t\t\t\t    \"if_addr_mtx\", NULL, MTX_DEF)\n#define\tIF_ADDR_LOCK_DESTROY(if)\tmtx_destroy(&(if)->if_addr_mtx)\n#define\tIF_ADDR_LOCK(if)\tmtx_lock(&(if)->if_addr_mtx)\n#define\tIF_ADDR_UNLOCK(if)\tmtx_unlock(&(if)->if_addr_mtx)\n#define\tIF_ADDR_LOCK_ASSERT(if)\tmtx_assert(&(if)->if_addr_mtx, MA_OWNED)\n\n/*\n * Function variations on locking macros intended to be used by loadable\n * kernel modules in order to divorce them from the internals of address list\n * locking.\n */\nvoid\tif_addr_rlock(struct ifnet *ifp);\t/* if_addrhead */\nvoid\tif_addr_runlock(struct ifnet *ifp);\t/* if_addrhead */\nvoid\tif_maddr_rlock(struct ifnet *ifp);\t/* if_multiaddrs */\nvoid\tif_maddr_runlock(struct ifnet *ifp);\t/* if_multiaddrs */\n\n/*\n * Output queues (ifp->if_snd) and slow device input queues (*ifp->if_slowq)\n * are queues of messages stored on ifqueue structures\n * (defined above).  Entries are added to and deleted from these structures\n * by these macros, which should be called with ipl raised to splimp().\n */\n#define IF_LOCK(ifq)\t\tmtx_lock(&(ifq)->ifq_mtx)\n#define IF_UNLOCK(ifq)\t\tmtx_unlock(&(ifq)->ifq_mtx)\n#define\tIF_LOCK_ASSERT(ifq)\tmtx_assert(&(ifq)->ifq_mtx, MA_OWNED)\n#define\t_IF_QFULL(ifq)\t\t((ifq)->ifq_len >= (ifq)->ifq_maxlen)\n#define\t_IF_DROP(ifq)\t\t((ifq)->ifq_drops++)\n#define\t_IF_QLEN(ifq)\t\t((ifq)->ifq_len)\n\n#define\t_IF_ENQUEUE(ifq, m) do { \t\t\t\t\\\n\t(m)->m_nextpkt = NULL;\t\t\t\t\t\\\n\tif ((ifq)->ifq_tail == NULL) \t\t\t\t\\\n\t\t(ifq)->ifq_head = m; \t\t\t\t\\\n\telse \t\t\t\t\t\t\t\\\n\t\t(ifq)->ifq_tail->m_nextpkt = m; \t\t\\\n\t(ifq)->ifq_tail = m; \t\t\t\t\t\\\n\t(ifq)->ifq_len++; \t\t\t\t\t\\\n} while (0)\n\n#define IF_ENQUEUE(ifq, m) do {\t\t\t\t\t\\\n\tIF_LOCK(ifq); \t\t\t\t\t\t\\\n\t_IF_ENQUEUE(ifq, m); \t\t\t\t\t\\\n\tIF_UNLOCK(ifq); \t\t\t\t\t\\\n} while (0)\n\n#define\t_IF_PREPEND(ifq, m) do {\t\t\t\t\\\n\t(m)->m_nextpkt = (ifq)->ifq_head; \t\t\t\\\n\tif ((ifq)->ifq_tail == NULL) \t\t\t\t\\\n\t\t(ifq)->ifq_tail = (m); \t\t\t\t\\\n\t(ifq)->ifq_head = (m); \t\t\t\t\t\\\n\t(ifq)->ifq_len++; \t\t\t\t\t\\\n} while (0)\n\n#define IF_PREPEND(ifq, m) do {\t\t \t\t\t\\\n\tIF_LOCK(ifq); \t\t\t\t\t\t\\\n\t_IF_PREPEND(ifq, m); \t\t\t\t\t\\\n\tIF_UNLOCK(ifq); \t\t\t\t\t\\\n} while (0)\n\n#define\t_IF_DEQUEUE(ifq, m) do { \t\t\t\t\\\n\t(m) = (ifq)->ifq_head; \t\t\t\t\t\\\n\tif (m) { \t\t\t\t\t\t\\\n\t\tif (((ifq)->ifq_head = (m)->m_nextpkt) == NULL)\t\\\n\t\t\t(ifq)->ifq_tail = NULL; \t\t\\\n\t\t(m)->m_nextpkt = NULL; \t\t\t\t\\\n\t\t(ifq)->ifq_len--; \t\t\t\t\\\n\t} \t\t\t\t\t\t\t\\\n} while (0)\n\n#define IF_DEQUEUE(ifq, m) do { \t\t\t\t\\\n\tIF_LOCK(ifq); \t\t\t\t\t\t\\\n\t_IF_DEQUEUE(ifq, m); \t\t\t\t\t\\\n\tIF_UNLOCK(ifq); \t\t\t\t\t\\\n} while (0)\n\n#define\t_IF_POLL(ifq, m)\t((m) = (ifq)->ifq_head)\n#define\tIF_POLL(ifq, m)\t\t_IF_POLL(ifq, m)\n\n#define _IF_DRAIN(ifq) do { \t\t\t\t\t\\\n\tstruct mbuf *m; \t\t\t\t\t\\\n\tfor (;;) { \t\t\t\t\t\t\\\n\t\t_IF_DEQUEUE(ifq, m); \t\t\t\t\\\n\t\tif (m == NULL) \t\t\t\t\t\\\n\t\t\tbreak; \t\t\t\t\t\\\n\t\tm_freem(m); \t\t\t\t\t\\\n\t} \t\t\t\t\t\t\t\\\n} while (0)\n\n#define IF_DRAIN(ifq) do {\t\t\t\t\t\\\n\tIF_LOCK(ifq);\t\t\t\t\t\t\\\n\t_IF_DRAIN(ifq);\t\t\t\t\t\t\\\n\tIF_UNLOCK(ifq);\t\t\t\t\t\t\\\n} while(0)\n\n#ifdef _KERNEL\n/* interface link layer address change event */\ntypedef void (*iflladdr_event_handler_t)(void *, struct ifnet *);\nEVENTHANDLER_DECLARE(iflladdr_event, iflladdr_event_handler_t);\n/* interface address change event */\ntypedef void (*ifaddr_event_handler_t)(void *, struct ifnet *);\nEVENTHANDLER_DECLARE(ifaddr_event, ifaddr_event_handler_t);\n/* new interface arrival event */\ntypedef void (*ifnet_arrival_event_handler_t)(void *, struct ifnet *);\nEVENTHANDLER_DECLARE(ifnet_arrival_event, ifnet_arrival_event_handler_t);\n/* interface departure event */\ntypedef void (*ifnet_departure_event_handler_t)(void *, struct ifnet *);\nEVENTHANDLER_DECLARE(ifnet_departure_event, ifnet_departure_event_handler_t);\n/* Interface link state change event */\ntypedef void (*ifnet_link_event_handler_t)(void *, struct ifnet *, int);\nEVENTHANDLER_DECLARE(ifnet_link_event, ifnet_link_event_handler_t);\n\n/*\n * interface groups\n */\nstruct ifg_group {\n\tchar\t\t\t\t ifg_group[IFNAMSIZ];\n\tu_int\t\t\t\t ifg_refcnt;\n\tvoid\t\t\t\t*ifg_pf_kif;\n\tTAILQ_HEAD(, ifg_member)\t ifg_members;\n\tTAILQ_ENTRY(ifg_group)\t\t ifg_next;\n};\n\nstruct ifg_member {\n\tTAILQ_ENTRY(ifg_member)\t ifgm_next;\n\tstruct ifnet\t\t*ifgm_ifp;\n};\n\nstruct ifg_list {\n\tstruct ifg_group\t*ifgl_group;\n\tTAILQ_ENTRY(ifg_list)\t ifgl_next;\n};\n\n/* group attach event */\ntypedef void (*group_attach_event_handler_t)(void *, struct ifg_group *);\nEVENTHANDLER_DECLARE(group_attach_event, group_attach_event_handler_t);\n/* group detach event */\ntypedef void (*group_detach_event_handler_t)(void *, struct ifg_group *);\nEVENTHANDLER_DECLARE(group_detach_event, group_detach_event_handler_t);\n/* group change event */\ntypedef void (*group_change_event_handler_t)(void *, const char *);\nEVENTHANDLER_DECLARE(group_change_event, group_change_event_handler_t);\n\n#define\tIF_AFDATA_LOCK_INIT(ifp)\t\\\n\trw_init(&(ifp)->if_afdata_lock, \"if_afdata\")\n\n#define\tIF_AFDATA_WLOCK(ifp)\trw_wlock(&(ifp)->if_afdata_lock)\n#define\tIF_AFDATA_RLOCK(ifp)\trw_rlock(&(ifp)->if_afdata_lock)\n#define\tIF_AFDATA_WUNLOCK(ifp)\trw_wunlock(&(ifp)->if_afdata_lock)\n#define\tIF_AFDATA_RUNLOCK(ifp)\trw_runlock(&(ifp)->if_afdata_lock)\n#define\tIF_AFDATA_LOCK(ifp)\tIF_AFDATA_WLOCK(ifp)\n#define\tIF_AFDATA_UNLOCK(ifp)\tIF_AFDATA_WUNLOCK(ifp)\n#define\tIF_AFDATA_TRYLOCK(ifp)\trw_try_wlock(&(ifp)->if_afdata_lock)\n#define\tIF_AFDATA_DESTROY(ifp)\trw_destroy(&(ifp)->if_afdata_lock)\n\n#define\tIF_AFDATA_LOCK_ASSERT(ifp)\trw_assert(&(ifp)->if_afdata_lock, RA_LOCKED)\n#define\tIF_AFDATA_UNLOCK_ASSERT(ifp)\trw_assert(&(ifp)->if_afdata_lock, RA_UNLOCKED)\n\nint\tif_handoff(struct ifqueue *ifq, struct mbuf *m, struct ifnet *ifp,\n\t    int adjust);\n#define\tIF_HANDOFF(ifq, m, ifp)\t\t\t\\\n\tif_handoff((struct ifqueue *)ifq, m, ifp, 0)\n#define\tIF_HANDOFF_ADJ(ifq, m, ifp, adj)\t\\\n\tif_handoff((struct ifqueue *)ifq, m, ifp, adj)\n\nvoid\tif_start(struct ifnet *);\n\n#define\tIFQ_ENQUEUE(ifq, m, err)\t\t\t\t\t\\\ndo {\t\t\t\t\t\t\t\t\t\\\n\tIF_LOCK(ifq);\t\t\t\t\t\t\t\\\n\tif (ALTQ_IS_ENABLED(ifq))\t\t\t\t\t\\\n\t\tALTQ_ENQUEUE(ifq, m, NULL, err);\t\t\t\\\n\telse {\t\t\t\t\t\t\t\t\\\n\t\tif (_IF_QFULL(ifq)) {\t\t\t\t\t\\\n\t\t\tm_freem(m);\t\t\t\t\t\\\n\t\t\t(err) = ENOBUFS;\t\t\t\t\\\n\t\t} else {\t\t\t\t\t\t\\\n\t\t\t_IF_ENQUEUE(ifq, m);\t\t\t\t\\\n\t\t\t(err) = 0;\t\t\t\t\t\\\n\t\t}\t\t\t\t\t\t\t\\\n\t}\t\t\t\t\t\t\t\t\\\n\tif (err)\t\t\t\t\t\t\t\\\n\t\t(ifq)->ifq_drops++;\t\t\t\t\t\\\n\tIF_UNLOCK(ifq);\t\t\t\t\t\t\t\\\n} while (0)\n\n#define\tIFQ_DEQUEUE_NOLOCK(ifq, m)\t\t\t\t\t\\\ndo {\t\t\t\t\t\t\t\t\t\\\n\tif (TBR_IS_ENABLED(ifq))\t\t\t\t\t\\\n\t\t(m) = tbr_dequeue_ptr(ifq, ALTDQ_REMOVE);\t\t\\\n\telse if (ALTQ_IS_ENABLED(ifq))\t\t\t\t\t\\\n\t\tALTQ_DEQUEUE(ifq, m);\t\t\t\t\t\\\n\telse\t\t\t\t\t\t\t\t\\\n\t\t_IF_DEQUEUE(ifq, m);\t\t\t\t\t\\\n} while (0)\n\n#define\tIFQ_DEQUEUE(ifq, m)\t\t\t\t\t\t\\\ndo {\t\t\t\t\t\t\t\t\t\\\n\tIF_LOCK(ifq);\t\t\t\t\t\t\t\\\n\tIFQ_DEQUEUE_NOLOCK(ifq, m);\t\t\t\t\t\\\n\tIF_UNLOCK(ifq);\t\t\t\t\t\t\t\\\n} while (0)\n\n#define\tIFQ_POLL_NOLOCK(ifq, m)\t\t\t\t\t\t\\\ndo {\t\t\t\t\t\t\t\t\t\\\n\tif (TBR_IS_ENABLED(ifq))\t\t\t\t\t\\\n\t\t(m) = tbr_dequeue_ptr(ifq, ALTDQ_POLL);\t\t\t\\\n\telse if (ALTQ_IS_ENABLED(ifq))\t\t\t\t\t\\\n\t\tALTQ_POLL(ifq, m);\t\t\t\t\t\\\n\telse\t\t\t\t\t\t\t\t\\\n\t\t_IF_POLL(ifq, m);\t\t\t\t\t\\\n} while (0)\n\n#define\tIFQ_POLL(ifq, m)\t\t\t\t\t\t\\\ndo {\t\t\t\t\t\t\t\t\t\\\n\tIF_LOCK(ifq);\t\t\t\t\t\t\t\\\n\tIFQ_POLL_NOLOCK(ifq, m);\t\t\t\t\t\\\n\tIF_UNLOCK(ifq);\t\t\t\t\t\t\t\\\n} while (0)\n\n#define\tIFQ_PURGE_NOLOCK(ifq)\t\t\t\t\t\t\\\ndo {\t\t\t\t\t\t\t\t\t\\\n\tif (ALTQ_IS_ENABLED(ifq)) {\t\t\t\t\t\\\n\t\tALTQ_PURGE(ifq);\t\t\t\t\t\\\n\t} else\t\t\t\t\t\t\t\t\\\n\t\t_IF_DRAIN(ifq);\t\t\t\t\t\t\\\n} while (0)\n\n#define\tIFQ_PURGE(ifq)\t\t\t\t\t\t\t\\\ndo {\t\t\t\t\t\t\t\t\t\\\n\tIF_LOCK(ifq);\t\t\t\t\t\t\t\\\n\tIFQ_PURGE_NOLOCK(ifq);\t\t\t\t\t\t\\\n\tIF_UNLOCK(ifq);\t\t\t\t\t\t\t\\\n} while (0)\n\n#define\tIFQ_SET_READY(ifq)\t\t\t\t\t\t\\\n\tdo { ((ifq)->altq_flags |= ALTQF_READY); } while (0)\n\n#define\tIFQ_LOCK(ifq)\t\t\tIF_LOCK(ifq)\n#define\tIFQ_UNLOCK(ifq)\t\t\tIF_UNLOCK(ifq)\n#define\tIFQ_LOCK_ASSERT(ifq)\t\tIF_LOCK_ASSERT(ifq)\n#define\tIFQ_IS_EMPTY(ifq)\t\t((ifq)->ifq_len == 0)\n#define\tIFQ_INC_LEN(ifq)\t\t((ifq)->ifq_len++)\n#define\tIFQ_DEC_LEN(ifq)\t\t(--(ifq)->ifq_len)\n#define\tIFQ_INC_DROPS(ifq)\t\t((ifq)->ifq_drops++)\n#define\tIFQ_SET_MAXLEN(ifq, len)\t((ifq)->ifq_maxlen = (len))\n\n/*\n * The IFF_DRV_OACTIVE test should really occur in the device driver, not in\n * the handoff logic, as that flag is locked by the device driver.\n */\n#define\tIFQ_HANDOFF_ADJ(ifp, m, adj, err)\t\t\t\t\\\ndo {\t\t\t\t\t\t\t\t\t\\\n\tint len;\t\t\t\t\t\t\t\\\n\tshort mflags;\t\t\t\t\t\t\t\\\n\t\t\t\t\t\t\t\t\t\\\n\tlen = (m)->m_pkthdr.len;\t\t\t\t\t\\\n\tmflags = (m)->m_flags;\t\t\t\t\t\t\\\n\tIFQ_ENQUEUE(&(ifp)->if_snd, m, err);\t\t\t\t\\\n\tif ((err) == 0) {\t\t\t\t\t\t\\\n\t\t(ifp)->if_obytes += len + (adj);\t\t\t\\\n\t\tif (mflags & M_MCAST)\t\t\t\t\t\\\n\t\t\t(ifp)->if_omcasts++;\t\t\t\t\\\n\t\tif (((ifp)->if_drv_flags & IFF_DRV_OACTIVE) == 0)\t\\\n\t\t\tif_start(ifp);\t\t\t\t\t\\\n\t}\t\t\t\t\t\t\t\t\\\n} while (0)\n\n#define\tIFQ_HANDOFF(ifp, m, err)\t\t\t\t\t\\\n\tIFQ_HANDOFF_ADJ(ifp, m, 0, err)\n\n#define\tIFQ_DRV_DEQUEUE(ifq, m)\t\t\t\t\t\t\\\ndo {\t\t\t\t\t\t\t\t\t\\\n\t(m) = (ifq)->ifq_drv_head;\t\t\t\t\t\\\n\tif (m) {\t\t\t\t\t\t\t\\\n\t\tif (((ifq)->ifq_drv_head = (m)->m_nextpkt) == NULL)\t\\\n\t\t\t(ifq)->ifq_drv_tail = NULL;\t\t\t\\\n\t\t(m)->m_nextpkt = NULL;\t\t\t\t\t\\\n\t\t(ifq)->ifq_drv_len--;\t\t\t\t\t\\\n\t} else {\t\t\t\t\t\t\t\\\n\t\tIFQ_LOCK(ifq);\t\t\t\t\t\t\\\n\t\tIFQ_DEQUEUE_NOLOCK(ifq, m);\t\t\t\t\\\n\t\twhile ((ifq)->ifq_drv_len < (ifq)->ifq_drv_maxlen) {\t\\\n\t\t\tstruct mbuf *m0;\t\t\t\t\\\n\t\t\tIFQ_DEQUEUE_NOLOCK(ifq, m0);\t\t\t\\\n\t\t\tif (m0 == NULL)\t\t\t\t\t\\\n\t\t\t\tbreak;\t\t\t\t\t\\\n\t\t\tm0->m_nextpkt = NULL;\t\t\t\t\\\n\t\t\tif ((ifq)->ifq_drv_tail == NULL)\t\t\\\n\t\t\t\t(ifq)->ifq_drv_head = m0;\t\t\\\n\t\t\telse\t\t\t\t\t\t\\\n\t\t\t\t(ifq)->ifq_drv_tail->m_nextpkt = m0;\t\\\n\t\t\t(ifq)->ifq_drv_tail = m0;\t\t\t\\\n\t\t\t(ifq)->ifq_drv_len++;\t\t\t\t\\\n\t\t}\t\t\t\t\t\t\t\\\n\t\tIFQ_UNLOCK(ifq);\t\t\t\t\t\\\n\t}\t\t\t\t\t\t\t\t\\\n} while (0)\n\n#define\tIFQ_DRV_PREPEND(ifq, m)\t\t\t\t\t\t\\\ndo {\t\t\t\t\t\t\t\t\t\\\n\t(m)->m_nextpkt = (ifq)->ifq_drv_head;\t\t\t\t\\\n\tif ((ifq)->ifq_drv_tail == NULL)\t\t\t\t\\\n\t\t(ifq)->ifq_drv_tail = (m);\t\t\t\t\\\n\t(ifq)->ifq_drv_head = (m);\t\t\t\t\t\\\n\t(ifq)->ifq_drv_len++;\t\t\t\t\t\t\\\n} while (0)\n\n#define\tIFQ_DRV_IS_EMPTY(ifq)\t\t\t\t\t\t\\\n\t(((ifq)->ifq_drv_len == 0) && ((ifq)->ifq_len == 0))\n\n#define\tIFQ_DRV_PURGE(ifq)\t\t\t\t\t\t\\\ndo {\t\t\t\t\t\t\t\t\t\\\n\tstruct mbuf *m, *n = (ifq)->ifq_drv_head;\t\t\t\\\n\twhile((m = n) != NULL) {\t\t\t\t\t\\\n\t\tn = m->m_nextpkt;\t\t\t\t\t\\\n\t\tm_freem(m);\t\t\t\t\t\t\\\n\t}\t\t\t\t\t\t\t\t\\\n\t(ifq)->ifq_drv_head = (ifq)->ifq_drv_tail = NULL;\t\t\\\n\t(ifq)->ifq_drv_len = 0;\t\t\t\t\t\t\\\n\tIFQ_PURGE(ifq);\t\t\t\t\t\t\t\\\n} while (0)\n\n#ifdef _KERNEL\nstatic __inline void\ndrbr_stats_update(struct ifnet *ifp, int len, int mflags)\n{\n#ifndef NO_SLOW_STATS\n\tifp->if_obytes += len;\n\tif (mflags & M_MCAST)\n\t\tifp->if_omcasts++;\n#endif\n}\n\nstatic __inline int\ndrbr_enqueue(struct ifnet *ifp, struct buf_ring *br, struct mbuf *m)\n{\t\n\tint error = 0;\n\tint len = m->m_pkthdr.len;\n\tint mflags = m->m_flags;\n\n#ifdef ALTQ\n\tif (ALTQ_IS_ENABLED(&ifp->if_snd)) {\n\t\tIFQ_ENQUEUE(&ifp->if_snd, m, error);\n\t\treturn (error);\n\t}\n#endif\n\tif ((error = buf_ring_enqueue_bytes(br, m, len)) == ENOBUFS) {\n\t\tbr->br_drops++;\n\t\tm_freem(m);\n\t} else\n\t\tdrbr_stats_update(ifp, len, mflags);\n\t\n\treturn (error);\n}\n\nstatic __inline void\ndrbr_flush(struct ifnet *ifp, struct buf_ring *br)\n{\n\tstruct mbuf *m;\n\n#ifdef ALTQ\n\tif (ifp != NULL && ALTQ_IS_ENABLED(&ifp->if_snd))\n\t\tIFQ_PURGE(&ifp->if_snd);\n#endif\t\n\twhile ((m = buf_ring_dequeue_sc(br)) != NULL)\n\t\tm_freem(m);\n}\n\nstatic __inline void\ndrbr_free(struct buf_ring *br, struct malloc_type *type)\n{\n\n\tdrbr_flush(NULL, br);\n\tbuf_ring_free(br, type);\n}\n\nstatic __inline struct mbuf *\ndrbr_dequeue(struct ifnet *ifp, struct buf_ring *br)\n{\n#ifdef ALTQ\n\tstruct mbuf *m;\n\n\tif (ALTQ_IS_ENABLED(&ifp->if_snd)) {\t\n\t\tIFQ_DEQUEUE(&ifp->if_snd, m);\n\t\treturn (m);\n\t}\n#endif\n\treturn (buf_ring_dequeue_sc(br));\n}\n\nstatic __inline struct mbuf *\ndrbr_dequeue_cond(struct ifnet *ifp, struct buf_ring *br,\n    int (*func) (struct mbuf *, void *), void *arg) \n{\n\tstruct mbuf *m;\n#ifdef ALTQ\n\tif (ALTQ_IS_ENABLED(&ifp->if_snd)) {\n\t\tIFQ_LOCK(&ifp->if_snd);\n\t\tIFQ_POLL_NOLOCK(&ifp->if_snd, m);\n\t\tif (m != NULL && func(m, arg) == 0) {\n\t\t\tIFQ_UNLOCK(&ifp->if_snd);\n\t\t\treturn (NULL);\n\t\t}\n\t\tIFQ_DEQUEUE_NOLOCK(&ifp->if_snd, m);\n\t\tIFQ_UNLOCK(&ifp->if_snd);\n\t\treturn (m);\n\t}\n#endif\n\tm = buf_ring_peek(br);\n\tif (m == NULL || func(m, arg) == 0)\n\t\treturn (NULL);\n\n\treturn (buf_ring_dequeue_sc(br));\n}\n\nstatic __inline int\ndrbr_empty(struct ifnet *ifp, struct buf_ring *br)\n{\n#ifdef ALTQ\n\tif (ALTQ_IS_ENABLED(&ifp->if_snd))\n\t\treturn (IFQ_IS_EMPTY(&ifp->if_snd));\n#endif\n\treturn (buf_ring_empty(br));\n}\n\nstatic __inline int\ndrbr_needs_enqueue(struct ifnet *ifp, struct buf_ring *br)\n{\n#ifdef ALTQ\n\tif (ALTQ_IS_ENABLED(&ifp->if_snd))\n\t\treturn (1);\n#endif\n\treturn (!buf_ring_empty(br));\n}\n\nstatic __inline int\ndrbr_inuse(struct ifnet *ifp, struct buf_ring *br)\n{\n#ifdef ALTQ\n\tif (ALTQ_IS_ENABLED(&ifp->if_snd))\n\t\treturn (ifp->if_snd.ifq_len);\n#endif\n\treturn (buf_ring_count(br));\n}\n#endif\n/*\n * 72 was chosen below because it is the size of a TCP/IP\n * header (40) + the minimum mss (32).\n */\n#define\tIF_MINMTU\t72\n#define\tIF_MAXMTU\t65535\n\n#endif /* _KERNEL */\n\n/*\n * The ifaddr structure contains information about one address\n * of an interface.  They are maintained by the different address families,\n * are allocated and attached when an address is set, and are linked\n * together so all addresses for an interface can be located.\n *\n * NOTE: a 'struct ifaddr' is always at the beginning of a larger\n * chunk of malloc'ed memory, where we store the three addresses\n * (ifa_addr, ifa_dstaddr and ifa_netmask) referenced here.\n */\nstruct ifaddr {\n\tstruct\tsockaddr *ifa_addr;\t/* address of interface */\n\tstruct\tsockaddr *ifa_dstaddr;\t/* other end of p-to-p link */\n#define\tifa_broadaddr\tifa_dstaddr\t/* broadcast address interface */\n\tstruct\tsockaddr *ifa_netmask;\t/* used to determine subnet */\n\tstruct\tif_data if_data;\t/* not all members are meaningful */\n\tstruct\tifnet *ifa_ifp;\t\t/* back-pointer to interface */\n\tTAILQ_ENTRY(ifaddr) ifa_link;\t/* queue macro glue */\n\tvoid\t(*ifa_rtrequest)\t/* check or clean routes (+ or -)'d */\n\t\t(int, struct rtentry *, struct rt_addrinfo *);\n\tu_short\tifa_flags;\t\t/* mostly rt_flags for cloning */\n\tu_int\tifa_refcnt;\t\t/* references to this structure */\n\tint\tifa_metric;\t\t/* cost of going out this interface */\n\tint (*ifa_claim_addr)\t\t/* check if an addr goes to this if */\n\t\t(struct ifaddr *, struct sockaddr *);\n\tstruct mtx ifa_mtx;\n};\n#define\tIFA_ROUTE\tRTF_UP\t\t/* route installed */\n#define IFA_RTSELF\tRTF_HOST\t/* loopback route to self installed */\n\n/* for compatibility with other BSDs */\n#define\tifa_list\tifa_link\n\n#ifdef _KERNEL\n#define\tIFA_LOCK(ifa)\t\tmtx_lock(&(ifa)->ifa_mtx)\n#define\tIFA_UNLOCK(ifa)\t\tmtx_unlock(&(ifa)->ifa_mtx)\n\nvoid\tifa_free(struct ifaddr *ifa);\nvoid\tifa_init(struct ifaddr *ifa);\nvoid\tifa_ref(struct ifaddr *ifa);\n#endif\n\n/*\n * The prefix structure contains information about one prefix\n * of an interface.  They are maintained by the different address families,\n * are allocated and attached when a prefix or an address is set,\n * and are linked together so all prefixes for an interface can be located.\n */\nstruct ifprefix {\n\tstruct\tsockaddr *ifpr_prefix;\t/* prefix of interface */\n\tstruct\tifnet *ifpr_ifp;\t/* back-pointer to interface */\n\tTAILQ_ENTRY(ifprefix) ifpr_list; /* queue macro glue */\n\tu_char\tifpr_plen;\t\t/* prefix length in bits */\n\tu_char\tifpr_type;\t\t/* protocol dependent prefix type */\n};\n\n/*\n * Multicast address structure.  This is analogous to the ifaddr\n * structure except that it keeps track of multicast addresses.\n */\nstruct ifmultiaddr {\n\tTAILQ_ENTRY(ifmultiaddr) ifma_link; /* queue macro glue */\n\tstruct\tsockaddr *ifma_addr; \t/* address this membership is for */\n\tstruct\tsockaddr *ifma_lladdr;\t/* link-layer translation, if any */\n\tstruct\tifnet *ifma_ifp;\t/* back-pointer to interface */\n\tu_int\tifma_refcount;\t\t/* reference count */\n\tvoid\t*ifma_protospec;\t/* protocol-specific state, if any */\n\tstruct\tifmultiaddr *ifma_llifma; /* pointer to ifma for ifma_lladdr */\n};\n\n#ifdef _KERNEL\n\nextern\tstruct rwlock ifnet_rwlock;\nextern\tstruct sx ifnet_sxlock;\n\n#define\tIFNET_LOCK_INIT() do {\t\t\t\t\t\t\\\n\trw_init_flags(&ifnet_rwlock, \"ifnet_rw\",  RW_RECURSE);\t\t\\\n\tsx_init_flags(&ifnet_sxlock, \"ifnet_sx\",  SX_RECURSE);\t\t\\\n} while(0)\n\n#define\tIFNET_WLOCK() do {\t\t\t\t\t\t\\\n\tsx_xlock(&ifnet_sxlock);\t\t\t\t\t\\\n\trw_wlock(&ifnet_rwlock);\t\t\t\t\t\\\n} while (0)\n\n#define\tIFNET_WUNLOCK() do {\t\t\t\t\t\t\\\n\trw_wunlock(&ifnet_rwlock);\t\t\t\t\t\\\n\tsx_xunlock(&ifnet_sxlock);\t\t\t\t\t\\\n} while (0)\n\n/*\n * To assert the ifnet lock, you must know not only whether it's for read or\n * write, but also whether it was acquired with sleep support or not.\n */\n#define\tIFNET_RLOCK_ASSERT()\t\tsx_assert(&ifnet_sxlock, SA_SLOCKED)\n#define\tIFNET_RLOCK_NOSLEEP_ASSERT()\trw_assert(&ifnet_rwlock, RA_RLOCKED)\n#define\tIFNET_WLOCK_ASSERT() do {\t\t\t\t\t\\\n\tsx_assert(&ifnet_sxlock, SA_XLOCKED);\t\t\t\t\\\n\trw_assert(&ifnet_rwlock, RA_WLOCKED);\t\t\t\t\\\n} while (0)\n\n#define\tIFNET_RLOCK()\t\tsx_slock(&ifnet_sxlock)\n#define\tIFNET_RLOCK_NOSLEEP()\trw_rlock(&ifnet_rwlock)\n#define\tIFNET_RUNLOCK()\t\tsx_sunlock(&ifnet_sxlock)\n#define\tIFNET_RUNLOCK_NOSLEEP()\trw_runlock(&ifnet_rwlock)\n\n/*\n * Look up an ifnet given its index; the _ref variant also acquires a\n * reference that must be freed using if_rele().  It is almost always a bug\n * to call ifnet_byindex() instead if ifnet_byindex_ref().\n */\nstruct ifnet\t*ifnet_byindex(u_short idx);\nstruct ifnet\t*ifnet_byindex_locked(u_short idx);\nstruct ifnet\t*ifnet_byindex_ref(u_short idx);\n\n/*\n * Given the index, ifaddr_byindex() returns the one and only\n * link-level ifaddr for the interface. You are not supposed to use\n * it to traverse the list of addresses associated to the interface.\n */\nstruct ifaddr\t*ifaddr_byindex(u_short idx);\n\nVNET_DECLARE(struct ifnethead, ifnet);\nVNET_DECLARE(struct ifgrouphead, ifg_head);\nVNET_DECLARE(int, if_index);\nVNET_DECLARE(struct ifnet *, loif);\t/* first loopback interface */\nVNET_DECLARE(int, useloopback);\n\n#define\tV_ifnet\t\tVNET(ifnet)\n#define\tV_ifg_head\tVNET(ifg_head)\n#define\tV_if_index\tVNET(if_index)\n#define\tV_loif\t\tVNET(loif)\n#define\tV_useloopback\tVNET(useloopback)\n\nextern\tint ifqmaxlen;\n\nint\tif_addgroup(struct ifnet *, const char *);\nint\tif_delgroup(struct ifnet *, const char *);\nint\tif_addmulti(struct ifnet *, struct sockaddr *, struct ifmultiaddr **);\nint\tif_allmulti(struct ifnet *, int);\nstruct\tifnet* if_alloc(u_char);\nvoid\tif_attach(struct ifnet *);\nvoid\tif_dead(struct ifnet *);\nint\tif_delmulti(struct ifnet *, struct sockaddr *);\nvoid\tif_delmulti_ifma(struct ifmultiaddr *);\nvoid\tif_detach(struct ifnet *);\nvoid\tif_vmove(struct ifnet *, struct vnet *);\nvoid\tif_purgeaddrs(struct ifnet *);\nvoid\tif_delallmulti(struct ifnet *);\nvoid\tif_down(struct ifnet *);\nstruct ifmultiaddr *\n\tif_findmulti(struct ifnet *, struct sockaddr *);\nvoid\tif_free(struct ifnet *);\nvoid\tif_free_type(struct ifnet *, u_char);\nvoid\tif_initname(struct ifnet *, const char *, int);\nvoid\tif_link_state_change(struct ifnet *, int);\nint\tif_printf(struct ifnet *, const char *, ...) __printflike(2, 3);\nvoid\tif_qflush(struct ifnet *);\nvoid\tif_ref(struct ifnet *);\nvoid\tif_rele(struct ifnet *);\nint\tif_setlladdr(struct ifnet *, const u_char *, int);\nvoid\tif_up(struct ifnet *);\nint\tifioctl(struct socket *, u_long, caddr_t, struct thread *);\nint\tifpromisc(struct ifnet *, int);\nstruct\tifnet *ifunit(const char *);\nstruct\tifnet *ifunit_ref(const char *);\n\nvoid\tifq_init(struct ifaltq *, struct ifnet *ifp);\nvoid\tifq_delete(struct ifaltq *);\n\nint\tifa_add_loopback_route(struct ifaddr *, struct sockaddr *);\nint\tifa_del_loopback_route(struct ifaddr *, struct sockaddr *);\n\nstruct\tifaddr *ifa_ifwithaddr(struct sockaddr *);\nint\t\tifa_ifwithaddr_check(struct sockaddr *);\nstruct\tifaddr *ifa_ifwithbroadaddr(struct sockaddr *);\nstruct\tifaddr *ifa_ifwithdstaddr(struct sockaddr *);\nstruct\tifaddr *ifa_ifwithnet(struct sockaddr *, int);\nstruct\tifaddr *ifa_ifwithroute(int, struct sockaddr *, struct sockaddr *);\nstruct\tifaddr *ifa_ifwithroute_fib(int, struct sockaddr *, struct sockaddr *, u_int);\n\nstruct\tifaddr *ifaof_ifpforaddr(struct sockaddr *, struct ifnet *);\n\nint\tif_simloop(struct ifnet *ifp, struct mbuf *m, int af, int hlen);\n\ntypedef\tvoid *if_com_alloc_t(u_char type, struct ifnet *ifp);\ntypedef\tvoid if_com_free_t(void *com, u_char type);\nvoid\tif_register_com_alloc(u_char type, if_com_alloc_t *a, if_com_free_t *f);\nvoid\tif_deregister_com_alloc(u_char type);\n\n#define IF_LLADDR(ifp)\t\t\t\t\t\t\t\\\n    LLADDR((struct sockaddr_dl *)((ifp)->if_addr->ifa_addr))\n\n#ifdef DEVICE_POLLING\nenum poll_cmd {\tPOLL_ONLY, POLL_AND_CHECK_STATUS };\n\ntypedef\tint poll_handler_t(struct ifnet *ifp, enum poll_cmd cmd, int count);\nint    ether_poll_register(poll_handler_t *h, struct ifnet *ifp);\nint    ether_poll_deregister(struct ifnet *ifp);\n#endif /* DEVICE_POLLING */\n\n#endif /* _KERNEL */\n\n#endif /* !_NET_IF_VAR_H_ */\n"
  },
  {
    "path": "freebsd-headers/net/if_vlan_var.h",
    "content": "/*-\n * Copyright 1998 Massachusetts Institute of Technology\n *\n * Permission to use, copy, modify, and distribute this software and\n * its documentation for any purpose and without fee is hereby\n * granted, provided that both the above copyright notice and this\n * permission notice appear in all copies, that both the above\n * copyright notice and this permission notice appear in all\n * supporting documentation, and that the name of M.I.T. not be used\n * in advertising or publicity pertaining to distribution of the\n * software without specific, written prior permission.  M.I.T. makes\n * no representations about the suitability of this software for any\n * purpose.  It is provided \"as is\" without express or implied\n * warranty.\n * \n * THIS SOFTWARE IS PROVIDED BY M.I.T. ``AS IS''.  M.I.T. DISCLAIMS\n * ALL EXPRESS OR IMPLIED WARRANTIES WITH REGARD TO THIS SOFTWARE,\n * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF\n * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT\n * SHALL M.I.T. BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF\n * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\n * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,\n * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT\n * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/net/if_vlan_var.h 219819 2011-03-21 09:40:01Z jeff $\n */\n\n#ifndef _NET_IF_VLAN_VAR_H_\n#define\t_NET_IF_VLAN_VAR_H_\t1\n\nstruct\tether_vlan_header {\n\tu_char\tevl_dhost[ETHER_ADDR_LEN];\n\tu_char\tevl_shost[ETHER_ADDR_LEN];\n\tu_int16_t evl_encap_proto;\n\tu_int16_t evl_tag;\n\tu_int16_t evl_proto;\n};\n\n#define\tEVL_VLID_MASK\t\t0x0FFF\n#define\tEVL_PRI_MASK\t\t0xE000\n#define\tEVL_VLANOFTAG(tag)\t((tag) & EVL_VLID_MASK)\n#define\tEVL_PRIOFTAG(tag)\t(((tag) >> 13) & 7)\n#define\tEVL_CFIOFTAG(tag)\t(((tag) >> 12) & 1)\n#define\tEVL_MAKETAG(vlid, pri, cfi)\t\t\t\t\t\\\n\t((((((pri) & 7) << 1) | ((cfi) & 1)) << 12) | ((vlid) & EVL_VLID_MASK))\n\n/* Set the VLAN ID in an mbuf packet header non-destructively. */\n#define EVL_APPLY_VLID(m, vlid)\t\t\t\t\t\t\\\n\tdo {\t\t\t\t\t\t\t\t\\\n\t\tif ((m)->m_flags & M_VLANTAG) {\t\t\t\t\\\n\t\t\t(m)->m_pkthdr.ether_vtag &= EVL_VLID_MASK;\t\\\n\t\t\t(m)->m_pkthdr.ether_vtag |= (vlid);\t\t\\\n\t\t} else {\t\t\t\t\t\t\\\n\t\t\t(m)->m_pkthdr.ether_vtag = (vlid);\t\t\\\n\t\t\t(m)->m_flags |= M_VLANTAG;\t\t\t\\\n\t\t}\t\t\t\t\t\t\t\\\n\t} while (0)\n\n/* Set the priority ID in an mbuf packet header non-destructively. */\n#define EVL_APPLY_PRI(m, pri)\t\t\t\t\t\t\\\n\tdo {\t\t\t\t\t\t\t\t\\\n\t\tif ((m)->m_flags & M_VLANTAG) {\t\t\t\t\\\n\t\t\tuint16_t __vlantag = (m)->m_pkthdr.ether_vtag;\t\\\n\t\t\t(m)->m_pkthdr.ether_vtag |= EVL_MAKETAG(\t\\\n\t\t\t    EVL_VLANOFTAG(__vlantag), (pri),\t\t\\\n\t\t\t    EVL_CFIOFTAG(__vlantag));\t\t\t\\\n\t\t} else {\t\t\t\t\t\t\\\n\t\t\t(m)->m_pkthdr.ether_vtag =\t\t\t\\\n\t\t\t    EVL_MAKETAG(0, (pri), 0);\t\t\t\\\n\t\t\t(m)->m_flags |= M_VLANTAG;\t\t\t\\\n\t\t}\t\t\t\t\t\t\t\\\n\t} while (0)\n\n/* sysctl(3) tags, for compatibility purposes */\n#define\tVLANCTL_PROTO\t1\n#define\tVLANCTL_MAX\t2\n\n/*\n * Configuration structure for SIOCSETVLAN and SIOCGETVLAN ioctls.\n */\nstruct\tvlanreq {\n\tchar\tvlr_parent[IFNAMSIZ];\n\tu_short\tvlr_tag;\n};\n#define\tSIOCSETVLAN\tSIOCSIFGENERIC\n#define\tSIOCGETVLAN\tSIOCGIFGENERIC\n\n#ifdef _KERNEL\n/*\n * Drivers that are capable of adding and removing the VLAN header\n * in hardware indicate they support this by marking IFCAP_VLAN_HWTAGGING\n * in if_capabilities.  Drivers for hardware that is capable\n * of handling larger MTU's that may include a software-appended\n * VLAN header w/o lowering the normal MTU should mark IFCAP_VLAN_MTU\n * in if_capabilities; this notifies the VLAN code it can leave the\n * MTU on the vlan interface at the normal setting.\n */\n\n/*\n * VLAN tags are stored in host byte order.  Byte swapping may be\n * necessary.\n *\n * Drivers that support hardware VLAN tag stripping fill in the\n * received VLAN tag (containing both vlan and priority information)\n * into the ether_vtag mbuf packet header field:\n * \n *\tm->m_pkthdr.ether_vtag = vlan_id;\t// ntohs()?\n *\tm->m_flags |= M_VLANTAG;\n *\n * to mark the packet m with the specified VLAN tag.\n *\n * On output the driver should check the mbuf for the M_VLANTAG\n * flag to see if a VLAN tag is present and valid:\n *\n *\tif (m->m_flags & M_VLANTAG) {\n *\t\t... = m->m_pkthdr.ether_vtag;\t// htons()?\n *\t\t... pass tag to hardware ...\n *\t}\n *\n * Note that a driver must indicate it supports hardware VLAN\n * stripping/insertion by marking IFCAP_VLAN_HWTAGGING in\n * if_capabilities.\n */\n\n#define\tVLAN_CAPABILITIES(_ifp) do {\t\t\t\t\\\n\tif ((_ifp)->if_vlantrunk != NULL) \t\t\t\\\n\t\t(*vlan_trunk_cap_p)(_ifp);\t\t\t\\\n} while (0)\n\n#define\tVLAN_TRUNKDEV(_ifp)\t\t\t\t\t\\\n\t(_ifp)->if_type == IFT_L2VLAN ? (*vlan_trunkdev_p)((_ifp)) : NULL\n#define\tVLAN_TAG(_ifp, _tag)\t\t\t\t\t\\\n\t(_ifp)->if_type == IFT_L2VLAN ? (*vlan_tag_p)((_ifp), (_tag)) : EINVAL\n#define\tVLAN_COOKIE(_ifp)\t\t\t\t\t\\\n\t(_ifp)->if_type == IFT_L2VLAN ? (*vlan_cookie_p)((_ifp)) : NULL\n#define\tVLAN_SETCOOKIE(_ifp, _cookie)\t\t\t\t\\\n\t(_ifp)->if_type == IFT_L2VLAN ?\t\t\t\t\\\n\t    (*vlan_setcookie_p)((_ifp), (_cookie)) : EINVAL\n#define\tVLAN_DEVAT(_ifp, _tag)\t\t\t\t\t\\\n\t(_ifp)->if_vlantrunk != NULL ? (*vlan_devat_p)((_ifp), (_tag)) : NULL\n\nextern\tvoid (*vlan_trunk_cap_p)(struct ifnet *);\nextern\tstruct ifnet *(*vlan_trunkdev_p)(struct ifnet *);\nextern\tstruct ifnet *(*vlan_devat_p)(struct ifnet *, uint16_t);\nextern\tint (*vlan_tag_p)(struct ifnet *, uint16_t *);\nextern\tint (*vlan_setcookie_p)(struct ifnet *, void *);\nextern\tvoid *(*vlan_cookie_p)(struct ifnet *);\n\n#endif /* _KERNEL */\n\n#endif /* _NET_IF_VLAN_VAR_H_ */\n"
  },
  {
    "path": "freebsd-headers/net/iso88025.h",
    "content": "/*-\n * Copyright (c) 1998, Larry Lile\n * All rights reserved.\n *\n * For latest sources and information on this driver, please\n * go to http://anarchy.stdio.com.\n *\n * Questions, comments or suggestions should be directed to\n * Larry Lile <lile@stdio.com>.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice unmodified, this list of conditions, and the following\n *    disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/net/iso88025.h 194581 2009-06-21 10:29:31Z rdivacky $\n *\n * Information gathered from tokenring@freebsd, /sys/net/ethernet.h and\n * the Mach token ring driver.\n */\n\n/*\n * Fundamental constants relating to iso 802.5\n */\n\n#ifndef _NET_ISO88025_H_\n#define\t_NET_ISO88025_H_\n\n/*\n * General ISO 802.5 definitions\n */\n#define\tISO88025_ADDR_LEN\t6\n#define\tISO88025_CF_LEN\t\t2\n#define\tISO88025_HDR_LEN\t(ISO88025_CF_LEN + (ISO88025_ADDR_LEN * 2))\n#define\tRCF_LEN\t\t\t2\n#define\tRIF_MAX_RD\t\t14\n#define\tRIF_MAX_LEN\t\t16\n\n#define\tTR_AC\t\t\t0x10\n#define\tTR_LLC_FRAME\t\t0x40\n\n#define\tTR_4MBPS\t\t4000000\n#define\tTR_16MBPS\t\t16000000\n#define\tTR_100MBPS\t\t100000000\n\n/*\n * Source routing \n */\n#define\tTR_RII\t\t\t0x80\n#define\tTR_RCF_BCST_MASK\t0xe000\n#define\tTR_RCF_LEN_MASK\t\t0x1f00\n#define\tTR_RCF_DIR\t\t0x0080\n#define\tTR_RCF_LF_MASK\t\t0x0070\n\n#define\tTR_RCF_RIFLEN(x)\t((ntohs(x) & TR_RCF_LEN_MASK) >> 8)\n\n/*\n * Minimum and maximum packet payload lengths.\n */\n#define\tISO88025_MIN_LEN\t0 \n#define\tISO88025_MAX_LEN_4\t4464\n#define\tISO88025_MAX_LEN_16\t17960\t\n#define\tISO88025_MAX_LEN\tISO88025_MAX_LEN_16\n\n/*\n * A macro to validate a length with\n */\n#define\tISO88025_IS_VALID_LEN(foo)\t\\\n\t((foo) >= ISO88025_MIN_LEN && (foo) <= ISO88025_MAX_LEN)\n\n/* Access Control field */\n#define\tAC_PRI_MASK\t\t0xe0\t/* Priority bits \t\t*/\n#define\tAC_TOKEN\t\t0x10\t/* Token bit: 0=Token, 1=Frame\t*/\n#define\tAC_MONITOR\t\t0x08\t/* Monitor\t\t\t*/\n#define\tAC_RESV_MASK\t\t0x07\t/* Reservation bits\t\t*/\n\n/* Frame Control field */\n#define\tFC_FT_MASK\t\t0xc0\t/* Frame Type\t\t\t*/\n#define\tFC_FT_MAC\t\t0x00\t/* MAC frame\t\t\t*/\n#define\tFC_FT_LLC\t\t0x40\t/* LLC frame\t\t\t*/\n#define\tFC_ATTN_MASK\t\t0x0f\t/* Attention bits\t\t*/\n#define\tFC_ATTN_EB\t\t0x01\t/* Express buffer\t\t*/\n#define\tFC_ATTN_BE\t\t0x02\t/* Beacon\t\t\t*/\n#define\tFC_ATTN_CT\t\t0x03\t/* Claim token\t\t\t*/\n#define\tFC_ATTN_RP\t\t0x04\t/* Ring purge\t\t\t*/\n#define\tFC_ATTN_AMP\t\t0x05\t/* Active monitor present\t*/\n#define\tFC_ATTN_SMP\t\t0x06\t/* Standby monitor present\t*/\n\n/* Token Ring destination address */\n#define\tDA_IG\t\t\t0x80\t/* Individual/group address.\t*/\n\t\t\t\t\t/* 0=Individual, 1=Group\t*/\n#define\tDA_UL\t\t\t0x40\t/* Universal/local address.\t*/\n\t\t\t\t\t/* 0=Universal, 1=Local\t\t*/\n/* Token Ring source address */\n#define\tSA_RII\t\t\t0x80\t/* Routing information indicator */\n#define\tSA_IG\t\t\t0x40\t/* Individual/group address\t*/\n\t\t\t\t\t/* 0=Group, 1=Individual\t*/\n\n/*\n * ISO 802.5 physical header\n */\nstruct iso88025_header {\n\tu_int8_t\tac;\t\t\t\t    /* access control field */\n\tu_int8_t\tfc;\t\t\t\t    /* frame control field */\n\tu_int8_t\tiso88025_dhost[ISO88025_ADDR_LEN];  /* destination address */\n\tu_int8_t\tiso88025_shost[ISO88025_ADDR_LEN];  /* source address */\n\tu_int16_t\trcf;\t\t\t\t    /* route control field */\n\tu_int16_t\trd[RIF_MAX_RD];\t\t\t    /* routing designators */\n} __packed;\n\nstruct iso88025_rif {\n\tu_int16_t\trcf;\t\t\t\t    /* route control field */\n\tu_int16_t\trd[RIF_MAX_RD];\t\t\t    /* routing designators */\n} __packed;\n\nstruct iso88025_sockaddr_data {\n\tu_char ether_dhost[ISO88025_ADDR_LEN];\n\tu_char ether_shost[ISO88025_ADDR_LEN];\n\tu_char ac;\n\tu_char fc;\n};\n\nstruct iso88025_sockaddr_dl_data {\n\tu_short\t trld_rcf;\n\tu_short\t*trld_route[RIF_MAX_LEN];\n};\n\n#define\tISO88025_MAX(a, b)\t(((a)>(b))?(a):(b))\n#define\tSDL_ISO88025(s)\t\t((struct iso88025_sockaddr_dl_data *)\t\\\n\t\t\t\t ((s)->sdl_data + \\\n\t\t\t\t  ISO88025_MAX((s)->sdl_nlen + (s)->sdl_alen + \\\n\t\t\t\t\t       (s)->sdl_slen, 12)))\n\n/*\n * Structure of a 48-bit iso 802.5 address.\n *  ( We could also add the 16 bit addresses as a union)\n */\nstruct\tiso88025_addr {\n\tu_char octet[ISO88025_ADDR_LEN];\n};\n\n#define\tISO88025_MAX_MTU\t\t18000\n#define\tISO88025_DEFAULT_MTU\t\t1500\n\n#define\tISO88025_BPF_UNSUPPORTED\t0\n#define\tISO88025_BPF_SUPPORTED\t\t1\n\nvoid\tiso88025_ifattach\t(struct ifnet *, const u_int8_t *, int);\nvoid\tiso88025_ifdetach\t(struct ifnet *, int);\nint\tiso88025_ioctl\t\t(struct ifnet *, u_long, caddr_t );\nint\tiso88025_output\t\t(struct ifnet *, struct mbuf *, struct sockaddr *,\n    \t\t\t\t struct route *);\nvoid\tiso88025_input\t\t(struct ifnet *, struct mbuf *);\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/net/netisr.h",
    "content": "/*-\n * Copyright (c) 2007-2009 Robert N. M. Watson\n * Copyright (c) 2010-2011 Juniper Networks, Inc.\n * All rights reserved.\n *\n * This software was developed by Robert N. M. Watson under contract\n * to Juniper Networks, Inc.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/net/netisr.h 222249 2011-05-24 12:34:19Z rwatson $\n */\n\n#ifndef _NET_NETISR_H_\n#define _NET_NETISR_H_\n\n/*\n * The netisr (network interrupt service routine) provides a deferred\n * execution evironment in which (generally inbound) network processing can\n * take place.  Protocols register handlers which will be executed directly,\n * or via deferred dispatch, depending on the circumstances.\n *\n * Historically, this was implemented by the BSD software ISR facility; it is\n * now implemented via a software ithread (SWI).\n */\n\n/*\n * Protocol numbers, which are encoded in monitoring applications and kernel\n * modules.  Internally, these are used in bit shift operations so must have\n * a value 0 < proto < 32; we currently further limit at compile-time to 16\n * for array-sizing purposes.\n */\n#define\tNETISR_IP\t1\n#define\tNETISR_IGMP\t2\t\t/* IGMPv3 output queue */\n#define\tNETISR_ROUTE\t3\t\t/* routing socket */\n#define\tNETISR_AARP\t4\t\t/* Appletalk ARP */\n#define\tNETISR_ATALK2\t5\t\t/* Appletalk phase 2 */\n#define\tNETISR_ATALK1\t6\t\t/* Appletalk phase 1 */\n#define\tNETISR_ARP\t7\t\t/* same as AF_LINK */\n#define\tNETISR_IPX\t8\t\t/* same as AF_IPX */\n#define\tNETISR_ETHER\t9\t\t/* ethernet input */\n#define\tNETISR_IPV6\t10\n#define\tNETISR_NATM\t11\n#define\tNETISR_EPAIR\t12\t\t/* if_epair(4) */\n\n/*\n * Protocol ordering and affinity policy constants.  See the detailed\n * discussion of policies later in the file.\n */\n#define\tNETISR_POLICY_SOURCE\t1\t/* Maintain source ordering. */\n#define\tNETISR_POLICY_FLOW\t2\t/* Maintain flow ordering. */\n#define\tNETISR_POLICY_CPU\t3\t/* Protocol determines CPU placement. */\n\n/*\n * Protocol dispatch policy constants; selects whether and when direct\n * dispatch is permitted.\n */\n#define\tNETISR_DISPATCH_DEFAULT\t\t0\t/* Use global default. */\n#define\tNETISR_DISPATCH_DEFERRED\t1\t/* Always defer dispatch. */\n#define\tNETISR_DISPATCH_HYBRID\t\t2\t/* Allow hybrid dispatch. */\n#define\tNETISR_DISPATCH_DIRECT\t\t3\t/* Always direct dispatch. */\n\n/*\n * Monitoring data structures, exported by sysctl(2).\n *\n * Three sysctls are defined.  First, a per-protocol structure exported by\n * net.isr.proto.\n */\n#define\tNETISR_NAMEMAXLEN\t32\nstruct sysctl_netisr_proto {\n\tu_int\tsnp_version;\t\t\t/* Length of struct. */\n\tchar\tsnp_name[NETISR_NAMEMAXLEN];\t/* nh_name */\n\tu_int\tsnp_proto;\t\t\t/* nh_proto */\n\tu_int\tsnp_qlimit;\t\t\t/* nh_qlimit */\n\tu_int\tsnp_policy;\t\t\t/* nh_policy */\n\tu_int\tsnp_flags;\t\t\t/* Various flags. */\n\tu_int\tsnp_dispatch;\t\t\t/* Dispatch policy. */\n\tu_int\t_snp_ispare[6];\n};\n\n/*\n * Flags for sysctl_netisr_proto.snp_flags.\n */\n#define\tNETISR_SNP_FLAGS_M2FLOW\t\t0x00000001\t/* nh_m2flow */\n#define\tNETISR_SNP_FLAGS_M2CPUID\t0x00000002\t/* nh_m2cpuid */\n#define\tNETISR_SNP_FLAGS_DRAINEDCPU\t0x00000004\t/* nh_drainedcpu */\n\n/*\n * Next, a structure per-workstream, with per-protocol data, exported as\n * net.isr.workstream.\n */\nstruct sysctl_netisr_workstream {\n\tu_int\tsnws_version;\t\t\t/* Length of struct. */\n\tu_int\tsnws_flags;\t\t\t/* Various flags. */\n\tu_int\tsnws_wsid;\t\t\t/* Workstream ID. */\n\tu_int\tsnws_cpu;\t\t\t/* nws_cpu */\n\tu_int\t_snws_ispare[12];\n};\n\n/*\n * Flags for sysctl_netisr_workstream.snws_flags\n */\n#define\tNETISR_SNWS_FLAGS_INTR\t\t0x00000001\t/* nws_intr_event */\n\n/*\n * Finally, a per-workstream-per-protocol structure, exported as\n * net.isr.work.\n */\nstruct sysctl_netisr_work {\n\tu_int\tsnw_version;\t\t\t/* Length of struct. */\n\tu_int\tsnw_wsid;\t\t\t/* Workstream ID. */\n\tu_int\tsnw_proto;\t\t\t/* Protocol number. */\n\tu_int\tsnw_len;\t\t\t/* nw_len */\n\tu_int\tsnw_watermark;\t\t\t/* nw_watermark */\n\tu_int\t_snw_ispare[3];\n\n\tuint64_t\tsnw_dispatched;\t\t/* nw_dispatched */\n\tuint64_t\tsnw_hybrid_dispatched;\t/* nw_hybrid_dispatched */\n\tuint64_t\tsnw_qdrops;\t\t/* nw_qdrops */\n\tuint64_t\tsnw_queued;\t\t/* nw_queued */\n\tuint64_t\tsnw_handled;\t\t/* nw_handled */\n\n\tuint64_t\t_snw_llspare[7];\n};\n\n#ifdef _KERNEL\n\n/*-\n * Protocols express ordering constraints and affinity preferences by\n * implementing one or neither of nh_m2flow and nh_m2cpuid, which are used by\n * netisr to determine which per-CPU workstream to assign mbufs to.\n *\n * The following policies may be used by protocols:\n *\n * NETISR_POLICY_SOURCE - netisr should maintain source ordering without\n *                        advice from the protocol.  netisr will ignore any\n *                        flow IDs present on the mbuf for the purposes of\n *                        work placement.\n *\n * NETISR_POLICY_FLOW - netisr should maintain flow ordering as defined by\n *                      the mbuf header flow ID field.  If the protocol\n *                      implements nh_m2flow, then netisr will query the\n *                      protocol in the event that the mbuf doesn't have a\n *                      flow ID, falling back on source ordering.\n *\n * NETISR_POLICY_CPU - netisr will delegate all work placement decisions to\n *                     the protocol, querying nh_m2cpuid for each packet.\n *\n * Protocols might make decisions about work placement based on an existing\n * calculated flow ID on the mbuf, such as one provided in hardware, the\n * receive interface pointed to by the mbuf (if any), the optional source\n * identifier passed at some dispatch points, or even parse packet headers to\n * calculate a flow.  Both protocol handlers may return a new mbuf pointer\n * for the chain, or NULL if the packet proves invalid or m_pullup() fails.\n *\n * XXXRW: If we eventually support dynamic reconfiguration, there should be\n * protocol handlers to notify them of CPU configuration changes so that they\n * can rebalance work.\n */\nstruct mbuf;\ntypedef void\t\t netisr_handler_t(struct mbuf *m);\ntypedef struct mbuf\t*netisr_m2cpuid_t(struct mbuf *m, uintptr_t source,\n\t\t\t u_int *cpuid);\ntypedef\tstruct mbuf\t*netisr_m2flow_t(struct mbuf *m, uintptr_t source);\ntypedef void\t\t netisr_drainedcpu_t(u_int cpuid);\n\n#define\tNETISR_CPUID_NONE\t((u_int)-1)\t/* No affinity returned. */\n\n/*\n * Data structure describing a protocol handler.\n */\nstruct netisr_handler {\n\tconst char\t*nh_name;\t/* Character string protocol name. */\n\tnetisr_handler_t *nh_handler;\t/* Protocol handler. */\n\tnetisr_m2flow_t\t*nh_m2flow;\t/* Query flow for untagged packet. */\n\tnetisr_m2cpuid_t *nh_m2cpuid;\t/* Query CPU to process mbuf on. */\n\tnetisr_drainedcpu_t *nh_drainedcpu; /* Callback when drained a queue. */\n\tu_int\t\t nh_proto;\t/* Integer protocol ID. */\n\tu_int\t\t nh_qlimit;\t/* Maximum per-CPU queue depth. */\n\tu_int\t\t nh_policy;\t/* Work placement policy. */\n\tu_int\t\t nh_dispatch;\t/* Dispatch policy. */\n\tu_int\t\t nh_ispare[4];\t/* For future use. */\n\tvoid\t\t*nh_pspare[4];\t/* For future use. */\n};\n\n/*\n * Register, unregister, and other netisr handler management functions.\n */\nvoid\tnetisr_clearqdrops(const struct netisr_handler *nhp);\nvoid\tnetisr_getqdrops(const struct netisr_handler *nhp,\n\t    u_int64_t *qdropsp);\nvoid\tnetisr_getqlimit(const struct netisr_handler *nhp, u_int *qlimitp);\nvoid\tnetisr_register(const struct netisr_handler *nhp);\nint\tnetisr_setqlimit(const struct netisr_handler *nhp, u_int qlimit);\nvoid\tnetisr_unregister(const struct netisr_handler *nhp);\n\n/*\n * Process a packet destined for a protocol, and attempt direct dispatch.\n * Supplemental source ordering information can be passed using the _src\n * variant.\n */\nint\tnetisr_dispatch(u_int proto, struct mbuf *m);\nint\tnetisr_dispatch_src(u_int proto, uintptr_t source, struct mbuf *m);\nint\tnetisr_queue(u_int proto, struct mbuf *m);\nint\tnetisr_queue_src(u_int proto, uintptr_t source, struct mbuf *m);\n\n/*\n * Provide a default implementation of \"map an ID to a CPU ID\".\n */\nu_int\tnetisr_default_flow2cpu(u_int flowid);\n\n/*\n * Utility routines to return the number of CPUs participting in netisr, and\n * to return a mapping from a number to a CPU ID that can be used with the\n * scheduler.\n */\nu_int\tnetisr_get_cpucount(void);\nu_int\tnetisr_get_cpuid(u_int cpunumber);\n\n/*\n * Interfaces between DEVICE_POLLING and netisr.\n */\nvoid\tnetisr_sched_poll(void);\nvoid\tnetisr_poll(void);\nvoid\tnetisr_pollmore(void);\n\n#endif /* !_KERNEL */\n#endif /* !_NET_NETISR_H_ */\n"
  },
  {
    "path": "freebsd-headers/net/netisr_internal.h",
    "content": "/*-\n * Copyright (c) 2007-2009 Robert N. M. Watson\n * Copyright (c) 2010-2011 Juniper Networks, Inc.\n * All rights reserved.\n *\n * This software was developed by Robert N. M. Watson under contract\n * to Juniper Networks, Inc.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/net/netisr_internal.h 222249 2011-05-24 12:34:19Z rwatson $\n */\n\n#ifndef _NET_NETISR_INTERNAL_H_\n#define\t_NET_NETISR_INTERNAL_H_\n\n#ifndef _WANT_NETISR_INTERNAL\n#error \"no user-serviceable parts inside\"\n#endif\n\n/*\n * These definitions are private to the netisr implementation, but provided\n * here for use by post-mortem crashdump analysis tools.  They should not be\n * used in any other context as they can and will change.  Public definitions\n * may be found in netisr.h.\n */\n\n#ifndef _KERNEL\ntypedef void *netisr_handler_t;\ntypedef void *netisr_m2flow_t;\ntypedef void *netisr_m2cpuid_t;\ntypedef void *netisr_drainedcpu_t;\n#endif\n\n/*\n * Each protocol is described by a struct netisr_proto, which holds all\n * global per-protocol information.  This data structure is set up by\n * netisr_register(), and derived from the public struct netisr_handler.\n */\nstruct netisr_proto {\n\tconst char\t*np_name;\t/* Character string protocol name. */\n\tnetisr_handler_t *np_handler;\t/* Protocol handler. */\n\tnetisr_m2flow_t\t*np_m2flow;\t/* Query flow for untagged packet. */\n\tnetisr_m2cpuid_t *np_m2cpuid;\t/* Query CPU to process packet on. */\n\tnetisr_drainedcpu_t *np_drainedcpu; /* Callback when drained a queue. */\n\tu_int\t\t np_qlimit;\t/* Maximum per-CPU queue depth. */\n\tu_int\t\t np_policy;\t/* Work placement policy. */\n\tu_int\t\t np_dispatch;\t/* Work dispatch policy. */\n};\n\n#define\tNETISR_MAXPROT\t16\t\t/* Compile-time limit. */\n\n/*\n * Protocol-specific work for each workstream is described by struct\n * netisr_work.  Each work descriptor consists of an mbuf queue and\n * statistics.\n */\nstruct netisr_work {\n\t/*\n\t * Packet queue, linked by m_nextpkt.\n\t */\n\tstruct mbuf\t*nw_head;\n\tstruct mbuf\t*nw_tail;\n\tu_int\t\t nw_len;\n\tu_int\t\t nw_qlimit;\n\tu_int\t\t nw_watermark;\n\n\t/*\n\t * Statistics -- written unlocked, but mostly from curcpu.\n\t */\n\tu_int64_t\t nw_dispatched; /* Number of direct dispatches. */\n\tu_int64_t\t nw_hybrid_dispatched; /* \"\" hybrid dispatches. */\n\tu_int64_t\t nw_qdrops;\t/* \"\" drops. */\n\tu_int64_t\t nw_queued;\t/* \"\" enqueues. */\n\tu_int64_t\t nw_handled;\t/* \"\" handled in worker. */\n};\n\n/*\n * Workstreams hold a queue of ordered work across each protocol, and are\n * described by netisr_workstream.  Each workstream is associated with a\n * worker thread, which in turn is pinned to a CPU.  Work associated with a\n * workstream can be processd in other threads during direct dispatch;\n * concurrent processing is prevented by the NWS_RUNNING flag, which\n * indicates that a thread is already processing the work queue.  It is\n * important to prevent a directly dispatched packet from \"skipping ahead\" of\n * work already in the workstream queue.\n */\nstruct netisr_workstream {\n\tstruct intr_event *nws_intr_event;\t/* Handler for stream. */\n\tvoid\t\t*nws_swi_cookie;\t/* swi(9) cookie for stream. */\n\tstruct mtx\t nws_mtx;\t\t/* Synchronize work. */\n\tu_int\t\t nws_cpu;\t\t/* CPU pinning. */\n\tu_int\t\t nws_flags;\t\t/* Wakeup flags. */\n\tu_int\t\t nws_pendingbits;\t/* Scheduled protocols. */\n\n\t/*\n\t * Each protocol has per-workstream data.\n\t */\n\tstruct netisr_work\tnws_work[NETISR_MAXPROT];\n} __aligned(CACHE_LINE_SIZE);\n\n/*\n * Per-workstream flags.\n */\n#define\tNWS_RUNNING\t0x00000001\t/* Currently running in a thread. */\n#define\tNWS_DISPATCHING\t0x00000002\t/* Currently being direct-dispatched. */\n#define\tNWS_SCHEDULED\t0x00000004\t/* Signal issued. */\n\n#endif /* !_NET_NETISR_INTERNAL_H_ */\n"
  },
  {
    "path": "freebsd-headers/net/pf_mtag.h",
    "content": "/*\t$FreeBSD: release/9.0.0/sys/contrib/pf/net/pf_mtag.h 223637 2011-06-28 11:57:25Z bz $\t*/\n/*\n * Copyright (c) 2001 Daniel Hartmeier\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n *\n *    - Redistributions of source code must retain the above copyright\n *      notice, this list of conditions and the following disclaimer.\n *    - Redistributions in binary form must reproduce the above\n *      copyright notice, this list of conditions and the following\n *      disclaimer in the documentation and/or other materials provided\n *      with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n * \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS\n * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE\n * COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,\n * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,\n * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\n * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n *\n */\n\n#ifndef _NET_PF_MTAG_H_\n#define _NET_PF_MTAG_H_\n\n#ifdef _KERNEL\n\n#define\tPF_TAG_GENERATED\t\t0x01\n#define\tPF_TAG_FRAGCACHE\t\t0x02\n#define\tPF_TAG_TRANSLATE_LOCALHOST\t0x04\n#define\tPF_PACKET_LOOPED\t\t0x08\n#define\tPF_FASTFWD_OURS_PRESENT\t\t0x10\n\nstruct pf_mtag {\n\tvoid\t\t*hdr;\t\t/* saved hdr pos in mbuf, for ECN */\n\tvoid\t\t*statekey;\t/* pf stackside statekey */\n\tu_int32_t\t qid;\t\t/* queue id */\n\tu_int\t\t rtableid;\t/* alternate routing table id */\n\tu_int16_t\t tag;\t\t/* tag id */\n\tu_int8_t\t flags;\n\tu_int8_t\t routed;\n};\n\nstatic __inline struct pf_mtag *pf_find_mtag(struct mbuf *);\nstatic __inline struct pf_mtag *pf_get_mtag(struct mbuf *);\n\nstatic __inline struct pf_mtag *\npf_find_mtag(struct mbuf *m)\n{\n\tstruct m_tag\t*mtag;\n\n\tif ((mtag = m_tag_find(m, PACKET_TAG_PF, NULL)) == NULL)\n\t\treturn (NULL);\n\n\treturn ((struct pf_mtag *)(mtag + 1));\n}\n\nstatic __inline struct pf_mtag *\npf_get_mtag(struct mbuf *m)\n{\n\tstruct m_tag\t*mtag;\n\n\tif ((mtag = m_tag_find(m, PACKET_TAG_PF, NULL)) == NULL) {\n\t\tmtag = m_tag_get(PACKET_TAG_PF, sizeof(struct pf_mtag),\n\t\t    M_NOWAIT);\n\t\tif (mtag == NULL)\n\t\t\treturn (NULL);\n\t\tbzero(mtag + 1, sizeof(struct pf_mtag));\n\t\tm_tag_prepend(m, mtag);\n\t}\n\n\treturn ((struct pf_mtag *)(mtag + 1));\n}\n#endif /* _KERNEL */\n#endif /* _NET_PF_MTAG_H_ */\n"
  },
  {
    "path": "freebsd-headers/net/pfil.h",
    "content": "/*\t$FreeBSD: release/9.0.0/sys/net/pfil.h 210121 2010-07-15 14:41:06Z luigi $ */\n/*\t$NetBSD: pfil.h,v 1.22 2003/06/23 12:57:08 martin Exp $\t*/\n\n/*-\n * Copyright (c) 1996 Matthew R. Green\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. The name of the author may not be used to endorse or promote products\n *    derived from this software without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR\n * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES\n * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,\n * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,\n * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\n * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED\n * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,\n * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n */\n\n#ifndef _NET_PFIL_H_\n#define _NET_PFIL_H_\n\n#include <sys/systm.h>\n#include <sys/queue.h>\n#include <sys/_lock.h>\n#include <sys/_mutex.h>\n#include <sys/lock.h>\n#include <sys/rmlock.h>\n\nstruct mbuf;\nstruct ifnet;\nstruct inpcb;\n\n/*\n * The packet filter hooks are designed for anything to call them to\n * possibly intercept the packet.\n */\nstruct packet_filter_hook {\n        TAILQ_ENTRY(packet_filter_hook) pfil_link;\n\tint\t(*pfil_func)(void *, struct mbuf **, struct ifnet *, int,\n\t\t    struct inpcb *);\n\tvoid\t*pfil_arg;\n};\n\n#define PFIL_IN\t\t0x00000001\n#define PFIL_OUT\t0x00000002\n#define PFIL_WAITOK\t0x00000004\n#define PFIL_ALL\t(PFIL_IN|PFIL_OUT)\n\ntypedef\tTAILQ_HEAD(pfil_list, packet_filter_hook) pfil_list_t;\n\n#define\tPFIL_TYPE_AF\t\t1\t/* key is AF_* type */\n#define\tPFIL_TYPE_IFNET\t\t2\t/* key is ifnet pointer */\n\nstruct pfil_head {\n\tpfil_list_t\tph_in;\n\tpfil_list_t\tph_out;\n\tint\t\tph_type;\n\tint\t\tph_nhooks;\n#if defined( __linux__ ) || defined( _WIN32 )\n\trwlock_t\tph_mtx;\n#else\n\tstruct rmlock\tph_lock;\n#endif\n\tunion {\n\t\tu_long\t\tphu_val;\n\t\tvoid\t\t*phu_ptr;\n\t} ph_un;\n#define\tph_af\t\tph_un.phu_val\n#define\tph_ifnet\tph_un.phu_ptr\n\tLIST_ENTRY(pfil_head) ph_list;\n};\n\nint\tpfil_add_hook(int (*func)(void *, struct mbuf **, struct ifnet *,\n\t    int, struct inpcb *), void *, int, struct pfil_head *);\nint\tpfil_remove_hook(int (*func)(void *, struct mbuf **, struct ifnet *,\n\t    int, struct inpcb *), void *, int, struct pfil_head *);\nint\tpfil_run_hooks(struct pfil_head *, struct mbuf **, struct ifnet *,\n\t    int, struct inpcb *inp);\n\nint\tpfil_head_register(struct pfil_head *);\nint\tpfil_head_unregister(struct pfil_head *);\n\nstruct pfil_head *pfil_head_get(int, u_long);\n\n#define\tPFIL_HOOKED(p) ((p)->ph_nhooks > 0)\n#define\tPFIL_LOCK_INIT(p) \\\n    rm_init_flags(&(p)->ph_lock, \"PFil hook read/write mutex\", RM_RECURSE)\n#define\tPFIL_LOCK_DESTROY(p) rm_destroy(&(p)->ph_lock)\n#define PFIL_RLOCK(p, t) rm_rlock(&(p)->ph_lock, (t))\n#define PFIL_WLOCK(p) rm_wlock(&(p)->ph_lock)\n#define PFIL_RUNLOCK(p, t) rm_runlock(&(p)->ph_lock, (t))\n#define PFIL_WUNLOCK(p) rm_wunlock(&(p)->ph_lock)\n#define PFIL_LIST_LOCK() mtx_lock(&pfil_global_lock)\n#define PFIL_LIST_UNLOCK() mtx_unlock(&pfil_global_lock)\n\nstatic __inline struct packet_filter_hook *\npfil_hook_get(int dir, struct pfil_head *ph)\n{\n\n\tif (dir == PFIL_IN)\n\t\treturn (TAILQ_FIRST(&ph->ph_in));\n\telse if (dir == PFIL_OUT)\n\t\treturn (TAILQ_FIRST(&ph->ph_out));\n\telse\n\t\treturn (NULL);\n}\n\n#endif /* _NET_PFIL_H_ */\n"
  },
  {
    "path": "freebsd-headers/net/pfkeyv2.h",
    "content": "/*\t$FreeBSD: release/9.0.0/sys/net/pfkeyv2.h 194062 2009-06-12 15:44:35Z vanhu $\t*/\n/*\t$KAME: pfkeyv2.h,v 1.37 2003/09/06 05:15:43 itojun Exp $\t*/\n\n/*-\n * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. Neither the name of the project nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n */\n\n/*\n * This file has been derived rfc 2367,\n * And added some flags of SADB_KEY_FLAGS_ as SADB_X_EXT_.\n *\tsakane@ydc.co.jp\n */\n\n#ifndef _NET_PFKEYV2_H_\n#define _NET_PFKEYV2_H_\n\n/*\nThis file defines structures and symbols for the PF_KEY Version 2\nkey management interface. It was written at the U.S. Naval Research\nLaboratory. This file is in the public domain. The authors ask that\nyou leave this credit intact on any copies of this file.\n*/\n#ifndef __PFKEY_V2_H\n#define __PFKEY_V2_H 1\n\n#define PF_KEY_V2 2\n#define PFKEYV2_REVISION        199806L\n\n#define SADB_RESERVED    0\n#define SADB_GETSPI      1\n#define SADB_UPDATE      2\n#define SADB_ADD         3\n#define SADB_DELETE      4\n#define SADB_GET         5\n#define SADB_ACQUIRE     6\n#define SADB_REGISTER    7\n#define SADB_EXPIRE      8\n#define SADB_FLUSH       9\n#define SADB_DUMP        10\n#define SADB_X_PROMISC   11\n#define SADB_X_PCHANGE   12\n\n#define SADB_X_SPDUPDATE  13\n#define SADB_X_SPDADD     14\n#define SADB_X_SPDDELETE  15\t/* by policy index */\n#define SADB_X_SPDGET     16\n#define SADB_X_SPDACQUIRE 17\n#define SADB_X_SPDDUMP    18\n#define SADB_X_SPDFLUSH   19\n#define SADB_X_SPDSETIDX  20\n#define SADB_X_SPDEXPIRE  21\n#define SADB_X_SPDDELETE2 22\t/* by policy id */\n#define SADB_MAX          22\n\nstruct sadb_msg {\n  u_int8_t sadb_msg_version;\n  u_int8_t sadb_msg_type;\n  u_int8_t sadb_msg_errno;\n  u_int8_t sadb_msg_satype;\n  u_int16_t sadb_msg_len;\n  u_int16_t sadb_msg_reserved;\n  u_int32_t sadb_msg_seq;\n  u_int32_t sadb_msg_pid;\n};\n\nstruct sadb_ext {\n  u_int16_t sadb_ext_len;\n  u_int16_t sadb_ext_type;\n};\n\nstruct sadb_sa {\n  u_int16_t sadb_sa_len;\n  u_int16_t sadb_sa_exttype;\n  u_int32_t sadb_sa_spi;\n  u_int8_t sadb_sa_replay;\n  u_int8_t sadb_sa_state;\n  u_int8_t sadb_sa_auth;\n  u_int8_t sadb_sa_encrypt;\n  u_int32_t sadb_sa_flags;\n};\n\nstruct sadb_lifetime {\n  u_int16_t sadb_lifetime_len;\n  u_int16_t sadb_lifetime_exttype;\n  u_int32_t sadb_lifetime_allocations;\n  u_int64_t sadb_lifetime_bytes;\n  u_int64_t sadb_lifetime_addtime;\n  u_int64_t sadb_lifetime_usetime;\n};\n\nstruct sadb_address {\n  u_int16_t sadb_address_len;\n  u_int16_t sadb_address_exttype;\n  u_int8_t sadb_address_proto;\n  u_int8_t sadb_address_prefixlen;\n  u_int16_t sadb_address_reserved;\n};\n\nstruct sadb_key {\n  u_int16_t sadb_key_len;\n  u_int16_t sadb_key_exttype;\n  u_int16_t sadb_key_bits;\n  u_int16_t sadb_key_reserved;\n};\n\nstruct sadb_ident {\n  u_int16_t sadb_ident_len;\n  u_int16_t sadb_ident_exttype;\n  u_int16_t sadb_ident_type;\n  u_int16_t sadb_ident_reserved;\n  u_int64_t sadb_ident_id;\n};\n\nstruct sadb_sens {\n  u_int16_t sadb_sens_len;\n  u_int16_t sadb_sens_exttype;\n  u_int32_t sadb_sens_dpd;\n  u_int8_t sadb_sens_sens_level;\n  u_int8_t sadb_sens_sens_len;\n  u_int8_t sadb_sens_integ_level;\n  u_int8_t sadb_sens_integ_len;\n  u_int32_t sadb_sens_reserved;\n};\n\nstruct sadb_prop {\n  u_int16_t sadb_prop_len;\n  u_int16_t sadb_prop_exttype;\n  u_int8_t sadb_prop_replay;\n  u_int8_t sadb_prop_reserved[3];\n};\n\nstruct sadb_comb {\n  u_int8_t sadb_comb_auth;\n  u_int8_t sadb_comb_encrypt;\n  u_int16_t sadb_comb_flags;\n  u_int16_t sadb_comb_auth_minbits;\n  u_int16_t sadb_comb_auth_maxbits;\n  u_int16_t sadb_comb_encrypt_minbits;\n  u_int16_t sadb_comb_encrypt_maxbits;\n  u_int32_t sadb_comb_reserved;\n  u_int32_t sadb_comb_soft_allocations;\n  u_int32_t sadb_comb_hard_allocations;\n  u_int64_t sadb_comb_soft_bytes;\n  u_int64_t sadb_comb_hard_bytes;\n  u_int64_t sadb_comb_soft_addtime;\n  u_int64_t sadb_comb_hard_addtime;\n  u_int64_t sadb_comb_soft_usetime;\n  u_int64_t sadb_comb_hard_usetime;\n};\n\nstruct sadb_supported {\n  u_int16_t sadb_supported_len;\n  u_int16_t sadb_supported_exttype;\n  u_int32_t sadb_supported_reserved;\n};\n\nstruct sadb_alg {\n  u_int8_t sadb_alg_id;\n  u_int8_t sadb_alg_ivlen;\n  u_int16_t sadb_alg_minbits;\n  u_int16_t sadb_alg_maxbits;\n  u_int16_t sadb_alg_reserved;\n};\n\nstruct sadb_spirange {\n  u_int16_t sadb_spirange_len;\n  u_int16_t sadb_spirange_exttype;\n  u_int32_t sadb_spirange_min;\n  u_int32_t sadb_spirange_max;\n  u_int32_t sadb_spirange_reserved;\n};\n\nstruct sadb_x_kmprivate {\n  u_int16_t sadb_x_kmprivate_len;\n  u_int16_t sadb_x_kmprivate_exttype;\n  u_int32_t sadb_x_kmprivate_reserved;\n};\n\n/*\n * XXX Additional SA Extension.\n * mode: tunnel or transport\n * reqid: to make SA unique nevertheless the address pair of SA are same.\n *        Mainly it's for VPN.\n */\nstruct sadb_x_sa2 {\n  u_int16_t sadb_x_sa2_len;\n  u_int16_t sadb_x_sa2_exttype;\n  u_int8_t sadb_x_sa2_mode;\n  u_int8_t sadb_x_sa2_reserved1;\n  u_int16_t sadb_x_sa2_reserved2;\n  u_int32_t sadb_x_sa2_sequence;\t/* lowermost 32bit of sequence number */\n  u_int32_t sadb_x_sa2_reqid;\n};\n\n/* XXX Policy Extension */\n/* sizeof(struct sadb_x_policy) == 16 */\nstruct sadb_x_policy {\n  u_int16_t sadb_x_policy_len;\n  u_int16_t sadb_x_policy_exttype;\n  u_int16_t sadb_x_policy_type;\t\t/* See policy type of ipsec.h */\n  u_int8_t sadb_x_policy_dir;\t\t/* direction, see ipsec.h */\n  u_int8_t sadb_x_policy_reserved;\n  u_int32_t sadb_x_policy_id;\n  u_int32_t sadb_x_policy_reserved2;\n};\n/*\n * When policy_type == IPSEC, it is followed by some of\n * the ipsec policy request.\n * [total length of ipsec policy requests]\n *\t= (sadb_x_policy_len * sizeof(uint64_t) - sizeof(struct sadb_x_policy))\n */\n\n/* XXX IPsec Policy Request Extension */\n/*\n * This structure is aligned 8 bytes.\n */\nstruct sadb_x_ipsecrequest {\n  u_int16_t sadb_x_ipsecrequest_len;\t/* structure length in 64 bits. */\n  u_int16_t sadb_x_ipsecrequest_proto;\t/* See ipsec.h */\n  u_int8_t sadb_x_ipsecrequest_mode;\t/* See IPSEC_MODE_XX in ipsec.h. */\n  u_int8_t sadb_x_ipsecrequest_level;\t/* See IPSEC_LEVEL_XX in ipsec.h */\n  u_int16_t sadb_x_ipsecrequest_reqid;\t/* See ipsec.h */\n\n  /*\n   * followed by source IP address of SA, and immediately followed by\n   * destination IP address of SA.  These encoded into two of sockaddr\n   * structure without any padding.  Must set each sa_len exactly.\n   * Each of length of the sockaddr structure are not aligned to 64bits,\n   * but sum of x_request and addresses is aligned to 64bits.\n   */\n};\n\n/* NAT-Traversal type, see RFC 3948 (and drafts). */\n/* sizeof(struct sadb_x_nat_t_type) == 8 */\nstruct sadb_x_nat_t_type {\n  u_int16_t sadb_x_nat_t_type_len;\n  u_int16_t sadb_x_nat_t_type_exttype;\n  u_int8_t sadb_x_nat_t_type_type;\n  u_int8_t sadb_x_nat_t_type_reserved[3];\n};\n\n/* NAT-Traversal source or destination port. */\n/* sizeof(struct sadb_x_nat_t_port) == 8 */\nstruct sadb_x_nat_t_port { \n  u_int16_t sadb_x_nat_t_port_len;\n  u_int16_t sadb_x_nat_t_port_exttype;\n  u_int16_t sadb_x_nat_t_port_port;\n  u_int16_t sadb_x_nat_t_port_reserved;\n};\n\n/* ESP fragmentation size. */\n/* sizeof(struct sadb_x_nat_t_frag) == 8 */\nstruct sadb_x_nat_t_frag {\n  u_int16_t sadb_x_nat_t_frag_len;\n  u_int16_t sadb_x_nat_t_frag_exttype;\n  u_int16_t sadb_x_nat_t_frag_fraglen;\n  u_int16_t sadb_x_nat_t_frag_reserved;\n};\n\n\n#define SADB_EXT_RESERVED             0\n#define SADB_EXT_SA                   1\n#define SADB_EXT_LIFETIME_CURRENT     2\n#define SADB_EXT_LIFETIME_HARD        3\n#define SADB_EXT_LIFETIME_SOFT        4\n#define SADB_EXT_ADDRESS_SRC          5\n#define SADB_EXT_ADDRESS_DST          6\n#define SADB_EXT_ADDRESS_PROXY        7\n#define SADB_EXT_KEY_AUTH             8\n#define SADB_EXT_KEY_ENCRYPT          9\n#define SADB_EXT_IDENTITY_SRC         10\n#define SADB_EXT_IDENTITY_DST         11\n#define SADB_EXT_SENSITIVITY          12\n#define SADB_EXT_PROPOSAL             13\n#define SADB_EXT_SUPPORTED_AUTH       14\n#define SADB_EXT_SUPPORTED_ENCRYPT    15\n#define SADB_EXT_SPIRANGE             16\n#define SADB_X_EXT_KMPRIVATE          17\n#define SADB_X_EXT_POLICY             18\n#define SADB_X_EXT_SA2                19\n#define SADB_X_EXT_NAT_T_TYPE         20\n#define SADB_X_EXT_NAT_T_SPORT        21\n#define SADB_X_EXT_NAT_T_DPORT        22\n#define SADB_X_EXT_NAT_T_OA           23\t/* Deprecated. */\n#define SADB_X_EXT_NAT_T_OAI          23\t/* Peer's NAT_OA for src of SA. */\n#define SADB_X_EXT_NAT_T_OAR          24\t/* Peer's NAT_OA for dst of SA. */\n#define SADB_X_EXT_NAT_T_FRAG         25\t/* Manual MTU override. */\n#define SADB_EXT_MAX                  25\n\n#define SADB_SATYPE_UNSPEC\t0\n#define SADB_SATYPE_AH\t\t2\n#define SADB_SATYPE_ESP\t\t3\n#define SADB_SATYPE_RSVP\t5\n#define SADB_SATYPE_OSPFV2\t6\n#define SADB_SATYPE_RIPV2\t7\n#define SADB_SATYPE_MIP\t\t8\n#define SADB_X_SATYPE_IPCOMP\t9\n/*#define SADB_X_SATYPE_POLICY\t10\tobsolete, do not reuse */\n#define SADB_X_SATYPE_TCPSIGNATURE\t11\n#define SADB_SATYPE_MAX\t\t12\n\n#define SADB_SASTATE_LARVAL   0\n#define SADB_SASTATE_MATURE   1\n#define SADB_SASTATE_DYING    2\n#define SADB_SASTATE_DEAD     3\n#define SADB_SASTATE_MAX      3\n\n#define SADB_SAFLAGS_PFS      1\n\n/* RFC2367 numbers - meets RFC2407 */\n#define SADB_AALG_NONE\t\t0\n#define SADB_AALG_MD5HMAC\t2\n#define SADB_AALG_SHA1HMAC\t3\n#define SADB_AALG_MAX\t\t252\n/* private allocations - based on RFC2407/IANA assignment */\n#define SADB_X_AALG_SHA2_256\t5\n#define SADB_X_AALG_SHA2_384\t6\n#define SADB_X_AALG_SHA2_512\t7\n#define SADB_X_AALG_RIPEMD160HMAC\t8\n#define SADB_X_AALG_AES_XCBC_MAC\t9\t/* draft-ietf-ipsec-ciph-aes-xcbc-mac-04 */\n/* private allocations should use 249-255 (RFC2407) */\n#define SADB_X_AALG_MD5\t\t249\t/* Keyed MD5 */\n#define SADB_X_AALG_SHA\t\t250\t/* Keyed SHA */\n#define SADB_X_AALG_NULL\t251\t/* null authentication */\n#define SADB_X_AALG_TCP_MD5\t252\t/* Keyed TCP-MD5 (RFC2385) */\n\n/* RFC2367 numbers - meets RFC2407 */\n#define SADB_EALG_NONE\t\t0\n#define SADB_EALG_DESCBC\t2\n#define SADB_EALG_3DESCBC\t3\n#define SADB_EALG_NULL\t\t11\n#define SADB_EALG_MAX\t\t250\n/* private allocations - based on RFC2407/IANA assignment */\n#define SADB_X_EALG_CAST128CBC\t6\n#define SADB_X_EALG_BLOWFISHCBC\t7\n#define SADB_X_EALG_RIJNDAELCBC\t12\n#define SADB_X_EALG_AES\t\t12\n/* private allocations - based on RFC4312/IANA assignment */\n#define SADB_X_EALG_CAMELLIACBC\t\t22\n/* private allocations should use 249-255 (RFC2407) */\n#define SADB_X_EALG_SKIPJACK\t249\t/*250*/ /* for IPSEC */\n#define SADB_X_EALG_AESCTR\t250\t/*249*/ /* draft-ietf-ipsec-ciph-aes-ctr-03 */\n\n/* private allocations - based on RFC2407/IANA assignment */\n#define SADB_X_CALG_NONE\t0\n#define SADB_X_CALG_OUI\t\t1\n#define SADB_X_CALG_DEFLATE\t2\n#define SADB_X_CALG_LZS\t\t3\n#define SADB_X_CALG_MAX\t\t4\n\n#define SADB_IDENTTYPE_RESERVED   0\n#define SADB_IDENTTYPE_PREFIX     1\n#define SADB_IDENTTYPE_FQDN       2\n#define SADB_IDENTTYPE_USERFQDN   3\n#define SADB_X_IDENTTYPE_ADDR     4\n#define SADB_IDENTTYPE_MAX        4\n\n/* `flags' in sadb_sa structure holds followings */\n#define SADB_X_EXT_NONE\t\t0x0000\t/* i.e. new format. */\n#define SADB_X_EXT_OLD\t\t0x0001\t/* old format. */\n\n#define SADB_X_EXT_IV4B\t\t0x0010\t/* IV length of 4 bytes in use */\n#define SADB_X_EXT_DERIV\t0x0020\t/* DES derived */\n#define SADB_X_EXT_CYCSEQ\t0x0040\t/* allowing to cyclic sequence. */\n\n\t/* three of followings are exclusive flags each them */\n#define SADB_X_EXT_PSEQ\t\t0x0000\t/* sequencial padding for ESP */\n#define SADB_X_EXT_PRAND\t0x0100\t/* random padding for ESP */\n#define SADB_X_EXT_PZERO\t0x0200\t/* zero padding for ESP */\n#define SADB_X_EXT_PMASK\t0x0300\t/* mask for padding flag */\n\n#if 1\n#define SADB_X_EXT_RAWCPI\t0x0080\t/* use well known CPI (IPComp) */\n#endif\n\n#define SADB_KEY_FLAGS_MAX\t0x0fff\n\n/* SPI size for PF_KEYv2 */\n#define PFKEY_SPI_SIZE\tsizeof(u_int32_t)\n\n/* Identifier for menber of lifetime structure */\n#define SADB_X_LIFETIME_ALLOCATIONS\t0\n#define SADB_X_LIFETIME_BYTES\t\t1\n#define SADB_X_LIFETIME_ADDTIME\t\t2\n#define SADB_X_LIFETIME_USETIME\t\t3\n\n/* The rate for SOFT lifetime against HARD one. */\n#define PFKEY_SOFT_LIFETIME_RATE\t80\n\n/* Utilities */\n#define PFKEY_ALIGN8(a) (1 + (((a) - 1) | (8 - 1)))\n#define\tPFKEY_EXTLEN(msg) \\\n\tPFKEY_UNUNIT64(((struct sadb_ext *)(msg))->sadb_ext_len)\n#define PFKEY_ADDR_PREFIX(ext) \\\n\t(((struct sadb_address *)(ext))->sadb_address_prefixlen)\n#define PFKEY_ADDR_PROTO(ext) \\\n\t(((struct sadb_address *)(ext))->sadb_address_proto)\n#define PFKEY_ADDR_SADDR(ext) \\\n\t((struct sockaddr *)((caddr_t)(ext) + sizeof(struct sadb_address)))\n\n/* in 64bits */\n#define\tPFKEY_UNUNIT64(a)\t((a) << 3)\n#define\tPFKEY_UNIT64(a)\t\t((a) >> 3)\n\n#endif /* __PFKEY_V2_H */\n\n#endif /* _NET_PFKEYV2_H_ */\n"
  },
  {
    "path": "freebsd-headers/net/pfvar.h",
    "content": "/*\t$OpenBSD: pfvar.h,v 1.282 2009/01/29 15:12:28 pyr Exp $ */\n\n/*\n * Copyright (c) 2001 Daniel Hartmeier\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n *\n *    - Redistributions of source code must retain the above copyright\n *      notice, this list of conditions and the following disclaimer.\n *    - Redistributions in binary form must reproduce the above\n *      copyright notice, this list of conditions and the following\n *      disclaimer in the documentation and/or other materials provided\n *      with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n * \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS\n * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE\n * COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,\n * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,\n * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\n * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n *\n */\n\n#ifndef _NET_PFVAR_H_\n#define _NET_PFVAR_H_\n\n#include <sys/param.h>\n#include <sys/types.h>\n#include <sys/queue.h>\n#include <sys/tree.h>\n#ifdef __FreeBSD__\n#include <sys/lock.h>\n#include <sys/sx.h>\n#else\n#include <sys/rwlock.h>\n#endif\n\n#include <net/radix.h>\n#include <net/route.h>\n#ifdef __FreeBSD__\n#include <net/if_clone.h>\n#include <net/pf_mtag.h>\n#include <vm/uma.h>\n#else\n#include <netinet/ip_ipsp.h>\n#endif\n\n#ifdef __FreeBSD__\n#include <netinet/in.h>\n#endif\n\n#include <netinet/tcp_fsm.h>\n\nstruct ip;\nstruct ip6_hdr;\n#ifdef __FreeBSD__\nstruct inpcb;\n#endif\n\n#define\tPF_TCPS_PROXY_SRC\t((TCP_NSTATES)+0)\n#define\tPF_TCPS_PROXY_DST\t((TCP_NSTATES)+1)\n\n#define\tPF_MD5_DIGEST_LENGTH\t16\n#ifdef MD5_DIGEST_LENGTH\n#if PF_MD5_DIGEST_LENGTH != MD5_DIGEST_LENGTH\n#error\n#endif\n#endif\n\nenum\t{ PF_INOUT, PF_IN, PF_OUT };\nenum\t{ PF_PASS, PF_DROP, PF_SCRUB, PF_NOSCRUB, PF_NAT, PF_NONAT,\n\t  PF_BINAT, PF_NOBINAT, PF_RDR, PF_NORDR, PF_SYNPROXY_DROP, PF_DEFER };\nenum\t{ PF_RULESET_SCRUB, PF_RULESET_FILTER, PF_RULESET_NAT,\n\t  PF_RULESET_BINAT, PF_RULESET_RDR, PF_RULESET_MAX };\nenum\t{ PF_OP_NONE, PF_OP_IRG, PF_OP_EQ, PF_OP_NE, PF_OP_LT,\n\t  PF_OP_LE, PF_OP_GT, PF_OP_GE, PF_OP_XRG, PF_OP_RRG };\nenum\t{ PF_DEBUG_NONE, PF_DEBUG_URGENT, PF_DEBUG_MISC, PF_DEBUG_NOISY };\nenum\t{ PF_CHANGE_NONE, PF_CHANGE_ADD_HEAD, PF_CHANGE_ADD_TAIL,\n\t  PF_CHANGE_ADD_BEFORE, PF_CHANGE_ADD_AFTER,\n\t  PF_CHANGE_REMOVE, PF_CHANGE_GET_TICKET };\nenum\t{ PF_GET_NONE, PF_GET_CLR_CNTR };\nenum\t{ PF_SK_WIRE, PF_SK_STACK, PF_SK_BOTH };\n\n/*\n * Note about PFTM_*: real indices into pf_rule.timeout[] come before\n * PFTM_MAX, special cases afterwards. See pf_state_expires().\n */\nenum\t{ PFTM_TCP_FIRST_PACKET, PFTM_TCP_OPENING, PFTM_TCP_ESTABLISHED,\n\t  PFTM_TCP_CLOSING, PFTM_TCP_FIN_WAIT, PFTM_TCP_CLOSED,\n\t  PFTM_UDP_FIRST_PACKET, PFTM_UDP_SINGLE, PFTM_UDP_MULTIPLE,\n\t  PFTM_ICMP_FIRST_PACKET, PFTM_ICMP_ERROR_REPLY,\n\t  PFTM_OTHER_FIRST_PACKET, PFTM_OTHER_SINGLE,\n\t  PFTM_OTHER_MULTIPLE, PFTM_FRAG, PFTM_INTERVAL,\n\t  PFTM_ADAPTIVE_START, PFTM_ADAPTIVE_END, PFTM_SRC_NODE,\n\t  PFTM_TS_DIFF, PFTM_MAX, PFTM_PURGE, PFTM_UNLINKED,\n\t  PFTM_UNTIL_PACKET };\n\n/* PFTM default values */\n#define PFTM_TCP_FIRST_PACKET_VAL\t120\t/* First TCP packet */\n#define PFTM_TCP_OPENING_VAL\t\t30\t/* No response yet */\n#define PFTM_TCP_ESTABLISHED_VAL\t24*60*60/* Established */\n#define PFTM_TCP_CLOSING_VAL\t\t15 * 60\t/* Half closed */\n#define PFTM_TCP_FIN_WAIT_VAL\t\t45\t/* Got both FINs */\n#define PFTM_TCP_CLOSED_VAL\t\t90\t/* Got a RST */\n#define PFTM_UDP_FIRST_PACKET_VAL\t60\t/* First UDP packet */\n#define PFTM_UDP_SINGLE_VAL\t\t30\t/* Unidirectional */\n#define PFTM_UDP_MULTIPLE_VAL\t\t60\t/* Bidirectional */\n#define PFTM_ICMP_FIRST_PACKET_VAL\t20\t/* First ICMP packet */\n#define PFTM_ICMP_ERROR_REPLY_VAL\t10\t/* Got error response */\n#define PFTM_OTHER_FIRST_PACKET_VAL\t60\t/* First packet */\n#define PFTM_OTHER_SINGLE_VAL\t\t30\t/* Unidirectional */\n#define PFTM_OTHER_MULTIPLE_VAL\t\t60\t/* Bidirectional */\n#define PFTM_FRAG_VAL\t\t\t30\t/* Fragment expire */\n#define PFTM_INTERVAL_VAL\t\t10\t/* Expire interval */\n#define PFTM_SRC_NODE_VAL\t\t0\t/* Source tracking */\n#define PFTM_TS_DIFF_VAL\t\t30\t/* Allowed TS diff */\n\nenum\t{ PF_NOPFROUTE, PF_FASTROUTE, PF_ROUTETO, PF_DUPTO, PF_REPLYTO };\nenum\t{ PF_LIMIT_STATES, PF_LIMIT_SRC_NODES, PF_LIMIT_FRAGS,\n\t  PF_LIMIT_TABLES, PF_LIMIT_TABLE_ENTRIES, PF_LIMIT_MAX };\n#define PF_POOL_IDMASK\t\t0x0f\nenum\t{ PF_POOL_NONE, PF_POOL_BITMASK, PF_POOL_RANDOM,\n\t  PF_POOL_SRCHASH, PF_POOL_ROUNDROBIN };\nenum\t{ PF_ADDR_ADDRMASK, PF_ADDR_NOROUTE, PF_ADDR_DYNIFTL,\n\t  PF_ADDR_TABLE, PF_ADDR_RTLABEL, PF_ADDR_URPFFAILED,\n\t  PF_ADDR_RANGE };\n#define PF_POOL_TYPEMASK\t0x0f\n#define PF_POOL_STICKYADDR\t0x20\n#define\tPF_WSCALE_FLAG\t\t0x80\n#define\tPF_WSCALE_MASK\t\t0x0f\n\n#define\tPF_LOG\t\t\t0x01\n#define\tPF_LOG_ALL\t\t0x02\n#define\tPF_LOG_SOCKET_LOOKUP\t0x04\n\nstruct pf_addr {\n\tunion {\n\t\tstruct in_addr\t\tv4;\n\t\tstruct in6_addr\t\tv6;\n\t\tu_int8_t\t\taddr8[16];\n\t\tu_int16_t\t\taddr16[8];\n\t\tu_int32_t\t\taddr32[4];\n\t} pfa;\t\t    /* 128-bit address */\n#define v4\tpfa.v4\n#define v6\tpfa.v6\n#define addr8\tpfa.addr8\n#define addr16\tpfa.addr16\n#define addr32\tpfa.addr32\n};\n\n#define\tPF_TABLE_NAME_SIZE\t 32\n\n#define PFI_AFLAG_NETWORK\t0x01\n#define PFI_AFLAG_BROADCAST\t0x02\n#define PFI_AFLAG_PEER\t\t0x04\n#define PFI_AFLAG_MODEMASK\t0x07\n#define PFI_AFLAG_NOALIAS\t0x08\n\nstruct pf_addr_wrap {\n\tunion {\n\t\tstruct {\n\t\t\tstruct pf_addr\t\t addr;\n\t\t\tstruct pf_addr\t\t mask;\n\t\t}\t\t\t a;\n\t\tchar\t\t\t ifname[IFNAMSIZ];\n\t\tchar\t\t\t tblname[PF_TABLE_NAME_SIZE];\n#ifdef __FreeBSD__\n#define\tRTLABEL_LEN\t32\n#endif\n\t\tchar\t\t\t rtlabelname[RTLABEL_LEN];\n\t\tu_int32_t\t\t rtlabel;\n\t}\t\t\t v;\n\tunion {\n\t\tstruct pfi_dynaddr\t*dyn;\n\t\tstruct pfr_ktable\t*tbl;\n\t\tint\t\t\t dyncnt;\n\t\tint\t\t\t tblcnt;\n\t}\t\t\t p;\n\tu_int8_t\t\t type;\t\t/* PF_ADDR_* */\n\tu_int8_t\t\t iflags;\t/* PFI_AFLAG_* */\n};\n\n#ifdef _KERNEL\n\nstruct pfi_dynaddr {\n\tTAILQ_ENTRY(pfi_dynaddr)\t entry;\n\tstruct pf_addr\t\t\t pfid_addr4;\n\tstruct pf_addr\t\t\t pfid_mask4;\n\tstruct pf_addr\t\t\t pfid_addr6;\n\tstruct pf_addr\t\t\t pfid_mask6;\n\tstruct pfr_ktable\t\t*pfid_kt;\n\tstruct pfi_kif\t\t\t*pfid_kif;\n\tvoid\t\t\t\t*pfid_hook_cookie;\n\tint\t\t\t\t pfid_net;\t/* mask or 128 */\n\tint\t\t\t\t pfid_acnt4;\t/* address count IPv4 */\n\tint\t\t\t\t pfid_acnt6;\t/* address count IPv6 */\n\tsa_family_t\t\t\t pfid_af;\t/* rule af */\n\tu_int8_t\t\t\t pfid_iflags;\t/* PFI_AFLAG_* */\n};\n\n/*\n * Address manipulation macros\n */\n\n#ifdef __FreeBSD__\n#define\tsplsoftnet()\tsplnet()\n\n#define\tHTONL(x)\t(x) = htonl((__uint32_t)(x))\n#define\tHTONS(x)\t(x) = htons((__uint16_t)(x))\n#define\tNTOHL(x)\t(x) = ntohl((__uint32_t)(x))\n#define\tNTOHS(x)\t(x) = ntohs((__uint16_t)(x))\n\n#define\tPF_NAME\t\t\"pf\"\n\n#define\tPR_NOWAIT\tM_NOWAIT\n#define\tPR_WAITOK\tM_WAITOK\n#define\tPR_ZERO\t\tM_ZERO\n#define\tpool_get(p, f)\tuma_zalloc(*(p), (f))\n#define\tpool_put(p, o)\tuma_zfree(*(p), (o))\n\n#define\tUMA_CREATE(var, type, desc)\t\t\t\\\n\tvar = uma_zcreate(desc, sizeof(type),\t\t\\\n\tNULL, NULL, NULL, NULL, UMA_ALIGN_PTR, 0);\t\\\n\tif (var == NULL)\t\t\t\t\\\n\t\tbreak\n#define\tUMA_DESTROY(var)\t\t\t\t\\\n\tif (var)\t\t\t\t\t\\\n\t\tuma_zdestroy(var)\n\n#ifdef __FreeBSD__\nextern struct mtx pf_task_mtx;\n\n#define\tPF_LOCK_ASSERT()\tmtx_assert(&pf_task_mtx, MA_OWNED)\n#define\tPF_UNLOCK_ASSERT()\tmtx_assert(&pf_task_mtx, MA_NOTOWNED)\n\n#define\tPF_LOCK()\tdo {\t\t\t\t\\\n\tPF_UNLOCK_ASSERT();\t\t\t\t\\\n\tmtx_lock(&pf_task_mtx);\t\t\t\t\\\n} while(0)\n#define\tPF_UNLOCK()\tdo {\t\t\t\t\\\n\tPF_LOCK_ASSERT();\t\t\t\t\\\n\tmtx_unlock(&pf_task_mtx);\t\t\t\\\n} while(0)\n#else\n#define\tPF_LOCK_ASSERT()\n#define\tPF_UNLOCK_ASSERT()\n#define\tPF_LOCK()\n#define\tPF_UNLOCK()\n#endif /* __FreeBSD__ */\n\n#define\tPF_COPYIN(uaddr, kaddr, len, r)\t\tdo {\t\\\n\tPF_UNLOCK();\t\t\t\t\t\\\n\tr = copyin((uaddr), (kaddr), (len));\t\t\\\n\tPF_LOCK();\t\t\t\t\t\\\n} while(0)\n\n#define\tPF_COPYOUT(kaddr, uaddr, len, r)\tdo {\t\\\n\tPF_UNLOCK();\t\t\t\t\t\\\n\tr = copyout((kaddr), (uaddr), (len));\t\t\\\n\tPF_LOCK();\t\t\t\t\t\\\n} while(0)\n\n#define\tPF_MODVER\t1\n#define\tPFLOG_MODVER\t1\n#define\tPFSYNC_MODVER\t1\n\n#define\tPFLOG_MINVER\t1\n#define\tPFLOG_PREFVER\tPFLOG_MODVER\n#define\tPFLOG_MAXVER\t1\n#define\tPFSYNC_MINVER\t1\n#define\tPFSYNC_PREFVER\tPFSYNC_MODVER\n#define\tPFSYNC_MAXVER\t1\n#endif /* __FreeBSD__ */\n#ifdef INET\n#ifndef INET6\n#define\tPF_INET_ONLY\n#endif /* ! INET6 */\n#endif /* INET */\n\n#ifdef INET6\n#ifndef INET\n#define\tPF_INET6_ONLY\n#endif /* ! INET */\n#endif /* INET6 */\n\n#ifdef INET\n#ifdef INET6\n#define\tPF_INET_INET6\n#endif /* INET6 */\n#endif /* INET */\n\n#else\n\n#define\tPF_INET_INET6\n\n#endif /* _KERNEL */\n\n/* Both IPv4 and IPv6 */\n#ifdef PF_INET_INET6\n\n#define PF_AEQ(a, b, c) \\\n\t((c == AF_INET && (a)->addr32[0] == (b)->addr32[0]) || \\\n\t((a)->addr32[3] == (b)->addr32[3] && \\\n\t(a)->addr32[2] == (b)->addr32[2] && \\\n\t(a)->addr32[1] == (b)->addr32[1] && \\\n\t(a)->addr32[0] == (b)->addr32[0])) \\\n\n#define PF_ANEQ(a, b, c) \\\n\t((c == AF_INET && (a)->addr32[0] != (b)->addr32[0]) || \\\n\t((a)->addr32[3] != (b)->addr32[3] || \\\n\t(a)->addr32[2] != (b)->addr32[2] || \\\n\t(a)->addr32[1] != (b)->addr32[1] || \\\n\t(a)->addr32[0] != (b)->addr32[0])) \\\n\n#define PF_AZERO(a, c) \\\n\t((c == AF_INET && !(a)->addr32[0]) || \\\n\t(!(a)->addr32[0] && !(a)->addr32[1] && \\\n\t!(a)->addr32[2] && !(a)->addr32[3] )) \\\n\n#define PF_MATCHA(n, a, m, b, f) \\\n\tpf_match_addr(n, a, m, b, f)\n\n#define PF_ACPY(a, b, f) \\\n\tpf_addrcpy(a, b, f)\n\n#define PF_AINC(a, f) \\\n\tpf_addr_inc(a, f)\n\n#define PF_POOLMASK(a, b, c, d, f) \\\n\tpf_poolmask(a, b, c, d, f)\n\n#else\n\n/* Just IPv6 */\n\n#ifdef PF_INET6_ONLY\n\n#define PF_AEQ(a, b, c) \\\n\t((a)->addr32[3] == (b)->addr32[3] && \\\n\t(a)->addr32[2] == (b)->addr32[2] && \\\n\t(a)->addr32[1] == (b)->addr32[1] && \\\n\t(a)->addr32[0] == (b)->addr32[0]) \\\n\n#define PF_ANEQ(a, b, c) \\\n\t((a)->addr32[3] != (b)->addr32[3] || \\\n\t(a)->addr32[2] != (b)->addr32[2] || \\\n\t(a)->addr32[1] != (b)->addr32[1] || \\\n\t(a)->addr32[0] != (b)->addr32[0]) \\\n\n#define PF_AZERO(a, c) \\\n\t(!(a)->addr32[0] && \\\n\t!(a)->addr32[1] && \\\n\t!(a)->addr32[2] && \\\n\t!(a)->addr32[3] ) \\\n\n#define PF_MATCHA(n, a, m, b, f) \\\n\tpf_match_addr(n, a, m, b, f)\n\n#define PF_ACPY(a, b, f) \\\n\tpf_addrcpy(a, b, f)\n\n#define PF_AINC(a, f) \\\n\tpf_addr_inc(a, f)\n\n#define PF_POOLMASK(a, b, c, d, f) \\\n\tpf_poolmask(a, b, c, d, f)\n\n#else\n\n/* Just IPv4 */\n#ifdef PF_INET_ONLY\n\n#define PF_AEQ(a, b, c) \\\n\t((a)->addr32[0] == (b)->addr32[0])\n\n#define PF_ANEQ(a, b, c) \\\n\t((a)->addr32[0] != (b)->addr32[0])\n\n#define PF_AZERO(a, c) \\\n\t(!(a)->addr32[0])\n\n#define PF_MATCHA(n, a, m, b, f) \\\n\tpf_match_addr(n, a, m, b, f)\n\n#define PF_ACPY(a, b, f) \\\n\t(a)->v4.s_addr = (b)->v4.s_addr\n\n#define PF_AINC(a, f) \\\n\tdo { \\\n\t\t(a)->addr32[0] = htonl(ntohl((a)->addr32[0]) + 1); \\\n\t} while (0)\n\n#define PF_POOLMASK(a, b, c, d, f) \\\n\tdo { \\\n\t\t(a)->addr32[0] = ((b)->addr32[0] & (c)->addr32[0]) | \\\n\t\t(((c)->addr32[0] ^ 0xffffffff ) & (d)->addr32[0]); \\\n\t} while (0)\n\n#endif /* PF_INET_ONLY */\n#endif /* PF_INET6_ONLY */\n#endif /* PF_INET_INET6 */\n\n#define\tPF_MISMATCHAW(aw, x, af, neg, ifp)\t\t\t\t\\\n\t(\t\t\t\t\t\t\t\t\\\n\t\t(((aw)->type == PF_ADDR_NOROUTE &&\t\t\t\\\n\t\t    pf_routable((x), (af), NULL)) ||\t\t\t\\\n\t\t(((aw)->type == PF_ADDR_URPFFAILED && (ifp) != NULL &&\t\\\n\t\t    pf_routable((x), (af), (ifp))) ||\t\t\t\\\n\t\t((aw)->type == PF_ADDR_RTLABEL &&\t\t\t\\\n\t\t    !pf_rtlabel_match((x), (af), (aw))) ||\t\t\\\n\t\t((aw)->type == PF_ADDR_TABLE &&\t\t\t\t\\\n\t\t    !pfr_match_addr((aw)->p.tbl, (x), (af))) ||\t\t\\\n\t\t((aw)->type == PF_ADDR_DYNIFTL &&\t\t\t\\\n\t\t    !pfi_match_addr((aw)->p.dyn, (x), (af))) ||\t\t\\\n\t\t((aw)->type == PF_ADDR_RANGE &&\t\t\t\t\\\n\t\t    !pf_match_addr_range(&(aw)->v.a.addr,\t\t\\\n\t\t    &(aw)->v.a.mask, (x), (af))) ||\t\t\t\\\n\t\t((aw)->type == PF_ADDR_ADDRMASK &&\t\t\t\\\n\t\t    !PF_AZERO(&(aw)->v.a.mask, (af)) &&\t\t\t\\\n\t\t    !PF_MATCHA(0, &(aw)->v.a.addr,\t\t\t\\\n\t\t    &(aw)->v.a.mask, (x), (af))))) !=\t\t\t\\\n\t\t(neg)\t\t\t\t\t\t\t\\\n\t)\n\n\nstruct pf_rule_uid {\n\tuid_t\t\t uid[2];\n\tu_int8_t\t op;\n};\n\nstruct pf_rule_gid {\n\tuid_t\t\t gid[2];\n\tu_int8_t\t op;\n};\n\nstruct pf_rule_addr {\n\tstruct pf_addr_wrap\t addr;\n\tu_int16_t\t\t port[2];\n\tu_int8_t\t\t neg;\n\tu_int8_t\t\t port_op;\n};\n\nstruct pf_pooladdr {\n\tstruct pf_addr_wrap\t\t addr;\n\tTAILQ_ENTRY(pf_pooladdr)\t entries;\n\tchar\t\t\t\t ifname[IFNAMSIZ];\n\tstruct pfi_kif\t\t\t*kif;\n};\n\nTAILQ_HEAD(pf_palist, pf_pooladdr);\n\nstruct pf_poolhashkey {\n\tunion {\n\t\tu_int8_t\t\tkey8[16];\n\t\tu_int16_t\t\tkey16[8];\n\t\tu_int32_t\t\tkey32[4];\n\t} pfk;\t\t    /* 128-bit hash key */\n#define key8\tpfk.key8\n#define key16\tpfk.key16\n#define key32\tpfk.key32\n};\n\nstruct pf_pool {\n\tstruct pf_palist\t list;\n\tstruct pf_pooladdr\t*cur;\n\tstruct pf_poolhashkey\t key;\n\tstruct pf_addr\t\t counter;\n\tint\t\t\t tblidx;\n\tu_int16_t\t\t proxy_port[2];\n\tu_int8_t\t\t port_op;\n\tu_int8_t\t\t opts;\n};\n\n\n/* A packed Operating System description for fingerprinting */\ntypedef u_int32_t pf_osfp_t;\n#define PF_OSFP_ANY\t((pf_osfp_t)0)\n#define PF_OSFP_UNKNOWN\t((pf_osfp_t)-1)\n#define PF_OSFP_NOMATCH\t((pf_osfp_t)-2)\n\nstruct pf_osfp_entry {\n\tSLIST_ENTRY(pf_osfp_entry) fp_entry;\n\tpf_osfp_t\t\tfp_os;\n\tint\t\t\tfp_enflags;\n#define PF_OSFP_EXPANDED\t0x001\t\t/* expanded entry */\n#define PF_OSFP_GENERIC\t\t0x002\t\t/* generic signature */\n#define PF_OSFP_NODETAIL\t0x004\t\t/* no p0f details */\n#define PF_OSFP_LEN\t32\n\tchar\t\t\tfp_class_nm[PF_OSFP_LEN];\n\tchar\t\t\tfp_version_nm[PF_OSFP_LEN];\n\tchar\t\t\tfp_subtype_nm[PF_OSFP_LEN];\n};\n#define PF_OSFP_ENTRY_EQ(a, b) \\\n    ((a)->fp_os == (b)->fp_os && \\\n    memcmp((a)->fp_class_nm, (b)->fp_class_nm, PF_OSFP_LEN) == 0 && \\\n    memcmp((a)->fp_version_nm, (b)->fp_version_nm, PF_OSFP_LEN) == 0 && \\\n    memcmp((a)->fp_subtype_nm, (b)->fp_subtype_nm, PF_OSFP_LEN) == 0)\n\n/* handle pf_osfp_t packing */\n#define _FP_RESERVED_BIT\t1  /* For the special negative #defines */\n#define _FP_UNUSED_BITS\t\t1\n#define _FP_CLASS_BITS\t\t10 /* OS Class (Windows, Linux) */\n#define _FP_VERSION_BITS\t10 /* OS version (95, 98, NT, 2.4.54, 3.2) */\n#define _FP_SUBTYPE_BITS\t10 /* patch level (NT SP4, SP3, ECN patch) */\n#define PF_OSFP_UNPACK(osfp, class, version, subtype) do { \\\n\t(class) = ((osfp) >> (_FP_VERSION_BITS+_FP_SUBTYPE_BITS)) & \\\n\t    ((1 << _FP_CLASS_BITS) - 1); \\\n\t(version) = ((osfp) >> _FP_SUBTYPE_BITS) & \\\n\t    ((1 << _FP_VERSION_BITS) - 1);\\\n\t(subtype) = (osfp) & ((1 << _FP_SUBTYPE_BITS) - 1); \\\n} while(0)\n#define PF_OSFP_PACK(osfp, class, version, subtype) do { \\\n\t(osfp) = ((class) & ((1 << _FP_CLASS_BITS) - 1)) << (_FP_VERSION_BITS \\\n\t    + _FP_SUBTYPE_BITS); \\\n\t(osfp) |= ((version) & ((1 << _FP_VERSION_BITS) - 1)) << \\\n\t    _FP_SUBTYPE_BITS; \\\n\t(osfp) |= (subtype) & ((1 << _FP_SUBTYPE_BITS) - 1); \\\n} while(0)\n\n/* the fingerprint of an OSes TCP SYN packet */\ntypedef u_int64_t\tpf_tcpopts_t;\nstruct pf_os_fingerprint {\n\tSLIST_HEAD(pf_osfp_enlist, pf_osfp_entry) fp_oses; /* list of matches */\n\tpf_tcpopts_t\t\tfp_tcpopts;\t/* packed TCP options */\n\tu_int16_t\t\tfp_wsize;\t/* TCP window size */\n\tu_int16_t\t\tfp_psize;\t/* ip->ip_len */\n\tu_int16_t\t\tfp_mss;\t\t/* TCP MSS */\n\tu_int16_t\t\tfp_flags;\n#define PF_OSFP_WSIZE_MOD\t0x0001\t\t/* Window modulus */\n#define PF_OSFP_WSIZE_DC\t0x0002\t\t/* Window don't care */\n#define PF_OSFP_WSIZE_MSS\t0x0004\t\t/* Window multiple of MSS */\n#define PF_OSFP_WSIZE_MTU\t0x0008\t\t/* Window multiple of MTU */\n#define PF_OSFP_PSIZE_MOD\t0x0010\t\t/* packet size modulus */\n#define PF_OSFP_PSIZE_DC\t0x0020\t\t/* packet size don't care */\n#define PF_OSFP_WSCALE\t\t0x0040\t\t/* TCP window scaling */\n#define PF_OSFP_WSCALE_MOD\t0x0080\t\t/* TCP window scale modulus */\n#define PF_OSFP_WSCALE_DC\t0x0100\t\t/* TCP window scale dont-care */\n#define PF_OSFP_MSS\t\t0x0200\t\t/* TCP MSS */\n#define PF_OSFP_MSS_MOD\t\t0x0400\t\t/* TCP MSS modulus */\n#define PF_OSFP_MSS_DC\t\t0x0800\t\t/* TCP MSS dont-care */\n#define PF_OSFP_DF\t\t0x1000\t\t/* IPv4 don't fragment bit */\n#define PF_OSFP_TS0\t\t0x2000\t\t/* Zero timestamp */\n#define PF_OSFP_INET6\t\t0x4000\t\t/* IPv6 */\n\tu_int8_t\t\tfp_optcnt;\t/* TCP option count */\n\tu_int8_t\t\tfp_wscale;\t/* TCP window scaling */\n\tu_int8_t\t\tfp_ttl;\t\t/* IPv4 TTL */\n#define PF_OSFP_MAXTTL_OFFSET\t40\n/* TCP options packing */\n#define PF_OSFP_TCPOPT_NOP\t0x0\t\t/* TCP NOP option */\n#define PF_OSFP_TCPOPT_WSCALE\t0x1\t\t/* TCP window scaling option */\n#define PF_OSFP_TCPOPT_MSS\t0x2\t\t/* TCP max segment size opt */\n#define PF_OSFP_TCPOPT_SACK\t0x3\t\t/* TCP SACK OK option */\n#define PF_OSFP_TCPOPT_TS\t0x4\t\t/* TCP timestamp option */\n#define PF_OSFP_TCPOPT_BITS\t3\t\t/* bits used by each option */\n#define PF_OSFP_MAX_OPTS \\\n    (sizeof(((struct pf_os_fingerprint *)0)->fp_tcpopts) * 8) \\\n    / PF_OSFP_TCPOPT_BITS\n\n\tSLIST_ENTRY(pf_os_fingerprint)\tfp_next;\n};\n\nstruct pf_osfp_ioctl {\n\tstruct pf_osfp_entry\tfp_os;\n\tpf_tcpopts_t\t\tfp_tcpopts;\t/* packed TCP options */\n\tu_int16_t\t\tfp_wsize;\t/* TCP window size */\n\tu_int16_t\t\tfp_psize;\t/* ip->ip_len */\n\tu_int16_t\t\tfp_mss;\t\t/* TCP MSS */\n\tu_int16_t\t\tfp_flags;\n\tu_int8_t\t\tfp_optcnt;\t/* TCP option count */\n\tu_int8_t\t\tfp_wscale;\t/* TCP window scaling */\n\tu_int8_t\t\tfp_ttl;\t\t/* IPv4 TTL */\n\n\tint\t\t\tfp_getnum;\t/* DIOCOSFPGET number */\n};\n\n\nunion pf_rule_ptr {\n\tstruct pf_rule\t\t*ptr;\n\tu_int32_t\t\t nr;\n};\n\n#define\tPF_ANCHOR_NAME_SIZE\t 64\n\nstruct pf_rule {\n\tstruct pf_rule_addr\t src;\n\tstruct pf_rule_addr\t dst;\n#define PF_SKIP_IFP\t\t0\n#define PF_SKIP_DIR\t\t1\n#define PF_SKIP_AF\t\t2\n#define PF_SKIP_PROTO\t\t3\n#define PF_SKIP_SRC_ADDR\t4\n#define PF_SKIP_SRC_PORT\t5\n#define PF_SKIP_DST_ADDR\t6\n#define PF_SKIP_DST_PORT\t7\n#define PF_SKIP_COUNT\t\t8\n\tunion pf_rule_ptr\t skip[PF_SKIP_COUNT];\n#define PF_RULE_LABEL_SIZE\t 64\n\tchar\t\t\t label[PF_RULE_LABEL_SIZE];\n#define PF_QNAME_SIZE\t\t 64\n\tchar\t\t\t ifname[IFNAMSIZ];\n\tchar\t\t\t qname[PF_QNAME_SIZE];\n\tchar\t\t\t pqname[PF_QNAME_SIZE];\n#define\tPF_TAG_NAME_SIZE\t 64\n\tchar\t\t\t tagname[PF_TAG_NAME_SIZE];\n\tchar\t\t\t match_tagname[PF_TAG_NAME_SIZE];\n\n\tchar\t\t\t overload_tblname[PF_TABLE_NAME_SIZE];\n\n\tTAILQ_ENTRY(pf_rule)\t entries;\n\tstruct pf_pool\t\t rpool;\n\n\tu_int64_t\t\t evaluations;\n\tu_int64_t\t\t packets[2];\n\tu_int64_t\t\t bytes[2];\n\n\tstruct pfi_kif\t\t*kif;\n\tstruct pf_anchor\t*anchor;\n\tstruct pfr_ktable\t*overload_tbl;\n\n\tpf_osfp_t\t\t os_fingerprint;\n\n\tint\t\t\t rtableid;\n\tu_int32_t\t\t timeout[PFTM_MAX];\n\tu_int32_t\t\t states_cur;\n\tu_int32_t\t\t states_tot;\n\tu_int32_t\t\t max_states;\n\tu_int32_t\t\t src_nodes;\n\tu_int32_t\t\t max_src_nodes;\n\tu_int32_t\t\t max_src_states;\n\tu_int32_t\t\t spare1;\t\t\t/* netgraph */\n\tu_int32_t\t\t max_src_conn;\n\tstruct {\n\t\tu_int32_t\t\tlimit;\n\t\tu_int32_t\t\tseconds;\n\t}\t\t\t max_src_conn_rate;\n\tu_int32_t\t\t qid;\n\tu_int32_t\t\t pqid;\n\tu_int32_t\t\t rt_listid;\n\tu_int32_t\t\t nr;\n\tu_int32_t\t\t prob;\n\tuid_t\t\t\t cuid;\n\tpid_t\t\t\t cpid;\n\n\tu_int16_t\t\t return_icmp;\n\tu_int16_t\t\t return_icmp6;\n\tu_int16_t\t\t max_mss;\n\tu_int16_t\t\t tag;\n\tu_int16_t\t\t match_tag;\n\tu_int16_t\t\t spare2;\t\t\t/* netgraph */\n\n\tstruct pf_rule_uid\t uid;\n\tstruct pf_rule_gid\t gid;\n\n\tu_int32_t\t\t rule_flag;\n\tu_int8_t\t\t action;\n\tu_int8_t\t\t direction;\n\tu_int8_t\t\t log;\n\tu_int8_t\t\t logif;\n\tu_int8_t\t\t quick;\n\tu_int8_t\t\t ifnot;\n\tu_int8_t\t\t match_tag_not;\n\tu_int8_t\t\t natpass;\n\n#define PF_STATE_NORMAL\t\t0x1\n#define PF_STATE_MODULATE\t0x2\n#define PF_STATE_SYNPROXY\t0x3\n\tu_int8_t\t\t keep_state;\n\tsa_family_t\t\t af;\n\tu_int8_t\t\t proto;\n\tu_int8_t\t\t type;\n\tu_int8_t\t\t code;\n\tu_int8_t\t\t flags;\n\tu_int8_t\t\t flagset;\n\tu_int8_t\t\t min_ttl;\n\tu_int8_t\t\t allow_opts;\n\tu_int8_t\t\t rt;\n\tu_int8_t\t\t return_ttl;\n\tu_int8_t\t\t tos;\n\tu_int8_t\t\t set_tos;\n\tu_int8_t\t\t anchor_relative;\n\tu_int8_t\t\t anchor_wildcard;\n\n#define PF_FLUSH\t\t0x01\n#define PF_FLUSH_GLOBAL\t\t0x02\n\tu_int8_t\t\t flush;\n\n\tstruct {\n\t\tstruct pf_addr\t\taddr;\n\t\tu_int16_t\t\tport;\n\t}\t\t\tdivert;\n};\n\n/* rule flags */\n#define\tPFRULE_DROP\t\t0x0000\n#define\tPFRULE_RETURNRST\t0x0001\n#define\tPFRULE_FRAGMENT\t\t0x0002\n#define\tPFRULE_RETURNICMP\t0x0004\n#define\tPFRULE_RETURN\t\t0x0008\n#define\tPFRULE_NOSYNC\t\t0x0010\n#define PFRULE_SRCTRACK\t\t0x0020  /* track source states */\n#define PFRULE_RULESRCTRACK\t0x0040  /* per rule */\n\n/* scrub flags */\n#define\tPFRULE_NODF\t\t0x0100\n#define\tPFRULE_FRAGCROP\t\t0x0200\t/* non-buffering frag cache */\n#define\tPFRULE_FRAGDROP\t\t0x0400\t/* drop funny fragments */\n#define PFRULE_RANDOMID\t\t0x0800\n#define PFRULE_REASSEMBLE_TCP\t0x1000\n#define PFRULE_SET_TOS\t\t0x2000\n\n/* rule flags again */\n#define PFRULE_IFBOUND\t\t0x00010000\t/* if-bound */\n#define PFRULE_STATESLOPPY\t0x00020000\t/* sloppy state tracking */\n#define PFRULE_PFLOW\t\t0x00040000\n\n#define PFSTATE_HIWAT\t\t10000\t/* default state table size */\n#define PFSTATE_ADAPT_START\t6000\t/* default adaptive timeout start */\n#define PFSTATE_ADAPT_END\t12000\t/* default adaptive timeout end */\n\n\nstruct pf_threshold {\n\tu_int32_t\tlimit;\n#define\tPF_THRESHOLD_MULT\t1000\n#define PF_THRESHOLD_MAX\t0xffffffff / PF_THRESHOLD_MULT\n\tu_int32_t\tseconds;\n\tu_int32_t\tcount;\n\tu_int32_t\tlast;\n};\n\nstruct pf_src_node {\n\tRB_ENTRY(pf_src_node) entry;\n\tstruct pf_addr\t addr;\n\tstruct pf_addr\t raddr;\n\tunion pf_rule_ptr rule;\n\tstruct pfi_kif\t*kif;\n\tu_int64_t\t bytes[2];\n\tu_int64_t\t packets[2];\n\tu_int32_t\t states;\n\tu_int32_t\t conn;\n\tstruct pf_threshold\tconn_rate;\n\tu_int32_t\t creation;\n\tu_int32_t\t expire;\n\tsa_family_t\t af;\n\tu_int8_t\t ruletype;\n};\n\n#define PFSNODE_HIWAT\t\t10000\t/* default source node table size */\n\nstruct pf_state_scrub {\n\tstruct timeval\tpfss_last;\t/* time received last packet\t*/\n\tu_int32_t\tpfss_tsecr;\t/* last echoed timestamp\t*/\n\tu_int32_t\tpfss_tsval;\t/* largest timestamp\t\t*/\n\tu_int32_t\tpfss_tsval0;\t/* original timestamp\t\t*/\n\tu_int16_t\tpfss_flags;\n#define PFSS_TIMESTAMP\t0x0001\t\t/* modulate timestamp\t\t*/\n#define PFSS_PAWS\t0x0010\t\t/* stricter PAWS checks\t\t*/\n#define PFSS_PAWS_IDLED\t0x0020\t\t/* was idle too long.  no PAWS\t*/\n#define PFSS_DATA_TS\t0x0040\t\t/* timestamp on data packets\t*/\n#define PFSS_DATA_NOTS\t0x0080\t\t/* no timestamp on data packets\t*/\n\tu_int8_t\tpfss_ttl;\t/* stashed TTL\t\t\t*/\n\tu_int8_t\tpad;\n\tu_int32_t\tpfss_ts_mod;\t/* timestamp modulation\t\t*/\n};\n\nstruct pf_state_host {\n\tstruct pf_addr\taddr;\n\tu_int16_t\tport;\n\tu_int16_t\tpad;\n};\n\nstruct pf_state_peer {\n\tstruct pf_state_scrub\t*scrub;\t/* state is scrubbed\t\t*/\n\tu_int32_t\tseqlo;\t\t/* Max sequence number sent\t*/\n\tu_int32_t\tseqhi;\t\t/* Max the other end ACKd + win\t*/\n\tu_int32_t\tseqdiff;\t/* Sequence number modulator\t*/\n\tu_int16_t\tmax_win;\t/* largest window (pre scaling)\t*/\n\tu_int16_t\tmss;\t\t/* Maximum segment size option\t*/\n\tu_int8_t\tstate;\t\t/* active state level\t\t*/\n\tu_int8_t\twscale;\t\t/* window scaling factor\t*/\n\tu_int8_t\ttcp_est;\t/* Did we reach TCPS_ESTABLISHED */\n\tu_int8_t\tpad[1];\n};\n\nTAILQ_HEAD(pf_state_queue, pf_state);\n\n/* keep synced with struct pf_state_key, used in RB_FIND */\nstruct pf_state_key_cmp {\n\tstruct pf_addr\t addr[2];\n\tu_int16_t\t port[2];\n\tsa_family_t\t af;\n\tu_int8_t\t proto;\n\tu_int8_t\t pad[2];\n};\n\nstruct pf_state_item {\n\tTAILQ_ENTRY(pf_state_item)\t entry;\n\tstruct pf_state\t\t\t*s;\n};\n\nTAILQ_HEAD(pf_statelisthead, pf_state_item);\n\nstruct pf_state_key {\n\tstruct pf_addr\t addr[2];\n\tu_int16_t\t port[2];\n\tsa_family_t\t af;\n\tu_int8_t\t proto;\n\tu_int8_t\t pad[2];\n\n\tRB_ENTRY(pf_state_key)\t entry;\n\tstruct pf_statelisthead\t states;\n\tstruct pf_state_key\t*reverse;\n\tstruct inpcb\t\t*inp;\n};\n\n/* keep synced with struct pf_state, used in RB_FIND */\nstruct pf_state_cmp {\n\tu_int64_t\t\t id;\n\tu_int32_t\t\t creatorid;\n\tu_int8_t\t\t direction;\n\tu_int8_t\t\t pad[3];\n};\n\nstruct pf_state {\n\tu_int64_t\t\t id;\n\tu_int32_t\t\t creatorid;\n\tu_int8_t\t\t direction;\n#ifdef __FreeBSD__\n\tu_int8_t\t\t pad[2];\n\tu_int8_t\t\t local_flags;\n#define\tPFSTATE_EXPIRING 0x01\n#else\n\tu_int8_t\t\t pad[3];\n#endif\n\n\tTAILQ_ENTRY(pf_state)\t sync_list;\n\tTAILQ_ENTRY(pf_state)\t entry_list;\n\tRB_ENTRY(pf_state)\t entry_id;\n\tstruct pf_state_peer\t src;\n\tstruct pf_state_peer\t dst;\n\tunion pf_rule_ptr\t rule;\n\tunion pf_rule_ptr\t anchor;\n\tunion pf_rule_ptr\t nat_rule;\n\tstruct pf_addr\t\t rt_addr;\n\tstruct pf_state_key\t*key[2];\t/* addresses stack and wire  */\n\tstruct pfi_kif\t\t*kif;\n\tstruct pfi_kif\t\t*rt_kif;\n\tstruct pf_src_node\t*src_node;\n\tstruct pf_src_node\t*nat_src_node;\n\tu_int64_t\t\t packets[2];\n\tu_int64_t\t\t bytes[2];\n\tu_int32_t\t\t creation;\n\tu_int32_t\t \t expire;\n\tu_int32_t\t\t pfsync_time;\n\tu_int16_t\t\t tag;\n\tu_int8_t\t\t log;\n\tu_int8_t\t\t state_flags;\n#define\tPFSTATE_ALLOWOPTS\t0x01\n#define\tPFSTATE_SLOPPY\t\t0x02\n#define\tPFSTATE_PFLOW\t\t0x04\n#define\tPFSTATE_NOSYNC\t\t0x08\n#define\tPFSTATE_ACK\t\t0x10\n\tu_int8_t\t\t timeout;\n\tu_int8_t\t\t sync_state; /* PFSYNC_S_x */\n\n\t/* XXX */\n\tu_int8_t\t\t sync_updates;\n\tu_int8_t\t\t_tail[3];\n};\n\n/*\n * Unified state structures for pulling states out of the kernel\n * used by pfsync(4) and the pf(4) ioctl.\n */\nstruct pfsync_state_scrub {\n\tu_int16_t\tpfss_flags;\n\tu_int8_t\tpfss_ttl;\t/* stashed TTL\t\t*/\n#define PFSYNC_SCRUB_FLAG_VALID\t\t0x01\n\tu_int8_t\tscrub_flag;\n\tu_int32_t\tpfss_ts_mod;\t/* timestamp modulation\t*/\n} __packed;\n\nstruct pfsync_state_peer {\n\tstruct pfsync_state_scrub scrub;\t/* state is scrubbed\t*/\n\tu_int32_t\tseqlo;\t\t/* Max sequence number sent\t*/\n\tu_int32_t\tseqhi;\t\t/* Max the other end ACKd + win\t*/\n\tu_int32_t\tseqdiff;\t/* Sequence number modulator\t*/\n\tu_int16_t\tmax_win;\t/* largest window (pre scaling)\t*/\n\tu_int16_t\tmss;\t\t/* Maximum segment size option\t*/\n\tu_int8_t\tstate;\t\t/* active state level\t\t*/\n\tu_int8_t\twscale;\t\t/* window scaling factor\t*/\n\tu_int8_t\tpad[6];\n} __packed;\n\nstruct pfsync_state_key {\n\tstruct pf_addr\t addr[2];\n\tu_int16_t\t port[2];\n};\n\nstruct pfsync_state {\n\tu_int32_t\t id[2];\n\tchar\t\t ifname[IFNAMSIZ];\n\tstruct pfsync_state_key\tkey[2];\n\tstruct pfsync_state_peer src;\n\tstruct pfsync_state_peer dst;\n\tstruct pf_addr\t rt_addr;\n\tu_int32_t\t rule;\n\tu_int32_t\t anchor;\n\tu_int32_t\t nat_rule;\n\tu_int32_t\t creation;\n\tu_int32_t\t expire;\n\tu_int32_t\t packets[2][2];\n\tu_int32_t\t bytes[2][2];\n\tu_int32_t\t creatorid;\n\tsa_family_t\t af;\n\tu_int8_t\t proto;\n\tu_int8_t\t direction;\n#ifdef __FreeBSD__\n\tu_int8_t\t local_flags;\n#define\tPFSTATE_EXPIRING\t\t0x01\n\tu_int8_t\t pad;\n#endif\n\tu_int8_t\t log;\n\tu_int8_t\t state_flags;\n\tu_int8_t\t timeout;\n\tu_int8_t\t sync_flags;\n\tu_int8_t\t updates;\n} __packed;\n\n#ifdef __FreeBSD__\n#ifdef _KERNEL\n/* pfsync */\ntypedef int\t\tpfsync_state_import_t(struct pfsync_state *, u_int8_t);\ntypedef\tvoid\t\tpfsync_insert_state_t(struct pf_state *);\ntypedef\tvoid\t\tpfsync_update_state_t(struct pf_state *);\ntypedef\tvoid\t\tpfsync_delete_state_t(struct pf_state *);\ntypedef void\t\tpfsync_clear_states_t(u_int32_t, const char *);\ntypedef int\t\tpfsync_state_in_use_t(struct pf_state *);\ntypedef int\t\tpfsync_defer_t(struct pf_state *, struct mbuf *);\ntypedef\tint\t\tpfsync_up_t(void);\n\nextern pfsync_state_import_t\t*pfsync_state_import_ptr;\nextern pfsync_insert_state_t\t*pfsync_insert_state_ptr;\nextern pfsync_update_state_t\t*pfsync_update_state_ptr;\nextern pfsync_delete_state_t\t*pfsync_delete_state_ptr;\nextern pfsync_clear_states_t\t*pfsync_clear_states_ptr;\nextern pfsync_state_in_use_t\t*pfsync_state_in_use_ptr;\nextern pfsync_defer_t\t\t*pfsync_defer_ptr;\nextern pfsync_up_t\t\t*pfsync_up_ptr;\n\nvoid\t\t\tpfsync_state_export(struct pfsync_state *,\n\t\t\t    struct pf_state *);\n\n/* pflow */\ntypedef int\t\texport_pflow_t(struct pf_state *);\n\nextern export_pflow_t\t\t*export_pflow_ptr;\n\n/* pflog */\nstruct pf_ruleset;\nstruct pf_pdesc;\ntypedef int pflog_packet_t(struct pfi_kif *, struct mbuf *, sa_family_t,\n    u_int8_t, u_int8_t, struct pf_rule *, struct pf_rule *,\n    struct pf_ruleset *, struct pf_pdesc *);\n\nextern pflog_packet_t\t\t*pflog_packet_ptr;\n\n/* pf uid hack */\nVNET_DECLARE(int, debug_pfugidhack);\n#define\tV_debug_pfugidhack\tVNET(debug_pfugidhack)\n\n#define\tV_pf_end_threads\tVNET(pf_end_threads)\n#endif\n\n/* Macros to set/clear/test flags. */\n#ifdef _KERNEL\n#define\tSET(t, f)\t((t) |= (f))\n#define\tCLR(t, f)\t((t) &= ~(f))\n#define\tISSET(t, f)\t((t) & (f))\n#endif\n#endif\n\n#define\tPFSYNC_FLAG_SRCNODE\t0x04\n#define\tPFSYNC_FLAG_NATSRCNODE\t0x08\n\n/* for copies to/from network byte order */\n/* ioctl interface also uses network byte order */\n#define pf_state_peer_hton(s,d) do {\t\t\\\n\t(d)->seqlo = htonl((s)->seqlo);\t\t\\\n\t(d)->seqhi = htonl((s)->seqhi);\t\t\\\n\t(d)->seqdiff = htonl((s)->seqdiff);\t\\\n\t(d)->max_win = htons((s)->max_win);\t\\\n\t(d)->mss = htons((s)->mss);\t\t\\\n\t(d)->state = (s)->state;\t\t\\\n\t(d)->wscale = (s)->wscale;\t\t\\\n\tif ((s)->scrub) {\t\t\t\t\t\t\\\n\t\t(d)->scrub.pfss_flags = \t\t\t\t\\\n\t\t    htons((s)->scrub->pfss_flags & PFSS_TIMESTAMP);\t\\\n\t\t(d)->scrub.pfss_ttl = (s)->scrub->pfss_ttl;\t\t\\\n\t\t(d)->scrub.pfss_ts_mod = htonl((s)->scrub->pfss_ts_mod);\\\n\t\t(d)->scrub.scrub_flag = PFSYNC_SCRUB_FLAG_VALID;\t\\\n\t}\t\t\t\t\t\t\t\t\\\n} while (0)\n\n#define pf_state_peer_ntoh(s,d) do {\t\t\\\n\t(d)->seqlo = ntohl((s)->seqlo);\t\t\\\n\t(d)->seqhi = ntohl((s)->seqhi);\t\t\\\n\t(d)->seqdiff = ntohl((s)->seqdiff);\t\\\n\t(d)->max_win = ntohs((s)->max_win);\t\\\n\t(d)->mss = ntohs((s)->mss);\t\t\\\n\t(d)->state = (s)->state;\t\t\\\n\t(d)->wscale = (s)->wscale;\t\t\\\n\tif ((s)->scrub.scrub_flag == PFSYNC_SCRUB_FLAG_VALID && \t\\\n\t    (d)->scrub != NULL) {\t\t\t\t\t\\\n\t\t(d)->scrub->pfss_flags =\t\t\t\t\\\n\t\t    ntohs((s)->scrub.pfss_flags) & PFSS_TIMESTAMP;\t\\\n\t\t(d)->scrub->pfss_ttl = (s)->scrub.pfss_ttl;\t\t\\\n\t\t(d)->scrub->pfss_ts_mod = ntohl((s)->scrub.pfss_ts_mod);\\\n\t}\t\t\t\t\t\t\t\t\\\n} while (0)\n\n#define pf_state_counter_hton(s,d) do {\t\t\t\t\\\n\td[0] = htonl((s>>32)&0xffffffff);\t\t\t\\\n\td[1] = htonl(s&0xffffffff);\t\t\t\t\\\n} while (0)\n\n#define pf_state_counter_from_pfsync(s)\t\t\t\t\\\n\t(((u_int64_t)(s[0])<<32) | (u_int64_t)(s[1]))\n\n#define pf_state_counter_ntoh(s,d) do {\t\t\t\t\\\n\td = ntohl(s[0]);\t\t\t\t\t\\\n\td = d<<32;\t\t\t\t\t\t\\\n\td += ntohl(s[1]);\t\t\t\t\t\\\n} while (0)\n\nTAILQ_HEAD(pf_rulequeue, pf_rule);\n\nstruct pf_anchor;\n\nstruct pf_ruleset {\n\tstruct {\n\t\tstruct pf_rulequeue\t queues[2];\n\t\tstruct {\n\t\t\tstruct pf_rulequeue\t*ptr;\n\t\t\tstruct pf_rule\t\t**ptr_array;\n\t\t\tu_int32_t\t\t rcount;\n\t\t\tu_int32_t\t\t ticket;\n\t\t\tint\t\t\t open;\n\t\t}\t\t\t active, inactive;\n\t}\t\t\t rules[PF_RULESET_MAX];\n\tstruct pf_anchor\t*anchor;\n\tu_int32_t\t\t tticket;\n\tint\t\t\t tables;\n\tint\t\t\t topen;\n};\n\nRB_HEAD(pf_anchor_global, pf_anchor);\nRB_HEAD(pf_anchor_node, pf_anchor);\nstruct pf_anchor {\n\tRB_ENTRY(pf_anchor)\t entry_global;\n\tRB_ENTRY(pf_anchor)\t entry_node;\n\tstruct pf_anchor\t*parent;\n\tstruct pf_anchor_node\t children;\n\tchar\t\t\t name[PF_ANCHOR_NAME_SIZE];\n\tchar\t\t\t path[MAXPATHLEN];\n\tstruct pf_ruleset\t ruleset;\n\tint\t\t\t refcnt;\t/* anchor rules */\n\tint\t\t\t match;\n};\nRB_PROTOTYPE(pf_anchor_global, pf_anchor, entry_global, pf_anchor_compare);\nRB_PROTOTYPE(pf_anchor_node, pf_anchor, entry_node, pf_anchor_compare);\n\n#define PF_RESERVED_ANCHOR\t\"_pf\"\n\n#define PFR_TFLAG_PERSIST\t0x00000001\n#define PFR_TFLAG_CONST\t\t0x00000002\n#define PFR_TFLAG_ACTIVE\t0x00000004\n#define PFR_TFLAG_INACTIVE\t0x00000008\n#define PFR_TFLAG_REFERENCED\t0x00000010\n#define PFR_TFLAG_REFDANCHOR\t0x00000020\n#define PFR_TFLAG_COUNTERS\t0x00000040\n/* Adjust masks below when adding flags. */\n#define PFR_TFLAG_USRMASK\t0x00000043\n#define PFR_TFLAG_SETMASK\t0x0000003C\n#define PFR_TFLAG_ALLMASK\t0x0000007F\n\nstruct pfr_table {\n\tchar\t\t\t pfrt_anchor[MAXPATHLEN];\n\tchar\t\t\t pfrt_name[PF_TABLE_NAME_SIZE];\n\tu_int32_t\t\t pfrt_flags;\n\tu_int8_t\t\t pfrt_fback;\n};\n\nenum { PFR_FB_NONE, PFR_FB_MATCH, PFR_FB_ADDED, PFR_FB_DELETED,\n\tPFR_FB_CHANGED, PFR_FB_CLEARED, PFR_FB_DUPLICATE,\n\tPFR_FB_NOTMATCH, PFR_FB_CONFLICT, PFR_FB_NOCOUNT, PFR_FB_MAX };\n\nstruct pfr_addr {\n\tunion {\n\t\tstruct in_addr\t _pfra_ip4addr;\n\t\tstruct in6_addr\t _pfra_ip6addr;\n\t}\t\t pfra_u;\n\tu_int8_t\t pfra_af;\n\tu_int8_t\t pfra_net;\n\tu_int8_t\t pfra_not;\n\tu_int8_t\t pfra_fback;\n};\n#define\tpfra_ip4addr\tpfra_u._pfra_ip4addr\n#define\tpfra_ip6addr\tpfra_u._pfra_ip6addr\n\nenum { PFR_DIR_IN, PFR_DIR_OUT, PFR_DIR_MAX };\nenum { PFR_OP_BLOCK, PFR_OP_PASS, PFR_OP_ADDR_MAX, PFR_OP_TABLE_MAX };\n#define PFR_OP_XPASS\tPFR_OP_ADDR_MAX\n\nstruct pfr_astats {\n\tstruct pfr_addr\t pfras_a;\n\tu_int64_t\t pfras_packets[PFR_DIR_MAX][PFR_OP_ADDR_MAX];\n\tu_int64_t\t pfras_bytes[PFR_DIR_MAX][PFR_OP_ADDR_MAX];\n\tlong\t\t pfras_tzero;\n};\n\nenum { PFR_REFCNT_RULE, PFR_REFCNT_ANCHOR, PFR_REFCNT_MAX };\n\nstruct pfr_tstats {\n\tstruct pfr_table pfrts_t;\n\tu_int64_t\t pfrts_packets[PFR_DIR_MAX][PFR_OP_TABLE_MAX];\n\tu_int64_t\t pfrts_bytes[PFR_DIR_MAX][PFR_OP_TABLE_MAX];\n\tu_int64_t\t pfrts_match;\n\tu_int64_t\t pfrts_nomatch;\n\tlong\t\t pfrts_tzero;\n\tint\t\t pfrts_cnt;\n\tint\t\t pfrts_refcnt[PFR_REFCNT_MAX];\n};\n#define\tpfrts_name\tpfrts_t.pfrt_name\n#define pfrts_flags\tpfrts_t.pfrt_flags\n\n#ifndef _SOCKADDR_UNION_DEFINED\n#define\t_SOCKADDR_UNION_DEFINED\nunion sockaddr_union {\n\tstruct sockaddr\t\tsa;\n\tstruct sockaddr_in\tsin;\n\tstruct sockaddr_in6\tsin6;\n};\n#endif /* _SOCKADDR_UNION_DEFINED */\n\nstruct pfr_kcounters {\n\tu_int64_t\t\t pfrkc_packets[PFR_DIR_MAX][PFR_OP_ADDR_MAX];\n\tu_int64_t\t\t pfrkc_bytes[PFR_DIR_MAX][PFR_OP_ADDR_MAX];\n};\n\nSLIST_HEAD(pfr_kentryworkq, pfr_kentry);\nstruct pfr_kentry {\n\tstruct radix_node\t pfrke_node[2];\n\tunion sockaddr_union\t pfrke_sa;\n\tSLIST_ENTRY(pfr_kentry)\t pfrke_workq;\n\tunion {\n\t\t\n\t\tstruct pfr_kcounters\t\t*pfrke_counters;\n#if 0\n\t\tstruct pfr_kroute\t\t*pfrke_route;\n#endif\n\t} u;\n\tlong\t\t\t pfrke_tzero;\n\tu_int8_t\t\t pfrke_af;\n\tu_int8_t\t\t pfrke_net;\n\tu_int8_t\t\t pfrke_not;\n\tu_int8_t\t\t pfrke_mark;\n};\n#define pfrke_counters\tu.pfrke_counters\n#define pfrke_route\tu.pfrke_route\n\n\nSLIST_HEAD(pfr_ktableworkq, pfr_ktable);\nRB_HEAD(pfr_ktablehead, pfr_ktable);\nstruct pfr_ktable {\n\tstruct pfr_tstats\t pfrkt_ts;\n\tRB_ENTRY(pfr_ktable)\t pfrkt_tree;\n\tSLIST_ENTRY(pfr_ktable)\t pfrkt_workq;\n\tstruct radix_node_head\t*pfrkt_ip4;\n\tstruct radix_node_head\t*pfrkt_ip6;\n\tstruct pfr_ktable\t*pfrkt_shadow;\n\tstruct pfr_ktable\t*pfrkt_root;\n\tstruct pf_ruleset\t*pfrkt_rs;\n\tlong\t\t\t pfrkt_larg;\n\tint\t\t\t pfrkt_nflags;\n};\n#define pfrkt_t\t\tpfrkt_ts.pfrts_t\n#define pfrkt_name\tpfrkt_t.pfrt_name\n#define pfrkt_anchor\tpfrkt_t.pfrt_anchor\n#define pfrkt_ruleset\tpfrkt_t.pfrt_ruleset\n#define pfrkt_flags\tpfrkt_t.pfrt_flags\n#define pfrkt_cnt\tpfrkt_ts.pfrts_cnt\n#define pfrkt_refcnt\tpfrkt_ts.pfrts_refcnt\n#define pfrkt_packets\tpfrkt_ts.pfrts_packets\n#define pfrkt_bytes\tpfrkt_ts.pfrts_bytes\n#define pfrkt_match\tpfrkt_ts.pfrts_match\n#define pfrkt_nomatch\tpfrkt_ts.pfrts_nomatch\n#define pfrkt_tzero\tpfrkt_ts.pfrts_tzero\n\nRB_HEAD(pf_state_tree, pf_state_key);\nRB_PROTOTYPE(pf_state_tree, pf_state_key, entry, pf_state_compare_key);\n\nRB_HEAD(pf_state_tree_ext_gwy, pf_state_key);\nRB_PROTOTYPE(pf_state_tree_ext_gwy, pf_state_key,\n    entry_ext_gwy, pf_state_compare_ext_gwy);\n\nRB_HEAD(pfi_ifhead, pfi_kif);\n\n/* state tables */\n#ifdef __FreeBSD__\n#ifdef _KERNEL\nVNET_DECLARE(struct pf_state_tree,\t pf_statetbl);\n#define\tV_pf_statetbl\t\t\t VNET(pf_statetbl)\n#endif\n#else\nextern struct pf_state_tree\t pf_statetbl;\n#endif\n\n/* keep synced with pfi_kif, used in RB_FIND */\nstruct pfi_kif_cmp {\n\tchar\t\t\t\t pfik_name[IFNAMSIZ];\n};\n\nstruct pfi_kif {\n\tchar\t\t\t\t pfik_name[IFNAMSIZ];\n\tRB_ENTRY(pfi_kif)\t\t pfik_tree;\n\tu_int64_t\t\t\t pfik_packets[2][2][2];\n\tu_int64_t\t\t\t pfik_bytes[2][2][2];\n\tu_int32_t\t\t\t pfik_tzero;\n\tint\t\t\t\t pfik_flags;\n\tvoid\t\t\t\t*pfik_ah_cookie;\n\tstruct ifnet\t\t\t*pfik_ifp;\n\tstruct ifg_group\t\t*pfik_group;\n\tint\t\t\t\t pfik_states;\n\tint\t\t\t\t pfik_rules;\n\tTAILQ_HEAD(, pfi_dynaddr)\t pfik_dynaddrs;\n};\n\nenum pfi_kif_refs {\n\tPFI_KIF_REF_NONE,\n\tPFI_KIF_REF_STATE,\n\tPFI_KIF_REF_RULE\n};\n\n#define PFI_IFLAG_SKIP\t\t0x0100\t/* skip filtering on interface */\n\nstruct pf_pdesc {\n\tstruct {\n\t\tint\t done;\n\t\tuid_t\t uid;\n\t\tgid_t\t gid;\n\t\tpid_t\t pid;\n\t}\t\t lookup;\n\tu_int64_t\t tot_len;\t/* Make Mickey money */\n\tunion {\n\t\tstruct tcphdr\t\t*tcp;\n\t\tstruct udphdr\t\t*udp;\n\t\tstruct icmp\t\t*icmp;\n#ifdef INET6\n\t\tstruct icmp6_hdr\t*icmp6;\n#endif /* INET6 */\n\t\tvoid\t\t\t*any;\n\t} hdr;\n\n\tstruct pf_rule\t*nat_rule;\t/* nat/rdr rule applied to packet */\n\tstruct ether_header\n\t\t\t*eh;\n\tstruct pf_addr\t*src;\t\t/* src address */\n\tstruct pf_addr\t*dst;\t\t/* dst address */\n\tu_int16_t *sport;\n\tu_int16_t *dport;\n#ifdef __FreeBSD__\n\tstruct pf_mtag\t*pf_mtag;\n#endif\n\n\tu_int32_t\t p_len;\t\t/* total length of payload */\n\n\tu_int16_t\t*ip_sum;\n\tu_int16_t\t*proto_sum;\n\tu_int16_t\t flags;\t\t/* Let SCRUB trigger behavior in\n\t\t\t\t\t * state code. Easier than tags */\n#define PFDESC_TCP_NORM\t0x0001\t\t/* TCP shall be statefully scrubbed */\n#define PFDESC_IP_REAS\t0x0002\t\t/* IP frags would've been reassembled */\n\tsa_family_t\t af;\n\tu_int8_t\t proto;\n\tu_int8_t\t tos;\n\tu_int8_t\t dir;\t\t/* direction */\n\tu_int8_t\t sidx;\t\t/* key index for source */\n\tu_int8_t\t didx;\t\t/* key index for destination */\n};\n\n/* flags for RDR options */\n#define PF_DPORT_RANGE\t0x01\t\t/* Dest port uses range */\n#define PF_RPORT_RANGE\t0x02\t\t/* RDR'ed port uses range */\n\n/* Reasons code for passing/dropping a packet */\n#define PFRES_MATCH\t0\t\t/* Explicit match of a rule */\n#define PFRES_BADOFF\t1\t\t/* Bad offset for pull_hdr */\n#define PFRES_FRAG\t2\t\t/* Dropping following fragment */\n#define PFRES_SHORT\t3\t\t/* Dropping short packet */\n#define PFRES_NORM\t4\t\t/* Dropping by normalizer */\n#define PFRES_MEMORY\t5\t\t/* Dropped due to lacking mem */\n#define PFRES_TS\t6\t\t/* Bad TCP Timestamp (RFC1323) */\n#define PFRES_CONGEST\t7\t\t/* Congestion (of ipintrq) */\n#define PFRES_IPOPTIONS 8\t\t/* IP option */\n#define PFRES_PROTCKSUM 9\t\t/* Protocol checksum invalid */\n#define PFRES_BADSTATE\t10\t\t/* State mismatch */\n#define PFRES_STATEINS\t11\t\t/* State insertion failure */\n#define PFRES_MAXSTATES\t12\t\t/* State limit */\n#define PFRES_SRCLIMIT\t13\t\t/* Source node/conn limit */\n#define PFRES_SYNPROXY\t14\t\t/* SYN proxy */\n#define PFRES_MAX\t15\t\t/* total+1 */\n\n#define PFRES_NAMES { \\\n\t\"match\", \\\n\t\"bad-offset\", \\\n\t\"fragment\", \\\n\t\"short\", \\\n\t\"normalize\", \\\n\t\"memory\", \\\n\t\"bad-timestamp\", \\\n\t\"congestion\", \\\n\t\"ip-option\", \\\n\t\"proto-cksum\", \\\n\t\"state-mismatch\", \\\n\t\"state-insert\", \\\n\t\"state-limit\", \\\n\t\"src-limit\", \\\n\t\"synproxy\", \\\n\tNULL \\\n}\n\n/* Counters for other things we want to keep track of */\n#define LCNT_STATES\t\t0\t/* states */\n#define LCNT_SRCSTATES\t\t1\t/* max-src-states */\n#define LCNT_SRCNODES\t\t2\t/* max-src-nodes */\n#define LCNT_SRCCONN\t\t3\t/* max-src-conn */\n#define LCNT_SRCCONNRATE\t4\t/* max-src-conn-rate */\n#define LCNT_OVERLOAD_TABLE\t5\t/* entry added to overload table */\n#define LCNT_OVERLOAD_FLUSH\t6\t/* state entries flushed */\n#define LCNT_MAX\t\t7\t/* total+1 */\n\n#define LCNT_NAMES { \\\n\t\"max states per rule\", \\\n\t\"max-src-states\", \\\n\t\"max-src-nodes\", \\\n\t\"max-src-conn\", \\\n\t\"max-src-conn-rate\", \\\n\t\"overload table insertion\", \\\n\t\"overload flush states\", \\\n\tNULL \\\n}\n\n/* UDP state enumeration */\n#define PFUDPS_NO_TRAFFIC\t0\n#define PFUDPS_SINGLE\t\t1\n#define PFUDPS_MULTIPLE\t\t2\n\n#define PFUDPS_NSTATES\t\t3\t/* number of state levels */\n\n#define PFUDPS_NAMES { \\\n\t\"NO_TRAFFIC\", \\\n\t\"SINGLE\", \\\n\t\"MULTIPLE\", \\\n\tNULL \\\n}\n\n/* Other protocol state enumeration */\n#define PFOTHERS_NO_TRAFFIC\t0\n#define PFOTHERS_SINGLE\t\t1\n#define PFOTHERS_MULTIPLE\t2\n\n#define PFOTHERS_NSTATES\t3\t/* number of state levels */\n\n#define PFOTHERS_NAMES { \\\n\t\"NO_TRAFFIC\", \\\n\t\"SINGLE\", \\\n\t\"MULTIPLE\", \\\n\tNULL \\\n}\n\n#define FCNT_STATE_SEARCH\t0\n#define FCNT_STATE_INSERT\t1\n#define FCNT_STATE_REMOVALS\t2\n#define FCNT_MAX\t\t3\n\n#define SCNT_SRC_NODE_SEARCH\t0\n#define SCNT_SRC_NODE_INSERT\t1\n#define SCNT_SRC_NODE_REMOVALS\t2\n#define SCNT_MAX\t\t3\n\n#define ACTION_SET(a, x) \\\n\tdo { \\\n\t\tif ((a) != NULL) \\\n\t\t\t*(a) = (x); \\\n\t} while (0)\n\n#ifdef __FreeBSD__\n#define REASON_SET(a, x) \\\n\tdo { \\\n\t\tif ((a) != NULL) \\\n\t\t\t*(a) = (x); \\\n\t\tif (x < PFRES_MAX) \\\n\t\t\tV_pf_status.counters[x]++; \\\n\t} while (0)\n#else\n#define REASON_SET(a, x) \\\n\tdo { \\\n\t\tif ((a) != NULL) \\\n\t\t\t*(a) = (x); \\\n\t\tif (x < PFRES_MAX) \\\n\t\t\tpf_status.counters[x]++; \\\n\t} while (0)\n#endif\n\nstruct pf_status {\n\tu_int64_t\tcounters[PFRES_MAX];\n\tu_int64_t\tlcounters[LCNT_MAX];\t/* limit counters */\n\tu_int64_t\tfcounters[FCNT_MAX];\n\tu_int64_t\tscounters[SCNT_MAX];\n\tu_int64_t\tpcounters[2][2][3];\n\tu_int64_t\tbcounters[2][2];\n\tu_int64_t\tstateid;\n\tu_int32_t\trunning;\n\tu_int32_t\tstates;\n\tu_int32_t\tsrc_nodes;\n\tu_int32_t\tsince;\n\tu_int32_t\tdebug;\n\tu_int32_t\thostid;\n\tchar\t\tifname[IFNAMSIZ];\n\tu_int8_t\tpf_chksum[PF_MD5_DIGEST_LENGTH];\n};\n\nstruct cbq_opts {\n\tu_int\t\tminburst;\n\tu_int\t\tmaxburst;\n\tu_int\t\tpktsize;\n\tu_int\t\tmaxpktsize;\n\tu_int\t\tns_per_byte;\n\tu_int\t\tmaxidle;\n\tint\t\tminidle;\n\tu_int\t\tofftime;\n\tint\t\tflags;\n};\n\nstruct priq_opts {\n\tint\t\tflags;\n};\n\nstruct hfsc_opts {\n\t/* real-time service curve */\n\tu_int\t\trtsc_m1;\t/* slope of the 1st segment in bps */\n\tu_int\t\trtsc_d;\t\t/* the x-projection of m1 in msec */\n\tu_int\t\trtsc_m2;\t/* slope of the 2nd segment in bps */\n\t/* link-sharing service curve */\n\tu_int\t\tlssc_m1;\n\tu_int\t\tlssc_d;\n\tu_int\t\tlssc_m2;\n\t/* upper-limit service curve */\n\tu_int\t\tulsc_m1;\n\tu_int\t\tulsc_d;\n\tu_int\t\tulsc_m2;\n\tint\t\tflags;\n};\n\nstruct pf_altq {\n\tchar\t\t\t ifname[IFNAMSIZ];\n\n\tvoid\t\t\t*altq_disc;\t/* discipline-specific state */\n\tTAILQ_ENTRY(pf_altq)\t entries;\n\n\t/* scheduler spec */\n\tu_int8_t\t\t scheduler;\t/* scheduler type */\n\tu_int16_t\t\t tbrsize;\t/* tokenbucket regulator size */\n\tu_int32_t\t\t ifbandwidth;\t/* interface bandwidth */\n\n\t/* queue spec */\n\tchar\t\t\t qname[PF_QNAME_SIZE];\t/* queue name */\n\tchar\t\t\t parent[PF_QNAME_SIZE];\t/* parent name */\n\tu_int32_t\t\t parent_qid;\t/* parent queue id */\n\tu_int32_t\t\t bandwidth;\t/* queue bandwidth */\n\tu_int8_t\t\t priority;\t/* priority */\n#ifdef __FreeBSD__\n\tu_int8_t\t\t local_flags;\t/* dynamic interface */\n#define\tPFALTQ_FLAG_IF_REMOVED\t\t0x01\n#endif\n\tu_int16_t\t\t qlimit;\t/* queue size limit */\n\tu_int16_t\t\t flags;\t\t/* misc flags */\n\tunion {\n\t\tstruct cbq_opts\t\t cbq_opts;\n\t\tstruct priq_opts\t priq_opts;\n\t\tstruct hfsc_opts\t hfsc_opts;\n\t} pq_u;\n\n\tu_int32_t\t\t qid;\t\t/* return value */\n};\n\nstruct pf_tagname {\n\tTAILQ_ENTRY(pf_tagname)\tentries;\n\tchar\t\t\tname[PF_TAG_NAME_SIZE];\n\tu_int16_t\t\ttag;\n\tint\t\t\tref;\n};\n\nstruct pf_divert {\n\tunion {\n\t\tstruct in_addr\tipv4;\n\t\tstruct in6_addr\tipv6;\n\t}\t\taddr;\n\tu_int16_t\tport;\n};\n\n#define PFFRAG_FRENT_HIWAT\t5000\t/* Number of fragment entries */\n#define PFFRAG_FRAG_HIWAT\t1000\t/* Number of fragmented packets */\n#define PFFRAG_FRCENT_HIWAT\t50000\t/* Number of fragment cache entries */\n#define PFFRAG_FRCACHE_HIWAT\t10000\t/* Number of fragment descriptors */\n\n#define PFR_KTABLE_HIWAT\t1000\t/* Number of tables */\n#define PFR_KENTRY_HIWAT\t200000\t/* Number of table entries */\n#define PFR_KENTRY_HIWAT_SMALL\t100000\t/* Number of table entries (tiny hosts) */\n\n/*\n * ioctl parameter structures\n */\n\nstruct pfioc_pooladdr {\n\tu_int32_t\t\t action;\n\tu_int32_t\t\t ticket;\n\tu_int32_t\t\t nr;\n\tu_int32_t\t\t r_num;\n\tu_int8_t\t\t r_action;\n\tu_int8_t\t\t r_last;\n\tu_int8_t\t\t af;\n\tchar\t\t\t anchor[MAXPATHLEN];\n\tstruct pf_pooladdr\t addr;\n};\n\nstruct pfioc_rule {\n\tu_int32_t\t action;\n\tu_int32_t\t ticket;\n\tu_int32_t\t pool_ticket;\n\tu_int32_t\t nr;\n\tchar\t\t anchor[MAXPATHLEN];\n\tchar\t\t anchor_call[MAXPATHLEN];\n\tstruct pf_rule\t rule;\n};\n\nstruct pfioc_natlook {\n\tstruct pf_addr\t saddr;\n\tstruct pf_addr\t daddr;\n\tstruct pf_addr\t rsaddr;\n\tstruct pf_addr\t rdaddr;\n\tu_int16_t\t sport;\n\tu_int16_t\t dport;\n\tu_int16_t\t rsport;\n\tu_int16_t\t rdport;\n\tsa_family_t\t af;\n\tu_int8_t\t proto;\n\tu_int8_t\t direction;\n};\n\nstruct pfioc_state {\n\tstruct pfsync_state\tstate;\n};\n\nstruct pfioc_src_node_kill {\n\tsa_family_t psnk_af;\n\tstruct pf_rule_addr psnk_src;\n\tstruct pf_rule_addr psnk_dst;\n\tu_int\t\t    psnk_killed;\n};\n\nstruct pfioc_state_kill {\n\tstruct pf_state_cmp\tpsk_pfcmp;\n\tsa_family_t\t\tpsk_af;\n\tint\t\t\tpsk_proto;\n\tstruct pf_rule_addr\tpsk_src;\n\tstruct pf_rule_addr\tpsk_dst;\n\tchar\t\t\tpsk_ifname[IFNAMSIZ];\n\tchar\t\t\tpsk_label[PF_RULE_LABEL_SIZE];\n\tu_int\t\t\tpsk_killed;\n};\n\nstruct pfioc_states {\n\tint\tps_len;\n\tunion {\n\t\tcaddr_t\t\t\t psu_buf;\n\t\tstruct pfsync_state\t*psu_states;\n\t} ps_u;\n#define ps_buf\t\tps_u.psu_buf\n#define ps_states\tps_u.psu_states\n};\n\nstruct pfioc_src_nodes {\n\tint\tpsn_len;\n\tunion {\n\t\tcaddr_t\t\t psu_buf;\n\t\tstruct pf_src_node\t*psu_src_nodes;\n\t} psn_u;\n#define psn_buf\t\tpsn_u.psu_buf\n#define psn_src_nodes\tpsn_u.psu_src_nodes\n};\n\nstruct pfioc_if {\n\tchar\t\t ifname[IFNAMSIZ];\n};\n\nstruct pfioc_tm {\n\tint\t\t timeout;\n\tint\t\t seconds;\n};\n\nstruct pfioc_limit {\n\tint\t\t index;\n\tunsigned\t limit;\n};\n\nstruct pfioc_altq {\n\tu_int32_t\t action;\n\tu_int32_t\t ticket;\n\tu_int32_t\t nr;\n\tstruct pf_altq\t altq;\n};\n\nstruct pfioc_qstats {\n\tu_int32_t\t ticket;\n\tu_int32_t\t nr;\n\tvoid\t\t*buf;\n\tint\t\t nbytes;\n\tu_int8_t\t scheduler;\n};\n\nstruct pfioc_ruleset {\n\tu_int32_t\t nr;\n\tchar\t\t path[MAXPATHLEN];\n\tchar\t\t name[PF_ANCHOR_NAME_SIZE];\n};\n\n#define PF_RULESET_ALTQ\t\t(PF_RULESET_MAX)\n#define PF_RULESET_TABLE\t(PF_RULESET_MAX+1)\nstruct pfioc_trans {\n\tint\t\t size;\t/* number of elements */\n\tint\t\t esize; /* size of each element in bytes */\n\tstruct pfioc_trans_e {\n\t\tint\t\trs_num;\n\t\tchar\t\tanchor[MAXPATHLEN];\n\t\tu_int32_t\tticket;\n\t}\t\t*array;\n};\n\n#define PFR_FLAG_ATOMIC\t\t0x00000001\n#define PFR_FLAG_DUMMY\t\t0x00000002\n#define PFR_FLAG_FEEDBACK\t0x00000004\n#define PFR_FLAG_CLSTATS\t0x00000008\n#define PFR_FLAG_ADDRSTOO\t0x00000010\n#define PFR_FLAG_REPLACE\t0x00000020\n#define PFR_FLAG_ALLRSETS\t0x00000040\n#define PFR_FLAG_ALLMASK\t0x0000007F\n#ifdef _KERNEL\n#define PFR_FLAG_USERIOCTL\t0x10000000\n#endif\n\nstruct pfioc_table {\n\tstruct pfr_table\t pfrio_table;\n\tvoid\t\t\t*pfrio_buffer;\n\tint\t\t\t pfrio_esize;\n\tint\t\t\t pfrio_size;\n\tint\t\t\t pfrio_size2;\n\tint\t\t\t pfrio_nadd;\n\tint\t\t\t pfrio_ndel;\n\tint\t\t\t pfrio_nchange;\n\tint\t\t\t pfrio_flags;\n\tu_int32_t\t\t pfrio_ticket;\n};\n#define\tpfrio_exists\tpfrio_nadd\n#define\tpfrio_nzero\tpfrio_nadd\n#define\tpfrio_nmatch\tpfrio_nadd\n#define pfrio_naddr\tpfrio_size2\n#define pfrio_setflag\tpfrio_size2\n#define pfrio_clrflag\tpfrio_nadd\n\nstruct pfioc_iface {\n\tchar\t pfiio_name[IFNAMSIZ];\n\tvoid\t*pfiio_buffer;\n\tint\t pfiio_esize;\n\tint\t pfiio_size;\n\tint\t pfiio_nzero;\n\tint\t pfiio_flags;\n};\n\n\n/*\n * ioctl operations\n */\n\n#define DIOCSTART\t_IO  ('D',  1)\n#define DIOCSTOP\t_IO  ('D',  2)\n#define DIOCADDRULE\t_IOWR('D',  4, struct pfioc_rule)\n#define DIOCGETRULES\t_IOWR('D',  6, struct pfioc_rule)\n#define DIOCGETRULE\t_IOWR('D',  7, struct pfioc_rule)\n/* XXX cut 8 - 17 */\n#define DIOCCLRSTATES\t_IOWR('D', 18, struct pfioc_state_kill)\n#define DIOCGETSTATE\t_IOWR('D', 19, struct pfioc_state)\n#define DIOCSETSTATUSIF _IOWR('D', 20, struct pfioc_if)\n#define DIOCGETSTATUS\t_IOWR('D', 21, struct pf_status)\n#define DIOCCLRSTATUS\t_IO  ('D', 22)\n#define DIOCNATLOOK\t_IOWR('D', 23, struct pfioc_natlook)\n#define DIOCSETDEBUG\t_IOWR('D', 24, u_int32_t)\n#define DIOCGETSTATES\t_IOWR('D', 25, struct pfioc_states)\n#define DIOCCHANGERULE\t_IOWR('D', 26, struct pfioc_rule)\n/* XXX cut 26 - 28 */\n#define DIOCSETTIMEOUT\t_IOWR('D', 29, struct pfioc_tm)\n#define DIOCGETTIMEOUT\t_IOWR('D', 30, struct pfioc_tm)\n#define DIOCADDSTATE\t_IOWR('D', 37, struct pfioc_state)\n#define DIOCCLRRULECTRS\t_IO  ('D', 38)\n#define DIOCGETLIMIT\t_IOWR('D', 39, struct pfioc_limit)\n#define DIOCSETLIMIT\t_IOWR('D', 40, struct pfioc_limit)\n#define DIOCKILLSTATES\t_IOWR('D', 41, struct pfioc_state_kill)\n#define DIOCSTARTALTQ\t_IO  ('D', 42)\n#define DIOCSTOPALTQ\t_IO  ('D', 43)\n#define DIOCADDALTQ\t_IOWR('D', 45, struct pfioc_altq)\n#define DIOCGETALTQS\t_IOWR('D', 47, struct pfioc_altq)\n#define DIOCGETALTQ\t_IOWR('D', 48, struct pfioc_altq)\n#define DIOCCHANGEALTQ\t_IOWR('D', 49, struct pfioc_altq)\n#define DIOCGETQSTATS\t_IOWR('D', 50, struct pfioc_qstats)\n#define DIOCBEGINADDRS\t_IOWR('D', 51, struct pfioc_pooladdr)\n#define DIOCADDADDR\t_IOWR('D', 52, struct pfioc_pooladdr)\n#define DIOCGETADDRS\t_IOWR('D', 53, struct pfioc_pooladdr)\n#define DIOCGETADDR\t_IOWR('D', 54, struct pfioc_pooladdr)\n#define DIOCCHANGEADDR\t_IOWR('D', 55, struct pfioc_pooladdr)\n/* XXX cut 55 - 57 */\n#define\tDIOCGETRULESETS\t_IOWR('D', 58, struct pfioc_ruleset)\n#define\tDIOCGETRULESET\t_IOWR('D', 59, struct pfioc_ruleset)\n#define\tDIOCRCLRTABLES\t_IOWR('D', 60, struct pfioc_table)\n#define\tDIOCRADDTABLES\t_IOWR('D', 61, struct pfioc_table)\n#define\tDIOCRDELTABLES\t_IOWR('D', 62, struct pfioc_table)\n#define\tDIOCRGETTABLES\t_IOWR('D', 63, struct pfioc_table)\n#define\tDIOCRGETTSTATS\t_IOWR('D', 64, struct pfioc_table)\n#define DIOCRCLRTSTATS\t_IOWR('D', 65, struct pfioc_table)\n#define\tDIOCRCLRADDRS\t_IOWR('D', 66, struct pfioc_table)\n#define\tDIOCRADDADDRS\t_IOWR('D', 67, struct pfioc_table)\n#define\tDIOCRDELADDRS\t_IOWR('D', 68, struct pfioc_table)\n#define\tDIOCRSETADDRS\t_IOWR('D', 69, struct pfioc_table)\n#define\tDIOCRGETADDRS\t_IOWR('D', 70, struct pfioc_table)\n#define\tDIOCRGETASTATS\t_IOWR('D', 71, struct pfioc_table)\n#define\tDIOCRCLRASTATS\t_IOWR('D', 72, struct pfioc_table)\n#define\tDIOCRTSTADDRS\t_IOWR('D', 73, struct pfioc_table)\n#define\tDIOCRSETTFLAGS\t_IOWR('D', 74, struct pfioc_table)\n#define\tDIOCRINADEFINE\t_IOWR('D', 77, struct pfioc_table)\n#define\tDIOCOSFPFLUSH\t_IO('D', 78)\n#define\tDIOCOSFPADD\t_IOWR('D', 79, struct pf_osfp_ioctl)\n#define\tDIOCOSFPGET\t_IOWR('D', 80, struct pf_osfp_ioctl)\n#define\tDIOCXBEGIN\t_IOWR('D', 81, struct pfioc_trans)\n#define\tDIOCXCOMMIT\t_IOWR('D', 82, struct pfioc_trans)\n#define\tDIOCXROLLBACK\t_IOWR('D', 83, struct pfioc_trans)\n#define\tDIOCGETSRCNODES\t_IOWR('D', 84, struct pfioc_src_nodes)\n#define\tDIOCCLRSRCNODES\t_IO('D', 85)\n#define\tDIOCSETHOSTID\t_IOWR('D', 86, u_int32_t)\n#define\tDIOCIGETIFACES\t_IOWR('D', 87, struct pfioc_iface)\n#define\tDIOCSETIFFLAG\t_IOWR('D', 89, struct pfioc_iface)\n#define\tDIOCCLRIFFLAG\t_IOWR('D', 90, struct pfioc_iface)\n#define\tDIOCKILLSRCNODES\t_IOWR('D', 91, struct pfioc_src_node_kill)\n#ifdef __FreeBSD__\nstruct pf_ifspeed {\n\tchar\t\t\tifname[IFNAMSIZ];\n\tu_int32_t\t\tbaudrate;\n};\n#define\tDIOCGIFSPEED\t_IOWR('D', 92, struct pf_ifspeed)\n#endif\n\n#ifdef _KERNEL\nRB_HEAD(pf_src_tree, pf_src_node);\nRB_PROTOTYPE(pf_src_tree, pf_src_node, entry, pf_src_compare);\n#ifdef __FreeBSD__\nVNET_DECLARE(struct pf_src_tree,\t tree_src_tracking);\n#define\tV_tree_src_tracking\t\t VNET(tree_src_tracking)\n#else\nextern struct pf_src_tree tree_src_tracking;\n#endif\n\nRB_HEAD(pf_state_tree_id, pf_state);\nRB_PROTOTYPE(pf_state_tree_id, pf_state,\n    entry_id, pf_state_compare_id);\n#ifdef __FreeBSD__\nVNET_DECLARE(struct pf_state_tree_id,\t tree_id);\n#define\tV_tree_id\t\t\t VNET(tree_id)\nVNET_DECLARE(struct pf_state_queue,\t state_list);\n#define\tV_state_list\t\t\t VNET(state_list)\n#else\nextern struct pf_state_tree_id tree_id;\nextern struct pf_state_queue state_list;\n#endif\n\nTAILQ_HEAD(pf_poolqueue, pf_pool);\n#ifdef __FreeBSD__\nVNET_DECLARE(struct pf_poolqueue,\t pf_pools[2]);\n#define\tV_pf_pools\t\t\t VNET(pf_pools)\n#else\nextern struct pf_poolqueue\t\t  pf_pools[2];\n#endif\nTAILQ_HEAD(pf_altqqueue, pf_altq);\n#ifdef __FreeBSD__\nVNET_DECLARE(struct pf_altqqueue,\t pf_altqs[2]);\n#define\tV_pf_altqs\t\t\t VNET(pf_altqs)\nVNET_DECLARE(struct pf_palist,\t\t pf_pabuf);\n#define\tV_pf_pabuf\t\t\t VNET(pf_pabuf)\n#else\nextern struct pf_altqqueue\t\t  pf_altqs[2];\nextern struct pf_palist\t\t\t  pf_pabuf;\n#endif\n\n#ifdef __FreeBSD__\nVNET_DECLARE(u_int32_t,\t\t\t ticket_altqs_active);\n#define\tV_ticket_altqs_active\t\t VNET(ticket_altqs_active)\nVNET_DECLARE(u_int32_t,\t\t\t ticket_altqs_inactive);\n#define\tV_ticket_altqs_inactive\t\t VNET(ticket_altqs_inactive)\nVNET_DECLARE(int,\t\t\t altqs_inactive_open);\n#define\tV_altqs_inactive_open\t\t VNET(altqs_inactive_open)\nVNET_DECLARE(u_int32_t,\t\t\t ticket_pabuf);\n#define\tV_ticket_pabuf\t\t\t VNET(ticket_pabuf)\nVNET_DECLARE(struct pf_altqqueue *,\t pf_altqs_active);\n#define\tV_pf_altqs_active\t\t VNET(pf_altqs_active)\nVNET_DECLARE(struct pf_altqqueue *,\t pf_altqs_inactive);\n#define\tV_pf_altqs_inactive\t\t VNET(pf_altqs_inactive)\nVNET_DECLARE(struct pf_poolqueue *,\t pf_pools_active);\n#define\tV_pf_pools_active\t\t VNET(pf_pools_active)\nVNET_DECLARE(struct pf_poolqueue *,\t pf_pools_inactive);\n#define\tV_pf_pools_inactive\t\t VNET(pf_pools_inactive)\n#else\nextern u_int32_t\t\t ticket_altqs_active;\nextern u_int32_t\t\t ticket_altqs_inactive;\nextern int\t\t\t altqs_inactive_open;\nextern u_int32_t\t\t ticket_pabuf;\nextern struct pf_altqqueue\t*pf_altqs_active;\nextern struct pf_altqqueue\t*pf_altqs_inactive;\nextern struct pf_poolqueue\t*pf_pools_active;\nextern struct pf_poolqueue\t*pf_pools_inactive;\n#endif\nextern int\t\t\t pf_tbladdr_setup(struct pf_ruleset *,\n\t\t\t\t    struct pf_addr_wrap *);\nextern void\t\t\t pf_tbladdr_remove(struct pf_addr_wrap *);\nextern void\t\t\t pf_tbladdr_copyout(struct pf_addr_wrap *);\nextern void\t\t\t pf_calc_skip_steps(struct pf_rulequeue *);\n#ifdef __FreeBSD__\n#ifdef ALTQ\nextern\tvoid\t\t\t pf_altq_ifnet_event(struct ifnet *, int);\n#endif\nVNET_DECLARE(uma_zone_t,\t\t pf_src_tree_pl);\n#define\tV_pf_src_tree_pl\t\t VNET(pf_src_tree_pl)\nVNET_DECLARE(uma_zone_t,\t\t pf_rule_pl);\n#define\tV_pf_rule_pl\t\t\t VNET(pf_rule_pl)\nVNET_DECLARE(uma_zone_t,\t\t pf_state_pl);\n#define\tV_pf_state_pl\t\t\t VNET(pf_state_pl)\nVNET_DECLARE(uma_zone_t,\t\t pf_state_key_pl);\n#define\tV_pf_state_key_pl\t\t VNET(pf_state_key_pl)\nVNET_DECLARE(uma_zone_t,\t\t pf_state_item_pl);\n#define\tV_pf_state_item_pl\t\t VNET(pf_state_item_pl)\nVNET_DECLARE(uma_zone_t,\t\t pf_altq_pl);\n#define\tV_pf_altq_pl\t\t\t VNET(pf_altq_pl)\nVNET_DECLARE(uma_zone_t,\t\t pf_pooladdr_pl);\n#define\tV_pf_pooladdr_pl\t\t VNET(pf_pooladdr_pl)\nVNET_DECLARE(uma_zone_t,\t\t pfr_ktable_pl);\n#define\tV_pfr_ktable_pl\t\t\t VNET(pfr_ktable_pl)\nVNET_DECLARE(uma_zone_t,\t\t pfr_kentry_pl);\n#define\tV_pfr_kentry_pl\t\t\t VNET(pfr_kentry_pl)\nVNET_DECLARE(uma_zone_t,\t\t pf_cache_pl);\n#define\tV_pf_cache_pl\t\t\t VNET(pf_cache_pl)\nVNET_DECLARE(uma_zone_t,\t\t pf_cent_pl);\n#define\tV_pf_cent_pl\t\t\t VNET(pf_cent_pl)\nVNET_DECLARE(uma_zone_t,\t\t pf_state_scrub_pl);\n#define\tV_pf_state_scrub_pl\t\t VNET(pf_state_scrub_pl)\nVNET_DECLARE(uma_zone_t,\t\t pfi_addr_pl);\n#define\tV_pfi_addr_pl\t\t\t VNET(pfi_addr_pl)\n#else\nextern struct pool\t\t pf_src_tree_pl, pf_rule_pl;\nextern struct pool\t\t pf_state_pl, pf_state_key_pl, pf_state_item_pl,\n\t\t\t\t    pf_altq_pl, pf_pooladdr_pl;\nextern struct pool\t\t pf_state_scrub_pl;\n#endif\nextern void\t\t\t pf_purge_thread(void *);\n#ifdef __FreeBSD__\nextern int\t\t\t pf_purge_expired_src_nodes(int);\nextern int\t\t\t pf_purge_expired_states(u_int32_t , int);\n#else\nextern void\t\t\t pf_purge_expired_src_nodes(int);\nextern void\t\t\t pf_purge_expired_states(u_int32_t);\n#endif\nextern void\t\t\t pf_unlink_state(struct pf_state *);\nextern void\t\t\t pf_free_state(struct pf_state *);\nextern int\t\t\t pf_state_insert(struct pfi_kif *,\n\t\t\t\t    struct pf_state_key *,\n\t\t\t\t    struct pf_state_key *,\n\t\t\t\t    struct pf_state *);\nextern int\t\t\t pf_insert_src_node(struct pf_src_node **,\n\t\t\t\t    struct pf_rule *, struct pf_addr *,\n\t\t\t\t    sa_family_t);\nvoid\t\t\t\t pf_src_tree_remove_state(struct pf_state *);\nextern struct pf_state\t\t*pf_find_state_byid(struct pf_state_cmp *);\nextern struct pf_state\t\t*pf_find_state_all(struct pf_state_key_cmp *,\n\t\t\t\t    u_int, int *);\nextern void\t\t\t pf_print_state(struct pf_state *);\nextern void\t\t\t pf_print_flags(u_int8_t);\nextern u_int16_t\t\t pf_cksum_fixup(u_int16_t, u_int16_t, u_int16_t,\n\t\t\t\t    u_int8_t);\n\n#ifdef __FreeBSD__\nVNET_DECLARE(struct ifnet *,\t\t sync_ifp);\n#define\tV_sync_ifp\t\t \t VNET(sync_ifp);\nVNET_DECLARE(struct pf_rule,\t\t pf_default_rule);\n#define\tV_pf_default_rule\t\t  VNET(pf_default_rule)\n#else\nextern struct ifnet\t\t*sync_ifp;\nextern struct pf_rule\t\t pf_default_rule;\n#endif\nextern void\t\t\t pf_addrcpy(struct pf_addr *, struct pf_addr *,\n\t\t\t\t    u_int8_t);\nvoid\t\t\t\t pf_rm_rule(struct pf_rulequeue *,\n\t\t\t\t    struct pf_rule *);\n#ifndef __FreeBSD__\nstruct pf_divert\t\t*pf_find_divert(struct mbuf *);\n#endif\n\n#ifdef INET\n#ifdef __FreeBSD__\nint\tpf_test(int, struct ifnet *, struct mbuf **, struct ether_header *,\n    struct inpcb *);\n#else\nint\tpf_test(int, struct ifnet *, struct mbuf **, struct ether_header *);\n#endif\n#endif /* INET */\n\n#ifdef INET6\n#ifdef __FreeBSD__\nint\tpf_test6(int, struct ifnet *, struct mbuf **, struct ether_header *,\n    struct inpcb *);\n#else\nint\tpf_test6(int, struct ifnet *, struct mbuf **, struct ether_header *);\n#endif\nvoid\tpf_poolmask(struct pf_addr *, struct pf_addr*,\n\t    struct pf_addr *, struct pf_addr *, u_int8_t);\nvoid\tpf_addr_inc(struct pf_addr *, sa_family_t);\n#endif /* INET6 */\n\n#ifdef __FreeBSD__\nu_int32_t\tpf_new_isn(struct pf_state *);\n#endif\nvoid   *pf_pull_hdr(struct mbuf *, int, void *, int, u_short *, u_short *,\n\t    sa_family_t);\nvoid\tpf_change_a(void *, u_int16_t *, u_int32_t, u_int8_t);\nint\tpflog_packet(struct pfi_kif *, struct mbuf *, sa_family_t, u_int8_t,\n\t    u_int8_t, struct pf_rule *, struct pf_rule *, struct pf_ruleset *,\n\t    struct pf_pdesc *);\nvoid\tpf_send_deferred_syn(struct pf_state *);\nint\tpf_match_addr(u_int8_t, struct pf_addr *, struct pf_addr *,\n\t    struct pf_addr *, sa_family_t);\nint\tpf_match_addr_range(struct pf_addr *, struct pf_addr *,\n\t    struct pf_addr *, sa_family_t);\nint\tpf_match(u_int8_t, u_int32_t, u_int32_t, u_int32_t);\nint\tpf_match_port(u_int8_t, u_int16_t, u_int16_t, u_int16_t);\nint\tpf_match_uid(u_int8_t, uid_t, uid_t, uid_t);\nint\tpf_match_gid(u_int8_t, gid_t, gid_t, gid_t);\n\nvoid\tpf_normalize_init(void);\nint\tpf_normalize_ip(struct mbuf **, int, struct pfi_kif *, u_short *,\n\t    struct pf_pdesc *);\nint\tpf_normalize_ip6(struct mbuf **, int, struct pfi_kif *, u_short *,\n\t    struct pf_pdesc *);\nint\tpf_normalize_tcp(int, struct pfi_kif *, struct mbuf *, int, int, void *,\n\t    struct pf_pdesc *);\nvoid\tpf_normalize_tcp_cleanup(struct pf_state *);\nint\tpf_normalize_tcp_init(struct mbuf *, int, struct pf_pdesc *,\n\t    struct tcphdr *, struct pf_state_peer *, struct pf_state_peer *);\nint\tpf_normalize_tcp_stateful(struct mbuf *, int, struct pf_pdesc *,\n\t    u_short *, struct tcphdr *, struct pf_state *,\n\t    struct pf_state_peer *, struct pf_state_peer *, int *);\nu_int32_t\n\tpf_state_expires(const struct pf_state *);\nvoid\tpf_purge_expired_fragments(void);\nint\tpf_routable(struct pf_addr *addr, sa_family_t af, struct pfi_kif *);\nint\tpf_rtlabel_match(struct pf_addr *, sa_family_t, struct pf_addr_wrap *);\n#ifdef __FreeBSD__\nint\tpf_socket_lookup(int, struct pf_pdesc *,  struct inpcb *);\n#else\nint\tpf_socket_lookup(int, struct pf_pdesc *);\n#endif\nstruct pf_state_key *pf_alloc_state_key(int);\nvoid\tpf_pkt_addr_changed(struct mbuf *);\nint\tpf_state_key_attach(struct pf_state_key *, struct pf_state *, int);\nvoid\tpfr_initialize(void);\nint\tpfr_match_addr(struct pfr_ktable *, struct pf_addr *, sa_family_t);\nvoid\tpfr_update_stats(struct pfr_ktable *, struct pf_addr *, sa_family_t,\n\t    u_int64_t, int, int, int);\nint\tpfr_pool_get(struct pfr_ktable *, int *, struct pf_addr *,\n\t    struct pf_addr **, struct pf_addr **, sa_family_t);\nvoid\tpfr_dynaddr_update(struct pfr_ktable *, struct pfi_dynaddr *);\nstruct pfr_ktable *\n\tpfr_attach_table(struct pf_ruleset *, char *, int);\nvoid\tpfr_detach_table(struct pfr_ktable *);\nint\tpfr_clr_tables(struct pfr_table *, int *, int);\nint\tpfr_add_tables(struct pfr_table *, int, int *, int);\nint\tpfr_del_tables(struct pfr_table *, int, int *, int);\nint\tpfr_get_tables(struct pfr_table *, struct pfr_table *, int *, int);\nint\tpfr_get_tstats(struct pfr_table *, struct pfr_tstats *, int *, int);\nint\tpfr_clr_tstats(struct pfr_table *, int, int *, int);\nint\tpfr_set_tflags(struct pfr_table *, int, int, int, int *, int *, int);\nint\tpfr_clr_addrs(struct pfr_table *, int *, int);\nint\tpfr_insert_kentry(struct pfr_ktable *, struct pfr_addr *, long);\nint\tpfr_add_addrs(struct pfr_table *, struct pfr_addr *, int, int *,\n\t    int);\nint\tpfr_del_addrs(struct pfr_table *, struct pfr_addr *, int, int *,\n\t    int);\nint\tpfr_set_addrs(struct pfr_table *, struct pfr_addr *, int, int *,\n\t    int *, int *, int *, int, u_int32_t);\nint\tpfr_get_addrs(struct pfr_table *, struct pfr_addr *, int *, int);\nint\tpfr_get_astats(struct pfr_table *, struct pfr_astats *, int *, int);\nint\tpfr_clr_astats(struct pfr_table *, struct pfr_addr *, int, int *,\n\t    int);\nint\tpfr_tst_addrs(struct pfr_table *, struct pfr_addr *, int, int *,\n\t    int);\nint\tpfr_ina_begin(struct pfr_table *, u_int32_t *, int *, int);\nint\tpfr_ina_rollback(struct pfr_table *, u_int32_t, int *, int);\nint\tpfr_ina_commit(struct pfr_table *, u_int32_t, int *, int *, int);\nint\tpfr_ina_define(struct pfr_table *, struct pfr_addr *, int, int *,\n\t    int *, u_int32_t, int);\n\n#ifdef __FreeBSD__\nVNET_DECLARE(struct pfi_kif *,\t\t pfi_all);\n#define\tV_pfi_all\t \t\t VNET(pfi_all)\n#else\nextern struct pfi_kif\t\t*pfi_all;\n#endif\n\nvoid\t\t pfi_initialize(void);\n#ifdef __FreeBSD__\nvoid\t\t pfi_cleanup(void);\n#endif\nstruct pfi_kif\t*pfi_kif_get(const char *);\nvoid\t\t pfi_kif_ref(struct pfi_kif *, enum pfi_kif_refs);\nvoid\t\t pfi_kif_unref(struct pfi_kif *, enum pfi_kif_refs);\nint\t\t pfi_kif_match(struct pfi_kif *, struct pfi_kif *);\nvoid\t\t pfi_attach_ifnet(struct ifnet *);\nvoid\t\t pfi_detach_ifnet(struct ifnet *);\nvoid\t\t pfi_attach_ifgroup(struct ifg_group *);\nvoid\t\t pfi_detach_ifgroup(struct ifg_group *);\nvoid\t\t pfi_group_change(const char *);\nint\t\t pfi_match_addr(struct pfi_dynaddr *, struct pf_addr *,\n\t\t    sa_family_t);\nint\t\t pfi_dynaddr_setup(struct pf_addr_wrap *, sa_family_t);\nvoid\t\t pfi_dynaddr_remove(struct pf_addr_wrap *);\nvoid\t\t pfi_dynaddr_copyout(struct pf_addr_wrap *);\nvoid\t\t pfi_update_status(const char *, struct pf_status *);\nint\t\t pfi_get_ifaces(const char *, struct pfi_kif *, int *);\nint\t\t pfi_set_flags(const char *, int);\nint\t\t pfi_clear_flags(const char *, int);\n\n#ifdef __FreeBSD__\nint\t\t pf_match_tag(struct mbuf *, struct pf_rule *, int *,\n\t\t    struct pf_mtag *);\n#else\nint\t\t pf_match_tag(struct mbuf *, struct pf_rule *, int *);\n#endif\nu_int16_t\t pf_tagname2tag(char *);\nvoid\t\t pf_tag2tagname(u_int16_t, char *);\nvoid\t\t pf_tag_ref(u_int16_t);\nvoid\t\t pf_tag_unref(u_int16_t);\n#ifdef __FreeBSD__\nint\t\t pf_tag_packet(struct mbuf *, int, int, struct pf_mtag *);\n#else\nint\t\t pf_tag_packet(struct mbuf *, int, int);\n#endif\nu_int32_t\t pf_qname2qid(char *);\nvoid\t\t pf_qid2qname(u_int32_t, char *);\nvoid\t\t pf_qid_unref(u_int32_t);\n\n#ifdef __FreeBSD__\nVNET_DECLARE(struct pf_status,\t\t pf_status);\n#define\tV_pf_status\t\t\t VNET(pf_status)\n#else\nextern struct pf_status\tpf_status;\n#endif\n\n#ifdef __FreeBSD__\nVNET_DECLARE(uma_zone_t,\t\t pf_frent_pl);\n#define\tV_pf_frent_pl\t\t\t VNET(pf_frent_pl)\nVNET_DECLARE(uma_zone_t,\t\t pf_frag_pl);\n#define\tV_pf_frag_pl\t\t\t VNET(pf_frag_pl)\nVNET_DECLARE(struct sx,\t\t\t pf_consistency_lock);\n#define\tV_pf_consistency_lock\t\t VNET(pf_consistency_lock)\n#else\nextern struct pool\tpf_frent_pl, pf_frag_pl;\nextern struct rwlock\tpf_consistency_lock;\n#endif\n\nstruct pf_pool_limit {\n\tvoid\t\t*pp;\n\tunsigned\t limit;\n};\n#ifdef __FreeBSD__\nVNET_DECLARE(struct pf_pool_limit,\t\t pf_pool_limits[PF_LIMIT_MAX]);\n#define\tV_pf_pool_limits\t\t\t VNET(pf_pool_limits)\n#else\nextern struct pf_pool_limit\tpf_pool_limits[PF_LIMIT_MAX];\n#endif\n\n#ifdef __FreeBSD__\nstruct pf_frent {\n\tLIST_ENTRY(pf_frent) fr_next;\n\tstruct ip *fr_ip;\n\tstruct mbuf *fr_m;\n};\n\nstruct pf_frcache {\n\tLIST_ENTRY(pf_frcache) fr_next;\n\tuint16_t\t\tfr_off;\n\tuint16_t\t\tfr_end;\n};\n\nstruct pf_fragment {\n\tRB_ENTRY(pf_fragment) fr_entry;\n\tTAILQ_ENTRY(pf_fragment) frag_next;\n\tstruct in_addr\tfr_src;\n\tstruct in_addr\tfr_dst;\n\tu_int8_t\tfr_p;\t\t/* protocol of this fragment */\n\tu_int8_t\tfr_flags;\t/* status flags */\n\tu_int16_t\tfr_id;\t\t/* fragment id for reassemble */\n\tu_int16_t\tfr_max;\t\t/* fragment data max */\n\tu_int32_t\tfr_timeout;\n#define\tfr_queue\tfr_u.fru_queue\n#define\tfr_cache\tfr_u.fru_cache\n\tunion {\n\t\tLIST_HEAD(pf_fragq, pf_frent) fru_queue;\t/* buffering */\n\t\tLIST_HEAD(pf_cacheq, pf_frcache) fru_cache;\t/* non-buf */\n\t} fr_u;\n};\n#endif /* (__FreeBSD__) */\n\n#endif /* _KERNEL */\n\n#ifdef __FreeBSD__\n#ifdef _KERNEL\nVNET_DECLARE(struct pf_anchor_global,\t\t pf_anchors);\n#define\tV_pf_anchors\t\t\t\t VNET(pf_anchors)\nVNET_DECLARE(struct pf_anchor,\t\t\t pf_main_anchor);\n#define\tV_pf_main_anchor\t\t\t VNET(pf_main_anchor)\n#define pf_main_ruleset\tV_pf_main_anchor.ruleset\n#endif\n#else\nextern struct pf_anchor_global\tpf_anchors;\nextern struct pf_anchor\t\tpf_main_anchor;\n#define pf_main_ruleset\tpf_main_anchor.ruleset\n#endif\n\n/* these ruleset functions can be linked into userland programs (pfctl) */\nint\t\t\t pf_get_ruleset_number(u_int8_t);\nvoid\t\t\t pf_init_ruleset(struct pf_ruleset *);\nint\t\t\t pf_anchor_setup(struct pf_rule *,\n\t\t\t    const struct pf_ruleset *, const char *);\nint\t\t\t pf_anchor_copyout(const struct pf_ruleset *,\n\t\t\t    const struct pf_rule *, struct pfioc_rule *);\nvoid\t\t\t pf_anchor_remove(struct pf_rule *);\nvoid\t\t\t pf_remove_if_empty_ruleset(struct pf_ruleset *);\nstruct pf_anchor\t*pf_find_anchor(const char *);\nstruct pf_ruleset\t*pf_find_ruleset(const char *);\nstruct pf_ruleset\t*pf_find_or_create_ruleset(const char *);\nvoid\t\t\t pf_rs_initialize(void);\n\n#ifndef __FreeBSD__\n#ifdef _KERNEL\nint\t\t\t pf_anchor_copyout(const struct pf_ruleset *,\n\t\t\t    const struct pf_rule *, struct pfioc_rule *);\nvoid\t\t\t pf_anchor_remove(struct pf_rule *);\n\n#endif /* _KERNEL */\n#endif\n\n/* The fingerprint functions can be linked into userland programs (tcpdump) */\nint\tpf_osfp_add(struct pf_osfp_ioctl *);\n#ifdef _KERNEL\nstruct pf_osfp_enlist *\n\tpf_osfp_fingerprint(struct pf_pdesc *, struct mbuf *, int,\n\t    const struct tcphdr *);\n#endif /* _KERNEL */\nstruct pf_osfp_enlist *\n\tpf_osfp_fingerprint_hdr(const struct ip *, const struct ip6_hdr *,\n\t    const struct tcphdr *);\nvoid\tpf_osfp_flush(void);\nint\tpf_osfp_get(struct pf_osfp_ioctl *);\n#ifdef __FreeBSD__\nint\tpf_osfp_initialize(void);\nvoid\tpf_osfp_cleanup(void);\n#else\nvoid\tpf_osfp_initialize(void);\n#endif\nint\tpf_osfp_match(struct pf_osfp_enlist *, pf_osfp_t);\nstruct pf_os_fingerprint *\n\tpf_osfp_validate(void);\n\n#ifdef _KERNEL\nvoid\t\t\t pf_print_host(struct pf_addr *, u_int16_t, u_int8_t);\n\nvoid\t\t\t pf_step_into_anchor(int *, struct pf_ruleset **, int,\n\t\t\t    struct pf_rule **, struct pf_rule **, int *);\nint\t\t\t pf_step_out_of_anchor(int *, struct pf_ruleset **,\n\t\t\t    int, struct pf_rule **, struct pf_rule **,\n\t\t\t    int *);\n\nint\t\t\t pf_map_addr(u_int8_t, struct pf_rule *,\n\t\t\t    struct pf_addr *, struct pf_addr *,\n\t\t\t    struct pf_addr *, struct pf_src_node **);\nstruct pf_rule\t\t*pf_get_translation(struct pf_pdesc *, struct mbuf *,\n\t\t\t    int, int, struct pfi_kif *, struct pf_src_node **,\n\t\t\t    struct pf_state_key **, struct pf_state_key **,\n\t\t\t    struct pf_state_key **, struct pf_state_key **,\n\t\t\t    struct pf_addr *, struct pf_addr *,\n\t\t\t    u_int16_t, u_int16_t);\n\nint\t\t\t pf_state_key_setup(struct pf_pdesc *, struct pf_rule *,\n\t\t\t    struct pf_state_key **, struct pf_state_key **,\n\t\t\t    struct pf_state_key **, struct pf_state_key **,\n\t\t\t    struct pf_addr *, struct pf_addr *,\n\t\t\t    u_int16_t, u_int16_t);\n#endif /* _KERNEL */\n\n\n#endif /* _NET_PFVAR_H_ */\n"
  },
  {
    "path": "freebsd-headers/net/ppp_defs.h",
    "content": "/*\n * ppp_defs.h - PPP definitions.\n */\n/*-\n * Copyright (c) 1994 The Australian National University.\n * All rights reserved.\n *\n * Permission to use, copy, modify, and distribute this software and its\n * documentation is hereby granted, provided that the above copyright\n * notice appears in all copies.  This software is provided without any\n * warranty, express or implied. The Australian National University\n * makes no representations about the suitability of this software for\n * any purpose.\n *\n * IN NO EVENT SHALL THE AUSTRALIAN NATIONAL UNIVERSITY BE LIABLE TO ANY\n * PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES\n * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF\n * THE AUSTRALIAN NATIONAL UNIVERSITY HAVE BEEN ADVISED OF THE POSSIBILITY\n * OF SUCH DAMAGE.\n *\n * THE AUSTRALIAN NATIONAL UNIVERSITY SPECIFICALLY DISCLAIMS ANY WARRANTIES,\n * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY\n * AND FITNESS FOR A PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HEREUNDER IS\n * ON AN \"AS IS\" BASIS, AND THE AUSTRALIAN NATIONAL UNIVERSITY HAS NO\n * OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS,\n * OR MODIFICATIONS.\n *\n * $FreeBSD: release/9.0.0/sys/net/ppp_defs.h 139823 2005-01-07 01:45:51Z imp $\n */\n\n#ifndef _PPP_DEFS_H_\n#define _PPP_DEFS_H_\n\n/*\n * The basic PPP frame.\n */\n#define PPP_HDRLEN\t4\t/* octets for standard ppp header */\n#define PPP_FCSLEN\t2\t/* octets for FCS */\n#define PPP_MRU\t\t1500\t/* default MRU = max length of info field */\n\n#define PPP_ADDRESS(p)\t(((u_char *)(p))[0])\n#define PPP_CONTROL(p)\t(((u_char *)(p))[1])\n#define PPP_PROTOCOL(p)\t((((u_char *)(p))[2] << 8) + ((u_char *)(p))[3])\n\n/*\n * Significant octet values.\n */\n#define\tPPP_ALLSTATIONS\t0xff\t/* All-Stations broadcast address */\n#define\tPPP_UI\t\t0x03\t/* Unnumbered Information */\n#define\tPPP_FLAG\t0x7e\t/* Flag Sequence */\n#define\tPPP_ESCAPE\t0x7d\t/* Asynchronous Control Escape */\n#define\tPPP_TRANS\t0x20\t/* Asynchronous transparency modifier */\n\n/*\n * Protocol field values.\n */\n#define PPP_IP\t\t0x21\t/* Internet Protocol */\n#define\tPPP_XNS\t\t0x25\t/* Xerox NS */\n#define PPP_AT\t\t0x29\t/* AppleTalk Protocol */\n#define PPP_IPX\t\t0x2b\t/* IPX Datagram (RFC1552) */\n#define\tPPP_VJC_COMP\t0x2d\t/* VJ compressed TCP */\n#define\tPPP_VJC_UNCOMP\t0x2f\t/* VJ uncompressed TCP */\n#define PPP_COMP\t0xfd\t/* compressed packet */\n#define PPP_IPCP\t0x8021\t/* IP Control Protocol */\n#define PPP_ATCP\t0x8029\t/* AppleTalk Control Protocol */\n#define PPP_IPXCP\t0x802b\t/* IPX Control Protocol (RFC1552) */\n#define PPP_CCP\t\t0x80fd\t/* Compression Control Protocol */\n#define PPP_LCP\t\t0xc021\t/* Link Control Protocol */\n#define PPP_PAP\t\t0xc023\t/* Password Authentication Protocol */\n#define PPP_LQR\t\t0xc025\t/* Link Quality Report protocol */\n#define PPP_CHAP\t0xc223\t/* Cryptographic Handshake Auth. Protocol */\n#define PPP_CBCP\t0xc029\t/* Callback Control Protocol */\n#define PPP_IPV6\t0x57\t/* Internet Protocol version 6*/\n#define PPP_IPV6CP\t0x8057\t/* IPv6 Control Protocol */\n\n/*\n * Values for FCS calculations.\n */\n#define PPP_INITFCS\t0xffff\t/* Initial FCS value */\n#define PPP_GOODFCS\t0xf0b8\t/* Good final FCS value */\n#define PPP_FCS(fcs, c)\t(((fcs) >> 8) ^ fcstab[((fcs) ^ (c)) & 0xff])\n\n/*\n * Extended asyncmap - allows any character to be escaped.\n */\ntypedef u_int32_t\text_accm[8];\n\n/*\n * What to do with network protocol (NP) packets.\n */\nenum NPmode {\n    NPMODE_PASS,\t\t/* pass the packet through */\n    NPMODE_DROP,\t\t/* silently drop the packet */\n    NPMODE_ERROR,\t\t/* return an error */\n    NPMODE_QUEUE\t\t/* save it up for later. */\n};\n\n/*\n * Statistics.\n */\nstruct pppstat\t{\n    unsigned int ppp_ibytes;\t/* bytes received */\n    unsigned int ppp_ipackets;\t/* packets received */\n    unsigned int ppp_ierrors;\t/* receive errors */\n    unsigned int ppp_obytes;\t/* bytes sent */\n    unsigned int ppp_opackets;\t/* packets sent */\n    unsigned int ppp_oerrors;\t/* transmit errors */\n};\n\nstruct vjstat {\n    unsigned int vjs_packets;\t/* outbound packets */\n    unsigned int vjs_compressed; /* outbound compressed packets */\n    unsigned int vjs_searches;\t/* searches for connection state */\n    unsigned int vjs_misses;\t/* times couldn't find conn. state */\n    unsigned int vjs_uncompressedin; /* inbound uncompressed packets */\n    unsigned int vjs_compressedin; /* inbound compressed packets */\n    unsigned int vjs_errorin;\t/* inbound unknown type packets */\n    unsigned int vjs_tossed;\t/* inbound packets tossed because of error */\n};\n\nstruct ppp_stats {\n    struct pppstat p;\t\t/* basic PPP statistics */\n    struct vjstat vj;\t\t/* VJ header compression statistics */\n};\n\nstruct compstat {\n    unsigned int unc_bytes;\t/* total uncompressed bytes */\n    unsigned int unc_packets;\t/* total uncompressed packets */\n    unsigned int comp_bytes;\t/* compressed bytes */\n    unsigned int comp_packets;\t/* compressed packets */\n    unsigned int inc_bytes;\t/* incompressible bytes */\n    unsigned int inc_packets;\t/* incompressible packets */\n    unsigned int ratio;\t\t/* recent compression ratio << 8 */\n};\n\nstruct ppp_comp_stats {\n    struct compstat c;\t\t/* packet compression statistics */\n    struct compstat d;\t\t/* packet decompression statistics */\n};\n\n/*\n * The following structure records the time in seconds since\n * the last NP packet was sent or received.\n */\nstruct ppp_idle {\n    time_t xmit_idle;\t\t/* time since last NP packet sent */\n    time_t recv_idle;\t\t/* time since last NP packet received */\n};\n\n#ifndef __P\n#ifdef __STDC__\n#define __P(x)\tx\n#else\n#define __P(x)\t()\n#endif\n#endif\n\n#endif /* _PPP_DEFS_H_ */\n"
  },
  {
    "path": "freebsd-headers/net/radix.h",
    "content": "/*-\n * Copyright (c) 1988, 1989, 1993\n *\tThe Regents of the University of California.  All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 4. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t@(#)radix.h\t8.2 (Berkeley) 10/31/94\n * $FreeBSD: release/9.0.0/sys/net/radix.h 225698 2011-09-20 20:27:26Z kmacy $\n */\n\n#ifndef _RADIX_H_\n#define\t_RADIX_H_\n\n#ifdef _KERNEL\n#include <sys/_lock.h>\n#include <sys/_mutex.h>\n#include <sys/_rwlock.h>\n#endif\n\n#ifdef MALLOC_DECLARE\nMALLOC_DECLARE(M_RTABLE);\n#endif\n\n/*\n * Radix search tree node layout.\n */\n\nstruct radix_node {\n\tstruct\tradix_mask *rn_mklist;\t/* list of masks contained in subtree */\n\tstruct\tradix_node *rn_parent;\t/* parent */\n\tshort\trn_bit;\t\t\t/* bit offset; -1-index(netmask) */\n\tchar\trn_bmask;\t\t/* node: mask for bit test*/\n\tu_char\trn_flags;\t\t/* enumerated next */\n#define RNF_NORMAL\t1\t\t/* leaf contains normal route */\n#define RNF_ROOT\t2\t\t/* leaf is root leaf for tree */\n#define RNF_ACTIVE\t4\t\t/* This node is alive (for rtfree) */\n\tunion {\n\t\tstruct {\t\t\t/* leaf only data: */\n\t\t\tcaddr_t\trn_Key;\t\t/* object of search */\n\t\t\tcaddr_t\trn_Mask;\t/* netmask, if present */\n\t\t\tstruct\tradix_node *rn_Dupedkey;\n\t\t} rn_leaf;\n\t\tstruct {\t\t\t/* node only data: */\n\t\t\tint\trn_Off;\t\t/* where to start compare */\n\t\t\tstruct\tradix_node *rn_L;/* progeny */\n\t\t\tstruct\tradix_node *rn_R;/* progeny */\n\t\t} rn_node;\n\t}\t\trn_u;\n#ifdef RN_DEBUG\n\tint rn_info;\n\tstruct radix_node *rn_twin;\n\tstruct radix_node *rn_ybro;\n#endif\n};\n\n#define\trn_dupedkey\trn_u.rn_leaf.rn_Dupedkey\n#define\trn_key\t\trn_u.rn_leaf.rn_Key\n#define\trn_mask\t\trn_u.rn_leaf.rn_Mask\n#define\trn_offset\trn_u.rn_node.rn_Off\n#define\trn_left\t\trn_u.rn_node.rn_L\n#define\trn_right\trn_u.rn_node.rn_R\n\n/*\n * Annotations to tree concerning potential routes applying to subtrees.\n */\n\nstruct radix_mask {\n\tshort\trm_bit;\t\t\t/* bit offset; -1-index(netmask) */\n\tchar\trm_unused;\t\t/* cf. rn_bmask */\n\tu_char\trm_flags;\t\t/* cf. rn_flags */\n\tstruct\tradix_mask *rm_mklist;\t/* more masks to try */\n\tunion\t{\n\t\tcaddr_t\trmu_mask;\t\t/* the mask */\n\t\tstruct\tradix_node *rmu_leaf;\t/* for normal routes */\n\t}\trm_rmu;\n\tint\trm_refs;\t\t/* # of references to this struct */\n};\n\n#define\trm_mask rm_rmu.rmu_mask\n#define\trm_leaf rm_rmu.rmu_leaf\t\t/* extra field would make 32 bytes */\n\ntypedef int walktree_f_t(struct radix_node *, void *);\n\nstruct radix_node_head {\n\tstruct\tradix_node *rnh_treetop;\n\tu_int\trnh_gen;\t\t/* generation counter */\n\tint\trnh_multipath;\t\t/* multipath capable ? */\n\tint\trnh_addrsize;\t\t/* permit, but not require fixed keys */\n\tint\trnh_pktsize;\t\t/* permit, but not require fixed keys */\n\tstruct\tradix_node *(*rnh_addaddr)\t/* add based on sockaddr */\n\t\t(void *v, void *mask,\n\t\t     struct radix_node_head *head, struct radix_node nodes[]);\n\tstruct\tradix_node *(*rnh_addpkt)\t/* add based on packet hdr */\n\t\t(void *v, void *mask,\n\t\t     struct radix_node_head *head, struct radix_node nodes[]);\n\tstruct\tradix_node *(*rnh_deladdr)\t/* remove based on sockaddr */\n\t\t(void *v, void *mask, struct radix_node_head *head);\n\tstruct\tradix_node *(*rnh_delpkt)\t/* remove based on packet hdr */\n\t\t(void *v, void *mask, struct radix_node_head *head);\n\tstruct\tradix_node *(*rnh_matchaddr)\t/* locate based on sockaddr */\n\t\t(void *v, struct radix_node_head *head);\n\tstruct\tradix_node *(*rnh_lookup)\t/* locate based on sockaddr */\n\t\t(void *v, void *mask, struct radix_node_head *head);\n\tstruct\tradix_node *(*rnh_matchpkt)\t/* locate based on packet hdr */\n\t\t(void *v, struct radix_node_head *head);\n\tint\t(*rnh_walktree)\t\t\t/* traverse tree */\n\t\t(struct radix_node_head *head, walktree_f_t *f, void *w);\n\tint\t(*rnh_walktree_from)\t\t/* traverse tree below a */\n\t\t(struct radix_node_head *head, void *a, void *m,\n\t\t     walktree_f_t *f, void *w);\n\tvoid\t(*rnh_close)\t/* do something when the last ref drops */\n\t\t(struct radix_node *rn, struct radix_node_head *head);\n\tstruct\tradix_node rnh_nodes[3];\t/* empty tree for common case */\n#ifdef _KERNEL\n\tstruct\trwlock rnh_lock;\t\t/* locks entire radix tree */\n#endif\n};\n\n#ifndef _KERNEL\n#define R_Malloc(p, t, n) (p = (t) malloc((unsigned int)(n)))\n#define R_Zalloc(p, t, n) (p = (t) calloc(1,(unsigned int)(n)))\n#define Free(p) free((char *)p);\n#else\n#define R_Malloc(p, t, n) (p = (t) malloc((unsigned long)(n), M_RTABLE, M_NOWAIT))\n#define R_Zalloc(p, t, n) (p = (t) malloc((unsigned long)(n), M_RTABLE, M_NOWAIT | M_ZERO))\n#define Free(p) free((caddr_t)p, M_RTABLE);\n\n#define\tRADIX_NODE_HEAD_LOCK_INIT(rnh)\t\\\n    rw_init_flags(&(rnh)->rnh_lock, \"radix node head\", 0)\n#define\tRADIX_NODE_HEAD_LOCK(rnh)\trw_wlock(&(rnh)->rnh_lock)\n#define\tRADIX_NODE_HEAD_UNLOCK(rnh)\trw_wunlock(&(rnh)->rnh_lock)\n#define\tRADIX_NODE_HEAD_RLOCK(rnh)\trw_rlock(&(rnh)->rnh_lock)\n#define\tRADIX_NODE_HEAD_RUNLOCK(rnh)\trw_runlock(&(rnh)->rnh_lock)\n#define\tRADIX_NODE_HEAD_LOCK_TRY_UPGRADE(rnh)\trw_try_upgrade(&(rnh)->rnh_lock)\n\n\n#define\tRADIX_NODE_HEAD_DESTROY(rnh)\trw_destroy(&(rnh)->rnh_lock)\n#define\tRADIX_NODE_HEAD_LOCK_ASSERT(rnh) rw_assert(&(rnh)->rnh_lock, RA_LOCKED)\n#define\tRADIX_NODE_HEAD_WLOCK_ASSERT(rnh) rw_assert(&(rnh)->rnh_lock, RA_WLOCKED)\n#endif /* _KERNEL */\n\nvoid\t rn_init(int);\nint\t rn_inithead(void **, int);\nint\t rn_detachhead(void **);\nint\t rn_refines(void *, void *);\nstruct radix_node\n\t *rn_addmask(void *, int, int),\n\t *rn_addroute (void *, void *, struct radix_node_head *,\n\t\t\tstruct radix_node [2]),\n\t *rn_delete(void *, void *, struct radix_node_head *),\n\t *rn_lookup (void *v_arg, void *m_arg,\n\t\t        struct radix_node_head *head),\n\t *rn_match(void *, struct radix_node_head *);\n\n#endif /* _RADIX_H_ */\n"
  },
  {
    "path": "freebsd-headers/net/radix_mpath.h",
    "content": "/*\t$KAME: radix_mpath.h,v 1.10 2004/11/06 15:44:28 itojun Exp $\t*/\n\n/*\n * Copyright (C) 2001 WIDE Project.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. Neither the name of the project nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n * THE AUTHORS DO NOT GUARANTEE THAT THIS SOFTWARE DOES NOT INFRINGE\n * ANY OTHERS' INTELLECTUAL PROPERTIES. IN NO EVENT SHALL THE AUTHORS\n * BE LIABLE FOR ANY INFRINGEMENT OF ANY OTHERS' INTELLECTUAL\n * PROPERTIES.\n */\n/* $FreeBSD: release/9.0.0/sys/net/radix_mpath.h 179426 2008-05-30 09:34:35Z qingli $ */\n\n#ifndef _NET_RADIX_MPATH_H_\n#define\t_NET_RADIX_MPATH_H_\n\n#ifdef _KERNEL\n/*\n * Radix tree API with multipath support\n */\nstruct route;\nstruct rtentry;\nstruct sockaddr;\nint\trn_mpath_capable(struct radix_node_head *);\nstruct radix_node *rn_mpath_next(struct radix_node *);\nu_int32_t rn_mpath_count(struct radix_node *);\nstruct rtentry *rt_mpath_matchgate(struct rtentry *, struct sockaddr *);\nint rt_mpath_conflict(struct radix_node_head *, struct rtentry *,\n    struct sockaddr *);\nvoid rtalloc_mpath_fib(struct route *, u_int32_t, u_int);\n#define rtalloc_mpath(_route, _hash) rtalloc_mpath_fib((_route), (_hash), 0)\nstruct radix_node *rn_mpath_lookup(void *, void *,\n    struct radix_node_head *);\nint rt_mpath_deldup(struct rtentry *, struct rtentry *);\nint\trn4_mpath_inithead(void **, int);\nint\trn6_mpath_inithead(void **, int);\n\n#endif\n\n#endif /* _NET_RADIX_MPATH_H_ */\n"
  },
  {
    "path": "freebsd-headers/net/raw_cb.h",
    "content": "/*-\n * Copyright (c) 1980, 1986, 1993\n *\tThe Regents of the University of California.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 4. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t@(#)raw_cb.h\t8.1 (Berkeley) 6/10/93\n * $FreeBSD: release/9.0.0/sys/net/raw_cb.h 225970 2011-10-04 11:35:18Z bz $\n */\n\n#ifndef _NET_RAW_CB_H_\n#define _NET_RAW_CB_H_\n\n#include <sys/queue.h>\n\n/*\n * Raw protocol interface control block.  Used to tie a socket to the generic\n * raw interface.\n */\nstruct rawcb {\n\tLIST_ENTRY(rawcb) list;\n\tstruct\tsocket *rcb_socket;\t/* back pointer to socket */\n\tstruct\tsockproto rcb_proto;\t/* protocol family, protocol */\n};\n\n#define\tsotorawcb(so)\t\t((struct rawcb *)(so)->so_pcb)\n\n/*\n * Nominal space allocated to a raw socket.\n */\n#define\tRAWSNDQ\t\t8192\n#define\tRAWRCVQ\t\t8192\n\n#ifdef _KERNEL\nVNET_DECLARE(LIST_HEAD(rawcb_list_head, rawcb), rawcb_list);\n#define\tV_rawcb_list\tVNET(rawcb_list)\n\nextern struct mtx rawcb_mtx;\n\n/*\n * Generic protosw entries for raw socket protocols.\n */\npr_ctlinput_t\traw_ctlinput;\npr_init_t\traw_init;\n\n/*\n * Library routines for raw socket usrreq functions; will always be wrapped\n * so that protocol-specific functions can be handled.\n */\ntypedef int (*raw_input_cb_fn)(struct mbuf *, struct sockproto *,\n    struct sockaddr *, struct rawcb *);\n\nint\t raw_attach(struct socket *, int);\nvoid\t raw_detach(struct rawcb *);\nvoid\t raw_input(struct mbuf *, struct sockproto *, struct sockaddr *);\nvoid\t raw_input_ext(struct mbuf *, struct sockproto *, struct sockaddr *,\n\t    raw_input_cb_fn);\n\n/*\n * Generic pr_usrreqs entries for raw socket protocols, usually wrapped so\n * that protocol-specific functions can be handled.\n */\nextern\tstruct pr_usrreqs raw_usrreqs;\n#endif\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/net/route.h",
    "content": "/*-\n * Copyright (c) 1980, 1986, 1993\n *\tThe Regents of the University of California.  All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 4. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t@(#)route.h\t8.4 (Berkeley) 1/9/95\n * $FreeBSD: release/9.0.0/sys/net/route.h 225970 2011-10-04 11:35:18Z bz $\n */\n\n#ifndef _NET_ROUTE_H_\n#define _NET_ROUTE_H_\n\n/*\n * Kernel resident routing tables.\n *\n * The routing tables are initialized when interface addresses\n * are set by making entries for all directly connected interfaces.\n */\n\n/*\n * A route consists of a destination address, a reference\n * to a routing entry, and a reference to an llentry.  \n * These are often held by protocols in their control\n * blocks, e.g. inpcb.\n */\nstruct route {\n\tstruct\trtentry *ro_rt;\n\tstruct\tllentry *ro_lle;\n\tstruct\tin_ifaddr *ro_ia;\n\tint\t\tro_flags;\n\tstruct\tsockaddr ro_dst;\n};\n\n#define RT_CACHING_CONTEXT\t0x1\n\n/*\n * These numbers are used by reliable protocols for determining\n * retransmission behavior and are included in the routing structure.\n */\nstruct rt_metrics_lite {\n\tu_long\trmx_mtu;\t/* MTU for this path */\n\tu_long\trmx_expire;\t/* lifetime for route, e.g. redirect */\n\tu_long\trmx_pksent;\t/* packets sent using this route */\n\tu_long\trmx_weight;\t/* absolute weight */ \n};\n\nstruct rt_metrics {\n\tu_long\trmx_locks;\t/* Kernel must leave these values alone */\n\tu_long\trmx_mtu;\t/* MTU for this path */\n\tu_long\trmx_hopcount;\t/* max hops expected */\n\tu_long\trmx_expire;\t/* lifetime for route, e.g. redirect */\n\tu_long\trmx_recvpipe;\t/* inbound delay-bandwidth product */\n\tu_long\trmx_sendpipe;\t/* outbound delay-bandwidth product */\n\tu_long\trmx_ssthresh;\t/* outbound gateway buffer limit */\n\tu_long\trmx_rtt;\t/* estimated round trip time */\n\tu_long\trmx_rttvar;\t/* estimated rtt variance */\n\tu_long\trmx_pksent;\t/* packets sent using this route */\n\tu_long\trmx_weight;\t/* route weight */\n\tu_long\trmx_filler[3];\t/* will be used for T/TCP later */\n};\n\n/*\n * rmx_rtt and rmx_rttvar are stored as microseconds;\n * RTTTOPRHZ(rtt) converts to a value suitable for use\n * by a protocol slowtimo counter.\n */\n#define\tRTM_RTTUNIT\t1000000\t/* units for rtt, rttvar, as units per sec */\n#define\tRTTTOPRHZ(r)\t((r) / (RTM_RTTUNIT / PR_SLOWHZ))\n\n/* MRT compile-time constants */\n#ifdef _KERNEL\n #ifndef ROUTETABLES\n  #define RT_NUMFIBS 1\n  #define RT_MAXFIBS 1\n #else\n  /* while we use 4 bits in the mbuf flags, we are limited to 16 */\n  #define RT_MAXFIBS 16\n  #if ROUTETABLES > RT_MAXFIBS\n   #define RT_NUMFIBS RT_MAXFIBS\n   #error \"ROUTETABLES defined too big\"\n  #else\n   #if ROUTETABLES == 0\n    #define RT_NUMFIBS 1\n   #else\n    #define RT_NUMFIBS ROUTETABLES\n   #endif\n  #endif\n #endif\n#endif\n\nextern u_int rt_numfibs;\t/* number fo usable routing tables */\n/*\n * XXX kernel function pointer `rt_output' is visible to applications.\n */\nstruct mbuf;\n\n/*\n * We distinguish between routes to hosts and routes to networks,\n * preferring the former if available.  For each route we infer\n * the interface to use from the gateway address supplied when\n * the route was entered.  Routes that forward packets through\n * gateways are marked so that the output routines know to address the\n * gateway rather than the ultimate destination.\n */\n#ifndef RNF_NORMAL\n#include <net/radix.h>\n#ifdef RADIX_MPATH\n#include <net/radix_mpath.h>\n#endif\n#endif\nstruct rtentry {\n\tstruct\tradix_node rt_nodes[2];\t/* tree glue, and other values */\n\t/*\n\t * XXX struct rtentry must begin with a struct radix_node (or two!)\n\t * because the code does some casts of a 'struct radix_node *'\n\t * to a 'struct rtentry *'\n\t */\n#define\trt_key(r)\t(*((struct sockaddr **)(&(r)->rt_nodes->rn_key)))\n#define\trt_mask(r)\t(*((struct sockaddr **)(&(r)->rt_nodes->rn_mask)))\n\tstruct\tsockaddr *rt_gateway;\t/* value */\n\tint\trt_flags;\t\t/* up/down?, host/net */\n\tint\trt_refcnt;\t\t/* # held references */\n\tstruct\tifnet *rt_ifp;\t\t/* the answer: interface to use */\n\tstruct\tifaddr *rt_ifa;\t\t/* the answer: interface address to use */\n\tstruct\trt_metrics_lite rt_rmx;\t/* metrics used by rx'ing protocols */\n\tu_int\trt_fibnum;\t\t/* which FIB */\n#ifdef _KERNEL\n\t/* XXX ugly, user apps use this definition but don't have a mtx def */\n\tstruct\tmtx rt_mtx;\t\t/* mutex for routing entry */\n#endif\n};\n\n/*\n * Following structure necessary for 4.3 compatibility;\n * We should eventually move it to a compat file.\n */\nstruct ortentry {\n\tu_long\trt_hash;\t\t/* to speed lookups */\n\tstruct\tsockaddr rt_dst;\t/* key */\n\tstruct\tsockaddr rt_gateway;\t/* value */\n\tshort\trt_flags;\t\t/* up/down?, host/net */\n\tshort\trt_refcnt;\t\t/* # held references */\n\tu_long\trt_use;\t\t\t/* raw # packets forwarded */\n\tstruct\tifnet *rt_ifp;\t\t/* the answer: interface to use */\n};\n\n#define rt_use rt_rmx.rmx_pksent\n\n#define\tRTF_UP\t\t0x1\t\t/* route usable */\n#define\tRTF_GATEWAY\t0x2\t\t/* destination is a gateway */\n#define\tRTF_HOST\t0x4\t\t/* host entry (net otherwise) */\n#define\tRTF_REJECT\t0x8\t\t/* host or net unreachable */\n#define\tRTF_DYNAMIC\t0x10\t\t/* created dynamically (by redirect) */\n#define\tRTF_MODIFIED\t0x20\t\t/* modified dynamically (by redirect) */\n#define RTF_DONE\t0x40\t\t/* message confirmed */\n/*\t\t\t0x80\t\t   unused, was RTF_DELCLONE */\n/*\t\t\t0x100\t\t   unused, was RTF_CLONING */\n#define RTF_XRESOLVE\t0x200\t\t/* external daemon resolves name */\n#define RTF_LLINFO\t0x400\t\t/* DEPRECATED - exists ONLY for backward \n\t\t\t\t\t   compatibility */\n#define RTF_LLDATA\t0x400\t\t/* used by apps to add/del L2 entries */\n#define RTF_STATIC\t0x800\t\t/* manually added */\n#define RTF_BLACKHOLE\t0x1000\t\t/* just discard pkts (during updates) */\n#define RTF_PROTO2\t0x4000\t\t/* protocol specific routing flag */\n#define RTF_PROTO1\t0x8000\t\t/* protocol specific routing flag */\n\n/* XXX: temporary to stay API/ABI compatible with userland */\n#ifndef _KERNEL\n#define RTF_PRCLONING\t0x10000\t\t/* unused, for compatibility */\n#endif\n\n/*\t\t\t0x20000\t\t   unused, was RTF_WASCLONED */\n#define RTF_PROTO3\t0x40000\t\t/* protocol specific routing flag */\n/*\t\t\t0x80000\t\t   unused */\n#define RTF_PINNED\t0x100000\t/* future use */\n#define\tRTF_LOCAL\t0x200000 \t/* route represents a local address */\n#define\tRTF_BROADCAST\t0x400000\t/* route represents a bcast address */\n#define\tRTF_MULTICAST\t0x800000\t/* route represents a mcast address */\n\t\t\t\t\t/* 0x8000000 and up unassigned */\n#define\tRTF_STICKY\t 0x10000000\t/* always route dst->src */\n\n#define\tRTF_RNH_LOCKED\t 0x40000000\t/* radix node head is locked */\n\n/* Mask of RTF flags that are allowed to be modified by RTM_CHANGE. */\n#define RTF_FMASK\t\\\n\t(RTF_PROTO1 | RTF_PROTO2 | RTF_PROTO3 | RTF_BLACKHOLE | \\\n\t RTF_REJECT | RTF_STATIC | RTF_STICKY)\n\n/*\n * Routing statistics.\n */\nstruct\trtstat {\n\tshort\trts_badredirect;\t/* bogus redirect calls */\n\tshort\trts_dynamic;\t\t/* routes created by redirects */\n\tshort\trts_newgateway;\t\t/* routes modified by redirects */\n\tshort\trts_unreach;\t\t/* lookups which failed */\n\tshort\trts_wildcard;\t\t/* lookups satisfied by a wildcard */\n};\n/*\n * Structures for routing messages.\n */\nstruct rt_msghdr {\n\tu_short\trtm_msglen;\t/* to skip over non-understood messages */\n\tu_char\trtm_version;\t/* future binary compatibility */\n\tu_char\trtm_type;\t/* message type */\n\tu_short\trtm_index;\t/* index for associated ifp */\n\tint\trtm_flags;\t/* flags, incl. kern & message, e.g. DONE */\n\tint\trtm_addrs;\t/* bitmask identifying sockaddrs in msg */\n\tpid_t\trtm_pid;\t/* identify sender */\n\tint\trtm_seq;\t/* for sender to identify action */\n\tint\trtm_errno;\t/* why failed */\n\tint\trtm_fmask;\t/* bitmask used in RTM_CHANGE message */\n\tu_long\trtm_inits;\t/* which metrics we are initializing */\n\tstruct\trt_metrics rtm_rmx; /* metrics themselves */\n};\n\n#define RTM_VERSION\t5\t/* Up the ante and ignore older versions */\n\n/*\n * Message types.\n */\n#define RTM_ADD\t\t0x1\t/* Add Route */\n#define RTM_DELETE\t0x2\t/* Delete Route */\n#define RTM_CHANGE\t0x3\t/* Change Metrics or flags */\n#define RTM_GET\t\t0x4\t/* Report Metrics */\n#define RTM_LOSING\t0x5\t/* Kernel Suspects Partitioning */\n#define RTM_REDIRECT\t0x6\t/* Told to use different route */\n#define RTM_MISS\t0x7\t/* Lookup failed on this address */\n#define RTM_LOCK\t0x8\t/* fix specified metrics */\n#define RTM_OLDADD\t0x9\t/* caused by SIOCADDRT */\n#define RTM_OLDDEL\t0xa\t/* caused by SIOCDELRT */\n#define RTM_RESOLVE\t0xb\t/* req to resolve dst to LL addr */\n#define RTM_NEWADDR\t0xc\t/* address being added to iface */\n#define RTM_DELADDR\t0xd\t/* address being removed from iface */\n#define RTM_IFINFO\t0xe\t/* iface going up/down etc. */\n#define\tRTM_NEWMADDR\t0xf\t/* mcast group membership being added to if */\n#define\tRTM_DELMADDR\t0x10\t/* mcast group membership being deleted */\n#define\tRTM_IFANNOUNCE\t0x11\t/* iface arrival/departure */\n#define\tRTM_IEEE80211\t0x12\t/* IEEE80211 wireless event */\n\n/*\n * Bitmask values for rtm_inits and rmx_locks.\n */\n#define RTV_MTU\t\t0x1\t/* init or lock _mtu */\n#define RTV_HOPCOUNT\t0x2\t/* init or lock _hopcount */\n#define RTV_EXPIRE\t0x4\t/* init or lock _expire */\n#define RTV_RPIPE\t0x8\t/* init or lock _recvpipe */\n#define RTV_SPIPE\t0x10\t/* init or lock _sendpipe */\n#define RTV_SSTHRESH\t0x20\t/* init or lock _ssthresh */\n#define RTV_RTT\t\t0x40\t/* init or lock _rtt */\n#define RTV_RTTVAR\t0x80\t/* init or lock _rttvar */\n#define RTV_WEIGHT\t0x100\t/* init or lock _weight */\n\n/*\n * Bitmask values for rtm_addrs.\n */\n#define RTA_DST\t\t0x1\t/* destination sockaddr present */\n#define RTA_GATEWAY\t0x2\t/* gateway sockaddr present */\n#define RTA_NETMASK\t0x4\t/* netmask sockaddr present */\n#define RTA_GENMASK\t0x8\t/* cloning mask sockaddr present */\n#define RTA_IFP\t\t0x10\t/* interface name sockaddr present */\n#define RTA_IFA\t\t0x20\t/* interface addr sockaddr present */\n#define RTA_AUTHOR\t0x40\t/* sockaddr for author of redirect */\n#define RTA_BRD\t\t0x80\t/* for NEWADDR, broadcast or p-p dest addr */\n\n/*\n * Index offsets for sockaddr array for alternate internal encoding.\n */\n#define RTAX_DST\t0\t/* destination sockaddr present */\n#define RTAX_GATEWAY\t1\t/* gateway sockaddr present */\n#define RTAX_NETMASK\t2\t/* netmask sockaddr present */\n#define RTAX_GENMASK\t3\t/* cloning mask sockaddr present */\n#define RTAX_IFP\t4\t/* interface name sockaddr present */\n#define RTAX_IFA\t5\t/* interface addr sockaddr present */\n#define RTAX_AUTHOR\t6\t/* sockaddr for author of redirect */\n#define RTAX_BRD\t7\t/* for NEWADDR, broadcast or p-p dest addr */\n#define RTAX_MAX\t8\t/* size of array to allocate */\n\nstruct rt_addrinfo {\n\tint\trti_addrs;\n\tstruct\tsockaddr *rti_info[RTAX_MAX];\n\tint\trti_flags;\n\tstruct\tifaddr *rti_ifa;\n\tstruct\tifnet *rti_ifp;\n};\n\n/*\n * This macro returns the size of a struct sockaddr when passed\n * through a routing socket. Basically we round up sa_len to\n * a multiple of sizeof(long), with a minimum of sizeof(long).\n * The check for a NULL pointer is just a convenience, probably never used.\n * The case sa_len == 0 should only apply to empty structures.\n */\n#define SA_SIZE(sa)\t\t\t\t\t\t\\\n    (  (!(sa) || ((struct sockaddr *)(sa))->sa_len == 0) ?\t\\\n\tsizeof(long)\t\t:\t\t\t\t\\\n\t1 + ( (((struct sockaddr *)(sa))->sa_len - 1) | (sizeof(long) - 1) ) )\n\n#ifdef _KERNEL\n\n#define RT_LINK_IS_UP(ifp)\t(!((ifp)->if_capabilities & IFCAP_LINKSTATE) \\\n\t\t\t\t || (ifp)->if_link_state == LINK_STATE_UP)\n\n#define\tRT_LOCK_INIT(_rt) \\\n\tmtx_init(&(_rt)->rt_mtx, \"rtentry\", NULL, MTX_DEF | MTX_DUPOK)\n#define\tRT_LOCK(_rt)\t\tmtx_lock(&(_rt)->rt_mtx)\n#define\tRT_UNLOCK(_rt)\t\tmtx_unlock(&(_rt)->rt_mtx)\n#define\tRT_LOCK_DESTROY(_rt)\tmtx_destroy(&(_rt)->rt_mtx)\n#define\tRT_LOCK_ASSERT(_rt)\tmtx_assert(&(_rt)->rt_mtx, MA_OWNED)\n\n#define\tRT_ADDREF(_rt)\tdo {\t\t\t\t\t\\\n\tRT_LOCK_ASSERT(_rt);\t\t\t\t\t\\\n\tKASSERT((_rt)->rt_refcnt >= 0,\t\t\t\t\\\n\t\t(\"negative refcnt %d\", (_rt)->rt_refcnt));\t\\\n\t(_rt)->rt_refcnt++;\t\t\t\t\t\\\n} while (0)\n\n#define\tRT_REMREF(_rt)\tdo {\t\t\t\t\t\\\n\tRT_LOCK_ASSERT(_rt);\t\t\t\t\t\\\n\tKASSERT((_rt)->rt_refcnt > 0,\t\t\t\t\\\n\t\t(\"bogus refcnt %d\", (_rt)->rt_refcnt));\t\\\n\t(_rt)->rt_refcnt--;\t\t\t\t\t\\\n} while (0)\n\n#define\tRTFREE_LOCKED(_rt) do {\t\t\t\t\t\\\n\tif ((_rt)->rt_refcnt <= 1)\t\t\t\t\\\n\t\trtfree(_rt);\t\t\t\t\t\\\n\telse {\t\t\t\t\t\t\t\\\n\t\tRT_REMREF(_rt);\t\t\t\t\t\\\n\t\tRT_UNLOCK(_rt);\t\t\t\t\t\\\n\t}\t\t\t\t\t\t\t\\\n\t/* guard against invalid refs */\t\t\t\\\n\t_rt = 0;\t\t\t\t\t\t\\\n} while (0)\n\n#define\tRTFREE(_rt) do {\t\t\t\t\t\\\n\tRT_LOCK(_rt);\t\t\t\t\t\t\\\n\tRTFREE_LOCKED(_rt);\t\t\t\t\t\\\n} while (0)\n\nstruct radix_node_head *rt_tables_get_rnh(int, int);\n\nstruct ifmultiaddr;\n\nvoid\t rt_ieee80211msg(struct ifnet *, int, void *, size_t);\nvoid\t rt_ifannouncemsg(struct ifnet *, int);\nvoid\t rt_ifmsg(struct ifnet *);\nvoid\t rt_missmsg(int, struct rt_addrinfo *, int, int);\nvoid\t rt_missmsg_fib(int, struct rt_addrinfo *, int, int, int);\nvoid\t rt_newaddrmsg(int, struct ifaddr *, int, struct rtentry *);\nvoid\t rt_newaddrmsg_fib(int, struct ifaddr *, int, struct rtentry *, int);\nvoid\t rt_newmaddrmsg(int, struct ifmultiaddr *);\nint\t rt_setgate(struct rtentry *, struct sockaddr *, struct sockaddr *);\nvoid \t rt_maskedcopy(struct sockaddr *, struct sockaddr *, struct sockaddr *);\n\n/*\n * Note the following locking behavior:\n *\n *    rtalloc_ign() and rtalloc() return ro->ro_rt unlocked\n *\n *    rtalloc1() returns a locked rtentry\n *\n *    rtfree() and RTFREE_LOCKED() require a locked rtentry\n *\n *    RTFREE() uses an unlocked entry.\n */\n\nint\t rtexpunge(struct rtentry *);\nvoid\t rtfree(struct rtentry *);\nint\t rt_check(struct rtentry **, struct rtentry **, struct sockaddr *);\n\n/* XXX MRT COMPAT VERSIONS THAT SET UNIVERSE to 0 */\n/* Thes are used by old code not yet converted to use multiple FIBS */\nint\t rt_getifa(struct rt_addrinfo *);\nvoid\t rtalloc_ign(struct route *ro, u_long ignflags);\nvoid\t rtalloc(struct route *ro); /* XXX deprecated, use rtalloc_ign(ro, 0) */\nstruct rtentry *rtalloc1(struct sockaddr *, int, u_long);\nint\t rtinit(struct ifaddr *, int, int);\nint\t rtioctl(u_long, caddr_t);\nvoid\t rtredirect(struct sockaddr *, struct sockaddr *,\n\t    struct sockaddr *, int, struct sockaddr *);\nint\t rtrequest(int, struct sockaddr *,\n\t    struct sockaddr *, struct sockaddr *, int, struct rtentry **);\n\n/* defaults to \"all\" FIBs */\nint\t rtinit_fib(struct ifaddr *, int, int);\n\n/* XXX MRT NEW VERSIONS THAT USE FIBs\n * For now the protocol indepedent versions are the same as the AF_INET ones\n * but this will change.. \n */\nint\t rt_getifa_fib(struct rt_addrinfo *, u_int fibnum);\nvoid\t rtalloc_ign_fib(struct route *ro, u_long ignflags, u_int fibnum);\nvoid\t rtalloc_fib(struct route *ro, u_int fibnum);\nstruct rtentry *rtalloc1_fib(struct sockaddr *, int, u_long, u_int);\nint\t rtioctl_fib(u_long, caddr_t, u_int);\nvoid\t rtredirect_fib(struct sockaddr *, struct sockaddr *,\n\t    struct sockaddr *, int, struct sockaddr *, u_int);\nint\t rtrequest_fib(int, struct sockaddr *,\n\t    struct sockaddr *, struct sockaddr *, int, struct rtentry **, u_int);\nint\t rtrequest1_fib(int, struct rt_addrinfo *, struct rtentry **, u_int);\n\n#include <sys/eventhandler.h>\ntypedef void (*rtevent_arp_update_fn)(void *, struct rtentry *, uint8_t *, struct sockaddr *);\ntypedef void (*rtevent_redirect_fn)(void *, struct rtentry *, struct rtentry *, struct sockaddr *);\n/* route_arp_update_event is no longer generated; see arp_update_event */\nEVENTHANDLER_DECLARE(route_arp_update_event, rtevent_arp_update_fn);\nEVENTHANDLER_DECLARE(route_redirect_event, rtevent_redirect_fn);\n#endif\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/net/slcompress.h",
    "content": "/*\n * Definitions for tcp compression routines.\n */\n/*-\n * Copyright (c) 1989, 1993\n *\tThe Regents of the University of California.  All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 4. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\tVan Jacobson (van@helios.ee.lbl.gov), Dec 31, 1989:\n *\t- Initial distribution.\n * $FreeBSD: release/9.0.0/sys/net/slcompress.h 139823 2005-01-07 01:45:51Z imp $\n */\n\n#ifndef _NET_SLCOMPRESS_H_\n#define _NET_SLCOMPRESS_H_\n\n#define MAX_STATES 16\t\t/* must be > 2 and < 256 */\n#define MAX_HDR 128\n\n/*\n * Compressed packet format:\n *\n * The first octet contains the packet type (top 3 bits), TCP\n * 'push' bit, and flags that indicate which of the 4 TCP sequence\n * numbers have changed (bottom 5 bits).  The next octet is a\n * conversation number that associates a saved IP/TCP header with\n * the compressed packet.  The next two octets are the TCP checksum\n * from the original datagram.  The next 0 to 15 octets are\n * sequence number changes, one change per bit set in the header\n * (there may be no changes and there are two special cases where\n * the receiver implicitly knows what changed -- see below).\n *\n * There are 5 numbers which can change (they are always inserted\n * in the following order): TCP urgent pointer, window,\n * acknowledgement, sequence number and IP ID.  (The urgent pointer\n * is different from the others in that its value is sent, not the\n * change in value.)  Since typical use of SLIP links is biased\n * toward small packets (see comments on MTU/MSS below), changes\n * use a variable length coding with one octet for numbers in the\n * range 1 - 255 and 3 octets (0, MSB, LSB) for numbers in the\n * range 256 - 65535 or 0.  (If the change in sequence number or\n * ack is more than 65535, an uncompressed packet is sent.)\n */\n\n/*\n * Packet types (must not conflict with IP protocol version)\n *\n * The top nibble of the first octet is the packet type.  There are\n * three possible types: IP (not proto TCP or tcp with one of the\n * control flags set); uncompressed TCP (a normal IP/TCP packet but\n * with the 8-bit protocol field replaced by an 8-bit connection id --\n * this type of packet syncs the sender & receiver); and compressed\n * TCP (described above).\n *\n * LSB of 4-bit field is TCP \"PUSH\" bit (a worthless anachronism) and\n * is logically part of the 4-bit \"changes\" field that follows.  Top\n * three bits are actual packet type.  For backward compatibility\n * and in the interest of conserving bits, numbers are chosen so the\n * IP protocol version number (4) which normally appears in this nibble\n * means \"IP packet\".\n */\n\n/* packet types */\n#define TYPE_IP 0x40\n#define TYPE_UNCOMPRESSED_TCP 0x70\n#define TYPE_COMPRESSED_TCP 0x80\n#define TYPE_ERROR 0x00\n\n/* Bits in first octet of compressed packet */\n#define NEW_C\t0x40\t/* flag bits for what changed in a packet */\n#define NEW_I\t0x20\n#define NEW_S\t0x08\n#define NEW_A\t0x04\n#define NEW_W\t0x02\n#define NEW_U\t0x01\n\n/* reserved, special-case values of above */\n#define SPECIAL_I (NEW_S|NEW_W|NEW_U)\t\t/* echoed interactive traffic */\n#define SPECIAL_D (NEW_S|NEW_A|NEW_W|NEW_U)\t/* unidirectional data */\n#define SPECIALS_MASK (NEW_S|NEW_A|NEW_W|NEW_U)\n\n#define TCP_PUSH_BIT 0x10\n\n\n/*\n * \"state\" data for each active tcp conversation on the wire.  This is\n * basically a copy of the entire IP/TCP header from the last packet\n * we saw from the conversation together with a small identifier\n * the transmit & receive ends of the line use to locate saved header.\n */\nstruct cstate {\n\tstruct cstate *cs_next;\t/* next most recently used cstate (xmit only) */\n\tu_int16_t cs_hlen;\t/* size of hdr (receive only) */\n\tu_char cs_id;\t\t/* connection # associated with this state */\n\tu_char cs_filler;\n\tunion {\n\t\tchar csu_hdr[MAX_HDR];\n\t\tstruct ip csu_ip;\t/* ip/tcp hdr from most recent packet */\n\t} slcs_u;\n};\n#define cs_ip slcs_u.csu_ip\n#define cs_hdr slcs_u.csu_hdr\n\n/*\n * all the state data for one serial line (we need one of these\n * per line).\n */\nstruct slcompress {\n\tstruct cstate *last_cs;\t/* most recently used tstate */\n\tu_char last_recv;\t/* last rcvd conn. id */\n\tu_char last_xmit;\t/* last sent conn. id */\n\tu_int16_t flags;\n#ifndef SL_NO_STATS\n\tint sls_packets;\t/* outbound packets */\n\tint sls_compressed;\t/* outbound compressed packets */\n\tint sls_searches;\t/* searches for connection state */\n\tint sls_misses;\t\t/* times couldn't find conn. state */\n\tint sls_uncompressedin;\t/* inbound uncompressed packets */\n\tint sls_compressedin;\t/* inbound compressed packets */\n\tint sls_errorin;\t/* inbound unknown type packets */\n\tint sls_tossed;\t\t/* inbound packets tossed because of error */\n#endif\n\tstruct cstate tstate[MAX_STATES];\t/* xmit connection states */\n\tstruct cstate rstate[MAX_STATES];\t/* receive connection states */\n};\n/* flag values */\n#define SLF_TOSS 1\t\t/* tossing rcvd frames because of input err */\n\nvoid\t sl_compress_init(struct slcompress *, int);\nu_int\t sl_compress_tcp(struct mbuf *, struct ip *, struct slcompress *, int);\nint\t sl_uncompress_tcp(u_char **, int, u_int, struct slcompress *);\nint\t sl_uncompress_tcp_core(u_char *, int, int, u_int,\n\t    struct slcompress *, u_char **, u_int *);\n\n#endif /* !_NET_SLCOMPRESS_H_ */\n"
  },
  {
    "path": "freebsd-headers/net/vnet.h",
    "content": "/*-\n * Copyright (c) 2006-2009 University of Zagreb\n * Copyright (c) 2006-2009 FreeBSD Foundation\n * All rights reserved.\n *\n * This software was developed by the University of Zagreb and the\n * FreeBSD Foundation under sponsorship by the Stichting NLnet and the\n * FreeBSD Foundation.\n *\n * Copyright (c) 2009 Jeffrey Roberson <jeff@freebsd.org>\n * Copyright (c) 2009 Robert N. M. Watson\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/net/vnet.h 218567 2011-02-11 14:17:58Z bz $\n */\n\n/*-\n * This header file defines several sets of interfaces supporting virtualized\n * network stacks:\n *\n * - Definition of 'struct vnet' and functions and macros to allocate/free/\n *   manipulate it.\n *\n * - A virtual network stack memory allocator, which provides support for\n *   virtualized global variables via a special linker set, set_vnet.\n *\n * - Virtualized sysinits/sysuninits, which allow constructors and\n *   destructors to be run for each network stack subsystem as virtual\n *   instances are created and destroyed.\n *\n * If VIMAGE isn't compiled into the kernel, virtualized global variables\n * compile to normal global variables, and virtualized sysinits to regular\n * sysinits.\n */\n\n#ifndef _NET_VNET_H_\n#define\t_NET_VNET_H_\n\n/*\n * struct vnet describes a virtualized network stack, and is primarily a\n * pointer to storage for virtualized global variables.  Expose to userspace\n * as required for libkvm.\n */\n#if defined(_KERNEL) || defined(_WANT_VNET)\n#include <sys/queue.h>\n\nstruct vnet {\n\tLIST_ENTRY(vnet)\t vnet_le;\t/* all vnets list */\n\tu_int\t\t\t vnet_magic_n;\n\tu_int\t\t\t vnet_ifcnt;\n\tu_int\t\t\t vnet_sockcnt;\n\tvoid\t\t\t*vnet_data_mem;\n\tuintptr_t\t\t vnet_data_base;\n};\n#define\tVNET_MAGIC_N\t0x3e0d8f29\n\n/*\n * These two virtual network stack allocator definitions are also required\n * for libkvm so that it can evaluate virtualized global variables.\n */\n#define\tVNET_SETNAME\t\t\"set_vnet\"\n#define\tVNET_SYMPREFIX\t\t\"vnet_entry_\"\n#endif\n\n#ifdef _KERNEL\n\n#ifdef VIMAGE\n#include <sys/lock.h>\n#include <sys/proc.h>\t\t\t/* for struct thread */\n#include <sys/rwlock.h>\n#include <sys/sx.h>\n\n/*\n * Location of the kernel's 'set_vnet' linker set.\n */\nextern uintptr_t\t*__start_set_vnet;\n__GLOBL(__start_set_vnet);\nextern uintptr_t\t*__stop_set_vnet;\n__GLOBL(__stop_set_vnet);\n\n#define\tVNET_START\t(uintptr_t)&__start_set_vnet\n#define\tVNET_STOP\t(uintptr_t)&__stop_set_vnet\n\n/*\n * Functions to allocate and destroy virtual network stacks.\n */\nstruct vnet *vnet_alloc(void);\nvoid\tvnet_destroy(struct vnet *vnet);\n\n/*\n * The current virtual network stack -- we may wish to move this to struct\n * pcpu in the future.\n */\n#define\tcurvnet\tcurthread->td_vnet\n\n/*\n * Various macros -- get and set the current network stack, but also\n * assertions.\n */\n#if defined(INVARIANTS) || defined(VNET_DEBUG)\n#define\tVNET_ASSERT(exp, msg)\tdo {\t\t\t\t\t\\\n\tif (!(exp))\t\t\t\t\t\t\t\\\n\t\tpanic msg;\t\t\t\t\t\t\\\n} while (0)\n#else\n#define\tVNET_ASSERT(exp, msg)\tdo {\t\t\t\t\t\\\n} while (0)\n#endif\n\n#ifdef VNET_DEBUG\nvoid vnet_log_recursion(struct vnet *, const char *, int);\n\n#define\tCURVNET_SET_QUIET(arg)\t\t\t\t\t\t\\\n\tVNET_ASSERT((arg) != NULL && (arg)->vnet_magic_n == VNET_MAGIC_N, \\\n\t    (\"CURVNET_SET at %s:%d %s() curvnet=%p vnet=%p\",\t\t\\\n\t    __FILE__, __LINE__, __func__, curvnet, (arg)));\t\t\\\n\tstruct vnet *saved_vnet = curvnet;\t\t\t\t\\\n\tconst char *saved_vnet_lpush = curthread->td_vnet_lpush;\t\\\n\tcurvnet = arg;\t\t\t\t\t\t\t\\\n\tcurthread->td_vnet_lpush = __func__;\n \n#define\tCURVNET_SET_VERBOSE(arg)\t\t\t\t\t\\\n\tCURVNET_SET_QUIET(arg)\t\t\t\t\t\t\\\n\tif (saved_vnet)\t\t\t\t\t\t\t\\\n\t\tvnet_log_recursion(saved_vnet, saved_vnet_lpush, __LINE__);\n\n#define\tCURVNET_SET(arg)\tCURVNET_SET_VERBOSE(arg)\n \n#define\tCURVNET_RESTORE()\t\t\t\t\t\t\\\n\tVNET_ASSERT(curvnet != NULL && (saved_vnet == NULL ||\t\t\\\n\t    saved_vnet->vnet_magic_n == VNET_MAGIC_N),\t\t\t\\\n\t    (\"CURVNET_RESTORE at %s:%d %s() curvnet=%p saved_vnet=%p\",\t\\\n\t    __FILE__, __LINE__, __func__, curvnet, saved_vnet));\t\\\n\tcurvnet = saved_vnet;\t\t\t\t\t\t\\\n\tcurthread->td_vnet_lpush = saved_vnet_lpush;\n#else /* !VNET_DEBUG */\n\n#define\tCURVNET_SET_QUIET(arg)\t\t\t\t\t\t\\\n\tVNET_ASSERT((arg) != NULL && (arg)->vnet_magic_n == VNET_MAGIC_N, \\\n\t    (\"CURVNET_SET at %s:%d %s() curvnet=%p vnet=%p\",\t\t\\\n\t    __FILE__, __LINE__, __func__, curvnet, (arg)));\t\t\\\n\tstruct vnet *saved_vnet = curvnet;\t\t\t\t\\\n\tcurvnet = arg;\t\n \n#define\tCURVNET_SET_VERBOSE(arg)\t\t\t\t\t\\\n\tCURVNET_SET_QUIET(arg)\n\n#define\tCURVNET_SET(arg)\tCURVNET_SET_VERBOSE(arg)\n \n#define\tCURVNET_RESTORE()\t\t\t\t\t\t\\\n\tVNET_ASSERT(curvnet != NULL && (saved_vnet == NULL ||\t\t\\\n\t    saved_vnet->vnet_magic_n == VNET_MAGIC_N),\t\t\t\\\n\t    (\"CURVNET_RESTORE at %s:%d %s() curvnet=%p saved_vnet=%p\",\t\\\n\t    __FILE__, __LINE__, __func__, curvnet, saved_vnet));\t\\\n\tcurvnet = saved_vnet;\n#endif /* VNET_DEBUG */\n\nextern struct vnet *vnet0;\n#define\tIS_DEFAULT_VNET(arg)\t((arg) == vnet0)\n\n#define\tCRED_TO_VNET(cr)\t(cr)->cr_prison->pr_vnet\n#define\tTD_TO_VNET(td)\t\tCRED_TO_VNET((td)->td_ucred)\n#define\tP_TO_VNET(p)\t\tCRED_TO_VNET((p)->p_ucred)\n\n/*\n * Global linked list of all virtual network stacks, along with read locks to\n * access it.  If a caller may sleep while accessing the list, it must use\n * the sleepable lock macros.\n */\nLIST_HEAD(vnet_list_head, vnet);\nextern struct vnet_list_head vnet_head;\nextern struct rwlock vnet_rwlock;\nextern struct sx vnet_sxlock;\n\n#define\tVNET_LIST_RLOCK()\t\tsx_slock(&vnet_sxlock)\n#define\tVNET_LIST_RLOCK_NOSLEEP()\trw_rlock(&vnet_rwlock)\n#define\tVNET_LIST_RUNLOCK()\t\tsx_sunlock(&vnet_sxlock)\n#define\tVNET_LIST_RUNLOCK_NOSLEEP()\trw_runlock(&vnet_rwlock)\n\n/*\n * Iteration macros to walk the global list of virtual network stacks.\n */\n#define\tVNET_ITERATOR_DECL(arg)\tstruct vnet *arg\n#define\tVNET_FOREACH(arg)\tLIST_FOREACH((arg), &vnet_head, vnet_le)\n\n/*\n * Virtual network stack memory allocator, which allows global variables to\n * be automatically instantiated for each network stack instance.\n */\n#define\tVNET_NAME(n)\t\tvnet_entry_##n\n#define\tVNET_DECLARE(t, n)\textern t VNET_NAME(n)\n#define\tVNET_DEFINE(t, n)\tt VNET_NAME(n) __section(VNET_SETNAME) __used\n#define\t_VNET_PTR(b, n)\t\t(__typeof(VNET_NAME(n))*)\t\t\\\n\t\t\t\t    ((b) + (uintptr_t)&VNET_NAME(n))\n\n#define\t_VNET(b, n)\t\t(*_VNET_PTR(b, n))\n\n/*\n * Virtualized global variable accessor macros.\n */\n#define\tVNET_VNET_PTR(vnet, n)\t\t_VNET_PTR((vnet)->vnet_data_base, n)\n#define\tVNET_VNET(vnet, n)\t\t(*VNET_VNET_PTR((vnet), n))\n\n#define\tVNET_PTR(n)\t\tVNET_VNET_PTR(curvnet, n)\n#define\tVNET(n)\t\t\tVNET_VNET(curvnet, n)\n\n/*\n * Virtual network stack allocator interfaces from the kernel linker.\n */\nvoid\t*vnet_data_alloc(int size);\nvoid\t vnet_data_copy(void *start, int size);\nvoid\t vnet_data_free(void *start_arg, int size);\n\n/*\n * Sysctl variants for vnet-virtualized global variables.  Include\n * <sys/sysctl.h> to expose these definitions.\n *\n * Note: SYSCTL_PROC() handler functions will need to resolve pointer\n * arguments themselves, if required.\n */\n#ifdef SYSCTL_OID\nint\tvnet_sysctl_handle_int(SYSCTL_HANDLER_ARGS);\nint\tvnet_sysctl_handle_opaque(SYSCTL_HANDLER_ARGS);\nint\tvnet_sysctl_handle_string(SYSCTL_HANDLER_ARGS);\nint\tvnet_sysctl_handle_uint(SYSCTL_HANDLER_ARGS);\n\n#define\tSYSCTL_VNET_INT(parent, nbr, name, access, ptr, val, descr)\t\\\n\tSYSCTL_OID(parent, nbr, name,\t\t\t\t\t\\\n\t    CTLTYPE_INT|CTLFLAG_MPSAFE|CTLFLAG_VNET|(access),\t\t\\\n\t    ptr, val, vnet_sysctl_handle_int, \"I\", descr)\n#define\tSYSCTL_VNET_PROC(parent, nbr, name, access, ptr, arg, handler,\t\\\n\t    fmt, descr)\t\t\t\t\t\t\t\\\n\tCTASSERT(((access) & CTLTYPE) != 0);\t\t\t\t\\\n\tSYSCTL_OID(parent, nbr, name, CTLFLAG_VNET|(access), ptr, arg, \t\\\n\t    handler, fmt, descr)\n#define\tSYSCTL_VNET_OPAQUE(parent, nbr, name, access, ptr, len, fmt,    \\\n\t    descr)\t\t\t\t\t\t\t\\\n\tSYSCTL_OID(parent, nbr, name,\t\t\t\t\t\\\n\t    CTLTYPE_OPAQUE|CTLFLAG_VNET|(access), ptr, len, \t\t\\\n\t    vnet_sysctl_handle_opaque, fmt, descr)\n#define\tSYSCTL_VNET_STRING(parent, nbr, name, access, arg, len, descr)\t\\\n\tSYSCTL_OID(parent, nbr, name,\t\t\t\t\t\\\n\t    CTLTYPE_STRING|CTLFLAG_VNET|(access),\t\t\t\\\n\t    arg, len, vnet_sysctl_handle_string, \"A\", descr)\n#define\tSYSCTL_VNET_STRUCT(parent, nbr, name, access, ptr, type, descr)\t\\\n\tSYSCTL_OID(parent, nbr, name,\t\t\t\t\t\\\n\t    CTLTYPE_OPAQUE|CTLFLAG_VNET|(access), ptr,\t\t\t\\\n\t    sizeof(struct type), vnet_sysctl_handle_opaque, \"S,\" #type,\t\\\n\t    descr)\n#define\tSYSCTL_VNET_UINT(parent, nbr, name, access, ptr, val, descr)\t\\\n\tSYSCTL_OID(parent, nbr, name,\t\t\t\t\t\\\n\t    CTLTYPE_UINT|CTLFLAG_MPSAFE|CTLFLAG_VNET|(access),\t\t\\\n\t    ptr, val, vnet_sysctl_handle_uint, \"IU\", descr)\n#define\tVNET_SYSCTL_ARG(req, arg1) do {\t\t\t\t\t\\\n\tif (arg1 != NULL)\t\t\t\t\t\t\\\n\t\targ1 = (void *)(TD_TO_VNET((req)->td)->vnet_data_base +\t\\\n\t\t    (uintptr_t)(arg1));\t\t\t\t\t\\\n} while (0)\n#endif /* SYSCTL_OID */\n\n/*\n * Virtual sysinit mechanism, allowing network stack components to declare\n * startup and shutdown methods to be run when virtual network stack\n * instances are created and destroyed.\n */\n#include <sys/kernel.h>\n\n/*\n * SYSINIT/SYSUNINIT variants that provide per-vnet constructors and\n * destructors.\n */\nstruct vnet_sysinit {\n\tenum sysinit_sub_id\tsubsystem;\n\tenum sysinit_elem_order\torder;\n\tsysinit_cfunc_t\t\tfunc;\n\tconst void\t\t*arg;\n\tTAILQ_ENTRY(vnet_sysinit) link;\n};\n\n#define\tVNET_SYSINIT(ident, subsystem, order, func, arg)\t\t\\\n\tstatic struct vnet_sysinit ident ## _vnet_init = {\t\t\\\n\t\tsubsystem,\t\t\t\t\t\t\\\n\t\torder,\t\t\t\t\t\t\t\\\n\t\t(sysinit_cfunc_t)(sysinit_nfunc_t)func,\t\t\t\\\n\t\t(arg)\t\t\t\t\t\t\t\\\n\t};\t\t\t\t\t\t\t\t\\\n\tSYSINIT(vnet_init_ ## ident, subsystem, order,\t\t\t\\\n\t    vnet_register_sysinit, &ident ## _vnet_init);\t\t\\\n\tSYSUNINIT(vnet_init_ ## ident, subsystem, order,\t\t\\\n\t    vnet_deregister_sysinit, &ident ## _vnet_init)\n\n#define\tVNET_SYSUNINIT(ident, subsystem, order, func, arg)\t\t\\\n\tstatic struct vnet_sysinit ident ## _vnet_uninit = {\t\t\\\n\t\tsubsystem,\t\t\t\t\t\t\\\n\t\torder,\t\t\t\t\t\t\t\\\n\t\t(sysinit_cfunc_t)(sysinit_nfunc_t)func,\t\t\t\\\n\t\t(arg)\t\t\t\t\t\t\t\\\n\t};\t\t\t\t\t\t\t\t\\\n\tSYSINIT(vnet_uninit_ ## ident, subsystem, order,\t\t\\\n\t    vnet_register_sysuninit, &ident ## _vnet_uninit);\t\t\\\n\tSYSUNINIT(vnet_uninit_ ## ident, subsystem, order,\t\t\\\n\t    vnet_deregister_sysuninit, &ident ## _vnet_uninit)\n\n/*\n * Run per-vnet sysinits or sysuninits during vnet creation/destruction.\n */\nvoid\t vnet_sysinit(void);\nvoid\t vnet_sysuninit(void);\n\n/*\n * Interfaces for managing per-vnet constructors and destructors.\n */\nvoid\tvnet_register_sysinit(void *arg);\nvoid\tvnet_register_sysuninit(void *arg);\nvoid\tvnet_deregister_sysinit(void *arg);\nvoid\tvnet_deregister_sysuninit(void *arg);\n\n/*\n * EVENTHANDLER(9) extensions.\n */\n#include <sys/eventhandler.h>\n\nvoid\tvnet_global_eventhandler_iterator_func(void *, ...);\n#define VNET_GLOBAL_EVENTHANDLER_REGISTER_TAG(tag, name, func, arg, priority) \\\ndo {\t\t\t\t\t\t\t\t\t\\\n\tif (IS_DEFAULT_VNET(curvnet)) {\t\t\t\t\t\\\n\t\t(tag) = vimage_eventhandler_register(NULL, #name, func,\t\\\n\t\t    arg, priority,\t\t\t\t\t\\\n\t\t    vnet_global_eventhandler_iterator_func);\t\t\\\n\t}\t\t\t\t\t\t\t\t\\\n} while(0)\n#define VNET_GLOBAL_EVENTHANDLER_REGISTER(name, func, arg, priority)\t\\\ndo {\t\t\t\t\t\t\t\t\t\\\n\tif (IS_DEFAULT_VNET(curvnet)) {\t\t\t\t\t\\\n\t\tvimage_eventhandler_register(NULL, #name, func,\t\t\\\n\t\t    arg, priority,\t\t\t\t\t\\\n\t\t    vnet_global_eventhandler_iterator_func);\t\t\\\n\t}\t\t\t\t\t\t\t\t\\\n} while(0)\n\n#else /* !VIMAGE */\n\n/*\n * Various virtual network stack macros compile to no-ops without VIMAGE.\n */\n#define\tcurvnet\t\t\tNULL\n\n#define\tVNET_ASSERT(exp, msg)\n#define\tCURVNET_SET(arg)\n#define\tCURVNET_SET_QUIET(arg)\n#define\tCURVNET_RESTORE()\n\n#define\tVNET_LIST_RLOCK()\n#define\tVNET_LIST_RLOCK_NOSLEEP()\n#define\tVNET_LIST_RUNLOCK()\n#define\tVNET_LIST_RUNLOCK_NOSLEEP()\n#define\tVNET_ITERATOR_DECL(arg)\n#define\tVNET_FOREACH(arg)\n\n#define\tIS_DEFAULT_VNET(arg)\t1\n#define\tCRED_TO_VNET(cr)\tNULL\n#define\tTD_TO_VNET(td)\t\tNULL\n#define\tP_TO_VNET(p)\t\tNULL\n\n/*\n * Versions of the VNET macros that compile to normal global variables and\n * standard sysctl definitions.\n */\n#define\tVNET_NAME(n)\t\tn\n#define\tVNET_DECLARE(t, n)\textern t n\n#define\tVNET_DEFINE(t, n)\tt n\n#define\t_VNET_PTR(b, n)\t\t&VNET_NAME(n)\n\n/*\n * Virtualized global variable accessor macros.\n */\n#define\tVNET_VNET_PTR(vnet, n)\t\t(&(n))\n#define\tVNET_VNET(vnet, n)\t\t(n)\n\n#define\tVNET_PTR(n)\t\t(&(n))\n#define\tVNET(n)\t\t\t(n)\n\n/*\n * When VIMAGE isn't compiled into the kernel, virtaulized SYSCTLs simply\n * become normal SYSCTLs.\n */\n#ifdef SYSCTL_OID\n#define\tSYSCTL_VNET_INT(parent, nbr, name, access, ptr, val, descr)\t\\\n\tSYSCTL_INT(parent, nbr, name, access, ptr, val, descr)\n#define\tSYSCTL_VNET_PROC(parent, nbr, name, access, ptr, arg, handler,\t\\\n\t    fmt, descr)\t\t\t\t\t\t\t\\\n\tSYSCTL_PROC(parent, nbr, name, access, ptr, arg, handler, fmt,\t\\\n\t    descr)\n#define\tSYSCTL_VNET_OPAQUE(parent, nbr, name, access, ptr, len, fmt,    \\\n\t    descr)\t\t\t\t\t\t\t\\\n\tSYSCTL_OPAQUE(parent, nbr, name, access, ptr, len, fmt, descr)\n#define\tSYSCTL_VNET_STRING(parent, nbr, name, access, arg, len, descr)\t\\\n\tSYSCTL_STRING(parent, nbr, name, access, arg, len, descr)\n#define\tSYSCTL_VNET_STRUCT(parent, nbr, name, access, ptr, type, descr)\t\\\n\tSYSCTL_STRUCT(parent, nbr, name, access, ptr, type, descr)\n#define\tSYSCTL_VNET_UINT(parent, nbr, name, access, ptr, val, descr)\t\\\n\tSYSCTL_UINT(parent, nbr, name, access, ptr, val, descr)\n#define\tVNET_SYSCTL_ARG(req, arg1)\n#endif /* SYSCTL_OID */\n\n/*\n * When VIMAGE isn't compiled into the kernel, VNET_SYSINIT/VNET_SYSUNINIT\n * map into normal sysinits, which have the same ordering properties.\n */\n#define\tVNET_SYSINIT(ident, subsystem, order, func, arg)\t\t\\\n\tSYSINIT(ident, subsystem, order, func, arg)\n#define\tVNET_SYSUNINIT(ident, subsystem, order, func, arg)\t\t\\\n\tSYSUNINIT(ident, subsystem, order, func, arg)\n\n/*\n * Without VIMAGE revert to the default implementation.\n */\n#define VNET_GLOBAL_EVENTHANDLER_REGISTER_TAG(tag, name, func, arg, priority) \\\n\t(tag) = eventhandler_register(NULL, #name, func, arg, priority)\n#define VNET_GLOBAL_EVENTHANDLER_REGISTER(name, func, arg, priority)\t\\\n\teventhandler_register(NULL, #name, func, arg, priority)\n#endif /* VIMAGE */\n#endif /* _KERNEL */\n\n#endif /* !_NET_VNET_H_ */\n"
  },
  {
    "path": "freebsd-headers/net/zlib.h",
    "content": "/* $FreeBSD: release/9.0.0/sys/net/zlib.h 204552 2010-03-02 06:58:58Z alfred $\t*/\n\n/*\n * This file is derived from zlib.h and zconf.h from the zlib-1.0.4\n * distribution by Jean-loup Gailly and Mark Adler, with some additions\n * by Paul Mackerras to aid in implementing Deflate compression and\n * decompression for PPP packets.\n */\n\n/*\n *  ==FILEVERSION 971127==\n *\n * This marker is used by the Linux installation script to determine\n * whether an up-to-date version of this file is already installed.\n */\n\n\n/* +++ zlib.h */\n/*-\n  zlib.h -- interface of the 'zlib' general purpose compression library\n  version 1.0.4, Jul 24th, 1996.\n\n  Copyright (C) 1995-1996 Jean-loup Gailly and Mark Adler\n\n  This software is provided 'as-is', without any express or implied\n  warranty.  In no event will the authors be held liable for any damages\n  arising from the use of this software.\n\n  Permission is granted to anyone to use this software for any purpose,\n  including commercial applications, and to alter it and redistribute it\n  freely, subject to the following restrictions:\n\n  1. The origin of this software must not be misrepresented; you must not\n     claim that you wrote the original software. If you use this software\n     in a product, an acknowledgment in the product documentation would be\n     appreciated but is not required.\n  2. Altered source versions must be plainly marked as such, and must not be\n     misrepresented as being the original software.\n  3. This notice may not be removed or altered from any source distribution.\n\n  Jean-loup Gailly        Mark Adler\n  gzip@prep.ai.mit.edu    madler@alumni.caltech.edu\n*/\n/*\n  The data format used by the zlib library is described by RFCs (Request for\n  Comments) 1950 to 1952 in the files ftp://ds.internic.net/rfc/rfc1950.txt\n  (zlib format), rfc1951.txt (deflate format) and rfc1952.txt (gzip format).\n*/\n\n#ifndef _ZLIB_H\n#define _ZLIB_H\n\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\n\n/* +++ zconf.h */\n/* zconf.h -- configuration of the zlib compression library\n * Copyright (C) 1995-1996 Jean-loup Gailly.\n * For conditions of distribution and use, see copyright notice in zlib.h \n */\n\n/* From: zconf.h,v 1.20 1996/07/02 15:09:28 me Exp $ */\n\n#ifndef _ZCONF_H\n#define _ZCONF_H\n\n/*\n * If you *really* need a unique prefix for all types and library functions,\n * compile with -DZ_PREFIX. The \"standard\" zlib should be compiled without it.\n */\n#ifdef Z_PREFIX\n#  define deflateInit_\tz_deflateInit_\n#  define deflate\tz_deflate\n#  define deflateEnd\tz_deflateEnd\n#  define inflateInit_ \tz_inflateInit_\n#  define inflate\tz_inflate\n#  define inflateEnd\tz_inflateEnd\n#  define deflateInit2_\tz_deflateInit2_\n#  define deflateSetDictionary z_deflateSetDictionary\n#  define deflateCopy\tz_deflateCopy\n#  define deflateReset\tz_deflateReset\n#  define deflateParams\tz_deflateParams\n#  define inflateInit2_\tz_inflateInit2_\n#  define inflateSetDictionary z_inflateSetDictionary\n#  define inflateSync\tz_inflateSync\n#  define inflateReset\tz_inflateReset\n#  define compress\tz_compress\n#  define uncompress\tz_uncompress\n#  define adler32\tz_adler32\n#if 0\n#  define crc32\t\tz_crc32\n#  define get_crc_table z_get_crc_table\n#endif\n\n#  define Byte\t\tz_Byte\n#  define uInt\t\tz_uInt\n#  define uLong\t\tz_uLong\n#  define Bytef\t        z_Bytef\n#  define charf\t\tz_charf\n#  define intf\t\tz_intf\n#  define uIntf\t\tz_uIntf\n#  define uLongf\tz_uLongf\n#  define voidpf\tz_voidpf\n#  define voidp\t\tz_voidp\n#endif\n\n#if (defined(_WIN32) || defined(__WIN32__)) && !defined(WIN32)\n#  define WIN32\n#endif\n#if defined(__GNUC__) || defined(WIN32) || defined(__386__) || defined(i386)\n#  ifndef __32BIT__\n#    define __32BIT__\n#  endif\n#endif\n#if defined(__MSDOS__) && !defined(MSDOS)\n#  define MSDOS\n#endif\n\n/*\n * Compile with -DMAXSEG_64K if the alloc function cannot allocate more\n * than 64k bytes at a time (needed on systems with 16-bit int).\n */\n#if defined(MSDOS) && !defined(__32BIT__)\n#  define MAXSEG_64K\n#endif\n#ifdef MSDOS\n#  define UNALIGNED_OK\n#endif\n\n#if (defined(MSDOS) || defined(_WINDOWS) || defined(WIN32))  && !defined(STDC)\n#  define STDC\n#endif\n#if (defined(__STDC__) || defined(__cplusplus)) && !defined(STDC)\n#  define STDC\n#endif\n\n#ifndef STDC\n#  ifndef const /* cannot use !defined(STDC) && !defined(const) on Mac */\n#    define const\n#  endif\n#endif\n\n/* Some Mac compilers merge all .h files incorrectly: */\n#if defined(__MWERKS__) || defined(applec) ||defined(THINK_C) ||defined(__SC__)\n#  define NO_DUMMY_DECL\n#endif\n\n/* Maximum value for memLevel in deflateInit2 */\n#ifndef MAX_MEM_LEVEL\n#  ifdef MAXSEG_64K\n#    define MAX_MEM_LEVEL 8\n#  else\n#    define MAX_MEM_LEVEL 9\n#  endif\n#endif\n\n/* Maximum value for windowBits in deflateInit2 and inflateInit2 */\n#ifndef MAX_WBITS\n#  define MAX_WBITS   15 /* 32K LZ77 window */\n#endif\n\n/* The memory requirements for deflate are (in bytes):\n            1 << (windowBits+2)   +  1 << (memLevel+9)\n that is: 128K for windowBits=15  +  128K for memLevel = 8  (default values)\n plus a few kilobytes for small objects. For example, if you want to reduce\n the default memory requirements from 256K to 128K, compile with\n     make CFLAGS=\"-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7\"\n Of course this will generally degrade compression (there's no free lunch).\n\n   The memory requirements for inflate are (in bytes) 1 << windowBits\n that is, 32K for windowBits=15 (default value) plus a few kilobytes\n for small objects.\n*/\n\n                        /* Type declarations */\n\n#ifndef OF /* function prototypes */\n#  ifdef STDC\n#    define OF(args)  args\n#  else\n#    define OF(args)  ()\n#  endif\n#endif\n\n/* The following definitions for FAR are needed only for MSDOS mixed\n * model programming (small or medium model with some far allocations).\n * This was tested only with MSC; for other MSDOS compilers you may have\n * to define NO_MEMCPY in zutil.h.  If you don't need the mixed model,\n * just define FAR to be empty.\n */\n#if (defined(M_I86SM) || defined(M_I86MM)) && !defined(__32BIT__)\n   /* MSC small or medium model */\n#  define SMALL_MEDIUM\n#  ifdef _MSC_VER\n#    define FAR __far\n#  else\n#    define FAR far\n#  endif\n#endif\n#if defined(__BORLANDC__) && (defined(__SMALL__) || defined(__MEDIUM__))\n#  ifndef __32BIT__\n#    define SMALL_MEDIUM\n#    define FAR __far\n#  endif\n#endif\n#ifndef FAR\n#   define FAR\n#endif\n\ntypedef unsigned char  Byte;  /* 8 bits */\ntypedef unsigned int   uInt;  /* 16 bits or more */\ntypedef unsigned long  uLong; /* 32 bits or more */\n\n#if defined(__BORLANDC__) && defined(SMALL_MEDIUM)\n   /* Borland C/C++ ignores FAR inside typedef */\n#  define Bytef Byte FAR\n#else\n   typedef Byte  FAR Bytef;\n#endif\ntypedef char  FAR charf;\ntypedef int   FAR intf;\ntypedef uInt  FAR uIntf;\ntypedef uLong FAR uLongf;\n\n#ifdef STDC\n   typedef void FAR *voidpf;\n   typedef void     *voidp;\n#else\n   typedef Byte FAR *voidpf;\n   typedef Byte     *voidp;\n#endif\n\n\n/* Compile with -DZLIB_DLL for Windows DLL support */\n#if (defined(_WINDOWS) || defined(WINDOWS)) && defined(ZLIB_DLL)\n#  include <windows.h>\n#  define EXPORT  WINAPI\n#else\n#  define EXPORT\n#endif\n\n#endif /* _ZCONF_H */\n/* --- zconf.h */\n\n#define ZLIB_VERSION \"1.0.4P\"\n\n/* \n     The 'zlib' compression library provides in-memory compression and\n  decompression functions, including integrity checks of the uncompressed\n  data.  This version of the library supports only one compression method\n  (deflation) but other algorithms may be added later and will have the same\n  stream interface.\n\n     For compression the application must provide the output buffer and\n  may optionally provide the input buffer for optimization. For decompression,\n  the application must provide the input buffer and may optionally provide\n  the output buffer for optimization.\n\n     Compression can be done in a single step if the buffers are large\n  enough (for example if an input file is mmap'ed), or can be done by\n  repeated calls of the compression function.  In the latter case, the\n  application must provide more input and/or consume the output\n  (providing more output space) before each call.\n\n     The library does not install any signal handler. It is recommended to\n  add at least a handler for SIGSEGV when decompressing; the library checks\n  the consistency of the input data whenever possible but may go nuts\n  for some forms of corrupted input.\n*/\n\ntypedef voidpf (*alloc_func) OF((voidpf opaque, uInt items, uInt size));\ntypedef void   (*free_func)  OF((voidpf opaque, voidpf address));\n\nstruct internal_state;\n\ntypedef struct z_stream_s {\n    Bytef    *next_in;  /* next input byte */\n    uInt     avail_in;  /* number of bytes available at next_in */\n    uLong    total_in;  /* total nb of input bytes read so far */\n\n    Bytef    *next_out; /* next output byte should be put there */\n    uInt     avail_out; /* remaining free space at next_out */\n    uLong    total_out; /* total nb of bytes output so far */\n\n    const char     *msg; /* last error message, NULL if no error */\n    struct internal_state FAR *state; /* not visible by applications */\n\n    alloc_func zalloc;  /* used to allocate the internal state */\n    free_func  zfree;   /* used to free the internal state */\n    voidpf     opaque;  /* private data object passed to zalloc and zfree */\n\n    int     data_type;  /* best guess about the data type: ascii or binary */\n    uLong   adler;      /* adler32 value of the uncompressed data */\n    uLong   reserved;   /* reserved for future use */\n} z_stream;\n\ntypedef z_stream FAR *z_streamp;\n\n/*\n   The application must update next_in and avail_in when avail_in has\n   dropped to zero. It must update next_out and avail_out when avail_out\n   has dropped to zero. The application must initialize zalloc, zfree and\n   opaque before calling the init function. All other fields are set by the\n   compression library and must not be updated by the application.\n\n   The opaque value provided by the application will be passed as the first\n   parameter for calls of zalloc and zfree. This can be useful for custom\n   memory management. The compression library attaches no meaning to the\n   opaque value.\n\n   zalloc must return Z_NULL if there is not enough memory for the object.\n   On 16-bit systems, the functions zalloc and zfree must be able to allocate\n   exactly 65536 bytes, but will not be required to allocate more than this\n   if the symbol MAXSEG_64K is defined (see zconf.h). WARNING: On MSDOS,\n   pointers returned by zalloc for objects of exactly 65536 bytes *must*\n   have their offset normalized to zero. The default allocation function\n   provided by this library ensures this (see zutil.c). To reduce memory\n   requirements and avoid any allocation of 64K objects, at the expense of\n   compression ratio, compile the library with -DMAX_WBITS=14 (see zconf.h).\n\n   The fields total_in and total_out can be used for statistics or\n   progress reports. After compression, total_in holds the total size of\n   the uncompressed data and may be saved for use in the decompressor\n   (particularly if the decompressor wants to decompress everything in\n   a single step).\n*/\n\n                        /* constants */\n\n#define Z_NO_FLUSH      0\n#define Z_PARTIAL_FLUSH 1\n#define Z_PACKET_FLUSH\t2\n#define Z_SYNC_FLUSH    3\n#define Z_FULL_FLUSH    4\n#define Z_FINISH        5\n/* Allowed flush values; see deflate() below for details */\n\n#define Z_OK            0\n#define Z_STREAM_END    1\n#define Z_NEED_DICT     2\n#define Z_ERRNO        (-1)\n#define Z_STREAM_ERROR (-2)\n#define Z_DATA_ERROR   (-3)\n#define Z_MEM_ERROR    (-4)\n#define Z_BUF_ERROR    (-5)\n#define Z_VERSION_ERROR (-6)\n/* Return codes for the compression/decompression functions. Negative\n * values are errors, positive values are used for special but normal events.\n */\n\n#define Z_NO_COMPRESSION         0\n#define Z_BEST_SPEED             1\n#define Z_BEST_COMPRESSION       9\n#define Z_DEFAULT_COMPRESSION  (-1)\n/* compression levels */\n\n#define Z_FILTERED            1\n#define Z_HUFFMAN_ONLY        2\n#define Z_DEFAULT_STRATEGY    0\n/* compression strategy; see deflateInit2() below for details */\n\n#define Z_BINARY   0\n#define Z_ASCII    1\n#define Z_UNKNOWN  2\n/* Possible values of the data_type field */\n\n#define Z_DEFLATED   8\n/* The deflate compression method (the only one supported in this version) */\n\n#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */\n\n#define zlib_version zlibVersion()\n/* for compatibility with versions < 1.0.2 */\n\n                        /* basic functions */\n\nextern const char * EXPORT zlibVersion OF((void));\n/* The application can compare zlibVersion and ZLIB_VERSION for consistency.\n   If the first character differs, the library code actually used is\n   not compatible with the zlib.h header file used by the application.\n   This check is automatically made by deflateInit and inflateInit.\n */\n\n/* \nextern int EXPORT deflateInit OF((z_streamp strm, int level));\n\n     Initializes the internal stream state for compression. The fields\n   zalloc, zfree and opaque must be initialized before by the caller.\n   If zalloc and zfree are set to Z_NULL, deflateInit updates them to\n   use default allocation functions.\n\n     The compression level must be Z_DEFAULT_COMPRESSION, or between 0 and 9:\n   1 gives best speed, 9 gives best compression, 0 gives no compression at\n   all (the input data is simply copied a block at a time).\n   Z_DEFAULT_COMPRESSION requests a default compromise between speed and\n   compression (currently equivalent to level 6).\n\n     deflateInit returns Z_OK if success, Z_MEM_ERROR if there was not\n   enough memory, Z_STREAM_ERROR if level is not a valid compression level,\n   Z_VERSION_ERROR if the zlib library version (zlib_version) is incompatible\n   with the version assumed by the caller (ZLIB_VERSION).\n   msg is set to null if there is no error message.  deflateInit does not\n   perform any compression: this will be done by deflate().\n*/\n\n\nextern int EXPORT deflate OF((z_streamp strm, int flush));\n/*\n  Performs one or both of the following actions:\n\n  - Compress more input starting at next_in and update next_in and avail_in\n    accordingly. If not all input can be processed (because there is not\n    enough room in the output buffer), next_in and avail_in are updated and\n    processing will resume at this point for the next call of deflate().\n\n  - Provide more output starting at next_out and update next_out and avail_out\n    accordingly. This action is forced if the parameter flush is non zero.\n    Forcing flush frequently degrades the compression ratio, so this parameter\n    should be set only when necessary (in interactive applications).\n    Some output may be provided even if flush is not set.\n\n  Before the call of deflate(), the application should ensure that at least\n  one of the actions is possible, by providing more input and/or consuming\n  more output, and updating avail_in or avail_out accordingly; avail_out\n  should never be zero before the call. The application can consume the\n  compressed output when it wants, for example when the output buffer is full\n  (avail_out == 0), or after each call of deflate(). If deflate returns Z_OK\n  and with zero avail_out, it must be called again after making room in the\n  output buffer because there might be more output pending.\n\n    If the parameter flush is set to Z_PARTIAL_FLUSH, the current compression\n  block is terminated and flushed to the output buffer so that the\n  decompressor can get all input data available so far. For method 9, a future\n  variant on method 8, the current block will be flushed but not terminated.\n  Z_SYNC_FLUSH has the same effect as partial flush except that the compressed\n  output is byte aligned (the compressor can clear its internal bit buffer)\n  and the current block is always terminated; this can be useful if the\n  compressor has to be restarted from scratch after an interruption (in which\n  case the internal state of the compressor may be lost).\n    If flush is set to Z_FULL_FLUSH, the compression block is terminated, a\n  special marker is output and the compression dictionary is discarded; this\n  is useful to allow the decompressor to synchronize if one compressed block\n  has been damaged (see inflateSync below).  Flushing degrades compression and\n  so should be used only when necessary.  Using Z_FULL_FLUSH too often can\n  seriously degrade the compression. If deflate returns with avail_out == 0,\n  this function must be called again with the same value of the flush\n  parameter and more output space (updated avail_out), until the flush is\n  complete (deflate returns with non-zero avail_out).\n\n    If the parameter flush is set to Z_PACKET_FLUSH, the compression\n  block is terminated, and a zero-length stored block is output,\n  omitting the length bytes (the effect of this is that the 3-bit type\n  code 000 for a stored block is output, and the output is then\n  byte-aligned).  This is designed for use at the end of a PPP packet.\n\n    If the parameter flush is set to Z_FINISH, pending input is processed,\n  pending output is flushed and deflate returns with Z_STREAM_END if there\n  was enough output space; if deflate returns with Z_OK, this function must be\n  called again with Z_FINISH and more output space (updated avail_out) but no\n  more input data, until it returns with Z_STREAM_END or an error. After\n  deflate has returned Z_STREAM_END, the only possible operations on the\n  stream are deflateReset or deflateEnd.\n  \n    Z_FINISH can be used immediately after deflateInit if all the compression\n  is to be done in a single step. In this case, avail_out must be at least\n  0.1% larger than avail_in plus 12 bytes.  If deflate does not return\n  Z_STREAM_END, then it must be called again as described above.\n\n    deflate() may update data_type if it can make a good guess about\n  the input data type (Z_ASCII or Z_BINARY). In doubt, the data is considered\n  binary. This field is only for information purposes and does not affect\n  the compression algorithm in any manner.\n\n    deflate() returns Z_OK if some progress has been made (more input\n  processed or more output produced), Z_STREAM_END if all input has been\n  consumed and all output has been produced (only when flush is set to\n  Z_FINISH), Z_STREAM_ERROR if the stream state was inconsistent (for example\n  if next_in or next_out was NULL), Z_BUF_ERROR if no progress is possible.\n*/\n\n\nextern int EXPORT deflateEnd OF((z_streamp strm));\n/*\n     All dynamically allocated data structures for this stream are freed.\n   This function discards any unprocessed input and does not flush any\n   pending output.\n\n     deflateEnd returns Z_OK if success, Z_STREAM_ERROR if the\n   stream state was inconsistent, Z_DATA_ERROR if the stream was freed\n   prematurely (some input or output was discarded). In the error case,\n   msg may be set but then points to a static string (which must not be\n   deallocated).\n*/\n\n\n/* \nextern int EXPORT inflateInit OF((z_streamp strm));\n\n     Initializes the internal stream state for decompression. The fields\n   zalloc, zfree and opaque must be initialized before by the caller.  If\n   zalloc and zfree are set to Z_NULL, inflateInit updates them to use default\n   allocation functions.\n\n     inflateInit returns Z_OK if success, Z_MEM_ERROR if there was not\n   enough memory, Z_VERSION_ERROR if the zlib library version is incompatible\n   with the version assumed by the caller.  msg is set to null if there is no\n   error message. inflateInit does not perform any decompression: this will be\n   done by inflate().\n*/\n\n#if defined(__FreeBSD__) && defined(_KERNEL)\n#define inflate       inflate_ppp     /* FreeBSD already has an inflate :-( */\n#endif\n\nextern int EXPORT inflate OF((z_streamp strm, int flush));\n/*\n  Performs one or both of the following actions:\n\n  - Decompress more input starting at next_in and update next_in and avail_in\n    accordingly. If not all input can be processed (because there is not\n    enough room in the output buffer), next_in is updated and processing\n    will resume at this point for the next call of inflate().\n\n  - Provide more output starting at next_out and update next_out and avail_out\n    accordingly.  inflate() provides as much output as possible, until there\n    is no more input data or no more space in the output buffer (see below\n    about the flush parameter).\n\n  Before the call of inflate(), the application should ensure that at least\n  one of the actions is possible, by providing more input and/or consuming\n  more output, and updating the next_* and avail_* values accordingly.\n  The application can consume the uncompressed output when it wants, for\n  example when the output buffer is full (avail_out == 0), or after each\n  call of inflate(). If inflate returns Z_OK and with zero avail_out, it\n  must be called again after making room in the output buffer because there\n  might be more output pending.\n\n    If the parameter flush is set to Z_PARTIAL_FLUSH or Z_PACKET_FLUSH,\n  inflate flushes as much output as possible to the output buffer. The\n  flushing behavior of inflate is not specified for values of the flush\n  parameter other than Z_PARTIAL_FLUSH, Z_PACKET_FLUSH or Z_FINISH, but the\n  current implementation actually flushes as much output as possible\n  anyway.  For Z_PACKET_FLUSH, inflate checks that once all the input data\n  has been consumed, it is expecting to see the length field of a stored\n  block; if not, it returns Z_DATA_ERROR.\n\n    inflate() should normally be called until it returns Z_STREAM_END or an\n  error. However if all decompression is to be performed in a single step\n  (a single call of inflate), the parameter flush should be set to\n  Z_FINISH. In this case all pending input is processed and all pending\n  output is flushed; avail_out must be large enough to hold all the\n  uncompressed data. (The size of the uncompressed data may have been saved\n  by the compressor for this purpose.) The next operation on this stream must\n  be inflateEnd to deallocate the decompression state. The use of Z_FINISH\n  is never required, but can be used to inform inflate that a faster routine\n  may be used for the single inflate() call.\n\n    inflate() returns Z_OK if some progress has been made (more input\n  processed or more output produced), Z_STREAM_END if the end of the\n  compressed data has been reached and all uncompressed output has been\n  produced, Z_NEED_DICT if a preset dictionary is needed at this point (see\n  inflateSetDictionary below), Z_DATA_ERROR if the input data was corrupted,\n  Z_STREAM_ERROR if the stream structure was inconsistent (for example if\n  next_in or next_out was NULL), Z_MEM_ERROR if there was not enough memory,\n  Z_BUF_ERROR if no progress is possible or if there was not enough room in\n  the output buffer when Z_FINISH is used. In the Z_DATA_ERROR case, the\n  application may then call inflateSync to look for a good compression block.\n  In the Z_NEED_DICT case, strm->adler is set to the Adler32 value of the\n  dictionary chosen by the compressor.\n*/\n\n\nextern int EXPORT inflateEnd OF((z_streamp strm));\n/*\n     All dynamically allocated data structures for this stream are freed.\n   This function discards any unprocessed input and does not flush any\n   pending output.\n\n     inflateEnd returns Z_OK if success, Z_STREAM_ERROR if the stream state\n   was inconsistent. In the error case, msg may be set but then points to a\n   static string (which must not be deallocated).\n*/\n\n                        /* Advanced functions */\n\n/*\n    The following functions are needed only in some special applications.\n*/\n\n/*   \nextern int EXPORT deflateInit2 OF((z_streamp strm,\n                                   int  level,\n                                   int  method,\n                                   int  windowBits,\n                                   int  memLevel,\n                                   int  strategy));\n\n     This is another version of deflateInit with more compression options. The\n   fields next_in, zalloc, zfree and opaque must be initialized before by\n   the caller.\n\n     The method parameter is the compression method. It must be Z_DEFLATED in\n   this version of the library. (Method 9 will allow a 64K history buffer and\n   partial block flushes.)\n\n     The windowBits parameter is the base two logarithm of the window size\n   (the size of the history buffer).  It should be in the range 8..15 for this\n   version of the library (the value 16 will be allowed for method 9). Larger\n   values of this parameter result in better compression at the expense of\n   memory usage. The default value is 15 if deflateInit is used instead.\n\n     The memLevel parameter specifies how much memory should be allocated\n   for the internal compression state. memLevel=1 uses minimum memory but\n   is slow and reduces compression ratio; memLevel=9 uses maximum memory\n   for optimal speed. The default value is 8. See zconf.h for total memory\n   usage as a function of windowBits and memLevel.\n\n     The strategy parameter is used to tune the compression algorithm. Use the\n   value Z_DEFAULT_STRATEGY for normal data, Z_FILTERED for data produced by a\n   filter (or predictor), or Z_HUFFMAN_ONLY to force Huffman encoding only (no\n   string match).  Filtered data consists mostly of small values with a\n   somewhat random distribution. In this case, the compression algorithm is\n   tuned to compress them better. The effect of Z_FILTERED is to force more\n   Huffman coding and less string matching; it is somewhat intermediate\n   between Z_DEFAULT and Z_HUFFMAN_ONLY. The strategy parameter only affects\n   the compression ratio but not the correctness of the compressed output even\n   if it is not set appropriately.\n\n     If next_in is not null, the library will use this buffer to hold also\n   some history information; the buffer must either hold the entire input\n   data, or have at least 1<<(windowBits+1) bytes and be writable. If next_in\n   is null, the library will allocate its own history buffer (and leave next_in\n   null). next_out need not be provided here but must be provided by the\n   application for the next call of deflate().\n\n     If the history buffer is provided by the application, next_in must\n   must never be changed by the application since the compressor maintains\n   information inside this buffer from call to call; the application\n   must provide more input only by increasing avail_in. next_in is always\n   reset by the library in this case.\n\n      deflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was\n   not enough memory, Z_STREAM_ERROR if a parameter is invalid (such as\n   an invalid method). msg is set to null if there is no error message.\n   deflateInit2 does not perform any compression: this will be done by\n   deflate(). \n*/\n                            \nextern int EXPORT deflateSetDictionary OF((z_streamp strm,\n                                           const Bytef *dictionary,\n\t\t\t\t           uInt  dictLength));\n/*\n     Initializes the compression dictionary (history buffer) from the given\n   byte sequence without producing any compressed output. This function must\n   be called immediately after deflateInit or deflateInit2, before any call\n   of deflate. The compressor and decompressor must use exactly the same\n   dictionary (see inflateSetDictionary).\n     The dictionary should consist of strings (byte sequences) that are likely\n   to be encountered later in the data to be compressed, with the most commonly\n   used strings preferably put towards the end of the dictionary. Using a\n   dictionary is most useful when the data to be compressed is short and\n   can be predicted with good accuracy; the data can then be compressed better\n   than with the default empty dictionary. In this version of the library,\n   only the last 32K bytes of the dictionary are used.\n     Upon return of this function, strm->adler is set to the Adler32 value\n   of the dictionary; the decompressor may later use this value to determine\n   which dictionary has been used by the compressor. (The Adler32 value\n   applies to the whole dictionary even if only a subset of the dictionary is\n   actually used by the compressor.)\n\n     deflateSetDictionary returns Z_OK if success, or Z_STREAM_ERROR if a\n   parameter is invalid (such as NULL dictionary) or the stream state\n   is inconsistent (for example if deflate has already been called for this\n   stream). deflateSetDictionary does not perform any compression: this will\n   be done by deflate(). \n*/\n\nextern int EXPORT deflateCopy OF((z_streamp dest,\n                                  z_streamp source));\n/*\n     Sets the destination stream as a complete copy of the source stream.  If\n   the source stream is using an application-supplied history buffer, a new\n   buffer is allocated for the destination stream.  The compressed output\n   buffer is always application-supplied. It's the responsibility of the\n   application to provide the correct values of next_out and avail_out for the\n   next call of deflate.\n\n     This function can be useful when several compression strategies will be\n   tried, for example when there are several ways of pre-processing the input\n   data with a filter. The streams that will be discarded should then be freed\n   by calling deflateEnd.  Note that deflateCopy duplicates the internal\n   compression state which can be quite large, so this strategy is slow and\n   can consume lots of memory.\n\n     deflateCopy returns Z_OK if success, Z_MEM_ERROR if there was not\n   enough memory, Z_STREAM_ERROR if the source stream state was inconsistent\n   (such as zalloc being NULL). msg is left unchanged in both source and\n   destination.\n*/\n\nextern int EXPORT deflateReset OF((z_streamp strm));\n/*\n     This function is equivalent to deflateEnd followed by deflateInit,\n   but does not free and reallocate all the internal compression state.\n   The stream will keep the same compression level and any other attributes\n   that may have been set by deflateInit2.\n\n      deflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source\n   stream state was inconsistent (such as zalloc or state being NULL).\n*/\n\nextern int EXPORT deflateParams OF((z_streamp strm, int level, int strategy));\n/*\n     Dynamically update the compression level and compression strategy.\n   This can be used to switch between compression and straight copy of\n   the input data, or to switch to a different kind of input data requiring\n   a different strategy. If the compression level is changed, the input\n   available so far is compressed with the old level (and may be flushed);\n   the new level will take effect only at the next call of deflate().\n\n     Before the call of deflateParams, the stream state must be set as for\n   a call of deflate(), since the currently available input may have to\n   be compressed and flushed. In particular, strm->avail_out must be non-zero.\n\n     deflateParams returns Z_OK if success, Z_STREAM_ERROR if the source\n   stream state was inconsistent or if a parameter was invalid, Z_BUF_ERROR\n   if strm->avail_out was zero.\n*/\n\nextern int EXPORT deflateOutputPending OF((z_streamp strm));\n/*\n     Returns the number of bytes of output which are immediately\n   available from the compressor (i.e. without any further input\n   or flush).\n*/\n\n/*   \nextern int EXPORT inflateInit2 OF((z_streamp strm,\n                                   int  windowBits));\n\n     This is another version of inflateInit with more compression options. The\n   fields next_out, zalloc, zfree and opaque must be initialized before by\n   the caller.\n\n     The windowBits parameter is the base two logarithm of the maximum window\n   size (the size of the history buffer).  It should be in the range 8..15 for\n   this version of the library (the value 16 will be allowed soon). The\n   default value is 15 if inflateInit is used instead. If a compressed stream\n   with a larger window size is given as input, inflate() will return with\n   the error code Z_DATA_ERROR instead of trying to allocate a larger window.\n\n     If next_out is not null, the library will use this buffer for the history\n   buffer; the buffer must either be large enough to hold the entire output\n   data, or have at least 1<<windowBits bytes.  If next_out is null, the\n   library will allocate its own buffer (and leave next_out null). next_in\n   need not be provided here but must be provided by the application for the\n   next call of inflate().\n\n     If the history buffer is provided by the application, next_out must\n   never be changed by the application since the decompressor maintains\n   history information inside this buffer from call to call; the application\n   can only reset next_out to the beginning of the history buffer when\n   avail_out is zero and all output has been consumed.\n\n      inflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was\n   not enough memory, Z_STREAM_ERROR if a parameter is invalid (such as\n   windowBits < 8). msg is set to null if there is no error message.\n   inflateInit2 does not perform any decompression: this will be done by\n   inflate().\n*/\n\nextern int EXPORT inflateSetDictionary OF((z_streamp strm,\n\t\t\t\t           const Bytef *dictionary,\n\t\t\t\t\t   uInt  dictLength));\n/*\n     Initializes the decompression dictionary (history buffer) from the given\n   uncompressed byte sequence. This function must be called immediately after\n   a call of inflate if this call returned Z_NEED_DICT. The dictionary chosen\n   by the compressor can be determined from the Adler32 value returned by this\n   call of inflate. The compressor and decompressor must use exactly the same\n   dictionary (see deflateSetDictionary).\n\n     inflateSetDictionary returns Z_OK if success, Z_STREAM_ERROR if a\n   parameter is invalid (such as NULL dictionary) or the stream state is\n   inconsistent, Z_DATA_ERROR if the given dictionary doesn't match the\n   expected one (incorrect Adler32 value). inflateSetDictionary does not\n   perform any decompression: this will be done by subsequent calls of\n   inflate().\n*/\n\nextern int EXPORT inflateSync OF((z_streamp strm));\n/* \n    Skips invalid compressed data until the special marker (see deflate()\n  above) can be found, or until all available input is skipped. No output\n  is provided.\n\n    inflateSync returns Z_OK if the special marker has been found, Z_BUF_ERROR\n  if no more input was provided, Z_DATA_ERROR if no marker has been found,\n  or Z_STREAM_ERROR if the stream structure was inconsistent. In the success\n  case, the application may save the current current value of total_in which\n  indicates where valid compressed data was found. In the error case, the\n  application may repeatedly call inflateSync, providing more input each time,\n  until success or end of the input data.\n*/\n\nextern int EXPORT inflateReset OF((z_streamp strm));\n/*\n     This function is equivalent to inflateEnd followed by inflateInit,\n   but does not free and reallocate all the internal decompression state.\n   The stream will keep attributes that may have been set by inflateInit2.\n\n      inflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source\n   stream state was inconsistent (such as zalloc or state being NULL).\n*/\n\nextern int inflateIncomp OF((z_stream *strm));\n/*\n     This function adds the data at next_in (avail_in bytes) to the output\n   history without performing any output.  There must be no pending output,\n   and the decompressor must be expecting to see the start of a block.\n   Calling this function is equivalent to decompressing a stored block\n   containing the data at next_in (except that the data is not output).\n*/\n\n                        /* utility functions */\n\n/*\n     The following utility functions are implemented on top of the\n   basic stream-oriented functions. To simplify the interface, some\n   default options are assumed (compression level, window size,\n   standard memory allocation functions). The source code of these\n   utility functions can easily be modified if you need special options.\n*/\n\nextern int EXPORT compress OF((Bytef *dest,   uLongf *destLen,\n\t\t\t       const Bytef *source, uLong sourceLen));\n/*\n     Compresses the source buffer into the destination buffer.  sourceLen is\n   the byte length of the source buffer. Upon entry, destLen is the total\n   size of the destination buffer, which must be at least 0.1% larger than\n   sourceLen plus 12 bytes. Upon exit, destLen is the actual size of the\n   compressed buffer.\n     This function can be used to compress a whole file at once if the\n   input file is mmap'ed.\n     compress returns Z_OK if success, Z_MEM_ERROR if there was not\n   enough memory, Z_BUF_ERROR if there was not enough room in the output\n   buffer.\n*/\n\nextern int EXPORT uncompress OF((Bytef *dest,   uLongf *destLen,\n\t\t\t\t const Bytef *source, uLong sourceLen));\n/*\n     Decompresses the source buffer into the destination buffer.  sourceLen is\n   the byte length of the source buffer. Upon entry, destLen is the total\n   size of the destination buffer, which must be large enough to hold the\n   entire uncompressed data. (The size of the uncompressed data must have\n   been saved previously by the compressor and transmitted to the decompressor\n   by some mechanism outside the scope of this compression library.)\n   Upon exit, destLen is the actual size of the compressed buffer.\n     This function can be used to decompress a whole file at once if the\n   input file is mmap'ed.\n\n     uncompress returns Z_OK if success, Z_MEM_ERROR if there was not\n   enough memory, Z_BUF_ERROR if there was not enough room in the output\n   buffer, or Z_DATA_ERROR if the input data was corrupted.\n*/\n\n\ntypedef voidp gzFile;\n\nextern gzFile EXPORT gzopen  OF((const char *path, const char *mode));\n/*\n     Opens a gzip (.gz) file for reading or writing. The mode parameter\n   is as in fopen (\"rb\" or \"wb\") but can also include a compression level\n   (\"wb9\").  gzopen can be used to read a file which is not in gzip format;\n   in this case gzread will directly read from the file without decompression.\n     gzopen returns NULL if the file could not be opened or if there was\n   insufficient memory to allocate the (de)compression state; errno\n   can be checked to distinguish the two cases (if errno is zero, the\n   zlib error is Z_MEM_ERROR).\n*/\n\nextern gzFile EXPORT gzdopen  OF((int fd, const char *mode));\n/*\n     gzdopen() associates a gzFile with the file descriptor fd.  File\n   descriptors are obtained from calls like open, dup, creat, pipe or\n   fileno (in the file has been previously opened with fopen).\n   The mode parameter is as in gzopen.\n     The next call of gzclose on the returned gzFile will also close the\n   file descriptor fd, just like fclose(fdopen(fd), mode) closes the file\n   descriptor fd. If you want to keep fd open, use gzdopen(dup(fd), mode).\n     gzdopen returns NULL if there was insufficient memory to allocate\n   the (de)compression state.\n*/\n\nextern int EXPORT    gzread  OF((gzFile file, voidp buf, unsigned len));\n/*\n     Reads the given number of uncompressed bytes from the compressed file.\n   If the input file was not in gzip format, gzread copies the given number\n   of bytes into the buffer.\n     gzread returns the number of uncompressed bytes actually read (0 for\n   end of file, -1 for error). */\n\nextern int EXPORT    gzwrite OF((gzFile file, const voidp buf, unsigned len));\n/*\n     Writes the given number of uncompressed bytes into the compressed file.\n   gzwrite returns the number of uncompressed bytes actually written\n   (0 in case of error).\n*/\n\nextern int EXPORT    gzflush OF((gzFile file, int flush));\n/*\n     Flushes all pending output into the compressed file. The parameter\n   flush is as in the deflate() function. The return value is the zlib\n   error number (see function gzerror below). gzflush returns Z_OK if\n   the flush parameter is Z_FINISH and all output could be flushed.\n     gzflush should be called only when strictly necessary because it can\n   degrade compression.\n*/\n\nextern int EXPORT    gzclose OF((gzFile file));\n/*\n     Flushes all pending output if necessary, closes the compressed file\n   and deallocates all the (de)compression state. The return value is the zlib\n   error number (see function gzerror below).\n*/\n\nextern const char * EXPORT gzerror OF((gzFile file, int *errnum));\n/*\n     Returns the error message for the last error which occurred on the\n   given compressed file. errnum is set to zlib error number. If an\n   error occurred in the filesystem and not in the compression library,\n   errnum is set to Z_ERRNO and the application may consult errno\n   to get the exact error code.\n*/\n\n                        /* checksum functions */\n\n/*\n     These functions are not related to compression but are exported\n   anyway because they might be useful in applications using the\n   compression library.\n*/\n\nextern uLong EXPORT adler32 OF((uLong adler, const Bytef *buf, uInt len));\n\n/*\n     Update a running Adler-32 checksum with the bytes buf[0..len-1] and\n   return the updated checksum. If buf is NULL, this function returns\n   the required initial value for the checksum.\n   An Adler-32 checksum is almost as reliable as a CRC32 but can be computed\n   much faster. Usage example:\n\n     uLong adler = adler32(0L, Z_NULL, 0);\n\n     while (read_buffer(buffer, length) != EOF) {\n       adler = adler32(adler, buffer, length);\n     }\n     if (adler != original_adler) error();\n*/\n\n#if 0\nextern uLong EXPORT crc32   OF((uLong crc, const Bytef *buf, uInt len));\n/*\n     Update a running crc with the bytes buf[0..len-1] and return the updated\n   crc. If buf is NULL, this function returns the required initial value\n   for the crc. Pre- and post-conditioning (one's complement) is performed\n   within this function so it shouldn't be done by the application.\n   Usage example:\n\n     uLong crc = crc32(0L, Z_NULL, 0);\n\n     while (read_buffer(buffer, length) != EOF) {\n       crc = crc32(crc, buffer, length);\n     }\n     if (crc != original_crc) error();\n*/\n#endif\n\n\n                        /* various hacks, don't look :) */\n\n/* deflateInit and inflateInit are macros to allow checking the zlib version\n * and the compiler's view of z_stream:\n */\nextern int EXPORT deflateInit_ OF((z_streamp strm, int level,\n\t\t\t           const char *version, int stream_size));\nextern int EXPORT inflateInit_ OF((z_streamp strm,\n\t\t\t\t   const char *version, int stream_size));\nextern int EXPORT deflateInit2_ OF((z_streamp strm, int  level, int  method,\n\t\t\t\t    int windowBits, int memLevel, int strategy,\n\t\t\t\t    const char *version, int stream_size));\nextern int EXPORT inflateInit2_ OF((z_streamp strm, int  windowBits,\n\t\t\t\t    const char *version, int stream_size));\n#define deflateInit(strm, level) \\\n        deflateInit_((strm), (level),       ZLIB_VERSION, sizeof(z_stream))\n#define inflateInit(strm) \\\n        inflateInit_((strm),                ZLIB_VERSION, sizeof(z_stream))\n#define deflateInit2(strm, level, method, windowBits, memLevel, strategy) \\\n        deflateInit2_((strm),(level),(method),(windowBits),(memLevel),\\\n\t\t      (strategy),           ZLIB_VERSION, sizeof(z_stream))\n#define inflateInit2(strm, windowBits) \\\n        inflateInit2_((strm), (windowBits), ZLIB_VERSION, sizeof(z_stream))\n\n#if !defined(_Z_UTIL_H) && !defined(NO_DUMMY_DECL)\n    struct internal_state {int dummy;}; /* hack for buggy compilers */\n#endif\n\nuLongf *get_crc_table OF((void)); /* can be used by asm versions of crc32() */\n\n#ifdef _KERNEL\nstruct vnode;\nextern gzFile gz_open     OF((const char *path, const char *mode,\n\t                              struct vnode *vp));\n#endif\n\n\n#ifdef __cplusplus\n}\n#endif\n\n#endif /* _ZLIB_H */\n/* --- zlib.h */\n"
  },
  {
    "path": "freebsd-headers/net/zutil.h",
    "content": "/* zutil.h -- internal interface and configuration of the compression library\n * Copyright (C) 1995-1996 Jean-loup Gailly.\n * For conditions of distribution and use, see copyright notice in zlib.h\n */\n\n/* WARNING: this file should *not* be used by applications. It is\n   part of the implementation of the compression library and is\n   subject to change. Applications should only use zlib.h.\n */\n\n/* From: zutil.h,v 1.16 1996/07/24 13:41:13 me Exp $ */\n/* $FreeBSD: release/9.0.0/sys/net/zutil.h 204552 2010-03-02 06:58:58Z alfred $ */\n\n#ifndef _Z_UTIL_H\n#define _Z_UTIL_H\n\n#define ZEXPORT\n\n#ifdef _KERNEL\n#include <net/zlib.h>\n#else\n#include \"zlib.h\"\n#endif\n\n#ifdef _KERNEL\n/* Assume this is a *BSD or SVR4 kernel */\n#include <sys/types.h>\n#include <sys/time.h>\n#include <sys/systm.h>\n#include <sys/module.h>\n#include <sys/errno.h>\n#include <sys/param.h>\n#include <sys/kernel.h>\n#  define HAVE_MEMCPY\n#  define memcpy(d, s, n)\tbcopy((s), (d), (n))\n#  define memset(d, v, n)\tbzero((d), (n))\n#  define memcmp\t\tbcmp\n\n#else\n#if defined(__KERNEL__)\n/* Assume this is a Linux kernel */\n#include <linux/string.h>\n#define HAVE_MEMCPY\n\n#else /* not kernel */\n\n#if defined(MSDOS)||defined(VMS)||defined(CRAY)||defined(WIN32)||defined(RISCOS)\n#   include <stddef.h>\n#   include <errno.h>\n#else\n    extern int errno;\n#endif\n#ifdef STDC\n#  include <string.h>\n#  include <stdlib.h>\n#endif\n#endif /* __KERNEL__ */\n#endif /* _KERNEL */\n\n#ifndef local\n#  define local static\n#endif\n/* compile with -Dlocal if your debugger can't find static symbols */\n\ntypedef unsigned char  uch;\ntypedef uch FAR uchf;\ntypedef unsigned short ush;\ntypedef ush FAR ushf;\ntypedef unsigned long  ulg;\n\n#define ERR_MSG(err) z_errmsg[Z_NEED_DICT-(err)]\n\n#define ERR_RETURN(strm,err) \\\n  return (strm->msg = (const char*)ERR_MSG(err), (err))\n/* To be used only when the state is known to be valid */\n\n        /* common constants */\n\n#ifndef DEF_WBITS\n#  define DEF_WBITS MAX_WBITS\n#endif\n/* default windowBits for decompression. MAX_WBITS is for compression only */\n\n#if MAX_MEM_LEVEL >= 8\n#  define DEF_MEM_LEVEL 8\n#else\n#  define DEF_MEM_LEVEL  MAX_MEM_LEVEL\n#endif\n/* default memLevel */\n\n#define STORED_BLOCK 0\n#define STATIC_TREES 1\n#define DYN_TREES    2\n/* The three kinds of block type */\n\n#define MIN_MATCH  3\n#define MAX_MATCH  258\n/* The minimum and maximum match lengths */\n\n#define PRESET_DICT 0x20 /* preset dictionary flag in zlib header */\n\n        /* target dependencies */\n\n#ifdef MSDOS\n#  define OS_CODE  0x00\n#  ifdef __TURBOC__\n#    include <alloc.h>\n#  else /* MSC or DJGPP */\n#    include <malloc.h>\n#  endif\n#endif\n\n#ifdef OS2\n#  define OS_CODE  0x06\n#endif\n\n#ifdef WIN32 /* Window 95 & Windows NT */\n#  define OS_CODE  0x0b\n#endif\n\n#if defined(VAXC) || defined(VMS)\n#  define OS_CODE  0x02\n#  define FOPEN(name, mode) \\\n     fopen((name), (mode), \"mbc=60\", \"ctx=stm\", \"rfm=fix\", \"mrs=512\")\n#endif\n\n#ifdef AMIGA\n#  define OS_CODE  0x01\n#endif\n\n#if defined(ATARI) || defined(atarist)\n#  define OS_CODE  0x05\n#endif\n\n#ifdef MACOS\n#  define OS_CODE  0x07\n#endif\n\n#ifdef __50SERIES /* Prime/PRIMOS */\n#  define OS_CODE  0x0F\n#endif\n\n#ifdef TOPS20\n#  define OS_CODE  0x0a\n#endif\n\n#if defined(_BEOS_) || defined(RISCOS)\n#  define fdopen(fd,mode) NULL /* No fdopen() */\n#endif\n\n        /* Common defaults */\n\n#ifndef OS_CODE\n#  define OS_CODE  0x03  /* assume Unix */\n#endif\n\n#ifndef FOPEN\n#  define FOPEN(name, mode) fopen((name), (mode))\n#endif\n\n         /* functions */\n\n#ifdef HAVE_STRERROR\n   extern char *strerror OF((int));\n#  define zstrerror(errnum) strerror(errnum)\n#else\n#  define zstrerror(errnum) \"\"\n#endif\n\n#if defined(pyr)\n#  define NO_MEMCPY\n#endif\n#if (defined(M_I86SM) || defined(M_I86MM)) && !defined(_MSC_VER)\n /* Use our own functions for small and medium model with MSC <= 5.0.\n  * You may have to use the same strategy for Borland C (untested).\n  */\n#  define NO_MEMCPY\n#endif\n#if defined(STDC) && !defined(HAVE_MEMCPY) && !defined(NO_MEMCPY)\n#  define HAVE_MEMCPY\n#endif\n#ifdef HAVE_MEMCPY\n#  ifdef SMALL_MEDIUM /* MSDOS small or medium model */\n#    define zmemcpy _fmemcpy\n#    define zmemcmp _fmemcmp\n#    define zmemzero(dest, len) _fmemset(dest, 0, len)\n#  else\n#    define zmemcpy memcpy\n#    define zmemcmp memcmp\n#    define zmemzero(dest, len) memset(dest, 0, len)\n#  endif\n#else\n   extern void zmemcpy  OF((Bytef* dest, Bytef* source, uInt len));\n   extern int  zmemcmp  OF((Bytef* s1,   Bytef* s2, uInt len));\n   extern void zmemzero OF((Bytef* dest, uInt len));\n#endif\n\n/* Diagnostic functions */\n#ifdef DEBUG_ZLIB\n#  include <stdio.h>\n#  ifndef verbose\n#    define verbose 0\n#  endif\n   extern void z_error    OF((char *m));\n#  define Assert(cond,msg) {if(!(cond)) z_error(msg);}\n#  define Trace(x) fprintf x\n#  define Tracev(x) {if (verbose) fprintf x ;}\n#  define Tracevv(x) {if (verbose>1) fprintf x ;}\n#  define Tracec(c,x) {if (verbose && (c)) fprintf x ;}\n#  define Tracecv(c,x) {if (verbose>1 && (c)) fprintf x ;}\n#else\n#  define Assert(cond,msg)\n#  define Trace(x)\n#  define Tracev(x)\n#  define Tracevv(x)\n#  define Tracec(c,x)\n#  define Tracecv(c,x)\n#endif\n\n\ntypedef uLong (*check_func) OF((uLong check, const Bytef *buf, uInt len));\n\nvoidpf zcalloc OF((voidpf opaque, unsigned items, unsigned size));\nvoid   zcfree  OF((voidpf opaque, voidpf ptr));\n\n#define ZALLOC(strm, items, size) \\\n           (*((strm)->zalloc))((strm)->opaque, (items), (size))\n#define ZFREE(strm, addr)  (*((strm)->zfree))((strm)->opaque, (voidpf)(addr))\n#define TRY_FREE(s, p) {if (p) ZFREE(s, p);}\n\n#endif /* _Z_UTIL_H */\n"
  },
  {
    "path": "freebsd-headers/net80211/_ieee80211.h",
    "content": "/*-\n * Copyright (c) 2001 Atsushi Onoe\n * Copyright (c) 2002-2008 Sam Leffler, Errno Consulting\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR\n * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES\n * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,\n * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF\n * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/net80211/_ieee80211.h 220935 2011-04-22 00:44:27Z adrian $\n */\n#ifndef _NET80211__IEEE80211_H_\n#define _NET80211__IEEE80211_H_\n\n/*\n * 802.11 implementation definitions.\n *\n * NB: this file is used by applications.\n */\n\n/*\n * PHY type; mostly used to identify FH phys.\n */\nenum ieee80211_phytype {\n\tIEEE80211_T_DS,\t\t\t/* direct sequence spread spectrum */\n\tIEEE80211_T_FH,\t\t\t/* frequency hopping */\n\tIEEE80211_T_OFDM,\t\t/* frequency division multiplexing */\n\tIEEE80211_T_TURBO,\t\t/* high rate OFDM, aka turbo mode */\n\tIEEE80211_T_HT,\t\t\t/* high throughput */\n\tIEEE80211_T_OFDM_HALF,\t\t/* 1/2 rate OFDM */\n\tIEEE80211_T_OFDM_QUARTER,\t/* 1/4 rate OFDM */\n};\n#define\tIEEE80211_T_CCK\tIEEE80211_T_DS\t/* more common nomenclature */\n\n/*\n * PHY mode; this is not really a mode as multi-mode devices\n * have multiple PHY's.  Mode is mostly used as a shorthand\n * for constraining which channels to consider in setting up\n * operation.  Modes used to be used more extensively when\n * channels were identified as IEEE channel numbers.\n */\nenum ieee80211_phymode {\n\tIEEE80211_MODE_AUTO\t= 0,\t/* autoselect */\n\tIEEE80211_MODE_11A\t= 1,\t/* 5GHz, OFDM */\n\tIEEE80211_MODE_11B\t= 2,\t/* 2GHz, CCK */\n\tIEEE80211_MODE_11G\t= 3,\t/* 2GHz, OFDM */\n\tIEEE80211_MODE_FH\t= 4,\t/* 2GHz, GFSK */\n\tIEEE80211_MODE_TURBO_A\t= 5,\t/* 5GHz, OFDM, 2x clock */\n\tIEEE80211_MODE_TURBO_G\t= 6,\t/* 2GHz, OFDM, 2x clock */\n\tIEEE80211_MODE_STURBO_A\t= 7,\t/* 5GHz, OFDM, 2x clock, static */\n\tIEEE80211_MODE_11NA\t= 8,\t/* 5GHz, w/ HT */\n\tIEEE80211_MODE_11NG\t= 9,\t/* 2GHz, w/ HT */\n\tIEEE80211_MODE_HALF\t= 10,\t/* OFDM, 1/2x clock */\n\tIEEE80211_MODE_QUARTER\t= 11,\t/* OFDM, 1/4x clock */\n};\n#define\tIEEE80211_MODE_MAX\t(IEEE80211_MODE_QUARTER+1)\n\n/*\n * Operating mode.  Devices do not necessarily support\n * all modes; they indicate which are supported in their\n * capabilities.\n */\nenum ieee80211_opmode {\n\tIEEE80211_M_IBSS \t= 0,\t/* IBSS (adhoc) station */\n\tIEEE80211_M_STA\t\t= 1,\t/* infrastructure station */\n\tIEEE80211_M_WDS\t\t= 2,\t/* WDS link */\n\tIEEE80211_M_AHDEMO\t= 3,\t/* Old lucent compatible adhoc demo */\n\tIEEE80211_M_HOSTAP\t= 4,\t/* Software Access Point */\n\tIEEE80211_M_MONITOR\t= 5,\t/* Monitor mode */\n\tIEEE80211_M_MBSS\t= 6,\t/* MBSS (Mesh Point) link */\n};\n#define\tIEEE80211_OPMODE_MAX\t(IEEE80211_M_MBSS+1)\n\n/*\n * 802.11g/802.11n protection mode.\n */\nenum ieee80211_protmode {\n\tIEEE80211_PROT_NONE\t= 0,\t/* no protection */\n\tIEEE80211_PROT_CTSONLY\t= 1,\t/* CTS to self */\n\tIEEE80211_PROT_RTSCTS\t= 2,\t/* RTS-CTS */\n};\n\n/*\n * Authentication mode.  The open and shared key authentication\n * modes are implemented within the 802.11 layer.  802.1x and\n * WPA/802.11i are implemented in user mode by setting the\n * 802.11 layer into IEEE80211_AUTH_8021X and deferring\n * authentication to user space programs.\n */\nenum ieee80211_authmode {\n\tIEEE80211_AUTH_NONE\t= 0,\n\tIEEE80211_AUTH_OPEN\t= 1,\t\t/* open */\n\tIEEE80211_AUTH_SHARED\t= 2,\t\t/* shared-key */\n\tIEEE80211_AUTH_8021X\t= 3,\t\t/* 802.1x */\n\tIEEE80211_AUTH_AUTO\t= 4,\t\t/* auto-select/accept */\n\t/* NB: these are used only for ioctls */\n\tIEEE80211_AUTH_WPA\t= 5,\t\t/* WPA/RSN w/ 802.1x/PSK */\n};\n\n/*\n * Roaming mode is effectively who controls the operation\n * of the 802.11 state machine when operating as a station.\n * State transitions are controlled either by the driver\n * (typically when management frames are processed by the\n * hardware/firmware), the host (auto/normal operation of\n * the 802.11 layer), or explicitly through ioctl requests\n * when applications like wpa_supplicant want control.\n */\nenum ieee80211_roamingmode {\n\tIEEE80211_ROAMING_DEVICE= 0,\t/* driver/hardware control */\n\tIEEE80211_ROAMING_AUTO\t= 1,\t/* 802.11 layer control */\n\tIEEE80211_ROAMING_MANUAL= 2,\t/* application control */\n};\n\n/*\n * Channels are specified by frequency and attributes.\n */\nstruct ieee80211_channel {\n\tuint32_t\tic_flags;\t/* see below */\n\tuint16_t\tic_freq;\t/* setting in MHz */\n\tuint8_t\t\tic_ieee;\t/* IEEE channel number */\n\tint8_t\t\tic_maxregpower;\t/* maximum regulatory tx power in dBm */\n\tint8_t\t\tic_maxpower;\t/* maximum tx power in .5 dBm */\n\tint8_t\t\tic_minpower;\t/* minimum tx power in .5 dBm */\n\tuint8_t\t\tic_state;\t/* dynamic state */\n\tuint8_t\t\tic_extieee;\t/* HT40 extension channel number */\n\tint8_t\t\tic_maxantgain;\t/* maximum antenna gain in .5 dBm */\n\tuint8_t\t\tic_pad;\n\tuint16_t\tic_devdata;\t/* opaque device/driver data */\n};\n\n#define\tIEEE80211_CHAN_MAX\t256\n#define\tIEEE80211_CHAN_BYTES\t32\t/* howmany(IEEE80211_CHAN_MAX, NBBY) */\n#define\tIEEE80211_CHAN_ANY\t0xffff\t/* token for ``any channel'' */\n#define\tIEEE80211_CHAN_ANYC \\\n\t((struct ieee80211_channel *) IEEE80211_CHAN_ANY)\n\n/* channel attributes */\n#define\tIEEE80211_CHAN_PRIV0\t0x00000001 /* driver private bit 0 */\n#define\tIEEE80211_CHAN_PRIV1\t0x00000002 /* driver private bit 1 */\n#define\tIEEE80211_CHAN_PRIV2\t0x00000004 /* driver private bit 2 */\n#define\tIEEE80211_CHAN_PRIV3\t0x00000008 /* driver private bit 3 */\n#define\tIEEE80211_CHAN_TURBO\t0x00000010 /* Turbo channel */\n#define\tIEEE80211_CHAN_CCK\t0x00000020 /* CCK channel */\n#define\tIEEE80211_CHAN_OFDM\t0x00000040 /* OFDM channel */\n#define\tIEEE80211_CHAN_2GHZ\t0x00000080 /* 2 GHz spectrum channel. */\n#define\tIEEE80211_CHAN_5GHZ\t0x00000100 /* 5 GHz spectrum channel */\n#define\tIEEE80211_CHAN_PASSIVE\t0x00000200 /* Only passive scan allowed */\n#define\tIEEE80211_CHAN_DYN\t0x00000400 /* Dynamic CCK-OFDM channel */\n#define\tIEEE80211_CHAN_GFSK\t0x00000800 /* GFSK channel (FHSS PHY) */\n#define\tIEEE80211_CHAN_GSM\t0x00001000 /* 900 MHz spectrum channel */\n#define\tIEEE80211_CHAN_STURBO\t0x00002000 /* 11a static turbo channel only */\n#define\tIEEE80211_CHAN_HALF\t0x00004000 /* Half rate channel */\n#define\tIEEE80211_CHAN_QUARTER\t0x00008000 /* Quarter rate channel */\n#define\tIEEE80211_CHAN_HT20\t0x00010000 /* HT 20 channel */\n#define\tIEEE80211_CHAN_HT40U\t0x00020000 /* HT 40 channel w/ ext above */\n#define\tIEEE80211_CHAN_HT40D\t0x00040000 /* HT 40 channel w/ ext below */\n#define\tIEEE80211_CHAN_DFS\t0x00080000 /* DFS required */\n#define\tIEEE80211_CHAN_4MSXMIT\t0x00100000 /* 4ms limit on frame length */\n#define\tIEEE80211_CHAN_NOADHOC\t0x00200000 /* adhoc mode not allowed */\n#define\tIEEE80211_CHAN_NOHOSTAP\t0x00400000 /* hostap mode not allowed */\n#define\tIEEE80211_CHAN_11D\t0x00800000 /* 802.11d required */\n\n#define\tIEEE80211_CHAN_HT40\t(IEEE80211_CHAN_HT40U | IEEE80211_CHAN_HT40D)\n#define\tIEEE80211_CHAN_HT\t(IEEE80211_CHAN_HT20 | IEEE80211_CHAN_HT40)\n\n#define\tIEEE80211_CHAN_BITS \\\n\t\"\\20\\1PRIV0\\2PRIV2\\3PRIV3\\4PRIV4\\5TURBO\\6CCK\\7OFDM\\0102GHZ\\0115GHZ\" \\\n\t\"\\12PASSIVE\\13DYN\\14GFSK\\15GSM\\16STURBO\\17HALF\\20QUARTER\\21HT20\" \\\n\t\"\\22HT40U\\23HT40D\\24DFS\\0254MSXMIT\\26NOADHOC\\27NOHOSTAP\\03011D\"\n\n/*\n * Useful combinations of channel characteristics.\n */\n#define\tIEEE80211_CHAN_FHSS \\\n\t(IEEE80211_CHAN_2GHZ | IEEE80211_CHAN_GFSK)\n#define\tIEEE80211_CHAN_A \\\n\t(IEEE80211_CHAN_5GHZ | IEEE80211_CHAN_OFDM)\n#define\tIEEE80211_CHAN_B \\\n\t(IEEE80211_CHAN_2GHZ | IEEE80211_CHAN_CCK)\n#define\tIEEE80211_CHAN_PUREG \\\n\t(IEEE80211_CHAN_2GHZ | IEEE80211_CHAN_OFDM)\n#define\tIEEE80211_CHAN_G \\\n\t(IEEE80211_CHAN_2GHZ | IEEE80211_CHAN_DYN)\n#define IEEE80211_CHAN_108A \\\n\t(IEEE80211_CHAN_A | IEEE80211_CHAN_TURBO)\n#define\tIEEE80211_CHAN_108G \\\n\t(IEEE80211_CHAN_PUREG | IEEE80211_CHAN_TURBO)\n#define\tIEEE80211_CHAN_ST \\\n\t(IEEE80211_CHAN_108A | IEEE80211_CHAN_STURBO)\n\n#define\tIEEE80211_CHAN_ALL \\\n\t(IEEE80211_CHAN_2GHZ | IEEE80211_CHAN_5GHZ | IEEE80211_CHAN_GFSK | \\\n\t IEEE80211_CHAN_CCK | IEEE80211_CHAN_OFDM | IEEE80211_CHAN_DYN | \\\n\t IEEE80211_CHAN_HALF | IEEE80211_CHAN_QUARTER | \\\n\t IEEE80211_CHAN_HT)\n#define\tIEEE80211_CHAN_ALLTURBO \\\n\t(IEEE80211_CHAN_ALL | IEEE80211_CHAN_TURBO | IEEE80211_CHAN_STURBO)\n\n#define\tIEEE80211_IS_CHAN_FHSS(_c) \\\n\t(((_c)->ic_flags & IEEE80211_CHAN_FHSS) == IEEE80211_CHAN_FHSS)\n#define\tIEEE80211_IS_CHAN_A(_c) \\\n\t(((_c)->ic_flags & IEEE80211_CHAN_A) == IEEE80211_CHAN_A)\n#define\tIEEE80211_IS_CHAN_B(_c) \\\n\t(((_c)->ic_flags & IEEE80211_CHAN_B) == IEEE80211_CHAN_B)\n#define\tIEEE80211_IS_CHAN_PUREG(_c) \\\n\t(((_c)->ic_flags & IEEE80211_CHAN_PUREG) == IEEE80211_CHAN_PUREG)\n#define\tIEEE80211_IS_CHAN_G(_c) \\\n\t(((_c)->ic_flags & IEEE80211_CHAN_G) == IEEE80211_CHAN_G)\n#define\tIEEE80211_IS_CHAN_ANYG(_c) \\\n\t(IEEE80211_IS_CHAN_PUREG(_c) || IEEE80211_IS_CHAN_G(_c))\n#define\tIEEE80211_IS_CHAN_ST(_c) \\\n\t(((_c)->ic_flags & IEEE80211_CHAN_ST) == IEEE80211_CHAN_ST)\n#define\tIEEE80211_IS_CHAN_108A(_c) \\\n\t(((_c)->ic_flags & IEEE80211_CHAN_108A) == IEEE80211_CHAN_108A)\n#define\tIEEE80211_IS_CHAN_108G(_c) \\\n\t(((_c)->ic_flags & IEEE80211_CHAN_108G) == IEEE80211_CHAN_108G)\n\n#define\tIEEE80211_IS_CHAN_2GHZ(_c) \\\n\t(((_c)->ic_flags & IEEE80211_CHAN_2GHZ) != 0)\n#define\tIEEE80211_IS_CHAN_5GHZ(_c) \\\n\t(((_c)->ic_flags & IEEE80211_CHAN_5GHZ) != 0)\n#define\tIEEE80211_IS_CHAN_PASSIVE(_c) \\\n\t(((_c)->ic_flags & IEEE80211_CHAN_PASSIVE) != 0)\n#define\tIEEE80211_IS_CHAN_OFDM(_c) \\\n\t(((_c)->ic_flags & (IEEE80211_CHAN_OFDM | IEEE80211_CHAN_DYN)) != 0)\n#define\tIEEE80211_IS_CHAN_CCK(_c) \\\n\t(((_c)->ic_flags & (IEEE80211_CHAN_CCK | IEEE80211_CHAN_DYN)) != 0)\n#define\tIEEE80211_IS_CHAN_GFSK(_c) \\\n\t(((_c)->ic_flags & IEEE80211_CHAN_GFSK) != 0)\n#define\tIEEE80211_IS_CHAN_TURBO(_c) \\\n\t(((_c)->ic_flags & IEEE80211_CHAN_TURBO) != 0)\n#define\tIEEE80211_IS_CHAN_STURBO(_c) \\\n\t(((_c)->ic_flags & IEEE80211_CHAN_STURBO) != 0)\n#define\tIEEE80211_IS_CHAN_DTURBO(_c) \\\n\t(((_c)->ic_flags & \\\n\t(IEEE80211_CHAN_TURBO | IEEE80211_CHAN_STURBO)) == IEEE80211_CHAN_TURBO)\n#define\tIEEE80211_IS_CHAN_HALF(_c) \\\n\t(((_c)->ic_flags & IEEE80211_CHAN_HALF) != 0)\n#define\tIEEE80211_IS_CHAN_QUARTER(_c) \\\n\t(((_c)->ic_flags & IEEE80211_CHAN_QUARTER) != 0)\n#define\tIEEE80211_IS_CHAN_FULL(_c) \\\n\t(((_c)->ic_flags & (IEEE80211_CHAN_QUARTER | IEEE80211_CHAN_HALF)) == 0)\n#define\tIEEE80211_IS_CHAN_GSM(_c) \\\n\t(((_c)->ic_flags & IEEE80211_CHAN_GSM) != 0)\n#define\tIEEE80211_IS_CHAN_HT(_c) \\\n\t(((_c)->ic_flags & IEEE80211_CHAN_HT) != 0)\n#define\tIEEE80211_IS_CHAN_HT20(_c) \\\n\t(((_c)->ic_flags & IEEE80211_CHAN_HT20) != 0)\n#define\tIEEE80211_IS_CHAN_HT40(_c) \\\n\t(((_c)->ic_flags & IEEE80211_CHAN_HT40) != 0)\n#define\tIEEE80211_IS_CHAN_HT40U(_c) \\\n\t(((_c)->ic_flags & IEEE80211_CHAN_HT40U) != 0)\n#define\tIEEE80211_IS_CHAN_HT40D(_c) \\\n\t(((_c)->ic_flags & IEEE80211_CHAN_HT40D) != 0)\n#define\tIEEE80211_IS_CHAN_HTA(_c) \\\n\t(IEEE80211_IS_CHAN_5GHZ(_c) && \\\n\t ((_c)->ic_flags & IEEE80211_CHAN_HT) != 0)\n#define\tIEEE80211_IS_CHAN_HTG(_c) \\\n\t(IEEE80211_IS_CHAN_2GHZ(_c) && \\\n\t ((_c)->ic_flags & IEEE80211_CHAN_HT) != 0)\n#define\tIEEE80211_IS_CHAN_DFS(_c) \\\n\t(((_c)->ic_flags & IEEE80211_CHAN_DFS) != 0)\n#define\tIEEE80211_IS_CHAN_NOADHOC(_c) \\\n\t(((_c)->ic_flags & IEEE80211_CHAN_NOADHOC) != 0)\n#define\tIEEE80211_IS_CHAN_NOHOSTAP(_c) \\\n\t(((_c)->ic_flags & IEEE80211_CHAN_NOHOSTAP) != 0)\n#define\tIEEE80211_IS_CHAN_11D(_c) \\\n\t(((_c)->ic_flags & IEEE80211_CHAN_11D) != 0)\n\n#define\tIEEE80211_CHAN2IEEE(_c)\t\t(_c)->ic_ieee\n\n/* dynamic state */\n#define\tIEEE80211_CHANSTATE_RADAR\t0x01\t/* radar detected */\n#define\tIEEE80211_CHANSTATE_CACDONE\t0x02\t/* CAC completed */\n#define\tIEEE80211_CHANSTATE_CWINT\t0x04\t/* interference detected */\n#define\tIEEE80211_CHANSTATE_NORADAR\t0x10\t/* post notify on radar clear */\n\n#define\tIEEE80211_IS_CHAN_RADAR(_c) \\\n\t(((_c)->ic_state & IEEE80211_CHANSTATE_RADAR) != 0)\n#define\tIEEE80211_IS_CHAN_CACDONE(_c) \\\n\t(((_c)->ic_state & IEEE80211_CHANSTATE_CACDONE) != 0)\n#define\tIEEE80211_IS_CHAN_CWINT(_c) \\\n\t(((_c)->ic_state & IEEE80211_CHANSTATE_CWINT) != 0)\n\n/* ni_chan encoding for FH phy */\n#define\tIEEE80211_FH_CHANMOD\t80\n#define\tIEEE80211_FH_CHAN(set,pat)\t(((set)-1)*IEEE80211_FH_CHANMOD+(pat))\n#define\tIEEE80211_FH_CHANSET(chan)\t((chan)/IEEE80211_FH_CHANMOD+1)\n#define\tIEEE80211_FH_CHANPAT(chan)\t((chan)%IEEE80211_FH_CHANMOD)\n\n#define\tIEEE80211_TID_SIZE\t(WME_NUM_TID+1)\t/* WME TID's +1 for non-QoS */\n#define\tIEEE80211_NONQOS_TID\tWME_NUM_TID\t/* index for non-QoS sta */\n\n/*\n * The 802.11 spec says at most 2007 stations may be\n * associated at once.  For most AP's this is way more\n * than is feasible so we use a default of 128.  This\n * number may be overridden by the driver and/or by\n * user configuration but may not be less than IEEE80211_AID_MIN.\n */\n#define\tIEEE80211_AID_DEF\t\t128\n#define\tIEEE80211_AID_MIN\t\t16\n\n/*\n * 802.11 rate set.\n */\n#define\tIEEE80211_RATE_SIZE\t8\t\t/* 802.11 standard */\n#define\tIEEE80211_RATE_MAXSIZE\t15\t\t/* max rates we'll handle */\n\nstruct ieee80211_rateset {\n\tuint8_t\t\trs_nrates;\n\tuint8_t\t\trs_rates[IEEE80211_RATE_MAXSIZE];\n};\n\n/*\n * 802.11n variant of ieee80211_rateset.  Instead of\n * legacy rates the entries are MCS rates.  We define\n * the structure such that it can be used interchangeably\n * with an ieee80211_rateset (modulo structure size).\n */\n#define\tIEEE80211_HTRATE_MAXSIZE\t77\n\nstruct ieee80211_htrateset {\n\tuint8_t\t\trs_nrates;\n\tuint8_t\t\trs_rates[IEEE80211_HTRATE_MAXSIZE];\n};\n\n#define\tIEEE80211_RATE_MCS\t0x80\n\n/*\n * Per-mode transmit parameters/controls visible to user space.\n * These can be used to set fixed transmit rate for all operating\n * modes or on a per-client basis according to the capabilities\n * of the client (e.g. an 11b client associated to an 11g ap).\n *\n * MCS are distinguished from legacy rates by or'ing in 0x80.\n */\nstruct ieee80211_txparam {\n\tuint8_t\t\tucastrate;\t/* ucast data rate (legacy/MCS|0x80) */\n\tuint8_t\t\tmgmtrate;\t/* mgmt frame rate (legacy/MCS|0x80) */\n\tuint8_t\t\tmcastrate;\t/* multicast rate (legacy/MCS|0x80) */\n\tuint8_t\t\tmaxretry;\t/* max unicast data retry count */\n};\n\n/*\n * Per-mode roaming state visible to user space.  There are two\n * thresholds that control whether roaming is considered; when\n * either is exceeded the 802.11 layer will check the scan cache\n * for another AP.  If the cache is stale then a scan may be\n * triggered.\n */\nstruct ieee80211_roamparam {\n\tint8_t\t\trssi;\t\t/* rssi thresh (.5 dBm) */\n\tuint8_t\t\trate;\t\t/* tx rate thresh (.5 Mb/s or MCS) */\n\tuint16_t\tpad;\t\t/* reserve */\n};\n\n/*\n * Regulatory Information.\n */\nstruct ieee80211_regdomain {\n\tuint16_t\tregdomain;\t/* SKU */\n\tuint16_t\tcountry;\t/* ISO country code */\n\tuint8_t\t\tlocation;\t/* I (indoor), O (outdoor), other */\n\tuint8_t\t\tecm;\t\t/* Extended Channel Mode */\n\tchar\t\tisocc[2];\t/* country code string */\n\tshort\t\tpad[2];\n};\n\n/*\n * MIMO antenna/radio state.\n */\n\n#define\tIEEE80211_MAX_CHAINS\t\t3\n#define\tIEEE80211_MAX_EVM_PILOTS\t6\n\n/*\n * XXX This doesn't yet export both ctl/ext chain details\n */\nstruct ieee80211_mimo_info {\n\tint8_t\t\trssi[IEEE80211_MAX_CHAINS];\t/* per-antenna rssi */\n\tint8_t\t\tnoise[IEEE80211_MAX_CHAINS];\t/* per-antenna noise floor */\n\tuint8_t\t\tpad[2];\n\tuint32_t\tevm[3];\t\t/* EVM data */\n};\n#endif /* _NET80211__IEEE80211_H_ */\n"
  },
  {
    "path": "freebsd-headers/net80211/ieee80211.h",
    "content": "/*-\n * Copyright (c) 2001 Atsushi Onoe\n * Copyright (c) 2002-2009 Sam Leffler, Errno Consulting\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR\n * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES\n * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,\n * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF\n * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/net80211/ieee80211.h 218927 2011-02-21 19:59:43Z bschmidt $\n */\n#ifndef _NET80211_IEEE80211_H_\n#define _NET80211_IEEE80211_H_\n\n/*\n * 802.11 protocol definitions.\n */\n\n#define\tIEEE80211_ADDR_LEN\t6\t\t/* size of 802.11 address */\n/* is 802.11 address multicast/broadcast? */\n#define\tIEEE80211_IS_MULTICAST(_a)\t(*(_a) & 0x01)\n\ntypedef uint16_t ieee80211_seq;\n\n/* IEEE 802.11 PLCP header */\nstruct ieee80211_plcp_hdr {\n\tuint16_t\ti_sfd;\n\tuint8_t\t\ti_signal;\n\tuint8_t\t\ti_service;\n\tuint16_t\ti_length;\n\tuint16_t\ti_crc;\n} __packed;\n\n#define IEEE80211_PLCP_SFD      0xF3A0 \n#define IEEE80211_PLCP_SERVICE  0x00\n#define IEEE80211_PLCP_SERVICE_LOCKED\t0x04\n#define IEEE80211_PLCL_SERVICE_PBCC\t0x08\n#define IEEE80211_PLCP_SERVICE_LENEXT5\t0x20\n#define IEEE80211_PLCP_SERVICE_LENEXT6\t0x40\n#define IEEE80211_PLCP_SERVICE_LENEXT7\t0x80\n\n/*\n * generic definitions for IEEE 802.11 frames\n */\nstruct ieee80211_frame {\n\tuint8_t\t\ti_fc[2];\n\tuint8_t\t\ti_dur[2];\n\tuint8_t\t\ti_addr1[IEEE80211_ADDR_LEN];\n\tuint8_t\t\ti_addr2[IEEE80211_ADDR_LEN];\n\tuint8_t\t\ti_addr3[IEEE80211_ADDR_LEN];\n\tuint8_t\t\ti_seq[2];\n\t/* possibly followed by addr4[IEEE80211_ADDR_LEN]; */\n\t/* see below */\n} __packed;\n\nstruct ieee80211_qosframe {\n\tuint8_t\t\ti_fc[2];\n\tuint8_t\t\ti_dur[2];\n\tuint8_t\t\ti_addr1[IEEE80211_ADDR_LEN];\n\tuint8_t\t\ti_addr2[IEEE80211_ADDR_LEN];\n\tuint8_t\t\ti_addr3[IEEE80211_ADDR_LEN];\n\tuint8_t\t\ti_seq[2];\n\tuint8_t\t\ti_qos[2];\n\t/* possibly followed by addr4[IEEE80211_ADDR_LEN]; */\n\t/* see below */\n} __packed;\n\nstruct ieee80211_qoscntl {\n\tuint8_t\t\ti_qos[2];\n};\n\nstruct ieee80211_frame_addr4 {\n\tuint8_t\t\ti_fc[2];\n\tuint8_t\t\ti_dur[2];\n\tuint8_t\t\ti_addr1[IEEE80211_ADDR_LEN];\n\tuint8_t\t\ti_addr2[IEEE80211_ADDR_LEN];\n\tuint8_t\t\ti_addr3[IEEE80211_ADDR_LEN];\n\tuint8_t\t\ti_seq[2];\n\tuint8_t\t\ti_addr4[IEEE80211_ADDR_LEN];\n} __packed;\n\n\nstruct ieee80211_qosframe_addr4 {\n\tuint8_t\t\ti_fc[2];\n\tuint8_t\t\ti_dur[2];\n\tuint8_t\t\ti_addr1[IEEE80211_ADDR_LEN];\n\tuint8_t\t\ti_addr2[IEEE80211_ADDR_LEN];\n\tuint8_t\t\ti_addr3[IEEE80211_ADDR_LEN];\n\tuint8_t\t\ti_seq[2];\n\tuint8_t\t\ti_addr4[IEEE80211_ADDR_LEN];\n\tuint8_t\t\ti_qos[2];\n} __packed;\n\n#define\tIEEE80211_FC0_VERSION_MASK\t\t0x03\n#define\tIEEE80211_FC0_VERSION_SHIFT\t\t0\n#define\tIEEE80211_FC0_VERSION_0\t\t\t0x00\n#define\tIEEE80211_FC0_TYPE_MASK\t\t\t0x0c\n#define\tIEEE80211_FC0_TYPE_SHIFT\t\t2\n#define\tIEEE80211_FC0_TYPE_MGT\t\t\t0x00\n#define\tIEEE80211_FC0_TYPE_CTL\t\t\t0x04\n#define\tIEEE80211_FC0_TYPE_DATA\t\t\t0x08\n\n#define\tIEEE80211_FC0_SUBTYPE_MASK\t\t0xf0\n#define\tIEEE80211_FC0_SUBTYPE_SHIFT\t\t4\n/* for TYPE_MGT */\n#define\tIEEE80211_FC0_SUBTYPE_ASSOC_REQ\t\t0x00\n#define\tIEEE80211_FC0_SUBTYPE_ASSOC_RESP\t0x10\n#define\tIEEE80211_FC0_SUBTYPE_REASSOC_REQ\t0x20\n#define\tIEEE80211_FC0_SUBTYPE_REASSOC_RESP\t0x30\n#define\tIEEE80211_FC0_SUBTYPE_PROBE_REQ\t\t0x40\n#define\tIEEE80211_FC0_SUBTYPE_PROBE_RESP\t0x50\n#define\tIEEE80211_FC0_SUBTYPE_BEACON\t\t0x80\n#define\tIEEE80211_FC0_SUBTYPE_ATIM\t\t0x90\n#define\tIEEE80211_FC0_SUBTYPE_DISASSOC\t\t0xa0\n#define\tIEEE80211_FC0_SUBTYPE_AUTH\t\t0xb0\n#define\tIEEE80211_FC0_SUBTYPE_DEAUTH\t\t0xc0\n#define\tIEEE80211_FC0_SUBTYPE_ACTION\t\t0xd0\n#define\tIEEE80211_FC0_SUBTYPE_ACTION_NOACK\t0xe0\n/* for TYPE_CTL */\n#define\tIEEE80211_FC0_SUBTYPE_BAR\t\t0x80\n#define\tIEEE80211_FC0_SUBTYPE_BA\t\t0x90\n#define\tIEEE80211_FC0_SUBTYPE_PS_POLL\t\t0xa0\n#define\tIEEE80211_FC0_SUBTYPE_RTS\t\t0xb0\n#define\tIEEE80211_FC0_SUBTYPE_CTS\t\t0xc0\n#define\tIEEE80211_FC0_SUBTYPE_ACK\t\t0xd0\n#define\tIEEE80211_FC0_SUBTYPE_CF_END\t\t0xe0\n#define\tIEEE80211_FC0_SUBTYPE_CF_END_ACK\t0xf0\n/* for TYPE_DATA (bit combination) */\n#define\tIEEE80211_FC0_SUBTYPE_DATA\t\t0x00\n#define\tIEEE80211_FC0_SUBTYPE_CF_ACK\t\t0x10\n#define\tIEEE80211_FC0_SUBTYPE_CF_POLL\t\t0x20\n#define\tIEEE80211_FC0_SUBTYPE_CF_ACPL\t\t0x30\n#define\tIEEE80211_FC0_SUBTYPE_NODATA\t\t0x40\n#define\tIEEE80211_FC0_SUBTYPE_CFACK\t\t0x50\n#define\tIEEE80211_FC0_SUBTYPE_CFPOLL\t\t0x60\n#define\tIEEE80211_FC0_SUBTYPE_CF_ACK_CF_ACK\t0x70\n#define\tIEEE80211_FC0_SUBTYPE_QOS\t\t0x80\n#define\tIEEE80211_FC0_SUBTYPE_QOS_NULL\t\t0xc0\n\n#define\tIEEE80211_FC1_DIR_MASK\t\t\t0x03\n#define\tIEEE80211_FC1_DIR_NODS\t\t\t0x00\t/* STA->STA */\n#define\tIEEE80211_FC1_DIR_TODS\t\t\t0x01\t/* STA->AP  */\n#define\tIEEE80211_FC1_DIR_FROMDS\t\t0x02\t/* AP ->STA */\n#define\tIEEE80211_FC1_DIR_DSTODS\t\t0x03\t/* AP ->AP  */\n\n#define\tIEEE80211_IS_DSTODS(wh) \\\n\t(((wh)->i_fc[1] & IEEE80211_FC1_DIR_MASK) == IEEE80211_FC1_DIR_DSTODS)\n\n#define\tIEEE80211_FC1_MORE_FRAG\t\t\t0x04\n#define\tIEEE80211_FC1_RETRY\t\t\t0x08\n#define\tIEEE80211_FC1_PWR_MGT\t\t\t0x10\n#define\tIEEE80211_FC1_MORE_DATA\t\t\t0x20\n#define\tIEEE80211_FC1_WEP\t\t\t0x40\n#define\tIEEE80211_FC1_ORDER\t\t\t0x80\n\n#define\tIEEE80211_SEQ_FRAG_MASK\t\t\t0x000f\n#define\tIEEE80211_SEQ_FRAG_SHIFT\t\t0\n#define\tIEEE80211_SEQ_SEQ_MASK\t\t\t0xfff0\n#define\tIEEE80211_SEQ_SEQ_SHIFT\t\t\t4\n#define\tIEEE80211_SEQ_RANGE\t\t\t4096\n\n#define\tIEEE80211_SEQ_ADD(seq, incr) \\\n\t(((seq) + (incr)) & (IEEE80211_SEQ_RANGE-1))\n#define\tIEEE80211_SEQ_INC(seq)\tIEEE80211_SEQ_ADD(seq,1)\n#define\tIEEE80211_SEQ_SUB(a, b) \\\n\t(((a) + IEEE80211_SEQ_RANGE - (b)) & (IEEE80211_SEQ_RANGE-1))\n\n#define\tIEEE80211_SEQ_BA_RANGE\t\t\t2048\t/* 2^11 */\n#define\tIEEE80211_SEQ_BA_BEFORE(a, b) \\\n\t(IEEE80211_SEQ_SUB(b, a+1) < IEEE80211_SEQ_BA_RANGE-1)\n\n#define\tIEEE80211_NWID_LEN\t\t\t32\n#define\tIEEE80211_MESHID_LEN\t\t\t32\n\n#define\tIEEE80211_QOS_TXOP\t\t\t0x00ff\n/* bit 8 is reserved */\n#define\tIEEE80211_QOS_AMSDU\t\t\t0x80\n#define\tIEEE80211_QOS_AMSDU_S\t\t\t7\n#define\tIEEE80211_QOS_ACKPOLICY\t\t\t0x60\n#define\tIEEE80211_QOS_ACKPOLICY_S\t\t5\n#define\tIEEE80211_QOS_ACKPOLICY_NOACK\t\t0x20\t/* No ACK required */\n#define\tIEEE80211_QOS_ACKPOLICY_BA\t\t0x60\t/* Block ACK */\n#define\tIEEE80211_QOS_EOSP\t\t\t0x10\t/* EndOfService Period*/\n#define\tIEEE80211_QOS_EOSP_S\t\t\t4\n#define\tIEEE80211_QOS_TID\t\t\t0x0f\n\n/* does frame have QoS sequence control data */\n#define\tIEEE80211_QOS_HAS_SEQ(wh) \\\n\t(((wh)->i_fc[0] & \\\n\t  (IEEE80211_FC0_TYPE_MASK | IEEE80211_FC0_SUBTYPE_QOS)) == \\\n\t  (IEEE80211_FC0_TYPE_DATA | IEEE80211_FC0_SUBTYPE_QOS))\n\n/*\n * WME/802.11e information element.\n */\nstruct ieee80211_wme_info {\n\tuint8_t\t\twme_id;\t\t/* IEEE80211_ELEMID_VENDOR */\n\tuint8_t\t\twme_len;\t/* length in bytes */\n\tuint8_t\t\twme_oui[3];\t/* 0x00, 0x50, 0xf2 */\n\tuint8_t\t\twme_type;\t/* OUI type */\n\tuint8_t\t\twme_subtype;\t/* OUI subtype */\n\tuint8_t\t\twme_version;\t/* spec revision */\n\tuint8_t\t\twme_info;\t/* QoS info */\n} __packed;\n\n/*\n * WME/802.11e Tspec Element\n */\nstruct ieee80211_wme_tspec {\n\tuint8_t\t\tts_id;\n\tuint8_t\t\tts_len;\n\tuint8_t\t\tts_oui[3];\n\tuint8_t\t\tts_oui_type;\n\tuint8_t\t\tts_oui_subtype;\n\tuint8_t\t\tts_version;\n\tuint8_t\t\tts_tsinfo[3];\n\tuint8_t\t\tts_nom_msdu[2];\n\tuint8_t\t\tts_max_msdu[2];\n\tuint8_t\t\tts_min_svc[4];\n\tuint8_t\t\tts_max_svc[4];\n\tuint8_t\t\tts_inactv_intv[4];\n\tuint8_t\t\tts_susp_intv[4];\n\tuint8_t\t\tts_start_svc[4];\n\tuint8_t\t\tts_min_rate[4];\n\tuint8_t\t\tts_mean_rate[4];\n\tuint8_t\t\tts_max_burst[4];\n\tuint8_t\t\tts_min_phy[4];\n\tuint8_t\t\tts_peak_rate[4];\n\tuint8_t\t\tts_delay[4];\n\tuint8_t\t\tts_surplus[2];\n\tuint8_t\t\tts_medium_time[2];\n} __packed;\n\n/*\n * WME AC parameter field\n */\nstruct ieee80211_wme_acparams {\n\tuint8_t\t\tacp_aci_aifsn;\n\tuint8_t\t\tacp_logcwminmax;\n\tuint16_t\tacp_txop;\n} __packed;\n\n#define WME_NUM_AC\t\t4\t/* 4 AC categories */\n#define\tWME_NUM_TID\t\t16\t/* 16 tids */\n\n#define WME_PARAM_ACI\t\t0x60\t/* Mask for ACI field */\n#define WME_PARAM_ACI_S\t\t5\t/* Shift for ACI field */\n#define WME_PARAM_ACM\t\t0x10\t/* Mask for ACM bit */\n#define WME_PARAM_ACM_S\t\t4\t/* Shift for ACM bit */\n#define WME_PARAM_AIFSN\t\t0x0f\t/* Mask for aifsn field */\n#define WME_PARAM_AIFSN_S\t0\t/* Shift for aifsn field */\n#define WME_PARAM_LOGCWMIN\t0x0f\t/* Mask for CwMin field (in log) */\n#define WME_PARAM_LOGCWMIN_S\t0\t/* Shift for CwMin field */\n#define WME_PARAM_LOGCWMAX\t0xf0\t/* Mask for CwMax field (in log) */\n#define WME_PARAM_LOGCWMAX_S\t4\t/* Shift for CwMax field */\n\n#define WME_AC_TO_TID(_ac) (       \\\n\t((_ac) == WME_AC_VO) ? 6 : \\\n\t((_ac) == WME_AC_VI) ? 5 : \\\n\t((_ac) == WME_AC_BK) ? 1 : \\\n\t0)\n\n#define TID_TO_WME_AC(_tid) (      \\\n\t((_tid) == 0 || (_tid) == 3) ? WME_AC_BE : \\\n\t((_tid) < 3) ? WME_AC_BK : \\\n\t((_tid) < 6) ? WME_AC_VI : \\\n\tWME_AC_VO)\n\n/*\n * WME Parameter Element\n */\nstruct ieee80211_wme_param {\n\tuint8_t\t\tparam_id;\n\tuint8_t\t\tparam_len;\n\tuint8_t\t\tparam_oui[3];\n\tuint8_t\t\tparam_oui_type;\n\tuint8_t\t\tparam_oui_subtype;\n\tuint8_t\t\tparam_version;\n\tuint8_t\t\tparam_qosInfo;\n#define\tWME_QOSINFO_COUNT\t0x0f\t/* Mask for param count field */\n\tuint8_t\t\tparam_reserved;\n\tstruct ieee80211_wme_acparams\tparams_acParams[WME_NUM_AC];\n} __packed;\n\n/*\n * Management Notification Frame\n */\nstruct ieee80211_mnf {\n\tuint8_t\t\tmnf_category;\n\tuint8_t\t\tmnf_action;\n\tuint8_t\t\tmnf_dialog;\n\tuint8_t\t\tmnf_status;\n} __packed;\n#define\tMNF_SETUP_REQ\t0\n#define\tMNF_SETUP_RESP\t1\n#define\tMNF_TEARDOWN\t2\n\n/* \n * 802.11n Management Action Frames \n */\n/* generic frame format */\nstruct ieee80211_action {\n\tuint8_t\t\tia_category;\n\tuint8_t\t\tia_action;\n} __packed;\n\n#define\tIEEE80211_ACTION_CAT_SM\t\t0\t/* Spectrum Management */\n#define\tIEEE80211_ACTION_CAT_QOS\t1\t/* QoS */\n#define\tIEEE80211_ACTION_CAT_DLS\t2\t/* DLS */\n#define\tIEEE80211_ACTION_CAT_BA\t\t3\t/* BA */\n#define\tIEEE80211_ACTION_CAT_HT\t\t7\t/* HT */\n#define\tIEEE80211_ACTION_CAT_VENDOR\t127\t/* Vendor Specific */\n\n#define\tIEEE80211_ACTION_HT_TXCHWIDTH\t0\t/* recommended xmit chan width*/\n#define\tIEEE80211_ACTION_HT_MIMOPWRSAVE\t1\t/* MIMO power save */\n\n/* HT - recommended transmission channel width */\nstruct ieee80211_action_ht_txchwidth {\n\tstruct ieee80211_action\tat_header;\n\tuint8_t\t\tat_chwidth;\t\n} __packed;\n\n#define\tIEEE80211_A_HT_TXCHWIDTH_20\t0\n#define\tIEEE80211_A_HT_TXCHWIDTH_2040\t1\n\n/* HT - MIMO Power Save (NB: D2.04) */\nstruct ieee80211_action_ht_mimopowersave {\n\tstruct ieee80211_action am_header;\n\tuint8_t\t\tam_control;\n} __packed;\n\n#define\tIEEE80211_A_HT_MIMOPWRSAVE_ENA\t\t0x01\t/* PS enabled */\n#define\tIEEE80211_A_HT_MIMOPWRSAVE_MODE\t\t0x02\n#define\tIEEE80211_A_HT_MIMOPWRSAVE_MODE_S\t1\n#define\tIEEE80211_A_HT_MIMOPWRSAVE_DYNAMIC\t0x02\t/* Dynamic Mode */\n#define\tIEEE80211_A_HT_MIMOPWRSAVE_STATIC\t0x00\t/* no SM packets */\n/* bits 2-7 reserved */\n\n/* Block Ack actions */\n#define IEEE80211_ACTION_BA_ADDBA_REQUEST       0   /* ADDBA request */\n#define IEEE80211_ACTION_BA_ADDBA_RESPONSE      1   /* ADDBA response */\n#define IEEE80211_ACTION_BA_DELBA\t        2   /* DELBA */\n\n/* Block Ack Parameter Set */\n#define\tIEEE80211_BAPS_BUFSIZ\t0xffc0\t\t/* buffer size */\n#define\tIEEE80211_BAPS_BUFSIZ_S\t6\n#define\tIEEE80211_BAPS_TID\t0x003c\t\t/* TID */\n#define\tIEEE80211_BAPS_TID_S\t2\n#define\tIEEE80211_BAPS_POLICY\t0x0002\t\t/* block ack policy */\n#define\tIEEE80211_BAPS_POLICY_S\t1\n\n#define\tIEEE80211_BAPS_POLICY_DELAYED\t(0<<IEEE80211_BAPS_POLICY_S)\n#define\tIEEE80211_BAPS_POLICY_IMMEDIATE\t(1<<IEEE80211_BAPS_POLICY_S)\n\n/* Block Ack Sequence Control */\n#define\tIEEE80211_BASEQ_START\t0xfff0\t\t/* starting seqnum */\n#define\tIEEE80211_BASEQ_START_S\t4\n#define\tIEEE80211_BASEQ_FRAG\t0x000f\t\t/* fragment number */\n#define\tIEEE80211_BASEQ_FRAG_S\t0\n\n/* Delayed Block Ack Parameter Set */\n#define\tIEEE80211_DELBAPS_TID\t0xf000\t\t/* TID */\n#define\tIEEE80211_DELBAPS_TID_S\t12\n#define\tIEEE80211_DELBAPS_INIT\t0x0800\t\t/* initiator */\n#define\tIEEE80211_DELBAPS_INIT_S 11\n\n/* BA - ADDBA request */\nstruct ieee80211_action_ba_addbarequest {\n\tstruct ieee80211_action rq_header;\n\tuint8_t\t\trq_dialogtoken;\n\tuint16_t\trq_baparamset;\n\tuint16_t\trq_batimeout;\t\t/* in TUs */\n\tuint16_t\trq_baseqctl;\n} __packed;\n\n/* BA - ADDBA response */\nstruct ieee80211_action_ba_addbaresponse {\n\tstruct ieee80211_action rs_header;\n\tuint8_t\t\trs_dialogtoken;\n\tuint16_t\trs_statuscode;\n\tuint16_t\trs_baparamset; \n\tuint16_t\trs_batimeout;\t\t/* in TUs */\n} __packed;\n\n/* BA - DELBA */\nstruct ieee80211_action_ba_delba {\n\tstruct ieee80211_action dl_header;\n\tuint16_t\tdl_baparamset;\n\tuint16_t\tdl_reasoncode;\n} __packed;\n\n/* BAR Control */\n#define\tIEEE80211_BAR_TID\t0xf000\t\t/* TID */\n#define\tIEEE80211_BAR_TID_S\t12\n#define\tIEEE80211_BAR_COMP\t0x0004\t\t/* Compressed Bitmap */\n#define\tIEEE80211_BAR_MTID\t0x0002\t\t/* Multi-TID */\n#define\tIEEE80211_BAR_NOACK\t0x0001\t\t/* No-Ack policy */\n\n/* BAR Starting Sequence Control */\n#define\tIEEE80211_BAR_SEQ_START\t0xfff0\t\t/* starting seqnum */\n#define\tIEEE80211_BAR_SEQ_START_S\t4\n\nstruct ieee80211_ba_request {\n\tuint16_t\trq_barctl;\n\tuint16_t\trq_barseqctl;\n} __packed;\n\n/*\n * Control frames.\n */\nstruct ieee80211_frame_min {\n\tuint8_t\t\ti_fc[2];\n\tuint8_t\t\ti_dur[2];\n\tuint8_t\t\ti_addr1[IEEE80211_ADDR_LEN];\n\tuint8_t\t\ti_addr2[IEEE80211_ADDR_LEN];\n\t/* FCS */\n} __packed;\n\nstruct ieee80211_frame_rts {\n\tuint8_t\t\ti_fc[2];\n\tuint8_t\t\ti_dur[2];\n\tuint8_t\t\ti_ra[IEEE80211_ADDR_LEN];\n\tuint8_t\t\ti_ta[IEEE80211_ADDR_LEN];\n\t/* FCS */\n} __packed;\n\nstruct ieee80211_frame_cts {\n\tuint8_t\t\ti_fc[2];\n\tuint8_t\t\ti_dur[2];\n\tuint8_t\t\ti_ra[IEEE80211_ADDR_LEN];\n\t/* FCS */\n} __packed;\n\nstruct ieee80211_frame_ack {\n\tuint8_t\t\ti_fc[2];\n\tuint8_t\t\ti_dur[2];\n\tuint8_t\t\ti_ra[IEEE80211_ADDR_LEN];\n\t/* FCS */\n} __packed;\n\nstruct ieee80211_frame_pspoll {\n\tuint8_t\t\ti_fc[2];\n\tuint8_t\t\ti_aid[2];\n\tuint8_t\t\ti_bssid[IEEE80211_ADDR_LEN];\n\tuint8_t\t\ti_ta[IEEE80211_ADDR_LEN];\n\t/* FCS */\n} __packed;\n\nstruct ieee80211_frame_cfend {\t\t/* NB: also CF-End+CF-Ack */\n\tuint8_t\t\ti_fc[2];\n\tuint8_t\t\ti_dur[2];\t/* should be zero */\n\tuint8_t\t\ti_ra[IEEE80211_ADDR_LEN];\n\tuint8_t\t\ti_bssid[IEEE80211_ADDR_LEN];\n\t/* FCS */\n} __packed;\n\nstruct ieee80211_frame_bar {\n\tuint8_t\t\ti_fc[2];\n\tuint8_t\t\ti_dur[2];\n\tuint8_t\t\ti_ra[IEEE80211_ADDR_LEN];\n\tuint8_t\t\ti_ta[IEEE80211_ADDR_LEN];\n\tuint16_t\ti_ctl;\n\tuint16_t\ti_seq;\n\t/* FCS */\n} __packed;\n\n/*\n * BEACON management packets\n *\n *\toctet timestamp[8]\n *\toctet beacon interval[2]\n *\toctet capability information[2]\n *\tinformation element\n *\t\toctet elemid\n *\t\toctet length\n *\t\toctet information[length]\n */\n\n#define\tIEEE80211_BEACON_INTERVAL(beacon) \\\n\t((beacon)[8] | ((beacon)[9] << 8))\n#define\tIEEE80211_BEACON_CAPABILITY(beacon) \\\n\t((beacon)[10] | ((beacon)[11] << 8))\n\n#define\tIEEE80211_CAPINFO_ESS\t\t\t0x0001\n#define\tIEEE80211_CAPINFO_IBSS\t\t\t0x0002\n#define\tIEEE80211_CAPINFO_CF_POLLABLE\t\t0x0004\n#define\tIEEE80211_CAPINFO_CF_POLLREQ\t\t0x0008\n#define\tIEEE80211_CAPINFO_PRIVACY\t\t0x0010\n#define\tIEEE80211_CAPINFO_SHORT_PREAMBLE\t0x0020\n#define\tIEEE80211_CAPINFO_PBCC\t\t\t0x0040\n#define\tIEEE80211_CAPINFO_CHNL_AGILITY\t\t0x0080\n#define\tIEEE80211_CAPINFO_SPECTRUM_MGMT\t\t0x0100\n/* bit 9 is reserved */\n#define\tIEEE80211_CAPINFO_SHORT_SLOTTIME\t0x0400\n#define\tIEEE80211_CAPINFO_RSN\t\t\t0x0800\n/* bit 12 is reserved */\n#define\tIEEE80211_CAPINFO_DSSSOFDM\t\t0x2000\n/* bits 14-15 are reserved */\n\n#define\tIEEE80211_CAPINFO_BITS \\\n\t\"\\20\\1ESS\\2IBSS\\3CF_POLLABLE\\4CF_POLLREQ\\5PRIVACY\\6SHORT_PREAMBLE\" \\\n\t\"\\7PBCC\\10CHNL_AGILITY\\11SPECTRUM_MGMT\\13SHORT_SLOTTIME\\14RSN\" \\\n\t\"\\16DSSOFDM\"\n\n/*\n * 802.11i/WPA information element (maximally sized).\n */\nstruct ieee80211_ie_wpa {\n\tuint8_t\t\twpa_id;\t\t/* IEEE80211_ELEMID_VENDOR */\n\tuint8_t\t\twpa_len;\t/* length in bytes */\n\tuint8_t\t\twpa_oui[3];\t/* 0x00, 0x50, 0xf2 */\n\tuint8_t\t\twpa_type;\t/* OUI type */\n\tuint16_t\twpa_version;\t/* spec revision */\n\tuint32_t\twpa_mcipher[1];\t/* multicast/group key cipher */\n\tuint16_t\twpa_uciphercnt;\t/* # pairwise key ciphers */\n\tuint32_t\twpa_uciphers[8];/* ciphers */\n\tuint16_t\twpa_authselcnt;\t/* authentication selector cnt*/\n\tuint32_t\twpa_authsels[8];/* selectors */\n\tuint16_t\twpa_caps;\t/* 802.11i capabilities */\n\tuint16_t\twpa_pmkidcnt;\t/* 802.11i pmkid count */\n\tuint16_t\twpa_pmkids[8];\t/* 802.11i pmkids */\n} __packed;\n\n/*\n * 802.11n HT Capability IE\n * NB: these reflect D1.10 \n */\nstruct ieee80211_ie_htcap {\n\tuint8_t\t\thc_id;\t\t\t/* element ID */\n\tuint8_t\t\thc_len;\t\t\t/* length in bytes */\n\tuint16_t\thc_cap;\t\t\t/* HT caps (see below) */\n\tuint8_t\t\thc_param;\t\t/* HT params (see below) */\n\tuint8_t \thc_mcsset[16]; \t\t/* supported MCS set */\n\tuint16_t\thc_extcap;\t\t/* extended HT capabilities */\n\tuint32_t\thc_txbf;\t\t/* txbf capabilities */\n\tuint8_t\t\thc_antenna;\t\t/* antenna capabilities */\n} __packed;\n\n/* HT capability flags (ht_cap) */\n#define\tIEEE80211_HTCAP_LDPC\t\t0x0001\t/* LDPC supported */\n#define\tIEEE80211_HTCAP_CHWIDTH40\t0x0002\t/* 20/40 supported */\n#define\tIEEE80211_HTCAP_SMPS\t\t0x000c\t/* SM Power Save mode */\n#define\tIEEE80211_HTCAP_SMPS_OFF\t0x000c\t/* disabled */\n#define\tIEEE80211_HTCAP_SMPS_DYNAMIC\t0x0004\t/* send RTS first */\n/* NB: SMPS value 2 is reserved */\n#define\tIEEE80211_HTCAP_SMPS_ENA\t0x0000\t/* enabled (static mode) */\n#define\tIEEE80211_HTCAP_GREENFIELD\t0x0010\t/* Greenfield supported */\n#define\tIEEE80211_HTCAP_SHORTGI20\t0x0020\t/* Short GI in 20MHz */\n#define\tIEEE80211_HTCAP_SHORTGI40\t0x0040\t/* Short GI in 40MHz */\n#define\tIEEE80211_HTCAP_TXSTBC\t\t0x0080\t/* STBC tx ok */\n#define\tIEEE80211_HTCAP_RXSTBC\t\t0x0300  /* STBC rx support */\n#define\tIEEE80211_HTCAP_RXSTBC_S\t8\n#define\tIEEE80211_HTCAP_RXSTBC_1STREAM\t0x0100  /* 1 spatial stream */\n#define\tIEEE80211_HTCAP_RXSTBC_2STREAM\t0x0200  /* 1-2 spatial streams*/\n#define\tIEEE80211_HTCAP_RXSTBC_3STREAM\t0x0300  /* 1-3 spatial streams*/\n#define\tIEEE80211_HTCAP_DELBA\t\t0x0400\t/* HT DELBA supported */\n#define\tIEEE80211_HTCAP_MAXAMSDU\t0x0800\t/* max A-MSDU length */\n#define\tIEEE80211_HTCAP_MAXAMSDU_7935\t0x0800\t/* 7935 octets */\n#define\tIEEE80211_HTCAP_MAXAMSDU_3839\t0x0000\t/* 3839 octets */\n#define\tIEEE80211_HTCAP_DSSSCCK40\t0x1000  /* DSSS/CCK in 40MHz */\n#define\tIEEE80211_HTCAP_PSMP\t\t0x2000  /* PSMP supported */\n#define\tIEEE80211_HTCAP_40INTOLERANT\t0x4000  /* 40MHz intolerant */\n#define\tIEEE80211_HTCAP_LSIGTXOPPROT\t0x8000  /* L-SIG TXOP prot */\n\n#define\tIEEE80211_HTCAP_BITS \\\n\t\"\\20\\1LDPC\\2CHWIDTH40\\5GREENFIELD\\6SHORTGI20\\7SHORTGI40\\10TXSTBC\" \\\n\t\"\\13DELBA\\14AMSDU(7935)\\15DSSSCCK40\\16PSMP\\1740INTOLERANT\" \\\n\t\"\\20LSIGTXOPPROT\"\n\n/* HT parameters (hc_param) */\n#define\tIEEE80211_HTCAP_MAXRXAMPDU\t0x03\t/* max rx A-MPDU factor */\n#define\tIEEE80211_HTCAP_MAXRXAMPDU_S\t0\n#define\tIEEE80211_HTCAP_MAXRXAMPDU_8K\t0\n#define\tIEEE80211_HTCAP_MAXRXAMPDU_16K\t1\n#define\tIEEE80211_HTCAP_MAXRXAMPDU_32K\t2\n#define\tIEEE80211_HTCAP_MAXRXAMPDU_64K\t3\n#define\tIEEE80211_HTCAP_MPDUDENSITY\t0x1c\t/* min MPDU start spacing */\n#define\tIEEE80211_HTCAP_MPDUDENSITY_S\t2\n#define\tIEEE80211_HTCAP_MPDUDENSITY_NA\t0\t/* no time restriction */\n#define\tIEEE80211_HTCAP_MPDUDENSITY_025\t1\t/* 1/4 us */\n#define\tIEEE80211_HTCAP_MPDUDENSITY_05\t2\t/* 1/2 us */\n#define\tIEEE80211_HTCAP_MPDUDENSITY_1\t3\t/* 1 us */\n#define\tIEEE80211_HTCAP_MPDUDENSITY_2\t4\t/* 2 us */\n#define\tIEEE80211_HTCAP_MPDUDENSITY_4\t5\t/* 4 us */\n#define\tIEEE80211_HTCAP_MPDUDENSITY_8\t6\t/* 8 us */\n#define\tIEEE80211_HTCAP_MPDUDENSITY_16\t7\t/* 16 us */\n\n/* HT extended capabilities (hc_extcap) */\n#define\tIEEE80211_HTCAP_PCO\t\t0x0001\t/* PCO capable */\n#define\tIEEE80211_HTCAP_PCOTRANS\t0x0006\t/* PCO transition time */\n#define\tIEEE80211_HTCAP_PCOTRANS_S\t1\n#define\tIEEE80211_HTCAP_PCOTRANS_04\t0x0002\t/* 400 us */\n#define\tIEEE80211_HTCAP_PCOTRANS_15\t0x0004\t/* 1.5 ms */\n#define\tIEEE80211_HTCAP_PCOTRANS_5\t0x0006\t/* 5 ms */\n/* bits 3-7 reserved */\n#define\tIEEE80211_HTCAP_MCSFBACK\t0x0300\t/* MCS feedback */\n#define\tIEEE80211_HTCAP_MCSFBACK_S\t8\n#define\tIEEE80211_HTCAP_MCSFBACK_NONE\t0x0000\t/* nothing provided */\n#define\tIEEE80211_HTCAP_MCSFBACK_UNSOL\t0x0200\t/* unsolicited feedback */\n#define\tIEEE80211_HTCAP_MCSFBACK_MRQ\t0x0300\t/* \" \"+respond to MRQ */\n#define\tIEEE80211_HTCAP_HTC\t\t0x0400\t/* +HTC support */\n#define\tIEEE80211_HTCAP_RDR\t\t0x0800\t/* reverse direction responder*/\n/* bits 12-15 reserved */\n\n/*\n * 802.11n HT Information IE\n */\nstruct ieee80211_ie_htinfo {\n\tuint8_t\t\thi_id;\t\t\t/* element ID */\n\tuint8_t\t\thi_len;\t\t\t/* length in bytes */\n\tuint8_t\t\thi_ctrlchannel;\t\t/* primary channel */\n\tuint8_t\t\thi_byte1;\t\t/* ht ie byte 1 */\n\tuint8_t\t\thi_byte2;\t\t/* ht ie byte 2 */\n\tuint8_t\t\thi_byte3;\t\t/* ht ie byte 3 */\n\tuint16_t\thi_byte45;\t\t/* ht ie bytes 4+5 */\n\tuint8_t \thi_basicmcsset[16]; \t/* basic MCS set */\n} __packed;\n\n/* byte1 */\n#define\tIEEE80211_HTINFO_2NDCHAN\t0x03\t/* secondary/ext chan offset */\n#define\tIEEE80211_HTINFO_2NDCHAN_S\t0\n#define\tIEEE80211_HTINFO_2NDCHAN_NONE\t0x00\t/* no secondary/ext channel */\n#define\tIEEE80211_HTINFO_2NDCHAN_ABOVE\t0x01\t/* above private channel */\n/* NB: 2 is reserved */\n#define\tIEEE80211_HTINFO_2NDCHAN_BELOW\t0x03\t/* below primary channel */ \n#define\tIEEE80211_HTINFO_TXWIDTH\t0x04\t/* tx channel width */\n#define\tIEEE80211_HTINFO_TXWIDTH_20\t0x00\t/* 20MHz width */\n#define\tIEEE80211_HTINFO_TXWIDTH_2040\t0x04\t/* any supported width */\n#define\tIEEE80211_HTINFO_RIFSMODE\t0x08\t/* Reduced IFS (RIFS) use */\n#define\tIEEE80211_HTINFO_RIFSMODE_PROH\t0x00\t/* RIFS use prohibited */\n#define\tIEEE80211_HTINFO_RIFSMODE_PERM\t0x08\t/* RIFS use permitted */\n#define\tIEEE80211_HTINFO_PMSPONLY\t0x10\t/* PSMP required to associate */\n#define\tIEEE80211_HTINFO_SIGRAN\t\t0xe0\t/* shortest Service Interval */\n#define\tIEEE80211_HTINFO_SIGRAN_S\t5\n#define\tIEEE80211_HTINFO_SIGRAN_5\t0x00\t/* 5 ms */\n/* XXX add rest */\n\n/* bytes 2+3 */\n#define\tIEEE80211_HTINFO_OPMODE\t\t0x03\t/* operating mode */\n#define\tIEEE80211_HTINFO_OPMODE_S\t0\n#define\tIEEE80211_HTINFO_OPMODE_PURE\t0x00\t/* no protection */\n#define\tIEEE80211_HTINFO_OPMODE_PROTOPT\t0x01\t/* protection optional */\n#define\tIEEE80211_HTINFO_OPMODE_HT20PR\t0x02\t/* protection for HT20 sta's */\n#define\tIEEE80211_HTINFO_OPMODE_MIXED\t0x03\t/* protection for legacy sta's*/\n#define\tIEEE80211_HTINFO_NONGF_PRESENT\t0x04\t/* non-GF sta's present */\n#define\tIEEE80211_HTINFO_TXBL\t\t0x08\t/* transmit burst limit */\n#define\tIEEE80211_HTINFO_NONHT_PRESENT\t0x10\t/* non-HT sta's present */\n/* bits 5-15 reserved */\n\n/* bytes 4+5 */\n#define\tIEEE80211_HTINFO_2NDARYBEACON\t0x01\n#define\tIEEE80211_HTINFO_LSIGTXOPPROT\t0x02\n#define\tIEEE80211_HTINFO_PCO_ACTIVE\t0x04\n#define\tIEEE80211_HTINFO_40MHZPHASE\t0x08\n\n/* byte5 */\n#define\tIEEE80211_HTINFO_BASIC_STBCMCS\t0x7f\n#define\tIEEE80211_HTINFO_BASIC_STBCMCS_S 0\n#define\tIEEE80211_HTINFO_DUALPROTECTED\t0x80\n\n/*\n * Management information element payloads.\n */\n\nenum {\n\tIEEE80211_ELEMID_SSID\t\t= 0,\n\tIEEE80211_ELEMID_RATES\t\t= 1,\n\tIEEE80211_ELEMID_FHPARMS\t= 2,\n\tIEEE80211_ELEMID_DSPARMS\t= 3,\n\tIEEE80211_ELEMID_CFPARMS\t= 4,\n\tIEEE80211_ELEMID_TIM\t\t= 5,\n\tIEEE80211_ELEMID_IBSSPARMS\t= 6,\n\tIEEE80211_ELEMID_COUNTRY\t= 7,\n\tIEEE80211_ELEMID_CHALLENGE\t= 16,\n\t/* 17-31 reserved for challenge text extension */\n\tIEEE80211_ELEMID_PWRCNSTR\t= 32,\n\tIEEE80211_ELEMID_PWRCAP\t\t= 33,\n\tIEEE80211_ELEMID_TPCREQ\t\t= 34,\n\tIEEE80211_ELEMID_TPCREP\t\t= 35,\n\tIEEE80211_ELEMID_SUPPCHAN\t= 36,\n\tIEEE80211_ELEMID_CSA\t\t= 37,\n\tIEEE80211_ELEMID_MEASREQ\t= 38,\n\tIEEE80211_ELEMID_MEASREP\t= 39,\n\tIEEE80211_ELEMID_QUIET\t\t= 40,\n\tIEEE80211_ELEMID_IBSSDFS\t= 41,\n\tIEEE80211_ELEMID_ERP\t\t= 42,\n\tIEEE80211_ELEMID_HTCAP\t\t= 45,\n\tIEEE80211_ELEMID_RSN\t\t= 48,\n\tIEEE80211_ELEMID_XRATES\t\t= 50,\n\tIEEE80211_ELEMID_HTINFO\t\t= 61,\n\tIEEE80211_ELEMID_TPC\t\t= 150,\n\tIEEE80211_ELEMID_CCKM\t\t= 156,\n\tIEEE80211_ELEMID_VENDOR\t\t= 221,\t/* vendor private */\n\n\t/*\n\t * 802.11s IEs based on D3.03 spec and were not assigned by\n\t * ANA. Beware changing them because some of them are being\n\t * kept compatible with Linux.\n\t */\n\tIEEE80211_ELEMID_MESHCONF\t= 51,\n\tIEEE80211_ELEMID_MESHID\t\t= 52,\n\tIEEE80211_ELEMID_MESHLINK\t= 35,\n\tIEEE80211_ELEMID_MESHCNGST\t= 36,\n\tIEEE80211_ELEMID_MESHPEER\t= 55,\n\tIEEE80211_ELEMID_MESHCSA\t= 38,\n\tIEEE80211_ELEMID_MESHTIM\t= 39,\n\tIEEE80211_ELEMID_MESHAWAKEW\t= 40,\n\tIEEE80211_ELEMID_MESHBEACONT\t= 41,\n\tIEEE80211_ELEMID_MESHPANN\t= 48,\n\tIEEE80211_ELEMID_MESHRANN\t= 49,\n\tIEEE80211_ELEMID_MESHPREQ\t= 68,\n\tIEEE80211_ELEMID_MESHPREP\t= 69,\n\tIEEE80211_ELEMID_MESHPERR\t= 70,\n\tIEEE80211_ELEMID_MESHPXU\t= 53,\n\tIEEE80211_ELEMID_MESHPXUC\t= 54,\n\tIEEE80211_ELEMID_MESHAH\t\t= 60, /* Abbreviated Handshake */\n};\n\nstruct ieee80211_tim_ie {\n\tuint8_t\t\ttim_ie;\t\t\t/* IEEE80211_ELEMID_TIM */\n\tuint8_t\t\ttim_len;\n\tuint8_t\t\ttim_count;\t\t/* DTIM count */\n\tuint8_t\t\ttim_period;\t\t/* DTIM period */\n\tuint8_t\t\ttim_bitctl;\t\t/* bitmap control */\n\tuint8_t\t\ttim_bitmap[1];\t\t/* variable-length bitmap */\n} __packed;\n\nstruct ieee80211_country_ie {\n\tuint8_t\t\tie;\t\t\t/* IEEE80211_ELEMID_COUNTRY */\n\tuint8_t\t\tlen;\n\tuint8_t\t\tcc[3];\t\t\t/* ISO CC+(I)ndoor/(O)utdoor */\n\tstruct {\n\t\tuint8_t schan;\t\t\t/* starting channel */\n\t\tuint8_t nchan;\t\t\t/* number channels */\n\t\tuint8_t maxtxpwr;\t\t/* tx power cap */\n\t} __packed band[1];\t\t\t/* sub bands (NB: var size) */\n} __packed;\n\n#define\tIEEE80211_COUNTRY_MAX_BANDS\t84\t/* max possible bands */\n#define\tIEEE80211_COUNTRY_MAX_SIZE \\\n\t(sizeof(struct ieee80211_country_ie) + 3*(IEEE80211_COUNTRY_MAX_BANDS-1))\n\n/*\n * 802.11h Channel Switch Announcement (CSA).\n */\nstruct ieee80211_csa_ie {\n\tuint8_t\t\tcsa_ie;\t\t/* IEEE80211_ELEMID_CHANSWITCHANN */\n\tuint8_t\t\tcsa_len;\n\tuint8_t\t\tcsa_mode;\t\t/* Channel Switch Mode */\n\tuint8_t\t\tcsa_newchan;\t\t/* New Channel Number */\n\tuint8_t\t\tcsa_count;\t\t/* Channel Switch Count */\n} __packed;\n\n/*\n * Note the min acceptable CSA count is used to guard against\n * malicious CSA injection in station mode.  Defining this value\n * as other than 0 violates the 11h spec.\n */\n#define\tIEEE80211_CSA_COUNT_MIN\t2\n#define\tIEEE80211_CSA_COUNT_MAX\t255\n\n/* rate set entries are in .5 Mb/s units, and potentially marked as basic */\n#define\tIEEE80211_RATE_BASIC\t\t0x80\n#define\tIEEE80211_RATE_VAL\t\t0x7f\n\n/* EPR information element flags */\n#define\tIEEE80211_ERP_NON_ERP_PRESENT\t0x01\n#define\tIEEE80211_ERP_USE_PROTECTION\t0x02\n#define\tIEEE80211_ERP_LONG_PREAMBLE\t0x04\n\n#define\tIEEE80211_ERP_BITS \\\n\t\"\\20\\1NON_ERP_PRESENT\\2USE_PROTECTION\\3LONG_PREAMBLE\"\n\n#define\tATH_OUI\t\t\t0x7f0300\t/* Atheros OUI */\n#define\tATH_OUI_TYPE\t\t0x01\t\t/* Atheros protocol ie */\n\n/* NB: Atheros allocated the OUI for this purpose ~2005 but beware ... */\n#define\tTDMA_OUI\t\tATH_OUI\n#define\tTDMA_OUI_TYPE\t\t0x02\t\t/* TDMA protocol ie */\n\n#define\tBCM_OUI\t\t\t0x4c9000\t/* Broadcom OUI */\n#define\tBCM_OUI_HTCAP\t\t51\t\t/* pre-draft HTCAP ie */\n#define\tBCM_OUI_HTINFO\t\t52\t\t/* pre-draft HTINFO ie */\n\n#define\tWPA_OUI\t\t\t0xf25000\n#define\tWPA_OUI_TYPE\t\t0x01\n#define\tWPA_VERSION\t\t1\t\t/* current supported version */\n\n#define\tWPA_CSE_NULL\t\t0x00\n#define\tWPA_CSE_WEP40\t\t0x01\n#define\tWPA_CSE_TKIP\t\t0x02\n#define\tWPA_CSE_CCMP\t\t0x04\n#define\tWPA_CSE_WEP104\t\t0x05\n\n#define\tWPA_ASE_NONE\t\t0x00\n#define\tWPA_ASE_8021X_UNSPEC\t0x01\n#define\tWPA_ASE_8021X_PSK\t0x02\n\n#define\tWPS_OUI_TYPE\t\t0x04\n\n#define\tRSN_OUI\t\t\t0xac0f00\n#define\tRSN_VERSION\t\t1\t\t/* current supported version */\n\n#define\tRSN_CSE_NULL\t\t0x00\n#define\tRSN_CSE_WEP40\t\t0x01\n#define\tRSN_CSE_TKIP\t\t0x02\n#define\tRSN_CSE_WRAP\t\t0x03\n#define\tRSN_CSE_CCMP\t\t0x04\n#define\tRSN_CSE_WEP104\t\t0x05\n\n#define\tRSN_ASE_NONE\t\t0x00\n#define\tRSN_ASE_8021X_UNSPEC\t0x01\n#define\tRSN_ASE_8021X_PSK\t0x02\n\n#define\tRSN_CAP_PREAUTH\t\t0x01\n\n#define\tWME_OUI\t\t\t0xf25000\n#define\tWME_OUI_TYPE\t\t0x02\n#define\tWME_INFO_OUI_SUBTYPE\t0x00\n#define\tWME_PARAM_OUI_SUBTYPE\t0x01\n#define\tWME_VERSION\t\t1\n\n/* WME stream classes */\n#define\tWME_AC_BE\t0\t\t/* best effort */\n#define\tWME_AC_BK\t1\t\t/* background */\n#define\tWME_AC_VI\t2\t\t/* video */\n#define\tWME_AC_VO\t3\t\t/* voice */\n\n/*\n * AUTH management packets\n *\n *\toctet algo[2]\n *\toctet seq[2]\n *\toctet status[2]\n *\toctet chal.id\n *\toctet chal.length\n *\toctet chal.text[253]\t\tNB: 1-253 bytes\n */\n\n/* challenge length for shared key auth */\n#define IEEE80211_CHALLENGE_LEN\t\t128\n\n#define\tIEEE80211_AUTH_ALG_OPEN\t\t0x0000\n#define\tIEEE80211_AUTH_ALG_SHARED\t0x0001\n#define\tIEEE80211_AUTH_ALG_LEAP\t\t0x0080\n\nenum {\n\tIEEE80211_AUTH_OPEN_REQUEST\t\t= 1,\n\tIEEE80211_AUTH_OPEN_RESPONSE\t\t= 2,\n};\n\nenum {\n\tIEEE80211_AUTH_SHARED_REQUEST\t\t= 1,\n\tIEEE80211_AUTH_SHARED_CHALLENGE\t\t= 2,\n\tIEEE80211_AUTH_SHARED_RESPONSE\t\t= 3,\n\tIEEE80211_AUTH_SHARED_PASS\t\t= 4,\n};\n\n/*\n * Reason and status codes.\n *\n * Reason codes are used in management frames to indicate why an\n * action took place (e.g. on disassociation).  Status codes are\n * used in management frames to indicate the result of an operation.\n *\n * Unlisted codes are reserved\n */\n\nenum {\n\tIEEE80211_REASON_UNSPECIFIED\t\t= 1,\n\tIEEE80211_REASON_AUTH_EXPIRE\t\t= 2,\n\tIEEE80211_REASON_AUTH_LEAVE\t\t= 3,\n\tIEEE80211_REASON_ASSOC_EXPIRE\t\t= 4,\n\tIEEE80211_REASON_ASSOC_TOOMANY\t\t= 5,\n\tIEEE80211_REASON_NOT_AUTHED\t\t= 6,\n\tIEEE80211_REASON_NOT_ASSOCED\t\t= 7,\n\tIEEE80211_REASON_ASSOC_LEAVE\t\t= 8,\n\tIEEE80211_REASON_ASSOC_NOT_AUTHED\t= 9,\n\tIEEE80211_REASON_DISASSOC_PWRCAP_BAD\t= 10,\t/* 11h */\n\tIEEE80211_REASON_DISASSOC_SUPCHAN_BAD\t= 11,\t/* 11h */\n\tIEEE80211_REASON_IE_INVALID\t\t= 13,\t/* 11i */\n\tIEEE80211_REASON_MIC_FAILURE\t\t= 14,\t/* 11i */\n\tIEEE80211_REASON_4WAY_HANDSHAKE_TIMEOUT\t= 15,\t/* 11i */\n\tIEEE80211_REASON_GROUP_KEY_UPDATE_TIMEOUT = 16,\t/* 11i */\n\tIEEE80211_REASON_IE_IN_4WAY_DIFFERS\t= 17,\t/* 11i */\n\tIEEE80211_REASON_GROUP_CIPHER_INVALID\t= 18,\t/* 11i */\n\tIEEE80211_REASON_PAIRWISE_CIPHER_INVALID= 19,\t/* 11i */\n\tIEEE80211_REASON_AKMP_INVALID\t\t= 20,\t/* 11i */\n\tIEEE80211_REASON_UNSUPP_RSN_IE_VERSION\t= 21,\t/* 11i */\n\tIEEE80211_REASON_INVALID_RSN_IE_CAP\t= 22,\t/* 11i */\n\tIEEE80211_REASON_802_1X_AUTH_FAILED\t= 23,\t/* 11i */\n\tIEEE80211_REASON_CIPHER_SUITE_REJECTED\t= 24,\t/* 11i */\n\tIEEE80211_REASON_UNSPECIFIED_QOS\t= 32,\t/* 11e */\n\tIEEE80211_REASON_INSUFFICIENT_BW\t= 33,\t/* 11e */\n\tIEEE80211_REASON_TOOMANY_FRAMES\t\t= 34,\t/* 11e */\n\tIEEE80211_REASON_OUTSIDE_TXOP\t\t= 35,\t/* 11e */\n\tIEEE80211_REASON_LEAVING_QBSS\t\t= 36,\t/* 11e */\n\tIEEE80211_REASON_BAD_MECHANISM\t\t= 37,\t/* 11e */\n\tIEEE80211_REASON_SETUP_NEEDED\t\t= 38,\t/* 11e */\n\tIEEE80211_REASON_TIMEOUT\t\t= 39,\t/* 11e */\n\n\t/* values not yet allocated by ANA */\n\tIEEE80211_REASON_PEER_LINK_CANCELED\t= 2,\t/* 11s */\n\tIEEE80211_REASON_MESH_MAX_PEERS\t\t= 3,\t/* 11s */\n\tIEEE80211_REASON_MESH_CPVIOLATION\t= 4,\t/* 11s */\n\tIEEE80211_REASON_MESH_CLOSE_RCVD\t= 5,\t/* 11s */\n\tIEEE80211_REASON_MESH_MAX_RETRIES\t= 6,\t/* 11s */\n\tIEEE80211_REASON_MESH_CONFIRM_TIMEOUT\t= 7,\t/* 11s */\n\tIEEE80211_REASON_MESH_INVALID_GTK\t= 8,\t/* 11s */\n\tIEEE80211_REASON_MESH_INCONS_PARAMS\t= 9,\t/* 11s */\n\tIEEE80211_REASON_MESH_INVALID_SECURITY\t= 10,\t/* 11s */\n\tIEEE80211_REASON_MESH_PERR_UNSPEC\t= 11,\t/* 11s */\n\tIEEE80211_REASON_MESH_PERR_NO_FI\t= 12,\t/* 11s */\n\tIEEE80211_REASON_MESH_PERR_DEST_UNREACH\t= 13,\t/* 11s */\n\n\tIEEE80211_STATUS_SUCCESS\t\t= 0,\n\tIEEE80211_STATUS_UNSPECIFIED\t\t= 1,\n\tIEEE80211_STATUS_CAPINFO\t\t= 10,\n\tIEEE80211_STATUS_NOT_ASSOCED\t\t= 11,\n\tIEEE80211_STATUS_OTHER\t\t\t= 12,\n\tIEEE80211_STATUS_ALG\t\t\t= 13,\n\tIEEE80211_STATUS_SEQUENCE\t\t= 14,\n\tIEEE80211_STATUS_CHALLENGE\t\t= 15,\n\tIEEE80211_STATUS_TIMEOUT\t\t= 16,\n\tIEEE80211_STATUS_TOOMANY\t\t= 17,\n\tIEEE80211_STATUS_BASIC_RATE\t\t= 18,\n\tIEEE80211_STATUS_SP_REQUIRED\t\t= 19,\t/* 11b */\n\tIEEE80211_STATUS_PBCC_REQUIRED\t\t= 20,\t/* 11b */\n\tIEEE80211_STATUS_CA_REQUIRED\t\t= 21,\t/* 11b */\n\tIEEE80211_STATUS_SPECMGMT_REQUIRED\t= 22,\t/* 11h */\n\tIEEE80211_STATUS_PWRCAP_REQUIRED\t= 23,\t/* 11h */\n\tIEEE80211_STATUS_SUPCHAN_REQUIRED\t= 24,\t/* 11h */\n\tIEEE80211_STATUS_SHORTSLOT_REQUIRED\t= 25,\t/* 11g */\n\tIEEE80211_STATUS_DSSSOFDM_REQUIRED\t= 26,\t/* 11g */\n\tIEEE80211_STATUS_MISSING_HT_CAPS\t= 27,\t/* 11n D3.0 */\n\tIEEE80211_STATUS_INVALID_IE\t\t= 40,\t/* 11i */\n\tIEEE80211_STATUS_GROUP_CIPHER_INVALID\t= 41,\t/* 11i */\n\tIEEE80211_STATUS_PAIRWISE_CIPHER_INVALID = 42,\t/* 11i */\n\tIEEE80211_STATUS_AKMP_INVALID\t\t= 43,\t/* 11i */\n\tIEEE80211_STATUS_UNSUPP_RSN_IE_VERSION\t= 44,\t/* 11i */\n\tIEEE80211_STATUS_INVALID_RSN_IE_CAP\t= 45,\t/* 11i */\n\tIEEE80211_STATUS_CIPHER_SUITE_REJECTED\t= 46,\t/* 11i */\n};\n\n#define\tIEEE80211_WEP_KEYLEN\t\t5\t/* 40bit */\n#define\tIEEE80211_WEP_IVLEN\t\t3\t/* 24bit */\n#define\tIEEE80211_WEP_KIDLEN\t\t1\t/* 1 octet */\n#define\tIEEE80211_WEP_CRCLEN\t\t4\t/* CRC-32 */\n#define\tIEEE80211_WEP_TOTLEN\t\t(IEEE80211_WEP_IVLEN + \\\n\t\t\t\t\t IEEE80211_WEP_KIDLEN + \\\n\t\t\t\t\t IEEE80211_WEP_CRCLEN)\n#define\tIEEE80211_WEP_NKID\t\t4\t/* number of key ids */\n\n/*\n * 802.11i defines an extended IV for use with non-WEP ciphers.\n * When the EXTIV bit is set in the key id byte an additional\n * 4 bytes immediately follow the IV for TKIP.  For CCMP the\n * EXTIV bit is likewise set but the 8 bytes represent the\n * CCMP header rather than IV+extended-IV.\n */\n#define\tIEEE80211_WEP_EXTIV\t\t0x20\n#define\tIEEE80211_WEP_EXTIVLEN\t\t4\t/* extended IV length */\n#define\tIEEE80211_WEP_MICLEN\t\t8\t/* trailing MIC */\n\n#define\tIEEE80211_CRC_LEN\t\t4\n\n/*\n * Maximum acceptable MTU is:\n *\tIEEE80211_MAX_LEN - WEP overhead - CRC -\n *\t\tQoS overhead - RSN/WPA overhead\n * Min is arbitrarily chosen > IEEE80211_MIN_LEN.  The default\n * mtu is Ethernet-compatible; it's set by ether_ifattach.\n */\n#define\tIEEE80211_MTU_MAX\t\t2290\n#define\tIEEE80211_MTU_MIN\t\t32\n\n#define\tIEEE80211_MAX_LEN\t\t(2300 + IEEE80211_CRC_LEN + \\\n    (IEEE80211_WEP_IVLEN + IEEE80211_WEP_KIDLEN + IEEE80211_WEP_CRCLEN))\n#define\tIEEE80211_ACK_LEN \\\n\t(sizeof(struct ieee80211_frame_ack) + IEEE80211_CRC_LEN)\n#define\tIEEE80211_MIN_LEN \\\n\t(sizeof(struct ieee80211_frame_min) + IEEE80211_CRC_LEN)\n\n/*\n * The 802.11 spec says at most 2007 stations may be\n * associated at once.  For most AP's this is way more\n * than is feasible so we use a default of IEEE80211_AID_DEF.\n * This number may be overridden by the driver and/or by\n * user configuration but may not be less than IEEE80211_AID_MIN\n * (see _ieee80211.h for implementation-specific settings).\n */\n#define\tIEEE80211_AID_MAX\t\t2007\n\n#define\tIEEE80211_AID(b)\t((b) &~ 0xc000)\n\n/* \n * RTS frame length parameters.  The default is specified in\n * the 802.11 spec as 512; we treat it as implementation-dependent\n * so it's defined in ieee80211_var.h.  The max may be wrong\n * for jumbo frames.\n */\n#define\tIEEE80211_RTS_MIN\t\t1\n#define\tIEEE80211_RTS_MAX\t\t2346\n\n/* \n * TX fragmentation parameters.  As above for RTS, we treat\n * default as implementation-dependent so define it elsewhere.\n */\n#define\tIEEE80211_FRAG_MIN\t\t256\n#define\tIEEE80211_FRAG_MAX\t\t2346\n\n/*\n * Beacon interval (TU's).  Min+max come from WiFi requirements.\n * As above, we treat default as implementation-dependent so\n * define it elsewhere.\n */\n#define\tIEEE80211_BINTVAL_MAX\t1000\t/* max beacon interval (TU's) */\n#define\tIEEE80211_BINTVAL_MIN\t25\t/* min beacon interval (TU's) */\n\n/*\n * DTIM period (beacons).  Min+max are not really defined\n * by the protocol but we want them publicly visible so\n * define them here.\n */\n#define\tIEEE80211_DTIM_MAX\t15\t/* max DTIM period */\n#define\tIEEE80211_DTIM_MIN\t1\t/* min DTIM period */\n\n/*\n * Beacon miss threshold (beacons).  As for DTIM, we define\n * them here to be publicly visible.  Note the max may be\n * clamped depending on device capabilities.\n */\n#define\tIEEE80211_HWBMISS_MIN \t1\n#define\tIEEE80211_HWBMISS_MAX \t255\n\n/*\n * 802.11 frame duration definitions.\n */\n\nstruct ieee80211_duration {\n\tuint16_t\td_rts_dur;\n\tuint16_t\td_data_dur;\n\tuint16_t\td_plcp_len;\n\tuint8_t\t\td_residue;\t/* unused octets in time slot */\n};\n\n/* One Time Unit (TU) is 1Kus = 1024 microseconds. */\n#define IEEE80211_DUR_TU\t\t1024\n\n/* IEEE 802.11b durations for DSSS PHY in microseconds */\n#define IEEE80211_DUR_DS_LONG_PREAMBLE\t144\n#define IEEE80211_DUR_DS_SHORT_PREAMBLE\t72\n\n#define IEEE80211_DUR_DS_SLOW_PLCPHDR\t48\n#define IEEE80211_DUR_DS_FAST_PLCPHDR\t24\n#define IEEE80211_DUR_DS_SLOW_ACK\t112\n#define IEEE80211_DUR_DS_FAST_ACK\t56\n#define IEEE80211_DUR_DS_SLOW_CTS\t112\n#define IEEE80211_DUR_DS_FAST_CTS\t56\n\n#define IEEE80211_DUR_DS_SLOT\t\t20\n#define IEEE80211_DUR_DS_SIFS\t\t10\n#define IEEE80211_DUR_DS_PIFS\t(IEEE80211_DUR_DS_SIFS + IEEE80211_DUR_DS_SLOT)\n#define IEEE80211_DUR_DS_DIFS\t(IEEE80211_DUR_DS_SIFS + \\\n\t\t\t\t 2 * IEEE80211_DUR_DS_SLOT)\n#define IEEE80211_DUR_DS_EIFS\t(IEEE80211_DUR_DS_SIFS + \\\n\t\t\t\t IEEE80211_DUR_DS_SLOW_ACK + \\\n\t\t\t\t IEEE80211_DUR_DS_LONG_PREAMBLE + \\\n\t\t\t\t IEEE80211_DUR_DS_SLOW_PLCPHDR + \\\n\t\t\t\t IEEE80211_DUR_DIFS)\n\n#endif /* _NET80211_IEEE80211_H_ */\n"
  },
  {
    "path": "freebsd-headers/net80211/ieee80211_action.h",
    "content": "/*-\n * Copyright (c) 2009 Sam Leffler, Errno Consulting\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR\n * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES\n * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,\n * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF\n * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/net80211/ieee80211_action.h 195377 2009-07-05 17:59:19Z sam $\n */\n#ifndef _NET80211_IEEE80211_ACTION_H_\n#define _NET80211_IEEE80211_ACTION_H_\n\n/*\n * 802.11 send/recv action frame support.\n */\n\nstruct ieee80211_node;\nstruct ieee80211_frame;\n\ntypedef int ieee80211_send_action_func(struct ieee80211_node *,\n    int, int, void *);\nint\tieee80211_send_action_register(int cat, int act,\n\t\tieee80211_send_action_func *f);\nvoid\tieee80211_send_action_unregister(int cat, int act);\nint\tieee80211_send_action(struct ieee80211_node *, int, int, void *);\n\ntypedef int ieee80211_recv_action_func(struct ieee80211_node *,\n    const struct ieee80211_frame *, const uint8_t *, const uint8_t *);\nint\tieee80211_recv_action_register(int cat, int act,\n\t\tieee80211_recv_action_func *);\nvoid\tieee80211_recv_action_unregister(int cat, int act);\nint\tieee80211_recv_action(struct ieee80211_node *,\n\t\tconst struct ieee80211_frame *,\n\t\tconst uint8_t *, const uint8_t *);\n#endif /* _NET80211_IEEE80211_ACTION_H_ */\n"
  },
  {
    "path": "freebsd-headers/net80211/ieee80211_adhoc.h",
    "content": "/*-\n * Copyright (c) 2007-2008 Sam Leffler, Errno Consulting\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR\n * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES\n * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,\n * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF\n * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/net80211/ieee80211_adhoc.h 178354 2008-04-20 20:35:46Z sam $\n */\n#ifndef _NET80211_IEEE80211_ADHOC_H_\n#define _NET80211_IEEE80211_ADHOC_H_\n\n/*\n * Adhoc-mode (ibss+ahdemo) implementation definitions.\n */\nvoid\tieee80211_adhoc_attach(struct ieee80211com *);\nvoid\tieee80211_adhoc_detach(struct ieee80211com *);\n#endif /* !_NET80211_IEEE80211_STA_H_ */\n"
  },
  {
    "path": "freebsd-headers/net80211/ieee80211_ageq.h",
    "content": "/*-\n * Copyright (c) 2009 Sam Leffler, Errno Consulting\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR\n * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES\n * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,\n * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF\n * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/net80211/ieee80211_ageq.h 195379 2009-07-05 18:17:37Z sam $\n */\n#ifndef _NET80211_IEEE80211_STAGEQ_H_\n#define _NET80211_IEEE80211_STAGEQ_H_\n\nstruct ieee80211_node;\nstruct mbuf;\n\nstruct ieee80211_ageq {\n\tieee80211_ageq_lock_t\taq_lock;\n\tint\t\t\taq_len;\t\t/* # items on queue */\n\tint\t\t\taq_maxlen;\t/* max queue length */\n\tint\t\t\taq_drops;\t/* frames dropped */\n\tstruct mbuf\t\t*aq_head;\t/* frames linked w/ m_nextpkt */\n\tstruct mbuf\t\t*aq_tail;\t/* last frame in queue */\n};\n\nvoid\tieee80211_ageq_init(struct ieee80211_ageq *, int maxlen,\n\t    const char *name);\nvoid\tieee80211_ageq_cleanup(struct ieee80211_ageq *);\nvoid\tieee80211_ageq_mfree(struct mbuf *);\nint\tieee80211_ageq_append(struct ieee80211_ageq *, struct mbuf *,\n\t    int age);\nvoid\tieee80211_ageq_drain(struct ieee80211_ageq *);\nvoid\tieee80211_ageq_drain_node(struct ieee80211_ageq *,\n\t    struct ieee80211_node *);\nstruct mbuf *ieee80211_ageq_age(struct ieee80211_ageq *, int quanta);\nstruct mbuf *ieee80211_ageq_remove(struct ieee80211_ageq *,\n\t    struct ieee80211_node *match);\n#endif /* _NET80211_IEEE80211_STAGEQ_H_ */\n"
  },
  {
    "path": "freebsd-headers/net80211/ieee80211_alq.h",
    "content": "/*-\n * Copyright (c) 2011 Adrian Chadd, Xenion Lty Ltd\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR\n * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES\n * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,\n * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF\n * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/net80211/ieee80211_alq.h 220908 2011-04-21 03:59:37Z adrian $\n */\n#ifndef\t__IEEE80211_ALQ_H__\n#define\t__IEEE80211_ALQ_H__\n\n#define\tIEEE80211_ALQ_PAYLOAD_SIZE\t24\n\n/*\n * timestamp\n * wlan interface\n * operation\n * sub-operation\n * rest of structure - operation specific\n */\nstruct ieee80211_alq_rec {\n\tuint32_t\tr_timestamp;\t/* XXX may wrap! */\n\tuint16_t\tr_wlan;\t\t/* wlan interface number */\n\tuint8_t\t\tr_version;\t/* version */\n\tuint8_t\t\tr_op;\t\t/* top-level operation id */\n\tu_char\t\tr_payload[IEEE80211_ALQ_PAYLOAD_SIZE];\n\t\t\t\t\t/* operation-specific payload */\n};\n\n/* General logging function */\nextern void ieee80211_alq_log(struct ieee80211vap *vap, uint8_t op, u_char *p, int l);\n\n#endif\t/* __IEEE80211_ALQ_H__ */\n"
  },
  {
    "path": "freebsd-headers/net80211/ieee80211_amrr.h",
    "content": "/* $FreeBSD: release/9.0.0/sys/net80211/ieee80211_amrr.h 206358 2010-04-07 15:29:13Z rpaulo $ */\n/*\t$OpenBSD: ieee80211_amrr.h,v 1.3 2006/06/17 19:34:31 damien Exp $\t*/\n\n/*-\n * Copyright (c) 2006\n *\tDamien Bergamini <damien.bergamini@free.fr>\n *\n * Permission to use, copy, modify, and distribute this software for any\n * purpose with or without fee is hereby granted, provided that the above\n * copyright notice and this permission notice appear in all copies.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES\n * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF\n * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR\n * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES\n * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN\n * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF\n * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.\n */\n#ifndef _NET80211_IEEE80211_AMRR_H_\n#define _NET80211_IEEE80211_AMRR_H_\n\n/*-\n * Naive implementation of the Adaptive Multi Rate Retry algorithm:\n *\n * \"IEEE 802.11 Rate Adaptation: A Practical Approach\"\n *  Mathieu Lacage, Hossein Manshaei, Thierry Turletti\n *  INRIA Sophia - Projet Planete\n *  http://www-sop.inria.fr/rapports/sophia/RR-5208.html\n */\n\n/*\n * Rate control settings.\n */\nstruct ieee80211vap;\n\nstruct ieee80211_amrr {\n\tu_int\tamrr_min_success_threshold;\n\tu_int\tamrr_max_success_threshold;\n\tint\tamrr_interval;\t\t/* update interval (ticks) */\n};\n\n#define IEEE80211_AMRR_MIN_SUCCESS_THRESHOLD\t 1\n#define IEEE80211_AMRR_MAX_SUCCESS_THRESHOLD\t15\n\n/*\n * Rate control state for a given node.\n */\nstruct ieee80211_amrr_node {\n\tstruct ieee80211_amrr *amn_amrr;/* backpointer */\n\tint\tamn_rix;\t\t/* current rate index */\n\tint\tamn_ticks;\t\t/* time of last update */\n\t/* statistics */\n\tu_int\tamn_txcnt;\n\tu_int\tamn_success;\n\tu_int\tamn_success_threshold;\n\tu_int\tamn_recovery;\n\tu_int\tamn_retrycnt;\n};\n\n#endif /* _NET80211_IEEE80211_AMRR_H_ */\n"
  },
  {
    "path": "freebsd-headers/net80211/ieee80211_crypto.h",
    "content": "/*-\n * Copyright (c) 2001 Atsushi Onoe\n * Copyright (c) 2002-2008 Sam Leffler, Errno Consulting\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR\n * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES\n * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,\n * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF\n * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/net80211/ieee80211_crypto.h 209636 2010-07-01 20:50:12Z bschmidt $\n */\n#ifndef _NET80211_IEEE80211_CRYPTO_H_\n#define _NET80211_IEEE80211_CRYPTO_H_\n\n/*\n * 802.11 protocol crypto-related definitions.\n */\n#define\tIEEE80211_KEYBUF_SIZE\t16\n#define\tIEEE80211_MICBUF_SIZE\t(8+8)\t/* space for both tx+rx keys */\n\n/*\n * Old WEP-style key.  Deprecated.\n */\nstruct ieee80211_wepkey {\n\tu_int\t\twk_len;\t\t/* key length in bytes */\n\tuint8_t\t\twk_key[IEEE80211_KEYBUF_SIZE];\n};\n\nstruct ieee80211_rsnparms {\n\tuint8_t\t\trsn_mcastcipher;\t/* mcast/group cipher */\n\tuint8_t\t\trsn_mcastkeylen;\t/* mcast key length */\n\tuint8_t\t\trsn_ucastcipher;\t/* selected unicast cipher */\n\tuint8_t\t\trsn_ucastkeylen;\t/* unicast key length */\n\tuint8_t\t\trsn_keymgmt;\t\t/* selected key mgmt algo */\n\tuint16_t\trsn_caps;\t\t/* capabilities */\n};\n\nstruct ieee80211_cipher;\n\n/*\n * Crypto key state.  There is sufficient room for all supported\n * ciphers (see below).  The underlying ciphers are handled\n * separately through loadable cipher modules that register with\n * the generic crypto support.  A key has a reference to an instance\n * of the cipher; any per-key state is hung off wk_private by the\n * cipher when it is attached.  Ciphers are automatically called\n * to detach and cleanup any such state when the key is deleted.\n *\n * The generic crypto support handles encap/decap of cipher-related\n * frame contents for both hardware- and software-based implementations.\n * A key requiring software crypto support is automatically flagged and\n * the cipher is expected to honor this and do the necessary work.\n * Ciphers such as TKIP may also support mixed hardware/software\n * encrypt/decrypt and MIC processing.\n */\ntypedef uint16_t ieee80211_keyix;\t/* h/w key index */\n\nstruct ieee80211_key {\n\tuint8_t\t\twk_keylen;\t/* key length in bytes */\n\tuint8_t\t\twk_pad;\n\tuint16_t\twk_flags;\n#define\tIEEE80211_KEY_XMIT\t0x0001\t/* key used for xmit */\n#define\tIEEE80211_KEY_RECV\t0x0002\t/* key used for recv */\n#define\tIEEE80211_KEY_GROUP\t0x0004\t/* key used for WPA group operation */\n#define\tIEEE80211_KEY_NOREPLAY\t0x0008\t/* ignore replay failures */\n#define\tIEEE80211_KEY_SWENCRYPT\t0x0010\t/* host-based encrypt */\n#define\tIEEE80211_KEY_SWDECRYPT\t0x0020\t/* host-based decrypt */\n#define\tIEEE80211_KEY_SWENMIC\t0x0040\t/* host-based enmic */\n#define\tIEEE80211_KEY_SWDEMIC\t0x0080\t/* host-based demic */\n#define\tIEEE80211_KEY_DEVKEY\t0x0100\t/* device key request completed */\n#define\tIEEE80211_KEY_CIPHER0\t0x1000\t/* cipher-specific action 0 */\n#define\tIEEE80211_KEY_CIPHER1\t0x2000\t/* cipher-specific action 1 */\n\tieee80211_keyix\twk_keyix;\t/* h/w key index */\n\tieee80211_keyix\twk_rxkeyix;\t/* optional h/w rx key index */\n\tuint8_t\t\twk_key[IEEE80211_KEYBUF_SIZE+IEEE80211_MICBUF_SIZE];\n#define\twk_txmic\twk_key+IEEE80211_KEYBUF_SIZE+0\t/* XXX can't () right */\n#define\twk_rxmic\twk_key+IEEE80211_KEYBUF_SIZE+8\t/* XXX can't () right */\n\t\t\t\t\t/* key receive sequence counter */\n\tuint64_t\twk_keyrsc[IEEE80211_TID_SIZE];\n\tuint64_t\twk_keytsc;\t/* key transmit sequence counter */\n\tconst struct ieee80211_cipher *wk_cipher;\n\tvoid\t\t*wk_private;\t/* private cipher state */\n\tuint8_t\t\twk_macaddr[IEEE80211_ADDR_LEN];\n};\n#define\tIEEE80211_KEY_COMMON \t\t/* common flags passed in by apps */\\\n\t(IEEE80211_KEY_XMIT | IEEE80211_KEY_RECV | IEEE80211_KEY_GROUP | \\\n\t IEEE80211_KEY_NOREPLAY)\n#define\tIEEE80211_KEY_DEVICE\t\t/* flags owned by device driver */\\\n\t(IEEE80211_KEY_DEVKEY|IEEE80211_KEY_CIPHER0|IEEE80211_KEY_CIPHER1)\n\n#define\tIEEE80211_KEY_SWCRYPT \\\n\t(IEEE80211_KEY_SWENCRYPT | IEEE80211_KEY_SWDECRYPT)\n#define\tIEEE80211_KEY_SWMIC\t(IEEE80211_KEY_SWENMIC | IEEE80211_KEY_SWDEMIC)\n\n#define\tIEEE80211_KEY_BITS \\\n\t\"\\20\\1XMIT\\2RECV\\3GROUP\\4SWENCRYPT\\5SWDECRYPT\\6SWENMIC\\7SWDEMIC\" \\\n\t\"\\10DEVKEY\\11CIPHER0\\12CIPHER1\"\n\n#define\tIEEE80211_KEYIX_NONE\t((ieee80211_keyix) -1)\n\n/*\n * NB: these values are ordered carefully; there are lots of\n * of implications in any reordering.  Beware that 4 is used\n * only to indicate h/w TKIP MIC support in driver capabilities;\n * there is no separate cipher support (it's rolled into the\n * TKIP cipher support).\n */\n#define\tIEEE80211_CIPHER_WEP\t\t0\n#define\tIEEE80211_CIPHER_TKIP\t\t1\n#define\tIEEE80211_CIPHER_AES_OCB\t2\n#define\tIEEE80211_CIPHER_AES_CCM\t3\n#define\tIEEE80211_CIPHER_TKIPMIC\t4\t/* TKIP MIC capability */\n#define\tIEEE80211_CIPHER_CKIP\t\t5\n#define\tIEEE80211_CIPHER_NONE\t\t6\t/* pseudo value */\n\n#define\tIEEE80211_CIPHER_MAX\t\t(IEEE80211_CIPHER_NONE+1)\n\n/* capability bits in ic_cryptocaps/iv_cryptocaps */\n#define\tIEEE80211_CRYPTO_WEP\t\t(1<<IEEE80211_CIPHER_WEP)\n#define\tIEEE80211_CRYPTO_TKIP\t\t(1<<IEEE80211_CIPHER_TKIP)\n#define\tIEEE80211_CRYPTO_AES_OCB\t(1<<IEEE80211_CIPHER_AES_OCB)\n#define\tIEEE80211_CRYPTO_AES_CCM\t(1<<IEEE80211_CIPHER_AES_CCM)\n#define\tIEEE80211_CRYPTO_TKIPMIC\t(1<<IEEE80211_CIPHER_TKIPMIC)\n#define\tIEEE80211_CRYPTO_CKIP\t\t(1<<IEEE80211_CIPHER_CKIP)\n\n#define\tIEEE80211_CRYPTO_BITS \\\n\t\"\\20\\1WEP\\2TKIP\\3AES\\4AES_CCM\\5TKIPMIC\\6CKIP\"\n\n#if defined(__KERNEL__) || defined(_KERNEL)\n\nstruct ieee80211com;\nstruct ieee80211vap;\nstruct ieee80211_node;\nstruct mbuf;\n\nMALLOC_DECLARE(M_80211_CRYPTO);\n\nvoid\tieee80211_crypto_attach(struct ieee80211com *);\nvoid\tieee80211_crypto_detach(struct ieee80211com *);\nvoid\tieee80211_crypto_vattach(struct ieee80211vap *);\nvoid\tieee80211_crypto_vdetach(struct ieee80211vap *);\nint\tieee80211_crypto_newkey(struct ieee80211vap *,\n\t\tint cipher, int flags, struct ieee80211_key *);\nint\tieee80211_crypto_delkey(struct ieee80211vap *,\n\t\tstruct ieee80211_key *);\nint\tieee80211_crypto_setkey(struct ieee80211vap *, struct ieee80211_key *);\nvoid\tieee80211_crypto_delglobalkeys(struct ieee80211vap *);\nvoid\tieee80211_crypto_reload_keys(struct ieee80211com *);\n\n/*\n * Template for a supported cipher.  Ciphers register with the\n * crypto code and are typically loaded as separate modules\n * (the null cipher is always present).\n * XXX may need refcnts\n */\nstruct ieee80211_cipher {\n\tconst char *ic_name;\t\t/* printable name */\n\tu_int\tic_cipher;\t\t/* IEEE80211_CIPHER_* */\n\tu_int\tic_header;\t\t/* size of privacy header (bytes) */\n\tu_int\tic_trailer;\t\t/* size of privacy trailer (bytes) */\n\tu_int\tic_miclen;\t\t/* size of mic trailer (bytes) */\n\tvoid*\t(*ic_attach)(struct ieee80211vap *, struct ieee80211_key *);\n\tvoid\t(*ic_detach)(struct ieee80211_key *);\n\tint\t(*ic_setkey)(struct ieee80211_key *);\n\tint\t(*ic_encap)(struct ieee80211_key *, struct mbuf *,\n\t\t\tuint8_t keyid);\n\tint\t(*ic_decap)(struct ieee80211_key *, struct mbuf *, int);\n\tint\t(*ic_enmic)(struct ieee80211_key *, struct mbuf *, int);\n\tint\t(*ic_demic)(struct ieee80211_key *, struct mbuf *, int);\n};\nextern\tconst struct ieee80211_cipher ieee80211_cipher_none;\n\n#define\tIEEE80211_KEY_UNDEFINED(k) \\\n\t((k)->wk_cipher == &ieee80211_cipher_none)\n\nvoid\tieee80211_crypto_register(const struct ieee80211_cipher *);\nvoid\tieee80211_crypto_unregister(const struct ieee80211_cipher *);\nint\tieee80211_crypto_available(u_int cipher);\n\nstruct ieee80211_key *ieee80211_crypto_encap(struct ieee80211_node *,\n\t\tstruct mbuf *);\nstruct ieee80211_key *ieee80211_crypto_decap(struct ieee80211_node *,\n\t\tstruct mbuf *, int);\n\n/*\n * Check and remove any MIC.\n */\nstatic __inline int\nieee80211_crypto_demic(struct ieee80211vap *vap, struct ieee80211_key *k,\n\tstruct mbuf *m, int force)\n{\n\tconst struct ieee80211_cipher *cip = k->wk_cipher;\n\treturn (cip->ic_miclen > 0 ? cip->ic_demic(k, m, force) : 1);\n}\n\n/*\n * Add any MIC.\n */\nstatic __inline int\nieee80211_crypto_enmic(struct ieee80211vap *vap,\n\tstruct ieee80211_key *k, struct mbuf *m, int force)\n{\n\tconst struct ieee80211_cipher *cip = k->wk_cipher;\n\treturn (cip->ic_miclen > 0 ? cip->ic_enmic(k, m, force) : 1);\n}\n\n/* \n * Reset key state to an unused state.  The crypto\n * key allocation mechanism insures other state (e.g.\n * key data) is properly setup before a key is used.\n */\nstatic __inline void\nieee80211_crypto_resetkey(struct ieee80211vap *vap,\n\tstruct ieee80211_key *k, ieee80211_keyix ix)\n{\n\tk->wk_cipher = &ieee80211_cipher_none;\n\tk->wk_private = k->wk_cipher->ic_attach(vap, k);\n\tk->wk_keyix = k->wk_rxkeyix = ix;\n\tk->wk_flags = IEEE80211_KEY_XMIT | IEEE80211_KEY_RECV;\n}\n\n/*\n * Crypt-related notification methods.\n */\nvoid\tieee80211_notify_replay_failure(struct ieee80211vap *,\n\t\tconst struct ieee80211_frame *, const struct ieee80211_key *,\n\t\tuint64_t rsc, int tid);\nvoid\tieee80211_notify_michael_failure(struct ieee80211vap *,\n\t\tconst struct ieee80211_frame *, u_int keyix);\n#endif /* defined(__KERNEL__) || defined(_KERNEL) */\n#endif /* _NET80211_IEEE80211_CRYPTO_H_ */\n"
  },
  {
    "path": "freebsd-headers/net80211/ieee80211_dfs.h",
    "content": "/*-\n * Copyright (c) 2007-2008 Sam Leffler, Errno Consulting\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR\n * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES\n * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,\n * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF\n * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/net80211/ieee80211_dfs.h 186107 2008-12-15 01:26:33Z sam $\n */\n#ifndef _NET80211_IEEE80211_DFS_H_\n#define _NET80211_IEEE80211_DFS_H_\n\n/*\n * 802.11h/DFS definitions.\n */\n\nstruct ieee80211_dfs_state {\n\tint\t\tnol_event[IEEE80211_CHAN_MAX];\n\tstruct callout\tnol_timer;\t\t/* NOL list processing */\n\tstruct callout\tcac_timer;\t\t/* CAC timer */\n\tstruct timeval\tlastevent;\t\t/* time of last radar event */\n\tint\t\tcureps;\t\t\t/* current events/second */\n\tconst struct ieee80211_channel *lastchan;/* chan w/ last radar event */\n\tstruct ieee80211_channel *newchan;\t/* chan selected next */\n};\n\nvoid\tieee80211_dfs_attach(struct ieee80211com *);\nvoid\tieee80211_dfs_detach(struct ieee80211com *);\n\nvoid\tieee80211_dfs_reset(struct ieee80211com *);\n\nvoid\tieee80211_dfs_cac_start(struct ieee80211vap *);\nvoid\tieee80211_dfs_cac_stop(struct ieee80211vap *);\nvoid\tieee80211_dfs_cac_clear(struct ieee80211com *,\n\t\tconst struct ieee80211_channel *);\n\nvoid\tieee80211_dfs_notify_radar(struct ieee80211com *,\n\t\tstruct ieee80211_channel *);\nstruct ieee80211_channel *ieee80211_dfs_pickchannel(struct ieee80211com *);\n#endif /* _NET80211_IEEE80211_DFS_H_ */\n"
  },
  {
    "path": "freebsd-headers/net80211/ieee80211_freebsd.h",
    "content": "/*-\n * Copyright (c) 2003-2008 Sam Leffler, Errno Consulting\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR\n * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES\n * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,\n * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF\n * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/net80211/ieee80211_freebsd.h 206617 2010-04-14 18:29:40Z rpaulo $\n */\n#ifndef _NET80211_IEEE80211_FREEBSD_H_\n#define _NET80211_IEEE80211_FREEBSD_H_\n\n#ifdef _KERNEL\n#include <sys/param.h>\n#include <sys/lock.h>\n#include <sys/mutex.h>\n#include <sys/rwlock.h>\n#include <sys/sysctl.h>\n#include <sys/taskqueue.h>\n\n/*\n * Common state locking definitions.\n */\ntypedef struct {\n\tchar\t\tname[16];\t\t/* e.g. \"ath0_com_lock\" */\n\tstruct mtx\tmtx;\n} ieee80211_com_lock_t;\n#define\tIEEE80211_LOCK_INIT(_ic, _name) do {\t\t\t\t\\\n\tieee80211_com_lock_t *cl = &(_ic)->ic_comlock;\t\t\t\\\n\tsnprintf(cl->name, sizeof(cl->name), \"%s_com_lock\", _name);\t\\\n\tmtx_init(&cl->mtx, cl->name, NULL, MTX_DEF | MTX_RECURSE);\t\\\n} while (0)\n#define\tIEEE80211_LOCK_OBJ(_ic)\t(&(_ic)->ic_comlock.mtx)\n#define\tIEEE80211_LOCK_DESTROY(_ic) mtx_destroy(IEEE80211_LOCK_OBJ(_ic))\n#define\tIEEE80211_LOCK(_ic)\t   mtx_lock(IEEE80211_LOCK_OBJ(_ic))\n#define\tIEEE80211_UNLOCK(_ic)\t   mtx_unlock(IEEE80211_LOCK_OBJ(_ic))\n#define\tIEEE80211_LOCK_ASSERT(_ic) \\\n\tmtx_assert(IEEE80211_LOCK_OBJ(_ic), MA_OWNED)\n\n/*\n * Node locking definitions.\n */\ntypedef struct {\n\tchar\t\tname[16];\t\t/* e.g. \"ath0_node_lock\" */\n\tstruct mtx\tmtx;\n} ieee80211_node_lock_t;\n#define\tIEEE80211_NODE_LOCK_INIT(_nt, _name) do {\t\t\t\\\n\tieee80211_node_lock_t *nl = &(_nt)->nt_nodelock;\t\t\\\n\tsnprintf(nl->name, sizeof(nl->name), \"%s_node_lock\", _name);\t\\\n\tmtx_init(&nl->mtx, nl->name, NULL, MTX_DEF | MTX_RECURSE);\t\\\n} while (0)\n#define\tIEEE80211_NODE_LOCK_OBJ(_nt)\t(&(_nt)->nt_nodelock.mtx)\n#define\tIEEE80211_NODE_LOCK_DESTROY(_nt) \\\n\tmtx_destroy(IEEE80211_NODE_LOCK_OBJ(_nt))\n#define\tIEEE80211_NODE_LOCK(_nt) \\\n\tmtx_lock(IEEE80211_NODE_LOCK_OBJ(_nt))\n#define\tIEEE80211_NODE_IS_LOCKED(_nt) \\\n\tmtx_owned(IEEE80211_NODE_LOCK_OBJ(_nt))\n#define\tIEEE80211_NODE_UNLOCK(_nt) \\\n\tmtx_unlock(IEEE80211_NODE_LOCK_OBJ(_nt))\n#define\tIEEE80211_NODE_LOCK_ASSERT(_nt)\t\\\n\tmtx_assert(IEEE80211_NODE_LOCK_OBJ(_nt), MA_OWNED)\n\n/*\n * Node table iteration locking definitions; this protects the\n * scan generation # used to iterate over the station table\n * while grabbing+releasing the node lock.\n */\ntypedef struct {\n\tchar\t\tname[16];\t\t/* e.g. \"ath0_scan_lock\" */\n\tstruct mtx\tmtx;\n} ieee80211_scan_lock_t;\n#define\tIEEE80211_NODE_ITERATE_LOCK_INIT(_nt, _name) do {\t\t\\\n\tieee80211_scan_lock_t *sl = &(_nt)->nt_scanlock;\t\t\\\n\tsnprintf(sl->name, sizeof(sl->name), \"%s_scan_lock\", _name);\t\\\n\tmtx_init(&sl->mtx, sl->name, NULL, MTX_DEF);\t\t\t\\\n} while (0)\n#define\tIEEE80211_NODE_ITERATE_LOCK_OBJ(_nt)\t(&(_nt)->nt_scanlock.mtx)\n#define\tIEEE80211_NODE_ITERATE_LOCK_DESTROY(_nt) \\\n\tmtx_destroy(IEEE80211_NODE_ITERATE_LOCK_OBJ(_nt))\n#define\tIEEE80211_NODE_ITERATE_LOCK(_nt) \\\n\tmtx_lock(IEEE80211_NODE_ITERATE_LOCK_OBJ(_nt))\n#define\tIEEE80211_NODE_ITERATE_UNLOCK(_nt) \\\n\tmtx_unlock(IEEE80211_NODE_ITERATE_LOCK_OBJ(_nt))\n\n/*\n * Power-save queue definitions. \n */\ntypedef struct mtx ieee80211_psq_lock_t;\n#define\tIEEE80211_PSQ_INIT(_psq, _name) \\\n\tmtx_init(&(_psq)->psq_lock, _name, \"802.11 ps q\", MTX_DEF)\n#define\tIEEE80211_PSQ_DESTROY(_psq)\tmtx_destroy(&(_psq)->psq_lock)\n#define\tIEEE80211_PSQ_LOCK(_psq)\tmtx_lock(&(_psq)->psq_lock)\n#define\tIEEE80211_PSQ_UNLOCK(_psq)\tmtx_unlock(&(_psq)->psq_lock)\n\n#ifndef IF_PREPEND_LIST\n#define _IF_PREPEND_LIST(ifq, mhead, mtail, mcount) do {\t\\\n\t(mtail)->m_nextpkt = (ifq)->ifq_head;\t\t\t\\\n\tif ((ifq)->ifq_tail == NULL)\t\t\t\t\\\n\t\t(ifq)->ifq_tail = (mtail);\t\t\t\\\n\t(ifq)->ifq_head = (mhead);\t\t\t\t\\\n\t(ifq)->ifq_len += (mcount);\t\t\t\t\\\n} while (0)\n#define IF_PREPEND_LIST(ifq, mhead, mtail, mcount) do {\t\t\\\n\tIF_LOCK(ifq);\t\t\t\t\t\t\\\n\t_IF_PREPEND_LIST(ifq, mhead, mtail, mcount);\t\t\\\n\tIF_UNLOCK(ifq);\t\t\t\t\t\t\\\n} while (0)\n#endif /* IF_PREPEND_LIST */\n \n/*\n * Age queue definitions.\n */\ntypedef struct mtx ieee80211_ageq_lock_t;\n#define\tIEEE80211_AGEQ_INIT(_aq, _name) \\\n\tmtx_init(&(_aq)->aq_lock, _name, \"802.11 age q\", MTX_DEF)\n#define\tIEEE80211_AGEQ_DESTROY(_aq)\tmtx_destroy(&(_aq)->aq_lock)\n#define\tIEEE80211_AGEQ_LOCK(_aq)\tmtx_lock(&(_aq)->aq_lock)\n#define\tIEEE80211_AGEQ_UNLOCK(_aq)\tmtx_unlock(&(_aq)->aq_lock)\n\n/*\n * 802.1x MAC ACL database locking definitions.\n */\ntypedef struct mtx acl_lock_t;\n#define\tACL_LOCK_INIT(_as, _name) \\\n\tmtx_init(&(_as)->as_lock, _name, \"802.11 ACL\", MTX_DEF)\n#define\tACL_LOCK_DESTROY(_as)\t\tmtx_destroy(&(_as)->as_lock)\n#define\tACL_LOCK(_as)\t\t\tmtx_lock(&(_as)->as_lock)\n#define\tACL_UNLOCK(_as)\t\t\tmtx_unlock(&(_as)->as_lock)\n#define\tACL_LOCK_ASSERT(_as) \\\n\tmtx_assert((&(_as)->as_lock), MA_OWNED)\n\n/*\n * Scan table definitions.\n */\ntypedef struct mtx ieee80211_scan_table_lock_t;\n#define\tIEEE80211_SCAN_TABLE_LOCK_INIT(_st, _name) \\\n\tmtx_init(&(_st)->st_lock, _name, \"802.11 scan table\", MTX_DEF)\n#define\tIEEE80211_SCAN_TABLE_LOCK_DESTROY(_st)\tmtx_destroy(&(_st)->st_lock)\n#define\tIEEE80211_SCAN_TABLE_LOCK(_st)\t\tmtx_lock(&(_st)->st_lock)\n#define\tIEEE80211_SCAN_TABLE_UNLOCK(_st)\tmtx_unlock(&(_st)->st_lock)\n\n/*\n * Node reference counting definitions.\n *\n * ieee80211_node_initref\tinitialize the reference count to 1\n * ieee80211_node_incref\tadd a reference\n * ieee80211_node_decref\tremove a reference\n * ieee80211_node_dectestref\tremove a reference and return 1 if this\n *\t\t\t\tis the last reference, otherwise 0\n * ieee80211_node_refcnt\treference count for printing (only)\n */\n#include <machine/atomic.h>\n\n#define ieee80211_node_initref(_ni) \\\n\tdo { ((_ni)->ni_refcnt = 1); } while (0)\n#define ieee80211_node_incref(_ni) \\\n\tatomic_add_int(&(_ni)->ni_refcnt, 1)\n#define\tieee80211_node_decref(_ni) \\\n\tatomic_subtract_int(&(_ni)->ni_refcnt, 1)\nstruct ieee80211_node;\nint\tieee80211_node_dectestref(struct ieee80211_node *ni);\n#define\tieee80211_node_refcnt(_ni)\t(_ni)->ni_refcnt\n\nstruct ifqueue;\nstruct ieee80211vap;\nvoid\tieee80211_drain_ifq(struct ifqueue *);\nvoid\tieee80211_flush_ifq(struct ifqueue *, struct ieee80211vap *);\n\nvoid\tieee80211_vap_destroy(struct ieee80211vap *);\n\n#define\tIFNET_IS_UP_RUNNING(_ifp) \\\n\t(((_ifp)->if_flags & IFF_UP) && \\\n\t ((_ifp)->if_drv_flags & IFF_DRV_RUNNING))\n\n#define\tmsecs_to_ticks(ms)\t(((ms)*hz)/1000)\n#define\tticks_to_msecs(t)\t(1000*(t) / hz)\n#define\tticks_to_secs(t)\t((t) / hz)\n#define time_after(a,b) \t((long)(b) - (long)(a) < 0)\n#define time_before(a,b)\ttime_after(b,a)\n#define time_after_eq(a,b)\t((long)(a) - (long)(b) >= 0)\n#define time_before_eq(a,b)\ttime_after_eq(b,a)\n\nstruct mbuf *ieee80211_getmgtframe(uint8_t **frm, int headroom, int pktlen);\n\n/* tx path usage */\n#define\tM_ENCAP\t\tM_PROTO1\t\t/* 802.11 encap done */\n#define\tM_EAPOL\t\tM_PROTO3\t\t/* PAE/EAPOL frame */\n#define\tM_PWR_SAV\tM_PROTO4\t\t/* bypass PS handling */\n#define\tM_MORE_DATA\tM_PROTO5\t\t/* more data frames to follow */\n#define\tM_FF\t\tM_PROTO6\t\t/* fast frame */\n#define\tM_TXCB\t\tM_PROTO7\t\t/* do tx complete callback */\n#define\tM_AMPDU_MPDU\tM_PROTO8\t\t/* ok for A-MPDU aggregation */\n#define\tM_80211_TX \\\n\t(M_FRAG|M_FIRSTFRAG|M_LASTFRAG|M_ENCAP|M_EAPOL|M_PWR_SAV|\\\n\t M_MORE_DATA|M_FF|M_TXCB|M_AMPDU_MPDU)\n\n/* rx path usage */\n#define\tM_AMPDU\t\tM_PROTO1\t\t/* A-MPDU subframe */\n#define\tM_WEP\t\tM_PROTO2\t\t/* WEP done by hardware */\n#if 0\n#define\tM_AMPDU_MPDU\tM_PROTO8\t\t/* A-MPDU re-order done */\n#endif\n#define\tM_80211_RX\t(M_AMPDU|M_WEP|M_AMPDU_MPDU)\n\n#define\tIEEE80211_MBUF_TX_FLAG_BITS \\\n\t\"\\20\\1M_EXT\\2M_PKTHDR\\3M_EOR\\4M_RDONLY\\5M_ENCAP\\6M_WEP\\7M_EAPOL\" \\\n\t\"\\10M_PWR_SAV\\11M_MORE_DATA\\12M_BCAST\\13M_MCAST\\14M_FRAG\\15M_FIRSTFRAG\" \\\n\t\"\\16M_LASTFRAG\\17M_SKIP_FIREWALL\\20M_FREELIST\\21M_VLANTAG\\22M_PROMISC\" \\\n\t\"\\23M_NOFREE\\24M_FF\\25M_TXCB\\26M_AMPDU_MPDU\\27M_FLOWID\"\n\n#define\tIEEE80211_MBUF_RX_FLAG_BITS \\\n\t\"\\20\\1M_EXT\\2M_PKTHDR\\3M_EOR\\4M_RDONLY\\5M_AMPDU\\6M_WEP\\7M_PROTO3\" \\\n\t\"\\10M_PROTO4\\11M_PROTO5\\12M_BCAST\\13M_MCAST\\14M_FRAG\\15M_FIRSTFRAG\" \\\n\t\"\\16M_LASTFRAG\\17M_SKIP_FIREWALL\\20M_FREELIST\\21M_VLANTAG\\22M_PROMISC\" \\\n\t\"\\23M_NOFREE\\24M_PROTO6\\25M_PROTO7\\26M_AMPDU_MPDU\\27M_FLOWID\"\n\n/*\n * Store WME access control bits in the vlan tag.\n * This is safe since it's done after the packet is classified\n * (where we use any previous tag) and because it's passed\n * directly in to the driver and there's no chance someone\n * else will clobber them on us.\n */\n#define\tM_WME_SETAC(m, ac) \\\n\t((m)->m_pkthdr.ether_vtag = (ac))\n#define\tM_WME_GETAC(m)\t((m)->m_pkthdr.ether_vtag)\n\n/*\n * Mbufs on the power save queue are tagged with an age and\n * timed out.  We reuse the hardware checksum field in the\n * mbuf packet header to store this data.\n */\n#define\tM_AGE_SET(m,v)\t\t(m->m_pkthdr.csum_data = v)\n#define\tM_AGE_GET(m)\t\t(m->m_pkthdr.csum_data)\n#define\tM_AGE_SUB(m,adj)\t(m->m_pkthdr.csum_data -= adj)\n\n/*\n * Store the sequence number.\n */\n#define\tM_SEQNO_SET(m, seqno) \\\n\t((m)->m_pkthdr.tso_segsz = (seqno))\n#define\tM_SEQNO_GET(m)\t((m)->m_pkthdr.tso_segsz)\n\n#define\tMTAG_ABI_NET80211\t1132948340\t/* net80211 ABI */\n\nstruct ieee80211_cb {\n\tvoid\t(*func)(struct ieee80211_node *, void *, int status);\n\tvoid\t*arg;\n};\n#define\tNET80211_TAG_CALLBACK\t0\t/* xmit complete callback */\nint\tieee80211_add_callback(struct mbuf *m,\n\t\tvoid (*func)(struct ieee80211_node *, void *, int), void *arg);\nvoid\tieee80211_process_callback(struct ieee80211_node *, struct mbuf *, int);\n\nvoid\tget_random_bytes(void *, size_t);\n\nstruct ieee80211com;\n\nvoid\tieee80211_sysctl_attach(struct ieee80211com *);\nvoid\tieee80211_sysctl_detach(struct ieee80211com *);\nvoid\tieee80211_sysctl_vattach(struct ieee80211vap *);\nvoid\tieee80211_sysctl_vdetach(struct ieee80211vap *);\n\nSYSCTL_DECL(_net_wlan);\nint\tieee80211_sysctl_msecs_ticks(SYSCTL_HANDLER_ARGS);\n\nvoid\tieee80211_load_module(const char *);\n\n/*\n * A \"policy module\" is an adjunct module to net80211 that provides\n * functionality that typically includes policy decisions.  This\n * modularity enables extensibility and vendor-supplied functionality.\n */\n#define\t_IEEE80211_POLICY_MODULE(policy, name, version)\t\t\t\\\ntypedef void (*policy##_setup)(int);\t\t\t\t\t\\\nSET_DECLARE(policy##_set, policy##_setup);\t\t\t\t\\\nstatic int\t\t\t\t\t\t\t\t\\\nwlan_##name##_modevent(module_t mod, int type, void *unused)\t\t\\\n{\t\t\t\t\t\t\t\t\t\\\n\tpolicy##_setup * const *iter, f;\t\t\t\t\\\n\tswitch (type) {\t\t\t\t\t\t\t\\\n\tcase MOD_LOAD:\t\t\t\t\t\t\t\\\n\t\tSET_FOREACH(iter, policy##_set) {\t\t\t\\\n\t\t\tf = (void*) *iter;\t\t\t\t\\\n\t\t\tf(type);\t\t\t\t\t\\\n\t\t}\t\t\t\t\t\t\t\\\n\t\treturn 0;\t\t\t\t\t\t\\\n\tcase MOD_UNLOAD:\t\t\t\t\t\t\\\n\tcase MOD_QUIESCE:\t\t\t\t\t\t\\\n\t\tif (nrefs) {\t\t\t\t\t\t\\\n\t\t\tprintf(\"wlan_##name: still in use (%u dynamic refs)\\n\",\\\n\t\t\t\tnrefs);\t\t\t\t\t\\\n\t\t\treturn EBUSY;\t\t\t\t\t\\\n\t\t}\t\t\t\t\t\t\t\\\n\t\tif (type == MOD_UNLOAD) {\t\t\t\t\\\n\t\t\tSET_FOREACH(iter, policy##_set) {\t\t\\\n\t\t\t\tf = (void*) *iter;\t\t\t\\\n\t\t\t\tf(type);\t\t\t\t\\\n\t\t\t}\t\t\t\t\t\t\\\n\t\t}\t\t\t\t\t\t\t\\\n\t\treturn 0;\t\t\t\t\t\t\\\n\t}\t\t\t\t\t\t\t\t\\\n\treturn EINVAL;\t\t\t\t\t\t\t\\\n}\t\t\t\t\t\t\t\t\t\\\nstatic moduledata_t name##_mod = {\t\t\t\t\t\\\n\t\"wlan_\" #name,\t\t\t\t\t\t\t\\\n\twlan_##name##_modevent,\t\t\t\t\t\t\\\n\t0\t\t\t\t\t\t\t\t\\\n};\t\t\t\t\t\t\t\t\t\\\nDECLARE_MODULE(wlan_##name, name##_mod, SI_SUB_DRIVERS, SI_ORDER_FIRST);\\\nMODULE_VERSION(wlan_##name, version);\t\t\t\t\t\\\nMODULE_DEPEND(wlan_##name, wlan, 1, 1, 1)\n\n/*\n * Crypto modules implement cipher support.\n */\n#define\tIEEE80211_CRYPTO_MODULE(name, version)\t\t\t\t\\\n_IEEE80211_POLICY_MODULE(crypto, name, version);\t\t\t\\\nstatic void\t\t\t\t\t\t\t\t\\\nname##_modevent(int type)\t\t\t\t\t\t\\\n{\t\t\t\t\t\t\t\t\t\\\n\tif (type == MOD_LOAD)\t\t\t\t\t\t\\\n\t\tieee80211_crypto_register(&name);\t\t\t\\\n\telse\t\t\t\t\t\t\t\t\\\n\t\tieee80211_crypto_unregister(&name);\t\t\t\\\n}\t\t\t\t\t\t\t\t\t\\\nTEXT_SET(crypto##_set, name##_modevent)\n\n/*\n * Scanner modules provide scanning policy.\n */\n#define\tIEEE80211_SCANNER_MODULE(name, version)\t\t\t\t\\\n\t_IEEE80211_POLICY_MODULE(scanner, name, version)\n\n#define\tIEEE80211_SCANNER_ALG(name, alg, v)\t\t\t\t\\\nstatic void\t\t\t\t\t\t\t\t\\\nname##_modevent(int type)\t\t\t\t\t\t\\\n{\t\t\t\t\t\t\t\t\t\\\n\tif (type == MOD_LOAD)\t\t\t\t\t\t\\\n\t\tieee80211_scanner_register(alg, &v);\t\t\t\\\n\telse\t\t\t\t\t\t\t\t\\\n\t\tieee80211_scanner_unregister(alg, &v);\t\t\t\\\n}\t\t\t\t\t\t\t\t\t\\\nTEXT_SET(scanner_set, name##_modevent);\t\t\t\t\t\\\n\n/*\n * ACL modules implement acl policy.\n */\n#define\tIEEE80211_ACL_MODULE(name, alg, version)\t\t\t\\\n_IEEE80211_POLICY_MODULE(acl, name, version);\t\t\t\t\\\nstatic void\t\t\t\t\t\t\t\t\\\nalg##_modevent(int type)\t\t\t\t\t\t\\\n{\t\t\t\t\t\t\t\t\t\\\n\tif (type == MOD_LOAD)\t\t\t\t\t\t\\\n\t\tieee80211_aclator_register(&alg);\t\t\t\\\n\telse\t\t\t\t\t\t\t\t\\\n\t\tieee80211_aclator_unregister(&alg);\t\t\t\\\n}\t\t\t\t\t\t\t\t\t\\\nTEXT_SET(acl_set, alg##_modevent);\t\t\t\t\t\\\n\n/*\n * Authenticator modules handle 802.1x/WPA authentication.\n */\n#define\tIEEE80211_AUTH_MODULE(name, version)\t\t\t\t\\\n\t_IEEE80211_POLICY_MODULE(auth, name, version)\n\n#define\tIEEE80211_AUTH_ALG(name, alg, v)\t\t\t\t\\\nstatic void\t\t\t\t\t\t\t\t\\\nname##_modevent(int type)\t\t\t\t\t\t\\\n{\t\t\t\t\t\t\t\t\t\\\n\tif (type == MOD_LOAD)\t\t\t\t\t\t\\\n\t\tieee80211_authenticator_register(alg, &v);\t\t\\\n\telse\t\t\t\t\t\t\t\t\\\n\t\tieee80211_authenticator_unregister(alg);\t\t\\\n}\t\t\t\t\t\t\t\t\t\\\nTEXT_SET(auth_set, name##_modevent)\n\n/*\n * Rate control modules provide tx rate control support.\n */\n#define\tIEEE80211_RATECTL_MODULE(alg, version)\t\t\t\t\\\n\t_IEEE80211_POLICY_MODULE(ratectl, alg, version);\t\t\\\n\n#define\tIEEE80211_RATECTL_ALG(name, alg, v)\t\t\t\t\\\nstatic void\t\t\t\t\t\t\t\t\\\nalg##_modevent(int type)\t\t\t\t\t\t\\\n{\t\t\t\t\t\t\t\t\t\\\n\tif (type == MOD_LOAD)\t\t\t\t\t\t\\\n\t\tieee80211_ratectl_register(alg, &v);\t\t\t\\\n\telse\t\t\t\t\t\t\t\t\\\n\t\tieee80211_ratectl_unregister(alg);\t\t\t\\\n}\t\t\t\t\t\t\t\t\t\\\nTEXT_SET(ratectl##_set, alg##_modevent)\n\nstruct ieee80211req;\ntypedef int ieee80211_ioctl_getfunc(struct ieee80211vap *,\n    struct ieee80211req *);\nSET_DECLARE(ieee80211_ioctl_getset, ieee80211_ioctl_getfunc);\n#define\tIEEE80211_IOCTL_GET(_name, _get) TEXT_SET(ieee80211_ioctl_getset, _get)\n\ntypedef int ieee80211_ioctl_setfunc(struct ieee80211vap *,\n    struct ieee80211req *);\nSET_DECLARE(ieee80211_ioctl_setset, ieee80211_ioctl_setfunc);\n#define\tIEEE80211_IOCTL_SET(_name, _set) TEXT_SET(ieee80211_ioctl_setset, _set)\n#endif /* _KERNEL */\n\n/* XXX this stuff belongs elsewhere */\n/*\n * Message formats for messages from the net80211 layer to user\n * applications via the routing socket.  These messages are appended\n * to an if_announcemsghdr structure.\n */\nstruct ieee80211_join_event {\n\tuint8_t\t\tiev_addr[6];\n};\n\nstruct ieee80211_leave_event {\n\tuint8_t\t\tiev_addr[6];\n};\n\nstruct ieee80211_replay_event {\n\tuint8_t\t\tiev_src[6];\t/* src MAC */\n\tuint8_t\t\tiev_dst[6];\t/* dst MAC */\n\tuint8_t\t\tiev_cipher;\t/* cipher type */\n\tuint8_t\t\tiev_keyix;\t/* key id/index */\n\tuint64_t\tiev_keyrsc;\t/* RSC from key */\n\tuint64_t\tiev_rsc;\t/* RSC from frame */\n};\n\nstruct ieee80211_michael_event {\n\tuint8_t\t\tiev_src[6];\t/* src MAC */\n\tuint8_t\t\tiev_dst[6];\t/* dst MAC */\n\tuint8_t\t\tiev_cipher;\t/* cipher type */\n\tuint8_t\t\tiev_keyix;\t/* key id/index */\n};\n\nstruct ieee80211_wds_event {\n\tuint8_t\t\tiev_addr[6];\n};\n\nstruct ieee80211_csa_event {\n\tuint32_t\tiev_flags;\t/* channel flags */\n\tuint16_t\tiev_freq;\t/* setting in Mhz */\n\tuint8_t\t\tiev_ieee;\t/* IEEE channel number */\n\tuint8_t\t\tiev_mode;\t/* CSA mode */\n\tuint8_t\t\tiev_count;\t/* CSA count */\n};\n\nstruct ieee80211_cac_event {\n\tuint32_t\tiev_flags;\t/* channel flags */\n\tuint16_t\tiev_freq;\t/* setting in Mhz */\n\tuint8_t\t\tiev_ieee;\t/* IEEE channel number */\n\t/* XXX timestamp? */\n\tuint8_t\t\tiev_type;\t/* IEEE80211_NOTIFY_CAC_* */\n};\n\nstruct ieee80211_radar_event {\n\tuint32_t\tiev_flags;\t/* channel flags */\n\tuint16_t\tiev_freq;\t/* setting in Mhz */\n\tuint8_t\t\tiev_ieee;\t/* IEEE channel number */\n\t/* XXX timestamp? */\n};\n\nstruct ieee80211_auth_event {\n\tuint8_t\t\tiev_addr[6];\n};\n\nstruct ieee80211_deauth_event {\n\tuint8_t\t\tiev_addr[6];\n};\n\nstruct ieee80211_country_event {\n\tuint8_t\t\tiev_addr[6];\n\tuint8_t\t\tiev_cc[2];\t/* ISO country code */\n};\n\nstruct ieee80211_radio_event {\n\tuint8_t\t\tiev_state;\t/* 1 on, 0 off */\n};\n\n#define\tRTM_IEEE80211_ASSOC\t100\t/* station associate (bss mode) */\n#define\tRTM_IEEE80211_REASSOC\t101\t/* station re-associate (bss mode) */\n#define\tRTM_IEEE80211_DISASSOC\t102\t/* station disassociate (bss mode) */\n#define\tRTM_IEEE80211_JOIN\t103\t/* station join (ap mode) */\n#define\tRTM_IEEE80211_LEAVE\t104\t/* station leave (ap mode) */\n#define\tRTM_IEEE80211_SCAN\t105\t/* scan complete, results available */\n#define\tRTM_IEEE80211_REPLAY\t106\t/* sequence counter replay detected */\n#define\tRTM_IEEE80211_MICHAEL\t107\t/* Michael MIC failure detected */\n#define\tRTM_IEEE80211_REJOIN\t108\t/* station re-associate (ap mode) */\n#define\tRTM_IEEE80211_WDS\t109\t/* WDS discovery (ap mode) */\n#define\tRTM_IEEE80211_CSA\t110\t/* Channel Switch Announcement event */\n#define\tRTM_IEEE80211_RADAR\t111\t/* radar event */\n#define\tRTM_IEEE80211_CAC\t112\t/* Channel Availability Check event */\n#define\tRTM_IEEE80211_DEAUTH\t113\t/* station deauthenticate */\n#define\tRTM_IEEE80211_AUTH\t114\t/* station authenticate (ap mode) */\n#define\tRTM_IEEE80211_COUNTRY\t115\t/* discovered country code (sta mode) */\n#define\tRTM_IEEE80211_RADIO\t116\t/* RF kill switch state change */\n\n/*\n * Structure prepended to raw packets sent through the bpf\n * interface when set to DLT_IEEE802_11_RADIO.  This allows\n * user applications to specify pretty much everything in\n * an Atheros tx descriptor.  XXX need to generalize.\n *\n * XXX cannot be more than 14 bytes as it is copied to a sockaddr's\n * XXX sa_data area.\n */\nstruct ieee80211_bpf_params {\n\tuint8_t\t\tibp_vers;\t/* version */\n#define\tIEEE80211_BPF_VERSION\t0\n\tuint8_t\t\tibp_len;\t/* header length in bytes */\n\tuint8_t\t\tibp_flags;\n#define\tIEEE80211_BPF_SHORTPRE\t0x01\t/* tx with short preamble */\n#define\tIEEE80211_BPF_NOACK\t0x02\t/* tx with no ack */\n#define\tIEEE80211_BPF_CRYPTO\t0x04\t/* tx with h/w encryption */\n#define\tIEEE80211_BPF_FCS\t0x10\t/* frame incldues FCS */\n#define\tIEEE80211_BPF_DATAPAD\t0x20\t/* frame includes data padding */\n#define\tIEEE80211_BPF_RTS\t0x40\t/* tx with RTS/CTS */\n#define\tIEEE80211_BPF_CTS\t0x80\t/* tx with CTS only */\n\tuint8_t\t\tibp_pri;\t/* WME/WMM AC+tx antenna */\n\tuint8_t\t\tibp_try0;\t/* series 1 try count */\n\tuint8_t\t\tibp_rate0;\t/* series 1 IEEE tx rate */\n\tuint8_t\t\tibp_power;\t/* tx power (device units) */\n\tuint8_t\t\tibp_ctsrate;\t/* IEEE tx rate for CTS */\n\tuint8_t\t\tibp_try1;\t/* series 2 try count */\n\tuint8_t\t\tibp_rate1;\t/* series 2 IEEE tx rate */\n\tuint8_t\t\tibp_try2;\t/* series 3 try count */\n\tuint8_t\t\tibp_rate2;\t/* series 3 IEEE tx rate */\n\tuint8_t\t\tibp_try3;\t/* series 4 try count */\n\tuint8_t\t\tibp_rate3;\t/* series 4 IEEE tx rate */\n};\n#endif /* _NET80211_IEEE80211_FREEBSD_H_ */\n"
  },
  {
    "path": "freebsd-headers/net80211/ieee80211_hostap.h",
    "content": "/*-\n * Copyright (c) 2007-2008 Sam Leffler, Errno Consulting\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR\n * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES\n * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,\n * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF\n * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/net80211/ieee80211_hostap.h 178354 2008-04-20 20:35:46Z sam $\n */\n#ifndef _NET80211_IEEE80211_HOSTAP_H_\n#define _NET80211_IEEE80211_HOSTAP_H_\n\n/*\n * Hostap implementation definitions.\n */\nvoid\tieee80211_hostap_attach(struct ieee80211com *);\nvoid\tieee80211_hostap_detach(struct ieee80211com *);\n#endif /* !_NET80211_IEEE80211_HOSTAP_H_ */\n"
  },
  {
    "path": "freebsd-headers/net80211/ieee80211_ht.h",
    "content": "/*-\n * Copyright (c) 2007-2008 Sam Leffler, Errno Consulting\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR\n * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES\n * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,\n * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF\n * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/net80211/ieee80211_ht.h 219456 2011-03-10 18:17:24Z bschmidt $\n */\n#ifndef _NET80211_IEEE80211_HT_H_\n#define _NET80211_IEEE80211_HT_H_\n\n/*\n * 802.11n protocol implementation definitions.\n */\n\n#define\tIEEE80211_AGGR_BAWMAX\t64\t/* max block ack window size */\n/* threshold for aging overlapping non-HT bss */\n#define\tIEEE80211_NONHT_PRESENT_AGE\tmsecs_to_ticks(60*1000)\n\nstruct ieee80211_tx_ampdu {\n\tstruct ieee80211_node *txa_ni;\t/* back pointer */\n\tu_short\t\ttxa_flags;\n#define\tIEEE80211_AGGR_IMMEDIATE\t0x0001\t/* BA policy */\n#define\tIEEE80211_AGGR_XCHGPEND\t\t0x0002\t/* ADDBA response pending */\n#define\tIEEE80211_AGGR_RUNNING\t\t0x0004\t/* ADDBA response received */\n#define\tIEEE80211_AGGR_SETUP\t\t0x0008\t/* deferred state setup */\n#define\tIEEE80211_AGGR_NAK\t\t0x0010\t/* peer NAK'd ADDBA request */\n#define\tIEEE80211_AGGR_BARPEND\t\t0x0020\t/* BAR response pending */\n\tuint8_t\t\ttxa_ac;\n\tuint8_t\t\ttxa_token;\t/* dialog token */\n\tint\t\ttxa_lastsample;\t/* ticks @ last traffic sample */\n\tint\t\ttxa_pkts;\t/* packets over last sample interval */\n\tint\t\ttxa_avgpps;\t/* filtered traffic over window */\n\tint\t\ttxa_qbytes;\t/* data queued (bytes) */\n\tshort\t\ttxa_qframes;\t/* data queued (frames) */\n\tieee80211_seq\ttxa_start;\t/* BA window left edge */\n\tieee80211_seq\ttxa_seqpending;\t/* new txa_start pending BAR response */\n\tuint16_t\ttxa_wnd;\t/* BA window size */\n\tuint8_t\t\ttxa_attempts;\t/* # ADDBA/BAR requests w/o a response*/\n\tint\t\ttxa_nextrequest;/* soonest to make next request */\n\tstruct callout\ttxa_timer;\n\tvoid\t\t*txa_private;\t/* driver-private storage */\n\tuint64_t\ttxa_pad[4];\n};\n\n/* return non-zero if AMPDU tx for the TID is running */\n#define\tIEEE80211_AMPDU_RUNNING(tap) \\\n\t(((tap)->txa_flags & IEEE80211_AGGR_RUNNING) != 0)\n\n/* return non-zero if AMPDU tx for the TID is running or started */\n#define\tIEEE80211_AMPDU_REQUESTED(tap) \\\n\t(((tap)->txa_flags & \\\n\t (IEEE80211_AGGR_RUNNING|IEEE80211_AGGR_XCHGPEND|IEEE80211_AGGR_NAK)) != 0)\n\n#define\tIEEE80211_AGGR_BITS \\\n\t\"\\20\\1IMMEDIATE\\2XCHGPEND\\3RUNNING\\4SETUP\\5NAK\"\n\n/*\n * Traffic estimator support.  We estimate packets/sec for\n * each AC that is setup for AMPDU or will potentially be\n * setup for AMPDU.  The traffic rate can be used to decide\n * when AMPDU should be setup (according to a threshold)\n * and is available for drivers to do things like cache\n * eviction when only a limited number of BA streams are\n * available and more streams are requested than available.\n */\n\nstatic __inline void\nieee80211_txampdu_update_pps(struct ieee80211_tx_ampdu *tap)\n{\n\t/* NB: scale factor of 2 was picked heuristically */\n\ttap->txa_avgpps = ((tap->txa_avgpps << 2) -\n\t     tap->txa_avgpps + tap->txa_pkts) >> 2;\n}\n\n/*\n * Count a packet towards the pps estimate.\n */\nstatic __inline void\nieee80211_txampdu_count_packet(struct ieee80211_tx_ampdu *tap)\n{\n\t/* XXX bound loop/do more crude estimate? */\n\twhile (ticks - tap->txa_lastsample >= hz) {\n\t\tieee80211_txampdu_update_pps(tap);\n\t\t/* reset to start new sample interval */\n\t\ttap->txa_pkts = 0;\n\t\tif (tap->txa_avgpps == 0) {\n\t\t\ttap->txa_lastsample = ticks;\n\t\t\tbreak;\n\t\t}\n\t\ttap->txa_lastsample += hz;\n\t}\n\ttap->txa_pkts++;\n}\n\n/*\n * Get the current pps estimate.  If the average is out of\n * date due to lack of traffic then we decay the estimate\n * to account for the idle time.\n */\nstatic __inline int\nieee80211_txampdu_getpps(struct ieee80211_tx_ampdu *tap)\n{\n\t/* XXX bound loop/do more crude estimate? */\n\twhile (ticks - tap->txa_lastsample >= hz) {\n\t\tieee80211_txampdu_update_pps(tap);\n\t\ttap->txa_pkts = 0;\n\t\tif (tap->txa_avgpps == 0) {\n\t\t\ttap->txa_lastsample = ticks;\n\t\t\tbreak;\n\t\t}\n\t\ttap->txa_lastsample += hz;\n\t}\n\treturn tap->txa_avgpps;\n}\n\nstruct ieee80211_rx_ampdu {\n\tint\t\trxa_flags;\n\tint\t\trxa_qbytes;\t/* data queued (bytes) */\n\tshort\t\trxa_qframes;\t/* data queued (frames) */\n\tieee80211_seq\trxa_seqstart;\n\tieee80211_seq\trxa_start;\t/* start of current BA window */\n\tuint16_t\trxa_wnd;\t/* BA window size */\n\tint\t\trxa_age;\t/* age of oldest frame in window */\n\tint\t\trxa_nframes;\t/* frames since ADDBA */\n\tstruct mbuf *rxa_m[IEEE80211_AGGR_BAWMAX];\n\tvoid\t\t*rxa_private;\n\tuint64_t\trxa_pad[3];\n};\n\nvoid\tieee80211_ht_attach(struct ieee80211com *);\nvoid\tieee80211_ht_detach(struct ieee80211com *);\nvoid\tieee80211_ht_vattach(struct ieee80211vap *);\nvoid\tieee80211_ht_vdetach(struct ieee80211vap *);\n\nvoid\tieee80211_ht_announce(struct ieee80211com *);\n\nstruct ieee80211_mcs_rates {\n\tuint16_t\tht20_rate_800ns;\n\tuint16_t\tht20_rate_400ns;\n\tuint16_t\tht40_rate_800ns;\n\tuint16_t\tht40_rate_400ns;\n};\nextern const struct ieee80211_mcs_rates ieee80211_htrates[];\nconst struct ieee80211_htrateset *ieee80211_get_suphtrates(\n\t\tstruct ieee80211com *, const struct ieee80211_channel *);\n\nstruct ieee80211_node;\nint\tieee80211_setup_htrates(struct ieee80211_node *,\n\t\tconst uint8_t *htcap, int flags);\nvoid\tieee80211_setup_basic_htrates(struct ieee80211_node *,\n\t\tconst uint8_t *htinfo);\nstruct mbuf *ieee80211_decap_amsdu(struct ieee80211_node *, struct mbuf *);\nint\tieee80211_ampdu_reorder(struct ieee80211_node *, struct mbuf *);\nvoid\tieee80211_recv_bar(struct ieee80211_node *, struct mbuf *);\nvoid\tieee80211_ht_node_init(struct ieee80211_node *);\nvoid\tieee80211_ht_node_cleanup(struct ieee80211_node *);\nvoid\tieee80211_ht_node_age(struct ieee80211_node *);\n\nstruct ieee80211_channel *ieee80211_ht_adjust_channel(struct ieee80211com *,\n\t\tstruct ieee80211_channel *, int);\nvoid\tieee80211_ht_wds_init(struct ieee80211_node *);\nvoid\tieee80211_ht_node_join(struct ieee80211_node *);\nvoid\tieee80211_ht_node_leave(struct ieee80211_node *);\nvoid\tieee80211_htprot_update(struct ieee80211com *, int protmode);\nvoid\tieee80211_ht_timeout(struct ieee80211com *);\nvoid\tieee80211_parse_htcap(struct ieee80211_node *, const uint8_t *);\nvoid\tieee80211_parse_htinfo(struct ieee80211_node *, const uint8_t *);\nvoid\tieee80211_ht_updateparams(struct ieee80211_node *, const uint8_t *,\n\t\tconst uint8_t *);\nvoid\tieee80211_ht_updatehtcap(struct ieee80211_node *, const uint8_t *);\nint\tieee80211_ampdu_request(struct ieee80211_node *,\n\t\tstruct ieee80211_tx_ampdu *);\nvoid\tieee80211_ampdu_stop(struct ieee80211_node *,\n\t\tstruct ieee80211_tx_ampdu *, int);\nint\tieee80211_send_bar(struct ieee80211_node *, struct ieee80211_tx_ampdu *,\n\t\tieee80211_seq);\nuint8_t\t*ieee80211_add_htcap(uint8_t *, struct ieee80211_node *);\nuint8_t\t*ieee80211_add_htcap_vendor(uint8_t *, struct ieee80211_node *);\nuint8_t\t*ieee80211_add_htinfo(uint8_t *, struct ieee80211_node *);\nuint8_t\t*ieee80211_add_htinfo_vendor(uint8_t *, struct ieee80211_node *);\nstruct ieee80211_beacon_offsets;\nvoid\tieee80211_ht_update_beacon(struct ieee80211vap *,\n\t\tstruct ieee80211_beacon_offsets *);\n#endif /* _NET80211_IEEE80211_HT_H_ */\n"
  },
  {
    "path": "freebsd-headers/net80211/ieee80211_input.h",
    "content": "/*-\n * Copyright (c) 2007-2009 Sam Leffler, Errno Consulting\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR\n * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES\n * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,\n * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF\n * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/net80211/ieee80211_input.h 221418 2011-05-04 02:23:59Z adrian $\n */\n#ifndef _NET80211_IEEE80211_INPUT_H_\n#define _NET80211_IEEE80211_INPUT_H_\n\n/* Verify the existence and length of __elem or get out. */\n#define IEEE80211_VERIFY_ELEMENT(__elem, __maxlen, _action) do {\t\\\n\tif ((__elem) == NULL) {\t\t\t\t\t\t\\\n\t\tIEEE80211_DISCARD(vap, IEEE80211_MSG_ELEMID,\t\t\\\n\t\t    wh, NULL, \"%s\", \"no \" #__elem );\t\t\t\\\n\t\tvap->iv_stats.is_rx_elem_missing++;\t\t\t\\\n\t\t_action;\t\t\t\t\t\t\\\n\t} else if ((__elem)[1] > (__maxlen)) {\t\t\t\t\\\n\t\tIEEE80211_DISCARD(vap, IEEE80211_MSG_ELEMID,\t\t\\\n\t\t    wh, NULL, \"bad \" #__elem \" len %d\", (__elem)[1]);\t\\\n\t\tvap->iv_stats.is_rx_elem_toobig++;\t\t\t\\\n\t\t_action;\t\t\t\t\t\t\\\n\t}\t\t\t\t\t\t\t\t\\\n} while (0)\n\n#define\tIEEE80211_VERIFY_LENGTH(_len, _minlen, _action) do {\t\t\\\n\tif ((_len) < (_minlen)) {\t\t\t\t\t\\\n\t\tIEEE80211_DISCARD(vap, IEEE80211_MSG_ELEMID,\t\t\\\n\t\t    wh, NULL, \"ie too short, got %d, expected %d\",\t\\\n\t\t    (_len), (_minlen));\t\t\t\t\t\\\n\t\tvap->iv_stats.is_rx_elem_toosmall++;\t\t\t\\\n\t\t_action;\t\t\t\t\t\t\\\n\t}\t\t\t\t\t\t\t\t\\\n} while (0)\n\n#ifdef IEEE80211_DEBUG\nvoid\tieee80211_ssid_mismatch(struct ieee80211vap *, const char *tag,\n\tuint8_t mac[IEEE80211_ADDR_LEN], uint8_t *ssid);\n\n#define\tIEEE80211_VERIFY_SSID(_ni, _ssid, _action) do {\t\t\t\\\n\tif ((_ssid)[1] != 0 &&\t\t\t\t\t\t\\\n\t    ((_ssid)[1] != (_ni)->ni_esslen ||\t\t\t\t\\\n\t    memcmp((_ssid) + 2, (_ni)->ni_essid, (_ssid)[1]) != 0)) {\t\\\n\t\tif (ieee80211_msg_input(vap))\t\t\t\t\\\n\t\t\tieee80211_ssid_mismatch(vap, \t\t\t\\\n\t\t\t    ieee80211_mgt_subtype_name[subtype >>\t\\\n\t\t\t\tIEEE80211_FC0_SUBTYPE_SHIFT],\t\t\\\n\t\t\t\twh->i_addr2, _ssid);\t\t\t\\\n\t\tvap->iv_stats.is_rx_ssidmismatch++;\t\t\t\\\n\t\t_action;\t\t\t\t\t\t\\\n\t}\t\t\t\t\t\t\t\t\\\n} while (0)\n#else /* !IEEE80211_DEBUG */\n#define\tIEEE80211_VERIFY_SSID(_ni, _ssid, _action) do {\t\t\t\\\n\tif ((_ssid)[1] != 0 &&\t\t\t\t\t\t\\\n\t    ((_ssid)[1] != (_ni)->ni_esslen ||\t\t\t\t\\\n\t    memcmp((_ssid) + 2, (_ni)->ni_essid, (_ssid)[1]) != 0)) {\t\\\n\t\tvap->iv_stats.is_rx_ssidmismatch++;\t\t\t\\\n\t\t_action;\t\t\t\t\t\t\\\n\t}\t\t\t\t\t\t\t\t\\\n} while (0)\n#endif /* !IEEE80211_DEBUG */\n\n/* unalligned little endian access */     \n#define LE_READ_2(p)\t\t\t\t\t\\\n\t((uint16_t)\t\t\t\t\t\\\n\t ((((const uint8_t *)(p))[0]      ) |\t\t\\\n\t  (((const uint8_t *)(p))[1] <<  8)))\n#define LE_READ_4(p)\t\t\t\t\t\\\n\t((uint32_t)\t\t\t\t\t\\\n\t ((((const uint8_t *)(p))[0]      ) |\t\t\\\n\t  (((const uint8_t *)(p))[1] <<  8) |\t\t\\\n\t  (((const uint8_t *)(p))[2] << 16) |\t\t\\\n\t  (((const uint8_t *)(p))[3] << 24)))\n\nstatic __inline int\niswpaoui(const uint8_t *frm)\n{\n\treturn frm[1] > 3 && LE_READ_4(frm+2) == ((WPA_OUI_TYPE<<24)|WPA_OUI);\n}\n\nstatic __inline int\niswmeoui(const uint8_t *frm)\n{\n\treturn frm[1] > 3 && LE_READ_4(frm+2) == ((WME_OUI_TYPE<<24)|WME_OUI);\n}\n\nstatic __inline int\niswmeparam(const uint8_t *frm)\n{\n\treturn frm[1] > 5 && LE_READ_4(frm+2) == ((WME_OUI_TYPE<<24)|WME_OUI) &&\n\t\tfrm[6] == WME_PARAM_OUI_SUBTYPE;\n}\n\nstatic __inline int\niswmeinfo(const uint8_t *frm)\n{\n\treturn frm[1] > 5 && LE_READ_4(frm+2) == ((WME_OUI_TYPE<<24)|WME_OUI) &&\n\t\tfrm[6] == WME_INFO_OUI_SUBTYPE;\n}\n\nstatic __inline int\nisatherosoui(const uint8_t *frm)\n{\n\treturn frm[1] > 3 && LE_READ_4(frm+2) == ((ATH_OUI_TYPE<<24)|ATH_OUI);\n}\n\nstatic __inline int\nistdmaoui(const uint8_t *frm)\n{\n\treturn frm[1] > 3 && LE_READ_4(frm+2) == ((TDMA_OUI_TYPE<<24)|TDMA_OUI);\n}\n\nstatic __inline int\nishtcapoui(const uint8_t *frm)\n{\n\treturn frm[1] > 3 && LE_READ_4(frm+2) == ((BCM_OUI_HTCAP<<24)|BCM_OUI);\n}\n\nstatic __inline int\nishtinfooui(const uint8_t *frm)\n{\n\treturn frm[1] > 3 && LE_READ_4(frm+2) == ((BCM_OUI_HTINFO<<24)|BCM_OUI);\n}\n\n#include <sys/endian.h>\t\t/* For le16toh() */\n\n/*\n * Check the current frame sequence number against the current TID\n * state and return whether it's in sequence or should be dropped.\n *\n * Since out of order packet and duplicate packet eliminations should\n * be done by the AMPDU RX code, this routine blindly accepts all\n * frames from a HT station w/ a TID that is currently doing AMPDU-RX.\n * HT stations without WME or where the TID is not doing AMPDU-RX\n * are checked like non-HT stations.\n *\n * The routine only eliminates packets whose sequence/fragment\n * match or are less than the last seen sequence/fragment number\n * AND are retransmits It doesn't try to eliminate out of order packets.\n *\n * Since all frames after sequence number 4095 will be less than 4095\n * (as the seqnum wraps), handle that special case so packets aren't\n * incorrectly dropped - ie, if the next packet is sequence number 0\n * but a retransmit since the initial packet didn't make it.\n */\nstatic __inline int\nieee80211_check_rxseq(struct ieee80211_node *ni, struct ieee80211_frame *wh)\n{\n#define\tSEQ_LEQ(a,b)\t((int)((a)-(b)) <= 0)\n#define\tSEQ_EQ(a,b)\t((int)((a)-(b)) == 0)\n#define\tHAS_SEQ(type)\t((type & 0x4) == 0)\n#define\tSEQNO(a)\t((a) >> IEEE80211_SEQ_SEQ_SHIFT)\n#define\tFRAGNO(a)\t((a) & IEEE80211_SEQ_FRAG_MASK)\n\tuint16_t rxseq;\n\tuint8_t type;\n\tuint8_t tid;\n\tstruct ieee80211_rx_ampdu *rap;\n\n\trxseq = le16toh(*(uint16_t *)wh->i_seq);\n\ttype = wh->i_fc[0] & IEEE80211_FC0_TYPE_MASK;\n\n\t/* Types with no sequence number are always treated valid */\n\tif (! HAS_SEQ(type))\n\t\treturn 1;\n\n\ttid = ieee80211_gettid(wh);\n\n\t/*\n\t * Only do the HT AMPDU check for WME stations; non-WME HT stations\n\t * shouldn't exist outside of debugging. We should at least\n\t * handle that.\n\t */\n\tif (tid < WME_NUM_TID) {\n\t\trap = &ni->ni_rx_ampdu[tid];\n\t\t/* HT nodes currently doing RX AMPDU are always valid */\n\t\tif ((ni->ni_flags & IEEE80211_NODE_HT) &&\n\t\t    (rap->rxa_flags & IEEE80211_AGGR_RUNNING))\n\t\t\treturn 1;\n\t}\n\n\t/*\t\n\t * Otherwise, retries for packets below or equal to the last\n\t * seen sequence number should be dropped.\n\t */\n\n\t/*\n\t * Treat frame seqnum 4095 as special due to boundary\n\t * wrapping conditions.\n\t */\n\tif (SEQNO(ni->ni_rxseqs[tid]) == 4095) {\n\t\t/*\n\t\t * Drop retransmits on seqnum 4095/current fragment for itself.\n\t\t */\n\t\tif (SEQ_EQ(rxseq, ni->ni_rxseqs[tid]) &&\n\t\t    (wh->i_fc[1] & IEEE80211_FC1_RETRY))\n\t\t\treturn 0;\n\t\t/*\n\t\t * Treat any subsequent frame as fine if the last seen frame\n\t\t * is 4095 and it's not a retransmit for the same sequence\n\t\t * number. However, this doesn't capture incorrectly ordered\n\t \t * fragments w/ sequence number 4095. It shouldn't be seen\n\t\t * in practice, but see the comment above for further info.\n\t\t */\n\t\treturn 1;\n\t}\n\n\t/*\n\t * At this point we assume that retransmitted seq/frag numbers below\n\t * the current can simply be eliminated.\n\t */\n\tif ((wh->i_fc[1] & IEEE80211_FC1_RETRY) &&\n\t    SEQ_LEQ(rxseq, ni->ni_rxseqs[tid]))\n\t\treturn 0;\n\n\treturn 1;\n#undef\tSEQ_LEQ\n#undef\tSEQ_EQ\n#undef\tHAS_SEQ\n#undef\tSEQNO\n#undef\tFRAGNO\n}\n\nvoid\tieee80211_deliver_data(struct ieee80211vap *,\n\t\tstruct ieee80211_node *, struct mbuf *);\nstruct mbuf *ieee80211_defrag(struct ieee80211_node *,\n\t\tstruct mbuf *, int);\nstruct mbuf *ieee80211_realign(struct ieee80211vap *, struct mbuf *, size_t);\nstruct mbuf *ieee80211_decap(struct ieee80211vap *, struct mbuf *, int);\nstruct mbuf *ieee80211_decap1(struct mbuf *, int *);\nint\tieee80211_setup_rates(struct ieee80211_node *ni,\n\t\tconst uint8_t *rates, const uint8_t *xrates, int flags);\nvoid ieee80211_send_error(struct ieee80211_node *,\n\t\tconst uint8_t mac[IEEE80211_ADDR_LEN], int subtype, int arg);\nint\tieee80211_alloc_challenge(struct ieee80211_node *);\nint\tieee80211_parse_beacon(struct ieee80211_node *, struct mbuf *,\n\t\tstruct ieee80211_scanparams *);\nint\tieee80211_parse_action(struct ieee80211_node *, struct mbuf *);\n#endif /* _NET80211_IEEE80211_INPUT_H_ */\n"
  },
  {
    "path": "freebsd-headers/net80211/ieee80211_ioctl.h",
    "content": "/*-\n * Copyright (c) 2001 Atsushi Onoe\n * Copyright (c) 2002-2009 Sam Leffler, Errno Consulting\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR\n * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES\n * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,\n * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF\n * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/net80211/ieee80211_ioctl.h 223145 2011-06-16 09:37:20Z kevlo $\n */\n#ifndef _NET80211_IEEE80211_IOCTL_H_\n#define _NET80211_IEEE80211_IOCTL_H_\n\n/*\n * IEEE 802.11 ioctls.\n */\n#include <net80211/_ieee80211.h>\n#include <net80211/ieee80211.h>\n#include <net80211/ieee80211_crypto.h>\n\n/*\n * Per/node (station) statistics.\n */\nstruct ieee80211_nodestats {\n\tuint32_t\tns_rx_data;\t\t/* rx data frames */\n\tuint32_t\tns_rx_mgmt;\t\t/* rx management frames */\n\tuint32_t\tns_rx_ctrl;\t\t/* rx control frames */\n\tuint32_t\tns_rx_ucast;\t\t/* rx unicast frames */\n\tuint32_t\tns_rx_mcast;\t\t/* rx multi/broadcast frames */\n\tuint64_t\tns_rx_bytes;\t\t/* rx data count (bytes) */\n\tuint64_t\tns_rx_beacons;\t\t/* rx beacon frames */\n\tuint32_t\tns_rx_proberesp;\t/* rx probe response frames */\n\n\tuint32_t\tns_rx_dup;\t\t/* rx discard 'cuz dup */\n\tuint32_t\tns_rx_noprivacy;\t/* rx w/ wep but privacy off */\n\tuint32_t\tns_rx_wepfail;\t\t/* rx wep processing failed */\n\tuint32_t\tns_rx_demicfail;\t/* rx demic failed */\n\tuint32_t\tns_rx_decap;\t\t/* rx decapsulation failed */\n\tuint32_t\tns_rx_defrag;\t\t/* rx defragmentation failed */\n\tuint32_t\tns_rx_disassoc;\t\t/* rx disassociation */\n\tuint32_t\tns_rx_deauth;\t\t/* rx deauthentication */\n\tuint32_t\tns_rx_action;\t\t/* rx action */\n\tuint32_t\tns_rx_decryptcrc;\t/* rx decrypt failed on crc */\n\tuint32_t\tns_rx_unauth;\t\t/* rx on unauthorized port */\n\tuint32_t\tns_rx_unencrypted;\t/* rx unecrypted w/ privacy */\n\tuint32_t\tns_rx_drop;\t\t/* rx discard other reason */\n\n\tuint32_t\tns_tx_data;\t\t/* tx data frames */\n\tuint32_t\tns_tx_mgmt;\t\t/* tx management frames */\n\tuint32_t\tns_tx_ctrl;\t\t/* tx control frames */\n\tuint32_t\tns_tx_ucast;\t\t/* tx unicast frames */\n\tuint32_t\tns_tx_mcast;\t\t/* tx multi/broadcast frames */\n\tuint64_t\tns_tx_bytes;\t\t/* tx data count (bytes) */\n\tuint32_t\tns_tx_probereq;\t\t/* tx probe request frames */\n\n\tuint32_t\tns_tx_novlantag;\t/* tx discard 'cuz no tag */\n\tuint32_t\tns_tx_vlanmismatch;\t/* tx discard 'cuz bad tag */\n\n\tuint32_t\tns_ps_discard;\t\t/* ps discard 'cuz of age */\n\n\t/* MIB-related state */\n\tuint32_t\tns_tx_assoc;\t\t/* [re]associations */\n\tuint32_t\tns_tx_assoc_fail;\t/* [re]association failures */\n\tuint32_t\tns_tx_auth;\t\t/* [re]authentications */\n\tuint32_t\tns_tx_auth_fail;\t/* [re]authentication failures*/\n\tuint32_t\tns_tx_deauth;\t\t/* deauthentications */\n\tuint32_t\tns_tx_deauth_code;\t/* last deauth reason */\n\tuint32_t\tns_tx_disassoc;\t\t/* disassociations */\n\tuint32_t\tns_tx_disassoc_code;\t/* last disassociation reason */\n\tuint32_t\tns_spare[8];\n};\n\n/*\n * Summary statistics.\n */\nstruct ieee80211_stats {\n\tuint32_t\tis_rx_badversion;\t/* rx frame with bad version */\n\tuint32_t\tis_rx_tooshort;\t\t/* rx frame too short */\n\tuint32_t\tis_rx_wrongbss;\t\t/* rx from wrong bssid */\n\tuint32_t\tis_rx_dup;\t\t/* rx discard 'cuz dup */\n\tuint32_t\tis_rx_wrongdir;\t\t/* rx w/ wrong direction */\n\tuint32_t\tis_rx_mcastecho;\t/* rx discard 'cuz mcast echo */\n\tuint32_t\tis_rx_notassoc;\t\t/* rx discard 'cuz sta !assoc */\n\tuint32_t\tis_rx_noprivacy;\t/* rx w/ wep but privacy off */\n\tuint32_t\tis_rx_unencrypted;\t/* rx w/o wep and privacy on */\n\tuint32_t\tis_rx_wepfail;\t\t/* rx wep processing failed */\n\tuint32_t\tis_rx_decap;\t\t/* rx decapsulation failed */\n\tuint32_t\tis_rx_mgtdiscard;\t/* rx discard mgt frames */\n\tuint32_t\tis_rx_ctl;\t\t/* rx ctrl frames */\n\tuint32_t\tis_rx_beacon;\t\t/* rx beacon frames */\n\tuint32_t\tis_rx_rstoobig;\t\t/* rx rate set truncated */\n\tuint32_t\tis_rx_elem_missing;\t/* rx required element missing*/\n\tuint32_t\tis_rx_elem_toobig;\t/* rx element too big */\n\tuint32_t\tis_rx_elem_toosmall;\t/* rx element too small */\n\tuint32_t\tis_rx_elem_unknown;\t/* rx element unknown */\n\tuint32_t\tis_rx_badchan;\t\t/* rx frame w/ invalid chan */\n\tuint32_t\tis_rx_chanmismatch;\t/* rx frame chan mismatch */\n\tuint32_t\tis_rx_nodealloc;\t/* rx frame dropped */\n\tuint32_t\tis_rx_ssidmismatch;\t/* rx frame ssid mismatch  */\n\tuint32_t\tis_rx_auth_unsupported;\t/* rx w/ unsupported auth alg */\n\tuint32_t\tis_rx_auth_fail;\t/* rx sta auth failure */\n\tuint32_t\tis_rx_auth_countermeasures;/* rx auth discard 'cuz CM */\n\tuint32_t\tis_rx_assoc_bss;\t/* rx assoc from wrong bssid */\n\tuint32_t\tis_rx_assoc_notauth;\t/* rx assoc w/o auth */\n\tuint32_t\tis_rx_assoc_capmismatch;/* rx assoc w/ cap mismatch */\n\tuint32_t\tis_rx_assoc_norate;\t/* rx assoc w/ no rate match */\n\tuint32_t\tis_rx_assoc_badwpaie;\t/* rx assoc w/ bad WPA IE */\n\tuint32_t\tis_rx_deauth;\t\t/* rx deauthentication */\n\tuint32_t\tis_rx_disassoc;\t\t/* rx disassociation */\n\tuint32_t\tis_rx_badsubtype;\t/* rx frame w/ unknown subtype*/\n\tuint32_t\tis_rx_nobuf;\t\t/* rx failed for lack of buf */\n\tuint32_t\tis_rx_decryptcrc;\t/* rx decrypt failed on crc */\n\tuint32_t\tis_rx_ahdemo_mgt;\t/* rx discard ahdemo mgt frame*/\n\tuint32_t\tis_rx_bad_auth;\t\t/* rx bad auth request */\n\tuint32_t\tis_rx_unauth;\t\t/* rx on unauthorized port */\n\tuint32_t\tis_rx_badkeyid;\t\t/* rx w/ incorrect keyid */\n\tuint32_t\tis_rx_ccmpreplay;\t/* rx seq# violation (CCMP) */\n\tuint32_t\tis_rx_ccmpformat;\t/* rx format bad (CCMP) */\n\tuint32_t\tis_rx_ccmpmic;\t\t/* rx MIC check failed (CCMP) */\n\tuint32_t\tis_rx_tkipreplay;\t/* rx seq# violation (TKIP) */\n\tuint32_t\tis_rx_tkipformat;\t/* rx format bad (TKIP) */\n\tuint32_t\tis_rx_tkipmic;\t\t/* rx MIC check failed (TKIP) */\n\tuint32_t\tis_rx_tkipicv;\t\t/* rx ICV check failed (TKIP) */\n\tuint32_t\tis_rx_badcipher;\t/* rx failed 'cuz key type */\n\tuint32_t\tis_rx_nocipherctx;\t/* rx failed 'cuz key !setup */\n\tuint32_t\tis_rx_acl;\t\t/* rx discard 'cuz acl policy */\n\tuint32_t\tis_tx_nobuf;\t\t/* tx failed for lack of buf */\n\tuint32_t\tis_tx_nonode;\t\t/* tx failed for no node */\n\tuint32_t\tis_tx_unknownmgt;\t/* tx of unknown mgt frame */\n\tuint32_t\tis_tx_badcipher;\t/* tx failed 'cuz key type */\n\tuint32_t\tis_tx_nodefkey;\t\t/* tx failed 'cuz no defkey */\n\tuint32_t\tis_tx_noheadroom;\t/* tx failed 'cuz no space */\n\tuint32_t\tis_tx_fragframes;\t/* tx frames fragmented */\n\tuint32_t\tis_tx_frags;\t\t/* tx fragments created */\n\tuint32_t\tis_scan_active;\t\t/* active scans started */\n\tuint32_t\tis_scan_passive;\t/* passive scans started */\n\tuint32_t\tis_node_timeout;\t/* nodes timed out inactivity */\n\tuint32_t\tis_crypto_nomem;\t/* no memory for crypto ctx */\n\tuint32_t\tis_crypto_tkip;\t\t/* tkip crypto done in s/w */\n\tuint32_t\tis_crypto_tkipenmic;\t/* tkip en-MIC done in s/w */\n\tuint32_t\tis_crypto_tkipdemic;\t/* tkip de-MIC done in s/w */\n\tuint32_t\tis_crypto_tkipcm;\t/* tkip counter measures */\n\tuint32_t\tis_crypto_ccmp;\t\t/* ccmp crypto done in s/w */\n\tuint32_t\tis_crypto_wep;\t\t/* wep crypto done in s/w */\n\tuint32_t\tis_crypto_setkey_cipher;/* cipher rejected key */\n\tuint32_t\tis_crypto_setkey_nokey;\t/* no key index for setkey */\n\tuint32_t\tis_crypto_delkey;\t/* driver key delete failed */\n\tuint32_t\tis_crypto_badcipher;\t/* unknown cipher */\n\tuint32_t\tis_crypto_nocipher;\t/* cipher not available */\n\tuint32_t\tis_crypto_attachfail;\t/* cipher attach failed */\n\tuint32_t\tis_crypto_swfallback;\t/* cipher fallback to s/w */\n\tuint32_t\tis_crypto_keyfail;\t/* driver key alloc failed */\n\tuint32_t\tis_crypto_enmicfail;\t/* en-MIC failed */\n\tuint32_t\tis_ibss_capmismatch;\t/* merge failed-cap mismatch */\n\tuint32_t\tis_ibss_norate;\t\t/* merge failed-rate mismatch */\n\tuint32_t\tis_ps_unassoc;\t\t/* ps-poll for unassoc. sta */\n\tuint32_t\tis_ps_badaid;\t\t/* ps-poll w/ incorrect aid */\n\tuint32_t\tis_ps_qempty;\t\t/* ps-poll w/ nothing to send */\n\tuint32_t\tis_ff_badhdr;\t\t/* fast frame rx'd w/ bad hdr */\n\tuint32_t\tis_ff_tooshort;\t\t/* fast frame rx decap error */\n\tuint32_t\tis_ff_split;\t\t/* fast frame rx split error */\n\tuint32_t\tis_ff_decap;\t\t/* fast frames decap'd */\n\tuint32_t\tis_ff_encap;\t\t/* fast frames encap'd for tx */\n\tuint32_t\tis_rx_badbintval;\t/* rx frame w/ bogus bintval */\n\tuint32_t\tis_rx_demicfail;\t/* rx demic failed */\n\tuint32_t\tis_rx_defrag;\t\t/* rx defragmentation failed */\n\tuint32_t\tis_rx_mgmt;\t\t/* rx management frames */\n\tuint32_t\tis_rx_action;\t\t/* rx action mgt frames */\n\tuint32_t\tis_amsdu_tooshort;\t/* A-MSDU rx decap error */\n\tuint32_t\tis_amsdu_split;\t\t/* A-MSDU rx split error */\n\tuint32_t\tis_amsdu_decap;\t\t/* A-MSDU decap'd */\n\tuint32_t\tis_amsdu_encap;\t\t/* A-MSDU encap'd for tx */\n\tuint32_t\tis_ampdu_bar_bad;\t/* A-MPDU BAR out of window */\n\tuint32_t\tis_ampdu_bar_oow;\t/* A-MPDU BAR before ADDBA */\n\tuint32_t\tis_ampdu_bar_move;\t/* A-MPDU BAR moved window */\n\tuint32_t\tis_ampdu_bar_rx;\t/* A-MPDU BAR frames handled */\n\tuint32_t\tis_ampdu_rx_flush;\t/* A-MPDU frames flushed */\n\tuint32_t\tis_ampdu_rx_oor;\t/* A-MPDU frames out-of-order */\n\tuint32_t\tis_ampdu_rx_copy;\t/* A-MPDU frames copied down */\n\tuint32_t\tis_ampdu_rx_drop;\t/* A-MPDU frames dropped */\n\tuint32_t\tis_tx_badstate;\t\t/* tx discard state != RUN */\n\tuint32_t\tis_tx_notassoc;\t\t/* tx failed, sta not assoc */\n\tuint32_t\tis_tx_classify;\t\t/* tx classification failed */\n\tuint32_t\tis_dwds_mcast;\t\t/* discard mcast over dwds */\n\tuint32_t\tis_dwds_qdrop;\t\t/* dwds pending frame q full */\n\tuint32_t\tis_ht_assoc_nohtcap;\t/* non-HT sta rejected */\n\tuint32_t\tis_ht_assoc_downgrade;\t/* HT sta forced to legacy */\n\tuint32_t\tis_ht_assoc_norate;\t/* HT assoc w/ rate mismatch */\n\tuint32_t\tis_ampdu_rx_age;\t/* A-MPDU sent up 'cuz of age */\n\tuint32_t\tis_ampdu_rx_move;\t/* A-MPDU MSDU moved window */\n\tuint32_t\tis_addba_reject;\t/* ADDBA reject 'cuz disabled */\n\tuint32_t\tis_addba_norequest;\t/* ADDBA response w/o ADDBA */\n\tuint32_t\tis_addba_badtoken;\t/* ADDBA response w/ wrong\n\t\t\t\t\t\t   dialogtoken */\n\tuint32_t\tis_addba_badpolicy;\t/* ADDBA resp w/ wrong policy */\n\tuint32_t\tis_ampdu_stop;\t\t/* A-MPDU stream stopped */\n\tuint32_t\tis_ampdu_stop_failed;\t/* A-MPDU stream not running */\n\tuint32_t\tis_ampdu_rx_reorder;\t/* A-MPDU held for rx reorder */\n\tuint32_t\tis_scan_bg;\t\t/* background scans started */\n\tuint8_t\t\tis_rx_deauth_code;\t/* last rx'd deauth reason */\n\tuint8_t\t\tis_rx_disassoc_code;\t/* last rx'd disassoc reason */\n\tuint8_t\t\tis_rx_authfail_code;\t/* last rx'd auth fail reason */\n\tuint32_t\tis_beacon_miss;\t\t/* beacon miss notification */\n\tuint32_t\tis_rx_badstate;\t\t/* rx discard state != RUN */\n\tuint32_t\tis_ff_flush;\t\t/* ff's flush'd from stageq */\n\tuint32_t\tis_tx_ctl;\t\t/* tx ctrl frames */\n\tuint32_t\tis_ampdu_rexmt;\t\t/* A-MPDU frames rexmt ok */\n\tuint32_t\tis_ampdu_rexmt_fail;\t/* A-MPDU frames rexmt fail */\n\n\tuint32_t\tis_mesh_wrongmesh;\t/* dropped 'cuz not mesh sta*/\n\tuint32_t\tis_mesh_nolink;\t\t/* dropped 'cuz link not estab*/\n\tuint32_t\tis_mesh_fwd_ttl;\t/* mesh not fwd'd 'cuz ttl 0 */\n\tuint32_t\tis_mesh_fwd_nobuf;\t/* mesh not fwd'd 'cuz no mbuf*/\n\tuint32_t\tis_mesh_fwd_tooshort;\t/* mesh not fwd'd 'cuz no hdr */\n\tuint32_t\tis_mesh_fwd_disabled;\t/* mesh not fwd'd 'cuz disabled */\n\tuint32_t\tis_mesh_fwd_nopath;\t/* mesh not fwd'd 'cuz path unknown */\n\n\tuint32_t\tis_hwmp_wrongseq;\t/* wrong hwmp seq no. */\n\tuint32_t\tis_hwmp_rootreqs;\t/* root PREQs sent */\n\tuint32_t\tis_hwmp_rootrann;\t/* root RANNs sent */\n\n\tuint32_t\tis_mesh_badae;\t\t/* dropped 'cuz invalid AE */\n\tuint32_t\tis_mesh_rtaddfailed;\t/* route add failed */\n\tuint32_t\tis_mesh_notproxy;\t/* dropped 'cuz not proxying */\n\tuint32_t\tis_rx_badalign;\t\t/* dropped 'cuz misaligned */\n\tuint32_t\tis_hwmp_proxy;\t\t/* PREP for proxy route */\n\t\n\tuint32_t\tis_spare[11];\n};\n\n/*\n * Max size of optional information elements.  We artificially\n * constrain this; it's limited only by the max frame size (and\n * the max parameter size of the wireless extensions).\n */\n#define\tIEEE80211_MAX_OPT_IE\t256\n\n/*\n * WPA/RSN get/set key request.  Specify the key/cipher\n * type and whether the key is to be used for sending and/or\n * receiving.  The key index should be set only when working\n * with global keys (use IEEE80211_KEYIX_NONE for ``no index'').\n * Otherwise a unicast/pairwise key is specified by the bssid\n * (on a station) or mac address (on an ap).  They key length\n * must include any MIC key data; otherwise it should be no\n * more than IEEE80211_KEYBUF_SIZE.\n */\nstruct ieee80211req_key {\n\tuint8_t\t\tik_type;\t/* key/cipher type */\n\tuint8_t\t\tik_pad;\n\tuint16_t\tik_keyix;\t/* key index */\n\tuint8_t\t\tik_keylen;\t/* key length in bytes */\n\tuint8_t\t\tik_flags;\n/* NB: IEEE80211_KEY_XMIT and IEEE80211_KEY_RECV defined elsewhere */\n#define\tIEEE80211_KEY_DEFAULT\t0x80\t/* default xmit key */\n\tuint8_t\t\tik_macaddr[IEEE80211_ADDR_LEN];\n\tuint64_t\tik_keyrsc;\t/* key receive sequence counter */\n\tuint64_t\tik_keytsc;\t/* key transmit sequence counter */\n\tuint8_t\t\tik_keydata[IEEE80211_KEYBUF_SIZE+IEEE80211_MICBUF_SIZE];\n};\n\n/*\n * Delete a key either by index or address.  Set the index\n * to IEEE80211_KEYIX_NONE when deleting a unicast key.\n */\nstruct ieee80211req_del_key {\n\tuint8_t\t\tidk_keyix;\t/* key index */\n\tuint8_t\t\tidk_macaddr[IEEE80211_ADDR_LEN];\n};\n\n/*\n * MLME state manipulation request.  IEEE80211_MLME_ASSOC\n * only makes sense when operating as a station.  The other\n * requests can be used when operating as a station or an\n * ap (to effect a station).\n */\nstruct ieee80211req_mlme {\n\tuint8_t\t\tim_op;\t\t/* operation to perform */\n#define\tIEEE80211_MLME_ASSOC\t\t1\t/* associate station */\n#define\tIEEE80211_MLME_DISASSOC\t\t2\t/* disassociate station */\n#define\tIEEE80211_MLME_DEAUTH\t\t3\t/* deauthenticate station */\n#define\tIEEE80211_MLME_AUTHORIZE\t4\t/* authorize station */\n#define\tIEEE80211_MLME_UNAUTHORIZE\t5\t/* unauthorize station */\n#define\tIEEE80211_MLME_AUTH\t\t6\t/* authenticate station */\n\tuint8_t\t\tim_ssid_len;\t/* length of optional ssid */\n\tuint16_t\tim_reason;\t/* 802.11 reason code */\n\tuint8_t\t\tim_macaddr[IEEE80211_ADDR_LEN];\n\tuint8_t\t\tim_ssid[IEEE80211_NWID_LEN];\n};\n\n/* \n * MAC ACL operations.\n */\nenum {\n\tIEEE80211_MACCMD_POLICY_OPEN\t= 0,\t/* set policy: no ACL's */\n\tIEEE80211_MACCMD_POLICY_ALLOW\t= 1,\t/* set policy: allow traffic */\n\tIEEE80211_MACCMD_POLICY_DENY\t= 2,\t/* set policy: deny traffic */\n\tIEEE80211_MACCMD_FLUSH\t\t= 3,\t/* flush ACL database */\n\tIEEE80211_MACCMD_DETACH\t\t= 4,\t/* detach ACL policy */\n\tIEEE80211_MACCMD_POLICY\t\t= 5,\t/* get ACL policy */\n\tIEEE80211_MACCMD_LIST\t\t= 6,\t/* get ACL database */\n\tIEEE80211_MACCMD_POLICY_RADIUS\t= 7,\t/* set policy: RADIUS managed */\n};\n\nstruct ieee80211req_maclist {\n\tuint8_t\t\tml_macaddr[IEEE80211_ADDR_LEN];\n} __packed;\n\n/*\n * Mesh Routing Table Operations.\n */\nenum {\n\tIEEE80211_MESH_RTCMD_LIST   = 0, /* list HWMP routing table */\n\tIEEE80211_MESH_RTCMD_FLUSH  = 1, /* flush HWMP routing table */\n\tIEEE80211_MESH_RTCMD_ADD    = 2, /* add entry to the table */\n\tIEEE80211_MESH_RTCMD_DELETE = 3, /* delete an entry from the table */\n};\n\nstruct ieee80211req_mesh_route {\n\tuint8_t\t\timr_flags;\n#define\tIEEE80211_MESHRT_FLAGS_VALID\t0x01\n#define\tIEEE80211_MESHRT_FLAGS_PROXY\t0x02\n\tuint8_t\t\timr_dest[IEEE80211_ADDR_LEN];\n\tuint8_t\t\timr_nexthop[IEEE80211_ADDR_LEN];\n\tuint16_t\timr_nhops;\n\tuint8_t\t\timr_pad;\n\tuint32_t\timr_metric;\n\tuint32_t\timr_lifetime;\n\tuint32_t\timr_lastmseq;\n};\n\n/*\n * HWMP root modes\n */\nenum {\n\tIEEE80211_HWMP_ROOTMODE_DISABLED\t= 0, \t/* disabled */\n\tIEEE80211_HWMP_ROOTMODE_NORMAL\t\t= 1,\t/* normal PREPs */\n\tIEEE80211_HWMP_ROOTMODE_PROACTIVE\t= 2,\t/* proactive PREPS */\n\tIEEE80211_HWMP_ROOTMODE_RANN\t\t= 3,\t/* use RANN elemid */\n};\n\n\n/*\n * Set the active channel list by IEEE channel #: each channel\n * to be marked active is set in a bit vector.  Note this list is\n * intersected with the available channel list in calculating\n * the set of channels actually used in scanning.\n */\nstruct ieee80211req_chanlist {\n\tuint8_t\t\tic_channels[32];\t/* NB: can be variable length */\n};\n\n/*\n * Get the active channel list info.\n */\nstruct ieee80211req_chaninfo {\n\tu_int\tic_nchans;\n\tstruct ieee80211_channel ic_chans[1];\t/* NB: variable length */\n};\n#define\tIEEE80211_CHANINFO_SIZE(_nchan) \\\n\t(sizeof(struct ieee80211req_chaninfo) + \\\n\t (((_nchan)-1) * sizeof(struct ieee80211_channel)))\n#define\tIEEE80211_CHANINFO_SPACE(_ci) \\\n\tIEEE80211_CHANINFO_SIZE((_ci)->ic_nchans)\n\n/*\n * Retrieve the WPA/RSN information element for an associated station.\n */\nstruct ieee80211req_wpaie {\t/* old version w/ only one ie */\n\tuint8_t\t\twpa_macaddr[IEEE80211_ADDR_LEN];\n\tuint8_t\t\twpa_ie[IEEE80211_MAX_OPT_IE];\n};\nstruct ieee80211req_wpaie2 {\n\tuint8_t\t\twpa_macaddr[IEEE80211_ADDR_LEN];\n\tuint8_t\t\twpa_ie[IEEE80211_MAX_OPT_IE];\n\tuint8_t\t\trsn_ie[IEEE80211_MAX_OPT_IE];\n};\n\n/*\n * Retrieve per-node statistics.\n */\nstruct ieee80211req_sta_stats {\n\tunion {\n\t\t/* NB: explicitly force 64-bit alignment */\n\t\tuint8_t\t\tmacaddr[IEEE80211_ADDR_LEN];\n\t\tuint64_t\tpad;\n\t} is_u;\n\tstruct ieee80211_nodestats is_stats;\n};\n\n/*\n * Station information block; the mac address is used\n * to retrieve other data like stats, unicast key, etc.\n */\nstruct ieee80211req_sta_info {\n\tuint16_t\tisi_len;\t\t/* total length (mult of 4) */\n\tuint16_t\tisi_ie_off;\t\t/* offset to IE data */\n\tuint16_t\tisi_ie_len;\t\t/* IE length */\n\tuint16_t\tisi_freq;\t\t/* MHz */\n\tuint32_t\tisi_flags;\t\t/* channel flags */\n\tuint32_t\tisi_state;\t\t/* state flags */\n\tuint8_t\t\tisi_authmode;\t\t/* authentication algorithm */\n\tint8_t\t\tisi_rssi;\t\t/* receive signal strength */\n\tint8_t\t\tisi_noise;\t\t/* noise floor */\n\tuint8_t\t\tisi_capinfo;\t\t/* capabilities */\n\tuint8_t\t\tisi_erp;\t\t/* ERP element */\n\tuint8_t\t\tisi_macaddr[IEEE80211_ADDR_LEN];\n\tuint8_t\t\tisi_nrates;\n\t\t\t\t\t\t/* negotiated rates */\n\tuint8_t\t\tisi_rates[IEEE80211_RATE_MAXSIZE];\n\tuint8_t\t\tisi_txrate;\t\t/* legacy/IEEE rate or MCS */\n\tuint16_t\tisi_associd;\t\t/* assoc response */\n\tuint16_t\tisi_txpower;\t\t/* current tx power */\n\tuint16_t\tisi_vlan;\t\t/* vlan tag */\n\t/* NB: [IEEE80211_NONQOS_TID] holds seq#'s for non-QoS stations */\n\tuint16_t\tisi_txseqs[IEEE80211_TID_SIZE];/* tx seq #/TID */\n\tuint16_t\tisi_rxseqs[IEEE80211_TID_SIZE];/* rx seq#/TID */\n\tuint16_t\tisi_inact;\t\t/* inactivity timer */\n\tuint16_t\tisi_txmbps;\t\t/* current tx rate in .5 Mb/s */\n\tuint16_t\tisi_pad;\n\tuint32_t\tisi_jointime;\t\t/* time of assoc/join */\n\tstruct ieee80211_mimo_info isi_mimo;\t/* MIMO info for 11n sta's */\n\t/* 11s info */\n\tuint16_t\tisi_peerid;\n\tuint16_t\tisi_localid;\n\tuint8_t\t\tisi_peerstate;\n\t/* XXX frag state? */\n\t/* variable length IE data */\n};\n\n/*\n * Retrieve per-station information; to retrieve all\n * specify a mac address of ff:ff:ff:ff:ff:ff.\n */\nstruct ieee80211req_sta_req {\n\tunion {\n\t\t/* NB: explicitly force 64-bit alignment */\n\t\tuint8_t\t\tmacaddr[IEEE80211_ADDR_LEN];\n\t\tuint64_t\tpad;\n\t} is_u;\n\tstruct ieee80211req_sta_info info[1];\t/* variable length */\n};\n\n/*\n * Get/set per-station tx power cap.\n */\nstruct ieee80211req_sta_txpow {\n\tuint8_t\t\tit_macaddr[IEEE80211_ADDR_LEN];\n\tuint8_t\t\tit_txpow;\n};\n\n/*\n * WME parameters manipulated with IEEE80211_IOC_WME_CWMIN\n * through IEEE80211_IOC_WME_ACKPOLICY are set and return\n * using i_val and i_len.  i_val holds the value itself.\n * i_len specifies the AC and, as appropriate, then high bit\n * specifies whether the operation is to be applied to the\n * BSS or ourself.\n */\n#define\tIEEE80211_WMEPARAM_SELF\t0x0000\t\t/* parameter applies to self */\n#define\tIEEE80211_WMEPARAM_BSS\t0x8000\t\t/* parameter applies to BSS */\n#define\tIEEE80211_WMEPARAM_VAL\t0x7fff\t\t/* parameter value */\n\n/*\n * Application Information Elements can be appended to a variety\n * of frames with the IEE80211_IOC_APPIE request.  This request\n * piggybacks on a normal ieee80211req; the frame type is passed\n * in i_val as the 802.11 FC0 bytes and the length of the IE data\n * is passed in i_len.  The data is referenced in i_data.  If i_len\n * is zero then any previously configured IE data is removed.  At\n * most IEEE80211_MAX_APPIE data be appened.  Note that multiple\n * IE's can be supplied; the data is treated opaquely.\n */\n#define\tIEEE80211_MAX_APPIE\t1024\t\t/* max app IE data */\n/*\n * Hack: the WPA authenticator uses this mechanism to specify WPA\n * ie's that are used instead of the ones normally constructed using\n * the cipher state setup with separate ioctls.  This avoids issues\n * like the authenticator ordering ie data differently than the\n * net80211 layer and needing to keep separate state for WPA and RSN.\n */\n#define\tIEEE80211_APPIE_WPA \\\n\t(IEEE80211_FC0_TYPE_MGT | IEEE80211_FC0_SUBTYPE_BEACON | \\\n\t IEEE80211_FC0_SUBTYPE_PROBE_RESP)\n\n/*\n * Station mode roaming parameters.  These are maintained\n * per band/mode and control the roaming algorithm.\n */\nstruct ieee80211_roamparams_req {\n\tstruct ieee80211_roamparam params[IEEE80211_MODE_MAX];\n};\n\n/*\n * Transmit parameters.  These can be used to set fixed transmit\n * rate for each operating mode when operating as client or on a\n * per-client basis according to the capabilities of the client\n * (e.g. an 11b client associated to an 11g ap) when operating as\n * an ap.\n *\n * MCS are distinguished from legacy rates by or'ing in 0x80.\n */\nstruct ieee80211_txparams_req {\n\tstruct ieee80211_txparam params[IEEE80211_MODE_MAX];\n};\n\n/*\n * Set regulatory domain state with IEEE80211_IOC_REGDOMAIN.\n * Note this is both the regulatory description and the channel\n * list.  The get request for IEEE80211_IOC_REGDOMAIN returns\n * only the regdomain info; the channel list is obtained\n * separately with IEEE80211_IOC_CHANINFO.\n */\nstruct ieee80211_regdomain_req {\n\tstruct ieee80211_regdomain\trd;\n\tstruct ieee80211req_chaninfo\tchaninfo;\n};\n#define\tIEEE80211_REGDOMAIN_SIZE(_nchan) \\\n\t(sizeof(struct ieee80211_regdomain_req) + \\\n\t (((_nchan)-1) * sizeof(struct ieee80211_channel)))\n#define\tIEEE80211_REGDOMAIN_SPACE(_req) \\\n\tIEEE80211_REGDOMAIN_SIZE((_req)->chaninfo.ic_nchans)\n\n/*\n * Get driver capabilities.  Driver, hardware crypto, and\n * HT/802.11n capabilities, and a table that describes what\n * the radio can do.\n */\nstruct ieee80211_devcaps_req {\n\tuint32_t\tdc_drivercaps;\t\t/* general driver caps */\n\tuint32_t\tdc_cryptocaps;\t\t/* hardware crypto support */\n\tuint32_t\tdc_htcaps;\t\t/* HT/802.11n support */\n\tstruct ieee80211req_chaninfo dc_chaninfo;\n};\n#define\tIEEE80211_DEVCAPS_SIZE(_nchan) \\\n\t(sizeof(struct ieee80211_devcaps_req) + \\\n\t (((_nchan)-1) * sizeof(struct ieee80211_channel)))\n#define\tIEEE80211_DEVCAPS_SPACE(_dc) \\\n\tIEEE80211_DEVCAPS_SIZE((_dc)->dc_chaninfo.ic_nchans)\n\nstruct ieee80211_chanswitch_req {\n\tstruct ieee80211_channel csa_chan;\t/* new channel */\n\tint\t\tcsa_mode;\t\t/* CSA mode */\n\tint\t\tcsa_count;\t\t/* beacon count to switch */\n};\n\n/*\n * Get/set per-station vlan tag.\n */\nstruct ieee80211req_sta_vlan {\n\tuint8_t\t\tsv_macaddr[IEEE80211_ADDR_LEN];\n\tuint16_t\tsv_vlan;\n};\n\n#ifdef __FreeBSD__\n/*\n * FreeBSD-style ioctls.\n */\n/* the first member must be matched with struct ifreq */\nstruct ieee80211req {\n\tchar\t\ti_name[IFNAMSIZ];\t/* if_name, e.g. \"wi0\" */\n\tuint16_t\ti_type;\t\t\t/* req type */\n\tint16_t\t\ti_val;\t\t\t/* Index or simple value */\n\tuint16_t\ti_len;\t\t\t/* Index or simple value */\n\tvoid\t\t*i_data;\t\t/* Extra data */\n};\n#define\tSIOCS80211\t\t _IOW('i', 234, struct ieee80211req)\n#define\tSIOCG80211\t\t_IOWR('i', 235, struct ieee80211req)\n#define\tSIOCG80211STATS\t\t_IOWR('i', 236, struct ifreq)\n\n#define IEEE80211_IOC_SSID\t\t1\n#define IEEE80211_IOC_NUMSSIDS\t\t2\n#define IEEE80211_IOC_WEP\t\t3\n#define \tIEEE80211_WEP_NOSUP\t-1\n#define \tIEEE80211_WEP_OFF\t0\n#define \tIEEE80211_WEP_ON\t1\n#define \tIEEE80211_WEP_MIXED\t2\n#define IEEE80211_IOC_WEPKEY\t\t4\n#define IEEE80211_IOC_NUMWEPKEYS\t5\n#define IEEE80211_IOC_WEPTXKEY\t\t6\n#define IEEE80211_IOC_AUTHMODE\t\t7\n#define IEEE80211_IOC_STATIONNAME\t8\n#define IEEE80211_IOC_CHANNEL\t\t9\n#define IEEE80211_IOC_POWERSAVE\t\t10\n#define \tIEEE80211_POWERSAVE_NOSUP\t-1\n#define \tIEEE80211_POWERSAVE_OFF\t\t0\n#define \tIEEE80211_POWERSAVE_CAM\t\t1\n#define \tIEEE80211_POWERSAVE_PSP\t\t2\n#define \tIEEE80211_POWERSAVE_PSP_CAM\t3\n#define \tIEEE80211_POWERSAVE_ON\t\tIEEE80211_POWERSAVE_CAM\n#define IEEE80211_IOC_POWERSAVESLEEP\t11\n#define\tIEEE80211_IOC_RTSTHRESHOLD\t12\n#define IEEE80211_IOC_PROTMODE\t\t13\n#define \tIEEE80211_PROTMODE_OFF\t\t0\n#define \tIEEE80211_PROTMODE_CTS\t\t1\n#define \tIEEE80211_PROTMODE_RTSCTS\t2\n#define\tIEEE80211_IOC_TXPOWER\t\t14\t/* global tx power limit */\n#define\tIEEE80211_IOC_BSSID\t\t15\n#define\tIEEE80211_IOC_ROAMING\t\t16\t/* roaming mode */\n#define\tIEEE80211_IOC_PRIVACY\t\t17\t/* privacy invoked */\n#define\tIEEE80211_IOC_DROPUNENCRYPTED\t18\t/* discard unencrypted frames */\n#define\tIEEE80211_IOC_WPAKEY\t\t19\n#define\tIEEE80211_IOC_DELKEY\t\t20\n#define\tIEEE80211_IOC_MLME\t\t21\n/* 22 was IEEE80211_IOC_OPTIE, replaced by IEEE80211_IOC_APPIE */\n/* 23 was IEEE80211_IOC_SCAN_REQ */\n/* 24 was IEEE80211_IOC_SCAN_RESULTS */\n#define\tIEEE80211_IOC_COUNTERMEASURES\t25\t/* WPA/TKIP countermeasures */\n#define\tIEEE80211_IOC_WPA\t\t26\t/* WPA mode (0,1,2) */\n#define\tIEEE80211_IOC_CHANLIST\t\t27\t/* channel list */\n#define\tIEEE80211_IOC_WME\t\t28\t/* WME mode (on, off) */\n#define\tIEEE80211_IOC_HIDESSID\t\t29\t/* hide SSID mode (on, off) */\n#define\tIEEE80211_IOC_APBRIDGE\t\t30\t/* AP inter-sta bridging */\n/* 31-35,37-38 were for WPA authenticator settings */\n/* 36 was IEEE80211_IOC_DRIVER_CAPS */\n#define\tIEEE80211_IOC_WPAIE\t\t39\t/* WPA information element */\n#define\tIEEE80211_IOC_STA_STATS\t\t40\t/* per-station statistics */\n#define\tIEEE80211_IOC_MACCMD\t\t41\t/* MAC ACL operation */\n#define\tIEEE80211_IOC_CHANINFO\t\t42\t/* channel info list */\n#define\tIEEE80211_IOC_TXPOWMAX\t\t43\t/* max tx power for channel */\n#define\tIEEE80211_IOC_STA_TXPOW\t\t44\t/* per-station tx power limit */\n/* 45 was IEEE80211_IOC_STA_INFO */\n#define\tIEEE80211_IOC_WME_CWMIN\t\t46\t/* WME: ECWmin */\n#define\tIEEE80211_IOC_WME_CWMAX\t\t47\t/* WME: ECWmax */\n#define\tIEEE80211_IOC_WME_AIFS\t\t48\t/* WME: AIFSN */\n#define\tIEEE80211_IOC_WME_TXOPLIMIT\t49\t/* WME: txops limit */\n#define\tIEEE80211_IOC_WME_ACM\t\t50\t/* WME: ACM (bss only) */\n#define\tIEEE80211_IOC_WME_ACKPOLICY\t51\t/* WME: ACK policy (!bss only)*/\n#define\tIEEE80211_IOC_DTIM_PERIOD\t52\t/* DTIM period (beacons) */\n#define\tIEEE80211_IOC_BEACON_INTERVAL\t53\t/* beacon interval (ms) */\n#define\tIEEE80211_IOC_ADDMAC\t\t54\t/* add sta to MAC ACL table */\n#define\tIEEE80211_IOC_DELMAC\t\t55\t/* del sta from MAC ACL table */\n#define\tIEEE80211_IOC_PUREG\t\t56\t/* pure 11g (no 11b stations) */\n#define\tIEEE80211_IOC_FF\t\t57\t/* ATH fast frames (on, off) */\n#define\tIEEE80211_IOC_TURBOP\t\t58\t/* ATH turbo' (on, off) */\n#define\tIEEE80211_IOC_BGSCAN\t\t59\t/* bg scanning (on, off) */\n#define\tIEEE80211_IOC_BGSCAN_IDLE\t60\t/* bg scan idle threshold */\n#define\tIEEE80211_IOC_BGSCAN_INTERVAL\t61\t/* bg scan interval */\n#define\tIEEE80211_IOC_SCANVALID\t\t65\t/* scan cache valid threshold */\n/* 66-72 were IEEE80211_IOC_ROAM_* and IEEE80211_IOC_MCAST_RATE */\n#define\tIEEE80211_IOC_FRAGTHRESHOLD\t73\t/* tx fragmentation threshold */\n#define\tIEEE80211_IOC_BURST\t\t75\t/* packet bursting */\n#define\tIEEE80211_IOC_SCAN_RESULTS\t76\t/* get scan results */\n#define\tIEEE80211_IOC_BMISSTHRESHOLD\t77\t/* beacon miss threshold */\n#define\tIEEE80211_IOC_STA_INFO\t\t78\t/* station/neighbor info */\n#define\tIEEE80211_IOC_WPAIE2\t\t79\t/* WPA+RSN info elements */\n#define\tIEEE80211_IOC_CURCHAN\t\t80\t/* current channel */\n#define\tIEEE80211_IOC_SHORTGI\t\t81\t/* 802.11n half GI */\n#define\tIEEE80211_IOC_AMPDU\t\t82\t/* 802.11n A-MPDU (on, off) */\n#define\tIEEE80211_IOC_AMPDU_LIMIT\t83\t/* A-MPDU length limit */\n#define\tIEEE80211_IOC_AMPDU_DENSITY\t84\t/* A-MPDU density */\n#define\tIEEE80211_IOC_AMSDU\t\t85\t/* 802.11n A-MSDU (on, off) */\n#define\tIEEE80211_IOC_AMSDU_LIMIT\t86\t/* A-MSDU length limit */\n#define\tIEEE80211_IOC_PUREN\t\t87\t/* pure 11n (no legacy sta's) */\n#define\tIEEE80211_IOC_DOTH\t\t88\t/* 802.11h (on, off) */\n/* 89-91 were regulatory items */\n#define\tIEEE80211_IOC_HTCOMPAT\t\t92\t/* support pre-D1.10 HT ie's */\n#define\tIEEE80211_IOC_DWDS\t\t93\t/* DWDS/4-address handling */\n#define\tIEEE80211_IOC_INACTIVITY\t94\t/* sta inactivity handling */\n#define\tIEEE80211_IOC_APPIE\t\t95\t/* application IE's */\n#define\tIEEE80211_IOC_WPS\t\t96\t/* WPS operation */\n#define\tIEEE80211_IOC_TSN\t\t97\t/* TSN operation */\n#define\tIEEE80211_IOC_DEVCAPS\t\t98\t/* driver+device capabilities */\n#define\tIEEE80211_IOC_CHANSWITCH\t99\t/* start 11h channel switch */\n#define\tIEEE80211_IOC_DFS\t\t100\t/* DFS (on, off) */\n#define\tIEEE80211_IOC_DOTD\t\t101\t/* 802.11d (on, off) */\n#define IEEE80211_IOC_HTPROTMODE\t102\t/* HT protection (off, rts) */\n#define\tIEEE80211_IOC_SCAN_REQ\t\t103\t/* scan w/ specified params */\n#define\tIEEE80211_IOC_SCAN_CANCEL\t104\t/* cancel ongoing scan */\n#define\tIEEE80211_IOC_HTCONF\t\t105\t/* HT config (off, HT20, HT40)*/\n#define\tIEEE80211_IOC_REGDOMAIN\t\t106\t/* regulatory domain info */\n#define\tIEEE80211_IOC_ROAM\t\t107\t/* roaming params en masse */\n#define\tIEEE80211_IOC_TXPARAMS\t\t108\t/* tx parameters */\n#define\tIEEE80211_IOC_STA_VLAN\t\t109\t/* per-station vlan tag */\n#define\tIEEE80211_IOC_SMPS\t\t110\t/* MIMO power save */\n#define\tIEEE80211_IOC_RIFS\t\t111\t/* RIFS config (on, off) */\n#define\tIEEE80211_IOC_GREENFIELD\t112\t/* Greenfield (on, off) */\n#define\tIEEE80211_IOC_STBC\t\t113\t/* STBC Tx/RX (on, off) */\n\n#define\tIEEE80211_IOC_MESH_ID\t\t170\t/* mesh identifier */\n#define\tIEEE80211_IOC_MESH_AP\t\t171\t/* accepting peerings */\n#define\tIEEE80211_IOC_MESH_FWRD\t\t172\t/* forward frames */\n#define\tIEEE80211_IOC_MESH_PROTO\t173\t/* mesh protocols */\n#define\tIEEE80211_IOC_MESH_TTL\t\t174\t/* mesh TTL */\n#define\tIEEE80211_IOC_MESH_RTCMD\t175\t/* mesh routing table commands*/\n#define\tIEEE80211_IOC_MESH_PR_METRIC\t176\t/* mesh metric protocol */\n#define\tIEEE80211_IOC_MESH_PR_PATH\t177\t/* mesh path protocol */\n#define\tIEEE80211_IOC_MESH_PR_SIG\t178\t/* mesh sig protocol */\n#define\tIEEE80211_IOC_MESH_PR_CC\t179\t/* mesh congestion protocol */\n#define\tIEEE80211_IOC_MESH_PR_AUTH\t180\t/* mesh auth protocol */\n\n#define\tIEEE80211_IOC_HWMP_ROOTMODE\t190\t/* HWMP root mode */\n#define\tIEEE80211_IOC_HWMP_MAXHOPS\t191\t/* number of hops before drop */\n#define\tIEEE80211_IOC_HWMP_TTL\t\t192\t/* HWMP TTL */\n\n#define\tIEEE80211_IOC_TDMA_SLOT\t\t201\t/* TDMA: assigned slot */\n#define\tIEEE80211_IOC_TDMA_SLOTCNT\t202\t/* TDMA: slots in bss */\n#define\tIEEE80211_IOC_TDMA_SLOTLEN\t203\t/* TDMA: slot length (usecs) */\n#define\tIEEE80211_IOC_TDMA_BINTERVAL\t204\t/* TDMA: beacon intvl (slots) */\n\n/*\n * Parameters for controlling a scan requested with\n * IEEE80211_IOC_SCAN_REQ.\n *\n * Active scans cause ProbeRequest frames to be issued for each\n * specified ssid and, by default, a broadcast ProbeRequest frame.\n * The set of ssid's is specified in the request.\n *\n * By default the scan will cause a BSS to be joined (in station/adhoc\n * mode) or a channel to be selected for operation (hostap mode).\n * To disable that specify IEEE80211_IOC_SCAN_NOPICK and if the\n *\n * If the station is currently associated to an AP then a scan request\n * will cause the station to leave the current channel and potentially\n * miss frames from the AP.  Alternatively the station may notify the\n * AP that it is going into power save mode before it leaves the channel.\n * This ensures frames for the station are buffered by the AP.  This is\n * termed a ``bg scan'' and is requested with the IEEE80211_IOC_SCAN_BGSCAN\n * flag.  Background scans may take longer than foreground scans and may\n * be preempted by traffic.  If a station is not associated to an AP\n * then a request for a background scan is automatically done in the\n * foreground.\n *\n * The results of the scan request are cached by the system.  This\n * information is aged out and/or invalidated based on events like not\n * being able to associated to an AP.  To flush the current cache\n * contents before doing a scan the IEEE80211_IOC_SCAN_FLUSH flag may\n * be specified.\n *\n * By default the scan will be done until a suitable AP is located\n * or a channel is found for use.  A scan can also be constrained\n * to be done once (IEEE80211_IOC_SCAN_ONCE) or to last for no more\n * than a specified duration.\n */\nstruct ieee80211_scan_req {\n\tint\t\tsr_flags;\n#define\tIEEE80211_IOC_SCAN_NOPICK\t0x00001\t/* scan only, no selection */\n#define\tIEEE80211_IOC_SCAN_ACTIVE\t0x00002\t/* active scan (probe req) */\n#define\tIEEE80211_IOC_SCAN_PICK1ST\t0x00004\t/* ``hey sailor'' mode */\n#define\tIEEE80211_IOC_SCAN_BGSCAN\t0x00008\t/* bg scan, exit ps at end */\n#define\tIEEE80211_IOC_SCAN_ONCE\t\t0x00010\t/* do one complete pass */\n#define\tIEEE80211_IOC_SCAN_NOBCAST\t0x00020\t/* don't send bcast probe req */\n#define\tIEEE80211_IOC_SCAN_NOJOIN\t0x00040\t/* no auto-sequencing */\n#define\tIEEE80211_IOC_SCAN_FLUSH\t0x10000\t/* flush scan cache first */\n#define\tIEEE80211_IOC_SCAN_CHECK\t0x20000\t/* check scan cache first */\n\tu_int\t\tsr_duration;\t\t/* duration (ms) */\n#define\tIEEE80211_IOC_SCAN_DURATION_MIN\t1\n#define\tIEEE80211_IOC_SCAN_DURATION_MAX\t0x7fffffff\n#define\tIEEE80211_IOC_SCAN_FOREVER\tIEEE80211_IOC_SCAN_DURATION_MAX\n\tu_int\t\tsr_mindwell;\t\t/* min channel dwelltime (ms) */\n\tu_int\t\tsr_maxdwell;\t\t/* max channel dwelltime (ms) */\n\tint\t\tsr_nssid;\n#define\tIEEE80211_IOC_SCAN_MAX_SSID\t3\n\tstruct {\n\t\tint\t len;\t\t\t\t/* length in bytes */\n\t\tuint8_t ssid[IEEE80211_NWID_LEN];\t/* ssid contents */\n\t} sr_ssid[IEEE80211_IOC_SCAN_MAX_SSID];\n};\n\n/*\n * Scan result data returned for IEEE80211_IOC_SCAN_RESULTS.\n * Each result is a fixed size structure followed by a variable\n * length SSID and one or more variable length information elements.\n * The size of each variable length item is found in the fixed\n * size structure and the entire length of the record is specified\n * in isr_len.  Result records are rounded to a multiple of 4 bytes.\n */\nstruct ieee80211req_scan_result {\n\tuint16_t\tisr_len;\t\t/* total length (mult of 4) */\n\tuint16_t\tisr_ie_off;\t\t/* offset to SSID+IE data */\n\tuint16_t\tisr_ie_len;\t\t/* IE length */\n\tuint16_t\tisr_freq;\t\t/* MHz */\n\tuint16_t\tisr_flags;\t\t/* channel flags */\n\tint8_t\t\tisr_noise;\n\tint8_t\t\tisr_rssi;\n\tuint16_t\tisr_intval;\t\t/* beacon interval */\n\tuint8_t\t\tisr_capinfo;\t\t/* capabilities */\n\tuint8_t\t\tisr_erp;\t\t/* ERP element */\n\tuint8_t\t\tisr_bssid[IEEE80211_ADDR_LEN];\n\tuint8_t\t\tisr_nrates;\n\tuint8_t\t\tisr_rates[IEEE80211_RATE_MAXSIZE];\n\tuint8_t\t\tisr_ssid_len;\t\t/* SSID length */\n\tuint8_t\t\tisr_meshid_len;\t\t/* MESH ID length */\n\t/* variable length SSID, followed by variable length MESH ID,\n\t  followed by IE data */\n};\n\n/*\n * Virtual AP cloning parameters.  The parent device must\n * be a vap-capable device.  All parameters specified with\n * the clone request are fixed for the lifetime of the vap.\n *\n * There are two flavors of WDS vaps: legacy and dynamic.\n * Legacy WDS operation implements a static binding between\n * two stations encapsulating traffic in 4-address frames.\n * Dynamic WDS vaps are created when a station associates to\n * an AP and sends a 4-address frame.  If the AP vap is\n * configured to support WDS then this will generate an\n * event to user programs listening on the routing socket\n * and a Dynamic WDS vap will be created to handle traffic\n * to/from that station.  In both cases the bssid of the\n * peer must be specified when creating the vap.\n *\n * By default a vap will inherit the mac address/bssid of\n * the underlying device.  To request a unique address the\n * IEEE80211_CLONE_BSSID flag should be supplied.  This is\n * meaningless for WDS vaps as they share the bssid of an\n * AP vap that must otherwise exist.  Note that some devices\n * may not be able to support multiple addresses.\n *\n * Station mode vap's normally depend on the device to notice\n * when the AP stops sending beacon frames.  If IEEE80211_CLONE_NOBEACONS\n * is specified the net80211 layer will do this in s/w.  This\n * is mostly useful when setting up a WDS repeater/extender where\n * an AP vap is combined with a sta vap and the device isn't able\n * to track beacon frames in hardware.\n */\nstruct ieee80211_clone_params {\n\tchar\ticp_parent[IFNAMSIZ];\t\t/* parent device */\n\tuint16_t icp_opmode;\t\t\t/* operating mode */\n\tuint16_t icp_flags;\t\t\t/* see below */\n\tuint8_t\ticp_bssid[IEEE80211_ADDR_LEN];\t/* for WDS links */\n\tuint8_t\ticp_macaddr[IEEE80211_ADDR_LEN];/* local address */\n};\n#define\tIEEE80211_CLONE_BSSID\t\t0x0001\t/* allocate unique mac/bssid */\n#define\tIEEE80211_CLONE_NOBEACONS\t0x0002\t/* don't setup beacon timers */\n#define\tIEEE80211_CLONE_WDSLEGACY\t0x0004\t/* legacy WDS processing */\n#define\tIEEE80211_CLONE_MACADDR\t\t0x0008\t/* use specified mac addr */\n#define\tIEEE80211_CLONE_TDMA\t\t0x0010\t/* operate in TDMA mode */\n#endif /* __FreeBSD__ */\n\n#endif /* _NET80211_IEEE80211_IOCTL_H_ */\n"
  },
  {
    "path": "freebsd-headers/net80211/ieee80211_mesh.h",
    "content": "/*- \n * Copyright (c) 2009 The FreeBSD Foundation \n * All rights reserved. \n * \n * This software was developed by Rui Paulo under sponsorship from the\n * FreeBSD Foundation. \n *  \n * Redistribution and use in source and binary forms, with or without \n * modification, are permitted provided that the following conditions \n * are met: \n * 1. Redistributions of source code must retain the above copyright \n *    notice, this list of conditions and the following disclaimer. \n * 2. Redistributions in binary form must reproduce the above copyright \n *    notice, this list of conditions and the following disclaimer in the \n *    documentation and/or other materials provided with the distribution. \n * \n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND \n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE \n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE \n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE \n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL \n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS \n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) \n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT \n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY \n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF \n * SUCH DAMAGE. \n * \n * $FreeBSD: release/9.0.0/sys/net80211/ieee80211_mesh.h 202178 2010-01-12 22:22:27Z rpaulo $\n */\n#ifndef _NET80211_IEEE80211_MESH_H_\n#define _NET80211_IEEE80211_MESH_H_\n\n#define\tIEEE80211_MESH_DEFAULT_TTL\t31\n\n/*\n * NB: all structures are __packed  so sizeof works on arm, et. al.\n */\n/*\n * 802.11s Information Elements.\n*/\n/* Mesh Configuration */\nstruct ieee80211_meshconf_ie {\n\tuint8_t\t\tconf_ie;\t/* IEEE80211_ELEMID_MESHCONF */\n\tuint8_t\t\tconf_len;\n\tuint8_t\t\tconf_pselid;\t/* Active Path Sel. Proto. ID */\n\tuint8_t\t\tconf_pmetid;\t/* Active Metric Identifier */\n\tuint8_t\t\tconf_ccid;\t/* Congestion Control Mode ID  */\n\tuint8_t\t\tconf_syncid;\t/* Sync. Protocol ID */\n\tuint8_t\t\tconf_authid;\t/* Auth. Protocol ID */\n\tuint8_t\t\tconf_form;\t/* Formation Information */\n\tuint16_t\tconf_cap;\n} __packed;\n\n/* Hybrid Wireless Mesh Protocol */\n#define\tIEEE80211_MESHCONF_PATH_HWMP\t\t0x00\n/* Airtime Link Metric */\n#define\tIEEE80211_MESHCONF_METRIC_AIRTIME\t0x00\n/* Congestion Control */\n#define\tIEEE80211_MESHCONF_CC_DISABLED\t\t0x00\n#define\tIEEE80211_MESHCONF_CC_SIG\t\t0x01\n/* Neighbour Offset */\n#define\tIEEE80211_MESHCONF_SYNC_NEIGHOFF\t0x00\n#define\tIEEE80211_MESHCONF_AUTH_DISABLED\t0x00\n/* Simultaneous Authenticaction of Equals */\n#define\tIEEE80211_MESHCONF_AUTH_SAE\t\t0x01\n#define\tIEEE80211_MESHCONF_FORM_MP\t\t0x01 /* Connected to Portal */\n#define\tIEEE80211_MESHCONF_FORM_NNEIGH_MASK\t0x04 /* Number of Neighbours */\n#define\tIEEE80211_MESHCONF_CAP_AP\t0x01\t/* Accepting Peers */\n#define\tIEEE80211_MESHCONF_CAP_MCCAS\t0x02\t/* MCCA supported */\n#define\tIEEE80211_MESHCONF_CAP_MCCAE\t0x04\t/* MCCA enabled */\n#define\tIEEE80211_MESHCONF_CAP_FWRD \t0x08\t/* forwarding enabled */\n#define\tIEEE80211_MESHCONF_CAP_BTR\t0x10\t/* Beacon Timing Report Enab */\n#define\tIEEE80211_MESHCONF_CAP_TBTTA\t0x20\t/* TBTT Adj. Enabled */\n#define\tIEEE80211_MESHCONF_CAP_TBTT\t0x40\t/* TBTT Adjusting  */\n#define\tIEEE80211_MESHCONF_CAP_PSL\t0x80\t/* Power Save Level */\n\n/* Mesh Identifier */\nstruct ieee80211_meshid_ie {\n\tuint8_t\t\tid_ie;\t\t/* IEEE80211_ELEMID_MESHID */\n\tuint8_t\t\tid_len;\n} __packed;\n\n/* Link Metric Report */\nstruct ieee80211_meshlmetric_ie {\n\tuint8_t\t\tlm_ie;\t/* IEEE80211_ELEMID_MESHLINK */\n\tuint8_t\t\tlm_len;\n\tuint32_t\tlm_metric;\n#define\tIEEE80211_MESHLMETRIC_INITIALVAL\t0\n} __packed;\n\n/* Congestion Notification */\nstruct ieee80211_meshcngst_ie {\n\tuint8_t\t\tcngst_ie;\t/* IEEE80211_ELEMID_MESHCNGST */\n\tuint8_t\t\tcngst_len;\n\tuint16_t\tcngst_timer[4];\t/* Expiration Timers: AC_BK,\n\t\t\t\t\t   AC_BE, AC_VI, AC_VO */\n} __packed;\n\n/* Peer Link Management */\nstruct ieee80211_meshpeer_ie {\n\tuint8_t\t\tpeer_ie;\t/* IEEE80211_ELEMID_MESHPEER */\n\tuint8_t\t\tpeer_len;\n\tuint8_t\t\tpeer_proto[4];\t/* Peer Management Protocol */\n\tuint16_t\tpeer_llinkid;\t/* Local Link ID */\n\tuint16_t\tpeer_linkid;\t/* Peer Link ID */\n\tuint16_t\tpeer_rcode;\n} __packed;\n\nenum {\n\tIEEE80211_MESH_PEER_LINK_OPEN\t\t= 0,\n\tIEEE80211_MESH_PEER_LINK_CONFIRM\t= 1,\n\tIEEE80211_MESH_PEER_LINK_CLOSE\t\t= 2,\n\t/* values 3-255 are reserved */\n};\n\n/* Mesh Peering Management Protocol */\n#define\tIEEE80211_MESH_PEER_PROTO_OUI\t\t0x00, 0x0f, 0xac\n#define\tIEEE80211_MESH_PEER_PROTO_VALUE\t\t0x2a\n#define\tIEEE80211_MESH_PEER_PROTO\t{ IEEE80211_MESH_PEER_PROTO_OUI, \\\n\t\t\t\t\t  IEEE80211_MESH_PEER_PROTO_VALUE }\n/* Abbreviated Handshake Protocol */\n#define\tIEEE80211_MESH_PEER_PROTO_AH_OUI\t0x00, 0x0f, 0xac\n#define\tIEEE80211_MESH_PEER_PROTO_AH_VALUE\t0x2b\n#define\tIEEE80211_MESH_PEER_PROTO_AH\t{ IEEE80211_MESH_PEER_PROTO_AH_OUI, \\\n\t\t\t\t\t  IEEE80211_MESH_PEER_PROTO_AH_VALUE }\n#ifdef notyet\n/* Mesh Channel Switch Annoucement */\nstruct ieee80211_meshcsa_ie {\n\tuint8_t\t\tcsa_ie;\t\t/* IEEE80211_ELEMID_MESHCSA */\n\tuint8_t\t\tcsa_len;\n\tuint8_t\t\tcsa_mode;\n\tuint8_t\t\tcsa_newclass;\t/* New Regulatory Class */\n\tuint8_t\t\tcsa_newchan;\n\tuint8_t\t\tcsa_precvalue;\t/* Precedence Value */\n\tuint8_t\t\tcsa_count;\n} __packed;\n\n/* Mesh TIM */\n/* Equal to the non Mesh version */\n\n/* Mesh Awake Window */\nstruct ieee80211_meshawakew_ie {\n\tuint8_t\t\tawakew_ie;\t\t/* IEEE80211_ELEMID_MESHAWAKEW */\n\tuint8_t\t\tawakew_len;\n\tuint8_t\t\tawakew_windowlen;\t/* in TUs */\n} __packed;\n\n/* Mesh Beacon Timing */\nstruct ieee80211_meshbeacont_ie {\n\tuint8_t\t\tbeacont_ie;\t\t/* IEEE80211_ELEMID_MESHBEACONT */\n\tuint8_t\t\tbeacont_len;\n\tstruct {\n\t\tuint8_t\t\tmp_aid;\t\t/* Least Octet of AID */\n\t\tuint16_t\tmp_btime;\t/* Beacon Time */\n\t\tuint16_t\tmp_bint;\t/* Beacon Interval */\n\t} __packed mp[1];\t\t\t/* NB: variable size */\n} __packed;\n#endif\n\n/* Portal (MP) Annoucement */\nstruct ieee80211_meshpann_ie {\n\tuint8_t\t\tpann_ie;\t\t/* IEEE80211_ELEMID_MESHPANN */\n\tuint8_t\t\tpann_len;\n\tuint8_t\t\tpann_flags;\n\tuint8_t\t\tpann_hopcount;\n\tuint8_t\t\tpann_ttl;\n\tuint8_t\t\tpann_addr[IEEE80211_ADDR_LEN];\n\tuint8_t\t\tpann_seq;\t\t/* PANN Sequence Number */\n} __packed;\n\n/* Root (MP) Annoucement */\nstruct ieee80211_meshrann_ie {\n\tuint8_t\t\trann_ie;\t\t/* IEEE80211_ELEMID_MESHRANN */\n\tuint8_t\t\trann_len;\n\tuint8_t\t\trann_flags;\n#define\tIEEE80211_MESHRANN_FLAGS_PR\t0x01\t/* Portal Role */\n\tuint8_t\t\trann_hopcount;\n\tuint8_t\t\trann_ttl;\n\tuint8_t\t\trann_addr[IEEE80211_ADDR_LEN];\n\tuint32_t\trann_seq;\t\t/* HWMP Sequence Number */\n\tuint32_t\trann_metric;\n} __packed;\n\n/* Mesh Path Request */\nstruct ieee80211_meshpreq_ie {\n\tuint8_t\t\tpreq_ie;\t/* IEEE80211_ELEMID_MESHPREQ */\n\tuint8_t\t\tpreq_len;\n\tuint8_t\t\tpreq_flags;\n#define\tIEEE80211_MESHPREQ_FLAGS_PR\t0x01\t/* Portal Role */\n#define\tIEEE80211_MESHPREQ_FLAGS_AM\t0x02\t/* 0 = ucast / 1 = bcast */\n#define\tIEEE80211_MESHPREQ_FLAGS_PP\t0x04\t/* Proactive PREP */\n#define\tIEEE80211_MESHPREQ_FLAGS_AE\t0x40\t/* Address Extension */\n\tuint8_t\t\tpreq_hopcount;\n\tuint8_t\t\tpreq_ttl;\n\tuint32_t\tpreq_id;\n\tuint8_t\t\tpreq_origaddr[IEEE80211_ADDR_LEN];\n\tuint32_t\tpreq_origseq;\t/* HWMP Sequence Number */\n\t/* NB: may have Originator Proxied Address */\n\tuint32_t\tpreq_lifetime;\n\tuint32_t\tpreq_metric;\n\tuint8_t\t\tpreq_tcount;\t/* target count */\n\tstruct {\n\t\tuint8_t\t\ttarget_flags;\n#define\tIEEE80211_MESHPREQ_TFLAGS_TO\t0x01\t/* Target Only */\n#define\tIEEE80211_MESHPREQ_TFLAGS_RF\t0x02\t/* Reply and Forward */\n#define\tIEEE80211_MESHPREQ_TFLAGS_USN\t0x04\t/* Unknown HWMP seq number */\n\t\tuint8_t\t\ttarget_addr[IEEE80211_ADDR_LEN];\n\t\tuint32_t\ttarget_seq;\t/* HWMP Sequence Number */\n\t} __packed preq_targets[1];\t\t/* NB: variable size */\n} __packed;\n\n/* Mesh Path Reply */\nstruct ieee80211_meshprep_ie {\n\tuint8_t\t\tprep_ie;\t/* IEEE80211_ELEMID_MESHPREP */\n\tuint8_t\t\tprep_len;\n\tuint8_t\t\tprep_flags;\n\tuint8_t\t\tprep_hopcount;\n\tuint8_t\t\tprep_ttl;\n\tuint8_t\t\tprep_targetaddr[IEEE80211_ADDR_LEN];\n\tuint32_t\tprep_targetseq;\n\t/* NB: May have Target Proxied Address */\n\tuint32_t\tprep_lifetime;\n\tuint32_t\tprep_metric;\n\tuint8_t\t\tprep_origaddr[IEEE80211_ADDR_LEN];\n\tuint32_t\tprep_origseq;\t/* HWMP Sequence Number */\n} __packed;\n\n/* Mesh Path Error */\nstruct ieee80211_meshperr_ie {\n\tuint8_t\t\tperr_ie;\t/* IEEE80211_ELEMID_MESHPERR */\n\tuint8_t\t\tperr_len;\n\tuint8_t\t\tperr_ttl;\n\tuint8_t\t\tperr_ndests;\t/* Number of Destinations */\n\tstruct {\n\t\tuint8_t\t\tdest_flags;\n#define\tIEEE80211_MESHPERR_DFLAGS_USN\t0x01\n#define\tIEEE80211_MESHPERR_DFLAGS_RC\t0x02\n\t\tuint8_t\t\tdest_addr[IEEE80211_ADDR_LEN];\n\t\tuint32_t\tdest_seq;\t/* HWMP Sequence Number */\n\t\tuint16_t\tdest_rcode;\n\t} __packed perr_dests[1];\t\t/* NB: variable size */\n} __packed;\n\n#ifdef notyet\n/* Mesh Proxy Update */\nstruct ieee80211_meshpu_ie {\n\tuint8_t\t\tpu_ie;\t\t/* IEEE80211_ELEMID_MESHPU */\n\tuint8_t\t\tpu_len;\n\tuint8_t\t\tpu_flags;\n#define\tIEEE80211_MESHPU_FLAGS_MASK\t\t0x1\n#define\tIEEE80211_MESHPU_FLAGS_DEL\t\t0x0\n#define\tIEEE80211_MESHPU_FLAGS_ADD\t\t0x1\n\tuint8_t\t\tpu_seq;\t\t/* PU Sequence Number */\n\tuint8_t\t\tpu_addr[IEEE80211_ADDR_LEN];\n\tuint8_t\t\tpu_naddr;\t/* Number of Proxied Addresses */\n\t/* NB: proxied address follows */\n} __packed;\n\n/* Mesh Proxy Update Confirmation */\nstruct ieee80211_meshpuc_ie {\n\tuint8_t\t\tpuc_ie;\t\t/* IEEE80211_ELEMID_MESHPUC */\n\tuint8_t\t\tpuc_len;\n\tuint8_t\t\tpuc_flags;\n\tuint8_t\t\tpuc_seq;\t/* PU Sequence Number */\n\tuint8_t\t\tpuc_daddr[IEEE80211_ADDR_LEN];\n} __packed;\n#endif\n\n/*\n * 802.11s Action Frames\n */\n#define\tIEEE80211_ACTION_CAT_MESHPEERING\t30\t/* XXX Linux */\n#define\tIEEE80211_ACTION_CAT_MESHLMETRIC\t13\n#define\tIEEE80211_ACTION_CAT_MESHPATH\t\t32\t/* XXX Linux */\n#define\tIEEE80211_ACTION_CAT_INTERWORK\t\t15\n#define\tIEEE80211_ACTION_CAT_RESOURCE\t\t16\n#define\tIEEE80211_ACTION_CAT_PROXY\t\t17\n\n/*\n * Mesh Peering Action codes.\n */\nenum {\n\tIEEE80211_ACTION_MESHPEERING_OPEN\t= 0,\n\tIEEE80211_ACTION_MESHPEERING_CONFIRM\t= 1,\n\tIEEE80211_ACTION_MESHPEERING_CLOSE\t= 2,\n\t/* 3-255 reserved */\n};\n\n/*\n * Mesh Path Selection Action code.\n */\nenum {\n\tIEEE80211_ACTION_MESHPATH_SEL\t= 0,\n\t/* 1-255 reserved */\n};\n\n/*\n * Mesh Link Metric Action codes.\n */\nenum {\n\tIEEE80211_ACTION_MESHLMETRIC_REQ = 0,\t/* Link Metric Request */\n\tIEEE80211_ACTION_MESHLMETRIC_REP = 1,\t/* Link Metric Report */\n\t/* 2-255 reserved */\n};\n\n/*\n * Mesh Portal Annoucement Action codes.\n */\nenum {\n\tIEEE80211_ACTION_MESHPANN\t= 0,\n\t/* 1-255 reserved */\n};\n\n/*\n * Different mesh control structures based on the AE\n * (Address Extension) bits.\n */\nstruct ieee80211_meshcntl {\n\tuint8_t\t\tmc_flags;\t/* Address Extension 00 */\n\tuint8_t\t\tmc_ttl;\t\t/* TTL */\n\tuint8_t\t\tmc_seq[4];\t/* Sequence No. */\n\t/* NB: more addresses may follow */\n} __packed;\n\nstruct ieee80211_meshcntl_ae01 {\n\tuint8_t\t\tmc_flags;\t/* Address Extension 01 */\n\tuint8_t\t\tmc_ttl;\t\t/* TTL */\n\tuint8_t\t\tmc_seq[4];\t/* Sequence No. */\n\tuint8_t\t\tmc_addr4[IEEE80211_ADDR_LEN];\n} __packed;\n\nstruct ieee80211_meshcntl_ae10 {\n\tuint8_t\t\tmc_flags;\t/* Address Extension 10 */\n\tuint8_t\t\tmc_ttl;\t\t/* TTL */\n\tuint8_t\t\tmc_seq[4];\t/* Sequence No. */\n\tuint8_t\t\tmc_addr4[IEEE80211_ADDR_LEN];\n\tuint8_t\t\tmc_addr5[IEEE80211_ADDR_LEN];\n} __packed;\n\nstruct ieee80211_meshcntl_ae11 {\n\tuint8_t\t\tmc_flags;\t/* Address Extension 11 */\n\tuint8_t\t\tmc_ttl;\t\t/* TTL */\n\tuint8_t\t\tmc_seq[4];\t/* Sequence No. */\n\tuint8_t\t\tmc_addr4[IEEE80211_ADDR_LEN];\n\tuint8_t\t\tmc_addr5[IEEE80211_ADDR_LEN];\n\tuint8_t\t\tmc_addr6[IEEE80211_ADDR_LEN];\n} __packed;\n\n#ifdef _KERNEL\nMALLOC_DECLARE(M_80211_MESH_RT);\nstruct ieee80211_mesh_route {\n\tTAILQ_ENTRY(ieee80211_mesh_route)\trt_next;\n\tint\t\t\trt_crtime;\t/* creation time */\n\tuint8_t\t\t\trt_dest[IEEE80211_ADDR_LEN];\n\tuint8_t\t\t\trt_nexthop[IEEE80211_ADDR_LEN];\n\tuint32_t\t\trt_metric;\t/* path metric */\n\tuint16_t\t\trt_nhops;\t/* number of hops */\n\tuint16_t\t\trt_flags;\n#define\tIEEE80211_MESHRT_FLAGS_VALID\t0x01\t/* patch discovery complete */\n#define\tIEEE80211_MESHRT_FLAGS_PROXY\t0x02\t/* proxy entry */\n\tuint32_t\t\trt_lifetime;\n\tuint32_t\t\trt_lastmseq;\t/* last seq# seen dest */\n\tvoid\t\t\t*rt_priv;\t/* private data */\n};\n#define\tIEEE80211_MESH_ROUTE_PRIV(rt, cast)\t((cast *)rt->rt_priv)\n\n#define\tIEEE80211_MESH_PROTO_DSZ\t12\t/* description size */\n/*\n * Mesh Path Selection Protocol.\n */\nenum ieee80211_state;\nstruct ieee80211_mesh_proto_path {\n\tuint8_t\t\tmpp_active;\n\tchar \t\tmpp_descr[IEEE80211_MESH_PROTO_DSZ];\n\tuint8_t\t\tmpp_ie;\n\tstruct ieee80211_node *\n\t    \t\t(*mpp_discover)(struct ieee80211vap *,\n\t\t\t\tconst uint8_t [IEEE80211_ADDR_LEN],\n\t\t\t\tstruct mbuf *);\n\tvoid\t\t(*mpp_peerdown)(struct ieee80211_node *);\n\tvoid\t\t(*mpp_vattach)(struct ieee80211vap *);\n\tvoid\t\t(*mpp_vdetach)(struct ieee80211vap *);\n\tint\t\t(*mpp_newstate)(struct ieee80211vap *,\n\t\t\t    enum ieee80211_state, int);\n\tconst size_t\tmpp_privlen;\t/* size required in the routing table\n\t\t\t\t\t   for private data */\n\tint\t\tmpp_inact;\t/* inact. timeout for invalid routes\n\t\t\t\t\t   (ticks) */\n};\n\n/*\n * Mesh Link Metric Report Protocol.\n */\nstruct ieee80211_mesh_proto_metric {\n\tuint8_t\t\tmpm_active;\n\tchar\t\tmpm_descr[IEEE80211_MESH_PROTO_DSZ];\n\tuint8_t\t\tmpm_ie;\n\tuint32_t\t(*mpm_metric)(struct ieee80211_node *);\n};\n\n#ifdef notyet\n/*\n * Mesh Authentication Protocol.\n */\nstruct ieee80211_mesh_proto_auth {\n\tuint8_t\t\tmpa_ie[4];\n};\n\nstruct ieee80211_mesh_proto_congestion {\n};\n\nstruct ieee80211_mesh_proto_sync {\n};\n#endif\n\ntypedef uint32_t ieee80211_mesh_seq;\n#define\tIEEE80211_MESH_SEQ_LEQ(a, b)\t((int32_t)((a)-(b)) <= 0)\n#define\tIEEE80211_MESH_SEQ_GEQ(a, b)\t((int32_t)((a)-(b)) >= 0)\n\nstruct ieee80211_mesh_state {\n\tint\t\t\t\tms_idlen;\n\tuint8_t\t\t\t\tms_id[IEEE80211_MESHID_LEN];\n\tieee80211_mesh_seq\t\tms_seq;\t/* seq no for meshcntl */\n\tuint16_t\t\t\tms_neighbors;\n\tuint8_t\t\t\t\tms_ttl;\t/* mesh ttl set in packets */\n#define IEEE80211_MESHFLAGS_AP\t\t0x01\t/* accept peers */\n#define IEEE80211_MESHFLAGS_PORTAL\t0x02\t/* mesh portal role */\n#define IEEE80211_MESHFLAGS_FWD\t\t0x04\t/* forward packets */\n\tuint8_t\t\t\t\tms_flags;\n\tstruct mtx\t\t\tms_rt_lock;\n\tstruct callout\t\t\tms_cleantimer;\n\tTAILQ_HEAD(, ieee80211_mesh_route)  ms_routes;\n\tstruct ieee80211_mesh_proto_metric *ms_pmetric;\n\tstruct ieee80211_mesh_proto_path   *ms_ppath;\n};\nvoid\t\tieee80211_mesh_attach(struct ieee80211com *);\nvoid\t\tieee80211_mesh_detach(struct ieee80211com *);\n\nstruct ieee80211_mesh_route *\n\t\tieee80211_mesh_rt_find(struct ieee80211vap *,\n\t\t    const uint8_t [IEEE80211_ADDR_LEN]);\nstruct ieee80211_mesh_route *\n                ieee80211_mesh_rt_add(struct ieee80211vap *,\n\t\t    const uint8_t [IEEE80211_ADDR_LEN]);\nvoid\t\tieee80211_mesh_rt_del(struct ieee80211vap *,\n\t\t    const uint8_t [IEEE80211_ADDR_LEN]);\nvoid\t\tieee80211_mesh_rt_flush(struct ieee80211vap *);\nvoid\t\tieee80211_mesh_rt_flush_peer(struct ieee80211vap *,\n\t\t    const uint8_t [IEEE80211_ADDR_LEN]);\nvoid\t\tieee80211_mesh_proxy_check(struct ieee80211vap *,\n\t\t    const uint8_t [IEEE80211_ADDR_LEN]);\n\nint\t\tieee80211_mesh_register_proto_path(const\n\t\t    struct ieee80211_mesh_proto_path *);\nint\t\tieee80211_mesh_register_proto_metric(const\n\t\t    struct ieee80211_mesh_proto_metric *);\n\nuint8_t *\tieee80211_add_meshid(uint8_t *, struct ieee80211vap *);\nuint8_t *\tieee80211_add_meshconf(uint8_t *, struct ieee80211vap *);\nuint8_t *\tieee80211_add_meshpeer(uint8_t *, uint8_t, uint16_t, uint16_t,\n\t\t    uint16_t);\nuint8_t *\tieee80211_add_meshlmetric(uint8_t *, uint32_t);\n\nvoid\t\tieee80211_mesh_node_init(struct ieee80211vap *,\n\t\t    struct ieee80211_node *);\nvoid\t\tieee80211_mesh_node_cleanup(struct ieee80211_node *);\nvoid\t\tieee80211_parse_meshid(struct ieee80211_node *,\n\t\t    const uint8_t *);\nstruct ieee80211_scanparams;\nvoid\t\tieee80211_mesh_init_neighbor(struct ieee80211_node *,\n\t\t   const struct ieee80211_frame *,\n\t\t   const struct ieee80211_scanparams *);\nvoid\t\tieee80211_mesh_update_beacon(struct ieee80211vap *,\n\t\t    struct ieee80211_beacon_offsets *);\n\n/*\n * Return non-zero if proxy operation is enabled.\n */\nstatic __inline int\nieee80211_mesh_isproxyena(struct ieee80211vap *vap)\n{\n\tstruct ieee80211_mesh_state *ms = vap->iv_mesh;\n\treturn (ms->ms_flags &\n\t    (IEEE80211_MESHFLAGS_AP | IEEE80211_MESHFLAGS_PORTAL)) != 0;\n}\n\n/*\n * Process an outbound frame: if a path is known to the\n * destination then return a reference to the next hop\n * for immediate transmission.  Otherwise initiate path\n * discovery and, if possible queue the packet to be\n * sent when path discovery completes.\n */\nstatic __inline struct ieee80211_node *\nieee80211_mesh_discover(struct ieee80211vap *vap,\n    const uint8_t dest[IEEE80211_ADDR_LEN], struct mbuf *m)\n{\n\tstruct ieee80211_mesh_state *ms = vap->iv_mesh;\n\treturn ms->ms_ppath->mpp_discover(vap, dest, m);\n}\n\n#endif /* _KERNEL */\n#endif /* !_NET80211_IEEE80211_MESH_H_ */\n"
  },
  {
    "path": "freebsd-headers/net80211/ieee80211_monitor.h",
    "content": "/*-\n * Copyright (c) 2007-2008 Sam Leffler, Errno Consulting\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR\n * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES\n * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,\n * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF\n * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/net80211/ieee80211_monitor.h 178354 2008-04-20 20:35:46Z sam $\n */\n#ifndef _NET80211_IEEE80211_MONITOR_H_\n#define _NET80211_IEEE80211_MONITOR_H_\n\n/*\n * Monitor implementation definitions.\n */\nvoid\tieee80211_monitor_attach(struct ieee80211com *);\nvoid\tieee80211_monitor_detach(struct ieee80211com *);\n#endif /* !_NET80211_IEEE80211_MONITOR_H_ */\n"
  },
  {
    "path": "freebsd-headers/net80211/ieee80211_node.h",
    "content": "/*-\n * Copyright (c) 2001 Atsushi Onoe\n * Copyright (c) 2002-2009 Sam Leffler, Errno Consulting\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR\n * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES\n * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,\n * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF\n * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/net80211/ieee80211_node.h 220445 2011-04-08 09:20:45Z adrian $\n */\n#ifndef _NET80211_IEEE80211_NODE_H_\n#define _NET80211_IEEE80211_NODE_H_\n\n#include <net80211/ieee80211_ioctl.h>\t\t/* for ieee80211_nodestats */\n#include <net80211/ieee80211_ht.h>\t\t/* for aggregation state */\n\n/*\n * Each ieee80211com instance has a single timer that fires every\n * IEEE80211_INACT_WAIT seconds to handle \"inactivity processing\".\n * This is used to do node inactivity processing when operating\n * as an AP, adhoc or mesh mode.  For inactivity processing each node\n * has a timeout set in it's ni_inact field that is decremented\n * on each timeout and the node is reclaimed when the counter goes\n * to zero.  We use different inactivity timeout values depending\n * on whether the node is associated and authorized (either by\n * 802.1x or open/shared key authentication) or associated but yet\n * to be authorized.  The latter timeout is shorter to more aggressively\n * reclaim nodes that leave part way through the 802.1x exchange.\n */\n#define\tIEEE80211_INACT_WAIT\t15\t\t/* inactivity interval (secs) */\n#define\tIEEE80211_INACT_INIT\t(30/IEEE80211_INACT_WAIT)\t/* initial */\n#define\tIEEE80211_INACT_AUTH\t(180/IEEE80211_INACT_WAIT)\t/* associated but not authorized */\n#define\tIEEE80211_INACT_RUN\t(300/IEEE80211_INACT_WAIT)\t/* authorized */\n#define\tIEEE80211_INACT_PROBE\t(30/IEEE80211_INACT_WAIT)\t/* probe */\n#define\tIEEE80211_INACT_SCAN\t(300/IEEE80211_INACT_WAIT)\t/* scanned */\n\n#define\tIEEE80211_TRANS_WAIT \t2\t\t/* mgt frame tx timer (secs) */\n\n/* threshold for aging overlapping non-ERP bss */\n#define\tIEEE80211_NONERP_PRESENT_AGE\tmsecs_to_ticks(60*1000)\n\n#define\tIEEE80211_NODE_HASHSIZE\t32\t\t/* NB: hash size must be pow2 */\n/* simple hash is enough for variation of macaddr */\n#define\tIEEE80211_NODE_HASH(ic, addr)\t\\\n\t(((const uint8_t *)(addr))[IEEE80211_ADDR_LEN - 1] % \\\n\t\tIEEE80211_NODE_HASHSIZE)\n\nstruct ieee80211_node_table;\nstruct ieee80211com;\nstruct ieee80211vap;\n\n/*\n * Information element ``blob''.  We use this structure\n * to capture management frame payloads that need to be\n * retained.  Information elements within the payload that\n * we need to consult have references recorded.\n */\nstruct ieee80211_ies {\n\t/* the following are either NULL or point within data */\n\tuint8_t\t*wpa_ie;\t/* captured WPA ie */\n\tuint8_t\t*rsn_ie;\t/* captured RSN ie */\n\tuint8_t\t*wme_ie;\t/* captured WME ie */\n\tuint8_t\t*ath_ie;\t/* captured Atheros ie */\n\tuint8_t\t*htcap_ie;\t/* captured HTCAP ie */\n\tuint8_t\t*htinfo_ie;\t/* captured HTINFO ie */\n\tuint8_t\t*tdma_ie;\t/* captured TDMA ie */\n\tuint8_t *meshid_ie;\t/* captured MESH ID ie */\n\tuint8_t\t*spare[4];\n\t/* NB: these must be the last members of this structure */\n\tuint8_t\t*data;\t\t/* frame data > 802.11 header */\n\tint\tlen;\t\t/* data size in bytes */\n};\n\n/*\n * 802.11s (Mesh) Peer Link FSM state.\n */\nenum ieee80211_mesh_mlstate {\n\tIEEE80211_NODE_MESH_IDLE\t= 0,\n\tIEEE80211_NODE_MESH_OPENSNT\t= 1,\t/* open frame sent */\n\tIEEE80211_NODE_MESH_OPENRCV\t= 2,\t/* open frame received */\n\tIEEE80211_NODE_MESH_CONFIRMRCV\t= 3,\t/* confirm frame received */\n\tIEEE80211_NODE_MESH_ESTABLISHED\t= 4,\t/* link established */\n\tIEEE80211_NODE_MESH_HOLDING\t= 5,\t/* link closing */\n};\n#define\tIEEE80211_MESH_MLSTATE_BITS \\\n\t\"\\20\\1IDLE\\2OPENSNT\\2OPENRCV\\3CONFIRMRCV\\4ESTABLISHED\\5HOLDING\"\n\n/*\n * Node specific information.  Note that drivers are expected\n * to derive from this structure to add device-specific per-node\n * state.  This is done by overriding the ic_node_* methods in\n * the ieee80211com structure.\n */\nstruct ieee80211_node {\n\tstruct ieee80211vap\t*ni_vap;\t/* associated vap */\n\tstruct ieee80211com\t*ni_ic;\t\t/* copy from vap to save deref*/\n\tstruct ieee80211_node_table *ni_table;\t/* NB: may be NULL */\n\tTAILQ_ENTRY(ieee80211_node) ni_list;\t/* list of all nodes */\n\tLIST_ENTRY(ieee80211_node) ni_hash;\t/* hash collision list */\n\tu_int\t\t\tni_refcnt;\t/* count of held references */\n\tu_int\t\t\tni_scangen;\t/* gen# for timeout scan */\n\tu_int\t\t\tni_flags;\n#define\tIEEE80211_NODE_AUTH\t0x000001\t/* authorized for data */\n#define\tIEEE80211_NODE_QOS\t0x000002\t/* QoS enabled */\n#define\tIEEE80211_NODE_ERP\t0x000004\t/* ERP enabled */\n/* NB: this must have the same value as IEEE80211_FC1_PWR_MGT */\n#define\tIEEE80211_NODE_PWR_MGT\t0x000010\t/* power save mode enabled */\n#define\tIEEE80211_NODE_AREF\t0x000020\t/* authentication ref held */\n#define\tIEEE80211_NODE_HT\t0x000040\t/* HT enabled */\n#define\tIEEE80211_NODE_HTCOMPAT\t0x000080\t/* HT setup w/ vendor OUI's */\n#define\tIEEE80211_NODE_WPS\t0x000100\t/* WPS association */\n#define\tIEEE80211_NODE_TSN\t0x000200\t/* TSN association */\n#define\tIEEE80211_NODE_AMPDU_RX\t0x000400\t/* AMPDU rx enabled */\n#define\tIEEE80211_NODE_AMPDU_TX\t0x000800\t/* AMPDU tx enabled */\n#define\tIEEE80211_NODE_MIMO_PS\t0x001000\t/* MIMO power save enabled */\n#define\tIEEE80211_NODE_MIMO_RTS\t0x002000\t/* send RTS in MIMO PS */\n#define\tIEEE80211_NODE_RIFS\t0x004000\t/* RIFS enabled */\n#define\tIEEE80211_NODE_SGI20\t0x008000\t/* Short GI in HT20 enabled */\n#define\tIEEE80211_NODE_SGI40\t0x010000\t/* Short GI in HT40 enabled */\n#define\tIEEE80211_NODE_ASSOCID\t0x020000\t/* xmit requires associd */\n#define\tIEEE80211_NODE_AMSDU_RX\t0x040000\t/* AMSDU rx enabled */\n#define\tIEEE80211_NODE_AMSDU_TX\t0x080000\t/* AMSDU tx enabled */\n\tuint16_t\t\tni_associd;\t/* association ID */\n\tuint16_t\t\tni_vlan;\t/* vlan tag */\n\tuint16_t\t\tni_txpower;\t/* current transmit power */\n\tuint8_t\t\t\tni_authmode;\t/* authentication algorithm */\n\tuint8_t\t\t\tni_ath_flags;\t/* Atheros feature flags */\n\t/* NB: These must have the same values as IEEE80211_ATHC_* */\n#define IEEE80211_NODE_TURBOP\t0x0001\t\t/* Turbo prime enable */\n#define IEEE80211_NODE_COMP\t0x0002\t\t/* Compresssion enable */\n#define IEEE80211_NODE_FF\t0x0004          /* Fast Frame capable */\n#define IEEE80211_NODE_XR\t0x0008\t\t/* Atheros WME enable */\n#define IEEE80211_NODE_AR\t0x0010\t\t/* AR capable */\n#define IEEE80211_NODE_BOOST\t0x0080\t\t/* Dynamic Turbo boosted */\n\tuint16_t\t\tni_ath_defkeyix;/* Atheros def key index */\n\tconst struct ieee80211_txparam *ni_txparms;\n\tuint32_t\t\tni_jointime;\t/* time of join (secs) */\n\tuint32_t\t\t*ni_challenge;\t/* shared-key challenge */\n\tstruct ieee80211_ies\tni_ies;\t\t/* captured ie's */\n\t\t\t\t\t\t/* tx seq per-tid */\n\tieee80211_seq\t\tni_txseqs[IEEE80211_TID_SIZE];\n\t\t\t\t\t\t/* rx seq previous per-tid*/\n\tieee80211_seq\t\tni_rxseqs[IEEE80211_TID_SIZE];\n\tuint32_t\t\tni_rxfragstamp;\t/* time stamp of last rx frag */\n\tstruct mbuf\t\t*ni_rxfrag[3];\t/* rx frag reassembly */\n\tstruct ieee80211_key\tni_ucastkey;\t/* unicast key */\n\n\t/* hardware */\n\tuint32_t\t\tni_avgrssi;\t/* recv ssi state */\n\tint8_t\t\t\tni_noise;\t/* noise floor */\n\n\t/* mimo statistics */\n\tuint32_t\t\tni_mimo_rssi_ctl[IEEE80211_MAX_CHAINS];\n\tuint32_t\t\tni_mimo_rssi_ext[IEEE80211_MAX_CHAINS];\n\tuint8_t\t\t\tni_mimo_noise_ctl[IEEE80211_MAX_CHAINS];\n\tuint8_t\t\t\tni_mimo_noise_ext[IEEE80211_MAX_CHAINS];\n\tuint8_t\t\t\tni_mimo_chains;\n\n\t/* header */\n\tuint8_t\t\t\tni_macaddr[IEEE80211_ADDR_LEN];\n\tuint8_t\t\t\tni_bssid[IEEE80211_ADDR_LEN];\n\n\t/* beacon, probe response */\n\tunion {\n\t\tuint8_t\t\tdata[8];\n\t\tu_int64_t\ttsf;\n\t} ni_tstamp;\t\t\t\t/* from last rcv'd beacon */\n\tuint16_t\t\tni_intval;\t/* beacon interval */\n\tuint16_t\t\tni_capinfo;\t/* capabilities */\n\tuint8_t\t\t\tni_esslen;\n\tuint8_t\t\t\tni_essid[IEEE80211_NWID_LEN];\n\tstruct ieee80211_rateset ni_rates;\t/* negotiated rate set */\n\tstruct ieee80211_channel *ni_chan;\n\tuint16_t\t\tni_fhdwell;\t/* FH only */\n\tuint8_t\t\t\tni_fhindex;\t/* FH only */\n\tuint16_t\t\tni_erp;\t\t/* ERP from beacon/probe resp */\n\tuint16_t\t\tni_timoff;\t/* byte offset to TIM ie */\n\tuint8_t\t\t\tni_dtim_period;\t/* DTIM period */\n\tuint8_t\t\t\tni_dtim_count;\t/* DTIM count for last bcn */\n\n\t/* 11s state */\n\tuint8_t\t\t\tni_meshidlen;\n\tuint8_t\t\t\tni_meshid[IEEE80211_MESHID_LEN];\n\tenum ieee80211_mesh_mlstate ni_mlstate;\t/* peering management state */\n\tuint16_t\t\tni_mllid;\t/* link local ID */\n\tuint16_t\t\tni_mlpid;\t/* link peer ID */\n\tstruct callout\t\tni_mltimer;\t/* link mesh timer */\n\tuint8_t\t\t\tni_mlrcnt;\t/* link mesh retry counter */\n\tuint8_t\t\t\tni_mltval;\t/* link mesh timer value */\n\n\t/* 11n state */\n\tuint16_t\t\tni_htcap;\t/* HT capabilities */\n\tuint8_t\t\t\tni_htparam;\t/* HT params */\n\tuint8_t\t\t\tni_htctlchan;\t/* HT control channel */\n\tuint8_t\t\t\tni_ht2ndchan;\t/* HT 2nd channel */\n\tuint8_t\t\t\tni_htopmode;\t/* HT operating mode */\n\tuint8_t\t\t\tni_htstbc;\t/* HT */\n\tuint8_t\t\t\tni_chw;\t\t/* negotiated channel width */\n\tstruct ieee80211_htrateset ni_htrates;\t/* negotiated ht rate set */\n\tstruct ieee80211_tx_ampdu ni_tx_ampdu[WME_NUM_AC];\n\tstruct ieee80211_rx_ampdu ni_rx_ampdu[WME_NUM_TID];\n\n\t/* others */\n\tshort\t\t\tni_inact;\t/* inactivity mark count */\n\tshort\t\t\tni_inact_reload;/* inactivity reload value */\n\tint\t\t\tni_txrate;\t/* legacy rate/MCS */\n\tstruct ieee80211_psq\tni_psq;\t\t/* power save queue */\n\tstruct ieee80211_nodestats ni_stats;\t/* per-node statistics */\n\n\tstruct ieee80211vap\t*ni_wdsvap;\t/* associated WDS vap */\n\tvoid\t\t\t*ni_rctls;\t/* private ratectl state */\n\tuint64_t\t\tni_spare[3];\n};\nMALLOC_DECLARE(M_80211_NODE);\nMALLOC_DECLARE(M_80211_NODE_IE);\n\n#define\tIEEE80211_NODE_ATH\t(IEEE80211_NODE_FF | IEEE80211_NODE_TURBOP)\n#define\tIEEE80211_NODE_AMPDU \\\n\t(IEEE80211_NODE_AMPDU_RX | IEEE80211_NODE_AMPDU_TX)\n#define\tIEEE80211_NODE_AMSDU \\\n\t(IEEE80211_NODE_AMSDU_RX | IEEE80211_NODE_AMSDU_TX)\n#define\tIEEE80211_NODE_HT_ALL \\\n\t(IEEE80211_NODE_HT | IEEE80211_NODE_HTCOMPAT | \\\n\t IEEE80211_NODE_AMPDU | IEEE80211_NODE_AMSDU | \\\n\t IEEE80211_NODE_MIMO_PS | IEEE80211_NODE_MIMO_RTS | \\\n\t IEEE80211_NODE_RIFS | IEEE80211_NODE_SGI20 | IEEE80211_NODE_SGI40)\n\n#define\tIEEE80211_NODE_BITS \\\n\t\"\\20\\1AUTH\\2QOS\\3ERP\\5PWR_MGT\\6AREF\\7HT\\10HTCOMPAT\\11WPS\\12TSN\" \\\n\t\"\\13AMPDU_RX\\14AMPDU_TX\\15MIMO_PS\\16MIMO_RTS\\17RIFS\\20SGI20\\21SGI40\" \\\n\t\"\\22ASSOCID\"\n\n#define\tIEEE80211_NODE_AID(ni)\tIEEE80211_AID(ni->ni_associd)\n\n#define\tIEEE80211_NODE_STAT(ni,stat)\t(ni->ni_stats.ns_##stat++)\n#define\tIEEE80211_NODE_STAT_ADD(ni,stat,v)\t(ni->ni_stats.ns_##stat += v)\n#define\tIEEE80211_NODE_STAT_SET(ni,stat,v)\t(ni->ni_stats.ns_##stat = v)\n\n/*\n * Filtered rssi calculation support.  The receive rssi is maintained\n * as an average over the last 10 frames received using a low pass filter\n * (all frames for now, possibly need to be more selective).  Calculations\n * are designed such that a good compiler can optimize them.  The avg\n * rssi state should be initialized to IEEE80211_RSSI_DUMMY_MARKER and\n * each sample incorporated with IEEE80211_RSSI_LPF.  Use IEEE80211_RSSI_GET\n * to extract the current value.\n *\n * Note that we assume rssi data are in the range [-127..127] and we\n * discard values <-20.  This is consistent with assumptions throughout\n * net80211 that signal strength data are in .5 dBm units relative to\n * the current noise floor (linear, not log).\n */\n#define IEEE80211_RSSI_LPF_LEN\t\t10\n#define\tIEEE80211_RSSI_DUMMY_MARKER\t127\n/* NB: pow2 to optimize out * and / */\n#define\tIEEE80211_RSSI_EP_MULTIPLIER\t(1<<7)\n#define IEEE80211_RSSI_IN(x)\t\t((x) * IEEE80211_RSSI_EP_MULTIPLIER)\n#define _IEEE80211_RSSI_LPF(x, y, len) \\\n    (((x) != IEEE80211_RSSI_DUMMY_MARKER) ? (((x) * ((len) - 1) + (y)) / (len)) : (y))\n#define IEEE80211_RSSI_LPF(x, y) do {\t\t\t\t\t\\\n    if ((y) >= -20) {\t\t\t\t\t\t\t\\\n    \tx = _IEEE80211_RSSI_LPF((x), IEEE80211_RSSI_IN((y)), \t\t\\\n\t\tIEEE80211_RSSI_LPF_LEN);\t\t\t\t\\\n    }\t\t\t\t\t\t\t\t\t\\\n} while (0)\n#define\tIEEE80211_RSSI_EP_RND(x, mul) \\\n\t((((x) % (mul)) >= ((mul)/2)) ? ((x) + ((mul) - 1)) / (mul) : (x)/(mul))\n#define\tIEEE80211_RSSI_GET(x) \\\n\tIEEE80211_RSSI_EP_RND(x, IEEE80211_RSSI_EP_MULTIPLIER)\n\nstatic __inline struct ieee80211_node *\nieee80211_ref_node(struct ieee80211_node *ni)\n{\n\tieee80211_node_incref(ni);\n\treturn ni;\n}\n\nstatic __inline void\nieee80211_unref_node(struct ieee80211_node **ni)\n{\n\tieee80211_node_decref(*ni);\n\t*ni = NULL;\t\t\t/* guard against use */\n}\n\nstruct ieee80211com;\n\nvoid\tieee80211_node_attach(struct ieee80211com *);\nvoid\tieee80211_node_lateattach(struct ieee80211com *);\nvoid\tieee80211_node_detach(struct ieee80211com *);\nvoid\tieee80211_node_vattach(struct ieee80211vap *);\nvoid\tieee80211_node_latevattach(struct ieee80211vap *);\nvoid\tieee80211_node_vdetach(struct ieee80211vap *);\n\nstatic __inline int\nieee80211_node_is_authorized(const struct ieee80211_node *ni)\n{\n\treturn (ni->ni_flags & IEEE80211_NODE_AUTH);\n}\n\nvoid\tieee80211_node_authorize(struct ieee80211_node *);\nvoid\tieee80211_node_unauthorize(struct ieee80211_node *);\n\nvoid\tieee80211_node_setuptxparms(struct ieee80211_node *);\nvoid\tieee80211_node_set_chan(struct ieee80211_node *,\n\t\tstruct ieee80211_channel *);\nvoid\tieee80211_create_ibss(struct ieee80211vap*, struct ieee80211_channel *);\nvoid\tieee80211_reset_bss(struct ieee80211vap *);\nvoid\tieee80211_sync_curchan(struct ieee80211com *);\nvoid\tieee80211_setupcurchan(struct ieee80211com *,\n\t    struct ieee80211_channel *);\nvoid\tieee80211_setcurchan(struct ieee80211com *, struct ieee80211_channel *);\nint\tieee80211_ibss_merge(struct ieee80211_node *);\nstruct ieee80211_scan_entry;\nint\tieee80211_sta_join(struct ieee80211vap *, struct ieee80211_channel *,\n\t\tconst struct ieee80211_scan_entry *);\nvoid\tieee80211_sta_leave(struct ieee80211_node *);\nvoid\tieee80211_node_deauth(struct ieee80211_node *, int);\n\nint\tieee80211_ies_init(struct ieee80211_ies *, const uint8_t *, int);\nvoid\tieee80211_ies_cleanup(struct ieee80211_ies *);\nvoid\tieee80211_ies_expand(struct ieee80211_ies *);\n#define\tieee80211_ies_setie(_ies, _ie, _off) do {\t\t\\\n\t(_ies)._ie = (_ies).data + (_off);\t\t\t\\\n} while (0)\n\n/*\n * Table of ieee80211_node instances.  Each ieee80211com\n * has one that holds association stations (when operating\n * as an ap) or neighbors (in ibss mode).\n *\n * XXX embed this in ieee80211com instead of indirect?\n */\nstruct ieee80211_node_table {\n\tstruct ieee80211com\t*nt_ic;\t\t/* back reference */\n\tieee80211_node_lock_t\tnt_nodelock;\t/* on node table */\n\tTAILQ_HEAD(, ieee80211_node) nt_node;\t/* information of all nodes */\n\tLIST_HEAD(, ieee80211_node) nt_hash[IEEE80211_NODE_HASHSIZE];\n\tstruct ieee80211_node\t**nt_keyixmap;\t/* key ix -> node map */\n\tint\t\t\tnt_keyixmax;\t/* keyixmap size */\n\tconst char\t\t*nt_name;\t/* table name for debug msgs */\n\tieee80211_scan_lock_t\tnt_scanlock;\t/* on nt_scangen */\n\tu_int\t\t\tnt_scangen;\t/* gen# for iterators */\n\tint\t\t\tnt_inact_init;\t/* initial node inact setting */\n};\n\nstruct ieee80211_node *ieee80211_alloc_node(struct ieee80211_node_table *,\n\t\tstruct ieee80211vap *,\n\t\tconst uint8_t macaddr[IEEE80211_ADDR_LEN]);\nstruct ieee80211_node *ieee80211_tmp_node(struct ieee80211vap *,\n\t\tconst uint8_t macaddr[IEEE80211_ADDR_LEN]);\nstruct ieee80211_node *ieee80211_dup_bss(struct ieee80211vap *,\n\t\tconst uint8_t macaddr[IEEE80211_ADDR_LEN]);\nstruct ieee80211_node *ieee80211_node_create_wds(struct ieee80211vap *,\n\t\tconst uint8_t bssid[IEEE80211_ADDR_LEN],\n\t\tstruct ieee80211_channel *);\n#ifdef IEEE80211_DEBUG_REFCNT\nvoid\tieee80211_free_node_debug(struct ieee80211_node *,\n\t\tconst char *func, int line);\nstruct ieee80211_node *ieee80211_find_node_locked_debug(\n\t\tstruct ieee80211_node_table *,\n\t\tconst uint8_t macaddr[IEEE80211_ADDR_LEN],\n\t\tconst char *func, int line);\nstruct ieee80211_node *ieee80211_find_node_debug(struct ieee80211_node_table *,\n\t\tconst uint8_t macaddr[IEEE80211_ADDR_LEN],\n\t\tconst char *func, int line);\nstruct ieee80211_node *ieee80211_find_vap_node_locked_debug(\n\t\tstruct ieee80211_node_table *,\n\t\tconst struct ieee80211vap *vap,\n\t\tconst uint8_t macaddr[IEEE80211_ADDR_LEN],\n\t\tconst char *func, int line);\nstruct ieee80211_node *ieee80211_find_vap_node_debug(\n\t\tstruct ieee80211_node_table *,\n\t\tconst struct ieee80211vap *vap,\n\t\tconst uint8_t macaddr[IEEE80211_ADDR_LEN],\n\t\tconst char *func, int line);\nstruct ieee80211_node * ieee80211_find_rxnode_debug(struct ieee80211com *,\n\t\tconst struct ieee80211_frame_min *,\n\t\tconst char *func, int line);\nstruct ieee80211_node * ieee80211_find_rxnode_withkey_debug(\n\t\tstruct ieee80211com *,\n\t\tconst struct ieee80211_frame_min *, uint16_t keyix,\n\t\tconst char *func, int line);\nstruct ieee80211_node *ieee80211_find_txnode_debug(struct ieee80211vap *,\n\t\tconst uint8_t *,\n\t\tconst char *func, int line);\n#define\tieee80211_free_node(ni) \\\n\tieee80211_free_node_debug(ni, __func__, __LINE__)\n#define\tieee80211_find_node_locked(nt, mac) \\\n\tieee80211_find_node_locked_debug(nt, mac, __func__, __LINE__)\n#define\tieee80211_find_node(nt, mac) \\\n\tieee80211_find_node_debug(nt, mac, __func__, __LINE__)\n#define\tieee80211_find_vap_node_locked(nt, vap, mac) \\\n\tieee80211_find_vap_node_locked_debug(nt, vap, mac, __func__, __LINE__)\n#define\tieee80211_find_vap_node(nt, vap, mac) \\\n\tieee80211_find_vap_node_debug(nt, vap, mac, __func__, __LINE__)\n#define\tieee80211_find_rxnode(ic, wh) \\\n\tieee80211_find_rxnode_debug(ic, wh, __func__, __LINE__)\n#define\tieee80211_find_rxnode_withkey(ic, wh, keyix) \\\n\tieee80211_find_rxnode_withkey_debug(ic, wh, keyix, __func__, __LINE__)\n#define\tieee80211_find_txnode(vap, mac) \\\n\tieee80211_find_txnode_debug(vap, mac, __func__, __LINE__)\n#else\nvoid\tieee80211_free_node(struct ieee80211_node *);\nstruct ieee80211_node *ieee80211_find_node_locked(struct ieee80211_node_table *,\n\t\tconst uint8_t macaddr[IEEE80211_ADDR_LEN]);\nstruct ieee80211_node *ieee80211_find_node(struct ieee80211_node_table *,\n\t\tconst uint8_t macaddr[IEEE80211_ADDR_LEN]);\nstruct ieee80211_node *ieee80211_find_vap_node_locked(\n\t\tstruct ieee80211_node_table *, const struct ieee80211vap *,\n\t\tconst uint8_t macaddr[IEEE80211_ADDR_LEN]);\nstruct ieee80211_node *ieee80211_find_vap_node(\n\t\tstruct ieee80211_node_table *, const struct ieee80211vap *,\n\t\tconst uint8_t macaddr[IEEE80211_ADDR_LEN]);\nstruct ieee80211_node * ieee80211_find_rxnode(struct ieee80211com *,\n\t\tconst struct ieee80211_frame_min *);\nstruct ieee80211_node * ieee80211_find_rxnode_withkey(struct ieee80211com *,\n\t\tconst struct ieee80211_frame_min *, uint16_t keyix);\nstruct ieee80211_node *ieee80211_find_txnode(struct ieee80211vap *,\n\t\tconst uint8_t macaddr[IEEE80211_ADDR_LEN]);\n#endif\nint\tieee80211_node_delucastkey(struct ieee80211_node *);\nvoid\tieee80211_node_timeout(void *arg);\n\ntypedef void ieee80211_iter_func(void *, struct ieee80211_node *);\nvoid\tieee80211_iterate_nodes(struct ieee80211_node_table *,\n\t\tieee80211_iter_func *, void *);\n\nvoid\tieee80211_notify_erp(struct ieee80211com *);\nvoid\tieee80211_dump_node(struct ieee80211_node_table *,\n\t\tstruct ieee80211_node *);\nvoid\tieee80211_dump_nodes(struct ieee80211_node_table *);\n\nstruct ieee80211_node *ieee80211_fakeup_adhoc_node(struct ieee80211vap *,\n\t\tconst uint8_t macaddr[IEEE80211_ADDR_LEN]);\nstruct ieee80211_scanparams;\nvoid\tieee80211_init_neighbor(struct ieee80211_node *,\n\t\tconst struct ieee80211_frame *,\n\t\tconst struct ieee80211_scanparams *);\nstruct ieee80211_node *ieee80211_add_neighbor(struct ieee80211vap *,\n\t\tconst struct ieee80211_frame *,\n\t\tconst struct ieee80211_scanparams *);\nvoid\tieee80211_node_join(struct ieee80211_node *,int);\nvoid\tieee80211_node_leave(struct ieee80211_node *);\nint8_t\tieee80211_getrssi(struct ieee80211vap *);\nvoid\tieee80211_getsignal(struct ieee80211vap *, int8_t *, int8_t *);\n#endif /* _NET80211_IEEE80211_NODE_H_ */\n"
  },
  {
    "path": "freebsd-headers/net80211/ieee80211_phy.h",
    "content": "/*-\n * Copyright (c) 2007-2008 Sam Leffler, Errno Consulting\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR\n * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES\n * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,\n * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF\n * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/net80211/ieee80211_phy.h 193072 2009-05-29 23:39:16Z sam $\n */\n\n#ifndef _NET80211_IEEE80211_PHY_H_\n#define _NET80211_IEEE80211_PHY_H_\n\n#ifdef _KERNEL\n/*\n * IEEE 802.11 PHY-related definitions.\n */\n\n/*\n * Contention window (slots).\n */\n#define IEEE80211_CW_MAX\t1023\t/* aCWmax */\n#define IEEE80211_CW_MIN_0\t31\t/* DS/CCK aCWmin, ERP aCWmin(0) */\n#define IEEE80211_CW_MIN_1\t15\t/* OFDM aCWmin, ERP aCWmin(1) */\n\n/*\n * SIFS (microseconds).\n */\n#define IEEE80211_DUR_SIFS\t10\t/* DS/CCK/ERP SIFS */\n#define IEEE80211_DUR_OFDM_SIFS\t16\t/* OFDM SIFS */\n\n/*\n * Slot time (microseconds).\n */\n#define IEEE80211_DUR_SLOT\t20\t/* DS/CCK slottime, ERP long slottime */\n#define IEEE80211_DUR_SHSLOT\t9\t/* ERP short slottime */\n#define IEEE80211_DUR_OFDM_SLOT\t9\t/* OFDM slottime */\n\n/*\n * DIFS (microseconds).\n */\n#define IEEE80211_DUR_DIFS(sifs, slot)\t((sifs) + 2 * (slot))\n\nstruct ieee80211_channel;\n\nstruct ieee80211_rate_table {\n\tint\t\trateCount;\t\t/* NB: for proper padding */\n\tuint8_t\t\trateCodeToIndex[256];\t/* back mapping */\n\tstruct {\n\t\tuint8_t\t\tphy;\t\t/* CCK/OFDM/TURBO */\n\t\tuint32_t\trateKbps;\t/* transfer rate in kbs */\n\t\tuint8_t\t\tshortPreamble;\t/* mask for enabling short\n\t\t\t\t\t\t * preamble in CCK rate code */\n\t\tuint8_t\t\tdot11Rate;\t/* value for supported rates\n\t\t\t\t\t\t * info element of MLME */\n\t\tuint8_t\t\tctlRateIndex;\t/* index of next lower basic\n\t\t\t\t\t\t * rate; used for dur. calcs */\n\t\tuint16_t\tlpAckDuration;\t/* long preamble ACK dur. */\n\t\tuint16_t\tspAckDuration;\t/* short preamble ACK dur. */\n\t} info[32];\n};\n\nconst struct ieee80211_rate_table *ieee80211_get_ratetable(\n\t\t\tstruct ieee80211_channel *);\n\nstatic __inline__ uint8_t\nieee80211_ack_rate(const struct ieee80211_rate_table *rt, uint8_t rate)\n{\n\tuint8_t cix = rt->info[rt->rateCodeToIndex[rate]].ctlRateIndex;\n\tKASSERT(cix != (uint8_t)-1, (\"rate %d has no info\", rate));\n\treturn rt->info[cix].dot11Rate;\n}\n\nstatic __inline__ uint8_t\nieee80211_ctl_rate(const struct ieee80211_rate_table *rt, uint8_t rate)\n{\n\tuint8_t cix = rt->info[rt->rateCodeToIndex[rate]].ctlRateIndex;\n\tKASSERT(cix != (uint8_t)-1, (\"rate %d has no info\", rate));\n\treturn rt->info[cix].dot11Rate;\n}\n\nstatic __inline__ enum ieee80211_phytype\nieee80211_rate2phytype(const struct ieee80211_rate_table *rt, uint8_t rate)\n{\n\tuint8_t rix = rt->rateCodeToIndex[rate];\n\tKASSERT(rix != (uint8_t)-1, (\"rate %d has no info\", rate));\n\treturn rt->info[rix].phy;\n}\n\nstatic __inline__ int\nieee80211_isratevalid(const struct ieee80211_rate_table *rt, uint8_t rate)\n{\n\treturn rt->rateCodeToIndex[rate] != (uint8_t)-1;\n}\n\n/*\n * Calculate ACK field for\n * o  non-fragment data frames\n * o  management frames\n * sent using rate, phy and short preamble setting.\n */\nstatic __inline__ uint16_t\nieee80211_ack_duration(const struct ieee80211_rate_table *rt,\n    uint8_t rate, int isShortPreamble)\n{\n\tuint8_t rix = rt->rateCodeToIndex[rate];\n\n\tKASSERT(rix != (uint8_t)-1, (\"rate %d has no info\", rate));\n\tif (isShortPreamble) {\n\t\tKASSERT(rt->info[rix].spAckDuration != 0,\n\t\t\t(\"shpreamble ack dur is not computed!\\n\"));\n\t\treturn rt->info[rix].spAckDuration;\n\t} else {\n\t\tKASSERT(rt->info[rix].lpAckDuration != 0,\n\t\t\t(\"lgpreamble ack dur is not computed!\\n\"));\n\t\treturn rt->info[rix].lpAckDuration;\n\t}\n}\n\n/*\n * Compute the time to transmit a frame of length frameLen bytes\n * using the specified 802.11 rate code, phy, and short preamble\n * setting.\n *\n * NB: SIFS is included.\n */\nuint16_t\tieee80211_compute_duration(const struct ieee80211_rate_table *,\n\t\t\tuint32_t frameLen, uint16_t rate, int isShortPreamble);\n/*\n * Convert PLCP signal/rate field to 802.11 rate code (.5Mbits/s)\n */\nuint8_t\t\tieee80211_plcp2rate(uint8_t, enum ieee80211_phytype);\n/*\n * Convert 802.11 rate code to PLCP signal.\n */\nuint8_t\t\tieee80211_rate2plcp(int, enum ieee80211_phytype);\n#endif\t/* _KERNEL */\n#endif\t/* !_NET80211_IEEE80211_PHY_H_ */\n"
  },
  {
    "path": "freebsd-headers/net80211/ieee80211_power.h",
    "content": "/*-\n * Copyright (c) 2002-2008 Sam Leffler, Errno Consulting\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR\n * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES\n * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,\n * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF\n * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/net80211/ieee80211_power.h 184288 2008-10-26 01:04:46Z sam $\n */\n#ifndef _NET80211_IEEE80211_POWER_H_\n#define _NET80211_IEEE80211_POWER_H_\n\nstruct ieee80211com;\nstruct ieee80211vap;\nstruct ieee80211_node;\nstruct mbuf;\n\n/*\n * Power save packet queues.  There are two queues, one\n * for frames coming from the net80211 layer and the other\n * for frames that come from the driver. Frames from the\n * driver are expected to have M_ENCAP marked to indicate\n * they have already been encapsulated and are treated as\n * higher priority: they are sent first when flushing the\n * queue on a power save state change or in response to a\n * ps-poll frame.\n *\n * Note that frames sent from the high priority queue are\n * fed directly to the driver without going through\n * ieee80211_start again; drivers that send up encap'd\n * frames are required to handle them when they come back.\n */\nstruct ieee80211_psq {\n\tieee80211_psq_lock_t psq_lock;\n\tint\tpsq_len;\n\tint\tpsq_maxlen;\n\tint\tpsq_drops;\n\tstruct ieee80211_psq_head {\n\t\tstruct mbuf *head;\n\t\tstruct mbuf *tail;\n\t\tint len;\n\t} psq_head[2];\t\t\t/* 2 priorities */\n};\n\nvoid\tieee80211_psq_init(struct ieee80211_psq *, const char *);\nvoid\tieee80211_psq_cleanup(struct ieee80211_psq *);\n\nvoid\tieee80211_power_attach(struct ieee80211com *);\nvoid\tieee80211_power_detach(struct ieee80211com *);\nvoid\tieee80211_power_vattach(struct ieee80211vap *);\nvoid\tieee80211_power_vdetach(struct ieee80211vap *);\nvoid\tieee80211_power_latevattach(struct ieee80211vap *);\n\nstruct mbuf *ieee80211_node_psq_dequeue(struct ieee80211_node *ni, int *qlen);\nint\tieee80211_node_psq_drain(struct ieee80211_node *);\nint\tieee80211_node_psq_age(struct ieee80211_node *);\nint\tieee80211_pwrsave(struct ieee80211_node *, struct mbuf *);\nvoid\tieee80211_node_pwrsave(struct ieee80211_node *, int enable);\nvoid\tieee80211_sta_pwrsave(struct ieee80211vap *, int enable);\n\nvoid\tieee80211_power_poll(struct ieee80211com *);\n#endif /* _NET80211_IEEE80211_POWER_H_ */\n"
  },
  {
    "path": "freebsd-headers/net80211/ieee80211_proto.h",
    "content": "/*-\n * Copyright (c) 2001 Atsushi Onoe\n * Copyright (c) 2002-2009 Sam Leffler, Errno Consulting\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR\n * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES\n * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,\n * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF\n * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/net80211/ieee80211_proto.h 220445 2011-04-08 09:20:45Z adrian $\n */\n#ifndef _NET80211_IEEE80211_PROTO_H_\n#define _NET80211_IEEE80211_PROTO_H_\n\n/*\n * 802.11 protocol implementation definitions.\n */\n\nenum ieee80211_state {\n\tIEEE80211_S_INIT\t= 0,\t/* default state */\n\tIEEE80211_S_SCAN\t= 1,\t/* scanning */\n\tIEEE80211_S_AUTH\t= 2,\t/* try to authenticate */\n\tIEEE80211_S_ASSOC\t= 3,\t/* try to assoc */\n\tIEEE80211_S_CAC\t\t= 4,\t/* doing channel availability check */\n\tIEEE80211_S_RUN\t\t= 5,\t/* operational (e.g. associated) */\n\tIEEE80211_S_CSA\t\t= 6,\t/* channel switch announce pending */\n\tIEEE80211_S_SLEEP\t= 7,\t/* power save */\n};\n#define\tIEEE80211_S_MAX\t\t(IEEE80211_S_SLEEP+1)\n\n#define\tIEEE80211_SEND_MGMT(_ni,_type,_arg) \\\n\t((*(_ni)->ni_ic->ic_send_mgmt)(_ni, _type, _arg))\n\nextern\tconst char *ieee80211_mgt_subtype_name[];\nextern\tconst char *ieee80211_phymode_name[IEEE80211_MODE_MAX];\nextern\tconst int ieee80211_opcap[IEEE80211_OPMODE_MAX];\n\nvoid\tieee80211_proto_attach(struct ieee80211com *);\nvoid\tieee80211_proto_detach(struct ieee80211com *);\nvoid\tieee80211_proto_vattach(struct ieee80211vap *);\nvoid\tieee80211_proto_vdetach(struct ieee80211vap *);\n\nvoid\tieee80211_syncifflag_locked(struct ieee80211com *, int flag);\nvoid\tieee80211_syncflag(struct ieee80211vap *, int flag);\nvoid\tieee80211_syncflag_ht(struct ieee80211vap *, int flag);\nvoid\tieee80211_syncflag_ext(struct ieee80211vap *, int flag);\n\n#define\tIEEE80211_R_NF\t\t0x0000001\t/* global NF value valid */\n#define\tIEEE80211_R_RSSI\t0x0000002\t/* global RSSI value valid */\n#define\tIEEE80211_R_C_CHAIN\t0x0000004\t/* RX chain count valid */\n#define\tIEEE80211_R_C_NF\t0x0000008\t/* per-chain NF value valid */\n#define\tIEEE80211_R_C_RSSI\t0x0000010\t/* per-chain RSSI value valid */\n#define\tIEEE80211_R_C_EVM\t0x0000020\t/* per-chain EVM valid */\n#define\tIEEE80211_R_C_HT40\t0x0000040\t/* RX'ed packet is 40mhz, pilots 4,5 valid */\n\nstruct ieee80211_rx_stats {\n\tuint32_t r_flags;\t\t/* IEEE80211_R_* flags */\n\tuint8_t c_chain;\t\t/* number of RX chains involved */\n\tint16_t\tc_nf_ctl[IEEE80211_MAX_CHAINS];\t/* per-chain NF */\n\tint16_t\tc_nf_ext[IEEE80211_MAX_CHAINS];\t/* per-chain NF */\n\tint16_t\tc_rssi_ctl[IEEE80211_MAX_CHAINS];\t/* per-chain RSSI */\n\tint16_t\tc_rssi_ext[IEEE80211_MAX_CHAINS];\t/* per-chain RSSI */\n\tuint8_t nf;\t\t\t/* global NF */\n\tuint8_t rssi;\t\t\t/* global RSSI */\n\tuint8_t evm[IEEE80211_MAX_CHAINS][IEEE80211_MAX_EVM_PILOTS];\n\t\t\t\t\t/* per-chain, per-pilot EVM values */\n};\n\n#define\tieee80211_input(ni, m, rssi, nf) \\\n\t((ni)->ni_vap->iv_input(ni, m, rssi, nf))\nint\tieee80211_input_all(struct ieee80211com *, struct mbuf *, int, int);\n\nint\tieee80211_input_mimo(struct ieee80211_node *, struct mbuf *,\n\t    struct ieee80211_rx_stats *);\nint\tieee80211_input_mimo_all(struct ieee80211com *, struct mbuf *,\n\t    struct ieee80211_rx_stats *);\n\nstruct ieee80211_bpf_params;\nint\tieee80211_mgmt_output(struct ieee80211_node *, struct mbuf *, int,\n\t\tstruct ieee80211_bpf_params *);\nint\tieee80211_raw_xmit(struct ieee80211_node *, struct mbuf *,\n\t\tconst struct ieee80211_bpf_params *);\nint\tieee80211_output(struct ifnet *, struct mbuf *,\n               struct sockaddr *, struct route *ro);\nvoid\tieee80211_send_setup(struct ieee80211_node *, struct mbuf *, int, int,\n        const uint8_t [IEEE80211_ADDR_LEN], const uint8_t [IEEE80211_ADDR_LEN],\n        const uint8_t [IEEE80211_ADDR_LEN]);\nvoid\tieee80211_start(struct ifnet *);\nint\tieee80211_send_nulldata(struct ieee80211_node *);\nint\tieee80211_classify(struct ieee80211_node *, struct mbuf *m);\nstruct mbuf *ieee80211_mbuf_adjust(struct ieee80211vap *, int,\n\t\tstruct ieee80211_key *, struct mbuf *);\nstruct mbuf *ieee80211_encap(struct ieee80211vap *, struct ieee80211_node *,\n\t\tstruct mbuf *);\nint\tieee80211_send_mgmt(struct ieee80211_node *, int, int);\nstruct ieee80211_appie;\nint\tieee80211_send_probereq(struct ieee80211_node *ni,\n\t\tconst uint8_t sa[IEEE80211_ADDR_LEN],\n\t\tconst uint8_t da[IEEE80211_ADDR_LEN],\n\t\tconst uint8_t bssid[IEEE80211_ADDR_LEN],\n\t\tconst uint8_t *ssid, size_t ssidlen);\n/*\n * The formation of ProbeResponse frames requires guidance to\n * deal with legacy clients.  When the client is identified as\n * \"legacy 11b\" ieee80211_send_proberesp is passed this token.\n */\n#define\tIEEE80211_SEND_LEGACY_11B\t0x1\t/* legacy 11b client */\n#define\tIEEE80211_SEND_LEGACY_11\t0x2\t/* other legacy client */\n#define\tIEEE80211_SEND_LEGACY\t\t0x3\t/* any legacy client */\nstruct mbuf *ieee80211_alloc_proberesp(struct ieee80211_node *, int);\nint\tieee80211_send_proberesp(struct ieee80211vap *,\n\t\tconst uint8_t da[IEEE80211_ADDR_LEN], int);\nstruct mbuf *ieee80211_alloc_rts(struct ieee80211com *ic,\n\t\tconst uint8_t [IEEE80211_ADDR_LEN],\n\t\tconst uint8_t [IEEE80211_ADDR_LEN], uint16_t);\nstruct mbuf *ieee80211_alloc_cts(struct ieee80211com *,\n\t\tconst uint8_t [IEEE80211_ADDR_LEN], uint16_t);\n\nuint8_t *ieee80211_add_rates(uint8_t *, const struct ieee80211_rateset *);\nuint8_t *ieee80211_add_xrates(uint8_t *, const struct ieee80211_rateset *);\nuint16_t ieee80211_getcapinfo(struct ieee80211vap *,\n\t\tstruct ieee80211_channel *);\n\nvoid\tieee80211_reset_erp(struct ieee80211com *);\nvoid\tieee80211_set_shortslottime(struct ieee80211com *, int onoff);\nint\tieee80211_iserp_rateset(const struct ieee80211_rateset *);\nvoid\tieee80211_setbasicrates(struct ieee80211_rateset *,\n\t\tenum ieee80211_phymode);\nvoid\tieee80211_addbasicrates(struct ieee80211_rateset *,\n\t\tenum ieee80211_phymode);\n\n/*\n * Return the size of the 802.11 header for a management or data frame.\n */\nstatic __inline int\nieee80211_hdrsize(const void *data)\n{\n\tconst struct ieee80211_frame *wh = data;\n\tint size = sizeof(struct ieee80211_frame);\n\n\t/* NB: we don't handle control frames */\n\tKASSERT((wh->i_fc[0]&IEEE80211_FC0_TYPE_MASK) != IEEE80211_FC0_TYPE_CTL,\n\t\t(\"%s: control frame\", __func__));\n\tif (IEEE80211_IS_DSTODS(wh))\n\t\tsize += IEEE80211_ADDR_LEN;\n\tif (IEEE80211_QOS_HAS_SEQ(wh))\n\t\tsize += sizeof(uint16_t);\n\treturn size;\n}\n\n/*\n * Like ieee80211_hdrsize, but handles any type of frame.\n */\nstatic __inline int\nieee80211_anyhdrsize(const void *data)\n{\n\tconst struct ieee80211_frame *wh = data;\n\n\tif ((wh->i_fc[0]&IEEE80211_FC0_TYPE_MASK) == IEEE80211_FC0_TYPE_CTL) {\n\t\tswitch (wh->i_fc[0] & IEEE80211_FC0_SUBTYPE_MASK) {\n\t\tcase IEEE80211_FC0_SUBTYPE_CTS:\n\t\tcase IEEE80211_FC0_SUBTYPE_ACK:\n\t\t\treturn sizeof(struct ieee80211_frame_ack);\n\t\tcase IEEE80211_FC0_SUBTYPE_BAR:\n\t\t\treturn sizeof(struct ieee80211_frame_bar);\n\t\t}\n\t\treturn sizeof(struct ieee80211_frame_min);\n\t} else\n\t\treturn ieee80211_hdrsize(data);\n}\n\n/*\n * Template for an in-kernel authenticator.  Authenticators\n * register with the protocol code and are typically loaded\n * as separate modules as needed.  One special authenticator\n * is xauth; it intercepts requests so that protocols like\n * WPA can be handled in user space.\n */\nstruct ieee80211_authenticator {\n\tconst char *ia_name;\t\t/* printable name */\n\tint\t(*ia_attach)(struct ieee80211vap *);\n\tvoid\t(*ia_detach)(struct ieee80211vap *);\n\tvoid\t(*ia_node_join)(struct ieee80211_node *);\n\tvoid\t(*ia_node_leave)(struct ieee80211_node *);\n};\nvoid\tieee80211_authenticator_register(int type,\n\t\tconst struct ieee80211_authenticator *);\nvoid\tieee80211_authenticator_unregister(int type);\nconst struct ieee80211_authenticator *ieee80211_authenticator_get(int auth);\n\nstruct ieee80211req;\n/*\n * Template for an MAC ACL policy module.  Such modules\n * register with the protocol code and are passed the sender's\n * address of each received auth frame for validation.\n */\nstruct ieee80211_aclator {\n\tconst char *iac_name;\t\t/* printable name */\n\tint\t(*iac_attach)(struct ieee80211vap *);\n\tvoid\t(*iac_detach)(struct ieee80211vap *);\n\tint\t(*iac_check)(struct ieee80211vap *,\n\t\t\tconst uint8_t mac[IEEE80211_ADDR_LEN]);\n\tint\t(*iac_add)(struct ieee80211vap *,\n\t\t\tconst uint8_t mac[IEEE80211_ADDR_LEN]);\n\tint\t(*iac_remove)(struct ieee80211vap *,\n\t\t\tconst uint8_t mac[IEEE80211_ADDR_LEN]);\n\tint\t(*iac_flush)(struct ieee80211vap *);\n\tint\t(*iac_setpolicy)(struct ieee80211vap *, int);\n\tint\t(*iac_getpolicy)(struct ieee80211vap *);\n\tint\t(*iac_setioctl)(struct ieee80211vap *, struct ieee80211req *);\n\tint\t(*iac_getioctl)(struct ieee80211vap *, struct ieee80211req *);\n};\nvoid\tieee80211_aclator_register(const struct ieee80211_aclator *);\nvoid\tieee80211_aclator_unregister(const struct ieee80211_aclator *);\nconst struct ieee80211_aclator *ieee80211_aclator_get(const char *name);\n\n/* flags for ieee80211_fix_rate() */\n#define\tIEEE80211_F_DOSORT\t0x00000001\t/* sort rate list */\n#define\tIEEE80211_F_DOFRATE\t0x00000002\t/* use fixed legacy rate */\n#define\tIEEE80211_F_DONEGO\t0x00000004\t/* calc negotiated rate */\n#define\tIEEE80211_F_DODEL\t0x00000008\t/* delete ignore rate */\n#define\tIEEE80211_F_DOBRS\t0x00000010\t/* check basic rate set */\n#define\tIEEE80211_F_JOIN\t0x00000020\t/* sta joining our bss */\n#define\tIEEE80211_F_DOFMCS\t0x00000040\t/* use fixed HT rate */\nint\tieee80211_fix_rate(struct ieee80211_node *,\n\t\tstruct ieee80211_rateset *, int);\n\n/*\n * WME/WMM support.\n */\nstruct wmeParams {\n\tuint8_t\t\twmep_acm;\n\tuint8_t\t\twmep_aifsn;\n\tuint8_t\t\twmep_logcwmin;\t\t/* log2(cwmin) */\n\tuint8_t\t\twmep_logcwmax;\t\t/* log2(cwmax) */\n\tuint8_t\t\twmep_txopLimit;\n\tuint8_t\t\twmep_noackPolicy;\t/* 0 (ack), 1 (no ack) */\n};\n#define\tIEEE80211_TXOP_TO_US(_txop)\t((_txop)<<5)\n#define\tIEEE80211_US_TO_TXOP(_us)\t((_us)>>5)\n\nstruct chanAccParams {\n\tuint8_t\t\tcap_info;\t\t/* version of the current set */\n\tstruct wmeParams cap_wmeParams[WME_NUM_AC];\n};\n\nstruct ieee80211_wme_state {\n\tu_int\twme_flags;\n#define\tWME_F_AGGRMODE\t0x00000001\t/* STATUS: WME agressive mode */\n\tu_int\twme_hipri_traffic;\t/* VI/VO frames in beacon interval */\n\tu_int\twme_hipri_switch_thresh;/* agressive mode switch thresh */\n\tu_int\twme_hipri_switch_hysteresis;/* agressive mode switch hysteresis */\n\n\tstruct wmeParams wme_params[4];\t\t/* from assoc resp for each AC*/\n\tstruct chanAccParams wme_wmeChanParams;\t/* WME params applied to self */\n\tstruct chanAccParams wme_wmeBssChanParams;/* WME params bcast to stations */\n\tstruct chanAccParams wme_chanParams;\t/* params applied to self */\n\tstruct chanAccParams wme_bssChanParams;\t/* params bcast to stations */\n\n\tint\t(*wme_update)(struct ieee80211com *);\n};\n\nvoid\tieee80211_wme_initparams(struct ieee80211vap *);\nvoid\tieee80211_wme_updateparams(struct ieee80211vap *);\nvoid\tieee80211_wme_updateparams_locked(struct ieee80211vap *);\n\n/*\n * Return the WME TID from a QoS frame.  If no TID\n * is present return the index for the \"non-QoS\" entry.\n */\nstatic __inline uint8_t\nieee80211_gettid(const struct ieee80211_frame *wh)\n{\n\tuint8_t tid;\n\n\tif (IEEE80211_QOS_HAS_SEQ(wh)) {\n\t\tif (IEEE80211_IS_DSTODS(wh))\n\t\t\ttid = ((const struct ieee80211_qosframe_addr4 *)wh)->\n\t\t\t\ti_qos[0];\n\t\telse\n\t\t\ttid = ((const struct ieee80211_qosframe *)wh)->i_qos[0];\n\t\ttid &= IEEE80211_QOS_TID;\n\t} else\n\t\ttid = IEEE80211_NONQOS_TID;\n\treturn tid;\n}\n\nvoid\tieee80211_waitfor_parent(struct ieee80211com *);\nvoid\tieee80211_start_locked(struct ieee80211vap *);\nvoid\tieee80211_init(void *);\nvoid\tieee80211_start_all(struct ieee80211com *);\nvoid\tieee80211_stop_locked(struct ieee80211vap *);\nvoid\tieee80211_stop(struct ieee80211vap *);\nvoid\tieee80211_stop_all(struct ieee80211com *);\nvoid\tieee80211_suspend_all(struct ieee80211com *);\nvoid\tieee80211_resume_all(struct ieee80211com *);\nvoid\tieee80211_dturbo_switch(struct ieee80211vap *, int newflags);\nvoid\tieee80211_swbmiss(void *arg);\nvoid\tieee80211_beacon_miss(struct ieee80211com *);\nint\tieee80211_new_state(struct ieee80211vap *, enum ieee80211_state, int);\nvoid\tieee80211_print_essid(const uint8_t *, int);\nvoid\tieee80211_dump_pkt(struct ieee80211com *,\n\t\tconst uint8_t *, int, int, int);\n\nextern \tconst char *ieee80211_opmode_name[];\nextern\tconst char *ieee80211_state_name[IEEE80211_S_MAX];\nextern\tconst char *ieee80211_wme_acnames[];\n\n/*\n * Beacon frames constructed by ieee80211_beacon_alloc\n * have the following structure filled in so drivers\n * can update the frame later w/ minimal overhead.\n */\nstruct ieee80211_beacon_offsets {\n\tuint8_t\t\tbo_flags[4];\t/* update/state flags */\n\tuint16_t\t*bo_caps;\t/* capabilities */\n\tuint8_t\t\t*bo_cfp;\t/* start of CFParms element */\n\tuint8_t\t\t*bo_tim;\t/* start of atim/dtim */\n\tuint8_t\t\t*bo_wme;\t/* start of WME parameters */\n\tuint8_t\t\t*bo_tdma;\t/* start of TDMA parameters */\n\tuint8_t\t\t*bo_tim_trailer;/* start of fixed-size trailer */\n\tuint16_t\tbo_tim_len;\t/* atim/dtim length in bytes */\n\tuint16_t\tbo_tim_trailer_len;/* tim trailer length in bytes */\n\tuint8_t\t\t*bo_erp;\t/* start of ERP element */\n\tuint8_t\t\t*bo_htinfo;\t/* start of HT info element */\n\tuint8_t\t\t*bo_ath;\t/* start of ATH parameters */\n\tuint8_t\t\t*bo_appie;\t/* start of AppIE element */\n\tuint16_t\tbo_appie_len;\t/* AppIE length in bytes */\n\tuint16_t\tbo_csa_trailer_len;\n\tuint8_t\t\t*bo_csa;\t/* start of CSA element */\n\tuint8_t\t\t*bo_meshconf;\t/* start of MESHCONF element */\n\tuint8_t\t\t*bo_spare[3];\n};\nstruct mbuf *ieee80211_beacon_alloc(struct ieee80211_node *,\n\t\tstruct ieee80211_beacon_offsets *);\n\n/*\n * Beacon frame updates are signaled through calls to iv_update_beacon\n * with one of the IEEE80211_BEACON_* tokens defined below.  For devices\n * that construct beacon frames on the host this can trigger a rebuild\n * or defer the processing.  For devices that offload beacon frame\n * handling this callback can be used to signal a rebuild.  The bo_flags\n * array in the ieee80211_beacon_offsets structure is intended to record\n * deferred processing requirements; ieee80211_beacon_update uses the\n * state to optimize work.  Since this structure is owned by the driver\n * and not visible to the 802.11 layer drivers must supply an iv_update_beacon\n * callback that marks the flag bits and schedules (as necessary) an update.\n */\nenum {\n\tIEEE80211_BEACON_CAPS\t= 0,\t/* capabilities */\n\tIEEE80211_BEACON_TIM\t= 1,\t/* DTIM/ATIM */\n\tIEEE80211_BEACON_WME\t= 2,\n\tIEEE80211_BEACON_ERP\t= 3,\t/* Extended Rate Phy */\n\tIEEE80211_BEACON_HTINFO\t= 4,\t/* HT Information */\n\tIEEE80211_BEACON_APPIE\t= 5,\t/* Application IE's */\n\tIEEE80211_BEACON_CFP\t= 6,\t/* CFParms */\n\tIEEE80211_BEACON_CSA\t= 7,\t/* Channel Switch Announcement */\n\tIEEE80211_BEACON_TDMA\t= 9,\t/* TDMA Info */\n\tIEEE80211_BEACON_ATH\t= 10,\t/* ATH parameters */\n\tIEEE80211_BEACON_MESHCONF = 11,\t/* Mesh Configuration */\n};\nint\tieee80211_beacon_update(struct ieee80211_node *,\n\t\tstruct ieee80211_beacon_offsets *, struct mbuf *, int mcast);\n\nvoid\tieee80211_csa_startswitch(struct ieee80211com *,\n\t\tstruct ieee80211_channel *, int mode, int count);\nvoid\tieee80211_csa_completeswitch(struct ieee80211com *);\nvoid\tieee80211_csa_cancelswitch(struct ieee80211com *);\nvoid\tieee80211_cac_completeswitch(struct ieee80211vap *);\n\n/*\n * Notification methods called from the 802.11 state machine.\n * Note that while these are defined here, their implementation\n * is OS-specific.\n */\nvoid\tieee80211_notify_node_join(struct ieee80211_node *, int newassoc);\nvoid\tieee80211_notify_node_leave(struct ieee80211_node *);\nvoid\tieee80211_notify_scan_done(struct ieee80211vap *);\nvoid\tieee80211_notify_wds_discover(struct ieee80211_node *);\nvoid\tieee80211_notify_csa(struct ieee80211com *,\n\t\tconst struct ieee80211_channel *, int mode, int count);\nvoid\tieee80211_notify_radar(struct ieee80211com *,\n\t\tconst struct ieee80211_channel *);\nenum ieee80211_notify_cac_event {\n\tIEEE80211_NOTIFY_CAC_START  = 0, /* CAC timer started */\n\tIEEE80211_NOTIFY_CAC_STOP   = 1, /* CAC intentionally stopped */\n\tIEEE80211_NOTIFY_CAC_RADAR  = 2, /* CAC stopped due to radar detectio */\n\tIEEE80211_NOTIFY_CAC_EXPIRE = 3, /* CAC expired w/o radar */\n};\nvoid\tieee80211_notify_cac(struct ieee80211com *,\n\t\tconst struct ieee80211_channel *,\n\t\tenum ieee80211_notify_cac_event);\nvoid\tieee80211_notify_node_deauth(struct ieee80211_node *);\nvoid\tieee80211_notify_node_auth(struct ieee80211_node *);\nvoid\tieee80211_notify_country(struct ieee80211vap *, const uint8_t [],\n\t\tconst uint8_t cc[2]);\nvoid\tieee80211_notify_radio(struct ieee80211com *, int);\n#endif /* _NET80211_IEEE80211_PROTO_H_ */\n"
  },
  {
    "path": "freebsd-headers/net80211/ieee80211_radiotap.h",
    "content": "/* $FreeBSD: release/9.0.0/sys/net80211/ieee80211_radiotap.h 174568 2007-12-13 01:23:40Z sam $ */\n/* $NetBSD: ieee80211_radiotap.h,v 1.16 2007/01/06 05:51:15 dyoung Exp $ */\n\n/*-\n * Copyright (c) 2003, 2004 David Young.  All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. The name of David Young may not be used to endorse or promote\n *    products derived from this software without specific prior\n *    written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY DAVID YOUNG ``AS IS'' AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,\n * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A\n * PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL DAVID\n * YOUNG BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,\n * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED\n * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\n * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,\n * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY\n * OF SUCH DAMAGE.\n */\n#ifndef _NET80211_IEEE80211_RADIOTAP_H_\n#define _NET80211_IEEE80211_RADIOTAP_H_\n\n/* A generic radio capture format is desirable. It must be\n * rigidly defined (e.g., units for fields should be given),\n * and easily extensible.\n *\n * The following is an extensible radio capture format. It is\n * based on a bitmap indicating which fields are present.\n *\n * I am trying to describe precisely what the application programmer\n * should expect in the following, and for that reason I tell the\n * units and origin of each measurement (where it applies), or else I\n * use sufficiently weaselly language (\"is a monotonically nondecreasing\n * function of...\") that I cannot set false expectations for lawyerly\n * readers.\n */\n#if defined(__KERNEL__) || defined(_KERNEL)\n#ifndef DLT_IEEE802_11_RADIO\n#define\tDLT_IEEE802_11_RADIO\t127\t/* 802.11 plus WLAN header */\n#endif\n#endif /* defined(__KERNEL__) || defined(_KERNEL) */\n\n#define\tIEEE80211_RADIOTAP_HDRLEN\t64\t/* XXX deprecated */\n\n/*\n * The radio capture header precedes the 802.11 header.\n *\n * Note well: all radiotap fields are little-endian.\n */\nstruct ieee80211_radiotap_header {\n\tuint8_t\t\tit_version;\t/* Version 0. Only increases\n\t\t\t\t\t * for drastic changes,\n\t\t\t\t\t * introduction of compatible\n\t\t\t\t\t * new fields does not count.\n\t\t\t\t\t */\n\tuint8_t\t\tit_pad;\n\tuint16_t\tit_len;\t\t/* length of the whole\n\t\t\t\t\t * header in bytes, including\n\t\t\t\t\t * it_version, it_pad,\n\t\t\t\t\t * it_len, and data fields.\n\t\t\t\t\t */\n\tuint32_t\tit_present;\t/* A bitmap telling which\n\t\t\t\t\t * fields are present. Set bit 31\n\t\t\t\t\t * (0x80000000) to extend the\n\t\t\t\t\t * bitmap by another 32 bits.\n\t\t\t\t\t * Additional extensions are made\n\t\t\t\t\t * by setting bit 31.\n\t\t\t\t\t */\n} __packed;\n\n/*\n * Name                                 Data type       Units\n * ----                                 ---------       -----\n *\n * IEEE80211_RADIOTAP_TSFT              uint64_t        microseconds\n *\n *      Value in microseconds of the MAC's 64-bit 802.11 Time\n *      Synchronization Function timer when the first bit of the\n *      MPDU arrived at the MAC. For received frames, only.\n *\n * IEEE80211_RADIOTAP_CHANNEL           2 x uint16_t    MHz, bitmap\n *\n *      Tx/Rx frequency in MHz, followed by flags (see below).\n *\n * IEEE80211_RADIOTAP_FHSS              uint16_t        see below\n *\n *      For frequency-hopping radios, the hop set (first byte)\n *      and pattern (second byte).\n *\n * IEEE80211_RADIOTAP_RATE              uint8_t         500kb/s or index\n *\n *      Tx/Rx data rate.  If bit 0x80 is set then it represents an\n *\tan MCS index and not an IEEE rate.\n *\n * IEEE80211_RADIOTAP_DBM_ANTSIGNAL     int8_t          decibels from\n *                                                      one milliwatt (dBm)\n *\n *      RF signal power at the antenna, decibel difference from\n *      one milliwatt.\n *\n * IEEE80211_RADIOTAP_DBM_ANTNOISE      int8_t          decibels from\n *                                                      one milliwatt (dBm)\n *\n *      RF noise power at the antenna, decibel difference from one\n *      milliwatt.\n *\n * IEEE80211_RADIOTAP_DB_ANTSIGNAL      uint8_t         decibel (dB)\n *\n *      RF signal power at the antenna, decibel difference from an\n *      arbitrary, fixed reference.\n *\n * IEEE80211_RADIOTAP_DB_ANTNOISE       uint8_t         decibel (dB)\n *\n *      RF noise power at the antenna, decibel difference from an\n *      arbitrary, fixed reference point.\n *\n * IEEE80211_RADIOTAP_LOCK_QUALITY      uint16_t        unitless\n *\n *      Quality of Barker code lock. Unitless. Monotonically\n *      nondecreasing with \"better\" lock strength. Called \"Signal\n *      Quality\" in datasheets.  (Is there a standard way to measure\n *      this?)\n *\n * IEEE80211_RADIOTAP_TX_ATTENUATION    uint16_t        unitless\n *\n *      Transmit power expressed as unitless distance from max\n *      power set at factory calibration.  0 is max power.\n *      Monotonically nondecreasing with lower power levels.\n *\n * IEEE80211_RADIOTAP_DB_TX_ATTENUATION uint16_t        decibels (dB)\n *\n *      Transmit power expressed as decibel distance from max power\n *      set at factory calibration.  0 is max power.  Monotonically\n *      nondecreasing with lower power levels.\n *\n * IEEE80211_RADIOTAP_DBM_TX_POWER      int8_t          decibels from\n *                                                      one milliwatt (dBm)\n *\n *      Transmit power expressed as dBm (decibels from a 1 milliwatt\n *      reference). This is the absolute power level measured at\n *      the antenna port.\n *\n * IEEE80211_RADIOTAP_FLAGS             uint8_t         bitmap\n *\n *      Properties of transmitted and received frames. See flags\n *      defined below.\n *\n * IEEE80211_RADIOTAP_ANTENNA           uint8_t         antenna index\n *\n *      Unitless indication of the Rx/Tx antenna for this packet.\n *      The first antenna is antenna 0.\n *\n * IEEE80211_RADIOTAP_XCHANNEL          uint32_t        bitmap\n *                                      uint16_t        MHz\n *                                      uint8_t         channel number\n *                                      int8_t          .5 dBm\n *\n *      Extended channel specification: flags (see below) followed by\n *      frequency in MHz, the corresponding IEEE channel number, and\n *      finally the maximum regulatory transmit power cap in .5 dBm\n *      units.  This property supersedes IEEE80211_RADIOTAP_CHANNEL\n *      and only one of the two should be present.\n */\nenum ieee80211_radiotap_type {\n\tIEEE80211_RADIOTAP_TSFT = 0,\n\tIEEE80211_RADIOTAP_FLAGS = 1,\n\tIEEE80211_RADIOTAP_RATE = 2,\n\tIEEE80211_RADIOTAP_CHANNEL = 3,\n\tIEEE80211_RADIOTAP_FHSS = 4,\n\tIEEE80211_RADIOTAP_DBM_ANTSIGNAL = 5,\n\tIEEE80211_RADIOTAP_DBM_ANTNOISE = 6,\n\tIEEE80211_RADIOTAP_LOCK_QUALITY = 7,\n\tIEEE80211_RADIOTAP_TX_ATTENUATION = 8,\n\tIEEE80211_RADIOTAP_DB_TX_ATTENUATION = 9,\n\tIEEE80211_RADIOTAP_DBM_TX_POWER = 10,\n\tIEEE80211_RADIOTAP_ANTENNA = 11,\n\tIEEE80211_RADIOTAP_DB_ANTSIGNAL = 12,\n\tIEEE80211_RADIOTAP_DB_ANTNOISE = 13,\n\t/* NB: gap for netbsd definitions */\n\tIEEE80211_RADIOTAP_XCHANNEL = 18,\n\tIEEE80211_RADIOTAP_EXT = 31,\n};\n\n#ifndef _KERNEL\n/* channel attributes */\n#define\tIEEE80211_CHAN_TURBO\t0x00000010 /* Turbo channel */\n#define\tIEEE80211_CHAN_CCK\t0x00000020 /* CCK channel */\n#define\tIEEE80211_CHAN_OFDM\t0x00000040 /* OFDM channel */\n#define\tIEEE80211_CHAN_2GHZ\t0x00000080 /* 2 GHz spectrum channel. */\n#define\tIEEE80211_CHAN_5GHZ\t0x00000100 /* 5 GHz spectrum channel */\n#define\tIEEE80211_CHAN_PASSIVE\t0x00000200 /* Only passive scan allowed */\n#define\tIEEE80211_CHAN_DYN\t0x00000400 /* Dynamic CCK-OFDM channel */\n#define\tIEEE80211_CHAN_GFSK\t0x00000800 /* GFSK channel (FHSS PHY) */\n#define\tIEEE80211_CHAN_GSM\t0x00001000 /* 900 MHz spectrum channel */\n#define\tIEEE80211_CHAN_STURBO\t0x00002000 /* 11a static turbo channel only */\n#define\tIEEE80211_CHAN_HALF\t0x00004000 /* Half rate channel */\n#define\tIEEE80211_CHAN_QUARTER\t0x00008000 /* Quarter rate channel */\n#endif /* !_KERNEL */\n\n/* For IEEE80211_RADIOTAP_FLAGS */\n#define\tIEEE80211_RADIOTAP_F_CFP\t0x01\t/* sent/received\n\t\t\t\t\t\t * during CFP\n\t\t\t\t\t\t */\n#define\tIEEE80211_RADIOTAP_F_SHORTPRE\t0x02\t/* sent/received\n\t\t\t\t\t\t * with short\n\t\t\t\t\t\t * preamble\n\t\t\t\t\t\t */\n#define\tIEEE80211_RADIOTAP_F_WEP\t0x04\t/* sent/received\n\t\t\t\t\t\t * with WEP encryption\n\t\t\t\t\t\t */\n#define\tIEEE80211_RADIOTAP_F_FRAG\t0x08\t/* sent/received\n\t\t\t\t\t\t * with fragmentation\n\t\t\t\t\t\t */\n#define\tIEEE80211_RADIOTAP_F_FCS\t0x10\t/* frame includes FCS */\n#define\tIEEE80211_RADIOTAP_F_DATAPAD\t0x20\t/* frame has padding between\n\t\t\t\t\t\t * 802.11 header and payload\n\t\t\t\t\t\t * (to 32-bit boundary)\n\t\t\t\t\t\t */\n#define\tIEEE80211_RADIOTAP_F_BADFCS\t0x40\t/* does not pass FCS check */\n#define\tIEEE80211_RADIOTAP_F_SHORTGI\t0x80\t/* HT short GI */\n\n#endif /* !_NET80211_IEEE80211_RADIOTAP_H_ */\n"
  },
  {
    "path": "freebsd-headers/net80211/ieee80211_ratectl.h",
    "content": "/*-\n * Copyright (c) 2010 Rui Paulo <rpaulo@FreeBSD.org>\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR\n * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES\n * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,\n * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF\n * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/net80211/ieee80211_ratectl.h 215289 2010-11-14 09:59:52Z bschmidt $\n */\n\nenum ieee80211_ratealgs {\n\tIEEE80211_RATECTL_AMRR\t\t= 0,\n\tIEEE80211_RATECTL_RSSADAPT\t= 1,\n\tIEEE80211_RATECTL_ONOE\t\t= 2,\n\tIEEE80211_RATECTL_SAMPLE\t= 3,\n\tIEEE80211_RATECTL_NONE\t\t= 4,\n\tIEEE80211_RATECTL_MAX\n};\n\n#define\tIEEE80211_RATECTL_TX_SUCCESS\t1\n#define\tIEEE80211_RATECTL_TX_FAILURE\t0\n\nstruct ieee80211_ratectl {\n\tconst char *ir_name;\n\tint\t(*ir_attach)(const struct ieee80211vap *);\n\tvoid\t(*ir_detach)(const struct ieee80211vap *);\n\tvoid\t(*ir_init)(struct ieee80211vap *);\n\tvoid\t(*ir_deinit)(struct ieee80211vap *);\n\tvoid\t(*ir_node_init)(struct ieee80211_node *);\n\tvoid\t(*ir_node_deinit)(struct ieee80211_node *);\n\tint\t(*ir_rate)(struct ieee80211_node *, void *, uint32_t);\n\tvoid\t(*ir_tx_complete)(const struct ieee80211vap *,\n\t    \t\t\t  const struct ieee80211_node *, int,\n\t    \t\t\t  void *, void *);\n\tvoid\t(*ir_tx_update)(const struct ieee80211vap *,\n\t    \t\t\tconst struct ieee80211_node *,\n\t    \t\t\tvoid *, void *, void *);\n\tvoid\t(*ir_setinterval)(const struct ieee80211vap *, int);\n};\n\nvoid\tieee80211_ratectl_register(int, const struct ieee80211_ratectl *);\nvoid\tieee80211_ratectl_unregister(int);\nvoid\tieee80211_ratectl_init(struct ieee80211vap *);\nvoid\tieee80211_ratectl_set(struct ieee80211vap *, int);\n\nMALLOC_DECLARE(M_80211_RATECTL);\n\nstatic void __inline\nieee80211_ratectl_deinit(struct ieee80211vap *vap)\n{\n\tvap->iv_rate->ir_deinit(vap);\n}\n\nstatic void __inline\nieee80211_ratectl_node_init(struct ieee80211_node *ni)\n{\n\tconst struct ieee80211vap *vap = ni->ni_vap;\n\n\tvap->iv_rate->ir_node_init(ni);\n}\n\nstatic void __inline\nieee80211_ratectl_node_deinit(struct ieee80211_node *ni)\n{\n\tconst struct ieee80211vap *vap = ni->ni_vap;\n\n\tvap->iv_rate->ir_node_deinit(ni);\n}\n\nstatic int __inline\nieee80211_ratectl_rate(struct ieee80211_node *ni, void *arg, uint32_t iarg)\n{\n\tconst struct ieee80211vap *vap = ni->ni_vap;\n\n\treturn vap->iv_rate->ir_rate(ni, arg, iarg);\n}\n\nstatic void __inline\nieee80211_ratectl_tx_complete(const struct ieee80211vap *vap,\n    const struct ieee80211_node *ni, int status, void *arg1, void *arg2)\n{\n\tvap->iv_rate->ir_tx_complete(vap, ni, status, arg1, arg2);\n}\n\nstatic void __inline\nieee80211_ratectl_tx_update(const struct ieee80211vap *vap,\n    const struct ieee80211_node *ni, void *arg1, void *arg2, void *arg3)\n{\n\tif (vap->iv_rate->ir_tx_update == NULL)\n\t\treturn;\n\tvap->iv_rate->ir_tx_update(vap, ni, arg1, arg2, arg3);\n}\n\nstatic void __inline\nieee80211_ratectl_setinterval(const struct ieee80211vap *vap, int msecs)\n{\n\tif (vap->iv_rate->ir_setinterval == NULL)\n\t\treturn;\n\tvap->iv_rate->ir_setinterval(vap, msecs);\n}\n"
  },
  {
    "path": "freebsd-headers/net80211/ieee80211_regdomain.h",
    "content": "/*-\n * Copyright (c) 2005-2008 Sam Leffler, Errno Consulting\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR\n * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES\n * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,\n * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF\n * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/net80211/ieee80211_regdomain.h 187799 2009-01-27 23:09:55Z sam $\n */\n#ifndef _NET80211_IEEE80211_REGDOMAIN_H_\n#define _NET80211_IEEE80211_REGDOMAIN_H_\n\n/*\n * 802.11 regulatory domain definitions.\n */\n\n/*\n * ISO 3166 Country/Region Codes\n * http://ftp.ics.uci.edu/pub/ietf/http/related/iso3166.txt\n */\nenum ISOCountryCode {\n\tCTRY_AFGHANISTAN\t= 4,\n\tCTRY_ALBANIA\t\t= 8,\t/* Albania */\n\tCTRY_ALGERIA\t\t= 12,\t/* Algeria */\n\tCTRY_AMERICAN_SAMOA\t= 16,\n\tCTRY_ANDORRA\t\t= 20,\n\tCTRY_ANGOLA\t\t= 24,\n\tCTRY_ANGUILLA\t\t= 660,\n\tCTRY_ANTARTICA\t\t= 10,\n\tCTRY_ANTIGUA\t\t= 28,\t/* Antigua and Barbuda */\n\tCTRY_ARGENTINA\t\t= 32,\t/* Argentina */\n\tCTRY_ARMENIA\t\t= 51,\t/* Armenia */\n\tCTRY_ARUBA\t\t= 533,\t/* Aruba */\n\tCTRY_AUSTRALIA\t\t= 36,\t/* Australia */\n\tCTRY_AUSTRIA\t\t= 40,\t/* Austria */\n\tCTRY_AZERBAIJAN\t\t= 31,\t/* Azerbaijan */\n\tCTRY_BAHAMAS\t\t= 44,\t/* Bahamas */\n\tCTRY_BAHRAIN\t\t= 48,\t/* Bahrain */\n\tCTRY_BANGLADESH\t\t= 50,\t/* Bangladesh */\n\tCTRY_BARBADOS\t\t= 52,\n\tCTRY_BELARUS\t\t= 112,\t/* Belarus */\n\tCTRY_BELGIUM\t\t= 56,\t/* Belgium */\n\tCTRY_BELIZE\t\t= 84,\n\tCTRY_BENIN\t\t= 204,\n\tCTRY_BERMUDA\t\t= 60,\n\tCTRY_BHUTAN\t\t= 64,\n\tCTRY_BOLIVIA\t\t= 68,\t/* Bolivia */\n\tCTRY_BOSNIA_AND_HERZEGOWINA = 70,\n\tCTRY_BOTSWANA\t\t= 72,\n\tCTRY_BOUVET_ISLAND\t= 74,\n\tCTRY_BRAZIL\t\t= 76,\t/* Brazil */\n\tCTRY_BRITISH_INDIAN_OCEAN_TERRITORY = 86,\n\tCTRY_BRUNEI_DARUSSALAM\t= 96,\t/* Brunei Darussalam */\n\tCTRY_BULGARIA\t\t= 100,\t/* Bulgaria */\n\tCTRY_BURKINA_FASO\t= 854,\n\tCTRY_BURUNDI\t\t= 108,\n\tCTRY_CAMBODIA\t\t= 116,\n\tCTRY_CAMEROON\t\t= 120,\n\tCTRY_CANADA\t\t= 124,\t/* Canada */\n\tCTRY_CAPE_VERDE\t\t= 132,\n\tCTRY_CAYMAN_ISLANDS\t= 136,\n\tCTRY_CENTRAL_AFRICAN_REPUBLIC = 140,\n\tCTRY_CHAD\t\t= 148,\n\tCTRY_CHILE\t\t= 152,\t/* Chile */\n\tCTRY_CHINA\t\t= 156,\t/* People's Republic of China */\n\tCTRY_CHRISTMAS_ISLAND\t= 162,\n\tCTRY_COCOS_ISLANDS\t= 166,\n\tCTRY_COLOMBIA\t\t= 170,\t/* Colombia */\n\tCTRY_COMOROS\t\t= 174,\n\tCTRY_CONGO\t\t= 178,\n\tCTRY_COOK_ISLANDS\t= 184,\n\tCTRY_COSTA_RICA\t\t= 188,\t/* Costa Rica */\n\tCTRY_COTE_DIVOIRE\t= 384,\n\tCTRY_CROATIA\t\t= 191,\t/* Croatia (local name: Hrvatska) */\n\tCTRY_CYPRUS\t\t= 196,\t/* Cyprus */\n\tCTRY_CZECH\t\t= 203,\t/* Czech Republic */\n\tCTRY_DENMARK\t\t= 208,\t/* Denmark */\n\tCTRY_DJIBOUTI\t\t= 262,\n\tCTRY_DOMINICA\t\t= 212,\n\tCTRY_DOMINICAN_REPUBLIC\t= 214,\t/* Dominican Republic */\n\tCTRY_EAST_TIMOR\t\t= 626,\n\tCTRY_ECUADOR\t\t= 218,\t/* Ecuador */\n\tCTRY_EGYPT\t\t= 818,\t/* Egypt */\n\tCTRY_EL_SALVADOR\t= 222,\t/* El Salvador */\n\tCTRY_EQUATORIAL_GUINEA\t= 226,\n\tCTRY_ERITREA\t\t= 232,\n\tCTRY_ESTONIA\t\t= 233,\t/* Estonia */\n\tCTRY_ETHIOPIA\t\t= 210,\n\tCTRY_FALKLAND_ISLANDS\t= 238,\t/* (Malvinas) */\n\tCTRY_FAEROE_ISLANDS\t= 234,\t/* Faeroe Islands */\n\tCTRY_FIJI\t\t= 242,\n\tCTRY_FINLAND\t\t= 246,\t/* Finland */\n\tCTRY_FRANCE\t\t= 250,\t/* France */\n\tCTRY_FRANCE2\t\t= 255,\t/* France (Metropolitan) */\n\tCTRY_FRENCH_GUIANA\t= 254,\n\tCTRY_FRENCH_POLYNESIA\t= 258,\n\tCTRY_FRENCH_SOUTHERN_TERRITORIES\t= 260,\n\tCTRY_GABON\t\t= 266,\n\tCTRY_GAMBIA\t\t= 270,\n\tCTRY_GEORGIA\t\t= 268,\t/* Georgia */\n\tCTRY_GERMANY\t\t= 276,\t/* Germany */\n\tCTRY_GHANA\t\t= 288,\n\tCTRY_GIBRALTAR\t\t= 292,\n\tCTRY_GREECE\t\t= 300,\t/* Greece */\n\tCTRY_GREENLAND\t\t= 304,\n\tCTRY_GRENADA\t\t= 308,\n\tCTRY_GUADELOUPE\t\t= 312,\n\tCTRY_GUAM\t\t= 316,\n\tCTRY_GUATEMALA\t\t= 320,\t/* Guatemala */\n\tCTRY_GUINEA\t\t= 324,\n\tCTRY_GUINEA_BISSAU\t= 624,\n\tCTRY_GUYANA\t\t= 328,\n\t/* XXX correct remainder */\n\tCTRY_HAITI\t\t= 332,\n\tCTRY_HONDURAS\t\t= 340,\t/* Honduras */\n\tCTRY_HONG_KONG\t\t= 344,\t/* Hong Kong S.A.R., P.R.C. */\n\tCTRY_HUNGARY\t\t= 348,\t/* Hungary */\n\tCTRY_ICELAND\t\t= 352,\t/* Iceland */\n\tCTRY_INDIA\t\t= 356,\t/* India */\n\tCTRY_INDONESIA\t\t= 360,\t/* Indonesia */\n\tCTRY_IRAN\t\t= 364,\t/* Iran */\n\tCTRY_IRAQ\t\t= 368,\t/* Iraq */\n\tCTRY_IRELAND\t\t= 372,\t/* Ireland */\n\tCTRY_ISRAEL\t\t= 376,\t/* Israel */\n\tCTRY_ITALY\t\t= 380,\t/* Italy */\n\tCTRY_JAMAICA\t\t= 388,\t/* Jamaica */\n\tCTRY_JAPAN\t\t= 392,\t/* Japan */\n\tCTRY_JORDAN\t\t= 400,\t/* Jordan */\n\tCTRY_KAZAKHSTAN\t\t= 398,\t/* Kazakhstan */\n\tCTRY_KENYA\t\t= 404,\t/* Kenya */\n\tCTRY_KOREA_NORTH\t= 408,\t/* North Korea */\n\tCTRY_KOREA_ROC\t\t= 410,\t/* South Korea */\n\tCTRY_KOREA_ROC2\t\t= 411,\t/* South Korea */\n\tCTRY_KUWAIT\t\t= 414,\t/* Kuwait */\n\tCTRY_LATVIA\t\t= 428,\t/* Latvia */\n\tCTRY_LEBANON\t\t= 422,\t/* Lebanon */\n\tCTRY_LIBYA\t\t= 434,\t/* Libya */\n\tCTRY_LIECHTENSTEIN\t= 438,\t/* Liechtenstein */\n\tCTRY_LITHUANIA\t\t= 440,\t/* Lithuania */\n\tCTRY_LUXEMBOURG\t\t= 442,\t/* Luxembourg */\n\tCTRY_MACAU\t\t= 446,\t/* Macau */\n\tCTRY_MACEDONIA\t\t= 807,\t/* the Former Yugoslav Republic of Macedonia */\n\tCTRY_MALAYSIA\t\t= 458,\t/* Malaysia */\n\tCTRY_MALTA\t\t= 470,\t/* Malta */\n\tCTRY_MEXICO\t\t= 484,\t/* Mexico */\n\tCTRY_MONACO\t\t= 492,\t/* Principality of Monaco */\n\tCTRY_MOROCCO\t\t= 504,\t/* Morocco */\n\tCTRY_NEPAL\t\t= 524,\t/* Nepal */\n\tCTRY_NETHERLANDS\t= 528,\t/* Netherlands */\n\tCTRY_NEW_ZEALAND\t= 554,\t/* New Zealand */\n\tCTRY_NICARAGUA\t\t= 558,\t/* Nicaragua */\n\tCTRY_NORWAY\t\t= 578,\t/* Norway */\n\tCTRY_OMAN\t\t= 512,\t/* Oman */\n\tCTRY_PAKISTAN\t\t= 586,\t/* Islamic Republic of Pakistan */\n\tCTRY_PANAMA\t\t= 591,\t/* Panama */\n\tCTRY_PARAGUAY\t\t= 600,\t/* Paraguay */\n\tCTRY_PERU\t\t= 604,\t/* Peru */\n\tCTRY_PHILIPPINES\t= 608,\t/* Republic of the Philippines */\n\tCTRY_POLAND\t\t= 616,\t/* Poland */\n\tCTRY_PORTUGAL\t\t= 620,\t/* Portugal */\n\tCTRY_PUERTO_RICO\t= 630,\t/* Puerto Rico */\n\tCTRY_QATAR\t\t= 634,\t/* Qatar */\n\tCTRY_ROMANIA\t\t= 642,\t/* Romania */\n\tCTRY_RUSSIA\t\t= 643,\t/* Russia */\n\tCTRY_SAUDI_ARABIA\t= 682,\t/* Saudi Arabia */\n\tCTRY_SINGAPORE\t\t= 702,\t/* Singapore */\n\tCTRY_SLOVAKIA\t\t= 703,\t/* Slovak Republic */\n\tCTRY_SLOVENIA\t\t= 705,\t/* Slovenia */\n\tCTRY_SOUTH_AFRICA\t= 710,\t/* South Africa */\n\tCTRY_SPAIN\t\t= 724,\t/* Spain */\n\tCTRY_SRILANKA\t\t= 144,\t/* Sri Lanka */\n\tCTRY_SWEDEN\t\t= 752,\t/* Sweden */\n\tCTRY_SWITZERLAND\t= 756,\t/* Switzerland */\n\tCTRY_SYRIA\t\t= 760,\t/* Syria */\n\tCTRY_TAIWAN\t\t= 158,\t/* Taiwan */\n\tCTRY_THAILAND\t\t= 764,\t/* Thailand */\n\tCTRY_TRINIDAD_Y_TOBAGO\t= 780,\t/* Trinidad y Tobago */\n\tCTRY_TUNISIA\t\t= 788,\t/* Tunisia */\n\tCTRY_TURKEY\t\t= 792,\t/* Turkey */\n\tCTRY_UAE\t\t= 784,\t/* U.A.E. */\n\tCTRY_UKRAINE\t\t= 804,\t/* Ukraine */\n\tCTRY_UNITED_KINGDOM\t= 826,\t/* United Kingdom */\n\tCTRY_UNITED_STATES\t= 840,\t/* United States */\n\tCTRY_URUGUAY\t\t= 858,\t/* Uruguay */\n\tCTRY_UZBEKISTAN\t\t= 860,\t/* Uzbekistan */\n\tCTRY_VENEZUELA\t\t= 862,\t/* Venezuela */\n\tCTRY_VIET_NAM\t\t= 704,\t/* Viet Nam */\n\tCTRY_YEMEN\t\t= 887,\t/* Yemen */\n\tCTRY_ZIMBABWE\t\t= 716,\t/* Zimbabwe */\n\n\t/* NB: from here down not listed in 3166; they come from Atheros */\n\tCTRY_DEBUG\t\t= 0x1ff, /* debug */\n\tCTRY_DEFAULT\t\t= 0,\t /* default */\n\n\tCTRY_UNITED_STATES_FCC49 = 842,\t/* United States (Public Safety)*/\n\tCTRY_KOREA_ROC3\t\t= 412,\t/* South Korea */\n\n\tCTRY_JAPAN1\t\t= 393,\t/* Japan (JP1) */\n\tCTRY_JAPAN2\t\t= 394,\t/* Japan (JP0) */\n\tCTRY_JAPAN3\t\t= 395,\t/* Japan (JP1-1) */\n\tCTRY_JAPAN4\t\t= 396,\t/* Japan (JE1) */\n\tCTRY_JAPAN5\t\t= 397,\t/* Japan (JE2) */\n\tCTRY_JAPAN6\t\t= 399,\t/* Japan (JP6) */\n\tCTRY_JAPAN7\t\t= 4007,\t/* Japan (J7) */\n\tCTRY_JAPAN8\t\t= 4008,\t/* Japan (J8) */\n\tCTRY_JAPAN9\t\t= 4009,\t/* Japan (J9) */\n\tCTRY_JAPAN10\t\t= 4010,\t/* Japan (J10) */\n\tCTRY_JAPAN11\t\t= 4011,\t/* Japan (J11) */\n\tCTRY_JAPAN12\t\t= 4012,\t/* Japan (J12) */\n\tCTRY_JAPAN13\t\t= 4013,\t/* Japan (J13) */\n\tCTRY_JAPAN14\t\t= 4014,\t/* Japan (J14) */\n\tCTRY_JAPAN15\t\t= 4015,\t/* Japan (J15) */\n\tCTRY_JAPAN16\t\t= 4016,\t/* Japan (J16) */\n\tCTRY_JAPAN17\t\t= 4017,\t/* Japan (J17) */\n\tCTRY_JAPAN18\t\t= 4018,\t/* Japan (J18) */\n\tCTRY_JAPAN19\t\t= 4019,\t/* Japan (J19) */\n\tCTRY_JAPAN20\t\t= 4020,\t/* Japan (J20) */\n\tCTRY_JAPAN21\t\t= 4021,\t/* Japan (J21) */\n\tCTRY_JAPAN22\t\t= 4022,\t/* Japan (J22) */\n\tCTRY_JAPAN23\t\t= 4023,\t/* Japan (J23) */\n\tCTRY_JAPAN24\t\t= 4024,\t/* Japan (J24) */\n};\n\nenum RegdomainCode {\n\tSKU_FCC\t\t\t= 0x10,\t/* FCC, aka United States */\n\tSKU_CA\t\t\t= 0x20,\t/* North America, aka Canada */\n\tSKU_ETSI\t\t= 0x30,\t/* Europe */\n\tSKU_ETSI2\t\t= 0x32,\t/* Europe w/o HT40 in 5GHz */\n\tSKU_ETSI3\t\t= 0x33,\t/* Europe - channel 36 */\n\tSKU_FCC3\t\t= 0x3a,\t/* FCC w/5470 band, 11h, DFS */\n\tSKU_JAPAN\t\t= 0x40,\n\tSKU_KOREA\t\t= 0x45,\n\tSKU_APAC\t\t= 0x50,\t/* Asia Pacific */\n\tSKU_APAC2\t\t= 0x51,\t/* Asia Pacific w/ DFS on mid-band */\n\tSKU_APAC3\t\t= 0x5d,\t/* Asia Pacific w/o ISM band */\n\tSKU_ROW\t\t\t= 0x81,\t/* China/Taiwan/Rest of World */\n\tSKU_NONE\t\t= 0xf0,\t/* \"Region Free\" */\n\tSKU_DEBUG\t\t= 0x1ff,\n\n\t/* NB: from here down private */\n\tSKU_SR9\t\t\t= 0x0298, /* Ubiquiti SR9 (900MHz/GSM) */\n\tSKU_XR9\t\t\t= 0x0299, /* Ubiquiti XR9 (900MHz/GSM) */\n\tSKU_GZ901\t\t= 0x029a, /* Zcomax GZ-901 (900MHz/GSM) */\n};\n\n#if defined(__KERNEL__) || defined(_KERNEL)\nstruct ieee80211com;\nvoid\tieee80211_regdomain_attach(struct ieee80211com *);\nvoid\tieee80211_regdomain_detach(struct ieee80211com *);\nstruct ieee80211vap;\nvoid\tieee80211_regdomain_vattach(struct ieee80211vap *);\nvoid\tieee80211_regdomain_vdetach(struct ieee80211vap *);\n\nstruct ieee80211_regdomain;\nint\tieee80211_init_channels(struct ieee80211com *,\n\t    const struct ieee80211_regdomain *, const uint8_t bands[]);\nstruct ieee80211_channel;\nvoid\tieee80211_sort_channels(struct ieee80211_channel *chans, int nchans);\nstruct ieee80211_appie;\nstruct ieee80211_appie *ieee80211_alloc_countryie(struct ieee80211com *);\nstruct ieee80211_regdomain_req;\nint\tieee80211_setregdomain(struct ieee80211vap *,\n\t    struct ieee80211_regdomain_req *);\n#endif /* defined(__KERNEL__) || defined(_KERNEL) */\n#endif /* _NET80211_IEEE80211_REGDOMAIN_H_ */\n"
  },
  {
    "path": "freebsd-headers/net80211/ieee80211_rssadapt.h",
    "content": "/*\t$FreeBSD: release/9.0.0/sys/net80211/ieee80211_rssadapt.h 206358 2010-04-07 15:29:13Z rpaulo $\t*/\n/* $NetBSD: ieee80211_rssadapt.h,v 1.4 2005/02/26 22:45:09 perry Exp $ */\n/*-\n * Copyright (c) 2003, 2004 David Young.  All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or\n * without modification, are permitted provided that the following\n * conditions are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above\n *    copyright notice, this list of conditions and the following\n *    disclaimer in the documentation and/or other materials provided\n *    with the distribution.\n * 3. The name of David Young may not be used to endorse or promote\n *    products derived from this software without specific prior\n *    written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY David Young ``AS IS'' AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,\n * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A\n * PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL David\n * Young BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,\n * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED\n * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\n * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,\n * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY\n * OF SUCH DAMAGE.\n */\n#ifndef _NET80211_IEEE80211_RSSADAPT_H_\n#define _NET80211_IEEE80211_RSSADAPT_H_\n\n/* Data-rate adaptation loosely based on \"Link Adaptation Strategy\n * for IEEE 802.11 WLAN via Received Signal Strength Measurement\"\n * by Javier del Prado Pavon and Sunghyun Choi.\n */\n\n/* Buckets for frames 0-128 bytes long, 129-1024, 1025-maximum. */\n#define\tIEEE80211_RSSADAPT_BKTS\t\t3\n#define IEEE80211_RSSADAPT_BKT0\t\t128\n#define\tIEEE80211_RSSADAPT_BKTPOWER\t3\t/* 2**_BKTPOWER */\n\nstruct ieee80211_rssadapt {\n\tconst struct ieee80211vap *vap;\n\tint\tinterval;\t\t\t/* update interval (ticks) */\n};\n\nstruct ieee80211_rssadapt_node {\n\tstruct ieee80211_rssadapt *ra_rs;\t/* backpointer */\n\tstruct ieee80211_rateset ra_rates;\t/* negotiated rates */\n\tint\tra_rix;\t\t\t\t/* current rate index */\n\tint\tra_ticks;\t\t\t/* time of last update */\n\tint\tra_last_raise;\t\t\t/* time of last rate raise */\n\tint\tra_raise_interval;\t\t/* rate raise time threshold */\n\n\t/* Tx failures in this update interval */\n\tuint32_t\t\tra_nfail;\n\t/* Tx successes in this update interval */\n\tuint32_t\t\tra_nok;\n\t/* exponential average packets/second */\n\tuint32_t\t\tra_pktrate;\n\t/* RSSI threshold for each Tx rate */\n\tuint16_t\t\tra_rate_thresh[IEEE80211_RSSADAPT_BKTS]\n\t\t\t\t\t      [IEEE80211_RATE_SIZE];\n};\n\n#define\tIEEE80211_RSSADAPT_SUCCESS\t1\n#define\tIEEE80211_RSSADAPT_FAILURE\t0\n#endif /* _NET80211_IEEE80211_RSSADAPT_H_ */\n"
  },
  {
    "path": "freebsd-headers/net80211/ieee80211_scan.h",
    "content": "/*-\n * Copyright (c) 2005-2009 Sam Leffler, Errno Consulting\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR\n * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES\n * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,\n * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF\n * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/net80211/ieee80211_scan.h 195618 2009-07-11 15:02:45Z rpaulo $\n */\n#ifndef _NET80211_IEEE80211_SCAN_H_\n#define _NET80211_IEEE80211_SCAN_H_\n\n/*\n * 802.11 scanning support.\n *\n * Scanning is the procedure by which a station locates a bss to join\n * (infrastructure/ibss mode), or a channel to use (when operating as\n * an ap or ibss master).  Scans are either \"active\" or \"passive\".  An\n * active scan causes one or more probe request frames to be sent on\n * visiting each channel.  A passive request causes each channel in the\n * scan set to be visited but no frames to be transmitted; the station\n * only listens for traffic.  Note that active scanning may still need\n * to listen for traffic before sending probe request frames depending\n * on regulatory constraints; the 802.11 layer handles this by generating\n * a callback when scanning on a ``passive channel'' when the\n * IEEE80211_FEXT_PROBECHAN flag is set.\n *\n * A scan operation involves constructing a set of channels to inspect\n * (the scan set), visiting each channel and collecting information\n * (e.g. what bss are present), and then analyzing the results to make\n * decisions like which bss to join.  This process needs to be as fast\n * as possible so we do things like intelligently construct scan sets\n * and dwell on a channel only as long as necessary.  The scan code also\n * maintains a cache of recent scan results and uses it to bypass scanning\n * whenever possible.  The scan cache is also used to enable roaming\n * between access points when operating in infrastructure mode.\n *\n * Scanning is handled with pluggable modules that implement \"policy\"\n * per-operating mode.  The core scanning support provides an\n * instrastructure to support these modules and exports a common api\n * to the rest of the 802.11 layer.  Policy modules decide what\n * channels to visit, what state to record to make decisions (e.g. ap\n * mode scanning for auto channel selection keeps significantly less\n * state than sta mode scanning for an ap to associate to), and selects\n * the final station/channel to return as the result of a scan.\n *\n * Scanning is done synchronously when initially bringing a vap to an\n * operational state and optionally in the background to maintain the\n * scan cache for doing roaming and rogue ap monitoring.  Scanning is\n * not tied to the 802.11 state machine that governs vaps though there\n * is linkage to the IEEE80211_SCAN state.  Only one vap at a time may\n * be scanning; this scheduling policy is handled in ieee80211_new_state\n * and is invisible to the scanning code.\n*/\n#define\tIEEE80211_SCAN_MAX\tIEEE80211_CHAN_MAX\n\nstruct ieee80211_scanner;\t\t\t/* scan policy state */\n\nstruct ieee80211_scan_ssid {\n\tint\t len;\t\t\t\t/* length in bytes */\n\tuint8_t ssid[IEEE80211_NWID_LEN];\t/* ssid contents */\n};\n#define\tIEEE80211_SCAN_MAX_SSID\t1\t\t/* max # ssid's to probe */\n\n/*\n * Scan state visible to the 802.11 layer.  Scan parameters and\n * results are stored in this data structure.  The ieee80211_scan_state\n * structure is extended with space that is maintained private to\n * the core scanning support.  We allocate one instance and link it\n * to the ieee80211com structure; then share it between all associated\n * vaps.  We could allocate multiple of these, e.g. to hold multiple\n * scan results, but this is sufficient for current needs.\n */\nstruct ieee80211_scan_state {\n\tstruct ieee80211vap *ss_vap;\n\tstruct ieee80211com *ss_ic;\n\tconst struct ieee80211_scanner *ss_ops;\t/* policy hookup, see below */\n\tvoid\t\t*ss_priv;\t\t/* scanner private state */\n\tuint16_t\tss_flags;\n#define\tIEEE80211_SCAN_NOPICK\t0x0001\t\t/* scan only, no selection */\n#define\tIEEE80211_SCAN_ACTIVE\t0x0002\t\t/* active scan (probe req) */\n#define\tIEEE80211_SCAN_PICK1ST\t0x0004\t\t/* ``hey sailor'' mode */\n#define\tIEEE80211_SCAN_BGSCAN\t0x0008\t\t/* bg scan, exit ps at end */\n#define\tIEEE80211_SCAN_ONCE\t0x0010\t\t/* do one complete pass */\n#define\tIEEE80211_SCAN_NOBCAST\t0x0020\t\t/* no broadcast probe req */\n#define\tIEEE80211_SCAN_NOJOIN\t0x0040\t\t/* no auto-sequencing */\n#define\tIEEE80211_SCAN_GOTPICK\t0x1000\t\t/* got candidate, can stop */\n\tuint8_t\t\tss_nssid;\t\t/* # ssid's to probe/match */\n\tstruct ieee80211_scan_ssid ss_ssid[IEEE80211_SCAN_MAX_SSID];\n\t\t\t\t\t\t/* ssid's to probe/match */\n\t\t\t\t\t\t/* ordered channel set */\n\tstruct ieee80211_channel *ss_chans[IEEE80211_SCAN_MAX];\n\tuint16_t\tss_next;\t\t/* ix of next chan to scan */\n\tuint16_t\tss_last;\t\t/* ix+1 of last chan to scan */\n\tunsigned long\tss_mindwell;\t\t/* min dwell on channel */\n\tunsigned long\tss_maxdwell;\t\t/* max dwell on channel */\n};\n\n/*\n * The upper 16 bits of the flags word is used to communicate\n * information to the scanning code that is NOT recorded in\n * ss_flags.  It might be better to split this stuff out into\n * a separate variable to avoid confusion.\n */\n#define\tIEEE80211_SCAN_FLUSH\t0x00010000\t/* flush candidate table */\n#define\tIEEE80211_SCAN_NOSSID\t0x80000000\t/* don't update ssid list */\n\nstruct ieee80211com;\nvoid\tieee80211_scan_attach(struct ieee80211com *);\nvoid\tieee80211_scan_detach(struct ieee80211com *);\nvoid\tieee80211_scan_vattach(struct ieee80211vap *);\nvoid\tieee80211_scan_vdetach(struct ieee80211vap *);\n\nvoid\tieee80211_scan_dump_channels(const struct ieee80211_scan_state *);\n\n#define\tIEEE80211_SCAN_FOREVER\t0x7fffffff\nint\tieee80211_start_scan(struct ieee80211vap *, int flags,\n\t\tu_int duration, u_int mindwell, u_int maxdwell,\n\t\tu_int nssid, const struct ieee80211_scan_ssid ssids[]);\nint\tieee80211_check_scan(struct ieee80211vap *, int flags,\n\t\tu_int duration, u_int mindwell, u_int maxdwell,\n\t\tu_int nssid, const struct ieee80211_scan_ssid ssids[]);\nint\tieee80211_check_scan_current(struct ieee80211vap *);\nint\tieee80211_bg_scan(struct ieee80211vap *, int);\nvoid\tieee80211_cancel_scan(struct ieee80211vap *);\nvoid\tieee80211_cancel_anyscan(struct ieee80211vap *);\nvoid\tieee80211_scan_next(struct ieee80211vap *);\nvoid\tieee80211_scan_done(struct ieee80211vap *);\nvoid\tieee80211_probe_curchan(struct ieee80211vap *, int);\nstruct ieee80211_channel *ieee80211_scan_pickchannel(struct ieee80211com *, int);\n\nstruct ieee80211_scanparams;\nvoid\tieee80211_add_scan(struct ieee80211vap *,\n\t\tconst struct ieee80211_scanparams *,\n\t\tconst struct ieee80211_frame *,\n\t\tint subtype, int rssi, int noise);\nvoid\tieee80211_scan_timeout(struct ieee80211com *);\n\nvoid\tieee80211_scan_assoc_success(struct ieee80211vap *,\n\t\tconst uint8_t mac[IEEE80211_ADDR_LEN]);\nenum {\n\tIEEE80211_SCAN_FAIL_TIMEOUT\t= 1,\t/* no response to mgmt frame */\n\tIEEE80211_SCAN_FAIL_STATUS\t= 2\t/* negative response to \" \" */\n};\nvoid\tieee80211_scan_assoc_fail(struct ieee80211vap *,\n\t\tconst uint8_t mac[IEEE80211_ADDR_LEN], int reason);\nvoid\tieee80211_scan_flush(struct ieee80211vap *);\n\nstruct ieee80211_scan_entry;\ntypedef void ieee80211_scan_iter_func(void *,\n\t\tconst struct ieee80211_scan_entry *);\nvoid\tieee80211_scan_iterate(struct ieee80211vap *,\n\t\tieee80211_scan_iter_func, void *);\nenum {\n\tIEEE80211_BPARSE_BADIELEN\t= 0x01,\t/* ie len past end of frame */\n\tIEEE80211_BPARSE_RATES_INVALID\t= 0x02,\t/* invalid RATES ie */\n\tIEEE80211_BPARSE_XRATES_INVALID\t= 0x04,\t/* invalid XRATES ie */\n\tIEEE80211_BPARSE_SSID_INVALID\t= 0x08,\t/* invalid SSID ie */\n\tIEEE80211_BPARSE_CHAN_INVALID\t= 0x10,\t/* invalid FH/DSPARMS chan */\n\tIEEE80211_BPARSE_OFFCHAN\t= 0x20,\t/* DSPARMS chan != curchan */\n\tIEEE80211_BPARSE_BINTVAL_INVALID= 0x40,\t/* invalid beacon interval */\n\tIEEE80211_BPARSE_CSA_INVALID\t= 0x80,\t/* invalid CSA ie */\n};\n\n/*\n * Parameters supplied when adding/updating an entry in a\n * scan cache.  Pointer variables should be set to NULL\n * if no data is available.  Pointer references can be to\n * local data; any information that is saved will be copied.\n * All multi-byte values must be in host byte order.\n */\nstruct ieee80211_scanparams {\n\tuint8_t\t\tstatus;\t\t/* bitmask of IEEE80211_BPARSE_* */\n\tuint8_t\t\tchan;\t\t/* channel # from FH/DSPARMS */\n\tuint8_t\t\tbchan;\t\t/* curchan's channel # */\n\tuint8_t\t\tfhindex;\n\tuint16_t\tfhdwell;\t/* FHSS dwell interval */\n\tuint16_t\tcapinfo;\t/* 802.11 capabilities */\n\tuint16_t\terp;\t\t/* NB: 0x100 indicates ie present */\n\tuint16_t\tbintval;\n\tuint8_t\t\ttimoff;\n\tuint8_t\t\t*ies;\t\t/* all captured ies */\n\tsize_t\t\ties_len;\t/* length of all captured ies */\n\tuint8_t\t\t*tim;\n\tuint8_t\t\t*tstamp;\n\tuint8_t\t\t*country;\n\tuint8_t\t\t*ssid;\n\tuint8_t\t\t*rates;\n\tuint8_t\t\t*xrates;\n\tuint8_t\t\t*doth;\n\tuint8_t\t\t*wpa;\n\tuint8_t\t\t*rsn;\n\tuint8_t\t\t*wme;\n\tuint8_t\t\t*htcap;\n\tuint8_t\t\t*htinfo;\n\tuint8_t\t\t*ath;\n\tuint8_t\t\t*tdma;\n\tuint8_t\t\t*csa;\n\tuint8_t\t\t*meshid;\n\tuint8_t\t\t*meshconf;\n\tuint8_t\t\t*spare[3];\n};\n\n/*\n * Scan cache entry format used when exporting data from a policy\n * module; this data may be represented some other way internally.\n */\nstruct ieee80211_scan_entry {\n\tuint8_t\t\tse_macaddr[IEEE80211_ADDR_LEN];\n\tuint8_t\t\tse_bssid[IEEE80211_ADDR_LEN];\n\t/* XXX can point inside se_ies */\n\tuint8_t\t\tse_ssid[2+IEEE80211_NWID_LEN];\n\tuint8_t\t\tse_rates[2+IEEE80211_RATE_MAXSIZE];\n\tuint8_t\t\tse_xrates[2+IEEE80211_RATE_MAXSIZE];\n\tunion {\n\t\tuint8_t\t\tdata[8];\n\t\tu_int64_t\ttsf;\n\t} se_tstamp;\t\t\t/* from last rcv'd beacon */\n\tuint16_t\tse_intval;\t/* beacon interval (host byte order) */\n\tuint16_t\tse_capinfo;\t/* capabilities (host byte order) */\n\tstruct ieee80211_channel *se_chan;/* channel where sta found */\n\tuint16_t\tse_timoff;\t/* byte offset to TIM ie */\n\tuint16_t\tse_fhdwell;\t/* FH only (host byte order) */\n\tuint8_t\t\tse_fhindex;\t/* FH only */\n\tuint8_t\t\tse_dtimperiod;\t/* DTIM period */\n\tuint16_t\tse_erp;\t\t/* ERP from beacon/probe resp */\n\tint8_t\t\tse_rssi;\t/* avg'd recv ssi */\n\tint8_t\t\tse_noise;\t/* noise floor */\n\tuint8_t\t\tse_cc[2];\t/* captured country code */\n\tuint8_t\t\tse_meshid[2+IEEE80211_MESHID_LEN];\n\tstruct ieee80211_ies se_ies;\t/* captured ie's */\n\tu_int\t\tse_age;\t\t/* age of entry (0 on create) */\n};\nMALLOC_DECLARE(M_80211_SCAN);\n\n/*\n * Template for an in-kernel scan policy module.\n * Modules register with the scanning code and are\n * typically loaded as needed.\n */\nstruct ieee80211_scanner {\n\tconst char *scan_name;\t\t/* printable name */\n\tint\t(*scan_attach)(struct ieee80211_scan_state *);\n\tint\t(*scan_detach)(struct ieee80211_scan_state *);\n\tint\t(*scan_start)(struct ieee80211_scan_state *,\n\t\t\tstruct ieee80211vap *);\n\tint\t(*scan_restart)(struct ieee80211_scan_state *,\n\t\t\tstruct ieee80211vap *);\n\tint\t(*scan_cancel)(struct ieee80211_scan_state *,\n\t\t\tstruct ieee80211vap *);\n\tint\t(*scan_end)(struct ieee80211_scan_state *,\n\t\t\tstruct ieee80211vap *);\n\tint\t(*scan_flush)(struct ieee80211_scan_state *);\n\tstruct ieee80211_channel *(*scan_pickchan)(\n\t\t\tstruct ieee80211_scan_state *, int);\n\t/* add an entry to the cache */\n\tint\t(*scan_add)(struct ieee80211_scan_state *,\n\t\t\tconst struct ieee80211_scanparams *,\n\t\t\tconst struct ieee80211_frame *,\n\t\t\tint subtype, int rssi, int noise);\n\t/* age and/or purge entries in the cache */\n\tvoid\t(*scan_age)(struct ieee80211_scan_state *);\n\t/* note that association failed for an entry */\n\tvoid\t(*scan_assoc_fail)(struct ieee80211_scan_state *,\n\t\t\tconst uint8_t macaddr[IEEE80211_ADDR_LEN],\n\t\t\tint reason);\n\t/* note that association succeed for an entry */\n\tvoid\t(*scan_assoc_success)(struct ieee80211_scan_state *,\n\t\t\tconst uint8_t macaddr[IEEE80211_ADDR_LEN]);\n\t/* iterate over entries in the scan cache */\n\tvoid\t(*scan_iterate)(struct ieee80211_scan_state *,\n\t\t\tieee80211_scan_iter_func *, void *);\n\tvoid\t(*scan_spare0)(void);\n\tvoid\t(*scan_spare1)(void);\n\tvoid\t(*scan_spare2)(void);\n\tvoid\t(*scan_spare4)(void);\n};\nvoid\tieee80211_scanner_register(enum ieee80211_opmode,\n\t\tconst struct ieee80211_scanner *);\nvoid\tieee80211_scanner_unregister(enum ieee80211_opmode,\n\t\tconst struct ieee80211_scanner *);\nvoid\tieee80211_scanner_unregister_all(const struct ieee80211_scanner *);\nconst struct ieee80211_scanner *ieee80211_scanner_get(enum ieee80211_opmode);\n#endif /* _NET80211_IEEE80211_SCAN_H_ */\n"
  },
  {
    "path": "freebsd-headers/net80211/ieee80211_sta.h",
    "content": "/*-\n * Copyright (c) 2007-2008 Sam Leffler, Errno Consulting\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR\n * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES\n * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,\n * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF\n * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/net80211/ieee80211_sta.h 178354 2008-04-20 20:35:46Z sam $\n */\n#ifndef _NET80211_IEEE80211_STA_H_\n#define _NET80211_IEEE80211_STA_H_\n\n/*\n * Station-mode implementation definitions.\n */\nvoid\tieee80211_sta_attach(struct ieee80211com *);\nvoid\tieee80211_sta_detach(struct ieee80211com *);\nvoid\tieee80211_sta_vattach(struct ieee80211vap *);\n#endif /* !_NET80211_IEEE80211_STA_H_ */\n"
  },
  {
    "path": "freebsd-headers/net80211/ieee80211_superg.h",
    "content": "/*-\n * Copyright (c) 2009 Sam Leffler, Errno Consulting\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR\n * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES\n * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,\n * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF\n * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/net80211/ieee80211_superg.h 191753 2009-05-02 20:16:55Z sam $\n */\n#ifndef _NET80211_IEEE80211_SUPERG_H_\n#define _NET80211_IEEE80211_SUPERG_H_\n\n/*\n * Atheros' 802.11 SuperG protocol support.\n */\n\n/*\n * Atheros advanced capability information element.\n */\nstruct ieee80211_ath_ie {\n\tuint8_t\t\tath_id;\t\t\t/* IEEE80211_ELEMID_VENDOR */\n\tuint8_t\t\tath_len;\t\t/* length in bytes */\n\tuint8_t\t\tath_oui[3];\t\t/* ATH_OUI */\n\tuint8_t\t\tath_oui_type;\t\t/* ATH_OUI_TYPE */\n\tuint8_t\t\tath_oui_subtype;\t/* ATH_OUI_SUBTYPE */\n\tuint8_t\t\tath_version;\t\t/* spec revision */\n\tuint8_t\t\tath_capability;\t\t/* capability info */\n#define\tATHEROS_CAP_TURBO_PRIME\t\t0x01\t/* dynamic turbo--aka Turbo' */\n#define\tATHEROS_CAP_COMPRESSION\t\t0x02\t/* data compression */\n#define\tATHEROS_CAP_FAST_FRAME\t\t0x04\t/* fast (jumbo) frames */\n#define\tATHEROS_CAP_XR\t\t\t0x08\t/* Xtended Range support */\n#define\tATHEROS_CAP_AR\t\t\t0x10\t/* Advanded Radar support */\n#define\tATHEROS_CAP_BURST\t\t0x20\t/* Bursting - not negotiated */\n#define\tATHEROS_CAP_WME\t\t\t0x40\t/* CWMin tuning */\n#define\tATHEROS_CAP_BOOST\t\t0x80\t/* use turbo/!turbo mode */\n\tuint8_t\t\tath_defkeyix[2];\n} __packed;\n\n#define\tATH_OUI_VERSION\t\t0x00\n#define\tATH_OUI_SUBTYPE\t\t0x01\n\n#ifdef _KERNEL\nstruct ieee80211_stageq {\n\tstruct mbuf\t\t*head;\t\t/* frames linked w/ m_nextpkt */\n\tstruct mbuf\t\t*tail;\t\t/* last frame in queue */\n\tint\t\t\tdepth;\t\t/* # items on head */\n};\n\nstruct ieee80211_superg {\n\t/* fast-frames staging q */\n\tstruct ieee80211_stageq\tff_stageq[WME_NUM_AC];\n\tint\t\t\tff_stageqdepth;\t/* cumulative depth */\n};\n\nvoid\tieee80211_superg_attach(struct ieee80211com *);\nvoid\tieee80211_superg_detach(struct ieee80211com *);\nvoid\tieee80211_superg_vattach(struct ieee80211vap *);\nvoid\tieee80211_superg_vdetach(struct ieee80211vap *);\n\nuint8_t *ieee80211_add_ath(uint8_t *, uint8_t, ieee80211_keyix);\nuint8_t *ieee80211_add_athcaps(uint8_t *, const struct ieee80211_node *);\nvoid\tieee80211_parse_ath(struct ieee80211_node *, uint8_t *);\nint\tieee80211_parse_athparams(struct ieee80211_node *, uint8_t *,\n\t    const struct ieee80211_frame *);\n\nvoid\tieee80211_ff_node_init(struct ieee80211_node *);\nvoid\tieee80211_ff_node_cleanup(struct ieee80211_node *);\n\nstruct mbuf *ieee80211_ff_check(struct ieee80211_node *, struct mbuf *);\nvoid\tieee80211_ff_age(struct ieee80211com *, struct ieee80211_stageq *,\n\t     int quanta);\n\nstatic __inline void\nieee80211_ff_flush(struct ieee80211com *ic, int ac)\n{\n\tstruct ieee80211_superg *sg = ic->ic_superg;\n\n\tif (sg != NULL && sg->ff_stageq[ac].depth)\n\t\tieee80211_ff_age(ic, &sg->ff_stageq[ac], 0x7fffffff);\n}\n\nstatic __inline void\nieee80211_ff_age_all(struct ieee80211com *ic, int quanta)\n{\n\tstruct ieee80211_superg *sg = ic->ic_superg;\n\n\tif (sg != NULL && sg->ff_stageqdepth) {\n\t\tif (sg->ff_stageq[WME_AC_VO].depth)\n\t\t\tieee80211_ff_age(ic, &sg->ff_stageq[WME_AC_VO], quanta);\n\t\tif (sg->ff_stageq[WME_AC_VI].depth)\n\t\t\tieee80211_ff_age(ic, &sg->ff_stageq[WME_AC_VI], quanta);\n\t\tif (sg->ff_stageq[WME_AC_BE].depth)\n\t\t\tieee80211_ff_age(ic, &sg->ff_stageq[WME_AC_BE], quanta);\n\t\tif (sg->ff_stageq[WME_AC_BK].depth)\n\t\t\tieee80211_ff_age(ic, &sg->ff_stageq[WME_AC_BK], quanta);\n\t}\n}\n\nstruct mbuf *ieee80211_ff_encap(struct ieee80211vap *, struct mbuf *,\n\t    int, struct ieee80211_key *);\n\nstruct mbuf *ieee80211_ff_decap(struct ieee80211_node *, struct mbuf *);\n\nstatic __inline struct mbuf *\nieee80211_decap_fastframe(struct ieee80211vap *vap, struct ieee80211_node *ni,\n    struct mbuf *m)\n{\n\treturn IEEE80211_ATH_CAP(vap, ni, IEEE80211_NODE_FF) ?\n\t    ieee80211_ff_decap(ni, m) : m;\n}\n#endif /* _KERNEL */\n#endif /* _NET80211_IEEE80211_SUPERG_H_ */\n"
  },
  {
    "path": "freebsd-headers/net80211/ieee80211_tdma.h",
    "content": "/*-\n * Copyright (c) 2007-2009 Sam Leffler, Errno Consulting\n * Copyright (c) 2007-2009 Intel Corporation\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR\n * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES\n * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,\n * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF\n * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/net80211/ieee80211_tdma.h 192468 2009-05-20 20:00:40Z sam $\n */\n#ifndef _NET80211_IEEE80211_TDMA_H_\n#define _NET80211_IEEE80211_TDMA_H_\n\n/*\n * TDMA-mode implementation definitions.\n */\n\n#define\tTDMA_SUBTYPE_PARAM\t0x01\n#define\tTDMA_VERSION_V2\t\t2\n#define\tTDMA_VERSION\t\tTDMA_VERSION_V2\n\n/* NB: we only support 2 right now but protocol handles up to 8 */\n#define\tTDMA_MAXSLOTS\t\t2\t/* max slots/sta's */\n\n#define\tTDMA_PARAM_LEN_V2\tsizeof(struct ieee80211_tdma_param)\n\n/*\n * TDMA information element.\n */\nstruct ieee80211_tdma_param {\n\tu_int8_t\ttdma_id;\t/* IEEE80211_ELEMID_VENDOR */\n\tu_int8_t\ttdma_len;\n\tu_int8_t\ttdma_oui[3];\t/* TDMA_OUI */\n\tu_int8_t\ttdma_type;\t/* TDMA_OUI_TYPE */\n\tu_int8_t\ttdma_subtype;\t/* TDMA_SUBTYPE_PARAM */\n\tu_int8_t\ttdma_version;\t/* spec revision */\n\tu_int8_t\ttdma_slot;\t/* station slot # [0..7] */\n\tu_int8_t\ttdma_slotcnt;\t/* bss slot count [1..8] */\n\tu_int16_t\ttdma_slotlen;\t/* bss slot len (100us) */\n\tu_int8_t\ttdma_bintval;\t/* beacon interval (superframes) */\n\tu_int8_t\ttdma_inuse[1];\t/* slot occupancy map */\n\tu_int8_t\ttdma_pad[2];\n\tu_int8_t\ttdma_tstamp[8];\t/* timestamp from last beacon */\n} __packed;\n\n#ifdef _KERNEL\n/*\n * Implementation state.\n */\nstruct ieee80211_tdma_state {\n\tu_int\ttdma_slotlen;\t\t/* bss slot length (us) */\n\tuint8_t\ttdma_version;\t\t/* protocol version to use */\n\tuint8_t\ttdma_slotcnt;\t\t/* bss slot count */\n\tuint8_t\ttdma_bintval;\t\t/* beacon interval (slots) */\n\tuint8_t\ttdma_slot;\t\t/* station slot # */\n\tuint8_t\ttdma_inuse[1];\t\t/* mask of slots in use */\n\tuint8_t\ttdma_active[1];\t\t/* mask of active slots */\n\tint\ttdma_count;\t\t/* active/inuse countdown */\n\tvoid\t*tdma_peer;\t\t/* peer station cookie */\n\tstruct timeval tdma_lastprint;\t/* time of last rate-limited printf */\n\tint\ttdma_fails;\t\t/* fail count for rate-limiting */\n\n\t/* parent method pointers */\n\tint\t(*tdma_newstate)(struct ieee80211vap *, enum ieee80211_state,\n\t\t    int arg);\n\tvoid\t(*tdma_recv_mgmt)(struct ieee80211_node *,\n\t\t    struct mbuf *, int, int, int);\n\tvoid\t(*tdma_opdetach)(struct ieee80211vap *);\n};\n \n#define\tTDMA_UPDATE_SLOT\t0x0001\t/* tdma_slot changed */\n#define\tTDMA_UPDATE_SLOTCNT\t0x0002\t/* tdma_slotcnt changed */\n#define\tTDMA_UPDATE_SLOTLEN\t0x0004\t/* tdma_slotlen changed */\n#define\tTDMA_UPDATE_BINTVAL\t0x0008\t/* tdma_bintval changed */\n\nvoid\tieee80211_tdma_vattach(struct ieee80211vap *);\n\nint\tieee80211_tdma_getslot(struct ieee80211vap *vap);\nvoid\tieee80211_parse_tdma(struct ieee80211_node *ni, const uint8_t *ie);\nuint8_t *ieee80211_add_tdma(uint8_t *frm, struct ieee80211vap *vap);\nstruct ieee80211_beacon_offsets;\nvoid\tieee80211_tdma_update_beacon(struct ieee80211vap *vap,\n\t    struct ieee80211_beacon_offsets *bo);\n#endif /* _KERNEL */\n#endif /* !_NET80211_IEEE80211_TDMA_H_ */\n"
  },
  {
    "path": "freebsd-headers/net80211/ieee80211_var.h",
    "content": "/*-\n * Copyright (c) 2001 Atsushi Onoe\n * Copyright (c) 2002-2009 Sam Leffler, Errno Consulting\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR\n * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES\n * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,\n * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF\n * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/net80211/ieee80211_var.h 223331 2011-06-20 11:46:03Z adrian $\n */\n#ifndef _NET80211_IEEE80211_VAR_H_\n#define _NET80211_IEEE80211_VAR_H_\n\n/*\n * Definitions for IEEE 802.11 drivers.\n */\n/* NB: portability glue must go first */\n#if defined(__NetBSD__)\n#include <net80211/ieee80211_netbsd.h>\n#elif defined(__FreeBSD__)\n#include <net80211/ieee80211_freebsd.h>\n#elif defined(__linux__)\n#include <net80211/ieee80211_linux.h>\n#else\n#error\t\"No support for your operating system!\"\n#endif\n\n#include <net80211/_ieee80211.h>\n#include <net80211/ieee80211.h>\n#include <net80211/ieee80211_ageq.h>\n#include <net80211/ieee80211_crypto.h>\n#include <net80211/ieee80211_dfs.h>\n#include <net80211/ieee80211_ioctl.h>\t\t/* for ieee80211_stats */\n#include <net80211/ieee80211_phy.h>\n#include <net80211/ieee80211_power.h>\n#include <net80211/ieee80211_node.h>\n#include <net80211/ieee80211_proto.h>\n#include <net80211/ieee80211_radiotap.h>\n#include <net80211/ieee80211_scan.h>\n\n#define\tIEEE80211_TXPOWER_MAX\t100\t/* .5 dbM (XXX units?) */\n#define\tIEEE80211_TXPOWER_MIN\t0\t/* kill radio */\n\n#define\tIEEE80211_DTIM_DEFAULT\t1\t/* default DTIM period */\n#define\tIEEE80211_BINTVAL_DEFAULT 100\t/* default beacon interval (TU's) */\n\n#define\tIEEE80211_BMISS_MAX\t2\t/* maximum consecutive bmiss allowed */\n#define\tIEEE80211_HWBMISS_DEFAULT 7\t/* h/w bmiss threshold (beacons) */\n\n#define\tIEEE80211_BGSCAN_INTVAL_MIN\t15\t/* min bg scan intvl (secs) */\n#define\tIEEE80211_BGSCAN_INTVAL_DEFAULT\t(5*60)\t/* default bg scan intvl */\n\n#define\tIEEE80211_BGSCAN_IDLE_MIN\t100\t/* min idle time (ms) */\n#define\tIEEE80211_BGSCAN_IDLE_DEFAULT\t250\t/* default idle time (ms) */\n\n#define\tIEEE80211_SCAN_VALID_MIN\t10\t/* min scan valid time (secs) */\n#define\tIEEE80211_SCAN_VALID_DEFAULT\t60\t/* default scan valid time */\n\n#define\tIEEE80211_PS_SLEEP\t0x1\t/* STA is in power saving mode */\n#define\tIEEE80211_PS_MAX_QUEUE\t50\t/* maximum saved packets */\n\n#define\tIEEE80211_FIXED_RATE_NONE\t0xff\n#define\tIEEE80211_TXMAX_DEFAULT\t\t6\t/* default ucast max retries */\n\n#define\tIEEE80211_RTS_DEFAULT\t\tIEEE80211_RTS_MAX\n#define\tIEEE80211_FRAG_DEFAULT\t\tIEEE80211_FRAG_MAX\n\n#define\tIEEE80211_MS_TO_TU(x)\t(((x) * 1000) / 1024)\n#define\tIEEE80211_TU_TO_MS(x)\t(((x) * 1024) / 1000)\n#define\tIEEE80211_TU_TO_TICKS(x)(((x) * 1024 * hz) / (1000 * 1000))\n\n/*\n * 802.11 control state is split into a common portion that maps\n * 1-1 to a physical device and one or more \"Virtual AP's\" (VAP)\n * that are bound to an ieee80211com instance and share a single\n * underlying device.  Each VAP has a corresponding OS device\n * entity through which traffic flows and that applications use\n * for issuing ioctls, etc.\n */\n\n/*\n * Data common to one or more virtual AP's.  State shared by\n * the underlying device and the net80211 layer is exposed here;\n * e.g. device-specific callbacks.\n */\nstruct ieee80211vap;\ntypedef void (*ieee80211vap_attach)(struct ieee80211vap *);\n\nstruct ieee80211_appie {\n\tuint16_t\t\tie_len;\t\t/* size of ie_data */\n\tuint8_t\t\t\tie_data[];\t/* user-specified IE's */\n};\n\nstruct ieee80211_tdma_param;\nstruct ieee80211_rate_table;\nstruct ieee80211_tx_ampdu;\nstruct ieee80211_rx_ampdu;\nstruct ieee80211_superg;\nstruct ieee80211_frame;\n\nstruct ieee80211com {\n\tstruct ifnet\t\t*ic_ifp;\t/* associated device */\n\tieee80211_com_lock_t\tic_comlock;\t/* state update lock */\n\tTAILQ_HEAD(, ieee80211vap) ic_vaps;\t/* list of vap instances */\n\tint\t\t\tic_headroom;\t/* driver tx headroom needs */\n\tenum ieee80211_phytype\tic_phytype;\t/* XXX wrong for multi-mode */\n\tenum ieee80211_opmode\tic_opmode;\t/* operation mode */\n\tstruct ifmedia\t\tic_media;\t/* interface media config */\n\tstruct callout\t\tic_inact;\t/* inactivity processing */\n\tstruct taskqueue\t*ic_tq;\t\t/* deferred state thread */\n\tstruct task\t\tic_parent_task;\t/* deferred parent processing */\n\tstruct task\t\tic_promisc_task;/* deferred promisc update */\n\tstruct task\t\tic_mcast_task;\t/* deferred mcast update */\n\tstruct task\t\tic_chan_task;\t/* deferred channel change */\n\tstruct task\t\tic_bmiss_task;\t/* deferred beacon miss hndlr */\n\n\tuint32_t\t\tic_flags;\t/* state flags */\n\tuint32_t\t\tic_flags_ext;\t/* extended state flags */\n\tuint32_t\t\tic_flags_ht;\t/* HT state flags */\n\tuint32_t\t\tic_flags_ven;\t/* vendor state flags */\n\tuint32_t\t\tic_caps;\t/* capabilities */\n\tuint32_t\t\tic_htcaps;\t/* HT capabilities */\n\tuint32_t\t\tic_htextcaps;\t/* HT extended capabilities */\n\tuint32_t\t\tic_cryptocaps;\t/* crypto capabilities */\n\tuint8_t\t\t\tic_modecaps[2];\t/* set of mode capabilities */\n\tuint8_t\t\t\tic_promisc;\t/* vap's needing promisc mode */\n\tuint8_t\t\t\tic_allmulti;\t/* vap's needing all multicast*/\n\tuint8_t\t\t\tic_nrunning;\t/* vap's marked running */\n\tuint8_t\t\t\tic_curmode;\t/* current mode */\n\tuint16_t\t\tic_bintval;\t/* beacon interval */\n\tuint16_t\t\tic_lintval;\t/* listen interval */\n\tuint16_t\t\tic_holdover;\t/* PM hold over duration */\n\tuint16_t\t\tic_txpowlimit;\t/* global tx power limit */\n\tstruct ieee80211_rateset ic_sup_rates[IEEE80211_MODE_MAX];\n\n\t/*\n\t * Channel state:\n\t *\n\t * ic_channels is the set of available channels for the device;\n\t *    it is setup by the driver\n\t * ic_nchans is the number of valid entries in ic_channels\n\t * ic_chan_avail is a bit vector of these channels used to check\n\t *    whether a channel is available w/o searching the channel table.\n\t * ic_chan_active is a (potentially) constrained subset of\n\t *    ic_chan_avail that reflects any mode setting or user-specified\n\t *    limit on the set of channels to use/scan\n\t * ic_curchan is the current channel the device is set to; it may\n\t *    be different from ic_bsschan when we are off-channel scanning\n\t *    or otherwise doing background work\n\t * ic_bsschan is the channel selected for operation; it may\n\t *    be undefined (IEEE80211_CHAN_ANYC)\n\t * ic_prevchan is a cached ``previous channel'' used to optimize\n\t *    lookups when switching back+forth between two channels\n\t *    (e.g. for dynamic turbo)\n\t */\n\tint\t\t\tic_nchans;\t/* # entries in ic_channels */\n\tstruct ieee80211_channel ic_channels[IEEE80211_CHAN_MAX];\n\tuint8_t\t\t\tic_chan_avail[IEEE80211_CHAN_BYTES];\n\tuint8_t\t\t\tic_chan_active[IEEE80211_CHAN_BYTES];\n\tuint8_t\t\t\tic_chan_scan[IEEE80211_CHAN_BYTES];\n\tstruct ieee80211_channel *ic_curchan;\t/* current channel */\n\tconst struct ieee80211_rate_table *ic_rt; /* table for ic_curchan */\n\tstruct ieee80211_channel *ic_bsschan;\t/* bss channel */\n\tstruct ieee80211_channel *ic_prevchan;\t/* previous channel */\n\tstruct ieee80211_regdomain ic_regdomain;/* regulatory data */\n\tstruct ieee80211_appie\t*ic_countryie;\t/* calculated country ie */\n\tstruct ieee80211_channel *ic_countryie_chan;\n\n\t/* 802.11h/DFS state */\n\tstruct ieee80211_channel *ic_csa_newchan;/* channel for doing CSA */\n\tshort\t\t\tic_csa_mode;\t/* mode for doing CSA */\n\tshort\t\t\tic_csa_count;\t/* count for doing CSA */\n\tstruct ieee80211_dfs_state ic_dfs;\t/* DFS state */\n\n\tstruct ieee80211_scan_state *ic_scan;\t/* scan state */\n\tint\t\t\tic_lastdata;\t/* time of last data frame */\n\tint\t\t\tic_lastscan;\t/* time last scan completed */\n\n\t/* NB: this is the union of all vap stations/neighbors */\n\tint\t\t\tic_max_keyix;\t/* max h/w key index */\n\tstruct ieee80211_node_table ic_sta;\t/* stations/neighbors */\n\tstruct ieee80211_ageq\tic_stageq;\t/* frame staging queue */\n\tuint32_t\t\tic_hash_key;\t/* random key for mac hash */\n\n\t/* XXX multi-bss: split out common/vap parts */\n\tstruct ieee80211_wme_state ic_wme;\t/* WME/WMM state */\n\n\t/* XXX multi-bss: can per-vap be done/make sense? */\n\tenum ieee80211_protmode\tic_protmode;\t/* 802.11g protection mode */\n\tuint16_t\t\tic_nonerpsta;\t/* # non-ERP stations */\n\tuint16_t\t\tic_longslotsta;\t/* # long slot time stations */\n\tuint16_t\t\tic_sta_assoc;\t/* stations associated */\n\tuint16_t\t\tic_ht_sta_assoc;/* HT stations associated */\n\tuint16_t\t\tic_ht40_sta_assoc;/* HT40 stations associated */\n\tuint8_t\t\t\tic_curhtprotmode;/* HTINFO bss state */\n\tenum ieee80211_protmode\tic_htprotmode;\t/* HT protection mode */\n\tint\t\t\tic_lastnonerp;\t/* last time non-ERP sta noted*/\n\tint\t\t\tic_lastnonht;\t/* last time non-HT sta noted */\n\tuint8_t\t\t\tic_rxstream;    /* # RX streams */\n\tuint8_t\t\t\tic_txstream;    /* # TX streams */\n\n\t/* optional state for Atheros SuperG protocol extensions */\n\tstruct ieee80211_superg\t*ic_superg;\n\n\t/* radiotap handling */\n\tstruct ieee80211_radiotap_header *ic_th;/* tx radiotap headers */\n\tvoid\t\t\t*ic_txchan;\t/* channel state in ic_th */\n\tstruct ieee80211_radiotap_header *ic_rh;/* rx radiotap headers */\n\tvoid\t\t\t*ic_rxchan;\t/* channel state in ic_rh */\n\tint\t\t\tic_montaps;\t/* active monitor mode taps */\n\n\t/* virtual ap create/delete */\n\tstruct ieee80211vap*\t(*ic_vap_create)(struct ieee80211com *,\n\t\t\t\t    const char name[IFNAMSIZ], int unit,\n\t\t\t\t    int opmode, int flags,\n\t\t\t\t    const uint8_t bssid[IEEE80211_ADDR_LEN],\n\t\t\t\t    const uint8_t macaddr[IEEE80211_ADDR_LEN]);\n\tvoid\t\t\t(*ic_vap_delete)(struct ieee80211vap *);\n\t/* operating mode attachment */\n\tieee80211vap_attach\tic_vattach[IEEE80211_OPMODE_MAX];\n\t/* return hardware/radio capabilities */\n\tvoid\t\t\t(*ic_getradiocaps)(struct ieee80211com *,\n\t\t\t\t    int, int *, struct ieee80211_channel []);\n\t/* check and/or prepare regdomain state change */\n\tint\t\t\t(*ic_setregdomain)(struct ieee80211com *,\n\t\t\t\t    struct ieee80211_regdomain *,\n\t\t\t\t    int, struct ieee80211_channel []);\n\t/* send/recv 802.11 management frame */\n\tint\t\t\t(*ic_send_mgmt)(struct ieee80211_node *,\n\t\t\t\t     int, int);\n\t/* send raw 802.11 frame */\n\tint\t\t\t(*ic_raw_xmit)(struct ieee80211_node *,\n\t\t\t\t    struct mbuf *,\n\t\t\t\t    const struct ieee80211_bpf_params *);\n\t/* update device state for 802.11 slot time change */\n\tvoid\t\t\t(*ic_updateslot)(struct ifnet *);\n\t/* handle multicast state changes */\n\tvoid\t\t\t(*ic_update_mcast)(struct ifnet *);\n\t/* handle promiscuous mode changes */\n\tvoid\t\t\t(*ic_update_promisc)(struct ifnet *);\n\t/* new station association callback/notification */\n\tvoid\t\t\t(*ic_newassoc)(struct ieee80211_node *, int);\n\t/* TDMA update notification */\n\tvoid\t\t\t(*ic_tdma_update)(struct ieee80211_node *,\n\t\t\t\t    const struct ieee80211_tdma_param *, int);\n\t/* node state management */\n\tstruct ieee80211_node*\t(*ic_node_alloc)(struct ieee80211vap *,\n\t\t\t\t    const uint8_t [IEEE80211_ADDR_LEN]);\n\tvoid\t\t\t(*ic_node_free)(struct ieee80211_node *);\n\tvoid\t\t\t(*ic_node_cleanup)(struct ieee80211_node *);\n\tvoid\t\t\t(*ic_node_age)(struct ieee80211_node *);\n\tvoid\t\t\t(*ic_node_drain)(struct ieee80211_node *);\n\tint8_t\t\t\t(*ic_node_getrssi)(const struct ieee80211_node*);\n\tvoid\t\t\t(*ic_node_getsignal)(const struct ieee80211_node*,\n\t\t\t\t    int8_t *, int8_t *);\n\tvoid\t\t\t(*ic_node_getmimoinfo)(\n\t\t\t\t    const struct ieee80211_node*,\n\t\t\t\t    struct ieee80211_mimo_info *);\n\t/* scanning support */\n\tvoid\t\t\t(*ic_scan_start)(struct ieee80211com *);\n\tvoid\t\t\t(*ic_scan_end)(struct ieee80211com *);\n\tvoid\t\t\t(*ic_set_channel)(struct ieee80211com *);\n\tvoid\t\t\t(*ic_scan_curchan)(struct ieee80211_scan_state *,\n\t\t\t\t    unsigned long);\n\tvoid\t\t\t(*ic_scan_mindwell)(struct ieee80211_scan_state *);\n\n\t/*\n\t * 802.11n ADDBA support.  A simple/generic implementation\n\t * of A-MPDU tx aggregation is provided; the driver may\n\t * override these methods to provide their own support.\n\t * A-MPDU rx re-ordering happens automatically if the\n\t * driver passes out-of-order frames to ieee80211_input\n\t * from an assocated HT station.\n\t */\n\tint\t\t\t(*ic_recv_action)(struct ieee80211_node *,\n\t\t\t\t    const struct ieee80211_frame *,\n\t\t\t\t    const uint8_t *frm, const uint8_t *efrm);\n\tint\t\t\t(*ic_send_action)(struct ieee80211_node *,\n\t\t\t\t    int category, int action, void *);\n\t/* check if A-MPDU should be enabled this station+ac */\n\tint\t\t\t(*ic_ampdu_enable)(struct ieee80211_node *,\n\t\t\t\t    struct ieee80211_tx_ampdu *);\n\t/* start/stop doing A-MPDU tx aggregation for a station */\n\tint\t\t\t(*ic_addba_request)(struct ieee80211_node *,\n\t\t\t\t    struct ieee80211_tx_ampdu *,\n\t\t\t\t    int dialogtoken, int baparamset,\n\t\t\t\t    int batimeout);\n\tint\t\t\t(*ic_addba_response)(struct ieee80211_node *,\n\t\t\t\t    struct ieee80211_tx_ampdu *,\n\t\t\t\t    int status, int baparamset, int batimeout);\n\tvoid\t\t\t(*ic_addba_stop)(struct ieee80211_node *,\n\t\t\t\t    struct ieee80211_tx_ampdu *);\n\tvoid\t\t\t(*ic_addba_response_timeout)(struct ieee80211_node *,\n\t\t\t\t    struct ieee80211_tx_ampdu *);\n\t/* BAR response received */\n\tvoid\t\t\t(*ic_bar_response)(struct ieee80211_node *,\n\t\t\t\t    struct ieee80211_tx_ampdu *, int status);\n\t/* start/stop doing A-MPDU rx processing for a station */\n\tint\t\t\t(*ic_ampdu_rx_start)(struct ieee80211_node *,\n\t\t\t\t    struct ieee80211_rx_ampdu *, int baparamset,\n\t\t\t\t    int batimeout, int baseqctl);\n\tvoid\t\t\t(*ic_ampdu_rx_stop)(struct ieee80211_node *,\n\t\t\t\t    struct ieee80211_rx_ampdu *);\n\tuint64_t\t\tic_spare[7];\n};\n\nstruct ieee80211_aclator;\nstruct ieee80211_tdma_state;\nstruct ieee80211_mesh_state;\nstruct ieee80211_hwmp_state;\n\nstruct ieee80211vap {\n\tstruct ifmedia\t\tiv_media;\t/* interface media config */\n\tstruct ifnet\t\t*iv_ifp;\t/* associated device */\n\tstruct bpf_if\t\t*iv_rawbpf;\t/* packet filter structure */\n\tstruct sysctl_ctx_list\t*iv_sysctl;\t/* dynamic sysctl context */\n\tstruct sysctl_oid\t*iv_oid;\t/* net.wlan.X sysctl oid */\n\n\tTAILQ_ENTRY(ieee80211vap) iv_next;\t/* list of vap instances */\n\tstruct ieee80211com\t*iv_ic;\t\t/* back ptr to common state */\n\tuint32_t\t\tiv_debug;\t/* debug msg flags */\n\tstruct ieee80211_stats\tiv_stats;\t/* statistics */\n\n\tuint8_t\t\t\tiv_myaddr[IEEE80211_ADDR_LEN];\n\tuint32_t\t\tiv_flags;\t/* state flags */\n\tuint32_t\t\tiv_flags_ext;\t/* extended state flags */\n\tuint32_t\t\tiv_flags_ht;\t/* HT state flags */\n\tuint32_t\t\tiv_flags_ven;\t/* vendor state flags */\n\tuint32_t\t\tiv_caps;\t/* capabilities */\n\tuint32_t\t\tiv_htcaps;\t/* HT capabilities */\n\tuint32_t\t\tiv_htextcaps;\t/* HT extended capabilities */\n\tenum ieee80211_opmode\tiv_opmode;\t/* operation mode */\n\tenum ieee80211_state\tiv_state;\t/* state machine state */\n\tenum ieee80211_state\tiv_nstate;\t/* pending state */\n\tint\t\t\tiv_nstate_arg;\t/* pending state arg */\n\tstruct task\t\tiv_nstate_task;\t/* deferred state processing */\n\tstruct task\t\tiv_swbmiss_task;/* deferred iv_bmiss call */\n\tstruct callout\t\tiv_mgtsend;\t/* mgmt frame response timer */\n\t\t\t\t\t\t/* inactivity timer settings */\n\tint\t\t\tiv_inact_init;\t/* setting for new station */\n\tint\t\t\tiv_inact_auth;\t/* auth but not assoc setting */\n\tint\t\t\tiv_inact_run;\t/* authorized setting */\n\tint\t\t\tiv_inact_probe;\t/* inactive probe time */\n\n\tint\t\t\tiv_des_nssid;\t/* # desired ssids */\n\tstruct ieee80211_scan_ssid iv_des_ssid[1];/* desired ssid table */\n\tuint8_t\t\t\tiv_des_bssid[IEEE80211_ADDR_LEN];\n\tstruct ieee80211_channel *iv_des_chan;\t/* desired channel */\n\tuint16_t\t\tiv_des_mode;\t/* desired mode */\n\tint\t\t\tiv_nicknamelen;\t/* XXX junk */\n\tuint8_t\t\t\tiv_nickname[IEEE80211_NWID_LEN];\n\tu_int\t\t\tiv_bgscanidle;\t/* bg scan idle threshold */\n\tu_int\t\t\tiv_bgscanintvl;\t/* bg scan min interval */\n\tu_int\t\t\tiv_scanvalid;\t/* scan cache valid threshold */\n\tu_int\t\t\tiv_scanreq_duration;\n\tu_int\t\t\tiv_scanreq_mindwell;\n\tu_int\t\t\tiv_scanreq_maxdwell;\n\tuint16_t\t\tiv_scanreq_flags;/* held scan request params */\n\tuint8_t\t\t\tiv_scanreq_nssid;\n\tstruct ieee80211_scan_ssid iv_scanreq_ssid[IEEE80211_SCAN_MAX_SSID];\n\t/* sta-mode roaming state */\n\tenum ieee80211_roamingmode iv_roaming;\t/* roaming mode */\n\tstruct ieee80211_roamparam iv_roamparms[IEEE80211_MODE_MAX];\n\n\tuint8_t\t\t\tiv_bmissthreshold;\n\tuint8_t\t\t\tiv_bmiss_count;\t/* current beacon miss count */\n\tint\t\t\tiv_bmiss_max;\t/* max bmiss before scan */\n\tuint16_t\t\tiv_swbmiss_count;/* beacons in last period */\n\tuint16_t\t\tiv_swbmiss_period;/* s/w bmiss period */\n\tstruct callout\t\tiv_swbmiss;\t/* s/w beacon miss timer */\n\n\tint\t\t\tiv_ampdu_rxmax;\t/* A-MPDU rx limit (bytes) */\n\tint\t\t\tiv_ampdu_density;/* A-MPDU density */\n\tint\t\t\tiv_ampdu_limit;\t/* A-MPDU tx limit (bytes) */\n\tint\t\t\tiv_amsdu_limit;\t/* A-MSDU tx limit (bytes) */\n\tu_int\t\t\tiv_ampdu_mintraffic[WME_NUM_AC];\n\n\tuint32_t\t\t*iv_aid_bitmap;\t/* association id map */\n\tuint16_t\t\tiv_max_aid;\n\tuint16_t\t\tiv_sta_assoc;\t/* stations associated */\n\tuint16_t\t\tiv_ps_sta;\t/* stations in power save */\n\tuint16_t\t\tiv_ps_pending;\t/* ps sta's w/ pending frames */\n\tuint16_t\t\tiv_txseq;\t/* mcast xmit seq# space */\n\tuint16_t\t\tiv_tim_len;\t/* ic_tim_bitmap size (bytes) */\n\tuint8_t\t\t\t*iv_tim_bitmap;\t/* power-save stations w/ data*/\n\tuint8_t\t\t\tiv_dtim_period;\t/* DTIM period */\n\tuint8_t\t\t\tiv_dtim_count;\t/* DTIM count from last bcn */\n\t\t\t\t\t\t/* set/unset aid pwrsav state */\n\tint\t\t\tiv_csa_count;\t/* count for doing CSA */\n\n\tstruct ieee80211_node\t*iv_bss;\t/* information for this node */\n\tstruct ieee80211_txparam iv_txparms[IEEE80211_MODE_MAX];\n\tuint16_t\t\tiv_rtsthreshold;\n\tuint16_t\t\tiv_fragthreshold;\n\tint\t\t\tiv_inact_timer;\t/* inactivity timer wait */\n\t/* application-specified IE's to attach to mgt frames */\n\tstruct ieee80211_appie\t*iv_appie_beacon;\n\tstruct ieee80211_appie\t*iv_appie_probereq;\n\tstruct ieee80211_appie\t*iv_appie_proberesp;\n\tstruct ieee80211_appie\t*iv_appie_assocreq;\n\tstruct ieee80211_appie\t*iv_appie_assocresp;\n\tstruct ieee80211_appie\t*iv_appie_wpa;\n\tuint8_t\t\t\t*iv_wpa_ie;\n\tuint8_t\t\t\t*iv_rsn_ie;\n\tuint16_t\t\tiv_max_keyix;\t/* max h/w key index */\n\tieee80211_keyix\t\tiv_def_txkey;\t/* default/group tx key index */\n\tstruct ieee80211_key\tiv_nw_keys[IEEE80211_WEP_NKID];\n\tint\t\t\t(*iv_key_alloc)(struct ieee80211vap *,\n\t\t\t\t    struct ieee80211_key *,\n\t\t\t\t    ieee80211_keyix *, ieee80211_keyix *);\n\tint\t\t\t(*iv_key_delete)(struct ieee80211vap *, \n\t\t\t\t    const struct ieee80211_key *);\n\tint\t\t\t(*iv_key_set)(struct ieee80211vap *,\n\t\t\t\t    const struct ieee80211_key *,\n\t\t\t\t    const uint8_t mac[IEEE80211_ADDR_LEN]);\n\tvoid\t\t\t(*iv_key_update_begin)(struct ieee80211vap *);\n\tvoid\t\t\t(*iv_key_update_end)(struct ieee80211vap *);\n\n\tconst struct ieee80211_authenticator *iv_auth; /* authenticator glue */\n\tvoid\t\t\t*iv_ec;\t\t/* private auth state */\n\n\tconst struct ieee80211_aclator *iv_acl;\t/* acl glue */\n\tvoid\t\t\t*iv_as;\t\t/* private aclator state */\n\n\tconst struct ieee80211_ratectl *iv_rate;\n\tvoid\t\t\t*iv_rs;\t\t/* private ratectl state */\n\n\tstruct ieee80211_tdma_state *iv_tdma;\t/* tdma state */\n\tstruct ieee80211_mesh_state *iv_mesh;\t/* MBSS state */\n\tstruct ieee80211_hwmp_state *iv_hwmp;\t/* HWMP state */\n\n\t/* operate-mode detach hook */\n\tvoid\t\t\t(*iv_opdetach)(struct ieee80211vap *);\n\t/* receive processing */\n\tint\t\t\t(*iv_input)(struct ieee80211_node *,\n\t\t\t\t    struct mbuf *, int, int);\n\tvoid\t\t\t(*iv_recv_mgmt)(struct ieee80211_node *,\n\t\t\t\t    struct mbuf *, int, int, int);\n\tvoid\t\t\t(*iv_recv_ctl)(struct ieee80211_node *,\n\t\t\t\t    struct mbuf *, int);\n\tvoid\t\t\t(*iv_deliver_data)(struct ieee80211vap *,\n\t\t\t\t    struct ieee80211_node *, struct mbuf *);\n#if 0\n\t/* send processing */\n\tint\t\t\t(*iv_send_mgmt)(struct ieee80211_node *,\n\t\t\t\t     int, int);\n#endif\n\t/* beacon miss processing */\n\tvoid\t\t\t(*iv_bmiss)(struct ieee80211vap *);\n\t/* reset device state after 802.11 parameter/state change */\n\tint\t\t\t(*iv_reset)(struct ieee80211vap *, u_long);\n\t/* [schedule] beacon frame update */\n\tvoid\t\t\t(*iv_update_beacon)(struct ieee80211vap *, int);\n\t/* power save handling */\n\tvoid\t\t\t(*iv_update_ps)(struct ieee80211vap *, int);\n\tint\t\t\t(*iv_set_tim)(struct ieee80211_node *, int);\n\t/* state machine processing */\n\tint\t\t\t(*iv_newstate)(struct ieee80211vap *,\n\t\t\t\t    enum ieee80211_state, int);\n\t/* 802.3 output method for raw frame xmit */\n\tint\t\t\t(*iv_output)(struct ifnet *, struct mbuf *,\n\t\t\t\t    struct sockaddr *, struct route *);\n\tuint64_t\t\tiv_spare[6];\n};\nMALLOC_DECLARE(M_80211_VAP);\n\n#define\tIEEE80211_ADDR_EQ(a1,a2)\t(memcmp(a1,a2,IEEE80211_ADDR_LEN) == 0)\n#define\tIEEE80211_ADDR_COPY(dst,src)\tmemcpy(dst,src,IEEE80211_ADDR_LEN)\n\n/* ic_flags/iv_flags */\n#define\tIEEE80211_F_TURBOP\t0x00000001\t/* CONF: ATH Turbo enabled*/\n#define\tIEEE80211_F_COMP\t0x00000002\t/* CONF: ATH comp enabled */\n#define\tIEEE80211_F_FF\t\t0x00000004\t/* CONF: ATH FF enabled */\n#define\tIEEE80211_F_BURST\t0x00000008\t/* CONF: bursting enabled */\n/* NB: this is intentionally setup to be IEEE80211_CAPINFO_PRIVACY */\n#define\tIEEE80211_F_PRIVACY\t0x00000010\t/* CONF: privacy enabled */\n#define\tIEEE80211_F_PUREG\t0x00000020\t/* CONF: 11g w/o 11b sta's */\n#define\tIEEE80211_F_SCAN\t0x00000080\t/* STATUS: scanning */\n#define\tIEEE80211_F_ASCAN\t0x00000100\t/* STATUS: active scan */\n#define\tIEEE80211_F_SIBSS\t0x00000200\t/* STATUS: start IBSS */\n/* NB: this is intentionally setup to be IEEE80211_CAPINFO_SHORT_SLOTTIME */\n#define\tIEEE80211_F_SHSLOT\t0x00000400\t/* STATUS: use short slot time*/\n#define\tIEEE80211_F_PMGTON\t0x00000800\t/* CONF: Power mgmt enable */\n#define\tIEEE80211_F_DESBSSID\t0x00001000\t/* CONF: des_bssid is set */\n#define\tIEEE80211_F_WME\t\t0x00002000\t/* CONF: enable WME use */\n#define\tIEEE80211_F_BGSCAN\t0x00004000\t/* CONF: bg scan enabled (???)*/\n#define\tIEEE80211_F_SWRETRY\t0x00008000\t/* CONF: sw tx retry enabled */\n#define IEEE80211_F_TXPOW_FIXED\t0x00010000\t/* TX Power: fixed rate */\n#define\tIEEE80211_F_IBSSON\t0x00020000\t/* CONF: IBSS creation enable */\n#define\tIEEE80211_F_SHPREAMBLE\t0x00040000\t/* STATUS: use short preamble */\n#define\tIEEE80211_F_DATAPAD\t0x00080000\t/* CONF: do alignment pad */\n#define\tIEEE80211_F_USEPROT\t0x00100000\t/* STATUS: protection enabled */\n#define\tIEEE80211_F_USEBARKER\t0x00200000\t/* STATUS: use barker preamble*/\n#define\tIEEE80211_F_CSAPENDING\t0x00400000\t/* STATUS: chan switch pending*/\n#define\tIEEE80211_F_WPA1\t0x00800000\t/* CONF: WPA enabled */\n#define\tIEEE80211_F_WPA2\t0x01000000\t/* CONF: WPA2 enabled */\n#define\tIEEE80211_F_WPA\t\t0x01800000\t/* CONF: WPA/WPA2 enabled */\n#define\tIEEE80211_F_DROPUNENC\t0x02000000\t/* CONF: drop unencrypted */\n#define\tIEEE80211_F_COUNTERM\t0x04000000\t/* CONF: TKIP countermeasures */\n#define\tIEEE80211_F_HIDESSID\t0x08000000\t/* CONF: hide SSID in beacon */\n#define\tIEEE80211_F_NOBRIDGE\t0x10000000\t/* CONF: dis. internal bridge */\n#define\tIEEE80211_F_PCF\t\t0x20000000\t/* CONF: PCF enabled */\n#define\tIEEE80211_F_DOTH\t0x40000000\t/* CONF: 11h enabled */\n#define\tIEEE80211_F_DWDS\t0x80000000\t/* CONF: Dynamic WDS enabled */\n\n#define\tIEEE80211_F_BITS \\\n\t\"\\20\\1TURBOP\\2COMP\\3FF\\4BURST\\5PRIVACY\\6PUREG\\10SCAN\\11ASCAN\\12SIBSS\" \\\n\t\"\\13SHSLOT\\14PMGTON\\15DESBSSID\\16WME\\17BGSCAN\\20SWRETRY\\21TXPOW_FIXED\" \\\n\t\"\\22IBSSON\\23SHPREAMBLE\\24DATAPAD\\25USEPROT\\26USERBARKER\\27CSAPENDING\" \\\n\t\"\\30WPA1\\31WPA2\\32DROPUNENC\\33COUNTERM\\34HIDESSID\\35NOBRIDG\\36PCF\" \\\n\t\"\\37DOTH\\40DWDS\"\n\n/* Atheros protocol-specific flags */\n#define\tIEEE80211_F_ATHEROS \\\n\t(IEEE80211_F_FF | IEEE80211_F_COMP | IEEE80211_F_TURBOP)\n/* Check if an Atheros capability was negotiated for use */\n#define\tIEEE80211_ATH_CAP(vap, ni, bit) \\\n\t((vap)->iv_flags & (ni)->ni_ath_flags & (bit))\n\n/* ic_flags_ext/iv_flags_ext */\n#define\tIEEE80211_FEXT_INACT\t 0x00000002\t/* CONF: sta inact handling */\n#define\tIEEE80211_FEXT_SCANWAIT\t 0x00000004\t/* STATUS: awaiting scan */\n/* 0x00000006 reserved */\n#define\tIEEE80211_FEXT_BGSCAN\t 0x00000008\t/* STATUS: complete bgscan */\n#define\tIEEE80211_FEXT_WPS\t 0x00000010\t/* CONF: WPS enabled */\n#define\tIEEE80211_FEXT_TSN \t 0x00000020\t/* CONF: TSN enabled */\n#define\tIEEE80211_FEXT_SCANREQ\t 0x00000040\t/* STATUS: scan req params */\n#define\tIEEE80211_FEXT_RESUME\t 0x00000080\t/* STATUS: start on resume */\n#define\tIEEE80211_FEXT_4ADDR\t 0x00000100\t/* CONF: apply 4-addr encap */\n#define\tIEEE80211_FEXT_NONERP_PR 0x00000200\t/* STATUS: non-ERP sta present*/\n#define\tIEEE80211_FEXT_SWBMISS\t 0x00000400\t/* CONF: do bmiss in s/w */\n#define\tIEEE80211_FEXT_DFS\t 0x00000800\t/* CONF: DFS enabled */\n#define\tIEEE80211_FEXT_DOTD\t 0x00001000\t/* CONF: 11d enabled */\n#define\tIEEE80211_FEXT_STATEWAIT 0x00002000\t/* STATUS: awaiting state chg */\n#define\tIEEE80211_FEXT_REINIT\t 0x00004000\t/* STATUS: INIT state first */\n#define\tIEEE80211_FEXT_BPF\t 0x00008000\t/* STATUS: BPF tap present */\n/* NB: immutable: should be set only when creating a vap */\n#define\tIEEE80211_FEXT_WDSLEGACY 0x00010000\t/* CONF: legacy WDS operation */\n#define\tIEEE80211_FEXT_PROBECHAN 0x00020000\t/* CONF: probe passive channel*/\n#define\tIEEE80211_FEXT_UNIQMAC\t 0x00040000\t/* CONF: user or computed mac */\n\n#define\tIEEE80211_FEXT_BITS \\\n\t\"\\20\\2INACT\\3SCANWAIT\\4BGSCAN\\5WPS\\6TSN\\7SCANREQ\\10RESUME\" \\\n\t\"\\0114ADDR\\12NONEPR_PR\\13SWBMISS\\14DFS\\15DOTD\\16STATEWAIT\\17REINIT\" \\\n\t\"\\20BPF\\21WDSLEGACY\\22PROBECHAN\\23UNIQMAC\"\n\n/* ic_flags_ht/iv_flags_ht */\n#define\tIEEE80211_FHT_NONHT_PR\t 0x00000001\t/* STATUS: non-HT sta present */\n#define\tIEEE80211_FHT_GF  \t 0x00040000\t/* CONF: Greenfield enabled */\n#define\tIEEE80211_FHT_HT\t 0x00080000\t/* CONF: HT supported */\n#define\tIEEE80211_FHT_AMPDU_TX\t 0x00100000\t/* CONF: A-MPDU tx supported */\n#define\tIEEE80211_FHT_AMPDU_RX\t 0x00200000\t/* CONF: A-MPDU rx supported */\n#define\tIEEE80211_FHT_AMSDU_TX\t 0x00400000\t/* CONF: A-MSDU tx supported */\n#define\tIEEE80211_FHT_AMSDU_RX\t 0x00800000\t/* CONF: A-MSDU rx supported */\n#define\tIEEE80211_FHT_USEHT40\t 0x01000000\t/* CONF: 20/40 use enabled */\n#define\tIEEE80211_FHT_PUREN\t 0x02000000\t/* CONF: 11n w/o legacy sta's */\n#define\tIEEE80211_FHT_SHORTGI20\t 0x04000000\t/* CONF: short GI in HT20 */\n#define\tIEEE80211_FHT_SHORTGI40\t 0x08000000\t/* CONF: short GI in HT40 */\n#define\tIEEE80211_FHT_HTCOMPAT \t 0x10000000\t/* CONF: HT vendor OUI's */\n#define\tIEEE80211_FHT_RIFS  \t 0x20000000\t/* CONF: RIFS enabled */\n#define\tIEEE80211_FHT_STBC_TX \t 0x40000000\t/* CONF: STBC tx enabled */\n#define\tIEEE80211_FHT_STBC_RX \t 0x80000000\t/* CONF: STBC rx enabled */\n\n#define\tIEEE80211_FHT_BITS \\\n\t\"\\20\\1NONHT_PR\" \\\n\t\"\\23GF\\24HT\\25AMPDU_TX\\26AMPDU_TX\" \\\n\t\"\\27AMSDU_TX\\30AMSDU_RX\\31USEHT40\\32PUREN\\33SHORTGI20\\34SHORTGI40\" \\\n\t\"\\35HTCOMPAT\\36RIFS\\37STBC_TX\\40STBC_RX\"\n\n#define\tIEEE80211_FVEN_BITS\t\"\\20\"\n\n/* ic_caps/iv_caps: device driver capabilities */\n/* 0x2e available */\n#define\tIEEE80211_C_STA\t\t0x00000001\t/* CAPABILITY: STA available */\n#define\tIEEE80211_C_8023ENCAP\t0x00000002\t/* CAPABILITY: 802.3 encap */\n#define\tIEEE80211_C_FF\t\t0x00000040\t/* CAPABILITY: ATH FF avail */\n#define\tIEEE80211_C_TURBOP\t0x00000080\t/* CAPABILITY: ATH Turbo avail*/\n#define\tIEEE80211_C_IBSS\t0x00000100\t/* CAPABILITY: IBSS available */\n#define\tIEEE80211_C_PMGT\t0x00000200\t/* CAPABILITY: Power mgmt */\n#define\tIEEE80211_C_HOSTAP\t0x00000400\t/* CAPABILITY: HOSTAP avail */\n#define\tIEEE80211_C_AHDEMO\t0x00000800\t/* CAPABILITY: Old Adhoc Demo */\n#define\tIEEE80211_C_SWRETRY\t0x00001000\t/* CAPABILITY: sw tx retry */\n#define\tIEEE80211_C_TXPMGT\t0x00002000\t/* CAPABILITY: tx power mgmt */\n#define\tIEEE80211_C_SHSLOT\t0x00004000\t/* CAPABILITY: short slottime */\n#define\tIEEE80211_C_SHPREAMBLE\t0x00008000\t/* CAPABILITY: short preamble */\n#define\tIEEE80211_C_MONITOR\t0x00010000\t/* CAPABILITY: monitor mode */\n#define\tIEEE80211_C_DFS\t\t0x00020000\t/* CAPABILITY: DFS/radar avail*/\n#define\tIEEE80211_C_MBSS\t0x00040000\t/* CAPABILITY: MBSS available */\n/* 0x7c0000 available */\n#define\tIEEE80211_C_WPA1\t0x00800000\t/* CAPABILITY: WPA1 avail */\n#define\tIEEE80211_C_WPA2\t0x01000000\t/* CAPABILITY: WPA2 avail */\n#define\tIEEE80211_C_WPA\t\t0x01800000\t/* CAPABILITY: WPA1+WPA2 avail*/\n#define\tIEEE80211_C_BURST\t0x02000000\t/* CAPABILITY: frame bursting */\n#define\tIEEE80211_C_WME\t\t0x04000000\t/* CAPABILITY: WME avail */\n#define\tIEEE80211_C_WDS\t\t0x08000000\t/* CAPABILITY: 4-addr support */\n/* 0x10000000 reserved */\n#define\tIEEE80211_C_BGSCAN\t0x20000000\t/* CAPABILITY: bg scanning */\n#define\tIEEE80211_C_TXFRAG\t0x40000000\t/* CAPABILITY: tx fragments */\n#define\tIEEE80211_C_TDMA\t0x80000000\t/* CAPABILITY: TDMA avail */\n/* XXX protection/barker? */\n\n#define\tIEEE80211_C_OPMODE \\\n\t(IEEE80211_C_STA | IEEE80211_C_IBSS | IEEE80211_C_HOSTAP | \\\n\t IEEE80211_C_AHDEMO | IEEE80211_C_MONITOR | IEEE80211_C_WDS | \\\n\t IEEE80211_C_TDMA | IEEE80211_C_MBSS)\n\n#define\tIEEE80211_C_BITS \\\n\t\"\\20\\1STA\\002803ENCAP\\7FF\\10TURBOP\\11IBSS\\12PMGT\" \\\n\t\"\\13HOSTAP\\14AHDEMO\\15SWRETRY\\16TXPMGT\\17SHSLOT\\20SHPREAMBLE\" \\\n\t\"\\21MONITOR\\22DFS\\23MBSS\\30WPA1\\31WPA2\\32BURST\\33WME\\34WDS\\36BGSCAN\" \\\n\t\"\\37TXFRAG\\40TDMA\"\n\n/*\n * ic_htcaps/iv_htcaps: HT-specific device/driver capabilities\n *\n * NB: the low 16-bits are the 802.11 definitions, the upper\n *     16-bits are used to define s/w/driver capabilities.\n */\n#define\tIEEE80211_HTC_AMPDU\t0x00010000\t/* CAPABILITY: A-MPDU tx */\n#define\tIEEE80211_HTC_AMSDU\t0x00020000\t/* CAPABILITY: A-MSDU tx */\n/* NB: HT40 is implied by IEEE80211_HTCAP_CHWIDTH40 */\n#define\tIEEE80211_HTC_HT\t0x00040000\t/* CAPABILITY: HT operation */\n#define\tIEEE80211_HTC_SMPS\t0x00080000\t/* CAPABILITY: MIMO power save*/\n#define\tIEEE80211_HTC_RIFS\t0x00100000\t/* CAPABILITY: RIFS support */\n#define\tIEEE80211_HTC_RXUNEQUAL\t0x00200000\t/* CAPABILITY: RX unequal MCS */\n#define\tIEEE80211_HTC_RXMCS32\t0x00400000\t/* CAPABILITY: MCS32 support */\n#define\tIEEE80211_HTC_TXUNEQUAL\t0x00800000\t/* CAPABILITY: TX unequal MCS */\n#define\tIEEE80211_HTC_TXMCS32\t0x01000000\t/* CAPABILITY: MCS32 suport */\n\n#define\tIEEE80211_C_HTCAP_BITS \\\n\t\"\\20\\1LDPC\\2CHWIDTH40\\5GREENFIELD\\6SHORTGI20\\7SHORTGI40\\10TXSTBC\" \\\n\t\"\\21AMPDU\\22AMSDU\\23HT\\24SMPS\\25RIFS\"\n\nvoid\tieee80211_ifattach(struct ieee80211com *,\n\t\tconst uint8_t macaddr[IEEE80211_ADDR_LEN]);\nvoid\tieee80211_ifdetach(struct ieee80211com *);\nint\tieee80211_vap_setup(struct ieee80211com *, struct ieee80211vap *,\n\t\tconst char name[IFNAMSIZ], int unit, int opmode, int flags,\n\t\tconst uint8_t bssid[IEEE80211_ADDR_LEN],\n\t\tconst uint8_t macaddr[IEEE80211_ADDR_LEN]);\nint\tieee80211_vap_attach(struct ieee80211vap *,\n\t\tifm_change_cb_t, ifm_stat_cb_t);\nvoid\tieee80211_vap_detach(struct ieee80211vap *);\nconst struct ieee80211_rateset *ieee80211_get_suprates(struct ieee80211com *ic,\n\t\tconst struct ieee80211_channel *);\nvoid\tieee80211_announce(struct ieee80211com *);\nvoid\tieee80211_announce_channels(struct ieee80211com *);\nvoid\tieee80211_drain(struct ieee80211com *);\nvoid\tieee80211_media_init(struct ieee80211com *);\nstruct ieee80211com *ieee80211_find_vap(const uint8_t mac[IEEE80211_ADDR_LEN]);\nint\tieee80211_media_change(struct ifnet *);\nvoid\tieee80211_media_status(struct ifnet *, struct ifmediareq *);\nint\tieee80211_ioctl(struct ifnet *, u_long, caddr_t);\nint\tieee80211_rate2media(struct ieee80211com *, int,\n\t\tenum ieee80211_phymode);\nint\tieee80211_media2rate(int);\nint\tieee80211_mhz2ieee(u_int, u_int);\nint\tieee80211_chan2ieee(struct ieee80211com *,\n\t\tconst struct ieee80211_channel *);\nu_int\tieee80211_ieee2mhz(u_int, u_int);\nstruct ieee80211_channel *ieee80211_find_channel(struct ieee80211com *,\n\t\tint freq, int flags);\nstruct ieee80211_channel *ieee80211_find_channel_byieee(struct ieee80211com *,\n\t\tint ieee, int flags);\nint\tieee80211_setmode(struct ieee80211com *, enum ieee80211_phymode);\nenum ieee80211_phymode ieee80211_chan2mode(const struct ieee80211_channel *);\nuint32_t ieee80211_mac_hash(const struct ieee80211com *,\n\t\tconst uint8_t addr[IEEE80211_ADDR_LEN]);\n\nvoid\tieee80211_radiotap_attach(struct ieee80211com *,\n\t    struct ieee80211_radiotap_header *th, int tlen,\n\t\tuint32_t tx_radiotap,\n\t    struct ieee80211_radiotap_header *rh, int rlen,\n\t\tuint32_t rx_radiotap);\nvoid\tieee80211_radiotap_detach(struct ieee80211com *);\nvoid\tieee80211_radiotap_vattach(struct ieee80211vap *);\nvoid\tieee80211_radiotap_vdetach(struct ieee80211vap *);\nvoid\tieee80211_radiotap_chan_change(struct ieee80211com *);\nvoid\tieee80211_radiotap_tx(struct ieee80211vap *, struct mbuf *);\nvoid\tieee80211_radiotap_rx(struct ieee80211vap *, struct mbuf *);\nvoid\tieee80211_radiotap_rx_all(struct ieee80211com *, struct mbuf *);\n\nstatic __inline int\nieee80211_radiotap_active(const struct ieee80211com *ic)\n{\n\treturn (ic->ic_flags_ext & IEEE80211_FEXT_BPF) != 0;\n}\n\nstatic __inline int\nieee80211_radiotap_active_vap(const struct ieee80211vap *vap)\n{\n\treturn (vap->iv_flags_ext & IEEE80211_FEXT_BPF) ||\n\t    vap->iv_ic->ic_montaps != 0;\n}\n\n/*\n * Enqueue a task on the state thread.\n */\nstatic __inline void\nieee80211_runtask(struct ieee80211com *ic, struct task *task)\n{\n\ttaskqueue_enqueue(ic->ic_tq, task);\n}\n\n/*\n * Wait for a queued task to complete.\n */\nstatic __inline void\nieee80211_draintask(struct ieee80211com *ic, struct task *task)\n{\n\ttaskqueue_drain(ic->ic_tq, task);\n}\n\n/* \n * Key update synchronization methods.  XXX should not be visible.\n */\nstatic __inline void\nieee80211_key_update_begin(struct ieee80211vap *vap)\n{\n\tvap->iv_key_update_begin(vap);\n}\nstatic __inline void\nieee80211_key_update_end(struct ieee80211vap *vap)\n{\n\tvap->iv_key_update_end(vap);\n}\n\n/*\n * XXX these need to be here for IEEE80211_F_DATAPAD\n */\n\n/*\n * Return the space occupied by the 802.11 header and any\n * padding required by the driver.  This works for a\n * management or data frame.\n */\nstatic __inline int\nieee80211_hdrspace(struct ieee80211com *ic, const void *data)\n{\n\tint size = ieee80211_hdrsize(data);\n\tif (ic->ic_flags & IEEE80211_F_DATAPAD)\n\t\tsize = roundup(size, sizeof(uint32_t));\n\treturn size;\n}\n\n/*\n * Like ieee80211_hdrspace, but handles any type of frame.\n */\nstatic __inline int\nieee80211_anyhdrspace(struct ieee80211com *ic, const void *data)\n{\n\tint size = ieee80211_anyhdrsize(data);\n\tif (ic->ic_flags & IEEE80211_F_DATAPAD)\n\t\tsize = roundup(size, sizeof(uint32_t));\n\treturn size;\n}\n\n/*\n * Notify a vap that beacon state has been updated.\n */\nstatic __inline void\nieee80211_beacon_notify(struct ieee80211vap *vap, int what)\n{\n\tif (vap->iv_state == IEEE80211_S_RUN)\n\t\tvap->iv_update_beacon(vap, what);\n}\n\n/*\n * Calculate HT channel promotion flags for a channel.\n * XXX belongs in ieee80211_ht.h but needs IEEE80211_FHT_*\n */\nstatic __inline int\nieee80211_htchanflags(const struct ieee80211_channel *c)\n{\n\treturn IEEE80211_IS_CHAN_HT40(c) ?\n\t    IEEE80211_FHT_HT | IEEE80211_FHT_USEHT40 :\n\t    IEEE80211_IS_CHAN_HT(c) ?  IEEE80211_FHT_HT : 0;\n}\n\n/*\n * Debugging facilities compiled in when IEEE80211_DEBUG is defined.\n *\n * The intent is that any problem in the net80211 layer can be\n * diagnosed by inspecting the statistics (dumped by the wlanstats\n * program) and/or the msgs generated by net80211.  Messages are\n * broken into functional classes and can be controlled with the\n * wlandebug program.  Certain of these msg groups are for facilities\n * that are no longer part of net80211 (e.g. IEEE80211_MSG_DOT1XSM).\n */\n#define\tIEEE80211_MSG_11N\t0x80000000\t/* 11n mode debug */\n#define\tIEEE80211_MSG_DEBUG\t0x40000000\t/* IFF_DEBUG equivalent */\n#define\tIEEE80211_MSG_DUMPPKTS\t0x20000000\t/* IFF_LINK2 equivalant */\n#define\tIEEE80211_MSG_CRYPTO\t0x10000000\t/* crypto work */\n#define\tIEEE80211_MSG_INPUT\t0x08000000\t/* input handling */\n#define\tIEEE80211_MSG_XRATE\t0x04000000\t/* rate set handling */\n#define\tIEEE80211_MSG_ELEMID\t0x02000000\t/* element id parsing */\n#define\tIEEE80211_MSG_NODE\t0x01000000\t/* node handling */\n#define\tIEEE80211_MSG_ASSOC\t0x00800000\t/* association handling */\n#define\tIEEE80211_MSG_AUTH\t0x00400000\t/* authentication handling */\n#define\tIEEE80211_MSG_SCAN\t0x00200000\t/* scanning */\n#define\tIEEE80211_MSG_OUTPUT\t0x00100000\t/* output handling */\n#define\tIEEE80211_MSG_STATE\t0x00080000\t/* state machine */\n#define\tIEEE80211_MSG_POWER\t0x00040000\t/* power save handling */\n#define\tIEEE80211_MSG_HWMP\t0x00020000\t/* hybrid mesh protocol */\n#define\tIEEE80211_MSG_DOT1XSM\t0x00010000\t/* 802.1x state machine */\n#define\tIEEE80211_MSG_RADIUS\t0x00008000\t/* 802.1x radius client */\n#define\tIEEE80211_MSG_RADDUMP\t0x00004000\t/* dump 802.1x radius packets */\n#define\tIEEE80211_MSG_MESH\t0x00002000\t/* mesh networking */\n#define\tIEEE80211_MSG_WPA\t0x00001000\t/* WPA/RSN protocol */\n#define\tIEEE80211_MSG_ACL\t0x00000800\t/* ACL handling */\n#define\tIEEE80211_MSG_WME\t0x00000400\t/* WME protocol */\n#define\tIEEE80211_MSG_SUPERG\t0x00000200\t/* Atheros SuperG protocol */\n#define\tIEEE80211_MSG_DOTH\t0x00000100\t/* 802.11h support */\n#define\tIEEE80211_MSG_INACT\t0x00000080\t/* inactivity handling */\n#define\tIEEE80211_MSG_ROAM\t0x00000040\t/* sta-mode roaming */\n#define\tIEEE80211_MSG_RATECTL\t0x00000020\t/* tx rate control */\n#define\tIEEE80211_MSG_ACTION\t0x00000010\t/* action frame handling */\n#define\tIEEE80211_MSG_WDS\t0x00000008\t/* WDS handling */\n#define\tIEEE80211_MSG_IOCTL\t0x00000004\t/* ioctl handling */\n#define\tIEEE80211_MSG_TDMA\t0x00000002\t/* TDMA handling */\n\n#define\tIEEE80211_MSG_ANY\t0xffffffff\t/* anything */\n\n#define\tIEEE80211_MSG_BITS \\\n\t\"\\20\\2TDMA\\3IOCTL\\4WDS\\5ACTION\\6RATECTL\\7ROAM\\10INACT\\11DOTH\\12SUPERG\" \\\n\t\"\\13WME\\14ACL\\15WPA\\16RADKEYS\\17RADDUMP\\20RADIUS\\21DOT1XSM\\22HWMP\" \\\n\t\"\\23POWER\\24STATE\\25OUTPUT\\26SCAN\\27AUTH\\30ASSOC\\31NODE\\32ELEMID\" \\\n\t\"\\33XRATE\\34INPUT\\35CRYPTO\\36DUPMPKTS\\37DEBUG\\04011N\"\n\n#ifdef IEEE80211_DEBUG\n#define\tieee80211_msg(_vap, _m)\t((_vap)->iv_debug & (_m))\n#define\tIEEE80211_DPRINTF(_vap, _m, _fmt, ...) do {\t\t\t\\\n\tif (ieee80211_msg(_vap, _m))\t\t\t\t\t\\\n\t\tieee80211_note(_vap, _fmt, __VA_ARGS__);\t\t\\\n} while (0)\n#define\tIEEE80211_NOTE(_vap, _m, _ni, _fmt, ...) do {\t\t\t\\\n\tif (ieee80211_msg(_vap, _m))\t\t\t\t\t\\\n\t\tieee80211_note_mac(_vap, (_ni)->ni_macaddr, _fmt, __VA_ARGS__);\\\n} while (0)\n#define\tIEEE80211_NOTE_MAC(_vap, _m, _mac, _fmt, ...) do {\t\t\\\n\tif (ieee80211_msg(_vap, _m))\t\t\t\t\t\\\n\t\tieee80211_note_mac(_vap, _mac, _fmt, __VA_ARGS__);\t\\\n} while (0)\n#define\tIEEE80211_NOTE_FRAME(_vap, _m, _wh, _fmt, ...) do {\t\t\\\n\tif (ieee80211_msg(_vap, _m))\t\t\t\t\t\\\n\t\tieee80211_note_frame(_vap, _wh, _fmt, __VA_ARGS__);\t\\\n} while (0)\nvoid\tieee80211_note(const struct ieee80211vap *, const char *, ...);\nvoid\tieee80211_note_mac(const struct ieee80211vap *,\n\t\tconst uint8_t mac[IEEE80211_ADDR_LEN], const char *, ...);\nvoid\tieee80211_note_frame(const struct ieee80211vap *,\n\t\tconst struct ieee80211_frame *, const char *, ...);\n#define\tieee80211_msg_debug(_vap) \\\n\t((_vap)->iv_debug & IEEE80211_MSG_DEBUG)\n#define\tieee80211_msg_dumppkts(_vap) \\\n\t((_vap)->iv_debug & IEEE80211_MSG_DUMPPKTS)\n#define\tieee80211_msg_input(_vap) \\\n\t((_vap)->iv_debug & IEEE80211_MSG_INPUT)\n#define\tieee80211_msg_radius(_vap) \\\n\t((_vap)->iv_debug & IEEE80211_MSG_RADIUS)\n#define\tieee80211_msg_dumpradius(_vap) \\\n\t((_vap)->iv_debug & IEEE80211_MSG_RADDUMP)\n#define\tieee80211_msg_dumpradkeys(_vap) \\\n\t((_vap)->iv_debug & IEEE80211_MSG_RADKEYS)\n#define\tieee80211_msg_scan(_vap) \\\n\t((_vap)->iv_debug & IEEE80211_MSG_SCAN)\n#define\tieee80211_msg_assoc(_vap) \\\n\t((_vap)->iv_debug & IEEE80211_MSG_ASSOC)\n\n/*\n * Emit a debug message about discarding a frame or information\n * element.  One format is for extracting the mac address from\n * the frame header; the other is for when a header is not\n * available or otherwise appropriate.\n */\n#define\tIEEE80211_DISCARD(_vap, _m, _wh, _type, _fmt, ...) do {\t\t\\\n\tif ((_vap)->iv_debug & (_m))\t\t\t\t\t\\\n\t\tieee80211_discard_frame(_vap, _wh, _type, _fmt, __VA_ARGS__);\\\n} while (0)\n#define\tIEEE80211_DISCARD_IE(_vap, _m, _wh, _type, _fmt, ...) do {\t\\\n\tif ((_vap)->iv_debug & (_m))\t\t\t\t\t\\\n\t\tieee80211_discard_ie(_vap, _wh, _type, _fmt, __VA_ARGS__);\\\n} while (0)\n#define\tIEEE80211_DISCARD_MAC(_vap, _m, _mac, _type, _fmt, ...) do {\t\\\n\tif ((_vap)->iv_debug & (_m))\t\t\t\t\t\\\n\t\tieee80211_discard_mac(_vap, _mac, _type, _fmt, __VA_ARGS__);\\\n} while (0)\n\nvoid ieee80211_discard_frame(const struct ieee80211vap *,\n\tconst struct ieee80211_frame *, const char *type, const char *fmt, ...);\nvoid ieee80211_discard_ie(const struct ieee80211vap *,\n\tconst struct ieee80211_frame *, const char *type, const char *fmt, ...);\nvoid ieee80211_discard_mac(const struct ieee80211vap *,\n\tconst uint8_t mac[IEEE80211_ADDR_LEN], const char *type,\n\tconst char *fmt, ...);\n#else\n#define\tIEEE80211_DPRINTF(_vap, _m, _fmt, ...)\n#define\tIEEE80211_NOTE(_vap, _m, _ni, _fmt, ...)\n#define\tIEEE80211_NOTE_FRAME(_vap, _m, _wh, _fmt, ...)\n#define\tIEEE80211_NOTE_MAC(_vap, _m, _mac, _fmt, ...)\n#define\tieee80211_msg_dumppkts(_vap)\t0\n#define\tieee80211_msg(_vap, _m)\t\t0\n\n#define\tIEEE80211_DISCARD(_vap, _m, _wh, _type, _fmt, ...)\n#define\tIEEE80211_DISCARD_IE(_vap, _m, _wh, _type, _fmt, ...)\n#define\tIEEE80211_DISCARD_MAC(_vap, _m, _mac, _type, _fmt, ...)\n#endif\n\n#endif /* _NET80211_IEEE80211_VAR_H_ */\n"
  },
  {
    "path": "freebsd-headers/net80211/ieee80211_wds.h",
    "content": "/*-\n * Copyright (c) 2007-2008 Sam Leffler, Errno Consulting\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR\n * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES\n * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,\n * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF\n * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/net80211/ieee80211_wds.h 178354 2008-04-20 20:35:46Z sam $\n */\n#ifndef _NET80211_IEEE80211_WDS_H_\n#define _NET80211_IEEE80211_WDS_H_\n\n/*\n * WDS implementation definitions.\n */\nvoid\tieee80211_wds_attach(struct ieee80211com *);\nvoid\tieee80211_wds_detach(struct ieee80211com *);\n\nvoid\tieee80211_dwds_mcast(struct ieee80211vap *, struct mbuf *);\nvoid\tieee80211_dwds_discover(struct ieee80211_node *, struct mbuf *);\nint\tieee80211_node_wdsq_age(struct ieee80211_node *);\n#endif /* !_NET80211_IEEE80211_WDS_H_ */\n"
  },
  {
    "path": "freebsd-headers/netatalk/aarp.h",
    "content": "/*-\n * Copyright (c) 1990,1991 Regents of The University of Michigan.\n * All Rights Reserved.\n *\n * Permission to use, copy, modify, and distribute this software and\n * its documentation for any purpose and without fee is hereby granted,\n * provided that the above copyright notice appears in all copies and\n * that both that copyright notice and this permission notice appear\n * in supporting documentation, and that the name of The University\n * of Michigan not be used in advertising or publicity pertaining to\n * distribution of the software without specific, written prior\n * permission. This software is supplied as is without expressed or\n * implied warranties of any kind.\n *\n * This product includes software developed by the University of\n * California, Berkeley and its contributors.\n *\n *\tResearch Systems Unix Group\n *\tThe University of Michigan\n *\tc/o Wesley Craig\n *\t535 W. William Street\n *\tAnn Arbor, Michigan\n *\t+1-313-764-2278\n *\tnetatalk@umich.edu\n *\n * $FreeBSD: release/9.0.0/sys/netatalk/aarp.h 171078 2007-06-28 12:54:58Z rwatson $\n */\n\n#ifndef _NETATALK_AARP_H_\n#define\t_NETATALK_AARP_H_\n\n/*\n * This structure is used for both phase 1 and 2. Under phase 1\n * the net is not filled in. It is in phase 2. In both cases, the\n * hardware address length is (for some unknown reason) 4. If\n * anyone at Apple could program their way out of paper bag, it\n * would be 1 and 3 respectively for phase 1 and 2.\n */\nunion aapa {\n\tu_char ap_pa[4];\n\tstruct ap_node {\n\t\tu_char an_zero;\n\t\tu_char an_net[2];\n\t\tu_char an_node;\n\t} __packed ap_node;\n};\n\nstruct ether_aarp {\n\tstruct arphdr eaa_hdr;\n\tu_char aarp_sha[6];\n\tunion aapa aarp_spu;\n\tu_char aarp_tha[6];\n\tunion aapa aarp_tpu;\n} __packed;\n\n#define\taarp_hrd\teaa_hdr.ar_hrd\n#define\taarp_pro\teaa_hdr.ar_pro\n#define\taarp_hln\teaa_hdr.ar_hln\n#define\taarp_pln\teaa_hdr.ar_pln\n#define\taarp_op\t\teaa_hdr.ar_op\n#define\taarp_spa\taarp_spu.ap_node.an_node\n#define\taarp_tpa\taarp_tpu.ap_node.an_node\n#define\taarp_spnet\taarp_spu.ap_node.an_net\n#define\taarp_tpnet\taarp_tpu.ap_node.an_net\n#define\taarp_spnode\taarp_spu.ap_node.an_node\n#define\taarp_tpnode\taarp_tpu.ap_node.an_node\n\nstruct aarptab {\n\tstruct at_addr aat_ataddr;\n\tu_char aat_enaddr[6];\n\tu_char aat_timer;\n\tu_char aat_flags;\n\tstruct mbuf *aat_hold;\n};\n\n#define\tAARPHRD_ETHER\t0x0001\n\n#define\tAARPOP_REQUEST\t0x01\n#define\tAARPOP_RESPONSE\t0x02\n#define\tAARPOP_PROBE\t0x03\n\n#ifdef _KERNEL\nstruct aarptab\t\t*aarptnew(struct at_addr      *);\n#endif\n\n#endif /* _NETATALK_AARP_H_ */\n"
  },
  {
    "path": "freebsd-headers/netatalk/at.h",
    "content": "/*-\n * Copyright (c) 1990,1991 Regents of The University of Michigan.\n * All Rights Reserved.\n *\n * Permission to use, copy, modify, and distribute this software and\n * its documentation for any purpose and without fee is hereby granted,\n * provided that the above copyright notice appears in all copies and\n * that both that copyright notice and this permission notice appear\n * in supporting documentation, and that the name of The University\n * of Michigan not be used in advertising or publicity pertaining to\n * distribution of the software without specific, written prior\n * permission. This software is supplied as is without expressed or\n * implied warranties of any kind.\n *\n *\tResearch Systems Unix Group\n *\tThe University of Michigan\n *\tc/o Mike Clark\n *\t535 W. William Street\n *\tAnn Arbor, Michigan\n *\t+1-313-763-0525\n *\tnetatalk@itd.umich.edu\n *\n * $FreeBSD: release/9.0.0/sys/netatalk/at.h 165972 2007-01-12 13:18:08Z rwatson $\n */\n\n#ifndef _NETATALK_AT_H_\n#define\t_NETATALK_AT_H_\n\n/*\n * Supported protocols\n */\n#define\tATPROTO_DDP\t0\n#define\tATPROTO_AARP\t254\n\n#define\tDDP_MAXSZ\t587\n\n/*\n * If ATPORT_FIRST <= Port < ATPORT_RESERVED, the port was created by a\n * privileged process.\n *\n * If ATPORT_RESERVED <= Port < ATPORT_LAST, the port was not necessarily\n * created by a privileged process.\n */\n#define\tATPORT_FIRST\t1\n#define\tATPORT_RESERVED\t128\n#define\tATPORT_LAST\t255\n\n/*\n * AppleTalk address.\n */\nstruct at_addr {\n\tu_short\ts_net;\n\tu_char\ts_node;\n};\n\n#define\tATADDR_ANYNET\t(u_short)0x0000\n#define\tATADDR_ANYNODE\t(u_char)0x00\n#define\tATADDR_ANYPORT\t(u_char)0x00\n#define\tATADDR_BCAST\t(u_char)0xff\t/* There is no BCAST for NET. */\n\nstruct netrange {\n\tu_char\tnr_phase;\n\tu_short\tnr_firstnet;\n\tu_short\tnr_lastnet;\n};\n\n/*\n * Socket address, AppleTalk style.  We keep magic information in the zero\n * bytes.  There are three types, NONE, CONFIG which has the phase and a net\n * range, and IFACE which has the network address of an interface.  IFACE may\n * be filled in by the client, and is filled in by the kernel.\n */\nstruct sockaddr_at {\n\tu_char\t\tsat_len;\n\tu_char\t\tsat_family;\n\tu_char\t\tsat_port;\n\tstruct at_addr\tsat_addr;\n\tunion {\n\t\tstruct netrange\tr_netrange;\n\t\tchar\t\tr_zero[8];\t/* Hide struct netrange here. */\n\t} sat_range;\n};\n\n#define\tsat_zero\tsat_range.r_zero\n\n#endif /* !_NETATALK_AT_H_ */\n"
  },
  {
    "path": "freebsd-headers/netatalk/at_extern.h",
    "content": "/*-\n * Copyright (c) 1990,1994 Regents of The University of Michigan.\n * All Rights Reserved.\n *\n * Permission to use, copy, modify, and distribute this software and\n * its documentation for any purpose and without fee is hereby granted,\n * provided that the above copyright notice appears in all copies and\n * that both that copyright notice and this permission notice appear\n * in supporting documentation, and that the name of The University\n * of Michigan not be used in advertising or publicity pertaining to\n * distribution of the software without specific, written prior\n * permission. This software is supplied as is without expressed or\n * implied warranties of any kind.\n *\n * This product includes software developed by the University of\n * California, Berkeley and its contributors.\n *\n *\tResearch Systems Unix Group\n *\tThe University of Michigan\n *\tc/o Wesley Craig\n *\t535 W. William Street\n *\tAnn Arbor, Michigan\n *\t+1-313-764-2278\n *\tnetatalk@umich.edu\n *\n * $FreeBSD: release/9.0.0/sys/netatalk/at_extern.h 194819 2009-06-24 10:32:44Z rwatson $\n */\n\n#ifndef _NETATALK_AT_EXTERN_H_\n#define\t_NETATALK_AT_EXTERN_H_\n\nextern struct mtx\taarptab_mtx;\n\n#define\tAARPTAB_LOCK()\t\tmtx_lock(&aarptab_mtx)\n#define\tAARPTAB_UNLOCK()\tmtx_unlock(&aarptab_mtx)\n#define\tAARPTAB_LOCK_ASSERT()\tmtx_assert(&aarptab_mtx, MA_OWNED)\n#define\tAARPTAB_UNLOCK_ASSERT()\tmtx_assert(&aarptab_mtx, MA_NOTOWNED)\n\nstruct at_ifaddr;\nstruct ifnet;\nstruct mbuf;\nstruct route;\nstruct thread;\nstruct sockaddr_at;\nstruct socket;\nvoid\t\t aarpintr(struct mbuf *);\nvoid\t\t aarpprobe(void *arg);\nint\t\t aarpresolve(struct ifnet *, struct mbuf *,\n\t\t    struct sockaddr_at *, u_char *);\nvoid\t\t aarp_clean(void);\nvoid\t\t at1intr(struct mbuf *);\nvoid\t\t at2intr(struct mbuf *);\nint\t\t at_broadcast(struct sockaddr_at  *);\nu_short\t\t at_cksum(struct mbuf *m, int skip);\nint\t\t at_control(struct socket *so, u_long cmd, caddr_t data,\n\t\t    struct ifnet *ifp, struct thread *td);\nstruct at_ifaddr\t*at_ifawithnet(struct sockaddr_at *);\nstruct at_ifaddr\t*at_ifawithnet_locked(struct sockaddr_at  *sat);\n\nint\t\t at_inithead(void**, int);\nvoid\t\t ddp_init(void);\nint\t\t ddp_output(struct mbuf *m, struct socket *so); \nint\t\t ddp_route(struct mbuf *m, struct route *ro);\nstruct ddpcb\t*ddp_search(struct sockaddr_at *, struct sockaddr_at *,\n\t\t    struct at_ifaddr *);\n\n#endif /* !_NETATALK_AT_EXTERN_H_ */\n"
  },
  {
    "path": "freebsd-headers/netatalk/at_var.h",
    "content": "/*-\n * Copyright (c) 1990, 1991 Regents of The University of Michigan.\n * All Rights Reserved.\n *\n * Permission to use, copy, modify, and distribute this software and\n * its documentation for any purpose and without fee is hereby granted,\n * provided that the above copyright notice appears in all copies and\n * that both that copyright notice and this permission notice appear\n * in supporting documentation, and that the name of The University\n * of Michigan not be used in advertising or publicity pertaining to\n * distribution of the software without specific, written prior\n * permission. This software is supplied as is without expressed or\n * implied warranties of any kind.\n *\n *\tResearch Systems Unix Group\n *\tThe University of Michigan\n *\tc/o Mike Clark\n *\t535 W. William Street\n *\tAnn Arbor, Michigan\n *\t+1-313-763-0525\n *\tnetatalk@itd.umich.edu\n *\n * $FreeBSD: release/9.0.0/sys/netatalk/at_var.h 194913 2009-06-24 21:36:09Z rwatson $\n */\n\n#ifndef _NETATALK_AT_VAR_H_\n#define\t_NETATALK_AT_VAR_H_\n\n/*\n * For phase2, we need to keep not only our address on an interface, but also\n * the legal networks on the interface.\n */\nstruct at_ifaddr {\n\tstruct ifaddr\t\t aa_ifa;\n\tstruct sockaddr_at\t aa_addr;\n\tstruct sockaddr_at\t aa_broadaddr;\n\tstruct sockaddr_at\t aa_netmask;\n\tint\t\t\t aa_flags;\n\tu_short\t\t\t aa_firstnet;\n\tu_short\t\t\t aa_lastnet;\n\tint\t\t\t aa_probcnt;\n\tstruct callout\t\t aa_callout;\n\tTAILQ_ENTRY(at_ifaddr)\t aa_link;\n};\n#define\taa_ifp\t\taa_ifa.ifa_ifp\n#define\taa_dstaddr\taa_broadaddr;\n\nTAILQ_HEAD(at_ifaddrhead, at_ifaddr);\n\nstruct at_aliasreq {\n\tchar\t\t\tifra_name[IFNAMSIZ];\n\tstruct sockaddr_at\tifra_addr;\n\tstruct sockaddr_at\tifra_broadaddr;\n\tstruct sockaddr_at\tifra_mask;\n};\n#define\tifra_dstaddr\tifra_broadaddr\n\n#define\tAA_SAT(aa)\t(&(aa->aa_addr))\n#define\tsatosat(sa)\t((struct sockaddr_at *)(sa))\n\n#define\tAFA_ROUTE\t0x0001\n#define\tAFA_PROBING\t0x0002\n#define\tAFA_PHASE2\t0x0004\n\n#ifdef _KERNEL\nextern struct rwlock\t\tat_ifaddr_rw;\nextern struct at_ifaddrhead\tat_ifaddrhead;\n\n#define\tAT_IFADDR_LOCK_INIT()\trw_init(&at_ifaddr_rw, \"at_ifaddr_rw\")\n#define\tAT_IFADDR_LOCK_ASSERT()\trw_assert(&at_ifaddr_rw, RA_LOCKED)\n#define\tAT_IFADDR_RLOCK()\trw_rlock(&at_ifaddr_rw)\n#define\tAT_IFADDR_RUNLOCK()\trw_runlock(&at_ifaddr_rw)\n#define\tAT_IFADDR_WLOCK()\trw_wlock(&at_ifaddr_rw)\n#define\tAT_IFADDR_WUNLOCK()\trw_wunlock(&at_ifaddr_rw)\n#endif\n\n#endif /* _NETATALK_AT_VAR_H_ */\n"
  },
  {
    "path": "freebsd-headers/netatalk/ddp.h",
    "content": "/*-\n * Copyright (c) 1990, 1991 Regents of The University of Michigan.\n * All Rights Reserved.\n *\n * Permission to use, copy, modify, and distribute this software and\n * its documentation for any purpose and without fee is hereby granted,\n * provided that the above copyright notice appears in all copies and\n * that both that copyright notice and this permission notice appear\n * in supporting documentation, and that the name of The University\n * of Michigan not be used in advertising or publicity pertaining to\n * distribution of the software without specific, written prior\n * permission. This software is supplied as is without expressed or\n * implied warranties of any kind.\n *\n *\tResearch Systems Unix Group\n *\tThe University of Michigan\n *\tc/o Mike Clark\n *\t535 W. William Street\n *\tAnn Arbor, Michigan\n *\t+1-313-763-0525\n *\tnetatalk@itd.umich.edu\n *\n * $FreeBSD: release/9.0.0/sys/netatalk/ddp.h 171078 2007-06-28 12:54:58Z rwatson $\n */\n\n#ifndef _NETATALK_DDP_H_\n#define\t_NETATALK_DDP_H_\n\n/*-\n * <-1byte(8bits) ->\n * +---------------+\n * | 0 | hopc  |len|\n * +---------------+\n * | len (cont)    |\n * +---------------+\n * |               |\n * +- DDP csum    -+\n * |               |\n * +---------------+\n * |               |\n * +- Dest NET    -+\n * |               |\n * +---------------+\n * |               |\n * +- Src NET     -+\n * |               |\n * +---------------+\n * | Dest NODE     |\n * +---------------+\n * | Src NODE      |\n * +---------------+\n * | Dest PORT     |\n * +---------------+\n * | Src PORT      |\n * +---------------+\n *\n * On Apples, there is also a ddp_type field, after src_port.  However, under\n * this unix implementation, user level processes need to be able to set the\n * ddp_type.  In later revisions, the ddp_type may only be available in a\n * raw_appletalk interface.\n */\n\nstruct elaphdr {\n\tu_char\tel_dnode;\n\tu_char\tel_snode;\n\tu_char\tel_type;\n} __packed;\n\n#define\tSZ_ELAPHDR\t3\n\n#define\tELAP_DDPSHORT\t0x01\n#define\tELAP_DDPEXTEND\t0x02\n\n/*\n * Extended DDP header. Includes sickness for dealing with arbitrary\n * bitfields on a little-endian arch.\n */\nstruct ddpehdr {\n\tunion {\n\t\tstruct {\n#if BYTE_ORDER == BIG_ENDIAN\n\t\t\tunsigned\tdub_pad:2;\n\t\t\tunsigned\tdub_hops:4;\n\t\t\tunsigned\tdub_len:10;\n\t\t\tunsigned\tdub_sum:16;\n#endif\n#if BYTE_ORDER == LITTLE_ENDIAN\n\t\t\tunsigned\tdub_sum:16;\n\t\t\tunsigned\tdub_len:10;\n\t\t\tunsigned\tdub_hops:4;\n\t\t\tunsigned\tdub_pad:2;\n#endif\n\t\t} __packed du_bits;\n\t\tunsigned\tdu_bytes;\n\t} deh_u;\n\tu_short\tdeh_dnet;\n\tu_short\tdeh_snet;\n\tu_char\tdeh_dnode;\n\tu_char\tdeh_snode;\n\tu_char\tdeh_dport;\n\tu_char\tdeh_sport;\n} __packed;\n#define\tdeh_pad\t\tdeh_u.du_bits.dub_pad\n#define\tdeh_hops\tdeh_u.du_bits.dub_hops\n#define\tdeh_len\t\tdeh_u.du_bits.dub_len\n#define\tdeh_sum\t\tdeh_u.du_bits.dub_sum\n#define\tdeh_bytes\tdeh_u.du_bytes\n\n#define\tDDP_MAXHOPS\t15\n\nstruct ddpshdr {\n\tunion {\n\t\tstruct {\n#if BYTE_ORDER == BIG_ENDIAN\n\t\t\tunsigned\tdub_pad:6;\n\t\t\tunsigned\tdub_len:10;\n\t\t\tunsigned\tdub_dport:8;\n\t\t\tunsigned\tdub_sport:8;\n#endif\n#if BYTE_ORDER == LITTLE_ENDIAN\n\t\t\tunsigned\tdub_sport:8;\n\t\t\tunsigned\tdub_dport:8;\n\t\t\tunsigned\tdub_len:10;\n\t\t\tunsigned\tdub_pad:6;\n#endif\n\t\t} __packed du_bits;\n\t\tunsigned\tdu_bytes;\n\t} dsh_u;\n} __packed;\n\n#define\tdsh_pad\t\tdsh_u.du_bits.dub_pad\n#define\tdsh_len\t\tdsh_u.du_bits.dub_len\n#define\tdsh_dport\tdsh_u.du_bits.dub_dport\n#define\tdsh_sport\tdsh_u.du_bits.dub_sport\n#define\tdsh_bytes\tdsh_u.du_bytes\n\n#endif /* _NETATALK_DDP_H_ */\n"
  },
  {
    "path": "freebsd-headers/netatalk/ddp_pcb.h",
    "content": "/*-\n * Copyright (c) 2004 Robert N. M. Watson\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * Copyright (c) 1990, 1994 Regents of The University of Michigan.\n * All Rights Reserved.\n *\n * Permission to use, copy, modify, and distribute this software and\n * its documentation for any purpose and without fee is hereby granted,\n * provided that the above copyright notice appears in all copies and\n * that both that copyright notice and this permission notice appear\n * in supporting documentation, and that the name of The University\n * of Michigan not be used in advertising or publicity pertaining to\n * distribution of the software without specific, written prior\n * permission. This software is supplied as is without expressed or\n * implied warranties of any kind.\n *\n * This product includes software developed by the University of\n * California, Berkeley and its contributors.\n *\n *\tResearch Systems Unix Group\n *\tThe University of Michigan\n *\tc/o Wesley Craig\n *\t535 W. William Street\n *\tAnn Arbor, Michigan\n *\t+1-313-764-2278\n *\tnetatalk@umich.edu\n *\n * $FreeBSD: release/9.0.0/sys/netatalk/ddp_pcb.h 165974 2007-01-12 15:07:51Z rwatson $\n */\n\n#ifndef _NETATALK_DDP_PCB_H_\n#define\t_NETATALK_DDP_PCB_H_\n\nint\tat_pcballoc(struct socket *so);\nint\tat_pcbconnect(struct ddpcb *ddp, struct sockaddr *addr, \n\t    struct thread *td);\nvoid\tat_pcbdetach(struct socket *so, struct ddpcb *ddp);\nvoid\tat_pcbdisconnect(struct ddpcb *ddp);\nint\tat_pcbsetaddr(struct ddpcb *ddp, struct sockaddr *addr,\n\t    struct thread *td);\nvoid\tat_sockaddr(struct ddpcb *ddp, struct sockaddr **addr);\n\n/* Lock macros for per-pcb locks. */\n#define\tDDP_LOCK_INIT(ddp)\tmtx_init(&(ddp)->ddp_mtx, \"ddp_mtx\",\t\\\n\t\t\t\t    NULL, MTX_DEF)\n#define\tDDP_LOCK_DESTROY(ddp)\tmtx_destroy(&(ddp)->ddp_mtx)\n#define\tDDP_LOCK(ddp)\t\tmtx_lock(&(ddp)->ddp_mtx)\n#define\tDDP_UNLOCK(ddp)\t\tmtx_unlock(&(ddp)->ddp_mtx)\n#define\tDDP_LOCK_ASSERT(ddp)\tmtx_assert(&(ddp)->ddp_mtx, MA_OWNED)\n\n/* Lock macros for global pcb list lock. */\n#define\tDDP_LIST_LOCK_INIT()\tmtx_init(&ddp_list_mtx, \"ddp_list_mtx\",\t\\\n\t\t\t\t    NULL, MTX_DEF)\n#define\tDDP_LIST_LOCK_DESTROY()\tmtx_destroy(&ddp_list_mtx)\n#define\tDDP_LIST_XLOCK()\tmtx_lock(&ddp_list_mtx)\n#define\tDDP_LIST_XUNLOCK()\tmtx_unlock(&ddp_list_mtx)\n#define\tDDP_LIST_XLOCK_ASSERT()\tmtx_assert(&ddp_list_mtx, MA_OWNED)\n#define\tDDP_LIST_SLOCK()\tmtx_lock(&ddp_list_mtx)\n#define\tDDP_LIST_SUNLOCK()\tmtx_unlock(&ddp_list_mtx)\n#define\tDDP_LIST_SLOCK_ASSERT()\tmtx_assert(&ddp_list_mtx, MA_OWNED)\n\n#endif /* !_NETATALK_DDP_PCB_H_ */\n"
  },
  {
    "path": "freebsd-headers/netatalk/ddp_var.h",
    "content": "/*-\n * Copyright (c) 1990, 1994 Regents of The University of Michigan.\n * All Rights Reserved.\n *\n * Permission to use, copy, modify, and distribute this software and\n * its documentation for any purpose and without fee is hereby granted,\n * provided that the above copyright notice appears in all copies and\n * that both that copyright notice and this permission notice appear\n * in supporting documentation, and that the name of The University\n * of Michigan not be used in advertising or publicity pertaining to\n * distribution of the software without specific, written prior\n * permission. This software is supplied as is without expressed or\n * implied warranties of any kind.\n *\n * This product includes software developed by the University of\n * California, Berkeley and its contributors.\n *\n *\tResearch Systems Unix Group\n *\tThe University of Michigan\n *\tc/o Wesley Craig\n *\t535 W. William Street\n *\tAnn Arbor, Michigan\n *\t+1-313-764-2278\n *\tnetatalk@umich.edu\n *\n * $FreeBSD: release/9.0.0/sys/netatalk/ddp_var.h 165974 2007-01-12 15:07:51Z rwatson $\n */\n\n#ifndef _NETATALK_DDP_VAR_H_\n#define\t_NETATALK_DDP_VAR_H_\n\nstruct ddpcb {\n\tstruct sockaddr_at\t ddp_fsat, ddp_lsat;\n\tstruct route\t\t ddp_route;\n\tstruct socket\t\t*ddp_socket;\n\tstruct ddpcb\t\t*ddp_prev, *ddp_next;\n\tstruct ddpcb\t\t*ddp_pprev, *ddp_pnext;\n\tstruct mtx\t\t ddp_mtx;\n};\n\n#define\tsotoddpcb(so)\t((struct ddpcb *)(so)->so_pcb)\n\nstruct ddpstat {\n\tlong\tddps_short;\t\t/* short header packets received */\n\tlong\tddps_long;\t\t/* long header packets received */\n\tlong\tddps_nosum;\t\t/* no checksum */\n\tlong\tddps_badsum;\t\t/* bad checksum */\n\tlong\tddps_tooshort;\t\t/* packet too short */\n\tlong\tddps_toosmall;\t\t/* not enough data */\n\tlong\tddps_forward;\t\t/* packets forwarded */\n\tlong\tddps_encap;\t\t/* packets encapsulated */\n\tlong\tddps_cantforward;\t/* packets rcvd for unreachable dest */\n\tlong\tddps_nosockspace;\t/* no space in sockbuf for packet */\n};\n\n#ifdef _KERNEL\nextern int\t\t\t ddp_cksum;\nextern struct ddpcb\t\t*ddpcb_list;\nextern struct pr_usrreqs\t ddp_usrreqs;\nextern struct mtx\t\t ddp_list_mtx;\n#endif\n\n#endif /* _NETATALK_DDP_VAR_H_ */\n"
  },
  {
    "path": "freebsd-headers/netatalk/endian.h",
    "content": "/*-\n * Copyright (c) 1990,1991 Regents of The University of Michigan.\n * All Rights Reserved.\n *\n * Permission to use, copy, modify, and distribute this software and\n * its documentation for any purpose and without fee is hereby granted,\n * provided that the above copyright notice appears in all copies and\n * that both that copyright notice and this permission notice appear\n * in supporting documentation, and that the name of The University\n * of Michigan not be used in advertising or publicity pertaining to\n * distribution of the software without specific, written prior\n * permission. This software is supplied as is without expressed or\n * implied warranties of any kind.\n *\n *\tResearch Systems Unix Group\n *\tThe University of Michigan\n *\tc/o Mike Clark\n *\t535 W. William Street\n *\tAnn Arbor, Michigan\n *\t+1-313-763-0525\n *\tnetatalk@itd.umich.edu\n *\n * $FreeBSD: release/9.0.0/sys/netatalk/endian.h 139827 2005-01-07 02:35:34Z imp $\n */\n\n#ifndef _ATALK_ENDIAN_H_\n#define _ATALK_ENDIAN_H_\n\n#include <machine/endian.h>\n\n#endif /* !_ATALK_ENDIAN_H_ */\n"
  },
  {
    "path": "freebsd-headers/netatalk/phase2.h",
    "content": "/*-\n * Copyright (c) 1990,1991 Regents of The University of Michigan.\n * All Rights Reserved.\n *\n * Permission to use, copy, modify, and distribute this software and\n * its documentation for any purpose and without fee is hereby granted,\n * provided that the above copyright notice appears in all copies and\n * that both that copyright notice and this permission notice appear\n * in supporting documentation, and that the name of The University\n * of Michigan not be used in advertising or publicity pertaining to\n * distribution of the software without specific, written prior\n * permission. This software is supplied as is without expressed or\n * implied warranties of any kind.\n *\n * This product includes software developed by the University of\n * California, Berkeley and its contributors.\n *\n *\tResearch Systems Unix Group\n *\tThe University of Michigan\n *\tc/o Wesley Craig\n *\t535 W. William Street\n *\tAnn Arbor, Michigan\n *\t+1-313-764-2278\n *\tnetatalk@umich.edu\n * $FreeBSD: release/9.0.0/sys/netatalk/phase2.h 139827 2005-01-07 02:35:34Z imp $\n */\n\n#include <net/if_llc.h>\n\n#define llc_org_code llc_un.type_snap.org_code\n#define llc_ether_type llc_un.type_snap.ether_type\n\n#define SIOCPHASE1\t_IOW('i', 100, struct ifreq)\t/* AppleTalk phase 1 */\n#define SIOCPHASE2\t_IOW('i', 101, struct ifreq)\t/* AppleTalk phase 2 */\n"
  },
  {
    "path": "freebsd-headers/netconfig.h",
    "content": "/*\t$NetBSD: netconfig.h,v 1.1 2000/06/02 22:57:54 fvdl Exp $\t*/\n/*\t$FreeBSD: release/9.0.0/include/netconfig.h 93032 2002-03-23 17:24:55Z imp $ */\n\n\n#ifndef _NETCONFIG_H_\n#define _NETCONFIG_H_\n\n#include <sys/cdefs.h>\n\n#define NETCONFIG\t\"/etc/netconfig\"\n#define NETPATH\t\t\"NETPATH\"\n\nstruct netconfig {\n\tchar *nc_netid;\t\t\t/* Network ID */\n\tunsigned long nc_semantics;\t/* Semantics (see below) */\n\tunsigned long nc_flag;\t\t/* Flags (see below) */\n\tchar *nc_protofmly;\t\t/* Protocol family */\n\tchar *nc_proto;\t\t\t/* Protocol name */\n\tchar *nc_device;\t\t/* Network device pathname */\n\tunsigned long nc_nlookups;\t/* Number of directory lookup libs */\n\tchar **nc_lookups;\t\t/* Names of the libraries */\n\tunsigned long nc_unused[9];\t/* reserved */\n};\n\ntypedef struct {\n\tstruct netconfig **nc_head;\n\tstruct netconfig **nc_curr;\n} NCONF_HANDLE;\n\n/*\n * nc_semantics values\n */\n#define NC_TPI_CLTS\t1\n#define NC_TPI_COTS\t2\n#define NC_TPI_COTS_ORD\t3\n#define NC_TPI_RAW\t4\n\n/*\n * nc_flag values\n */\n#define NC_NOFLAG\t0x00\n#define NC_VISIBLE\t0x01\n#define NC_BROADCAST\t0x02\n\n/*\n * nc_protofmly values\n */\n#define NC_NOPROTOFMLY\t\"-\"\n#define NC_LOOPBACK\t\"loopback\"\n#define NC_INET\t\t\"inet\"\n#define NC_INET6\t\"inet6\"\n#define NC_IMPLINK\t\"implink\"\n#define NC_PUP\t\t\"pup\"\n#define NC_CHAOS\t\"chaos\"\n#define NC_NS\t\t\"ns\"\n#define NC_NBS\t\t\"nbs\"\n#define NC_ECMA\t\t\"ecma\"\n#define NC_DATAKIT\t\"datakit\"\n#define NC_CCITT\t\"ccitt\"\n#define NC_SNA\t\t\"sna\"\n#define NC_DECNET\t\"decnet\"\n#define NC_DLI\t\t\"dli\"\n#define NC_LAT\t\t\"lat\"\n#define NC_HYLINK\t\"hylink\"\n#define NC_APPLETALK\t\"appletalk\"\n#define NC_NIT\t\t\"nit\"\n#define NC_IEEE802\t\"ieee802\"\n#define NC_OSI\t\t\"osi\"\n#define NC_X25\t\t\"x25\"\n#define NC_OSINET\t\"osinet\"\n#define NC_GOSIP\t\"gosip\"\n\n/*\n * nc_proto values\n */\n#define NC_NOPROTO\t\"-\"\n#define NC_TCP\t\t\"tcp\"\n#define NC_UDP\t\t\"udp\"\n#define NC_ICMP\t\t\"icmp\"\n\n__BEGIN_DECLS\nvoid *setnetconfig(void);\nstruct netconfig *getnetconfig(void *);\nstruct netconfig *getnetconfigent(const char *);\nvoid freenetconfigent(struct netconfig *);\nint endnetconfig(void *);\n\nvoid *setnetpath(void);\nstruct netconfig *getnetpath(void *);\nint endnetpath(void *);\n\nvoid nc_perror(const char *);\nchar *nc_sperror(void);\n__END_DECLS\n\n#endif /* _NETCONFIG_H_ */\n"
  },
  {
    "path": "freebsd-headers/netdb.h",
    "content": "/*-\n * Copyright (c) 1980, 1983, 1988, 1993\n *\tThe Regents of the University of California.  All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * -\n * Portions Copyright (c) 1993 by Digital Equipment Corporation.\n *\n * Permission to use, copy, modify, and distribute this software for any\n * purpose with or without fee is hereby granted, provided that the above\n * copyright notice and this permission notice appear in all copies, and that\n * the name of Digital Equipment Corporation not be used in advertising or\n * publicity pertaining to distribution of the document or software without\n * specific, written prior permission.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL\n * WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES\n * OF MERCHANTABILITY AND FITNESS.   IN NO EVENT SHALL DIGITAL EQUIPMENT\n * CORPORATION BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL\n * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR\n * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS\n * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS\n * SOFTWARE.\n * -\n * --Copyright--\n */\n\n/*\n *      @(#)netdb.h\t8.1 (Berkeley) 6/2/93\n *      From: Id: netdb.h,v 8.9 1996/11/19 08:39:29 vixie Exp $\n * $FreeBSD: release/9.0.0/include/netdb.h 206155 2010-04-04 08:31:03Z ume $\n */\n\n#ifndef _NETDB_H_\n#define _NETDB_H_\n\n#include <sys/cdefs.h>\n#include <sys/_types.h>\n\n#ifndef _SIZE_T_DECLARED\ntypedef\t__size_t\tsize_t;\n#define\t_SIZE_T_DECLARED\n#endif\n\n#ifndef _SOCKLEN_T_DECLARED\ntypedef\t__socklen_t\tsocklen_t;\n#define\t_SOCKLEN_T_DECLARED\n#endif\n\n#ifndef _UINT32_T_DECLARED\ntypedef\t__uint32_t\tuint32_t;\n#define\t_UINT32_T_DECLARED\n#endif\n\n#ifndef _PATH_HEQUIV\n# define\t_PATH_HEQUIV\t\"/etc/hosts.equiv\"\n#endif\n#define\t_PATH_HOSTS\t\"/etc/hosts\"\n#define\t_PATH_NETWORKS\t\"/etc/networks\"\n#define\t_PATH_PROTOCOLS\t\"/etc/protocols\"\n#define\t_PATH_SERVICES\t\"/etc/services\"\n#define\t_PATH_SERVICES_DB \"/var/db/services.db\"\n\n#define\th_errno (*__h_errno())\n\n/*\n * Structures returned by network data base library.  All addresses are\n * supplied in host order, and returned in network order (suitable for\n * use in system calls).\n */\nstruct hostent {\n\tchar\t*h_name;\t/* official name of host */\n\tchar\t**h_aliases;\t/* alias list */\n\tint\th_addrtype;\t/* host address type */\n\tint\th_length;\t/* length of address */\n\tchar\t**h_addr_list;\t/* list of addresses from name server */\n#define\th_addr\th_addr_list[0]\t/* address, for backward compatibility */\n};\n\nstruct netent {\n\tchar\t\t*n_name;\t/* official name of net */\n\tchar\t\t**n_aliases;\t/* alias list */\n\tint\t\tn_addrtype;\t/* net address type */\n\tuint32_t\tn_net;\t\t/* network # */\n};\n\nstruct servent {\n\tchar\t*s_name;\t/* official service name */\n\tchar\t**s_aliases;\t/* alias list */\n\tint\ts_port;\t\t/* port # */\n\tchar\t*s_proto;\t/* protocol to use */\n};\n\nstruct protoent {\n\tchar\t*p_name;\t/* official protocol name */\n\tchar\t**p_aliases;\t/* alias list */\n\tint\tp_proto;\t/* protocol # */\n};\n\nstruct addrinfo {\n\tint\tai_flags;\t/* AI_PASSIVE, AI_CANONNAME, AI_NUMERICHOST */\n\tint\tai_family;\t/* PF_xxx */\n\tint\tai_socktype;\t/* SOCK_xxx */\n\tint\tai_protocol;\t/* 0 or IPPROTO_xxx for IPv4 and IPv6 */\n\tsocklen_t ai_addrlen;\t/* length of ai_addr */\n\tchar\t*ai_canonname;\t/* canonical name for hostname */\n\tstruct\tsockaddr *ai_addr;\t/* binary address */\n\tstruct\taddrinfo *ai_next;\t/* next structure in linked list */\n};\n\n/*\n * Error return codes from gethostbyname() and gethostbyaddr()\n * (left in h_errno).\n */\n\n#define\tNETDB_INTERNAL\t-1\t/* see errno */\n#define\tNETDB_SUCCESS\t0\t/* no problem */\n#define\tHOST_NOT_FOUND\t1 /* Authoritative Answer Host not found */\n#define\tTRY_AGAIN\t2 /* Non-Authoritative Host not found, or SERVERFAIL */\n#define\tNO_RECOVERY\t3 /* Non recoverable errors, FORMERR, REFUSED, NOTIMP */\n#define\tNO_DATA\t\t4 /* Valid name, no data record of requested type */\n#define\tNO_ADDRESS\tNO_DATA\t\t/* no address, look for MX record */\n\n/*\n * Error return codes from getaddrinfo()\n */\n#if 0\n/* obsoleted */\n#define\tEAI_ADDRFAMILY\t 1\t/* address family for hostname not supported */\n#endif\n#define\tEAI_AGAIN\t 2\t/* temporary failure in name resolution */\n#define\tEAI_BADFLAGS\t 3\t/* invalid value for ai_flags */\n#define\tEAI_FAIL\t 4\t/* non-recoverable failure in name resolution */\n#define\tEAI_FAMILY\t 5\t/* ai_family not supported */\n#define\tEAI_MEMORY\t 6\t/* memory allocation failure */\n#if 0\n/* obsoleted */\n#define\tEAI_NODATA\t 7\t/* no address associated with hostname */\n#endif\n#define\tEAI_NONAME\t 8\t/* hostname nor servname provided, or not known */\n#define\tEAI_SERVICE\t 9\t/* servname not supported for ai_socktype */\n#define\tEAI_SOCKTYPE\t10\t/* ai_socktype not supported */\n#define\tEAI_SYSTEM\t11\t/* system error returned in errno */\n#define\tEAI_BADHINTS\t12\t/* invalid value for hints */\n#define\tEAI_PROTOCOL\t13\t/* resolved protocol is unknown */\n#define\tEAI_OVERFLOW\t14\t/* argument buffer overflow */\n#define\tEAI_MAX\t\t15\n\n/*\n * Flag values for getaddrinfo()\n */\n#define\tAI_PASSIVE\t0x00000001 /* get address to use bind() */\n#define\tAI_CANONNAME\t0x00000002 /* fill ai_canonname */\n#define\tAI_NUMERICHOST\t0x00000004 /* prevent host name resolution */\n#define\tAI_NUMERICSERV\t0x00000008 /* prevent service name resolution */\n/* valid flags for addrinfo (not a standard def, apps should not use it) */\n#define AI_MASK \\\n    (AI_PASSIVE | AI_CANONNAME | AI_NUMERICHOST | AI_NUMERICSERV | \\\n    AI_ADDRCONFIG)\n\n#define\tAI_ALL\t\t0x00000100 /* IPv6 and IPv4-mapped (with AI_V4MAPPED) */\n#define\tAI_V4MAPPED_CFG\t0x00000200 /* accept IPv4-mapped if kernel supports */\n#define\tAI_ADDRCONFIG\t0x00000400 /* only if any address is assigned */\n#define\tAI_V4MAPPED\t0x00000800 /* accept IPv4-mapped IPv6 address */\n/* special recommended flags for getipnodebyname */\n#define\tAI_DEFAULT\t(AI_V4MAPPED_CFG | AI_ADDRCONFIG)\n\n/*\n * Constants for getnameinfo()\n */\n#define\tNI_MAXHOST\t1025\n#define\tNI_MAXSERV\t32\n\n/*\n * Flag values for getnameinfo()\n */\n#define\tNI_NOFQDN\t0x00000001\n#define\tNI_NUMERICHOST\t0x00000002\n#define\tNI_NAMEREQD\t0x00000004\n#define\tNI_NUMERICSERV\t0x00000008\n#define\tNI_DGRAM\t0x00000010\n#if 0 /* obsolete */\n#define NI_WITHSCOPEID\t0x00000020\n#endif\n\n/*\n * Scope delimit character\n */\n#define\tSCOPE_DELIMITER\t'%'\n\n__BEGIN_DECLS\nvoid\t\tendhostent(void);\nvoid\t\tendnetent(void);\nvoid\t\tendprotoent(void);\nvoid\t\tendservent(void);\n#if __BSD_VISIBLE || (__POSIX_VISIBLE && __POSIX_VISIBLE <= 200112)\nstruct hostent\t*gethostbyaddr(const void *, socklen_t, int);\nstruct hostent\t*gethostbyname(const char *);\n#endif\nstruct hostent\t*gethostent(void);\nstruct netent\t*getnetbyaddr(uint32_t, int);\nstruct netent\t*getnetbyname(const char *);\nstruct netent\t*getnetent(void);\nstruct protoent\t*getprotobyname(const char *);\nstruct protoent\t*getprotobynumber(int);\nstruct protoent\t*getprotoent(void);\nstruct servent\t*getservbyname(const char *, const char *);\nstruct servent\t*getservbyport(int, const char *);\nstruct servent\t*getservent(void);\nvoid\t\tsethostent(int);\n/* void\t\tsethostfile(const char *); */\nvoid\t\tsetnetent(int);\nvoid\t\tsetprotoent(int);\nint\t\tgetaddrinfo(const char *, const char *,\n\t\t\t    const struct addrinfo *, struct addrinfo **);\nint\t\tgetnameinfo(const struct sockaddr *, socklen_t, char *,\n\t\t\t    size_t, char *, size_t, int);\nvoid\t\tfreeaddrinfo(struct addrinfo *);\nconst char\t*gai_strerror(int);\nvoid\t\tsetservent(int);\n\n#if __BSD_VISIBLE\nvoid\t\tendnetgrent(void);\nvoid\t\tfreehostent(struct hostent *);\nint\t\tgethostbyaddr_r(const void *, socklen_t, int, struct hostent *,\n    char *, size_t, struct hostent **, int *);\nint\t\tgethostbyname_r(const char *, struct hostent *, char *, size_t,\n    struct hostent **, int *);\nstruct hostent\t*gethostbyname2(const char *, int);\nint\t\tgethostbyname2_r(const char *, int, struct hostent *, char *,\n    size_t, struct hostent **, int *);\nint\t\tgethostent_r(struct hostent *, char *, size_t,\n    struct hostent **, int *);\nstruct hostent\t*getipnodebyaddr(const void *, size_t, int, int *);\nstruct hostent\t*getipnodebyname(const char *, int, int, int *);\nint\t\tgetnetbyaddr_r(uint32_t, int, struct netent *, char *, size_t,\n    struct netent**, int *);\nint\t\tgetnetbyname_r(const char *, struct netent *, char *, size_t,\n    struct netent **, int *);\nint\t\tgetnetent_r(struct netent *, char *, size_t, struct netent **,\n    int *);\nint\t\tgetnetgrent(char **, char **, char **);\nint\t\tgetprotobyname_r(const char *, struct protoent *, char *,\n    size_t, struct protoent **);\nint\t\tgetprotobynumber_r(int, struct protoent *, char *, size_t,\n    struct protoent **);\nint\t\tgetprotoent_r(struct protoent *, char *, size_t,\n    struct protoent **);\nint\t\tgetservbyname_r(const char *, const char *, struct servent *,\n    char *, size_t, struct servent **);\nint\t\tgetservbyport_r(int, const char *, struct servent *, char *,\n    size_t, struct servent **);\nint\t\tgetservent_r(struct servent *, char *, size_t,\n    struct servent **);\nvoid\t\therror(const char *);\n__const char\t*hstrerror(int);\nint\t\tinnetgr(const char *, const char *, const char *, const char *);\nvoid\t\tsetnetgrent(const char *);\n#endif\n\n\n/*\n * PRIVATE functions specific to the FreeBSD implementation\n */\n\n/* DO NOT USE THESE, THEY ARE SUBJECT TO CHANGE AND ARE NOT PORTABLE!!! */\nint\t* __h_errno(void);\n__END_DECLS\n\n#endif /* !_NETDB_H_ */\n"
  },
  {
    "path": "freebsd-headers/netgraph/atm/ng_atm.h",
    "content": "/*-\n * Copyright (c) 2001-2003\n *\tFraunhofer Institute for Open Communication Systems (FhG Fokus).\n * \tAll rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * Author: Harti Brandt <harti@freebsd.org>\n */\n\n/*\n * Netgraph module to connect NATM interfaces to netgraph.\n *\n * $FreeBSD: release/9.0.0/sys/netgraph/atm/ng_atm.h 139823 2005-01-07 01:45:51Z imp $\n */\n#ifndef _NETGRAPH_ATM_NG_ATM_H_\n#define _NETGRAPH_ATM_NG_ATM_H_\n\n#define NG_ATM_NODE_TYPE \"atm\"\n#define NGM_ATM_COOKIE\t960802260\n\n/* Netgraph control messages */\nenum {\n\tNGM_ATM_GET_IFNAME = 1,\t\t/* get the interface name */\n\tNGM_ATM_GET_CONFIG,\t\t/* get configuration */\n\tNGM_ATM_GET_VCCS,\t\t/* get a list of all active vccs */\n\tNGM_ATM_CPCS_INIT,\t\t/* start the channel */\n\tNGM_ATM_CPCS_TERM,\t\t/* stop the channel */\n\tNGM_ATM_GET_VCC,\t\t/* get VCC config */\n\tNGM_ATM_GET_VCCID,\t\t/* get VCC by VCI/VPI */\n\tNGM_ATM_GET_STATS,\t\t/* get global statistics */\n\n\t/* messages from the node */\n\tNGM_ATM_CARRIER_CHANGE = 1000,\t/* UNUSED: carrier changed */\n\tNGM_ATM_VCC_CHANGE,\t\t/* permanent VCC changed */\n\tNGM_ATM_ACR_CHANGE,\t\t/* ABR ACR has changed */\n\tNGM_ATM_IF_CHANGE,\t\t/* interface state change */\n};\n\n/*\n * Hardware interface configuration\n */\nstruct ngm_atm_config {\n\tuint32_t\tpcr;\t\t/* peak cell rate */\n\tuint32_t\tvpi_bits;\t/* number of active VPI bits */\n\tuint32_t\tvci_bits;\t/* number of active VCI bits */\n\tuint32_t\tmax_vpcs;\t/* maximum number of VPCs */\n\tuint32_t\tmax_vccs;\t/* maximum number of VCCs */\n};\n#define NGM_ATM_CONFIG_INFO \t\t\t\t\t\\\n\t{\t\t\t\t\t\t\t\\\n\t  { \"pcr\",\t&ng_parse_uint32_type },\t\t\\\n\t  { \"vpi_bits\",\t&ng_parse_uint32_type },\t\t\\\n\t  { \"vci_bits\",\t&ng_parse_uint32_type },\t\t\\\n\t  { \"max_vpcs\",\t&ng_parse_uint32_type },\t\t\\\n\t  { \"max_vccs\",\t&ng_parse_uint32_type },\t\t\\\n\t  { NULL }\t\t\t\t\t\t\\\n\t}\n\n/*\n * Information about an open VCC\n * See net/if_atm.h. Keep in sync.\n */\n#define NGM_ATM_TPARAM_INFO \t\t\t\t\t\\\n\t{\t\t\t\t\t\t\t\\\n\t  { \"pcr\",\t&ng_parse_uint32_type },\t\t\\\n\t  { \"scr\",\t&ng_parse_uint32_type },\t\t\\\n\t  { \"mbs\",\t&ng_parse_uint32_type },\t\t\\\n\t  { \"mcr\",\t&ng_parse_uint32_type },\t\t\\\n\t  { \"icr\",\t&ng_parse_uint32_type },\t\t\\\n\t  { \"tbe\",\t&ng_parse_uint32_type },\t\t\\\n\t  { \"nrm\",\t&ng_parse_uint8_type },\t\t\t\\\n\t  { \"trm\",\t&ng_parse_uint8_type },\t\t\t\\\n\t  { \"adtf\",\t&ng_parse_uint16_type },\t\t\\\n\t  { \"rif\",\t&ng_parse_uint8_type },\t\t\t\\\n\t  { \"rdf\",\t&ng_parse_uint8_type },\t\t\t\\\n\t  { \"cdf\",\t&ng_parse_uint8_type },\t\t\t\\\n\t  { NULL }\t\t\t\t\t\t\\\n\t}\n\n#define NGM_ATM_VCC_INFO \t\t\t\t\t\\\n\t{\t\t\t\t\t\t\t\\\n\t  { \"flags\",\t&ng_parse_hint16_type },\t\t\\\n\t  { \"vpi\",\t&ng_parse_uint16_type },\t\t\\\n\t  { \"vci\",\t&ng_parse_uint16_type },\t\t\\\n\t  { \"rmtu\",\t&ng_parse_uint16_type },\t\t\\\n\t  { \"tmtu\",\t&ng_parse_uint16_type },\t\t\\\n\t  { \"aal\",\t&ng_parse_uint8_type },\t\t\t\\\n\t  { \"traffic\",\t&ng_parse_uint8_type },\t\t\t\\\n\t  { \"tparam\",\t&ng_atm_tparam_type },\t\t\t\\\n\t  { NULL }\t\t\t\t\t\t\\\n\t}\n\n#define NGM_ATM_VCCARRAY_INFO\t\t\t\t\t\\\n\t{\t\t\t\t\t\t\t\\\n\t  &ng_atm_vcc_type,\t\t\t\t\t\\\n\t  ng_atm_vccarray_getlen,\t\t\t\t\\\n\t  NULL\t\t\t\t\t\t\t\\\n\t}\n\n#define NGM_ATM_VCCTABLE_INFO \t\t\t\t\t\\\n\t{\t\t\t\t\t\t\t\\\n\t  { \"count\",\t&ng_parse_uint32_type },\t\t\\\n\t  { \"vccs\",\t&ng_atm_vccarray_type },\t\t\\\n\t  { NULL }\t\t\t\t\t\t\\\n\t}\n\n/*\n * Structure to open a VCC.\n */\nstruct ngm_atm_cpcs_init {\n\tchar\t\tname[NG_HOOKSIZ];\n\tuint32_t\tflags;\t\t/* flags. (if_atm.h) */\n\tuint16_t\tvci;\t\t/* VCI to open */\n\tuint16_t\tvpi;\t\t/* VPI to open */\n\tuint16_t\trmtu;\t\t/* Receive maximum CPCS size */\n\tuint16_t\ttmtu;\t\t/* Transmit maximum CPCS size */\n\tuint8_t\t\taal;\t\t/* AAL type (if_atm.h) */\n\tuint8_t\t\ttraffic;\t/* traffic type (if_atm.h) */\n\tuint32_t\tpcr;\t\t/* Peak cell rate */\n\tuint32_t\tscr;\t\t/* VBR: Sustainable cell rate */\n\tuint32_t\tmbs;\t\t/* VBR: Maximum burst rate */\n\tuint32_t\tmcr;\t\t/* UBR+: Minimum cell rate */\n\tuint32_t\ticr;\t\t/* ABR: Initial cell rate */\n\tuint32_t\ttbe;\t\t/* ABR: Transmit buffer exposure */\n\tuint8_t\t\tnrm;\t\t/* ABR: Nrm */\n\tuint8_t\t\ttrm;\t\t/* ABR: Trm */\n\tuint16_t\tadtf;\t\t/* ABR: ADTF */\n\tuint8_t\t\trif;\t\t/* ABR: RIF */\n\tuint8_t\t\trdf;\t\t/* ABR: RDF */\n\tuint8_t\t\tcdf;\t\t/* ABR: CDF */\n};\n\n#define NGM_ATM_CPCS_INIT_INFO \t\t\t\t\t\\\n\t{\t\t\t\t\t\t\t\\\n\t  { \"name\",\t&ng_parse_hookbuf_type },\t\t\\\n\t  { \"flags\",\t&ng_parse_hint32_type },\t\t\\\n\t  { \"vci\",\t&ng_parse_uint16_type },\t\t\\\n\t  { \"vpi\",\t&ng_parse_uint16_type },\t\t\\\n\t  { \"rmtu\",\t&ng_parse_uint16_type },\t\t\\\n\t  { \"tmtu\",\t&ng_parse_uint16_type },\t\t\\\n\t  { \"aal\",\t&ng_parse_uint8_type },\t\t\t\\\n\t  { \"traffic\",\t&ng_parse_uint8_type },\t\t\t\\\n\t  { \"pcr\",\t&ng_parse_uint32_type },\t\t\\\n\t  { \"scr\",\t&ng_parse_uint32_type },\t\t\\\n\t  { \"mbs\",\t&ng_parse_uint32_type },\t\t\\\n\t  { \"mcr\",\t&ng_parse_uint32_type },\t\t\\\n\t  { \"icr\",\t&ng_parse_uint32_type },\t\t\\\n\t  { \"tbe\",\t&ng_parse_uint32_type },\t\t\\\n\t  { \"nrm\",\t&ng_parse_uint8_type },\t\t\t\\\n\t  { \"trm\",\t&ng_parse_uint8_type },\t\t\t\\\n\t  { \"adtf\",\t&ng_parse_uint16_type },\t\t\\\n\t  { \"rif\",\t&ng_parse_uint8_type },\t\t\t\\\n\t  { \"rdf\",\t&ng_parse_uint8_type },\t\t\t\\\n\t  { \"cdf\",\t&ng_parse_uint8_type },\t\t\t\\\n\t  { NULL }\t\t\t\t\t\t\\\n\t}\n\n/*\n * Structure to close a VCI without disconnecting the hook\n */\nstruct ngm_atm_cpcs_term {\n\tchar\t\tname[NG_HOOKSIZ];\n};\n#define NGM_ATM_CPCS_TERM_INFO \t\t\t\t\t\\\n\t{\t\t\t\t\t\t\t\\\n\t  { \"name\",\t&ng_parse_hookbuf_type },\t\t\\\n\t  { NULL }\t\t\t\t\t\t\\\n\t}\n\nstruct ngm_atm_stats {\n\tuint64_t\tin_packets;\n\tuint64_t\tin_errors;\n\tuint64_t\tout_packets;\n\tuint64_t\tout_errors;\n};\n#define NGM_ATM_STATS_INFO\t\t\t\t\t\\\n\t{\t\t\t\t\t\t\t\\\n\t  { \"in_packets\",\t&ng_parse_uint64_type },\t\\\n\t  { \"in_errors\",\t&ng_parse_uint64_type },\t\\\n\t  { \"out_packets\",\t&ng_parse_uint64_type },\t\\\n\t  { \"out_errors\",\t&ng_parse_uint64_type },\t\\\n\t  { NULL }\t\t\t\t\t\t\\\n\t}\n\nstruct ngm_atm_if_change {\n\tuint32_t\tnode;\n\tuint8_t\t\tcarrier;\n\tuint8_t\t\trunning;\n};\n#define NGM_ATM_IF_CHANGE_INFO \t\t\t\t\t\\\n\t{\t\t\t\t\t\t\t\\\n\t  { \"node\",\t&ng_parse_hint32_type },\t\t\\\n\t  { \"carrier\",\t&ng_parse_uint8_type },\t\t\t\\\n\t  { \"running\",\t&ng_parse_uint8_type },\t\t\t\\\n\t  { NULL }\t\t\t\t\t\t\\\n\t}\n\nstruct ngm_atm_vcc_change {\n\tuint32_t\tnode;\n\tuint16_t\tvci;\n\tuint8_t\t\tvpi;\n\tuint8_t\t\tstate;\n};\n#define NGM_ATM_VCC_CHANGE_INFO \t\t\t\t\\\n\t{\t\t\t\t\t\t\t\\\n\t  { \"node\",\t&ng_parse_hint32_type },\t\t\\\n\t  { \"vci\",\t&ng_parse_uint16_type },\t\t\\\n\t  { \"vpi\",\t&ng_parse_uint8_type },\t\t\t\\\n\t  { \"state\",\t&ng_parse_uint8_type },\t\t\t\\\n\t  { NULL }\t\t\t\t\t\t\\\n\t}\n\nstruct ngm_atm_acr_change {\n\tuint32_t\tnode;\n\tuint16_t\tvci;\n\tuint8_t\t\tvpi;\n\tuint32_t\tacr;\n};\n#define NGM_ATM_ACR_CHANGE_INFO\t\t\t\t\t\\\n\t{\t\t\t\t\t\t\t\\\n\t  { \"node\",\t&ng_parse_hint32_type },\t\t\\\n\t  { \"vci\",\t&ng_parse_uint16_type },\t\t\\\n\t  { \"vpi\",\t&ng_parse_uint8_type },\t\t\t\\\n\t  { \"acr\",\t&ng_parse_uint32_type },\t\t\\\n\t  { NULL }\t\t\t\t\t\t\\\n\t}\n\n#endif /* _NETGRAPH_ATM_NG_ATM_H */\n"
  },
  {
    "path": "freebsd-headers/netgraph/atm/ng_ccatm.h",
    "content": "/*-\n * Copyright (c) 2001-2002\n *\tFraunhofer Institute for Open Communication Systems (FhG Fokus).\n *\tAll rights reserved.\n * Copyright (c) 2003-2004\n *\tHartmut Brandt\n *\tAll rights reserved.\n *\n * Author: Harti Brandt <harti@freebsd.org>\n *\n * Redistribution of this software and documentation and use in source and\n * binary forms, with or without modification, are permitted provided that\n * the following conditions are met:\n *\n * 1. Redistributions of source code or documentation must retain the above\n *    copyright notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/netgraph/atm/ng_ccatm.h 189315 2009-03-03 18:47:33Z ed $\n */\n\n/*\n * Interface to ng_ccatm\n */\n#ifndef _NETGRAPH_ATM_NG_CCATM_H_\n#define _NETGRAPH_ATM_NG_CCATM_H_\n\n#define NG_CCATM_NODE_TYPE\t\"ccatm\"\n#define NGM_CCATM_COOKIE\t984046139\n\nenum {\n\tNGM_CCATM_DUMP,\t\t\t/* dump internal status */\n\tNGM_CCATM_STOP,\t\t\t/* stop all processing, close all */\n\tNGM_CCATM_START,\t\t/* start processing */\n\tNGM_CCATM_CLEAR,\t\t/* clear prefix/address table */\n\tNGM_CCATM_GET_ADDRESSES,\t/* get list of all addresses */\n\tNGM_CCATM_ADDRESS_REGISTERED,\t/* registration ok */\n\tNGM_CCATM_ADDRESS_UNREGISTERED,\t/* unregistration ok */\n\tNGM_CCATM_SET_PORT_PARAM,\t/* set port parameters */\n\tNGM_CCATM_GET_PORT_PARAM,\t/* get port parameters */\n\tNGM_CCATM_GET_PORTLIST,\t\t/* get list of port numbers */\n\tNGM_CCATM_GETSTATE,\t\t/* get port status */\n\tNGM_CCATM_SETLOG,\t\t/* set/get loglevel */\n\tNGM_CCATM_RESET,\t\t/* reset everything */\n\tNGM_CCATM_GET_EXSTAT,\t\t/* get extended status */\n};\n\n/*\n * This must be synchronized with unistruct.h::struct uni_addr\n */\n#define\tNGM_CCATM_ADDR_ARRAY_INFO\t\t\t\t\\\n\t{\t\t\t\t\t\t\t\\\n\t  &ng_parse_hint8_type,\t\t\t\t\t\\\n\t  UNI_ADDR_MAXLEN\t\t\t\t\t\\\n\t}\n\n#define NGM_CCATM_UNI_ADDR_INFO \t\t\t\t\\\n \t{\t\t\t\t\t\t\t\\\n\t  { \"type\",\t&ng_parse_uint32_type },\t\t\\\n\t  { \"plan\",\t&ng_parse_uint32_type },\t\t\\\n\t  { \"len\",\t&ng_parse_uint32_type },\t\t\\\n\t  { \"addr\",\t&ng_ccatm_addr_array_type },\t\t\\\n\t  { NULL }\t\t\t\t\t\t\\\n\t}\n\n/*\n * Address request\n */\nstruct ngm_ccatm_addr_req {\n\tuint32_t\tport;\n\tstruct uni_addr\taddr;\n};\n#define\tNGM_CCATM_ADDR_REQ_INFO\t\t\t\t\t\\\n\t{\t\t\t\t\t\t\t\\\n\t  { \"port\",\t&ng_parse_uint32_type },\t\t\\\n\t  { \"addr\",\t&ng_ccatm_uni_addr_type },\t\t\\\n\t  { NULL },\t\t\t\t\t\t\\\n\t}\n\n/*\n * Get current address list\n */\nstruct ngm_ccatm_get_addresses {\n\tuint32_t\tcount;\n\tstruct ngm_ccatm_addr_req addr[];\n};\n#define\tNGM_CCATM_ADDR_REQ_ARRAY_INFO\t\t\t\t\\\n\t{\t\t\t\t\t\t\t\\\n\t  &ng_ccatm_addr_req_type,\t\t\t\t\\\n\t  ng_ccatm_addr_req_array_getlen\t\t\t\\\n\t}\n#define NGM_CCATM_GET_ADDRESSES_INFO \t\t\t\t\\\n\t{\t\t\t\t\t\t\t\\\n\t  { \"count\",\t&ng_parse_uint32_type },\t\t\\\n\t  { \"addr\",\t&ng_ccatm_addr_req_array_type },\t\\\n\t  { NULL }\t\t\t\t\t\t\\\n\t}\n\n/*\n * Port as parameter\n */\nstruct ngm_ccatm_port {\n\tuint32_t\tport;\n};\n#define NGM_CCATM_PORT_INFO \t\t\t\t\t\\\n\t{\t\t\t\t\t\t\t\\\n\t  { \"port\",\t&ng_parse_uint32_type },\t\t\\\n\t  { NULL }\t\t\t\t\t\t\\\n\t}\n\n/*\n * Port parameters.\n * This must be synchronized with atmapi.h::struct atm_port_info.\n */\n#define\tNGM_CCATM_ESI_INFO\t\t\t\t\t\t\\\n\t{\t\t\t\t\t\t\t\t\\\n\t  &ng_parse_hint8_type,\t\t\t\t\t\t\\\n\t  6\t\t\t\t\t\t\t\t\\\n\t}\n#define NGM_CCATM_ATM_PORT_INFO \t\t\t\t\t\\\n\t{\t\t\t\t\t\t\t\t\\\n\t  { \"port\",\t\t&ng_parse_uint32_type },\t\t\\\n\t  { \"pcr\",\t\t&ng_parse_uint32_type },\t\t\\\n\t  { \"max_vpi_bits\",\t&ng_parse_uint32_type },\t\t\\\n\t  { \"max_vci_bits\",\t&ng_parse_uint32_type },\t\t\\\n\t  { \"max_svpc_vpi\",\t&ng_parse_uint32_type },\t\t\\\n\t  { \"max_svcc_vpi\",\t&ng_parse_uint32_type },\t\t\\\n\t  { \"min_svcc_vci\",\t&ng_parse_uint32_type },\t\t\\\n\t  { \"esi\",\t\t&ng_ccatm_esi_type },\t\t\t\\\n\t  { \"num_addr\",\t\t&ng_parse_uint32_type },\t\t\\\n\t  { NULL }\t\t\t\t\t\t\t\\\n\t}\n\n/*\n * List of port numbers\n */\nstruct ngm_ccatm_portlist {\n\tuint32_t\tnports;\n\tuint32_t\tports[];\n};\n#define\tNGM_CCATM_PORT_ARRAY_INFO\t\t\t\t\t\\\n\t{\t\t\t\t\t\t\t\t\\\n\t  &ng_parse_uint32_type,\t\t\t\t\t\\\n\t  ng_ccatm_port_array_getlen\t\t\t\t\t\\\n\t}\n#define NGM_CCATM_PORTLIST_INFO \t\t\t\t\t\\\n\t{\t\t\t\t\t\t\t\t\\\n\t  { \"nports\",\t&ng_parse_uint32_type },\t\t\t\\\n\t  { \"ports\",\t&ng_ccatm_port_array_type },\t\t\t\\\n\t  { NULL }\t\t\t\t\t\t\t\\\n\t}\n\nstruct ccatm_op {\n\tuint32_t\top;\t/* request code */\n};\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/netgraph/atm/ng_sscfu.h",
    "content": "/*-\n * Copyright (c) 2001-2003\n *\tFraunhofer Institute for Open Communication Systems (FhG Fokus).\n * \tAll rights reserved.\n *\n * Author: Harti Brandt <harti@freebsd.org>\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/netgraph/atm/ng_sscfu.h 139823 2005-01-07 01:45:51Z imp $\n *\n * Netgraph module for ITU-T Q.2120 UNI SSCF.\n */\n#ifndef _NETGRAPH_ATM_NG_SSCFU_H_\n#define\t_NETGRAPH_ATM_NG_SSCFU_H_\n\n#define NG_SSCFU_NODE_TYPE \"sscfu\"\n#define NGM_SSCFU_COOKIE\t980517963\n\n/* Netgraph control messages */\nenum {\n\tNGM_SSCFU_GETDEFPARAM = 1,\t/* get default SSCOP parameters */\n\tNGM_SSCFU_ENABLE,\t\t/* enable processing */\n\tNGM_SSCFU_DISABLE,\t\t/* disable processing */\n\tNGM_SSCFU_GETDEBUG,\t\t/* get debug flags */\n\tNGM_SSCFU_SETDEBUG,\t\t/* set debug flags */\n\tNGM_SSCFU_GETSTATE,\t\t/* get current state */\n};\n\n/* getdefparam return */\nstruct ng_sscfu_getdefparam {\n\tstruct sscop_param\tparam;\n\tuint32_t\t\tmask;\n};\n#define NG_SSCFU_GETDEFPARAM_INFO \t\t\t\t\\\n\t{\t\t\t\t\t\t\t\\\n\t  { \"param\",\t\t&ng_sscop_param_type },\t\t\\\n\t  { \"mask\",\t\t&ng_parse_uint32_type },\t\\\n\t  { NULL }\t\t\t\t\t\t\\\n\t}\n\n/*\n * Upper interface\n */\nstruct sscfu_arg {\n\tuint32_t\tsig;\n\tu_char\t\tdata[];\n};\n#endif\n"
  },
  {
    "path": "freebsd-headers/netgraph/atm/ng_sscop.h",
    "content": "/*-\n * Copyright (c) 2001-2003\n *\tFraunhofer Institute for Open Communication Systems (FhG Fokus).\n * \tAll rights reserved.\n *\n * Author: Harti Brandt <harti@freebsd.org>\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/netgraph/atm/ng_sscop.h 139823 2005-01-07 01:45:51Z imp $\n *\n * Netgraph module for Q.2110 SSCOP\n */\n#ifndef _NETGRAPH_ATM_NG_SSCOP_H_\n#define _NETGRAPH_ATM_NG_SSCOP_H_\n\n#define NG_SSCOP_NODE_TYPE \"sscop\"\n#define NGM_SSCOP_COOKIE\t980175044\n\n/* Netgraph control messages */\nenum {\n\tNGM_SSCOP_GETPARAM = 1,\t\t/* get parameters */\n\tNGM_SSCOP_SETPARAM,\t\t/* set parameters */\n\tNGM_SSCOP_ENABLE,\t\t/* enable processing */\n\tNGM_SSCOP_DISABLE,\t\t/* disable and reset */\n\tNGM_SSCOP_GETDEBUG,\t\t/* get debugging flags */\n\tNGM_SSCOP_SETDEBUG,\t\t/* set debugging flags */\n\tNGM_SSCOP_GETSTATE,\t\t/* get current SSCOP state */\n};\n\n/* This must be in-sync with the definition in sscopdef.h */\n#define NG_SSCOP_PARAM_INFO \t\t\t\t\t\\\n\t{\t\t\t\t\t\t\t\\\n\t  { \"timer_cc\",\t\t&ng_parse_uint32_type },\t\\\n\t  { \"timer_poll\",\t&ng_parse_uint32_type },\t\\\n\t  { \"timer_keep_alive\",\t&ng_parse_uint32_type },\t\\\n\t  { \"timer_no_response\",&ng_parse_uint32_type },\t\\\n\t  { \"timer_idle\",\t&ng_parse_uint32_type },\t\\\n\t  { \"maxk\",\t\t&ng_parse_uint32_type },\t\\\n\t  { \"maxj\",\t\t&ng_parse_uint32_type },\t\\\n\t  { \"maxcc\",\t\t&ng_parse_uint32_type },\t\\\n\t  { \"maxpd\",\t\t&ng_parse_uint32_type },\t\\\n\t  { \"maxstat\",\t\t&ng_parse_uint32_type },\t\\\n\t  { \"mr\",\t\t&ng_parse_uint32_type },\t\\\n\t  { \"flags\",\t\t&ng_parse_uint32_type },\t\\\n\t  { NULL }\t\t\t\t\t\t\\\n\t}\n\n\nstruct ng_sscop_setparam {\n\tuint32_t\t\tmask;\n\tstruct sscop_param\tparam;\n};\n#define NG_SSCOP_SETPARAM_INFO \t\t\t\t\t\\\n\t{\t\t\t\t\t\t\t\\\n\t  { \"mask\",\t\t&ng_parse_uint32_type },\t\\\n\t  { \"param\",\t\t&ng_sscop_param_type },\t\t\\\n\t  { NULL }\t\t\t\t\t\t\\\n\t}\n\nstruct ng_sscop_setparam_resp {\n\tuint32_t\t\tmask;\n\tint32_t\t\t\terror;\n};\n#define NG_SSCOP_SETPARAM_RESP_INFO \t\t\t\t\\\n\t{\t\t\t\t\t\t\t\\\n\t  { \"mask\",\t\t&ng_parse_uint32_type },\t\\\n\t  { \"error\",\t\t&ng_parse_int32_type },\t\t\\\n\t  { NULL }\t\t\t\t\t\t\\\n\t}\n\n/*\n * Upper interface\n */\nstruct sscop_arg {\n\tuint32_t\tsig;\n\tuint32_t\targ;\t/* opt. sequence number or clear-buff */\n\tu_char\t\tdata[];\n};\n\nstruct sscop_marg {\n\tuint32_t\tsig;\n\tu_char\t\tdata[];\n};\nstruct sscop_merr {\n\tuint32_t\tsig;\n\tuint32_t\terr;\t/* error code */\n\tuint32_t\tcnt;\t/* error count */\n};\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/netgraph/atm/ng_uni.h",
    "content": "/*-\n * Copyright (c) 2001-2003\n *\tFraunhofer Institute for Open Communication Systems (FhG Fokus).\n * \tAll rights reserved.\n *\n * Author: Hartmut Brandt <harti@freebsd.org>\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/netgraph/atm/ng_uni.h 139823 2005-01-07 01:45:51Z imp $\n *\n * Netgraph module for UNI 4.0\n */\n#ifndef _NETGRAPH_ATM_NG_UNI_H_\n#define _NETGRAPH_ATM_NG_UNI_H_\n\n#define NG_UNI_NODE_TYPE \"uni\"\n#define NGM_UNI_COOKIE\t981112392\n\nenum {\n\tNGM_UNI_GETDEBUG,\t/* get debug flags */\n\tNGM_UNI_SETDEBUG,\t/* set debug flags */\n\tNGM_UNI_GET_CONFIG,\t/* get configuration */\n\tNGM_UNI_SET_CONFIG,\t/* set configuration */\n\tNGM_UNI_ENABLE,\t\t/* enable processing */\n\tNGM_UNI_DISABLE,\t/* free resources and disable */\n\tNGM_UNI_GETSTATE,\t/* retrieve coord state */\n};\n\nstruct ngm_uni_debug {\n\tuint32_t\tlevel[UNI_MAXFACILITY];\n};\n#define NGM_UNI_DEBUGLEVEL_INFO {\t\t\t\t\\\n\t&ng_parse_uint32_type,\t\t\t\t\t\\\n\tUNI_MAXFACILITY\t\t\t\t\t\t\\\n}\n#define NGM_UNI_DEBUG_INFO \t\t\t\t\t\\\n\t{\t\t\t\t\t\t\t\\\n\t  { \"level\",\t&ng_uni_debuglevel_type },\t\t\\\n\t  { NULL }\t\t\t\t\t\t\\\n\t}\n\n#define NGM_UNI_CONFIG_INFO \t\t\t\t\t\\\n\t{\t\t\t\t\t\t\t\\\n\t  { \"proto\",\t&ng_parse_uint32_type },\t\t\\\n\t  { \"popt\",\t&ng_parse_uint32_type },\t\t\\\n\t  { \"option\",\t&ng_parse_uint32_type },\t\t\\\n\t  { \"timer301\",\t&ng_parse_uint32_type },\t\t\\\n\t  { \"timer303\",\t&ng_parse_uint32_type },\t\t\\\n\t  { \"init303\",\t&ng_parse_uint32_type },\t\t\\\n\t  { \"timer308\",\t&ng_parse_uint32_type },\t\t\\\n\t  { \"init308\",\t&ng_parse_uint32_type },\t\t\\\n\t  { \"timer309\",\t&ng_parse_uint32_type },\t\t\\\n\t  { \"timer310\",\t&ng_parse_uint32_type },\t\t\\\n\t  { \"timer313\",\t&ng_parse_uint32_type },\t\t\\\n\t  { \"timer316\",\t&ng_parse_uint32_type },\t\t\\\n\t  { \"init316\",\t&ng_parse_uint32_type },\t\t\\\n\t  { \"timer317\",\t&ng_parse_uint32_type },\t\t\\\n\t  { \"timer322\",\t&ng_parse_uint32_type },\t\t\\\n\t  { \"init322\",\t&ng_parse_uint32_type },\t\t\\\n\t  { \"timer397\",\t&ng_parse_uint32_type },\t\t\\\n\t  { \"timer398\",\t&ng_parse_uint32_type },\t\t\\\n\t  { \"timer399\",\t&ng_parse_uint32_type },\t\t\\\n\t  { NULL }\t\t\t\t\t\t\\\n\t}\n\nstruct ngm_uni_config_mask {\n\tuint32_t\t\tmask;\n\tuint32_t\t\tpopt_mask;\n\tuint32_t\t\toption_mask;\n};\n#define NGM_UNI_CONFIG_MASK_INFO \t\t\t\t\\\n\t{\t\t\t\t\t\t\t\\\n\t  { \"mask\",\t\t&ng_parse_hint32_type },\t\\\n\t  { \"popt_mask\",\t&ng_parse_hint32_type },\t\\\n\t  { \"option_mask\",\t&ng_parse_hint32_type },\t\\\n\t  { NULL }\t\t\t\t\t\t\\\n\t}\n\nstruct ngm_uni_set_config {\n\tstruct uni_config\t\tconfig;\n\tstruct ngm_uni_config_mask\tmask;\n};\n#define NGM_UNI_SET_CONFIG_INFO \t\t\t\t\\\n\t{\t\t\t\t\t\t\t\\\n\t  { \"config\",\t\t&ng_uni_config_type },\t\t\\\n\t  { \"mask\",\t\t&ng_uni_config_mask_type },\t\\\n\t  { NULL }\t\t\t\t\t\t\\\n\t}\n\n/*\n * API message\n */\nstruct uni_arg {\n\tuint32_t\tsig;\n\tuint32_t\tcookie;\n\tu_char\t\tdata[];\n};\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/netgraph/atm/ngatmbase.h",
    "content": "/*-\n * Copyright (c) 2001-2003\n *\tFraunhofer Institute for Open Communication Systems (FhG Fokus).\n *\tAll rights reserved.\n *\n * Author: Harti Brandt <harti@freebsd.org>\n *\n * Redistribution of this software and documentation and use in source and\n * binary forms, with or without modification, are permitted provided that\n * the following conditions are met:\n *\n * 1. Redistributions of source code or documentation must retain the above\n *    copyright notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE AND DOCUMENTATION IS PROVIDED BY FRAUNHOFER FOKUS\n * AND ITS CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,\n * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND\n * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL\n * FRAUNHOFER FOKUS OR ITS CONTRIBUTORS  BE LIABLE FOR ANY DIRECT, INDIRECT,\n * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,\n * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF\n * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING\n * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,\n * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/netgraph/atm/ngatmbase.h 139823 2005-01-07 01:45:51Z imp $\n *\n * In-kernel UNI stack message functions.\n */\n#ifndef _NETGRAPH_ATM_NGATMBASE_H_\n#define\t_NETGRAPH_ATM_NGATMBASE_H_\n\n/* forward declarations */\nstruct mbuf;\nstruct uni_msg;\n\nstruct mbuf *uni_msg_pack_mbuf(struct uni_msg *, void *, size_t);\n\n#ifdef NGATM_DEBUG\n\nstruct uni_msg *_uni_msg_alloc(size_t, const char *, int);\nstruct uni_msg *_uni_msg_build(const char *, int, void *, ...);\nvoid _uni_msg_destroy(struct uni_msg *, const char *, int);\nint _uni_msg_unpack_mbuf(struct mbuf *, struct uni_msg **, const char *, int);\n\n#define\tuni_msg_alloc(S) _uni_msg_alloc((S), __FILE__, __LINE__)\n#define\tuni_msg_build(P...) _uni_msg_build(__FILE__, __LINE__, P)\n#define\tuni_msg_destroy(M) _uni_msg_destroy((M), __FILE__, __LINE__)\n#define\tuni_msg_unpack_mbuf(M, PP) \\\n\t    _uni_msg_unpack_mbuf((M), (PP), __FILE__, __LINE__)\n\n#else /* !NGATM_DEBUG */\n\nstruct uni_msg *uni_msg_alloc(size_t);\nstruct uni_msg *uni_msg_build(void *, ...);\nvoid uni_msg_destroy(struct uni_msg *);\nint uni_msg_unpack_mbuf(struct mbuf *, struct uni_msg **);\n\n#endif\n#endif\n"
  },
  {
    "path": "freebsd-headers/netgraph/bluetooth/include/ng_bluetooth.h",
    "content": "/*\n * bluetooth.h\n */\n\n/*-\n * Copyright (c) 2001-2002 Maksim Yevmenkin <m_evmenkin@yahoo.com>\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $Id: ng_bluetooth.h,v 1.4 2003/04/26 22:32:34 max Exp $\n * $FreeBSD: release/9.0.0/sys/netgraph/bluetooth/include/ng_bluetooth.h 180399 2008-07-10 00:15:29Z emax $\n */\n\n#ifndef _NETGRAPH_BLUETOOTH_H_\n#define _NETGRAPH_BLUETOOTH_H_\n\n#include <sys/queue.h>\n\n/*\n * Version of the stack\n */\n\n#define NG_BLUETOOTH_VERSION\t1\n\n/*\n * Declare the base of the Bluetooth sysctl hierarchy, \n * but only if this file cares about sysctl's\n */\n\n#ifdef SYSCTL_DECL\nSYSCTL_DECL(_net_bluetooth);\nSYSCTL_DECL(_net_bluetooth_hci);\nSYSCTL_DECL(_net_bluetooth_l2cap);\nSYSCTL_DECL(_net_bluetooth_rfcomm);\nSYSCTL_DECL(_net_bluetooth_sco);\n#endif /* SYSCTL_DECL */\n\n/*\n * Mbuf qeueue and useful mbufq macros. We do not use ifqueue because we\n * do not need mutex and other locking stuff\n */\n\nstruct mbuf;\n\nstruct ng_bt_mbufq {\n\tstruct mbuf\t*head;   /* first item in the queue */\n\tstruct mbuf\t*tail;   /* last item in the queue */\n\tu_int32_t\t len;    /* number of items in the queue */\n\tu_int32_t\t maxlen; /* maximal number of items in the queue */\n\tu_int32_t\t drops;\t /* number if dropped items */\n};\ntypedef struct ng_bt_mbufq\tng_bt_mbufq_t;\ntypedef struct ng_bt_mbufq *\tng_bt_mbufq_p;\n\n#define NG_BT_MBUFQ_INIT(q, _maxlen)\t\t\t\\\n\tdo {\t\t\t\t\t\t\\\n\t\t(q)->head = NULL;\t\t\t\\\n\t\t(q)->tail = NULL;\t\t\t\\\n\t\t(q)->len = 0;\t\t\t\t\\\n\t\t(q)->maxlen = (_maxlen);\t\t\\\n\t\t(q)->drops = 0;\t\t\t\t\\\n\t} while (0)\n\n#define NG_BT_MBUFQ_DESTROY(q)\t\t\t\t\\\n\tdo {\t\t\t\t\t\t\\\n\t\tNG_BT_MBUFQ_DRAIN((q));\t\t\t\\\n\t} while (0)\n\n#define NG_BT_MBUFQ_FIRST(q)\t(q)->head\n\n#define NG_BT_MBUFQ_LEN(q)\t(q)->len\n\n#define NG_BT_MBUFQ_FULL(q)\t((q)->len >= (q)->maxlen)\n\n#define NG_BT_MBUFQ_DROP(q)\t(q)->drops ++\n\n#define NG_BT_MBUFQ_ENQUEUE(q, i)\t\t\t\\\n\tdo {\t\t\t\t\t\t\\\n\t\t(i)->m_nextpkt = NULL;\t\t\t\\\n\t\t\t\t\t\t\t\\\n\t\tif ((q)->tail == NULL)\t\t\t\\\n\t\t\t(q)->head = (i);\t\t\\\n\t\telse\t\t\t\t\t\\\n\t\t\t(q)->tail->m_nextpkt = (i);\t\\\n\t\t\t\t\t\t\t\\\n\t\t(q)->tail = (i);\t\t\t\\\n\t\t(q)->len ++;\t\t\t\t\\\n\t} while (0)\n\n#define NG_BT_MBUFQ_DEQUEUE(q, i)\t\t\t\\\n\tdo {\t\t\t\t\t\t\\\n\t\t(i) = (q)->head;\t\t\t\\\n\t\tif ((i) != NULL) {\t\t\t\\\n\t\t\t(q)->head = (q)->head->m_nextpkt; \\\n\t\t\tif ((q)->head == NULL)\t\t\\\n\t\t\t\t(q)->tail = NULL;\t\\\n\t\t\t\t\t\t\t\\\n\t\t\t(q)->len --;\t\t\t\\\n\t\t\t(i)->m_nextpkt = NULL;\t\t\\\n\t\t} \t\t\t\t\t\\\n\t} while (0)\n\n#define NG_BT_MBUFQ_PREPEND(q, i)\t\t\t\\\n\tdo {\t\t\t\t\t\t\\\n\t\t(i)->m_nextpkt = (q)->head;\t\t\\\n\t\tif ((q)->tail == NULL)\t\t\t\\\n\t\t\t(q)->tail = (i);\t\t\\\n\t\t\t\t\t\t\t\\\n\t\t(q)->head = (i);\t\t\t\\\n\t\t(q)->len ++;\t\t\t\t\\\n\t} while (0)\n\n#define NG_BT_MBUFQ_DRAIN(q)\t\t\t\t\\\n\tdo { \t\t\t\t\t\t\\\n        \tstruct mbuf\t*m = NULL;\t\t\\\n\t\t\t\t\t\t\t\\\n\t\tfor (;;) { \t\t\t\t\\\n\t\t\tNG_BT_MBUFQ_DEQUEUE((q), m);\t\\\n\t\t\tif (m == NULL) \t\t\t\\\n\t\t\t\tbreak; \t\t\t\\\n\t\t\t\t\t\t\t\\\n\t\t\tNG_FREE_M(m);\t \t\t\\\n\t\t} \t\t\t\t\t\\\n\t} while (0)\n\n/* \n * Netgraph item queue and useful itemq macros\n */\n\nstruct ng_item;\n\nstruct ng_bt_itemq {\n\tSTAILQ_HEAD(, ng_item)\tqueue;\t/* actually items queue */\n\tu_int32_t\t len;    /* number of items in the queue */\n\tu_int32_t\t maxlen; /* maximal number of items in the queue */\n\tu_int32_t\t drops;  /* number if dropped items */\n};\ntypedef struct ng_bt_itemq\tng_bt_itemq_t;\ntypedef struct ng_bt_itemq *\tng_bt_itemq_p;\n\n#define NG_BT_ITEMQ_INIT(q, _maxlen)\t\t\t\\\n\tdo {\t\t\t\t\t\t\\\n\t\tSTAILQ_INIT(&(q)->queue);\t\t\\\n\t\t(q)->len = 0;\t\t\t\t\\\n\t\t(q)->maxlen = (_maxlen);\t\t\\\n\t\t(q)->drops = 0;\t\t\t\t\\\n\t} while (0)\n\n#define NG_BT_ITEMQ_DESTROY(q)\t\t\t\t\\\n\tdo {\t\t\t\t\t\t\\\n\t\tNG_BT_ITEMQ_DRAIN((q));\t\t\t\\\n\t} while (0)\n\n#define NG_BT_ITEMQ_FIRST(q)\tSTAILQ_FIRST(&(q)->queue)\n\n#define NG_BT_ITEMQ_LEN(q)\tNG_BT_MBUFQ_LEN((q))\n\n#define NG_BT_ITEMQ_FULL(q)\tNG_BT_MBUFQ_FULL((q))\n\n#define NG_BT_ITEMQ_DROP(q)\tNG_BT_MBUFQ_DROP((q))\n\n#define NG_BT_ITEMQ_ENQUEUE(q, i)\t\t\t\\\n\tdo {\t\t\t\t\t\t\\\n\t\tSTAILQ_INSERT_TAIL(&(q)->queue, (i), el_next);\t\\\n\t\t(q)->len ++;\t\t\t\t\\\n\t} while (0)\n\n#define NG_BT_ITEMQ_DEQUEUE(q, i)\t\t\t\\\n\tdo {\t\t\t\t\t\t\\\n\t\t(i) = STAILQ_FIRST(&(q)->queue);\t\\\n\t\tif ((i) != NULL) {\t\t\t\\\n\t\t\tSTAILQ_REMOVE_HEAD(&(q)->queue, el_next);\t\\\n\t\t\t(q)->len --;\t\t\t\\\n\t\t} \t\t\t\t\t\\\n\t} while (0)\n\n#define NG_BT_ITEMQ_PREPEND(q, i)\t\t\t\\\n\tdo {\t\t\t\t\t\t\\\n\t\tSTAILQ_INSERT_HEAD(&(q)->queue, (i), el_next);\t\\\n\t\t(q)->len ++;\t\t\t\t\\\n\t} while (0)\n\n#define NG_BT_ITEMQ_DRAIN(q)\t\t\t\t\\\n\tdo { \t\t\t\t\t\t\\\n        \tstruct ng_item\t*i = NULL;\t\t\\\n\t\t\t\t\t\t\t\\\n\t\tfor (;;) { \t\t\t\t\\\n\t\t\tNG_BT_ITEMQ_DEQUEUE((q), i);\t\\\n\t\t\tif (i == NULL) \t\t\t\\\n\t\t\t\tbreak; \t\t\t\\\n\t\t\t\t\t\t\t\\\n\t\t\tNG_FREE_ITEM(i); \t\t\\\n\t\t} \t\t\t\t\t\\\n\t} while (0)\n\n/*\n * Get Bluetooth stack sysctl globals\n */\n\nu_int32_t\tbluetooth_hci_command_timeout\t(void);\nu_int32_t\tbluetooth_hci_connect_timeout\t(void);\nu_int32_t\tbluetooth_hci_max_neighbor_age\t(void);\nu_int32_t\tbluetooth_l2cap_rtx_timeout\t(void);\nu_int32_t\tbluetooth_l2cap_ertx_timeout\t(void);\nu_int32_t      bluetooth_sco_rtx_timeout       (void);\n\n#endif /* _NETGRAPH_BLUETOOTH_H_ */\n\n"
  },
  {
    "path": "freebsd-headers/netgraph/bluetooth/include/ng_bt3c.h",
    "content": "/*\n * ng_bt3c.h\n */\n\n/*-\n * Copyright (c) 2001-2002 Maksim Yevmenkin <m_evmenkin@yahoo.com>\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $Id: ng_bt3c.h,v 1.1 2002/11/24 19:47:05 max Exp $\n * $FreeBSD: release/9.0.0/sys/netgraph/bluetooth/include/ng_bt3c.h 139823 2005-01-07 01:45:51Z imp $\n *\n * XXX XXX XX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX \n *\n * Based on information obrained from: Jose Orlando Pereira <jop@di.uminho.pt>\n * and disassembled w2k driver.\n *\n * XXX XXX XX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX \n *\n */\n\n#ifndef _NG_BT3C_H_\n#define _NG_BT3C_H_\n\n/**************************************************************************\n **************************************************************************\n **     Netgraph node hook name, type name and type cookie and commands \n **************************************************************************  \n **************************************************************************/\n\n#define NG_BT3C_NODE_TYPE\t\"btccc\"\t/* XXX can't use bt3c in pccard.conf */\n#define NG_BT3C_HOOK\t\t\"hook\"\n\n#define NGM_BT3C_COOKIE\t\t1014752016\n\n/* Debug levels */\n#define NG_BT3C_ALERT_LEVEL\t1\n#define NG_BT3C_ERR_LEVEL\t2\n#define NG_BT3C_WARN_LEVEL\t3\n#define NG_BT3C_INFO_LEVEL\t4\n\n/* Node states */\n#define NG_BT3C_W4_PKT_IND\t1               /* wait for packet indicator */\n#define NG_BT3C_W4_PKT_HDR\t2               /* wait for packet header */\n#define NG_BT3C_W4_PKT_DATA\t3               /* wait for packet data */\n\n/**************************************************************************\n **************************************************************************\n **                    BT3C node command/event parameters\n **************************************************************************\n **************************************************************************/\n\n#define NGM_BT3C_NODE_GET_STATE\t1\t\t/* get node state */\ntypedef u_int16_t\t\tng_bt3c_node_state_ep;\n\n#define NGM_BT3C_NODE_SET_DEBUG\t2\t\t/* set debug level */\n#define NGM_BT3C_NODE_GET_DEBUG\t3\t\t/* get debug level */\ntypedef u_int16_t\t\tng_bt3c_node_debug_ep; \n\n#define NGM_BT3C_NODE_GET_QLEN\t4\t\t/* get queue length */\n#define NGM_BT3C_NODE_SET_QLEN\t5\t\t/* set queue length */\ntypedef struct {\n\tint32_t\tqueue;\t\t\t\t/* queue index */\n#define NGM_BT3C_NODE_IN_QUEUE\t1\t\t/* incoming queue */\n#define NGM_BT3C_NODE_OUT_QUEUE\t2\t\t/* outgoing queue */\n\n\tint32_t\tqlen;\t\t\t\t/* queue length */\n} ng_bt3c_node_qlen_ep;\n\n#define NGM_BT3C_NODE_GET_STAT\t6\t\t/* get statistic */\ntypedef struct {\n\tu_int32_t\tpckts_recv;\t\t/* # of packets received */\n\tu_int32_t\tbytes_recv;\t\t/* # of bytes received */\n\tu_int32_t\tpckts_sent;\t\t/* # of packets sent */\n\tu_int32_t\tbytes_sent;\t\t/* # of bytes sent */\n\tu_int32_t\toerrors;\t\t/* # of output errors */\n\tu_int32_t\tierrors;\t\t/* # of input errors */\n} ng_bt3c_node_stat_ep;\n\n#define NGM_BT3C_NODE_RESET_STAT 7\t\t/* reset statistic */\n\n#define NGM_BT3C_NODE_DOWNLOAD_FIRMWARE\t8\t/* download firmware */\n\ntypedef struct {\n\tu_int32_t\tblock_address;\n\tu_int16_t\tblock_size;\t\t/* in words */\n\tu_int16_t\tblock_alignment;\t/* in bytes */\n} ng_bt3c_firmware_block_ep;\n\n#endif /* ndef _NG_BT3C_H_ */\n\n"
  },
  {
    "path": "freebsd-headers/netgraph/bluetooth/include/ng_btsocket.h",
    "content": "/*\n * ng_btsocket.h\n */\n\n/*-\n * Copyright (c) 2001-2002 Maksim Yevmenkin <m_evmenkin@yahoo.com>\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $Id: ng_btsocket.h,v 1.8 2003/04/26 22:32:10 max Exp $\n * $FreeBSD: release/9.0.0/sys/netgraph/bluetooth/include/ng_btsocket.h 180399 2008-07-10 00:15:29Z emax $\n */\n\n#ifndef _NETGRAPH_BTSOCKET_H_\n#define _NETGRAPH_BTSOCKET_H_\n\n/*\n * Bluetooth protocols\n */\n\n#define BLUETOOTH_PROTO_HCI\t134\t/* HCI protocol number */\n#define BLUETOOTH_PROTO_L2CAP\t135\t/* L2CAP protocol number */\n#define BLUETOOTH_PROTO_RFCOMM\t136\t/* RFCOMM protocol number */\n#define BLUETOOTH_PROTO_SCO\t137\t/* SCO protocol number */\n\n/*\n * Bluetooth version of struct sockaddr for raw HCI sockets\n */\n\nstruct sockaddr_hci {\n\tu_char\t\thci_len;\t/* total length */\n\tu_char\t\thci_family;\t/* address family */\n\tchar\t\thci_node[32];\t/* address (size == NG_NODESIZ ) */\n};\n\n/* Raw HCI socket options */\n#define SOL_HCI_RAW\t\t0x0802\t/* socket options level */\n\n#define SO_HCI_RAW_FILTER\t1\t/* get/set filter on socket */\n#define SO_HCI_RAW_DIRECTION\t2\t/* turn on/off direction info */\n#define SCM_HCI_RAW_DIRECTION\tSO_HCI_RAW_DIRECTION /* cmsg_type  */\n\n/*\n * Raw HCI socket filter.\n *\n * For packet mask use (1 << (HCI packet indicator - 1))\n * For event mask use (1 << (Event - 1))\n */\n\nstruct ng_btsocket_hci_raw_filter {\n\tbitstr_t\tbit_decl(packet_mask, 32);\n\tbitstr_t\tbit_decl(event_mask, (NG_HCI_EVENT_MASK_SIZE * 8));\n};\n\n/*\n * Raw HCI sockets ioctl's\n */\n\n/* Get state */\nstruct ng_btsocket_hci_raw_node_state {\n\tng_hci_node_state_ep\tstate;\n};\n#define SIOC_HCI_RAW_NODE_GET_STATE \\\n\t_IOWR('b', NGM_HCI_NODE_GET_STATE, \\\n\t\tstruct ng_btsocket_hci_raw_node_state)\n\n/* Initialize */\n#define SIOC_HCI_RAW_NODE_INIT \\\n\t_IO('b', NGM_HCI_NODE_INIT)\n\n/* Get/Set debug level */\nstruct ng_btsocket_hci_raw_node_debug {\n\tng_hci_node_debug_ep\tdebug;\n};\n#define SIOC_HCI_RAW_NODE_GET_DEBUG \\\n\t_IOWR('b', NGM_HCI_NODE_GET_DEBUG, \\\n\t\tstruct ng_btsocket_hci_raw_node_debug)\n#define SIOC_HCI_RAW_NODE_SET_DEBUG \\\n\t_IOWR('b', NGM_HCI_NODE_SET_DEBUG, \\\n\t\tstruct ng_btsocket_hci_raw_node_debug)\n\n/* Get buffer info */\nstruct ng_btsocket_hci_raw_node_buffer {\n\tng_hci_node_buffer_ep\tbuffer;\n};\n#define SIOC_HCI_RAW_NODE_GET_BUFFER \\\n\t_IOWR('b', NGM_HCI_NODE_GET_BUFFER, \\\n\t\tstruct ng_btsocket_hci_raw_node_buffer)\n\n/* Get BD_ADDR */\nstruct ng_btsocket_hci_raw_node_bdaddr {\n\tbdaddr_t\tbdaddr;\n};\n#define SIOC_HCI_RAW_NODE_GET_BDADDR \\\n\t_IOWR('b', NGM_HCI_NODE_GET_BDADDR, \\\n\t\tstruct ng_btsocket_hci_raw_node_bdaddr)\n\n/* Get features */\nstruct ng_btsocket_hci_raw_node_features {\n\tu_int8_t\tfeatures[NG_HCI_FEATURES_SIZE];\n};\n#define SIOC_HCI_RAW_NODE_GET_FEATURES \\\n\t_IOWR('b', NGM_HCI_NODE_GET_FEATURES, \\\n\t\tstruct ng_btsocket_hci_raw_node_features)\n\n/* Get stat */\nstruct ng_btsocket_hci_raw_node_stat {\n\tng_hci_node_stat_ep\tstat;\n};\n#define SIOC_HCI_RAW_NODE_GET_STAT \\\n\t_IOWR('b', NGM_HCI_NODE_GET_STAT, \\\n\t\tstruct ng_btsocket_hci_raw_node_stat)\n\n/* Reset stat */\n#define SIOC_HCI_RAW_NODE_RESET_STAT \\\n\t_IO('b', NGM_HCI_NODE_RESET_STAT)\n\n/* Flush neighbor cache */\n#define SIOC_HCI_RAW_NODE_FLUSH_NEIGHBOR_CACHE \\\n\t_IO('b', NGM_HCI_NODE_FLUSH_NEIGHBOR_CACHE)\n\n/* Get neighbor cache */\nstruct ng_btsocket_hci_raw_node_neighbor_cache {\n\tu_int32_t\t\t\t\t num_entries;\n\tng_hci_node_neighbor_cache_entry_ep\t*entries;\n};\n#define SIOC_HCI_RAW_NODE_GET_NEIGHBOR_CACHE \\\n\t_IOWR('b', NGM_HCI_NODE_GET_NEIGHBOR_CACHE, \\\n\t\tstruct ng_btsocket_hci_raw_node_neighbor_cache)\n\n/* Get connection list */\nstruct ng_btsocket_hci_raw_con_list {\n\tu_int32_t\t\t num_connections;\n\tng_hci_node_con_ep\t*connections;\n};\n#define SIOC_HCI_RAW_NODE_GET_CON_LIST \\\n\t_IOWR('b', NGM_HCI_NODE_GET_CON_LIST, \\\n\t\tstruct ng_btsocket_hci_raw_con_list)\n\n/* Get/Set link policy settings mask */\nstruct ng_btsocket_hci_raw_node_link_policy_mask {\n\tng_hci_node_link_policy_mask_ep\tpolicy_mask;\n};\n#define SIOC_HCI_RAW_NODE_GET_LINK_POLICY_MASK \\\n\t_IOWR('b', NGM_HCI_NODE_GET_LINK_POLICY_SETTINGS_MASK, \\\n\t\tstruct ng_btsocket_hci_raw_node_link_policy_mask)\n#define SIOC_HCI_RAW_NODE_SET_LINK_POLICY_MASK \\\n\t_IOWR('b', NGM_HCI_NODE_SET_LINK_POLICY_SETTINGS_MASK, \\\n\t\tstruct ng_btsocket_hci_raw_node_link_policy_mask)\n\n/* Get/Set packet mask */\nstruct ng_btsocket_hci_raw_node_packet_mask {\n\tng_hci_node_packet_mask_ep\tpacket_mask;\n};\n#define SIOC_HCI_RAW_NODE_GET_PACKET_MASK \\\n\t_IOWR('b', NGM_HCI_NODE_GET_PACKET_MASK, \\\n\t\tstruct ng_btsocket_hci_raw_node_packet_mask)\n#define SIOC_HCI_RAW_NODE_SET_PACKET_MASK \\\n\t_IOWR('b', NGM_HCI_NODE_SET_PACKET_MASK, \\\n\t\tstruct ng_btsocket_hci_raw_node_packet_mask)\n\n/* Get/Set role switch */\nstruct ng_btsocket_hci_raw_node_role_switch {\n\tng_hci_node_role_switch_ep\trole_switch;\n};\n#define SIOC_HCI_RAW_NODE_GET_ROLE_SWITCH \\\n\t_IOWR('b', NGM_HCI_NODE_GET_ROLE_SWITCH, \\\n\t\tstruct ng_btsocket_hci_raw_node_role_switch)\n#define SIOC_HCI_RAW_NODE_SET_ROLE_SWITCH \\\n\t_IOWR('b', NGM_HCI_NODE_SET_ROLE_SWITCH, \\\n\t\tstruct ng_btsocket_hci_raw_node_role_switch)\n\n/* Get list of HCI node names */\nstruct ng_btsocket_hci_raw_node_list_names {\n\tu_int32_t\t num_names;\n\tstruct nodeinfo\t*names;\n};\n#define SIOC_HCI_RAW_NODE_LIST_NAMES \\\n\t_IOWR('b', NGM_HCI_NODE_LIST_NAMES, \\\n\t\tstruct ng_btsocket_hci_raw_node_list_names)\n\n/*\n * XXX FIXME: probably does not belong here\n * Bluetooth version of struct sockaddr for SCO sockets (SEQPACKET)\n */\n\nstruct sockaddr_sco {\n\tu_char\t\tsco_len;\t/* total length */\n\tu_char\t\tsco_family;\t/* address family */\n\tbdaddr_t\tsco_bdaddr;\t/* address */\n};\n\n/* SCO socket options */\n#define SOL_SCO\t\t0x0209\t\t/* socket options level */\n\n#define SO_SCO_MTU\t1\t\t/* get sockets mtu */\n#define SO_SCO_CONNINFO\t2\t\t/* get HCI connection handle */\n\n/*\n * XXX FIXME: probably does not belong here\n * Bluetooth version of struct sockaddr for L2CAP sockets (RAW and SEQPACKET)\n */\n\nstruct sockaddr_l2cap {\n\tu_char\t\tl2cap_len;\t/* total length */\n\tu_char\t\tl2cap_family;\t/* address family */\n\tu_int16_t\tl2cap_psm;\t/* PSM (Protocol/Service Multiplexor) */\n\tbdaddr_t\tl2cap_bdaddr;\t/* address */\n};\n\n/* L2CAP socket options */\n#define SOL_L2CAP\t\t0x1609\t/* socket option level */\n\n#define SO_L2CAP_IMTU\t\t1\t/* get/set incoming MTU */\n#define SO_L2CAP_OMTU\t\t2\t/* get outgoing (peer incoming) MTU */\n#define SO_L2CAP_IFLOW\t\t3\t/* get incoming flow spec. */\n#define SO_L2CAP_OFLOW\t\t4\t/* get/set outgoing flow spec. */\n#define SO_L2CAP_FLUSH\t\t5\t/* get/set flush timeout */\n\n/*\n * Raw L2CAP sockets ioctl's\n */\n\n/* Ping */\nstruct ng_btsocket_l2cap_raw_ping {\n\tu_int32_t\t\t result;\n\tu_int32_t\t\t echo_size;\n\tu_int8_t\t\t*echo_data;\n};\n#define SIOC_L2CAP_L2CA_PING \\\n\t_IOWR('b', NGM_L2CAP_L2CA_PING, \\\n\t\tstruct ng_btsocket_l2cap_raw_ping)\n\n/* Get info */\nstruct ng_btsocket_l2cap_raw_get_info {\n\tu_int32_t\t\t result;\n\tu_int32_t\t\t info_type;\n\tu_int32_t\t\t info_size;\n\tu_int8_t\t\t*info_data;\n};\n#define SIOC_L2CAP_L2CA_GET_INFO \\\n\t_IOWR('b', NGM_L2CAP_L2CA_GET_INFO, \\\n\t\tstruct ng_btsocket_l2cap_raw_get_info)\n\n/* Get flags */\nstruct ng_btsocket_l2cap_raw_node_flags {\n\tng_l2cap_node_flags_ep\tflags;\n};\n#define SIOC_L2CAP_NODE_GET_FLAGS \\\n\t_IOWR('b', NGM_L2CAP_NODE_GET_FLAGS, \\\n\t\tstruct ng_btsocket_l2cap_raw_node_flags)\n\n/* Get/Set debug level */\nstruct ng_btsocket_l2cap_raw_node_debug {\n\tng_l2cap_node_debug_ep\tdebug;\n};\n#define SIOC_L2CAP_NODE_GET_DEBUG \\\n\t_IOWR('b', NGM_L2CAP_NODE_GET_DEBUG, \\\n\t\tstruct ng_btsocket_l2cap_raw_node_debug)\n#define SIOC_L2CAP_NODE_SET_DEBUG \\\n\t_IOWR('b', NGM_L2CAP_NODE_SET_DEBUG, \\\n\t\tstruct ng_btsocket_l2cap_raw_node_debug)\n\n/* Get connection list */\nstruct ng_btsocket_l2cap_raw_con_list {\n\tu_int32_t\t\t num_connections;\n\tng_l2cap_node_con_ep\t*connections;\n};\n#define SIOC_L2CAP_NODE_GET_CON_LIST \\\n\t_IOWR('b', NGM_L2CAP_NODE_GET_CON_LIST, \\\n\t\tstruct ng_btsocket_l2cap_raw_con_list)\n\n/* Get channel list */\nstruct ng_btsocket_l2cap_raw_chan_list {\n\tu_int32_t\t\t num_channels;\n\tng_l2cap_node_chan_ep\t*channels;\n};\n#define SIOC_L2CAP_NODE_GET_CHAN_LIST \\\n\t_IOWR('b', NGM_L2CAP_NODE_GET_CHAN_LIST, \\\n\t\tstruct ng_btsocket_l2cap_raw_chan_list)\n\n/* Get/Set auto disconnect timeout */\nstruct ng_btsocket_l2cap_raw_auto_discon_timo\n{\n\tng_l2cap_node_auto_discon_ep\ttimeout;\n};\n#define SIOC_L2CAP_NODE_GET_AUTO_DISCON_TIMO \\\n\t_IOWR('b', NGM_L2CAP_NODE_GET_AUTO_DISCON_TIMO, \\\n\t\tstruct ng_btsocket_l2cap_raw_auto_discon_timo)\n#define SIOC_L2CAP_NODE_SET_AUTO_DISCON_TIMO \\\n\t_IOWR('b', NGM_L2CAP_NODE_SET_AUTO_DISCON_TIMO, \\\n\t\tstruct ng_btsocket_l2cap_raw_auto_discon_timo)\n\n/*\n * XXX FIXME: probably does not belong here\n * Bluetooth version of struct sockaddr for RFCOMM sockets (STREAM)\n */\n\nstruct sockaddr_rfcomm {\n\tu_char\t\trfcomm_len;\t/* total length */\n\tu_char\t\trfcomm_family;\t/* address family */\n\tbdaddr_t\trfcomm_bdaddr;\t/* address */\n\tu_int8_t\trfcomm_channel;\t/* channel */\n};\n\n/* Flow control information */\nstruct ng_btsocket_rfcomm_fc_info {\n\tu_int8_t\tlmodem;\t\t/* modem signals (local) */\n\tu_int8_t\trmodem;\t\t/* modem signals (remote) */\n\tu_int8_t\ttx_cred;\t/* TX credits */\n\tu_int8_t\trx_cred;\t/* RX credits */\n\tu_int8_t\tcfc;\t\t/* credit flow control */\n\tu_int8_t\treserved;\n};\n\n/* STREAM RFCOMM socket options */\n#define SOL_RFCOMM\t\t0x0816\t/* socket options level */\n\n#define SO_RFCOMM_MTU\t\t1\t/* get channel MTU */\n#define SO_RFCOMM_FC_INFO\t2\t/* get flow control information */\n\n/* \n * Netgraph node type name and cookie \n */\n\n#define\tNG_BTSOCKET_HCI_RAW_NODE_TYPE\t\"btsock_hci_raw\"\n#define\tNG_BTSOCKET_L2CAP_RAW_NODE_TYPE\t\"btsock_l2c_raw\"\n#define\tNG_BTSOCKET_L2CAP_NODE_TYPE\t\"btsock_l2c\"\n#define\tNG_BTSOCKET_SCO_NODE_TYPE\t\"btsock_sco\"\n\n/*\n * Debug levels \n */\n\n#define NG_BTSOCKET_ALERT_LEVEL\t1\n#define NG_BTSOCKET_ERR_LEVEL\t2\n#define NG_BTSOCKET_WARN_LEVEL\t3\n#define NG_BTSOCKET_INFO_LEVEL\t4\n\n#endif /* _NETGRAPH_BTSOCKET_H_ */\n\n"
  },
  {
    "path": "freebsd-headers/netgraph/bluetooth/include/ng_btsocket_hci_raw.h",
    "content": "/*\n * ng_btsocket_hci_raw.h\n */\n\n/*-\n * Copyright (c) 2001-2002 Maksim Yevmenkin <m_evmenkin@yahoo.com>\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $Id: ng_btsocket_hci_raw.h,v 1.3 2003/03/25 23:53:32 max Exp $\n * $FreeBSD: release/9.0.0/sys/netgraph/bluetooth/include/ng_btsocket_hci_raw.h 160549 2006-07-21 17:11:15Z rwatson $\n */\n\n#ifndef _NETGRAPH_BTSOCKET_HCI_RAW_H_\n#define _NETGRAPH_BTSOCKET_HCI_RAW_H_\n\n#define NG_BTSOCKET_HCI_RAW_SENDSPACE\t(4 * 1024)\n#define NG_BTSOCKET_HCI_RAW_RECVSPACE\t(4 * 1024)\n\n/*\n * Bluetooth raw HCI socket PCB\n */\n\nstruct ng_btsocket_hci_raw_pcb {\n\tstruct socket\t\t\t\t*so;     /* socket */\n\tu_int32_t\t\t\t\t flags;  /* flags */\n#define NG_BTSOCKET_HCI_RAW_DIRECTION\t(1 << 0)\n#define NG_BTSOCKET_HCI_RAW_PRIVILEGED\t(1 << 1)\n\tstruct sockaddr_hci\t\t\t addr;   /* local address */\n\tstruct ng_btsocket_hci_raw_filter\t filter; /* filter */\n\tu_int32_t\t\t\t\t token;  /* message token */\n\tstruct ng_mesg\t\t\t\t*msg;    /* message */\n\tLIST_ENTRY(ng_btsocket_hci_raw_pcb)\t next;   /* link to next */\n\tstruct mtx\t\t\t\t pcb_mtx; /* pcb mutex */\n};\ntypedef struct ng_btsocket_hci_raw_pcb\t\tng_btsocket_hci_raw_pcb_t;\ntypedef struct ng_btsocket_hci_raw_pcb *\tng_btsocket_hci_raw_pcb_p;\n\n#define\tso2hci_raw_pcb(so) \\\n\t((struct ng_btsocket_hci_raw_pcb *)((so)->so_pcb))\n\n/*\n * Bluetooth raw HCI socket methods\n */\n\n#ifdef _KERNEL\n\nvoid ng_btsocket_hci_raw_init       (void);\nvoid ng_btsocket_hci_raw_abort      (struct socket *);\nvoid ng_btsocket_hci_raw_close      (struct socket *);\nint  ng_btsocket_hci_raw_attach     (struct socket *, int, struct thread *);\nint  ng_btsocket_hci_raw_bind       (struct socket *, struct sockaddr *, \n                                     struct thread *);\nint  ng_btsocket_hci_raw_connect    (struct socket *, struct sockaddr *, \n                                     struct thread *);\nint  ng_btsocket_hci_raw_control    (struct socket *, u_long, caddr_t,\n                                     struct ifnet *, struct thread *);\nint  ng_btsocket_hci_raw_ctloutput  (struct socket *, struct sockopt *);\nvoid ng_btsocket_hci_raw_detach     (struct socket *);\nint  ng_btsocket_hci_raw_disconnect (struct socket *);\nint  ng_btsocket_hci_raw_peeraddr   (struct socket *, struct sockaddr **);\nint  ng_btsocket_hci_raw_send       (struct socket *, int, struct mbuf *,\n                                     struct sockaddr *, struct mbuf *,\n                                     struct thread *);\nint  ng_btsocket_hci_raw_sockaddr   (struct socket *, struct sockaddr **);\n\n#endif /* _KERNEL */\n \n#endif /* ndef _NETGRAPH_BTSOCKET_HCI_RAW_H_ */\n\n"
  },
  {
    "path": "freebsd-headers/netgraph/bluetooth/include/ng_btsocket_l2cap.h",
    "content": "/*\n * ng_btsocket_l2cap.h\n */\n\n/*-\n * Copyright (c) 2001-2002 Maksim Yevmenkin <m_evmenkin@yahoo.com>\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $Id: ng_btsocket_l2cap.h,v 1.4 2003/03/25 23:53:33 max Exp $\n * $FreeBSD: release/9.0.0/sys/netgraph/bluetooth/include/ng_btsocket_l2cap.h 160549 2006-07-21 17:11:15Z rwatson $\n */\n\n#ifndef _NETGRAPH_BTSOCKET_L2CAP_H_\n#define _NETGRAPH_BTSOCKET_L2CAP_H_\n\n/*\n * L2CAP routing entry\n */\n\nstruct ng_hook;\nstruct ng_message;\n\nstruct ng_btsocket_l2cap_rtentry {\n\tbdaddr_t\t\t\t\t src;  /* source BD_ADDR */\n\tstruct ng_hook\t\t\t\t*hook; /* downstream hook */\n\tLIST_ENTRY(ng_btsocket_l2cap_rtentry)\t next; /* link to next */\n};\ntypedef struct ng_btsocket_l2cap_rtentry\tng_btsocket_l2cap_rtentry_t;\ntypedef struct ng_btsocket_l2cap_rtentry *\tng_btsocket_l2cap_rtentry_p;\n\n/*****************************************************************************\n *****************************************************************************\n **                          SOCK_RAW L2CAP sockets                         **\n *****************************************************************************\n *****************************************************************************/\n\n#define NG_BTSOCKET_L2CAP_RAW_SENDSPACE\tNG_L2CAP_MTU_DEFAULT\n#define NG_BTSOCKET_L2CAP_RAW_RECVSPACE\tNG_L2CAP_MTU_DEFAULT\n\n/*\n * Bluetooth raw L2CAP socket PCB\n */\n\nstruct ng_btsocket_l2cap_raw_pcb {\n\tstruct socket\t\t\t\t*so;\t/* socket */\n\n\tu_int32_t\t\t\t\t flags; /* flags */\n#define NG_BTSOCKET_L2CAP_RAW_PRIVILEGED\t(1 << 0)\n\n\tbdaddr_t\t\t\t\t src;\t/* source address */\n\tbdaddr_t\t\t\t\t dst;\t/* dest address */\n\tng_btsocket_l2cap_rtentry_p\t\t rt;    /* routing info */\n\n\tu_int32_t\t\t\t\t token;\t/* message token */\n\tstruct ng_mesg\t\t\t\t*msg;   /* message */\n\n\tstruct mtx\t\t\t\t pcb_mtx; /* pcb mutex */\n\n\tLIST_ENTRY(ng_btsocket_l2cap_raw_pcb)\t next;  /* link to next PCB */\n};\ntypedef struct ng_btsocket_l2cap_raw_pcb\tng_btsocket_l2cap_raw_pcb_t;\ntypedef struct ng_btsocket_l2cap_raw_pcb *\tng_btsocket_l2cap_raw_pcb_p;\n\n#define\tso2l2cap_raw_pcb(so) \\\n\t((struct ng_btsocket_l2cap_raw_pcb *)((so)->so_pcb))\n\n/*\n * Bluetooth raw L2CAP socket methods\n */\n\n#ifdef _KERNEL\n\nvoid ng_btsocket_l2cap_raw_init       (void);\nvoid ng_btsocket_l2cap_raw_abort      (struct socket *);\nvoid ng_btsocket_l2cap_raw_close      (struct socket *);\nint  ng_btsocket_l2cap_raw_attach     (struct socket *, int, struct thread *);\nint  ng_btsocket_l2cap_raw_bind       (struct socket *, struct sockaddr *,\n                                       struct thread *);\nint  ng_btsocket_l2cap_raw_connect    (struct socket *, struct sockaddr *,\n                                       struct thread *);\nint  ng_btsocket_l2cap_raw_control    (struct socket *, u_long, caddr_t,\n                                       struct ifnet *, struct thread *);\nvoid ng_btsocket_l2cap_raw_detach     (struct socket *);\nint  ng_btsocket_l2cap_raw_disconnect (struct socket *);\nint  ng_btsocket_l2cap_raw_peeraddr   (struct socket *, struct sockaddr **);\nint  ng_btsocket_l2cap_raw_send       (struct socket *, int, struct mbuf *,\n                                       struct sockaddr *, struct mbuf *,\n                                       struct thread *);\nint  ng_btsocket_l2cap_raw_sockaddr   (struct socket *, struct sockaddr **);\n\n#endif /* _KERNEL */\n\n/*****************************************************************************\n *****************************************************************************\n **                    SOCK_SEQPACKET L2CAP sockets                         **\n *****************************************************************************\n *****************************************************************************/\n\n#define NG_BTSOCKET_L2CAP_SENDSPACE\tNG_L2CAP_MTU_DEFAULT /* (64 * 1024) */\n#define NG_BTSOCKET_L2CAP_RECVSPACE\t(64 * 1024)\n\n/*\n * Bluetooth L2CAP socket PCB\n */\n\nstruct ng_btsocket_l2cap_pcb {\n\tstruct socket\t\t\t*so;\t     /* Pointer to socket */\n\n\tbdaddr_t\t\t\t src;\t     /* Source address */\n\tbdaddr_t\t\t\t dst;\t     /* Destination address */\n\n\tu_int16_t\t\t\t psm;\t     /* PSM */\n\tu_int16_t\t\t\t cid;\t     /* Local channel ID */\n\n\tu_int16_t\t\t\t flags;      /* socket flags */\n#define NG_BTSOCKET_L2CAP_CLIENT\t(1 << 0)     /* socket is client */\n#define NG_BTSOCKET_L2CAP_TIMO\t\t(1 << 1)     /* timeout pending */\n\n\tu_int8_t\t\t\t state;      /* socket state */\n#define NG_BTSOCKET_L2CAP_CLOSED\t0            /* socket closed */\n#define NG_BTSOCKET_L2CAP_CONNECTING\t1            /* wait for connect */\n#define NG_BTSOCKET_L2CAP_CONFIGURING\t2            /* wait for config */\n#define NG_BTSOCKET_L2CAP_OPEN\t\t3            /* socket open */\n#define NG_BTSOCKET_L2CAP_DISCONNECTING\t4            /* wait for disconnect */\n\n\tu_int8_t\t\t\t cfg_state;  /* config state */\n#define\tNG_BTSOCKET_L2CAP_CFG_IN\t(1 << 0)     /* incoming path done */\n#define\tNG_BTSOCKET_L2CAP_CFG_OUT\t(1 << 1)     /* outgoing path done */\n#define\tNG_BTSOCKET_L2CAP_CFG_BOTH \\\n\t(NG_BTSOCKET_L2CAP_CFG_IN | NG_BTSOCKET_L2CAP_CFG_OUT)\n\n#define\tNG_BTSOCKET_L2CAP_CFG_IN_SENT\t(1 << 2)     /* L2CAP ConfigReq sent */\n#define\tNG_BTSOCKET_L2CAP_CFG_OUT_SENT\t(1 << 3)     /* ---/--- */\n\n\tu_int16_t\t\t\t imtu;       /* Incoming MTU */\n\tng_l2cap_flow_t\t\t\t iflow;      /* Input flow spec */\n\n\tu_int16_t\t\t\t omtu;       /* Outgoing MTU */\n\tng_l2cap_flow_t\t\t\t oflow;      /* Outgoing flow spec */\n\n\tu_int16_t\t\t\t flush_timo; /* flush timeout */   \n\tu_int16_t\t\t\t link_timo;  /* link timeout */ \n\n\tstruct callout_handle\t\t timo;       /* timeout */\n\n\tu_int32_t\t\t\t token;\t     /* message token */\n\tng_btsocket_l2cap_rtentry_p\t rt;         /* routing info */\n\n\tstruct mtx\t\t\t pcb_mtx;    /* pcb mutex */\n\n\tLIST_ENTRY(ng_btsocket_l2cap_pcb) next;      /* link to next PCB */\n};\ntypedef struct ng_btsocket_l2cap_pcb\tng_btsocket_l2cap_pcb_t;\ntypedef struct ng_btsocket_l2cap_pcb *\tng_btsocket_l2cap_pcb_p;\n\n#define\tso2l2cap_pcb(so) \\\n\t((struct ng_btsocket_l2cap_pcb *)((so)->so_pcb))\n\n/*\n * Bluetooth L2CAP socket methods\n */\n\n#ifdef _KERNEL\n\nvoid ng_btsocket_l2cap_init       (void);\nvoid ng_btsocket_l2cap_abort      (struct socket *);\nvoid ng_btsocket_l2cap_close      (struct socket *);\nint  ng_btsocket_l2cap_accept     (struct socket *, struct sockaddr **);\nint  ng_btsocket_l2cap_attach     (struct socket *, int, struct thread *);\nint  ng_btsocket_l2cap_bind       (struct socket *, struct sockaddr *,\n                                   struct thread *);\nint  ng_btsocket_l2cap_connect    (struct socket *, struct sockaddr *,\n                                   struct thread *);\nint  ng_btsocket_l2cap_control    (struct socket *, u_long, caddr_t,\n                                   struct ifnet *, struct thread *);\nint  ng_btsocket_l2cap_ctloutput  (struct socket *, struct sockopt *);\nvoid ng_btsocket_l2cap_detach     (struct socket *);\nint  ng_btsocket_l2cap_disconnect (struct socket *);\nint  ng_btsocket_l2cap_listen     (struct socket *, int, struct thread *);\nint  ng_btsocket_l2cap_peeraddr   (struct socket *, struct sockaddr **);\nint  ng_btsocket_l2cap_send       (struct socket *, int, struct mbuf *,\n                                   struct sockaddr *, struct mbuf *,\n                                   struct thread *);\nint  ng_btsocket_l2cap_sockaddr   (struct socket *, struct sockaddr **);\n\n#endif /* _KERNEL */\n\n#endif /* _NETGRAPH_BTSOCKET_L2CAP_H_ */\n\n"
  },
  {
    "path": "freebsd-headers/netgraph/bluetooth/include/ng_btsocket_rfcomm.h",
    "content": "/*\n * ng_btsocket_rfcomm.h\n */\n\n/*-\n * Copyright (c) 2001-2003 Maksim Yevmenkin <m_evmenkin@yahoo.com>\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $Id: ng_btsocket_rfcomm.h,v 1.10 2003/03/29 22:27:42 max Exp $\n * $FreeBSD: release/9.0.0/sys/netgraph/bluetooth/include/ng_btsocket_rfcomm.h 197083 2009-09-10 23:30:13Z emax $\n */\n\n#ifndef _NETGRAPH_BTSOCKET_RFCOMM_H_\n#define _NETGRAPH_BTSOCKET_RFCOMM_H_\n\n/*****************************************************************************\n *****************************************************************************\n **                              RFCOMM                                     **\n *****************************************************************************\n *****************************************************************************/\n\n/* XXX FIXME this does not belong here */\n\n#define RFCOMM_DEFAULT_MTU\t\t667\n#define RFCOMM_MAX_MTU\t\t\t1024\n\n#define RFCOMM_DEFAULT_CREDITS\t\t7\n#define RFCOMM_MAX_CREDITS\t\t40\n\n/* RFCOMM frame types */\n#define RFCOMM_FRAME_SABM\t\t0x2f\n#define RFCOMM_FRAME_DISC\t\t0x43\n#define RFCOMM_FRAME_UA\t\t\t0x63\n#define RFCOMM_FRAME_DM\t\t\t0x0f\n#define RFCOMM_FRAME_UIH\t\t0xef\n\n/* RFCOMM MCC commands */\n#define RFCOMM_MCC_TEST\t\t\t0x08 /* Test */\n#define RFCOMM_MCC_FCON\t\t\t0x28 /* Flow Control on */\n#define RFCOMM_MCC_FCOFF\t\t0x18 /* Flow Control off */\n#define RFCOMM_MCC_MSC\t\t\t0x38 /* Modem Status Command */\n#define RFCOMM_MCC_RPN\t\t\t0x24 /* Remote Port Negotiation */\n#define RFCOMM_MCC_RLS\t\t\t0x14 /* Remote Line Status */\n#define RFCOMM_MCC_PN\t\t\t0x20 /* Port Negotiation */\n#define RFCOMM_MCC_NSC\t\t\t0x04 /* Non Supported Command */\n\n/* RFCOMM modem signals */\n#define RFCOMM_MODEM_FC\t\t\t0x02 /* Flow Control asserted */\n#define RFCOMM_MODEM_RTC\t\t0x04 /* Ready To Communicate */\n#define RFCOMM_MODEM_RTR\t\t0x08 /* Ready To Receive */\n#define RFCOMM_MODEM_IC\t\t\t0x40 /* Incomming Call */\n#define RFCOMM_MODEM_DV\t\t\t0x80 /* Data Valid */\n\n/* RPN parameters - baud rate */\n#define RFCOMM_RPN_BR_2400\t\t0x0\n#define RFCOMM_RPN_BR_4800\t\t0x1\n#define RFCOMM_RPN_BR_7200\t\t0x2\n#define RFCOMM_RPN_BR_9600\t\t0x3\n#define RFCOMM_RPN_BR_19200\t\t0x4\n#define RFCOMM_RPN_BR_38400\t\t0x5\n#define RFCOMM_RPN_BR_57600\t\t0x6\n#define RFCOMM_RPN_BR_115200\t\t0x7\n#define RFCOMM_RPN_BR_230400\t\t0x8\n\n/* RPN parameters - data bits */\n#define RFCOMM_RPN_DATA_5\t\t0x0\n#define RFCOMM_RPN_DATA_6\t\t0x2\n#define RFCOMM_RPN_DATA_7\t\t0x1\n#define RFCOMM_RPN_DATA_8\t\t0x3\n\n/* RPN parameters - stop bit */\n#define RFCOMM_RPN_STOP_1\t\t0\n#define RFCOMM_RPN_STOP_15\t\t1\n\n/* RPN parameters - parity */\n#define RFCOMM_RPN_PARITY_NONE\t\t0x0\n#define RFCOMM_RPN_PARITY_ODD\t\t0x4\n#define RFCOMM_RPN_PARITY_EVEN\t\t0x5\n#define RFCOMM_RPN_PARITY_MARK\t\t0x6\n#define RFCOMM_RPN_PARITY_SPACE\t\t0x7\n\n/* RPN parameters - flow control */\n#define RFCOMM_RPN_FLOW_NONE\t\t0x00\n#define RFCOMM_RPN_XON_CHAR\t\t0x11\n#define RFCOMM_RPN_XOFF_CHAR\t\t0x13\n\n/* RPN parameters - mask */\n#define RFCOMM_RPN_PM_BITRATE\t\t0x0001\n#define RFCOMM_RPN_PM_DATA\t\t0x0002\n#define RFCOMM_RPN_PM_STOP\t\t0x0004\n#define RFCOMM_RPN_PM_PARITY\t\t0x0008\n#define RFCOMM_RPN_PM_PARITY_TYPE\t0x0010\n#define RFCOMM_RPN_PM_XON\t\t0x0020\n#define RFCOMM_RPN_PM_XOFF\t\t0x0040\n#define RFCOMM_RPN_PM_FLOW\t\t0x3F00\n#define RFCOMM_RPN_PM_ALL\t\t0x3F7F\n\n/* RFCOMM frame header */\nstruct rfcomm_frame_hdr \n{\n\tu_int8_t\taddress;\n\tu_int8_t\tcontrol;\n\tu_int8_t\tlength;\t/* Actual size could be 2 bytes */\n} __attribute__ ((packed));\n\n/* RFCOMM command frame header */\nstruct rfcomm_cmd_hdr\n{\n\tu_int8_t\taddress;\n\tu_int8_t\tcontrol;\n\tu_int8_t\tlength;\n\tu_int8_t\tfcs;\n} __attribute__ ((packed));\n                \n/* RFCOMM MCC command header */\nstruct rfcomm_mcc_hdr\n{\n\tu_int8_t\ttype;\n\tu_int8_t\tlength; /* XXX FIXME Can actual size be 2 bytes?? */\n} __attribute__ ((packed));\n\n/* RFCOMM MSC command */\nstruct rfcomm_mcc_msc\n{\n\tu_int8_t\taddress;\n\tu_int8_t\tmodem;\n} __attribute__ ((packed));\n\n/* RFCOMM RPN command */\nstruct rfcomm_mcc_rpn\n{\n\tu_int8_t\tdlci;\n\tu_int8_t\tbit_rate;\n\tu_int8_t\tline_settings;\n\tu_int8_t\tflow_control;\n\tu_int8_t\txon_char;\n\tu_int8_t\txoff_char;\n\tu_int16_t\tparam_mask;\n} __attribute__ ((packed));\n\n/* RFCOMM RLS command */\nstruct rfcomm_mcc_rls\n{\n\tu_int8_t\taddress;\n\tu_int8_t\tstatus;\n} __attribute__ ((packed));\n\n/* RFCOMM PN command */\nstruct rfcomm_mcc_pn\n{\n\tu_int8_t\tdlci;\n\tu_int8_t\tflow_control;\n\tu_int8_t\tpriority;\n\tu_int8_t\tack_timer;\n\tu_int16_t\tmtu;\n\tu_int8_t\tmax_retrans;\n\tu_int8_t\tcredits;\n} __attribute__ ((packed));\n\n/* RFCOMM frame parsing macros */\n#define RFCOMM_DLCI(b)\t\t\t(((b) & 0xfc) >> 2)\n#define RFCOMM_CHANNEL(b)\t\t(((b) & 0xf8) >> 3)\n#define RFCOMM_DIRECTION(b)\t\t(((b) & 0x04) >> 2)\n#define RFCOMM_TYPE(b)\t\t\t(((b) & 0xef))\n  \n#define RFCOMM_EA(b)\t\t\t(((b) & 0x01))\n#define RFCOMM_CR(b)\t\t\t(((b) & 0x02) >> 1)\n#define RFCOMM_PF(b)\t\t\t(((b) & 0x10) >> 4)\n\n#define RFCOMM_SRVCHANNEL(dlci)\t\t((dlci) >> 1)\n  \n#define RFCOMM_MKADDRESS(cr, dlci) \\\n\t((((dlci) & 0x3f) << 2) | ((cr) << 1) | 0x01)\n\n#define RFCOMM_MKCONTROL(type, pf)\t((((type) & 0xef) | ((pf) << 4)))\n#define RFCOMM_MKDLCI(dir, channel)\t((((channel) & 0x1f) << 1) | (dir))\n\n#define RFCOMM_MKLEN8(len)\t\t(((len) << 1) | 1)\n#define RFCOMM_MKLEN16(len)\t\t((len) << 1)\n\n/* RFCOMM MCC macros */\n#define RFCOMM_MCC_TYPE(b)\t\t(((b) & 0xfc) >> 2)\n#define RFCOMM_MCC_LENGTH(b)\t\t(((b) & 0xfe) >> 1)\n#define RFCOMM_MKMCC_TYPE(cr, type)\t((((type) << 2) | ((cr) << 1) | 0x01))\n   \n/* RPN macros */\n#define RFCOMM_RPN_DATA_BITS(line)\t((line) & 0x3)\n#define RFCOMM_RPN_STOP_BITS(line)\t(((line) >> 2) & 0x1)\n#define RFCOMM_RPN_PARITY(line)\t\t(((line) >> 3) & 0x3)\n#define RFCOMM_MKRPN_LINE_SETTINGS(data, stop, parity) \\\n\t(((data) & 0x3) | (((stop) & 0x1) << 2) | (((parity) & 0x3) << 3))\n\n/*****************************************************************************\n *****************************************************************************\n **                      SOCK_STREAM RFCOMM sockets                         **\n *****************************************************************************\n *****************************************************************************/\n\n#define NG_BTSOCKET_RFCOMM_SENDSPACE \\\n\t(RFCOMM_MAX_CREDITS * RFCOMM_DEFAULT_MTU * 2)\n#define NG_BTSOCKET_RFCOMM_RECVSPACE \\\n\t(RFCOMM_MAX_CREDITS * RFCOMM_DEFAULT_MTU * 2)\n\n/*\n * Bluetooth RFCOMM session. One L2CAP connection == one RFCOMM session\n */\n\nstruct ng_btsocket_rfcomm_pcb;\nstruct ng_btsocket_rfcomm_session;\n\nstruct ng_btsocket_rfcomm_session {\n\tstruct socket\t\t\t\t*l2so;\t /* L2CAP socket */\n\n\tu_int16_t\t\t\t\t state;  /* session state */\n#define NG_BTSOCKET_RFCOMM_SESSION_CLOSED\t 0\n#define NG_BTSOCKET_RFCOMM_SESSION_LISTENING\t 1\n#define NG_BTSOCKET_RFCOMM_SESSION_CONNECTING\t 2 \n#define NG_BTSOCKET_RFCOMM_SESSION_CONNECTED\t 3\n#define NG_BTSOCKET_RFCOMM_SESSION_OPEN\t\t 4\n#define NG_BTSOCKET_RFCOMM_SESSION_DISCONNECTING 5\n\n\tu_int16_t\t\t\t\t flags;  /* session flags */\n#define NG_BTSOCKET_RFCOMM_SESSION_INITIATOR\t(1 << 0) /* initiator */\n#define NG_BTSOCKET_RFCOMM_SESSION_LFC\t\t(1 << 1) /* local flow */\n#define NG_BTSOCKET_RFCOMM_SESSION_RFC\t\t(1 << 2) /* remote flow */\n\n#define INITIATOR(s) \\\n\t(((s)->flags & NG_BTSOCKET_RFCOMM_SESSION_INITIATOR)? 1 : 0)\n\n\tu_int16_t\t\t\t\t mtu;    /* default MTU */\n\tstruct ng_bt_mbufq\t\t\t outq;   /* outgoing queue */\n\n\tstruct mtx\t\t\t\t session_mtx; /* session lock */\n\tLIST_HEAD(, ng_btsocket_rfcomm_pcb)\t dlcs;\t /* active DLC */\n\n\tLIST_ENTRY(ng_btsocket_rfcomm_session)\t next;\t /* link to next */\n};\ntypedef struct ng_btsocket_rfcomm_session\tng_btsocket_rfcomm_session_t;\ntypedef struct ng_btsocket_rfcomm_session *\tng_btsocket_rfcomm_session_p;\n\n/*\n * Bluetooth RFCOMM socket PCB (DLC)\n */\n\nstruct ng_btsocket_rfcomm_pcb {\n\tstruct socket\t\t\t\t*so;\t  /* RFCOMM socket */\n\tstruct ng_btsocket_rfcomm_session\t*session; /* RFCOMM session */\n\n\tu_int16_t\t\t\t\t flags;   /* DLC flags */\n#define NG_BTSOCKET_RFCOMM_DLC_TIMO\t\t(1 << 0)  /* timeout pending */\n#define NG_BTSOCKET_RFCOMM_DLC_CFC\t\t(1 << 1)  /* credit flow ctrl */\n#define NG_BTSOCKET_RFCOMM_DLC_TIMEDOUT\t\t(1 << 2)  /* timeout happend */\n#define NG_BTSOCKET_RFCOMM_DLC_DETACHED\t\t(1 << 3)  /* DLC detached */\n#define NG_BTSOCKET_RFCOMM_DLC_SENDING\t\t(1 << 4)  /* send pending */\n\n\tu_int16_t\t\t\t\t state;   /* DLC state */\n#define NG_BTSOCKET_RFCOMM_DLC_CLOSED\t\t0\n#define NG_BTSOCKET_RFCOMM_DLC_W4_CONNECT\t1\n#define NG_BTSOCKET_RFCOMM_DLC_CONFIGURING\t2\n#define NG_BTSOCKET_RFCOMM_DLC_CONNECTING\t3\n#define NG_BTSOCKET_RFCOMM_DLC_CONNECTED\t4\n#define NG_BTSOCKET_RFCOMM_DLC_DISCONNECTING\t5\n\n\tbdaddr_t\t\t\t\t src;     /* source address */\n\tbdaddr_t\t\t\t\t dst;     /* dest. address */\n\n\tu_int8_t\t\t\t\t channel; /* RFCOMM channel */\n\tu_int8_t\t\t\t\t dlci;    /* RFCOMM DLCI */\n\n\tu_int8_t\t\t\t\t lmodem;  /* local mdm signls */\n\tu_int8_t\t\t\t\t rmodem;  /* remote -/- */\n\n\tu_int16_t\t\t\t\t mtu;\t  /* MTU */\n\tint16_t\t\t\t\t\t rx_cred; /* RX credits */\n\tint16_t\t\t\t\t\t tx_cred; /* TX credits */\n\n\tstruct mtx\t\t\t\t pcb_mtx; /* PCB lock */\n\tstruct callout_handle\t\t\t timo;    /* timeout */\n\n\tLIST_ENTRY(ng_btsocket_rfcomm_pcb)\t session_next;/* link to next */\n\tLIST_ENTRY(ng_btsocket_rfcomm_pcb)\t next;\t  /* link to next */\n};\ntypedef struct ng_btsocket_rfcomm_pcb\tng_btsocket_rfcomm_pcb_t;\ntypedef struct ng_btsocket_rfcomm_pcb *\tng_btsocket_rfcomm_pcb_p;\n\n#define\tso2rfcomm_pcb(so) \\\n\t((struct ng_btsocket_rfcomm_pcb *)((so)->so_pcb))\n\n/*\n * Bluetooth RFCOMM socket methods\n */\n\n#ifdef _KERNEL\n\nvoid ng_btsocket_rfcomm_init       (void);\nvoid ng_btsocket_rfcomm_abort      (struct socket *);\nvoid ng_btsocket_rfcomm_close      (struct socket *);\nint  ng_btsocket_rfcomm_accept     (struct socket *, struct sockaddr **);\nint  ng_btsocket_rfcomm_attach     (struct socket *, int, struct thread *);\nint  ng_btsocket_rfcomm_bind       (struct socket *, struct sockaddr *,\n                                    struct thread *);\nint  ng_btsocket_rfcomm_connect    (struct socket *, struct sockaddr *,\n                                    struct thread *);\nint  ng_btsocket_rfcomm_control    (struct socket *, u_long, caddr_t,\n                                    struct ifnet *, struct thread *);\nint  ng_btsocket_rfcomm_ctloutput  (struct socket *, struct sockopt *);\nvoid ng_btsocket_rfcomm_detach     (struct socket *);\nint  ng_btsocket_rfcomm_disconnect (struct socket *);\nint  ng_btsocket_rfcomm_listen     (struct socket *, int, struct thread *);\nint  ng_btsocket_rfcomm_peeraddr   (struct socket *, struct sockaddr **);\nint  ng_btsocket_rfcomm_send       (struct socket *, int, struct mbuf *,\n                                    struct sockaddr *, struct mbuf *,\n                                    struct thread *);\nint  ng_btsocket_rfcomm_sockaddr   (struct socket *, struct sockaddr **);\n\n#endif /* _KERNEL */\n\n#endif /* _NETGRAPH_BTSOCKET_RFCOMM_H_ */\n\n"
  },
  {
    "path": "freebsd-headers/netgraph/bluetooth/include/ng_btsocket_sco.h",
    "content": "/*\n * ng_btsocket_sco.h\n */\n\n/*-\n * Copyright (c) 2001-2002 Maksim Yevmenkin <m_evmenkin@yahoo.com>\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $Id: ng_btsocket_sco.h,v 1.3 2005/10/31 18:08:52 max Exp $\n * $FreeBSD: release/9.0.0/sys/netgraph/bluetooth/include/ng_btsocket_sco.h 181033 2008-07-30 22:41:23Z emax $\n */\n\n#ifndef _NETGRAPH_BTSOCKET_SCO_H_\n#define _NETGRAPH_BTSOCKET_SCO_H_\n\n/*\n * SCO routing entry\n */\n\nstruct ng_hook;\nstruct ng_message;\n\nstruct ng_btsocket_sco_rtentry {\n\tbdaddr_t\t\t\t\t src;  /* source BD_ADDR */\n\tu_int16_t\t\t\t\t pkt_size; /* mtu */\n\tu_int16_t\t\t\t\t num_pkts; /* buffer size */\n\tint32_t\t\t\t\t\t pending; /* pending packets */\n\tstruct ng_hook\t\t\t\t*hook; /* downstream hook */\n\tLIST_ENTRY(ng_btsocket_sco_rtentry)\t next; /* link to next */\n};\ntypedef struct ng_btsocket_sco_rtentry\t\tng_btsocket_sco_rtentry_t;\ntypedef struct ng_btsocket_sco_rtentry *\tng_btsocket_sco_rtentry_p;\n\n/*****************************************************************************\n *****************************************************************************\n **                      SOCK_SEQPACKET SCO sockets                         **\n *****************************************************************************\n *****************************************************************************/\n\n#define NG_BTSOCKET_SCO_SENDSPACE\t1024\n#define NG_BTSOCKET_SCO_RECVSPACE\t(64 * 1024)\n\n/*\n * Bluetooth SCO socket PCB\n */\n\nstruct ng_btsocket_sco_pcb {\n\tstruct socket\t\t\t*so;\t     /* Pointer to socket */\n\n\tbdaddr_t\t\t\t src;\t     /* Source address */\n\tbdaddr_t\t\t\t dst;\t     /* Destination address */\n\n\tu_int16_t\t\t\t con_handle; /* connection handle */\n\n\tu_int16_t\t\t\t flags;      /* socket flags */\n#define NG_BTSOCKET_SCO_CLIENT\t\t(1 << 0)     /* socket is client */\n#define NG_BTSOCKET_SCO_TIMO\t\t(1 << 1)     /* timeout pending */\n\n\tu_int8_t\t\t\t state;      /* socket state */\n#define NG_BTSOCKET_SCO_CLOSED\t\t0            /* socket closed */\n#define NG_BTSOCKET_SCO_CONNECTING\t1            /* wait for connect */\n#define NG_BTSOCKET_SCO_OPEN\t\t2            /* socket open */\n#define NG_BTSOCKET_SCO_DISCONNECTING\t3            /* wait for disconnect */\n\n\tstruct callout\t\t\t timo;       /* timeout */\n\n\tng_btsocket_sco_rtentry_p\t rt;         /* routing info */\n\n\tstruct mtx\t\t\t pcb_mtx;    /* pcb mutex */\n\n\tLIST_ENTRY(ng_btsocket_sco_pcb)\t next;       /* link to next PCB */\n};\ntypedef struct ng_btsocket_sco_pcb\tng_btsocket_sco_pcb_t;\ntypedef struct ng_btsocket_sco_pcb *\tng_btsocket_sco_pcb_p;\n\n#define\tso2sco_pcb(so) \\\n\t((struct ng_btsocket_sco_pcb *)((so)->so_pcb))\n\n/*\n * Bluetooth SCO socket methods\n */\n\n#ifdef _KERNEL\n\nvoid ng_btsocket_sco_init       (void);\nvoid ng_btsocket_sco_abort      (struct socket *);\nvoid ng_btsocket_sco_close      (struct socket *);\nint  ng_btsocket_sco_accept     (struct socket *, struct sockaddr **);\nint  ng_btsocket_sco_attach     (struct socket *, int, struct thread *);\nint  ng_btsocket_sco_bind       (struct socket *, struct sockaddr *,\n                                   struct thread *);\nint  ng_btsocket_sco_connect    (struct socket *, struct sockaddr *,\n                                   struct thread *);\nint  ng_btsocket_sco_control    (struct socket *, u_long, caddr_t,\n                                   struct ifnet *, struct thread *);\nint  ng_btsocket_sco_ctloutput  (struct socket *, struct sockopt *);\nvoid ng_btsocket_sco_detach     (struct socket *);\nint  ng_btsocket_sco_disconnect (struct socket *);\nint  ng_btsocket_sco_listen     (struct socket *, int, struct thread *);\nint  ng_btsocket_sco_peeraddr   (struct socket *, struct sockaddr **);\nint  ng_btsocket_sco_send       (struct socket *, int, struct mbuf *,\n                                   struct sockaddr *, struct mbuf *,\n                                   struct thread *);\nint  ng_btsocket_sco_sockaddr   (struct socket *, struct sockaddr **);\n\n#endif /* _KERNEL */\n\n#endif /* _NETGRAPH_BTSOCKET_SCO_H_ */\n\n"
  },
  {
    "path": "freebsd-headers/netgraph/bluetooth/include/ng_h4.h",
    "content": "/*\n * ng_h4.h\n */\n\n/*-\n * Copyright (c) 2001-2002 Maksim Yevmenkin <m_evmenkin@yahoo.com>\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $Id: ng_h4.h,v 1.1 2002/11/24 19:47:05 max Exp $\n * $FreeBSD: release/9.0.0/sys/netgraph/bluetooth/include/ng_h4.h 139823 2005-01-07 01:45:51Z imp $\n * \n * Based on:\n * ---------\n *\n * FreeBSD: src/sys/netgraph/ng_tty.h\n * Author: Archie Cobbs <archie@freebsd.org>\n */\n\n/*\n * This file contains everything that application needs to know about\n * Bluetooth HCI UART transport layer as per chapter H4 of the Bluetooth\n * Specification Book v1.1.\n *\n * This file can be included by both kernel and userland applications.\n */\n\n#ifndef _NETGRAPH_H4_H_\n#define _NETGRAPH_H4_H_\n\n/**************************************************************************\n **************************************************************************\n **     Netgraph node hook name, type name and type cookie and commands\n **************************************************************************\n **************************************************************************/\n\n/* Hook name */\n#define NG_H4_HOOK\t\t\"hook\"\n\n/* Node type name and magic cookie */\n#define NG_H4_NODE_TYPE\t\t\"h4\"\n#define NGM_H4_COOKIE\t\t1013899512\n\n/* Node states */\n#define NG_H4_W4_PKT_IND\t1\t/* Waiting for packet indicator */\n#define NG_H4_W4_PKT_HDR\t2\t/* Waiting for packet header */\n#define NG_H4_W4_PKT_DATA\t3\t/* Waiting for packet data */\n\n/* Debug levels */\n#define NG_H4_ALERT_LEVEL\t1\n#define NG_H4_ERR_LEVEL\t\t2\n#define NG_H4_WARN_LEVEL\t3\n#define NG_H4_INFO_LEVEL\t4\n\n/**************************************************************************\n **************************************************************************\n **                    H4 node command/event parameters\n **************************************************************************\n **************************************************************************/\n\n/* Reset node */\n#define NGM_H4_NODE_RESET\t1\n\n/* Get node state (see states above) */\n#define NGM_H4_NODE_GET_STATE\t2\ntypedef u_int16_t\tng_h4_node_state_ep;\n\n/* Get/Set node debug level (see levels above) */\n#define NGM_H4_NODE_GET_DEBUG\t3\n#define NGM_H4_NODE_SET_DEBUG\t4\ntypedef u_int16_t\tng_h4_node_debug_ep;\n\n/* Get/Set max queue length for the node */\n#define NGM_H4_NODE_GET_QLEN\t5\n#define NGM_H4_NODE_SET_QLEN\t6\ntypedef int32_t\t\tng_h4_node_qlen_ep;\n\n/* Get node statistic */\n#define NGM_H4_NODE_GET_STAT\t7\ntypedef struct {\n\tu_int32_t\tpckts_recv; /* # of packets received */\n\tu_int32_t\tbytes_recv; /* # of bytes received */\n\tu_int32_t\tpckts_sent; /* # of packets sent */\n\tu_int32_t\tbytes_sent; /* # of bytes sent */\n\tu_int32_t\toerrors;    /* # of output errors */\n\tu_int32_t\tierrors;    /* # of input errors */\n} ng_h4_node_stat_ep;\n\n/* Reset node statistic */\n#define NGM_H4_NODE_RESET_STAT\t8\n\n#endif /* _NETGRAPH_H4_H_ */\n\n"
  },
  {
    "path": "freebsd-headers/netgraph/bluetooth/include/ng_hci.h",
    "content": "/*\n * ng_hci.h\n */\n\n/*-\n * Copyright (c) 2001 Maksim Yevmenkin <m_evmenkin@yahoo.com>\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $Id: ng_hci.h,v 1.2 2003/03/18 00:09:37 max Exp $\n * $FreeBSD: release/9.0.0/sys/netgraph/bluetooth/include/ng_hci.h 158672 2006-05-17 00:13:07Z emax $\n */\n\n/*\n * This file contains everything that application needs to know about\n * Host Controller Interface (HCI). All information was obtained from\n * Bluetooth Specification Book v1.1.\n *\n * This file can be included by both kernel and userland applications.\n *\n * NOTE: Here and after Bluetooth device is called a \"unit\". Bluetooth\n *       specification refers to both devices and units. They are the\n *       same thing (i think), so to be consistent word \"unit\" will be\n *       used.\n */\n\n#ifndef _NETGRAPH_HCI_H_\n#define _NETGRAPH_HCI_H_\n\n/**************************************************************************\n **************************************************************************\n **     Netgraph node hook name, type name and type cookie and commands\n **************************************************************************\n **************************************************************************/\n\n/* Node type name and type cookie */\n#define NG_HCI_NODE_TYPE\t\t\t\"hci\"\n#define NGM_HCI_COOKIE\t\t\t\t1000774184\n\n/* Netgraph node hook names */\n#define NG_HCI_HOOK_DRV\t\t\t\t\"drv\" /* Driver <-> HCI */\n#define NG_HCI_HOOK_ACL\t\t\t\t\"acl\" /* HCI <-> Upper */\n#define NG_HCI_HOOK_SCO\t\t\t\t\"sco\" /* HCI <-> Upper */ \n#define NG_HCI_HOOK_RAW\t\t\t\t\"raw\" /* HCI <-> Upper */ \n\n/**************************************************************************\n **************************************************************************\n **                   Common defines and types (HCI)\n **************************************************************************\n **************************************************************************/\n\n/* All sizes are in bytes */\n#define NG_HCI_BDADDR_SIZE\t\t\t6   /* unit address */\n#define NG_HCI_LAP_SIZE\t\t\t\t3   /* unit LAP */\n#define NG_HCI_KEY_SIZE\t\t\t\t16  /* link key */\n#define NG_HCI_PIN_SIZE\t\t\t\t16  /* link PIN */\n#define NG_HCI_EVENT_MASK_SIZE\t\t\t8   /* event mask */\n#define NG_HCI_CLASS_SIZE\t\t\t3   /* unit class */\n#define NG_HCI_FEATURES_SIZE\t\t\t8   /* LMP features */\n#define NG_HCI_UNIT_NAME_SIZE\t\t\t248 /* unit name size */\n\n/* HCI specification */\n#define NG_HCI_SPEC_V10\t\t\t\t0x00 /* v1.0 */\n#define NG_HCI_SPEC_V11\t\t\t\t0x01 /* v1.1 */\n/* 0x02 - 0xFF - reserved for future use */\n\n/* LMP features */\n/* ------------------- byte 0 --------------------*/\n#define NG_HCI_LMP_3SLOT\t\t\t0x01\n#define NG_HCI_LMP_5SLOT\t\t\t0x02\n#define NG_HCI_LMP_ENCRYPTION\t\t\t0x04\n#define NG_HCI_LMP_SLOT_OFFSET\t\t\t0x08\n#define NG_HCI_LMP_TIMING_ACCURACY\t\t0x10\n#define NG_HCI_LMP_SWITCH\t\t\t0x20\n#define NG_HCI_LMP_HOLD_MODE\t\t\t0x40\n#define NG_HCI_LMP_SNIFF_MODE\t\t\t0x80\n/* ------------------- byte 1 --------------------*/\n#define NG_HCI_LMP_PARK_MODE\t\t\t0x01\n#define NG_HCI_LMP_RSSI\t\t\t\t0x02\n#define NG_HCI_LMP_CHANNEL_QUALITY\t\t0x04\n#define NG_HCI_LMP_SCO_LINK\t\t\t0x08\n#define NG_HCI_LMP_HV2_PKT\t\t\t0x10\n#define NG_HCI_LMP_HV3_PKT\t\t\t0x20\n#define NG_HCI_LMP_ULAW_LOG\t\t\t0x40\n#define NG_HCI_LMP_ALAW_LOG\t\t\t0x80\n/* ------------------- byte 2 --------------------*/\n#define NG_HCI_LMP_CVSD\t\t\t\t0x01\n#define NG_HCI_LMP_PAGING_SCHEME\t\t0x02\n#define NG_HCI_LMP_POWER_CONTROL\t\t0x04\n#define NG_HCI_LMP_TRANSPARENT_SCO\t\t0x08\n#define NG_HCI_LMP_FLOW_CONTROL_LAG0\t\t0x10\n#define NG_HCI_LMP_FLOW_CONTROL_LAG1\t\t0x20\n#define NG_HCI_LMP_FLOW_CONTROL_LAG2\t\t0x40\n\n/* Link types */\n#define NG_HCI_LINK_SCO\t\t\t\t0x00 /* Voice */\n#define NG_HCI_LINK_ACL\t\t\t\t0x01 /* Data */\n/* 0x02 - 0xFF - reserved for future use */\n\n/* Packet types */\n\t\t\t\t/* 0x0001 - 0x0004 - reserved for future use */\n#define NG_HCI_PKT_DM1\t\t\t\t0x0008 /* ACL link */\n#define NG_HCI_PKT_DH1\t\t\t\t0x0010 /* ACL link */\n#define NG_HCI_PKT_HV1\t\t\t\t0x0020 /* SCO link */\n#define NG_HCI_PKT_HV2\t\t\t\t0x0040 /* SCO link */\n#define NG_HCI_PKT_HV3\t\t\t\t0x0080 /* SCO link */\n\t\t\t\t/* 0x0100 - 0x0200 - reserved for future use */\n#define NG_HCI_PKT_DM3\t\t\t\t0x0400 /* ACL link */\n#define NG_HCI_PKT_DH3\t\t\t\t0x0800 /* ACL link */\n\t\t\t\t/* 0x1000 - 0x2000 - reserved for future use */\n#define NG_HCI_PKT_DM5\t\t\t\t0x4000 /* ACL link */\n#define NG_HCI_PKT_DH5\t\t\t\t0x8000 /* ACL link */\n\n/* \n * Connection modes/Unit modes\n *\n * This is confusing. It means that one of the units change its mode\n * for the specific connection. For example one connection was put on \n * hold (but i could be wrong :) \n */\n\n#define NG_HCI_UNIT_MODE_ACTIVE\t\t\t0x00\n#define NG_HCI_UNIT_MODE_HOLD\t\t\t0x01\n#define NG_HCI_UNIT_MODE_SNIFF\t\t\t0x02\n#define NG_HCI_UNIT_MODE_PARK\t\t\t0x03\n/* 0x04 - 0xFF - reserved for future use */\n\n/* Page scan modes */\n#define NG_HCI_MANDATORY_PAGE_SCAN_MODE\t\t0x00\n#define NG_HCI_OPTIONAL_PAGE_SCAN_MODE1\t\t0x01\n#define NG_HCI_OPTIONAL_PAGE_SCAN_MODE2\t\t0x02\n#define NG_HCI_OPTIONAL_PAGE_SCAN_MODE3\t\t0x03\n/* 0x04 - 0xFF - reserved for future use */\n\n/* Page scan repetition modes */\n#define NG_HCI_SCAN_REP_MODE0\t\t\t0x00\n#define NG_HCI_SCAN_REP_MODE1\t\t\t0x01\n#define NG_HCI_SCAN_REP_MODE2\t\t\t0x02\n/* 0x03 - 0xFF - reserved for future use */\n\n/* Page scan period modes */\n#define NG_HCI_PAGE_SCAN_PERIOD_MODE0\t\t0x00\n#define NG_HCI_PAGE_SCAN_PERIOD_MODE1\t\t0x01\n#define NG_HCI_PAGE_SCAN_PERIOD_MODE2\t\t0x02\n/* 0x03 - 0xFF - reserved for future use */\n\n/* Scan enable */\n#define NG_HCI_NO_SCAN_ENABLE\t\t\t0x00\n#define NG_HCI_INQUIRY_ENABLE_PAGE_DISABLE\t0x01\n#define NG_HCI_INQUIRY_DISABLE_PAGE_ENABLE\t0x02\n#define NG_HCI_INQUIRY_ENABLE_PAGE_ENABLE\t0x03\n/* 0x04 - 0xFF - reserved for future use */\n\n/* Hold mode activities */\n#define NG_HCI_HOLD_MODE_NO_CHANGE\t\t0x00\n#define NG_HCI_HOLD_MODE_SUSPEND_PAGE_SCAN\t0x01\n#define NG_HCI_HOLD_MODE_SUSPEND_INQUIRY_SCAN\t0x02\n#define NG_HCI_HOLD_MODE_SUSPEND_PERIOD_INQUIRY\t0x04\n/* 0x08 - 0x80 - reserved for future use */\n\n/* Connection roles */\n#define NG_HCI_ROLE_MASTER\t\t\t0x00\n#define NG_HCI_ROLE_SLAVE\t\t\t0x01\n/* 0x02 - 0xFF - reserved for future use */\n\n/* Key flags */\n#define NG_HCI_USE_SEMI_PERMANENT_LINK_KEYS\t0x00\n#define NG_HCI_USE_TEMPORARY_LINK_KEY\t\t0x01\n/* 0x02 - 0xFF - reserved for future use */\n\n/* Pin types */\n#define NG_HCI_PIN_TYPE_VARIABLE\t\t0x00\n#define NG_HCI_PIN_TYPE_FIXED\t\t\t0x01\n\n/* Link key types */\n#define NG_HCI_LINK_KEY_TYPE_COMBINATION_KEY\t0x00\n#define NG_HCI_LINK_KEY_TYPE_LOCAL_UNIT_KEY\t0x01\n#define NG_HCI_LINK_KEY_TYPE_REMOTE_UNIT_KEY\t0x02\n/* 0x03 - 0xFF - reserved for future use */\n\n/* Encryption modes */\n#define NG_HCI_ENCRYPTION_MODE_NONE\t\t0x00\n#define NG_HCI_ENCRYPTION_MODE_P2P\t\t0x01\n#define NG_HCI_ENCRYPTION_MODE_ALL\t\t0x02\n/* 0x03 - 0xFF - reserved for future use */\n\n/* Quality of service types */\n#define NG_HCI_SERVICE_TYPE_NO_TRAFFIC\t\t0x00\n#define NG_HCI_SERVICE_TYPE_BEST_EFFORT\t\t0x01\n#define NG_HCI_SERVICE_TYPE_GUARANTEED\t\t0x02\n/* 0x03 - 0xFF - reserved for future use */\n\n/* Link policy settings */\n#define NG_HCI_LINK_POLICY_DISABLE_ALL_LM_MODES\t0x0000\n#define NG_HCI_LINK_POLICY_ENABLE_ROLE_SWITCH\t0x0001 /* Master/Slave switch */\n#define NG_HCI_LINK_POLICY_ENABLE_HOLD_MODE\t0x0002\n#define NG_HCI_LINK_POLICY_ENABLE_SNIFF_MODE\t0x0004\n#define NG_HCI_LINK_POLICY_ENABLE_PARK_MODE\t0x0008\n/* 0x0010 - 0x8000 - reserved for future use */\n\n/* Event masks */\n#define NG_HCI_EVMSK_ALL\t\t\t0x00000000ffffffff\n#define NG_HCI_EVMSK_NONE\t\t\t0x0000000000000000\n#define NG_HCI_EVMSK_INQUIRY_COMPL\t\t0x0000000000000001\n#define NG_HCI_EVMSK_INQUIRY_RESULT\t\t0x0000000000000002\n#define NG_HCI_EVMSK_CON_COMPL\t\t\t0x0000000000000004\n#define NG_HCI_EVMSK_CON_REQ\t\t\t0x0000000000000008\n#define NG_HCI_EVMSK_DISCON_COMPL\t\t0x0000000000000010\n#define NG_HCI_EVMSK_AUTH_COMPL\t\t\t0x0000000000000020\n#define NG_HCI_EVMSK_REMOTE_NAME_REQ_COMPL\t0x0000000000000040\n#define NG_HCI_EVMSK_ENCRYPTION_CHANGE\t\t0x0000000000000080\n#define NG_HCI_EVMSK_CHANGE_CON_LINK_KEY_COMPL\t0x0000000000000100\n#define NG_HCI_EVMSK_MASTER_LINK_KEY_COMPL\t0x0000000000000200\n#define NG_HCI_EVMSK_READ_REMOTE_FEATURES_COMPL\t0x0000000000000400\n#define NG_HCI_EVMSK_READ_REMOTE_VER_INFO_COMPL\t0x0000000000000800\n#define NG_HCI_EVMSK_QOS_SETUP_COMPL\t\t0x0000000000001000\n#define NG_HCI_EVMSK_COMMAND_COMPL\t\t0x0000000000002000\n#define NG_HCI_EVMSK_COMMAND_STATUS\t\t0x0000000000004000\n#define NG_HCI_EVMSK_HARDWARE_ERROR\t\t0x0000000000008000\n#define NG_HCI_EVMSK_FLUSH_OCCUR\t\t0x0000000000010000\n#define NG_HCI_EVMSK_ROLE_CHANGE\t\t0x0000000000020000\n#define NG_HCI_EVMSK_NUM_COMPL_PKTS\t\t0x0000000000040000\n#define NG_HCI_EVMSK_MODE_CHANGE\t\t0x0000000000080000\n#define NG_HCI_EVMSK_RETURN_LINK_KEYS\t\t0x0000000000100000\n#define NG_HCI_EVMSK_PIN_CODE_REQ\t\t0x0000000000200000\n#define NG_HCI_EVMSK_LINK_KEY_REQ\t\t0x0000000000400000\n#define NG_HCI_EVMSK_LINK_KEY_NOTIFICATION\t0x0000000000800000\n#define NG_HCI_EVMSK_LOOPBACK_COMMAND\t\t0x0000000001000000\n#define NG_HCI_EVMSK_DATA_BUFFER_OVERFLOW\t0x0000000002000000\n#define NG_HCI_EVMSK_MAX_SLOT_CHANGE\t\t0x0000000004000000\n#define NG_HCI_EVMSK_READ_CLOCK_OFFSET_COMLETE\t0x0000000008000000\n#define NG_HCI_EVMSK_CON_PKT_TYPE_CHANGED\t0x0000000010000000\n#define NG_HCI_EVMSK_QOS_VIOLATION\t\t0x0000000020000000\n#define NG_HCI_EVMSK_PAGE_SCAN_MODE_CHANGE\t0x0000000040000000\n#define NG_HCI_EVMSK_PAGE_SCAN_REP_MODE_CHANGE\t0x0000000080000000\n/* 0x0000000100000000 - 0x8000000000000000 - reserved for future use */\n\n/* Filter types */\n#define NG_HCI_FILTER_TYPE_NONE\t\t\t0x00\n#define NG_HCI_FILTER_TYPE_INQUIRY_RESULT\t0x01\n#define NG_HCI_FILTER_TYPE_CON_SETUP\t\t0x02\n/* 0x03 - 0xFF - reserved for future use */\n\n/* Filter condition types for NG_HCI_FILTER_TYPE_INQUIRY_RESULT */\n#define NG_HCI_FILTER_COND_INQUIRY_NEW_UNIT\t0x00\n#define NG_HCI_FILTER_COND_INQUIRY_UNIT_CLASS\t0x01\n#define NG_HCI_FILTER_COND_INQUIRY_BDADDR\t0x02\n/* 0x03 - 0xFF - reserved for future use */\n\n/* Filter condition types for NG_HCI_FILTER_TYPE_CON_SETUP */\n#define NG_HCI_FILTER_COND_CON_ANY_UNIT\t\t0x00\n#define NG_HCI_FILTER_COND_CON_UNIT_CLASS\t0x01\n#define NG_HCI_FILTER_COND_CON_BDADDR\t\t0x02\n/* 0x03 - 0xFF - reserved for future use */\n\n/* Xmit level types */\n#define NG_HCI_XMIT_LEVEL_CURRENT\t\t0x00\n#define NG_HCI_XMIT_LEVEL_MAXIMUM\t\t0x01\n/* 0x02 - 0xFF - reserved for future use */\n\n/* Host to Host Controller flow control */\n#define NG_HCI_H2HC_FLOW_CONTROL_NONE\t\t0x00\n#define NG_HCI_H2HC_FLOW_CONTROL_ACL\t\t0x01\n#define NG_HCI_H2HC_FLOW_CONTROL_SCO\t\t0x02\n#define NG_HCI_H2HC_FLOW_CONTROL_BOTH\t\t0x03\t/* ACL and SCO */\n/* 0x04 - 0xFF - reserved future use */\n\n/* Country codes */\n#define NG_HCI_COUNTRY_CODE_NAM_EUR_JP\t\t0x00\n#define NG_HCI_COUNTRY_CODE_FRANCE\t\t0x01\n/* 0x02 - 0xFF - reserved future use */\n\n/* Loopback modes */\n#define NG_HCI_LOOPBACK_NONE\t\t\t0x00\n#define NG_HCI_LOOPBACK_LOCAL\t\t\t0x01\n#define NG_HCI_LOOPBACK_REMOTE\t\t\t0x02\n/* 0x03 - 0xFF - reserved future use */\n\n/**************************************************************************\n **************************************************************************\n **                 Link level defines, headers and types\n **************************************************************************\n **************************************************************************/\n\n/* \n * Macro(s) to combine OpCode and extract OGF (OpCode Group Field) \n * and OCF (OpCode Command Field) from OpCode.\n */\n\n#define NG_HCI_OPCODE(gf,cf)\t\t((((gf) & 0x3f) << 10) | ((cf) & 0x3ff))\n#define NG_HCI_OCF(op)\t\t\t((op) & 0x3ff)\n#define NG_HCI_OGF(op)\t\t\t(((op) >> 10) & 0x3f)\n\n/* \n * Marco(s) to extract/combine connection handle, BC (Broadcast) and \n * PB (Packet boundary) flags.\n */\n\n#define NG_HCI_CON_HANDLE(h)\t\t((h) & 0x0fff)\n#define NG_HCI_PB_FLAG(h)\t\t(((h) & 0x3000) >> 12)\n#define NG_HCI_BC_FLAG(h)\t\t(((h) & 0xc000) >> 14)\n#define NG_HCI_MK_CON_HANDLE(h, pb, bc) \\\n\t(((h) & 0x0fff) | (((pb) & 3) << 12) | (((bc) & 3) << 14))\n\n/* PB flag values */\n\t\t\t\t\t/* 00 - reserved for future use */\n#define\tNG_HCI_PACKET_FRAGMENT\t\t0x1 \n#define\tNG_HCI_PACKET_START\t\t0x2\n\t\t\t\t\t/* 11 - reserved for future use */\n\n/* BC flag values */\n#define NG_HCI_POINT2POINT\t\t0x0 /* only Host controller to Host */\n#define NG_HCI_BROADCAST_ACTIVE\t\t0x1 /* both directions */\n#define NG_HCI_BROADCAST_PICONET\t0x2 /* both directions */\n\t\t\t\t\t/* 11 - reserved for future use */\n\n/* HCI command packet header */\n#define NG_HCI_CMD_PKT\t\t\t0x01\n#define NG_HCI_CMD_PKT_SIZE\t\t0xff /* without header */\ntypedef struct {\n\tu_int8_t\ttype;   /* MUST be 0x1 */\n\tu_int16_t\topcode; /* OpCode */\n\tu_int8_t\tlength; /* parameter(s) length in bytes */\n} __attribute__ ((packed)) ng_hci_cmd_pkt_t;\n\n/* ACL data packet header */\n#define NG_HCI_ACL_DATA_PKT\t\t0x02\n#define NG_HCI_ACL_PKT_SIZE\t\t0xffff /* without header */\ntypedef struct {\n\tu_int8_t\ttype;        /* MUST be 0x2 */\n\tu_int16_t\tcon_handle;  /* connection handle + PB + BC flags */\n\tu_int16_t\tlength;      /* payload length in bytes */\n} __attribute__ ((packed)) ng_hci_acldata_pkt_t;\n\n/* SCO data packet header */\n#define NG_HCI_SCO_DATA_PKT\t\t0x03\n#define NG_HCI_SCO_PKT_SIZE\t\t0xff /* without header */\ntypedef struct {\n\tu_int8_t\ttype;       /* MUST be 0x3 */\n\tu_int16_t\tcon_handle; /* connection handle + reserved bits */\n\tu_int8_t\tlength;     /* payload length in bytes */\n} __attribute__ ((packed)) ng_hci_scodata_pkt_t;\n\n/* HCI event packet header */\n#define NG_HCI_EVENT_PKT\t\t0x04\n#define NG_HCI_EVENT_PKT_SIZE\t\t0xff /* without header */\ntypedef struct {\n\tu_int8_t\ttype;   /* MUST be 0x4 */\n\tu_int8_t\tevent;  /* event */\n\tu_int8_t\tlength; /* parameter(s) length in bytes */\n} __attribute__ ((packed)) ng_hci_event_pkt_t;\n\n/* Bluetooth unit address */\ntypedef struct {\n\tu_int8_t\tb[NG_HCI_BDADDR_SIZE];\n} __attribute__ ((packed)) bdaddr_t;\ntypedef bdaddr_t *\tbdaddr_p;\n\n/* Any BD_ADDR. Note: This is actually 7 bytes (count '\\0' terminator) */\n#define NG_HCI_BDADDR_ANY\t((bdaddr_p) \"\\000\\000\\000\\000\\000\\000\")\n\n/* HCI status return parameter */\ntypedef struct {\n\tu_int8_t\tstatus; /* 0x00 - success */\n} __attribute__ ((packed)) ng_hci_status_rp;\n\n/**************************************************************************\n **************************************************************************\n **        Upper layer protocol interface. LP_xxx event parameters\n **************************************************************************\n **************************************************************************/\n\n/* Connection Request Event */\n#define NGM_HCI_LP_CON_REQ\t\t\t1  /* Upper -> HCI */\ntypedef struct {\n\tu_int16_t\tlink_type; /* type of connection */\n\tbdaddr_t\tbdaddr;    /* remote unit address */\n} ng_hci_lp_con_req_ep;\n\n/*\n * XXX XXX XXX\n *\n * NOTE: This request is not defined by Bluetooth specification, \n * but i find it useful :)\n */\n#define NGM_HCI_LP_DISCON_REQ\t\t\t2 /* Upper -> HCI */\ntypedef struct {\n\tu_int16_t\tcon_handle; /* connection handle */\n\tu_int16_t\treason;\t    /* reason to disconnect (only low byte) */\n} ng_hci_lp_discon_req_ep;\n\n/* Connection Confirmation Event */\n#define NGM_HCI_LP_CON_CFM\t\t\t3  /* HCI -> Upper */\ntypedef struct {\n\tu_int8_t\tstatus;     /* 0x00 - success */\n\tu_int8_t\tlink_type;  /* link type */\n\tu_int16_t\tcon_handle; /* con_handle */\n\tbdaddr_t\tbdaddr;     /* remote unit address */\n} ng_hci_lp_con_cfm_ep;\n\n/* Connection Indication Event */\n#define NGM_HCI_LP_CON_IND\t\t\t4  /* HCI -> Upper */\ntypedef struct {\n\tu_int8_t\tlink_type;                 /* link type */\n\tu_int8_t\tuclass[NG_HCI_CLASS_SIZE]; /* unit class */\n\tbdaddr_t\tbdaddr;                    /* remote unit address */\n} ng_hci_lp_con_ind_ep;\n\n/* Connection Response Event */\n#define NGM_HCI_LP_CON_RSP\t\t\t5  /* Upper -> HCI */\ntypedef struct {\n\tu_int8_t\tstatus;    /* 0x00 - accept connection */\n\tu_int8_t\tlink_type; /* link type */\n\tbdaddr_t\tbdaddr;    /* remote unit address */\n} ng_hci_lp_con_rsp_ep;\n\n/* Disconnection Indication Event */\n#define NGM_HCI_LP_DISCON_IND\t\t\t6  /* HCI -> Upper */\ntypedef struct {\n\tu_int8_t\treason;     /* reason to disconnect (only low byte) */\n\tu_int8_t\tlink_type;  /* link type */\n\tu_int16_t\tcon_handle; /* connection handle */\n} ng_hci_lp_discon_ind_ep;\n\n/* QoS Setup Request Event */\n#define NGM_HCI_LP_QOS_REQ\t\t\t7  /* Upper -> HCI */\ntypedef struct {\n\tu_int16_t\tcon_handle;      /* connection handle */\n\tu_int8_t\tflags;           /* reserved */\n\tu_int8_t\tservice_type;    /* service type */\n\tu_int32_t\ttoken_rate;      /* bytes/sec */\n\tu_int32_t\tpeak_bandwidth;  /* bytes/sec */\n\tu_int32_t\tlatency;         /* msec */\n\tu_int32_t\tdelay_variation; /* msec */\n} ng_hci_lp_qos_req_ep;\n\n/* QoS Conformition Event */\n#define NGM_HCI_LP_QOS_CFM\t\t\t8  /* HCI -> Upper */\ntypedef struct {\n\tu_int16_t\tstatus;          /* 0x00 - success  (only low byte) */\n\tu_int16_t\tcon_handle;      /* connection handle */\n} ng_hci_lp_qos_cfm_ep;\n\n/* QoS Violation Indication Event */\n#define NGM_HCI_LP_QOS_IND\t\t\t9  /* HCI -> Upper */\ntypedef struct {\n\tu_int16_t\tcon_handle; /* connection handle */\n} ng_hci_lp_qos_ind_ep;\n\n/**************************************************************************\n **************************************************************************\n **                    HCI node command/event parameters\n **************************************************************************\n **************************************************************************/\n\n/* Debug levels */\n#define NG_HCI_ALERT_LEVEL\t\t1\n#define NG_HCI_ERR_LEVEL\t\t2\n#define NG_HCI_WARN_LEVEL\t\t3\n#define NG_HCI_INFO_LEVEL\t\t4\n\n/* Unit states */\n#define NG_HCI_UNIT_CONNECTED\t\t(1 << 0)\n#define NG_HCI_UNIT_INITED\t\t(1 << 1)\n#define NG_HCI_UNIT_READY\t(NG_HCI_UNIT_CONNECTED|NG_HCI_UNIT_INITED)\n#define NG_HCI_UNIT_COMMAND_PENDING\t(1 << 2)\n\n/* Connection state */\n#define NG_HCI_CON_CLOSED\t\t0 /* connection closed */\n#define NG_HCI_CON_W4_LP_CON_RSP\t1 /* wait for LP_ConnectRsp */\n#define NG_HCI_CON_W4_CONN_COMPLETE\t2 /* wait for Connection_Complete evt */\n#define NG_HCI_CON_OPEN\t\t\t3 /* connection open */\n\n/* Get HCI node (unit) state (see states above) */\n#define NGM_HCI_NODE_GET_STATE\t\t\t100  /* HCI -> User */\ntypedef u_int16_t\tng_hci_node_state_ep;\n\n/* Turn on \"inited\" bit */\n#define NGM_HCI_NODE_INIT\t\t\t101 /* User -> HCI */\n/* No parameters */\n\n/* Get/Set node debug level (see debug levels above) */\n#define NGM_HCI_NODE_GET_DEBUG\t\t\t102 /* HCI -> User */\n#define NGM_HCI_NODE_SET_DEBUG\t\t\t103 /* User -> HCI */\ntypedef u_int16_t\tng_hci_node_debug_ep;\n\n/* Get node buffer info */\n#define NGM_HCI_NODE_GET_BUFFER\t\t\t104 /* HCI -> User */\ntypedef struct {\n\tu_int8_t\tcmd_free; /* number of free command packets */\n\tu_int8_t\tsco_size; /* max. size of SCO packet */\n\tu_int16_t\tsco_pkts; /* number of SCO packets */\n\tu_int16_t\tsco_free; /* number of free SCO packets */\n\tu_int16_t\tacl_size; /* max. size of ACL packet */\n\tu_int16_t\tacl_pkts; /* number of ACL packets */\n\tu_int16_t\tacl_free; /* number of free ACL packets */\n} ng_hci_node_buffer_ep;\n\n/* Get BDADDR */\n#define NGM_HCI_NODE_GET_BDADDR\t\t\t105 /* HCI -> User */\n/* bdaddr_t -- BDADDR */\n\n/* Get features */\n#define NGM_HCI_NODE_GET_FEATURES\t\t106 /* HCI -> User */\n/* features[NG_HCI_FEATURES_SIZE] -- features */\n\n#define NGM_HCI_NODE_GET_STAT\t\t\t107 /* HCI -> User */\ntypedef struct {\n\tu_int32_t\tcmd_sent;   /* number of HCI commands sent */\n\tu_int32_t\tevnt_recv;  /* number of HCI events received */\n\tu_int32_t\tacl_recv;   /* number of ACL packets received */\n\tu_int32_t\tacl_sent;   /* number of ACL packets sent */\n\tu_int32_t\tsco_recv;   /* number of SCO packets received */\n\tu_int32_t\tsco_sent;   /* number of SCO packets sent */\n\tu_int32_t\tbytes_recv; /* total number of bytes received */\n\tu_int32_t\tbytes_sent; /* total number of bytes sent */\n} ng_hci_node_stat_ep;\n\n#define NGM_HCI_NODE_RESET_STAT\t\t\t108 /* User -> HCI */\n/* No parameters */\n\n#define NGM_HCI_NODE_FLUSH_NEIGHBOR_CACHE\t109 /* User -> HCI */\n\n#define NGM_HCI_NODE_GET_NEIGHBOR_CACHE\t\t110 /* HCI -> User */\ntypedef struct {\n\tu_int32_t\tnum_entries;\t/* number of entries */\n} ng_hci_node_get_neighbor_cache_ep;\n\ntypedef struct {\n\tu_int16_t\tpage_scan_rep_mode;             /* page rep scan mode */\n\tu_int16_t\tpage_scan_mode;                 /* page scan mode */\n\tu_int16_t\tclock_offset;                   /* clock offset */\n\tbdaddr_t\tbdaddr;                         /* bdaddr */\n\tu_int8_t\tfeatures[NG_HCI_FEATURES_SIZE]; /* features */\n} ng_hci_node_neighbor_cache_entry_ep;\n\n#define NG_HCI_MAX_NEIGHBOR_NUM \\\n\t((0xffff - sizeof(ng_hci_node_get_neighbor_cache_ep))/sizeof(ng_hci_node_neighbor_cache_entry_ep))\n\n#define NGM_HCI_NODE_GET_CON_LIST\t\t111 /* HCI -> User */\ntypedef struct {\n\tu_int32_t\tnum_connections; /* number of connections */\n} ng_hci_node_con_list_ep;\n\ntypedef struct {\n\tu_int8_t\tlink_type;       /* ACL or SCO */\n\tu_int8_t\tencryption_mode; /* none, p2p, ... */\n\tu_int8_t\tmode;            /* ACTIVE, HOLD ... */\n\tu_int8_t\trole;            /* MASTER/SLAVE */\n\tu_int16_t\tstate;           /* connection state */\n\tu_int16_t\treserved;        /* place holder */\n\tu_int16_t\tpending;         /* number of pending packets */\n\tu_int16_t\tqueue_len;       /* number of packets in queue */\n\tu_int16_t\tcon_handle;      /* connection handle */\n\tbdaddr_t\tbdaddr;          /* remote bdaddr */\n} ng_hci_node_con_ep;\n\n#define NG_HCI_MAX_CON_NUM \\\n\t((0xffff - sizeof(ng_hci_node_con_list_ep))/sizeof(ng_hci_node_con_ep))\n\n#define NGM_HCI_NODE_UP\t\t\t\t112 /* HCI -> Upper */\ntypedef struct {\n\tu_int16_t\tpkt_size; /* max. ACL/SCO packet size (w/out header) */\n\tu_int16_t\tnum_pkts; /* ACL/SCO packet queue size */\n\tu_int16_t\treserved; /* place holder */\n\tbdaddr_t\tbdaddr;\t  /* bdaddr */\n} ng_hci_node_up_ep;\n\n#define NGM_HCI_SYNC_CON_QUEUE\t\t\t113 /* HCI -> Upper */\ntypedef struct {\n\tu_int16_t\tcon_handle; /* connection handle */\n\tu_int16_t\tcompleted;  /* number of completed packets */\n} ng_hci_sync_con_queue_ep;\n\n#define NGM_HCI_NODE_GET_LINK_POLICY_SETTINGS_MASK\t114 /* HCI -> User */\n#define NGM_HCI_NODE_SET_LINK_POLICY_SETTINGS_MASK\t115 /* User -> HCI */\ntypedef u_int16_t\tng_hci_node_link_policy_mask_ep;\n\n#define NGM_HCI_NODE_GET_PACKET_MASK\t\t116 /* HCI -> User */\n#define NGM_HCI_NODE_SET_PACKET_MASK\t\t117 /* User -> HCI */\ntypedef u_int16_t\tng_hci_node_packet_mask_ep;\n\n#define NGM_HCI_NODE_GET_ROLE_SWITCH\t\t118 /* HCI -> User */\n#define NGM_HCI_NODE_SET_ROLE_SWITCH\t\t119 /* User -> HCI */\ntypedef u_int16_t\tng_hci_node_role_switch_ep;\n\n#define\tNGM_HCI_NODE_LIST_NAMES\t\t\t200 /* HCI -> User */\n\n/**************************************************************************\n **************************************************************************\n **             Link control commands and return parameters\n **************************************************************************\n **************************************************************************/\n\n#define NG_HCI_OGF_LINK_CONTROL\t\t\t0x01 /* OpCode Group Field */\n\n#define NG_HCI_OCF_INQUIRY\t\t\t0x0001\ntypedef struct {\n\tu_int8_t\tlap[NG_HCI_LAP_SIZE]; /* LAP */\n\tu_int8_t\tinquiry_length; /* (N x 1.28) sec */\n\tu_int8_t\tnum_responses;  /* Max. # of responses before halted */\n} __attribute__ ((packed)) ng_hci_inquiry_cp;\n/* No return parameter(s) */\n\n#define NG_HCI_OCF_INQUIRY_CANCEL\t\t0x0002\n/* No command parameter(s) */\ntypedef ng_hci_status_rp\tng_hci_inquiry_cancel_rp;\n\n#define NG_HCI_OCF_PERIODIC_INQUIRY\t\t0x0003\ntypedef struct {\n\tu_int16_t\tmax_period_length; /* Max. and min. amount of time */\n\tu_int16_t\tmin_period_length; /* between consecutive inquiries */\n\tu_int8_t\tlap[NG_HCI_LAP_SIZE]; /* LAP */\n\tu_int8_t\tinquiry_length;    /* (inquiry_length * 1.28) sec */\n\tu_int8_t\tnum_responses;     /* Max. # of responses */\n} __attribute__ ((packed)) ng_hci_periodic_inquiry_cp;\n\ntypedef ng_hci_status_rp\tng_hci_periodic_inquiry_rp;\n\t\n#define NG_HCI_OCF_EXIT_PERIODIC_INQUIRY\t0x0004\n/* No command parameter(s) */\ntypedef ng_hci_status_rp\tng_hci_exit_periodic_inquiry_rp;\n\n#define NG_HCI_OCF_CREATE_CON\t\t\t0x0005\ntypedef struct {\n\tbdaddr_t\tbdaddr;             /* destination address */\n\tu_int16_t\tpkt_type;           /* packet type */\n\tu_int8_t\tpage_scan_rep_mode; /* page scan repetition mode */\n\tu_int8_t\tpage_scan_mode;     /* page scan mode */\n\tu_int16_t\tclock_offset;       /* clock offset */\n\tu_int8_t\taccept_role_switch; /* accept role switch? 0x00 - no */\n} __attribute__ ((packed)) ng_hci_create_con_cp;\n/* No return parameter(s) */\n\n#define NG_HCI_OCF_DISCON\t\t\t0x0006\ntypedef struct {\n\tu_int16_t\tcon_handle; /* connection handle */\n\tu_int8_t\treason;     /* reason to disconnect */\n} __attribute__ ((packed)) ng_hci_discon_cp;\n/* No return parameter(s) */\n\n#define NG_HCI_OCF_ADD_SCO_CON\t\t\t0x0007\ntypedef struct {\n\tu_int16_t\tcon_handle; /* connection handle */\n\tu_int16_t\tpkt_type;   /* packet type */\n} __attribute__ ((packed)) ng_hci_add_sco_con_cp;\n/* No return parameter(s) */\n\n#define NG_HCI_OCF_ACCEPT_CON\t\t\t0x0009\ntypedef struct {\n\tbdaddr_t\tbdaddr; /* address of unit to be connected */\n\tu_int8_t\trole;   /* connection role */\n} __attribute__ ((packed)) ng_hci_accept_con_cp;\n/* No return parameter(s) */\n\n#define NG_HCI_OCF_REJECT_CON\t\t\t0x000a\ntypedef struct {\n\tbdaddr_t\tbdaddr; /* remote address */\n\tu_int8_t\treason; /* reason to reject */\n} __attribute__ ((packed)) ng_hci_reject_con_cp;\n/* No return parameter(s) */\n\n#define NG_HCI_OCF_LINK_KEY_REP\t\t\t0x000b\ntypedef struct {\n\tbdaddr_t\tbdaddr;               /* remote address */\n\tu_int8_t\tkey[NG_HCI_KEY_SIZE]; /* key */\n} __attribute__ ((packed)) ng_hci_link_key_rep_cp;\n\ntypedef struct {\n\tu_int8_t\tstatus; /* 0x00 - success */\n\tbdaddr_t\tbdaddr; /* unit address */\n} __attribute__ ((packed)) ng_hci_link_key_rep_rp;\n\n#define NG_HCI_OCF_LINK_KEY_NEG_REP\t\t0x000c\ntypedef struct {\n\tbdaddr_t\tbdaddr; /* remote address */\n} __attribute__ ((packed)) ng_hci_link_key_neg_rep_cp;\n\ntypedef struct {\n\tu_int8_t\tstatus; /* 0x00 - success */\n\tbdaddr_t\tbdaddr; /* unit address */\n} __attribute__ ((packed)) ng_hci_link_key_neg_rep_rp;\n\n#define NG_HCI_OCF_PIN_CODE_REP\t\t\t0x000d\ntypedef struct {\n\tbdaddr_t\tbdaddr;               /* remote address */\n\tu_int8_t\tpin_size;             /* pin code length (in bytes) */\n\tu_int8_t\tpin[NG_HCI_PIN_SIZE]; /* pin code */\n} __attribute__ ((packed)) ng_hci_pin_code_rep_cp;\n\ntypedef struct {\n\tu_int8_t\tstatus; /* 0x00 - success */\n\tbdaddr_t\tbdaddr; /* unit address */\n} __attribute__ ((packed)) ng_hci_pin_code_rep_rp;\n\n#define NG_HCI_OCF_PIN_CODE_NEG_REP\t\t0x000e\ntypedef struct {\n\tbdaddr_t\tbdaddr;  /* remote address */\n} __attribute__ ((packed)) ng_hci_pin_code_neg_rep_cp;\n\ntypedef struct {\n\tu_int8_t\tstatus; /* 0x00 - success */\n\tbdaddr_t\tbdaddr; /* unit address */\n} __attribute__ ((packed)) ng_hci_pin_code_neg_rep_rp;\n\n#define NG_HCI_OCF_CHANGE_CON_PKT_TYPE\t\t0x000f\ntypedef struct {\n\tu_int16_t\tcon_handle; /* connection handle */\n\tu_int16_t\tpkt_type;   /* packet type */\n} __attribute__ ((packed)) ng_hci_change_con_pkt_type_cp;\n/* No return parameter(s) */\n\n#define NG_HCI_OCF_AUTH_REQ\t\t\t0x0011\ntypedef struct {\n\tu_int16_t\tcon_handle; /* connection handle */\n} __attribute__ ((packed)) ng_hci_auth_req_cp;\n/* No return parameter(s) */\n\n#define NG_HCI_OCF_SET_CON_ENCRYPTION\t\t0x0013\ntypedef struct {\n\tu_int16_t\tcon_handle;        /* connection handle */\n\tu_int8_t\tencryption_enable; /* 0x00 - disable, 0x01 - enable */\n} __attribute__ ((packed)) ng_hci_set_con_encryption_cp;\n/* No return parameter(s) */\n\n#define NG_HCI_OCF_CHANGE_CON_LINK_KEY\t\t0x0015\ntypedef struct {\n\tu_int16_t\tcon_handle; /* connection handle */\n} __attribute__ ((packed)) ng_hci_change_con_link_key_cp;\n/* No return parameter(s) */\n\n#define NG_HCI_OCF_MASTER_LINK_KEY\t\t0x0017\ntypedef struct {\n\tu_int8_t\tkey_flag; /* key flag */\n} __attribute__ ((packed)) ng_hci_master_link_key_cp;\n/* No return parameter(s) */\n\n#define NG_HCI_OCF_REMOTE_NAME_REQ\t\t0x0019\ntypedef struct {\n\tbdaddr_t\tbdaddr;             /* remote address */\n\tu_int8_t\tpage_scan_rep_mode; /* page scan repetition mode */\n\tu_int8_t\tpage_scan_mode;     /* page scan mode */\n\tu_int16_t\tclock_offset;       /* clock offset */\n} __attribute__ ((packed)) ng_hci_remote_name_req_cp;\n/* No return parameter(s) */\n\n#define NG_HCI_OCF_READ_REMOTE_FEATURES\t\t0x001b\ntypedef struct {\n\tu_int16_t\tcon_handle; /* connection handle */\n} __attribute__ ((packed)) ng_hci_read_remote_features_cp;\n/* No return parameter(s) */\n\n#define NG_HCI_OCF_READ_REMOTE_VER_INFO\t\t0x001d\ntypedef struct {\n\tu_int16_t\tcon_handle; /* connection handle */\n} __attribute__ ((packed)) ng_hci_read_remote_ver_info_cp;\n/* No return parameter(s) */\n\n#define NG_HCI_OCF_READ_CLOCK_OFFSET\t\t 0x001f\ntypedef struct {\n\tu_int16_t\tcon_handle; /* connection handle */\n} __attribute__ ((packed)) ng_hci_read_clock_offset_cp;\n/* No return parameter(s) */\n\n/**************************************************************************\n **************************************************************************\n **        Link policy commands and return parameters\n **************************************************************************\n **************************************************************************/\n\n#define NG_HCI_OGF_LINK_POLICY\t\t\t0x02 /* OpCode Group Field */\n\n#define NG_HCI_OCF_HOLD_MODE\t\t\t0x0001\ntypedef struct {\n\tu_int16_t\tcon_handle;   /* connection handle */\n\tu_int16_t\tmax_interval; /* (max_interval * 0.625) msec */\n\tu_int16_t\tmin_interval; /* (max_interval * 0.625) msec */\n} __attribute__ ((packed)) ng_hci_hold_mode_cp;\n/* No return parameter(s) */\n\n#define NG_HCI_OCF_SNIFF_MODE\t\t\t0x0003\ntypedef struct {\n\tu_int16_t\tcon_handle;   /* connection handle */\n\tu_int16_t\tmax_interval; /* (max_interval * 0.625) msec */\n\tu_int16_t\tmin_interval; /* (max_interval * 0.625) msec */\n\tu_int16_t\tattempt;      /* (2 * attempt - 1) * 0.625 msec */\n\tu_int16_t\ttimeout;      /* (2 * attempt - 1) * 0.625 msec */\n} __attribute__ ((packed)) ng_hci_sniff_mode_cp;\n/* No return parameter(s) */\n\n#define NG_HCI_OCF_EXIT_SNIFF_MODE\t\t0x0004\ntypedef struct {\n\tu_int16_t\tcon_handle; /* connection handle */\n} __attribute__ ((packed)) ng_hci_exit_sniff_mode_cp;\n/* No return parameter(s) */\n\n#define NG_HCI_OCF_PARK_MODE\t\t\t0x0005\ntypedef struct {\n\tu_int16_t\tcon_handle;   /* connection handle */\n\tu_int16_t\tmax_interval; /* (max_interval * 0.625) msec */\n\tu_int16_t\tmin_interval; /* (max_interval * 0.625) msec */\n} __attribute__ ((packed)) ng_hci_park_mode_cp;\n/* No return parameter(s) */\n\n#define NG_HCI_OCF_EXIT_PARK_MODE\t\t0x0006\ntypedef struct {\n\tu_int16_t\tcon_handle; /* connection handle */\n} __attribute__ ((packed)) ng_hci_exit_park_mode_cp;\n/* No return parameter(s) */\n\n#define NG_HCI_OCF_QOS_SETUP\t\t\t0x0007\ntypedef struct {\n\tu_int16_t\tcon_handle;      /* connection handle */\n\tu_int8_t\tflags;           /* reserved for future use */\n\tu_int8_t\tservice_type;    /* service type */\n\tu_int32_t\ttoken_rate;      /* bytes per second */\n\tu_int32_t\tpeak_bandwidth;  /* bytes per second */\n\tu_int32_t\tlatency;         /* microseconds */\n\tu_int32_t\tdelay_variation; /* microseconds */\n} __attribute__ ((packed)) ng_hci_qos_setup_cp;\n/* No return parameter(s) */\n\n#define NG_HCI_OCF_ROLE_DISCOVERY\t\t0x0009\ntypedef struct {\n\tu_int16_t\tcon_handle; /* connection handle */\n} __attribute__ ((packed)) ng_hci_role_discovery_cp;\n\ntypedef struct {\n\tu_int8_t\tstatus;     /* 0x00 - success */\n\tu_int16_t\tcon_handle; /* connection handle */\n\tu_int8_t\trole;       /* role for the connection handle */\n} __attribute__ ((packed)) ng_hci_role_discovery_rp;\n\n#define NG_HCI_OCF_SWITCH_ROLE\t\t\t0x000b\ntypedef struct {\n\tbdaddr_t\tbdaddr; /* remote address */\n\tu_int8_t\trole;   /* new local role */\n} __attribute__ ((packed)) ng_hci_switch_role_cp;\n/* No return parameter(s) */\n\n#define NG_HCI_OCF_READ_LINK_POLICY_SETTINGS\t0x000c\ntypedef struct {\n\tu_int16_t\tcon_handle; /* connection handle */\n} __attribute__ ((packed)) ng_hci_read_link_policy_settings_cp;\n\t\ntypedef struct {\n\tu_int8_t\tstatus;     /* 0x00 - success */\n\tu_int16_t\tcon_handle; /* connection handle */\n\tu_int16_t\tsettings;   /* link policy settings */\n} __attribute__ ((packed)) ng_hci_read_link_policy_settings_rp;\n\n#define NG_HCI_OCF_WRITE_LINK_POLICY_SETTINGS\t0x000d\ntypedef struct {\n\tu_int16_t\tcon_handle; /* connection handle */\n\tu_int16_t\tsettings;   /* link policy settings */\n} __attribute__ ((packed)) ng_hci_write_link_policy_settings_cp;\n\ntypedef struct {\n\tu_int8_t\tstatus;     /* 0x00 - success */\n\tu_int16_t\tcon_handle; /* connection handle */\n} __attribute__ ((packed)) ng_hci_write_link_policy_settings_rp;\n\n/**************************************************************************\n **************************************************************************\n **   Host controller and baseband commands and return parameters \n **************************************************************************\n **************************************************************************/\n\n#define NG_HCI_OGF_HC_BASEBAND\t\t\t0x03 /* OpCode Group Field */\n\n#define NG_HCI_OCF_SET_EVENT_MASK\t\t0x0001\ntypedef struct {\n\tu_int8_t\tevent_mask[NG_HCI_EVENT_MASK_SIZE]; /* event_mask */\n} __attribute__ ((packed)) ng_hci_set_event_mask_cp;\n\ntypedef ng_hci_status_rp\tng_hci_set_event_mask_rp;\n\n#define NG_HCI_OCF_RESET\t\t\t0x0003\n/* No command parameter(s) */\ntypedef ng_hci_status_rp\tng_hci_reset_rp;\n\n#define NG_HCI_OCF_SET_EVENT_FILTER\t\t0x0005\ntypedef struct {\n\tu_int8_t\tfilter_type;           /* filter type */\n\tu_int8_t\tfilter_condition_type; /* filter condition type */\n\tu_int8_t\tcondition[0];          /* conditions - variable size */\n} __attribute__ ((packed)) ng_hci_set_event_filter_cp;\n\ntypedef ng_hci_status_rp\tng_hci_set_event_filter_rp;\n\n#define NG_HCI_OCF_FLUSH\t\t\t0x0008\ntypedef struct {\n\tu_int16_t\tcon_handle; /* connection handle */\n} __attribute__ ((packed)) ng_hci_flush_cp;\n\ntypedef struct {\n\tu_int8_t\tstatus;     /* 0x00 - success */\n\tu_int16_t\tcon_handle; /* connection handle */\n} __attribute__ ((packed)) ng_hci_flush_rp;\n\n#define NG_HCI_OCF_READ_PIN_TYPE\t\t0x0009\n/* No command parameter(s) */\ntypedef struct {\n\tu_int8_t\tstatus;   /* 0x00 - success */\n\tu_int8_t\tpin_type; /* PIN type */\n} __attribute__ ((packed)) ng_hci_read_pin_type_rp;\n\n#define NG_HCI_OCF_WRITE_PIN_TYPE\t\t0x000a\ntypedef struct {\n\tu_int8_t\tpin_type; /* PIN type */\n} __attribute__ ((packed)) ng_hci_write_pin_type_cp;\n\ntypedef ng_hci_status_rp\tng_hci_write_pin_type_rp;\n\n#define NG_HCI_OCF_CREATE_NEW_UNIT_KEY\t\t0x000b\n/* No command parameter(s) */\ntypedef ng_hci_status_rp\tng_hci_create_new_unit_key_rp;\n\n#define NG_HCI_OCF_READ_STORED_LINK_KEY\t\t0x000d\ntypedef struct {\n\tbdaddr_t\tbdaddr;   /* address */\n\tu_int8_t\tread_all; /* read all keys? 0x01 - yes */\n} __attribute__ ((packed)) ng_hci_read_stored_link_key_cp;\n\ntypedef struct {\n\tu_int8_t\tstatus;        /* 0x00 - success */\n\tu_int16_t\tmax_num_keys;  /* Max. number of keys */\n\tu_int16_t\tnum_keys_read; /* Number of stored keys */\n} __attribute__ ((packed)) ng_hci_read_stored_link_key_rp;\n\n#define NG_HCI_OCF_WRITE_STORED_LINK_KEY\t0x0011\ntypedef struct {\n\tu_int8_t\tnum_keys_write; /* # of keys to write */\n/* these are repeated \"num_keys_write\" times \n\tbdaddr_t\tbdaddr;                --- remote address(es)\n\tu_int8_t\tkey[NG_HCI_KEY_SIZE];  --- key(s) */\n} __attribute__ ((packed)) ng_hci_write_stored_link_key_cp;\n\ntypedef struct {\n\tu_int8_t\tstatus;           /* 0x00 - success */\n\tu_int8_t\tnum_keys_written; /* # of keys successfully written */\n} __attribute__ ((packed)) ng_hci_write_stored_link_key_rp;\n\n#define NG_HCI_OCF_DELETE_STORED_LINK_KEY\t0x0012\ntypedef struct {\n\tbdaddr_t\tbdaddr;     /* address */\n\tu_int8_t\tdelete_all; /* delete all keys? 0x01 - yes */\n} __attribute__ ((packed)) ng_hci_delete_stored_link_key_cp;\n\ntypedef struct {\n\tu_int8_t\tstatus;           /* 0x00 - success */\n\tu_int16_t\tnum_keys_deleted; /* Number of keys deleted */\n} __attribute__ ((packed)) ng_hci_delete_stored_link_key_rp;\n\n#define NG_HCI_OCF_CHANGE_LOCAL_NAME\t\t0x0013\ntypedef struct {\n\tchar\t\tname[NG_HCI_UNIT_NAME_SIZE]; /* new unit name */\n} __attribute__ ((packed)) ng_hci_change_local_name_cp;\n\ntypedef ng_hci_status_rp\tng_hci_change_local_name_rp;\n\n#define NG_HCI_OCF_READ_LOCAL_NAME\t\t0x0014\n/* No command parameter(s) */\ntypedef struct {\n\tu_int8_t\tstatus;  /* 0x00 - success */\n\tchar\t\tname[NG_HCI_UNIT_NAME_SIZE]; /* unit name */\n} __attribute__ ((packed)) ng_hci_read_local_name_rp;\n\n#define NG_HCI_OCF_READ_CON_ACCEPT_TIMO\t\t0x0015\n/* No command parameter(s) */\ntypedef struct {\n\tu_int8_t\tstatus;  /* 0x00 - success */\n\tu_int16_t\ttimeout; /* (timeout * 0.625) msec */\n} __attribute__ ((packed)) ng_hci_read_con_accept_timo_rp;\n\n#define NG_HCI_OCF_WRITE_CON_ACCEPT_TIMO\t0x0016\ntypedef struct {\n\tu_int16_t\ttimeout; /* (timeout * 0.625) msec */\n} __attribute__ ((packed)) ng_hci_write_con_accept_timo_cp;\n\ntypedef ng_hci_status_rp\tng_hci_write_con_accept_timo_rp;\n\n#define NG_HCI_OCF_READ_PAGE_TIMO\t\t0x0017\n/* No command parameter(s) */\ntypedef struct {\n\tu_int8_t\tstatus;  /* 0x00 - success */\n\tu_int16_t\ttimeout; /* (timeout * 0.625) msec */\n} __attribute__ ((packed)) ng_hci_read_page_timo_rp;\n\n#define NG_HCI_OCF_WRITE_PAGE_TIMO\t\t0x0018\ntypedef struct {\n\tu_int16_t\ttimeout; /* (timeout * 0.625) msec */\n} __attribute__ ((packed)) ng_hci_write_page_timo_cp;\n\ntypedef ng_hci_status_rp\tng_hci_write_page_timo_rp;\n\n#define NG_HCI_OCF_READ_SCAN_ENABLE\t\t0x0019\n/* No command parameter(s) */\ntypedef struct {\n\tu_int8_t\tstatus;      /* 0x00 - success */\n\tu_int8_t\tscan_enable; /* Scan enable */\n} __attribute__ ((packed)) ng_hci_read_scan_enable_rp;\n\n#define NG_HCI_OCF_WRITE_SCAN_ENABLE\t\t0x001a\ntypedef struct {\n\tu_int8_t\tscan_enable; /* Scan enable */\n} __attribute__ ((packed)) ng_hci_write_scan_enable_cp;\n\ntypedef ng_hci_status_rp\tng_hci_write_scan_enable_rp;\n\n#define NG_HCI_OCF_READ_PAGE_SCAN_ACTIVITY\t0x001b\n/* No command parameter(s) */\ntypedef struct {\n\tu_int8_t\tstatus;             /* 0x00 - success */\n\tu_int16_t\tpage_scan_interval; /* interval * 0.625 msec */\n\tu_int16_t\tpage_scan_window;   /* window * 0.625 msec */\n} __attribute__ ((packed)) ng_hci_read_page_scan_activity_rp;\n\n#define NG_HCI_OCF_WRITE_PAGE_SCAN_ACTIVITY\t0x001c\ntypedef struct {\n\tu_int16_t\tpage_scan_interval; /* interval * 0.625 msec */\n\tu_int16_t\tpage_scan_window;   /* window * 0.625 msec */\n} __attribute__ ((packed)) ng_hci_write_page_scan_activity_cp;\n\ntypedef ng_hci_status_rp\tng_hci_write_page_scan_activity_rp;\n\n#define NG_HCI_OCF_READ_INQUIRY_SCAN_ACTIVITY\t0x001d\n/* No command parameter(s) */\ntypedef struct {\n\tu_int8_t\tstatus;                /* 0x00 - success */\n\tu_int16_t\tinquiry_scan_interval; /* interval * 0.625 msec */\n\tu_int16_t\tinquiry_scan_window;   /* window * 0.625 msec */\n} __attribute__ ((packed)) ng_hci_read_inquiry_scan_activity_rp;\n\n#define NG_HCI_OCF_WRITE_INQUIRY_SCAN_ACTIVITY\t0x001e\ntypedef struct {\n\tu_int16_t\tinquiry_scan_interval; /* interval * 0.625 msec */\n\tu_int16_t\tinquiry_scan_window;   /* window * 0.625 msec */\n} __attribute__ ((packed)) ng_hci_write_inquiry_scan_activity_cp;\n\ntypedef ng_hci_status_rp\tng_hci_write_inquiry_scan_activity_rp;\n\n#define NG_HCI_OCF_READ_AUTH_ENABLE\t\t0x001f\n/* No command parameter(s) */\ntypedef struct {\n\tu_int8_t\tstatus;      /* 0x00 - success */\n\tu_int8_t\tauth_enable; /* 0x01 - enabled */\n} __attribute__ ((packed)) ng_hci_read_auth_enable_rp;\n\n#define NG_HCI_OCF_WRITE_AUTH_ENABLE\t\t0x0020\ntypedef struct {\n\tu_int8_t\tauth_enable; /* 0x01 - enabled */\n} __attribute__ ((packed)) ng_hci_write_auth_enable_cp;\n\ntypedef ng_hci_status_rp\tng_hci_write_auth_enable_rp;\n\n#define NG_HCI_OCF_READ_ENCRYPTION_MODE\t\t0x0021\n/* No command parameter(s) */\ntypedef struct {\n\tu_int8_t\tstatus;          /* 0x00 - success */\n\tu_int8_t\tencryption_mode; /* encryption mode */\n} __attribute__ ((packed)) ng_hci_read_encryption_mode_rp;\n\n#define NG_HCI_OCF_WRITE_ENCRYPTION_MODE\t0x0022\ntypedef struct {\n\tu_int8_t\tencryption_mode; /* encryption mode */\n} __attribute__ ((packed)) ng_hci_write_encryption_mode_cp;\n\ntypedef ng_hci_status_rp\tng_hci_write_encryption_mode_rp;\n\n#define NG_HCI_OCF_READ_UNIT_CLASS\t\t0x0023\n/* No command parameter(s) */\ntypedef struct {\n\tu_int8_t\tstatus;                    /* 0x00 - success */\n\tu_int8_t\tuclass[NG_HCI_CLASS_SIZE]; /* unit class */\n} __attribute__ ((packed)) ng_hci_read_unit_class_rp;\n\n#define NG_HCI_OCF_WRITE_UNIT_CLASS\t\t0x0024\ntypedef struct {\n\tu_int8_t\tuclass[NG_HCI_CLASS_SIZE]; /* unit class */\n} __attribute__ ((packed)) ng_hci_write_unit_class_cp;\n\ntypedef ng_hci_status_rp\tng_hci_write_unit_class_rp;\n\n#define NG_HCI_OCF_READ_VOICE_SETTINGS\t\t0x0025\n/* No command parameter(s) */\ntypedef struct {\n\tu_int8_t\tstatus;   /* 0x00 - success */\n\tu_int16_t\tsettings; /* voice settings */\n} __attribute__ ((packed)) ng_hci_read_voice_settings_rp;\n\n#define NG_HCI_OCF_WRITE_VOICE_SETTINGS\t\t0x0026\ntypedef struct {\n\tu_int16_t\tsettings; /* voice settings */\n} __attribute__ ((packed)) ng_hci_write_voice_settings_cp;\n\ntypedef ng_hci_status_rp\tng_hci_write_voice_settings_rp;\n\n#define NG_HCI_OCF_READ_AUTO_FLUSH_TIMO\t\t0x0027\ntypedef struct {\n\tu_int16_t\tcon_handle; /* connection handle */\n} __attribute__ ((packed)) ng_hci_read_auto_flush_timo_cp;\n\ntypedef struct {\n\tu_int8_t\tstatus;     /* 0x00 - success */\n\tu_int16_t\tcon_handle; /* connection handle */\n\tu_int16_t\ttimeout;    /* 0x00 - no flush, timeout * 0.625 msec */\n} __attribute__ ((packed)) ng_hci_read_auto_flush_timo_rp;\n\t\n#define NG_HCI_OCF_WRITE_AUTO_FLUSH_TIMO\t0x0028\ntypedef struct {\n\tu_int16_t\tcon_handle; /* connection handle */\n\tu_int16_t\ttimeout;    /* 0x00 - no flush, timeout * 0.625 msec */\n} __attribute__ ((packed)) ng_hci_write_auto_flush_timo_cp;\n\ntypedef struct {\n\tu_int8_t\tstatus;     /* 0x00 - success */\n\tu_int16_t\tcon_handle; /* connection handle */\n} __attribute__ ((packed)) ng_hci_write_auto_flush_timo_rp;\n\n#define NG_HCI_OCF_READ_NUM_BROADCAST_RETRANS\t0x0029\n/* No command parameter(s) */\ntypedef struct {\n\tu_int8_t\tstatus;  /* 0x00 - success */\n\tu_int8_t\tcounter; /* number of broadcast retransmissions */\n} __attribute__ ((packed)) ng_hci_read_num_broadcast_retrans_rp;\n\n#define NG_HCI_OCF_WRITE_NUM_BROADCAST_RETRANS\t0x002a\ntypedef struct {\n\tu_int8_t\tcounter; /* number of broadcast retransmissions */\n} __attribute__ ((packed)) ng_hci_write_num_broadcast_retrans_cp;\n\ntypedef ng_hci_status_rp\tng_hci_write_num_broadcast_retrans_rp;\n\n#define NG_HCI_OCF_READ_HOLD_MODE_ACTIVITY\t0x002b\n/* No command parameter(s) */\ntypedef struct {\n\tu_int8_t\tstatus;             /* 0x00 - success */\n\tu_int8_t\thold_mode_activity; /* Hold mode activities */\n} __attribute__ ((packed)) ng_hci_read_hold_mode_activity_rp;\n\n#define NG_HCI_OCF_WRITE_HOLD_MODE_ACTIVITY\t0x002c\ntypedef struct {\n\tu_int8_t\thold_mode_activity; /* Hold mode activities */\n} __attribute__ ((packed)) ng_hci_write_hold_mode_activity_cp;\n\ntypedef ng_hci_status_rp\tng_hci_write_hold_mode_activity_rp;\n\n#define NG_HCI_OCF_READ_XMIT_LEVEL\t\t0x002d\ntypedef struct {\n\tu_int16_t\tcon_handle; /* connection handle */\n\tu_int8_t\ttype;       /* Xmit level type */\n} __attribute__ ((packed)) ng_hci_read_xmit_level_cp;\n\ntypedef struct {\n\tu_int8_t\tstatus;     /* 0x00 - success */\n\tu_int16_t\tcon_handle; /* connection handle */\n\tchar\t\tlevel;      /* -30 <= level <= 30 dBm */\n} __attribute__ ((packed)) ng_hci_read_xmit_level_rp;\n\n#define NG_HCI_OCF_READ_SCO_FLOW_CONTROL\t0x002e\n/* No command parameter(s) */\ntypedef struct {\n\tu_int8_t\tstatus;       /* 0x00 - success */\n\tu_int8_t\tflow_control; /* 0x00 - disabled */\n} __attribute__ ((packed)) ng_hci_read_sco_flow_control_rp;\n\n#define NG_HCI_OCF_WRITE_SCO_FLOW_CONTROL\t0x002f\ntypedef struct {\n\tu_int8_t\tflow_control; /* 0x00 - disabled */\n} __attribute__ ((packed)) ng_hci_write_sco_flow_control_cp;\n\ntypedef ng_hci_status_rp\tng_hci_write_sco_flow_control_rp;\n\n#define NG_HCI_OCF_H2HC_FLOW_CONTROL\t\t0x0031\ntypedef struct {\n\tu_int8_t\th2hc_flow; /* Host to Host controller flow control */\n} __attribute__ ((packed)) ng_hci_h2hc_flow_control_cp;\n\ntypedef ng_hci_status_rp\tng_hci_h2hc_flow_control_rp;\n\n#define NG_HCI_OCF_HOST_BUFFER_SIZE\t\t0x0033\ntypedef struct {\n\tu_int16_t\tmax_acl_size; /* Max. size of ACL packet (bytes) */\n\tu_int8_t\tmax_sco_size; /* Max. size of SCO packet (bytes) */\n\tu_int16_t\tnum_acl_pkt;  /* Max. number of ACL packets */\n\tu_int16_t\tnum_sco_pkt;  /* Max. number of SCO packets */\n} __attribute__ ((packed)) ng_hci_host_buffer_size_cp;\n\ntypedef ng_hci_status_rp\tng_hci_host_buffer_size_rp;\n\n#define NG_HCI_OCF_HOST_NUM_COMPL_PKTS\t\t0x0035\ntypedef struct {\n\tu_int8_t\tnum_con_handles; /* # of connection handles */\n/* these are repeated \"num_con_handles\" times\n\tu_int16_t\tcon_handle; --- connection handle(s)\n\tu_int16_t\tcompl_pkt;  --- # of completed packets */\n} __attribute__ ((packed)) ng_hci_host_num_compl_pkts_cp;\n/* No return parameter(s) */\n\n#define NG_HCI_OCF_READ_LINK_SUPERVISION_TIMO\t0x0036\ntypedef struct {\n\tu_int16_t\tcon_handle; /* connection handle */\n} __attribute__ ((packed)) ng_hci_read_link_supervision_timo_cp;\n\ntypedef struct {\n\tu_int8_t\tstatus;     /* 0x00 - success */\n\tu_int16_t\tcon_handle; /* connection handle */\n\tu_int16_t\ttimeout;    /* Link supervision timeout * 0.625 msec */\n} __attribute__ ((packed)) ng_hci_read_link_supervision_timo_rp;\n\n#define NG_HCI_OCF_WRITE_LINK_SUPERVISION_TIMO\t0x0037\ntypedef struct {\n\tu_int16_t\tcon_handle; /* connection handle */\n\tu_int16_t\ttimeout;    /* Link supervision timeout * 0.625 msec */\n} __attribute__ ((packed)) ng_hci_write_link_supervision_timo_cp;\n\ntypedef struct {\n\tu_int8_t\tstatus;     /* 0x00 - success */\n\tu_int16_t\tcon_handle; /* connection handle */\n} __attribute__ ((packed)) ng_hci_write_link_supervision_timo_rp;\n\n#define NG_HCI_OCF_READ_SUPPORTED_IAC_NUM\t0x0038\n/* No command parameter(s) */\ntypedef struct {\n\tu_int8_t\tstatus;  /* 0x00 - success */\n\tu_int8_t\tnum_iac; /* # of supported IAC during scan */\n} __attribute__ ((packed)) ng_hci_read_supported_iac_num_rp;\n\n#define NG_HCI_OCF_READ_IAC_LAP\t\t\t0x0039\n/* No command parameter(s) */\ntypedef struct {\n\tu_int8_t\tstatus;  /* 0x00 - success */\n\tu_int8_t\tnum_iac; /* # of IAC */\n/* these are repeated \"num_iac\" times \n\tu_int8_t\tlaps[NG_HCI_LAP_SIZE]; --- LAPs */\n} __attribute__ ((packed)) ng_hci_read_iac_lap_rp;\n\n#define NG_HCI_OCF_WRITE_IAC_LAP\t\t0x003a\ntypedef struct {\n\tu_int8_t\tnum_iac; /* # of IAC */\n/* these are repeated \"num_iac\" times \n\tu_int8_t\tlaps[NG_HCI_LAP_SIZE]; --- LAPs */\n} __attribute__ ((packed)) ng_hci_write_iac_lap_cp;\n\ntypedef ng_hci_status_rp\tng_hci_write_iac_lap_rp;\n\n#define NG_HCI_OCF_READ_PAGE_SCAN_PERIOD\t0x003b\n/* No command parameter(s) */\ntypedef struct {\n\tu_int8_t\tstatus;                /* 0x00 - success */\n\tu_int8_t\tpage_scan_period_mode; /* Page scan period mode */\n} __attribute__ ((packed)) ng_hci_read_page_scan_period_rp;\n\n#define NG_HCI_OCF_WRITE_PAGE_SCAN_PERIOD\t0x003c\ntypedef struct {\n\tu_int8_t\tpage_scan_period_mode; /* Page scan period mode */\n} __attribute__ ((packed)) ng_hci_write_page_scan_period_cp;\n\ntypedef ng_hci_status_rp\tng_hci_write_page_scan_period_rp;\n\n#define NG_HCI_OCF_READ_PAGE_SCAN\t\t0x003d\n/* No command parameter(s) */\ntypedef struct {\n\tu_int8_t\tstatus;         /* 0x00 - success */\n\tu_int8_t\tpage_scan_mode; /* Page scan mode */\n} __attribute__ ((packed)) ng_hci_read_page_scan_rp;\n\n#define NG_HCI_OCF_WRITE_PAGE_SCAN\t\t0x003e\ntypedef struct {\n\tu_int8_t\tpage_scan_mode; /* Page scan mode */\n} __attribute__ ((packed)) ng_hci_write_page_scan_cp;\n\ntypedef ng_hci_status_rp\tng_hci_write_page_scan_rp;\n\n/**************************************************************************\n **************************************************************************\n **           Informational commands and return parameters \n **     All commands in this category do not accept any parameters\n **************************************************************************\n **************************************************************************/\n\n#define NG_HCI_OGF_INFO\t\t\t\t0x04 /* OpCode Group Field */\n\n#define NG_HCI_OCF_READ_LOCAL_VER\t\t0x0001\ntypedef struct {\n\tu_int8_t\tstatus;         /* 0x00 - success */\n\tu_int8_t\thci_version;    /* HCI version */\n\tu_int16_t\thci_revision;   /* HCI revision */\n\tu_int8_t\tlmp_version;    /* LMP version */\n\tu_int16_t\tmanufacturer;   /* Hardware manufacturer name */\n\tu_int16_t\tlmp_subversion; /* LMP sub-version */\n} __attribute__ ((packed)) ng_hci_read_local_ver_rp;\n\n#define NG_HCI_OCF_READ_LOCAL_FEATURES\t\t0x0003\ntypedef struct {\n\tu_int8_t\tstatus;                         /* 0x00 - success */\n\tu_int8_t\tfeatures[NG_HCI_FEATURES_SIZE]; /* LMP features bitmsk*/\n} __attribute__ ((packed)) ng_hci_read_local_features_rp;\n\n#define NG_HCI_OCF_READ_BUFFER_SIZE\t\t0x0005\ntypedef struct {\n\tu_int8_t\tstatus;       /* 0x00 - success */\n\tu_int16_t\tmax_acl_size; /* Max. size of ACL packet (bytes) */\n\tu_int8_t\tmax_sco_size; /* Max. size of SCO packet (bytes) */\n\tu_int16_t\tnum_acl_pkt;  /* Max. number of ACL packets */\n\tu_int16_t\tnum_sco_pkt;  /* Max. number of SCO packets */\n} __attribute__ ((packed)) ng_hci_read_buffer_size_rp;\n\n#define NG_HCI_OCF_READ_COUNTRY_CODE\t\t0x0007\ntypedef struct {\n\tu_int8_t\tstatus;       /* 0x00 - success */\n\tu_int8_t\tcountry_code; /* 0x00 - NAM, EUR, JP; 0x01 - France */\n} __attribute__ ((packed)) ng_hci_read_country_code_rp;\n\n#define NG_HCI_OCF_READ_BDADDR\t\t\t0x0009\ntypedef struct {\n\tu_int8_t\tstatus; /* 0x00 - success */\n\tbdaddr_t\tbdaddr; /* unit address */\n} __attribute__ ((packed)) ng_hci_read_bdaddr_rp;\n\n/**************************************************************************\n **************************************************************************\n **            Status commands and return parameters \n **************************************************************************\n **************************************************************************/\n\n#define NG_HCI_OGF_STATUS\t\t\t0x05 /* OpCode Group Field */\n\n#define NG_HCI_OCF_READ_FAILED_CONTACT_CNTR\t0x0001\ntypedef struct {\n\tu_int16_t\tcon_handle; /* connection handle */\n} __attribute__ ((packed)) ng_hci_read_failed_contact_cntr_cp;\n\ntypedef struct {\n\tu_int8_t\tstatus;     /* 0x00 - success */\n\tu_int16_t\tcon_handle; /* connection handle */\n\tu_int16_t\tcounter;    /* number of consecutive failed contacts */\n} __attribute__ ((packed)) ng_hci_read_failed_contact_cntr_rp;\n\n#define NG_HCI_OCF_RESET_FAILED_CONTACT_CNTR\t0x0002\ntypedef struct {\n\tu_int16_t\tcon_handle; /* connection handle */\n} __attribute__ ((packed)) ng_hci_reset_failed_contact_cntr_cp;\n\ntypedef struct {\n\tu_int8_t\tstatus;     /* 0x00 - success */\n\tu_int16_t\tcon_handle; /* connection handle */\n} __attribute__ ((packed)) ng_hci_reset_failed_contact_cntr_rp;\n\n#define NG_HCI_OCF_GET_LINK_QUALITY\t\t0x0003\ntypedef struct {\n\tu_int16_t\tcon_handle; /* connection handle */\n} __attribute__ ((packed)) ng_hci_get_link_quality_cp;\n\ntypedef struct {\n\tu_int8_t\tstatus;     /* 0x00 - success */\n\tu_int16_t\tcon_handle; /* connection handle */\n\tu_int8_t\tquality;    /* higher value means better quality */\n} __attribute__ ((packed)) ng_hci_get_link_quality_rp;\n\n#define NG_HCI_OCF_READ_RSSI\t\t\t0x0005\ntypedef struct {\n\tu_int16_t\tcon_handle; /* connection handle */\n} __attribute__ ((packed)) ng_hci_read_rssi_cp;\n\ntypedef struct {\n\tu_int8_t\tstatus;     /* 0x00 - success */\n\tu_int16_t\tcon_handle; /* connection handle */\n\tchar\t\trssi;       /* -127 <= rssi <= 127 dB */\n} __attribute__ ((packed)) ng_hci_read_rssi_rp;\n\n/**************************************************************************\n **************************************************************************\n **             Testing commands and return parameters \n **************************************************************************\n **************************************************************************/\n\n#define NG_HCI_OGF_TESTING\t\t\t0x06 /* OpCode Group Field */\n\n#define NG_HCI_OCF_READ_LOOPBACK_MODE\t\t0x0001\n/* No command parameter(s) */\ntypedef struct {\n\tu_int8_t\tstatus; /* 0x00 - success */\n\tu_int8_t\tlbmode; /* loopback mode */\n} __attribute__ ((packed)) ng_hci_read_loopback_mode_rp;\n\n#define NG_HCI_OCF_WRITE_LOOPBACK_MODE\t\t0x0002\ntypedef struct {\n\tu_int8_t\tlbmode; /* loopback mode */\n} __attribute__ ((packed)) ng_hci_write_loopback_mode_cp;\n\ntypedef ng_hci_status_rp\tng_hci_write_loopback_mode_rp;\n\n#define NG_HCI_OCF_ENABLE_UNIT_UNDER_TEST\t0x0003\n/* No command parameter(s) */\ntypedef ng_hci_status_rp\tng_hci_enable_unit_under_test_rp;\n\n/**************************************************************************\n **************************************************************************\n **                Special HCI OpCode group field values\n **************************************************************************\n **************************************************************************/\n\n#define NG_HCI_OGF_BT_LOGO\t\t\t0x3e\t\n\n#define NG_HCI_OGF_VENDOR\t\t\t0x3f\n\n/**************************************************************************\n **************************************************************************\n **                         Events and event parameters\n **************************************************************************\n **************************************************************************/\n\n#define NG_HCI_EVENT_INQUIRY_COMPL\t\t0x01\ntypedef struct {\n\tu_int8_t\tstatus; /* 0x00 - success */\n} __attribute__ ((packed)) ng_hci_inquiry_compl_ep;\n\n#define NG_HCI_EVENT_INQUIRY_RESULT\t\t0x02\ntypedef struct {\n\tu_int8_t\tnum_responses;      /* number of responses */\n/*\tng_hci_inquiry_response[num_responses]   -- see below */\n} __attribute__ ((packed)) ng_hci_inquiry_result_ep;\n\ntypedef struct {\n\tbdaddr_t\tbdaddr;                   /* unit address */\n\tu_int8_t\tpage_scan_rep_mode;       /* page scan rep. mode */\n\tu_int8_t\tpage_scan_period_mode;    /* page scan period mode */\n\tu_int8_t\tpage_scan_mode;           /* page scan mode */\n\tu_int8_t\tuclass[NG_HCI_CLASS_SIZE];/* unit class */\n\tu_int16_t\tclock_offset;             /* clock offset */\n} __attribute__ ((packed)) ng_hci_inquiry_response;\n\n#define NG_HCI_EVENT_CON_COMPL\t\t\t0x03\ntypedef struct {\n\tu_int8_t\tstatus;          /* 0x00 - success */\n\tu_int16_t\tcon_handle;      /* Connection handle */\n\tbdaddr_t\tbdaddr;          /* remote unit address */\n\tu_int8_t\tlink_type;       /* Link type */\n\tu_int8_t\tencryption_mode; /* Encryption mode */\n} __attribute__ ((packed)) ng_hci_con_compl_ep;\n\n#define NG_HCI_EVENT_CON_REQ\t\t\t0x04\ntypedef struct {\n\tbdaddr_t\tbdaddr;                    /* remote unit address */\n\tu_int8_t\tuclass[NG_HCI_CLASS_SIZE]; /* remote unit class */\n\tu_int8_t\tlink_type;                 /* link type */\n} __attribute__ ((packed)) ng_hci_con_req_ep;\n\n#define NG_HCI_EVENT_DISCON_COMPL\t\t0x05\ntypedef struct {\n\tu_int8_t\tstatus;     /* 0x00 - success */\n\tu_int16_t\tcon_handle; /* connection handle */\n\tu_int8_t\treason;     /* reason to disconnect */\n} __attribute__ ((packed)) ng_hci_discon_compl_ep;\n\n#define NG_HCI_EVENT_AUTH_COMPL\t\t\t0x06\ntypedef struct {\n\tu_int8_t\tstatus;     /* 0x00 - success */\n\tu_int16_t\tcon_handle; /* connection handle */\n} __attribute__ ((packed)) ng_hci_auth_compl_ep;\n\n#define NG_HCI_EVENT_REMOTE_NAME_REQ_COMPL\t0x7\ntypedef struct {\n\tu_int8_t\tstatus; /* 0x00 - success */\n\tbdaddr_t\tbdaddr; /* remote unit address */\n\tchar\t\tname[NG_HCI_UNIT_NAME_SIZE]; /* remote unit name */\n} __attribute__ ((packed)) ng_hci_remote_name_req_compl_ep;\n\n#define NG_HCI_EVENT_ENCRYPTION_CHANGE\t\t0x08\ntypedef struct {\n\tu_int8_t\tstatus;            /* 0x00 - success */\n\tu_int16_t\tcon_handle;        /* Connection handle */\n\tu_int8_t\tencryption_enable; /* 0x00 - disable */\n} __attribute__ ((packed)) ng_hci_encryption_change_ep;\n\n#define NG_HCI_EVENT_CHANGE_CON_LINK_KEY_COMPL\t0x09\ntypedef struct {\n\tu_int8_t\tstatus;     /* 0x00 - success */\n\tu_int16_t\tcon_handle; /* Connection handle */\n} __attribute__ ((packed)) ng_hci_change_con_link_key_compl_ep;\n\n#define NG_HCI_EVENT_MASTER_LINK_KEY_COMPL\t0x0a\ntypedef struct {\n\tu_int8_t\tstatus;     /* 0x00 - success */\n\tu_int16_t\tcon_handle; /* Connection handle */\n\tu_int8_t\tkey_flag;   /* Key flag */\n} __attribute__ ((packed)) ng_hci_master_link_key_compl_ep;\n\n#define NG_HCI_EVENT_READ_REMOTE_FEATURES_COMPL\t0x0b\ntypedef struct {\n\tu_int8_t\tstatus;                         /* 0x00 - success */\n\tu_int16_t\tcon_handle;                     /* Connection handle */\n\tu_int8_t\tfeatures[NG_HCI_FEATURES_SIZE]; /* LMP features bitmsk*/\n} __attribute__ ((packed)) ng_hci_read_remote_features_compl_ep;\n\n#define NG_HCI_EVENT_READ_REMOTE_VER_INFO_COMPL\t0x0c\ntypedef struct {\n\tu_int8_t\tstatus;         /* 0x00 - success */\n\tu_int16_t\tcon_handle;     /* Connection handle */\n\tu_int8_t\tlmp_version;    /* LMP version */\n\tu_int16_t\tmanufacturer;   /* Hardware manufacturer name */\n\tu_int16_t\tlmp_subversion; /* LMP sub-version */\n} __attribute__ ((packed)) ng_hci_read_remote_ver_info_compl_ep;\n\n#define NG_HCI_EVENT_QOS_SETUP_COMPL\t\t0x0d\ntypedef struct {\n\tu_int8_t\tstatus;          /* 0x00 - success */\n\tu_int16_t\tcon_handle;      /* connection handle */\n\tu_int8_t\tflags;           /* reserved for future use */\n\tu_int8_t\tservice_type;    /* service type */\n\tu_int32_t\ttoken_rate;      /* bytes per second */\n\tu_int32_t\tpeak_bandwidth;  /* bytes per second */\n\tu_int32_t\tlatency;         /* microseconds */\n\tu_int32_t\tdelay_variation; /* microseconds */\n} __attribute__ ((packed)) ng_hci_qos_setup_compl_ep;\n\n#define NG_HCI_EVENT_COMMAND_COMPL\t\t0x0e\ntypedef struct {\n\tu_int8_t\tnum_cmd_pkts; /* # of HCI command packets */\n\tu_int16_t\topcode;       /* command OpCode */\n\t/* command return parameters (if any) */\n} __attribute__ ((packed)) ng_hci_command_compl_ep;\n\n#define NG_HCI_EVENT_COMMAND_STATUS\t\t0x0f\ntypedef struct {\n\tu_int8_t\tstatus;       /* 0x00 - pending */\n\tu_int8_t\tnum_cmd_pkts; /* # of HCI command packets */\n\tu_int16_t\topcode;       /* command OpCode */\n} __attribute__ ((packed)) ng_hci_command_status_ep;\n\n#define NG_HCI_EVENT_HARDWARE_ERROR\t\t0x10\ntypedef struct {\n\tu_int8_t\thardware_code; /* hardware error code */\n} __attribute__ ((packed)) ng_hci_hardware_error_ep;\n\n#define NG_HCI_EVENT_FLUSH_OCCUR\t\t0x11\ntypedef struct {\n\tu_int16_t\tcon_handle; /* connection handle */\n} __attribute__ ((packed)) ng_hci_flush_occur_ep;\n\n#define NG_HCI_EVENT_ROLE_CHANGE\t\t0x12\ntypedef struct {\n\tu_int8_t\tstatus; /* 0x00 - success */\n\tbdaddr_t\tbdaddr; /* address of remote unit */\n\tu_int8_t\trole;   /* new connection role */\n} __attribute__ ((packed)) ng_hci_role_change_ep;\n\n#define NG_HCI_EVENT_NUM_COMPL_PKTS\t\t0x13\ntypedef struct {\n\tu_int8_t\tnum_con_handles; /* # of connection handles */\n/* these are repeated \"num_con_handles\" times \n\tu_int16_t\tcon_handle; --- connection handle(s)\n\tu_int16_t\tcompl_pkt;  --- # of completed packets */\n} __attribute__ ((packed)) ng_hci_num_compl_pkts_ep;\n\n#define NG_HCI_EVENT_MODE_CHANGE\t\t0x14\ntypedef struct {\n\tu_int8_t\tstatus;     /* 0x00 - success */\n\tu_int16_t\tcon_handle; /* connection handle */\n\tu_int8_t\tunit_mode;  /* remote unit mode */\n\tu_int16_t\tinterval;   /* interval * 0.625 msec */\n} __attribute__ ((packed)) ng_hci_mode_change_ep;\n\n#define NG_HCI_EVENT_RETURN_LINK_KEYS\t\t0x15\ntypedef struct {\n\tu_int8_t\tnum_keys; /* # of keys */\n/* these are repeated \"num_keys\" times \n\tbdaddr_t\tbdaddr;               --- remote address(es)\n\tu_int8_t\tkey[NG_HCI_KEY_SIZE]; --- key(s) */\n} __attribute__ ((packed)) ng_hci_return_link_keys_ep;\n\n#define NG_HCI_EVENT_PIN_CODE_REQ\t\t0x16\ntypedef struct {\n\tbdaddr_t\tbdaddr; /* remote unit address */\n} __attribute__ ((packed)) ng_hci_pin_code_req_ep;\n\n#define NG_HCI_EVENT_LINK_KEY_REQ\t\t0x17\ntypedef struct {\n\tbdaddr_t\tbdaddr; /* remote unit address */\n} __attribute__ ((packed)) ng_hci_link_key_req_ep;\n\n#define NG_HCI_EVENT_LINK_KEY_NOTIFICATION\t0x18\ntypedef struct {\n\tbdaddr_t\tbdaddr;               /* remote unit address */\n\tu_int8_t\tkey[NG_HCI_KEY_SIZE]; /* link key */\n\tu_int8_t\tkey_type;             /* type of the key */\n} __attribute__ ((packed)) ng_hci_link_key_notification_ep;\n\n#define NG_HCI_EVENT_LOOPBACK_COMMAND\t\t0x19\ntypedef struct {\n\tu_int8_t\tcommand[0]; /* Command packet */\n} __attribute__ ((packed)) ng_hci_loopback_command_ep;\n\n#define NG_HCI_EVENT_DATA_BUFFER_OVERFLOW\t0x1a\ntypedef struct {\n\tu_int8_t\tlink_type; /* Link type */\n} __attribute__ ((packed)) ng_hci_data_buffer_overflow_ep;\n\n#define NG_HCI_EVENT_MAX_SLOT_CHANGE\t\t0x1b\ntypedef struct {\n\tu_int16_t\tcon_handle;    /* connection handle */\n\tu_int8_t\tlmp_max_slots; /* Max. # of slots allowed */\n} __attribute__ ((packed)) ng_hci_max_slot_change_ep;\n\n#define NG_HCI_EVENT_READ_CLOCK_OFFSET_COMPL\t0x1c\ntypedef struct {\n\tu_int8_t\tstatus;       /* 0x00 - success */\n\tu_int16_t\tcon_handle;   /* Connection handle */\n\tu_int16_t\tclock_offset; /* Clock offset */\n} __attribute__ ((packed)) ng_hci_read_clock_offset_compl_ep;\n\n#define NG_HCI_EVENT_CON_PKT_TYPE_CHANGED\t0x1d\ntypedef struct {\n\tu_int8_t\tstatus;     /* 0x00 - success */\n\tu_int16_t\tcon_handle; /* connection handle */\n\tu_int16_t\tpkt_type;   /* packet type */\n} __attribute__ ((packed)) ng_hci_con_pkt_type_changed_ep;\n\n#define NG_HCI_EVENT_QOS_VIOLATION\t\t0x1e\ntypedef struct {\n\tu_int16_t\tcon_handle; /* connection handle */\n} __attribute__ ((packed)) ng_hci_qos_violation_ep;\n\n#define NG_HCI_EVENT_PAGE_SCAN_MODE_CHANGE\t0x1f\ntypedef struct {\n\tbdaddr_t\tbdaddr;         /* destination address */\n\tu_int8_t\tpage_scan_mode; /* page scan mode */\n} __attribute__ ((packed)) ng_hci_page_scan_mode_change_ep;\n\n#define NG_HCI_EVENT_PAGE_SCAN_REP_MODE_CHANGE\t0x20\ntypedef struct {\n\tbdaddr_t\tbdaddr;             /* destination address */\n\tu_int8_t\tpage_scan_rep_mode; /* page scan repetition mode */\n} __attribute__ ((packed)) ng_hci_page_scan_rep_mode_change_ep;\n\n#define NG_HCI_EVENT_BT_LOGO\t\t\t0xfe\n\n#define NG_HCI_EVENT_VENDOR\t\t\t0xff\n\n#endif /* ndef _NETGRAPH_HCI_H_ */\n"
  },
  {
    "path": "freebsd-headers/netgraph/bluetooth/include/ng_l2cap.h",
    "content": "/*\n * ng_l2cap.h\n */\n\n/*-\n * Copyright (c) Maksim Yevmenkin <m_evmenkin@yahoo.com>\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $Id: ng_l2cap.h,v 1.2 2003/04/27 00:52:26 max Exp $\n * $FreeBSD: release/9.0.0/sys/netgraph/bluetooth/include/ng_l2cap.h 149679 2005-08-31 18:13:23Z emax $\n */\n\n/*\n * This file contains everything that application needs to know about\n * Link Layer Control and Adaptation Protocol (L2CAP). All information \n * was obtained from Bluetooth Specification Book v1.1.\n *\n * This file can be included by both kernel and userland applications.\n */\n\n#ifndef _NETGRAPH_L2CAP_H_\n#define _NETGRAPH_L2CAP_H_\n\n/**************************************************************************\n **************************************************************************\n **     Netgraph node hook name, type name and type cookie and commands\n **************************************************************************\n **************************************************************************/\n\n/* Netgraph node hook names */\n#define NG_L2CAP_HOOK_HCI\t\t\"hci\"\t/* HCI   <-> L2CAP */\n#define NG_L2CAP_HOOK_L2C\t\t\"l2c\"\t/* L2CAP <-> Upper */\n#define NG_L2CAP_HOOK_CTL\t\t\"ctl\"\t/* L2CAP <-> User  */ \n\n/* Node type name and type cookie */\n#define NG_L2CAP_NODE_TYPE\t\t\"l2cap\"\n#define NGM_L2CAP_COOKIE\t\t1000774185\n\n/**************************************************************************\n **************************************************************************\n **                   Common defines and types (L2CAP)\n **************************************************************************\n **************************************************************************/\n\n/*\n * Channel IDs are assigned relative to the instance of L2CAP node, i.e.\n * relative to the unit. So the total number of channels that unit can have\n * open at the same time is 0xffff - 0x0040 = 0xffbf (65471). This number\n * does not depend on number of connections.\n */\n\n#define NG_L2CAP_NULL_CID\t0x0000\t/* DO NOT USE THIS CID */\n#define NG_L2CAP_SIGNAL_CID\t0x0001\t/* signaling channel ID */\n#define NG_L2CAP_CLT_CID\t0x0002\t/* connectionless channel ID */\n\t/* 0x0003 - 0x003f Reserved */\n#define NG_L2CAP_FIRST_CID\t0x0040\t/* dynamically alloc. (start) */\n#define NG_L2CAP_LAST_CID\t0xffff\t/* dynamically alloc. (end) */\n\n/* L2CAP MTU */\n#define NG_L2CAP_MTU_MINIMUM\t\t48\n#define NG_L2CAP_MTU_DEFAULT\t\t672\n#define NG_L2CAP_MTU_MAXIMUM\t\t0xffff\n\n/* L2CAP flush and link timeouts */\n#define NG_L2CAP_FLUSH_TIMO_DEFAULT\t0xffff /* always retransmit */\n#define NG_L2CAP_LINK_TIMO_DEFAULT\t0xffff\n\n/* L2CAP Command Reject reasons */\n#define NG_L2CAP_REJ_NOT_UNDERSTOOD\t0x0000\n#define NG_L2CAP_REJ_MTU_EXCEEDED\t0x0001\n#define NG_L2CAP_REJ_INVALID_CID\t0x0002\n/* 0x0003 - 0xffff - reserved for future use */\n\n/* Protocol/Service Multioplexor (PSM) values */\n#define NG_L2CAP_PSM_ANY\t\t0x0000\t/* Any/Invalid PSM */\n#define NG_L2CAP_PSM_SDP\t\t0x0001\t/* Service Discovery Protocol */\n#define NG_L2CAP_PSM_RFCOMM\t\t0x0003\t/* RFCOMM protocol */\n#define NG_L2CAP_PSM_TCP\t\t0x0005\t/* Telephony Control Protocol */\n/* 0x0006 - 0x1000 - reserved for future use */\n\n/* L2CAP Connection response command result codes */\n#define NG_L2CAP_SUCCESS\t\t0x0000\n#define NG_L2CAP_PENDING\t\t0x0001\n#define NG_L2CAP_PSM_NOT_SUPPORTED\t0x0002\n#define NG_L2CAP_SEQUIRY_BLOCK\t\t0x0003\n#define NG_L2CAP_NO_RESOURCES\t\t0x0004\n#define NG_L2CAP_TIMEOUT\t\t0xeeee\n#define NG_L2CAP_UNKNOWN\t\t0xffff\n/* 0x0005 - 0xffff - reserved for future use */\n\n/* L2CAP Connection response status codes */\n#define NG_L2CAP_NO_INFO\t\t0x0000\n#define NG_L2CAP_AUTH_PENDING\t\t0x0001\n#define NG_L2CAP_AUTZ_PENDING\t\t0x0002\n/* 0x0003 - 0xffff - reserved for future use */\n\n/* L2CAP Configuration response result codes */\n#define NG_L2CAP_UNACCEPTABLE_PARAMS\t0x0001\n#define NG_L2CAP_REJECT\t\t\t0x0002\n#define NG_L2CAP_UNKNOWN_OPTION\t\t0x0003\n/* 0x0003 - 0xffff - reserved for future use */\n\n/* L2CAP Configuration options */\n#define NG_L2CAP_OPT_CFLAG_BIT\t\t0x0001\n#define NG_L2CAP_OPT_CFLAG(flags)\t((flags) & NG_L2CAP_OPT_CFLAG_BIT)\n#define NG_L2CAP_OPT_HINT_BIT\t\t0x80\n#define NG_L2CAP_OPT_HINT(type)\t\t((type) & NG_L2CAP_OPT_HINT_BIT)\n#define NG_L2CAP_OPT_HINT_MASK\t\t0x7f\n#define NG_L2CAP_OPT_MTU\t\t0x01\n#define NG_L2CAP_OPT_MTU_SIZE\t\tsizeof(u_int16_t)\n#define NG_L2CAP_OPT_FLUSH_TIMO\t\t0x02\n#define NG_L2CAP_OPT_FLUSH_TIMO_SIZE\tsizeof(u_int16_t)\n#define NG_L2CAP_OPT_QOS\t\t0x03\n#define NG_L2CAP_OPT_QOS_SIZE\t\tsizeof(ng_l2cap_flow_t)\n/* 0x4 - 0xff - reserved for future use */\n\n/* L2CAP Information request type codes */\n#define NG_L2CAP_CONNLESS_MTU\t\t0x0001\n/* 0x0002 - 0xffff - reserved for future use */\n\n/* L2CAP Information response codes */\n#define NG_L2CAP_NOT_SUPPORTED\t\t0x0001\n/* 0x0002 - 0xffff - reserved for future use */\n\n/* L2CAP flow control */\ntypedef struct {\n\tu_int8_t\tflags;             /* reserved for future use */\n\tu_int8_t\tservice_type;      /* service type */\n\tu_int32_t\ttoken_rate;        /* bytes per second */\n\tu_int32_t\ttoken_bucket_size; /* bytes */\n\tu_int32_t\tpeak_bandwidth;    /* bytes per second */\n\tu_int32_t\tlatency;           /* microseconds */\n\tu_int32_t\tdelay_variation;   /* microseconds */\n} __attribute__ ((packed)) ng_l2cap_flow_t;\ntypedef ng_l2cap_flow_t *\tng_l2cap_flow_p;\n\n/**************************************************************************\n **************************************************************************\n **                 Link level defines, headers and types\n **************************************************************************\n **************************************************************************/\n\n/* L2CAP header */\ntypedef struct {\n\tu_int16_t\tlength;\t/* payload size */\n\tu_int16_t\tdcid;\t/* destination channel ID */\n} __attribute__ ((packed)) ng_l2cap_hdr_t;\n\n/* L2CAP ConnectionLess Traffic (CLT) (if destination cid == 0x2) */\ntypedef struct {\n\tu_int16_t\tpsm; /* Protocol/Service Multiplexor */\n} __attribute__ ((packed)) ng_l2cap_clt_hdr_t;\n\n#define NG_L2CAP_CLT_MTU_MAXIMUM \\\n\t(NG_L2CAP_MTU_MAXIMUM - sizeof(ng_l2cap_clt_hdr_t))\n\n/* L2CAP command header */\ntypedef struct {\n\tu_int8_t\tcode;   /* command OpCode */\n\tu_int8_t\tident;  /* identifier to match request and response */\n\tu_int16_t\tlength; /* command parameters length */\n} __attribute__ ((packed)) ng_l2cap_cmd_hdr_t;\n\n/* L2CAP Command Reject */\n#define NG_L2CAP_CMD_REJ\t0x01\ntypedef struct {\n\tu_int16_t\treason; /* reason to reject command */\n/*\tu_int8_t\tdata[]; -- optional data (depends on reason) */\n} __attribute__ ((packed)) ng_l2cap_cmd_rej_cp;\n\n/* CommandReject data */\ntypedef union {\n \t/* NG_L2CAP_REJ_MTU_EXCEEDED */\n\tstruct {\n\t\tu_int16_t\tmtu; /* actual signaling MTU */\n\t} __attribute__ ((packed)) mtu;\n\t/* NG_L2CAP_REJ_INVALID_CID */\n\tstruct {\n\t\tu_int16_t\tscid; /* local CID */\n\t\tu_int16_t\tdcid; /* remote CID */\n\t} __attribute__ ((packed)) cid;\n} ng_l2cap_cmd_rej_data_t;\ntypedef ng_l2cap_cmd_rej_data_t * ng_l2cap_cmd_rej_data_p;\n\n/* L2CAP Connection Request */\n#define NG_L2CAP_CON_REQ\t0x02\ntypedef struct {\n\tu_int16_t\tpsm;  /* Protocol/Service Multiplexor (PSM) */\n\tu_int16_t\tscid; /* source channel ID */\n} __attribute__ ((packed)) ng_l2cap_con_req_cp;\n\n/* L2CAP Connection Response */\n#define NG_L2CAP_CON_RSP\t0x03\ntypedef struct {\n\tu_int16_t\tdcid;   /* destination channel ID */\n\tu_int16_t\tscid;   /* source channel ID */\n\tu_int16_t\tresult; /* 0x00 - success */\n\tu_int16_t\tstatus; /* more info if result != 0x00 */\n} __attribute__ ((packed)) ng_l2cap_con_rsp_cp;\n\n/* L2CAP Configuration Request */\n#define NG_L2CAP_CFG_REQ\t0x04\ntypedef struct {\n\tu_int16_t\tdcid;  /* destination channel ID */\n\tu_int16_t\tflags; /* flags */\n/*\tu_int8_t\toptions[] --  options */\n} __attribute__ ((packed)) ng_l2cap_cfg_req_cp;\n\n/* L2CAP Configuration Response */\n#define NG_L2CAP_CFG_RSP\t0x05\ntypedef struct {\n\tu_int16_t\tscid;   /* source channel ID */\n\tu_int16_t\tflags;  /* flags */\n\tu_int16_t\tresult; /* 0x00 - success */\n/*\tu_int8_t\toptions[] -- options */\n} __attribute__ ((packed)) ng_l2cap_cfg_rsp_cp;\n\n/* L2CAP configuration option */\ntypedef struct {\n\tu_int8_t\ttype;\n\tu_int8_t\tlength;\n/*\tu_int8_t\tvalue[] -- option value (depends on type) */\n} __attribute__ ((packed)) ng_l2cap_cfg_opt_t;\ntypedef ng_l2cap_cfg_opt_t * ng_l2cap_cfg_opt_p;\n\n/* L2CAP configuration option value */\ntypedef union {\n\tu_int16_t\t\tmtu;\t\t/* NG_L2CAP_OPT_MTU */\n\tu_int16_t\t\tflush_timo;\t/* NG_L2CAP_OPT_FLUSH_TIMO */\n\tng_l2cap_flow_t\t\tflow;\t\t/* NG_L2CAP_OPT_QOS */\n} ng_l2cap_cfg_opt_val_t;\ntypedef ng_l2cap_cfg_opt_val_t * ng_l2cap_cfg_opt_val_p;\n\n/* L2CAP Disconnect Request */\n#define NG_L2CAP_DISCON_REQ\t0x06\ntypedef struct {\n\tu_int16_t\tdcid; /* destination channel ID */\n\tu_int16_t\tscid; /* source channel ID */\n} __attribute__ ((packed)) ng_l2cap_discon_req_cp;\n\n/* L2CAP Disconnect Response */\n#define NG_L2CAP_DISCON_RSP\t0x07\ntypedef ng_l2cap_discon_req_cp\tng_l2cap_discon_rsp_cp;\n\n/* L2CAP Echo Request */\n#define NG_L2CAP_ECHO_REQ\t0x08\n/* No command parameters, only optional data */\n\n/* L2CAP Echo Response */\n#define NG_L2CAP_ECHO_RSP\t0x09\n#define NG_L2CAP_MAX_ECHO_SIZE \\\n\t(NG_L2CAP_MTU_MAXIMUM - sizeof(ng_l2cap_cmd_hdr_t))\n/* No command parameters, only optional data */\n\n/* L2CAP Information Request */\n#define NG_L2CAP_INFO_REQ\t0x0a\ntypedef struct {\n\tu_int16_t\ttype; /* requested information type */\n} __attribute__ ((packed)) ng_l2cap_info_req_cp;\n\n/* L2CAP Information Response */\n#define NG_L2CAP_INFO_RSP\t0x0b\ntypedef struct {\n\tu_int16_t\ttype;   /* requested information type */\n\tu_int16_t\tresult; /* 0x00 - success */\n/*\tu_int8_t\tinfo[]  -- info data (depends on type)\n *\n * NG_L2CAP_CONNLESS_MTU - 2 bytes connectionless MTU\n */\n} __attribute__ ((packed)) ng_l2cap_info_rsp_cp;\n\ntypedef union {\n \t/* NG_L2CAP_CONNLESS_MTU */\n\tstruct {\n\t\tu_int16_t\tmtu;\n\t} __attribute__ ((packed)) mtu;\n} ng_l2cap_info_rsp_data_t;\ntypedef ng_l2cap_info_rsp_data_t *\tng_l2cap_info_rsp_data_p;\n\n/**************************************************************************\n **************************************************************************\n **        Upper layer protocol interface. L2CA_xxx messages \n **************************************************************************\n **************************************************************************/\n\n/*\n * NOTE! NOTE! NOTE!\n *\n * Bluetooth specification says that L2CA_xxx request must block until\n * response is ready. We are not allowed to block in Netgraph, so we \n * need to queue request and save some information that can be used \n * later and help match request and response.\n *\n * The idea is to use \"token\" field from Netgraph message header. The\n * upper layer protocol _MUST_ populate \"token\". L2CAP will queue request\n * (using L2CAP command descriptor) and start processing. Later, when\n * response is ready or timeout has occur L2CAP layer will create new \n * Netgraph message, set \"token\" and RESP flag and send the message to\n * the upper layer protocol. \n *\n * L2CA_xxx_Ind messages _WILL_NOT_ populate \"token\" and _WILL_NOT_\n * set RESP flag. There is no reason for this, because they are just\n * notifications and do not require acknowlegment.\n *\n * NOTE: This is _NOT_ what NG_MKRESPONSE and NG_RESPOND_MSG do, however\n *       it is somewhat similar.\n */\n\n/* L2CA data packet header */\ntypedef struct {\n\tu_int32_t\ttoken;\t/* token to use in L2CAP_L2CA_WRITE */\n\tu_int16_t\tlength;\t/* length of the data */\n\tu_int16_t\tlcid;\t/* local channel ID */\n} __attribute__ ((packed)) ng_l2cap_l2ca_hdr_t;\n\n/* L2CA_Connect */\n#define NGM_L2CAP_L2CA_CON\t\t0x80\n/* Upper -> L2CAP */\ntypedef struct {\n\tu_int16_t\tpsm;    /* Protocol/Service Multiplexor */\n\tbdaddr_t\tbdaddr;\t/* remote unit address */\n} ng_l2cap_l2ca_con_ip;\n\n/* L2CAP -> Upper */\ntypedef struct {\n\tu_int16_t\tlcid;   /* local channel ID */\n\tu_int16_t\tresult; /* 0x00 - success */\n\tu_int16_t\tstatus; /* if result != 0x00 */\n} ng_l2cap_l2ca_con_op;\n\n/* L2CA_ConnectInd */\n#define NGM_L2CAP_L2CA_CON_IND\t\t0x81\n/* L2CAP -> Upper */\ntypedef struct {\n\tbdaddr_t\tbdaddr; /* remote unit address */\n\tu_int16_t\tlcid;   /* local channel ID */\n\tu_int16_t\tpsm;    /* Procotol/Service Multiplexor */\n\tu_int8_t\tident;  /* indentifier */\n\tu_int8_t\tunused; /* place holder */\n} ng_l2cap_l2ca_con_ind_ip;\n/* No output parameters */\n\n/* L2CA_ConnectRsp */\n#define NGM_L2CAP_L2CA_CON_RSP\t\t0x82\n/* Upper -> L2CAP */\ntypedef struct {\n\tbdaddr_t\tbdaddr; /* remote unit address */\n\tu_int8_t\tident;  /* \"ident\" from L2CAP_ConnectInd event */\n\tu_int8_t\tunused; /* place holder */\n\tu_int16_t\tlcid;   /* local channel ID */\n\tu_int16_t\tresult; /* 0x00 - success */ \n\tu_int16_t\tstatus; /* if response != 0x00 */ \n} ng_l2cap_l2ca_con_rsp_ip;\n\n/* L2CAP -> Upper */\ntypedef struct {\n\tu_int16_t\tresult; /* 0x00 - success */\n} ng_l2cap_l2ca_con_rsp_op;\n\n/* L2CA_Config */\n#define NGM_L2CAP_L2CA_CFG\t\t0x83\n/* Upper -> L2CAP */\ntypedef struct {\n\tu_int16_t\tlcid;        /* local channel ID */\n\tu_int16_t\timtu;        /* receiving MTU for the local channel */\n\tng_l2cap_flow_t\toflow;       /* out flow */\n\tu_int16_t\tflush_timo;  /* flush timeout (msec) */\n\tu_int16_t\tlink_timo;   /* link timeout (msec) */\n} ng_l2cap_l2ca_cfg_ip;\n\n/* L2CAP -> Upper */\ntypedef struct {\n\tu_int16_t\tresult;      /* 0x00 - success */\n\tu_int16_t\timtu;        /* sending MTU for the remote channel */\n\tng_l2cap_flow_t\toflow;       /* out flow */\n\tu_int16_t\tflush_timo;  /* flush timeout (msec) */\n} ng_l2cap_l2ca_cfg_op;\n\n/* L2CA_ConfigRsp */\n#define NGM_L2CAP_L2CA_CFG_RSP\t\t0x84\n/* Upper -> L2CAP */\ntypedef struct {\n\tu_int16_t\tlcid;  /* local channel ID */\n\tu_int16_t\tomtu;  /* sending MTU for the local channel */\n\tng_l2cap_flow_t\tiflow; /* in FLOW */\n} ng_l2cap_l2ca_cfg_rsp_ip;\n\n/* L2CAP -> Upper */\ntypedef struct {\n\tu_int16_t\tresult; /* 0x00 - sucsess */\n} ng_l2cap_l2ca_cfg_rsp_op;\n\n/* L2CA_ConfigInd */\n#define NGM_L2CAP_L2CA_CFG_IND\t\t0x85\n/* L2CAP -> Upper */\ntypedef struct {\n\tu_int16_t\tlcid;        /* local channel ID */\n\tu_int16_t\tomtu;        /* outgoing MTU for the local channel */\n\tng_l2cap_flow_t\tiflow;       /* in flow */\n\tu_int16_t\tflush_timo;  /* flush timeout (msec) */\n} ng_l2cap_l2ca_cfg_ind_ip;\n/* No output parameters */\n\n/* L2CA_QoSViolationInd */\n#define NGM_L2CAP_L2CA_QOS_IND\t\t0x86\n/* L2CAP -> Upper */\ntypedef struct {\n\tbdaddr_t\tbdaddr;\t/* remote unit address */\n} ng_l2cap_l2ca_qos_ind_ip;\n/* No output parameters */\n\n/* L2CA_Disconnect */\n#define NGM_L2CAP_L2CA_DISCON\t\t0x87\n/* Upper -> L2CAP */\ntypedef struct {\n\tu_int16_t\tlcid;  /* local channel ID */\n} ng_l2cap_l2ca_discon_ip;\n\n/* L2CAP -> Upper */\ntypedef struct {\n\tu_int16_t\tresult; /* 0x00 - sucsess */\n} ng_l2cap_l2ca_discon_op;\n\n/* L2CA_DisconnectInd */\n#define NGM_L2CAP_L2CA_DISCON_IND\t0x88\n/* L2CAP -> Upper */\ntypedef ng_l2cap_l2ca_discon_ip ng_l2cap_l2ca_discon_ind_ip;\n/* No output parameters */\n\n/* L2CA_Write response */\n#define NGM_L2CAP_L2CA_WRITE\t\t0x89\n/* No input parameters */\n\n/* L2CAP -> Upper */\ntypedef struct {\n\tint\t\tresult;\t/* result (0x00 - success) */\n\tu_int16_t\tlength;\t/* amount of data written */\n\tu_int16_t\tlcid;\t/* local channel ID */\n} ng_l2cap_l2ca_write_op;\n\n/* L2CA_GroupCreate */\n#define NGM_L2CAP_L2CA_GRP_CREATE\t0x8a\n/* Upper -> L2CAP */\ntypedef struct {\n\tu_int16_t\tpsm;   /* Protocol/Service Multiplexor */\n} ng_l2cap_l2ca_grp_create_ip;\n\n/* L2CAP -> Upper */\ntypedef struct {\n\tu_int16_t\tlcid;  /* local group channel ID */\n} ng_l2cap_l2ca_grp_create_op;\n\n/* L2CA_GroupClose */\n#define NGM_L2CAP_L2CA_GRP_CLOSE\t0x8b\n/* Upper -> L2CAP */\ntypedef struct {\n\tu_int16_t\tlcid;  /* local group channel ID */\n} ng_l2cap_l2ca_grp_close_ip;\n\n#if 0\n/* L2CAP -> Upper */\n * typedef struct {\n * \tu_int16_t\tresult; /* 0x00 - success */\n * } ng_l2cap_l2ca_grp_close_op;\n#endif\n\n/* L2CA_GroupAddMember */\n#define NGM_L2CAP_L2CA_GRP_ADD_MEMBER\t0x8c\n/* Upper -> L2CAP */\ntypedef struct {\n\tu_int16_t\tlcid;   /* local group channel ID */\n\tbdaddr_t\tbdaddr; /* remote unit address */\n} ng_l2cap_l2ca_grp_add_member_ip;\n\n/* L2CAP -> Upper */\ntypedef struct {\n\tu_int16_t\tresult; /* 0x00 - success */\n} ng_l2cap_l2ca_grp_add_member_op;\n\n/* L2CA_GroupRemoveMember */\n#define NGM_L2CAP_L2CA_GRP_REM_MEMBER\t0x8d\n/* Upper -> L2CAP */\ntypedef ng_l2cap_l2ca_grp_add_member_ip\tng_l2cap_l2ca_grp_rem_member_ip;\n\n/* L2CAP -> Upper */\n#if 0\n * typedef ng_l2cap_l2ca_grp_add_member_op\tng_l2cap_l2ca_grp_rem_member_op;\n#endif\n\n/* L2CA_GroupMembeship */\n#define NGM_L2CAP_L2CA_GRP_MEMBERSHIP\t0x8e\n/* Upper -> L2CAP */\ntypedef struct {\n\tu_int16_t\tlcid;  /* local group channel ID */\n} ng_l2cap_l2ca_grp_get_members_ip;\n\n/* L2CAP -> Upper */\ntypedef struct {\n\tu_int16_t\tresult;   /* 0x00 - success */\n\tu_int16_t\tnmembers; /* number of group members */\n/*\tbdaddr_t\tmembers[] -- group memebers */\n} ng_l2cap_l2ca_grp_get_members_op;\n\n/* L2CA_Ping */\n#define NGM_L2CAP_L2CA_PING\t\t0x8f\n/* Upper -> L2CAP */\ntypedef struct {\n\tbdaddr_t\tbdaddr;    /* remote unit address */\n\tu_int16_t\techo_size; /* size of echo data in bytes */\n/*\tu_int8_t\techo_data[] -- echo data */\n} ng_l2cap_l2ca_ping_ip;\n\n/* L2CAP -> Upper */\ntypedef struct {\n\tu_int16_t\tresult;    /* 0x00 - success */\n\tbdaddr_t\tbdaddr;    /* remote unit address */\n\tu_int16_t\techo_size; /* size of echo data in bytes */\n/*\tu_int8_t\techo_data[] -- echo data */\n} ng_l2cap_l2ca_ping_op;\n\n/* L2CA_GetInfo */\n#define NGM_L2CAP_L2CA_GET_INFO\t\t0x90\n/* Upper -> L2CAP */\ntypedef struct {\n\tbdaddr_t\tbdaddr;\t   /* remote unit address */\n\tu_int16_t\tinfo_type; /* info type */\n} ng_l2cap_l2ca_get_info_ip;\n\n/* L2CAP -> Upper */\ntypedef struct {\n\tu_int16_t\tresult;    /* 0x00 - success */\n\tu_int16_t\tinfo_size; /* size of info data in bytes */\n/*\tu_int8_t\tinfo_data[] -- info data */\n} ng_l2cap_l2ca_get_info_op;\n\n/* L2CA_EnableCLT/L2CA_DisableCLT */\n#define NGM_L2CAP_L2CA_ENABLE_CLT\t0x91\n/* Upper -> L2CAP */\ntypedef struct {\n\tu_int16_t\tpsm;    /* Protocol/Service Multiplexor */\n\tu_int16_t\tenable; /* 0x00 - disable */\n} ng_l2cap_l2ca_enable_clt_ip;\n\n#if 0\n/* L2CAP -> Upper */\n * typedef struct {\n * \tu_int16_t\tresult; /* 0x00 - success */\n * } ng_l2cap_l2ca_enable_clt_op;\n#endif\n\n/**************************************************************************\n **************************************************************************\n **                          L2CAP node messages\n **************************************************************************\n **************************************************************************/\n\n/* L2CAP connection states */\n#define NG_L2CAP_CON_CLOSED\t\t0\t/* connection closed */\n#define NG_L2CAP_W4_LP_CON_CFM\t\t1\t/* waiting... */\n#define NG_L2CAP_CON_OPEN\t\t2\t/* connection open */\n\n/* L2CAP channel states */\n#define NG_L2CAP_CLOSED\t\t\t0\t/* channel closed */\n#define NG_L2CAP_W4_L2CAP_CON_RSP\t1\t/* wait for L2CAP resp. */\n#define NG_L2CAP_W4_L2CA_CON_RSP\t2\t/* wait for upper resp. */\n#define NG_L2CAP_CONFIG\t\t\t3\t/* L2CAP configuration */\n#define NG_L2CAP_OPEN\t\t\t4\t/* channel open */\n#define NG_L2CAP_W4_L2CAP_DISCON_RSP\t5\t/* wait for L2CAP discon. */\n#define NG_L2CAP_W4_L2CA_DISCON_RSP\t6\t/* wait for upper discon. */\n\n/* Node flags */\n#define NG_L2CAP_CLT_SDP_DISABLED\t(1 << 0)      /* disable SDP CLT */\n#define NG_L2CAP_CLT_RFCOMM_DISABLED\t(1 << 1)      /* disable RFCOMM CLT */\n#define NG_L2CAP_CLT_TCP_DISABLED\t(1 << 2)      /* disable TCP CLT */\n\n/* Debug levels */\n#define NG_L2CAP_ALERT_LEVEL\t\t1\n#define NG_L2CAP_ERR_LEVEL\t\t2\n#define NG_L2CAP_WARN_LEVEL\t\t3\n#define NG_L2CAP_INFO_LEVEL\t\t4\n\n/* Get node flags (see flags above) */\n#define\tNGM_L2CAP_NODE_GET_FLAGS\t0x400\t/* L2CAP -> User */\ntypedef u_int16_t\tng_l2cap_node_flags_ep;\n\n/* Get/Set debug level (see levels above) */\n#define\tNGM_L2CAP_NODE_GET_DEBUG\t0x401\t/* L2CAP -> User */\n#define\tNGM_L2CAP_NODE_SET_DEBUG\t0x402\t/* User -> L2CAP */\ntypedef u_int16_t\tng_l2cap_node_debug_ep;\n\n#define NGM_L2CAP_NODE_HOOK_INFO\t0x409\t/* L2CAP -> Upper */\n/* bdaddr_t bdaddr; -- local (source BDADDR) */\n\n#define NGM_L2CAP_NODE_GET_CON_LIST\t0x40a\t/* L2CAP -> User */\ntypedef struct {\n\tu_int32_t\tnum_connections; /* number of connections */\n} ng_l2cap_node_con_list_ep;\n\n/* Connection flags */\n#define NG_L2CAP_CON_TX\t\t\t(1 << 0) /* sending data */\n#define NG_L2CAP_CON_RX\t\t\t(1 << 1) /* receiving data */\n#define NG_L2CAP_CON_OUTGOING\t\t(1 << 2) /* outgoing connection */\n#define NG_L2CAP_CON_LP_TIMO\t\t(1 << 3) /* LP timeout */\n#define NG_L2CAP_CON_AUTO_DISCON_TIMO\t(1 << 4) /* auto discon. timeout */\n#define NG_L2CAP_CON_DYING\t\t(1 << 5) /* connection is dying */\n\ntypedef struct {\n\tu_int8_t\tstate;      /* connection state */\n\tu_int8_t\tflags;      /* flags */\n\tint16_t\t\tpending;    /* num. pending packets */\n\tu_int16_t\tcon_handle; /* connection handle */\n\tbdaddr_t\tremote;     /* remote bdaddr */\n} ng_l2cap_node_con_ep;\n\n#define NG_L2CAP_MAX_CON_NUM \\\n\t((0xffff - sizeof(ng_l2cap_node_con_list_ep))/sizeof(ng_l2cap_node_con_ep))\n\n#define NGM_L2CAP_NODE_GET_CHAN_LIST\t0x40b\t/* L2CAP -> User */\ntypedef struct {\n\tu_int32_t\tnum_channels;\t/* number of channels */\n} ng_l2cap_node_chan_list_ep;\n\ntypedef struct {\n\tu_int32_t\tstate;\t\t/* channel state */\n\n\tu_int16_t\tscid;\t\t/* source (local) channel ID */\n\tu_int16_t\tdcid;\t\t/* destination (remote) channel ID */\n\n\tu_int16_t\timtu;\t\t/* incomming MTU */\n\tu_int16_t\tomtu;\t\t/* outgoing MTU */\n\n\tu_int16_t\tpsm;\t\t/* PSM */\n\tbdaddr_t\tremote;\t\t/* remote bdaddr */\n} ng_l2cap_node_chan_ep;\n\n#define NG_L2CAP_MAX_CHAN_NUM \\\n\t((0xffff - sizeof(ng_l2cap_node_chan_list_ep))/sizeof(ng_l2cap_node_chan_ep))\n\n#define NGM_L2CAP_NODE_GET_AUTO_DISCON_TIMO 0x40c /* L2CAP -> User */\n#define NGM_L2CAP_NODE_SET_AUTO_DISCON_TIMO 0x40d /* User -> L2CAP */\ntypedef u_int16_t\tng_l2cap_node_auto_discon_ep;\n\n#endif /* ndef _NETGRAPH_L2CAP_H_ */\n\n"
  },
  {
    "path": "freebsd-headers/netgraph/bluetooth/include/ng_ubt.h",
    "content": "/*\n * ng_ubt.h\n */\n\n/*-\n * Copyright (c) 2001-2002 Maksim Yevmenkin <m_evmenkin@yahoo.com>\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $Id: ng_ubt.h,v 1.6 2003/04/13 21:34:42 max Exp $\n * $FreeBSD: release/9.0.0/sys/netgraph/bluetooth/include/ng_ubt.h 139823 2005-01-07 01:45:51Z imp $\n */\n\n#ifndef _NG_UBT_H_\n#define _NG_UBT_H_\n\n/**************************************************************************\n **************************************************************************\n **     Netgraph node hook name, type name and type cookie and commands \n **************************************************************************  \n **************************************************************************/\n\n#define NG_UBT_NODE_TYPE\t\"ubt\"\n#define NG_UBT_HOOK\t\t\"hook\"\n\n#define NGM_UBT_COOKIE\t\t1021837971\n\n/* Debug levels */\n#define NG_UBT_ALERT_LEVEL\t1\n#define NG_UBT_ERR_LEVEL\t2\n#define NG_UBT_WARN_LEVEL\t3\n#define NG_UBT_INFO_LEVEL\t4\n\n/**************************************************************************\n **************************************************************************\n **                    UBT node command/event parameters\n **************************************************************************\n **************************************************************************/\n\n#define NGM_UBT_NODE_SET_DEBUG\t1\t\t/* set debug level */\n#define NGM_UBT_NODE_GET_DEBUG\t2\t\t/* get debug level */\ntypedef u_int16_t\t\tng_ubt_node_debug_ep; \n\n#define NGM_UBT_NODE_SET_QLEN\t3\t\t/* set queue length */\n#define NGM_UBT_NODE_GET_QLEN\t4\t\t/* get queue length */ \ntypedef struct {\n\tint32_t\t\tqueue;\t\t\t/* queue index */\n#define\tNGM_UBT_NODE_QUEUE_CMD\t1\t\t/* commands */\n#define\tNGM_UBT_NODE_QUEUE_ACL\t2\t\t/* ACL data */\n#define\tNGM_UBT_NODE_QUEUE_SCO\t3\t\t/* SCO data */\n\n\tint32_t\t\tqlen;\t\t\t/* queue length */\n} ng_ubt_node_qlen_ep;\n\n#define NGM_UBT_NODE_GET_STAT\t5\t\t/* get statistic */\ntypedef struct {\n\tu_int32_t\tpckts_recv;\t\t/* # of packets received */\n\tu_int32_t\tbytes_recv;\t\t/* # of bytes received */\n\tu_int32_t\tpckts_sent;\t\t/* # of packets sent */\n\tu_int32_t\tbytes_sent;\t\t/* # of bytes sent */\n\tu_int32_t\toerrors;\t\t/* # of output errors */\n\tu_int32_t\tierrors;\t\t/* # of input errors */\n} ng_ubt_node_stat_ep;\n\n#define NGM_UBT_NODE_RESET_STAT\t6\t\t/* reset statistic */\n\n#define NGM_UBT_NODE_DEV_NODES\t7\t\t/* on/off device interface */\ntypedef u_int16_t\tng_ubt_node_dev_nodes_ep;\n\n#endif /* ndef _NG_UBT_H_ */\n\n"
  },
  {
    "path": "freebsd-headers/netgraph/netflow/netflow.h",
    "content": "/*-\n * Copyright (c) 2010-2011 Alexander V. Chernikov <melifaro@ipfw.ru>\n * Copyright (c) 2004 Gleb Smirnoff <glebius@FreeBSD.org>\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t $SourceForge: netflow.h,v 1.8 2004/09/16 17:05:11 glebius Exp $\n *\t $FreeBSD: release/9.0.0/sys/netgraph/netflow/netflow.h 219182 2011-03-02 16:15:11Z glebius $\n */\n\n/* netflow timeouts in seconds */\n\n#define\tACTIVE_TIMEOUT\t\t(30*60)\t/* maximum flow lifetime is 30 min */\n#define\tINACTIVE_TIMEOUT\t15\n\n/*\n * More info can be found in these Cisco documents:\n *\n * Cisco IOS NetFlow, White Papers.\n * http://www.cisco.com/en/US/products/ps6601/prod_white_papers_list.html\n *\n * Cisco CNS NetFlow Collection Engine User Guide, 5.0.2, NetFlow Export\n * Datagram Formats.\n * http://www.cisco.com/en/US/products/sw/netmgtsw/ps1964/products_user_guide_chapter09186a00803f3147.html#wp26453\n *\n * Cisco Systems NetFlow Services Export Version 9\n * http://www.ietf.org/rfc/rfc3954.txt\n *\n */\n\n#define NETFLOW_V1 1\n#define NETFLOW_V5 5\n#define NETFLOW_V9 9\n\nstruct netflow_v1_header\n{\n  uint16_t version;\t/* NetFlow version */\n  uint16_t count;\t/* Number of records in flow */\n  uint32_t sys_uptime;\t/* System uptime */\n  uint32_t unix_secs;\t/* Current seconds since 0000 UTC 1970 */\n  uint32_t unix_nsecs;\t/* Remaining nanoseconds since 0000 UTC 1970 */\n} __attribute__((__packed__));\n\nstruct netflow_v5_header\n{\n  uint16_t version;\t/* NetFlow version */\n  uint16_t count;\t/* Number of records in flow */\n  uint32_t sys_uptime;\t/* System uptime */\n  uint32_t unix_secs;\t/* Current seconds since 0000 UTC 1970 */\n  uint32_t unix_nsecs;\t/* Remaining nanoseconds since 0000 UTC 1970 */\n  uint32_t flow_seq;\t/* Sequence number of the first record */\n  uint8_t engine_type;\t/* Type of flow switching engine (RP,VIP,etc.) */\n  uint8_t engine_id;\t/* Slot number of the flow switching engine */\n  uint16_t pad;\t\t/* Pad to word boundary */\n} __attribute__((__packed__));\n\nstruct netflow_v9_header\n{\n  uint16_t version;\t/* NetFlow version */\n  uint16_t count;\t/* Total number of records in packet */\n  uint32_t sys_uptime;\t/* System uptime */\n  uint32_t unix_secs;\t/* Current seconds since 0000 UTC 1970 */\n  uint32_t seq_num;\t/* Sequence number */\n  uint32_t source_id;\t/* Observation Domain id */\n} __attribute__((__packed__));\n\nstruct netflow_v1_record\n{\n  uint32_t src_addr;\t/* Source IP address */\n  uint32_t dst_addr;\t/* Destination IP address */\n  uint32_t next_hop;\t/* Next hop IP address */\n  uint16_t in_ifx;\t/* Source interface index */\n  uint16_t out_ifx;\t/* Destination interface index */\n  uint32_t packets;\t/* Number of packets in a flow */\n  uint32_t octets;\t/* Number of octets in a flow */\n  uint32_t first;\t/* System uptime at start of a flow */\n  uint32_t last;\t/* System uptime at end of a flow */\n  uint16_t s_port;\t/* Source port */\n  uint16_t d_port;\t/* Destination port */\n  uint16_t pad1;\t/* Pad to word boundary */\n  uint8_t prot;\t\t/* IP protocol */\n  uint8_t tos;\t\t/* IP type of service */\n  uint8_t flags;\t/* Cumulative OR of tcp flags */\n  uint8_t pad2;\t\t/* Pad to word boundary */\n  uint16_t pad3;\t/* Pad to word boundary */\n  uint8_t reserved[5];\t/* Reserved for future use */\n} __attribute__((__packed__));\n\nstruct netflow_v5_record\n{\n  uint32_t src_addr;\t/* Source IP address */\n  uint32_t dst_addr;\t/* Destination IP address */\n  uint32_t next_hop;\t/* Next hop IP address */\n  uint16_t i_ifx;\t/* Source interface index */\n  uint16_t o_ifx;\t/* Destination interface index */\n  uint32_t packets;\t/* Number of packets in a flow */\n  uint32_t octets;\t/* Number of octets in a flow */\n  uint32_t first;\t/* System uptime at start of a flow */\n  uint32_t last;\t/* System uptime at end of a flow */\n  uint16_t s_port;\t/* Source port */\n  uint16_t d_port;\t/* Destination port */\n  uint8_t pad1;\t\t/* Pad to word boundary */\n  uint8_t flags;\t/* Cumulative OR of tcp flags */\n  uint8_t prot;\t\t/* IP protocol */\n  uint8_t tos;\t\t/* IP type of service */\n  uint16_t src_as;\t/* Src peer/origin Autonomous System */\n  uint16_t dst_as;\t/* Dst peer/origin Autonomous System */\n  uint8_t src_mask;\t/* Source route's mask bits */\n  uint8_t dst_mask;\t/* Destination route's mask bits */\n  uint16_t pad2;\t/* Pad to word boundary */\n} __attribute__((__packed__));\n\n#define NETFLOW_V1_MAX_RECORDS 24\n#define NETFLOW_V5_MAX_RECORDS 30\n\n#define NETFLOW_V1_MAX_SIZE (sizeof(netflow_v1_header)+ \\\n\t\t\t     sizeof(netflow_v1_record)*NETFLOW_V1_MAX_RECORDS)\n#define NETFLOW_V5_MAX_SIZE (sizeof(netflow_v5_header)+ \\\n\t\t\t     sizeof(netflow_v5_record)*NETFLOW_V5_MAX_RECORDS)\n\nstruct netflow_v5_export_dgram {\n\tstruct netflow_v5_header\theader;\n\tstruct netflow_v5_record\tr[NETFLOW_V5_MAX_RECORDS];\n} __attribute__((__packed__));\n\n\n/* RFC3954 field definitions */\n#define NETFLOW_V9_FIELD_IN_BYTES\t\t1\t/* Input bytes count for a flow. Default 4, can be 8 */\n#define NETFLOW_V9_FIELD_IN_PKTS\t\t2\t/* Incoming counter with number of packets associated with an IP Flow. Default 4 */\n#define NETFLOW_V9_FIELD_FLOWS\t\t\t3\t/* Number of Flows that were aggregated. Default 4 */\n#define NETFLOW_V9_FIELD_PROTOCOL\t\t4\t/* IP protocol byte. 1 */\n#define NETFLOW_V9_FIELD_TOS\t\t\t5\t/* Type of service byte setting when entering the incoming interface. 1 */\n#define NETFLOW_V9_FIELD_TCP_FLAGS\t\t6\t/* TCP flags; cumulative of all the TCP flags seen in this Flow. 1 */\n#define NETFLOW_V9_FIELD_L4_SRC_PORT\t\t7\t/* TCP/UDP source port number. 2 */\n#define NETFLOW_V9_FIELD_IPV4_SRC_ADDR\t\t8\t/* IPv4 source address. 4 */\n#define NETFLOW_V9_FIELD_SRC_MASK\t\t9\t/* The number of contiguous bits in the source subnet mask (i.e., the mask in slash notation). 1 */\n#define NETFLOW_V9_FIELD_INPUT_SNMP\t\t10\t/* Input interface index. Default 2 */\n#define NETFLOW_V9_FIELD_L4_DST_PORT\t\t11\t/* TCP/UDP destination port number. 2 */\n#define NETFLOW_V9_FIELD_IPV4_DST_ADDR\t\t12\t/* IPv4 destination address. 4 */\n#define NETFLOW_V9_FIELD_DST_MASK\t\t13\t/* The number of contiguous bits in the destination subnet mask (i.e., the mask in slash notation). 1 */\n#define NETFLOW_V9_FIELD_OUTPUT_SNMP\t\t14\t/* Output interface index. Default 2 */\n#define NETFLOW_V9_FIELD_IPV4_NEXT_HOP\t\t15\t/* IPv4 address of the next-hop router. 4 */\n#define NETFLOW_V9_FIELD_SRC_AS\t\t\t16\t/* Source BGP autonomous system number. Default 2, can be 4 */\n#define NETFLOW_V9_FIELD_DST_AS\t\t\t17\t/* Destination BGP autonomous system number. Default 2, can be 4 */\n#define NETFLOW_V9_FIELD_BGP_IPV4_NEXT_HOP\t18\t/* Next-hop router's IP address in the BGP domain. 4 */\n#define NETFLOW_V9_FIELD_MUL_DST_PKTS\t\t19\t/* IP multicast outgoing packet counter for packets associated with IP flow. Default 4 */\n#define NETFLOW_V9_FIELD_MUL_DST_BYTES\t\t20\t/* IP multicast outgoing Octet (byte) counter for the number of bytes associated with IP flow. Default 4 */\n#define NETFLOW_V9_FIELD_LAST_SWITCHED\t\t21\t/* sysUptime in msec at which the last packet of this Flow was switched. 4 */\n#define NETFLOW_V9_FIELD_FIRST_SWITCHED\t\t22\t/* sysUptime in msec at which the first packet of this Flow was switched. 4 */\n#define NETFLOW_V9_FIELD_OUT_BYTES\t\t23\t/* Outgoing counter for the number of bytes associated with an IP Flow. Default 4 */\n#define NETFLOW_V9_FIELD_OUT_PKTS\t\t24\t/* Outgoing counter for the number of packets associated with an IP Flow. Default 4 */\n#define NETFLOW_V9_FIELD_IPV6_SRC_ADDR\t\t27\t/* IPv6 source address. 16 */\n#define NETFLOW_V9_FIELD_IPV6_DST_ADDR\t\t28\t/* IPv6 destination address. 16 */\n#define NETFLOW_V9_FIELD_IPV6_SRC_MASK\t\t29\t/* Length of the IPv6 source mask in contiguous bits. 1 */\n#define NETFLOW_V9_FIELD_IPV6_DST_MASK\t\t30\t/* Length of the IPv6 destination mask in contiguous bits. 1 */\n#define NETFLOW_V9_FIELD_IPV6_FLOW_LABEL\t31\t/* IPv6 flow label as per RFC 2460 definition. 3 */\n#define NETFLOW_V9_FIELD_ICMP_TYPE\t\t32\t/* Internet Control Message Protocol (ICMP) packet type; reported as ICMP Type * 256 + ICMP code. 2 */\n#define NETFLOW_V9_FIELD_MUL_IGMP_TYPE\t\t33\t/* Internet Group Management Protocol (IGMP) packet type. 1 */\n#define NETFLOW_V9_FIELD_SAMPLING_INTERVAL\t34\t/* When using sampled NetFlow, the rate at which packets are sampled; for example, a value of 100 indicates that one of every hundred packets is sampled. 4 */\n#define NETFLOW_V9_FIELD_SAMPLING_ALGORITHM\t35\t/* For sampled NetFlow platform-wide: 0x01 deterministic sampling 0x02 random sampling. 1 */\n#define NETFLOW_V9_FIELD_FLOW_ACTIVE_TIMEOUT\t36\t/* Timeout value (in seconds) for active flow entries in the NetFlow cache. 2 */\n#define NETFLOW_V9_FIELD_FLOW_INACTIVE_TIMEOUT\t37\t/* Timeout value (in seconds) for inactive Flow entries in the NetFlow cache. 2 */\n#define NETFLOW_V9_FIELD_ENGINE_TYPE\t\t38\t/* Type of Flow switching engine (route processor, linecard, etc...). 1 */\n#define NETFLOW_V9_FIELD_ENGINE_ID\t\t39\t/* ID number of the Flow switching engine. 1 */\n#define NETFLOW_V9_FIELD_TOTAL_BYTES_EXP\t40\t/* Counter with for the number of bytes exported by the Observation Domain. Default 4 */\n#define NETFLOW_V9_FIELD_TOTAL_PKTS_EXP\t\t41\t/* Counter with for the number of packets exported by the Observation Domain. Default 4 */\n#define NETFLOW_V9_FIELD_TOTAL_FLOWS_EXP\t42\t/* Counter with for the number of flows exported by the Observation Domain. Default 4 */\n#define NETFLOW_V9_FIELD_MPLS_TOP_LABEL_TYPE\t46\t/* MPLS Top Label Type. 1 */\n#define NETFLOW_V9_FIELD_MPLS_TOP_LABEL_IP_ADDR\t47\t/* Forwarding Equivalent Class corresponding to the MPLS Top Label. 4 */\n#define NETFLOW_V9_FIELD_FLOW_SAMPLER_ID\t48\t/* Identifier shown in \"show flow-sampler\". 1 */\n#define NETFLOW_V9_FIELD_FLOW_SAMPLER_MODE\t49\t/* The type of algorithm used for sampling data. 2 */\n#define NETFLOW_V9_FIELD_FLOW_SAMPLER_RANDOM_INTERVAL\t\t50\t/* Packet interval at which to sample. 4. */\n#define NETFLOW_V9_FIELD_DST_TOS\t\t55\t/* Type of Service byte setting when exiting outgoing interface. 1. */\n#define NETFLOW_V9_FIELD_SRC_MAC\t\t56\t/* Source MAC Address. 6 */\n#define NETFLOW_V9_FIELD_DST_MAC\t\t57\t/* Destination MAC Address. 6 */\n#define NETFLOW_V9_FIELD_SRC_VLAN\t\t58\t/* Virtual LAN identifier associated with ingress interface. 2 */\n#define NETFLOW_V9_FIELD_DST_VLAN\t\t59\t/* Virtual LAN identifier associated with egress interface. 2 */\n#define NETFLOW_V9_FIELD_IP_PROTOCOL_VERSION\t60\t/* Internet Protocol Version. Set to 4 for IPv4, set to 6 for IPv6. If not present in the template, then version 4 is assumed. 1. */\n#define NETFLOW_V9_FIELD_DIRECTION\t\t61\t/* Flow direction: 0 - ingress flow 1 - egress flow. 1 */\n#define NETFLOW_V9_FIELD_IPV6_NEXT_HOP\t\t62\t/* IPv6 address of the next-hop router. 16 */\n#define NETFLOW_V9_FIELD_BGP_IPV6_NEXT_HOP\t63\t/* Next-hop router in the BGP domain. 16 */\n#define NETFLOW_V9_FIELD_IPV6_OPTION_HEADERS\t64\t/* Bit-encoded field identifying IPv6 option headers found in the flow */\n#define NETFLOW_V9_FIELD_MPLS_LABEL_1\t\t70\t/* MPLS label at position 1 in the stack. 3 */\n#define NETFLOW_V9_FIELD_MPLS_LABEL_2\t\t71\t/* MPLS label at position 2 in the stack. 3 */\n#define NETFLOW_V9_FIELD_MPLS_LABEL_3\t\t72\t/* MPLS label at position 3 in the stack. 3 */\n#define NETFLOW_V9_FIELD_MPLS_LABEL_4\t\t73\t/* MPLS label at position 4 in the stack. 3 */\n#define NETFLOW_V9_FIELD_MPLS_LABEL_5\t\t74\t/* MPLS label at position 5 in the stack. 3 */\n#define NETFLOW_V9_FIELD_MPLS_LABEL_6\t\t75\t/* MPLS label at position 6 in the stack. 3 */\n#define NETFLOW_V9_FIELD_MPLS_LABEL_7\t\t76\t/* MPLS label at position 7 in the stack. 3 */\n#define NETFLOW_V9_FIELD_MPLS_LABEL_8\t\t77\t/* MPLS label at position 8 in the stack. 3 */\n#define NETFLOW_V9_FIELD_MPLS_LABEL_9\t\t78\t/* MPLS label at position 9 in the stack. 3 */\n#define NETFLOW_V9_FIELD_MPLS_LABEL_10\t\t79\t/* MPLS label at position 10 in the stack. 3 */\n\n#define NETFLOW_V9_MAX_RESERVED_FLOWSET\t\t0xFF\t/* Clause 5.2 */\n"
  },
  {
    "path": "freebsd-headers/netgraph/netflow/netflow_v9.h",
    "content": "/*-\n * Copyright (c) 2010 Alexander V. Chernikov <melifaro@ipfw.ru>\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t $FreeBSD: release/9.0.0/sys/netgraph/netflow/netflow_v9.h 219182 2011-03-02 16:15:11Z glebius $\n */\n\n#ifndef\t_NETFLOW_V9_H_\n#define\t_NETFLOW_V9_H_\n\n#ifdef COUNTERS_64\n#define CNTR\t\tuint64_t\n#define CNTR_MAX\tUINT64_MAX\n#else\n#define CNTR\t\tuint32_t\n#define CNTR_MAX\tUINT_MAX\n#endif\n\nstruct netflow_v9_template\n{\n\tint\tfield_id;\n\tint\tfield_length;\n};\n\n/* Template ID for tcp/udp v4 streams ID:257 (0x100 + NETFLOW_V9_FLOW_V4_L4) */\nstruct netflow_v9_record_ipv4_tcp\n{\n\tuint32_t\tsrc_addr;\t/* Source IPv4 address (IPV4_SRC_ADDR) */\n\tuint32_t\tdst_addr;\t/* Destination IPv4 address (IPV4_DST_ADDR) */\n\tuint32_t\tnext_hop;\t/* Next hop IPv4 address (IPV4_NEXT_HOP) */\n\tuint16_t\ti_ifx;\t/* Source interface index (INPUT_SNMP) */\n\tuint16_t\to_ifx;\t/* Destination interface index (OUTPUT_SNMP) */\n\tCNTR\t\ti_packets;\t/* Number of incoming packets in a flow (IN_PKTS) */\n\tCNTR\t\ti_octets;\t/* Number of incoming octets in a flow (IN_BYTES) */\n\tCNTR\t\to_packets;\t/* Number of outgoing packets in a flow (OUT_PKTS) */\n\tCNTR\t\to_octets;\t/* Number of outgoing octets in a flow (OUT_BYTES) */\n\tuint32_t\tfirst;\t/* System uptime at start of a flow (FIRST_SWITCHED) */\n\tuint32_t\tlast;\t/* System uptime at end of a flow (LAST_SWITCHED) */\n\tuint16_t\ts_port;\t/* Source port (L4_SRC_PORT) */\n\tuint16_t\td_port;\t/* Destination port (L4_DST_PORT) */\n\tuint8_t\t\tflags;\t/* Cumulative OR of tcp flags (TCP_FLAGS) */\n\tuint8_t\t\tprot;\t\t/* IP protocol */\n\tuint8_t\t\ttos;\t\t/* IP type of service IN (or OUT) (TOS) */\n\tuint32_t\tsrc_as;\t/* Src peer/origin Autonomous System (SRC_AS) */\n\tuint32_t\tdst_as;\t/* Dst peer/origin Autonomous System (DST_AS) */\n\tuint8_t\t\tsrc_mask;\t/* Source route's mask bits (SRC_MASK) */\n\tuint8_t\t\tdst_mask; \t/* Destination route's mask bits (DST_MASK) */\n} __attribute__((__packed__));\n\n/* Template ID for tcp/udp v6 streams ID: 260 (0x100 + NETFLOW_V9_FLOW_V6_L4) */\nstruct netflow_v9_record_ipv6_tcp\n{\n\tstruct in6_addr\tsrc_addr;\t/* Source IPv6 address (IPV6_SRC_ADDR) */\n\tstruct in6_addr\tdst_addr;\t/* Destination IPv6 address (IPV6_DST_ADDR) */\n\tstruct in6_addr\tnext_hop;\t/* Next hop IPv6 address (IPV6_NEXT_HOP) */\n\tuint16_t\ti_ifx;\t/* Source interface index (INPUT_SNMP) */\n\tuint16_t\to_ifx;\t/* Destination interface index (OUTPUT_SNMP) */\n\tCNTR\t\ti_packets;\t/* Number of incoming packets in a flow (IN_PKTS) */\n\tCNTR\t\ti_octets;\t/* Number of incoming octets in a flow (IN_BYTES) */\n\tCNTR\t\to_packets;\t/* Number of outgoing packets in a flow (OUT_PKTS) */\n\tCNTR\t\to_octets;\t/* Number of outgoing octets in a flow (OUT_BYTES) */\n\tuint32_t\tfirst;\t/* System uptime at start of a flow (FIRST_SWITCHED) */\n\tuint32_t\tlast;\t/* System uptime at end of a flow (LAST_SWITCHED) */\n\tuint16_t\ts_port;\t/* Source port (L4_SRC_PORT) */\n\tuint16_t\td_port;\t/* Destination port (L4_DST_PORT) */\n\tuint8_t\t\tflags;\t/* Cumulative OR of tcp flags (TCP_FLAGS) */\n\tuint8_t\t\tprot;\t\t/* IP protocol */\n\tuint8_t\t\ttos;\t\t/* IP type of service IN (or OUT) (TOS) */\n\tuint32_t\tsrc_as;\t/* Src peer/origin Autonomous System (SRC_AS) */\n\tuint32_t\tdst_as;\t/* Dst peer/origin Autonomous System (DST_AS) */\n\tuint8_t\t\tsrc_mask;\t/* Source route's mask bits (SRC_MASK) */\n\tuint8_t\t\tdst_mask; \t/* Destination route's mask bits (DST_MASK) */\n} __attribute__((__packed__));\n\n/* Used in export9_add to determine max record size */\nstruct netflow_v9_record_general\n{\n\tunion {\n\t\tstruct netflow_v9_record_ipv4_tcp v4_tcp;\n\t\tstruct netflow_v9_record_ipv6_tcp v6_tcp;\n\t} rec;\n};\n\n#define BASE_MTU\t1500\n#define MIN_MTU\t\tsizeof(struct netflow_v5_header)\n#define MAX_MTU\t\t16384\n#define NETFLOW_V9_MAX_SIZE\t_NETFLOW_V9_MAX_SIZE(BASE_MTU)\n/* Decrease MSS by 16 since there can be some IPv[46] header options */\n#define _NETFLOW_V9_MAX_SIZE(x)\t(x) - sizeof(struct ip6_hdr) - sizeof(struct udphdr) - 16\n\n/* #define NETFLOW_V9_MAX_FLOWSETS\t2 */\n\n#define NETFLOW_V9_MAX_RECORD_SIZE\tsizeof(struct netflow_v9_record_ipv6_tcp)\n#define NETFLOW_V9_MAX_PACKETS_TEMPL\t500\t/* Send data templates every ... packets */\n#define NETFLOW_V9_MAX_TIME_TEMPL\t600\t/* Send data templates every ... seconds */\n#define NETFLOW_V9_MAX_TEMPLATES\t16\t/* Not a real value */\n#define _NETFLOW_V9_TEMPLATE_SIZE(x)\t(sizeof(x) / sizeof(struct netflow_v9_template)) * 4\n//#define _NETFLOW_V9_TEMPLATE_SIZE(x)\t((x) + 1) * 4\n\n/* Flow Templates */\n#define NETFLOW_V9_FLOW_V4_L4\t1 /* IPv4 TCP/UDP packet */\n#define NETFLOW_V9_FLOW_V4_ICMP\t2 /* IPv4 ICMP packet, currently unused */\n#define NETFLOW_V9_FLOW_V4_L3\t3 /* IPv4 IP packet */\n#define NETFLOW_V9_FLOW_V6_L4\t4 /* IPv6 TCP/UDP packet */\n#define NETFLOW_V9_FLOW_V6_ICMP\t5 /* IPv6 ICMP packet, currently unused */\n#define NETFLOW_V9_FLOW_V6_L3\t6 /* IPv6 IP packet */\n\n#define NETFLOW_V9_FLOW_FAKE\t65535 /* Not uset used in real flowsets! */\n\nstruct netflow_v9_export_dgram {\n\tstruct netflow_v9_header\theader;\n\tchar\t\t\t\t*data; /* MTU can change, record length is dynamic */\n};\n\nstruct netflow_v9_flowset_header {\n\tuint16_t\tid; /* FlowSet id */\n\tuint16_t\tlength; /* FlowSet length */\n} __attribute__((__packed__));\n\nstruct netflow_v9_packet_opt {\n\tuint16_t\tlength; /* current packet length */\n\tuint16_t\tcount; /* current records count */\n\tuint16_t\tmtu; /* max MTU shapshot */\n\tuint16_t\tflow_type; /* current flowset */\n\tuint16_t\tflow_header; /* offset pointing to current flow header */\n};\n#endif\n"
  },
  {
    "path": "freebsd-headers/netgraph/netflow/ng_netflow.h",
    "content": "/*-\n * Copyright (c) 2010-2011 Alexander V. Chernikov <melifaro@ipfw.ru>\n * Copyright (c) 2004-2005 Gleb Smirnoff <glebius@FreeBSD.org>\n * Copyright (c) 2001-2003 Roman V. Palagin <romanp@unshadow.net>\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t $SourceForge: ng_netflow.h,v 1.26 2004/09/04 15:44:55 glebius Exp $\n *\t $FreeBSD: release/9.0.0/sys/netgraph/netflow/ng_netflow.h 223787 2011-07-05 14:48:39Z glebius $\n */\n\n#ifndef\t_NG_NETFLOW_H_\n#define\t_NG_NETFLOW_H_\n\n#define NG_NETFLOW_NODE_TYPE\t\"netflow\"\n#define NGM_NETFLOW_COOKIE\t1309868867\n\n#define\tNG_NETFLOW_MAXIFACES\tUSHRT_MAX\n\n/* Hook names */\n\n#define\tNG_NETFLOW_HOOK_DATA\t\"iface\"\n#define\tNG_NETFLOW_HOOK_OUT\t\"out\"\n#define NG_NETFLOW_HOOK_EXPORT\t\"export\"\n#define NG_NETFLOW_HOOK_EXPORT9\t\"export9\"\n\n/* This define effectively disable (v5) netflow export hook! */\n/* #define COUNTERS_64 */\n\n/* Netgraph commands understood by netflow node */\nenum {\n    NGM_NETFLOW_INFO = 1|NGM_READONLY|NGM_HASREPLY,\t/* get node info */\n    NGM_NETFLOW_IFINFO = 2|NGM_READONLY|NGM_HASREPLY,\t/* get iface info */\n    NGM_NETFLOW_SHOW = 3|NGM_READONLY|NGM_HASREPLY,\t/* show ip cache flow */\n    NGM_NETFLOW_SETDLT\t\t= 4,\t/* set data-link type */\t\n    NGM_NETFLOW_SETIFINDEX\t= 5, \t/* set interface index */\n    NGM_NETFLOW_SETTIMEOUTS\t= 6, \t/* set active/inactive flow timeouts */\n    NGM_NETFLOW_SETCONFIG\t= 7, \t/* set flow generation options */\n    NGM_NETFLOW_SETTEMPLATE\t= 8, \t/* set v9 flow template periodic */\n    NGM_NETFLOW_SETMTU\t\t= 9, \t/* set outgoing interface MTU */\n};\n\n/* This structure is returned by the NGM_NETFLOW_INFO message */\nstruct ng_netflow_info {\n\tuint64_t\tnfinfo_bytes;\t\t/* accounted IPv4 bytes */\n\tuint32_t\tnfinfo_packets;\t\t/* accounted IPv4 packets */\n\tuint64_t\tnfinfo_bytes6;\t\t/* accounted IPv6 bytes */\n\tuint32_t\tnfinfo_packets6;\t/* accounted IPv6 packets */\n\tuint64_t\tnfinfo_sbytes;\t\t/* skipped IPv4 bytes */\n\tuint32_t\tnfinfo_spackets;\t/* skipped IPv4 packets */\n\tuint64_t\tnfinfo_sbytes6;\t\t/* skipped IPv6 bytes */\n\tuint32_t\tnfinfo_spackets6;\t/* skipped IPv6 packets */\n\tuint32_t\tnfinfo_used;\t\t/* used cache records */\n\tuint32_t\tnfinfo_used6;\t\t/* used IPv6 cache records */\n\tuint32_t\tnfinfo_alloc_failed;\t/* failed allocations */\n\tuint32_t\tnfinfo_export_failed;\t/* failed exports */\n\tuint32_t\tnfinfo_export9_failed;\t/* failed exports */\n\tuint32_t\tnfinfo_realloc_mbuf;\t/* reallocated mbufs */\n\tuint32_t\tnfinfo_alloc_fibs;\t/* fibs allocated */\n\tuint32_t\tnfinfo_act_exp;\t\t/* active expiries */\n\tuint32_t\tnfinfo_inact_exp;\t/* inactive expiries */\n\tuint32_t\tnfinfo_inact_t;\t\t/* flow inactive timeout */\n\tuint32_t\tnfinfo_act_t;\t\t/* flow active timeout */\n};\n\n/* This structure is returned by the NGM_NETFLOW_IFINFO message */\nstruct ng_netflow_ifinfo {\n\tuint32_t\tifinfo_packets;\t/* number of packets for this iface */\n\tuint8_t\t\tifinfo_dlt;\t/* Data Link Type, DLT_XXX */\n#define\tMAXDLTNAMELEN\t20\n\tu_int16_t\tifinfo_index;\t/* connected iface index */\n\tuint32_t\tconf;\n};\n\n\n/* This structure is passed to NGM_NETFLOW_SETDLT message */\nstruct ng_netflow_setdlt {\n\tuint16_t iface;\t\t/* which iface dlt change */\n\tuint8_t  dlt;\t\t\t/* DLT_XXX from bpf.h */\n};\n\n/* This structure is passed to NGM_NETFLOW_SETIFINDEX */\nstruct ng_netflow_setifindex {\n\tu_int16_t iface;\t\t/* which iface index change */\n\tu_int16_t index;\t\t/* new index */\n};\n\n/* This structure is passed to NGM_NETFLOW_SETTIMEOUTS */\nstruct ng_netflow_settimeouts {\n\tuint32_t\tinactive_timeout;\t/* flow inactive timeout */\n\tuint32_t\tactive_timeout;\t\t/* flow active timeout */\n};\n\n#define NG_NETFLOW_CONF_INGRESS\t\t1\n#define NG_NETFLOW_CONF_EGRESS\t\t2\n#define NG_NETFLOW_CONF_ONCE\t\t4\n#define NG_NETFLOW_CONF_THISONCE\t8\n\n/* This structure is passed to NGM_NETFLOW_SETCONFIG */\nstruct ng_netflow_setconfig {\n\tu_int16_t iface;\t\t/* which iface config change */\n\tu_int32_t conf;\t\t\t/* new config */\n};\n\n/* This structure is passed to NGM_NETFLOW_SETTEMPLATE */\nstruct ng_netflow_settemplate {\n\tuint16_t time;\t\t/* max time between announce */\n\tuint16_t packets;\t/* max packets between announce */\n};\n\n/* This structure is passed to NGM_NETFLOW_SETMTU */\nstruct ng_netflow_setmtu {\n\tuint16_t mtu;\t\t/* MTU for packet */\n};\n\n/* This structure is used in NGM_NETFLOW_SHOW request/responce */\nstruct ngnf_show_header {\n\tu_char\t\tversion;\t/* IPv4 or IPv6 */\n\tuint32_t\thash_id;\t/* current hash index */\n\tuint32_t\tlist_id;\t/* current record number in given hash */\n\tuint32_t\tnentries;\t/* number of records in response */\n};\n\n/* XXXGL\n * Somewhere flow_rec6 is casted to flow_rec, and flow6_entry_data is\n * casted to flow_entry_data. After casting, fle->r.fib is accessed.\n * So beginning of these structs up to fib should be kept common.\n */\n\n/* This is unique data, which identifies flow */\nstruct flow_rec {\n\tuint16_t\tflow_type; /* IPv4 L4/L3 flow, see NETFLOW_V9_FLOW* */\n\tuint16_t\tfib;\n\tstruct in_addr\tr_src;\n\tstruct in_addr\tr_dst;\n\tunion {\n\t\tstruct {\n\t\t\tuint16_t\ts_port;\t/* source TCP/UDP port */\n\t\t\tuint16_t\td_port; /* destination TCP/UDP port */\n\t\t} dir;\n\t\tuint32_t both;\n\t} ports;\n\tunion {\n\t\tstruct {\n\t\t\tu_char\t\tprot;\t/* IP protocol */\n\t\t\tu_char\t\ttos;\t/* IP TOS */\n\t\t\tuint16_t\ti_ifx;\t/* input interface index */\n\t\t} i;\n\t\tuint32_t all;\n\t} misc;\n};\n\n/* This is unique data, which identifies flow */\nstruct flow6_rec {\n\tuint16_t\tflow_type; /* IPv4 L4/L3 Ipv6 L4/L3 flow, see NETFLOW_V9_FLOW* */\n\tuint16_t\tfib;\n\tunion {\n\t\tstruct in_addr\tr_src;\n\t\tstruct in6_addr\tr_src6;\n\t} src;\n\tunion {\n\t\tstruct in_addr\tr_dst;\n\t\tstruct in6_addr\tr_dst6;\n\t} dst;\n\tunion {\n\t\tstruct {\n\t\t\tuint16_t\ts_port;\t/* source TCP/UDP port */\n\t\t\tuint16_t\td_port; /* destination TCP/UDP port */\n\t\t} dir;\n\t\tuint32_t both;\n\t} ports;\n\tunion {\n\t\tstruct {\n\t\t\tu_char\t\tprot;\t/* IP protocol */\n\t\t\tu_char\t\ttos;\t/* IP TOS */\n\t\t\tuint16_t\ti_ifx;\t/* input interface index */\n\t\t} i;\n\t\tuint32_t all;\n\t} misc;\n};\n\n#define\tr_ip_p\tmisc.i.prot\n#define\tr_tos\tmisc.i.tos\n#define\tr_i_ifx\tmisc.i.i_ifx\n#define r_misc\tmisc.all\n#define r_ports\tports.both\n#define r_sport\tports.dir.s_port\n#define r_dport\tports.dir.d_port\n\t\n/* A flow entry which accumulates statistics */\nstruct flow_entry_data {\n\tuint16_t\t\tversion;\t/* Protocol version */\n\tstruct flow_rec\t\tr;\n\tstruct in_addr\t\tnext_hop;\n\tuint16_t\t\tfle_o_ifx;\t/* output interface index */\n#define\t\t\t\tfle_i_ifx\tr.misc.i.i_ifx\n\tuint8_t\t\tdst_mask;\t/* destination route mask bits */\n\tuint8_t\t\tsrc_mask;\t/* source route mask bits */\n\tu_long\t\t\tpackets;\n\tu_long\t\t\tbytes;\n\tlong\t\t\tfirst;\t/* uptime on first packet */\n\tlong\t\t\tlast;\t/* uptime on last packet */\n\tu_char\t\t\ttcp_flags;\t/* cumulative OR */\n};\n\nstruct flow6_entry_data {\n\tuint16_t\t\tversion;\t/* Protocol version */\n\tstruct flow6_rec\tr;\n\tunion {\n\t\tstruct in_addr\t\tnext_hop;\n\t\tstruct in6_addr\t\tnext_hop6;\n\t} n;\n\tuint16_t\t\tfle_o_ifx;\t/* output interface index */\n#define\t\t\t\tfle_i_ifx\tr.misc.i.i_ifx\n\tuint8_t\t\tdst_mask;\t/* destination route mask bits */\n\tuint8_t\t\tsrc_mask;\t/* source route mask bits */\n\tu_long\t\t\tpackets;\n\tu_long\t\t\tbytes;\n\tlong\t\t\tfirst;\t/* uptime on first packet */\n\tlong\t\t\tlast;\t/* uptime on last packet */\n\tu_char\t\t\ttcp_flags;\t/* cumulative OR */\n};\n\n/*\n * How many flow records we will transfer at once\n * without overflowing socket receive buffer\n */\n#define NREC_AT_ONCE\t\t1000\n#define NREC6_AT_ONCE\t\t(NREC_AT_ONCE * sizeof(struct flow_entry_data) / \\\n\t\t\t\tsizeof(struct flow6_entry_data))\n#define NGRESP_SIZE\t\t(sizeof(struct ngnf_show_header) + (NREC_AT_ONCE * \\\n\t\t\t\tsizeof(struct flow_entry_data)))\n#define SORCVBUF_SIZE\t\t(NGRESP_SIZE + 2 * sizeof(struct ng_mesg))\n\n/* Everything below is for kernel */\n\n#ifdef _KERNEL\n\nstruct flow_entry {\n\tTAILQ_ENTRY(flow_entry)\tfle_hash;\t/* entries in hash slot */\n\tstruct flow_entry_data\tf;\n};\n\nstruct flow6_entry {\n\tTAILQ_ENTRY(flow_entry)\tfle_hash;\t/* entries in hash slot */\n\tstruct flow6_entry_data\tf;\n};\n/* Parsing declarations */\n\n/* Parse the info structure */\n#define\tNG_NETFLOW_INFO_TYPE\t{\t\t\t\\\n\t{ \"IPv4 bytes\",\t\t&ng_parse_uint64_type },\t\\\n\t{ \"IPv4 packets\",\t&ng_parse_uint32_type },\t\\\n\t{ \"IPv6 bytes\",\t\t&ng_parse_uint64_type },\t\\\n\t{ \"IPv6 packets\",\t&ng_parse_uint32_type },\t\\\n\t{ \"IPv4 skipped bytes\",\t\t&ng_parse_uint64_type },\t\\\n\t{ \"IPv4 skipped packets\",\t&ng_parse_uint32_type },\t\\\n\t{ \"IPv6 skipped bytes\",\t\t&ng_parse_uint64_type },\t\\\n\t{ \"IPv6 skipped packets\",\t&ng_parse_uint32_type },\t\\\n\t{ \"IPv4 records used\",\t&ng_parse_uint32_type },\\\n\t{ \"IPv6 records used\",\t&ng_parse_uint32_type },\\\n\t{ \"Failed allocations\",\t&ng_parse_uint32_type },\\\n\t{ \"V5 failed exports\",\t&ng_parse_uint32_type },\\\n\t{ \"V9 failed exports\",\t&ng_parse_uint32_type },\\\n\t{ \"mbuf reallocations\",\t&ng_parse_uint32_type },\\\n\t{ \"fibs allocated\",\t&ng_parse_uint32_type },\\\n\t{ \"Active expiries\",\t&ng_parse_uint32_type },\\\n\t{ \"Inactive expiries\",\t&ng_parse_uint32_type },\\\n\t{ \"Inactive timeout\",\t&ng_parse_uint32_type },\\\n\t{ \"Active timeout\",\t&ng_parse_uint32_type },\\\n\t{ NULL }\t\t\t\t\t\\\n}\n\n/* Parse the ifinfo structure */\n#define NG_NETFLOW_IFINFO_TYPE\t{\t\t\t\\\n\t{ \"packets\",\t&ng_parse_uint32_type },\t\\\n\t{ \"data link type\", &ng_parse_uint8_type },\t\\\n\t{ \"index\", &ng_parse_uint16_type },\t\t\\\n\t{ \"conf\", &ng_parse_uint32_type },\t\t\\\n\t{ NULL }\t\t\t\t\t\\\n}\n\n/* Parse the setdlt structure */\n#define\tNG_NETFLOW_SETDLT_TYPE {\t\t\t\\\n\t{ \"iface\",\t&ng_parse_uint16_type },\t\\\n\t{ \"dlt\",\t&ng_parse_uint8_type  },\t\\\n\t{ NULL }\t\t\t\t\t\\\n}\n\n/* Parse the setifindex structure */\n#define\tNG_NETFLOW_SETIFINDEX_TYPE {\t\t\t\\\n\t{ \"iface\",\t&ng_parse_uint16_type },\t\\\n\t{ \"index\",\t&ng_parse_uint16_type },\t\\\n\t{ NULL }\t\t\t\t\t\\\n}\n\n/* Parse the settimeouts structure */\n#define NG_NETFLOW_SETTIMEOUTS_TYPE {\t\t\t\\\n\t{ \"inactive\",\t&ng_parse_uint32_type },\t\\\n\t{ \"active\",\t&ng_parse_uint32_type },\t\\\n\t{ NULL }\t\t\t\t\t\\\n}\n\n/* Parse the setifindex structure */\n#define\tNG_NETFLOW_SETCONFIG_TYPE {\t\t\t\\\n\t{ \"iface\",\t&ng_parse_uint16_type },\t\\\n\t{ \"conf\",\t&ng_parse_uint32_type },\t\\\n\t{ NULL }\t\t\t\t\t\\\n}\n\n/* Parse the settemplate structure */\n#define\tNG_NETFLOW_SETTEMPLATE_TYPE {\t\t\\\n\t{ \"time\",\t&ng_parse_uint16_type },\t\\\n\t{ \"packets\",\t&ng_parse_uint16_type },\t\\\n\t{ NULL }\t\t\t\t\t\\\n}\n\n/* Parse the setmtu structure */\n#define\tNG_NETFLOW_SETMTU_TYPE {\t\t\t\\\n\t{ \"mtu\",\t&ng_parse_uint16_type },\t\\\n\t{ NULL }\t\t\t\t\t\\\n}\n\n/* Private hook data */\nstruct ng_netflow_iface {\n\thook_p\t\thook;\t\t/* NULL when disconnected */\n\thook_p\t\tout;\t\t/* NULL when no bypass hook */\n\tstruct ng_netflow_ifinfo\tinfo;\n};\n\ntypedef struct ng_netflow_iface *iface_p;\ntypedef struct ng_netflow_ifinfo *ifinfo_p;\n\nstruct netflow_export_item {\n\titem_p\t\titem;\n\titem_p\t\titem9;\n\tstruct netflow_v9_packet_opt\t*item9_opt;\n};\n\n/* Structure contatining fib-specific data */\nstruct fib_export {\n\tuint32_t\t\t\tfib;\t\t/* kernel fib id */\n\tstruct netflow_export_item\texp;\t\t/* Various data used for export */\n\tstruct mtx\t\t\texport_mtx;\t/* exp.item mutex */\n\tstruct mtx\t\t\texport9_mtx;\t/* exp.item9 mutex */\n\tuint32_t\t\t\tflow_seq;\t/* current V5 flow sequence */\n\tuint32_t\t\t\tflow9_seq;\t/* current V9 flow sequence */\n\tuint32_t\t\t\tdomain_id;\t/* Observartion domain id */\n\t/* Netflow V9 counters */\n\tuint32_t\t\t\ttempl_last_ts;\t/* unixtime of last template announce */\n\tuint32_t\t\t\ttempl_last_pkt;\t/* packets count on last template announce */\n\tuint32_t\t\t\tsent_packets;\t/* packets sent by exporter; */\n\tstruct netflow_v9_packet_opt\t*export9_opt;\t/* current packet specific options */\n};\n\ntypedef struct fib_export *fib_export_p;\n\n/* Structure describing our flow engine */\nstruct netflow {\n\tnode_p\t\t\tnode;\t\t/* link to the node itself */\n\thook_p\t\t\texport;\t\t/* export data goes there */\n\thook_p\t\t\texport9;\t/* Netflow V9 export data goes there */\n\n\tstruct ng_netflow_info\tinfo;\n\tstruct callout\t\texp_callout;\t/* expiry periodic job */\n\n\t/*\n\t * Flow entries are allocated in uma(9) zone zone. They are\n\t * indexed by hash hash. Each hash element consist of tailqueue\n\t * head and mutex to protect this element.\n\t */\n#define\tCACHESIZE\t\t\t(65536*4)\n#define\tCACHELOWAT\t\t\t(CACHESIZE * 3/4)\n#define\tCACHEHIGHWAT\t\t\t(CACHESIZE * 9/10)\n\tuma_zone_t\t\tzone;\n\tstruct flow_hash_entry\t*hash;\n\n\t/*\n\t * NetFlow data export\n\t *\n\t * export_item is a data item, it has an mbuf with cluster\n\t * attached to it. A thread detaches export_item from priv\n\t * and works with it. If the export is full it is sent, and\n\t * a new one is allocated. Before exiting thread re-attaches\n\t * its current item back to priv. If there is item already,\n\t * current incomplete datagram is sent.\n\t * export_mtx is used for attaching/detaching.\n\t */\n\n\t/* IPv6 support */\n#ifdef INET6\n\tuma_zone_t\t\tzone6;\n\tstruct flow_hash_entry\t*hash6;\n#endif\n\t/* Multiple FIB support */\n\tfib_export_p\t\tfib_data[RT_NUMFIBS]; /* array of pointers to fib-specific data */\n\n\t/*\n\t * RFC 3954 clause 7.3\n\t * \"Both options MUST be configurable by the user on the Exporter.\"\n\t */\n\tuint16_t\t\ttempl_time;\t/* time between sending templates */\n\tuint16_t\t\ttempl_packets;\t/* packets between sending templates */\n#define NETFLOW_V9_MAX_FLOWSETS\t2\n\tu_char\t\t\tflowsets_count; /* current flowsets used */\n\tu_char\t\t\tflowset_records[NETFLOW_V9_MAX_FLOWSETS - 1]; /* Count of records in each flowset */\n\tuint16_t\t\tmtu;\t\t/* export interface MTU */\n\tstruct netflow_v9_flowset_header\t*v9_flowsets[NETFLOW_V9_MAX_FLOWSETS - 1]; /* Pointers to pre-compiled flowsets */\n\n\tstruct ng_netflow_iface\tifaces[NG_NETFLOW_MAXIFACES];\n};\n\ntypedef struct netflow *priv_p;\n\n/* Header of a small list in hash cell */\nstruct flow_hash_entry {\n\tstruct mtx\t\tmtx;\n\tTAILQ_HEAD(fhead, flow_entry) head;\n};\n\n#define\tERROUT(x)\t{ error = (x); goto done; }\n\n#define MTAG_NETFLOW\t\t1221656444\n#define MTAG_NETFLOW_CALLED\t0\n\n#define m_pktlen(m)\t((m)->m_pkthdr.len)\n#define IP6VERSION\t6\n\n#define priv_to_fib(priv, fib)\t(priv)->fib_data[(fib)]\n\n/*\n * Cisco uses milliseconds for uptime. Bad idea, since it overflows\n * every 48+ days. But we will do same to keep compatibility. This macro\n * does overflowable multiplication to 1000.\n */\n#define\tMILLIUPTIME(t)\t(((t) << 9) +\t/* 512 */\t\\\n\t\t\t ((t) << 8) +\t/* 256 */\t\\\n\t\t\t ((t) << 7) +\t/* 128 */\t\\\n\t\t\t ((t) << 6) +\t/* 64  */\t\\\n\t\t\t ((t) << 5) +\t/* 32  */\t\\\n\t\t\t ((t) << 3))\t/* 8   */\n\n/* Prototypes for netflow.c */\nvoid\tng_netflow_cache_init(priv_p);\nvoid\tng_netflow_cache_flush(priv_p);\nint\tng_netflow_fib_init(priv_p priv, int fib);\nvoid\tng_netflow_copyinfo(priv_p, struct ng_netflow_info *);\ntimeout_t ng_netflow_expire;\nint \tng_netflow_flow_add(priv_p, fib_export_p, struct ip *, caddr_t, uint8_t, uint8_t, unsigned int);\nint\tng_netflow_flow6_add(priv_p, fib_export_p, struct ip6_hdr *, caddr_t , uint8_t, uint8_t, unsigned int);\nint\tng_netflow_flow_show(priv_p, struct ngnf_show_header *req, struct ngnf_show_header *resp);\n\nvoid\tng_netflow_v9_cache_init(priv_p);\nvoid\tng_netflow_v9_cache_flush(priv_p);\nitem_p\tget_export9_dgram(priv_p, fib_export_p, struct netflow_v9_packet_opt **);\nvoid\treturn_export9_dgram(priv_p, fib_export_p, item_p,\n\t    struct netflow_v9_packet_opt *, int);\nint\texport9_add(item_p, struct netflow_v9_packet_opt *, struct flow_entry *);\nint\texport9_send(priv_p, fib_export_p, item_p, struct netflow_v9_packet_opt *,\n\t    int);\n\n#endif\t/* _KERNEL */\n#endif\t/* _NG_NETFLOW_H_ */\n"
  },
  {
    "path": "freebsd-headers/netgraph/netgraph.h",
    "content": "/*\n * netgraph.h\n */\n\n/*-\n * Copyright (c) 1996-1999 Whistle Communications, Inc.\n * All rights reserved.\n * \n * Subject to the following obligations and disclaimer of warranty, use and\n * redistribution of this software, in source or object code forms, with or\n * without modifications are expressly permitted by Whistle Communications;\n * provided, however, that:\n * 1. Any and all reproductions of the source or object code must include the\n *    copyright notice above and the following disclaimer of warranties; and\n * 2. No rights are granted, in any manner or form, to use Whistle\n *    Communications, Inc. trademarks, including the mark \"WHISTLE\n *    COMMUNICATIONS\" on advertising, endorsements, or otherwise except as\n *    such appears in the above copyright notice or in the software.\n * \n * THIS SOFTWARE IS BEING PROVIDED BY WHISTLE COMMUNICATIONS \"AS IS\", AND\n * TO THE MAXIMUM EXTENT PERMITTED BY LAW, WHISTLE COMMUNICATIONS MAKES NO\n * REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, REGARDING THIS SOFTWARE,\n * INCLUDING WITHOUT LIMITATION, ANY AND ALL IMPLIED WARRANTIES OF\n * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT.\n * WHISTLE COMMUNICATIONS DOES NOT WARRANT, GUARANTEE, OR MAKE ANY\n * REPRESENTATIONS REGARDING THE USE OF, OR THE RESULTS OF THE USE OF THIS\n * SOFTWARE IN TERMS OF ITS CORRECTNESS, ACCURACY, RELIABILITY OR OTHERWISE.\n * IN NO EVENT SHALL WHISTLE COMMUNICATIONS BE LIABLE FOR ANY DAMAGES\n * RESULTING FROM OR ARISING OUT OF ANY USE OF THIS SOFTWARE, INCLUDING\n * WITHOUT LIMITATION, ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,\n * PUNITIVE, OR CONSEQUENTIAL DAMAGES, PROCUREMENT OF SUBSTITUTE GOODS OR\n * SERVICES, LOSS OF USE, DATA OR PROFITS, HOWEVER CAUSED AND UNDER ANY\n * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF\n * THIS SOFTWARE, EVEN IF WHISTLE COMMUNICATIONS IS ADVISED OF THE POSSIBILITY\n * OF SUCH DAMAGE.\n *\n * Author: Julian Elischer <julian@freebsd.org>\n *\n * $FreeBSD: release/9.0.0/sys/netgraph/netgraph.h 223768 2011-07-04 20:50:09Z glebius $\n * $Whistle: netgraph.h,v 1.29 1999/11/01 07:56:13 julian Exp $\n */\n\n#ifndef _NETGRAPH_NETGRAPH_H_\n#define _NETGRAPH_NETGRAPH_H_\n\n#ifndef _KERNEL\n#error \"This file should not be included in user level programs\"\n#endif\n\n#include <sys/queue.h>\n#include <sys/lock.h>\n#include <sys/malloc.h>\n#include <sys/module.h>\n#include <sys/mutex.h>\n#include <sys/refcount.h>\n\n#ifdef HAVE_KERNEL_OPTION_HEADERS\n#include \"opt_netgraph.h\"\n#endif\n\n/* debugging options */\n#define NG_SEPARATE_MALLOC\t/* make modules use their own malloc types */\n\n/*\n * This defines the in-kernel binary interface version.\n * It is possible to change this but leave the external message\n * API the same. Each type also has it's own cookies for versioning as well.\n * Change it for NETGRAPH_DEBUG version so we cannot mix debug and non debug\n * modules.\n */\n#define _NG_ABI_VERSION 12\n#ifdef\tNETGRAPH_DEBUG /*----------------------------------------------*/\n#define NG_ABI_VERSION\t(_NG_ABI_VERSION + 0x10000)\n#else\t/* NETGRAPH_DEBUG */ /*----------------------------------------------*/\n#define NG_ABI_VERSION\t_NG_ABI_VERSION\n#endif\t/* NETGRAPH_DEBUG */ /*----------------------------------------------*/\n\n\n/*\n * Forward references for the basic structures so we can\n * define the typedefs and use them in the structures themselves.\n */\nstruct ng_hook ;\nstruct ng_node ;\nstruct ng_item ;\ntypedef\tstruct ng_item *item_p;\ntypedef struct ng_node *node_p;\ntypedef struct ng_hook *hook_p;\n\n/* node method definitions */\ntypedef\tint\tng_constructor_t(node_p node);\ntypedef\tint\tng_close_t(node_p node);\ntypedef\tint\tng_shutdown_t(node_p node);\ntypedef\tint\tng_newhook_t(node_p node, hook_p hook, const char *name);\ntypedef\thook_p\tng_findhook_t(node_p node, const char *name);\ntypedef\tint\tng_connect_t(hook_p hook);\ntypedef\tint\tng_rcvmsg_t(node_p node, item_p item, hook_p lasthook);\ntypedef\tint\tng_rcvdata_t(hook_p hook, item_p item);\ntypedef\tint\tng_disconnect_t(hook_p hook);\ntypedef\tint\tng_rcvitem (node_p node, hook_p hook, item_p item);\n\n/***********************************************************************\n ***************** Hook Structure and Methods **************************\n ***********************************************************************\n *\n * Structure of a hook\n */\nstruct ng_hook {\n\tchar\thk_name[NG_HOOKSIZ];\t/* what this node knows this link as */\n\tvoid   *hk_private;\t\t/* node dependant ID for this hook */\n\tint\thk_flags;\t\t/* info about this hook/link */\n\tint\thk_type;\t\t/* tbd: hook data link type */\n\tstruct\tng_hook *hk_peer;\t/* the other end of this link */\n\tstruct\tng_node *hk_node;\t/* The node this hook is attached to */\n\tLIST_ENTRY(ng_hook) hk_hooks;\t/* linked list of all hooks on node */\n\tng_rcvmsg_t\t*hk_rcvmsg;\t/* control messages come here */\n\tng_rcvdata_t\t*hk_rcvdata;\t/* data comes here */\n\tint\thk_refs;\t\t/* dont actually free this till 0 */\n#ifdef\tNETGRAPH_DEBUG /*----------------------------------------------*/\n#define HK_MAGIC 0x78573011\n\tint\thk_magic;\n\tchar\t*lastfile;\n\tint\tlastline;\n\tSLIST_ENTRY(ng_hook)\t  hk_all;\t\t/* all existing items */\n#endif\t/* NETGRAPH_DEBUG */ /*----------------------------------------------*/\n};\n/* Flags for a hook */\n#define HK_INVALID\t\t0x0001\t/* don't trust it! */\n#define HK_QUEUE\t\t0x0002\t/* queue for later delivery */\n#define HK_FORCE_WRITER\t\t0x0004\t/* Incoming data queued as a writer */\n#define HK_DEAD\t\t\t0x0008\t/* This is the dead hook.. don't free */\n#define HK_HI_STACK\t\t0x0010\t/* Hook has hi stack usage */\n#define HK_TO_INBOUND\t\t0x0020\t/* Hook on ntw. stack inbound path. */\n\n/*\n * Public Methods for hook\n * If you can't do it with these you probably shouldn;t be doing it.\n */\nvoid ng_unref_hook(hook_p hook); /* don't move this */\n#define\t_NG_HOOK_REF(hook)\trefcount_acquire(&(hook)->hk_refs)\n#define _NG_HOOK_NAME(hook)\t((hook)->hk_name)\n#define _NG_HOOK_UNREF(hook)\tng_unref_hook(hook)\n#define\t_NG_HOOK_SET_PRIVATE(hook, val)\tdo {(hook)->hk_private = val;} while (0)\n#define\t_NG_HOOK_SET_RCVMSG(hook, val)\tdo {(hook)->hk_rcvmsg = val;} while (0)\n#define\t_NG_HOOK_SET_RCVDATA(hook, val)\tdo {(hook)->hk_rcvdata = val;} while (0)\n#define\t_NG_HOOK_PRIVATE(hook)\t((hook)->hk_private)\n#define _NG_HOOK_NOT_VALID(hook)\t((hook)->hk_flags & HK_INVALID)\n#define _NG_HOOK_IS_VALID(hook)\t(!((hook)->hk_flags & HK_INVALID))\n#define _NG_HOOK_NODE(hook)\t((hook)->hk_node) /* only rvalue! */\n#define _NG_HOOK_PEER(hook)\t((hook)->hk_peer) /* only rvalue! */\n#define _NG_HOOK_FORCE_WRITER(hook)\t\t\t\t\\\n\t\tdo { hook->hk_flags |= HK_FORCE_WRITER; } while (0)\n#define _NG_HOOK_FORCE_QUEUE(hook) do { hook->hk_flags |= HK_QUEUE; } while (0)\n#define _NG_HOOK_SET_TO_INBOUND(hook)\t\t\t\t\\\n\t\tdo { hook->hk_flags |= HK_TO_INBOUND; } while (0)\n#define _NG_HOOK_HI_STACK(hook) do { hook->hk_flags |= HK_HI_STACK; } while (0)\n\n/* Some shortcuts */\n#define NG_PEER_NODE(hook)\tNG_HOOK_NODE(NG_HOOK_PEER(hook))\n#define NG_PEER_HOOK_NAME(hook)\tNG_HOOK_NAME(NG_HOOK_PEER(hook))\n#define NG_PEER_NODE_NAME(hook)\tNG_NODE_NAME(NG_PEER_NODE(hook))\n\n#ifdef\tNETGRAPH_DEBUG /*----------------------------------------------*/\n#define _NN_ __FILE__,__LINE__\nvoid\tdumphook (hook_p hook, char *file, int line);\nstatic __inline void\t_chkhook(hook_p hook, char *file, int line);\nstatic __inline void\t_ng_hook_ref(hook_p hook, char * file, int line);\nstatic __inline char *\t_ng_hook_name(hook_p hook, char * file, int line);\nstatic __inline void\t_ng_hook_unref(hook_p hook, char * file, int line);\nstatic __inline void\t_ng_hook_set_private(hook_p hook,\n\t\t\t\tvoid * val, char * file, int line);\nstatic __inline void\t_ng_hook_set_rcvmsg(hook_p hook,\n\t\t\t\tng_rcvmsg_t *val, char * file, int line);\nstatic __inline void\t_ng_hook_set_rcvdata(hook_p hook,\n\t\t\t\tng_rcvdata_t *val, char * file, int line);\nstatic __inline void *\t_ng_hook_private(hook_p hook, char * file, int line);\nstatic __inline int\t_ng_hook_not_valid(hook_p hook, char * file, int line);\nstatic __inline int\t_ng_hook_is_valid(hook_p hook, char * file, int line);\nstatic __inline node_p\t_ng_hook_node(hook_p hook, char * file, int line);\nstatic __inline hook_p\t_ng_hook_peer(hook_p hook, char * file, int line);\nstatic __inline void\t_ng_hook_force_writer(hook_p hook, char * file,\n\t\t\t\tint line);\nstatic __inline void\t_ng_hook_force_queue(hook_p hook, char * file,\n\t\t\t\tint line);\nstatic __inline void\t_ng_hook_set_to_inbound(hook_p hook, char * file,\n\t\t\t\tint line);\n\nstatic __inline void\n_chkhook(hook_p hook, char *file, int line)\n{\n\tif (hook->hk_magic != HK_MAGIC) {\n\t\tprintf(\"Accessing freed hook \");\n\t\tdumphook(hook, file, line);\n\t}\n\thook->lastline = line;\n\thook->lastfile = file;\n}\n\nstatic __inline void\n_ng_hook_ref(hook_p hook, char * file, int line)\n{\n\t_chkhook(hook, file, line);\n\t_NG_HOOK_REF(hook);\n}\n\nstatic __inline char *\n_ng_hook_name(hook_p hook, char * file, int line)\n{\n\t_chkhook(hook, file, line);\n\treturn (_NG_HOOK_NAME(hook));\n}\n\nstatic __inline void\n_ng_hook_unref(hook_p hook, char * file, int line)\n{\n\t_chkhook(hook, file, line);\n\t_NG_HOOK_UNREF(hook);\n}\n\nstatic __inline void\n_ng_hook_set_private(hook_p hook, void *val, char * file, int line)\n{\n\t_chkhook(hook, file, line);\n\t_NG_HOOK_SET_PRIVATE(hook, val);\n}\n\nstatic __inline void\n_ng_hook_set_rcvmsg(hook_p hook, ng_rcvmsg_t *val, char * file, int line)\n{\n\t_chkhook(hook, file, line);\n\t_NG_HOOK_SET_RCVMSG(hook, val);\n}\n\nstatic __inline void\n_ng_hook_set_rcvdata(hook_p hook, ng_rcvdata_t *val, char * file, int line)\n{\n\t_chkhook(hook, file, line);\n\t_NG_HOOK_SET_RCVDATA(hook, val);\n}\n\nstatic __inline void *\n_ng_hook_private(hook_p hook, char * file, int line)\n{\n\t_chkhook(hook, file, line);\n\treturn (_NG_HOOK_PRIVATE(hook));\n}\n\nstatic __inline int\n_ng_hook_not_valid(hook_p hook, char * file, int line)\n{\n\t_chkhook(hook, file, line);\n\treturn (_NG_HOOK_NOT_VALID(hook));\n}\n\nstatic __inline int\n_ng_hook_is_valid(hook_p hook, char * file, int line)\n{\n\t_chkhook(hook, file, line);\n\treturn (_NG_HOOK_IS_VALID(hook));\n}\n\nstatic __inline node_p\n_ng_hook_node(hook_p hook, char * file, int line)\n{\n\t_chkhook(hook, file, line);\n\treturn (_NG_HOOK_NODE(hook));\n}\n\nstatic __inline hook_p\n_ng_hook_peer(hook_p hook, char * file, int line)\n{\n\t_chkhook(hook, file, line);\n\treturn (_NG_HOOK_PEER(hook));\n}\n\nstatic __inline void\n_ng_hook_force_writer(hook_p hook, char * file, int line)\n{\n\t_chkhook(hook, file, line);\n\t_NG_HOOK_FORCE_WRITER(hook);\n}\n\nstatic __inline void\n_ng_hook_force_queue(hook_p hook, char * file, int line)\n{\n\t_chkhook(hook, file, line);\n\t_NG_HOOK_FORCE_QUEUE(hook);\n}\n\nstatic __inline void\n_ng_hook_set_to_inbound(hook_p hook, char * file, int line)\n{\n\t_chkhook(hook, file, line);\n\t_NG_HOOK_SET_TO_INBOUND(hook);\n}\n\nstatic __inline void\n_ng_hook_hi_stack(hook_p hook, char * file, int line)\n{\n\t_chkhook(hook, file, line);\n\t_NG_HOOK_HI_STACK(hook);\n}\n\n\n#define\tNG_HOOK_REF(hook)\t\t_ng_hook_ref(hook, _NN_)\n#define NG_HOOK_NAME(hook)\t\t_ng_hook_name(hook, _NN_)\n#define NG_HOOK_UNREF(hook)\t\t_ng_hook_unref(hook, _NN_)\n#define\tNG_HOOK_SET_PRIVATE(hook, val)\t_ng_hook_set_private(hook, val, _NN_)\n#define\tNG_HOOK_SET_RCVMSG(hook, val)\t_ng_hook_set_rcvmsg(hook, val, _NN_)\n#define\tNG_HOOK_SET_RCVDATA(hook, val)\t_ng_hook_set_rcvdata(hook, val, _NN_)\n#define\tNG_HOOK_PRIVATE(hook)\t\t_ng_hook_private(hook, _NN_)\n#define NG_HOOK_NOT_VALID(hook)\t\t_ng_hook_not_valid(hook, _NN_)\n#define NG_HOOK_IS_VALID(hook)\t\t_ng_hook_is_valid(hook, _NN_)\n#define NG_HOOK_NODE(hook)\t\t_ng_hook_node(hook, _NN_)\n#define NG_HOOK_PEER(hook)\t\t_ng_hook_peer(hook, _NN_)\n#define NG_HOOK_FORCE_WRITER(hook)\t_ng_hook_force_writer(hook, _NN_)\n#define NG_HOOK_FORCE_QUEUE(hook)\t_ng_hook_force_queue(hook, _NN_)\n#define NG_HOOK_SET_TO_INBOUND(hook)\t_ng_hook_set_to_inbound(hook, _NN_)\n#define NG_HOOK_HI_STACK(hook)\t\t_ng_hook_hi_stack(hook, _NN_)\n\n#else\t/* NETGRAPH_DEBUG */ /*----------------------------------------------*/\n\n#define\tNG_HOOK_REF(hook)\t\t_NG_HOOK_REF(hook)\n#define NG_HOOK_NAME(hook)\t\t_NG_HOOK_NAME(hook)\n#define NG_HOOK_UNREF(hook)\t\t_NG_HOOK_UNREF(hook)\n#define\tNG_HOOK_SET_PRIVATE(hook, val)\t_NG_HOOK_SET_PRIVATE(hook, val)\n#define\tNG_HOOK_SET_RCVMSG(hook, val)\t_NG_HOOK_SET_RCVMSG(hook, val)\n#define\tNG_HOOK_SET_RCVDATA(hook, val)\t_NG_HOOK_SET_RCVDATA(hook, val)\n#define\tNG_HOOK_PRIVATE(hook)\t\t_NG_HOOK_PRIVATE(hook)\n#define NG_HOOK_NOT_VALID(hook)\t\t_NG_HOOK_NOT_VALID(hook)\n#define NG_HOOK_IS_VALID(hook)\t\t_NG_HOOK_IS_VALID(hook)\n#define NG_HOOK_NODE(hook)\t\t_NG_HOOK_NODE(hook)\n#define NG_HOOK_PEER(hook)\t\t_NG_HOOK_PEER(hook)\n#define NG_HOOK_FORCE_WRITER(hook)\t_NG_HOOK_FORCE_WRITER(hook)\n#define NG_HOOK_FORCE_QUEUE(hook)\t_NG_HOOK_FORCE_QUEUE(hook)\n#define NG_HOOK_SET_TO_INBOUND(hook)\t_NG_HOOK_SET_TO_INBOUND(hook)\n#define NG_HOOK_HI_STACK(hook)\t\t_NG_HOOK_HI_STACK(hook)\n\n#endif\t/* NETGRAPH_DEBUG */ /*----------------------------------------------*/\n\n/***********************************************************************\n ***************** Node Structure and Methods **************************\n ***********************************************************************\n * Structure of a node\n * including the eembedded queue structure.\n *\n * The structure for queueing Netgraph request items\n * embedded in the node structure\n */\nstruct ng_queue {\n\tu_int\t\tq_flags;\t/* Current r/w/q lock flags */\n\tu_int\t\tq_flags2;\t/* Other queue flags */\n\tstruct mtx\tq_mtx;\n\tSTAILQ_ENTRY(ng_node)\tq_work;\t/* nodes with work to do */\n\tSTAILQ_HEAD(, ng_item)\tqueue;\t/* actually items queue */\n};\n\nstruct ng_node {\n\tchar\tnd_name[NG_NODESIZ];\t/* optional globally unique name */\n\tstruct\tng_type *nd_type;\t/* the installed 'type' */\n\tint\tnd_flags;\t\t/* see below for bit definitions */\n\tint\tnd_numhooks;\t\t/* number of hooks */\n\tvoid   *nd_private;\t\t/* node type dependant node ID */\n\tng_ID_t\tnd_ID;\t\t\t/* Unique per node */\n\tLIST_HEAD(hooks, ng_hook) nd_hooks;\t/* linked list of node hooks */\n\tLIST_ENTRY(ng_node)\t  nd_nodes;\t/* linked list of all nodes */\n\tLIST_ENTRY(ng_node)\t  nd_idnodes;\t/* ID hash collision list */\n\tstruct\tng_queue\t  nd_input_queue; /* input queue for locking */\n\tint\tnd_refs;\t\t/* # of references to this node */\n\tstruct\tvnet\t\t *nd_vnet;\t/* network stack instance */\n#ifdef\tNETGRAPH_DEBUG /*----------------------------------------------*/\n#define ND_MAGIC 0x59264837\n\tint\tnd_magic;\n\tchar\t*lastfile;\n\tint\tlastline;\n\tSLIST_ENTRY(ng_node)\t  nd_all;\t/* all existing nodes */\n#endif\t/* NETGRAPH_DEBUG */ /*----------------------------------------------*/\n};\n\n/* Flags for a node */\n#define NGF_INVALID\t0x00000001\t/* free when refs go to 0 */\n#define NG_INVALID\tNGF_INVALID\t/* compat for old code */\n#define NGF_FORCE_WRITER\t0x00000004\t/* Never multithread this node */\n#define NG_FORCE_WRITER\tNGF_FORCE_WRITER /* compat for old code */\n#define NGF_CLOSING\t0x00000008\t/* ng_rmnode() at work */\n#define NG_CLOSING\tNGF_CLOSING\t/* compat for old code */\n#define NGF_REALLY_DIE\t0x00000010\t/* \"persistent\" node is unloading */\n#define NG_REALLY_DIE\tNGF_REALLY_DIE\t/* compat for old code */\n#define NGF_HI_STACK\t0x00000020\t/* node has hi stack usage */\n#define NGF_TYPE1\t0x10000000\t/* reserved for type specific storage */\n#define NGF_TYPE2\t0x20000000\t/* reserved for type specific storage */\n#define NGF_TYPE3\t0x40000000\t/* reserved for type specific storage */\n#define NGF_TYPE4\t0x80000000\t/* reserved for type specific storage */\n\n/*\n * Public methods for nodes.\n * If you can't do it with these you probably shouldn't be doing it.\n */\nvoid\tng_unref_node(node_p node); /* don't move this */\n#define _NG_NODE_NAME(node)\t((node)->nd_name + 0)\n#define _NG_NODE_HAS_NAME(node)\t((node)->nd_name[0] + 0)\n#define _NG_NODE_ID(node)\t((node)->nd_ID + 0)\n#define\t_NG_NODE_REF(node)\trefcount_acquire(&(node)->nd_refs)\n#define\t_NG_NODE_UNREF(node)\tng_unref_node(node)\n#define\t_NG_NODE_SET_PRIVATE(node, val)\tdo {(node)->nd_private = val;} while (0)\n#define\t_NG_NODE_PRIVATE(node)\t((node)->nd_private)\n#define _NG_NODE_IS_VALID(node)\t(!((node)->nd_flags & NGF_INVALID))\n#define _NG_NODE_NOT_VALID(node)\t((node)->nd_flags & NGF_INVALID)\n#define _NG_NODE_NUMHOOKS(node)\t((node)->nd_numhooks + 0) /* rvalue */\n#define _NG_NODE_FORCE_WRITER(node)\t\t\t\t\t\\\n\tdo{ node->nd_flags |= NGF_FORCE_WRITER; }while (0)\n#define _NG_NODE_HI_STACK(node)\t\t\t\t\t\t\\\n\tdo{ node->nd_flags |= NGF_HI_STACK; }while (0)\n#define _NG_NODE_REALLY_DIE(node)\t\t\t\t\t\\\n\tdo{ node->nd_flags |= (NGF_REALLY_DIE|NGF_INVALID); }while (0)\n#define _NG_NODE_REVIVE(node) \\\n\tdo { node->nd_flags &= ~NGF_INVALID; } while (0)\n/*\n * The hook iterator.\n * This macro will call a function of type ng_fn_eachhook for each\n * hook attached to the node. If the function returns 0, then the\n * iterator will stop and return a pointer to the hook that returned 0.\n */\ntypedef\tint\tng_fn_eachhook(hook_p hook, void* arg);\n#define _NG_NODE_FOREACH_HOOK(node, fn, arg, rethook)\t\t\t\\\n\tdo {\t\t\t\t\t\t\t\t\\\n\t\thook_p _hook;\t\t\t\t\t\t\\\n\t\t(rethook) = NULL;\t\t\t\t\t\\\n\t\tLIST_FOREACH(_hook, &((node)->nd_hooks), hk_hooks) {\t\\\n\t\t\tif ((fn)(_hook, arg) == 0) {\t\t\t\\\n\t\t\t\t(rethook) = _hook;\t\t\t\\\n\t\t\t\tbreak;\t\t\t\t\t\\\n\t\t\t}\t\t\t\t\t\t\\\n\t\t}\t\t\t\t\t\t\t\\\n\t} while (0)\n\n#ifdef\tNETGRAPH_DEBUG /*----------------------------------------------*/\nvoid\tdumpnode(node_p node, char *file, int line);\nstatic __inline void _chknode(node_p node, char *file, int line);\nstatic __inline char * _ng_node_name(node_p node, char *file, int line);\nstatic __inline int _ng_node_has_name(node_p node, char *file, int line);\nstatic __inline ng_ID_t _ng_node_id(node_p node, char *file, int line);\nstatic __inline void _ng_node_ref(node_p node, char *file, int line);\nstatic __inline void _ng_node_unref(node_p node, char *file, int line);\nstatic __inline void _ng_node_set_private(node_p node, void * val,\n\t\t\t\t\t\t\tchar *file, int line);\nstatic __inline void * _ng_node_private(node_p node, char *file, int line);\nstatic __inline int _ng_node_is_valid(node_p node, char *file, int line);\nstatic __inline int _ng_node_not_valid(node_p node, char *file, int line);\nstatic __inline int _ng_node_numhooks(node_p node, char *file, int line);\nstatic __inline void _ng_node_force_writer(node_p node, char *file, int line);\nstatic __inline hook_p _ng_node_foreach_hook(node_p node,\n\t\t\tng_fn_eachhook *fn, void *arg, char *file, int line);\nstatic __inline void _ng_node_revive(node_p node, char *file, int line);\n\nstatic __inline void\n_chknode(node_p node, char *file, int line)\n{\n\tif (node->nd_magic != ND_MAGIC) {\n\t\tprintf(\"Accessing freed node \");\n\t\tdumpnode(node, file, line);\n\t}\n\tnode->lastline = line;\n\tnode->lastfile = file;\n}\n\nstatic __inline char *\n_ng_node_name(node_p node, char *file, int line)\n{\n\t_chknode(node, file, line);\n\treturn(_NG_NODE_NAME(node));\n}\n\nstatic __inline int\n_ng_node_has_name(node_p node, char *file, int line)\n{\n\t_chknode(node, file, line);\n\treturn(_NG_NODE_HAS_NAME(node));\n}\n\nstatic __inline ng_ID_t\n_ng_node_id(node_p node, char *file, int line)\n{\n\t_chknode(node, file, line);\n\treturn(_NG_NODE_ID(node));\n}\n\nstatic __inline void\n_ng_node_ref(node_p node, char *file, int line)\n{\n\t_chknode(node, file, line);\n\t_NG_NODE_REF(node);\n}\n\nstatic __inline void\n_ng_node_unref(node_p node, char *file, int line)\n{\n\t_chknode(node, file, line);\n\t_NG_NODE_UNREF(node);\n}\n\nstatic __inline void\n_ng_node_set_private(node_p node, void * val, char *file, int line)\n{\n\t_chknode(node, file, line);\n\t_NG_NODE_SET_PRIVATE(node, val);\n}\n\nstatic __inline void *\n_ng_node_private(node_p node, char *file, int line)\n{\n\t_chknode(node, file, line);\n\treturn (_NG_NODE_PRIVATE(node));\n}\n\nstatic __inline int\n_ng_node_is_valid(node_p node, char *file, int line)\n{\n\t_chknode(node, file, line);\n\treturn(_NG_NODE_IS_VALID(node));\n}\n\nstatic __inline int\n_ng_node_not_valid(node_p node, char *file, int line)\n{\n\t_chknode(node, file, line);\n\treturn(_NG_NODE_NOT_VALID(node));\n}\n\nstatic __inline int\n_ng_node_numhooks(node_p node, char *file, int line)\n{\n\t_chknode(node, file, line);\n\treturn(_NG_NODE_NUMHOOKS(node));\n}\n\nstatic __inline void\n_ng_node_force_writer(node_p node, char *file, int line)\n{\n\t_chknode(node, file, line);\n\t_NG_NODE_FORCE_WRITER(node);\n}\n\nstatic __inline void\n_ng_node_hi_stack(node_p node, char *file, int line)\n{\n\t_chknode(node, file, line);\n\t_NG_NODE_HI_STACK(node);\n}\n\nstatic __inline void\n_ng_node_really_die(node_p node, char *file, int line)\n{\n\t_chknode(node, file, line);\n\t_NG_NODE_REALLY_DIE(node);\n}\n\nstatic __inline void\n_ng_node_revive(node_p node, char *file, int line)\n{\n\t_chknode(node, file, line);\n\t_NG_NODE_REVIVE(node);\n}\n\nstatic __inline hook_p\n_ng_node_foreach_hook(node_p node, ng_fn_eachhook *fn, void *arg,\n\t\t\t\t\t\tchar *file, int line)\n{\n\thook_p hook;\n\t_chknode(node, file, line);\n\t_NG_NODE_FOREACH_HOOK(node, fn, arg, hook);\n\treturn (hook);\n}\n\n#define NG_NODE_NAME(node)\t\t_ng_node_name(node, _NN_)\t\n#define NG_NODE_HAS_NAME(node)\t\t_ng_node_has_name(node, _NN_)\t\n#define NG_NODE_ID(node)\t\t_ng_node_id(node, _NN_)\n#define NG_NODE_REF(node)\t\t_ng_node_ref(node, _NN_)\n#define\tNG_NODE_UNREF(node)\t\t_ng_node_unref(node, _NN_)\n#define\tNG_NODE_SET_PRIVATE(node, val)\t_ng_node_set_private(node, val, _NN_)\n#define\tNG_NODE_PRIVATE(node)\t\t_ng_node_private(node, _NN_)\n#define NG_NODE_IS_VALID(node)\t\t_ng_node_is_valid(node, _NN_)\n#define NG_NODE_NOT_VALID(node)\t\t_ng_node_not_valid(node, _NN_)\n#define NG_NODE_FORCE_WRITER(node) \t_ng_node_force_writer(node, _NN_)\n#define NG_NODE_HI_STACK(node) \t\t_ng_node_hi_stack(node, _NN_)\n#define NG_NODE_REALLY_DIE(node) \t_ng_node_really_die(node, _NN_)\n#define NG_NODE_NUMHOOKS(node)\t\t_ng_node_numhooks(node, _NN_)\n#define NG_NODE_REVIVE(node)\t\t_ng_node_revive(node, _NN_)\n#define NG_NODE_FOREACH_HOOK(node, fn, arg, rethook)\t\t\t      \\\n\tdo {\t\t\t\t\t\t\t\t      \\\n\t\trethook = _ng_node_foreach_hook(node, fn, (void *)arg, _NN_); \\\n\t} while (0)\n\n#else\t/* NETGRAPH_DEBUG */ /*----------------------------------------------*/\n\n#define NG_NODE_NAME(node)\t\t_NG_NODE_NAME(node)\t\n#define NG_NODE_HAS_NAME(node)\t\t_NG_NODE_HAS_NAME(node)\t\n#define NG_NODE_ID(node)\t\t_NG_NODE_ID(node)\t\n#define\tNG_NODE_REF(node)\t\t_NG_NODE_REF(node)\t\n#define\tNG_NODE_UNREF(node)\t\t_NG_NODE_UNREF(node)\t\n#define\tNG_NODE_SET_PRIVATE(node, val)\t_NG_NODE_SET_PRIVATE(node, val)\t\n#define\tNG_NODE_PRIVATE(node)\t\t_NG_NODE_PRIVATE(node)\t\n#define NG_NODE_IS_VALID(node)\t\t_NG_NODE_IS_VALID(node)\t\n#define NG_NODE_NOT_VALID(node)\t\t_NG_NODE_NOT_VALID(node)\t\n#define NG_NODE_FORCE_WRITER(node) \t_NG_NODE_FORCE_WRITER(node)\n#define NG_NODE_HI_STACK(node) \t\t_NG_NODE_HI_STACK(node)\n#define NG_NODE_REALLY_DIE(node) \t_NG_NODE_REALLY_DIE(node)\n#define NG_NODE_NUMHOOKS(node)\t\t_NG_NODE_NUMHOOKS(node)\t\n#define NG_NODE_REVIVE(node)\t\t_NG_NODE_REVIVE(node)\n#define NG_NODE_FOREACH_HOOK(node, fn, arg, rethook)\t\t\t\\\n\t\t_NG_NODE_FOREACH_HOOK(node, fn, arg, rethook)\n#endif\t/* NETGRAPH_DEBUG */ /*----------------------------------------------*/\n\n/***********************************************************************\n ************* Node Queue and Item Structures and Methods **************\n ***********************************************************************\n *\n */\ntypedef\tvoid\tng_item_fn(node_p node, hook_p hook, void *arg1, int arg2);\ntypedef\tint\tng_item_fn2(node_p node, struct ng_item *item, hook_p hook);\ntypedef\tvoid\tng_apply_t(void *context, int error);\nstruct ng_apply_info {\n\tng_apply_t\t*apply;\n\tvoid\t\t*context;\n\tint\t\trefs;\n\tint\t\terror;\n};\nstruct ng_item {\n\tu_long\tel_flags;\n\tSTAILQ_ENTRY(ng_item)\tel_next;\n\tnode_p\tel_dest; /* The node it will be applied against (or NULL) */\n\thook_p\tel_hook; /* Entering hook. Optional in Control messages */\n\tunion {\n\t\tstruct mbuf\t*da_m;\n\t\tstruct {\n\t\t\tstruct ng_mesg\t*msg_msg;\n\t\t\tng_ID_t\t\tmsg_retaddr;\n\t\t} msg;\n\t\tstruct {\n\t\t\tunion {\n\t\t\t\tng_item_fn\t*fn_fn;\n\t\t\t\tng_item_fn2\t*fn_fn2;\n\t\t\t} fn_fn;\n\t\t\tvoid \t\t*fn_arg1;\n\t\t\tint\t\tfn_arg2;\n\t\t} fn;\n\t} body;\n\t/*\n\t * Optional callback called when item is being applied,\n\t * and its context.\n\t */\n\tstruct ng_apply_info\t*apply;\n\tu_int\tdepth;\n#ifdef\tNETGRAPH_DEBUG /*----------------------------------------------*/\n\tchar *lastfile;\n\tint  lastline;\n\tTAILQ_ENTRY(ng_item)\t  all;\t\t/* all existing items */\n#endif\t/* NETGRAPH_DEBUG */ /*----------------------------------------------*/\n};\n\n#define NGQF_TYPE\t0x03\t\t/* MASK of content definition */\n#define NGQF_MESG\t0x00\t\t/* the queue element is a message */\n#define NGQF_DATA\t0x01\t\t/* the queue element is data */\n#define NGQF_FN\t\t0x02\t\t/* the queue element is a function */\n#define NGQF_FN2\t0x03\t\t/* the queue element is a new function */\n\n#define NGQF_RW\t\t0x04\t\t/* MASK for wanted queue mode */\n#define NGQF_READER\t0x04\t\t/* wants to be a reader */\n#define NGQF_WRITER\t0x00\t\t/* wants to be a writer */\n\n#define NGQF_QMODE\t0x08\t\t/* MASK for how it was queued */\n#define NGQF_QREADER\t0x08\t\t/* was queued as a reader */\n#define NGQF_QWRITER\t0x00\t\t/* was queued as a writer */\n\n/*\n * Get the mbuf (etc) out of an item.\n * Sets the value in the item to NULL in case we need to call NG_FREE_ITEM()\n * with it, (to avoid freeing the things twice).\n * If you don't want to zero out the item then realise that the\n * item still owns it.\n * Retaddr is different. There are no references on that. It's just a number.\n * The debug versions must be either all used everywhere or not at all.\n */\n\n#define _NGI_M(i) ((i)->body.da_m)\n#define _NGI_MSG(i) ((i)->body.msg.msg_msg)\n#define _NGI_RETADDR(i) ((i)->body.msg.msg_retaddr)\n#define\t_NGI_FN(i) ((i)->body.fn.fn_fn.fn_fn)\n#define\t_NGI_FN2(i) ((i)->body.fn.fn_fn.fn_fn2)\n#define\t_NGI_ARG1(i) ((i)->body.fn.fn_arg1)\n#define\t_NGI_ARG2(i) ((i)->body.fn.fn_arg2)\n#define\t_NGI_NODE(i) ((i)->el_dest)\n#define\t_NGI_HOOK(i) ((i)->el_hook)\n#define\t_NGI_SET_HOOK(i,h) do { _NGI_HOOK(i) = h; h = NULL;} while (0)\n#define\t_NGI_CLR_HOOK(i)   do {\t\t\t\t\t\t\\\n\t\thook_p _hook = _NGI_HOOK(i);\t\t\t\t\\\n\t\tif (_hook) {\t\t\t\t\t\t\\\n\t\t\t_NG_HOOK_UNREF(_hook);\t\t\t\t\\\n\t\t\t_NGI_HOOK(i) = NULL;\t\t\t\t\\\n\t\t}\t\t\t\t\t\t\t\\\n\t} while (0)\n#define\t_NGI_SET_NODE(i,n) do { _NGI_NODE(i) = n; n = NULL;} while (0)\n#define\t_NGI_CLR_NODE(i)   do {\t\t\t\t\t\t\\\n\t\tnode_p _node = _NGI_NODE(i);\t\t\t\t\\\n\t\tif (_node) {\t\t\t\t\t\t\\\n\t\t\t_NG_NODE_UNREF(_node);\t\t\t\t\\\n\t\t\t_NGI_NODE(i) = NULL;\t\t\t\t\\\n\t\t}\t\t\t\t\t\t\t\\\n\t} while (0)\n\n#ifdef NETGRAPH_DEBUG /*----------------------------------------------*/\nvoid\t\t\t\tdumpitem(item_p item, char *file, int line);\nstatic __inline void\t\t_ngi_check(item_p item, char *file, int line) ;\nstatic __inline struct mbuf **\t_ngi_m(item_p item, char *file, int line) ;\nstatic __inline ng_ID_t *\t_ngi_retaddr(item_p item, char *file, int line);\nstatic __inline struct ng_mesg ** _ngi_msg(item_p item, char *file, int line) ;\nstatic __inline ng_item_fn **\t_ngi_fn(item_p item, char *file, int line) ;\nstatic __inline ng_item_fn2 **\t_ngi_fn2(item_p item, char *file, int line) ;\nstatic __inline void **\t\t_ngi_arg1(item_p item, char *file, int line) ;\nstatic __inline int *\t\t_ngi_arg2(item_p item, char *file, int line) ;\nstatic __inline node_p\t\t_ngi_node(item_p item, char *file, int line);\nstatic __inline hook_p\t\t_ngi_hook(item_p item, char *file, int line);\n\nstatic __inline void\n_ngi_check(item_p item, char *file, int line)\n{\n\t(item)->lastline = line;\n\t(item)->lastfile = file;\n}\n\nstatic __inline struct mbuf **\n_ngi_m(item_p item, char *file, int line)\n{\n\t_ngi_check(item, file, line);\n\treturn (&_NGI_M(item));\n}\n\nstatic __inline struct ng_mesg **\n_ngi_msg(item_p item, char *file, int line)\n{\n\t_ngi_check(item, file, line);\n\treturn (&_NGI_MSG(item));\n}\n\nstatic __inline ng_ID_t *\n_ngi_retaddr(item_p item, char *file, int line)\n{\n\t_ngi_check(item, file, line);\n\treturn (&_NGI_RETADDR(item));\n}\n\nstatic __inline ng_item_fn **\n_ngi_fn(item_p item, char *file, int line)\n{\n\t_ngi_check(item, file, line);\n\treturn (&_NGI_FN(item));\n}\n\nstatic __inline ng_item_fn2 **\n_ngi_fn2(item_p item, char *file, int line)\n{\n\t_ngi_check(item, file, line);\n\treturn (&_NGI_FN2(item));\n}\n\nstatic __inline void **\n_ngi_arg1(item_p item, char *file, int line)\n{\n\t_ngi_check(item, file, line);\n\treturn (&_NGI_ARG1(item));\n}\n\nstatic __inline int *\n_ngi_arg2(item_p item, char *file, int line)\n{\n\t_ngi_check(item, file, line);\n\treturn (&_NGI_ARG2(item));\n}\n\nstatic __inline node_p\n_ngi_node(item_p item, char *file, int line)\n{\n\t_ngi_check(item, file, line);\n\treturn (_NGI_NODE(item));\n}\n\nstatic __inline hook_p\n_ngi_hook(item_p item, char *file, int line)\n{\n\t_ngi_check(item, file, line);\n\treturn (_NGI_HOOK(item));\n}\n\n#define NGI_M(i)\t(*_ngi_m(i, _NN_))\n#define NGI_MSG(i)\t(*_ngi_msg(i, _NN_))\n#define NGI_RETADDR(i)\t(*_ngi_retaddr(i, _NN_))\n#define NGI_FN(i)\t(*_ngi_fn(i, _NN_))\n#define NGI_FN2(i)\t(*_ngi_fn2(i, _NN_))\n#define NGI_ARG1(i)\t(*_ngi_arg1(i, _NN_))\n#define NGI_ARG2(i)\t(*_ngi_arg2(i, _NN_))\n#define NGI_HOOK(i)\t_ngi_hook(i, _NN_)\n#define NGI_NODE(i)\t_ngi_node(i, _NN_)\n#define\tNGI_SET_HOOK(i,h)\t\t\t\t\t\t\\\n\tdo { _ngi_check(i, _NN_); _NGI_SET_HOOK(i, h); } while (0)\n#define\tNGI_CLR_HOOK(i)\t\t\t\t\t\t\t\\\n\tdo { _ngi_check(i, _NN_); _NGI_CLR_HOOK(i); } while (0)\n#define\tNGI_SET_NODE(i,n)\t\t\t\t\t\t\\\n\tdo { _ngi_check(i, _NN_); _NGI_SET_NODE(i, n); } while (0)\n#define\tNGI_CLR_NODE(i)\t\t\t\t\t\t\t\\\n\tdo { _ngi_check(i, _NN_); _NGI_CLR_NODE(i); } while (0)\n\n#define NG_FREE_ITEM(item)\t\t\t\t\t\t\\\n\tdo {\t\t\t\t\t\t\t\t\\\n\t\t_ngi_check(item, _NN_);\t\t\t\t\t\\\n\t\tng_free_item((item));\t\t\t\t\t\\\n\t} while (0)\n\n#define\tSAVE_LINE(item)\t\t\t\t\t\t\t\\\n\tdo {\t\t\t\t\t\t\t\t\\\n\t\t(item)->lastline = __LINE__;\t\t\t\t\\\n\t\t(item)->lastfile = __FILE__;\t\t\t\t\\\n\t} while (0)\n\n#else\t/* NETGRAPH_DEBUG */ /*----------------------------------------------*/\n\n#define NGI_M(i)\t_NGI_M(i)\n#define NGI_MSG(i)\t_NGI_MSG(i)\n#define NGI_RETADDR(i)\t_NGI_RETADDR(i)\n#define NGI_FN(i)\t_NGI_FN(i)\n#define NGI_FN2(i)\t_NGI_FN2(i)\n#define NGI_ARG1(i)\t_NGI_ARG1(i)\n#define NGI_ARG2(i)\t_NGI_ARG2(i)\n#define\tNGI_NODE(i)\t_NGI_NODE(i)\n#define\tNGI_HOOK(i)\t_NGI_HOOK(i)\n#define\tNGI_SET_HOOK(i,h) _NGI_SET_HOOK(i,h)\n#define\tNGI_CLR_HOOK(i)\t  _NGI_CLR_HOOK(i)\n#define\tNGI_SET_NODE(i,n) _NGI_SET_NODE(i,n)\n#define\tNGI_CLR_NODE(i)\t  _NGI_CLR_NODE(i)\n\n#define\tNG_FREE_ITEM(item)\tng_free_item((item))\n#define\tSAVE_LINE(item)\t\tdo {} while (0)\n\n#endif\t/* NETGRAPH_DEBUG */ /*----------------------------------------------*/\n\n#define NGI_GET_M(i,m)\t\t\t\t\t\t\t\\\n\tdo {\t\t\t\t\t\t\t\t\\\n\t\t(m) = NGI_M(i);\t\t\t\t\t\t\\\n\t\t_NGI_M(i) = NULL;\t\t\t\t\t\\\n\t} while (0)\n\n#define NGI_GET_MSG(i,m)\t\t\t\t\t\t\\\n\tdo {\t\t\t\t\t\t\t\t\\\n\t\t(m) = NGI_MSG(i);\t\t\t\t\t\\\n\t\t_NGI_MSG(i) = NULL;\t\t\t\t\t\\\n\t} while (0)\n\n#define NGI_GET_NODE(i,n)\t/* YOU NOW HAVE THE REFERENCE */\t\\\n\tdo {\t\t\t\t\t\t\t\t\\\n\t\t(n) = NGI_NODE(i);\t\t\t\t\t\\\n\t\t_NGI_NODE(i) = NULL;\t\t\t\t\t\\\n\t} while (0)\n\n#define NGI_GET_HOOK(i,h)\t\t\t\t\t\t\\\n\tdo {\t\t\t\t\t\t\t\t\\\n\t\t(h) = NGI_HOOK(i);\t\t\t\t\t\\\n\t\t_NGI_HOOK(i) = NULL;\t\t\t\t\t\\\n\t} while (0)\n\n#define NGI_SET_WRITER(i)\t((i)->el_flags &= ~NGQF_QMODE)\n#define NGI_SET_READER(i)\t((i)->el_flags |= NGQF_QREADER)\n\n#define NGI_QUEUED_READER(i)\t((i)->el_flags & NGQF_QREADER)\n#define NGI_QUEUED_WRITER(i)\t(((i)->el_flags & NGQF_QMODE) == NGQF_QWRITER)\n\t\n/**********************************************************************\n* Data macros.  Send, manipulate and free.\n**********************************************************************/\n/*\n * Assuming the data is already ok, just set the new address and send\n */\n#define NG_FWD_ITEM_HOOK_FLAGS(error, item, hook, flags)\t\t\\\n\tdo {\t\t\t\t\t\t\t\t\\\n\t\t(error) =\t\t\t\t\t\t\\\n\t\t    ng_address_hook(NULL, (item), (hook), NG_NOFLAGS);\t\\\n\t\tif (error == 0) {\t\t\t\t\t\\\n\t\t\tSAVE_LINE(item);\t\t\t\t\\\n\t\t\t(error) = ng_snd_item((item), (flags));\t\t\\\n\t\t}\t\t\t\t\t\t\t\\\n\t\t(item) = NULL;\t\t\t\t\t\t\\\n\t} while (0)\n#define\tNG_FWD_ITEM_HOOK(error, item, hook)\t\\\n\t\tNG_FWD_ITEM_HOOK_FLAGS(error, item, hook, NG_NOFLAGS)\n\n/*\n * Forward a data packet. Mbuf pointer is updated to new value. We\n * presume you dealt with the old one when you update it to the new one\n * (or it maybe the old one). We got a packet and possibly had to modify\n * the mbuf. You should probably use NGI_GET_M() if you are going to use\n * this too.\n */\n#define NG_FWD_NEW_DATA_FLAGS(error, item, hook, m, flags)\t\t\\\n\tdo {\t\t\t\t\t\t\t\t\\\n\t\tNGI_M(item) = (m);\t\t\t\t\t\\\n\t\t(m) = NULL;\t\t\t\t\t\t\\\n\t\tNG_FWD_ITEM_HOOK_FLAGS(error, item, hook, flags);\t\\\n\t} while (0)\n#define\tNG_FWD_NEW_DATA(error, item, hook, m)\t\\\n\t\tNG_FWD_NEW_DATA_FLAGS(error, item, hook, m, NG_NOFLAGS)\n\n/* Send a previously unpackaged mbuf. XXX: This should be called\n * NG_SEND_DATA in future, but this name is kept for compatibility\n * reasons.\n */\n#define NG_SEND_DATA_FLAGS(error, hook, m, flags)\t\t\t\\\n\tdo {\t\t\t\t\t\t\t\t\\\n\t\titem_p _item;\t\t\t\t\t\t\\\n\t\tif ((_item = ng_package_data((m), flags))) {\t\t\\\n\t\t\tNG_FWD_ITEM_HOOK_FLAGS(error, _item, hook, flags);\\\n\t\t} else {\t\t\t\t\t\t\\\n\t\t\t(error) = ENOMEM;\t\t\t\t\\\n\t\t}\t\t\t\t\t\t\t\\\n\t\t(m) = NULL;\t\t\t\t\t\t\\\n\t} while (0)\n\n#define NG_SEND_DATA_ONLY(error, hook, m)\t\\\n\t\tNG_SEND_DATA_FLAGS(error, hook, m, NG_NOFLAGS)\n/* NG_SEND_DATA() compat for meta-data times */\n#define\tNG_SEND_DATA(error, hook, m, x)\t\\\n\t\tNG_SEND_DATA_FLAGS(error, hook, m, NG_NOFLAGS)\n\n#define NG_FREE_MSG(msg)\t\t\t\t\t\t\\\n\tdo {\t\t\t\t\t\t\t\t\\\n\t\tif ((msg)) {\t\t\t\t\t\t\\\n\t\t\tfree((msg), M_NETGRAPH_MSG);\t\t\t\\\n\t\t\t(msg) = NULL;\t\t\t\t\t\\\n\t\t}\t \t\t\t\t\t\t\\\n\t} while (0)\n\n#define NG_FREE_M(m)\t\t\t\t\t\t\t\\\n\tdo {\t\t\t\t\t\t\t\t\\\n\t\tif ((m)) {\t\t\t\t\t\t\\\n\t\t\tm_freem((m));\t\t\t\t\t\\\n\t\t\t(m) = NULL;\t\t\t\t\t\\\n\t\t}\t\t\t\t\t\t\t\\\n\t} while (0)\n\n/*****************************************\n* Message macros\n*****************************************/\n\n#define NG_SEND_MSG_HOOK(error, here, msg, hook, retaddr)\t\t\\\n\tdo {\t\t\t\t\t\t\t\t\\\n\t\titem_p _item;\t\t\t\t\t\t\\\n\t\tif ((_item = ng_package_msg(msg, NG_NOFLAGS)) == NULL) {\\\n\t\t\t(msg) = NULL;\t\t\t\t\t\\\n\t\t\t(error) = ENOMEM;\t\t\t\t\\\n\t\t\tbreak;\t\t\t\t\t\t\\\n\t\t}\t\t\t\t\t\t\t\\\n\t\tif (((error) = ng_address_hook((here), (_item),\t\t\\\n\t\t\t\t\t(hook), (retaddr))) == 0) {\t\\\n\t\t\tSAVE_LINE(_item);\t\t\t\t\\\n\t\t\t(error) = ng_snd_item((_item), 0);\t\t\\\n\t\t}\t\t\t\t\t\t\t\\\n\t\t(msg) = NULL;\t\t\t\t\t\t\\\n\t} while (0)\n\n#define NG_SEND_MSG_PATH(error, here, msg, path, retaddr)\t\t\\\n\tdo {\t\t\t\t\t\t\t\t\\\n\t\titem_p _item;\t\t\t\t\t\t\\\n\t\tif ((_item = ng_package_msg(msg, NG_NOFLAGS)) == NULL) {\\\n\t\t\t(msg) = NULL;\t\t\t\t\t\\\n\t\t\t(error) = ENOMEM;\t\t\t\t\\\n\t\t\tbreak;\t\t\t\t\t\t\\\n\t\t}\t\t\t\t\t\t\t\\\n\t\tif (((error) = ng_address_path((here), (_item),\t\t\\\n\t\t\t\t\t(path), (retaddr))) == 0) {\t\\\n\t\t\tSAVE_LINE(_item);\t\t\t\t\\\n\t\t\t(error) = ng_snd_item((_item), 0);\t\t\\\n\t\t}\t\t\t\t\t\t\t\\\n\t\t(msg) = NULL;\t\t\t\t\t\t\\\n\t} while (0)\n\n#define NG_SEND_MSG_ID(error, here, msg, ID, retaddr)\t\t\t\\\n\tdo {\t\t\t\t\t\t\t\t\\\n\t\titem_p _item;\t\t\t\t\t\t\\\n\t\tif ((_item = ng_package_msg(msg, NG_NOFLAGS)) == NULL) {\\\n\t\t\t(msg) = NULL;\t\t\t\t\t\\\n\t\t\t(error) = ENOMEM;\t\t\t\t\\\n\t\t\tbreak;\t\t\t\t\t\t\\\n\t\t}\t\t\t\t\t\t\t\\\n\t\tif (((error) = ng_address_ID((here), (_item),\t\t\\\n\t\t\t\t\t(ID), (retaddr))) == 0) {\t\\\n\t\t\tSAVE_LINE(_item);\t\t\t\t\\\n\t\t\t(error) = ng_snd_item((_item), 0);\t\t\\\n\t\t}\t\t\t\t\t\t\t\\\n\t\t(msg) = NULL;\t\t\t\t\t\t\\\n\t} while (0)\n\n/*\n * Redirect the message to the next hop using the given hook.\n * ng_retarget_msg() frees the item if there is an error\n * and returns an error code.  It returns 0 on success.\n */\n#define NG_FWD_MSG_HOOK(error, here, item, hook, retaddr)\t\t\\\n\tdo {\t\t\t\t\t\t\t\t\\\n\t\tif (((error) = ng_address_hook((here), (item),\t\t\\\n\t\t\t\t\t(hook), (retaddr))) == 0) {\t\\\n\t\t\tSAVE_LINE(item);\t\t\t\t\\\n\t\t\t(error) = ng_snd_item((item), 0);\t\t\\\n\t\t}\t\t\t\t\t\t\t\\\n\t\t(item) = NULL;\t\t\t\t\t\t\\\n\t} while (0)\n\n/*\n * Send a queue item back to it's originator with a response message.\n * Assume original message was removed and freed separatly.\n */\n#define NG_RESPOND_MSG(error, here, item, resp)\t\t\t\t\\\n\tdo {\t\t\t\t\t\t\t\t\\\n\t\tif (resp) {\t\t\t\t\t\t\\\n\t\t\tng_ID_t _dest = NGI_RETADDR(item);\t\t\\\n\t\t\tNGI_RETADDR(item) = 0;\t\t\t\t\\\n\t\t\tNGI_MSG(item) = resp;\t\t\t\t\\\n\t\t\tif ((error = ng_address_ID((here), (item),\t\\\n\t\t\t\t\t_dest, 0)) == 0) {\t\t\\\n\t\t\t\tSAVE_LINE(item);\t\t\t\\\n\t\t\t\t(error) = ng_snd_item((item), NG_QUEUE);\\\n\t\t\t}\t\t\t\t\t\t\\\n\t\t} else\t\t\t\t\t\t\t\\\n\t\t\tNG_FREE_ITEM(item);\t\t\t\t\\\n\t\t(item) = NULL;\t\t\t\t\t\t\\\n\t} while (0)\n\n\n/***********************************************************************\n ******** Structures Definitions and Macros for defining a node  *******\n ***********************************************************************\n *\n * Here we define the structures needed to actually define a new node\n * type.\n */\n\n/*\n * Command list -- each node type specifies the command that it knows\n * how to convert between ASCII and binary using an array of these.\n * The last element in the array must be a terminator with cookie=0.\n */\n\nstruct ng_cmdlist {\n\tu_int32_t\t\t\tcookie;\t\t/* command typecookie */\n\tint\t\t\t\tcmd;\t\t/* command number */\n\tconst char\t\t\t*name;\t\t/* command name */\n\tconst struct ng_parse_type\t*mesgType;\t/* args if !NGF_RESP */\n\tconst struct ng_parse_type\t*respType;\t/* args if NGF_RESP */\n};\n\n/*\n * Structure of a node type\n * If data is sent to the \"rcvdata()\" entrypoint then the system\n * may decide to defer it until later by queing it with the normal netgraph\n * input queuing system.  This is decidde by the HK_QUEUE flag being set in\n * the flags word of the peer (receiving) hook. The dequeuing mechanism will\n * ensure it is not requeued again.\n * Note the input queueing system is to allow modules\n * to 'release the stack' or to pass data across spl layers.\n * The data will be redelivered as soon as the NETISR code runs\n * which may be almost immediatly.  A node may also do it's own queueing\n * for other reasons (e.g. device output queuing).\n */\nstruct ng_type {\n\n\tu_int32_t\tversion; \t/* must equal NG_API_VERSION */\n\tconst char\t*name;\t\t/* Unique type name */\n\tmodeventhand_t\tmod_event;\t/* Module event handler (optional) */\n\tng_constructor_t *constructor;\t/* Node constructor */\n\tng_rcvmsg_t\t*rcvmsg;\t/* control messages come here */\n\tng_close_t\t*close;\t\t/* warn about forthcoming shutdown */\n\tng_shutdown_t\t*shutdown;\t/* reset, and free resources */\n\tng_newhook_t\t*newhook;\t/* first notification of new hook */\n\tng_findhook_t\t*findhook;\t/* only if you have lots of hooks */\n\tng_connect_t\t*connect;\t/* final notification of new hook */\n\tng_rcvdata_t\t*rcvdata;\t/* data comes here */\n\tng_disconnect_t\t*disconnect;\t/* notify on disconnect */\n\n\tconst struct\tng_cmdlist *cmdlist;\t/* commands we can convert */\n\n\t/* R/W data private to the base netgraph code DON'T TOUCH! */\n\tLIST_ENTRY(ng_type) types;\t\t/* linked list of all types */\n\tint\t\t    refs;\t\t/* number of instances */\n};\n\n/*\n * Use the NETGRAPH_INIT() macro to link a node type into the\n * netgraph system. This works for types compiled into the kernel\n * as well as KLD modules. The first argument should be the type\n * name (eg, echo) and the second a pointer to the type struct.\n *\n * If a different link time is desired, e.g., a device driver that\n * needs to install its netgraph type before probing, use the\n * NETGRAPH_INIT_ORDERED() macro instead.  Device drivers probably\n * want to use SI_SUB_DRIVERS/SI_ORDER_FIRST.\n */\n\n#define NETGRAPH_INIT_ORDERED(typename, typestructp, sub, order)\t\\\nstatic moduledata_t ng_##typename##_mod = {\t\t\t\t\\\n\t\"ng_\" #typename,\t\t\t\t\t\t\\\n\tng_mod_event,\t\t\t\t\t\t\t\\\n\t(typestructp)\t\t\t\t\t\t\t\\\n};\t\t\t\t\t\t\t\t\t\\\nDECLARE_MODULE(ng_##typename, ng_##typename##_mod, sub, order);\t\t\\\nMODULE_DEPEND(ng_##typename, netgraph,\tNG_ABI_VERSION,\t\t\t\\\n\t\t\t\t\tNG_ABI_VERSION,\t\t\t\\\n\t\t\t\t\tNG_ABI_VERSION)\n\n#define NETGRAPH_INIT(tn, tp)\t\t\t\t\t\t\\\n\tNETGRAPH_INIT_ORDERED(tn, tp, SI_SUB_PSEUDO, SI_ORDER_MIDDLE)\n\n/* Special malloc() type for netgraph structs and ctrl messages */\n/* Only these two types should be visible to nodes */\nMALLOC_DECLARE(M_NETGRAPH);\nMALLOC_DECLARE(M_NETGRAPH_MSG);\n\n/* declare the base of the netgraph sysclt hierarchy */\n/* but only if this file cares about sysctls */\n#ifdef\tSYSCTL_DECL\nSYSCTL_DECL(_net_graph);\n#endif\n\n/*\n * Methods that the nodes can use.\n * Many of these methods should usually NOT be used directly but via\n * Macros above.\n */\nint\tng_address_ID(node_p here, item_p item, ng_ID_t ID, ng_ID_t retaddr);\nint\tng_address_hook(node_p here, item_p item, hook_p hook, ng_ID_t retaddr);\nint\tng_address_path(node_p here, item_p item, char *address, ng_ID_t raddr);\nint\tng_bypass(hook_p hook1, hook_p hook2);\nhook_p\tng_findhook(node_p node, const char *name);\nstruct\tng_type *ng_findtype(const char *type);\nint\tng_make_node_common(struct ng_type *typep, node_p *nodep);\nint\tng_name_node(node_p node, const char *name);\nnode_p\tng_name2noderef(node_p node, const char *name);\nint\tng_newtype(struct ng_type *tp);\nng_ID_t ng_node2ID(node_p node);\nitem_p\tng_package_data(struct mbuf *m, int flags);\nitem_p\tng_package_msg(struct ng_mesg *msg, int flags);\nitem_p\tng_package_msg_self(node_p here, hook_p hook, struct ng_mesg *msg);\nvoid\tng_replace_retaddr(node_p here, item_p item, ng_ID_t retaddr);\nint\tng_rmhook_self(hook_p hook);\t/* if a node wants to kill a hook */\nint\tng_rmnode_self(node_p here);\t/* if a node wants to suicide */\nint\tng_rmtype(struct ng_type *tp);\nint\tng_snd_item(item_p item, int queue);\nint \tng_send_fn(node_p node, hook_p hook, ng_item_fn *fn, void *arg1,\n\tint arg2);\nint \tng_send_fn1(node_p node, hook_p hook, ng_item_fn *fn, void *arg1,\n\tint arg2, int flags);\nint \tng_send_fn2(node_p node, hook_p hook, item_p pitem, ng_item_fn2 *fn,\n\tvoid *arg1, int arg2, int flags);\nint\tng_uncallout(struct callout *c, node_p node);\nint\tng_callout(struct callout *c, node_p node, hook_p hook, int ticks,\n\t    ng_item_fn *fn, void * arg1, int arg2);\n#define\tng_callout_init(c)\tcallout_init(c, CALLOUT_MPSAFE)\n\n/* Flags for netgraph functions. */\n#define\tNG_NOFLAGS\t0x00000000\t/* no special options */\n#define\tNG_QUEUE\t0x00000001\t/* enqueue item, don't dispatch */\n#define\tNG_WAITOK\t0x00000002\t/* use M_WAITOK, etc. */\n/* XXXGL: NG_PROGRESS unused since ng_base.c rev. 1.136. Should be deleted? */\n#define\tNG_PROGRESS\t0x00000004\t/* return EINPROGRESS if queued */\n#define\tNG_REUSE_ITEM\t0x00000008\t/* supplied item should be reused */\n\n/*\n * prototypes the user should DEFINITELY not use directly\n */\nvoid\tng_free_item(item_p item); /* Use NG_FREE_ITEM instead */\nint\tng_mod_event(module_t mod, int what, void *arg);\n\n/*\n * Tag definitions and constants\n */\n\n#define\tNG_TAG_PRIO\t1\n\nstruct ng_tag_prio {\n\tstruct m_tag\ttag;\n\tchar\tpriority;\n\tchar\tdiscardability;\n};\n\n#define\tNG_PRIO_CUTOFF\t\t32\n#define\tNG_PRIO_LINKSTATE\t64\n\n/* Macros and declarations to keep compatibility with metadata, which\n * is obsoleted now. To be deleted.\n */\ntypedef void *meta_p;\n#define _NGI_META(i)\tNULL\n#define NGI_META(i)\tNULL\n#define NG_FREE_META(meta)\n#define NGI_GET_META(i,m)\n#define\tng_copy_meta(meta) NULL\n\n/* Hash related definitions */\n#define\tNG_ID_HASH_SIZE 128 /* most systems wont need even this many */\n#define\tNG_NAME_HASH_SIZE 128 /* most systems wont need even this many */\n\n/*\n * Mark the current thread when called from the outbound path of the\n * network stack, in order to enforce queuing on ng nodes calling into\n * the inbound network stack path.\n */\n#define NG_OUTBOUND_THREAD_REF()\t\t\t\t\t\\\n\tcurthread->td_ng_outbound++\n#define NG_OUTBOUND_THREAD_UNREF()\t\t\t\t\t\\\n\tdo {\t\t\t\t\t\t\t\t\\\n\t\tcurthread->td_ng_outbound--;\t\t\t\t\\\n\t\tKASSERT(curthread->td_ng_outbound >= 0,\t\t\t\\\n\t\t    (\"%s: negative td_ng_outbound\", __func__));\t\t\\\n\t} while (0)\n\n#endif /* _NETGRAPH_NETGRAPH_H_ */\n"
  },
  {
    "path": "freebsd-headers/netgraph/ng_UI.h",
    "content": "/*\n * ng_UI.h\n */\n\n/*-\n * Copyright (c) 1996-1999 Whistle Communications, Inc.\n * All rights reserved.\n * \n * Subject to the following obligations and disclaimer of warranty, use and\n * redistribution of this software, in source or object code forms, with or\n * without modifications are expressly permitted by Whistle Communications;\n * provided, however, that:\n * 1. Any and all reproductions of the source or object code must include the\n *    copyright notice above and the following disclaimer of warranties; and\n * 2. No rights are granted, in any manner or form, to use Whistle\n *    Communications, Inc. trademarks, including the mark \"WHISTLE\n *    COMMUNICATIONS\" on advertising, endorsements, or otherwise except as\n *    such appears in the above copyright notice or in the software.\n * \n * THIS SOFTWARE IS BEING PROVIDED BY WHISTLE COMMUNICATIONS \"AS IS\", AND\n * TO THE MAXIMUM EXTENT PERMITTED BY LAW, WHISTLE COMMUNICATIONS MAKES NO\n * REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, REGARDING THIS SOFTWARE,\n * INCLUDING WITHOUT LIMITATION, ANY AND ALL IMPLIED WARRANTIES OF\n * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT.\n * WHISTLE COMMUNICATIONS DOES NOT WARRANT, GUARANTEE, OR MAKE ANY\n * REPRESENTATIONS REGARDING THE USE OF, OR THE RESULTS OF THE USE OF THIS\n * SOFTWARE IN TERMS OF ITS CORRECTNESS, ACCURACY, RELIABILITY OR OTHERWISE.\n * IN NO EVENT SHALL WHISTLE COMMUNICATIONS BE LIABLE FOR ANY DAMAGES\n * RESULTING FROM OR ARISING OUT OF ANY USE OF THIS SOFTWARE, INCLUDING\n * WITHOUT LIMITATION, ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,\n * PUNITIVE, OR CONSEQUENTIAL DAMAGES, PROCUREMENT OF SUBSTITUTE GOODS OR\n * SERVICES, LOSS OF USE, DATA OR PROFITS, HOWEVER CAUSED AND UNDER ANY\n * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF\n * THIS SOFTWARE, EVEN IF WHISTLE COMMUNICATIONS IS ADVISED OF THE POSSIBILITY\n * OF SUCH DAMAGE.\n *\n * Author: Julian Elischer <julian@freebsd.org>\n *\n * $FreeBSD: release/9.0.0/sys/netgraph/ng_UI.h 139823 2005-01-07 01:45:51Z imp $\n * $Whistle: ng_UI.h,v 1.6 1999/01/20 00:54:15 archie Exp $\n */\n\n#ifndef _NETGRAPH_NG_UI_H_\n#define _NETGRAPH_NG_UI_H_\n\n/* Node type name and cookie */\n#define NG_UI_NODE_TYPE\t\t\"UI\"\n#define NGM_UI_COOKIE\t\t884639499\n\n/* Hook names */\n#define NG_UI_HOOK_DOWNSTREAM\t\"downstream\"\n#define NG_UI_HOOK_UPSTREAM\t\"upstream\"\n\n#endif /* _NETGRAPH_NG_UI_H_ */\n\n"
  },
  {
    "path": "freebsd-headers/netgraph/ng_async.h",
    "content": "/*\n * ng_async.h\n */\n\n/*-\n * Copyright (c) 1996-1999 Whistle Communications, Inc.\n * All rights reserved.\n * \n * Subject to the following obligations and disclaimer of warranty, use and\n * redistribution of this software, in source or object code forms, with or\n * without modifications are expressly permitted by Whistle Communications;\n * provided, however, that:\n * 1. Any and all reproductions of the source or object code must include the\n *    copyright notice above and the following disclaimer of warranties; and\n * 2. No rights are granted, in any manner or form, to use Whistle\n *    Communications, Inc. trademarks, including the mark \"WHISTLE\n *    COMMUNICATIONS\" on advertising, endorsements, or otherwise except as\n *    such appears in the above copyright notice or in the software.\n * \n * THIS SOFTWARE IS BEING PROVIDED BY WHISTLE COMMUNICATIONS \"AS IS\", AND\n * TO THE MAXIMUM EXTENT PERMITTED BY LAW, WHISTLE COMMUNICATIONS MAKES NO\n * REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, REGARDING THIS SOFTWARE,\n * INCLUDING WITHOUT LIMITATION, ANY AND ALL IMPLIED WARRANTIES OF\n * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT.\n * WHISTLE COMMUNICATIONS DOES NOT WARRANT, GUARANTEE, OR MAKE ANY\n * REPRESENTATIONS REGARDING THE USE OF, OR THE RESULTS OF THE USE OF THIS\n * SOFTWARE IN TERMS OF ITS CORRECTNESS, ACCURACY, RELIABILITY OR OTHERWISE.\n * IN NO EVENT SHALL WHISTLE COMMUNICATIONS BE LIABLE FOR ANY DAMAGES\n * RESULTING FROM OR ARISING OUT OF ANY USE OF THIS SOFTWARE, INCLUDING\n * WITHOUT LIMITATION, ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,\n * PUNITIVE, OR CONSEQUENTIAL DAMAGES, PROCUREMENT OF SUBSTITUTE GOODS OR\n * SERVICES, LOSS OF USE, DATA OR PROFITS, HOWEVER CAUSED AND UNDER ANY\n * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF\n * THIS SOFTWARE, EVEN IF WHISTLE COMMUNICATIONS IS ADVISED OF THE POSSIBILITY\n * OF SUCH DAMAGE.\n *\n * Author: Archie Cobbs <archie@freebsd.org>\n *\n * $FreeBSD: release/9.0.0/sys/netgraph/ng_async.h 139823 2005-01-07 01:45:51Z imp $\n * $Whistle: ng_async.h,v 1.5 1999/01/25 01:17:14 archie Exp $\n */\n\n#ifndef _NETGRAPH_NG_ASYNC_H_\n#define _NETGRAPH_NG_ASYNC_H_\n\n/* Type name and cookie */\n#define NG_ASYNC_NODE_TYPE\t\"async\"\n#define NGM_ASYNC_COOKIE\t886473717\n\n/* Hook names */\n#define NG_ASYNC_HOOK_SYNC\t\"sync\"\t/* Sync frames */\n#define NG_ASYNC_HOOK_ASYNC\t\"async\"\t/* Async-encoded frames */\n\n/* Maximum receive size bounds (for both sync and async sides) */\n#define NG_ASYNC_MIN_MRU\t1\n#define NG_ASYNC_MAX_MRU\t8192\n#define NG_ASYNC_DEFAULT_MRU\t1600\n\n/* Frame statistics */\nstruct ng_async_stat {\n\tu_int32_t\tsyncOctets;\n\tu_int32_t\tsyncFrames;\n\tu_int32_t\tsyncOverflows;\n\tu_int32_t\tasyncOctets;\n\tu_int32_t\tasyncFrames;\n\tu_int32_t\tasyncRunts;\n\tu_int32_t\tasyncOverflows;\n\tu_int32_t\tasyncBadCheckSums;\n};\n\n/* Keep this in sync with the above structure definition */\n#define NG_ASYNC_STATS_TYPE_INFO\t{\t\t\t\\\n\t  { \"syncOctets\",\t&ng_parse_uint32_type\t},\t\\\n\t  { \"syncFrames\",\t&ng_parse_uint32_type\t},\t\\\n\t  { \"syncOverflows\",\t&ng_parse_uint32_type\t},\t\\\n\t  { \"asyncOctets\",\t&ng_parse_uint32_type\t},\t\\\n\t  { \"asyncFrames\",\t&ng_parse_uint32_type\t},\t\\\n\t  { \"asyncRunts\",\t&ng_parse_uint32_type\t},\t\\\n\t  { \"asyncOverflows\",\t&ng_parse_uint32_type\t},\t\\\n\t  { \"asyncBadCheckSums\",&ng_parse_uint32_type\t},\t\\\n\t  { NULL }\t\t\t\t\t\t\\\n}\n\n/* Configuration for this node */\nstruct ng_async_cfg {\n\tu_char\t\tenabled;\t/* Turn encoding on/off */\n\tu_int16_t\tamru;\t\t/* Max receive async frame length */\n\tu_int16_t\tsmru;\t\t/* Max receive sync frame length */\n\tu_int32_t\taccm;\t\t/* ACCM encoding */\n};\n\n/* Keep this in sync with the above structure definition */\n#define NG_ASYNC_CONFIG_TYPE_INFO\t{\t\t\t\\\n\t  { \"enabled\",\t\t&ng_parse_int8_type\t},\t\\\n\t  { \"amru\",\t\t&ng_parse_uint16_type\t},\t\\\n\t  { \"smru\",\t\t&ng_parse_uint16_type\t},\t\\\n\t  { \"accm\",\t\t&ng_parse_hint32_type\t},\t\\\n\t  { NULL }\t\t\t\t\t\t\\\n}\n\n/* Commands */\nenum {\n\tNGM_ASYNC_CMD_GET_STATS = 1,\t/* returns struct ng_async_stat */\n\tNGM_ASYNC_CMD_CLR_STATS,\n\tNGM_ASYNC_CMD_SET_CONFIG,\t/* takes struct ng_async_cfg */\n\tNGM_ASYNC_CMD_GET_CONFIG,\t/* returns struct ng_async_cfg */\n};\n\n#endif /* _NETGRAPH_NG_ASYNC_H_ */\n"
  },
  {
    "path": "freebsd-headers/netgraph/ng_atmllc.h",
    "content": "/*-\n * Copyright (c) 2003-2004 Benno Rice <benno@FreeBSD.org>\n * All Rights Reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR  ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR  BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/netgraph/ng_atmllc.h 139823 2005-01-07 01:45:51Z imp $\n */\n\n#ifndef\t_NETGRAPH_ATMLLC_H_\n#define\t_NETGRAPH_ATMLLC_H_\n\n/* Node type name and magic cookie. */\n#define\tNG_ATMLLC_NODE_TYPE\t\"atmllc\"\n#define\tNGM_ATMLLC_COOKIE\t1065246274\n\n/* Hook names. */\n#define\tNG_ATMLLC_HOOK_ATM\t\"atm\"\n#define\tNG_ATMLLC_HOOK_ETHER\t\"ether\"\n#define\tNG_ATMLLC_HOOK_802_4\t\"ieee8024\"\n#define\tNG_ATMLLC_HOOK_802_5\t\"ieee8025\"\n#define\tNG_ATMLLC_HOOK_802_6\t\"ieee8026\"\n#define\tNG_ATMLLC_HOOK_FDDI\t\"fddi\"\n#define\tNG_ATMLLC_HOOK_BPDU\t\"bpdu\"\n\n#endif /* _NETGRAPH_ATMLLC_H_ */\n"
  },
  {
    "path": "freebsd-headers/netgraph/ng_bpf.h",
    "content": "/*\n * ng_bpf.h\n */\n\n/*-\n * Copyright (c) 1996-1999 Whistle Communications, Inc.\n * All rights reserved.\n * \n * Subject to the following obligations and disclaimer of warranty, use and\n * redistribution of this software, in source or object code forms, with or\n * without modifications are expressly permitted by Whistle Communications;\n * provided, however, that:\n * 1. Any and all reproductions of the source or object code must include the\n *    copyright notice above and the following disclaimer of warranties; and\n * 2. No rights are granted, in any manner or form, to use Whistle\n *    Communications, Inc. trademarks, including the mark \"WHISTLE\n *    COMMUNICATIONS\" on advertising, endorsements, or otherwise except as\n *    such appears in the above copyright notice or in the software.\n * \n * THIS SOFTWARE IS BEING PROVIDED BY WHISTLE COMMUNICATIONS \"AS IS\", AND\n * TO THE MAXIMUM EXTENT PERMITTED BY LAW, WHISTLE COMMUNICATIONS MAKES NO\n * REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, REGARDING THIS SOFTWARE,\n * INCLUDING WITHOUT LIMITATION, ANY AND ALL IMPLIED WARRANTIES OF\n * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT.\n * WHISTLE COMMUNICATIONS DOES NOT WARRANT, GUARANTEE, OR MAKE ANY\n * REPRESENTATIONS REGARDING THE USE OF, OR THE RESULTS OF THE USE OF THIS\n * SOFTWARE IN TERMS OF ITS CORRECTNESS, ACCURACY, RELIABILITY OR OTHERWISE.\n * IN NO EVENT SHALL WHISTLE COMMUNICATIONS BE LIABLE FOR ANY DAMAGES\n * RESULTING FROM OR ARISING OUT OF ANY USE OF THIS SOFTWARE, INCLUDING\n * WITHOUT LIMITATION, ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,\n * PUNITIVE, OR CONSEQUENTIAL DAMAGES, PROCUREMENT OF SUBSTITUTE GOODS OR\n * SERVICES, LOSS OF USE, DATA OR PROFITS, HOWEVER CAUSED AND UNDER ANY\n * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF\n * THIS SOFTWARE, EVEN IF WHISTLE COMMUNICATIONS IS ADVISED OF THE POSSIBILITY\n * OF SUCH DAMAGE.\n *\n * Author: Archie Cobbs <archie@freebsd.org>\n *\n * $FreeBSD: release/9.0.0/sys/netgraph/ng_bpf.h 141751 2005-02-12 18:10:26Z ru $\n * $Whistle: ng_bpf.h,v 1.3 1999/12/03 20:30:23 archie Exp $\n */\n\n#ifndef _NETGRAPH_NG_BPF_H_\n#define _NETGRAPH_NG_BPF_H_\n\n/* Node type name and magic cookie */\n#define NG_BPF_NODE_TYPE\t\"bpf\"\n#define NGM_BPF_COOKIE\t\t944100792\n\n/* Program structure for one hook */\nstruct ng_bpf_hookprog {\n\tchar\t\tthisHook[NG_HOOKSIZ];\t\t/* name of hook */\n\tchar\t\tifMatch[NG_HOOKSIZ];\t\t/* match dest hook */\n\tchar\t\tifNotMatch[NG_HOOKSIZ];\t\t/* !match dest hook */\n\tint32_t\t\tbpf_prog_len;\t\t\t/* #insns in program */\n\tstruct bpf_insn\tbpf_prog[];\t\t\t/* bpf program */\n};\n\n#define NG_BPF_HOOKPROG_SIZE(numInsn)\t\\\n\t(sizeof(struct ng_bpf_hookprog) + (numInsn) * sizeof(struct bpf_insn))\n\n/* Keep this in sync with the above structure definition */\n#define NG_BPF_HOOKPROG_TYPE_INFO(bptype)\t{\t\t\\\n\t  { \"thisHook\",\t\t&ng_parse_hookbuf_type\t},\t\\\n\t  { \"ifMatch\",\t\t&ng_parse_hookbuf_type\t},\t\\\n\t  { \"ifNotMatch\",\t&ng_parse_hookbuf_type\t},\t\\\n\t  { \"bpf_prog_len\",\t&ng_parse_int32_type\t},\t\\\n\t  { \"bpf_prog\",\t\t(bptype)\t\t},\t\\\n\t  { NULL }\t\t\t\t\t\t\\\n}\n\n/* Statistics structure for one hook */\nstruct ng_bpf_hookstat {\n\tu_int64_t\trecvFrames;\n\tu_int64_t\trecvOctets;\n\tu_int64_t\trecvMatchFrames;\n\tu_int64_t\trecvMatchOctets;\n\tu_int64_t\txmitFrames;\n\tu_int64_t\txmitOctets;\n};\n\n/* Keep this in sync with the above structure definition */\n#define NG_BPF_HOOKSTAT_TYPE_INFO\t{\t\t\t\\\n\t  { \"recvFrames\",\t&ng_parse_uint64_type\t},\t\\\n\t  { \"recvOctets\",\t&ng_parse_uint64_type\t},\t\\\n\t  { \"recvMatchFrames\",\t&ng_parse_uint64_type\t},\t\\\n\t  { \"recvMatchOctets\",\t&ng_parse_uint64_type\t},\t\\\n\t  { \"xmitFrames\",\t&ng_parse_uint64_type\t},\t\\\n\t  { \"xmitOctets\",\t&ng_parse_uint64_type\t},\t\\\n\t  { NULL }\t\t\t\t\t\t\\\n}\n\n/* Netgraph commands */\nenum {\n\tNGM_BPF_SET_PROGRAM = 1,\t/* supply a struct ng_bpf_hookprog */\n\tNGM_BPF_GET_PROGRAM,\t\t/* returns a struct ng_bpf_hookprog */\n\tNGM_BPF_GET_STATS,\t\t/* supply name as char[NG_HOOKSIZ] */\n\tNGM_BPF_CLR_STATS,\t\t/* supply name as char[NG_HOOKSIZ] */\n\tNGM_BPF_GETCLR_STATS,\t\t/* supply name as char[NG_HOOKSIZ] */\n};\n\n#endif /* _NETGRAPH_NG_BPF_H_ */\n"
  },
  {
    "path": "freebsd-headers/netgraph/ng_bridge.h",
    "content": "/*\n * ng_bridge.h\n */\n\n/*-\n * Copyright (c) 2000 Whistle Communications, Inc.\n * All rights reserved.\n * \n * Subject to the following obligations and disclaimer of warranty, use and\n * redistribution of this software, in source or object code forms, with or\n * without modifications are expressly permitted by Whistle Communications;\n * provided, however, that:\n * 1. Any and all reproductions of the source or object code must include the\n *    copyright notice above and the following disclaimer of warranties; and\n * 2. No rights are granted, in any manner or form, to use Whistle\n *    Communications, Inc. trademarks, including the mark \"WHISTLE\n *    COMMUNICATIONS\" on advertising, endorsements, or otherwise except as\n *    such appears in the above copyright notice or in the software.\n * \n * THIS SOFTWARE IS BEING PROVIDED BY WHISTLE COMMUNICATIONS \"AS IS\", AND\n * TO THE MAXIMUM EXTENT PERMITTED BY LAW, WHISTLE COMMUNICATIONS MAKES NO\n * REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, REGARDING THIS SOFTWARE,\n * INCLUDING WITHOUT LIMITATION, ANY AND ALL IMPLIED WARRANTIES OF\n * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT.\n * WHISTLE COMMUNICATIONS DOES NOT WARRANT, GUARANTEE, OR MAKE ANY\n * REPRESENTATIONS REGARDING THE USE OF, OR THE RESULTS OF THE USE OF THIS\n * SOFTWARE IN TERMS OF ITS CORRECTNESS, ACCURACY, RELIABILITY OR OTHERWISE.\n * IN NO EVENT SHALL WHISTLE COMMUNICATIONS BE LIABLE FOR ANY DAMAGES\n * RESULTING FROM OR ARISING OUT OF ANY USE OF THIS SOFTWARE, INCLUDING\n * WITHOUT LIMITATION, ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,\n * PUNITIVE, OR CONSEQUENTIAL DAMAGES, PROCUREMENT OF SUBSTITUTE GOODS OR\n * SERVICES, LOSS OF USE, DATA OR PROFITS, HOWEVER CAUSED AND UNDER ANY\n * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF\n * THIS SOFTWARE, EVEN IF WHISTLE COMMUNICATIONS IS ADVISED OF THE POSSIBILITY\n * OF SUCH DAMAGE.\n *\n * Author: Archie Cobbs <archie@freebsd.org>\n *\n * $FreeBSD: release/9.0.0/sys/netgraph/ng_bridge.h 207680 2010-05-05 22:06:05Z zec $\n */\n\n#ifndef _NETGRAPH_NG_BRIDGE_H_\n#define _NETGRAPH_NG_BRIDGE_H_\n\n/* Node type name and magic cookie */\n#define NG_BRIDGE_NODE_TYPE\t\t\"bridge\"\n#define NGM_BRIDGE_COOKIE\t\t967239368\n\n/* Hook names */\n#define NG_BRIDGE_HOOK_LINK_PREFIX\t\"link\"\t /* append decimal integer */\n#define NG_BRIDGE_HOOK_LINK_FMT\t\t\"link%d\" /* for use with printf(3) */\n\n/* Maximum number of supported links */\n#define NG_BRIDGE_MAX_LINKS\t\t32\n\n/* Node configuration structure */\nstruct ng_bridge_config {\n\tu_char\t\tipfw[NG_BRIDGE_MAX_LINKS]; \t/* enable ipfw */\n\tu_char\t\tdebugLevel;\t\t/* debug level */\n\tu_int32_t\tloopTimeout;\t\t/* link loopback mute time */\n\tu_int32_t\tmaxStaleness;\t\t/* max host age before nuking */\n\tu_int32_t\tminStableAge;\t\t/* min time for a stable host */\n};\n\n/* Keep this in sync with the above structure definition */\n#define NG_BRIDGE_CONFIG_TYPE_INFO(ainfo)\t{\t\t\\\n\t  { \"ipfw\",\t\t(ainfo)\t\t\t},\t\\\n\t  { \"debugLevel\",\t&ng_parse_uint8_type\t},\t\\\n\t  { \"loopTimeout\",\t&ng_parse_uint32_type\t},\t\\\n\t  { \"maxStaleness\",\t&ng_parse_uint32_type\t},\t\\\n\t  { \"minStableAge\",\t&ng_parse_uint32_type\t},\t\\\n\t  { NULL }\t\t\t\t\t\t\\\n}\n\n/* Statistics structure (one for each link) */\nstruct ng_bridge_link_stats {\n\tu_int64_t\trecvOctets;\t/* total octets rec'd on link */\n\tu_int64_t\trecvPackets;\t/* total pkts rec'd on link */\n\tu_int64_t\trecvMulticasts;\t/* multicast pkts rec'd on link */\n\tu_int64_t\trecvBroadcasts;\t/* broadcast pkts rec'd on link */\n\tu_int64_t\trecvUnknown;\t/* pkts rec'd with unknown dest addr */\n\tu_int64_t\trecvRunts;\t/* pkts rec'd less than 14 bytes */\n\tu_int64_t\trecvInvalid;\t/* pkts rec'd with bogus source addr */\n\tu_int64_t\txmitOctets;\t/* total octets xmit'd on link */\n\tu_int64_t\txmitPackets;\t/* total pkts xmit'd on link */\n\tu_int64_t\txmitMulticasts;\t/* multicast pkts xmit'd on link */\n\tu_int64_t\txmitBroadcasts;\t/* broadcast pkts xmit'd on link */\n\tu_int64_t\tloopDrops;\t/* pkts dropped due to loopback */\n\tu_int64_t\tloopDetects;\t/* number of loop detections */\n\tu_int64_t\tmemoryFailures;\t/* times couldn't get mem or mbuf */\n};\n\n/* Keep this in sync with the above structure definition */\n#define NG_BRIDGE_STATS_TYPE_INFO\t{\t\t\t\\\n\t  { \"recvOctets\",\t&ng_parse_uint64_type\t},\t\\\n\t  { \"recvPackets\",\t&ng_parse_uint64_type\t},\t\\\n\t  { \"recvMulticast\",\t&ng_parse_uint64_type\t},\t\\\n\t  { \"recvBroadcast\",\t&ng_parse_uint64_type\t},\t\\\n\t  { \"recvUnknown\",\t&ng_parse_uint64_type\t},\t\\\n\t  { \"recvRunts\",\t&ng_parse_uint64_type\t},\t\\\n\t  { \"recvInvalid\",\t&ng_parse_uint64_type\t},\t\\\n\t  { \"xmitOctets\",\t&ng_parse_uint64_type\t},\t\\\n\t  { \"xmitPackets\",\t&ng_parse_uint64_type\t},\t\\\n\t  { \"xmitMulticasts\",\t&ng_parse_uint64_type\t},\t\\\n\t  { \"xmitBroadcasts\",\t&ng_parse_uint64_type\t},\t\\\n\t  { \"loopDrops\",\t&ng_parse_uint64_type\t},\t\\\n\t  { \"loopDetects\",\t&ng_parse_uint64_type\t},\t\\\n\t  { \"memoryFailures\",\t&ng_parse_uint64_type\t},\t\\\n\t  { NULL }\t\t\t\t\t\t\\\n}\n\n/* Structure describing a single host */\nstruct ng_bridge_host {\n\tu_char\t\taddr[6];\t/* ethernet address */\n\tu_int16_t\tlinkNum;\t/* link where addr can be found */\n\tu_int16_t\tage;\t\t/* seconds ago entry was created */\n\tu_int16_t\tstaleness;\t/* seconds ago host last heard from */\n};\n\n/* Keep this in sync with the above structure definition */\n#define NG_BRIDGE_HOST_TYPE_INFO(entype)\t{\t\t\\\n\t  { \"addr\",\t\t(entype)\t\t},\t\\\n\t  { \"linkNum\",\t\t&ng_parse_uint16_type\t},\t\\\n\t  { \"age\",\t\t&ng_parse_uint16_type\t},\t\\\n\t  { \"staleness\",\t&ng_parse_uint16_type\t},\t\\\n\t  { NULL }\t\t\t\t\t\t\\\n}\n\n/* Structure returned by NGM_BRIDGE_GET_TABLE */\nstruct ng_bridge_host_ary {\n\tu_int32_t\t\tnumHosts;\n\tstruct ng_bridge_host\thosts[];\n};\n\n/* Keep this in sync with the above structure definition */\n#define NG_BRIDGE_HOST_ARY_TYPE_INFO(harytype)\t{\t\t\\\n\t  { \"numHosts\",\t\t&ng_parse_uint32_type\t},\t\\\n\t  { \"hosts\",\t\t(harytype)\t\t},\t\\\n\t  { NULL }\t\t\t\t\t\t\\\n}\n\n/* Netgraph control messages */\nenum {\n\tNGM_BRIDGE_SET_CONFIG = 1,\t/* set node configuration */\n\tNGM_BRIDGE_GET_CONFIG,\t\t/* get node configuration */\n\tNGM_BRIDGE_RESET,\t\t/* reset (forget) all information */\n\tNGM_BRIDGE_GET_STATS,\t\t/* get link stats */\n\tNGM_BRIDGE_CLR_STATS,\t\t/* clear link stats */\n\tNGM_BRIDGE_GETCLR_STATS,\t/* atomically get & clear link stats */\n\tNGM_BRIDGE_GET_TABLE,\t\t/* get link table */\n\tNGM_BRIDGE_SET_PERSISTENT,\t/* set persistent mode */\n};\n\n#endif /* _NETGRAPH_NG_BRIDGE_H_ */\n\n"
  },
  {
    "path": "freebsd-headers/netgraph/ng_car.h",
    "content": "/*-\n * Copyright (c) 2005 Nuno Antunes <nuno.antunes@gmail.com>\n * Copyright (c) 2007 Alexander Motin <mav@freebsd.org>\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/netgraph/ng_car.h 174795 2007-12-19 22:50:14Z mav $\n */\n\n#ifndef _NETGRAPH_NG_CAR_H_\n#define _NETGRAPH_NG_CAR_H_\n\n#define NG_CAR_NODE_TYPE\t\"car\"\n#define NGM_CAR_COOKIE\t\t1173648034\n\n/* Hook names */\n#define NG_CAR_HOOK_UPPER\t\"upper\"\n#define NG_CAR_HOOK_LOWER\t\"lower\"\n\n/* Per hook statistics counters */\nstruct ng_car_hookstats {\n\tu_int64_t passed_pkts;\t/* Counter for passed packets */\n\tu_int64_t droped_pkts;\t/* Counter for droped packets */\n\tu_int64_t green_pkts;\t/* Counter for green packets */\n\tu_int64_t yellow_pkts;\t/* Counter for yellow packets */\n\tu_int64_t red_pkts;\t/* Counter for red packets */\n\tu_int64_t errors;\t/* Counter for operation errors */\n};\n#define NG_CAR_HOOKSTATS\t{\t\t\t\t\\\n\t  { \"passed\",\t\t&ng_parse_uint64_type\t},\t\\\n\t  { \"droped\",\t\t&ng_parse_uint64_type\t},\t\\\n\t  { \"green\",\t\t&ng_parse_uint64_type\t},\t\\\n\t  { \"yellow\",\t\t&ng_parse_uint64_type\t},\t\\\n\t  { \"red\",\t\t&ng_parse_uint64_type\t},\t\\\n\t  { \"errors\",\t\t&ng_parse_uint64_type\t},\t\\\n\t  { NULL }\t\t\t\t\t\t\\\n}\n\n/* Bulk statistics */\nstruct ng_car_bulkstats {\n\tstruct ng_car_hookstats upstream;\n\tstruct ng_car_hookstats downstream;\n};\n#define NG_CAR_BULKSTATS(hstatstype) {\t\t\t\t\\\n\t  { \"upstream\",\t\t(hstatstype)\t\t},\t\\\n\t  { \"downstream\",\t(hstatstype)\t\t},\t\\\n\t  { NULL }\t\t\t\t\t\t\\\n}\n\n/* Per hook configuration */\nstruct ng_car_hookconf {\n\tu_int64_t cbs;\t\t/* Commited burst size (bytes) */\n\tu_int64_t ebs;\t\t/* Exceeded/Peak burst size (bytes) */\n\tu_int64_t cir;\t\t/* Commited information rate (bits/s) */\n\tu_int64_t pir;\t\t/* Peak information rate (bits/s) */\n\tu_int8_t green_action;\t/* Action for green packets */\n\tu_int8_t yellow_action;\t/* Action for yellow packets */\n\tu_int8_t red_action;\t/* Action for red packets */\n\tu_int8_t mode;\t\t/* single/double rate, ... */\n\tu_int8_t opt;\t\t/* color-aware or color-blind */\n};\n/* Keep this definition in sync with the above structure */\n#define NG_CAR_HOOKCONF\t{\t\t\t\t\t\\\n\t  { \"cbs\",\t\t&ng_parse_uint64_type\t},\t\\\n\t  { \"ebs\",\t\t&ng_parse_uint64_type\t},\t\\\n\t  { \"cir\",\t\t&ng_parse_uint64_type\t},\t\\\n\t  { \"pir\",\t\t&ng_parse_uint64_type\t},\t\\\n\t  { \"greenAction\",\t&ng_parse_uint8_type\t},\t\\\n\t  { \"yellowAction\",\t&ng_parse_uint8_type\t},\t\\\n\t  { \"redAction\",\t&ng_parse_uint8_type\t},\t\\\n\t  { \"mode\",\t\t&ng_parse_uint8_type\t},\t\\\n\t  { \"opt\",\t\t&ng_parse_uint8_type\t},\t\\\n\t  { NULL }\t\t\t\t\t\t\\\n}\n\n#define NG_CAR_CBS_MIN\t\t8192\n#define NG_CAR_EBS_MIN\t\t8192\n#define NG_CAR_CIR_DFLT\t\t10240\n\n/* possible actions (...Action) */\nenum {\n    NG_CAR_ACTION_FORWARD = 1,\n    NG_CAR_ACTION_DROP,\n    NG_CAR_ACTION_MARK,\n    NG_CAR_ACTION_SET_TOS\n};\n\n/* operation modes (mode) */\nenum {\n    NG_CAR_SINGLE_RATE = 0,\n    NG_CAR_DOUBLE_RATE,\n    NG_CAR_RED,\n    NG_CAR_SHAPE\n};\n\n/* mode options (opt) */\n#define NG_CAR_COLOR_AWARE\t1\n#define NG_CAR_COUNT_PACKETS\t2\n\n/* Bulk config */\nstruct ng_car_bulkconf {\n\tstruct ng_car_hookconf upstream;\n\tstruct ng_car_hookconf downstream;\n};\n#define NG_CAR_BULKCONF(hconftype) {\t\t\t\t\\\n\t  { \"upstream\",\t\t(hconftype)\t\t},\t\\\n\t  { \"downstream\",\t(hconftype)\t\t},\t\\\n\t  { NULL }\t\t\t\t\t\t\\\n}\n\n/* Commands */\nenum {\n\tNGM_CAR_GET_STATS = 1,\t\t/* Get statistics */\n\tNGM_CAR_CLR_STATS,\t\t/* Clear statistics */\n\tNGM_CAR_GETCLR_STATS,\t\t/* Get and clear statistics */\n\tNGM_CAR_GET_CONF,\t\t/* Get bulk configuration */\n\tNGM_CAR_SET_CONF,\t\t/* Set bulk configuration */\n};\n\n#endif /* _NETGRAPH_NG_CAR_H_ */\n"
  },
  {
    "path": "freebsd-headers/netgraph/ng_cisco.h",
    "content": "/*\n * ng_cisco.h\n */\n\n/*-\n * Copyright (c) 1996-1999 Whistle Communications, Inc.\n * All rights reserved.\n * \n * Subject to the following obligations and disclaimer of warranty, use and\n * redistribution of this software, in source or object code forms, with or\n * without modifications are expressly permitted by Whistle Communications;\n * provided, however, that:\n * 1. Any and all reproductions of the source or object code must include the\n *    copyright notice above and the following disclaimer of warranties; and\n * 2. No rights are granted, in any manner or form, to use Whistle\n *    Communications, Inc. trademarks, including the mark \"WHISTLE\n *    COMMUNICATIONS\" on advertising, endorsements, or otherwise except as\n *    such appears in the above copyright notice or in the software.\n * \n * THIS SOFTWARE IS BEING PROVIDED BY WHISTLE COMMUNICATIONS \"AS IS\", AND\n * TO THE MAXIMUM EXTENT PERMITTED BY LAW, WHISTLE COMMUNICATIONS MAKES NO\n * REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, REGARDING THIS SOFTWARE,\n * INCLUDING WITHOUT LIMITATION, ANY AND ALL IMPLIED WARRANTIES OF\n * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT.\n * WHISTLE COMMUNICATIONS DOES NOT WARRANT, GUARANTEE, OR MAKE ANY\n * REPRESENTATIONS REGARDING THE USE OF, OR THE RESULTS OF THE USE OF THIS\n * SOFTWARE IN TERMS OF ITS CORRECTNESS, ACCURACY, RELIABILITY OR OTHERWISE.\n * IN NO EVENT SHALL WHISTLE COMMUNICATIONS BE LIABLE FOR ANY DAMAGES\n * RESULTING FROM OR ARISING OUT OF ANY USE OF THIS SOFTWARE, INCLUDING\n * WITHOUT LIMITATION, ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,\n * PUNITIVE, OR CONSEQUENTIAL DAMAGES, PROCUREMENT OF SUBSTITUTE GOODS OR\n * SERVICES, LOSS OF USE, DATA OR PROFITS, HOWEVER CAUSED AND UNDER ANY\n * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF\n * THIS SOFTWARE, EVEN IF WHISTLE COMMUNICATIONS IS ADVISED OF THE POSSIBILITY\n * OF SUCH DAMAGE.\n *\n * Author: Archie Cobbs <archie@freebsd.org>\n *\n * $FreeBSD: release/9.0.0/sys/netgraph/ng_cisco.h 139823 2005-01-07 01:45:51Z imp $\n * $Whistle: ng_cisco.h,v 1.6 1999/01/25 01:21:48 archie Exp $\n */\n\n#ifndef _NETGRAPH_NG_CISCO_H_\n#define _NETGRAPH_NG_CISCO_H_\n\n/* Node type name and magic cookie */\n#define NG_CISCO_NODE_TYPE\t\t\"cisco\"\n#define NGM_CISCO_COOKIE\t\t860707227\n\n/* Hook names */\n#define NG_CISCO_HOOK_DOWNSTREAM\t\"downstream\"\n#define NG_CISCO_HOOK_INET\t\t\"inet\"\n#define NG_CISCO_HOOK_INET6\t\t\"inet6\"\n#define NG_CISCO_HOOK_APPLETALK\t\t\"atalk\"\n#define NG_CISCO_HOOK_IPX\t\t\"ipx\"\n#define NG_CISCO_HOOK_DEBUG\t\t\"debug\"\n\n/* Netgraph commands */\nenum {\n\tNGM_CISCO_SET_IPADDR = 1,\t/* requires a struct ng_cisco_ipaddr */\n\tNGM_CISCO_GET_IPADDR,\t\t/* returns a struct ng_cisco_ipaddr */\n\tNGM_CISCO_GET_STATUS,\t\t/* returns a struct ng_cisco_stat */\n};\n\nstruct ng_cisco_ipaddr {\n\tstruct in_addr\tipaddr;\t\t/* IP address */\n\tstruct in_addr\tnetmask;\t/* Netmask */\n};\n\n/* Keep this in sync with the above structure definition */\n#define NG_CISCO_IPADDR_TYPE_INFO\t{\t\t\t\\\n\t  { \"ipaddr\",\t\t&ng_parse_ipaddr_type\t},\t\\\n\t  { \"netmask\",\t\t&ng_parse_ipaddr_type\t},\t\\\n\t  { NULL }\t\t\t\t\t\t\\\n}\n\nstruct ng_cisco_stats {\n\tu_int32_t   seqRetries;\t\t/* # unack'd retries */\n\tu_int32_t   keepAlivePeriod;\t/* in seconds */\n};\n\n/* Keep this in sync with the above structure definition */\n#define NG_CISCO_STATS_TYPE_INFO\t{\t\t\t\\\n\t  { \"seqRetries\",\t&ng_parse_uint32_type\t},\t\\\n\t  { \"keepAlivePeriod\",\t&ng_parse_uint32_type\t},\t\\\n\t  { NULL }\t\t\t\t\t\t\\\n}\n\n#endif /* _NETGRAPH_NG_CISCO_H_ */\n\n"
  },
  {
    "path": "freebsd-headers/netgraph/ng_deflate.h",
    "content": "/*-\n * Copyright (c) 2006 Alexander Motin <mav@alkar.net>\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice unmodified, this list of conditions, and the following\n *    disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/netgraph/ng_deflate.h 165581 2006-12-28 15:44:05Z glebius $\n */\n\n#ifndef _NETGRAPH_NG_DEFLATE_H_\n#define _NETGRAPH_NG_DEFLATE_H_\n\n/* Node type name and magic cookie */\n#define NG_DEFLATE_NODE_TYPE\t\"deflate\"\n#define NGM_DEFLATE_COOKIE\t1166642656\n\n/* Hook names */\n#define NG_DEFLATE_HOOK_COMP\t\"comp\"\t\t/* compression hook */\n#define NG_DEFLATE_HOOK_DECOMP\t\"decomp\"\t/* decompression hook */\n\n/* Config struct */\nstruct ng_deflate_config {\n\tu_char\t\tenable;\t\t\t/* node enabled */\n\tu_char\t\twindowBits;\t\t/* log2(Window size) */\n};\n\n/* Keep this in sync with the above structure definition. */\n#define NG_DEFLATE_CONFIG_INFO\t{\t\t\t\\\n\t{ \"enable\",\t&ng_parse_uint8_type\t},\t\\\n\t{ \"windowBits\",\t&ng_parse_uint8_type\t},\t\\\n\t{ NULL }\t\t\t\t\t\\\n}\n\n/* Statistics structure for one direction. */\nstruct ng_deflate_stats {\n\tuint64_t\tFramesPlain;\n\tuint64_t\tFramesComp;\n\tuint64_t\tFramesUncomp;\n\tuint64_t\tInOctets;\n\tuint64_t\tOutOctets;\n\tuint64_t\tErrors;\n};\n\n/* Keep this in sync with the above structure definition. */\n#define NG_DEFLATE_STATS_INFO\t{\t\t\t\t\\\n\t{ \"FramesPlain\",&ng_parse_uint64_type\t},\t\\\n\t{ \"FramesComp\",\t&ng_parse_uint64_type\t},\t\\\n\t{ \"FramesUncomp\", &ng_parse_uint64_type\t},\t\\\n\t{ \"InOctets\",\t&ng_parse_uint64_type\t},\t\\\n\t{ \"OutOctets\",\t&ng_parse_uint64_type\t},\t\\\n\t{ \"Errors\",\t&ng_parse_uint64_type\t},\t\\\n\t{ NULL }\t\t\t\t\t\\\n}\n\n/* Netgraph commands */\nenum {\n\tNGM_DEFLATE_CONFIG = 1,\n\tNGM_DEFLATE_RESETREQ,\t\t\t/* sent either way! */\n\tNGM_DEFLATE_GET_STATS,\n\tNGM_DEFLATE_CLR_STATS,\n\tNGM_DEFLATE_GETCLR_STATS,\n};\n\n#endif /* _NETGRAPH_NG_DEFLATE_H_ */\n\n"
  },
  {
    "path": "freebsd-headers/netgraph/ng_device.h",
    "content": "/*-\n * Copyright (c) 2002 Mark Santcroos <marks@ripe.net>\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR\n * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES\n * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,\n * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF\n * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n *\n *\n * $FreeBSD: release/9.0.0/sys/netgraph/ng_device.h 139823 2005-01-07 01:45:51Z imp $\n *\n */\n\n#ifndef _NETGRAPH_NG_DEVICE_H_\n#define _NETGRAPH_NG_DEVICE_H_\n\n/* Node type name and magic cookie */\n#define NG_DEVICE_NODE_TYPE\t\"device\"\n#define NGM_DEVICE_COOKIE\t1091129178\n#define\tNG_DEVICE_DEVNAME\t\"ngd\"\n\n/* Netgraph control messages */\nenum {\n\tNGM_DEVICE_GET_DEVNAME,\n};\n\n#if 0\n/* passing ioctl params */\nstruct ngd_param_s {\n\t        void * p;\n};\n#endif\n\n#endif /* _NETGRAPH_NG_DEVICE_H_ */\n"
  },
  {
    "path": "freebsd-headers/netgraph/ng_echo.h",
    "content": "/*\n * ng_echo.h\n */\n\n/*-\n * Copyright (c) 1996-1999 Whistle Communications, Inc.\n * All rights reserved.\n * \n * Subject to the following obligations and disclaimer of warranty, use and\n * redistribution of this software, in source or object code forms, with or\n * without modifications are expressly permitted by Whistle Communications;\n * provided, however, that:\n * 1. Any and all reproductions of the source or object code must include the\n *    copyright notice above and the following disclaimer of warranties; and\n * 2. No rights are granted, in any manner or form, to use Whistle\n *    Communications, Inc. trademarks, including the mark \"WHISTLE\n *    COMMUNICATIONS\" on advertising, endorsements, or otherwise except as\n *    such appears in the above copyright notice or in the software.\n * \n * THIS SOFTWARE IS BEING PROVIDED BY WHISTLE COMMUNICATIONS \"AS IS\", AND\n * TO THE MAXIMUM EXTENT PERMITTED BY LAW, WHISTLE COMMUNICATIONS MAKES NO\n * REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, REGARDING THIS SOFTWARE,\n * INCLUDING WITHOUT LIMITATION, ANY AND ALL IMPLIED WARRANTIES OF\n * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT.\n * WHISTLE COMMUNICATIONS DOES NOT WARRANT, GUARANTEE, OR MAKE ANY\n * REPRESENTATIONS REGARDING THE USE OF, OR THE RESULTS OF THE USE OF THIS\n * SOFTWARE IN TERMS OF ITS CORRECTNESS, ACCURACY, RELIABILITY OR OTHERWISE.\n * IN NO EVENT SHALL WHISTLE COMMUNICATIONS BE LIABLE FOR ANY DAMAGES\n * RESULTING FROM OR ARISING OUT OF ANY USE OF THIS SOFTWARE, INCLUDING\n * WITHOUT LIMITATION, ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,\n * PUNITIVE, OR CONSEQUENTIAL DAMAGES, PROCUREMENT OF SUBSTITUTE GOODS OR\n * SERVICES, LOSS OF USE, DATA OR PROFITS, HOWEVER CAUSED AND UNDER ANY\n * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF\n * THIS SOFTWARE, EVEN IF WHISTLE COMMUNICATIONS IS ADVISED OF THE POSSIBILITY\n * OF SUCH DAMAGE.\n *\n * Author: Archie Cobbs <archie@freebsd.org>\n *\n * $FreeBSD: release/9.0.0/sys/netgraph/ng_echo.h 139823 2005-01-07 01:45:51Z imp $\n * $Whistle: ng_echo.h,v 1.3 1999/01/20 00:22:12 archie Exp $\n */\n\n#ifndef _NETGRAPH_NG_ECHO_H_\n#define _NETGRAPH_NG_ECHO_H_\n\n/* Node type name and magic cookie */\n#define NG_ECHO_NODE_TYPE\t\"echo\"\n#define NGM_ECHO_COOKIE\t\t884298942\n\n#endif /* _NETGRAPH_NG_ECHO_H_ */\n"
  },
  {
    "path": "freebsd-headers/netgraph/ng_eiface.h",
    "content": "/*\n * ng_eiface.h\n */\n\n/*-\n * Copyright (c) 1999-2001, Vitaly V Belekhov\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice unmodified, this list of conditions, and the following\n *    disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/netgraph/ng_eiface.h 215673 2010-11-22 12:32:19Z zec $\n */\n\n#ifndef _NETGRAPH_NG_EIFACE_H_\n#define _NETGRAPH_NG_EIFACE_H_\n\n/* Node type name and magic cookie */\n#define NG_EIFACE_NODE_TYPE\t\t\"eiface\"\n#define NGM_EIFACE_COOKIE\t\t948105892\n\n/* Interface base name */\n#define NG_EIFACE_EIFACE_NAME\t\t\"ngeth\"\n\n/* My hook names */\n#define NG_EIFACE_HOOK_ETHER\t\t\"ether\"\n\n/* MTU bounds */\n#define NG_EIFACE_MTU_MIN\t\t72\n#define NG_EIFACE_MTU_MAX\t\tETHER_MAX_LEN_JUMBO\n#define NG_EIFACE_MTU_DEFAULT\t\t1500\n\n/* Netgraph commands */\nenum {\n\tNGM_EIFACE_GET_IFNAME = 1,\t/* get the interface name */\n\tNGM_EIFACE_GET_IFADDRS,\t\t/* returns list of addresses */\n\tNGM_EIFACE_SET,\t\t\t/* set ethernet address */\n};\n\n#endif /* _NETGRAPH_NG_EIFACE_H_ */\n"
  },
  {
    "path": "freebsd-headers/netgraph/ng_etf.h",
    "content": "/*-\n * ng_etf.h\n */\n\n/*-\n * Copyright (c) 2001, FreeBSD Incorporated \n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice unmodified, this list of conditions, and the following\n *    disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * Author: Julian Elischer <julian@freebsd.org>\n *\n * $FreeBSD: release/9.0.0/sys/netgraph/ng_etf.h 139823 2005-01-07 01:45:51Z imp $\n */\n\n#ifndef _NETGRAPH_NG_ETF_H_\n#define _NETGRAPH_NG_ETF_H_\n\n/* Node type name. This should be unique among all netgraph node types */\n#define NG_ETF_NODE_TYPE\t\"etf\"\n\n/* Node type cookie. Should also be unique. This value MUST change whenever\n   an incompatible change is made to this header file, to insure consistency.\n   The de facto method for generating cookies is to take the output of the\n   date command: date -u +'%s' */\n#define NGM_ETF_COOKIE\t\t983084516\n\n/* Hook names */\n#define NG_ETF_HOOK_DOWNSTREAM\t\"downstream\"\n#define NG_ETF_HOOK_NOMATCH\t\"nomatch\"\n\n/* Netgraph commands understood by this node type */\nenum {\n\tNGM_ETF_SET_FLAG = 1,\n\tNGM_ETF_GET_STATUS,\n\tNGM_ETF_SET_FILTER,\n\n};\n\n/* This structure is returned by the NGM_ETF_GET_STATUS command */\nstruct ng_etfstat {\n\tu_int32_t   packets_in;\t\t/* packets in from downstream */\n\tu_int32_t   packets_out;\t/* packets out towards downstream */\n};\n\n/*\n * This needs to be kept in sync with the above structure definition\n */\n#define NG_ETF_STATS_TYPE_INFO\t{\t\t\t\t\\\n\t  { \"packets_in\",\t&ng_parse_uint32_type\t},\t\\\n\t  { \"packets_out\",\t&ng_parse_uint32_type\t},\t\\\n\t  { NULL }\t\t\t\t\t\t\\\n}\n\n/* This structure is returned by the NGM_ETF_GET_STATUS command */\nstruct ng_etffilter {\n\tchar\t\tmatchhook[NG_HOOKSIZ]; /* hook name */\n\tu_int16_t\tethertype;\t/* this ethertype to this hook */\n};\t\n\n/*\n * This needs to be kept in sync with the above structure definition\n */\n#define NG_ETF_FILTER_TYPE_INFO\t{\t\t\t\t\\\n          { \"matchhook\",\t&ng_parse_hookbuf_type  },\t\\\n\t  { \"ethertype\",\t&ng_parse_uint16_type   },\t\\\n\t  { NULL }\t\t\t\t\t\t\\\n}\n\n#endif /* _NETGRAPH_NG_ETF_H_ */\n"
  },
  {
    "path": "freebsd-headers/netgraph/ng_ether.h",
    "content": "\n/*\n * ng_ether.h\n */\n\n/*-\n * Copyright (c) 1996-1999 Whistle Communications, Inc.\n * All rights reserved.\n * \n * Subject to the following obligations and disclaimer of warranty, use and\n * redistribution of this software, in source or object code forms, with or\n * without modifications are expressly permitted by Whistle Communications;\n * provided, however, that:\n * 1. Any and all reproductions of the source or object code must include the\n *    copyright notice above and the following disclaimer of warranties; and\n * 2. No rights are granted, in any manner or form, to use Whistle\n *    Communications, Inc. trademarks, including the mark \"WHISTLE\n *    COMMUNICATIONS\" on advertising, endorsements, or otherwise except as\n *    such appears in the above copyright notice or in the software.\n * \n * THIS SOFTWARE IS BEING PROVIDED BY WHISTLE COMMUNICATIONS \"AS IS\", AND\n * TO THE MAXIMUM EXTENT PERMITTED BY LAW, WHISTLE COMMUNICATIONS MAKES NO\n * REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, REGARDING THIS SOFTWARE,\n * INCLUDING WITHOUT LIMITATION, ANY AND ALL IMPLIED WARRANTIES OF\n * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT.\n * WHISTLE COMMUNICATIONS DOES NOT WARRANT, GUARANTEE, OR MAKE ANY\n * REPRESENTATIONS REGARDING THE USE OF, OR THE RESULTS OF THE USE OF THIS\n * SOFTWARE IN TERMS OF ITS CORRECTNESS, ACCURACY, RELIABILITY OR OTHERWISE.\n * IN NO EVENT SHALL WHISTLE COMMUNICATIONS BE LIABLE FOR ANY DAMAGES\n * RESULTING FROM OR ARISING OUT OF ANY USE OF THIS SOFTWARE, INCLUDING\n * WITHOUT LIMITATION, ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,\n * PUNITIVE, OR CONSEQUENTIAL DAMAGES, PROCUREMENT OF SUBSTITUTE GOODS OR\n * SERVICES, LOSS OF USE, DATA OR PROFITS, HOWEVER CAUSED AND UNDER ANY\n * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF\n * THIS SOFTWARE, EVEN IF WHISTLE COMMUNICATIONS IS ADVISED OF THE POSSIBILITY\n * OF SUCH DAMAGE.\n *\n * Author: Archie Cobbs <archie@freebsd.org>\n *\n * $FreeBSD: release/9.0.0/sys/netgraph/ng_ether.h 141910 2005-02-14 12:01:09Z glebius $\n * $Whistle: ng_ether.h,v 1.1 1999/02/02 03:17:22 julian Exp $\n */\n\n#ifndef _NETGRAPH_NG_ETHER_H_\n#define _NETGRAPH_NG_ETHER_H_\n\n/* Node type name and magic cookie */\n#define NG_ETHER_NODE_TYPE\t\"ether\"\n#define NGM_ETHER_COOKIE\t917786906\n\n/* Hook names */\n#define NG_ETHER_HOOK_LOWER\t\"lower\"\t\t/* connection to raw device */\n#define NG_ETHER_HOOK_UPPER\t\"upper\"\t\t/* connection to upper layers */\n#define NG_ETHER_HOOK_DIVERT\t\"divert\"\t/* alias for lower */\n#define NG_ETHER_HOOK_ORPHAN\t\"orphans\"\t/* like lower, unknowns only */\n\n/* Netgraph control messages */\nenum {\n\tNGM_ETHER_GET_IFNAME = 1,\t/* get the interface name */\n\tNGM_ETHER_GET_IFINDEX,\t\t/* get the interface global index # */\n\tNGM_ETHER_GET_ENADDR,\t\t/* get Ethernet address */\n\tNGM_ETHER_SET_ENADDR,\t\t/* set Ethernet address */\n\tNGM_ETHER_GET_PROMISC,\t\t/* get node's promiscuous mode bit */\n\tNGM_ETHER_SET_PROMISC,\t\t/* enable/disable promiscuous mode */\n\tNGM_ETHER_GET_AUTOSRC,\t\t/* get source address override */\n\tNGM_ETHER_SET_AUTOSRC,\t\t/* enable/disable src addr override */\n\tNGM_ETHER_ADD_MULTI,\t\t/* add multicast membership */\n\tNGM_ETHER_DEL_MULTI,\t\t/* delete multicast membership */\n\tNGM_ETHER_DETACH,\t\t/* our way to be shut down */\n};\n\n#endif /* _NETGRAPH_NG_ETHER_H_ */\n"
  },
  {
    "path": "freebsd-headers/netgraph/ng_ether_echo.h",
    "content": "/*\n * ng_ether_echo.h\n */\n\n/*-\n * Copyright (c) 1996-1999 Whistle Communications, Inc.\n * All rights reserved.\n * \n * Subject to the following obligations and disclaimer of warranty, use and\n * redistribution of this software, in source or object code forms, with or\n * without modifications are expressly permitted by Whistle Communications;\n * provided, however, that:\n * 1. Any and all reproductions of the source or object code must include the\n *    copyright notice above and the following disclaimer of warranties; and\n * 2. No rights are granted, in any manner or form, to use Whistle\n *    Communications, Inc. trademarks, including the mark \"WHISTLE\n *    COMMUNICATIONS\" on advertising, endorsements, or otherwise except as\n *    such appears in the above copyright notice or in the software.\n * \n * THIS SOFTWARE IS BEING PROVIDED BY WHISTLE COMMUNICATIONS \"AS IS\", AND\n * TO THE MAXIMUM EXTENT PERMITTED BY LAW, WHISTLE COMMUNICATIONS MAKES NO\n * REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, REGARDING THIS SOFTWARE,\n * INCLUDING WITHOUT LIMITATION, ANY AND ALL IMPLIED WARRANTIES OF\n * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT.\n * WHISTLE COMMUNICATIONS DOES NOT WARRANT, GUARANTEE, OR MAKE ANY\n * REPRESENTATIONS REGARDING THE USE OF, OR THE RESULTS OF THE USE OF THIS\n * SOFTWARE IN TERMS OF ITS CORRECTNESS, ACCURACY, RELIABILITY OR OTHERWISE.\n * IN NO EVENT SHALL WHISTLE COMMUNICATIONS BE LIABLE FOR ANY DAMAGES\n * RESULTING FROM OR ARISING OUT OF ANY USE OF THIS SOFTWARE, INCLUDING\n * WITHOUT LIMITATION, ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,\n * PUNITIVE, OR CONSEQUENTIAL DAMAGES, PROCUREMENT OF SUBSTITUTE GOODS OR\n * SERVICES, LOSS OF USE, DATA OR PROFITS, HOWEVER CAUSED AND UNDER ANY\n * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF\n * THIS SOFTWARE, EVEN IF WHISTLE COMMUNICATIONS IS ADVISED OF THE POSSIBILITY\n * OF SUCH DAMAGE.\n *\n * Author: Archie Cobbs <archie@freebsd.org>\n *\n * $FreeBSD: release/9.0.0/sys/netgraph/ng_ether_echo.h 186481 2008-12-25 00:01:29Z julian $\n * $Whistle: ng_echo.h,v 1.3 1999/01/20 00:22:12 archie Exp $\n */\n\n#ifndef _NETGRAPH_NG_ETHER_ECHO_H_\n#define _NETGRAPH_NG_ETHER_ECHO_H_\n\n/* Node type name and magic cookie */\n#define NG_ETHER_ECHO_NODE_TYPE\t\"ether_echo\"\n#define NGM_ETHER_ECHO_COOKIE\t\t1230155201\n\n#endif /* _NETGRAPH_NG_ETHER_ECHO_H_ */\n"
  },
  {
    "path": "freebsd-headers/netgraph/ng_fec.h",
    "content": "/*\n * ng_fec.h\n */\n\n/*-\n * Copyright (c) 2000 Berkeley Software Design, Inc.\n * Copyright (c) 1997, 1998, 1999, 2000\n *\tBill Paul <wpaul@osd.bsdi.com>.  All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. All advertising materials mentioning features or use of this software\n *    must display the following acknowledgement:\n *\tThis product includes software developed by Bill Paul.\n * 4. Neither the name of the author nor the names of any co-contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY Bill Paul AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL Bill Paul OR THE VOICES IN HIS HEAD\n * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\n * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\n * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\n * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\n * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF\n * THE POSSIBILITY OF SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/netgraph/ng_fec.h 139823 2005-01-07 01:45:51Z imp $\n */\n/*-\n * Copyright (c) 1996-1999 Whistle Communications, Inc.\n * All rights reserved.\n * \n * Subject to the following obligations and disclaimer of warranty, use and\n * redistribution of this software, in source or object code forms, with or\n * without modifications are expressly permitted by Whistle Communications;\n * provided, however, that:\n * 1. Any and all reproductions of the source or object code must include the\n *    copyright notice above and the following disclaimer of warranties; and\n * 2. No rights are granted, in any manner or form, to use Whistle\n *    Communications, Inc. trademarks, including the mark \"WHISTLE\n *    COMMUNICATIONS\" on advertising, endorsements, or otherwise except as\n *    such appears in the above copyright notice or in the software.\n * \n * THIS SOFTWARE IS BEING PROVIDED BY WHISTLE COMMUNICATIONS \"AS IS\", AND\n * TO THE MAXIMUM EXTENT PERMITTED BY LAW, WHISTLE COMMUNICATIONS MAKES NO\n * REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, REGARDING THIS SOFTWARE,\n * INCLUDING WITHOUT LIMITATION, ANY AND ALL IMPLIED WARRANTIES OF\n * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT.\n * WHISTLE COMMUNICATIONS DOES NOT WARRANT, GUARANTEE, OR MAKE ANY\n * REPRESENTATIONS REGARDING THE USE OF, OR THE RESULTS OF THE USE OF THIS\n * SOFTWARE IN TERMS OF ITS CORRECTNESS, ACCURACY, RELIABILITY OR OTHERWISE.\n * IN NO EVENT SHALL WHISTLE COMMUNICATIONS BE LIABLE FOR ANY DAMAGES\n * RESULTING FROM OR ARISING OUT OF ANY USE OF THIS SOFTWARE, INCLUDING\n * WITHOUT LIMITATION, ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,\n * PUNITIVE, OR CONSEQUENTIAL DAMAGES, PROCUREMENT OF SUBSTITUTE GOODS OR\n * SERVICES, LOSS OF USE, DATA OR PROFITS, HOWEVER CAUSED AND UNDER ANY\n * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF\n * THIS SOFTWARE, EVEN IF WHISTLE COMMUNICATIONS IS ADVISED OF THE POSSIBILITY\n * OF SUCH DAMAGE.\n *\n * Author: Archie Cobbs <archie@freebsd.org>\n *\n * $Whistle: ng_fec.h,v 1.5 1999/01/20 00:22:13 archie Exp $\n */\n\n#ifndef _NETGRAPH_NG_FEC_H_\n#define _NETGRAPH_NG_FEC_H_\n\n#define NETISR_FEC\t\t\t26\n\n/* Node type name and magic cookie */\n#define NG_FEC_NODE_TYPE\t\t\"fec\"\n#define NGM_FEC_COOKIE\t\t\t983566799\n\n/* Interface base name */\n#define NG_FEC_FEC_NAME\t\t\t\"fec\"\n#define NG_FEC_FEC_NAME_MAX\t\t15\n\n/* MTU bounds */\n#define NG_FEC_MTU_MIN\t\t\t72\n#define NG_FEC_MTU_MAX\t\t\t65535\n#define NG_FEC_MTU_DEFAULT\t\t1500\n\n/* Special flags for mbufs. */\n#define M_FEC_MAC\t\t\t0x2000\n#define M_FEC_INET\t\t\t0x4000\n#define M_FEC_INET6\t\t\t0x8000\n\n/* Netgraph commands */\nenum {\n\tNGM_FEC_ADD_IFACE,\n\tNGM_FEC_DEL_IFACE,\n\tNGM_FEC_SET_MODE_MAC,\n\tNGM_FEC_SET_MODE_INET,\n\tNGM_FEC_SET_MODE_INET6\n};\n\nstruct ng_fec_ifname {\n\tchar    ngif_name[NG_FEC_FEC_NAME_MAX + 1];\n};\n\n#endif /* _NETGRAPH_NG_FEC_H_ */\n"
  },
  {
    "path": "freebsd-headers/netgraph/ng_frame_relay.h",
    "content": "/*\n * ng_frame_relay.h\n */\n\n/*-\n * Copyright (c) 1996-1999 Whistle Communications, Inc.\n * All rights reserved.\n * \n * Subject to the following obligations and disclaimer of warranty, use and\n * redistribution of this software, in source or object code forms, with or\n * without modifications are expressly permitted by Whistle Communications;\n * provided, however, that:\n * 1. Any and all reproductions of the source or object code must include the\n *    copyright notice above and the following disclaimer of warranties; and\n * 2. No rights are granted, in any manner or form, to use Whistle\n *    Communications, Inc. trademarks, including the mark \"WHISTLE\n *    COMMUNICATIONS\" on advertising, endorsements, or otherwise except as\n *    such appears in the above copyright notice or in the software.\n * \n * THIS SOFTWARE IS BEING PROVIDED BY WHISTLE COMMUNICATIONS \"AS IS\", AND\n * TO THE MAXIMUM EXTENT PERMITTED BY LAW, WHISTLE COMMUNICATIONS MAKES NO\n * REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, REGARDING THIS SOFTWARE,\n * INCLUDING WITHOUT LIMITATION, ANY AND ALL IMPLIED WARRANTIES OF\n * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT.\n * WHISTLE COMMUNICATIONS DOES NOT WARRANT, GUARANTEE, OR MAKE ANY\n * REPRESENTATIONS REGARDING THE USE OF, OR THE RESULTS OF THE USE OF THIS\n * SOFTWARE IN TERMS OF ITS CORRECTNESS, ACCURACY, RELIABILITY OR OTHERWISE.\n * IN NO EVENT SHALL WHISTLE COMMUNICATIONS BE LIABLE FOR ANY DAMAGES\n * RESULTING FROM OR ARISING OUT OF ANY USE OF THIS SOFTWARE, INCLUDING\n * WITHOUT LIMITATION, ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,\n * PUNITIVE, OR CONSEQUENTIAL DAMAGES, PROCUREMENT OF SUBSTITUTE GOODS OR\n * SERVICES, LOSS OF USE, DATA OR PROFITS, HOWEVER CAUSED AND UNDER ANY\n * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF\n * THIS SOFTWARE, EVEN IF WHISTLE COMMUNICATIONS IS ADVISED OF THE POSSIBILITY\n * OF SUCH DAMAGE.\n *\n * Author: Archie Cobbs <archie@freebsd.org>\n *\n * $FreeBSD: release/9.0.0/sys/netgraph/ng_frame_relay.h 139823 2005-01-07 01:45:51Z imp $\n * $Whistle: ng_frame_relay.h,v 1.7 1999/01/20 00:22:13 archie Exp $\n */\n\n#ifndef _NETGRAPH_NG_FRAME_RELAY_H_\n#define _NETGRAPH_NG_FRAME_RELAY_H_\n\n/* Node type name and magic cookie */\n#define NG_FRAMERELAY_NODE_TYPE\t\t\"frame_relay\"\n#define NGM_FRAMERELAY_COOKIE\t\t872148478\n\n/* Hook names */\n#define NG_FRAMERELAY_HOOK_DEBUG\t\"debug\"\n#define NG_FRAMERELAY_HOOK_DOWNSTREAM\t\"downstream\"\n#define NG_FRAMERELAY_HOOK_DLCI\t\t\"dlci\"\t/* really just the prefix */\n\n#endif /* _NETGRAPH_NG_FRAME_RELAY_H_ */\n"
  },
  {
    "path": "freebsd-headers/netgraph/ng_gif.h",
    "content": "/*\n * ng_gif.h\n */\n\n/*-\n * Copyright 2001 The Aerospace Corporation.  All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n *\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions, and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions, and the following disclaimer in the\n *     documentation and/or other materials provided with the distribution.\n * 3. The name of The Aerospace Corporation may not be used to endorse or\n *    promote products derived from this software.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AEROSPACE CORPORATION ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AEROSPACE CORPORATION BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\n * Copyright (c) 1996-1999 Whistle Communications, Inc.\n * All rights reserved.\n * \n * Subject to the following obligations and disclaimer of warranty, use and\n * redistribution of this software, in source or object code forms, with or\n * without modifications are expressly permitted by Whistle Communications;\n * provided, however, that:\n * 1. Any and all reproductions of the source or object code must include the\n *    copyright notice above and the following disclaimer of warranties; and\n * 2. No rights are granted, in any manner or form, to use Whistle\n *    Communications, Inc. trademarks, including the mark \"WHISTLE\n *    COMMUNICATIONS\" on advertising, endorsements, or otherwise except as\n *    such appears in the above copyright notice or in the software.\n * \n * THIS SOFTWARE IS BEING PROVIDED BY WHISTLE COMMUNICATIONS \"AS IS\", AND\n * TO THE MAXIMUM EXTENT PERMITTED BY LAW, WHISTLE COMMUNICATIONS MAKES NO\n * REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, REGARDING THIS SOFTWARE,\n * INCLUDING WITHOUT LIMITATION, ANY AND ALL IMPLIED WARRANTIES OF\n * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT.\n * WHISTLE COMMUNICATIONS DOES NOT WARRANT, GUARANTEE, OR MAKE ANY\n * REPRESENTATIONS REGARDING THE USE OF, OR THE RESULTS OF THE USE OF THIS\n * SOFTWARE IN TERMS OF ITS CORRECTNESS, ACCURACY, RELIABILITY OR OTHERWISE.\n * IN NO EVENT SHALL WHISTLE COMMUNICATIONS BE LIABLE FOR ANY DAMAGES\n * RESULTING FROM OR ARISING OUT OF ANY USE OF THIS SOFTWARE, INCLUDING\n * WITHOUT LIMITATION, ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,\n * PUNITIVE, OR CONSEQUENTIAL DAMAGES, PROCUREMENT OF SUBSTITUTE GOODS OR\n * SERVICES, LOSS OF USE, DATA OR PROFITS, HOWEVER CAUSED AND UNDER ANY\n * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF\n * THIS SOFTWARE, EVEN IF WHISTLE COMMUNICATIONS IS ADVISED OF THE POSSIBILITY\n * OF SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/netgraph/ng_gif.h 139823 2005-01-07 01:45:51Z imp $\n */\n\n#ifndef _NETGRAPH_NG_GIF_H_\n#define _NETGRAPH_NG_GIF_H_\n\n/* Node type name and magic cookie */\n#define NG_GIF_NODE_TYPE\t\"gif\"\n#define NGM_GIF_COOKIE\t\t994115727\n\n/* Hook names */\n#define NG_GIF_HOOK_LOWER\t\"lower\"\t\t/* connection to raw device */\n#define NG_GIF_HOOK_DIVERT\t\"divert\"\t/* alias for lower */\n#define NG_GIF_HOOK_ORPHAN\t\"orphans\"\t/* like lower, unknowns only */\n\n/* Netgraph control messages */\nenum {\n\tNGM_GIF_GET_IFNAME = 1,\t\t/* get the interface name */\n\tNGM_GIF_GET_IFINDEX\t\t/* get the interface global index # */\n};\n\n#endif /* _NETGRAPH_NG_GIF_H_ */\n"
  },
  {
    "path": "freebsd-headers/netgraph/ng_gif_demux.h",
    "content": "/*\n * ng_gif_demux.h\n */\n\n/*-\n * Copyright 2001 The Aerospace Corporation.  All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n *\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions, and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions, and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. The name of The Aerospace Corporation may not be used to endorse or\n *    promote products derived from this software.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AEROSPACE CORPORATION ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AEROSPACE CORPORATION BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/netgraph/ng_gif_demux.h 139823 2005-01-07 01:45:51Z imp $\n */\n\n#ifndef _NETGRAPH_NG_GIF_DEMUX_H_\n#define _NETGRAPH_NG_GIF_DEMUX_H_\n\n/* Node type name and magic cookie */\n#define NG_GIF_DEMUX_NODE_TYPE\t\t\"gif_demux\"\n#define NGM_GIF_DEMUX_COOKIE\t\t995567329\n\n/* Hook names */\n#define NG_GIF_DEMUX_HOOK_GIF\t\t\"gif\"\n#define NG_GIF_DEMUX_HOOK_INET\t\t\"inet\"\n#define NG_GIF_DEMUX_HOOK_INET6\t\t\"inet6\"\n#define NG_GIF_DEMUX_HOOK_ATALK\t\t\"atalk\"\n#define NG_GIF_DEMUX_HOOK_IPX\t\t\"ipx\"\n#define NG_GIF_DEMUX_HOOK_ATM\t\t\"atm\"\n#define NG_GIF_DEMUX_HOOK_NATM\t\t\"natm\"\n\n#endif /* _NETGRAPH_NG_GIF_DEMUX_H_ */\n"
  },
  {
    "path": "freebsd-headers/netgraph/ng_hole.h",
    "content": "/*\n * ng_hole.h\n */\n\n/*-\n * Copyright (c) 1996-1999 Whistle Communications, Inc.\n * All rights reserved.\n * \n * Subject to the following obligations and disclaimer of warranty, use and\n * redistribution of this software, in source or object code forms, with or\n * without modifications are expressly permitted by Whistle Communications;\n * provided, however, that:\n * 1. Any and all reproductions of the source or object code must include the\n *    copyright notice above and the following disclaimer of warranties; and\n * 2. No rights are granted, in any manner or form, to use Whistle\n *    Communications, Inc. trademarks, including the mark \"WHISTLE\n *    COMMUNICATIONS\" on advertising, endorsements, or otherwise except as\n *    such appears in the above copyright notice or in the software.\n * \n * THIS SOFTWARE IS BEING PROVIDED BY WHISTLE COMMUNICATIONS \"AS IS\", AND\n * TO THE MAXIMUM EXTENT PERMITTED BY LAW, WHISTLE COMMUNICATIONS MAKES NO\n * REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, REGARDING THIS SOFTWARE,\n * INCLUDING WITHOUT LIMITATION, ANY AND ALL IMPLIED WARRANTIES OF\n * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT.\n * WHISTLE COMMUNICATIONS DOES NOT WARRANT, GUARANTEE, OR MAKE ANY\n * REPRESENTATIONS REGARDING THE USE OF, OR THE RESULTS OF THE USE OF THIS\n * SOFTWARE IN TERMS OF ITS CORRECTNESS, ACCURACY, RELIABILITY OR OTHERWISE.\n * IN NO EVENT SHALL WHISTLE COMMUNICATIONS BE LIABLE FOR ANY DAMAGES\n * RESULTING FROM OR ARISING OUT OF ANY USE OF THIS SOFTWARE, INCLUDING\n * WITHOUT LIMITATION, ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,\n * PUNITIVE, OR CONSEQUENTIAL DAMAGES, PROCUREMENT OF SUBSTITUTE GOODS OR\n * SERVICES, LOSS OF USE, DATA OR PROFITS, HOWEVER CAUSED AND UNDER ANY\n * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF\n * THIS SOFTWARE, EVEN IF WHISTLE COMMUNICATIONS IS ADVISED OF THE POSSIBILITY\n * OF SUCH DAMAGE.\n *\n * Author: Archie Cobbs <archie@freebsd.org>\n *\n * $FreeBSD: release/9.0.0/sys/netgraph/ng_hole.h 139823 2005-01-07 01:45:51Z imp $\n * $Whistle: ng_hole.h,v 1.3 1999/01/20 00:22:13 archie Exp $\n */\n\n#ifndef _NETGRAPH_NG_HOLE_H_\n#define _NETGRAPH_NG_HOLE_H_\n\n/* Node type name and magic cookie */\n#define NG_HOLE_NODE_TYPE\t\"hole\"\n#define NGM_HOLE_COOKIE\t\t915433206\n\n/* Statistics structure for one hook. */\nstruct ng_hole_hookstat {\n\tuint64_t\tframes;\n\tuint64_t\toctets;\n};\n\n/* Keep this in sync with the above structure definition. */\n#define\tNG_HOLE_HOOKSTAT_TYPE_INFO {\t\t\t\t\\\n\t{ \"frames\",\t&ng_parse_uint64_type },\t\t\\\n\t{ \"octets\",\t&ng_parse_uint64_type },\t\t\\\n\t{ NULL }\t\t\t\t\t\t\\\n}\n\n/* Netgraph commands. */\nenum {\n\tNGM_HOLE_GET_STATS = 1,\n\tNGM_HOLE_CLR_STATS,\n\tNGM_HOLE_GETCLR_STATS,\n};\n\n#endif /* _NETGRAPH_NG_HOLE_H_ */\n"
  },
  {
    "path": "freebsd-headers/netgraph/ng_hub.h",
    "content": "/*-\n * Copyright (c) 2004 Ruslan Ermilov\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/netgraph/ng_hub.h 207680 2010-05-05 22:06:05Z zec $\n */\n\n#ifndef _NETGRAPH_NG_HUB_H_\n#define\t_NETGRAPH_NG_HUB_H_\n\n/* Node type name and magic cookie. */\n#define\tNG_HUB_NODE_TYPE\t\"hub\"\n#define\tNGM_HUB_COOKIE\t\t1082189597\n\n/* Netgraph control messages */\nenum {\n\tNGM_HUB_SET_PERSISTENT = 1,\t/* set persistent mode */\n};\n\n#endif /* _NETGRAPH_NG_HUB_H_ */\n"
  },
  {
    "path": "freebsd-headers/netgraph/ng_iface.h",
    "content": "/*\n * ng_iface.h\n */\n\n/*-\n * Copyright (c) 1996-1999 Whistle Communications, Inc.\n * All rights reserved.\n * \n * Subject to the following obligations and disclaimer of warranty, use and\n * redistribution of this software, in source or object code forms, with or\n * without modifications are expressly permitted by Whistle Communications;\n * provided, however, that:\n * 1. Any and all reproductions of the source or object code must include the\n *    copyright notice above and the following disclaimer of warranties; and\n * 2. No rights are granted, in any manner or form, to use Whistle\n *    Communications, Inc. trademarks, including the mark \"WHISTLE\n *    COMMUNICATIONS\" on advertising, endorsements, or otherwise except as\n *    such appears in the above copyright notice or in the software.\n * \n * THIS SOFTWARE IS BEING PROVIDED BY WHISTLE COMMUNICATIONS \"AS IS\", AND\n * TO THE MAXIMUM EXTENT PERMITTED BY LAW, WHISTLE COMMUNICATIONS MAKES NO\n * REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, REGARDING THIS SOFTWARE,\n * INCLUDING WITHOUT LIMITATION, ANY AND ALL IMPLIED WARRANTIES OF\n * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT.\n * WHISTLE COMMUNICATIONS DOES NOT WARRANT, GUARANTEE, OR MAKE ANY\n * REPRESENTATIONS REGARDING THE USE OF, OR THE RESULTS OF THE USE OF THIS\n * SOFTWARE IN TERMS OF ITS CORRECTNESS, ACCURACY, RELIABILITY OR OTHERWISE.\n * IN NO EVENT SHALL WHISTLE COMMUNICATIONS BE LIABLE FOR ANY DAMAGES\n * RESULTING FROM OR ARISING OUT OF ANY USE OF THIS SOFTWARE, INCLUDING\n * WITHOUT LIMITATION, ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,\n * PUNITIVE, OR CONSEQUENTIAL DAMAGES, PROCUREMENT OF SUBSTITUTE GOODS OR\n * SERVICES, LOSS OF USE, DATA OR PROFITS, HOWEVER CAUSED AND UNDER ANY\n * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF\n * THIS SOFTWARE, EVEN IF WHISTLE COMMUNICATIONS IS ADVISED OF THE POSSIBILITY\n * OF SUCH DAMAGE.\n *\n * Author: Archie Cobbs <archie@freebsd.org>\n *\n * $FreeBSD: release/9.0.0/sys/netgraph/ng_iface.h 187495 2009-01-20 22:26:09Z mav $\n * $Whistle: ng_iface.h,v 1.5 1999/01/20 00:22:13 archie Exp $\n */\n\n#ifndef _NETGRAPH_NG_IFACE_H_\n#define _NETGRAPH_NG_IFACE_H_\n\n/* Node type name and magic cookie */\n#define NG_IFACE_NODE_TYPE\t\t\"iface\"\n#define NGM_IFACE_COOKIE\t\t1108312559\n\n/* Interface base name */\n#define NG_IFACE_IFACE_NAME\t\t\"ng\"\n\n/* My hook names */\n#define NG_IFACE_HOOK_INET\t\t\"inet\"\n#define NG_IFACE_HOOK_INET6\t\t\"inet6\"\n#define NG_IFACE_HOOK_ATALK\t\t\"atalk\"\t/* AppleTalk phase 2 */\n#define NG_IFACE_HOOK_IPX\t\t\"ipx\"\n#define NG_IFACE_HOOK_ATM\t\t\"atm\"\n#define NG_IFACE_HOOK_NATM\t\t\"natm\"\n\n/* MTU bounds */\n#define NG_IFACE_MTU_MIN\t\t72\n#define NG_IFACE_MTU_MAX\t\t65535\n#define NG_IFACE_MTU_DEFAULT\t\t1500\n\n/* Netgraph commands */\nenum {\n\tNGM_IFACE_GET_IFNAME = 1,\n\tNGM_IFACE_POINT2POINT,\n\tNGM_IFACE_BROADCAST,\n\tNGM_IFACE_GET_IFINDEX,\n};\n\n#define\tMTAG_NGIF\t\t\tNGM_IFACE_COOKIE\n#define\tMTAG_NGIF_CALLED\t\t0 | MTAG_PERSISTENT\n\n#endif /* _NETGRAPH_NG_IFACE_H_ */\n"
  },
  {
    "path": "freebsd-headers/netgraph/ng_ip_input.h",
    "content": "/*\n * ng_ip_input.h\n */\n\n/*-\n * Copyright 2001 The Aerospace Corporation.  All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n *\n * 1.  Redistributions of source code must retain the above copyright\n *     notice, this list of conditions, and the following disclaimer.\n * 2.  Redistributions in binary form must reproduce the above copyright\n *     notice, this list of conditions, and the following disclaimer in the\n *     documentation and/or other materials provided with the distribution.\n * 3.  The name of The Aerospace Corporation may not be used to endorse or\n *     promote products derived from this software.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AEROSPACE CORPORATION \"AS IS\" AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AEROSPACE CORPORATION BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * Copyright (c) 1996-1999 Whistle Communications, Inc.\n * All rights reserved.\n * \n * Subject to the following obligations and disclaimer of warranty, use and\n * redistribution of this software, in source or object code forms, with or\n * without modifications are expressly permitted by Whistle Communications;\n * provided, however, that:\n * 1. Any and all reproductions of the source or object code must include the\n *    copyright notice above and the following disclaimer of warranties; and\n * 2. No rights are granted, in any manner or form, to use Whistle\n *    Communications, Inc. trademarks, including the mark \"WHISTLE\n *    COMMUNICATIONS\" on advertising, endorsements, or otherwise except as\n *    such appears in the above copyright notice or in the software.\n * \n * THIS SOFTWARE IS BEING PROVIDED BY WHISTLE COMMUNICATIONS \"AS IS\", AND\n * TO THE MAXIMUM EXTENT PERMITTED BY LAW, WHISTLE COMMUNICATIONS MAKES NO\n * REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, REGARDING THIS SOFTWARE,\n * INCLUDING WITHOUT LIMITATION, ANY AND ALL IMPLIED WARRANTIES OF\n * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT.\n * WHISTLE COMMUNICATIONS DOES NOT WARRANT, GUARANTEE, OR MAKE ANY\n * REPRESENTATIONS REGARDING THE USE OF, OR THE RESULTS OF THE USE OF THIS\n * SOFTWARE IN TERMS OF ITS CORRECTNESS, ACCURACY, RELIABILITY OR OTHERWISE.\n * IN NO EVENT SHALL WHISTLE COMMUNICATIONS BE LIABLE FOR ANY DAMAGES\n * RESULTING FROM OR ARISING OUT OF ANY USE OF THIS SOFTWARE, INCLUDING\n * WITHOUT LIMITATION, ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,\n * PUNITIVE, OR CONSEQUENTIAL DAMAGES, PROCUREMENT OF SUBSTITUTE GOODS OR\n * SERVICES, LOSS OF USE, DATA OR PROFITS, HOWEVER CAUSED AND UNDER ANY\n * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF\n * THIS SOFTWARE, EVEN IF WHISTLE COMMUNICATIONS IS ADVISED OF THE POSSIBILITY\n * OF SUCH DAMAGE.\n *\n * Author:\t\tBrooks Davis <brooks@FreeBSD.org>\n * Derived from:\tng_hole.h\n *\n * $FreeBSD: release/9.0.0/sys/netgraph/ng_ip_input.h 139823 2005-01-07 01:45:51Z imp $\n */\n\n#ifndef _NETGRAPH_NG_IP_INPUT_H_\n#define _NETGRAPH_NG_IP_INPUT_H_\n\n/* Node type name and magic cookie */\n#define NG_IP_INPUT_NODE_TYPE\t\"ip_input\"\n#define NGM_IP_INPUT_COOKIE\t994874907\n\n#endif /* _NETGRAPH_NG_IP_INPUT_H_ */\n"
  },
  {
    "path": "freebsd-headers/netgraph/ng_ipfw.h",
    "content": "/*-\n * Copyright 2005, Gleb Smirnoff <glebius@FreeBSD.org>\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/netgraph/ng_ipfw.h 201124 2009-12-28 12:29:13Z luigi $\n */\n\n#ifndef _NG_IPFW_H\n#define _NG_IPFW_H\n#define NG_IPFW_NODE_TYPE    \"ipfw\"\n#define NGM_IPFW_COOKIE      1105988990\n#endif /* _NG_IPFW_H */\n"
  },
  {
    "path": "freebsd-headers/netgraph/ng_ksocket.h",
    "content": "/*\n * ng_ksocket.h\n */\n\n/*-\n * Copyright (c) 1996-1999 Whistle Communications, Inc.\n * All rights reserved.\n * \n * Subject to the following obligations and disclaimer of warranty, use and\n * redistribution of this software, in source or object code forms, with or\n * without modifications are expressly permitted by Whistle Communications;\n * provided, however, that:\n * 1. Any and all reproductions of the source or object code must include the\n *    copyright notice above and the following disclaimer of warranties; and\n * 2. No rights are granted, in any manner or form, to use Whistle\n *    Communications, Inc. trademarks, including the mark \"WHISTLE\n *    COMMUNICATIONS\" on advertising, endorsements, or otherwise except as\n *    such appears in the above copyright notice or in the software.\n * \n * THIS SOFTWARE IS BEING PROVIDED BY WHISTLE COMMUNICATIONS \"AS IS\", AND\n * TO THE MAXIMUM EXTENT PERMITTED BY LAW, WHISTLE COMMUNICATIONS MAKES NO\n * REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, REGARDING THIS SOFTWARE,\n * INCLUDING WITHOUT LIMITATION, ANY AND ALL IMPLIED WARRANTIES OF\n * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT.\n * WHISTLE COMMUNICATIONS DOES NOT WARRANT, GUARANTEE, OR MAKE ANY\n * REPRESENTATIONS REGARDING THE USE OF, OR THE RESULTS OF THE USE OF THIS\n * SOFTWARE IN TERMS OF ITS CORRECTNESS, ACCURACY, RELIABILITY OR OTHERWISE.\n * IN NO EVENT SHALL WHISTLE COMMUNICATIONS BE LIABLE FOR ANY DAMAGES\n * RESULTING FROM OR ARISING OUT OF ANY USE OF THIS SOFTWARE, INCLUDING\n * WITHOUT LIMITATION, ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,\n * PUNITIVE, OR CONSEQUENTIAL DAMAGES, PROCUREMENT OF SUBSTITUTE GOODS OR\n * SERVICES, LOSS OF USE, DATA OR PROFITS, HOWEVER CAUSED AND UNDER ANY\n * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF\n * THIS SOFTWARE, EVEN IF WHISTLE COMMUNICATIONS IS ADVISED OF THE POSSIBILITY\n * OF SUCH DAMAGE.\n *\n * Author: Archie Cobbs <archie@freebsd.org>\n *\n * $FreeBSD: release/9.0.0/sys/netgraph/ng_ksocket.h 151800 2005-10-28 14:41:28Z ru $\n * $Whistle: ng_ksocket.h,v 1.1 1999/11/16 20:04:40 archie Exp $\n */\n\n#ifndef _NETGRAPH_NG_KSOCKET_H_\n#define _NETGRAPH_NG_KSOCKET_H_\n\n#include <sys/socket.h>\n\n/* Node type name and magic cookie */\n#define NG_KSOCKET_NODE_TYPE\t\"ksocket\"\n#define NGM_KSOCKET_COOKIE\t942710669\n\n/* For NGM_KSOCKET_SETOPT and NGM_KSOCKET_GETOPT control messages */\nstruct ng_ksocket_sockopt {\n\tint32_t\t\tlevel;\t\t/* second arg of [gs]etsockopt() */\n\tint32_t\t\tname;\t\t/* third arg of [gs]etsockopt() */\n\tu_char\t\tvalue[];\t/* fourth arg of [gs]etsockopt() */\n};\n\n/* Max length socket option we can return via NGM_KSOCKET_GETOPT\n   XXX This should not be necessary, we should dynamically size\n   XXX the response. Until then.. */\n#define NG_KSOCKET_MAX_OPTLEN\t1024\n\n/* Keep this in sync with the above structure definition */\n#define NG_KSOCKET_SOCKOPT_INFO(svtype)\t{\t\t\t\\\n\t  { \"level\",\t\t&ng_parse_int32_type\t},\t\\\n\t  { \"name\",\t\t&ng_parse_int32_type\t},\t\\\n\t  { \"value\",\t\t(svtype)\t\t},\t\\\n\t  { NULL }\t\t\t\t\t\t\\\n}\n\n/* For NGM_KSOCKET_ACCEPT control message responses */\nstruct ng_ksocket_accept {\n\tu_int32_t\tnodeid;\t\t/* node ID of connected ksocket */\n\tstruct sockaddr\taddr;\t\t/* peer's address (variable length) */\n};\n\n/* Keep this in sync with the above structure definition */\n#define\tNGM_KSOCKET_ACCEPT_INFO {\t\t\t\t\t\\\n\t  { \"nodeid\",\t\t&ng_parse_hint32_type\t\t  },\t\\\n\t  { \"addr\",\t\t&ng_ksocket_generic_sockaddr_type },\t\\\n\t  { NULL }\t\t\t\t\t\t\t\\\n}\n\n/* Netgraph commands */\nenum {\n\tNGM_KSOCKET_BIND = 1,\n\tNGM_KSOCKET_LISTEN,\n\tNGM_KSOCKET_ACCEPT,\n\tNGM_KSOCKET_CONNECT,\n\tNGM_KSOCKET_GETNAME,\n\tNGM_KSOCKET_GETPEERNAME,\n\tNGM_KSOCKET_SETOPT,\n\tNGM_KSOCKET_GETOPT,\n};\n\n#ifdef _KERNEL\n\n/* Structure for sockaddr tag */\nstruct sa_tag {\n\tstruct m_tag\ttag;\n\tng_ID_t\t\tid;\n\tstruct sockaddr\tsa;\n};\n\n/* Tag information ID's */\n#define NG_KSOCKET_TAG_SOCKADDR\t1\t/* data is struct sockaddr */\n\n#endif /* _KERNEL */\n#endif /* _NETGRAPH_NG_KSOCKET_H_ */\n"
  },
  {
    "path": "freebsd-headers/netgraph/ng_l2tp.h",
    "content": "/*-\n * Copyright (c) 2001-2002 Packet Design, LLC.\n * All rights reserved.\n * \n * Subject to the following obligations and disclaimer of warranty,\n * use and redistribution of this software, in source or object code\n * forms, with or without modifications are expressly permitted by\n * Packet Design; provided, however, that:\n * \n *    (i)  Any and all reproductions of the source or object code\n *         must include the copyright notice above and the following\n *         disclaimer of warranties; and\n *    (ii) No rights are granted, in any manner or form, to use\n *         Packet Design trademarks, including the mark \"PACKET DESIGN\"\n *         on advertising, endorsements, or otherwise except as such\n *         appears in the above copyright notice or in the software.\n * \n * THIS SOFTWARE IS BEING PROVIDED BY PACKET DESIGN \"AS IS\", AND\n * TO THE MAXIMUM EXTENT PERMITTED BY LAW, PACKET DESIGN MAKES NO\n * REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, REGARDING\n * THIS SOFTWARE, INCLUDING WITHOUT LIMITATION, ANY AND ALL IMPLIED\n * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE,\n * OR NON-INFRINGEMENT.  PACKET DESIGN DOES NOT WARRANT, GUARANTEE,\n * OR MAKE ANY REPRESENTATIONS REGARDING THE USE OF, OR THE RESULTS\n * OF THE USE OF THIS SOFTWARE IN TERMS OF ITS CORRECTNESS, ACCURACY,\n * RELIABILITY OR OTHERWISE.  IN NO EVENT SHALL PACKET DESIGN BE\n * LIABLE FOR ANY DAMAGES RESULTING FROM OR ARISING OUT OF ANY USE\n * OF THIS SOFTWARE, INCLUDING WITHOUT LIMITATION, ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, PUNITIVE, OR CONSEQUENTIAL\n * DAMAGES, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, LOSS OF\n * USE, DATA OR PROFITS, HOWEVER CAUSED AND UNDER ANY THEORY OF\n * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF\n * THE USE OF THIS SOFTWARE, EVEN IF PACKET DESIGN IS ADVISED OF\n * THE POSSIBILITY OF SUCH DAMAGE.\n * \n * Author: Archie Cobbs <archie@freebsd.org>\n *\n * $FreeBSD: release/9.0.0/sys/netgraph/ng_l2tp.h 139823 2005-01-07 01:45:51Z imp $\n */\n\n#ifndef _NETGRAPH_NG_L2TP_H_\n#define _NETGRAPH_NG_L2TP_H_\n\n/* Node type name and magic cookie */\n#define NG_L2TP_NODE_TYPE\t\"l2tp\"\n#define NGM_L2TP_COOKIE\t\t1091515793\n\n/* Hook names */\n#define NG_L2TP_HOOK_CTRL\t\"ctrl\"\t\t/* control channel hook */\n#define NG_L2TP_HOOK_LOWER\t\"lower\"\t\t/* hook to lower layers */\n\n/* Session hooks: prefix plus hex session ID, e.g., \"session_3e14\" */\n#define NG_L2TP_HOOK_SESSION_P\t\"session_\"\t/* session data hook (prefix) */\n#define NG_L2TP_HOOK_SESSION_F\t\"session_%04x\"\t/* session data hook (format) */\n\n/* Set intial sequence numbers to not yet enabled node. */\nstruct ng_l2tp_seq_config {\n\tu_int16_t\tns;\t\t/* sequence number to send next */\n\tu_int16_t\tnr;\t\t/* sequence number to be recved next */\n\tu_int16_t\track;\t\t/* last 'nr' received */\n\tu_int16_t\txack;\t\t/* last 'nr' sent */\n};\n\n/* Keep this in sync with the above structure definition. */\n#define\tNG_L2TP_SEQ_CONFIG_TYPE_INFO\t{\t\t\t\\\n\t  { \"ns\",\t\t&ng_parse_uint16_type\t},\t\\\n\t  { \"nr\",\t\t&ng_parse_uint16_type\t},\t\\\n\t  { NULL }\t\t\t\t\t\t\\\n}\n\n/* Configuration for a node */\nstruct ng_l2tp_config {\n\tu_char\t\tenabled;\t/* enables traffic flow */\n\tu_char\t\tmatch_id;\t/* tunnel id must match 'tunnel_id' */\n\tu_int16_t\ttunnel_id;\t/* local tunnel id */\n\tu_int16_t\tpeer_id;\t/* peer's tunnel id */\n\tu_int16_t\tpeer_win;\t/* peer's max recv window size */\n\tu_int16_t\trexmit_max;\t/* max retransmits before failure */\n\tu_int16_t\trexmit_max_to;\t/* max delay between retransmits */\n};\n\n/* Keep this in sync with the above structure definition */\n#define NG_L2TP_CONFIG_TYPE_INFO\t{\t\t\t\\\n\t  { \"enabled\",\t\t&ng_parse_uint8_type\t},\t\\\n\t  { \"match_id\",\t\t&ng_parse_uint8_type\t},\t\\\n\t  { \"tunnel_id\",\t&ng_parse_hint16_type\t},\t\\\n\t  { \"peer_id\",\t\t&ng_parse_hint16_type\t},\t\\\n\t  { \"peer_win\",\t\t&ng_parse_uint16_type\t},\t\\\n\t  { \"rexmit_max\",\t&ng_parse_uint16_type\t},\t\\\n\t  { \"rexmit_max_to\",\t&ng_parse_uint16_type\t},\t\\\n\t  { NULL }\t\t\t\t\t\t\\\n}\n\n/* Configuration for a session hook */\nstruct ng_l2tp_sess_config {\n\tu_int16_t\tsession_id;\t/* local session id */\n\tu_int16_t\tpeer_id;\t/* peer's session id */\n\tu_char\t\tcontrol_dseq;\t/* whether we control data sequencing */\n\tu_char\t\tenable_dseq;\t/* whether to enable data sequencing */\n\tu_char\t\tinclude_length;\t/* whether to include length field */\n};\n\n/* Keep this in sync with the above structure definition */\n#define NG_L2TP_SESS_CONFIG_TYPE_INFO\t{\t\t\t\\\n\t  { \"session_id\",\t&ng_parse_hint16_type\t},\t\\\n\t  { \"peer_id\",\t\t&ng_parse_hint16_type\t},\t\\\n\t  { \"control_dseq\",\t&ng_parse_uint8_type\t},\t\\\n\t  { \"enable_dseq\",\t&ng_parse_uint8_type\t},\t\\\n\t  { \"include_length\",\t&ng_parse_uint8_type\t},\t\\\n\t  { NULL }\t\t\t\t\t\t\\\n}\n\n/* Statistics struct */\nstruct ng_l2tp_stats {\n\tu_int32_t xmitPackets;\t\t/* number of packets xmit */\n\tu_int32_t xmitOctets;\t\t/* number of octets xmit */\n\tu_int32_t xmitZLBs;\t\t/* ack-only packets transmitted */\n\tu_int32_t xmitDrops;\t\t/* xmits dropped due to full window */\n\tu_int32_t xmitTooBig;\t\t/* ctrl pkts dropped because too big */\n\tu_int32_t xmitInvalid;\t\t/* ctrl packets with no session ID */\n\tu_int32_t xmitDataTooBig;\t/* data pkts dropped because too big */\n\tu_int32_t xmitRetransmits;\t/* retransmitted packets */\n\tu_int32_t recvPackets;\t\t/* number of packets rec'd */\n\tu_int32_t recvOctets;\t\t/* number of octets rec'd */\n\tu_int32_t recvRunts;\t\t/* too short packets rec'd */\n\tu_int32_t recvInvalid;\t\t/* invalid packets rec'd */\n\tu_int32_t recvWrongTunnel;\t/* packets rec'd with wrong tunnel id */\n\tu_int32_t recvUnknownSID;\t/* pkts rec'd with unknown session id */\n\tu_int32_t recvBadAcks;\t\t/* ctrl pkts rec'd with invalid 'nr' */\n\tu_int32_t recvOutOfOrder;\t/* out of order ctrl pkts rec'd */\n\tu_int32_t recvDuplicates;\t/* duplicate ctrl pkts rec'd */\n\tu_int32_t recvDataDrops;\t/* dup/out of order data pkts rec'd */\n\tu_int32_t recvZLBs;\t\t/* ack-only packets rec'd */\n\tu_int32_t memoryFailures;\t/* times we couldn't allocate memory */\n};\n\n/* Keep this in sync with the above structure definition */\n#define NG_L2TP_STATS_TYPE_INFO\t{\t\t\t\\\n\t  { \"xmitPackets\",\t&ng_parse_uint32_type\t},\t\\\n\t  { \"xmitOctets\",\t&ng_parse_uint32_type\t},\t\\\n\t  { \"xmitZLBs\",\t\t&ng_parse_uint32_type\t},\t\\\n\t  { \"xmitDrops\",\t&ng_parse_uint32_type\t},\t\\\n\t  { \"xmitTooBig\",\t&ng_parse_uint32_type\t},\t\\\n\t  { \"xmitInvalid\",\t&ng_parse_uint32_type\t},\t\\\n\t  { \"xmitDataTooBig\",\t&ng_parse_uint32_type\t},\t\\\n\t  { \"xmitRetransmits\",\t&ng_parse_uint32_type\t},\t\\\n\t  { \"recvPackets\",\t&ng_parse_uint32_type\t},\t\\\n\t  { \"recvOctets\",\t&ng_parse_uint32_type\t},\t\\\n\t  { \"recvRunts\",\t&ng_parse_uint32_type\t},\t\\\n\t  { \"recvInvalid\",\t&ng_parse_uint32_type\t},\t\\\n\t  { \"recvWrongTunnel\",\t&ng_parse_uint32_type\t},\t\\\n\t  { \"recvUnknownSID\",\t&ng_parse_uint32_type\t},\t\\\n\t  { \"recvBadAcks\",\t&ng_parse_uint32_type\t},\t\\\n\t  { \"recvOutOfOrder\",\t&ng_parse_uint32_type\t},\t\\\n\t  { \"recvDuplicates\",\t&ng_parse_uint32_type\t},\t\\\n\t  { \"recvDataDrops\",\t&ng_parse_uint32_type\t},\t\\\n\t  { \"recvZLBs\",\t\t&ng_parse_uint32_type\t},\t\\\n\t  { \"memoryFailures\",\t&ng_parse_uint32_type\t},\t\\\n\t  { NULL }\t\t\t\t\t\t\\\n}\n\n/* Session statistics struct. */\nstruct ng_l2tp_session_stats {\n\tu_int64_t xmitPackets;\t\t/* number of packets xmit */\n\tu_int64_t xmitOctets;\t\t/* number of octets xmit */\n\tu_int64_t recvPackets;\t\t/* number of packets received */\n\tu_int64_t recvOctets;\t\t/* number of octets received */\n};\n\n/* Keep this in sync with the above structure definition. */\n#define NG_L2TP_SESSION_STATS_TYPE_INFO\t{\t\t\t\\\n\t  { \"xmitPackets\",\t&ng_parse_uint64_type\t},\t\\\n\t  { \"xmitOctets\",\t&ng_parse_uint64_type\t},\t\\\n\t  { \"recvPackets\",\t&ng_parse_uint64_type\t},\t\\\n\t  { \"recvOctets\",\t&ng_parse_uint64_type\t},\t\\\n\t  { NULL }\t\t\t\t\t\t\\\n}\n\n/* Netgraph commands */\nenum {\n\tNGM_L2TP_SET_CONFIG = 1,\t/* supply a struct ng_l2tp_config */\n\tNGM_L2TP_GET_CONFIG,\t\t/* returns a struct ng_l2tp_config */\n\tNGM_L2TP_SET_SESS_CONFIG,\t/* supply struct ng_l2tp_sess_config */\n\tNGM_L2TP_GET_SESS_CONFIG,\t/* supply a session id (u_int16_t) */\n\tNGM_L2TP_GET_STATS,\t\t/* returns struct ng_l2tp_stats */\n\tNGM_L2TP_CLR_STATS,\t\t/* clears stats */\n\tNGM_L2TP_GETCLR_STATS,\t\t/* returns & clears stats */\n\tNGM_L2TP_GET_SESSION_STATS,\t/* returns session stats */\n\tNGM_L2TP_CLR_SESSION_STATS,\t/* clears session stats */\n\tNGM_L2TP_GETCLR_SESSION_STATS,\t/* returns & clears session stats */\n\tNGM_L2TP_ACK_FAILURE,\t\t/* sent *from* node after ack timeout */\n\tNGM_L2TP_SET_SEQ\t\t/* supply a struct ng_l2tp_seq_config */\n};\n\n#endif /* _NETGRAPH_NG_L2TP_H_ */\n"
  },
  {
    "path": "freebsd-headers/netgraph/ng_lmi.h",
    "content": "/*\n * ng_lmi.h\n */\n\n/*-\n * Copyright (c) 1996-1999 Whistle Communications, Inc.\n * All rights reserved.\n * \n * Subject to the following obligations and disclaimer of warranty, use and\n * redistribution of this software, in source or object code forms, with or\n * without modifications are expressly permitted by Whistle Communications;\n * provided, however, that:\n * 1. Any and all reproductions of the source or object code must include the\n *    copyright notice above and the following disclaimer of warranties; and\n * 2. No rights are granted, in any manner or form, to use Whistle\n *    Communications, Inc. trademarks, including the mark \"WHISTLE\n *    COMMUNICATIONS\" on advertising, endorsements, or otherwise except as\n *    such appears in the above copyright notice or in the software.\n * \n * THIS SOFTWARE IS BEING PROVIDED BY WHISTLE COMMUNICATIONS \"AS IS\", AND\n * TO THE MAXIMUM EXTENT PERMITTED BY LAW, WHISTLE COMMUNICATIONS MAKES NO\n * REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, REGARDING THIS SOFTWARE,\n * INCLUDING WITHOUT LIMITATION, ANY AND ALL IMPLIED WARRANTIES OF\n * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT.\n * WHISTLE COMMUNICATIONS DOES NOT WARRANT, GUARANTEE, OR MAKE ANY\n * REPRESENTATIONS REGARDING THE USE OF, OR THE RESULTS OF THE USE OF THIS\n * SOFTWARE IN TERMS OF ITS CORRECTNESS, ACCURACY, RELIABILITY OR OTHERWISE.\n * IN NO EVENT SHALL WHISTLE COMMUNICATIONS BE LIABLE FOR ANY DAMAGES\n * RESULTING FROM OR ARISING OUT OF ANY USE OF THIS SOFTWARE, INCLUDING\n * WITHOUT LIMITATION, ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,\n * PUNITIVE, OR CONSEQUENTIAL DAMAGES, PROCUREMENT OF SUBSTITUTE GOODS OR\n * SERVICES, LOSS OF USE, DATA OR PROFITS, HOWEVER CAUSED AND UNDER ANY\n * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF\n * THIS SOFTWARE, EVEN IF WHISTLE COMMUNICATIONS IS ADVISED OF THE POSSIBILITY\n * OF SUCH DAMAGE.\n *\n * Author: Archie Cobbs <archie@freebsd.org>\n *\n * $FreeBSD: release/9.0.0/sys/netgraph/ng_lmi.h 139823 2005-01-07 01:45:51Z imp $\n * $Whistle: ng_lmi.h,v 1.9 1999/01/20 00:22:13 archie Exp $\n */\n\n#ifndef _NETGRAPH_NG_LMI_H_\n#define _NETGRAPH_NG_LMI_H_\n\n/* Node type name and magic cookie */\n#define NG_LMI_NODE_TYPE\t\t\"lmi\"\n#define NGM_LMI_COOKIE\t\t\t867184133\n\n/* My hook names */\n#define NG_LMI_HOOK_DEBUG\t\t\"debug\"\n#define NG_LMI_HOOK_ANNEXA\t\t\"annexA\"\n#define NG_LMI_HOOK_ANNEXD\t\t\"annexD\"\n#define NG_LMI_HOOK_GROUPOF4\t\t\"group4\"\n#define NG_LMI_HOOK_AUTO0\t\t\"auto0\"\n#define NG_LMI_HOOK_AUTO1023\t\t\"auto1023\"\n\n/* Netgraph commands */\nenum {\n\tNGM_LMI_GET_STATUS = 1,\n};\n\n#define NGM_LMI_STAT_ARYSIZE\t\t(1024/8)\n\nstruct nglmistat {\n\tu_char  proto[12];\t/* Active proto (same as hook name) */\n\tu_char  hook[12];\t/* Active hook */\n\tu_char  fixed;\t\t/* Set to fixed LMI mode */\n\tu_char  autod;\t\t/* Currently auto-detecting */\n\tu_char  seen[NGM_LMI_STAT_ARYSIZE];\t/* DLCIs ever seen */\n\tu_char  up[NGM_LMI_STAT_ARYSIZE];\t/* DLCIs currently up */\n};\n\n/* Some default values */\n#define NG_LMI_KEEPALIVE_RATE\t\t10\t/* seconds per keepalive */\n#define NG_LMI_POLL_RATE\t\t3\t/* faster when AUTO polling */\n#define NG_LMI_SEQ_PER_FULL\t\t5\t/* keepalives per full status */\n#define NG_LMI_LMI_PRIORITY\t\t64\t/* priority for LMI data */\n\n#endif /* _NETGRAPH_NG_LMI_H_ */\n"
  },
  {
    "path": "freebsd-headers/netgraph/ng_message.h",
    "content": "/*\n * ng_message.h\n */\n\n/*-\n * Copyright (c) 1996-1999 Whistle Communications, Inc.\n * All rights reserved.\n * \n * Subject to the following obligations and disclaimer of warranty, use and\n * redistribution of this software, in source or object code forms, with or\n * without modifications are expressly permitted by Whistle Communications;\n * provided, however, that:\n * 1. Any and all reproductions of the source or object code must include the\n *    copyright notice above and the following disclaimer of warranties; and\n * 2. No rights are granted, in any manner or form, to use Whistle\n *    Communications, Inc. trademarks, including the mark \"WHISTLE\n *    COMMUNICATIONS\" on advertising, endorsements, or otherwise except as\n *    such appears in the above copyright notice or in the software.\n * \n * THIS SOFTWARE IS BEING PROVIDED BY WHISTLE COMMUNICATIONS \"AS IS\", AND\n * TO THE MAXIMUM EXTENT PERMITTED BY LAW, WHISTLE COMMUNICATIONS MAKES NO\n * REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, REGARDING THIS SOFTWARE,\n * INCLUDING WITHOUT LIMITATION, ANY AND ALL IMPLIED WARRANTIES OF\n * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT.\n * WHISTLE COMMUNICATIONS DOES NOT WARRANT, GUARANTEE, OR MAKE ANY\n * REPRESENTATIONS REGARDING THE USE OF, OR THE RESULTS OF THE USE OF THIS\n * SOFTWARE IN TERMS OF ITS CORRECTNESS, ACCURACY, RELIABILITY OR OTHERWISE.\n * IN NO EVENT SHALL WHISTLE COMMUNICATIONS BE LIABLE FOR ANY DAMAGES\n * RESULTING FROM OR ARISING OUT OF ANY USE OF THIS SOFTWARE, INCLUDING\n * WITHOUT LIMITATION, ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,\n * PUNITIVE, OR CONSEQUENTIAL DAMAGES, PROCUREMENT OF SUBSTITUTE GOODS OR\n * SERVICES, LOSS OF USE, DATA OR PROFITS, HOWEVER CAUSED AND UNDER ANY\n * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF\n * THIS SOFTWARE, EVEN IF WHISTLE COMMUNICATIONS IS ADVISED OF THE POSSIBILITY\n * OF SUCH DAMAGE.\n *\n * Author: Julian Elischer <julian@freebsd.org>\n *\n * $FreeBSD: release/9.0.0/sys/netgraph/ng_message.h 193812 2009-06-09 07:07:20Z imp $\n * $Whistle: ng_message.h,v 1.12 1999/01/25 01:17:44 archie Exp $\n */\n\n#ifndef _NETGRAPH_NG_MESSAGE_H_\n#define _NETGRAPH_NG_MESSAGE_H_\n\n/* ASCII string size limits */\n#define\tNG_TYPESIZ\t32\t/* max type name len (including null) */\n#define\tNG_HOOKSIZ\t32\t/* max hook name len (including null) */\n#define\tNG_NODESIZ\t32\t/* max node name len (including null) */\n#define\tNG_PATHSIZ\t512\t/* max path len (including null) */\n#define\tNG_CMDSTRSIZ\t32\t/* max command string (including null) */\n\n#define NG_TEXTRESPONSE 1024\t/* allow this length for a text response */\n\n/* A netgraph message */\nstruct ng_mesg {\n\tstruct\tng_msghdr {\n\t\tu_char\t\tversion;\t\t/*  == NGM_VERSION */\n\t\tu_char\t\tspare;\t\t\t/* pad to 4 bytes */\n\t\tu_int16_t\tspare2;\t\n\t\tu_int32_t\targlen;\t\t\t/* length of data */\n\t\tu_int32_t\tcmd;\t\t\t/* command identifier */\n\t\tu_int32_t\tflags;\t\t\t/* message status */\n\t\tu_int32_t\ttoken;\t\t\t/* match with reply */\n\t\tu_int32_t\ttypecookie;\t\t/* node's type cookie */\n\t\tu_char\t\tcmdstr[NG_CMDSTRSIZ];\t/* cmd string + \\0 */\n\t} header;\n\tchar\tdata[];\t\t\t/* placeholder for actual data */\n};\n\n/* This command is guaranteed to not alter data (or'd into the command). */\n#define NGM_READONLY\t0x10000000\n/* This command is guaranteed to have a reply (or'd into the command). */\n#define NGM_HASREPLY\t0x20000000\n\n/* Keep this in sync with the above structure definition */\n#define NG_GENERIC_NG_MESG_INFO(dtype)\t{\t\t\t\\\n\t  { \"version\",\t\t&ng_parse_uint8_type\t},\t\\\n\t  { \"spare\",\t\t&ng_parse_uint8_type\t},\t\\\n\t  { \"spare2\",\t\t&ng_parse_uint16_type\t},\t\\\n\t  { \"arglen\",\t\t&ng_parse_uint32_type\t},\t\\\n\t  { \"cmd\",\t\t&ng_parse_uint32_type\t},\t\\\n\t  { \"flags\",\t\t&ng_parse_hint32_type\t},\t\\\n\t  { \"token\",\t\t&ng_parse_uint32_type\t},\t\\\n\t  { \"typecookie\",\t&ng_parse_uint32_type\t},\t\\\n\t  { \"cmdstr\",\t\t&ng_parse_cmdbuf_type\t},\t\\\n\t  { \"data\",\t\t(dtype)\t\t\t},\t\\\n\t  { NULL }\t\t\t\t\t\t\\\n}\n\n/*\n * Netgraph message header compatibility field\n * Interfaces within the kernel are defined by a different \n * value (see NG_ABI_VERSION in netgraph.h)\n */\n#define NG_VERSION\t8\n\n/* Flags field flags */\n#define NGF_ORIG\t0x00000000\t/* the msg is the original request */\n#define NGF_RESP\t0x00000001\t/* the message is a response */\n\n/* Type of a unique node ID. */\n#define ng_ID_t uint32_t\n\n/*\n * Here we describe the \"generic\" messages that all nodes inherently\n * understand. With the exception of NGM_TEXT_STATUS, these are handled\n * automatically by the base netgraph code.\n */\n\n/* Generic message type cookie */\n#define NGM_GENERIC_COOKIE\t1137070366\n\n/* Generic messages defined for this type cookie. */\nenum {\n\tNGM_SHUTDOWN\t= 1,\t/* Shut down node. */\n\tNGM_MKPEER\t= 2,\t/* Create and attach a peer node. */\n\tNGM_CONNECT\t= 3,\t/* Connect two nodes. */\n\tNGM_NAME\t= 4,\t/* Give a node a name. */\n\tNGM_RMHOOK\t= 5,\t/* Break a connection between two nodes. */\n\n\t/* Get nodeinfo for target. */\n\tNGM_NODEINFO\t= (6|NGM_READONLY|NGM_HASREPLY),\n\t/* Get list of hooks on node. */\n\tNGM_LISTHOOKS\t= (7|NGM_READONLY|NGM_HASREPLY),\n\t/* List globally named nodes. */\n\tNGM_LISTNAMES\t= (8|NGM_READONLY|NGM_HASREPLY),\n\t/* List all nodes. */\n\tNGM_LISTNODES\t= (9|NGM_READONLY|NGM_HASREPLY),\n\t/* List installed node types. */\n\tNGM_LISTTYPES\t= (10|NGM_READONLY|NGM_HASREPLY),\n\t/* (optional) Get text status. */\n\tNGM_TEXT_STATUS\t= (11|NGM_READONLY|NGM_HASREPLY),\n\t/* Convert struct ng_mesg to ASCII. */\n\tNGM_BINARY2ASCII= (12|NGM_READONLY|NGM_HASREPLY),\n\t/* Convert ASCII to struct ng_mesg. */\n\tNGM_ASCII2BINARY= (13|NGM_READONLY|NGM_HASREPLY),\n\t/* (optional) Get/set text config. */\n\tNGM_TEXT_CONFIG\t= 14,\n};\n\n/*\n * Flow control and intra node control messages.\n * These are routed between nodes to allow flow control and to allow\n * events to be passed around the graph. \n * There will be some form of default handling for these but I \n * do not yet know what it is..\n */\n\n/* Generic message type cookie */\n#define NGM_FLOW_COOKIE\t851672669 /* temp for debugging */\n\n/* Upstream messages */\n#define NGM_LINK_IS_UP\t\t32\t/* e.g. carrier found - no data */\n#define NGM_LINK_IS_DOWN\t33\t/* carrier lost, includes queue state */\n#define NGM_HIGH_WATER_PASSED\t34\t/* includes queue state */\n#define NGM_LOW_WATER_PASSED\t35\t/* includes queue state */\n#define NGM_SYNC_QUEUE_STATE\t36\t/* sync response from sending packet */\n\n/* Downstream messages */\n#define NGM_DROP_LINK\t\t41\t/* drop DTR, etc. - stay in the graph */\n#define NGM_RAISE_LINK\t\t42\t/* if you previously dropped it */\n#define NGM_FLUSH_QUEUE\t\t43\t/* no data */\n#define NGM_GET_BANDWIDTH\t(44|NGM_READONLY)\t/* either real or measured */\n#define NGM_SET_XMIT_Q_LIMITS\t45\t/* includes queue state */\n#define NGM_GET_XMIT_Q_LIMITS\t(46|NGM_READONLY)\t/* returns queue state */\n#define NGM_MICROMANAGE\t\t47\t/* We want sync. queue state\n\t\t\t\t\t\treply for each packet sent */\n#define NGM_SET_FLOW_MANAGER\t48\t/* send flow control here */ \n/* Structure used for NGM_MKPEER */\nstruct ngm_mkpeer {\n\tchar\ttype[NG_TYPESIZ];\t\t/* peer type */\n\tchar\tourhook[NG_HOOKSIZ];\t\t/* hook name */\n\tchar\tpeerhook[NG_HOOKSIZ];\t\t/* peer hook name */\n};\n\n/* Keep this in sync with the above structure definition */\n#define NG_GENERIC_MKPEER_INFO()\t{\t\t\t\\\n\t  { \"type\",\t\t&ng_parse_typebuf_type\t},\t\\\n\t  { \"ourhook\",\t\t&ng_parse_hookbuf_type\t},\t\\\n\t  { \"peerhook\",\t\t&ng_parse_hookbuf_type\t},\t\\\n\t  { NULL }\t\t\t\t\t\t\\\n}\n\n/* Structure used for NGM_CONNECT */\nstruct ngm_connect {\n\tchar\tpath[NG_PATHSIZ];\t\t/* peer path */\n\tchar\tourhook[NG_HOOKSIZ];\t\t/* hook name */\n\tchar\tpeerhook[NG_HOOKSIZ];\t\t/* peer hook name */\n};\n\n/* Keep this in sync with the above structure definition */\n#define NG_GENERIC_CONNECT_INFO()\t{\t\t\t\\\n\t  { \"path\",\t\t&ng_parse_pathbuf_type\t},\t\\\n\t  { \"ourhook\",\t\t&ng_parse_hookbuf_type\t},\t\\\n\t  { \"peerhook\",\t\t&ng_parse_hookbuf_type\t},\t\\\n\t  { NULL }\t\t\t\t\t\t\\\n}\n\n/* Structure used for NGM_NAME */\nstruct ngm_name {\n\tchar\tname[NG_NODESIZ];\t\t\t/* node name */\n};\n\n/* Keep this in sync with the above structure definition */\n#define NG_GENERIC_NAME_INFO()\t{\t\t\t\t\\\n\t  { \"name\",\t\t&ng_parse_nodebuf_type\t},\t\\\n\t  { NULL }\t\t\t\t\t\t\\\n}\n\n/* Structure used for NGM_RMHOOK */\nstruct ngm_rmhook {\n\tchar\tourhook[NG_HOOKSIZ];\t\t/* hook name */\n};\n\n/* Keep this in sync with the above structure definition */\n#define NG_GENERIC_RMHOOK_INFO()\t{\t\t\t\\\n\t  { \"hook\",\t\t&ng_parse_hookbuf_type\t},\t\\\n\t  { NULL }\t\t\t\t\t\t\\\n}\n\n/* Structure used for NGM_NODEINFO */\nstruct nodeinfo {\n\tchar\t\tname[NG_NODESIZ];\t/* node name (if any) */\n        char    \ttype[NG_TYPESIZ];\t/* peer type */\n\tng_ID_t\t\tid;\t\t\t/* unique identifier */\n\tu_int32_t\thooks;\t\t\t/* number of active hooks */\n};\n\n/* Keep this in sync with the above structure definition */\n#define NG_GENERIC_NODEINFO_INFO()\t{\t\t\t\\\n\t  { \"name\",\t\t&ng_parse_nodebuf_type\t},\t\\\n\t  { \"type\",\t\t&ng_parse_typebuf_type\t},\t\\\n\t  { \"id\",\t\t&ng_parse_hint32_type\t},\t\\\n\t  { \"hooks\",\t\t&ng_parse_uint32_type\t},\t\\\n\t  { NULL }\t\t\t\t\t\t\\\n}\n\n/* Structure used for NGM_LISTHOOKS */\nstruct linkinfo {\n\tchar\t\tourhook[NG_HOOKSIZ];\t/* hook name */\n\tchar\t\tpeerhook[NG_HOOKSIZ];\t/* peer hook */\n\tstruct nodeinfo\tnodeinfo;\n};\n\n/* Keep this in sync with the above structure definition */\n#define NG_GENERIC_LINKINFO_INFO(nitype)\t{\t\t\\\n\t  { \"ourhook\",\t\t&ng_parse_hookbuf_type\t},\t\\\n\t  { \"peerhook\",\t\t&ng_parse_hookbuf_type\t},\t\\\n\t  { \"nodeinfo\",\t\t(nitype)\t\t},\t\\\n\t  { NULL }\t\t\t\t\t\t\\\n}\n\nstruct hooklist {\n\tstruct nodeinfo nodeinfo;\t\t/* node information */\n\tstruct linkinfo link[];\t\t\t/* info about each hook */\n};\n\n/* Keep this in sync with the above structure definition */\n#define NG_GENERIC_HOOKLIST_INFO(nitype,litype)\t{\t\t\\\n\t  { \"nodeinfo\",\t\t(nitype)\t\t},\t\\\n\t  { \"linkinfo\",\t\t(litype)\t\t},\t\\\n\t  { NULL }\t\t\t\t\t\t\\\n}\n\n/* Structure used for NGM_LISTNAMES/NGM_LISTNODES */\nstruct namelist {\n\tu_int32_t\tnumnames;\n\tstruct nodeinfo\tnodeinfo[];\n};\n\n/* Keep this in sync with the above structure definition */\n#define NG_GENERIC_LISTNODES_INFO(niarraytype)\t{\t\t\\\n\t  { \"numnames\",\t\t&ng_parse_uint32_type\t},\t\\\n\t  { \"nodeinfo\",\t\t(niarraytype)\t\t},\t\\\n\t  { NULL }\t\t\t\t\t\t\\\n}\n\n/* Structure used for NGM_LISTTYPES */\nstruct typeinfo {\n\tchar\t\ttype_name[NG_TYPESIZ];\t/* name of type */\n\tu_int32_t\tnumnodes;\t\t/* number alive */\n};\n\n/* Keep this in sync with the above structure definition */\n#define NG_GENERIC_TYPEINFO_INFO()\t\t{\t\t\\\n\t  { \"typename\",\t\t&ng_parse_typebuf_type\t},\t\\\n\t  { \"numnodes\",\t\t&ng_parse_uint32_type\t},\t\\\n\t  { NULL }\t\t\t\t\t\t\\\n}\n\nstruct typelist {\n\tu_int32_t\tnumtypes;\n\tstruct typeinfo\ttypeinfo[];\n};\n\n/* Keep this in sync with the above structure definition */\n#define NG_GENERIC_TYPELIST_INFO(tiarraytype)\t{\t\t\\\n\t  { \"numtypes\",\t\t&ng_parse_uint32_type\t},\t\\\n\t  { \"typeinfo\",\t\t(tiarraytype)\t\t},\t\\\n\t  { NULL }\t\t\t\t\t\t\\\n}\n\nstruct ngm_bandwidth {\n\tu_int64_t\tnominal_in;\n\tu_int64_t\tseen_in;\n\tu_int64_t\tnominal_out;\n\tu_int64_t\tseen_out;\n};\n\n/* Keep this in sync with the above structure definition */\n#define NG_GENERIC_BANDWIDTH_INFO()\t{\t\t\t\\\n\t  { \"nominal_in\",\t&ng_parse_uint64_type\t},\t\\\n\t  { \"seen_in\",\t\t&ng_parse_uint64_type\t},\t\\\n\t  { \"nominal_out\",\t&ng_parse_uint64_type\t},\t\\\n\t  { \"seen_out\",\t\t&ng_parse_uint64_type\t},\t\\\n\t  { NULL }\t\t\t\t\t\t\\\n}\n\n/*\n * Information about a node's 'output' queue.\n * This is NOT the netgraph input queueing mechanism,\n * but rather any queue the node may implement internally\n * This has to consider ALTQ if we are to work with it.\n * As far as I can see, ALTQ counts PACKETS, not bytes.\n * If ALTQ has several queues and one has passed a watermark\n * we should have the priority of that queue be real (and not -1)\n * XXX ALTQ stuff is just an idea.....\n */\nstruct ngm_queue_state {\n\tu_int queue_priority; /* maybe only low-pri is full. -1 = all*/\n\tu_int\tmax_queuelen_bytes;\n\tu_int\tmax_queuelen_packets;\n\tu_int\tlow_watermark;\n\tu_int\thigh_watermark;\n\tu_int\tcurrent;\n};\n\n/* Keep this in sync with the above structure definition */\n#define NG_GENERIC_QUEUE_INFO()\t{\t\t\t\t\\\n\t  { \"max_queuelen_bytes\", &ng_parse_uint_type\t},\t\\\n\t  { \"max_queuelen_packets\", &ng_parse_uint_type\t},\t\\\n\t  { \"high_watermark\",\t&ng_parse_uint_type\t},\t\\\n\t  { \"low_watermark\",\t&ng_parse_uint_type\t},\t\\\n\t  { \"current\",\t\t&ng_parse_uint_type\t},\t\\\n\t  { NULL }\t\t\t\t\t\t\\\n}\n\n/* Tell a node who to send async flow control info to. */\nstruct flow_manager {\n\tng_ID_t\t\tid;\t\t\t/* unique identifier */\n};\n\n/* Keep this in sync with the above structure definition */\n#define NG_GENERIC_FLOW_MANAGER_INFO()\t{\t\t\t\\\n\t  { \"id\",\t\t&ng_parse_hint32_type\t},\t\\\n\t  { NULL }\t\t\t\t\t\t\\\n}\n\n\n/*\n * For netgraph nodes that are somehow associated with file descriptors\n * (e.g., a device that has a /dev entry and is also a netgraph node),\n * we define a generic ioctl for requesting the corresponding nodeinfo\n * structure and for assigning a name (if there isn't one already).\n *\n * For these to you need to also #include <sys/ioccom.h>.\n */\n\n#define NGIOCGINFO\t_IOR('N', 40, struct nodeinfo)\t/* get node info */\n#define NGIOCSETNAME\t_IOW('N', 41, struct ngm_name)\t/* set node name */\n\n#ifdef _KERNEL\n/*\n * Allocate and initialize a netgraph message \"msg\" with \"len\"\n * extra bytes of argument. Sets \"msg\" to NULL if fails.\n * Does not initialize token.\n */\n#define NG_MKMESSAGE(msg, cookie, cmdid, len, how)\t\t\t\\\n\tdo {\t\t\t\t\t\t\t\t\\\n\t  (msg) = malloc(sizeof(struct ng_mesg)\t\t\t\t\\\n\t    + (len), M_NETGRAPH_MSG, (how) | M_ZERO);\t\t\t\\\n\t  if ((msg) == NULL)\t\t\t\t\t\t\\\n\t    break;\t\t\t\t\t\t\t\\\n\t  (msg)->header.version = NG_VERSION;\t\t\t\t\\\n\t  (msg)->header.typecookie = (cookie);\t\t\t\t\\\n\t  (msg)->header.cmd = (cmdid);\t\t\t\t\t\\\n\t  (msg)->header.arglen = (len);\t\t\t\t\t\\\n\t  strncpy((msg)->header.cmdstr, #cmdid,\t\t\t\t\\\n\t    sizeof((msg)->header.cmdstr) - 1);\t\t\t\t\\\n\t} while (0)\n\n/*\n * Allocate and initialize a response \"rsp\" to a message \"msg\"\n * with \"len\" extra bytes of argument. Sets \"rsp\" to NULL if fails.\n */\n#define NG_MKRESPONSE(rsp, msg, len, how)\t\t\t\t\\\n\tdo {\t\t\t\t\t\t\t\t\\\n\t  (rsp) = malloc(sizeof(struct ng_mesg)\t\t\t\t\\\n\t    + (len), M_NETGRAPH_MSG, (how) | M_ZERO);\t\t\t\\\n\t  if ((rsp) == NULL)\t\t\t\t\t\t\\\n\t    break;\t\t\t\t\t\t\t\\\n\t  (rsp)->header.version = NG_VERSION;\t\t\t\t\\\n\t  (rsp)->header.arglen = (len);\t\t\t\t\t\\\n\t  (rsp)->header.token = (msg)->header.token;\t\t\t\\\n\t  (rsp)->header.typecookie = (msg)->header.typecookie;\t\t\\\n\t  (rsp)->header.cmd = (msg)->header.cmd;\t\t\t\\\n\t  bcopy((msg)->header.cmdstr, (rsp)->header.cmdstr,\t\t\\\n\t    sizeof((rsp)->header.cmdstr));\t\t\t\t\\\n\t  (rsp)->header.flags |= NGF_RESP;\t\t\t\t\\\n\t} while (0)\n\n/*\n * Make a copy of message. Sets \"copy\" to NULL if fails.\n */\n#define\tNG_COPYMESSAGE(copy, msg, how)\t\t\t\t\t\\\n\tdo {\t\t\t\t\t\t\t\t\\\n\t  (copy) = malloc(sizeof(struct ng_mesg)\t\t\t\\\n\t    + (msg)->header.arglen, M_NETGRAPH_MSG, (how) | M_ZERO);\t\\\n\t  if ((copy) == NULL)\t\t\t\t\t\t\\\n\t    break;\t\t\t\t\t\t\t\\\n\t  (copy)->header.version = NG_VERSION;\t\t\t\t\\\n\t  (copy)->header.arglen = (msg)->header.arglen;\t\t\t\\\n\t  (copy)->header.token = (msg)->header.token;\t\t\t\\\n\t  (copy)->header.typecookie = (msg)->header.typecookie;\t\t\\\n\t  (copy)->header.cmd = (msg)->header.cmd;\t\t\t\\\n\t  (copy)->header.flags = (msg)->header.flags;\t\t\t\\\n\t  bcopy((msg)->header.cmdstr, (copy)->header.cmdstr,\t\t\\\n\t    sizeof((copy)->header.cmdstr));\t\t\t\t\\\n\t  if ((msg)->header.arglen > 0)\t\t\t\t\t\\\n\t    bcopy((msg)->data, (copy)->data, (msg)->header.arglen);\t\\\n\t} while (0)\n\n#endif /* _KERNEL */\n\n#endif /* _NETGRAPH_NG_MESSAGE_H_ */\n"
  },
  {
    "path": "freebsd-headers/netgraph/ng_mppc.h",
    "content": "/*\n * ng_mppc.h\n */\n\n/*-\n * Copyright (c) 1996-2000 Whistle Communications, Inc.\n * All rights reserved.\n * \n * Subject to the following obligations and disclaimer of warranty, use and\n * redistribution of this software, in source or object code forms, with or\n * without modifications are expressly permitted by Whistle Communications;\n * provided, however, that:\n * 1. Any and all reproductions of the source or object code must include the\n *    copyright notice above and the following disclaimer of warranties; and\n * 2. No rights are granted, in any manner or form, to use Whistle\n *    Communications, Inc. trademarks, including the mark \"WHISTLE\n *    COMMUNICATIONS\" on advertising, endorsements, or otherwise except as\n *    such appears in the above copyright notice or in the software.\n * \n * THIS SOFTWARE IS BEING PROVIDED BY WHISTLE COMMUNICATIONS \"AS IS\", AND\n * TO THE MAXIMUM EXTENT PERMITTED BY LAW, WHISTLE COMMUNICATIONS MAKES NO\n * REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, REGARDING THIS SOFTWARE,\n * INCLUDING WITHOUT LIMITATION, ANY AND ALL IMPLIED WARRANTIES OF\n * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT.\n * WHISTLE COMMUNICATIONS DOES NOT WARRANT, GUARANTEE, OR MAKE ANY\n * REPRESENTATIONS REGARDING THE USE OF, OR THE RESULTS OF THE USE OF THIS\n * SOFTWARE IN TERMS OF ITS CORRECTNESS, ACCURACY, RELIABILITY OR OTHERWISE.\n * IN NO EVENT SHALL WHISTLE COMMUNICATIONS BE LIABLE FOR ANY DAMAGES\n * RESULTING FROM OR ARISING OUT OF ANY USE OF THIS SOFTWARE, INCLUDING\n * WITHOUT LIMITATION, ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,\n * PUNITIVE, OR CONSEQUENTIAL DAMAGES, PROCUREMENT OF SUBSTITUTE GOODS OR\n * SERVICES, LOSS OF USE, DATA OR PROFITS, HOWEVER CAUSED AND UNDER ANY\n * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF\n * THIS SOFTWARE, EVEN IF WHISTLE COMMUNICATIONS IS ADVISED OF THE POSSIBILITY\n * OF SUCH DAMAGE.\n *\n * Author: Archie Cobbs <archie@freebsd.org>\n *\n * $Whistle: ng_mppc.h,v 1.3 2000/02/12 01:17:22 archie Exp $\n * $FreeBSD: release/9.0.0/sys/netgraph/ng_mppc.h 139823 2005-01-07 01:45:51Z imp $\n */\n\n#ifndef _NETGRAPH_NG_MPPC_H_\n#define _NETGRAPH_NG_MPPC_H_\n\n/* Node type name and magic cookie */\n#define NG_MPPC_NODE_TYPE\t\"mppc\"\n#define NGM_MPPC_COOKIE\t\t942886745\n\n/* Hook names */\n#define NG_MPPC_HOOK_COMP\t\"comp\"\t\t/* compression hook */\n#define NG_MPPC_HOOK_DECOMP\t\"decomp\"\t/* decompression hook */\n\n/* Length of MPPE key */\n#define MPPE_KEY_LEN\t\t16\n\n/* Max expansion due to MPPC header and compression algorithm */\n#define MPPC_MAX_BLOWUP(n)\t((n) * 9 / 8 + 26)\n\n/* MPPC/MPPE PPP negotiation bits */\n#define MPPC_BIT\t\t0x00000001\t/* mppc compression bits */\n#define MPPE_40\t\t\t0x00000020\t/* use 40 bit key */\n#define MPPE_56\t\t\t0x00000080\t/* use 56 bit key */\n#define MPPE_128\t\t0x00000040\t/* use 128 bit key */\n#define MPPE_BITS\t\t0x000000e0\t/* mppe encryption bits */\n#define MPPE_STATELESS\t\t0x01000000\t/* use stateless mode */\n#define MPPC_VALID_BITS\t\t0x010000e1\t/* possibly valid bits */\n\n/* Config struct (per-direction) */\nstruct ng_mppc_config {\n\tu_char\t\tenable;\t\t\t/* enable */\n\tu_int32_t\tbits;\t\t\t/* config bits */\n\tu_char\t\tstartkey[MPPE_KEY_LEN];\t/* start key */\n};\n\n/* Netgraph commands */\nenum {\n\tNGM_MPPC_CONFIG_COMP = 1,\n\tNGM_MPPC_CONFIG_DECOMP,\n\tNGM_MPPC_RESETREQ,\t\t\t/* sent either way! */\n};\n\n#endif /* _NETGRAPH_NG_MPPC_H_ */\n\n"
  },
  {
    "path": "freebsd-headers/netgraph/ng_nat.h",
    "content": "/*-\n * Copyright 2005, Gleb Smirnoff <glebius@FreeBSD.org>\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/netgraph/ng_nat.h 176791 2008-03-04 11:10:54Z mav $\n */\n\n#define NG_NAT_NODE_TYPE    \"nat\"\n#define NGM_NAT_COOKIE      1107718711\n\n#define\tNG_NAT_HOOK_IN\t\"in\"\n#define\tNG_NAT_HOOK_OUT\t\"out\"\n\n/* Arguments for NGM_NAT_SET_MODE message */\nstruct ng_nat_mode {\n\tuint32_t\tflags;\n\tuint32_t\tmask;\n};\n\n/* Keep this in sync with the above structure definition */\n#define NG_NAT_MODE_INFO {\t\t\t\t\\\n\t  { \"flags\",\t&ng_parse_uint32_type\t},\t\\\n\t  { \"mask\",\t&ng_parse_uint32_type\t},\t\\\n\t  { NULL }\t\t\t\t\t\\\n}\n\n#define NG_NAT_LOG\t\t\t0x01\n#define NG_NAT_DENY_INCOMING\t\t0x02\n#define NG_NAT_SAME_PORTS\t\t0x04\n#define NG_NAT_UNREGISTERED_ONLY\t0x10\n#define NG_NAT_RESET_ON_ADDR_CHANGE\t0x20\n#define NG_NAT_PROXY_ONLY\t\t0x40\n#define NG_NAT_REVERSE\t\t\t0x80\n\n#define NG_NAT_DESC_LENGTH\t64\n#define NG_NAT_REDIRPROTO_ADDR\t(IPPROTO_MAX + 3) \t/* LibAlias' LINK_ADDR, also unused in in.h */\n\n/* Arguments for NGM_NAT_REDIRECT_PORT message */\nstruct ng_nat_redirect_port {\n\tstruct in_addr\tlocal_addr;\n\tstruct in_addr\talias_addr;\n\tstruct in_addr\tremote_addr;\n\tuint16_t\tlocal_port;\n\tuint16_t\talias_port;\n\tuint16_t\tremote_port;\n\tuint8_t\t\tproto;\n\tchar\t\tdescription[NG_NAT_DESC_LENGTH];\n};\n\n/* Keep this in sync with the above structure definition */\n#define NG_NAT_REDIRECT_PORT_TYPE_INFO(desctype) {\t\t\\\n\t  { \"local_addr\",\t&ng_parse_ipaddr_type\t},\t\\\n\t  { \"alias_addr\",\t&ng_parse_ipaddr_type\t},\t\\\n\t  { \"remote_addr\",\t&ng_parse_ipaddr_type\t},\t\\\n\t  { \"local_port\",\t&ng_parse_uint16_type\t},\t\\\n\t  { \"alias_port\",\t&ng_parse_uint16_type\t},\t\\\n\t  { \"remote_port\",\t&ng_parse_uint16_type\t},\t\\\n\t  { \"proto\",\t\t&ng_parse_uint8_type\t},\t\\\n\t  { \"description\",\t(desctype)\t\t},\t\\\n\t  { NULL }\t\t\t\t\t\t\\\n}\n\n/* Arguments for NGM_NAT_REDIRECT_ADDR message */\nstruct ng_nat_redirect_addr {\n\tstruct in_addr\tlocal_addr;\n\tstruct in_addr\talias_addr;\n\tchar\t\tdescription[NG_NAT_DESC_LENGTH];\n};\n\n/* Keep this in sync with the above structure definition */\n#define NG_NAT_REDIRECT_ADDR_TYPE_INFO(desctype) {\t\t\\\n\t  { \"local_addr\",\t&ng_parse_ipaddr_type\t},\t\\\n\t  { \"alias_addr\",\t&ng_parse_ipaddr_type\t},\t\\\n\t  { \"description\",\t(desctype)\t\t},\t\\\n\t  { NULL }\t\t\t\t\t\t\\\n}\n\n/* Arguments for NGM_NAT_REDIRECT_PROTO message */\nstruct ng_nat_redirect_proto {\n\tstruct in_addr\tlocal_addr;\n\tstruct in_addr\talias_addr;\n\tstruct in_addr\tremote_addr;\n\tuint8_t\t\tproto;\n\tchar\t\tdescription[NG_NAT_DESC_LENGTH];\n};\n\n/* Keep this in sync with the above structure definition */\n#define NG_NAT_REDIRECT_PROTO_TYPE_INFO(desctype) {\t\t\\\n\t  { \"local_addr\",\t&ng_parse_ipaddr_type\t},\t\\\n\t  { \"alias_addr\",\t&ng_parse_ipaddr_type\t},\t\\\n\t  { \"remote_addr\",\t&ng_parse_ipaddr_type\t},\t\\\n\t  { \"proto\",\t\t&ng_parse_uint8_type\t},\t\\\n\t  { \"description\",\t(desctype)\t\t},\t\\\n\t  { NULL }\t\t\t\t\t\t\\\n}\n\n/* Arguments for NGM_NAT_ADD_SERVER message */\nstruct ng_nat_add_server {\n\tuint32_t\tid;\n\tstruct in_addr\taddr;\n\tuint16_t\tport;\n};\n\n/* Keep this in sync with the above structure definition */\n#define NG_NAT_ADD_SERVER_TYPE_INFO {\t\t\t\t\\\n\t  { \"id\",\t\t&ng_parse_uint32_type\t},\t\\\n\t  { \"addr\",\t\t&ng_parse_ipaddr_type\t},\t\\\n\t  { \"port\",\t\t&ng_parse_uint16_type\t},\t\\\n\t  { NULL }\t\t\t\t\t\t\\\n}\n\n/* List entry of array returned in NGM_NAT_LIST_REDIRECTS message */\nstruct ng_nat_listrdrs_entry {\n\tuint32_t\tid;\t\t/* Anything except zero */\n\tstruct in_addr\tlocal_addr;\n\tstruct in_addr\talias_addr;\n\tstruct in_addr\tremote_addr;\n\tuint16_t\tlocal_port;\n\tuint16_t\talias_port;\n\tuint16_t\tremote_port;\n\tuint16_t\tproto;\t\t/* Valid proto or NG_NAT_REDIRPROTO_ADDR */\n\tuint16_t\tlsnat;\t\t/* LSNAT servers count */\n\tchar\t\tdescription[NG_NAT_DESC_LENGTH];\n};\n\n/* Keep this in sync with the above structure definition */\n#define NG_NAT_LISTRDRS_ENTRY_TYPE_INFO(desctype) {\t\t\t\\\n\t  { \"id\",\t\t&ng_parse_uint32_type\t},\t\\\n\t  { \"local_addr\",\t&ng_parse_ipaddr_type\t},\t\\\n\t  { \"alias_addr\",\t&ng_parse_ipaddr_type\t},\t\\\n\t  { \"remote_addr\",\t&ng_parse_ipaddr_type\t},\t\\\n\t  { \"local_port\",\t&ng_parse_uint16_type\t},\t\\\n\t  { \"alias_port\",\t&ng_parse_uint16_type\t},\t\\\n\t  { \"remote_port\",\t&ng_parse_uint16_type\t},\t\\\n\t  { \"proto\",\t\t&ng_parse_uint16_type\t},\t\\\n\t  { \"lsnat\",\t\t&ng_parse_uint16_type\t},\t\\\n\t  { \"description\",\t(desctype)\t\t},\t\\\n\t  { NULL }\t\t\t\t\t\t\\\n}\n\n/* Structure returned by NGM_NAT_LIST_REDIRECTS */\nstruct ng_nat_list_redirects {\n\tuint32_t\t\ttotal_count;\n\tstruct ng_nat_listrdrs_entry redirects[];\n};\n\n/* Keep this in sync with the above structure definition */\n#define NG_NAT_LIST_REDIRECTS_TYPE_INFO(redirtype) {\t\t\\\n\t  { \"total_count\",\t&ng_parse_uint32_type\t},\t\\\n\t  { \"redirects\",\t(redirtype)\t\t},\t\\\n\t  { NULL }\t\t\t\t\t\t\\\n}\n\nenum {\n\tNGM_NAT_SET_IPADDR = 1,\n\tNGM_NAT_SET_MODE,\n\tNGM_NAT_SET_TARGET,\n\tNGM_NAT_REDIRECT_PORT,\n\tNGM_NAT_REDIRECT_ADDR,\n\tNGM_NAT_REDIRECT_PROTO,\n\tNGM_NAT_REDIRECT_DYNAMIC,\n\tNGM_NAT_REDIRECT_DELETE,\n\tNGM_NAT_ADD_SERVER,\n\tNGM_NAT_LIST_REDIRECTS,\n\tNGM_NAT_PROXY_RULE,\n};\n"
  },
  {
    "path": "freebsd-headers/netgraph/ng_one2many.h",
    "content": "/*\n * ng_one2many.h\n */\n\n/*-\n * Copyright (c) 2000 Whistle Communications, Inc.\n * All rights reserved.\n * \n * Subject to the following obligations and disclaimer of warranty, use and\n * redistribution of this software, in source or object code forms, with or\n * without modifications are expressly permitted by Whistle Communications;\n * provided, however, that:\n * 1. Any and all reproductions of the source or object code must include the\n *    copyright notice above and the following disclaimer of warranties; and\n * 2. No rights are granted, in any manner or form, to use Whistle\n *    Communications, Inc. trademarks, including the mark \"WHISTLE\n *    COMMUNICATIONS\" on advertising, endorsements, or otherwise except as\n *    such appears in the above copyright notice or in the software.\n * \n * THIS SOFTWARE IS BEING PROVIDED BY WHISTLE COMMUNICATIONS \"AS IS\", AND\n * TO THE MAXIMUM EXTENT PERMITTED BY LAW, WHISTLE COMMUNICATIONS MAKES NO\n * REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, REGARDING THIS SOFTWARE,\n * INCLUDING WITHOUT LIMITATION, ANY AND ALL IMPLIED WARRANTIES OF\n * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT.\n * WHISTLE COMMUNICATIONS DOES NOT WARRANT, GUARANTEE, OR MAKE ANY\n * REPRESENTATIONS REGARDING THE USE OF, OR THE RESULTS OF THE USE OF THIS\n * SOFTWARE IN TERMS OF ITS CORRECTNESS, ACCURACY, RELIABILITY OR OTHERWISE.\n * IN NO EVENT SHALL WHISTLE COMMUNICATIONS BE LIABLE FOR ANY DAMAGES\n * RESULTING FROM OR ARISING OUT OF ANY USE OF THIS SOFTWARE, INCLUDING\n * WITHOUT LIMITATION, ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,\n * PUNITIVE, OR CONSEQUENTIAL DAMAGES, PROCUREMENT OF SUBSTITUTE GOODS OR\n * SERVICES, LOSS OF USE, DATA OR PROFITS, HOWEVER CAUSED AND UNDER ANY\n * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF\n * THIS SOFTWARE, EVEN IF WHISTLE COMMUNICATIONS IS ADVISED OF THE POSSIBILITY\n * OF SUCH DAMAGE.\n *\n * Author: Archie Cobbs <archie@freebsd.org>\n *\n * $FreeBSD: release/9.0.0/sys/netgraph/ng_one2many.h 219127 2011-03-01 13:10:56Z ae $\n */\n\n#ifndef _NETGRAPH_NG_ONE2MANY_H_\n#define _NETGRAPH_NG_ONE2MANY_H_\n\n/* Node type name and magic cookie */\n#define NG_ONE2MANY_NODE_TYPE\t\t\"one2many\"\n#define NGM_ONE2MANY_COOKIE\t\t1100897444\n\n/* Hook names */\n#define NG_ONE2MANY_HOOK_ONE\t\t\"one\"\n#define NG_ONE2MANY_HOOK_MANY_PREFIX\t\"many\"\t /* append decimal integer */\n#define NG_ONE2MANY_HOOK_MANY_FMT\t\"many%d\" /* for use with printf(3) */\n\n/* Maximum number of supported \"many\" links */\n#define NG_ONE2MANY_MAX_LINKS\t\t64\n\n/* Link number used to indicate the \"one\" hook */\n#define NG_ONE2MANY_ONE_LINKNUM\t\t(-1)\n\n/* Algorithms for outgoing packet distribution (XXX only one so far) */\n#define NG_ONE2MANY_XMIT_ROUNDROBIN\t1\t/* round-robin delivery */\n#define NG_ONE2MANY_XMIT_ALL\t\t2\t/* send packets to all many hooks */\n#define\tNG_ONE2MANY_XMIT_FAILOVER\t3\t/* send packets to first active \"many\" */\n\n/* Algorithms for detecting link failure (XXX only one so far) */\n#define NG_ONE2MANY_FAIL_MANUAL\t\t1\t/* use enabledLinks[] array */\n#define NG_ONE2MANY_FAIL_NOTIFY\t\t2\t/* listen to flow control msgs */\n\n/* Node configuration structure */\nstruct ng_one2many_config {\n\tu_int32_t\txmitAlg;\t\t/* how to distribute packets */\n\tu_int32_t\tfailAlg;\t\t/* how to detect link failure */\n\tu_char\t\tenabledLinks[NG_ONE2MANY_MAX_LINKS];\n};\n\n/* Keep this in sync with the above structure definition */\n#define NG_ONE2MANY_CONFIG_TYPE_INFO(atype)\t{\t\t\\\n\t  { \"xmitAlg\",\t\t&ng_parse_uint32_type\t},\t\\\n\t  { \"failAlg\",\t\t&ng_parse_uint32_type\t},\t\\\n\t  { \"enabledLinks\",\t(atype)\t\t\t},\t\\\n\t  { NULL }\t\t\t\t\t\t\\\n}\n\n/* Statistics structure (one for each link) */\nstruct ng_one2many_link_stats {\n\tu_int64_t\trecvOctets;\t/* total octets rec'd on link */\n\tu_int64_t\trecvPackets;\t/* total pkts rec'd on link */\n\tu_int64_t\txmitOctets;\t/* total octets xmit'd on link */\n\tu_int64_t\txmitPackets;\t/* total pkts xmit'd on link */\n\tu_int64_t\tmemoryFailures;\t/* times couldn't get mem or mbuf */\n};\n\n/* Keep this in sync with the above structure definition */\n#define NG_ONE2MANY_LINK_STATS_TYPE_INFO\t{\t\t\\\n\t  { \"recvOctets\",\t&ng_parse_uint64_type\t},\t\\\n\t  { \"recvPackets\",\t&ng_parse_uint64_type\t},\t\\\n\t  { \"xmitOctets\",\t&ng_parse_uint64_type\t},\t\\\n\t  { \"xmitPackets\",\t&ng_parse_uint64_type\t},\t\\\n\t  { \"memoryFailures\",\t&ng_parse_uint64_type\t},\t\\\n\t  { NULL }\t\t\t\t\t\t\\\n}\n\n/* Netgraph control messages */\nenum {\n\tNGM_ONE2MANY_SET_CONFIG,\t/* set configuration */\n\tNGM_ONE2MANY_GET_CONFIG,\t/* get configuration */\n\tNGM_ONE2MANY_GET_STATS,\t\t/* get link stats */\n\tNGM_ONE2MANY_CLR_STATS,\t\t/* clear link stats */\n\tNGM_ONE2MANY_GETCLR_STATS,\t/* atomically get & clear link stats */\n};\n\n#endif /* _NETGRAPH_NG_ONE2MANY_H_ */\n\n"
  },
  {
    "path": "freebsd-headers/netgraph/ng_parse.h",
    "content": "/*\n * ng_parse.h\n */\n\n/*-\n * Copyright (c) 1999 Whistle Communications, Inc.\n * All rights reserved.\n * \n * Subject to the following obligations and disclaimer of warranty, use and\n * redistribution of this software, in source or object code forms, with or\n * without modifications are expressly permitted by Whistle Communications;\n * provided, however, that:\n * 1. Any and all reproductions of the source or object code must include the\n *    copyright notice above and the following disclaimer of warranties; and\n * 2. No rights are granted, in any manner or form, to use Whistle\n *    Communications, Inc. trademarks, including the mark \"WHISTLE\n *    COMMUNICATIONS\" on advertising, endorsements, or otherwise except as\n *    such appears in the above copyright notice or in the software.\n * \n * THIS SOFTWARE IS BEING PROVIDED BY WHISTLE COMMUNICATIONS \"AS IS\", AND\n * TO THE MAXIMUM EXTENT PERMITTED BY LAW, WHISTLE COMMUNICATIONS MAKES NO\n * REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, REGARDING THIS SOFTWARE,\n * INCLUDING WITHOUT LIMITATION, ANY AND ALL IMPLIED WARRANTIES OF\n * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT.\n * WHISTLE COMMUNICATIONS DOES NOT WARRANT, GUARANTEE, OR MAKE ANY\n * REPRESENTATIONS REGARDING THE USE OF, OR THE RESULTS OF THE USE OF THIS\n * SOFTWARE IN TERMS OF ITS CORRECTNESS, ACCURACY, RELIABILITY OR OTHERWISE.\n * IN NO EVENT SHALL WHISTLE COMMUNICATIONS BE LIABLE FOR ANY DAMAGES\n * RESULTING FROM OR ARISING OUT OF ANY USE OF THIS SOFTWARE, INCLUDING\n * WITHOUT LIMITATION, ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,\n * PUNITIVE, OR CONSEQUENTIAL DAMAGES, PROCUREMENT OF SUBSTITUTE GOODS OR\n * SERVICES, LOSS OF USE, DATA OR PROFITS, HOWEVER CAUSED AND UNDER ANY\n * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF\n * THIS SOFTWARE, EVEN IF WHISTLE COMMUNICATIONS IS ADVISED OF THE POSSIBILITY\n * OF SUCH DAMAGE.\n *\n * Author: Archie Cobbs <archie@freebsd.org>\n *\n * $Whistle: ng_parse.h,v 1.2 1999/11/29 01:43:48 archie Exp $\n * $FreeBSD: release/9.0.0/sys/netgraph/ng_parse.h 151800 2005-10-28 14:41:28Z ru $\n */\n\n#ifndef _NETGRAPH_NG_PARSE_H_\n#define _NETGRAPH_NG_PARSE_H_\n\n/*\n\n  This defines a library of routines for converting between various C\n  language types in binary form and ASCII strings.  Types are user\n  definable.  Several pre-defined types are supplied, for some common\n  C types: structures, variable and fixed length arrays, integer types,\n  variable and fixed length strings, IP addresses, etc.\n\n  A netgraph node type may provide a list of types that correspond to\n  the structures it expects to send and receive in the arguments field\n  of a control message.  This allows these messages to be converted\n  between their native binary form and the corresponding ASCII form.\n\n  A future use of the ASCII form may be for inter-machine communication\n  of control messages, because the ASCII form is machine independent\n  whereas the native binary form is not.\n\n  Syntax\n  ------\n\n    Structures:\n\n      '{' [ <name>=<value> ... ] '}'\n\n      Omitted fields have their default values by implication.\n      The order in which the fields are specified does not matter.\n\n    Arrays:\n\n      '[' [ [index=]<value> ... ] ']'\n\n      Element value may be specified with or without the \"<index>=\" prefix;\n      If omitted, the index after the previous element is used.\n      Omitted fields have their default values by implication.\n\n    Strings:\n\n      \"foo bar blah\\r\\n\"\n\n      That is, strings are specified just like C strings. The usual\n      backslash escapes are accepted.\n\n    Other simple types (integers, IP addresses) have their obvious forms.\n\n  Example\n  -------\n\n    Suppose we have a netgraph command that takes as an argument\n    a 'struct foo' shown below.  Here is an example of a possible\n    value for the structure, and the corresponding ASCII encoding\n    of that value:\n\n\tStructure\t\t\tBinary value\n\t---------\t\t\t------------\n\n\tstruct foo {\n\t    struct in_addr ip;  \t01 02 03 04\n\t    int bar;\t\t\t00 00 00 00\n\t    char label[8];\t\t61 62 63 0a 00 00 00 00\n\t    u_char alen;\t\t03 00\n\t    short ary[];\t  \t05 00 00 00 0a 00\n\t};\n\n\tASCII value\n\t-----------\n\n\t{ ip=1.2.3.4 label=\"abc\\n\" alen=3 ary=[ 5 2=10 ] }\n\n    Note that omitted fields and array elements get their default\n    values (\"bar\" and ary[2]), and that the alignment is handled\n    automatically (the extra 00 byte after \"alen\").  Also, since byte\n    order and alignment are inherently machine dependent, so is this\n    conversion process.  The above example shows an x86 (little\n    endian) encoding.  Also the above example is tricky because the\n    structure is variable length, depending on 'alen', the number of\n    elements in the array 'ary'.\n\n    Here is how one would define a parse type for the above structure,\n    subclassing the pre-defined types below.  We construct the type in\n    a 'bottom up' fashion, defining each field's type first, then the\n    type for the whole structure ('//' comments used to avoid breakage).\n\n    // Super-type info for 'label' field\n    struct ng_parse_fixedstring_info foo_label_info = { 8 };\n\n    // Parse type for 'label' field\n    struct ng_parse_type foo_label_type = {\n\t    &ng_parse_fixedstring_type\t\t// super-type\n\t    &foo_label_info\t\t\t// super-type info\n    };\n\n    #define OFFSETOF(s, e) ((char *)&((s *)0)->e - (char *)((s *)0))\n\n    // Function to compute the length of the array 'ary', which\n    // is variable length, depending on the previous field 'alen'.\n    // Upon entry 'buf' will be pointing at &ary[0].\n    int\n    foo_ary_getLength(const struct ng_parse_type *type,\n\t    const u_char *start, const u_char *buf)\n    {\n\t    const struct foo *f;\n\n\t    f = (const struct foo *)(buf - OFFSETOF(struct foo, ary));\n\t    return f->alen;\n    }\n\n    // Super-type info for 'ary' field\n    struct ng_parse_array_info foo_ary_info = {\n\t    &ng_parse_int16_type,\t\t// element type\n\t    &foo_ary_getLength\t\t\t// func to get array length\n    }\n\n    // Parse type for 'ary' field\n    struct ng_parse_type foo_ary_type = {\n\t    &ng_parse_array_type,\t\t// super-type\n\t    &foo_ary_info\t\t\t// super-type info\n    };\n\n    // Super-type info for struct foo\n    struct ng_parse_struct_field foo_fields[] = {\n\t    { \"ip\",\t&ng_parse_ipaddr_type\t},\n\t    { \"bar\",\t&ng_parse_int32_type\t},\n\t    { \"label\",\t&foo_label_type\t\t},\n\t    { \"alen\",\t&ng_parse_uint8_type\t},\n\t    { \"ary\",\t&foo_ary_type\t\t},\n\t    { NULL }\n    };\n\n    // Parse type for struct foo\n    struct ng_parse_type foo_type = {\n\t    &ng_parse_struct_type,\t\t// super-type\n\t    &foo_fields\t\t\t\t// super-type info\n    };\n\n  To define a type, you can define it as a sub-type of a predefined\n  type as shown above, possibly overriding some of the predefined\n  type's methods, or define an entirely new syntax, with the restriction\n  that the ASCII representation of your type's value must not contain\n  any whitespace or any of these characters: { } [ ] = \"\n\n  See ng_ksocket.c for an example of how to do this for 'struct sockaddr'.\n  See ng_parse.c to see implementations of the pre-defined types below.\n\n*/\n\n/************************************************************************\n\t\t\tMETHODS REQUIRED BY A TYPE\n ************************************************************************/\n\n/*\n * Three methods are required for a type. These may be given explicitly\n * or, if NULL, inherited from the super-type.  The 'getDefault' method\n * is always optional; the others are required if there is no super-type.\n */\n\nstruct ng_parse_type;\n\n/*\n * Convert ASCII to binary according to the supplied type.\n *\n * The ASCII characters begin at offset *off in 'string'.  The binary\n * representation is put into 'buf', which has at least *buflen bytes.\n * 'start' points to the first byte output by ng_parse() (ie, start <= buf).\n *\n * Upon return, *buflen contains the length of the new binary data, and\n * *off is updated to point just past the end of the parsed range of\n * characters, or, in the case of an error, to the offending character(s).\n *\n * Return values:\n *\t0\t\tSuccess; *buflen holds the length of the data\n *\t\t\tand *off points just past the last char parsed.\n *\tEALREADY\tField specified twice\n *\tENOENT\t\tUnknown field\n *\tE2BIG\t\tArray or character string overflow\n *\tERANGE\t\tOutput was longer than *buflen bytes\n *\tEINVAL\t\tParse failure or other invalid content\n *\tENOMEM\t\tOut of memory\n *\tEOPNOTSUPP\tMandatory array/structure element missing\n */\ntypedef\tint\tng_parse_t(const struct ng_parse_type *type, const char *string,\n\t\t\tint *off, const u_char *start,\n\t\t\tu_char *buf, int *buflen);\n\n/*\n * Convert binary to ASCII according to the supplied type.\n *\n * The results are put into 'buf', which is at least buflen bytes long.\n * *off points to the current byte in 'data' and should be updated\n * before return to point just past the last byte unparsed.\n *\n * Returns:\n *\t0\t\tSuccess\n *\tERANGE\t\tOutput was longer than buflen bytes\n */\ntypedef\tint\tng_unparse_t(const struct ng_parse_type *type,\n\t\t\tconst u_char *data, int *off, char *buf, int buflen);\n\n/*\n * Compute the default value according to the supplied type.\n *\n * Store the result in 'buf', which is at least *buflen bytes long.\n * Upon return *buflen contains the length of the output.\n *\n * Returns:\n *\t0\t\tSuccess\n *\tERANGE\t\tOutput was longer than *buflen bytes\n *\tEOPNOTSUPP\tDefault value is not specified for this type\n */\ntypedef\tint\tng_getDefault_t(const struct ng_parse_type *type,\n\t\t\tconst u_char *start, u_char *buf, int *buflen);\n\n/*\n * Return the alignment requirement of this type.  Zero is same as one.\n */\ntypedef\tint\tng_getAlign_t(const struct ng_parse_type *type);\n\n/************************************************************************\n\t\t\tTYPE DEFINITION\n ************************************************************************/\n\n/*\n * This structure describes a type, which may be a sub-type of another\n * type by pointing to it with 'supertype' and possibly omitting methods.\n * Typically the super-type requires some type-specific info, which is\n * supplied by the 'info' field.\n *\n * The 'private' field is ignored by all of the pre-defined types.\n * Sub-types may use it as they see fit.\n *\n * The 'getDefault' method may always be omitted (even if there is no\n * super-type), which means the value for any item of this type must\n * always be explicitly given.\n */\nstruct ng_parse_type {\n\tconst struct ng_parse_type *supertype;\t/* super-type, if any */\n\tconst void\t\t*info;\t\t/* type-specific info */\n\tvoid\t\t\t*private;\t/* client private info */\n\tng_parse_t\t\t*parse;\t\t/* parse method */\n\tng_unparse_t\t\t*unparse;\t/* unparse method */\n\tng_getDefault_t\t\t*getDefault;\t/* get default value method */\n\tng_getAlign_t\t\t*getAlign;\t/* get alignment */\n};\n\n/************************************************************************\n\t\t\tPRE-DEFINED TYPES\n ************************************************************************/\n\n/*\n * STRUCTURE TYPE\n *\n * This type supports arbitrary C structures.  The normal field alignment\n * rules for the local machine are applied.  Fields are always parsed in\n * field order, no matter what order they are listed in the ASCII string.\n *\n *   Default value:\t\tDetermined on a per-field basis\n *   Additional info:\t\tstruct ng_parse_struct_field *\n */\nextern const struct ng_parse_type ng_parse_struct_type;\n\n/* Each field has a name, type, and optional alignment override. If the\n   override is non-zero, the alignment is determined from the field type.\n   Note: add an extra struct ng_parse_struct_field with name == NULL\n   to indicate the end of the list. */\nstruct ng_parse_struct_field {\n\tconst char\t\t\t*name;\t\t/* field name */\n\tconst struct ng_parse_type\t*type;\t\t/* field type */\n\tint\t\t\t\talignment;\t/* override alignment */\n};\n\n/*\n * FIXED LENGTH ARRAY TYPE\n *\n * This type supports fixed length arrays, having any element type.\n *\n *   Default value:\t\tAs returned by getDefault for each index\n *   Additional info:\t\tstruct ng_parse_fixedarray_info *\n */\nextern const struct ng_parse_type ng_parse_fixedarray_type;\n\n/*\n * Get the default value for the element at index 'index'.  This method\n * may be NULL, in which case the default value is computed from the\n * element type.  Otherwise, it should fill in the default value at *buf\n * (having size *buflen) and update *buflen to the length of the filled-in\n * value before return.  If there is not enough routine return ERANGE.\n */\ntypedef\tint\tng_parse_array_getDefault_t(const struct ng_parse_type *type,\n\t\t\t\tint index, const u_char *start,\n\t\t\t\tu_char *buf, int *buflen);\n\nstruct ng_parse_fixedarray_info {\n\tconst struct ng_parse_type\t*elementType;\n\tint\t\t\t\tlength;\n\tng_parse_array_getDefault_t\t*getDefault;\n};\n\n/*\n * VARIABLE LENGTH ARRAY TYPE\n *\n * Same as fixed length arrays, except that the length is determined\n * by a function instead of a constant value.\n *\n *   Default value:\t\tSame as with fixed length arrays\n *   Additional info:\t\tstruct ng_parse_array_info *\n */\nextern const struct ng_parse_type ng_parse_array_type;\n\n/*\n * Return the length of the array.  If the array is a field in a structure,\n * all prior fields are guaranteed to be filled in already.  Upon entry,\n * 'start' is equal to the first byte parsed in this run, while 'buf' points\n * to the first element of the array to be filled in.\n */\ntypedef int\tng_parse_array_getLength_t(const struct ng_parse_type *type,\n\t\t\t\tconst u_char *start, const u_char *buf);\n\nstruct ng_parse_array_info {\n\tconst struct ng_parse_type\t*elementType;\n\tng_parse_array_getLength_t\t*getLength;\n\tng_parse_array_getDefault_t\t*getDefault;\n};\n\n/*\n * ARBITRARY LENGTH STRING TYPE\n *\n * For arbirary length, NUL-terminated strings.\n *\n *   Default value:\t\tEmpty string\n *   Additional info:\t\tNone required\n */\nextern const struct ng_parse_type ng_parse_string_type;\n\n/*\n * BOUNDED LENGTH STRING TYPE\n *\n * These are strings that have a fixed-size buffer, and always include\n * a terminating NUL character.\n *\n *   Default value:\t\tEmpty string\n *   Additional info:\t\tstruct ng_parse_fixedstring_info *\n */\nextern const struct ng_parse_type ng_parse_fixedstring_type;\n\nstruct ng_parse_fixedstring_info {\n\tint\tbufSize;\t/* size of buffer (including NUL) */\n};\n\n/*\n * EXPLICITLY SIZED STRING TYPE\n *\n * These are strings that have a two byte length field preceding them.\n * Parsed strings are NOT NUL-terminated.\n *\n *   Default value:\t\tEmpty string\n *   Additional info:\t\tNone\n */\nextern const struct ng_parse_type ng_parse_sizedstring_type;\n\n/*\n * COMMONLY USED BOUNDED LENGTH STRING TYPES\n */\nextern const struct ng_parse_type ng_parse_nodebuf_type;  /* NG_NODESIZ */\nextern const struct ng_parse_type ng_parse_hookbuf_type;  /* NG_HOOKSIZ */\nextern const struct ng_parse_type ng_parse_pathbuf_type;  /* NG_PATHSIZ */\nextern const struct ng_parse_type ng_parse_typebuf_type;  /* NG_TYPESIZ */\nextern const struct ng_parse_type ng_parse_cmdbuf_type;   /* NG_CMDSTRSIZ */\n\n/*\n * INTEGER TYPES\n *\n *   Default value:\t\t0\n *   Additional info:\t\tNone required\n */\nextern const struct ng_parse_type ng_parse_int8_type;\nextern const struct ng_parse_type ng_parse_int16_type;\nextern const struct ng_parse_type ng_parse_int32_type;\nextern const struct ng_parse_type ng_parse_int64_type;\n\n/* Same thing but unparse as unsigned quantities */\nextern const struct ng_parse_type ng_parse_uint8_type;\nextern const struct ng_parse_type ng_parse_uint16_type;\nextern const struct ng_parse_type ng_parse_uint32_type;\nextern const struct ng_parse_type ng_parse_uint64_type;\n\n/* Same thing but unparse as hex quantities, e.g., \"0xe7\" */\nextern const struct ng_parse_type ng_parse_hint8_type;\nextern const struct ng_parse_type ng_parse_hint16_type;\nextern const struct ng_parse_type ng_parse_hint32_type;\nextern const struct ng_parse_type ng_parse_hint64_type;\n\n/*\n * IP ADDRESS TYPE\n *\n *   Default value:\t\t0.0.0.0\n *   Additional info:\t\tNone required\n */\nextern const struct ng_parse_type ng_parse_ipaddr_type;\n\n/*\n * ETHERNET ADDRESS TYPE\n *\n *   Default value:\t\tNone\n *   Additional info:\t\tNone required\n */\nextern const struct ng_parse_type ng_parse_enaddr_type;\n\n/*\n * VARIABLE LENGTH BYTE ARRAY TYPE\n *\n * The bytes are displayed in hex.  The ASCII form may be either an\n * array of bytes or a string constant, in which case the array is\n * zero-filled after the string bytes.\n *\n *   Default value:\t\tAll bytes are zero\n *   Additional info:\t\tng_parse_array_getLength_t *\n */\nextern const struct ng_parse_type ng_parse_bytearray_type;\n\n/*\n * NETGRAPH CONTROL MESSAGE TYPE\n *\n * This is the parse type for a struct ng_mesg.\n *\n *   Default value:\t\tAll fields zero\n *   Additional info:\t\tNone required\n */\nextern const struct ng_parse_type ng_parse_ng_mesg_type;\n\n/************************************************************************\n\t\tCONVERSTION AND PARSING ROUTINES\n ************************************************************************/\n\n/* Tokens for parsing structs and arrays */\nenum ng_parse_token {\n\tT_LBRACE,\t\t/* '{' */\n\tT_RBRACE,\t\t/* '}' */\n\tT_LBRACKET,\t\t/* '[' */\n\tT_RBRACKET,\t\t/* ']' */\n\tT_EQUALS,\t\t/* '=' */\n\tT_STRING,\t\t/* string in double quotes */\n\tT_ERROR,\t\t/* error parsing string in double quotes */\n\tT_WORD,\t\t\t/* anything else containing no whitespace */\n\tT_EOF,\t\t\t/* end of string reached */\n};\n\n/*\n * See typedef ng_parse_t for definition\n */\nextern int\tng_parse(const struct ng_parse_type *type, const char *string,\n\t\t\tint *off, u_char *buf, int *buflen);\n\n/*\n * See typedef ng_unparse_t for definition (*off assumed to be zero).\n */\nextern int\tng_unparse(const struct ng_parse_type *type,\n\t\t\tconst u_char *data, char *buf, int buflen);\n\n/*\n * See typedef ng_getDefault_t for definition\n */\nextern int\tng_parse_getDefault(const struct ng_parse_type *type,\n\t\t\tu_char *buf, int *buflen);\n\n/*\n * Parse a token: '*startp' is the offset to start looking.  Upon\n * successful return, '*startp' equals the beginning of the token\n * and '*lenp' the length.  If error, '*startp' points at the\n * offending character(s).\n */\nextern enum\tng_parse_token ng_parse_get_token(const char *s,\n\t\t\tint *startp, int *lenp);\n\n/*\n * Like above, but specifically for getting a string token and returning\n * the string value.  The string token must be enclosed in double quotes\n * and the normal C backslash escapes are recognized.  The caller must\n * eventually free() the returned result.  Returns NULL if token is\n * not a string token, or parse or other error. Otherwise, *lenp contains\n * the number of characters parsed, and *slenp (if not NULL) contains\n * the actual number of characters in the parsed string.\n */\nextern char\t*ng_get_string_token(const char *s, int *startp,\n\t\t\tint *lenp, int *slenp);\n\n/*\n * Convert a raw string into a doubly-quoted string including any\n * necessary backslash escapes.  Caller must free the result.\n * Returns NULL if ENOMEM. Normally \"slen\" should equal strlen(s)\n * unless you want to encode NUL bytes.\n */\nextern char\t*ng_encode_string(const char *s, int slen);\n\n#endif /* _NETGRAPH_NG_PARSE_H_ */\n\n"
  },
  {
    "path": "freebsd-headers/netgraph/ng_patch.h",
    "content": "/*-\n * Copyright (C) 2010 by Maxim Ignatenko <gelraen.ua@gmail.com>\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/netgraph/ng_patch.h 208989 2010-06-10 16:45:30Z ae $\n */\n\n#ifndef _NETGRAPH_NG_PATCH_H_\n#define _NETGRAPH_NG_PATCH_H_\n\n/* Node type name. */\n#define\tNG_PATCH_NODE_TYPE\t\"patch\"\n\n/* Node type cookie. */\n#define\tNGM_PATCH_COOKIE\t1262445509\n\n/* Hook names */\n#define\tNG_PATCH_HOOK_IN\t\"in\"\n#define\tNG_PATCH_HOOK_OUT\t\"out\"\n\n/* Netgraph commands understood by this node type */\nenum {\n\tNGM_PATCH_SETCONFIG = 1,\n\tNGM_PATCH_GETCONFIG,\n\tNGM_PATCH_GET_STATS,\n\tNGM_PATCH_CLR_STATS,\n\tNGM_PATCH_GETCLR_STATS\n};\n\n/* Patching modes */\nenum {\n\tNG_PATCH_MODE_SET = 1,\n\tNG_PATCH_MODE_ADD = 2,\n\tNG_PATCH_MODE_SUB = 3,\n\tNG_PATCH_MODE_MUL = 4,\n\tNG_PATCH_MODE_DIV = 5,\n\tNG_PATCH_MODE_NEG = 6,\n\tNG_PATCH_MODE_AND = 7,\n\tNG_PATCH_MODE_OR = 8,\n\tNG_PATCH_MODE_XOR = 9,\n\tNG_PATCH_MODE_SHL = 10,\n\tNG_PATCH_MODE_SHR = 11\n};\n\nstruct ng_patch_op {\n\tuint64_t\tvalue;\n\tuint32_t\toffset;\n\tuint16_t\tlength;\t/* 1,2,4 or 8 (bytes) */\n\tuint16_t\tmode;\n};\n\n#define\tNG_PATCH_OP_TYPE_INFO\t{\t\\\n\t\t{ \"value\",\t&ng_parse_uint64_type\t},\t\\\n\t\t{ \"offset\",\t&ng_parse_uint32_type\t},\t\\\n\t\t{ \"length\",\t&ng_parse_uint16_type\t},\t\\\n\t\t{ \"mode\",\t&ng_parse_uint16_type\t},\t\\\n\t\t{ NULL } \\\n}\n\nstruct ng_patch_config {\n\tuint32_t\tcount;\n\tuint32_t\tcsum_flags;\n\tstruct ng_patch_op ops[];\n};\n\n#define\tNG_PATCH_CONFIG_TYPE_INFO\t{\t\\\n\t\t{ \"count\",\t&ng_parse_uint32_type\t},\t\\\n\t\t{ \"csum_flags\",\t&ng_parse_uint32_type\t},\t\\\n\t\t{ \"ops\",\t&ng_patch_confarr_type\t},\t\\\n\t\t{ NULL } \\\n}\n\nstruct ng_patch_stats {\n\tuint64_t\treceived;\n\tuint64_t\tpatched;\n\tuint64_t\tdropped;\n};\n\n#define\tNG_PATCH_STATS_TYPE_INFO {\t\\\n\t\t{ \"received\",\t&ng_parse_uint64_type\t},\t\\\n\t\t{ \"patched\",\t&ng_parse_uint64_type\t},\t\\\n\t\t{ \"dropped\",\t&ng_parse_uint64_type\t},\t\\\n\t\t{ NULL } \\\n}\n\n#endif /* _NETGRAPH_NG_PATCH_H_ */\n"
  },
  {
    "path": "freebsd-headers/netgraph/ng_pipe.h",
    "content": "/*-\n * Copyright (c) 2004-2008 University of Zagreb\n * Copyright (c) 2007-2008 FreeBSD Foundation\n *\n * This software was developed by the University of Zagreb and the\n * FreeBSD Foundation under sponsorship by the Stichting NLnet and the\n * FreeBSD Foundation.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/netgraph/ng_pipe.h 206360 2010-04-07 16:29:10Z joel $\n */\n\n#ifndef _NETGRAPH_PIPE_H_\n#define _NETGRAPH_PIPE_H_\n\n/* Node type name and magic cookie */\n#define NG_PIPE_NODE_TYPE\t\"pipe\"\n#define NGM_PIPE_COOKIE\t\t200708191\n\n/* Hook names */\n#define NG_PIPE_HOOK_UPPER\t\"upper\"\n#define NG_PIPE_HOOK_LOWER\t\"lower\"\n\n#define MAX_FSIZE 16384\t/* Largest supported frame size, in bytes, for BER */\n#define MAX_OHSIZE 256\t/* Largest supported dummy-framing size, in bytes */\n\n/* Statistics structure for one hook */\nstruct ng_pipe_hookstat {\n\tu_int64_t\t\tfwd_octets;\n\tu_int64_t\t\tfwd_frames;\n\tu_int64_t\t\tin_disc_octets;\n\tu_int64_t\t\tin_disc_frames;\n\tu_int64_t\t\tout_disc_octets;\n\tu_int64_t\t\tout_disc_frames;\n};\n\n/* Keep this in sync with the above structure definition */\n#define NG_PIPE_HOOKSTAT_INFO\t{\t\t\t\t\t\\\n\t{ \"FwdOctets\",\t\t&ng_parse_uint64_type\t},\t\t\\\n\t{ \"FwdFrames\",\t\t&ng_parse_uint64_type\t},\t\t\\\n\t{ \"queueDropOctets\",\t&ng_parse_uint64_type\t},\t\t\\\n\t{ \"queueDropFrames\",\t&ng_parse_uint64_type\t},\t\t\\\n\t{ \"delayDropOctets\",\t&ng_parse_uint64_type\t},\t\t\\\n\t{ \"delayDropFrames\",\t&ng_parse_uint64_type\t},\t\t\\\n\t{ NULL },\t\t\t\t\t\t\t\\\n}\n\n/* Statistics structure returned by NGM_PIPE_GET_STATS */\nstruct ng_pipe_stats {\n\tstruct ng_pipe_hookstat\tdownstream;\n\tstruct ng_pipe_hookstat\tupstream;\n};\n\n/* Keep this in sync with the above structure definition */\n#define NG_PIPE_STATS_INFO(hstype)\t{\t\t\t\t\\\n\t{ \"downstream\",\t\t(hstype) },\t\t\t\t\\\n\t{ \"upstream\",\t\t(hstype) },\t\t\t\t\\\n\t{ NULL },\t\t\t\t\t\t\t\\\n}\n\n/* Runtime structure for one hook */\nstruct ng_pipe_hookrun {\n\tu_int32_t\t\tfifo_queues;\n\tu_int32_t\t\tqin_octets;\n\tu_int32_t\t\tqin_frames;\n\tu_int32_t\t\tqout_octets;\n\tu_int32_t\t\tqout_frames;\n};\n\n/* Keep this in sync with the above structure definition */\n#define NG_PIPE_HOOKRUN_INFO\t{\t\t\t\t\t\\\n\t{ \"queues\",\t\t&ng_parse_uint32_type\t},\t\t\\\n\t{ \"queuedOctets\",\t&ng_parse_uint32_type\t},\t\t\\\n\t{ \"queuedFrames\",\t&ng_parse_uint32_type\t},\t\t\\\n\t{ \"delayedOctets\",\t&ng_parse_uint32_type\t},\t\t\\\n\t{ \"delayedFrames\",\t&ng_parse_uint32_type\t},\t\t\\\n\t{ NULL },\t\t\t\t\t\t\t\\\n}\n\n/* Runtime structure returned by NGM_PIPE_GET_RUN */\nstruct ng_pipe_run {\n\tstruct ng_pipe_hookrun\tdownstream;\n\tstruct ng_pipe_hookrun\tupstream;\n};\n\n/* Keep this in sync with the above structure definition */\n#define NG_PIPE_RUN_INFO(hstype)\t{\t\t\t\t\\\n\t{ \"downstream\",\t\t(hstype) },\t\t\t\t\\\n\t{ \"upstream\",\t\t(hstype) },\t\t\t\t\\\n\t{ NULL },\t\t\t\t\t\t\t\\\n}\n\n/* Config structure for one hook */\nstruct ng_pipe_hookcfg {\n\tu_int64_t\t\tbandwidth;\n\tu_int64_t\t\tber;\n\tu_int32_t\t\tqin_size_limit;\n\tu_int32_t\t\tqout_size_limit;\n\tu_int32_t\t\tduplicate;\n\tu_int32_t\t\tfifo;\n\tu_int32_t\t\tdrr;\n\tu_int32_t\t\twfq;\n\tu_int32_t\t\tdroptail;\n\tu_int32_t\t\tdrophead;\n};\n\n/* Keep this in sync with the above structure definition */\n#define NG_PIPE_HOOKCFG_INFO\t{\t\t\t\t\t\\\n\t{ \"bandwidth\",\t\t&ng_parse_uint64_type\t},\t\t\\\n\t{ \"BER\",\t\t&ng_parse_uint64_type\t},\t\t\\\n\t{ \"queuelen\",\t\t&ng_parse_uint32_type\t},\t\t\\\n\t{ \"delaylen\",\t\t&ng_parse_uint32_type\t},\t\t\\\n\t{ \"duplicate\",\t\t&ng_parse_uint32_type\t},\t\t\\\n\t{ \"fifo\",\t\t&ng_parse_uint32_type\t},\t\t\\\n\t{ \"drr\",\t\t&ng_parse_uint32_type\t},\t\t\\\n\t{ \"wfq\",\t\t&ng_parse_uint32_type\t},\t\t\\\n\t{ \"droptail\",\t\t&ng_parse_uint32_type\t},\t\t\\\n\t{ \"drophead\",\t\t&ng_parse_uint32_type\t},\t\t\\\n\t{ NULL },\t\t\t\t\t\t\t\\\n}\n\n/* Config structure returned by NGM_PIPE_GET_CFG */\nstruct ng_pipe_cfg {\n\tu_int64_t\t\tbandwidth;\n\tu_int64_t\t\tdelay;\n\tu_int32_t\t\theader_offset;\n\tu_int32_t\t\toverhead;\n\tstruct ng_pipe_hookcfg\tdownstream;\n\tstruct ng_pipe_hookcfg\tupstream;\n};\n\n/* Keep this in sync with the above structure definition */\n#define NG_PIPE_CFG_INFO(hstype)\t{\t\t\t\t\\\n\t{ \"bandwidth\",\t\t&ng_parse_uint64_type\t},\t\t\\\n\t{ \"delay\",\t\t&ng_parse_uint64_type\t},\t\t\\\n\t{ \"header_offset\",\t&ng_parse_uint32_type\t},\t\t\\\n\t{ \"overhead\",\t\t&ng_parse_uint32_type\t},\t\t\\\n\t{ \"downstream\",\t\t(hstype)\t\t},\t\t\\\n\t{ \"upstream\",\t\t(hstype)\t\t},\t\t\\\n\t{ NULL },\t\t\t\t\t\t\t\\\n}\n\n/* Netgraph commands */\nenum {\n\tNGM_PIPE_GET_STATS=1,\t\t/* get stats */\n\tNGM_PIPE_CLR_STATS,\t\t/* clear stats */\n\tNGM_PIPE_GETCLR_STATS,\t\t/* atomically get and clear stats */\n\tNGM_PIPE_GET_RUN,\t\t/* get current runtime status */\n\tNGM_PIPE_GET_CFG,\t\t/* get configurable parameters */\n\tNGM_PIPE_SET_CFG,\t\t/* set configurable parameters */\n};\n\n#endif /* _NETGRAPH_PIPE_H_ */\n"
  },
  {
    "path": "freebsd-headers/netgraph/ng_ppp.h",
    "content": "/*\n * ng_ppp.h\n */\n\n/*-\n * Copyright (c) 1996-2000 Whistle Communications, Inc.\n * All rights reserved.\n * \n * Subject to the following obligations and disclaimer of warranty, use and\n * redistribution of this software, in source or object code forms, with or\n * without modifications are expressly permitted by Whistle Communications;\n * provided, however, that:\n * 1. Any and all reproductions of the source or object code must include the\n *    copyright notice above and the following disclaimer of warranties; and\n * 2. No rights are granted, in any manner or form, to use Whistle\n *    Communications, Inc. trademarks, including the mark \"WHISTLE\n *    COMMUNICATIONS\" on advertising, endorsements, or otherwise except as\n *    such appears in the above copyright notice or in the software.\n * \n * THIS SOFTWARE IS BEING PROVIDED BY WHISTLE COMMUNICATIONS \"AS IS\", AND\n * TO THE MAXIMUM EXTENT PERMITTED BY LAW, WHISTLE COMMUNICATIONS MAKES NO\n * REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, REGARDING THIS SOFTWARE,\n * INCLUDING WITHOUT LIMITATION, ANY AND ALL IMPLIED WARRANTIES OF\n * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT.\n * WHISTLE COMMUNICATIONS DOES NOT WARRANT, GUARANTEE, OR MAKE ANY\n * REPRESENTATIONS REGARDING THE USE OF, OR THE RESULTS OF THE USE OF THIS\n * SOFTWARE IN TERMS OF ITS CORRECTNESS, ACCURACY, RELIABILITY OR OTHERWISE.\n * IN NO EVENT SHALL WHISTLE COMMUNICATIONS BE LIABLE FOR ANY DAMAGES\n * RESULTING FROM OR ARISING OUT OF ANY USE OF THIS SOFTWARE, INCLUDING\n * WITHOUT LIMITATION, ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,\n * PUNITIVE, OR CONSEQUENTIAL DAMAGES, PROCUREMENT OF SUBSTITUTE GOODS OR\n * SERVICES, LOSS OF USE, DATA OR PROFITS, HOWEVER CAUSED AND UNDER ANY\n * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF\n * THIS SOFTWARE, EVEN IF WHISTLE COMMUNICATIONS IS ADVISED OF THE POSSIBILITY\n * OF SUCH DAMAGE.\n *\n * Author: Archie Cobbs <archie@freebsd.org>\n *\n * $FreeBSD: release/9.0.0/sys/netgraph/ng_ppp.h 171688 2007-08-01 20:49:35Z mav $\n * $Whistle: ng_ppp.h,v 1.8 1999/01/25 02:40:02 archie Exp $\n */\n\n#ifndef _NETGRAPH_NG_PPP_H_\n#define _NETGRAPH_NG_PPP_H_\n\n/* Node type name and magic cookie */\n#define NG_PPP_NODE_TYPE\t\"ppp\"\n#define NGM_PPP_COOKIE\t\t940897795\n\n/* 64bit stats presence flag */\n#define NG_PPP_STATS64\n\n/* Maximum number of supported links */\n#define NG_PPP_MAX_LINKS\t16\n\n/* Pseudo-link number representing the multi-link bundle */\n#define NG_PPP_BUNDLE_LINKNUM\t0xffff\n\n/* Max allowable link latency (miliseconds) and bandwidth (bytes/second/10) */\n#define NG_PPP_MAX_LATENCY\t1000\t\t/* 1 second */\n#define NG_PPP_MAX_BANDWIDTH\t125000\t\t/* 10 Mbits / second */\n\n/* Hook names */\n#define NG_PPP_HOOK_BYPASS\t\"bypass\"\t/* unknown protocols */\n#define NG_PPP_HOOK_COMPRESS\t\"compress\"\t/* outgoing compression */\n#define NG_PPP_HOOK_DECOMPRESS\t\"decompress\"\t/* incoming decompression */\n#define NG_PPP_HOOK_ENCRYPT\t\"encrypt\"\t/* outgoing encryption */\n#define NG_PPP_HOOK_DECRYPT\t\"decrypt\"\t/* incoming decryption */\n#define NG_PPP_HOOK_VJC_IP\t\"vjc_ip\"\t/* VJC raw IP */\n#define NG_PPP_HOOK_VJC_COMP\t\"vjc_vjcomp\"\t/* VJC compressed TCP */\n#define NG_PPP_HOOK_VJC_UNCOMP\t\"vjc_vjuncomp\"\t/* VJC uncompressed TCP */\n#define NG_PPP_HOOK_VJC_VJIP\t\"vjc_vjip\"\t/* VJC uncompressed IP */\n#define NG_PPP_HOOK_INET\t\"inet\"\t\t/* IP packet data */\n#define NG_PPP_HOOK_ATALK\t\"atalk\"\t\t/* AppleTalk packet data */\n#define NG_PPP_HOOK_IPX\t\t\"ipx\"\t\t/* IPX packet data */\n#define NG_PPP_HOOK_IPV6\t\"ipv6\"\t\t/* IPv6 packet data */\n\n#define NG_PPP_HOOK_LINK_PREFIX\t\"link\"\t\t/* append decimal link number */\n\n/* Compress hook operation modes */\nenum {\n\tNG_PPP_COMPRESS_NONE = 0,\t/* compression disabled */\n\tNG_PPP_COMPRESS_SIMPLE,\t\t/* original operation mode */\n\tNG_PPP_COMPRESS_FULL,\t\t/* compressor returns proto */\n};\n\n/* Decompress hook operation modes */\nenum {\n\tNG_PPP_DECOMPRESS_NONE = 0,\t/* decompression disabled */\n\tNG_PPP_DECOMPRESS_SIMPLE,\t/* original operation mode */\n\tNG_PPP_DECOMPRESS_FULL,\t\t/* forward any packet to decompressor */\n};\n\n/* Netgraph commands */\nenum {\n\tNGM_PPP_SET_CONFIG = 1,\t\t/* takes struct ng_ppp_node_conf */\n\tNGM_PPP_GET_CONFIG,\t\t/* returns ng_ppp_node_conf */\n\tNGM_PPP_GET_MP_STATE,\t\t/* returns ng_ppp_mp_state */\n\tNGM_PPP_GET_LINK_STATS,\t\t/* takes link #, returns stats struct */\n\tNGM_PPP_CLR_LINK_STATS,\t\t/* takes link #, clears link stats */\n\tNGM_PPP_GETCLR_LINK_STATS,\t/* takes link #, returns & clrs stats */\n\tNGM_PPP_GET_LINK_STATS64,\t/* takes link #, returns stats64 struct */\n\tNGM_PPP_GETCLR_LINK_STATS64,\t/* takes link #, returns stats64 & clrs */\n};\n\n/* Multi-link sequence number state (for debugging) */\nstruct ng_ppp_mp_state {\n\tint32_t\t\trseq[NG_PPP_MAX_LINKS];\t/* highest rec'd MP seq # */\n\tint32_t\t\tmseq;\t\t\t/* min rseq[i] */\n\tint32_t\t\txseq;\t\t\t/* next xmit MP seq # */\n};\n\n/* Keep this in sync with the above structure definition */\n#define NG_PPP_MP_STATE_TYPE_INFO(atype)\t{\t\t\\\n\t  { \"rseq\",\t(atype)\t\t\t},\t\t\\\n\t  { \"mseq\",\t&ng_parse_hint32_type\t},\t\t\\\n\t  { \"xseq\",\t&ng_parse_hint32_type\t},\t\t\\\n\t  { NULL }\t\t\t\t\t\t\\\n}\n\n/* Per-link config structure */\nstruct ng_ppp_link_conf {\n\tu_char\t\tenableLink;\t/* enable this link */\n\tu_char\t\tenableProtoComp;/* enable protocol field compression */\n\tu_char\t\tenableACFComp;\t/* enable addr/ctrl field compression */\n\tu_int16_t\tmru;\t\t/* peer MRU */\n\tu_int32_t\tlatency;\t/* link latency (in milliseconds) */\n\tu_int32_t\tbandwidth;\t/* link bandwidth (in bytes/sec/10) */\n};\n\n/* Keep this in sync with the above structure definition */\n#define NG_PPP_LINK_TYPE_INFO\t{\t\t\t\t\\\n\t  { \"enableLink\",\t&ng_parse_uint8_type\t},\t\\\n\t  { \"enableProtoComp\",\t&ng_parse_uint8_type\t},\t\\\n\t  { \"enableACFComp\",\t&ng_parse_uint8_type\t},\t\\\n\t  { \"mru\",\t\t&ng_parse_uint16_type\t},\t\\\n\t  { \"latency\",\t\t&ng_parse_uint32_type\t},\t\\\n\t  { \"bandwidth\",\t&ng_parse_uint32_type\t},\t\\\n\t  { NULL }\t\t\t\t\t\t\\\n}\n\n/* Bundle config structure */\nstruct ng_ppp_bund_conf {\n\tu_int16_t\tmrru;\t\t\t/* multilink peer MRRU */\n\tu_char\t\tenableMultilink;\t/* enable multilink */\n\tu_char\t\trecvShortSeq;\t\t/* recv multilink short seq # */\n\tu_char\t\txmitShortSeq;\t\t/* xmit multilink short seq # */\n\tu_char\t\tenableRoundRobin;\t/* xmit whole packets */\n\tu_char\t\tenableIP;\t\t/* enable IP data flow */\n\tu_char\t\tenableIPv6;\t\t/* enable IPv6 data flow */\n\tu_char\t\tenableAtalk;\t\t/* enable AppleTalk data flow */\n\tu_char\t\tenableIPX;\t\t/* enable IPX data flow */\n\tu_char\t\tenableCompression;\t/* enable PPP compression */\n\tu_char\t\tenableDecompression;\t/* enable PPP decompression */\n\tu_char\t\tenableEncryption;\t/* enable PPP encryption */\n\tu_char\t\tenableDecryption;\t/* enable PPP decryption */\n\tu_char\t\tenableVJCompression;\t/* enable VJ compression */\n\tu_char\t\tenableVJDecompression;\t/* enable VJ decompression */\n};\n\n/* Keep this in sync with the above structure definition */\n#define NG_PPP_BUND_TYPE_INFO\t{\t\t\t\t\t\\\n\t  { \"mrru\",\t\t\t&ng_parse_uint16_type\t},\t\\\n\t  { \"enableMultilink\",\t\t&ng_parse_uint8_type\t},\t\\\n\t  { \"recvShortSeq\",\t\t&ng_parse_uint8_type\t},\t\\\n\t  { \"xmitShortSeq\",\t\t&ng_parse_uint8_type\t},\t\\\n\t  { \"enableRoundRobin\",\t\t&ng_parse_uint8_type\t},\t\\\n\t  { \"enableIP\",\t\t\t&ng_parse_uint8_type\t},\t\\\n\t  { \"enableIPv6\",\t\t&ng_parse_uint8_type\t},\t\\\n\t  { \"enableAtalk\",\t\t&ng_parse_uint8_type\t},\t\\\n\t  { \"enableIPX\",\t\t&ng_parse_uint8_type\t},\t\\\n\t  { \"enableCompression\",\t&ng_parse_uint8_type\t},\t\\\n\t  { \"enableDecompression\",\t&ng_parse_uint8_type\t},\t\\\n\t  { \"enableEncryption\",\t\t&ng_parse_uint8_type\t},\t\\\n\t  { \"enableDecryption\",\t\t&ng_parse_uint8_type\t},\t\\\n\t  { \"enableVJCompression\",\t&ng_parse_uint8_type\t},\t\\\n\t  { \"enableVJDecompression\",\t&ng_parse_uint8_type\t},\t\\\n\t  { NULL }\t\t\t\t\t\t\t\\\n}\n\n/* Total node config structure */\nstruct ng_ppp_node_conf {\n\tstruct ng_ppp_bund_conf\tbund;\n\tstruct ng_ppp_link_conf\tlinks[NG_PPP_MAX_LINKS];\n};\n\n/* Keep this in sync with the above structure definition */\n#define NG_PPP_CONFIG_TYPE_INFO(bctype, arytype)\t{\t\\\n\t  { \"bund\",\t\t(bctype)\t},\t\t\\\n\t  { \"links\",\t\t(arytype)\t},\t\t\\\n\t  { NULL }\t\t\t\t\t\t\\\n}\n\n/* Statistics struct for a link (or the bundle if NG_PPP_BUNDLE_LINKNUM) */\nstruct ng_ppp_link_stat {\n\tu_int32_t xmitFrames;\t\t/* xmit frames on link */\n\tu_int32_t xmitOctets;\t\t/* xmit octets on link */\n\tu_int32_t recvFrames;\t\t/* recv frames on link */\n\tu_int32_t recvOctets;\t\t/* recv octets on link */\n\tu_int32_t badProtos;\t\t/* frames rec'd with bogus protocol */\n\tu_int32_t runts;\t\t/* Too short MP fragments */\n\tu_int32_t dupFragments;\t\t/* MP frames with duplicate seq # */\n\tu_int32_t dropFragments;\t/* MP fragments we had to drop */\n};\n\n/* Keep this in sync with the above structure definition */\n#define NG_PPP_STATS_TYPE_INFO\t{\t\t\t\t\\\n\t  { \"xmitFrames\",\t&ng_parse_uint32_type\t},\t\\\n\t  { \"xmitOctets\",\t&ng_parse_uint32_type\t},\t\\\n\t  { \"recvFrames\",\t&ng_parse_uint32_type\t},\t\\\n\t  { \"recvOctets\",\t&ng_parse_uint32_type\t},\t\\\n\t  { \"badProtos\",\t&ng_parse_uint32_type\t},\t\\\n\t  { \"runts\",\t\t&ng_parse_uint32_type\t},\t\\\n\t  { \"dupFragments\",\t&ng_parse_uint32_type\t},\t\\\n\t  { \"dropFragments\",\t&ng_parse_uint32_type\t},\t\\\n\t  { NULL }\t\t\t\t\t\t\\\n}\n\n/* Statistics struct for a link (or the bundle if NG_PPP_BUNDLE_LINKNUM) */\nstruct ng_ppp_link_stat64 {\n\tu_int64_t xmitFrames;\t\t/* xmit frames on link */\n\tu_int64_t xmitOctets;\t\t/* xmit octets on link */\n\tu_int64_t recvFrames;\t\t/* recv frames on link */\n\tu_int64_t recvOctets;\t\t/* recv octets on link */\n\tu_int64_t badProtos;\t\t/* frames rec'd with bogus protocol */\n\tu_int64_t runts;\t\t/* Too short MP fragments */\n\tu_int64_t dupFragments;\t\t/* MP frames with duplicate seq # */\n\tu_int64_t dropFragments;\t/* MP fragments we had to drop */\n};\n\n/* Keep this in sync with the above structure definition */\n#define NG_PPP_STATS64_TYPE_INFO\t{\t\t\t\\\n\t  { \"xmitFrames\",\t&ng_parse_uint64_type\t},\t\\\n\t  { \"xmitOctets\",\t&ng_parse_uint64_type\t},\t\\\n\t  { \"recvFrames\",\t&ng_parse_uint64_type\t},\t\\\n\t  { \"recvOctets\",\t&ng_parse_uint64_type\t},\t\\\n\t  { \"badProtos\",\t&ng_parse_uint64_type\t},\t\\\n\t  { \"runts\",\t\t&ng_parse_uint64_type\t},\t\\\n\t  { \"dupFragments\",\t&ng_parse_uint64_type\t},\t\\\n\t  { \"dropFragments\",\t&ng_parse_uint64_type\t},\t\\\n\t  { NULL }\t\t\t\t\t\t\\\n}\n\n#endif /* _NETGRAPH_NG_PPP_H_ */\n"
  },
  {
    "path": "freebsd-headers/netgraph/ng_pppoe.h",
    "content": "/*\n * ng_pppoe.h\n */\n\n/*-\n * Copyright (c) 1996-1999 Whistle Communications, Inc.\n * All rights reserved.\n * \n * Subject to the following obligations and disclaimer of warranty, use and\n * redistribution of this software, in source or object code forms, with or\n * without modifications are expressly permitted by Whistle Communications;\n * provided, however, that:\n * 1. Any and all reproductions of the source or object code must include the\n *    copyright notice above and the following disclaimer of warranties; and\n * 2. No rights are granted, in any manner or form, to use Whistle\n *    Communications, Inc. trademarks, including the mark \"WHISTLE\n *    COMMUNICATIONS\" on advertising, endorsements, or otherwise except as\n *    such appears in the above copyright notice or in the software.\n * \n * THIS SOFTWARE IS BEING PROVIDED BY WHISTLE COMMUNICATIONS \"AS IS\", AND\n * TO THE MAXIMUM EXTENT PERMITTED BY LAW, WHISTLE COMMUNICATIONS MAKES NO\n * REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, REGARDING THIS SOFTWARE,\n * INCLUDING WITHOUT LIMITATION, ANY AND ALL IMPLIED WARRANTIES OF\n * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT.\n * WHISTLE COMMUNICATIONS DOES NOT WARRANT, GUARANTEE, OR MAKE ANY\n * REPRESENTATIONS REGARDING THE USE OF, OR THE RESULTS OF THE USE OF THIS\n * SOFTWARE IN TERMS OF ITS CORRECTNESS, ACCURACY, RELIABILITY OR OTHERWISE.\n * IN NO EVENT SHALL WHISTLE COMMUNICATIONS BE LIABLE FOR ANY DAMAGES\n * RESULTING FROM OR ARISING OUT OF ANY USE OF THIS SOFTWARE, INCLUDING\n * WITHOUT LIMITATION, ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,\n * PUNITIVE, OR CONSEQUENTIAL DAMAGES, PROCUREMENT OF SUBSTITUTE GOODS OR\n * SERVICES, LOSS OF USE, DATA OR PROFITS, HOWEVER CAUSED AND UNDER ANY\n * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF\n * THIS SOFTWARE, EVEN IF WHISTLE COMMUNICATIONS IS ADVISED OF THE POSSIBILITY\n * OF SUCH DAMAGE.\n *\n * Author: Julian Elischer <julian@freebsd.org>\n *\n * $FreeBSD: release/9.0.0/sys/netgraph/ng_pppoe.h 189315 2009-03-03 18:47:33Z ed $\n * $Whistle: ng_pppoe.h,v 1.7 1999/10/16 10:16:43 julian Exp $\n */\n\n#ifndef _NETGRAPH_NG_PPPOE_H_\n#define _NETGRAPH_NG_PPPOE_H_\n\n/********************************************************************\n * Netgraph hook constants etc.\n ********************************************************************/\n/* Node type name. This should be unique among all netgraph node types */\n#define NG_PPPOE_NODE_TYPE\t\"pppoe\"\n\n#define NGM_PPPOE_COOKIE\t\t1089893072\n\n#define\tPPPOE_SERVICE_NAME_SIZE\t\t64 /* for now */\n\n/* Hook names */\n#define NG_PPPOE_HOOK_ETHERNET\t\"ethernet\"\n#define NG_PPPOE_HOOK_DEBUG\t\"debug\"\n\n/* Mode names */\n#define\tNG_PPPOE_STANDARD\t\"standard\"\n#define\tNG_PPPOE_3COM\t\t\"3Com\"\n#define\tNG_PPPOE_NONSTANDARD\tNG_PPPOE_3COM\n#define\tNG_PPPOE_DLINK\t\t\"D-Link\"\n\n/**********************************************************************\n * Netgraph commands understood by this node type.\n * FAIL, SUCCESS, CLOSE and ACNAME are sent by the node rather than received.\n ********************************************************************/\nenum cmd {\n\tNGM_PPPOE_SET_FLAG = 1,\n\tNGM_PPPOE_CONNECT  = 2,\t/* Client, Try find this service */\n\tNGM_PPPOE_LISTEN   = 3,\t/* Server, Await a request for this service */\n\tNGM_PPPOE_OFFER    = 4,\t/* Server, hook X should respond (*) */\n\tNGM_PPPOE_SUCCESS  = 5,\t/* State machine connected */\n\tNGM_PPPOE_FAIL     = 6,\t/* State machine could not connect */\n\tNGM_PPPOE_CLOSE    = 7,\t/* Session closed down */\n\tNGM_PPPOE_SERVICE  = 8,\t/* additional Service to advertise (in PADO) */\n\tNGM_PPPOE_ACNAME   = 9,\t/* AC_NAME for informational purposes */\n\tNGM_PPPOE_GET_STATUS = 10, /* data in/out */\n\tNGM_PPPOE_SESSIONID  = 11,  /* Session_ID for informational purposes */\n\tNGM_PPPOE_SETMODE  = 12, /* set to standard or compat modes */\n\tNGM_PPPOE_GETMODE  = 13, /* see current mode */\n\tNGM_PPPOE_SETENADDR = 14, /* set Ethernet address */\n};\n\n/***********************\n * Structures passed in the various netgraph command messages.\n ***********************/\n/* This structure is returned by the NGM_PPPOE_GET_STATUS command */\nstruct ngpppoestat {\n\tu_int   packets_in;\t/* packets in from ethernet */\n\tu_int   packets_out;\t/* packets out towards ethernet */\n};\n\n/* Keep this in sync with the above structure definition */\n#define NG_PPPOESTAT_TYPE_INFO\t{\t\t\t\t\\\n\t  { \"packets_in\",\t&ng_parse_uint_type\t},\t\\\n\t  { \"packets_out\",\t&ng_parse_uint_type\t},\t\\\n\t  { NULL }\t\t\t\t\t\t\\\n}\n\n/*\n * When this structure is accepted by the NGM_PPPOE_CONNECT command :\n * The data field is MANDATORY.\n * The session sends out a PADI request for the named service.\n *\n *\n * When this structure is accepted by the NGM_PPPOE_LISTEN command.\n * If no service is given this is assumed to accept ALL PADI requests.\n * This may at some time take a regexp expression, but not yet.\n * Matching PADI requests will be passed up the named hook.\n *\n *\n * When this structure is accepted by the NGM_PPPOE_OFFER command:\n * The AC-NAme field is set from that given and a PADI\n * packet is expected to arrive from the session control daemon, on the\n * named hook. The session will then issue the appropriate PADO\n * and begin negotiation.\n */\nstruct ngpppoe_init_data {\n\tchar\t\thook[NG_HOOKSIZ];\t/* hook to monitor on */\n\tu_int16_t\tdata_len;\t\t/* Length of the service name */\n\tchar\t\tdata[];\t\t\t/* init data goes here */\n};\n\n/* Keep this in sync with the above structure definition */\n#define NG_PPPOE_INIT_DATA_TYPE_INFO\t{\t\t\\\n\t  { \"hook\",\t&ng_parse_hookbuf_type\t},\t\\\n\t  { \"data\",\t&ng_parse_sizedstring_type },\t\\\n\t  { NULL }\t\t\t\t\t\\\n}\n\n/*\n * This structure is used by the asychronous success and failure messages.\n * (to report which hook has failed or connected). The message is sent\n * to whoever requested the connection. (close may use this too).\n */\nstruct ngpppoe_sts {\n\tchar\thook[NG_HOOKSIZ];\t/* hook associated with event session */\n};\n\n/* Keep this in sync with the above structure definition */\n#define NG_PPPOE_STS_TYPE_INFO\t\t{\t\t\\\n\t  { \"hook\",\t&ng_parse_hookbuf_type\t},\t\\\n\t  { NULL }\t\t\t\t\t\\\n}\n\n\n/********************************************************************\n * Constants and definitions specific to pppoe\n ********************************************************************/\n\n#define PPPOE_TIMEOUT_LIMIT 64\n#define PPPOE_OFFER_TIMEOUT 16\n#define PPPOE_INITIAL_TIMEOUT 2\n\n/* Codes to identify message types */\n#define PADI_CODE\t0x09\n#define PADO_CODE\t0x07\n#define PADR_CODE\t0x19\n#define PADS_CODE\t0x65\n#define PADT_CODE\t0xa7\n\n/* Tag identifiers */\n#if BYTE_ORDER == BIG_ENDIAN\n#define PTT_EOL\t\t(0x0000)\n#define PTT_SRV_NAME\t(0x0101)\n#define PTT_AC_NAME\t(0x0102)\n#define PTT_HOST_UNIQ\t(0x0103)\n#define PTT_AC_COOKIE\t(0x0104)\n#define PTT_VENDOR \t(0x0105)\n#define PTT_RELAY_SID\t(0x0110)\n#define PTT_SRV_ERR     (0x0201)\n#define PTT_SYS_ERR  \t(0x0202)\n#define PTT_GEN_ERR  \t(0x0203)\n\n#define ETHERTYPE_PPPOE_DISC\t0x8863\t/* pppoe discovery packets     */\n#define ETHERTYPE_PPPOE_SESS\t0x8864\t/* pppoe session packets       */\n#define ETHERTYPE_PPPOE_3COM_DISC 0x3c12 /* pppoe discovery packets 3com? */\n#define ETHERTYPE_PPPOE_3COM_SESS 0x3c13 /* pppoe session packets   3com? */\n#else\n#define PTT_EOL\t\t(0x0000)\n#define PTT_SRV_NAME\t(0x0101)\n#define PTT_AC_NAME\t(0x0201)\n#define PTT_HOST_UNIQ\t(0x0301)\n#define PTT_AC_COOKIE\t(0x0401)\n#define PTT_VENDOR \t(0x0501)\n#define PTT_RELAY_SID\t(0x1001)\n#define PTT_SRV_ERR     (0x0102)\n#define PTT_SYS_ERR  \t(0x0202)\n#define PTT_GEN_ERR  \t(0x0302)\n\n#define ETHERTYPE_PPPOE_DISC\t0x6388\t/* pppoe discovery packets     */\n#define ETHERTYPE_PPPOE_SESS\t0x6488\t/* pppoe session packets       */\n#define ETHERTYPE_PPPOE_3COM_DISC 0x123c /* pppoe discovery packets 3com? */\n#define ETHERTYPE_PPPOE_3COM_SESS 0x133c /* pppoe session packets   3com? */\n#endif\n\nstruct pppoe_tag {\n\tu_int16_t tag_type;\n\tu_int16_t tag_len;\n}__packed;\n\nstruct pppoe_hdr{\n\tu_int8_t ver:4;\n\tu_int8_t type:4;\n\tu_int8_t code;\n\tu_int16_t sid;\n\tu_int16_t length;\n}__packed;\n\n\nstruct pppoe_full_hdr {\n\tstruct  ether_header eh;\n\tstruct pppoe_hdr ph;\n}__packed;\n\nunion\tpacket {\n\tstruct pppoe_full_hdr\tpkt_header;\n\tu_int8_t\tbytes[2048];\n};\n\nstruct datatag {\n        struct pppoe_tag hdr;\n\tu_int8_t        data[PPPOE_SERVICE_NAME_SIZE];\n};     \n\n\n/*\n * Define the order in which we will place tags in packets\n * this may be ignored\n */\n/* for PADI */\n#define TAGI_SVC 0\n#define TAGI_HUNIQ 1\n/* for PADO */\n#define TAGO_ACNAME 0\n#define TAGO_SVC 1\n#define TAGO_COOKIE 2\n#define TAGO_HUNIQ 3\n/* for PADR */\n#define TAGR_SVC 0\n#define TAGR_HUNIQ 1\n#define TAGR_COOKIE 2\n/* for PADS */\n#define TAGS_ACNAME 0\n#define TAGS_SVC 1\n#define TAGS_COOKIE 2\n#define TAGS_HUNIQ 3\n/* for PADT */\n\n#endif /* _NETGRAPH_NG_PPPOE_H_ */\n\n"
  },
  {
    "path": "freebsd-headers/netgraph/ng_pptpgre.h",
    "content": "/*\n * ng_pptpgre.h\n */\n\n/*-\n * Copyright (c) 1999 Whistle Communications, Inc.\n * All rights reserved.\n * \n * Subject to the following obligations and disclaimer of warranty, use and\n * redistribution of this software, in source or object code forms, with or\n * without modifications are expressly permitted by Whistle Communications;\n * provided, however, that:\n * 1. Any and all reproductions of the source or object code must include the\n *    copyright notice above and the following disclaimer of warranties; and\n * 2. No rights are granted, in any manner or form, to use Whistle\n *    Communications, Inc. trademarks, including the mark \"WHISTLE\n *    COMMUNICATIONS\" on advertising, endorsements, or otherwise except as\n *    such appears in the above copyright notice or in the software.\n * \n * THIS SOFTWARE IS BEING PROVIDED BY WHISTLE COMMUNICATIONS \"AS IS\", AND\n * TO THE MAXIMUM EXTENT PERMITTED BY LAW, WHISTLE COMMUNICATIONS MAKES NO\n * REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, REGARDING THIS SOFTWARE,\n * INCLUDING WITHOUT LIMITATION, ANY AND ALL IMPLIED WARRANTIES OF\n * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT.\n * WHISTLE COMMUNICATIONS DOES NOT WARRANT, GUARANTEE, OR MAKE ANY\n * REPRESENTATIONS REGARDING THE USE OF, OR THE RESULTS OF THE USE OF THIS\n * SOFTWARE IN TERMS OF ITS CORRECTNESS, ACCURACY, RELIABILITY OR OTHERWISE.\n * IN NO EVENT SHALL WHISTLE COMMUNICATIONS BE LIABLE FOR ANY DAMAGES\n * RESULTING FROM OR ARISING OUT OF ANY USE OF THIS SOFTWARE, INCLUDING\n * WITHOUT LIMITATION, ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,\n * PUNITIVE, OR CONSEQUENTIAL DAMAGES, PROCUREMENT OF SUBSTITUTE GOODS OR\n * SERVICES, LOSS OF USE, DATA OR PROFITS, HOWEVER CAUSED AND UNDER ANY\n * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF\n * THIS SOFTWARE, EVEN IF WHISTLE COMMUNICATIONS IS ADVISED OF THE POSSIBILITY\n * OF SUCH DAMAGE.\n *\n * Author: Archie Cobbs <archie@freebsd.org>\n *\n * $FreeBSD: release/9.0.0/sys/netgraph/ng_pptpgre.h 177587 2008-03-24 22:55:22Z mav $\n * $Whistle: ng_pptpgre.h,v 1.3 1999/12/08 00:11:36 archie Exp $\n */\n\n#ifndef _NETGRAPH_NG_PPTPGRE_H_\n#define _NETGRAPH_NG_PPTPGRE_H_\n\n/* Node type name and magic cookie */\n#define NG_PPTPGRE_NODE_TYPE\t\"pptpgre\"\n#define NGM_PPTPGRE_COOKIE\t1082548365\n\n/* Hook names */\n#define NG_PPTPGRE_HOOK_UPPER\t\"upper\"\t\t/* to upper layers */\n#define NG_PPTPGRE_HOOK_LOWER\t\"lower\"\t\t/* to lower layers */\n\n/* Session hooks: prefix plus hex session ID, e.g., \"session_3e14\" */\n#define NG_PPTPGRE_HOOK_SESSION_P\t\"session_\"\n#define NG_PPTPGRE_HOOK_SESSION_F\t\"session_%04x\"\n\n/* Configuration for a session */\nstruct ng_pptpgre_conf {\n\tu_char\t\tenabled;\t/* enables traffic flow */\n\tu_char\t\tenableDelayedAck;/* enables delayed acks */\n\tu_char\t\tenableAlwaysAck;/* always include ack with data */\n\tu_char\t\tenableWindowing;/* enable windowing algorithm */\n\tu_int16_t\tcid;\t\t/* my call id */\n\tu_int16_t\tpeerCid;\t/* peer call id */\n\tu_int16_t\trecvWin;\t/* peer recv window size */\n\tu_int16_t\tpeerPpd;\t/* peer packet processing delay\n\t\t\t\t\t   (in units of 1/10 of a second) */\n};\n\n/* Keep this in sync with the above structure definition */\n#define NG_PPTPGRE_CONF_TYPE_INFO\t{\t\t\t\\\n\t  { \"enabled\",\t\t&ng_parse_uint8_type\t},\t\\\n\t  { \"enableDelayedAck\",\t&ng_parse_uint8_type\t},\t\\\n\t  { \"enableAlwaysAck\",\t&ng_parse_uint8_type\t},\t\\\n\t  { \"enableWindowing\",\t&ng_parse_uint8_type\t},\t\\\n\t  { \"cid\",\t\t&ng_parse_hint16_type\t},\t\\\n\t  { \"peerCid\",\t\t&ng_parse_hint16_type\t},\t\\\n\t  { \"recvWin\",\t\t&ng_parse_uint16_type\t},\t\\\n\t  { \"peerPpd\",\t\t&ng_parse_uint16_type\t},\t\\\n\t  { NULL }\t\t\t\t\t\t\\\n}\n\n/* Statistics struct */\nstruct ng_pptpgre_stats {\n\tu_int32_t xmitPackets;\t\t/* number of GRE packets xmit */\n\tu_int32_t xmitOctets;\t\t/* number of GRE octets xmit */\n\tu_int32_t xmitLoneAcks;\t\t/* ack-only packets transmitted */\n\tu_int32_t xmitDrops;\t\t/* xmits dropped due to full window */\n\tu_int32_t xmitTooBig;\t\t/* xmits dropped because too big */\n\tu_int32_t recvPackets;\t\t/* number of GRE packets rec'd */\n\tu_int32_t recvOctets;\t\t/* number of GRE octets rec'd */\n\tu_int32_t recvRunts;\t\t/* too short packets rec'd */\n\tu_int32_t recvBadGRE;\t\t/* bogus packets rec'd (bad GRE hdr) */\n\tu_int32_t recvBadAcks;\t\t/* bogus ack's rec'd in GRE header */\n\tu_int32_t recvBadCID;\t\t/* pkts with unknown call ID rec'd */\n\tu_int32_t recvOutOfOrder;\t/* packets rec'd out of order */\n\tu_int32_t recvDuplicates;\t/* packets rec'd with duplicate seq # */\n\tu_int32_t recvLoneAcks;\t\t/* ack-only packets rec'd */\n\tu_int32_t recvAckTimeouts;\t/* times peer failed to ack in time */\n\tu_int32_t memoryFailures;\t/* times we couldn't allocate memory */\n};\n\n/* Keep this in sync with the above structure definition */\n#define NG_PPTPGRE_STATS_TYPE_INFO\t{\t\t\t\\\n\t  { \"xmitPackets\",\t&ng_parse_uint32_type\t},\t\\\n\t  { \"xmitOctets\",\t&ng_parse_uint32_type\t},\t\\\n\t  { \"xmitLoneAcks\",\t&ng_parse_uint32_type\t},\t\\\n\t  { \"xmitDrops\",\t&ng_parse_uint32_type\t},\t\\\n\t  { \"xmitTooBig\",\t&ng_parse_uint32_type\t},\t\\\n\t  { \"recvPackets\",\t&ng_parse_uint32_type\t},\t\\\n\t  { \"recvOctets\",\t&ng_parse_uint32_type\t},\t\\\n\t  { \"recvRunts\",\t&ng_parse_uint32_type\t},\t\\\n\t  { \"recvBadGRE\",\t&ng_parse_uint32_type\t},\t\\\n\t  { \"recvBadAcks\",\t&ng_parse_uint32_type\t},\t\\\n\t  { \"recvBadCID\",\t&ng_parse_uint32_type\t},\t\\\n\t  { \"recvOutOfOrder\",\t&ng_parse_uint32_type\t},\t\\\n\t  { \"recvDuplicates\",\t&ng_parse_uint32_type\t},\t\\\n\t  { \"recvLoneAcks\",\t&ng_parse_uint32_type\t},\t\\\n\t  { \"recvAckTimeouts\",\t&ng_parse_uint32_type\t},\t\\\n\t  { \"memoryFailures\",\t&ng_parse_uint32_type\t},\t\\\n\t  { NULL }\t\t\t\t\t\t\\\n}\n\n/* Netgraph commands */\nenum {\n\tNGM_PPTPGRE_SET_CONFIG = 1,\t/* supply a struct ng_pptpgre_conf */\n\tNGM_PPTPGRE_GET_CONFIG,\t\t/* returns a struct ng_pptpgre_conf */\n\tNGM_PPTPGRE_GET_STATS,\t\t/* returns struct ng_pptpgre_stats */\n\tNGM_PPTPGRE_CLR_STATS,\t\t/* clears stats */\n\tNGM_PPTPGRE_GETCLR_STATS,\t/* returns & clears stats */\n};\n\n#endif /* _NETGRAPH_NG_PPTPGRE_H_ */\n"
  },
  {
    "path": "freebsd-headers/netgraph/ng_pred1.h",
    "content": "/*-\n * Copyright (c) 2006 Alexander Motin <mav@alkar.net>\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice unmodified, this list of conditions, and the following\n *    disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/netgraph/ng_pred1.h 165619 2006-12-29 09:54:32Z glebius $\n */\n\n#ifndef _NETGRAPH_NG_PRED1_H_\n#define _NETGRAPH_NG_PRED1_H_\n\n/* Node type name and magic cookie */\n#define NG_PRED1_NODE_TYPE\t\"pred1\"\n#define NGM_PRED1_COOKIE\t1166902612\n\n/* Hook names */\n#define NG_PRED1_HOOK_COMP\t\"comp\"\t\t/* compression hook */\n#define NG_PRED1_HOOK_DECOMP\t\"decomp\"\t/* decompression hook */\n\n/* Config struct */\nstruct ng_pred1_config {\n\tu_char\t\tenable;\t\t\t/* node enabled */\n};\n\n/* Keep this in sync with the above structure definition. */\n#define NG_PRED1_CONFIG_INFO\t{\t\t\t\\\n\t{ \"enable\",\t&ng_parse_uint8_type\t},\t\\\n\t{ NULL }\t\t\t\t\t\\\n}\n\n/* Statistics structure for one direction. */\nstruct ng_pred1_stats {\n\tuint64_t\tFramesPlain;\n\tuint64_t\tFramesComp;\n\tuint64_t\tFramesUncomp;\n\tuint64_t\tInOctets;\n\tuint64_t\tOutOctets;\n\tuint64_t\tErrors;\n};\n\n/* Keep this in sync with the above structure definition. */\n#define NG_PRED1_STATS_INFO\t{\t\t\t\t\\\n\t{ \"FramesPlain\",&ng_parse_uint64_type\t},\t\\\n\t{ \"FramesComp\",\t&ng_parse_uint64_type\t},\t\\\n\t{ \"FramesUncomp\", &ng_parse_uint64_type\t},\t\\\n\t{ \"InOctets\",\t&ng_parse_uint64_type\t},\t\\\n\t{ \"OutOctets\",\t&ng_parse_uint64_type\t},\t\\\n\t{ \"Errors\",\t&ng_parse_uint64_type\t},\t\\\n\t{ NULL }\t\t\t\t\t\\\n}\n\n/* Netgraph commands */\nenum {\n\tNGM_PRED1_CONFIG = 1,\n\tNGM_PRED1_RESETREQ,\t\t\t/* sent either way! */\n\tNGM_PRED1_GET_STATS,\n\tNGM_PRED1_CLR_STATS,\n\tNGM_PRED1_GETCLR_STATS,\n};\n\n#endif /* _NETGRAPH_NG_PRED1_H_ */\n\n"
  },
  {
    "path": "freebsd-headers/netgraph/ng_rfc1490.h",
    "content": "/*\n * ng_rfc1490.h\n */\n\n/*-\n * Copyright (c) 1996-1999 Whistle Communications, Inc.\n * All rights reserved.\n * \n * Subject to the following obligations and disclaimer of warranty, use and\n * redistribution of this software, in source or object code forms, with or\n * without modifications are expressly permitted by Whistle Communications;\n * provided, however, that:\n * 1. Any and all reproductions of the source or object code must include the\n *    copyright notice above and the following disclaimer of warranties; and\n * 2. No rights are granted, in any manner or form, to use Whistle\n *    Communications, Inc. trademarks, including the mark \"WHISTLE\n *    COMMUNICATIONS\" on advertising, endorsements, or otherwise except as\n *    such appears in the above copyright notice or in the software.\n * \n * THIS SOFTWARE IS BEING PROVIDED BY WHISTLE COMMUNICATIONS \"AS IS\", AND\n * TO THE MAXIMUM EXTENT PERMITTED BY LAW, WHISTLE COMMUNICATIONS MAKES NO\n * REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, REGARDING THIS SOFTWARE,\n * INCLUDING WITHOUT LIMITATION, ANY AND ALL IMPLIED WARRANTIES OF\n * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT.\n * WHISTLE COMMUNICATIONS DOES NOT WARRANT, GUARANTEE, OR MAKE ANY\n * REPRESENTATIONS REGARDING THE USE OF, OR THE RESULTS OF THE USE OF THIS\n * SOFTWARE IN TERMS OF ITS CORRECTNESS, ACCURACY, RELIABILITY OR OTHERWISE.\n * IN NO EVENT SHALL WHISTLE COMMUNICATIONS BE LIABLE FOR ANY DAMAGES\n * RESULTING FROM OR ARISING OUT OF ANY USE OF THIS SOFTWARE, INCLUDING\n * WITHOUT LIMITATION, ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,\n * PUNITIVE, OR CONSEQUENTIAL DAMAGES, PROCUREMENT OF SUBSTITUTE GOODS OR\n * SERVICES, LOSS OF USE, DATA OR PROFITS, HOWEVER CAUSED AND UNDER ANY\n * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF\n * THIS SOFTWARE, EVEN IF WHISTLE COMMUNICATIONS IS ADVISED OF THE POSSIBILITY\n * OF SUCH DAMAGE.\n *\n * Author: Archie Cobbs <archie@freebsd.org>\n *\n * $FreeBSD: release/9.0.0/sys/netgraph/ng_rfc1490.h 139823 2005-01-07 01:45:51Z imp $\n * $Whistle: ng_rfc1490.h,v 1.7 1999/01/20 00:54:15 archie Exp $\n */\n\n#ifndef _NETGRAPH_NG_RFC1490_H_\n#define _NETGRAPH_NG_RFC1490_H_\n\n/* Node type name */\n#define NG_RFC1490_NODE_TYPE\t\t\"rfc1490\"\n#define NGM_RFC1490_COOKIE\t\t1086947474\n\n/* Hook names */\n#define NG_RFC1490_HOOK_DOWNSTREAM\t\"downstream\"\n#define NG_RFC1490_HOOK_INET\t\t\"inet\"\n#define NG_RFC1490_HOOK_PPP\t\t\"ppp\"\n#define NG_RFC1490_HOOK_ETHERNET\t\"ethernet\"\n\n/* Netgraph commands */\nenum {\n\tNGM_RFC1490_SET_ENCAP,\t\t/* sets encapsulation method */\n\tNGM_RFC1490_GET_ENCAP,\t\t/* gets current encapsulation method */\n};\n\n#endif /* _NETGRAPH_NG_RFC1490_H_ */\n"
  },
  {
    "path": "freebsd-headers/netgraph/ng_sample.h",
    "content": "/*\n * ng_sample.h\n */\n\n/*-\n * Copyright (c) 1996-1999 Whistle Communications, Inc.\n * All rights reserved.\n * \n * Subject to the following obligations and disclaimer of warranty, use and\n * redistribution of this software, in source or object code forms, with or\n * without modifications are expressly permitted by Whistle Communications;\n * provided, however, that:\n * 1. Any and all reproductions of the source or object code must include the\n *    copyright notice above and the following disclaimer of warranties; and\n * 2. No rights are granted, in any manner or form, to use Whistle\n *    Communications, Inc. trademarks, including the mark \"WHISTLE\n *    COMMUNICATIONS\" on advertising, endorsements, or otherwise except as\n *    such appears in the above copyright notice or in the software.\n * \n * THIS SOFTWARE IS BEING PROVIDED BY WHISTLE COMMUNICATIONS \"AS IS\", AND\n * TO THE MAXIMUM EXTENT PERMITTED BY LAW, WHISTLE COMMUNICATIONS MAKES NO\n * REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, REGARDING THIS SOFTWARE,\n * INCLUDING WITHOUT LIMITATION, ANY AND ALL IMPLIED WARRANTIES OF\n * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT.\n * WHISTLE COMMUNICATIONS DOES NOT WARRANT, GUARANTEE, OR MAKE ANY\n * REPRESENTATIONS REGARDING THE USE OF, OR THE RESULTS OF THE USE OF THIS\n * SOFTWARE IN TERMS OF ITS CORRECTNESS, ACCURACY, RELIABILITY OR OTHERWISE.\n * IN NO EVENT SHALL WHISTLE COMMUNICATIONS BE LIABLE FOR ANY DAMAGES\n * RESULTING FROM OR ARISING OUT OF ANY USE OF THIS SOFTWARE, INCLUDING\n * WITHOUT LIMITATION, ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,\n * PUNITIVE, OR CONSEQUENTIAL DAMAGES, PROCUREMENT OF SUBSTITUTE GOODS OR\n * SERVICES, LOSS OF USE, DATA OR PROFITS, HOWEVER CAUSED AND UNDER ANY\n * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF\n * THIS SOFTWARE, EVEN IF WHISTLE COMMUNICATIONS IS ADVISED OF THE POSSIBILITY\n * OF SUCH DAMAGE.\n *\n * Author: Julian Elischer <julian@freebsd.org>\n *\n * $FreeBSD: release/9.0.0/sys/netgraph/ng_sample.h 139823 2005-01-07 01:45:51Z imp $\n * $Whistle: ng_sample.h,v 1.3 1999/01/20 00:22:14 archie Exp $\n */\n\n#ifndef _NETGRAPH_NG_SAMPLE_H_\n#define _NETGRAPH_NG_SAMPLE_H_\n\n/* Node type name. This should be unique among all netgraph node types */\n#define NG_XXX_NODE_TYPE\t\"sample\"\n\n/* Node type cookie. Should also be unique. This value MUST change whenever\n   an incompatible change is made to this header file, to insure consistency.\n   The de facto method for generating cookies is to take the output of the\n   date command: date -u +'%s' */\n#define NGM_XXX_COOKIE\t\t915491374\n\n/* Number of active DLCI's we can handle */\n#define\tXXX_NUM_DLCIS\t\t16\n\n/* Hook names */\n#define NG_XXX_HOOK_DLCI_LEADIN\t\"dlci\"\n#define NG_XXX_HOOK_DOWNSTREAM\t\"downstream\"\n#define NG_XXX_HOOK_DEBUG\t\"debug\"\n\n/* Netgraph commands understood by this node type */\nenum {\n\tNGM_XXX_SET_FLAG = 1,\n\tNGM_XXX_GET_STATUS,\n};\n\n/* This structure is returned by the NGM_XXX_GET_STATUS command */\nstruct ngxxxstat {\n\tu_int32_t   packets_in;\t\t/* packets in from downstream */\n\tu_int32_t   packets_out;\t/* packets out towards downstream */\n};\n\n/*\n * This is used to define the 'parse type' for a struct ngxxxstat, which\n * is bascially a description of how to convert a binary struct ngxxxstat\n * to an ASCII string and back.  See ng_parse.h for more info.\n *\n * This needs to be kept in sync with the above structure definition\n */\n#define NG_XXX_STATS_TYPE_INFO\t{\t\t\t\t\\\n\t  { \"packets_in\",\t&ng_parse_uint32_type\t},\t\\\n\t  { \"packets_out\",\t&ng_parse_uint32_type\t},\t\\\n\t  { NULL }\t\t\t\t\t\t\\\n}\n\n#endif /* _NETGRAPH_NG_SAMPLE_H_ */\n"
  },
  {
    "path": "freebsd-headers/netgraph/ng_socket.h",
    "content": "/*\n * ng_socket.h\n */\n\n/*-\n * Copyright (c) 1996-1999 Whistle Communications, Inc.\n * All rights reserved.\n * \n * Subject to the following obligations and disclaimer of warranty, use and\n * redistribution of this software, in source or object code forms, with or\n * without modifications are expressly permitted by Whistle Communications;\n * provided, however, that:\n * 1. Any and all reproductions of the source or object code must include the\n *    copyright notice above and the following disclaimer of warranties; and\n * 2. No rights are granted, in any manner or form, to use Whistle\n *    Communications, Inc. trademarks, including the mark \"WHISTLE\n *    COMMUNICATIONS\" on advertising, endorsements, or otherwise except as\n *    such appears in the above copyright notice or in the software.\n * \n * THIS SOFTWARE IS BEING PROVIDED BY WHISTLE COMMUNICATIONS \"AS IS\", AND\n * TO THE MAXIMUM EXTENT PERMITTED BY LAW, WHISTLE COMMUNICATIONS MAKES NO\n * REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, REGARDING THIS SOFTWARE,\n * INCLUDING WITHOUT LIMITATION, ANY AND ALL IMPLIED WARRANTIES OF\n * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT.\n * WHISTLE COMMUNICATIONS DOES NOT WARRANT, GUARANTEE, OR MAKE ANY\n * REPRESENTATIONS REGARDING THE USE OF, OR THE RESULTS OF THE USE OF THIS\n * SOFTWARE IN TERMS OF ITS CORRECTNESS, ACCURACY, RELIABILITY OR OTHERWISE.\n * IN NO EVENT SHALL WHISTLE COMMUNICATIONS BE LIABLE FOR ANY DAMAGES\n * RESULTING FROM OR ARISING OUT OF ANY USE OF THIS SOFTWARE, INCLUDING\n * WITHOUT LIMITATION, ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,\n * PUNITIVE, OR CONSEQUENTIAL DAMAGES, PROCUREMENT OF SUBSTITUTE GOODS OR\n * SERVICES, LOSS OF USE, DATA OR PROFITS, HOWEVER CAUSED AND UNDER ANY\n * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF\n * THIS SOFTWARE, EVEN IF WHISTLE COMMUNICATIONS IS ADVISED OF THE POSSIBILITY\n * OF SUCH DAMAGE.\n *\n * Author: Julian Elischer <julian@freebsd.org>\n *\n * $FreeBSD: release/9.0.0/sys/netgraph/ng_socket.h 163462 2006-10-17 11:03:55Z glebius $\n * $Whistle: ng_socket.h,v 1.5 1999/01/20 00:22:14 archie Exp $\n */\n\n#ifndef _NETGRAPH_NG_SOCKET_H_\n#define _NETGRAPH_NG_SOCKET_H_\n\n/* Netgraph node type name and cookie */\n#define\tNG_SOCKET_NODE_TYPE\t\"socket\"\n#define\tNGM_SOCKET_COOKIE\t851601233\n\n/* Netgraph socket(2) constants */\n#define\tNG_DATA\t\t\t1\n#define\tNG_CONTROL\t\t2\n\n/* Commands */\nenum {\n\tNGM_SOCK_CMD_NOLINGER = 1,\t/* close the socket with last hook */\n\tNGM_SOCK_CMD_LINGER\t\t/* Keep socket even if 0 hooks */\n};\n\n/* Netgraph version of struct sockaddr */\nstruct sockaddr_ng {\n\tunsigned char\tsg_len;\t\t/* total length */\n\tsa_family_t\tsg_family;\t/* address family */\n\tchar\t\tsg_data[14];\t/* actually longer; address value */\n};\n\n#endif /* _NETGRAPH_NG_SOCKET_H_ */\n\n"
  },
  {
    "path": "freebsd-headers/netgraph/ng_socketvar.h",
    "content": "/*\n * netgraph.h\n */\n\n/*-\n * Copyright (c) 1996-1999 Whistle Communications, Inc.\n * All rights reserved.\n * \n * Subject to the following obligations and disclaimer of warranty, use and\n * redistribution of this software, in source or object code forms, with or\n * without modifications are expressly permitted by Whistle Communications;\n * provided, however, that:\n * 1. Any and all reproductions of the source or object code must include the\n *    copyright notice above and the following disclaimer of warranties; and\n * 2. No rights are granted, in any manner or form, to use Whistle\n *    Communications, Inc. trademarks, including the mark \"WHISTLE\n *    COMMUNICATIONS\" on advertising, endorsements, or otherwise except as\n *    such appears in the above copyright notice or in the software.\n * \n * THIS SOFTWARE IS BEING PROVIDED BY WHISTLE COMMUNICATIONS \"AS IS\", AND\n * TO THE MAXIMUM EXTENT PERMITTED BY LAW, WHISTLE COMMUNICATIONS MAKES NO\n * REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, REGARDING THIS SOFTWARE,\n * INCLUDING WITHOUT LIMITATION, ANY AND ALL IMPLIED WARRANTIES OF\n * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT.\n * WHISTLE COMMUNICATIONS DOES NOT WARRANT, GUARANTEE, OR MAKE ANY\n * REPRESENTATIONS REGARDING THE USE OF, OR THE RESULTS OF THE USE OF THIS\n * SOFTWARE IN TERMS OF ITS CORRECTNESS, ACCURACY, RELIABILITY OR OTHERWISE.\n * IN NO EVENT SHALL WHISTLE COMMUNICATIONS BE LIABLE FOR ANY DAMAGES\n * RESULTING FROM OR ARISING OUT OF ANY USE OF THIS SOFTWARE, INCLUDING\n * WITHOUT LIMITATION, ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,\n * PUNITIVE, OR CONSEQUENTIAL DAMAGES, PROCUREMENT OF SUBSTITUTE GOODS OR\n * SERVICES, LOSS OF USE, DATA OR PROFITS, HOWEVER CAUSED AND UNDER ANY\n * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF\n * THIS SOFTWARE, EVEN IF WHISTLE COMMUNICATIONS IS ADVISED OF THE POSSIBILITY\n * OF SUCH DAMAGE.\n *\n * Author: Julian Elischer <julian@freebsd.org>\n *\n * $FreeBSD: release/9.0.0/sys/netgraph/ng_socketvar.h 205083 2010-03-12 15:04:59Z glebius $\n * $Whistle: ng_socketvar.h,v 1.1 1999/01/20 21:35:39 archie Exp $\n */\n\n#ifndef _NETGRAPH_NG_SOCKETVAR_H_\n#define _NETGRAPH_NG_SOCKETVAR_H_\n\n/* Netgraph protocol control block for each socket */\nstruct ngpcb {\n\tstruct socket\t *ng_socket;\t/* the socket */\n\tstruct ngsock\t *sockdata;\t/* netgraph info */\n\tLIST_ENTRY(ngpcb) socks;\t/* linked list of sockets */\n\tint\t\t  type;\t\t/* NG_CONTROL or NG_DATA */\n};\n\n/* Per-node private data */\nstruct ngsock {\n\tstruct ng_node\t*node;\t\t/* the associated netgraph node */\n\tstruct ngpcb\t*datasock;\t/* optional data socket */\n\tstruct ngpcb\t*ctlsock;\t/* optional control socket */\n\tint    flags;\n\tint    refs;\n\tstruct mtx\tmtx;\t\t/* mtx to wait on */\n\tint\t\terror;\t\t/* place to store error */\n\tng_ID_t\t\tnode_id;\t/* a hint for netstat(1) to find the node */\n};\n#define\tNGS_FLAG_NOLINGER\t1\t/* close with last hook */\n\n#endif /* _NETGRAPH_NG_SOCKETVAR_H_ */\n\n"
  },
  {
    "path": "freebsd-headers/netgraph/ng_source.h",
    "content": "/*\n * ng_source.h\n */\n\n/*-\n * Copyright 2002 Sandvine Inc.\n * All rights reserved.\n *\n * Subject to the following obligations and disclaimer of warranty, use and\n * redistribution of this software, in source or object code forms, with or\n * without modifications are expressly permitted by Sandvine Inc.; provided,\n * however, that:\n * 1. Any and all reproductions of the source or object code must include the\n *    copyright notice above and the following disclaimer of warranties; and\n * 2. No rights are granted, in any manner or form, to use Sandvine Inc.\n *    trademarks, including the mark \"SANDVINE\" on advertising, endorsements,\n *    or otherwise except as such appears in the above copyright notice or in\n *    the software.\n *\n * THIS SOFTWARE IS BEING PROVIDED BY SANDVINE \"AS IS\", AND TO THE MAXIMUM\n * EXTENT PERMITTED BY LAW, SANDVINE MAKES NO REPRESENTATIONS OR WARRANTIES,\n * EXPRESS OR IMPLIED, REGARDING THIS SOFTWARE, INCLUDING WITHOUT LIMITATION,\n * ANY AND ALL IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR\n * PURPOSE, OR NON-INFRINGEMENT.  SANDVINE DOES NOT WARRANT, GUARANTEE, OR\n * MAKE ANY REPRESENTATIONS REGARDING THE USE OF, OR THE RESULTS OF THE\n * USE OF THIS SOFTWARE IN TERMS OF ITS CORRECTNESS, ACCURACY, RELIABILITY\n * OR OTHERWISE.  IN NO EVENT SHALL SANDVINE BE LIABLE FOR ANY DAMAGES\n * RESULTING FROM OR ARISING OUT OF ANY USE OF THIS SOFTWARE, INCLUDING\n * WITHOUT LIMITATION, ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,\n * PUNITIVE, OR CONSEQUENTIAL DAMAGES, PROCUREMENT OF SUBSTITUTE GOODS OR\n * SERVICES, LOSS OF USE, DATA OR PROFITS, HOWEVER CAUSED AND UNDER ANY\n * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF\n * THIS SOFTWARE, EVEN IF SANDVINE IS ADVISED OF THE POSSIBILITY OF SUCH\n * DAMAGE.\n *\n * Author: Dave Chapeskie\n *\n * $FreeBSD: release/9.0.0/sys/netgraph/ng_source.h 209730 2010-07-06 16:55:39Z emaste $\n */\n\n#ifndef _NETGRAPH_NG_SOURCE_H_\n#define _NETGRAPH_NG_SOURCE_H_\n\n/* Node type name and magic cookie */\n#define NG_SOURCE_NODE_TYPE\t\"source\"\n#define NGM_SOURCE_COOKIE\t1110646684\n\n/* Hook names */\n#define NG_SOURCE_HOOK_INPUT\t\"input\"\n#define NG_SOURCE_HOOK_OUTPUT\t\"output\"\n\n/* Statistics structure returned by NGM_SOURCE_GET_STATS */\nstruct ng_source_stats {\n\tuint64_t\toutOctets;\n\tuint64_t\toutFrames;\n\tuint32_t\tqueueOctets;\n\tuint32_t\tqueueFrames;\n\tuint32_t\tmaxPps;\n\tstruct timeval\tstartTime;\n\tstruct timeval\tendTime;\n\tstruct timeval\telapsedTime;\n\tstruct timeval\tlastTime;\n};\n\nextern const struct ng_parse_type ng_source_timeval_type;\n/* Keep this in sync with the above structure definition */\n#define NG_SOURCE_STATS_TYPE_INFO\t{\t\t\t\\\n\t  { \"outOctets\",\t&ng_parse_uint64_type\t},\t\\\n\t  { \"outFrames\",\t&ng_parse_uint64_type\t},\t\\\n\t  { \"queueOctets\",\t&ng_parse_uint32_type\t},\t\\\n\t  { \"queueFrames\",\t&ng_parse_uint32_type\t},\t\\\n\t  { \"maxPps\",\t\t&ng_parse_uint32_type\t},\t\\\n\t  { \"startTime\",\t&ng_source_timeval_type },\t\\\n\t  { \"endTime\",\t\t&ng_source_timeval_type },\t\\\n\t  { \"elapsedTime\",\t&ng_source_timeval_type },\t\\\n\t  { \"lastTime\",\t\t&ng_source_timeval_type },\t\\\n\t  { NULL }\t\t\t\t\t\t\\\n}\n\n/* Packet embedding info for NGM_SOURCE_GET/SET_TIMESTAMP */\nstruct ng_source_embed_info {\n\tuint16_t\toffset;\t\t/* offset from ethernet header */\n\tuint8_t\t\tflags;\n\tuint8_t\t\tspare;\n};\n#define NGM_SOURCE_EMBED_ENABLE\t\t0x01\t/* enable embedding */\n#define\tNGM_SOURCE_INC_CNT_PER_LIST\t0x02\t/* increment once per list */\n\n/* Keep this in sync with the above structure definition. */\n#define NG_SOURCE_EMBED_TYPE_INFO {\t\t\t\t\\\n\t{ \"offset\",\t\t&ng_parse_hint16_type\t},\t\\\n\t{ \"flags\",\t\t&ng_parse_hint8_type\t},\t\\\n\t{ NULL }\t\t\t\t\t\t\\\n}\n\n/* Packet embedding info for NGM_SOURCE_GET/SET_COUNTER */\n#define\tNG_SOURCE_COUNTERS\t4\nstruct ng_source_embed_cnt_info {\n\tuint16_t\toffset;\t\t/* offset from ethernet header */\n\tuint8_t\t\tflags;\t\t/* as above */\n\tuint8_t\t\twidth;\t\t/* in bytes (1, 2, 4) */\n\tuint32_t\tnext_val;\n\tuint32_t\tmin_val;\n\tuint32_t\tmax_val;\n\tint32_t\t\tincrement;\n\tuint8_t\t\tindex;\t\t/* which counter (0..3) */\n};\n\n/* Keep this in sync with the above structure definition. */\n#define NG_SOURCE_EMBED_CNT_TYPE_INFO {\t\t\t\t\\\n\t{ \"offset\",\t\t&ng_parse_hint16_type\t}, \t\\\n\t{ \"flags\",\t\t&ng_parse_hint8_type\t},\t\\\n\t{ \"width\",\t\t&ng_parse_uint8_type\t},\t\\\n\t{ \"next_val\",\t\t&ng_parse_uint32_type\t},\t\\\n\t{ \"min_val\",\t\t&ng_parse_uint32_type\t},\t\\\n\t{ \"max_val\",\t\t&ng_parse_uint32_type\t},\t\\\n\t{ \"increment\",\t\t&ng_parse_int32_type\t},\t\\\n\t{ \"index\",\t\t&ng_parse_uint8_type\t},\t\\\n\t{ NULL }\t\t\t\t\t\t\\\n}\n\n/* Netgraph commands */\nenum {\n\tNGM_SOURCE_GET_STATS = 1,\t/* get stats */\n\tNGM_SOURCE_CLR_STATS,\t\t/* clear stats */\n\tNGM_SOURCE_GETCLR_STATS,\t/* atomically get and clear stats */\n\tNGM_SOURCE_START,\t\t/* start sending queued data */\n\tNGM_SOURCE_STOP,\t\t/* stop sending queued data */\n\tNGM_SOURCE_CLR_DATA,\t\t/* clear the queued data */\n\tNGM_SOURCE_SETIFACE,\t\t/* configure downstream iface */\n\tNGM_SOURCE_SETPPS,\t\t/* rate-limiting packets per second */\n\tNGM_SOURCE_SET_TIMESTAMP,\t/* embed xmit timestamp */\n\tNGM_SOURCE_GET_TIMESTAMP,\n\tNGM_SOURCE_SET_COUNTER,\t\t/* embed counter */\n\tNGM_SOURCE_GET_COUNTER,\n};\n\n#endif /* _NETGRAPH_NG_SOURCE_H_ */\n"
  },
  {
    "path": "freebsd-headers/netgraph/ng_split.h",
    "content": "/*-\n *\n * Copyright (c) 1999-2000, Vitaly V Belekhov\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice unmodified, this list of conditions, and the following\n *    disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/netgraph/ng_split.h 151676 2005-10-25 20:56:12Z ru $\n *\n */\n\n\n#ifndef _NETGRAPH_NG_SPLIT_H_\n#define _NETGRAPH_NG_SPLIT_H_\n\n/* Node type name and magic cookie */\n#define NG_SPLIT_NODE_TYPE\t\"split\"\n#define NGM_SPLIT_COOKIE\t949409402\n\n/* My hook names */\n#define NG_SPLIT_HOOK_MIXED\t\"mixed\"\t/* Mixed stream (in/out) */\n#define NG_SPLIT_HOOK_OUT\t\"out\"\t/* Output to outhook (sending out) */\n#define NG_SPLIT_HOOK_IN\t\"in\"\t/* Input from inhook (recieving) */\n\n#endif /* _NETGRAPH_NG_SPLIT_H_ */\n"
  },
  {
    "path": "freebsd-headers/netgraph/ng_sppp.h",
    "content": "/*\n * ng_sppp.h Netgraph to Sppp module.\n */\n\n/*-\n * Copyright (C) 2002-2004 Cronyx Engineering.\n * Copyright (C) 2002-2004 Roman Kurakin <rik@cronyx.ru>\n *\n * This software is distributed with NO WARRANTIES, not even the implied\n * warranties for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n *\n * Authors grant any other persons or organisations a permission to use,\n * modify and redistribute this software in source and binary forms,\n * as long as this message is kept with the software, all derivative\n * works or modified versions.\n *\n * $FreeBSD: release/9.0.0/sys/netgraph/ng_sppp.h 141197 2005-02-03 13:03:31Z ru $\n * Cronyx Id: ng_sppp.h,v 1.1.2.6 2004/03/01 15:17:21 rik Exp $\n */\n\n#ifndef _NETGRAPH_SPPP_H_\n#define _NETGRAPH_SPPP_H_\n\n/* Node type name and magic cookie */\n#define NG_SPPP_NODE_TYPE\t\t\"sppp\"\n#define NGM_SPPP_COOKIE\t\t\t1040804655\n\n/* Interface base name */\n#define NG_SPPP_IFACE_NAME\t\t\"sppp\"\n\n/* My hook names */\n#define NG_SPPP_HOOK_DOWNSTREAM\t\t\"downstream\"\n\n/* Netgraph commands */\nenum {\n\tNGM_SPPP_GET_IFNAME = 1,\t/* returns struct ng_sppp_ifname */\n};\n\n#endif /* _NETGRAPH_SPPP_H_ */\n"
  },
  {
    "path": "freebsd-headers/netgraph/ng_tag.h",
    "content": "/*-\n * Copyright (c) 2006 Vadim Goncharov <vadimnuclight@tpu.ru>\n * All rights reserved.\n * \n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice unmodified, this list of conditions, and the following\n *    disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/netgraph/ng_tag.h 159979 2006-06-27 12:45:28Z glebius $\n */\n\n#ifndef _NETGRAPH_NG_TAG_H_\n#define _NETGRAPH_NG_TAG_H_\n\n/* Node type name and magic cookie. */\n#define NG_TAG_NODE_TYPE\t\"tag\"\n#define NGM_TAG_COOKIE\t\t1149771193\n\n/*\n * The types of tag_cookie, tag_len and tag_id in structures below\n * must be the same as corresponding members m_tag_cookie, m_tag_len\n * and m_tag_id in struct m_tag (defined in <sys/mbuf.h>).\n */\n\n/* Tag match structure for every (input) hook. */\nstruct ng_tag_hookin {\n\tchar\t\tthisHook[NG_HOOKSIZ];\t\t/* name of hook */\n\tchar\t\tifMatch[NG_HOOKSIZ];\t\t/* match dest hook */\n\tchar\t\tifNotMatch[NG_HOOKSIZ];\t\t/* !match dest hook */\n\tuint8_t\t\tstrip;\t\t\t\t/* strip tag if found */\n\tuint32_t\ttag_cookie;\t\t\t/* ABI/Module ID */\n\tuint16_t\ttag_id;\t\t\t\t/* tag ID */\n\tuint16_t\ttag_len;\t\t\t/* length of data */\n\tuint8_t\t\ttag_data[0];\t\t\t/* tag data */\n};\n\n/* Tag set structure for every (output) hook. */\nstruct ng_tag_hookout {\n\tchar\t\tthisHook[NG_HOOKSIZ];\t\t/* name of hook */\n\tuint32_t\ttag_cookie;\t\t\t/* ABI/Module ID */\n\tuint16_t\ttag_id;\t\t\t\t/* tag ID */\n\tuint16_t\ttag_len;\t\t\t/* length of data */\n\tuint8_t\t\ttag_data[0];\t\t\t/* tag data */\n};\n\n#define NG_TAG_HOOKIN_SIZE(taglen)\t\\\n\t(sizeof(struct ng_tag_hookin) + (taglen))\n\n#define NG_TAG_HOOKOUT_SIZE(taglen)\t\\\n\t(sizeof(struct ng_tag_hookout) + (taglen))\n\n/* Keep this in sync with the above structures definitions. */\n#define NG_TAG_HOOKIN_TYPE_INFO(tdtype)\t{\t\t\\\n\t  { \"thisHook\",\t\t&ng_parse_hookbuf_type\t},\t\\\n\t  { \"ifMatch\",\t\t&ng_parse_hookbuf_type\t},\t\\\n\t  { \"ifNotMatch\",\t&ng_parse_hookbuf_type\t},\t\\\n\t  { \"strip\",\t\t&ng_parse_uint8_type\t},\t\\\n\t  { \"tag_cookie\",\t&ng_parse_uint32_type\t},\t\\\n\t  { \"tag_id\",\t\t&ng_parse_uint16_type\t},\t\\\n\t  { \"tag_len\",\t\t&ng_parse_uint16_type\t},\t\\\n\t  { \"tag_data\",\t\t(tdtype)\t\t},\t\\\n\t  { NULL }\t\t\t\t\t\t\\\n}\n\n#define NG_TAG_HOOKOUT_TYPE_INFO(tdtype)\t{\t\t\\\n\t  { \"thisHook\",\t\t&ng_parse_hookbuf_type\t},\t\\\n\t  { \"tag_cookie\",\t&ng_parse_uint32_type\t},\t\\\n\t  { \"tag_id\",\t\t&ng_parse_uint16_type\t},\t\\\n\t  { \"tag_len\",\t\t&ng_parse_uint16_type\t},\t\\\n\t  { \"tag_data\",\t\t(tdtype)\t\t},\t\\\n\t  { NULL }\t\t\t\t\t\t\\\n}\n\n#ifdef NG_TAG_DEBUG\n\n/* Statistics structure for one hook. */\nstruct ng_tag_hookstat {\n\tuint64_t\trecvFrames;\n\tuint64_t\trecvOctets;\n\tuint64_t\trecvMatchFrames;\n\tuint64_t\trecvMatchOctets;\n\tuint64_t\txmitFrames;\n\tuint64_t\txmitOctets;\n};\n\n/* Keep this in sync with the above structure definition. */\n#define NG_TAG_HOOKSTAT_TYPE_INFO\t{\t\t\t\\\n\t  { \"recvFrames\",\t&ng_parse_uint64_type\t},\t\\\n\t  { \"recvOctets\",\t&ng_parse_uint64_type\t},\t\\\n\t  { \"recvMatchFrames\",\t&ng_parse_uint64_type\t},\t\\\n\t  { \"recvMatchOctets\",\t&ng_parse_uint64_type\t},\t\\\n\t  { \"xmitFrames\",\t&ng_parse_uint64_type\t},\t\\\n\t  { \"xmitOctets\",\t&ng_parse_uint64_type\t},\t\\\n\t  { NULL }\t\t\t\t\t\t\\\n}\n\n#endif /* NG_TAG_DEBUG */\n\n/* Netgraph commands. */\nenum {\n\tNGM_TAG_SET_HOOKIN = 1,\t\t/* supply a struct ng_tag_hookin */\n\tNGM_TAG_GET_HOOKIN,\t\t/* returns a struct ng_tag_hookin */\n\tNGM_TAG_SET_HOOKOUT,\t\t/* supply a struct ng_tag_hookout */\n\tNGM_TAG_GET_HOOKOUT,\t\t/* returns a struct ng_tag_hookout */\n#ifdef NG_TAG_DEBUG\n\tNGM_TAG_GET_STATS,\t\t/* supply name as char[NG_HOOKSIZ] */\n\tNGM_TAG_CLR_STATS,\t\t/* supply name as char[NG_HOOKSIZ] */\n\tNGM_TAG_GETCLR_STATS,\t\t/* supply name as char[NG_HOOKSIZ] */\n#endif\n};\n\n#endif /* _NETGRAPH_NG_TAG_H_ */\n"
  },
  {
    "path": "freebsd-headers/netgraph/ng_tcpmss.h",
    "content": "/*-\n * ng_tcpmss.h\n *\n * Copyright (c) 2004, Alexey Popov <lollypop@flexuser.ru>\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice unmodified, this list of conditions, and the following\n *    disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/netgraph/ng_tcpmss.h 147231 2005-06-10 08:02:34Z glebius $\n */\n\n#ifndef _NETGRAPH_TCPMSS_H_\n#define _NETGRAPH_TCPMSS_H_\n\n/* Node type name and magic cookie */\n#define NG_TCPMSS_NODE_TYPE\t\"tcpmss\"\n#define NGM_TCPMSS_COOKIE\t1097623478\n\n/* Statistics structure for one hook. */\nstruct ng_tcpmss_hookstat {\n\tuint64_t\tOctets;\n\tuint64_t\tPackets;\n\tuint16_t\tmaxMSS;\n\tuint64_t\tSYNPkts;\n\tuint64_t\tFixedPkts;\n};\n\n/* Keep this in sync with the above structure definition. */\n#define NG_TCPMSS_HOOKSTAT_INFO\t{\t\t\t\\\n\t{ \"Octets\",\t&ng_parse_uint64_type\t},\t\\\n\t{ \"Packets\",\t&ng_parse_uint64_type\t},\t\\\n\t{ \"maxMSS\",\t&ng_parse_uint16_type\t},\t\\\n\t{ \"SYNPkts\",\t&ng_parse_uint64_type\t},\t\\\n\t{ \"FixedPkts\",\t&ng_parse_uint64_type\t},\t\\\n\t{ NULL }\t\t\t\t\t\\\n}\n\n\n/* Structure for NGM_TCPMSS_CONFIG. */\nstruct ng_tcpmss_config {\n\tchar\t\tinHook[NG_HOOKSIZ];\n\tchar\t\toutHook[NG_HOOKSIZ];\n\tuint16_t\tmaxMSS;\n};\n\n/* Keep this in sync with the above structure definition. */\n#define NG_TCPMSS_CONFIG_INFO {\t\t\t\t\\\n\t{ \"inHook\",\t&ng_parse_hookbuf_type\t},\t\\\n\t{ \"outHook\",\t&ng_parse_hookbuf_type\t},\t\\\n\t{ \"maxMSS\",\t&ng_parse_uint16_type\t},\t\\\n\t{ NULL }\t\t\t\t\t\\\n}\n\n/* Netgraph commands */\nenum {\n\tNGM_TCPMSS_GET_STATS = 1,\t/* Get stats. */\n\tNGM_TCPMSS_CLR_STATS,\t\t/* Clear stats. */\n\tNGM_TCPMSS_GETCLR_STATS,\t/* \"Atomically\" get and clear stats. */\n\tNGM_TCPMSS_CONFIG\t\t/* Set configuration. */\n};\n\n#endif /* _NETGRAPH_TCPMSS_H_ */\n"
  },
  {
    "path": "freebsd-headers/netgraph/ng_tee.h",
    "content": "\n/*\n * ng_tee.h\n */\n\n/*-\n * Copyright (c) 1996-1999 Whistle Communications, Inc.\n * All rights reserved.\n * \n * Subject to the following obligations and disclaimer of warranty, use and\n * redistribution of this software, in source or object code forms, with or\n * without modifications are expressly permitted by Whistle Communications;\n * provided, however, that:\n * 1. Any and all reproductions of the source or object code must include the\n *    copyright notice above and the following disclaimer of warranties; and\n * 2. No rights are granted, in any manner or form, to use Whistle\n *    Communications, Inc. trademarks, including the mark \"WHISTLE\n *    COMMUNICATIONS\" on advertising, endorsements, or otherwise except as\n *    such appears in the above copyright notice or in the software.\n * \n * THIS SOFTWARE IS BEING PROVIDED BY WHISTLE COMMUNICATIONS \"AS IS\", AND\n * TO THE MAXIMUM EXTENT PERMITTED BY LAW, WHISTLE COMMUNICATIONS MAKES NO\n * REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, REGARDING THIS SOFTWARE,\n * INCLUDING WITHOUT LIMITATION, ANY AND ALL IMPLIED WARRANTIES OF\n * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT.\n * WHISTLE COMMUNICATIONS DOES NOT WARRANT, GUARANTEE, OR MAKE ANY\n * REPRESENTATIONS REGARDING THE USE OF, OR THE RESULTS OF THE USE OF THIS\n * SOFTWARE IN TERMS OF ITS CORRECTNESS, ACCURACY, RELIABILITY OR OTHERWISE.\n * IN NO EVENT SHALL WHISTLE COMMUNICATIONS BE LIABLE FOR ANY DAMAGES\n * RESULTING FROM OR ARISING OUT OF ANY USE OF THIS SOFTWARE, INCLUDING\n * WITHOUT LIMITATION, ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,\n * PUNITIVE, OR CONSEQUENTIAL DAMAGES, PROCUREMENT OF SUBSTITUTE GOODS OR\n * SERVICES, LOSS OF USE, DATA OR PROFITS, HOWEVER CAUSED AND UNDER ANY\n * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF\n * THIS SOFTWARE, EVEN IF WHISTLE COMMUNICATIONS IS ADVISED OF THE POSSIBILITY\n * OF SUCH DAMAGE.\n *\n * Author: Archie Cobbs <archie@freebsd.org>\n *\n * $FreeBSD: release/9.0.0/sys/netgraph/ng_tee.h 139823 2005-01-07 01:45:51Z imp $\n * $Whistle: ng_tee.h,v 1.2 1999/01/20 00:22:14 archie Exp $\n */\n\n#ifndef _NETGRAPH_NG_TEE_H_\n#define _NETGRAPH_NG_TEE_H_\n\n/* Node type name and magic cookie */\n#define NG_TEE_NODE_TYPE\t\"tee\"\n#define NGM_TEE_COOKIE\t\t916107047\n\n/* Hook names */\n#define NG_TEE_HOOK_RIGHT\t\"right\"\n#define NG_TEE_HOOK_LEFT\t\"left\"\n#define NG_TEE_HOOK_RIGHT2LEFT\t\"right2left\"\n#define NG_TEE_HOOK_LEFT2RIGHT\t\"left2right\"\n\n/* Statistics structure for one hook */\nstruct ng_tee_hookstat {\n\tu_int64_t\tinOctets;\n\tu_int64_t\tinFrames;\n\tu_int64_t\toutOctets;\n\tu_int64_t\toutFrames;\n};\n\n/* Keep this in sync with the above structure definition */\n#define NG_TEE_HOOKSTAT_INFO\t{\t\t\t\t\\\n\t  { \"inOctets\",\t\t&ng_parse_uint64_type\t},\t\\\n\t  { \"inFrames\",\t\t&ng_parse_uint64_type\t},\t\\\n\t  { \"outOctets\",\t&ng_parse_uint64_type\t},\t\\\n\t  { \"outFrames\",\t&ng_parse_uint64_type\t},\t\\\n\t  { NULL }\t\t\t\t\t\t\\\n}\n\n/* Statistics structure returned by NGM_TEE_GET_STATS */\nstruct ng_tee_stats {\n\tstruct ng_tee_hookstat\tright;\n\tstruct ng_tee_hookstat\tleft;\n\tstruct ng_tee_hookstat\tright2left;\n\tstruct ng_tee_hookstat\tleft2right;\n};\n\n/* Keep this in sync with the above structure definition */\n#define NG_TEE_STATS_INFO(hstype)\t{\t\t\t\\\n\t  { \"right\",\t\t(hstype)\t\t},\t\\\n\t  { \"left\",\t\t(hstype)\t\t},\t\\\n\t  { \"right2left\",\t(hstype)\t\t},\t\\\n\t  { \"left2right\",\t(hstype)\t\t},\t\\\n\t  { NULL }\t\t\t\t\t\t\\\n}\n\n/* Netgraph commands */\nenum {\n\tNGM_TEE_GET_STATS = 1,\t\t/* get stats */\n\tNGM_TEE_CLR_STATS,\t\t/* clear stats */\n\tNGM_TEE_GETCLR_STATS,\t\t/* atomically get and clear stats */\n};\n\n#endif /* _NETGRAPH_NG_TEE_H_ */\n"
  },
  {
    "path": "freebsd-headers/netgraph/ng_tty.h",
    "content": "\n/*\n * ng_tty.h\n */\n\n/*-\n * Copyright (c) 1996-1999 Whistle Communications, Inc.\n * All rights reserved.\n * \n * Subject to the following obligations and disclaimer of warranty, use and\n * redistribution of this software, in source or object code forms, with or\n * without modifications are expressly permitted by Whistle Communications;\n * provided, however, that:\n * 1. Any and all reproductions of the source or object code must include the\n *    copyright notice above and the following disclaimer of warranties; and\n * 2. No rights are granted, in any manner or form, to use Whistle\n *    Communications, Inc. trademarks, including the mark \"WHISTLE\n *    COMMUNICATIONS\" on advertising, endorsements, or otherwise except as\n *    such appears in the above copyright notice or in the software.\n * \n * THIS SOFTWARE IS BEING PROVIDED BY WHISTLE COMMUNICATIONS \"AS IS\", AND\n * TO THE MAXIMUM EXTENT PERMITTED BY LAW, WHISTLE COMMUNICATIONS MAKES NO\n * REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, REGARDING THIS SOFTWARE,\n * INCLUDING WITHOUT LIMITATION, ANY AND ALL IMPLIED WARRANTIES OF\n * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT.\n * WHISTLE COMMUNICATIONS DOES NOT WARRANT, GUARANTEE, OR MAKE ANY\n * REPRESENTATIONS REGARDING THE USE OF, OR THE RESULTS OF THE USE OF THIS\n * SOFTWARE IN TERMS OF ITS CORRECTNESS, ACCURACY, RELIABILITY OR OTHERWISE.\n * IN NO EVENT SHALL WHISTLE COMMUNICATIONS BE LIABLE FOR ANY DAMAGES\n * RESULTING FROM OR ARISING OUT OF ANY USE OF THIS SOFTWARE, INCLUDING\n * WITHOUT LIMITATION, ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,\n * PUNITIVE, OR CONSEQUENTIAL DAMAGES, PROCUREMENT OF SUBSTITUTE GOODS OR\n * SERVICES, LOSS OF USE, DATA OR PROFITS, HOWEVER CAUSED AND UNDER ANY\n * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF\n * THIS SOFTWARE, EVEN IF WHISTLE COMMUNICATIONS IS ADVISED OF THE POSSIBILITY\n * OF SUCH DAMAGE.\n *\n * Author: Archie Cobbs <archie@freebsd.org>\n *\n * $FreeBSD: release/9.0.0/sys/netgraph/ng_tty.h 184760 2008-11-08 02:05:41Z mav $\n * $Whistle: ng_tty.h,v 1.7 1999/01/20 00:22:15 archie Exp $\n */\n\n#ifndef _NETGRAPH_NG_TTY_H_\n#define _NETGRAPH_NG_TTY_H_\n\n/* Node type name and magic cookie */\n#define NG_TTY_NODE_TYPE\t\"tty\"\n#define NGM_TTY_COOKIE\t\t1226109660\n\n/* Default hot char */\n#define NG_TTY_DFL_HOTCHAR\t0x7e\t/* PPP flag byte */\n\n/* Hook names */\n#define NG_TTY_HOOK\t\t\"hook\"\n\n/* Netgraph commands */\nenum {\n\tNGM_TTY_GET_HOTCHAR = 1,\n\tNGM_TTY_SET_HOTCHAR,\n\tNGM_TTY_SET_TTY,\n};\n\n#endif /* _NETGRAPH_NG_TTY_H_ */\n"
  },
  {
    "path": "freebsd-headers/netgraph/ng_vjc.h",
    "content": "\n/*\n * ng_vjc.h\n */\n\n/*-\n * Copyright (c) 1996-1999 Whistle Communications, Inc.\n * All rights reserved.\n * \n * Subject to the following obligations and disclaimer of warranty, use and\n * redistribution of this software, in source or object code forms, with or\n * without modifications are expressly permitted by Whistle Communications;\n * provided, however, that:\n * 1. Any and all reproductions of the source or object code must include the\n *    copyright notice above and the following disclaimer of warranties; and\n * 2. No rights are granted, in any manner or form, to use Whistle\n *    Communications, Inc. trademarks, including the mark \"WHISTLE\n *    COMMUNICATIONS\" on advertising, endorsements, or otherwise except as\n *    such appears in the above copyright notice or in the software.\n * \n * THIS SOFTWARE IS BEING PROVIDED BY WHISTLE COMMUNICATIONS \"AS IS\", AND\n * TO THE MAXIMUM EXTENT PERMITTED BY LAW, WHISTLE COMMUNICATIONS MAKES NO\n * REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, REGARDING THIS SOFTWARE,\n * INCLUDING WITHOUT LIMITATION, ANY AND ALL IMPLIED WARRANTIES OF\n * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT.\n * WHISTLE COMMUNICATIONS DOES NOT WARRANT, GUARANTEE, OR MAKE ANY\n * REPRESENTATIONS REGARDING THE USE OF, OR THE RESULTS OF THE USE OF THIS\n * SOFTWARE IN TERMS OF ITS CORRECTNESS, ACCURACY, RELIABILITY OR OTHERWISE.\n * IN NO EVENT SHALL WHISTLE COMMUNICATIONS BE LIABLE FOR ANY DAMAGES\n * RESULTING FROM OR ARISING OUT OF ANY USE OF THIS SOFTWARE, INCLUDING\n * WITHOUT LIMITATION, ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,\n * PUNITIVE, OR CONSEQUENTIAL DAMAGES, PROCUREMENT OF SUBSTITUTE GOODS OR\n * SERVICES, LOSS OF USE, DATA OR PROFITS, HOWEVER CAUSED AND UNDER ANY\n * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF\n * THIS SOFTWARE, EVEN IF WHISTLE COMMUNICATIONS IS ADVISED OF THE POSSIBILITY\n * OF SUCH DAMAGE.\n *\n * Author: Archie Cobbs <archie@freebsd.org>\n *\n * $FreeBSD: release/9.0.0/sys/netgraph/ng_vjc.h 139823 2005-01-07 01:45:51Z imp $\n * $Whistle: ng_vjc.h,v 1.6 1999/01/25 02:40:22 archie Exp $\n */\n\n#ifndef _NETGRAPH_NG_VJC_H_\n#define _NETGRAPH_NG_VJC_H_\n\n /* Node type name and magic cookie */\n#define NG_VJC_NODE_TYPE\t\"vjc\"\n#define NGM_VJC_COOKIE\t\t868219210\n\n /* Hook names */\n#define NG_VJC_HOOK_IP\t\t\"ip\"\t\t/* normal IP traffic */\n#define NG_VJC_HOOK_VJCOMP\t\"vjcomp\"\t/* compressed TCP */\n#define NG_VJC_HOOK_VJUNCOMP\t\"vjuncomp\"\t/* uncompressed TCP */\n#define NG_VJC_HOOK_VJIP\t\"vjip\"\t\t/* uncompressed IP */\n\n /* Minimum and maximum number of compression channels */\n#define NG_VJC_MIN_CHANNELS\t4\n#define NG_VJC_MAX_CHANNELS\t16\n\n /* Configure struct */\nstruct ngm_vjc_config {\n\tu_char\tenableComp;\t/* Enable compression */\n\tu_char\tenableDecomp;\t/* Enable decompression */\n\tu_char\tmaxChannel;\t/* Number of compression channels - 1 */\n\tu_char\tcompressCID;\t/* OK to compress outgoing CID's */\n};\n\n/* Keep this in sync with the above structure definition */\n#define NG_VJC_CONFIG_TYPE_INFO\t{\t\t\t\t\\\n\t  { \"enableComp\",\t&ng_parse_uint8_type\t},\t\\\n\t  { \"enableDecomp\",\t&ng_parse_uint8_type\t},\t\\\n\t  { \"maxChannel\",\t&ng_parse_uint8_type\t},\t\\\n\t  { \"compressCID\",\t&ng_parse_uint8_type\t},\t\\\n\t  { NULL }\t\t\t\t\t\t\\\n}\n\n /* Netgraph commands */\nenum {\n\tNGM_VJC_SET_CONFIG,\t/* Supply a struct ngm_vjc_config */\n\tNGM_VJC_GET_CONFIG,\t/* Returns a struct ngm_vjc_config */\n\tNGM_VJC_GET_STATE,\t/* Returns current struct slcompress */\n\tNGM_VJC_CLR_STATS,\t/* Clears statistics counters */\n\tNGM_VJC_RECV_ERROR,\t/* Indicate loss of incoming frame */\n};\n\n#endif /* _NETGRAPH_NG_VJC_H_ */\n"
  },
  {
    "path": "freebsd-headers/netgraph/ng_vlan.h",
    "content": "/*-\n * Copyright (c) 2003 IPNET Internet Communication Company\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * Author: Ruslan Ermilov <ru@FreeBSD.org>\n *\n * $FreeBSD: release/9.0.0/sys/netgraph/ng_vlan.h 151800 2005-10-28 14:41:28Z ru $\n */\n\n#ifndef _NETGRAPH_NG_VLAN_H_\n#define\t_NETGRAPH_NG_VLAN_H_\n\n/* Node type name and magic cookie. */\n#define\tNG_VLAN_NODE_TYPE\t\"vlan\"\n#define\tNGM_VLAN_COOKIE\t\t1068486472\n\n/* Hook names. */\n#define\tNG_VLAN_HOOK_DOWNSTREAM\t\"downstream\"\n#define\tNG_VLAN_HOOK_NOMATCH\t\"nomatch\"\n\n/* Netgraph commands. */\nenum {\n\tNGM_VLAN_ADD_FILTER = 1,\n\tNGM_VLAN_DEL_FILTER,\n\tNGM_VLAN_GET_TABLE\n};\n\n/* For NGM_VLAN_ADD_FILTER control message. */\nstruct ng_vlan_filter {\n\tchar\t\thook[NG_HOOKSIZ];\n\tu_int16_t\tvlan;\n};\t\n\n/* Keep this in sync with the above structure definition.  */\n#define\tNG_VLAN_FILTER_FIELDS\t{\t\t\t\t\\\n\t{ \"hook\",\t&ng_parse_hookbuf_type  },\t\t\\\n\t{ \"vlan\",\t&ng_parse_uint16_type   },\t\t\\\n\t{ NULL }\t\t\t\t\t\t\\\n}\n\n/* Structure returned by NGM_VLAN_GET_TABLE. */\nstruct ng_vlan_table {\n\tu_int32_t\tn;\n\tstruct ng_vlan_filter filter[];\n};\n\n/* Keep this in sync with the above structure definition. */\n#define\tNG_VLAN_TABLE_FIELDS\t{\t\t\t\t\\\n\t{ \"n\",\t\t&ng_parse_uint32_type },\t\t\\\n\t{ \"filter\",\t&ng_vlan_table_array_type },\t\t\\\n\t{ NULL }\t\t\t\t\t\t\\\n}\n\n#endif /* _NETGRAPH_NG_VLAN_H_ */\n"
  },
  {
    "path": "freebsd-headers/netgraph.h",
    "content": "\n/*\n * netgraph.h\n *\n * Copyright (c) 1996-1999 Whistle Communications, Inc.\n * All rights reserved.\n * \n * Subject to the following obligations and disclaimer of warranty, use and\n * redistribution of this software, in source or object code forms, with or\n * without modifications are expressly permitted by Whistle Communications;\n * provided, however, that:\n * 1. Any and all reproductions of the source or object code must include the\n *    copyright notice above and the following disclaimer of warranties; and\n * 2. No rights are granted, in any manner or form, to use Whistle\n *    Communications, Inc. trademarks, including the mark \"WHISTLE\n *    COMMUNICATIONS\" on advertising, endorsements, or otherwise except as\n *    such appears in the above copyright notice or in the software.\n * \n * THIS SOFTWARE IS BEING PROVIDED BY WHISTLE COMMUNICATIONS \"AS IS\", AND\n * TO THE MAXIMUM EXTENT PERMITTED BY LAW, WHISTLE COMMUNICATIONS MAKES NO\n * REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, REGARDING THIS SOFTWARE,\n * INCLUDING WITHOUT LIMITATION, ANY AND ALL IMPLIED WARRANTIES OF\n * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT.\n * WHISTLE COMMUNICATIONS DOES NOT WARRANT, GUARANTEE, OR MAKE ANY\n * REPRESENTATIONS REGARDING THE USE OF, OR THE RESULTS OF THE USE OF THIS\n * SOFTWARE IN TERMS OF ITS CORRECTNESS, ACCURACY, RELIABILITY OR OTHERWISE.\n * IN NO EVENT SHALL WHISTLE COMMUNICATIONS BE LIABLE FOR ANY DAMAGES\n * RESULTING FROM OR ARISING OUT OF ANY USE OF THIS SOFTWARE, INCLUDING\n * WITHOUT LIMITATION, ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,\n * PUNITIVE, OR CONSEQUENTIAL DAMAGES, PROCUREMENT OF SUBSTITUTE GOODS OR\n * SERVICES, LOSS OF USE, DATA OR PROFITS, HOWEVER CAUSED AND UNDER ANY\n * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF\n * THIS SOFTWARE, EVEN IF WHISTLE COMMUNICATIONS IS ADVISED OF THE POSSIBILITY\n * OF SUCH DAMAGE.\n *\n * Author: Archie Cobbs <archie@whistle.com>\n *\n * $FreeBSD: release/9.0.0/lib/libnetgraph/netgraph.h 125113 2004-01-27 20:25:14Z ru $\n * $Whistle: netgraph.h,v 1.7 1999/01/20 00:57:23 archie Exp $\n */\n\n#ifndef _NETGRAPH_H_\n#define _NETGRAPH_H_\n\n#include <sys/types.h>\n#include <netgraph/ng_message.h>\n\n__BEGIN_DECLS\nint\tNgMkSockNode(const char *, int *, int *);\nint\tNgNameNode(int, const char *, const char *, ...) __printflike(3, 4);\nint\tNgSendMsg(int, const char *, int, int, const void *, size_t);\nint\tNgSendAsciiMsg(int, const char *, const char *, ...) __printflike(3, 4);\nint\tNgSendReplyMsg(int, const char *,\n\t\tconst struct ng_mesg *, const void *, size_t);\nint\tNgRecvMsg(int, struct ng_mesg *, size_t, char *);\nint\tNgAllocRecvMsg(int, struct ng_mesg **, char *);\nint\tNgRecvAsciiMsg(int, struct ng_mesg *, size_t, char *);\nint\tNgAllocRecvAsciiMsg(int, struct ng_mesg **, char *);\nint\tNgSendData(int, const char *, const u_char *, size_t);\nint\tNgRecvData(int, u_char *, size_t, char *);\nint\tNgAllocRecvData(int, u_char **, char *);\nint\tNgSetDebug(int);\nvoid\tNgSetErrLog(void (*)(const char *fmt, ...),\n\t    void (*)(const char *fmt, ...));\n__END_DECLS\n\n#endif\n\n"
  },
  {
    "path": "freebsd-headers/netinet/cc.h",
    "content": "/*-\n * Copyright (c) 2007-2008\n * \tSwinburne University of Technology, Melbourne, Australia.\n * Copyright (c) 2009-2010 Lawrence Stewart <lstewart@freebsd.org>\n * Copyright (c) 2010 The FreeBSD Foundation\n * All rights reserved.\n *\n * This software was developed at the Centre for Advanced Internet\n * Architectures, Swinburne University of Technology, by Lawrence Stewart and\n * James Healy, made possible in part by a grant from the Cisco University\n * Research Program Fund at Community Foundation Silicon Valley.\n *\n * Portions of this software were developed at the Centre for Advanced\n * Internet Architectures, Swinburne University of Technology, Melbourne,\n * Australia by David Hayes under sponsorship from the FreeBSD Foundation.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/netinet/cc.h 220560 2011-04-12 08:13:18Z lstewart $\n */\n\n/*\n * This software was first released in 2007 by James Healy and Lawrence Stewart\n * whilst working on the NewTCP research project at Swinburne University of\n * Technology's Centre for Advanced Internet Architectures, Melbourne,\n * Australia, which was made possible in part by a grant from the Cisco\n * University Research Program Fund at Community Foundation Silicon Valley.\n * More details are available at:\n *   http://caia.swin.edu.au/urp/newtcp/\n */\n\n#ifndef _NETINET_CC_H_\n#define _NETINET_CC_H_\n\n/* XXX: TCP_CA_NAME_MAX define lives in tcp.h for compat reasons. */\n#include <netinet/tcp.h>\n\n/* Global CC vars. */\nextern STAILQ_HEAD(cc_head, cc_algo) cc_list;\nextern const int tcprexmtthresh;\nextern struct cc_algo newreno_cc_algo;\n\n/* Per-netstack bits. */\nVNET_DECLARE(struct cc_algo *, default_cc_ptr);\n#define\tV_default_cc_ptr VNET(default_cc_ptr)\n\n/* Define the new net.inet.tcp.cc sysctl tree. */\nSYSCTL_DECL(_net_inet_tcp_cc);\n\n/* CC housekeeping functions. */\nint\tcc_register_algo(struct cc_algo *add_cc);\nint\tcc_deregister_algo(struct cc_algo *remove_cc);\n\n/*\n * Wrapper around transport structs that contain same-named congestion\n * control variables. Allows algos to be shared amongst multiple CC aware\n * transprots.\n */\nstruct cc_var {\n\tvoid\t\t*cc_data; /* Per-connection private CC algorithm data. */\n\tint\t\tbytes_this_ack; /* # bytes acked by the current ACK. */\n\ttcp_seq\t\tcurack; /* Most recent ACK. */\n\tuint32_t\tflags; /* Flags for cc_var (see below) */\n\tint\t\ttype; /* Indicates which ptr is valid in ccvc. */\n\tunion ccv_container {\n\t\tstruct tcpcb\t\t*tcp;\n\t\tstruct sctp_nets\t*sctp;\n\t} ccvc;\n};\n\n/* cc_var flags. */\n#define\tCCF_ABC_SENTAWND\t0x0001\t/* ABC counted cwnd worth of bytes? */\n#define\tCCF_CWND_LIMITED\t0x0002\t/* Are we currently cwnd limited? */\n\n/* ACK types passed to the ack_received() hook. */\n#define\tCC_ACK\t\t0x0001\t/* Regular in sequence ACK. */\n#define\tCC_DUPACK\t0x0002\t/* Duplicate ACK. */\n#define\tCC_PARTIALACK\t0x0004\t/* Not yet. */\n#define\tCC_SACK\t\t0x0008\t/* Not yet. */\n\n/*\n * Congestion signal types passed to the cong_signal() hook. The highest order 8\n * bits (0x01000000 - 0x80000000) are reserved for CC algos to declare their own\n * congestion signal types.\n */\n#define\tCC_ECN\t\t0x00000001\t/* ECN marked packet received. */\n#define\tCC_RTO\t\t0x00000002\t/* RTO fired. */\n#define\tCC_RTO_ERR\t0x00000004\t/* RTO fired in error. */\n#define\tCC_NDUPACK\t0x00000008\t/* Threshold of dupack's reached. */\n\n#define\tCC_SIGPRIVMASK\t0xFF000000\t/* Mask to check if sig is private. */\n\n/*\n * Structure to hold data and function pointers that together represent a\n * congestion control algorithm.\n */\nstruct cc_algo {\n\tchar\tname[TCP_CA_NAME_MAX];\n\n\t/* Init global module state on kldload. */\n\tint\t(*mod_init)(void);\n\n\t/* Cleanup global module state on kldunload. */\n\tint\t(*mod_destroy)(void);\n\n\t/* Init CC state for a new control block. */\n\tint\t(*cb_init)(struct cc_var *ccv);\n\n\t/* Cleanup CC state for a terminating control block. */\n\tvoid\t(*cb_destroy)(struct cc_var *ccv);\n\n\t/* Init variables for a newly established connection. */\n\tvoid\t(*conn_init)(struct cc_var *ccv);\n\n\t/* Called on receipt of an ack. */\n\tvoid\t(*ack_received)(struct cc_var *ccv, uint16_t type);\n\n\t/* Called on detection of a congestion signal. */\n\tvoid\t(*cong_signal)(struct cc_var *ccv, uint32_t type);\n\n\t/* Called after exiting congestion recovery. */\n\tvoid\t(*post_recovery)(struct cc_var *ccv);\n\n\t/* Called when data transfer resumes after an idle period. */\n\tvoid\t(*after_idle)(struct cc_var *ccv);\n\n\tSTAILQ_ENTRY (cc_algo) entries;\n};\n\n/* Macro to obtain the CC algo's struct ptr. */\n#define\tCC_ALGO(tp)\t((tp)->cc_algo)\n\n/* Macro to obtain the CC algo's data ptr. */\n#define\tCC_DATA(tp)\t((tp)->ccv->cc_data)\n\n/* Macro to obtain the system default CC algo's struct ptr. */\n#define\tCC_DEFAULT()\tV_default_cc_ptr\n\nextern struct rwlock cc_list_lock;\n#define\tCC_LIST_LOCK_INIT()\trw_init(&cc_list_lock, \"cc_list\")\n#define\tCC_LIST_LOCK_DESTROY()\trw_destroy(&cc_list_lock)\n#define\tCC_LIST_RLOCK()\t\trw_rlock(&cc_list_lock)\n#define\tCC_LIST_RUNLOCK()\trw_runlock(&cc_list_lock)\n#define\tCC_LIST_WLOCK()\t\trw_wlock(&cc_list_lock)\n#define\tCC_LIST_WUNLOCK()\trw_wunlock(&cc_list_lock)\n#define\tCC_LIST_LOCK_ASSERT()\trw_assert(&cc_list_lock, RA_LOCKED)\n\n#endif /* _NETINET_CC_H_ */\n"
  },
  {
    "path": "freebsd-headers/netinet/icmp6.h",
    "content": "/*\t$FreeBSD: release/9.0.0/sys/netinet/icmp6.h 222732 2011-06-06 03:06:43Z hrs $\t*/\n/*\t$KAME: icmp6.h,v 1.46 2001/04/27 15:09:48 itojun Exp $\t*/\n\n/*-\n * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. Neither the name of the project nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n */\n\n/*-\n * Copyright (c) 1982, 1986, 1993\n *\tThe Regents of the University of California.  All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 4. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t@(#)ip_icmp.h\t8.1 (Berkeley) 6/10/93\n */\n\n#ifndef _NETINET_ICMP6_H_\n#define _NETINET_ICMP6_H_\n\n#define ICMPV6_PLD_MAXLEN\t1232\t/* IPV6_MMTU - sizeof(struct ip6_hdr)\n\t\t\t\t\t   - sizeof(struct icmp6_hdr) */\n\nstruct icmp6_hdr {\n\tu_int8_t\ticmp6_type;\t/* type field */\n\tu_int8_t\ticmp6_code;\t/* code field */\n\tu_int16_t\ticmp6_cksum;\t/* checksum field */\n\tunion {\n\t\tu_int32_t\ticmp6_un_data32[1]; /* type-specific field */\n\t\tu_int16_t\ticmp6_un_data16[2]; /* type-specific field */\n\t\tu_int8_t\ticmp6_un_data8[4];  /* type-specific field */\n\t} icmp6_dataun;\n} __packed;\n\n#define icmp6_data32\ticmp6_dataun.icmp6_un_data32\n#define icmp6_data16\ticmp6_dataun.icmp6_un_data16\n#define icmp6_data8\ticmp6_dataun.icmp6_un_data8\n#define icmp6_pptr\ticmp6_data32[0]\t\t/* parameter prob */\n#define icmp6_mtu\ticmp6_data32[0]\t\t/* packet too big */\n#define icmp6_id\ticmp6_data16[0]\t\t/* echo request/reply */\n#define icmp6_seq\ticmp6_data16[1]\t\t/* echo request/reply */\n#define icmp6_maxdelay\ticmp6_data16[0]\t\t/* mcast group membership */\n\n#define ICMP6_DST_UNREACH\t\t1\t/* dest unreachable, codes: */\n#define ICMP6_PACKET_TOO_BIG\t\t2\t/* packet too big */\n#define ICMP6_TIME_EXCEEDED\t\t3\t/* time exceeded, code: */\n#define ICMP6_PARAM_PROB\t\t4\t/* ip6 header bad */\n\n#define ICMP6_ECHO_REQUEST\t\t128\t/* echo service */\n#define ICMP6_ECHO_REPLY\t\t129\t/* echo reply */\n#define MLD_LISTENER_QUERY\t\t130 \t/* multicast listener query */\n#define MLD_LISTENER_REPORT\t\t131\t/* multicast listener report */\n#define MLD_LISTENER_DONE\t\t132\t/* multicast listener done */\n#define MLD_LISTENER_REDUCTION MLD_LISTENER_DONE /* RFC3542 definition */\n\n/* RFC2292 decls */\n#define ICMP6_MEMBERSHIP_QUERY\t\t130\t/* group membership query */\n#define ICMP6_MEMBERSHIP_REPORT\t\t131\t/* group membership report */\n#define ICMP6_MEMBERSHIP_REDUCTION\t132\t/* group membership termination */\n\n#ifndef _KERNEL\n/* the followings are for backward compatibility to old KAME apps. */\n#define MLD6_LISTENER_QUERY\tMLD_LISTENER_QUERY\n#define MLD6_LISTENER_REPORT\tMLD_LISTENER_REPORT\n#define MLD6_LISTENER_DONE\tMLD_LISTENER_DONE\n#endif\n\n#define ND_ROUTER_SOLICIT\t\t133\t/* router solicitation */\n#define ND_ROUTER_ADVERT\t\t134\t/* router advertisement */\n#define ND_NEIGHBOR_SOLICIT\t\t135\t/* neighbor solicitation */\n#define ND_NEIGHBOR_ADVERT\t\t136\t/* neighbor advertisement */\n#define ND_REDIRECT\t\t\t137\t/* redirect */\n\n#define ICMP6_ROUTER_RENUMBERING\t138\t/* router renumbering */\n\n#define ICMP6_WRUREQUEST\t\t139\t/* who are you request */\n#define ICMP6_WRUREPLY\t\t\t140\t/* who are you reply */\n#define ICMP6_FQDN_QUERY\t\t139\t/* FQDN query */\n#define ICMP6_FQDN_REPLY\t\t140\t/* FQDN reply */\n#define ICMP6_NI_QUERY\t\t\t139\t/* node information request */\n#define ICMP6_NI_REPLY\t\t\t140\t/* node information reply */\n#define MLDV2_LISTENER_REPORT\t\t143\t/* RFC3810 listener report */\n\n/* The definitions below are experimental. TBA */\n#define MLD_MTRACE_RESP\t\t\t200\t/* mtrace resp (to sender) */\n#define MLD_MTRACE\t\t\t201\t/* mtrace messages */\n\n#ifndef _KERNEL\n#define MLD6_MTRACE_RESP\tMLD_MTRACE_RESP\n#define MLD6_MTRACE\t\tMLD_MTRACE\n#endif\n\n#define ICMP6_MAXTYPE\t\t\t201\n\n#define ICMP6_DST_UNREACH_NOROUTE\t0\t/* no route to destination */\n#define ICMP6_DST_UNREACH_ADMIN\t \t1\t/* administratively prohibited */\n#define ICMP6_DST_UNREACH_NOTNEIGHBOR\t2\t/* not a neighbor(obsolete) */\n#define ICMP6_DST_UNREACH_BEYONDSCOPE\t2\t/* beyond scope of source address */\n#define ICMP6_DST_UNREACH_ADDR\t\t3\t/* address unreachable */\n#define ICMP6_DST_UNREACH_NOPORT\t4\t/* port unreachable */\n\n#define ICMP6_TIME_EXCEED_TRANSIT \t0\t/* ttl==0 in transit */\n#define ICMP6_TIME_EXCEED_REASSEMBLY\t1\t/* ttl==0 in reass */\n\n#define ICMP6_PARAMPROB_HEADER \t \t0\t/* erroneous header field */\n#define ICMP6_PARAMPROB_NEXTHEADER\t1\t/* unrecognized next header */\n#define ICMP6_PARAMPROB_OPTION\t\t2\t/* unrecognized option */\n\n#define ICMP6_INFOMSG_MASK\t\t0x80\t/* all informational messages */\n\n#define ICMP6_NI_SUBJ_IPV6\t0\t/* Query Subject is an IPv6 address */\n#define ICMP6_NI_SUBJ_FQDN\t1\t/* Query Subject is a Domain name */\n#define ICMP6_NI_SUBJ_IPV4\t2\t/* Query Subject is an IPv4 address */\n\n#define ICMP6_NI_SUCCESS\t0\t/* node information successful reply */\n#define ICMP6_NI_REFUSED\t1\t/* node information request is refused */\n#define ICMP6_NI_UNKNOWN\t2\t/* unknown Qtype */\n\n#define ICMP6_ROUTER_RENUMBERING_COMMAND  0\t/* rr command */\n#define ICMP6_ROUTER_RENUMBERING_RESULT   1\t/* rr result */\n#define ICMP6_ROUTER_RENUMBERING_SEQNUM_RESET   255\t/* rr seq num reset */\n\n/* Used in kernel only */\n#define ND_REDIRECT_ONLINK\t0\t/* redirect to an on-link node */\n#define ND_REDIRECT_ROUTER\t1\t/* redirect to a better router */\n\n/*\n * Multicast Listener Discovery\n */\nstruct mld_hdr {\n\tstruct icmp6_hdr\tmld_icmp6_hdr;\n\tstruct in6_addr\t\tmld_addr; /* multicast address */\n} __packed;\n\n/* definitions to provide backward compatibility to old KAME applications */\n#ifndef _KERNEL\n#define mld6_hdr\tmld_hdr\n#define mld6_type\tmld_type\n#define mld6_code\tmld_code\n#define mld6_cksum\tmld_cksum\n#define mld6_maxdelay\tmld_maxdelay\n#define mld6_reserved\tmld_reserved\n#define mld6_addr\tmld_addr\n#endif\n\n/* shortcut macro definitions */\n#define mld_type\tmld_icmp6_hdr.icmp6_type\n#define mld_code\tmld_icmp6_hdr.icmp6_code\n#define mld_cksum\tmld_icmp6_hdr.icmp6_cksum\n#define mld_maxdelay\tmld_icmp6_hdr.icmp6_data16[0]\n#define mld_reserved\tmld_icmp6_hdr.icmp6_data16[1]\n#define mld_v2_reserved\tmld_icmp6_hdr.icmp6_data16[0]\n#define mld_v2_numrecs\tmld_icmp6_hdr.icmp6_data16[1]\n\n/*\n * Neighbor Discovery\n */\n\nstruct nd_router_solicit {\t/* router solicitation */\n\tstruct icmp6_hdr \tnd_rs_hdr;\n\t/* could be followed by options */\n} __packed;\n\n#define nd_rs_type\tnd_rs_hdr.icmp6_type\n#define nd_rs_code\tnd_rs_hdr.icmp6_code\n#define nd_rs_cksum\tnd_rs_hdr.icmp6_cksum\n#define nd_rs_reserved\tnd_rs_hdr.icmp6_data32[0]\n\nstruct nd_router_advert {\t/* router advertisement */\n\tstruct icmp6_hdr\tnd_ra_hdr;\n\tu_int32_t\t\tnd_ra_reachable;\t/* reachable time */\n\tu_int32_t\t\tnd_ra_retransmit;\t/* retransmit timer */\n\t/* could be followed by options */\n} __packed;\n\n#define nd_ra_type\t\tnd_ra_hdr.icmp6_type\n#define nd_ra_code\t\tnd_ra_hdr.icmp6_code\n#define nd_ra_cksum\t\tnd_ra_hdr.icmp6_cksum\n#define nd_ra_curhoplimit\tnd_ra_hdr.icmp6_data8[0]\n#define nd_ra_flags_reserved\tnd_ra_hdr.icmp6_data8[1]\n#define ND_RA_FLAG_MANAGED\t0x80\n#define ND_RA_FLAG_OTHER\t0x40\n#define ND_RA_FLAG_HA\t\t0x20\n\n/*\n * Router preference values based on draft-draves-ipngwg-router-selection-01.\n * These are non-standard definitions.\n */\n#define ND_RA_FLAG_RTPREF_MASK\t0x18 /* 00011000 */\n\n#define ND_RA_FLAG_RTPREF_HIGH\t0x08 /* 00001000 */\n#define ND_RA_FLAG_RTPREF_MEDIUM\t0x00 /* 00000000 */\n#define ND_RA_FLAG_RTPREF_LOW\t0x18 /* 00011000 */\n#define ND_RA_FLAG_RTPREF_RSV\t0x10 /* 00010000 */\n\n#define nd_ra_router_lifetime\tnd_ra_hdr.icmp6_data16[1]\n\nstruct nd_neighbor_solicit {\t/* neighbor solicitation */\n\tstruct icmp6_hdr\tnd_ns_hdr;\n\tstruct in6_addr\t\tnd_ns_target;\t/*target address */\n\t/* could be followed by options */\n} __packed;\n\n#define nd_ns_type\t\tnd_ns_hdr.icmp6_type\n#define nd_ns_code\t\tnd_ns_hdr.icmp6_code\n#define nd_ns_cksum\t\tnd_ns_hdr.icmp6_cksum\n#define nd_ns_reserved\t\tnd_ns_hdr.icmp6_data32[0]\n\nstruct nd_neighbor_advert {\t/* neighbor advertisement */\n\tstruct icmp6_hdr\tnd_na_hdr;\n\tstruct in6_addr\t\tnd_na_target;\t/* target address */\n\t/* could be followed by options */\n} __packed;\n\n#define nd_na_type\t\tnd_na_hdr.icmp6_type\n#define nd_na_code\t\tnd_na_hdr.icmp6_code\n#define nd_na_cksum\t\tnd_na_hdr.icmp6_cksum\n#define nd_na_flags_reserved\tnd_na_hdr.icmp6_data32[0]\n#if BYTE_ORDER == BIG_ENDIAN\n#define ND_NA_FLAG_ROUTER\t\t0x80000000\n#define ND_NA_FLAG_SOLICITED\t\t0x40000000\n#define ND_NA_FLAG_OVERRIDE\t\t0x20000000\n#else\n#if BYTE_ORDER == LITTLE_ENDIAN\n#define ND_NA_FLAG_ROUTER\t\t0x80\n#define ND_NA_FLAG_SOLICITED\t\t0x40\n#define ND_NA_FLAG_OVERRIDE\t\t0x20\n#endif\n#endif\n\nstruct nd_redirect {\t\t/* redirect */\n\tstruct icmp6_hdr\tnd_rd_hdr;\n\tstruct in6_addr\t\tnd_rd_target;\t/* target address */\n\tstruct in6_addr\t\tnd_rd_dst;\t/* destination address */\n\t/* could be followed by options */\n} __packed;\n\n#define nd_rd_type\t\tnd_rd_hdr.icmp6_type\n#define nd_rd_code\t\tnd_rd_hdr.icmp6_code\n#define nd_rd_cksum\t\tnd_rd_hdr.icmp6_cksum\n#define nd_rd_reserved\t\tnd_rd_hdr.icmp6_data32[0]\n\nstruct nd_opt_hdr {\t\t/* Neighbor discovery option header */\n\tu_int8_t\tnd_opt_type;\n\tu_int8_t\tnd_opt_len;\n\t/* followed by option specific data*/\n} __packed;\n\n#define ND_OPT_SOURCE_LINKADDR\t\t1\n#define ND_OPT_TARGET_LINKADDR\t\t2\n#define ND_OPT_PREFIX_INFORMATION\t3\n#define ND_OPT_REDIRECTED_HEADER\t4\n#define ND_OPT_MTU\t\t\t5\n#define ND_OPT_ROUTE_INFO\t\t24\t/* RFC 4191 */\n#define ND_OPT_RDNSS\t\t\t25\t/* RFC 6016 */\n#define ND_OPT_DNSSL\t\t\t31\t/* RFC 6016 */\n\nstruct nd_opt_prefix_info {\t/* prefix information */\n\tu_int8_t\tnd_opt_pi_type;\n\tu_int8_t\tnd_opt_pi_len;\n\tu_int8_t\tnd_opt_pi_prefix_len;\n\tu_int8_t\tnd_opt_pi_flags_reserved;\n\tu_int32_t\tnd_opt_pi_valid_time;\n\tu_int32_t\tnd_opt_pi_preferred_time;\n\tu_int32_t\tnd_opt_pi_reserved2;\n\tstruct in6_addr\tnd_opt_pi_prefix;\n} __packed;\n\n#define ND_OPT_PI_FLAG_ONLINK\t\t0x80\n#define ND_OPT_PI_FLAG_AUTO\t\t0x40\n\nstruct nd_opt_rd_hdr {\t\t/* redirected header */\n\tu_int8_t\tnd_opt_rh_type;\n\tu_int8_t\tnd_opt_rh_len;\n\tu_int16_t\tnd_opt_rh_reserved1;\n\tu_int32_t\tnd_opt_rh_reserved2;\n\t/* followed by IP header and data */\n} __packed;\n\nstruct nd_opt_mtu {\t\t/* MTU option */\n\tu_int8_t\tnd_opt_mtu_type;\n\tu_int8_t\tnd_opt_mtu_len;\n\tu_int16_t\tnd_opt_mtu_reserved;\n\tu_int32_t\tnd_opt_mtu_mtu;\n} __packed;\n\nstruct nd_opt_route_info {\t/* route info */\n\tu_int8_t\tnd_opt_rti_type;\n\tu_int8_t\tnd_opt_rti_len;\n\tu_int8_t\tnd_opt_rti_prefixlen;\n\tu_int8_t\tnd_opt_rti_flags;\n\tu_int32_t\tnd_opt_rti_lifetime;\n\t/* prefix follows */\n} __packed;\n\nstruct nd_opt_rdnss {\t\t/* RDNSS option (RFC 6106) */\n\tu_int8_t\tnd_opt_rdnss_type;\n\tu_int8_t\tnd_opt_rdnss_len;\n\tu_int16_t\tnd_opt_rdnss_reserved;\n\tu_int32_t\tnd_opt_rdnss_lifetime;\n\t/* followed by list of recursive DNS servers */\n} __packed;\n\nstruct nd_opt_dnssl {\t\t/* DNSSL option (RFC 6106) */\n\tu_int8_t\tnd_opt_dnssl_type;\n\tu_int8_t\tnd_opt_dnssl_len;\n\tu_int16_t\tnd_opt_dnssl_reserved;\n\tu_int32_t\tnd_opt_dnssl_lifetime;\n\t/* followed by list of DNS search domains */\n} __packed;\n\n/*\n * icmp6 namelookup\n */\n\nstruct icmp6_namelookup {\n\tstruct icmp6_hdr \ticmp6_nl_hdr;\n\tu_int8_t\ticmp6_nl_nonce[8];\n\tint32_t\t\ticmp6_nl_ttl;\n#if 0\n\tu_int8_t\ticmp6_nl_len;\n\tu_int8_t\ticmp6_nl_name[3];\n#endif\n\t/* could be followed by options */\n} __packed;\n\n/*\n * icmp6 node information\n */\nstruct icmp6_nodeinfo {\n\tstruct icmp6_hdr icmp6_ni_hdr;\n\tu_int8_t icmp6_ni_nonce[8];\n\t/* could be followed by reply data */\n} __packed;\n\n#define ni_type\t\ticmp6_ni_hdr.icmp6_type\n#define ni_code\t\ticmp6_ni_hdr.icmp6_code\n#define ni_cksum\ticmp6_ni_hdr.icmp6_cksum\n#define ni_qtype\ticmp6_ni_hdr.icmp6_data16[0]\n#define ni_flags\ticmp6_ni_hdr.icmp6_data16[1]\n\n#define NI_QTYPE_NOOP\t\t0 /* NOOP  */\n#define NI_QTYPE_SUPTYPES\t1 /* Supported Qtypes */\n#define NI_QTYPE_FQDN\t\t2 /* FQDN (draft 04) */\n#define NI_QTYPE_DNSNAME\t2 /* DNS Name */\n#define NI_QTYPE_NODEADDR\t3 /* Node Addresses */\n#define NI_QTYPE_IPV4ADDR\t4 /* IPv4 Addresses */\n\n#if BYTE_ORDER == BIG_ENDIAN\n#define NI_SUPTYPE_FLAG_COMPRESS\t0x1\n#define NI_FQDN_FLAG_VALIDTTL\t\t0x1\n#elif BYTE_ORDER == LITTLE_ENDIAN\n#define NI_SUPTYPE_FLAG_COMPRESS\t0x0100\n#define NI_FQDN_FLAG_VALIDTTL\t\t0x0100\n#endif\n\n#ifdef NAME_LOOKUPS_04\n#if BYTE_ORDER == BIG_ENDIAN\n#define NI_NODEADDR_FLAG_LINKLOCAL\t0x1\n#define NI_NODEADDR_FLAG_SITELOCAL\t0x2\n#define NI_NODEADDR_FLAG_GLOBAL\t\t0x4\n#define NI_NODEADDR_FLAG_ALL\t\t0x8\n#define NI_NODEADDR_FLAG_TRUNCATE\t0x10\n#define NI_NODEADDR_FLAG_ANYCAST\t0x20 /* just experimental. not in spec */\n#elif BYTE_ORDER == LITTLE_ENDIAN\n#define NI_NODEADDR_FLAG_LINKLOCAL\t0x0100\n#define NI_NODEADDR_FLAG_SITELOCAL\t0x0200\n#define NI_NODEADDR_FLAG_GLOBAL\t\t0x0400\n#define NI_NODEADDR_FLAG_ALL\t\t0x0800\n#define NI_NODEADDR_FLAG_TRUNCATE\t0x1000\n#define NI_NODEADDR_FLAG_ANYCAST\t0x2000 /* just experimental. not in spec */\n#endif\n#else  /* draft-ietf-ipngwg-icmp-name-lookups-05 (and later?) */\n#if BYTE_ORDER == BIG_ENDIAN\n#define NI_NODEADDR_FLAG_TRUNCATE\t0x1\n#define NI_NODEADDR_FLAG_ALL\t\t0x2\n#define NI_NODEADDR_FLAG_COMPAT\t\t0x4\n#define NI_NODEADDR_FLAG_LINKLOCAL\t0x8\n#define NI_NODEADDR_FLAG_SITELOCAL\t0x10\n#define NI_NODEADDR_FLAG_GLOBAL\t\t0x20\n#define NI_NODEADDR_FLAG_ANYCAST\t0x40 /* just experimental. not in spec */\n#elif BYTE_ORDER == LITTLE_ENDIAN\n#define NI_NODEADDR_FLAG_TRUNCATE\t0x0100\n#define NI_NODEADDR_FLAG_ALL\t\t0x0200\n#define NI_NODEADDR_FLAG_COMPAT\t\t0x0400\n#define NI_NODEADDR_FLAG_LINKLOCAL\t0x0800\n#define NI_NODEADDR_FLAG_SITELOCAL\t0x1000\n#define NI_NODEADDR_FLAG_GLOBAL\t\t0x2000\n#define NI_NODEADDR_FLAG_ANYCAST\t0x4000 /* just experimental. not in spec */\n#endif\n#endif\n\nstruct ni_reply_fqdn {\n\tu_int32_t ni_fqdn_ttl;\t/* TTL */\n\tu_int8_t ni_fqdn_namelen; /* length in octets of the FQDN */\n\tu_int8_t ni_fqdn_name[3]; /* XXX: alignment */\n} __packed;\n\n/*\n * Router Renumbering. as router-renum-08.txt\n */\nstruct icmp6_router_renum {\t/* router renumbering header */\n\tstruct icmp6_hdr\trr_hdr;\n\tu_int8_t\trr_segnum;\n\tu_int8_t\trr_flags;\n\tu_int16_t\trr_maxdelay;\n\tu_int32_t\trr_reserved;\n} __packed;\n\n#define ICMP6_RR_FLAGS_TEST\t\t0x80\n#define ICMP6_RR_FLAGS_REQRESULT\t0x40\n#define ICMP6_RR_FLAGS_FORCEAPPLY\t0x20\n#define ICMP6_RR_FLAGS_SPECSITE\t\t0x10\n#define ICMP6_RR_FLAGS_PREVDONE\t\t0x08\n\n#define rr_type\t\trr_hdr.icmp6_type\n#define rr_code\t\trr_hdr.icmp6_code\n#define rr_cksum\trr_hdr.icmp6_cksum\n#define rr_seqnum \trr_hdr.icmp6_data32[0]\n\nstruct rr_pco_match {\t\t/* match prefix part */\n\tu_int8_t\trpm_code;\n\tu_int8_t\trpm_len;\n\tu_int8_t\trpm_ordinal;\n\tu_int8_t\trpm_matchlen;\n\tu_int8_t\trpm_minlen;\n\tu_int8_t\trpm_maxlen;\n\tu_int16_t\trpm_reserved;\n\tstruct\tin6_addr\trpm_prefix;\n} __packed;\n\n#define RPM_PCO_ADD\t\t1\n#define RPM_PCO_CHANGE\t\t2\n#define RPM_PCO_SETGLOBAL\t3\n#define RPM_PCO_MAX\t\t4\n\nstruct rr_pco_use {\t\t/* use prefix part */\n\tu_int8_t\trpu_uselen;\n\tu_int8_t\trpu_keeplen;\n\tu_int8_t\trpu_ramask;\n\tu_int8_t\trpu_raflags;\n\tu_int32_t\trpu_vltime;\n\tu_int32_t\trpu_pltime;\n\tu_int32_t\trpu_flags;\n\tstruct\tin6_addr rpu_prefix;\n} __packed;\n#define ICMP6_RR_PCOUSE_RAFLAGS_ONLINK\t0x80\n#define ICMP6_RR_PCOUSE_RAFLAGS_AUTO\t0x40\n\n#if BYTE_ORDER == BIG_ENDIAN\n#define ICMP6_RR_PCOUSE_FLAGS_DECRVLTIME     0x80000000\n#define ICMP6_RR_PCOUSE_FLAGS_DECRPLTIME     0x40000000\n#elif BYTE_ORDER == LITTLE_ENDIAN\n#define ICMP6_RR_PCOUSE_FLAGS_DECRVLTIME     0x80\n#define ICMP6_RR_PCOUSE_FLAGS_DECRPLTIME     0x40\n#endif\n\nstruct rr_result {\t\t/* router renumbering result message */\n\tu_int16_t\trrr_flags;\n\tu_int8_t\trrr_ordinal;\n\tu_int8_t\trrr_matchedlen;\n\tu_int32_t\trrr_ifid;\n\tstruct\tin6_addr rrr_prefix;\n} __packed;\n#if BYTE_ORDER == BIG_ENDIAN\n#define ICMP6_RR_RESULT_FLAGS_OOB\t\t0x0002\n#define ICMP6_RR_RESULT_FLAGS_FORBIDDEN\t\t0x0001\n#elif BYTE_ORDER == LITTLE_ENDIAN\n#define ICMP6_RR_RESULT_FLAGS_OOB\t\t0x0200\n#define ICMP6_RR_RESULT_FLAGS_FORBIDDEN\t\t0x0100\n#endif\n\n/*\n * icmp6 filter structures.\n */\n\nstruct icmp6_filter {\n\tu_int32_t icmp6_filt[8];\n};\n\n#ifdef _KERNEL\n#define\tICMP6_FILTER_SETPASSALL(filterp) \\\ndo {\t\t\t\t\t\t\t\t\\\n\tint i; u_char *p;\t\t\t\t\t\\\n\tp = (u_char *)filterp;\t\t\t\t\t\\\n\tfor (i = 0; i < sizeof(struct icmp6_filter); i++)\t\\\n\t\tp[i] = 0xff;\t\t\t\t\t\\\n} while (/*CONSTCOND*/ 0)\n#define\tICMP6_FILTER_SETBLOCKALL(filterp) \\\n\tbzero(filterp, sizeof(struct icmp6_filter))\n#else /* _KERNEL */\n#define\tICMP6_FILTER_SETPASSALL(filterp) \\\n\tmemset(filterp, 0xff, sizeof(struct icmp6_filter))\n#define\tICMP6_FILTER_SETBLOCKALL(filterp) \\\n\tmemset(filterp, 0x00, sizeof(struct icmp6_filter))\n#endif /* _KERNEL */\n\n#define\tICMP6_FILTER_SETPASS(type, filterp) \\\n\t(((filterp)->icmp6_filt[(type) >> 5]) |= (1 << ((type) & 31)))\n#define\tICMP6_FILTER_SETBLOCK(type, filterp) \\\n\t(((filterp)->icmp6_filt[(type) >> 5]) &= ~(1 << ((type) & 31)))\n#define\tICMP6_FILTER_WILLPASS(type, filterp) \\\n\t((((filterp)->icmp6_filt[(type) >> 5]) & (1 << ((type) & 31))) != 0)\n#define\tICMP6_FILTER_WILLBLOCK(type, filterp) \\\n\t((((filterp)->icmp6_filt[(type) >> 5]) & (1 << ((type) & 31))) == 0)\n\n/*\n * Variables related to this implementation\n * of the internet control message protocol version 6.\n */\nstruct icmp6errstat {\n\tu_quad_t icp6errs_dst_unreach_noroute;\n\tu_quad_t icp6errs_dst_unreach_admin;\n\tu_quad_t icp6errs_dst_unreach_beyondscope;\n\tu_quad_t icp6errs_dst_unreach_addr;\n\tu_quad_t icp6errs_dst_unreach_noport;\n\tu_quad_t icp6errs_packet_too_big;\n\tu_quad_t icp6errs_time_exceed_transit;\n\tu_quad_t icp6errs_time_exceed_reassembly;\n\tu_quad_t icp6errs_paramprob_header;\n\tu_quad_t icp6errs_paramprob_nextheader;\n\tu_quad_t icp6errs_paramprob_option;\n\tu_quad_t icp6errs_redirect; /* we regard redirect as an error here */\n\tu_quad_t icp6errs_unknown;\n};\n\nstruct icmp6stat {\n/* statistics related to icmp6 packets generated */\n\tu_quad_t icp6s_error;\t\t/* # of calls to icmp6_error */\n\tu_quad_t icp6s_canterror;\t/* no error 'cuz old was icmp */\n\tu_quad_t icp6s_toofreq;\t\t/* no error 'cuz rate limitation */\n\tu_quad_t icp6s_outhist[256];\n/* statistics related to input message processed */\n\tu_quad_t icp6s_badcode;\t\t/* icmp6_code out of range */\n\tu_quad_t icp6s_tooshort;\t/* packet < sizeof(struct icmp6_hdr) */\n\tu_quad_t icp6s_checksum;\t/* bad checksum */\n\tu_quad_t icp6s_badlen;\t\t/* calculated bound mismatch */\n\t/*\n\t * number of responses: this member is inherited from netinet code, but\n\t * for netinet6 code, it is already available in icp6s_outhist[].\n\t */\n\tu_quad_t icp6s_reflect;\n\tu_quad_t icp6s_inhist[256];\t\n\tu_quad_t icp6s_nd_toomanyopt;\t/* too many ND options */\n\tstruct icmp6errstat icp6s_outerrhist;\n#define icp6s_odst_unreach_noroute \\\n\ticp6s_outerrhist.icp6errs_dst_unreach_noroute\n#define icp6s_odst_unreach_admin icp6s_outerrhist.icp6errs_dst_unreach_admin\n#define icp6s_odst_unreach_beyondscope \\\n\ticp6s_outerrhist.icp6errs_dst_unreach_beyondscope\n#define icp6s_odst_unreach_addr icp6s_outerrhist.icp6errs_dst_unreach_addr\n#define icp6s_odst_unreach_noport icp6s_outerrhist.icp6errs_dst_unreach_noport\n#define icp6s_opacket_too_big icp6s_outerrhist.icp6errs_packet_too_big\n#define icp6s_otime_exceed_transit \\\n\ticp6s_outerrhist.icp6errs_time_exceed_transit\n#define icp6s_otime_exceed_reassembly \\\n\ticp6s_outerrhist.icp6errs_time_exceed_reassembly\n#define icp6s_oparamprob_header icp6s_outerrhist.icp6errs_paramprob_header\n#define icp6s_oparamprob_nextheader \\\n\ticp6s_outerrhist.icp6errs_paramprob_nextheader\n#define icp6s_oparamprob_option icp6s_outerrhist.icp6errs_paramprob_option\n#define icp6s_oredirect icp6s_outerrhist.icp6errs_redirect\n#define icp6s_ounknown icp6s_outerrhist.icp6errs_unknown\n\tu_quad_t icp6s_pmtuchg;\t\t/* path MTU changes */\n\tu_quad_t icp6s_nd_badopt;\t/* bad ND options */\n\tu_quad_t icp6s_badns;\t\t/* bad neighbor solicitation */\n\tu_quad_t icp6s_badna;\t\t/* bad neighbor advertisement */\n\tu_quad_t icp6s_badrs;\t\t/* bad router advertisement */\n\tu_quad_t icp6s_badra;\t\t/* bad router advertisement */\n\tu_quad_t icp6s_badredirect;\t/* bad redirect message */\n};\n\n#ifdef _KERNEL\n/*\n * In-kernel consumers can use these accessor macros directly to update\n * stats.\n */\n#define\tICMP6STAT_ADD(name, val)\tV_icmp6stat.name += (val)\n#define\tICMP6STAT_INC(name)\t\tICMP6STAT_ADD(name, 1)\n\n/*\n * Kernel module consumers must use this accessor macro.\n */\nvoid\tkmod_icmp6stat_inc(int statnum);\n#define\tKMOD_ICMP6STAT_INC(name)\t\t\t\t\t\\\n\tkmod_icmp6stat_inc(offsetof(struct icmp6stat, name) / sizeof(u_quad_t))\n#endif\n\n/*\n * Names for ICMP sysctl objects\n */\n#define ICMPV6CTL_STATS\t\t1\n#define ICMPV6CTL_REDIRACCEPT\t2\t/* accept/process redirects */\n#define ICMPV6CTL_REDIRTIMEOUT\t3\t/* redirect cache time */\n#if 0\t/*obsoleted*/\n#define ICMPV6CTL_ERRRATELIMIT\t5\t/* ICMPv6 error rate limitation */\n#endif\n#define ICMPV6CTL_ND6_PRUNE\t6\n#define ICMPV6CTL_ND6_DELAY\t8\n#define ICMPV6CTL_ND6_UMAXTRIES\t9\n#define ICMPV6CTL_ND6_MMAXTRIES\t\t10\n#define ICMPV6CTL_ND6_USELOOPBACK\t11\n/*#define ICMPV6CTL_ND6_PROXYALL\t12\tobsoleted, do not reuse here */\n#define ICMPV6CTL_NODEINFO\t13\n#define ICMPV6CTL_ERRPPSLIMIT\t14\t/* ICMPv6 error pps limitation */\n#define ICMPV6CTL_ND6_MAXNUDHINT\t15\n#define ICMPV6CTL_MTUDISC_HIWAT\t16\n#define ICMPV6CTL_MTUDISC_LOWAT\t17\n#define ICMPV6CTL_ND6_DEBUG\t18\n#define ICMPV6CTL_ND6_DRLIST\t19\n#define ICMPV6CTL_ND6_PRLIST\t20\n#define ICMPV6CTL_MLD_MAXSRCFILTER\t21\n#define ICMPV6CTL_MLD_SOMAXSRC\t22\n#define ICMPV6CTL_MLD_VERSION\t23\n#define ICMPV6CTL_ND6_MAXQLEN\t24\n#define ICMPV6CTL_MAXID\t\t25\n\n#define RTF_PROBEMTU\tRTF_PROTO1\n\n#ifdef _KERNEL\n# ifdef __STDC__\nstruct\trtentry;\nstruct\trttimer;\nstruct\tin6_multi;\n# endif\nvoid\ticmp6_paramerror(struct mbuf *, int);\nvoid\ticmp6_error(struct mbuf *, int, int, int);\nvoid\ticmp6_error2(struct mbuf *, int, int, int, struct ifnet *);\nint\ticmp6_input(struct mbuf **, int *, int);\nvoid\ticmp6_fasttimo(void);\nvoid\ticmp6_slowtimo(void);\nvoid\ticmp6_reflect(struct mbuf *, size_t);\nvoid\ticmp6_prepare(struct mbuf *);\nvoid\ticmp6_redirect_input(struct mbuf *, int);\nvoid\ticmp6_redirect_output(struct mbuf *, struct rtentry *);\n\nstruct\tip6ctlparam;\nvoid\ticmp6_mtudisc_update(struct ip6ctlparam *, int);\n\n/* XXX: is this the right place for these macros? */\n#define icmp6_ifstat_inc(ifp, tag) \\\ndo {\t\t\t\t\t\t\t\t\\\n\tif (ifp)\t\t\t\t\t\t\\\n\t\t((struct in6_ifextra *)((ifp)->if_afdata[AF_INET6]))->icmp6_ifstat->tag++; \\\n} while (/*CONSTCOND*/ 0)\n\n#define icmp6_ifoutstat_inc(ifp, type, code) \\\ndo { \\\n\t\ticmp6_ifstat_inc(ifp, ifs6_out_msg); \\\n \t\tif (type < ICMP6_INFOMSG_MASK) \\\n \t\t\ticmp6_ifstat_inc(ifp, ifs6_out_error); \\\n\t\tswitch (type) { \\\n\t\t case ICMP6_DST_UNREACH: \\\n\t\t\t icmp6_ifstat_inc(ifp, ifs6_out_dstunreach); \\\n\t\t\t if (code == ICMP6_DST_UNREACH_ADMIN) \\\n\t\t\t\t icmp6_ifstat_inc(ifp, ifs6_out_adminprohib); \\\n\t\t\t break; \\\n\t\t case ICMP6_PACKET_TOO_BIG: \\\n\t\t\t icmp6_ifstat_inc(ifp, ifs6_out_pkttoobig); \\\n\t\t\t break; \\\n\t\t case ICMP6_TIME_EXCEEDED: \\\n\t\t\t icmp6_ifstat_inc(ifp, ifs6_out_timeexceed); \\\n\t\t\t break; \\\n\t\t case ICMP6_PARAM_PROB: \\\n\t\t\t icmp6_ifstat_inc(ifp, ifs6_out_paramprob); \\\n\t\t\t break; \\\n\t\t case ICMP6_ECHO_REQUEST: \\\n\t\t\t icmp6_ifstat_inc(ifp, ifs6_out_echo); \\\n\t\t\t break; \\\n\t\t case ICMP6_ECHO_REPLY: \\\n\t\t\t icmp6_ifstat_inc(ifp, ifs6_out_echoreply); \\\n\t\t\t break; \\\n\t\t case MLD_LISTENER_QUERY: \\\n\t\t\t icmp6_ifstat_inc(ifp, ifs6_out_mldquery); \\\n\t\t\t break; \\\n\t\t case MLD_LISTENER_REPORT: \\\n\t\t\t icmp6_ifstat_inc(ifp, ifs6_out_mldreport); \\\n\t\t\t break; \\\n\t\t case MLD_LISTENER_DONE: \\\n\t\t\t icmp6_ifstat_inc(ifp, ifs6_out_mlddone); \\\n\t\t\t break; \\\n\t\t case ND_ROUTER_SOLICIT: \\\n\t\t\t icmp6_ifstat_inc(ifp, ifs6_out_routersolicit); \\\n\t\t\t break; \\\n\t\t case ND_ROUTER_ADVERT: \\\n\t\t\t icmp6_ifstat_inc(ifp, ifs6_out_routeradvert); \\\n\t\t\t break; \\\n\t\t case ND_NEIGHBOR_SOLICIT: \\\n\t\t\t icmp6_ifstat_inc(ifp, ifs6_out_neighborsolicit); \\\n\t\t\t break; \\\n\t\t case ND_NEIGHBOR_ADVERT: \\\n\t\t\t icmp6_ifstat_inc(ifp, ifs6_out_neighboradvert); \\\n\t\t\t break; \\\n\t\t case ND_REDIRECT: \\\n\t\t\t icmp6_ifstat_inc(ifp, ifs6_out_redirect); \\\n\t\t\t break; \\\n\t\t} \\\n} while (/*CONSTCOND*/ 0)\n\nVNET_DECLARE(int, icmp6_rediraccept);\t/* accept/process redirects */\nVNET_DECLARE(int, icmp6_redirtimeout);\t/* cache time for redirect routes */\n\n#define\tV_icmp6_rediraccept\tVNET(icmp6_rediraccept)\n#define\tV_icmp6_redirtimeout\tVNET(icmp6_redirtimeout)\n\n#define ICMP6_NODEINFO_FQDNOK\t\t0x1\n#define ICMP6_NODEINFO_NODEADDROK\t0x2\n#define ICMP6_NODEINFO_TMPADDROK\t0x4\n#define ICMP6_NODEINFO_GLOBALOK\t\t0x8\n#endif /* _KERNEL */\n\n#endif /* not _NETINET_ICMP6_H_ */\n"
  },
  {
    "path": "freebsd-headers/netinet/icmp_var.h",
    "content": "/*-\n * Copyright (c) 1982, 1986, 1993\n *\tThe Regents of the University of California.  All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 4. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t@(#)icmp_var.h\t8.1 (Berkeley) 6/10/93\n * $FreeBSD: release/9.0.0/sys/netinet/icmp_var.h 196039 2009-08-02 19:43:32Z rwatson $\n */\n\n#ifndef _NETINET_ICMP_VAR_H_\n#define _NETINET_ICMP_VAR_H_\n\n\n/*\n * Variables related to this implementation\n * of the internet control message protocol.\n */\nstruct\ticmpstat {\n/* statistics related to icmp packets generated */\n\tu_long\ticps_error;\t\t/* # of calls to icmp_error */\n\tu_long\ticps_oldshort;\t\t/* no error 'cuz old ip too short */\n\tu_long\ticps_oldicmp;\t\t/* no error 'cuz old was icmp */\n\tu_long\ticps_outhist[ICMP_MAXTYPE + 1];\n/* statistics related to input messages processed */\n\tu_long\ticps_badcode;\t\t/* icmp_code out of range */\n\tu_long\ticps_tooshort;\t\t/* packet < ICMP_MINLEN */\n\tu_long\ticps_checksum;\t\t/* bad checksum */\n\tu_long\ticps_badlen;\t\t/* calculated bound mismatch */\n\tu_long\ticps_reflect;\t\t/* number of responses */\n\tu_long\ticps_inhist[ICMP_MAXTYPE + 1];\n\tu_long\ticps_bmcastecho;\t/* b/mcast echo requests dropped */\n\tu_long\ticps_bmcasttstamp;\t/* b/mcast tstamp requests dropped */\n\tu_long\ticps_badaddr;\t\t/* bad return address */\n\tu_long\ticps_noroute;\t\t/* no route back */\n};\n\n#ifdef _KERNEL\n/*\n * In-kernel consumers can use these accessor macros directly to update\n * stats.\n */\n#define\tICMPSTAT_ADD(name, val)\tV_icmpstat.name += (val)\n#define\tICMPSTAT_INC(name)\tICMPSTAT_ADD(name, 1)\n\n/*\n * Kernel module consumers must use this accessor macro.\n */\nvoid\tkmod_icmpstat_inc(int statnum);\n#define\tKMOD_ICMPSTAT_INC(name)\t\t\t\t\t\t\\\n\tkmod_icmpstat_inc(offsetof(struct icmpstat, name) / sizeof(u_long))\n#endif\n\n/*\n * Names for ICMP sysctl objects\n */\n#define\tICMPCTL_MASKREPL\t1\t/* allow replies to netmask requests */\n#define\tICMPCTL_STATS\t\t2\t/* statistics (read-only) */\n#define ICMPCTL_ICMPLIM\t\t3\n#define ICMPCTL_MAXID\t\t4\n\n#define ICMPCTL_NAMES { \\\n\t{ 0, 0 }, \\\n\t{ \"maskrepl\", CTLTYPE_INT }, \\\n\t{ \"stats\", CTLTYPE_STRUCT }, \\\n\t{ \"icmplim\", CTLTYPE_INT }, \\\n}\n\n#ifdef _KERNEL\nSYSCTL_DECL(_net_inet_icmp);\n\nVNET_DECLARE(struct icmpstat, icmpstat);\t/* icmp statistics. */\n#define\tV_icmpstat\tVNET(icmpstat)\n\nextern int badport_bandlim(int);\n#define BANDLIM_UNLIMITED -1\n#define BANDLIM_ICMP_UNREACH 0\n#define BANDLIM_ICMP_ECHO 1\n#define BANDLIM_ICMP_TSTAMP 2\n#define BANDLIM_RST_CLOSEDPORT 3 /* No connection, and no listeners */\n#define BANDLIM_RST_OPENPORT 4   /* No connection, listener */\n#define BANDLIM_ICMP6_UNREACH 5\n#define BANDLIM_MAX 5\n#endif\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/netinet/if_atm.h",
    "content": "/* $FreeBSD: release/9.0.0/sys/netinet/if_atm.h 139823 2005-01-07 01:45:51Z imp $ */\n/*      $NetBSD: if_atm.h,v 1.2 1996/07/03 17:17:17 chuck Exp $       */\n\n/*-\n *\n * Copyright (c) 1996 Charles D. Cranor and Washington University.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. All advertising materials mentioning features or use of this software\n *    must display the following acknowledgement:\n *      This product includes software developed by Charles D. Cranor and\n *      Washington University.\n * 4. The name of the author may not be used to endorse or promote products\n *    derived from this software without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR\n * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES\n * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,\n * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF\n * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n */\n\n/*\n * if_atm.h\n */\n\nstruct atm_pseudohdr;\nstruct mbuf;\nstruct rtentry;\nstruct sockaddr;\n\nvoid atm_rtrequest(int, struct rtentry *, struct rt_addrinfo *);\nint atmresolve(struct rtentry *, struct mbuf *, struct sockaddr *,\n\t\tstruct atm_pseudohdr *);\n"
  },
  {
    "path": "freebsd-headers/netinet/if_ether.h",
    "content": "/*-\n * Copyright (c) 1982, 1986, 1993\n *\tThe Regents of the University of California.  All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 4. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t@(#)if_ether.h\t8.3 (Berkeley) 5/2/95\n * $FreeBSD: release/9.0.0/sys/netinet/if_ether.h 196995 2009-09-08 21:17:17Z np $\n */\n\n#ifndef _NETINET_IF_ETHER_H_\n#define _NETINET_IF_ETHER_H_\n\n#include <net/ethernet.h>\n#include <net/if_arp.h>\n\n/*\n * Macro to map an IP multicast address to an Ethernet multicast address.\n * The high-order 25 bits of the Ethernet address are statically assigned,\n * and the low-order 23 bits are taken from the low end of the IP address.\n */\n#define ETHER_MAP_IP_MULTICAST(ipaddr, enaddr) \\\n\t/* struct in_addr *ipaddr; */ \\\n\t/* u_char enaddr[ETHER_ADDR_LEN];\t   */ \\\n{ \\\n\t(enaddr)[0] = 0x01; \\\n\t(enaddr)[1] = 0x00; \\\n\t(enaddr)[2] = 0x5e; \\\n\t(enaddr)[3] = ((u_char *)ipaddr)[1] & 0x7f; \\\n\t(enaddr)[4] = ((u_char *)ipaddr)[2]; \\\n\t(enaddr)[5] = ((u_char *)ipaddr)[3]; \\\n}\n/*\n * Macro to map an IP6 multicast address to an Ethernet multicast address.\n * The high-order 16 bits of the Ethernet address are statically assigned,\n * and the low-order 32 bits are taken from the low end of the IP6 address.\n */\n#define ETHER_MAP_IPV6_MULTICAST(ip6addr, enaddr)\t\t\t\\\n/* struct\tin6_addr *ip6addr; */\t\t\t\t\t\\\n/* u_char\tenaddr[ETHER_ADDR_LEN]; */\t\t\t\t\\\n{                                                                       \\\n\t(enaddr)[0] = 0x33;\t\t\t\t\t\t\\\n\t(enaddr)[1] = 0x33;\t\t\t\t\t\t\\\n\t(enaddr)[2] = ((u_char *)ip6addr)[12];\t\t\t\t\\\n\t(enaddr)[3] = ((u_char *)ip6addr)[13];\t\t\t\t\\\n\t(enaddr)[4] = ((u_char *)ip6addr)[14];\t\t\t\t\\\n\t(enaddr)[5] = ((u_char *)ip6addr)[15];\t\t\t\t\\\n}\n\n/*\n * Ethernet Address Resolution Protocol.\n *\n * See RFC 826 for protocol description.  Structure below is adapted\n * to resolving internet addresses.  Field names used correspond to\n * RFC 826.\n */\nstruct\tether_arp {\n\tstruct\tarphdr ea_hdr;\t/* fixed-size header */\n\tu_char\tarp_sha[ETHER_ADDR_LEN];\t/* sender hardware address */\n\tu_char\tarp_spa[4];\t/* sender protocol address */\n\tu_char\tarp_tha[ETHER_ADDR_LEN];\t/* target hardware address */\n\tu_char\tarp_tpa[4];\t/* target protocol address */\n};\n#define\tarp_hrd\tea_hdr.ar_hrd\n#define\tarp_pro\tea_hdr.ar_pro\n#define\tarp_hln\tea_hdr.ar_hln\n#define\tarp_pln\tea_hdr.ar_pln\n#define\tarp_op\tea_hdr.ar_op\n\nstruct sockaddr_inarp {\n\tu_char\tsin_len;\n\tu_char\tsin_family;\n\tu_short sin_port;\n\tstruct\tin_addr sin_addr;\n\tstruct\tin_addr sin_srcaddr;\n\tu_short\tsin_tos;\n\tu_short\tsin_other;\n#define SIN_PROXY 1\n};\n/*\n * IP and ethernet specific routing flags\n */\n#define\tRTF_USETRAILERS\tRTF_PROTO1\t/* use trailers */\n#define RTF_ANNOUNCE\tRTF_PROTO2\t/* announce new arp entry */\n\n#ifdef\t_KERNEL\nextern u_char\tether_ipmulticast_min[ETHER_ADDR_LEN];\nextern u_char\tether_ipmulticast_max[ETHER_ADDR_LEN];\n\nstruct llentry;\nstruct ifaddr;\n\nint\tarpresolve(struct ifnet *ifp, struct rtentry *rt,\n\t\t    struct mbuf *m, struct sockaddr *dst, u_char *desten,\n\t\t    struct llentry **lle);\nvoid\tarp_ifinit(struct ifnet *, struct ifaddr *);\nvoid\tarp_ifinit2(struct ifnet *, struct ifaddr *, u_char *);\n\n#include <sys/eventhandler.h>\ntypedef void (*llevent_arp_update_fn)(void *, struct llentry *);\nEVENTHANDLER_DECLARE(arp_update_event, llevent_arp_update_fn);\n\n#endif\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/netinet/igmp.h",
    "content": "/*-\n * Copyright (c) 1988 Stephen Deering.\n * Copyright (c) 1992, 1993\n *\tThe Regents of the University of California.  All rights reserved.\n *\n * This code is derived from software contributed to Berkeley by\n * Stephen Deering of Stanford University.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 4. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t@(#)igmp.h\t8.1 (Berkeley) 6/10/93\n * $FreeBSD: release/9.0.0/sys/netinet/igmp.h 193938 2009-06-10 18:12:15Z imp $\n */\n\n#ifndef _NETINET_IGMP_H_\n#define _NETINET_IGMP_H_\n\n/*\n * Internet Group Management Protocol (IGMP) definitions.\n *\n * Written by Steve Deering, Stanford, May 1988.\n *\n * MULTICAST Revision: 3.5.1.2\n */\n\n/* Minimum length of any IGMP protocol message. */\n#define IGMP_MINLEN\t\t\t8\n\n/*\n * IGMPv1/v2 query and host report format.\n */\nstruct igmp {\n\tu_char\t\tigmp_type;\t/* version & type of IGMP message  */\n\tu_char\t\tigmp_code;\t/* subtype for routing msgs        */\n\tu_short\t\tigmp_cksum;\t/* IP-style checksum               */\n\tstruct in_addr\tigmp_group;\t/* group address being reported    */\n};\t\t\t\t\t/*  (zero for queries)             */\n\n/*\n * IGMP v3 query format.\n */\nstruct igmpv3 {\n\tu_char\t\tigmp_type;\t/* version & type of IGMP message  */\n\tu_char\t\tigmp_code;\t/* subtype for routing msgs        */\n\tu_short\t\tigmp_cksum;\t/* IP-style checksum               */\n\tstruct in_addr\tigmp_group;\t/* group address being reported    */\n\t\t\t\t\t/*  (zero for queries)             */\n\tu_char\t\tigmp_misc;\t/* reserved/suppress/robustness    */\n\tu_char\t\tigmp_qqi;\t/* querier's query interval        */\n\tu_short\t\tigmp_numsrc;\t/* number of sources               */\n\t/*struct in_addr\tigmp_sources[1];*/ /* source addresses */\n};\n#define IGMP_V3_QUERY_MINLEN\t\t12\n#define IGMP_EXP(x)\t\t\t(((x) >> 4) & 0x07)\n#define IGMP_MANT(x)\t\t\t((x) & 0x0f)\n#define IGMP_QRESV(x)\t\t\t(((x) >> 4) & 0x0f)\n#define IGMP_SFLAG(x)\t\t\t(((x) >> 3) & 0x01)\n#define IGMP_QRV(x)\t\t\t((x) & 0x07)\n\nstruct igmp_grouprec {\n\tu_char\t\tig_type;\t/* record type */\n\tu_char\t\tig_datalen;\t/* length of auxiliary data */\n\tu_short\t\tig_numsrc;\t/* number of sources */\n\tstruct in_addr\tig_group;\t/* group address being reported */\n\t/*struct in_addr\tig_sources[1];*/ /* source addresses */\n};\n#define IGMP_GRPREC_HDRLEN\t\t8\n\n/*\n * IGMPv3 host membership report header.\n */\nstruct igmp_report {\n\tu_char\t\tir_type;\t/* IGMP_v3_HOST_MEMBERSHIP_REPORT */\n\tu_char\t\tir_rsv1;\t/* must be zero */\n\tu_short\t\tir_cksum;\t/* checksum */\n\tu_short\t\tir_rsv2;\t/* must be zero */\n\tu_short\t\tir_numgrps;\t/* number of group records */\n\t/*struct\tigmp_grouprec ir_groups[1];*/\t/* group records */\n};\n#define IGMP_V3_REPORT_MINLEN\t\t8\n#define IGMP_V3_REPORT_MAXRECS\t\t65535\n\n/*\n * Message types, including version number.\n */\n#define IGMP_HOST_MEMBERSHIP_QUERY\t0x11\t/* membership query         */\n#define IGMP_v1_HOST_MEMBERSHIP_REPORT\t0x12\t/* Ver. 1 membership report */\n#define IGMP_DVMRP\t\t\t0x13\t/* DVMRP routing message    */\n#define IGMP_PIM\t\t\t0x14\t/* PIMv1 message (historic) */\n#define IGMP_v2_HOST_MEMBERSHIP_REPORT\t0x16\t/* Ver. 2 membership report */\n#define IGMP_HOST_LEAVE_MESSAGE\t\t0x17\t/* Leave-group message     */\n#define IGMP_MTRACE_REPLY\t\t0x1e\t/* mtrace(8) reply */\n#define IGMP_MTRACE_QUERY\t\t0x1f\t/* mtrace(8) probe */\n#define IGMP_v3_HOST_MEMBERSHIP_REPORT\t0x22\t/* Ver. 3 membership report */\n\n/*\n * IGMPv3 report modes.\n */\n#define IGMP_DO_NOTHING\t\t\t0\t/* don't send a record */\n#define IGMP_MODE_IS_INCLUDE\t\t1\t/* MODE_IN */\n#define IGMP_MODE_IS_EXCLUDE\t\t2\t/* MODE_EX */\n#define IGMP_CHANGE_TO_INCLUDE_MODE\t3\t/* TO_IN */\n#define IGMP_CHANGE_TO_EXCLUDE_MODE\t4\t/* TO_EX */\n#define IGMP_ALLOW_NEW_SOURCES\t\t5\t/* ALLOW_NEW */\n#define IGMP_BLOCK_OLD_SOURCES\t\t6\t/* BLOCK_OLD */\n\n/*\n * IGMPv3 query types.\n */\n#define IGMP_V3_GENERAL_QUERY\t\t1\n#define IGMP_V3_GROUP_QUERY\t\t2\n#define IGMP_V3_GROUP_SOURCE_QUERY\t3\n\n/*\n * Maximum report interval for IGMP v1/v2 host membership reports [RFC 1112]\n */\n#define IGMP_V1V2_MAX_RI\t\t10\n#define IGMP_MAX_HOST_REPORT_DELAY\tIGMP_V1V2_MAX_RI\n\n/*\n * IGMP_TIMER_SCALE denotes that the igmp code field specifies\n * time in tenths of a second.\n */\n#define IGMP_TIMER_SCALE\t\t10\n\n#endif /* _NETINET_IGMP_H_ */\n"
  },
  {
    "path": "freebsd-headers/netinet/igmp_var.h",
    "content": "/*-a\n * Copyright (c) 1988 Stephen Deering.\n * Copyright (c) 1992, 1993\n *\tThe Regents of the University of California.  All rights reserved.\n *\n * This code is derived from software contributed to Berkeley by\n * Stephen Deering of Stanford University.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 4. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\tfrom: @(#)igmp_var.h\t8.1 (Berkeley) 7/19/93\n * $FreeBSD: release/9.0.0/sys/netinet/igmp_var.h 190965 2009-04-12 13:41:13Z rwatson $\n */\n\n#ifndef _NETINET_IGMP_VAR_H_\n#define _NETINET_IGMP_VAR_H_\n\n/*\n * Internet Group Management Protocol (IGMP),\n * implementation-specific definitions.\n *\n * Written by Steve Deering, Stanford, May 1988.\n *\n * MULTICAST Revision: 3.5.1.3\n */\n\n#ifndef BURN_BRIDGES\n/*\n * Pre-IGMPV3 igmpstat structure.\n */\nstruct oigmpstat {\n\tu_int igps_rcv_total;\t\t/* total IGMP messages received */\n\tu_int igps_rcv_tooshort;\t/* received with too few bytes */\n\tu_int igps_rcv_badsum;\t\t/* received with bad checksum */\n\tu_int igps_rcv_queries;\t\t/* received membership queries */\n\tu_int igps_rcv_badqueries;\t/* received invalid queries */\n\tu_int igps_rcv_reports;\t\t/* received membership reports */\n\tu_int igps_rcv_badreports;\t/* received invalid reports */\n\tu_int igps_rcv_ourreports;\t/* received reports for our groups */\n\tu_int igps_snd_reports;\t\t/* sent membership reports */\n\tu_int igps_rcv_toolong;\t\t/* received with too many bytes */\n};\n#endif\n\n/*\n * IGMPv3 protocol statistics.\n */\nstruct igmpstat {\n\t/*\n\t * Structure header (to insulate ABI changes).\n\t */\n\tuint32_t igps_version;\t\t/* version of this structure */\n\tuint32_t igps_len;\t\t/* length of this structure */\n\t/*\n\t * Message statistics.\n\t */\n\tuint64_t igps_rcv_total;\t/* total IGMP messages received */\n\tuint64_t igps_rcv_tooshort;\t/* received with too few bytes */\n\tuint64_t igps_rcv_badttl;\t/* received with ttl other than 1 */\n\tuint64_t igps_rcv_badsum;\t/* received with bad checksum */\n\t/*\n\t * Query statistics.\n\t */\n\tuint64_t igps_rcv_v1v2_queries;\t/* received IGMPv1/IGMPv2 queries */\n\tuint64_t igps_rcv_v3_queries;\t/* received IGMPv3 queries */\n\tuint64_t igps_rcv_badqueries;\t/* received invalid queries */\n\tuint64_t igps_rcv_gen_queries;\t/* received general queries */\n\tuint64_t igps_rcv_group_queries;/* received group queries */\n\tuint64_t igps_rcv_gsr_queries;\t/* received group-source queries */\n\tuint64_t igps_drop_gsr_queries;\t/* dropped group-source queries */\n\t/*\n\t * Report statistics.\n\t */\n\tuint64_t igps_rcv_reports;\t/* received membership reports */\n\tuint64_t igps_rcv_badreports;\t/* received invalid reports */\n\tuint64_t igps_rcv_ourreports;\t/* received reports for our groups */\n\tuint64_t igps_rcv_nora;\t\t/* received w/o Router Alert option */\n\tuint64_t igps_snd_reports;\t/* sent membership reports */\n\t/*\n\t * Padding for future additions.\n\t */\n\tuint64_t __igps_pad[4];\n};\n#define IGPS_VERSION_3\t3\t\t/* as of FreeBSD 8.x */\n#define IGPS_VERSION3_LEN\t\t168\n\n#ifdef _KERNEL\n#define\tIGMPSTAT_ADD(name, val)\t\tV_igmpstat.name += (val)\n#define\tIGMPSTAT_INC(name)\t\tIGMPSTAT_ADD(name, 1)\n#endif\n\n#ifdef CTASSERT\nCTASSERT(sizeof(struct igmpstat) == 168);\n#endif\n\n#ifdef _KERNEL\n#define IGMP_RANDOM_DELAY(X) (random() % (X) + 1)\n\n#define IGMP_MAX_STATE_CHANGES\t\t24 /* Max pending changes per group */\n\n/*\n * IGMP per-group states.\n */\n#define IGMP_NOT_MEMBER\t\t\t0 /* Can garbage collect in_multi */\n#define IGMP_SILENT_MEMBER\t\t1 /* Do not perform IGMP for group */\n#define IGMP_REPORTING_MEMBER\t\t2 /* IGMPv1/2/3 we are reporter */\n#define IGMP_IDLE_MEMBER\t\t3 /* IGMPv1/2 we reported last */\n#define IGMP_LAZY_MEMBER\t\t4 /* IGMPv1/2 other member reporting */\n#define IGMP_SLEEPING_MEMBER\t\t5 /* IGMPv1/2 start query response */\n#define IGMP_AWAKENING_MEMBER\t\t6 /* IGMPv1/2 group timer will start */\n#define IGMP_G_QUERY_PENDING_MEMBER\t7 /* IGMPv3 group query pending */\n#define IGMP_SG_QUERY_PENDING_MEMBER\t8 /* IGMPv3 source query pending */\n#define IGMP_LEAVING_MEMBER\t\t9 /* IGMPv3 dying gasp (pending last */\n\t\t\t\t\t  /* retransmission of INCLUDE {}) */\n\n/*\n * IGMP version tag.\n */\n#define IGMP_VERSION_NONE\t\t0 /* Invalid */\n#define IGMP_VERSION_1\t\t\t1\n#define IGMP_VERSION_2\t\t\t2\n#define IGMP_VERSION_3\t\t\t3 /* Default */\n\n/*\n * IGMPv3 protocol control variables.\n */\n#define IGMP_RV_INIT\t\t2\t/* Robustness Variable */\n#define IGMP_RV_MIN\t\t1\n#define IGMP_RV_MAX\t\t7\n\n#define IGMP_QI_INIT\t\t125\t/* Query Interval (s) */\n#define IGMP_QI_MIN\t\t1\n#define IGMP_QI_MAX\t\t255\n\n#define IGMP_QRI_INIT\t\t10\t/* Query Response Interval (s) */\n#define IGMP_QRI_MIN\t\t1\n#define IGMP_QRI_MAX\t\t255\n\n#define IGMP_URI_INIT\t\t3\t/* Unsolicited Report Interval (s) */\n#define IGMP_URI_MIN\t\t0\n#define IGMP_URI_MAX\t\t10\n\n#define IGMP_MAX_G_GS_PACKETS\t\t8 /* # of packets to answer G/GS */\n#define IGMP_MAX_STATE_CHANGE_PACKETS\t8 /* # of packets per state change */\n#define IGMP_MAX_RESPONSE_PACKETS\t16 /* # of packets for general query */\n#define IGMP_MAX_RESPONSE_BURST\t\t4 /* # of responses to send at once */\n#define IGMP_RESPONSE_BURST_INTERVAL\t(PR_FASTHZ / 2)\t/* 500ms */\n\n/*\n * IGMP-specific mbuf flags.\n */\n#define M_IGMPV2\tM_PROTO1\t/* Packet is IGMPv2 */\n#define M_IGMPV3_HDR\tM_PROTO2\t/* Packet has IGMPv3 headers */\n#define M_GROUPREC\tM_PROTO3\t/* mbuf chain is a group record */\n#define M_IGMP_LOOP\tM_PROTO4\t/* transmit on loif, not real ifp */\n\n/*\n * Default amount of leading space for IGMPv3 to allocate at the\n * beginning of its mbuf packet chains, to avoid fragmentation and\n * unnecessary allocation of leading mbufs.\n */\n#define RAOPT_LEN\t4\t\t/* Length of IP Router Alert option */\n#define\tIGMP_LEADINGSPACE\t\t\\\n\t(sizeof(struct ip) + RAOPT_LEN + sizeof(struct igmp_report))\n\n/*\n * Subsystem lock macros.\n * The IGMP lock is only taken with IGMP. Currently it is system-wide.\n * VIMAGE: The lock could be pushed to per-VIMAGE granularity in future.\n */\n#define\tIGMP_LOCK_INIT()\tmtx_init(&igmp_mtx, \"igmp_mtx\", NULL, MTX_DEF)\n#define\tIGMP_LOCK_DESTROY()\tmtx_destroy(&igmp_mtx)\n#define\tIGMP_LOCK()\t\tmtx_lock(&igmp_mtx)\n#define\tIGMP_LOCK_ASSERT()\tmtx_assert(&igmp_mtx, MA_OWNED)\n#define\tIGMP_UNLOCK()\t\tmtx_unlock(&igmp_mtx)\n#define\tIGMP_UNLOCK_ASSERT()\tmtx_assert(&igmp_mtx, MA_NOTOWNED)\n\nstruct igmp_ifinfo;\n\nint\tigmp_change_state(struct in_multi *);\nvoid\tigmp_fasttimo(void);\nstruct igmp_ifinfo *\n\tigmp_domifattach(struct ifnet *);\nvoid\tigmp_domifdetach(struct ifnet *);\nvoid\tigmp_ifdetach(struct ifnet *);\nvoid\tigmp_input(struct mbuf *, int);\nvoid\tigmp_slowtimo(void);\n\nSYSCTL_DECL(_net_inet_igmp);\n\n#endif /* _KERNEL */\n\n/*\n * Names for IGMP sysctl objects\n */\n#define IGMPCTL_STATS\t\t1\t/* statistics (read-only) */\n#define IGMPCTL_MAXID\t\t2\n\n#define IGMPCTL_NAMES { \\\n\t{ 0, 0 }, \\\n\t{ \"stats\", CTLTYPE_STRUCT } \\\n}\n#endif\n"
  },
  {
    "path": "freebsd-headers/netinet/in.h",
    "content": "/*-\n * Copyright (c) 1982, 1986, 1990, 1993\n *\tThe Regents of the University of California.  All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 4. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t@(#)in.h\t8.3 (Berkeley) 1/3/94\n * $FreeBSD: release/9.0.0/sys/netinet/in.h 226572 2011-10-20 15:58:05Z glebius $\n */\n\n#ifndef _NETINET_IN_H_\n#define\t_NETINET_IN_H_\n\n#include <sys/cdefs.h>\n#include <sys/_types.h>\n#include <machine/endian.h>\n\n/* Protocols common to RFC 1700, POSIX, and X/Open. */\n#define\tIPPROTO_IP\t\t0\t\t/* dummy for IP */\n#define\tIPPROTO_ICMP\t\t1\t\t/* control message protocol */\n#define\tIPPROTO_TCP\t\t6\t\t/* tcp */\n#define\tIPPROTO_UDP\t\t17\t\t/* user datagram protocol */\n\n#define\tINADDR_ANY\t\t(u_int32_t)0x00000000\n#define\tINADDR_BROADCAST\t(u_int32_t)0xffffffff\t/* must be masked */\n\n#ifndef _UINT8_T_DECLARED\ntypedef\t__uint8_t\t\tuint8_t;\n#define\t_UINT8_T_DECLARED\n#endif\n\n#ifndef _UINT16_T_DECLARED\ntypedef\t__uint16_t\t\tuint16_t;\n#define\t_UINT16_T_DECLARED\n#endif\n\n#ifndef _UINT32_T_DECLARED\ntypedef\t__uint32_t\t\tuint32_t;\n#define\t_UINT32_T_DECLARED\n#endif\n\n#ifndef _IN_ADDR_T_DECLARED\ntypedef\tuint32_t\t\tin_addr_t;\n#define\t_IN_ADDR_T_DECLARED\n#endif\n\n#ifndef _IN_PORT_T_DECLARED\ntypedef\tuint16_t\t\tin_port_t;\n#define\t_IN_PORT_T_DECLARED\n#endif\n\n#ifndef _SA_FAMILY_T_DECLARED\ntypedef\t__sa_family_t\t\tsa_family_t;\n#define\t_SA_FAMILY_T_DECLARED\n#endif\n\n/* Internet address (a structure for historical reasons). */\n#ifndef\t_STRUCT_IN_ADDR_DECLARED\nstruct in_addr {\n\tin_addr_t s_addr;\n};\n#define\t_STRUCT_IN_ADDR_DECLARED\n#endif\n\n#ifndef\t_SOCKLEN_T_DECLARED\ntypedef\t__socklen_t\tsocklen_t;\n#define\t_SOCKLEN_T_DECLARED\n#endif\n\n#include <sys/_sockaddr_storage.h>\n\n/* Socket address, internet style. */\nstruct sockaddr_in {\n\tuint8_t\tsin_len;\n\tsa_family_t\tsin_family;\n\tin_port_t\tsin_port;\n\tstruct\tin_addr sin_addr;\n\tchar\tsin_zero[8];\n};\n\n#if !defined(_KERNEL) && __BSD_VISIBLE\n\n#ifndef _BYTEORDER_PROTOTYPED\n#define\t_BYTEORDER_PROTOTYPED\n__BEGIN_DECLS\nuint32_t\thtonl(uint32_t);\nuint16_t\thtons(uint16_t);\nuint32_t\tntohl(uint32_t);\nuint16_t\tntohs(uint16_t);\n__END_DECLS\n#endif\n\n#ifndef _BYTEORDER_FUNC_DEFINED\n#define\t_BYTEORDER_FUNC_DEFINED\n#define\thtonl(x)\t__htonl(x)\n#define\thtons(x)\t__htons(x)\n#define\tntohl(x)\t__ntohl(x)\n#define\tntohs(x)\t__ntohs(x)\n#endif\n\n#endif /* !_KERNEL && __BSD_VISIBLE */\n\n#if __POSIX_VISIBLE >= 200112\n#define\tIPPROTO_RAW\t\t255\t\t/* raw IP packet */\n#define\tINET_ADDRSTRLEN\t\t16\n#endif\n\n#if __BSD_VISIBLE\n/*\n * Constants and structures defined by the internet system,\n * Per RFC 790, September 1981, and numerous additions.\n */\n\n/*\n * Protocols (RFC 1700)\n */\n#define\tIPPROTO_HOPOPTS\t\t0\t\t/* IP6 hop-by-hop options */\n#define\tIPPROTO_IGMP\t\t2\t\t/* group mgmt protocol */\n#define\tIPPROTO_GGP\t\t3\t\t/* gateway^2 (deprecated) */\n#define\tIPPROTO_IPV4\t\t4\t\t/* IPv4 encapsulation */\n#define\tIPPROTO_IPIP\t\tIPPROTO_IPV4\t/* for compatibility */\n#define\tIPPROTO_ST\t\t7\t\t/* Stream protocol II */\n#define\tIPPROTO_EGP\t\t8\t\t/* exterior gateway protocol */\n#define\tIPPROTO_PIGP\t\t9\t\t/* private interior gateway */\n#define\tIPPROTO_RCCMON\t\t10\t\t/* BBN RCC Monitoring */\n#define\tIPPROTO_NVPII\t\t11\t\t/* network voice protocol*/\n#define\tIPPROTO_PUP\t\t12\t\t/* pup */\n#define\tIPPROTO_ARGUS\t\t13\t\t/* Argus */\n#define\tIPPROTO_EMCON\t\t14\t\t/* EMCON */\n#define\tIPPROTO_XNET\t\t15\t\t/* Cross Net Debugger */\n#define\tIPPROTO_CHAOS\t\t16\t\t/* Chaos*/\n#define\tIPPROTO_MUX\t\t18\t\t/* Multiplexing */\n#define\tIPPROTO_MEAS\t\t19\t\t/* DCN Measurement Subsystems */\n#define\tIPPROTO_HMP\t\t20\t\t/* Host Monitoring */\n#define\tIPPROTO_PRM\t\t21\t\t/* Packet Radio Measurement */\n#define\tIPPROTO_IDP\t\t22\t\t/* xns idp */\n#define\tIPPROTO_TRUNK1\t\t23\t\t/* Trunk-1 */\n#define\tIPPROTO_TRUNK2\t\t24\t\t/* Trunk-2 */\n#define\tIPPROTO_LEAF1\t\t25\t\t/* Leaf-1 */\n#define\tIPPROTO_LEAF2\t\t26\t\t/* Leaf-2 */\n#define\tIPPROTO_RDP\t\t27\t\t/* Reliable Data */\n#define\tIPPROTO_IRTP\t\t28\t\t/* Reliable Transaction */\n#define\tIPPROTO_TP\t\t29\t\t/* tp-4 w/ class negotiation */\n#define\tIPPROTO_BLT\t\t30\t\t/* Bulk Data Transfer */\n#define\tIPPROTO_NSP\t\t31\t\t/* Network Services */\n#define\tIPPROTO_INP\t\t32\t\t/* Merit Internodal */\n#define\tIPPROTO_SEP\t\t33\t\t/* Sequential Exchange */\n#define\tIPPROTO_3PC\t\t34\t\t/* Third Party Connect */\n#define\tIPPROTO_IDPR\t\t35\t\t/* InterDomain Policy Routing */\n#define\tIPPROTO_XTP\t\t36\t\t/* XTP */\n#define\tIPPROTO_DDP\t\t37\t\t/* Datagram Delivery */\n#define\tIPPROTO_CMTP\t\t38\t\t/* Control Message Transport */\n#define\tIPPROTO_TPXX\t\t39\t\t/* TP++ Transport */\n#define\tIPPROTO_IL\t\t40\t\t/* IL transport protocol */\n#define\tIPPROTO_IPV6\t\t41\t\t/* IP6 header */\n#define\tIPPROTO_SDRP\t\t42\t\t/* Source Demand Routing */\n#define\tIPPROTO_ROUTING\t\t43\t\t/* IP6 routing header */\n#define\tIPPROTO_FRAGMENT\t44\t\t/* IP6 fragmentation header */\n#define\tIPPROTO_IDRP\t\t45\t\t/* InterDomain Routing*/\n#define\tIPPROTO_RSVP\t\t46\t\t/* resource reservation */\n#define\tIPPROTO_GRE\t\t47\t\t/* General Routing Encap. */\n#define\tIPPROTO_MHRP\t\t48\t\t/* Mobile Host Routing */\n#define\tIPPROTO_BHA\t\t49\t\t/* BHA */\n#define\tIPPROTO_ESP\t\t50\t\t/* IP6 Encap Sec. Payload */\n#define\tIPPROTO_AH\t\t51\t\t/* IP6 Auth Header */\n#define\tIPPROTO_INLSP\t\t52\t\t/* Integ. Net Layer Security */\n#define\tIPPROTO_SWIPE\t\t53\t\t/* IP with encryption */\n#define\tIPPROTO_NHRP\t\t54\t\t/* Next Hop Resolution */\n#define\tIPPROTO_MOBILE\t\t55\t\t/* IP Mobility */\n#define\tIPPROTO_TLSP\t\t56\t\t/* Transport Layer Security */\n#define\tIPPROTO_SKIP\t\t57\t\t/* SKIP */\n#define\tIPPROTO_ICMPV6\t\t58\t\t/* ICMP6 */\n#define\tIPPROTO_NONE\t\t59\t\t/* IP6 no next header */\n#define\tIPPROTO_DSTOPTS\t\t60\t\t/* IP6 destination option */\n#define\tIPPROTO_AHIP\t\t61\t\t/* any host internal protocol */\n#define\tIPPROTO_CFTP\t\t62\t\t/* CFTP */\n#define\tIPPROTO_HELLO\t\t63\t\t/* \"hello\" routing protocol */\n#define\tIPPROTO_SATEXPAK\t64\t\t/* SATNET/Backroom EXPAK */\n#define\tIPPROTO_KRYPTOLAN\t65\t\t/* Kryptolan */\n#define\tIPPROTO_RVD\t\t66\t\t/* Remote Virtual Disk */\n#define\tIPPROTO_IPPC\t\t67\t\t/* Pluribus Packet Core */\n#define\tIPPROTO_ADFS\t\t68\t\t/* Any distributed FS */\n#define\tIPPROTO_SATMON\t\t69\t\t/* Satnet Monitoring */\n#define\tIPPROTO_VISA\t\t70\t\t/* VISA Protocol */\n#define\tIPPROTO_IPCV\t\t71\t\t/* Packet Core Utility */\n#define\tIPPROTO_CPNX\t\t72\t\t/* Comp. Prot. Net. Executive */\n#define\tIPPROTO_CPHB\t\t73\t\t/* Comp. Prot. HeartBeat */\n#define\tIPPROTO_WSN\t\t74\t\t/* Wang Span Network */\n#define\tIPPROTO_PVP\t\t75\t\t/* Packet Video Protocol */\n#define\tIPPROTO_BRSATMON\t76\t\t/* BackRoom SATNET Monitoring */\n#define\tIPPROTO_ND\t\t77\t\t/* Sun net disk proto (temp.) */\n#define\tIPPROTO_WBMON\t\t78\t\t/* WIDEBAND Monitoring */\n#define\tIPPROTO_WBEXPAK\t\t79\t\t/* WIDEBAND EXPAK */\n#define\tIPPROTO_EON\t\t80\t\t/* ISO cnlp */\n#define\tIPPROTO_VMTP\t\t81\t\t/* VMTP */\n#define\tIPPROTO_SVMTP\t\t82\t\t/* Secure VMTP */\n#define\tIPPROTO_VINES\t\t83\t\t/* Banyon VINES */\n#define\tIPPROTO_TTP\t\t84\t\t/* TTP */\n#define\tIPPROTO_IGP\t\t85\t\t/* NSFNET-IGP */\n#define\tIPPROTO_DGP\t\t86\t\t/* dissimilar gateway prot. */\n#define\tIPPROTO_TCF\t\t87\t\t/* TCF */\n#define\tIPPROTO_IGRP\t\t88\t\t/* Cisco/GXS IGRP */\n#define\tIPPROTO_OSPFIGP\t\t89\t\t/* OSPFIGP */\n#define\tIPPROTO_SRPC\t\t90\t\t/* Strite RPC protocol */\n#define\tIPPROTO_LARP\t\t91\t\t/* Locus Address Resoloution */\n#define\tIPPROTO_MTP\t\t92\t\t/* Multicast Transport */\n#define\tIPPROTO_AX25\t\t93\t\t/* AX.25 Frames */\n#define\tIPPROTO_IPEIP\t\t94\t\t/* IP encapsulated in IP */\n#define\tIPPROTO_MICP\t\t95\t\t/* Mobile Int.ing control */\n#define\tIPPROTO_SCCSP\t\t96\t\t/* Semaphore Comm. security */\n#define\tIPPROTO_ETHERIP\t\t97\t\t/* Ethernet IP encapsulation */\n#define\tIPPROTO_ENCAP\t\t98\t\t/* encapsulation header */\n#define\tIPPROTO_APES\t\t99\t\t/* any private encr. scheme */\n#define\tIPPROTO_GMTP\t\t100\t\t/* GMTP*/\n#define\tIPPROTO_IPCOMP\t\t108\t\t/* payload compression (IPComp) */\n#define\tIPPROTO_SCTP\t\t132\t\t/* SCTP */\n#define\tIPPROTO_MH\t\t135\t\t/* IPv6 Mobility Header */\n/* 101-254: Partly Unassigned */\n#define\tIPPROTO_PIM\t\t103\t\t/* Protocol Independent Mcast */\n#define\tIPPROTO_CARP\t\t112\t\t/* CARP */\n#define\tIPPROTO_PGM\t\t113\t\t/* PGM */\n#define\tIPPROTO_PFSYNC\t\t240\t\t/* PFSYNC */\n/* 255: Reserved */\n/* BSD Private, local use, namespace incursion, no longer used */\n#define\tIPPROTO_OLD_DIVERT\t254\t\t/* OLD divert pseudo-proto */\n#define\tIPPROTO_MAX\t\t256\n\n/* last return value of *_input(), meaning \"all job for this pkt is done\".  */\n#define\tIPPROTO_DONE\t\t257\n\n/* Only used internally, so can be outside the range of valid IP protocols. */\n#define\tIPPROTO_DIVERT\t\t258\t\t/* divert pseudo-protocol */\n#define\tIPPROTO_SEND\t\t259\t\t/* SeND pseudo-protocol */\n\n/*\n * Defined to avoid confusion.  The master value is defined by\n * PROTO_SPACER in sys/protosw.h.\n */\n#define\tIPPROTO_SPACER\t\t32767\t\t/* spacer for loadable protos */\n\n/*\n * Local port number conventions:\n *\n * When a user does a bind(2) or connect(2) with a port number of zero,\n * a non-conflicting local port address is chosen.\n * The default range is IPPORT_HIFIRSTAUTO through\n * IPPORT_HILASTAUTO, although that is settable by sysctl.\n *\n * A user may set the IPPROTO_IP option IP_PORTRANGE to change this\n * default assignment range.\n *\n * The value IP_PORTRANGE_DEFAULT causes the default behavior.\n *\n * The value IP_PORTRANGE_HIGH changes the range of candidate port numbers\n * into the \"high\" range.  These are reserved for client outbound connections\n * which do not want to be filtered by any firewalls.\n *\n * The value IP_PORTRANGE_LOW changes the range to the \"low\" are\n * that is (by convention) restricted to privileged processes.  This\n * convention is based on \"vouchsafe\" principles only.  It is only secure\n * if you trust the remote host to restrict these ports.\n *\n * The default range of ports and the high range can be changed by\n * sysctl(3).  (net.inet.ip.port{hi,low}{first,last}_auto)\n *\n * Changing those values has bad security implications if you are\n * using a stateless firewall that is allowing packets outside of that\n * range in order to allow transparent outgoing connections.\n *\n * Such a firewall configuration will generally depend on the use of these\n * default values.  If you change them, you may find your Security\n * Administrator looking for you with a heavy object.\n *\n * For a slightly more orthodox text view on this:\n *\n *            ftp://ftp.isi.edu/in-notes/iana/assignments/port-numbers\n *\n *    port numbers are divided into three ranges:\n *\n *                0 -  1023 Well Known Ports\n *             1024 - 49151 Registered Ports\n *            49152 - 65535 Dynamic and/or Private Ports\n *\n */\n\n/*\n * Ports < IPPORT_RESERVED are reserved for\n * privileged processes (e.g. root).         (IP_PORTRANGE_LOW)\n */\n#define\tIPPORT_RESERVED\t\t1024\n\n/*\n * Default local port range, used by IP_PORTRANGE_DEFAULT\n */\n#define IPPORT_EPHEMERALFIRST\t10000\n#define IPPORT_EPHEMERALLAST\t65535 \n \n/*\n * Dynamic port range, used by IP_PORTRANGE_HIGH.\n */\n#define\tIPPORT_HIFIRSTAUTO\t49152\n#define\tIPPORT_HILASTAUTO\t65535\n\n/*\n * Scanning for a free reserved port return a value below IPPORT_RESERVED,\n * but higher than IPPORT_RESERVEDSTART.  Traditionally the start value was\n * 512, but that conflicts with some well-known-services that firewalls may\n * have a fit if we use.\n */\n#define\tIPPORT_RESERVEDSTART\t600\n\n#define\tIPPORT_MAX\t\t65535\n\n/*\n * Definitions of bits in internet address integers.\n * On subnets, the decomposition of addresses to host and net parts\n * is done according to subnet mask, not the masks here.\n */\n#define\tIN_CLASSA(i)\t\t(((u_int32_t)(i) & 0x80000000) == 0)\n#define\tIN_CLASSA_NET\t\t0xff000000\n#define\tIN_CLASSA_NSHIFT\t24\n#define\tIN_CLASSA_HOST\t\t0x00ffffff\n#define\tIN_CLASSA_MAX\t\t128\n\n#define\tIN_CLASSB(i)\t\t(((u_int32_t)(i) & 0xc0000000) == 0x80000000)\n#define\tIN_CLASSB_NET\t\t0xffff0000\n#define\tIN_CLASSB_NSHIFT\t16\n#define\tIN_CLASSB_HOST\t\t0x0000ffff\n#define\tIN_CLASSB_MAX\t\t65536\n\n#define\tIN_CLASSC(i)\t\t(((u_int32_t)(i) & 0xe0000000) == 0xc0000000)\n#define\tIN_CLASSC_NET\t\t0xffffff00\n#define\tIN_CLASSC_NSHIFT\t8\n#define\tIN_CLASSC_HOST\t\t0x000000ff\n\n#define\tIN_CLASSD(i)\t\t(((u_int32_t)(i) & 0xf0000000) == 0xe0000000)\n#define\tIN_CLASSD_NET\t\t0xf0000000\t/* These ones aren't really */\n#define\tIN_CLASSD_NSHIFT\t28\t\t/* net and host fields, but */\n#define\tIN_CLASSD_HOST\t\t0x0fffffff\t/* routing needn't know.    */\n#define\tIN_MULTICAST(i)\t\tIN_CLASSD(i)\n\n#define\tIN_EXPERIMENTAL(i)\t(((u_int32_t)(i) & 0xf0000000) == 0xf0000000)\n#define\tIN_BADCLASS(i)\t\t(((u_int32_t)(i) & 0xf0000000) == 0xf0000000)\n\n#define IN_LINKLOCAL(i)\t\t(((u_int32_t)(i) & 0xffff0000) == 0xa9fe0000)\n#define IN_LOOPBACK(i)\t\t(((u_int32_t)(i) & 0xff000000) == 0x7f000000)\n#define IN_ZERONET(i)\t\t(((u_int32_t)(i) & 0xff000000) == 0)\n\n#define\tIN_PRIVATE(i)\t((((u_int32_t)(i) & 0xff000000) == 0x0a000000) || \\\n\t\t\t (((u_int32_t)(i) & 0xfff00000) == 0xac100000) || \\\n\t\t\t (((u_int32_t)(i) & 0xffff0000) == 0xc0a80000))\n\n#define\tIN_LOCAL_GROUP(i)\t(((u_int32_t)(i) & 0xffffff00) == 0xe0000000)\n \n#define\tIN_ANY_LOCAL(i)\t\t(IN_LINKLOCAL(i) || IN_LOCAL_GROUP(i))\n\n#define\tINADDR_LOOPBACK\t\t(u_int32_t)0x7f000001\n#ifndef _KERNEL\n#define\tINADDR_NONE\t\t0xffffffff\t\t/* -1 return */\n#endif\n\n#define\tINADDR_UNSPEC_GROUP\t(u_int32_t)0xe0000000\t/* 224.0.0.0 */\n#define\tINADDR_ALLHOSTS_GROUP\t(u_int32_t)0xe0000001\t/* 224.0.0.1 */\n#define\tINADDR_ALLRTRS_GROUP\t(u_int32_t)0xe0000002\t/* 224.0.0.2 */\n#define\tINADDR_ALLRPTS_GROUP\t(u_int32_t)0xe0000016\t/* 224.0.0.22, IGMPv3 */\n#define\tINADDR_CARP_GROUP\t(u_int32_t)0xe0000012\t/* 224.0.0.18 */\n#define\tINADDR_PFSYNC_GROUP\t(u_int32_t)0xe00000f0\t/* 224.0.0.240 */\n#define\tINADDR_ALLMDNS_GROUP\t(u_int32_t)0xe00000fb\t/* 224.0.0.251 */\n#define\tINADDR_MAX_LOCAL_GROUP\t(u_int32_t)0xe00000ff\t/* 224.0.0.255 */\n\n#define\tIN_LOOPBACKNET\t\t127\t\t\t/* official! */\n\n#define\tIN_RFC3021_MASK\t\t(u_int32_t)0xfffffffe\n\n/*\n * Options for use with [gs]etsockopt at the IP level.\n * First word of comment is data type; bool is stored in int.\n */\n#define\tIP_OPTIONS\t\t1    /* buf/ip_opts; set/get IP options */\n#define\tIP_HDRINCL\t\t2    /* int; header is included with data */\n#define\tIP_TOS\t\t\t3    /* int; IP type of service and preced. */\n#define\tIP_TTL\t\t\t4    /* int; IP time to live */\n#define\tIP_RECVOPTS\t\t5    /* bool; receive all IP opts w/dgram */\n#define\tIP_RECVRETOPTS\t\t6    /* bool; receive IP opts for response */\n#define\tIP_RECVDSTADDR\t\t7    /* bool; receive IP dst addr w/dgram */\n#define\tIP_SENDSRCADDR\t\tIP_RECVDSTADDR /* cmsg_type to set src addr */\n#define\tIP_RETOPTS\t\t8    /* ip_opts; set/get IP options */\n#define\tIP_MULTICAST_IF\t\t9    /* struct in_addr *or* struct ip_mreqn;\n\t\t\t\t      * set/get IP multicast i/f  */\n#define\tIP_MULTICAST_TTL\t10   /* u_char; set/get IP multicast ttl */\n#define\tIP_MULTICAST_LOOP\t11   /* u_char; set/get IP multicast loopback */\n#define\tIP_ADD_MEMBERSHIP\t12   /* ip_mreq; add an IP group membership */\n#define\tIP_DROP_MEMBERSHIP\t13   /* ip_mreq; drop an IP group membership */\n#define\tIP_MULTICAST_VIF\t14   /* set/get IP mcast virt. iface */\n#define\tIP_RSVP_ON\t\t15   /* enable RSVP in kernel */\n#define\tIP_RSVP_OFF\t\t16   /* disable RSVP in kernel */\n#define\tIP_RSVP_VIF_ON\t\t17   /* set RSVP per-vif socket */\n#define\tIP_RSVP_VIF_OFF\t\t18   /* unset RSVP per-vif socket */\n#define\tIP_PORTRANGE\t\t19   /* int; range to choose for unspec port */\n#define\tIP_RECVIF\t\t20   /* bool; receive reception if w/dgram */\n/* for IPSEC */\n#define\tIP_IPSEC_POLICY\t\t21   /* int; set/get security policy */\n#define\tIP_FAITH\t\t22   /* bool; accept FAITH'ed connections */\n\n#define\tIP_ONESBCAST\t\t23   /* bool: send all-ones broadcast */\n#define\tIP_BINDANY\t\t24   /* bool: allow bind to any address */\n\n/*\n * Options for controlling the firewall and dummynet.\n * Historical options (from 40 to 64) will eventually be\n * replaced by only two options, IP_FW3 and IP_DUMMYNET3.\n */\n#define\tIP_FW_TABLE_ADD\t\t40   /* add entry */\n#define\tIP_FW_TABLE_DEL\t\t41   /* delete entry */\n#define\tIP_FW_TABLE_FLUSH\t42   /* flush table */\n#define\tIP_FW_TABLE_GETSIZE\t43   /* get table size */\n#define\tIP_FW_TABLE_LIST\t44   /* list table contents */\n\n#define\tIP_FW3\t\t\t48   /* generic ipfw v.3 sockopts */\n#define\tIP_DUMMYNET3\t\t49   /* generic dummynet v.3 sockopts */\n\n#define\tIP_FW_ADD\t\t50   /* add a firewall rule to chain */\n#define\tIP_FW_DEL\t\t51   /* delete a firewall rule from chain */\n#define\tIP_FW_FLUSH\t\t52   /* flush firewall rule chain */\n#define\tIP_FW_ZERO\t\t53   /* clear single/all firewall counter(s) */\n#define\tIP_FW_GET\t\t54   /* get entire firewall rule chain */\n#define\tIP_FW_RESETLOG\t\t55   /* reset logging counters */\n\n#define IP_FW_NAT_CFG           56   /* add/config a nat rule */\n#define IP_FW_NAT_DEL           57   /* delete a nat rule */\n#define IP_FW_NAT_GET_CONFIG    58   /* get configuration of a nat rule */\n#define IP_FW_NAT_GET_LOG       59   /* get log of a nat rule */\n\n#define\tIP_DUMMYNET_CONFIGURE\t60   /* add/configure a dummynet pipe */\n#define\tIP_DUMMYNET_DEL\t\t61   /* delete a dummynet pipe from chain */\n#define\tIP_DUMMYNET_FLUSH\t62   /* flush dummynet */\n#define\tIP_DUMMYNET_GET\t\t64   /* get entire dummynet pipes */\n\n#define\tIP_RECVTTL\t\t65   /* bool; receive IP TTL w/dgram */\n#define\tIP_MINTTL\t\t66   /* minimum TTL for packet or drop */\n#define\tIP_DONTFRAG\t\t67   /* don't fragment packet */\n\n/* IPv4 Source Filter Multicast API [RFC3678] */\n#define\tIP_ADD_SOURCE_MEMBERSHIP\t70   /* join a source-specific group */\n#define\tIP_DROP_SOURCE_MEMBERSHIP\t71   /* drop a single source */\n#define\tIP_BLOCK_SOURCE\t\t\t72   /* block a source */\n#define\tIP_UNBLOCK_SOURCE\t\t73   /* unblock a source */\n\n/* The following option is private; do not use it from user applications. */\n#define\tIP_MSFILTER\t\t\t74   /* set/get filter list */\n\n/* Protocol Independent Multicast API [RFC3678] */\n#define\tMCAST_JOIN_GROUP\t\t80   /* join an any-source group */\n#define\tMCAST_LEAVE_GROUP\t\t81   /* leave all sources for group */\n#define\tMCAST_JOIN_SOURCE_GROUP\t\t82   /* join a source-specific group */\n#define\tMCAST_LEAVE_SOURCE_GROUP\t83   /* leave a single source */\n#define\tMCAST_BLOCK_SOURCE\t\t84   /* block a source */\n#define\tMCAST_UNBLOCK_SOURCE\t\t85   /* unblock a source */\n\n/*\n * Defaults and limits for options\n */\n#define\tIP_DEFAULT_MULTICAST_TTL  1\t/* normally limit m'casts to 1 hop  */\n#define\tIP_DEFAULT_MULTICAST_LOOP 1\t/* normally hear sends if a member  */\n\n/*\n * The imo_membership vector for each socket is now dynamically allocated at\n * run-time, bounded by USHRT_MAX, and is reallocated when needed, sized\n * according to a power-of-two increment.\n */\n#define\tIP_MIN_MEMBERSHIPS\t31\n#define\tIP_MAX_MEMBERSHIPS\t4095\n#define\tIP_MAX_SOURCE_FILTER\t1024\t/* XXX to be unused */\n\n/*\n * Default resource limits for IPv4 multicast source filtering.\n * These may be modified by sysctl.\n */\n#define\tIP_MAX_GROUP_SRC_FILTER\t\t512\t/* sources per group */\n#define\tIP_MAX_SOCK_SRC_FILTER\t\t128\t/* sources per socket/group */\n#define\tIP_MAX_SOCK_MUTE_FILTER\t\t128\t/* XXX no longer used */\n\n/*\n * Argument structure for IP_ADD_MEMBERSHIP and IP_DROP_MEMBERSHIP.\n */\nstruct ip_mreq {\n\tstruct\tin_addr imr_multiaddr;\t/* IP multicast address of group */\n\tstruct\tin_addr imr_interface;\t/* local IP address of interface */\n};\n\n/*\n * Modified argument structure for IP_MULTICAST_IF, obtained from Linux.\n * This is used to specify an interface index for multicast sends, as\n * the IPv4 legacy APIs do not support this (unless IP_SENDIF is available).\n */\nstruct ip_mreqn {\n\tstruct\tin_addr imr_multiaddr;\t/* IP multicast address of group */\n\tstruct\tin_addr imr_address;\t/* local IP address of interface */\n\tint\t\timr_ifindex;\t/* Interface index; cast to uint32_t */\n};\n\n/*\n * Argument structure for IPv4 Multicast Source Filter APIs. [RFC3678]\n */\nstruct ip_mreq_source {\n\tstruct\tin_addr imr_multiaddr;\t/* IP multicast address of group */\n\tstruct\tin_addr imr_sourceaddr;\t/* IP address of source */\n\tstruct\tin_addr imr_interface;\t/* local IP address of interface */\n};\n\n/*\n * Argument structures for Protocol-Independent Multicast Source\n * Filter APIs. [RFC3678]\n */\nstruct group_req {\n\tuint32_t\t\tgr_interface;\t/* interface index */\n\tstruct sockaddr_storage\tgr_group;\t/* group address */\n};\n\nstruct group_source_req {\n\tuint32_t\t\tgsr_interface;\t/* interface index */\n\tstruct sockaddr_storage\tgsr_group;\t/* group address */\n\tstruct sockaddr_storage\tgsr_source;\t/* source address */\n};\n\n#ifndef __MSFILTERREQ_DEFINED\n#define __MSFILTERREQ_DEFINED\n/*\n * The following structure is private; do not use it from user applications.\n * It is used to communicate IP_MSFILTER/IPV6_MSFILTER information between\n * the RFC 3678 libc functions and the kernel.\n */\nstruct __msfilterreq {\n\tuint32_t\t\t msfr_ifindex;\t/* interface index */\n\tuint32_t\t\t msfr_fmode;\t/* filter mode for group */\n\tuint32_t\t\t msfr_nsrcs;\t/* # of sources in msfr_srcs */\n\tstruct sockaddr_storage\t msfr_group;\t/* group address */\n\tstruct sockaddr_storage\t*msfr_srcs;\t/* pointer to the first member\n\t\t\t\t\t\t * of a contiguous array of\n\t\t\t\t\t\t * sources to filter in full.\n\t\t\t\t\t\t */\n};\n#endif\n\nstruct sockaddr;\n\n/*\n * Advanced (Full-state) APIs [RFC3678]\n * The RFC specifies uint_t for the 6th argument to [sg]etsourcefilter().\n * We use uint32_t here to be consistent.\n */\nint\tsetipv4sourcefilter(int, struct in_addr, struct in_addr, uint32_t,\n\t    uint32_t, struct in_addr *);\nint\tgetipv4sourcefilter(int, struct in_addr, struct in_addr, uint32_t *,\n\t    uint32_t *, struct in_addr *);\nint\tsetsourcefilter(int, uint32_t, struct sockaddr *, socklen_t,\n\t    uint32_t, uint32_t, struct sockaddr_storage *);\nint\tgetsourcefilter(int, uint32_t, struct sockaddr *, socklen_t,\n\t    uint32_t *, uint32_t *, struct sockaddr_storage *);\n\n/*\n * Filter modes; also used to represent per-socket filter mode internally.\n */\n#define\tMCAST_UNDEFINED\t0\t/* fmode: not yet defined */\n#define\tMCAST_INCLUDE\t1\t/* fmode: include these source(s) */\n#define\tMCAST_EXCLUDE\t2\t/* fmode: exclude these source(s) */\n\n/*\n * Argument for IP_PORTRANGE:\n * - which range to search when port is unspecified at bind() or connect()\n */\n#define\tIP_PORTRANGE_DEFAULT\t0\t/* default range */\n#define\tIP_PORTRANGE_HIGH\t1\t/* \"high\" - request firewall bypass */\n#define\tIP_PORTRANGE_LOW\t2\t/* \"low\" - vouchsafe security */\n\n/*\n * Definitions for inet sysctl operations.\n *\n * Third level is protocol number.\n * Fourth level is desired variable within that protocol.\n */\n#define\tIPPROTO_MAXID\t(IPPROTO_AH + 1)\t/* don't list to IPPROTO_MAX */\n\n#define\tCTL_IPPROTO_NAMES { \\\n\t{ \"ip\", CTLTYPE_NODE }, \\\n\t{ \"icmp\", CTLTYPE_NODE }, \\\n\t{ \"igmp\", CTLTYPE_NODE }, \\\n\t{ \"ggp\", CTLTYPE_NODE }, \\\n\t{ 0, 0 }, \\\n\t{ 0, 0 }, \\\n\t{ \"tcp\", CTLTYPE_NODE }, \\\n\t{ 0, 0 }, \\\n\t{ \"egp\", CTLTYPE_NODE }, \\\n\t{ 0, 0 }, \\\n\t{ 0, 0 }, \\\n\t{ 0, 0 }, \\\n\t{ \"pup\", CTLTYPE_NODE }, \\\n\t{ 0, 0 }, \\\n\t{ 0, 0 }, \\\n\t{ 0, 0 }, \\\n\t{ 0, 0 }, \\\n\t{ \"udp\", CTLTYPE_NODE }, \\\n\t{ 0, 0 }, \\\n\t{ 0, 0 }, \\\n\t{ 0, 0 }, \\\n\t{ 0, 0 }, \\\n\t{ \"idp\", CTLTYPE_NODE }, \\\n\t{ 0, 0 }, \\\n\t{ 0, 0 }, \\\n\t{ 0, 0 }, \\\n\t{ 0, 0 }, \\\n\t{ 0, 0 }, \\\n\t{ 0, 0 }, \\\n\t{ 0, 0 }, \\\n\t{ 0, 0 }, \\\n\t{ 0, 0 }, \\\n\t{ 0, 0 }, \\\n\t{ 0, 0 }, \\\n\t{ 0, 0 }, \\\n\t{ 0, 0 }, \\\n\t{ 0, 0 }, \\\n\t{ 0, 0 }, \\\n\t{ 0, 0 }, \\\n\t{ 0, 0 }, \\\n\t{ 0, 0 }, \\\n\t{ 0, 0 }, \\\n\t{ 0, 0 }, \\\n\t{ 0, 0 }, \\\n\t{ 0, 0 }, \\\n\t{ 0, 0 }, \\\n\t{ 0, 0 }, \\\n\t{ 0, 0 }, \\\n\t{ 0, 0 }, \\\n\t{ 0, 0 }, \\\n\t{ 0, 0 }, \\\n\t{ \"ipsec\", CTLTYPE_NODE }, \\\n\t{ 0, 0 }, \\\n\t{ 0, 0 }, \\\n\t{ 0, 0 }, \\\n\t{ 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \\\n\t{ 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \\\n\t{ 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \\\n\t{ 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \\\n\t{ 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \\\n\t{ 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \\\n\t{ 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \\\n\t{ 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \\\n\t{ 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \\\n\t{ 0, 0 }, \\\n\t{ 0, 0 }, \\\n\t{ 0, 0 }, \\\n\t{ \"pim\", CTLTYPE_NODE }, \\\n}\n\n/*\n * Names for IP sysctl objects\n */\n#define\tIPCTL_FORWARDING\t1\t/* act as router */\n#define\tIPCTL_SENDREDIRECTS\t2\t/* may send redirects when forwarding */\n#define\tIPCTL_DEFTTL\t\t3\t/* default TTL */\n#ifdef notyet\n#define\tIPCTL_DEFMTU\t\t4\t/* default MTU */\n#endif\n#define\tIPCTL_RTEXPIRE\t\t5\t/* cloned route expiration time */\n#define\tIPCTL_RTMINEXPIRE\t6\t/* min value for expiration time */\n#define\tIPCTL_RTMAXCACHE\t7\t/* trigger level for dynamic expire */\n#define\tIPCTL_SOURCEROUTE\t8\t/* may perform source routes */\n#define\tIPCTL_DIRECTEDBROADCAST\t9\t/* may re-broadcast received packets */\n#define\tIPCTL_INTRQMAXLEN\t10\t/* max length of netisr queue */\n#define\tIPCTL_INTRQDROPS\t11\t/* number of netisr q drops */\n#define\tIPCTL_STATS\t\t12\t/* ipstat structure */\n#define\tIPCTL_ACCEPTSOURCEROUTE\t13\t/* may accept source routed packets */\n#define\tIPCTL_FASTFORWARDING\t14\t/* use fast IP forwarding code */\n#define\tIPCTL_KEEPFAITH\t\t15\t/* FAITH IPv4->IPv6 translater ctl */\n#define\tIPCTL_GIF_TTL\t\t16\t/* default TTL for gif encap packet */\n#define\tIPCTL_MAXID\t\t17\n\n#define\tIPCTL_NAMES { \\\n\t{ 0, 0 }, \\\n\t{ \"forwarding\", CTLTYPE_INT }, \\\n\t{ \"redirect\", CTLTYPE_INT }, \\\n\t{ \"ttl\", CTLTYPE_INT }, \\\n\t{ \"mtu\", CTLTYPE_INT }, \\\n\t{ \"rtexpire\", CTLTYPE_INT }, \\\n\t{ \"rtminexpire\", CTLTYPE_INT }, \\\n\t{ \"rtmaxcache\", CTLTYPE_INT }, \\\n\t{ \"sourceroute\", CTLTYPE_INT }, \\\n\t{ \"directed-broadcast\", CTLTYPE_INT }, \\\n\t{ \"intr-queue-maxlen\", CTLTYPE_INT }, \\\n\t{ \"intr-queue-drops\", CTLTYPE_INT }, \\\n\t{ \"stats\", CTLTYPE_STRUCT }, \\\n\t{ \"accept_sourceroute\", CTLTYPE_INT }, \\\n\t{ \"fastforwarding\", CTLTYPE_INT }, \\\n}\n\n#endif /* __BSD_VISIBLE */\n\n#ifdef _KERNEL\n\nstruct ifnet; struct mbuf;\t/* forward declarations for Standard C */\n\nint\t in_broadcast(struct in_addr, struct ifnet *);\nint\t in_canforward(struct in_addr);\nint\t in_localaddr(struct in_addr);\nint\t in_localip(struct in_addr);\nint\t inet_aton(const char *, struct in_addr *); /* in libkern */\nchar\t*inet_ntoa(struct in_addr); /* in libkern */\nchar\t*inet_ntoa_r(struct in_addr ina, char *buf); /* in libkern */\nchar\t*inet_ntop(int, const void *, char *, socklen_t); /* in libkern */\nint\t inet_pton(int af, const char *, void *); /* in libkern */\nvoid\t in_ifdetach(struct ifnet *);\n\n#define\tin_hosteq(s, t)\t((s).s_addr == (t).s_addr)\n#define\tin_nullhost(x)\t((x).s_addr == INADDR_ANY)\n#define\tin_allhosts(x)\t((x).s_addr == htonl(INADDR_ALLHOSTS_GROUP))\n\n#define\tsatosin(sa)\t((struct sockaddr_in *)(sa))\n#define\tsintosa(sin)\t((struct sockaddr *)(sin))\n#define\tifatoia(ifa)\t((struct in_ifaddr *)(ifa))\n\n/*\n * Historically, BSD keeps ip_len and ip_off in host format\n * when doing layer 3 processing, and this often requires\n * to translate the format back and forth.\n * To make the process explicit, we define a couple of macros\n * that also take into account the fact that at some point\n * we may want to keep those fields always in net format.\n */\n\n#if (BYTE_ORDER == BIG_ENDIAN) || defined(HAVE_NET_IPLEN)\n#define SET_NET_IPLEN(p)\tdo {} while (0)\n#define SET_HOST_IPLEN(p)\tdo {} while (0)\n#else\n#define SET_NET_IPLEN(p)\tdo {\t\t\\\n\tstruct ip *h_ip = (p);\t\t\t\\\n\th_ip->ip_len = htons(h_ip->ip_len);\t\\\n\th_ip->ip_off = htons(h_ip->ip_off);\t\\\n\t} while (0)\n\n#define SET_HOST_IPLEN(p)\tdo {\t\t\\\n\tstruct ip *h_ip = (p);\t\t\t\\\n\th_ip->ip_len = ntohs(h_ip->ip_len);\t\\\n\th_ip->ip_off = ntohs(h_ip->ip_off);\t\\\n\t} while (0)\n#endif /* !HAVE_NET_IPLEN */\n\n#endif /* _KERNEL */\n\n/* INET6 stuff */\n#if __POSIX_VISIBLE >= 200112\n#define\t__KAME_NETINET_IN_H_INCLUDED_\n#include <netinet6/in6.h>\n#undef __KAME_NETINET_IN_H_INCLUDED_\n#endif\n\n#endif /* !_NETINET_IN_H_*/\n"
  },
  {
    "path": "freebsd-headers/netinet/in_gif.h",
    "content": "/*\t$FreeBSD: release/9.0.0/sys/netinet/in_gif.h 139823 2005-01-07 01:45:51Z imp $\t*/\n/*\t$KAME: in_gif.h,v 1.5 2000/04/14 08:36:02 itojun Exp $\t*/\n\n/*-\n * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. Neither the name of the project nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n */\n\n#ifndef _NETINET_IN_GIF_H_\n#define _NETINET_IN_GIF_H_\n\n#define GIF_TTL\t\t30\n\nstruct gif_softc;\nvoid in_gif_input(struct mbuf *, int);\nint in_gif_output(struct ifnet *, int, struct mbuf *);\nint gif_encapcheck4(const struct mbuf *, int, int, void *);\nint in_gif_attach(struct gif_softc *);\nint in_gif_detach(struct gif_softc *);\n\n#endif /*_NETINET_IN_GIF_H_*/\n"
  },
  {
    "path": "freebsd-headers/netinet/in_pcb.h",
    "content": "/*-\n * Copyright (c) 1982, 1986, 1990, 1993\n *\tThe Regents of the University of California.\n * Copyright (c) 2010-2011 Juniper Networks, Inc.\n * All rights reserved.\n *\n * Portions of this software were developed by Robert N. M. Watson under\n * contract to Juniper Networks, Inc.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 4. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t@(#)in_pcb.h\t8.1 (Berkeley) 6/10/93\n * $FreeBSD: release/9.0.0/sys/netinet/in_pcb.h 227428 2011-11-10 20:28:30Z trociny $\n */\n\n#ifndef _NETINET_IN_PCB_H_\n#define _NETINET_IN_PCB_H_\n\n#include <sys/queue.h>\n#include <sys/_lock.h>\n#include <sys/_mutex.h>\n#include <sys/_rwlock.h>\n\n#ifdef _KERNEL\n#include <sys/lock.h>\n#include <sys/rwlock.h>\n#include <net/vnet.h>\n#include <vm/uma.h>\n#endif\n\n#define\tin6pcb\t\tinpcb\t/* for KAME src sync over BSD*'s */\n#define\tin6p_sp\t\tinp_sp\t/* for KAME src sync over BSD*'s */\nstruct inpcbpolicy;\n\n/*\n * struct inpcb is the common protocol control block structure used in most\n * IP transport protocols.\n *\n * Pointers to local and foreign host table entries, local and foreign socket\n * numbers, and pointers up (to a socket structure) and down (to a\n * protocol-specific control block) are stored here.\n */\nLIST_HEAD(inpcbhead, inpcb);\nLIST_HEAD(inpcbporthead, inpcbport);\ntypedef\tu_quad_t\tinp_gen_t;\n\n/*\n * PCB with AF_INET6 null bind'ed laddr can receive AF_INET input packet.\n * So, AF_INET6 null laddr is also used as AF_INET null laddr, by utilizing\n * the following structure.\n */\nstruct in_addr_4in6 {\n\tu_int32_t\tia46_pad32[3];\n\tstruct\tin_addr\tia46_addr4;\n};\n\n/*\n * NOTE: ipv6 addrs should be 64-bit aligned, per RFC 2553.  in_conninfo has\n * some extra padding to accomplish this.\n */\nstruct in_endpoints {\n\tu_int16_t\tie_fport;\t\t/* foreign port */\n\tu_int16_t\tie_lport;\t\t/* local port */\n\t/* protocol dependent part, local and foreign addr */\n\tunion {\n\t\t/* foreign host table entry */\n\t\tstruct\tin_addr_4in6 ie46_foreign;\n\t\tstruct\tin6_addr ie6_foreign;\n\t} ie_dependfaddr;\n\tunion {\n\t\t/* local host table entry */\n\t\tstruct\tin_addr_4in6 ie46_local;\n\t\tstruct\tin6_addr ie6_local;\n\t} ie_dependladdr;\n};\n#define\tie_faddr\tie_dependfaddr.ie46_foreign.ia46_addr4\n#define\tie_laddr\tie_dependladdr.ie46_local.ia46_addr4\n#define\tie6_faddr\tie_dependfaddr.ie6_foreign\n#define\tie6_laddr\tie_dependladdr.ie6_local\n\n/*\n * XXX The defines for inc_* are hacks and should be changed to direct\n * references.\n */\nstruct in_conninfo {\n\tu_int8_t\tinc_flags;\n\tu_int8_t\tinc_len;\n\tu_int16_t\tinc_fibnum;\t/* XXX was pad, 16 bits is plenty */\n\t/* protocol dependent part */\n\tstruct\tin_endpoints inc_ie;\n};\n\n/*\n * Flags for inc_flags.\n */\n#define\tINC_ISIPV6\t0x01\n\n#define inc_isipv6\tinc_flags\t/* temp compatability */\n#define\tinc_fport\tinc_ie.ie_fport\n#define\tinc_lport\tinc_ie.ie_lport\n#define\tinc_faddr\tinc_ie.ie_faddr\n#define\tinc_laddr\tinc_ie.ie_laddr\n#define\tinc6_faddr\tinc_ie.ie6_faddr\n#define\tinc6_laddr\tinc_ie.ie6_laddr\n\nstruct\ticmp6_filter;\n\n/*-\n * struct inpcb captures the network layer state for TCP, UDP, and raw IPv4\n * and IPv6 sockets.  In the case of TCP, further per-connection state is\n * hung off of inp_ppcb most of the time.  Almost all fields of struct inpcb\n * are static after creation or protected by a per-inpcb rwlock, inp_lock.  A\n * few fields also require the global pcbinfo lock for the inpcb to be held,\n * when modified, such as the global connection lists and hashes, as well as\n * binding information (which affects which hash a connection is on).  This\n * model means that connections can be looked up without holding the\n * per-connection lock, which is important for performance when attempting to\n * find the connection for a packet given its IP and port tuple.  Writing to\n * these fields that write locks be held on both the inpcb and global locks.\n *\n * Key:\n * (c) - Constant after initialization\n * (g) - Protected by the pcbgroup lock\n * (i) - Protected by the inpcb lock\n * (p) - Protected by the pcbinfo lock for the inpcb\n * (s) - Protected by another subsystem's locks\n * (x) - Undefined locking\n *\n * A few other notes:\n *\n * When a read lock is held, stability of the field is guaranteed; to write\n * to a field, a write lock must generally be held.\n *\n * netinet/netinet6-layer code should not assume that the inp_socket pointer\n * is safe to dereference without inp_lock being held, even for protocols\n * other than TCP (where the inpcb persists during TIMEWAIT even after the\n * socket has been freed), or there may be close(2)-related races.\n *\n * The inp_vflag field is overloaded, and would otherwise ideally be (c).\n */\nstruct inpcb {\n\tLIST_ENTRY(inpcb) inp_hash;\t/* (i/p) hash list */\n\tLIST_ENTRY(inpcb) inp_pcbgrouphash;\t/* (g/i) hash list */\n\tLIST_ENTRY(inpcb) inp_list;\t/* (i/p) list for all PCBs for proto */\n\tvoid\t*inp_ppcb;\t\t/* (i) pointer to per-protocol pcb */\n\tstruct\tinpcbinfo *inp_pcbinfo;\t/* (c) PCB list info */\n\tstruct\tinpcbgroup *inp_pcbgroup; /* (g/i) PCB group list */\n\tLIST_ENTRY(inpcb) inp_pcbgroup_wild; /* (g/i/p) group wildcard entry */\n\tstruct\tsocket *inp_socket;\t/* (i) back pointer to socket */\n\tstruct\tucred\t*inp_cred;\t/* (c) cache of socket cred */\n\tu_int32_t inp_flow;\t\t/* (i) IPv6 flow information */\n\tint\tinp_flags;\t\t/* (i) generic IP/datagram flags */\n\tint\tinp_flags2;\t\t/* (i) generic IP/datagram flags #2*/\n\tu_char\tinp_vflag;\t\t/* (i) IP version flag (v4/v6) */\n\tu_char\tinp_ip_ttl;\t\t/* (i) time to live proto */\n\tu_char\tinp_ip_p;\t\t/* (c) protocol proto */\n\tu_char\tinp_ip_minttl;\t\t/* (i) minimum TTL or drop */\n\tuint32_t inp_flowid;\t\t/* (x) flow id / queue id */\n\tu_int\tinp_refcount;\t\t/* (i) refcount */\n\tvoid\t*inp_pspare[5];\t\t/* (x) route caching / general use */\n\tu_int\tinp_ispare[6];\t\t/* (x) route caching / user cookie /\n\t\t\t\t\t *     general use */\n\n\t/* Local and foreign ports, local and foreign addr. */\n\tstruct\tin_conninfo inp_inc;\t/* (i/p) list for PCB's local port */\n\n\t/* MAC and IPSEC policy information. */\n\tstruct\tlabel *inp_label;\t/* (i) MAC label */\n\tstruct\tinpcbpolicy *inp_sp;    /* (s) for IPSEC */\n\n\t/* Protocol-dependent part; options. */\n\tstruct {\n\t\tu_char\tinp4_ip_tos;\t\t/* (i) type of service proto */\n\t\tstruct\tmbuf *inp4_options;\t/* (i) IP options */\n\t\tstruct\tip_moptions *inp4_moptions; /* (i) IP mcast options */\n\t} inp_depend4;\n\tstruct {\n\t\t/* (i) IP options */\n\t\tstruct\tmbuf *inp6_options;\n\t\t/* (i) IP6 options for outgoing packets */\n\t\tstruct\tip6_pktopts *inp6_outputopts;\n\t\t/* (i) IP multicast options */\n\t\tstruct\tip6_moptions *inp6_moptions;\n\t\t/* (i) ICMPv6 code type filter */\n\t\tstruct\ticmp6_filter *inp6_icmp6filt;\n\t\t/* (i) IPV6_CHECKSUM setsockopt */\n\t\tint\tinp6_cksum;\n\t\tshort\tinp6_hops;\n\t} inp_depend6;\n\tLIST_ENTRY(inpcb) inp_portlist;\t/* (i/p) */\n\tstruct\tinpcbport *inp_phd;\t/* (i/p) head of this list */\n#define inp_zero_size offsetof(struct inpcb, inp_gencnt)\n\tinp_gen_t\tinp_gencnt;\t/* (c) generation count */\n\tstruct llentry\t*inp_lle;\t/* cached L2 information */\n\tstruct rtentry\t*inp_rt;\t/* cached L3 information */\n\tstruct rwlock\tinp_lock;\n};\n#define\tinp_fport\tinp_inc.inc_fport\n#define\tinp_lport\tinp_inc.inc_lport\n#define\tinp_faddr\tinp_inc.inc_faddr\n#define\tinp_laddr\tinp_inc.inc_laddr\n#define\tinp_ip_tos\tinp_depend4.inp4_ip_tos\n#define\tinp_options\tinp_depend4.inp4_options\n#define\tinp_moptions\tinp_depend4.inp4_moptions\n\n#define\tin6p_faddr\tinp_inc.inc6_faddr\n#define\tin6p_laddr\tinp_inc.inc6_laddr\n#define\tin6p_hops\tinp_depend6.inp6_hops\t/* default hop limit */\n#define\tin6p_flowinfo\tinp_flow\n#define\tin6p_options\tinp_depend6.inp6_options\n#define\tin6p_outputopts\tinp_depend6.inp6_outputopts\n#define\tin6p_moptions\tinp_depend6.inp6_moptions\n#define\tin6p_icmp6filt\tinp_depend6.inp6_icmp6filt\n#define\tin6p_cksum\tinp_depend6.inp6_cksum\n\n#define\tinp_vnet\tinp_pcbinfo->ipi_vnet\n\n/*\n * The range of the generation count, as used in this implementation, is 9e19.\n * We would have to create 300 billion connections per second for this number\n * to roll over in a year.  This seems sufficiently unlikely that we simply\n * don't concern ourselves with that possibility.\n */\n\n/*\n * Interface exported to userland by various protocols which use inpcbs.  Hack\n * alert -- only define if struct xsocket is in scope.\n */\n#ifdef _SYS_SOCKETVAR_H_\nstruct\txinpcb {\n\tsize_t\txi_len;\t\t/* length of this structure */\n\tstruct\tinpcb xi_inp;\n\tstruct\txsocket xi_socket;\n\tu_quad_t\txi_alignment_hack;\n};\n\nstruct\txinpgen {\n\tsize_t\txig_len;\t/* length of this structure */\n\tu_int\txig_count;\t/* number of PCBs at this time */\n\tinp_gen_t xig_gen;\t/* generation count at this time */\n\tso_gen_t xig_sogen;\t/* socket generation count at this time */\n};\n#endif /* _SYS_SOCKETVAR_H_ */\n\nstruct inpcbport {\n\tLIST_ENTRY(inpcbport) phd_hash;\n\tstruct inpcbhead phd_pcblist;\n\tu_short phd_port;\n};\n\n/*-\n * Global data structure for each high-level protocol (UDP, TCP, ...) in both\n * IPv4 and IPv6.  Holds inpcb lists and information for managing them.\n *\n * Each pcbinfo is protected by two locks: ipi_lock and ipi_hash_lock,\n * the former covering mutable global fields (such as the global pcb list),\n * and the latter covering the hashed lookup tables.  The lock order is:\n *\n *    ipi_lock (before) inpcb locks (before) {ipi_hash_lock, pcbgroup locks}\n *\n * Locking key:\n *\n * (c) Constant or nearly constant after initialisation\n * (g) Locked by ipi_lock\n * (h) Read using either ipi_hash_lock or inpcb lock; write requires both\n * (p) Protected by one or more pcbgroup locks\n * (x) Synchronisation properties poorly defined\n */\nstruct inpcbinfo {\n\t/*\n\t * Global lock protecting global inpcb list, inpcb count, etc.\n\t */\n\tstruct rwlock\t\t ipi_lock;\n\n\t/*\n\t * Global list of inpcbs on the protocol.\n\t */\n\tstruct inpcbhead\t*ipi_listhead;\t\t/* (g) */\n\tu_int\t\t\t ipi_count;\t\t/* (g) */\n\n\t/*\n\t * Generation count -- incremented each time a connection is allocated\n\t * or freed.\n\t */\n\tu_quad_t\t\t ipi_gencnt;\t\t/* (g) */\n\n\t/*\n\t * Fields associated with port lookup and allocation.\n\t */\n\tu_short\t\t\t ipi_lastport;\t\t/* (x) */\n\tu_short\t\t\t ipi_lastlow;\t\t/* (x) */\n\tu_short\t\t\t ipi_lasthi;\t\t/* (x) */\n\n\t/*\n\t * UMA zone from which inpcbs are allocated for this protocol.\n\t */\n\tstruct\tuma_zone\t*ipi_zone;\t\t/* (c) */\n\n\t/*\n\t * Connection groups associated with this protocol.  These fields are\n\t * constant, but pcbgroup structures themselves are protected by\n\t * per-pcbgroup locks.\n\t */\n\tstruct inpcbgroup\t*ipi_pcbgroups;\t\t/* (c) */\n\tu_int\t\t\t ipi_npcbgroups;\t/* (c) */\n\tu_int\t\t\t ipi_hashfields;\t/* (c) */\n\n\t/*\n\t * Global lock protecting non-pcbgroup hash lookup tables.\n\t */\n\tstruct rwlock\t\t ipi_hash_lock;\n\n\t/*\n\t * Global hash of inpcbs, hashed by local and foreign addresses and\n\t * port numbers.\n\t */\n\tstruct inpcbhead\t*ipi_hashbase;\t\t/* (h) */\n\tu_long\t\t\t ipi_hashmask;\t\t/* (h) */\n\n\t/*\n\t * Global hash of inpcbs, hashed by only local port number.\n\t */\n\tstruct inpcbporthead\t*ipi_porthashbase;\t/* (h) */\n\tu_long\t\t\t ipi_porthashmask;\t/* (h) */\n\n\t/*\n\t * List of wildcard inpcbs for use with pcbgroups.  In the past, was\n\t * per-pcbgroup but is now global.  All pcbgroup locks must be held\n\t * to modify the list, so any is sufficient to read it.\n\t */\n\tstruct inpcbhead\t*ipi_wildbase;\t\t/* (p) */\n\tu_long\t\t\t ipi_wildmask;\t\t/* (p) */\n\n\t/*\n\t * Pointer to network stack instance\n\t */\n\tstruct vnet\t\t*ipi_vnet;\t\t/* (c) */\n\n\t/*\n\t * general use 2\n\t */\n\tvoid \t\t\t*ipi_pspare[2];\n};\n\n/*\n * Connection groups hold sets of connections that have similar CPU/thread\n * affinity.  Each connection belongs to exactly one connection group.\n */\nstruct inpcbgroup {\n\t/*\n\t * Per-connection group hash of inpcbs, hashed by local and foreign\n\t * addresses and port numbers.\n\t */\n\tstruct inpcbhead\t*ipg_hashbase;\t\t/* (c) */\n\tu_long\t\t\t ipg_hashmask;\t\t/* (c) */\n\n\t/*\n\t * Notional affinity of this pcbgroup.\n\t */\n\tu_int\t\t\t ipg_cpu;\t\t/* (p) */\n\n\t/*\n\t * Per-connection group lock, not to be confused with ipi_lock.\n\t * Protects the hash table hung off the group, but also the global\n\t * wildcard list in inpcbinfo.\n\t */\n\tstruct mtx\t\t ipg_lock;\n} __aligned(CACHE_LINE_SIZE);\n\n#define INP_LOCK_INIT(inp, d, t) \\\n\trw_init_flags(&(inp)->inp_lock, (t), RW_RECURSE |  RW_DUPOK)\n#define INP_LOCK_DESTROY(inp)\trw_destroy(&(inp)->inp_lock)\n#define INP_RLOCK(inp)\t\trw_rlock(&(inp)->inp_lock)\n#define INP_WLOCK(inp)\t\trw_wlock(&(inp)->inp_lock)\n#define INP_TRY_RLOCK(inp)\trw_try_rlock(&(inp)->inp_lock)\n#define INP_TRY_WLOCK(inp)\trw_try_wlock(&(inp)->inp_lock)\n#define INP_RUNLOCK(inp)\trw_runlock(&(inp)->inp_lock)\n#define INP_WUNLOCK(inp)\trw_wunlock(&(inp)->inp_lock)\n#define\tINP_TRY_UPGRADE(inp)\trw_try_upgrade(&(inp)->inp_lock)\n#define\tINP_DOWNGRADE(inp)\trw_downgrade(&(inp)->inp_lock)\n#define\tINP_WLOCKED(inp)\trw_wowned(&(inp)->inp_lock)\n#define\tINP_LOCK_ASSERT(inp)\trw_assert(&(inp)->inp_lock, RA_LOCKED)\n#define\tINP_RLOCK_ASSERT(inp)\trw_assert(&(inp)->inp_lock, RA_RLOCKED)\n#define\tINP_WLOCK_ASSERT(inp)\trw_assert(&(inp)->inp_lock, RA_WLOCKED)\n#define\tINP_UNLOCK_ASSERT(inp)\trw_assert(&(inp)->inp_lock, RA_UNLOCKED)\n\n#ifdef _KERNEL\n/*\n * These locking functions are for inpcb consumers outside of sys/netinet,\n * more specifically, they were added for the benefit of TOE drivers. The\n * macros are reserved for use by the stack.\n */\nvoid inp_wlock(struct inpcb *);\nvoid inp_wunlock(struct inpcb *);\nvoid inp_rlock(struct inpcb *);\nvoid inp_runlock(struct inpcb *);\n\n#ifdef INVARIANTS\nvoid inp_lock_assert(struct inpcb *);\nvoid inp_unlock_assert(struct inpcb *);\n#else\nstatic __inline void\ninp_lock_assert(struct inpcb *inp __unused)\n{\n}\n\nstatic __inline void\ninp_unlock_assert(struct inpcb *inp __unused)\n{\n}\n\n#endif\n\nvoid\tinp_apply_all(void (*func)(struct inpcb *, void *), void *arg);\nint \tinp_ip_tos_get(const struct inpcb *inp);\nvoid \tinp_ip_tos_set(struct inpcb *inp, int val);\nstruct socket *\n\tinp_inpcbtosocket(struct inpcb *inp);\nstruct tcpcb *\n\tinp_inpcbtotcpcb(struct inpcb *inp);\nvoid \tinp_4tuple_get(struct inpcb *inp, uint32_t *laddr, uint16_t *lp,\n\t\tuint32_t *faddr, uint16_t *fp);\n\n#endif /* _KERNEL */\n\n#define INP_INFO_LOCK_INIT(ipi, d) \\\n\trw_init_flags(&(ipi)->ipi_lock, (d), RW_RECURSE)\n#define INP_INFO_LOCK_DESTROY(ipi)  rw_destroy(&(ipi)->ipi_lock)\n#define INP_INFO_RLOCK(ipi)\trw_rlock(&(ipi)->ipi_lock)\n#define INP_INFO_WLOCK(ipi)\trw_wlock(&(ipi)->ipi_lock)\n#define INP_INFO_TRY_RLOCK(ipi)\trw_try_rlock(&(ipi)->ipi_lock)\n#define INP_INFO_TRY_WLOCK(ipi)\trw_try_wlock(&(ipi)->ipi_lock)\n#define INP_INFO_TRY_UPGRADE(ipi)\trw_try_upgrade(&(ipi)->ipi_lock)\n#define INP_INFO_RUNLOCK(ipi)\trw_runlock(&(ipi)->ipi_lock)\n#define INP_INFO_WUNLOCK(ipi)\trw_wunlock(&(ipi)->ipi_lock)\n#define\tINP_INFO_LOCK_ASSERT(ipi)\trw_assert(&(ipi)->ipi_lock, RA_LOCKED)\n#define INP_INFO_RLOCK_ASSERT(ipi)\trw_assert(&(ipi)->ipi_lock, RA_RLOCKED)\n#define INP_INFO_WLOCK_ASSERT(ipi)\trw_assert(&(ipi)->ipi_lock, RA_WLOCKED)\n#define INP_INFO_UNLOCK_ASSERT(ipi)\trw_assert(&(ipi)->ipi_lock, RA_UNLOCKED)\n\n#define\tINP_HASH_LOCK_INIT(ipi, d) \\\n\trw_init_flags(&(ipi)->ipi_hash_lock, (d), 0)\n#define\tINP_HASH_LOCK_DESTROY(ipi)\trw_destroy(&(ipi)->ipi_hash_lock)\n#define\tINP_HASH_RLOCK(ipi)\t\trw_rlock(&(ipi)->ipi_hash_lock)\n#define\tINP_HASH_WLOCK(ipi)\t\trw_wlock(&(ipi)->ipi_hash_lock)\n#define\tINP_HASH_RUNLOCK(ipi)\t\trw_runlock(&(ipi)->ipi_hash_lock)\n#define\tINP_HASH_WUNLOCK(ipi)\t\trw_wunlock(&(ipi)->ipi_hash_lock)\n#define\tINP_HASH_LOCK_ASSERT(ipi)\trw_assert(&(ipi)->ipi_hash_lock, \\\n\t\t\t\t\t    RA_LOCKED)\n#define\tINP_HASH_WLOCK_ASSERT(ipi)\trw_assert(&(ipi)->ipi_hash_lock, \\\n\t\t\t\t\t    RA_WLOCKED)\n\n#define\tINP_GROUP_LOCK_INIT(ipg, d)\tmtx_init(&(ipg)->ipg_lock, (d), NULL, \\\n\t\t\t\t\t    MTX_DEF | MTX_DUPOK)\n#define\tINP_GROUP_LOCK_DESTROY(ipg)\tmtx_destroy(&(ipg)->ipg_lock)\n\n#define\tINP_GROUP_LOCK(ipg)\t\tmtx_lock(&(ipg)->ipg_lock)\n#define\tINP_GROUP_LOCK_ASSERT(ipg)\tmtx_assert(&(ipg)->ipg_lock, MA_OWNED)\n#define\tINP_GROUP_UNLOCK(ipg)\t\tmtx_unlock(&(ipg)->ipg_lock)\n\n#define INP_PCBHASH(faddr, lport, fport, mask) \\\n\t(((faddr) ^ ((faddr) >> 16) ^ ntohs((lport) ^ (fport))) & (mask))\n#define INP_PCBPORTHASH(lport, mask) \\\n\t(ntohs((lport)) & (mask))\n\n/*\n * Flags for inp_vflags -- historically version flags only\n */\n#define\tINP_IPV4\t0x1\n#define\tINP_IPV6\t0x2\n#define\tINP_IPV6PROTO\t0x4\t\t/* opened under IPv6 protocol */\n\n/*\n * Flags for inp_flags.\n */\n#define\tINP_RECVOPTS\t\t0x00000001 /* receive incoming IP options */\n#define\tINP_RECVRETOPTS\t\t0x00000002 /* receive IP options for reply */\n#define\tINP_RECVDSTADDR\t\t0x00000004 /* receive IP dst address */\n#define\tINP_HDRINCL\t\t0x00000008 /* user supplies entire IP header */\n#define\tINP_HIGHPORT\t\t0x00000010 /* user wants \"high\" port binding */\n#define\tINP_LOWPORT\t\t0x00000020 /* user wants \"low\" port binding */\n#define\tINP_ANONPORT\t\t0x00000040 /* port chosen for user */\n#define\tINP_RECVIF\t\t0x00000080 /* receive incoming interface */\n#define\tINP_MTUDISC\t\t0x00000100 /* user can do MTU discovery */\n#define\tINP_FAITH\t\t0x00000200 /* accept FAITH'ed connections */\n#define\tINP_RECVTTL\t\t0x00000400 /* receive incoming IP TTL */\n#define\tINP_DONTFRAG\t\t0x00000800 /* don't fragment packet */\n#define\tINP_BINDANY\t\t0x00001000 /* allow bind to any address */\n#define\tINP_INHASHLIST\t\t0x00002000 /* in_pcbinshash() has been called */\n#define\tIN6P_IPV6_V6ONLY\t0x00008000 /* restrict AF_INET6 socket for v6 */\n#define\tIN6P_PKTINFO\t\t0x00010000 /* receive IP6 dst and I/F */\n#define\tIN6P_HOPLIMIT\t\t0x00020000 /* receive hoplimit */\n#define\tIN6P_HOPOPTS\t\t0x00040000 /* receive hop-by-hop options */\n#define\tIN6P_DSTOPTS\t\t0x00080000 /* receive dst options after rthdr */\n#define\tIN6P_RTHDR\t\t0x00100000 /* receive routing header */\n#define\tIN6P_RTHDRDSTOPTS\t0x00200000 /* receive dstoptions before rthdr */\n#define\tIN6P_TCLASS\t\t0x00400000 /* receive traffic class value */\n#define\tIN6P_AUTOFLOWLABEL\t0x00800000 /* attach flowlabel automatically */\n#define\tINP_TIMEWAIT\t\t0x01000000 /* in TIMEWAIT, ppcb is tcptw */\n#define\tINP_ONESBCAST\t\t0x02000000 /* send all-ones broadcast */\n#define\tINP_DROPPED\t\t0x04000000 /* protocol drop flag */\n#define\tINP_SOCKREF\t\t0x08000000 /* strong socket reference */\n#define\tINP_SW_FLOWID           0x10000000 /* software generated flow id */\n#define\tINP_HW_FLOWID           0x20000000 /* hardware generated flow id */\n#define\tIN6P_RFC2292\t\t0x40000000 /* used RFC2292 API on the socket */\n#define\tIN6P_MTU\t\t0x80000000 /* receive path MTU */\n\n#define\tINP_CONTROLOPTS\t\t(INP_RECVOPTS|INP_RECVRETOPTS|INP_RECVDSTADDR|\\\n\t\t\t\t INP_RECVIF|INP_RECVTTL|\\\n\t\t\t\t IN6P_PKTINFO|IN6P_HOPLIMIT|IN6P_HOPOPTS|\\\n\t\t\t\t IN6P_DSTOPTS|IN6P_RTHDR|IN6P_RTHDRDSTOPTS|\\\n\t\t\t\t IN6P_TCLASS|IN6P_AUTOFLOWLABEL|IN6P_RFC2292|\\\n\t\t\t\t IN6P_MTU)\n\n/*\n * Flags for inp_flags2.\n */\n#define\tINP_LLE_VALID\t\t0x00000001 /* cached lle is valid */\t\n#define\tINP_RT_VALID\t\t0x00000002 /* cached rtentry is valid */\n#define\tINP_PCBGROUPWILD\t0x00000004 /* in pcbgroup wildcard list */\n#define\tINP_REUSEPORT\t\t0x00000008 /* SO_REUSEPORT option is set */\n\n/*\n * Flags passed to in_pcblookup*() functions.\n */\n#define\tINPLOOKUP_WILDCARD\t0x00000001\t/* Allow wildcard sockets. */\n#define\tINPLOOKUP_RLOCKPCB\t0x00000002\t/* Return inpcb read-locked. */\n#define\tINPLOOKUP_WLOCKPCB\t0x00000004\t/* Return inpcb write-locked. */\n\n#define\tINPLOOKUP_MASK\t(INPLOOKUP_WILDCARD | INPLOOKUP_RLOCKPCB | \\\n\t\t\t    INPLOOKUP_WLOCKPCB)\n\n#define\tsotoinpcb(so)\t((struct inpcb *)(so)->so_pcb)\n#define\tsotoin6pcb(so)\tsotoinpcb(so) /* for KAME src sync over BSD*'s */\n\n#define\tINP_SOCKAF(so) so->so_proto->pr_domain->dom_family\n\n#define\tINP_CHECK_SOCKAF(so, af)\t(INP_SOCKAF(so) == af)\n\n/*\n * Constants for pcbinfo.ipi_hashfields.\n */\n#define\tIPI_HASHFIELDS_NONE\t0\n#define\tIPI_HASHFIELDS_2TUPLE\t1\n#define\tIPI_HASHFIELDS_4TUPLE\t2\n\n#ifdef _KERNEL\nVNET_DECLARE(int, ipport_reservedhigh);\nVNET_DECLARE(int, ipport_reservedlow);\nVNET_DECLARE(int, ipport_lowfirstauto);\nVNET_DECLARE(int, ipport_lowlastauto);\nVNET_DECLARE(int, ipport_firstauto);\nVNET_DECLARE(int, ipport_lastauto);\nVNET_DECLARE(int, ipport_hifirstauto);\nVNET_DECLARE(int, ipport_hilastauto);\nVNET_DECLARE(int, ipport_randomized);\nVNET_DECLARE(int, ipport_randomcps);\nVNET_DECLARE(int, ipport_randomtime);\nVNET_DECLARE(int, ipport_stoprandom);\nVNET_DECLARE(int, ipport_tcpallocs);\n\n#define\tV_ipport_reservedhigh\tVNET(ipport_reservedhigh)\n#define\tV_ipport_reservedlow\tVNET(ipport_reservedlow)\n#define\tV_ipport_lowfirstauto\tVNET(ipport_lowfirstauto)\n#define\tV_ipport_lowlastauto\tVNET(ipport_lowlastauto)\n#define\tV_ipport_firstauto\tVNET(ipport_firstauto)\n#define\tV_ipport_lastauto\tVNET(ipport_lastauto)\n#define\tV_ipport_hifirstauto\tVNET(ipport_hifirstauto)\n#define\tV_ipport_hilastauto\tVNET(ipport_hilastauto)\n#define\tV_ipport_randomized\tVNET(ipport_randomized)\n#define\tV_ipport_randomcps\tVNET(ipport_randomcps)\n#define\tV_ipport_randomtime\tVNET(ipport_randomtime)\n#define\tV_ipport_stoprandom\tVNET(ipport_stoprandom)\n#define\tV_ipport_tcpallocs\tVNET(ipport_tcpallocs)\n\nvoid\tin_pcbinfo_destroy(struct inpcbinfo *);\nvoid\tin_pcbinfo_init(struct inpcbinfo *, const char *, struct inpcbhead *,\n\t    int, int, char *, uma_init, uma_fini, uint32_t, u_int);\n\nstruct inpcbgroup *\n\tin_pcbgroup_byhash(struct inpcbinfo *, u_int, uint32_t);\nstruct inpcbgroup *\n\tin_pcbgroup_byinpcb(struct inpcb *);\nstruct inpcbgroup *\n\tin_pcbgroup_bytuple(struct inpcbinfo *, struct in_addr, u_short,\n\t    struct in_addr, u_short);\nvoid\tin_pcbgroup_destroy(struct inpcbinfo *);\nint\tin_pcbgroup_enabled(struct inpcbinfo *);\nvoid\tin_pcbgroup_init(struct inpcbinfo *, u_int, int);\nvoid\tin_pcbgroup_remove(struct inpcb *);\nvoid\tin_pcbgroup_update(struct inpcb *);\nvoid\tin_pcbgroup_update_mbuf(struct inpcb *, struct mbuf *);\n\nvoid\tin_pcbpurgeif0(struct inpcbinfo *, struct ifnet *);\nint\tin_pcballoc(struct socket *, struct inpcbinfo *);\nint\tin_pcbbind(struct inpcb *, struct sockaddr *, struct ucred *);\nint\tin_pcb_lport(struct inpcb *, struct in_addr *, u_short *,\n\t    struct ucred *, int);\nint\tin_pcbbind_setup(struct inpcb *, struct sockaddr *, in_addr_t *,\n\t    u_short *, struct ucred *);\nint\tin_pcbconnect(struct inpcb *, struct sockaddr *, struct ucred *);\nint\tin_pcbconnect_mbuf(struct inpcb *, struct sockaddr *, struct ucred *,\n\t    struct mbuf *);\nint\tin_pcbconnect_setup(struct inpcb *, struct sockaddr *, in_addr_t *,\n\t    u_short *, in_addr_t *, u_short *, struct inpcb **,\n\t    struct ucred *);\nvoid\tin_pcbdetach(struct inpcb *);\nvoid\tin_pcbdisconnect(struct inpcb *);\nvoid\tin_pcbdrop(struct inpcb *);\nvoid\tin_pcbfree(struct inpcb *);\nint\tin_pcbinshash(struct inpcb *);\nint\tin_pcbinshash_nopcbgroup(struct inpcb *);\nstruct inpcb *\n\tin_pcblookup_local(struct inpcbinfo *,\n\t    struct in_addr, u_short, int, struct ucred *);\nstruct inpcb *\n\tin_pcblookup(struct inpcbinfo *, struct in_addr, u_int,\n\t    struct in_addr, u_int, int, struct ifnet *);\nstruct inpcb *\n\tin_pcblookup_mbuf(struct inpcbinfo *, struct in_addr, u_int,\n\t    struct in_addr, u_int, int, struct ifnet *, struct mbuf *);\nvoid\tin_pcbnotifyall(struct inpcbinfo *pcbinfo, struct in_addr,\n\t    int, struct inpcb *(*)(struct inpcb *, int));\nvoid\tin_pcbref(struct inpcb *);\nvoid\tin_pcbrehash(struct inpcb *);\nvoid\tin_pcbrehash_mbuf(struct inpcb *, struct mbuf *);\nint\tin_pcbrele(struct inpcb *);\nint\tin_pcbrele_rlocked(struct inpcb *);\nint\tin_pcbrele_wlocked(struct inpcb *);\nvoid\tin_pcbsetsolabel(struct socket *so);\nint\tin_getpeeraddr(struct socket *so, struct sockaddr **nam);\nint\tin_getsockaddr(struct socket *so, struct sockaddr **nam);\nstruct sockaddr *\n\tin_sockaddr(in_port_t port, struct in_addr *addr);\nvoid\tin_pcbsosetlabel(struct socket *so);\n#endif /* _KERNEL */\n\n#endif /* !_NETINET_IN_PCB_H_ */\n"
  },
  {
    "path": "freebsd-headers/netinet/in_systm.h",
    "content": "/*-\n * Copyright (c) 1982, 1986, 1993\n *\tThe Regents of the University of California.  All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 4. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t@(#)in_systm.h\t8.1 (Berkeley) 6/10/93\n * $FreeBSD: release/9.0.0/sys/netinet/in_systm.h 188578 2009-02-13 15:14:43Z luigi $\n */\n\n#ifndef _NETINET_IN_SYSTM_H_\n#define _NETINET_IN_SYSTM_H_\n\n/*\n * Miscellaneous internetwork\n * definitions for kernel.\n */\n\n/*\n * Network types.\n *\n * Internally the system keeps counters in the headers with the bytes\n * swapped so that VAX instructions will work on them.  It reverses\n * the bytes before transmission at each protocol level.  The n_ types\n * represent the types with the bytes in ``high-ender'' order.\n */\ntypedef u_int16_t n_short;\t\t/* short as received from the net */\ntypedef u_int32_t n_long;\t\t/* long as received from the net */\n\ntypedef\tu_int32_t n_time;\t\t/* ms since 00:00 GMT, byte rev */\n\n#ifdef _KERNEL\nuint32_t\t iptime(void);\n#endif\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/netinet/in_var.h",
    "content": "/*-\n * Copyright (c) 1985, 1986, 1993\n *\tThe Regents of the University of California.  All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 4. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t@(#)in_var.h\t8.2 (Berkeley) 1/9/95\n * $FreeBSD: release/9.0.0/sys/netinet/in_var.h 226572 2011-10-20 15:58:05Z glebius $\n */\n\n#ifndef _NETINET_IN_VAR_H_\n#define _NETINET_IN_VAR_H_\n\n#include <sys/queue.h>\n#include <sys/fnv_hash.h>\n#include <sys/tree.h>\n\nstruct igmp_ifinfo;\nstruct in_multi;\nstruct lltable;\n\n/*\n * IPv4 per-interface state.\n */\nstruct in_ifinfo {\n\tstruct lltable\t\t*ii_llt;\t/* ARP state */\n\tstruct igmp_ifinfo\t*ii_igmp;\t/* IGMP state */\n\tstruct in_multi\t\t*ii_allhosts;\t/* 224.0.0.1 membership */\n};\n\n/*\n * Interface address, Internet version.  One of these structures\n * is allocated for each Internet address on an interface.\n * The ifaddr structure contains the protocol-independent part\n * of the structure and is assumed to be first.\n */\nstruct in_ifaddr {\n\tstruct\tifaddr ia_ifa;\t\t/* protocol-independent info */\n#define\tia_ifp\t\tia_ifa.ifa_ifp\n#define ia_flags\tia_ifa.ifa_flags\n\t\t\t\t\t/* ia_subnet{,mask} in host order */\n\tu_long\tia_subnet;\t\t/* subnet address */\n\tu_long\tia_subnetmask;\t\t/* mask of subnet */\n\tLIST_ENTRY(in_ifaddr) ia_hash;\t/* entry in bucket of inet addresses */\n\tTAILQ_ENTRY(in_ifaddr) ia_link;\t/* list of internet addresses */\n\tstruct\tsockaddr_in ia_addr;\t/* reserve space for interface name */\n\tstruct\tsockaddr_in ia_dstaddr; /* reserve space for broadcast addr */\n#define\tia_broadaddr\tia_dstaddr\n\tstruct\tsockaddr_in ia_sockmask; /* reserve space for general netmask */\n};\n\nstruct\tin_aliasreq {\n\tchar\tifra_name[IFNAMSIZ];\t\t/* if name, e.g. \"en0\" */\n\tstruct\tsockaddr_in ifra_addr;\n\tstruct\tsockaddr_in ifra_broadaddr;\n#define ifra_dstaddr ifra_broadaddr\n\tstruct\tsockaddr_in ifra_mask;\n};\n/*\n * Given a pointer to an in_ifaddr (ifaddr),\n * return a pointer to the addr as a sockaddr_in.\n */\n#define IA_SIN(ia)    (&(((struct in_ifaddr *)(ia))->ia_addr))\n#define IA_DSTSIN(ia) (&(((struct in_ifaddr *)(ia))->ia_dstaddr))\n\n#define IN_LNAOF(in, ifa) \\\n\t((ntohl((in).s_addr) & ~((struct in_ifaddr *)(ifa)->ia_subnetmask))\n\n\n#ifdef\t_KERNEL\nextern\tu_char\tinetctlerrmap[];\n\n#define LLTABLE(ifp)\t\\\n\t((struct in_ifinfo *)(ifp)->if_afdata[AF_INET])->ii_llt\n/*\n * Hash table for IP addresses.\n */\nTAILQ_HEAD(in_ifaddrhead, in_ifaddr);\nLIST_HEAD(in_ifaddrhashhead, in_ifaddr);\n\nVNET_DECLARE(struct in_ifaddrhashhead *, in_ifaddrhashtbl);\nVNET_DECLARE(struct in_ifaddrhead, in_ifaddrhead);\nVNET_DECLARE(u_long, in_ifaddrhmask);\t\t/* mask for hash table */\n\n#define\tV_in_ifaddrhashtbl\tVNET(in_ifaddrhashtbl)\n#define\tV_in_ifaddrhead\t\tVNET(in_ifaddrhead)\n#define\tV_in_ifaddrhmask\tVNET(in_ifaddrhmask)\n\n#define INADDR_NHASH_LOG2       9\n#define INADDR_NHASH\t\t(1 << INADDR_NHASH_LOG2)\n#define INADDR_HASHVAL(x)\tfnv_32_buf((&(x)), sizeof(x), FNV1_32_INIT)\n#define INADDR_HASH(x) \\\n\t(&V_in_ifaddrhashtbl[INADDR_HASHVAL(x) & V_in_ifaddrhmask])\n\nextern\tstruct rwlock in_ifaddr_lock;\n\n#define\tIN_IFADDR_LOCK_ASSERT()\trw_assert(&in_ifaddr_lock, RA_LOCKED)\n#define\tIN_IFADDR_RLOCK()\trw_rlock(&in_ifaddr_lock)\n#define\tIN_IFADDR_RLOCK_ASSERT()\trw_assert(&in_ifaddr_lock, RA_RLOCKED)\n#define\tIN_IFADDR_RUNLOCK()\trw_runlock(&in_ifaddr_lock)\n#define\tIN_IFADDR_WLOCK()\trw_wlock(&in_ifaddr_lock)\n#define\tIN_IFADDR_WLOCK_ASSERT()\trw_assert(&in_ifaddr_lock, RA_WLOCKED)\n#define\tIN_IFADDR_WUNLOCK()\trw_wunlock(&in_ifaddr_lock)\n\n/*\n * Macro for finding the internet address structure (in_ifaddr)\n * corresponding to one of our IP addresses (in_addr).\n */\n#define INADDR_TO_IFADDR(addr, ia) \\\n\t/* struct in_addr addr; */ \\\n\t/* struct in_ifaddr *ia; */ \\\ndo { \\\n\\\n\tLIST_FOREACH(ia, INADDR_HASH((addr).s_addr), ia_hash) \\\n\t\tif (IA_SIN(ia)->sin_addr.s_addr == (addr).s_addr) \\\n\t\t\tbreak; \\\n} while (0)\n\n/*\n * Macro for finding the interface (ifnet structure) corresponding to one\n * of our IP addresses.\n */\n#define INADDR_TO_IFP(addr, ifp) \\\n\t/* struct in_addr addr; */ \\\n\t/* struct ifnet *ifp; */ \\\n{ \\\n\tstruct in_ifaddr *ia; \\\n\\\n\tINADDR_TO_IFADDR(addr, ia); \\\n\t(ifp) = (ia == NULL) ? NULL : ia->ia_ifp; \\\n}\n\n/*\n * Macro for finding the internet address structure (in_ifaddr) corresponding\n * to a given interface (ifnet structure).\n */\n#define IFP_TO_IA(ifp, ia)\t\t\t\t\t\t\\\n\t/* struct ifnet *ifp; */\t\t\t\t\t\\\n\t/* struct in_ifaddr *ia; */\t\t\t\t\t\\\n{\t\t\t\t\t\t\t\t\t\\\n\tfor ((ia) = TAILQ_FIRST(&V_in_ifaddrhead);\t\t\t\\\n\t    (ia) != NULL && (ia)->ia_ifp != (ifp);\t\t\t\\\n\t    (ia) = TAILQ_NEXT((ia), ia_link))\t\t\t\t\\\n\t\tcontinue;\t\t\t\t\t\t\\\n\tif ((ia) != NULL)\t\t\t\t\t\t\\\n\t\tifa_ref(&(ia)->ia_ifa);\t\t\t\t\t\\\n}\n#endif\n\n/*\n * IP datagram reassembly.\n */\n#define\tIPREASS_NHASH_LOG2\t6\n#define\tIPREASS_NHASH\t\t(1 << IPREASS_NHASH_LOG2)\n#define\tIPREASS_HMASK\t\t(IPREASS_NHASH - 1)\n#define\tIPREASS_HASH(x,y) \\\n\t(((((x) & 0xF) | ((((x) >> 8) & 0xF) << 4)) ^ (y)) & IPREASS_HMASK)\n\n/*\n * Legacy IPv4 IGMP per-link structure.\n */\nstruct router_info {\n\tstruct ifnet *rti_ifp;\n\tint    rti_type; /* type of router which is querier on this interface */\n\tint    rti_time; /* # of slow timeouts since last old query */\n\tSLIST_ENTRY(router_info) rti_list;\n};\n\n/*\n * Per-interface IGMP router version information.\n */\nstruct igmp_ifinfo {\n\tLIST_ENTRY(igmp_ifinfo) igi_link;\n\tstruct ifnet *igi_ifp;\t/* interface this instance belongs to */\n\tuint32_t igi_version;\t/* IGMPv3 Host Compatibility Mode */\n\tuint32_t igi_v1_timer;\t/* IGMPv1 Querier Present timer (s) */\n\tuint32_t igi_v2_timer;\t/* IGMPv2 Querier Present timer (s) */\n\tuint32_t igi_v3_timer;\t/* IGMPv3 General Query (interface) timer (s)*/\n\tuint32_t igi_flags;\t/* IGMP per-interface flags */\n\tuint32_t igi_rv;\t/* IGMPv3 Robustness Variable */\n\tuint32_t igi_qi;\t/* IGMPv3 Query Interval (s) */\n\tuint32_t igi_qri;\t/* IGMPv3 Query Response Interval (s) */\n\tuint32_t igi_uri;\t/* IGMPv3 Unsolicited Report Interval (s) */\n\tSLIST_HEAD(,in_multi)\tigi_relinmhead; /* released groups */\n\tstruct ifqueue\t igi_gq;\t/* queue of general query responses */\n};\n\n#define IGIF_SILENT\t0x00000001\t/* Do not use IGMP on this ifp */\n#define IGIF_LOOPBACK\t0x00000002\t/* Send IGMP reports to loopback */\n\n/*\n * IPv4 multicast IGMP-layer source entry.\n */\nstruct ip_msource {\n\tRB_ENTRY(ip_msource)\tims_link;\t/* RB tree links */\n\tin_addr_t\t\tims_haddr;\t/* host byte order */\n\tstruct ims_st {\n\t\tuint16_t\tex;\t\t/* # of exclusive members */\n\t\tuint16_t\tin;\t\t/* # of inclusive members */\n\t}\t\t\tims_st[2];\t/* state at t0, t1 */\n\tuint8_t\t\t\tims_stp;\t/* pending query */\n};\n\n/*\n * IPv4 multicast PCB-layer source entry.\n */\nstruct in_msource {\n\tRB_ENTRY(ip_msource)\tims_link;\t/* RB tree links */\n\tin_addr_t\t\tims_haddr;\t/* host byte order */\n\tuint8_t\t\t\timsl_st[2];\t/* state before/at commit */\n};\n\nRB_HEAD(ip_msource_tree, ip_msource);\t/* define struct ip_msource_tree */\n\nstatic __inline int\nip_msource_cmp(const struct ip_msource *a, const struct ip_msource *b)\n{\n\n\tif (a->ims_haddr < b->ims_haddr)\n\t\treturn (-1);\n\tif (a->ims_haddr == b->ims_haddr)\n\t\treturn (0);\n\treturn (1);\n}\nRB_PROTOTYPE(ip_msource_tree, ip_msource, ims_link, ip_msource_cmp);\n\n/*\n * IPv4 multicast PCB-layer group filter descriptor.\n */\nstruct in_mfilter {\n\tstruct ip_msource_tree\timf_sources; /* source list for (S,G) */\n\tu_long\t\t\timf_nsrc;    /* # of source entries */\n\tuint8_t\t\t\timf_st[2];   /* state before/at commit */\n};\n\n/*\n * IPv4 group descriptor.\n *\n * For every entry on an ifnet's if_multiaddrs list which represents\n * an IP multicast group, there is one of these structures.\n *\n * If any source filters are present, then a node will exist in the RB-tree\n * to permit fast lookup by source whenever an operation takes place.\n * This permits pre-order traversal when we issue reports.\n * Source filter trees are kept separately from the socket layer to\n * greatly simplify locking.\n *\n * When IGMPv3 is active, inm_timer is the response to group query timer.\n * The state-change timer inm_sctimer is separate; whenever state changes\n * for the group the state change record is generated and transmitted,\n * and kept if retransmissions are necessary.\n *\n * FUTURE: inm_link is now only used when groups are being purged\n * on a detaching ifnet. It could be demoted to a SLIST_ENTRY, but\n * because it is at the very start of the struct, we can't do this\n * w/o breaking the ABI for ifmcstat.\n */\nstruct in_multi {\n\tLIST_ENTRY(in_multi) inm_link;\t/* to-be-released by in_ifdetach */\n\tstruct\tin_addr inm_addr;\t/* IP multicast address, convenience */\n\tstruct\tifnet *inm_ifp;\t\t/* back pointer to ifnet */\n\tstruct\tifmultiaddr *inm_ifma;\t/* back pointer to ifmultiaddr */\n\tu_int\tinm_timer;\t\t/* IGMPv1/v2 group / v3 query timer */\n\tu_int\tinm_state;\t\t/* state of the membership */\n\tvoid\t*inm_rti;\t\t/* unused, legacy field */\n\tu_int\tinm_refcount;\t\t/* reference count */\n\n\t/* New fields for IGMPv3 follow. */\n\tstruct igmp_ifinfo\t*inm_igi;\t/* IGMP info */\n\tSLIST_ENTRY(in_multi)\t inm_nrele;\t/* to-be-released by IGMP */\n\tstruct ip_msource_tree\t inm_srcs;\t/* tree of sources */\n\tu_long\t\t\t inm_nsrc;\t/* # of tree entries */\n\n\tstruct ifqueue\t\t inm_scq;\t/* queue of pending\n\t\t\t\t\t\t * state-change packets */\n\tstruct timeval\t\t inm_lastgsrtv;\t/* Time of last G-S-R query */\n\tuint16_t\t\t inm_sctimer;\t/* state-change timer */\n\tuint16_t\t\t inm_scrv;\t/* state-change rexmit count */\n\n\t/*\n\t * SSM state counters which track state at T0 (the time the last\n\t * state-change report's RV timer went to zero) and T1\n\t * (time of pending report, i.e. now).\n\t * Used for computing IGMPv3 state-change reports. Several refcounts\n\t * are maintained here to optimize for common use-cases.\n\t */\n\tstruct inm_st {\n\t\tuint16_t\tiss_fmode;\t/* IGMP filter mode */\n\t\tuint16_t\tiss_asm;\t/* # of ASM listeners */\n\t\tuint16_t\tiss_ex;\t\t/* # of exclusive members */\n\t\tuint16_t\tiss_in;\t\t/* # of inclusive members */\n\t\tuint16_t\tiss_rec;\t/* # of recorded sources */\n\t}\t\t\tinm_st[2];\t/* state at t0, t1 */\n};\n\n/*\n * Helper function to derive the filter mode on a source entry\n * from its internal counters. Predicates are:\n *  A source is only excluded if all listeners exclude it.\n *  A source is only included if no listeners exclude it,\n *  and at least one listener includes it.\n * May be used by ifmcstat(8).\n */\nstatic __inline uint8_t\nims_get_mode(const struct in_multi *inm, const struct ip_msource *ims,\n    uint8_t t)\n{\n\n\tt = !!t;\n\tif (inm->inm_st[t].iss_ex > 0 &&\n\t    inm->inm_st[t].iss_ex == ims->ims_st[t].ex)\n\t\treturn (MCAST_EXCLUDE);\n\telse if (ims->ims_st[t].in > 0 && ims->ims_st[t].ex == 0)\n\t\treturn (MCAST_INCLUDE);\n\treturn (MCAST_UNDEFINED);\n}\n\n#ifdef _KERNEL\n\n#ifdef SYSCTL_DECL\nSYSCTL_DECL(_net_inet);\nSYSCTL_DECL(_net_inet_ip);\nSYSCTL_DECL(_net_inet_raw);\n#endif\n\n/*\n * Lock macros for IPv4 layer multicast address lists.  IPv4 lock goes\n * before link layer multicast locks in the lock order.  In most cases,\n * consumers of IN_*_MULTI() macros should acquire the locks before\n * calling them; users of the in_{add,del}multi() functions should not.\n */\nextern struct mtx in_multi_mtx;\n#define\tIN_MULTI_LOCK()\t\tmtx_lock(&in_multi_mtx)\n#define\tIN_MULTI_UNLOCK()\tmtx_unlock(&in_multi_mtx)\n#define\tIN_MULTI_LOCK_ASSERT()\tmtx_assert(&in_multi_mtx, MA_OWNED)\n#define\tIN_MULTI_UNLOCK_ASSERT() mtx_assert(&in_multi_mtx, MA_NOTOWNED)\n\n/*\n * Function for looking up an in_multi record for an IPv4 multicast address\n * on a given interface. ifp must be valid. If no record found, return NULL.\n * The IN_MULTI_LOCK and IF_ADDR_LOCK on ifp must be held.\n */\nstatic __inline struct in_multi *\ninm_lookup_locked(struct ifnet *ifp, const struct in_addr ina)\n{\n\tstruct ifmultiaddr *ifma;\n\tstruct in_multi *inm;\n\n\tIN_MULTI_LOCK_ASSERT();\n\tIF_ADDR_LOCK_ASSERT(ifp);\n\n\tinm = NULL;\n\tTAILQ_FOREACH(ifma, &((ifp)->if_multiaddrs), ifma_link) {\n\t\tif (ifma->ifma_addr->sa_family == AF_INET) {\n\t\t\tinm = (struct in_multi *)ifma->ifma_protospec;\n\t\t\tif (inm->inm_addr.s_addr == ina.s_addr)\n\t\t\t\tbreak;\n\t\t\tinm = NULL;\n\t\t}\n\t}\n\treturn (inm);\n}\n\n/*\n * Wrapper for inm_lookup_locked().\n * The IF_ADDR_LOCK will be taken on ifp and released on return.\n */\nstatic __inline struct in_multi *\ninm_lookup(struct ifnet *ifp, const struct in_addr ina)\n{\n\tstruct in_multi *inm;\n\n\tIN_MULTI_LOCK_ASSERT();\n\tIF_ADDR_LOCK(ifp);\n\tinm = inm_lookup_locked(ifp, ina);\n\tIF_ADDR_UNLOCK(ifp);\n\n\treturn (inm);\n}\n\n/* Acquire an in_multi record. */\nstatic __inline void\ninm_acquire_locked(struct in_multi *inm)\n{\n\n\tIN_MULTI_LOCK_ASSERT();\n\t++inm->inm_refcount;\n}\n\n/*\n * Return values for imo_multi_filter().\n */\n#define MCAST_PASS\t\t0\t/* Pass */\n#define MCAST_NOTGMEMBER\t1\t/* This host not a member of group */\n#define MCAST_NOTSMEMBER\t2\t/* This host excluded source */\n#define MCAST_MUTED\t\t3\t/* [deprecated] */\n\nstruct\trtentry;\nstruct\troute;\nstruct\tip_moptions;\n\nint\timo_multi_filter(const struct ip_moptions *, const struct ifnet *,\n\t    const struct sockaddr *, const struct sockaddr *);\nvoid\tinm_commit(struct in_multi *);\nvoid\tinm_clear_recorded(struct in_multi *);\nvoid\tinm_print(const struct in_multi *);\nint\tinm_record_source(struct in_multi *inm, const in_addr_t);\nvoid\tinm_release(struct in_multi *);\nvoid\tinm_release_locked(struct in_multi *);\nstruct\tin_multi *\n\tin_addmulti(struct in_addr *, struct ifnet *);\nvoid\tin_delmulti(struct in_multi *);\nint\tin_joingroup(struct ifnet *, const struct in_addr *,\n\t    /*const*/ struct in_mfilter *, struct in_multi **);\nint\tin_joingroup_locked(struct ifnet *, const struct in_addr *,\n\t    /*const*/ struct in_mfilter *, struct in_multi **);\nint\tin_leavegroup(struct in_multi *, /*const*/ struct in_mfilter *);\nint\tin_leavegroup_locked(struct in_multi *,\n\t    /*const*/ struct in_mfilter *);\nint\tin_control(struct socket *, u_long, caddr_t, struct ifnet *,\n\t    struct thread *);\nvoid\tin_rtqdrain(void);\nvoid\tip_input(struct mbuf *);\nint\tin_ifadown(struct ifaddr *ifa, int);\nvoid\tin_ifscrub(struct ifnet *, struct in_ifaddr *, u_int);\nstruct\tmbuf\t*ip_fastforward(struct mbuf *);\nvoid\t*in_domifattach(struct ifnet *);\nvoid\tin_domifdetach(struct ifnet *, void *);\n\n\n/* XXX */\nvoid\t in_rtalloc_ign(struct route *ro, u_long ignflags, u_int fibnum);\nvoid\t in_rtalloc(struct route *ro, u_int fibnum);\nstruct rtentry *in_rtalloc1(struct sockaddr *, int, u_long, u_int);\nvoid\t in_rtredirect(struct sockaddr *, struct sockaddr *,\n\t    struct sockaddr *, int, struct sockaddr *, u_int);\nint\t in_rtrequest(int, struct sockaddr *,\n\t    struct sockaddr *, struct sockaddr *, int, struct rtentry **, u_int);\n\n#if 0\nint\t in_rt_getifa(struct rt_addrinfo *, u_int fibnum);\nint\t in_rtioctl(u_long, caddr_t, u_int);\nint\t in_rtrequest1(int, struct rt_addrinfo *, struct rtentry **, u_int);\n#endif\n#endif /* _KERNEL */\n\n/* INET6 stuff */\n#include <netinet6/in6_var.h>\n\n#endif /* _NETINET_IN_VAR_H_ */\n"
  },
  {
    "path": "freebsd-headers/netinet/ip.h",
    "content": "/*-\n * Copyright (c) 1982, 1986, 1993\n *\tThe Regents of the University of California.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 4. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t@(#)ip.h\t8.2 (Berkeley) 6/1/94\n * $FreeBSD: release/9.0.0/sys/netinet/ip.h 203343 2010-02-01 14:13:44Z luigi $\n */\n\n#ifndef _NETINET_IP_H_\n#define\t_NETINET_IP_H_\n\n#include <sys/cdefs.h>\n\n/*\n * Definitions for internet protocol version 4.\n *\n * Per RFC 791, September 1981.\n */\n#define\tIPVERSION\t4\n\n/*\n * Structure of an internet header, naked of options.\n */\nstruct ip {\n#if BYTE_ORDER == LITTLE_ENDIAN\n\tu_char\tip_hl:4,\t\t/* header length */\n\t\tip_v:4;\t\t\t/* version */\n#endif\n#if BYTE_ORDER == BIG_ENDIAN\n\tu_char\tip_v:4,\t\t\t/* version */\n\t\tip_hl:4;\t\t/* header length */\n#endif\n\tu_char\tip_tos;\t\t\t/* type of service */\n\tu_short\tip_len;\t\t\t/* total length */\n\tu_short\tip_id;\t\t\t/* identification */\n\tu_short\tip_off;\t\t\t/* fragment offset field */\n#define\tIP_RF 0x8000\t\t\t/* reserved fragment flag */\n#define\tIP_DF 0x4000\t\t\t/* dont fragment flag */\n#define\tIP_MF 0x2000\t\t\t/* more fragments flag */\n#define\tIP_OFFMASK 0x1fff\t\t/* mask for fragmenting bits */\n\tu_char\tip_ttl;\t\t\t/* time to live */\n\tu_char\tip_p;\t\t\t/* protocol */\n\tu_short\tip_sum;\t\t\t/* checksum */\n\tstruct\tin_addr ip_src,ip_dst;\t/* source and dest address */\n} __packed __aligned(4);\n\n#define\tIP_MAXPACKET\t65535\t\t/* maximum packet size */\n\n/*\n * Definitions for IP type of service (ip_tos).\n */\n#define\tIPTOS_LOWDELAY\t\t0x10\n#define\tIPTOS_THROUGHPUT\t0x08\n#define\tIPTOS_RELIABILITY\t0x04\n#define\tIPTOS_MINCOST\t\t0x02\n\n/*\n * Definitions for IP precedence (also in ip_tos) (hopefully unused).\n */\n#define\tIPTOS_PREC_NETCONTROL\t\t0xe0\n#define\tIPTOS_PREC_INTERNETCONTROL\t0xc0\n#define\tIPTOS_PREC_CRITIC_ECP\t\t0xa0\n#define\tIPTOS_PREC_FLASHOVERRIDE\t0x80\n#define\tIPTOS_PREC_FLASH\t\t0x60\n#define\tIPTOS_PREC_IMMEDIATE\t\t0x40\n#define\tIPTOS_PREC_PRIORITY\t\t0x20\n#define\tIPTOS_PREC_ROUTINE\t\t0x00\n\n/*\n * ECN (Explicit Congestion Notification) codepoints in RFC3168 mapped to the\n * lower 2 bits of the TOS field.\n */\n#define\tIPTOS_ECN_NOTECT\t0x00\t/* not-ECT */\n#define\tIPTOS_ECN_ECT1\t\t0x01\t/* ECN-capable transport (1) */\n#define\tIPTOS_ECN_ECT0\t\t0x02\t/* ECN-capable transport (0) */\n#define\tIPTOS_ECN_CE\t\t0x03\t/* congestion experienced */\n#define\tIPTOS_ECN_MASK\t\t0x03\t/* ECN field mask */\n\n/*\n * Definitions for options.\n */\n#define\tIPOPT_COPIED(o)\t\t((o)&0x80)\n#define\tIPOPT_CLASS(o)\t\t((o)&0x60)\n#define\tIPOPT_NUMBER(o)\t\t((o)&0x1f)\n\n#define\tIPOPT_CONTROL\t\t0x00\n#define\tIPOPT_RESERVED1\t\t0x20\n#define\tIPOPT_DEBMEAS\t\t0x40\n#define\tIPOPT_RESERVED2\t\t0x60\n\n#define\tIPOPT_EOL\t\t0\t\t/* end of option list */\n#define\tIPOPT_NOP\t\t1\t\t/* no operation */\n\n#define\tIPOPT_RR\t\t7\t\t/* record packet route */\n#define\tIPOPT_TS\t\t68\t\t/* timestamp */\n#define\tIPOPT_SECURITY\t\t130\t\t/* provide s,c,h,tcc */\n#define\tIPOPT_LSRR\t\t131\t\t/* loose source route */\n#define\tIPOPT_ESO\t\t133\t\t/* extended security */\n#define\tIPOPT_CIPSO\t\t134\t\t/* commerical security */\n#define\tIPOPT_SATID\t\t136\t\t/* satnet id */\n#define\tIPOPT_SSRR\t\t137\t\t/* strict source route */\n#define\tIPOPT_RA\t\t148\t\t/* router alert */\n\n/*\n * Offsets to fields in options other than EOL and NOP.\n */\n#define\tIPOPT_OPTVAL\t\t0\t\t/* option ID */\n#define\tIPOPT_OLEN\t\t1\t\t/* option length */\n#define\tIPOPT_OFFSET\t\t2\t\t/* offset within option */\n#define\tIPOPT_MINOFF\t\t4\t\t/* min value of above */\n\n/*\n * Time stamp option structure.\n */\nstruct\tip_timestamp {\n\tu_char\tipt_code;\t\t/* IPOPT_TS */\n\tu_char\tipt_len;\t\t/* size of structure (variable) */\n\tu_char\tipt_ptr;\t\t/* index of current entry */\n#if BYTE_ORDER == LITTLE_ENDIAN\n\tu_char\tipt_flg:4,\t\t/* flags, see below */\n\t\tipt_oflw:4;\t\t/* overflow counter */\n#endif\n#if BYTE_ORDER == BIG_ENDIAN\n\tu_char\tipt_oflw:4,\t\t/* overflow counter */\n\t\tipt_flg:4;\t\t/* flags, see below */\n#endif\n\tunion ipt_timestamp {\n\t\tuint32_t\tipt_time[1];\t/* network format */\n\t\tstruct\tipt_ta {\n\t\t\tstruct in_addr ipt_addr;\n\t\t\tuint32_t ipt_time;\t/* network format */\n\t\t} ipt_ta[1];\n\t} ipt_timestamp;\n};\n\n/* Flag bits for ipt_flg. */\n#define\tIPOPT_TS_TSONLY\t\t0\t\t/* timestamps only */\n#define\tIPOPT_TS_TSANDADDR\t1\t\t/* timestamps and addresses */\n#define\tIPOPT_TS_PRESPEC\t3\t\t/* specified modules only */\n\n/* Bits for security (not byte swapped). */\n#define\tIPOPT_SECUR_UNCLASS\t0x0000\n#define\tIPOPT_SECUR_CONFID\t0xf135\n#define\tIPOPT_SECUR_EFTO\t0x789a\n#define\tIPOPT_SECUR_MMMM\t0xbc4d\n#define\tIPOPT_SECUR_RESTR\t0xaf13\n#define\tIPOPT_SECUR_SECRET\t0xd788\n#define\tIPOPT_SECUR_TOPSECRET\t0x6bc5\n\n/*\n * Internet implementation parameters.\n */\n#define\tMAXTTL\t\t255\t\t/* maximum time to live (seconds) */\n#define\tIPDEFTTL\t64\t\t/* default ttl, from RFC 1340 */\n#define\tIPFRAGTTL\t60\t\t/* time to live for frags, slowhz */\n#define\tIPTTLDEC\t1\t\t/* subtracted when forwarding */\n#define\tIP_MSS\t\t576\t\t/* default maximum segment size */\n\n/*\n * This is the real IPv4 pseudo header, used for computing the TCP and UDP\n * checksums. For the Internet checksum, struct ipovly can be used instead.\n * For stronger checksums, the real thing must be used.\n */\nstruct ippseudo {\n\tstruct\tin_addr\tippseudo_src;\t/* source internet address */\n\tstruct\tin_addr\tippseudo_dst;\t/* destination internet address */\n\tu_char\t\tippseudo_pad;\t/* pad, must be zero */\n\tu_char\t\tippseudo_p;\t/* protocol */\n\tu_short\t\tippseudo_len;\t/* protocol length */\n};\n#endif\n"
  },
  {
    "path": "freebsd-headers/netinet/ip6.h",
    "content": "/*\t$FreeBSD: release/9.0.0/sys/netinet/ip6.h 215956 2010-11-27 21:51:39Z brucec $\t*/\n/*\t$KAME: ip6.h,v 1.18 2001/03/29 05:34:30 itojun Exp $\t*/\n\n/*-\n * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. Neither the name of the project nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n */\n\n/*-\n * Copyright (c) 1982, 1986, 1993\n *\tThe Regents of the University of California.  All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 4. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t@(#)ip.h\t8.1 (Berkeley) 6/10/93\n */\n\n#ifndef _NETINET_IP6_H_\n#define _NETINET_IP6_H_\n\n/*\n * Definition for internet protocol version 6.\n * RFC 2460\n */\n\nstruct ip6_hdr {\n\tunion {\n\t\tstruct ip6_hdrctl {\n\t\t\tu_int32_t ip6_un1_flow;\t/* 20 bits of flow-ID */\n\t\t\tu_int16_t ip6_un1_plen;\t/* payload length */\n\t\t\tu_int8_t  ip6_un1_nxt;\t/* next header */\n\t\t\tu_int8_t  ip6_un1_hlim;\t/* hop limit */\n\t\t} ip6_un1;\n\t\tu_int8_t ip6_un2_vfc;\t/* 4 bits version, top 4 bits class */\n\t} ip6_ctlun;\n\tstruct in6_addr ip6_src;\t/* source address */\n\tstruct in6_addr ip6_dst;\t/* destination address */\n} __packed;\n\n#define ip6_vfc\t\tip6_ctlun.ip6_un2_vfc\n#define ip6_flow\tip6_ctlun.ip6_un1.ip6_un1_flow\n#define ip6_plen\tip6_ctlun.ip6_un1.ip6_un1_plen\n#define ip6_nxt\t\tip6_ctlun.ip6_un1.ip6_un1_nxt\n#define ip6_hlim\tip6_ctlun.ip6_un1.ip6_un1_hlim\n#define ip6_hops\tip6_ctlun.ip6_un1.ip6_un1_hlim\n\n#define IPV6_VERSION\t\t0x60\n#define IPV6_VERSION_MASK\t0xf0\n\n#if BYTE_ORDER == BIG_ENDIAN\n#define IPV6_FLOWINFO_MASK\t0x0fffffff\t/* flow info (28 bits) */\n#define IPV6_FLOWLABEL_MASK\t0x000fffff\t/* flow label (20 bits) */\n#else\n#if BYTE_ORDER == LITTLE_ENDIAN\n#define IPV6_FLOWINFO_MASK\t0xffffff0f\t/* flow info (28 bits) */\n#define IPV6_FLOWLABEL_MASK\t0xffff0f00\t/* flow label (20 bits) */\n#endif /* LITTLE_ENDIAN */\n#endif\n#if 1\n/* ECN bits proposed by Sally Floyd */\n#define IP6TOS_CE\t\t0x01\t/* congestion experienced */\n#define IP6TOS_ECT\t\t0x02\t/* ECN-capable transport */\n#endif\n\n/*\n * Extension Headers\n */\n\nstruct\tip6_ext {\n\tu_int8_t ip6e_nxt;\n\tu_int8_t ip6e_len;\n} __packed;\n\n/* Hop-by-Hop options header */\n/* XXX should we pad it to force alignment on an 8-byte boundary? */\nstruct ip6_hbh {\n\tu_int8_t ip6h_nxt;\t/* next header */\n\tu_int8_t ip6h_len;\t/* length in units of 8 octets */\n\t/* followed by options */\n} __packed;\n\n/* Destination options header */\n/* XXX should we pad it to force alignment on an 8-byte boundary? */\nstruct ip6_dest {\n\tu_int8_t ip6d_nxt;\t/* next header */\n\tu_int8_t ip6d_len;\t/* length in units of 8 octets */\n\t/* followed by options */\n} __packed;\n\n/* Option types and related macros */\n#define IP6OPT_PAD1\t\t0x00\t/* 00 0 00000 */\n#define IP6OPT_PADN\t\t0x01\t/* 00 0 00001 */\n#define IP6OPT_JUMBO\t\t0xC2\t/* 11 0 00010 = 194 */\n#define IP6OPT_NSAP_ADDR\t0xC3\t/* 11 0 00011 */\n#define IP6OPT_TUNNEL_LIMIT\t0x04\t/* 00 0 00100 */\n#ifndef _KERNEL\n#define IP6OPT_RTALERT\t\t0x05\t/* 00 0 00101 (KAME definition) */\n#endif\n#define IP6OPT_ROUTER_ALERT\t0x05\t/* 00 0 00101 (RFC3542, recommended) */\n\n#define IP6OPT_RTALERT_LEN\t4\n#define IP6OPT_RTALERT_MLD\t0\t/* Datagram contains an MLD message */\n#define IP6OPT_RTALERT_RSVP\t1\t/* Datagram contains an RSVP message */\n#define IP6OPT_RTALERT_ACTNET\t2 \t/* contains an Active Networks msg */\n#define IP6OPT_MINLEN\t\t2\n\n#define IP6OPT_EID\t\t0x8a\t/* 10 0 01010 */\n\n#define IP6OPT_TYPE(o)\t\t((o) & 0xC0)\n#define IP6OPT_TYPE_SKIP\t0x00\n#define IP6OPT_TYPE_DISCARD\t0x40\n#define IP6OPT_TYPE_FORCEICMP\t0x80\n#define IP6OPT_TYPE_ICMP\t0xC0\n\n#define IP6OPT_MUTABLE\t\t0x20\n\n/* IPv6 options: common part */\nstruct ip6_opt {\n\tu_int8_t ip6o_type;\n\tu_int8_t ip6o_len;\n} __packed;\n\n/* Jumbo Payload Option */\nstruct ip6_opt_jumbo {\n\tu_int8_t ip6oj_type;\n\tu_int8_t ip6oj_len;\n\tu_int8_t ip6oj_jumbo_len[4];\n} __packed;\n#define IP6OPT_JUMBO_LEN\t6\n\n/* NSAP Address Option */\nstruct ip6_opt_nsap {\n\tu_int8_t ip6on_type;\n\tu_int8_t ip6on_len;\n\tu_int8_t ip6on_src_nsap_len;\n\tu_int8_t ip6on_dst_nsap_len;\n\t/* followed by source NSAP */\n\t/* followed by destination NSAP */\n} __packed;\n\n/* Tunnel Limit Option */\nstruct ip6_opt_tunnel {\n\tu_int8_t ip6ot_type;\n\tu_int8_t ip6ot_len;\n\tu_int8_t ip6ot_encap_limit;\n} __packed;\n\n/* Router Alert Option */\nstruct ip6_opt_router {\n\tu_int8_t ip6or_type;\n\tu_int8_t ip6or_len;\n\tu_int8_t ip6or_value[2];\n} __packed;\n/* Router alert values (in network byte order) */\n#if BYTE_ORDER == BIG_ENDIAN\n#define IP6_ALERT_MLD\t0x0000\n#define IP6_ALERT_RSVP\t0x0001\n#define IP6_ALERT_AN\t0x0002\n#else\n#if BYTE_ORDER == LITTLE_ENDIAN\n#define IP6_ALERT_MLD\t0x0000\n#define IP6_ALERT_RSVP\t0x0100\n#define IP6_ALERT_AN\t0x0200\n#endif /* LITTLE_ENDIAN */\n#endif\n\n/* Routing header */\nstruct ip6_rthdr {\n\tu_int8_t  ip6r_nxt;\t/* next header */\n\tu_int8_t  ip6r_len;\t/* length in units of 8 octets */\n\tu_int8_t  ip6r_type;\t/* routing type */\n\tu_int8_t  ip6r_segleft;\t/* segments left */\n\t/* followed by routing type specific data */\n} __packed;\n\n/* Type 0 Routing header, deprecated by RFC 5095. */\nstruct ip6_rthdr0 {\n\tu_int8_t  ip6r0_nxt;\t\t/* next header */\n\tu_int8_t  ip6r0_len;\t\t/* length in units of 8 octets */\n\tu_int8_t  ip6r0_type;\t\t/* always zero */\n\tu_int8_t  ip6r0_segleft;\t/* segments left */\n\tu_int32_t  ip6r0_reserved;\t/* reserved field */\n\t/* followed by up to 127 struct in6_addr */\n} __packed;\n\n/* Fragment header */\nstruct ip6_frag {\n\tu_int8_t  ip6f_nxt;\t\t/* next header */\n\tu_int8_t  ip6f_reserved;\t/* reserved field */\n\tu_int16_t ip6f_offlg;\t\t/* offset, reserved, and flag */\n\tu_int32_t ip6f_ident;\t\t/* identification */\n} __packed;\n\n#if BYTE_ORDER == BIG_ENDIAN\n#define IP6F_OFF_MASK\t\t0xfff8\t/* mask out offset from _offlg */\n#define IP6F_RESERVED_MASK\t0x0006\t/* reserved bits in ip6f_offlg */\n#define IP6F_MORE_FRAG\t\t0x0001\t/* more-fragments flag */\n#else /* BYTE_ORDER == LITTLE_ENDIAN */\n#define IP6F_OFF_MASK\t\t0xf8ff\t/* mask out offset from _offlg */\n#define IP6F_RESERVED_MASK\t0x0600\t/* reserved bits in ip6f_offlg */\n#define IP6F_MORE_FRAG\t\t0x0100\t/* more-fragments flag */\n#endif /* BYTE_ORDER == LITTLE_ENDIAN */\n\n/*\n * Internet implementation parameters.\n */\n#define IPV6_MAXHLIM\t255\t/* maximum hoplimit */\n#define IPV6_DEFHLIM\t64\t/* default hlim */\n#define IPV6_FRAGTTL\t120\t/* ttl for fragment packets, in slowtimo tick */\n#define IPV6_HLIMDEC\t1\t/* subtracted when forwarding */\n\n#define IPV6_MMTU\t1280\t/* minimal MTU and reassembly. 1024 + 256 */\n#define IPV6_MAXPACKET\t65535\t/* ip6 max packet size without Jumbo payload*/\n#define IPV6_MAXOPTHDR\t2048\t/* max option header size, 256 64-bit words */\n\n#ifdef _KERNEL\n/*\n * IP6_EXTHDR_CHECK ensures that region between the IP6 header and the\n * target header (including IPv6 itself, extension headers and\n * TCP/UDP/ICMP6 headers) are contiguous. KAME requires drivers\n * to store incoming data into one internal mbuf or one or more external\n * mbufs(never into two or more internal mbufs). Thus, the third case is\n * supposed to never be matched but is prepared just in case.\n */\n\n#define IP6_EXTHDR_CHECK(m, off, hlen, ret)\t\t\t\t\\\ndo {\t\t\t\t\t\t\t\t\t\\\n    if ((m)->m_next != NULL) {\t\t\t\t\t\t\\\n\tif (((m)->m_flags & M_LOOP) &&\t\t\t\t\t\\\n\t    ((m)->m_len < (off) + (hlen)) &&\t\t\t\t\\\n\t    (((m) = m_pullup((m), (off) + (hlen))) == NULL)) {\t\t\\\n\t\tV_ip6stat.ip6s_exthdrtoolong++;\t\t\t\t\\\n\t\treturn ret;\t\t\t\t\t\t\\\n\t} else if ((m)->m_flags & M_EXT) {\t\t\t\t\\\n\t\tif ((m)->m_len < (off) + (hlen)) {\t\t\t\\\n\t\t\tV_ip6stat.ip6s_exthdrtoolong++;\t\t\t\\\n\t\t\tm_freem(m);\t\t\t\t\t\\\n\t\t\treturn ret;\t\t\t\t\t\\\n\t\t}\t\t\t\t\t\t\t\\\n\t} else {\t\t\t\t\t\t\t\\\n\t\tif ((m)->m_len < (off) + (hlen)) {\t\t\t\\\n\t\t\tV_ip6stat.ip6s_exthdrtoolong++;\t\t\t\\\n\t\t\tm_freem(m);\t\t\t\t\t\\\n\t\t\treturn ret;\t\t\t\t\t\\\n\t\t}\t\t\t\t\t\t\t\\\n\t}\t\t\t\t\t\t\t\t\\\n    } else {\t\t\t\t\t\t\t\t\\\n\tif ((m)->m_len < (off) + (hlen)) {\t\t\t\t\\\n\t\tV_ip6stat.ip6s_tooshort++;\t\t\t\t\\\n\t\tin6_ifstat_inc(m->m_pkthdr.rcvif, ifs6_in_truncated);\t\\\n\t\tm_freem(m);\t\t\t\t\t\t\\\n\t\treturn ret;\t\t\t\t\t\t\\\n\t}\t\t\t\t\t\t\t\t\\\n    }\t\t\t\t\t\t\t\t\t\\\n} while (/*CONSTCOND*/ 0)\n\n/*\n * IP6_EXTHDR_GET ensures that intermediate protocol header (from \"off\" to\n * \"len\") is located in single mbuf, on contiguous memory region.\n * The pointer to the region will be returned to pointer variable \"val\",\n * with type \"typ\".\n * IP6_EXTHDR_GET0 does the same, except that it aligns the structure at the\n * very top of mbuf.  GET0 is likely to make memory copy than GET.\n *\n * XXX we're now testing this, needs m_pulldown()\n */\n#define IP6_EXTHDR_GET(val, typ, m, off, len) \\\ndo {\t\t\t\t\t\t\t\t\t\\\n\tstruct mbuf *t;\t\t\t\t\t\t\t\\\n\tint tmp;\t\t\t\t\t\t\t\\\n\tif ((m)->m_len >= (off) + (len))\t\t\t\t\\\n\t\t(val) = (typ)(mtod((m), caddr_t) + (off));\t\t\\\n\telse {\t\t\t\t\t\t\t\t\\\n\t\tt = m_pulldown((m), (off), (len), &tmp);\t\t\\\n\t\tif (t) {\t\t\t\t\t\t\\\n\t\t\tif (t->m_len < tmp + (len))\t\t\t\\\n\t\t\t\tpanic(\"m_pulldown malfunction\");\t\\\n\t\t\t(val) = (typ)(mtod(t, caddr_t) + tmp);\t\t\\\n\t\t} else {\t\t\t\t\t\t\\\n\t\t\t(val) = (typ)NULL;\t\t\t\t\\\n\t\t\t(m) = NULL;\t\t\t\t\t\\\n\t\t}\t\t\t\t\t\t\t\\\n\t}\t\t\t\t\t\t\t\t\\\n} while (/*CONSTCOND*/ 0)\n\n#define IP6_EXTHDR_GET0(val, typ, m, off, len) \\\ndo {\t\t\t\t\t\t\t\t\t\\\n\tstruct mbuf *t;\t\t\t\t\t\t\t\\\n\tif ((off) == 0)\t\t\t\t\t\t\t\\\n\t\t(val) = (typ)mtod(m, caddr_t);\t\t\t\t\\\n\telse {\t\t\t\t\t\t\t\t\\\n\t\tt = m_pulldown((m), (off), (len), NULL);\t\t\\\n\t\tif (t) {\t\t\t\t\t\t\\\n\t\t\tif (t->m_len < (len))\t\t\t\t\\\n\t\t\t\tpanic(\"m_pulldown malfunction\");\t\\\n\t\t\t(val) = (typ)mtod(t, caddr_t);\t\t\t\\\n\t\t} else {\t\t\t\t\t\t\\\n\t\t\t(val) = (typ)NULL;\t\t\t\t\\\n\t\t\t(m) = NULL;\t\t\t\t\t\\\n\t\t}\t\t\t\t\t\t\t\\\n\t}\t\t\t\t\t\t\t\t\\\n} while (/*CONSTCOND*/ 0)\n\n#endif /*_KERNEL*/\n\n#endif /* not _NETINET_IP6_H_ */\n"
  },
  {
    "path": "freebsd-headers/netinet/ip_auth.h",
    "content": "/*\t$FreeBSD: release/9.0.0/sys/contrib/ipfilter/netinet/ip_auth.h 170268 2007-06-04 02:54:36Z darrenr $\t*/\n\n/*\n * Copyright (C) 1997-2001 by Darren Reed & Guido Van Rooij.\n *\n * See the IPFILTER.LICENCE file for details on licencing.\n *\n * $FreeBSD: release/9.0.0/sys/contrib/ipfilter/netinet/ip_auth.h 170268 2007-06-04 02:54:36Z darrenr $\n * Id: ip_auth.h,v 2.16.2.2 2006/03/16 06:45:49 darrenr Exp $\n *\n */\n#ifndef\t__IP_AUTH_H__\n#define\t__IP_AUTH_H__\n\n#define FR_NUMAUTH      32\n\ntypedef struct  frauth {\n\tint\tfra_age;\n\tint\tfra_len;\n\tint\tfra_index;\n\tu_32_t\tfra_pass;\n\tfr_info_t\tfra_info;\n\tchar\t*fra_buf;\n#ifdef\tMENTAT\n\tqueue_t\t*fra_q;\n\tmb_t\t*fra_m;\n#endif\n} frauth_t;\n\ntypedef\tstruct\tfrauthent  {\n\tstruct\tfrentry\tfae_fr;\n\tstruct\tfrauthent\t*fae_next;\n\tstruct\tfrauthent\t**fae_pnext;\n\tu_long\tfae_age;\n\tint\tfae_ref;\n} frauthent_t;\n\ntypedef struct  fr_authstat {\n\tU_QUAD_T\tfas_hits;\n\tU_QUAD_T\tfas_miss;\n\tu_long\t\tfas_nospace;\n\tu_long\t\tfas_added;\n\tu_long\t\tfas_sendfail;\n\tu_long\t\tfas_sendok;\n\tu_long\t\tfas_queok;\n\tu_long\t\tfas_quefail;\n\tu_long\t\tfas_expire;\n\tfrauthent_t\t*fas_faelist;\n} fr_authstat_t;\n\n\nextern\tfrentry_t\t*ipauth;\nextern\tstruct fr_authstat\tfr_authstats;\nextern\tint\tfr_defaultauthage;\nextern\tint\tfr_authstart;\nextern\tint\tfr_authend;\nextern\tint\tfr_authsize;\nextern\tint\tfr_authused;\nextern\tint\tfr_auth_lock;\nextern\tfrentry_t *fr_checkauth __P((fr_info_t *, u_32_t *));\nextern\tvoid\tfr_authexpire __P((void));\nextern\tint\tfr_authinit __P((void));\nextern\tvoid\tfr_authunload __P((void));\nextern\tint\tfr_authflush __P((void));\nextern\tmb_t\t**fr_authpkts;\nextern\tint\tfr_newauth __P((mb_t *, fr_info_t *));\nextern\tint\tfr_preauthcmd __P((ioctlcmd_t, frentry_t *, frentry_t **));\nextern\tint\tfr_auth_ioctl __P((caddr_t, ioctlcmd_t, int, int, void *));\nextern\tint\tfr_auth_waiting __P((void));\n\n#endif\t/* __IP_AUTH_H__ */\n"
  },
  {
    "path": "freebsd-headers/netinet/ip_carp.h",
    "content": "/*\t$FreeBSD: release/9.0.0/sys/netinet/ip_carp.h 211193 2010-08-11 20:18:19Z will $\t*/\n/*\t$OpenBSD: ip_carp.h,v 1.8 2004/07/29 22:12:15 mcbride Exp $\t*/\n\n/*\n * Copyright (c) 2002 Michael Shalayeff. All rights reserved.\n * Copyright (c) 2003 Ryan McBride. All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR\n * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES\n * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE AUTHOR OR HIS RELATIVES BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR\n * SERVICES; LOSS OF MIND, USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,\n * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING\n * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF\n * THE POSSIBILITY OF SUCH DAMAGE.\n */\n\n#ifndef _IP_CARP_H\n#define\t_IP_CARP_H\n\n/*\n * The CARP header layout is as follows:\n *\n *     0                   1                   2                   3\n *     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\n *    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\n *    |Version| Type  | VirtualHostID |    AdvSkew    |    Auth Len   |\n *    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\n *    |   Reserved    |     AdvBase   |          Checksum             |\n *    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\n *    |                         Counter (1)                           |\n *    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\n *    |                         Counter (2)                           |\n *    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\n *    |                        SHA-1 HMAC (1)                         |\n *    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\n *    |                        SHA-1 HMAC (2)                         |\n *    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\n *    |                        SHA-1 HMAC (3)                         |\n *    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\n *    |                        SHA-1 HMAC (4)                         |\n *    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\n *    |                        SHA-1 HMAC (5)                         |\n *    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\n *\n */\n\nstruct carp_header {\n#if BYTE_ORDER == LITTLE_ENDIAN\n\tu_int8_t\tcarp_type:4,\n\t\t\tcarp_version:4;\n#endif\n#if BYTE_ORDER == BIG_ENDIAN\n\tu_int8_t\tcarp_version:4,\n\t\t\tcarp_type:4;\n#endif\n\tu_int8_t\tcarp_vhid;\t/* virtual host id */\n\tu_int8_t\tcarp_advskew;\t/* advertisement skew */\n\tu_int8_t\tcarp_authlen;   /* size of counter+md, 32bit chunks */\n\tu_int8_t\tcarp_pad1;\t/* reserved */\n\tu_int8_t\tcarp_advbase;\t/* advertisement interval */\n\tu_int16_t\tcarp_cksum;\n\tu_int32_t\tcarp_counter[2];\n\tunsigned char\tcarp_md[20];\t/* SHA1 HMAC */\n} __packed;\n\n#ifdef CTASSERT\nCTASSERT(sizeof(struct carp_header) == 36);\n#endif\n\n#define\tCARP_DFLTTL\t\t255\n\n/* carp_version */\n#define\tCARP_VERSION\t\t2\n\n/* carp_type */\n#define\tCARP_ADVERTISEMENT\t0x01\n\n#define\tCARP_KEY_LEN\t\t20\t/* a sha1 hash of a passphrase */\n\n/* carp_advbase */\n#define\tCARP_DFLTINTV\t\t1\n\n/*\n * Statistics.\n */\nstruct carpstats {\n\tuint64_t\tcarps_ipackets;\t\t/* total input packets, IPv4 */\n\tuint64_t\tcarps_ipackets6;\t/* total input packets, IPv6 */\n\tuint64_t\tcarps_badif;\t\t/* wrong interface */\n\tuint64_t\tcarps_badttl;\t\t/* TTL is not CARP_DFLTTL */\n\tuint64_t\tcarps_hdrops;\t\t/* packets shorter than hdr */\n\tuint64_t\tcarps_badsum;\t\t/* bad checksum */\n\tuint64_t\tcarps_badver;\t\t/* bad (incl unsupp) version */\n\tuint64_t\tcarps_badlen;\t\t/* data length does not match */\n\tuint64_t\tcarps_badauth;\t\t/* bad authentication */\n\tuint64_t\tcarps_badvhid;\t\t/* bad VHID */\n\tuint64_t\tcarps_badaddrs;\t\t/* bad address list */\n\n\tuint64_t\tcarps_opackets;\t\t/* total output packets, IPv4 */\n\tuint64_t\tcarps_opackets6;\t/* total output packets, IPv6 */\n\tuint64_t\tcarps_onomem;\t\t/* no memory for an mbuf */\n\tuint64_t\tcarps_ostates;\t\t/* total state updates sent */\n\n\tuint64_t\tcarps_preempt;\t\t/* if enabled, preemptions */\n};\n\n#ifdef _KERNEL\n#define\tCARPSTATS_ADD(name, val)\tcarpstats.name += (val)\n#define\tCARPSTATS_INC(name)\t\tCARPSTATS_ADD(name, 1)\n#endif\n\n/*\n * Configuration structure for SIOCSVH SIOCGVH\n */\nstruct carpreq {\n\tint\t\tcarpr_state;\n#define\tCARP_STATES\t\"INIT\", \"BACKUP\", \"MASTER\"\n#define\tCARP_MAXSTATE\t2\n\tint\t\tcarpr_vhid;\n\tint\t\tcarpr_advskew;\n\tint\t\tcarpr_advbase;\n\tunsigned char\tcarpr_key[CARP_KEY_LEN];\n};\n#define\tSIOCSVH\t_IOWR('i', 245, struct ifreq)\n#define\tSIOCGVH\t_IOWR('i', 246, struct ifreq)\n\n/*\n * Names for CARP sysctl objects\n */\n#define\tCARPCTL_ALLOW\t\t1\t/* accept incoming CARP packets */\n#define\tCARPCTL_PREEMPT\t\t2\t/* high-pri backup preemption mode */\n#define\tCARPCTL_LOG\t\t3\t/* log bad packets */\n#define\tCARPCTL_STATS\t\t4\t/* statistics (read-only) */\n#define\tCARPCTL_ARPBALANCE\t5\t/* balance arp responses */\n#define\tCARPCTL_MAXID\t\t6\n\n#define\tCARPCTL_NAMES { \\\n\t{ 0, 0 }, \\\n\t{ \"allow\", CTLTYPE_INT }, \\\n\t{ \"preempt\", CTLTYPE_INT }, \\\n\t{ \"log\", CTLTYPE_INT }, \\\n\t{ \"stats\", CTLTYPE_STRUCT }, \\\n\t{ \"arpbalance\", CTLTYPE_INT }, \\\n}\n\n#ifdef _KERNEL\nvoid\t\t carp_carpdev_state(struct ifnet *);\nvoid\t\t carp_input (struct mbuf *, int);\nint\t\t carp6_input (struct mbuf **, int *, int);\nint\t\t carp_output (struct ifnet *, struct mbuf *, struct sockaddr *,\n\t\t     struct rtentry *);\nint\t\t carp_iamatch (struct ifnet *, struct in_ifaddr *, struct in_addr *,\n\t\t     u_int8_t **);\nstruct ifaddr\t*carp_iamatch6(struct ifnet *, struct in6_addr *);\ncaddr_t\t\tcarp_macmatch6(struct ifnet *, struct mbuf *, const struct in6_addr *);\nstruct\tifnet\t*carp_forus (struct ifnet *, u_char *);\n\n/* These are external networking stack hooks for CARP */\n/* net/if.c */\nextern void (*carp_linkstate_p)(struct ifnet *);\n/* net/if_bridge.c net/if_ethersubr.c */\nextern struct ifnet *(*carp_forus_p)(struct ifnet *, u_char *);\n/* net/if_ethersubr.c */\nextern int (*carp_output_p)(struct ifnet *, struct mbuf *,\n    struct sockaddr *, struct rtentry *);\n#ifdef INET\n/* netinet/if_ether.c */\nextern int (*carp_iamatch_p)(struct ifnet *, struct in_ifaddr *,\n    struct in_addr *, u_int8_t **);\n#endif\n#ifdef INET6\n/* netinet6/nd6_nbr.c */\nextern struct ifaddr *(*carp_iamatch6_p)(struct ifnet *, struct in6_addr *);\nextern caddr_t (*carp_macmatch6_p)(struct ifnet *, struct mbuf *,\n    const struct in6_addr *);\n#endif\n#endif\n#endif /* _IP_CARP_H */\n"
  },
  {
    "path": "freebsd-headers/netinet/ip_compat.h",
    "content": "/*\n * Copyright (C) 1993-2001, 2003 by Darren Reed.\n *\n * See the IPFILTER.LICENCE file for details on licencing.\n *\n * @(#)ip_compat.h\t1.8 1/14/96\n * $FreeBSD: release/9.0.0/sys/contrib/ipfilter/netinet/ip_compat.h 206627 2010-04-14 20:50:07Z imp $\n * Id: ip_compat.h,v 2.142.2.57 2007/10/10 09:51:42 darrenr Exp $\n */\n\n#ifndef\t__IP_COMPAT_H__\n#define\t__IP_COMPAT_H__\n\n#ifndef\t__P\n# ifdef\t__STDC__\n#  define\t__P(x)  x\n# else\n#  define\t__P(x)  ()\n# endif\n#endif\n#ifndef\t__STDC__\n# undef\t\tconst\n# define\tconst\n#endif\n\n#if defined(_KERNEL) || defined(KERNEL) || defined(__KERNEL__)\n# undef\tKERNEL\n# undef\t_KERNEL\n# undef \t__KERNEL__\n# define\tKERNEL\n# define\t_KERNEL\n# define \t__KERNEL__\n#endif\n\n#ifndef\tSOLARIS\n#define\tSOLARIS\t(defined(sun) && (defined(__svr4__) || defined(__SVR4)))\n#endif\n#if (defined(SOLARIS2) && (SOLARIS2 >= 8))\n# ifndef\tUSE_INET6\n#  define\tUSE_INET6\n# endif\n#endif\n#if defined(__FreeBSD_version) && (__FreeBSD_version >= 400000) && \\\n    !defined(_KERNEL) && !defined(USE_INET6) && !defined(NOINET6)\n# define\tUSE_INET6\n#endif\n#if defined(__NetBSD_Version__) && (__NetBSD_Version__ >= 105000000) && \\\n    !defined(_KERNEL) && !defined(USE_INET6)\n# define\tUSE_INET6\n# define\tIPFILTER_M_IPFILTER\n#endif\n#if defined(OpenBSD) && (OpenBSD >= 200206) && \\\n    !defined(_KERNEL) && !defined(USE_INET6)\n# define\tUSE_INET6\n#endif\n#if defined(__osf__)\n# define\tUSE_INET6\n#endif\n#if defined(linux) && (!defined(_KERNEL) || defined(CONFIG_IPV6))\n# define\tUSE_INET6\n#endif\n#if defined(HPUXREV) && (HPUXREV >= 1111)\n# define\tUSE_INET6\n#endif\n\n#if defined(BSD) && (BSD < 199103) && defined(__osf__)\n# undef BSD\n# define BSD 199103\n#endif\n\n#if defined(__SVR4) || defined(__svr4__) || defined(__sgi)\n# define index   strchr\n# if !defined(_KERNEL)\n#  define\tbzero(a,b)\tmemset(a,0,b)\n#  define\tbcmp\t\tmemcmp\n#  define\tbcopy(a,b,c)\tmemmove(b,a,c)\n# endif\n#endif\n\n#ifndef LIFNAMSIZ\n# ifdef IF_NAMESIZE\n#  define\tLIFNAMSIZ\tIF_NAMESIZE\n# else\n#  ifdef\tIFNAMSIZ\n#   define\tLIFNAMSIZ\tIFNAMSIZ\n#  else\n#   define\tLIFNAMSIZ\t16\n#  endif\n# endif\n#endif\n\n#if defined(__sgi) || defined(bsdi) || defined(__hpux) || defined(hpux)\nstruct  ether_addr {\n        u_char  ether_addr_octet[6];\n};\n#endif\n\n#if defined(__sgi) && !defined(IPFILTER_LKM)\n# ifdef __STDC__\n#  define IPL_EXTERN(ep) ipfilter##ep\n# else\n#  define IPL_EXTERN(ep) ipfilter/**/ep\n# endif\n#else\n# ifdef __STDC__\n#  define IPL_EXTERN(ep) ipl##ep\n# else\n#  define IPL_EXTERN(ep) ipl/**/ep\n# endif\n#endif\n\n/*\n * This is a workaround for <sys/uio.h> troubles on FreeBSD and OpenBSD.\n */\n#ifndef linux\n# ifndef _KERNEL\n#  define ADD_KERNEL\n#  define _KERNEL\n#  define KERNEL\n# endif\n# ifdef __OpenBSD__\nstruct file;\n# endif\n# include <sys/uio.h>\n# ifdef ADD_KERNEL\n#  undef _KERNEL\n#  undef KERNEL\n# endif\n#endif\n\n\n/* ----------------------------------------------------------------------- */\n/*                                  S O L A R I S                          */\n/* ----------------------------------------------------------------------- */\n#if SOLARIS\n# define\tMENTAT\t1\n# include\t<sys/cmn_err.h>\n# include\t<sys/isa_defs.h>\n# include\t<sys/stream.h>\n# include\t<sys/ioccom.h>\n# include\t<sys/sysmacros.h>\n# include\t<sys/kmem.h>\n# if defined(SOLARIS2) && SOLARIS2 >= 10\n#  include\t<sys/procset.h>\n#  include\t<sys/proc.h>\n#  include\t<sys/devops.h>\n#  include\t<sys/ddi_impldefs.h>\n# endif\n/*\n * because Solaris 2 defines these in two places :-/\n */\n# ifndef\tKERNEL\n#  define\t_KERNEL\n#  undef\tRES_INIT\n# endif /* _KERNEL */\n\n# if defined(SOLARIS2) && SOLARIS2 >= 8\n#  include <netinet/ip6.h>\n#  include <netinet/icmp6.h>\n# endif\n\n# include <inet/common.h>\n/* These 5 are defined in <inet/ip.h> and <netinet/ip.h> */\n# undef\tIPOPT_EOL\n# undef\tIPOPT_NOP\n# undef\tIPOPT_LSRR\n# undef\tIPOPT_RR\n# undef\tIPOPT_SSRR\n# ifdef i386\n#  define _SYS_PROMIF_H\n# endif\n# ifndef _KERNEL\n#  include \"radix_ipf.h\"\n# else\n#  include \"radix_ipf_local.h\"\n# endif\n# include <inet/ip.h>\n# undef COPYOUT\n# include <inet/ip_ire.h>\n# ifndef\tKERNEL\n#  undef\t_KERNEL\n# endif\n# if defined(SOLARIS2) && SOLARIS2 >= 8\n#  define SNPRINTF\tsnprintf\n\n#  include <inet/ip_if.h>\n#  define\tipif_local_addr\tipif_lcl_addr\n/* Only defined in private include file */\n#  ifndef\tV4_PART_OF_V6\n#   define\tV4_PART_OF_V6(v6)\tv6.s6_addr32[3]\n#  endif\nstruct ip6_ext {\n\tu_char\tip6e_nxt;\n\tu_char\tip6e_len;\n};\n# endif /* SOLARIS2 >= 8 */\n\n# if defined(SOLARIS2) && SOLARIS2 >= 6\n#  include <sys/atomic.h>\ntypedef\tuint32_t\tu_32_t;\n# else\ntypedef unsigned int\tu_32_t;\n# endif\n# define\tU_32_T\t1\n\n# ifdef _KERNEL\n#  define\tNEED_LOCAL_RAND\t1\n#  define\tipf_random\t\tarc4random\n#  define\tKRWLOCK_T\t\tkrwlock_t\n#  define\tKMUTEX_T\t\tkmutex_t\n\n#  if !defined(FW_HOOKS)\n#   include \"qif.h\"\n#   include \"pfil.h\"\n#  else\n#   include <sys/neti.h>\n\nextern net_data_t ipfipv4;\nextern net_data_t ipfipv6;\n\ntypedef struct qpktinfo {\n        void\t\t*qpi_data;\n\tmblk_t\t\t**qpi_mp;\n\tmblk_t\t\t*qpi_m;\n        uintptr_t\tqpi_real;\n\tint\t\tqpi_flags;\n        int\t\tqpi_num;\n        int\t\tqpi_off;\n} qpktinfo_t;\n#   define\tQF_GROUP\t\t0x01\n#  endif\n\n#  if SOLARIS2 >= 6\n#   if SOLARIS2 == 6\n#    define\tATOMIC_INCL(x)\t\tatomic_add_long((uint32_t*)&(x), 1)\n#    define\tATOMIC_DECL(x)\t\tatomic_add_long((uint32_t*)&(x), -1)\n#   else\n#    define\tATOMIC_INCL(x)\t\tatomic_add_long(&(x), 1)\n#    define\tATOMIC_DECL(x)\t\tatomic_add_long(&(x), -1)\n#   endif /* SOLARIS2 == 6 */\n#   define\tATOMIC_INC64(x)\t\tatomic_add_64((uint64_t*)&(x), 1)\n#   define\tATOMIC_INC32(x)\t\tatomic_add_32((uint32_t*)&(x), 1)\n#   define\tATOMIC_INC16(x)\t\tatomic_add_16((uint16_t*)&(x), 1)\n#   define\tATOMIC_DEC64(x)\t\tatomic_add_64((uint64_t*)&(x), -1)\n#   define\tATOMIC_DEC32(x)\t\tatomic_add_32((uint32_t*)&(x), -1)\n#   define\tATOMIC_DEC16(x)\t\tatomic_add_16((uint16_t*)&(x), -1)\n#  else\n#   define\tATOMIC_INC(x)\t\t{ mutex_enter(&ipf_rw); (x)++; \\\n\t\t\t\t\t  mutex_exit(&ipf_rw); }\n#   define\tATOMIC_DEC(x)\t\t{ mutex_enter(&ipf_rw); (x)--; \\\n\t\t\t\t\t  mutex_exit(&ipf_rw); }\n#  endif /* SOLARIS2 >= 6 */\n#  define\tUSE_MUTEXES\n#  define\tMUTEX_ENTER(x)\t\tmutex_enter(&(x)->ipf_lk)\n#  define\tREAD_ENTER(x)\t\trw_enter(&(x)->ipf_lk, RW_READER)\n#  define\tWRITE_ENTER(x)\t\trw_enter(&(x)->ipf_lk, RW_WRITER)\n#  define\tMUTEX_DOWNGRADE(x)\trw_downgrade(&(x)->ipf_lk)\n#  define\tRWLOCK_INIT(x, y)\trw_init(&(x)->ipf_lk, (y),  \\\n\t\t\t\t\t\tRW_DRIVER, NULL)\n#  define\tRWLOCK_EXIT(x)\t\trw_exit(&(x)->ipf_lk)\n#  define\tRW_DESTROY(x)\t\trw_destroy(&(x)->ipf_lk)\n#  define\tMUTEX_INIT(x, y)\tmutex_init(&(x)->ipf_lk, (y), \\\n\t\t\t\t\t\t   MUTEX_DRIVER, NULL)\n#  define\tMUTEX_DESTROY(x)\tmutex_destroy(&(x)->ipf_lk)\n#  define\tMUTEX_NUKE(x)\t\tbzero((x), sizeof(*(x)))\n#  define\tMUTEX_EXIT(x)\t\tmutex_exit(&(x)->ipf_lk)\n#  define\tCOPYIN(a,b,c)\tcopyin((caddr_t)(a), (caddr_t)(b), (c))\n#  define\tCOPYOUT(a,b,c)\tcopyout((caddr_t)(a), (caddr_t)(b), (c))\n#  define\tBCOPYIN(a,b,c)\tcopyin((caddr_t)(a), (caddr_t)(b), (c))\n#  define\tBCOPYOUT(a,b,c)\tcopyout((caddr_t)(a), (caddr_t)(b), (c))\n#  define\tUIOMOVE(a,b,c,d)\tuiomove((caddr_t)a,b,c,d)\n#  define\tKFREE(x)\tkmem_free((char *)(x), sizeof(*(x)))\n#  define\tKFREES(x,s)\tkmem_free((char *)(x), (s))\n#  define\tSPL_SCHED(x)\t;\n#  define\tSPL_NET(x)\t;\n#  define\tSPL_IMP(x)\t;\n#  undef\tSPL_X\n#  define\tSPL_X(x)\t;\n#  ifdef sparc\n#   define\tntohs(x)\t(x)\n#   define\tntohl(x)\t(x)\n#   define\thtons(x)\t(x)\n#   define\thtonl(x)\t(x)\n#  endif /* sparc */\n#  define\tKMALLOC(a,b)\t(a) = (b)kmem_alloc(sizeof(*(a)), KM_NOSLEEP)\n#  define\tKMALLOCS(a,b,c)\t(a) = (b)kmem_alloc((c), KM_NOSLEEP)\n#  define\tGET_MINOR(x)\tgetminor(x)\nextern\tvoid\t*get_unit __P((char *, int));\n#  define\tGETIFP(n, v)\tget_unit(n, v)\n#  if defined(_INET_IP_STACK_H)\n#   define\t COPYIFNAME(v, x, b) \\\n\t\t\t\tdo { \\\n\t\t\t\t\tif ((v) == 4) { \\\n\t\t\t\t\t\t(void) net_getifname(ipfipv4,\\\n\t\t\t\t\t\t\t(uintptr_t)x, b, \\\n\t\t\t\t\t\t\tLIFNAMSIZ); \\\n\t\t\t\t\t} else { \\\n\t\t\t\t\t\t(void) net_getifname(ipfipv6,\\\n\t\t\t\t\t\t\t(uintptr_t)x, b, \\\n\t\t\t\t\t\t\tLIFNAMSIZ); \\\n\t\t\t\t\t} \\\n\t\t\t\t} while (0)\n#  else\n#   define\t COPYIFNAME(v, x, b) \\\n\t\t\t\t(void) strncpy(b, ((qif_t *)x)->qf_name, \\\n\t\t\t\t\t       LIFNAMSIZ)\n#  endif\n#  define\tGETKTIME(x)\tuniqtime((struct timeval *)x)\n#  define\tMSGDSIZE(x)\tmsgdsize(x)\n#  define\tM_LEN(x)\t((x)->b_wptr - (x)->b_rptr)\n#  define\tM_DUPLICATE(x)\tdupmsg((x))\n#  define\tMTOD(m,t)\t((t)((m)->b_rptr))\n#  define\tMTYPE(m)\t((m)->b_datap->db_type)\n#  define\tFREE_MB_T(m)\tfreemsg(m)\n#  define\tm_next\t\tb_cont\n#  if !defined(_INET_IP_STACK_H)\n#   define\tCACHE_HASH(x)\t(((qpktinfo_t *)(x)->fin_qpi)->qpi_num & 7)\n#  else\n#   define\tCACHE_HASH(x)\t((uintptr_t)(x)->fin_ifp & 7)\n#  endif\n#  define\tIPF_PANIC(x,y)\tif (x) { printf y; cmn_err(CE_PANIC, \"ipf_panic\"); }\ntypedef mblk_t mb_t;\n# endif /* _KERNEL */\n\n# if defined(SOLARIS2) && (SOLARIS2 >= 7)\n#  ifdef lint\n#   define ALIGN32(ptr)    (ptr ? 0L : 0L)\n#   define ALIGN16(ptr)    (ptr ? 0L : 0L)\n#  else\n#   define ALIGN32(ptr)    (ptr)\n#   define ALIGN16(ptr)    (ptr)\n#  endif\n# endif\n\n# if defined(SOLARIS2) && SOLARIS2 < 6\ntypedef\tstruct uio\tuio_t;\n# endif\ntypedef\tint\t\tioctlcmd_t;\ntypedef\tuint8_t\t\tu_int8_t;\n\n# define OS_RECOGNISED 1\n\n#endif /* SOLARIS */\n\n/* ----------------------------------------------------------------------- */\n/*                                  H P U X                                */\n/* ----------------------------------------------------------------------- */\n#ifdef __hpux\n# define\tMENTAT\t1\n# include\t<sys/sysmacros.h>\n# include\t<sys/spinlock.h>\n# include\t<sys/lock.h>\n# include\t<sys/stream.h>\n# ifdef USE_INET6\n#  include\t<netinet/if_ether.h>\n#  include\t<netinet/ip6.h>\n#  include\t<netinet/icmp6.h>\ntypedef\tstruct\tip6_hdr\tip6_t;\n# endif\n\n# ifdef _KERNEL\n#  define SNPRINTF\tsprintf\n#  if (HPUXREV >= 1111)\n#   define\tIPL_SELECT\n#   ifdef\tIPL_SELECT\n#    include\t<machine/sys/user.h>\n#    include\t<sys/kthread_iface.h>\n#    define\tREAD_COLLISION\t0x01\n\ntypedef\tstruct\tiplog_select_s {\n\tkthread_t\t*read_waiter;\n\tint\t\tstate;\n} iplog_select_t;\n#   endif\n#  endif\n\n#  define\tGETKTIME(x)\tuniqtime((struct timeval *)x)\n\n#  if HPUXREV == 1111\n#   include\t\"kern_svcs.h\"\n#  else\n#   include\t<sys/kern_svcs.h>\n#  endif\n#  undef\tti_flags\n#  undef\tTCP_NODELAY\n#  undef\tTCP_MAXSEG\n#  include <sys/reg.h>\n#  include \"../netinet/ip_info.h\"\n/*\n * According to /usr/include/sys/spinlock.h on HP-UX 11.00, these functions\n * are available.  Attempting to use them actually results in unresolved\n * symbols when it comes time to load the module.\n * This has been fixed!  Yipee!\n */\n#  if 1\n#   ifdef __LP64__\n#    define\tATOMIC_INCL(x)\t\tlock_and_incr_int64(&ipf_rw.ipf_lk, &(x), 1)\n#    define\tATOMIC_DECL(x)\t\tlock_and_incr_int64(&ipf_rw.ipf_lk, &(x), -1)\n#   else\n#    define\tATOMIC_INCL(x)\t\tlock_and_incr_int32(&ipf_rw.ipf_lk, &(x), 1)\n#    define\tATOMIC_DECL(x)\t\tlock_and_incr_int32(&ipf_rw.ipf_lk, &(x), -1)\n#   endif\n#   define\tATOMIC_INC64(x)\t\tlock_and_incr_int64(&ipf_rw.ipf_lk, &(x), 1)\n#   define\tATOMIC_INC32(x)\t\tlock_and_incr_int32(&ipf_rw.ipf_lk, &(x), 1)\n#   define\tATOMIC_INC16(x)\t\tlock_and_incr_int16(&ipf_rw.ipf_lk, &(x), 1)\n#   define\tATOMIC_DEC64(x)\t\tlock_and_incr_int64(&ipf_rw.ipf_lk, &(x), -1)\n#   define\tATOMIC_DEC32(x)\t\tlock_and_incr_int32(&ipf_rw.ipf_lk, &(x), -1)\n#   define\tATOMIC_DEC16(x)\t\tlock_and_incr_int16(&ipf_rw.ipf_lk, &(x), -1)\n#  else /* 0 */\n#   define\tATOMIC_INC64(x)\t\t{ MUTEX_ENTER(&ipf_rw); (x)++; \\\n\t\t\t\t\t  MUTEX_EXIT(&ipf_rw); }\n#   define\tATOMIC_DEC64(x)\t\t{ MUTEX_ENTER(&ipf_rw); (x)--; \\\n\t\t\t\t\t  MUTEX_EXIT(&ipf_rw); }\n#   define\tATOMIC_INC32(x)\t\t{ MUTEX_ENTER(&ipf_rw); (x)++; \\\n\t\t\t\t\t  MUTEX_EXIT(&ipf_rw); }\n#   define\tATOMIC_DEC32(x)\t\t{ MUTEX_ENTER(&ipf_rw); (x)--; \\\n\t\t\t\t\t  MUTEX_EXIT(&ipf_rw); }\n#   define\tATOMIC_INCL(x)\t\t{ MUTEX_ENTER(&ipf_rw); (x)++; \\\n\t\t\t\t\t  MUTEX_EXIT(&ipf_rw); }\n#   define\tATOMIC_DECL(x)\t\t{ MUTEX_ENTER(&ipf_rw); (x)--; \\\n\t\t\t\t\t  MUTEX_EXIT(&ipf_rw); }\n#   define\tATOMIC_INC(x)\t\t{ MUTEX_ENTER(&ipf_rw); (x)++; \\\n\t\t\t\t\t  MUTEX_EXIT(&ipf_rw); }\n#   define\tATOMIC_DEC(x)\t\t{ MUTEX_ENTER(&ipf_rw); (x)--; \\\n\t\t\t\t\t  MUTEX_EXIT(&ipf_rw); }\n#  endif\n#  define\tip_cksum\t\tip_csuma\n#  define\tmemcpy(a,b,c)\t\tbcopy((caddr_t)b, (caddr_t)a, c)\n#  define\tUSE_MUTEXES\n#  define\tMUTEX_INIT(x, y)\tinitlock(&(x)->ipf_lk, 0, 0, (y))\n#  define\tMUTEX_ENTER(x)\t\tspinlock(&(x)->ipf_lk)\n#  define\tMUTEX_EXIT(x)\t\tspinunlock(&(x)->ipf_lk);\n#  define\tMUTEX_DESTROY(x)\n#  define\tMUTEX_NUKE(x)\t\tbzero((char *)(x), sizeof(*(x)))\n#  define\tKMUTEX_T\t\tlock_t\n#  define\tkmutex_t\t\tlock_t\t\t/* for pfil.h */\n#  define\tkrwlock_t\t\tlock_t\t\t/* for pfil.h */\n/*\n * The read-write lock implementation in HP-UX 11.0 is crippled - it can\n * only be used by threads working in a user context!\n * This has been fixed!  Yipee! (Or at least it does in 11.00, not 11.11..)\n */\n#  if HPUXREV < 1111\n#   define\tMUTEX_DOWNGRADE(x)\tlock_write_to_read(x)\n#   define\tKRWLOCK_T\t\tstruct rw_lock\n#   define\tREAD_ENTER(x)\t\tlock_read(&(x)->ipf_lk)\n#   define\tWRITE_ENTER(x)\t\tlock_write(&(x)->ipf_lk)\n#   if HPUXREV >= 1111\n#    define\tRWLOCK_INIT(x, y)\trwlock_init4(&(x)->ipf_lk, 0, RWLCK_CANSLEEP, 0, y)\n#   else\n#    define\tRWLOCK_INIT(x, y)\tlock_init3(&(x)->ipf_lk, 0, 1, 0, 0, y)\n#   endif\n#   define\tRWLOCK_EXIT(x)\t\tlock_done(&(x)->ipf_lk)\n#  else\n#   define\tKRWLOCK_T\t\tlock_t\n#   define\tKMUTEX_T\t\tlock_t\n#   define\tREAD_ENTER(x)\t\tMUTEX_ENTER(x)\n#   define\tWRITE_ENTER(x)\t\tMUTEX_ENTER(x)\n#   define\tMUTEX_DOWNGRADE(x)\n#   define\tRWLOCK_INIT(x, y)\tinitlock(&(x)->ipf_lk, 0, 0, y)\n#   define\tRWLOCK_EXIT(x)\t\tMUTEX_EXIT(x)\n#  endif\n#  define\tRW_DESTROY(x)\n#  define\tCOPYIN(a,b,c)\tcopyin((caddr_t)(a), (caddr_t)(b), (c))\n#  define\tCOPYOUT(a,b,c)\tcopyout((caddr_t)(a), (caddr_t)(b), (c))\n#  define\tSPL_SCHED(x)\t;\n#  define\tSPL_NET(x)\t;\n#  define\tSPL_IMP(x)\t;\n#  undef\tSPL_X\n#  define\tSPL_X(x)\t;\nextern\tvoid\t*get_unit __P((char *, int));\n#  define\tGETIFP(n, v)\tget_unit(n, v)\n#  define\tCOPYIFNAME(v, x, b) \\\n\t\t\t\t(void) strncpy(b, ((qif_t *)x)->qf_name, \\\n\t\t\t\t\t       LIFNAMSIZ)\n#  define\tUIOMOVE(a,b,c,d)\tuiomove((caddr_t)a,b,c,d)\n#  define\tSLEEP(id, n)\t{ lock_t *_l = get_sleep_lock((caddr_t)id); \\\n\t\t\t\t  sleep(id, PZERO+1); \\\n\t\t\t\t  spinunlock(_l); \\\n\t\t\t\t}\n#  define\tWAKEUP(id,x)\t{ lock_t *_l = get_sleep_lock((caddr_t)id); \\\n\t\t\t\t  wakeup(id + x); \\\n\t\t\t\t  spinunlock(_l); \\\n\t\t\t\t}\n#  define\tPOLLWAKEUP(x)\t;\n#  define\tKMALLOC(a, b)\tMALLOC((a), b, sizeof(*(a)), M_IOSYS, M_NOWAIT)\n#  define\tKMALLOCS(a, b, c)\tMALLOC((a), b, (c), M_IOSYS, M_NOWAIT)\n#  define\tKFREE(x)\tkmem_free((char *)(x), sizeof(*(x)))\n#  define\tKFREES(x,s)\tkmem_free((char *)(x), (s))\n#  define\tMSGDSIZE(x)\tmsgdsize(x)\n#  define\tM_LEN(x)\t((x)->b_wptr - (x)->b_rptr)\n#  define\tM_DUPLICATE(x)\tdupmsg((x))\n#  define\tMTOD(m,t)\t((t)((m)->b_rptr))\n#  define\tMTYPE(m)\t((m)->b_datap->db_type)\n#  define\tFREE_MB_T(m)\tfreemsg(m)\n#  define\tm_next\t\tb_cont\n#  define\tIPF_PANIC(x,y)\tif (x) { printf y; panic(\"ipf_panic\"); }\ntypedef mblk_t mb_t;\n\n#  define\tCACHE_HASH(x)\t(((qpktinfo_t *)(x)->fin_qpi)->qpi_num & 7)\n\n#  include \"qif.h\"\n#  include \"pfil.h\"\n\n# else /* _KERNEL */\n\ntypedef\tunsigned char uchar_t;\n\n#  ifndef\t_SYS_STREAM_INCLUDED\ntypedef char * mblk_t;\ntypedef void * queue_t;\ntypedef\tu_long ulong;\n#  endif\n#  include <netinet/ip_info.h>\n\n# endif /* _KERNEL */\n\n# ifdef lint\n#  define ALIGN32(ptr)    (ptr ? 0L : 0L)\n#  define ALIGN16(ptr)    (ptr ? 0L : 0L)\n# else\n#  define ALIGN32(ptr)    (ptr)\n#  define ALIGN16(ptr)    (ptr)\n# endif\n\ntypedef\tstruct uio\tuio_t;\ntypedef\tint\t\tioctlcmd_t;\ntypedef\tint\t\tminor_t;\ntypedef unsigned int\tu_32_t;\n# define\tU_32_T\t1\n\n# define OS_RECOGNISED 1\n\n#endif /* __hpux */\n\n/* ----------------------------------------------------------------------- */\n/*                                  I R I X                                */\n/* ----------------------------------------------------------------------- */\n#ifdef __sgi\n# undef\t\tMENTAT\n# if IRIX < 60500\ntypedef\tstruct uio\tuio_t;\n# endif\ntypedef\tint\t\tioctlcmd_t;\ntypedef u_int32_t       u_32_t;\n# define\tU_32_T\t1\n\n# ifdef INET6\n#  define USE_INET6\n# endif\n\n# define  hz HZ\n# include <sys/ksynch.h>\n# define\tIPF_LOCK_PL\tplhi\n# include <sys/sema.h>\n# undef kmutex_t\ntypedef struct {\n\tlock_t *l;\n\tint pl;\n} kmutex_t;\n\n# ifdef MUTEX_INIT\n#  define\tKMUTEX_T\t\tmutex_t\n# else\n#  define\tKMUTEX_T\t\tkmutex_t\n#  define\tKRWLOCK_T\t\tkmutex_t\n# endif\n\n# ifdef _KERNEL\n#  define\tNEED_LOCAL_RAND\t1\n#  define\tipf_random\t\tarc4random\n#  define\tATOMIC_INC(x)\t\t{ MUTEX_ENTER(&ipf_rw); \\\n\t\t\t\t\t  (x)++; MUTEX_EXIT(&ipf_rw); }\n#  define\tATOMIC_DEC(x)\t\t{ MUTEX_ENTER(&ipf_rw); \\\n\t\t\t\t\t  (x)--; MUTEX_EXIT(&ipf_rw); }\n#  define\tUSE_MUTEXES\n#  ifdef MUTEX_INIT\n#   include <sys/atomic_ops.h>\n#   define\tATOMIC_INCL(x)\t\tatomicAddUlong(&(x), 1)\n#   define\tATOMIC_INC64(x)\t\tatomicAddUint64(&(x), 1)\n#   define\tATOMIC_INC32(x)\t\tatomicAddUint(&(x), 1)\n#   define\tATOMIC_INC16\t\tATOMIC_INC\n#   define\tATOMIC_DECL(x)\t\tatomicAddUlong(&(x), -1)\n#   define\tATOMIC_DEC64(x)\t\tatomicAddUint64(&(x), -1)\n#   define\tATOMIC_DEC32(x)\t\tatomicAddUint(&(x), -1)\n#   define\tATOMIC_DEC16\t\tATOMIC_DEC\n#   undef\tMUTEX_INIT\n#   define\tMUTEX_INIT(x, y)\tmutex_init(&(x)->ipf_lk,  \\\n\t\t\t\t\t\t   MUTEX_DEFAULT, y)\n#   undef\tMUTEX_ENTER\n#   define\tMUTEX_ENTER(x)\t\tmutex_lock(&(x)->ipf_lk, 0)\n#   undef\tMUTEX_EXIT\n#   define\tMUTEX_EXIT(x)\t\tmutex_unlock(&(x)->ipf_lk)\n#   undef\tMUTEX_DESTROY\n#   define\tMUTEX_DESTROY(x)\tmutex_destroy(&(x)->ipf_lk)\n#   define\tMUTEX_DOWNGRADE(x)\tmrdemote(&(x)->ipf_lk)\n#   define\tKRWLOCK_T\t\tmrlock_t\n#   define\tRWLOCK_INIT(x, y)\tmrinit(&(x)->ipf_lk, y)\n#   undef\tRW_DESTROY\n#   define\tRW_DESTROY(x)\t\tmrfree(&(x)->ipf_lk)\n#   define\tREAD_ENTER(x)\t\tRW_RDLOCK(&(x)->ipf_lk)\n#   define\tWRITE_ENTER(x)\t\tRW_WRLOCK(&(x)->ipf_lk)\n#   define\tRWLOCK_EXIT(x)\t\tRW_UNLOCK(&(x)->ipf_lk)\n#  else\n#   define\tREAD_ENTER(x)\t\tMUTEX_ENTER(&(x)->ipf_lk)\n#   define\tWRITE_ENTER(x)\t\tMUTEX_ENTER(&(x)->ipf_lk)\n#   define\tMUTEX_DOWNGRADE(x)\t;\n#   define\tRWLOCK_EXIT(x)\t\tMUTEX_EXIT(&(x)->ipf_lk)\n#   define\tMUTEX_EXIT(x)\t\tUNLOCK((x)->ipf_lk.l, (x)->ipf_lk.pl);\n#   define\tMUTEX_INIT(x,y)\t\t(x)->ipf_lk.l = LOCK_ALLOC((uchar_t)-1, IPF_LOCK_PL, (lkinfo_t *)-1, KM_NOSLEEP)\n#   define\tMUTEX_DESTROY(x)\tLOCK_DEALLOC((x)->ipf_lk.l)\n#   define\tMUTEX_ENTER(x)\t\t(x)->ipf_lk.pl = LOCK((x)->ipf_lk.l, \\\n\t\t\t\t\t\t\t      IPF_LOCK_PL);\n#  endif\n#  define\tMUTEX_NUKE(x)\t\tbzero((x), sizeof(*(x)))\n#  define\tFREE_MB_T(m)\tm_freem(m)\n#  define\tMTOD(m,t)\tmtod(m,t)\n#  define\tCOPYIN(a,b,c)\t(bcopy((caddr_t)(a), (caddr_t)(b), (c)), 0)\n#  define\tCOPYOUT(a,b,c)\t(bcopy((caddr_t)(a), (caddr_t)(b), (c)), 0)\n#  define\tUIOMOVE(a,b,c,d)\tuiomove((caddr_t)a,b,c,d)\n#  define\tSLEEP(id, n)\tsleep((id), PZERO+1)\n#  define\tWAKEUP(id,x)\twakeup(id+x)\n#  define\tPOLLWAKEUP(x)\t;\n#  define\tKFREE(x)\tkmem_free((char *)(x), sizeof(*(x)))\n#  define\tKFREES(x,s)\tkmem_free((char *)(x), (s))\n#  define\tGETIFP(n,v)\tifunit(n)\n#  include <sys/kmem.h>\n#  include <sys/ddi.h>\n#  define\tKMALLOC(a,b)\t(a) = (b)kmem_alloc(sizeof(*(a)), KM_NOSLEEP)\n#  define\tKMALLOCS(a,b,c)\t(a) = (b)kmem_alloc((c), KM_NOSLEEP)\n#  define\tGET_MINOR(x)\tgetminor(x)\n#  define\tUSE_SPL\t\t1\n#  define\tSPL_IMP(x)\t(x) = splimp()\n#  define\tSPL_NET(x)\t(x) = splnet()\n#  define\tSPL_SCHED(x)\t(x) = splsched()\n#  define\tSPL_X(x)\t(void) splx(x)\nextern\tvoid\tm_copydata __P((struct mbuf *, int, int, caddr_t));\nextern\tvoid\tm_copyback __P((struct mbuf *, int, int, caddr_t));\n#  define\tMSGDSIZE(x)\tmbufchainlen(x)\n#  define\tM_LEN(x)\t(x)->m_len\n#  define\tM_DUPLICATE(x)\tm_copy((x), 0, M_COPYALL)\n#  define\tGETKTIME(x)\tmicrotime((struct timeval *)x)\n#  define\tIFNAME(x)\t((struct ifnet *)x)->if_name\n#  define\tCACHE_HASH(x)\t((IFNAME(fin->fin_ifp)[0] + \\\n\t\t\t\t  ((struct ifnet *)fin->fin_ifp)->if_unit) & 7)\n#  define\tIPF_PANIC(x,y)\tif (x) { printf y; panic(\"ipf_panic\"); }\ntypedef struct mbuf mb_t;\n# else\n#  undef RW_DESTROY\n#  undef MUTEX_INIT\n#  undef MUTEX_DESTROY\n# endif /* _KERNEL */\n\n# define OS_RECOGNISED 1\n\n#endif /* __sgi */\n\n/* ----------------------------------------------------------------------- */\n/*                                  T R U 6 4                              */\n/* ----------------------------------------------------------------------- */\n#ifdef __osf__\n# undef\t\tMENTAT\n\n# include <kern/lock.h>\n# include <sys/sysmacros.h>\n\n# ifdef _KERNEL\n#  define\tNEED_LOCAL_RAND\t\t1\n#  define\tipf_random\t\tarc4random\n#  define\tKMUTEX_T\t\tsimple_lock_data_t\n#  define\tKRWLOCK_T\t\tlock_data_t\n#  include <net/net_globals.h>\n#  define\tUSE_MUTEXES\n#  define\tREAD_ENTER(x)\t\tlock_read(&(x)->ipf_lk)\n#  define\tWRITE_ENTER(x)\t\tlock_write(&(x)->ipf_lk)\n#  define\tMUTEX_DOWNGRADE(x)\tlock_write_to_read(&(x)->ipf_lk)\n#  define\tRWLOCK_INIT(x, y)\tlock_init(&(x)->ipf_lk, TRUE)\n#  define\tRWLOCK_EXIT(x)\t\tlock_done(&(x)->ipf_lk)\n#  define\tRW_DESTROY(x)\t\tlock_terminate(&(x)->ipf_lk)\n#  define\tMUTEX_ENTER(x)\t\tsimple_lock(&(x)->ipf_lk)\n#  define\tMUTEX_INIT(x, y)\tsimple_lock_init(&(x)->ipf_lk)\n#  define\tMUTEX_DESTROY(x)\tsimple_lock_terminate(&(x)->ipf_lk)\n#  define\tMUTEX_EXIT(x)\t\tsimple_unlock(&(x)->ipf_lk)\n#  define\tMUTEX_NUKE(x)\t\tbzero(x, sizeof(*(x)))\n#  define\tATOMIC_INC64(x)\t\tatomic_incq((uint64_t*)&(x))\n#  define\tATOMIC_DEC64(x)\t\tatomic_decq((uint64_t*)&(x))\n#  define\tATOMIC_INC32(x)\t\tatomic_incl((uint32_t*)&(x))\n#  define\tATOMIC_DEC32(x)\t\tatomic_decl((uint32_t*)&(x))\n#  define\tATOMIC_INC16(x)\t\t{ simple_lock(&ipf_rw); (x)++; \\\n\t\t\t\t\t  simple_unlock(&ipf_rw); }\n#  define\tATOMIC_DEC16(x)\t\t{ simple_lock(&ipf_rw); (x)--; \\\n\t\t\t\t\t  simple_unlock(&ipf_rw); }\n#  define\tATOMIC_INCL(x)\t\tatomic_incl((uint32_t*)&(x))\n#  define\tATOMIC_DECL(x)\t\tatomic_decl((uint32_t*)&(x))\n#  define\tATOMIC_INC(x)\t\t{ simple_lock(&ipf_rw); (x)++; \\\n\t\t\t\t\t  simple_unlock(&ipf_rw); }\n#  define\tATOMIC_DEC(x)\t\t{ simple_lock(&ipf_rw); (x)--; \\\n\t\t\t\t\t  simple_unlock(&ipf_rw); }\n#  define\tSPL_SCHED(x)\t\t;\n#  define\tSPL_NET(x)\t\t;\n#  define\tSPL_IMP(x)\t\t;\n#  undef\tSPL_X\n#  define\tSPL_X(x)\t\t;\n#  define\tUIOMOVE(a,b,c,d)\tuiomove((caddr_t)a, b, d)\n#  define\tFREE_MB_T(m)\t\tm_freem(m)\n#  define\tMTOD(m,t)\t\tmtod(m,t)\n#  define\tGETIFP(n, v)\t\tifunit(n)\n#  define\tGET_MINOR\t\tgetminor\n#  define\tWAKEUP(id,x)\t\twakeup(id + x)\n#  define\tPOLLWAKEUP(x)\t\t;\n#  define\tCOPYIN(a,b,c)\tcopyin((caddr_t)(a), (caddr_t)(b), (c))\n#  define\tCOPYOUT(a,b,c)\tcopyout((caddr_t)(a), (caddr_t)(b), (c))\n#  define\tKMALLOC(a, b)\tMALLOC((a), b, sizeof(*(a)), M_PFILT, M_NOWAIT)\n#  define\tKMALLOCS(a, b, c)\tMALLOC((a), b, (c), M_PFILT, \\\n\t\t\t\t\t    ((c) > 4096) ? M_WAITOK : M_NOWAIT)\n#  define\tKFREE(x)\tFREE((x), M_PFILT)\n#  define\tKFREES(x,s)\tFREE((x), M_PFILT)\n#  define\tMSGDSIZE(x)\tmbufchainlen(x)\n#  define\tM_LEN(x)\t(x)->m_len\n#  define\tM_DUPLICATE(x)\tm_copy((x), 0, M_COPYALL)\n#  define\tGETKTIME(x)\tmicrotime((struct timeval *)x)\n#  define\tIFNAME(x)\t((struct ifnet *)x)->if_name\n#  define\tCACHE_HASH(x)\t((IFNAME(fin->fin_ifp)[0] + \\\n\t\t\t\t  ((struct ifnet *)fin->fin_ifp)->if_unit) & 7)\n#  define\tIPF_PANIC(x,y)\tif (x) { printf y; panic(\"ipf_panic\"); }\ntypedef struct mbuf mb_t;\n# endif /* _KERNEL */\n\n# if (defined(_KERNEL) || defined(_NO_BITFIELDS) || (__STDC__ == 1))\n#  define\tIP_V(x)\t\t((x)->ip_vhl >> 4)\n#  define\tIP_HL(x)\t((x)->ip_vhl & 0xf)\n#  define\tIP_V_A(x,y)\t(x)->ip_vhl |= (((y) << 4) & 0xf0)\n#  define\tIP_HL_A(x,y)\t(x)->ip_vhl |= ((y) & 0xf)\n#  define\tTCP_X2(x)\t((x)->th_xoff & 0xf)\n#  define\tTCP_X2_A(x,y)\t(x)->th_xoff |= ((y) & 0xf)\n#  define\tTCP_OFF(x)\t((x)->th_xoff >> 4)\n#  define\tTCP_OFF_A(x,y)\t(x)->th_xoff |= (((y) << 4) & 0xf0)\n# endif\n\n/*\n * These are from's Solaris' #defines for little endian.\n */\n#define\tIP6F_MORE_FRAG\t\t0x0100\n#define\tIP6F_RESERVED_MASK\t0x0600\n#define\tIP6F_OFF_MASK\t\t0xf8ff\n\nstruct ip6_ext {\n\tu_char\tip6e_nxt;\n\tu_char\tip6e_len;\n};\n\ntypedef\tint\t\tioctlcmd_t;  \n/*\n * Really, any arch where sizeof(long) != sizeof(int).\n */\ntypedef unsigned int    u_32_t;\n# define\tU_32_T\t1\n\n# define OS_RECOGNISED 1\n#endif /* __osf__ */\n\n/* ----------------------------------------------------------------------- */\n/*                                  N E T B S D                            */\n/* ----------------------------------------------------------------------- */\n#ifdef __NetBSD__\n# if (NetBSD >= 199905) && !defined(IPFILTER_LKM) && defined(_KERNEL)\n#  include \"opt_ipfilter.h\"\n# endif\n# if defined(_KERNEL)\n#  include <sys/systm.h>\n# else\n#  include <stddef.h>\n# endif\n# if defined(_KERNEL) && !defined(IPFILTER_LKM)\n#  include \"bpfilter.h\"\n#  if defined(__NetBSD_Version__) && (__NetBSD_Version__ >= 104110000)\n#   include \"opt_inet.h\"\n#  endif\n#  ifdef INET6\n#   define USE_INET6\n#  endif\n#  if (__NetBSD_Version__ >= 105000000)\n#   define HAVE_M_PULLDOWN 1\n#  endif\n# endif\n\n# if (__NetBSD_Version__ >= 499000000)\ntypedef\tchar *\tcaddr_t;\n# endif\n\n# define\tipf_random\tarc4random\n\n# ifdef _KERNEL\n#  if (__NetBSD_Version__ >= 399001400)\n#   define\tKMALLOCS(a, b, c)\t(a) = (b)malloc((c), _M_IPF, M_NOWAIT)\n#  endif\n#  define\tMSGDSIZE(x)\tmbufchainlen(x)\n#  define\tM_LEN(x)\t(x)->m_len\n#  define\tM_DUPLICATE(x)\tm_copy((x), 0, M_COPYALL)\n#  define\tGETKTIME(x)\tmicrotime((struct timeval *)x)\n#  define\tIPF_PANIC(x,y)\tif (x) { printf y; panic(\"ipf_panic\"); }\n#  define\tCOPYIN(a,b,c)\tcopyin((caddr_t)(a), (caddr_t)(b), (c))\n#  define\tCOPYOUT(a,b,c)\tcopyout((caddr_t)(a), (caddr_t)(b), (c))\ntypedef struct mbuf mb_t;\n# endif /* _KERNEL */\n# if (NetBSD <= 1991011) && (NetBSD >= 199606)\n#  define\tIFNAME(x)\t((struct ifnet *)x)->if_xname\n#  define\tCOPYIFNAME(v, x, b) \\\n\t\t\t\t(void) strncpy(b, \\\n\t\t\t\t\t       ((struct ifnet *)x)->if_xname, \\\n\t\t\t\t\t       LIFNAMSIZ)\n#  define\tCACHE_HASH(x)\t((((struct ifnet *)fin->fin_ifp)->if_index)&7)\n# else\n#  define\tIFNAME(x)\t((struct ifnet *)x)->if_name\n#  define\tCACHE_HASH(x)\t((IFNAME(fin->fin_ifp)[0] + \\\n\t\t\t\t  ((struct ifnet *)fin->fin_ifp)->if_unit) & 7)\n# endif\ntypedef\tstruct uio\tuio_t;\ntypedef\tu_long\t\tioctlcmd_t;  \ntypedef\tint\t\tminor_t;\ntypedef\tu_int32_t\tu_32_t;\n# define\tU_32_T\t1\n\n# define OS_RECOGNISED 1\n#endif /* __NetBSD__ */\n\n\n/* ----------------------------------------------------------------------- */\n/*                                F R E E B S D                            */\n/* ----------------------------------------------------------------------- */\n#ifdef __FreeBSD__\n# if  (__FreeBSD_version < 400000)\n#  define\tNEED_LOCAL_RAND\t1\n# else\n#  define\tipf_random\tarc4random\n# endif\n# if defined(_KERNEL)\n#  if (__FreeBSD_version >= 500000)                          \n#   include \"opt_bpf.h\"\n#  else\n#   include \"bpf.h\"    \n#  endif\n#  if defined(__FreeBSD_version) && (__FreeBSD_version >= 400000)\n#   include \"opt_inet6.h\"\n#  endif\n#  if defined(INET6) && !defined(USE_INET6)\n#   define USE_INET6\n#  endif\n# endif\n\n# if defined(_KERNEL)\n#  if (__FreeBSD_version >= 400000)\n/*\n * When #define'd, the 5.2.1 kernel panics when used with the ftp proxy.\n * There may be other, safe, kernels but this is not extensively tested yet.\n */\n#   define HAVE_M_PULLDOWN\n#  endif\n#  if !defined(IPFILTER_LKM) && (__FreeBSD_version >= 300000)\n#   include \"opt_ipfilter.h\"\n#  endif\n#  define\tCOPYIN(a,b,c)\tcopyin((caddr_t)(a), (caddr_t)(b), (c))\n#  define\tCOPYOUT(a,b,c)\tcopyout((caddr_t)(a), (caddr_t)(b), (c))\n\n#  if (__FreeBSD_version >= 500043)\n#   define NETBSD_PF\n#  endif\n# endif /* _KERNEL */\n\n# if (__FreeBSD_version >= 500043)\n#  include <sys/mutex.h>\n#  if (__FreeBSD_version > 700014)\n#   include <sys/rwlock.h>\n#    define\tKRWLOCK_T\t\tstruct rwlock\n#    ifdef _KERNEL\n#     define\tREAD_ENTER(x)\t\trw_rlock(&(x)->ipf_lk)\n#     define\tWRITE_ENTER(x)\t\trw_wlock(&(x)->ipf_lk)\n#     define\tMUTEX_DOWNGRADE(x)\trw_downgrade(&(x)->ipf_lk)\n#     define\tRWLOCK_INIT(x, y)\trw_init(&(x)->ipf_lk, (y))\n#     define\tRW_DESTROY(x)\t\trw_destroy(&(x)->ipf_lk)\n#     define\tRWLOCK_EXIT(x)\t\tdo { \\\n\t\t\t\t\t    if (rw_wowned(&(x)->ipf_lk)) \\\n\t\t\t\t\t\trw_wunlock(&(x)->ipf_lk); \\\n \t\t\t\t\t    else \\\n\t\t\t\t\t\trw_runlock(&(x)->ipf_lk); \\\n\t\t\t\t\t} while (0)\n#   endif\n#  else\n#   include <sys/sx.h>\n/*\n * Whilst the sx(9) locks on FreeBSD have the right semantics and interface\n * for what we want to use them for, despite testing showing they work -\n * with a WITNESS kernel, it generates LOR messages.\n */\n#   ifdef _KERNEL\n#    if (__FreeBSD_version < 700000)\n#     define\tKRWLOCK_T\t\tstruct mtx\n#     define\tREAD_ENTER(x)\t\tmtx_lock(&(x)->ipf_lk)\n#     define\tWRITE_ENTER(x)\t\tmtx_lock(&(x)->ipf_lk)\n#     define\tRWLOCK_EXIT(x)\t\tmtx_unlock(&(x)->ipf_lk)\n#     define\tMUTEX_DOWNGRADE(x)\t;\n#     define\tRWLOCK_INIT(x,y)\tmtx_init(&(x)->ipf_lk, (y), NULL,\\\n\t\t\t\t\t\t MTX_DEF)\n#     define\tRW_DESTROY(x)\t\tmtx_destroy(&(x)->ipf_lk)\n#    else\n#     define\tKRWLOCK_T\t\tstruct sx\n#     define\tREAD_ENTER(x)\t\tsx_slock(&(x)->ipf_lk)\n#     define\tWRITE_ENTER(x)\t\tsx_xlock(&(x)->ipf_lk)\n#     define\tMUTEX_DOWNGRADE(x)\tsx_downgrade(&(x)->ipf_lk)\n#     define\tRWLOCK_INIT(x, y)\tsx_init(&(x)->ipf_lk, (y))\n#     define\tRW_DESTROY(x)\t\tsx_destroy(&(x)->ipf_lk)\n#     ifdef sx_unlock\n#      define\tRWLOCK_EXIT(x)\t\tsx_unlock(&(x)->ipf_lk)\n#     else\n#      define\tRWLOCK_EXIT(x)\t\tdo { \\\n\t\t\t\t\t    if ((x)->ipf_lk.sx_cnt < 0) \\\n\t\t\t\t\t\tsx_xunlock(&(x)->ipf_lk); \\\n\t\t\t\t\t    else \\\n\t\t\t\t\t\tsx_sunlock(&(x)->ipf_lk); \\\n\t\t\t\t\t} while (0)\n#     endif\n#    endif\n#   endif\n#  endif\n#  define\tKMUTEX_T\t\tstruct mtx\n# endif\n\n# if (__FreeBSD_version >= 501113)\n#  include <net/if_var.h>\n#  define\tIFNAME(x)\t((struct ifnet *)x)->if_xname\n#  define\tCOPYIFNAME(v, x, b) \\\n\t\t\t\t(void) strncpy(b, \\\n\t\t\t\t\t       ((struct ifnet *)x)->if_xname, \\\n\t\t\t\t\t       LIFNAMSIZ)\n# endif\n# if (__FreeBSD_version >= 500043)\n#  define\tCACHE_HASH(x)\t((((struct ifnet *)fin->fin_ifp)->if_index) & 7)\n# else\n#  define\tIFNAME(x)\t((struct ifnet *)x)->if_name\n#  define\tCACHE_HASH(x)\t((IFNAME(fin->fin_ifp)[0] + \\\n\t\t\t\t  ((struct ifnet *)fin->fin_ifp)->if_unit) & 7)\n# endif\n\n# ifdef _KERNEL\n#  define\tGETKTIME(x)\tmicrotime((struct timeval *)x)\n\n#  if (__FreeBSD_version >= 500002)\n#   include <netinet/in_systm.h>\n#   include <netinet/ip.h>\n#   include <machine/in_cksum.h>\n#  endif\n\n#  if (__FreeBSD_version >= 500043)\n#   define\tUSE_MUTEXES\n#   define\tMUTEX_ENTER(x)\t\tmtx_lock(&(x)->ipf_lk)\n#   define\tMUTEX_EXIT(x)\t\tmtx_unlock(&(x)->ipf_lk)\n#   define\tMUTEX_INIT(x,y)\t\tmtx_init(&(x)->ipf_lk, (y), NULL,\\\n\t\t\t\t\t\t MTX_DEF)\n#   define\tMUTEX_DESTROY(x)\tmtx_destroy(&(x)->ipf_lk)\n#   define\tMUTEX_NUKE(x)\t\tbzero((x), sizeof(*(x)))\n#   include <machine/atomic.h>\n#   define\tATOMIC_INC(x)\t\t{ mtx_lock(&ipf_rw.ipf_lk); (x)++; \\\n\t\t\t\t\t  mtx_unlock(&ipf_rw.ipf_lk); }\n#   define\tATOMIC_DEC(x)\t\t{ mtx_lock(&ipf_rw.ipf_lk); (x)--; \\\n\t\t\t\t\t  mtx_unlock(&ipf_rw.ipf_lk); }\n#   define\tATOMIC_INCL(x)\t\tatomic_add_long(&(x), 1)\n#   define\tATOMIC_INC64(x)\t\tATOMIC_INC(x)\n#   define\tATOMIC_INC32(x)\t\tatomic_add_32((u_int *)&(x), 1)\n#   define\tATOMIC_INC16(x)\t\tatomic_add_16(&(x), 1)\n#   define\tATOMIC_DECL(x)\t\tatomic_add_long(&(x), -1)\n#   define\tATOMIC_DEC64(x)\t\tATOMIC_DEC(x)\n#   define\tATOMIC_DEC32(x)\t\tatomic_add_32((u_int *)&(x), -1)\n#   define\tATOMIC_DEC16(x)\t\tatomic_add_16(&(x), -1)\n#   define\tSPL_X(x)\t;\n#   define\tSPL_NET(x)\t;\n#   define\tSPL_IMP(x)\t;\n#   define\tSPL_SCHED(x)\t;\n#  else\n#   define\tSPL_SCHED(x)\tx = splhigh()\n#  endif /* __FreeBSD_version >= 500043 */\n#  define\tMSGDSIZE(x)\tmbufchainlen(x)\n#  define\tM_LEN(x)\t(x)->m_len\n#  define\tM_DUPLICATE(x)\tm_copy((x), 0, M_COPYALL)\n#  define\tIPF_PANIC(x,y)\tif (x) { printf y; panic(\"ipf_panic\"); }\ntypedef struct mbuf mb_t;\n# endif /* _KERNEL */\n\n# if __FreeBSD__ < 3\n#  include <machine/spl.h>\n# else\n#  if __FreeBSD__ == 3\n#   if defined(IPFILTER_LKM) && !defined(ACTUALLY_LKM_NOT_KERNEL)\n#    define\tACTUALLY_LKM_NOT_KERNEL\n#   endif\n#  endif\n# endif\n\n# if (__FreeBSD_version >= 300000)\ntypedef\tu_long\t\tioctlcmd_t;\n# else\ntypedef\tint\t\tioctlcmd_t;\n# endif\ntypedef\tstruct uio\tuio_t;\ntypedef\tint\t\tminor_t;\ntypedef\tu_int32_t\tu_32_t;\n# define\tU_32_T\t1\n\n# define OS_RECOGNISED 1\n#endif /* __FreeBSD__ */\n\n\n/* ----------------------------------------------------------------------- */\n/*                                O P E N B S D                            */\n/* ----------------------------------------------------------------------- */\n#ifdef __OpenBSD__\n# ifdef INET6\n#  define USE_INET6\n# endif\n\n# ifdef _KERNEL\n#  if !defined(IPFILTER_LKM)\n#   include \"bpfilter.h\"\n#  endif\n#  if (OpenBSD >= 200311)\n#   define SNPRINTF\tsnprintf\n#   if defined(USE_INET6)\n#    include \"netinet6/in6_var.h\"\n#    include \"netinet6/nd6.h\"\n#   endif\n#  endif\n#  if (OpenBSD >= 200012)\n#   define HAVE_M_PULLDOWN 1\n#  endif\n#  define\tCOPYIN(a,b,c)\tcopyin((caddr_t)(a), (caddr_t)(b), (c))\n#  define\tCOPYOUT(a,b,c)\tcopyout((caddr_t)(a), (caddr_t)(b), (c))\n#  define\tGETKTIME(x)\tmicrotime((struct timeval *)x)\n#  define\tMSGDSIZE(x)\tmbufchainlen(x)\n#  define\tM_LEN(x)\t(x)->m_len\n#  define\tM_DUPLICATE(x)\tm_copy((x), 0, M_COPYALL)\n#  define\tIPF_PANIC(x,y)\tif (x) { printf y; panic(\"ipf_panic\"); }\ntypedef struct mbuf mb_t;\n# endif /* _KERNEL */\n# if (OpenBSD >= 199603)\n#  define\tIFNAME(x, b)\t((struct ifnet *)x)->if_xname\n#  define\tCOPYIFNAME(v, x, b) \\\n\t\t\t\t(void) strncpy(b, \\\n\t\t\t\t\t       ((struct ifnet *)x)->if_xname, \\\n\t\t\t\t\t       LIFNAMSIZ)\n#  define\tCACHE_HASH(x)\t((((struct ifnet *)fin->fin_ifp)->if_index)&7)\n# else\n#  define\tIFNAME(x, b)\t((struct ifnet *)x)->if_name\n#  define\tCACHE_HASH(x)\t((IFNAME(fin->fin_ifp)[0] + \\\n\t\t\t\t  ((struct ifnet *)fin->fin_ifp)->if_unit) & 7)\n# endif\n\ntypedef\tstruct uio\tuio_t;\ntypedef\tu_long\t\tioctlcmd_t;  \ntypedef\tint\t\tminor_t;\ntypedef\tu_int32_t\tu_32_t;\n# define\tU_32_T\t1\n\n# define OS_RECOGNISED 1\n#endif /* __OpenBSD__ */\n\n\n/* ----------------------------------------------------------------------- */\n/*                                B S D O S                                */\n/* ----------------------------------------------------------------------- */\n#ifdef _BSDI_VERSION\n# ifdef INET6\n#  define USE_INET6\n# endif\n\n# ifdef _KERNEL\n#  define\tGETKTIME(x)\tmicrotime((struct timeval *)x)\n#  define\tMSGDSIZE(x)\tmbufchainlen(x)\n#  define\tM_LEN(x)\t(x)->m_len\n#  define\tM_DUPLICATE(x)\tm_copy((x), 0, M_COPYALL)\n#  define\tIFNAME(x, b)\t((struct ifnet *)x)->if_name\n#  define\tCACHE_HASH(x)\t((IFNAME(fin->fin_ifp)[0] + \\\n\t\t\t\t  ((struct ifnet *)fin->fin_ifp)->if_unit) & 7)\ntypedef struct mbuf mb_t;\n# endif /* _KERNEL */\n\n# if (_BSDI_VERSION >= 199701)\ntypedef\tu_long\t\tioctlcmd_t;\n# else\ntypedef\tint\t\tioctlcmd_t;\n# endif\ntypedef\tu_int32_t\tu_32_t;\n# define\tU_32_T\t1\n\n#endif /* _BSDI_VERSION */\n\n\n/* ----------------------------------------------------------------------- */\n/*                                  S U N O S 4                            */\n/* ----------------------------------------------------------------------- */\n#if defined(sun) && !defined(OS_RECOGNISED) /* SunOS4 */\n# ifdef _KERNEL\n#  include\t<sys/kmem_alloc.h>\n#  define\tGETKTIME(x)\tuniqtime((struct timeval *)x)\n#  define\tMSGDSIZE(x)\tmbufchainlen(x)\n#  define\tM_LEN(x)\t(x)->m_len\n#  define\tM_DUPLICATE(x)\tm_copy((x), 0, M_COPYALL)\n#  define\tIFNAME(x, b)\t((struct ifnet *)x)->if_name\n#  define\tCACHE_HASH(x)\t((IFNAME(fin->fin_ifp)[0] + \\\n\t\t\t\t  ((struct ifnet *)fin->fin_ifp)->if_unit) & 7)\n#  define\tGETIFP(n, v)\tifunit(n, IFNAMSIZ)\n#  define\tKFREE(x)\tkmem_free((char *)(x), sizeof(*(x)))\n#  define\tKFREES(x,s)\tkmem_free((char *)(x), (s))\n#  define\tSLEEP(id, n)\tsleep((id), PZERO+1)\n#  define\tWAKEUP(id,x)\twakeup(id + x)\n#  define\tPOLLWAKEUP(x)\t;\n#  define\tUIOMOVE(a,b,c,d)\tuiomove((caddr_t)a,b,c,d)\n#  define\tIPF_PANIC(x,y)\tif (x) { printf y; panic(\"ipf_panic\"); }\n\nextern\tvoid\tm_copydata __P((struct mbuf *, int, int, caddr_t));\nextern\tvoid\tm_copyback __P((struct mbuf *, int, int, caddr_t));\n\ntypedef struct mbuf mb_t;\n# endif\n\ntypedef\tstruct uio\tuio_t;\ntypedef\tint\t\tioctlcmd_t;  \ntypedef\tint\t\tminor_t;\ntypedef\tunsigned int\tu_32_t;\n# define\tU_32_T\t1\n\n# define OS_RECOGNISED 1\n\n#endif /* SunOS 4 */\n\n/* ----------------------------------------------------------------------- */\n/*                            L I N U X                                    */\n/* ----------------------------------------------------------------------- */\n#if defined(linux) && !defined(OS_RECOGNISED)\n#include <linux/config.h>\n#include <linux/version.h>\n# if (LINUX >= 20600) && defined(_KERNEL)\n#  define\t HDR_T_PRIVATE\t1\n# endif\n# undef USE_INET6\n# ifdef USE_INET6\nstruct ip6_ext {\n\tu_char\tip6e_nxt;\n\tu_char\tip6e_len;\n};\n# endif\n\n# ifdef _KERNEL\n#  define\tIPF_PANIC(x,y)\tif (x) { printf y; panic(\"ipf_panic\"); }\n#  define\tCOPYIN(a,b,c)\tcopy_from_user((caddr_t)(b), (caddr_t)(a), (c))\n#  define\tCOPYOUT(a,b,c)\tcopy_to_user((caddr_t)(b), (caddr_t)(a), (c))\n#  define\tFREE_MB_T(m)\tkfree_skb(m)\n#  define\tGETKTIME(x)\tdo_gettimeofday((struct timeval *)x)\n#  define\tPOLLWAKEUP(x)\t;\n#  ifdef wait_event_interruptible\n#   define\tSLEEP(x,s)\twait_event_interruptible((*(x##_linux)), 0)\n#  else\n#   define\tSLEEP(x,s)\t0, interruptible_sleep_on(x##_linux)\n#  endif\n#   define\tWAKEUP(x,y)\twake_up(x##_linux + y)\n#  define\tUIOMOVE(a,b,c,d)\tuiomove((caddr_t)a,b,c,d)\n#  define\tUSE_MUTEXES\n#  define\tKRWLOCK_T\t\trwlock_t\n#  define\tKMUTEX_T\t\tspinlock_t\n#  define\tMUTEX_INIT(x,y)\t\tspin_lock_init(&(x)->ipf_lk)\n#  define\tMUTEX_ENTER(x)\t\tspin_lock(&(x)->ipf_lk)\n#  define\tMUTEX_EXIT(x)\t\tspin_unlock(&(x)->ipf_lk)\n#  define\tMUTEX_DESTROY(x)\tdo { } while (0)\n#  define\tMUTEX_NUKE(x)\t\tbzero(&(x)->ipf_lk, sizeof((x)->ipf_lk))\n#  define\tREAD_ENTER(x)\t\tipf_read_enter(x)\n#  define\tWRITE_ENTER(x)\t\tipf_write_enter(x)\n#  define\tRWLOCK_INIT(x,y)\tipf_rw_init(x, y)\n#  define\tRW_DESTROY(x)\t\tdo { } while (0)\n#  define\tRWLOCK_EXIT(x)\t\tipf_rw_exit(x)\n#  define\tMUTEX_DOWNGRADE(x)\tipf_rw_downgrade(x)\n#  define\tATOMIC_INCL(x)\t\tMUTEX_ENTER(&ipf_rw); (x)++; \\\n\t\t\t\t\tMUTEX_EXIT(&ipf_rw)\n#  define\tATOMIC_DECL(x)\t\tMUTEX_ENTER(&ipf_rw); (x)--; \\\n\t\t\t\t\tMUTEX_EXIT(&ipf_rw)\n#  define\tATOMIC_INC64(x)\t\tMUTEX_ENTER(&ipf_rw); (x)++; \\\n\t\t\t\t\tMUTEX_EXIT(&ipf_rw)\n#  define\tATOMIC_INC32(x)\t\tMUTEX_ENTER(&ipf_rw); (x)++; \\\n\t\t\t\t\tMUTEX_EXIT(&ipf_rw)\n#  define\tATOMIC_INC16(x)\t\tMUTEX_ENTER(&ipf_rw); (x)++; \\\n\t\t\t\t\tMUTEX_EXIT(&ipf_rw)\n#  define\tATOMIC_DEC64(x)\t\tMUTEX_ENTER(&ipf_rw); (x)--; \\\n\t\t\t\t\tMUTEX_EXIT(&ipf_rw)\n#  define\tATOMIC_DEC32(x)\t\tMUTEX_ENTER(&ipf_rw); (x)--; \\\n\t\t\t\t\tMUTEX_EXIT(&ipf_rw)\n#  define\tATOMIC_DEC16(x)\t\tMUTEX_ENTER(&ipf_rw); (x)--; \\\n\t\t\t\t\tMUTEX_EXIT(&ipf_rw)\n#  define\tSPL_SCHED(x)\t\tdo { } while (0)\n#  define\tSPL_IMP(x)\t\tdo { } while (0)\n#  define\tSPL_NET(x)\t\tdo { } while (0)\n#  define\tSPL_X(x)\t\tdo { } while (0)\n#  define\tIFNAME(x)\t\t((struct net_device*)x)->name\n#  define\tCACHE_HASH(x)\t((IFNAME(fin->fin_ifp)[0] + \\\n\t\t\t  ((struct net_device *)fin->fin_ifp)->ifindex) & 7)\ntypedef\tstruct\tsk_buff\tmb_t;\nextern\tvoid\tm_copydata __P((mb_t *, int, int, caddr_t));\nextern\tvoid\tm_copyback __P((mb_t *, int, int, caddr_t));\nextern\tvoid\tm_adj __P((mb_t *, int));\nextern\tmb_t\t*m_pullup __P((mb_t *, int));\n#  define\tmbuf\tsk_buff\n\n#  define\tmtod(m, t)\t((t)(m)->data)\n#  define\tm_data\t\tdata\n#  define\tm_len\t\tlen\n#  define\tm_next\t\tnext\n#  define\tM_DUPLICATE(m)\tskb_clone((m), in_interrupt() ? GFP_ATOMIC : \\\n\t\t\t\t\t\t\t\tGFP_KERNEL)\n#  define\tMSGDSIZE(m)\t(m)->len\n#  define\tM_LEN(m)\t(m)->len\n\n#  define\tsplnet(x)\t;\n#  define\tprintf\t\tprintk\n#  define\tbcopy(s,d,z)\tmemmove(d, s, z)\n#  define\tbzero(s,z)\tmemset(s, 0, z)\n#  define\tbcmp(a,b,z)\tmemcmp(a, b, z)\n\n#  define\tifnet\t\tnet_device\n#  define\tif_xname\tname\n#  define\tif_unit\t\tifindex \n\n#  define\tKMALLOC(x,t)\t(x) = (t)kmalloc(sizeof(*(x)), \\\n\t\t\t\t    in_interrupt() ? GFP_ATOMIC : GFP_KERNEL)\n#  define\tKFREE(x)\tkfree(x)\n#  define\tKMALLOCS(x,t,s)\t(x) = (t)kmalloc((s), \\\n\t\t\t\t    in_interrupt() ? GFP_ATOMIC : GFP_KERNEL)\n#  define\tKFREES(x,s)\tkfree(x)\n\n#  define GETIFP(n,v)\tdev_get_by_name(n)\n\n# else\n#  include <net/ethernet.h>\n\nstruct mbuf {\n};\n\n#  ifndef _NET_ROUTE_H\nstruct rtentry {\n};\n#  endif\n\nstruct ifnet {\n\tchar\tif_xname[IFNAMSIZ];\n\tint\tif_unit;\n\tint\t(* if_output) __P((struct ifnet *, struct mbuf *, struct sockaddr *, struct rtentry *));\n\tstruct\tifaddr\t*if_addrlist;\n};\n# define\tIFNAME(x)\t((struct ifnet *)x)->if_xname\n\n# endif\t/* _KERNEL */\n\n# define\tCOPYIFNAME(v, x, b) \\\n\t\t\t\t(void) strncpy(b, \\\n\t\t\t\t\t       ((struct ifnet *)x)->if_xname, \\\n\t\t\t\t\t       LIFNAMSIZ)\n\n# include <linux/fs.h>\n# define\tFWRITE\tFMODE_WRITE\n# define\tFREAD\tFMODE_READ\n\n# define\t__USE_MISC\t1\n# define\t__FAVOR_BSD\t1\n\ntypedef\tstruct uio {\n\tstruct iovec\t*uio_iov;\n\tvoid\t*uio_file;\n\tchar\t*uio_buf;\n\tint\tuio_iovcnt;\n\tint\tuio_offset;\n\tsize_t\tuio_resid;\n\tint\tuio_rw;\n} uio_t;\n\nextern\tint\tuiomove __P((caddr_t, size_t, int, struct uio *));\n\n# define\tUIO_READ\t1\n# define\tUIO_WRITE\t2\n\ntypedef\tu_long\t\tioctlcmd_t;\ntypedef\tint\t\tminor_t;\ntypedef u_int32_t \tu_32_t;\n# define\tU_32_T\t1\n\n# define OS_RECOGNISED 1\n\n#endif\n\n\n/* ----------------------------------------------------------------------- */\n/*                                    A I X                                */\n/* ----------------------------------------------------------------------- */\n#if defined(_AIX51)\n# undef\t\tMENTAT\n\n# include <sys/lock.h>\n# include <sys/sysmacros.h>\n\n# ifdef _KERNEL\n#  define rw_read_locked(x)\t\t0\n#  include <net/net_globals.h>\n#  include <net/net_malloc.h>\n#  define\tKMUTEX_T\t\tsimple_lock_t\n#  define\tKRWLOCK_T\t\tcomplex_lock_t\n#  define\tUSE_MUTEXES\t\t1\n#  define\tUSE_SPL\t\t\t1\n#  define\tREAD_ENTER(x)\t\tlock_read((x)->ipf_lk)\n#  define\tWRITE_ENTER(x)\t\tlock_write((x)->ipf_lk)\n#  define\tMUTEX_DOWNGRADE(x)\tlock_write_to_read((x)->ipf_lk)\n#  define\tRWLOCK_INIT(x, y)\tlock_alloc(&(x)->ipf_lk, \\\n\t\t\t\t\t\t   LOCK_ALLOC_PIN, \\\n\t\t\t\t\t\t   (u_short)y, 0); \\\n\t\t\t\t\tlock_init((x)->ipf_lk, TRUE)\n#  define\tRWLOCK_EXIT(x)\t\tlock_done((x)->ipf_lk)\n#  define\tRW_DESTROY(x)\t\tlock_free(&(x)->ipf_lk)\n#  define\tMUTEX_ENTER(x)\t\tsimple_lock((x)->ipf_lk)\n#  define\tMUTEX_INIT(x, y)\tlock_alloc(&(x)->ipf_lk, \\\n\t\t\t\t\t\t   LOCK_ALLOC_PIN, \\\n\t\t\t\t\t\t   (u_short)y, 0); \\\n\t\t\t\t\tsimple_lock_init((x)->ipf_lk)\n#  define\tMUTEX_DESTROY(x)\tlock_free(&(x)->ipf_lk)\n#  define\tMUTEX_EXIT(x)\t\tsimple_unlock((x)->ipf_lk)\n#  define\tMUTEX_NUKE(x)\t\tbzero(&(x)->ipf_lk, sizeof((x)->ipf_lk))\n#   define\tATOMIC_INC64(x)\t\t{ MUTEX_ENTER(&ipf_rw); (x)++; \\\n\t\t\t\t\t  MUTEX_EXIT(&ipf_rw); }\n#   define\tATOMIC_DEC64(x)\t\t{ MUTEX_ENTER(&ipf_rw); (x)--; \\\n\t\t\t\t\t  MUTEX_EXIT(&ipf_rw); }\n#   define\tATOMIC_INC32(x)\t\t{ MUTEX_ENTER(&ipf_rw); (x)++; \\\n\t\t\t\t\t  MUTEX_EXIT(&ipf_rw); }\n#   define\tATOMIC_DEC32(x)\t\t{ MUTEX_ENTER(&ipf_rw); (x)--; \\\n\t\t\t\t\t  MUTEX_EXIT(&ipf_rw); }\n#   define\tATOMIC_INCL(x)\t\t{ MUTEX_ENTER(&ipf_rw); (x)++; \\\n\t\t\t\t\t  MUTEX_EXIT(&ipf_rw); }\n#   define\tATOMIC_DECL(x)\t\t{ MUTEX_ENTER(&ipf_rw); (x)--; \\\n\t\t\t\t\t  MUTEX_EXIT(&ipf_rw); }\n#   define\tATOMIC_INC(x)\t\t{ MUTEX_ENTER(&ipf_rw); (x)++; \\\n\t\t\t\t\t  MUTEX_EXIT(&ipf_rw); }\n#   define\tATOMIC_DEC(x)\t\t{ MUTEX_ENTER(&ipf_rw); (x)--; \\\n\t\t\t\t\t  MUTEX_EXIT(&ipf_rw); }\n#  define\tSPL_SCHED(x)\t\tx = splsched()\n#  define\tSPL_NET(x)\t\tx = splnet()\n#  define\tSPL_IMP(x)\t\tx = splimp()\n#  undef\tSPL_X\n#  define\tSPL_X(x)\t\tsplx(x)\n#  define\tUIOMOVE(a,b,c,d)\tuiomove((caddr_t)a,b,c,d)\nextern void* getifp __P((char *, int));\n#  define\tGETIFP(n, v)\t\tgetifp(n, v)\n#  define\tGET_MINOR\t\tminor\n#  define\tSLEEP(id, n)\tsleepx((id), PZERO+1, 0)\n#  define\tWAKEUP(id,x)\twakeup(id)\n#  define\tPOLLWAKEUP(x)\t;\n#  define\tCOPYIN(a,b,c)\tcopyin((caddr_t)(a), (caddr_t)(b), (c))\n#  define\tCOPYOUT(a,b,c)\tcopyout((caddr_t)(a), (caddr_t)(b), (c))\n#  define\tKMALLOC(a, b)\tMALLOC((a), b, sizeof(*(a)), M_TEMP, M_NOWAIT)\n#  define\tKMALLOCS(a, b, c)\tMALLOC((a), b, (c), M_TEMP, \\\n\t\t\t\t\t    ((c) > 4096) ? M_WAITOK : M_NOWAIT)\n#  define\tKFREE(x)\tFREE((x), M_TEMP)\n#  define\tKFREES(x,s)\tFREE((x), M_TEMP)\n#  define\tMSGDSIZE(x)\tmbufchainlen(x)\n#  define\tM_LEN(x)\t(x)->m_len\n#  define\tM_DUPLICATE(x)\tm_copy((x), 0, M_COPYALL)\n#  define\tGETKTIME(x)\n#  define\tIFNAME(x, b)\t((struct ifnet *)x)->if_name\n#  define\tCACHE_HASH(x)\t((IFNAME(fin->fin_ifp)[0] + \\\n\t\t\t\t  ((struct ifnet *)fin->fin_ifp)->if_unit) & 7)\n#  define\tIPF_PANIC(x,y)\ntypedef struct mbuf mb_t;\n# endif /* _KERNEL */\n\n/*\n * These are from's Solaris' #defines for little endian.\n */\n#if !defined(IP6F_MORE_FRAG)\n# define\tIP6F_MORE_FRAG\t\t0x0100\n#endif\n#if !defined(IP6F_RESERVED_MASK)\n# define\tIP6F_RESERVED_MASK\t0x0600\n#endif\n#if !defined(IP6F_OFF_MASK)\n# define\tIP6F_OFF_MASK\t\t0xf8ff\n#endif\n\nstruct ip6_ext {\n\tu_char\tip6e_nxt;\n\tu_char\tip6e_len;\n};\n\ntypedef\tint\t\tioctlcmd_t;  \ntypedef\tint\t\tminor_t;\n/*\n * Really, any arch where sizeof(long) != sizeof(int).\n */\ntypedef unsigned int    u_32_t;\n# define\tU_32_T\t1\n\n# define OS_RECOGNISED 1\n#endif\t/* _AIX51 */\n\n\n#ifndef\tOS_RECOGNISED\n#error\tip_compat.h does not recognise this platform/OS.\n#endif\n\n\n/* ----------------------------------------------------------------------- */\n/*                           G E N E R I C                                 */\n/* ----------------------------------------------------------------------- */\n#ifndef OS_RECOGNISED\n#endif\n\n/*\n * For BSD kernels, if bpf is in the kernel, enable ipfilter to use bpf in\n * filter rules.\n */\n#if !defined(IPFILTER_BPF)\n# if (defined(NBPF) && (NBPF > 0)) || (defined(DEV_BPF) && (DEV_BPF > 0)) || \\\n     (defined(NBPFILTER) && (NBPFILTER > 0))\n#  define\tIPFILTER_BPF\n# endif\n#endif\n\n/*\n * Userland locking primitives\n */\ntypedef\tstruct\t{\n\tchar\t*eMm_owner;\n\tchar\t*eMm_heldin;\n\tu_int\teMm_magic;\n\tint\teMm_held;\n\tint\teMm_heldat;\n#if defined(__hpux) || defined(__linux)\n\tchar\teMm_fill[8];\n#endif\n} eMmutex_t;\n\ntypedef\tstruct\t{\n\tchar\t*eMrw_owner;\n\tchar\t*eMrw_heldin;\n\tu_int\teMrw_magic;\n\tshort\teMrw_read;\n\tshort\teMrw_write;\n\tint\teMrw_heldat;\n#ifdef __hpux\n\tchar\teMm_fill[24];\n#endif\n} eMrwlock_t;\n\ntypedef union {\n#ifdef KMUTEX_T\n\tstruct\t{\n\t\tKMUTEX_T\tipf_slk;\n\t\tchar\t\t*ipf_lname;\n\t} ipf_lkun_s;\n#endif\n\teMmutex_t\tipf_emu;\n} ipfmutex_t;\n\ntypedef union {\n#ifdef KRWLOCK_T\n\tstruct\t{\n\t\tKRWLOCK_T\tipf_slk;\n\t\tchar\t\t*ipf_lname;\n\t\tint\t\tipf_sr;\n\t\tint\t\tipf_sw;\n\t\tu_int\t\tipf_magic;\n\t} ipf_lkun_s;\n#endif\n\teMrwlock_t\tipf_emu;\n} ipfrwlock_t;\n\n#define\tipf_lk\t\tipf_lkun_s.ipf_slk\n#define\tipf_lname\tipf_lkun_s.ipf_lname\n#define\tipf_isr\t\tipf_lkun_s.ipf_sr\n#define\tipf_isw\t\tipf_lkun_s.ipf_sw\n#define\tipf_magic\tipf_lkun_s.ipf_magic\n\n#if !defined(__GNUC__) || \\\n    (defined(__FreeBSD_version) && (__FreeBSD_version >= 503000))\n# ifndef\tINLINE\n#  define\tINLINE\n# endif\n#else\n# define\tINLINE\t__inline__\n#endif\n\n#if defined(linux) && defined(_KERNEL)\nextern\tvoid\tipf_read_enter __P((ipfrwlock_t *));\nextern\tvoid\tipf_write_enter __P((ipfrwlock_t *));\nextern\tvoid\tipf_rw_exit __P((ipfrwlock_t *));\nextern\tvoid\tipf_rw_init __P((ipfrwlock_t *, char *));\nextern\tvoid\tipf_rw_downgrade __P((ipfrwlock_t *));\n#endif\n\n/*\n * In a non-kernel environment, there are a lot of macros that need to be\n * filled in to be null-ops or to point to some compatibility function,\n * somewhere in userland.\n */\n#ifndef _KERNEL\ntypedef\tstruct\tmb_s\t{\n\tstruct\tmb_s\t*mb_next;\n\tint\t\tmb_len;\n\tu_long\t\tmb_buf[2048];\n} mb_t;\n# undef\t\tm_next\n# define\tm_next\t\tmb_next\n# define\tMSGDSIZE(x)\t(x)->mb_len\t/* XXX - from ipt.c */\n# define\tM_LEN(x)\t(x)->mb_len\n# define\tM_DUPLICATE(x)\t(x)\n# define\tGETKTIME(x)\tgettimeofday((struct timeval *)(x), NULL)\n# undef\t\tMTOD\n# define\tMTOD(m, t)\t((t)(m)->mb_buf)\n# define\tFREE_MB_T(x)\n# define\tSLEEP(x,y)\t1;\n# define\tWAKEUP(x,y)\t;\n# define\tPOLLWAKEUP(y)\t;\n# define\tIPF_PANIC(x,y)\t;\n# define\tPANIC(x,y)\t;\n# define\tSPL_SCHED(x)\t;\n# define\tSPL_NET(x)\t;\n# define\tSPL_IMP(x)\t;\n# define\tSPL_X(x)\t;\n# define\tKMALLOC(a,b)\t(a) = (b)malloc(sizeof(*a))\n# define\tKMALLOCS(a,b,c)\t(a) = (b)malloc(c)\n# define\tKFREE(x)\tfree(x)\n# define\tKFREES(x,s)\tfree(x)\n# define\tGETIFP(x, v)\tget_unit(x,v)\n# define\tCOPYIN(a,b,c)\tbcopywrap((a), (b), (c))\n# define\tCOPYOUT(a,b,c)\tbcopywrap((a), (b), (c))\n# define\tCOPYDATA(m, o, l, b)\tbcopy(MTOD((mb_t *)m, char *) + (o), \\\n\t\t\t\t\t      (b), (l))\n# define\tCOPYBACK(m, o, l, b)\tbcopy((b), \\\n\t\t\t\t\t      MTOD((mb_t *)m, char *) + (o), \\\n\t\t\t\t\t      (l))\n# define\tUIOMOVE(a,b,c,d)\tipfuiomove((caddr_t)a,b,c,d)\nextern\tvoid\tm_copydata __P((mb_t *, int, int, caddr_t));\nextern\tint\tipfuiomove __P((caddr_t, int, int, struct uio *));\nextern\tint\tbcopywrap __P((void *, void *, size_t));\n# ifndef CACHE_HASH\n#  define\tCACHE_HASH(x)\t((IFNAME(fin->fin_ifp)[0] + \\\n\t\t\t\t  ((struct ifnet *)fin->fin_ifp)->if_unit) & 7)\n# endif\n\n# define\tMUTEX_DESTROY(x)\teMmutex_destroy(&(x)->ipf_emu)\n# define\tMUTEX_ENTER(x)\t\teMmutex_enter(&(x)->ipf_emu, \\\n\t\t\t\t\t\t      __FILE__, __LINE__)\n# define\tMUTEX_EXIT(x)\t\teMmutex_exit(&(x)->ipf_emu)\n# define\tMUTEX_INIT(x,y)\t\teMmutex_init(&(x)->ipf_emu, y)\n# define\tMUTEX_NUKE(x)\t\tbzero((x), sizeof(*(x)))\n\n# define\tMUTEX_DOWNGRADE(x)\teMrwlock_downgrade(&(x)->ipf_emu, \\\n\t\t\t\t\t\t\t   __FILE__, __LINE__)\n# define\tREAD_ENTER(x)\t\teMrwlock_read_enter(&(x)->ipf_emu, \\\n\t\t\t\t\t\t\t    __FILE__, __LINE__)\n# define\tRWLOCK_INIT(x, y)\teMrwlock_init(&(x)->ipf_emu, y)\n# define\tRWLOCK_EXIT(x)\t\teMrwlock_exit(&(x)->ipf_emu)\n# define\tRW_DESTROY(x)\t\teMrwlock_destroy(&(x)->ipf_emu)\n# define\tWRITE_ENTER(x)\t\teMrwlock_write_enter(&(x)->ipf_emu, \\\n\t\t\t\t\t\t\t     __FILE__, \\\n\t\t\t\t\t\t\t     __LINE__)\n\n# define\tUSE_MUTEXES\t\t1\n\nextern void eMmutex_destroy __P((eMmutex_t *));\nextern void eMmutex_enter __P((eMmutex_t *, char *, int));\nextern void eMmutex_exit __P((eMmutex_t *));\nextern void eMmutex_init __P((eMmutex_t *, char *));\nextern void eMrwlock_destroy __P((eMrwlock_t *));\nextern void eMrwlock_exit __P((eMrwlock_t *));\nextern void eMrwlock_init __P((eMrwlock_t *, char *));\nextern void eMrwlock_read_enter __P((eMrwlock_t *, char *, int));\nextern void eMrwlock_write_enter __P((eMrwlock_t *, char *, int));\nextern void eMrwlock_downgrade __P((eMrwlock_t *, char *, int));\n\n#endif\n\n#define\tMAX_IPV4HDR\t((0xf << 2) + sizeof(struct icmp) + sizeof(ip_t) + 8)\n\n#ifndef\tIP_OFFMASK\n# define\tIP_OFFMASK\t0x1fff\n#endif\n\n\n/*\n * On BSD's use quad_t as a guarantee for getting at least a 64bit sized\n * object.\n */\n#if (BSD > 199306)\n# define\tUSE_QUAD_T\n# define\tU_QUAD_T\tunsigned long long\n# define\tQUAD_T\t\tlong long\n#else /* BSD > 199306 */\n# define\tU_QUAD_T\tu_long\n# define\tQUAD_T\t\tlong\n#endif /* BSD > 199306 */\n\n\n#ifdef\tUSE_INET6\n# if defined(__NetBSD__) || defined(__OpenBSD__) || defined(__FreeBSD__) || \\\n     defined(__osf__) || defined(linux)\n#  include <netinet/ip6.h>\n#  include <netinet/icmp6.h>\n#  if !defined(linux)\n#   if defined(_KERNEL) && !defined(__osf__)\n#    include <netinet6/ip6_var.h>\n#   endif\n#  endif\ntypedef\tstruct ip6_hdr\tip6_t;\n# endif\n#endif\n\n#ifndef\tMAX\n# define\tMAX(a,b)\t(((a) > (b)) ? (a) : (b))\n#endif\n\n#if defined(_KERNEL)\n# ifdef MENTAT\n#  define\tCOPYDATA\tmb_copydata\n#  define\tCOPYBACK\tmb_copyback\n# else\n#  define\tCOPYDATA\tm_copydata\n#  define\tCOPYBACK\tm_copyback\n# endif\n# if (BSD >= 199306) || defined(__FreeBSD__)\n#  if (defined(__NetBSD_Version__) && (__NetBSD_Version__ < 105180000)) || \\\n       defined(__FreeBSD__) || (defined(OpenBSD) && (OpenBSD < 200206)) || \\\n       defined(_BSDI_VERSION)\n#   include <vm/vm.h>\n#  endif\n#  if !defined(__FreeBSD__) || (defined (__FreeBSD_version) && \\\n      (__FreeBSD_version >= 300000))\n#   if (defined(__NetBSD_Version__) && (__NetBSD_Version__ >= 105180000)) || \\\n       (defined(OpenBSD) && (OpenBSD >= 200111))\n#    include <uvm/uvm_extern.h>\n#   else\n#    include <vm/vm_extern.h>\nextern  vm_map_t        kmem_map;\n#   endif\n#   include <sys/proc.h>\n#  else /* !__FreeBSD__ || (__FreeBSD__ && __FreeBSD_version >= 300000) */\n#   include <vm/vm_kern.h>\n#  endif /* !__FreeBSD__ || (__FreeBSD__ && __FreeBSD_version >= 300000) */\n\n#  ifdef IPFILTER_M_IPFILTER\n#    include <sys/malloc.h>\nMALLOC_DECLARE(M_IPFILTER);\n#    define\t_M_IPF\t\tM_IPFILTER\n#  else /* IPFILTER_M_IPFILTER */\n#   ifdef M_PFIL\n#    define\t_M_IPF\t\tM_PFIL\n#   else\n#    ifdef M_IPFILTER\n#     define\t_M_IPF\t\tM_IPFILTER\n#    else\n#     define\t_M_IPF\t\tM_TEMP\n#    endif /* M_IPFILTER */\n#   endif /* M_PFIL */\n#  endif /* IPFILTER_M_IPFILTER */\n#  if defined(__FreeBSD__) && __FreeBSD_version >= 800051\n#   define\tKMALLOC(a, b)\tdo {\t\t\t\\\n\ta = (b)malloc(sizeof(*(a)), _M_IPF, M_NOWAIT); \\\n    } while (0)\n#   define\tKMALLOCS(a, b, c)\tdo { \\\n\ta = (b)malloc((c), _M_IPF, ((c) > 4096) ? M_WAITOK : M_NOWAIT); \\\n    } while (0)\n#   define\tKFREE(x)\tfree((x), _M_IPF)\n#   define\tKFREES(x,s)\tfree((x), _M_IPF)\n#  else\n#   define\tKMALLOC(a, b)\tMALLOC((a), b, sizeof(*(a)), _M_IPF, M_NOWAIT)\n#   if !defined(KMALLOCS)\n#    define\tKMALLOCS(a, b, c)\tMALLOC((a), b, (c), _M_IPF, M_NOWAIT)\n#   endif\n#   define\tKFREE(x)\tFREE((x), _M_IPF)\n#   define\tKFREES(x,s)\tFREE((x), _M_IPF)\n#  endif\n#  define\tUIOMOVE(a,b,c,d)\tuiomove((caddr_t)a,b,d)\n#  define\tSLEEP(id, n)\ttsleep((id), PPAUSE|PCATCH, n, 0)\n#  define\tWAKEUP(id,x)\twakeup(id+x)\n#  define\tPOLLWAKEUP(x)\tselwakeup(ipfselwait+x)\n#  define\tGETIFP(n, v)\tifunit(n)\n# endif /* (Free)BSD */\n\n# if !defined(USE_MUTEXES) && !defined(SPL_NET)\n#  if (defined(NetBSD) && (NetBSD <= 1991011) && (NetBSD >= 199407)) || \\\n      (defined(OpenBSD) && (OpenBSD >= 200006))\n#   define\tSPL_NET(x)\tx = splsoftnet()\n#  else\n#   define\tSPL_IMP(x)\tx = splimp()\n#   define\tSPL_NET(x)\tx = splnet()\n#  endif /* NetBSD && (NetBSD <= 1991011) && (NetBSD >= 199407) */\n#  if !defined(SPL_SCHED)\n#   define\tSPL_SCHED(x)\tx = splsched()\n#  endif\n#  define\tSPL_X(x)\t(void) splx(x)\n# endif /* !USE_MUTEXES */\n\n# ifndef FREE_MB_T\n#  define\tFREE_MB_T(m)\tm_freem(m)\n# endif\n\n# ifndef MTOD\n#  define\tMTOD(m,t)\tmtod(m,t)\n# endif\n\n# ifndef COPYIN\n#  define\tCOPYIN(a,b,c)\t(bcopy((caddr_t)(a), (caddr_t)(b), (c)), 0)\n#  define\tCOPYOUT(a,b,c)\t(bcopy((caddr_t)(a), (caddr_t)(b), (c)), 0)\n# endif\n\n# ifndef KMALLOC\n#  define\tKMALLOC(a,b)\t(a) = (b)new_kmem_alloc(sizeof(*(a)), \\\n\t\t\t\t\t\t\tKMEM_NOSLEEP)\n#  define\tKMALLOCS(a,b,c)\t(a) = (b)new_kmem_alloc((c), KMEM_NOSLEEP)\n# endif\n\n# ifndef\tGET_MINOR\n#  define\tGET_MINOR(x)\tdev2unit(x)\n# endif\n# define\tPANIC(x,y)\tif (x) panic y\n#endif /* _KERNEL */\n\n#if !defined(IFNAME) && !defined(_KERNEL)\n# define\tIFNAME(x)\t((struct ifnet *)x)->if_name\n#endif\n#ifndef\tCOPYIFNAME\n# define\tNEED_FRGETIFNAME\nextern\tchar\t*fr_getifname __P((struct ifnet *, char *));\n# define\tCOPYIFNAME(v, x, b) \\\n\t\t\t\tfr_getifname((struct ifnet *)x, b)\n#endif\n\n#ifndef ASSERT\n# ifdef _KERNEL\n#  define\tASSERT(x)\n# else\n#  define\tASSERT(x)\tdo { if (!(x)) abort(); } while (0)\n# endif\n#endif\n\n#ifndef BCOPYIN\n#  define\tBCOPYIN(a,b,c)\t(bcopy((caddr_t)(a), (caddr_t)(b), (c)), 0)\n#  define\tBCOPYOUT(a,b,c)\t(bcopy((caddr_t)(a), (caddr_t)(b), (c)), 0)\n#endif\n\n/*\n * Because the ctype(3) posix definition, if used \"safely\" in code everywhere,\n * would mean all normal code that walks through strings needed casts.  Yuck.\n */\n#define\tISALNUM(x)\tisalnum((u_char)(x))\n#define\tISALPHA(x)\tisalpha((u_char)(x))\n#define\tISASCII(x)\tisascii((u_char)(x))\n#define\tISDIGIT(x)\tisdigit((u_char)(x))\n#define\tISPRINT(x)\tisprint((u_char)(x))\n#define\tISSPACE(x)\tisspace((u_char)(x))\n#define\tISUPPER(x)\tisupper((u_char)(x))\n#define\tISXDIGIT(x)\tisxdigit((u_char)(x))\n#define\tISLOWER(x)\tislower((u_char)(x))\n#define\tTOUPPER(x)\ttoupper((u_char)(x))\n#define\tTOLOWER(x)\ttolower((u_char)(x))\n\n/*\n * If mutexes aren't being used, turn all the mutex functions into null-ops.\n */\n#if !defined(USE_MUTEXES)\n# define\tUSE_SPL\t\t\t1\n# undef\t\tRW_DESTROY\n# undef\t\tMUTEX_INIT\n# undef\t\tMUTEX_NUKE\n# undef\t\tMUTEX_DESTROY\n# define\tMUTEX_ENTER(x)\t\t;\n# define\tREAD_ENTER(x)\t\t;\n# define\tWRITE_ENTER(x)\t\t;\n# define\tMUTEX_DOWNGRADE(x)\t;\n# define\tRWLOCK_INIT(x, y)\t;\n# define\tRWLOCK_EXIT(x)\t\t;\n# define\tRW_DESTROY(x)\t\t;\n# define\tMUTEX_EXIT(x)\t\t;\n# define\tMUTEX_INIT(x,y)\t\t;\n# define\tMUTEX_DESTROY(x)\t;\n# define\tMUTEX_NUKE(x)\t\t;\n#endif /* !USE_MUTEXES */\n#ifndef\tATOMIC_INC\n# define\tATOMIC_INC(x)\t\t(x)++\n# define\tATOMIC_DEC(x)\t\t(x)--\n#endif\n\n#if defined(USE_SPL) && defined(_KERNEL)\n# define\tSPL_INT(x)\tint x\n#else\n# define\tSPL_INT(x)\n#endif\n\n/*\n * If there are no atomic operations for bit sizes defined, define them to all\n * use a generic one that works for all sizes.\n */\n#ifndef\tATOMIC_INCL\n# define\tATOMIC_INCL\t\tATOMIC_INC\n# define\tATOMIC_INC64\t\tATOMIC_INC\n# define\tATOMIC_INC32\t\tATOMIC_INC\n# define\tATOMIC_INC16\t\tATOMIC_INC\n# define\tATOMIC_DECL\t\tATOMIC_DEC\n# define\tATOMIC_DEC64\t\tATOMIC_DEC\n# define\tATOMIC_DEC32\t\tATOMIC_DEC\n# define\tATOMIC_DEC16\t\tATOMIC_DEC\n#endif\n\n#ifndef HDR_T_PRIVATE\ntypedef\tstruct\ttcphdr\ttcphdr_t;\ntypedef\tstruct\tudphdr\tudphdr_t;\n#endif\ntypedef\tstruct\ticmp\ticmphdr_t;\ntypedef\tstruct\tip\tip_t;\ntypedef\tstruct\tether_header\tether_header_t;\ntypedef\tstruct\ttcpiphdr\ttcpiphdr_t;\n\n#ifndef\tFR_GROUPLEN\n# define\tFR_GROUPLEN\t16\n#endif\n\n#ifndef offsetof\n# define offsetof(t,m) (int)((&((t *)0L)->m))\n#endif\n\n/*\n * This set of macros has been brought about because on Tru64 it is not\n * possible to easily assign or examine values in a structure that are\n * bit fields.\n */\n#ifndef IP_V\n# define\tIP_V(x)\t\t(x)->ip_v\n#endif\n#ifndef\tIP_V_A\n# define\tIP_V_A(x,y)\t(x)->ip_v = (y)\n#endif\n#ifndef\tIP_HL\n# define\tIP_HL(x)\t(x)->ip_hl\n#endif\n#ifndef\tIP_HL_A\n# define\tIP_HL_A(x,y)\t(x)->ip_hl = ((y) & 0xf)\n#endif\n#ifndef\tTCP_X2\n# define\tTCP_X2(x)\t(x)->th_x2\n#endif\n#ifndef\tTCP_X2_A\n# define\tTCP_X2_A(x,y)\t(x)->th_x2 = (y)\n#endif\n#ifndef\tTCP_OFF\n# define\tTCP_OFF(x)\t(x)->th_off\n#endif\n#ifndef\tTCP_OFF_A\n# define\tTCP_OFF_A(x,y)\t(x)->th_off = (y)\n#endif\n#define\tIPMINLEN(i, h)\t((i)->ip_len >= (IP_HL(i) * 4 + sizeof(struct h)))\n\n\n/*\n * XXX - This is one of those *awful* hacks which nobody likes\n */\n#ifdef\tultrix\n#define\tA_A\n#else\n#define\tA_A\t&\n#endif\n\n#define\tTCPF_ALL\t(TH_FIN|TH_SYN|TH_RST|TH_PUSH|TH_ACK|TH_URG|\\\n\t\t\t TH_ECN|TH_CWR)\n\n#if (BSD >= 199306) && !defined(m_act)\n# define\tm_act\tm_nextpkt\n#endif  \n\n/*\n * Security Options for Intenet Protocol (IPSO) as defined in RFC 1108.\n *\n * Basic Option\n *\n * 00000001   -   (Reserved 4)\n * 00111101   -   Top Secret\n * 01011010   -   Secret\n * 10010110   -   Confidential\n * 01100110   -   (Reserved 3)\n * 11001100   -   (Reserved 2)\n * 10101011   -   Unclassified\n * 11110001   -   (Reserved 1)\n */\n#define\tIPSO_CLASS_RES4\t\t0x01\n#define\tIPSO_CLASS_TOPS\t\t0x3d\n#define\tIPSO_CLASS_SECR\t\t0x5a\n#define\tIPSO_CLASS_CONF\t\t0x96\n#define\tIPSO_CLASS_RES3\t\t0x66\n#define\tIPSO_CLASS_RES2\t\t0xcc\n#define\tIPSO_CLASS_UNCL\t\t0xab\n#define\tIPSO_CLASS_RES1\t\t0xf1\n\n#define\tIPSO_AUTH_GENSER\t0x80\n#define\tIPSO_AUTH_ESI\t\t0x40\n#define\tIPSO_AUTH_SCI\t\t0x20\n#define\tIPSO_AUTH_NSA\t\t0x10\n#define\tIPSO_AUTH_DOE\t\t0x08\n#define\tIPSO_AUTH_UN\t\t0x06\n#define\tIPSO_AUTH_FTE\t\t0x01\n\n/*\n * IP option #defines\n */\n#undef\tIPOPT_RR\n#define\tIPOPT_RR\t7 \n#undef\tIPOPT_ZSU\n#define\tIPOPT_ZSU\t10\t/* ZSU */\n#undef\tIPOPT_MTUP\n#define\tIPOPT_MTUP\t11\t/* MTUP */\n#undef\tIPOPT_MTUR\n#define\tIPOPT_MTUR\t12\t/* MTUR */\n#undef\tIPOPT_ENCODE\n#define\tIPOPT_ENCODE\t15\t/* ENCODE */\n#undef\tIPOPT_TS\n#define\tIPOPT_TS\t68\n#undef\tIPOPT_TR\n#define\tIPOPT_TR\t82\t/* TR */\n#undef\tIPOPT_SECURITY\n#define\tIPOPT_SECURITY\t130\n#undef\tIPOPT_LSRR\n#define\tIPOPT_LSRR\t131\n#undef\tIPOPT_E_SEC\n#define\tIPOPT_E_SEC\t133\t/* E-SEC */\n#undef\tIPOPT_CIPSO\n#define\tIPOPT_CIPSO\t134\t/* CIPSO */\n#undef\tIPOPT_SATID\n#define\tIPOPT_SATID\t136\n#ifndef\tIPOPT_SID\n# define\tIPOPT_SID\tIPOPT_SATID\n#endif\n#undef\tIPOPT_SSRR\n#define\tIPOPT_SSRR\t137\n#undef\tIPOPT_ADDEXT\n#define\tIPOPT_ADDEXT\t147\t/* ADDEXT */\n#undef\tIPOPT_VISA\n#define\tIPOPT_VISA\t142\t/* VISA */\n#undef\tIPOPT_IMITD\n#define\tIPOPT_IMITD\t144\t/* IMITD */\n#undef\tIPOPT_EIP\n#define\tIPOPT_EIP\t145\t/* EIP */\n#undef\tIPOPT_RTRALRT\n#define\tIPOPT_RTRALRT\t148\t/* RTRALRT */\n#undef\tIPOPT_SDB\n#define\tIPOPT_SDB\t149\n#undef\tIPOPT_NSAPA\n#define\tIPOPT_NSAPA\t150\n#undef\tIPOPT_DPS\n#define\tIPOPT_DPS\t151\n#undef\tIPOPT_UMP\n#define\tIPOPT_UMP\t152\n#undef\tIPOPT_FINN\n#define\tIPOPT_FINN\t205\t/* FINN */\n\n#ifndef TCPOPT_EOL\n# define TCPOPT_EOL\t\t0\n#endif\n#ifndef TCPOPT_NOP\n# define TCPOPT_NOP\t\t1\n#endif\n#ifndef TCPOPT_MAXSEG\n# define TCPOPT_MAXSEG\t\t2\n#endif\n#ifndef TCPOLEN_MAXSEG\n# define TCPOLEN_MAXSEG\t\t4\n#endif\n#ifndef TCPOPT_WINDOW\n# define TCPOPT_WINDOW\t\t3\n#endif\n#ifndef TCPOLEN_WINDOW\n# define TCPOLEN_WINDOW\t\t3\n#endif\n#ifndef TCPOPT_SACK_PERMITTED\n# define TCPOPT_SACK_PERMITTED\t4\n#endif\n#ifndef TCPOLEN_SACK_PERMITTED\n# define TCPOLEN_SACK_PERMITTED\t2\n#endif\n#ifndef TCPOPT_SACK\n# define TCPOPT_SACK\t\t5\n#endif\n#ifndef TCPOPT_TIMESTAMP\n# define TCPOPT_TIMESTAMP\t8\n#endif\n\n#ifndef\tICMP_MINLEN\n# define\tICMP_MINLEN\t8\n#endif\n#ifndef\tICMP_ECHOREPLY\n# define\tICMP_ECHOREPLY\t0\n#endif\n#ifndef\tICMP_UNREACH\n# define\tICMP_UNREACH\t3\n#endif\n#ifndef\tICMP_UNREACH_NET\n# define\tICMP_UNREACH_NET\t0\n#endif\n#ifndef\tICMP_UNREACH_HOST\n# define\tICMP_UNREACH_HOST\t1\n#endif\n#ifndef\tICMP_UNREACH_PROTOCOL\n# define\tICMP_UNREACH_PROTOCOL\t2\n#endif\n#ifndef\tICMP_UNREACH_PORT\n# define\tICMP_UNREACH_PORT\t3\n#endif\n#ifndef\tICMP_UNREACH_NEEDFRAG\n# define\tICMP_UNREACH_NEEDFRAG\t4\n#endif\n#ifndef\tICMP_UNREACH_SRCFAIL\n# define\tICMP_UNREACH_SRCFAIL\t5\n#endif\n#ifndef\tICMP_UNREACH_NET_UNKNOWN\n# define\tICMP_UNREACH_NET_UNKNOWN\t6\n#endif\n#ifndef\tICMP_UNREACH_HOST_UNKNOWN\n# define\tICMP_UNREACH_HOST_UNKNOWN\t7\n#endif\n#ifndef\tICMP_UNREACH_ISOLATED\n# define\tICMP_UNREACH_ISOLATED\t8\n#endif\n#ifndef\tICMP_UNREACH_NET_PROHIB\n# define\tICMP_UNREACH_NET_PROHIB\t9\n#endif\n#ifndef\tICMP_UNREACH_HOST_PROHIB\n# define\tICMP_UNREACH_HOST_PROHIB\t10\n#endif\n#ifndef\tICMP_UNREACH_TOSNET\n# define\tICMP_UNREACH_TOSNET\t11\n#endif\n#ifndef\tICMP_UNREACH_TOSHOST\n# define\tICMP_UNREACH_TOSHOST\t12\n#endif\n#ifndef\tICMP_UNREACH_ADMIN_PROHIBIT\n# define\tICMP_UNREACH_ADMIN_PROHIBIT\t13\n#endif\n#ifndef\tICMP_UNREACH_FILTER\n# define\tICMP_UNREACH_FILTER\t13\n#endif\n#ifndef\tICMP_UNREACH_HOST_PRECEDENCE\n# define\tICMP_UNREACH_HOST_PRECEDENCE\t14\n#endif\n#ifndef\tICMP_UNREACH_PRECEDENCE_CUTOFF\n# define\tICMP_UNREACH_PRECEDENCE_CUTOFF\t15\n#endif\n#ifndef\tICMP_SOURCEQUENCH\n# define\tICMP_SOURCEQUENCH\t4\n#endif\n#ifndef\tICMP_REDIRECT_NET\n# define\tICMP_REDIRECT_NET\t0\n#endif\n#ifndef\tICMP_REDIRECT_HOST\n# define\tICMP_REDIRECT_HOST\t1\n#endif\n#ifndef\tICMP_REDIRECT_TOSNET\n# define\tICMP_REDIRECT_TOSNET\t2\n#endif\n#ifndef\tICMP_REDIRECT_TOSHOST\n# define\tICMP_REDIRECT_TOSHOST\t3\n#endif\n#ifndef\tICMP_ALTHOSTADDR\n# define\tICMP_ALTHOSTADDR\t6\n#endif\n#ifndef\tICMP_TIMXCEED\n# define\tICMP_TIMXCEED\t11\n#endif\n#ifndef\tICMP_TIMXCEED_INTRANS\n# define\tICMP_TIMXCEED_INTRANS\t0\n#endif\n#ifndef\tICMP_TIMXCEED_REASS\n# define\t\tICMP_TIMXCEED_REASS\t1\n#endif\n#ifndef\tICMP_PARAMPROB\n# define\tICMP_PARAMPROB\t12\n#endif\n#ifndef\tICMP_PARAMPROB_ERRATPTR\n# define\tICMP_PARAMPROB_ERRATPTR\t0\n#endif\n#ifndef\tICMP_PARAMPROB_OPTABSENT\n# define\tICMP_PARAMPROB_OPTABSENT\t1\n#endif\n#ifndef\tICMP_PARAMPROB_LENGTH\n# define\tICMP_PARAMPROB_LENGTH\t2\n#endif\n#ifndef ICMP_TSTAMP\n# define\tICMP_TSTAMP\t13\n#endif\n#ifndef ICMP_TSTAMPREPLY\n# define\tICMP_TSTAMPREPLY\t14\n#endif\n#ifndef ICMP_IREQ\n# define\tICMP_IREQ\t15\n#endif\n#ifndef ICMP_IREQREPLY\n# define\tICMP_IREQREPLY\t16\n#endif\n#ifndef\tICMP_MASKREQ\n# define\tICMP_MASKREQ\t17\n#endif\n#ifndef ICMP_MASKREPLY\n# define\tICMP_MASKREPLY\t18\n#endif\n#ifndef\tICMP_TRACEROUTE\n# define\tICMP_TRACEROUTE\t30\n#endif\n#ifndef\tICMP_DATACONVERR\n# define\tICMP_DATACONVERR\t31\n#endif\n#ifndef\tICMP_MOBILE_REDIRECT\n# define\tICMP_MOBILE_REDIRECT\t32\n#endif\n#ifndef\tICMP_IPV6_WHEREAREYOU\n# define\tICMP_IPV6_WHEREAREYOU\t33\n#endif\n#ifndef\tICMP_IPV6_IAMHERE\n# define\tICMP_IPV6_IAMHERE\t34\n#endif\n#ifndef\tICMP_MOBILE_REGREQUEST\n# define\tICMP_MOBILE_REGREQUEST\t35\n#endif\n#ifndef\tICMP_MOBILE_REGREPLY\n# define\tICMP_MOBILE_REGREPLY\t36\n#endif\n#ifndef\tICMP_SKIP\n# define\tICMP_SKIP\t39\n#endif\n#ifndef\tICMP_PHOTURIS\n# define\tICMP_PHOTURIS\t40\n#endif\n#ifndef\tICMP_PHOTURIS_UNKNOWN_INDEX\n# define\tICMP_PHOTURIS_UNKNOWN_INDEX\t1\n#endif\n#ifndef\tICMP_PHOTURIS_AUTH_FAILED\n# define\tICMP_PHOTURIS_AUTH_FAILED\t2\n#endif\n#ifndef\tICMP_PHOTURIS_DECRYPT_FAILED\n# define\tICMP_PHOTURIS_DECRYPT_FAILED\t3\n#endif\n#ifndef\tIPVERSION\n# define\tIPVERSION\t4\n#endif\n#ifndef\tIPOPT_MINOFF\n# define\tIPOPT_MINOFF\t4\n#endif\n#ifndef\tIPOPT_COPIED\n# define\tIPOPT_COPIED(x)\t((x)&0x80)\n#endif\n#ifndef\tIPOPT_EOL\n# define\tIPOPT_EOL\t0\n#endif\n#ifndef\tIPOPT_NOP\n# define\tIPOPT_NOP\t1\n#endif\n#ifndef\tIP_MF\n# define\tIP_MF\t((u_short)0x2000)\n#endif\n#ifndef\tETHERTYPE_IP\n# define\tETHERTYPE_IP\t((u_short)0x0800)\n#endif\n#ifndef\tTH_FIN\n# define\tTH_FIN\t0x01\n#endif\n#ifndef\tTH_SYN\n# define\tTH_SYN\t0x02\n#endif\n#ifndef\tTH_RST\n# define\tTH_RST\t0x04\n#endif\n#ifndef\tTH_PUSH\n# define\tTH_PUSH\t0x08\n#endif\n#ifndef\tTH_ACK\n# define\tTH_ACK\t0x10\n#endif\n#ifndef\tTH_URG\n# define\tTH_URG\t0x20\n#endif\n#undef\tTH_ACKMASK\n#define\tTH_ACKMASK\t(TH_FIN|TH_SYN|TH_RST|TH_ACK)\n\n#ifndef\tIPOPT_EOL\n# define\tIPOPT_EOL\t0\n#endif\n#ifndef\tIPOPT_NOP\n# define\tIPOPT_NOP\t1\n#endif\n#ifndef\tIPOPT_RR\n# define\tIPOPT_RR\t7\n#endif\n#ifndef\tIPOPT_TS\n# define\tIPOPT_TS\t68\n#endif\n#ifndef\tIPOPT_SECURITY\n# define\tIPOPT_SECURITY\t130\n#endif\n#ifndef\tIPOPT_LSRR\n# define\tIPOPT_LSRR\t131\n#endif\n#ifndef\tIPOPT_SATID\n# define\tIPOPT_SATID\t136\n#endif\n#ifndef\tIPOPT_SSRR\n# define\tIPOPT_SSRR\t137\n#endif\n#ifndef\tIPOPT_SECUR_UNCLASS\n# define\tIPOPT_SECUR_UNCLASS\t((u_short)0x0000)\n#endif\n#ifndef\tIPOPT_SECUR_CONFID\n# define\tIPOPT_SECUR_CONFID\t((u_short)0xf135)\n#endif\n#ifndef\tIPOPT_SECUR_EFTO\n# define\tIPOPT_SECUR_EFTO\t((u_short)0x789a)\n#endif\n#ifndef\tIPOPT_SECUR_MMMM\n# define\tIPOPT_SECUR_MMMM\t((u_short)0xbc4d)\n#endif\n#ifndef\tIPOPT_SECUR_RESTR\n# define\tIPOPT_SECUR_RESTR\t((u_short)0xaf13)\n#endif\n#ifndef\tIPOPT_SECUR_SECRET\n# define\tIPOPT_SECUR_SECRET\t((u_short)0xd788)\n#endif\n#ifndef IPOPT_SECUR_TOPSECRET\n# define\tIPOPT_SECUR_TOPSECRET\t((u_short)0x6bc5)\n#endif\n#ifndef IPOPT_OLEN\n# define\tIPOPT_OLEN\t1\n#endif\n#ifndef\tIPPROTO_HOPOPTS\n# define\tIPPROTO_HOPOPTS\t0\n#endif\n#ifndef\tIPPROTO_ENCAP\n# define\tIPPROTO_ENCAP\t4\n#endif\n#ifndef\tIPPROTO_IPV6\n# define\tIPPROTO_IPV6\t41\n#endif\n#ifndef\tIPPROTO_ROUTING\n# define\tIPPROTO_ROUTING\t43\n#endif\n#ifndef\tIPPROTO_FRAGMENT\n# define\tIPPROTO_FRAGMENT\t44\n#endif\n#ifndef\tIPPROTO_GRE\n# define\tIPPROTO_GRE\t47\t/* GRE encaps RFC 1701 */\n#endif\n#ifndef\tIPPROTO_ESP\n# define\tIPPROTO_ESP\t50\n#endif\n#ifndef\tIPPROTO_AH\n# define\tIPPROTO_AH\t51\n#endif\n#ifndef\tIPPROTO_ICMPV6\n# define\tIPPROTO_ICMPV6\t58\n#endif\n#ifndef\tIPPROTO_NONE\n# define\tIPPROTO_NONE\t59\n#endif\n#ifndef\tIPPROTO_DSTOPTS\n# define\tIPPROTO_DSTOPTS\t60\n#endif\n#ifndef\tIPPROTO_MOBILITY\n# define\tIPPROTO_MOBILITY\t135\n#endif\n\n#ifndef\tICMP_ROUTERADVERT\n# define\tICMP_ROUTERADVERT\t9\n#endif\n#ifndef\tICMP_ROUTERSOLICIT\n# define\tICMP_ROUTERSOLICIT\t10\n#endif\n#ifndef\tICMP6_DST_UNREACH\n# define\tICMP6_DST_UNREACH\t1\n#endif\n#ifndef\tICMP6_PACKET_TOO_BIG\n# define\tICMP6_PACKET_TOO_BIG\t2\n#endif\n#ifndef\tICMP6_TIME_EXCEEDED\n# define\tICMP6_TIME_EXCEEDED\t3\n#endif\n#ifndef\tICMP6_PARAM_PROB\n# define\tICMP6_PARAM_PROB\t4\n#endif\n\n#ifndef\tICMP6_ECHO_REQUEST\n# define\tICMP6_ECHO_REQUEST\t128\n#endif\n#ifndef\tICMP6_ECHO_REPLY\n# define\tICMP6_ECHO_REPLY\t129\n#endif\n#ifndef\tICMP6_MEMBERSHIP_QUERY\n# define\tICMP6_MEMBERSHIP_QUERY\t130\n#endif\n#ifndef\tMLD6_LISTENER_QUERY\n# define\tMLD6_LISTENER_QUERY\t130\n#endif\n#ifndef\tICMP6_MEMBERSHIP_REPORT\n# define\tICMP6_MEMBERSHIP_REPORT\t131\n#endif\n#ifndef\tMLD6_LISTENER_REPORT\n# define\tMLD6_LISTENER_REPORT\t131\n#endif\n#ifndef\tICMP6_MEMBERSHIP_REDUCTION\n# define\tICMP6_MEMBERSHIP_REDUCTION\t132\n#endif\n#ifndef\tMLD6_LISTENER_DONE\n# define\tMLD6_LISTENER_DONE\t132\n#endif\n#ifndef\tND_ROUTER_SOLICIT\n# define\tND_ROUTER_SOLICIT\t133\n#endif\n#ifndef\tND_ROUTER_ADVERT\n# define\tND_ROUTER_ADVERT\t134\n#endif\n#ifndef\tND_NEIGHBOR_SOLICIT\n# define\tND_NEIGHBOR_SOLICIT\t135\n#endif\n#ifndef\tND_NEIGHBOR_ADVERT\n# define\tND_NEIGHBOR_ADVERT\t136\n#endif\n#ifndef\tND_REDIRECT\n# define\tND_REDIRECT\t137\n#endif\n#ifndef\tICMP6_ROUTER_RENUMBERING\n# define\tICMP6_ROUTER_RENUMBERING\t138\n#endif\n#ifndef\tICMP6_WRUREQUEST\n# define\tICMP6_WRUREQUEST\t139\n#endif\n#ifndef\tICMP6_WRUREPLY\n# define\tICMP6_WRUREPLY\t\t140\n#endif\n#ifndef\tICMP6_FQDN_QUERY\n# define\tICMP6_FQDN_QUERY\t139\n#endif\n#ifndef\tICMP6_FQDN_REPLY\n# define\tICMP6_FQDN_REPLY\t140\n#endif\n#ifndef\tICMP6_NI_QUERY\n# define\tICMP6_NI_QUERY\t\t139\n#endif\n#ifndef\tICMP6_NI_REPLY\n# define\tICMP6_NI_REPLY\t\t140\n#endif\n#ifndef\tMLD6_MTRACE_RESP\n# define\tMLD6_MTRACE_RESP\t200\n#endif\n#ifndef\tMLD6_MTRACE\n# define\tMLD6_MTRACE\t\t201\n#endif\n#ifndef\tICMP6_HADISCOV_REQUEST\n# define\tICMP6_HADISCOV_REQUEST\t202\n#endif\n#ifndef\tICMP6_HADISCOV_REPLY\n# define\tICMP6_HADISCOV_REPLY\t203\n#endif\n#ifndef\tICMP6_MOBILEPREFIX_SOLICIT\n# define\tICMP6_MOBILEPREFIX_SOLICIT\t204\n#endif\n#ifndef\tICMP6_MOBILEPREFIX_ADVERT\n# define\tICMP6_MOBILEPREFIX_ADVERT\t205\n#endif\n#ifndef\tICMP6_MAXTYPE\n# define\tICMP6_MAXTYPE\t\t205\n#endif\n\n#ifndef\tICMP6_DST_UNREACH_NOROUTE\n# define\tICMP6_DST_UNREACH_NOROUTE\t0\n#endif\n#ifndef\tICMP6_DST_UNREACH_ADMIN\n# define\tICMP6_DST_UNREACH_ADMIN\t\t1\n#endif\n#ifndef\tICMP6_DST_UNREACH_NOTNEIGHBOR\n# define\tICMP6_DST_UNREACH_NOTNEIGHBOR\t2\n#endif\n#ifndef\tICMP6_DST_UNREACH_BEYONDSCOPE\n# define\tICMP6_DST_UNREACH_BEYONDSCOPE\t2\n#endif\n#ifndef\tICMP6_DST_UNREACH_ADDR\n# define\tICMP6_DST_UNREACH_ADDR\t\t3\n#endif\n#ifndef\tICMP6_DST_UNREACH_NOPORT\n# define\tICMP6_DST_UNREACH_NOPORT\t4\n#endif\n#ifndef\tICMP6_TIME_EXCEED_TRANSIT\n# define\tICMP6_TIME_EXCEED_TRANSIT\t0\n#endif\n#ifndef\tICMP6_TIME_EXCEED_REASSEMBLY\n# define\tICMP6_TIME_EXCEED_REASSEMBLY\t1\n#endif\n\n#ifndef\tICMP6_NI_SUCCESS\n# define\tICMP6_NI_SUCCESS\t0\n#endif\n#ifndef\tICMP6_NI_REFUSED\n# define\tICMP6_NI_REFUSED\t1\n#endif\n#ifndef\tICMP6_NI_UNKNOWN\n# define\tICMP6_NI_UNKNOWN\t2\n#endif\n\n#ifndef\tICMP6_ROUTER_RENUMBERING_COMMAND\n# define\tICMP6_ROUTER_RENUMBERING_COMMAND\t0\n#endif\n#ifndef\tICMP6_ROUTER_RENUMBERING_RESULT\n# define\tICMP6_ROUTER_RENUMBERING_RESULT\t1\n#endif\n#ifndef\tICMP6_ROUTER_RENUMBERING_SEQNUM_RESET\n# define\tICMP6_ROUTER_RENUMBERING_SEQNUM_RESET\t255\n#endif\n\n#ifndef\tICMP6_PARAMPROB_HEADER\n# define\tICMP6_PARAMPROB_HEADER\t0\n#endif\n#ifndef\tICMP6_PARAMPROB_NEXTHEADER\n# define\tICMP6_PARAMPROB_NEXTHEADER\t1\n#endif\n#ifndef\tICMP6_PARAMPROB_OPTION\n# define\tICMP6_PARAMPROB_OPTION\t2\n#endif\n\n#ifndef\tICMP6_NI_SUBJ_IPV6\n# define\tICMP6_NI_SUBJ_IPV6\t0\n#endif\n#ifndef\tICMP6_NI_SUBJ_FQDN\n# define\tICMP6_NI_SUBJ_FQDN\t1\n#endif\n#ifndef\tICMP6_NI_SUBJ_IPV4\n# define\tICMP6_NI_SUBJ_IPV4\t2\n#endif\n\n/*\n * ECN is a new addition to TCP - RFC 2481\n */\n#ifndef TH_ECN\n# define\tTH_ECN\t0x40\n#endif\n#ifndef TH_CWR\n# define\tTH_CWR\t0x80\n#endif\n#define\tTH_ECNALL\t(TH_ECN|TH_CWR)\n\n/*\n * TCP States\n */\n#define IPF_TCPS_LISTEN\t\t0\t/* listening for connection */\n#define IPF_TCPS_SYN_SENT\t1\t/* active, have sent syn */\n#define IPF_TCPS_SYN_RECEIVED\t2\t/* have send and received syn */\n#define IPF_TCPS_HALF_ESTAB\t3\t/* for connections not fully \"up\" */\n/* states < IPF_TCPS_ESTABLISHED are those where connections not established */\n#define IPF_TCPS_ESTABLISHED\t4\t/* established */\n#define IPF_TCPS_CLOSE_WAIT\t5\t/* rcvd fin, waiting for close */\n/* states > IPF_TCPS_CLOSE_WAIT are those where user has closed */\n#define IPF_TCPS_FIN_WAIT_1\t6\t/* have closed, sent fin */\n#define IPF_TCPS_CLOSING\t7\t/* closed xchd FIN; await FIN ACK */\n#define IPF_TCPS_LAST_ACK\t8\t/* had fin and close; await FIN ACK */\n/* states > IPF_TCPS_CLOSE_WAIT && < IPF_TCPS_FIN_WAIT_2 await ACK of FIN */\n#define IPF_TCPS_FIN_WAIT_2\t9\t/* have closed, fin is acked */\n#define IPF_TCPS_TIME_WAIT\t10\t/* in 2*msl quiet wait after close */\n#define IPF_TCPS_CLOSED\t\t11\t/* closed */\n#define IPF_TCP_NSTATES\t\t12\n\n#define\tTCP_MSL\t\t\t120\n\n#undef\tICMP_MAX_UNREACH\n#define\tICMP_MAX_UNREACH\t14\n#undef\tICMP_MAXTYPE\n#define\tICMP_MAXTYPE\t\t18\n\n#ifndef\tIFNAMSIZ\n#define\tIFNAMSIZ\t\t16\n#endif\n\n#ifndef\tLOG_FTP\n# define\tLOG_FTP\t\t(11<<3)\n#endif\n#ifndef\tLOG_AUTHPRIV\n# define\tLOG_AUTHPRIV\t(10<<3)\n#endif\n#ifndef\tLOG_AUDIT\n# define\tLOG_AUDIT\t(13<<3)\n#endif\n#ifndef\tLOG_NTP\n# define\tLOG_NTP\t\t(12<<3)\n#endif\n#ifndef\tLOG_SECURITY\n# define\tLOG_SECURITY\t(13<<3)\n#endif\n#ifndef\tLOG_LFMT\n# define\tLOG_LFMT\t(14<<3)\n#endif\n#ifndef\tLOG_CONSOLE\n# define\tLOG_CONSOLE\t(14<<3)\n#endif\n\n/*\n * ICMP error replies have an IP header (20 bytes), 8 bytes of ICMP data,\n * another IP header and then 64 bits of data, totalling 56.  Of course,\n * the last 64 bits is dependent on that being available.\n */\n#define\tICMPERR_ICMPHLEN\t8\n#define\tICMPERR_IPICMPHLEN\t(20 + 8)\n#define\tICMPERR_MINPKTLEN\t(20 + 8 + 20)\n#define\tICMPERR_MAXPKTLEN\t(20 + 8 + 20 + 8)\n#define ICMP6ERR_MINPKTLEN\t(40 + 8)\n#define ICMP6ERR_IPICMPHLEN\t(40 + 8 + 40)\n\n#ifndef MIN\n# define\tMIN(a,b)\t(((a)<(b))?(a):(b))\n#endif\n\n#ifdef IPF_DEBUG\n# define\tDPRINT(x)\tprintf x\n#else\n# define\tDPRINT(x)\n#endif\n\n#ifdef RESCUE\n# undef IPFILTER_BPF\n#endif\n\n#endif\t/* __IP_COMPAT_H__ */\n"
  },
  {
    "path": "freebsd-headers/netinet/ip_divert.h",
    "content": "/*-\n * Copyright (c) 2003 Sam Leffler, Errno Consulting\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer,\n *    without modification.\n * 2. Redistributions in binary form must reproduce at minimum a disclaimer\n *    similar to the \"NO WARRANTY\" disclaimer below (\"Disclaimer\") and any\n *    redistribution must be conditioned upon including a substantially\n *    similar Disclaimer requirement for further binary redistribution.\n * 3. Neither the names of the above-listed copyright holders nor the names\n *    of any contributors may be used to endorse or promote products derived\n *    from this software without specific prior written permission.\n *\n * NO WARRANTY\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n * LIMITED TO, THE IMPLIED WARRANTIES OF NONINFRINGEMENT, MERCHANTIBILITY\n * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL\n * THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY,\n * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\n * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\n * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER\n * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF\n * THE POSSIBILITY OF SUCH DAMAGES.\n *\n * $FreeBSD: release/9.0.0/sys/netinet/ip_divert.h 201527 2010-01-04 19:01:22Z luigi $\n */\n\n#ifndef _NETINET_IP_DIVERT_H_\n#define\t_NETINET_IP_DIVERT_H_\n\n/*\n * divert has no custom kernel-userland API.\n *\n * All communication occurs through a sockaddr_in socket where\n *\n * kernel-->userland\n *\tsin_port = matching rule, host format;\n * \tsin_addr = IN: first address of the incoming interface;\n *\t\t   OUT: INADDR_ANY\n *\tsin_zero = if fits, the interface name (max 7 bytes + NUL)\n *\n * userland->kernel\n *\tsin_port = restart-rule - 1, host order\n *\t\t(we restart at sin_port + 1)\n *\tsin_addr = IN: address of the incoming interface;\n *\t\t   OUT: INADDR_ANY\n */\n#endif /* _NETINET_IP_DIVERT_H_ */\n"
  },
  {
    "path": "freebsd-headers/netinet/ip_dummynet.h",
    "content": "/*-\n * Copyright (c) 1998-2010 Luigi Rizzo, Universita` di Pisa\n * Portions Copyright (c) 2000 Akamba Corp.\n * All rights reserved\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/netinet/ip_dummynet.h 206845 2010-04-19 16:17:30Z luigi $\n */\n\n#ifndef _IP_DUMMYNET_H\n#define _IP_DUMMYNET_H\n\n/*\n * Definition of the kernel-userland API for dummynet.\n *\n * Setsockopt() and getsockopt() pass a batch of objects, each\n * of them starting with a \"struct dn_id\" which should fully identify\n * the object and its relation with others in the sequence.\n * The first object in each request should have\n *\t type= DN_CMD_*, id = DN_API_VERSION.\n * For other objects, type and subtype specify the object, len indicates\n * the total length including the header, and 'id' identifies the specific\n * object.\n *\n * Most objects are numbered with an identifier in the range 1..65535.\n * DN_MAX_ID indicates the first value outside the range.\n */\n\n#define\tDN_API_VERSION\t12500000\n#define\tDN_MAX_ID\t0x10000\n\nstruct dn_id {\n\tuint16_t\tlen;\t/* total obj len including this header */\n\tuint8_t\t\ttype;\n\tuint8_t\t\tsubtype;\n\tuint32_t\tid;\t/* generic id */\n};\n\n/*\n * These values are in the type field of struct dn_id.\n * To preserve the ABI, never rearrange the list or delete\n * entries with the exception of DN_LAST\n */\nenum {\n\tDN_NONE = 0,\n\tDN_LINK = 1,\n\tDN_FS,\n\tDN_SCH,\n\tDN_SCH_I,\n\tDN_QUEUE,\n\tDN_DELAY_LINE,\n\tDN_PROFILE,\n\tDN_FLOW,\t\t/* struct dn_flow */\n\tDN_TEXT,\t\t/* opaque text is the object */\n\n\tDN_CMD_CONFIG = 0x80,\t/* objects follow */\n\tDN_CMD_DELETE,\t\t/* subtype + list of entries */\n\tDN_CMD_GET,\t\t/* subtype + list of entries */\n\tDN_CMD_FLUSH,\n\t/* for compatibility with FreeBSD 7.2/8 */\n\tDN_COMPAT_PIPE,\n\tDN_COMPAT_QUEUE,\n\tDN_GET_COMPAT,\n\n\t/* special commands for emulation of sysctl variables */\n\tDN_SYSCTL_GET,\n\tDN_SYSCTL_SET,\n\n\tDN_LAST,\n};\n\nenum { /* subtype for schedulers, flowset and the like */\n\tDN_SCHED_UNKNOWN = 0,\n\tDN_SCHED_FIFO = 1,\n\tDN_SCHED_WF2QP = 2,\n\t/* others are in individual modules */\n};\n\nenum {\t/* user flags */\n\tDN_HAVE_MASK\t= 0x0001,\t/* fs or sched has a mask */\n\tDN_NOERROR\t= 0x0002,\t/* do not report errors */\n\tDN_QHT_HASH\t= 0x0004,\t/* qht is a hash table */\n\tDN_QSIZE_BYTES\t= 0x0008,\t/* queue size is in bytes */\n\tDN_HAS_PROFILE\t= 0x0010,\t/* a link has a profile */\n\tDN_IS_RED\t= 0x0020,\n\tDN_IS_GENTLE_RED= 0x0040,\n\tDN_PIPE_CMD\t= 0x1000,\t/* pipe config... */\n};\n\n/*\n * link template.\n */\nstruct dn_link {\n\tstruct dn_id oid;\n\n\t/*\n\t * Userland sets bw and delay in bits/s and milliseconds.\n\t * The kernel converts this back and forth to bits/tick and ticks.\n\t * XXX what about burst ?\n\t */\n\tint32_t\t\tlink_nr;\n\tint\t\tbandwidth;\t/* bit/s or bits/tick.   */\n\tint\t\tdelay;\t\t/* ms and ticks */\n\tuint64_t\tburst;\t\t/* scaled. bits*Hz  XXX */\n};\n\n/*\n * A flowset, which is a template for flows. Contains parameters\n * from the command line: id, target scheduler, queue sizes, plr,\n * flow masks, buckets for the flow hash, and possibly scheduler-\n * specific parameters (weight, quantum and so on).\n */\nstruct dn_fs {\n\tstruct dn_id oid;\n\tuint32_t fs_nr;\t\t/* the flowset number */\n\tuint32_t flags;\t\t/* userland flags */\n\tint qsize;\t\t/* queue size in slots or bytes */\n\tint32_t plr;\t\t/* PLR, pkt loss rate (2^31-1 means 100%) */\n\tuint32_t buckets;\t/* buckets used for the queue hash table */\n\n\tstruct ipfw_flow_id flow_mask;\n\tuint32_t sched_nr;\t/* the scheduler we attach to */\n\t/* generic scheduler parameters. Leave them at -1 if unset.\n\t * Now we use 0: weight, 1: lmax, 2: priority\n\t */\n\tint par[4];\n\n\t/* RED/GRED parameters.\n\t * weight and probabilities are in the range 0..1 represented\n\t * in fixed point arithmetic with SCALE_RED decimal bits.\n\t */\n#define SCALE_RED\t16\n#define SCALE(x)\t( (x) << SCALE_RED )\n#define SCALE_VAL(x)\t( (x) >> SCALE_RED )\n#define SCALE_MUL(x,y)\t( ( (x) * (y) ) >> SCALE_RED )\n\tint w_q ;\t\t/* queue weight (scaled) */\n\tint max_th ;\t\t/* maximum threshold for queue (scaled) */\n\tint min_th ;\t\t/* minimum threshold for queue (scaled) */\n\tint max_p ;\t\t/* maximum value for p_b (scaled) */\n\n};\n\n/*\n * dn_flow collects flow_id and stats for queues and scheduler\n * instances, and is used to pass these info to userland.\n * oid.type/oid.subtype describe the object, oid.id is number\n * of the parent object.\n */\nstruct dn_flow {\n\tstruct dn_id\toid;\n\tstruct ipfw_flow_id fid;\n\tuint64_t\ttot_pkts; /* statistics counters  */\n\tuint64_t\ttot_bytes;\n\tuint32_t\tlength; /* Queue lenght, in packets */\n\tuint32_t\tlen_bytes; /* Queue lenght, in bytes */\n\tuint32_t\tdrops;\n};\n\n\n/*\n * Scheduler template, mostly indicating the name, number,\n * sched_mask and buckets.\n */\nstruct dn_sch {\n\tstruct dn_id\toid;\n\tuint32_t\tsched_nr; /* N, scheduler number */\n\tuint32_t\tbuckets; /* number of buckets for the instances */\n\tuint32_t\tflags;\t/* have_mask, ... */\n\n\tchar name[16];\t/* null terminated */\n\t/* mask to select the appropriate scheduler instance */\n\tstruct ipfw_flow_id sched_mask; /* M */\n};\n\n\n/* A delay profile is attached to a link.\n * Note that a profile, as any other object, cannot be longer than 2^16\n */\n#define\tED_MAX_SAMPLES_NO\t1024\nstruct dn_profile {\n\tstruct dn_id\toid;\n\t/* fields to simulate a delay profile */\n#define ED_MAX_NAME_LEN\t\t32\n\tchar\tname[ED_MAX_NAME_LEN];\n\tint\tlink_nr;\n\tint\tloss_level;\n\tint\tbandwidth;\t\t\t// XXX use link bandwidth?\n\tint\tsamples_no;\t\t\t/* actual len of samples[] */\n\tint\tsamples[ED_MAX_SAMPLES_NO];\t/* may be shorter */\n};\n\n\n\n/*\n * Overall structure of dummynet\n\nIn dummynet, packets are selected with the firewall rules, and passed\nto two different objects: PIPE or QUEUE (bad name).\n\nA QUEUE defines a classifier, which groups packets into flows\naccording to a 'mask', puts them into independent queues (one\nper flow) with configurable size and queue management policy,\nand passes flows to a scheduler:\n\n                 (flow_mask|sched_mask)  sched_mask\n\t +---------+   weight Wx  +-------------+\n         |         |->-[flow]-->--|             |-+\n    -->--| QUEUE x |   ...        |             | |\n         |         |->-[flow]-->--| SCHEDuler N | |\n\t +---------+              |             | |\n\t     ...                  |             +--[LINK N]-->--\n\t +---------+   weight Wy  |             | +--[LINK N]-->--\n         |         |->-[flow]-->--|             | |\n    -->--| QUEUE y |   ...        |             | |\n         |         |->-[flow]-->--|             | |\n\t +---------+              +-------------+ |\n\t                            +-------------+\n\nMany QUEUE objects can connect to the same scheduler, each\nQUEUE object can have its own set of parameters.\n\nIn turn, the SCHEDuler 'forks' multiple instances according\nto a 'sched_mask', each instance manages its own set of queues\nand transmits on a private instance of a configurable LINK.\n\nA PIPE is a simplified version of the above, where there\nis no flow_mask, and each scheduler instance handles a single queue.\n\nThe following data structures (visible from userland) describe\nthe objects used by dummynet:\n\n + dn_link, contains the main configuration parameters related\n   to delay and bandwidth;\n + dn_profile describes a delay profile;\n + dn_flow describes the flow status (flow id, statistics)\n   \n + dn_sch describes a scheduler\n + dn_fs describes a flowset (msk, weight, queue parameters)\n\n *\n */\n\n#endif /* _IP_DUMMYNET_H */\n"
  },
  {
    "path": "freebsd-headers/netinet/ip_ecn.h",
    "content": "/*\t$FreeBSD: release/9.0.0/sys/netinet/ip_ecn.h 139823 2005-01-07 01:45:51Z imp $\t*/\n/*\t$KAME: ip_ecn.h,v 1.8 2002/01/07 11:34:47 kjc Exp $\t*/\n\n/*-\n * Copyright (C) 1999 WIDE Project.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. Neither the name of the project nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n */\n/*\n * ECN consideration on tunnel ingress/egress operation.\n * http://www.aciri.org/floyd/papers/draft-ipsec-ecn-00.txt\n */\n\n#ifndef _NETINET_IP_ECN_H_\n#define _NETINET_IP_ECN_H_\n\n#if defined(_KERNEL) && !defined(_LKM)\n#include \"opt_inet.h\"\n#endif\n\n#define ECN_ALLOWED\t1\t/* ECN allowed */\n#define ECN_FORBIDDEN\t0\t/* ECN forbidden */\n#define ECN_NOCARE\t(-1)\t/* no consideration to ECN */\n\n#ifdef _KERNEL\nextern void ip_ecn_ingress(int, u_int8_t *, const u_int8_t *);\nextern int ip_ecn_egress(int, const u_int8_t *, u_int8_t *);\n#endif\n#endif\n"
  },
  {
    "path": "freebsd-headers/netinet/ip_encap.h",
    "content": "/*\t$FreeBSD: release/9.0.0/sys/netinet/ip_encap.h 139823 2005-01-07 01:45:51Z imp $\t*/\n/*\t$KAME: ip_encap.h,v 1.7 2000/03/25 07:23:37 sumikawa Exp $\t*/\n\n/*-\n * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. Neither the name of the project nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n */\n\n#ifndef _NETINET_IP_ENCAP_H_\n#define _NETINET_IP_ENCAP_H_\n\n#ifdef _KERNEL\n\nstruct encaptab {\n\tLIST_ENTRY(encaptab) chain;\n\tint af;\n\tint proto;\t\t\t/* -1: don't care, I'll check myself */\n\tstruct sockaddr_storage src;\t/* my addr */\n\tstruct sockaddr_storage srcmask;\n\tstruct sockaddr_storage dst;\t/* remote addr */\n\tstruct sockaddr_storage dstmask;\n\tint (*func)(const struct mbuf *, int, int, void *);\n\tconst struct protosw *psw;\t/* only pr_input will be used */\n\tvoid *arg;\t\t\t/* passed via m->m_pkthdr.aux */\n};\n\nvoid\tencap_init(void);\nvoid\tencap4_input(struct mbuf *, int);\nint\tencap6_input(struct mbuf **, int *, int);\nconst struct encaptab *encap_attach(int, int, const struct sockaddr *,\n\tconst struct sockaddr *, const struct sockaddr *,\n\tconst struct sockaddr *, const struct protosw *, void *);\nconst struct encaptab *encap_attach_func(int, int,\n\tint (*)(const struct mbuf *, int, int, void *),\n\tconst struct protosw *, void *);\nint\tencap_detach(const struct encaptab *);\nvoid\t*encap_getarg(struct mbuf *);\n#endif\n\n#endif /*_NETINET_IP_ENCAP_H_*/\n"
  },
  {
    "path": "freebsd-headers/netinet/ip_fil.h",
    "content": "/*\n * Copyright (C) 1993-2001, 2003 by Darren Reed.\n *\n * See the IPFILTER.LICENCE file for details on licencing.\n *\n * @(#)ip_fil.h\t1.35 6/5/96\n * $FreeBSD: release/9.0.0/sys/contrib/ipfilter/netinet/ip_fil.h 180778 2008-07-24 12:35:05Z darrenr $\n * Id: ip_fil.h,v 2.170.2.51 2007/10/10 09:48:03 darrenr Exp $\n */\n\n#ifndef\t__IP_FIL_H__\n#define\t__IP_FIL_H__\n\n#include \"netinet/ip_compat.h\"\n\n#ifndef\tSOLARIS\n# define SOLARIS (defined(sun) && (defined(__svr4__) || defined(__SVR4)))\n#endif\n\n#ifndef\t__P\n# ifdef\t__STDC__\n#  define\t__P(x)\tx\n# else\n#  define\t__P(x)\t()\n# endif\n#endif\n\n#if defined(__STDC__) || defined(__GNUC__) || defined(_AIX51)\n# define\tSIOCADAFR\t_IOW('r', 60, struct ipfobj)\n# define\tSIOCRMAFR\t_IOW('r', 61, struct ipfobj)\n# define\tSIOCSETFF\t_IOW('r', 62, u_int)\n# define\tSIOCGETFF\t_IOR('r', 63, u_int)\n# define\tSIOCGETFS\t_IOWR('r', 64, struct ipfobj)\n# define\tSIOCIPFFL\t_IOWR('r', 65, int)\n# define\tSIOCIPFFB\t_IOR('r', 66, int)\n# define\tSIOCADIFR\t_IOW('r', 67, struct ipfobj)\n# define\tSIOCRMIFR\t_IOW('r', 68, struct ipfobj)\n# define\tSIOCSWAPA\t_IOR('r', 69, u_int)\n# define\tSIOCINAFR\t_IOW('r', 70, struct ipfobj)\n# define\tSIOCINIFR\t_IOW('r', 71, struct ipfobj)\n# define\tSIOCFRENB\t_IOW('r', 72, u_int)\n# define\tSIOCFRSYN\t_IOW('r', 73, u_int)\n# define\tSIOCFRZST\t_IOWR('r', 74, struct ipfobj)\n# define\tSIOCZRLST\t_IOWR('r', 75, struct ipfobj)\n# define\tSIOCAUTHW\t_IOWR('r', 76, struct ipfobj)\n# define\tSIOCAUTHR\t_IOWR('r', 77, struct ipfobj)\n# define\tSIOCSTAT1\t_IOWR('r', 78, struct ipfobj)\n# define\tSIOCSTLCK\t_IOWR('r', 79, u_int)\n# define\tSIOCSTPUT\t_IOWR('r', 80, struct ipfobj)\n# define\tSIOCSTGET\t_IOWR('r', 81, struct ipfobj)\n# define\tSIOCSTGSZ\t_IOWR('r', 82, struct ipfobj)\n# define\tSIOCSTAT2\t_IOWR('r', 83, struct ipfobj)\n# define\tSIOCSETLG\t_IOWR('r', 84, int)\n# define\tSIOCGETLG\t_IOWR('r', 85, int)\n# define\tSIOCFUNCL\t_IOWR('r', 86, struct ipfunc_resolve)\n# define\tSIOCIPFGETNEXT\t_IOWR('r', 87, struct ipfobj)\n# define\tSIOCIPFGET\t_IOWR('r', 88, struct ipfobj)\n# define\tSIOCIPFSET\t_IOWR('r', 89, struct ipfobj)\n# define\tSIOCIPFL6\t_IOWR('r', 90, int)\n# define\tSIOCIPFITER\t_IOWR('r', 91, struct ipfobj)\n# define\tSIOCGENITER\t_IOWR('r', 92, struct ipfobj)\n# define\tSIOCGTABL\t_IOWR('r', 93, struct ipfobj)\n# define\tSIOCIPFDELTOK\t_IOWR('r', 94, int)\n# define\tSIOCLOOKUPITER\t_IOWR('r', 95, struct ipfobj)\n# define\tSIOCGTQTAB\t_IOWR('r', 96, struct ipfobj)\n#else\n# define\tSIOCADAFR\t_IOW(r, 60, struct ipfobj)\n# define\tSIOCRMAFR\t_IOW(r, 61, struct ipfobj)\n# define\tSIOCSETFF\t_IOW(r, 62, u_int)\n# define\tSIOCGETFF\t_IOR(r, 63, u_int)\n# define\tSIOCGETFS\t_IOWR(r, 64, struct ipfobj)\n# define\tSIOCIPFFL\t_IOWR(r, 65, int)\n# define\tSIOCIPFFB\t_IOR(r, 66, int)\n# define\tSIOCADIFR\t_IOW(r, 67, struct ipfobj)\n# define\tSIOCRMIFR\t_IOW(r, 68, struct ipfobj)\n# define\tSIOCSWAPA\t_IOR(r, 69, u_int)\n# define\tSIOCINAFR\t_IOW(r, 70, struct ipfobj)\n# define\tSIOCINIFR\t_IOW(r, 71, struct ipfobj)\n# define\tSIOCFRENB\t_IOW(r, 72, u_int)\n# define\tSIOCFRSYN\t_IOW(r, 73, u_int)\n# define\tSIOCFRZST\t_IOWR(r, 74, struct ipfobj)\n# define\tSIOCZRLST\t_IOWR(r, 75, struct ipfobj)\n# define\tSIOCAUTHW\t_IOWR(r, 76, struct ipfobj)\n# define\tSIOCAUTHR\t_IOWR(r, 77, struct ipfobj)\n# define\tSIOCSTAT1\t_IOWR(r, 78, struct ipfobj)\n# define\tSIOCSTLCK\t_IOWR(r, 79, u_int)\n# define\tSIOCSTPUT\t_IOWR(r, 80, struct ipfobj)\n# define\tSIOCSTGET\t_IOWR(r, 81, struct ipfobj)\n# define\tSIOCSTGSZ\t_IOWR(r, 82, struct ipfobj)\n# define\tSIOCSTAT2\t_IOWR(r, 83, struct ipfobj)\n# define\tSIOCSETLG\t_IOWR(r, 84, int)\n# define\tSIOCGETLG\t_IOWR(r, 85, int)\n# define\tSIOCFUNCL\t_IOWR(r, 86, struct ipfunc_resolve)\n# define\tSIOCIPFGETNEXT\t_IOWR(r, 87, struct ipfobj)\n# define\tSIOCIPFGET\t_IOWR(r, 88, struct ipfobj)\n# define\tSIOCIPFSET\t_IOWR(r, 89, struct ipfobj)\n# define\tSIOCIPFL6\t_IOWR(r, 90, int)\n# define\tSIOCIPFITER\t_IOWR(r, 91, struct ipfobj)\n# define\tSIOCGENITER\t_IOWR(r, 92, struct ipfobj)\n# define\tSIOCGTABL\t_IOWR(r, 93, struct ipfobj)\n# define\tSIOCIPFDELTOK\t_IOWR(r, 94, int)\n# define\tSIOCLOOKUPITER\t_IOWR(r, 95, struct ipfobj)\n# define\tSIOCGTQTAB\t_IOWR(r, 96, struct ipfobj)\n#endif\n#define\tSIOCADDFR\tSIOCADAFR\n#define\tSIOCDELFR\tSIOCRMAFR\n#define\tSIOCINSFR\tSIOCINAFR\n#define\tSIOCATHST\tSIOCSTAT1\n#define\tSIOCGFRST\tSIOCSTAT2\n\n\nstruct ipscan;\nstruct ifnet;\n\n\ntypedef\tint\t(* lookupfunc_t) __P((void *, int, void *));\n\n/*\n * i6addr is used as a container for both IPv4 and IPv6 addresses, as well\n * as other types of objects, depending on its qualifier.\n */\n#ifdef\tUSE_INET6\ntypedef\tunion\ti6addr\t{\n\tu_32_t\ti6[4];\n\tstruct\tin_addr\tin4;\n\tstruct\tin6_addr in6;\n\tvoid\t*vptr[2];\n\tlookupfunc_t\tlptr[2];\n\tstruct {\n\t\tu_short\ttype;\n\t\tu_short\tsubtype;\n\t\tchar\tlabel[12];\n\t} i6un;\n} i6addr_t;\n#else\ntypedef\tunion\ti6addr\t{\n\tu_32_t\ti6[4];\n\tstruct\tin_addr\tin4;\n\tvoid\t*vptr[2];\n\tlookupfunc_t\tlptr[2];\n\tstruct {\n\t\tu_short\ttype;\n\t\tu_short\tsubtype;\n\t\tchar\tlabel[12];\n\t} i6un;\n} i6addr_t;\n#endif\n\n#define in4_addr\tin4.s_addr\n#define\tiplookupnum\ti6[1]\n#define\tiplookupname\ti6un.label\n#define\tiplookuptype\ti6un.type\n#define\tiplookupsubtype\ti6un.subtype\n/*\n * NOTE: These DO overlap the above on 64bit systems and this IS recognised.\n */\n#define\tiplookupptr\tvptr[0]\n#define\tiplookupfunc\tlptr[1]\n\n#define\tI60(x)\t(((u_32_t *)(x))[0])\n#define\tI61(x)\t(((u_32_t *)(x))[1])\n#define\tI62(x)\t(((u_32_t *)(x))[2])\n#define\tI63(x)\t(((u_32_t *)(x))[3])\n#define\tHI60(x)\tntohl(((u_32_t *)(x))[0])\n#define\tHI61(x)\tntohl(((u_32_t *)(x))[1])\n#define\tHI62(x)\tntohl(((u_32_t *)(x))[2])\n#define\tHI63(x)\tntohl(((u_32_t *)(x))[3])\n\n#define\tIP6_EQ(a,b)\t((I63(a) == I63(b)) && (I62(a) == I62(b)) && \\\n\t\t\t (I61(a) == I61(b)) && (I60(a) == I60(b)))\n#define\tIP6_NEQ(a,b)\t((I63(a) != I63(b)) || (I62(a) != I62(b)) || \\\n\t\t\t (I61(a) != I61(b)) || (I60(a) != I60(b)))\n#define IP6_ISZERO(a)   ((I60(a) | I61(a) | I62(a) | I63(a)) == 0)\n#define IP6_NOTZERO(a)  ((I60(a) | I61(a) | I62(a) | I63(a)) != 0)\n#define\tIP6_GT(a,b)\t(HI60(a) > HI60(b) || (HI60(a) == HI60(b) && \\\n\t\t\t  (HI61(a) > HI61(b) || (HI61(a) == HI61(b) && \\\n\t\t\t    (HI62(a) > HI62(b) || (HI62(a) == HI62(b) && \\\n\t\t\t      HI63(a) > HI63(b)))))))\n#define\tIP6_LT(a,b)\t(HI60(a) < HI60(b) || (HI60(a) == HI60(b) && \\\n\t\t\t  (HI61(a) < HI61(b) || (HI61(a) == HI61(b) && \\\n\t\t\t    (HI62(a) < HI62(b) || (HI62(a) == HI62(b) && \\\n\t\t\t      HI63(a) < HI63(b)))))))\n#define\tNLADD(n,x)\thtonl(ntohl(n) + (x))\n#define\tIP6_INC(a)\t\\\n\t\t{ u_32_t *_i6 = (u_32_t *)(a); \\\n\t\t  _i6[3] = NLADD(_i6[3], 1); \\\n\t\t  if (_i6[3] == 0) { \\\n\t\t\t_i6[2] = NLADD(_i6[2], 1); \\\n\t\t\tif (_i6[2] == 0) { \\\n\t\t\t\t_i6[1] = NLADD(_i6[1], 1); \\\n\t\t\t\tif (_i6[1] == 0) { \\\n\t\t\t\t\t_i6[0] = NLADD(_i6[0], 1); \\\n\t\t\t\t} \\\n\t\t\t} \\\n\t\t  } \\\n\t\t}\n#define\tIP6_ADD(a,x,d)\t\\\n\t\t{ i6addr_t *_s = (i6addr_t *)(a); \\\n\t\t  i6addr_t *_d = (i6addr_t *)(d); \\\n\t\t  _d->i6[0] = NLADD(_s->i6[0], x); \\\n\t\t  if (ntohl(_d->i6[0]) < ntohl(_s->i6[0])) { \\\n\t\t\t_d->i6[1] = NLADD(_d->i6[1], 1); \\\n\t\t\tif (ntohl(_d->i6[1]) < ntohl(_s->i6[1])) { \\\n\t\t\t\t_d->i6[2] = NLADD(_d->i6[2], 1); \\\n\t\t\t\tif (ntohl(_d->i6[2]) < ntohl(_s->i6[2])) { \\\n\t\t\t\t\t_d->i6[3] = NLADD(_d->i6[3], 1); \\\n\t\t\t\t} \\\n\t\t\t} \\\n\t\t  } \\\n\t\t}\n#define\tIP6_AND(a,b,d)\t{ i6addr_t *_s1 = (i6addr_t *)(a); \\\n\t\t\t  i6addr_t *_s2 = (i6addr_t *)(d); \\\n\t\t\t  i6addr_t *_d = (i6addr_t *)(d); \\\n\t\t\t  _d->i6[0] = _s1->i6[0] & _s2->i6[0]; \\\n\t\t\t  _d->i6[1] = _s1->i6[1] & _s2->i6[1]; \\\n\t\t\t  _d->i6[2] = _s1->i6[2] & _s2->i6[2]; \\\n\t\t\t  _d->i6[3] = _s1->i6[3] & _s2->i6[3]; \\\n\t\t\t}\n#define\tIP6_MERGE(a,b,c) \\\n\t\t\t{ i6addr_t *_d, *_s1, *_s2; \\\n\t\t\t  _d = (i6addr_t *)(a); \\\n\t\t\t  _s1 = (i6addr_t *)(b); \\\n\t\t\t  _s2 = (i6addr_t *)(c); \\\n\t\t\t  _d->i6[0] |= _s1->i6[0] & ~_s2->i6[0]; \\\n\t\t\t  _d->i6[1] |= _s1->i6[1] & ~_s2->i6[1]; \\\n\t\t\t  _d->i6[2] |= _s1->i6[2] & ~_s2->i6[2]; \\\n\t\t\t  _d->i6[2] |= _s1->i6[3] & ~_s2->i6[3]; \\\n\t\t\t}\n\n\ntypedef\tstruct\tfr_ip\t{\n\tu_32_t\tfi_v:4;\t\t/* IP version */\n\tu_32_t\tfi_xx:4;\t/* spare */\n\tu_32_t\tfi_tos:8;\t/* IP packet TOS */\n\tu_32_t\tfi_ttl:8;\t/* IP packet TTL */\n\tu_32_t\tfi_p:8;\t\t/* IP packet protocol */\n\tu_32_t\tfi_optmsk;\t/* bitmask composed from IP options */\n\ti6addr_t fi_src;\t/* source address from packet */\n\ti6addr_t fi_dst;\t/* destination address from packet */\n\tu_short\tfi_secmsk;\t/* bitmask composed from IP security options */\n\tu_short\tfi_auth;\t/* authentication code from IP sec. options */\n\tu_32_t\tfi_flx;\t\t/* packet flags */\n\tu_32_t\tfi_tcpmsk;\t/* TCP options set/reset */\n\tu_32_t\tfi_res1;\t/* RESERVED */\n} fr_ip_t;\n\n/*\n * For use in fi_flx\n */\n#define\tFI_TCPUDP\t0x0001\t/* TCP/UCP implied comparison*/\n#define\tFI_OPTIONS\t0x0002\n#define\tFI_FRAG\t\t0x0004\n#define\tFI_SHORT\t0x0008\n#define\tFI_NATED\t0x0010\n#define\tFI_MULTICAST\t0x0020\n#define\tFI_BROADCAST\t0x0040\n#define\tFI_MBCAST\t0x0080\n#define\tFI_STATE\t0x0100\n#define\tFI_BADNAT\t0x0200\n#define\tFI_BAD\t\t0x0400\n#define\tFI_OOW\t\t0x0800\t/* Out of state window, else match */\n#define\tFI_ICMPERR\t0x1000\n#define\tFI_FRAGBODY\t0x2000\n#define\tFI_BADSRC\t0x4000\n#define\tFI_LOWTTL\t0x8000\n#define\tFI_CMP\t\t0xcf03\t/* Not FI_FRAG,FI_NATED,FI_FRAGTAIL,broadcast */\n#define\tFI_ICMPCMP\t0x0003\t/* Flags we can check for ICMP error packets */\n#define\tFI_WITH\t\t0xeffe\t/* Not FI_TCPUDP */\n#define\tFI_V6EXTHDR\t0x10000\n#define\tFI_COALESCE\t0x20000\n#define\tFI_NEWNAT\t0x40000\n#define\tFI_NOCKSUM\t0x20000000\t/* don't do a L4 checksum validation */\n#define\tFI_DONTCACHE\t0x40000000\t/* don't cache the result */\n#define\tFI_IGNORE\t0x80000000\n\n#define\tfi_saddr\tfi_src.in4.s_addr\n#define\tfi_daddr\tfi_dst.in4.s_addr\n#define\tfi_srcnum\tfi_src.iplookupnum\n#define\tfi_dstnum\tfi_dst.iplookupnum\n#define\tfi_srcname\tfi_src.iplookupname\n#define\tfi_dstname\tfi_dst.iplookupname\n#define\tfi_srctype\tfi_src.iplookuptype\n#define\tfi_dsttype\tfi_dst.iplookuptype\n#define\tfi_srcsubtype\tfi_src.iplookupsubtype\n#define\tfi_dstsubtype\tfi_dst.iplookupsubtype\n#define\tfi_srcptr\tfi_src.iplookupptr\n#define\tfi_dstptr\tfi_dst.iplookupptr\n#define\tfi_srcfunc\tfi_src.iplookupfunc\n#define\tfi_dstfunc\tfi_dst.iplookupfunc\n\n\n/*\n * These are both used by the state and NAT code to indicate that one port or\n * the other should be treated as a wildcard.\n * NOTE: When updating, check bit masks in ip_state.h and update there too.\n */\n#define\tSI_W_SPORT\t0x00000100\n#define\tSI_W_DPORT\t0x00000200\n#define\tSI_WILDP\t(SI_W_SPORT|SI_W_DPORT)\n#define\tSI_W_SADDR\t0x00000400\n#define\tSI_W_DADDR\t0x00000800\n#define\tSI_WILDA\t(SI_W_SADDR|SI_W_DADDR)\n#define\tSI_NEWFR\t0x00001000\n#define\tSI_CLONE\t0x00002000\n#define\tSI_CLONED\t0x00004000\n\n\ntypedef\tstruct\tfr_info\t{\n\tvoid\t*fin_ifp;\t\t/* interface packet is `on' */\n\tfr_ip_t\tfin_fi;\t\t/* IP Packet summary */\n\tunion\t{\n\t\tu_short\tfid_16[2];\t/* TCP/UDP ports, ICMP code/type */\n\t\tu_32_t\tfid_32;\n\t} fin_dat;\n\tint\tfin_out;\t\t/* in or out ? 1 == out, 0 == in */\n\tint\tfin_rev;\t\t/* state only: 1 = reverse */\n\tu_short\tfin_hlen;\t\t/* length of IP header in bytes */\n\tu_char\tfin_tcpf;\t\t/* TCP header flags (SYN, ACK, etc) */\n\tu_char\tfin_icode;\t\t/* ICMP error to return */\n\tu_32_t\tfin_rule;\t\t/* rule # last matched */\n\tchar\tfin_group[FR_GROUPLEN];\t/* group number, -1 for none */\n\tstruct\tfrentry *fin_fr;\t/* last matching rule */\n\tvoid\t*fin_dp;\t\t/* start of data past IP header */\n\tint\tfin_dlen;\t\t/* length of data portion of packet */\n\tint\tfin_plen;\n\tint\tfin_ipoff;\t\t/* # bytes from buffer start to hdr */\n\tu_short\tfin_id;\t\t\t/* IP packet id field */\n\tu_short\tfin_off;\n\tint\tfin_depth;\t\t/* Group nesting depth */\n\tint\tfin_error;\t\t/* Error code to return */\n\tint\tfin_cksum;\t\t/* -1 bad, 1 good, 0 not done */\n\tvoid\t*fin_nat;\n\tvoid\t*fin_state;\n\tvoid\t*fin_nattag;\n\tvoid\t*fin_exthdr;\n\tip_t\t*fin_ip;\n\tmb_t\t**fin_mp;\t\t/* pointer to pointer to mbuf */\n\tmb_t\t*fin_m;\t\t\t/* pointer to mbuf */\n#ifdef\tMENTAT\n\tmb_t\t*fin_qfm;\t\t/* pointer to mblk where pkt starts */\n\tvoid\t*fin_qpi;\n\tchar\tfin_ifname[LIFNAMSIZ];\n#endif\n#ifdef\t__sgi\n\tvoid\t*fin_hbuf;\n#endif\n} fr_info_t;\n\n#define\tfin_v\t\tfin_fi.fi_v\n#define\tfin_p\t\tfin_fi.fi_p\n#define\tfin_flx\t\tfin_fi.fi_flx\n#define\tfin_optmsk\tfin_fi.fi_optmsk\n#define\tfin_secmsk\tfin_fi.fi_secmsk\n#define\tfin_auth\tfin_fi.fi_auth\n#define\tfin_src\t\tfin_fi.fi_src.in4\n#define\tfin_src6\tfin_fi.fi_src.in6\n#define\tfin_saddr\tfin_fi.fi_saddr\n#define\tfin_dst\t\tfin_fi.fi_dst.in4\n#define\tfin_dst6\tfin_fi.fi_dst.in6\n#define\tfin_daddr\tfin_fi.fi_daddr\n#define\tfin_data\tfin_dat.fid_16\n#define\tfin_sport\tfin_dat.fid_16[0]\n#define\tfin_dport\tfin_dat.fid_16[1]\n#define\tfin_ports\tfin_dat.fid_32\n\n#define\tIPF_IN\t\t0\n#define\tIPF_OUT\t\t1\n\ntypedef\tstruct frentry\t*(*ipfunc_t) __P((fr_info_t *, u_32_t *));\ntypedef\tint\t\t(*ipfuncinit_t) __P((struct frentry *));\n\ntypedef\tstruct\tipfunc_resolve\t{\n\tchar\t\tipfu_name[32];\n\tipfunc_t\tipfu_addr;\n\tipfuncinit_t\tipfu_init;\n} ipfunc_resolve_t;\n\n/*\n * Size for compares on fr_info structures\n */\n#define\tFI_CSIZE\toffsetof(fr_info_t, fin_icode)\n#define\tFI_LCSIZE\toffsetof(fr_info_t, fin_dp)\n\n/*\n * Size for copying cache fr_info structure\n */\n#define\tFI_COPYSIZE\toffsetof(fr_info_t, fin_dp)\n\n/*\n * Structure for holding IPFilter's tag information\n */\n#define\tIPFTAG_LEN\t16\ntypedef\tstruct\t{\n\tunion\t{\n\t\tu_32_t\tiptu_num[4];\n\t\tchar\tiptu_tag[IPFTAG_LEN];\n\t} ipt_un;\n\tint\tipt_not;\n} ipftag_t;\n\n#define\tipt_tag\tipt_un.iptu_tag\n#define\tipt_num\tipt_un.iptu_num\n\n\n/*\n * This structure is used to hold information about the next hop for where\n * to forward a packet.\n */\ntypedef\tstruct\tfrdest\t{\n\tvoid\t*fd_ifp;\n\ti6addr_t\tfd_ip6;\n\tchar\tfd_ifname[LIFNAMSIZ];\n} frdest_t;\n\n#define\tfd_ip\tfd_ip6.in4\n\n\n/*\n * This structure holds information about a port comparison.\n */\ntypedef\tstruct\tfrpcmp\t{\n\tint\tfrp_cmp;\t/* data for port comparisons */\n\tu_short\tfrp_port;\t/* top port for <> and >< */\n\tu_short\tfrp_top;\t/* top port for <> and >< */\n} frpcmp_t;\n\n#define FR_NONE 0\n#define FR_EQUAL 1\n#define FR_NEQUAL 2\n#define FR_LESST 3\n#define FR_GREATERT 4\n#define FR_LESSTE 5\n#define FR_GREATERTE 6\n#define FR_OUTRANGE 7\n#define FR_INRANGE 8\n#define FR_INCRANGE 9\n\n/*\n * Structure containing all the relevant TCP things that can be checked in\n * a filter rule.\n */\ntypedef\tstruct\tfrtuc\t{\n\tu_char\t\tftu_tcpfm;\t/* tcp flags mask */\n\tu_char\t\tftu_tcpf;\t/* tcp flags */\n\tfrpcmp_t\tftu_src;\n\tfrpcmp_t\tftu_dst;\n} frtuc_t;\n\n#define\tftu_scmp\tftu_src.frp_cmp\n#define\tftu_dcmp\tftu_dst.frp_cmp\n#define\tftu_sport\tftu_src.frp_port\n#define\tftu_dport\tftu_dst.frp_port\n#define\tftu_stop\tftu_src.frp_top\n#define\tftu_dtop\tftu_dst.frp_top\n\n#define\tFR_TCPFMAX\t0x3f\n\n/*\n * This structure makes up what is considered to be the IPFilter specific\n * matching components of a filter rule, as opposed to the data structures\n * used to define the result which are in frentry_t and not here.\n */\ntypedef\tstruct\tfripf\t{\n\tfr_ip_t\tfri_ip;\n\tfr_ip_t\tfri_mip;\t/* mask structure */\n\n\tu_short\tfri_icmpm;\t\t/* data for ICMP packets (mask) */\n\tu_short\tfri_icmp;\n\n\tfrtuc_t\tfri_tuc;\n\tint\tfri_satype;\t\t/* addres type */\n\tint\tfri_datype;\t\t/* addres type */\n\tint\tfri_sifpidx;\t\t/* doing dynamic addressing */\n\tint\tfri_difpidx;\t\t/* index into fr_ifps[] to use when */\n} fripf_t;\n\n#define\tfri_dlookup\tfri_mip.fi_dst\n#define\tfri_slookup\tfri_mip.fi_src\n#define\tfri_dstnum\tfri_mip.fi_dstnum\n#define\tfri_srcnum\tfri_mip.fi_srcnum\n#define\tfri_dstname\tfri_mip.fi_dstname\n#define\tfri_srcname\tfri_mip.fi_srcname\n#define\tfri_dstptr\tfri_mip.fi_dstptr\n#define\tfri_srcptr\tfri_mip.fi_srcptr\n\n#define\tFRI_NORMAL\t0\t/* Normal address */\n#define\tFRI_DYNAMIC\t1\t/* dynamic address */\n#define\tFRI_LOOKUP\t2\t/* address is a pool # */\n#define\tFRI_RANGE\t3\t/* address/mask is a range */\n#define\tFRI_NETWORK\t4\t/* network address from if */\n#define\tFRI_BROADCAST\t5\t/* broadcast address from if */\n#define\tFRI_PEERADDR\t6\t/* Peer address for P-to-P */\n#define\tFRI_NETMASKED\t7\t/* network address with netmask from if */\n\n\ntypedef\tstruct\tfrentry\t* (* frentfunc_t) __P((fr_info_t *));\n\ntypedef\tstruct\tfrentry {\n\tipfmutex_t\tfr_lock;\n\tstruct\tfrentry\t*fr_next;\n\tstruct\tfrentry\t**fr_grp;\n\tstruct\tipscan\t*fr_isc;\n\tvoid\t*fr_ifas[4];\n\tvoid\t*fr_ptr;\t/* for use with fr_arg */\n\tchar\t*fr_comment;\t/* text comment for rule */\n\tint\tfr_ref;\t\t/* reference count - for grouping */\n\tint\tfr_statecnt;\t/* state count - for limit rules */\n\t/*\n\t * The line number from a file is here because we need to be able to\n\t * match the rule generated with ``grep rule ipf.conf | ipf -rf -''\n\t * with the rule loaded using ``ipf -f ipf.conf'' - thus it can't be\n\t * on the other side of fr_func.\n\t */\n\tint\tfr_flineno;\t/* line number from conf file */\n\t/*\n\t * These are only incremented when a packet  matches this rule and\n\t * it is the last match\n\t */\n\tU_QUAD_T\tfr_hits;\n\tU_QUAD_T\tfr_bytes;\n\n\t/*\n\t * For PPS rate limiting\n\t */\n\tstruct timeval\tfr_lastpkt;\n\tint\t\tfr_curpps;\n\n\tunion\t{\n\t\tvoid\t\t*fru_data;\n\t\tcaddr_t\t\tfru_caddr;\n\t\tfripf_t\t\t*fru_ipf;\n\t\tfrentfunc_t\tfru_func;\n\t} fr_dun;\n\n\t/*\n\t * Fields after this may not change whilst in the kernel.\n\t */\n\tipfunc_t fr_func; \t/* call this function */\n\tint\tfr_dsize;\n\tint\tfr_pps;\n\tint\tfr_statemax;\t/* max reference count */\n\tu_32_t\tfr_type;\n\tu_32_t\tfr_flags;\t/* per-rule flags && options (see below) */\n\tu_32_t\tfr_logtag;\t/* user defined log tag # */\n\tu_32_t\tfr_collect;\t/* collection number */\n\tu_int\tfr_arg;\t\t/* misc. numeric arg for rule */ \n\tu_int\tfr_loglevel;\t/* syslog log facility + priority */\n\tu_int\tfr_age[2];\t/* non-TCP timeouts */\n\tu_char\tfr_v;\n\tu_char\tfr_icode;\t/* return ICMP code */\n\tchar\tfr_group[FR_GROUPLEN];\t/* group to which this rule belongs */\n\tchar\tfr_grhead[FR_GROUPLEN];\t/* group # which this rule starts */\n\tipftag_t fr_nattag;\n\tchar\tfr_ifnames[4][LIFNAMSIZ];\n\tchar\tfr_isctag[16];\n\tfrdest_t fr_tifs[2];\t/* \"to\"/\"reply-to\" interface */\n\tfrdest_t fr_dif;\t/* duplicate packet interface */\n\t/*\n\t * This must be last and will change after loaded into the kernel.\n\t */\n\tu_int\tfr_cksum;\t/* checksum on filter rules for performance */\n} frentry_t;\n\n#define\tfr_caddr\tfr_dun.fru_caddr\n#define\tfr_data\t\tfr_dun.fru_data\n#define\tfr_dfunc\tfr_dun.fru_func\n#define\tfr_ipf\t\tfr_dun.fru_ipf\n#define\tfr_ip\t\tfr_ipf->fri_ip\n#define\tfr_mip\t\tfr_ipf->fri_mip\n#define\tfr_icmpm\tfr_ipf->fri_icmpm\n#define\tfr_icmp\t\tfr_ipf->fri_icmp\n#define\tfr_tuc\t\tfr_ipf->fri_tuc\n#define\tfr_satype\tfr_ipf->fri_satype\n#define\tfr_datype\tfr_ipf->fri_datype\n#define\tfr_sifpidx\tfr_ipf->fri_sifpidx\n#define\tfr_difpidx\tfr_ipf->fri_difpidx\n#define\tfr_proto\tfr_ip.fi_p\n#define\tfr_mproto\tfr_mip.fi_p\n#define\tfr_ttl\t\tfr_ip.fi_ttl\n#define\tfr_mttl\t\tfr_mip.fi_ttl\n#define\tfr_tos\t\tfr_ip.fi_tos\n#define\tfr_mtos\t\tfr_mip.fi_tos\n#define\tfr_tcpfm\tfr_tuc.ftu_tcpfm\n#define\tfr_tcpf\t\tfr_tuc.ftu_tcpf\n#define\tfr_scmp\t\tfr_tuc.ftu_scmp\n#define\tfr_dcmp\t\tfr_tuc.ftu_dcmp\n#define\tfr_dport\tfr_tuc.ftu_dport\n#define\tfr_sport\tfr_tuc.ftu_sport\n#define\tfr_stop\t\tfr_tuc.ftu_stop\n#define\tfr_dtop\t\tfr_tuc.ftu_dtop\n#define\tfr_dst\t\tfr_ip.fi_dst.in4\n#define\tfr_daddr\tfr_ip.fi_dst.in4.s_addr\n#define\tfr_src\t\tfr_ip.fi_src.in4\n#define\tfr_saddr\tfr_ip.fi_src.in4.s_addr\n#define\tfr_dmsk\t\tfr_mip.fi_dst.in4\n#define\tfr_dmask\tfr_mip.fi_dst.in4.s_addr\n#define\tfr_smsk\t\tfr_mip.fi_src.in4\n#define\tfr_smask\tfr_mip.fi_src.in4.s_addr\n#define\tfr_dstnum\tfr_ip.fi_dstnum\n#define\tfr_srcnum\tfr_ip.fi_srcnum\n#define\tfr_dlookup\tfr_ip.fi_dst\n#define\tfr_slookup\tfr_ip.fi_src\n#define\tfr_dstname\tfr_ip.fi_dstname\n#define\tfr_srcname\tfr_ip.fi_srcname\n#define\tfr_dsttype\tfr_ip.fi_dsttype\n#define\tfr_srctype\tfr_ip.fi_srctype\n#define\tfr_dstsubtype\tfr_ip.fi_dstsubtype\n#define\tfr_srcsubtype\tfr_ip.fi_srcsubtype\n#define\tfr_dstptr\tfr_mip.fi_dstptr\n#define\tfr_srcptr\tfr_mip.fi_srcptr\n#define\tfr_dstfunc\tfr_mip.fi_dstfunc\n#define\tfr_srcfunc\tfr_mip.fi_srcfunc\n#define\tfr_optbits\tfr_ip.fi_optmsk\n#define\tfr_optmask\tfr_mip.fi_optmsk\n#define\tfr_secbits\tfr_ip.fi_secmsk\n#define\tfr_secmask\tfr_mip.fi_secmsk\n#define\tfr_authbits\tfr_ip.fi_auth\n#define\tfr_authmask\tfr_mip.fi_auth\n#define\tfr_flx\t\tfr_ip.fi_flx\n#define\tfr_mflx\t\tfr_mip.fi_flx\n#define\tfr_ifname\tfr_ifnames[0]\n#define\tfr_oifname\tfr_ifnames[2]\n#define\tfr_ifa\t\tfr_ifas[0]\n#define\tfr_oifa\t\tfr_ifas[2]\n#define\tfr_tif\t\tfr_tifs[0]\n#define\tfr_rif\t\tfr_tifs[1]\n\n#define\tFR_NOLOGTAG\t0\n\n#ifndef\toffsetof\n#define\toffsetof(t,m)\t(int)((&((t *)0L)->m))\n#endif\n#define\tFR_CMPSIZ\t(sizeof(struct frentry) - \\\n\t\t\t offsetof(struct frentry, fr_func))\n\n/*\n * fr_type\n */\n#define\tFR_T_NONE\t0\n#define\tFR_T_IPF\t1\t/* IPF structures */\n#define\tFR_T_BPFOPC\t2\t/* BPF opcode */\n#define\tFR_T_CALLFUNC\t3\t/* callout to function in fr_func only */\n#define\tFR_T_COMPIPF\t4\t/* compiled C code */\n#define\tFR_T_BUILTIN\t0x80000000\t/* rule is in kernel space */\n\n/*\n * fr_flags\n */\n#define\tFR_CALL\t\t0x00000\t/* call rule */\n#define\tFR_BLOCK\t0x00001\t/* do not allow packet to pass */\n#define\tFR_PASS\t\t0x00002\t/* allow packet to pass */\n#define\tFR_AUTH\t\t0x00003\t/* use authentication */\n#define\tFR_PREAUTH\t0x00004\t/* require preauthentication */\n#define\tFR_ACCOUNT\t0x00005\t/* Accounting rule */\n#define\tFR_SKIP\t\t0x00006\t/* skip rule */\n#define\tFR_DIVERT\t0x00007\t/* divert rule */\n#define\tFR_CMDMASK\t0x0000f\n#define\tFR_LOG\t\t0x00010\t/* Log */\n#define\tFR_LOGB\t\t0x00011\t/* Log-fail */\n#define\tFR_LOGP\t\t0x00012\t/* Log-pass */\n#define\tFR_LOGMASK\t(FR_LOG|FR_CMDMASK)\n#define\tFR_CALLNOW\t0x00020\t/* call another function (fr_func) if matches */\n#define\tFR_NOTSRCIP\t0x00040\n#define\tFR_NOTDSTIP\t0x00080\n#define\tFR_QUICK\t0x00100\t/* match & stop processing list */\n#define\tFR_KEEPFRAG\t0x00200\t/* keep fragment information */\n#define\tFR_KEEPSTATE\t0x00400\t/* keep `connection' state information */\n#define\tFR_FASTROUTE\t0x00800\t/* bypass normal routing */\n#define\tFR_RETRST\t0x01000\t/* Return TCP RST packet - reset connection */\n#define\tFR_RETICMP\t0x02000\t/* Return ICMP unreachable packet */\n#define\tFR_FAKEICMP\t0x03000\t/* Return ICMP unreachable with fake source */\n#define\tFR_OUTQUE\t0x04000\t/* outgoing packets */\n#define\tFR_INQUE\t0x08000\t/* ingoing packets */\n#define\tFR_LOGBODY\t0x10000\t/* Log the body */\n#define\tFR_LOGFIRST\t0x20000\t/* Log the first byte if state held */\n#define\tFR_LOGORBLOCK\t0x40000\t/* block the packet if it can't be logged */\n#define\tFR_DUP\t\t0x80000\t/* duplicate packet */\n#define\tFR_FRSTRICT\t0x100000\t/* strict frag. cache */\n#define\tFR_STSTRICT\t0x200000\t/* strict keep state */\n#define\tFR_NEWISN\t0x400000\t/* new ISN for outgoing TCP */\n#define\tFR_NOICMPERR\t0x800000\t/* do not match ICMP errors in state */\n#define\tFR_STATESYNC\t0x1000000\t/* synchronize state to slave */\n#define\tFR_NOMATCH\t0x8000000\t/* no match occured */\n\t\t/*\t0x10000000 \tFF_LOGPASS */\n\t\t/*\t0x20000000 \tFF_LOGBLOCK */\n\t\t/*\t0x40000000 \tFF_LOGNOMATCH */\n\t\t/*\t0x80000000 \tFF_BLOCKNONIP */\n#define\tFR_COPIED\t0x40000000\t/* copied from user space */\n#define\tFR_INACTIVE\t0x80000000\t/* only used when flush'ing rules */\n\n#define\tFR_RETMASK\t(FR_RETICMP|FR_RETRST|FR_FAKEICMP)\n#define\tFR_ISBLOCK(x)\t(((x) & FR_CMDMASK) == FR_BLOCK)\n#define\tFR_ISPASS(x)\t(((x) & FR_CMDMASK) == FR_PASS)\n#define\tFR_ISAUTH(x)\t(((x) & FR_CMDMASK) == FR_AUTH)\n#define\tFR_ISPREAUTH(x)\t(((x) & FR_CMDMASK) == FR_PREAUTH)\n#define\tFR_ISACCOUNT(x)\t(((x) & FR_CMDMASK) == FR_ACCOUNT)\n#define\tFR_ISSKIP(x)\t(((x) & FR_CMDMASK) == FR_SKIP)\n#define\tFR_ISNOMATCH(x)\t((x) & FR_NOMATCH)\n#define\tFR_INOUT\t(FR_INQUE|FR_OUTQUE)\n\n/*\n * recognized flags for SIOCGETFF and SIOCSETFF, and get put in fr_flags\n */\n#define\tFF_LOGPASS\t0x10000000\n#define\tFF_LOGBLOCK\t0x20000000\n#define\tFF_LOGNOMATCH\t0x40000000\n#define\tFF_LOGGING\t(FF_LOGPASS|FF_LOGBLOCK|FF_LOGNOMATCH)\n#define\tFF_BLOCKNONIP\t0x80000000\t/* Solaris2 Only */\n\n\n/*\n * Structure that passes information on what/how to flush to the kernel.\n */\ntypedef\tstruct\tipfflush\t{\n\tint\tipflu_how;\n\tint\tipflu_arg;\n} ipfflush_t;\n\n\n/*\n *\n */\ntypedef\tstruct\tipfgetctl\t{\n\tu_int\tipfg_min;\t/* min value */\n\tu_int\tipfg_current;\t/* current value */\n\tu_int\tipfg_max;\t/* max value */\n\tu_int\tipfg_default;\t/* default value */\n\tu_int\tipfg_steps;\t/* value increments */\n\tchar\tipfg_name[40];\t/* tag name for this control */\n} ipfgetctl_t;\n\ntypedef\tstruct\tipfsetctl\t{\n\tint\tipfs_which;\t/* 0 = min 1 = current 2 = max 3 = default */\n\tu_int\tipfs_value;\t/* min value */\n\tchar\tipfs_name[40];\t/* tag name for this control */\n} ipfsetctl_t;\n\n\n/*\n * Some of the statistics below are in their own counters, but most are kept\n * in this single structure so that they can all easily be collected and\n * copied back as required.\n */\ntypedef\tstruct\tfilterstats {\n\tu_long\tfr_pass;\t/* packets allowed */\n\tu_long\tfr_block;\t/* packets denied */\n\tu_long\tfr_nom;\t\t/* packets which don't match any rule */\n\tu_long\tfr_short;\t/* packets which are short */\n\tu_long\tfr_ppkl;\t/* packets allowed and logged */\n\tu_long\tfr_bpkl;\t/* packets denied and logged */\n\tu_long\tfr_npkl;\t/* packets unmatched and logged */\n\tu_long\tfr_pkl;\t\t/* packets logged */\n\tu_long\tfr_skip;\t/* packets to be logged but buffer full */\n\tu_long\tfr_ret;\t\t/* packets for which a return is sent */\n\tu_long\tfr_acct;\t/* packets for which counting was performed */\n\tu_long\tfr_bnfr;\t/* bad attempts to allocate fragment state */\n\tu_long\tfr_nfr;\t\t/* new fragment state kept */\n\tu_long\tfr_cfr;\t\t/* add new fragment state but complete pkt */\n\tu_long\tfr_bads;\t/* bad attempts to allocate packet state */\n\tu_long\tfr_ads;\t\t/* new packet state kept */\n\tu_long\tfr_chit;\t/* cached hit */\n\tu_long\tfr_tcpbad;\t/* TCP checksum check failures */\n\tu_long\tfr_pull[2];\t/* good and bad pullup attempts */\n\tu_long\tfr_badsrc;\t/* source received doesn't match route */\n\tu_long\tfr_badttl;\t/* TTL in packet doesn't reach minimum */\n\tu_long\tfr_bad;\t\t/* bad IP packets to the filter */\n\tu_long\tfr_ipv6;\t/* IPv6 packets in/out */\n\tu_long\tfr_ppshit;\t/* dropped because of pps ceiling */\n\tu_long\tfr_ipud;\t/* IP id update failures */\n} filterstats_t;\n\n/*\n * Log structure.  Each packet header logged is prepended by one of these.\n * Following this in the log records read from the device will be an ipflog\n * structure which is then followed by any packet data.\n */\ntypedef\tstruct\tiplog\t{\n\tu_32_t\t\tipl_magic;\n\tu_int\t\tipl_count;\n\tstruct\ttimeval\tipl_time;\n\tsize_t\t\tipl_dsize;\n\tstruct\tiplog\t*ipl_next;\n} iplog_t;\n\n#define\tipl_sec\t\tipl_time.tv_sec\n#define\tipl_usec\tipl_time.tv_usec\n\n#define IPL_MAGIC\t0x49504c4d\t/* 'IPLM' */\n#define IPL_MAGIC_NAT\t0x49504c4e\t/* 'IPLN' */\n#define IPL_MAGIC_STATE\t0x49504c53\t/* 'IPLS' */\n#define\tIPLOG_SIZE\tsizeof(iplog_t)\n\ntypedef\tstruct\tipflog\t{\n#if (defined(NetBSD) && (NetBSD <= 1991011) && (NetBSD >= 199603)) || \\\n        (defined(OpenBSD) && (OpenBSD >= 199603))\n#else\n\tu_int\tfl_unit;\n#endif\n\tu_32_t\tfl_rule;\n\tu_32_t\tfl_flags;\n\tu_32_t\tfl_lflags;\n\tu_32_t\tfl_logtag;\n\tipftag_t\tfl_nattag;\n\tu_short\tfl_plen;\t/* extra data after hlen */\n\tu_short\tfl_loglevel;\t/* syslog log level */\n\tchar\tfl_group[FR_GROUPLEN];\n\tu_char\tfl_hlen;\t/* length of IP headers saved */\n\tu_char\tfl_dir;\n\tu_char\tfl_xxx[2];\t/* pad */\n\tchar\tfl_ifname[LIFNAMSIZ];\n} ipflog_t;\n\n#ifndef\tIPF_LOGGING\n# define\tIPF_LOGGING\t0\n#endif\n#ifndef\tIPF_DEFAULT_PASS\n# define\tIPF_DEFAULT_PASS\tFR_PASS\n#endif\n\n#define\tDEFAULT_IPFLOGSIZE\t8192\n#ifndef\tIPFILTER_LOGSIZE\n# define\tIPFILTER_LOGSIZE\tDEFAULT_IPFLOGSIZE\n#else\n# if IPFILTER_LOGSIZE < DEFAULT_IPFLOGSIZE\n#  error IPFILTER_LOGSIZE too small.  Must be >= DEFAULT_IPFLOGSIZE\n# endif\n#endif\n\n#define\tIPF_OPTCOPY\t0x07ff00\t/* bit mask of copied options */\n\n/*\n * Device filenames for reading log information.  Use ipf on Solaris2 because\n * ipl is already a name used by something else.\n */\n#ifndef\tIPL_NAME\n# if\tSOLARIS\n#  define\tIPL_NAME\t\"/dev/ipf\"\n# else\n#  define\tIPL_NAME\t\"/dev/ipl\"\n# endif\n#endif\n/*\n * Pathnames for various IP Filter control devices.  Used by LKM\n * and userland, so defined here.\n */\n#define\tIPNAT_NAME\t\"/dev/ipnat\"\n#define\tIPSTATE_NAME\t\"/dev/ipstate\"\n#define\tIPAUTH_NAME\t\"/dev/ipauth\"\n#define\tIPSYNC_NAME\t\"/dev/ipsync\"\n#define\tIPSCAN_NAME\t\"/dev/ipscan\"\n#define\tIPLOOKUP_NAME\t\"/dev/iplookup\"\n\n#define\tIPL_LOGIPF\t0\t/* Minor device #'s for accessing logs */\n#define\tIPL_LOGNAT\t1\n#define\tIPL_LOGSTATE\t2\n#define\tIPL_LOGAUTH\t3\n#define\tIPL_LOGSYNC\t4\n#define\tIPL_LOGSCAN\t5\n#define\tIPL_LOGLOOKUP\t6\n#define\tIPL_LOGCOUNT\t7\n#define\tIPL_LOGMAX\t7\n#define\tIPL_LOGSIZE\tIPL_LOGMAX + 1\n#define\tIPL_LOGALL\t-1\n#define\tIPL_LOGNONE\t-2\n\n/*\n * For SIOCGETFS\n */\ntypedef\tstruct\tfriostat\t{\n\tstruct\tfilterstats\tf_st[2];\n\tstruct\tfrentry\t\t*f_ipf[2][2];\n\tstruct\tfrentry\t\t*f_acct[2][2];\n\tstruct\tfrentry\t\t*f_ipf6[2][2];\n\tstruct\tfrentry\t\t*f_acct6[2][2];\n\tstruct\tfrentry\t\t*f_auth;\n\tstruct\tfrgroup\t\t*f_groups[IPL_LOGSIZE][2];\n\tu_long\tf_froute[2];\n\tu_long\tf_ticks;\n\tint\tf_locks[IPL_LOGMAX];\n\tsize_t\tf_kmutex_sz;\n\tsize_t\tf_krwlock_sz;\n\tint\tf_defpass;\t/* default pass - from fr_pass */\n\tint\tf_active;\t/* 1 or 0 - active rule set */\n\tint\tf_running;\t/* 1 if running, else 0 */\n\tint\tf_logging;\t/* 1 if enabled, else 0 */\n\tint\tf_features;\n\tchar\tf_version[32];\t/* version string */\n} friostat_t;\n\n#define\tf_fin\t\tf_ipf[0]\n#define\tf_fin6\t\tf_ipf6[0]\n#define\tf_fout\t\tf_ipf[1]\n#define\tf_fout6\t\tf_ipf6[1]\n#define\tf_acctin\tf_acct[0]\n#define\tf_acctin6\tf_acct6[0]\n#define\tf_acctout\tf_acct[1]\n#define\tf_acctout6\tf_acct6[1]\n\n#define\tIPF_FEAT_LKM\t\t0x001\n#define\tIPF_FEAT_LOG\t\t0x002\n#define\tIPF_FEAT_LOOKUP\t\t0x004\n#define\tIPF_FEAT_BPF\t\t0x008\n#define\tIPF_FEAT_COMPILED\t0x010\n#define\tIPF_FEAT_CKSUM\t\t0x020\n#define\tIPF_FEAT_SYNC\t\t0x040\n#define\tIPF_FEAT_SCAN\t\t0x080\n#define\tIPF_FEAT_IPV6\t\t0x100\n\ntypedef struct\toptlist {\n\tu_short ol_val;\n\tint\tol_bit;\n} optlist_t;\n\n\n/*\n * Group list structure.\n */\ntypedef\tstruct frgroup {\n\tstruct\tfrgroup\t*fg_next;\n\tstruct\tfrentry\t*fg_head;\n\tstruct\tfrentry\t*fg_start;\n\tu_32_t\tfg_flags;\n\tint\tfg_ref;\n\tchar\tfg_name[FR_GROUPLEN];\n} frgroup_t;\n\n#define\tFG_NAME(g)\t(*(g)->fg_name == '\\0' ? \"\" : (g)->fg_name)\n\n\n/*\n * Used by state and NAT tables\n */\ntypedef struct icmpinfo {\n\tu_short\tici_id;\n\tu_short\tici_seq;\n\tu_char\tici_type;\n} icmpinfo_t;\n\ntypedef struct udpinfo {\n\tu_short\tus_sport;\n\tu_short\tus_dport;\n} udpinfo_t;\n\n\ntypedef\tstruct\ttcpdata\t{\n\tu_32_t\ttd_end;\n\tu_32_t\ttd_maxend;\n\tu_32_t\ttd_maxwin;\n\tu_32_t\ttd_winscale;\n\tu_32_t\ttd_maxseg;\n\tint\ttd_winflags;\n} tcpdata_t;\n\n#define\tTCP_WSCALE_MAX\t\t14\n\n#define\tTCP_WSCALE_SEEN\t\t0x00000001\n#define\tTCP_WSCALE_FIRST\t0x00000002\n#define\tTCP_SACK_PERMIT\t\t0x00000004\n\n\ntypedef\tstruct tcpinfo {\n\tu_short\tts_sport;\n\tu_short\tts_dport;\n\ttcpdata_t ts_data[2];\n} tcpinfo_t;\n\n\n/*\n * Structures to define a GRE header as seen in a packet.\n */\nstruct\tgrebits\t{\n\tu_32_t\tgrb_C:1;\n\tu_32_t\tgrb_R:1;\n\tu_32_t\tgrb_K:1;\n\tu_32_t\tgrb_S:1;\n\tu_32_t\tgrb_s:1;\n\tu_32_t\tgrb_recur:1;\n\tu_32_t\tgrb_A:1;\n\tu_32_t\tgrb_flags:3;\n\tu_32_t\tgrb_ver:3;\n\tu_short\tgrb_ptype;\n};\n\ntypedef\tstruct\tgrehdr\t{\n\tunion\t{\n\t\tstruct\tgrebits\tgru_bits;\n\t\tu_short\tgru_flags;\n\t} gr_un;\n\tu_short\tgr_len;\n\tu_short\tgr_call;\n} grehdr_t;\n\n#define\tgr_flags\tgr_un.gru_flags\n#define\tgr_bits\t\tgr_un.gru_bits\n#define\tgr_ptype\tgr_bits.grb_ptype\n#define\tgr_C\t\tgr_bits.grb_C\n#define\tgr_R\t\tgr_bits.grb_R\n#define\tgr_K\t\tgr_bits.grb_K\n#define\tgr_S\t\tgr_bits.grb_S\n#define\tgr_s\t\tgr_bits.grb_s\n#define\tgr_recur\tgr_bits.grb_recur\n#define\tgr_A\t\tgr_bits.grb_A\n#define\tgr_ver\t\tgr_bits.grb_ver\n\n/*\n * GRE information tracked by \"keep state\"\n */\ntypedef\tstruct\tgreinfo\t{\n\tu_short\tgs_call[2];\n\tu_short\tgs_flags;\n\tu_short\tgs_ptype;\n} greinfo_t;\n\n#define\tGRE_REV(x)\t((ntohs(x) >> 13) & 7)\n\n\n/*\n * Format of an Authentication header\n */\ntypedef\tstruct\tauthhdr\t{\n\tu_char\tah_next;\n\tu_char\tah_plen;\n\tu_short\tah_reserved;\n\tu_32_t\tah_spi;\n\tu_32_t\tah_seq;\n\t/* Following the sequence number field is 0 or more bytes of */\n\t/* authentication data, as specified by ah_plen - RFC 2402.  */\n} authhdr_t;\n\n\n/*\n * Timeout tail queue list member\n */\ntypedef\tstruct\tipftqent\t{\n\tstruct ipftqent **tqe_pnext;\n\tstruct ipftqent *tqe_next;\n\tstruct\tipftq\t*tqe_ifq;\n\tvoid\t*tqe_parent;\t\t/* pointer back to NAT/state struct */\n\tu_long\ttqe_die;\t\t/* when this entriy is to die */\n\tu_long\ttqe_touched;\n\tint\ttqe_flags;\n\tint\ttqe_state[2];\t\t/* current state of this entry */\n} ipftqent_t;\n\n#define\tTQE_RULEBASED\t0x00000001\n\n\n/*\n * Timeout tail queue head for IPFilter\n */\ntypedef struct  ipftq   {\n\tipfmutex_t\tifq_lock;\n\tu_int\tifq_ttl;\n\tipftqent_t\t*ifq_head;\n\tipftqent_t\t**ifq_tail;\n\tstruct\tipftq\t*ifq_next;\n\tstruct\tipftq\t**ifq_pnext;\n\tint\tifq_ref;\n\tu_int\tifq_flags;\n} ipftq_t;\n\n#define\tIFQF_USER\t0x01\t\t/* User defined aging */\n#define\tIFQF_DELETE\t0x02\t\t/* Marked for deletion */\n#define\tIFQF_PROXY\t0x04\t\t/* Timeout queue in use by a proxy */\n\n#define\tIPF_HZ_MULT\t1\n#define\tIPF_HZ_DIVIDE\t2\t\t/* How many times a second ipfilter */\n\t\t\t\t\t/* checks its timeout queues.       */\n#define\tIPF_TTLVAL(x)\t(((x) / IPF_HZ_MULT) * IPF_HZ_DIVIDE)\n\ntypedef\tint\t(*ipftq_delete_fn_t)(void *);       \n\n/*\n * Structure to define address for pool lookups.\n */\ntypedef\tstruct\t{\n\tu_char\t\tadf_len;\n\ti6addr_t\tadf_addr;\n} addrfamily_t;\n\n\n/*\n * Object structure description.  For passing through in ioctls.\n */\ntypedef\tstruct\tipfobj\t{\n\tu_32_t\tipfo_rev;\t\t/* IPFilter version number */\n\tu_32_t\tipfo_size;\t\t/* size of object at ipfo_ptr */\n\tvoid\t*ipfo_ptr;\t\t/* pointer to object */\n\tint\tipfo_type;\t\t/* type of object being pointed to */\n\tint\tipfo_offset;\t\t/* bytes from ipfo_ptr where to start */\n\tu_char\tipfo_xxxpad[32];\t/* reserved for future use */\n} ipfobj_t;\n\n#define\tIPFOBJ_FRENTRY\t\t0\t/* struct frentry */\n#define\tIPFOBJ_IPFSTAT\t\t1\t/* struct friostat */\n#define\tIPFOBJ_IPFINFO\t\t2\t/* struct fr_info */\n#define\tIPFOBJ_AUTHSTAT\t\t3\t/* struct fr_authstat */\n#define\tIPFOBJ_FRAGSTAT\t\t4\t/* struct ipfrstat */\n#define\tIPFOBJ_IPNAT\t\t5\t/* struct ipnat */\n#define\tIPFOBJ_NATSTAT\t\t6\t/* struct natstat */\n#define\tIPFOBJ_STATESAVE\t7\t/* struct ipstate_save */\n#define\tIPFOBJ_NATSAVE\t\t8\t/* struct nat_save */\n#define\tIPFOBJ_NATLOOKUP\t9\t/* struct natlookup */\n#define\tIPFOBJ_IPSTATE\t\t10\t/* struct ipstate */\n#define\tIPFOBJ_STATESTAT\t11\t/* struct ips_stat */\n#define\tIPFOBJ_FRAUTH\t\t12\t/* struct frauth */\n#define\tIPFOBJ_TUNEABLE\t\t13\t/* struct ipftune */\n#define\tIPFOBJ_NAT\t\t14\t/* struct nat */\n#define\tIPFOBJ_IPFITER\t\t15\t/* struct ipfruleiter */\n#define\tIPFOBJ_GENITER\t\t16\t/* struct ipfgeniter */\n#define\tIPFOBJ_GTABLE\t\t17\t/* struct ipftable */\n#define\tIPFOBJ_LOOKUPITER\t18\t/* struct ipflookupiter */\n#define\tIPFOBJ_STATETQTAB\t19\t/* struct ipftq [NSTATES] */\n#define\tIPFOBJ_COUNT\t\t20\t/* How many #defines are above this? */\n\n\ntypedef\tunion\tipftunevalptr\t{\n\tvoid\t*ipftp_void;\n\tu_long\t*ipftp_long;\n\tu_int\t*ipftp_int;\n\tu_short\t*ipftp_short;\n\tu_char\t*ipftp_char;\n} ipftunevalptr_t;\n\ntypedef\tstruct\tipftuneable\t{\n\tipftunevalptr_t\tipft_una;\n\tconst char\t*ipft_name;\n\tu_long\t\tipft_min;\n\tu_long\t\tipft_max;\n\tint\t\tipft_sz;\n\tint\t\tipft_flags;\n\tstruct ipftuneable *ipft_next;\n} ipftuneable_t;\n\n#define\tipft_addr\tipft_una.ipftp_void\n#define\tipft_plong\tipft_una.ipftp_long\n#define\tipft_pint\tipft_una.ipftp_int\n#define\tipft_pshort\tipft_una.ipftp_short\n#define\tipft_pchar\tipft_una.ipftp_char\n\n#define\tIPFT_RDONLY\t1\t/* read-only */\n#define\tIPFT_WRDISABLED\t2\t/* write when disabled only */\n\ntypedef\tunion\tipftuneval\t{\n\tu_long\tipftu_long;\n\tu_int\tipftu_int;\n\tu_short\tipftu_short;\n\tu_char\tipftu_char;\n} ipftuneval_t;\n\ntypedef\tstruct\tipftune\t{\n\tvoid    \t*ipft_cookie;\n\tipftuneval_t\tipft_un;\n\tu_long  \tipft_min;\n\tu_long  \tipft_max;\n\tint\t\tipft_sz;\n\tint\t\tipft_flags;\n\tchar\t\tipft_name[80];\n} ipftune_t;\n\n#define\tipft_vlong\tipft_un.ipftu_long\n#define\tipft_vint\tipft_un.ipftu_int\n#define\tipft_vshort\tipft_un.ipftu_short\n#define\tipft_vchar\tipft_un.ipftu_char\n\n/*\n *\n */\ntypedef\tstruct\tipfruleiter {\n\tint\t\tiri_inout;\n\tchar\t\tiri_group[FR_GROUPLEN];\n\tint\t\tiri_active;\n\tint\t\tiri_nrules;\n\tint\t\tiri_v;\n\tfrentry_t\t*iri_rule;\n} ipfruleiter_t;\n\n/*\n * Values for iri_inout\n */\n#define\tF_IN\t0\n#define\tF_OUT\t1\n#define\tF_ACIN\t2\n#define\tF_ACOUT\t3\n\n\ntypedef\tstruct\tipfgeniter {\n\tint\tigi_type;\n\tint\tigi_nitems;\n\tvoid\t*igi_data;\n} ipfgeniter_t;\n\n#define\tIPFGENITER_IPF\t\t0\n#define\tIPFGENITER_NAT\t\t1\n#define\tIPFGENITER_IPNAT\t2\n#define\tIPFGENITER_FRAG\t\t3\n#define\tIPFGENITER_AUTH\t\t4\n#define\tIPFGENITER_STATE\t5\n#define\tIPFGENITER_NATFRAG\t6\n#define\tIPFGENITER_HOSTMAP\t7\n#define\tIPFGENITER_LOOKUP\t8\n\ntypedef\tstruct\tipftable {\n\tint\tita_type;\n\tvoid\t*ita_table;\n} ipftable_t;\n\n#define\tIPFTABLE_BUCKETS\t1\n#define\tIPFTABLE_BUCKETS_NATIN\t2\n#define\tIPFTABLE_BUCKETS_NATOUT\t3\n\n\n/*\n *\n */\ntypedef struct ipftoken {\n\tstruct ipftoken\t*ipt_next;\n\tstruct ipftoken\t**ipt_pnext;\n\tvoid\t\t*ipt_ctx;\n\tvoid\t\t*ipt_data;\n\tu_long\t\tipt_die;\n\tint\t\tipt_type;\n\tint\t\tipt_uid;\n\tint\t\tipt_subtype;\n\tint\t\tipt_alive;\n} ipftoken_t;\n\n\n/*\n** HPUX Port\n*/\n#ifdef __hpux\n/* HP-UX locking sequence deadlock detection module lock MAJOR ID */\n# define\tIPF_SMAJ\t0\t/* temp assignment XXX, not critical */\n#endif\n\n#if !defined(CDEV_MAJOR) && defined (__FreeBSD_version) && \\\n    (__FreeBSD_version >= 220000)\n# define\tCDEV_MAJOR\t79\n#endif\n\n/*\n * Post NetBSD 1.2 has the PFIL interface for packet filters.  This turns\n * on those hooks.  We don't need any special mods in non-IP Filter code\n * with this!\n */\n#if (defined(NetBSD) && (NetBSD > 199609) && (NetBSD <= 1991011)) || \\\n    (defined(NetBSD1_2) && NetBSD1_2 > 1) || \\\n    (defined(__FreeBSD__) && (__FreeBSD_version >= 500043))\n# if defined(NetBSD) && (NetBSD >= 199905)\n#  define PFIL_HOOKS\n# endif\n# ifdef PFIL_HOOKS\n#  define NETBSD_PF\n# endif\n#endif\n\n#ifdef _KERNEL\n# define\tFR_VERBOSE(verb_pr)\n# define\tFR_DEBUG(verb_pr)\n#else\nextern\tvoid\tdebug __P((char *, ...));\nextern\tvoid\tverbose __P((char *, ...));\n# define\tFR_VERBOSE(verb_pr)\tverbose verb_pr\n# define\tFR_DEBUG(verb_pr)\tdebug verb_pr\n#endif\n\n\n#ifndef\t_KERNEL\nextern\tint\tfr_check __P((struct ip *, int, void *, int, mb_t **));\nextern\tint\t(*fr_checkp) __P((ip_t *, int, void *, int, mb_t **));\nextern\tint\tipf_log __P((void));\nextern\tstruct\tifnet *get_unit __P((char *, int));\nextern\tchar\t*get_ifname __P((struct ifnet *));\n# if defined(__NetBSD__) || defined(__OpenBSD__) || \\\n\t  (_BSDI_VERSION >= 199701) || (__FreeBSD_version >= 300000)\nextern\tint\tiplioctl __P((int, ioctlcmd_t, caddr_t, int));\n# else\nextern\tint\tiplioctl __P((int, ioctlcmd_t, caddr_t, int));\n# endif\nextern\tint\tiplopen __P((dev_t, int));\nextern\tint\tiplclose __P((dev_t, int));\nextern\tvoid\tm_freem __P((mb_t *));\nextern\tint\tbcopywrap __P((void *, void *, size_t));\n#else /* #ifndef _KERNEL */\n# ifdef BSD\n#  if (defined(__NetBSD__) && (__NetBSD_Version__ < 399000000)) || \\\n      defined(__osf__) || \\\n      (defined(__FreeBSD_version) && (__FreeBSD_version < 500043))\n#   include <sys/select.h>\n#  else\n#   include <sys/selinfo.h>\n#  endif\nextern struct selinfo ipfselwait[IPL_LOGSIZE];\n# endif\n# if defined(__NetBSD__) && defined(PFIL_HOOKS)\nextern\tvoid\tipfilterattach __P((int));\n# endif\nextern\tint\tipl_enable __P((void));\nextern\tint\tipl_disable __P((void));\nextern\tint\tipf_inject __P((fr_info_t *, mb_t *));\n# ifdef MENTAT\nextern\tint\tfr_check __P((struct ip *, int, void *, int, void *,\n\t\t\t      mblk_t **));\n#  if SOLARIS\n#   if SOLARIS2 >= 7\nextern\tint\tiplioctl __P((dev_t, int, intptr_t, int, cred_t *, int *));\n#   else\nextern\tint\tiplioctl __P((dev_t, int, int *, int, cred_t *, int *));\n#   endif\nextern\tint\tiplopen __P((dev_t *, int, int, cred_t *));\nextern\tint\tiplclose __P((dev_t, int, int, cred_t *));\nextern\tint\tiplread __P((dev_t, uio_t *, cred_t *));\nextern\tint\tiplwrite __P((dev_t, uio_t *, cred_t *));\n#  endif\n#  ifdef __hpux\nextern\tint\tiplopen __P((dev_t, int, intptr_t, int));\nextern\tint\tiplclose __P((dev_t, int, int));\nextern\tint\tiplioctl __P((dev_t, int, caddr_t, int));\nextern\tint\tiplread __P((dev_t, uio_t *));\nextern\tint\tiplwrite __P((dev_t, uio_t *));\nextern\tint\tiplselect __P((dev_t, int));\n#  endif\nextern\tint\tfr_qout __P((queue_t *, mblk_t *));\n# else /* MENTAT */\nextern\tint\tfr_check __P((struct ip *, int, void *, int, mb_t **));\nextern\tint\t(*fr_checkp) __P((ip_t *, int, void *, int, mb_t **));\nextern\tsize_t\tmbufchainlen __P((mb_t *));\n#  ifdef\t__sgi\n#   include <sys/cred.h>\nextern\tint\tiplioctl __P((dev_t, int, caddr_t, int, cred_t *, int *));\nextern\tint\tiplopen __P((dev_t *, int, int, cred_t *));\nextern\tint\tiplclose __P((dev_t, int, int, cred_t *));\nextern\tint\tiplread __P((dev_t, uio_t *, cred_t *));\nextern\tint\tiplwrite __P((dev_t, uio_t *, cred_t *));\nextern\tint\tipfilter_sgi_attach __P((void));\nextern\tvoid\tipfilter_sgi_detach __P((void));\nextern\tvoid\tipfilter_sgi_intfsync __P((void));\n#  else\n#   ifdef\tIPFILTER_LKM\nextern\tint\tiplidentify __P((char *));\n#   endif\n#   if (defined(_BSDI_VERSION) && _BSDI_VERSION >= 199510) || \\\n      (__FreeBSD_version >= 220000) || \\\n      (NetBSD >= 199511) || defined(__OpenBSD__)\n#    if defined(__NetBSD__) || \\\n       (defined(_BSDI_VERSION) && _BSDI_VERSION >= 199701) || \\\n       defined(__OpenBSD__) || (__FreeBSD_version >= 300000)\n#     if (__FreeBSD_version >= 500024)\n#      if (__FreeBSD_version >= 502116)\nextern\tint\tiplioctl __P((struct cdev*, u_long, caddr_t, int, struct thread *));\n#      else\nextern\tint\tiplioctl __P((dev_t, u_long, caddr_t, int, struct thread *));\n#      endif /* __FreeBSD_version >= 502116 */\n#     else\n#      if  (__NetBSD_Version__ >= 499001000)\nextern\tint\tiplioctl __P((dev_t, u_long, void *, int, struct lwp *));\n#       else\n#       if  (__NetBSD_Version__ >= 399001400)\nextern\tint\tiplioctl __P((dev_t, u_long, caddr_t, int, struct lwp *));\n#       else\nextern\tint\tiplioctl __P((dev_t, u_long, caddr_t, int, struct proc *));\n#       endif\n#      endif\n#     endif /* __FreeBSD_version >= 500024 */\n#    else\nextern\tint\tiplioctl __P((dev_t, int, caddr_t, int, struct thread *));\n#    endif\n#    if (__FreeBSD_version >= 500024)\n#      if (__FreeBSD_version >= 502116)\nextern\tint\tiplopen __P((struct cdev*, int, int, struct thread *));\nextern\tint\tiplclose __P((struct cdev*, int, int, struct thread *));\n#      else\nextern\tint\tiplopen __P((dev_t, int, int, struct thread *));\nextern\tint\tiplclose __P((dev_t, int, int, struct thread *));\n#      endif /* __FreeBSD_version >= 502116 */\n#    else\n#     if  (__NetBSD_Version__ >= 399001400)\nextern\tint\tiplopen __P((dev_t, int, int, struct lwp *));\nextern\tint\tiplclose __P((dev_t, int, int, struct lwp *));\n#     else\nextern\tint\tiplopen __P((dev_t, int, int, struct proc *));\nextern\tint\tiplclose __P((dev_t, int, int, struct proc *));\n#     endif /* __NetBSD_Version__ >= 399001400 */\n#    endif /* __FreeBSD_version >= 500024 */\n#   else\n#    ifdef linux\nextern\tint\tiplioctl __P((struct inode *, struct file *, u_int, u_long));\n#    else\nextern\tint\tiplopen __P((dev_t, int));\nextern\tint\tiplclose __P((dev_t, int));\nextern\tint\tiplioctl __P((dev_t, int, caddr_t, int));\n#    endif\n#   endif /* (_BSDI_VERSION >= 199510) */\n#   if\tBSD >= 199306\n#      if (__FreeBSD_version >= 502116)\nextern\tint\tiplread __P((struct cdev*, struct uio *, int));\nextern\tint\tiplwrite __P((struct cdev*, struct uio *, int));\n#      else\nextern\tint\tiplread __P((dev_t, struct uio *, int));\nextern\tint\tiplwrite __P((dev_t, struct uio *, int));\n#      endif /* __FreeBSD_version >= 502116 */\n#   else\n#    ifndef linux\nextern\tint\tiplread __P((dev_t, struct uio *));\nextern\tint\tiplwrite __P((dev_t, struct uio *));\n#    endif\n#   endif /* BSD >= 199306 */\n#  endif /* __ sgi */\n# endif /* MENTAT */\n\n# if defined(__FreeBSD_version)\nextern\tint\tipf_pfil_hook __P((void));\nextern\tint\tipf_pfil_unhook __P((void));\nextern\tvoid\tipf_event_reg __P((void));\nextern\tvoid\tipf_event_dereg __P((void));\n# endif\n\n#endif /* #ifndef _KERNEL */\n\nextern\tipfmutex_t\tipl_mutex, ipf_authmx, ipf_rw, ipf_hostmap;\nextern\tipfmutex_t\tipf_timeoutlock, ipf_stinsert, ipf_natio, ipf_nat_new;\nextern\tipfrwlock_t\tipf_mutex, ipf_global, ip_poolrw, ipf_ipidfrag;\nextern\tipfrwlock_t\tipf_frag, ipf_state, ipf_nat, ipf_natfrag, ipf_auth;\nextern\tipfrwlock_t\tipf_frcache, ipf_tokens;\n\nextern\tchar\t*memstr __P((const char *, char *, size_t, size_t));\nextern\tint\tcount4bits __P((u_32_t));\nextern\tint\tfrrequest __P((int, ioctlcmd_t, caddr_t, int, int));\nextern\tchar\t*getifname __P((struct ifnet *));\nextern\tint\tipfattach __P((void));\nextern\tint\tipfdetach __P((void));\nextern\tu_short\tipf_cksum __P((u_short *, int));\nextern\tint\tcopyinptr __P((void *, void *, size_t));\nextern\tint\tcopyoutptr __P((void *, void *, size_t));\nextern\tint\tfr_fastroute __P((mb_t *, mb_t **, fr_info_t *, frdest_t *));\nextern\tint\tfr_inobj __P((void *, void *, int));\nextern\tint\tfr_inobjsz __P((void *, void *, int, int));\nextern\tint\tfr_ioctlswitch __P((int, void *, ioctlcmd_t, int, int, void *));\nextern\tint\tfr_ipf_ioctl __P((caddr_t, ioctlcmd_t, int, int, void *));\nextern\tint\tfr_ipftune __P((ioctlcmd_t, void *));\nextern\tint\tfr_outobj __P((void *, void *, int));\nextern\tint\tfr_outobjsz __P((void *, void *, int, int));\nextern\tvoid\t*fr_pullup __P((mb_t *, fr_info_t *, int));\nextern\tvoid\tfr_resolvedest __P((struct frdest *, int));\nextern\tint\tfr_resolvefunc __P((void *));\nextern\tvoid\t*fr_resolvenic __P((char *, int));\nextern\tint\tfr_send_icmp_err __P((int, fr_info_t *, int));\nextern\tint\tfr_send_reset __P((fr_info_t *));\n#if  (__FreeBSD_version < 501000) || !defined(_KERNEL)\nextern\tint\tppsratecheck __P((struct timeval *, int *, int));\n#endif\nextern\tipftq_t\t*fr_addtimeoutqueue __P((ipftq_t **, u_int));\nextern\tvoid\tfr_deletequeueentry __P((ipftqent_t *));\nextern\tint\tfr_deletetimeoutqueue __P((ipftq_t *));\nextern\tvoid\tfr_freetimeoutqueue __P((ipftq_t *));\nextern\tvoid\tfr_movequeue __P((ipftqent_t *, ipftq_t *, ipftq_t *));\nextern\tvoid\tfr_queueappend __P((ipftqent_t *, ipftq_t *, void *));\nextern\tvoid\tfr_queueback __P((ipftqent_t *));\nextern\tvoid\tfr_queuefront __P((ipftqent_t *));\nextern\tvoid\tfr_checkv4sum __P((fr_info_t *));\nextern\tint\tfr_checkl4sum __P((fr_info_t *));\nextern\tint\tfr_ifpfillv4addr __P((int, struct sockaddr_in *,\n\t\t\t\t      struct sockaddr_in *, struct in_addr *,\n\t\t\t\t      struct in_addr *));\nextern\tint\tfr_coalesce __P((fr_info_t *));\n#ifdef\tUSE_INET6\nextern\tvoid\tfr_checkv6sum __P((fr_info_t *));\nextern\tint\tfr_ifpfillv6addr __P((int, struct sockaddr_in6 *,\n\t\t\t\t      struct sockaddr_in6 *, struct in_addr *,\n\t\t\t\t      struct in_addr *));\n#endif\n\nextern\tint\t\tfr_addipftune __P((ipftuneable_t *));\nextern\tint\t\tfr_delipftune __P((ipftuneable_t *));\n\nextern\tint\tfrflush __P((minor_t, int, int));\nextern\tvoid\tfrsync __P((void *));\nextern\tfrgroup_t *fr_addgroup __P((char *, void *, u_32_t, minor_t, int));\nextern\tint\tfr_derefrule __P((frentry_t **));\nextern\tvoid\tfr_delgroup __P((char *, minor_t, int));\nextern\tfrgroup_t *fr_findgroup __P((char *, minor_t, int, frgroup_t ***));\n\nextern\tint\tfr_loginit __P((void));\nextern\tint\tipflog_canread __P((int));\nextern\tint\tipflog_clear __P((minor_t));\nextern\tint\tipflog_read __P((minor_t, uio_t *));\nextern\tint\tipflog __P((fr_info_t *, u_int));\nextern\tint\tipllog __P((int, fr_info_t *, void **, size_t *, int *, int));\nextern\tvoid\tfr_logunload __P((void));\n\nextern\tfrentry_t\t*fr_acctpkt __P((fr_info_t *, u_32_t *));\nextern\tint\t\tfr_copytolog __P((int, char *, int));\nextern\tu_short\t\tfr_cksum __P((mb_t *, ip_t *, int, void *, int));\nextern\tvoid\t\tfr_deinitialise __P((void));\nextern\tfrentry_t \t*fr_dolog __P((fr_info_t *, u_32_t *));\nextern\tfrentry_t \t*fr_dstgrpmap __P((fr_info_t *, u_32_t *));\nextern\tvoid\t\tfr_fixskip __P((frentry_t **, frentry_t *, int));\nextern\tvoid\t\tfr_forgetifp __P((void *));\nextern\tfrentry_t \t*fr_getrulen __P((int, char *, u_32_t));\nextern\tvoid\t\tfr_getstat __P((struct friostat *));\nextern\tint\t\tfr_ifpaddr __P((int, int, void *,\n\t\t\t\tstruct in_addr *, struct in_addr *));\nextern\tint\t\tfr_initialise __P((void));\nextern\tint\t\tfr_lock __P((caddr_t, int *));\nextern  int\t\tfr_makefrip __P((int, ip_t *, fr_info_t *));\nextern\tint\t\tfr_matchtag __P((ipftag_t *, ipftag_t *));\nextern\tint\t\tfr_matchicmpqueryreply __P((int, icmpinfo_t *,\n\t\t\t\t\t    struct icmp *, int));\nextern\tu_32_t\t\tfr_newisn __P((fr_info_t *));\nextern\tu_short\t\tfr_nextipid __P((fr_info_t *));\nextern\tint\tipf_queueflush __P((ipftq_delete_fn_t, ipftq_t *, ipftq_t *));\nextern\tint\t\tfr_rulen __P((int, frentry_t *));\nextern\tint\t\tfr_scanlist __P((fr_info_t *, u_32_t));\nextern\tfrentry_t \t*fr_srcgrpmap __P((fr_info_t *, u_32_t *));\nextern\tint\t\tfr_tcpudpchk __P((fr_info_t *, frtuc_t *));\nextern\tint\t\tfr_verifysrc __P((fr_info_t *fin));\nextern\tint\t\tfr_zerostats __P((void *));\nextern\tipftoken_t\t*ipf_findtoken __P((int, int, void *));\nextern\tint\t\tipf_getnextrule __P((ipftoken_t *, void *));\nextern\tvoid\t\tipf_expiretokens __P((void));\nextern\tvoid\t\tipf_freetoken __P((ipftoken_t *));\nextern\tint\t\tipf_deltoken __P((int,int, void *));\nextern\tint\t\tipfsync __P((void));\nextern\tint\t\tipf_genericiter __P((void *, int, void *));\n#ifndef ipf_random\nextern\tu_32_t\t\tipf_random __P((void));\n#endif\n#ifdef NEED_LOCAL_RAND\nextern\tvoid\t\tipf_rand_push __P((void *, int));\n#endif\n\nextern\tint\tfr_running;\nextern\tu_long\tfr_frouteok[2];\nextern\tint\tfr_pass;\nextern\tint\tfr_flags;\nextern\tint\tfr_active;\nextern\tint\tfr_chksrc;\nextern\tint\tfr_minttl;\nextern\tint\tfr_refcnt;\nextern\tint\tfr_control_forwarding;\nextern\tint\tfr_update_ipid;\nextern\tint\tnat_logging;\nextern\tint\tipstate_logging;\nextern\tint\tipl_suppress;\nextern\tint\tipl_logmax;\nextern\tint\tipl_logall;\nextern\tint\tipl_logsize;\nextern\tu_long\tfr_ticks;\nextern\tfr_info_t\tfrcache[2][8];\nextern\tchar\tipfilter_version[];\nextern\tiplog_t\t**iplh[IPL_LOGMAX+1], *iplt[IPL_LOGMAX+1];\nextern\tint\tiplused[IPL_LOGMAX + 1];\nextern\tstruct frentry *ipfilter[2][2], *ipacct[2][2];\n#ifdef\tUSE_INET6\nextern\tstruct frentry *ipfilter6[2][2], *ipacct6[2][2];\nextern\tint\ticmptoicmp6types[ICMP_MAXTYPE+1];\nextern\tint\ticmptoicmp6unreach[ICMP_MAX_UNREACH];\nextern\tint\ticmpreplytype6[ICMP6_MAXTYPE + 1];\n#endif\nextern\tint\ticmpreplytype4[ICMP_MAXTYPE + 1];\nextern\tstruct frgroup *ipfgroups[IPL_LOGSIZE][2];\nextern\tstruct filterstats frstats[];\nextern\tfrentry_t *ipfrule_match __P((fr_info_t *));\nextern\tu_char\tipf_iss_secret[32];\nextern\tipftuneable_t ipf_tuneables[];\n\n#endif\t/* __IP_FIL_H__ */\n"
  },
  {
    "path": "freebsd-headers/netinet/ip_frag.h",
    "content": "/*\t$FreeBSD: release/9.0.0/sys/contrib/ipfilter/netinet/ip_frag.h 170268 2007-06-04 02:54:36Z darrenr $\t*/\n\n/*\n * Copyright (C) 1993-2001 by Darren Reed.\n *\n * See the IPFILTER.LICENCE file for details on licencing.\n *\n * @(#)ip_frag.h\t1.5 3/24/96\n * $FreeBSD: release/9.0.0/sys/contrib/ipfilter/netinet/ip_frag.h 170268 2007-06-04 02:54:36Z darrenr $\n * Id: ip_frag.h,v 2.23.2.1 2004/03/29 16:21:56 darrenr Exp\n */\n\n#ifndef\t__IP_FRAG_H__\n#define\t__IP_FRAG_H__\n\n#define\tIPFT_SIZE\t257\n\ntypedef\tstruct\tipfr\t{\n\tstruct\tipfr\t*ipfr_hnext, **ipfr_hprev;\n\tstruct\tipfr\t*ipfr_next, **ipfr_prev;\n\tvoid\t*ipfr_data;\n\tfrentry_t *ipfr_rule;\n\tu_long\tipfr_ttl;\n\tint\tipfr_ref;\n\tu_short\tipfr_off;\n\tu_short\tipfr_seen0;\n\t/*\n\t * All of the fields, from ipfr_ifp to ipfr_pass, are compared\n\t * using bcmp to see if an identical entry is present.  It is\n\t * therefore important for this set to remain together.\n\t */\n\tvoid\t*ipfr_ifp;\n\tstruct\tin_addr\tipfr_src;\n\tstruct\tin_addr\tipfr_dst;\n\tu_32_t\tipfr_optmsk;\n\tu_short\tipfr_secmsk;\n\tu_short\tipfr_auth;\n\tu_short\tipfr_id;\n\tu_char\tipfr_p;\n\tu_char\tipfr_tos;\n\tu_32_t\tipfr_pass;\n} ipfr_t;\n\n\ntypedef\tstruct\tipfrstat {\n\tu_long\tifs_exists;\t/* add & already exists */\n\tu_long\tifs_nomem;\n\tu_long\tifs_new;\n\tu_long\tifs_hits;\n\tu_long\tifs_expire;\n\tu_long\tifs_inuse;\n\tu_long\tifs_retrans0;\n\tu_long\tifs_short;\n\tstruct\tipfr\t**ifs_table;\n\tstruct\tipfr\t**ifs_nattab;\n} ipfrstat_t;\n\n#define\tIPFR_CMPSZ\t(offsetof(ipfr_t, ipfr_pass) - \\\n\t\t\t offsetof(ipfr_t, ipfr_ifp))\n\nextern\tipfr_t\t*ipfr_list, **ipfr_tail;\nextern\tipfr_t\t*ipfr_natlist, **ipfr_nattail;\nextern\tint\tipfr_size;\nextern\tint\tfr_ipfrttl;\nextern\tint\tfr_frag_lock;\nextern\tint\tfr_fraginit __P((void));\nextern\tvoid\tfr_fragunload __P((void));\nextern\tipfrstat_t\t*fr_fragstats __P((void));\n\nextern\tint\tfr_newfrag __P((fr_info_t *, u_32_t));\nextern\tfrentry_t *fr_knownfrag __P((fr_info_t *, u_32_t *));\n\nextern\tint\tfr_nat_newfrag __P((fr_info_t *, u_32_t, struct nat *));\nextern\tnat_t\t*fr_nat_knownfrag __P((fr_info_t *));\n\nextern\tint\tfr_ipid_newfrag __P((fr_info_t *, u_32_t));\nextern\tu_32_t\tfr_ipid_knownfrag __P((fr_info_t *));\n#ifdef USE_MUTEXES\nextern\tvoid\tfr_fragderef __P((ipfr_t **, ipfrwlock_t *));\nextern\tint\tfr_nextfrag __P((ipftoken_t *, ipfgeniter_t *, ipfr_t **, \\\n\t\t\t\t ipfr_t ***, ipfrwlock_t *));\n#else\nextern\tvoid\tfr_fragderef __P((ipfr_t **));\nextern\tint\tfr_nextfrag __P((ipftoken_t *, ipfgeniter_t *, ipfr_t **, \\\n\t\t\t\t ipfr_t ***));\n#endif\n\nextern\tvoid\tfr_forget __P((void *));\nextern\tvoid\tfr_forgetnat __P((void *));\nextern\tvoid\tfr_fragclear __P((void));\nextern\tvoid\tfr_fragexpire __P((void));\n\n#if     defined(_KERNEL) && ((BSD >= 199306) || SOLARIS || defined(__sgi) \\\n\t        || defined(__osf__) || (defined(__sgi) && (IRIX >= 60500)))\n# if defined(SOLARIS2) && (SOLARIS2 < 7)\nextern\tvoid\tfr_slowtimer __P((void));\n# else\nextern\tvoid\tfr_slowtimer __P((void *));\n# endif\n#else\n# if defined(linux) && defined(_KERNEL)\nextern\tvoid\tfr_slowtimer __P((long));\n# else\nextern\tint\tfr_slowtimer __P((void));\n# endif\n#endif\n\n#endif\t/* __IP_FRAG_H__ */\n"
  },
  {
    "path": "freebsd-headers/netinet/ip_fw.h",
    "content": "/*-\n * Copyright (c) 2002-2009 Luigi Rizzo, Universita` di Pisa\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/netinet/ip_fw.h 225044 2011-08-20 17:05:11Z bz $\n */\n\n#ifndef _IPFW2_H\n#define _IPFW2_H\n\n/*\n * The default rule number.  By the design of ip_fw, the default rule\n * is the last one, so its number can also serve as the highest number\n * allowed for a rule.  The ip_fw code relies on both meanings of this\n * constant. \n */\n#define\tIPFW_DEFAULT_RULE\t65535\n\n/*\n * The number of ipfw tables.  The maximum allowed table number is the\n * (IPFW_TABLES_MAX - 1).\n */\n#define\tIPFW_TABLES_MAX\t\t128\n\n/*\n * Most commands (queue, pipe, tag, untag, limit...) can have a 16-bit\n * argument between 1 and 65534. The value 0 is unused, the value\n * 65535 (IP_FW_TABLEARG) is used to represent 'tablearg', i.e. the\n * can be 1..65534, or 65535 to indicate the use of a 'tablearg'\n * result of the most recent table() lookup.\n * Note that 16bit is only a historical limit, resulting from\n * the use of a 16-bit fields for that value. In reality, we can have\n * 2^32 pipes, queues, tag values and so on, and use 0 as a tablearg.\n */\n#define\tIPFW_ARG_MIN\t\t1\n#define\tIPFW_ARG_MAX\t\t65534\n#define IP_FW_TABLEARG\t\t65535\t/* XXX should use 0 */\n\n/*\n * Number of entries in the call stack of the call/return commands.\n * Call stack currently is an uint16_t array with rule numbers.\n */\n#define\tIPFW_CALLSTACK_SIZE\t16\n\n/*\n * The kernel representation of ipfw rules is made of a list of\n * 'instructions' (for all practical purposes equivalent to BPF\n * instructions), which specify which fields of the packet\n * (or its metadata) should be analysed.\n *\n * Each instruction is stored in a structure which begins with\n * \"ipfw_insn\", and can contain extra fields depending on the\n * instruction type (listed below).\n * Note that the code is written so that individual instructions\n * have a size which is a multiple of 32 bits. This means that, if\n * such structures contain pointers or other 64-bit entities,\n * (there is just one instance now) they may end up unaligned on\n * 64-bit architectures, so the must be handled with care.\n *\n * \"enum ipfw_opcodes\" are the opcodes supported. We can have up\n * to 256 different opcodes. When adding new opcodes, they should\n * be appended to the end of the opcode list before O_LAST_OPCODE,\n * this will prevent the ABI from being broken, otherwise users\n * will have to recompile ipfw(8) when they update the kernel.\n */\n\nenum ipfw_opcodes {\t\t/* arguments (4 byte each)\t*/\n\tO_NOP,\n\n\tO_IP_SRC,\t\t/* u32 = IP\t\t\t*/\n\tO_IP_SRC_MASK,\t\t/* ip = IP/mask\t\t\t*/\n\tO_IP_SRC_ME,\t\t/* none\t\t\t\t*/\n\tO_IP_SRC_SET,\t\t/* u32=base, arg1=len, bitmap\t*/\n\n\tO_IP_DST,\t\t/* u32 = IP\t\t\t*/\n\tO_IP_DST_MASK,\t\t/* ip = IP/mask\t\t\t*/\n\tO_IP_DST_ME,\t\t/* none\t\t\t\t*/\n\tO_IP_DST_SET,\t\t/* u32=base, arg1=len, bitmap\t*/\n\n\tO_IP_SRCPORT,\t\t/* (n)port list:mask 4 byte ea\t*/\n\tO_IP_DSTPORT,\t\t/* (n)port list:mask 4 byte ea\t*/\n\tO_PROTO,\t\t/* arg1=protocol\t\t*/\n\n\tO_MACADDR2,\t\t/* 2 mac addr:mask\t\t*/\n\tO_MAC_TYPE,\t\t/* same as srcport\t\t*/\n\n\tO_LAYER2,\t\t/* none\t\t\t\t*/\n\tO_IN,\t\t\t/* none\t\t\t\t*/\n\tO_FRAG,\t\t\t/* none\t\t\t\t*/\n\n\tO_RECV,\t\t\t/* none\t\t\t\t*/\n\tO_XMIT,\t\t\t/* none\t\t\t\t*/\n\tO_VIA,\t\t\t/* none\t\t\t\t*/\n\n\tO_IPOPT,\t\t/* arg1 = 2*u8 bitmap\t\t*/\n\tO_IPLEN,\t\t/* arg1 = len\t\t\t*/\n\tO_IPID,\t\t\t/* arg1 = id\t\t\t*/\n\n\tO_IPTOS,\t\t/* arg1 = id\t\t\t*/\n\tO_IPPRECEDENCE,\t\t/* arg1 = precedence << 5\t*/\n\tO_IPTTL,\t\t/* arg1 = TTL\t\t\t*/\n\n\tO_IPVER,\t\t/* arg1 = version\t\t*/\n\tO_UID,\t\t\t/* u32 = id\t\t\t*/\n\tO_GID,\t\t\t/* u32 = id\t\t\t*/\n\tO_ESTAB,\t\t/* none (tcp established)\t*/\n\tO_TCPFLAGS,\t\t/* arg1 = 2*u8 bitmap\t\t*/\n\tO_TCPWIN,\t\t/* arg1 = desired win\t\t*/\n\tO_TCPSEQ,\t\t/* u32 = desired seq.\t\t*/\n\tO_TCPACK,\t\t/* u32 = desired seq.\t\t*/\n\tO_ICMPTYPE,\t\t/* u32 = icmp bitmap\t\t*/\n\tO_TCPOPTS,\t\t/* arg1 = 2*u8 bitmap\t\t*/\n\n\tO_VERREVPATH,\t\t/* none\t\t\t\t*/\n\tO_VERSRCREACH,\t\t/* none\t\t\t\t*/\n\n\tO_PROBE_STATE,\t\t/* none\t\t\t\t*/\n\tO_KEEP_STATE,\t\t/* none\t\t\t\t*/\n\tO_LIMIT,\t\t/* ipfw_insn_limit\t\t*/\n\tO_LIMIT_PARENT,\t\t/* dyn_type, not an opcode.\t*/\n\n\t/*\n\t * These are really 'actions'.\n\t */\n\n\tO_LOG,\t\t\t/* ipfw_insn_log\t\t*/\n\tO_PROB,\t\t\t/* u32 = match probability\t*/\n\n\tO_CHECK_STATE,\t\t/* none\t\t\t\t*/\n\tO_ACCEPT,\t\t/* none\t\t\t\t*/\n\tO_DENY,\t\t\t/* none \t\t\t*/\n\tO_REJECT,\t\t/* arg1=icmp arg (same as deny)\t*/\n\tO_COUNT,\t\t/* none\t\t\t\t*/\n\tO_SKIPTO,\t\t/* arg1=next rule number\t*/\n\tO_PIPE,\t\t\t/* arg1=pipe number\t\t*/\n\tO_QUEUE,\t\t/* arg1=queue number\t\t*/\n\tO_DIVERT,\t\t/* arg1=port number\t\t*/\n\tO_TEE,\t\t\t/* arg1=port number\t\t*/\n\tO_FORWARD_IP,\t\t/* fwd sockaddr\t\t\t*/\n\tO_FORWARD_MAC,\t\t/* fwd mac\t\t\t*/\n\tO_NAT,                  /* nope                         */\n\tO_REASS,                /* none                         */\n\t\n\t/*\n\t * More opcodes.\n\t */\n\tO_IPSEC,\t\t/* has ipsec history \t\t*/\n\tO_IP_SRC_LOOKUP,\t/* arg1=table number, u32=value\t*/\n\tO_IP_DST_LOOKUP,\t/* arg1=table number, u32=value\t*/\n\tO_ANTISPOOF,\t\t/* none\t\t\t\t*/\n\tO_JAIL,\t\t\t/* u32 = id\t\t\t*/\n\tO_ALTQ,\t\t\t/* u32 = altq classif. qid\t*/\n\tO_DIVERTED,\t\t/* arg1=bitmap (1:loop, 2:out)\t*/\n\tO_TCPDATALEN,\t\t/* arg1 = tcp data len\t\t*/\n\tO_IP6_SRC,\t\t/* address without mask\t\t*/\n\tO_IP6_SRC_ME,\t\t/* my addresses\t\t\t*/\n\tO_IP6_SRC_MASK,\t\t/* address with the mask\t*/\n\tO_IP6_DST,\n\tO_IP6_DST_ME,\n\tO_IP6_DST_MASK,\n\tO_FLOW6ID,\t\t/* for flow id tag in the ipv6 pkt */\n\tO_ICMP6TYPE,\t\t/* icmp6 packet type filtering\t*/\n\tO_EXT_HDR,\t\t/* filtering for ipv6 extension header */\n\tO_IP6,\n\n\t/*\n\t * actions for ng_ipfw\n\t */\n\tO_NETGRAPH,\t\t/* send to ng_ipfw\t\t*/\n\tO_NGTEE,\t\t/* copy to ng_ipfw\t\t*/\n\n\tO_IP4,\n\n\tO_UNREACH6,\t\t/* arg1=icmpv6 code arg (deny)  */\n\n\tO_TAG,   \t\t/* arg1=tag number */\n\tO_TAGGED,\t\t/* arg1=tag number */\n\n\tO_SETFIB,\t\t/* arg1=FIB number */\n\tO_FIB,\t\t\t/* arg1=FIB desired fib number */\n\t\n\tO_SOCKARG,\t\t/* socket argument */\n\n\tO_CALLRETURN,\t\t/* arg1=called rule number */\n\n\tO_FORWARD_IP6,\t\t/* fwd sockaddr_in6             */\n\n\tO_LAST_OPCODE\t\t/* not an opcode!\t\t*/\n};\n\n\n/*\n * The extension header are filtered only for presence using a bit\n * vector with a flag for each header.\n */\n#define EXT_FRAGMENT\t0x1\n#define EXT_HOPOPTS\t0x2\n#define EXT_ROUTING\t0x4\n#define EXT_AH\t\t0x8\n#define EXT_ESP\t\t0x10\n#define EXT_DSTOPTS\t0x20\n#define EXT_RTHDR0\t\t0x40\n#define EXT_RTHDR2\t\t0x80\n\n/*\n * Template for instructions.\n *\n * ipfw_insn is used for all instructions which require no operands,\n * a single 16-bit value (arg1), or a couple of 8-bit values.\n *\n * For other instructions which require different/larger arguments\n * we have derived structures, ipfw_insn_*.\n *\n * The size of the instruction (in 32-bit words) is in the low\n * 6 bits of \"len\". The 2 remaining bits are used to implement\n * NOT and OR on individual instructions. Given a type, you can\n * compute the length to be put in \"len\" using F_INSN_SIZE(t)\n *\n * F_NOT\tnegates the match result of the instruction.\n *\n * F_OR\t\tis used to build or blocks. By default, instructions\n *\t\tare evaluated as part of a logical AND. An \"or\" block\n *\t\t{ X or Y or Z } contains F_OR set in all but the last\n *\t\tinstruction of the block. A match will cause the code\n *\t\tto skip past the last instruction of the block.\n *\n * NOTA BENE: in a couple of places we assume that\n *\tsizeof(ipfw_insn) == sizeof(u_int32_t)\n * this needs to be fixed.\n *\n */\ntypedef struct\t_ipfw_insn {\t/* template for instructions */\n\tu_int8_t \topcode;\n\tu_int8_t\tlen;\t/* number of 32-bit words */\n#define\tF_NOT\t\t0x80\n#define\tF_OR\t\t0x40\n#define\tF_LEN_MASK\t0x3f\n#define\tF_LEN(cmd)\t((cmd)->len & F_LEN_MASK)\n\n\tu_int16_t\targ1;\n} ipfw_insn;\n\n/*\n * The F_INSN_SIZE(type) computes the size, in 4-byte words, of\n * a given type.\n */\n#define\tF_INSN_SIZE(t)\t((sizeof (t))/sizeof(u_int32_t))\n\n/*\n * This is used to store an array of 16-bit entries (ports etc.)\n */\ntypedef struct\t_ipfw_insn_u16 {\n\tipfw_insn o;\n\tu_int16_t ports[2];\t/* there may be more */\n} ipfw_insn_u16;\n\n/*\n * This is used to store an array of 32-bit entries\n * (uid, single IPv4 addresses etc.)\n */\ntypedef struct\t_ipfw_insn_u32 {\n\tipfw_insn o;\n\tu_int32_t d[1];\t/* one or more */\n} ipfw_insn_u32;\n\n/*\n * This is used to store IP addr-mask pairs.\n */\ntypedef struct\t_ipfw_insn_ip {\n\tipfw_insn o;\n\tstruct in_addr\taddr;\n\tstruct in_addr\tmask;\n} ipfw_insn_ip;\n\n/*\n * This is used to forward to a given address (ip).\n */\ntypedef struct  _ipfw_insn_sa {\n\tipfw_insn o;\n\tstruct sockaddr_in sa;\n} ipfw_insn_sa;\n\n/*\n * This is used to forward to a given address (ipv6).\n */\ntypedef struct _ipfw_insn_sa6 {\n\tipfw_insn o;\n\tstruct sockaddr_in6 sa;\n} ipfw_insn_sa6;\n\n/*\n * This is used for MAC addr-mask pairs.\n */\ntypedef struct\t_ipfw_insn_mac {\n\tipfw_insn o;\n\tu_char addr[12];\t/* dst[6] + src[6] */\n\tu_char mask[12];\t/* dst[6] + src[6] */\n} ipfw_insn_mac;\n\n/*\n * This is used for interface match rules (recv xx, xmit xx).\n */\ntypedef struct\t_ipfw_insn_if {\n\tipfw_insn o;\n\tunion {\n\t\tstruct in_addr ip;\n\t\tint glob;\n\t} p;\n\tchar name[IFNAMSIZ];\n} ipfw_insn_if;\n\n/*\n * This is used for storing an altq queue id number.\n */\ntypedef struct _ipfw_insn_altq {\n\tipfw_insn\to;\n\tu_int32_t\tqid;\n} ipfw_insn_altq;\n\n/*\n * This is used for limit rules.\n */\ntypedef struct\t_ipfw_insn_limit {\n\tipfw_insn o;\n\tu_int8_t _pad;\n\tu_int8_t limit_mask;\t/* combination of DYN_* below\t*/\n#define\tDYN_SRC_ADDR\t0x1\n#define\tDYN_SRC_PORT\t0x2\n#define\tDYN_DST_ADDR\t0x4\n#define\tDYN_DST_PORT\t0x8\n\n\tu_int16_t conn_limit;\n} ipfw_insn_limit;\n\n/*\n * This is used for log instructions.\n */\ntypedef struct  _ipfw_insn_log {\n        ipfw_insn o;\n\tu_int32_t max_log;\t/* how many do we log -- 0 = all */\n\tu_int32_t log_left;\t/* how many left to log \t*/\n} ipfw_insn_log;\n\n/*\n * Data structures required by both ipfw(8) and ipfw(4) but not part of the\n * management API are protected by IPFW_INTERNAL.\n */\n#ifdef IPFW_INTERNAL\n/* Server pool support (LSNAT). */\nstruct cfg_spool {\n\tLIST_ENTRY(cfg_spool)   _next;          /* chain of spool instances */\n\tstruct in_addr          addr;\n\tu_short                 port;\n};\n#endif\n\n/* Redirect modes id. */\n#define REDIR_ADDR      0x01\n#define REDIR_PORT      0x02\n#define REDIR_PROTO     0x04\n\n#ifdef IPFW_INTERNAL\n/* Nat redirect configuration. */\nstruct cfg_redir {\n\tLIST_ENTRY(cfg_redir)   _next;          /* chain of redir instances */\n\tu_int16_t               mode;           /* type of redirect mode */\n\tstruct in_addr\t        laddr;          /* local ip address */\n\tstruct in_addr\t        paddr;          /* public ip address */\n\tstruct in_addr\t        raddr;          /* remote ip address */\n\tu_short                 lport;          /* local port */\n\tu_short                 pport;          /* public port */\n\tu_short                 rport;          /* remote port  */\n\tu_short                 pport_cnt;      /* number of public ports */\n\tu_short                 rport_cnt;      /* number of remote ports */\n\tint                     proto;          /* protocol: tcp/udp */\n\tstruct alias_link       **alink;\t\n\t/* num of entry in spool chain */\n\tu_int16_t               spool_cnt;      \n\t/* chain of spool instances */\n\tLIST_HEAD(spool_chain, cfg_spool) spool_chain;\n};\n#endif\n\n#ifdef IPFW_INTERNAL\n/* Nat configuration data struct. */\nstruct cfg_nat {\n\t/* chain of nat instances */\n\tLIST_ENTRY(cfg_nat)     _next;\n\tint                     id;                     /* nat id */\n\tstruct in_addr          ip;                     /* nat ip address */\n\tchar                    if_name[IF_NAMESIZE];   /* interface name */\n\tint                     mode;                   /* aliasing mode */\n\tstruct libalias\t        *lib;                   /* libalias instance */\n\t/* number of entry in spool chain */\n\tint                     redir_cnt;              \n\t/* chain of redir instances */\n\tLIST_HEAD(redir_chain, cfg_redir) redir_chain;  \n};\n#endif\n\n#define SOF_NAT         sizeof(struct cfg_nat)\n#define SOF_REDIR       sizeof(struct cfg_redir)\n#define SOF_SPOOL       sizeof(struct cfg_spool)\n\n/* Nat command. */\ntypedef struct\t_ipfw_insn_nat {\n \tipfw_insn\to;\n \tstruct cfg_nat *nat;\t\n} ipfw_insn_nat;\n\n/* Apply ipv6 mask on ipv6 addr */\n#define APPLY_MASK(addr,mask)                          \\\n    (addr)->__u6_addr.__u6_addr32[0] &= (mask)->__u6_addr.__u6_addr32[0]; \\\n    (addr)->__u6_addr.__u6_addr32[1] &= (mask)->__u6_addr.__u6_addr32[1]; \\\n    (addr)->__u6_addr.__u6_addr32[2] &= (mask)->__u6_addr.__u6_addr32[2]; \\\n    (addr)->__u6_addr.__u6_addr32[3] &= (mask)->__u6_addr.__u6_addr32[3];\n\n/* Structure for ipv6 */\ntypedef struct _ipfw_insn_ip6 {\n       ipfw_insn o;\n       struct in6_addr addr6;\n       struct in6_addr mask6;\n} ipfw_insn_ip6;\n\n/* Used to support icmp6 types */\ntypedef struct _ipfw_insn_icmp6 {\n       ipfw_insn o;\n       uint32_t d[7]; /* XXX This number si related to the netinet/icmp6.h\n                       *     define ICMP6_MAXTYPE\n                       *     as follows: n = ICMP6_MAXTYPE/32 + 1\n                        *     Actually is 203 \n                       */\n} ipfw_insn_icmp6;\n\n/*\n * Here we have the structure representing an ipfw rule.\n *\n * It starts with a general area (with link fields and counters)\n * followed by an array of one or more instructions, which the code\n * accesses as an array of 32-bit values.\n *\n * Given a rule pointer  r:\n *\n *  r->cmd\t\tis the start of the first instruction.\n *  ACTION_PTR(r)\tis the start of the first action (things to do\n *\t\t\tonce a rule matched).\n *\n * When assembling instruction, remember the following:\n *\n *  + if a rule has a \"keep-state\" (or \"limit\") option, then the\n *\tfirst instruction (at r->cmd) MUST BE an O_PROBE_STATE\n *  + if a rule has a \"log\" option, then the first action\n *\t(at ACTION_PTR(r)) MUST be O_LOG\n *  + if a rule has an \"altq\" option, it comes after \"log\"\n *  + if a rule has an O_TAG option, it comes after \"log\" and \"altq\"\n *\n * NOTE: we use a simple linked list of rules because we never need\n * \tto delete a rule without scanning the list. We do not use\n *\tqueue(3) macros for portability and readability.\n */\n\nstruct ip_fw {\n\tstruct ip_fw\t*x_next;\t/* linked list of rules\t\t*/\n\tstruct ip_fw\t*next_rule;\t/* ptr to next [skipto] rule\t*/\n\t/* 'next_rule' is used to pass up 'set_disable' status\t\t*/\n\n\tuint16_t\tact_ofs;\t/* offset of action in 32-bit units */\n\tuint16_t\tcmd_len;\t/* # of 32-bit words in cmd\t*/\n\tuint16_t\trulenum;\t/* rule number\t\t\t*/\n\tuint8_t\tset;\t\t/* rule set (0..31)\t\t*/\n#define\tRESVD_SET\t31\t/* set for default and persistent rules */\n\tuint8_t\t\t_pad;\t\t/* padding\t\t\t*/\n\tuint32_t\tid;\t\t/* rule id */\n\n\t/* These fields are present in all rules.\t\t\t*/\n\tuint64_t\tpcnt;\t\t/* Packet counter\t\t*/\n\tuint64_t\tbcnt;\t\t/* Byte counter\t\t\t*/\n\tuint32_t\ttimestamp;\t/* tv_sec of last match\t\t*/\n\n\tipfw_insn\tcmd[1];\t\t/* storage for commands\t\t*/\n};\n\n#define ACTION_PTR(rule)\t\t\t\t\\\n\t(ipfw_insn *)( (u_int32_t *)((rule)->cmd) + ((rule)->act_ofs) )\n\n#define RULESIZE(rule)  (sizeof(struct ip_fw) + \\\n\t((struct ip_fw *)(rule))->cmd_len * 4 - 4)\n\n#if 1 // should be moved to in.h\n/*\n * This structure is used as a flow mask and a flow id for various\n * parts of the code.\n * addr_type is used in userland and kernel to mark the address type.\n * fib is used in the kernel to record the fib in use.\n * _flags is used in the kernel to store tcp flags for dynamic rules.\n */\nstruct ipfw_flow_id {\n\tuint32_t\tdst_ip;\n\tuint32_t\tsrc_ip;\n\tuint16_t\tdst_port;\n\tuint16_t\tsrc_port;\n\tuint8_t\t\tfib;\n\tuint8_t\t\tproto;\n\tuint8_t\t\t_flags;\t/* protocol-specific flags */\n\tuint8_t\t\taddr_type; /* 4=ip4, 6=ip6, 1=ether ? */\n\tstruct in6_addr dst_ip6;\n\tstruct in6_addr src_ip6;\n\tuint32_t\tflow_id6;\n\tuint32_t\textra; /* queue/pipe or frag_id */\n};\n#endif\n\n#define IS_IP6_FLOW_ID(id)\t((id)->addr_type == 6)\n\n/*\n * Dynamic ipfw rule.\n */\ntypedef struct _ipfw_dyn_rule ipfw_dyn_rule;\n\nstruct _ipfw_dyn_rule {\n\tipfw_dyn_rule\t*next;\t\t/* linked list of rules.\t*/\n\tstruct ip_fw *rule;\t\t/* pointer to rule\t\t*/\n\t/* 'rule' is used to pass up the rule number (from the parent)\t*/\n\n\tipfw_dyn_rule *parent;\t\t/* pointer to parent rule\t*/\n\tu_int64_t\tpcnt;\t\t/* packet match counter\t\t*/\n\tu_int64_t\tbcnt;\t\t/* byte match counter\t\t*/\n\tstruct ipfw_flow_id id;\t\t/* (masked) flow id\t\t*/\n\tu_int32_t\texpire;\t\t/* expire time\t\t\t*/\n\tu_int32_t\tbucket;\t\t/* which bucket in hash table\t*/\n\tu_int32_t\tstate;\t\t/* state of this rule (typically a\n\t\t\t\t\t * combination of TCP flags)\n\t\t\t\t\t */\n\tu_int32_t\tack_fwd;\t/* most recent ACKs in forward\t*/\n\tu_int32_t\tack_rev;\t/* and reverse directions (used\t*/\n\t\t\t\t\t/* to generate keepalives)\t*/\n\tu_int16_t\tdyn_type;\t/* rule type\t\t\t*/\n\tu_int16_t\tcount;\t\t/* refcount\t\t\t*/\n};\n\n/*\n * Definitions for IP option names.\n */\n#define\tIP_FW_IPOPT_LSRR\t0x01\n#define\tIP_FW_IPOPT_SSRR\t0x02\n#define\tIP_FW_IPOPT_RR\t\t0x04\n#define\tIP_FW_IPOPT_TS\t\t0x08\n\n/*\n * Definitions for TCP option names.\n */\n#define\tIP_FW_TCPOPT_MSS\t0x01\n#define\tIP_FW_TCPOPT_WINDOW\t0x02\n#define\tIP_FW_TCPOPT_SACK\t0x04\n#define\tIP_FW_TCPOPT_TS\t\t0x08\n#define\tIP_FW_TCPOPT_CC\t\t0x10\n\n#define\tICMP_REJECT_RST\t\t0x100\t/* fake ICMP code (send a TCP RST) */\n#define\tICMP6_UNREACH_RST\t0x100\t/* fake ICMPv6 code (send a TCP RST) */\n\n/*\n * These are used for lookup tables.\n */\ntypedef struct\t_ipfw_table_entry {\n\tin_addr_t\taddr;\t\t/* network address\t\t*/\n\tu_int32_t\tvalue;\t\t/* value\t\t\t*/\n\tu_int16_t\ttbl;\t\t/* table number\t\t\t*/\n\tu_int8_t\tmasklen;\t/* mask length\t\t\t*/\n} ipfw_table_entry;\n\ntypedef struct\t_ipfw_table {\n\tu_int32_t\tsize;\t\t/* size of entries in bytes\t*/\n\tu_int32_t\tcnt;\t\t/* # of entries\t\t\t*/\n\tu_int16_t\ttbl;\t\t/* table number\t\t\t*/\n\tipfw_table_entry ent[0];\t/* entries\t\t\t*/\n} ipfw_table;\n\n#endif /* _IPFW2_H */\n"
  },
  {
    "path": "freebsd-headers/netinet/ip_gre.h",
    "content": "/*\t$NetBSD: ip_gre.h,v 1.5 2002/06/09 16:33:40 itojun Exp $ */\n/*\t $FreeBSD: release/9.0.0/sys/netinet/ip_gre.h 204522 2010-03-01 17:05:46Z joel $ */\n\n/*-\n * Copyright (c) 1998 The NetBSD Foundation, Inc.\n * All rights reserved.\n *\n * This code is derived from software contributed to The NetBSD Foundation\n * by Heiko W.Rupp <hwr@pilhuhn.de>\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS\n * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED\n * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\n * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS\n * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\n * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\n * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\n * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\n * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\n#ifdef _KERNEL\nvoid gre_input(struct mbuf *, int);\nvoid gre_mobile_input(struct mbuf *, int);\n#endif /* _KERNEL */\n"
  },
  {
    "path": "freebsd-headers/netinet/ip_htable.h",
    "content": "#ifndef __IP_HTABLE_H__\n#define __IP_HTABLE_H__\n\n#include \"netinet/ip_lookup.h\"\n\ntypedef\tstruct\tiphtent_s\t{\n\tstruct\tiphtent_s\t*ipe_next, **ipe_pnext;\n\tstruct\tiphtent_s\t*ipe_hnext, **ipe_phnext;\n\tvoid\t\t*ipe_ptr;\n\ti6addr_t\tipe_addr;\n\ti6addr_t\tipe_mask;\n\tint\t\tipe_ref;\n\tint\t\tipe_unit;\n\tunion\t{\n\t\tchar\tipeu_char[16];\n\t\tu_long\tipeu_long;\n\t\tu_int\tipeu_int;\n\t}ipe_un;\n} iphtent_t;\n\n#define\tipe_value\tipe_un.ipeu_int\n#define\tipe_group\tipe_un.ipeu_char\n\n#define\tIPE_HASH_FN(a, m, s)\t(((a) * (m)) % (s))\n\n\ntypedef\tstruct\tiphtable_s\t{\n\tipfrwlock_t\tiph_rwlock;\n\tstruct\tiphtable_s\t*iph_next, **iph_pnext;\n\tstruct\tiphtent_s\t**iph_table;\n\tstruct\tiphtent_s\t*iph_list;\n\tsize_t\tiph_size;\t\t/* size of hash table */\n\tu_long\tiph_seed;\t\t/* hashing seed */\n\tu_32_t\tiph_flags;\n\tu_int\tiph_unit;\t\t/* IPL_LOG* */\n\tu_int\tiph_ref;\n\tu_int\tiph_type;\t\t/* lookup or group map  - IPHASH_* */\n\tu_int\tiph_masks;\t\t/* IPv4 netmasks in use */\n\tchar\tiph_name[FR_GROUPLEN];\t/* hash table number */\n} iphtable_t;\n\n/* iph_type */\n#define\tIPHASH_LOOKUP\t0\n#define\tIPHASH_GROUPMAP\t1\n#define\tIPHASH_DELETE\t2\n#define\tIPHASH_ANON\t0x80000000\n\n\ntypedef\tstruct\tiphtstat_s\t{\n\tiphtable_t\t*iphs_tables;\n\tu_long\t\tiphs_numtables;\n\tu_long\t\tiphs_numnodes;\n\tu_long\t\tiphs_nomem;\n\tu_long\t\tiphs_pad[16];\n} iphtstat_t;\n\n\nextern iphtable_t *ipf_htables[IPL_LOGSIZE];\n\nextern iphtable_t *fr_existshtable __P((int, char *));\nextern int fr_clearhtable __P((iphtable_t *));\nextern void fr_htable_unload __P((void));\nextern int fr_newhtable __P((iplookupop_t *));\nextern iphtable_t *fr_findhtable __P((int, char *));\nextern int fr_removehtable __P((int, char *));\nextern size_t fr_flushhtable __P((iplookupflush_t *));\nextern int fr_addhtent __P((iphtable_t *, iphtent_t *));\nextern int fr_delhtent __P((iphtable_t *, iphtent_t *));\nextern int fr_derefhtable __P((iphtable_t *));\nextern int fr_derefhtent __P((iphtent_t *));\nextern int fr_delhtable __P((iphtable_t *));\nextern void *fr_iphmfindgroup __P((void *, void *));\nextern int fr_iphmfindip __P((void *, int, void *));\nextern int fr_gethtablestat __P((iplookupop_t *));\nextern int fr_htable_getnext __P((ipftoken_t *, ipflookupiter_t *));\nextern void fr_htable_iterderef __P((u_int, int, void *));\n\n#endif /* __IP_HTABLE_H__ */\n"
  },
  {
    "path": "freebsd-headers/netinet/ip_icmp.h",
    "content": "/*-\n * Copyright (c) 1982, 1986, 1993\n *\tThe Regents of the University of California.  All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 4. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t@(#)ip_icmp.h\t8.1 (Berkeley) 6/10/93\n * $FreeBSD: release/9.0.0/sys/netinet/ip_icmp.h 207369 2010-04-29 11:52:42Z bz $\n */\n\n#ifndef _NETINET_IP_ICMP_H_\n#define _NETINET_IP_ICMP_H_\n\n/*\n * Interface Control Message Protocol Definitions.\n * Per RFC 792, September 1981.\n */\n\n/*\n * Internal of an ICMP Router Advertisement\n */\nstruct icmp_ra_addr {\n\tu_int32_t ira_addr;\n\tu_int32_t ira_preference;\n};\n\n/*\n * Structure of an icmp header.\n */\nstruct icmphdr {\n\tu_char\ticmp_type;\t\t/* type of message, see below */\n\tu_char\ticmp_code;\t\t/* type sub code */\n\tu_short\ticmp_cksum;\t\t/* ones complement cksum of struct */\n};\n\n/*\n * Structure of an icmp packet.\n *\n * XXX: should start with a struct icmphdr.\n */\nstruct icmp {\n\tu_char\ticmp_type;\t\t/* type of message, see below */\n\tu_char\ticmp_code;\t\t/* type sub code */\n\tu_short\ticmp_cksum;\t\t/* ones complement cksum of struct */\n\tunion {\n\t\tu_char ih_pptr;\t\t\t/* ICMP_PARAMPROB */\n\t\tstruct in_addr ih_gwaddr;\t/* ICMP_REDIRECT */\n\t\tstruct ih_idseq {\n\t\t\tuint16_t\ticd_id;\t/* network format */\n\t\t\tuint16_t\ticd_seq; /* network format */\n\t\t} ih_idseq;\n\t\tint ih_void;\n\n\t\t/* ICMP_UNREACH_NEEDFRAG -- Path MTU Discovery (RFC1191) */\n\t\tstruct ih_pmtu {\n\t\t\tuint16_t ipm_void;\t/* network format */\n\t\t\tuint16_t ipm_nextmtu;\t/* network format */\n\t\t} ih_pmtu;\n\n\t\tstruct ih_rtradv {\n\t\t\tu_char irt_num_addrs;\n\t\t\tu_char irt_wpa;\n\t\t\tu_int16_t irt_lifetime;\n\t\t} ih_rtradv;\n\t} icmp_hun;\n#define\ticmp_pptr\ticmp_hun.ih_pptr\n#define\ticmp_gwaddr\ticmp_hun.ih_gwaddr\n#define\ticmp_id\t\ticmp_hun.ih_idseq.icd_id\n#define\ticmp_seq\ticmp_hun.ih_idseq.icd_seq\n#define\ticmp_void\ticmp_hun.ih_void\n#define\ticmp_pmvoid\ticmp_hun.ih_pmtu.ipm_void\n#define\ticmp_nextmtu\ticmp_hun.ih_pmtu.ipm_nextmtu\n#define\ticmp_num_addrs\ticmp_hun.ih_rtradv.irt_num_addrs\n#define\ticmp_wpa\ticmp_hun.ih_rtradv.irt_wpa\n#define\ticmp_lifetime\ticmp_hun.ih_rtradv.irt_lifetime\n\tunion {\n\t\tstruct id_ts {\t\t\t/* ICMP Timestamp */\n\t\t\t/*\n\t\t\t * The next 3 fields are in network format,\n\t\t\t * milliseconds since 00:00 GMT\n\t\t\t */\n\t\t\tuint32_t its_otime;\t/* Originate */\n\t\t\tuint32_t its_rtime;\t/* Receive */\n\t\t\tuint32_t its_ttime;\t/* Transmit */\n\t\t} id_ts;\n\t\tstruct id_ip  {\n\t\t\tstruct ip idi_ip;\n\t\t\t/* options and then 64 bits of data */\n\t\t} id_ip;\n\t\tstruct icmp_ra_addr id_radv;\n\t\tu_int32_t id_mask;\n\t\tchar\tid_data[1];\n\t} icmp_dun;\n#define\ticmp_otime\ticmp_dun.id_ts.its_otime\n#define\ticmp_rtime\ticmp_dun.id_ts.its_rtime\n#define\ticmp_ttime\ticmp_dun.id_ts.its_ttime\n#define\ticmp_ip\t\ticmp_dun.id_ip.idi_ip\n#define\ticmp_radv\ticmp_dun.id_radv\n#define\ticmp_mask\ticmp_dun.id_mask\n#define\ticmp_data\ticmp_dun.id_data\n};\n\n/*\n * Lower bounds on packet lengths for various types.\n * For the error advice packets must first insure that the\n * packet is large enough to contain the returned ip header.\n * Only then can we do the check to see if 64 bits of packet\n * data have been returned, since we need to check the returned\n * ip header length.\n */\n#define\tICMP_MINLEN\t8\t\t\t\t/* abs minimum */\n#define\tICMP_TSLEN\t(8 + 3 * sizeof (uint32_t))\t/* timestamp */\n#define\tICMP_MASKLEN\t12\t\t\t\t/* address mask */\n#define\tICMP_ADVLENMIN\t(8 + sizeof (struct ip) + 8)\t/* min */\n#define\tICMP_ADVLEN(p)\t(8 + ((p)->icmp_ip.ip_hl << 2) + 8)\n\t/* N.B.: must separately check that ip_hl >= 5 */\n\n/*\n * Definition of type and code field values.\n */\n#define\tICMP_ECHOREPLY\t\t0\t\t/* echo reply */\n#define\tICMP_UNREACH\t\t3\t\t/* dest unreachable, codes: */\n#define\t\tICMP_UNREACH_NET\t0\t\t/* bad net */\n#define\t\tICMP_UNREACH_HOST\t1\t\t/* bad host */\n#define\t\tICMP_UNREACH_PROTOCOL\t2\t\t/* bad protocol */\n#define\t\tICMP_UNREACH_PORT\t3\t\t/* bad port */\n#define\t\tICMP_UNREACH_NEEDFRAG\t4\t\t/* IP_DF caused drop */\n#define\t\tICMP_UNREACH_SRCFAIL\t5\t\t/* src route failed */\n#define\t\tICMP_UNREACH_NET_UNKNOWN 6\t\t/* unknown net */\n#define\t\tICMP_UNREACH_HOST_UNKNOWN 7\t\t/* unknown host */\n#define\t\tICMP_UNREACH_ISOLATED\t8\t\t/* src host isolated */\n#define\t\tICMP_UNREACH_NET_PROHIB\t9\t\t/* prohibited access */\n#define\t\tICMP_UNREACH_HOST_PROHIB 10\t\t/* ditto */\n#define\t\tICMP_UNREACH_TOSNET\t11\t\t/* bad tos for net */\n#define\t\tICMP_UNREACH_TOSHOST\t12\t\t/* bad tos for host */\n#define\t\tICMP_UNREACH_FILTER_PROHIB 13\t\t/* admin prohib */\n#define\t\tICMP_UNREACH_HOST_PRECEDENCE 14\t\t/* host prec vio. */\n#define\t\tICMP_UNREACH_PRECEDENCE_CUTOFF 15\t/* prec cutoff */\n#define\tICMP_SOURCEQUENCH\t4\t\t/* packet lost, slow down */\n#define\tICMP_REDIRECT\t\t5\t\t/* shorter route, codes: */\n#define\t\tICMP_REDIRECT_NET\t0\t\t/* for network */\n#define\t\tICMP_REDIRECT_HOST\t1\t\t/* for host */\n#define\t\tICMP_REDIRECT_TOSNET\t2\t\t/* for tos and net */\n#define\t\tICMP_REDIRECT_TOSHOST\t3\t\t/* for tos and host */\n#define\tICMP_ALTHOSTADDR\t6\t\t/* alternate host address */\n#define\tICMP_ECHO\t\t8\t\t/* echo service */\n#define\tICMP_ROUTERADVERT\t9\t\t/* router advertisement */\n#define\t\tICMP_ROUTERADVERT_NORMAL\t\t0\t/* normal advertisement */\n#define\t\tICMP_ROUTERADVERT_NOROUTE_COMMON\t16\t/* selective routing */\n#define\tICMP_ROUTERSOLICIT\t10\t\t/* router solicitation */\n#define\tICMP_TIMXCEED\t\t11\t\t/* time exceeded, code: */\n#define\t\tICMP_TIMXCEED_INTRANS\t0\t\t/* ttl==0 in transit */\n#define\t\tICMP_TIMXCEED_REASS\t1\t\t/* ttl==0 in reass */\n#define\tICMP_PARAMPROB\t\t12\t\t/* ip header bad */\n#define\t\tICMP_PARAMPROB_ERRATPTR 0\t\t/* error at param ptr */\n#define\t\tICMP_PARAMPROB_OPTABSENT 1\t\t/* req. opt. absent */\n#define\t\tICMP_PARAMPROB_LENGTH 2\t\t\t/* bad length */\n#define\tICMP_TSTAMP\t\t13\t\t/* timestamp request */\n#define\tICMP_TSTAMPREPLY\t14\t\t/* timestamp reply */\n#define\tICMP_IREQ\t\t15\t\t/* information request */\n#define\tICMP_IREQREPLY\t\t16\t\t/* information reply */\n#define\tICMP_MASKREQ\t\t17\t\t/* address mask request */\n#define\tICMP_MASKREPLY\t\t18\t\t/* address mask reply */\n#define\tICMP_TRACEROUTE\t\t30\t\t/* traceroute */\n#define\tICMP_DATACONVERR\t31\t\t/* data conversion error */\n#define\tICMP_MOBILE_REDIRECT\t32\t\t/* mobile host redirect */\n#define\tICMP_IPV6_WHEREAREYOU\t33\t\t/* IPv6 where-are-you */\n#define\tICMP_IPV6_IAMHERE\t34\t\t/* IPv6 i-am-here */\n#define\tICMP_MOBILE_REGREQUEST\t35\t\t/* mobile registration req */\n#define\tICMP_MOBILE_REGREPLY\t36\t\t/* mobile registration reply */\n#define\tICMP_SKIP\t\t39\t\t/* SKIP */\n#define\tICMP_PHOTURIS\t\t40\t\t/* Photuris */\n#define\t\tICMP_PHOTURIS_UNKNOWN_INDEX\t1\t/* unknown sec index */\n#define\t\tICMP_PHOTURIS_AUTH_FAILED\t2\t/* auth failed */\n#define\t\tICMP_PHOTURIS_DECRYPT_FAILED\t3\t/* decrypt failed */\n\n#define\tICMP_MAXTYPE\t\t40\n\n#define\tICMP_INFOTYPE(type) \\\n\t((type) == ICMP_ECHOREPLY || (type) == ICMP_ECHO || \\\n\t(type) == ICMP_ROUTERADVERT || (type) == ICMP_ROUTERSOLICIT || \\\n\t(type) == ICMP_TSTAMP || (type) == ICMP_TSTAMPREPLY || \\\n\t(type) == ICMP_IREQ || (type) == ICMP_IREQREPLY || \\\n\t(type) == ICMP_MASKREQ || (type) == ICMP_MASKREPLY)\n\n#ifdef _KERNEL\nvoid\ticmp_error(struct mbuf *, int, int, uint32_t, int);\nvoid\ticmp_input(struct mbuf *, int);\nint\tip_next_mtu(int, int);\n#endif\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/netinet/ip_ipsec.h",
    "content": "/*-\n * Copyright (c) 1982, 1986, 1988, 1993\n *      The Regents of the University of California.  All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 4. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/netinet/ip_ipsec.h 199102 2009-11-09 19:53:34Z trasz $\n */\n\n#ifndef _NETINET_IP_IPSEC_H_\n#define _NETINET_IP_IPSEC_H_\n\nint\tip_ipsec_filtertunnel(struct mbuf *);\nint\tip_ipsec_fwd(struct mbuf *);\nint\tip_ipsec_input(struct mbuf *);\nint\tip_ipsec_mtu(struct mbuf *, int);\nint\tip_ipsec_output(struct mbuf **, struct inpcb *, int *, int *);\n#endif\n"
  },
  {
    "path": "freebsd-headers/netinet/ip_lookup.h",
    "content": "\n#ifndef __IP_LOOKUP_H__\n#define __IP_LOOKUP_H__\n\n#if defined(__STDC__) || defined(__GNUC__) || defined(_AIX51)\n# define\tSIOCLOOKUPADDTABLE\t_IOWR('r', 60, struct iplookupop)\n# define\tSIOCLOOKUPDELTABLE\t_IOWR('r', 61, struct iplookupop)\n# define\tSIOCLOOKUPSTAT\t\t_IOWR('r', 64, struct iplookupop)\n# define\tSIOCLOOKUPSTATW\t\t_IOW('r', 64, struct iplookupop)\n# define\tSIOCLOOKUPFLUSH\t\t_IOWR('r', 65, struct iplookupflush)\n# define\tSIOCLOOKUPADDNODE\t_IOWR('r', 67, struct iplookupop)\n# define\tSIOCLOOKUPADDNODEW\t_IOW('r', 67, struct iplookupop)\n# define\tSIOCLOOKUPDELNODE\t_IOWR('r', 68, struct iplookupop)\n# define\tSIOCLOOKUPDELNODEW\t_IOW('r', 68, struct iplookupop)\n#else\n# define\tSIOCLOOKUPADDTABLE\t_IOWR(r, 60, struct iplookupop)\n# define\tSIOCLOOKUPDELTABLE\t_IOWR(r, 61, struct iplookupop)\n# define\tSIOCLOOKUPSTAT\t\t_IOWR(r, 64, struct iplookupop)\n# define\tSIOCLOOKUPSTATW\t\t_IOW(r, 64, struct iplookupop)\n# define\tSIOCLOOKUPFLUSH\t\t_IOWR(r, 65, struct iplookupflush)\n# define\tSIOCLOOKUPADDNODE\t_IOWR(r, 67, struct iplookupop)\n# define\tSIOCLOOKUPADDNODEW\t_IOW(r, 67, struct iplookupop)\n# define\tSIOCLOOKUPDELNODE\t_IOWR(r, 68, struct iplookupop)\n# define\tSIOCLOOKUPDELNODEW\t_IOW(r, 68, struct iplookupop)\n#endif\n\ntypedef\tstruct\tiplookupop\t{\n\tint\tiplo_type;\t/* IPLT_* */\n\tint\tiplo_unit;\t/* IPL_LOG* */\n\tu_int\tiplo_arg;\n\tchar\tiplo_name[FR_GROUPLEN];\n\tsize_t\tiplo_size;\t/* sizeof struct at iplo_struct */\n\tvoid\t*iplo_struct;\n} iplookupop_t;\n\n#define\tLOOKUP_ANON\t0x80000000\n\n\ntypedef\tstruct\tiplookupflush\t{\n\tint\tiplf_type;\t/* IPLT_* */\n\tint\tiplf_unit;\t/* IPL_LOG* */\n\tu_int\tiplf_arg;\n\tsize_t\tiplf_count;\n\tchar\tiplf_name[FR_GROUPLEN];\n} iplookupflush_t;\n\ntypedef\tstruct\tiplookuplink\t{\n\tint\tipll_type;\t/* IPLT_* */\n\tint\tipll_unit;\t/* IPL_LOG* */\n\tu_int\tipll_num;\n\tchar\tipll_group[FR_GROUPLEN];\n} iplookuplink_t;\n\n#define\tIPLT_ALL\t-1\n#define\tIPLT_NONE\t0\n#define\tIPLT_POOL\t1\n#define\tIPLT_HASH\t2\n\n#define\tIPLT_ANON\t0x80000000\n\n\ntypedef\tunion\t{\n\tstruct\tiplookupiterkey {\n\t\tchar\tilik_ival;\n\t\tu_char\tilik_type;\t/* IPLT_* */\n\t\tu_char\tilik_otype;\n\t\tu_char\tilik_unit;\t/* IPL_LOG* */\n\t} ilik_unstr;\n\tu_32_t\tilik_key;\n} iplookupiterkey_t;\n\ntypedef\tstruct\tipflookupiter\t{\n\tint\t\t\tili_nitems;\n\tiplookupiterkey_t\tili_lkey;\n\tchar\t\t\tili_name[FR_GROUPLEN];\n\tvoid\t\t\t*ili_data;\n} ipflookupiter_t;\n\n#define\tili_key\t\tili_lkey.ilik_key\n#define\tili_ival\tili_lkey.ilik_unstr.ilik_ival\n#define\tili_unit\tili_lkey.ilik_unstr.ilik_unit\n#define\tili_type\tili_lkey.ilik_unstr.ilik_type\n#define\tili_otype\tili_lkey.ilik_unstr.ilik_otype\n\n#define\tIPFLOOKUPITER_LIST\t0\n#define\tIPFLOOKUPITER_NODE\t1\n\n\nextern int ip_lookup_init __P((void));\nextern int ip_lookup_ioctl __P((caddr_t, ioctlcmd_t, int, int, void *));\nextern void ip_lookup_unload __P((void));\nextern void ip_lookup_deref __P((int, void *));\nextern void ip_lookup_iterderef __P((u_32_t, void *));\n\n#endif /* __IP_LOOKUP_H__ */\n"
  },
  {
    "path": "freebsd-headers/netinet/ip_mroute.h",
    "content": "/*-\n * Copyright (c) 1989 Stephen Deering.\n * Copyright (c) 1992, 1993\n *\tThe Regents of the University of California.  All rights reserved.\n *\n * This code is derived from software contributed to Berkeley by\n * Stephen Deering of Stanford University.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 4. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t@(#)ip_mroute.h\t8.1 (Berkeley) 6/10/93\n * $FreeBSD: release/9.0.0/sys/netinet/ip_mroute.h 208744 2010-06-02 15:44:43Z zec $\n */\n\n#ifndef _NETINET_IP_MROUTE_H_\n#define _NETINET_IP_MROUTE_H_\n\n/*\n * Definitions for IP multicast forwarding.\n *\n * Written by David Waitzman, BBN Labs, August 1988.\n * Modified by Steve Deering, Stanford, February 1989.\n * Modified by Ajit Thyagarajan, PARC, August 1993.\n * Modified by Ajit Thyagarajan, PARC, August 1994.\n * Modified by Ahmed Helmy, SGI, June 1996.\n * Modified by Pavlin Radoslavov, ICSI, October 2002.\n *\n * MROUTING Revision: 3.3.1.3\n * and PIM-SMv2 and PIM-DM support, advanced API support,\n * bandwidth metering and signaling.\n */\n\n/*\n * Multicast Routing set/getsockopt commands.\n */\n#define\tMRT_INIT\t100\t/* initialize forwarder */\n#define\tMRT_DONE\t101\t/* shut down forwarder */\n#define\tMRT_ADD_VIF\t102\t/* create virtual interface */\n#define\tMRT_DEL_VIF\t103\t/* delete virtual interface */\n#define MRT_ADD_MFC\t104\t/* insert forwarding cache entry */\n#define MRT_DEL_MFC\t105\t/* delete forwarding cache entry */\n#define MRT_VERSION\t106\t/* get kernel version number */\n#define MRT_ASSERT      107     /* enable assert processing */\n#define MRT_PIM\t\tMRT_ASSERT /* enable PIM processing */\n#define MRT_API_SUPPORT\t109\t/* supported MRT API */\n#define MRT_API_CONFIG\t110\t/* config MRT API */\n#define MRT_ADD_BW_UPCALL 111\t/* create bandwidth monitor */\n#define MRT_DEL_BW_UPCALL 112\t/* delete bandwidth monitor */\n\n/*\n * Types and macros for handling bitmaps with one bit per virtual interface.\n */\n#define\tMAXVIFS 32\ntypedef u_long vifbitmap_t;\ntypedef u_short vifi_t;\t\t/* type of a vif index */\n#define ALL_VIFS (vifi_t)-1\n\n#define\tVIFM_SET(n, m)\t\t((m) |= (1 << (n)))\n#define\tVIFM_CLR(n, m)\t\t((m) &= ~(1 << (n)))\n#define\tVIFM_ISSET(n, m)\t((m) & (1 << (n)))\n#define\tVIFM_CLRALL(m)\t\t((m) = 0x00000000)\n#define\tVIFM_COPY(mfrom, mto)\t((mto) = (mfrom))\n#define\tVIFM_SAME(m1, m2)\t((m1) == (m2))\n\nstruct mfc;\n\n/*\n * Argument structure for MRT_ADD_VIF.\n * (MRT_DEL_VIF takes a single vifi_t argument.)\n */\nstruct vifctl {\n\tvifi_t\tvifc_vifi;\t\t/* the index of the vif to be added */\n\tu_char\tvifc_flags;\t\t/* VIFF_ flags defined below */\n\tu_char\tvifc_threshold;\t\t/* min ttl required to forward on vif */\n\tu_int\tvifc_rate_limit;\t/* max rate */\n\tstruct\tin_addr vifc_lcl_addr;\t/* local interface address */\n\tstruct\tin_addr vifc_rmt_addr;\t/* remote address (tunnels only) */\n};\n\n#define\tVIFF_TUNNEL\t0x1\t\t/* no-op; retained for old source */\n#define VIFF_SRCRT\t0x2\t\t/* no-op; retained for old source */\n#define VIFF_REGISTER\t0x4\t\t/* used for PIM Register encap/decap */\n\n/*\n * Argument structure for MRT_ADD_MFC and MRT_DEL_MFC\n * XXX if you change this, make sure to change struct mfcctl2 as well.\n */\nstruct mfcctl {\n    struct in_addr  mfcc_origin;\t\t/* ip origin of mcasts       */\n    struct in_addr  mfcc_mcastgrp;\t\t/* multicast group associated*/\n    vifi_t\t    mfcc_parent;\t\t/* incoming vif              */\n    u_char\t    mfcc_ttls[MAXVIFS];\t\t/* forwarding ttls on vifs   */\n};\n\n/*\n * The new argument structure for MRT_ADD_MFC and MRT_DEL_MFC overlays\n * and extends the old struct mfcctl.\n */\nstruct mfcctl2 {\n\t/* the mfcctl fields */\n\tstruct in_addr\tmfcc_origin;\t\t/* ip origin of mcasts\t     */\n\tstruct in_addr\tmfcc_mcastgrp;\t\t/* multicast group associated*/\n\tvifi_t\t\tmfcc_parent;\t\t/* incoming vif\t\t     */\n\tu_char\t\tmfcc_ttls[MAXVIFS];\t/* forwarding ttls on vifs   */\n\n\t/* extension fields */\n\tuint8_t\t\tmfcc_flags[MAXVIFS];\t/* the MRT_MFC_FLAGS_* flags */\n\tstruct in_addr\tmfcc_rp;\t\t/* the RP address            */\n};\n/*\n * The advanced-API flags.\n *\n * The MRT_MFC_FLAGS_XXX API flags are also used as flags\n * for the mfcc_flags field.\n */\n#define\tMRT_MFC_FLAGS_DISABLE_WRONGVIF\t(1 << 0) /* disable WRONGVIF signals */\n#define\tMRT_MFC_FLAGS_BORDER_VIF\t(1 << 1) /* border vif\t\t     */\n#define MRT_MFC_RP\t\t\t(1 << 8) /* enable RP address\t     */\n#define MRT_MFC_BW_UPCALL\t\t(1 << 9) /* enable bw upcalls\t     */\n#define MRT_MFC_FLAGS_ALL\t\t(MRT_MFC_FLAGS_DISABLE_WRONGVIF |    \\\n\t\t\t\t\t MRT_MFC_FLAGS_BORDER_VIF)\n#define MRT_API_FLAGS_ALL\t\t(MRT_MFC_FLAGS_ALL |\t\t     \\\n\t\t\t\t\t MRT_MFC_RP |\t\t\t     \\\n\t\t\t\t\t MRT_MFC_BW_UPCALL)\n\n/*\n * Structure for installing or delivering an upcall if the\n * measured bandwidth is above or below a threshold.\n *\n * User programs (e.g. daemons) may have a need to know when the\n * bandwidth used by some data flow is above or below some threshold.\n * This interface allows the userland to specify the threshold (in\n * bytes and/or packets) and the measurement interval. Flows are\n * all packet with the same source and destination IP address.\n * At the moment the code is only used for multicast destinations\n * but there is nothing that prevents its use for unicast.\n *\n * The measurement interval cannot be shorter than some Tmin (currently, 3s).\n * The threshold is set in packets and/or bytes per_interval.\n *\n * Measurement works as follows:\n *\n * For >= measurements:\n * The first packet marks the start of a measurement interval.\n * During an interval we count packets and bytes, and when we\n * pass the threshold we deliver an upcall and we are done.\n * The first packet after the end of the interval resets the\n * count and restarts the measurement.\n *\n * For <= measurement:\n * We start a timer to fire at the end of the interval, and\n * then for each incoming packet we count packets and bytes.\n * When the timer fires, we compare the value with the threshold,\n * schedule an upcall if we are below, and restart the measurement\n * (reschedule timer and zero counters).\n */\n\nstruct bw_data {\n\tstruct timeval\tb_time;\n\tuint64_t\tb_packets;\n\tuint64_t\tb_bytes;\n};\n\nstruct bw_upcall {\n\tstruct in_addr\tbu_src;\t\t\t/* source address            */\n\tstruct in_addr\tbu_dst;\t\t\t/* destination address       */\n\tuint32_t\tbu_flags;\t\t/* misc flags (see below)    */\n#define BW_UPCALL_UNIT_PACKETS   (1 << 0)\t/* threshold (in packets)    */\n#define BW_UPCALL_UNIT_BYTES     (1 << 1)\t/* threshold (in bytes)      */\n#define BW_UPCALL_GEQ            (1 << 2)\t/* upcall if bw >= threshold */\n#define BW_UPCALL_LEQ            (1 << 3)\t/* upcall if bw <= threshold */\n#define BW_UPCALL_DELETE_ALL     (1 << 4)\t/* delete all upcalls for s,d*/\n\tstruct bw_data\tbu_threshold;\t\t/* the bw threshold\t     */\n\tstruct bw_data\tbu_measured;\t\t/* the measured bw\t     */\n};\n\n/* max. number of upcalls to deliver together */\n#define BW_UPCALLS_MAX\t\t\t\t128\n/* min. threshold time interval for bandwidth measurement */\n#define BW_UPCALL_THRESHOLD_INTERVAL_MIN_SEC\t3\n#define BW_UPCALL_THRESHOLD_INTERVAL_MIN_USEC\t0\n\n/*\n * The kernel's multicast routing statistics.\n */\nstruct mrtstat {\n    u_long\tmrts_mfc_lookups;\t/* # forw. cache hash table hits   */\n    u_long\tmrts_mfc_misses;\t/* # forw. cache hash table misses */\n    u_long\tmrts_upcalls;\t\t/* # calls to multicast routing daemon */\n    u_long\tmrts_no_route;\t\t/* no route for packet's origin    */\n    u_long\tmrts_bad_tunnel;\t/* malformed tunnel options        */\n    u_long\tmrts_cant_tunnel;\t/* no room for tunnel options      */\n    u_long\tmrts_wrong_if;\t\t/* arrived on wrong interface\t   */\n    u_long\tmrts_upq_ovflw;\t\t/* upcall Q overflow\t\t   */\n    u_long\tmrts_cache_cleanups;\t/* # entries with no upcalls\t   */\n    u_long\tmrts_drop_sel;\t\t/* pkts dropped selectively        */\n    u_long\tmrts_q_overflow;\t/* pkts dropped - Q overflow       */\n    u_long\tmrts_pkt2large;\t\t/* pkts dropped - size > BKT SIZE  */\n    u_long\tmrts_upq_sockfull;\t/* upcalls dropped - socket full */\n};\n\n#ifdef _KERNEL\n#define\tMRTSTAT_ADD(name, val)\tV_mrtstat.name += (val)\n#define\tMRTSTAT_INC(name)\tMRTSTAT_ADD(name, 1)\n#endif\n\n/*\n * Argument structure used by mrouted to get src-grp pkt counts\n */\nstruct sioc_sg_req {\n    struct in_addr src;\n    struct in_addr grp;\n    u_long pktcnt;\n    u_long bytecnt;\n    u_long wrong_if;\n};\n\n/*\n * Argument structure used by mrouted to get vif pkt counts\n */\nstruct sioc_vif_req {\n    vifi_t vifi;\t\t/* vif number\t\t\t\t*/\n    u_long icount;\t\t/* Input packet count on vif\t\t*/\n    u_long ocount;\t\t/* Output packet count on vif\t\t*/\n    u_long ibytes;\t\t/* Input byte count on vif\t\t*/\n    u_long obytes;\t\t/* Output byte count on vif\t\t*/\n};\n\n\n/*\n * The kernel's virtual-interface structure.\n */\nstruct vif {\n    u_char\t\tv_flags;\t/* VIFF_ flags defined above         */\n    u_char\t\tv_threshold;\t/* min ttl required to forward on vif*/\n    struct in_addr\tv_lcl_addr;\t/* local interface address           */\n    struct in_addr\tv_rmt_addr;\t/* remote address (tunnels only)     */\n    struct ifnet       *v_ifp;\t\t/* pointer to interface              */\n    u_long\t\tv_pkt_in;\t/* # pkts in on interface            */\n    u_long\t\tv_pkt_out;\t/* # pkts out on interface           */\n    u_long\t\tv_bytes_in;\t/* # bytes in on interface\t     */\n    u_long\t\tv_bytes_out;\t/* # bytes out on interface\t     */\n    struct route\tv_route;\t/* cached route */\n};\n\n#ifdef _KERNEL\n/*\n * The kernel's multicast forwarding cache entry structure\n */\nstruct mfc {\n\tLIST_ENTRY(mfc)\tmfc_hash;\n\tstruct in_addr\tmfc_origin;\t\t/* IP origin of mcasts\t     */\n\tstruct in_addr  mfc_mcastgrp;\t\t/* multicast group associated*/\n\tvifi_t\t\tmfc_parent;\t\t/* incoming vif              */\n\tu_char\t\tmfc_ttls[MAXVIFS];\t/* forwarding ttls on vifs   */\n\tu_long\t\tmfc_pkt_cnt;\t\t/* pkt count for src-grp     */\n\tu_long\t\tmfc_byte_cnt;\t\t/* byte count for src-grp    */\n\tu_long\t\tmfc_wrong_if;\t\t/* wrong if for src-grp\t     */\n\tint\t\tmfc_expire;\t\t/* time to clean entry up    */\n\tstruct timeval\tmfc_last_assert;\t/* last time I sent an assert*/\n\tuint8_t\t\tmfc_flags[MAXVIFS];\t/* the MRT_MFC_FLAGS_* flags */\n\tstruct in_addr\tmfc_rp;\t\t\t/* the RP address\t     */\n\tstruct bw_meter\t*mfc_bw_meter;\t\t/* list of bandwidth meters  */\n\tu_long\t\tmfc_nstall;\t\t/* # of packets awaiting mfc */\n\tTAILQ_HEAD(, rtdetq) mfc_stall;\t\t/* q of packets awaiting mfc */\n};\n#endif /* _KERNEL */\n\n/*\n * Struct used to communicate from kernel to multicast router\n * note the convenient similarity to an IP packet\n */\nstruct igmpmsg {\n    uint32_t\t    unused1;\n    uint32_t\t    unused2;\n    u_char\t    im_msgtype;\t\t\t/* what type of message\t    */\n#define IGMPMSG_NOCACHE\t\t1\t/* no MFC in the kernel\t\t    */\n#define IGMPMSG_WRONGVIF\t2\t/* packet came from wrong interface */\n#define\tIGMPMSG_WHOLEPKT\t3\t/* PIM pkt for user level encap.    */\n#define\tIGMPMSG_BW_UPCALL\t4\t/* BW monitoring upcall\t\t    */\n    u_char\t    im_mbz;\t\t\t/* must be zero\t\t    */\n    u_char\t    im_vif;\t\t\t/* vif rec'd on\t\t    */\n    u_char\t    unused3;\n    struct in_addr  im_src, im_dst;\n};\n\n#ifdef _KERNEL\n/*\n * Argument structure used for pkt info. while upcall is made\n */\nstruct rtdetq {\n    TAILQ_ENTRY(rtdetq)\trte_link;\n    struct mbuf\t\t*m;\t\t/* A copy of the packet\t\t    */\n    struct ifnet\t*ifp;\t\t/* Interface pkt came in on\t    */\n    vifi_t\t\txmt_vif;\t/* Saved copy of imo_multicast_vif  */\n};\n#define MAX_UPQ\t4\t\t/* max. no of pkts in upcall Q */\n#endif /* _KERNEL */\n\n/*\n * Structure for measuring the bandwidth and sending an upcall if the\n * measured bandwidth is above or below a threshold.\n */\nstruct bw_meter {\n\tstruct bw_meter\t*bm_mfc_next;\t\t/* next bw meter (same mfc)  */\n\tstruct bw_meter\t*bm_time_next;\t\t/* next bw meter (same time) */\n\tuint32_t\tbm_time_hash;\t\t/* the time hash value       */\n\tstruct mfc\t*bm_mfc;\t\t/* the corresponding mfc     */\n\tuint32_t\tbm_flags;\t\t/* misc flags (see below)    */\n#define BW_METER_UNIT_PACKETS\t(1 << 0)\t/* threshold (in packets)    */\n#define BW_METER_UNIT_BYTES\t(1 << 1)\t/* threshold (in bytes)      */\n#define BW_METER_GEQ\t\t(1 << 2)\t/* upcall if bw >= threshold */\n#define BW_METER_LEQ\t\t(1 << 3)\t/* upcall if bw <= threshold */\n#define BW_METER_USER_FLAGS\t(BW_METER_UNIT_PACKETS |\t\t\\\n\t\t\t\t BW_METER_UNIT_BYTES |\t\t\t\\\n\t\t\t\t BW_METER_GEQ |\t\t\t\t\\\n\t\t\t\t BW_METER_LEQ)\n\n#define BW_METER_UPCALL_DELIVERED (1 << 24)\t/* upcall was delivered      */\n\n\tstruct bw_data\tbm_threshold;\t\t/* the upcall threshold\t     */\n\tstruct bw_data\tbm_measured;\t\t/* the measured bw\t     */\n\tstruct timeval\tbm_start_time;\t\t/* abs. time\t\t     */\n};\n\n#ifdef _KERNEL\n\nstruct sockopt;\n\nextern int\t(*ip_mrouter_set)(struct socket *, struct sockopt *);\nextern int\t(*ip_mrouter_get)(struct socket *, struct sockopt *);\nextern int\t(*ip_mrouter_done)(void);\nextern int\t(*mrt_ioctl)(u_long, caddr_t, int);\n\n#endif /* _KERNEL */\n\n#endif /* _NETINET_IP_MROUTE_H_ */\n"
  },
  {
    "path": "freebsd-headers/netinet/ip_nat.h",
    "content": "/*\t$FreeBSD: release/9.0.0/sys/contrib/ipfilter/netinet/ip_nat.h 180778 2008-07-24 12:35:05Z darrenr $\t*/\n\n/*\n * Copyright (C) 1995-2001, 2003 by Darren Reed.\n *\n * See the IPFILTER.LICENCE file for details on licencing.\n *\n * @(#)ip_nat.h\t1.5 2/4/96\n * $FreeBSD: release/9.0.0/sys/contrib/ipfilter/netinet/ip_nat.h 180778 2008-07-24 12:35:05Z darrenr $\n * Id: ip_nat.h,v 2.90.2.20 2007/09/25 08:27:32 darrenr Exp $\n */\n\n#ifndef\t__IP_NAT_H__\n#define\t__IP_NAT_H__\n\n#ifndef SOLARIS\n#define\tSOLARIS\t(defined(sun) && (defined(__svr4__) || defined(__SVR4)))\n#endif\n\n#if defined(__STDC__) || defined(__GNUC__) || defined(_AIX51)\n#define\tSIOCADNAT\t_IOW('r', 60, struct ipfobj)\n#define\tSIOCRMNAT\t_IOW('r', 61, struct ipfobj)\n#define\tSIOCGNATS\t_IOWR('r', 62, struct ipfobj)\n#define\tSIOCGNATL\t_IOWR('r', 63, struct ipfobj)\n#else\n#define\tSIOCADNAT\t_IOW(r, 60, struct ipfobj)\n#define\tSIOCRMNAT\t_IOW(r, 61, struct ipfobj)\n#define\tSIOCGNATS\t_IOWR(r, 62, struct ipfobj)\n#define\tSIOCGNATL\t_IOWR(r, 63, struct ipfobj)\n#endif\n\n#undef\tLARGE_NAT\t/* define\tthis if you're setting up a system to NAT\n\t\t\t * LARGE numbers of networks/hosts - i.e. in the\n\t\t\t * hundreds or thousands.  In such a case, you should\n\t\t\t * also change the RDR_SIZE and NAT_SIZE below to more\n\t\t\t * appropriate sizes.  The figures below were used for\n\t\t\t * a setup with 1000-2000 networks to NAT.\n\t\t\t */\n#ifndef NAT_SIZE\n# ifdef LARGE_NAT\n#  define\tNAT_SIZE\t2047\n# else\n#  define\tNAT_SIZE\t127\n# endif\n#endif\n#ifndef RDR_SIZE\n# ifdef LARGE_NAT\n#  define\tRDR_SIZE\t2047\n# else\n#  define\tRDR_SIZE\t127\n# endif\n#endif\n#ifndef HOSTMAP_SIZE\n# ifdef LARGE_NAT\n#  define\tHOSTMAP_SIZE\t8191\n# else\n#  define\tHOSTMAP_SIZE\t2047\n# endif\n#endif\n#ifndef NAT_TABLE_MAX\n/*\n * This is newly introduced and for the sake of \"least surprise\", the numbers\n * present aren't what we'd normally use for creating a proper hash table.\n */\n# ifdef\tLARGE_NAT\n#  define\tNAT_TABLE_MAX\t180000\n# else\n#  define\tNAT_TABLE_MAX\t30000\n# endif\n#endif\n#ifndef NAT_TABLE_SZ\n# ifdef LARGE_NAT\n#  define\tNAT_TABLE_SZ\t16383\n# else\n#  define\tNAT_TABLE_SZ\t2047\n# endif\n#endif\n#ifndef\tAPR_LABELLEN\n#define\tAPR_LABELLEN\t16\n#endif\n#define\tNAT_HW_CKSUM\t0x80000000\n\n#define\tDEF_NAT_AGE\t1200     /* 10 minutes (600 seconds) */\n\nstruct ipstate;\nstruct ap_session;\n\ntypedef\tstruct\tnat\t{\n\tipfmutex_t\tnat_lock;\n\tstruct\tnat\t*nat_next;\n\tstruct\tnat\t**nat_pnext;\n\tstruct\tnat\t*nat_hnext[2];\n\tstruct\tnat\t**nat_phnext[2];\n\tstruct\thostmap\t*nat_hm;\n\tvoid\t\t*nat_data;\n\tstruct\tnat\t**nat_me;\n\tstruct\tipstate\t*nat_state;\n\tstruct\tap_session\t*nat_aps;\t\t/* proxy session */\n\tfrentry_t\t*nat_fr;\t/* filter rule ptr if appropriate */\n\tstruct\tipnat\t*nat_ptr;\t/* pointer back to the rule */\n\tvoid\t\t*nat_ifps[2];\n\tvoid\t\t*nat_sync;\n\tipftqent_t\tnat_tqe;\n\tu_32_t\t\tnat_flags;\n\tu_32_t\t\tnat_sumd[2];\t/* ip checksum delta for data segment*/\n\tu_32_t\t\tnat_ipsumd;\t/* ip checksum delta for ip header */\n\tu_32_t\t\tnat_mssclamp;\t/* if != zero clamp MSS to this */\n\ti6addr_t\tnat_inip6;\n\ti6addr_t\tnat_outip6;\n\ti6addr_t\tnat_oip6;\t\t/* other ip */\n\tU_QUAD_T\tnat_pkts[2];\n\tU_QUAD_T\tnat_bytes[2];\n\tunion\t{\n\t\tudpinfo_t\tnat_unu;\n\t\ttcpinfo_t\tnat_unt;\n\t\ticmpinfo_t\tnat_uni;\n\t\tgreinfo_t\tnat_ugre;\n\t} nat_un;\n\tu_short\t\tnat_oport;\t\t/* other port */\n\tu_short\t\tnat_use;\n\tu_char\t\tnat_p;\t\t\t/* protocol for NAT */\n\tint\t\tnat_dir;\n\tint\t\tnat_ref;\t\t/* reference count */\n\tint\t\tnat_hv[2];\n\tchar\t\tnat_ifnames[2][LIFNAMSIZ];\n\tint\t\tnat_rev;\t\t/* 0 = forward, 1 = reverse */\n\tint\t\tnat_redir;\t\t/* copy of in_redir */\n\tu_32_t\t\tnat_seqnext[2];\n} nat_t;\n\n#define\tnat_inip\tnat_inip6.in4\n#define\tnat_outip\tnat_outip6.in4\n#define\tnat_oip\t\tnat_oip6.in4\n#define\tnat_age\t\tnat_tqe.tqe_die\n#define\tnat_inport\tnat_un.nat_unt.ts_sport\n#define\tnat_outport\tnat_un.nat_unt.ts_dport\n#define\tnat_type\tnat_un.nat_uni.ici_type\n#define\tnat_seq\t\tnat_un.nat_uni.ici_seq\n#define\tnat_id\t\tnat_un.nat_uni.ici_id\n#define\tnat_tcpstate\tnat_tqe.tqe_state\n#define\tnat_die\t\tnat_tqe.tqe_die\n#define\tnat_touched\tnat_tqe.tqe_touched\n\n/*\n * Values for nat_dir\n */\n#define\tNAT_INBOUND\t0\n#define\tNAT_OUTBOUND\t1\n\n/*\n * Definitions for nat_flags\n */\n#define\tNAT_TCP\t\t0x0001\t/* IPN_TCP */\n#define\tNAT_UDP\t\t0x0002\t/* IPN_UDP */\n#define\tNAT_ICMPERR\t0x0004\t/* IPN_ICMPERR */\n#define\tNAT_ICMPQUERY\t0x0008\t/* IPN_ICMPQUERY */\n#define\tNAT_SEARCH\t0x0010\n#define\tNAT_SLAVE\t0x0020\t/* Slave connection for a proxy */\n#define\tNAT_NOTRULEPORT\t0x0040\t/* Don't use the port # in the NAT rule */\n\n#define\tNAT_TCPUDP\t(NAT_TCP|NAT_UDP)\n#define\tNAT_TCPUDPICMP\t(NAT_TCP|NAT_UDP|NAT_ICMPERR)\n#define\tNAT_TCPUDPICMPQ\t(NAT_TCP|NAT_UDP|NAT_ICMPQUERY)\n#define\tNAT_FROMRULE\t(NAT_TCP|NAT_UDP)\n\n/* 0x0100 reserved for FI_W_SPORT */\n/* 0x0200 reserved for FI_W_DPORT */\n/* 0x0400 reserved for FI_W_SADDR */\n/* 0x0800 reserved for FI_W_DADDR */\n/* 0x1000 reserved for FI_W_NEWFR */\n/* 0x2000 reserved for SI_CLONE */\n/* 0x4000 reserved for SI_CLONED */\n/* 0x8000 reserved for SI_IGNOREPKT */\n\n#define\tNAT_DEBUG\t0x800000\n\ntypedef\tstruct\tipnat\t{\n\tipfmutex_t\tin_lock;\n\tstruct\tipnat\t*in_next;\t\t/* NAT rule list next */\n\tstruct\tipnat\t*in_rnext;\t\t/* rdr rule hash next */\n\tstruct\tipnat\t**in_prnext;\t\t/* prior rdr next ptr */\n\tstruct\tipnat\t*in_mnext;\t\t/* map rule hash next */\n\tstruct\tipnat\t**in_pmnext;\t\t/* prior map next ptr */\n\tstruct\tipftq\t*in_tqehead[2];\n\tvoid\t\t*in_ifps[2];\n\tvoid\t\t*in_apr;\n\tchar\t\t*in_comment;\n\ti6addr_t\tin_next6;\n\tu_long\t\tin_space;\n\tu_long\t\tin_hits;\n\tu_int\t\tin_use;\n\tu_int\t\tin_hv;\n\tint\t\tin_flineno;\t\t/* conf. file line number */\n\tu_short\t\tin_pnext;\n\tu_char\t\tin_v;\n\tu_char\t\tin_xxx;\n\t/* From here to the end is covered by IPN_CMPSIZ */\n\tu_32_t\t\tin_flags;\n\tu_32_t\t\tin_mssclamp;\t\t/* if != 0 clamp MSS to this */\n\tu_int\t\tin_age[2];\n\tint\t\tin_redir;\t\t/* see below for values */\n\tint\t\tin_p;\t\t\t/* protocol. */\n\ti6addr_t\tin_in[2];\n\ti6addr_t\tin_out[2];\n\ti6addr_t\tin_src[2];\n\tfrtuc_t\t\tin_tuc;\n\tu_short\t\tin_port[2];\n\tu_short\t\tin_ppip;\t\t/* ports per IP. */\n\tu_short\t\tin_ippip;\t\t/* IP #'s per IP# */\n\tchar\t\tin_ifnames[2][LIFNAMSIZ];\n\tchar\t\tin_plabel[APR_LABELLEN];\t/* proxy label. */\n\tipftag_t\tin_tag;\n} ipnat_t;\n\n#define\tin_pmin\t\tin_port[0]\t/* Also holds static redir port */\n#define\tin_pmax\t\tin_port[1]\n#define\tin_nextip\tin_next6.in4\n#define\tin_nip\t\tin_next6.in4.s_addr\n#define\tin_inip\t\tin_in[0].in4.s_addr\n#define\tin_inmsk\tin_in[1].in4.s_addr\n#define\tin_outip\tin_out[0].in4.s_addr\n#define\tin_outmsk\tin_out[1].in4.s_addr\n#define\tin_srcip\tin_src[0].in4.s_addr\n#define\tin_srcmsk\tin_src[1].in4.s_addr\n#define\tin_scmp\t\tin_tuc.ftu_scmp\n#define\tin_dcmp\t\tin_tuc.ftu_dcmp\n#define\tin_stop\t\tin_tuc.ftu_stop\n#define\tin_dtop\t\tin_tuc.ftu_dtop\n#define\tin_sport\tin_tuc.ftu_sport\n#define\tin_dport\tin_tuc.ftu_dport\n\n/*\n * Bit definitions for in_flags\n */\n#define\tIPN_ANY\t\t0x00000\n#define\tIPN_TCP\t\t0x00001\n#define\tIPN_UDP\t\t0x00002\n#define\tIPN_TCPUDP\t(IPN_TCP|IPN_UDP)\n#define\tIPN_ICMPERR\t0x00004\n#define\tIPN_TCPUDPICMP\t(IPN_TCP|IPN_UDP|IPN_ICMPERR)\n#define\tIPN_ICMPQUERY\t0x00008\n#define\tIPN_TCPUDPICMPQ\t(IPN_TCP|IPN_UDP|IPN_ICMPQUERY)\n#define\tIPN_RF\t\t(IPN_TCPUDP|IPN_DELETE|IPN_ICMPERR)\n#define\tIPN_AUTOPORTMAP\t0x00010\n#define\tIPN_IPRANGE\t0x00020\n#define\tIPN_FILTER\t0x00040\n#define\tIPN_SPLIT\t0x00080\n#define\tIPN_ROUNDR\t0x00100\n#define\tIPN_NOTSRC\t0x04000\n#define\tIPN_NOTDST\t0x08000\n#define\tIPN_DYNSRCIP\t0x10000\t/* dynamic src IP# */\n#define\tIPN_DYNDSTIP\t0x20000\t/* dynamic dst IP# */\n#define\tIPN_DELETE\t0x40000\n#define\tIPN_STICKY\t0x80000\n#define\tIPN_FRAG\t0x100000\n#define\tIPN_FIXEDDPORT\t0x200000\n#define\tIPN_FINDFORWARD\t0x400000\n#define\tIPN_IN\t\t0x800000\n#define\tIPN_SEQUENTIAL\t0x1000000\n#define\tIPN_USERFLAGS\t(IPN_TCPUDP|IPN_AUTOPORTMAP|IPN_IPRANGE|IPN_SPLIT|\\\n\t\t\t IPN_ROUNDR|IPN_FILTER|IPN_NOTSRC|IPN_NOTDST|\\\n\t\t\t IPN_FRAG|IPN_STICKY|IPN_FIXEDDPORT|IPN_ICMPQUERY|\\\n\t\t\t IPN_SEQUENTIAL)\n\n/*\n * Values for in_redir\n */\n#define\tNAT_MAP\t\t0x01\n#define\tNAT_REDIRECT\t0x02\n#define\tNAT_BIMAP\t(NAT_MAP|NAT_REDIRECT)\n#define\tNAT_MAPBLK\t0x04\n\n#define\tMAPBLK_MINPORT\t1024\t/* don't use reserved ports for src port */\n#define\tUSABLE_PORTS\t(65536 - MAPBLK_MINPORT)\n\n#define\tIPN_CMPSIZ\t(sizeof(ipnat_t) - offsetof(ipnat_t, in_flags))\n\ntypedef\tstruct\tnatlookup {\n\tstruct\tin_addr\tnl_inip;\n\tstruct\tin_addr\tnl_outip;\n\tstruct\tin_addr\tnl_realip;\n\tint\tnl_flags;\n\tu_short\tnl_inport;\n\tu_short\tnl_outport;\n\tu_short\tnl_realport;\n} natlookup_t;\n\n\ntypedef struct  nat_save    {\n\tvoid\t*ipn_next;\n\tstruct\tnat\tipn_nat;\n\tstruct\tipnat\tipn_ipnat;\n\tstruct\tfrentry ipn_fr;\n\tint\tipn_dsize;\n\tchar\tipn_data[4];\n} nat_save_t;\n\n#define\tipn_rule\tipn_nat.nat_fr\n\ntypedef\tstruct\tnatget\t{\n\tvoid\t*ng_ptr;\n\tint\tng_sz;\n} natget_t;\n\n\n/*\n * This structure gets used to help NAT sessions keep the same NAT rule (and\n * thus translation for IP address) when:\n * (a) round-robin redirects are in use\n * (b) different IP add\n */\ntypedef\tstruct\thostmap\t{\n\tstruct\thostmap\t*hm_hnext;\n\tstruct\thostmap\t**hm_phnext;\n\tstruct\thostmap\t*hm_next;\n\tstruct\thostmap\t**hm_pnext;\n\tstruct\tipnat\t*hm_ipnat;\n\tstruct\tin_addr\thm_srcip;\n\tstruct\tin_addr\thm_dstip;\n\tstruct\tin_addr\thm_mapip;\n\tu_32_t\t\thm_port;\n\tint\t\thm_ref;\n} hostmap_t;\n\n\n/*\n * Structure used to pass information in to nat_newmap and nat_newrdr.\n */\ntypedef struct\tnatinfo\t{\n\tipnat_t\t\t*nai_np;\n\tu_32_t\t\tnai_sum1;\n\tu_32_t\t\tnai_sum2;\n\tu_32_t\t\tnai_nflags;\n\tu_32_t\t\tnai_flags;\n\tstruct\tin_addr\tnai_ip;\n\tu_short\t\tnai_port;\n\tu_short\t\tnai_nport;\n\tu_short\t\tnai_sport;\n\tu_short\t\tnai_dport;\n} natinfo_t;\n\n\ntypedef\tstruct\tnatstat\t{\n\tu_long\tns_mapped[2];\n\tu_long\tns_rules;\n\tu_long\tns_added;\n\tu_long\tns_expire;\n\tu_long\tns_inuse;\n\tu_long\tns_logged;\n\tu_long\tns_logfail;\n\tu_long\tns_memfail;\n\tu_long\tns_badnat;\n\tu_long\tns_addtrpnt;\n\tnat_t\t**ns_table[2];\n\thostmap_t **ns_maptable;\n\tipnat_t\t*ns_list;\n\tvoid\t*ns_apslist;\n\tu_int\tns_wilds;\n\tu_int\tns_nattab_sz;\n\tu_int\tns_nattab_max;\n\tu_int\tns_rultab_sz;\n\tu_int\tns_rdrtab_sz;\n\tu_int\tns_trpntab_sz;\n\tu_int\tns_hostmap_sz;\n\tnat_t\t*ns_instances;\n\thostmap_t *ns_maplist;\n\tu_long\t*ns_bucketlen[2];\n\tu_long\tns_ticks;\n\tu_int\tns_orphans;\n} natstat_t;\n\ntypedef\tstruct\tnatlog {\n\tstruct\tin_addr\tnl_origip;\n\tstruct\tin_addr\tnl_outip;\n\tstruct\tin_addr\tnl_inip;\n\tu_short\tnl_origport;\n\tu_short\tnl_outport;\n\tu_short\tnl_inport;\n\tu_short\tnl_type;\n\tint\tnl_rule;\n\tU_QUAD_T\tnl_pkts[2];\n\tU_QUAD_T\tnl_bytes[2];\n\tu_char\tnl_p;\n} natlog_t;\n\n\n#define\tNL_NEWMAP\tNAT_MAP\n#define\tNL_NEWRDR\tNAT_REDIRECT\n#define\tNL_NEWBIMAP\tNAT_BIMAP\n#define\tNL_NEWBLOCK\tNAT_MAPBLK\n#define\tNL_DESTROY\t0xfffc\n#define\tNL_CLONE\t0xfffd\n#define\tNL_FLUSH\t0xfffe\n#define\tNL_EXPIRE\t0xffff\n\n#define\tNAT_HASH_FN(k,l,m)\t(((k) + ((k) >> 12) + l) % (m))\n\n#define\tLONG_SUM(in)\t(((in) & 0xffff) + ((in) >> 16))\n\n#define\tCALC_SUMD(s1, s2, sd) { \\\n\t\t\t    (s1) = ((s1) & 0xffff) + ((s1) >> 16); \\\n\t\t\t    (s2) = ((s2) & 0xffff) + ((s2) >> 16); \\\n\t\t\t    /* Do it twice */ \\\n\t\t\t    (s1) = ((s1) & 0xffff) + ((s1) >> 16); \\\n\t\t\t    (s2) = ((s2) & 0xffff) + ((s2) >> 16); \\\n\t\t\t    /* Because ~1 == -2, We really need ~1 == -1 */ \\\n\t\t\t    if ((s1) > (s2)) (s2)--; \\\n\t\t\t    (sd) = (s2) - (s1); \\\n\t\t\t    (sd) = ((sd) & 0xffff) + ((sd) >> 16); }\n\n#define\tNAT_SYSSPACE\t\t0x80000000\n#define\tNAT_LOCKHELD\t\t0x40000000\n\n\nextern\tu_int\tipf_nattable_sz;\nextern\tu_int\tipf_nattable_max;\nextern\tu_int\tipf_natrules_sz;\nextern\tu_int\tipf_rdrrules_sz;\nextern\tu_int\tipf_hostmap_sz;\nextern\tu_int\tfr_nat_maxbucket;\nextern\tu_int\tfr_nat_maxbucket_reset;\nextern\tint\tfr_nat_lock;\nextern\tint\tfr_nat_doflush;\nextern\tvoid\tfr_natsync __P((void *));\nextern\tu_long\tfr_defnatage;\nextern\tu_long\tfr_defnaticmpage;\nextern\tu_long\tfr_defnatipage;\n\t/* nat_table[0] -> hashed list sorted by inside (ip, port) */\n\t/* nat_table[1] -> hashed list sorted by outside (ip, port) */\nextern\tnat_t\t**nat_table[2];\nextern\tnat_t\t*nat_instances;\nextern\tipnat_t\t*nat_list;\nextern\tipnat_t\t**nat_rules;\nextern\tipnat_t\t**rdr_rules;\nextern\tipftq_t\t*nat_utqe;\nextern\tnatstat_t\tnat_stats;\n\n#if defined(__OpenBSD__)\nextern\tvoid\tnat_ifdetach __P((void *));\n#endif\nextern\tint\tfr_nat_ioctl __P((caddr_t, ioctlcmd_t, int, int, void *));\nextern\tint\tfr_natinit __P((void));\nextern\tnat_t\t*nat_new __P((fr_info_t *, ipnat_t *, nat_t **, u_int, int));\nextern\tnat_t\t*nat_outlookup __P((fr_info_t *, u_int, u_int, struct in_addr,\n\t\t\t\t struct in_addr));\nextern\tvoid\tfix_datacksum __P((u_short *, u_32_t));\nextern\tnat_t\t*nat_inlookup __P((fr_info_t *, u_int, u_int, struct in_addr,\n\t\t\t\tstruct in_addr));\nextern\tnat_t\t*nat_tnlookup __P((fr_info_t *, int));\nextern\tnat_t\t*nat_maplookup __P((void *, u_int, struct in_addr,\n\t\t\t\tstruct in_addr));\nextern\tnat_t\t*nat_lookupredir __P((natlookup_t *));\nextern\tnat_t\t*nat_icmperrorlookup __P((fr_info_t *, int));\nextern\tnat_t\t*nat_icmperror __P((fr_info_t *, u_int *, int));\nextern\tvoid\tnat_delete __P((struct nat *, int));\nextern\tint\tnat_insert __P((nat_t *, int));\n\nextern\tint\tfr_checknatout __P((fr_info_t *, u_32_t *));\nextern\tint\tfr_natout __P((fr_info_t *, nat_t *, int, u_32_t));\nextern\tint\tfr_checknatin __P((fr_info_t *, u_32_t *));\nextern\tint\tfr_natin __P((fr_info_t *, nat_t *, int, u_32_t));\nextern\tvoid\tfr_natunload __P((void));\nextern\tvoid\tfr_natexpire __P((void));\nextern\tvoid\tnat_log __P((struct nat *, u_int));\nextern\tvoid\tfix_incksum __P((fr_info_t *, u_short *, u_32_t));\nextern\tvoid\tfix_outcksum __P((fr_info_t *, u_short *, u_32_t));\nextern\tvoid\tfr_ipnatderef __P((ipnat_t **));\nextern\tvoid\tfr_natderef __P((nat_t **));\nextern\tu_short\t*nat_proto __P((fr_info_t *, nat_t *, u_int));\nextern\tvoid\tnat_update __P((fr_info_t *, nat_t *, ipnat_t *));\nextern\tvoid\tfr_setnatqueue __P((nat_t *, int));\nextern\tvoid\tfr_hostmapdel __P((hostmap_t **));\n\n#endif /* __IP_NAT_H__ */\n"
  },
  {
    "path": "freebsd-headers/netinet/ip_options.h",
    "content": "/*\n * Copyright (c) 1982, 1986, 1993\n *\tThe Regents of the University of California.\n * Copyright (c) 2005 Andre Oppermann, Internet Business Solutions AG.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 4. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/netinet/ip_options.h 189343 2009-03-04 02:51:22Z bms $\n */\n\n#ifndef _NETINET_IP_OPTIONS_H_\n#define\t_NETINET_IP_OPTIONS_H_\n\nstruct ipoptrt {\n        struct  in_addr dst;                    /* final destination */\n        char    nop;                            /* one NOP to align */\n        char    srcopt[IPOPT_OFFSET + 1];       /* OPTVAL, OLEN and OFFSET */\n        struct  in_addr route[MAX_IPOPTLEN/sizeof(struct in_addr)];\n};\n\nstruct ipopt_tag {\n\tstruct\tm_tag tag;\t\t\t/* m_tag */\n\tint\tip_nhops;\n\tstruct\tipoptrt ip_srcrt;\n};\n\nextern\tint\tip_doopts;\t\t/* process or ignore IP options */\n\nint\t\t ip_checkrouteralert(struct mbuf *);\nint\t\t ip_dooptions(struct mbuf *, int);\nstruct mbuf\t*ip_insertoptions(struct mbuf *, struct mbuf *, int *);\nint\t\t ip_optcopy(struct ip *, struct ip *);\nint\t\t ip_pcbopts(struct inpcb *, int, struct mbuf *);\nvoid\t\t ip_stripoptions(struct mbuf *, struct mbuf *);\nstruct mbuf\t*ip_srcroute(struct mbuf *);\n\n#endif /* !_NETINET_IP_OPTIONS_H_ */\n"
  },
  {
    "path": "freebsd-headers/netinet/ip_pool.h",
    "content": "/*\n * Copyright (C) 1993-2001, 2003 by Darren Reed.\n *\n * See the IPFILTER.LICENCE file for details on licencing.\n *\n * $Id: ip_pool.h,v 2.26.2.6 2007/10/10 09:51:43 darrenr Exp $\n */\n\n#ifndef\t__IP_POOL_H__\n#define\t__IP_POOL_H__\n\n#if defined(_KERNEL) && !defined(__osf__) && !defined(__hpux) && \\\n    !defined(linux) && !defined(sun) && !defined(AIX)\n# include <net/radix.h>\nextern void rn_freehead __P((struct radix_node_head *));\n# define FreeS(p, z)\t\tKFREES(p, z)\nextern int max_keylen;\n#else\n# if defined(__osf__) || defined(__hpux) || defined(sun)\n#  include \"radix_ipf_local.h\"\n#  define radix_mask ipf_radix_mask\n#  define radix_node ipf_radix_node\n#  define radix_node_head ipf_radix_node_head\n# else\n#  include \"radix_ipf.h\"\n# endif\n#endif\n#include \"netinet/ip_lookup.h\"\n\n#define\tIP_POOL_NOMATCH\t\t0\n#define\tIP_POOL_POSITIVE\t1\n\ntypedef\tstruct ip_pool_node {\n\tstruct\tradix_node\tipn_nodes[2];\n\taddrfamily_t\t\tipn_addr;\n\taddrfamily_t\t\tipn_mask;\n\tint\t\t\tipn_info;\n\tint\t\t\tipn_ref;\nchar\t\t\tipn_name[FR_GROUPLEN];\nu_long\t\t\tipn_hits;\n\tstruct ip_pool_node\t*ipn_next, **ipn_pnext;\n} ip_pool_node_t;\n\n\ntypedef\tstruct ip_pool_s {\n\tstruct ip_pool_s\t*ipo_next;\n\tstruct ip_pool_s\t**ipo_pnext;\n\tstruct radix_node_head\t*ipo_head;\n\tip_pool_node_t\t*ipo_list;\n\tu_long\t\tipo_hits;\n\tint\t\tipo_unit;\n\tint\t\tipo_flags;\n\tint\t\tipo_ref;\n\tchar\t\tipo_name[FR_GROUPLEN];\n} ip_pool_t;\n\n#define\tIPOOL_DELETE\t0x01\n#define\tIPOOL_ANON\t0x02\n\n\ntypedef\tstruct\tip_pool_stat\t{\n\tu_long\t\tipls_pools;\n\tu_long\t\tipls_tables;\n\tu_long\t\tipls_nodes;\n\tip_pool_t\t*ipls_list[IPL_LOGSIZE];\n} ip_pool_stat_t;\n\n\nextern\tip_pool_stat_t\tipoolstat;\nextern\tip_pool_t\t*ip_pool_list[IPL_LOGSIZE];\n\nextern\tint\tip_pool_search __P((void *, int, void *));\nextern\tint\tip_pool_init __P((void));\nextern\tvoid\tip_pool_fini __P((void));\nextern\tint\tip_pool_create __P((iplookupop_t *));\nextern\tint\tip_pool_insert __P((ip_pool_t *, i6addr_t *, i6addr_t *, int));\nextern\tint\tip_pool_remove __P((ip_pool_t *, ip_pool_node_t *));\nextern\tint\tip_pool_destroy __P((int, char *));\nextern\tvoid\tip_pool_free __P((ip_pool_t *));\nextern\tvoid\tip_pool_deref __P((ip_pool_t *));\nextern\tvoid\tip_pool_node_deref __P((ip_pool_node_t *));\nextern\tvoid\t*ip_pool_find __P((int, char *));\nextern\tip_pool_node_t *ip_pool_findeq __P((ip_pool_t *,\n\t\t\t\t\t  addrfamily_t *, addrfamily_t *));\nextern\tint\tip_pool_flush __P((iplookupflush_t *));\nextern\tint\tip_pool_statistics __P((iplookupop_t *));\nextern\tint\tip_pool_getnext __P((ipftoken_t *, ipflookupiter_t *));\nextern\tvoid\tip_pool_iterderef __P((u_int, int, void *));\n\n#endif /* __IP_POOL_H__ */\n"
  },
  {
    "path": "freebsd-headers/netinet/ip_proxy.h",
    "content": "/*\t$FreeBSD: release/9.0.0/sys/contrib/ipfilter/netinet/ip_proxy.h 170268 2007-06-04 02:54:36Z darrenr $\t*/\n\n/*\n * Copyright (C) 1997-2001 by Darren Reed.\n *\n * See the IPFILTER.LICENCE file for details on licencing.\n *\n * $FreeBSD: release/9.0.0/sys/contrib/ipfilter/netinet/ip_proxy.h 170268 2007-06-04 02:54:36Z darrenr $\n * Id: ip_proxy.h,v 2.31.2.2 2005/03/12 19:33:48 darrenr Exp\n */\n\n#ifndef\t__IP_PROXY_H__\n#define\t__IP_PROXY_H__\n\n#ifndef SOLARIS\n#define SOLARIS (defined(sun) && (defined(__svr4__) || defined(__SVR4)))\n#endif\n\n#if defined(__STDC__) || defined(__GNUC__) || defined(_AIX51)\n#define\tSIOCPROXY\t_IOWR('r', 64, struct ap_control)\n#else\n#define\tSIOCPROXY\t_IOWR(r, 64, struct ap_control)\n#endif\n\n#ifndef\tAPR_LABELLEN\n#define\tAPR_LABELLEN\t16\n#endif\n#define\tAP_SESS_SIZE\t53\n\nstruct\tnat;\nstruct\tipnat;\nstruct\tipstate;\n\ntypedef\tstruct\tap_tcp {\n\tu_short\tapt_sport;\t/* source port */\n\tu_short\tapt_dport;\t/* destination port */\n\tshort\tapt_sel[2];\t/* {seq,ack}{off,min} set selector */\n\tshort\tapt_seqoff[2];\t/* sequence # difference */\n\tu_32_t\tapt_seqmin[2];\t/* don't change seq-off until after this */\n\tshort\tapt_ackoff[2];\t/* sequence # difference */\n\tu_32_t\tapt_ackmin[2];\t/* don't change seq-off until after this */\n\tu_char\tapt_state[2];\t/* connection state */\n} ap_tcp_t;\n\ntypedef\tstruct\tap_udp {\n\tu_short\tapu_sport;\t/* source port */\n\tu_short\tapu_dport;\t/* destination port */\n} ap_udp_t;\n\ntypedef\tstruct ap_session {\n\tstruct\taproxy\t*aps_apr;\n\tunion {\n\t\tstruct\tap_tcp\tapu_tcp;\n\t\tstruct\tap_udp\tapu_udp;\n\t} aps_un;\n\tu_int\taps_flags;\n\tU_QUAD_T aps_bytes;\t/* bytes sent */\n\tU_QUAD_T aps_pkts;\t/* packets sent */\n\tvoid\t*aps_nat;\t/* pointer back to nat struct */\n\tvoid\t*aps_data;\t/* private data */\n\tint\taps_p;\t\t/* protocol */\n\tint\taps_psiz;\t/* size of private data */\n\tstruct\tap_session\t*aps_hnext;\n\tstruct\tap_session\t*aps_next;\n} ap_session_t;\n\n#define\taps_sport\taps_un.apu_tcp.apt_sport\n#define\taps_dport\taps_un.apu_tcp.apt_dport\n#define\taps_sel\t\taps_un.apu_tcp.apt_sel\n#define\taps_seqoff\taps_un.apu_tcp.apt_seqoff\n#define\taps_seqmin\taps_un.apu_tcp.apt_seqmin\n#define\taps_state\taps_un.apu_tcp.apt_state\n#define\taps_ackoff\taps_un.apu_tcp.apt_ackoff\n#define\taps_ackmin\taps_un.apu_tcp.apt_ackmin\n\n\ntypedef\tstruct\tap_control {\n\tchar\tapc_label[APR_LABELLEN];\n\tu_char\tapc_p;\n\t/*\n\t * The following fields are upto the proxy's apr_ctl routine to deal\n\t * with.  When the proxy gets this in kernel space, apc_data will\n\t * point to a malloc'd region of memory of apc_dsize bytes.  If the\n\t * proxy wants to keep that memory, it must set apc_data to NULL\n\t * before it returns.  It is expected if this happens that it will\n\t * take care to free it in apr_fini or otherwise as appropriate.\n\t * apc_cmd is provided as a standard place to put simple commands,\n\t * with apc_arg being available to put a simple arg.\n\t */\n\tu_long\tapc_cmd;\n\tu_long\tapc_arg;\n\tvoid\t*apc_data;\n\tsize_t\tapc_dsize;\n} ap_ctl_t;\n\n\ntypedef\tstruct\taproxy\t{\n\tstruct\taproxy\t*apr_next;\n\tchar\tapr_label[APR_LABELLEN];\t/* Proxy label # */\n\tu_char\tapr_p;\t\t/* protocol */\n\tint\tapr_ref;\t/* +1 per rule referencing it */\n\tint\tapr_flags;\n\tint\t(* apr_init) __P((void));\n\tvoid\t(* apr_fini) __P((void));\n\tint\t(* apr_new) __P((fr_info_t *, ap_session_t *, struct nat *));\n\tvoid\t(* apr_del) __P((ap_session_t *));\n\tint\t(* apr_inpkt) __P((fr_info_t *, ap_session_t *, struct nat *));\n\tint\t(* apr_outpkt) __P((fr_info_t *, ap_session_t *, struct nat *));\n\tint\t(* apr_match) __P((fr_info_t *, ap_session_t *, struct nat *));\n\tint\t(* apr_ctl) __P((struct aproxy *, struct ap_control *));\n} aproxy_t;\n\n#define\tAPR_DELETE\t1\n\n#define\tAPR_ERR(x)\t((x) << 16)\n#define\tAPR_EXIT(x)\t(((x) >> 16) & 0xffff)\n#define\tAPR_INC(x)\t((x) & 0xffff)\n\n/*\n * Generic #define's to cover missing things in the kernel\n */\n#ifndef isdigit\n#define isdigit(x)\t((x) >= '0' && (x) <= '9')\n#endif\n#ifndef isupper\n#define isupper(x)\t(((unsigned)(x) >= 'A') && ((unsigned)(x) <= 'Z'))\n#endif\n#ifndef islower\n#define islower(x)\t(((unsigned)(x) >= 'a') && ((unsigned)(x) <= 'z'))\n#endif\n#ifndef isalpha\n#define isalpha(x)\t(isupper(x) || islower(x))\n#endif\n#ifndef toupper\n#define toupper(x)\t(isupper(x) ? (x) : (x) - 'a' + 'A')\n#endif\n#ifndef isspace\n#define isspace(x)\t(((x) == ' ') || ((x) == '\\r') || ((x) == '\\n') || \\\n\t\t\t ((x) == '\\t') || ((x) == '\\b'))\n#endif\n\n/*\n * This is the scratch buffer size used to hold strings from the TCP stream\n * that we may want to parse.  It's an arbitrary size, really, but it must\n * be at least as large as IPF_FTPBUFSZ.\n */ \n#define\tFTP_BUFSZ\t120\n\n/*\n * This buffer, however, doesn't need to be nearly so big.  It just needs to\n * be able to squeeze in the largest command it needs to rewrite, Which ones\n * does it rewrite? EPRT, PORT, 227 replies.\n */\n#define\tIPF_FTPBUFSZ\t80\t/* This *MUST* be >= 53! */\n\ntypedef struct  ftpside {\n\tchar\t*ftps_rptr;\n\tchar\t*ftps_wptr;\n\tvoid\t*ftps_ifp;\n\tu_32_t\tftps_seq[2];\n\tu_32_t\tftps_len;\n\tint\tftps_junk;\t/* 2 = no cr/lf yet, 1 = cannot parse */\n\tint\tftps_cmds;\n\tchar\tftps_buf[FTP_BUFSZ];\n} ftpside_t;\n\ntypedef struct  ftpinfo {\n\tint \t  \tftp_passok;\n\tint\t\tftp_incok;\n\tftpside_t\tftp_side[2];\n} ftpinfo_t;\n\n\n/*\n * For the irc proxy.\n */\ntypedef\tstruct\tircinfo {\n\tsize_t\tirc_len;\n\tchar\t*irc_snick;\n\tchar\t*irc_dnick;\n\tchar\t*irc_type;\n\tchar\t*irc_arg;\n\tchar\t*irc_addr;\n\tu_32_t\tirc_ipnum;\n\tu_short\tirc_port;\n} ircinfo_t;\n\n\n/*\n * Real audio proxy structure and #defines\n */\ntypedef\tstruct\traudio_s {\n\tint\trap_seenpna;\n\tint\trap_seenver;\n\tint\trap_version;\n\tint\trap_eos;\t/* End Of Startup */\n\tint\trap_gotid;\n\tint\trap_gotlen;\n\tint\trap_mode;\n\tint\trap_sdone;\n\tu_short\trap_plport;\n\tu_short\trap_prport;\n\tu_short\trap_srport;\n\tchar\trap_svr[19];\n\tu_32_t\trap_sbf;\t/* flag to indicate which of the 19 bytes have\n\t\t\t\t * been filled\n\t\t\t\t */\n\tu_32_t\trap_sseq;\n} raudio_t;\n\n#define\tRA_ID_END\t0\n#define\tRA_ID_UDP\t1\n#define\tRA_ID_ROBUST\t7\n\n#define\tRAP_M_UDP\t1\n#define\tRAP_M_ROBUST\t2\n#define\tRAP_M_TCP\t4\n#define\tRAP_M_UDP_ROBUST\t(RAP_M_UDP|RAP_M_ROBUST)\n\n\n/*\n * MSN RPC proxy\n */\ntypedef\tstruct\tmsnrpcinfo\t{\n\tu_int\t\tmri_flags;\n\tint\t\tmri_cmd[2];\n\tu_int\t\tmri_valid;\n\tstruct\tin_addr\tmri_raddr;\n\tu_short\t\tmri_rport;\n} msnrpcinfo_t;\n\n\n/*\n * IPSec proxy\n */\ntypedef\tu_32_t\tipsec_cookie_t[2];\n\ntypedef struct ipsec_pxy {\n\tipsec_cookie_t\tipsc_icookie;\n\tipsec_cookie_t\tipsc_rcookie;\n\tint\t\tipsc_rckset;\n\tipnat_t\t\tipsc_rule;\n\tnat_t\t\t*ipsc_nat;\n\tstruct ipstate\t*ipsc_state;\n} ipsec_pxy_t;\n\n/*\n * PPTP proxy\n */\ntypedef\tstruct pptp_side {\n\tu_32_t\t\tpptps_nexthdr;\n\tu_32_t\t\tpptps_next;\n\tint\t\tpptps_state;\n\tint\t\tpptps_gothdr;\n\tint\t\tpptps_len;\n\tint\t\tpptps_bytes;\n\tchar\t\t*pptps_wptr;\n\tchar\t\tpptps_buffer[512];\n} pptp_side_t;\n\ntypedef\tstruct pptp_pxy {\n\tipnat_t\t\tpptp_rule;\n\tnat_t\t\t*pptp_nat;\n\tstruct ipstate\t*pptp_state;\n\tu_short\t\tpptp_call[2];\n\tpptp_side_t\tpptp_side[2];\n} pptp_pxy_t;\n\n\n/*\n * Sun RPCBIND proxy\n */\n#define RPCB_MAXMSG\t888\n#define RPCB_RES_PMAP\t0\t/* Response contains a v2 port. */\n#define RPCB_RES_STRING\t1\t/* \" \" \" v3 (GETADDR) string. */\n#define RPCB_RES_LIST\t2\t/* \" \" \" v4 (GETADDRLIST) list. */\n#define RPCB_MAXREQS\t32\t/* Arbitrary limit on tracked transactions */\n\n#define RPCB_REQMIN\t40\n#define RPCB_REQMAX\t888\n#define RPCB_REPMIN\t20\n#define\tRPCB_REPMAX\t604\t/* XXX double check this! */\n\n/*\n * These macros determine the number of bytes between p and the end of\n * r->rs_buf relative to l.\n */\n#define RPCB_BUF_END(r) (char *)((r)->rm_msgbuf + (r)->rm_buflen)\n#define RPCB_BUF_GEQ(r, p, l)   \\\n        ((RPCB_BUF_END((r)) > (char *)(p)) &&           \\\n         ((RPCB_BUF_END((r)) - (char *)(p)) >= (l)))\n#define\tRPCB_BUF_EQ(r, p, l)                            \\\n        (RPCB_BUF_END((r)) == ((char *)(p) + (l)))\n\n/*\n * The following correspond to RPC(B) detailed in RFC183[13].\n */\n#define RPCB_CALL\t\t0\n#define RPCB_REPLY\t\t1\n#define RPCB_MSG_VERSION\t2\n#define RPCB_PROG\t\t100000\n#define RPCB_GETPORT\t\t3\n#define RPCB_GETADDR\t\t3\n#define RPCB_GETADDRLIST\t11\n#define RPCB_MSG_ACCEPTED\t0\n#define RPCB_MSG_DENIED\t\t1\n\n/* BEGIN (Generic XDR structures) */\ntypedef struct xdr_string {\n\tu_32_t\t*xs_len;\n\tchar\t*xs_str;\n} xdr_string_t;\n\ntypedef struct xdr_auth {\n\t/* u_32_t\txa_flavor; */\n\txdr_string_t\txa_string;\n} xdr_auth_t;\n\ntypedef struct xdr_uaddr {\n\tu_32_t\t\txu_ip;\n\tu_short         xu_port;\n\txdr_string_t\txu_str;\n} xdr_uaddr_t;\n\ntypedef\tstruct xdr_proto {\n\tu_int\t\txp_proto;\n\txdr_string_t\txp_str;\n} xdr_proto_t;\n\n#define xu_xslen\txu_str.xs_len\n#define xu_xsstr\txu_str.xs_str\n#define\txp_xslen\txp_str.xs_len\n#define xp_xsstr\txp_str.xs_str\n/* END (Generic XDR structures) */\n\n/* BEGIN (RPC call structures) */\ntypedef struct pmap_args {\n\t/* u_32_t\tpa_prog; */\n\t/* u_32_t\tpa_vers; */\n\tu_32_t\t\t*pa_prot;\n\t/* u_32_t\tpa_port; */\n} pmap_args_t;\n\ntypedef struct rpcb_args {\n\t/* u_32_t\t*ra_prog; */\n\t/* u_32_t\t*ra_vers; */\n\txdr_proto_t\tra_netid;\n\txdr_uaddr_t\tra_maddr;\n\t/* xdr_string_t\tra_owner; */\n} rpcb_args_t;\n\ntypedef struct rpc_call {\n\t/* u_32_t\trc_rpcvers; */\n\t/* u_32_t\trc_prog; */\n\tu_32_t\t*rc_vers;\n\tu_32_t\t*rc_proc;\n\txdr_auth_t\trc_authcred;\n\txdr_auth_t\trc_authverf;\n\tunion {\n\t\tpmap_args_t\tra_pmapargs;\n\t\trpcb_args_t\tra_rpcbargs;\n\t} rpcb_args;\n} rpc_call_t;\n\n#define\trc_pmapargs\trpcb_args.ra_pmapargs\n#define rc_rpcbargs\trpcb_args.ra_rpcbargs\n/* END (RPC call structures) */\n\n/* BEGIN (RPC reply structures) */\ntypedef struct rpcb_entry {\n\txdr_uaddr_t\tre_maddr;\n\txdr_proto_t\tre_netid;\n\t/* u_32_t\tre_semantics; */\n\txdr_string_t\tre_family;\n\txdr_proto_t\tre_proto;\n\tu_32_t\t\t*re_more; /* 1 == another entry follows */\n} rpcb_entry_t;\n\ntypedef struct rpcb_listp {\n\tu_32_t\t\t*rl_list; /* 1 == list follows */\n\tint\t\trl_cnt;\n\trpcb_entry_t\trl_entries[2]; /* TCP / UDP only */\n} rpcb_listp_t;\n\ntypedef struct rpc_resp {\n\t/* u_32_t\trr_acceptdeny; */\n\t/* Omitted 'message denied' fork; we don't care about rejects. */\n\txdr_auth_t\trr_authverf;\n\t/* u_32_t\t\t*rr_astat;\t*/\n\tunion {\n\t\tu_32_t\t\t*resp_pmap;\n\t\txdr_uaddr_t\tresp_getaddr;\n\t\trpcb_listp_t\tresp_getaddrlist;\n\t} rpcb_reply;\n} rpc_resp_t;\n\n#define\trr_v2\trpcb_reply.resp_pmap\n#define rr_v3\trpcb_reply.resp_getaddr\n#define\trr_v4\trpcb_reply.resp_getaddrlist\n/* END (RPC reply structures) */\n\n/* BEGIN (RPC message structure & macros) */\ntypedef struct rpc_msg {\n\tchar\trm_msgbuf[RPCB_MAXMSG];\t/* RPCB data buffer */\n\tu_int\trm_buflen;\n\tu_32_t\t*rm_xid;\n\t/* u_32_t Call vs Reply */\n\tunion {\n\t\trpc_call_t\trb_call;\n\t\trpc_resp_t\trb_resp;\n\t} rm_body;\n} rpc_msg_t;\n\n#define rm_call\t\trm_body.rb_call\n#define rm_resp\t\trm_body.rb_resp\n/* END (RPC message structure & macros) */\n\n/*\n * These code paths aren't hot enough to warrant per transaction\n * mutexes.\n */\ntypedef struct rpcb_xact {\n\tstruct\trpcb_xact\t*rx_next;\n\tstruct\trpcb_xact\t**rx_pnext;\n\tu_32_t\trx_xid;\t\t/* RPC transmission ID */\n\tu_int\trx_type;\t/* RPCB response type */\n\tu_int\trx_ref;         /* reference count */\n\tu_int\trx_proto;\t/* transport protocol (v2 only) */\n} rpcb_xact_t;\n\ntypedef struct rpcb_session {\n        ipfmutex_t\trs_rxlock;\n\trpcb_xact_t\t*rs_rxlist;\n} rpcb_session_t;\n\n/*\n * For an explanation, please see the following:\n *   RFC1832 - Sections 3.11, 4.4, and 4.5.\n */\n#define XDRALIGN(x)\t((((x) % 4) != 0) ? ((((x) + 3) / 4) * 4) : (x))\n\nextern\tap_session_t\t*ap_sess_tab[AP_SESS_SIZE];\nextern\tap_session_t\t*ap_sess_list;\nextern\taproxy_t\tap_proxies[];\nextern\tint\t\tippr_ftp_pasvonly;\nextern\tint\t\tipf_proxy_debug;\n\nextern\tint\tappr_add __P((aproxy_t *));\nextern\tint\tappr_ctl __P((ap_ctl_t *));\nextern\tint\tappr_del __P((aproxy_t *));\nextern\tint\tappr_init __P((void));\nextern\tvoid\tappr_unload __P((void));\nextern\tint\tappr_ok __P((fr_info_t *, tcphdr_t *, struct ipnat *));\nextern\tint\tappr_match __P((fr_info_t *, struct nat *));\nextern\tvoid\tappr_free __P((aproxy_t *));\nextern\tvoid\taps_free __P((ap_session_t *));\nextern\tint\tappr_check __P((fr_info_t *, struct nat *));\nextern\taproxy_t\t*appr_lookup __P((u_int, char *));\nextern\tint\tappr_new __P((fr_info_t *, struct nat *));\nextern\tint\tappr_ioctl __P((caddr_t, ioctlcmd_t, int, void *));\n\n#endif /* __IP_PROXY_H__ */\n"
  },
  {
    "path": "freebsd-headers/netinet/ip_rules.h",
    "content": "/*\t$FreeBSD: release/9.0.0/sys/contrib/ipfilter/netinet/ip_rules.h 145517 2005-04-25 18:15:41Z darrenr $\t*/\n\nextern int ipfrule_add __P((void));\nextern int ipfrule_remove __P((void));\n\nextern frentry_t *ipfrule_match_out_ __P((fr_info_t *, u_32_t *));\nextern frentry_t *ipf_rules_out_[1];\n\nextern int ipfrule_add_out_ __P((void));\nextern int ipfrule_remove_out_ __P((void));\n\nextern frentry_t *ipfrule_match_in_ __P((fr_info_t *, u_32_t *));\nextern frentry_t *ipf_rules_in_[1];\n\nextern int ipfrule_add_in_ __P((void));\nextern int ipfrule_remove_in_ __P((void));\n"
  },
  {
    "path": "freebsd-headers/netinet/ip_scan.h",
    "content": "/*\n * Copyright (C) 1993-2001 by Darren Reed.\n *\n * See the IPFILTER.LICENCE file for details on licencing.\n *\n * @(#)ip_fil.h\t1.35 6/5/96\n * $Id: ip_scan.h,v 2.9.2.2 2006/07/14 06:12:19 darrenr Exp $\n */\n\n#ifndef __IP_SCAN_H__\n#define __IP_SCAN_H__ 1\n\n#ifdef sun\n# include <sys/ioccom.h>\n#endif\n\n#define\tIPSCAN_NAME\t\"/dev/ipscan\"\n#define\tIPL_SCAN\tIPSCAN_NAME\n#define\tISC_TLEN\t16\n\n\nstruct fr_info;\nstruct frentry;\nstruct ip;\nstruct ipstate;\n\n\n#if defined(__STDC__) || defined(__GNUC__) || defined(_AIX51)\n# define\tSIOCADSCA\t_IOWR('r', 60, struct ipscan *)\n# define\tSIOCRMSCA\t_IOWR('r', 61, struct ipscan *)\n# define\tSIOCGSCST\t_IOWR('r', 62, struct ipscan *)\n#else\n# define\tSIOCADSCA\t_IOWR(r, 60, struct ipscan *)\n# define\tSIOCRMSCA\t_IOWR(r, 61, struct ipscan *)\n# define\tSIOCGSCST\t_IOWR(r, 62, struct ipscan *)\n#endif\n\nstruct\taction\t{\n\tint\t\tact_val;\t/* what to do */\n\tstruct\tin_addr\tact_ip;\t\t/* redirect IP# */\n\tu_short\t\tact_port;\t/* redirect port number */\n\tint\t\tact_else;\t/* what to do */\n\tstruct\tin_addr\tact_eip;\t/* redirect IP# */\n\tu_short\t\tact_eport;\t/* redirect port number */\n};\n\n\ntypedef\tstruct\tsinfo {\n\tchar\ts_txt[ISC_TLEN];\t/* text to match */\n\tchar\ts_msk[ISC_TLEN];\t/* mask of the above to check */\n\tint\ts_len;\t\t\t/* length of server text */\n} sinfo_t;\n\n\ntypedef\tstruct\tipscan\t{\n\tstruct\tipscan\t*ipsc_next;\n\tstruct\tipscan\t**ipsc_pnext;\n\tchar\t\tipsc_tag[ISC_TLEN];\t/* table entry protocol tag */\n\tsinfo_t\t\tipsc_si[2];\t/* client/server side information */\n\tint\t\tipsc_hits;\t/* times this has been matched */\n\tint\t\tipsc_active;\t/* # of active matches */\n\tint\t\tipsc_fref;\t/* # of references from filter rules */\n\tint\t\tipsc_sref;\t/* # of references from state entries */\n\tstruct\taction\tipsc_act;\n} ipscan_t;\n\n\n#define\tipsc_cl\t\tipsc_si[0]\n#define\tipsc_sl\t\tipsc_si[1]\n#define\tipsc_ctxt\tipsc_cl.s_txt\n#define\tipsc_cmsk\tipsc_cl.s_msk\n#define\tipsc_clen\tipsc_cl.s_len\n#define\tipsc_stxt\tipsc_sl.s_txt\n#define\tipsc_smsk\tipsc_sl.s_msk\n#define\tipsc_slen\tipsc_sl.s_len\n#define\tipsc_action\tipsc_act.act_val\n#define\tipsc_ip\t\tipsc_act.act_ip\n#define\tipsc_port\tipsc_act.act_port\n#define\tipsc_else\tipsc_act.act_else\n#define\tipsc_eip\tipsc_act.act_eip\n#define\tipsc_eport\tipsc_act.act_eport\n\n#define\tISC_A_NONE\t0\n#define\tISC_A_TRACK\t1\n#define\tISC_A_CLOSE\t2\n#define\tISC_A_REDIRECT\t3\n\n\ntypedef\tstruct\tipscanstat\t{\n\tstruct\tipscan\t*iscs_list;\n\tu_long\t\tiscs_acted;\n\tu_long\t\tiscs_else;\n\tint\t\tiscs_entries;\n} ipscanstat_t;\n\n\nextern\tint fr_scan_ioctl __P((caddr_t, ioctlcmd_t, int, int, void *));\nextern\tint ipsc_init __P((void));\nextern\tint ipsc_attachis __P((struct ipstate *));\nextern\tint ipsc_attachfr __P((struct frentry *));\nextern\tint ipsc_detachis __P((struct ipstate *));\nextern\tint ipsc_detachfr __P((struct frentry *));\nextern\tint ipsc_packet __P((struct fr_info *, struct ipstate *));\nextern\tvoid fr_scanunload __P((void));\n\n#endif /* __IP_SCAN_H__ */\n"
  },
  {
    "path": "freebsd-headers/netinet/ip_state.h",
    "content": "/*\t$FreeBSD: release/9.0.0/sys/contrib/ipfilter/netinet/ip_state.h 172776 2007-10-18 21:52:14Z darrenr $\t*/\n\n/*\n * Copyright (C) 1995-2001 by Darren Reed.\n *\n * See the IPFILTER.LICENCE file for details on licencing.\n *\n * @(#)ip_state.h\t1.3 1/12/96 (C) 1995 Darren Reed\n * $FreeBSD: release/9.0.0/sys/contrib/ipfilter/netinet/ip_state.h 172776 2007-10-18 21:52:14Z darrenr $\n * Id: ip_state.h,v 2.68.2.10 2007/10/16 09:33:24 darrenr Exp $\n */\n#ifndef\t__IP_STATE_H__\n#define\t__IP_STATE_H__\n\n#if defined(__STDC__) || defined(__GNUC__) || defined(_AIX51)\n# define\tSIOCDELST\t_IOW('r', 61, struct ipfobj)\n#else\n# define\tSIOCDELST\t_IOW(r, 61, struct ipfobj)\n#endif\n\nstruct ipscan;\n\n#ifndef\tIPSTATE_SIZE\n# define\tIPSTATE_SIZE\t5737\n#endif\n#ifndef\tIPSTATE_MAX\n# define\tIPSTATE_MAX\t4013\t/* Maximum number of states held */\n#endif\n\n#define\tSEQ_GE(a,b)\t((int)((a) - (b)) >= 0)\n#define\tSEQ_GT(a,b)\t((int)((a) - (b)) > 0)\n\n\ntypedef struct ipstate {\n\tipfmutex_t\tis_lock;\n\tstruct\tipstate\t*is_next;\n\tstruct\tipstate\t**is_pnext;\n\tstruct\tipstate\t*is_hnext;\n\tstruct\tipstate\t**is_phnext;\n\tstruct\tipstate\t**is_me;\n\tvoid\t\t*is_ifp[4];\n\tvoid\t\t*is_sync;\n\tfrentry_t\t*is_rule;\n\tstruct\tipftq\t*is_tqehead[2];\n\tstruct\tipscan\t*is_isc;\n\tU_QUAD_T\tis_pkts[4];\n\tU_QUAD_T\tis_bytes[4];\n\tU_QUAD_T\tis_icmppkts[4];\n\tstruct\tipftqent is_sti;\n\tu_int\tis_frage[2];\n\tint\tis_ref;\t\t\t/* reference count */\n\tint\tis_isninc[2];\n\tu_short\tis_sumd[2];\n\ti6addr_t\tis_src;\n\ti6addr_t\tis_dst;\n\tu_int\tis_pass;\n\tu_char\tis_p;\t\t\t/* Protocol */\n\tu_char\tis_v;\n\tu_32_t\tis_hv;\n\tu_32_t\tis_tag;\n\tu_32_t\tis_opt[2];\t\t/* packet options set */\n\tu_32_t\tis_optmsk[2];\t\t/*    \"      \"    mask */\n\tu_short\tis_sec;\t\t\t/* security options set */\n\tu_short\tis_secmsk;\t\t/*    \"        \"    mask */\n\tu_short\tis_auth;\t\t/* authentication options set */\n\tu_short\tis_authmsk;\t\t/*    \"              \"    mask */\n\tunion {\n\t\ticmpinfo_t\tis_ics;\n\t\ttcpinfo_t\tis_ts;\n\t\tudpinfo_t\tis_us;\n\t\tgreinfo_t\tis_ug;\n\t} is_ps;\n\tu_32_t\tis_flags;\n\tint\tis_flx[2][2];\n\tu_32_t\tis_rulen;\t\t/* rule number when created */\n\tu_32_t\tis_s0[2];\n\tu_short\tis_smsk[2];\n\tchar\tis_group[FR_GROUPLEN];\n\tchar\tis_sbuf[2][16];\n\tchar\tis_ifname[4][LIFNAMSIZ];\n} ipstate_t;\n\n#define\tis_die\t\tis_sti.tqe_die\n#define\tis_state\tis_sti.tqe_state\n#define\tis_touched\tis_sti.tqe_touched\n#define\tis_saddr\tis_src.in4.s_addr\n#define\tis_daddr\tis_dst.in4.s_addr\n#define\tis_icmp\t\tis_ps.is_ics\n#define\tis_type\t\tis_icmp.ici_type\n#define\tis_code\t\tis_icmp.ici_code\n#define\tis_tcp\t\tis_ps.is_ts\n#define\tis_udp\t\tis_ps.is_us\n#define is_send\t\tis_tcp.ts_data[0].td_end\n#define is_dend\t\tis_tcp.ts_data[1].td_end\n#define is_maxswin\tis_tcp.ts_data[0].td_maxwin\n#define is_maxdwin\tis_tcp.ts_data[1].td_maxwin\n#define is_maxsend\tis_tcp.ts_data[0].td_maxend\n#define is_maxdend\tis_tcp.ts_data[1].td_maxend\n#define\tis_swinscale\tis_tcp.ts_data[0].td_winscale\n#define\tis_dwinscale\tis_tcp.ts_data[1].td_winscale\n#define\tis_swinflags\tis_tcp.ts_data[0].td_winflags\n#define\tis_dwinflags\tis_tcp.ts_data[1].td_winflags\n#define\tis_sport\tis_tcp.ts_sport\n#define\tis_dport\tis_tcp.ts_dport\n#define\tis_ifpin\tis_ifp[0]\n#define\tis_ifpout\tis_ifp[2]\n#define\tis_gre\t\tis_ps.is_ug\n#define\tis_call\t\tis_gre.gs_call\n\n#define\tIS_WSPORT\tSI_W_SPORT\t/* 0x00100 */\n#define\tIS_WDPORT\tSI_W_DPORT\t/* 0x00200 */\n#define\tIS_WSADDR\tSI_W_SADDR\t/* 0x00400 */\n#define\tIS_WDADDR\tSI_W_DADDR\t/* 0x00800 */\n#define\tIS_NEWFR\tSI_NEWFR\t/* 0x01000 */\n#define\tIS_CLONE\tSI_CLONE\t/* 0x02000 */\n#define\tIS_CLONED\tSI_CLONED\t/* 0x04000 */\n#define\tIS_TCPFSM\t\t\t   0x10000\n#define\tIS_STRICT\t\t\t   0x20000\n#define\tIS_ISNSYN\t\t\t   0x40000\n#define\tIS_ISNACK\t\t\t   0x80000\n#define\tIS_STATESYNC\t\t\t   0x100000\n/*\n * IS_SC flags are for scan-operations that need to be recognised in state.\n */\n#define\tIS_SC_CLIENT\t\t\t0x10000000\n#define\tIS_SC_SERVER\t\t\t0x20000000\n#define\tIS_SC_MATCHC\t\t\t0x40000000\n#define\tIS_SC_MATCHS\t\t\t0x80000000\n#define\tIS_SC_MATCHALL\t(IS_SC_MATCHC|IS_SC_MATCHC)\n#define\tIS_SC_ALL\t(IS_SC_MATCHC|IS_SC_MATCHC|IS_SC_CLIENT|IS_SC_SERVER)\n\n/*\n * Flags that can be passed into fr_addstate\n */\n#define\tIS_INHERITED\t\t\t0x0fffff00\n\n#define\tTH_OPENING\t(TH_SYN|TH_ACK)\n/*\n * is_flags:\n * Bits 0 - 3 are use as a mask with the current packet's bits to check for\n * whether it is short, tcp/udp, a fragment or the presence of IP options.\n * Bits 4 - 7 are set from the initial packet and contain what the packet\n * anded with bits 0-3 must match.\n * Bits 8,9 are used to indicate wildcard source/destination port matching.\n * Bits 10,11 are reserved for other wildcard flag compatibility.\n * Bits 12,13 are for scaning.\n */\n\ntypedef\tstruct\tipstate_save\t{\n\tvoid\t*ips_next;\n\tstruct\tipstate\tips_is;\n\tstruct\tfrentry\tips_fr;\n} ipstate_save_t;\n\n#define\tips_rule\tips_is.is_rule\n\n\ntypedef\tstruct\tipslog\t{\n\tU_QUAD_T\tisl_pkts[4];\n\tU_QUAD_T\tisl_bytes[4];\n\ti6addr_t\tisl_src;\n\ti6addr_t\tisl_dst;\n\tu_32_t\tisl_tag;\n\tu_short\tisl_type;\n\tunion {\n\t\tu_short\tisl_filler[2];\n\t\tu_short\tisl_ports[2];\n\t\tu_short\tisl_icmp;\n\t} isl_ps;\n\tu_char\tisl_v;\n\tu_char\tisl_p;\n\tu_char\tisl_flags;\n\tu_char\tisl_state[2];\n\tu_32_t\tisl_rulen;\n\tchar\tisl_group[FR_GROUPLEN];\n} ipslog_t;\n\n#define\tisl_sport\tisl_ps.isl_ports[0]\n#define\tisl_dport\tisl_ps.isl_ports[1]\n#define\tisl_itype\tisl_ps.isl_icmp\n\n#define\tISL_NEW\t\t\t0\n#define\tISL_CLONE\t\t1\n#define\tISL_EXPIRE\t\t0xffff\n#define\tISL_FLUSH\t\t0xfffe\n#define\tISL_REMOVE\t\t0xfffd\n#define\tISL_INTERMEDIATE\t0xfffc\n#define\tISL_KILLED\t\t0xfffb\n#define\tISL_ORPHAN\t\t0xfffa\n#define\tISL_UNLOAD\t\t0xfff9\n\n\ntypedef\tstruct\tips_stat {\n\tu_long\tiss_hits;\n\tu_long\tiss_miss;\n\tu_long\tiss_max;\n\tu_long\tiss_maxref;\n\tu_long\tiss_tcp;\n\tu_long\tiss_udp;\n\tu_long\tiss_icmp;\n\tu_long\tiss_nomem;\n\tu_long\tiss_expire;\n\tu_long\tiss_fin;\n\tu_long\tiss_active;\n\tu_long\tiss_logged;\n\tu_long\tiss_logfail;\n\tu_long\tiss_inuse;\n\tu_long\tiss_wild;\n\tu_long\tiss_killed;\n\tu_long\tiss_ticks;\n\tu_long\tiss_bucketfull;\n\tint\tiss_statesize;\n\tint\tiss_statemax;\n\tipstate_t **iss_table;\n\tipstate_t *iss_list;\n\tu_long\t*iss_bucketlen;\n\tipftq_t\t*iss_tcptab;\n} ips_stat_t;\n\n\nextern\tu_long\tfr_tcpidletimeout;\nextern\tu_long\tfr_tcpclosewait;\nextern\tu_long\tfr_tcplastack;\nextern\tu_long\tfr_tcptimeout;\nextern\tu_long\tfr_tcpclosed;\nextern\tu_long\tfr_tcphalfclosed;\nextern\tu_long\tfr_udptimeout;\nextern\tu_long\tfr_udpacktimeout;\nextern\tu_long\tfr_icmptimeout;\nextern\tu_long\tfr_icmpacktimeout;\nextern\tu_long\tfr_iptimeout;\nextern\tint\tfr_statemax;\nextern\tint\tfr_statesize;\nextern\tint\tfr_state_lock;\nextern\tint\tfr_state_maxbucket;\nextern\tint\tfr_state_maxbucket_reset;\nextern\tipstate_t\t*ips_list;\nextern\tipftq_t\t*ips_utqe;\nextern\tipftq_t\tips_tqtqb[IPF_TCP_NSTATES];\n\nextern\tint\tfr_stateinit __P((void));\nextern\tipstate_t *fr_addstate __P((fr_info_t *, ipstate_t **, u_int));\nextern\tfrentry_t *fr_checkstate __P((struct fr_info *, u_32_t *));\nextern\tipstate_t *fr_stlookup __P((fr_info_t *, tcphdr_t *, ipftq_t **));\nextern\tvoid\tfr_statesync __P((void *));\nextern\tvoid\tfr_timeoutstate __P((void));\nextern\tint\tfr_tcp_age __P((struct ipftqent *, struct fr_info *,\n\t\t\t\tstruct ipftq *, int));\nextern\tint\tfr_tcpinwindow __P((struct fr_info *, struct tcpdata *,\n\t\t\t\t    struct tcpdata *, tcphdr_t *, int));\nextern\tvoid\tfr_stateunload __P((void));\nextern\tvoid\tipstate_log __P((struct ipstate *, u_int));\nextern\tint\tfr_state_ioctl __P((caddr_t, ioctlcmd_t, int, int, void *));\nextern\tvoid\tfr_stinsert __P((struct ipstate *, int));\nextern\tvoid\tfr_sttab_init __P((struct ipftq *));\nextern\tvoid\tfr_sttab_destroy __P((struct ipftq *));\nextern\tvoid\tfr_updatestate __P((fr_info_t *, ipstate_t *, ipftq_t *));\nextern\tvoid\tfr_statederef __P((ipstate_t **));\nextern\tvoid\tfr_setstatequeue __P((ipstate_t *, int));\n\n#endif /* __IP_STATE_H__ */\n"
  },
  {
    "path": "freebsd-headers/netinet/ip_sync.h",
    "content": "/*\n * Copyright (C) 1993-2001 by Darren Reed.\n *\n * See the IPFILTER.LICENCE file for details on licencing.\n *\n * @(#)ip_fil.h\t1.35 6/5/96\n * $Id: ip_sync.h,v 2.11.2.4 2006/07/14 06:12:20 darrenr Exp $\n */\n\n#ifndef __IP_SYNC_H__\n#define __IP_SYNC_H__\n\ntypedef\tstruct\tsynchdr\t{\n\tu_32_t\t\tsm_magic;\t/* magic */\n\tu_char\t\tsm_v;\t\t/* version: 4,6 */\n\tu_char\t\tsm_p;\t\t/* protocol */\n\tu_char\t\tsm_cmd;\t\t/* command */\n\tu_char\t\tsm_table;\t/* NAT, STATE, etc */\n\tu_int\t\tsm_num;\t\t/* table entry number */\n\tint\t\tsm_rev;\t\t/* forward/reverse */\n\tint\t\tsm_len;\t\t/* length of the data section */\n\tstruct\tsynclist\t*sm_sl;\t\t/* back pointer to parent */\n} synchdr_t;\n\n\n#define SYNHDRMAGIC 0x0FF51DE5\n\n/*\n * Commands\n * No delete required as expirey will take care of that!\n */\n#define\tSMC_CREATE\t0\t/* pass ipstate_t after synchdr_t */\n#define\tSMC_UPDATE\t1\n#define\tSMC_MAXCMD\t1\n\n/*\n * Tables\n */\n#define\tSMC_NAT\t\t0\n#define\tSMC_STATE\t1\n#define\tSMC_MAXTBL\t1\n\n\n/*\n * Only TCP requires \"more\" information than just a reference to the entry\n * for which an update is being made.\n */\ntypedef\tstruct\tsynctcp_update\t{\n\tu_long\t\tstu_age;\n\ttcpdata_t\tstu_data[2];\n\tint\t\tstu_state[2];\n} synctcp_update_t;\n\n\ntypedef\tstruct\tsynclist\t{\n\tstruct\tsynclist\t*sl_next;\n\tstruct\tsynclist\t**sl_pnext;\n\tint\t\t\tsl_idx;\t\t/* update index */\n\tstruct\tsynchdr\t\tsl_hdr;\n\tunion\t{\n\t\tstruct\tipstate\t*slu_ips;\n\t\tstruct\tnat\t*slu_ipn;\n\t\tvoid\t\t*slu_ptr;\n\t} sl_un;\n} synclist_t;\n\n#define\tsl_ptr\tsl_un.slu_ptr\n#define\tsl_ips\tsl_un.slu_ips\n#define\tsl_ipn\tsl_un.slu_ipn\n#define\tsl_magic sl_hdr.sm_magic\n#define\tsl_v\tsl_hdr.sm_v\n#define\tsl_p\tsl_hdr.sm_p\n#define\tsl_cmd\tsl_hdr.sm_cmd\n#define\tsl_rev\tsl_hdr.sm_rev\n#define\tsl_table\tsl_hdr.sm_table\n#define\tsl_num\tsl_hdr.sm_num\n#define\tsl_len\tsl_hdr.sm_len\n\n/*\n * NOTE: SYNCLOG_SZ is defined *low*.  It should be the next power of two\n * up for whatever number of packets per second you expect to see.  Be\n * warned: this index's a table of large elements (upto 272 bytes in size\n * each), and thus a size of 8192, for example, results in a 2MB table.\n * The lesson here is not to use small machines for running fast firewalls\n * (100BaseT) in sync, where you might have upwards of 10k pps.\n */\n#define\tSYNCLOG_SZ\t256\n\ntypedef\tstruct\tsynclogent\t{\n\tstruct\tsynchdr\tsle_hdr;\n\tunion\t{\n\t\tstruct\tipstate\tsleu_ips;\n\t\tstruct\tnat\tsleu_ipn;\n\t} sle_un;\n} synclogent_t;\n\ntypedef\tstruct\tsyncupdent\t{\t\t/* 28 or 32 bytes */\n\tstruct\tsynchdr\tsup_hdr;\n\tstruct\tsynctcp_update\tsup_tcp;\n} syncupdent_t;\n\nextern\tsynclogent_t\tsynclog[SYNCLOG_SZ];\n\n\nextern\tint fr_sync_ioctl __P((caddr_t, ioctlcmd_t, int, int, void *));\nextern\tsynclist_t *ipfsync_new __P((int, fr_info_t *, void *));\nextern\tvoid ipfsync_del __P((synclist_t *));\nextern\tvoid ipfsync_update __P((int, fr_info_t *, synclist_t *));\nextern\tint ipfsync_init __P((void));\nextern\tint ipfsync_nat __P((synchdr_t *sp, void *data));\nextern\tint ipfsync_state __P((synchdr_t *sp, void *data));\nextern\tint ipfsync_read __P((struct uio *uio));\nextern\tint ipfsync_write __P((struct uio *uio));\nextern\tint ipfsync_canread __P((void));\nextern\tint ipfsync_canwrite __P((void));\n\n#endif /* IP_SYNC */\n"
  },
  {
    "path": "freebsd-headers/netinet/ip_var.h",
    "content": "/*-\n * Copyright (c) 1982, 1986, 1993\n *\tThe Regents of the University of California.  All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 4. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t@(#)ip_var.h\t8.2 (Berkeley) 1/9/95\n * $FreeBSD: release/9.0.0/sys/netinet/ip_var.h 223666 2011-06-29 10:06:58Z ae $\n */\n\n#ifndef _NETINET_IP_VAR_H_\n#define\t_NETINET_IP_VAR_H_\n\n#include <sys/queue.h>\n\n/*\n * Overlay for ip header used by other protocols (tcp, udp).\n */\nstruct ipovly {\n\tu_char\tih_x1[9];\t\t/* (unused) */\n\tu_char\tih_pr;\t\t\t/* protocol */\n\tu_short\tih_len;\t\t\t/* protocol length */\n\tstruct\tin_addr ih_src;\t\t/* source internet address */\n\tstruct\tin_addr ih_dst;\t\t/* destination internet address */\n};\n\n#ifdef _KERNEL\n/*\n * Ip reassembly queue structure.  Each fragment\n * being reassembled is attached to one of these structures.\n * They are timed out after ipq_ttl drops to 0, and may also\n * be reclaimed if memory becomes tight.\n */\nstruct ipq {\n\tTAILQ_ENTRY(ipq) ipq_list;\t/* to other reass headers */\n\tu_char\tipq_ttl;\t\t/* time for reass q to live */\n\tu_char\tipq_p;\t\t\t/* protocol of this fragment */\n\tu_short\tipq_id;\t\t\t/* sequence id for reassembly */\n\tstruct mbuf *ipq_frags;\t\t/* to ip headers of fragments */\n\tstruct\tin_addr ipq_src,ipq_dst;\n\tu_char\tipq_nfrags;\t\t/* # frags in this packet */\n\tstruct label *ipq_label;\t/* MAC label */\n};\n#endif /* _KERNEL */\n\n/*\n * Structure stored in mbuf in inpcb.ip_options\n * and passed to ip_output when ip options are in use.\n * The actual length of the options (including ipopt_dst)\n * is in m_len.\n */\n#define MAX_IPOPTLEN\t40\n\nstruct ipoption {\n\tstruct\tin_addr ipopt_dst;\t/* first-hop dst if source routed */\n\tchar\tipopt_list[MAX_IPOPTLEN];\t/* options proper */\n};\n\n/*\n * Structure attached to inpcb.ip_moptions and\n * passed to ip_output when IP multicast options are in use.\n * This structure is lazy-allocated.\n */\nstruct ip_moptions {\n\tstruct\tifnet *imo_multicast_ifp; /* ifp for outgoing multicasts */\n\tstruct in_addr imo_multicast_addr; /* ifindex/addr on MULTICAST_IF */\n\tu_long\timo_multicast_vif;\t/* vif num outgoing multicasts */\n\tu_char\timo_multicast_ttl;\t/* TTL for outgoing multicasts */\n\tu_char\timo_multicast_loop;\t/* 1 => hear sends if a member */\n\tu_short\timo_num_memberships;\t/* no. memberships this socket */\n\tu_short\timo_max_memberships;\t/* max memberships this socket */\n\tstruct\tin_multi **imo_membership;\t/* group memberships */\n\tstruct\tin_mfilter *imo_mfilters;\t/* source filters */\n};\n\nstruct\tipstat {\n\tu_long\tips_total;\t\t/* total packets received */\n\tu_long\tips_badsum;\t\t/* checksum bad */\n\tu_long\tips_tooshort;\t\t/* packet too short */\n\tu_long\tips_toosmall;\t\t/* not enough data */\n\tu_long\tips_badhlen;\t\t/* ip header length < data size */\n\tu_long\tips_badlen;\t\t/* ip length < ip header length */\n\tu_long\tips_fragments;\t\t/* fragments received */\n\tu_long\tips_fragdropped;\t/* frags dropped (dups, out of space) */\n\tu_long\tips_fragtimeout;\t/* fragments timed out */\n\tu_long\tips_forward;\t\t/* packets forwarded */\n\tu_long\tips_fastforward;\t/* packets fast forwarded */\n\tu_long\tips_cantforward;\t/* packets rcvd for unreachable dest */\n\tu_long\tips_redirectsent;\t/* packets forwarded on same net */\n\tu_long\tips_noproto;\t\t/* unknown or unsupported protocol */\n\tu_long\tips_delivered;\t\t/* datagrams delivered to upper level*/\n\tu_long\tips_localout;\t\t/* total ip packets generated here */\n\tu_long\tips_odropped;\t\t/* lost packets due to nobufs, etc. */\n\tu_long\tips_reassembled;\t/* total packets reassembled ok */\n\tu_long\tips_fragmented;\t\t/* datagrams successfully fragmented */\n\tu_long\tips_ofragments;\t\t/* output fragments created */\n\tu_long\tips_cantfrag;\t\t/* don't fragment flag was set, etc. */\n\tu_long\tips_badoptions;\t\t/* error in option processing */\n\tu_long\tips_noroute;\t\t/* packets discarded due to no route */\n\tu_long\tips_badvers;\t\t/* ip version != 4 */\n\tu_long\tips_rawout;\t\t/* total raw ip packets generated */\n\tu_long\tips_toolong;\t\t/* ip length > max ip packet size */\n\tu_long\tips_notmember;\t\t/* multicasts for unregistered grps */\n\tu_long\tips_nogif;\t\t/* no match gif found */\n\tu_long\tips_badaddr;\t\t/* invalid address on header */\n};\n\n#ifdef _KERNEL\n\n#include <net/vnet.h>\n\n/*\n * In-kernel consumers can use these accessor macros directly to update\n * stats.\n */\n#define\tIPSTAT_ADD(name, val)\tV_ipstat.name += (val)\n#define\tIPSTAT_SUB(name, val)\tV_ipstat.name -= (val)\n#define\tIPSTAT_INC(name)\tIPSTAT_ADD(name, 1)\n#define\tIPSTAT_DEC(name)\tIPSTAT_SUB(name, 1)\n\n/*\n * Kernel module consumers must use this accessor macro.\n */\nvoid\tkmod_ipstat_inc(int statnum);\n#define\tKMOD_IPSTAT_INC(name)\t\t\t\t\t\t\\\n\tkmod_ipstat_inc(offsetof(struct ipstat, name) / sizeof(u_long))\nvoid\tkmod_ipstat_dec(int statnum);\n#define\tKMOD_IPSTAT_DEC(name)\t\t\t\t\t\t\\\n\tkmod_ipstat_dec(offsetof(struct ipstat, name) / sizeof(u_long))\n\n/* flags passed to ip_output as last parameter */\n#define\tIP_FORWARDING\t\t0x1\t\t/* most of ip header exists */\n#define\tIP_RAWOUTPUT\t\t0x2\t\t/* raw ip header exists */\n#define\tIP_SENDONES\t\t0x4\t\t/* send all-ones broadcast */\n#define\tIP_SENDTOIF\t\t0x8\t\t/* send on specific ifnet */\n#define IP_ROUTETOIF\t\tSO_DONTROUTE\t/* 0x10 bypass routing tables */\n#define IP_ALLOWBROADCAST\tSO_BROADCAST\t/* 0x20 can send broadcast packets */\n\n/*\n * mbuf flag used by ip_fastfwd\n */\n#define\tM_FASTFWD_OURS\t\tM_PROTO1\t/* changed dst to local */\n\n#ifdef __NO_STRICT_ALIGNMENT\n#define IP_HDR_ALIGNED_P(ip)\t1\n#else\n#define IP_HDR_ALIGNED_P(ip)\t((((intptr_t) (ip)) & 3) == 0)\n#endif\n\nstruct ip;\nstruct inpcb;\nstruct route;\nstruct sockopt;\n\nVNET_DECLARE(struct ipstat, ipstat);\nVNET_DECLARE(u_short, ip_id);\t\t\t/* ip packet ctr, for ids */\nVNET_DECLARE(int, ip_defttl);\t\t\t/* default IP ttl */\nVNET_DECLARE(int, ipforwarding);\t\t/* ip forwarding */\n#ifdef IPSTEALTH\nVNET_DECLARE(int, ipstealth);\t\t\t/* stealth forwarding */\n#endif\nextern u_char\tip_protox[];\nVNET_DECLARE(struct socket *, ip_rsvpd);\t/* reservation protocol daemon*/\nVNET_DECLARE(struct socket *, ip_mrouter);\t/* multicast routing daemon */\nextern int\t(*legal_vif_num)(int);\nextern u_long\t(*ip_mcast_src)(int);\nVNET_DECLARE(int, rsvp_on);\nextern struct\tpr_usrreqs rip_usrreqs;\n\n#define\tV_ipstat\t\tVNET(ipstat)\n#define\tV_ip_id\t\t\tVNET(ip_id)\n#define\tV_ip_defttl\t\tVNET(ip_defttl)\n#define\tV_ipforwarding\t\tVNET(ipforwarding)\n#ifdef IPSTEALTH\n#define\tV_ipstealth\t\tVNET(ipstealth)\n#endif\n#define\tV_ip_rsvpd\t\tVNET(ip_rsvpd)\n#define\tV_ip_mrouter\t\tVNET(ip_mrouter)\n#define\tV_rsvp_on\t\tVNET(rsvp_on)\n\nvoid\tinp_freemoptions(struct ip_moptions *);\nint\tinp_getmoptions(struct inpcb *, struct sockopt *);\nint\tinp_setmoptions(struct inpcb *, struct sockopt *);\n\nint\tip_ctloutput(struct socket *, struct sockopt *sopt);\nvoid\tip_drain(void);\nint\tip_fragment(struct ip *ip, struct mbuf **m_frag, int mtu,\n\t    u_long if_hwassist_flags, int sw_csum);\nvoid\tip_forward(struct mbuf *m, int srcrt);\nvoid\tip_init(void);\n#ifdef VIMAGE\nvoid\tip_destroy(void);\n#endif\nextern int\n\t(*ip_mforward)(struct ip *, struct ifnet *, struct mbuf *,\n\t    struct ip_moptions *);\nint\tip_output(struct mbuf *,\n\t    struct mbuf *, struct route *, int, struct ip_moptions *,\n\t    struct inpcb *);\nint\tipproto_register(short);\nint\tipproto_unregister(short);\nstruct mbuf *\n\tip_reass(struct mbuf *);\nstruct in_ifaddr *\n\tip_rtaddr(struct in_addr, u_int fibnum);\nvoid\tip_savecontrol(struct inpcb *, struct mbuf **, struct ip *,\n\t    struct mbuf *);\nvoid\tip_slowtimo(void);\nu_int16_t\tip_randomid(void);\nint\trip_ctloutput(struct socket *, struct sockopt *);\nvoid\trip_ctlinput(int, struct sockaddr *, void *);\nvoid\trip_init(void);\n#ifdef VIMAGE\nvoid\trip_destroy(void);\n#endif\nvoid\trip_input(struct mbuf *, int);\nint\trip_output(struct mbuf *, struct socket *, u_long);\nvoid\tipip_input(struct mbuf *, int);\nvoid\trsvp_input(struct mbuf *, int);\nint\tip_rsvp_init(struct socket *);\nint\tip_rsvp_done(void);\nextern int\t(*ip_rsvp_vif)(struct socket *, struct sockopt *);\nextern void\t(*ip_rsvp_force_done)(struct socket *);\nextern void\t(*rsvp_input_p)(struct mbuf *m, int off);\n\nVNET_DECLARE(struct pfil_head, inet_pfil_hook);\t/* packet filter hooks */\n#define\tV_inet_pfil_hook\tVNET(inet_pfil_hook)\n\nvoid\tin_delayed_cksum(struct mbuf *m);\n\n/* Hooks for ipfw, dummynet, divert etc. Most are declared in raw_ip.c */\n/*\n * Reference to an ipfw or packet filter rule that can be carried\n * outside critical sections.\n * A rule is identified by rulenum:rule_id which is ordered.\n * In version chain_id the rule can be found in slot 'slot', so\n * we don't need a lookup if chain_id == chain->id.\n *\n * On exit from the firewall this structure refers to the rule after\n * the matching one (slot points to the new rule; rulenum:rule_id-1\n * is the matching rule), and additional info (e.g. info often contains\n * the insn argument or tablearg in the low 16 bits, in host format).\n * On entry, the structure is valid if slot>0, and refers to the starting\n * rules. 'info' contains the reason for reinject, e.g. divert port,\n * divert direction, and so on.\n */\nstruct ipfw_rule_ref {\n\tuint32_t\tslot;\t\t/* slot for matching rule\t*/\n\tuint32_t\trulenum;\t/* matching rule number\t\t*/\n\tuint32_t\trule_id;\t/* matching rule id\t\t*/\n\tuint32_t\tchain_id;\t/* ruleset id\t\t\t*/\n\tuint32_t\tinfo;\t\t/* see below\t\t\t*/\n};\n\nenum {\n\tIPFW_INFO_MASK\t= 0x0000ffff,\n\tIPFW_INFO_OUT\t= 0x00000000,\t/* outgoing, just for convenience */\n\tIPFW_INFO_IN\t= 0x80000000,\t/* incoming, overloads dir */\n\tIPFW_ONEPASS\t= 0x40000000,\t/* One-pass, do not reinject */\n\tIPFW_IS_MASK\t= 0x30000000,\t/* which source ? */\n\tIPFW_IS_DIVERT\t= 0x20000000,\n\tIPFW_IS_DUMMYNET =0x10000000,\n\tIPFW_IS_PIPE\t= 0x08000000,\t/* pip1=1, queue = 0 */\n};\n#define MTAG_IPFW\t1148380143\t/* IPFW-tagged cookie */\n#define MTAG_IPFW_RULE\t1262273568\t/* rule reference */\n#define\tMTAG_IPFW_CALL\t1308397630\t/* call stack */\n\nstruct ip_fw_args;\ntypedef int\t(*ip_fw_chk_ptr_t)(struct ip_fw_args *args);\ntypedef int\t(*ip_fw_ctl_ptr_t)(struct sockopt *);\nVNET_DECLARE(ip_fw_chk_ptr_t, ip_fw_chk_ptr);\nVNET_DECLARE(ip_fw_ctl_ptr_t, ip_fw_ctl_ptr);\n#define\tV_ip_fw_chk_ptr\t\tVNET(ip_fw_chk_ptr)\n#define\tV_ip_fw_ctl_ptr\t\tVNET(ip_fw_ctl_ptr)\n\n/* Divert hooks. */\nextern void\t(*ip_divert_ptr)(struct mbuf *m, int incoming);\n/* ng_ipfw hooks -- XXX make it the same as divert and dummynet */\nextern int\t(*ng_ipfw_input_p)(struct mbuf **, int,\n\t\t\tstruct ip_fw_args *, int);\n\nextern int\t(*ip_dn_ctl_ptr)(struct sockopt *);\nextern int\t(*ip_dn_io_ptr)(struct mbuf **, int, struct ip_fw_args *);\n\nVNET_DECLARE(int, ip_do_randomid);\n#define\tV_ip_do_randomid\tVNET(ip_do_randomid)\n#define\tip_newid()\t((V_ip_do_randomid != 0) ? ip_randomid() : \\\n\t\t\t    htons(V_ip_id++))\n\n#endif /* _KERNEL */\n\n#endif /* !_NETINET_IP_VAR_H_ */\n"
  },
  {
    "path": "freebsd-headers/netinet/ipl.h",
    "content": "/*\t$FreeBSD: release/9.0.0/sys/contrib/ipfilter/netinet/ipl.h 172776 2007-10-18 21:52:14Z darrenr $\t*/\n\n/*\n * Copyright (C) 1993-2001, 2003 by Darren Reed.\n *\n * See the IPFILTER.LICENCE file for details on licencing.\n *\n * @(#)ipl.h\t1.21 6/5/96\n * $FreeBSD: release/9.0.0/sys/contrib/ipfilter/netinet/ipl.h 172776 2007-10-18 21:52:14Z darrenr $\n * Id: ipl.h,v 2.52.2.30 2007/10/16 09:41:00 darrenr Exp $\n */\n\n#ifndef\t__IPL_H__\n#define\t__IPL_H__\n\n#define\tIPL_VERSION\t\"IP Filter: v4.1.28\"\n\n#define\tIPFILTER_VERSION\t4012800\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/netinet/pim.h",
    "content": "/*-\n * Copyright (c) 1996-2000\n * University of Southern California/Information Sciences Institute.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. Neither the name of the project nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/netinet/pim.h 139823 2005-01-07 01:45:51Z imp $\n */\n\n#ifndef _NETINET_PIM_H_\n#define _NETINET_PIM_H_\n\n/*\n * Protocol Independent Multicast (PIM) definitions.\n * RFC 2362, June 1998.\n *\n * Written by Ahmed Helmy, USC/SGI, July 1996.\n * Modified by George Edmond Eddy (Rusty), ISI, February 1998.\n * Modified by Pavlin Radoslavov, USC/ISI, May 1998, October 2000.\n */\n\n#include <sys/types.h>\n\n#ifndef _PIM_VT\n#ifndef BYTE_ORDER\n# error BYTE_ORDER is not defined!\n#endif\n#if (BYTE_ORDER != BIG_ENDIAN) && (BYTE_ORDER != LITTLE_ENDIAN)\n# error BYTE_ORDER must be defined to either BIG_ENDIAN or LITTLE_ENDIAN\n#endif\n#endif /* ! _PIM_VT */\n\n/*\n * PIM packet header\n */\nstruct pim {\n#ifdef _PIM_VT\n\tuint8_t\t\tpim_vt;\t\t/* PIM version and message type\t*/\n#else /* ! _PIM_VT   */\n#if BYTE_ORDER == BIG_ENDIAN\n\tu_int\t\tpim_vers:4,\t/* PIM protocol version\t\t*/\n\t\t\tpim_type:4;\t/* PIM message type\t\t*/\n#endif\n#if BYTE_ORDER == LITTLE_ENDIAN\n\tu_int\t\tpim_type:4,\t/* PIM message type\t\t*/\n\t\t\tpim_vers:4;\t/* PIM protocol version\t\t*/\n#endif\n#endif /* ! _PIM_VT  */\n\tuint8_t\t\tpim_reserved;\t/* Reserved\t\t\t*/\n\tuint16_t\tpim_cksum;\t/* IP-style checksum\t\t*/\n};\n/* KAME-related name backward compatibility */\n#define pim_ver pim_vers\n#define pim_rsv pim_reserved\n\n#ifdef _PIM_VT\n#define PIM_MAKE_VT(v, t)\t(0xff & (((v) << 4) | (0x0f & (t))))\n#define PIM_VT_V(x)\t\t(((x) >> 4) & 0x0f)\n#define PIM_VT_T(x)\t\t((x) & 0x0f)\n#endif /* _PIM_VT */\n\n#define PIM_VERSION\t\t2\n#define PIM_MINLEN\t\t8\t/* PIM message min. length\t*/\n#define PIM_REG_MINLEN\t(PIM_MINLEN+20)\t/* PIM Register hdr + inner IPv4 hdr */\n#define PIM6_REG_MINLEN\t(PIM_MINLEN+40)\t/* PIM Register hdr + inner IPv6 hdr */\n\n/*\n * PIM message types\n */\n#define PIM_HELLO\t\t0x0\t/* PIM-SM and PIM-DM\t\t*/\n#define PIM_REGISTER\t\t0x1\t/* PIM-SM only\t\t\t*/\n#define PIM_REGISTER_STOP\t0x2\t/* PIM-SM only\t\t\t*/\n#define PIM_JOIN_PRUNE\t\t0x3\t/* PIM-SM and PIM-DM\t\t*/\n#define PIM_BOOTSTRAP\t\t0x4\t/* PIM-SM only\t\t\t*/\n#define PIM_ASSERT\t\t0x5\t/* PIM-SM and PIM-DM\t\t*/\n#define PIM_GRAFT\t\t0x6\t/* PIM-DM only\t\t\t*/\n#define PIM_GRAFT_ACK\t\t0x7\t/* PIM-DM only\t\t\t*/\n#define PIM_CAND_RP_ADV\t\t0x8\t/* PIM-SM only\t\t\t*/\n#define PIM_ALL_DF_ELECTION\t0xa\t/* Bidir-PIM-SM only\t\t*/\n\n/*\n * PIM-Register message flags\n */\n#define PIM_BORDER_REGISTER 0x80000000U\t/* The Border bit (host-order)\t*/\n#define PIM_NULL_REGISTER   0x40000000U\t/* The Null-Register bit (host-order)*/\n\n/*\n * All-PIM-Routers IPv4 and IPv6 multicast addresses\n */\n#define INADDR_ALLPIM_ROUTERS_GROUP\t(uint32_t)0xe000000dU  /* 224.0.0.13 */\n#define IN6ADDR_LINKLOCAL_ALLPIM_ROUTERS\t\"ff02::d\"\n#define IN6ADDR_LINKLOCAL_ALLPIM_ROUTERS_INIT\t\t\t\t\\\n\t{{{ 0xff, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\t\t\\\n\t    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0d }}}\n\n#endif /* _NETINET_PIM_H_ */\n"
  },
  {
    "path": "freebsd-headers/netinet/pim_var.h",
    "content": "/*-\n * Copyright (c) 1998-2000\n * University of Southern California/Information Sciences Institute.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. Neither the name of the project nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/netinet/pim_var.h 208744 2010-06-02 15:44:43Z zec $\n */\n\n#ifndef _NETINET_PIM_VAR_H_\n#define _NETINET_PIM_VAR_H_\n\n/*\n * Protocol Independent Multicast (PIM),\n * kernel variables and implementation-specific definitions.\n *\n * Written by George Edmond Eddy (Rusty), ISI, February 1998.\n * Modified by Pavlin Radoslavov, USC/ISI, May 1998, Aug 1999, October 2000.\n * Modified by Hitoshi Asaeda, WIDE, August 1998.\n */\n\n/*\n * PIM statistics kept in the kernel\n */\nstruct pimstat {\n\tu_quad_t pims_rcv_total_msgs;\t   /* total PIM messages received    */\n\tu_quad_t pims_rcv_total_bytes;\t   /* total PIM bytes received\t     */\n\tu_quad_t pims_rcv_tooshort;\t   /* rcvd with too few bytes\t     */\n\tu_quad_t pims_rcv_badsum;\t   /* rcvd with bad checksum\t     */\n\tu_quad_t pims_rcv_badversion;\t   /* rcvd bad PIM version\t     */\n\tu_quad_t pims_rcv_registers_msgs;  /* rcvd regs. msgs (data only)    */\n\tu_quad_t pims_rcv_registers_bytes; /* rcvd regs. bytes (data only)   */\n\tu_quad_t pims_rcv_registers_wrongiif; /* rcvd regs. on wrong iif     */\n\tu_quad_t pims_rcv_badregisters;\t   /* rcvd invalid registers\t     */\n\tu_quad_t pims_snd_registers_msgs;  /* sent regs. msgs (data only)    */\n\tu_quad_t pims_snd_registers_bytes; /* sent regs. bytes (data only)   */\n};\n\n#ifdef _KERNEL\n#define\tPIMSTAT_ADD(name, val)\tV_pimstat.name += (val)\n#define\tPIMSTAT_INC(name)\tPIMSTAT_ADD(name, 1)\n#endif\n\n/*\n * Names for PIM sysctl objects\n */\n#define PIMCTL_STATS\t\t1\t/* statistics (read-only) */\n#define PIMCTL_MAXID\t\t2\n\n#define PIMCTL_NAMES {\t\t\t\\\n\t{ 0, 0 },\t\t\t\\\n\t{ \"stats\", CTLTYPE_STRUCT },\t\\\n}\n\n#ifdef _KERNEL\n\nvoid pim_input(struct mbuf *, int);\nSYSCTL_DECL(_net_inet_pim);\n#endif\n\n#endif /* _NETINET_PIM_VAR_H_ */\n"
  },
  {
    "path": "freebsd-headers/netinet/sctp.h",
    "content": "/*-\n * Copyright (c) 2001-2008, by Cisco Systems, Inc. All rights reserved.\n * Copyright (c) 2008-2011, by Randall Stewart. All rights reserved.\n * Copyright (c) 2008-2011, by Michael Tuexen. All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions are met:\n *\n * a) Redistributions of source code must retain the above copyright notice,\n *   this list of conditions and the following disclaimer.\n *\n * b) Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in\n *   the documentation and/or other materials provided with the distribution.\n *\n * c) Neither the name of Cisco Systems, Inc. nor the names of its\n *    contributors may be used to endorse or promote products derived\n *    from this software without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n * \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,\n * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE\n * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\n * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\n * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\n * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\n * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF\n * THE POSSIBILITY OF SUCH DAMAGE.\n */\n/* $KAME: sctp.h,v 1.18 2005/03/06 16:04:16 itojun Exp $\t */\n\n#include <sys/cdefs.h>\n__FBSDID(\"$FreeBSD: release/9.0.0/sys/netinet/sctp.h 225635 2011-09-17 08:50:29Z tuexen $\");\n\n#ifndef _NETINET_SCTP_H_\n#define _NETINET_SCTP_H_\n\n#include <sys/types.h>\n\n\n#define SCTP_PACKED __attribute__((packed))\n\n/*\n * SCTP protocol - RFC2960.\n */\nstruct sctphdr {\n\tuint16_t src_port;\t/* source port */\n\tuint16_t dest_port;\t/* destination port */\n\tuint32_t v_tag;\t\t/* verification tag of packet */\n\tuint32_t checksum;\t/* Adler32 C-Sum */\n\t/* chunks follow... */\n}       SCTP_PACKED;\n\n/*\n * SCTP Chunks\n */\nstruct sctp_chunkhdr {\n\tuint8_t chunk_type;\t/* chunk type */\n\tuint8_t chunk_flags;\t/* chunk flags */\n\tuint16_t chunk_length;\t/* chunk length */\n\t/* optional params follow */\n}             SCTP_PACKED;\n\n/*\n * SCTP chunk parameters\n */\nstruct sctp_paramhdr {\n\tuint16_t param_type;\t/* parameter type */\n\tuint16_t param_length;\t/* parameter length */\n}             SCTP_PACKED;\n\n/*\n * user socket options: socket API defined\n */\n/*\n * read-write options\n */\n#define SCTP_RTOINFO\t\t\t0x00000001\n#define SCTP_ASSOCINFO\t\t\t0x00000002\n#define SCTP_INITMSG\t\t\t0x00000003\n#define SCTP_NODELAY\t\t\t0x00000004\n#define SCTP_AUTOCLOSE\t\t\t0x00000005\n#define SCTP_SET_PEER_PRIMARY_ADDR\t0x00000006\n#define SCTP_PRIMARY_ADDR\t\t0x00000007\n#define SCTP_ADAPTATION_LAYER\t\t0x00000008\n/* same as above */\n#define SCTP_ADAPTION_LAYER\t\t0x00000008\n#define SCTP_DISABLE_FRAGMENTS\t\t0x00000009\n#define SCTP_PEER_ADDR_PARAMS \t\t0x0000000a\n#define SCTP_DEFAULT_SEND_PARAM\t\t0x0000000b\n/* ancillary data/notification interest options */\n#define SCTP_EVENTS\t\t\t0x0000000c\t/* deprecated */\n/* Without this applied we will give V4 and V6 addresses on a V6 socket */\n#define SCTP_I_WANT_MAPPED_V4_ADDR\t0x0000000d\n#define SCTP_MAXSEG \t\t\t0x0000000e\n#define SCTP_DELAYED_SACK               0x0000000f\n#define SCTP_FRAGMENT_INTERLEAVE        0x00000010\n#define SCTP_PARTIAL_DELIVERY_POINT     0x00000011\n/* authentication support */\n#define SCTP_AUTH_CHUNK \t\t0x00000012\n#define SCTP_AUTH_KEY \t\t\t0x00000013\n#define SCTP_HMAC_IDENT \t\t0x00000014\n#define SCTP_AUTH_ACTIVE_KEY \t\t0x00000015\n#define SCTP_AUTH_DELETE_KEY \t\t0x00000016\n#define SCTP_USE_EXT_RCVINFO\t\t0x00000017\n#define SCTP_AUTO_ASCONF\t\t0x00000018\t/* rw */\n#define SCTP_MAXBURST\t\t\t0x00000019\t/* rw */\n#define SCTP_MAX_BURST\t\t\t0x00000019\t/* rw */\n/* assoc level context */\n#define SCTP_CONTEXT                    0x0000001a\t/* rw */\n/* explicit EOR signalling */\n#define SCTP_EXPLICIT_EOR               0x0000001b\n#define SCTP_REUSE_PORT                 0x0000001c\t/* rw */\n#define SCTP_AUTH_DEACTIVATE_KEY\t0x0000001d\n#define SCTP_EVENT                      0x0000001e\n#define SCTP_RECVRCVINFO                0x0000001f\n#define SCTP_RECVNXTINFO                0x00000020\n#define SCTP_DEFAULT_SNDINFO            0x00000021\n#define SCTP_DEFAULT_PRINFO             0x00000022\n#define SCTP_PEER_ADDR_THLDS            0x00000023\n\n/*\n * read-only options\n */\n#define SCTP_STATUS\t\t\t0x00000100\n#define SCTP_GET_PEER_ADDR_INFO\t\t0x00000101\n/* authentication support */\n#define SCTP_PEER_AUTH_CHUNKS \t\t0x00000102\n#define SCTP_LOCAL_AUTH_CHUNKS \t\t0x00000103\n#define SCTP_GET_ASSOC_NUMBER           0x00000104\t/* ro */\n#define SCTP_GET_ASSOC_ID_LIST          0x00000105\t/* ro */\n#define SCTP_TIMEOUTS                   0x00000106\n\n/*\n * user socket options: BSD implementation specific\n */\n/*\n * Blocking I/O is enabled on any TCP type socket by default. For the UDP\n * model if this is turned on then the socket buffer is shared for send\n * resources amongst all associations.  The default for the UDP model is that\n * is SS_NBIO is set.  Which means all associations have a separate send\n * limit BUT they will NOT ever BLOCK instead you will get an error back\n * EAGAIN if you try to send too much. If you want the blocking semantics you\n * set this option at the cost of sharing one socket send buffer size amongst\n * all associations. Peeled off sockets turn this option off and block. But\n * since both TCP and peeled off sockets have only one assoc per socket this\n * is fine. It probably does NOT make sense to set this on SS_NBIO on a TCP\n * model OR peeled off UDP model, but we do allow you to do so. You just use\n * the normal syscall to toggle SS_NBIO the way you want.\n *\n * Blocking I/O is controlled by the SS_NBIO flag on the socket state so_state\n * field.\n */\n\n/* these should probably go into sockets API */\n#define SCTP_RESET_STREAMS\t\t0x00001004\t/* wo */\n\n\n/* here on down are more implementation specific */\n#define SCTP_SET_DEBUG_LEVEL\t\t0x00001005\n#define SCTP_CLR_STAT_LOG               0x00001007\n/* CMT ON/OFF socket option */\n#define SCTP_CMT_ON_OFF                 0x00001200\n#define SCTP_CMT_USE_DAC                0x00001201\n/* JRS - Pluggable Congestion Control Socket option */\n#define SCTP_PLUGGABLE_CC               0x00001202\n/* RS - Pluggable Stream Scheduling Socket option */\n#define SCTP_PLUGGABLE_SS\t\t0x00001203\n#define SCTP_SS_VALUE\t\t\t0x00001204\n#define SCTP_CC_OPTION\t\t\t0x00001205\t/* Options for CC\n\t\t\t\t\t\t\t * modules */\n/* read only */\n#define SCTP_GET_SNDBUF_USE\t\t0x00001101\n#define SCTP_GET_STAT_LOG\t\t0x00001103\n#define SCTP_PCB_STATUS\t\t\t0x00001104\n#define SCTP_GET_NONCE_VALUES           0x00001105\n\n\n/* Special hook for dynamically setting primary for all assoc's,\n * this is a write only option that requires root privilege.\n */\n#define SCTP_SET_DYNAMIC_PRIMARY        0x00002001\n\n/* VRF (virtual router feature) and multi-VRF support\n * options. VRF's provide splits within a router\n * that give the views of multiple routers. A\n * standard host, without VRF support, is just\n * a single VRF. If VRF's are supported then\n * the transport must be VRF aware. This means\n * that every socket call coming in must be directed\n * within the endpoint to one of the VRF's it belongs\n * to. The endpoint, before binding, may select\n * the \"default\" VRF it is in by using a set socket\n * option with SCTP_VRF_ID. This will also\n * get propagated to the default VRF. Once the\n * endpoint binds an address then it CANNOT add\n * additional VRF's to become a Multi-VRF endpoint.\n *\n * Before BINDING additional VRF's can be added with\n * the SCTP_ADD_VRF_ID call or deleted with\n * SCTP_DEL_VRF_ID.\n *\n * Associations are ALWAYS contained inside a single\n * VRF. They cannot reside in two (or more) VRF's. Incoming\n * packets, assuming the router is VRF aware, can always\n * tell us what VRF they arrived on. A host not supporting\n * any VRF's will find that the packets always arrived on the\n * single VRF that the host has.\n *\n */\n\n#define SCTP_VRF_ID\t\t\t0x00003001\n#define SCTP_ADD_VRF_ID\t\t\t0x00003002\n#define SCTP_GET_VRF_IDS\t\t0x00003003\n#define SCTP_GET_ASOC_VRF               0x00003004\n#define SCTP_DEL_VRF_ID                 0x00003005\n\n/*\n * If you enable packet logging you can get\n * a poor mans ethereal output in binary\n * form. Note this is a compile option to\n * the kernel,  SCTP_PACKET_LOGGING, and\n * without it in your kernel you\n * will get a EOPNOTSUPP\n */\n#define SCTP_GET_PACKET_LOG             0x00004001\n\n/*\n * hidden implementation specific options these are NOT user visible (should\n * move out of sctp.h)\n */\n/* sctp_bindx() flags as hidden socket options */\n#define SCTP_BINDX_ADD_ADDR\t\t0x00008001\n#define SCTP_BINDX_REM_ADDR\t\t0x00008002\n/* Hidden socket option that gets the addresses */\n#define SCTP_GET_PEER_ADDRESSES\t\t0x00008003\n#define SCTP_GET_LOCAL_ADDRESSES\t0x00008004\n/* return the total count in bytes needed to hold all local addresses bound */\n#define SCTP_GET_LOCAL_ADDR_SIZE\t0x00008005\n/* Return the total count in bytes needed to hold the remote address */\n#define SCTP_GET_REMOTE_ADDR_SIZE\t0x00008006\n/* hidden option for connectx */\n#define SCTP_CONNECT_X\t\t\t0x00008007\n/* hidden option for connectx_delayed, part of sendx */\n#define SCTP_CONNECT_X_DELAYED\t\t0x00008008\n#define SCTP_CONNECT_X_COMPLETE         0x00008009\n/* hidden socket option based sctp_peeloff */\n#define SCTP_PEELOFF                    0x0000800a\n/* the real worker for sctp_getaddrlen() */\n#define SCTP_GET_ADDR_LEN               0x0000800b\n/* temporary workaround for Apple listen() issue, no args used */\n#define SCTP_LISTEN_FIX\t\t\t0x0000800c\n/* Debug things that need to be purged */\n#define SCTP_SET_INITIAL_DBG_SEQ\t0x00009f00\n\n/* JRS - Supported congestion control modules for pluggable\n * congestion control\n */\n/* Standard TCP Congestion Control */\n#define SCTP_CC_RFC2581\t\t0x00000000\n/* High Speed TCP Congestion Control (Floyd) */\n#define SCTP_CC_HSTCP\t\t0x00000001\n/* HTCP Congestion Control */\n#define SCTP_CC_HTCP\t\t0x00000002\n/* RTCC Congestion Control - RFC2581 plus */\n#define SCTP_CC_RTCC            0x00000003\n\n#define SCTP_CC_OPT_RTCC_SETMODE\t0x00002000\n#define SCTP_CC_OPT_USE_DCCC_ECN\t0x00002001\n#define SCTP_CC_OPT_STEADY_STEP         0x00002002\n\n#define SCTP_CMT_OFF            0\n#define SCTP_CMT_BASE           1\n#define SCTP_CMT_RPV1           2\n#define SCTP_CMT_RPV2           3\n#define SCTP_CMT_MPTCP          4\n#define SCTP_CMT_MAX            SCTP_CMT_MPTCP\n\n/* RS - Supported stream scheduling modules for pluggable\n * stream scheduling\n */\n/* Default simple round-robin */\n#define SCTP_SS_DEFAULT\t\t\t0x00000000\n/* Real round-robin */\n#define SCTP_SS_ROUND_ROBIN\t\t0x00000001\n/* Real round-robin per packet */\n#define SCTP_SS_ROUND_ROBIN_PACKET\t0x00000002\n/* Priority */\n#define SCTP_SS_PRIORITY\t\t0x00000003\n/* Fair Bandwidth */\n#define SCTP_SS_FAIR_BANDWITH\t\t0x00000004\n/* First-come, first-serve */\n#define SCTP_SS_FIRST_COME\t\t0x00000005\n\n\n/* fragment interleave constants\n * setting must be one of these or\n * EINVAL returned.\n */\n#define SCTP_FRAG_LEVEL_0    0x00000000\n#define SCTP_FRAG_LEVEL_1    0x00000001\n#define SCTP_FRAG_LEVEL_2    0x00000002\n\n/*\n * user state values\n */\n#define SCTP_CLOSED\t\t\t0x0000\n#define SCTP_BOUND\t\t\t0x1000\n#define SCTP_LISTEN\t\t\t0x2000\n#define SCTP_COOKIE_WAIT\t\t0x0002\n#define SCTP_COOKIE_ECHOED\t\t0x0004\n#define SCTP_ESTABLISHED\t\t0x0008\n#define SCTP_SHUTDOWN_SENT\t\t0x0010\n#define SCTP_SHUTDOWN_RECEIVED\t\t0x0020\n#define SCTP_SHUTDOWN_ACK_SENT\t\t0x0040\n#define SCTP_SHUTDOWN_PENDING\t\t0x0080\n\n/*\n * SCTP operational error codes (user visible)\n */\n#define SCTP_CAUSE_NO_ERROR\t\t0x0000\n#define SCTP_CAUSE_INVALID_STREAM\t0x0001\n#define SCTP_CAUSE_MISSING_PARAM\t0x0002\n#define SCTP_CAUSE_STALE_COOKIE\t\t0x0003\n#define SCTP_CAUSE_OUT_OF_RESC\t\t0x0004\n#define SCTP_CAUSE_UNRESOLVABLE_ADDR\t0x0005\n#define SCTP_CAUSE_UNRECOG_CHUNK\t0x0006\n#define SCTP_CAUSE_INVALID_PARAM\t0x0007\n#define SCTP_CAUSE_UNRECOG_PARAM\t0x0008\n#define SCTP_CAUSE_NO_USER_DATA\t\t0x0009\n#define SCTP_CAUSE_COOKIE_IN_SHUTDOWN\t0x000a\n#define SCTP_CAUSE_RESTART_W_NEWADDR\t0x000b\n#define SCTP_CAUSE_USER_INITIATED_ABT\t0x000c\n#define SCTP_CAUSE_PROTOCOL_VIOLATION\t0x000d\n\n/* Error causes from RFC5061 */\n#define SCTP_CAUSE_DELETING_LAST_ADDR\t0x00a0\n#define SCTP_CAUSE_RESOURCE_SHORTAGE\t0x00a1\n#define SCTP_CAUSE_DELETING_SRC_ADDR\t0x00a2\n#define SCTP_CAUSE_ILLEGAL_ASCONF_ACK\t0x00a3\n#define SCTP_CAUSE_REQUEST_REFUSED\t0x00a4\n\n/* Error causes from nat-draft */\n#define SCTP_CAUSE_NAT_COLLIDING_STATE  0x00b0\n#define SCTP_CAUSE_NAT_MISSING_STATE    0x00b1\n\n/* Error causes from RFC4895 */\n#define SCTP_CAUSE_UNSUPPORTED_HMACID\t0x0105\n\n/*\n * error cause parameters (user visible)\n */\nstruct sctp_error_cause {\n\tuint16_t code;\n\tuint16_t length;\n\t/* optional cause-specific info may follow */\n}                SCTP_PACKED;\n\nstruct sctp_error_invalid_stream {\n\tstruct sctp_error_cause cause;\t/* code=SCTP_ERROR_INVALID_STREAM */\n\tuint16_t stream_id;\t/* stream id of the DATA in error */\n\tuint16_t reserved;\n}                         SCTP_PACKED;\n\nstruct sctp_error_missing_param {\n\tstruct sctp_error_cause cause;\t/* code=SCTP_ERROR_MISSING_PARAM */\n\tuint32_t num_missing_params;\t/* number of missing parameters */\n\t/* uint16_t param_type's follow */\n}                        SCTP_PACKED;\n\nstruct sctp_error_stale_cookie {\n\tstruct sctp_error_cause cause;\t/* code=SCTP_ERROR_STALE_COOKIE */\n\tuint32_t stale_time;\t/* time in usec of staleness */\n}                       SCTP_PACKED;\n\nstruct sctp_error_out_of_resource {\n\tstruct sctp_error_cause cause;\t/* code=SCTP_ERROR_OUT_OF_RESOURCES */\n}                          SCTP_PACKED;\n\nstruct sctp_error_unresolv_addr {\n\tstruct sctp_error_cause cause;\t/* code=SCTP_ERROR_UNRESOLVABLE_ADDR */\n\n}                        SCTP_PACKED;\n\nstruct sctp_error_unrecognized_chunk {\n\tstruct sctp_error_cause cause;\t/* code=SCTP_ERROR_UNRECOG_CHUNK */\n\tstruct sctp_chunkhdr ch;/* header from chunk in error */\n}                             SCTP_PACKED;\n\n/*\n * Main SCTP chunk types we place these here so natd and f/w's in user land\n * can find them.\n */\n/************0x00 series ***********/\n#define SCTP_DATA\t\t0x00\n#define SCTP_INITIATION\t\t0x01\n#define SCTP_INITIATION_ACK\t0x02\n#define SCTP_SELECTIVE_ACK\t0x03\n#define SCTP_HEARTBEAT_REQUEST\t0x04\n#define SCTP_HEARTBEAT_ACK\t0x05\n#define SCTP_ABORT_ASSOCIATION\t0x06\n#define SCTP_SHUTDOWN\t\t0x07\n#define SCTP_SHUTDOWN_ACK\t0x08\n#define SCTP_OPERATION_ERROR\t0x09\n#define SCTP_COOKIE_ECHO\t0x0a\n#define SCTP_COOKIE_ACK\t\t0x0b\n#define SCTP_ECN_ECHO\t\t0x0c\n#define SCTP_ECN_CWR\t\t0x0d\n#define SCTP_SHUTDOWN_COMPLETE\t0x0e\n/* RFC4895 */\n#define SCTP_AUTHENTICATION     0x0f\n/* EY nr_sack chunk id*/\n#define SCTP_NR_SELECTIVE_ACK 0x10\n/************0x40 series ***********/\n/************0x80 series ***********/\n/* RFC5061 */\n#define\tSCTP_ASCONF_ACK\t\t0x80\n/* draft-ietf-stewart-pktdrpsctp */\n#define SCTP_PACKET_DROPPED\t0x81\n/* draft-ietf-stewart-strreset-xxx */\n#define SCTP_STREAM_RESET       0x82\n\n/* RFC4820                         */\n#define SCTP_PAD_CHUNK          0x84\n/************0xc0 series ***********/\n/* RFC3758 */\n#define SCTP_FORWARD_CUM_TSN\t0xc0\n/* RFC5061 */\n#define SCTP_ASCONF\t\t0xc1\n\n\n/* ABORT and SHUTDOWN COMPLETE FLAG */\n#define SCTP_HAD_NO_TCB\t\t0x01\n\n/* Packet dropped flags */\n#define SCTP_FROM_MIDDLE_BOX\tSCTP_HAD_NO_TCB\n#define SCTP_BADCRC\t\t0x02\n#define SCTP_PACKET_TRUNCATED\t0x04\n\n/* Flag for ECN -CWR */\n#define SCTP_CWR_REDUCE_OVERRIDE 0x01\n#define SCTP_CWR_IN_SAME_WINDOW  0x02\n\n#define SCTP_SAT_NETWORK_MIN\t400\t/* min ms for RTT to set satellite\n\t\t\t\t\t * time */\n#define SCTP_SAT_NETWORK_BURST_INCR  2\t/* how many times to multiply maxburst\n\t\t\t\t\t * in sat */\n\n/* Data Chuck Specific Flags */\n#define SCTP_DATA_FRAG_MASK        0x03\n#define SCTP_DATA_MIDDLE_FRAG      0x00\n#define SCTP_DATA_LAST_FRAG        0x01\n#define SCTP_DATA_FIRST_FRAG       0x02\n#define SCTP_DATA_NOT_FRAG         0x03\n#define SCTP_DATA_UNORDERED        0x04\n#define SCTP_DATA_SACK_IMMEDIATELY 0x08\n/* ECN Nonce: SACK Chunk Specific Flags */\n#define SCTP_SACK_NONCE_SUM        0x01\n\n/* CMT DAC algorithm SACK flag */\n#define SCTP_SACK_CMT_DAC          0x80\n\n/*\n * PCB flags (in sctp_flags bitmask).\n * Note the features and flags are meant\n * for use by netstat.\n */\n#define SCTP_PCB_FLAGS_UDPTYPE\t\t0x00000001\n#define SCTP_PCB_FLAGS_TCPTYPE\t\t0x00000002\n#define SCTP_PCB_FLAGS_BOUNDALL\t\t0x00000004\n#define SCTP_PCB_FLAGS_ACCEPTING\t0x00000008\n#define SCTP_PCB_FLAGS_UNBOUND\t\t0x00000010\n#define SCTP_PCB_FLAGS_CLOSE_IP         0x00040000\n#define SCTP_PCB_FLAGS_WAS_CONNECTED    0x00080000\n#define SCTP_PCB_FLAGS_WAS_ABORTED      0x00100000\n/* TCP model support */\n\n#define SCTP_PCB_FLAGS_CONNECTED\t0x00200000\n#define SCTP_PCB_FLAGS_IN_TCPPOOL\t0x00400000\n#define SCTP_PCB_FLAGS_DONT_WAKE\t0x00800000\n#define SCTP_PCB_FLAGS_WAKEOUTPUT\t0x01000000\n#define SCTP_PCB_FLAGS_WAKEINPUT\t0x02000000\n#define SCTP_PCB_FLAGS_BOUND_V6\t\t0x04000000\n#define SCTP_PCB_FLAGS_BLOCKING_IO\t0x08000000\n#define SCTP_PCB_FLAGS_SOCKET_GONE\t0x10000000\n#define SCTP_PCB_FLAGS_SOCKET_ALLGONE\t0x20000000\n#define SCTP_PCB_FLAGS_SOCKET_CANT_READ\t0x40000000\n/* flags to copy to new PCB */\n#define SCTP_PCB_COPY_FLAGS\t\t(SCTP_PCB_FLAGS_BOUNDALL|\\\n\t\t\t\t\t SCTP_PCB_FLAGS_WAKEINPUT|\\\n\t\t\t\t\t SCTP_PCB_FLAGS_BOUND_V6)\n\n\n/*\n * PCB Features (in sctp_features bitmask)\n */\n#define SCTP_PCB_FLAGS_DO_NOT_PMTUD     0x00000001\n#define SCTP_PCB_FLAGS_EXT_RCVINFO      0x00000002\t/* deprecated */\n#define SCTP_PCB_FLAGS_DONOT_HEARTBEAT  0x00000004\n#define SCTP_PCB_FLAGS_FRAG_INTERLEAVE  0x00000008\n#define SCTP_PCB_FLAGS_INTERLEAVE_STRMS\t0x00000010\n#define SCTP_PCB_FLAGS_DO_ASCONF\t0x00000020\n#define SCTP_PCB_FLAGS_AUTO_ASCONF\t0x00000040\n#define SCTP_PCB_FLAGS_ZERO_COPY_ACTIVE 0x00000080\n/* socket options */\n#define SCTP_PCB_FLAGS_NODELAY\t\t0x00000100\n#define SCTP_PCB_FLAGS_AUTOCLOSE\t0x00000200\n#define SCTP_PCB_FLAGS_RECVDATAIOEVNT\t0x00000400\t/* deprecated */\n#define SCTP_PCB_FLAGS_RECVASSOCEVNT\t0x00000800\n#define SCTP_PCB_FLAGS_RECVPADDREVNT\t0x00001000\n#define SCTP_PCB_FLAGS_RECVPEERERR\t0x00002000\n#define SCTP_PCB_FLAGS_RECVSENDFAILEVNT\t0x00004000\n#define SCTP_PCB_FLAGS_RECVSHUTDOWNEVNT\t0x00008000\n#define SCTP_PCB_FLAGS_ADAPTATIONEVNT\t0x00010000\n#define SCTP_PCB_FLAGS_PDAPIEVNT\t0x00020000\n#define SCTP_PCB_FLAGS_AUTHEVNT\t\t0x00040000\n#define SCTP_PCB_FLAGS_STREAM_RESETEVNT 0x00080000\n#define SCTP_PCB_FLAGS_NO_FRAGMENT\t0x00100000\n#define SCTP_PCB_FLAGS_EXPLICIT_EOR     0x00400000\n#define SCTP_PCB_FLAGS_NEEDS_MAPPED_V4\t0x00800000\n#define SCTP_PCB_FLAGS_MULTIPLE_ASCONFS\t0x01000000\n#define SCTP_PCB_FLAGS_PORTREUSE        0x02000000\n#define SCTP_PCB_FLAGS_DRYEVNT          0x04000000\n#define SCTP_PCB_FLAGS_RECVRCVINFO      0x08000000\n#define SCTP_PCB_FLAGS_RECVNXTINFO      0x10000000\n\n/*-\n * mobility_features parameters (by micchie).Note\n * these features are applied against the\n * sctp_mobility_features flags.. not the sctp_features\n * flags.\n */\n#define SCTP_MOBILITY_BASE\t\t0x00000001\n#define SCTP_MOBILITY_FASTHANDOFF\t0x00000002\n#define SCTP_MOBILITY_PRIM_DELETED\t0x00000004\n\n\n#define SCTP_SMALLEST_PMTU 512\t/* smallest pmtu allowed when disabling PMTU\n\t\t\t\t * discovery */\n\n#include <netinet/sctp_uio.h>\n\n/* This dictates the size of the packet\n * collection buffer. This only applies\n * if SCTP_PACKET_LOGGING is enabled in\n * your config.\n */\n#define SCTP_PACKET_LOG_SIZE 65536\n\n/* Maximum delays and such a user can set for options that\n * take ms.\n */\n#define SCTP_MAX_SACK_DELAY 500\t/* per RFC4960 */\n#define SCTP_MAX_HB_INTERVAL 14400000\t/* 4 hours in ms */\n#define SCTP_MAX_COOKIE_LIFE  3600000\t/* 1 hour in ms */\n\n\n/* Types of logging/KTR tracing  that can be enabled via the\n * sysctl net.inet.sctp.sctp_logging. You must also enable\n * SUBSYS tracing.\n * Note that you must have the SCTP option in the kernel\n * to enable these as well.\n */\n#define SCTP_BLK_LOGGING_ENABLE\t\t\t\t0x00000001\n#define SCTP_CWND_MONITOR_ENABLE\t\t\t0x00000002\n#define SCTP_CWND_LOGGING_ENABLE\t\t\t0x00000004\n#define SCTP_FLIGHT_LOGGING_ENABLE\t\t\t0x00000020\n#define SCTP_FR_LOGGING_ENABLE\t\t\t\t0x00000040\n#define SCTP_LOCK_LOGGING_ENABLE\t\t\t0x00000080\n#define SCTP_MAP_LOGGING_ENABLE\t\t\t\t0x00000100\n#define SCTP_MBCNT_LOGGING_ENABLE\t\t\t0x00000200\n#define SCTP_MBUF_LOGGING_ENABLE\t\t\t0x00000400\n#define SCTP_NAGLE_LOGGING_ENABLE\t\t\t0x00000800\n#define SCTP_RECV_RWND_LOGGING_ENABLE\t\t\t0x00001000\n#define SCTP_RTTVAR_LOGGING_ENABLE\t\t\t0x00002000\n#define SCTP_SACK_LOGGING_ENABLE\t\t\t0x00004000\n#define SCTP_SACK_RWND_LOGGING_ENABLE\t\t\t0x00008000\n#define SCTP_SB_LOGGING_ENABLE\t\t\t\t0x00010000\n#define SCTP_STR_LOGGING_ENABLE\t\t\t\t0x00020000\n#define SCTP_WAKE_LOGGING_ENABLE\t\t\t0x00040000\n#define SCTP_LOG_MAXBURST_ENABLE\t\t\t0x00080000\n#define SCTP_LOG_RWND_ENABLE    \t\t\t0x00100000\n#define SCTP_LOG_SACK_ARRIVALS_ENABLE\t\t\t0x00200000\n#define SCTP_LTRACE_CHUNK_ENABLE\t\t\t0x00400000\n#define SCTP_LTRACE_ERROR_ENABLE\t\t\t0x00800000\n#define SCTP_LAST_PACKET_TRACING\t\t\t0x01000000\n#define SCTP_THRESHOLD_LOGGING\t\t\t\t0x02000000\n#define SCTP_LOG_AT_SEND_2_SCTP\t\t\t\t0x04000000\n#define SCTP_LOG_AT_SEND_2_OUTQ\t\t\t\t0x08000000\n#define SCTP_LOG_TRY_ADVANCE\t\t\t\t0x10000000\n\n\n#undef SCTP_PACKED\n\n#endif\t\t\t\t/* !_NETINET_SCTP_H_ */\n"
  },
  {
    "path": "freebsd-headers/netinet/sctp_asconf.h",
    "content": "/*-\n * Copyright (c) 2001-2007, by Cisco Systems, Inc. All rights reserved.\n * Copyright (c) 2008-2011, by Randall Stewart. All rights reserved.\n * Copyright (c) 2008-2011, by Michael Tuexen. All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions are met:\n *\n * a) Redistributions of source code must retain the above copyright notice,\n *   this list of conditions and the following disclaimer.\n *\n * b) Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in\n *   the documentation and/or other materials provided with the distribution.\n *\n * c) Neither the name of Cisco Systems, Inc. nor the names of its\n *    contributors may be used to endorse or promote products derived\n *    from this software without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n * \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,\n * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE\n * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\n * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\n * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\n * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\n * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF\n * THE POSSIBILITY OF SUCH DAMAGE.\n */\n\n/* $KAME: sctp_asconf.h,v 1.8 2005/03/06 16:04:16 itojun Exp $\t */\n\n#include <sys/cdefs.h>\n__FBSDID(\"$FreeBSD: release/9.0.0/sys/netinet/sctp_asconf.h 218319 2011-02-05 12:12:51Z rrs $\");\n\n#ifndef _NETINET_SCTP_ASCONF_H_\n#define _NETINET_SCTP_ASCONF_H_\n\n#if defined(_KERNEL) || defined(__Userspace__)\n\n/*\n * function prototypes\n */\nextern void sctp_asconf_cleanup(struct sctp_tcb *, struct sctp_nets *);\n\nextern struct mbuf *sctp_compose_asconf(struct sctp_tcb *, int *, int);\n\nextern void\nsctp_handle_asconf(struct mbuf *, unsigned int, struct sctp_asconf_chunk *,\n    struct sctp_tcb *, int i);\n\nextern void\nsctp_handle_asconf_ack(struct mbuf *, int, struct sctp_asconf_ack_chunk *,\n    struct sctp_tcb *, struct sctp_nets *, int *);\n\nextern uint32_t\nsctp_addr_mgmt_ep_sa(struct sctp_inpcb *, struct sockaddr *,\n    uint32_t, uint32_t, struct sctp_ifa *);\n\n\nextern int \nsctp_asconf_iterator_ep(struct sctp_inpcb *inp, void *ptr,\n    uint32_t val);\nextern void \nsctp_asconf_iterator_stcb(struct sctp_inpcb *inp,\n    struct sctp_tcb *stcb,\n    void *ptr, uint32_t type);\nextern void sctp_asconf_iterator_end(void *ptr, uint32_t val);\n\n\nextern int32_t\nsctp_set_primary_ip_address_sa(struct sctp_tcb *,\n    struct sockaddr *);\n\nextern void\n     sctp_set_primary_ip_address(struct sctp_ifa *ifa);\n\nextern void\nsctp_check_address_list(struct sctp_tcb *, struct mbuf *, int, int,\n    struct sockaddr *, uint16_t, uint16_t, uint16_t, uint16_t);\n\nextern void\n     sctp_assoc_immediate_retrans(struct sctp_tcb *, struct sctp_nets *);\nextern void\n     sctp_net_immediate_retrans(struct sctp_tcb *, struct sctp_nets *);\n\nextern void\nsctp_asconf_send_nat_state_update(struct sctp_tcb *stcb,\n    struct sctp_nets *net);\n\nextern int\n    sctp_is_addr_pending(struct sctp_tcb *, struct sctp_ifa *);\n\n#endif\t\t\t\t/* _KERNEL */\n\n#endif\t\t\t\t/* !_NETINET_SCTP_ASCONF_H_ */\n"
  },
  {
    "path": "freebsd-headers/netinet/sctp_auth.h",
    "content": "/*-\n * Copyright (c) 2001-2008, by Cisco Systems, Inc. All rights reserved.\n * Copyright (c) 2008-2011, by Randall Stewart. All rights reserved.\n * Copyright (c) 2008-2011, by Michael Tuexen. All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions are met:\n *\n * a) Redistributions of source code must retain the above copyright notice,\n *   this list of conditions and the following disclaimer.\n *\n * b) Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in\n *   the documentation and/or other materials provided with the distribution.\n *\n * c) Neither the name of Cisco Systems, Inc. nor the names of its\n *    contributors may be used to endorse or promote products derived\n *    from this software without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n * \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,\n * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE\n * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\n * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\n * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\n * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\n * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF\n * THE POSSIBILITY OF SUCH DAMAGE.\n */\n\n#include <sys/cdefs.h>\n__FBSDID(\"$FreeBSD: release/9.0.0/sys/netinet/sctp_auth.h 221627 2011-05-08 09:11:59Z tuexen $\");\n\n#ifndef __SCTP_AUTH_H__\n#define __SCTP_AUTH_H__\n\n\n/* digest lengths */\n#define SCTP_AUTH_DIGEST_LEN_SHA1\t20\n#define SCTP_AUTH_DIGEST_LEN_SHA224\t28\n#define SCTP_AUTH_DIGEST_LEN_SHA256\t32\n#define SCTP_AUTH_DIGEST_LEN_SHA384\t48\n#define SCTP_AUTH_DIGEST_LEN_SHA512\t64\n#define SCTP_AUTH_DIGEST_LEN_MAX\t64\n\n/* random sizes */\n#define SCTP_AUTH_RANDOM_SIZE_DEFAULT\t32\n#define SCTP_AUTH_RANDOM_SIZE_REQUIRED\t32\n#define SCTP_AUTH_RANDOM_SIZE_MAX\t256\n\n/* union of all supported HMAC algorithm contexts */\ntypedef union sctp_hash_context {\n\tSHA1_CTX sha1;\n#ifdef HAVE_SHA2\n\tSHA256_CTX sha256;\n\tSHA384_CTX sha384;\n\tSHA512_CTX sha512;\n#endif\n}                 sctp_hash_context_t;\n\ntypedef struct sctp_key {\n\tuint32_t keylen;\n\tuint8_t key[];\n}        sctp_key_t;\n\ntypedef struct sctp_shared_key {\n\tLIST_ENTRY(sctp_shared_key) next;\n\tsctp_key_t *key;\t/* key text */\n\tuint32_t refcount;\t/* reference count */\n\tuint16_t keyid;\t\t/* shared key ID */\n\tuint8_t deactivated;\t/* key is deactivated */\n}               sctp_sharedkey_t;\n\nLIST_HEAD(sctp_keyhead, sctp_shared_key);\n\n/* authentication chunks list */\ntypedef struct sctp_auth_chklist {\n\tuint8_t chunks[256];\n\tuint8_t num_chunks;\n}                 sctp_auth_chklist_t;\n\n/* hmac algos supported list */\ntypedef struct sctp_hmaclist {\n\tuint16_t max_algo;\t/* max algorithms allocated */\n\tuint16_t num_algo;\t/* num algorithms used */\n\tuint16_t hmac[];\n}             sctp_hmaclist_t;\n\n/* authentication info */\ntypedef struct sctp_authinformation {\n\tsctp_key_t *random;\t/* local random key (concatenated) */\n\tuint32_t random_len;\t/* local random number length for param */\n\tsctp_key_t *peer_random;/* peer's random key (concatenated) */\n\tsctp_key_t *assoc_key;\t/* cached concatenated send key */\n\tsctp_key_t *recv_key;\t/* cached concatenated recv key */\n\tuint16_t active_keyid;\t/* active send keyid */\n\tuint16_t assoc_keyid;\t/* current send keyid (cached) */\n\tuint16_t recv_keyid;\t/* last recv keyid (cached) */\n}                    sctp_authinfo_t;\n\n\n\n/*\n * Macros\n */\n#define sctp_auth_is_required_chunk(chunk, list) ((list == NULL) ? (0) : (list->chunks[chunk] != 0))\n\n/*\n * function prototypes\n */\n\n/* socket option api functions */\nextern sctp_auth_chklist_t *sctp_alloc_chunklist(void);\nextern void sctp_free_chunklist(sctp_auth_chklist_t * chklist);\nextern void sctp_clear_chunklist(sctp_auth_chklist_t * chklist);\nextern sctp_auth_chklist_t *sctp_copy_chunklist(sctp_auth_chklist_t * chklist);\nextern int sctp_auth_add_chunk(uint8_t chunk, sctp_auth_chklist_t * list);\nextern int sctp_auth_delete_chunk(uint8_t chunk, sctp_auth_chklist_t * list);\nextern size_t sctp_auth_get_chklist_size(const sctp_auth_chklist_t * list);\nextern void sctp_auth_set_default_chunks(sctp_auth_chklist_t * list);\nextern int \nsctp_serialize_auth_chunks(const sctp_auth_chklist_t * list,\n    uint8_t * ptr);\nextern int \nsctp_pack_auth_chunks(const sctp_auth_chklist_t * list,\n    uint8_t * ptr);\nextern int \nsctp_unpack_auth_chunks(const uint8_t * ptr, uint8_t num_chunks,\n    sctp_auth_chklist_t * list);\n\n/* key handling */\nextern sctp_key_t *sctp_alloc_key(uint32_t keylen);\nextern void sctp_free_key(sctp_key_t * key);\nextern void sctp_print_key(sctp_key_t * key, const char *str);\nextern void sctp_show_key(sctp_key_t * key, const char *str);\nextern sctp_key_t *sctp_generate_random_key(uint32_t keylen);\nextern sctp_key_t *sctp_set_key(uint8_t * key, uint32_t keylen);\nextern sctp_key_t *\nsctp_compute_hashkey(sctp_key_t * key1, sctp_key_t * key2,\n    sctp_key_t * shared);\n\n/* shared key handling */\nextern sctp_sharedkey_t *sctp_alloc_sharedkey(void);\nextern void sctp_free_sharedkey(sctp_sharedkey_t * skey);\nextern sctp_sharedkey_t *\nsctp_find_sharedkey(struct sctp_keyhead *shared_keys,\n    uint16_t key_id);\nextern int \nsctp_insert_sharedkey(struct sctp_keyhead *shared_keys,\n    sctp_sharedkey_t * new_skey);\nextern int \nsctp_copy_skeylist(const struct sctp_keyhead *src,\n    struct sctp_keyhead *dest);\n\n/* ref counts on shared keys, by key id */\nextern void sctp_auth_key_acquire(struct sctp_tcb *stcb, uint16_t keyid);\nextern void \nsctp_auth_key_release(struct sctp_tcb *stcb, uint16_t keyid,\n    int so_locked);\n\n\n/* hmac list handling */\nextern sctp_hmaclist_t *sctp_alloc_hmaclist(uint8_t num_hmacs);\nextern void sctp_free_hmaclist(sctp_hmaclist_t * list);\nextern int sctp_auth_add_hmacid(sctp_hmaclist_t * list, uint16_t hmac_id);\nextern sctp_hmaclist_t *sctp_copy_hmaclist(sctp_hmaclist_t * list);\nextern sctp_hmaclist_t *sctp_default_supported_hmaclist(void);\nextern uint16_t \nsctp_negotiate_hmacid(sctp_hmaclist_t * peer,\n    sctp_hmaclist_t * local);\nextern int sctp_serialize_hmaclist(sctp_hmaclist_t * list, uint8_t * ptr);\nextern int \nsctp_verify_hmac_param(struct sctp_auth_hmac_algo *hmacs,\n    uint32_t num_hmacs);\n\nextern sctp_authinfo_t *sctp_alloc_authinfo(void);\nextern void sctp_free_authinfo(sctp_authinfo_t * authinfo);\n\n/* keyed-HMAC functions */\nextern uint32_t sctp_get_auth_chunk_len(uint16_t hmac_algo);\nextern uint32_t sctp_get_hmac_digest_len(uint16_t hmac_algo);\nextern uint32_t \nsctp_hmac(uint16_t hmac_algo, uint8_t * key, uint32_t keylen,\n    uint8_t * text, uint32_t textlen, uint8_t * digest);\nextern int \nsctp_verify_hmac(uint16_t hmac_algo, uint8_t * key, uint32_t keylen,\n    uint8_t * text, uint32_t textlen, uint8_t * digest, uint32_t digestlen);\nextern uint32_t \nsctp_compute_hmac(uint16_t hmac_algo, sctp_key_t * key,\n    uint8_t * text, uint32_t textlen, uint8_t * digest);\nextern int sctp_auth_is_supported_hmac(sctp_hmaclist_t * list, uint16_t id);\n\n/* mbuf versions */\nextern uint32_t \nsctp_hmac_m(uint16_t hmac_algo, uint8_t * key, uint32_t keylen,\n    struct mbuf *m, uint32_t m_offset, uint8_t * digest, uint32_t trailer);\nextern uint32_t \nsctp_compute_hmac_m(uint16_t hmac_algo, sctp_key_t * key,\n    struct mbuf *m, uint32_t m_offset, uint8_t * digest);\n\n/*\n * authentication routines\n */\nextern void sctp_clear_cachedkeys(struct sctp_tcb *stcb, uint16_t keyid);\nextern void sctp_clear_cachedkeys_ep(struct sctp_inpcb *inp, uint16_t keyid);\nextern int sctp_delete_sharedkey(struct sctp_tcb *stcb, uint16_t keyid);\nextern int sctp_delete_sharedkey_ep(struct sctp_inpcb *inp, uint16_t keyid);\nextern int sctp_auth_setactivekey(struct sctp_tcb *stcb, uint16_t keyid);\nextern int sctp_auth_setactivekey_ep(struct sctp_inpcb *inp, uint16_t keyid);\nextern int sctp_deact_sharedkey(struct sctp_tcb *stcb, uint16_t keyid);\nextern int sctp_deact_sharedkey_ep(struct sctp_inpcb *inp, uint16_t keyid);\n\nextern void \nsctp_auth_get_cookie_params(struct sctp_tcb *stcb, struct mbuf *m,\n    uint32_t offset, uint32_t length);\nextern void \nsctp_fill_hmac_digest_m(struct mbuf *m, uint32_t auth_offset,\n    struct sctp_auth_chunk *auth, struct sctp_tcb *stcb, uint16_t key_id);\nextern struct mbuf *\nsctp_add_auth_chunk(struct mbuf *m, struct mbuf **m_end,\n    struct sctp_auth_chunk **auth_ret, uint32_t * offset,\n    struct sctp_tcb *stcb, uint8_t chunk);\nextern int \nsctp_handle_auth(struct sctp_tcb *stcb, struct sctp_auth_chunk *ch,\n    struct mbuf *m, uint32_t offset);\nextern void \nsctp_notify_authentication(struct sctp_tcb *stcb,\n    uint32_t indication, uint16_t keyid, uint16_t alt_keyid, int so_locked);\nextern int \nsctp_validate_init_auth_params(struct mbuf *m, int offset,\n    int limit);\nextern void \nsctp_initialize_auth_params(struct sctp_inpcb *inp,\n    struct sctp_tcb *stcb);\n\n/* test functions */\n#endif\t\t\t\t/* __SCTP_AUTH_H__ */\n"
  },
  {
    "path": "freebsd-headers/netinet/sctp_bsd_addr.h",
    "content": "/*-\n * Copyright (c) 2001-2007, by Cisco Systems, Inc. All rights reserved.\n * Copyright (c) 2008-2011, by Randall Stewart. All rights reserved.\n * Copyright (c) 2008-2011, by Michael Tuexen. All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions are met:\n *\n * a) Redistributions of source code must retain the above copyright notice,\n *   this list of conditions and the following disclaimer.\n *\n * b) Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in\n *   the documentation and/or other materials provided with the distribution.\n *\n * c) Neither the name of Cisco Systems, Inc. nor the names of its\n *    contributors may be used to endorse or promote products derived\n *    from this software without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n * \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,\n * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE\n * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\n * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\n * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\n * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\n * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF\n * THE POSSIBILITY OF SUCH DAMAGE.\n */\n\n#include <sys/cdefs.h>\n__FBSDID(\"$FreeBSD: release/9.0.0/sys/netinet/sctp_bsd_addr.h 218319 2011-02-05 12:12:51Z rrs $\");\n\n#ifndef __sctp_bsd_addr_h__\n#define __sctp_bsd_addr_h__\n#include <netinet/sctp_pcb.h>\n\n#if defined(_KERNEL) || defined(__Userspace__)\n\nextern struct iterator_control sctp_it_ctl;\nvoid sctp_wakeup_iterator(void);\n\nvoid sctp_startup_iterator(void);\n\n\n#ifdef INET6\nvoid sctp_gather_internal_ifa_flags(struct sctp_ifa *ifa);\n\n#endif\n\n#ifdef  SCTP_PACKET_LOGGING\n\nvoid sctp_packet_log(struct mbuf *m, int length);\nint sctp_copy_out_packet_log(uint8_t * target, int length);\n\n#endif\n\nvoid sctp_addr_change(struct ifaddr *ifa, int cmd);\n\nvoid sctp_add_or_del_interfaces(int (*pred) (struct ifnet *), int add);\n\n#endif\n#endif\n"
  },
  {
    "path": "freebsd-headers/netinet/sctp_constants.h",
    "content": "/*-\n * Copyright (c) 2001-2008, by Cisco Systems, Inc. All rights reserved.\n * Copyright (c) 2008-2011, by Randall Stewart. All rights reserved.\n * Copyright (c) 2008-2011, by Michael Tuexen. All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions are met:\n *\n * a) Redistributions of source code must retain the above copyright notice,\n *   this list of conditions and the following disclaimer.\n *\n * b) Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in\n *   the documentation and/or other materials provided with the distribution.\n *\n * c) Neither the name of Cisco Systems, Inc. nor the names of its\n *    contributors may be used to endorse or promote products derived\n *    from this software without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n * \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,\n * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE\n * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\n * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\n * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\n * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\n * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF\n * THE POSSIBILITY OF SUCH DAMAGE.\n */\n\n/* $KAME: sctp_constants.h,v 1.17 2005/03/06 16:04:17 itojun Exp $\t */\n\n#include <sys/cdefs.h>\n__FBSDID(\"$FreeBSD: release/9.0.0/sys/netinet/sctp_constants.h 225635 2011-09-17 08:50:29Z tuexen $\");\n\n#ifndef __sctp_constants_h__\n#define __sctp_constants_h__\n\n/* IANA assigned port number for SCTP over UDP encapsulation */\n/* For freebsd we cannot bind the port at\n * startup. Otherwise what will happen is\n * we really won't be bound. The user must\n * put it into the sysctl... or we need\n * to build a special timer for this to allow\n * us to wait 1 second or so after the system\n * comes up.\n */\n#define SCTP_OVER_UDP_TUNNELING_PORT 0\n/* Number of packets to get before sack sent by default */\n#define SCTP_DEFAULT_SACK_FREQ 2\n\n/* Address limit - This variable is calculated\n * based on an 65535 byte max ip packet. We take out 100 bytes\n * for the cookie, 40 bytes for a v6 header and 32\n * bytes for the init structure. A second init structure\n * for the init-ack and then finally a third one for the\n * imbedded init. This yeilds 100+40+(3 * 32) = 236 bytes.\n * This leaves 65299 bytes for addresses. We throw out the 299 bytes.\n * Now whatever we send in the INIT() we need to allow to get back in the\n * INIT-ACK plus all the values from INIT and INIT-ACK\n * listed in the cookie. Plus we need some overhead for\n * maybe copied parameters in the COOKIE. If we\n * allow 1080 addresses, and each side has 1080 V6 addresses\n * that will be 21600 bytes. In the INIT-ACK we will\n * see the INIT-ACK 21600 + 43200 in the cookie. This leaves\n * about 500 bytes slack for misc things in the cookie.\n */\n#define SCTP_ADDRESS_LIMIT 1080\n\n/* We need at least 2k of space for us, inits\n * larger than that lets abort.\n */\n#define SCTP_LARGEST_INIT_ACCEPTED (65535 - 2048)\n\n/* Number of addresses where we just skip the counting */\n#define SCTP_COUNT_LIMIT 40\n\n#define SCTP_ZERO_COPY_TICK_DELAY (((100 * hz) + 999) / 1000)\n#define SCTP_ZERO_COPY_SENDQ_TICK_DELAY (((100 * hz) + 999) / 1000)\n\n/* Number of ticks to delay before running\n * iterator on an address change.\n */\n#define SCTP_ADDRESS_TICK_DELAY 2\n\n#define SCTP_VERSION_STRING \"KAME-BSD 1.1\"\n/* #define SCTP_AUDITING_ENABLED 1 used for debug/auditing */\n#define SCTP_AUDIT_SIZE 256\n\n\n#define SCTP_KTRHEAD_NAME \"sctp_iterator\"\n#define SCTP_KTHREAD_PAGES 0\n\n#define SCTP_MCORE_NAME \"sctp_core_worker\"\n\n\n/* If you support Multi-VRF how big to\n * make the initial array of VRF's to.\n */\n#define SCTP_DEFAULT_VRF_SIZE 4\n\n/* constants for rto calc */\n#define sctp_align_safe_nocopy 0\n#define sctp_align_unsafe_makecopy 1\n\n/* JRS - Values defined for the HTCP algorithm */\n#define ALPHA_BASE\t(1<<7)\t/* 1.0 with shift << 7 */\n#define BETA_MIN\t(1<<6)\t/* 0.5 with shift << 7 */\n#define BETA_MAX\t102\t/* 0.8 with shift << 7 */\n\n/* Places that CWND log can happen from */\n#define SCTP_CWND_LOG_FROM_FR\t1\n#define SCTP_CWND_LOG_FROM_RTX\t2\n#define SCTP_CWND_LOG_FROM_BRST\t3\n#define SCTP_CWND_LOG_FROM_SS\t4\n#define SCTP_CWND_LOG_FROM_CA\t5\n#define SCTP_CWND_LOG_FROM_SAT\t6\n#define SCTP_BLOCK_LOG_INTO_BLK 7\n#define SCTP_BLOCK_LOG_OUTOF_BLK 8\n#define SCTP_BLOCK_LOG_CHECK     9\n#define SCTP_STR_LOG_FROM_INTO_STRD 10\n#define SCTP_STR_LOG_FROM_IMMED_DEL 11\n#define SCTP_STR_LOG_FROM_INSERT_HD 12\n#define SCTP_STR_LOG_FROM_INSERT_MD 13\n#define SCTP_STR_LOG_FROM_INSERT_TL 14\n#define SCTP_STR_LOG_FROM_MARK_TSN  15\n#define SCTP_STR_LOG_FROM_EXPRS_DEL 16\n#define SCTP_FR_LOG_BIGGEST_TSNS    17\n#define SCTP_FR_LOG_STRIKE_TEST     18\n#define SCTP_FR_LOG_STRIKE_CHUNK    19\n#define SCTP_FR_T3_TIMEOUT          20\n#define SCTP_MAP_PREPARE_SLIDE      21\n#define SCTP_MAP_SLIDE_FROM         22\n#define SCTP_MAP_SLIDE_RESULT       23\n#define SCTP_MAP_SLIDE_CLEARED\t    24\n#define SCTP_MAP_SLIDE_NONE         25\n#define SCTP_FR_T3_MARK_TIME        26\n#define SCTP_FR_T3_MARKED           27\n#define SCTP_FR_T3_STOPPED          28\n#define SCTP_FR_MARKED              30\n#define SCTP_CWND_LOG_NOADV_SS      31\n#define SCTP_CWND_LOG_NOADV_CA      32\n#define SCTP_MAX_BURST_APPLIED      33\n#define SCTP_MAX_IFP_APPLIED        34\n#define SCTP_MAX_BURST_ERROR_STOP   35\n#define SCTP_INCREASE_PEER_RWND     36\n#define SCTP_DECREASE_PEER_RWND     37\n#define SCTP_SET_PEER_RWND_VIA_SACK 38\n#define SCTP_LOG_MBCNT_INCREASE     39\n#define SCTP_LOG_MBCNT_DECREASE     40\n#define SCTP_LOG_MBCNT_CHKSET       41\n#define SCTP_LOG_NEW_SACK           42\n#define SCTP_LOG_TSN_ACKED          43\n#define SCTP_LOG_TSN_REVOKED        44\n#define SCTP_LOG_LOCK_TCB           45\n#define SCTP_LOG_LOCK_INP           46\n#define SCTP_LOG_LOCK_SOCK          47\n#define SCTP_LOG_LOCK_SOCKBUF_R     48\n#define SCTP_LOG_LOCK_SOCKBUF_S     49\n#define SCTP_LOG_LOCK_CREATE        50\n#define SCTP_LOG_INITIAL_RTT        51\n#define SCTP_LOG_RTTVAR             52\n#define SCTP_LOG_SBALLOC            53\n#define SCTP_LOG_SBFREE             54\n#define SCTP_LOG_SBRESULT           55\n#define SCTP_FR_DUPED               56\n#define SCTP_FR_MARKED_EARLY        57\n#define SCTP_FR_CWND_REPORT         58\n#define SCTP_FR_CWND_REPORT_START   59\n#define SCTP_FR_CWND_REPORT_STOP    60\n#define SCTP_CWND_LOG_FROM_SEND     61\n#define SCTP_CWND_INITIALIZATION    62\n#define SCTP_CWND_LOG_FROM_T3       63\n#define SCTP_CWND_LOG_FROM_SACK     64\n#define SCTP_CWND_LOG_NO_CUMACK     65\n#define SCTP_CWND_LOG_FROM_RESEND   66\n#define SCTP_FR_LOG_CHECK_STRIKE    67\n#define SCTP_SEND_NOW_COMPLETES     68\n#define SCTP_CWND_LOG_FILL_OUTQ_CALLED 69\n#define SCTP_CWND_LOG_FILL_OUTQ_FILLS  70\n#define SCTP_LOG_FREE_SENT             71\n#define SCTP_NAGLE_APPLIED          72\n#define SCTP_NAGLE_SKIPPED          73\n#define SCTP_WAKESND_FROM_SACK      74\n#define SCTP_WAKESND_FROM_FWDTSN    75\n#define SCTP_NOWAKE_FROM_SACK       76\n#define SCTP_CWNDLOG_PRESEND        77\n#define SCTP_CWNDLOG_ENDSEND        78\n#define SCTP_AT_END_OF_SACK         79\n#define SCTP_REASON_FOR_SC          80\n#define SCTP_BLOCK_LOG_INTO_BLKA    81\n#define SCTP_ENTER_USER_RECV        82\n#define SCTP_USER_RECV_SACKS        83\n#define SCTP_SORECV_BLOCKSA         84\n#define SCTP_SORECV_BLOCKSB         85\n#define SCTP_SORECV_DONE            86\n#define SCTP_SACK_RWND_UPDATE       87\n#define SCTP_SORECV_ENTER           88\n#define SCTP_SORECV_ENTERPL         89\n#define SCTP_MBUF_INPUT             90\n#define SCTP_MBUF_IALLOC            91\n#define SCTP_MBUF_IFREE             92\n#define SCTP_MBUF_ICOPY             93\n#define SCTP_MBUF_SPLIT             94\n#define SCTP_SORCV_FREECTL          95\n#define SCTP_SORCV_DOESCPY          96\n#define SCTP_SORCV_DOESLCK          97\n#define SCTP_SORCV_DOESADJ          98\n#define SCTP_SORCV_BOTWHILE         99\n#define SCTP_SORCV_PASSBF          100\n#define SCTP_SORCV_ADJD            101\n#define SCTP_UNKNOWN_MAX           102\n#define SCTP_RANDY_STUFF           103\n#define SCTP_RANDY_STUFF1          104\n#define SCTP_STRMOUT_LOG_ASSIGN\t   105\n#define SCTP_STRMOUT_LOG_SEND\t   106\n#define SCTP_FLIGHT_LOG_DOWN_CA    107\n#define SCTP_FLIGHT_LOG_UP         108\n#define SCTP_FLIGHT_LOG_DOWN_GAP   109\n#define SCTP_FLIGHT_LOG_DOWN_RSND  110\n#define SCTP_FLIGHT_LOG_UP_RSND    111\n#define SCTP_FLIGHT_LOG_DOWN_RSND_TO    112\n#define SCTP_FLIGHT_LOG_DOWN_WP    113\n#define SCTP_FLIGHT_LOG_UP_REVOKE  114\n#define SCTP_FLIGHT_LOG_DOWN_PDRP  115\n#define SCTP_FLIGHT_LOG_DOWN_PMTU  116\n#define SCTP_SACK_LOG_NORMAL\t   117\n#define SCTP_SACK_LOG_EXPRESS\t   118\n#define SCTP_MAP_TSN_ENTERS        119\n#define SCTP_THRESHOLD_CLEAR       120\n#define SCTP_THRESHOLD_INCR        121\n#define SCTP_FLIGHT_LOG_DWN_WP_FWD 122\n#define SCTP_FWD_TSN_CHECK         123\n#define SCTP_LOG_MAX_TYPES 124\n/*\n * To turn on various logging, you must first enable 'options KTR' and\n * you might want to bump the entires 'options KTR_ENTRIES=80000'.\n * To get something to log you define one of the logging defines.\n * (see LINT).\n *\n * This gets the compile in place, but you still need to turn the\n * logging flag on too in the sysctl (see in sctp.h).\n */\n\n#define SCTP_LOG_EVENT_UNKNOWN 0\n#define SCTP_LOG_EVENT_CWND  1\n#define SCTP_LOG_EVENT_BLOCK 2\n#define SCTP_LOG_EVENT_STRM  3\n#define SCTP_LOG_EVENT_FR    4\n#define SCTP_LOG_EVENT_MAP   5\n#define SCTP_LOG_EVENT_MAXBURST 6\n#define SCTP_LOG_EVENT_RWND  7\n#define SCTP_LOG_EVENT_MBCNT 8\n#define SCTP_LOG_EVENT_SACK  9\n#define SCTP_LOG_LOCK_EVENT 10\n#define SCTP_LOG_EVENT_RTT  11\n#define SCTP_LOG_EVENT_SB   12\n#define SCTP_LOG_EVENT_NAGLE 13\n#define SCTP_LOG_EVENT_WAKE 14\n#define SCTP_LOG_MISC_EVENT 15\n#define SCTP_LOG_EVENT_CLOSE 16\n#define SCTP_LOG_EVENT_MBUF 17\n#define SCTP_LOG_CHUNK_PROC 18\n#define SCTP_LOG_ERROR_RET  19\n\n#define SCTP_LOG_MAX_EVENT 20\n\n#define SCTP_LOCK_UNKNOWN 2\n\n\n/* number of associations by default for zone allocation */\n#define SCTP_MAX_NUM_OF_ASOC\t40000\n/* how many addresses per assoc remote and local */\n#define SCTP_SCALE_FOR_ADDR\t2\n\n/* default AUTO_ASCONF mode enable(1)/disable(0) value (sysctl) */\n#define SCTP_DEFAULT_AUTO_ASCONF\t1\n\n/* default MULTIPLE_ASCONF mode enable(1)/disable(0) value (sysctl) */\n#define SCTP_DEFAULT_MULTIPLE_ASCONFS\t0\n\n/* default MOBILITY_BASE mode enable(1)/disable(0) value (sysctl) */\n#define SCTP_DEFAULT_MOBILITY_BASE\t0\n\n/* default MOBILITY_FASTHANDOFF mode enable(1)/disable(0) value (sysctl) */\n#define SCTP_DEFAULT_MOBILITY_FASTHANDOFF\t0\n\n/*\n * Theshold for rwnd updates, we have to read (sb_hiwat >>\n * SCTP_RWND_HIWAT_SHIFT) before we will look to see if we need to send a\n * window update sack. When we look, we compare the last rwnd we sent vs the\n * current rwnd. It too must be greater than this value. Using 3 divdes the\n * hiwat by 8, so for 200k rwnd we need to read 24k. For a 64k rwnd we need\n * to read 8k. This seems about right.. I hope :-D.. we do set a\n * min of a MTU on it so if the rwnd is real small we will insist\n * on a full MTU of 1500 bytes.\n */\n#define SCTP_RWND_HIWAT_SHIFT 3\n\n/* How much of the rwnd must the\n * message be taking up to start partial delivery.\n * We calculate this by shifing the hi_water (recv_win)\n * left the following .. set to 1, when a message holds\n * 1/2 the rwnd. If we set it to 2 when a message holds\n * 1/4 the rwnd...etc..\n */\n\n#define SCTP_PARTIAL_DELIVERY_SHIFT 1\n\n/*\n * default HMAC for cookies, etc... use one of the AUTH HMAC id's\n * SCTP_HMAC is the HMAC_ID to use\n * SCTP_SIGNATURE_SIZE is the digest length\n */\n#define SCTP_HMAC\t\tSCTP_AUTH_HMAC_ID_SHA1\n#define SCTP_SIGNATURE_SIZE\tSCTP_AUTH_DIGEST_LEN_SHA1\n#define SCTP_SIGNATURE_ALOC_SIZE SCTP_SIGNATURE_SIZE\n\n/*\n * the SCTP protocol signature this includes the version number encoded in\n * the last 4 bits of the signature.\n */\n#define PROTO_SIGNATURE_A\t0x30000000\n#define SCTP_VERSION_NUMBER\t0x3\n\n#define MAX_TSN\t0xffffffff\n\n/* how many executions every N tick's */\n#define SCTP_ITERATOR_MAX_AT_ONCE 20\n\n/* number of clock ticks between iterator executions */\n#define SCTP_ITERATOR_TICKS 1\n\n/*\n * option: If you comment out the following you will receive the old behavior\n * of obeying cwnd for the fast retransmit algorithm. With this defined a FR\n * happens right away with-out waiting for the flightsize to drop below the\n * cwnd value (which is reduced by the FR to 1/2 the inflight packets).\n */\n#define SCTP_IGNORE_CWND_ON_FR 1\n\n/*\n * Adds implementors guide behavior to only use newest highest update in SACK\n * gap ack's to figure out if you need to stroke a chunk for FR.\n */\n#define SCTP_NO_FR_UNLESS_SEGMENT_SMALLER 1\n\n/* default max I can burst out after a fast retransmit, 0 disables it */\n#define SCTP_DEF_MAX_BURST 0\n#define SCTP_DEF_HBMAX_BURST 4\n#define SCTP_DEF_FRMAX_BURST 4\n\n/* RTO calculation flag to say if it\n * is safe to determine local lan or not.\n */\n#define SCTP_RTT_FROM_NON_DATA 0\n#define SCTP_RTT_FROM_DATA     1\n\n\n/* IP hdr (20/40) + 12+2+2 (enet) + sctp common 12 */\n#define SCTP_FIRST_MBUF_RESV 68\n/* Packet transmit states in the sent field */\n#define SCTP_DATAGRAM_UNSENT\t\t0\n#define SCTP_DATAGRAM_SENT\t\t1\n#define SCTP_DATAGRAM_RESEND1\t\t2\t/* not used (in code, but may\n\t\t\t\t\t\t * hit this value) */\n#define SCTP_DATAGRAM_RESEND2\t\t3\t/* not used (in code, but may\n\t\t\t\t\t\t * hit this value) */\n#define SCTP_DATAGRAM_RESEND\t\t4\n#define SCTP_DATAGRAM_ACKED\t\t10010\n#define SCTP_DATAGRAM_MARKED\t\t20010\n#define SCTP_FORWARD_TSN_SKIP\t\t30010\n\n/* chunk output send from locations */\n#define SCTP_OUTPUT_FROM_USR_SEND       0\n#define SCTP_OUTPUT_FROM_T3       \t1\n#define SCTP_OUTPUT_FROM_INPUT_ERROR    2\n#define SCTP_OUTPUT_FROM_CONTROL_PROC   3\n#define SCTP_OUTPUT_FROM_SACK_TMR       4\n#define SCTP_OUTPUT_FROM_SHUT_TMR       5\n#define SCTP_OUTPUT_FROM_HB_TMR         6\n#define SCTP_OUTPUT_FROM_SHUT_ACK_TMR   7\n#define SCTP_OUTPUT_FROM_ASCONF_TMR     8\n#define SCTP_OUTPUT_FROM_STRRST_TMR     9\n#define SCTP_OUTPUT_FROM_AUTOCLOSE_TMR  10\n#define SCTP_OUTPUT_FROM_EARLY_FR_TMR   11\n#define SCTP_OUTPUT_FROM_STRRST_REQ     12\n#define SCTP_OUTPUT_FROM_USR_RCVD       13\n#define SCTP_OUTPUT_FROM_COOKIE_ACK     14\n#define SCTP_OUTPUT_FROM_DRAIN          15\n#define SCTP_OUTPUT_FROM_CLOSING        16\n/* SCTP chunk types are moved sctp.h for application (NAT, FW) use */\n\n/* align to 32-bit sizes */\n#define SCTP_SIZE32(x)\t((((x)+3) >> 2) << 2)\n\n#define IS_SCTP_CONTROL(a) ((a)->chunk_type != SCTP_DATA)\n#define IS_SCTP_DATA(a) ((a)->chunk_type == SCTP_DATA)\n\n\n/* SCTP parameter types */\n/*************0x0000 series*************/\n#define SCTP_HEARTBEAT_INFO\t\t0x0001\n#define SCTP_IPV4_ADDRESS\t\t0x0005\n#define SCTP_IPV6_ADDRESS\t\t0x0006\n#define SCTP_STATE_COOKIE\t\t0x0007\n#define SCTP_UNRECOG_PARAM\t\t0x0008\n#define SCTP_COOKIE_PRESERVE\t\t0x0009\n#define SCTP_HOSTNAME_ADDRESS\t\t0x000b\n#define SCTP_SUPPORTED_ADDRTYPE\t\t0x000c\n\n/* draft-ietf-stewart-tsvwg-strreset-xxx */\n#define SCTP_STR_RESET_OUT_REQUEST\t0x000d\n#define SCTP_STR_RESET_IN_REQUEST\t0x000e\n#define SCTP_STR_RESET_TSN_REQUEST\t0x000f\n#define SCTP_STR_RESET_RESPONSE\t\t0x0010\n#define SCTP_STR_RESET_ADD_STREAMS\t0x0011\n\n#define SCTP_MAX_RESET_PARAMS 2\n#define SCTP_STREAM_RESET_TSN_DELTA    0x1000\n\n/*************0x4000 series*************/\n\n/*************0x8000 series*************/\n#define SCTP_ECN_CAPABLE\t\t0x8000\n\n/* draft-ietf-tsvwg-auth-xxx */\n#define SCTP_RANDOM\t\t\t0x8002\n#define SCTP_CHUNK_LIST\t\t\t0x8003\n#define SCTP_HMAC_LIST\t\t\t0x8004\n/*\n * draft-ietf-tsvwg-addip-sctp-xx param=0x8008  len=0xNNNN Byte | Byte | Byte\n * | Byte Byte | Byte ...\n *\n * Where each byte is a chunk type extension supported. For example, to support\n * all chunks one would have (in hex):\n *\n * 80 01 00 09 C0 C1 80 81 82 00 00 00\n *\n * Has the parameter. C0 = PR-SCTP    (RFC3758) C1, 80 = ASCONF (addip draft) 81\n * = Packet Drop 82 = Stream Reset 83 = Authentication\n */\n#define SCTP_SUPPORTED_CHUNK_EXT    0x8008\n\n/*************0xC000 series*************/\n#define SCTP_PRSCTP_SUPPORTED\t\t0xc000\n/* draft-ietf-tsvwg-addip-sctp */\n#define SCTP_ADD_IP_ADDRESS\t\t0xc001\n#define SCTP_DEL_IP_ADDRESS\t\t0xc002\n#define SCTP_ERROR_CAUSE_IND\t\t0xc003\n#define SCTP_SET_PRIM_ADDR\t\t0xc004\n#define SCTP_SUCCESS_REPORT\t\t0xc005\n#define SCTP_ULP_ADAPTATION\t\t0xc006\n/* behave-nat-draft */\n#define SCTP_HAS_NAT_SUPPORT            0xc007\n#define SCTP_NAT_VTAGS                  0xc008\n\n/* Notification error codes */\n#define SCTP_NOTIFY_DATAGRAM_UNSENT\t0x0001\n#define SCTP_NOTIFY_DATAGRAM_SENT\t0x0002\n#define SCTP_FAILED_THRESHOLD\t\t0x0004\n#define SCTP_HEARTBEAT_SUCCESS\t\t0x0008\n#define SCTP_RESPONSE_TO_USER_REQ\t0x0010\n#define SCTP_INTERNAL_ERROR\t\t0x0020\n#define SCTP_SHUTDOWN_GUARD_EXPIRES\t0x0040\n#define SCTP_RECEIVED_SACK\t\t0x0080\n#define SCTP_PEER_FAULTY\t\t0x0100\n#define SCTP_ICMP_REFUSED\t\t0x0200\n\n/* bits for TOS field */\n#define SCTP_ECT0_BIT\t\t0x02\n#define SCTP_ECT1_BIT\t\t0x01\n#define SCTP_CE_BITS\t\t0x03\n\n/* below turns off above */\n#define SCTP_FLEXIBLE_ADDRESS\t0x20\n#define SCTP_NO_HEARTBEAT\t0x40\n\n/* mask to get sticky */\n#define SCTP_STICKY_OPTIONS_MASK\t0x0c\n\n\n/*\n * SCTP states for internal state machine XXX (should match \"user\" values)\n */\n#define SCTP_STATE_EMPTY\t\t0x0000\n#define SCTP_STATE_INUSE\t\t0x0001\n#define SCTP_STATE_COOKIE_WAIT\t\t0x0002\n#define SCTP_STATE_COOKIE_ECHOED\t0x0004\n#define SCTP_STATE_OPEN\t\t\t0x0008\n#define SCTP_STATE_SHUTDOWN_SENT\t0x0010\n#define SCTP_STATE_SHUTDOWN_RECEIVED\t0x0020\n#define SCTP_STATE_SHUTDOWN_ACK_SENT\t0x0040\n#define SCTP_STATE_SHUTDOWN_PENDING\t0x0080\n#define SCTP_STATE_CLOSED_SOCKET\t0x0100\n#define SCTP_STATE_ABOUT_TO_BE_FREED    0x0200\n#define SCTP_STATE_PARTIAL_MSG_LEFT     0x0400\n#define SCTP_STATE_WAS_ABORTED          0x0800\n#define SCTP_STATE_IN_ACCEPT_QUEUE      0x1000\n#define SCTP_STATE_MASK\t\t\t0x007f\n\n#define SCTP_GET_STATE(asoc)\t((asoc)->state & SCTP_STATE_MASK)\n#define SCTP_SET_STATE(asoc, newstate)  ((asoc)->state = ((asoc)->state & ~SCTP_STATE_MASK) |  newstate)\n#define SCTP_CLEAR_SUBSTATE(asoc, substate) ((asoc)->state &= ~substate)\n#define SCTP_ADD_SUBSTATE(asoc, substate) ((asoc)->state |= substate)\n\n/* SCTP reachability state for each address */\n#define SCTP_ADDR_REACHABLE\t\t0x001\n#define SCTP_ADDR_NO_PMTUD              0x002\n#define SCTP_ADDR_NOHB\t\t\t0x004\n#define SCTP_ADDR_BEING_DELETED\t\t0x008\n#define SCTP_ADDR_NOT_IN_ASSOC\t\t0x010\n#define SCTP_ADDR_OUT_OF_SCOPE\t\t0x080\n#define SCTP_ADDR_UNCONFIRMED\t\t0x200\n#define SCTP_ADDR_REQ_PRIMARY           0x400\n/* JRS 5/13/07 - Added potentially failed state for CMT PF */\n#define SCTP_ADDR_PF                    0x800\n\n/* bound address types (e.g. valid address types to allow) */\n#define SCTP_BOUND_V6\t\t0x01\n#define SCTP_BOUND_V4\t\t0x02\n\n/*\n * what is the default number of mbufs in a chain I allow before switching to\n * a cluster\n */\n#define SCTP_DEFAULT_MBUFS_IN_CHAIN 5\n\n/* How long a cookie lives in milli-seconds */\n#define SCTP_DEFAULT_COOKIE_LIFE\t60000\n\n/* resource limit of streams */\n#define MAX_SCTP_STREAMS\t2048\n\n/* Maximum the mapping array will  grow to (TSN mapping array) */\n#define SCTP_MAPPING_ARRAY\t512\n\n/* size of the inital malloc on the mapping array */\n#define SCTP_INITIAL_MAPPING_ARRAY  16\n/* how much we grow the mapping array each call */\n#define SCTP_MAPPING_ARRAY_INCR     32\n\n/*\n * Here we define the timer types used by the implementation as arguments in\n * the set/get timer type calls.\n */\n#define SCTP_TIMER_INIT \t0\n#define SCTP_TIMER_RECV \t1\n#define SCTP_TIMER_SEND \t2\n#define SCTP_TIMER_HEARTBEAT\t3\n#define SCTP_TIMER_PMTU\t\t4\n#define SCTP_TIMER_MAXSHUTDOWN\t5\n#define SCTP_TIMER_SIGNATURE\t6\n/*\n * number of timer types in the base SCTP structure used in the set/get and\n * has the base default.\n */\n#define SCTP_NUM_TMRS\t7\n\n/* timer types */\n#define SCTP_TIMER_TYPE_NONE\t\t0\n#define SCTP_TIMER_TYPE_SEND\t\t1\n#define SCTP_TIMER_TYPE_INIT\t\t2\n#define SCTP_TIMER_TYPE_RECV\t\t3\n#define SCTP_TIMER_TYPE_SHUTDOWN\t4\n#define SCTP_TIMER_TYPE_HEARTBEAT\t5\n#define SCTP_TIMER_TYPE_COOKIE\t\t6\n#define SCTP_TIMER_TYPE_NEWCOOKIE\t7\n#define SCTP_TIMER_TYPE_PATHMTURAISE\t8\n#define SCTP_TIMER_TYPE_SHUTDOWNACK\t9\n#define SCTP_TIMER_TYPE_ASCONF\t\t10\n#define SCTP_TIMER_TYPE_SHUTDOWNGUARD\t11\n#define SCTP_TIMER_TYPE_AUTOCLOSE\t12\n#define SCTP_TIMER_TYPE_EVENTWAKE\t13\n#define SCTP_TIMER_TYPE_STRRESET        14\n#define SCTP_TIMER_TYPE_INPKILL         15\n#define SCTP_TIMER_TYPE_ASOCKILL        16\n#define SCTP_TIMER_TYPE_ADDR_WQ         17\n#define SCTP_TIMER_TYPE_ZERO_COPY       18\n#define SCTP_TIMER_TYPE_ZCOPY_SENDQ     19\n#define SCTP_TIMER_TYPE_PRIM_DELETED    20\n/* add new timers here - and increment LAST */\n#define SCTP_TIMER_TYPE_LAST            21\n\n#define SCTP_IS_TIMER_TYPE_VALID(t)\t(((t) > SCTP_TIMER_TYPE_NONE) && \\\n\t\t\t\t\t ((t) < SCTP_TIMER_TYPE_LAST))\n\n\n\n/* max number of TSN's dup'd that I will hold */\n#define SCTP_MAX_DUP_TSNS\t20\n\n/*\n * Here we define the types used when setting the retry amounts.\n */\n/* How many drop re-attempts we make on  INIT/COOKIE-ECHO */\n#define SCTP_RETRY_DROPPED_THRESH 4\n\n/*\n * Maxmium number of chunks a single association can have on it. Note that\n * this is a squishy number since the count can run over this if the user\n * sends a large message down .. the fragmented chunks don't count until\n * AFTER the message is on queue.. it would be the next send that blocks\n * things. This number will get tuned up at boot in the sctp_init and use the\n * number of clusters as a base. This way high bandwidth environments will\n * not get impacted by the lower bandwidth sending a bunch of 1 byte chunks\n */\n#define SCTP_ASOC_MAX_CHUNKS_ON_QUEUE 512\n\n\n/* The conversion from time to ticks and vice versa is done by rounding\n * upwards. This way we can test in the code the time to be positive and\n * know that this corresponds to a positive number of ticks.\n */\n#define MSEC_TO_TICKS(x) ((hz == 1000) ? x : ((((x) * hz) + 999) / 1000))\n#define TICKS_TO_MSEC(x) ((hz == 1000) ? x : ((((x) * 1000) + (hz - 1)) / hz))\n\n#define SEC_TO_TICKS(x) ((x) * hz)\n#define TICKS_TO_SEC(x) (((x) + (hz - 1)) / hz)\n\n/*\n * Basically the minimum amount of time before I do a early FR. Making this\n * value to low will cause duplicate retransmissions.\n */\n#define SCTP_MINFR_MSEC_TIMER 250\n/* The floor this value is allowed to fall to when starting a timer. */\n#define SCTP_MINFR_MSEC_FLOOR 20\n\n/* init timer def = 1 sec */\n#define SCTP_INIT_SEC\t1\n\n/* send timer def = 1 seconds */\n#define SCTP_SEND_SEC\t1\n\n/* recv timer def = 200ms  */\n#define SCTP_RECV_MSEC\t200\n\n/* 30 seconds + RTO (in ms) */\n#define SCTP_HB_DEFAULT_MSEC\t30000\n\n/* Max time I will wait for Shutdown to complete */\n#define SCTP_DEF_MAX_SHUTDOWN_SEC 180\n\n\n/*\n * This is how long a secret lives, NOT how long a cookie lives how many\n * ticks the current secret will live.\n */\n#define SCTP_DEFAULT_SECRET_LIFE_SEC 3600\n\n#define SCTP_RTO_UPPER_BOUND\t(60000)\t/* 60 sec in ms */\n#define SCTP_RTO_LOWER_BOUND\t(1000)\t/* 1 sec is ms */\n#define SCTP_RTO_INITIAL\t(3000)\t/* 3 sec in ms */\n\n\n#define SCTP_INP_KILL_TIMEOUT 20/* number of ms to retry kill of inpcb */\n#define SCTP_ASOC_KILL_TIMEOUT 10\t/* number of ms to retry kill of inpcb */\n\n#define SCTP_DEF_MAX_INIT\t\t8\n#define SCTP_DEF_MAX_SEND\t\t10\n#define SCTP_DEF_MAX_PATH_RTX\t\t5\n#define SCTP_DEF_PATH_PF_THRESHOLD\tSCTP_DEF_MAX_PATH_RTX\n\n#define SCTP_DEF_PMTU_RAISE_SEC\t600\t/* 10 min between raise attempts */\n\n\n/* How many streams I request initally by default */\n#define SCTP_OSTREAM_INITIAL 10\n\n/*\n * How many smallest_mtu's need to increase before a window update sack is\n * sent (should be a power of 2).\n */\n/* Send window update (incr * this > hiwat). Should be a power of 2 */\n#define SCTP_MINIMAL_RWND\t\t(4096)\t/* minimal rwnd */\n\n#define SCTP_ADDRMAX\t\t16\n\n/* SCTP DEBUG Switch parameters */\n#define SCTP_DEBUG_TIMER1\t0x00000001\n#define SCTP_DEBUG_TIMER2\t0x00000002\t/* unused */\n#define SCTP_DEBUG_TIMER3\t0x00000004\t/* unused */\n#define SCTP_DEBUG_TIMER4\t0x00000008\n#define SCTP_DEBUG_OUTPUT1\t0x00000010\n#define SCTP_DEBUG_OUTPUT2\t0x00000020\n#define SCTP_DEBUG_OUTPUT3\t0x00000040\n#define SCTP_DEBUG_OUTPUT4\t0x00000080\n#define SCTP_DEBUG_UTIL1\t0x00000100\n#define SCTP_DEBUG_UTIL2\t0x00000200\t/* unused */\n#define SCTP_DEBUG_AUTH1\t0x00000400\n#define SCTP_DEBUG_AUTH2\t0x00000800\t/* unused */\n#define SCTP_DEBUG_INPUT1\t0x00001000\n#define SCTP_DEBUG_INPUT2\t0x00002000\n#define SCTP_DEBUG_INPUT3\t0x00004000\n#define SCTP_DEBUG_INPUT4\t0x00008000\t/* unused */\n#define SCTP_DEBUG_ASCONF1\t0x00010000\n#define SCTP_DEBUG_ASCONF2\t0x00020000\n#define SCTP_DEBUG_OUTPUT5\t0x00040000\t/* unused */\n#define SCTP_DEBUG_XXX\t\t0x00080000\t/* unused */\n#define SCTP_DEBUG_PCB1\t\t0x00100000\n#define SCTP_DEBUG_PCB2\t\t0x00200000\t/* unused */\n#define SCTP_DEBUG_PCB3\t\t0x00400000\n#define SCTP_DEBUG_PCB4\t\t0x00800000\n#define SCTP_DEBUG_INDATA1\t0x01000000\n#define SCTP_DEBUG_INDATA2\t0x02000000\t/* unused */\n#define SCTP_DEBUG_INDATA3\t0x04000000\t/* unused */\n#define SCTP_DEBUG_CRCOFFLOAD\t0x08000000\t/* unused */\n#define SCTP_DEBUG_USRREQ1\t0x10000000\t/* unused */\n#define SCTP_DEBUG_USRREQ2\t0x20000000\t/* unused */\n#define SCTP_DEBUG_PEEL1\t0x40000000\n#define SCTP_DEBUG_XXXXX\t0x80000000\t/* unused */\n#define SCTP_DEBUG_ALL\t\t0x7ff3ffff\n#define SCTP_DEBUG_NOISY\t0x00040000\n\n/* What sender needs to see to avoid SWS or we consider peers rwnd 0 */\n#define SCTP_SWS_SENDER_DEF\t1420\n\n/*\n * SWS is scaled to the sb_hiwat of the socket. A value of 2 is hiwat/4, 1\n * would be hiwat/2 etc.\n */\n/* What receiver needs to see in sockbuf or we tell peer its 1 */\n#define SCTP_SWS_RECEIVER_DEF\t3000\n\n#define SCTP_INITIAL_CWND 4380\n\n#define SCTP_DEFAULT_MTU 1500\t/* emergency default MTU */\n/* amount peer is obligated to have in rwnd or I will abort */\n#define SCTP_MIN_RWND\t1500\n\n#define SCTP_DEFAULT_MAXSEGMENT 65535\n\n#define SCTP_CHUNK_BUFFER_SIZE\t512\n#define SCTP_PARAM_BUFFER_SIZE\t512\n\n/* small chunk store for looking at chunk_list in auth */\n#define SCTP_SMALL_CHUNK_STORE 260\n\n#define SCTP_DEFAULT_MINSEGMENT 512\t/* MTU size ... if no mtu disc */\n#define SCTP_HOW_MANY_SECRETS\t2\t/* how many secrets I keep */\n\n#define SCTP_NUMBER_OF_SECRETS\t8\t/* or 8 * 4 = 32 octets */\n#define SCTP_SECRET_SIZE\t32\t/* number of octets in a 256 bits */\n\n\n/*\n * SCTP upper layer notifications\n */\n#define SCTP_NOTIFY_ASSOC_UP                     1\n#define SCTP_NOTIFY_ASSOC_DOWN                   2\n#define SCTP_NOTIFY_INTERFACE_DOWN               3\n#define SCTP_NOTIFY_INTERFACE_UP                 4\n#define SCTP_NOTIFY_DG_FAIL                      5\n#define SCTP_NOTIFY_STRDATA_ERR                  6\n#define SCTP_NOTIFY_ASSOC_ABORTED                7\n#define SCTP_NOTIFY_PEER_OPENED_STREAM           8\n#define SCTP_NOTIFY_STREAM_OPENED_OK             9\n#define SCTP_NOTIFY_ASSOC_RESTART               10\n#define SCTP_NOTIFY_HB_RESP                     11\n#define SCTP_NOTIFY_ASCONF_SUCCESS              12\n#define SCTP_NOTIFY_ASCONF_FAILED               13\n#define SCTP_NOTIFY_PEER_SHUTDOWN               14\n#define SCTP_NOTIFY_ASCONF_ADD_IP               15\n#define SCTP_NOTIFY_ASCONF_DELETE_IP            16\n#define SCTP_NOTIFY_ASCONF_SET_PRIMARY          17\n#define SCTP_NOTIFY_PARTIAL_DELVIERY_INDICATION 18\n#define SCTP_NOTIFY_INTERFACE_CONFIRMED         20\n#define SCTP_NOTIFY_STR_RESET_RECV              21\n#define SCTP_NOTIFY_STR_RESET_SEND              22\n#define SCTP_NOTIFY_STR_RESET_FAILED_OUT        23\n#define SCTP_NOTIFY_STR_RESET_FAILED_IN         24\n#define SCTP_NOTIFY_AUTH_NEW_KEY                25\n#define SCTP_NOTIFY_AUTH_FREE_KEY               26\n#define SCTP_NOTIFY_SPECIAL_SP_FAIL             27\n#define SCTP_NOTIFY_NO_PEER_AUTH                28\n#define SCTP_NOTIFY_SENDER_DRY                  29\n#define SCTP_NOTIFY_STR_RESET_ADD_OK            30\n#define SCTP_NOTIFY_STR_RESET_ADD_FAIL          31\n#define SCTP_NOTIFY_STR_RESET_INSTREAM_ADD_OK   32\n#define SCTP_NOTIFY_MAX                         32\n\n\n/* This is the value for messages that are NOT completely\n * copied down where we will start to split the message.\n * So, with our default, we split only if the piece we\n * want to take will fill up a full MTU (assuming\n * a 1500 byte MTU).\n */\n#define SCTP_DEFAULT_SPLIT_POINT_MIN 2904\n\n/* ABORT CODES and other tell-tale location\n * codes are generated by adding the below\n * to the instance id.\n */\n\n/* File defines */\n#define SCTP_FROM_SCTP_INPUT   0x10000000\n#define SCTP_FROM_SCTP_PCB     0x20000000\n#define SCTP_FROM_SCTP_INDATA  0x30000000\n#define SCTP_FROM_SCTP_TIMER   0x40000000\n#define SCTP_FROM_SCTP_USRREQ  0x50000000\n#define SCTP_FROM_SCTPUTIL     0x60000000\n#define SCTP_FROM_SCTP6_USRREQ 0x70000000\n#define SCTP_FROM_SCTP_ASCONF  0x80000000\n#define SCTP_FROM_SCTP_OUTPUT  0x90000000\n#define SCTP_FROM_SCTP_PEELOFF 0xa0000000\n#define SCTP_FROM_SCTP_PANDA   0xb0000000\n#define SCTP_FROM_SCTP_SYSCTL  0xc0000000\n\n/* Location ID's */\n#define SCTP_LOC_1  0x00000001\n#define SCTP_LOC_2  0x00000002\n#define SCTP_LOC_3  0x00000003\n#define SCTP_LOC_4  0x00000004\n#define SCTP_LOC_5  0x00000005\n#define SCTP_LOC_6  0x00000006\n#define SCTP_LOC_7  0x00000007\n#define SCTP_LOC_8  0x00000008\n#define SCTP_LOC_9  0x00000009\n#define SCTP_LOC_10 0x0000000a\n#define SCTP_LOC_11 0x0000000b\n#define SCTP_LOC_12 0x0000000c\n#define SCTP_LOC_13 0x0000000d\n#define SCTP_LOC_14 0x0000000e\n#define SCTP_LOC_15 0x0000000f\n#define SCTP_LOC_16 0x00000010\n#define SCTP_LOC_17 0x00000011\n#define SCTP_LOC_18 0x00000012\n#define SCTP_LOC_19 0x00000013\n#define SCTP_LOC_20 0x00000014\n#define SCTP_LOC_21 0x00000015\n#define SCTP_LOC_22 0x00000016\n#define SCTP_LOC_23 0x00000017\n#define SCTP_LOC_24 0x00000018\n#define SCTP_LOC_25 0x00000019\n#define SCTP_LOC_26 0x0000001a\n#define SCTP_LOC_27 0x0000001b\n#define SCTP_LOC_28 0x0000001c\n#define SCTP_LOC_29 0x0000001d\n#define SCTP_LOC_30 0x0000001e\n#define SCTP_LOC_31 0x0000001f\n#define SCTP_LOC_32 0x00000020\n#define SCTP_LOC_33 0x00000021\n\n\n/* Free assoc codes */\n#define SCTP_NORMAL_PROC      0\n#define SCTP_PCBFREE_NOFORCE  1\n#define SCTP_PCBFREE_FORCE    2\n\n/* From codes for adding addresses */\n#define SCTP_ADDR_IS_CONFIRMED 8\n#define SCTP_ADDR_DYNAMIC_ADDED 6\n#define SCTP_IN_COOKIE_PROC 100\n#define SCTP_ALLOC_ASOC  1\n#define SCTP_LOAD_ADDR_2 2\n#define SCTP_LOAD_ADDR_3 3\n#define SCTP_LOAD_ADDR_4 4\n#define SCTP_LOAD_ADDR_5 5\n\n#define SCTP_DONOT_SETSCOPE 0\n#define SCTP_DO_SETSCOPE 1\n\n\n/* This value determines the default for when\n * we try to add more on the send queue., if\n * there is room. This prevents us from cycling\n * into the copy_resume routine to often if\n * we have not got enough space to add a decent\n * enough size message. Note that if we have enough\n * space to complete the message copy we will always\n * add to the message, no matter what the size. Its\n * only when we reach the point that we have some left\n * to add, there is only room for part of it that we\n * will use this threshold. Its also a sysctl.\n */\n#define SCTP_DEFAULT_ADD_MORE 1452\n\n#ifndef SCTP_PCBHASHSIZE\n/* default number of association hash buckets in each endpoint */\n#define SCTP_PCBHASHSIZE 256\n#endif\n#ifndef SCTP_TCBHASHSIZE\n#define SCTP_TCBHASHSIZE 1024\n#endif\n\n#ifndef SCTP_CHUNKQUEUE_SCALE\n#define SCTP_CHUNKQUEUE_SCALE 10\n#endif\n\n/* clock variance is 1 ms */\n#define SCTP_CLOCK_GRANULARITY\t1\n#define IP_HDR_SIZE 40\t\t/* we use the size of a IP6 header here this\n\t\t\t\t * detracts a small amount for ipv4 but it\n\t\t\t\t * simplifies the ipv6 addition */\n\n/* Argument magic number for sctp_inpcb_free() */\n\n/* third argument */\n#define SCTP_CALLED_DIRECTLY_NOCMPSET     0\n#define SCTP_CALLED_AFTER_CMPSET_OFCLOSE  1\n#define SCTP_CALLED_FROM_INPKILL_TIMER    2\n/* second argument */\n#define SCTP_FREE_SHOULD_USE_ABORT          1\n#define SCTP_FREE_SHOULD_USE_GRACEFUL_CLOSE 0\n\n#ifndef IPPROTO_SCTP\n#define IPPROTO_SCTP 132\t/* the Official IANA number :-) */\n#endif\t\t\t\t/* !IPPROTO_SCTP */\n\n#define SCTP_MAX_DATA_BUNDLING\t\t256\n\n/* modular comparison */\n/* See RFC 1982 for details. */\n#define SCTP_SSN_GT(a, b) (((a < b) && ((uint16_t)(b - a) > (1U<<15))) || \\\n                           ((a > b) && ((uint16_t)(a - b) < (1U<<15))))\n#define SCTP_SSN_GE(a, b) (SCTP_SSN_GT(a, b) || (a == b))\n#define SCTP_TSN_GT(a, b) (((a < b) && ((uint32_t)(b - a) > (1U<<31))) || \\\n                           ((a > b) && ((uint32_t)(a - b) < (1U<<31))))\n#define SCTP_TSN_GE(a, b) (SCTP_TSN_GT(a, b) || (a == b))\n\n/* Mapping array manipulation routines */\n#define SCTP_IS_TSN_PRESENT(arry, gap) ((arry[(gap >> 3)] >> (gap & 0x07)) & 0x01)\n#define SCTP_SET_TSN_PRESENT(arry, gap) (arry[(gap >> 3)] |= (0x01 << ((gap & 0x07))))\n#define SCTP_UNSET_TSN_PRESENT(arry, gap) (arry[(gap >> 3)] &= ((~(0x01 << ((gap & 0x07)))) & 0xff))\n#define SCTP_CALC_TSN_TO_GAP(gap, tsn, mapping_tsn) do { \\\n\t                if (tsn >= mapping_tsn) { \\\n\t\t\t\t\t\tgap = tsn - mapping_tsn; \\\n\t\t\t\t\t} else { \\\n\t\t\t\t\t\tgap = (MAX_TSN - mapping_tsn) + tsn + 1; \\\n\t\t\t\t\t} \\\n                  } while(0)\n\n\n#define SCTP_RETRAN_DONE -1\n#define SCTP_RETRAN_EXIT -2\n\n/*\n * This value defines the number of vtag block time wait entry's per list\n * element.  Each entry will take 2 4 byte ints (and of course the overhead\n * of the next pointer as well). Using 15 as an example will yield * ((8 *\n * 15) + 8) or 128 bytes of overhead for each timewait block that gets\n * initialized. Increasing it to 31 would yeild 256 bytes per block.\n */\n#define SCTP_NUMBER_IN_VTAG_BLOCK 15\n/*\n * If we use the STACK option, we have an array of this size head pointers.\n * This array is mod'd the with the size to find which bucket and then all\n * entries must be searched to see if the tag is in timed wait. If so we\n * reject it.\n */\n#define SCTP_STACK_VTAG_HASH_SIZE   32\n\n/*\n * Number of seconds of time wait for a vtag.\n */\n#define SCTP_TIME_WAIT 60\n\n/* How many micro seconds is the cutoff from\n * local lan type rtt's\n */\n /*\n  * We allow 900us for the rtt.\n  */\n#define SCTP_LOCAL_LAN_RTT 900\n#define SCTP_LAN_UNKNOWN  0\n#define SCTP_LAN_LOCAL    1\n#define SCTP_LAN_INTERNET 2\n\n#define SCTP_SEND_BUFFER_SPLITTING 0x00000001\n#define SCTP_RECV_BUFFER_SPLITTING 0x00000002\n\n/* The system retains a cache of free chunks such to\n * cut down on calls the memory allocation system. There\n * is a per association limit of free items and a overall\n * system limit. If either one gets hit then the resource\n * stops being cached.\n */\n\n#define SCTP_DEF_ASOC_RESC_LIMIT 10\n#define SCTP_DEF_SYSTEM_RESC_LIMIT 1000\n\n/*-\n * defines for socket lock states.\n * Used by __APPLE__ and SCTP_SO_LOCK_TESTING\n */\n#define SCTP_SO_LOCKED\t\t1\n#define SCTP_SO_NOT_LOCKED\t0\n\n\n#define SCTP_HOLDS_LOCK 1\n#define SCTP_NOT_LOCKED 0\n\n/*-\n * For address locks, do we hold the lock?\n */\n#define SCTP_ADDR_LOCKED 1\n#define SCTP_ADDR_NOT_LOCKED 0\n\n#define IN4_ISPRIVATE_ADDRESS(a) \\\n   ((((uint8_t *)&(a)->s_addr)[0] == 10) || \\\n    ((((uint8_t *)&(a)->s_addr)[0] == 172) && \\\n     (((uint8_t *)&(a)->s_addr)[1] >= 16) && \\\n     (((uint8_t *)&(a)->s_addr)[1] <= 32)) || \\\n    ((((uint8_t *)&(a)->s_addr)[0] == 192) && \\\n     (((uint8_t *)&(a)->s_addr)[1] == 168)))\n\n#define IN4_ISLOOPBACK_ADDRESS(a) \\\n    ((((uint8_t *)&(a)->s_addr)[0] == 127) && \\\n     (((uint8_t *)&(a)->s_addr)[1] == 0) && \\\n     (((uint8_t *)&(a)->s_addr)[2] == 0) && \\\n     (((uint8_t *)&(a)->s_addr)[3] == 1))\n\n\n#if defined(_KERNEL)\n\n#define SCTP_GETTIME_TIMESPEC(x) (getnanouptime(x))\n#define SCTP_GETTIME_TIMEVAL(x)\t(getmicrouptime(x))\n#define SCTP_GETPTIME_TIMEVAL(x)\t(microuptime(x))\n#endif\n/*#if defined(__FreeBSD__) || defined(__APPLE__)*/\n/*#define SCTP_GETTIME_TIMEVAL(x) { \\*/\n/*\t(x)->tv_sec = ticks / 1000; \\*/\n/*\t(x)->tv_usec = (ticks % 1000) * 1000; \\*/\n/*}*/\n\n/*#else*/\n/*#define SCTP_GETTIME_TIMEVAL(x)\t(microtime(x))*/\n/*#endif\t\t\t\t __FreeBSD__ */\n\n#if defined(_KERNEL) || defined(__Userspace__)\n#define sctp_sowwakeup(inp, so) \\\ndo { \\\n\tif (inp->sctp_flags & SCTP_PCB_FLAGS_DONT_WAKE) { \\\n\t\tinp->sctp_flags |= SCTP_PCB_FLAGS_WAKEOUTPUT; \\\n\t} else { \\\n\t\tsowwakeup(so); \\\n\t} \\\n} while (0)\n\n#define sctp_sowwakeup_locked(inp, so) \\\ndo { \\\n\tif (inp->sctp_flags & SCTP_PCB_FLAGS_DONT_WAKE) { \\\n                SOCKBUF_UNLOCK(&((so)->so_snd)); \\\n\t\tinp->sctp_flags |= SCTP_PCB_FLAGS_WAKEOUTPUT; \\\n\t} else { \\\n\t\tsowwakeup_locked(so); \\\n\t} \\\n} while (0)\n\n#define sctp_sorwakeup(inp, so) \\\ndo { \\\n\tif (inp->sctp_flags & SCTP_PCB_FLAGS_DONT_WAKE) { \\\n\t\tinp->sctp_flags |= SCTP_PCB_FLAGS_WAKEINPUT; \\\n\t} else { \\\n\t\tsorwakeup(so); \\\n\t} \\\n} while (0)\n\n#define sctp_sorwakeup_locked(inp, so) \\\ndo { \\\n\tif (inp->sctp_flags & SCTP_PCB_FLAGS_DONT_WAKE) { \\\n\t\tinp->sctp_flags |= SCTP_PCB_FLAGS_WAKEINPUT; \\\n                SOCKBUF_UNLOCK(&((so)->so_rcv)); \\\n\t} else { \\\n\t\tsorwakeup_locked(so); \\\n\t} \\\n} while (0)\n\n#endif\t\t\t\t/* _KERNEL || __Userspace__ */\n#endif\n"
  },
  {
    "path": "freebsd-headers/netinet/sctp_crc32.h",
    "content": "/*-\n * Copyright (c) 2001-2007, by Cisco Systems, Inc. All rights reserved.\n * Copyright (c) 2008-2011, by Randall Stewart. All rights reserved.\n * Copyright (c) 2008-2011, by Michael Tuexen. All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions are met:\n *\n * a) Redistributions of source code must retain the above copyright notice,\n *   this list of conditions and the following disclaimer.\n *\n * b) Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in\n *   the documentation and/or other materials provided with the distribution.\n *\n * c) Neither the name of Cisco Systems, Inc. nor the names of its\n *    contributors may be used to endorse or promote products derived\n *    from this software without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n * \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,\n * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE\n * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\n * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\n * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\n * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\n * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF\n * THE POSSIBILITY OF SUCH DAMAGE.\n */\n\n/* $KAME: sctp_crc32.h,v 1.5 2004/08/17 04:06:16 itojun Exp $\t */\n\n#include <sys/cdefs.h>\n__FBSDID(\"$FreeBSD: release/9.0.0/sys/netinet/sctp_crc32.h 218319 2011-02-05 12:12:51Z rrs $\");\n\n#ifndef __crc32c_h__\n#define __crc32c_h__\n\n#if defined(_KERNEL)\n#if !defined(SCTP_WITH_NO_CSUM)\nuint32_t sctp_calculate_cksum(struct mbuf *, uint32_t);\n\n#endif\nvoid sctp_delayed_cksum(struct mbuf *, uint32_t offset);\n\n#endif\t\t\t\t/* _KERNEL */\n#endif\t\t\t\t/* __crc32c_h__ */\n"
  },
  {
    "path": "freebsd-headers/netinet/sctp_dtrace_declare.h",
    "content": "/*-\n * Copyright (c) 2008-2011, by Randall Stewart. All rights reserved.\n * Copyright (c) 2008-2011, by Michael Tuexen. All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions are met:\n *\n * a) Redistributions of source code must retain the above copyright notice,\n *   this list of conditions and the following disclaimer.\n *\n * b) Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in\n *   the documentation and/or other materials provided with the distribution.\n *\n * c) Neither the name of Cisco Systems, Inc. nor the names of its\n *    contributors may be used to endorse or promote products derived\n *    from this software without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n * \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,\n * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE\n * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\n * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\n * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\n * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\n * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF\n * THE POSSIBILITY OF SUCH DAMAGE.\n */\n#include <sys/cdefs.h>\n__FBSDID(\"$FreeBSD: release/9.0.0/sys/netinet/sctp_dtrace_declare.h 219397 2011-03-08 11:58:25Z rrs $\");\n#ifndef __sctp_dtrace_declare_h__\n#include \"opt_kdtrace.h\"\n#include <sys/kernel.h>\n#include <sys/sdt.h>\n\n/* Declare the SCTP provider */\nSDT_PROVIDER_DECLARE(sctp);\n\n/* The probes we have so far: */\n\n/* One to track a net's cwnd */\n/* initial */\nSDT_PROBE_DECLARE(sctp, cwnd, net, init);\n/* update at a ack -- increase */\nSDT_PROBE_DECLARE(sctp, cwnd, net, ack);\n/* update at a fast retransmit -- decrease */\nSDT_PROBE_DECLARE(sctp, cwnd, net, fr);\n/* update at a time-out -- decrease */\nSDT_PROBE_DECLARE(sctp, cwnd, net, to);\n/* update at a burst-limit -- decrease */\nSDT_PROBE_DECLARE(sctp, cwnd, net, bl);\n/* update at a ECN -- decrease */\nSDT_PROBE_DECLARE(sctp, cwnd, net, ecn);\n/* update at a Packet-Drop -- decrease */\nSDT_PROBE_DECLARE(sctp, cwnd, net, pd);\n/* Rttvar probe declaration */\nSDT_PROBE_DECLARE(sctp, cwnd, net, rttvar);\nSDT_PROBE_DECLARE(sctp, cwnd, net, rttstep);\n\n/* One to track an associations rwnd */\nSDT_PROBE_DECLARE(sctp, rwnd, assoc, val);\n\n/* One to track a net's flight size */\nSDT_PROBE_DECLARE(sctp, flightsize, net, val);\n\n/* One to track an associations flight size */\nSDT_PROBE_DECLARE(sctp, flightsize, assoc, val);\n\n\n\n\n\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/netinet/sctp_dtrace_define.h",
    "content": "/*-\n * Copyright (c) 2008-2011, by Randall Stewart. All rights reserved.\n * Copyright (c) 2008-2011, by Michael Tuexen. All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions are met:\n *\n * a) Redistributions of source code must retain the above copyright notice,\n *   this list of conditions and the following disclaimer.\n *\n * b) Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in\n *   the documentation and/or other materials provided with the distribution.\n *\n * c) Neither the name of Cisco Systems, Inc. nor the names of its\n *    contributors may be used to endorse or promote products derived\n *    from this software without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n * \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,\n * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE\n * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\n * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\n * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\n * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\n * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF\n * THE POSSIBILITY OF SUCH DAMAGE.\n */\n#include <sys/cdefs.h>\n__FBSDID(\"$FreeBSD: release/9.0.0/sys/netinet/sctp_dtrace_define.h 219397 2011-03-08 11:58:25Z rrs $\");\n#ifndef __sctp_dtrace_define_h__\n#include \"opt_kdtrace.h\"\n#include <sys/kernel.h>\n#include <sys/sdt.h>\n\nSDT_PROVIDER_DEFINE(sctp);\n\n/********************************************************/\n/* Cwnd probe - tracks changes in the congestion window on a netp */\n/********************************************************/\n/* Initial */\nSDT_PROBE_DEFINE(sctp, cwnd, net, init, init);\n/* The Vtag for this end */\nSDT_PROBE_ARGTYPE(sctp, cwnd, net, init, 0, \"uint32_t\");\n/* The port number of the local side << 16 | port number of remote\n * in network byte order.\n */\nSDT_PROBE_ARGTYPE(sctp, cwnd, net, init, 1, \"uint32_t\");\n/* The pointer to the struct sctp_nets * changing */\nSDT_PROBE_ARGTYPE(sctp, cwnd, net, init, 2, \"uintptr_t\");\n/* The old value of the cwnd  */\nSDT_PROBE_ARGTYPE(sctp, cwnd, net, init, 3, \"int\");\n/* The new value of the cwnd */\nSDT_PROBE_ARGTYPE(sctp, cwnd, net, init, 4, \"int\");\n\n\n/* ACK-INCREASE */\nSDT_PROBE_DEFINE(sctp, cwnd, net, ack, ack);\n/* The Vtag for this end */\nSDT_PROBE_ARGTYPE(sctp, cwnd, net, ack, 0, \"uint32_t\");\n/* The port number of the local side << 16 | port number of remote\n * in network byte order.\n */\nSDT_PROBE_ARGTYPE(sctp, cwnd, net, ack, 1, \"uint32_t\");\n/* The pointer to the struct sctp_nets * changing */\nSDT_PROBE_ARGTYPE(sctp, cwnd, net, ack, 2, \"uintptr_t\");\n/* The old value of the cwnd  */\nSDT_PROBE_ARGTYPE(sctp, cwnd, net, ack, 3, \"int\");\n/* The new value of the cwnd */\nSDT_PROBE_ARGTYPE(sctp, cwnd, net, ack, 4, \"int\");\n\n\n/* ACK-INCREASE */\nSDT_PROBE_DEFINE(sctp, cwnd, net, rttvar, rttvar);\n/* The Vtag << 32 | localport << 16 | remoteport */\nSDT_PROBE_ARGTYPE(sctp, cwnd, net, rttvar, 0, \"uint64_t\");\n/* obw | nbw */\nSDT_PROBE_ARGTYPE(sctp, cwnd, net, rttvar, 1, \"uint64_t\");\n/* bwrtt | newrtt */\nSDT_PROBE_ARGTYPE(sctp, cwnd, net, rttvar, 2, \"uint64_t\");\n/* flight */\nSDT_PROBE_ARGTYPE(sctp, cwnd, net, rttvar, 3, \"uint64_t\");\n/* (cwnd << 32) | point << 16 | retval(0/1) */\nSDT_PROBE_ARGTYPE(sctp, cwnd, net, rttvar, 4, \"uint64_t\");\n\n\nSDT_PROBE_DEFINE(sctp, cwnd, net, rttstep, rttstep);\n/* The Vtag << 32 | localport << 16 | remoteport */\nSDT_PROBE_ARGTYPE(sctp, cwnd, net, rttstep, 0, \"uint64_t\");\n/* obw | nbw */\nSDT_PROBE_ARGTYPE(sctp, cwnd, net, rttstep, 1, \"uint64_t\");\n/* bwrtt | nrtt */\nSDT_PROBE_ARGTYPE(sctp, cwnd, net, rttstep, 2, \"uint64_t\");\n/* cwnd_saved | stepcnt << 16 | oldstep  */\nSDT_PROBE_ARGTYPE(sctp, cwnd, net, rttstep, 3, \"uint64_t\");\n/* (cwnd << 32) | point << 16 | retval(0/1) */\nSDT_PROBE_ARGTYPE(sctp, cwnd, net, rttstep, 4, \"uint64_t\");\n\n\n/* FastRetransmit-DECREASE */\nSDT_PROBE_DEFINE(sctp, cwnd, net, fr, fr);\n/* The Vtag for this end */\nSDT_PROBE_ARGTYPE(sctp, cwnd, net, fr, 0, \"uint32_t\");\n/* The port number of the local side << 16 | port number of remote\n * in network byte order.\n */\nSDT_PROBE_ARGTYPE(sctp, cwnd, net, fr, 1, \"uint32_t\");\n/* The pointer to the struct sctp_nets * changing */\nSDT_PROBE_ARGTYPE(sctp, cwnd, net, fr, 2, \"uintptr_t\");\n/* The old value of the cwnd  */\nSDT_PROBE_ARGTYPE(sctp, cwnd, net, fr, 3, \"int\");\n/* The new value of the cwnd */\nSDT_PROBE_ARGTYPE(sctp, cwnd, net, fr, 4, \"int\");\n\n\n/* TimeOut-DECREASE */\nSDT_PROBE_DEFINE(sctp, cwnd, net, to, to);\n/* The Vtag for this end */\nSDT_PROBE_ARGTYPE(sctp, cwnd, net, to, 0, \"uint32_t\");\n/* The port number of the local side << 16 | port number of remote\n * in network byte order.\n */\nSDT_PROBE_ARGTYPE(sctp, cwnd, net, to, 1, \"uint32_t\");\n/* The pointer to the struct sctp_nets * changing */\nSDT_PROBE_ARGTYPE(sctp, cwnd, net, to, 2, \"uintptr_t\");\n/* The old value of the cwnd  */\nSDT_PROBE_ARGTYPE(sctp, cwnd, net, to, 3, \"int\");\n/* The new value of the cwnd */\nSDT_PROBE_ARGTYPE(sctp, cwnd, net, to, 4, \"int\");\n\n\n/* BurstLimit-DECREASE */\nSDT_PROBE_DEFINE(sctp, cwnd, net, bl, bl);\n/* The Vtag for this end */\nSDT_PROBE_ARGTYPE(sctp, cwnd, net, bl, 0, \"uint32_t\");\n/* The port number of the local side << 16 | port number of remote\n * in network byte order.\n */\nSDT_PROBE_ARGTYPE(sctp, cwnd, net, bl, 1, \"uint32_t\");\n/* The pointer to the struct sctp_nets * changing */\nSDT_PROBE_ARGTYPE(sctp, cwnd, net, bl, 2, \"uintptr_t\");\n/* The old value of the cwnd  */\nSDT_PROBE_ARGTYPE(sctp, cwnd, net, bl, 3, \"int\");\n/* The new value of the cwnd */\nSDT_PROBE_ARGTYPE(sctp, cwnd, net, bl, 4, \"int\");\n\n\n/* ECN-DECREASE */\nSDT_PROBE_DEFINE(sctp, cwnd, net, ecn, ecn);\n/* The Vtag for this end */\nSDT_PROBE_ARGTYPE(sctp, cwnd, net, ecn, 0, \"uint32_t\");\n/* The port number of the local side << 16 | port number of remote\n * in network byte order.\n */\nSDT_PROBE_ARGTYPE(sctp, cwnd, net, ecn, 1, \"uint32_t\");\n/* The pointer to the struct sctp_nets * changing */\nSDT_PROBE_ARGTYPE(sctp, cwnd, net, ecn, 2, \"uintptr_t\");\n/* The old value of the cwnd  */\nSDT_PROBE_ARGTYPE(sctp, cwnd, net, ecn, 3, \"int\");\n/* The new value of the cwnd */\nSDT_PROBE_ARGTYPE(sctp, cwnd, net, ecn, 4, \"int\");\n\n\n/* PacketDrop-DECREASE */\nSDT_PROBE_DEFINE(sctp, cwnd, net, pd, pd);\n/* The Vtag for this end */\nSDT_PROBE_ARGTYPE(sctp, cwnd, net, pd, 0, \"uint32_t\");\n/* The port number of the local side << 16 | port number of remote\n * in network byte order.\n */\nSDT_PROBE_ARGTYPE(sctp, cwnd, net, pd, 1, \"uint32_t\");\n/* The pointer to the struct sctp_nets * changing */\nSDT_PROBE_ARGTYPE(sctp, cwnd, net, pd, 2, \"uintptr_t\");\n/* The old value of the cwnd  */\nSDT_PROBE_ARGTYPE(sctp, cwnd, net, pd, 3, \"int\");\n/* The new value of the cwnd */\nSDT_PROBE_ARGTYPE(sctp, cwnd, net, pd, 4, \"int\");\n\n\n\n/********************************************************/\n/* Rwnd probe - tracks changes in the receiver window for an assoc */\n/********************************************************/\nSDT_PROBE_DEFINE(sctp, rwnd, assoc, val, val);\n/* The Vtag for this end */\nSDT_PROBE_ARGTYPE(sctp, rwnd, assoc, val, 0, \"uint32_t\");\n/* The port number of the local side << 16 | port number of remote\n * in network byte order.\n */\nSDT_PROBE_ARGTYPE(sctp, rwnd, assoc, val, 1, \"uint32_t\");\n/* The up/down amount */\nSDT_PROBE_ARGTYPE(sctp, rwnd, assoc, val, 2, \"int\");\n/* The new value of the cwnd */\nSDT_PROBE_ARGTYPE(sctp, rwnd, assoc, val, 3, \"int\");\n\n/********************************************************/\n/* flight probe - tracks changes in the flight size on a net or assoc */\n/********************************************************/\nSDT_PROBE_DEFINE(sctp, flightsize, net, val, val);\n/* The Vtag for this end */\nSDT_PROBE_ARGTYPE(sctp, flightsize, net, val, 0, \"uint32_t\");\n/* The port number of the local side << 16 | port number of remote\n * in network byte order.\n */\nSDT_PROBE_ARGTYPE(sctp, flightsize, net, val, 1, \"uint32_t\");\n/* The pointer to the struct sctp_nets * changing */\nSDT_PROBE_ARGTYPE(sctp, flightsize, net, val, 2, \"uintptr_t\");\n/* The up/down amount */\nSDT_PROBE_ARGTYPE(sctp, flightsize, net, val, 3, \"int\");\n/* The new value of the cwnd */\nSDT_PROBE_ARGTYPE(sctp, flightsize, net, val, 4, \"int\");\n/********************************************************/\n/* The total flight version */\n/********************************************************/\nSDT_PROBE_DEFINE(sctp, flightsize, assoc, val, val);\n/* The Vtag for this end */\nSDT_PROBE_ARGTYPE(sctp, flightsize, assoc, val, 0, \"uint32_t\");\n/* The port number of the local side << 16 | port number of remote\n * in network byte order.\n */\nSDT_PROBE_ARGTYPE(sctp, flightsize, assoc, val, 1, \"uint32_t\");\n/* The up/down amount */\nSDT_PROBE_ARGTYPE(sctp, flightsize, assoc, val, 2, \"int\");\n/* The new value of the cwnd */\nSDT_PROBE_ARGTYPE(sctp, flightsize, assoc, val, 3, \"int\");\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/netinet/sctp_header.h",
    "content": "/*-\n * Copyright (c) 2001-2007, by Cisco Systems, Inc. All rights reserved.\n * Copyright (c) 2008-2011, by Randall Stewart. All rights reserved.\n * Copyright (c) 2008-2011, by Michael Tuexen. All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions are met:\n *\n * a) Redistributions of source code must retain the above copyright notice,\n *   this list of conditions and the following disclaimer.\n *\n * b) Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in\n *   the documentation and/or other materials provided with the distribution.\n *\n * c) Neither the name of Cisco Systems, Inc. nor the names of its\n *    contributors may be used to endorse or promote products derived\n *    from this software without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n * \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,\n * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE\n * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\n * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\n * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\n * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\n * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF\n * THE POSSIBILITY OF SUCH DAMAGE.\n */\n\n/* $KAME: sctp_header.h,v 1.14 2005/03/06 16:04:17 itojun Exp $\t */\n\n#include <sys/cdefs.h>\n__FBSDID(\"$FreeBSD: release/9.0.0/sys/netinet/sctp_header.h 228037 2011-11-27 19:13:45Z tuexen $\");\n\n#ifndef __sctp_header_h__\n#define __sctp_header_h__\n\n#include <sys/time.h>\n#include <netinet/sctp.h>\n#include <netinet/sctp_constants.h>\n\n#define SCTP_PACKED __attribute__((packed))\n\n/*\n * Parameter structures\n */\nstruct sctp_ipv4addr_param {\n\tstruct sctp_paramhdr ph;/* type=SCTP_IPV4_PARAM_TYPE, len=8 */\n\tuint32_t addr;\t\t/* IPV4 address */\n}                   SCTP_PACKED;\n\n#define SCTP_V6_ADDR_BYTES 16\n\n\nstruct sctp_ipv6addr_param {\n\tstruct sctp_paramhdr ph;/* type=SCTP_IPV6_PARAM_TYPE, len=20 */\n\tuint8_t addr[SCTP_V6_ADDR_BYTES];\t/* IPV6 address */\n}                   SCTP_PACKED;\n\n/* Cookie Preservative */\nstruct sctp_cookie_perserve_param {\n\tstruct sctp_paramhdr ph;/* type=SCTP_COOKIE_PRESERVE, len=8 */\n\tuint32_t time;\t\t/* time in ms to extend cookie */\n}                          SCTP_PACKED;\n\n#define SCTP_ARRAY_MIN_LEN 1\n/* Host Name Address */\nstruct sctp_host_name_param {\n\tstruct sctp_paramhdr ph;/* type=SCTP_HOSTNAME_ADDRESS */\n\tchar name[SCTP_ARRAY_MIN_LEN];\t/* host name */\n}                    SCTP_PACKED;\n\n/*\n * This is the maximum padded size of a s-a-p\n * so paramheadr + 3 address types (6 bytes) + 2 byte pad = 12\n */\n#define SCTP_MAX_ADDR_PARAMS_SIZE 12\n/* supported address type */\nstruct sctp_supported_addr_param {\n\tstruct sctp_paramhdr ph;/* type=SCTP_SUPPORTED_ADDRTYPE */\n\tuint16_t addr_type[2];\t/* array of supported address types */\n}                         SCTP_PACKED;\n\n/* ECN parameter */\nstruct sctp_ecn_supported_param {\n\tstruct sctp_paramhdr ph;/* type=SCTP_ECN_CAPABLE */\n}                        SCTP_PACKED;\n\n\n/* heartbeat info parameter */\nstruct sctp_heartbeat_info_param {\n\tstruct sctp_paramhdr ph;\n\tuint32_t time_value_1;\n\tuint32_t time_value_2;\n\tuint32_t random_value1;\n\tuint32_t random_value2;\n\tuint8_t addr_family;\n\tuint8_t addr_len;\n\t/* make sure that this structure is 4 byte aligned */\n\tuint8_t padding[2];\n\tchar address[SCTP_ADDRMAX];\n}                         SCTP_PACKED;\n\n\n/* draft-ietf-tsvwg-prsctp */\n/* PR-SCTP supported parameter */\nstruct sctp_prsctp_supported_param {\n\tstruct sctp_paramhdr ph;\n}                           SCTP_PACKED;\n\n\n/* draft-ietf-tsvwg-addip-sctp */\nstruct sctp_asconf_paramhdr {\t/* an ASCONF \"parameter\" */\n\tstruct sctp_paramhdr ph;/* a SCTP parameter header */\n\tuint32_t correlation_id;/* correlation id for this param */\n}                    SCTP_PACKED;\n\nstruct sctp_asconf_addr_param {\t/* an ASCONF address parameter */\n\tstruct sctp_asconf_paramhdr aph;\t/* asconf \"parameter\" */\n\tstruct sctp_ipv6addr_param addrp;\t/* max storage size */\n}                      SCTP_PACKED;\n\n\nstruct sctp_asconf_tag_param {\t/* an ASCONF NAT-Vtag parameter */\n\tstruct sctp_asconf_paramhdr aph;\t/* asconf \"parameter\" */\n\tuint32_t local_vtag;\n\tuint32_t remote_vtag;\n}                     SCTP_PACKED;\n\n\nstruct sctp_asconf_addrv4_param {\t/* an ASCONF address (v4) parameter */\n\tstruct sctp_asconf_paramhdr aph;\t/* asconf \"parameter\" */\n\tstruct sctp_ipv4addr_param addrp;\t/* max storage size */\n}                        SCTP_PACKED;\n\n#define SCTP_MAX_SUPPORTED_EXT 256\n\nstruct sctp_supported_chunk_types_param {\n\tstruct sctp_paramhdr ph;/* type = 0x8008  len = x */\n\tuint8_t chunk_types[];\n}                                SCTP_PACKED;\n\n\n/*\n * Structures for DATA chunks\n */\nstruct sctp_data {\n\tuint32_t tsn;\n\tuint16_t stream_id;\n\tuint16_t stream_sequence;\n\tuint32_t protocol_id;\n\t/* user data follows */\n}         SCTP_PACKED;\n\nstruct sctp_data_chunk {\n\tstruct sctp_chunkhdr ch;\n\tstruct sctp_data dp;\n}               SCTP_PACKED;\n\n/*\n * Structures for the control chunks\n */\n\n/* Initiate (INIT)/Initiate Ack (INIT ACK) */\nstruct sctp_init {\n\tuint32_t initiate_tag;\t/* initiate tag */\n\tuint32_t a_rwnd;\t/* a_rwnd */\n\tuint16_t num_outbound_streams;\t/* OS */\n\tuint16_t num_inbound_streams;\t/* MIS */\n\tuint32_t initial_tsn;\t/* I-TSN */\n\t/* optional param's follow */\n}         SCTP_PACKED;\n\n#define SCTP_IDENTIFICATION_SIZE 16\n#define SCTP_ADDRESS_SIZE 4\n#define SCTP_RESERVE_SPACE 6\n/* state cookie header */\nstruct sctp_state_cookie {\t/* this is our definition... */\n\tuint8_t identification[SCTP_IDENTIFICATION_SIZE];\t/* id of who we are */\n\tstruct timeval time_entered;\t/* the time I built cookie */\n\tuint32_t cookie_life;\t/* life I will award this cookie */\n\tuint32_t tie_tag_my_vtag;\t/* my tag in old association */\n\n\tuint32_t tie_tag_peer_vtag;\t/* peers tag in old association */\n\tuint32_t peers_vtag;\t/* peers tag in INIT (for quick ref) */\n\n\tuint32_t my_vtag;\t/* my tag in INIT-ACK (for quick ref) */\n\tuint32_t address[SCTP_ADDRESS_SIZE];\t/* 4 ints/128 bits */\n\tuint32_t addr_type;\t/* address type */\n\tuint32_t laddress[SCTP_ADDRESS_SIZE];\t/* my local from address */\n\tuint32_t laddr_type;\t/* my local from address type */\n\tuint32_t scope_id;\t/* v6 scope id for link-locals */\n\n\tuint16_t peerport;\t/* port address of the peer in the INIT */\n\tuint16_t myport;\t/* my port address used in the INIT */\n\tuint8_t ipv4_addr_legal;/* Are V4 addr legal? */\n\tuint8_t ipv6_addr_legal;/* Are V6 addr legal? */\n\tuint8_t local_scope;\t/* IPv6 local scope flag */\n\tuint8_t site_scope;\t/* IPv6 site scope flag */\n\n\tuint8_t ipv4_scope;\t/* IPv4 private addr scope */\n\tuint8_t loopback_scope;\t/* loopback scope information */\n\tuint8_t reserved[SCTP_RESERVE_SPACE];\t/* Align to 64 bits */\n\t/*\n\t * at the end is tacked on the INIT chunk and the INIT-ACK chunk\n\t * (minus the cookie).\n\t */\n}                 SCTP_PACKED;\n\n\n/* Used for NAT state error cause */\nstruct sctp_missing_nat_state {\n\tuint16_t cause;\n\tuint16_t length;\n\tuint8_t data[];\n}                      SCTP_PACKED;\n\n\nstruct sctp_inv_mandatory_param {\n\tuint16_t cause;\n\tuint16_t length;\n\tuint32_t num_param;\n\tuint16_t param;\n\t/*\n\t * We include this to 0 it since only a missing cookie will cause\n\t * this error.\n\t */\n\tuint16_t resv;\n}                        SCTP_PACKED;\n\nstruct sctp_unresolv_addr {\n\tuint16_t cause;\n\tuint16_t length;\n\tuint16_t addr_type;\n\tuint16_t reserved;\t/* Only one invalid addr type */\n}                  SCTP_PACKED;\n\n/* state cookie parameter */\nstruct sctp_state_cookie_param {\n\tstruct sctp_paramhdr ph;\n\tstruct sctp_state_cookie cookie;\n}                       SCTP_PACKED;\n\nstruct sctp_init_chunk {\n\tstruct sctp_chunkhdr ch;\n\tstruct sctp_init init;\n}               SCTP_PACKED;\n\nstruct sctp_init_msg {\n\tstruct sctphdr sh;\n\tstruct sctp_init_chunk msg;\n}             SCTP_PACKED;\n\n/* ... used for both INIT and INIT ACK */\n#define sctp_init_ack\t\tsctp_init\n#define sctp_init_ack_chunk\tsctp_init_chunk\n#define sctp_init_ack_msg\tsctp_init_msg\n\n\n/* Selective Ack (SACK) */\nstruct sctp_gap_ack_block {\n\tuint16_t start;\t\t/* Gap Ack block start */\n\tuint16_t end;\t\t/* Gap Ack block end */\n}                  SCTP_PACKED;\n\nstruct sctp_sack {\n\tuint32_t cum_tsn_ack;\t/* cumulative TSN Ack */\n\tuint32_t a_rwnd;\t/* updated a_rwnd of sender */\n\tuint16_t num_gap_ack_blks;\t/* number of Gap Ack blocks */\n\tuint16_t num_dup_tsns;\t/* number of duplicate TSNs */\n\t/* struct sctp_gap_ack_block's follow */\n\t/* uint32_t duplicate_tsn's follow */\n}         SCTP_PACKED;\n\nstruct sctp_sack_chunk {\n\tstruct sctp_chunkhdr ch;\n\tstruct sctp_sack sack;\n}               SCTP_PACKED;\n\nstruct sctp_nr_sack {\n\tuint32_t cum_tsn_ack;\t/* cumulative TSN Ack */\n\tuint32_t a_rwnd;\t/* updated a_rwnd of sender */\n\tuint16_t num_gap_ack_blks;\t/* number of Gap Ack blocks */\n\tuint16_t num_nr_gap_ack_blks;\t/* number of NR Gap Ack blocks */\n\tuint16_t num_dup_tsns;\t/* number of duplicate TSNs */\n\tuint16_t reserved;\t/* not currently used */\n\t/* struct sctp_gap_ack_block's follow */\n\t/* uint32_t duplicate_tsn's follow */\n}            SCTP_PACKED;\n\nstruct sctp_nr_sack_chunk {\n\tstruct sctp_chunkhdr ch;\n\tstruct sctp_nr_sack nr_sack;\n}                  SCTP_PACKED;\n\n\n/* Heartbeat Request (HEARTBEAT) */\nstruct sctp_heartbeat {\n\tstruct sctp_heartbeat_info_param hb_info;\n}              SCTP_PACKED;\n\nstruct sctp_heartbeat_chunk {\n\tstruct sctp_chunkhdr ch;\n\tstruct sctp_heartbeat heartbeat;\n}                    SCTP_PACKED;\n\n/* ... used for Heartbeat Ack (HEARTBEAT ACK) */\n#define sctp_heartbeat_ack\t\tsctp_heartbeat\n#define sctp_heartbeat_ack_chunk\tsctp_heartbeat_chunk\n\n\n/* Abort Asssociation (ABORT) */\nstruct sctp_abort_chunk {\n\tstruct sctp_chunkhdr ch;\n\t/* optional error cause may follow */\n}                SCTP_PACKED;\n\nstruct sctp_abort_msg {\n\tstruct sctphdr sh;\n\tstruct sctp_abort_chunk msg;\n}              SCTP_PACKED;\n\n\n/* Shutdown Association (SHUTDOWN) */\nstruct sctp_shutdown_chunk {\n\tstruct sctp_chunkhdr ch;\n\tuint32_t cumulative_tsn_ack;\n}                   SCTP_PACKED;\n\n\n/* Shutdown Acknowledgment (SHUTDOWN ACK) */\nstruct sctp_shutdown_ack_chunk {\n\tstruct sctp_chunkhdr ch;\n}                       SCTP_PACKED;\n\n\n/* Operation Error (ERROR) */\nstruct sctp_error_chunk {\n\tstruct sctp_chunkhdr ch;\n\t/* optional error causes follow */\n}                SCTP_PACKED;\n\n\n/* Cookie Echo (COOKIE ECHO) */\nstruct sctp_cookie_echo_chunk {\n\tstruct sctp_chunkhdr ch;\n\tstruct sctp_state_cookie cookie;\n}                      SCTP_PACKED;\n\n/* Cookie Acknowledgment (COOKIE ACK) */\nstruct sctp_cookie_ack_chunk {\n\tstruct sctp_chunkhdr ch;\n}                     SCTP_PACKED;\n\n/* Explicit Congestion Notification Echo (ECNE) */\nstruct old_sctp_ecne_chunk {\n\tstruct sctp_chunkhdr ch;\n\tuint32_t tsn;\n}                   SCTP_PACKED;\n\nstruct sctp_ecne_chunk {\n\tstruct sctp_chunkhdr ch;\n\tuint32_t tsn;\n\tuint32_t num_pkts_since_cwr;\n}               SCTP_PACKED;\n\n/* Congestion Window Reduced (CWR) */\nstruct sctp_cwr_chunk {\n\tstruct sctp_chunkhdr ch;\n\tuint32_t tsn;\n}              SCTP_PACKED;\n\n/* Shutdown Complete (SHUTDOWN COMPLETE) */\nstruct sctp_shutdown_complete_chunk {\n\tstruct sctp_chunkhdr ch;\n}                            SCTP_PACKED;\n\n/* Oper error holding a stale cookie */\nstruct sctp_stale_cookie_msg {\n\tstruct sctp_paramhdr ph;/* really an error cause */\n\tuint32_t time_usec;\n}                     SCTP_PACKED;\n\nstruct sctp_adaptation_layer_indication {\n\tstruct sctp_paramhdr ph;\n\tuint32_t indication;\n}                                SCTP_PACKED;\n\nstruct sctp_cookie_while_shutting_down {\n\tstruct sctphdr sh;\n\tstruct sctp_chunkhdr ch;\n\tstruct sctp_paramhdr ph;/* really an error cause */\n}                               SCTP_PACKED;\n\nstruct sctp_shutdown_complete_msg {\n\tstruct sctphdr sh;\n\tstruct sctp_shutdown_complete_chunk shut_cmp;\n}                          SCTP_PACKED;\n\n/*\n * draft-ietf-tsvwg-addip-sctp\n */\n/* Address/Stream Configuration Change (ASCONF) */\nstruct sctp_asconf_chunk {\n\tstruct sctp_chunkhdr ch;\n\tuint32_t serial_number;\n\t/* lookup address parameter (mandatory) */\n\t/* asconf parameters follow */\n}                 SCTP_PACKED;\n\n/* Address/Stream Configuration Acknowledge (ASCONF ACK) */\nstruct sctp_asconf_ack_chunk {\n\tstruct sctp_chunkhdr ch;\n\tuint32_t serial_number;\n\t/* asconf parameters follow */\n}                     SCTP_PACKED;\n\n/* draft-ietf-tsvwg-prsctp */\n/* Forward Cumulative TSN (FORWARD TSN) */\nstruct sctp_forward_tsn_chunk {\n\tstruct sctp_chunkhdr ch;\n\tuint32_t new_cumulative_tsn;\n\t/* stream/sequence pairs (sctp_strseq) follow */\n}                      SCTP_PACKED;\n\nstruct sctp_strseq {\n\tuint16_t stream;\n\tuint16_t sequence;\n}           SCTP_PACKED;\n\nstruct sctp_forward_tsn_msg {\n\tstruct sctphdr sh;\n\tstruct sctp_forward_tsn_chunk msg;\n}                    SCTP_PACKED;\n\n/* should be a multiple of 4 - 1 aka 3/7/11 etc. */\n\n#define SCTP_NUM_DB_TO_VERIFY 31\n\nstruct sctp_chunk_desc {\n\tuint8_t chunk_type;\n\tuint8_t data_bytes[SCTP_NUM_DB_TO_VERIFY];\n\tuint32_t tsn_ifany;\n}               SCTP_PACKED;\n\n\nstruct sctp_pktdrop_chunk {\n\tstruct sctp_chunkhdr ch;\n\tuint32_t bottle_bw;\n\tuint32_t current_onq;\n\tuint16_t trunc_len;\n\tuint16_t reserved;\n\tuint8_t data[];\n}                  SCTP_PACKED;\n\n/**********STREAM RESET STUFF ******************/\n\nstruct sctp_stream_reset_out_request {\n\tstruct sctp_paramhdr ph;\n\tuint32_t request_seq;\t/* monotonically increasing seq no */\n\tuint32_t response_seq;\t/* if a response, the resp seq no */\n\tuint32_t send_reset_at_tsn;\t/* last TSN I assigned outbound */\n\tuint16_t list_of_streams[];\t/* if not all list of streams */\n}                             SCTP_PACKED;\n\nstruct sctp_stream_reset_in_request {\n\tstruct sctp_paramhdr ph;\n\tuint32_t request_seq;\n\tuint16_t list_of_streams[];\t/* if not all list of streams */\n}                            SCTP_PACKED;\n\n\nstruct sctp_stream_reset_tsn_request {\n\tstruct sctp_paramhdr ph;\n\tuint32_t request_seq;\n}                             SCTP_PACKED;\n\nstruct sctp_stream_reset_response {\n\tstruct sctp_paramhdr ph;\n\tuint32_t response_seq;\t/* if a response, the resp seq no */\n\tuint32_t result;\n}                          SCTP_PACKED;\n\nstruct sctp_stream_reset_response_tsn {\n\tstruct sctp_paramhdr ph;\n\tuint32_t response_seq;\t/* if a response, the resp seq no */\n\tuint32_t result;\n\tuint32_t senders_next_tsn;\n\tuint32_t receivers_next_tsn;\n}                              SCTP_PACKED;\n\nstruct sctp_stream_reset_add_strm {\n\tstruct sctp_paramhdr ph;\n\tuint32_t request_seq;\n\tuint16_t number_of_streams;\n\tuint16_t reserved;\n}                          SCTP_PACKED;\n\n#define SCTP_STREAM_RESET_NOTHING   0x00000000\t/* Nothing for me to do */\n#define SCTP_STREAM_RESET_PERFORMED 0x00000001\t/* Did it */\n#define SCTP_STREAM_RESET_DENIED    0x00000002\t/* refused to do it */\n#define SCTP_STREAM_RESET_ERROR_STR 0x00000003\t/* bad Stream no */\n#define SCTP_STREAM_RESET_TRY_LATER 0x00000004\t/* collision, try again */\n#define SCTP_STREAM_RESET_BAD_SEQNO 0x00000005\t/* bad str-reset seq no */\n\n/*\n * convience structures, note that if you are making a request for specific\n * streams then the request will need to be an overlay structure.\n */\n\nstruct sctp_stream_reset_out_req {\n\tstruct sctp_chunkhdr ch;\n\tstruct sctp_stream_reset_out_request sr_req;\n}                         SCTP_PACKED;\n\nstruct sctp_stream_reset_in_req {\n\tstruct sctp_chunkhdr ch;\n\tstruct sctp_stream_reset_in_request sr_req;\n}                        SCTP_PACKED;\n\nstruct sctp_stream_reset_tsn_req {\n\tstruct sctp_chunkhdr ch;\n\tstruct sctp_stream_reset_tsn_request sr_req;\n}                         SCTP_PACKED;\n\nstruct sctp_stream_reset_resp {\n\tstruct sctp_chunkhdr ch;\n\tstruct sctp_stream_reset_response sr_resp;\n}                      SCTP_PACKED;\n\n/* respone only valid with a TSN request */\nstruct sctp_stream_reset_resp_tsn {\n\tstruct sctp_chunkhdr ch;\n\tstruct sctp_stream_reset_response_tsn sr_resp;\n}                          SCTP_PACKED;\n\n/****************************************************/\n\n/*\n * Authenticated chunks support draft-ietf-tsvwg-sctp-auth\n */\n\n/* Should we make the max be 32? */\n#define SCTP_RANDOM_MAX_SIZE 256\nstruct sctp_auth_random {\n\tstruct sctp_paramhdr ph;/* type = 0x8002 */\n\tuint8_t random_data[];\n}                SCTP_PACKED;\n\nstruct sctp_auth_chunk_list {\n\tstruct sctp_paramhdr ph;/* type = 0x8003 */\n\tuint8_t chunk_types[];\n}                    SCTP_PACKED;\n\nstruct sctp_auth_hmac_algo {\n\tstruct sctp_paramhdr ph;/* type = 0x8004 */\n\tuint16_t hmac_ids[];\n}                   SCTP_PACKED;\n\nstruct sctp_auth_chunk {\n\tstruct sctp_chunkhdr ch;\n\tuint16_t shared_key_id;\n\tuint16_t hmac_id;\n\tuint8_t hmac[];\n}               SCTP_PACKED;\n\nstruct sctp_auth_invalid_hmac {\n\tstruct sctp_paramhdr ph;\n\tuint16_t hmac_id;\n\tuint16_t padding;\n}                      SCTP_PACKED;\n\n/*\n * we pre-reserve enough room for a ECNE or CWR AND a SACK with no missing\n * pieces. If ENCE is missing we could have a couple of blocks. This way we\n * optimize so we MOST likely can bundle a SACK/ECN with the smallest size\n * data chunk I will split into. We could increase throughput slightly by\n * taking out these two but the  24-sack/8-CWR i.e. 32 bytes I pre-reserve I\n * feel is worth it for now.\n */\n#ifndef SCTP_MAX_OVERHEAD\n#ifdef INET6\n#define SCTP_MAX_OVERHEAD (sizeof(struct sctp_data_chunk) + \\\n\t\t\t   sizeof(struct sctphdr) + \\\n\t\t\t   sizeof(struct sctp_ecne_chunk) + \\\n\t\t\t   sizeof(struct sctp_sack_chunk) + \\\n\t\t\t   sizeof(struct ip6_hdr))\n\n#define SCTP_MED_OVERHEAD (sizeof(struct sctp_data_chunk) + \\\n\t\t\t   sizeof(struct sctphdr) + \\\n\t\t\t   sizeof(struct ip6_hdr))\n\n\n#define SCTP_MIN_OVERHEAD (sizeof(struct ip6_hdr) + \\\n\t\t\t   sizeof(struct sctphdr))\n\n#else\n#define SCTP_MAX_OVERHEAD (sizeof(struct sctp_data_chunk) + \\\n\t\t\t   sizeof(struct sctphdr) + \\\n\t\t\t   sizeof(struct sctp_ecne_chunk) + \\\n\t\t\t   sizeof(struct sctp_sack_chunk) + \\\n\t\t\t   sizeof(struct ip))\n\n#define SCTP_MED_OVERHEAD (sizeof(struct sctp_data_chunk) + \\\n\t\t\t   sizeof(struct sctphdr) + \\\n\t\t\t   sizeof(struct ip))\n\n\n#define SCTP_MIN_OVERHEAD (sizeof(struct ip) + \\\n\t\t\t   sizeof(struct sctphdr))\n\n#endif\t\t\t\t/* INET6 */\n#endif\t\t\t\t/* !SCTP_MAX_OVERHEAD */\n\n#define SCTP_MED_V4_OVERHEAD (sizeof(struct sctp_data_chunk) + \\\n\t\t\t      sizeof(struct sctphdr) + \\\n\t\t\t      sizeof(struct ip))\n\n#define SCTP_MIN_V4_OVERHEAD (sizeof(struct ip) + \\\n\t\t\t      sizeof(struct sctphdr))\n\n#undef SCTP_PACKED\n#endif\t\t\t\t/* !__sctp_header_h__ */\n"
  },
  {
    "path": "freebsd-headers/netinet/sctp_indata.h",
    "content": "/*-\n * Copyright (c) 2001-2007, by Cisco Systems, Inc. All rights reserved.\n * Copyright (c) 2008-2011, by Randall Stewart. All rights reserved.\n * Copyright (c) 2008-2011, by Michael Tuexen. All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions are met:\n *\n * a) Redistributions of source code must retain the above copyright notice,\n *   this list of conditions and the following disclaimer.\n *\n * b) Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in\n *   the documentation and/or other materials provided with the distribution.\n *\n * c) Neither the name of Cisco Systems, Inc. nor the names of its\n *    contributors may be used to endorse or promote products derived\n *    from this software without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n * \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,\n * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE\n * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\n * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\n * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\n * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\n * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF\n * THE POSSIBILITY OF SUCH DAMAGE.\n */\n\n/* $KAME: sctp_indata.h,v 1.9 2005/03/06 16:04:17 itojun Exp $\t */\n\n#include <sys/cdefs.h>\n__FBSDID(\"$FreeBSD: release/9.0.0/sys/netinet/sctp_indata.h 222459 2011-05-29 18:41:06Z tuexen $\");\n\n#ifndef __sctp_indata_h__\n#define __sctp_indata_h__\n\n#if defined(_KERNEL) || defined(__Userspace__)\n\nstruct sctp_queued_to_read *\nsctp_build_readq_entry(struct sctp_tcb *stcb,\n    struct sctp_nets *net,\n    uint32_t tsn, uint32_t ppid,\n    uint32_t context, uint16_t stream_no,\n    uint16_t stream_seq, uint8_t flags,\n    struct mbuf *dm);\n\n\n#define sctp_build_readq_entry_mac(_ctl, in_it, a, net, tsn, ppid, context, stream_no, stream_seq, flags, dm) do { \\\n\tif (_ctl) { \\\n\t\tatomic_add_int(&((net)->ref_count), 1); \\\n\t\t(_ctl)->sinfo_stream = stream_no; \\\n\t\t(_ctl)->sinfo_ssn = stream_seq; \\\n\t\t(_ctl)->sinfo_flags = (flags << 8); \\\n\t\t(_ctl)->sinfo_ppid = ppid; \\\n\t\t(_ctl)->sinfo_context = a; \\\n\t\t(_ctl)->sinfo_timetolive = 0; \\\n\t\t(_ctl)->sinfo_tsn = tsn; \\\n\t\t(_ctl)->sinfo_cumtsn = tsn; \\\n\t\t(_ctl)->sinfo_assoc_id = sctp_get_associd((in_it)); \\\n\t\t(_ctl)->length = 0; \\\n\t\t(_ctl)->held_length = 0; \\\n\t\t(_ctl)->whoFrom = net; \\\n\t\t(_ctl)->data = dm; \\\n\t\t(_ctl)->tail_mbuf = NULL; \\\n\t        (_ctl)->aux_data = NULL; \\\n\t\t(_ctl)->stcb = (in_it); \\\n\t\t(_ctl)->port_from = (in_it)->rport; \\\n\t\t(_ctl)->spec_flags = 0; \\\n\t\t(_ctl)->do_not_ref_stcb = 0; \\\n\t\t(_ctl)->end_added = 0; \\\n\t\t(_ctl)->pdapi_aborted = 0; \\\n\t\t(_ctl)->some_taken = 0; \\\n\t} \\\n} while (0)\n\n\n\nstruct mbuf *\nsctp_build_ctl_nchunk(struct sctp_inpcb *inp,\n    struct sctp_sndrcvinfo *sinfo);\n\nvoid sctp_set_rwnd(struct sctp_tcb *, struct sctp_association *);\n\nuint32_t\nsctp_calc_rwnd(struct sctp_tcb *stcb, struct sctp_association *asoc);\n\nvoid\nsctp_express_handle_sack(struct sctp_tcb *stcb, uint32_t cumack,\n    uint32_t rwnd, int *abort_now, int ecne_seen);\n\nvoid\nsctp_handle_sack(struct mbuf *m, int offset_seg, int offset_dup,\n    struct sctp_tcb *stcb, struct sctp_nets *net_from,\n    uint16_t num_seg, uint16_t num_nr_seg, uint16_t num_dup,\n    int *abort_now, uint8_t flags,\n    uint32_t cum_ack, uint32_t rwnd, int ecne_seen);\n\n/* draft-ietf-tsvwg-usctp */\nvoid\nsctp_handle_forward_tsn(struct sctp_tcb *,\n    struct sctp_forward_tsn_chunk *, int *, struct mbuf *, int);\n\nstruct sctp_tmit_chunk *\n                sctp_try_advance_peer_ack_point(struct sctp_tcb *, struct sctp_association *);\n\nvoid sctp_service_queues(struct sctp_tcb *, struct sctp_association *);\n\nvoid\nsctp_update_acked(struct sctp_tcb *, struct sctp_shutdown_chunk *,\n    struct sctp_nets *, int *);\n\nint\nsctp_process_data(struct mbuf **, int, int *, int, struct sctphdr *,\n    struct sctp_inpcb *, struct sctp_tcb *,\n    struct sctp_nets *, uint32_t *);\n\nvoid sctp_slide_mapping_arrays(struct sctp_tcb *stcb);\n\nvoid sctp_sack_check(struct sctp_tcb *, int, int *);\n\n#endif\n#endif\n"
  },
  {
    "path": "freebsd-headers/netinet/sctp_input.h",
    "content": "/*-\n * Copyright (c) 2001-2007, by Cisco Systems, Inc. All rights reserved.\n * Copyright (c) 2008-2011, by Randall Stewart. All rights reserved.\n * Copyright (c) 2008-2011, by Michael Tuexen. All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions are met:\n *\n * a) Redistributions of source code must retain the above copyright notice,\n *   this list of conditions and the following disclaimer.\n *\n * b) Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in\n *   the documentation and/or other materials provided with the distribution.\n *\n * c) Neither the name of Cisco Systems, Inc. nor the names of its\n *    contributors may be used to endorse or promote products derived\n *    from this software without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n * \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,\n * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE\n * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\n * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\n * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\n * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\n * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF\n * THE POSSIBILITY OF SUCH DAMAGE.\n */\n\n/* $KAME: sctp_input.h,v 1.6 2005/03/06 16:04:17 itojun Exp $\t */\n\n#include <sys/cdefs.h>\n__FBSDID(\"$FreeBSD: release/9.0.0/sys/netinet/sctp_input.h 221627 2011-05-08 09:11:59Z tuexen $\");\n\n#ifndef __sctp_input_h__\n#define __sctp_input_h__\n\n#if defined(_KERNEL) || defined(__Userspace__)\nvoid\nsctp_common_input_processing(struct mbuf **, int, int, int,\n    struct sctphdr *, struct sctp_chunkhdr *, struct sctp_inpcb *,\n    struct sctp_tcb *, struct sctp_nets *, uint8_t, uint32_t, uint16_t);\n\nstruct sctp_stream_reset_out_request *\nsctp_find_stream_reset(struct sctp_tcb *stcb, uint32_t seq,\n    struct sctp_tmit_chunk **bchk);\n\nvoid \nsctp_reset_in_stream(struct sctp_tcb *stcb, int number_entries,\n    uint16_t * list);\n\n\nint sctp_is_there_unsent_data(struct sctp_tcb *stcb, int so_locked);\n\n#endif\n#endif\n"
  },
  {
    "path": "freebsd-headers/netinet/sctp_lock_bsd.h",
    "content": "#ifndef __sctp_lock_bsd_h__\n#define __sctp_lock_bsd_h__\n/*-\n * Copyright (c) 2001-2007, by Cisco Systems, Inc. All rights reserved.\n * Copyright (c) 2008-2011, by Randall Stewart. All rights reserved.\n * Copyright (c) 2008-2011, by Michael Tuexen. All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions are met:\n *\n * a) Redistributions of source code must retain the above copyright notice,\n *   this list of conditions and the following disclaimer.\n *\n * b) Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in\n *   the documentation and/or other materials provided with the distribution.\n *\n * c) Neither the name of Cisco Systems, Inc. nor the names of its\n *    contributors may be used to endorse or promote products derived\n *    from this software without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n * \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,\n * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE\n * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\n * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\n * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\n * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\n * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF\n * THE POSSIBILITY OF SUCH DAMAGE.\n */\n\n/*\n * General locking concepts: The goal of our locking is to of course provide\n * consistency and yet minimize overhead. We will attempt to use\n * non-recursive locks which are supposed to be quite inexpensive. Now in\n * order to do this the goal is that most functions are not aware of locking.\n * Once we have a TCB we lock it and unlock when we are through. This means\n * that the TCB lock is kind-of a \"global\" lock when working on an\n * association. Caution must be used when asserting a TCB_LOCK since if we\n * recurse we deadlock.\n *\n * Most other locks (INP and INFO) attempt to localize the locking i.e. we try\n * to contain the lock and unlock within the function that needs to lock it.\n * This sometimes mean we do extra locks and unlocks and lose a bit of\n * efficency, but if the performance statements about non-recursive locks are\n * true this should not be a problem.  One issue that arises with this only\n * lock when needed is that if an implicit association setup is done we have\n * a problem. If at the time I lookup an association I have NULL in the tcb\n * return, by the time I call to create the association some other processor\n * could have created it. This is what the CREATE lock on the endpoint.\n * Places where we will be implicitly creating the association OR just\n * creating an association (the connect call) will assert the CREATE_INP\n * lock. This will assure us that during all the lookup of INP and INFO if\n * another creator is also locking/looking up we can gate the two to\n * synchronize. So the CREATE_INP lock is also another one we must use\n * extreme caution in locking to make sure we don't hit a re-entrancy issue.\n *\n * For non FreeBSD 5.x we provide a bunch of EMPTY lock macros so we can\n * blatantly put locks everywhere and they reduce to nothing on\n * NetBSD/OpenBSD and FreeBSD 4.x\n *\n */\n\n/*\n * When working with the global SCTP lists we lock and unlock the INP_INFO\n * lock. So when we go to lookup an association we will want to do a\n * SCTP_INP_INFO_RLOCK() and then when we want to add a new association to\n * the SCTP_BASE_INFO() list's we will do a SCTP_INP_INFO_WLOCK().\n */\n#include <sys/cdefs.h>\n__FBSDID(\"$FreeBSD: release/9.0.0/sys/netinet/sctp_lock_bsd.h 218319 2011-02-05 12:12:51Z rrs $\");\n\n\nextern struct sctp_foo_stuff sctp_logoff[];\nextern int sctp_logoff_stuff;\n\n#define SCTP_IPI_COUNT_INIT()\n\n#define SCTP_STATLOG_INIT_LOCK()\n#define SCTP_STATLOG_LOCK()\n#define SCTP_STATLOG_UNLOCK()\n#define SCTP_STATLOG_DESTROY()\n\n#define SCTP_INP_INFO_LOCK_DESTROY() do { \\\n        if(rw_wowned(&SCTP_BASE_INFO(ipi_ep_mtx))) { \\\n             rw_wunlock(&SCTP_BASE_INFO(ipi_ep_mtx)); \\\n        } \\\n        rw_destroy(&SCTP_BASE_INFO(ipi_ep_mtx)); \\\n      }  while (0)\n\n#define SCTP_INP_INFO_LOCK_INIT() \\\n        rw_init(&SCTP_BASE_INFO(ipi_ep_mtx), \"sctp-info\");\n\n\n#define SCTP_INP_INFO_RLOCK()\tdo { \t\t\t\t\t\\\n             rw_rlock(&SCTP_BASE_INFO(ipi_ep_mtx));                         \\\n} while (0)\n\n#define SCTP_MCORE_QLOCK_INIT(cpstr) do { \\\n\t\tmtx_init(&(cpstr)->que_mtx,\t      \\\n\t\t\t \"sctp-mcore_queue\",\"queue_lock\",\t\\\n\t\t\t MTX_DEF|MTX_DUPOK);\t\t\\\n} while (0)\n\n#define SCTP_MCORE_QLOCK(cpstr)  do { \\\n\t\tmtx_lock(&(cpstr)->que_mtx);\t\\\n} while (0)\n\n#define SCTP_MCORE_QUNLOCK(cpstr)  do { \\\n\t\tmtx_unlock(&(cpstr)->que_mtx);\t\\\n} while (0)\n\n#define SCTP_MCORE_QDESTROY(cpstr)  do { \\\n\tif(mtx_owned(&(cpstr)->core_mtx)) {\t\\\n\t\tmtx_unlock(&(cpstr)->que_mtx);\t\\\n        } \\\n\tmtx_destroy(&(cpstr)->que_mtx);\t\\\n} while (0)\n\n\n#define SCTP_MCORE_LOCK_INIT(cpstr) do { \\\n\t\tmtx_init(&(cpstr)->core_mtx,\t      \\\n\t\t\t \"sctp-cpulck\",\"cpu_proc_lock\",\t\\\n\t\t\t MTX_DEF|MTX_DUPOK);\t\t\\\n} while (0)\n\n#define SCTP_MCORE_LOCK(cpstr)  do { \\\n\t\tmtx_lock(&(cpstr)->core_mtx);\t\\\n} while (0)\n\n#define SCTP_MCORE_UNLOCK(cpstr)  do { \\\n\t\tmtx_unlock(&(cpstr)->core_mtx);\t\\\n} while (0)\n\n#define SCTP_MCORE_DESTROY(cpstr)  do { \\\n\tif(mtx_owned(&(cpstr)->core_mtx)) {\t\\\n\t\tmtx_unlock(&(cpstr)->core_mtx);\t\\\n        } \\\n\tmtx_destroy(&(cpstr)->core_mtx);\t\\\n} while (0)\n\n#define SCTP_INP_INFO_WLOCK()\tdo { \t\t\t\t\t\\\n            rw_wlock(&SCTP_BASE_INFO(ipi_ep_mtx));                         \\\n} while (0)\n\n\n#define SCTP_INP_INFO_RUNLOCK()\t\trw_runlock(&SCTP_BASE_INFO(ipi_ep_mtx))\n#define SCTP_INP_INFO_WUNLOCK()\t\trw_wunlock(&SCTP_BASE_INFO(ipi_ep_mtx))\n\n\n#define SCTP_IPI_ADDR_INIT()\t\t\t\t\t\t\t\t\\\n        rw_init(&SCTP_BASE_INFO(ipi_addr_mtx), \"sctp-addr\")\n#define SCTP_IPI_ADDR_DESTROY() do  { \\\n        if(rw_wowned(&SCTP_BASE_INFO(ipi_addr_mtx))) { \\\n             rw_wunlock(&SCTP_BASE_INFO(ipi_addr_mtx)); \\\n        } \\\n\trw_destroy(&SCTP_BASE_INFO(ipi_addr_mtx)); \\\n      }  while (0)\n#define SCTP_IPI_ADDR_RLOCK()\tdo { \t\t\t\t\t\\\n             rw_rlock(&SCTP_BASE_INFO(ipi_addr_mtx));                         \\\n} while (0)\n#define SCTP_IPI_ADDR_WLOCK()\tdo { \t\t\t\t\t\\\n             rw_wlock(&SCTP_BASE_INFO(ipi_addr_mtx));                         \\\n} while (0)\n\n#define SCTP_IPI_ADDR_RUNLOCK()\t\trw_runlock(&SCTP_BASE_INFO(ipi_addr_mtx))\n#define SCTP_IPI_ADDR_WUNLOCK()\t\trw_wunlock(&SCTP_BASE_INFO(ipi_addr_mtx))\n\n\n#define SCTP_IPI_ITERATOR_WQ_INIT() \\\n        mtx_init(&sctp_it_ctl.ipi_iterator_wq_mtx, \"sctp-it-wq\", \"sctp_it_wq\", MTX_DEF)\n\n#define SCTP_IPI_ITERATOR_WQ_DESTROY() \\\n\tmtx_destroy(&sctp_it_ctl.ipi_iterator_wq_mtx)\n\n#define SCTP_IPI_ITERATOR_WQ_LOCK()\tdo { \t\t\t\t\t\\\n             mtx_lock(&sctp_it_ctl.ipi_iterator_wq_mtx);                \\\n} while (0)\n\n#define SCTP_IPI_ITERATOR_WQ_UNLOCK()\t\tmtx_unlock(&sctp_it_ctl.ipi_iterator_wq_mtx)\n\n\n#define SCTP_IP_PKTLOG_INIT() \\\n        mtx_init(&SCTP_BASE_INFO(ipi_pktlog_mtx), \"sctp-pktlog\", \"packetlog\", MTX_DEF)\n\n\n#define SCTP_IP_PKTLOG_LOCK()\tdo { \t\t\t\\\n             mtx_lock(&SCTP_BASE_INFO(ipi_pktlog_mtx));     \\\n} while (0)\n\n#define SCTP_IP_PKTLOG_UNLOCK()\tmtx_unlock(&SCTP_BASE_INFO(ipi_pktlog_mtx))\n\n#define SCTP_IP_PKTLOG_DESTROY() \\\n\tmtx_destroy(&SCTP_BASE_INFO(ipi_pktlog_mtx))\n\n\n\n\n\n/*\n * The INP locks we will use for locking an SCTP endpoint, so for example if\n * we want to change something at the endpoint level for example random_store\n * or cookie secrets we lock the INP level.\n */\n\n#define SCTP_INP_READ_INIT(_inp) \\\n\tmtx_init(&(_inp)->inp_rdata_mtx, \"sctp-read\", \"inpr\", MTX_DEF | MTX_DUPOK)\n\n#define SCTP_INP_READ_DESTROY(_inp) \\\n\tmtx_destroy(&(_inp)->inp_rdata_mtx)\n\n#define SCTP_INP_READ_LOCK(_inp)\tdo { \\\n        mtx_lock(&(_inp)->inp_rdata_mtx);    \\\n} while (0)\n\n\n#define SCTP_INP_READ_UNLOCK(_inp) mtx_unlock(&(_inp)->inp_rdata_mtx)\n\n\n#define SCTP_INP_LOCK_INIT(_inp) \\\n\tmtx_init(&(_inp)->inp_mtx, \"sctp-inp\", \"inp\", MTX_DEF | MTX_DUPOK)\n#define SCTP_ASOC_CREATE_LOCK_INIT(_inp) \\\n\tmtx_init(&(_inp)->inp_create_mtx, \"sctp-create\", \"inp_create\", \\\n\t\t MTX_DEF | MTX_DUPOK)\n\n#define SCTP_INP_LOCK_DESTROY(_inp) \\\n\tmtx_destroy(&(_inp)->inp_mtx)\n\n#define SCTP_INP_LOCK_CONTENDED(_inp) ((_inp)->inp_mtx.mtx_lock & MTX_CONTESTED)\n\n#define SCTP_INP_READ_CONTENDED(_inp) ((_inp)->inp_rdata_mtx.mtx_lock & MTX_CONTESTED)\n\n#define SCTP_ASOC_CREATE_LOCK_CONTENDED(_inp) ((_inp)->inp_create_mtx.mtx_lock & MTX_CONTESTED)\n\n\n#define SCTP_ASOC_CREATE_LOCK_DESTROY(_inp) \\\n\tmtx_destroy(&(_inp)->inp_create_mtx)\n\n\n#ifdef SCTP_LOCK_LOGGING\n#define SCTP_INP_RLOCK(_inp)\tdo { \t\t\t\t\t\\\n\tif(SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_LOCK_LOGGING_ENABLE) sctp_log_lock(_inp, (struct sctp_tcb *)NULL, SCTP_LOG_LOCK_INP);\\\n        mtx_lock(&(_inp)->inp_mtx);                                     \\\n} while (0)\n\n#define SCTP_INP_WLOCK(_inp)\tdo { \t\t\t\t\t\\\n\tif(SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_LOCK_LOGGING_ENABLE) sctp_log_lock(_inp, (struct sctp_tcb *)NULL, SCTP_LOG_LOCK_INP);\\\n        mtx_lock(&(_inp)->inp_mtx);                                     \\\n} while (0)\n\n#else\n\n#define SCTP_INP_RLOCK(_inp)\tdo { \t\t\t\t\t\\\n        mtx_lock(&(_inp)->inp_mtx);                                     \\\n} while (0)\n\n#define SCTP_INP_WLOCK(_inp)\tdo { \t\t\t\t\t\\\n        mtx_lock(&(_inp)->inp_mtx);                                     \\\n} while (0)\n\n#endif\n\n\n#define SCTP_TCB_SEND_LOCK_INIT(_tcb) \\\n\tmtx_init(&(_tcb)->tcb_send_mtx, \"sctp-send-tcb\", \"tcbs\", MTX_DEF | MTX_DUPOK)\n\n#define SCTP_TCB_SEND_LOCK_DESTROY(_tcb) mtx_destroy(&(_tcb)->tcb_send_mtx)\n\n#define SCTP_TCB_SEND_LOCK(_tcb)  do { \\\n\tmtx_lock(&(_tcb)->tcb_send_mtx); \\\n} while (0)\n\n#define SCTP_TCB_SEND_UNLOCK(_tcb) mtx_unlock(&(_tcb)->tcb_send_mtx)\n\n#define SCTP_INP_INCR_REF(_inp) atomic_add_int(&((_inp)->refcount), 1)\n#define SCTP_INP_DECR_REF(_inp) atomic_add_int(&((_inp)->refcount), -1)\n\n\n#ifdef SCTP_LOCK_LOGGING\n#define SCTP_ASOC_CREATE_LOCK(_inp) \\\n\tdo {\t\t\t\t\t\t\t\t\\\n\tif(SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_LOCK_LOGGING_ENABLE) sctp_log_lock(_inp, (struct sctp_tcb *)NULL, SCTP_LOG_LOCK_CREATE); \\\n\t\tmtx_lock(&(_inp)->inp_create_mtx);\t\t\t\\\n\t} while (0)\n#else\n\n#define SCTP_ASOC_CREATE_LOCK(_inp) \\\n\tdo {\t\t\t\t\t\t\t\t\\\n\t\tmtx_lock(&(_inp)->inp_create_mtx);\t\t\t\\\n\t} while (0)\n#endif\n\n#define SCTP_INP_RUNLOCK(_inp)\t\tmtx_unlock(&(_inp)->inp_mtx)\n#define SCTP_INP_WUNLOCK(_inp)\t\tmtx_unlock(&(_inp)->inp_mtx)\n#define SCTP_ASOC_CREATE_UNLOCK(_inp)\tmtx_unlock(&(_inp)->inp_create_mtx)\n\n/*\n * For the majority of things (once we have found the association) we will\n * lock the actual association mutex. This will protect all the assoiciation\n * level queues and streams and such. We will need to lock the socket layer\n * when we stuff data up into the receiving sb_mb. I.e. we will need to do an\n * extra SOCKBUF_LOCK(&so->so_rcv) even though the association is locked.\n */\n\n#define SCTP_TCB_LOCK_INIT(_tcb) \\\n\tmtx_init(&(_tcb)->tcb_mtx, \"sctp-tcb\", \"tcb\", MTX_DEF | MTX_DUPOK)\n\n#define SCTP_TCB_LOCK_DESTROY(_tcb)\tmtx_destroy(&(_tcb)->tcb_mtx)\n\n#ifdef SCTP_LOCK_LOGGING\n#define SCTP_TCB_LOCK(_tcb)  do {\t\t\t\t\t\\\n\tif(SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_LOCK_LOGGING_ENABLE)  sctp_log_lock(_tcb->sctp_ep, _tcb, SCTP_LOG_LOCK_TCB);          \\\n\tmtx_lock(&(_tcb)->tcb_mtx);                                     \\\n} while (0)\n\n#else\n#define SCTP_TCB_LOCK(_tcb)  do {\t\t\t\t\t\\\n\tmtx_lock(&(_tcb)->tcb_mtx);                                     \\\n} while (0)\n\n#endif\n\n\n#define SCTP_TCB_TRYLOCK(_tcb) \tmtx_trylock(&(_tcb)->tcb_mtx)\n\n#define SCTP_TCB_UNLOCK(_tcb)\t\tmtx_unlock(&(_tcb)->tcb_mtx)\n\n#define SCTP_TCB_UNLOCK_IFOWNED(_tcb)\t      do { \\\n                                                if (mtx_owned(&(_tcb)->tcb_mtx)) \\\n                                                     mtx_unlock(&(_tcb)->tcb_mtx); \\\n                                              } while (0)\n\n\n\n#ifdef INVARIANTS\n#define SCTP_TCB_LOCK_ASSERT(_tcb) do { \\\n                            if (mtx_owned(&(_tcb)->tcb_mtx) == 0) \\\n                                panic(\"Don't own TCB lock\"); \\\n                            } while (0)\n#else\n#define SCTP_TCB_LOCK_ASSERT(_tcb)\n#endif\n\n#define SCTP_ITERATOR_LOCK_INIT() \\\n        mtx_init(&sctp_it_ctl.it_mtx, \"sctp-it\", \"iterator\", MTX_DEF)\n\n#ifdef INVARIANTS\n#define SCTP_ITERATOR_LOCK() \\\n\tdo {\t\t\t\t\t\t\t\t\\\n\t\tif (mtx_owned(&sctp_it_ctl.it_mtx))\t\t\t\\\n\t\t\tpanic(\"Iterator Lock\");\t\t\t\t\\\n\t\tmtx_lock(&sctp_it_ctl.it_mtx);\t\t\t\t\\\n\t} while (0)\n#else\n#define SCTP_ITERATOR_LOCK() \\\n\tdo {\t\t\t\t\t\t\t\t\\\n\t\tmtx_lock(&sctp_it_ctl.it_mtx);\t\t\t\t\\\n\t} while (0)\n\n#endif\n\n#define SCTP_ITERATOR_UNLOCK()\t        mtx_unlock(&sctp_it_ctl.it_mtx)\n#define SCTP_ITERATOR_LOCK_DESTROY()\tmtx_destroy(&sctp_it_ctl.it_mtx)\n\n\n#define SCTP_WQ_ADDR_INIT() do { \\\n        mtx_init(&SCTP_BASE_INFO(wq_addr_mtx), \"sctp-addr-wq\",\"sctp_addr_wq\",MTX_DEF); \\\n } while (0)\n\n#define SCTP_WQ_ADDR_DESTROY() do  { \\\n        if(mtx_owned(&SCTP_BASE_INFO(wq_addr_mtx))) { \\\n             mtx_unlock(&SCTP_BASE_INFO(wq_addr_mtx)); \\\n        } \\\n\t    mtx_destroy(&SCTP_BASE_INFO(wq_addr_mtx)); \\\n      }  while (0)\n\n#define SCTP_WQ_ADDR_LOCK()\tdo { \\\n             mtx_lock(&SCTP_BASE_INFO(wq_addr_mtx));  \\\n} while (0)\n#define SCTP_WQ_ADDR_UNLOCK() do { \\\n\t\tmtx_unlock(&SCTP_BASE_INFO(wq_addr_mtx)); \\\n} while (0)\n\n\n\n#define SCTP_INCR_EP_COUNT() \\\n                do { \\\n\t\t       atomic_add_int(&SCTP_BASE_INFO(ipi_count_ep), 1); \\\n\t        } while (0)\n\n#define SCTP_DECR_EP_COUNT() \\\n                do { \\\n\t\t       atomic_subtract_int(&SCTP_BASE_INFO(ipi_count_ep), 1); \\\n\t        } while (0)\n\n#define SCTP_INCR_ASOC_COUNT() \\\n                do { \\\n\t               atomic_add_int(&SCTP_BASE_INFO(ipi_count_asoc), 1); \\\n\t        } while (0)\n\n#define SCTP_DECR_ASOC_COUNT() \\\n                do { \\\n\t               atomic_subtract_int(&SCTP_BASE_INFO(ipi_count_asoc), 1); \\\n\t        } while (0)\n\n#define SCTP_INCR_LADDR_COUNT() \\\n                do { \\\n\t               atomic_add_int(&SCTP_BASE_INFO(ipi_count_laddr), 1); \\\n\t        } while (0)\n\n#define SCTP_DECR_LADDR_COUNT() \\\n                do { \\\n\t               atomic_subtract_int(&SCTP_BASE_INFO(ipi_count_laddr), 1); \\\n\t        } while (0)\n\n#define SCTP_INCR_RADDR_COUNT() \\\n                do { \\\n \t               atomic_add_int(&SCTP_BASE_INFO(ipi_count_raddr), 1); \\\n\t        } while (0)\n\n#define SCTP_DECR_RADDR_COUNT() \\\n                do { \\\n \t               atomic_subtract_int(&SCTP_BASE_INFO(ipi_count_raddr),1); \\\n\t        } while (0)\n\n#define SCTP_INCR_CHK_COUNT() \\\n                do { \\\n  \t               atomic_add_int(&SCTP_BASE_INFO(ipi_count_chunk), 1); \\\n\t        } while (0)\n#ifdef INVARIANTS\n#define SCTP_DECR_CHK_COUNT() \\\n                do { \\\n                       if(SCTP_BASE_INFO(ipi_count_chunk) == 0) \\\n                             panic(\"chunk count to 0?\");    \\\n  \t               atomic_subtract_int(&SCTP_BASE_INFO(ipi_count_chunk), 1); \\\n\t        } while (0)\n#else\n#define SCTP_DECR_CHK_COUNT() \\\n                do { \\\n                       if(SCTP_BASE_INFO(ipi_count_chunk) != 0) \\\n  \t               atomic_subtract_int(&SCTP_BASE_INFO(ipi_count_chunk), 1); \\\n\t        } while (0)\n#endif\n#define SCTP_INCR_READQ_COUNT() \\\n                do { \\\n\t\t       atomic_add_int(&SCTP_BASE_INFO(ipi_count_readq),1); \\\n\t        } while (0)\n\n#define SCTP_DECR_READQ_COUNT() \\\n                do { \\\n\t\t       atomic_subtract_int(&SCTP_BASE_INFO(ipi_count_readq), 1); \\\n\t        } while (0)\n\n#define SCTP_INCR_STRMOQ_COUNT() \\\n                do { \\\n\t\t       atomic_add_int(&SCTP_BASE_INFO(ipi_count_strmoq), 1); \\\n\t        } while (0)\n\n#define SCTP_DECR_STRMOQ_COUNT() \\\n                do { \\\n\t\t       atomic_subtract_int(&SCTP_BASE_INFO(ipi_count_strmoq), 1); \\\n\t        } while (0)\n\n\n#if defined(SCTP_SO_LOCK_TESTING)\n#define SCTP_INP_SO(sctpinp)\t(sctpinp)->ip_inp.inp.inp_socket\n#define SCTP_SOCKET_LOCK(so, refcnt)\n#define SCTP_SOCKET_UNLOCK(so, refcnt)\n#endif\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/netinet/sctp_os.h",
    "content": "/*-\n * Copyright (c) 2006-2007, by Cisco Systems, Inc. All rights reserved.\n * Copyright (c) 2008-2011, by Randall Stewart. All rights reserved.\n * Copyright (c) 2008-2011, by Michael Tuexen. All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions are met:\n *\n * a) Redistributions of source code must retain the above copyright notice,\n *   this list of conditions and the following disclaimer.\n *\n * b) Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in\n *   the documentation and/or other materials provided with the distribution.\n *\n * c) Neither the name of Cisco Systems, Inc. nor the names of its\n *    contributors may be used to endorse or promote products derived\n *    from this software without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n * \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,\n * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE\n * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\n * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\n * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\n * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\n * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF\n * THE POSSIBILITY OF SUCH DAMAGE.\n */\n#include <sys/cdefs.h>\n__FBSDID(\"$FreeBSD: release/9.0.0/sys/netinet/sctp_os.h 218319 2011-02-05 12:12:51Z rrs $\");\n#ifndef __sctp_os_h__\n#define __sctp_os_h__\n\n/*\n * General kernel memory allocation:\n *  SCTP_MALLOC(element, type, size, name)\n *  SCTP_FREE(element)\n * Kernel memory allocation for \"soname\"- memory must be zeroed.\n *  SCTP_MALLOC_SONAME(name, type, size)\n *  SCTP_FREE_SONAME(name)\n */\n\n/*\n * Zone(pool) allocation routines: MUST be defined for each OS.\n *  zone = zone/pool pointer.\n *  name = string name of the zone/pool.\n *  size = size of each zone/pool element.\n *  number = number of elements in zone/pool.\n *  type = structure type to allocate\n *\n * sctp_zone_t\n * SCTP_ZONE_INIT(zone, name, size, number)\n * SCTP_ZONE_GET(zone, type)\n * SCTP_ZONE_FREE(zone, element)\n * SCTP_ZONE_DESTROY(zone)\n */\n\n#include <netinet/sctp_os_bsd.h>\n\n\n\n\n\n/* All os's must implement this address gatherer. If\n * no VRF's exist, then vrf 0 is the only one and all\n * addresses and ifn's live here.\n */\n#define SCTP_DEFAULT_VRF 0\nvoid sctp_init_vrf_list(int vrfid);\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/netinet/sctp_os_bsd.h",
    "content": "/*-\n * Copyright (c) 2006-2007, by Cisco Systems, Inc. All rights reserved.\n * Copyright (c) 2008-2011, by Randall Stewart. All rights reserved.\n * Copyright (c) 2008-2011, by Michael Tuexen. All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions are met:\n *\n * a) Redistributions of source code must retain the above copyright notice,\n *   this list of conditions and the following disclaimer.\n *\n * b) Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in\n *   the documentation and/or other materials provided with the distribution.\n *\n * c) Neither the name of Cisco Systems, Inc. nor the names of its\n *    contributors may be used to endorse or promote products derived\n *    from this software without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n * \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,\n * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE\n * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\n * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\n * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\n * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\n * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF\n * THE POSSIBILITY OF SUCH DAMAGE.\n */\n#include <sys/cdefs.h>\n__FBSDID(\"$FreeBSD: release/9.0.0/sys/netinet/sctp_os_bsd.h 221251 2011-04-30 11:22:30Z tuexen $\");\n#ifndef __sctp_os_bsd_h__\n#define __sctp_os_bsd_h__\n/*\n * includes\n */\n#include \"opt_ipsec.h\"\n#include \"opt_compat.h\"\n#include \"opt_inet6.h\"\n#include \"opt_inet.h\"\n#include \"opt_sctp.h\"\n\n#include <sys/param.h>\n#include <sys/ktr.h>\n#include <sys/systm.h>\n#include <sys/malloc.h>\n#include <sys/kernel.h>\n#include <sys/sysctl.h>\n#include <sys/mbuf.h>\n#include <sys/protosw.h>\n#include <sys/socket.h>\n#include <sys/socketvar.h>\n#include <sys/jail.h>\n#include <sys/sysctl.h>\n#include <sys/resourcevar.h>\n#include <sys/uio.h>\n#include <sys/lock.h>\n#include <sys/rwlock.h>\n#include <sys/kthread.h>\n#include <sys/priv.h>\n#include <sys/random.h>\n#include <sys/limits.h>\n#include <sys/queue.h>\n#include <machine/cpu.h>\n\n#include <net/if.h>\n#include <net/if_types.h>\n#include <net/if_var.h>\n#include <net/route.h>\n#include <net/vnet.h>\n\n#include <netinet/in.h>\n#include <netinet/in_systm.h>\n#include <netinet/ip.h>\n#include <netinet/in_pcb.h>\n#include <netinet/in_var.h>\n#include <netinet/ip_var.h>\n#include <netinet/ip_icmp.h>\n#include <netinet/icmp_var.h>\n\n#ifdef IPSEC\n#include <netipsec/ipsec.h>\n#include <netipsec/key.h>\n#endif\t\t\t\t/* IPSEC */\n\n#ifdef INET6\n#include <sys/domain.h>\n#ifdef IPSEC\n#include <netipsec/ipsec6.h>\n#endif\n#include <netinet/ip6.h>\n#include <netinet6/ip6_var.h>\n#include <netinet6/in6_pcb.h>\n#include <netinet/icmp6.h>\n#include <netinet6/ip6protosw.h>\n#include <netinet6/nd6.h>\n#include <netinet6/scope6_var.h>\n#endif\t\t\t\t/* INET6 */\n\n\n#include <netinet/ip_options.h>\n\n#ifndef in6pcb\n#define in6pcb\t\tinpcb\n#endif\n/* Declare all the malloc names for all the various mallocs */\nMALLOC_DECLARE(SCTP_M_MAP);\nMALLOC_DECLARE(SCTP_M_STRMI);\nMALLOC_DECLARE(SCTP_M_STRMO);\nMALLOC_DECLARE(SCTP_M_ASC_ADDR);\nMALLOC_DECLARE(SCTP_M_ASC_IT);\nMALLOC_DECLARE(SCTP_M_AUTH_CL);\nMALLOC_DECLARE(SCTP_M_AUTH_KY);\nMALLOC_DECLARE(SCTP_M_AUTH_HL);\nMALLOC_DECLARE(SCTP_M_AUTH_IF);\nMALLOC_DECLARE(SCTP_M_STRESET);\nMALLOC_DECLARE(SCTP_M_CMSG);\nMALLOC_DECLARE(SCTP_M_COPYAL);\nMALLOC_DECLARE(SCTP_M_VRF);\nMALLOC_DECLARE(SCTP_M_IFA);\nMALLOC_DECLARE(SCTP_M_IFN);\nMALLOC_DECLARE(SCTP_M_TIMW);\nMALLOC_DECLARE(SCTP_M_MVRF);\nMALLOC_DECLARE(SCTP_M_ITER);\nMALLOC_DECLARE(SCTP_M_SOCKOPT);\nMALLOC_DECLARE(SCTP_M_MCORE);\n\n#if defined(SCTP_LOCAL_TRACE_BUF)\n\n#define SCTP_GET_CYCLECOUNT get_cyclecount()\n#define SCTP_CTR6 sctp_log_trace\n\n#else\n#define SCTP_CTR6 CTR6\n#endif\n\n/*\n * Macros to expand out globals defined by various modules\n * to either a real global or a virtualized instance of one,\n * depending on whether VIMAGE is defined.\n */\n/* then define the macro(s) that hook into the vimage macros */\n#define MODULE_GLOBAL(__SYMBOL) V_##__SYMBOL\n\n#define V_system_base_info VNET(system_base_info)\n#define SCTP_BASE_INFO(__m) V_system_base_info.sctppcbinfo.__m\n#define SCTP_BASE_STATS V_system_base_info.sctpstat\n#define SCTP_BASE_STATS_SYSCTL VNET_NAME(system_base_info.sctpstat)\n#define SCTP_BASE_STAT(__m)     V_system_base_info.sctpstat.__m\n#define SCTP_BASE_SYSCTL(__m) VNET_NAME(system_base_info.sctpsysctl.__m)\n#define SCTP_BASE_VAR(__m) V_system_base_info.__m\n\n/*\n *\n */\n#define USER_ADDR_NULL\t(NULL)\t/* FIX ME: temp */\n\n#if defined(SCTP_DEBUG)\n#define SCTPDBG(level, params...)\t\t\t\t\t\\\n{\t\t\t\t\t\t\t\t\t\\\n    do {\t\t\t\t\t\t\t\t\\\n\tif (SCTP_BASE_SYSCTL(sctp_debug_on) & level ) {\t\t\t\\\n\t    printf(params);\t\t\t\t\t\t\\\n\t}\t\t\t\t\t\t\t\t\\\n    } while (0);\t\t\t\t\t\t\t\\\n}\n#define SCTPDBG_ADDR(level, addr)\t\t\t\t\t\\\n{\t\t\t\t\t\t\t\t\t\\\n    do {\t\t\t\t\t\t\t\t\\\n\tif (SCTP_BASE_SYSCTL(sctp_debug_on) & level ) {\t\t\t\\\n\t    sctp_print_address(addr);\t\t\t\t\t\\\n\t}\t\t\t\t\t\t\t\t\\\n    } while (0);\t\t\t\t\t\t\t\\\n}\n#define SCTPDBG_PKT(level, iph, sh)\t\t\t\t\t\\\n{\t\t\t\t\t\t\t\t\t\\\n    do {\t\t\t\t\t\t\t\t\\\n\t    if (SCTP_BASE_SYSCTL(sctp_debug_on) & level) {\t\t\\\n\t\t    sctp_print_address_pkt(iph, sh);\t\t\t\\\n\t    }\t\t\t\t\t\t\t\t\\\n    } while (0);\t\t\t\t\t\t\t\\\n}\n#else\n#define SCTPDBG(level, params...)\n#define SCTPDBG_ADDR(level, addr)\n#define SCTPDBG_PKT(level, iph, sh)\n#endif\n#define SCTP_PRINTF(params...)\tprintf(params)\n\n#ifdef SCTP_LTRACE_CHUNKS\n#define SCTP_LTRACE_CHK(a, b, c, d) if(SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_LTRACE_CHUNK_ENABLE) SCTP_CTR6(KTR_SUBSYS, \"SCTP:%d[%d]:%x-%x-%x-%x\", SCTP_LOG_CHUNK_PROC, 0, a, b, c, d)\n#else\n#define SCTP_LTRACE_CHK(a, b, c, d)\n#endif\n\n#ifdef SCTP_LTRACE_ERRORS\n#define SCTP_LTRACE_ERR_RET_PKT(m, inp, stcb, net, file, err) if(SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_LTRACE_ERROR_ENABLE) \\\n                                                         printf(\"mbuf:%p inp:%p stcb:%p net:%p file:%x line:%d error:%d\\n\", \\\n\t\t\t\t\t\t\t\t     m, inp, stcb, net, file, __LINE__, err);\n#define SCTP_LTRACE_ERR_RET(inp, stcb, net, file, err) if(SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_LTRACE_ERROR_ENABLE) \\\n                                                          printf(\"inp:%p stcb:%p net:%p file:%x line:%d error:%d\\n\", \\\n\t\t\t\t\t\t\t\t     inp, stcb, net, file, __LINE__, err);\n#else\n#define SCTP_LTRACE_ERR_RET_PKT(m, inp, stcb, net, file, err)\n#define SCTP_LTRACE_ERR_RET(inp, stcb, net, file, err)\n#endif\n\n\n/*\n * Local address and interface list handling\n */\n#define SCTP_MAX_VRF_ID\t\t0\n#define SCTP_SIZE_OF_VRF_HASH\t3\n#define SCTP_IFNAMSIZ\t\tIFNAMSIZ\n#define SCTP_DEFAULT_VRFID\t0\n#define SCTP_VRF_ADDR_HASH_SIZE\t16\n#define SCTP_VRF_IFN_HASH_SIZE\t3\n#define\tSCTP_INIT_VRF_TABLEID(vrf)\n\n#define SCTP_IFN_IS_IFT_LOOP(ifn) ((ifn)->ifn_type == IFT_LOOP)\n#define SCTP_ROUTE_IS_REAL_LOOP(ro) ((ro)->ro_rt && (ro)->ro_rt->rt_ifa && (ro)->ro_rt->rt_ifa->ifa_ifp && (ro)->ro_rt->rt_ifa->ifa_ifp->if_type == IFT_LOOP)\n\n/*\n * Access to IFN's to help with src-addr-selection\n */\n/* This could return VOID if the index works but for BSD we provide both. */\n#define SCTP_GET_IFN_VOID_FROM_ROUTE(ro) (void *)ro->ro_rt->rt_ifp\n#define SCTP_GET_IF_INDEX_FROM_ROUTE(ro) (ro)->ro_rt->rt_ifp->if_index\n#define SCTP_ROUTE_HAS_VALID_IFN(ro) ((ro)->ro_rt && (ro)->ro_rt->rt_ifp)\n\n/*\n * general memory allocation\n */\n#define SCTP_MALLOC(var, type, size, name) \\\n    do { \\\n\tvar = (type)malloc(size, name, M_NOWAIT); \\\n    } while (0)\n\n#define SCTP_FREE(var, type)\tfree(var, type)\n\n#define SCTP_MALLOC_SONAME(var, type, size) \\\n    do { \\\n\tvar = (type)malloc(size, M_SONAME, M_WAITOK | M_ZERO); \\\n    } while (0)\n\n#define SCTP_FREE_SONAME(var)\tfree(var, M_SONAME)\n\n#define SCTP_PROCESS_STRUCT struct proc *\n\n/*\n * zone allocation functions\n */\n#include <vm/uma.h>\n\n/* SCTP_ZONE_INIT: initialize the zone */\ntypedef struct uma_zone *sctp_zone_t;\n\n#define SCTP_ZONE_INIT(zone, name, size, number) { \\\n\tzone = uma_zcreate(name, size, NULL, NULL, NULL, NULL, UMA_ALIGN_PTR,\\\n\t\t0); \\\n\tuma_zone_set_max(zone, number); \\\n}\n\n#define SCTP_ZONE_DESTROY(zone) uma_zdestroy(zone)\n\n/* SCTP_ZONE_GET: allocate element from the zone */\n#define SCTP_ZONE_GET(zone, type) \\\n\t(type *)uma_zalloc(zone, M_NOWAIT);\n\n/* SCTP_ZONE_FREE: free element from the zone */\n#define SCTP_ZONE_FREE(zone, element) \\\n\tuma_zfree(zone, element);\n\n#define SCTP_HASH_INIT(size, hashmark) hashinit_flags(size, M_PCB, hashmark, HASH_NOWAIT)\n#define SCTP_HASH_FREE(table, hashmark) hashdestroy(table, M_PCB, hashmark)\n\n#define SCTP_M_COPYM\tm_copym\n\n/*\n * timers\n */\n#include <sys/callout.h>\ntypedef struct callout sctp_os_timer_t;\n\n\n#define SCTP_OS_TIMER_INIT(tmr)\tcallout_init(tmr, 1)\n#define SCTP_OS_TIMER_START\tcallout_reset\n#define SCTP_OS_TIMER_STOP\tcallout_stop\n#define SCTP_OS_TIMER_STOP_DRAIN callout_drain\n#define SCTP_OS_TIMER_PENDING\tcallout_pending\n#define SCTP_OS_TIMER_ACTIVE\tcallout_active\n#define SCTP_OS_TIMER_DEACTIVATE callout_deactivate\n\n#define sctp_get_tick_count() (ticks)\n\n#define SCTP_UNUSED __attribute__((unused))\n\n/*\n * Functions\n */\n/* Mbuf manipulation and access macros  */\n#define SCTP_BUF_LEN(m) (m->m_len)\n#define SCTP_BUF_NEXT(m) (m->m_next)\n#define SCTP_BUF_NEXT_PKT(m) (m->m_nextpkt)\n#define SCTP_BUF_RESV_UF(m, size) m->m_data += size\n#define SCTP_BUF_AT(m, size) m->m_data + size\n#define SCTP_BUF_IS_EXTENDED(m) (m->m_flags & M_EXT)\n#define SCTP_BUF_EXTEND_SIZE(m) (m->m_ext.ext_size)\n#define SCTP_BUF_TYPE(m) (m->m_type)\n#define SCTP_BUF_RECVIF(m) (m->m_pkthdr.rcvif)\n#define SCTP_BUF_PREPEND\tM_PREPEND\n\n#define SCTP_ALIGN_TO_END(m, len) if(m->m_flags & M_PKTHDR) { \\\n                                     MH_ALIGN(m, len); \\\n                                  } else if ((m->m_flags & M_EXT) == 0) { \\\n                                     M_ALIGN(m, len); \\\n                                  }\n\n/* We make it so if you have up to 4 threads\n * writing based on the default size of\n * the packet log 65 k, that would be\n * 4 16k packets before we would hit\n * a problem.\n */\n#define SCTP_PKTLOG_WRITERS_NEED_LOCK 3\n\n/*************************/\n/*      MTU              */\n/*************************/\n#define SCTP_GATHER_MTU_FROM_IFN_INFO(ifn, ifn_index, af) ((struct ifnet *)ifn)->if_mtu\n#define SCTP_GATHER_MTU_FROM_ROUTE(sctp_ifa, sa, rt) ((rt != NULL) ? rt->rt_rmx.rmx_mtu : 0)\n#define SCTP_GATHER_MTU_FROM_INTFC(sctp_ifn) ((sctp_ifn->ifn_p != NULL) ? ((struct ifnet *)(sctp_ifn->ifn_p))->if_mtu : 0)\n#define SCTP_SET_MTU_OF_ROUTE(sa, rt, mtu) do { \\\n                                              if (rt != NULL) \\\n                                                 rt->rt_rmx.rmx_mtu = mtu; \\\n                                           } while(0)\n\n/* (de-)register interface event notifications */\n#define SCTP_REGISTER_INTERFACE(ifhandle, af)\n#define SCTP_DEREGISTER_INTERFACE(ifhandle, af)\n\n\n/*************************/\n/* These are for logging */\n/*************************/\n/* return the base ext data pointer */\n#define SCTP_BUF_EXTEND_BASE(m) (m->m_ext.ext_buf)\n /* return the refcnt of the data pointer */\n#define SCTP_BUF_EXTEND_REFCNT(m) (*m->m_ext.ref_cnt)\n/* return any buffer related flags, this is\n * used beyond logging for apple only.\n */\n#define SCTP_BUF_GET_FLAGS(m) (m->m_flags)\n\n/* For BSD this just accesses the M_PKTHDR length\n * so it operates on an mbuf with hdr flag. Other\n * O/S's may have separate packet header and mbuf\n * chain pointers.. thus the macro.\n */\n#define SCTP_HEADER_TO_CHAIN(m) (m)\n#define SCTP_DETACH_HEADER_FROM_CHAIN(m)\n#define SCTP_HEADER_LEN(m) (m->m_pkthdr.len)\n#define SCTP_GET_HEADER_FOR_OUTPUT(o_pak) 0\n#define SCTP_RELEASE_HEADER(m)\n#define SCTP_RELEASE_PKT(m)\tsctp_m_freem(m)\n#define SCTP_ENABLE_UDP_CSUM(m) do { \\\n\t\t\t\t\tm->m_pkthdr.csum_flags = CSUM_UDP; \\\n\t\t\t\t\tm->m_pkthdr.csum_data = offsetof(struct udphdr, uh_sum); \\\n\t\t\t\t} while (0)\n\n#define SCTP_GET_PKT_VRFID(m, vrf_id)  ((vrf_id = SCTP_DEFAULT_VRFID) != SCTP_DEFAULT_VRFID)\n\n\n\n/* Attach the chain of data into the sendable packet. */\n#define SCTP_ATTACH_CHAIN(pak, m, packet_length) do { \\\n                                                 pak = m; \\\n                                                 pak->m_pkthdr.len = packet_length; \\\n                         } while(0)\n\n/* Other m_pkthdr type things */\n#define SCTP_IS_IT_BROADCAST(dst, m) ((m->m_flags & M_PKTHDR) ? in_broadcast(dst, m->m_pkthdr.rcvif) : 0)\n#define SCTP_IS_IT_LOOPBACK(m) ((m->m_flags & M_PKTHDR) && ((m->m_pkthdr.rcvif == NULL) || (m->m_pkthdr.rcvif->if_type == IFT_LOOP)))\n\n\n/* This converts any input packet header\n * into the chain of data holders, for BSD\n * its a NOP.\n */\n\n/* Macro's for getting length from V6/V4 header */\n#define SCTP_GET_IPV4_LENGTH(iph) (iph->ip_len)\n#define SCTP_GET_IPV6_LENGTH(ip6) (ntohs(ip6->ip6_plen))\n\n/* get the v6 hop limit */\n#define SCTP_GET_HLIM(inp, ro)\tin6_selecthlim((struct in6pcb *)&inp->ip_inp.inp, (ro ? (ro->ro_rt ? (ro->ro_rt->rt_ifp) : (NULL)) : (NULL)));\n\n/* is the endpoint v6only? */\n#define SCTP_IPV6_V6ONLY(inp)\t(((struct inpcb *)inp)->inp_flags & IN6P_IPV6_V6ONLY)\n/* is the socket non-blocking? */\n#define SCTP_SO_IS_NBIO(so)\t((so)->so_state & SS_NBIO)\n#define SCTP_SET_SO_NBIO(so)\t((so)->so_state |= SS_NBIO)\n#define SCTP_CLEAR_SO_NBIO(so)\t((so)->so_state &= ~SS_NBIO)\n/* get the socket type */\n#define SCTP_SO_TYPE(so)\t((so)->so_type)\n/* reserve sb space for a socket */\n#define SCTP_SORESERVE(so, send, recv)\tsoreserve(so, send, recv)\n/* wakeup a socket */\n#define SCTP_SOWAKEUP(so)\twakeup(&(so)->so_timeo)\n/* clear the socket buffer state */\n#define SCTP_SB_CLEAR(sb)\t\\\n\t(sb).sb_cc = 0;\t\t\\\n\t(sb).sb_mb = NULL;\t\\\n\t(sb).sb_mbcnt = 0;\n\n#define SCTP_SB_LIMIT_RCV(so) so->so_rcv.sb_hiwat\n#define SCTP_SB_LIMIT_SND(so) so->so_snd.sb_hiwat\n\n/*\n * routes, output, etc.\n */\ntypedef struct route sctp_route_t;\ntypedef struct rtentry sctp_rtentry_t;\n\n#define SCTP_RTALLOC(ro, vrf_id) rtalloc_ign((struct route *)ro, 0UL)\n\n/* Future zero copy wakeup/send  function */\n#define SCTP_ZERO_COPY_EVENT(inp, so)\n/* This is re-pulse ourselves for sendbuf */\n#define SCTP_ZERO_COPY_SENDQ_EVENT(inp, so)\n\n/*\n * IP output routines\n */\n#define SCTP_IP_OUTPUT(result, o_pak, ro, stcb, vrf_id) \\\n{ \\\n\tint o_flgs = IP_RAWOUTPUT; \\\n\tstruct sctp_tcb *local_stcb = stcb; \\\n\tif (local_stcb && \\\n\t    local_stcb->sctp_ep && \\\n\t    local_stcb->sctp_ep->sctp_socket) \\\n\t\to_flgs |= local_stcb->sctp_ep->sctp_socket->so_options & SO_DONTROUTE; \\\n\tresult = ip_output(o_pak, NULL, ro, o_flgs, 0, NULL); \\\n}\n\n#define SCTP_IP6_OUTPUT(result, o_pak, ro, ifp, stcb, vrf_id) \\\n{ \\\n\tstruct sctp_tcb *local_stcb = stcb; \\\n\tif (local_stcb && local_stcb->sctp_ep) \\\n\t\tresult = ip6_output(o_pak, \\\n\t\t\t\t    ((struct in6pcb *)(local_stcb->sctp_ep))->in6p_outputopts, \\\n\t\t\t\t    (ro), 0, 0, ifp, NULL); \\\n\telse \\\n\t\tresult = ip6_output(o_pak, NULL, (ro), 0, 0, ifp, NULL); \\\n}\n\nstruct mbuf *\nsctp_get_mbuf_for_msg(unsigned int space_needed,\n    int want_header, int how, int allonebuf, int type);\n\n\n/*\n * SCTP AUTH\n */\n#define HAVE_SHA2\n\n#define SCTP_READ_RANDOM(buf, len)\tread_random(buf, len)\n\n#ifdef USE_SCTP_SHA1\n#include <netinet/sctp_sha1.h>\n#else\n#include <crypto/sha1.h>\n/* map standard crypto API names */\n#define SHA1_Init\tSHA1Init\n#define SHA1_Update\tSHA1Update\n#define SHA1_Final(x,y)\tSHA1Final((caddr_t)x, y)\n#endif\n\n#if defined(HAVE_SHA2)\n#include <crypto/sha2/sha2.h>\n#endif\n\n#endif\n\n#define SCTP_DECREMENT_AND_CHECK_REFCOUNT(addr) (atomic_fetchadd_int(addr, -1) == 1)\n#if defined(INVARIANTS)\n#define SCTP_SAVE_ATOMIC_DECREMENT(addr, val) \\\n{ \\\n\tint32_t oldval; \\\n\toldval = atomic_fetchadd_int(addr, -val); \\\n\tif (oldval < val) { \\\n\t\tpanic(\"Counter goes negative\"); \\\n\t} \\\n}\n#else\n#define SCTP_SAVE_ATOMIC_DECREMENT(addr, val) \\\n{ \\\n\tint32_t oldval; \\\n\toldval = atomic_fetchadd_int(addr, -val); \\\n\tif (oldval < val) { \\\n\t\t*addr = 0; \\\n\t} \\\n}\n#endif\n"
  },
  {
    "path": "freebsd-headers/netinet/sctp_output.h",
    "content": "/*-\n * Copyright (c) 2001-2007, by Cisco Systems, Inc. All rights reserved.\n * Copyright (c) 2008-2011, by Randall Stewart. All rights reserved.\n * Copyright (c) 2008-2011, by Michael Tuexen. All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions are met:\n *\n * a) Redistributions of source code must retain the above copyright notice,\n *   this list of conditions and the following disclaimer.\n *\n * b) Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in\n *   the documentation and/or other materials provided with the distribution.\n *\n * c) Neither the name of Cisco Systems, Inc. nor the names of its\n *    contributors may be used to endorse or promote products derived\n *    from this software without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n * \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,\n * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE\n * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\n * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\n * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\n * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\n * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF\n * THE POSSIBILITY OF SUCH DAMAGE.\n */\n\n/* $KAME: sctp_output.h,v 1.14 2005/03/06 16:04:18 itojun Exp $\t */\n\n#include <sys/cdefs.h>\n__FBSDID(\"$FreeBSD: release/9.0.0/sys/netinet/sctp_output.h 224641 2011-08-03 20:21:00Z tuexen $\");\n\n#ifndef __sctp_output_h__\n#define __sctp_output_h__\n\n#include <netinet/sctp_header.h>\n\n#if defined(_KERNEL) || defined(__Userspace__)\n\n\nstruct mbuf *\nsctp_add_addresses_to_i_ia(struct sctp_inpcb *inp,\n    struct sctp_tcb *stcb,\n    struct sctp_scoping *scope,\n    struct mbuf *m_at,\n    int cnt_inits_to);\n\n\nint sctp_is_addr_restricted(struct sctp_tcb *, struct sctp_ifa *);\n\n\nint\nsctp_is_address_in_scope(struct sctp_ifa *ifa,\n    int ipv4_addr_legal,\n    int ipv6_addr_legal,\n    int loopback_scope,\n    int ipv4_local_scope,\n    int local_scope,\n    int site_scope,\n    int do_update);\nint\n    sctp_is_addr_in_ep(struct sctp_inpcb *inp, struct sctp_ifa *ifa);\n\nstruct sctp_ifa *\nsctp_source_address_selection(struct sctp_inpcb *inp,\n    struct sctp_tcb *stcb,\n    sctp_route_t * ro, struct sctp_nets *net,\n    int non_asoc_addr_ok, uint32_t vrf_id);\n\nint\n    sctp_v6src_match_nexthop(struct sockaddr_in6 *src6, sctp_route_t * ro);\nint\n    sctp_v4src_match_nexthop(struct sctp_ifa *sifa, sctp_route_t * ro);\n\nvoid \nsctp_send_initiate(struct sctp_inpcb *, struct sctp_tcb *, int\n#if !defined(__APPLE__) && !defined(SCTP_SO_LOCK_TESTING)\n    SCTP_UNUSED\n#endif\n);\n\nvoid\nsctp_send_initiate_ack(struct sctp_inpcb *, struct sctp_tcb *,\n    struct mbuf *, int, int, struct sctphdr *, struct sctp_init_chunk *,\n    uint32_t, uint16_t, int);\n\nstruct mbuf *\nsctp_arethere_unrecognized_parameters(struct mbuf *, int, int *,\n    struct sctp_chunkhdr *, int *);\nvoid sctp_queue_op_err(struct sctp_tcb *, struct mbuf *);\n\nint\nsctp_send_cookie_echo(struct mbuf *, int, struct sctp_tcb *,\n    struct sctp_nets *);\n\nvoid sctp_send_cookie_ack(struct sctp_tcb *);\n\nvoid\nsctp_send_heartbeat_ack(struct sctp_tcb *, struct mbuf *, int, int,\n    struct sctp_nets *);\n\nvoid\nsctp_remove_from_wheel(struct sctp_tcb *stcb,\n    struct sctp_association *asoc,\n    struct sctp_stream_out *strq, int holds_lock);\n\n\nvoid sctp_send_shutdown(struct sctp_tcb *, struct sctp_nets *);\n\nvoid sctp_send_shutdown_ack(struct sctp_tcb *, struct sctp_nets *);\n\nvoid sctp_send_shutdown_complete(struct sctp_tcb *, struct sctp_nets *, int);\n\nvoid \nsctp_send_shutdown_complete2(struct mbuf *, int, struct sctphdr *,\n    uint32_t, uint16_t);\n\nvoid sctp_send_asconf(struct sctp_tcb *, struct sctp_nets *, int addr_locked);\n\nvoid sctp_send_asconf_ack(struct sctp_tcb *);\n\nint sctp_get_frag_point(struct sctp_tcb *, struct sctp_association *);\n\nvoid sctp_toss_old_cookies(struct sctp_tcb *, struct sctp_association *);\n\nvoid sctp_toss_old_asconf(struct sctp_tcb *);\n\nvoid sctp_fix_ecn_echo(struct sctp_association *);\n\nvoid sctp_move_chunks_from_net(struct sctp_tcb *stcb, struct sctp_nets *net);\n\nint\nsctp_output(struct sctp_inpcb *, struct mbuf *, struct sockaddr *,\n    struct mbuf *, struct thread *, int);\n\nvoid \nsctp_chunk_output(struct sctp_inpcb *, struct sctp_tcb *, int, int\n#if !defined(__APPLE__) && !defined(SCTP_SO_LOCK_TESTING)\n    SCTP_UNUSED\n#endif\n);\nvoid \nsctp_send_abort_tcb(struct sctp_tcb *, struct mbuf *, int\n#if !defined(__APPLE__) && !defined(SCTP_SO_LOCK_TESTING)\n    SCTP_UNUSED\n#endif\n);\n\nvoid send_forward_tsn(struct sctp_tcb *, struct sctp_association *);\n\nvoid sctp_send_sack(struct sctp_tcb *, int);\n\nvoid sctp_send_hb(struct sctp_tcb *, struct sctp_nets *, int);\n\nvoid sctp_send_ecn_echo(struct sctp_tcb *, struct sctp_nets *, uint32_t);\n\n\nvoid\nsctp_send_packet_dropped(struct sctp_tcb *, struct sctp_nets *, struct mbuf *,\n    int, int);\n\n\n\nvoid sctp_send_cwr(struct sctp_tcb *, struct sctp_nets *, uint32_t, uint8_t);\n\n\nvoid\nsctp_add_stream_reset_out(struct sctp_tmit_chunk *chk,\n    int number_entries, uint16_t * list,\n    uint32_t seq, uint32_t resp_seq, uint32_t last_sent);\n\nvoid\nsctp_add_stream_reset_in(struct sctp_tmit_chunk *chk,\n    int number_entries, uint16_t * list,\n    uint32_t seq);\n\nvoid\nsctp_add_stream_reset_tsn(struct sctp_tmit_chunk *chk,\n    uint32_t seq);\n\nvoid\nsctp_add_stream_reset_result(struct sctp_tmit_chunk *chk,\n    uint32_t resp_seq, uint32_t result);\n\nvoid\nsctp_add_stream_reset_result_tsn(struct sctp_tmit_chunk *chk,\n    uint32_t resp_seq, uint32_t result,\n    uint32_t send_una, uint32_t recv_next);\n\nint\nsctp_send_str_reset_req(struct sctp_tcb *stcb,\n    int number_entries,\n    uint16_t * list,\n    uint8_t send_out_req,\n    uint32_t resp_seq,\n    uint8_t send_in_req,\n    uint8_t send_tsn_req,\n    uint8_t add_str,\n    uint16_t adding);\n\n\nvoid\nsctp_send_abort(struct mbuf *, int, struct sctphdr *, uint32_t,\n    struct mbuf *, uint32_t, uint16_t);\n\nvoid sctp_send_operr_to(struct mbuf *, int, struct mbuf *, uint32_t, uint32_t, uint16_t);\n\n#endif\t\t\t\t/* _KERNEL || __Userspace__ */\n\n#if defined(_KERNEL) || defined (__Userspace__)\nint\nsctp_sosend(struct socket *so,\n    struct sockaddr *addr,\n    struct uio *uio,\n    struct mbuf *top,\n    struct mbuf *control,\n    int flags,\n    struct thread *p\n);\n\n#endif\n#endif\n"
  },
  {
    "path": "freebsd-headers/netinet/sctp_pcb.h",
    "content": "/*-\n * Copyright (c) 2001-2007, by Cisco Systems, Inc. All rights reserved.\n * Copyright (c) 2008-2011, by Randall Stewart. All rights reserved.\n * Copyright (c) 2008-2011, by Michael Tuexen. All rights reserved.\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions are met:\n *\n * a) Redistributions of source code must retain the above copyright notice,\n *   this list of conditions and the following disclaimer.\n *\n * b) Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in\n *   the documentation and/or other materials provided with the distribution.\n *\n * c) Neither the name of Cisco Systems, Inc. nor the names of its\n *    contributors may be used to endorse or promote products derived\n *    from this software without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n * \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,\n * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE\n * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\n * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\n * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\n * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\n * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF\n * THE POSSIBILITY OF SUCH DAMAGE.\n */\n\n/* $KAME: sctp_pcb.h,v 1.21 2005/07/16 01:18:47 suz Exp $\t */\n\n#include <sys/cdefs.h>\n__FBSDID(\"$FreeBSD: release/9.0.0/sys/netinet/sctp_pcb.h 225549 2011-09-14 08:15:21Z tuexen $\");\n\n#ifndef __sctp_pcb_h__\n#define __sctp_pcb_h__\n\n#include <netinet/sctp_os.h>\n#include <netinet/sctp.h>\n#include <netinet/sctp_constants.h>\n#include <netinet/sctp_sysctl.h>\n\nLIST_HEAD(sctppcbhead, sctp_inpcb);\nLIST_HEAD(sctpasochead, sctp_tcb);\nLIST_HEAD(sctpladdr, sctp_laddr);\nLIST_HEAD(sctpvtaghead, sctp_tagblock);\nLIST_HEAD(sctp_vrflist, sctp_vrf);\nLIST_HEAD(sctp_ifnlist, sctp_ifn);\nLIST_HEAD(sctp_ifalist, sctp_ifa);\nTAILQ_HEAD(sctp_readhead, sctp_queued_to_read);\nTAILQ_HEAD(sctp_streamhead, sctp_stream_queue_pending);\n\n#include <netinet/sctp_structs.h>\n#include <netinet/sctp_auth.h>\n\n#define SCTP_PCBHASH_ALLADDR(port, mask) (port & mask)\n#define SCTP_PCBHASH_ASOC(tag, mask) (tag & mask)\n\nstruct sctp_vrf {\n\tLIST_ENTRY(sctp_vrf) next_vrf;\n\tstruct sctp_ifalist *vrf_addr_hash;\n\tstruct sctp_ifnlist ifnlist;\n\tuint32_t vrf_id;\n\tuint32_t tbl_id_v4;\t/* default v4 table id */\n\tuint32_t tbl_id_v6;\t/* default v6 table id */\n\tuint32_t total_ifa_count;\n\tu_long vrf_addr_hashmark;\n\tuint32_t refcount;\n};\n\nstruct sctp_ifn {\n\tstruct sctp_ifalist ifalist;\n\tstruct sctp_vrf *vrf;\n\t         LIST_ENTRY(sctp_ifn) next_ifn;\n\t         LIST_ENTRY(sctp_ifn) next_bucket;\n\tvoid *ifn_p;\t\t/* never access without appropriate lock */\n\tuint32_t ifn_mtu;\n\tuint32_t ifn_type;\n\tuint32_t ifn_index;\t/* shorthand way to look at ifn for reference */\n\tuint32_t refcount;\t/* number of reference held should be >=\n\t\t\t\t * ifa_count */\n\tuint32_t ifa_count;\t/* IFA's we hold (in our list - ifalist) */\n\tuint32_t num_v6;\t/* number of v6 addresses */\n\tuint32_t num_v4;\t/* number of v4 addresses */\n\tuint32_t registered_af;\t/* registered address family for i/f events */\n\tchar ifn_name[SCTP_IFNAMSIZ];\n};\n\n/* SCTP local IFA flags */\n#define SCTP_ADDR_VALID         0x00000001\t/* its up and active */\n#define SCTP_BEING_DELETED      0x00000002\t/* being deleted, when\n\t\t\t\t\t\t * refcount = 0. Note that it\n\t\t\t\t\t\t * is pulled from the ifn list\n\t\t\t\t\t\t * and ifa_p is nulled right\n\t\t\t\t\t\t * away but it cannot be freed\n\t\t\t\t\t\t * until the last *net\n\t\t\t\t\t\t * pointing to it is deleted. */\n#define SCTP_ADDR_DEFER_USE     0x00000004\t/* Hold off using this one */\n#define SCTP_ADDR_IFA_UNUSEABLE 0x00000008\n\nstruct sctp_ifa {\n\tLIST_ENTRY(sctp_ifa) next_ifa;\n\tLIST_ENTRY(sctp_ifa) next_bucket;\n\tstruct sctp_ifn *ifn_p;\t/* back pointer to parent ifn */\n\tvoid *ifa;\t\t/* pointer to ifa, needed for flag update for\n\t\t\t\t * that we MUST lock appropriate locks. This\n\t\t\t\t * is for V6. */\n\tunion sctp_sockstore address;\n\tuint32_t refcount;\t/* number of folks refering to this */\n\tuint32_t flags;\n\tuint32_t localifa_flags;\n\tuint32_t vrf_id;\t/* vrf_id of this addr (for deleting) */\n\tuint8_t src_is_loop;\n\tuint8_t src_is_priv;\n\tuint8_t src_is_glob;\n\tuint8_t resv;\n};\n\nstruct sctp_laddr {\n\tLIST_ENTRY(sctp_laddr) sctp_nxt_addr;\t/* next in list */\n\tstruct sctp_ifa *ifa;\n\tuint32_t action;\t/* Used during asconf and adding if no-zero\n\t\t\t\t * src-addr selection will not consider this\n\t\t\t\t * address. */\n\tstruct timeval start_time;\t/* time when this address was created */\n};\n\nstruct sctp_block_entry {\n\tint error;\n};\n\nstruct sctp_timewait {\n\tuint32_t tv_sec_at_expire;\t/* the seconds from boot to expire */\n\tuint32_t v_tag;\t\t/* the vtag that can not be reused */\n\tuint16_t lport;\t\t/* the local port used in vtag */\n\tuint16_t rport;\t\t/* the remote port used in vtag */\n};\n\nstruct sctp_tagblock {\n\tLIST_ENTRY(sctp_tagblock) sctp_nxt_tagblock;\n\tstruct sctp_timewait vtag_block[SCTP_NUMBER_IN_VTAG_BLOCK];\n};\n\n\nstruct sctp_epinfo {\n\tstruct socket *udp_tun_socket;\n\tstruct sctpasochead *sctp_asochash;\n\tu_long hashasocmark;\n\n\tstruct sctppcbhead *sctp_ephash;\n\tu_long hashmark;\n\n\t/*-\n\t * The TCP model represents a substantial overhead in that we get an\n\t * additional hash table to keep explicit connections in. The\n\t * listening TCP endpoint will exist in the usual ephash above and\n\t * accept only INIT's. It will be incapable of sending off an INIT.\n\t * When a dg arrives we must look in the normal ephash. If we find a\n\t * TCP endpoint that will tell us to go to the specific endpoint\n\t * hash and re-hash to find the right assoc/socket. If we find a UDP\n\t * model socket we then must complete the lookup. If this fails,\n\t * i.e. no association can be found then we must continue to see if\n\t * a sctp_peeloff()'d socket is in the tcpephash (a spun off socket\n\t * acts like a TCP model connected socket).\n\t */\n\tstruct sctppcbhead *sctp_tcpephash;\n\tu_long hashtcpmark;\n\tuint32_t hashtblsize;\n\n\tstruct sctp_vrflist *sctp_vrfhash;\n\tu_long hashvrfmark;\n\n\tstruct sctp_ifnlist *vrf_ifn_hash;\n\tu_long vrf_ifn_hashmark;\n\n\tstruct sctppcbhead listhead;\n\tstruct sctpladdr addr_wq;\n\n\t/* ep zone info */\n\tsctp_zone_t ipi_zone_ep;\n\tsctp_zone_t ipi_zone_asoc;\n\tsctp_zone_t ipi_zone_laddr;\n\tsctp_zone_t ipi_zone_net;\n\tsctp_zone_t ipi_zone_chunk;\n\tsctp_zone_t ipi_zone_readq;\n\tsctp_zone_t ipi_zone_strmoq;\n\tsctp_zone_t ipi_zone_asconf;\n\tsctp_zone_t ipi_zone_asconf_ack;\n\n\tstruct rwlock ipi_ep_mtx;\n\tstruct mtx ipi_iterator_wq_mtx;\n\tstruct rwlock ipi_addr_mtx;\n\tstruct mtx ipi_pktlog_mtx;\n\tstruct mtx wq_addr_mtx;\n\tuint32_t ipi_count_ep;\n\n\t/* assoc/tcb zone info */\n\tuint32_t ipi_count_asoc;\n\n\t/* local addrlist zone info */\n\tuint32_t ipi_count_laddr;\n\n\t/* remote addrlist zone info */\n\tuint32_t ipi_count_raddr;\n\n\t/* chunk structure list for output */\n\tuint32_t ipi_count_chunk;\n\n\t/* socket queue zone info */\n\tuint32_t ipi_count_readq;\n\n\t/* socket queue zone info */\n\tuint32_t ipi_count_strmoq;\n\n\t/* Number of vrfs */\n\tuint32_t ipi_count_vrfs;\n\n\t/* Number of ifns */\n\tuint32_t ipi_count_ifns;\n\n\t/* Number of ifas */\n\tuint32_t ipi_count_ifas;\n\n\t/* system wide number of free chunks hanging around */\n\tuint32_t ipi_free_chunks;\n\tuint32_t ipi_free_strmoq;\n\n\tstruct sctpvtaghead vtag_timewait[SCTP_STACK_VTAG_HASH_SIZE];\n\n\t/* address work queue handling */\n\tstruct sctp_timer addr_wq_timer;\n\n};\n\n\nstruct sctp_base_info {\n\t/*\n\t * All static structures that anchor the system must be here.\n\t */\n\tstruct sctp_epinfo sctppcbinfo;\n#if defined(__FreeBSD__) && defined(SMP) && defined(SCTP_USE_PERCPU_STAT)\n\tstruct sctpstat *sctpstat;\n#else\n\tstruct sctpstat sctpstat;\n#endif\n\tstruct sctp_sysctl sctpsysctl;\n\tuint8_t first_time;\n\tchar sctp_pcb_initialized;\n#if defined(SCTP_PACKET_LOGGING)\n\tint packet_log_writers;\n\tint packet_log_end;\n\tuint8_t packet_log_buffer[SCTP_PACKET_LOG_SIZE];\n#endif\n};\n\n/*-\n * Here we have all the relevant information for each SCTP entity created. We\n * will need to modify this as approprate. We also need to figure out how to\n * access /dev/random.\n */\nstruct sctp_pcb {\n\tunsigned int time_of_secret_change;\t/* number of seconds from\n\t\t\t\t\t\t * timeval.tv_sec */\n\tuint32_t secret_key[SCTP_HOW_MANY_SECRETS][SCTP_NUMBER_OF_SECRETS];\n\tunsigned int size_of_a_cookie;\n\n\tunsigned int sctp_timeoutticks[SCTP_NUM_TMRS];\n\tunsigned int sctp_minrto;\n\tunsigned int sctp_maxrto;\n\tunsigned int initial_rto;\n\tint initial_init_rto_max;\n\n\tunsigned int sctp_sack_freq;\n\tuint32_t sctp_sws_sender;\n\tuint32_t sctp_sws_receiver;\n\n\tuint32_t sctp_default_cc_module;\n\tuint32_t sctp_default_ss_module;\n\t/* authentication related fields */\n\tstruct sctp_keyhead shared_keys;\n\tsctp_auth_chklist_t *local_auth_chunks;\n\tsctp_hmaclist_t *local_hmacs;\n\tuint16_t default_keyid;\n\n\t/* various thresholds */\n\t/* Max times I will init at a guy */\n\tuint16_t max_init_times;\n\n\t/* Max times I will send before we consider someone dead */\n\tuint16_t max_send_times;\n\n\tuint16_t def_net_failure;\n\n\tuint16_t def_net_pf_threshold;\n\n\t/* number of streams to pre-open on a association */\n\tuint16_t pre_open_stream_count;\n\tuint16_t max_open_streams_intome;\n\n\t/* random number generator */\n\tuint32_t random_counter;\n\tuint8_t random_numbers[SCTP_SIGNATURE_ALOC_SIZE];\n\tuint8_t random_store[SCTP_SIGNATURE_ALOC_SIZE];\n\n\t/*\n\t * This timer is kept running per endpoint.  When it fires it will\n\t * change the secret key.  The default is once a hour\n\t */\n\tstruct sctp_timer signature_change;\n\n\t/* Zero copy full buffer timer */\n\tstruct sctp_timer zero_copy_timer;\n\t/* Zero copy app to transport (sendq) read repulse timer */\n\tstruct sctp_timer zero_copy_sendq_timer;\n\tuint32_t def_cookie_life;\n\t/* defaults to 0 */\n\tint auto_close_time;\n\tuint32_t initial_sequence_debug;\n\tuint32_t adaptation_layer_indicator;\n\tuint32_t store_at;\n\tuint32_t max_burst;\n\tuint32_t fr_max_burst;\n#ifdef INET6\n\tuint32_t default_flowlabel;\n#endif\n\tuint8_t default_dscp;\n\tchar current_secret_number;\n\tchar last_secret_number;\n};\n\n#ifndef SCTP_ALIGNMENT\n#define SCTP_ALIGNMENT 32\n#endif\n\n#ifndef SCTP_ALIGNM1\n#define SCTP_ALIGNM1 (SCTP_ALIGNMENT-1)\n#endif\n\n#define sctp_lport ip_inp.inp.inp_lport\n\nstruct sctp_pcbtsn_rlog {\n\tuint32_t vtag;\n\tuint16_t strm;\n\tuint16_t seq;\n\tuint16_t sz;\n\tuint16_t flgs;\n};\n\n#define SCTP_READ_LOG_SIZE 135\t/* we choose the number to make a pcb a page */\n\n\nstruct sctp_inpcb {\n\t/*-\n\t * put an inpcb in front of it all, kind of a waste but we need to\n\t * for compatability with all the other stuff.\n\t */\n\tunion {\n\t\tstruct inpcb inp;\n\t\tchar align[(sizeof(struct in6pcb) + SCTP_ALIGNM1) &\n\t\t        ~SCTP_ALIGNM1];\n\t}     ip_inp;\n\n\n\t/* Socket buffer lock protects read_queue and of course sb_cc */\n\tstruct sctp_readhead read_queue;\n\n\t              LIST_ENTRY(sctp_inpcb) sctp_list;\t/* lists all endpoints */\n\t/* hash of all endpoints for model */\n\t              LIST_ENTRY(sctp_inpcb) sctp_hash;\n\t/* count of local addresses bound, 0 if bound all */\n\tint laddr_count;\n\n\t/* list of addrs in use by the EP, NULL if bound-all */\n\tstruct sctpladdr sctp_addr_list;\n\t/*\n\t * used for source address selection rotation when we are subset\n\t * bound\n\t */\n\tstruct sctp_laddr *next_addr_touse;\n\n\t/* back pointer to our socket */\n\tstruct socket *sctp_socket;\n\tuint32_t sctp_flags;\t/* INP state flag set */\n\tuint32_t sctp_features;\t/* Feature flags */\n\tuint32_t sctp_mobility_features;\t/* Mobility  Feature flags */\n\tstruct sctp_pcb sctp_ep;/* SCTP ep data */\n\t/* head of the hash of all associations */\n\tstruct sctpasochead *sctp_tcbhash;\n\tu_long sctp_hashmark;\n\t/* head of the list of all associations */\n\tstruct sctpasochead sctp_asoc_list;\n#ifdef SCTP_TRACK_FREED_ASOCS\n\tstruct sctpasochead sctp_asoc_free_list;\n#endif\n\tstruct sctp_iterator *inp_starting_point_for_iterator;\n\tuint32_t sctp_frag_point;\n\tuint32_t partial_delivery_point;\n\tuint32_t sctp_context;\n\tuint32_t sctp_cmt_on_off;\n\tuint32_t sctp_ecn_enable;\n\tstruct sctp_nonpad_sndrcvinfo def_send;\n\t/*-\n\t * These three are here for the sosend_dgram\n\t * (pkt, pkt_last and control).\n\t * routine. However, I don't think anyone in\n\t * the current FreeBSD kernel calls this. So\n\t * they are candidates with sctp_sendm for\n\t * de-supporting.\n\t */\n\tstruct mbuf *pkt, *pkt_last;\n\tstruct mbuf *control;\n\tstruct mtx inp_mtx;\n\tstruct mtx inp_create_mtx;\n\tstruct mtx inp_rdata_mtx;\n\tint32_t refcount;\n\tuint32_t def_vrf_id;\n\tuint32_t total_sends;\n\tuint32_t total_recvs;\n\tuint32_t last_abort_code;\n\tuint32_t total_nospaces;\n\tstruct sctpasochead *sctp_asocidhash;\n\tu_long hashasocidmark;\n\tuint32_t sctp_associd_counter;\n\n#ifdef SCTP_ASOCLOG_OF_TSNS\n\tstruct sctp_pcbtsn_rlog readlog[SCTP_READ_LOG_SIZE];\n\tuint32_t readlog_index;\n#endif\n};\n\nstruct sctp_tcb {\n\tstruct socket *sctp_socket;\t/* back pointer to socket */\n\tstruct sctp_inpcb *sctp_ep;\t/* back pointer to ep */\n\t           LIST_ENTRY(sctp_tcb) sctp_tcbhash;\t/* next link in hash\n\t\t\t\t\t\t\t * table */\n\t           LIST_ENTRY(sctp_tcb) sctp_tcblist;\t/* list of all of the\n\t\t\t\t\t\t\t * TCB's */\n\t           LIST_ENTRY(sctp_tcb) sctp_tcbasocidhash;\t/* next link in asocid\n\t\t\t\t\t\t\t\t * hash table */\n\t           LIST_ENTRY(sctp_tcb) sctp_asocs;\t/* vtag hash list */\n\tstruct sctp_block_entry *block_entry;\t/* pointer locked by  socket\n\t\t\t\t\t\t * send buffer */\n\tstruct sctp_association asoc;\n\t/*-\n\t * freed_by_sorcv_sincelast is protected by the sockbuf_lock NOT the\n\t * tcb_lock. Its special in this way to help avoid extra mutex calls\n\t * in the reading of data.\n\t */\n\tuint32_t freed_by_sorcv_sincelast;\n\tuint32_t total_sends;\n\tuint32_t total_recvs;\n\tint freed_from_where;\n\tuint16_t rport;\t\t/* remote port in network format */\n\tuint16_t resv;\n\tstruct mtx tcb_mtx;\n\tstruct mtx tcb_send_mtx;\n};\n\n\n\n#include <netinet/sctp_lock_bsd.h>\n\n\n/* TODO where to put non-_KERNEL things for __Userspace__? */\n#if defined(_KERNEL) || defined(__Userspace__)\n\n/* Attention Julian, this is the extern that\n * goes with the base info. sctp_pcb.c has\n * the real definition.\n */\nVNET_DECLARE(struct sctp_base_info, system_base_info);\n\n#ifdef INET6\nint SCTP6_ARE_ADDR_EQUAL(struct sockaddr_in6 *a, struct sockaddr_in6 *b);\n\n#endif\n\nvoid sctp_fill_pcbinfo(struct sctp_pcbinfo *);\n\nstruct sctp_ifn *\n         sctp_find_ifn(void *ifn, uint32_t ifn_index);\n\nstruct sctp_vrf *sctp_allocate_vrf(int vrfid);\nstruct sctp_vrf *sctp_find_vrf(uint32_t vrfid);\nvoid sctp_free_vrf(struct sctp_vrf *vrf);\n\n/*-\n * Change address state, can be used if\n * O/S supports telling transports about\n * changes to IFA/IFN's (link layer triggers).\n * If a ifn goes down, we will do src-addr-selection\n * and NOT use that, as a source address. This does\n * not stop the routing system from routing out\n * that interface, but we won't put it as a source.\n */\nvoid sctp_mark_ifa_addr_down(uint32_t vrf_id, struct sockaddr *addr, const char *if_name, uint32_t ifn_index);\nvoid sctp_mark_ifa_addr_up(uint32_t vrf_id, struct sockaddr *addr, const char *if_name, uint32_t ifn_index);\n\nstruct sctp_ifa *\nsctp_add_addr_to_vrf(uint32_t vrfid,\n    void *ifn, uint32_t ifn_index, uint32_t ifn_type,\n    const char *if_name,\n    void *ifa, struct sockaddr *addr, uint32_t ifa_flags,\n    int dynamic_add);\n\nvoid sctp_update_ifn_mtu(uint32_t ifn_index, uint32_t mtu);\n\nvoid sctp_free_ifn(struct sctp_ifn *sctp_ifnp);\nvoid sctp_free_ifa(struct sctp_ifa *sctp_ifap);\n\n\nvoid \nsctp_del_addr_from_vrf(uint32_t vrfid, struct sockaddr *addr,\n    uint32_t ifn_index, const char *if_name);\n\n\n\nstruct sctp_nets *sctp_findnet(struct sctp_tcb *, struct sockaddr *);\n\nstruct sctp_inpcb *sctp_pcb_findep(struct sockaddr *, int, int, uint32_t);\n\nint \nsctp_inpcb_bind(struct socket *, struct sockaddr *,\n    struct sctp_ifa *, struct thread *);\n\nstruct sctp_tcb *\nsctp_findassociation_addr(struct mbuf *, int, int,\n    struct sctphdr *, struct sctp_chunkhdr *, struct sctp_inpcb **,\n    struct sctp_nets **, uint32_t vrf_id);\n\nstruct sctp_tcb *\nsctp_findassociation_addr_sa(struct sockaddr *,\n    struct sockaddr *, struct sctp_inpcb **, struct sctp_nets **, int, uint32_t);\n\nvoid\nsctp_move_pcb_and_assoc(struct sctp_inpcb *, struct sctp_inpcb *,\n    struct sctp_tcb *);\n\n/*-\n * For this call ep_addr, the to is the destination endpoint address of the\n * peer (relative to outbound). The from field is only used if the TCP model\n * is enabled and helps distingush amongst the subset bound (non-boundall).\n * The TCP model MAY change the actual ep field, this is why it is passed.\n */\nstruct sctp_tcb *\nsctp_findassociation_ep_addr(struct sctp_inpcb **,\n    struct sockaddr *, struct sctp_nets **, struct sockaddr *,\n    struct sctp_tcb *);\n\nstruct sctp_tcb *\n         sctp_findasoc_ep_asocid_locked(struct sctp_inpcb *inp, sctp_assoc_t asoc_id, int want_lock);\n\nstruct sctp_tcb *\nsctp_findassociation_ep_asocid(struct sctp_inpcb *,\n    sctp_assoc_t, int);\n\nstruct sctp_tcb *\nsctp_findassociation_ep_asconf(struct mbuf *, int, int,\n    struct sctphdr *, struct sctp_inpcb **, struct sctp_nets **, uint32_t vrf_id);\n\nint sctp_inpcb_alloc(struct socket *so, uint32_t vrf_id);\n\nint sctp_is_address_on_local_host(struct sockaddr *addr, uint32_t vrf_id);\n\nvoid sctp_inpcb_free(struct sctp_inpcb *, int, int);\n\nstruct sctp_tcb *\nsctp_aloc_assoc(struct sctp_inpcb *, struct sockaddr *,\n    int *, uint32_t, uint32_t, struct thread *);\n\nint sctp_free_assoc(struct sctp_inpcb *, struct sctp_tcb *, int, int);\n\n\nvoid sctp_delete_from_timewait(uint32_t, uint16_t, uint16_t);\n\nint sctp_is_in_timewait(uint32_t tag, uint16_t lport, uint16_t rport);\n\nvoid\n     sctp_add_vtag_to_timewait(uint32_t tag, uint32_t time, uint16_t lport, uint16_t rport);\n\nvoid sctp_add_local_addr_ep(struct sctp_inpcb *, struct sctp_ifa *, uint32_t);\n\nint sctp_insert_laddr(struct sctpladdr *, struct sctp_ifa *, uint32_t);\n\nvoid sctp_remove_laddr(struct sctp_laddr *);\n\nvoid sctp_del_local_addr_ep(struct sctp_inpcb *, struct sctp_ifa *);\n\nint sctp_add_remote_addr(struct sctp_tcb *, struct sockaddr *, struct sctp_nets **, int, int);\n\nvoid sctp_remove_net(struct sctp_tcb *, struct sctp_nets *);\n\nint sctp_del_remote_addr(struct sctp_tcb *, struct sockaddr *);\n\nvoid sctp_pcb_init(void);\n\nvoid sctp_pcb_finish(void);\n\nvoid sctp_add_local_addr_restricted(struct sctp_tcb *, struct sctp_ifa *);\nvoid sctp_del_local_addr_restricted(struct sctp_tcb *, struct sctp_ifa *);\n\nint\nsctp_load_addresses_from_init(struct sctp_tcb *, struct mbuf *, int, int,\n    int, struct sctphdr *, struct sockaddr *);\n\nint\nsctp_set_primary_addr(struct sctp_tcb *, struct sockaddr *,\n    struct sctp_nets *);\n\nint sctp_is_vtag_good(struct sctp_inpcb *, uint32_t, uint16_t lport, uint16_t rport, struct timeval *, int);\n\n/* void sctp_drain(void); */\n\nint sctp_destination_is_reachable(struct sctp_tcb *, struct sockaddr *);\n\nint sctp_swap_inpcb_for_listen(struct sctp_inpcb *inp);\n\n/*-\n * Null in last arg inpcb indicate run on ALL ep's. Specific inp in last arg\n * indicates run on ONLY assoc's of the specified endpoint.\n */\nint\nsctp_initiate_iterator(inp_func inpf,\n    asoc_func af,\n    inp_func inpe,\n    uint32_t, uint32_t,\n    uint32_t, void *,\n    uint32_t,\n    end_func ef,\n    struct sctp_inpcb *,\n    uint8_t co_off);\n\n#if defined(__FreeBSD__) && defined(SCTP_MCORE_INPUT) && defined(SMP)\nvoid\n     sctp_queue_to_mcore(struct mbuf *m, int off, int cpu_to_use);\n\n#endif\n\n#ifdef INVARIANTS\nvoid\n     sctp_validate_no_locks(struct sctp_inpcb *inp);\n\n#endif\n\n#endif\t\t\t\t/* _KERNEL */\n#endif\t\t\t\t/* !__sctp_pcb_h__ */\n"
  },
  {
    "path": "freebsd-headers/netinet/sctp_peeloff.h",
    "content": "/*-\n * Copyright (c) 2001-2007, by Cisco Systems, Inc. All rights reserved.\n * Copyright (c) 2008-2011, by Randall Stewart. All rights reserved.\n * Copyright (c) 2008-2011, by Michael Tuexen. All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions are met:\n *\n * a) Redistributions of source code must retain the above copyright notice,\n *   this list of conditions and the following disclaimer.\n *\n * b) Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in\n *   the documentation and/or other materials provided with the distribution.\n *\n * c) Neither the name of Cisco Systems, Inc. nor the names of its\n *    contributors may be used to endorse or promote products derived\n *    from this software without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n * \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,\n * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE\n * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\n * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\n * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\n * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\n * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF\n * THE POSSIBILITY OF SUCH DAMAGE.\n */\n\n/* $KAME: sctp_peeloff.h,v 1.6 2005/03/06 16:04:18 itojun Exp $\t */\n\n#include <sys/cdefs.h>\n__FBSDID(\"$FreeBSD: release/9.0.0/sys/netinet/sctp_peeloff.h 218319 2011-02-05 12:12:51Z rrs $\");\n\n#ifndef __sctp_peeloff_h__\n#define __sctp_peeloff_h__\n\n\n\n\n#if defined(_KERNEL)\n\nint sctp_can_peel_off(struct socket *, sctp_assoc_t);\nint sctp_do_peeloff(struct socket *, struct socket *, sctp_assoc_t);\nstruct socket *sctp_get_peeloff(struct socket *, sctp_assoc_t, int *);\n\n\n\n#endif\t\t\t\t/* _KERNEL */\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/netinet/sctp_structs.h",
    "content": "/*-\n * Copyright (c) 2001-2008, by Cisco Systems, Inc. All rights reserved.\n * Copyright (c) 2008-2011, by Randall Stewart. All rights reserved.\n * Copyright (c) 2008-2011, by Michael Tuexen. All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions are met:\n *\n * a) Redistributions of source code must retain the above copyright notice,\n *   this list of conditions and the following disclaimer.\n *\n * b) Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in\n *   the documentation and/or other materials provided with the distribution.\n *\n * c) Neither the name of Cisco Systems, Inc. nor the names of its\n *    contributors may be used to endorse or promote products derived\n *    from this software without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n * \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,\n * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE\n * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\n * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\n * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\n * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\n * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF\n * THE POSSIBILITY OF SUCH DAMAGE.\n */\n\n/* $KAME: sctp_structs.h,v 1.13 2005/03/06 16:04:18 itojun Exp $\t */\n\n#include <sys/cdefs.h>\n__FBSDID(\"$FreeBSD: release/9.0.0/sys/netinet/sctp_structs.h 226278 2011-10-12 05:18:15Z tuexen $\");\n\n#ifndef __sctp_structs_h__\n#define __sctp_structs_h__\n\n#include <netinet/sctp_os.h>\n#include <netinet/sctp_header.h>\n#include <netinet/sctp_auth.h>\n\nstruct sctp_timer {\n\tsctp_os_timer_t timer;\n\n\tint type;\n\t/*\n\t * Depending on the timer type these will be setup and cast with the\n\t * appropriate entity.\n\t */\n\tvoid *ep;\n\tvoid *tcb;\n\tvoid *net;\n\tvoid *vnet;\n\n\t/* for sanity checking */\n\tvoid *self;\n\tuint32_t ticks;\n\tuint32_t stopped_from;\n};\n\n\nstruct sctp_foo_stuff {\n\tstruct sctp_inpcb *inp;\n\tuint32_t lineno;\n\tuint32_t ticks;\n\tint updown;\n};\n\n\n/*\n * This is the information we track on each interface that we know about from\n * the distant end.\n */\nTAILQ_HEAD(sctpnetlisthead, sctp_nets);\n\nstruct sctp_stream_reset_list {\n\tTAILQ_ENTRY(sctp_stream_reset_list) next_resp;\n\tuint32_t tsn;\n\tint number_entries;\n\tstruct sctp_stream_reset_out_request req;\n};\n\nTAILQ_HEAD(sctp_resethead, sctp_stream_reset_list);\n\n/*\n * Users of the iterator need to malloc a iterator with a call to\n * sctp_initiate_iterator(inp_func, assoc_func, inp_func,  pcb_flags, pcb_features,\n *     asoc_state, void-ptr-arg, uint32-arg, end_func, inp);\n *\n * Use the following two defines if you don't care what pcb flags are on the EP\n * and/or you don't care what state the association is in.\n *\n * Note that if you specify an INP as the last argument then ONLY each\n * association of that single INP will be executed upon. Note that the pcb\n * flags STILL apply so if the inp you specify has different pcb_flags then\n * what you put in pcb_flags nothing will happen. use SCTP_PCB_ANY_FLAGS to\n * assure the inp you specify gets treated.\n */\n#define SCTP_PCB_ANY_FLAGS\t0x00000000\n#define SCTP_PCB_ANY_FEATURES\t0x00000000\n#define SCTP_ASOC_ANY_STATE\t0x00000000\n\ntypedef void (*asoc_func) (struct sctp_inpcb *, struct sctp_tcb *, void *ptr,\n         uint32_t val);\ntypedef int (*inp_func) (struct sctp_inpcb *, void *ptr, uint32_t val);\ntypedef void (*end_func) (void *ptr, uint32_t val);\n\n#if defined(__FreeBSD__) && defined(SCTP_MCORE_INPUT) && defined(SMP)\n/* whats on the mcore control struct */\nstruct sctp_mcore_queue {\n\tTAILQ_ENTRY(sctp_mcore_queue) next;\n\tstruct vnet *vn;\n\tstruct mbuf *m;\n\tint off;\n\tint v6;\n};\n\nTAILQ_HEAD(sctp_mcore_qhead, sctp_mcore_queue);\n\nstruct sctp_mcore_ctrl {\n\tSCTP_PROCESS_STRUCT thread_proc;\n\tstruct sctp_mcore_qhead que;\n\tstruct mtx core_mtx;\n\tstruct mtx que_mtx;\n\tint running;\n\tint cpuid;\n};\n\n\n#endif\n\n\nstruct sctp_iterator {\n\tTAILQ_ENTRY(sctp_iterator) sctp_nxt_itr;\n\tstruct vnet *vn;\n\tstruct sctp_timer tmr;\n\tstruct sctp_inpcb *inp;\t/* current endpoint */\n\tstruct sctp_tcb *stcb;\t/* current* assoc */\n\tstruct sctp_inpcb *next_inp;\t/* special hook to skip to */\n\tasoc_func function_assoc;\t/* per assoc function */\n\tinp_func function_inp;\t/* per endpoint function */\n\tinp_func function_inp_end;\t/* end INP function */\n\tend_func function_atend;/* iterator completion function */\n\tvoid *pointer;\t\t/* pointer for apply func to use */\n\tuint32_t val;\t\t/* value for apply func to use */\n\tuint32_t pcb_flags;\t/* endpoint flags being checked */\n\tuint32_t pcb_features;\t/* endpoint features being checked */\n\tuint32_t asoc_state;\t/* assoc state being checked */\n\tuint32_t iterator_flags;\n\tuint8_t no_chunk_output;\n\tuint8_t done_current_ep;\n};\n\n/* iterator_flags values */\n#define SCTP_ITERATOR_DO_ALL_INP\t0x00000001\n#define SCTP_ITERATOR_DO_SINGLE_INP\t0x00000002\n\n\nTAILQ_HEAD(sctpiterators, sctp_iterator);\n\nstruct sctp_copy_all {\n\tstruct sctp_inpcb *inp;\t/* ep */\n\tstruct mbuf *m;\n\tstruct sctp_sndrcvinfo sndrcv;\n\tint sndlen;\n\tint cnt_sent;\n\tint cnt_failed;\n};\n\nstruct sctp_asconf_iterator {\n\tstruct sctpladdr list_of_work;\n\tint cnt;\n};\n\nstruct iterator_control {\n\tstruct mtx ipi_iterator_wq_mtx;\n\tstruct mtx it_mtx;\n\tSCTP_PROCESS_STRUCT thread_proc;\n\tstruct sctpiterators iteratorhead;\n\tstruct sctp_iterator *cur_it;\n\tuint32_t iterator_running;\n\tuint32_t iterator_flags;\n};\n\n#define SCTP_ITERATOR_STOP_CUR_IT\t0x00000004\n#define SCTP_ITERATOR_STOP_CUR_INP\t0x00000008\n\nstruct sctp_net_route {\n\tsctp_rtentry_t *ro_rt;\n\tvoid *ro_lle;\n\tvoid *ro_ia;\n\tint ro_flags;\n\tunion sctp_sockstore _l_addr;\t/* remote peer addr */\n\tstruct sctp_ifa *_s_addr;\t/* our selected src addr */\n};\n\nstruct htcp {\n\tuint16_t alpha;\t\t/* Fixed point arith, << 7 */\n\tuint8_t beta;\t\t/* Fixed point arith, << 7 */\n\tuint8_t modeswitch;\t/* Delay modeswitch until we had at least one\n\t\t\t\t * congestion event */\n\tuint32_t last_cong;\t/* Time since last congestion event end */\n\tuint32_t undo_last_cong;\n\tuint16_t bytes_acked;\n\tuint32_t bytecount;\n\tuint32_t minRTT;\n\tuint32_t maxRTT;\n\n\tuint32_t undo_maxRTT;\n\tuint32_t undo_old_maxB;\n\n\t/* Bandwidth estimation */\n\tuint32_t minB;\n\tuint32_t maxB;\n\tuint32_t old_maxB;\n\tuint32_t Bi;\n\tuint32_t lasttime;\n};\n\nstruct rtcc_cc {\n\tstruct timeval tls;\t/* The time we started the sending  */\n\tuint64_t lbw;\t\t/* Our last estimated bw */\n\tuint64_t lbw_rtt;\t/* RTT at bw estimate */\n\tuint64_t bw_bytes;\t/* The total bytes since this sending began */\n\tuint64_t bw_tot_time;\t/* The total time since sending began */\n\tuint64_t new_tot_time;\t/* temp holding the new value */\n\tuint64_t bw_bytes_at_last_rttc;\t/* What bw_bytes was at last rtt calc */\n\tuint32_t cwnd_at_bw_set;/* Cwnd at last bw saved - lbw */\n\tuint32_t vol_reduce;\t/* cnt of voluntary reductions */\n\tuint16_t steady_step;\t/* The number required to be in steady state */\n\tuint16_t step_cnt;\t/* The current number */\n\tuint8_t ret_from_eq;\t/* When all things are equal what do I return\n\t\t\t\t * 0/1 - 1 no cc advance */\n\tuint8_t use_dccc_ecn;\t/* Flag to enable DCCC ECN */\n\tuint8_t tls_needs_set;\t/* Flag to indicate we need to set tls 0 or 1\n\t\t\t\t * means set at send 2 not */\n\tuint8_t last_step_state;/* Last state if steady state stepdown is on */\n\tuint8_t rtt_set_this_sack;\t/* Flag saying this sack had RTT calc\n\t\t\t\t\t * on it */\n\tuint8_t last_inst_ind;\t/* Last saved inst indication */\n};\n\n\nstruct sctp_nets {\n\tTAILQ_ENTRY(sctp_nets) sctp_next;\t/* next link */\n\n\t/*\n\t * Things on the top half may be able to be split into a common\n\t * structure shared by all.\n\t */\n\tstruct sctp_timer pmtu_timer;\n\tstruct sctp_timer hb_timer;\n\n\t/*\n\t * The following two in combination equate to a route entry for v6\n\t * or v4.\n\t */\n\tstruct sctp_net_route ro;\n\n\t/* mtu discovered so far */\n\tuint32_t mtu;\n\tuint32_t ssthresh;\t/* not sure about this one for split */\n\tuint32_t last_cwr_tsn;\n\tuint32_t cwr_window_tsn;\n\tuint32_t ecn_ce_pkt_cnt;\n\tuint32_t lost_cnt;\n\t/* smoothed average things for RTT and RTO itself */\n\tint lastsa;\n\tint lastsv;\n\tuint64_t rtt;\t\t/* last measured rtt value in us */\n\tunsigned int RTO;\n\n\t/* This is used for SHUTDOWN/SHUTDOWN-ACK/SEND or INIT timers */\n\tstruct sctp_timer rxt_timer;\n\n\t/* last time in seconds I sent to it */\n\tstruct timeval last_sent_time;\n\tunion cc_control_data {\n\t\tstruct htcp htcp_ca;\t/* JRS - struct used in HTCP algorithm */\n\t\tstruct rtcc_cc rtcc;\t/* rtcc module cc stuff  */\n\t}               cc_mod;\n\tint ref_count;\n\n\t/* Congestion stats per destination */\n\t/*\n\t * flight size variables and such, sorry Vern, I could not avoid\n\t * this if I wanted performance :>\n\t */\n\tuint32_t flight_size;\n\tuint32_t cwnd;\t\t/* actual cwnd */\n\tuint32_t prev_cwnd;\t/* cwnd before any processing */\n\tuint32_t ecn_prev_cwnd;\t/* ECN prev cwnd at first ecn_echo seen in new\n\t\t\t\t * window */\n\tuint32_t partial_bytes_acked;\t/* in CA tracks when to incr a MTU */\n\t/* tracking variables to avoid the aloc/free in sack processing */\n\tunsigned int net_ack;\n\tunsigned int net_ack2;\n\n\t/*\n\t * JRS - 5/8/07 - Variable to track last time a destination was\n\t * active for CMT PF\n\t */\n\tuint32_t last_active;\n\n\t/*\n\t * CMT variables (iyengar@cis.udel.edu)\n\t */\n\tuint32_t this_sack_highest_newack;\t/* tracks highest TSN newly\n\t\t\t\t\t\t * acked for a given dest in\n\t\t\t\t\t\t * the current SACK. Used in\n\t\t\t\t\t\t * SFR and HTNA algos */\n\tuint32_t pseudo_cumack;\t/* CMT CUC algorithm. Maintains next expected\n\t\t\t\t * pseudo-cumack for this destination */\n\tuint32_t rtx_pseudo_cumack;\t/* CMT CUC algorithm. Maintains next\n\t\t\t\t\t * expected pseudo-cumack for this\n\t\t\t\t\t * destination */\n\n\t/* CMT fast recovery variables */\n\tuint32_t fast_recovery_tsn;\n\tuint32_t heartbeat_random1;\n\tuint32_t heartbeat_random2;\n#ifdef INET6\n\tuint32_t flowlabel;\n#endif\n\tuint8_t dscp;\n\n\tstruct timeval start_time;\t/* time when this net was created */\n\tuint32_t marked_retrans;/* number or DATA chunks marked for timer\n\t\t\t\t * based retransmissions */\n\tuint32_t marked_fastretrans;\n\tuint32_t heart_beat_delay;\t/* Heart Beat delay in ms */\n\n\t/* if this guy is ok or not ... status */\n\tuint16_t dest_state;\n\t/* number of timeouts to consider the destination unreachable */\n\tuint16_t failure_threshold;\n\t/* number of timeouts to consider the destination potentially failed */\n\tuint16_t pf_threshold;\n\t/* error stats on the destination */\n\tuint16_t error_count;\n\t/* UDP port number in case of UDP tunneling */\n\tuint16_t port;\n\n\tuint8_t fast_retran_loss_recovery;\n\tuint8_t will_exit_fast_recovery;\n\t/* Flags that probably can be combined into dest_state */\n\tuint8_t fast_retran_ip;\t/* fast retransmit in progress */\n\tuint8_t hb_responded;\n\tuint8_t saw_newack;\t/* CMT's SFR algorithm flag */\n\tuint8_t src_addr_selected;\t/* if we split we move */\n\tuint8_t indx_of_eligible_next_to_use;\n\tuint8_t addr_is_local;\t/* its a local address (if known) could move\n\t\t\t\t * in split */\n\n\t/*\n\t * CMT variables (iyengar@cis.udel.edu)\n\t */\n\tuint8_t find_pseudo_cumack;\t/* CMT CUC algorithm. Flag used to\n\t\t\t\t\t * find a new pseudocumack. This flag\n\t\t\t\t\t * is set after a new pseudo-cumack\n\t\t\t\t\t * has been received and indicates\n\t\t\t\t\t * that the sender should find the\n\t\t\t\t\t * next pseudo-cumack expected for\n\t\t\t\t\t * this destination */\n\tuint8_t find_rtx_pseudo_cumack;\t/* CMT CUCv2 algorithm. Flag used to\n\t\t\t\t\t * find a new rtx-pseudocumack. This\n\t\t\t\t\t * flag is set after a new\n\t\t\t\t\t * rtx-pseudo-cumack has been received\n\t\t\t\t\t * and indicates that the sender\n\t\t\t\t\t * should find the next\n\t\t\t\t\t * rtx-pseudo-cumack expected for this\n\t\t\t\t\t * destination */\n\tuint8_t new_pseudo_cumack;\t/* CMT CUC algorithm. Flag used to\n\t\t\t\t\t * indicate if a new pseudo-cumack or\n\t\t\t\t\t * rtx-pseudo-cumack has been received */\n\tuint8_t window_probe;\t/* Doing a window probe? */\n\tuint8_t RTO_measured;\t/* Have we done the first measure */\n\tuint8_t last_hs_used;\t/* index into the last HS table entry we used */\n\tuint8_t lan_type;\n\tuint8_t rto_needed;\n\tuint32_t flowid;\n#ifdef INVARIANTS\n\tuint8_t flowidset;\n#endif\n};\n\n\nstruct sctp_data_chunkrec {\n\tuint32_t TSN_seq;\t/* the TSN of this transmit */\n\tuint16_t stream_seq;\t/* the stream sequence number of this transmit */\n\tuint16_t stream_number;\t/* the stream number of this guy */\n\tuint32_t payloadtype;\n\tuint32_t context;\t/* from send */\n\tuint32_t cwnd_at_send;\n\t/*\n\t * part of the Highest sacked algorithm to be able to stroke counts\n\t * on ones that are FR'd.\n\t */\n\tuint32_t fast_retran_tsn;\t/* sending_seq at the time of FR */\n\tstruct timeval timetodrop;\t/* time we drop it from queue */\n\tuint8_t doing_fast_retransmit;\n\tuint8_t rcv_flags;\t/* flags pulled from data chunk on inbound for\n\t\t\t\t * outbound holds sending flags for PR-SCTP. */\n\tuint8_t state_flags;\n\tuint8_t chunk_was_revoked;\n\tuint8_t fwd_tsn_cnt;\n};\n\nTAILQ_HEAD(sctpchunk_listhead, sctp_tmit_chunk);\n\n/* The lower byte is used to enumerate PR_SCTP policies */\n#define CHUNK_FLAGS_PR_SCTP_TTL\t        SCTP_PR_SCTP_TTL\n#define CHUNK_FLAGS_PR_SCTP_BUF\t        SCTP_PR_SCTP_BUF\n#define CHUNK_FLAGS_PR_SCTP_RTX         SCTP_PR_SCTP_RTX\n\n/* The upper byte is used a a bit mask */\n#define CHUNK_FLAGS_FRAGMENT_OK\t        0x0100\n\nstruct chk_id {\n\tuint16_t id;\n\tuint16_t can_take_data;\n};\n\n\nstruct sctp_tmit_chunk {\n\tunion {\n\t\tstruct sctp_data_chunkrec data;\n\t\tstruct chk_id chunk_id;\n\t}     rec;\n\tstruct sctp_association *asoc;\t/* bp to asoc this belongs to */\n\tstruct timeval sent_rcv_time;\t/* filled in if RTT being calculated */\n\tstruct mbuf *data;\t/* pointer to mbuf chain of data */\n\tstruct mbuf *last_mbuf;\t/* pointer to last mbuf in chain */\n\tstruct sctp_nets *whoTo;\n\t          TAILQ_ENTRY(sctp_tmit_chunk) sctp_next;\t/* next link */\n\tint32_t sent;\t\t/* the send status */\n\tuint16_t snd_count;\t/* number of times I sent */\n\tuint16_t flags;\t\t/* flags, such as FRAGMENT_OK */\n\tuint16_t send_size;\n\tuint16_t book_size;\n\tuint16_t mbcnt;\n\tuint16_t auth_keyid;\n\tuint8_t holds_key_ref;\t/* flag if auth keyid refcount is held */\n\tuint8_t pad_inplace;\n\tuint8_t do_rtt;\n\tuint8_t book_size_scale;\n\tuint8_t no_fr_allowed;\n\tuint8_t pr_sctp_on;\n\tuint8_t copy_by_ref;\n\tuint8_t window_probe;\n};\n\n/*\n * The first part of this structure MUST be the entire sinfo structure. Maybe\n * I should have made it a sub structure... we can circle back later and do\n * that if we want.\n */\nstruct sctp_queued_to_read {\t/* sinfo structure Pluse more */\n\tuint16_t sinfo_stream;\t/* off the wire */\n\tuint16_t sinfo_ssn;\t/* off the wire */\n\tuint16_t sinfo_flags;\t/* SCTP_UNORDERED from wire use SCTP_EOF for\n\t\t\t\t * EOR */\n\tuint32_t sinfo_ppid;\t/* off the wire */\n\tuint32_t sinfo_context;\t/* pick this up from assoc def context? */\n\tuint32_t sinfo_timetolive;\t/* not used by kernel */\n\tuint32_t sinfo_tsn;\t/* Use this in reassembly as first TSN */\n\tuint32_t sinfo_cumtsn;\t/* Use this in reassembly as last TSN */\n\tsctp_assoc_t sinfo_assoc_id;\t/* our assoc id */\n\t/* Non sinfo stuff */\n\tuint32_t length;\t/* length of data */\n\tuint32_t held_length;\t/* length held in sb */\n\tstruct sctp_nets *whoFrom;\t/* where it came from */\n\tstruct mbuf *data;\t/* front of the mbuf chain of data with\n\t\t\t\t * PKT_HDR */\n\tstruct mbuf *tail_mbuf;\t/* used for multi-part data */\n\tstruct mbuf *aux_data;\t/* used to hold/cache  control if o/s does not\n\t\t\t\t * take it from us */\n\tstruct sctp_tcb *stcb;\t/* assoc, used for window update */\n\t         TAILQ_ENTRY(sctp_queued_to_read) next;\n\tuint16_t port_from;\n\tuint16_t spec_flags;\t/* Flags to hold the notification field */\n\tuint8_t do_not_ref_stcb;\n\tuint8_t end_added;\n\tuint8_t pdapi_aborted;\n\tuint8_t some_taken;\n};\n\n/* This data structure will be on the outbound\n * stream queues. Data will be pulled off from\n * the front of the mbuf data and chunk-ified\n * by the output routines. We will custom\n * fit every chunk we pull to the send/sent\n * queue to make up the next full packet\n * if we can. An entry cannot be removed\n * from the stream_out queue until\n * the msg_is_complete flag is set. This\n * means at times data/tail_mbuf MIGHT\n * be NULL.. If that occurs it happens\n * for one of two reasons. Either the user\n * is blocked on a send() call and has not\n * awoken to copy more data down... OR\n * the user is in the explict MSG_EOR mode\n * and wrote some data, but has not completed\n * sending.\n */\nstruct sctp_stream_queue_pending {\n\tstruct mbuf *data;\n\tstruct mbuf *tail_mbuf;\n\tstruct timeval ts;\n\tstruct sctp_nets *net;\n\t          TAILQ_ENTRY(sctp_stream_queue_pending) next;\n\t          TAILQ_ENTRY(sctp_stream_queue_pending) ss_next;\n\tuint32_t length;\n\tuint32_t timetolive;\n\tuint32_t ppid;\n\tuint32_t context;\n\tuint16_t sinfo_flags;\n\tuint16_t stream;\n\tuint16_t strseq;\n\tuint16_t act_flags;\n\tuint16_t auth_keyid;\n\tuint8_t holds_key_ref;\n\tuint8_t msg_is_complete;\n\tuint8_t some_taken;\n\tuint8_t pr_sctp_on;\n\tuint8_t sender_all_done;\n\tuint8_t put_last_out;\n\tuint8_t discard_rest;\n};\n\n/*\n * this struct contains info that is used to track inbound stream data and\n * help with ordering.\n */\nTAILQ_HEAD(sctpwheelunrel_listhead, sctp_stream_in);\nstruct sctp_stream_in {\n\tstruct sctp_readhead inqueue;\n\tuint16_t stream_no;\n\tuint16_t last_sequence_delivered;\t/* used for re-order */\n\tuint8_t delivery_started;\n};\n\nTAILQ_HEAD(sctpwheel_listhead, sctp_stream_out);\nTAILQ_HEAD(sctplist_listhead, sctp_stream_queue_pending);\n\n/* Round-robin schedulers */\nstruct ss_rr {\n\t/* next link in wheel */\n\tTAILQ_ENTRY(sctp_stream_out) next_spoke;\n};\n\n/* Priority scheduler */\nstruct ss_prio {\n\t/* next link in wheel */\n\tTAILQ_ENTRY(sctp_stream_out) next_spoke;\n\t/* priority id */\n\tuint16_t priority;\n};\n\n/* Fair Bandwidth scheduler */\nstruct ss_fb {\n\t/* next link in wheel */\n\tTAILQ_ENTRY(sctp_stream_out) next_spoke;\n\t/* stores message size */\n\tint32_t rounds;\n};\n\n/*\n * This union holds all data necessary for\n * different stream schedulers.\n */\nunion scheduling_data {\n\tstruct sctpwheel_listhead out_wheel;\n\tstruct sctplist_listhead out_list;\n};\n\n/*\n * This union holds all parameters per stream\n * necessary for different stream schedulers.\n */\nunion scheduling_parameters {\n\tstruct ss_rr rr;\n\tstruct ss_prio prio;\n\tstruct ss_fb fb;\n};\n\n/* This struct is used to track the traffic on outbound streams */\nstruct sctp_stream_out {\n\tstruct sctp_streamhead outqueue;\n\tunion scheduling_parameters ss_params;\n\tuint16_t stream_no;\n\tuint16_t next_sequence_sent;\t/* next one I expect to send out */\n\tuint8_t last_msg_incomplete;\n};\n\n/* used to keep track of the addresses yet to try to add/delete */\nTAILQ_HEAD(sctp_asconf_addrhead, sctp_asconf_addr);\nstruct sctp_asconf_addr {\n\tTAILQ_ENTRY(sctp_asconf_addr) next;\n\tstruct sctp_asconf_addr_param ap;\n\tstruct sctp_ifa *ifa;\t/* save the ifa for add/del ip */\n\tuint8_t sent;\t\t/* has this been sent yet? */\n\tuint8_t special_del;\t/* not to be used in lookup */\n};\n\nstruct sctp_scoping {\n\tuint8_t ipv4_addr_legal;\n\tuint8_t ipv6_addr_legal;\n\tuint8_t loopback_scope;\n\tuint8_t ipv4_local_scope;\n\tuint8_t local_scope;\n\tuint8_t site_scope;\n};\n\n#define SCTP_TSN_LOG_SIZE 40\n\nstruct sctp_tsn_log {\n\tvoid *stcb;\n\tuint32_t tsn;\n\tuint16_t strm;\n\tuint16_t seq;\n\tuint16_t sz;\n\tuint16_t flgs;\n\tuint16_t in_pos;\n\tuint16_t in_out;\n};\n\n#define SCTP_FS_SPEC_LOG_SIZE 200\nstruct sctp_fs_spec_log {\n\tuint32_t sent;\n\tuint32_t total_flight;\n\tuint32_t tsn;\n\tuint16_t book;\n\tuint8_t incr;\n\tuint8_t decr;\n};\n\n/* This struct is here to cut out the compatiabilty\n * pad that bulks up both the inp and stcb. The non\n * pad portion MUST stay in complete sync with\n * sctp_sndrcvinfo... i.e. if sinfo_xxxx is added\n * this must be done here too.\n */\nstruct sctp_nonpad_sndrcvinfo {\n\tuint16_t sinfo_stream;\n\tuint16_t sinfo_ssn;\n\tuint16_t sinfo_flags;\n\tuint32_t sinfo_ppid;\n\tuint32_t sinfo_context;\n\tuint32_t sinfo_timetolive;\n\tuint32_t sinfo_tsn;\n\tuint32_t sinfo_cumtsn;\n\tsctp_assoc_t sinfo_assoc_id;\n\tuint16_t sinfo_keynumber;\n\tuint16_t sinfo_keynumber_valid;\n};\n\n/*\n * JRS - Structure to hold function pointers to the functions responsible\n * for congestion control.\n */\n\nstruct sctp_cc_functions {\n\tvoid (*sctp_set_initial_cc_param) (struct sctp_tcb *stcb, struct sctp_nets *net);\n\tvoid (*sctp_cwnd_update_after_sack) (struct sctp_tcb *stcb,\n\t         struct sctp_association *asoc,\n\t         int accum_moved, int reneged_all, int will_exit);\n\tvoid (*sctp_cwnd_update_exit_pf) (struct sctp_tcb *stcb, struct sctp_nets *net);\n\tvoid (*sctp_cwnd_update_after_fr) (struct sctp_tcb *stcb,\n\t         struct sctp_association *asoc);\n\tvoid (*sctp_cwnd_update_after_timeout) (struct sctp_tcb *stcb,\n\t         struct sctp_nets *net);\n\tvoid (*sctp_cwnd_update_after_ecn_echo) (struct sctp_tcb *stcb,\n\t         struct sctp_nets *net, int in_window, int num_pkt_lost);\n\tvoid (*sctp_cwnd_update_after_packet_dropped) (struct sctp_tcb *stcb,\n\t         struct sctp_nets *net, struct sctp_pktdrop_chunk *cp,\n\t         uint32_t * bottle_bw, uint32_t * on_queue);\n\tvoid (*sctp_cwnd_update_after_output) (struct sctp_tcb *stcb,\n\t         struct sctp_nets *net, int burst_limit);\n\tvoid (*sctp_cwnd_update_packet_transmitted) (struct sctp_tcb *stcb,\n\t         struct sctp_nets *net);\n\tvoid (*sctp_cwnd_update_tsn_acknowledged) (struct sctp_nets *net,\n\t         struct sctp_tmit_chunk *);\n\tvoid (*sctp_cwnd_new_transmission_begins) (struct sctp_tcb *stcb,\n\t         struct sctp_nets *net);\n\tvoid (*sctp_cwnd_prepare_net_for_sack) (struct sctp_tcb *stcb,\n\t         struct sctp_nets *net);\n\tint (*sctp_cwnd_socket_option) (struct sctp_tcb *stcb, int set, struct sctp_cc_option *);\n\tvoid (*sctp_rtt_calculated) (struct sctp_tcb *, struct sctp_nets *, struct timeval *);\n};\n\n/*\n * RS - Structure to hold function pointers to the functions responsible\n * for stream scheduling.\n */\nstruct sctp_ss_functions {\n\tvoid (*sctp_ss_init) (struct sctp_tcb *stcb, struct sctp_association *asoc,\n\t         int holds_lock);\n\tvoid (*sctp_ss_clear) (struct sctp_tcb *stcb, struct sctp_association *asoc,\n\t         int clear_values, int holds_lock);\n\tvoid (*sctp_ss_init_stream) (struct sctp_stream_out *strq, struct sctp_stream_out *with_strq);\n\tvoid (*sctp_ss_add_to_stream) (struct sctp_tcb *stcb, struct sctp_association *asoc,\n\t         struct sctp_stream_out *strq, struct sctp_stream_queue_pending *sp, int holds_lock);\n\tint (*sctp_ss_is_empty) (struct sctp_tcb *stcb, struct sctp_association *asoc);\n\tvoid (*sctp_ss_remove_from_stream) (struct sctp_tcb *stcb, struct sctp_association *asoc,\n\t         struct sctp_stream_out *strq, struct sctp_stream_queue_pending *sp, int holds_lock);\n\tstruct sctp_stream_out *(*sctp_ss_select_stream) (struct sctp_tcb *stcb,\n\t                    struct sctp_nets *net, struct sctp_association *asoc);\n\tvoid (*sctp_ss_scheduled) (struct sctp_tcb *stcb, struct sctp_nets *net,\n\t         struct sctp_association *asoc, struct sctp_stream_out *strq, int moved_how_much);\n\tvoid (*sctp_ss_packet_done) (struct sctp_tcb *stcb, struct sctp_nets *net,\n\t         struct sctp_association *asoc);\n\tint (*sctp_ss_get_value) (struct sctp_tcb *stcb, struct sctp_association *asoc,\n\t        struct sctp_stream_out *strq, uint16_t * value);\n\tint (*sctp_ss_set_value) (struct sctp_tcb *stcb, struct sctp_association *asoc,\n\t        struct sctp_stream_out *strq, uint16_t value);\n};\n\n/* used to save ASCONF chunks for retransmission */\nTAILQ_HEAD(sctp_asconf_head, sctp_asconf);\nstruct sctp_asconf {\n\tTAILQ_ENTRY(sctp_asconf) next;\n\tuint32_t serial_number;\n\tuint16_t snd_count;\n\tstruct mbuf *data;\n\tuint16_t len;\n};\n\n/* used to save ASCONF-ACK chunks for retransmission */\nTAILQ_HEAD(sctp_asconf_ackhead, sctp_asconf_ack);\nstruct sctp_asconf_ack {\n\tTAILQ_ENTRY(sctp_asconf_ack) next;\n\tuint32_t serial_number;\n\tstruct sctp_nets *last_sent_to;\n\tstruct mbuf *data;\n\tuint16_t len;\n};\n\n/*\n * Here we have information about each individual association that we track.\n * We probably in production would be more dynamic. But for ease of\n * implementation we will have a fixed array that we hunt for in a linear\n * fashion.\n */\nstruct sctp_association {\n\t/* association state */\n\tint state;\n\n\t/* queue of pending addrs to add/delete */\n\tstruct sctp_asconf_addrhead asconf_queue;\n\n\tstruct timeval time_entered;\t/* time we entered state */\n\tstruct timeval time_last_rcvd;\n\tstruct timeval time_last_sent;\n\tstruct timeval time_last_sat_advance;\n\tstruct sctp_nonpad_sndrcvinfo def_send;\n\n\t/* timers and such */\n\tstruct sctp_timer dack_timer;\t/* Delayed ack timer */\n\tstruct sctp_timer asconf_timer;\t/* asconf */\n\tstruct sctp_timer strreset_timer;\t/* stream reset */\n\tstruct sctp_timer shut_guard_timer;\t/* shutdown guard */\n\tstruct sctp_timer autoclose_timer;\t/* automatic close timer */\n\tstruct sctp_timer delayed_event_timer;\t/* timer for delayed events */\n\tstruct sctp_timer delete_prim_timer;\t/* deleting primary dst */\n\n\t/* list of restricted local addresses */\n\tstruct sctpladdr sctp_restricted_addrs;\n\n\t/* last local address pending deletion (waiting for an address add) */\n\tstruct sctp_ifa *asconf_addr_del_pending;\n\t/* Deleted primary destination (used to stop timer) */\n\tstruct sctp_nets *deleted_primary;\n\n\tstruct sctpnetlisthead nets;\t/* remote address list */\n\n\t/* Free chunk list */\n\tstruct sctpchunk_listhead free_chunks;\n\n\t/* Control chunk queue */\n\tstruct sctpchunk_listhead control_send_queue;\n\n\t/* ASCONF chunk queue */\n\tstruct sctpchunk_listhead asconf_send_queue;\n\n\t/*\n\t * Once a TSN hits the wire it is moved to the sent_queue. We\n\t * maintain two counts here (don't know if any but retran_cnt is\n\t * needed). The idea is that the sent_queue_retran_cnt reflects how\n\t * many chunks have been marked for retranmission by either T3-rxt\n\t * or FR.\n\t */\n\tstruct sctpchunk_listhead sent_queue;\n\tstruct sctpchunk_listhead send_queue;\n\n\t/* re-assembly queue for fragmented chunks on the inbound path */\n\tstruct sctpchunk_listhead reasmqueue;\n\n\t/* Scheduling queues */\n\tunion scheduling_data ss_data;\n\n\t/*\n\t * This pointer will be set to NULL most of the time. But when we\n\t * have a fragmented message, where we could not get out all of the\n\t * message at the last send then this will point to the stream to go\n\t * get data from.\n\t */\n\tstruct sctp_stream_out *locked_on_sending;\n\n\t/* If an iterator is looking at me, this is it */\n\tstruct sctp_iterator *stcb_starting_point_for_iterator;\n\n\t/* ASCONF save the last ASCONF-ACK so we can resend it if necessary */\n\tstruct sctp_asconf_ackhead asconf_ack_sent;\n\n\t/*\n\t * pointer to last stream reset queued to control queue by us with\n\t * requests.\n\t */\n\tstruct sctp_tmit_chunk *str_reset;\n\t/*\n\t * if Source Address Selection happening, this will rotate through\n\t * the link list.\n\t */\n\tstruct sctp_laddr *last_used_address;\n\n\t/* stream arrays */\n\tstruct sctp_stream_in *strmin;\n\tstruct sctp_stream_out *strmout;\n\tuint8_t *mapping_array;\n\t/* primary destination to use */\n\tstruct sctp_nets *primary_destination;\n\tstruct sctp_nets *alternate;\t/* If primary is down or PF */\n\t/* For CMT */\n\tstruct sctp_nets *last_net_cmt_send_started;\n\t/* last place I got a data chunk from */\n\tstruct sctp_nets *last_data_chunk_from;\n\t/* last place I got a control from */\n\tstruct sctp_nets *last_control_chunk_from;\n\n\t/* circular looking for output selection */\n\tstruct sctp_stream_out *last_out_stream;\n\n\t/*\n\t * wait to the point the cum-ack passes req->send_reset_at_tsn for\n\t * any req on the list.\n\t */\n\tstruct sctp_resethead resetHead;\n\n\t/* queue of chunks waiting to be sent into the local stack */\n\tstruct sctp_readhead pending_reply_queue;\n\n\t/* JRS - the congestion control functions are in this struct */\n\tstruct sctp_cc_functions cc_functions;\n\t/*\n\t * JRS - value to store the currently loaded congestion control\n\t * module\n\t */\n\tuint32_t congestion_control_module;\n\t/* RS - the stream scheduling functions are in this struct */\n\tstruct sctp_ss_functions ss_functions;\n\t/* RS - value to store the currently loaded stream scheduling module */\n\tuint32_t stream_scheduling_module;\n\n\tuint32_t vrf_id;\n\n\tuint32_t cookie_preserve_req;\n\t/* ASCONF next seq I am sending out, inits at init-tsn */\n\tuint32_t asconf_seq_out;\n\tuint32_t asconf_seq_out_acked;\n\t/* ASCONF last received ASCONF from peer, starts at peer's TSN-1 */\n\tuint32_t asconf_seq_in;\n\n\t/* next seq I am sending in str reset messages */\n\tuint32_t str_reset_seq_out;\n\t/* next seq I am expecting in str reset messages */\n\tuint32_t str_reset_seq_in;\n\n\t/* various verification tag information */\n\tuint32_t my_vtag;\t/* The tag to be used. if assoc is re-initited\n\t\t\t\t * by remote end, and I have unlocked this\n\t\t\t\t * will be regenerated to a new random value. */\n\tuint32_t peer_vtag;\t/* The peers last tag */\n\n\tuint32_t my_vtag_nonce;\n\tuint32_t peer_vtag_nonce;\n\n\tuint32_t assoc_id;\n\n\t/* This is the SCTP fragmentation threshold */\n\tuint32_t smallest_mtu;\n\n\t/*\n\t * Special hook for Fast retransmit, allows us to track the highest\n\t * TSN that is NEW in this SACK if gap ack blocks are present.\n\t */\n\tuint32_t this_sack_highest_gap;\n\n\t/*\n\t * The highest consecutive TSN that has been acked by peer on my\n\t * sends\n\t */\n\tuint32_t last_acked_seq;\n\n\t/* The next TSN that I will use in sending. */\n\tuint32_t sending_seq;\n\n\t/* Original seq number I used ??questionable to keep?? */\n\tuint32_t init_seq_number;\n\n\n\t/* The Advanced Peer Ack Point, as required by the PR-SCTP */\n\t/* (A1 in Section 4.2) */\n\tuint32_t advanced_peer_ack_point;\n\n\t/*\n\t * The highest consequetive TSN at the bottom of the mapping array\n\t * (for his sends).\n\t */\n\tuint32_t cumulative_tsn;\n\t/*\n\t * Used to track the mapping array and its offset bits. This MAY be\n\t * lower then cumulative_tsn.\n\t */\n\tuint32_t mapping_array_base_tsn;\n\t/*\n\t * used to track highest TSN we have received and is listed in the\n\t * mapping array.\n\t */\n\tuint32_t highest_tsn_inside_map;\n\n\t/* EY - new NR variables used for nr_sack based on mapping_array */\n\tuint8_t *nr_mapping_array;\n\tuint32_t highest_tsn_inside_nr_map;\n\n\tuint32_t fast_recovery_tsn;\n\tuint32_t sat_t3_recovery_tsn;\n\tuint32_t tsn_last_delivered;\n\t/*\n\t * For the pd-api we should re-write this a bit more efficent. We\n\t * could have multiple sctp_queued_to_read's that we are building at\n\t * once. Now we only do this when we get ready to deliver to the\n\t * socket buffer. Note that we depend on the fact that the struct is\n\t * \"stuck\" on the read queue until we finish all the pd-api.\n\t */\n\tstruct sctp_queued_to_read *control_pdapi;\n\n\tuint32_t tsn_of_pdapi_last_delivered;\n\tuint32_t pdapi_ppid;\n\tuint32_t context;\n\tuint32_t last_reset_action[SCTP_MAX_RESET_PARAMS];\n\tuint32_t last_sending_seq[SCTP_MAX_RESET_PARAMS];\n\tuint32_t last_base_tsnsent[SCTP_MAX_RESET_PARAMS];\n#ifdef SCTP_ASOCLOG_OF_TSNS\n\t/*\n\t * special log  - This adds considerable size to the asoc, but\n\t * provides a log that you can use to detect problems via kgdb.\n\t */\n\tstruct sctp_tsn_log in_tsnlog[SCTP_TSN_LOG_SIZE];\n\tstruct sctp_tsn_log out_tsnlog[SCTP_TSN_LOG_SIZE];\n\tuint32_t cumack_log[SCTP_TSN_LOG_SIZE];\n\tuint32_t cumack_logsnt[SCTP_TSN_LOG_SIZE];\n\tuint16_t tsn_in_at;\n\tuint16_t tsn_out_at;\n\tuint16_t tsn_in_wrapped;\n\tuint16_t tsn_out_wrapped;\n\tuint16_t cumack_log_at;\n\tuint16_t cumack_log_atsnt;\n#endif\t\t\t\t/* SCTP_ASOCLOG_OF_TSNS */\n#ifdef SCTP_FS_SPEC_LOG\n\tstruct sctp_fs_spec_log fslog[SCTP_FS_SPEC_LOG_SIZE];\n\tuint16_t fs_index;\n#endif\n\n\t/*\n\t * window state information and smallest MTU that I use to bound\n\t * segmentation\n\t */\n\tuint32_t peers_rwnd;\n\tuint32_t my_rwnd;\n\tuint32_t my_last_reported_rwnd;\n\tuint32_t sctp_frag_point;\n\n\tuint32_t total_output_queue_size;\n\n\tuint32_t sb_cc;\t\t/* shadow of sb_cc */\n\tuint32_t sb_send_resv;\t/* amount reserved on a send */\n\tuint32_t my_rwnd_control_len;\t/* shadow of sb_mbcnt used for rwnd\n\t\t\t\t\t * control */\n#ifdef INET6\n\tuint32_t default_flowlabel;\n#endif\n\tuint32_t pr_sctp_cnt;\n\tint ctrl_queue_cnt;\t/* could be removed  REM - NO IT CAN'T!! RRS */\n\t/*\n\t * All outbound datagrams queue into this list from the individual\n\t * stream queue. Here they get assigned a TSN and then await\n\t * sending. The stream seq comes when it is first put in the\n\t * individual str queue\n\t */\n\tunsigned int stream_queue_cnt;\n\tunsigned int send_queue_cnt;\n\tunsigned int sent_queue_cnt;\n\tunsigned int sent_queue_cnt_removeable;\n\t/*\n\t * Number on sent queue that are marked for retran until this value\n\t * is 0 we only send one packet of retran'ed data.\n\t */\n\tunsigned int sent_queue_retran_cnt;\n\n\tunsigned int size_on_reasm_queue;\n\tunsigned int cnt_on_reasm_queue;\n\tunsigned int fwd_tsn_cnt;\n\t/* amount of data (bytes) currently in flight (on all destinations) */\n\tunsigned int total_flight;\n\t/* Total book size in flight */\n\tunsigned int total_flight_count;\t/* count of chunks used with\n\t\t\t\t\t\t * book total */\n\t/* count of destinaton nets and list of destination nets */\n\tunsigned int numnets;\n\n\t/* Total error count on this association */\n\tunsigned int overall_error_count;\n\n\tunsigned int cnt_msg_on_sb;\n\n\t/* All stream count of chunks for delivery */\n\tunsigned int size_on_all_streams;\n\tunsigned int cnt_on_all_streams;\n\n\t/* Heart Beat delay in ms */\n\tuint32_t heart_beat_delay;\n\n\t/* autoclose */\n\tunsigned int sctp_autoclose_ticks;\n\n\t/* how many preopen streams we have */\n\tunsigned int pre_open_streams;\n\n\t/* How many streams I support coming into me */\n\tunsigned int max_inbound_streams;\n\n\t/* the cookie life I award for any cookie, in seconds */\n\tunsigned int cookie_life;\n\t/* time to delay acks for */\n\tunsigned int delayed_ack;\n\tunsigned int old_delayed_ack;\n\tunsigned int sack_freq;\n\tunsigned int data_pkts_seen;\n\n\tunsigned int numduptsns;\n\tint dup_tsns[SCTP_MAX_DUP_TSNS];\n\tunsigned int initial_init_rto_max;\t/* initial RTO for INIT's */\n\tunsigned int initial_rto;\t/* initial send RTO */\n\tunsigned int minrto;\t/* per assoc RTO-MIN */\n\tunsigned int maxrto;\t/* per assoc RTO-MAX */\n\n\t/* authentication fields */\n\tsctp_auth_chklist_t *local_auth_chunks;\n\tsctp_auth_chklist_t *peer_auth_chunks;\n\tsctp_hmaclist_t *local_hmacs;\t/* local HMACs supported */\n\tsctp_hmaclist_t *peer_hmacs;\t/* peer HMACs supported */\n\tstruct sctp_keyhead shared_keys;\t/* assoc's shared keys */\n\tsctp_authinfo_t authinfo;\t/* randoms, cached keys */\n\t/*\n\t * refcnt to block freeing when a sender or receiver is off coping\n\t * user data in.\n\t */\n\tuint32_t refcnt;\n\tuint32_t chunks_on_out_queue;\t/* total chunks floating around,\n\t\t\t\t\t * locked by send socket buffer */\n\tuint32_t peers_adaptation;\n\tuint16_t peer_hmac_id;\t/* peer HMAC id to send */\n\n\t/*\n\t * Being that we have no bag to collect stale cookies, and that we\n\t * really would not want to anyway.. we will count them in this\n\t * counter. We of course feed them to the pigeons right away (I have\n\t * always thought of pigeons as flying rats).\n\t */\n\tuint16_t stale_cookie_count;\n\n\t/*\n\t * For the partial delivery API, if up, invoked this is what last\n\t * TSN I delivered\n\t */\n\tuint16_t str_of_pdapi;\n\tuint16_t ssn_of_pdapi;\n\n\t/* counts of actual built streams. Allocation may be more however */\n\t/* could re-arrange to optimize space here. */\n\tuint16_t streamincnt;\n\tuint16_t streamoutcnt;\n\tuint16_t strm_realoutsize;\n\t/* my maximum number of retrans of INIT and SEND */\n\t/* copied from SCTP but should be individually setable */\n\tuint16_t max_init_times;\n\tuint16_t max_send_times;\n\n\tuint16_t def_net_failure;\n\n\tuint16_t def_net_pf_threshold;\n\n\t/*\n\t * lock flag: 0 is ok to send, 1+ (duals as a retran count) is\n\t * awaiting ACK\n\t */\n\tuint16_t mapping_array_size;\n\n\tuint16_t last_strm_seq_delivered;\n\tuint16_t last_strm_no_delivered;\n\n\tuint16_t last_revoke_count;\n\tint16_t num_send_timers_up;\n\n\tuint16_t stream_locked_on;\n\tuint16_t ecn_echo_cnt_onq;\n\n\tuint16_t free_chunk_cnt;\n\tuint8_t stream_locked;\n\tuint8_t authenticated;\t/* packet authenticated ok */\n\t/*\n\t * This flag indicates that a SACK need to be sent. Initially this\n\t * is 1 to send the first sACK immediately.\n\t */\n\tuint8_t send_sack;\n\n\t/* max burst of new packets into the network */\n\tuint32_t max_burst;\n\t/* max burst of fast retransmit packets */\n\tuint32_t fr_max_burst;\n\n\tuint8_t sat_network;\t/* RTT is in range of sat net or greater */\n\tuint8_t sat_network_lockout;\t/* lockout code */\n\tuint8_t burst_limit_applied;\t/* Burst limit in effect at last send? */\n\t/* flag goes on when we are doing a partial delivery api */\n\tuint8_t hb_random_values[4];\n\tuint8_t fragmented_delivery_inprogress;\n\tuint8_t fragment_flags;\n\tuint8_t last_flags_delivered;\n\tuint8_t hb_ect_randombit;\n\tuint8_t hb_random_idx;\n\tuint8_t default_dscp;\n\tuint8_t asconf_del_pending;\t/* asconf delete last addr pending */\n\n\t/*\n\t * This value, plus all other ack'd but above cum-ack is added\n\t * together to cross check against the bit that we have yet to\n\t * define (probably in the SACK). When the cum-ack is updated, this\n\t * sum is updated as well.\n\t */\n\n\t/* Flag to tell if ECN is allowed */\n\tuint8_t ecn_allowed;\n\n\t/* flag to indicate if peer can do asconf */\n\tuint8_t peer_supports_asconf;\n\t/* EY - flag to indicate if peer can do nr_sack */\n\tuint8_t peer_supports_nr_sack;\n\t/* pr-sctp support flag */\n\tuint8_t peer_supports_prsctp;\n\t/* peer authentication support flag */\n\tuint8_t peer_supports_auth;\n\t/* stream resets are supported by the peer */\n\tuint8_t peer_supports_strreset;\n\n\tuint8_t peer_supports_nat;\n\t/*\n\t * packet drop's are supported by the peer, we don't really care\n\t * about this but we bookkeep it anyway.\n\t */\n\tuint8_t peer_supports_pktdrop;\n\n\t/* Do we allow V6/V4? */\n\tuint8_t ipv4_addr_legal;\n\tuint8_t ipv6_addr_legal;\n\t/* Address scoping flags */\n\t/* scope value for IPv4 */\n\tuint8_t ipv4_local_scope;\n\t/* scope values for IPv6 */\n\tuint8_t local_scope;\n\tuint8_t site_scope;\n\t/* loopback scope */\n\tuint8_t loopback_scope;\n\t/* flags to handle send alternate net tracking */\n\tuint8_t used_alt_onsack;\n\tuint8_t used_alt_asconfack;\n\tuint8_t fast_retran_loss_recovery;\n\tuint8_t sat_t3_loss_recovery;\n\tuint8_t dropped_special_cnt;\n\tuint8_t seen_a_sack_this_pkt;\n\tuint8_t stream_reset_outstanding;\n\tuint8_t stream_reset_out_is_outstanding;\n\tuint8_t delayed_connection;\n\tuint8_t ifp_had_enobuf;\n\tuint8_t saw_sack_with_frags;\n\tuint8_t saw_sack_with_nr_frags;\n\tuint8_t in_asocid_hash;\n\tuint8_t assoc_up_sent;\n\tuint8_t adaptation_needed;\n\tuint8_t adaptation_sent;\n\t/* CMT variables */\n\tuint8_t cmt_dac_pkts_rcvd;\n\tuint8_t sctp_cmt_on_off;\n\tuint8_t iam_blocking;\n\tuint8_t cookie_how[8];\n\t/* EY 05/05/08 - NR_SACK variable */\n\tuint8_t sctp_nr_sack_on_off;\n\t/* JRS 5/21/07 - CMT PF variable */\n\tuint8_t sctp_cmt_pf;\n\tuint8_t use_precise_time;\n\tuint32_t sctp_features;\n\t/*\n\t * The mapping array is used to track out of order sequences above\n\t * last_acked_seq. 0 indicates packet missing 1 indicates packet\n\t * rec'd. We slide it up every time we raise last_acked_seq and 0\n\t * trailing locactions out.  If I get a TSN above the array\n\t * mappingArraySz, I discard the datagram and let retransmit happen.\n\t */\n\tuint32_t marked_retrans;\n\tuint32_t timoinit;\n\tuint32_t timodata;\n\tuint32_t timosack;\n\tuint32_t timoshutdown;\n\tuint32_t timoheartbeat;\n\tuint32_t timocookie;\n\tuint32_t timoshutdownack;\n\tstruct timeval start_time;\n\tstruct timeval discontinuity_time;\n};\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/netinet/sctp_sysctl.h",
    "content": "/*-\n * Copyright (c) 2007, by Cisco Systems, Inc. All rights reserved.\n * Copyright (c) 2008-2011, by Randall Stewart. All rights reserved.\n * Copyright (c) 2008-2011, by Michael Tuexen. All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions are met:\n *\n * a) Redistributions of source code must retain the above copyright notice,\n *   this list of conditions and the following disclaimer.\n *\n * b) Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in\n *   the documentation and/or other materials provided with the distribution.\n *\n * c) Neither the name of Cisco Systems, Inc. nor the names of its\n *    contributors may be used to endorse or promote products derived\n *    from this software without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n * \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,\n * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE\n * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\n * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\n * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\n * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\n * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF\n * THE POSSIBILITY OF SUCH DAMAGE.\n */\n\n#include <sys/cdefs.h>\n__FBSDID(\"$FreeBSD: release/9.0.0/sys/netinet/sctp_sysctl.h 224641 2011-08-03 20:21:00Z tuexen $\");\n\n#ifndef __sctp_sysctl_h__\n#define __sctp_sysctl_h__\n\n#include <netinet/sctp_os.h>\n#include <netinet/sctp_constants.h>\n\nstruct sctp_sysctl {\n\tuint32_t sctp_sendspace;\n\tuint32_t sctp_recvspace;\n\tuint32_t sctp_auto_asconf;\n\tuint32_t sctp_multiple_asconfs;\n\tuint32_t sctp_ecn_enable;\n\tuint32_t sctp_fr_max_burst_default;\n\tuint32_t sctp_strict_sacks;\n#if !defined(SCTP_WITH_NO_CSUM)\n\tuint32_t sctp_no_csum_on_loopback;\n#endif\n\tuint32_t sctp_strict_init;\n\tuint32_t sctp_peer_chunk_oh;\n\tuint32_t sctp_max_burst_default;\n\tuint32_t sctp_max_chunks_on_queue;\n\tuint32_t sctp_hashtblsize;\n\tuint32_t sctp_pcbtblsize;\n\tuint32_t sctp_min_split_point;\n\tuint32_t sctp_chunkscale;\n\tuint32_t sctp_delayed_sack_time_default;\n\tuint32_t sctp_sack_freq_default;\n\tuint32_t sctp_system_free_resc_limit;\n\tuint32_t sctp_asoc_free_resc_limit;\n\tuint32_t sctp_heartbeat_interval_default;\n\tuint32_t sctp_pmtu_raise_time_default;\n\tuint32_t sctp_shutdown_guard_time_default;\n\tuint32_t sctp_secret_lifetime_default;\n\tuint32_t sctp_rto_max_default;\n\tuint32_t sctp_rto_min_default;\n\tuint32_t sctp_rto_initial_default;\n\tuint32_t sctp_init_rto_max_default;\n\tuint32_t sctp_valid_cookie_life_default;\n\tuint32_t sctp_init_rtx_max_default;\n\tuint32_t sctp_assoc_rtx_max_default;\n\tuint32_t sctp_path_rtx_max_default;\n\tuint32_t sctp_path_pf_threshold;\n\tuint32_t sctp_add_more_threshold;\n\tuint32_t sctp_nr_outgoing_streams_default;\n\tuint32_t sctp_cmt_on_off;\n\tuint32_t sctp_cmt_use_dac;\n\t/* EY 5/5/08 - nr_sack flag variable */\n\tuint32_t sctp_nr_sack_on_off;\n\tuint32_t sctp_use_cwnd_based_maxburst;\n\tuint32_t sctp_asconf_auth_nochk;\n\tuint32_t sctp_auth_disable;\n\tuint32_t sctp_nat_friendly;\n\tuint32_t sctp_L2_abc_variable;\n\tuint32_t sctp_mbuf_threshold_count;\n\tuint32_t sctp_do_drain;\n\tuint32_t sctp_hb_maxburst;\n\tuint32_t sctp_abort_if_one_2_one_hits_limit;\n\tuint32_t sctp_strict_data_order;\n\tuint32_t sctp_min_residual;\n\tuint32_t sctp_max_retran_chunk;\n\tuint32_t sctp_logging_level;\n\t/* JRS - Variable for default congestion control module */\n\tuint32_t sctp_default_cc_module;\n\t/* RS - Variable for default stream scheduling module */\n\tuint32_t sctp_default_ss_module;\n\tuint32_t sctp_default_frag_interleave;\n\tuint32_t sctp_mobility_base;\n\tuint32_t sctp_mobility_fasthandoff;\n\tuint32_t sctp_inits_include_nat_friendly;\n\tuint32_t sctp_rttvar_bw;\n\tuint32_t sctp_rttvar_rtt;\n\tuint32_t sctp_rttvar_eqret;\n\tuint32_t sctp_steady_step;\n\tuint32_t sctp_use_dccc_ecn;\n#if defined(SCTP_LOCAL_TRACE_BUF)\n\tstruct sctp_log sctp_log;\n#endif\n\tuint32_t sctp_udp_tunneling_for_client_enable;\n\tuint32_t sctp_udp_tunneling_port;\n\tuint32_t sctp_enable_sack_immediately;\n\tuint32_t sctp_vtag_time_wait;\n\tuint32_t sctp_buffer_splitting;\n\tuint32_t sctp_initial_cwnd;\n#if defined(SCTP_DEBUG)\n\tuint32_t sctp_debug_on;\n#endif\n#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING)\n\tuint32_t sctp_output_unlocked;\n#endif\n};\n\n/*\n * limits for the sysctl variables\n */\n/* maxdgram: Maximum outgoing SCTP buffer size */\n#define SCTPCTL_MAXDGRAM_DESC\t\t\"Maximum outgoing SCTP buffer size\"\n#define SCTPCTL_MAXDGRAM_MIN\t\t0\n#define SCTPCTL_MAXDGRAM_MAX\t\t0xFFFFFFFF\n#define SCTPCTL_MAXDGRAM_DEFAULT\t262144\t/* 256k */\n\n/* recvspace: Maximum incoming SCTP buffer size */\n#define SCTPCTL_RECVSPACE_DESC\t\t\"Maximum incoming SCTP buffer size\"\n#define SCTPCTL_RECVSPACE_MIN\t\t0\n#define SCTPCTL_RECVSPACE_MAX\t\t0xFFFFFFFF\n#define SCTPCTL_RECVSPACE_DEFAULT\t262144\t/* 256k */\n\n/* autoasconf: Enable SCTP Auto-ASCONF */\n#define SCTPCTL_AUTOASCONF_DESC\t\t\"Enable SCTP Auto-ASCONF\"\n#define SCTPCTL_AUTOASCONF_MIN\t\t0\n#define SCTPCTL_AUTOASCONF_MAX\t\t1\n#define SCTPCTL_AUTOASCONF_DEFAULT\tSCTP_DEFAULT_AUTO_ASCONF\n\n/* autoasconf: Enable SCTP Auto-ASCONF */\n#define SCTPCTL_MULTIPLEASCONFS_DESC\t\"Enable SCTP Muliple-ASCONFs\"\n#define SCTPCTL_MULTIPLEASCONFS_MIN\t0\n#define SCTPCTL_MULTIPLEASCONFS_MAX\t1\n#define SCTPCTL_MULTIPLEASCONFS_DEFAULT\tSCTP_DEFAULT_MULTIPLE_ASCONFS\n\n/* ecn_enable: Enable SCTP ECN */\n#define SCTPCTL_ECN_ENABLE_DESC\t\t\"Enable SCTP ECN\"\n#define SCTPCTL_ECN_ENABLE_MIN\t\t0\n#define SCTPCTL_ECN_ENABLE_MAX\t\t1\n#define SCTPCTL_ECN_ENABLE_DEFAULT\t1\n\n/* strict_sacks: Enable SCTP Strict SACK checking */\n#define SCTPCTL_STRICT_SACKS_DESC\t\"Enable SCTP Strict SACK checking\"\n#define SCTPCTL_STRICT_SACKS_MIN\t0\n#define SCTPCTL_STRICT_SACKS_MAX\t1\n#define SCTPCTL_STRICT_SACKS_DEFAULT\t1\n\n/* loopback_nocsum: Enable NO Csum on packets sent on loopback */\n#define SCTPCTL_LOOPBACK_NOCSUM_DESC\t\"Enable NO Csum on packets sent on loopback\"\n#define SCTPCTL_LOOPBACK_NOCSUM_MIN\t0\n#define SCTPCTL_LOOPBACK_NOCSUM_MAX\t1\n#define SCTPCTL_LOOPBACK_NOCSUM_DEFAULT\t1\n\n/* strict_init: Enable strict INIT/INIT-ACK singleton enforcement */\n#define SCTPCTL_STRICT_INIT_DESC\t\"Enable strict INIT/INIT-ACK singleton enforcement\"\n#define SCTPCTL_STRICT_INIT_MIN\t\t0\n#define SCTPCTL_STRICT_INIT_MAX\t\t1\n#define SCTPCTL_STRICT_INIT_DEFAULT\t1\n\n/* peer_chkoh: Amount to debit peers rwnd per chunk sent */\n#define SCTPCTL_PEER_CHKOH_DESC\t\t\"Amount to debit peers rwnd per chunk sent\"\n#define SCTPCTL_PEER_CHKOH_MIN\t\t0\n#define SCTPCTL_PEER_CHKOH_MAX\t\t0xFFFFFFFF\n#define SCTPCTL_PEER_CHKOH_DEFAULT\t256\n\n/* maxburst: Default max burst for sctp endpoints */\n#define SCTPCTL_MAXBURST_DESC\t\t\"Default max burst for sctp endpoints\"\n#define SCTPCTL_MAXBURST_MIN\t\t0\n#define SCTPCTL_MAXBURST_MAX\t\t0xFFFFFFFF\n#define SCTPCTL_MAXBURST_DEFAULT\tSCTP_DEF_MAX_BURST\n\n/* fr_maxburst: Default max burst for sctp endpoints when fast retransmitting */\n#define SCTPCTL_FRMAXBURST_DESC\t\t\"Default fr max burst for sctp endpoints\"\n#define SCTPCTL_FRMAXBURST_MIN\t\t0\n#define SCTPCTL_FRMAXBURST_MAX\t\t0xFFFFFFFF\n#define SCTPCTL_FRMAXBURST_DEFAULT\tSCTP_DEF_FRMAX_BURST\n\n\n/* maxchunks: Default max chunks on queue per asoc */\n#define SCTPCTL_MAXCHUNKS_DESC\t\t\"Default max chunks on queue per asoc\"\n#define SCTPCTL_MAXCHUNKS_MIN\t\t0\n#define SCTPCTL_MAXCHUNKS_MAX\t\t0xFFFFFFFF\n#define SCTPCTL_MAXCHUNKS_DEFAULT\tSCTP_ASOC_MAX_CHUNKS_ON_QUEUE\n\n/* tcbhashsize: Tunable for Hash table sizes */\n#define SCTPCTL_TCBHASHSIZE_DESC\t\"Tunable for TCB hash table sizes\"\n#define SCTPCTL_TCBHASHSIZE_MIN\t\t1\n#define SCTPCTL_TCBHASHSIZE_MAX\t\t0xFFFFFFFF\n#define SCTPCTL_TCBHASHSIZE_DEFAULT\tSCTP_TCBHASHSIZE\n\n/* pcbhashsize: Tunable for PCB Hash table sizes */\n#define SCTPCTL_PCBHASHSIZE_DESC\t\"Tunable for PCB hash table sizes\"\n#define SCTPCTL_PCBHASHSIZE_MIN\t\t1\n#define SCTPCTL_PCBHASHSIZE_MAX\t\t0xFFFFFFFF\n#define SCTPCTL_PCBHASHSIZE_DEFAULT\tSCTP_PCBHASHSIZE\n\n/* min_split_point: Minimum size when splitting a chunk */\n#define SCTPCTL_MIN_SPLIT_POINT_DESC\t\"Minimum size when splitting a chunk\"\n#define SCTPCTL_MIN_SPLIT_POINT_MIN\t0\n#define SCTPCTL_MIN_SPLIT_POINT_MAX\t0xFFFFFFFF\n#define SCTPCTL_MIN_SPLIT_POINT_DEFAULT\tSCTP_DEFAULT_SPLIT_POINT_MIN\n\n/* chunkscale: Tunable for Scaling of number of chunks and messages */\n#define SCTPCTL_CHUNKSCALE_DESC\t\t\"Tunable for Scaling of number of chunks and messages\"\n#define SCTPCTL_CHUNKSCALE_MIN\t\t1\n#define SCTPCTL_CHUNKSCALE_MAX\t\t0xFFFFFFFF\n#define SCTPCTL_CHUNKSCALE_DEFAULT\tSCTP_CHUNKQUEUE_SCALE\n\n/* delayed_sack_time: Default delayed SACK timer in ms */\n#define SCTPCTL_DELAYED_SACK_TIME_DESC\t\"Default delayed SACK timer in ms\"\n#define SCTPCTL_DELAYED_SACK_TIME_MIN\t0\n#define SCTPCTL_DELAYED_SACK_TIME_MAX\t0xFFFFFFFF\n#define SCTPCTL_DELAYED_SACK_TIME_DEFAULT\tSCTP_RECV_MSEC\n\n/* sack_freq: Default SACK frequency */\n#define SCTPCTL_SACK_FREQ_DESC\t\t\"Default SACK frequency\"\n#define SCTPCTL_SACK_FREQ_MIN\t\t0\n#define SCTPCTL_SACK_FREQ_MAX\t\t0xFFFFFFFF\n#define SCTPCTL_SACK_FREQ_DEFAULT\tSCTP_DEFAULT_SACK_FREQ\n\n/* sys_resource: Max number of cached resources in the system */\n#define SCTPCTL_SYS_RESOURCE_DESC\t\"Max number of cached resources in the system\"\n#define SCTPCTL_SYS_RESOURCE_MIN\t0\n#define SCTPCTL_SYS_RESOURCE_MAX\t0xFFFFFFFF\n#define SCTPCTL_SYS_RESOURCE_DEFAULT\tSCTP_DEF_SYSTEM_RESC_LIMIT\n\n/* asoc_resource: Max number of cached resources in an asoc */\n#define SCTPCTL_ASOC_RESOURCE_DESC\t\"Max number of cached resources in an asoc\"\n#define SCTPCTL_ASOC_RESOURCE_MIN\t0\n#define SCTPCTL_ASOC_RESOURCE_MAX\t0xFFFFFFFF\n#define SCTPCTL_ASOC_RESOURCE_DEFAULT\tSCTP_DEF_ASOC_RESC_LIMIT\n\n/* heartbeat_interval: Default heartbeat interval in ms */\n#define SCTPCTL_HEARTBEAT_INTERVAL_DESC\t\"Default heartbeat interval in ms\"\n#define SCTPCTL_HEARTBEAT_INTERVAL_MIN\t0\n#define SCTPCTL_HEARTBEAT_INTERVAL_MAX\t0xFFFFFFFF\n#define SCTPCTL_HEARTBEAT_INTERVAL_DEFAULT\tSCTP_HB_DEFAULT_MSEC\n\n/* pmtu_raise_time: Default PMTU raise timer in seconds */\n#define SCTPCTL_PMTU_RAISE_TIME_DESC\t\"Default PMTU raise timer in seconds\"\n#define SCTPCTL_PMTU_RAISE_TIME_MIN\t0\n#define SCTPCTL_PMTU_RAISE_TIME_MAX\t0xFFFFFFFF\n#define SCTPCTL_PMTU_RAISE_TIME_DEFAULT\tSCTP_DEF_PMTU_RAISE_SEC\n\n/* shutdown_guard_time: Default shutdown guard timer in seconds */\n#define SCTPCTL_SHUTDOWN_GUARD_TIME_DESC\t\"Default shutdown guard timer in seconds\"\n#define SCTPCTL_SHUTDOWN_GUARD_TIME_MIN\t\t0\n#define SCTPCTL_SHUTDOWN_GUARD_TIME_MAX\t\t0xFFFFFFFF\n#define SCTPCTL_SHUTDOWN_GUARD_TIME_DEFAULT\tSCTP_DEF_MAX_SHUTDOWN_SEC\n\n/* secret_lifetime: Default secret lifetime in seconds */\n#define SCTPCTL_SECRET_LIFETIME_DESC\t\"Default secret lifetime in seconds\"\n#define SCTPCTL_SECRET_LIFETIME_MIN\t0\n#define SCTPCTL_SECRET_LIFETIME_MAX\t0xFFFFFFFF\n#define SCTPCTL_SECRET_LIFETIME_DEFAULT\tSCTP_DEFAULT_SECRET_LIFE_SEC\n\n/* rto_max: Default maximum retransmission timeout in ms */\n#define SCTPCTL_RTO_MAX_DESC\t\t\"Default maximum retransmission timeout in ms\"\n#define SCTPCTL_RTO_MAX_MIN\t\t0\n#define SCTPCTL_RTO_MAX_MAX\t\t0xFFFFFFFF\n#define SCTPCTL_RTO_MAX_DEFAULT\t\tSCTP_RTO_UPPER_BOUND\n\n/* rto_min: Default minimum retransmission timeout in ms */\n#define SCTPCTL_RTO_MIN_DESC\t\t\"Default minimum retransmission timeout in ms\"\n#define SCTPCTL_RTO_MIN_MIN\t\t0\n#define SCTPCTL_RTO_MIN_MAX\t\t0xFFFFFFFF\n#define SCTPCTL_RTO_MIN_DEFAULT\t\tSCTP_RTO_LOWER_BOUND\n\n/* rto_initial: Default initial retransmission timeout in ms */\n#define SCTPCTL_RTO_INITIAL_DESC\t\"Default initial retransmission timeout in ms\"\n#define SCTPCTL_RTO_INITIAL_MIN\t\t0\n#define SCTPCTL_RTO_INITIAL_MAX\t\t0xFFFFFFFF\n#define SCTPCTL_RTO_INITIAL_DEFAULT\tSCTP_RTO_INITIAL\n\n/* init_rto_max: Default maximum retransmission timeout during association setup in ms */\n#define SCTPCTL_INIT_RTO_MAX_DESC\t\"Default maximum retransmission timeout during association setup in ms\"\n#define SCTPCTL_INIT_RTO_MAX_MIN\t0\n#define SCTPCTL_INIT_RTO_MAX_MAX\t0xFFFFFFFF\n#define SCTPCTL_INIT_RTO_MAX_DEFAULT\tSCTP_RTO_UPPER_BOUND\n\n/* valid_cookie_life: Default cookie lifetime in sec */\n#define SCTPCTL_VALID_COOKIE_LIFE_DESC\t\"Default cookie lifetime in seconds\"\n#define SCTPCTL_VALID_COOKIE_LIFE_MIN\t0\n#define SCTPCTL_VALID_COOKIE_LIFE_MAX\t0xFFFFFFFF\n#define SCTPCTL_VALID_COOKIE_LIFE_DEFAULT\tSCTP_DEFAULT_COOKIE_LIFE\n\n/* init_rtx_max: Default maximum number of retransmission for INIT chunks */\n#define SCTPCTL_INIT_RTX_MAX_DESC\t\"Default maximum number of retransmission for INIT chunks\"\n#define SCTPCTL_INIT_RTX_MAX_MIN\t0\n#define SCTPCTL_INIT_RTX_MAX_MAX\t0xFFFFFFFF\n#define SCTPCTL_INIT_RTX_MAX_DEFAULT\tSCTP_DEF_MAX_INIT\n\n/* assoc_rtx_max: Default maximum number of retransmissions per association */\n#define SCTPCTL_ASSOC_RTX_MAX_DESC\t\"Default maximum number of retransmissions per association\"\n#define SCTPCTL_ASSOC_RTX_MAX_MIN\t0\n#define SCTPCTL_ASSOC_RTX_MAX_MAX\t0xFFFFFFFF\n#define SCTPCTL_ASSOC_RTX_MAX_DEFAULT\tSCTP_DEF_MAX_SEND\n\n/* path_rtx_max: Default maximum of retransmissions per path */\n#define SCTPCTL_PATH_RTX_MAX_DESC\t\"Default maximum of retransmissions per path\"\n#define SCTPCTL_PATH_RTX_MAX_MIN\t0\n#define SCTPCTL_PATH_RTX_MAX_MAX\t0xFFFFFFFF\n#define SCTPCTL_PATH_RTX_MAX_DEFAULT\tSCTP_DEF_MAX_PATH_RTX\n\n/* path_pf_threshold: threshold for considering the path potentially failed */\n#define SCTPCTL_PATH_PF_THRESHOLD_DESC\t\t\"Default potentially failed threshold\"\n#define SCTPCTL_PATH_PF_THRESHOLD_MIN\t\t0\n#define SCTPCTL_PATH_PF_THRESHOLD_MAX\t\t0xFFFF\n#define SCTPCTL_PATH_PF_THRESHOLD_DEFAULT\tSCTPCTL_PATH_PF_THRESHOLD_MAX\n\n/* add_more_on_output: When space-wise is it worthwhile to try to add more to a socket send buffer */\n#define SCTPCTL_ADD_MORE_ON_OUTPUT_DESC\t\"When space-wise is it worthwhile to try to add more to a socket send buffer\"\n#define SCTPCTL_ADD_MORE_ON_OUTPUT_MIN\t0\n#define SCTPCTL_ADD_MORE_ON_OUTPUT_MAX\t0xFFFFFFFF\n#define SCTPCTL_ADD_MORE_ON_OUTPUT_DEFAULT SCTP_DEFAULT_ADD_MORE\n\n/* outgoing_streams: Default number of outgoing streams */\n#define SCTPCTL_OUTGOING_STREAMS_DESC\t\"Default number of outgoing streams\"\n#define SCTPCTL_OUTGOING_STREAMS_MIN\t1\n#define SCTPCTL_OUTGOING_STREAMS_MAX\t65535\n#define SCTPCTL_OUTGOING_STREAMS_DEFAULT SCTP_OSTREAM_INITIAL\n\n/* cmt_on_off: CMT on/off flag */\n#define SCTPCTL_CMT_ON_OFF_DESC\t\t\"CMT settings\"\n#define SCTPCTL_CMT_ON_OFF_MIN\t\tSCTP_CMT_OFF\n#define SCTPCTL_CMT_ON_OFF_MAX\t\tSCTP_CMT_MAX\n#define SCTPCTL_CMT_ON_OFF_DEFAULT\tSCTP_CMT_OFF\n\n/* EY - nr_sack_on_off: NR_SACK on/off flag */\n#define SCTPCTL_NR_SACK_ON_OFF_DESC\t\"NR_SACK on/off flag\"\n#define SCTPCTL_NR_SACK_ON_OFF_MIN\t0\n#define SCTPCTL_NR_SACK_ON_OFF_MAX\t1\n#define SCTPCTL_NR_SACK_ON_OFF_DEFAULT\t0\n\n/* cmt_use_dac: CMT DAC on/off flag */\n#define SCTPCTL_CMT_USE_DAC_DESC\t\"CMT DAC on/off flag\"\n#define SCTPCTL_CMT_USE_DAC_MIN\t\t0\n#define SCTPCTL_CMT_USE_DAC_MAX\t\t1\n#define SCTPCTL_CMT_USE_DAC_DEFAULT    \t0\n\n/* cwnd_maxburst: Use a CWND adjusting maxburst */\n#define SCTPCTL_CWND_MAXBURST_DESC\t\"Use a CWND adjusting maxburst\"\n#define SCTPCTL_CWND_MAXBURST_MIN\t0\n#define SCTPCTL_CWND_MAXBURST_MAX\t1\n#define SCTPCTL_CWND_MAXBURST_DEFAULT\t1\n\n/* asconf_auth_nochk: Disable SCTP ASCONF AUTH requirement */\n#define SCTPCTL_ASCONF_AUTH_NOCHK_DESC\t\"Disable SCTP ASCONF AUTH requirement\"\n#define SCTPCTL_ASCONF_AUTH_NOCHK_MIN\t0\n#define SCTPCTL_ASCONF_AUTH_NOCHK_MAX\t1\n#define SCTPCTL_ASCONF_AUTH_NOCHK_DEFAULT\t0\n\n/* auth_disable: Disable SCTP AUTH function */\n#define SCTPCTL_AUTH_DISABLE_DESC\t\"Disable SCTP AUTH function\"\n#define SCTPCTL_AUTH_DISABLE_MIN\t0\n#define SCTPCTL_AUTH_DISABLE_MAX\t1\n#define SCTPCTL_AUTH_DISABLE_DEFAULT\t0\n\n/* nat_friendly: SCTP NAT friendly operation */\n#define SCTPCTL_NAT_FRIENDLY_DESC\t\"SCTP NAT friendly operation\"\n#define SCTPCTL_NAT_FRIENDLY_MIN\t0\n#define SCTPCTL_NAT_FRIENDLY_MAX\t1\n#define SCTPCTL_NAT_FRIENDLY_DEFAULT\t1\n\n/* abc_l_var: SCTP ABC max increase per SACK (L) */\n#define SCTPCTL_ABC_L_VAR_DESC\t\t\"SCTP ABC max increase per SACK (L)\"\n#define SCTPCTL_ABC_L_VAR_MIN\t\t0\n#define SCTPCTL_ABC_L_VAR_MAX\t\t0xFFFFFFFF\n#define SCTPCTL_ABC_L_VAR_DEFAULT\t1\n\n/* max_chained_mbufs: Default max number of small mbufs on a chain */\n#define SCTPCTL_MAX_CHAINED_MBUFS_DESC\t\"Default max number of small mbufs on a chain\"\n#define SCTPCTL_MAX_CHAINED_MBUFS_MIN\t0\n#define SCTPCTL_MAX_CHAINED_MBUFS_MAX\t0xFFFFFFFF\n#define SCTPCTL_MAX_CHAINED_MBUFS_DEFAULT\tSCTP_DEFAULT_MBUFS_IN_CHAIN\n\n/* do_sctp_drain: Should SCTP respond to the drain calls */\n#define SCTPCTL_DO_SCTP_DRAIN_DESC\t\"Should SCTP respond to the drain calls\"\n#define SCTPCTL_DO_SCTP_DRAIN_MIN\t0\n#define SCTPCTL_DO_SCTP_DRAIN_MAX\t1\n#define SCTPCTL_DO_SCTP_DRAIN_DEFAULT\t1\n\n/* hb_max_burst: Confirmation Heartbeat max burst? */\n#define SCTPCTL_HB_MAX_BURST_DESC\t\"Confirmation Heartbeat max burst\"\n#define SCTPCTL_HB_MAX_BURST_MIN\t1\n#define SCTPCTL_HB_MAX_BURST_MAX\t0xFFFFFFFF\n#define SCTPCTL_HB_MAX_BURST_DEFAULT\tSCTP_DEF_HBMAX_BURST\n\n/* abort_at_limit: When one-2-one hits qlimit abort */\n#define SCTPCTL_ABORT_AT_LIMIT_DESC\t\"When one-2-one hits qlimit abort\"\n#define SCTPCTL_ABORT_AT_LIMIT_MIN\t0\n#define SCTPCTL_ABORT_AT_LIMIT_MAX\t1\n#define SCTPCTL_ABORT_AT_LIMIT_DEFAULT\t0\n\n/* strict_data_order: Enforce strict data ordering, abort if control inside data */\n#define SCTPCTL_STRICT_DATA_ORDER_DESC\t\"Enforce strict data ordering, abort if control inside data\"\n#define SCTPCTL_STRICT_DATA_ORDER_MIN\t0\n#define SCTPCTL_STRICT_DATA_ORDER_MAX\t1\n#define SCTPCTL_STRICT_DATA_ORDER_DEFAULT\t0\n\n/* min_residual: min residual in a data fragment leftover */\n#define SCTPCTL_MIN_RESIDUAL_DESC\t\"Minimum residual data chunk in second part of split\"\n#define SCTPCTL_MIN_RESIDUAL_MIN\t20\n#define SCTPCTL_MIN_RESIDUAL_MAX\t65535\n#define SCTPCTL_MIN_RESIDUAL_DEFAULT\t1452\n\n/* max_retran_chunk: max chunk retransmissions */\n#define SCTPCTL_MAX_RETRAN_CHUNK_DESC\t\"Maximum times an unlucky chunk can be retran'd before assoc abort\"\n#define SCTPCTL_MAX_RETRAN_CHUNK_MIN\t0\n#define SCTPCTL_MAX_RETRAN_CHUNK_MAX\t65535\n#define SCTPCTL_MAX_RETRAN_CHUNK_DEFAULT\t30\n\n/* sctp_logging: This gives us logging when the options are enabled */\n#define SCTPCTL_LOGGING_LEVEL_DESC\t\"Ltrace/KTR trace logging level\"\n#define SCTPCTL_LOGGING_LEVEL_MIN\t0\n#define SCTPCTL_LOGGING_LEVEL_MAX\t0xffffffff\n#define SCTPCTL_LOGGING_LEVEL_DEFAULT\t0\n\n/* JRS - default congestion control module sysctl */\n#define SCTPCTL_DEFAULT_CC_MODULE_DESC\t\t\"Default congestion control module\"\n#define SCTPCTL_DEFAULT_CC_MODULE_MIN\t\t0\n#define SCTPCTL_DEFAULT_CC_MODULE_MAX\t\t2\n#define SCTPCTL_DEFAULT_CC_MODULE_DEFAULT\t0\n\n/* RS - default stream scheduling module sysctl */\n#define SCTPCTL_DEFAULT_SS_MODULE_DESC\t\t\"Default stream scheduling module\"\n#define SCTPCTL_DEFAULT_SS_MODULE_MIN\t\t0\n#define SCTPCTL_DEFAULT_SS_MODULE_MAX\t\t5\n#define SCTPCTL_DEFAULT_SS_MODULE_DEFAULT\t0\n\n/* RRS - default fragment interleave */\n#define SCTPCTL_DEFAULT_FRAG_INTERLEAVE_DESC\t\"Default fragment interleave level\"\n#define SCTPCTL_DEFAULT_FRAG_INTERLEAVE_MIN\t0\n#define SCTPCTL_DEFAULT_FRAG_INTERLEAVE_MAX\t2\n#define SCTPCTL_DEFAULT_FRAG_INTERLEAVE_DEFAULT\t1\n\n/* mobility_base: Enable SCTP mobility support */\n#define SCTPCTL_MOBILITY_BASE_DESC\t\"Enable SCTP base mobility\"\n#define SCTPCTL_MOBILITY_BASE_MIN\t0\n#define SCTPCTL_MOBILITY_BASE_MAX\t1\n#define SCTPCTL_MOBILITY_BASE_DEFAULT\tSCTP_DEFAULT_MOBILITY_BASE\n\n/* mobility_fasthandoff: Enable SCTP fast handoff support */\n#define SCTPCTL_MOBILITY_FASTHANDOFF_DESC\t\"Enable SCTP fast handoff\"\n#define SCTPCTL_MOBILITY_FASTHANDOFF_MIN\t0\n#define SCTPCTL_MOBILITY_FASTHANDOFF_MAX\t1\n#define SCTPCTL_MOBILITY_FASTHANDOFF_DEFAULT\tSCTP_DEFAULT_MOBILITY_FASTHANDOFF\n\n/* Enable SCTP/UDP tunneling for clients*/\n#define SCTPCTL_UDP_TUNNELING_FOR_CLIENT_ENABLE_DESC\t\"Enable SCTP/UDP tunneling for client\"\n#define SCTPCTL_UDP_TUNNELING_FOR_CLIENT_ENABLE_MIN\t0\n#define SCTPCTL_UDP_TUNNELING_FOR_CLIENT_ENABLE_MAX\t1\n#define SCTPCTL_UDP_TUNNELING_FOR_CLIENT_ENABLE_DEFAULT\tSCTPCTL_UDP_TUNNELING_FOR_CLIENT_ENABLE_MIN\n\n/* Enable SCTP/UDP tunneling port */\n#define SCTPCTL_UDP_TUNNELING_PORT_DESC\t\t\"Set the SCTP/UDP tunneling port\"\n#define SCTPCTL_UDP_TUNNELING_PORT_MIN\t\t0\n#define SCTPCTL_UDP_TUNNELING_PORT_MAX\t\t65535\n#define SCTPCTL_UDP_TUNNELING_PORT_DEFAULT\tSCTP_OVER_UDP_TUNNELING_PORT\n\n/* Enable sending of the SACK-IMMEDIATELY bit */\n#define SCTPCTL_SACK_IMMEDIATELY_ENABLE_DESC\t\"Enable sending of the SACK-IMMEDIATELY-bit.\"\n#define SCTPCTL_SACK_IMMEDIATELY_ENABLE_MIN\t0\n#define SCTPCTL_SACK_IMMEDIATELY_ENABLE_MAX\t1\n#define SCTPCTL_SACK_IMMEDIATELY_ENABLE_DEFAULT\tSCTPCTL_SACK_IMMEDIATELY_ENABLE_MIN\n\n/* Enable sending of the NAT-FRIENDLY message */\n#define SCTPCTL_NAT_FRIENDLY_INITS_DESC\t\"Enable sending of the nat-friendly SCTP option on INITs.\"\n#define SCTPCTL_NAT_FRIENDLY_INITS_MIN\t0\n#define SCTPCTL_NAT_FRIENDLY_INITS_MAX\t1\n#define SCTPCTL_NAT_FRIENDLY_INITS_DEFAULT\tSCTPCTL_NAT_FRIENDLY_INITS_MIN\n\n/* Vtag time wait in seconds */\n#define SCTPCTL_TIME_WAIT_DESC\t\"Vtag time wait time in seconds, 0 disables it.\"\n#define SCTPCTL_TIME_WAIT_MIN\t0\n#define SCTPCTL_TIME_WAIT_MAX\t0xffffffff\n#define SCTPCTL_TIME_WAIT_DEFAULT\tSCTP_TIME_WAIT\n\n/* Enable Send/Receive buffer splitting */\n#define SCTPCTL_BUFFER_SPLITTING_DESC\t\t\"Enable send/receive buffer splitting.\"\n#define SCTPCTL_BUFFER_SPLITTING_MIN\t\t0\n#define SCTPCTL_BUFFER_SPLITTING_MAX\t\t0x3\n#define SCTPCTL_BUFFER_SPLITTING_DEFAULT\tSCTPCTL_BUFFER_SPLITTING_MIN\n\n/* Initial congestion window in MTU */\n#define SCTPCTL_INITIAL_CWND_DESC\t\"Initial congestion window in MTUs\"\n#define SCTPCTL_INITIAL_CWND_MIN\t0\n#define SCTPCTL_INITIAL_CWND_MAX\t0xffffffff\n#define SCTPCTL_INITIAL_CWND_DEFAULT\t3\n\n/* rttvar smooth avg for bw calc  */\n#define SCTPCTL_RTTVAR_BW_DESC\t\"Shift amount for bw smoothing on rtt calc\"\n#define SCTPCTL_RTTVAR_BW_MIN\t0\n#define SCTPCTL_RTTVAR_BW_MAX\t32\n#define SCTPCTL_RTTVAR_BW_DEFAULT\t4\n\n/* rttvar smooth avg for bw calc  */\n#define SCTPCTL_RTTVAR_RTT_DESC\t\"Shift amount for rtt smoothing on rtt calc\"\n#define SCTPCTL_RTTVAR_RTT_MIN\t0\n#define SCTPCTL_RTTVAR_RTT_MAX\t32\n#define SCTPCTL_RTTVAR_RTT_DEFAULT\t5\n\n#define SCTPCTL_RTTVAR_EQRET_DESC\t\"What to return when rtt and bw are unchanged\"\n#define SCTPCTL_RTTVAR_EQRET_MIN\t0\n#define SCTPCTL_RTTVAR_EQRET_MAX\t1\n#define SCTPCTL_RTTVAR_EQRET_DEFAULT\t0\n\n#define SCTPCTL_RTTVAR_STEADYS_DESC\t\"How many the sames it takes to try step down of cwnd\"\n#define SCTPCTL_RTTVAR_STEADYS_MIN\t0\n#define SCTPCTL_RTTVAR_STEADYS_MAX\t0xFFFF\n#define SCTPCTL_RTTVAR_STEADYS_DEFAULT\t20\t/* 0 means disable feature */\n\n#define SCTPCTL_RTTVAR_DCCCECN_DESC\t\"Enable for RTCC CC datacenter ECN\"\n#define SCTPCTL_RTTVAR_DCCCECN_MIN\t0\n#define SCTPCTL_RTTVAR_DCCCECN_MAX\t1\n#define SCTPCTL_RTTVAR_DCCCECN_DEFAULT\t1\t/* 0 means disable feature */\n\n#if defined(SCTP_DEBUG)\n/* debug: Configure debug output */\n#define SCTPCTL_DEBUG_DESC\t\"Configure debug output\"\n#define SCTPCTL_DEBUG_MIN\t0\n#define SCTPCTL_DEBUG_MAX\t0xFFFFFFFF\n#define SCTPCTL_DEBUG_DEFAULT\t0\n#endif\n\n\n#if defined (__APPLE__) || defined(SCTP_SO_LOCK_TESTING)\n#define SCTPCTL_OUTPUT_UNLOCKED_DESC\t\"Unlock socket when sending packets down to IP.\"\n#define SCTPCTL_OUTPUT_UNLOCKED_MIN\t0\n#define SCTPCTL_OUTPUT_UNLOCKED_MAX\t1\n#define SCTPCTL_OUTPUT_UNLOCKED_DEFAULT\tSCTPCTL_OUTPUT_UNLOCKED_MIN\n#endif\n\n\n#if defined(_KERNEL) || defined(__Userspace__)\n#if defined(SYSCTL_DECL)\nSYSCTL_DECL(_net_inet_sctp);\n#endif\n\nvoid sctp_init_sysctls(void);\n\n#endif\t\t\t\t/* _KERNEL */\n#endif\t\t\t\t/* __sctp_sysctl_h__ */\n"
  },
  {
    "path": "freebsd-headers/netinet/sctp_timer.h",
    "content": "/*-\n * Copyright (c) 2001-2007, by Cisco Systems, Inc. All rights reserved.\n * Copyright (c) 2008-2011, by Randall Stewart. All rights reserved.\n * Copyright (c) 2008-2011, by Michael Tuexen. All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions are met:\n *\n * a) Redistributions of source code must retain the above copyright notice,\n *   this list of conditions and the following disclaimer.\n *\n * b) Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in\n *   the documentation and/or other materials provided with the distribution.\n *\n * c) Neither the name of Cisco Systems, Inc. nor the names of its\n *    contributors may be used to endorse or promote products derived\n *    from this software without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n * \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,\n * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE\n * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\n * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\n * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\n * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\n * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF\n * THE POSSIBILITY OF SUCH DAMAGE.\n */\n\n/* $KAME: sctp_timer.h,v 1.6 2005/03/06 16:04:18 itojun Exp $\t */\n#include <sys/cdefs.h>\n__FBSDID(\"$FreeBSD: release/9.0.0/sys/netinet/sctp_timer.h 224641 2011-08-03 20:21:00Z tuexen $\");\n\n#ifndef __sctp_timer_h__\n#define __sctp_timer_h__\n\n#if defined(_KERNEL) || defined(__Userspace__)\n\n#define SCTP_RTT_SHIFT 3\n#define SCTP_RTT_VAR_SHIFT 2\n\nstruct sctp_nets *\nsctp_find_alternate_net(struct sctp_tcb *,\n    struct sctp_nets *, int mode);\n\nint\nsctp_threshold_management(struct sctp_inpcb *, struct sctp_tcb *,\n    struct sctp_nets *, uint16_t);\n\nint\nsctp_t3rxt_timer(struct sctp_inpcb *, struct sctp_tcb *,\n    struct sctp_nets *);\nint\nsctp_t1init_timer(struct sctp_inpcb *, struct sctp_tcb *,\n    struct sctp_nets *);\nint\nsctp_shutdown_timer(struct sctp_inpcb *, struct sctp_tcb *,\n    struct sctp_nets *);\nint\nsctp_heartbeat_timer(struct sctp_inpcb *, struct sctp_tcb *,\n    struct sctp_nets *);\n\nint\nsctp_cookie_timer(struct sctp_inpcb *, struct sctp_tcb *,\n    struct sctp_nets *);\n\nvoid\nsctp_pathmtu_timer(struct sctp_inpcb *, struct sctp_tcb *,\n    struct sctp_nets *);\n\nint\nsctp_shutdownack_timer(struct sctp_inpcb *, struct sctp_tcb *,\n    struct sctp_nets *);\nint\nsctp_strreset_timer(struct sctp_inpcb *inp, struct sctp_tcb *stcb,\n    struct sctp_nets *net);\n\nint\nsctp_asconf_timer(struct sctp_inpcb *, struct sctp_tcb *,\n    struct sctp_nets *);\n\nvoid\nsctp_delete_prim_timer(struct sctp_inpcb *, struct sctp_tcb *,\n    struct sctp_nets *);\n\nvoid\nsctp_autoclose_timer(struct sctp_inpcb *, struct sctp_tcb *,\n    struct sctp_nets *net);\n\nvoid sctp_audit_retranmission_queue(struct sctp_association *);\n\nvoid sctp_iterator_timer(struct sctp_iterator *it);\n\n\n#endif\n#endif\n"
  },
  {
    "path": "freebsd-headers/netinet/sctp_uio.h",
    "content": "/*-\n * Copyright (c) 2001-2007, by Cisco Systems, Inc. All rights reserved.\n * Copyright (c) 2008-2011, by Randall Stewart. All rights reserved.\n * Copyright (c) 2008-2011, by Michael Tuexen. All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions are met:\n *\n * a) Redistributions of source code must retain the above copyright notice,\n *   this list of conditions and the following disclaimer.\n *\n * b) Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in\n *   the documentation and/or other materials provided with the distribution.\n *\n * c) Neither the name of Cisco Systems, Inc. nor the names of its\n *    contributors may be used to endorse or promote products derived\n *    from this software without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n * \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,\n * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE\n * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\n * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\n * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\n * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\n * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF\n * THE POSSIBILITY OF SUCH DAMAGE.\n */\n\n/* $KAME: sctp_uio.h,v 1.11 2005/03/06 16:04:18 itojun Exp $\t */\n#include <sys/cdefs.h>\n__FBSDID(\"$FreeBSD: release/9.0.0/sys/netinet/sctp_uio.h 227949 2011-11-24 18:57:31Z tuexen $\");\n\n#ifndef __sctp_uio_h__\n#define __sctp_uio_h__\n\n\n#if ! defined(_KERNEL)\n#include <stdint.h>\n#endif\n#include <sys/types.h>\n#include <sys/socket.h>\n#include <netinet/in.h>\n\ntypedef uint32_t sctp_assoc_t;\n\n#define SCTP_FUTURE_ASSOC  0\n#define SCTP_CURRENT_ASSOC 1\n#define SCTP_ALL_ASSOC     2\n\nstruct sctp_event {\n\tsctp_assoc_t se_assoc_id;\n\tuint16_t se_type;\n\tuint8_t se_on;\n};\n\n/* Compatibility to previous define's */\n#define sctp_stream_reset_events sctp_stream_reset_event\n\n/* On/Off setup for subscription to events */\nstruct sctp_event_subscribe {\n\tuint8_t sctp_data_io_event;\n\tuint8_t sctp_association_event;\n\tuint8_t sctp_address_event;\n\tuint8_t sctp_send_failure_event;\n\tuint8_t sctp_peer_error_event;\n\tuint8_t sctp_shutdown_event;\n\tuint8_t sctp_partial_delivery_event;\n\tuint8_t sctp_adaptation_layer_event;\n\tuint8_t sctp_authentication_event;\n\tuint8_t sctp_sender_dry_event;\n\tuint8_t sctp_stream_reset_event;\n};\n\n/* ancillary data types */\n#define SCTP_INIT\t0x0001\n#define SCTP_SNDRCV\t0x0002\n#define SCTP_EXTRCV\t0x0003\n#define SCTP_SNDINFO    0x0004\n#define SCTP_RCVINFO    0x0005\n#define SCTP_NXTINFO    0x0006\n#define SCTP_PRINFO     0x0007\n#define SCTP_AUTHINFO   0x0008\n#define SCTP_DSTADDRV4  0x0009\n#define SCTP_DSTADDRV6  0x000a\n\n/*\n * ancillary data structures\n */\nstruct sctp_initmsg {\n\tuint16_t sinit_num_ostreams;\n\tuint16_t sinit_max_instreams;\n\tuint16_t sinit_max_attempts;\n\tuint16_t sinit_max_init_timeo;\n};\n\n/* We add 96 bytes to the size of sctp_sndrcvinfo.\n * This makes the current structure 128 bytes long\n * which is nicely 64 bit aligned but also has room\n * for us to add more and keep ABI compatibility.\n * For example, already we have the sctp_extrcvinfo\n * when enabled which is 48 bytes.\n */\n\n/*\n * The assoc up needs a verfid\n * all sendrcvinfo's need a verfid for SENDING only.\n */\n\n\n#define SCTP_ALIGN_RESV_PAD 92\n#define SCTP_ALIGN_RESV_PAD_SHORT 76\n\nstruct sctp_sndrcvinfo {\n\tuint16_t sinfo_stream;\n\tuint16_t sinfo_ssn;\n\tuint16_t sinfo_flags;\n\tuint32_t sinfo_ppid;\n\tuint32_t sinfo_context;\n\tuint32_t sinfo_timetolive;\n\tuint32_t sinfo_tsn;\n\tuint32_t sinfo_cumtsn;\n\tsctp_assoc_t sinfo_assoc_id;\n\tuint16_t sinfo_keynumber;\n\tuint16_t sinfo_keynumber_valid;\n\tuint8_t __reserve_pad[SCTP_ALIGN_RESV_PAD];\n};\n\nstruct sctp_extrcvinfo {\n\tuint16_t sinfo_stream;\n\tuint16_t sinfo_ssn;\n\tuint16_t sinfo_flags;\n\tuint32_t sinfo_ppid;\n\tuint32_t sinfo_context;\n\tuint32_t sinfo_timetolive;\n\tuint32_t sinfo_tsn;\n\tuint32_t sinfo_cumtsn;\n\tsctp_assoc_t sinfo_assoc_id;\n\tuint16_t sreinfo_next_flags;\n\tuint16_t sreinfo_next_stream;\n\tuint32_t sreinfo_next_aid;\n\tuint32_t sreinfo_next_length;\n\tuint32_t sreinfo_next_ppid;\n\tuint16_t sinfo_keynumber;\n\tuint16_t sinfo_keynumber_valid;\n\tuint8_t __reserve_pad[SCTP_ALIGN_RESV_PAD_SHORT];\n};\n\nstruct sctp_sndinfo {\n\tuint16_t snd_sid;\n\tuint16_t snd_flags;\n\tuint32_t snd_ppid;\n\tuint32_t snd_context;\n\tsctp_assoc_t snd_assoc_id;\n};\n\nstruct sctp_prinfo {\n\tuint16_t pr_policy;\n\tuint32_t pr_value;\n};\n\nstruct sctp_default_prinfo {\n\tuint16_t pr_policy;\n\tuint32_t pr_value;\n\tsctp_assoc_t pr_assoc_id;\n};\n\nstruct sctp_authinfo {\n\tuint16_t auth_keyid;\n};\n\nstruct sctp_rcvinfo {\n\tuint16_t rcv_sid;\n\tuint16_t rcv_ssn;\n\tuint16_t rcv_flags;\n\tuint32_t rcv_ppid;\n\tuint32_t rcv_tsn;\n\tuint32_t rcv_cumtsn;\n\tuint32_t rcv_context;\n\tsctp_assoc_t rcv_assoc_id;\n};\n\nstruct sctp_nxtinfo {\n\tuint16_t nxt_sid;\n\tuint16_t nxt_flags;\n\tuint32_t nxt_ppid;\n\tuint32_t nxt_length;\n\tsctp_assoc_t nxt_assoc_id;\n};\n\n#define SCTP_NO_NEXT_MSG           0x0000\n#define SCTP_NEXT_MSG_AVAIL        0x0001\n#define SCTP_NEXT_MSG_ISCOMPLETE   0x0002\n#define SCTP_NEXT_MSG_IS_UNORDERED 0x0004\n#define SCTP_NEXT_MSG_IS_NOTIFICATION 0x0008\n\nstruct sctp_recvv_rn {\n\tstruct sctp_rcvinfo recvv_rcvinfo;\n\tstruct sctp_nxtinfo recvv_nxtinfo;\n};\n\n#define SCTP_RECVV_NOINFO  0\n#define SCTP_RECVV_RCVINFO 1\n#define SCTP_RECVV_NXTINFO 2\n#define SCTP_RECVV_RN      3\n\n#define SCTP_SENDV_NOINFO   0\n#define SCTP_SENDV_SNDINFO  1\n#define SCTP_SENDV_PRINFO   2\n#define SCTP_SENDV_AUTHINFO 3\n#define SCTP_SENDV_SPA      4\n\nstruct sctp_sendv_spa {\n\tuint32_t sendv_flags;\n\tstruct sctp_sndinfo sendv_sndinfo;\n\tstruct sctp_prinfo sendv_prinfo;\n\tstruct sctp_authinfo sendv_authinfo;\n};\n\n#define SCTP_SEND_SNDINFO_VALID  0x00000001\n#define SCTP_SEND_PRINFO_VALID   0x00000002\n#define SCTP_SEND_AUTHINFO_VALID 0x00000004\n\nstruct sctp_snd_all_completes {\n\tuint16_t sall_stream;\n\tuint16_t sall_flags;\n\tuint32_t sall_ppid;\n\tuint32_t sall_context;\n\tuint32_t sall_num_sent;\n\tuint32_t sall_num_failed;\n};\n\n/* Flags that go into the sinfo->sinfo_flags field */\n#define SCTP_NOTIFICATION     0x0010\t/* next message is a notification */\n#define SCTP_COMPLETE         0x0020\t/* next message is complete */\n#define SCTP_EOF              0x0100\t/* Start shutdown procedures */\n#define SCTP_ABORT            0x0200\t/* Send an ABORT to peer */\n#define SCTP_UNORDERED        0x0400\t/* Message is un-ordered */\n#define SCTP_ADDR_OVER        0x0800\t/* Override the primary-address */\n#define SCTP_SENDALL          0x1000\t/* Send this on all associations */\n#define SCTP_EOR              0x2000\t/* end of message signal */\n#define SCTP_SACK_IMMEDIATELY 0x4000\t/* Set I-Bit */\n\n#define INVALID_SINFO_FLAG(x) (((x) & 0xfffffff0 \\\n                                    & ~(SCTP_EOF | SCTP_ABORT | SCTP_UNORDERED |\\\n\t\t\t\t        SCTP_ADDR_OVER | SCTP_SENDALL | SCTP_EOR |\\\n\t\t\t\t\tSCTP_SACK_IMMEDIATELY)) != 0)\n/* for the endpoint */\n\n/* The lower byte is an enumeration of PR-SCTP policies */\n#define SCTP_PR_SCTP_NONE 0x0000/* Reliable transfer */\n#define SCTP_PR_SCTP_TTL  0x0001/* Time based PR-SCTP */\n#define SCTP_PR_SCTP_BUF  0x0002/* Buffer based PR-SCTP */\n#define SCTP_PR_SCTP_RTX  0x0003/* Number of retransmissions based PR-SCTP */\n\n#define PR_SCTP_POLICY(x)         ((x) & 0x0f)\n#define PR_SCTP_ENABLED(x)        (PR_SCTP_POLICY(x) != SCTP_PR_SCTP_NONE)\n#define PR_SCTP_TTL_ENABLED(x)    (PR_SCTP_POLICY(x) == SCTP_PR_SCTP_TTL)\n#define PR_SCTP_BUF_ENABLED(x)    (PR_SCTP_POLICY(x) == SCTP_PR_SCTP_BUF)\n#define PR_SCTP_RTX_ENABLED(x)    (PR_SCTP_POLICY(x) == SCTP_PR_SCTP_RTX)\n#define PR_SCTP_INVALID_POLICY(x) (PR_SCTP_POLICY(x) > SCTP_PR_SCTP_RTX)\n/* Stat's */\nstruct sctp_pcbinfo {\n\tuint32_t ep_count;\n\tuint32_t asoc_count;\n\tuint32_t laddr_count;\n\tuint32_t raddr_count;\n\tuint32_t chk_count;\n\tuint32_t readq_count;\n\tuint32_t free_chunks;\n\tuint32_t stream_oque;\n};\n\nstruct sctp_sockstat {\n\tsctp_assoc_t ss_assoc_id;\n\tuint32_t ss_total_sndbuf;\n\tuint32_t ss_total_recv_buf;\n};\n\n/*\n * notification event structures\n */\n\n/*\n * association change event\n */\nstruct sctp_assoc_change {\n\tuint16_t sac_type;\n\tuint16_t sac_flags;\n\tuint32_t sac_length;\n\tuint16_t sac_state;\n\tuint16_t sac_error;\n\tuint16_t sac_outbound_streams;\n\tuint16_t sac_inbound_streams;\n\tsctp_assoc_t sac_assoc_id;\n};\n\n/* sac_state values */\n#define SCTP_COMM_UP\t\t0x0001\n#define SCTP_COMM_LOST\t\t0x0002\n#define SCTP_RESTART\t\t0x0003\n#define SCTP_SHUTDOWN_COMP\t0x0004\n#define SCTP_CANT_STR_ASSOC\t0x0005\n\n\n/*\n * Address event\n */\nstruct sctp_paddr_change {\n\tuint16_t spc_type;\n\tuint16_t spc_flags;\n\tuint32_t spc_length;\n\tstruct sockaddr_storage spc_aaddr;\n\tuint32_t spc_state;\n\tuint32_t spc_error;\n\tsctp_assoc_t spc_assoc_id;\n\tuint8_t spc_padding[4];\n};\n\n/* paddr state values */\n#define SCTP_ADDR_AVAILABLE\t0x0001\n#define SCTP_ADDR_UNREACHABLE\t0x0002\n#define SCTP_ADDR_REMOVED\t0x0003\n#define SCTP_ADDR_ADDED\t\t0x0004\n#define SCTP_ADDR_MADE_PRIM\t0x0005\n#define SCTP_ADDR_CONFIRMED\t0x0006\n\n#define SCTP_ACTIVE\t\t0x0001\t/* SCTP_ADDR_REACHABLE */\n#define SCTP_INACTIVE\t\t0x0002\t/* neither SCTP_ADDR_REACHABLE nor\n\t\t\t\t\t * SCTP_ADDR_UNCONFIRMED */\n#define SCTP_UNCONFIRMED\t0x0200\t/* SCTP_ADDR_UNCONFIRMED */\n\n/* remote error events */\nstruct sctp_remote_error {\n\tuint16_t sre_type;\n\tuint16_t sre_flags;\n\tuint32_t sre_length;\n\tuint16_t sre_error;\n\tsctp_assoc_t sre_assoc_id;\n\tuint8_t sre_data[4];\n};\n\n/* data send failure event */\nstruct sctp_send_failed {\n\tuint16_t ssf_type;\n\tuint16_t ssf_flags;\n\tuint32_t ssf_length;\n\tuint32_t ssf_error;\n\tstruct sctp_sndrcvinfo ssf_info;\n\tsctp_assoc_t ssf_assoc_id;\n\tuint8_t ssf_data[];\n};\n\n/* flag that indicates state of data */\n#define SCTP_DATA_UNSENT\t0x0001\t/* inqueue never on wire */\n#define SCTP_DATA_SENT\t\t0x0002\t/* on wire at failure */\n\n/* shutdown event */\nstruct sctp_shutdown_event {\n\tuint16_t sse_type;\n\tuint16_t sse_flags;\n\tuint32_t sse_length;\n\tsctp_assoc_t sse_assoc_id;\n};\n\n/* Adaptation layer indication stuff */\nstruct sctp_adaptation_event {\n\tuint16_t sai_type;\n\tuint16_t sai_flags;\n\tuint32_t sai_length;\n\tuint32_t sai_adaptation_ind;\n\tsctp_assoc_t sai_assoc_id;\n};\n\nstruct sctp_setadaptation {\n\tuint32_t ssb_adaptation_ind;\n};\n\n/* compatible old spelling */\nstruct sctp_adaption_event {\n\tuint16_t sai_type;\n\tuint16_t sai_flags;\n\tuint32_t sai_length;\n\tuint32_t sai_adaption_ind;\n\tsctp_assoc_t sai_assoc_id;\n};\n\nstruct sctp_setadaption {\n\tuint32_t ssb_adaption_ind;\n};\n\n\n/*\n * Partial Delivery API event\n */\nstruct sctp_pdapi_event {\n\tuint16_t pdapi_type;\n\tuint16_t pdapi_flags;\n\tuint32_t pdapi_length;\n\tuint32_t pdapi_indication;\n\tuint16_t pdapi_stream;\n\tuint16_t pdapi_seq;\n\tsctp_assoc_t pdapi_assoc_id;\n};\n\n/* indication values */\n#define SCTP_PARTIAL_DELIVERY_ABORTED\t0x0001\n\n\n/*\n * authentication key event\n */\nstruct sctp_authkey_event {\n\tuint16_t auth_type;\n\tuint16_t auth_flags;\n\tuint32_t auth_length;\n\tuint16_t auth_keynumber;\n\tuint16_t auth_altkeynumber;\n\tuint32_t auth_indication;\n\tsctp_assoc_t auth_assoc_id;\n};\n\n/* indication values */\n#define SCTP_AUTH_NEWKEY\t0x0001\n#define SCTP_AUTH_NO_AUTH\t0x0002\n#define SCTP_AUTH_FREE_KEY\t0x0003\n\n\nstruct sctp_sender_dry_event {\n\tuint16_t sender_dry_type;\n\tuint16_t sender_dry_flags;\n\tuint32_t sender_dry_length;\n\tsctp_assoc_t sender_dry_assoc_id;\n};\n\n\n/*\n * stream reset event\n */\nstruct sctp_stream_reset_event {\n\tuint16_t strreset_type;\n\tuint16_t strreset_flags;\n\tuint32_t strreset_length;\n\tsctp_assoc_t strreset_assoc_id;\n\tuint16_t strreset_list[];\n};\n\n/* flags in strreset_flags field */\n#define SCTP_STRRESET_INBOUND_STR  0x0001\n#define SCTP_STRRESET_OUTBOUND_STR 0x0002\n#define SCTP_STRRESET_ALL_STREAMS  0x0004\n#define SCTP_STRRESET_STREAM_LIST  0x0008\n#define SCTP_STRRESET_FAILED       0x0010\n#define SCTP_STRRESET_ADD_STREAM   0x0020\n\n/* SCTP notification event */\nstruct sctp_tlv {\n\tuint16_t sn_type;\n\tuint16_t sn_flags;\n\tuint32_t sn_length;\n};\n\nunion sctp_notification {\n\tstruct sctp_tlv sn_header;\n\tstruct sctp_assoc_change sn_assoc_change;\n\tstruct sctp_paddr_change sn_paddr_change;\n\tstruct sctp_remote_error sn_remote_error;\n\tstruct sctp_send_failed sn_send_failed;\n\tstruct sctp_shutdown_event sn_shutdown_event;\n\tstruct sctp_adaptation_event sn_adaptation_event;\n\t/* compatibility same as above */\n\tstruct sctp_adaption_event sn_adaption_event;\n\tstruct sctp_pdapi_event sn_pdapi_event;\n\tstruct sctp_authkey_event sn_auth_event;\n\tstruct sctp_sender_dry_event sn_sender_dry_event;\n\tstruct sctp_stream_reset_event sn_strreset_event;\n};\n\n/* notification types */\n#define SCTP_ASSOC_CHANGE\t\t\t0x0001\n#define SCTP_PEER_ADDR_CHANGE\t\t\t0x0002\n#define SCTP_REMOTE_ERROR\t\t\t0x0003\n#define SCTP_SEND_FAILED\t\t\t0x0004\n#define SCTP_SHUTDOWN_EVENT\t\t\t0x0005\n#define SCTP_ADAPTATION_INDICATION\t\t0x0006\n/* same as above */\n#define SCTP_ADAPTION_INDICATION\t\t0x0006\n#define SCTP_PARTIAL_DELIVERY_EVENT\t\t0x0007\n#define SCTP_AUTHENTICATION_EVENT\t\t0x0008\n#define SCTP_STREAM_RESET_EVENT\t\t\t0x0009\n#define SCTP_SENDER_DRY_EVENT\t\t\t0x000a\n#define SCTP_NOTIFICATIONS_STOPPED_EVENT\t0x000b\t/* we don't send this */\n/*\n * socket option structs\n */\n\nstruct sctp_paddrparams {\n\tstruct sockaddr_storage spp_address;\n\tsctp_assoc_t spp_assoc_id;\n\tuint32_t spp_hbinterval;\n\tuint32_t spp_pathmtu;\n\tuint32_t spp_flags;\n\tuint32_t spp_ipv6_flowlabel;\n\tuint16_t spp_pathmaxrxt;\n\tuint8_t spp_dscp;\n};\n\n#define spp_ipv4_tos spp_dscp\n\n#define SPP_HB_ENABLE\t\t0x00000001\n#define SPP_HB_DISABLE\t\t0x00000002\n#define SPP_HB_DEMAND\t\t0x00000004\n#define SPP_PMTUD_ENABLE\t0x00000008\n#define SPP_PMTUD_DISABLE\t0x00000010\n#define SPP_HB_TIME_IS_ZERO     0x00000080\n#define SPP_IPV6_FLOWLABEL      0x00000100\n#define SPP_DSCP                0x00000200\n#define SPP_IPV4_TOS            SPP_DSCP\n\nstruct sctp_paddrthlds {\n\tstruct sockaddr_storage spt_address;\n\tsctp_assoc_t spt_assoc_id;\n\tuint16_t spt_pathmaxrxt;\n\tuint16_t spt_pathpfthld;\n};\n\nstruct sctp_paddrinfo {\n\tstruct sockaddr_storage spinfo_address;\n\tsctp_assoc_t spinfo_assoc_id;\n\tint32_t spinfo_state;\n\tuint32_t spinfo_cwnd;\n\tuint32_t spinfo_srtt;\n\tuint32_t spinfo_rto;\n\tuint32_t spinfo_mtu;\n};\n\nstruct sctp_rtoinfo {\n\tsctp_assoc_t srto_assoc_id;\n\tuint32_t srto_initial;\n\tuint32_t srto_max;\n\tuint32_t srto_min;\n};\n\nstruct sctp_assocparams {\n\tsctp_assoc_t sasoc_assoc_id;\n\tuint32_t sasoc_peer_rwnd;\n\tuint32_t sasoc_local_rwnd;\n\tuint32_t sasoc_cookie_life;\n\tuint16_t sasoc_asocmaxrxt;\n\tuint16_t sasoc_number_peer_destinations;\n};\n\nstruct sctp_setprim {\n\tstruct sockaddr_storage ssp_addr;\n\tsctp_assoc_t ssp_assoc_id;\n\tuint8_t ssp_padding[4];\n};\n\nstruct sctp_setpeerprim {\n\tstruct sockaddr_storage sspp_addr;\n\tsctp_assoc_t sspp_assoc_id;\n\tuint8_t sspp_padding[4];\n};\n\nstruct sctp_getaddresses {\n\tsctp_assoc_t sget_assoc_id;\n\t/* addr is filled in for N * sockaddr_storage */\n\tstruct sockaddr addr[1];\n};\n\nstruct sctp_setstrm_timeout {\n\tsctp_assoc_t ssto_assoc_id;\n\tuint32_t ssto_timeout;\n\tuint32_t ssto_streamid_start;\n\tuint32_t ssto_streamid_end;\n};\n\nstruct sctp_status {\n\tsctp_assoc_t sstat_assoc_id;\n\tint32_t sstat_state;\n\tuint32_t sstat_rwnd;\n\tuint16_t sstat_unackdata;\n\tuint16_t sstat_penddata;\n\tuint16_t sstat_instrms;\n\tuint16_t sstat_outstrms;\n\tuint32_t sstat_fragmentation_point;\n\tstruct sctp_paddrinfo sstat_primary;\n};\n\n/*\n * AUTHENTICATION support\n */\n/* SCTP_AUTH_CHUNK */\nstruct sctp_authchunk {\n\tuint8_t sauth_chunk;\n};\n\n/* SCTP_AUTH_KEY */\nstruct sctp_authkey {\n\tsctp_assoc_t sca_assoc_id;\n\tuint16_t sca_keynumber;\n\tuint16_t sca_keylength;\n\tuint8_t sca_key[];\n};\n\n/* SCTP_HMAC_IDENT */\nstruct sctp_hmacalgo {\n\tuint32_t shmac_number_of_idents;\n\tuint16_t shmac_idents[];\n};\n\n/* AUTH hmac_id */\n#define SCTP_AUTH_HMAC_ID_RSVD\t\t0x0000\n#define SCTP_AUTH_HMAC_ID_SHA1\t\t0x0001\t/* default, mandatory */\n#define SCTP_AUTH_HMAC_ID_SHA256\t0x0003\n#define SCTP_AUTH_HMAC_ID_SHA224\t0x0004\n#define SCTP_AUTH_HMAC_ID_SHA384\t0x0005\n#define SCTP_AUTH_HMAC_ID_SHA512\t0x0006\n\n\n/* SCTP_AUTH_ACTIVE_KEY / SCTP_AUTH_DELETE_KEY */\nstruct sctp_authkeyid {\n\tsctp_assoc_t scact_assoc_id;\n\tuint16_t scact_keynumber;\n};\n\n/* SCTP_PEER_AUTH_CHUNKS / SCTP_LOCAL_AUTH_CHUNKS */\nstruct sctp_authchunks {\n\tsctp_assoc_t gauth_assoc_id;\n\tuint8_t gauth_chunks[];\n};\n\nstruct sctp_assoc_value {\n\tsctp_assoc_t assoc_id;\n\tuint32_t assoc_value;\n};\n\nstruct sctp_cc_option {\n\tint option;\n\tstruct sctp_assoc_value aid_value;\n};\n\nstruct sctp_stream_value {\n\tsctp_assoc_t assoc_id;\n\tuint16_t stream_id;\n\tuint16_t stream_value;\n};\n\nstruct sctp_assoc_ids {\n\tuint32_t gaids_number_of_ids;\n\tsctp_assoc_t gaids_assoc_id[];\n};\n\nstruct sctp_sack_info {\n\tsctp_assoc_t sack_assoc_id;\n\tuint32_t sack_delay;\n\tuint32_t sack_freq;\n};\n\nstruct sctp_timeouts {\n\tsctp_assoc_t stimo_assoc_id;\n\tuint32_t stimo_init;\n\tuint32_t stimo_data;\n\tuint32_t stimo_sack;\n\tuint32_t stimo_shutdown;\n\tuint32_t stimo_heartbeat;\n\tuint32_t stimo_cookie;\n\tuint32_t stimo_shutdownack;\n};\n\nstruct sctp_cwnd_args {\n\tstruct sctp_nets *net;\t/* network to *//* FIXME: LP64 issue */\n\tuint32_t cwnd_new_value;/* cwnd in k */\n\tuint32_t pseudo_cumack;\n\tuint16_t inflight;\t/* flightsize in k */\n\tuint16_t cwnd_augment;\t/* increment to it */\n\tuint8_t meets_pseudo_cumack;\n\tuint8_t need_new_pseudo_cumack;\n\tuint8_t cnt_in_send;\n\tuint8_t cnt_in_str;\n};\n\nstruct sctp_blk_args {\n\tuint32_t onsb;\t\t/* in 1k bytes */\n\tuint32_t sndlen;\t/* len of send being attempted */\n\tuint32_t peer_rwnd;\t/* rwnd of peer */\n\tuint16_t send_sent_qcnt;/* chnk cnt */\n\tuint16_t stream_qcnt;\t/* chnk cnt */\n\tuint16_t chunks_on_oque;/* chunks out */\n\tuint16_t flight_size;\t/* flight size in k */\n};\n\n/*\n * Max we can reset in one setting, note this is dictated not by the define\n * but the size of a mbuf cluster so don't change this define and think you\n * can specify more. You must do multiple resets if you want to reset more\n * than SCTP_MAX_EXPLICIT_STR_RESET.\n */\n#define SCTP_MAX_EXPLICT_STR_RESET   1000\n\n#define SCTP_RESET_LOCAL_RECV  0x0001\n#define SCTP_RESET_LOCAL_SEND  0x0002\n#define SCTP_RESET_BOTH        0x0003\n#define SCTP_RESET_TSN         0x0004\n#define SCTP_RESET_ADD_STREAMS 0x0005\n\nstruct sctp_stream_reset {\n\tsctp_assoc_t strrst_assoc_id;\n\tuint16_t strrst_flags;\n\tuint16_t strrst_num_streams;\t/* 0 == ALL */\n\tuint16_t strrst_list[];\t/* list if strrst_num_streams is not 0 */\n};\n\n\nstruct sctp_get_nonce_values {\n\tsctp_assoc_t gn_assoc_id;\n\tuint32_t gn_peers_tag;\n\tuint32_t gn_local_tag;\n};\n\n/* Debugging logs */\nstruct sctp_str_log {\n\tvoid *stcb;\t\t/* FIXME: LP64 issue */\n\tuint32_t n_tsn;\n\tuint32_t e_tsn;\n\tuint16_t n_sseq;\n\tuint16_t e_sseq;\n\tuint16_t strm;\n};\n\nstruct sctp_sb_log {\n\tvoid *stcb;\t\t/* FIXME: LP64 issue */\n\tuint32_t so_sbcc;\n\tuint32_t stcb_sbcc;\n\tuint32_t incr;\n};\n\nstruct sctp_fr_log {\n\tuint32_t largest_tsn;\n\tuint32_t largest_new_tsn;\n\tuint32_t tsn;\n};\n\nstruct sctp_fr_map {\n\tuint32_t base;\n\tuint32_t cum;\n\tuint32_t high;\n};\n\nstruct sctp_rwnd_log {\n\tuint32_t rwnd;\n\tuint32_t send_size;\n\tuint32_t overhead;\n\tuint32_t new_rwnd;\n};\n\nstruct sctp_mbcnt_log {\n\tuint32_t total_queue_size;\n\tuint32_t size_change;\n\tuint32_t total_queue_mb_size;\n\tuint32_t mbcnt_change;\n};\n\nstruct sctp_sack_log {\n\tuint32_t cumack;\n\tuint32_t oldcumack;\n\tuint32_t tsn;\n\tuint16_t numGaps;\n\tuint16_t numDups;\n};\n\nstruct sctp_lock_log {\n\tvoid *sock;\t\t/* FIXME: LP64 issue */\n\tvoid *inp;\t\t/* FIXME: LP64 issue */\n\tuint8_t tcb_lock;\n\tuint8_t inp_lock;\n\tuint8_t info_lock;\n\tuint8_t sock_lock;\n\tuint8_t sockrcvbuf_lock;\n\tuint8_t socksndbuf_lock;\n\tuint8_t create_lock;\n\tuint8_t resv;\n};\n\nstruct sctp_rto_log {\n\tvoid *net;\t\t/* FIXME: LP64 issue */\n\tuint32_t rtt;\n};\n\nstruct sctp_nagle_log {\n\tvoid *stcb;\t\t/* FIXME: LP64 issue */\n\tuint32_t total_flight;\n\tuint32_t total_in_queue;\n\tuint16_t count_in_queue;\n\tuint16_t count_in_flight;\n};\n\nstruct sctp_sbwake_log {\n\tvoid *stcb;\t\t/* FIXME: LP64 issue */\n\tuint16_t send_q;\n\tuint16_t sent_q;\n\tuint16_t flight;\n\tuint16_t wake_cnt;\n\tuint8_t stream_qcnt;\t/* chnk cnt */\n\tuint8_t chunks_on_oque;\t/* chunks out */\n\tuint8_t sbflags;\n\tuint8_t sctpflags;\n};\n\nstruct sctp_misc_info {\n\tuint32_t log1;\n\tuint32_t log2;\n\tuint32_t log3;\n\tuint32_t log4;\n};\n\nstruct sctp_log_closing {\n\tvoid *inp;\t\t/* FIXME: LP64 issue */\n\tvoid *stcb;\t\t/* FIXME: LP64 issue */\n\tuint32_t sctp_flags;\n\tuint16_t state;\n\tint16_t loc;\n};\n\nstruct sctp_mbuf_log {\n\tstruct mbuf *mp;\t/* FIXME: LP64 issue */\n\tcaddr_t ext;\n\tcaddr_t data;\n\tuint16_t size;\n\tuint8_t refcnt;\n\tuint8_t mbuf_flags;\n};\n\nstruct sctp_cwnd_log {\n\tuint64_t time_event;\n\tuint8_t from;\n\tuint8_t event_type;\n\tuint8_t resv[2];\n\tunion {\n\t\tstruct sctp_log_closing close;\n\t\tstruct sctp_blk_args blk;\n\t\tstruct sctp_cwnd_args cwnd;\n\t\tstruct sctp_str_log strlog;\n\t\tstruct sctp_fr_log fr;\n\t\tstruct sctp_fr_map map;\n\t\tstruct sctp_rwnd_log rwnd;\n\t\tstruct sctp_mbcnt_log mbcnt;\n\t\tstruct sctp_sack_log sack;\n\t\tstruct sctp_lock_log lock;\n\t\tstruct sctp_rto_log rto;\n\t\tstruct sctp_sb_log sb;\n\t\tstruct sctp_nagle_log nagle;\n\t\tstruct sctp_sbwake_log wake;\n\t\tstruct sctp_mbuf_log mb;\n\t\tstruct sctp_misc_info misc;\n\t}     x;\n};\n\nstruct sctp_cwnd_log_req {\n\tint32_t num_in_log;\t/* Number in log */\n\tint32_t num_ret;\t/* Number returned */\n\tint32_t start_at;\t/* start at this one */\n\tint32_t end_at;\t\t/* end at this one */\n\tstruct sctp_cwnd_log log[];\n};\n\nstruct sctp_timeval {\n\tuint32_t tv_sec;\n\tuint32_t tv_usec;\n};\n\nstruct sctpstat {\n\tstruct sctp_timeval sctps_discontinuitytime;\t/* sctpStats 18\n\t\t\t\t\t\t\t * (TimeStamp) */\n\t/* MIB according to RFC 3873 */\n\tuint32_t sctps_currestab;\t/* sctpStats  1   (Gauge32) */\n\tuint32_t sctps_activeestab;\t/* sctpStats  2 (Counter32) */\n\tuint32_t sctps_restartestab;\n\tuint32_t sctps_collisionestab;\n\tuint32_t sctps_passiveestab;\t/* sctpStats  3 (Counter32) */\n\tuint32_t sctps_aborted;\t/* sctpStats  4 (Counter32) */\n\tuint32_t sctps_shutdown;/* sctpStats  5 (Counter32) */\n\tuint32_t sctps_outoftheblue;\t/* sctpStats  6 (Counter32) */\n\tuint32_t sctps_checksumerrors;\t/* sctpStats  7 (Counter32) */\n\tuint32_t sctps_outcontrolchunks;\t/* sctpStats  8 (Counter64) */\n\tuint32_t sctps_outorderchunks;\t/* sctpStats  9 (Counter64) */\n\tuint32_t sctps_outunorderchunks;\t/* sctpStats 10 (Counter64) */\n\tuint32_t sctps_incontrolchunks;\t/* sctpStats 11 (Counter64) */\n\tuint32_t sctps_inorderchunks;\t/* sctpStats 12 (Counter64) */\n\tuint32_t sctps_inunorderchunks;\t/* sctpStats 13 (Counter64) */\n\tuint32_t sctps_fragusrmsgs;\t/* sctpStats 14 (Counter64) */\n\tuint32_t sctps_reasmusrmsgs;\t/* sctpStats 15 (Counter64) */\n\tuint32_t sctps_outpackets;\t/* sctpStats 16 (Counter64) */\n\tuint32_t sctps_inpackets;\t/* sctpStats 17 (Counter64) */\n\n\t/* input statistics: */\n\tuint32_t sctps_recvpackets;\t/* total input packets        */\n\tuint32_t sctps_recvdatagrams;\t/* total input datagrams      */\n\tuint32_t sctps_recvpktwithdata;\t/* total packets that had data */\n\tuint32_t sctps_recvsacks;\t/* total input SACK chunks    */\n\tuint32_t sctps_recvdata;/* total input DATA chunks    */\n\tuint32_t sctps_recvdupdata;\t/* total input duplicate DATA chunks */\n\tuint32_t sctps_recvheartbeat;\t/* total input HB chunks      */\n\tuint32_t sctps_recvheartbeatack;\t/* total input HB-ACK chunks  */\n\tuint32_t sctps_recvecne;/* total input ECNE chunks    */\n\tuint32_t sctps_recvauth;/* total input AUTH chunks    */\n\tuint32_t sctps_recvauthmissing;\t/* total input chunks missing AUTH */\n\tuint32_t sctps_recvivalhmacid;\t/* total number of invalid HMAC ids\n\t\t\t\t\t * received */\n\tuint32_t sctps_recvivalkeyid;\t/* total number of invalid secret ids\n\t\t\t\t\t * received */\n\tuint32_t sctps_recvauthfailed;\t/* total number of auth failed */\n\tuint32_t sctps_recvexpress;\t/* total fast path receives all one\n\t\t\t\t\t * chunk */\n\tuint32_t sctps_recvexpressm;\t/* total fast path multi-part data */\n\tuint32_t sctps_recvnocrc;\n\tuint32_t sctps_recvswcrc;\n\tuint32_t sctps_recvhwcrc;\n\n\t/* output statistics: */\n\tuint32_t sctps_sendpackets;\t/* total output packets       */\n\tuint32_t sctps_sendsacks;\t/* total output SACKs         */\n\tuint32_t sctps_senddata;/* total output DATA chunks   */\n\tuint32_t sctps_sendretransdata;\t/* total output retransmitted DATA\n\t\t\t\t\t * chunks */\n\tuint32_t sctps_sendfastretrans;\t/* total output fast retransmitted\n\t\t\t\t\t * DATA chunks */\n\tuint32_t sctps_sendmultfastretrans;\t/* total FR's that happened\n\t\t\t\t\t\t * more than once to same\n\t\t\t\t\t\t * chunk (u-del multi-fr\n\t\t\t\t\t\t * algo). */\n\tuint32_t sctps_sendheartbeat;\t/* total output HB chunks     */\n\tuint32_t sctps_sendecne;/* total output ECNE chunks    */\n\tuint32_t sctps_sendauth;/* total output AUTH chunks FIXME   */\n\tuint32_t sctps_senderrors;\t/* ip_output error counter */\n\tuint32_t sctps_sendnocrc;\n\tuint32_t sctps_sendswcrc;\n\tuint32_t sctps_sendhwcrc;\n\t/* PCKDROPREP statistics: */\n\tuint32_t sctps_pdrpfmbox;\t/* Packet drop from middle box */\n\tuint32_t sctps_pdrpfehos;\t/* P-drop from end host */\n\tuint32_t sctps_pdrpmbda;/* P-drops with data */\n\tuint32_t sctps_pdrpmbct;/* P-drops, non-data, non-endhost */\n\tuint32_t sctps_pdrpbwrpt;\t/* P-drop, non-endhost, bandwidth rep\n\t\t\t\t\t * only */\n\tuint32_t sctps_pdrpcrupt;\t/* P-drop, not enough for chunk header */\n\tuint32_t sctps_pdrpnedat;\t/* P-drop, not enough data to confirm */\n\tuint32_t sctps_pdrppdbrk;\t/* P-drop, where process_chunk_drop\n\t\t\t\t\t * said break */\n\tuint32_t sctps_pdrptsnnf;\t/* P-drop, could not find TSN */\n\tuint32_t sctps_pdrpdnfnd;\t/* P-drop, attempt reverse TSN lookup */\n\tuint32_t sctps_pdrpdiwnp;\t/* P-drop, e-host confirms zero-rwnd */\n\tuint32_t sctps_pdrpdizrw;\t/* P-drop, midbox confirms no space */\n\tuint32_t sctps_pdrpbadd;/* P-drop, data did not match TSN */\n\tuint32_t sctps_pdrpmark;/* P-drop, TSN's marked for Fast Retran */\n\t/* timeouts */\n\tuint32_t sctps_timoiterator;\t/* Number of iterator timers that\n\t\t\t\t\t * fired */\n\tuint32_t sctps_timodata;/* Number of T3 data time outs */\n\tuint32_t sctps_timowindowprobe;\t/* Number of window probe (T3) timers\n\t\t\t\t\t * that fired */\n\tuint32_t sctps_timoinit;/* Number of INIT timers that fired */\n\tuint32_t sctps_timosack;/* Number of sack timers that fired */\n\tuint32_t sctps_timoshutdown;\t/* Number of shutdown timers that\n\t\t\t\t\t * fired */\n\tuint32_t sctps_timoheartbeat;\t/* Number of heartbeat timers that\n\t\t\t\t\t * fired */\n\tuint32_t sctps_timocookie;\t/* Number of times a cookie timeout\n\t\t\t\t\t * fired */\n\tuint32_t sctps_timosecret;\t/* Number of times an endpoint changed\n\t\t\t\t\t * its cookie secret */\n\tuint32_t sctps_timopathmtu;\t/* Number of PMTU timers that fired */\n\tuint32_t sctps_timoshutdownack;\t/* Number of shutdown ack timers that\n\t\t\t\t\t * fired */\n\tuint32_t sctps_timoshutdownguard;\t/* Number of shutdown guard\n\t\t\t\t\t\t * timers that fired */\n\tuint32_t sctps_timostrmrst;\t/* Number of stream reset timers that\n\t\t\t\t\t * fired */\n\tuint32_t sctps_timoearlyfr;\t/* Number of early FR timers that\n\t\t\t\t\t * fired */\n\tuint32_t sctps_timoasconf;\t/* Number of times an asconf timer\n\t\t\t\t\t * fired */\n\tuint32_t sctps_timodelprim;\t/* Number of times a prim_deleted\n\t\t\t\t\t * timer fired */\n\tuint32_t sctps_timoautoclose;\t/* Number of times auto close timer\n\t\t\t\t\t * fired */\n\tuint32_t sctps_timoassockill;\t/* Number of asoc free timers expired */\n\tuint32_t sctps_timoinpkill;\t/* Number of inp free timers expired */\n\t/* former early FR counters */\n\tuint32_t sctps_spare[11];\n\t/* others */\n\tuint32_t sctps_hdrops;\t/* packet shorter than header */\n\tuint32_t sctps_badsum;\t/* checksum error             */\n\tuint32_t sctps_noport;\t/* no endpoint for port       */\n\tuint32_t sctps_badvtag;\t/* bad v-tag                  */\n\tuint32_t sctps_badsid;\t/* bad SID                    */\n\tuint32_t sctps_nomem;\t/* no memory                  */\n\tuint32_t sctps_fastretransinrtt;\t/* number of multiple FR in a\n\t\t\t\t\t\t * RTT window */\n\tuint32_t sctps_markedretrans;\n\tuint32_t sctps_naglesent;\t/* nagle allowed sending      */\n\tuint32_t sctps_naglequeued;\t/* nagle doesn't allow sending */\n\tuint32_t sctps_maxburstqueued;\t/* max burst doesn't allow sending */\n\tuint32_t sctps_ifnomemqueued;\t/* look ahead tells us no memory in\n\t\t\t\t\t * interface ring buffer OR we had a\n\t\t\t\t\t * send error and are queuing one\n\t\t\t\t\t * send. */\n\tuint32_t sctps_windowprobed;\t/* total number of window probes sent */\n\tuint32_t sctps_lowlevelerr;\t/* total times an output error causes\n\t\t\t\t\t * us to clamp down on next user send. */\n\tuint32_t sctps_lowlevelerrusr;\t/* total times sctp_senderrors were\n\t\t\t\t\t * caused from a user send from a user\n\t\t\t\t\t * invoked send not a sack response */\n\tuint32_t sctps_datadropchklmt;\t/* Number of in data drops due to\n\t\t\t\t\t * chunk limit reached */\n\tuint32_t sctps_datadroprwnd;\t/* Number of in data drops due to rwnd\n\t\t\t\t\t * limit reached */\n\tuint32_t sctps_ecnereducedcwnd;\t/* Number of times a ECN reduced the\n\t\t\t\t\t * cwnd */\n\tuint32_t sctps_vtagexpress;\t/* Used express lookup via vtag */\n\tuint32_t sctps_vtagbogus;\t/* Collision in express lookup. */\n\tuint32_t sctps_primary_randry;\t/* Number of times the sender ran dry\n\t\t\t\t\t * of user data on primary */\n\tuint32_t sctps_cmt_randry;\t/* Same for above */\n\tuint32_t sctps_slowpath_sack;\t/* Sacks the slow way */\n\tuint32_t sctps_wu_sacks_sent;\t/* Window Update only sacks sent */\n\tuint32_t sctps_sends_with_flags;\t/* number of sends with\n\t\t\t\t\t\t * sinfo_flags !=0 */\n\tuint32_t sctps_sends_with_unord;\t/* number of unordered sends */\n\tuint32_t sctps_sends_with_eof;\t/* number of sends with EOF flag set */\n\tuint32_t sctps_sends_with_abort;\t/* number of sends with ABORT\n\t\t\t\t\t\t * flag set */\n\tuint32_t sctps_protocol_drain_calls;\t/* number of times protocol\n\t\t\t\t\t\t * drain called */\n\tuint32_t sctps_protocol_drains_done;\t/* number of times we did a\n\t\t\t\t\t\t * protocol drain */\n\tuint32_t sctps_read_peeks;\t/* Number of times recv was called\n\t\t\t\t\t * with peek */\n\tuint32_t sctps_cached_chk;\t/* Number of cached chunks used */\n\tuint32_t sctps_cached_strmoq;\t/* Number of cached stream oq's used */\n\tuint32_t sctps_left_abandon;\t/* Number of unread messages abandoned\n\t\t\t\t\t * by close */\n\tuint32_t sctps_send_burst_avoid;\t/* Unused */\n\tuint32_t sctps_send_cwnd_avoid;\t/* Send cwnd full  avoidance, already\n\t\t\t\t\t * max burst inflight to net */\n\tuint32_t sctps_fwdtsn_map_over;\t/* number of map array over-runs via\n\t\t\t\t\t * fwd-tsn's */\n\tuint32_t sctps_queue_upd_ecne;\t/* Number of times we queued or\n\t\t\t\t\t * updated an ECN chunk on send queue */\n\tuint32_t sctps_reserved[31];\t/* Future ABI compat - remove int's\n\t\t\t\t\t * from here when adding new */\n};\n\n#define SCTP_STAT_INCR(_x) SCTP_STAT_INCR_BY(_x,1)\n#define SCTP_STAT_DECR(_x) SCTP_STAT_DECR_BY(_x,1)\n#if defined(__FreeBSD__) && defined(SMP) && defined(SCTP_USE_PERCPU_STAT)\n#define SCTP_STAT_INCR_BY(_x,_d) (SCTP_BASE_STATS[PCPU_GET(cpuid)]._x += _d)\n#define SCTP_STAT_DECR_BY(_x,_d) (SCTP_BASE_STATS[PCPU_GET(cpuid)]._x -= _d)\n#else\n#define SCTP_STAT_INCR_BY(_x,_d) atomic_add_int(&SCTP_BASE_STAT(_x), _d)\n#define SCTP_STAT_DECR_BY(_x,_d) atomic_subtract_int(&SCTP_BASE_STAT(_x), _d)\n#endif\n/* The following macros are for handling MIB values, */\n#define SCTP_STAT_INCR_COUNTER32(_x) SCTP_STAT_INCR(_x)\n#define SCTP_STAT_INCR_COUNTER64(_x) SCTP_STAT_INCR(_x)\n#define SCTP_STAT_INCR_GAUGE32(_x) SCTP_STAT_INCR(_x)\n#define SCTP_STAT_DECR_COUNTER32(_x) SCTP_STAT_DECR(_x)\n#define SCTP_STAT_DECR_COUNTER64(_x) SCTP_STAT_DECR(_x)\n#define SCTP_STAT_DECR_GAUGE32(_x) SCTP_STAT_DECR(_x)\n\nunion sctp_sockstore {\n#if defined(INET) || !defined(_KERNEL)\n\tstruct sockaddr_in sin;\n#endif\n#if defined(INET6) || !defined(_KERNEL)\n\tstruct sockaddr_in6 sin6;\n#endif\n\tstruct sockaddr sa;\n};\n\n\n/***********************************/\n/* And something for us old timers */\n/***********************************/\n\n#ifndef ntohll\n#include <sys/endian.h>\n#define ntohll(x) be64toh(x)\n#endif\n\n#ifndef htonll\n#include <sys/endian.h>\n#define htonll(x) htobe64(x)\n#endif\n/***********************************/\n\n\nstruct xsctp_inpcb {\n\tuint32_t last;\n\tuint32_t flags;\n\tuint32_t features;\n\tuint32_t total_sends;\n\tuint32_t total_recvs;\n\tuint32_t total_nospaces;\n\tuint32_t fragmentation_point;\n\tuint16_t local_port;\n\tuint16_t qlen;\n\tuint16_t maxqlen;\n\tuint32_t extra_padding[32];\t/* future */\n};\n\nstruct xsctp_tcb {\n\tunion sctp_sockstore primary_addr;\t/* sctpAssocEntry 5/6 */\n\tuint32_t last;\n\tuint32_t heartbeat_interval;\t/* sctpAssocEntry 7   */\n\tuint32_t state;\t\t/* sctpAssocEntry 8   */\n\tuint32_t in_streams;\t/* sctpAssocEntry 9   */\n\tuint32_t out_streams;\t/* sctpAssocEntry 10  */\n\tuint32_t max_nr_retrans;/* sctpAssocEntry 11  */\n\tuint32_t primary_process;\t/* sctpAssocEntry 12  */\n\tuint32_t T1_expireries;\t/* sctpAssocEntry 13  */\n\tuint32_t T2_expireries;\t/* sctpAssocEntry 14  */\n\tuint32_t retransmitted_tsns;\t/* sctpAssocEntry 15  */\n\tuint32_t total_sends;\n\tuint32_t total_recvs;\n\tuint32_t local_tag;\n\tuint32_t remote_tag;\n\tuint32_t initial_tsn;\n\tuint32_t highest_tsn;\n\tuint32_t cumulative_tsn;\n\tuint32_t cumulative_tsn_ack;\n\tuint32_t mtu;\n\tuint32_t refcnt;\n\tuint16_t local_port;\t/* sctpAssocEntry 3   */\n\tuint16_t remote_port;\t/* sctpAssocEntry 4   */\n\tstruct sctp_timeval start_time;\t/* sctpAssocEntry 16  */\n\tstruct sctp_timeval discontinuity_time;\t/* sctpAssocEntry 17  */\n\tuint32_t peers_rwnd;\n\tsctp_assoc_t assoc_id;\t/* sctpAssocEntry 1   */\n\tuint32_t extra_padding[32];\t/* future */\n};\n\nstruct xsctp_laddr {\n\tunion sctp_sockstore address;\t/* sctpAssocLocalAddrEntry 1/2 */\n\tuint32_t last;\n\tstruct sctp_timeval start_time;\t/* sctpAssocLocalAddrEntry 3   */\n\tuint32_t extra_padding[32];\t/* future */\n};\n\nstruct xsctp_raddr {\n\tunion sctp_sockstore address;\t/* sctpAssocLocalRemEntry 1/2 */\n\tuint32_t last;\n\tuint32_t rto;\t\t/* sctpAssocLocalRemEntry 5   */\n\tuint32_t max_path_rtx;\t/* sctpAssocLocalRemEntry 6   */\n\tuint32_t rtx;\t\t/* sctpAssocLocalRemEntry 7   */\n\tuint32_t error_counter;\t/* */\n\tuint32_t cwnd;\t\t/* */\n\tuint32_t flight_size;\t/* */\n\tuint32_t mtu;\t\t/* */\n\tuint8_t active;\t\t/* sctpAssocLocalRemEntry 3   */\n\tuint8_t confirmed;\t/* */\n\tuint8_t heartbeat_enabled;\t/* sctpAssocLocalRemEntry 4   */\n\tuint8_t potentially_failed;\n\tstruct sctp_timeval start_time;\t/* sctpAssocLocalRemEntry 8   */\n\tuint32_t rtt;\n\tuint32_t heartbeat_interval;\n\tuint32_t extra_padding[31];\t/* future */\n};\n\n#define SCTP_MAX_LOGGING_SIZE 30000\n#define SCTP_TRACE_PARAMS 6\t/* This number MUST be even   */\n\nstruct sctp_log_entry {\n\tuint64_t timestamp;\n\tuint32_t subsys;\n\tuint32_t padding;\n\tuint32_t params[SCTP_TRACE_PARAMS];\n};\n\nstruct sctp_log {\n\tstruct sctp_log_entry entry[SCTP_MAX_LOGGING_SIZE];\n\tuint32_t index;\n\tuint32_t padding;\n};\n\n/*\n * Kernel defined for sctp_send\n */\n#if defined(_KERNEL) || defined(__Userspace__)\nint\nsctp_lower_sosend(struct socket *so,\n    struct sockaddr *addr,\n    struct uio *uio,\n    struct mbuf *i_pak,\n    struct mbuf *control,\n    int flags,\n    struct sctp_sndrcvinfo *srcv\n    ,struct thread *p\n);\n\nint\nsctp_sorecvmsg(struct socket *so,\n    struct uio *uio,\n    struct mbuf **mp,\n    struct sockaddr *from,\n    int fromlen,\n    int *msg_flags,\n    struct sctp_sndrcvinfo *sinfo,\n    int filling_sinfo);\n\n#endif\n\n/*\n * API system calls\n */\n#if !(defined(_KERNEL)) && !(defined(__Userspace__))\n\n__BEGIN_DECLS\nint sctp_peeloff __P((int, sctp_assoc_t));\nint sctp_bindx __P((int, struct sockaddr *, int, int));\nint sctp_connectx __P((int, const struct sockaddr *, int, sctp_assoc_t *));\nint sctp_getaddrlen __P((sa_family_t));\nint sctp_getpaddrs __P((int, sctp_assoc_t, struct sockaddr **));\nvoid sctp_freepaddrs __P((struct sockaddr *));\nint sctp_getladdrs __P((int, sctp_assoc_t, struct sockaddr **));\nvoid sctp_freeladdrs __P((struct sockaddr *));\nint sctp_opt_info __P((int, sctp_assoc_t, int, void *, socklen_t *));\n\n/* deprecated */\nssize_t sctp_sendmsg \n__P((int, const void *, size_t, const struct sockaddr *,\n    socklen_t, uint32_t, uint32_t, uint16_t, uint32_t, uint32_t));\n\n/* deprecated */\n\tssize_t sctp_send __P((int, const void *, size_t,\n              const struct sctp_sndrcvinfo *, int));\n\n/* deprecated */\n\tssize_t sctp_sendx __P((int, const void *, size_t, struct sockaddr *,\n               int, struct sctp_sndrcvinfo *, int));\n\n/* deprecated */\n\tssize_t sctp_sendmsgx __P((int sd, const void *, size_t, struct sockaddr *,\n                  int, uint32_t, uint32_t, uint16_t, uint32_t, uint32_t));\n\n\tsctp_assoc_t sctp_getassocid __P((int, struct sockaddr *));\n\n/* deprecated */\n\tssize_t sctp_recvmsg __P((int, void *, size_t, struct sockaddr *, socklen_t *,\n                 struct sctp_sndrcvinfo *, int *));\n\n\tssize_t sctp_sendv __P((int, const struct iovec *, int, struct sockaddr *,\n               int, void *, socklen_t, unsigned int, int));\n\n\tssize_t sctp_recvv __P((int, const struct iovec *, int, struct sockaddr *,\n               socklen_t *, void *, socklen_t *, unsigned int *, int *));\n\n__END_DECLS\n\n#endif\t\t\t\t/* !_KERNEL */\n#endif\t\t\t\t/* !__sctp_uio_h__ */\n"
  },
  {
    "path": "freebsd-headers/netinet/sctp_var.h",
    "content": "/*-\n * Copyright (c) 2001-2008, by Cisco Systems, Inc. All rights reserved.\n * Copyright (c) 2008-2011, by Randall Stewart. All rights reserved.\n * Copyright (c) 2008-2011, by Michael Tuexen. All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions are met:\n *\n * a) Redistributions of source code must retain the above copyright notice,\n *   this list of conditions and the following disclaimer.\n *\n * b) Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in\n *   the documentation and/or other materials provided with the distribution.\n *\n * c) Neither the name of Cisco Systems, Inc. nor the names of its\n *    contributors may be used to endorse or promote products derived\n *    from this software without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n * \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,\n * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE\n * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\n * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\n * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\n * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\n * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF\n * THE POSSIBILITY OF SUCH DAMAGE.\n */\n\n/* $KAME: sctp_var.h,v 1.24 2005/03/06 16:04:19 itojun Exp $\t */\n\n#include <sys/cdefs.h>\n__FBSDID(\"$FreeBSD: release/9.0.0/sys/netinet/sctp_var.h 224641 2011-08-03 20:21:00Z tuexen $\");\n\n#ifndef _NETINET_SCTP_VAR_H_\n#define _NETINET_SCTP_VAR_H_\n\n#include <netinet/sctp_uio.h>\n\n#if defined(_KERNEL) || defined(__Userspace__)\n\nextern struct pr_usrreqs sctp_usrreqs;\n\n\n#define sctp_feature_on(inp, feature)  (inp->sctp_features |= feature)\n#define sctp_feature_off(inp, feature) (inp->sctp_features &= ~feature)\n#define sctp_is_feature_on(inp, feature) ((inp->sctp_features & feature) == feature)\n#define sctp_is_feature_off(inp, feature) ((inp->sctp_features & feature) == 0)\n\n#define sctp_stcb_feature_on(inp, stcb, feature) {\\\n\tif (stcb) { \\\n\t\tstcb->asoc.sctp_features |= feature; \\\n\t} else { \\\n\t\tinp->sctp_features |= feature; \\\n\t} \\\n}\n#define sctp_stcb_feature_off(inp, stcb, feature) {\\\n\tif (stcb) { \\\n\t\tstcb->asoc.sctp_features &= ~feature; \\\n\t} else { \\\n\t\tinp->sctp_features &= ~feature; \\\n\t} \\\n}\n#define sctp_stcb_is_feature_on(inp, stcb, feature) \\\n\t(((stcb != NULL) && \\\n\t  ((stcb->asoc.sctp_features & feature) == feature)) || \\\n\t ((stcb == NULL) && \\\n\t  ((inp->sctp_features & feature) == feature)))\n#define sctp_stcb_is_feature_off(inp, stcb, feature) \\\n\t(((stcb != NULL) && \\\n\t  ((stcb->asoc.sctp_features & feature) == 0)) || \\\n\t ((stcb == NULL) && \\\n\t  ((inp->sctp_features & feature) == 0)))\n\n/* managing mobility_feature in inpcb (by micchie) */\n#define sctp_mobility_feature_on(inp, feature)  (inp->sctp_mobility_features |= feature)\n#define sctp_mobility_feature_off(inp, feature) (inp->sctp_mobility_features &= ~feature)\n#define sctp_is_mobility_feature_on(inp, feature) (inp->sctp_mobility_features & feature)\n#define sctp_is_mobility_feature_off(inp, feature) ((inp->sctp_mobility_features & feature) == 0)\n\n#define sctp_maxspace(sb) (max((sb)->sb_hiwat,SCTP_MINIMAL_RWND))\n\n#define\tsctp_sbspace(asoc, sb) ((long) ((sctp_maxspace(sb) > (asoc)->sb_cc) ? (sctp_maxspace(sb) - (asoc)->sb_cc) : 0))\n\n#define\tsctp_sbspace_failedmsgs(sb) ((long) ((sctp_maxspace(sb) > (sb)->sb_cc) ? (sctp_maxspace(sb) - (sb)->sb_cc) : 0))\n\n#define sctp_sbspace_sub(a,b) ((a > b) ? (a - b) : 0)\n\n/*\n * I tried to cache the readq entries at one point. But the reality\n * is that it did not add any performance since this meant we had to\n * lock the STCB on read. And at that point once you have to do an\n * extra lock, it really does not matter if the lock is in the ZONE\n * stuff or in our code. Note that this same problem would occur with\n * an mbuf cache as well so it is not really worth doing, at least\n * right now :-D\n */\n\n#define sctp_free_a_readq(_stcb, _readq) { \\\n\tSCTP_ZONE_FREE(SCTP_BASE_INFO(ipi_zone_readq), (_readq)); \\\n\tSCTP_DECR_READQ_COUNT(); \\\n}\n\n#define sctp_alloc_a_readq(_stcb, _readq) { \\\n\t(_readq) = SCTP_ZONE_GET(SCTP_BASE_INFO(ipi_zone_readq), struct sctp_queued_to_read); \\\n\tif ((_readq)) { \\\n \t     SCTP_INCR_READQ_COUNT(); \\\n\t} \\\n}\n\n#define sctp_free_a_strmoq(_stcb, _strmoq, _so_locked) { \\\n\tif ((_strmoq)->holds_key_ref) { \\\n\t\tsctp_auth_key_release(stcb, sp->auth_keyid, _so_locked); \\\n\t\t(_strmoq)->holds_key_ref = 0; \\\n\t} \\\n\tSCTP_ZONE_FREE(SCTP_BASE_INFO(ipi_zone_strmoq), (_strmoq)); \\\n\tSCTP_DECR_STRMOQ_COUNT(); \\\n}\n\n#define sctp_alloc_a_strmoq(_stcb, _strmoq) { \\\n\t(_strmoq) = SCTP_ZONE_GET(SCTP_BASE_INFO(ipi_zone_strmoq), struct sctp_stream_queue_pending); \\\n         if ((_strmoq)) {\t\t\t  \\\n\t\tmemset(_strmoq, 0, sizeof(struct sctp_stream_queue_pending)); \\\n\t\tSCTP_INCR_STRMOQ_COUNT(); \\\n\t\t(_strmoq)->holds_key_ref = 0; \\\n \t} \\\n}\n\n#define sctp_free_a_chunk(_stcb, _chk, _so_locked) { \\\n\tif ((_chk)->holds_key_ref) {\\\n\t\tsctp_auth_key_release((_stcb), (_chk)->auth_keyid, _so_locked); \\\n\t\t(_chk)->holds_key_ref = 0; \\\n\t} \\\n        if (_stcb) { \\\n          SCTP_TCB_LOCK_ASSERT((_stcb)); \\\n          if ((_chk)->whoTo) { \\\n                  sctp_free_remote_addr((_chk)->whoTo); \\\n                  (_chk)->whoTo = NULL; \\\n          } \\\n          if (((_stcb)->asoc.free_chunk_cnt > SCTP_BASE_SYSCTL(sctp_asoc_free_resc_limit)) || \\\n               (SCTP_BASE_INFO(ipi_free_chunks) > SCTP_BASE_SYSCTL(sctp_system_free_resc_limit))) { \\\n\t \tSCTP_ZONE_FREE(SCTP_BASE_INFO(ipi_zone_chunk), (_chk)); \\\n\t \tSCTP_DECR_CHK_COUNT(); \\\n\t  } else { \\\n\t \tTAILQ_INSERT_TAIL(&(_stcb)->asoc.free_chunks, (_chk), sctp_next); \\\n\t \t(_stcb)->asoc.free_chunk_cnt++; \\\n\t \tatomic_add_int(&SCTP_BASE_INFO(ipi_free_chunks), 1); \\\n          } \\\n        } else { \\\n\t\tSCTP_ZONE_FREE(SCTP_BASE_INFO(ipi_zone_chunk), (_chk)); \\\n\t\tSCTP_DECR_CHK_COUNT(); \\\n\t} \\\n}\n\n#define sctp_alloc_a_chunk(_stcb, _chk) { \\\n\tif (TAILQ_EMPTY(&(_stcb)->asoc.free_chunks))  { \\\n\t\t(_chk) = SCTP_ZONE_GET(SCTP_BASE_INFO(ipi_zone_chunk), struct sctp_tmit_chunk); \\\n\t\tif ((_chk)) { \\\n\t\t\tSCTP_INCR_CHK_COUNT(); \\\n                        (_chk)->whoTo = NULL; \\\n\t\t\t(_chk)->holds_key_ref = 0; \\\n\t\t} \\\n\t} else { \\\n\t\t(_chk) = TAILQ_FIRST(&(_stcb)->asoc.free_chunks); \\\n\t\tTAILQ_REMOVE(&(_stcb)->asoc.free_chunks, (_chk), sctp_next); \\\n\t\tatomic_subtract_int(&SCTP_BASE_INFO(ipi_free_chunks), 1); \\\n\t\t(_chk)->holds_key_ref = 0; \\\n                SCTP_STAT_INCR(sctps_cached_chk); \\\n\t\t(_stcb)->asoc.free_chunk_cnt--; \\\n\t} \\\n}\n\n\n#define sctp_free_remote_addr(__net) { \\\n\tif ((__net)) {  \\\n\t\tif (SCTP_DECREMENT_AND_CHECK_REFCOUNT(&(__net)->ref_count)) { \\\n\t\t\t(void)SCTP_OS_TIMER_STOP(&(__net)->rxt_timer.timer); \\\n\t\t\t(void)SCTP_OS_TIMER_STOP(&(__net)->pmtu_timer.timer); \\\n                        if ((__net)->ro.ro_rt) { \\\n\t\t\t\tRTFREE((__net)->ro.ro_rt); \\\n\t\t\t\t(__net)->ro.ro_rt = NULL; \\\n                        } \\\n\t\t\tif ((__net)->src_addr_selected) { \\\n\t\t\t\tsctp_free_ifa((__net)->ro._s_addr); \\\n\t\t\t\t(__net)->ro._s_addr = NULL; \\\n\t\t\t} \\\n                        (__net)->src_addr_selected = 0; \\\n\t\t\t(__net)->dest_state &= ~SCTP_ADDR_REACHABLE; \\\n\t\t\tSCTP_ZONE_FREE(SCTP_BASE_INFO(ipi_zone_net), (__net)); \\\n\t\t\tSCTP_DECR_RADDR_COUNT(); \\\n\t\t} \\\n\t} \\\n}\n\n#define sctp_sbfree(ctl, stcb, sb, m) { \\\n\tSCTP_SAVE_ATOMIC_DECREMENT(&(sb)->sb_cc, SCTP_BUF_LEN((m))); \\\n\tSCTP_SAVE_ATOMIC_DECREMENT(&(sb)->sb_mbcnt, MSIZE); \\\n\tif (((ctl)->do_not_ref_stcb == 0) && stcb) {\\\n\t\tSCTP_SAVE_ATOMIC_DECREMENT(&(stcb)->asoc.sb_cc, SCTP_BUF_LEN((m))); \\\n\t\tSCTP_SAVE_ATOMIC_DECREMENT(&(stcb)->asoc.my_rwnd_control_len, MSIZE); \\\n\t} \\\n\tif (SCTP_BUF_TYPE(m) != MT_DATA && SCTP_BUF_TYPE(m) != MT_HEADER && \\\n\t    SCTP_BUF_TYPE(m) != MT_OOBDATA) \\\n\t\tatomic_subtract_int(&(sb)->sb_ctl,SCTP_BUF_LEN((m))); \\\n}\n\n#define sctp_sballoc(stcb, sb, m) { \\\n\tatomic_add_int(&(sb)->sb_cc,SCTP_BUF_LEN((m))); \\\n\tatomic_add_int(&(sb)->sb_mbcnt, MSIZE); \\\n\tif (stcb) { \\\n\t\tatomic_add_int(&(stcb)->asoc.sb_cc,SCTP_BUF_LEN((m))); \\\n\t\tatomic_add_int(&(stcb)->asoc.my_rwnd_control_len, MSIZE); \\\n\t} \\\n\tif (SCTP_BUF_TYPE(m) != MT_DATA && SCTP_BUF_TYPE(m) != MT_HEADER && \\\n\t    SCTP_BUF_TYPE(m) != MT_OOBDATA) \\\n\t\tatomic_add_int(&(sb)->sb_ctl,SCTP_BUF_LEN((m))); \\\n}\n\n\n#define sctp_ucount_incr(val) { \\\n\tval++; \\\n}\n\n#define sctp_ucount_decr(val) { \\\n\tif (val > 0) { \\\n\t\tval--; \\\n\t} else { \\\n\t\tval = 0; \\\n\t} \\\n}\n\n#define sctp_mbuf_crush(data) do { \\\n\tstruct mbuf *_m; \\\n\t_m = (data); \\\n\twhile(_m && (SCTP_BUF_LEN(_m) == 0)) { \\\n\t\t(data)  = SCTP_BUF_NEXT(_m); \\\n\t\tSCTP_BUF_NEXT(_m) = NULL; \\\n\t\tsctp_m_free(_m); \\\n\t\t_m = (data); \\\n\t} \\\n} while (0)\n\n#define sctp_flight_size_decrease(tp1) do { \\\n\tif (tp1->whoTo->flight_size >= tp1->book_size) \\\n\t\ttp1->whoTo->flight_size -= tp1->book_size; \\\n\telse \\\n\t\ttp1->whoTo->flight_size = 0; \\\n} while (0)\n\n#define sctp_flight_size_increase(tp1) do { \\\n       (tp1)->whoTo->flight_size += (tp1)->book_size; \\\n} while (0)\n\n#ifdef SCTP_FS_SPEC_LOG\n#define sctp_total_flight_decrease(stcb, tp1) do { \\\n        if (stcb->asoc.fs_index > SCTP_FS_SPEC_LOG_SIZE) \\\n\t\tstcb->asoc.fs_index = 0;\\\n\tstcb->asoc.fslog[stcb->asoc.fs_index].total_flight = stcb->asoc.total_flight; \\\n\tstcb->asoc.fslog[stcb->asoc.fs_index].tsn = tp1->rec.data.TSN_seq; \\\n\tstcb->asoc.fslog[stcb->asoc.fs_index].book = tp1->book_size; \\\n\tstcb->asoc.fslog[stcb->asoc.fs_index].sent = tp1->sent; \\\n\tstcb->asoc.fslog[stcb->asoc.fs_index].incr = 0; \\\n\tstcb->asoc.fslog[stcb->asoc.fs_index].decr = 1; \\\n\tstcb->asoc.fs_index++; \\\n        tp1->window_probe = 0; \\\n\tif (stcb->asoc.total_flight >= tp1->book_size) { \\\n\t\tstcb->asoc.total_flight -= tp1->book_size; \\\n\t\tif (stcb->asoc.total_flight_count > 0) \\\n\t\t\tstcb->asoc.total_flight_count--; \\\n\t} else { \\\n\t\tstcb->asoc.total_flight = 0; \\\n\t\tstcb->asoc.total_flight_count = 0; \\\n\t} \\\n} while (0)\n\n#define sctp_total_flight_increase(stcb, tp1) do { \\\n        if (stcb->asoc.fs_index > SCTP_FS_SPEC_LOG_SIZE) \\\n\t\tstcb->asoc.fs_index = 0;\\\n\tstcb->asoc.fslog[stcb->asoc.fs_index].total_flight = stcb->asoc.total_flight; \\\n\tstcb->asoc.fslog[stcb->asoc.fs_index].tsn = tp1->rec.data.TSN_seq; \\\n\tstcb->asoc.fslog[stcb->asoc.fs_index].book = tp1->book_size; \\\n\tstcb->asoc.fslog[stcb->asoc.fs_index].sent = tp1->sent; \\\n\tstcb->asoc.fslog[stcb->asoc.fs_index].incr = 1; \\\n\tstcb->asoc.fslog[stcb->asoc.fs_index].decr = 0; \\\n\tstcb->asoc.fs_index++; \\\n       (stcb)->asoc.total_flight_count++; \\\n       (stcb)->asoc.total_flight += (tp1)->book_size; \\\n} while (0)\n\n#else\n\n#define sctp_total_flight_decrease(stcb, tp1) do { \\\n        tp1->window_probe = 0; \\\n\tif (stcb->asoc.total_flight >= tp1->book_size) { \\\n\t\tstcb->asoc.total_flight -= tp1->book_size; \\\n\t\tif (stcb->asoc.total_flight_count > 0) \\\n\t\t\tstcb->asoc.total_flight_count--; \\\n\t} else { \\\n\t\tstcb->asoc.total_flight = 0; \\\n\t\tstcb->asoc.total_flight_count = 0; \\\n\t} \\\n} while (0)\n\n#define sctp_total_flight_increase(stcb, tp1) do { \\\n       (stcb)->asoc.total_flight_count++; \\\n       (stcb)->asoc.total_flight += (tp1)->book_size; \\\n} while (0)\n\n#endif\n\n#define SCTP_PF_ENABLED(_net) (_net->pf_threshold < _net->failure_threshold)\n#define SCTP_NET_IS_PF(_net) (_net->pf_threshold < _net->error_count)\n\nstruct sctp_nets;\nstruct sctp_inpcb;\nstruct sctp_tcb;\nstruct sctphdr;\n\n\nvoid sctp_close(struct socket *so);\nint sctp_disconnect(struct socket *so);\n\nvoid sctp_ctlinput __P((int, struct sockaddr *, void *));\nint sctp_ctloutput __P((struct socket *, struct sockopt *));\n\n#ifdef INET\nvoid sctp_input_with_port __P((struct mbuf *, int, uint16_t));\n\n#endif\n#ifdef INET\nvoid sctp_input __P((struct mbuf *, int));\n\n#endif\nvoid sctp_pathmtu_adjustment __P((struct sctp_inpcb *, struct sctp_tcb *, struct sctp_nets *, uint16_t));\nvoid sctp_drain __P((void));\nvoid sctp_init __P((void));\n\nvoid sctp_finish(void);\n\nint sctp_flush(struct socket *, int);\nint sctp_shutdown __P((struct socket *));\nvoid sctp_notify \n__P((struct sctp_inpcb *, struct ip *ip, struct sctphdr *,\n    struct sockaddr *, struct sctp_tcb *,\n    struct sctp_nets *));\n\n\tint sctp_bindx(struct socket *, int, struct sockaddr_storage *,\n        int, int, struct proc *);\n\n/* can't use sctp_assoc_t here */\n\tint sctp_peeloff(struct socket *, struct socket *, int, caddr_t, int *);\n\n\tint sctp_ingetaddr(struct socket *,\n        struct sockaddr **\n);\n\n\tint sctp_peeraddr(struct socket *,\n        struct sockaddr **\n);\n\n\tint sctp_listen(struct socket *, int, struct thread *);\n\n\tint sctp_accept(struct socket *, struct sockaddr **);\n\n#endif\t\t\t\t/* _KERNEL */\n\n#endif\t\t\t\t/* !_NETINET_SCTP_VAR_H_ */\n"
  },
  {
    "path": "freebsd-headers/netinet/sctputil.h",
    "content": "/*-\n * Copyright (c) 2001-2007, by Cisco Systems, Inc. All rights reserved.\n * Copyright (c) 2008-2011, by Randall Stewart. All rights reserved.\n * Copyright (c) 2008-2011, by Michael Tuexen. All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions are met:\n *\n * a) Redistributions of source code must retain the above copyright notice,\n *   this list of conditions and the following disclaimer.\n *\n * b) Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in\n *   the documentation and/or other materials provided with the distribution.\n *\n * c) Neither the name of Cisco Systems, Inc. nor the names of its\n *    contributors may be used to endorse or promote products derived\n *    from this software without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n * \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,\n * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE\n * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\n * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\n * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\n * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\n * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF\n * THE POSSIBILITY OF SUCH DAMAGE.\n */\n\n\n/* $KAME: sctputil.h,v 1.15 2005/03/06 16:04:19 itojun Exp $\t */\n\n#include <sys/cdefs.h>\n__FBSDID(\"$FreeBSD: release/9.0.0/sys/netinet/sctputil.h 222459 2011-05-29 18:41:06Z tuexen $\");\n#ifndef __sctputil_h__\n#define __sctputil_h__\n\n\n#if defined(_KERNEL) || defined(__Userspace__)\n\n#define SCTP_READ_LOCK_HELD 1\n#define SCTP_READ_LOCK_NOT_HELD 0\n\n#ifdef SCTP_ASOCLOG_OF_TSNS\nvoid sctp_print_out_track_log(struct sctp_tcb *stcb);\n\n#endif\n\n#ifdef SCTP_MBUF_LOGGING\nstruct mbuf *sctp_m_free(struct mbuf *m);\nvoid sctp_m_freem(struct mbuf *m);\n\n#else\n#define sctp_m_free m_free\n#define sctp_m_freem m_freem\n#endif\n\n#if defined(SCTP_LOCAL_TRACE_BUF) || defined(__APPLE__)\nvoid\n     sctp_log_trace(uint32_t fr, const char *str SCTP_UNUSED, uint32_t a, uint32_t b, uint32_t c, uint32_t d, uint32_t e, uint32_t f);\n\n#endif\n\n#define sctp_get_associd(stcb) ((sctp_assoc_t)stcb->asoc.assoc_id)\n\n\n/*\n * Function prototypes\n */\nuint32_t\nsctp_get_ifa_hash_val(struct sockaddr *addr);\n\nstruct sctp_ifa *\n         sctp_find_ifa_in_ep(struct sctp_inpcb *inp, struct sockaddr *addr, int hold_lock);\n\nstruct sctp_ifa *\n         sctp_find_ifa_by_addr(struct sockaddr *addr, uint32_t vrf_id, int holds_lock);\n\nuint32_t sctp_select_initial_TSN(struct sctp_pcb *);\n\nuint32_t sctp_select_a_tag(struct sctp_inpcb *, uint16_t lport, uint16_t rport, int);\n\nint sctp_init_asoc(struct sctp_inpcb *, struct sctp_tcb *, uint32_t, uint32_t);\n\nvoid sctp_fill_random_store(struct sctp_pcb *);\n\nvoid\nsctp_timer_start(int, struct sctp_inpcb *, struct sctp_tcb *,\n    struct sctp_nets *);\n\nvoid\nsctp_timer_stop(int, struct sctp_inpcb *, struct sctp_tcb *,\n    struct sctp_nets *, uint32_t);\n\nint\n    sctp_dynamic_set_primary(struct sockaddr *sa, uint32_t vrf_id);\n\nvoid\n     sctp_mtu_size_reset(struct sctp_inpcb *, struct sctp_association *, uint32_t);\n\nvoid\nsctp_add_to_readq(struct sctp_inpcb *inp,\n    struct sctp_tcb *stcb,\n    struct sctp_queued_to_read *control,\n    struct sockbuf *sb,\n    int end,\n    int inpread_locked,\n    int so_locked\n#if !defined(__APPLE__) && !defined(SCTP_SO_LOCK_TESTING)\n    SCTP_UNUSED\n#endif\n);\n\nint\nsctp_append_to_readq(struct sctp_inpcb *inp,\n    struct sctp_tcb *stcb,\n    struct sctp_queued_to_read *control,\n    struct mbuf *m,\n    int end,\n    int new_cumack,\n    struct sockbuf *sb);\n\n\nvoid sctp_iterator_worker(void);\n\nuint32_t sctp_get_prev_mtu(uint32_t);\nuint32_t sctp_get_next_mtu(struct sctp_inpcb *, uint32_t);\n\nvoid\n     sctp_timeout_handler(void *);\n\nuint32_t\nsctp_calculate_rto(struct sctp_tcb *, struct sctp_association *,\n    struct sctp_nets *, struct timeval *, int, int);\n\nuint32_t sctp_calculate_len(struct mbuf *);\n\ncaddr_t sctp_m_getptr(struct mbuf *, int, int, uint8_t *);\n\nstruct sctp_paramhdr *\nsctp_get_next_param(struct mbuf *, int,\n    struct sctp_paramhdr *, int);\n\nint sctp_add_pad_tombuf(struct mbuf *, int);\n\nint sctp_pad_lastmbuf(struct mbuf *, int, struct mbuf *);\n\nvoid \nsctp_ulp_notify(uint32_t, struct sctp_tcb *, uint32_t, void *, int\n#if !defined(__APPLE__) && !defined(SCTP_SO_LOCK_TESTING)\n    SCTP_UNUSED\n#endif\n);\n\nvoid\nsctp_pull_off_control_to_new_inp(struct sctp_inpcb *old_inp,\n    struct sctp_inpcb *new_inp,\n    struct sctp_tcb *stcb, int waitflags);\n\n\nvoid sctp_stop_timers_for_shutdown(struct sctp_tcb *);\n\nvoid \nsctp_report_all_outbound(struct sctp_tcb *, int, int\n#if !defined(__APPLE__) && !defined(SCTP_SO_LOCK_TESTING)\n    SCTP_UNUSED\n#endif\n);\n\nint sctp_expand_mapping_array(struct sctp_association *, uint32_t);\n\nvoid \nsctp_abort_notification(struct sctp_tcb *, int, int\n#if !defined(__APPLE__) && !defined(SCTP_SO_LOCK_TESTING)\n    SCTP_UNUSED\n#endif\n);\n\n/* We abort responding to an IP packet for some reason */\nvoid\nsctp_abort_association(struct sctp_inpcb *, struct sctp_tcb *,\n    struct mbuf *, int, struct sctphdr *, struct mbuf *, uint32_t, uint16_t);\n\n\n/* We choose to abort via user input */\nvoid\nsctp_abort_an_association(struct sctp_inpcb *, struct sctp_tcb *, int,\n    struct mbuf *, int\n#if !defined(__APPLE__) && !defined(SCTP_SO_LOCK_TESTING)\n    SCTP_UNUSED\n#endif\n);\n\nvoid \nsctp_handle_ootb(struct mbuf *, int, int, struct sctphdr *,\n    struct sctp_inpcb *, struct mbuf *, uint32_t, uint16_t);\n\nint \nsctp_connectx_helper_add(struct sctp_tcb *stcb, struct sockaddr *addr,\n    int totaddr, int *error);\n\nstruct sctp_tcb *\nsctp_connectx_helper_find(struct sctp_inpcb *inp, struct sockaddr *addr,\n    int *totaddr, int *num_v4, int *num_v6, int *error, int limit, int *bad_addr);\n\nint sctp_is_there_an_abort_here(struct mbuf *, int, uint32_t *);\n\n#ifdef INET6\nuint32_t sctp_is_same_scope(struct sockaddr_in6 *, struct sockaddr_in6 *);\n\nstruct sockaddr_in6 *\n             sctp_recover_scope(struct sockaddr_in6 *, struct sockaddr_in6 *);\n\n#define sctp_recover_scope_mac(addr, store) do { \\\n\t if ((addr->sin6_family == AF_INET6) && \\\n\t     (IN6_IS_SCOPE_LINKLOCAL(&addr->sin6_addr))) { \\\n\t\t*store = *addr; \\\n\t\tif (addr->sin6_scope_id == 0) { \\\n\t\t\tif (!sa6_recoverscope(store)) { \\\n\t\t\t\taddr = store; \\\n\t\t\t} \\\n\t\t} else { \\\n\t\t\tin6_clearscope(&addr->sin6_addr); \\\n\t\t\taddr = store; \\\n\t\t} \\\n\t } \\\n} while (0)\n#endif\n\nint sctp_cmpaddr(struct sockaddr *, struct sockaddr *);\n\nvoid sctp_print_address(struct sockaddr *);\nvoid sctp_print_address_pkt(struct ip *, struct sctphdr *);\n\nint\nsctp_release_pr_sctp_chunk(struct sctp_tcb *, struct sctp_tmit_chunk *,\n    int, int\n#if !defined(__APPLE__) && !defined(SCTP_SO_LOCK_TESTING)\n    SCTP_UNUSED\n#endif\n);\n\nstruct mbuf *sctp_generate_invmanparam(int);\n\nvoid \nsctp_bindx_add_address(struct socket *so, struct sctp_inpcb *inp,\n    struct sockaddr *sa, sctp_assoc_t assoc_id,\n    uint32_t vrf_id, int *error, void *p);\nvoid \nsctp_bindx_delete_address(struct socket *so, struct sctp_inpcb *inp,\n    struct sockaddr *sa, sctp_assoc_t assoc_id,\n    uint32_t vrf_id, int *error);\n\nint sctp_local_addr_count(struct sctp_tcb *stcb);\n\n#ifdef SCTP_MBCNT_LOGGING\nvoid\nsctp_free_bufspace(struct sctp_tcb *, struct sctp_association *,\n    struct sctp_tmit_chunk *, int);\n\n#else\n#define sctp_free_bufspace(stcb, asoc, tp1, chk_cnt)  \\\ndo { \\\n\tif (tp1->data != NULL) { \\\n                atomic_subtract_int(&((asoc)->chunks_on_out_queue), chk_cnt); \\\n\t\tif ((asoc)->total_output_queue_size >= tp1->book_size) { \\\n\t\t\tatomic_subtract_int(&((asoc)->total_output_queue_size), tp1->book_size); \\\n\t\t} else { \\\n\t\t\t(asoc)->total_output_queue_size = 0; \\\n\t\t} \\\n   \t        if (stcb->sctp_socket && ((stcb->sctp_ep->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) || \\\n\t            (stcb->sctp_ep->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL))) { \\\n\t\t\tif (stcb->sctp_socket->so_snd.sb_cc >= tp1->book_size) { \\\n\t\t\t\tatomic_subtract_int(&((stcb)->sctp_socket->so_snd.sb_cc), tp1->book_size); \\\n\t\t\t} else { \\\n\t\t\t\tstcb->sctp_socket->so_snd.sb_cc = 0; \\\n\t\t\t} \\\n\t\t} \\\n        } \\\n} while (0)\n\n#endif\n\n#define sctp_free_spbufspace(stcb, asoc, sp)  \\\ndo { \\\n \tif (sp->data != NULL) { \\\n\t\tif ((asoc)->total_output_queue_size >= sp->length) { \\\n\t\t\tatomic_subtract_int(&(asoc)->total_output_queue_size, sp->length); \\\n\t\t} else { \\\n\t\t\t(asoc)->total_output_queue_size = 0; \\\n\t\t} \\\n   \t        if (stcb->sctp_socket && ((stcb->sctp_ep->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) || \\\n\t            (stcb->sctp_ep->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL))) { \\\n\t\t\tif (stcb->sctp_socket->so_snd.sb_cc >= sp->length) { \\\n\t\t\t\tatomic_subtract_int(&stcb->sctp_socket->so_snd.sb_cc,sp->length); \\\n\t\t\t} else { \\\n\t\t\t\tstcb->sctp_socket->so_snd.sb_cc = 0; \\\n\t\t\t} \\\n\t\t} \\\n        } \\\n} while (0)\n\n#define sctp_snd_sb_alloc(stcb, sz)  \\\ndo { \\\n\tatomic_add_int(&stcb->asoc.total_output_queue_size,sz); \\\n\tif ((stcb->sctp_socket != NULL) && \\\n\t    ((stcb->sctp_ep->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) || \\\n\t     (stcb->sctp_ep->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL))) { \\\n\t\tatomic_add_int(&stcb->sctp_socket->so_snd.sb_cc,sz); \\\n\t} \\\n} while (0)\n\n/* functions to start/stop udp tunneling */\n/* XXX: Remove the #ifdef after tunneling over IPv6 works also on FreeBSD. */\n#ifdef INET\nvoid sctp_over_udp_stop(void);\nint sctp_over_udp_start(void);\n\n#endif\n\nint\nsctp_soreceive(struct socket *so, struct sockaddr **psa,\n    struct uio *uio,\n    struct mbuf **mp0,\n    struct mbuf **controlp,\n    int *flagsp);\n\nvoid\n     sctp_misc_ints(uint8_t from, uint32_t a, uint32_t b, uint32_t c, uint32_t d);\n\nvoid\nsctp_wakeup_log(struct sctp_tcb *stcb,\n    uint32_t cumtsn,\n    uint32_t wake_cnt, int from);\n\nvoid sctp_log_strm_del_alt(struct sctp_tcb *stcb, uint32_t, uint16_t, uint16_t, int);\n\nvoid sctp_log_nagle_event(struct sctp_tcb *stcb, int action);\n\n\nvoid\n     sctp_log_mb(struct mbuf *m, int from);\n\nvoid\nsctp_sblog(struct sockbuf *sb,\n    struct sctp_tcb *stcb, int from, int incr);\n\nvoid\nsctp_log_strm_del(struct sctp_queued_to_read *control,\n    struct sctp_queued_to_read *poschk,\n    int from);\nvoid sctp_log_cwnd(struct sctp_tcb *stcb, struct sctp_nets *, int, uint8_t);\nvoid rto_logging(struct sctp_nets *net, int from);\n\nvoid sctp_log_closing(struct sctp_inpcb *inp, struct sctp_tcb *stcb, int16_t loc);\n\nvoid sctp_log_lock(struct sctp_inpcb *inp, struct sctp_tcb *stcb, uint8_t from);\nvoid sctp_log_maxburst(struct sctp_tcb *stcb, struct sctp_nets *, int, int, uint8_t);\nvoid sctp_log_block(uint8_t, struct socket *, struct sctp_association *, int);\nvoid sctp_log_rwnd(uint8_t, uint32_t, uint32_t, uint32_t);\nvoid sctp_log_mbcnt(uint8_t, uint32_t, uint32_t, uint32_t, uint32_t);\nvoid sctp_log_rwnd_set(uint8_t, uint32_t, uint32_t, uint32_t, uint32_t);\nint sctp_fill_stat_log(void *, size_t *);\nvoid sctp_log_fr(uint32_t, uint32_t, uint32_t, int);\nvoid sctp_log_sack(uint32_t, uint32_t, uint32_t, uint16_t, uint16_t, int);\nvoid sctp_log_map(uint32_t, uint32_t, uint32_t, int);\nvoid sctp_print_mapping_array(struct sctp_association *asoc);\nvoid sctp_clr_stat_log(void);\n\n\n#ifdef SCTP_AUDITING_ENABLED\nvoid\nsctp_auditing(int, struct sctp_inpcb *, struct sctp_tcb *,\n    struct sctp_nets *);\nvoid sctp_audit_log(uint8_t, uint8_t);\n\n#endif\n\n\n#endif\t\t\t\t/* _KERNEL */\n#endif\n"
  },
  {
    "path": "freebsd-headers/netinet/tcp.h",
    "content": "/*-\n * Copyright (c) 1982, 1986, 1993\n *\tThe Regents of the University of California.  All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 4. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t@(#)tcp.h\t8.1 (Berkeley) 6/10/93\n * $FreeBSD: release/9.0.0/sys/netinet/tcp.h 215434 2010-11-17 18:55:12Z gnn $\n */\n\n#ifndef _NETINET_TCP_H_\n#define _NETINET_TCP_H_\n\n#include <sys/cdefs.h>\n\n#if __BSD_VISIBLE\n\ntypedef\tu_int32_t tcp_seq;\n\n#define tcp6_seq\ttcp_seq\t/* for KAME src sync over BSD*'s */\n#define tcp6hdr\t\ttcphdr\t/* for KAME src sync over BSD*'s */\n\n/*\n * TCP header.\n * Per RFC 793, September, 1981.\n */\nstruct tcphdr {\n\tu_short\tth_sport;\t\t/* source port */\n\tu_short\tth_dport;\t\t/* destination port */\n\ttcp_seq\tth_seq;\t\t\t/* sequence number */\n\ttcp_seq\tth_ack;\t\t\t/* acknowledgement number */\n#if BYTE_ORDER == LITTLE_ENDIAN\n\tu_char\tth_x2:4,\t\t/* (unused) */\n\t\tth_off:4;\t\t/* data offset */\n#endif\n#if BYTE_ORDER == BIG_ENDIAN\n\tu_char\tth_off:4,\t\t/* data offset */\n\t\tth_x2:4;\t\t/* (unused) */\n#endif\n\tu_char\tth_flags;\n#define\tTH_FIN\t0x01\n#define\tTH_SYN\t0x02\n#define\tTH_RST\t0x04\n#define\tTH_PUSH\t0x08\n#define\tTH_ACK\t0x10\n#define\tTH_URG\t0x20\n#define\tTH_ECE\t0x40\n#define\tTH_CWR\t0x80\n#define\tTH_FLAGS\t(TH_FIN|TH_SYN|TH_RST|TH_PUSH|TH_ACK|TH_URG|TH_ECE|TH_CWR)\n#define\tPRINT_TH_FLAGS\t\"\\20\\1FIN\\2SYN\\3RST\\4PUSH\\5ACK\\6URG\\7ECE\\10CWR\"\n\n\tu_short\tth_win;\t\t\t/* window */\n\tu_short\tth_sum;\t\t\t/* checksum */\n\tu_short\tth_urp;\t\t\t/* urgent pointer */\n};\n\n#define\tTCPOPT_EOL\t\t0\n#define\t   TCPOLEN_EOL\t\t\t1\n#define\tTCPOPT_PAD\t\t0\t\t/* padding after EOL */\n#define\t   TCPOLEN_PAD\t\t\t1\n#define\tTCPOPT_NOP\t\t1\n#define\t   TCPOLEN_NOP\t\t\t1\n#define\tTCPOPT_MAXSEG\t\t2\n#define    TCPOLEN_MAXSEG\t\t4\n#define TCPOPT_WINDOW\t\t3\n#define    TCPOLEN_WINDOW\t\t3\n#define TCPOPT_SACK_PERMITTED\t4\n#define    TCPOLEN_SACK_PERMITTED\t2\n#define TCPOPT_SACK\t\t5\n#define\t   TCPOLEN_SACKHDR\t\t2\n#define    TCPOLEN_SACK\t\t\t8\t/* 2*sizeof(tcp_seq) */\n#define TCPOPT_TIMESTAMP\t8\n#define    TCPOLEN_TIMESTAMP\t\t10\n#define    TCPOLEN_TSTAMP_APPA\t\t(TCPOLEN_TIMESTAMP+2) /* appendix A */\n#define\tTCPOPT_SIGNATURE\t19\t\t/* Keyed MD5: RFC 2385 */\n#define\t   TCPOLEN_SIGNATURE\t\t18\n\n/* Miscellaneous constants */\n#define\tMAX_SACK_BLKS\t6\t/* Max # SACK blocks stored at receiver side */\n#define\tTCP_MAX_SACK\t4\t/* MAX # SACKs sent in any segment */\n\n\n/*\n * The default maximum segment size (MSS) to be used for new TCP connections\n * when path MTU discovery is not enabled.\n *\n * RFC879 derives the default MSS from the largest datagram size hosts are\n * minimally required to handle directly or through IP reassembly minus the\n * size of the IP and TCP header.  With IPv6 the minimum MTU is specified\n * in RFC2460.\n *\n * For IPv4 the MSS is 576 - sizeof(struct tcpiphdr)\n * For IPv6 the MSS is IPV6_MMTU - sizeof(struct ip6_hdr) - sizeof(struct tcphdr)\n *\n * We use explicit numerical definition here to avoid header pollution.\n */\n#define\tTCP_MSS\t\t536\n#define\tTCP6_MSS\t1220\n\n/*\n * Limit the lowest MSS we accept for path MTU discovery and the TCP SYN MSS\n * option.  Allowing low values of MSS can consume significant resources and\n * be used to mount a resource exhaustion attack.\n * Connections requesting lower MSS values will be rounded up to this value\n * and the IP_DF flag will be cleared to allow fragmentation along the path.\n *\n * See tcp_subr.c tcp_minmss SYSCTL declaration for more comments.  Setting\n * it to \"0\" disables the minmss check.\n *\n * The default value is fine for TCP across the Internet's smallest official\n * link MTU (256 bytes for AX.25 packet radio).  However, a connection is very\n * unlikely to come across such low MTU interfaces these days (anno domini 2003).\n */\n#define\tTCP_MINMSS 216\n\n#define\tTCP_MAXWIN\t65535\t/* largest value for (unscaled) window */\n#define\tTTCP_CLIENT_SND_WND\t4096\t/* dflt send window for T/TCP client */\n\n#define TCP_MAX_WINSHIFT\t14\t/* maximum window shift */\n\n#define TCP_MAXBURST\t\t4\t/* maximum segments in a burst */\n\n#define TCP_MAXHLEN\t(0xf<<2)\t/* max length of header in bytes */\n#define TCP_MAXOLEN\t(TCP_MAXHLEN - sizeof(struct tcphdr))\n\t\t\t\t\t/* max space left for options */\n#endif /* __BSD_VISIBLE */\n\n/*\n * User-settable options (used with setsockopt).\n */\n#define\tTCP_NODELAY\t0x01\t/* don't delay send to coalesce packets */\n#if __BSD_VISIBLE\n#define\tTCP_MAXSEG\t0x02\t/* set maximum segment size */\n#define TCP_NOPUSH\t0x04\t/* don't push last block of write */\n#define TCP_NOOPT\t0x08\t/* don't use TCP options */\n#define TCP_MD5SIG\t0x10\t/* use MD5 digests (RFC2385) */\n#define\tTCP_INFO\t0x20\t/* retrieve tcp_info structure */\n#define\tTCP_CONGESTION\t0x40\t/* get/set congestion control algorithm */\n\n#define\tTCP_CA_NAME_MAX\t16\t/* max congestion control name length */\n\n#define\tTCPI_OPT_TIMESTAMPS\t0x01\n#define\tTCPI_OPT_SACK\t\t0x02\n#define\tTCPI_OPT_WSCALE\t\t0x04\n#define\tTCPI_OPT_ECN\t\t0x08\n#define\tTCPI_OPT_TOE\t\t0x10\n\n/*\n * The TCP_INFO socket option comes from the Linux 2.6 TCP API, and permits\n * the caller to query certain information about the state of a TCP\n * connection.  We provide an overlapping set of fields with the Linux\n * implementation, but since this is a fixed size structure, room has been\n * left for growth.  In order to maximize potential future compatibility with\n * the Linux API, the same variable names and order have been adopted, and\n * padding left to make room for omitted fields in case they are added later.\n *\n * XXX: This is currently an unstable ABI/API, in that it is expected to\n * change.\n */\nstruct tcp_info {\n\tu_int8_t\ttcpi_state;\t\t/* TCP FSM state. */\n\tu_int8_t\t__tcpi_ca_state;\n\tu_int8_t\t__tcpi_retransmits;\n\tu_int8_t\t__tcpi_probes;\n\tu_int8_t\t__tcpi_backoff;\n\tu_int8_t\ttcpi_options;\t\t/* Options enabled on conn. */\n\tu_int8_t\ttcpi_snd_wscale:4,\t/* RFC1323 send shift value. */\n\t\t\ttcpi_rcv_wscale:4;\t/* RFC1323 recv shift value. */\n\n\tu_int32_t\ttcpi_rto;\t\t/* Retransmission timeout (usec). */\n\tu_int32_t\t__tcpi_ato;\n\tu_int32_t\ttcpi_snd_mss;\t\t/* Max segment size for send. */\n\tu_int32_t\ttcpi_rcv_mss;\t\t/* Max segment size for receive. */\n\n\tu_int32_t\t__tcpi_unacked;\n\tu_int32_t\t__tcpi_sacked;\n\tu_int32_t\t__tcpi_lost;\n\tu_int32_t\t__tcpi_retrans;\n\tu_int32_t\t__tcpi_fackets;\n\n\t/* Times; measurements in usecs. */\n\tu_int32_t\t__tcpi_last_data_sent;\n\tu_int32_t\t__tcpi_last_ack_sent;\t/* Also unimpl. on Linux? */\n\tu_int32_t\ttcpi_last_data_recv;\t/* Time since last recv data. */\n\tu_int32_t\t__tcpi_last_ack_recv;\n\n\t/* Metrics; variable units. */\n\tu_int32_t\t__tcpi_pmtu;\n\tu_int32_t\t__tcpi_rcv_ssthresh;\n\tu_int32_t\ttcpi_rtt;\t\t/* Smoothed RTT in usecs. */\n\tu_int32_t\ttcpi_rttvar;\t\t/* RTT variance in usecs. */\n\tu_int32_t\ttcpi_snd_ssthresh;\t/* Slow start threshold. */\n\tu_int32_t\ttcpi_snd_cwnd;\t\t/* Send congestion window. */\n\tu_int32_t\t__tcpi_advmss;\n\tu_int32_t\t__tcpi_reordering;\n\n\tu_int32_t\t__tcpi_rcv_rtt;\n\tu_int32_t\ttcpi_rcv_space;\t\t/* Advertised recv window. */\n\n\t/* FreeBSD extensions to tcp_info. */\n\tu_int32_t\ttcpi_snd_wnd;\t\t/* Advertised send window. */\n\tu_int32_t\ttcpi_snd_bwnd;\t\t/* No longer used. */\n\tu_int32_t\ttcpi_snd_nxt;\t\t/* Next egress seqno */\n\tu_int32_t\ttcpi_rcv_nxt;\t\t/* Next ingress seqno */\n\tu_int32_t\ttcpi_toe_tid;\t\t/* HWTID for TOE endpoints */\n\tu_int32_t\ttcpi_snd_rexmitpack;\t/* Retransmitted packets */\n\tu_int32_t\ttcpi_rcv_ooopack;\t/* Out-of-order packets */\n\tu_int32_t\ttcpi_snd_zerowin;\t/* Zero-sized windows sent */\n\t\n\t/* Padding to grow without breaking ABI. */\n\tu_int32_t\t__tcpi_pad[26];\t\t/* Padding. */\n};\n#endif\n\n#endif /* !_NETINET_TCP_H_ */\n"
  },
  {
    "path": "freebsd-headers/netinet/tcp_debug.h",
    "content": "/*-\n * Copyright (c) 1982, 1986, 1993\n *\tThe Regents of the University of California.  All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 4. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t@(#)tcp_debug.h\t8.1 (Berkeley) 6/10/93\n * $FreeBSD: release/9.0.0/sys/netinet/tcp_debug.h 188578 2009-02-13 15:14:43Z luigi $\n */\n\n#ifndef _NETINET_TCP_DEBUG_H_\n#define\t_NETINET_TCP_DEBUG_H_\n\nstruct\ttcp_debug {\n\tuint32_t\ttd_time;\t/* network format */\n\tshort\ttd_act;\n\tshort\ttd_ostate;\n\tcaddr_t\ttd_tcb;\n\tint\ttd_family;\n\t/*\n\t * Co-existense of td_ti and td_ti6 below is ugly, but it is necessary\n\t * to achieve backword compatibility to some extent.\n\t */\n\tstruct\ttcpiphdr td_ti;\n\tstruct {\n#define\tIP6_HDR_LEN\t40\t/* sizeof(struct ip6_hdr) */\n#if !defined(_KERNEL) && defined(INET6)\n\t\tstruct\tip6_hdr ip6;\n#else\n\t\tu_char\tip6buf[IP6_HDR_LEN];\n#endif\n\t\tstruct\ttcphdr th;\n\t} td_ti6;\n#define\ttd_ip6buf\ttd_ti6.ip6buf\n\tshort\ttd_req;\n\tstruct\ttcpcb td_cb;\n};\n\n#define\tTA_INPUT\t0\n#define\tTA_OUTPUT\t1\n#define\tTA_USER\t\t2\n#define\tTA_RESPOND\t3\n#define\tTA_DROP\t\t4\n\n#ifdef TANAMES\nstatic const char\t*tanames[] =\n    { \"input\", \"output\", \"user\", \"respond\", \"drop\" };\n#endif\n\n#define\tTCP_NDEBUG 100\n\n#ifndef _KERNEL\n/* XXX common variables for broken applications. */\nstruct\ttcp_debug tcp_debug[TCP_NDEBUG];\nint\ttcp_debx;\n#endif\n\n#endif /* !_NETINET_TCP_DEBUG_H_ */\n"
  },
  {
    "path": "freebsd-headers/netinet/tcp_fsm.h",
    "content": "/*-\n * Copyright (c) 1982, 1986, 1993\n *\tThe Regents of the University of California.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 4. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t@(#)tcp_fsm.h\t8.1 (Berkeley) 6/10/93\n * $FreeBSD: release/9.0.0/sys/netinet/tcp_fsm.h 171656 2007-07-30 11:06:42Z des $\n */\n\n#ifndef _NETINET_TCP_FSM_H_\n#define\t_NETINET_TCP_FSM_H_\n\n/*\n * TCP FSM state definitions.\n *\n * Per RFC793, September, 1981.\n */\n\n#define\tTCP_NSTATES\t11\n\n#define\tTCPS_CLOSED\t\t0\t/* closed */\n#define\tTCPS_LISTEN\t\t1\t/* listening for connection */\n#define\tTCPS_SYN_SENT\t\t2\t/* active, have sent syn */\n#define\tTCPS_SYN_RECEIVED\t3\t/* have sent and received syn */\n/* states < TCPS_ESTABLISHED are those where connections not established */\n#define\tTCPS_ESTABLISHED\t4\t/* established */\n#define\tTCPS_CLOSE_WAIT\t\t5\t/* rcvd fin, waiting for close */\n/* states > TCPS_CLOSE_WAIT are those where user has closed */\n#define\tTCPS_FIN_WAIT_1\t\t6\t/* have closed, sent fin */\n#define\tTCPS_CLOSING\t\t7\t/* closed xchd FIN; await FIN ACK */\n#define\tTCPS_LAST_ACK\t\t8\t/* had fin and close; await FIN ACK */\n/* states > TCPS_CLOSE_WAIT && < TCPS_FIN_WAIT_2 await ACK of FIN */\n#define\tTCPS_FIN_WAIT_2\t\t9\t/* have closed, fin is acked */\n#define\tTCPS_TIME_WAIT\t\t10\t/* in 2*msl quiet wait after close */\n\n/* for KAME src sync over BSD*'s */\n#define\tTCP6_NSTATES\t\tTCP_NSTATES\n#define\tTCP6S_CLOSED\t\tTCPS_CLOSED\n#define\tTCP6S_LISTEN\t\tTCPS_LISTEN\n#define\tTCP6S_SYN_SENT\t\tTCPS_SYN_SENT\n#define\tTCP6S_SYN_RECEIVED\tTCPS_SYN_RECEIVED\n#define\tTCP6S_ESTABLISHED\tTCPS_ESTABLISHED\n#define\tTCP6S_CLOSE_WAIT\tTCPS_CLOSE_WAIT\n#define\tTCP6S_FIN_WAIT_1\tTCPS_FIN_WAIT_1\n#define\tTCP6S_CLOSING\t\tTCPS_CLOSING\n#define\tTCP6S_LAST_ACK\t\tTCPS_LAST_ACK\n#define\tTCP6S_FIN_WAIT_2\tTCPS_FIN_WAIT_2\n#define\tTCP6S_TIME_WAIT\t\tTCPS_TIME_WAIT\n\n#define\tTCPS_HAVERCVDSYN(s)\t((s) >= TCPS_SYN_RECEIVED)\n#define\tTCPS_HAVEESTABLISHED(s)\t((s) >= TCPS_ESTABLISHED)\n#define\tTCPS_HAVERCVDFIN(s)\t((s) >= TCPS_TIME_WAIT)\n\n#ifdef\tTCPOUTFLAGS\n/*\n * Flags used when sending segments in tcp_output.  Basic flags (TH_RST,\n * TH_ACK,TH_SYN,TH_FIN) are totally determined by state, with the proviso\n * that TH_FIN is sent only if all data queued for output is included in the\n * segment.\n */\nstatic u_char\ttcp_outflags[TCP_NSTATES] = {\n\tTH_RST|TH_ACK,\t\t/* 0, CLOSED */\n\t0,\t\t\t/* 1, LISTEN */\n\tTH_SYN,\t\t\t/* 2, SYN_SENT */\n\tTH_SYN|TH_ACK,\t\t/* 3, SYN_RECEIVED */\n\tTH_ACK,\t\t\t/* 4, ESTABLISHED */\n\tTH_ACK,\t\t\t/* 5, CLOSE_WAIT */\n\tTH_FIN|TH_ACK,\t\t/* 6, FIN_WAIT_1 */\n\tTH_FIN|TH_ACK,\t\t/* 7, CLOSING */\n\tTH_FIN|TH_ACK,\t\t/* 8, LAST_ACK */\n\tTH_ACK,\t\t\t/* 9, FIN_WAIT_2 */\n\tTH_ACK,\t\t\t/* 10, TIME_WAIT */\n};\t\n#endif\n\n#ifdef KPROF\nint\ttcp_acounts[TCP_NSTATES][PRU_NREQ];\n#endif\n\n#ifdef\tTCPSTATES\nstatic char const * const tcpstates[] = {\n\t\"CLOSED\",\t\"LISTEN\",\t\"SYN_SENT\",\t\"SYN_RCVD\",\n\t\"ESTABLISHED\",\t\"CLOSE_WAIT\",\t\"FIN_WAIT_1\",\t\"CLOSING\",\n\t\"LAST_ACK\",\t\"FIN_WAIT_2\",\t\"TIME_WAIT\",\n};\n#endif\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/netinet/tcp_hostcache.h",
    "content": "/*-\n * Copyright (c) 2002 Andre Oppermann, Internet Business Solutions AG\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. The name of the author may not be used to endorse or promote\n *    products derived from this software without specific prior written\n *    permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/netinet/tcp_hostcache.h 185420 2008-11-28 23:39:25Z zec $\n */\n\n/*\n * Many thanks to jlemon for basic structure of tcp_syncache which is being\n * followed here.\n */\n\n#ifndef _NETINET_TCP_HOSTCACHE_H_\n#define _NETINET_TCP_HOSTCACHE_H_\n\nTAILQ_HEAD(hc_qhead, hc_metrics);\n\nstruct hc_head {\n\tstruct hc_qhead\thch_bucket;\n\tu_int\t\thch_length;\n\tstruct mtx\thch_mtx;\n};\n\nstruct hc_metrics {\n\t/* housekeeping */\n\tTAILQ_ENTRY(hc_metrics) rmx_q;\n\tstruct\thc_head *rmx_head; /* head of bucket tail queue */\n\tstruct\tin_addr ip4;\t/* IP address */\n\tstruct\tin6_addr ip6;\t/* IP6 address */\n\t/* endpoint specific values for tcp */\n\tu_long\trmx_mtu;\t/* MTU for this path */\n\tu_long\trmx_ssthresh;\t/* outbound gateway buffer limit */\n\tu_long\trmx_rtt;\t/* estimated round trip time */\n\tu_long\trmx_rttvar;\t/* estimated rtt variance */\n\tu_long\trmx_bandwidth;\t/* estimated bandwidth */\n\tu_long\trmx_cwnd;\t/* congestion window */\n\tu_long\trmx_sendpipe;\t/* outbound delay-bandwidth product */\n\tu_long\trmx_recvpipe;\t/* inbound delay-bandwidth product */\n\t/* TCP hostcache internal data */\n\tint\trmx_expire;\t/* lifetime for object */\n\tu_long\trmx_hits;\t/* number of hits */\n\tu_long\trmx_updates;\t/* number of updates */\n};\n\nstruct tcp_hostcache {\n\tstruct\thc_head *hashbase;\n\tuma_zone_t zone;\n\tu_int\thashsize;\n\tu_int\thashmask;\n\tu_int\tbucket_limit;\n\tu_int\tcache_count;\n\tu_int\tcache_limit;\n\tint\texpire;\n\tint\tprune;\n\tint\tpurgeall;\n};\n\n#endif /* !_NETINET_TCP_HOSTCACHE_H_*/\n"
  },
  {
    "path": "freebsd-headers/netinet/tcp_lro.h",
    "content": "/*******************************************************************************\n\nCopyright (c) 2006, Myricom Inc.\nCopyright (c) 2008, Intel Corporation.\nAll rights reserved.\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are met:\n\n 1. Redistributions of source code must retain the above copyright notice,\n    this list of conditions and the following disclaimer.\n\n 2. Neither the name of the Myricom Inc, nor the names of its\n    contributors may be used to endorse or promote products derived from\n    this software without specific prior written permission.\n\n 2. Neither the name of the Intel Corporation, nor the names of its\n    contributors may be used to endorse or promote products derived from\n    this software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\nAND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\nIMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\nARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE\nLIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\nCONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\nSUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\nINTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\nCONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\nARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\nPOSSIBILITY OF SUCH DAMAGE.\n\n\n$FreeBSD: release/9.0.0/sys/netinet/tcp_lro.h 217126 2011-01-07 21:40:34Z jhb $\n\n***************************************************************************/\n#ifndef _TCP_LRO_H_\n#define _TCP_LRO_H_\n\nstruct lro_entry;\nstruct lro_entry\n{\n\tSLIST_ENTRY(lro_entry) next;\n\tstruct mbuf\t*m_head;\n\tstruct mbuf\t*m_tail;\n\tint\t\ttimestamp;\n\tstruct ip\t*ip;\n\tuint32_t\ttsval;\n\tuint32_t\ttsecr;\n\tuint32_t\tsource_ip;\n\tuint32_t\tdest_ip;\n\tuint32_t\tnext_seq;\n\tuint32_t\tack_seq;\n\tuint32_t\tlen;\n\tuint32_t\tdata_csum;\n\tuint16_t\twindow;\n\tuint16_t\tsource_port;\n\tuint16_t\tdest_port;\n\tuint16_t\tappend_cnt;\n\tuint16_t\tmss;\n\t\n};\nSLIST_HEAD(lro_head, lro_entry);\n\nstruct lro_ctrl {\n\tstruct ifnet\t*ifp;\n\tint\t\tlro_queued;\n\tint\t\tlro_flushed;\n\tint\t\tlro_bad_csum;\n\tint\t\tlro_cnt;\n\n\tstruct lro_head\tlro_active;\n\tstruct lro_head\tlro_free;\n};\n\n\nint tcp_lro_init(struct lro_ctrl *);\nvoid tcp_lro_free(struct lro_ctrl *);\nvoid tcp_lro_flush(struct lro_ctrl *, struct lro_entry *);\nint tcp_lro_rx(struct lro_ctrl *, struct mbuf *, uint32_t);\n\n/* Number of LRO entries - these are per rx queue */\n#define LRO_ENTRIES\t\t\t8\n\n#endif /* _TCP_LRO_H_ */\n"
  },
  {
    "path": "freebsd-headers/netinet/tcp_offload.h",
    "content": "/*-\n * Copyright (c) 2007, Chelsio Inc.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions are met:\n *\n * 1. Redistributions of source code must retain the above copyright notice,\n *    this list of conditions and the following disclaimer.\n *\n * 2. Neither the name of the Chelsio Corporation nor the names of its\n *    contributors may be used to endorse or promote products derived from\n *    this software without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\n * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE\n * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\n * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\n * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\n * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\n * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/netinet/tcp_offload.h 218909 2011-02-21 09:01:34Z brucec $\n */\n\n#ifndef _NETINET_TCP_OFFLOAD_H_\n#define\t_NETINET_TCP_OFFLOAD_H_\n\n#ifndef _KERNEL\n#error \"no user-serviceable parts inside\"\n#endif\n\n/*\n * A driver publishes that it provides offload services\n * by setting IFCAP_TOE in the ifnet. The offload connect\n * will bypass any further work if the interface that a\n * connection would use does not support TCP offload.\n *\n * The TOE API assumes that the tcp offload engine can offload the \n * the entire connection from set up to teardown, with some provision \n * being made to allowing the software stack to handle time wait. If\n * the device does not meet these criteria, it is the driver's responsibility\n * to overload the functions that it needs to in tcp_usrreqs and make\n * its own calls to tcp_output if it needs to do so.\n *\n * There is currently no provision for the device advertising the congestion\n * control algorithms it supports as there is currently no API for querying \n * an operating system for the protocols that it has loaded. This is a desirable\n * future extension.\n *\n *\n *\n * It is assumed that individuals deploying TOE will want connections\n * to be offloaded without software changes so all connections on an\n * interface providing TOE are offloaded unless the SO_NO_OFFLOAD \n * flag is set on the socket.\n *\n *\n * The toe_usrreqs structure constitutes the TOE driver's \n * interface to the TCP stack for functionality that doesn't\n * interact directly with userspace. If one wants to provide\n * (optional) functionality to do zero-copy to/from\n * userspace one still needs to override soreceive/sosend \n * with functions that fault in and pin the user buffers.\n *\n * + tu_send\n *   - tells the driver that new data may have been added to the \n *     socket's send buffer - the driver should not fail if the\n *     buffer is in fact unchanged\n *   - the driver is responsible for providing credits (bytes in the send window)\n *     back to the socket by calling sbdrop() as segments are acknowledged.\n *   - The driver expects the inpcb lock to be held - the driver is expected\n *     not to drop the lock. Hence the driver is not allowed to acquire the\n *     pcbinfo lock during this call.\n *\n * + tu_rcvd\n *   - returns credits to the driver and triggers window updates\n *     to the peer (a credit as used here is a byte in the peer's receive window)\n *   - the driver is expected to determine how many bytes have been \n *     consumed and credit that back to the card so that it can grow\n *     the window again by maintaining its own state between invocations.\n *   - In principle this could be used to shrink the window as well as\n *     grow the window, although it is not used for that now.\n *   - this function needs to correctly handle being called any number of\n *     times without any bytes being consumed from the receive buffer.\n *   - The driver expects the inpcb lock to be held - the driver is expected\n *     not to drop the lock. Hence the driver is not allowed to acquire the\n *     pcbinfo lock during this call.\n *\n * + tu_disconnect\n *   - tells the driver to send FIN to peer\n *   - driver is expected to send the remaining data and then do a clean half close\n *   - disconnect implies at least half-close so only send, reset, and detach\n *     are legal\n *   - the driver is expected to handle transition through the shutdown\n *     state machine and allow the stack to support SO_LINGER.\n *   - The driver expects the inpcb lock to be held - the driver is expected\n *     not to drop the lock. Hence the driver is not allowed to acquire the\n *     pcbinfo lock during this call.\n *\n * + tu_reset\n *   - closes the connection and sends a RST to peer\n *   - driver is expectd to trigger an RST and detach the toepcb\n *   - no further calls are legal after reset\n *   - The driver expects the inpcb lock to be held - the driver is expected\n *     not to drop the lock. Hence the driver is not allowed to acquire the\n *     pcbinfo lock during this call.\n *\n *   The following fields in the tcpcb are expected to be referenced by the driver:\n *\t+ iss\n *\t+ rcv_nxt\n *\t+ rcv_wnd\n *\t+ snd_isn\n *\t+ snd_max\n *\t+ snd_nxt\n *\t+ snd_una\n *\t+ t_flags\n *\t+ t_inpcb\n *\t+ t_maxseg\n *\t+ t_toe\n *\n *   The following fields in the inpcb are expected to be referenced by the driver:\n *\t+ inp_lport\n *\t+ inp_fport\n *\t+ inp_laddr\n *\t+ inp_fport\n *\t+ inp_socket\n *\t+ inp_ip_tos\n *\n *   The following fields in the socket are expected to be referenced by the\n *   driver:\n *\t+ so_comp\n *\t+ so_error\n *\t+ so_linger\n *\t+ so_options\n *\t+ so_rcv\n *\t+ so_snd\n *\t+ so_state\n *\t+ so_timeo\n *\n *   These functions all return 0 on success and can return the following errors\n *   as appropriate:\n *\t+ EPERM:\n *\t+ ENOBUFS: memory allocation failed\n *\t+ EMSGSIZE: MTU changed during the call\n *\t+ EHOSTDOWN:\n *\t+ EHOSTUNREACH:\n *\t+ ENETDOWN:\n *\t* ENETUNREACH: the peer is no longer reachable\n *\n * + tu_detach\n *   - tells driver that the socket is going away so disconnect\n *     the toepcb and free appropriate resources\n *   - allows the driver to cleanly handle the case of connection state\n *     outliving the socket\n *   - no further calls are legal after detach\n *   - the driver is expected to provide its own synchronization between\n *     detach and receiving new data.\n * \n * + tu_syncache_event\n *   - even if it is not actually needed, the driver is expected to\n *     call syncache_add for the initial SYN and then syncache_expand\n *     for the SYN,ACK\n *   - tells driver that a connection either has not been added or has \n *     been dropped from the syncache\n *   - the driver is expected to maintain state that lives outside the \n *     software stack so the syncache needs to be able to notify the\n *     toe driver that the software stack is not going to create a connection\n *     for a received SYN\n *   - The driver is responsible for any synchronization required between\n *     the syncache dropping an entry and the driver processing the SYN,ACK.\n * \n */\nstruct toe_usrreqs {\n\tint (*tu_send)(struct tcpcb *tp);\n\tint (*tu_rcvd)(struct tcpcb *tp);\n\tint (*tu_disconnect)(struct tcpcb *tp);\n\tint (*tu_reset)(struct tcpcb *tp);\n\tvoid (*tu_detach)(struct tcpcb *tp);\n\tvoid (*tu_syncache_event)(int event, void *toep);\n};\n\n/*\n * Proxy for struct tcpopt between TOE drivers and TCP functions.\n */\nstruct toeopt {\n\tu_int64_t\tto_flags;\t/* see tcpopt in tcp_var.h */\n\tu_int16_t\tto_mss;\t\t/* maximum segment size */\n\tu_int8_t\tto_wscale;\t/* window scaling */\n\n\tu_int8_t\t_pad1;\t\t/* explicit pad for 64bit alignment */\n\tu_int32_t\t_pad2;\t\t/* explicit pad for 64bit alignment */\n\tu_int64_t\t_pad3[4];\t/* TBD */\n};\n\n#define\tTOE_SC_ENTRY_PRESENT\t\t1\t/* 4-tuple already present */\n#define\tTOE_SC_DROP\t\t\t2\t/* connection was timed out */\n\n/*\n * Because listen is a one-to-many relationship (a socket can be listening \n * on all interfaces on a machine some of which may be using different TCP\n * offload devices), listen uses a publish/subscribe mechanism. The TCP\n * offload driver registers a listen notification function with the stack.\n * When a listen socket is created all TCP offload devices are notified\n * so that they can do the appropriate set up to offload connections on the\n * port to which the socket is bound. When the listen socket is closed,\n * the offload devices are notified so that they will stop listening on that\n * port and free any associated resources as well as sending RSTs on any\n * connections in the SYN_RCVD state.\n *\n */\n\ntypedef\tvoid\t(*tcp_offload_listen_start_fn)(void *, struct tcpcb *);\ntypedef\tvoid\t(*tcp_offload_listen_stop_fn)(void *, struct tcpcb *);\n\nEVENTHANDLER_DECLARE(tcp_offload_listen_start, tcp_offload_listen_start_fn);\nEVENTHANDLER_DECLARE(tcp_offload_listen_stop, tcp_offload_listen_stop_fn);\n\n/*\n * Check if the socket can be offloaded by the following steps:\n * - determine the egress interface\n * - check the interface for TOE capability and TOE is enabled\n * - check if the device has resources to offload the connection\n */\nint\ttcp_offload_connect(struct socket *so, struct sockaddr *nam);\n\n/*\n * The tcp_output_* routines are wrappers around the toe_usrreqs calls\n * which trigger packet transmission. In the non-offloaded case they\n * translate to tcp_output. The tcp_offload_* routines notify TOE\n * of specific events. I the non-offloaded case they are no-ops.\n *\n * Listen is a special case because it is a 1 to many relationship\n * and there can be more than one offload driver in the system.\n */\n\n/*\n * Connection is offloaded\n */\n#define\ttp_offload(tp)\t\t((tp)->t_flags & TF_TOE)\n\n/*\n * hackish way of allowing this file to also be included by TOE\n * which needs to be kept ignorant of socket implementation details\n */\n#ifdef _SYS_SOCKETVAR_H_\n/*\n * The socket has not been marked as \"do not offload\"\n */\n#define\tSO_OFFLOADABLE(so)\t((so->so_options & SO_NO_OFFLOAD) == 0)\n\nstatic __inline int\ntcp_output_connect(struct socket *so, struct sockaddr *nam)\n{\n\tstruct tcpcb *tp = sototcpcb(so);\n\tint error;\n\n\t/*\n\t * If offload has been disabled for this socket or the \n\t * connection cannot be offloaded just call tcp_output\n\t * to start the TCP state machine.\n\t */\n#ifndef TCP_OFFLOAD_DISABLE\t\n\tif (!SO_OFFLOADABLE(so) || (error = tcp_offload_connect(so, nam)) != 0)\n#endif\t\t\n\t\terror = tcp_output(tp);\n\treturn (error);\n}\n\nstatic __inline int\ntcp_output_send(struct tcpcb *tp)\n{\n\n#ifndef TCP_OFFLOAD_DISABLE\n\tif (tp_offload(tp))\n\t\treturn (tp->t_tu->tu_send(tp));\n#endif\n\treturn (tcp_output(tp));\n}\n\nstatic __inline int\ntcp_output_rcvd(struct tcpcb *tp)\n{\n\n#ifndef TCP_OFFLOAD_DISABLE\n\tif (tp_offload(tp))\n\t\treturn (tp->t_tu->tu_rcvd(tp));\n#endif\n\treturn (tcp_output(tp));\n}\n\nstatic __inline int\ntcp_output_disconnect(struct tcpcb *tp)\n{\n\n#ifndef TCP_OFFLOAD_DISABLE\n\tif (tp_offload(tp))\n\t\treturn (tp->t_tu->tu_disconnect(tp));\n#endif\n\treturn (tcp_output(tp));\n}\n\nstatic __inline int\ntcp_output_reset(struct tcpcb *tp)\n{\n\n#ifndef TCP_OFFLOAD_DISABLE\n\tif (tp_offload(tp))\n\t\treturn (tp->t_tu->tu_reset(tp));\n#endif\n\treturn (tcp_output(tp));\n}\n\nstatic __inline void\ntcp_offload_detach(struct tcpcb *tp)\n{\n\n#ifndef TCP_OFFLOAD_DISABLE\n\tif (tp_offload(tp))\n\t\ttp->t_tu->tu_detach(tp);\n#endif\t\n}\n\nstatic __inline void\ntcp_offload_listen_open(struct tcpcb *tp)\n{\n\n#ifndef TCP_OFFLOAD_DISABLE\n\tif (SO_OFFLOADABLE(tp->t_inpcb->inp_socket))\n\t\tEVENTHANDLER_INVOKE(tcp_offload_listen_start, tp);\n#endif\t\n}\n\nstatic __inline void\ntcp_offload_listen_close(struct tcpcb *tp)\n{\n\n#ifndef TCP_OFFLOAD_DISABLE\n\tEVENTHANDLER_INVOKE(tcp_offload_listen_stop, tp);\n#endif\t\n}\n#undef SO_OFFLOADABLE\n#endif /* _SYS_SOCKETVAR_H_ */\n#undef tp_offload\n\nvoid tcp_offload_twstart(struct tcpcb *tp);\nstruct tcpcb *tcp_offload_close(struct tcpcb *tp);\nstruct tcpcb *tcp_offload_drop(struct tcpcb *tp, int error);\n\n#endif /* _NETINET_TCP_OFFLOAD_H_ */\n"
  },
  {
    "path": "freebsd-headers/netinet/tcp_seq.h",
    "content": "/*-\n * Copyright (c) 1982, 1986, 1993, 1995\n *\tThe Regents of the University of California.  All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 4. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t@(#)tcp_seq.h\t8.3 (Berkeley) 6/21/95\n * $FreeBSD: release/9.0.0/sys/netinet/tcp_seq.h 159733 2006-06-18 14:24:12Z andre $\n */\n\n#ifndef _NETINET_TCP_SEQ_H_\n#define _NETINET_TCP_SEQ_H_\n/*\n * TCP sequence numbers are 32 bit integers operated\n * on with modular arithmetic.  These macros can be\n * used to compare such integers.\n */\n#define\tSEQ_LT(a,b)\t((int)((a)-(b)) < 0)\n#define\tSEQ_LEQ(a,b)\t((int)((a)-(b)) <= 0)\n#define\tSEQ_GT(a,b)\t((int)((a)-(b)) > 0)\n#define\tSEQ_GEQ(a,b)\t((int)((a)-(b)) >= 0)\n\n#define\tSEQ_MIN(a, b)\t((SEQ_LT(a, b)) ? (a) : (b))\n#define\tSEQ_MAX(a, b)\t((SEQ_GT(a, b)) ? (a) : (b))\n\n/* for modulo comparisons of timestamps */\n#define TSTMP_LT(a,b)\t((int)((a)-(b)) < 0)\n#define TSTMP_GT(a,b)\t((int)((a)-(b)) > 0)\n#define TSTMP_GEQ(a,b)\t((int)((a)-(b)) >= 0)\n\n/*\n * Macros to initialize tcp sequence numbers for\n * send and receive from initial send and receive\n * sequence numbers.\n */\n#define\ttcp_rcvseqinit(tp) \\\n\t(tp)->rcv_adv = (tp)->rcv_nxt = (tp)->irs + 1\n\n#define\ttcp_sendseqinit(tp) \\\n\t(tp)->snd_una = (tp)->snd_nxt = (tp)->snd_max = (tp)->snd_up = \\\n\t    (tp)->snd_recover = (tp)->iss\n\n#define TCP_PAWS_IDLE\t(24 * 24 * 60 * 60 * hz)\n\t\t\t\t\t/* timestamp wrap-around time */\n\n#endif /* _NETINET_TCP_SEQ_H_ */\n"
  },
  {
    "path": "freebsd-headers/netinet/tcp_syncache.h",
    "content": "/*-\n * Copyright (c) 1982, 1986, 1993, 1994, 1995\n *\tThe Regents of the University of California.  All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 4. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t@(#)tcp_var.h\t8.4 (Berkeley) 5/24/95\n * $FreeBSD: release/9.0.0/sys/netinet/tcp_syncache.h 224151 2011-07-17 21:15:20Z bz $\n */\n\n#ifndef _NETINET_TCP_SYNCACHE_H_\n#define _NETINET_TCP_SYNCACHE_H_\n#ifdef _KERNEL\n\nstruct toeopt;\n\nvoid\t syncache_init(void);\n#ifdef VIMAGE\nvoid\tsyncache_destroy(void);\n#endif\nvoid\t syncache_unreach(struct in_conninfo *, struct tcphdr *);\nint\t syncache_expand(struct in_conninfo *, struct tcpopt *,\n\t     struct tcphdr *, struct socket **, struct mbuf *);\nint\t tcp_offload_syncache_expand(struct in_conninfo *inc, struct toeopt *toeo,\n             struct tcphdr *th, struct socket **lsop, struct mbuf *m);\nvoid\t syncache_add(struct in_conninfo *, struct tcpopt *,\n\t     struct tcphdr *, struct inpcb *, struct socket **, struct mbuf *);\nvoid\t tcp_offload_syncache_add(struct in_conninfo *, struct toeopt *,\n             struct tcphdr *, struct inpcb *, struct socket **,\n             struct toe_usrreqs *tu, void *toepcb);\n\nvoid\t syncache_chkrst(struct in_conninfo *, struct tcphdr *);\nvoid\t syncache_badack(struct in_conninfo *);\nint\t syncache_pcbcount(void);\nint\t syncache_pcblist(struct sysctl_req *req, int max_pcbs, int *pcbs_exported);\n\nstruct syncache {\n\tTAILQ_ENTRY(syncache)\tsc_hash;\n\tstruct\t\tin_conninfo sc_inc;\t/* addresses */\n\tint\t\tsc_rxttime;\t\t/* retransmit time */\n\tu_int16_t\tsc_rxmits;\t\t/* retransmit counter */\n\tu_int32_t\tsc_tsreflect;\t\t/* timestamp to reflect */\n\tu_int32_t\tsc_ts;\t\t\t/* our timestamp to send */\n\tu_int32_t\tsc_tsoff;\t\t/* ts offset w/ syncookies */\n\tu_int32_t\tsc_flowlabel;\t\t/* IPv6 flowlabel */\n\ttcp_seq\t\tsc_irs;\t\t\t/* seq from peer */\n\ttcp_seq\t\tsc_iss;\t\t\t/* our ISS */\n\tstruct\t\tmbuf *sc_ipopts;\t/* source route */\n\tu_int16_t\tsc_peer_mss;\t\t/* peer's MSS */\n\tu_int16_t\tsc_wnd;\t\t\t/* advertised window */\n\tu_int8_t\tsc_ip_ttl;\t\t/* IPv4 TTL */\n\tu_int8_t\tsc_ip_tos;\t\t/* IPv4 TOS */\n\tu_int8_t\tsc_requested_s_scale:4,\n\t\t\tsc_requested_r_scale:4;\n\tu_int16_t\tsc_flags;\n#ifndef TCP_OFFLOAD_DISABLE\n\tstruct toe_usrreqs *sc_tu;\t\t/* TOE operations */\n\tvoid\t\t*sc_toepcb;\t\t/* TOE protocol block */\n#endif\t\t\t\n\tstruct label\t*sc_label;\t\t/* MAC label reference */\n\tstruct ucred\t*sc_cred;\t\t/* cred cache for jail checks */\n\n\tu_int32_t\tsc_spare[2];\t\t/* UTO */\n};\n\n/*\n * Flags for the sc_flags field.\n */\n#define SCF_NOOPT\t0x01\t\t\t/* no TCP options */\n#define SCF_WINSCALE\t0x02\t\t\t/* negotiated window scaling */\n#define SCF_TIMESTAMP\t0x04\t\t\t/* negotiated timestamps */\n\t\t\t\t\t\t/* MSS is implicit */\n#define SCF_UNREACH\t0x10\t\t\t/* icmp unreachable received */\n#define SCF_SIGNATURE\t0x20\t\t\t/* send MD5 digests */\n#define SCF_SACK\t0x80\t\t\t/* send SACK option */\n#define SCF_ECN\t\t0x100\t\t\t/* send ECN setup packet */\n\n#define\tSYNCOOKIE_SECRET_SIZE\t8\t/* dwords */\n#define\tSYNCOOKIE_LIFETIME\t16\t/* seconds */\n\nstruct syncache_head {\n\tstruct vnet\t*sch_vnet;\n\tstruct mtx\tsch_mtx;\n\tTAILQ_HEAD(sch_head, syncache)\tsch_bucket;\n\tstruct callout\tsch_timer;\n\tint\t\tsch_nextc;\n\tu_int\t\tsch_length;\n\tu_int\t\tsch_oddeven;\n\tu_int32_t\tsch_secbits_odd[SYNCOOKIE_SECRET_SIZE];\n\tu_int32_t\tsch_secbits_even[SYNCOOKIE_SECRET_SIZE];\n\tu_int\t\tsch_reseed;\t\t/* time_uptime, seconds */\n};\n\nstruct tcp_syncache {\n\tstruct\tsyncache_head *hashbase;\n\tuma_zone_t zone;\n\tu_int\thashsize;\n\tu_int\thashmask;\n\tu_int\tbucket_limit;\n\tu_int\tcache_count;\t\t/* XXX: unprotected */\n\tu_int\tcache_limit;\n\tu_int\trexmt_limit;\n\tu_int\thash_secret;\n};\n\n#endif /* _KERNEL */\n#endif /* !_NETINET_TCP_SYNCACHE_H_ */\n"
  },
  {
    "path": "freebsd-headers/netinet/tcp_timer.h",
    "content": "/*-\n * Copyright (c) 1982, 1986, 1993\n *\tThe Regents of the University of California.  All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 4. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t@(#)tcp_timer.h\t8.1 (Berkeley) 6/10/93\n * $FreeBSD: release/9.0.0/sys/netinet/tcp_timer.h 212765 2010-09-16 21:06:45Z andre $\n */\n\n#ifndef _NETINET_TCP_TIMER_H_\n#define _NETINET_TCP_TIMER_H_\n\n/*\n * The TCPT_REXMT timer is used to force retransmissions.\n * The TCP has the TCPT_REXMT timer set whenever segments\n * have been sent for which ACKs are expected but not yet\n * received.  If an ACK is received which advances tp->snd_una,\n * then the retransmit timer is cleared (if there are no more\n * outstanding segments) or reset to the base value (if there\n * are more ACKs expected).  Whenever the retransmit timer goes off,\n * we retransmit one unacknowledged segment, and do a backoff\n * on the retransmit timer.\n *\n * The TCPT_PERSIST timer is used to keep window size information\n * flowing even if the window goes shut.  If all previous transmissions\n * have been acknowledged (so that there are no retransmissions in progress),\n * and the window is too small to bother sending anything, then we start\n * the TCPT_PERSIST timer.  When it expires, if the window is nonzero,\n * we go to transmit state.  Otherwise, at intervals send a single byte\n * into the peer's window to force him to update our window information.\n * We do this at most as often as TCPT_PERSMIN time intervals,\n * but no more frequently than the current estimate of round-trip\n * packet time.  The TCPT_PERSIST timer is cleared whenever we receive\n * a window update from the peer.\n *\n * The TCPT_KEEP timer is used to keep connections alive.  If an\n * connection is idle (no segments received) for TCPTV_KEEP_INIT amount of time,\n * but not yet established, then we drop the connection.  Once the connection\n * is established, if the connection is idle for TCPTV_KEEP_IDLE time\n * (and keepalives have been enabled on the socket), we begin to probe\n * the connection.  We force the peer to send us a segment by sending:\n *\t<SEQ=SND.UNA-1><ACK=RCV.NXT><CTL=ACK>\n * This segment is (deliberately) outside the window, and should elicit\n * an ack segment in response from the peer.  If, despite the TCPT_KEEP\n * initiated segments we cannot elicit a response from a peer in TCPT_MAXIDLE\n * amount of time probing, then we drop the connection.\n */\n\n/*\n * Time constants.\n */\n#define\tTCPTV_MSL\t( 30*hz)\t\t/* max seg lifetime (hah!) */\n#define\tTCPTV_SRTTBASE\t0\t\t\t/* base roundtrip time;\n\t\t\t\t\t\t   if 0, no idea yet */\n#define\tTCPTV_RTOBASE\t(  3*hz)\t\t/* assumed RTO if no info */\n#define\tTCPTV_SRTTDFLT\t(  3*hz)\t\t/* assumed RTT if no info */\n\n#define\tTCPTV_PERSMIN\t(  5*hz)\t\t/* retransmit persistence */\n#define\tTCPTV_PERSMAX\t( 60*hz)\t\t/* maximum persist interval */\n\n#define\tTCPTV_KEEP_INIT\t( 75*hz)\t\t/* initial connect keepalive */\n#define\tTCPTV_KEEP_IDLE\t(120*60*hz)\t\t/* dflt time before probing */\n#define\tTCPTV_KEEPINTVL\t( 75*hz)\t\t/* default probe interval */\n#define\tTCPTV_KEEPCNT\t8\t\t\t/* max probes before drop */\n\n#define TCPTV_FINWAIT2_TIMEOUT (60*hz)         /* FIN_WAIT_2 timeout if no receiver */\n\n/*\n * Minimum retransmit timer is 3 ticks, for algorithmic stability.\n * TCPT_RANGESET() will add another TCPTV_CPU_VAR to deal with\n * the expected worst-case processing variances by the kernels\n * representing the end points.  Such variances do not always show\n * up in the srtt because the timestamp is often calculated at\n * the interface rather then at the TCP layer.  This value is\n * typically 50ms.  However, it is also possible that delayed\n * acks (typically 100ms) could create issues so we set the slop\n * to 200ms to try to cover it.  Note that, properly speaking,\n * delayed-acks should not create a major issue for interactive\n * environments which 'P'ush the last segment, at least as\n * long as implementations do the required 'at least one ack\n * for every two packets' for the non-interactive streaming case.\n * (maybe the RTO calculation should use 2*RTT instead of RTT\n * to handle the ack-every-other-packet case).\n *\n * The prior minimum of 1*hz (1 second) badly breaks throughput on any\n * networks faster then a modem that has minor (e.g. 1%) packet loss.\n */\n#define\tTCPTV_MIN\t( hz/33 )\t\t/* minimum allowable value */\n#define TCPTV_CPU_VAR\t( hz/5 )\t\t/* cpu variance allowed (200ms) */\n#define\tTCPTV_REXMTMAX\t( 64*hz)\t\t/* max allowable REXMT value */\n\n#define TCPTV_TWTRUNC\t8\t\t\t/* RTO factor to truncate TW */\n\n#define\tTCP_LINGERTIME\t120\t\t\t/* linger at most 2 minutes */\n\n#define\tTCP_MAXRXTSHIFT\t12\t\t\t/* maximum retransmits */\n\n#define\tTCPTV_DELACK\t(hz / PR_FASTHZ / 2)\t/* 100ms timeout */\n\n#ifdef\tTCPTIMERS\nstatic const char *tcptimers[] =\n    { \"REXMT\", \"PERSIST\", \"KEEP\", \"2MSL\" };\n#endif\n\n/*\n * Force a time value to be in a certain range.\n */\n#define\tTCPT_RANGESET(tv, value, tvmin, tvmax) do { \\\n\t(tv) = (value) + tcp_rexmit_slop; \\\n\tif ((u_long)(tv) < (u_long)(tvmin)) \\\n\t\t(tv) = (tvmin); \\\n\tif ((u_long)(tv) > (u_long)(tvmax)) \\\n\t\t(tv) = (tvmax); \\\n} while(0)\n\n#ifdef _KERNEL\n\nstruct xtcp_timer;\n\nstruct tcp_timer {\n\tstruct\tcallout tt_rexmt;\t/* retransmit timer */\n\tstruct\tcallout tt_persist;\t/* retransmit persistence */\n\tstruct\tcallout tt_keep;\t/* keepalive */\n\tstruct\tcallout tt_2msl;\t/* 2*msl TIME_WAIT timer */\n\tstruct\tcallout tt_delack;\t/* delayed ACK timer */\n};\n#define TT_DELACK\t0x01\n#define TT_REXMT\t0x02\n#define TT_PERSIST\t0x04\n#define TT_KEEP\t\t0x08\n#define TT_2MSL\t\t0x10\n\nextern int tcp_keepinit;\t\t/* time to establish connection */\nextern int tcp_keepidle;\t\t/* time before keepalive probes begin */\nextern int tcp_keepintvl;\t\t/* time between keepalive probes */\nextern int tcp_maxidle;\t\t\t/* time to drop after starting probes */\nextern int tcp_delacktime;\t\t/* time before sending a delayed ACK */\nextern int tcp_maxpersistidle;\nextern int tcp_rexmit_min;\nextern int tcp_rexmit_slop;\nextern int tcp_msl;\nextern int tcp_ttl;\t\t\t/* time to live for TCP segs */\nextern int tcp_backoff[];\n\nextern int tcp_finwait2_timeout;\nextern int tcp_fast_finwait2_recycle;\n\nvoid\ttcp_timer_init(void);\nvoid\ttcp_timer_2msl(void *xtp);\nstruct tcptw *\n\ttcp_tw_2msl_scan(int _reuse);\t\t/* XXX temporary */\nvoid\ttcp_timer_keep(void *xtp);\nvoid\ttcp_timer_persist(void *xtp);\nvoid\ttcp_timer_rexmt(void *xtp);\nvoid\ttcp_timer_delack(void *xtp);\nvoid\ttcp_timer_to_xtimer(struct tcpcb *tp, struct tcp_timer *timer,\n\tstruct xtcp_timer *xtimer);\n\n#endif /* _KERNEL */\n\n#endif /* !_NETINET_TCP_TIMER_H_ */\n"
  },
  {
    "path": "freebsd-headers/netinet/tcp_var.h",
    "content": "/*-\n * Copyright (c) 1982, 1986, 1993, 1994, 1995\n *\tThe Regents of the University of California.  All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 4. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t@(#)tcp_var.h\t8.4 (Berkeley) 5/24/95\n * $FreeBSD: release/9.0.0/sys/netinet/tcp_var.h 224151 2011-07-17 21:15:20Z bz $\n */\n\n#ifndef _NETINET_TCP_VAR_H_\n#define _NETINET_TCP_VAR_H_\n\n#include <netinet/tcp.h>\n\n#ifdef _KERNEL\n#include <net/vnet.h>\n\n/*\n * Kernel variables for tcp.\n */\nVNET_DECLARE(int, tcp_do_rfc1323);\n#define\tV_tcp_do_rfc1323\tVNET(tcp_do_rfc1323)\n\n#endif /* _KERNEL */\n\n/* TCP segment queue entry */\nstruct tseg_qent {\n\tLIST_ENTRY(tseg_qent) tqe_q;\n\tint\ttqe_len;\t\t/* TCP segment data length */\n\tstruct\ttcphdr *tqe_th;\t\t/* a pointer to tcp header */\n\tstruct\tmbuf\t*tqe_m;\t\t/* mbuf contains packet */\n};\nLIST_HEAD(tsegqe_head, tseg_qent);\n\nstruct sackblk {\n\ttcp_seq start;\t\t/* start seq no. of sack block */\n\ttcp_seq end;\t\t/* end seq no. */\n};\n\nstruct sackhole {\n\ttcp_seq start;\t\t/* start seq no. of hole */\n\ttcp_seq end;\t\t/* end seq no. */\n\ttcp_seq rxmit;\t\t/* next seq. no in hole to be retransmitted */\n\tTAILQ_ENTRY(sackhole) scblink;\t/* scoreboard linkage */\n};\n\nstruct sackhint {\n\tstruct sackhole\t*nexthole;\n\tint\t\tsack_bytes_rexmit;\n\ttcp_seq\t\tlast_sack_ack;\t/* Most recent/largest sacked ack */\n\n\tint\t\tispare;\t\t/* explicit pad for 64bit alignment */\n\tuint64_t\t_pad[2];\t/* 1 sacked_bytes, 1 TBD */\n};\n\nstruct tcptemp {\n\tu_char\ttt_ipgen[40]; /* the size must be of max ip header, now IPv6 */\n\tstruct\ttcphdr tt_t;\n};\n\n#define tcp6cb\t\ttcpcb  /* for KAME src sync over BSD*'s */\n\n/* Neighbor Discovery, Neighbor Unreachability Detection Upper layer hint. */\n#ifdef INET6\n#define ND6_HINT(tp)\t\t\t\t\t\t\\\ndo {\t\t\t\t\t\t\t\t\\\n\tif ((tp) && (tp)->t_inpcb &&\t\t\t\t\\\n\t    ((tp)->t_inpcb->inp_vflag & INP_IPV6) != 0)\t\t\\\n\t\tnd6_nud_hint(NULL, NULL, 0);\t\t\t\\\n} while (0)\n#else\n#define ND6_HINT(tp)\n#endif\n\n/*\n * Tcp control block, one per tcp; fields:\n * Organized for 16 byte cacheline efficiency.\n */\nstruct tcpcb {\n\tstruct\ttsegqe_head t_segq;\t/* segment reassembly queue */\n\tvoid\t*t_pspare[2];\t\t/* new reassembly queue */\n\tint\tt_segqlen;\t\t/* segment reassembly queue length */\n\tint\tt_dupacks;\t\t/* consecutive dup acks recd */\n\n\tstruct tcp_timer *t_timers;\t/* All the TCP timers in one struct */\n\n\tstruct\tinpcb *t_inpcb;\t\t/* back pointer to internet pcb */\n\tint\tt_state;\t\t/* state of this connection */\n\tu_int\tt_flags;\n\n\tstruct\tvnet *t_vnet;\t\t/* back pointer to parent vnet */\n\n\ttcp_seq\tsnd_una;\t\t/* send unacknowledged */\n\ttcp_seq\tsnd_max;\t\t/* highest sequence number sent;\n\t\t\t\t\t * used to recognize retransmits\n\t\t\t\t\t */\n\ttcp_seq\tsnd_nxt;\t\t/* send next */\n\ttcp_seq\tsnd_up;\t\t\t/* send urgent pointer */\n\n\ttcp_seq\tsnd_wl1;\t\t/* window update seg seq number */\n\ttcp_seq\tsnd_wl2;\t\t/* window update seg ack number */\n\ttcp_seq\tiss;\t\t\t/* initial send sequence number */\n\ttcp_seq\tirs;\t\t\t/* initial receive sequence number */\n\n\ttcp_seq\trcv_nxt;\t\t/* receive next */\n\ttcp_seq\trcv_adv;\t\t/* advertised window */\n\tu_long\trcv_wnd;\t\t/* receive window */\n\ttcp_seq\trcv_up;\t\t\t/* receive urgent pointer */\n\n\tu_long\tsnd_wnd;\t\t/* send window */\n\tu_long\tsnd_cwnd;\t\t/* congestion-controlled window */\n\tu_long\tsnd_spare1;\t\t/* unused */\n\tu_long\tsnd_ssthresh;\t\t/* snd_cwnd size threshold for\n\t\t\t\t\t * for slow start exponential to\n\t\t\t\t\t * linear switch\n\t\t\t\t\t */\n\tu_long\tsnd_spare2;\t\t/* unused */\n\ttcp_seq\tsnd_recover;\t\t/* for use in NewReno Fast Recovery */\n\n\tu_int\tt_maxopd;\t\t/* mss plus options */\n\n\tu_int\tt_rcvtime;\t\t/* inactivity time */\n\tu_int\tt_starttime;\t\t/* time connection was established */\n\tu_int\tt_rtttime;\t\t/* RTT measurement start time */\n\ttcp_seq\tt_rtseq;\t\t/* sequence number being timed */\n\n\tu_int\tt_bw_spare1;\t\t/* unused */\n\ttcp_seq\tt_bw_spare2;\t\t/* unused */\n\n\tint\tt_rxtcur;\t\t/* current retransmit value (ticks) */\n\tu_int\tt_maxseg;\t\t/* maximum segment size */\n\tint\tt_srtt;\t\t\t/* smoothed round-trip time */\n\tint\tt_rttvar;\t\t/* variance in round-trip time */\n\n\tint\tt_rxtshift;\t\t/* log(2) of rexmt exp. backoff */\n\tu_int\tt_rttmin;\t\t/* minimum rtt allowed */\n\tu_int\tt_rttbest;\t\t/* best rtt we've seen */\n\tu_long\tt_rttupdated;\t\t/* number of times rtt sampled */\n\tu_long\tmax_sndwnd;\t\t/* largest window peer has offered */\n\n\tint\tt_softerror;\t\t/* possible error not yet reported */\n/* out-of-band data */\n\tchar\tt_oobflags;\t\t/* have some */\n\tchar\tt_iobc;\t\t\t/* input character */\n/* RFC 1323 variables */\n\tu_char\tsnd_scale;\t\t/* window scaling for send window */\n\tu_char\trcv_scale;\t\t/* window scaling for recv window */\n\tu_char\trequest_r_scale;\t/* pending window scaling */\n\tu_int32_t  ts_recent;\t\t/* timestamp echo data */\n\tu_int\tts_recent_age;\t\t/* when last updated */\n\tu_int32_t  ts_offset;\t\t/* our timestamp offset */\n\n\ttcp_seq\tlast_ack_sent;\n/* experimental */\n\tu_long\tsnd_cwnd_prev;\t\t/* cwnd prior to retransmit */\n\tu_long\tsnd_ssthresh_prev;\t/* ssthresh prior to retransmit */\n\ttcp_seq\tsnd_recover_prev;\t/* snd_recover prior to retransmit */\n\tint\tt_sndzerowin;\t\t/* zero-window updates sent */\n\tu_int\tt_badrxtwin;\t\t/* window for retransmit recovery */\n\tu_char\tsnd_limited;\t\t/* segments limited transmitted */\n/* SACK related state */\n\tint\tsnd_numholes;\t\t/* number of holes seen by sender */\n\tTAILQ_HEAD(sackhole_head, sackhole) snd_holes;\n\t\t\t\t\t/* SACK scoreboard (sorted) */\n\ttcp_seq\tsnd_fack;\t\t/* last seq number(+1) sack'd by rcv'r*/\n\tint\trcv_numsacks;\t\t/* # distinct sack blks present */\n\tstruct sackblk sackblks[MAX_SACK_BLKS]; /* seq nos. of sack blocks */\n\ttcp_seq sack_newdata;\t\t/* New data xmitted in this recovery\n\t\t\t\t\t   episode starts at this seq number */\n\tstruct sackhint\tsackhint;\t/* SACK scoreboard hint */\n\tint\tt_rttlow;\t\t/* smallest observerved RTT */\n\tu_int32_t\trfbuf_ts;\t/* recv buffer autoscaling timestamp */\n\tint\trfbuf_cnt;\t\t/* recv buffer autoscaling byte count */\n\tstruct toe_usrreqs *t_tu;\t/* offload operations vector */\n\tint\tt_sndrexmitpack;\t/* retransmit packets sent */\n\tint\tt_rcvoopack;\t\t/* out-of-order packets received */\n\tvoid\t*t_toe;\t\t\t/* TOE pcb pointer */\n\tint\tt_bytes_acked;\t\t/* # bytes acked during current RTT */\n\tstruct cc_algo\t*cc_algo;\t/* congestion control algorithm */\n\tstruct cc_var\t*ccv;\t\t/* congestion control specific vars */\n\tstruct osd\t*osd;\t\t/* storage for Khelp module data */\n\n\tuint32_t t_ispare[12];\t\t/* 4 keep timers, 5 UTO, 3 TBD */\n\tvoid\t*t_pspare2[4];\t\t/* 4 TBD */\n\tuint64_t _pad[6];\t\t/* 6 TBD (1-2 CC/RTT?) */\n};\n\n/*\n * Flags and utility macros for the t_flags field.\n */\n#define\tTF_ACKNOW\t0x000001\t/* ack peer immediately */\n#define\tTF_DELACK\t0x000002\t/* ack, but try to delay it */\n#define\tTF_NODELAY\t0x000004\t/* don't delay packets to coalesce */\n#define\tTF_NOOPT\t0x000008\t/* don't use tcp options */\n#define\tTF_SENTFIN\t0x000010\t/* have sent FIN */\n#define\tTF_REQ_SCALE\t0x000020\t/* have/will request window scaling */\n#define\tTF_RCVD_SCALE\t0x000040\t/* other side has requested scaling */\n#define\tTF_REQ_TSTMP\t0x000080\t/* have/will request timestamps */\n#define\tTF_RCVD_TSTMP\t0x000100\t/* a timestamp was received in SYN */\n#define\tTF_SACK_PERMIT\t0x000200\t/* other side said I could SACK */\n#define\tTF_NEEDSYN\t0x000400\t/* send SYN (implicit state) */\n#define\tTF_NEEDFIN\t0x000800\t/* send FIN (implicit state) */\n#define\tTF_NOPUSH\t0x001000\t/* don't push */\n#define\tTF_PREVVALID\t0x002000\t/* saved values for bad rxmit valid */\n#define\tTF_MORETOCOME\t0x010000\t/* More data to be appended to sock */\n#define\tTF_LQ_OVERFLOW\t0x020000\t/* listen queue overflow */\n#define\tTF_LASTIDLE\t0x040000\t/* connection was previously idle */\n#define\tTF_RXWIN0SENT\t0x080000\t/* sent a receiver win 0 in response */\n#define\tTF_FASTRECOVERY\t0x100000\t/* in NewReno Fast Recovery */\n#define\tTF_WASFRECOVERY\t0x200000\t/* was in NewReno Fast Recovery */\n#define\tTF_SIGNATURE\t0x400000\t/* require MD5 digests (RFC2385) */\n#define\tTF_FORCEDATA\t0x800000\t/* force out a byte */\n#define\tTF_TSO\t\t0x1000000\t/* TSO enabled on this connection */\n#define\tTF_TOE\t\t0x2000000\t/* this connection is offloaded */\n#define\tTF_ECN_PERMIT\t0x4000000\t/* connection ECN-ready */\n#define\tTF_ECN_SND_CWR\t0x8000000\t/* ECN CWR in queue */\n#define\tTF_ECN_SND_ECE\t0x10000000\t/* ECN ECE in queue */\n#define\tTF_CONGRECOVERY\t0x20000000\t/* congestion recovery mode */\n#define\tTF_WASCRECOVERY\t0x40000000\t/* was in congestion recovery */\n\n#define\tIN_FASTRECOVERY(t_flags)\t(t_flags & TF_FASTRECOVERY)\n#define\tENTER_FASTRECOVERY(t_flags)\tt_flags |= TF_FASTRECOVERY\n#define\tEXIT_FASTRECOVERY(t_flags)\tt_flags &= ~TF_FASTRECOVERY\n\n#define\tIN_CONGRECOVERY(t_flags)\t(t_flags & TF_CONGRECOVERY)\n#define\tENTER_CONGRECOVERY(t_flags)\tt_flags |= TF_CONGRECOVERY\n#define\tEXIT_CONGRECOVERY(t_flags)\tt_flags &= ~TF_CONGRECOVERY\n\n#define\tIN_RECOVERY(t_flags) (t_flags & (TF_CONGRECOVERY | TF_FASTRECOVERY))\n#define\tENTER_RECOVERY(t_flags) t_flags |= (TF_CONGRECOVERY | TF_FASTRECOVERY)\n#define\tEXIT_RECOVERY(t_flags) t_flags &= ~(TF_CONGRECOVERY | TF_FASTRECOVERY)\n\n#define\tBYTES_THIS_ACK(tp, th)\t(th->th_ack - tp->snd_una)\n\n/*\n * Flags for the t_oobflags field.\n */\n#define\tTCPOOB_HAVEDATA\t0x01\n#define\tTCPOOB_HADDATA\t0x02\n\n#ifdef TCP_SIGNATURE\n/*\n * Defines which are needed by the xform_tcp module and tcp_[in|out]put\n * for SADB verification and lookup.\n */\n#define\tTCP_SIGLEN\t16\t/* length of computed digest in bytes */\n#define\tTCP_KEYLEN_MIN\t1\t/* minimum length of TCP-MD5 key */\n#define\tTCP_KEYLEN_MAX\t80\t/* maximum length of TCP-MD5 key */\n/*\n * Only a single SA per host may be specified at this time. An SPI is\n * needed in order for the KEY_ALLOCSA() lookup to work.\n */\n#define\tTCP_SIG_SPI\t0x1000\n#endif /* TCP_SIGNATURE */\n\n/*\n * Structure to hold TCP options that are only used during segment\n * processing (in tcp_input), but not held in the tcpcb.\n * It's basically used to reduce the number of parameters\n * to tcp_dooptions and tcp_addoptions.\n * The binary order of the to_flags is relevant for packing of the\n * options in tcp_addoptions.\n */\nstruct tcpopt {\n\tu_int64_t\tto_flags;\t/* which options are present */\n#define\tTOF_MSS\t\t0x0001\t\t/* maximum segment size */\n#define\tTOF_SCALE\t0x0002\t\t/* window scaling */\n#define\tTOF_SACKPERM\t0x0004\t\t/* SACK permitted */\n#define\tTOF_TS\t\t0x0010\t\t/* timestamp */\n#define\tTOF_SIGNATURE\t0x0040\t\t/* TCP-MD5 signature option (RFC2385) */\n#define\tTOF_SACK\t0x0080\t\t/* Peer sent SACK option */\n#define\tTOF_MAXOPT\t0x0100\n\tu_int32_t\tto_tsval;\t/* new timestamp */\n\tu_int32_t\tto_tsecr;\t/* reflected timestamp */\n\tu_char\t\t*to_sacks;\t/* pointer to the first SACK blocks */\n\tu_char\t\t*to_signature;\t/* pointer to the TCP-MD5 signature */\n\tu_int16_t\tto_mss;\t\t/* maximum segment size */\n\tu_int8_t\tto_wscale;\t/* window scaling */\n\tu_int8_t\tto_nsacks;\t/* number of SACK blocks */\n\tu_int32_t\tto_spare;\t/* UTO */\n};\n\n/*\n * Flags for tcp_dooptions.\n */\n#define\tTO_SYN\t\t0x01\t\t/* parse SYN-only options */\n\nstruct hc_metrics_lite {\t/* must stay in sync with hc_metrics */\n\tu_long\trmx_mtu;\t/* MTU for this path */\n\tu_long\trmx_ssthresh;\t/* outbound gateway buffer limit */\n\tu_long\trmx_rtt;\t/* estimated round trip time */\n\tu_long\trmx_rttvar;\t/* estimated rtt variance */\n\tu_long\trmx_bandwidth;\t/* estimated bandwidth */\n\tu_long\trmx_cwnd;\t/* congestion window */\n\tu_long\trmx_sendpipe;   /* outbound delay-bandwidth product */\n\tu_long\trmx_recvpipe;   /* inbound delay-bandwidth product */\n};\n\n#ifndef _NETINET_IN_PCB_H_\nstruct in_conninfo;\n#endif /* _NETINET_IN_PCB_H_ */\n\nstruct tcptw {\n\tstruct inpcb\t*tw_inpcb;\t/* XXX back pointer to internet pcb */\n\ttcp_seq\t\tsnd_nxt;\n\ttcp_seq\t\trcv_nxt;\n\ttcp_seq\t\tiss;\n\ttcp_seq\t\tirs;\n\tu_short\t\tlast_win;\t/* cached window value */\n\tu_short\t\ttw_so_options;\t/* copy of so_options */\n\tstruct ucred\t*tw_cred;\t/* user credentials */\n\tu_int32_t\tt_recent;\n\tu_int32_t\tts_offset;\t/* our timestamp offset */\n\tu_int\t\tt_starttime;\n\tint\t\ttw_time;\n\tTAILQ_ENTRY(tcptw) tw_2msl;\n};\n\n#define\tintotcpcb(ip)\t((struct tcpcb *)(ip)->inp_ppcb)\n#define\tintotw(ip)\t((struct tcptw *)(ip)->inp_ppcb)\n#define\tsototcpcb(so)\t(intotcpcb(sotoinpcb(so)))\n\n/*\n * The smoothed round-trip time and estimated variance\n * are stored as fixed point numbers scaled by the values below.\n * For convenience, these scales are also used in smoothing the average\n * (smoothed = (1/scale)sample + ((scale-1)/scale)smoothed).\n * With these scales, srtt has 3 bits to the right of the binary point,\n * and thus an \"ALPHA\" of 0.875.  rttvar has 2 bits to the right of the\n * binary point, and is smoothed with an ALPHA of 0.75.\n */\n#define\tTCP_RTT_SCALE\t\t32\t/* multiplier for srtt; 3 bits frac. */\n#define\tTCP_RTT_SHIFT\t\t5\t/* shift for srtt; 3 bits frac. */\n#define\tTCP_RTTVAR_SCALE\t16\t/* multiplier for rttvar; 2 bits */\n#define\tTCP_RTTVAR_SHIFT\t4\t/* shift for rttvar; 2 bits */\n#define\tTCP_DELTA_SHIFT\t\t2\t/* see tcp_input.c */\n\n/*\n * The initial retransmission should happen at rtt + 4 * rttvar.\n * Because of the way we do the smoothing, srtt and rttvar\n * will each average +1/2 tick of bias.  When we compute\n * the retransmit timer, we want 1/2 tick of rounding and\n * 1 extra tick because of +-1/2 tick uncertainty in the\n * firing of the timer.  The bias will give us exactly the\n * 1.5 tick we need.  But, because the bias is\n * statistical, we have to test that we don't drop below\n * the minimum feasible timer (which is 2 ticks).\n * This version of the macro adapted from a paper by Lawrence\n * Brakmo and Larry Peterson which outlines a problem caused\n * by insufficient precision in the original implementation,\n * which results in inappropriately large RTO values for very\n * fast networks.\n */\n#define\tTCP_REXMTVAL(tp) \\\n\tmax((tp)->t_rttmin, (((tp)->t_srtt >> (TCP_RTT_SHIFT - TCP_DELTA_SHIFT))  \\\n\t  + (tp)->t_rttvar) >> TCP_DELTA_SHIFT)\n\n/*\n * TCP statistics.\n * Many of these should be kept per connection,\n * but that's inconvenient at the moment.\n */\nstruct\ttcpstat {\n\tu_long\ttcps_connattempt;\t/* connections initiated */\n\tu_long\ttcps_accepts;\t\t/* connections accepted */\n\tu_long\ttcps_connects;\t\t/* connections established */\n\tu_long\ttcps_drops;\t\t/* connections dropped */\n\tu_long\ttcps_conndrops;\t\t/* embryonic connections dropped */\n\tu_long\ttcps_minmssdrops;\t/* average minmss too low drops */\n\tu_long\ttcps_closed;\t\t/* conn. closed (includes drops) */\n\tu_long\ttcps_segstimed;\t\t/* segs where we tried to get rtt */\n\tu_long\ttcps_rttupdated;\t/* times we succeeded */\n\tu_long\ttcps_delack;\t\t/* delayed acks sent */\n\tu_long\ttcps_timeoutdrop;\t/* conn. dropped in rxmt timeout */\n\tu_long\ttcps_rexmttimeo;\t/* retransmit timeouts */\n\tu_long\ttcps_persisttimeo;\t/* persist timeouts */\n\tu_long\ttcps_keeptimeo;\t\t/* keepalive timeouts */\n\tu_long\ttcps_keepprobe;\t\t/* keepalive probes sent */\n\tu_long\ttcps_keepdrops;\t\t/* connections dropped in keepalive */\n\n\tu_long\ttcps_sndtotal;\t\t/* total packets sent */\n\tu_long\ttcps_sndpack;\t\t/* data packets sent */\n\tu_long\ttcps_sndbyte;\t\t/* data bytes sent */\n\tu_long\ttcps_sndrexmitpack;\t/* data packets retransmitted */\n\tu_long\ttcps_sndrexmitbyte;\t/* data bytes retransmitted */\n\tu_long\ttcps_sndrexmitbad;\t/* unnecessary packet retransmissions */\n\tu_long\ttcps_sndacks;\t\t/* ack-only packets sent */\n\tu_long\ttcps_sndprobe;\t\t/* window probes sent */\n\tu_long\ttcps_sndurg;\t\t/* packets sent with URG only */\n\tu_long\ttcps_sndwinup;\t\t/* window update-only packets sent */\n\tu_long\ttcps_sndctrl;\t\t/* control (SYN|FIN|RST) packets sent */\n\n\tu_long\ttcps_rcvtotal;\t\t/* total packets received */\n\tu_long\ttcps_rcvpack;\t\t/* packets received in sequence */\n\tu_long\ttcps_rcvbyte;\t\t/* bytes received in sequence */\n\tu_long\ttcps_rcvbadsum;\t\t/* packets received with ccksum errs */\n\tu_long\ttcps_rcvbadoff;\t\t/* packets received with bad offset */\n\tu_long\ttcps_rcvmemdrop;\t/* packets dropped for lack of memory */\n\tu_long\ttcps_rcvshort;\t\t/* packets received too short */\n\tu_long\ttcps_rcvduppack;\t/* duplicate-only packets received */\n\tu_long\ttcps_rcvdupbyte;\t/* duplicate-only bytes received */\n\tu_long\ttcps_rcvpartduppack;\t/* packets with some duplicate data */\n\tu_long\ttcps_rcvpartdupbyte;\t/* dup. bytes in part-dup. packets */\n\tu_long\ttcps_rcvoopack;\t\t/* out-of-order packets received */\n\tu_long\ttcps_rcvoobyte;\t\t/* out-of-order bytes received */\n\tu_long\ttcps_rcvpackafterwin;\t/* packets with data after window */\n\tu_long\ttcps_rcvbyteafterwin;\t/* bytes rcvd after window */\n\tu_long\ttcps_rcvafterclose;\t/* packets rcvd after \"close\" */\n\tu_long\ttcps_rcvwinprobe;\t/* rcvd window probe packets */\n\tu_long\ttcps_rcvdupack;\t\t/* rcvd duplicate acks */\n\tu_long\ttcps_rcvacktoomuch;\t/* rcvd acks for unsent data */\n\tu_long\ttcps_rcvackpack;\t/* rcvd ack packets */\n\tu_long\ttcps_rcvackbyte;\t/* bytes acked by rcvd acks */\n\tu_long\ttcps_rcvwinupd;\t\t/* rcvd window update packets */\n\tu_long\ttcps_pawsdrop;\t\t/* segments dropped due to PAWS */\n\tu_long\ttcps_predack;\t\t/* times hdr predict ok for acks */\n\tu_long\ttcps_preddat;\t\t/* times hdr predict ok for data pkts */\n\tu_long\ttcps_pcbcachemiss;\n\tu_long\ttcps_cachedrtt;\t\t/* times cached RTT in route updated */\n\tu_long\ttcps_cachedrttvar;\t/* times cached rttvar updated */\n\tu_long\ttcps_cachedssthresh;\t/* times cached ssthresh updated */\n\tu_long\ttcps_usedrtt;\t\t/* times RTT initialized from route */\n\tu_long\ttcps_usedrttvar;\t/* times RTTVAR initialized from rt */\n\tu_long\ttcps_usedssthresh;\t/* times ssthresh initialized from rt*/\n\tu_long\ttcps_persistdrop;\t/* timeout in persist state */\n\tu_long\ttcps_badsyn;\t\t/* bogus SYN, e.g. premature ACK */\n\tu_long\ttcps_mturesent;\t\t/* resends due to MTU discovery */\n\tu_long\ttcps_listendrop;\t/* listen queue overflows */\n\tu_long\ttcps_badrst;\t\t/* ignored RSTs in the window */\n\n\tu_long\ttcps_sc_added;\t\t/* entry added to syncache */\n\tu_long\ttcps_sc_retransmitted;\t/* syncache entry was retransmitted */\n\tu_long\ttcps_sc_dupsyn;\t\t/* duplicate SYN packet */\n\tu_long\ttcps_sc_dropped;\t/* could not reply to packet */\n\tu_long\ttcps_sc_completed;\t/* successful extraction of entry */\n\tu_long\ttcps_sc_bucketoverflow;\t/* syncache per-bucket limit hit */\n\tu_long\ttcps_sc_cacheoverflow;\t/* syncache cache limit hit */\n\tu_long\ttcps_sc_reset;\t\t/* RST removed entry from syncache */\n\tu_long\ttcps_sc_stale;\t\t/* timed out or listen socket gone */\n\tu_long\ttcps_sc_aborted;\t/* syncache entry aborted */\n\tu_long\ttcps_sc_badack;\t\t/* removed due to bad ACK */\n\tu_long\ttcps_sc_unreach;\t/* ICMP unreachable received */\n\tu_long\ttcps_sc_zonefail;\t/* zalloc() failed */\n\tu_long\ttcps_sc_sendcookie;\t/* SYN cookie sent */\n\tu_long\ttcps_sc_recvcookie;\t/* SYN cookie received */\n\n\tu_long\ttcps_hc_added;\t\t/* entry added to hostcache */\n\tu_long\ttcps_hc_bucketoverflow;\t/* hostcache per bucket limit hit */\n\n\tu_long  tcps_finwait2_drops;    /* Drop FIN_WAIT_2 connection after time limit */\n\n\t/* SACK related stats */\n\tu_long\ttcps_sack_recovery_episode; /* SACK recovery episodes */\n\tu_long  tcps_sack_rexmits;\t    /* SACK rexmit segments   */\n\tu_long  tcps_sack_rexmit_bytes;\t    /* SACK rexmit bytes      */\n\tu_long  tcps_sack_rcv_blocks;\t    /* SACK blocks (options) received */\n\tu_long  tcps_sack_send_blocks;\t    /* SACK blocks (options) sent     */\n\tu_long  tcps_sack_sboverflow;\t    /* times scoreboard overflowed */\n\t\n\t/* ECN related stats */\n\tu_long\ttcps_ecn_ce;\t\t/* ECN Congestion Experienced */\n\tu_long\ttcps_ecn_ect0;\t\t/* ECN Capable Transport */\n\tu_long\ttcps_ecn_ect1;\t\t/* ECN Capable Transport */\n\tu_long\ttcps_ecn_shs;\t\t/* ECN successful handshakes */\n\tu_long\ttcps_ecn_rcwnd;\t\t/* # times ECN reduced the cwnd */\n\n\t/* TCP_SIGNATURE related stats */\n\tu_long\ttcps_sig_rcvgoodsig;\t/* Total matching signature received */\n\tu_long\ttcps_sig_rcvbadsig;\t/* Total bad signature received */\n\tu_long\ttcps_sig_err_buildsig;\t/* Mismatching signature received */\n\tu_long\ttcps_sig_err_sigopt;\t/* No signature expected by socket */\n\tu_long\ttcps_sig_err_nosigopt;\t/* No signature provided by segment */\n\n\tu_long\t_pad[12];\t\t/* 6 UTO, 6 TBD */\n};\n\n#ifdef _KERNEL\n/*\n * In-kernel consumers can use these accessor macros directly to update\n * stats.\n */\n#define\tTCPSTAT_ADD(name, val)\tV_tcpstat.name += (val)\n#define\tTCPSTAT_INC(name)\tTCPSTAT_ADD(name, 1)\n\n/*\n * Kernel module consumers must use this accessor macro.\n */\nvoid\tkmod_tcpstat_inc(int statnum);\n#define\tKMOD_TCPSTAT_INC(name)\t\t\t\t\t\t\\\n\tkmod_tcpstat_inc(offsetof(struct tcpstat, name) / sizeof(u_long))\n\n/*\n * TCP specific helper hook point identifiers.\n */\n#define\tHHOOK_TCP_EST_IN\t\t0\n#define\tHHOOK_TCP_EST_OUT\t\t1\n#define\tHHOOK_TCP_LAST\t\t\tHHOOK_TCP_EST_OUT\n\nstruct tcp_hhook_data {\n\tstruct tcpcb\t*tp;\n\tstruct tcphdr\t*th;\n\tstruct tcpopt\t*to;\n\tlong\t\tlen;\n\tint\t\ttso;\n\ttcp_seq\t\tcurack;\n};\n#endif\n\n/*\n * TCB structure exported to user-land via sysctl(3).\n * Evil hack: declare only if in_pcb.h and sys/socketvar.h have been\n * included.  Not all of our clients do.\n */\n#if defined(_NETINET_IN_PCB_H_) && defined(_SYS_SOCKETVAR_H_)\nstruct xtcp_timer {\n\tint tt_rexmt;\t/* retransmit timer */\n\tint tt_persist;\t/* retransmit persistence */\n\tint tt_keep;\t/* keepalive */\n\tint tt_2msl;\t/* 2*msl TIME_WAIT timer */\n\tint tt_delack;\t/* delayed ACK timer */\n\tint t_rcvtime;\t/* Time since last packet received */\n};\nstruct\txtcpcb {\n\tsize_t\txt_len;\n\tstruct\tinpcb\txt_inp;\n\tstruct\ttcpcb\txt_tp;\n\tstruct\txsocket\txt_socket;\n\tstruct\txtcp_timer xt_timer;\n\tu_quad_t\txt_alignment_hack;\n};\n#endif\n\n/*\n * Names for TCP sysctl objects\n */\n#define\tTCPCTL_DO_RFC1323\t1\t/* use RFC-1323 extensions */\n#define\tTCPCTL_MSSDFLT\t\t3\t/* MSS default */\n#define TCPCTL_STATS\t\t4\t/* statistics (read-only) */\n#define\tTCPCTL_RTTDFLT\t\t5\t/* default RTT estimate */\n#define\tTCPCTL_KEEPIDLE\t\t6\t/* keepalive idle timer */\n#define\tTCPCTL_KEEPINTVL\t7\t/* interval to send keepalives */\n#define\tTCPCTL_SENDSPACE\t8\t/* send buffer space */\n#define\tTCPCTL_RECVSPACE\t9\t/* receive buffer space */\n#define\tTCPCTL_KEEPINIT\t\t10\t/* timeout for establishing syn */\n#define\tTCPCTL_PCBLIST\t\t11\t/* list of all outstanding PCBs */\n#define\tTCPCTL_DELACKTIME\t12\t/* time before sending delayed ACK */\n#define\tTCPCTL_V6MSSDFLT\t13\t/* MSS default for IPv6 */\n#define\tTCPCTL_SACK\t\t14\t/* Selective Acknowledgement,rfc 2018 */\n#define\tTCPCTL_DROP\t\t15\t/* drop tcp connection */\n#define\tTCPCTL_MAXID\t\t16\n#define TCPCTL_FINWAIT2_TIMEOUT        17\n\n#define TCPCTL_NAMES { \\\n\t{ 0, 0 }, \\\n\t{ \"rfc1323\", CTLTYPE_INT }, \\\n\t{ \"mssdflt\", CTLTYPE_INT }, \\\n\t{ \"stats\", CTLTYPE_STRUCT }, \\\n\t{ \"rttdflt\", CTLTYPE_INT }, \\\n\t{ \"keepidle\", CTLTYPE_INT }, \\\n\t{ \"keepintvl\", CTLTYPE_INT }, \\\n\t{ \"sendspace\", CTLTYPE_INT }, \\\n\t{ \"recvspace\", CTLTYPE_INT }, \\\n\t{ \"keepinit\", CTLTYPE_INT }, \\\n\t{ \"pcblist\", CTLTYPE_STRUCT }, \\\n\t{ \"delacktime\", CTLTYPE_INT }, \\\n\t{ \"v6mssdflt\", CTLTYPE_INT }, \\\n\t{ \"maxid\", CTLTYPE_INT }, \\\n}\n\n\n#ifdef _KERNEL\n#ifdef SYSCTL_DECL\nSYSCTL_DECL(_net_inet_tcp);\nSYSCTL_DECL(_net_inet_tcp_sack);\nMALLOC_DECLARE(M_TCPLOG);\n#endif\n\nVNET_DECLARE(struct inpcbhead, tcb);\t\t/* queue of active tcpcb's */\nVNET_DECLARE(struct inpcbinfo, tcbinfo);\nVNET_DECLARE(struct tcpstat, tcpstat);\t\t/* tcp statistics */\nextern\tint tcp_log_in_vain;\nVNET_DECLARE(int, tcp_mssdflt);\t/* XXX */\nVNET_DECLARE(int, tcp_minmss);\nVNET_DECLARE(int, tcp_delack_enabled);\nVNET_DECLARE(int, tcp_do_rfc3390);\nVNET_DECLARE(int, path_mtu_discovery);\nVNET_DECLARE(int, ss_fltsz);\nVNET_DECLARE(int, ss_fltsz_local);\nVNET_DECLARE(int, tcp_do_rfc3465);\nVNET_DECLARE(int, tcp_abc_l_var);\n#define\tV_tcb\t\t\tVNET(tcb)\n#define\tV_tcbinfo\t\tVNET(tcbinfo)\n#define\tV_tcpstat\t\tVNET(tcpstat)\n#define\tV_tcp_mssdflt\t\tVNET(tcp_mssdflt)\n#define\tV_tcp_minmss\t\tVNET(tcp_minmss)\n#define\tV_tcp_delack_enabled\tVNET(tcp_delack_enabled)\n#define\tV_tcp_do_rfc3390\tVNET(tcp_do_rfc3390)\n#define\tV_path_mtu_discovery\tVNET(path_mtu_discovery)\n#define\tV_ss_fltsz\t\tVNET(ss_fltsz)\n#define\tV_ss_fltsz_local\tVNET(ss_fltsz_local)\n#define\tV_tcp_do_rfc3465\tVNET(tcp_do_rfc3465)\n#define\tV_tcp_abc_l_var\t\tVNET(tcp_abc_l_var)\n\nVNET_DECLARE(int, tcp_do_sack);\t\t\t/* SACK enabled/disabled */\nVNET_DECLARE(int, tcp_sc_rst_sock_fail);\t/* RST on sock alloc failure */\n#define\tV_tcp_do_sack\t\tVNET(tcp_do_sack)\n#define\tV_tcp_sc_rst_sock_fail\tVNET(tcp_sc_rst_sock_fail)\n\nVNET_DECLARE(int, tcp_do_ecn);\t\t\t/* TCP ECN enabled/disabled */\nVNET_DECLARE(int, tcp_ecn_maxretries);\n#define\tV_tcp_do_ecn\t\tVNET(tcp_do_ecn)\n#define\tV_tcp_ecn_maxretries\tVNET(tcp_ecn_maxretries)\n\nVNET_DECLARE(struct hhook_head *, tcp_hhh[HHOOK_TCP_LAST + 1]);\n#define\tV_tcp_hhh\t\tVNET(tcp_hhh)\n\nint\t tcp_addoptions(struct tcpopt *, u_char *);\nint\t tcp_ccalgounload(struct cc_algo *unload_algo);\nstruct tcpcb *\n\t tcp_close(struct tcpcb *);\nvoid\t tcp_discardcb(struct tcpcb *);\nvoid\t tcp_twstart(struct tcpcb *);\n#if 0\nint\t tcp_twrecycleable(struct tcptw *tw);\n#endif\nvoid\t tcp_twclose(struct tcptw *_tw, int _reuse);\nvoid\t tcp_ctlinput(int, struct sockaddr *, void *);\nint\t tcp_ctloutput(struct socket *, struct sockopt *);\nstruct tcpcb *\n\t tcp_drop(struct tcpcb *, int);\nvoid\t tcp_drain(void);\nvoid\t tcp_init(void);\n#ifdef VIMAGE\nvoid\t tcp_destroy(void);\n#endif\nvoid\t tcp_fini(void *);\nchar\t*tcp_log_addrs(struct in_conninfo *, struct tcphdr *, void *,\n\t    const void *);\nchar\t*tcp_log_vain(struct in_conninfo *, struct tcphdr *, void *,\n\t    const void *);\nint\t tcp_reass(struct tcpcb *, struct tcphdr *, int *, struct mbuf *);\nvoid\t tcp_reass_init(void);\nvoid\t tcp_reass_flush(struct tcpcb *);\n#ifdef VIMAGE\nvoid\t tcp_reass_destroy(void);\n#endif\nvoid\t tcp_input(struct mbuf *, int);\nu_long\t tcp_maxmtu(struct in_conninfo *, int *);\nu_long\t tcp_maxmtu6(struct in_conninfo *, int *);\nvoid\t tcp_mss_update(struct tcpcb *, int, struct hc_metrics_lite *, int *);\nvoid\t tcp_mss(struct tcpcb *, int);\nint\t tcp_mssopt(struct in_conninfo *);\nstruct inpcb *\n\t tcp_drop_syn_sent(struct inpcb *, int);\nstruct inpcb *\n\t tcp_mtudisc(struct inpcb *, int);\nstruct tcpcb *\n\t tcp_newtcpcb(struct inpcb *);\nint\t tcp_output(struct tcpcb *);\nvoid\t tcp_respond(struct tcpcb *, void *,\n\t    struct tcphdr *, struct mbuf *, tcp_seq, tcp_seq, int);\nvoid\t tcp_tw_init(void);\n#ifdef VIMAGE\nvoid\t tcp_tw_destroy(void);\n#endif\nvoid\t tcp_tw_zone_change(void);\nint\t tcp_twcheck(struct inpcb *, struct tcpopt *, struct tcphdr *,\n\t    struct mbuf *, int);\nint\t tcp_twrespond(struct tcptw *, int);\nvoid\t tcp_setpersist(struct tcpcb *);\n#ifdef TCP_SIGNATURE\nint\t tcp_signature_compute(struct mbuf *, int, int, int, u_char *, u_int);\nint\t tcp_signature_verify(struct mbuf *, int, int, int, struct tcpopt *,\n\t    struct tcphdr *, u_int);\n#endif\nvoid\t tcp_slowtimo(void);\nstruct tcptemp *\n\t tcpip_maketemplate(struct inpcb *);\nvoid\t tcpip_fillheaders(struct inpcb *, void *, void *);\nvoid\t tcp_timer_activate(struct tcpcb *, int, u_int);\nint\t tcp_timer_active(struct tcpcb *, int);\nvoid\t tcp_trace(short, short, struct tcpcb *, void *, struct tcphdr *, int);\n/*\n * All tcp_hc_* functions are IPv4 and IPv6 (via in_conninfo)\n */\nvoid\t tcp_hc_init(void);\n#ifdef VIMAGE\nvoid\t tcp_hc_destroy(void);\n#endif\nvoid\t tcp_hc_get(struct in_conninfo *, struct hc_metrics_lite *);\nu_long\t tcp_hc_getmtu(struct in_conninfo *);\nvoid\t tcp_hc_updatemtu(struct in_conninfo *, u_long);\nvoid\t tcp_hc_update(struct in_conninfo *, struct hc_metrics_lite *);\n\nextern\tstruct pr_usrreqs tcp_usrreqs;\nextern\tu_long tcp_sendspace;\nextern\tu_long tcp_recvspace;\ntcp_seq tcp_new_isn(struct tcpcb *);\n\nvoid\t tcp_sack_doack(struct tcpcb *, struct tcpopt *, tcp_seq);\nvoid\t tcp_update_sack_list(struct tcpcb *tp, tcp_seq rcv_laststart, tcp_seq rcv_lastend);\nvoid\t tcp_clean_sackreport(struct tcpcb *tp);\nvoid\t tcp_sack_adjust(struct tcpcb *tp);\nstruct sackhole *tcp_sack_output(struct tcpcb *tp, int *sack_bytes_rexmt);\nvoid\t tcp_sack_partialack(struct tcpcb *, struct tcphdr *);\nvoid\t tcp_free_sackholes(struct tcpcb *tp);\nint\t tcp_newreno(struct tcpcb *, struct tcphdr *);\nu_long\t tcp_seq_subtract(u_long, u_long );\n\nvoid\tcc_cong_signal(struct tcpcb *tp, struct tcphdr *th, uint32_t type);\n\n#endif /* _KERNEL */\n\n#endif /* _NETINET_TCP_VAR_H_ */\n"
  },
  {
    "path": "freebsd-headers/netinet/tcpip.h",
    "content": "/*-\n * Copyright (c) 1982, 1986, 1993\n *\tThe Regents of the University of California.  All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 4. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t@(#)tcpip.h\t8.1 (Berkeley) 6/10/93\n * $FreeBSD: release/9.0.0/sys/netinet/tcpip.h 139823 2005-01-07 01:45:51Z imp $\n */\n\n#ifndef _NETINET_TCPIP_H_\n#define _NETINET_TCPIP_H_\n\n/*\n * Tcp+ip header, after ip options removed.\n */\nstruct tcpiphdr {\n\tstruct\tipovly ti_i;\t\t/* overlaid ip structure */\n\tstruct\ttcphdr ti_t;\t\t/* tcp header */\n};\n#define\tti_x1\t\tti_i.ih_x1\n#define\tti_pr\t\tti_i.ih_pr\n#define\tti_len\t\tti_i.ih_len\n#define\tti_src\t\tti_i.ih_src\n#define\tti_dst\t\tti_i.ih_dst\n#define\tti_sport\tti_t.th_sport\n#define\tti_dport\tti_t.th_dport\n#define\tti_seq\t\tti_t.th_seq\n#define\tti_ack\t\tti_t.th_ack\n#define\tti_x2\t\tti_t.th_x2\n#define\tti_off\t\tti_t.th_off\n#define\tti_flags\tti_t.th_flags\n#define\tti_win\t\tti_t.th_win\n#define\tti_sum\t\tti_t.th_sum\n#define\tti_urp\t\tti_t.th_urp\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/netinet/toedev.h",
    "content": "/*-\n * Copyright (c) 2007, Chelsio Inc.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions are met:\n *\n * 1. Redistributions of source code must retain the above copyright notice,\n *    this list of conditions and the following disclaimer.\n *\n * 2. Neither the name of the Chelsio Corporation nor the names of its\n *    contributors may be used to endorse or promote products derived from\n *    this software without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\n * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE\n * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\n * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\n * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\n * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\n * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/netinet/toedev.h 182591 2008-09-01 05:30:22Z kmacy $\n */\n\n#ifndef _NETINET_TOEDEV_H_\n#define\t_NETINET_TOEDEV_H_\n\n#ifndef _KERNEL\n#error \"no user-serviceable parts inside\"\n#endif\n\nextern uint32_t toedev_registration_count;\n\n/* Parameter values for offload_get_phys_egress(). */\nenum {\n\tTOE_OPEN,\n\tTOE_FAILOVER,\n};\n\n/* Parameter values for toe_failover(). */\nenum {\n\tTOE_ACTIVE_SLAVE,\n\tTOE_LINK_DOWN,\n\tTOE_LINK_UP,\n\tTOE_RELEASE,\n\tTOE_RELEASE_ALL,\n};\n\n#define\tTOENAMSIZ\t16\n\n/* Get the toedev associated with a ifnet. */\n#define\tTOEDEV(ifp)\t((ifp)->if_llsoftc)\n\nstruct offload_id {\n\tunsigned int\tid;\n\tunsigned long\tdata;\n};\n\nstruct ifnet;\nstruct rt_entry;\nstruct tom_info;\nstruct sysctl_oid;\nstruct socket;\nstruct mbuf;\n\nstruct toedev {\n\tTAILQ_ENTRY(toedev) entry;  \n\tchar \t\ttod_name[TOENAMSIZ];\t/* TOE device name */\n\tunsigned int \ttod_ttid;\t\t/* TOE type id */\n\tunsigned long \ttod_flags;\t\t/* device flags */\n\tunsigned int\ttod_mtu;\t\t/* max TX offloaded data */\n\tunsigned int\ttod_nconn;\t\t/* max # of offloaded\n\t\t\t\t\t\t * connections\n\t\t\t\t\t\t */\n\tstruct ifnet \t*tod_lldev;   \t\t/* first interface */\n\tconst struct tom_info *tod_offload_mod; /* TCP offload module */\n\n\t/*\n\t * This TOE device is capable of offloading the connection for socket so\n\t */\n\tint\t(*tod_can_offload)(struct toedev *dev, struct socket *so);\n\n\t/*\n\t * Establish a connection to nam using the TOE device dev\n\t */\n\tint\t(*tod_connect)(struct toedev *dev, struct socket *so,\n\t        struct rtentry *rt, struct sockaddr *nam);\n\t/*\n\t * Send an mbuf down to the toe device \n\t */\n\tint\t(*tod_send)(struct toedev *dev, struct mbuf *m);\n\t/*\n\t * Receive an array of mbufs from the TOE device dev \n\t */\n\tint\t(*tod_recv)(struct toedev *dev, struct mbuf **m, int n);\n\t/*\n\t * Device specific ioctl interface\n\t */\n\tint\t(*tod_ctl)(struct toedev *dev, unsigned int req, void *data);\n\t/*\n\t * Update L2 entry in toedev \n\t */\n\tvoid\t(*tod_arp_update)(struct toedev *dev, struct rtentry *neigh);\n\t/*\n\t * Failover from one toe device to another\n\t */\n\tvoid\t(*tod_failover)(struct toedev *dev, struct ifnet *bond_ifp,\n\t\t\t struct ifnet *ndev, int event);\n\tvoid\t*tod_priv;\t\t\t/* driver private data */\n\tvoid \t*tod_l2opt;\t\t\t/* optional layer 2 data */\n\tvoid\t*tod_l3opt; \t\t\t/* optional layer 3 data */\n\tvoid \t*tod_l4opt;\t\t\t/* optional layer 4 data */\n\tvoid \t*tod_ulp;\t\t\t/* upper lever protocol */\n};\n\nstruct tom_info {\n\tTAILQ_ENTRY(tom_info)\tentry;\n\tint\t\t(*ti_attach)(struct toedev *dev,\n\t                             const struct offload_id *entry);\n\tint\t\t(*ti_detach)(struct toedev *dev);\n\tconst char\t*ti_name;\n\tconst struct offload_id\t*ti_id_table;\n};\n\nstatic __inline void\ninit_offload_dev(struct toedev *dev)\n{\n}\n\nint\tregister_tom(struct tom_info *t);\nint\tunregister_tom(struct tom_info *t);\nint\tregister_toedev(struct toedev *dev, const char *name);\nint\tunregister_toedev(struct toedev *dev);\nint\tactivate_offload(struct toedev *dev);\nint\ttoe_send(struct toedev *dev, struct mbuf *m);\nvoid\ttoe_arp_update(struct rtentry *rt);\nstruct ifnet\t*offload_get_phys_egress(struct ifnet *ifp,\n        struct socket *so, int context);\nint \ttoe_receive_mbuf(struct toedev *dev, struct mbuf **m, int n);\n\nstatic __inline void\ntoe_neigh_update(struct ifnet *ifp)\n{\n}\n\nstatic __inline void\ntoe_failover(struct ifnet *bond_ifp, struct ifnet *fail_ifp, int event)\n{\n}\n\nstatic __inline int\ntoe_enslave(struct ifnet *bond_ifp, struct ifnet *slave_ifp)\n{\n\treturn (0);\n}\n\n#endif /* _NETINET_TOEDEV_H_ */\n"
  },
  {
    "path": "freebsd-headers/netinet/udp.h",
    "content": "/*-\n * Copyright (c) 1982, 1986, 1993\n *\tThe Regents of the University of California.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 4. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t@(#)udp.h\t8.1 (Berkeley) 6/10/93\n * $FreeBSD: release/9.0.0/sys/netinet/udp.h 217126 2011-01-07 21:40:34Z jhb $\n */\n\n#ifndef _NETINET_UDP_H_\n#define\t_NETINET_UDP_H_\n\n/*\n * UDP protocol header.\n * Per RFC 768, September, 1981.\n */\nstruct udphdr {\n\tu_short\tuh_sport;\t\t/* source port */\n\tu_short\tuh_dport;\t\t/* destination port */\n\tu_short\tuh_ulen;\t\t/* udp length */\n\tu_short\tuh_sum;\t\t\t/* udp checksum */\n};\n\n/* \n * User-settable options (used with setsockopt).\n */\n#define\tUDP_ENCAP\t\t\t0x01\n\n\n/*\n * UDP Encapsulation of IPsec Packets options.\n */\n/* Encapsulation types. */\n#define\tUDP_ENCAP_ESPINUDP_NON_IKE\t1 /* draft-ietf-ipsec-nat-t-ike-00/01 */\n#define\tUDP_ENCAP_ESPINUDP\t\t2 /* draft-ietf-ipsec-udp-encaps-02+ */\n\n/* Default ESP in UDP encapsulation port. */\n#define\tUDP_ENCAP_ESPINUDP_PORT\t\t500\n\n/* Maximum UDP fragment size for ESP over UDP. */\n#define\tUDP_ENCAP_ESPINUDP_MAXFRAGLEN\t552\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/netinet/udp_var.h",
    "content": "/*-\n * Copyright (c) 1982, 1986, 1989, 1993\n *\tThe Regents of the University of California.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 4. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t@(#)udp_var.h\t8.1 (Berkeley) 6/10/93\n * $FreeBSD: release/9.0.0/sys/netinet/udp_var.h 217126 2011-01-07 21:40:34Z jhb $\n */\n\n#ifndef _NETINET_UDP_VAR_H_\n#define\t_NETINET_UDP_VAR_H_\n\n/*\n * UDP kernel structures and variables.\n */\nstruct udpiphdr {\n\tstruct ipovly\tui_i;\t\t/* overlaid ip structure */\n\tstruct udphdr\tui_u;\t\t/* udp header */\n};\n#define\tui_x1\t\tui_i.ih_x1\n#define\tui_pr\t\tui_i.ih_pr\n#define\tui_len\t\tui_i.ih_len\n#define\tui_src\t\tui_i.ih_src\n#define\tui_dst\t\tui_i.ih_dst\n#define\tui_sport\tui_u.uh_sport\n#define\tui_dport\tui_u.uh_dport\n#define\tui_ulen\t\tui_u.uh_ulen\n#define\tui_sum\t\tui_u.uh_sum\n\ntypedef void(*udp_tun_func_t)(struct mbuf *, int off, struct inpcb *);\n\n/*\n * UDP control block; one per udp.\n */\nstruct udpcb {\n\tudp_tun_func_t\tu_tun_func;\t/* UDP kernel tunneling callback. */\n\tu_int\t\tu_flags;\t/* Generic UDP flags. */\n};\n\n#define\tintoudpcb(ip)\t((struct udpcb *)(ip)->inp_ppcb)\n#define\tsotoudpcb(so)\t(intoudpcb(sotoinpcb(so)))\n\n\t\t\t\t/* IPsec: ESP in UDP tunneling: */\n#define\tUF_ESPINUDP_NON_IKE\t0x00000001\t/* w/ non-IKE marker .. */\n\t/* .. per draft-ietf-ipsec-nat-t-ike-0[01],\n\t * and draft-ietf-ipsec-udp-encaps-(00/)01.txt */\n#define\tUF_ESPINUDP\t\t0x00000002\t/* w/ non-ESP marker. */\n\nstruct udpstat {\n\t\t\t\t/* input statistics: */\n\tu_long\tudps_ipackets;\t\t/* total input packets */\n\tu_long\tudps_hdrops;\t\t/* packet shorter than header */\n\tu_long\tudps_badsum;\t\t/* checksum error */\n\tu_long\tudps_nosum;\t\t/* no checksum */\n\tu_long\tudps_badlen;\t\t/* data length larger than packet */\n\tu_long\tudps_noport;\t\t/* no socket on port */\n\tu_long\tudps_noportbcast;\t/* of above, arrived as broadcast */\n\tu_long\tudps_fullsock;\t\t/* not delivered, input socket full */\n\tu_long\tudpps_pcbcachemiss;\t/* input packets missing pcb cache */\n\tu_long\tudpps_pcbhashmiss;\t/* input packets not for hashed pcb */\n\t\t\t\t/* output statistics: */\n\tu_long\tudps_opackets;\t\t/* total output packets */\n\tu_long\tudps_fastout;\t\t/* output packets on fast path */\n\t/* of no socket on port, arrived as multicast */\n\tu_long\tudps_noportmcast;\n\tu_long\tudps_filtermcast;\t/* blocked by multicast filter */\n};\n\n#ifdef _KERNEL\n/*\n * In-kernel consumers can use these accessor macros directly to update\n * stats.\n */\n#define\tUDPSTAT_ADD(name, val)\tV_udpstat.name += (val)\n#define\tUDPSTAT_INC(name)\tUDPSTAT_ADD(name, 1)\n\n/*\n * Kernel module consumers must use this accessor macro.\n */\nvoid\tkmod_udpstat_inc(int statnum);\n#define\tKMOD_UDPSTAT_INC(name)\t\t\t\t\t\t\\\n\tkmod_udpstat_inc(offsetof(struct udpstat, name) / sizeof(u_long))\n#endif\n\n/*\n * Names for UDP sysctl objects.\n */\n#define\tUDPCTL_CHECKSUM\t\t1\t/* checksum UDP packets */\n#define\tUDPCTL_STATS\t\t2\t/* statistics (read-only) */\n#define\tUDPCTL_MAXDGRAM\t\t3\t/* max datagram size */\n#define\tUDPCTL_RECVSPACE\t4\t/* default receive buffer space */\n#define\tUDPCTL_PCBLIST\t\t5\t/* list of PCBs for UDP sockets */\n#define\tUDPCTL_MAXID\t\t6\n\n#define\tUDPCTL_NAMES\t{\t\t\t\t\t\t\\\n\t{ 0, 0 },\t\t\t\t\t\t\t\\\n\t{ \"checksum\", CTLTYPE_INT },\t\t\t\t\t\\\n\t{ \"stats\", CTLTYPE_STRUCT },\t\t\t\t\t\\\n\t{ \"maxdgram\", CTLTYPE_INT },\t\t\t\t\t\\\n\t{ \"recvspace\", CTLTYPE_INT },\t\t\t\t\t\\\n\t{ \"pcblist\", CTLTYPE_STRUCT },\t\t\t\t\t\\\n}\n\n#ifdef _KERNEL\nSYSCTL_DECL(_net_inet_udp);\n\nextern struct pr_usrreqs\tudp_usrreqs;\nVNET_DECLARE(struct inpcbhead, udb);\nVNET_DECLARE(struct inpcbinfo, udbinfo);\n#define\tV_udb\t\t\tVNET(udb)\n#define\tV_udbinfo\t\tVNET(udbinfo)\n\nextern u_long\t\t\tudp_sendspace;\nextern u_long\t\t\tudp_recvspace;\nVNET_DECLARE(struct udpstat, udpstat);\nVNET_DECLARE(int, udp_blackhole);\n#define\tV_udpstat\t\tVNET(udpstat)\n#define\tV_udp_blackhole\t\tVNET(udp_blackhole)\nextern int\t\t\tudp_log_in_vain;\n\nint\t\t udp_newudpcb(struct inpcb *);\nvoid\t\t udp_discardcb(struct udpcb *);\n\nvoid\t\t udp_ctlinput(int, struct sockaddr *, void *);\nint\t\t udp_ctloutput(struct socket *, struct sockopt *);\nvoid\t\t udp_init(void);\n#ifdef VIMAGE\nvoid\t\t udp_destroy(void);\n#endif\nvoid\t\t udp_input(struct mbuf *, int);\nstruct inpcb\t*udp_notify(struct inpcb *inp, int errno);\nint\t\t udp_shutdown(struct socket *so);\n\nint udp_set_kernel_tunneling(struct socket *so, udp_tun_func_t f);\n#endif\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/netinet6/icmp6.h",
    "content": "/*\t$FreeBSD: release/9.0.0/sys/netinet6/icmp6.h 62587 2000-07-04 16:35:15Z itojun $\t*/\n/*\t$KAME: icmp6.h,v 1.17 2000/06/11 17:23:40 jinmei Exp $\t*/\n\n#error \"netinet6/icmp6.h is obsolete.  use netinet/icmp6.h\"\n"
  },
  {
    "path": "freebsd-headers/netinet6/in6.h",
    "content": "/*-\n * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. Neither the name of the project nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t$KAME: in6.h,v 1.89 2001/05/27 13:28:35 itojun Exp $\n */\n\n/*-\n * Copyright (c) 1982, 1986, 1990, 1993\n *\tThe Regents of the University of California.  All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 4. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t@(#)in.h\t8.3 (Berkeley) 1/3/94\n * $FreeBSD: release/9.0.0/sys/netinet6/in6.h 225698 2011-09-20 20:27:26Z kmacy $\n */\n\n#ifndef __KAME_NETINET_IN_H_INCLUDED_\n#error \"do not include netinet6/in6.h directly, include netinet/in.h.  see RFC2553\"\n#endif\n\n#ifndef _NETINET6_IN6_H_\n#define _NETINET6_IN6_H_\n\n/*\n * Identification of the network protocol stack\n * for *BSD-current/release: http://www.kame.net/dev/cvsweb.cgi/kame/COVERAGE\n * has the table of implementation/integration differences.\n */\n#define __KAME__\n#define __KAME_VERSION\t\t\"FreeBSD\"\n\n/*\n * IPv6 port allocation rules should mirror the IPv4 rules and are controlled\n * by the net.inet.ip.portrange sysctl tree. The following defines exist\n * for compatibility with userland applications that need them.\n */\n#if __BSD_VISIBLE\n#define\tIPV6PORT_RESERVED\t1024\n#define\tIPV6PORT_ANONMIN\t49152\n#define\tIPV6PORT_ANONMAX\t65535\n#define\tIPV6PORT_RESERVEDMIN\t600\n#define\tIPV6PORT_RESERVEDMAX\t(IPV6PORT_RESERVED-1)\n#endif\n\n/*\n * IPv6 address\n */\nstruct in6_addr {\n\tunion {\n\t\tuint8_t\t\t__u6_addr8[16];\n\t\tuint16_t\t__u6_addr16[8];\n\t\tuint32_t\t__u6_addr32[4];\n\t} __u6_addr;\t\t\t/* 128-bit IP6 address */\n};\n\n#define s6_addr   __u6_addr.__u6_addr8\n#ifdef _KERNEL\t/* XXX nonstandard */\n#define s6_addr8  __u6_addr.__u6_addr8\n#define s6_addr16 __u6_addr.__u6_addr16\n#define s6_addr32 __u6_addr.__u6_addr32\n#endif\n\n#define INET6_ADDRSTRLEN\t46\n\n/*\n * XXX missing POSIX.1-2001 macro IPPROTO_IPV6.\n */\n\n/*\n * Socket address for IPv6\n */\n#if __BSD_VISIBLE\n#define SIN6_LEN\n#endif\n\nstruct sockaddr_in6 {\n\tuint8_t\t\tsin6_len;\t/* length of this struct */\n\tsa_family_t\tsin6_family;\t/* AF_INET6 */\n\tin_port_t\tsin6_port;\t/* Transport layer port # */\n\tuint32_t\tsin6_flowinfo;\t/* IP6 flow information */\n\tstruct in6_addr\tsin6_addr;\t/* IP6 address */\n\tuint32_t\tsin6_scope_id;\t/* scope zone index */\n};\n\n/*\n * Local definition for masks\n */\n#ifdef _KERNEL\t/* XXX nonstandard */\n#define IN6MASK0\t{{{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }}}\n#define IN6MASK32\t{{{ 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, \\\n\t\t\t    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }}}\n#define IN6MASK64\t{{{ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, \\\n\t\t\t    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }}}\n#define IN6MASK96\t{{{ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, \\\n\t\t\t    0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00 }}}\n#define IN6MASK128\t{{{ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, \\\n\t\t\t    0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }}}\n#endif\n\n#ifdef _KERNEL\nextern const struct sockaddr_in6 sa6_any;\n\nextern const struct in6_addr in6mask0;\nextern const struct in6_addr in6mask32;\nextern const struct in6_addr in6mask64;\nextern const struct in6_addr in6mask96;\nextern const struct in6_addr in6mask128;\n#endif /* _KERNEL */\n\n/*\n * Macros started with IPV6_ADDR is KAME local\n */\n#ifdef _KERNEL\t/* XXX nonstandard */\n#if _BYTE_ORDER == _BIG_ENDIAN\n#define IPV6_ADDR_INT32_ONE\t1\n#define IPV6_ADDR_INT32_TWO\t2\n#define IPV6_ADDR_INT32_MNL\t0xff010000\n#define IPV6_ADDR_INT32_MLL\t0xff020000\n#define IPV6_ADDR_INT32_SMP\t0x0000ffff\n#define IPV6_ADDR_INT16_ULL\t0xfe80\n#define IPV6_ADDR_INT16_USL\t0xfec0\n#define IPV6_ADDR_INT16_MLL\t0xff02\n#elif _BYTE_ORDER == _LITTLE_ENDIAN\n#define IPV6_ADDR_INT32_ONE\t0x01000000\n#define IPV6_ADDR_INT32_TWO\t0x02000000\n#define IPV6_ADDR_INT32_MNL\t0x000001ff\n#define IPV6_ADDR_INT32_MLL\t0x000002ff\n#define IPV6_ADDR_INT32_SMP\t0xffff0000\n#define IPV6_ADDR_INT16_ULL\t0x80fe\n#define IPV6_ADDR_INT16_USL\t0xc0fe\n#define IPV6_ADDR_INT16_MLL\t0x02ff\n#endif\n#endif\n\n/*\n * Definition of some useful macros to handle IP6 addresses\n */\n#if __BSD_VISIBLE\n#define IN6ADDR_ANY_INIT \\\n\t{{{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \\\n\t    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }}}\n#define IN6ADDR_LOOPBACK_INIT \\\n\t{{{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \\\n\t    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01 }}}\n#define IN6ADDR_NODELOCAL_ALLNODES_INIT \\\n\t{{{ 0xff, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \\\n\t    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01 }}}\n#define IN6ADDR_INTFACELOCAL_ALLNODES_INIT \\\n\t{{{ 0xff, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \\\n\t    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01 }}}\n#define IN6ADDR_LINKLOCAL_ALLNODES_INIT \\\n\t{{{ 0xff, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \\\n\t    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01 }}}\n#define IN6ADDR_LINKLOCAL_ALLROUTERS_INIT \\\n\t{{{ 0xff, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \\\n\t    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02 }}}\n#define IN6ADDR_LINKLOCAL_ALLV2ROUTERS_INIT \\\n\t{{{ 0xff, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \\\n\t    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x16 }}}\n#endif\n\nextern const struct in6_addr in6addr_any;\nextern const struct in6_addr in6addr_loopback;\n#if __BSD_VISIBLE\nextern const struct in6_addr in6addr_nodelocal_allnodes;\nextern const struct in6_addr in6addr_linklocal_allnodes;\nextern const struct in6_addr in6addr_linklocal_allrouters;\nextern const struct in6_addr in6addr_linklocal_allv2routers;\n#endif\n\n/*\n * Equality\n * NOTE: Some of kernel programming environment (for example, openbsd/sparc)\n * does not supply memcmp().  For userland memcmp() is preferred as it is\n * in ANSI standard.\n */\n#ifdef _KERNEL\n#define IN6_ARE_ADDR_EQUAL(a, b)\t\t\t\\\n    (bcmp(&(a)->s6_addr[0], &(b)->s6_addr[0], sizeof(struct in6_addr)) == 0)\n#else\n#if __BSD_VISIBLE\n#define IN6_ARE_ADDR_EQUAL(a, b)\t\t\t\\\n    (memcmp(&(a)->s6_addr[0], &(b)->s6_addr[0], sizeof(struct in6_addr)) == 0)\n#endif\n#endif\n\n/*\n * Unspecified\n */\n#define IN6_IS_ADDR_UNSPECIFIED(a)\t\\\n\t((*(const u_int32_t *)(const void *)(&(a)->s6_addr[0]) == 0) &&\t\\\n\t (*(const u_int32_t *)(const void *)(&(a)->s6_addr[4]) == 0) &&\t\\\n\t (*(const u_int32_t *)(const void *)(&(a)->s6_addr[8]) == 0) &&\t\\\n\t (*(const u_int32_t *)(const void *)(&(a)->s6_addr[12]) == 0))\n\n/*\n * Loopback\n */\n#define IN6_IS_ADDR_LOOPBACK(a)\t\t\\\n\t((*(const u_int32_t *)(const void *)(&(a)->s6_addr[0]) == 0) &&\t\\\n\t (*(const u_int32_t *)(const void *)(&(a)->s6_addr[4]) == 0) &&\t\\\n\t (*(const u_int32_t *)(const void *)(&(a)->s6_addr[8]) == 0) &&\t\\\n\t (*(const u_int32_t *)(const void *)(&(a)->s6_addr[12]) == ntohl(1)))\n\n/*\n * IPv4 compatible\n */\n#define IN6_IS_ADDR_V4COMPAT(a)\t\t\\\n\t((*(const u_int32_t *)(const void *)(&(a)->s6_addr[0]) == 0) &&\t\\\n\t (*(const u_int32_t *)(const void *)(&(a)->s6_addr[4]) == 0) &&\t\\\n\t (*(const u_int32_t *)(const void *)(&(a)->s6_addr[8]) == 0) &&\t\\\n\t (*(const u_int32_t *)(const void *)(&(a)->s6_addr[12]) != 0) &&\t\\\n\t (*(const u_int32_t *)(const void *)(&(a)->s6_addr[12]) != ntohl(1)))\n\n/*\n * Mapped\n */\n#define IN6_IS_ADDR_V4MAPPED(a)\t\t      \\\n\t((*(const u_int32_t *)(const void *)(&(a)->s6_addr[0]) == 0) &&\t\\\n\t (*(const u_int32_t *)(const void *)(&(a)->s6_addr[4]) == 0) &&\t\\\n\t (*(const u_int32_t *)(const void *)(&(a)->s6_addr[8]) == ntohl(0x0000ffff)))\n\n/*\n * KAME Scope Values\n */\n\n#ifdef _KERNEL\t/* XXX nonstandard */\n#define IPV6_ADDR_SCOPE_NODELOCAL\t0x01\n#define IPV6_ADDR_SCOPE_INTFACELOCAL\t0x01\n#define IPV6_ADDR_SCOPE_LINKLOCAL\t0x02\n#define IPV6_ADDR_SCOPE_SITELOCAL\t0x05\n#define IPV6_ADDR_SCOPE_ORGLOCAL\t0x08\t/* just used in this file */\n#define IPV6_ADDR_SCOPE_GLOBAL\t\t0x0e\n#else\n#define __IPV6_ADDR_SCOPE_NODELOCAL\t0x01\n#define __IPV6_ADDR_SCOPE_INTFACELOCAL\t0x01\n#define __IPV6_ADDR_SCOPE_LINKLOCAL\t0x02\n#define __IPV6_ADDR_SCOPE_SITELOCAL\t0x05\n#define __IPV6_ADDR_SCOPE_ORGLOCAL\t0x08\t/* just used in this file */\n#define __IPV6_ADDR_SCOPE_GLOBAL\t0x0e\n#endif\n\n/*\n * Unicast Scope\n * Note that we must check topmost 10 bits only, not 16 bits (see RFC2373).\n */\n#define IN6_IS_ADDR_LINKLOCAL(a)\t\\\n\t(((a)->s6_addr[0] == 0xfe) && (((a)->s6_addr[1] & 0xc0) == 0x80))\n#define IN6_IS_ADDR_SITELOCAL(a)\t\\\n\t(((a)->s6_addr[0] == 0xfe) && (((a)->s6_addr[1] & 0xc0) == 0xc0))\n\n/*\n * Multicast\n */\n#define IN6_IS_ADDR_MULTICAST(a)\t((a)->s6_addr[0] == 0xff)\n\n#ifdef _KERNEL\t/* XXX nonstandard */\n#define IPV6_ADDR_MC_SCOPE(a)\t\t((a)->s6_addr[1] & 0x0f)\n#else\n#define __IPV6_ADDR_MC_SCOPE(a)\t\t((a)->s6_addr[1] & 0x0f)\n#endif\n\n/*\n * Multicast Scope\n */\n#ifdef _KERNEL\t/* refers nonstandard items */\n#define IN6_IS_ADDR_MC_NODELOCAL(a)\t\\\n\t(IN6_IS_ADDR_MULTICAST(a) &&\t\\\n\t (IPV6_ADDR_MC_SCOPE(a) == IPV6_ADDR_SCOPE_NODELOCAL))\n#define IN6_IS_ADDR_MC_INTFACELOCAL(a)\t\\\n\t(IN6_IS_ADDR_MULTICAST(a) &&\t\\\n\t (IPV6_ADDR_MC_SCOPE(a) == IPV6_ADDR_SCOPE_INTFACELOCAL))\n#define IN6_IS_ADDR_MC_LINKLOCAL(a)\t\\\n\t(IN6_IS_ADDR_MULTICAST(a) &&\t\\\n\t (IPV6_ADDR_MC_SCOPE(a) == IPV6_ADDR_SCOPE_LINKLOCAL))\n#define IN6_IS_ADDR_MC_SITELOCAL(a)\t\\\n\t(IN6_IS_ADDR_MULTICAST(a) &&\t\\\n\t (IPV6_ADDR_MC_SCOPE(a) == IPV6_ADDR_SCOPE_SITELOCAL))\n#define IN6_IS_ADDR_MC_ORGLOCAL(a)\t\\\n\t(IN6_IS_ADDR_MULTICAST(a) &&\t\\\n\t (IPV6_ADDR_MC_SCOPE(a) == IPV6_ADDR_SCOPE_ORGLOCAL))\n#define IN6_IS_ADDR_MC_GLOBAL(a)\t\\\n\t(IN6_IS_ADDR_MULTICAST(a) &&\t\\\n\t (IPV6_ADDR_MC_SCOPE(a) == IPV6_ADDR_SCOPE_GLOBAL))\n#else\n#define IN6_IS_ADDR_MC_NODELOCAL(a)\t\\\n\t(IN6_IS_ADDR_MULTICAST(a) &&\t\\\n\t (__IPV6_ADDR_MC_SCOPE(a) == __IPV6_ADDR_SCOPE_NODELOCAL))\n#define IN6_IS_ADDR_MC_LINKLOCAL(a)\t\\\n\t(IN6_IS_ADDR_MULTICAST(a) &&\t\\\n\t (__IPV6_ADDR_MC_SCOPE(a) == __IPV6_ADDR_SCOPE_LINKLOCAL))\n#define IN6_IS_ADDR_MC_SITELOCAL(a)\t\\\n\t(IN6_IS_ADDR_MULTICAST(a) &&\t\\\n\t (__IPV6_ADDR_MC_SCOPE(a) == __IPV6_ADDR_SCOPE_SITELOCAL))\n#define IN6_IS_ADDR_MC_ORGLOCAL(a)\t\\\n\t(IN6_IS_ADDR_MULTICAST(a) &&\t\\\n\t (__IPV6_ADDR_MC_SCOPE(a) == __IPV6_ADDR_SCOPE_ORGLOCAL))\n#define IN6_IS_ADDR_MC_GLOBAL(a)\t\\\n\t(IN6_IS_ADDR_MULTICAST(a) &&\t\\\n\t (__IPV6_ADDR_MC_SCOPE(a) == __IPV6_ADDR_SCOPE_GLOBAL))\n#endif\n\n#ifdef _KERNEL\t/* nonstandard */\n/*\n * KAME Scope\n */\n#define IN6_IS_SCOPE_LINKLOCAL(a)\t\\\n\t((IN6_IS_ADDR_LINKLOCAL(a)) ||\t\\\n\t (IN6_IS_ADDR_MC_LINKLOCAL(a)))\n#define\tIN6_IS_SCOPE_EMBED(a)\t\t\t\\\n\t((IN6_IS_ADDR_LINKLOCAL(a)) ||\t\t\\\n\t (IN6_IS_ADDR_MC_LINKLOCAL(a)) ||\t\\\n\t (IN6_IS_ADDR_MC_INTFACELOCAL(a)))\n\n#define IFA6_IS_DEPRECATED(a) \\\n\t((a)->ia6_lifetime.ia6t_pltime != ND6_INFINITE_LIFETIME && \\\n\t (u_int32_t)((time_second - (a)->ia6_updatetime)) > \\\n\t (a)->ia6_lifetime.ia6t_pltime)\n#define IFA6_IS_INVALID(a) \\\n\t((a)->ia6_lifetime.ia6t_vltime != ND6_INFINITE_LIFETIME && \\\n\t (u_int32_t)((time_second - (a)->ia6_updatetime)) > \\\n\t (a)->ia6_lifetime.ia6t_vltime)\n#endif /* _KERNEL */\n\n/*\n * IP6 route structure\n */\n#if __BSD_VISIBLE\nstruct route_in6 {\n\tstruct\trtentry *ro_rt;\n\tstruct\tllentry *ro_lle;\n\tstruct\tin6_addr *ro_ia6;\n\tint\t\tro_flags;\n\tstruct\tsockaddr_in6 ro_dst;\n};\n#endif\n\n/*\n * Options for use with [gs]etsockopt at the IPV6 level.\n * First word of comment is data type; bool is stored in int.\n */\n/* no hdrincl */\n#if 0 /* the followings are relic in IPv4 and hence are disabled */\n#define IPV6_OPTIONS\t\t1  /* buf/ip6_opts; set/get IP6 options */\n#define IPV6_RECVOPTS\t\t5  /* bool; receive all IP6 opts w/dgram */\n#define IPV6_RECVRETOPTS\t6  /* bool; receive IP6 opts for response */\n#define IPV6_RECVDSTADDR\t7  /* bool; receive IP6 dst addr w/dgram */\n#define IPV6_RETOPTS\t\t8  /* ip6_opts; set/get IP6 options */\n#endif\n#define IPV6_SOCKOPT_RESERVED1\t3  /* reserved for future use */\n#define IPV6_UNICAST_HOPS\t4  /* int; IP6 hops */\n#define IPV6_MULTICAST_IF\t9  /* u_int; set/get IP6 multicast i/f  */\n#define IPV6_MULTICAST_HOPS\t10 /* int; set/get IP6 multicast hops */\n#define IPV6_MULTICAST_LOOP\t11 /* u_int; set/get IP6 multicast loopback */\n#define IPV6_JOIN_GROUP\t\t12 /* ipv6_mreq; join a group membership */\n#define IPV6_LEAVE_GROUP\t13 /* ipv6_mreq; leave a group membership */\n#define IPV6_PORTRANGE\t\t14 /* int; range to choose for unspec port */\n#define ICMP6_FILTER\t\t18 /* icmp6_filter; icmp6 filter */\n/* RFC2292 options */\n#ifdef _KERNEL\n#define IPV6_2292PKTINFO\t19 /* bool; send/recv if, src/dst addr */\n#define IPV6_2292HOPLIMIT\t20 /* bool; hop limit */\n#define IPV6_2292NEXTHOP\t21 /* bool; next hop addr */\n#define IPV6_2292HOPOPTS\t22 /* bool; hop-by-hop option */\n#define IPV6_2292DSTOPTS\t23 /* bool; destinaion option */\n#define IPV6_2292RTHDR\t\t24 /* bool; routing header */\n#define IPV6_2292PKTOPTIONS\t25 /* buf/cmsghdr; set/get IPv6 options */\n#endif\n\n#define IPV6_CHECKSUM\t\t26 /* int; checksum offset for raw socket */\n#define IPV6_V6ONLY\t\t27 /* bool; make AF_INET6 sockets v6 only */\n#ifndef _KERNEL\n#define IPV6_BINDV6ONLY\t\tIPV6_V6ONLY\n#endif\n\n#if 1 /* IPSEC */\n#define IPV6_IPSEC_POLICY\t28 /* struct; get/set security policy */\n#endif /* IPSEC */\n\n#define IPV6_FAITH\t\t29 /* bool; accept FAITH'ed connections */\n\n#if 1 /* IPV6FIREWALL */\n#define IPV6_FW_ADD\t\t30 /* add a firewall rule to chain */\n#define IPV6_FW_DEL\t\t31 /* delete a firewall rule from chain */\n#define IPV6_FW_FLUSH\t\t32 /* flush firewall rule chain */\n#define IPV6_FW_ZERO\t\t33 /* clear single/all firewall counter(s) */\n#define IPV6_FW_GET\t\t34 /* get entire firewall rule chain */\n#endif\n\n/* new socket options introduced in RFC3542 */\n#define IPV6_RTHDRDSTOPTS\t35 /* ip6_dest; send dst option before rthdr */\n\n#define IPV6_RECVPKTINFO\t36 /* bool; recv if, dst addr */\n#define IPV6_RECVHOPLIMIT\t37 /* bool; recv hop limit */\n#define IPV6_RECVRTHDR\t\t38 /* bool; recv routing header */\n#define IPV6_RECVHOPOPTS\t39 /* bool; recv hop-by-hop option */\n#define IPV6_RECVDSTOPTS\t40 /* bool; recv dst option after rthdr */\n#ifdef _KERNEL\n#define IPV6_RECVRTHDRDSTOPTS\t41 /* bool; recv dst option before rthdr */\n#endif\n\n#define IPV6_USE_MIN_MTU\t42 /* bool; send packets at the minimum MTU */\n#define IPV6_RECVPATHMTU\t43 /* bool; notify an according MTU */\n\n#define IPV6_PATHMTU\t\t44 /* mtuinfo; get the current path MTU (sopt),\n\t\t\t\t      4 bytes int; MTU notification (cmsg) */\n#if 0 /*obsoleted during 2292bis -> 3542*/\n#define IPV6_REACHCONF\t\t45 /* no data; ND reachability confirm\n\t\t\t\t      (cmsg only/not in of RFC3542) */\n#endif\n\n/* more new socket options introduced in RFC3542 */\n#define IPV6_PKTINFO\t\t46 /* in6_pktinfo; send if, src addr */\n#define IPV6_HOPLIMIT\t\t47 /* int; send hop limit */\n#define IPV6_NEXTHOP\t\t48 /* sockaddr; next hop addr */\n#define IPV6_HOPOPTS\t\t49 /* ip6_hbh; send hop-by-hop option */\n#define IPV6_DSTOPTS\t\t50 /* ip6_dest; send dst option befor rthdr */\n#define IPV6_RTHDR\t\t51 /* ip6_rthdr; send routing header */\n#if 0\n#define IPV6_PKTOPTIONS\t\t52 /* buf/cmsghdr; set/get IPv6 options */\n\t\t\t\t   /* obsoleted by RFC3542 */\n#endif\n\n#define IPV6_RECVTCLASS\t\t57 /* bool; recv traffic class values */\n\n#define IPV6_AUTOFLOWLABEL\t59 /* bool; attach flowlabel automagically */\n\n#define IPV6_TCLASS\t\t61 /* int; send traffic class value */\n#define IPV6_DONTFRAG\t\t62 /* bool; disable IPv6 fragmentation */\n\n#define IPV6_PREFER_TEMPADDR\t63 /* int; prefer temporary addresses as\n\t\t\t\t    * the source address.\n\t\t\t\t    */\n\n#define\tIPV6_BINDANY\t\t64 /* bool: allow bind to any address */\n\n/*\n * The following option is private; do not use it from user applications.\n * It is deliberately defined to the same value as IP_MSFILTER.\n */\n#define\tIPV6_MSFILTER\t\t74 /* struct __msfilterreq;\n\t\t\t\t    * set/get multicast source filter list.\n\t\t\t\t    */\n\n/* to define items, should talk with KAME guys first, for *BSD compatibility */\n\n#define IPV6_RTHDR_LOOSE     0 /* this hop need not be a neighbor. XXX old spec */\n#define IPV6_RTHDR_STRICT    1 /* this hop must be a neighbor. XXX old spec */\n#define IPV6_RTHDR_TYPE_0    0 /* IPv6 routing header type 0 */\n\n/*\n * Defaults and limits for options\n */\n#define IPV6_DEFAULT_MULTICAST_HOPS 1\t/* normally limit m'casts to 1 hop */\n#define IPV6_DEFAULT_MULTICAST_LOOP 1\t/* normally hear sends if a member */\n\n/*\n * The im6o_membership vector for each socket is now dynamically allocated at\n * run-time, bounded by USHRT_MAX, and is reallocated when needed, sized\n * according to a power-of-two increment.\n */\n#define\tIPV6_MIN_MEMBERSHIPS\t31\n#define\tIPV6_MAX_MEMBERSHIPS\t4095\n\n/*\n * Default resource limits for IPv6 multicast source filtering.\n * These may be modified by sysctl.\n */\n#define\tIPV6_MAX_GROUP_SRC_FILTER\t512\t/* sources per group */\n#define\tIPV6_MAX_SOCK_SRC_FILTER\t128\t/* sources per socket/group */\n\n/*\n * Argument structure for IPV6_JOIN_GROUP and IPV6_LEAVE_GROUP.\n */\nstruct ipv6_mreq {\n\tstruct in6_addr\tipv6mr_multiaddr;\n\tunsigned int\tipv6mr_interface;\n};\n\n/*\n * IPV6_PKTINFO: Packet information(RFC2292 sec 5)\n */\nstruct in6_pktinfo {\n\tstruct in6_addr\tipi6_addr;\t/* src/dst IPv6 address */\n\tunsigned int\tipi6_ifindex;\t/* send/recv interface index */\n};\n\n/*\n * Control structure for IPV6_RECVPATHMTU socket option.\n */\nstruct ip6_mtuinfo {\n\tstruct sockaddr_in6 ip6m_addr;\t/* or sockaddr_storage? */\n\tuint32_t ip6m_mtu;\n};\n\n/*\n * Argument for IPV6_PORTRANGE:\n * - which range to search when port is unspecified at bind() or connect()\n */\n#define\tIPV6_PORTRANGE_DEFAULT\t0\t/* default range */\n#define\tIPV6_PORTRANGE_HIGH\t1\t/* \"high\" - request firewall bypass */\n#define\tIPV6_PORTRANGE_LOW\t2\t/* \"low\" - vouchsafe security */\n\n#if __BSD_VISIBLE\n/*\n * Definitions for inet6 sysctl operations.\n *\n * Third level is protocol number.\n * Fourth level is desired variable within that protocol.\n */\n#define IPV6PROTO_MAXID\t(IPPROTO_PIM + 1)\t/* don't list to IPV6PROTO_MAX */\n\n/*\n * Names for IP sysctl objects\n */\n#define IPV6CTL_FORWARDING\t1\t/* act as router */\n#define IPV6CTL_SENDREDIRECTS\t2\t/* may send redirects when forwarding*/\n#define IPV6CTL_DEFHLIM\t\t3\t/* default Hop-Limit */\n#ifdef notyet\n#define IPV6CTL_DEFMTU\t\t4\t/* default MTU */\n#endif\n#define IPV6CTL_FORWSRCRT\t5\t/* forward source-routed dgrams */\n#define IPV6CTL_STATS\t\t6\t/* stats */\n#define IPV6CTL_MRTSTATS\t7\t/* multicast forwarding stats */\n#define IPV6CTL_MRTPROTO\t8\t/* multicast routing protocol */\n#define IPV6CTL_MAXFRAGPACKETS\t9\t/* max packets reassembly queue */\n#define IPV6CTL_SOURCECHECK\t10\t/* verify source route and intf */\n#define IPV6CTL_SOURCECHECK_LOGINT 11\t/* minimume logging interval */\n#define IPV6CTL_ACCEPT_RTADV\t12\n#define IPV6CTL_KEEPFAITH\t13\n#define IPV6CTL_LOG_INTERVAL\t14\n#define IPV6CTL_HDRNESTLIMIT\t15\n#define IPV6CTL_DAD_COUNT\t16\n#define IPV6CTL_AUTO_FLOWLABEL\t17\n#define IPV6CTL_DEFMCASTHLIM\t18\n#define IPV6CTL_GIF_HLIM\t19\t/* default HLIM for gif encap packet */\n#define IPV6CTL_KAME_VERSION\t20\n#define IPV6CTL_USE_DEPRECATED\t21\t/* use deprecated addr (RFC2462 5.5.4) */\n#define IPV6CTL_RR_PRUNE\t22\t/* walk timer for router renumbering */\n#if 0\t/* obsolete */\n#define IPV6CTL_MAPPED_ADDR\t23\n#endif\n#define IPV6CTL_V6ONLY\t\t24\n#define IPV6CTL_RTEXPIRE\t25\t/* cloned route expiration time */\n#define IPV6CTL_RTMINEXPIRE\t26\t/* min value for expiration time */\n#define IPV6CTL_RTMAXCACHE\t27\t/* trigger level for dynamic expire */\n\n#define IPV6CTL_USETEMPADDR\t32\t/* use temporary addresses (RFC3041) */\n#define IPV6CTL_TEMPPLTIME\t33\t/* preferred lifetime for tmpaddrs */\n#define IPV6CTL_TEMPVLTIME\t34\t/* valid lifetime for tmpaddrs */\n#define IPV6CTL_AUTO_LINKLOCAL\t35\t/* automatic link-local addr assign */\n#define IPV6CTL_RIP6STATS\t36\t/* raw_ip6 stats */\n#define IPV6CTL_PREFER_TEMPADDR\t37\t/* prefer temporary addr as src */\n#define IPV6CTL_ADDRCTLPOLICY\t38\t/* get/set address selection policy */\n#define IPV6CTL_USE_DEFAULTZONE\t39\t/* use default scope zone */\n\n#define IPV6CTL_MAXFRAGS\t41\t/* max fragments */\n#if 0\n#define IPV6CTL_IFQ\t\t42\t/* ip6intrq node */\n#define IPV6CTL_ISATAPRTR\t43\t/* isatap router */\n#endif\n#define IPV6CTL_MCAST_PMTU\t44\t/* enable pMTU discovery for multicast? */\n\n/* New entries should be added here from current IPV6CTL_MAXID value. */\n/* to define items, should talk with KAME guys first, for *BSD compatibility */\n#define IPV6CTL_STEALTH\t\t45\n\n#define\tICMPV6CTL_ND6_ONLINKNSRFC4861\t47\n#define\tIPV6CTL_NO_RADR\t\t48\t/* No defroute from RA */\n#define\tIPV6CTL_NORBIT_RAIF\t49\t/* Disable R-bit in NA on RA\n\t\t\t\t\t * receiving IF. */\n#define\tIPV6CTL_RFC6204W3\t50\t/* Accept defroute even when forwarding\n\t\t\t\t\t   enabled */\n#define\tIPV6CTL_MAXID\t\t51\n#endif /* __BSD_VISIBLE */\n\n/*\n * Redefinition of mbuf flags\n */\n#define\tM_AUTHIPHDR\tM_PROTO2\n#define\tM_DECRYPTED\tM_PROTO3\n#define\tM_LOOP\t\tM_PROTO4\n#define\tM_AUTHIPDGM\tM_PROTO5\n#define\tM_RTALERT_MLD\tM_PROTO6\n\n#ifdef _KERNEL\nstruct cmsghdr;\n\nint\tin6_cksum __P((struct mbuf *, u_int8_t, u_int32_t, u_int32_t));\nint\tin6_localaddr __P((struct in6_addr *));\nint\tin6_localip(struct in6_addr *);\nint\tin6_addrscope __P((struct in6_addr *));\nstruct\tin6_ifaddr *in6_ifawithifp __P((struct ifnet *, struct in6_addr *));\nextern void in6_if_up __P((struct ifnet *));\nstruct sockaddr;\nextern\tu_char\tip6_protox[];\n\nvoid\tin6_sin6_2_sin __P((struct sockaddr_in *sin,\n\t\t\t    struct sockaddr_in6 *sin6));\nvoid\tin6_sin_2_v4mapsin6 __P((struct sockaddr_in *sin,\n\t\t\t\t struct sockaddr_in6 *sin6));\nvoid\tin6_sin6_2_sin_in_sock __P((struct sockaddr *nam));\nvoid\tin6_sin_2_v4mapsin6_in_sock __P((struct sockaddr **nam));\nextern void addrsel_policy_init __P((void));\n\n#define\tsatosin6(sa)\t((struct sockaddr_in6 *)(sa))\n#define\tsin6tosa(sin6)\t((struct sockaddr *)(sin6))\n#define\tifatoia6(ifa)\t((struct in6_ifaddr *)(ifa))\n\nextern int\t(*faithprefix_p)(struct in6_addr *);\n#endif /* _KERNEL */\n\n#ifndef _SIZE_T_DECLARED\ntypedef\t__size_t\tsize_t;\n#define\t_SIZE_T_DECLARED\n#endif\n\n#ifndef _SOCKLEN_T_DECLARED\ntypedef\t__socklen_t\tsocklen_t;\n#define\t_SOCKLEN_T_DECLARED\n#endif\n\n#if __BSD_VISIBLE\n\n__BEGIN_DECLS\nstruct cmsghdr;\n\nextern int inet6_option_space __P((int));\nextern int inet6_option_init __P((void *, struct cmsghdr **, int));\nextern int inet6_option_append __P((struct cmsghdr *, const uint8_t *,\n\tint, int));\nextern uint8_t *inet6_option_alloc __P((struct cmsghdr *, int, int, int));\nextern int inet6_option_next __P((const struct cmsghdr *, uint8_t **));\nextern int inet6_option_find __P((const struct cmsghdr *, uint8_t **, int));\n\nextern size_t inet6_rthdr_space __P((int, int));\nextern struct cmsghdr *inet6_rthdr_init __P((void *, int));\nextern int inet6_rthdr_add __P((struct cmsghdr *, const struct in6_addr *,\n\tunsigned int));\nextern int inet6_rthdr_lasthop __P((struct cmsghdr *, unsigned int));\n#if 0 /* not implemented yet */\nextern int inet6_rthdr_reverse __P((const struct cmsghdr *, struct cmsghdr *));\n#endif\nextern int inet6_rthdr_segments __P((const struct cmsghdr *));\nextern struct in6_addr *inet6_rthdr_getaddr __P((struct cmsghdr *, int));\nextern int inet6_rthdr_getflags __P((const struct cmsghdr *, int));\n\nextern int inet6_opt_init __P((void *, socklen_t));\nextern int inet6_opt_append __P((void *, socklen_t, int, uint8_t, socklen_t,\n\tuint8_t, void **));\nextern int inet6_opt_finish __P((void *, socklen_t, int));\nextern int inet6_opt_set_val __P((void *, int, void *, socklen_t));\n\nextern int inet6_opt_next __P((void *, socklen_t, int, uint8_t *, socklen_t *,\n\tvoid **));\nextern int inet6_opt_find __P((void *, socklen_t, int, uint8_t, socklen_t *,\n\tvoid **));\nextern int inet6_opt_get_val __P((void *, int, void *, socklen_t));\nextern socklen_t inet6_rth_space __P((int, int));\nextern void *inet6_rth_init __P((void *, socklen_t, int, int));\nextern int inet6_rth_add __P((void *, const struct in6_addr *));\nextern int inet6_rth_reverse __P((const void *, void *));\nextern int inet6_rth_segments __P((const void *));\nextern struct in6_addr *inet6_rth_getaddr __P((const void *, int));\n__END_DECLS\n\n#endif /* __BSD_VISIBLE */\n\n#endif /* !_NETINET6_IN6_H_ */\n"
  },
  {
    "path": "freebsd-headers/netinet6/in6_gif.h",
    "content": "/*-\n * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. Neither the name of the project nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t$KAME: in6_gif.h,v 1.5 2000/04/14 08:36:03 itojun Exp $\n * $FreeBSD: release/9.0.0/sys/netinet6/in6_gif.h 174510 2007-12-10 16:03:40Z obrien $\n */\n\n#ifndef _NETINET6_IN6_GIF_H_\n#define _NETINET6_IN6_GIF_H_\n\n#define GIF_HLIM\t30\n\nstruct gif_softc;\nint in6_gif_input __P((struct mbuf **, int *, int));\nint in6_gif_output __P((struct ifnet *, int, struct mbuf *));\nint gif_encapcheck6 __P((const struct mbuf *, int, int, void *));\nint in6_gif_attach __P((struct gif_softc *));\nint in6_gif_detach __P((struct gif_softc *));\n\n#endif /* _NETINET6_IN6_GIF_H_ */\n"
  },
  {
    "path": "freebsd-headers/netinet6/in6_ifattach.h",
    "content": "/*-\n * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. Neither the name of the project nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t$KAME: in6_ifattach.h,v 1.14 2001/02/08 12:48:39 jinmei Exp $\n * $FreeBSD: release/9.0.0/sys/netinet6/in6_ifattach.h 174510 2007-12-10 16:03:40Z obrien $\n */\n\n#ifndef _NETINET6_IN6_IFATTACH_H_\n#define _NETINET6_IN6_IFATTACH_H_\n\n#ifdef _KERNEL\nvoid in6_ifattach __P((struct ifnet *, struct ifnet *));\nvoid in6_ifdetach __P((struct ifnet *));\nint in6_get_tmpifid __P((struct ifnet *, u_int8_t *, const u_int8_t *, int));\nvoid in6_tmpaddrtimer __P((void *));\nint in6_get_hw_ifid __P((struct ifnet *, struct in6_addr *));\nint in6_nigroup __P((struct ifnet *, const char *, int, struct in6_addr *));\n#endif /* _KERNEL */\n\n#endif /* _NETINET6_IN6_IFATTACH_H_ */\n"
  },
  {
    "path": "freebsd-headers/netinet6/in6_pcb.h",
    "content": "/*-\n * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. Neither the name of the project nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t$KAME: in6_pcb.h,v 1.13 2001/02/06 09:16:53 itojun Exp $\n */\n\n/*-\n * Copyright (c) 1982, 1986, 1990, 1993\n *\tThe Regents of the University of California.  All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 4. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t@(#)in_pcb.h\t8.1 (Berkeley) 6/10/93\n * $FreeBSD: release/9.0.0/sys/netinet6/in6_pcb.h 222748 2011-06-06 12:55:02Z rwatson $\n */\n\n#ifndef _NETINET6_IN6_PCB_H_\n#define\t_NETINET6_IN6_PCB_H_\n\n#ifdef _KERNEL\n#define\tsatosin6(sa)\t((struct sockaddr_in6 *)(sa))\n#define\tsin6tosa(sin6)\t((struct sockaddr *)(sin6))\n#define\tifatoia6(ifa)\t((struct in6_ifaddr *)(ifa))\n\nstruct\tinpcbgroup *\n\tin6_pcbgroup_byhash(struct inpcbinfo *, u_int, uint32_t);\nstruct\tinpcbgroup *\n\tin6_pcbgroup_byinpcb __P((struct inpcb *));\nstruct inpcbgroup *\n\tin6_pcbgroup_bymbuf(struct inpcbinfo *, struct mbuf *);\nstruct\tinpcbgroup *\n\tin6_pcbgroup_bytuple __P((struct inpcbinfo *, const struct in6_addr *,\n\t    u_short, const struct in6_addr *, u_short));\n\nvoid\tin6_pcbpurgeif0 __P((struct inpcbinfo *, struct ifnet *));\nvoid\tin6_losing __P((struct inpcb *));\nint\tin6_pcbbind __P((struct inpcb *, struct sockaddr *, struct ucred *));\nint\tin6_pcbconnect __P((struct inpcb *, struct sockaddr *, struct ucred *));\nint\tin6_pcbconnect_mbuf __P((struct inpcb *, struct sockaddr *,\n\t    struct ucred *, struct mbuf *));\nvoid\tin6_pcbdisconnect __P((struct inpcb *));\nint\tin6_pcbladdr(struct inpcb *, struct sockaddr *, struct in6_addr *);\nstruct\tinpcb *\n\tin6_pcblookup_local __P((struct inpcbinfo *,\n\t\t\t\t struct in6_addr *, u_short, int,\n\t\t\t\t struct ucred *));\nstruct\tinpcb *\n\tin6_pcblookup __P((struct inpcbinfo *, struct in6_addr *,\n\t\t\t   u_int, struct in6_addr *, u_int, int,\n\t\t\t   struct ifnet *));\nstruct\tinpcb *\n\tin6_pcblookup_hash_locked __P((struct inpcbinfo *, struct in6_addr *,\n\t\t\t   u_int, struct in6_addr *, u_int, int,\n\t\t\t   struct ifnet *));\nstruct\tinpcb *\n\tin6_pcblookup_mbuf __P((struct inpcbinfo *, struct in6_addr *,\n\t\t\t   u_int, struct in6_addr *, u_int, int,\n\t\t\t   struct ifnet *ifp, struct mbuf *));\nvoid\tin6_pcbnotify __P((struct inpcbinfo *, struct sockaddr *,\n\t\t\t   u_int, const struct sockaddr *, u_int, int, void *,\n\t\t\t   struct inpcb *(*)(struct inpcb *, int)));\nstruct inpcb *\n\tin6_rtchange __P((struct inpcb *, int));\nstruct sockaddr *\n\tin6_sockaddr __P((in_port_t port, struct in6_addr *addr_p));\nstruct sockaddr *\n\tin6_v4mapsin6_sockaddr __P((in_port_t port, struct in_addr *addr_p));\nint\tin6_getpeeraddr __P((struct socket *so, struct sockaddr **nam));\nint\tin6_getsockaddr __P((struct socket *so, struct sockaddr **nam));\nint\tin6_mapped_sockaddr __P((struct socket *so, struct sockaddr **nam));\nint\tin6_mapped_peeraddr __P((struct socket *so, struct sockaddr **nam));\nint\tin6_selecthlim __P((struct in6pcb *, struct ifnet *));\nint\tin6_pcbsetport __P((struct in6_addr *, struct inpcb *, struct ucred *));\nvoid\tinit_sin6 __P((struct sockaddr_in6 *sin6, struct mbuf *m));\n#endif /* _KERNEL */\n\n#endif /* !_NETINET6_IN6_PCB_H_ */\n"
  },
  {
    "path": "freebsd-headers/netinet6/in6_var.h",
    "content": "/*-\n * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. Neither the name of the project nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t$KAME: in6_var.h,v 1.56 2001/03/29 05:34:31 itojun Exp $\n */\n\n/*-\n * Copyright (c) 1985, 1986, 1993\n *\tThe Regents of the University of California.  All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 4. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t@(#)in_var.h\t8.1 (Berkeley) 6/10/93\n * $FreeBSD: release/9.0.0/sys/netinet6/in6_var.h 207369 2010-04-29 11:52:42Z bz $\n */\n\n#ifndef _NETINET6_IN6_VAR_H_\n#define _NETINET6_IN6_VAR_H_\n\n#include <sys/tree.h>\n\n#ifdef _KERNEL\n#include <sys/libkern.h>\n#endif\n\n/*\n * Interface address, Internet version.  One of these structures\n * is allocated for each interface with an Internet address.\n * The ifaddr structure contains the protocol-independent part\n * of the structure and is assumed to be first.\n */\n\n/*\n * pltime/vltime are just for future reference (required to implements 2\n * hour rule for hosts).  they should never be modified by nd6_timeout or\n * anywhere else.\n *\tuserland -> kernel: accept pltime/vltime\n *\tkernel -> userland: throw up everything\n *\tin kernel: modify preferred/expire only\n */\nstruct in6_addrlifetime {\n\ttime_t ia6t_expire;\t/* valid lifetime expiration time */\n\ttime_t ia6t_preferred;\t/* preferred lifetime expiration time */\n\tu_int32_t ia6t_vltime;\t/* valid lifetime */\n\tu_int32_t ia6t_pltime;\t/* prefix lifetime */\n};\n\nstruct nd_ifinfo;\nstruct scope6_id;\nstruct lltable;\nstruct mld_ifinfo;\n\nstruct in6_ifextra {\n\tstruct in6_ifstat *in6_ifstat;\n\tstruct icmp6_ifstat *icmp6_ifstat;\n\tstruct nd_ifinfo *nd_ifinfo;\n\tstruct scope6_id *scope6_id;\n\tstruct lltable *lltable;\n\tstruct mld_ifinfo *mld_ifinfo;\n};\n\n#define\tLLTABLE6(ifp)\t(((struct in6_ifextra *)(ifp)->if_afdata[AF_INET6])->lltable)\n\nstruct\tin6_ifaddr {\n\tstruct\tifaddr ia_ifa;\t\t/* protocol-independent info */\n#define\tia_ifp\t\tia_ifa.ifa_ifp\n#define ia_flags\tia_ifa.ifa_flags\n\tstruct\tsockaddr_in6 ia_addr;\t/* interface address */\n\tstruct\tsockaddr_in6 ia_net;\t/* network number of interface */\n\tstruct\tsockaddr_in6 ia_dstaddr; /* space for destination addr */\n\tstruct\tsockaddr_in6 ia_prefixmask; /* prefix mask */\n\tu_int32_t ia_plen;\t\t/* prefix length */\n\tTAILQ_ENTRY(in6_ifaddr)\tia_link;\t/* list of IPv6 addresses */\n\tint\tia6_flags;\n\n\tstruct in6_addrlifetime ia6_lifetime;\n\ttime_t\tia6_createtime; /* the creation time of this address, which is\n\t\t\t\t * currently used for temporary addresses only.\n\t\t\t\t */\n\ttime_t\tia6_updatetime;\n\n\t/* back pointer to the ND prefix (for autoconfigured addresses only) */\n\tstruct nd_prefix *ia6_ndpr;\n\n\t/* multicast addresses joined from the kernel */\n\tLIST_HEAD(, in6_multi_mship) ia6_memberships;\n};\n\n/* List of in6_ifaddr's. */\nTAILQ_HEAD(in6_ifaddrhead, in6_ifaddr);\n\n/* control structure to manage address selection policy */\nstruct in6_addrpolicy {\n\tstruct sockaddr_in6 addr; /* prefix address */\n\tstruct sockaddr_in6 addrmask; /* prefix mask */\n\tint preced;\t\t/* precedence */\n\tint label;\t\t/* matching label */\n\tu_quad_t use;\t\t/* statistics */\n};\n\n/*\n * IPv6 interface statistics, as defined in RFC2465 Ipv6IfStatsEntry (p12).\n */\nstruct in6_ifstat {\n\tu_quad_t ifs6_in_receive;\t/* # of total input datagram */\n\tu_quad_t ifs6_in_hdrerr;\t/* # of datagrams with invalid hdr */\n\tu_quad_t ifs6_in_toobig;\t/* # of datagrams exceeded MTU */\n\tu_quad_t ifs6_in_noroute;\t/* # of datagrams with no route */\n\tu_quad_t ifs6_in_addrerr;\t/* # of datagrams with invalid dst */\n\tu_quad_t ifs6_in_protounknown;\t/* # of datagrams with unknown proto */\n\t\t\t\t\t/* NOTE: increment on final dst if */\n\tu_quad_t ifs6_in_truncated;\t/* # of truncated datagrams */\n\tu_quad_t ifs6_in_discard;\t/* # of discarded datagrams */\n\t\t\t\t\t/* NOTE: fragment timeout is not here */\n\tu_quad_t ifs6_in_deliver;\t/* # of datagrams delivered to ULP */\n\t\t\t\t\t/* NOTE: increment on final dst if */\n\tu_quad_t ifs6_out_forward;\t/* # of datagrams forwarded */\n\t\t\t\t\t/* NOTE: increment on outgoing if */\n\tu_quad_t ifs6_out_request;\t/* # of outgoing datagrams from ULP */\n\t\t\t\t\t/* NOTE: does not include forwrads */\n\tu_quad_t ifs6_out_discard;\t/* # of discarded datagrams */\n\tu_quad_t ifs6_out_fragok;\t/* # of datagrams fragmented */\n\tu_quad_t ifs6_out_fragfail;\t/* # of datagrams failed on fragment */\n\tu_quad_t ifs6_out_fragcreat;\t/* # of fragment datagrams */\n\t\t\t\t\t/* NOTE: this is # after fragment */\n\tu_quad_t ifs6_reass_reqd;\t/* # of incoming fragmented packets */\n\t\t\t\t\t/* NOTE: increment on final dst if */\n\tu_quad_t ifs6_reass_ok;\t\t/* # of reassembled packets */\n\t\t\t\t\t/* NOTE: this is # after reass */\n\t\t\t\t\t/* NOTE: increment on final dst if */\n\tu_quad_t ifs6_reass_fail;\t/* # of reass failures */\n\t\t\t\t\t/* NOTE: may not be packet count */\n\t\t\t\t\t/* NOTE: increment on final dst if */\n\tu_quad_t ifs6_in_mcast;\t\t/* # of inbound multicast datagrams */\n\tu_quad_t ifs6_out_mcast;\t/* # of outbound multicast datagrams */\n};\n\n/*\n * ICMPv6 interface statistics, as defined in RFC2466 Ipv6IfIcmpEntry.\n * XXX: I'm not sure if this file is the right place for this structure...\n */\nstruct icmp6_ifstat {\n\t/*\n\t * Input statistics\n\t */\n\t/* ipv6IfIcmpInMsgs, total # of input messages */\n\tu_quad_t ifs6_in_msg;\n\t/* ipv6IfIcmpInErrors, # of input error messages */\n\tu_quad_t ifs6_in_error;\n\t/* ipv6IfIcmpInDestUnreachs, # of input dest unreach errors */\n\tu_quad_t ifs6_in_dstunreach;\n\t/* ipv6IfIcmpInAdminProhibs, # of input administratively prohibited errs */\n\tu_quad_t ifs6_in_adminprohib;\n\t/* ipv6IfIcmpInTimeExcds, # of input time exceeded errors */\n\tu_quad_t ifs6_in_timeexceed;\n\t/* ipv6IfIcmpInParmProblems, # of input parameter problem errors */\n\tu_quad_t ifs6_in_paramprob;\n\t/* ipv6IfIcmpInPktTooBigs, # of input packet too big errors */\n\tu_quad_t ifs6_in_pkttoobig;\n\t/* ipv6IfIcmpInEchos, # of input echo requests */\n\tu_quad_t ifs6_in_echo;\n\t/* ipv6IfIcmpInEchoReplies, # of input echo replies */\n\tu_quad_t ifs6_in_echoreply;\n\t/* ipv6IfIcmpInRouterSolicits, # of input router solicitations */\n\tu_quad_t ifs6_in_routersolicit;\n\t/* ipv6IfIcmpInRouterAdvertisements, # of input router advertisements */\n\tu_quad_t ifs6_in_routeradvert;\n\t/* ipv6IfIcmpInNeighborSolicits, # of input neighbor solicitations */\n\tu_quad_t ifs6_in_neighborsolicit;\n\t/* ipv6IfIcmpInNeighborAdvertisements, # of input neighbor advertisements */\n\tu_quad_t ifs6_in_neighboradvert;\n\t/* ipv6IfIcmpInRedirects, # of input redirects */\n\tu_quad_t ifs6_in_redirect;\n\t/* ipv6IfIcmpInGroupMembQueries, # of input MLD queries */\n\tu_quad_t ifs6_in_mldquery;\n\t/* ipv6IfIcmpInGroupMembResponses, # of input MLD reports */\n\tu_quad_t ifs6_in_mldreport;\n\t/* ipv6IfIcmpInGroupMembReductions, # of input MLD done */\n\tu_quad_t ifs6_in_mlddone;\n\n\t/*\n\t * Output statistics. We should solve unresolved routing problem...\n\t */\n\t/* ipv6IfIcmpOutMsgs, total # of output messages */\n\tu_quad_t ifs6_out_msg;\n\t/* ipv6IfIcmpOutErrors, # of output error messages */\n\tu_quad_t ifs6_out_error;\n\t/* ipv6IfIcmpOutDestUnreachs, # of output dest unreach errors */\n\tu_quad_t ifs6_out_dstunreach;\n\t/* ipv6IfIcmpOutAdminProhibs, # of output administratively prohibited errs */\n\tu_quad_t ifs6_out_adminprohib;\n\t/* ipv6IfIcmpOutTimeExcds, # of output time exceeded errors */\n\tu_quad_t ifs6_out_timeexceed;\n\t/* ipv6IfIcmpOutParmProblems, # of output parameter problem errors */\n\tu_quad_t ifs6_out_paramprob;\n\t/* ipv6IfIcmpOutPktTooBigs, # of output packet too big errors */\n\tu_quad_t ifs6_out_pkttoobig;\n\t/* ipv6IfIcmpOutEchos, # of output echo requests */\n\tu_quad_t ifs6_out_echo;\n\t/* ipv6IfIcmpOutEchoReplies, # of output echo replies */\n\tu_quad_t ifs6_out_echoreply;\n\t/* ipv6IfIcmpOutRouterSolicits, # of output router solicitations */\n\tu_quad_t ifs6_out_routersolicit;\n\t/* ipv6IfIcmpOutRouterAdvertisements, # of output router advertisements */\n\tu_quad_t ifs6_out_routeradvert;\n\t/* ipv6IfIcmpOutNeighborSolicits, # of output neighbor solicitations */\n\tu_quad_t ifs6_out_neighborsolicit;\n\t/* ipv6IfIcmpOutNeighborAdvertisements, # of output neighbor advertisements */\n\tu_quad_t ifs6_out_neighboradvert;\n\t/* ipv6IfIcmpOutRedirects, # of output redirects */\n\tu_quad_t ifs6_out_redirect;\n\t/* ipv6IfIcmpOutGroupMembQueries, # of output MLD queries */\n\tu_quad_t ifs6_out_mldquery;\n\t/* ipv6IfIcmpOutGroupMembResponses, # of output MLD reports */\n\tu_quad_t ifs6_out_mldreport;\n\t/* ipv6IfIcmpOutGroupMembReductions, # of output MLD done */\n\tu_quad_t ifs6_out_mlddone;\n};\n\nstruct\tin6_ifreq {\n\tchar\tifr_name[IFNAMSIZ];\n\tunion {\n\t\tstruct\tsockaddr_in6 ifru_addr;\n\t\tstruct\tsockaddr_in6 ifru_dstaddr;\n\t\tint\tifru_flags;\n\t\tint\tifru_flags6;\n\t\tint\tifru_metric;\n\t\tcaddr_t\tifru_data;\n\t\tstruct in6_addrlifetime ifru_lifetime;\n\t\tstruct in6_ifstat ifru_stat;\n\t\tstruct icmp6_ifstat ifru_icmp6stat;\n\t\tu_int32_t ifru_scope_id[16];\n\t} ifr_ifru;\n};\n\nstruct\tin6_aliasreq {\n\tchar\tifra_name[IFNAMSIZ];\n\tstruct\tsockaddr_in6 ifra_addr;\n\tstruct\tsockaddr_in6 ifra_dstaddr;\n\tstruct\tsockaddr_in6 ifra_prefixmask;\n\tint\tifra_flags;\n\tstruct in6_addrlifetime ifra_lifetime;\n};\n\n/* prefix type macro */\n#define IN6_PREFIX_ND\t1\n#define IN6_PREFIX_RR\t2\n\n/*\n * prefix related flags passed between kernel(NDP related part) and\n * user land command(ifconfig) and daemon(rtadvd).\n */\nstruct in6_prflags {\n\tstruct prf_ra {\n\t\tu_char onlink : 1;\n\t\tu_char autonomous : 1;\n\t\tu_char reserved : 6;\n\t} prf_ra;\n\tu_char prf_reserved1;\n\tu_short prf_reserved2;\n\t/* want to put this on 4byte offset */\n\tstruct prf_rr {\n\t\tu_char decrvalid : 1;\n\t\tu_char decrprefd : 1;\n\t\tu_char reserved : 6;\n\t} prf_rr;\n\tu_char prf_reserved3;\n\tu_short prf_reserved4;\n};\n\nstruct  in6_prefixreq {\n\tchar\tipr_name[IFNAMSIZ];\n\tu_char\tipr_origin;\n\tu_char\tipr_plen;\n\tu_int32_t ipr_vltime;\n\tu_int32_t ipr_pltime;\n\tstruct in6_prflags ipr_flags;\n\tstruct\tsockaddr_in6 ipr_prefix;\n};\n\n#define PR_ORIG_RA\t0\n#define PR_ORIG_RR\t1\n#define PR_ORIG_STATIC\t2\n#define PR_ORIG_KERNEL\t3\n\n#define ipr_raf_onlink\t\tipr_flags.prf_ra.onlink\n#define ipr_raf_auto\t\tipr_flags.prf_ra.autonomous\n\n#define ipr_statef_onlink\tipr_flags.prf_state.onlink\n\n#define ipr_rrf_decrvalid\tipr_flags.prf_rr.decrvalid\n#define ipr_rrf_decrprefd\tipr_flags.prf_rr.decrprefd\n\nstruct\tin6_rrenumreq {\n\tchar\tirr_name[IFNAMSIZ];\n\tu_char\tirr_origin;\n\tu_char\tirr_m_len;\t/* match len for matchprefix */\n\tu_char\tirr_m_minlen;\t/* minlen for matching prefix */\n\tu_char\tirr_m_maxlen;\t/* maxlen for matching prefix */\n\tu_char\tirr_u_uselen;\t/* uselen for adding prefix */\n\tu_char\tirr_u_keeplen;\t/* keeplen from matching prefix */\n\tstruct irr_raflagmask {\n\t\tu_char onlink : 1;\n\t\tu_char autonomous : 1;\n\t\tu_char reserved : 6;\n\t} irr_raflagmask;\n\tu_int32_t irr_vltime;\n\tu_int32_t irr_pltime;\n\tstruct in6_prflags irr_flags;\n\tstruct\tsockaddr_in6 irr_matchprefix;\n\tstruct\tsockaddr_in6 irr_useprefix;\n};\n\n#define irr_raf_mask_onlink\tirr_raflagmask.onlink\n#define irr_raf_mask_auto\tirr_raflagmask.autonomous\n#define irr_raf_mask_reserved\tirr_raflagmask.reserved\n\n#define irr_raf_onlink\t\tirr_flags.prf_ra.onlink\n#define irr_raf_auto\t\tirr_flags.prf_ra.autonomous\n\n#define irr_statef_onlink\tirr_flags.prf_state.onlink\n\n#define irr_rrf\t\t\tirr_flags.prf_rr\n#define irr_rrf_decrvalid\tirr_flags.prf_rr.decrvalid\n#define irr_rrf_decrprefd\tirr_flags.prf_rr.decrprefd\n\n/*\n * Given a pointer to an in6_ifaddr (ifaddr),\n * return a pointer to the addr as a sockaddr_in6\n */\n#define IA6_IN6(ia)\t(&((ia)->ia_addr.sin6_addr))\n#define IA6_DSTIN6(ia)\t(&((ia)->ia_dstaddr.sin6_addr))\n#define IA6_MASKIN6(ia)\t(&((ia)->ia_prefixmask.sin6_addr))\n#define IA6_SIN6(ia)\t(&((ia)->ia_addr))\n#define IA6_DSTSIN6(ia)\t(&((ia)->ia_dstaddr))\n#define IFA_IN6(x)\t(&((struct sockaddr_in6 *)((x)->ifa_addr))->sin6_addr)\n#define IFA_DSTIN6(x)\t(&((struct sockaddr_in6 *)((x)->ifa_dstaddr))->sin6_addr)\n\n#define IFPR_IN6(x)\t(&((struct sockaddr_in6 *)((x)->ifpr_prefix))->sin6_addr)\n\n#ifdef _KERNEL\n#define IN6_ARE_MASKED_ADDR_EQUAL(d, a, m)\t(\t\\\n\t(((d)->s6_addr32[0] ^ (a)->s6_addr32[0]) & (m)->s6_addr32[0]) == 0 && \\\n\t(((d)->s6_addr32[1] ^ (a)->s6_addr32[1]) & (m)->s6_addr32[1]) == 0 && \\\n\t(((d)->s6_addr32[2] ^ (a)->s6_addr32[2]) & (m)->s6_addr32[2]) == 0 && \\\n\t(((d)->s6_addr32[3] ^ (a)->s6_addr32[3]) & (m)->s6_addr32[3]) == 0 )\n#endif\n\n#define SIOCSIFADDR_IN6\t\t _IOW('i', 12, struct in6_ifreq)\n#define SIOCGIFADDR_IN6\t\t_IOWR('i', 33, struct in6_ifreq)\n\n#ifdef _KERNEL\n/*\n * SIOCSxxx ioctls should be unused (see comments in in6.c), but\n * we do not shift numbers for binary compatibility.\n */\n#define SIOCSIFDSTADDR_IN6\t _IOW('i', 14, struct in6_ifreq)\n#define SIOCSIFNETMASK_IN6\t _IOW('i', 22, struct in6_ifreq)\n#endif\n\n#define SIOCGIFDSTADDR_IN6\t_IOWR('i', 34, struct in6_ifreq)\n#define SIOCGIFNETMASK_IN6\t_IOWR('i', 37, struct in6_ifreq)\n\n#define SIOCDIFADDR_IN6\t\t _IOW('i', 25, struct in6_ifreq)\n#define SIOCAIFADDR_IN6\t\t _IOW('i', 26, struct in6_aliasreq)\n\n#define SIOCSIFPHYADDR_IN6       _IOW('i', 70, struct in6_aliasreq)\n#define\tSIOCGIFPSRCADDR_IN6\t_IOWR('i', 71, struct in6_ifreq)\n#define\tSIOCGIFPDSTADDR_IN6\t_IOWR('i', 72, struct in6_ifreq)\n\n#define SIOCGIFAFLAG_IN6\t_IOWR('i', 73, struct in6_ifreq)\n\n#define SIOCGDRLST_IN6\t\t_IOWR('i', 74, struct in6_drlist)\n#ifdef _KERNEL\n/* XXX: SIOCGPRLST_IN6 is exposed in KAME but in6_oprlist is not. */\n#define SIOCGPRLST_IN6\t\t_IOWR('i', 75, struct in6_oprlist)\n#endif\n#ifdef _KERNEL\n#define OSIOCGIFINFO_IN6\t_IOWR('i', 76, struct in6_ondireq)\n#endif\n#define SIOCGIFINFO_IN6\t\t_IOWR('i', 108, struct in6_ndireq)\n#define SIOCSIFINFO_IN6\t\t_IOWR('i', 109, struct in6_ndireq)\n#define SIOCSNDFLUSH_IN6\t_IOWR('i', 77, struct in6_ifreq)\n#define SIOCGNBRINFO_IN6\t_IOWR('i', 78, struct in6_nbrinfo)\n#define SIOCSPFXFLUSH_IN6\t_IOWR('i', 79, struct in6_ifreq)\n#define SIOCSRTRFLUSH_IN6\t_IOWR('i', 80, struct in6_ifreq)\n\n#define SIOCGIFALIFETIME_IN6\t_IOWR('i', 81, struct in6_ifreq)\n#define SIOCSIFALIFETIME_IN6\t_IOWR('i', 82, struct in6_ifreq)\n#define SIOCGIFSTAT_IN6\t\t_IOWR('i', 83, struct in6_ifreq)\n#define SIOCGIFSTAT_ICMP6\t_IOWR('i', 84, struct in6_ifreq)\n\n#define SIOCSDEFIFACE_IN6\t_IOWR('i', 85, struct in6_ndifreq)\n#define SIOCGDEFIFACE_IN6\t_IOWR('i', 86, struct in6_ndifreq)\n\n#define SIOCSIFINFO_FLAGS\t_IOWR('i', 87, struct in6_ndireq) /* XXX */\n\n#define SIOCSSCOPE6\t\t_IOW('i', 88, struct in6_ifreq)\n#define SIOCGSCOPE6\t\t_IOWR('i', 89, struct in6_ifreq)\n#define SIOCGSCOPE6DEF\t\t_IOWR('i', 90, struct in6_ifreq)\n\n#define SIOCSIFPREFIX_IN6\t_IOW('i', 100, struct in6_prefixreq) /* set */\n#define SIOCGIFPREFIX_IN6\t_IOWR('i', 101, struct in6_prefixreq) /* get */\n#define SIOCDIFPREFIX_IN6\t_IOW('i', 102, struct in6_prefixreq) /* del */\n#define SIOCAIFPREFIX_IN6\t_IOW('i', 103, struct in6_rrenumreq) /* add */\n#define SIOCCIFPREFIX_IN6\t_IOW('i', 104, \\\n\t\t\t\t     struct in6_rrenumreq) /* change */\n#define SIOCSGIFPREFIX_IN6\t_IOW('i', 105, \\\n\t\t\t\t     struct in6_rrenumreq) /* set global */\n\n#define SIOCGETSGCNT_IN6\t_IOWR('u', 106, \\\n\t\t\t\t      struct sioc_sg_req6) /* get s,g pkt cnt */\n#define SIOCGETMIFCNT_IN6\t_IOWR('u', 107, \\\n\t\t\t\t      struct sioc_mif_req6) /* get pkt cnt per if */\n\n#define SIOCAADDRCTL_POLICY\t_IOW('u', 108, struct in6_addrpolicy)\n#define SIOCDADDRCTL_POLICY\t_IOW('u', 109, struct in6_addrpolicy)\n\n#define IN6_IFF_ANYCAST\t\t0x01\t/* anycast address */\n#define IN6_IFF_TENTATIVE\t0x02\t/* tentative address */\n#define IN6_IFF_DUPLICATED\t0x04\t/* DAD detected duplicate */\n#define IN6_IFF_DETACHED\t0x08\t/* may be detached from the link */\n#define IN6_IFF_DEPRECATED\t0x10\t/* deprecated address */\n#define IN6_IFF_NODAD\t\t0x20\t/* don't perform DAD on this address\n\t\t\t\t\t * (used only at first SIOC* call)\n\t\t\t\t\t */\n#define IN6_IFF_AUTOCONF\t0x40\t/* autoconfigurable address. */\n#define IN6_IFF_TEMPORARY\t0x80\t/* temporary (anonymous) address. */\n#define IN6_IFF_NOPFX\t\t0x8000\t/* skip kernel prefix management.\n\t\t\t\t\t * XXX: this should be temporary.\n\t\t\t\t\t */\n\n/* do not input/output */\n#define IN6_IFF_NOTREADY (IN6_IFF_TENTATIVE|IN6_IFF_DUPLICATED)\n\n#ifdef _KERNEL\n#define IN6_ARE_SCOPE_CMP(a,b) ((a)-(b))\n#define IN6_ARE_SCOPE_EQUAL(a,b) ((a)==(b))\n#endif\n\n#ifdef _KERNEL\nVNET_DECLARE(struct in6_ifaddrhead, in6_ifaddrhead);\n#define\tV_in6_ifaddrhead\t\tVNET(in6_ifaddrhead)\n\nextern struct rwlock in6_ifaddr_lock;\n#define\tIN6_IFADDR_LOCK_ASSERT(\t)\trw_assert(&in6_ifaddr_lock, RA_LOCKED)\n#define\tIN6_IFADDR_RLOCK()\t\trw_rlock(&in6_ifaddr_lock)\n#define\tIN6_IFADDR_RLOCK_ASSERT()\trw_assert(&in6_ifaddr_lock, RA_RLOCKED)\n#define\tIN6_IFADDR_RUNLOCK()\t\trw_runlock(&in6_ifaddr_lock)\n#define\tIN6_IFADDR_WLOCK()\t\trw_wlock(&in6_ifaddr_lock)\n#define\tIN6_IFADDR_WLOCK_ASSERT()\trw_assert(&in6_ifaddr_lock, RA_WLOCKED)\n#define\tIN6_IFADDR_WUNLOCK()\t\trw_wunlock(&in6_ifaddr_lock)\n\nVNET_DECLARE(struct icmp6stat, icmp6stat);\n#define\tV_icmp6stat\t\t\tVNET(icmp6stat)\n#define in6_ifstat_inc(ifp, tag) \\\ndo {\t\t\t\t\t\t\t\t\\\n\tif (ifp)\t\t\t\t\t\t\\\n\t\t((struct in6_ifextra *)((ifp)->if_afdata[AF_INET6]))->in6_ifstat->tag++; \\\n} while (/*CONSTCOND*/ 0)\n\nextern struct in6_addr zeroin6_addr;\nextern u_char inet6ctlerrmap[];\nVNET_DECLARE(unsigned long, in6_maxmtu);\n#define\tV_in6_maxmtu\t\t\tVNET(in6_maxmtu)\n#endif /* _KERNEL */\n\n/*\n * IPv6 multicast MLD-layer source entry.\n */\nstruct ip6_msource {\n\tRB_ENTRY(ip6_msource)\tim6s_link;\t/* RB tree links */\n\tstruct in6_addr\t\tim6s_addr;\n\tstruct im6s_st {\n\t\tuint16_t\tex;\t\t/* # of exclusive members */\n\t\tuint16_t\tin;\t\t/* # of inclusive members */\n\t}\t\t\tim6s_st[2];\t/* state at t0, t1 */\n\tuint8_t\t\t\tim6s_stp;\t/* pending query */\n};\nRB_HEAD(ip6_msource_tree, ip6_msource);\n\n/*\n * IPv6 multicast PCB-layer source entry.\n *\n * NOTE: overlapping use of struct ip6_msource fields at start.\n */\nstruct in6_msource {\n\tRB_ENTRY(ip6_msource)\tim6s_link;\t/* Common field */\n\tstruct in6_addr\t\tim6s_addr;\t/* Common field */\n\tuint8_t\t\t\tim6sl_st[2];\t/* state before/at commit */\n};\n\n#ifdef _KERNEL\n/*\n * IPv6 source tree comparison function.\n *\n * An ordered predicate is necessary; bcmp() is not documented to return\n * an indication of order, memcmp() is, and is an ISO C99 requirement.\n */\nstatic __inline int\nip6_msource_cmp(const struct ip6_msource *a, const struct ip6_msource *b)\n{\n\n\treturn (memcmp(&a->im6s_addr, &b->im6s_addr, sizeof(struct in6_addr)));\n}\nRB_PROTOTYPE(ip6_msource_tree, ip6_msource, im6s_link, ip6_msource_cmp);\n#endif /* _KERNEL */\n\n/*\n * IPv6 multicast PCB-layer group filter descriptor.\n */\nstruct in6_mfilter {\n\tstruct ip6_msource_tree\tim6f_sources; /* source list for (S,G) */\n\tu_long\t\t\tim6f_nsrc;    /* # of source entries */\n\tuint8_t\t\t\tim6f_st[2];   /* state before/at commit */\n};\n\n/*\n * Legacy KAME IPv6 multicast membership descriptor.\n */\nstruct in6_multi_mship {\n\tstruct\tin6_multi *i6mm_maddr;\n\tLIST_ENTRY(in6_multi_mship) i6mm_chain;\n};\n\n/*\n * IPv6 group descriptor.\n *\n * For every entry on an ifnet's if_multiaddrs list which represents\n * an IP multicast group, there is one of these structures.\n *\n * If any source filters are present, then a node will exist in the RB-tree\n * to permit fast lookup by source whenever an operation takes place.\n * This permits pre-order traversal when we issue reports.\n * Source filter trees are kept separately from the socket layer to\n * greatly simplify locking.\n *\n * When MLDv2 is active, in6m_timer is the response to group query timer.\n * The state-change timer in6m_sctimer is separate; whenever state changes\n * for the group the state change record is generated and transmitted,\n * and kept if retransmissions are necessary.\n *\n * FUTURE: in6m_link is now only used when groups are being purged\n * on a detaching ifnet. It could be demoted to a SLIST_ENTRY, but\n * because it is at the very start of the struct, we can't do this\n * w/o breaking the ABI for ifmcstat.\n */\nstruct in6_multi {\n\tLIST_ENTRY(in6_multi) in6m_entry; /* list glue */\n\tstruct\tin6_addr in6m_addr;\t/* IPv6 multicast address */\n\tstruct\tifnet *in6m_ifp;\t/* back pointer to ifnet */\n\tstruct\tifmultiaddr *in6m_ifma;\t/* back pointer to ifmultiaddr */\n\tu_int\tin6m_refcount;\t\t/* reference count */\n\tu_int\tin6m_state;\t\t/* state of the membership */\n\tu_int\tin6m_timer;\t\t/* MLD6 listener report timer */\n\n\t/* New fields for MLDv2 follow. */\n\tstruct mld_ifinfo\t*in6m_mli;\t/* MLD info */\n\tSLIST_ENTRY(in6_multi)\t in6m_nrele;\t/* to-be-released by MLD */\n\tstruct ip6_msource_tree\t in6m_srcs;\t/* tree of sources */\n\tu_long\t\t\t in6m_nsrc;\t/* # of tree entries */\n\n\tstruct ifqueue\t\t in6m_scq;\t/* queue of pending\n\t\t\t\t\t\t * state-change packets */\n\tstruct timeval\t\t in6m_lastgsrtv;\t/* last G-S-R query */\n\tuint16_t\t\t in6m_sctimer;\t/* state-change timer */\n\tuint16_t\t\t in6m_scrv;\t/* state-change rexmit count */\n\n\t/*\n\t * SSM state counters which track state at T0 (the time the last\n\t * state-change report's RV timer went to zero) and T1\n\t * (time of pending report, i.e. now).\n\t * Used for computing MLDv2 state-change reports. Several refcounts\n\t * are maintained here to optimize for common use-cases.\n\t */\n\tstruct in6m_st {\n\t\tuint16_t\tiss_fmode;\t/* MLD filter mode */\n\t\tuint16_t\tiss_asm;\t/* # of ASM listeners */\n\t\tuint16_t\tiss_ex;\t\t/* # of exclusive members */\n\t\tuint16_t\tiss_in;\t\t/* # of inclusive members */\n\t\tuint16_t\tiss_rec;\t/* # of recorded sources */\n\t}\t\t\tin6m_st[2];\t/* state at t0, t1 */\n};\n\n/*\n * Helper function to derive the filter mode on a source entry\n * from its internal counters. Predicates are:\n *  A source is only excluded if all listeners exclude it.\n *  A source is only included if no listeners exclude it,\n *  and at least one listener includes it.\n * May be used by ifmcstat(8).\n */\nstatic __inline uint8_t\nim6s_get_mode(const struct in6_multi *inm, const struct ip6_msource *ims,\n    uint8_t t)\n{\n\n\tt = !!t;\n\tif (inm->in6m_st[t].iss_ex > 0 &&\n\t    inm->in6m_st[t].iss_ex == ims->im6s_st[t].ex)\n\t\treturn (MCAST_EXCLUDE);\n\telse if (ims->im6s_st[t].in > 0 && ims->im6s_st[t].ex == 0)\n\t\treturn (MCAST_INCLUDE);\n\treturn (MCAST_UNDEFINED);\n}\n\n#ifdef _KERNEL\n\n/*\n * Lock macros for IPv6 layer multicast address lists.  IPv6 lock goes\n * before link layer multicast locks in the lock order.  In most cases,\n * consumers of IN_*_MULTI() macros should acquire the locks before\n * calling them; users of the in_{add,del}multi() functions should not.\n */\nextern struct mtx in6_multi_mtx;\n#define\tIN6_MULTI_LOCK()\t\tmtx_lock(&in6_multi_mtx)\n#define\tIN6_MULTI_UNLOCK()\t\tmtx_unlock(&in6_multi_mtx)\n#define\tIN6_MULTI_LOCK_ASSERT()\t\tmtx_assert(&in6_multi_mtx, MA_OWNED)\n#define\tIN6_MULTI_UNLOCK_ASSERT()\tmtx_assert(&in6_multi_mtx, MA_NOTOWNED)\n\n/*\n * Look up an in6_multi record for an IPv6 multicast address\n * on the interface ifp.\n * If no record found, return NULL.\n *\n * SMPng: The IN6_MULTI_LOCK and IF_ADDR_LOCK on ifp must be held.\n */\nstatic __inline struct in6_multi *\nin6m_lookup_locked(struct ifnet *ifp, const struct in6_addr *mcaddr)\n{\n\tstruct ifmultiaddr *ifma;\n\tstruct in6_multi *inm;\n\n\tIN6_MULTI_LOCK_ASSERT();\n\tIF_ADDR_LOCK_ASSERT(ifp);\n\n\tinm = NULL;\n\tTAILQ_FOREACH(ifma, &((ifp)->if_multiaddrs), ifma_link) {\n\t\tif (ifma->ifma_addr->sa_family == AF_INET6) {\n\t\t\tinm = (struct in6_multi *)ifma->ifma_protospec;\n\t\t\tif (IN6_ARE_ADDR_EQUAL(&inm->in6m_addr, mcaddr))\n\t\t\t\tbreak;\n\t\t\tinm = NULL;\n\t\t}\n\t}\n\treturn (inm);\n}\n\n/*\n * Wrapper for in6m_lookup_locked().\n *\n * SMPng: Assumes that neithr the IN6_MULTI_LOCK() or IF_ADDR_LOCK() are held.\n */\nstatic __inline struct in6_multi *\nin6m_lookup(struct ifnet *ifp, const struct in6_addr *mcaddr)\n{\n\tstruct in6_multi *inm;\n\n\tIN6_MULTI_LOCK();\n\tIF_ADDR_LOCK(ifp);\n\tinm = in6m_lookup_locked(ifp, mcaddr);\n\tIF_ADDR_UNLOCK(ifp);\n\tIN6_MULTI_UNLOCK();\n\n\treturn (inm);\n}\n\n/* Acquire an in6_multi record. */\nstatic __inline void\nin6m_acquire_locked(struct in6_multi *inm)\n{\n\n\tIN6_MULTI_LOCK_ASSERT();\n\t++inm->in6m_refcount;\n}\n\nstruct ip6_moptions;\nstruct sockopt;\n\n/* Multicast KPIs. */\nint\tim6o_mc_filter(const struct ip6_moptions *, const struct ifnet *,\n\t    const struct sockaddr *, const struct sockaddr *);\nint\tin6_mc_join(struct ifnet *, const struct in6_addr *,\n\t    struct in6_mfilter *, struct in6_multi **, int);\nint\tin6_mc_join_locked(struct ifnet *, const struct in6_addr *,\n\t    struct in6_mfilter *, struct in6_multi **, int);\nint\tin6_mc_leave(struct in6_multi *, struct in6_mfilter *);\nint\tin6_mc_leave_locked(struct in6_multi *, struct in6_mfilter *);\nvoid\tin6m_clear_recorded(struct in6_multi *);\nvoid\tin6m_commit(struct in6_multi *);\nvoid\tin6m_print(const struct in6_multi *);\nint\tin6m_record_source(struct in6_multi *, const struct in6_addr *);\nvoid\tin6m_release_locked(struct in6_multi *);\nvoid\tip6_freemoptions(struct ip6_moptions *);\nint\tip6_getmoptions(struct inpcb *, struct sockopt *);\nint\tip6_setmoptions(struct inpcb *, struct sockopt *);\n\n/* Legacy KAME multicast KPIs. */\nstruct in6_multi_mship *\n\tin6_joingroup(struct ifnet *, struct in6_addr *, int *, int);\nint\tin6_leavegroup(struct in6_multi_mship *);\n\n/* flags to in6_update_ifa */\n#define IN6_IFAUPDATE_DADDELAY\t0x1 /* first time to configure an address */\n\nint\tin6_mask2len __P((struct in6_addr *, u_char *));\nint\tin6_control __P((struct socket *, u_long, caddr_t, struct ifnet *,\n\tstruct thread *));\nint\tin6_update_ifa __P((struct ifnet *, struct in6_aliasreq *,\n\tstruct in6_ifaddr *, int));\nvoid\tin6_purgeaddr __P((struct ifaddr *));\nint\tin6if_do_dad __P((struct ifnet *));\nvoid\tin6_purgeif __P((struct ifnet *));\nvoid\tin6_savemkludge __P((struct in6_ifaddr *));\nvoid\t*in6_domifattach __P((struct ifnet *));\nvoid\tin6_domifdetach __P((struct ifnet *, void *));\nvoid\tin6_setmaxmtu   __P((void));\nint\tin6_if2idlen   __P((struct ifnet *));\nstruct in6_ifaddr *in6ifa_ifpforlinklocal __P((struct ifnet *, int));\nstruct in6_ifaddr *in6ifa_ifpwithaddr __P((struct ifnet *, struct in6_addr *));\nchar\t*ip6_sprintf __P((char *, const struct in6_addr *));\nint\tin6_addr2zoneid __P((struct ifnet *, struct in6_addr *, u_int32_t *));\nint\tin6_matchlen __P((struct in6_addr *, struct in6_addr *));\nint\tin6_are_prefix_equal __P((struct in6_addr *, struct in6_addr *, int));\nvoid\tin6_prefixlen2mask __P((struct in6_addr *, int));\nint\tin6_prefix_ioctl __P((struct socket *, u_long, caddr_t,\n\tstruct ifnet *));\nint\tin6_prefix_add_ifid __P((int, struct in6_ifaddr *));\nvoid\tin6_prefix_remove_ifid __P((int, struct in6_ifaddr *));\nvoid\tin6_purgeprefix __P((struct ifnet *));\nvoid\tin6_ifremloop(struct ifaddr *);\nvoid\tin6_ifaddloop(struct ifaddr *);\n\nint\tin6_is_addr_deprecated __P((struct sockaddr_in6 *));\nstruct inpcb;\nint in6_src_ioctl __P((u_long, caddr_t));\n#endif /* _KERNEL */\n\n#endif /* _NETINET6_IN6_VAR_H_ */\n"
  },
  {
    "path": "freebsd-headers/netinet6/ip6.h",
    "content": "/*\t$FreeBSD: release/9.0.0/sys/netinet6/ip6.h 62587 2000-07-04 16:35:15Z itojun $\t*/\n/*\t$KAME: ip6.h,v 1.7 2000/03/25 07:23:36 sumikawa Exp $\t*/\n\n#error \"netinet6/ip6.h is obsolete.  use netinet/ip6.h\"\n"
  },
  {
    "path": "freebsd-headers/netinet6/ip6_ecn.h",
    "content": "/*-\n * Copyright (C) 1999 WIDE Project.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. Neither the name of the project nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t$KAME: ip_ecn.h,v 1.5 2000/03/27 04:58:38 sumikawa Exp $\n * $FreeBSD: release/9.0.0/sys/netinet6/ip6_ecn.h 174510 2007-12-10 16:03:40Z obrien $\n */\n\n/*\n * ECN consideration on tunnel ingress/egress operation.\n * http://www.aciri.org/floyd/papers/draft-ipsec-ecn-00.txt\n */\n\n#ifdef _KERNEL\nextern void ip6_ecn_ingress(int, u_int32_t *, const u_int32_t *);\nextern int ip6_ecn_egress(int, const u_int32_t *, u_int32_t *);\n#endif\n"
  },
  {
    "path": "freebsd-headers/netinet6/ip6_ipsec.h",
    "content": "/*-\n * Copyright (c) 1982, 1986, 1988, 1993\n *      The Regents of the University of California.  All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 4. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/netinet6/ip6_ipsec.h 177166 2008-03-14 11:44:30Z bz $\n */\n\n#ifndef _NETINET_IP6_IPSEC_H_\n#define _NETINET_IP6_IPSEC_H_\n\nint\tip6_ipsec_filtertunnel(struct mbuf *);\nint\tip6_ipsec_fwd(struct mbuf *);\nint\tip6_ipsec_input(struct mbuf *, int);\nint\tip6_ipsec_output(struct mbuf **, struct inpcb *, int *, int *,\n\t    struct ifnet **, struct secpolicy **sp);\n#if 0\nint\tip6_ipsec_mtu(struct mbuf *);\n#endif\n#endif\n"
  },
  {
    "path": "freebsd-headers/netinet6/ip6_mroute.h",
    "content": "/*-\n * Copyright (C) 1998 WIDE Project.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. Neither the name of the project nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t$KAME: ip6_mroute.h,v 1.19 2001/06/14 06:12:55 suz Exp $\n * $FreeBSD: release/9.0.0/sys/netinet6/ip6_mroute.h 194581 2009-06-21 10:29:31Z rdivacky $\n */\n\n/*\tBSDI ip_mroute.h,v 2.5 1996/10/11 16:01:48 pjd Exp\t*/\n\n/*\n * Definitions for IP multicast forwarding.\n *\n * Written by David Waitzman, BBN Labs, August 1988.\n * Modified by Steve Deering, Stanford, February 1989.\n * Modified by Ajit Thyagarajan, PARC, August 1993.\n * Modified by Ajit Thyagarajan, PARC, August 1994.\n * Modified by Ahmed Helmy, USC, September 1996.\n *\n * MROUTING Revision: 1.2\n */\n\n#ifndef _NETINET6_IP6_MROUTE_H_\n#define _NETINET6_IP6_MROUTE_H_\n\n/*\n * Multicast Routing set/getsockopt commands.\n */\n#ifdef _KERNEL\n#define MRT6_OINIT\t\t100\t/* initialize forwarder (omrt6msg) */\n#endif\n#define MRT6_DONE\t\t101\t/* shut down forwarder */\n#define MRT6_ADD_MIF\t\t102\t/* add multicast interface */\n#define MRT6_DEL_MIF\t\t103\t/* delete multicast interface */\n#define MRT6_ADD_MFC\t\t104\t/* insert forwarding cache entry */\n#define MRT6_DEL_MFC\t\t105\t/* delete forwarding cache entry */\n#define MRT6_PIM                107     /* enable pim code */\n#define MRT6_INIT\t\t108\t/* initialize forwarder (mrt6msg) */\n\n#if BSD >= 199103\n#define GET_TIME(t)\tmicrotime(&t)\n#elif defined(sun)\n#define GET_TIME(t)\tuniqtime(&t)\n#else\n#define GET_TIME(t)\t((t) = time)\n#endif\n\n/*\n * Types and macros for handling bitmaps with one bit per multicast interface.\n */\ntypedef u_short mifi_t;\t\t/* type of a mif index */\n#define MAXMIFS\t\t64\n\n#ifndef\tIF_SETSIZE\n#define\tIF_SETSIZE\t256\n#endif\n\ntypedef\tu_int32_t\tif_mask;\n#define\tNIFBITS\t(sizeof(if_mask) * NBBY)\t/* bits per mask */\n\n#ifndef howmany\n#define\thowmany(x, y)\t(((x) + ((y) - 1)) / (y))\n#endif\n\ntypedef\tstruct if_set {\n\tif_mask\tifs_bits[howmany(IF_SETSIZE, NIFBITS)];\n} if_set;\n\n#define\tIF_SET(n, p)\t((p)->ifs_bits[(n)/NIFBITS] |= (1 << ((n) % NIFBITS)))\n#define\tIF_CLR(n, p)\t((p)->ifs_bits[(n)/NIFBITS] &= ~(1 << ((n) % NIFBITS)))\n#define\tIF_ISSET(n, p)\t((p)->ifs_bits[(n)/NIFBITS] & (1 << ((n) % NIFBITS)))\n#define\tIF_COPY(f, t)\tbcopy(f, t, sizeof(*(f)))\n#define\tIF_ZERO(p)\tbzero(p, sizeof(*(p)))\n\n/*\n * Argument structure for MRT6_ADD_IF.\n */\nstruct mif6ctl {\n\tmifi_t\t    mif6c_mifi;\t\t/* the index of the mif to be added  */\n\tu_char\t    mif6c_flags;\t/* MIFF_ flags defined below         */\n\tu_short\t    mif6c_pifi;\t\t/* the index of the physical IF */\n};\n\n#define\tMIFF_REGISTER\t0x1\t/* mif represents a register end-point */\n\n/*\n * Argument structure for MRT6_ADD_MFC and MRT6_DEL_MFC\n */\nstruct mf6cctl {\n\tstruct sockaddr_in6 mf6cc_origin;\t/* IPv6 origin of mcasts */\n\tstruct sockaddr_in6 mf6cc_mcastgrp; /* multicast group associated */\n\tmifi_t\t\tmf6cc_parent;\t/* incoming ifindex */\n\tstruct if_set\tmf6cc_ifset;\t/* set of forwarding ifs */\n};\n\n/*\n * The kernel's multicast routing statistics.\n */\nstruct mrt6stat {\n\tu_quad_t mrt6s_mfc_lookups;\t/* # forw. cache hash table hits   */\n\tu_quad_t mrt6s_mfc_misses;\t/* # forw. cache hash table misses */\n\tu_quad_t mrt6s_upcalls;\t\t/* # calls to multicast routing daemon */\n\tu_quad_t mrt6s_no_route;\t/* no route for packet's origin    */\n\tu_quad_t mrt6s_bad_tunnel;\t/* malformed tunnel options        */\n\tu_quad_t mrt6s_cant_tunnel;\t/* no room for tunnel options      */\n\tu_quad_t mrt6s_wrong_if;\t/* arrived on wrong interface\t   */\n\tu_quad_t mrt6s_upq_ovflw;\t/* upcall Q overflow\t\t   */\n\tu_quad_t mrt6s_cache_cleanups;\t/* # entries with no upcalls\t   */\n\tu_quad_t mrt6s_drop_sel;\t/* pkts dropped selectively        */\n\tu_quad_t mrt6s_q_overflow;\t/* pkts dropped - Q overflow       */\n\tu_quad_t mrt6s_pkt2large;\t/* pkts dropped - size > BKT SIZE  */\n\tu_quad_t mrt6s_upq_sockfull;\t/* upcalls dropped - socket full   */\n};\n\n#ifdef MRT6_OINIT\n/*\n * Struct used to communicate from kernel to multicast router\n * note the convenient similarity to an IPv6 header.\n * XXX old version, superseded by mrt6msg.\n */\nstruct omrt6msg {\n\tu_long\t    unused1;\n\tu_char\t    im6_msgtype;\t\t/* what type of message\t    */\n#if 0\n#define MRT6MSG_NOCACHE\t1\n#define MRT6MSG_WRONGMIF\t2\n#define MRT6MSG_WHOLEPKT\t3\t\t/* used for user level encap*/\n#endif\n\tu_char\t    im6_mbz;\t\t\t/* must be zero\t\t    */\n\tu_char\t    im6_mif;\t\t\t/* mif rec'd on\t\t    */\n\tu_char\t    unused2;\n\tstruct in6_addr  im6_src, im6_dst;\n};\n#endif\n\n/*\n * Structure used to communicate from kernel to multicast router.\n * We'll overlay the structure onto an MLD header (not an IPv6 header\n * like igmpmsg{} used for IPv4 implementation). This is because this\n * structure will be passed via an IPv6 raw socket, on which an application\n * will only receive the payload i.e. the data after the IPv6 header and all\n * the extension headers. (see Section 3 of RFC3542)\n */\nstruct mrt6msg {\n#define MRT6MSG_NOCACHE\t\t1\n#define MRT6MSG_WRONGMIF\t2\n#define MRT6MSG_WHOLEPKT\t3\t\t/* used for user level encap*/\n\tu_char\t    im6_mbz;\t\t\t/* must be zero\t\t    */\n\tu_char\t    im6_msgtype;\t\t/* what type of message\t    */\n\tu_int16_t   im6_mif;\t\t\t/* mif rec'd on\t\t    */\n\tu_int32_t   im6_pad;\t\t\t/* padding for 64bit arch   */\n\tstruct in6_addr  im6_src, im6_dst;\n};\n\n/*\n * Argument structure used by multicast routing daemon to get src-grp\n * packet counts\n */\nstruct sioc_sg_req6 {\n\tstruct sockaddr_in6 src;\n\tstruct sockaddr_in6 grp;\n\tu_quad_t pktcnt;\n\tu_quad_t bytecnt;\n\tu_quad_t wrong_if;\n};\n\n/*\n * Argument structure used by mrouted to get mif pkt counts\n */\nstruct sioc_mif_req6 {\n\tmifi_t mifi;\t\t/* mif number\t\t\t\t*/\n\tu_quad_t icount;\t/* Input packet count on mif\t\t*/\n\tu_quad_t ocount;\t/* Output packet count on mif\t\t*/\n\tu_quad_t ibytes;\t/* Input byte count on mif\t\t*/\n\tu_quad_t obytes;\t/* Output byte count on mif\t\t*/\n};\n\n#if defined(_KERNEL) || defined(KERNEL)\n/*\n * The kernel's multicast-interface structure.\n */\nstruct mif6 {\n        u_char\t\tm6_flags;\t/* MIFF_ flags defined above         */\n\tu_int\t\tm6_rate_limit;\t/* max rate\t\t\t     */\n\tstruct in6_addr\tm6_lcl_addr;\t/* local interface address           */\n\tstruct ifnet    *m6_ifp;\t/* pointer to interface              */\n\tu_quad_t\tm6_pkt_in;\t/* # pkts in on interface            */\n\tu_quad_t\tm6_pkt_out;\t/* # pkts out on interface           */\n\tu_quad_t\tm6_bytes_in;\t/* # bytes in on interface\t     */\n\tu_quad_t\tm6_bytes_out;\t/* # bytes out on interface\t     */\n\tstruct route_in6 m6_route;\t/* cached route */\n#ifdef notyet\n\tu_int\t\tm6_rsvp_on;\t/* RSVP listening on this vif */\n\tstruct socket   *m6_rsvpd;\t/* RSVP daemon socket */\n#endif\n};\n\n/*\n * The kernel's multicast forwarding cache entry structure\n */\nstruct mf6c {\n\tstruct sockaddr_in6  mf6c_origin;\t/* IPv6 origin of mcasts     */\n\tstruct sockaddr_in6  mf6c_mcastgrp;\t/* multicast group associated*/\n\tmifi_t\t\t mf6c_parent;\t\t/* incoming IF               */\n\tstruct if_set\t mf6c_ifset;\t\t/* set of outgoing IFs */\n\n\tu_quad_t\tmf6c_pkt_cnt;\t\t/* pkt count for src-grp     */\n\tu_quad_t\tmf6c_byte_cnt;\t\t/* byte count for src-grp    */\n\tu_quad_t\tmf6c_wrong_if;\t\t/* wrong if for src-grp\t     */\n\tint\t\tmf6c_expire;\t\t/* time to clean entry up    */\n\tstruct timeval  mf6c_last_assert;\t/* last time I sent an assert*/\n\tstruct rtdetq  *mf6c_stall;\t\t/* pkts waiting for route */\n\tstruct mf6c    *mf6c_next;\t\t/* hash table linkage */\n};\n\n#define MF6C_INCOMPLETE_PARENT ((mifi_t)-1)\n\n/*\n * Argument structure used for pkt info. while upcall is made\n */\n#ifndef _NETINET_IP_MROUTE_H_\nstruct rtdetq {\t\t/* XXX: rtdetq is also defined in ip_mroute.h */\n    struct mbuf\t\t*m;\t\t/* A copy of the packet\t\t    */\n    struct ifnet\t*ifp;\t\t/* Interface pkt came in on\t    */\n#ifdef UPCALL_TIMING\n    struct timeval\tt;\t\t/* Timestamp */\n#endif /* UPCALL_TIMING */\n    struct rtdetq\t*next;\n};\n#endif /* _NETINET_IP_MROUTE_H_ */\n\n#define MF6CTBLSIZ\t256\n#if (MF6CTBLSIZ & (MF6CTBLSIZ - 1)) == 0\t  /* from sys:route.h */\n#define MF6CHASHMOD(h)\t((h) & (MF6CTBLSIZ - 1))\n#else\n#define MF6CHASHMOD(h)\t((h) % MF6CTBLSIZ)\n#endif\n\n#define MAX_UPQ6\t4\t\t/* max. no of pkts in upcall Q */\n\nextern int\t(*ip6_mrouter_set)(struct socket *so, struct sockopt *sopt);\nextern int\t(*ip6_mrouter_get)(struct socket *so, struct sockopt *sopt);\nextern int\t(*ip6_mrouter_done)(void);\nextern int\t(*mrt6_ioctl)(u_long, caddr_t);\n#endif /* _KERNEL */\n\n#endif /* !_NETINET6_IP6_MROUTE_H_ */\n"
  },
  {
    "path": "freebsd-headers/netinet6/ip6_var.h",
    "content": "/*-\n * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. Neither the name of the project nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t$KAME: ip6_var.h,v 1.62 2001/05/03 14:51:48 itojun Exp $\n */\n\n/*-\n * Copyright (c) 1982, 1986, 1993\n *\tThe Regents of the University of California.  All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 4. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t@(#)ip_var.h\t8.1 (Berkeley) 6/10/93\n * $FreeBSD: release/9.0.0/sys/netinet6/ip6_var.h 225521 2011-09-13 00:06:11Z hrs $\n */\n\n#ifndef _NETINET6_IP6_VAR_H_\n#define _NETINET6_IP6_VAR_H_\n\n/*\n * IP6 reassembly queue structure.  Each fragment\n * being reassembled is attached to one of these structures.\n */\nstruct\tip6q {\n\tstruct ip6asfrag *ip6q_down;\n\tstruct ip6asfrag *ip6q_up;\n\tu_int32_t\tip6q_ident;\n\tu_int8_t\tip6q_nxt;\n\tu_int8_t\tip6q_ecn;\n\tu_int8_t\tip6q_ttl;\n\tstruct in6_addr ip6q_src, ip6q_dst;\n\tstruct ip6q\t*ip6q_next;\n\tstruct ip6q\t*ip6q_prev;\n\tint\t\tip6q_unfrglen;\t/* len of unfragmentable part */\n#ifdef notyet\n\tu_char\t\t*ip6q_nxtp;\n#endif\n\tint\t\tip6q_nfrag;\t/* # of fragments */\n\tstruct label\t*ip6q_label;\n};\n\nstruct\tip6asfrag {\n\tstruct ip6asfrag *ip6af_down;\n\tstruct ip6asfrag *ip6af_up;\n\tstruct mbuf\t*ip6af_m;\n\tint\t\tip6af_offset;\t/* offset in ip6af_m to next header */\n\tint\t\tip6af_frglen;\t/* fragmentable part length */\n\tint\t\tip6af_off;\t/* fragment offset */\n\tu_int16_t\tip6af_mff;\t/* more fragment bit in frag off */\n};\n\n#define IP6_REASS_MBUF(ip6af) (*(struct mbuf **)&((ip6af)->ip6af_m))\n\n/*\n * Structure attached to inpcb.in6p_moptions and\n * passed to ip6_output when IPv6 multicast options are in use.\n * This structure is lazy-allocated.\n */\nstruct ip6_moptions {\n\tstruct\tifnet *im6o_multicast_ifp; /* ifp for outgoing multicasts */\n\tu_char\tim6o_multicast_hlim;\t/* hoplimit for outgoing multicasts */\n\tu_char\tim6o_multicast_loop;\t/* 1 >= hear sends if a member */\n\tu_short\tim6o_num_memberships;\t/* no. memberships this socket */\n\tu_short\tim6o_max_memberships;\t/* max memberships this socket */\n\tstruct\tin6_multi **im6o_membership;\t/* group memberships */\n\tstruct\tin6_mfilter *im6o_mfilters;\t/* source filters */\n};\n\n/*\n * Control options for outgoing packets\n */\n\n/* Routing header related info */\nstruct\tip6po_rhinfo {\n\tstruct\tip6_rthdr *ip6po_rhi_rthdr; /* Routing header */\n\tstruct\troute_in6 ip6po_rhi_route; /* Route to the 1st hop */\n};\n#define ip6po_rthdr\tip6po_rhinfo.ip6po_rhi_rthdr\n#define ip6po_route\tip6po_rhinfo.ip6po_rhi_route\n\n/* Nexthop related info */\nstruct\tip6po_nhinfo {\n\tstruct\tsockaddr *ip6po_nhi_nexthop;\n\tstruct\troute_in6 ip6po_nhi_route; /* Route to the nexthop */\n};\n#define ip6po_nexthop\tip6po_nhinfo.ip6po_nhi_nexthop\n#define ip6po_nextroute\tip6po_nhinfo.ip6po_nhi_route\n\nstruct\tip6_pktopts {\n\tstruct\tmbuf *ip6po_m;\t/* Pointer to mbuf storing the data */\n\tint\tip6po_hlim;\t/* Hoplimit for outgoing packets */\n\n\t/* Outgoing IF/address information */\n\tstruct\tin6_pktinfo *ip6po_pktinfo;\n\n\t/* Next-hop address information */\n\tstruct\tip6po_nhinfo ip6po_nhinfo;\n\n\tstruct\tip6_hbh *ip6po_hbh; /* Hop-by-Hop options header */\n\n\t/* Destination options header (before a routing header) */\n\tstruct\tip6_dest *ip6po_dest1;\n\n\t/* Routing header related info. */\n\tstruct\tip6po_rhinfo ip6po_rhinfo;\n\n\t/* Destination options header (after a routing header) */\n\tstruct\tip6_dest *ip6po_dest2;\n\n\tint\tip6po_tclass;\t/* traffic class */\n\n\tint\tip6po_minmtu;  /* fragment vs PMTU discovery policy */\n#define IP6PO_MINMTU_MCASTONLY\t-1 /* default; send at min MTU for multicast*/\n#define IP6PO_MINMTU_DISABLE\t 0 /* always perform pmtu disc */\n#define IP6PO_MINMTU_ALL\t 1 /* always send at min MTU */\n\n\tint\tip6po_prefer_tempaddr;  /* whether temporary addresses are\n\t\t\t\t\t   preferred as source address */\n#define IP6PO_TEMPADDR_SYSTEM\t-1 /* follow the system default */\n#define IP6PO_TEMPADDR_NOTPREFER 0 /* not prefer temporary address */\n#define IP6PO_TEMPADDR_PREFER\t 1 /* prefer temporary address */\n\n\tint ip6po_flags;\n#if 0\t/* parameters in this block is obsolete. do not reuse the values. */\n#define IP6PO_REACHCONF\t0x01\t/* upper-layer reachability confirmation. */\n#define IP6PO_MINMTU\t0x02\t/* use minimum MTU (IPV6_USE_MIN_MTU) */\n#endif\n#define IP6PO_DONTFRAG\t0x04\t/* disable fragmentation (IPV6_DONTFRAG) */\n#define IP6PO_USECOA\t0x08\t/* use care of address */\n};\n\n/*\n * Control options for incoming packets\n */\n\nstruct\tip6stat {\n\tu_quad_t ip6s_total;\t\t/* total packets received */\n\tu_quad_t ip6s_tooshort;\t\t/* packet too short */\n\tu_quad_t ip6s_toosmall;\t\t/* not enough data */\n\tu_quad_t ip6s_fragments;\t/* fragments received */\n\tu_quad_t ip6s_fragdropped;\t/* frags dropped(dups, out of space) */\n\tu_quad_t ip6s_fragtimeout;\t/* fragments timed out */\n\tu_quad_t ip6s_fragoverflow;\t/* fragments that exceeded limit */\n\tu_quad_t ip6s_forward;\t\t/* packets forwarded */\n\tu_quad_t ip6s_cantforward;\t/* packets rcvd for unreachable dest */\n\tu_quad_t ip6s_redirectsent;\t/* packets forwarded on same net */\n\tu_quad_t ip6s_delivered;\t/* datagrams delivered to upper level*/\n\tu_quad_t ip6s_localout;\t\t/* total ip packets generated here */\n\tu_quad_t ip6s_odropped;\t\t/* lost packets due to nobufs, etc. */\n\tu_quad_t ip6s_reassembled;\t/* total packets reassembled ok */\n\tu_quad_t ip6s_fragmented;\t/* datagrams successfully fragmented */\n\tu_quad_t ip6s_ofragments;\t/* output fragments created */\n\tu_quad_t ip6s_cantfrag;\t\t/* don't fragment flag was set, etc. */\n\tu_quad_t ip6s_badoptions;\t/* error in option processing */\n\tu_quad_t ip6s_noroute;\t\t/* packets discarded due to no route */\n\tu_quad_t ip6s_badvers;\t\t/* ip6 version != 6 */\n\tu_quad_t ip6s_rawout;\t\t/* total raw ip packets generated */\n\tu_quad_t ip6s_badscope;\t\t/* scope error */\n\tu_quad_t ip6s_notmember;\t/* don't join this multicast group */\n\tu_quad_t ip6s_nxthist[256];\t/* next header history */\n\tu_quad_t ip6s_m1;\t\t/* one mbuf */\n\tu_quad_t ip6s_m2m[32];\t\t/* two or more mbuf */\n\tu_quad_t ip6s_mext1;\t\t/* one ext mbuf */\n\tu_quad_t ip6s_mext2m;\t\t/* two or more ext mbuf */\n\tu_quad_t ip6s_exthdrtoolong;\t/* ext hdr are not contiguous */\n\tu_quad_t ip6s_nogif;\t\t/* no match gif found */\n\tu_quad_t ip6s_toomanyhdr;\t/* discarded due to too many headers */\n\n\t/*\n\t * statistics for improvement of the source address selection\n\t * algorithm:\n\t * XXX: hardcoded 16 = # of ip6 multicast scope types + 1\n\t */\n\t/* number of times that address selection fails */\n\tu_quad_t ip6s_sources_none;\n\t/* number of times that an address on the outgoing I/F is chosen */\n\tu_quad_t ip6s_sources_sameif[16];\n\t/* number of times that an address on a non-outgoing I/F is chosen */\n\tu_quad_t ip6s_sources_otherif[16];\n\t/*\n\t * number of times that an address that has the same scope\n\t * from the destination is chosen.\n\t */\n\tu_quad_t ip6s_sources_samescope[16];\n\t/*\n\t * number of times that an address that has a different scope\n\t * from the destination is chosen.\n\t */\n\tu_quad_t ip6s_sources_otherscope[16];\n\t/* number of times that a deprecated address is chosen */\n\tu_quad_t ip6s_sources_deprecated[16];\n\n\t/* number of times that each rule of source selection is applied. */\n\tu_quad_t ip6s_sources_rule[16];\n};\n\n#ifdef _KERNEL\n#define\tIP6STAT_ADD(name, val)\tV_ip6stat.name += (val)\n#define\tIP6STAT_SUB(name, val)\tV_ip6stat.name -= (val)\n#define\tIP6STAT_INC(name)\tIP6STAT_ADD(name, 1)\n#define\tIP6STAT_DEC(name)\tIP6STAT_SUB(name, 1)\n#endif\n\n#ifdef _KERNEL\n/*\n * IPv6 onion peeling state.\n * it will be initialized when we come into ip6_input().\n * XXX do not make it a kitchen sink!\n */\nstruct ip6aux {\n\tu_int32_t ip6a_flags;\n#define IP6A_SWAP\t0x01\t\t/* swapped home/care-of on packet */\n#define IP6A_HASEEN\t0x02\t\t/* HA was present */\n#define IP6A_BRUID\t0x04\t\t/* BR Unique Identifier was present */\n#define IP6A_RTALERTSEEN 0x08\t\t/* rtalert present */\n\n\t/* ip6.ip6_src */\n\tstruct in6_addr ip6a_careof;\t/* care-of address of the peer */\n\tstruct in6_addr ip6a_home;\t/* home address of the peer */\n\tu_int16_t\tip6a_bruid;\t/* BR unique identifier */\n\n\t/* ip6.ip6_dst */\n\tstruct in6_ifaddr *ip6a_dstia6;\t/* my ifaddr that matches ip6_dst */\n\n\t/* rtalert */\n\tu_int16_t ip6a_rtalert;\t\t/* rtalert option value */\n\n\t/*\n\t * decapsulation history will be here.\n\t * with IPsec it may not be accurate.\n\t */\n};\n#endif\n\n#ifdef _KERNEL\n/* flags passed to ip6_output as last parameter */\n#define\tIPV6_UNSPECSRC\t\t0x01\t/* allow :: as the source address */\n#define\tIPV6_FORWARDING\t\t0x02\t/* most of IPv6 header exists */\n#define\tIPV6_MINMTU\t\t0x04\t/* use minimum MTU (IPV6_USE_MIN_MTU) */\n\n#ifdef __NO_STRICT_ALIGNMENT\n#define IP6_HDR_ALIGNED_P(ip)\t1\n#else\n#define IP6_HDR_ALIGNED_P(ip)\t((((intptr_t) (ip)) & 3) == 0)\n#endif\n\nVNET_DECLARE(struct ip6stat, ip6stat);\t/* statistics */\nVNET_DECLARE(int, ip6_defhlim);\t\t/* default hop limit */\nVNET_DECLARE(int, ip6_defmcasthlim);\t/* default multicast hop limit */\nVNET_DECLARE(int, ip6_forwarding);\t/* act as router? */\nVNET_DECLARE(int, ip6_use_deprecated);\t/* allow deprecated addr as source */\nVNET_DECLARE(int, ip6_rr_prune);\t/* router renumbering prefix\n\t\t\t\t\t * walk list every 5 sec.    */\nVNET_DECLARE(int, ip6_mcast_pmtu);\t/* enable pMTU discovery for multicast? */\nVNET_DECLARE(int, ip6_v6only);\n#define\tV_ip6stat\t\t\tVNET(ip6stat)\n#define\tV_ip6_defhlim\t\t\tVNET(ip6_defhlim)\n#define\tV_ip6_defmcasthlim\t\tVNET(ip6_defmcasthlim)\n#define\tV_ip6_forwarding\t\tVNET(ip6_forwarding)\n#define\tV_ip6_use_deprecated\t\tVNET(ip6_use_deprecated)\n#define\tV_ip6_rr_prune\t\t\tVNET(ip6_rr_prune)\n#define\tV_ip6_mcast_pmtu\t\tVNET(ip6_mcast_pmtu)\n#define\tV_ip6_v6only\t\t\tVNET(ip6_v6only)\n\nVNET_DECLARE(struct socket *, ip6_mrouter);\t/* multicast routing daemon */\nVNET_DECLARE(int, ip6_sendredirects);\t/* send IP redirects when forwarding? */\nVNET_DECLARE(int, ip6_maxfragpackets);\t/* Maximum packets in reassembly\n\t\t\t\t\t * queue */\nVNET_DECLARE(int, ip6_maxfrags);\t/* Maximum fragments in reassembly\n\t\t\t\t\t * queue */\nVNET_DECLARE(int, ip6_accept_rtadv);\t/* Acts as a host not a router */\nVNET_DECLARE(int, ip6_no_radr);\t\t/* No defroute from RA */\nVNET_DECLARE(int, ip6_norbit_raif);\t/* Disable R-bit in NA on RA\n\t\t\t\t\t * receiving IF. */\nVNET_DECLARE(int, ip6_rfc6204w3);\t/* Accept defroute from RA even when\n\t\t\t\t\t   forwarding enabled */\nVNET_DECLARE(int, ip6_keepfaith);\t/* Firewall Aided Internet Translator */\nVNET_DECLARE(int, ip6_log_interval);\nVNET_DECLARE(time_t, ip6_log_time);\nVNET_DECLARE(int, ip6_hdrnestlimit);\t/* upper limit of # of extension\n\t\t\t\t\t * headers */\nVNET_DECLARE(int, ip6_dad_count);\t/* DupAddrDetectionTransmits */\n#define\tV_ip6_mrouter\t\t\tVNET(ip6_mrouter)\n#define\tV_ip6_sendredirects\t\tVNET(ip6_sendredirects)\n#define\tV_ip6_maxfragpackets\t\tVNET(ip6_maxfragpackets)\n#define\tV_ip6_maxfrags\t\t\tVNET(ip6_maxfrags)\n#define\tV_ip6_accept_rtadv\t\tVNET(ip6_accept_rtadv)\n#define\tV_ip6_no_radr\t\t\tVNET(ip6_no_radr)\n#define\tV_ip6_norbit_raif\t\tVNET(ip6_norbit_raif)\n#define\tV_ip6_rfc6204w3\t\t\tVNET(ip6_rfc6204w3)\n#define\tV_ip6_keepfaith\t\t\tVNET(ip6_keepfaith)\n#define\tV_ip6_log_interval\t\tVNET(ip6_log_interval)\n#define\tV_ip6_log_time\t\t\tVNET(ip6_log_time)\n#define\tV_ip6_hdrnestlimit\t\tVNET(ip6_hdrnestlimit)\n#define\tV_ip6_dad_count\t\t\tVNET(ip6_dad_count)\n\nVNET_DECLARE(int, ip6_auto_flowlabel);\nVNET_DECLARE(int, ip6_auto_linklocal);\n#define\tV_ip6_auto_flowlabel\t\tVNET(ip6_auto_flowlabel)\n#define\tV_ip6_auto_linklocal\t\tVNET(ip6_auto_linklocal)\n\nVNET_DECLARE(int, ip6_use_tempaddr);\t/* Whether to use temporary addresses */\nVNET_DECLARE(int, ip6_prefer_tempaddr);\t/* Whether to prefer temporary\n\t\t\t\t\t * addresses in the source address\n\t\t\t\t\t * selection */\n#define\tV_ip6_use_tempaddr\t\tVNET(ip6_use_tempaddr)\n#define\tV_ip6_prefer_tempaddr\t\tVNET(ip6_prefer_tempaddr)\n\nVNET_DECLARE(int, ip6_use_defzone);\t/* Whether to use the default scope\n\t\t\t\t\t * zone when unspecified */\n#define\tV_ip6_use_defzone\t\tVNET(ip6_use_defzone)\n\nVNET_DECLARE (struct pfil_head, inet6_pfil_hook);\t/* packet filter hooks */\n#define\tV_inet6_pfil_hook\tVNET(inet6_pfil_hook)\n#ifdef IPSTEALTH\nVNET_DECLARE(int, ip6stealth);\n#define\tV_ip6stealth\t\t\tVNET(ip6stealth)\n#endif\n\nextern struct\tpr_usrreqs rip6_usrreqs;\nstruct sockopt;\n\nstruct inpcb;\n\nint\ticmp6_ctloutput __P((struct socket *, struct sockopt *sopt));\n\nstruct in6_ifaddr;\nvoid\tip6_init __P((void));\n#ifdef VIMAGE\nvoid\tip6_destroy __P((void));\n#endif\nint\tip6proto_register(short);\nint\tip6proto_unregister(short);\n\nvoid\tip6_input __P((struct mbuf *));\nstruct in6_ifaddr *ip6_getdstifaddr __P((struct mbuf *));\nvoid\tip6_freepcbopts __P((struct ip6_pktopts *));\n\nint\tip6_unknown_opt __P((u_int8_t *, struct mbuf *, int));\nchar *\tip6_get_prevhdr __P((struct mbuf *, int));\nint\tip6_nexthdr __P((struct mbuf *, int, int, int *));\nint\tip6_lasthdr __P((struct mbuf *, int, int, int *));\n\nstruct ip6aux *ip6_addaux __P((struct mbuf *));\nstruct ip6aux *ip6_findaux __P((struct mbuf *));\nvoid\tip6_delaux __P((struct mbuf *));\n\nextern int\t(*ip6_mforward)(struct ip6_hdr *, struct ifnet *,\n    struct mbuf *);\n\nint\tip6_process_hopopts __P((struct mbuf *, u_int8_t *, int, u_int32_t *,\n\t\t\t\t u_int32_t *));\nstruct mbuf\t**ip6_savecontrol_v4(struct inpcb *, struct mbuf *,\n\t    struct mbuf **, int *);\nvoid\tip6_savecontrol __P((struct inpcb *, struct mbuf *, struct mbuf **));\nvoid\tip6_notify_pmtu __P((struct inpcb *, struct sockaddr_in6 *,\n\t\t\t     u_int32_t *));\nint\tip6_sysctl __P((int *, u_int, void *, size_t *, void *, size_t));\n\nvoid\tip6_forward __P((struct mbuf *, int));\n\nvoid\tip6_mloopback __P((struct ifnet *, struct mbuf *, struct sockaddr_in6 *));\nint\tip6_output __P((struct mbuf *, struct ip6_pktopts *,\n\t\t\tstruct route_in6 *,\n\t\t\tint,\n\t\t\tstruct ip6_moptions *, struct ifnet **,\n\t\t\tstruct inpcb *));\nint\tip6_ctloutput __P((struct socket *, struct sockopt *));\nint\tip6_raw_ctloutput __P((struct socket *, struct sockopt *));\nvoid\tip6_initpktopts __P((struct ip6_pktopts *));\nint\tip6_setpktopts __P((struct mbuf *, struct ip6_pktopts *,\n\tstruct ip6_pktopts *, struct ucred *, int));\nvoid\tip6_clearpktopts __P((struct ip6_pktopts *, int));\nstruct ip6_pktopts *ip6_copypktopts __P((struct ip6_pktopts *, int));\nint\tip6_optlen __P((struct inpcb *));\n\nint\troute6_input __P((struct mbuf **, int *, int));\n\nvoid\tfrag6_init __P((void));\nint\tfrag6_input __P((struct mbuf **, int *, int));\nvoid\tfrag6_slowtimo __P((void));\nvoid\tfrag6_drain __P((void));\n\nvoid\trip6_init __P((void));\nint\trip6_input __P((struct mbuf **, int *, int));\nvoid\trip6_ctlinput __P((int, struct sockaddr *, void *));\nint\trip6_ctloutput __P((struct socket *, struct sockopt *));\nint\trip6_output __P((struct mbuf *, ...));\nint\trip6_usrreq __P((struct socket *,\n\t    int, struct mbuf *, struct mbuf *, struct mbuf *, struct thread *));\n\nint\tdest6_input __P((struct mbuf **, int *, int));\nint\tnone_input __P((struct mbuf **, int *, int));\n\nint\tin6_selectsrc(struct sockaddr_in6 *, struct ip6_pktopts *,\n\tstruct inpcb *inp, struct route_in6 *, struct ucred *cred,\n\tstruct ifnet **, struct in6_addr *);\nint in6_selectroute __P((struct sockaddr_in6 *, struct ip6_pktopts *,\n\tstruct ip6_moptions *, struct route_in6 *, struct ifnet **,\n\tstruct rtentry **));\nu_int32_t ip6_randomid __P((void));\nu_int32_t ip6_randomflowlabel __P((void));\n#endif /* _KERNEL */\n\n#endif /* !_NETINET6_IP6_VAR_H_ */\n"
  },
  {
    "path": "freebsd-headers/netinet6/ip6protosw.h",
    "content": "/*-\n * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. Neither the name of the project nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t$KAME: ip6protosw.h,v 1.25 2001/09/26 06:13:03 keiichi Exp $\n */\n\n/*-\n * Copyright (c) 1982, 1986, 1993\n *\tThe Regents of the University of California.  All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 4. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t@(#)protosw.h\t8.1 (Berkeley) 6/2/93\n *\tBSDI protosw.h,v 2.3 1996/10/11 16:02:40 pjd Exp\n * $FreeBSD: release/9.0.0/sys/netinet6/ip6protosw.h 193731 2009-06-08 17:15:40Z zec $\n */\n\n#ifndef _NETINET6_IP6PROTOSW_H_\n#define _NETINET6_IP6PROTOSW_H_\n\n/*\n * Protocol switch table for IPv6.\n * All other definitions should refer to sys/protosw.h\n */\n\nstruct mbuf;\nstruct sockaddr;\nstruct socket;\nstruct domain;\nstruct thread;\nstruct ip6_hdr;\nstruct icmp6_hdr;\nstruct in6_addr;\nstruct pr_usrreqs;\n\n/*\n * argument type for the last arg of pr_ctlinput().\n * should be consulted only with AF_INET6 family.\n *\n * IPv6 ICMP IPv6 [exthdrs] finalhdr payload\n * ^    ^    ^              ^\n * |    |    ip6c_ip6       ip6c_off\n * |    ip6c_icmp6\n * ip6c_m\n *\n * ip6c_finaldst usually points to ip6c_ip6->ip6_dst.  if the original\n * (internal) packet carries a routing header, it may point the final\n * dstination address in the routing header.\n *\n * ip6c_src: ip6c_ip6->ip6_src + scope info + flowlabel in ip6c_ip6\n *\t(beware of flowlabel, if you try to compare it against others)\n * ip6c_dst: ip6c_finaldst + scope info\n */\nstruct ip6ctlparam {\n\tstruct mbuf *ip6c_m;\t\t/* start of mbuf chain */\n\tstruct icmp6_hdr *ip6c_icmp6;\t/* icmp6 header of target packet */\n\tstruct ip6_hdr *ip6c_ip6;\t/* ip6 header of target packet */\n\tint ip6c_off;\t\t\t/* offset of the target proto header */\n\tstruct sockaddr_in6 *ip6c_src;\t/* srcaddr w/ additional info */\n\tstruct sockaddr_in6 *ip6c_dst;\t/* (final) dstaddr w/ additional info */\n\tstruct in6_addr *ip6c_finaldst;\t/* final destination address */\n\tvoid *ip6c_cmdarg;\t\t/* control command dependent data */\n\tu_int8_t ip6c_nxt;\t\t/* final next header field */\n};\n\nstruct ip6protosw {\n\tshort\tpr_type;\t\t/* socket type used for */\n\tstruct\tdomain *pr_domain;\t/* domain protocol a member of */\n\tshort\tpr_protocol;\t\t/* protocol number */\n\tshort\tpr_flags;\t\t/* see below */\n\n/* protocol-protocol hooks */\n\tint\t(*pr_input)\t\t/* input to protocol (from below) */\n\t\t\t__P((struct mbuf **, int *, int));\n\tint\t(*pr_output)\t\t/* output to protocol (from above) */\n\t\t\t__P((struct mbuf *, ...));\n\tvoid\t(*pr_ctlinput)\t\t/* control input (from below) */\n\t\t\t__P((int, struct sockaddr *, void *));\n\tint\t(*pr_ctloutput)\t\t/* control output (from above) */\n\t\t\t__P((struct socket *, struct sockopt *));\n\n/* utility hooks */\n\tvoid\t(*pr_init)\t\t/* initialization hook */\n\t\t\t__P((void));\n\tvoid\t(*pr_destroy)\t\t/* cleanup hook */\n\t\t\t__P((void));\n\n\tvoid\t(*pr_fasttimo)\t\t/* fast timeout (200ms) */\n\t\t\t__P((void));\n\tvoid\t(*pr_slowtimo)\t\t/* slow timeout (500ms) */\n\t\t\t__P((void));\n\tvoid\t(*pr_drain)\t\t/* flush any excess space possible */\n\t\t\t__P((void));\n\tstruct\tpr_usrreqs *pr_usrreqs;\t/* supersedes pr_usrreq() */\n};\n\n#ifdef _KERNEL\nextern struct ip6protosw inet6sw[];\n#endif\n\n#endif /* !_NETINET6_IP6PROTOSW_H_ */\n"
  },
  {
    "path": "freebsd-headers/netinet6/mld6.h",
    "content": "/*-\n * Copyright (c) 2009 Bruce Simpson.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. The name of the author may not be used to endorse or promote\n *    products derived from this software without specific prior written\n *    permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/netinet6/mld6.h 191666 2009-04-29 11:31:23Z bms $\n */\n\n#ifndef _NETINET6_MLD6_H_\n#define _NETINET6_MLD6_H_\n\n/*\n * Multicast Listener Discovery (MLD) definitions.\n */\n\n/* Minimum length of any MLD protocol message. */\n#define MLD_MINLEN\tsizeof(struct icmp6_hdr)\n\n/*\n * MLD v2 query format.\n * See <netinet/icmp6.h> for struct mld_hdr\n * (MLDv1 query and host report format).\n */\nstruct mldv2_query {\n\tstruct icmp6_hdr\tmld_icmp6_hdr;\t/* ICMPv6 header */\n\tstruct in6_addr\t\tmld_addr;\t/* address being queried */\n\tuint8_t\t\tmld_misc;\t/* reserved/suppress/robustness   */\n\tuint8_t\t\tmld_qqi;\t/* querier's query interval       */\n\tuint16_t\tmld_numsrc;\t/* number of sources              */\n\t/* followed by 1..numsrc source addresses */\n} __packed;\n#define MLD_V2_QUERY_MINLEN\t\tsizeof(struct mldv2_query)\n#define MLD_MRC_EXP(x)\t\t\t((ntohs((x)) >> 12) & 0x0007)\n#define MLD_MRC_MANT(x)\t\t\t(ntohs((x)) & 0x0fff)\n#define MLD_QQIC_EXP(x)\t\t\t(((x) >> 4) & 0x07)\n#define MLD_QQIC_MANT(x)\t\t((x) & 0x0f)\n#define MLD_QRESV(x)\t\t\t(((x) >> 4) & 0x0f)\n#define MLD_SFLAG(x)\t\t\t(((x) >> 3) & 0x01)\n#define MLD_QRV(x)\t\t\t((x) & 0x07)\n\n/*\n * MLDv2 host membership report header.\n * mld_type: MLDV2_LISTENER_REPORT\n */\nstruct mldv2_report {\n\tstruct icmp6_hdr\tmld_icmp6_hdr;\n\t/* followed by 1..numgrps records */\n} __packed;\n/* overlaid on struct icmp6_hdr. */\n#define mld_numrecs\tmld_icmp6_hdr.icmp6_data16[1]\n\nstruct mldv2_record {\n\tuint8_t\t\t\tmr_type;\t/* record type */\n\tuint8_t\t\t\tmr_datalen;\t/* length of auxiliary data */\n\tuint16_t\t\tmr_numsrc;\t/* number of sources */\n\tstruct in6_addr\t\tmr_addr;\t/* address being reported */\n\t/* followed by 1..numsrc source addresses */\n} __packed;\n#define MLD_V2_REPORT_MAXRECS\t\t65535\n\n/*\n * MLDv2 report modes.\n */\n#define MLD_DO_NOTHING\t\t\t0\t/* don't send a record */\n#define MLD_MODE_IS_INCLUDE\t\t1\t/* MODE_IN */\n#define MLD_MODE_IS_EXCLUDE\t\t2\t/* MODE_EX */\n#define MLD_CHANGE_TO_INCLUDE_MODE\t3\t/* TO_IN */\n#define MLD_CHANGE_TO_EXCLUDE_MODE\t4\t/* TO_EX */\n#define MLD_ALLOW_NEW_SOURCES\t\t5\t/* ALLOW_NEW */\n#define MLD_BLOCK_OLD_SOURCES\t\t6\t/* BLOCK_OLD */\n\n/*\n * MLDv2 query types.\n */\n#define MLD_V2_GENERAL_QUERY\t\t1\n#define MLD_V2_GROUP_QUERY\t\t2\n#define MLD_V2_GROUP_SOURCE_QUERY\t3\n\n/*\n * Maximum report interval for MLDv1 host membership reports.\n */\n#define MLD_V1_MAX_RI\t\t\t10\n\n/*\n * MLD_TIMER_SCALE denotes that the MLD code field specifies\n * time in milliseconds.\n */\n#define MLD_TIMER_SCALE\t\t\t1000\n\n#endif /* _NETINET6_MLD6_H_ */\n"
  },
  {
    "path": "freebsd-headers/netinet6/mld6_var.h",
    "content": "/*-\n * Copyright (c) 2009 Bruce Simpson.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. The name of the author may not be used to endorse or promote\n *    products derived from this software without specific prior written\n *    permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/netinet6/mld6_var.h 200871 2009-12-22 20:40:22Z bms $\n */\n#ifndef _NETINET6_MLD6_VAR_H_\n#define _NETINET6_MLD6_VAR_H_\n\n/*\n * Multicast Listener Discovery (MLD)\n * implementation-specific definitions.\n */\n\n#ifdef _KERNEL\n\n/*\n * Per-link MLD state.\n */\nstruct mld_ifinfo {\n\tLIST_ENTRY(mld_ifinfo) mli_link;\n\tstruct ifnet *mli_ifp;\t/* interface this instance belongs to */\n\tuint32_t mli_version;\t/* MLDv1 Host Compatibility Mode */\n\tuint32_t mli_v1_timer;\t/* MLDv1 Querier Present timer (s) */\n\tuint32_t mli_v2_timer;\t/* MLDv2 General Query (interface) timer (s)*/\n\tuint32_t mli_flags;\t/* MLD per-interface flags */\n\tuint32_t mli_rv;\t/* MLDv2 Robustness Variable */\n\tuint32_t mli_qi;\t/* MLDv2 Query Interval (s) */\n\tuint32_t mli_qri;\t/* MLDv2 Query Response Interval (s) */\n\tuint32_t mli_uri;\t/* MLDv2 Unsolicited Report Interval (s) */\n\tSLIST_HEAD(,in6_multi)\tmli_relinmhead; /* released groups */\n\tstruct ifqueue\t mli_gq;\t/* queue of general query responses */\n};\n#define MLIF_SILENT\t0x00000001\t/* Do not use MLD on this ifp */\n#define MLIF_USEALLOW\t0x00000002\t/* Use ALLOW/BLOCK for joins/leaves */\n\n#define MLD_RANDOM_DELAY(X)\t\t(arc4random() % (X) + 1)\n#define MLD_MAX_STATE_CHANGES\t\t24 /* Max pending changes per group */\n\n/*\n * MLD per-group states.\n */\n#define MLD_NOT_MEMBER\t\t\t0 /* Can garbage collect group */\n#define MLD_SILENT_MEMBER\t\t1 /* Do not perform MLD for group */\n#define MLD_REPORTING_MEMBER\t\t2 /* MLDv1 we are reporter */\n#define MLD_IDLE_MEMBER\t\t\t3 /* MLDv1 we reported last */\n#define MLD_LAZY_MEMBER\t\t\t4 /* MLDv1 other member reporting */\n#define MLD_SLEEPING_MEMBER\t\t5 /* MLDv1 start query response */\n#define MLD_AWAKENING_MEMBER\t\t6 /* MLDv1 group timer will start */\n#define MLD_G_QUERY_PENDING_MEMBER\t7 /* MLDv2 group query pending */\n#define MLD_SG_QUERY_PENDING_MEMBER\t8 /* MLDv2 source query pending */\n#define MLD_LEAVING_MEMBER\t\t9 /* MLDv2 dying gasp (pending last */\n\t\t\t\t\t  /* retransmission of INCLUDE {}) */\n\n/*\n * MLD version tag.\n */\n#define MLD_VERSION_NONE\t\t0 /* Invalid */\n#define MLD_VERSION_1\t\t\t1\n#define MLD_VERSION_2\t\t\t2 /* Default */\n\n/*\n * MLDv2 protocol control variables.\n */\n#define MLD_RV_INIT\t\t2\t/* Robustness Variable */\n#define MLD_RV_MIN\t\t1\n#define MLD_RV_MAX\t\t7\n\n#define MLD_QI_INIT\t\t125\t/* Query Interval (s) */\n#define MLD_QI_MIN\t\t1\n#define MLD_QI_MAX\t\t255\n\n#define MLD_QRI_INIT\t\t10\t/* Query Response Interval (s) */\n#define MLD_QRI_MIN\t\t1\n#define MLD_QRI_MAX\t\t255\n\n#define MLD_URI_INIT\t\t3\t/* Unsolicited Report Interval (s) */\n#define MLD_URI_MIN\t\t0\n#define MLD_URI_MAX\t\t10\n\n#define MLD_MAX_GS_SOURCES\t\t256 /* # of sources in rx GS query */\n#define MLD_MAX_G_GS_PACKETS\t\t8 /* # of packets to answer G/GS */\n#define MLD_MAX_STATE_CHANGE_PACKETS\t8 /* # of packets per state change */\n#define MLD_MAX_RESPONSE_PACKETS\t16 /* # of packets for general query */\n#define MLD_MAX_RESPONSE_BURST\t\t4 /* # of responses to send at once */\n#define MLD_RESPONSE_BURST_INTERVAL\t(PR_FASTHZ / 2)\t/* 500ms */\n\n/*\n * MLD-specific mbuf flags.\n */\n#define M_MLDV1\t\tM_PROTO1\t/* Packet is MLDv1 */\n#define M_GROUPREC\tM_PROTO3\t/* mbuf chain is a group record */\n\n/*\n * Leading space for MLDv2 reports inside MTU.\n *\n * NOTE: This differs from IGMPv3 significantly. KAME IPv6 requires\n * that a fully formed mbuf chain *without* the Router Alert option\n * is passed to ip6_output(), however we must account for it in the\n * MTU if we need to split an MLDv2 report into several packets.\n *\n * We now put the MLDv2 report header in the initial mbuf containing\n * the IPv6 header.\n */\n#define\tMLD_MTUSPACE\t(sizeof(struct ip6_hdr) + sizeof(struct mld_raopt) + \\\n\t\t\t sizeof(struct icmp6_hdr))\n\n/*\n * Subsystem lock macros.\n * The MLD lock is only taken with MLD. Currently it is system-wide.\n * VIMAGE: The lock could be pushed to per-VIMAGE granularity in future.\n */\n#define\tMLD_LOCK_INIT()\tmtx_init(&mld_mtx, \"mld_mtx\", NULL, MTX_DEF)\n#define\tMLD_LOCK_DESTROY()\tmtx_destroy(&mld_mtx)\n#define\tMLD_LOCK()\t\tmtx_lock(&mld_mtx)\n#define\tMLD_LOCK_ASSERT()\tmtx_assert(&mld_mtx, MA_OWNED)\n#define\tMLD_UNLOCK()\t\tmtx_unlock(&mld_mtx)\n#define\tMLD_UNLOCK_ASSERT()\tmtx_assert(&mld_mtx, MA_NOTOWNED)\n\n/*\n * Per-link MLD context.\n */\n#define MLD_IFINFO(ifp) \\\n\t(((struct in6_ifextra *)(ifp)->if_afdata[AF_INET6])->mld_ifinfo)\n\nint\tmld_change_state(struct in6_multi *, const int);\nstruct mld_ifinfo *\n\tmld_domifattach(struct ifnet *);\nvoid\tmld_domifdetach(struct ifnet *);\nvoid\tmld_fasttimo(void);\nvoid\tmld_ifdetach(struct ifnet *);\nint\tmld_input(struct mbuf *, int, int);\nvoid\tmld_slowtimo(void);\n\n#ifdef SYSCTL_DECL\nSYSCTL_DECL(_net_inet6_mld);\n#endif\n\n#endif /* _KERNEL */\n\n#endif /* _NETINET6_MLD6_VAR_H_ */\n"
  },
  {
    "path": "freebsd-headers/netinet6/nd6.h",
    "content": "/*-\n * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. Neither the name of the project nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t$KAME: nd6.h,v 1.76 2001/12/18 02:10:31 itojun Exp $\n * $FreeBSD: release/9.0.0/sys/netinet6/nd6.h 222728 2011-06-06 02:14:23Z hrs $\n */\n\n#ifndef _NETINET6_ND6_H_\n#define _NETINET6_ND6_H_\n\n/* see net/route.h, or net/if_inarp.h */\n#ifndef RTF_ANNOUNCE\n#define RTF_ANNOUNCE\tRTF_PROTO2\n#endif\n\n#include <sys/queue.h>\n#include <sys/callout.h>\n\nstruct llentry;\n\n#define ND6_LLINFO_NOSTATE\t-2\n/*\n * We don't need the WAITDELETE state any more, but we keep the definition\n * in a comment line instead of removing it. This is necessary to avoid\n * unintentionally reusing the value for another purpose, which might\n * affect backward compatibility with old applications.\n * (20000711 jinmei@kame.net)\n */\n/* #define ND6_LLINFO_WAITDELETE\t-1 */\n#define ND6_LLINFO_INCOMPLETE\t0\n#define ND6_LLINFO_REACHABLE\t1\n#define ND6_LLINFO_STALE\t2\n#define ND6_LLINFO_DELAY\t3\n#define ND6_LLINFO_PROBE\t4\n\n#define ND6_IS_LLINFO_PROBREACH(n) ((n)->ln_state > ND6_LLINFO_INCOMPLETE)\n#define ND6_LLINFO_PERMANENT(n) (((n)->la_expire == 0) && ((n)->ln_state > ND6_LLINFO_INCOMPLETE))\n\nstruct nd_ifinfo {\n\tu_int32_t linkmtu;\t\t/* LinkMTU */\n\tu_int32_t maxmtu;\t\t/* Upper bound of LinkMTU */\n\tu_int32_t basereachable;\t/* BaseReachableTime */\n\tu_int32_t reachable;\t\t/* Reachable Time */\n\tu_int32_t retrans;\t\t/* Retrans Timer */\n\tu_int32_t flags;\t\t/* Flags */\n\tint recalctm;\t\t\t/* BaseReacable re-calculation timer */\n\tu_int8_t chlim;\t\t\t/* CurHopLimit */\n\tu_int8_t initialized; /* Flag to see the entry is initialized */\n\t/* the following 3 members are for privacy extension for addrconf */\n\tu_int8_t randomseed0[8]; /* upper 64 bits of MD5 digest */\n\tu_int8_t randomseed1[8]; /* lower 64 bits (usually the EUI64 IFID) */\n\tu_int8_t randomid[8];\t/* current random ID */\n};\n\n#define ND6_IFF_PERFORMNUD\t0x1\n#define ND6_IFF_ACCEPT_RTADV\t0x2\n#define ND6_IFF_PREFER_SOURCE\t0x4 /* XXX: not related to ND. */\n#define ND6_IFF_IFDISABLED\t0x8 /* IPv6 operation is disabled due to\n\t\t\t\t     * DAD failure.  (XXX: not ND-specific)\n\t\t\t\t     */\n#define ND6_IFF_DONT_SET_IFROUTE\t0x10\n#define ND6_IFF_AUTO_LINKLOCAL\t0x20\n#define\tND6_IFF_NO_RADR\t\t0x40\n\n#define\tND6_CREATE\t\tLLE_CREATE\n#define\tND6_EXCLUSIVE\t\tLLE_EXCLUSIVE\n\n#ifdef _KERNEL\n#define ND_IFINFO(ifp) \\\n\t(((struct in6_ifextra *)(ifp)->if_afdata[AF_INET6])->nd_ifinfo)\n#define IN6_LINKMTU(ifp) \\\n\t((ND_IFINFO(ifp)->linkmtu && ND_IFINFO(ifp)->linkmtu < (ifp)->if_mtu) \\\n\t    ? ND_IFINFO(ifp)->linkmtu \\\n\t    : ((ND_IFINFO(ifp)->maxmtu && ND_IFINFO(ifp)->maxmtu < (ifp)->if_mtu) \\\n\t\t? ND_IFINFO(ifp)->maxmtu : (ifp)->if_mtu))\n#endif\n\nstruct in6_nbrinfo {\n\tchar ifname[IFNAMSIZ];\t/* if name, e.g. \"en0\" */\n\tstruct in6_addr addr;\t/* IPv6 address of the neighbor */\n\tlong\tasked;\t\t/* number of queries already sent for this addr */\n\tint\tisrouter;\t/* if it acts as a router */\n\tint\tstate;\t\t/* reachability state */\n\tint\texpire;\t\t/* lifetime for NDP state transition */\n};\n\n#define DRLSTSIZ 10\n#define PRLSTSIZ 10\nstruct\tin6_drlist {\n\tchar ifname[IFNAMSIZ];\n\tstruct {\n\t\tstruct\tin6_addr rtaddr;\n\t\tu_char\tflags;\n\t\tu_short\trtlifetime;\n\t\tu_long\texpire;\n\t\tu_short if_index;\n\t} defrouter[DRLSTSIZ];\n};\n\nstruct\tin6_defrouter {\n\tstruct\tsockaddr_in6 rtaddr;\n\tu_char\tflags;\n\tu_short\trtlifetime;\n\tu_long\texpire;\n\tu_short if_index;\n};\n\n#ifdef _KERNEL\nstruct\tin6_oprlist {\n\tchar ifname[IFNAMSIZ];\n\tstruct {\n\t\tstruct\tin6_addr prefix;\n\t\tstruct prf_ra raflags;\n\t\tu_char\tprefixlen;\n\t\tu_char\torigin;\n\t\tu_long vltime;\n\t\tu_long pltime;\n\t\tu_long expire;\n\t\tu_short if_index;\n\t\tu_short advrtrs; /* number of advertisement routers */\n\t\tstruct\tin6_addr advrtr[DRLSTSIZ]; /* XXX: explicit limit */\n\t} prefix[PRLSTSIZ];\n};\n#endif\n\nstruct\tin6_prlist {\n\tchar ifname[IFNAMSIZ];\n\tstruct {\n\t\tstruct\tin6_addr prefix;\n\t\tstruct prf_ra raflags;\n\t\tu_char\tprefixlen;\n\t\tu_char\torigin;\n\t\tu_int32_t vltime;\n\t\tu_int32_t pltime;\n\t\ttime_t expire;\n\t\tu_short if_index;\n\t\tu_short advrtrs; /* number of advertisement routers */\n\t\tstruct\tin6_addr advrtr[DRLSTSIZ]; /* XXX: explicit limit */\n\t} prefix[PRLSTSIZ];\n};\n\nstruct in6_prefix {\n\tstruct\tsockaddr_in6 prefix;\n\tstruct prf_ra raflags;\n\tu_char\tprefixlen;\n\tu_char\torigin;\n\tu_int32_t vltime;\n\tu_int32_t pltime;\n\ttime_t expire;\n\tu_int32_t flags;\n\tint refcnt;\n\tu_short if_index;\n\tu_short advrtrs; /* number of advertisement routers */\n\t/* struct sockaddr_in6 advrtr[] */\n};\n\n#ifdef _KERNEL\nstruct\tin6_ondireq {\n\tchar ifname[IFNAMSIZ];\n\tstruct {\n\t\tu_int32_t linkmtu;\t/* LinkMTU */\n\t\tu_int32_t maxmtu;\t/* Upper bound of LinkMTU */\n\t\tu_int32_t basereachable; /* BaseReachableTime */\n\t\tu_int32_t reachable;\t/* Reachable Time */\n\t\tu_int32_t retrans;\t/* Retrans Timer */\n\t\tu_int32_t flags;\t/* Flags */\n\t\tint recalctm;\t\t/* BaseReacable re-calculation timer */\n\t\tu_int8_t chlim;\t\t/* CurHopLimit */\n\t\tu_int8_t receivedra;\n\t} ndi;\n};\n#endif\n\nstruct\tin6_ndireq {\n\tchar ifname[IFNAMSIZ];\n\tstruct nd_ifinfo ndi;\n};\n\nstruct\tin6_ndifreq {\n\tchar ifname[IFNAMSIZ];\n\tu_long ifindex;\n};\n\n/* Prefix status */\n#define NDPRF_ONLINK\t\t0x1\n#define NDPRF_DETACHED\t\t0x2\n\n/* protocol constants */\n#define MAX_RTR_SOLICITATION_DELAY\t1\t/* 1sec */\n#define RTR_SOLICITATION_INTERVAL\t4\t/* 4sec */\n#define MAX_RTR_SOLICITATIONS\t\t3\n\n#define ND6_INFINITE_LIFETIME\t\t0xffffffff\n\n#ifdef _KERNEL\n/* node constants */\n#define MAX_REACHABLE_TIME\t\t3600000\t/* msec */\n#define REACHABLE_TIME\t\t\t30000\t/* msec */\n#define RETRANS_TIMER\t\t\t1000\t/* msec */\n#define MIN_RANDOM_FACTOR\t\t512\t/* 1024 * 0.5 */\n#define MAX_RANDOM_FACTOR\t\t1536\t/* 1024 * 1.5 */\n#define DEF_TEMP_VALID_LIFETIME\t\t604800\t/* 1 week */\n#define DEF_TEMP_PREFERRED_LIFETIME\t86400\t/* 1 day */\n#define TEMPADDR_REGEN_ADVANCE\t\t5\t/* sec */\n#define MAX_TEMP_DESYNC_FACTOR\t\t600\t/* 10 min */\n#define ND_COMPUTE_RTIME(x) \\\n\t\t(((MIN_RANDOM_FACTOR * (x >> 10)) + (arc4random() & \\\n\t\t((MAX_RANDOM_FACTOR - MIN_RANDOM_FACTOR) * (x >> 10)))) /1000)\n\nTAILQ_HEAD(nd_drhead, nd_defrouter);\nstruct\tnd_defrouter {\n\tTAILQ_ENTRY(nd_defrouter) dr_entry;\n\tstruct\tin6_addr rtaddr;\n\tu_char\tflags;\t\t/* flags on RA message */\n\tu_short\trtlifetime;\n\tu_long\texpire;\n\tstruct  ifnet *ifp;\n\tint\tinstalled;\t/* is installed into kernel routing table */\n};\n\nstruct nd_prefixctl {\n\tstruct ifnet *ndpr_ifp;\n\n\t/* prefix */\n\tstruct sockaddr_in6 ndpr_prefix;\n\tu_char\tndpr_plen;\n\n\tu_int32_t ndpr_vltime;\t/* advertised valid lifetime */\n\tu_int32_t ndpr_pltime;\t/* advertised preferred lifetime */\n\n\tstruct prf_ra ndpr_flags;\n};\n\n\nstruct nd_prefix {\n\tstruct ifnet *ndpr_ifp;\n\tLIST_ENTRY(nd_prefix) ndpr_entry;\n\tstruct sockaddr_in6 ndpr_prefix;\t/* prefix */\n\tstruct in6_addr ndpr_mask; /* netmask derived from the prefix */\n\n\tu_int32_t ndpr_vltime;\t/* advertised valid lifetime */\n\tu_int32_t ndpr_pltime;\t/* advertised preferred lifetime */\n\n\ttime_t ndpr_expire;\t/* expiration time of the prefix */\n\ttime_t ndpr_preferred;\t/* preferred time of the prefix */\n\ttime_t ndpr_lastupdate; /* reception time of last advertisement */\n\n\tstruct prf_ra ndpr_flags;\n\tu_int32_t ndpr_stateflags; /* actual state flags */\n\t/* list of routers that advertise the prefix: */\n\tLIST_HEAD(pr_rtrhead, nd_pfxrouter) ndpr_advrtrs;\n\tu_char\tndpr_plen;\n\tint\tndpr_refcnt;\t/* reference couter from addresses */\n};\n\n#define ndpr_next\t\tndpr_entry.le_next\n\n#define ndpr_raf\t\tndpr_flags\n#define ndpr_raf_onlink\t\tndpr_flags.onlink\n#define ndpr_raf_auto\t\tndpr_flags.autonomous\n#define ndpr_raf_router\t\tndpr_flags.router\n\n/*\n * Message format for use in obtaining information about prefixes\n * from inet6 sysctl function\n */\nstruct inet6_ndpr_msghdr {\n\tu_short\tinpm_msglen;\t/* to skip over non-understood messages */\n\tu_char\tinpm_version;\t/* future binary compatibility */\n\tu_char\tinpm_type;\t/* message type */\n\tstruct in6_addr inpm_prefix;\n\tu_long\tprm_vltim;\n\tu_long\tprm_pltime;\n\tu_long\tprm_expire;\n\tu_long\tprm_preferred;\n\tstruct in6_prflags prm_flags;\n\tu_short\tprm_index;\t/* index for associated ifp */\n\tu_char\tprm_plen;\t/* length of prefix in bits */\n};\n\n#define prm_raf_onlink\t\tprm_flags.prf_ra.onlink\n#define prm_raf_auto\t\tprm_flags.prf_ra.autonomous\n\n#define prm_statef_onlink\tprm_flags.prf_state.onlink\n\n#define prm_rrf_decrvalid\tprm_flags.prf_rr.decrvalid\n#define prm_rrf_decrprefd\tprm_flags.prf_rr.decrprefd\n\nstruct nd_pfxrouter {\n\tLIST_ENTRY(nd_pfxrouter) pfr_entry;\n#define pfr_next pfr_entry.le_next\n\tstruct nd_defrouter *router;\n};\n\nLIST_HEAD(nd_prhead, nd_prefix);\n\n/* nd6.c */\nVNET_DECLARE(int, nd6_prune);\nVNET_DECLARE(int, nd6_delay);\nVNET_DECLARE(int, nd6_umaxtries);\nVNET_DECLARE(int, nd6_mmaxtries);\nVNET_DECLARE(int, nd6_useloopback);\nVNET_DECLARE(int, nd6_maxnudhint);\nVNET_DECLARE(int, nd6_gctimer);\nVNET_DECLARE(struct nd_drhead, nd_defrouter);\nVNET_DECLARE(struct nd_prhead, nd_prefix);\nVNET_DECLARE(int, nd6_debug);\nVNET_DECLARE(int, nd6_onlink_ns_rfc4861);\n#define\tV_nd6_prune\t\t\tVNET(nd6_prune)\n#define\tV_nd6_delay\t\t\tVNET(nd6_delay)\n#define\tV_nd6_umaxtries\t\t\tVNET(nd6_umaxtries)\n#define\tV_nd6_mmaxtries\t\t\tVNET(nd6_mmaxtries)\n#define\tV_nd6_useloopback\t\tVNET(nd6_useloopback)\n#define\tV_nd6_maxnudhint\t\tVNET(nd6_maxnudhint)\n#define\tV_nd6_gctimer\t\t\tVNET(nd6_gctimer)\n#define\tV_nd_defrouter\t\t\tVNET(nd_defrouter)\n#define\tV_nd_prefix\t\t\tVNET(nd_prefix)\n#define\tV_nd6_debug\t\t\tVNET(nd6_debug)\n#define\tV_nd6_onlink_ns_rfc4861\t\tVNET(nd6_onlink_ns_rfc4861)\n\n#define nd6log(x)\tdo { if (V_nd6_debug) log x; } while (/*CONSTCOND*/ 0)\n\nVNET_DECLARE(struct callout, nd6_timer_ch);\n#define\tV_nd6_timer_ch\t\t\tVNET(nd6_timer_ch)\n\n/* nd6_rtr.c */\nVNET_DECLARE(int, nd6_defifindex);\nVNET_DECLARE(int, ip6_desync_factor);\t/* seconds */\nVNET_DECLARE(u_int32_t, ip6_temp_preferred_lifetime); /* seconds */\nVNET_DECLARE(u_int32_t, ip6_temp_valid_lifetime); /* seconds */\nVNET_DECLARE(int, ip6_temp_regen_advance); /* seconds */\n#define\tV_nd6_defifindex\t\tVNET(nd6_defifindex)\n#define\tV_ip6_desync_factor\t\tVNET(ip6_desync_factor)\n#define\tV_ip6_temp_preferred_lifetime\tVNET(ip6_temp_preferred_lifetime)\n#define\tV_ip6_temp_valid_lifetime\tVNET(ip6_temp_valid_lifetime)\n#define\tV_ip6_temp_regen_advance\tVNET(ip6_temp_regen_advance)\n\nunion nd_opts {\n\tstruct nd_opt_hdr *nd_opt_array[8];\t/* max = target address list */\n\tstruct {\n\t\tstruct nd_opt_hdr *zero;\n\t\tstruct nd_opt_hdr *src_lladdr;\n\t\tstruct nd_opt_hdr *tgt_lladdr;\n\t\tstruct nd_opt_prefix_info *pi_beg; /* multiple opts, start */\n\t\tstruct nd_opt_rd_hdr *rh;\n\t\tstruct nd_opt_mtu *mtu;\n\t\tstruct nd_opt_hdr *search;\t/* multiple opts */\n\t\tstruct nd_opt_hdr *last;\t/* multiple opts */\n\t\tint done;\n\t\tstruct nd_opt_prefix_info *pi_end;/* multiple opts, end */\n\t} nd_opt_each;\n};\n#define nd_opts_src_lladdr\tnd_opt_each.src_lladdr\n#define nd_opts_tgt_lladdr\tnd_opt_each.tgt_lladdr\n#define nd_opts_pi\t\tnd_opt_each.pi_beg\n#define nd_opts_pi_end\t\tnd_opt_each.pi_end\n#define nd_opts_rh\t\tnd_opt_each.rh\n#define nd_opts_mtu\t\tnd_opt_each.mtu\n#define nd_opts_search\t\tnd_opt_each.search\n#define nd_opts_last\t\tnd_opt_each.last\n#define nd_opts_done\t\tnd_opt_each.done\n\n/* XXX: need nd6_var.h?? */\n/* nd6.c */\nvoid nd6_init __P((void));\n#ifdef VIMAGE\nvoid nd6_destroy __P((void));\n#endif\nstruct nd_ifinfo *nd6_ifattach __P((struct ifnet *));\nvoid nd6_ifdetach __P((struct nd_ifinfo *));\nint nd6_is_addr_neighbor __P((struct sockaddr_in6 *, struct ifnet *));\nvoid nd6_option_init __P((void *, int, union nd_opts *));\nstruct nd_opt_hdr *nd6_option __P((union nd_opts *));\nint nd6_options __P((union nd_opts *));\nstruct\tllentry *nd6_lookup __P((struct in6_addr *, int, struct ifnet *));\nvoid nd6_setmtu __P((struct ifnet *));\nvoid nd6_llinfo_settimer __P((struct llentry *, long));\nvoid nd6_llinfo_settimer_locked __P((struct llentry *, long));\nvoid nd6_timer __P((void *));\nvoid nd6_purge __P((struct ifnet *));\nvoid nd6_nud_hint __P((struct rtentry *, struct in6_addr *, int));\nint nd6_resolve __P((struct ifnet *, struct rtentry *, struct mbuf *,\n\tstruct sockaddr *, u_char *));\nint nd6_ioctl __P((u_long, caddr_t, struct ifnet *));\nstruct llentry *nd6_cache_lladdr __P((struct ifnet *, struct in6_addr *,\n\tchar *, int, int, int));\nint nd6_output __P((struct ifnet *, struct ifnet *, struct mbuf *,\n\tstruct sockaddr_in6 *, struct rtentry *));\nint nd6_output_lle __P((struct ifnet *, struct ifnet *, struct mbuf *,\n\tstruct sockaddr_in6 *, struct rtentry *, struct llentry *,\n\tstruct mbuf **));\nint nd6_output_flush __P((struct ifnet *, struct ifnet *, struct mbuf *,\n\tstruct sockaddr_in6 *, struct route *));\nint nd6_need_cache __P((struct ifnet *));\nint nd6_storelladdr __P((struct ifnet *, struct mbuf *,\n\tstruct sockaddr *, u_char *, struct llentry **));\n\n/* nd6_nbr.c */\nvoid nd6_na_input __P((struct mbuf *, int, int));\nvoid nd6_na_output __P((struct ifnet *, const struct in6_addr *,\n\tconst struct in6_addr *, u_long, int, struct sockaddr *));\nvoid nd6_ns_input __P((struct mbuf *, int, int));\nvoid nd6_ns_output __P((struct ifnet *, const struct in6_addr *,\n\tconst struct in6_addr *, struct llentry *, int));\ncaddr_t nd6_ifptomac __P((struct ifnet *));\nvoid nd6_dad_start __P((struct ifaddr *, int));\nvoid nd6_dad_stop __P((struct ifaddr *));\nvoid nd6_dad_duplicated __P((struct ifaddr *));\n\n/* nd6_rtr.c */\nvoid nd6_rs_input __P((struct mbuf *, int, int));\nvoid nd6_ra_input __P((struct mbuf *, int, int));\nvoid prelist_del __P((struct nd_prefix *));\nvoid defrouter_addreq __P((struct nd_defrouter *));\nvoid defrouter_reset __P((void));\nvoid defrouter_select __P((void));\nvoid defrtrlist_del __P((struct nd_defrouter *));\nvoid prelist_remove __P((struct nd_prefix *));\nint nd6_prelist_add __P((struct nd_prefixctl *, struct nd_defrouter *,\n\tstruct nd_prefix **));\nint nd6_prefix_onlink __P((struct nd_prefix *));\nint nd6_prefix_offlink __P((struct nd_prefix *));\nvoid pfxlist_onlink_check __P((void));\nstruct nd_defrouter *defrouter_lookup __P((struct in6_addr *, struct ifnet *));\nstruct nd_prefix *nd6_prefix_lookup __P((struct nd_prefixctl *));\nvoid rt6_flush __P((struct in6_addr *, struct ifnet *));\nint nd6_setdefaultiface __P((int));\nint in6_tmpifadd __P((const struct in6_ifaddr *, int, int));\n\n#endif /* _KERNEL */\n\n#endif /* _NETINET6_ND6_H_ */\n"
  },
  {
    "path": "freebsd-headers/netinet6/pim6.h",
    "content": "/*-\n * Copyright (C) 1998 WIDE Project.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. Neither the name of the project nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t$KAME: pim6.h,v 1.3 2000/03/25 07:23:58 sumikawa Exp $\n * $FreeBSD: release/9.0.0/sys/netinet6/pim6.h 174510 2007-12-10 16:03:40Z obrien $\n */\n/*\n * Protocol Independent Multicast (PIM) definitions\n *\n * Written by Ahmed Helmy, SGI, July 1996\n *\n * MULTICAST\n */\n\n/*\n * PIM packet header\n */\n#define PIM_VERSION\t2\nstruct pim {\n#if defined(BYTE_ORDER) && (BYTE_ORDER == LITTLE_ENDIAN)\n\tu_char\tpim_type:4, /* the PIM message type, currently they are:\n\t\t\t     * Hello, Register, Register-Stop, Join/Prune,\n\t\t\t     * Bootstrap, Assert, Graft (PIM-DM only),\n\t\t\t     * Graft-Ack (PIM-DM only), C-RP-Adv\n\t\t\t     */\n\t\tpim_ver:4;  /* PIM version number; 2 for PIMv2 */\n#else\n\tu_char\tpim_ver:4,\t/* PIM version */\n\t\tpim_type:4;\t/* PIM type    */\n#endif\n\tu_char  pim_rsv;\t/* Reserved */\n\tu_short\tpim_cksum;\t/* IP style check sum */\n};\n\n#define PIM_MINLEN\t8\t\t/* The header min. length is 8    */\n#define PIM6_REG_MINLEN\t(PIM_MINLEN+40)\t/* Register message + inner IP6 header */\n\n/*\n * Message types\n */\n#define PIM_REGISTER\t1\t/* PIM Register type is 1 */\n\n/* second bit in reg_head is the null bit */\n#define PIM_NULL_REGISTER 0x40000000\n"
  },
  {
    "path": "freebsd-headers/netinet6/pim6_var.h",
    "content": "/*-\n * Copyright (C) 1998 WIDE Project.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. Neither the name of the project nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t$KAME: pim6_var.h,v 1.8 2000/06/06 08:07:43 jinmei Exp $\n * $FreeBSD: release/9.0.0/sys/netinet6/pim6_var.h 174510 2007-12-10 16:03:40Z obrien $\n */\n\n/*\n * Protocol Independent Multicast (PIM),\n * implementation-specific definitions.\n *\n * Written by George Edmond Eddy (Rusty), ISI, February 1998\n * Modified by Pavlin Ivanov Radoslavov, USC/ISI, May 1998\n */\n\n#ifndef _NETINET6_PIM6_VAR_H_\n#define _NETINET6_PIM6_VAR_H_\n\nstruct pim6stat {\n\tu_quad_t pim6s_rcv_total;\t/* total PIM messages received\t*/\n\tu_quad_t pim6s_rcv_tooshort;\t/* received with too few bytes\t*/\n\tu_quad_t pim6s_rcv_badsum;\t/* received with bad checksum\t*/\n\tu_quad_t pim6s_rcv_badversion;\t/* received bad PIM version\t*/\n\tu_quad_t pim6s_rcv_registers;\t/* received registers\t\t*/\n\tu_quad_t pim6s_rcv_badregisters; /* received invalid registers\t*/\n\tu_quad_t pim6s_snd_registers;\t/* sent registers\t\t*/\n};\n\n#if (defined(KERNEL)) || (defined(_KERNEL))\nint pim6_input __P((struct mbuf **, int*, int));\n#endif /* KERNEL */\n\n/*\n * Names for PIM sysctl objects\n */\n#define PIM6CTL_STATS\t\t1\t/* statistics (read-only) */\n#define PIM6CTL_MAXID\t\t2\n\n#define PIM6CTL_NAMES { \\\n\t{ 0, 0 }, \\\n\t{ 0, 0 }, \\\n}\n#endif /* _NETINET6_PIM6_VAR_H_ */\n"
  },
  {
    "path": "freebsd-headers/netinet6/raw_ip6.h",
    "content": "/*-\n * Copyright (C) 2001 WIDE Project.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. Neither the name of the project nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t$KAME: raw_ip6.h,v 1.2 2001/05/27 13:28:35 itojun Exp $\n * $FreeBSD: release/9.0.0/sys/netinet6/raw_ip6.h 195727 2009-07-16 21:13:04Z rwatson $\n */\n\n#ifndef _NETINET6_RAW_IP6_H_\n#define _NETINET6_RAW_IP6_H_\n\n/*\n * ICMPv6 stat is counted separately.  see netinet/icmp6.h\n */\nstruct rip6stat {\n\tu_quad_t rip6s_ipackets;\t/* total input packets */\n\tu_quad_t rip6s_isum;\t\t/* input checksum computations */\n\tu_quad_t rip6s_badsum;\t\t/* of above, checksum error */\n\tu_quad_t rip6s_nosock;\t\t/* no matching socket */\n\tu_quad_t rip6s_nosockmcast;\t/* of above, arrived as multicast */\n\tu_quad_t rip6s_fullsock;\t/* not delivered, input socket full */\n\n\tu_quad_t rip6s_opackets;\t/* total output packets */\n};\n\n#ifdef _KERNEL\nVNET_DECLARE(struct rip6stat, rip6stat);\n#define\tV_rip6stat\t\t\tVNET(rip6stat)\n#endif\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/netinet6/scope6_var.h",
    "content": "/*-\n * Copyright (C) 2000 WIDE Project.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. Neither the name of the project nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t$KAME: scope6_var.h,v 1.4 2000/05/18 15:03:27 jinmei Exp $\n * $FreeBSD: release/9.0.0/sys/netinet6/scope6_var.h 174510 2007-12-10 16:03:40Z obrien $\n */\n\n#ifndef _NETINET6_SCOPE6_VAR_H_\n#define _NETINET6_SCOPE6_VAR_H_\n\n#ifdef _KERNEL\nstruct scope6_id {\n\t/*\n\t * 16 is correspondent to 4bit multicast scope field.\n\t * i.e. from node-local to global with some reserved/unassigned types.\n\t */\n\tu_int32_t s6id_list[16];\n};\n\nvoid\tscope6_init __P((void));\nstruct scope6_id *scope6_ifattach __P((struct ifnet *));\nvoid\tscope6_ifdetach __P((struct scope6_id *));\nint\tscope6_set __P((struct ifnet *, struct scope6_id *));\nint\tscope6_get __P((struct ifnet *, struct scope6_id *));\nvoid\tscope6_setdefault __P((struct ifnet *));\nint\tscope6_get_default __P((struct scope6_id *));\nu_int32_t scope6_in6_addrscope __P((struct in6_addr *));\nu_int32_t scope6_addr2default __P((struct in6_addr *));\nint\tsa6_embedscope __P((struct sockaddr_in6 *, int));\nint\tsa6_recoverscope __P((struct sockaddr_in6 *));\nint\tin6_setscope __P((struct in6_addr *, struct ifnet *, u_int32_t *));\nint\tin6_clearscope __P((struct in6_addr *));\n#endif /* _KERNEL */\n\n#endif /* _NETINET6_SCOPE6_VAR_H_ */\n"
  },
  {
    "path": "freebsd-headers/netinet6/sctp6_var.h",
    "content": "/*-\n * Copyright (c) 2001-2007, by Cisco Systems, Inc. All rights reserved.\n * Copyright (c) 2008-2011, by Randall Stewart. All rights reserved.\n * Copyright (c) 2008-2011, by Michael Tuexen. All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions are met:\n *\n * a) Redistributions of source code must retain the above copyright notice,\n *   this list of conditions and the following disclaimer.\n *\n * b) Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in\n *   the documentation and/or other materials provided with the distribution.\n *\n * c) Neither the name of Cisco Systems, Inc. nor the names of its\n *    contributors may be used to endorse or promote products derived\n *    from this software without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n * \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,\n * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE\n * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\n * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\n * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\n * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\n * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF\n * THE POSSIBILITY OF SUCH DAMAGE.\n */\n/*\t$KAME: sctp6_var.h,v 1.7 2004/08/17 04:06:22 itojun Exp $\t*/\n\n#ifndef _NETINET6_SCTP6_VAR_H_\n#define _NETINET6_SCTP6_VAR_H_\n\n#include <sys/cdefs.h>\n__FBSDID(\"$FreeBSD: release/9.0.0/sys/netinet6/sctp6_var.h 218319 2011-02-05 12:12:51Z rrs $\");\n\n/* TODO __Userspace__ IPv6 stuff... */\n#if defined(_KERNEL)\n\nSYSCTL_DECL(_net_inet6_sctp6);\nextern struct pr_usrreqs sctp6_usrreqs;\n\n\nint sctp6_input __P((struct mbuf **, int *, int));\nint sctp6_output\n__P((struct sctp_inpcb *, struct mbuf *, struct sockaddr *,\n    struct mbuf *, struct proc *));\n\tvoid sctp6_ctlinput __P((int, struct sockaddr *, void *));\n\n\n\textern void sctp6_notify(struct sctp_inpcb *inp,\n         struct icmp6_hdr *icmph,\n         struct sctphdr *sh,\n         struct sockaddr *to,\n         struct sctp_tcb *stcb,\n         struct sctp_nets *net);\n\n\n#endif\t\t\t\t/* _KERNEL */\n#endif\n"
  },
  {
    "path": "freebsd-headers/netinet6/send.h",
    "content": "/*-\n * Copyright (c) 2009-2010 Ana Kukec <anchie@FreeBSD.org>\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/netinet6/send.h 222712 2011-06-05 11:40:30Z hrs $\n */\n\n#ifndef _NETINET6_SEND_H_\n#define _NETINET6_SEND_H_\n\n#define\tSND_OUT\t\t0\t/* Outgoing traffic */\n#define\tSND_IN\t\t1\t/* Incoming traffic. */\n\nstruct sockaddr_send {\n\tuint8_t\t\t\tsend_len;\t/* total length */\n\tsa_family_t\t\tsend_family;\t/* address family */\n\tint\t\t\tsend_direction;\n\tint\t\t\tsend_ifidx;\n\tchar\t\t\tsend_zero[8];\n};\n\nextern int (*send_sendso_input_hook)(struct mbuf *, struct ifnet *, int, int);\n\n#endif /* _NETINET6_SEND_H_ */\n"
  },
  {
    "path": "freebsd-headers/netinet6/tcp6_var.h",
    "content": "/*-\n * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. Neither the name of the project nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n */\n\n/*-\n * Copyright (c) 1982, 1986, 1993, 1994, 1995\n *\tThe Regents of the University of California.  All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 4. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t@(#)tcp_var.h\t8.4 (Berkeley) 5/24/95\n * $FreeBSD: release/9.0.0/sys/netinet6/tcp6_var.h 195727 2009-07-16 21:13:04Z rwatson $\n */\n\n#ifndef _NETINET_TCP6_VAR_H_\n#define _NETINET_TCP6_VAR_H_\n\n#ifdef _KERNEL\n#ifdef SYSCTL_DECL\nSYSCTL_DECL(_net_inet6_tcp6);\n\nVNET_DECLARE(int, tcp_v6mssdflt);\t/* XXX */\n#define\tV_tcp_v6mssdflt\t\t\tVNET(tcp_v6mssdflt)\n#endif\n\nstruct\tip6_hdr;\nvoid\ttcp6_ctlinput __P((int, struct sockaddr *, void *));\nvoid\ttcp6_init __P((void));\nint\ttcp6_input __P((struct mbuf **, int *, int));\nstruct\trtentry *tcp_rtlookup6(struct in_conninfo *);\n\nextern struct\tpr_usrreqs tcp6_usrreqs;\n\n#endif /* _KERNEL */\n\n#endif /* _NETINET_TCP6_VAR_H_ */\n"
  },
  {
    "path": "freebsd-headers/netinet6/udp6_var.h",
    "content": "/*-\n * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. Neither the name of the project nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n */\n\n/*-\n * Copyright (c) 1982, 1986, 1989, 1993\n *\tThe Regents of the University of California.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 4. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t@(#)udp_var.h\t8.1 (Berkeley) 6/10/93\n * $FreeBSD: release/9.0.0/sys/netinet6/udp6_var.h 174510 2007-12-10 16:03:40Z obrien $\n */\n\n#ifndef _NETINET6_UDP6_VAR_H_\n#define _NETINET6_UDP6_VAR_H_\n\n#ifdef _KERNEL\nSYSCTL_DECL(_net_inet6_udp6);\n\nextern struct pr_usrreqs\tudp6_usrreqs;\n\nvoid\tudp6_ctlinput(int, struct sockaddr *, void *);\nint\tudp6_input(struct mbuf **, int *, int);\n#endif\n\n#endif /*_NETINET6_UDP6_VAR_H_*/\n"
  },
  {
    "path": "freebsd-headers/netipsec/ah.h",
    "content": "/*\t$FreeBSD: release/9.0.0/sys/netipsec/ah.h 139823 2005-01-07 01:45:51Z imp $\t*/\n/*\t$KAME: ah.h,v 1.13 2000/10/18 21:28:00 itojun Exp $\t*/\n\n/*-\n * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. Neither the name of the project nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n */\n\n/*\n * RFC1826/2402 authentication header.\n */\n\n#ifndef _NETIPSEC_AH_H_\n#define _NETIPSEC_AH_H_\n\nstruct ah {\n\tu_int8_t\tah_nxt;\t\t/* Next Header */\n\tu_int8_t\tah_len;\t\t/* Length of data, in 32bit */\n\tu_int16_t\tah_reserve;\t/* Reserved for future use */\n\tu_int32_t\tah_spi;\t\t/* Security parameter index */\n\t/* variable size, 32bit bound*/\t/* Authentication data */\n};\n\nstruct newah {\n\tu_int8_t\tah_nxt;\t\t/* Next Header */\n\tu_int8_t\tah_len;\t\t/* Length of data + 1, in 32bit */\n\tu_int16_t\tah_reserve;\t/* Reserved for future use */\n\tu_int32_t\tah_spi;\t\t/* Security parameter index */\n\tu_int32_t\tah_seq;\t\t/* Sequence number field */\n\t/* variable size, 32bit bound*/\t/* Authentication data */\n};\n#endif /*_NETIPSEC_AH_H_*/\n"
  },
  {
    "path": "freebsd-headers/netipsec/ah_var.h",
    "content": "/*\t$FreeBSD: release/9.0.0/sys/netipsec/ah_var.h 207369 2010-04-29 11:52:42Z bz $\t*/\n/*\t$OpenBSD: ip_ah.h,v 1.29 2002/06/09 16:26:10 itojun Exp $\t*/\n/*-\n * The authors of this code are John Ioannidis (ji@tla.org),\n * Angelos D. Keromytis (kermit@csd.uch.gr) and\n * Niels Provos (provos@physnet.uni-hamburg.de).\n *\n * The original version of this code was written by John Ioannidis\n * for BSD/OS in Athens, Greece, in November 1995.\n *\n * Ported to OpenBSD and NetBSD, with additional transforms, in December 1996,\n * by Angelos D. Keromytis.\n *\n * Additional transforms and features in 1997 and 1998 by Angelos D. Keromytis\n * and Niels Provos.\n *\n * Additional features in 1999 by Angelos D. Keromytis.\n *\n * Copyright (C) 1995, 1996, 1997, 1998, 1999 John Ioannidis,\n * Angelos D. Keromytis and Niels Provos.\n * Copyright (c) 2001 Angelos D. Keromytis.\n *\n * Permission to use, copy, and modify this software with or without fee\n * is hereby granted, provided that this entire notice is included in\n * all copies of any software which is or includes a copy or\n * modification of this software.\n * You may use this code under the GNU public license if you so wish. Please\n * contribute changes back to the authors under this freer than GPL license\n * so that we may further the use of strong encryption without limitations to\n * all.\n *\n * THIS SOFTWARE IS BEING PROVIDED \"AS IS\", WITHOUT ANY EXPRESS OR\n * IMPLIED WARRANTY. IN PARTICULAR, NONE OF THE AUTHORS MAKES ANY\n * REPRESENTATION OR WARRANTY OF ANY KIND CONCERNING THE\n * MERCHANTABILITY OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR\n * PURPOSE.\n */\n\n#ifndef _NETIPSEC_AH_VAR_H_\n#define _NETIPSEC_AH_VAR_H_\n\n/*\n * These define the algorithm indices into the histogram.  They're\n * presently based on the PF_KEY v2 protocol values which is bogus;\n * they should be decoupled from the protocol at which time we can\n * pack them and reduce the size of the array to a minimum.\n */\n#define\tAH_ALG_MAX\t16\n\nstruct ahstat {\n\tu_int32_t\tahs_hdrops;\t/* Packet shorter than header shows */\n\tu_int32_t\tahs_nopf;\t/* Protocol family not supported */\n\tu_int32_t\tahs_notdb;\n\tu_int32_t\tahs_badkcr;\n\tu_int32_t\tahs_badauth;\n\tu_int32_t\tahs_noxform;\n\tu_int32_t\tahs_qfull;\n\tu_int32_t\tahs_wrap;\n\tu_int32_t\tahs_replay;\n\tu_int32_t\tahs_badauthl;\t/* Bad authenticator length */\n\tu_int32_t\tahs_input;\t/* Input AH packets */\n\tu_int32_t\tahs_output;\t/* Output AH packets */\n\tu_int32_t\tahs_invalid;\t/* Trying to use an invalid TDB */\n\tu_int64_t\tahs_ibytes;\t/* Input bytes */\n\tu_int64_t\tahs_obytes;\t/* Output bytes */\n\tu_int32_t\tahs_toobig;\t/* Packet got larger than IP_MAXPACKET */\n\tu_int32_t\tahs_pdrops;\t/* Packet blocked due to policy */\n\tu_int32_t\tahs_crypto;\t/* Crypto processing failure */\n\tu_int32_t\tahs_tunnel;\t/* Tunnel sanity check failure */\n\tu_int32_t\tahs_hist[AH_ALG_MAX];\t/* Per-algorithm op count */\n};\n\n#ifdef _KERNEL\nVNET_DECLARE(int, ah_enable);\nVNET_DECLARE(int, ah_cleartos);\nVNET_DECLARE(struct ahstat, ahstat);\n\n#define\tV_ah_enable\t\tVNET(ah_enable)\n#define\tV_ah_cleartos\t\tVNET(ah_cleartos)\n#define\tV_ahstat\t\tVNET(ahstat)\n#endif /* _KERNEL */\n#endif /*_NETIPSEC_AH_VAR_H_*/\n"
  },
  {
    "path": "freebsd-headers/netipsec/esp.h",
    "content": "/*\t$FreeBSD: release/9.0.0/sys/netipsec/esp.h 139823 2005-01-07 01:45:51Z imp $\t*/\n/*\t$KAME: esp.h,v 1.16 2000/10/18 21:28:00 itojun Exp $\t*/\n\n/*-\n * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. Neither the name of the project nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n */\n\n/*\n * RFC1827/2406 Encapsulated Security Payload.\n */\n\n#ifndef _NETIPSEC_ESP_H_\n#define _NETIPSEC_ESP_H_\n\nstruct esp {\n\tu_int32_t\tesp_spi;\t/* ESP */\n\t/*variable size, 32bit bound*/\t/* Initialization Vector */\n\t/*variable size*/\t\t/* Payload data */\n\t/*variable size*/\t\t/* padding */\n\t/*8bit*/\t\t\t/* pad size */\n\t/*8bit*/\t\t\t/* next header */\n\t/*8bit*/\t\t\t/* next header */\n\t/*variable size, 32bit bound*/\t/* Authentication data (new IPsec) */\n};\n\nstruct newesp {\n\tu_int32_t\tesp_spi;\t/* ESP */\n\tu_int32_t\tesp_seq;\t/* Sequence number */\n\t/*variable size*/\t\t/* (IV and) Payload data */\n\t/*variable size*/\t\t/* padding */\n\t/*8bit*/\t\t\t/* pad size */\n\t/*8bit*/\t\t\t/* next header */\n\t/*8bit*/\t\t\t/* next header */\n\t/*variable size, 32bit bound*/\t/* Authentication data */\n};\n\nstruct esptail {\n\tu_int8_t\tesp_padlen;\t/* pad length */\n\tu_int8_t\tesp_nxt;\t/* Next header */\n\t/*variable size, 32bit bound*/\t/* Authentication data (new IPsec)*/\n};\n\t\n#define ESP_ALEN\t12\t/* 96-bit authenticator */\n#endif /*_NETIPSEC_ESP_H_*/\n"
  },
  {
    "path": "freebsd-headers/netipsec/esp_var.h",
    "content": "/*\t$FreeBSD: release/9.0.0/sys/netipsec/esp_var.h 207369 2010-04-29 11:52:42Z bz $\t*/\n/*\t$OpenBSD: ip_esp.h,v 1.37 2002/06/09 16:26:10 itojun Exp $\t*/\n/*-\n * The authors of this code are John Ioannidis (ji@tla.org),\n * Angelos D. Keromytis (kermit@csd.uch.gr) and\n * Niels Provos (provos@physnet.uni-hamburg.de).\n *\n * The original version of this code was written by John Ioannidis\n * for BSD/OS in Athens, Greece, in November 1995.\n *\n * Ported to OpenBSD and NetBSD, with additional transforms, in December 1996,\n * by Angelos D. Keromytis.\n *\n * Additional transforms and features in 1997 and 1998 by Angelos D. Keromytis\n * and Niels Provos.\n *\n * Additional features in 1999 by Angelos D. Keromytis.\n *\n * Copyright (C) 1995, 1996, 1997, 1998, 1999 by John Ioannidis,\n * Angelos D. Keromytis and Niels Provos.\n * Copyright (c) 2001 Angelos D. Keromytis.\n *\n * Permission to use, copy, and modify this software with or without fee\n * is hereby granted, provided that this entire notice is included in\n * all copies of any software which is or includes a copy or\n * modification of this software.\n * You may use this code under the GNU public license if you so wish. Please\n * contribute changes back to the authors under this freer than GPL license\n * so that we may further the use of strong encryption without limitations to\n * all.\n *\n * THIS SOFTWARE IS BEING PROVIDED \"AS IS\", WITHOUT ANY EXPRESS OR\n * IMPLIED WARRANTY. IN PARTICULAR, NONE OF THE AUTHORS MAKES ANY\n * REPRESENTATION OR WARRANTY OF ANY KIND CONCERNING THE\n * MERCHANTABILITY OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR\n * PURPOSE.\n */\n\n#ifndef _NETIPSEC_ESP_VAR_H_\n#define _NETIPSEC_ESP_VAR_H_\n\n/*\n * These define the algorithm indices into the histogram.  They're\n * presently based on the PF_KEY v2 protocol values which is bogus;\n * they should be decoupled from the protocol at which time we can\n * pack them and reduce the size of the array to a reasonable value.\n */\n#define\tESP_ALG_MAX\t256\t\t/* NB: could be < but skipjack is 249 */\n\nstruct espstat {\n\tu_int32_t\tesps_hdrops;\t/* Packet shorter than header shows */\n\tu_int32_t\tesps_nopf;\t/* Protocol family not supported */\n\tu_int32_t\tesps_notdb;\n\tu_int32_t\tesps_badkcr;\n\tu_int32_t\tesps_qfull;\n\tu_int32_t\tesps_noxform;\n\tu_int32_t\tesps_badilen;\n\tu_int32_t\tesps_wrap;\t/* Replay counter wrapped around */\n\tu_int32_t\tesps_badenc;\t/* Bad encryption detected */\n\tu_int32_t\tesps_badauth;\t/* Only valid for transforms with auth */\n\tu_int32_t\tesps_replay;\t/* Possible packet replay detected */\n\tu_int32_t\tesps_input;\t/* Input ESP packets */\n\tu_int32_t\tesps_output;\t/* Output ESP packets */\n\tu_int32_t\tesps_invalid;\t/* Trying to use an invalid TDB */\n\tu_int64_t\tesps_ibytes;\t/* Input bytes */\n\tu_int64_t\tesps_obytes;\t/* Output bytes */\n\tu_int32_t\tesps_toobig;\t/* Packet got larger than IP_MAXPACKET */\n\tu_int32_t\tesps_pdrops;\t/* Packet blocked due to policy */\n\tu_int32_t\tesps_crypto;\t/* Crypto processing failure */\n\tu_int32_t\tesps_tunnel;\t/* Tunnel sanity check failure */\n\tu_int32_t\tesps_hist[ESP_ALG_MAX];\t/* Per-algorithm op count */\n};\n\n#ifdef _KERNEL\nVNET_DECLARE(int, esp_enable);\nVNET_DECLARE(struct espstat, espstat);\n\n#define\tV_esp_enable\tVNET(esp_enable)\n#define\tV_espstat\tVNET(espstat)\n#endif /* _KERNEL */\n#endif /*_NETIPSEC_ESP_VAR_H_*/\n"
  },
  {
    "path": "freebsd-headers/netipsec/ipcomp.h",
    "content": "/*\t$FreeBSD: release/9.0.0/sys/netipsec/ipcomp.h 139823 2005-01-07 01:45:51Z imp $\t*/\n/*\t$KAME: ipcomp.h,v 1.8 2000/09/26 07:55:14 itojun Exp $\t*/\n\n/*-\n * Copyright (C) 1999 WIDE Project.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. Neither the name of the project nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n */\n\n/*\n * RFC2393 IP payload compression protocol (IPComp).\n */\n\n#ifndef _NETIPSEC_IPCOMP_H_\n#define _NETIPSEC_IPCOMP_H_\n\nstruct ipcomp {\n\tu_int8_t comp_nxt;\t/* Next Header */\n\tu_int8_t comp_flags;\t/* reserved, must be zero */\n\tu_int16_t comp_cpi;\t/* Compression parameter index */\n};\n\n#define\tIPCOMP_HLENGTH\t4\t/* Length of IPCOMP header */\n\n/* well-known algorithm number (in CPI), from RFC2409 */\n#define IPCOMP_OUI\t1\t/* vendor specific */\n#define IPCOMP_DEFLATE\t2\t/* RFC2394 */\n#define IPCOMP_LZS\t3\t/* RFC2395 */\n#define IPCOMP_MAX\t4\n\n#define IPCOMP_CPI_NEGOTIATE_MIN\t256\n#endif /*_NETIPSEC_IPCOMP_H_*/\n"
  },
  {
    "path": "freebsd-headers/netipsec/ipcomp_var.h",
    "content": "/*\t$FreeBSD: release/9.0.0/sys/netipsec/ipcomp_var.h 207369 2010-04-29 11:52:42Z bz $\t*/\n/*\t$KAME: ipcomp.h,v 1.8 2000/09/26 07:55:14 itojun Exp $\t*/\n\n/*-\n * Copyright (C) 1999 WIDE Project.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. Neither the name of the project nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n */\n\n#ifndef _NETIPSEC_IPCOMP_VAR_H_\n#define _NETIPSEC_IPCOMP_VAR_H_\n\n/*\n * These define the algorithm indices into the histogram.  They're\n * presently based on the PF_KEY v2 protocol values which is bogus;\n * they should be decoupled from the protocol at which time we can\n * pack them and reduce the size of the array to a minimum.\n */\n#define\tIPCOMP_ALG_MAX\t8\n\n#define\tIPCOMPSTAT_VERSION\t1\nstruct ipcompstat {\n\tu_int32_t\tipcomps_hdrops;\t/* Packet shorter than header shows */\n\tu_int32_t\tipcomps_nopf;\t/* Protocol family not supported */\n\tu_int32_t\tipcomps_notdb;\n\tu_int32_t\tipcomps_badkcr;\n\tu_int32_t\tipcomps_qfull;\n\tu_int32_t\tipcomps_noxform;\n\tu_int32_t\tipcomps_wrap;\n\tu_int32_t\tipcomps_input;\t/* Input IPcomp packets */\n\tu_int32_t\tipcomps_output;\t/* Output IPcomp packets */\n\tu_int32_t\tipcomps_invalid;/* Trying to use an invalid TDB */\n\tu_int64_t\tipcomps_ibytes;\t/* Input bytes */\n\tu_int64_t\tipcomps_obytes;\t/* Output bytes */\n\tu_int32_t\tipcomps_toobig;\t/* Packet got > IP_MAXPACKET */\n\tu_int32_t\tipcomps_pdrops;\t/* Packet blocked due to policy */\n\tu_int32_t\tipcomps_crypto;\t/* \"Crypto\" processing failure */\n\tu_int32_t\tipcomps_hist[IPCOMP_ALG_MAX];/* Per-algorithm op count */\n\tu_int32_t\tversion;\t/* Version of this structure. */\n\tu_int32_t\tipcomps_threshold; /* Packet < comp. algo. threshold. */\n\tu_int32_t\tipcomps_uncompr; /* Compression was useles. */\n};\n\n#ifdef _KERNEL\nVNET_DECLARE(int, ipcomp_enable);\nVNET_DECLARE(struct ipcompstat, ipcompstat);\n\n#define\tV_ipcomp_enable\t\tVNET(ipcomp_enable)\n#define\tV_ipcompstat\t\tVNET(ipcompstat)\n#endif /* _KERNEL */\n#endif /*_NETIPSEC_IPCOMP_VAR_H_*/\n"
  },
  {
    "path": "freebsd-headers/netipsec/ipip_var.h",
    "content": "/*\t$FreeBSD: release/9.0.0/sys/netipsec/ipip_var.h 207369 2010-04-29 11:52:42Z bz $\t*/\n/*\t$OpenBSD: ip_ipip.h,v 1.5 2002/06/09 16:26:10 itojun Exp $ */\n/*-\n * The authors of this code are John Ioannidis (ji@tla.org),\n * Angelos D. Keromytis (kermit@csd.uch.gr) and\n * Niels Provos (provos@physnet.uni-hamburg.de).\n *\n * The original version of this code was written by John Ioannidis\n * for BSD/OS in Athens, Greece, in November 1995.\n *\n * Ported to OpenBSD and NetBSD, with additional transforms, in December 1996,\n * by Angelos D. Keromytis.\n *\n * Additional transforms and features in 1997 and 1998 by Angelos D. Keromytis\n * and Niels Provos.\n *\n * Additional features in 1999 by Angelos D. Keromytis.\n *\n * Copyright (C) 1995, 1996, 1997, 1998, 1999 by John Ioannidis,\n * Angelos D. Keromytis and Niels Provos.\n * Copyright (c) 2001, Angelos D. Keromytis.\n *\n * Permission to use, copy, and modify this software with or without fee\n * is hereby granted, provided that this entire notice is included in\n * all copies of any software which is or includes a copy or\n * modification of this software.\n * You may use this code under the GNU public license if you so wish. Please\n * contribute changes back to the authors under this freer than GPL license\n * so that we may further the use of strong encryption without limitations to\n * all.\n *\n * THIS SOFTWARE IS BEING PROVIDED \"AS IS\", WITHOUT ANY EXPRESS OR\n * IMPLIED WARRANTY. IN PARTICULAR, NONE OF THE AUTHORS MAKES ANY\n * REPRESENTATION OR WARRANTY OF ANY KIND CONCERNING THE\n * MERCHANTABILITY OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR\n * PURPOSE.\n */\n\n#ifndef _NETINET_IPIP_H_\n#define _NETINET_IPIP_H_\n\n/*\n * IP-inside-IP processing.\n * Not quite all the functionality of RFC-1853, but the main idea is there.\n */\n\nstruct ipipstat\n{\n    u_int32_t\tipips_ipackets;\t\t/* total input packets */\n    u_int32_t\tipips_opackets;\t\t/* total output packets */\n    u_int32_t\tipips_hdrops;\t\t/* packet shorter than header shows */\n    u_int32_t\tipips_qfull;\n    u_int64_t   ipips_ibytes;\n    u_int64_t   ipips_obytes;\n    u_int32_t\tipips_pdrops;\t\t/* packet dropped due to policy */\n    u_int32_t\tipips_spoof;\t\t/* IP spoofing attempts */\n    u_int32_t   ipips_family;\t\t/* Protocol family mismatch */\n    u_int32_t   ipips_unspec;            /* Missing tunnel endpoint address */\n};\n\n#ifdef _KERNEL\nVNET_DECLARE(int, ipip_allow);\nVNET_DECLARE(struct ipipstat, ipipstat);\n\n#define\tV_ipip_allow\t\tVNET(ipip_allow)\n#define\tV_ipipstat\t\tVNET(ipipstat)\n#endif /* _KERNEL */\n#endif /* _NETINET_IPIP_H_ */\n"
  },
  {
    "path": "freebsd-headers/netipsec/ipsec.h",
    "content": "/*\t$FreeBSD: release/9.0.0/sys/netipsec/ipsec.h 220206 2011-03-31 15:23:32Z fabient $\t*/\n/*\t$KAME: ipsec.h,v 1.53 2001/11/20 08:32:38 itojun Exp $\t*/\n\n/*-\n * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. Neither the name of the project nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n */\n\n/*\n * IPsec controller part.\n */\n\n#ifndef _NETIPSEC_IPSEC_H_\n#define _NETIPSEC_IPSEC_H_\n\n#if defined(_KERNEL) && !defined(_LKM) && !defined(KLD_MODULE)\n#include \"opt_inet.h\"\n#include \"opt_ipsec.h\"\n#endif\n\n#include <net/pfkeyv2.h>\n#include <netipsec/keydb.h>\n\n#ifdef _KERNEL\n\n#define\tIPSEC_ASSERT(_c,_m) KASSERT(_c, _m)\n\n#define\tIPSEC_IS_PRIVILEGED_SO(_so) \\\n\t((_so)->so_cred != NULL && \\\n\t priv_check_cred((_so)->so_cred, PRIV_NETINET_IPSEC, 0) \\\n\t == 0)\n\n/*\n * Security Policy Index\n * Ensure that both address families in the \"src\" and \"dst\" are same.\n * When the value of the ul_proto is ICMPv6, the port field in \"src\"\n * specifies ICMPv6 type, and the port field in \"dst\" specifies ICMPv6 code.\n */\nstruct secpolicyindex {\n\tu_int8_t dir;\t\t\t/* direction of packet flow, see below */\n\tunion sockaddr_union src;\t/* IP src address for SP */\n\tunion sockaddr_union dst;\t/* IP dst address for SP */\n\tu_int8_t prefs;\t\t\t/* prefix length in bits for src */\n\tu_int8_t prefd;\t\t\t/* prefix length in bits for dst */\n\tu_int16_t ul_proto;\t\t/* upper layer Protocol */\n#ifdef notyet\n\tuid_t uids;\n\tuid_t uidd;\n\tgid_t gids;\n\tgid_t gidd;\n#endif\n};\n\n/* Security Policy Data Base */\nstruct secpolicy {\n\tLIST_ENTRY(secpolicy) chain;\n\tstruct mtx lock;\n\n\tu_int refcnt;\t\t\t/* reference count */\n\tstruct secpolicyindex spidx;\t/* selector */\n\tu_int32_t id;\t\t\t/* It's unique number on the system. */\n\tu_int state;\t\t\t/* 0: dead, others: alive */\n#define IPSEC_SPSTATE_DEAD\t0\n#define IPSEC_SPSTATE_ALIVE\t1\n\tu_int16_t policy;\t\t/* policy_type per pfkeyv2.h */\n\tu_int16_t scangen;\t\t/* scan generation # */\n\tstruct ipsecrequest *req;\n\t\t\t\t/* pointer to the ipsec request tree, */\n\t\t\t\t/* if policy == IPSEC else this value == NULL.*/\n\n\t/*\n\t * lifetime handler.\n\t * the policy can be used without limitiation if both lifetime and\n\t * validtime are zero.\n\t * \"lifetime\" is passed by sadb_lifetime.sadb_lifetime_addtime.\n\t * \"validtime\" is passed by sadb_lifetime.sadb_lifetime_usetime.\n\t */\n\ttime_t created;\t\t/* time created the policy */\n\ttime_t lastused;\t/* updated every when kernel sends a packet */\n\tlong lifetime;\t\t/* duration of the lifetime of this policy */\n\tlong validtime;\t\t/* duration this policy is valid without use */\n};\n\n#define\tSECPOLICY_LOCK_INIT(_sp) \\\n\tmtx_init(&(_sp)->lock, \"ipsec policy\", NULL, MTX_DEF)\n#define\tSECPOLICY_LOCK(_sp)\t\tmtx_lock(&(_sp)->lock)\n#define\tSECPOLICY_UNLOCK(_sp)\t\tmtx_unlock(&(_sp)->lock)\n#define\tSECPOLICY_LOCK_DESTROY(_sp)\tmtx_destroy(&(_sp)->lock)\n#define\tSECPOLICY_LOCK_ASSERT(_sp)\tmtx_assert(&(_sp)->lock, MA_OWNED)\n\n/* Request for IPsec */\nstruct ipsecrequest {\n\tstruct ipsecrequest *next;\n\t\t\t\t/* pointer to next structure */\n\t\t\t\t/* If NULL, it means the end of chain. */\n\tstruct secasindex saidx;/* hint for search proper SA */\n\t\t\t\t/* if __ss_len == 0 then no address specified.*/\n\tu_int level;\t\t/* IPsec level defined below. */\n\n\tstruct secasvar *sav;\t/* place holder of SA for use */\n\tstruct secpolicy *sp;\t/* back pointer to SP */\n\tstruct rwlock lock;\t/* to interlock updates */\n};\n\n/*\n * Need recursion for when crypto callbacks happen directly,\n * as in the case of software crypto.  Need to look at how\n * hard it is to remove this...\n */\n#define\tIPSECREQUEST_LOCK_INIT(_isr) \\\n\trw_init_flags(&(_isr)->lock, \"ipsec request\", RW_RECURSE)\n#define\tIPSECREQUEST_LOCK(_isr)\t\trw_rlock(&(_isr)->lock)\n#define\tIPSECREQUEST_UNLOCK(_isr)\trw_runlock(&(_isr)->lock)\n#define\tIPSECREQUEST_WLOCK(_isr)\trw_wlock(&(_isr)->lock)\n#define\tIPSECREQUEST_WUNLOCK(_isr)\trw_wunlock(&(_isr)->lock)\n#define\tIPSECREQUEST_UPGRADE(_isr)\trw_try_upgrade(&(_isr)->lock)\n#define\tIPSECREQUEST_DOWNGRADE(_isr)\trw_downgrade(&(_isr)->lock)\n#define\tIPSECREQUEST_LOCK_DESTROY(_isr)\trw_destroy(&(_isr)->lock)\n#define\tIPSECREQUEST_LOCK_ASSERT(_isr)\trw_assert(&(_isr)->lock, RA_LOCKED)\n\n/* security policy in PCB */\nstruct inpcbpolicy {\n\tstruct secpolicy *sp_in;\n\tstruct secpolicy *sp_out;\n\tint priv;\t\t\t/* privileged socket ? */\n};\n\n/* SP acquiring list table. */\nstruct secspacq {\n\tLIST_ENTRY(secspacq) chain;\n\n\tstruct secpolicyindex spidx;\n\n\ttime_t created;\t\t/* for lifetime */\n\tint count;\t\t/* for lifetime */\n\t/* XXX: here is mbuf place holder to be sent ? */\n};\n#endif /* _KERNEL */\n\n/* according to IANA assignment, port 0x0000 and proto 0xff are reserved. */\n#define IPSEC_PORT_ANY\t\t0\n#define IPSEC_ULPROTO_ANY\t255\n#define IPSEC_PROTO_ANY\t\t255\n\n/* mode of security protocol */\n/* NOTE: DON'T use IPSEC_MODE_ANY at SPD.  It's only use in SAD */\n#define\tIPSEC_MODE_ANY\t\t0\t/* i.e. wildcard. */\n#define\tIPSEC_MODE_TRANSPORT\t1\n#define\tIPSEC_MODE_TUNNEL\t2\n#define\tIPSEC_MODE_TCPMD5\t3\t/* TCP MD5 mode */\n\n/*\n * Direction of security policy.\n * NOTE: Since INVALID is used just as flag.\n * The other are used for loop counter too.\n */\n#define IPSEC_DIR_ANY\t\t0\n#define IPSEC_DIR_INBOUND\t1\n#define IPSEC_DIR_OUTBOUND\t2\n#define IPSEC_DIR_MAX\t\t3\n#define IPSEC_DIR_INVALID\t4\n\n/* Policy level */\n/*\n * IPSEC, ENTRUST and BYPASS are allowed for setsockopt() in PCB,\n * DISCARD, IPSEC and NONE are allowed for setkey() in SPD.\n * DISCARD and NONE are allowed for system default.\n */\n#define IPSEC_POLICY_DISCARD\t0\t/* discarding packet */\n#define IPSEC_POLICY_NONE\t1\t/* through IPsec engine */\n#define IPSEC_POLICY_IPSEC\t2\t/* do IPsec */\n#define IPSEC_POLICY_ENTRUST\t3\t/* consulting SPD if present. */\n#define IPSEC_POLICY_BYPASS\t4\t/* only for privileged socket. */\n\n/* Security protocol level */\n#define\tIPSEC_LEVEL_DEFAULT\t0\t/* reference to system default */\n#define\tIPSEC_LEVEL_USE\t\t1\t/* use SA if present. */\n#define\tIPSEC_LEVEL_REQUIRE\t2\t/* require SA. */\n#define\tIPSEC_LEVEL_UNIQUE\t3\t/* unique SA. */\n\n#define IPSEC_MANUAL_REQID_MAX\t0x3fff\n\t\t\t\t/*\n\t\t\t\t * if security policy level == unique, this id\n\t\t\t\t * indicate to a relative SA for use, else is\n\t\t\t\t * zero.\n\t\t\t\t * 1 - 0x3fff are reserved for manual keying.\n\t\t\t\t * 0 are reserved for above reason.  Others is\n\t\t\t\t * for kernel use.\n\t\t\t\t * Note that this id doesn't identify SA\n\t\t\t\t * by only itself.\n\t\t\t\t */\n#define IPSEC_REPLAYWSIZE  32\n\n/* statistics for ipsec processing */\nstruct ipsecstat {\n\tu_quad_t in_success;  /* succeeded inbound process */\n\tu_quad_t in_polvio;\n\t\t\t/* security policy violation for inbound process */\n\tu_quad_t in_nosa;     /* inbound SA is unavailable */\n\tu_quad_t in_inval;    /* inbound processing failed due to EINVAL */\n\tu_quad_t in_nomem;    /* inbound processing failed due to ENOBUFS */\n\tu_quad_t in_badspi;   /* failed getting a SPI */\n\tu_quad_t in_ahreplay; /* AH replay check failed */\n\tu_quad_t in_espreplay; /* ESP replay check failed */\n\tu_quad_t in_ahauthsucc; /* AH authentication success */\n\tu_quad_t in_ahauthfail; /* AH authentication failure */\n\tu_quad_t in_espauthsucc; /* ESP authentication success */\n\tu_quad_t in_espauthfail; /* ESP authentication failure */\n\tu_quad_t in_esphist[256];\n\tu_quad_t in_ahhist[256];\n\tu_quad_t in_comphist[256];\n\tu_quad_t out_success; /* succeeded outbound process */\n\tu_quad_t out_polvio;\n\t\t\t/* security policy violation for outbound process */\n\tu_quad_t out_nosa;    /* outbound SA is unavailable */\n\tu_quad_t out_inval;   /* outbound process failed due to EINVAL */\n\tu_quad_t out_nomem;    /* inbound processing failed due to ENOBUFS */\n\tu_quad_t out_noroute; /* there is no route */\n\tu_quad_t out_esphist[256];\n\tu_quad_t out_ahhist[256];\n\tu_quad_t out_comphist[256];\n\n\tu_quad_t spdcachelookup;\n\tu_quad_t spdcachemiss;\n\n\tu_int32_t ips_in_polvio;\t/* input: sec policy violation */\n\tu_int32_t ips_out_polvio;\t/* output: sec policy violation */\n\tu_int32_t ips_out_nosa;\t\t/* output: SA unavailable  */\n\tu_int32_t ips_out_nomem;\t/* output: no memory available */\n\tu_int32_t ips_out_noroute;\t/* output: no route available */\n\tu_int32_t ips_out_inval;\t/* output: generic error */\n\tu_int32_t ips_out_bundlesa;\t/* output: bundled SA processed */\n\tu_int32_t ips_mbcoalesced;\t/* mbufs coalesced during clone */\n\tu_int32_t ips_clcoalesced;\t/* clusters coalesced during clone */\n\tu_int32_t ips_clcopied;\t\t/* clusters copied during clone */\n\tu_int32_t ips_mbinserted;\t/* mbufs inserted during makespace */\n\t/* \n\t * Temporary statistics for performance analysis.\n\t */\n\t/* See where ESP/AH/IPCOMP header land in mbuf on input */\n\tu_int32_t ips_input_front;\n\tu_int32_t ips_input_middle;\n\tu_int32_t ips_input_end;\n};\n\n/*\n * Definitions for IPsec & Key sysctl operations.\n */\n/*\n * Names for IPsec & Key sysctl objects\n */\n#define IPSECCTL_STATS\t\t\t1\t/* stats */\n#define IPSECCTL_DEF_POLICY\t\t2\n#define IPSECCTL_DEF_ESP_TRANSLEV\t3\t/* int; ESP transport mode */\n#define IPSECCTL_DEF_ESP_NETLEV\t\t4\t/* int; ESP tunnel mode */\n#define IPSECCTL_DEF_AH_TRANSLEV\t5\t/* int; AH transport mode */\n#define IPSECCTL_DEF_AH_NETLEV\t\t6\t/* int; AH tunnel mode */\n#if 0\t/* obsolete, do not reuse */\n#define IPSECCTL_INBOUND_CALL_IKE\t7\n#endif\n#define\tIPSECCTL_AH_CLEARTOS\t\t8\n#define\tIPSECCTL_AH_OFFSETMASK\t\t9\n#define\tIPSECCTL_DFBIT\t\t\t10\n#define\tIPSECCTL_ECN\t\t\t11\n#define\tIPSECCTL_DEBUG\t\t\t12\n#define\tIPSECCTL_ESP_RANDPAD\t\t13\n#define IPSECCTL_MAXID\t\t\t14\n\n#define IPSECCTL_NAMES { \\\n\t{ 0, 0 }, \\\n\t{ 0, 0 }, \\\n\t{ \"def_policy\", CTLTYPE_INT }, \\\n\t{ \"esp_trans_deflev\", CTLTYPE_INT }, \\\n\t{ \"esp_net_deflev\", CTLTYPE_INT }, \\\n\t{ \"ah_trans_deflev\", CTLTYPE_INT }, \\\n\t{ \"ah_net_deflev\", CTLTYPE_INT }, \\\n\t{ 0, 0 }, \\\n\t{ \"ah_cleartos\", CTLTYPE_INT }, \\\n\t{ \"ah_offsetmask\", CTLTYPE_INT }, \\\n\t{ \"dfbit\", CTLTYPE_INT }, \\\n\t{ \"ecn\", CTLTYPE_INT }, \\\n\t{ \"debug\", CTLTYPE_INT }, \\\n\t{ \"esp_randpad\", CTLTYPE_INT }, \\\n}\n\n#define IPSEC6CTL_NAMES { \\\n\t{ 0, 0 }, \\\n\t{ 0, 0 }, \\\n\t{ \"def_policy\", CTLTYPE_INT }, \\\n\t{ \"esp_trans_deflev\", CTLTYPE_INT }, \\\n\t{ \"esp_net_deflev\", CTLTYPE_INT }, \\\n\t{ \"ah_trans_deflev\", CTLTYPE_INT }, \\\n\t{ \"ah_net_deflev\", CTLTYPE_INT }, \\\n\t{ 0, 0 }, \\\n\t{ 0, 0 }, \\\n\t{ 0, 0 }, \\\n\t{ 0, 0 }, \\\n\t{ \"ecn\", CTLTYPE_INT }, \\\n\t{ \"debug\", CTLTYPE_INT }, \\\n\t{ \"esp_randpad\", CTLTYPE_INT }, \\\n}\n\n#ifdef _KERNEL\nstruct ipsec_output_state {\n\tstruct mbuf *m;\n\tstruct route *ro;\n\tstruct sockaddr *dst;\n};\n\nstruct ipsec_history {\n\tint ih_proto;\n\tu_int32_t ih_spi;\n};\n\nVNET_DECLARE(int, ipsec_debug);\n#define\tV_ipsec_debug\t\tVNET(ipsec_debug)\n\n#ifdef REGRESSION\nVNET_DECLARE(int, ipsec_replay);\nVNET_DECLARE(int, ipsec_integrity);\n\n#define\tV_ipsec_replay\t\tVNET(ipsec_replay)\n#define\tV_ipsec_integrity\tVNET(ipsec_integrity)\n#endif\n\nVNET_DECLARE(struct ipsecstat, ipsec4stat);\nVNET_DECLARE(struct secpolicy, ip4_def_policy);\nVNET_DECLARE(int, ip4_esp_trans_deflev);\nVNET_DECLARE(int, ip4_esp_net_deflev);\nVNET_DECLARE(int, ip4_ah_trans_deflev);\nVNET_DECLARE(int, ip4_ah_net_deflev);\nVNET_DECLARE(int, ip4_ah_offsetmask);\nVNET_DECLARE(int, ip4_ipsec_dfbit);\nVNET_DECLARE(int, ip4_ipsec_ecn);\nVNET_DECLARE(int, ip4_esp_randpad);\nVNET_DECLARE(int, crypto_support);\n\n#define\tV_ipsec4stat\t\tVNET(ipsec4stat)\n#define\tV_ip4_def_policy\tVNET(ip4_def_policy)\n#define\tV_ip4_esp_trans_deflev\tVNET(ip4_esp_trans_deflev)\n#define\tV_ip4_esp_net_deflev\tVNET(ip4_esp_net_deflev)\n#define\tV_ip4_ah_trans_deflev\tVNET(ip4_ah_trans_deflev)\n#define\tV_ip4_ah_net_deflev\tVNET(ip4_ah_net_deflev)\n#define\tV_ip4_ah_offsetmask\tVNET(ip4_ah_offsetmask)\n#define\tV_ip4_ipsec_dfbit\tVNET(ip4_ipsec_dfbit)\n#define\tV_ip4_ipsec_ecn\t\tVNET(ip4_ipsec_ecn)\n#define\tV_ip4_esp_randpad\tVNET(ip4_esp_randpad)\n#define\tV_crypto_support\tVNET(crypto_support)\n\n#define ipseclog(x)\tdo { if (V_ipsec_debug) log x; } while (0)\n/* for openbsd compatibility */\n#define\tDPRINTF(x)\tdo { if (V_ipsec_debug) printf x; } while (0)\n\nextern\tstruct ipsecrequest *ipsec_newisr(void);\nextern\tvoid ipsec_delisr(struct ipsecrequest *);\n\nstruct tdb_ident;\nextern struct secpolicy *ipsec_getpolicy __P((struct tdb_ident*, u_int));\nstruct inpcb;\nextern struct secpolicy *ipsec4_checkpolicy __P((struct mbuf *, u_int, u_int,\n\tint *, struct inpcb *));\nextern struct secpolicy * ipsec_getpolicybyaddr(struct mbuf *, u_int,\n\tint, int *);\n\nstruct inpcb;\nextern int ipsec_init_policy __P((struct socket *so, struct inpcbpolicy **));\nextern int ipsec_copy_policy\n\t__P((struct inpcbpolicy *, struct inpcbpolicy *));\nextern u_int ipsec_get_reqlevel __P((struct ipsecrequest *));\nextern int ipsec_in_reject __P((struct secpolicy *, struct mbuf *));\n\nextern int ipsec_set_policy __P((struct inpcb *inp, int optname,\n\tcaddr_t request, size_t len, struct ucred *cred));\nextern int ipsec_get_policy __P((struct inpcb *inpcb, caddr_t request,\n\tsize_t len, struct mbuf **mp));\nextern int ipsec_delete_pcbpolicy __P((struct inpcb *));\nextern int ipsec4_in_reject __P((struct mbuf *, struct inpcb *));\n\nstruct secas;\nstruct tcpcb;\nextern int ipsec_chkreplay __P((u_int32_t, struct secasvar *));\nextern int ipsec_updatereplay __P((u_int32_t, struct secasvar *));\n\nextern size_t ipsec_hdrsiz __P((struct mbuf *, u_int, struct inpcb *));\nextern size_t ipsec_hdrsiz_tcp __P((struct tcpcb *));\n\nunion sockaddr_union;\nextern char * ipsec_address(union sockaddr_union* sa);\nextern const char *ipsec_logsastr __P((struct secasvar *));\n\nextern void ipsec_dumpmbuf __P((struct mbuf *));\n\nstruct m_tag;\nextern void ah4_input(struct mbuf *m, int off);\nextern void ah4_ctlinput(int cmd, struct sockaddr *sa, void *);\nextern void esp4_input(struct mbuf *m, int off);\nextern void esp4_ctlinput(int cmd, struct sockaddr *sa, void *);\nextern void ipcomp4_input(struct mbuf *m, int off);\nextern int ipsec4_common_input(struct mbuf *m, ...);\nextern int ipsec4_common_input_cb(struct mbuf *m, struct secasvar *sav,\n\t\t\tint skip, int protoff, struct m_tag *mt);\nextern int ipsec4_process_packet __P((struct mbuf *, struct ipsecrequest *,\n\t\t\tint, int));\nextern int ipsec_process_done __P((struct mbuf *, struct ipsecrequest *));\n\nextern struct mbuf *ipsec_copypkt __P((struct mbuf *));\n\nextern\tvoid m_checkalignment(const char* where, struct mbuf *m0,\n\t\tint off, int len);\nextern\tstruct mbuf *m_makespace(struct mbuf *m0, int skip, int hlen, int *off);\nextern\tcaddr_t m_pad(struct mbuf *m, int n);\nextern\tint m_striphdr(struct mbuf *m, int skip, int hlen);\n\n#ifdef DEV_ENC\n#define\tENC_BEFORE\t0x0001\n#define\tENC_AFTER\t0x0002\n#define\tENC_IN\t\t0x0100\n#define\tENC_OUT\t\t0x0200\nextern\tint ipsec_filter(struct mbuf **, int, int);\nextern\tvoid ipsec_bpf(struct mbuf *, struct secasvar *, int, int);\n#endif\n#endif /* _KERNEL */\n\n#ifndef _KERNEL\nextern caddr_t ipsec_set_policy __P((char *, int));\nextern int ipsec_get_policylen __P((caddr_t));\nextern char *ipsec_dump_policy __P((caddr_t, char *));\n\nextern const char *ipsec_strerror __P((void));\n\n#endif /* ! KERNEL */\n\n#endif /* _NETIPSEC_IPSEC_H_ */\n"
  },
  {
    "path": "freebsd-headers/netipsec/ipsec6.h",
    "content": "/*\t$FreeBSD: release/9.0.0/sys/netipsec/ipsec6.h 207369 2010-04-29 11:52:42Z bz $\t*/\n/*\t$KAME: ipsec.h,v 1.44 2001/03/23 08:08:47 itojun Exp $\t*/\n\n/*-\n * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. Neither the name of the project nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n */\n\n/*\n * IPsec controller part.\n */\n\n#ifndef _NETIPSEC_IPSEC6_H_\n#define _NETIPSEC_IPSEC6_H_\n\n#include <net/pfkeyv2.h>\n#include <netipsec/keydb.h>\n\n#ifdef _KERNEL\nVNET_DECLARE(struct ipsecstat, ipsec6stat);\nVNET_DECLARE(int, ip6_esp_trans_deflev);\nVNET_DECLARE(int, ip6_esp_net_deflev);\nVNET_DECLARE(int, ip6_ah_trans_deflev);\nVNET_DECLARE(int, ip6_ah_net_deflev);\nVNET_DECLARE(int, ip6_ipsec_ecn);\n\n#define\tV_ipsec6stat\t\tVNET(ipsec6stat)\n#define\tV_ip6_esp_trans_deflev\tVNET(ip6_esp_trans_deflev)\n#define\tV_ip6_esp_net_deflev\tVNET(ip6_esp_net_deflev)\n#define\tV_ip6_ah_trans_deflev\tVNET(ip6_ah_trans_deflev)\n#define\tV_ip6_ah_net_deflev\tVNET(ip6_ah_net_deflev)\n#define\tV_ip6_ipsec_ecn\t\tVNET(ip6_ipsec_ecn)\n\nstruct inpcb;\n\nextern int ipsec6_in_reject __P((struct mbuf *, struct inpcb *));\n\nstruct ip6_hdr;\nextern const char *ipsec6_logpacketstr __P((struct ip6_hdr *, u_int32_t));\n\nstruct m_tag;\nextern int ipsec6_common_input(struct mbuf **mp, int *offp, int proto);\nextern int ipsec6_common_input_cb(struct mbuf *m, struct secasvar *sav,\n\t\t\tint skip, int protoff, struct m_tag *mt);\nextern void esp6_ctlinput(int, struct sockaddr *, void *);\n\nstruct ipsec_output_state;\nextern int ipsec6_output_trans __P((struct ipsec_output_state *, u_char *,\n\tstruct mbuf *, struct secpolicy *, int, int *));\nextern int ipsec6_output_tunnel __P((struct ipsec_output_state *,\n\tstruct secpolicy *, int));\n#endif /*_KERNEL*/\n\n#endif /*_NETIPSEC_IPSEC6_H_*/\n"
  },
  {
    "path": "freebsd-headers/netipsec/key.h",
    "content": "/*\t$FreeBSD: release/9.0.0/sys/netipsec/key.h 220206 2011-03-31 15:23:32Z fabient $\t*/\n/*\t$KAME: key.h,v 1.21 2001/07/27 03:51:30 itojun Exp $\t*/\n\n/*-\n * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. Neither the name of the project nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n */\n\n#ifndef _NETIPSEC_KEY_H_\n#define _NETIPSEC_KEY_H_\n\n#ifdef _KERNEL\n\nstruct secpolicy;\nstruct secpolicyindex;\nstruct ipsecrequest;\nstruct secasvar;\nstruct sockaddr;\nstruct socket;\nstruct sadb_msg;\nstruct sadb_x_policy;\nstruct secasindex;\nunion sockaddr_union;\n\nextern void key_addref(struct secpolicy *sp);\nextern\tint key_havesp(u_int dir);\nextern struct secpolicy *key_allocsp(struct secpolicyindex *, u_int,\n\tconst char*, int);\nextern struct secpolicy *key_allocsp2(u_int32_t spi, union sockaddr_union *dst,\n\tu_int8_t proto, u_int dir, const char*, int);\nextern struct secpolicy *key_newsp(const char*, int);\n#if 0\nextern struct secpolicy *key_gettunnel(const struct sockaddr *,\n\tconst struct sockaddr *, const struct sockaddr *,\n\tconst struct sockaddr *, const char*, int);\n#endif\n/* NB: prepend with _ for KAME IPv6 compatbility */\nextern void _key_freesp(struct secpolicy **, const char*, int);\n\n#define\tKEY_ALLOCSP(spidx, dir)\t\t\t\t\t\\\n\tkey_allocsp(spidx, dir, __FILE__, __LINE__)\n#define\tKEY_ALLOCSP2(spi, dst, proto, dir)\t\t\t\\\n\tkey_allocsp2(spi, dst, proto, dir, __FILE__, __LINE__)\n#define\tKEY_NEWSP()\t\t\t\t\t\t\\\n\tkey_newsp(__FILE__, __LINE__)\n#if 0\n#define\tKEY_GETTUNNEL(osrc, odst, isrc, idst)\t\t\t\\\n\tkey_gettunnel(osrc, odst, isrc, idst, __FILE__, __LINE__)\n#endif\n#define\tKEY_FREESP(spp)\t\t\t\t\t\t\\\n\t_key_freesp(spp, __FILE__, __LINE__)\n\nextern struct secasvar *key_allocsa(union sockaddr_union *, u_int, u_int32_t,\n\tconst char*, int);\nextern void key_addrefsa(struct secasvar *, const char*, int);\nextern void key_freesav(struct secasvar **, const char*, int);\n\n#define\tKEY_ALLOCSA(dst, proto, spi)\t\t\t\t\\\n\tkey_allocsa(dst, proto, spi, __FILE__, __LINE__)\n#define\tKEY_ADDREFSA(sav)\t\t\t\t\t\\\n\tkey_addrefsa(sav, __FILE__, __LINE__)\n#define\tKEY_FREESAV(psav)\t\t\t\t\t\\\n\tkey_freesav(psav, __FILE__, __LINE__)\n\nextern void key_freeso __P((struct socket *));\nextern int key_checktunnelsanity __P((struct secasvar *, u_int,\n\t\t\t\t\tcaddr_t, caddr_t));\nextern int key_checkrequest\n\t__P((struct ipsecrequest *isr, const struct secasindex *));\n\nextern struct secpolicy *key_msg2sp __P((struct sadb_x_policy *,\n\tsize_t, int *));\nextern struct mbuf *key_sp2msg __P((struct secpolicy *));\nextern int key_ismyaddr __P((struct sockaddr *));\nextern int key_spdacquire __P((struct secpolicy *));\nextern void key_timehandler __P((void));\nextern u_long key_random __P((void));\nextern void key_randomfill __P((void *, size_t));\nextern void key_freereg __P((struct socket *));\nextern int key_parse __P((struct mbuf *, struct socket *));\nextern void key_init __P((void));\n#ifdef VIMAGE\nextern void key_destroy(void);\n#endif\nextern void key_sa_recordxfer __P((struct secasvar *, struct mbuf *));\nextern void key_sa_routechange __P((struct sockaddr *));\nextern void key_sa_stir_iv __P((struct secasvar *));\n#ifdef IPSEC_NAT_T\nu_int16_t key_portfromsaddr(struct sockaddr *);\n#define\tKEY_PORTFROMSADDR(saddr)\t\t\t\t\\\n\tkey_portfromsaddr((struct sockaddr *)(saddr))\n#endif\n\n#ifdef MALLOC_DECLARE\nMALLOC_DECLARE(M_IPSEC_SA);\nMALLOC_DECLARE(M_IPSEC_SAH);\nMALLOC_DECLARE(M_IPSEC_SP);\nMALLOC_DECLARE(M_IPSEC_SR);\nMALLOC_DECLARE(M_IPSEC_MISC);\nMALLOC_DECLARE(M_IPSEC_SAQ);\nMALLOC_DECLARE(M_IPSEC_SAR);\nMALLOC_DECLARE(M_IPSEC_INPCB);\n#endif /* MALLOC_DECLARE */\n\n#endif /* defined(_KERNEL) */\n#endif /* _NETIPSEC_KEY_H_ */\n"
  },
  {
    "path": "freebsd-headers/netipsec/key_debug.h",
    "content": "/*\t$FreeBSD: release/9.0.0/sys/netipsec/key_debug.h 195727 2009-07-16 21:13:04Z rwatson $\t*/\n/*\t$KAME: key_debug.h,v 1.10 2001/08/05 08:37:52 itojun Exp $\t*/\n\n/*-\n * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. Neither the name of the project nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n */\n\n#ifndef _NETIPSEC_KEY_DEBUG_H_\n#define _NETIPSEC_KEY_DEBUG_H_\n\n#ifdef _KERNEL\n/* debug flags */\n#define KEYDEBUG_STAMP\t\t0x00000001 /* path */\n#define KEYDEBUG_DATA\t\t0x00000002 /* data */\n#define KEYDEBUG_DUMP\t\t0x00000004 /* dump */\n\n#define KEYDEBUG_KEY\t\t0x00000010 /* key processing */\n#define KEYDEBUG_ALG\t\t0x00000020 /* ciph & auth algorithm */\n#define KEYDEBUG_IPSEC\t\t0x00000040 /* ipsec processing */\n\n#define KEYDEBUG_KEY_STAMP\t(KEYDEBUG_KEY | KEYDEBUG_STAMP)\n#define KEYDEBUG_KEY_DATA\t(KEYDEBUG_KEY | KEYDEBUG_DATA)\n#define KEYDEBUG_KEY_DUMP\t(KEYDEBUG_KEY | KEYDEBUG_DUMP)\n#define KEYDEBUG_ALG_STAMP\t(KEYDEBUG_ALG | KEYDEBUG_STAMP)\n#define KEYDEBUG_ALG_DATA\t(KEYDEBUG_ALG | KEYDEBUG_DATA)\n#define KEYDEBUG_ALG_DUMP\t(KEYDEBUG_ALG | KEYDEBUG_DUMP)\n#define KEYDEBUG_IPSEC_STAMP\t(KEYDEBUG_IPSEC | KEYDEBUG_STAMP)\n#define KEYDEBUG_IPSEC_DATA\t(KEYDEBUG_IPSEC | KEYDEBUG_DATA)\n#define KEYDEBUG_IPSEC_DUMP\t(KEYDEBUG_IPSEC | KEYDEBUG_DUMP)\n\n#define KEYDEBUG(lev,arg) \\\n\tdo { if ((V_key_debug_level & (lev)) == (lev)) { arg; } } while (0)\n\nVNET_DECLARE(u_int32_t, key_debug_level);\n#define\tV_key_debug_level\tVNET(key_debug_level)\n#endif /*_KERNEL*/\n\nstruct sadb_msg;\nstruct sadb_ext;\nextern void kdebug_sadb __P((struct sadb_msg *));\nextern void kdebug_sadb_x_policy __P((struct sadb_ext *));\n\n#ifdef _KERNEL\nstruct secpolicy;\nstruct secpolicyindex;\nstruct secasindex;\nstruct secasvar;\nstruct secreplay;\nstruct mbuf;\nextern void kdebug_secpolicy __P((struct secpolicy *));\nextern void kdebug_secpolicyindex __P((struct secpolicyindex *));\nextern void kdebug_secasindex __P((struct secasindex *));\nextern void kdebug_secasv __P((struct secasvar *));\nextern void kdebug_mbufhdr __P((struct mbuf *));\nextern void kdebug_mbuf __P((struct mbuf *));\n#endif /*_KERNEL*/\n\nstruct sockaddr;\nextern void kdebug_sockaddr __P((struct sockaddr *));\n\nextern void ipsec_hexdump __P((caddr_t, int));\nextern void ipsec_bindump __P((caddr_t, int));\n\n#endif /* _NETIPSEC_KEY_DEBUG_H_ */\n"
  },
  {
    "path": "freebsd-headers/netipsec/key_var.h",
    "content": "/*\t$FreeBSD: release/9.0.0/sys/netipsec/key_var.h 157123 2006-03-25 13:38:52Z gnn $\t*/\n/*\t$KAME: key_var.h,v 1.11 2001/09/12 23:05:07 sakane Exp $\t*/\n\n/*-\n * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. Neither the name of the project nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n */\n\n#ifndef _NETIPSEC_KEY_VAR_H_\n#define _NETIPSEC_KEY_VAR_H_\n\n/* sysctl */\n#define KEYCTL_DEBUG_LEVEL\t\t1\n#define KEYCTL_SPI_TRY\t\t\t2\n#define KEYCTL_SPI_MIN_VALUE\t\t3\n#define KEYCTL_SPI_MAX_VALUE\t\t4\n#define KEYCTL_RANDOM_INT\t\t5\n#define KEYCTL_LARVAL_LIFETIME\t\t6\n#define KEYCTL_BLOCKACQ_COUNT\t\t7\n#define KEYCTL_BLOCKACQ_LIFETIME\t8\n#define KEYCTL_ESP_KEYMIN\t\t9\n#define KEYCTL_ESP_AUTH\t\t\t10\n#define KEYCTL_AH_KEYMIN\t\t11\n#define KEYCTL_PREFERED_OLDSA\t\t12\n#define KEYCTL_MAXID\t\t\t13\n\n#define KEYCTL_NAMES { \\\n\t{ 0, 0 }, \\\n\t{ \"debug\", CTLTYPE_INT }, \\\n\t{ \"spi_try\", CTLTYPE_INT }, \\\n\t{ \"spi_min_value\", CTLTYPE_INT }, \\\n\t{ \"spi_max_value\", CTLTYPE_INT }, \\\n\t{ \"random_int\", CTLTYPE_INT }, \\\n\t{ \"larval_lifetime\", CTLTYPE_INT }, \\\n\t{ \"blockacq_count\", CTLTYPE_INT }, \\\n\t{ \"blockacq_lifetime\", CTLTYPE_INT }, \\\n\t{ \"esp_keymin\", CTLTYPE_INT }, \\\n\t{ \"esp_auth\", CTLTYPE_INT }, \\\n\t{ \"ah_keymin\", CTLTYPE_INT }, \\\n\t{ \"prefered_oldsa\", CTLTYPE_INT }, \\\n}\n\n#ifdef _KERNEL\n#define _ARRAYLEN(p) (sizeof(p)/sizeof(p[0]))\n#define _KEYLEN(key) ((u_int)((key)->bits >> 3))\n#define _KEYBITS(key) ((u_int)((key)->bits))\n#define _KEYBUF(key) ((caddr_t)((caddr_t)(key) + sizeof(struct sadb_key)))\n#endif /*_KERNEL*/\n\n#endif /* _NETIPSEC_KEY_VAR_H_ */\n"
  },
  {
    "path": "freebsd-headers/netipsec/keydb.h",
    "content": "/*\t$FreeBSD: release/9.0.0/sys/netipsec/keydb.h 214250 2010-10-23 20:35:40Z bz $\t*/\n/*\t$KAME: keydb.h,v 1.14 2000/08/02 17:58:26 sakane Exp $\t*/\n\n/*-\n * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. Neither the name of the project nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n */\n\n#ifndef _NETIPSEC_KEYDB_H_\n#define _NETIPSEC_KEYDB_H_\n\n#ifdef _KERNEL\n\n#include <netipsec/key_var.h>\n\n#ifndef _SOCKADDR_UNION_DEFINED\n#define\t_SOCKADDR_UNION_DEFINED\n/*\n * The union of all possible address formats we handle.\n */\nunion sockaddr_union {\n\tstruct sockaddr\t\tsa;\n\tstruct sockaddr_in\tsin;\n\tstruct sockaddr_in6\tsin6;\n};\n#endif /* _SOCKADDR_UNION_DEFINED */\n\n/* Security Assocciation Index */\n/* NOTE: Ensure to be same address family */\nstruct secasindex {\n\tunion sockaddr_union src;\t/* source address for SA */\n\tunion sockaddr_union dst;\t/* destination address for SA */\n\tu_int16_t proto;\t\t/* IPPROTO_ESP or IPPROTO_AH */\n\tu_int8_t mode;\t\t\t/* mode of protocol, see ipsec.h */\n\tu_int32_t reqid;\t\t/* reqid id who owned this SA */\n\t\t\t\t\t/* see IPSEC_MANUAL_REQID_MAX. */\n};\n\n/* \n * In order to split out the keydb implementation from that of the\n * PF_KEY sockets we need to define a few structures that while they\n * may seem common are likely to diverge over time. \n */\n\n/* sadb_identity */\nstruct secident {\n\tu_int16_t type;\n\tu_int64_t id;\n};\n\n/* sadb_key */\nstruct seckey {\n\tu_int16_t bits;\n\tchar *key_data;\n};\n\nstruct seclifetime {\n\tu_int32_t allocations;\n\tu_int64_t bytes;\n\tu_int64_t addtime;\n\tu_int64_t usetime;\n};\n\nunion sa_route_union {\n\tstruct route\t\tsa_route;\n\tstruct route\t\tsin_route;\t/* Duplicate for consistency. */\n\tstruct route_in6\tsin6_route;\n};\n\n/* Security Association Data Base */\nstruct secashead {\n\tLIST_ENTRY(secashead) chain;\n\n\tstruct secasindex saidx;\n\n\tstruct secident *idents;\t/* source identity */\n\tstruct secident *identd;\t/* destination identity */\n\t\t\t\t\t/* XXX I don't know how to use them. */\n\n\tu_int8_t state;\t\t\t/* MATURE or DEAD. */\n\tLIST_HEAD(_satree, secasvar) savtree[SADB_SASTATE_MAX+1];\n\t\t\t\t\t/* SA chain */\n\t\t\t\t\t/* The first of this list is newer SA */\n\n\tunion sa_route_union route_cache;\n};\n\nstruct xformsw;\nstruct enc_xform;\nstruct auth_hash;\nstruct comp_algo;\n\n/* Security Association */\nstruct secasvar {\n\tLIST_ENTRY(secasvar) chain;\n\tstruct mtx lock;\t\t/* update/access lock */\n\n\tu_int refcnt;\t\t\t/* reference count */\n\tu_int8_t state;\t\t\t/* Status of this Association */\n\n\tu_int8_t alg_auth;\t\t/* Authentication Algorithm Identifier*/\n\tu_int8_t alg_enc;\t\t/* Cipher Algorithm Identifier */\n\tu_int8_t alg_comp;\t\t/* Compression Algorithm Identifier */\n\tu_int32_t spi;\t\t\t/* SPI Value, network byte order */\n\tu_int32_t flags;\t\t/* holder for SADB_KEY_FLAGS */\n\n\tstruct seckey *key_auth;\t/* Key for Authentication */\n\tstruct seckey *key_enc;\t        /* Key for Encryption */\n\tcaddr_t iv;\t\t\t/* Initilization Vector */\n\tu_int ivlen;\t\t\t/* length of IV */\n\tvoid *sched;\t\t\t/* intermediate encryption key */\n\tsize_t schedlen;\n\n\tstruct secreplay *replay;\t/* replay prevention */\n\ttime_t created;\t\t\t/* for lifetime */\n\n\tstruct seclifetime *lft_c;\t/* CURRENT lifetime, it's constant. */\n\tstruct seclifetime *lft_h;\t/* HARD lifetime */\n\tstruct seclifetime *lft_s;\t/* SOFT lifetime */\n\n\tu_int32_t seq;\t\t\t/* sequence number */\n\tpid_t pid;\t\t\t/* message's pid */\n\n\tstruct secashead *sah;\t\t/* back pointer to the secashead */\n\n\t/*\n\t * NB: Fields with a tdb_ prefix are part of the \"glue\" used\n\t *     to interface to the OpenBSD crypto support.  This was done\n\t *     to distinguish this code from the mainline KAME code.\n\t */\n\tstruct xformsw *tdb_xform;\t/* transform */\n\tstruct enc_xform *tdb_encalgxform;\t/* encoding algorithm */\n\tstruct auth_hash *tdb_authalgxform;\t/* authentication algorithm */\n\tstruct comp_algo *tdb_compalgxform;\t/* compression algorithm */\n\tu_int64_t tdb_cryptoid;\t\t/* crypto session id */\n\n\t/*\n\t * NAT-Traversal.\n\t */\n\tu_int16_t natt_type;\t\t/* IKE/ESP-marker in output. */\n\tu_int16_t natt_esp_frag_len;\t/* MTU for payload fragmentation. */\n};\n\n#define\tSECASVAR_LOCK_INIT(_sav) \\\n\tmtx_init(&(_sav)->lock, \"ipsec association\", NULL, MTX_DEF)\n#define\tSECASVAR_LOCK(_sav)\t\tmtx_lock(&(_sav)->lock)\n#define\tSECASVAR_UNLOCK(_sav)\t\tmtx_unlock(&(_sav)->lock)\n#define\tSECASVAR_LOCK_DESTROY(_sav)\tmtx_destroy(&(_sav)->lock)\n#define\tSECASVAR_LOCK_ASSERT(_sav)\tmtx_assert(&(_sav)->lock, MA_OWNED)\n\n/* replay prevention */\nstruct secreplay {\n\tu_int32_t count;\n\tu_int wsize;\t\t/* window size, i.g. 4 bytes */\n\tu_int32_t seq;\t\t/* used by sender */\n\tu_int32_t lastseq;\t/* used by receiver */\n\tcaddr_t bitmap;\t\t/* used by receiver */\n\tint overflow;\t\t/* overflow flag */\n};\n\n/* socket table due to send PF_KEY messages. */\nstruct secreg {\n\tLIST_ENTRY(secreg) chain;\n\n\tstruct socket *so;\n};\n\n/* acquiring list table. */\nstruct secacq {\n\tLIST_ENTRY(secacq) chain;\n\n\tstruct secasindex saidx;\n\n\tu_int32_t seq;\t\t/* sequence number */\n\ttime_t created;\t\t/* for lifetime */\n\tint count;\t\t/* for lifetime */\n};\n\n/* Sensitivity Level Specification */\n/* nothing */\n\n#define SADB_KILL_INTERVAL\t600\t/* six seconds */\n\n/* secpolicy */\nextern struct secpolicy *keydb_newsecpolicy __P((void));\nextern void keydb_delsecpolicy __P((struct secpolicy *));\n/* secashead */\nextern struct secashead *keydb_newsecashead __P((void));\nextern void keydb_delsecashead __P((struct secashead *));\n/* secasvar */\nextern struct secasvar *keydb_newsecasvar __P((void));\nextern void keydb_refsecasvar __P((struct secasvar *));\nextern void keydb_freesecasvar __P((struct secasvar *));\n/* secreplay */\nextern struct secreplay *keydb_newsecreplay __P((size_t));\nextern void keydb_delsecreplay __P((struct secreplay *));\n/* secreg */\nextern struct secreg *keydb_newsecreg __P((void));\nextern void keydb_delsecreg __P((struct secreg *));\n\n#endif /* _KERNEL */\n\n#endif /* _NETIPSEC_KEYDB_H_ */\n"
  },
  {
    "path": "freebsd-headers/netipsec/keysock.h",
    "content": "/*\t$FreeBSD: release/9.0.0/sys/netipsec/keysock.h 195727 2009-07-16 21:13:04Z rwatson $\t*/\n/*\t$KAME: keysock.h,v 1.8 2000/03/27 05:11:06 sumikawa Exp $\t*/\n\n/*-\n * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. Neither the name of the project nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n */\n\n#ifndef _NETIPSEC_KEYSOCK_H_\n#define _NETIPSEC_KEYSOCK_H_\n\n/* statistics for pfkey socket */\nstruct pfkeystat {\n\t/* kernel -> userland */\n\tu_quad_t out_total;\t\t/* # of total calls */\n\tu_quad_t out_bytes;\t\t/* total bytecount */\n\tu_quad_t out_msgtype[256];\t/* message type histogram */\n\tu_quad_t out_invlen;\t\t/* invalid length field */\n\tu_quad_t out_invver;\t\t/* invalid version field */\n\tu_quad_t out_invmsgtype;\t/* invalid message type field */\n\tu_quad_t out_tooshort;\t\t/* msg too short */\n\tu_quad_t out_nomem;\t\t/* memory allocation failure */\n\tu_quad_t out_dupext;\t\t/* duplicate extension */\n\tu_quad_t out_invexttype;\t/* invalid extension type */\n\tu_quad_t out_invsatype;\t\t/* invalid sa type */\n\tu_quad_t out_invaddr;\t\t/* invalid address extension */\n\t/* userland -> kernel */\n\tu_quad_t in_total;\t\t/* # of total calls */\n\tu_quad_t in_bytes;\t\t/* total bytecount */\n\tu_quad_t in_msgtype[256];\t/* message type histogram */\n\tu_quad_t in_msgtarget[3];\t/* one/all/registered */\n\tu_quad_t in_nomem;\t\t/* memory allocation failure */\n\t/* others */\n\tu_quad_t sockerr;\t\t/* # of socket related errors */\n};\n\n#define KEY_SENDUP_ONE\t\t0\n#define KEY_SENDUP_ALL\t\t1\n#define KEY_SENDUP_REGISTERED\t2\n\n#ifdef _KERNEL\nstruct keycb {\n\tstruct rawcb kp_raw;\t/* rawcb */\n\tint kp_promisc;\t\t/* promiscuous mode */\n\tint kp_registered;\t/* registered socket */\n};\n\nVNET_DECLARE(struct pfkeystat, pfkeystat);\n#define\tV_pfkeystat\t\tVNET(pfkeystat)\n\nextern int key_output(struct mbuf *m, struct socket *so);\nextern int key_usrreq __P((struct socket *,\n\tint, struct mbuf *, struct mbuf *, struct mbuf *));\n\nextern int key_sendup __P((struct socket *, struct sadb_msg *, u_int, int));\nextern int key_sendup_mbuf __P((struct socket *, struct mbuf *, int));\n#endif /* _KERNEL */\n\n#endif /*_NETIPSEC_KEYSOCK_H_*/\n"
  },
  {
    "path": "freebsd-headers/netipsec/xform.h",
    "content": "/*\t$FreeBSD: release/9.0.0/sys/netipsec/xform.h 220206 2011-03-31 15:23:32Z fabient $\t*/\n/*\t$OpenBSD: ip_ipsp.h,v 1.119 2002/03/14 01:27:11 millert Exp $\t*/\n/*-\n * The authors of this code are John Ioannidis (ji@tla.org),\n * Angelos D. Keromytis (kermit@csd.uch.gr),\n * Niels Provos (provos@physnet.uni-hamburg.de) and\n * Niklas Hallqvist (niklas@appli.se).\n *\n * The original version of this code was written by John Ioannidis\n * for BSD/OS in Athens, Greece, in November 1995.\n *\n * Ported to OpenBSD and NetBSD, with additional transforms, in December 1996,\n * by Angelos D. Keromytis.\n *\n * Additional transforms and features in 1997 and 1998 by Angelos D. Keromytis\n * and Niels Provos.\n *\n * Additional features in 1999 by Angelos D. Keromytis and Niklas Hallqvist.\n *\n * Copyright (c) 1995, 1996, 1997, 1998, 1999 by John Ioannidis,\n * Angelos D. Keromytis and Niels Provos.\n * Copyright (c) 1999 Niklas Hallqvist.\n * Copyright (c) 2001, Angelos D. Keromytis.\n *\n * Permission to use, copy, and modify this software with or without fee\n * is hereby granted, provided that this entire notice is included in\n * all copies of any software which is or includes a copy or\n * modification of this software.\n * You may use this code under the GNU public license if you so wish. Please\n * contribute changes back to the authors under this freer than GPL license\n * so that we may further the use of strong encryption without limitations to\n * all.\n *\n * THIS SOFTWARE IS BEING PROVIDED \"AS IS\", WITHOUT ANY EXPRESS OR\n * IMPLIED WARRANTY. IN PARTICULAR, NONE OF THE AUTHORS MAKES ANY\n * REPRESENTATION OR WARRANTY OF ANY KIND CONCERNING THE\n * MERCHANTABILITY OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR\n * PURPOSE.\n */\n\n#ifndef _NETIPSEC_XFORM_H_\n#define _NETIPSEC_XFORM_H_\n\n#include <sys/types.h>\n#include <netinet/in.h>\n#include <opencrypto/xform.h>\n\n#define\tAH_HMAC_HASHLEN\t\t12\t/* 96 bits of authenticator */\n#define\tAH_HMAC_MAXHASHLEN\t(SHA2_512_HASH_LEN/2)\t/* Keep this updated */\n#define\tAH_HMAC_INITIAL_RPL\t1\t/* replay counter initial value */\n\n/*\n * Packet tag assigned on completion of IPsec processing; used\n * to speedup processing when/if the packet comes back for more\n * processing.\n */\nstruct tdb_ident {\n\tu_int32_t spi;\n\tunion sockaddr_union dst;\n\tu_int8_t proto;\n\t/* Cache those two for enc(4) in xform_ipip. */\n\tu_int8_t alg_auth;\n\tu_int8_t alg_enc;\n};\n\n/*\n * Opaque data structure hung off a crypto operation descriptor.\n */\nstruct tdb_crypto {\n\tstruct ipsecrequest\t*tc_isr;\t/* ipsec request state */\n\tu_int32_t\t\ttc_spi;\t\t/* associated SPI */\n\tunion sockaddr_union\ttc_dst;\t\t/* dst addr of packet */\n\tu_int8_t\t\ttc_proto;\t/* current protocol, e.g. AH */\n\tu_int8_t\t\ttc_nxt;\t\t/* next protocol, e.g. IPV4 */\n\tint\t\t\ttc_protoff;\t/* current protocol offset */\n\tint\t\t\ttc_skip;\t/* data offset */\n\tcaddr_t\t\t\ttc_ptr;\t\t/* associated crypto data */\n\tstruct secasvar \t*tc_sav;\t/* related SA */\n};\n\nstruct secasvar;\nstruct ipescrequest;\n\nstruct xformsw {\n\tu_short\txf_type;\t\t/* xform ID */\n#define\tXF_IP4\t\t1\t/* IP inside IP */\n#define\tXF_AH\t\t2\t/* AH */\n#define\tXF_ESP\t\t3\t/* ESP */\n#define\tXF_TCPSIGNATURE\t5\t/* TCP MD5 Signature option, RFC 2358 */\n#define\tXF_IPCOMP\t6\t/* IPCOMP */\n\tu_short\txf_flags;\n#define\tXFT_AUTH\t0x0001\n#define\tXFT_CONF\t0x0100\n#define\tXFT_COMP\t0x1000\n\tchar\t*xf_name;\t\t\t/* human-readable name */\n\tint\t(*xf_init)(struct secasvar*, struct xformsw*);\t/* setup */\n\tint\t(*xf_zeroize)(struct secasvar*);\t\t/* cleanup */\n\tint\t(*xf_input)(struct mbuf*, struct secasvar*,\t/* input */\n\t\t\tint, int);\n\tint\t(*xf_output)(struct mbuf*,\t       \t\t/* output */\n\t\t\tstruct ipsecrequest *, struct mbuf **, int, int);\n\tstruct xformsw *xf_next;\t\t/* list of registered xforms */\n};\n\n#ifdef _KERNEL\nextern void xform_register(struct xformsw*);\nextern int xform_init(struct secasvar *sav, int xftype);\n\nstruct cryptoini;\n\n/* XF_IP4 */\nextern\tint ip4_input6(struct mbuf **m, int *offp, int proto);\nextern\tvoid ip4_input(struct mbuf *m, int);\nextern\tint ipip_output(struct mbuf *, struct ipsecrequest *,\n\t\t\tstruct mbuf **, int, int);\n\n/* XF_AH */\nextern int ah_init0(struct secasvar *, struct xformsw *, struct cryptoini *);\nextern int ah_zeroize(struct secasvar *sav);\nextern struct auth_hash *ah_algorithm_lookup(int alg);\nextern size_t ah_hdrsiz(struct secasvar *);\n\n/* XF_ESP */\nextern struct enc_xform *esp_algorithm_lookup(int alg);\nextern size_t esp_hdrsiz(struct secasvar *sav);\n\n/* XF_COMP */\nextern struct comp_algo *ipcomp_algorithm_lookup(int alg);\n\n#endif /* _KERNEL */\n#endif /* _NETIPSEC_XFORM_H_ */\n"
  },
  {
    "path": "freebsd-headers/netipx/ipx.h",
    "content": "/*-\n * Copyright (c) 1984, 1985, 1986, 1987, 1993\n *\tThe Regents of the University of California.  All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 4. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * Copyright (c) 1995, Mike Mitchell\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. All advertising materials mentioning features or use of this software\n *    must display the following acknowledgement:\n *\tThis product includes software developed by the University of\n *\tCalifornia, Berkeley and its contributors.\n * 4. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t@(#)ipx.h\n *\n * $FreeBSD: release/9.0.0/sys/netipx/ipx.h 170664 2007-06-13 14:01:43Z rwatson $\n */\n\n#ifndef _NETIPX_IPX_H_\n#define\t_NETIPX_IPX_H_\n\n/*\n * Constants and Structures\n */\n\n/*\n * Protocols\n */\n#define IPXPROTO_UNKWN\t\t0\t/* Unknown */\n#define IPXPROTO_RI\t\t1\t/* RIP Routing Information */\n#define IPXPROTO_PXP\t\t4\t/* IPX Packet Exchange Protocol */\n#define IPXPROTO_SPX\t\t5\t/* SPX Sequenced Packet */\n#define IPXPROTO_NCP\t\t17\t/* NCP NetWare Core */\n#define IPXPROTO_NETBIOS\t20\t/* Propagated Packet */\n#define IPXPROTO_RAW\t\t255\t/* Placemarker*/\n#define IPXPROTO_MAX\t\t256\t/* Placemarker*/\n\n/*\n * Port/Socket numbers: network standard functions\n */\n\n#define IPXPORT_RI\t\t1\t/* NS RIP Routing Information */\n#define IPXPORT_ECHO\t\t2\t/* NS Echo */\n#define IPXPORT_RE\t\t3\t/* NS Router Error */\n#define IPXPORT_NCP\t\t0x0451\t/* NW NCP Core Protocol */\n#define IPXPORT_SAP\t\t0x0452\t/* NW SAP Service Advertising */\n#define IPXPORT_RIP\t\t0x0453\t/* NW RIP Routing Information */\n#define IPXPORT_NETBIOS\t\t0x0455\t/* NW NetBIOS */\n#define IPXPORT_DIAGS\t\t0x0456\t/* NW Diagnostics */\n/*\n * Ports < IPXPORT_RESERVED are reserved for privileged\n */\n#define IPXPORT_RESERVED\t0x4000\n/*\n * Ports > IPXPORT_WELLKNOWN are reserved for privileged\n * processes (e.g. root).\n */\n#define IPXPORT_WELLKNOWN\t0x6000\n\n/* flags passed to ipx_outputfl as last parameter */\n\n#define\tIPX_FORWARDING\t\t0x1\t/* most of ipx header exists */\n#define\tIPX_ROUTETOIF\t\t0x10\t/* same as SO_DONTROUTE */\n#define\tIPX_ALLOWBROADCAST\tSO_BROADCAST\t/* can send broadcast packets */\n\n#define IPX_MAXHOPS\t\t15\n\n/* flags passed to get/set socket option */\n#define\tSO_HEADERS_ON_INPUT\t1\n#define\tSO_HEADERS_ON_OUTPUT\t2\n#define\tSO_DEFAULT_HEADERS\t3\n#define\tSO_LAST_HEADER\t\t4\n#define\tSO_IPXIP_ROUTE\t\t5\t/* No longer implemented. */\n#define SO_SEQNO\t\t6\n#define\tSO_ALL_PACKETS\t\t7\n#define SO_MTU\t\t\t8\n#define SO_IPXTUN_ROUTE\t\t9\n#define SO_IPX_CHECKSUM\t\t10\n\n/*\n * IPX addressing\n */\nunion ipx_host {\n\tu_char\tc_host[6];\n\tu_short\ts_host[3];\n};\n\nunion ipx_net {\n\tu_char\tc_net[4];\n\tu_short\ts_net[2];\n};\n\nunion ipx_net_u {\n\tunion\tipx_net\tnet_e;\n\tu_long\t\tlong_e;\n};\n\nstruct ipx_addr {\n\tunion ipx_net\tx_net;\n\tunion ipx_host\tx_host;\n\tu_short\t\tx_port;\n};\n\n/*\n * Socket address\n */\nstruct sockaddr_ipx {\n\tu_char\t\tsipx_len;\n\tu_char\t\tsipx_family;\n\tstruct ipx_addr\tsipx_addr;\n\tchar\t\tsipx_zero[2];\n};\n#define sipx_port sipx_addr.x_port\n\n/*\n * Definitions for IPX Internetwork Packet Exchange Protocol\n */\nstruct ipx {\n\tu_short\tipx_sum;\t/* Checksum */\n\tu_short\tipx_len;\t/* Length, in bytes, including header */\n\tu_char\tipx_tc;\t\t/* Transport Control (i.e. hop count) */\n\tu_char\tipx_pt;\t\t/* Packet Type (i.e. level 2 protocol) */\n\tstruct ipx_addr\tipx_dna;\t/* Destination Network Address */\n\tstruct ipx_addr\tipx_sna;\t/* Source Network Address */\n} __packed;\n\n#define ipx_neteqnn(a,b) \\\n\t(((a).s_net[0] == (b).s_net[0]) && ((a).s_net[1] == (b).s_net[1]))\n#define ipx_neteq(a,b) ipx_neteqnn((a).x_net, (b).x_net)\n#define satoipx_addr(sa) (((struct sockaddr_ipx *)&(sa))->sipx_addr)\n#define ipx_hosteqnh(s,t) ((s).s_host[0] == (t).s_host[0] && \\\n\t(s).s_host[1] == (t).s_host[1] && (s).s_host[2] == (t).s_host[2])\n#define ipx_hosteq(s,t) (ipx_hosteqnh((s).x_host,(t).x_host))\n#define ipx_nullnet(x) (((x).x_net.s_net[0]==0) && ((x).x_net.s_net[1]==0))\n#define ipx_nullhost(x) (((x).x_host.s_host[0] == 0) && \\\n\t((x).x_host.s_host[1] == 0) && ((x).x_host.s_host[2] == 0))\n#define ipx_wildnet(x) (((x).x_net.s_net[0] == 0xffff) && \\\n\t((x).x_net.s_net[1] == 0xffff))\n#define ipx_wildhost(x) (((x).x_host.s_host[0] == 0xffff) && \\\n\t((x).x_host.s_host[1] == 0xffff) && ((x).x_host.s_host[2] == 0xffff))\n\n#include <sys/cdefs.h>\n\n__BEGIN_DECLS\nstruct ipx_addr\t ipx_addr(const char *);\nchar\t\t*ipx_ntoa(struct ipx_addr);\n__END_DECLS\n\n#endif /* !_NETIPX_IPX_H_ */\n"
  },
  {
    "path": "freebsd-headers/netipx/ipx_if.h",
    "content": "/*-\n * Copyright (c) 1984, 1985, 1986, 1987, 1993\n *\tThe Regents of the University of California.  All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 4. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n\n * Copyright (c) 1995, Mike Mitchell\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. All advertising materials mentioning features or use of this software\n *    must display the following acknowledgement:\n *\tThis product includes software developed by the University of\n *\tCalifornia, Berkeley and its contributors.\n * 4. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t@(#)ipx_if.h\n *\n * $FreeBSD: release/9.0.0/sys/netipx/ipx_if.h 194905 2009-06-24 20:57:50Z rwatson $\n */\n\n#ifndef _NETIPX_IPX_IF_H_\n#define\t_NETIPX_IPX_IF_H_\n\n/*\n * Interface address.  One of these structures\n * is allocated for each interface with an internet address.\n * The ifaddr structure contains the protocol-independent part\n * of the structure and is assumed to be first.\n */\n\nstruct ipx_ifaddr {\n\tstruct\tifaddr ia_ifa;\t\t/* protocol-independent info */\n#define\tia_ifp\t\tia_ifa.ifa_ifp\n#define\tia_flags\tia_ifa.ifa_flags\n\tTAILQ_ENTRY(ipx_ifaddr)\tia_link;\t/* list of IPv6 addresses */\n\tstruct\tsockaddr_ipx ia_addr;\t/* reserve space for my address */\n\tstruct\tsockaddr_ipx ia_dstaddr;\t/* space for my broadcast address */\n#define ia_broadaddr\tia_dstaddr\n\tstruct\tsockaddr_ipx ia_netmask;\t/* space for my network mask */\n};\n\nstruct\tipx_aliasreq {\n\tchar\tifra_name[IFNAMSIZ];\t\t/* if name, e.g. \"en0\" */\n\tstruct\tsockaddr_ipx ifra_addr;\n\tstruct\tsockaddr_ipx ifra_broadaddr;\n#define ifra_dstaddr ifra_broadaddr\n};\n\n/*\n * List of ipx_ifaddr's.\n */\nTAILQ_HEAD(ipx_ifaddrhead, ipx_ifaddr);\n\n/*\n * Given a pointer to an ipx_ifaddr (ifaddr),\n * return a pointer to the addr as a sockadd_ipx.\n */\n\n#define\tIA_SIPX(ia) (&(((struct ipx_ifaddr *)(ia))->ia_addr))\n\n/* This is not the right place for this but where is? */\n\n#define ETHERTYPE_IPX_8022\t0x00e0\t/* Ethernet_802.2 */\n#define ETHERTYPE_IPX_8023\t0x0000\t/* Ethernet_802.3 */\n#define ETHERTYPE_IPX_II\t0x8137\t/* Ethernet_II */\n#define ETHERTYPE_IPX_SNAP\t0x8137\t/* Ethernet_SNAP */\n\n#define\tETHERTYPE_IPX\t\t0x8137\t/* Only  Ethernet_II Available */\n\n#ifdef\t_KERNEL\nextern struct rwlock\t\t ipx_ifaddr_rw;\nextern struct ipx_ifaddrhead\t ipx_ifaddrhead;\n\n#define\tIPX_IFADDR_LOCK_INIT()\t\trw_init(&ipx_ifaddr_rw, \"ipx_ifaddr_rw\")\n#define\tIPX_IFADDR_LOCK_ASSERT()\trw_assert(&ipx_ifaddr_rw, RA_LOCKED)\n#define\tIPX_IFADDR_RLOCK()\t\trw_rlock(&ipx_ifaddr_rw)\n#define\tIPX_IFADDR_RUNLOCK()\t\trw_runlock(&ipx_ifaddr_rw)\n#define\tIPX_IFADDR_WLOCK()\t\trw_wlock(&ipx_ifaddr_rw)\n#define\tIPX_IFADDR_WUNLOCK()\t\trw_wunlock(&ipx_ifaddr_rw)\n#define\tIPX_IFADDR_RLOCK_ASSERT()\trw_assert(&ipx_ifaddr_rw, RA_WLOCKED)\n\nstruct ipx_ifaddr\t*ipx_iaonnetof(struct ipx_addr *dst);\n#endif\n\n#endif /* !_NETIPX_IPX_IF_H_ */\n"
  },
  {
    "path": "freebsd-headers/netipx/ipx_pcb.h",
    "content": "/*-\n * Copyright (c) 1984, 1985, 1986, 1987, 1993\n *\tThe Regents of the University of California.\n * Copyright (c) 2004-2006 Robert N. M. Watson\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 4. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * Copyright (c) 1995, Mike Mitchell\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. All advertising materials mentioning features or use of this software\n *    must display the following acknowledgement:\n *\tThis product includes software developed by the University of\n *\tCalifornia, Berkeley and its contributors.\n * 4. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t@(#)ipx_pcb.h\n *\n * $FreeBSD: release/9.0.0/sys/netipx/ipx_pcb.h 169463 2007-05-11 10:38:34Z rwatson $\n */\n\n#ifndef _NETIPX_IPX_PCB_H_\n#define\t_NETIPX_IPX_PCB_H_\n\n/*\n * IPX protocol interface control block.\n */\nstruct ipxpcb {\n\tLIST_ENTRY(ipxpcb) ipxp_list;\n\tstruct\tsocket *ipxp_socket;\t/* back pointer to socket */\n\tstruct\tipx_addr ipxp_faddr;\t/* destination address */\n\tstruct\tipx_addr ipxp_laddr;\t/* socket's address */\n\tcaddr_t\tipxp_pcb;\t\t/* protocol specific stuff */\n\tstruct\troute ipxp_route;\t/* routing information */\n\tstruct\tipx_addr ipxp_lastdst;\t/* validate cached route for dg socks*/\n\tshort\tipxp_flags;\n\tu_char\tipxp_dpt;\t\t/* default packet type for ipx_output */\n\tu_char\tipxp_rpt;\t\t/* last received packet type by ipx_input() */\n\tstruct\tmtx ipxp_mtx;\n};\n\n/*\n * Additional IPX pcb-related types and variables.\n */\nLIST_HEAD(ipxpcbhead, ipxpcb);\nextern struct ipxpcbhead ipxpcb_list;\nextern struct ipxpcbhead ipxrawpcb_list;\n\n#ifdef _KERNEL\nextern struct mtx\tipxpcb_list_mtx;\n#endif\n\n/*\n * IPX/SPX PCB flags.\n */\n#define IPXP_IN_ABORT\t\t0x1\t/* Calling abort through socket. */\n#define IPXP_RAWIN\t\t0x2\t/* Show headers on input. */\n#define IPXP_RAWOUT\t\t0x4\t/* Show header on output. */\n#define IPXP_ALL_PACKETS\t0x8\t/* Turn off higher proto processing. */\n#define\tIPXP_CHECKSUM\t\t0x10\t/* Use checksum on this socket. */\n#define\tIPXP_DROPPED\t\t0x20\t/* Connection dropped. */\n#define\tIPXP_SPX\t\t0x40\t/* SPX PCB. */\n\n#define\tIPX_WILDCARD\t\t1\n\n#define ipxp_lport ipxp_laddr.x_port\n#define ipxp_fport ipxp_faddr.x_port\n\n#define\tsotoipxpcb(so)\t\t((struct ipxpcb *)((so)->so_pcb))\n\n/*\n * Nominal space allocated to an IPX socket.\n */\n#define\tIPXSNDQ\t\t16384\n#define\tIPXRCVQ\t\t40960\n\n#ifdef _KERNEL\nint\tipx_pcballoc(struct socket *so, struct ipxpcbhead *head,\n\t    struct thread *p);\nint\tipx_pcbbind(struct ipxpcb *ipxp, struct sockaddr *nam,\n\t    struct thread *p);\nint\tipx_pcbconnect(struct ipxpcb *ipxp, struct sockaddr *nam,\n\t    struct thread *p);\nvoid\tipx_pcbdetach(struct ipxpcb *ipxp);\nvoid\tipx_pcbdisconnect(struct ipxpcb *ipxp);\nvoid\tipx_pcbfree(struct ipxpcb *ipxp);\nstruct ipxpcb *ipx_pcblookup(struct ipx_addr *faddr, u_short lport, int wildp);\nvoid\tipx_getpeeraddr(struct ipxpcb *ipxp, struct sockaddr **nam);\nvoid\tipx_getsockaddr(struct ipxpcb *ipxp, struct sockaddr **nam);\n\n#define\tIPX_LIST_LOCK_INIT()\tmtx_init(&ipxpcb_list_mtx, \"ipx_list_mtx\", \\\n\t\t\t\t    NULL, MTX_DEF | MTX_RECURSE)\n#define\tIPX_LIST_LOCK()\t\tmtx_lock(&ipxpcb_list_mtx)\n#define\tIPX_LIST_UNLOCK()\tmtx_unlock(&ipxpcb_list_mtx)\n#define\tIPX_LIST_LOCK_ASSERT()\tmtx_assert(&ipxpcb_list_mtx, MA_OWNED)\n\n#define\tIPX_LOCK_INIT(ipx)\tmtx_init(&(ipx)->ipxp_mtx, \"ipx_mtx\", NULL, \\\n\t\t\t\t    MTX_DEF)\n#define\tIPX_LOCK_DESTROY(ipx)\tmtx_destroy(&(ipx)->ipxp_mtx)\n#define\tIPX_LOCK(ipx)\t\tmtx_lock(&(ipx)->ipxp_mtx)\n#define\tIPX_UNLOCK(ipx)\t\tmtx_unlock(&(ipx)->ipxp_mtx)\n#define\tIPX_LOCK_ASSERT(ipx)\tmtx_assert(&(ipx)->ipxp_mtx, MA_OWNED)\n#endif /* _KERNEL */\n\n#endif /* !_NETIPX_IPX_PCB_H_ */\n"
  },
  {
    "path": "freebsd-headers/netipx/ipx_var.h",
    "content": "/*-\n * Copyright (c) 1984, 1985, 1986, 1987, 1993\n *\tThe Regents of the University of California.  All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 4. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * Copyright (c) 1995, Mike Mitchell\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. All advertising materials mentioning features or use of this software\n *    must display the following acknowledgement:\n *\tThis product includes software developed by the University of\n *\tCalifornia, Berkeley and its contributors.\n * 4. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t@(#)ipx_var.h\n *\n * $FreeBSD: release/9.0.0/sys/netipx/ipx_var.h 194591 2009-06-21 16:11:40Z rwatson $\n */\n\n#ifndef _NETIPX_IPX_VAR_H_\n#define _NETIPX_IPX_VAR_H_\n\n/*\n * IPX Kernel Structures and Variables\n */\nstruct\tipxstat {\n\tu_long\tipxs_total;\t\t/* total packets received */\n\tu_long\tipxs_badsum;\t\t/* checksum bad */\n\tu_long\tipxs_tooshort;\t\t/* packet too short */\n\tu_long\tipxs_toosmall;\t\t/* not enough data */\n\tu_long\tipxs_forward;\t\t/* packets forwarded */\n\tu_long\tipxs_cantforward;\t/* packets rcvd for unreachable dest */\n\tu_long\tipxs_delivered;\t\t/* datagrams delivered to upper level*/\n\tu_long\tipxs_localout;\t\t/* total ipx packets generated here */\n\tu_long\tipxs_odropped;\t\t/* lost packets due to nobufs, etc. */\n\tu_long\tipxs_noroute;\t\t/* packets discarded due to no route */\n\tu_long\tipxs_mtutoosmall;\t/* the interface mtu is too small */\n};\n\n#ifdef _KERNEL\n\n#ifdef SYSCTL_DECL\nSYSCTL_DECL(_net_ipx);\nSYSCTL_DECL(_net_ipx_ipx);\n#endif\n\nextern int ipxcksum;\nextern long ipx_pexseq;\nextern struct ipxstat ipxstat;\nextern struct pr_usrreqs ipx_usrreqs;\nextern struct pr_usrreqs ripx_usrreqs;\nextern struct sockaddr_ipx ipx_netmask;\nextern struct sockaddr_ipx ipx_hostmask;\n\nextern const union ipx_net ipx_zeronet;\nextern const union ipx_net ipx_broadnet;\nextern const union ipx_host ipx_broadhost;\n\nstruct ifnet;\nstruct ipx_addr;\nstruct ipxpcb;\nstruct mbuf;\nstruct thread;\nstruct route;\nstruct sockaddr;\nstruct socket;\nstruct sockopt;\n\nu_short\tipx_cksum(struct mbuf *m, int len);\nint\tipx_control(struct socket *so, u_long cmd, caddr_t data,\n\t    struct ifnet *ifp, struct thread *td);\nvoid\tipx_ctlinput(int cmd, struct sockaddr *arg_as_sa, void *dummy);\nint\tipx_ctloutput(struct socket *so, struct sockopt *sopt);\nvoid\tipx_drop(struct ipxpcb *ipxp, int errno);\nvoid\tipx_init(void);\nvoid\tipx_input(struct mbuf *m, struct ipxpcb *ipxp);\nint\tipx_outputfl(struct mbuf *m0, struct route *ro, int flags);\nint\tipx_output_type20(struct mbuf *);\nint\tipx_peeraddr(struct socket *so, struct sockaddr **nam);\nvoid\tipx_printhost(struct ipx_addr *addr);\nint\tipx_sockaddr(struct socket *so, struct sockaddr **nam);\n\n#endif /* _KERNEL */\n\n#endif /* !_NETIPX_IPX_VAR_H_ */\n"
  },
  {
    "path": "freebsd-headers/netipx/spx.h",
    "content": "/*-\n * Copyright (c) 1984, 1985, 1986, 1987, 1993\n *\tThe Regents of the University of California.  All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 4. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * Copyright (c) 1995, Mike Mitchell\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. All advertising materials mentioning features or use of this software\n *    must display the following acknowledgement:\n *\tThis product includes software developed by the University of\n *\tCalifornia, Berkeley and its contributors.\n * 4. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t@(#)spx.h\n *\n * $FreeBSD: release/9.0.0/sys/netipx/spx.h 194547 2009-06-20 18:24:25Z rwatson $\n */\n\n#ifndef _NETIPX_SPX_H_\n#define\t_NETIPX_SPX_H_\n\n/*\n * Definitions for IPX style Sequenced Packet Protocol\n */\n\nstruct spxhdr {\n\tu_char\tspx_cc;\t\t/* connection control */\n\tu_char\tspx_dt;\t\t/* datastream type */\n#define\tSPX_SP\t0x80\t\t/* system packet */\n#define\tSPX_SA\t0x40\t\t/* send acknowledgement */\n#define\tSPX_OB\t0x20\t\t/* attention (out of band data) */\n#define\tSPX_EM\t0x10\t\t/* end of message */\n\tu_short\tspx_sid;\t/* source connection identifier */\n\tu_short\tspx_did;\t/* destination connection identifier */\n\tu_short\tspx_seq;\t/* sequence number */\n\tu_short\tspx_ack;\t/* acknowledge number */\n\tu_short\tspx_alo;\t/* allocation number */\n} __packed;\n\n/*\n * Definitions for NS(tm) Internet Datagram Protocol\n * containing a Sequenced Packet Protocol packet.\n */\nstruct spx {\n\tstruct ipx\tsi_i;\n\tstruct spxhdr \tsi_s;\n} __packed;\nstruct spx_q {\n\tstruct mbuf\t\t*sq_msi;\n\tstruct spx\t\t*sq_si;\n\tLIST_ENTRY(spx_q)\t sq_entry;\n};\n#define SI(x)\t((struct spx *)x)\n#define si_sum\tsi_i.ipx_sum\n#define si_len\tsi_i.ipx_len\n#define si_tc\tsi_i.ipx_tc\n#define si_pt\tsi_i.ipx_pt\n#define si_dna\tsi_i.ipx_dna\n#define si_sna\tsi_i.ipx_sna\n#define si_sport\tsi_i.ipx_sna.x_port\n#define si_cc\tsi_s.spx_cc\n#define si_dt\tsi_s.spx_dt\n#define si_sid\tsi_s.spx_sid\n#define si_did\tsi_s.spx_did\n#define si_seq\tsi_s.spx_seq\n#define si_ack\tsi_s.spx_ack\n#define si_alo\tsi_s.spx_alo\n\n/*\n * SPX control block, one per connection\n */\nstruct spxpcb {\n\tLIST_HEAD(, spx_q)\ts_q;\t/* queue for out-of-order receipt */\n\tstruct\tipxpcb\t*s_ipxpcb;\t/* backpointer to internet pcb */\n\tu_char\ts_state;\n\tu_char\ts_flags;\n#define\tSF_ACKNOW\t0x01\t\t/* Ack peer immediately */\n#define\tSF_DELACK\t0x02\t\t/* Ack, but try to delay it */\n#define\tSF_HI\t0x04\t\t\t/* Show headers on input */\n#define\tSF_HO\t0x08\t\t\t/* Show headers on output */\n#define\tSF_PI\t0x10\t\t\t/* Packet (datagram) interface */\n#define SF_WIN\t0x20\t\t\t/* Window info changed */\n#define SF_RXT\t0x40\t\t\t/* Rxt info changed */\n#define SF_RVD\t0x80\t\t\t/* Calling from read usrreq routine */\n\tu_short s_mtu;\t\t\t/* Max packet size for this stream */\n/* use sequence fields in headers to store sequence numbers for this\n   connection */\n\tstruct\tipx\ts_ipx;\n\tstruct\tspxhdr\ts_shdr;\t\t/* prototype header to transmit */\n#define s_cc s_shdr.spx_cc\t\t/* connection control (for EM bit) */\n#define s_dt s_shdr.spx_dt\t\t/* datastream type */\n#define s_sid s_shdr.spx_sid\t\t/* source connection identifier */\n#define s_did s_shdr.spx_did\t\t/* destination connection identifier */\n#define s_seq s_shdr.spx_seq\t\t/* sequence number */\n#define s_ack s_shdr.spx_ack\t\t/* acknowledge number */\n#define s_alo s_shdr.spx_alo\t\t/* allocation number */\n#define s_dport s_ipx.ipx_dna.x_port\t/* where we are sending */\n\tstruct spxhdr s_rhdr;\t\t/* last received header (in effect!)*/\n\tu_short s_rack;\t\t\t/* their acknowledge number */\n\tu_short s_ralo;\t\t\t/* their allocation number */\n\tu_short s_smax;\t\t\t/* highest packet # we have sent */\n\tu_short\ts_snxt;\t\t\t/* which packet to send next */\n\n/* congestion control */\n#define\tCUNIT\t1024\t\t\t/* scaling for ... */\n\tint\ts_cwnd;\t\t\t/* Congestion-controlled window */\n\t\t\t\t\t/* in packets * CUNIT */\n\tshort\ts_swnd;\t\t\t/* == tcp snd_wnd, in packets */\n\tshort\ts_smxw;\t\t\t/* == tcp max_sndwnd */\n\t\t\t\t\t/* difference of two spx_seq's can be\n\t\t\t\t\t   no bigger than a short */\n\tu_short\ts_swl1;\t\t\t/* == tcp snd_wl1 */\n\tu_short\ts_swl2;\t\t\t/* == tcp snd_wl2 */\n\tint\ts_cwmx;\t\t\t/* max allowable cwnd */\n\tint\ts_ssthresh;\t\t/* s_cwnd size threshold for\n\t\t\t\t\t * slow start exponential-to-\n\t\t\t\t\t * linear switch */\n/* transmit timing stuff\n * srtt and rttvar are stored as fixed point, for convenience in smoothing.\n * srtt has 3 bits to the right of the binary point, rttvar has 2.\n */\n\tshort\ts_idle;\t\t\t/* time idle */\n#define\tSPXT_NTIMERS\t4\n\tshort\ts_timer[SPXT_NTIMERS];\t/* timers */\n\tshort\ts_rxtshift;\t\t/* log(2) of rexmt exp. backoff */\n\tshort\ts_rxtcur;\t\t/* current retransmit value */\n\tu_short\ts_rtseq;\t\t/* packet being timed */\n\tshort\ts_rtt;\t\t\t/* timer for round trips */\n\tshort\ts_srtt;\t\t\t/* averaged timer */\n\tshort\ts_rttvar;\t\t/* variance in round trip time */\n\tchar\ts_force;\t\t/* which timer expired */\n\tchar\ts_dupacks;\t\t/* counter to intuit xmt loss */\n\n/* out of band data */\n\tchar\ts_oobflags;\n#define SF_SOOB\t0x08\t\t\t/* sending out of band data */\n#define SF_IOOB 0x10\t\t\t/* receiving out of band data */\n\tchar\ts_iobc;\t\t\t/* input characters */\n/* debug stuff */\n\tu_short\ts_want;\t\t\t/* Last candidate for sending */\n\tchar\ts_outx;\t\t\t/* exit taken from spx_output */\n\tchar\ts_inx;\t\t\t/* exit taken from spx_input */\n\tu_short\ts_flags2;\t\t/* more flags for testing */\n#define SF_NEWCALL\t0x100\t\t/* for new_recvmsg */\n#define SO_NEWCALL\t10\t\t/* for new_recvmsg */\n};\n\n#define\tipxtospxpcb(np)\t((struct spxpcb *)(np)->ipxp_pcb)\n#define\tsotospxpcb(so)\t(ipxtospxpcb(sotoipxpcb(so)))\n\n#ifdef _KERNEL\n\nextern struct pr_usrreqs spx_usrreqs;\nextern struct pr_usrreqs spx_usrreq_sps;\n\nvoid\tspx_ctlinput(int cmd, struct sockaddr *arg_as_sa, void *dummy);\nint\tspx_ctloutput(struct socket *so, struct sockopt *sopt);\nvoid\tspx_fasttimo(void);\nvoid\tspx_init(void);\nvoid\tspx_input(struct mbuf *m, struct ipxpcb *ipxp);\nvoid\tspx_slowtimo(void);\n\n#endif /* _KERNEL */\n\n#endif /* !_NETIPX_SPX_H_ */\n"
  },
  {
    "path": "freebsd-headers/netipx/spx_debug.h",
    "content": "/*-\n * Copyright (c) 1984, 1985, 1986, 1987, 1993\n *\tThe Regents of the University of California.  All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 4. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * Copyright (c) 1995, Mike Mitchell\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. All advertising materials mentioning features or use of this software\n *    must display the following acknowledgement:\n *\tThis product includes software developed by the University of\n *\tCalifornia, Berkeley and its contributors.\n * 4. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t@(#)spx_debug.h\n *\n * $FreeBSD: release/9.0.0/sys/netipx/spx_debug.h 171656 2007-07-30 11:06:42Z des $\n */\n\n#ifndef _NETIPX_SPX_DEBUG_H_\n#define\t_NETIPX_SPX_DEBUG_H_\n\nstruct\tspx_debug {\n\tu_long\tsd_time;\n\tshort\tsd_act;\n\tshort\tsd_ostate;\n\tcaddr_t\tsd_cb;\n\tshort\tsd_req;\n\tstruct\tspx sd_si;\n\tstruct\tspxpcb sd_sp;\n};\n\n#define\tSA_INPUT \t0\n#define\tSA_OUTPUT\t1\n#define\tSA_USER\t\t2\n#define\tSA_RESPOND\t3\n#define\tSA_DROP\t\t4\n\n#ifdef SANAMES\nconst char *spxnames[] =\n    { \"input\", \"output\", \"user\", \"respond\", \"drop\" };\n#endif\n\n#define\tSPX_NDEBUG 100\n#ifndef _KERNEL\n/* XXX common variables for broken applications. */\nstruct\tspx_debug spx_debug[SPX_NDEBUG];\nint\tspx_debx;\n#endif\n\n#ifdef _KERNEL\nextern char *prurequests[];\nextern char *sanames[];\n\nvoid\tspx_trace(short act, u_char ostate, struct spxpcb *sp, struct spx *si,\n\t    int req);\n#endif\n\n#endif /* !_NETIPX_SPX_DEBUG_H_ */\n"
  },
  {
    "path": "freebsd-headers/netipx/spx_timer.h",
    "content": "/*-\n * Copyright (c) 1982, 1986, 1988, 1993\n *\tThe Regents of the University of California.  All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 4. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * Copyright (c) 1995, Mike Mitchell\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. All advertising materials mentioning features or use of this software\n *    must display the following acknowledgement:\n *\tThis product includes software developed by the University of\n *\tCalifornia, Berkeley and its contributors.\n * 4. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t@(#)spx_timer.h\n *\n * $FreeBSD: release/9.0.0/sys/netipx/spx_timer.h 165899 2007-01-08 22:14:00Z rwatson $\n */\n\n#ifndef _NETIPX_SPX_TIMER_H_\n#define _NETIPX_SPX_TIMER_H_\n\n/*\n * Definitions of the SPX timers.  These timers are counted\n * down PR_SLOWHZ times a second.\n */\n#define\tSPXT_REXMT\t0\t\t/* retransmit */\n#define\tSPXT_PERSIST\t1\t\t/* retransmit persistence */\n#define\tSPXT_KEEP\t2\t\t/* keep alive */\n#define\tSPXT_2MSL\t3\t\t/* 2*msl quiet time timer */\n\n/*\n * The SPXT_REXMT timer is used to force retransmissions.\n * The SPX has the SPXT_REXMT timer set whenever segments\n * have been sent for which ACKs are expected but not yet\n * received.  If an ACK is received which advances tp->snd_una,\n * then the retransmit timer is cleared (if there are no more\n * outstanding segments) or reset to the base value (if there\n * are more ACKs expected).  Whenever the retransmit timer goes off,\n * we retransmit one unacknowledged segment, and do a backoff\n * on the retransmit timer.\n *\n * The SPXT_PERSIST timer is used to keep window size information\n * flowing even if the window goes shut.  If all previous transmissions\n * have been acknowledged (so that there are no retransmissions in progress),\n * and the window is too small to bother sending anything, then we start\n * the SPXT_PERSIST timer.  When it expires, if the window is nonzero,\n * we go to transmit state.  Otherwise, at intervals send a single byte\n * into the peer's window to force him to update our window information.\n * We do this at most as often as SPXT_PERSMIN time intervals,\n * but no more frequently than the current estimate of round-trip\n * packet time.  The SPXT_PERSIST timer is cleared whenever we receive\n * a window update from the peer.\n *\n * The SPXT_KEEP timer is used to keep connections alive.  If an\n * connection is idle (no segments received) for SPXTV_KEEP amount of time,\n * but not yet established, then we drop the connection.  If the connection\n * is established, then we force the peer to send us a segment by sending:\n *\t<SEQ=SND.UNA-1><ACK=RCV.NXT><CTL=ACK>\n * This segment is (deliberately) outside the window, and should elicit\n * an ack segment in response from the peer.  If, despite the SPXT_KEEP\n * initiated segments we cannot elicit a response from a peer in SPXT_MAXIDLE\n * amount of time, then we drop the connection.\n */\n\n#define\tSPX_TTL\t\t30\t\t/* default time to live for SPX segs */\n/*\n * Time constants.\n */\n#define\tSPXTV_MSL\t( 15*PR_SLOWHZ)\t\t/* max seg lifetime */\n#define\tSPXTV_SRTTBASE\t0\t\t\t/* base roundtrip time;\n\t\t\t\t\t\t   if 0, no idea yet */\n#define\tSPXTV_SRTTDFLT\t(  3*PR_SLOWHZ)\t\t/* assumed RTT if no info */\n\n#define\tSPXTV_PERSMIN\t(  5*PR_SLOWHZ)\t\t/* retransmit persistence */\n#define\tSPXTV_PERSMAX\t( 60*PR_SLOWHZ)\t\t/* maximum persist interval */\n\n#define\tSPXTV_KEEP\t( 75*PR_SLOWHZ)\t\t/* keep alive - 75 secs */\n#define\tSPXTV_MAXIDLE\t(  8*SPXTV_KEEP)\t/* maximum allowable idle\n\t\t\t\t\t\t   time before drop conn */\n\n#define\tSPXTV_MIN\t(  1*PR_SLOWHZ)\t\t/* minimum allowable value */\n#define\tSPXTV_REXMTMAX\t( 64*PR_SLOWHZ)\t\t/* max allowable REXMT value */\n\n#define\tSPX_LINGERTIME\t120\t\t\t/* linger at most 2 minutes */\n\n#define\tSPX_MAXRXTSHIFT\t12\t\t\t/* maximum retransmits */\n\n#ifdef\tSPXTIMERS\nchar *spxtimers[] =\n    { \"REXMT\", \"PERSIST\", \"KEEP\", \"2MSL\" };\n#endif\n\n/*\n * Force a time value to be in a certain range.\n */\n#define\tSPXT_RANGESET(tv, value, tvmin, tvmax) { \\\n\t(tv) = (value); \\\n\tif ((tv) < (tvmin)) \\\n\t\t(tv) = (tvmin); \\\n\telse if ((tv) > (tvmax)) \\\n\t\t(tv) = (tvmax); \\\n}\n\n#endif /* !_NETIPX_SPX_TIMER_H_ */\n"
  },
  {
    "path": "freebsd-headers/netipx/spx_var.h",
    "content": "/*-\n * Copyright (c) 1984, 1985, 1986, 1987, 1993\n *\tThe Regents of the University of California.  All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 4. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * Copyright (c) 1995, Mike Mitchell\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. All advertising materials mentioning features or use of this software\n *    must display the following acknowledgement:\n *\tThis product includes software developed by the University of\n *\tCalifornia, Berkeley and its contributors.\n * 4. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t@(#)spx_var.h\n *\n * $FreeBSD: release/9.0.0/sys/netipx/spx_var.h 194547 2009-06-20 18:24:25Z rwatson $\n */\n\n#ifndef _NETIPX_SPX_VAR_H_\n#define _NETIPX_SPX_VAR_H_\n\nstruct\tspxstat {\n\tlong\tspxs_connattempt;\t/* connections initiated */\n\tlong\tspxs_accepts;\t\t/* connections accepted */\n\tlong\tspxs_connects;\t\t/* connections established */\n\tlong\tspxs_drops;\t\t/* connections dropped */\n\tlong\tspxs_conndrops;\t\t/* embryonic connections dropped */\n\tlong\tspxs_closed;\t\t/* conn. closed (includes drops) */\n\tlong\tspxs_segstimed;\t\t/* segs where we tried to get rtt */\n\tlong\tspxs_rttupdated;\t/* times we succeeded */\n\tlong\tspxs_delack;\t\t/* delayed acks sent */\n\tlong\tspxs_timeoutdrop;\t/* conn. dropped in rxmt timeout */\n\tlong\tspxs_rexmttimeo;\t/* retransmit timeouts */\n\tlong\tspxs_persisttimeo;\t/* persist timeouts */\n\tlong\tspxs_keeptimeo;\t\t/* keepalive timeouts */\n\tlong\tspxs_keepprobe;\t\t/* keepalive probes sent */\n\tlong\tspxs_keepdrops;\t\t/* connections dropped in keepalive */\n\n\tlong\tspxs_sndtotal;\t\t/* total packets sent */\n\tlong\tspxs_sndpack;\t\t/* data packets sent */\n\tlong\tspxs_sndbyte;\t\t/* data bytes sent */\n\tlong\tspxs_sndrexmitpack;\t/* data packets retransmitted */\n\tlong\tspxs_sndrexmitbyte;\t/* data bytes retransmitted */\n\tlong\tspxs_sndacks;\t\t/* ack-only packets sent */\n\tlong\tspxs_sndprobe;\t\t/* window probes sent */\n\tlong\tspxs_sndurg;\t\t/* packets sent with URG only */\n\tlong\tspxs_sndwinup;\t\t/* window update-only packets sent */\n\tlong\tspxs_sndctrl;\t\t/* control (SYN|FIN|RST) packets sent */\n\tlong\tspxs_sndvoid;\t\t/* couldn't find requested packet*/\n\n\tlong\tspxs_rcvtotal;\t\t/* total packets received */\n\tlong\tspxs_rcvpack;\t\t/* packets received in sequence */\n\tlong\tspxs_rcvbyte;\t\t/* bytes received in sequence */\n\tlong\tspxs_rcvbadsum;\t\t/* packets received with ccksum errs */\n\tlong\tspxs_rcvbadoff;\t\t/* packets received with bad offset */\n\tlong\tspxs_rcvshort;\t\t/* packets received too short */\n\tlong\tspxs_rcvduppack;\t/* duplicate-only packets received */\n\tlong\tspxs_rcvdupbyte;\t/* duplicate-only bytes received */\n\tlong\tspxs_rcvpartduppack;\t/* packets with some duplicate data */\n\tlong\tspxs_rcvpartdupbyte;\t/* dup. bytes in part-dup. packets */\n\tlong\tspxs_rcvoopack;\t\t/* out-of-order packets received */\n\tlong\tspxs_rcvoobyte;\t\t/* out-of-order bytes received */\n\tlong\tspxs_rcvpackafterwin;\t/* packets with data after window */\n\tlong\tspxs_rcvbyteafterwin;\t/* bytes rcvd after window */\n\tlong\tspxs_rcvafterclose;\t/* packets rcvd after \"close\" */\n\tlong\tspxs_rcvwinprobe;\t/* rcvd window probe packets */\n\tlong\tspxs_rcvdupack;\t\t/* rcvd duplicate acks */\n\tlong\tspxs_rcvacktoomuch;\t/* rcvd acks for unsent data */\n\tlong\tspxs_rcvackpack;\t/* rcvd ack packets */\n\tlong\tspxs_rcvackbyte;\t/* bytes acked by rcvd acks */\n\tlong\tspxs_rcvwinupd;\t\t/* rcvd window update packets */\n};\nstruct\tspx_istat {\n\tshort\thdrops;\n\tshort\tbadsum;\n\tshort\tbadlen;\n\tshort\tslotim;\n\tshort\tfastim;\n\tshort\tnonucn;\n\tshort\tnoconn;\n\tshort\tnotme;\n\tshort\twrncon;\n\tshort\tbdreas;\n\tshort\tgonawy;\n\tshort\tnotyet;\n\tshort\tlstdup;\n\tstruct spxstat newstats;\n};\n\n#define\tSPX_ISSINCR\t128\n/*\n * spx sequence numbers are 16 bit integers operated\n * on with modular arithmetic.  These macros can be\n * used to compare such integers.\n */\n#define\tSSEQ_LT(a,b)\t(((short)((a)-(b))) < 0)\n#define\tSSEQ_LEQ(a,b)\t(((short)((a)-(b))) <= 0)\n#define\tSSEQ_GT(a,b)\t(((short)((a)-(b))) > 0)\n#define\tSSEQ_GEQ(a,b)\t(((short)((a)-(b))) >= 0)\n\n#ifdef _KERNEL\n/* Following was struct spxstat spxstat; */\n#ifndef spxstat\n#define\tspxstat\tspx_istat.newstats\n#endif\nextern struct spx_istat\tspx_istat;\nextern u_short\tspx_newchecks[50];\n\nint\tspx_output(struct spxpcb *cb, struct mbuf *m0);\nint\tspx_reass(struct spxpcb *cb, struct mbuf *msi, struct spx *si);\nvoid\tspx_reass_flush(struct spxpcb *cb);\nvoid\tspx_reass_init(struct spxpcb *cb);\n#endif\n\n#endif /* !_NETIPX_SPX_VAR_H_ */\n"
  },
  {
    "path": "freebsd-headers/netnatm/addr.h",
    "content": "/*\n * Copyright (c) 1996-2003\n *\tFraunhofer Institute for Open Communication Systems (FhG Fokus).\n * \tAll rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * Author: Hartmut Brandt <harti@freebsd.org>\n *\n * $Begemot: libunimsg/netnatm/addr.h,v 1.3 2004/07/08 08:21:45 brandt Exp $\n */\n#ifndef _NETNATM_ADDR_H_\n#define _NETNATM_ADDR_H_\n\nint uni_str2nsap(u_char *, const char *);\nvoid uni_nsap2str(char *, const u_char *, int);\n\nvoid uni_prefix2str(char *, const u_char *, u_int, int);\n\nint uni_e1642nsap(u_char *, const char *);\nint uni_nsap2e164(char *, const u_char *, int);\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/netnatm/api/atmapi.h",
    "content": "/*\n * Copyright (c) 2003-2004\n *\tHartmut Brandt\n *\tAll rights reserved.\n *\n * Copyright (c) 2001-2002\n *\tFraunhofer Institute for Open Communication Systems (FhG Fokus).\n *\tAll rights reserved.\n *\n * Author: Harti Brandt <harti@freebsd.org>\n *\n * Redistribution of this software and documentation and use in source and\n * binary forms, with or without modification, are permitted provided that\n * the following conditions are met:\n *\n * 1. Redistributions of source code or documentation must retain the above\n *    copyright notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE AND DOCUMENTATION IS PROVIDED BY THE AUTHORS\n * AND ITS CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,\n * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND\n * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL\n * THE AUTHORS OR ITS CONTRIBUTORS  BE LIABLE FOR ANY DIRECT, INDIRECT,\n * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,\n * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF\n * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING\n * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,\n * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n *\n * $Begemot: libunimsg/netnatm/api/atmapi.h,v 1.1 2004/07/08 08:21:48 brandt Exp $\n *\n * ATM API as defined per af-saa-0108\n */\n#ifndef _NETNATM_API_ATMAPI_H_\n#define _NETNATM_API_ATMAPI_H_\n\n#include <sys/types.h>\n\n/* size of an endpointlen including trailing \\0 */\n#define\tATM_EPNAMSIZ\t65\n\nenum atmstate {\n\tATM_A0,\t\t/* non existent */\n\tATM_A1,\t\t/* initial */\n\tATM_A2,\t\t/* outgoing call preparation */\n\tATM_A3,\t\t/* outgoing call requested */\n\tATM_A4,\t\t/* incoming call preparation */\n\tATM_A5,\t\t/* wait incoming call */\n\tATM_A6,\t\t/* incoming call present */\n\tATM_A7,\t\t/* incoming call requested */\n\tATM_A8,\t\t/* p2p data transfer */\n\tATM_A9,\t\t/* p2mp root data transfer */\n\tATM_A10,\t/* p2mp leaf data transfer */\n\tATM_A11,\t/* terminated */\n};\n\nenum atmop {\n\tATMOP_RESP,\t\t\t\t/* 0 */\n\tATMOP_ABORT_CONNECTION,\n\tATMOP_ACCEPT_INCOMING_CALL,\n\tATMOP_ADD_PARTY,\n\tATMOP_ADD_PARTY_REJECT,\n\tATMOP_ADD_PARTY_SUCCESS,\t\t/* 5 */\n\tATMOP_ARRIVAL_OF_INCOMING_CALL,\n\tATMOP_CALL_RELEASE,\n\tATMOP_CONNECT_OUTGOING_CALL,\n\tATMOP_DROP_PARTY,\n\tATMOP_GET_LOCAL_PORT_INFO,\t\t/* 10 */\n\tATMOP_P2MP_CALL_ACTIVE,\n\tATMOP_P2P_CALL_ACTIVE,\n\tATMOP_PREPARE_INCOMING_CALL,\n\tATMOP_PREPARE_OUTGOING_CALL,\n\tATMOP_QUERY_CONNECTION_ATTRIBUTES,\t/* 15 */\n\tATMOP_REJECT_INCOMING_CALL,\n\tATMOP_SET_CONNECTION_ATTRIBUTES,\n\tATMOP_WAIT_ON_INCOMING_CALL,\n\tATMOP_SET_CONNECTION_ATTRIBUTES_X,\n\tATMOP_QUERY_CONNECTION_ATTRIBUTES_X,\t/* 20 */\n\tATMOP_QUERY_STATE,\n};\n\n#define ATM_DEFINE_ERRORS\t\t\t\t\t\t\\\n   DEF(ATMERR_OK,\t\t 0, \"OK\")\t\t\t\t\\\n   DEF(ATMERR_SYS,\t\t-1, \"syscall error\")\t\t\t\\\n   DEF(ATMERR_BAD_OP,\t\t-2, \"bad operation\")\t\t\t\\\n   DEF(ATMERR_BAD_ARGS,\t\t-3, \"bad arguments for operation\")\t\\\n   DEF(ATMERR_BAD_STATE,\t-4, \"operation in bad state\")\t\t\\\n   DEF(ATMERR_BAD_ATTR,\t\t-5, \"unknown attribute\")\t\t\\\n   DEF(ATMERR_BAD_VALUE,\t-6, \"bad attribute value\")\t\t\\\n   DEF(ATMERR_BUSY,\t\t-7, \"busy\")\t\t\t\t\\\n   DEF(ATMERR_RDONLY,\t\t-8, \"read-only attribute\")\t\t\\\n   DEF(ATMERR_BAD_SAP,\t\t-9, \"bad SAP\")\t\t\t\t\\\n   DEF(ATMERR_OVERLAP,\t\t-10,\"overlaping SAP\")\t\t\t\\\n   DEF(ATMERR_BAD_ENDPOINT,\t-11,\"bad ATM endpoint\")\t\t\t\\\n   DEF(ATMERR_PREVIOUSLY_ABORTED,-12,\"previously aborted\")\t\t\\\n   DEF(ATMERR_NO_CALL,\t\t-13,\"no incoming call\")\t\t\t\\\n   DEF(ATMERR_BAD_LEAF_IDENT,\t-14,\"bad leaf identifier\")\t\t\\\n   DEF(ATMERR_BAD_PORT,\t\t-15,\"unknown port\")\t\t\t\\\n   DEF(ATMERR_BAD_SIGNAL,\t-29-UNIAPI_ERROR_BAD_SIGNAL, \"bad signal\")\\\n   DEF(ATMERR_BADCU,\t\t-29-UNIAPI_ERROR_BADCU, \"bad coordinator state\")\\\n   DEF(ATMERR_BAD_CALLSTATE,\t-29-UNIAPI_ERROR_BAD_CALLSTATE, \"bad call state\")\\\n   DEF(ATMERR_BAD_EPSTATE,\t-29-UNIAPI_ERROR_BAD_EPSTATE, \"bad party state\")\\\n   DEF(ATMERR_BAD_UNIARG,\t-29-UNIAPI_ERROR_BAD_ARG, \"bad uni argument\")\\\n   DEF(ATMERR_BAD_CALL,\t\t-29-UNIAPI_ERROR_BAD_CALL, \"unknown call\")\\\n   DEF(ATMERR_BAD_PARTY,\t-29-UNIAPI_ERROR_BAD_PARTY, \"unknown party\")\\\n   DEF(ATMERR_BAD_CTYPE,\t-29-UNIAPI_ERROR_BAD_CTYPE, \"wrong call type\")\\\n   DEF(ATMERR_BAD_IE,\t\t-29-UNIAPI_ERROR_BAD_IE, \"bad information element\")\\\n   DEF(ATMERR_EPREF_INUSE,\t-29-UNIAPI_ERROR_EPREF_INUSE, \"endpoint reference in use\")\\\n   DEF(ATMERR_MISSING_IE,\t-29-UNIAPI_ERROR_MISSING_IE, \"missing information element\")\\\n   DEF(ATMERR_ENCODING,\t\t-29-UNIAPI_ERROR_ENCODING, \"encoding error\")\\\n   DEF(ATMERR_NOMEM,\t\t-29-UNIAPI_ERROR_NOMEM, \"no memory\")\\\n   DEF(ATMERR_UNIBUSY,\t\t-29-UNIAPI_ERROR_BUSY, \"uni process busy\")\n\n#define ATM_MKUNIERR(E)\t(-29 - (E))\n\nenum atm_error {\n#define DEF(NAME,VAL,STR)\tNAME = (VAL),\nATM_DEFINE_ERRORS\n#undef DEF\n};\n\nenum atm_attribute {\n\tATM_ATTR_NONE = 0,\n\tATM_ATTR_BLLI_SELECTOR,\n\tATM_ATTR_BLLI,\n\tATM_ATTR_BEARER,\n\tATM_ATTR_TRAFFIC,\n\tATM_ATTR_QOS,\n\tATM_ATTR_EXQOS,\n\tATM_ATTR_CALLED,\n\tATM_ATTR_CALLEDSUB,\n\tATM_ATTR_CALLING,\n\tATM_ATTR_CALLINGSUB,\n\tATM_ATTR_AAL,\n\tATM_ATTR_EPREF,\n\tATM_ATTR_CONNED,\n\tATM_ATTR_CONNEDSUB,\n\tATM_ATTR_EETD,\n\tATM_ATTR_ABRSETUP,\n\tATM_ATTR_ABRADD,\n\tATM_ATTR_CONNID,\n\tATM_ATTR_MDCR,\n};\n\nstruct atm_resp {\n\tint32_t\t\tresp;\n\tuint32_t\tdata;\t\t/* type of attached data */\n};\nenum {\n\tATMRESP_NONE,\t\t\t/* no data */\n\tATMRESP_ATTRS,\t\t\t/* attribute(s) */\n\tATMRESP_PORTS,\t\t\t/* port info */\n\tATMRESP_STATE,\t\t\t/* endpoint state */\n\tATMRESP_EXSTAT,\t\t\t/* extended status */\n};\n\nstruct atm_abort_connection {\n\tstruct uni_ie_cause cause;\n};\n\nstruct atm_query_connection_attributes {\n\tuint32_t\tattr;\n};\nstruct atm_set_connection_attributes {\n\tuint32_t\tattr;\n};\nstruct atm_query_connection_attributes_x {\n\tuint32_t\tcount;\n#if defined(__GNUC__) && __GNUC__ < 3\n\tuint32_t\tattr[0];\n#else\n\tuint32_t\tattr[];\n#endif\n};\nstruct atm_set_connection_attributes_x {\n\tuint32_t\tcount;\n#if defined(__GNUC__) && __GNUC__ < 3\n\tuint32_t\tattr[0];\n#else\n\tuint32_t\tattr[];\n#endif\n};\nstruct atm_prepare_incoming_call {\n\tstruct uni_sap\tsap;\n\tuint32_t\tqueue_size;\n};\nstruct atm_connect_outgoing_call {\n\tstruct uni_ie_called\tcalled;\n};\nstruct atm_call_release {\n\tstruct uni_ie_cause\tcause[2];\n};\nstruct atm_p2p_call_active {\n\tstruct uni_ie_connid\tconnid;\n};\nstruct atm_p2mp_call_active {\n\tstruct uni_ie_connid\tconnid;\n};\nstruct atm_accept_incoming_call {\n\tchar\tnewep[ATM_EPNAMSIZ];\n};\nstruct atm_reject_incoming_call {\n\tstruct uni_ie_cause\tcause;\n};\nstruct atm_add_party {\n\tuint16_t\t\tleaf_ident;\n\tstruct uni_ie_called\tcalled;\n};\nstruct atm_add_party_success {\n\tuint16_t\t\tleaf_ident;\n};\nstruct atm_add_party_reject {\n\tuint16_t\t\tleaf_ident;\n\tstruct uni_ie_cause\tcause;\n};\nstruct atm_drop_party {\n\tuint16_t\t\tleaf_ident;\n\tstruct uni_ie_cause\tcause;\n};\n\n/*\n * Get local port info. If port is 0, information on all ports is returned,\n * otherwise only on the named port.\n * The response consists of a header with two counters, a list of ports\n * (struct atm_port_info) and a list of addresses (struct uni_addr).\n * The port to which an address belongs is implicit in the num_addrs field\n * of the port.\n */\nstruct atm_get_local_port_info {\n\tuint32_t\tport;\n};\n\nstruct atm_port_list {\n\tuint32_t\tnum_ports;\t/* number of ports */\n\tuint32_t\tnum_addrs;\t/* total number of addresses */\n};\n\nstruct atm_port_info {\n\tuint32_t\tport;\n\tuint32_t\tpcr;\n\tuint32_t\tmax_vpi_bits;\n\tuint32_t\tmax_vci_bits;\n\tuint32_t\tmax_svpc_vpi;\n\tuint32_t\tmax_svcc_vpi;\n\tuint32_t\tmin_svcc_vci;\n\tu_char\t\tesi[6];\n\tuint32_t\tnum_addrs;\t/* number of addresses on this port */\n};\n\n/*\n * Endpoint state info\n */\nstruct atm_epstate {\n\tchar\tname[ATM_EPNAMSIZ];\n\tuint8_t\tstate;\n};\n\n/*\n * Extended status information.\n */\nstruct atm_exstatus {\n\tuint32_t\tneps;\t\t/* endpoints */\n\tuint32_t\tnports;\t\t/* ports */\n\tuint32_t\tnconns;\t\t/* connections */\n\tuint32_t\tnparties;\t/* number of parties */\n};\nstruct atm_exstatus_ep {\n\tchar\t\tname[ATM_EPNAMSIZ];\n\tuint8_t\t\tstate;\t\t/* Ux */\n};\nstruct atm_exstatus_port {\n\tuint32_t\tportno;\n\tuint8_t\t\tstate;\n};\nstruct atm_exstatus_conn {\n\tuint32_t\tid;\n\tuint32_t\tcref;\t\t/* (flag << 23) | cref */\n\tuint32_t\tport;\n\tchar\t\tep[ATM_EPNAMSIZ];\t/* \\0 - none */\n\tuint8_t\t\tstate;\t\t/* Cx */\n};\nstruct atm_exstatus_party {\n\tuint32_t\tconnid;\n\tuint16_t\tepref;\n\tuint8_t\t\tstate;\t\t/* Px */\n};\n#endif\n"
  },
  {
    "path": "freebsd-headers/netnatm/api/ccatm.h",
    "content": "/*\n * Copyright (c) 2003-2004\n *\tHartmut Brandt\n *\tAll rights reserved.\n *\n * Author: Harti Brandt <harti@freebsd.org>\n *\n * Redistribution of this software and documentation and use in source and\n * binary forms, with or without modification, are permitted provided that\n * the following conditions are met:\n *\n * 1. Redistributions of source code or documentation must retain the above\n *    copyright notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE AND DOCUMENTATION IS PROVIDED BY THE AUTHOR\n * AND ITS CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,\n * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND\n * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL\n * THE AUTHOR OR ITS CONTRIBUTORS  BE LIABLE FOR ANY DIRECT, INDIRECT,\n * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,\n * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF\n * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING\n * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,\n * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n *\n * $Begemot: libunimsg/netnatm/api/ccatm.h,v 1.1 2004/07/08 08:21:58 brandt Exp $\n *\n * ATM API as defined per af-saa-0108\n *\n * Interface to the supporting code.\n */\n\n#ifndef _API_CCATM_H_\n#define _API_CCATM_H_\n\nstruct ccuser;\nstruct ccconn;\nstruct ccport;\nstruct ccdata;\n\nstruct cc_funcs {\n\t/* send signal to API user */\n\tvoid\t(*send_user)(struct ccuser *, void *, u_int, void *, size_t);\n\n\t/* respond API user */\n\tvoid\t(*respond_user)(struct ccuser *, void *, int, u_int,\n\t\t    void *, size_t);\n\n\t/* send signal to uni for connection */\n\tvoid\t(*send_uni)(struct ccconn *, void *, u_int, u_int,\n\t\t    struct uni_msg *);\n\n\t/* send global signal to uni */\n\tvoid\t(*send_uni_glob)(struct ccport *, void *, u_int, u_int,\n\t\t    struct uni_msg *);\n\n\t/* log a message */\n\tvoid\t(*log)(const char *, ...);\n};\n\nenum {\n\tCCLOG_USER_STATE\t= 0x00000001,\n\tCCLOG_USER_INST\t\t= 0x00000002,\n\tCCLOG_USER_SIG\t\t= 0x00000004,\n\tCCLOG_CONN_STATE\t= 0x00000010,\n\tCCLOG_CONN_INST\t\t= 0x00000020,\n\tCCLOG_CONN_SIG\t\t= 0x00000040,\n\tCCLOG_PARTY_STATE\t= 0x00000100,\n\tCCLOG_PARTY_INST\t= 0x00000200,\n\tCCLOG_PARTY_SIG\t\t= 0x00000400,\n\tCCLOG_SIGS\t\t= 0x00001000,\n};\n\n/* instance handling */\nstruct ccdata *cc_create(const struct cc_funcs *);\nvoid cc_destroy(struct ccdata *);\nvoid cc_reset(struct ccdata *);\n\n/* input a response from the UNI layer to CC */\nint cc_uni_response(struct ccport *, u_int cookie, u_int reason, u_int state);\n\n/* Signal from UNI on this port */\nint cc_uni_signal(struct ccport *, u_int cookie, u_int sig, struct uni_msg *);\n\n/* retrieve addresses */\nint cc_get_addrs(struct ccdata *, u_int, struct uni_addr **, u_int **, u_int *);\n\n/* dump state */\ntypedef int (*cc_dump_f)(struct ccdata *, void *, const char *);\nint cc_dump(struct ccdata *, size_t, cc_dump_f, void *);\n\n/* start/stop port */\nint cc_port_stop(struct ccdata *, u_int);\nint cc_port_start(struct ccdata *, u_int);\n\n/* is port running? */\nint cc_port_isrunning(struct ccdata *, u_int, int *);\n\n/* return port number */\nu_int cc_port_no(struct ccport *);\n\n/* Clear address and prefix information from the named port. */\nint cc_port_clear(struct ccdata *, u_int);\n\n/* Address registered.  */\nint cc_addr_register(struct ccdata *, u_int, const struct uni_addr *);\n\n/* Address unregistered. */\nint cc_addr_unregister(struct ccdata *, u_int, const struct uni_addr *);\n\n/* get port info */\nint cc_port_get_param(struct ccdata *, u_int, struct atm_port_info *);\n\n/* set port info */\nint cc_port_set_param(struct ccdata *, const struct atm_port_info *);\n\n/* get port list */\nint cc_port_getlist(struct ccdata *, u_int *, u_int **);\n\n/* create a port */\nstruct ccport *cc_port_create(struct ccdata *, void *, u_int);\n\n/* destroy a port */\nvoid cc_port_destroy(struct ccport *, int);\n\n/* New endpoint created */\nstruct ccuser *cc_user_create(struct ccdata *, void *, const char *);\n\n/* destroy user endpoint */\nvoid cc_user_destroy(struct ccuser *);\n\n/* signal from user */\nint cc_user_signal(struct ccuser *, u_int, struct uni_msg *);\n\n/* Management is given up on this node. */\nvoid cc_unmanage(struct ccdata *);\n\n/* handle all queued signals */\nvoid cc_work(struct ccdata *);\n\n/* set/get logging flags */\nvoid cc_set_log(struct ccdata *, u_int);\nu_int cc_get_log(const struct ccdata *);\n\n/* get extended status */\nint cc_get_extended_status(const struct ccdata *, struct atm_exstatus *,\n    struct atm_exstatus_ep **, struct atm_exstatus_port **,\n    struct atm_exstatus_conn **, struct atm_exstatus_party **);\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/netnatm/api/unisap.h",
    "content": "/*\n * Copyright (c) 2001-2003\n *\tFraunhofer Institute for Open Communication Systems (FhG Fokus).\n * \tAll rights reserved.\n *\n * Author: Hartmut Brandt <harti@freebsd.org>\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $Begemot: libunimsg/netnatm/api/unisap.h,v 1.6 2005/05/23 11:49:17 brandt_h Exp $\n */\n#ifndef _NETNATM_API_UNISAP_H_\n#define _NETNATM_API_UNISAP_H_\n\n#include <netnatm/msg/uni_config.h>\n\nenum unisve_tag {\n\tUNISVE_ABSENT,\t\t/* Element is absent */\n\tUNISVE_PRESENT,\t\t/* Element is present with specific value */\n\tUNISVE_ANY\t\t/* Any values is acceptable */\n};\n\nstruct unisve_addr {\n\tenum unisve_tag\t\ttag;\n\tenum uni_addr_type\ttype;\t/* type of address */\n\tenum uni_addr_plan\tplan;\t/* addressing plan */\n\tuint32_t\t\tlen;\t/* length of address */\n\tu_char\t\t\taddr[UNI_ADDR_MAXLEN];\n};\n\nstruct unisve_selector {\n\tenum unisve_tag\ttag;\n\tuint8_t\t\tselector;\n};\n\nstruct unisve_blli_id2 {\n\tenum unisve_tag\ttag;\n\tu_int\t\tproto:5;\t/* the protocol */\n\tu_int\t\tuser:7;\t\t/* user specific protocol */\n};\n\nstruct unisve_blli_id3 {\n\tenum unisve_tag\ttag;\n\tu_int\t\tproto:5;\t/* L3 protocol */\n\tu_int\t\tuser:7;\t\t/* user specific protocol */\n\tu_int\t\tipi:8;\t\t/* ISO/IEC TR 9557 IPI */\n\tu_int\t\toui:24;\t\t/* IEEE 802.1 OUI */\n\tu_int\t\tpid:16;\t\t/* IEEE 802.1 PID */\n\tuint32_t\tnoipi;\t\t/* ISO/IEC TR 9557 per frame */\n};\n\nstruct unisve_bhli {\n\tenum unisve_tag\ttag;\n\tenum uni_bhli\ttype;\t\t/* type of info */\n\tuint32_t\tlen;\t\t/* length of info */\n\tuint8_t\t\tinfo[8];\t/* info itself */\n};\n\nstruct uni_sap {\n\tstruct unisve_addr\taddr;\n\tstruct unisve_selector\tselector;\n\tstruct unisve_blli_id2\tblli_id2;\n\tstruct unisve_blli_id3\tblli_id3;\n\tstruct unisve_bhli\tbhli;\n};\n\nint unisve_check_addr(const struct unisve_addr *);\nint unisve_check_selector(const struct unisve_selector *);\nint unisve_check_blli_id2(const struct unisve_blli_id2 *);\nint unisve_check_blli_id3(const struct unisve_blli_id3 *);\nint unisve_check_bhli(const struct unisve_bhli *);\n\nint unisve_check_sap(const struct uni_sap *);\n\nint unisve_overlap_addr(const struct unisve_addr *, const struct unisve_addr *);\nint unisve_overlap_selector(const struct unisve_selector *,\n    const struct unisve_selector *);\nint unisve_overlap_blli_id2(const struct unisve_blli_id2 *,\n    const struct unisve_blli_id2 *);\nint unisve_overlap_blli_id3(const struct unisve_blli_id3 *,\n    const struct unisve_blli_id3 *);\nint unisve_overlap_bhli(const struct unisve_bhli *,\n    const struct unisve_bhli *);\nint unisve_overlap_sap(const struct uni_sap *, const struct uni_sap *);\n\nint unisve_is_catchall(const struct uni_sap *);\nint unisve_match(const struct uni_sap *, const struct uni_ie_called *,\n\tconst struct uni_ie_blli *, const struct uni_ie_bhli *);\n\nenum {\n\tUNISVE_OK = 0,\n\tUNISVE_ERROR_BAD_TAG,\n\tUNISVE_ERROR_TYPE_PLAN_CONFLICT,\n\tUNISVE_ERROR_ADDR_SEL_CONFLICT,\n\tUNISVE_ERROR_ADDR_LEN,\n\tUNISVE_ERROR_BAD_ADDR_TYPE,\n\tUNISVE_ERROR_BAD_BHLI_TYPE,\n\tUNISVE_ERROR_BAD_BHLI_LEN,\n};\n\n#define UNISVE_ERRSTR\t\t\t\t\t\\\n\t\"no error\",\t\t\t\t\t\\\n\t\"bad SVE tag\",\t\t\t\t\t\\\n\t\"bad address type/plan combination\",\t\t\\\n\t\"bad address plan/selector tag combination\",\t\\\n\t\"bad address length in SVE\",\t\t\t\\\n\t\"unknown address type in SVE\",\t\t\t\\\n\t\"bad BHLI type in SVE\",\t\t\t\t\\\n\t\"BHLI info too long in SVE\",\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/netnatm/msg/uni_config.h",
    "content": "/*\n * Copyright (c) 1996-2003\n *\tFraunhofer Institute for Open Communication Systems (FhG Fokus).\n * \tAll rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * Author: Hartmut Brandt <harti@freebsd.org>\n *\n * $Begemot: libunimsg/netnatm/msg/uni_config.h,v 1.3 2003/09/19 11:58:15 hbb Exp $\n */\n#ifndef _uni_uni_config_h_\n#define _uni_uni_config_h_\n\nenum {\n\t/* maximum number of reported error IEs */\n\tUNI_MAX_ERRIE\t= 50,\n\n\t/* maximum number of Generic Identifier Transport IE's per message */\n\tUNI_NUM_IE_GIT\t= 3,\n\n\t/* maximum number of BLLI's in SETUP */\n\tUNI_NUM_IE_BLLI\t= 3,\n\n\t/* maximum number of CALLEDSUB's */\n\tUNI_NUM_IE_CALLEDSUB = 2,\n\n\t/* maximum number of CALLINGSUB's */\n\tUNI_NUM_IE_CALLINGSUB = 2,\n\n\t/* maximum number of TNS's */\n\tUNI_NUM_IE_TNS = 4,\n\n\t/* maximum length of TNS name */\n\tUNI_TNS_MAXLEN = 4,\n\n\t/* maximum info size in user-to-user signalling IE */\n\tUNI_UU_MAXLEN\t= 128,\n\n\t/* maximum length of address */\n\tUNI_ADDR_MAXLEN\t= 20,\n\n\t/* maximum length of subaddress */\n\tUNI_SUBADDR_MAXLEN = 20,\n\n\t/* maximum number of DTLs */\n\tUNI_NUM_IE_DTL = 10,\n\t/* maximum number of identifiers in DTL */\n\tUNI_DTL_MAXNUM = 20,\n};\n#endif\n"
  },
  {
    "path": "freebsd-headers/netnatm/msg/uni_hdr.h",
    "content": "/*\n * Copyright (c) 1996-2003\n *\tFraunhofer Institute for Open Communication Systems (FhG Fokus).\n * \tAll rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * Author: Hartmut Brandt <harti@freebsd.org>\n *\n * $Begemot: libunimsg/netnatm/msg/uni_hdr.h,v 1.6 2004/07/08 08:22:05 brandt Exp $\n */\n#ifndef _NETNATM_MSG_UNI_HDR_H_\n#define _NETNATM_MSG_UNI_HDR_H_\n\n#include <sys/types.h>\n#ifdef _KERNEL\n#include <sys/stdint.h>\n#else\n#include <stdint.h>\n#endif\n\n#include <netnatm/msg/uni_config.h>\n\nenum {\n\tUNI_PROTO\t= 0x09,\t\t/* protocol discriminator */\n\tPNNI_PROTO\t= 0xf0,\t\t/* PNNI protocol discriminator */\n};\n\n/*\n * Message types\n */\nenum uni_msgtype {\n\tUNI_UNKNOWN\t\t= 0x100,/* unknown message */\n\n\tUNI_ALERTING\t\t= 0x01,\t/* alerting */\n\tUNI_CALL_PROC\t\t= 0x02, /* call proceeding */\n\tUNI_SETUP\t\t= 0x05,\t/* setup */\n\tUNI_CONNECT\t\t= 0x07,\t/* connect */\n\tUNI_CONNECT_ACK\t\t= 0x0f,\t/* connect ack */\n\n\tUNI_RESTART\t\t= 0x46,\t/* restart */\n\tUNI_RELEASE\t\t= 0x4d,\t/* release */\n\tUNI_RESTART_ACK\t\t= 0x4e,\t/* restart acknowledgement */\n\tUNI_RELEASE_COMPL\t= 0x5a,\t/* release complete */\n\n\tUNI_NOTIFY\t\t= 0x6e,\t/* notify user */\n\tUNI_STATUS_ENQ\t\t= 0x75,\t/* status enquiry */\n\tUNI_STATUS\t\t= 0x7d,\t/* status */\n\n\tUNI_ADD_PARTY\t\t= 0x80,\t/* add party */\n\tUNI_ADD_PARTY_ACK\t= 0x81,\t/* add party acknowledgement */\n\tUNI_ADD_PARTY_REJ\t= 0x82,\t/* add party reject */\n\tUNI_DROP_PARTY\t\t= 0x83,\t/* drop party */\n\tUNI_DROP_PARTY_ACK\t= 0x84,\t/* drop party acknowledgement */\n\tUNI_PARTY_ALERTING\t= 0x85,\t/* party alerting */\n\n\tUNI_LEAF_SETUP_FAIL\t= 0x90,\t/* leaf setup failed */\n\tUNI_LEAF_SETUP_REQ\t= 0x91,\t/* leaf setup request */\n\n\tUNI_COBISETUP\t\t= 0x15,\t/* Q.2932 COBI-setup */\n\tUNI_FACILITY\t\t= 0x62,\t/* Q.2932 facility */\n\n\tUNI_MODIFY_REQ\t\t= 0x88,\t/* Q.2963 Modify request */\n\tUNI_MODIFY_ACK\t\t= 0x89,\t/* Q.2963 Modify acknowledgement */\n\tUNI_MODIFY_REJ\t\t= 0x8a,\t/* Q.2963 Modify reject */\n\tUNI_CONN_AVAIL\t\t= 0x8b,\t/* Q.2963 Connection available */\n};\n\n/*\n * Information element types\n */\nenum uni_ietype {\n\tUNI_IE_CAUSE\t\t= 0x08,\t/* cause */\n\tUNI_IE_CALLSTATE\t= 0x14,\t/* call state */\n\tUNI_IE_FACILITY\t\t= 0x1C,\t/* Q.2932 facility IE */\n\tUNI_IE_NOTIFY\t\t= 0x27,\t/* UNI4.0 notify */\n\tUNI_IE_EETD\t\t= 0x42,\t/* UNI4.0 end-to-end transit delay */\n\tUNI_IE_CONNED\t\t= 0x4c,\t/* UNI4.0/Q.2951 connected address */\n\tUNI_IE_CONNEDSUB\t= 0x4d,\t/* UNI4.0/Q.2951 connected subaddress */\n\tUNI_IE_EPREF\t\t= 0x54,\t/* endpoint reference */\n\tUNI_IE_EPSTATE\t\t= 0x55,\t/* enpoint state */\n\tUNI_IE_AAL\t\t= 0x58,\t/* ATM adaptation layer parameters */\n\tUNI_IE_TRAFFIC\t\t= 0x59,\t/* ATM traffic descriptor */\n\tUNI_IE_CONNID\t\t= 0x5a,\t/* connection identifier */\n\tUNI_IE_QOS\t\t= 0x5c,\t/* quality of service parameter */\n\tUNI_IE_BHLI\t\t= 0x5d,\t/* broadband higher layer information */\n\tUNI_IE_BEARER\t\t= 0x5e,\t/* broadband bearer capability */\n\tUNI_IE_BLLI\t\t= 0x5f,\t/* broadband lower layer information */\n\tUNI_IE_LSHIFT\t\t= 0x60,\t/* broadband locking shift */\n\tUNI_IE_NLSHIFT\t\t= 0x61,\t/* broadband non-locking shift */\n\tUNI_IE_SCOMPL\t\t= 0x62,\t/* broadband sending complete */\n\tUNI_IE_REPEAT\t\t= 0x63,\t/* broadband repeat indicator */\n\tUNI_IE_CALLING\t\t= 0x6c,\t/* calling party number */\n\tUNI_IE_CALLINGSUB\t= 0x6d,\t/* calling party subaddress */\n\tUNI_IE_CALLED\t\t= 0x70,\t/* called party number */\n\tUNI_IE_CALLEDSUB\t= 0x71,\t/* called party subaddress */\n\tUNI_IE_TNS\t\t= 0x78,\t/* transit network selection */\n\tUNI_IE_RESTART\t\t= 0x79,\t/* restart indicator */\n\tUNI_IE_UU\t\t= 0x7e,\t/* UNI4.0/Q.2957 user-to-user info */\n\tUNI_IE_GIT\t\t= 0x7f,\t/* UNI4.0 generic identifier transport*/\n\tUNI_IE_MINTRAFFIC\t= 0x81,\t/* Q.2962 minimum traffic desc */\n\tUNI_IE_ATRAFFIC\t\t= 0x82,\t/* Q.2962 alternate traffic desc */\n\tUNI_IE_ABRSETUP\t\t= 0x84,\t/* UNI4.0 ABR setup parameters */\n\tUNI_IE_REPORT\t\t= 0x89,\t/* Q.2963 broadband report type */\n\tUNI_IE_CALLED_SOFT\t= 0xe0,\t/* PNNI Calling party soft PVPC */\n\tUNI_IE_CRANKBACK\t= 0xe1,\t/* PNNI Crankback */\n\tUNI_IE_DTL\t\t= 0xe2,\t/* PNNI designated transit list */\n\tUNI_IE_CALLING_SOFT\t= 0xe3,\t/* PNNI Called party soft PVPC */\n\tUNI_IE_ABRADD\t\t= 0xe4,\t/* UNI4.0 ABR additional parameters */\n\tUNI_IE_LIJ_CALLID\t= 0xe8,\t/* UNI4.0 LIF call identifier */\n\tUNI_IE_LIJ_PARAM\t= 0xe9,\t/* UNI4.0 LIF parameters */\n\tUNI_IE_LIJ_SEQNO\t= 0xea,\t/* UNI4.0 LIF sequence number */\n\tUNI_IE_CSCOPE\t\t= 0xeb,\t/* UNI4.0 connection scope selection */\n\tUNI_IE_EXQOS\t\t= 0xec,\t/* UNI4.0 extended QoS parameters */\n\tUNI_IE_MDCR\t\t= 0xf0,\t/* UNI4.0+ Minimum desired call rate */\n\tUNI_IE_UNREC\t\t= 0xfe,\n};\n\nenum uni_coding {\n\tUNI_CODING_ITU = 0x0,\n\tUNI_CODING_NET = 0x3,\n};\n\nenum uni_msgact {\n\tUNI_MSGACT_CLEAR\t= 0x0,\n\tUNI_MSGACT_IGNORE\t= 0x1,\n\tUNI_MSGACT_REPORT\t= 0x2,\n\n\tUNI_MSGACT_DEFAULT\t= 0x4\n};\n\nenum uni_ieact {\n\tUNI_IEACT_CLEAR\t\t= 0x00,\t/* clear call */\n\tUNI_IEACT_IGNORE\t= 0x01,\t/* ignore IE and proceed */\n\tUNI_IEACT_REPORT\t= 0x02,\t/* ignore IE, report and proceed */\n\tUNI_IEACT_MSG_IGNORE\t= 0x05,\t/* ignore message */\n\tUNI_IEACT_MSG_REPORT\t= 0x06,\t/* ignore message and report */\n\n\tUNI_IEACT_DEFAULT\t= 0x08\n};\n\nstruct uni_cref {\n\tu_int\tflag;\n\tu_int\tcref;\n};\n\n/*\n * Message header.\n */\nstruct uni_msghdr {\n\tstruct uni_cref\tcref;\n\tenum uni_msgact\tact;\t\t/* action indicator */\n\tu_int\t\tpass:1;\t\t/* PNNI pass along request */\n};\n\nenum {\n\tCREF_GLOBAL\t= 0,\n\tCREF_DUMMY\t= 0x7fffff,\n};\n\n/*\n * General information element header.\n */\nstruct uni_iehdr {\n\tenum uni_coding\tcoding;\t\t/* coding standard */\n\tenum uni_ieact\tact;\t\t/* action indicator */\n\tu_int\t\tpass : 1;\t/* PNNI pass along request */\n\tu_int\t\tpresent;\t/* which optional elements are present */\n#define UNI_IE_EMPTY\t0x80000000\n#define UNI_IE_PRESENT\t0x40000000\n#define UNI_IE_ERROR\t0x20000000\n#define UNI_IE_XXX\t0x10000000\n#define UNI_IE_MASK\t0xf0000000\n};\n\n#define IE_ISPRESENT(IE) \\\n\t(((IE).h.present & (UNI_IE_PRESENT|UNI_IE_EMPTY)) == UNI_IE_PRESENT)\n#define IE_SETPRESENT(IE) \\\n\t((IE).h.present = ((IE).h.present & ~UNI_IE_MASK) | \\\n\t\tUNI_IE_PRESENT)\n\n#define IE_ADDPRESENT(IE) \\\n\t((IE).h.present = ((IE).h.present & ~UNI_IE_EMPTY) | \\\n\t\tUNI_IE_PRESENT)\n\n#define IE_ISEMPTY(IE) \\\n\t(((IE).h.present & UNI_IE_MASK) == (UNI_IE_PRESENT | UNI_IE_EMPTY))\n#define IE_SETEMPTY(IE) \\\n\t((IE).h.present = ((IE).h.present & ~UNI_IE_MASK) | \\\n\t\tUNI_IE_EMPTY | UNI_IE_PRESENT)\n\n#define IE_ISERROR(IE) \\\n\t(((IE).h.present & UNI_IE_MASK) == (UNI_IE_PRESENT | UNI_IE_ERROR))\n#define IE_SETERROR(IE) \\\n\t((IE).h.present = ((IE).h.present & ~UNI_IE_MASK) | \\\n\t\tUNI_IE_ERROR | UNI_IE_PRESENT)\n\n#define IE_ISGOOD(IE) \\\n\t(((IE).h.present & UNI_IE_MASK) == (UNI_IE_PRESENT))\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/netnatm/msg/uni_ie.h",
    "content": "/* This file was created automatically\n * Source file: $Begemot: libunimsg/atm/msg/ie.def,v 1.3 2003/09/19 11:58:15 hbb Exp $\n * $FreeBSD: release/9.0.0/sys/contrib/ngatm/netnatm/msg/uni_ie.h 121936 2003-11-03 09:11:53Z harti $\n */\n\n#ifndef _NETNATM_MSG_UNI_IE_H_\n#define _NETNATM_MSG_UNI_IE_H_\n\nunion uni_ieall {\n\tstruct uni_iehdr h;\n\tstruct uni_ie_cause cause;\n\tstruct uni_ie_callstate callstate;\n\tstruct uni_ie_facility facility;\n\tstruct uni_ie_notify notify;\n\tstruct uni_ie_eetd eetd;\n\tstruct uni_ie_conned conned;\n\tstruct uni_ie_connedsub connedsub;\n\tstruct uni_ie_epref epref;\n\tstruct uni_ie_epstate epstate;\n\tstruct uni_ie_aal aal;\n\tstruct uni_ie_traffic traffic;\n\tstruct uni_ie_connid connid;\n\tstruct uni_ie_qos qos;\n\tstruct uni_ie_bhli bhli;\n\tstruct uni_ie_bearer bearer;\n\tstruct uni_ie_blli blli;\n\tstruct uni_ie_lshift lshift;\n\tstruct uni_ie_nlshift nlshift;\n\tstruct uni_ie_scompl scompl;\n\tstruct uni_ie_repeat repeat;\n\tstruct uni_ie_calling calling;\n\tstruct uni_ie_callingsub callingsub;\n\tstruct uni_ie_called called;\n\tstruct uni_ie_calledsub calledsub;\n\tstruct uni_ie_tns tns;\n\tstruct uni_ie_restart restart;\n\tstruct uni_ie_uu uu;\n\tstruct uni_ie_git git;\n\tstruct uni_ie_mintraffic mintraffic;\n\tstruct uni_ie_atraffic atraffic;\n\tstruct uni_ie_abrsetup abrsetup;\n\tstruct uni_ie_report report;\n\tstruct uni_ie_called_soft called_soft;\n\tstruct uni_ie_crankback crankback;\n\tstruct uni_ie_dtl dtl;\n\tstruct uni_ie_calling_soft calling_soft;\n\tstruct uni_ie_abradd abradd;\n\tstruct uni_ie_lij_callid lij_callid;\n\tstruct uni_ie_lij_param lij_param;\n\tstruct uni_ie_lij_seqno lij_seqno;\n\tstruct uni_ie_cscope cscope;\n\tstruct uni_ie_exqos exqos;\n\tstruct uni_ie_mdcr mdcr;\n\tstruct uni_ie_unrec unrec;\n};\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/netnatm/msg/uni_msg.h",
    "content": "/* This file was created automatically\n * Source file: $Begemot: libunimsg/atm/msg/msg.def,v 1.3 2003/09/19 11:58:15 hbb Exp $\n * $FreeBSD: release/9.0.0/sys/contrib/ngatm/netnatm/msg/uni_msg.h 121936 2003-11-03 09:11:53Z harti $\n */\n\n#ifndef _NETNATM_MSG_UNI_MSG_H_\n#define _NETNATM_MSG_UNI_MSG_H_\n\nstruct uni_alerting {\n\tstruct uni_msghdr\thdr;\n\tstruct uni_ie_connid\tconnid;\n\tstruct uni_ie_epref\tepref;\n\tstruct uni_ie_notify\tnotify;\n\tstruct uni_ie_git\tgit[UNI_NUM_IE_GIT];\n\tstruct uni_ie_uu\tuu;\n\tstruct uni_ie_report\treport;\n\tstruct uni_ie_unrec\tunrec;\n};\n\nstruct uni_call_proc {\n\tstruct uni_msghdr\thdr;\n\tstruct uni_ie_connid\tconnid;\n\tstruct uni_ie_epref\tepref;\n\tstruct uni_ie_notify\tnotify;\n\tstruct uni_ie_unrec\tunrec;\n};\n\nstruct uni_connect {\n\tstruct uni_msghdr\thdr;\n\tstruct uni_ie_aal\taal;\n\tstruct uni_ie_blli\tblli;\n\tstruct uni_ie_connid\tconnid;\n\tstruct uni_ie_epref\tepref;\n\tstruct uni_ie_notify\tnotify;\n\tstruct uni_ie_conned\tconned;\n\tstruct uni_ie_connedsub\tconnedsub;\n\tstruct uni_ie_eetd\teetd;\n\tstruct uni_ie_git\tgit[UNI_NUM_IE_GIT];\n\tstruct uni_ie_uu\tuu;\n\tstruct uni_ie_traffic\ttraffic;\n\tstruct uni_ie_exqos\texqos;\n\tstruct uni_ie_facility\tfacility;\n\tstruct uni_ie_abrsetup\tabrsetup;\n\tstruct uni_ie_abradd\tabradd;\n\tstruct uni_ie_called_soft\tcalled_soft;\n\tstruct uni_ie_report\treport;\n\tstruct uni_ie_unrec\tunrec;\n};\n\nstruct uni_connect_ack {\n\tstruct uni_msghdr\thdr;\n\tstruct uni_ie_notify\tnotify;\n\tstruct uni_ie_unrec\tunrec;\n};\n\nstruct uni_release {\n\tstruct uni_msghdr\thdr;\n\tstruct uni_ie_cause\tcause[2];\n\tstruct uni_ie_notify\tnotify;\n\tstruct uni_ie_git\tgit[UNI_NUM_IE_GIT];\n\tstruct uni_ie_uu\tuu;\n\tstruct uni_ie_facility\tfacility;\n\tstruct uni_ie_crankback\tcrankback;\n\tstruct uni_ie_unrec\tunrec;\n};\n\nstruct uni_release_compl {\n\tstruct uni_msghdr\thdr;\n\tstruct uni_ie_cause\tcause[2];\n\tstruct uni_ie_git\tgit[UNI_NUM_IE_GIT];\n\tstruct uni_ie_uu\tuu;\n\tstruct uni_ie_crankback\tcrankback;\n\tstruct uni_ie_unrec\tunrec;\n};\n\nstruct uni_setup {\n\tstruct uni_msghdr\thdr;\n\tstruct uni_ie_aal\taal;\n\tstruct uni_ie_traffic\ttraffic;\n\tstruct uni_ie_bearer\tbearer;\n\tstruct uni_ie_bhli\tbhli;\n\tstruct uni_ie_repeat\tblli_repeat;\n\tstruct uni_ie_blli\tblli[UNI_NUM_IE_BLLI];\n\tstruct uni_ie_called\tcalled;\n\tstruct uni_ie_calledsub\tcalledsub[UNI_NUM_IE_CALLEDSUB];\n\tstruct uni_ie_calling\tcalling;\n\tstruct uni_ie_callingsub\tcallingsub[UNI_NUM_IE_CALLINGSUB];\n\tstruct uni_ie_connid\tconnid;\n\tstruct uni_ie_qos\tqos;\n\tstruct uni_ie_eetd\teetd;\n\tstruct uni_ie_notify\tnotify;\n\tstruct uni_ie_scompl\tscompl;\n\tstruct uni_ie_tns\ttns[UNI_NUM_IE_TNS];\n\tstruct uni_ie_epref\tepref;\n\tstruct uni_ie_atraffic\tatraffic;\n\tstruct uni_ie_mintraffic\tmintraffic;\n\tstruct uni_ie_uu\tuu;\n\tstruct uni_ie_git\tgit[UNI_NUM_IE_GIT];\n\tstruct uni_ie_lij_callid\tlij_callid;\n\tstruct uni_ie_lij_param\tlij_param;\n\tstruct uni_ie_lij_seqno\tlij_seqno;\n\tstruct uni_ie_exqos\texqos;\n\tstruct uni_ie_abrsetup\tabrsetup;\n\tstruct uni_ie_abradd\tabradd;\n\tstruct uni_ie_cscope\tcscope;\n\tstruct uni_ie_calling_soft\tcalling_soft;\n\tstruct uni_ie_called_soft\tcalled_soft;\n\tstruct uni_ie_repeat\tdtl_repeat;\n\tstruct uni_ie_dtl\tdtl[UNI_NUM_IE_DTL];\n\tstruct uni_ie_report\treport;\n\tstruct uni_ie_mdcr\tmdcr;\n\tstruct uni_ie_unrec\tunrec;\n};\n\nstruct uni_status {\n\tstruct uni_msghdr\thdr;\n\tstruct uni_ie_callstate\tcallstate;\n\tstruct uni_ie_cause\tcause;\n\tstruct uni_ie_epref\tepref;\n\tstruct uni_ie_epstate\tepstate;\n\tstruct uni_ie_unrec\tunrec;\n};\n\nstruct uni_status_enq {\n\tstruct uni_msghdr\thdr;\n\tstruct uni_ie_epref\tepref;\n\tstruct uni_ie_unrec\tunrec;\n};\n\nstruct uni_notify {\n\tstruct uni_msghdr\thdr;\n\tstruct uni_ie_notify\tnotify;\n\tstruct uni_ie_epref\tepref;\n\tstruct uni_ie_unrec\tunrec;\n};\n\nstruct uni_restart {\n\tstruct uni_msghdr\thdr;\n\tstruct uni_ie_connid\tconnid;\n\tstruct uni_ie_restart\trestart;\n\tstruct uni_ie_unrec\tunrec;\n};\n\nstruct uni_restart_ack {\n\tstruct uni_msghdr\thdr;\n\tstruct uni_ie_connid\tconnid;\n\tstruct uni_ie_restart\trestart;\n\tstruct uni_ie_unrec\tunrec;\n};\n\nstruct uni_add_party {\n\tstruct uni_msghdr\thdr;\n\tstruct uni_ie_aal\taal;\n\tstruct uni_ie_bhli\tbhli;\n\tstruct uni_ie_blli\tblli;\n\tstruct uni_ie_called\tcalled;\n\tstruct uni_ie_calledsub\tcalledsub[UNI_NUM_IE_CALLEDSUB];\n\tstruct uni_ie_calling\tcalling;\n\tstruct uni_ie_callingsub\tcallingsub[UNI_NUM_IE_CALLINGSUB];\n\tstruct uni_ie_scompl\tscompl;\n\tstruct uni_ie_tns\ttns[UNI_NUM_IE_TNS];\n\tstruct uni_ie_epref\tepref;\n\tstruct uni_ie_notify\tnotify;\n\tstruct uni_ie_eetd\teetd;\n\tstruct uni_ie_uu\tuu;\n\tstruct uni_ie_git\tgit[UNI_NUM_IE_GIT];\n\tstruct uni_ie_lij_seqno\tlij_seqno;\n\tstruct uni_ie_calling_soft\tcalling_soft;\n\tstruct uni_ie_called_soft\tcalled_soft;\n\tstruct uni_ie_repeat\tdtl_repeat;\n\tstruct uni_ie_dtl\tdtl[UNI_NUM_IE_DTL];\n\tstruct uni_ie_unrec\tunrec;\n};\n\nstruct uni_add_party_ack {\n\tstruct uni_msghdr\thdr;\n\tstruct uni_ie_epref\tepref;\n\tstruct uni_ie_aal\taal;\n\tstruct uni_ie_blli\tblli;\n\tstruct uni_ie_notify\tnotify;\n\tstruct uni_ie_eetd\teetd;\n\tstruct uni_ie_conned\tconned;\n\tstruct uni_ie_connedsub\tconnedsub;\n\tstruct uni_ie_uu\tuu;\n\tstruct uni_ie_git\tgit[UNI_NUM_IE_GIT];\n\tstruct uni_ie_called_soft\tcalled_soft;\n\tstruct uni_ie_unrec\tunrec;\n};\n\nstruct uni_party_alerting {\n\tstruct uni_msghdr\thdr;\n\tstruct uni_ie_epref\tepref;\n\tstruct uni_ie_notify\tnotify;\n\tstruct uni_ie_uu\tuu;\n\tstruct uni_ie_git\tgit[UNI_NUM_IE_GIT];\n\tstruct uni_ie_unrec\tunrec;\n};\n\nstruct uni_add_party_rej {\n\tstruct uni_msghdr\thdr;\n\tstruct uni_ie_cause\tcause;\n\tstruct uni_ie_epref\tepref;\n\tstruct uni_ie_uu\tuu;\n\tstruct uni_ie_git\tgit[UNI_NUM_IE_GIT];\n\tstruct uni_ie_crankback\tcrankback;\n\tstruct uni_ie_unrec\tunrec;\n};\n\nstruct uni_drop_party {\n\tstruct uni_msghdr\thdr;\n\tstruct uni_ie_cause\tcause;\n\tstruct uni_ie_epref\tepref;\n\tstruct uni_ie_notify\tnotify;\n\tstruct uni_ie_uu\tuu;\n\tstruct uni_ie_git\tgit[UNI_NUM_IE_GIT];\n\tstruct uni_ie_unrec\tunrec;\n};\n\nstruct uni_drop_party_ack {\n\tstruct uni_msghdr\thdr;\n\tstruct uni_ie_epref\tepref;\n\tstruct uni_ie_cause\tcause;\n\tstruct uni_ie_uu\tuu;\n\tstruct uni_ie_git\tgit[UNI_NUM_IE_GIT];\n\tstruct uni_ie_unrec\tunrec;\n};\n\nstruct uni_leaf_setup_req {\n\tstruct uni_msghdr\thdr;\n\tstruct uni_ie_tns\ttns[UNI_NUM_IE_TNS];\n\tstruct uni_ie_calling\tcalling;\n\tstruct uni_ie_callingsub\tcallingsub[UNI_NUM_IE_CALLINGSUB];\n\tstruct uni_ie_called\tcalled;\n\tstruct uni_ie_calledsub\tcalledsub[UNI_NUM_IE_CALLEDSUB];\n\tstruct uni_ie_lij_callid\tlij_callid;\n\tstruct uni_ie_lij_seqno\tlij_seqno;\n\tstruct uni_ie_unrec\tunrec;\n};\n\nstruct uni_leaf_setup_fail {\n\tstruct uni_msghdr\thdr;\n\tstruct uni_ie_cause\tcause;\n\tstruct uni_ie_called\tcalled;\n\tstruct uni_ie_calledsub\tcalledsub;\n\tstruct uni_ie_lij_seqno\tlij_seqno;\n\tstruct uni_ie_tns\ttns[UNI_NUM_IE_TNS];\n\tstruct uni_ie_unrec\tunrec;\n};\n\nstruct uni_cobisetup {\n\tstruct uni_msghdr\thdr;\n\tstruct uni_ie_facility\tfacility;\n\tstruct uni_ie_called\tcalled;\n\tstruct uni_ie_calledsub\tcalledsub;\n\tstruct uni_ie_calling\tcalling;\n\tstruct uni_ie_notify\tnotify;\n\tstruct uni_ie_unrec\tunrec;\n};\n\nstruct uni_facility {\n\tstruct uni_msghdr\thdr;\n\tstruct uni_ie_facility\tfacility;\n\tstruct uni_ie_called\tcalled;\n\tstruct uni_ie_calledsub\tcalledsub;\n\tstruct uni_ie_calling\tcalling;\n\tstruct uni_ie_notify\tnotify;\n\tstruct uni_ie_unrec\tunrec;\n};\n\nstruct uni_modify_req {\n\tstruct uni_msghdr\thdr;\n\tstruct uni_ie_traffic\ttraffic;\n\tstruct uni_ie_atraffic\tatraffic;\n\tstruct uni_ie_mintraffic\tmintraffic;\n\tstruct uni_ie_notify\tnotify;\n\tstruct uni_ie_git\tgit[UNI_NUM_IE_GIT];\n\tstruct uni_ie_unrec\tunrec;\n};\n\nstruct uni_modify_ack {\n\tstruct uni_msghdr\thdr;\n\tstruct uni_ie_report\treport;\n\tstruct uni_ie_traffic\ttraffic;\n\tstruct uni_ie_notify\tnotify;\n\tstruct uni_ie_git\tgit[UNI_NUM_IE_GIT];\n\tstruct uni_ie_unrec\tunrec;\n};\n\nstruct uni_modify_rej {\n\tstruct uni_msghdr\thdr;\n\tstruct uni_ie_cause\tcause;\n\tstruct uni_ie_notify\tnotify;\n\tstruct uni_ie_git\tgit[UNI_NUM_IE_GIT];\n\tstruct uni_ie_unrec\tunrec;\n};\n\nstruct uni_conn_avail {\n\tstruct uni_msghdr\thdr;\n\tstruct uni_ie_notify\tnotify;\n\tstruct uni_ie_git\tgit[UNI_NUM_IE_GIT];\n\tstruct uni_ie_report\treport;\n\tstruct uni_ie_unrec\tunrec;\n};\n\nstruct uni_unknown {\n\tstruct uni_msghdr\thdr;\n\tstruct uni_ie_epref\tepref;\n\tstruct uni_ie_unrec\tunrec;\n};\n\nunion uni_msgall {\n\tstruct uni_msghdr\thdr;\n\tstruct uni_alerting\talerting;\n\tstruct uni_call_proc\tcall_proc;\n\tstruct uni_connect\tconnect;\n\tstruct uni_connect_ack\tconnect_ack;\t/* !pnni */\n\tstruct uni_release\trelease;\n\tstruct uni_release_compl\trelease_compl;\n\tstruct uni_setup\tsetup;\n\tstruct uni_status\tstatus;\n\tstruct uni_status_enq\tstatus_enq;\n\tstruct uni_notify\tnotify;\n\tstruct uni_restart\trestart;\n\tstruct uni_restart_ack\trestart_ack;\n\tstruct uni_add_party\tadd_party;\n\tstruct uni_add_party_ack\tadd_party_ack;\n\tstruct uni_party_alerting\tparty_alerting;\n\tstruct uni_add_party_rej\tadd_party_rej;\n\tstruct uni_drop_party\tdrop_party;\n\tstruct uni_drop_party_ack\tdrop_party_ack;\n\tstruct uni_leaf_setup_req\tleaf_setup_req;\t/* !pnni */\n\tstruct uni_leaf_setup_fail\tleaf_setup_fail;\t/* !pnni */\n\tstruct uni_cobisetup\tcobisetup;\t/* !pnni&&q2932 */\n\tstruct uni_facility\tfacility;\t/* !pnni&&q2932 */\n\tstruct uni_modify_req\tmodify_req;\t/* !pnni */\n\tstruct uni_modify_ack\tmodify_ack;\t/* !pnni */\n\tstruct uni_modify_rej\tmodify_rej;\t/* !pnni */\n\tstruct uni_conn_avail\tconn_avail;\t/* !pnni */\n\tstruct uni_unknown\tunknown;\n};\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/netnatm/msg/unimsglib.h",
    "content": "/*\n * Copyright (c) 1996-2003\n *\tFraunhofer Institute for Open Communication Systems (FhG Fokus).\n * \tAll rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * Author: Hartmut Brandt <harti@freebsd.org>\n *\n * $Begemot: libunimsg/netnatm/msg/unimsglib.h,v 1.6 2004/07/08 08:22:07 brandt Exp $\n */\n#ifndef _NETNATM_MSG_UNIMSGLIB_H_\n#define _NETNATM_MSG_UNIMSGLIB_H_\n\n#include <netnatm/msg/uni_config.h>\n\nstruct uni_msg;\n\nenum uni_ierr_type {\n\tUNI_IERR_UNK,\t/* unknown IE */\n\tUNI_IERR_LEN,\t/* length error */\n\tUNI_IERR_BAD,\t/* content error */\n\tUNI_IERR_ACC,\t/* access element content error */\n\tUNI_IERR_MIS,\t/* mandatory IE missing (not used here) */\n};\n\nstruct uni_ierr {\n\tenum uni_ierr_type\terr;\t/* what error */\n\tenum uni_ieact\t\tact;\t/* the action indicator */\n\tu_int\t\t\tie:8;\t/* the ie type */\n\tu_int\t\t\tman:1;\t/* mandatory flag */\n\tu_int\t\t\tepref:1;/* Q.2971 9.5.3.2.1 low-pri epref */\n};\n\n/*\n * Context buffer. Needed to reduce number of arguments to routines.\n */\nstruct unicx {\n\t/*\n\t * globals for error handling\n\t */\n\tu_int\t\terrcnt;\t\t/* number of bad IEs */\n\tstruct uni_ierr\terr[UNI_MAX_ERRIE]; /* the errors */\n\n\tint\t\tq2932;\t\t/* Enable GFP */\n\tint\t\tpnni;\t\t/* Enable PNNI */\n\n\tint\t\tgit_hard;\t/* do hard check on GIT IE */\n\tint\t\tbearer_hard;\t/* do hard check on BEARER IE */\n\tint\t\tcause_hard;\t/* do hard check on cause */\n\n\tint\t\tmultiline;\t/* printing mode */\n\tu_int\t\ttabsiz;\t\t/* tabulation size */\n\n\t/*\n\t * Internal context of library -- don't touch\n\t */\n\tstruct uni_ie_repeat\trepeat;\t/* repeat IE during decoding */\n\tenum uni_ietype\t\tielast;\t/* last IE seen for repeat handling */\n\n\tconst char \t\t*prefix[20];\n\tu_int\t\t\tnprefix;\n\tint\t\t\tdoindent;\n\tchar\t\t\t*buf;\n\tsize_t\t\t\tbufsiz;\n\tu_int\t\t\tindent;\t\t/* indentation */\n\tint\t\t\tdont_init;\n};\n\n/*\n * Functions for all messages\n */\nvoid uni_print_cref(char *, size_t, const struct uni_cref *, struct unicx *);\nvoid uni_print_msghdr(char *, size_t, const struct uni_msghdr *, struct unicx *);\nvoid uni_print(char *, size_t, const struct uni_all *, struct unicx *);\nvoid uni_print_msg(char *, size_t, u_int _mtype, const union uni_msgall *,\n    struct unicx *);\nint uni_encode(struct uni_msg *, struct uni_all *, struct unicx *);\nint uni_decode(struct uni_msg *, struct uni_all *, struct unicx *);\n\nint uni_decode_head(struct uni_msg *, struct uni_all *, struct unicx *);\nint uni_decode_body(struct uni_msg *, struct uni_all *, struct unicx *);\n\nint uni_encode_msg_hdr(struct uni_msg *, struct uni_msghdr *, enum uni_msgtype,\n    struct unicx *, int *);\n\n\n/*\n * Functions for all information elements\n */\nvoid uni_print_ie(char *, size_t, enum uni_ietype, const union uni_ieall *,\n    struct unicx *);\nint uni_check_ie(enum uni_ietype, union uni_ieall *, struct unicx *);\nint uni_encode_ie(enum uni_ietype, struct uni_msg *, union uni_ieall *,\n    struct unicx *);\nint uni_decode_ie_hdr(enum uni_ietype *, struct uni_iehdr *, struct uni_msg *,\n    struct unicx *, u_int *);\nint uni_encode_ie_hdr(struct uni_msg *, enum uni_ietype, struct uni_iehdr *,\n    u_int, struct unicx *);\nint uni_decode_ie_body(enum uni_ietype, union uni_ieall *, struct uni_msg *,\n    u_int, struct unicx *);\n\n\n/*\n * Context handling\n */\nvoid uni_initcx(struct unicx *);\nvoid uni_print_cx(char *, size_t, struct unicx *);\n\n#define\tUNI_SAVE_IERR(CX, IETYPE, ACT, ERRCODE)\t\t\t\t\\\n\t(((CX)->errcnt < UNI_MAX_ERRIE) ?\t\t\t\t\\\n\t ((CX)->err[(CX)->errcnt].ie = (IETYPE),\t\t\t\\\n\t  (CX)->err[(CX)->errcnt].act = (ACT),\t\t\t\t\\\n\t  (CX)->err[(CX)->errcnt].err = (ERRCODE),\t\t\t\\\n\t  (CX)->err[(CX)->errcnt].man = 0,\t\t\t\t\\\n\t  (CX)->errcnt++,\t\t\t\t\t\t\\\n\t  1) : 0)\n\n/*\n * Traffic classification\n */\nenum uni_traffic_class {\n\tUNI_TRAFFIC_CBR1,\n\tUNI_TRAFFIC_CBR2,\n\tUNI_TRAFFIC_CBR3,\n\tUNI_TRAFFIC_rtVBR1,\n\tUNI_TRAFFIC_rtVBR2,\n\tUNI_TRAFFIC_rtVBR3,\n\tUNI_TRAFFIC_rtVBR4,\n\tUNI_TRAFFIC_rtVBR5,\n\tUNI_TRAFFIC_rtVBR6,\n\tUNI_TRAFFIC_nrtVBR1,\n\tUNI_TRAFFIC_nrtVBR2,\n\tUNI_TRAFFIC_nrtVBR3,\n\tUNI_TRAFFIC_nrtVBR4,\n\tUNI_TRAFFIC_nrtVBR5,\n\tUNI_TRAFFIC_nrtVBR6,\n\tUNI_TRAFFIC_ABR,\n\tUNI_TRAFFIC_UBR1,\n\tUNI_TRAFFIC_UBR2,\n};\n\n/* classify traffic */\nint uni_classify_traffic(const struct uni_ie_bearer *,\n    const struct uni_ie_traffic *,\n    enum uni_traffic_class *, enum uni_traffic_class *,\n    char *, size_t);\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/netnatm/msg/uniprint.h",
    "content": "/*\n * Copyright (c) 2001-2003\n *\tFraunhofer Institute for Open Communication Systems (FhG Fokus).\n * \tAll rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * Author: Hartmut Brandt <harti@freebsd.org>\n *\n * $Begemot: libunimsg/netnatm/msg/uniprint.h,v 1.4 2004/07/08 08:22:08 brandt Exp $\n *\n * Print utility functions. These are only needed if you want to hook to\n * the format of the uni printing routines.\n */\n#ifndef _NETNATM_MSG_UNIPRINT_H_\n#define _NETNATM_MSG_UNIPRINT_H_\n\n#include <netnatm/msg/uni_config.h>\n\n/*\n * This structure is used to define value->string mappings.\n * It must be terminated by a { NULL, 0 } entry.\n */\nstruct uni_print_tbl {\n\tconst char *name;\n\tu_int val;\n};\nvoid uni_print_tbl(const char *_entry, u_int _val,\n    const struct uni_print_tbl *_tbl, struct unicx *_cx);\n\n/* initialize printing. This must be called at the start from each external\n * callable printing function. */\nvoid uni_print_init(char *_buf, size_t _bufsiz, struct unicx *_cx);\n\n/* End the current (semantical) line. This takes care of indendation and\n * actually print the newline in the appropriate modes. */\nvoid uni_print_eol(struct unicx *_cx);\n\n/* Push or pop a prefix. This takes care of indendation. */\nvoid uni_print_push_prefix(const char *_prefix, struct unicx *_cx);\nvoid uni_print_pop_prefix(struct unicx *_cx);\n\n/* Print a flag taking care of the right prefixing */\nvoid uni_print_flag(const char *_flag, struct unicx *_cx);\n\n/* Print an entry taking care of the right prefixing */\nvoid uni_print_entry(struct unicx *_cx, const char *_entry,\n    const char *_fmt, ...) __printflike(3, 4);\n\n/* Generic printf */\nvoid uni_printf(struct unicx *_cx, const char *_fmt, ...) __printflike(2, 3);\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/netnatm/msg/unistruct.h",
    "content": "/*\n * Copyright (c) 1996-2003\n *\tFraunhofer Institute for Open Communication Systems (FhG Fokus).\n * \tAll rights reserved.\n *\n * Author: Hartmut Brandt <harti@freebsd.org>\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $Begemot: libunimsg/netnatm/msg/unistruct.h,v 1.7 2004/07/16 18:42:22 brandt Exp $\n *\n * This file defines all structures that are used by\n * API users.\n */\n#ifndef _NETNATM_MSG_UNISTRUCT_H_\n#define _NETNATM_MSG_UNISTRUCT_H_\n\n#include <netnatm/msg/uni_config.h>\n\n/*\n * define IE and MSG header\n */\n#include <netnatm/msg/uni_hdr.h>\n\n/*\n * define all IE's\n */\n/*************************************************************************\n *\n * Free FORM IE\n */\nstruct uni_ie_unrec {\n\tstruct uni_iehdr h;\n\tuint8_t id;\t\t/* ID of this IE */\n\tu_int len;\t\t/* data length */\n\tu_char data[128];\t/* arbitrary maximum length */\n};\n\n/*************************************************************************\n *\n * ATM adaptation layer parameters information element\n */\nenum {\n\tUNI_AAL_SUB_ID\t\t= 0x85,\n\tUNI_AAL_CBR_ID\t\t= 0x86,\n\tUNI_AAL_MULT_ID\t\t= 0x87,\n\tUNI_AAL_SCREC_ID\t= 0x88,\n\tUNI_AAL_ECM_ID\t\t= 0x89,\n\tUNI_AAL_BSIZE_ID\t= 0x8a,\n\tUNI_AAL_PART_ID\t\t= 0x8b,\n\tUNI_AAL_FWDCPCS_ID\t= 0x8c,\n\tUNI_AAL_BWDCPCS_ID\t= 0x81,\n\tUNI_AAL_MID_ID\t\t= 0x82,\n\tUNI_AAL_SSCS_ID\t\t= 0x84,\n};\n\nenum uni_aal {\n\tUNI_AAL_0\t= 0x00,\t/* voice */\n\tUNI_AAL_1\t= 0x01,\n\tUNI_AAL_2\t= 0x02,\n\tUNI_AAL_4\t= 0x03,\t/* same as AAL 3 */\n\tUNI_AAL_5\t= 0x05,\n\tUNI_AAL_USER\t= 0x10,\n};\nenum uni_aal1_subtype {\n\tUNI_AAL1_SUB_NULL\t= 0x00,\n\tUNI_AAL1_SUB_VOICE\t= 0x01,\n\tUNI_AAL1_SUB_CIRCUIT\t= 0x02,\n\tUNI_AAL1_SUB_HQAUDIO\t= 0x04,\n\tUNI_AAL1_SUB_VIDEO\t= 0x05,\n};\nenum uni_aal1_cbr {\n\tUNI_AAL1_CBR_64\t\t= 0x01,\n\tUNI_AAL1_CBR_1544\t= 0x04,\n\tUNI_AAL1_CBR_6312\t= 0x05,\n\tUNI_AAL1_CBR_32064\t= 0x06,\n\tUNI_AAL1_CBR_44736\t= 0x07,\n\tUNI_AAL1_CBR_97728\t= 0x08,\n\tUNI_AAL1_CBR_2048\t= 0x10,\n\tUNI_AAL1_CBR_8448\t= 0x11,\n\tUNI_AAL1_CBR_34368\t= 0x12,\n\tUNI_AAL1_CBR_139264\t= 0x13,\n\tUNI_AAL1_CBR_N64\t= 0x40,\n\tUNI_AAL1_CBR_N8\t\t= 0x41,\n};\nenum uni_aal1_screc {\n\tUNI_AAL1_SCREC_NULL\t= 0x00,\t/* synchr. circuit transport */\n\tUNI_AAL1_SCREC_SRTS\t= 0x01,\t/* synchr. residual timestamp */\n\tUNI_AAL1_SCREC_ACLK\t= 0x02,\t/* adaptive clock */\n};\nenum uni_aal1_ecm {\n\tUNI_AAL1_ECM_NULL\t= 0x00,\t/* no error correction */\n\tUNI_AAL1_ECM_LOSS\t= 0x01,\t/* for loss sensitive signals */\n\tUNI_AAL1_ECM_DELAY\t= 0x02,\t/* for delay sensitive signals */\n};\nenum uni_aal_sscs {\n\tUNI_AAL_SSCS_NULL\t= 0x00,\t/* Null */\n\tUNI_AAL_SSCS_SSCOPA\t= 0x01,\t/* assured SSCOP */\n\tUNI_AAL_SSCS_SSCOPU\t= 0x02,\t/* unassured SSCOP */\n\tUNI_AAL_SSCS_FRAME\t= 0x04,\t/* frame relay */\n};\n\nstruct uni_ie_aal {\n\tstruct uni_iehdr h;\n\tenum uni_aal\ttype;\t\t/* aal type */\n\n\tunion {\n#define UNI_AAL1_MULT_P\t0x01\n#define UNI_AAL1_SCREC_P\t0x02\n#define UNI_AAL1_ECM_P\t\t0x04\n#define UNI_AAL1_BSIZE_P\t0x08\n#define UNI_AAL1_PART_P\t0x10\n\t    struct {\n\t\tenum uni_aal1_subtype subtype;\t/* AAL1 subtype */\n\t\tenum uni_aal1_cbr cbr_rate;\t/* AAL1 CBR rate */\n\t\tu_int\t\tmult;\t\t/* AAL1 CBR mutliplier */\n\t\tenum uni_aal1_screc screc;\t/* AAL1 source clock recovery */\n\t\tenum uni_aal1_ecm ecm;\t\t/* AAL1 error correction */\n\t\tu_int\tbsize;\t\t\t/* AAL1 SDT blocksize */\n\t\tu_int\tpart;\t\t\t/* AAL1 partial cell fill */\n\t    } aal1;\n\n#define UNI_AAL4_CPCS_P\t0x01\n#define UNI_AAL4_MID_P\t\t0x02\n#define UNI_AAL4_SSCS_P\t0x04\n\t    struct {\n\t\tu_int\tfwd_cpcs;\t/* max fwd cpcs blocksize */\n\t\tu_int\tbwd_cpcs;\t/* max bkw cpcs blocksize */\n\t\tu_int\tmid_low;\t/* MID low range */\n\t\tu_int\tmid_high;\t/* MID high range */\n\t\tenum uni_aal_sscs sscs;\t/* sscs type */\n\t     } aal4;\n\n#define UNI_AAL5_CPCS_P\t0x01\n#define UNI_AAL5_SSCS_P\t0x02\n\t    struct {\n\t\tu_int\tfwd_cpcs;\t/* max fwd cpcs blocksize */\n\t\tu_int\tbwd_cpcs;\t/* max bkw cpcs blocksize */\n\t\tenum uni_aal_sscs sscs;\t/* sscs type */\n\t     } aal5;\n\n\t    struct {\n\t\tu_int\tlen;\t\t/* number of bytes */\n\t\tu_char\tuser[4];\t/* user data */\n\t    } aalu;\n\t} u;\n};\n\n/*************************************************************************\n *\n * Called party number information element\n * Called party subaddress information element\n * Calling party number information element\n * Calling party subaddress information element\n * Q.2951/UNI4.0 Connected number information element\n * Q.2951/UNI4.0 Connected subaddress information element\n */\nenum uni_addr_type {\n\tUNI_ADDR_UNKNOWN\t= 0x0,\n\tUNI_ADDR_INTERNATIONAL\t= 0x1,\n\tUNI_ADDR_NATIONAL\t= 0x2,\t/* not sup */\n\tUNI_ADDR_NETWORK\t= 0x3,\t/* not sup */\n\tUNI_ADDR_SUBSCR\t\t= 0x4,\t/* not sup */\n\tUNI_ADDR_ABBR\t\t= 0x6,\t/* not sup */\n};\nenum uni_addr_plan {\n\t/* UNI_ADDR_UNKNOWN\t= 0x0, */\t/* not sup */\n\tUNI_ADDR_E164\t\t= 0x1,\n\tUNI_ADDR_ATME\t\t= 0x2,\n\tUNI_ADDR_DATA\t\t= 0x3,\t/* not sup */\n\tUNI_ADDR_PRIVATE\t= 0x9,\t/* not sup */\n};\nenum uni_subaddr_type {\n\tUNI_SUBADDR_NSAP\t= 0x0,\n\tUNI_SUBADDR_ATME\t= 0x1,\n\tUNI_SUBADDR_USER\t= 0x2,\t/* not sup */\n};\nenum uni_addr_pres {\n\tUNI_ADDR_PRES\t\t= 0x0,\n\tUNI_ADDR_RESTRICT\t= 0x1,\n\tUNI_ADDR_NONUMBER\t= 0x2,\n};\nenum uni_addr_screen {\n\tUNI_ADDR_SCREEN_NOT\t= 0x0,\n\tUNI_ADDR_SCREEN_PASSED\t= 0x1,\n\tUNI_ADDR_SCREEN_FAILED\t= 0x2,\n\tUNI_ADDR_SCREEN_NET\t= 0x3,\n};\n\n/* don't use bitfields to get a defined structure layout */\nstruct uni_addr {\n\tuint8_t\t\t\ttype;\n\tuint8_t\t\t\tplan;\n\tuint8_t\t\t\tlen;\n\tu_char\t\t\taddr[UNI_ADDR_MAXLEN];\n};\nstruct uni_subaddr {\n\tenum uni_subaddr_type\ttype;\n\tu_int\t\t\tlen;\n\tu_char\t\t\taddr[UNI_SUBADDR_MAXLEN];\n};\n\nstruct uni_ie_called {\n\tstruct uni_iehdr\th;\n\tstruct uni_addr\taddr;\n};\n\nstruct uni_ie_calledsub {\n\tstruct uni_iehdr\th;\n\tstruct uni_subaddr\taddr;\n};\n\nstruct uni_ie_calling {\n\tstruct uni_iehdr\th;\n#define UNI_CALLING_SCREEN_P 0x0001\n\n\tstruct uni_addr\t\taddr;\n\tenum uni_addr_pres\tpres;\n\tenum uni_addr_screen\tscreen;\n};\n\nstruct uni_ie_callingsub {\n\tstruct uni_iehdr\th;\n\tstruct uni_subaddr\taddr;\n};\n\nstruct uni_ie_conned {\n\tstruct uni_iehdr\th;\n#define UNI_CONNED_SCREEN_P 0x0001\n\n\tstruct uni_addr\t\taddr;\n\tenum uni_addr_pres\tpres;\n\tenum uni_addr_screen\tscreen;\n};\n\nstruct uni_ie_connedsub {\n\tstruct uni_iehdr\th;\n\tstruct uni_subaddr\taddr;\n};\n\n/*************************************************************************\n *\n * Broadband bearer capability descriptor\n * On reception of an old bearer descriptor, it is automatically\n * converted to a new, legal one.\n */\nenum uni_bearer_class {\n\tUNI_BEARER_A\t\t= 0x01,\n\tUNI_BEARER_C\t\t= 0x03,\n\tUNI_BEARER_X\t\t= 0x10,\n\tUNI_BEARER_TVP\t\t= 0x30,\n};\n\nenum uni_bearer_atc {\n\tUNI_BEARER_ATC_CBR\t= 0x05,\n\tUNI_BEARER_ATC_CBR1\t= 0x07,\n\tUNI_BEARER_ATC_VBR\t= 0x09,\n\tUNI_BEARER_ATC_VBR1\t= 0x13,\n\tUNI_BEARER_ATC_NVBR\t= 0x0a,\n\tUNI_BEARER_ATC_NVBR1\t= 0x0b,\n\tUNI_BEARER_ATC_ABR\t= 0x0c,\n\n\tUNI_BEARER_ATCX_0\t= 0x00,\n\tUNI_BEARER_ATCX_1\t= 0x01,\n\tUNI_BEARER_ATCX_2\t= 0x02,\n\tUNI_BEARER_ATCX_4\t= 0x04,\n\tUNI_BEARER_ATCX_6\t= 0x06,\n\tUNI_BEARER_ATCX_8\t= 0x08,\n};\n\nenum uni_bearer_clip {\n\tUNI_BEARER_NOCLIP\t= 0x0,\n\tUNI_BEARER_CLIP\t\t= 0x1,\n};\n\nenum uni_bearer_cfg {\n\tUNI_BEARER_P2P\t\t= 0x0,\n\tUNI_BEARER_MP\t\t= 0x1,\n};\n\nstruct uni_ie_bearer {\n\tstruct uni_iehdr\th;\n#define UNI_BEARER_ATC_P\t0x02\n\n\tenum uni_bearer_class\tbclass;\t\t/* bearer class */\n\tenum uni_bearer_atc\tatc;\t\t/* ATM transfer capability */\n\tenum uni_bearer_clip\tclip;\t\t/* suspectibility to clipping */\n\tenum uni_bearer_cfg\tcfg;\t\t/* u-plane configuration */\n};\n\n/*************************************************************************\n *\n * Broadband higher layer information element\n */\nenum uni_bhli {\n\tUNI_BHLI_ISO\t= 0x00,\t/* IDO defined */\n\tUNI_BHLI_USER\t= 0x01,\t/* user specific */\n\tUNI_BHLI_VENDOR\t= 0x03,\t/* vendor specific */\n};\n\nstruct uni_ie_bhli {\n\tstruct uni_iehdr\th;\n\tenum uni_bhli\t\ttype;\n\tu_char\t\t\tinfo[8];\n\tu_int\t\t\tlen;\n};\n\n/*************************************************************************\n *\n * Boradband lower layer information element\n */\nenum {\n\tUNI_BLLI_L1_ID\t\t= 0x1,\n\tUNI_BLLI_L2_ID\t\t= 0x2,\n\tUNI_BLLI_L3_ID\t\t= 0x3,\n};\n\nenum uni_blli_l2 {\n\tUNI_BLLI_L2_BASIC\t= 0x01,\n\tUNI_BLLI_L2_Q921\t= 0x02,\n\tUNI_BLLI_L2_X25LL\t= 0x06,\n\tUNI_BLLI_L2_X25ML\t= 0x07,\n\tUNI_BLLI_L2_LABP\t= 0x08,\n\tUNI_BLLI_L2_HDLC_ARM\t= 0x09,\n\tUNI_BLLI_L2_HDLC_NRM\t= 0x0a,\n\tUNI_BLLI_L2_HDLC_ABM\t= 0x0b,\n\tUNI_BLLI_L2_LAN\t\t= 0x0c,\n\tUNI_BLLI_L2_X75\t\t= 0x0d,\n\tUNI_BLLI_L2_Q922\t= 0x0e,\n\tUNI_BLLI_L2_USER\t= 0x10,\n\tUNI_BLLI_L2_ISO7776\t= 0x11,\n};\n\nenum uni_blli_l2_mode {\n\tUNI_BLLI_L2NORM\t\t= 0x1,\n\tUNI_BLLI_L2EXT\t\t= 0x2,\n};\n\nenum uni_blli_l3 {\n\tUNI_BLLI_L3_X25\t\t= 0x06,\n\tUNI_BLLI_L3_ISO8208\t= 0x07,\n\tUNI_BLLI_L3_X223\t= 0x08,\n\tUNI_BLLI_L3_CLMP\t= 0x09,\n\tUNI_BLLI_L3_T70\t\t= 0x0a,\n\tUNI_BLLI_L3_TR9577\t= 0x0b,\n\tUNI_BLLI_L3_H310\t= 0x0c,\n\tUNI_BLLI_L3_H321\t= 0x0d,\n\tUNI_BLLI_L3_USER\t= 0x10,\n};\n\nenum uni_blli_l3_mode {\n\tUNI_BLLI_L3NSEQ\t\t= 0x1,\t/* normal sequence numbering */\n\tUNI_BLLI_L3ESEQ\t\t= 0x2,\t/* extended sequence numbering */\n};\n\nenum uni_blli_l3_psiz {\n\tUNI_BLLI_L3_16\t\t= 0x4,\t/* 16 byte packets */\n\tUNI_BLLI_L3_32\t\t= 0x5,\t/* 32 byte packets */\n\tUNI_BLLI_L3_64\t\t= 0x6,\t/* 64 byte packets */\n\tUNI_BLLI_L3_128\t\t= 0x7,\t/* 128 byte packets */\n\tUNI_BLLI_L3_256\t\t= 0x8,\t/* 256 byte packets */\n\tUNI_BLLI_L3_512\t\t= 0x9,\t/* 512 byte packets */\n\tUNI_BLLI_L3_1024\t= 0xa,\t/* 1024 byte packets */\n\tUNI_BLLI_L3_2048\t= 0xb,\t/* 2048 byte packets */\n\tUNI_BLLI_L3_4096\t= 0xc,\t/* 4096 byte packets */\n};\n\nenum uni_blli_l3_ttype {\n\tUNI_BLLI_L3_TTYPE_RECV\t= 0x1,\t/* receive only */\n\tUNI_BLLI_L3_TTYPE_SEND\t= 0x2,\t/* send only */\n\tUNI_BLLI_L3_TTYPE_BOTH\t= 0x3,\t/* both */\n};\n\nenum uni_blli_l3_mux {\n\tUNI_BLLI_L3_MUX_NOMUX\t= 0,\t/* no multiplexing */\n\tUNI_BLLI_L3_MUX_TS\t= 1,\t/* transport stream */\n\tUNI_BLLI_L3_MUX_TSFEC\t= 2,\t/* transport stream with FEC */\n\tUNI_BLLI_L3_MUX_PS\t= 3,\t/* program stream */\n\tUNI_BLLI_L3_MUX_PSFEC\t= 4,\t/* program stream with FEC */\n\tUNI_BLLI_L3_MUX_H221\t= 5,\t/* H.221 */\n};\n\nenum uni_blli_l3_tcap {\n\tUNI_BLLI_L3_TCAP_NOIND\t= 0,\t/* no indication */\n\tUNI_BLLI_L3_TCAP_AAL1\t= 1,\t/* only AAL1 */\n\tUNI_BLLI_L3_TCAP_AAL5\t= 2,\t/* only AAL5 */\n\tUNI_BLLI_L3_TCAP_AAL15\t= 3,\t/* AAL1 and AAL5 */\n};\n\n/* Value for l3_ipi: */\nenum {\n\tUNI_BLLI_L3_SNAP\t= 0x80,\t/* IEEE 802.1 SNAP */\n};\n\nstruct uni_ie_blli {\n\tstruct uni_iehdr\th;\n#define UNI_BLLI_L1_P\t\t0x0001\n#define UNI_BLLI_L2_P\t\t0x0002\n#define UNI_BLLI_L2_Q933_P\t0x0004\n#define UNI_BLLI_L2_WSIZ_P\t0x0008\n#define UNI_BLLI_L2_USER_P\t0x0010\n#define UNI_BLLI_L3_P\t\t0x0020\n#define UNI_BLLI_L3_MODE_P\t0x0040\n#define UNI_BLLI_L3_PSIZ_P\t0x0080\n#define UNI_BLLI_L3_WSIZ_P\t0x0100\n#define UNI_BLLI_L3_USER_P\t0x0200\n#define UNI_BLLI_L3_IPI_P\t0x0400\n#define UNI_BLLI_L3_SNAP_P\t0x0800\n#define UNI_BLLI_L3_TTYPE_P\t0x1000\n#define UNI_BLLI_L3_MUX_P\t0x2000\n\n\tu_int\t\t\tl1:5;\t\t/* layer 1 info */\n\n\tenum uni_blli_l2\tl2;\t\t/* layer 2 info */\n\tu_int\t\t\tl2_q933:2;\t/* layer 2 Q.933 use */\n\tenum uni_blli_l2_mode\tl2_mode;\t/* layer 2 HDLC mode */ \n\tu_char\t\t\tl2_user;\t/* layer 2 user info */\n\tu_char\t\t\tl2_wsiz;\t/* layer 2 window size */\n\n\tenum uni_blli_l3\tl3;\t\t/* layer 3 info */\n\tenum uni_blli_l3_mode\tl3_mode;\t/* layer 3 mode */\n\tenum uni_blli_l3_psiz\tl3_psiz;\t/* layer 3 default packet size */\n\tu_char\t\t\tl3_wsiz;\t/* layer 3 window size */\n\tu_char\t\t\tl3_user;\t/* layer 3 user info */\n\tu_char\t\t\tl3_ipi;\t\t/* IPI byte */\n\tu_int\t\t\toui;\t\t/* OUI bytes */\n\tu_int\t\t\tpid;\t\t/* PID bytes */\n\tenum uni_blli_l3_ttype\tl3_ttype;\t/* terminal bytes */\n\tenum uni_blli_l3_tcap\tl3_tcap;\t/* terminal capability */\n\tenum uni_blli_l3_mux\tl3_fmux;\t/* forward muxing */\n\tenum uni_blli_l3_mux\tl3_bmux;\t/* forward muxing */\n};\n\n/*************************************************************************\n *\n * Transit network selection IE\n */\nstruct uni_ie_tns {\n\tstruct uni_iehdr h;\n\tu_char\t\tnet[UNI_TNS_MAXLEN];\n\tu_int\t\tlen;\n};\n\n/*************************************************************************\n *\n * Call state information element\n */\nenum uni_callstate {\n\tUNI_CALLSTATE_U0\t= 0x00,\n\tUNI_CALLSTATE_N0\t= 0x00,\n\tUNI_CALLSTATE_NN0\t= 0x00,\n\n\tUNI_CALLSTATE_U1\t= 0x01,\n\tUNI_CALLSTATE_N1\t= 0x01,\n\tUNI_CALLSTATE_NN1\t= 0x01,\n\n\tUNI_CALLSTATE_U3\t= 0x03,\n\tUNI_CALLSTATE_N3\t= 0x03,\n\tUNI_CALLSTATE_NN3\t= 0x03,\n\n\tUNI_CALLSTATE_U4\t= 0x04,\n\tUNI_CALLSTATE_N4\t= 0x04,\n\tUNI_CALLSTATE_NN4\t= 0x04,\n\n\tUNI_CALLSTATE_U6\t= 0x06,\n\tUNI_CALLSTATE_N6\t= 0x06,\n\tUNI_CALLSTATE_NN6\t= 0x06,\n\n\tUNI_CALLSTATE_U7\t= 0x07,\n\tUNI_CALLSTATE_N7\t= 0x07,\n\tUNI_CALLSTATE_NN7\t= 0x07,\n\n\tUNI_CALLSTATE_U8\t= 0x08,\n\tUNI_CALLSTATE_N8\t= 0x08,\n\n\tUNI_CALLSTATE_U9\t= 0x09,\n\tUNI_CALLSTATE_N9\t= 0x09,\n\tUNI_CALLSTATE_NN9\t= 0x09,\n\n\tUNI_CALLSTATE_U10\t= 0x0a,\n\tUNI_CALLSTATE_N10\t= 0x0a,\n\tUNI_CALLSTATE_NN10\t= 0x0a,\n\n\tUNI_CALLSTATE_U11\t= 0x0b,\n\tUNI_CALLSTATE_N11\t= 0x0b,\n\tUNI_CALLSTATE_NN11\t= 0x0b,\n\n\tUNI_CALLSTATE_U12\t= 0x0c,\n\tUNI_CALLSTATE_N12\t= 0x0c,\n\tUNI_CALLSTATE_NN12\t= 0x0c,\n\n\tUNI_CALLSTATE_REST0\t= 0x00,\n\tUNI_CALLSTATE_REST1\t= 0x3d,\n\tUNI_CALLSTATE_REST2\t= 0x3e,\n\n\tUNI_CALLSTATE_U13\t= 0x0d,\n\tUNI_CALLSTATE_N13\t= 0x0d,\n\n\tUNI_CALLSTATE_U14\t= 0x0e,\n\tUNI_CALLSTATE_N14\t= 0x0e,\n};\n\nstruct uni_ie_callstate {\n\tstruct uni_iehdr\th;\n\tenum uni_callstate\tstate;\n};\n\n/*************************************************************************\n *\n * Cause information element\n */\nenum uni_cause_loc {\n\tUNI_CAUSE_LOC_USER\t= 0x0,\n\tUNI_CAUSE_LOC_PRIVLOC\t= 0x1,\n\tUNI_CAUSE_LOC_PUBLOC\t= 0x2,\n\tUNI_CAUSE_LOC_TRANSIT\t= 0x3,\n\tUNI_CAUSE_LOC_PUBREM\t= 0x4,\n\tUNI_CAUSE_LOC_PRIVREM\t= 0x5,\n\tUNI_CAUSE_LOC_INTERNAT\t= 0x6,\n\tUNI_CAUSE_LOC_BEYOND\t= 0x7,\n};\n\n#define UNI_DECLARE_CAUSE_VALUES \\\nD(UNALL_NUM,\t0x01 /*  1*/, COND,\tQ.850,\t\"Unallocated (unassigned) number\") \\\nD(NOROUTE_NET,\t0x02 /*  2*/, TNS,\tQ.850,\t\"No route to specified transit network\") \\\nD(NOROUTE,\t0x03 /*  3*/, COND,\tQ.850,\t\"No route to destination\") \\\nD(SPTONE,\t0x04 /*  4*/, NONE,\tQ.850,\t\"Send special information tone\") \\\nD(BADTRUNK,\t0x05 /*  5*/, NONE,\tQ.850,\t\"Misdialled trunk prefix\") \\\nD(BADCHAN,\t0x06 /*  6*/, NONE,\tQ.850,\t\"Channel unacceptable\") \\\nD(CALLAWARDED,\t0x07 /*  7*/, NONE,\tQ.850,\t\"Call awarded and being delivered in an established channel\") \\\nD(PREEMPT,\t0x08 /*  8*/, NONE,\tQ.850,\t\"Preemption\") \\\nD(PREEMPT_RES,\t0x09 /*  9*/, NONE,\tQ.850,\t\"Preemption - circuit reserved for reuse\") \\\nD(CLEARING,\t0x10 /* 16*/, COND,\tQ.850,\t\"Normal call clearing\") \\\nD(BUSY,\t\t0x11 /* 17*/, CCBS,\tQ.850,\t\"User busy\") \\\nD(NO_RESPONSE,\t0x12 /* 18*/, NONE,\tQ.850,\t\"No user responding\") \\\nD(NO_RESP_ALERT,0x13 /* 19*/, NONE,\tQ.850,\t\"No answer from user (user alerted)\") \\\nD(ABSENT,\t0x14 /* 20*/, NONE,\tQ.850,\t\"Subscriber absent\") \\\nD(REJECTED,\t0x15 /* 21*/, REJ,\tQ.850,\t\"Call rejected\") \\\nD(NUMCHG,\t0x16 /* 22*/, NUMBER,\tQ.850,\t\"Number changed\") \\\nD(REDIR,\t0x17 /* 23*/, NONE,\tQ.850,\t\"Redirection to new destination\") \\\nN(CLIR_REJECTED,0x17 /* 23*/, NONE,\tUNI4.0,\t\"User rejects call with calling line identification restriction (CLIR)\") \\\nD(EXCHG_ERR,\t0x19 /* 25*/, NONE,\tQ.850,\t\"Exchange routing error\") \\\nD(NOSEL_CLEAR,\t0x1a /* 26*/, NONE,\tQ.850,\t\"Non-selected user clearing\") \\\nD(DST_OOO,\t0x1b /* 27*/, NONE,\tQ.850,\t\"Destination out of order\") \\\nD(INV_ADDR,\t0x1c /* 28*/, NONE,\tQ.850,\t\"Invalid number format (address incomplete)\") \\\nD(FAC_REJ,\t0x1d /* 29*/, FAC,\tQ.850,\t\"Facility rejected\") \\\nD(STATUS,\t0x1e /* 30*/, NONE,\tQ.850,\t\"Response to STATUS ENQUIRY\") \\\nD(UNSPEC,\t0x1f /* 31*/, NONE,\tQ.850,\t\"Normal, unspecified\") \\\nD(TMY_PARTY,\t0x20 /* 32*/, NONE,\tQ.2971,\t\"Too many pending add party requests\") \\\nD(NOCHAN,\t0x22 /* 34*/, CCBS,\tQ.850,\t\"No circuit/channel available\") \\\nN(SOFT_NAVL,\t0x22 /* 34*/, NONE,\tPNNI1.0,\"Requested called party soft PVPC or PVCC not available\")\\\nD(VPCI_NAVL,\t0x23 /* 35*/, NONE,\tQ.2610,\t\"Requested VPCI/VCI not available\") \\\nD(VPCI_FAIL,\t0x24 /* 36*/, NONE,\tQ.2610,\t\"VPCI/VPI assignment failure\") \\\nD(CRATE_NAVL,\t0x25 /* 37*/, CRATE,\tQ.2610,\t\"User cell rate not available\") \\\nD(NET_OOO,\t0x26 /* 38*/, NONE,\tQ.850,\t\"Network out of order\") \\\nD(FRAME_OOS,\t0x27 /* 39*/, NONE,\tQ.850,\t\"Permanent frame mode connection out of service\") \\\nD(FRAME_OP,\t0x28 /* 40*/, NONE,\tQ.850,\t\"Permanent frame mode connection operational\") \\\nD(TEMP,\t\t0x29 /* 41*/, NONE,\tQ.850,\t\"Temporary failure\") \\\nD(CONG,\t\t0x2a /* 42*/, NONE,\tQ.850,\t\"Switching equipment congestion\") \\\nD(ACC_DISC,\t0x2b /* 43*/, IE,\tQ.850,\t\"Access information discarded\") \\\nD(REQNOCHAN,\t0x2c /* 44*/, NONE,\tQ.850,\t\"Requested circuit/channel not available\") \\\nD(NOVPCI,\t0x2d /* 45*/, NONE,\tQ.2610,\t\"No VPCI/VCI available\") \\\nD(PREC_BLOCK,\t0x2e /* 46*/, NONE,\tQ.850,\t\"Precedence call blocked\") \\\nD(RESRC_NAVL,\t0x2f /* 47*/, NONE,\tQ.850,\t\"Resource unavailable, unspecified\") \\\nD(QOS_NAVL,\t0x31 /* 49*/, COND,\tQ.850,\t\"Quality of service not available\") \\\nD(FAC_NOTSUB,\t0x32 /* 50*/, FAC,\tQ.850,\t\"Requested facility not subscribed\") \\\nD(OUT_CUG,\t0x35 /* 53*/, NONE,\tQ.850,\t\"Outgoing calls barred within CUG\") \\\nN(PGL_CHG,\t0x35 /* 53*/, NONE,\tPNNI1.0,\"Call cleared due to change in PGL\") \\\nD(IN_CUG,\t0x37 /* 55*/, NONE,\tQ.850,\t\"Incoming call barred within CUG\") \\\nD(BEARER_NAUTH,\t0x39 /* 57*/, ATTR,\tQ.850,\t\"Bearer capability not authorized\") \\\nD(BEARER_NAVL,\t0x3a /* 58*/, ATTR,\tQ.850,\t\"Bearer capability not presently available\") \\\nD(INCONS,\t0x3e /* 62*/, NONE,\tQ.850,\t\"Inconsistency in designated outgoing access information and subscriber class\") \\\nD(OPT_NAVL,\t0x3f /* 63*/, NONE,\tQ.850,\t\"Service or option not available, unspecified\") \\\nD(BEARER_NIMPL,\t0x41 /* 65*/, ATTR,\tQ.850,\t\"Bearer capability not implemented\") \\\nD(CHANNEL_NIMPL,0x42 /* 66*/, CHANNEL,\tQ.850,\t\"Channel type not implemented\") \\\nD(FAC_NIMPL,\t0x45 /* 69*/, FAC,\tQ.850,\t\"Requested facility not implemented\") \\\nD(RESTR_DIG,\t0x46 /* 70*/, NONE,\tQ.850,\t\"Only restricted digital information bearer capability is available\") \\\nD(TRAFFIC_UNSUP,0x49 /* 73*/, NONE,\tQ.2971,\t\"Unsupported combination of traffic parameters\") \\\nN(AAL_UNSUP,\t0x4c /* 78*/, NONE,\tUNI3.1,\t\"AAL parameters cannot be supported\") \\\nD(CREF_INV,\t0x51 /* 81*/, NONE,\tQ.850,\t\"Invalid call reference value\") \\\nD(CHANNEL_NEX,\t0x52 /* 82*/, CHANID,\tQ.850,\t\"Identified channel does not exist\") \\\nD(SUSPENDED,\t0x53 /* 83*/, NONE,\tQ.850,\t\"A suspended call exists, but this call identity does not\") \\\nD(CID_INUSE,\t0x54 /* 84*/, NONE,\tQ.850,\t\"Call identity in use\") \\\nD(NOTSUSP,\t0x55 /* 85*/, NONE,\tQ.850,\t\"No call suspended\") \\\nD(CLEARED,\t0x56 /* 86*/, CAUSE,\tQ.850,\t\"Call having requested call identity has been cleared\") \\\nD(NOT_MEMBER,\t0x57 /* 87*/, NONE,\tQ.850,\t\"User not member of CUG\") \\\nD(INCOMP,\t0x58 /* 88*/, PARAM,\tQ.850,\t\"Incompatible destination\") \\\nD(ENDP_INV,\t0x59 /* 89*/, IE,\tUNI3.1,\t\"Invalid endpoint reference\") \\\nD(NEX_CUG,\t0x5a /* 90*/, NONE,\tQ.850,\t\"Non-existend CUG\") \\\nD(TRANSIT_INV,\t0x5b /* 91*/, NONE,\tQ.850,\t\"Invalid transit network selection\") \\\nD(AALNOTSUPP,\t0x5d /* 93*/, NONE,\tQ.2610,\t\"AAL parameters cannot be supported\") \\\nD(INVMSG,\t0x5f /* 95*/, NONE,\tQ.850,\t\"Invalid message, unspecified\") \\\nD(MANDAT,\t0x60 /* 96*/, IE,\tQ.850,\t\"Mandatory information element is missing\") \\\nD(MTYPE_NIMPL,\t0x61 /* 97*/, MTYPE,\tQ.850,\t\"Message type non-existent or not implemented\") \\\nD(MSG_NOTCOMP,\t0x62 /* 98*/, MTYPE,\tQ.850,\t\"Message not compatible with call state or message type non-existent or not implemented\") \\\nD(IE_NIMPL,\t0x63 /* 99*/, IE,\tQ.850,\t\"Information element/parameter non-existent or not implemented\") \\\nD(IE_INV,\t0x64 /*100*/, IE,\tQ.850,\t\"Invalid information element contents\") \\\nD(MSG_INCOMP,\t0x65 /*101*/, MTYPE,\tQ.850,\t\"Message not compatible with call state\") \\\nD(RECOVER,\t0x66 /*102*/, TIMER,\tQ.850,\t\"Recovery on timer expiry\") \\\nD(PARAM_NEX,\t0x67 /*103*/, PARAM,\tQ.850,\t\"Parameter non-existent or not implemented, passed on\") \\\nN(BAD_LENGTH,\t0x68 /*104*/, NONE,\tUNI3.1,\t\"Incorrect message length\") \\\nD(PARAM_UNREC,\t0x6e /*110*/, PARAM,\tQ.850,\t\"Message with unrecognized parameter, discarded\") \\\nD(PROTO,\t0x6f /*111*/, NONE,\tQ.850,\t\"Protocol error, unspecified\") \\\nD(INTERWORKING,\t0x7f /*127*/, NONE,\tQ.850,\t\"Interworking, unspecified\")\n\n#define D(NAME,VAL,DIAG,STD,STR) UNI_CAUSE_##NAME = VAL,\n#define N(NAME,VAL,DIAG,STD,STR) UNI_CAUSE_##NAME = VAL,\n\nenum uni_cause {\nUNI_DECLARE_CAUSE_VALUES\n};\n\n#undef D\n#undef N\n\nenum uni_cause_class {\n\tUNI_CAUSE_CLASS_NORM\t= 0x0,\n\tUNI_CAUSE_CLASS_NORM1\t= 0x1,\n\tUNI_CAUSE_CLASS_RES\t= 0x2,\n\tUNI_CAUSE_CLASS_NAVL\t= 0x3,\n\tUNI_CAUSE_CLASS_NIMPL\t= 0x4,\n\tUNI_CAUSE_CLASS_INV\t= 0x5,\n\tUNI_CAUSE_CLASS_PROTO\t= 0x6,\n\tUNI_CAUSE_CLASS_INTER\t= 0x7,\n};\nenum uni_cause_pu {\n\tUNI_CAUSE_PU_PROVIDER\t= 0,\n\tUNI_CAUSE_PU_USER\t= 1,\n};\nenum uni_cause_na {\n\tUNI_CAUSE_NA_NORMAL\t= 0,\n\tUNI_CAUSE_NA_ABNORMAL\t= 1,\n};\nenum uni_cause_cond {\n\tUNI_CAUSE_COND_UNKNOWN\t= 0,\n\tUNI_CAUSE_COND_PERM\t= 1,\n\tUNI_CAUSE_COND_TRANS\t= 2,\n};\nenum uni_cause_reason {\n\tUNI_CAUSE_REASON_USER\t= 0x00,\n\tUNI_CAUSE_REASON_IEMISS\t= 0x01,\n\tUNI_CAUSE_REASON_IESUFF\t= 0x02,\n};\n\nenum uni_diag {\n\tUNI_DIAG_NONE,\t\t/* no diagnostics */\n\n\tUNI_DIAG_COND,\t\t/* Condition */\n\tUNI_DIAG_TNS,\t\t/* Transit Network Selector */\n\tUNI_DIAG_REJ,\t\t/* Call Rejected */\n\tUNI_DIAG_NUMBER,\t/* New Destination */\n\tUNI_DIAG_CRATE,\t\t/* Traffic descriptor subfield */\n\tUNI_DIAG_ATTR,\t\t/* Attribute idendity */\n\tUNI_DIAG_PARAM,\t\t/* Parameter, same as one IE */\n\tUNI_DIAG_TIMER,\t\t/* timer in ASCII */\n\tUNI_DIAG_MTYPE,\t\t/* Message type */\n\tUNI_DIAG_IE,\t\t/* Information element */\n\tUNI_DIAG_CHANID,\t/* VPCI/VCI */\n\n\tUNI_DIAG_CAUSE = UNI_DIAG_NONE,\t\t/* Not specified */\n\tUNI_DIAG_CHANNEL = UNI_DIAG_NONE,\t/* For N-ISDN */\n\tUNI_DIAG_CCBS = UNI_DIAG_NONE,\t\t/* Not used in Q.931 */\n\tUNI_DIAG_FAC = UNI_DIAG_NONE,\t\t/* Not specified */\n};\n\nenum {\n\tUNI_CAUSE_TRAFFIC_N\t= 34-6,\n\tUNI_CAUSE_IE_N\t\t= 34-6,\n\tUNI_CAUSE_ATTR_N\t= (34-6)/3,\n};\n\nstruct uni_ie_cause {\n\tstruct uni_iehdr\th;\n#define UNI_CAUSE_COND_P\t0x0001\n#define UNI_CAUSE_REJ_P\t\t0x0002\n#define UNI_CAUSE_REJ_USER_P\t0x0004\n#define UNI_CAUSE_REJ_IE_P\t0x0008\n#define UNI_CAUSE_IE_P\t\t0x0010\n#define UNI_CAUSE_TRAFFIC_P\t0x0020\n#define UNI_CAUSE_VPCI_P\t0x0040\n#define UNI_CAUSE_MTYPE_P\t0x0080\n#define UNI_CAUSE_TIMER_P\t0x0100\n#define UNI_CAUSE_TNS_P\t\t0x0200\n#define UNI_CAUSE_NUMBER_P\t0x0400\n#define UNI_CAUSE_ATTR_P\t0x0800\n#define UNI_CAUSE_PARAM_P\t0x1000\n\n\tenum uni_cause_loc\tloc;\n\tenum uni_cause\t\tcause;\n\n\tunion {\n\t    struct {\n\t\tenum uni_cause_pu\tpu;\n\t\tenum uni_cause_na\tna;\n\t\tenum uni_cause_cond\tcond;\n\t    } cond;\n\t    struct {\n\t\tenum uni_cause_reason\treason;\n\t\tenum uni_cause_cond\tcond;\n\t\tu_int\t\t\tuser;\n\t\tuint8_t\t\t\tie;\n\t    } rej;\n\t    struct {\n\t\tuint8_t\t\t\tie[UNI_CAUSE_IE_N];\n\t\tu_int\t\t\tlen;\n\t    } ie;\n\t    struct {\n\t\tuint8_t\t\t\ttraffic[UNI_CAUSE_TRAFFIC_N];\n\t\tu_int\t\t\tlen;\n\t    } traffic;\n\t    struct {\n\t\tuint16_t\t\tvpci;\n\t\tuint16_t\t\tvci;\n\t    } vpci;\n\t    uint8_t\t\t\tmtype;\n\t    u_char\t\t\ttimer[3];\n\t    struct uni_ie_tns\t\ttns;\n\t    struct uni_ie_called\tnumber;\t\t/* TNS does not fit */\n\t    uint8_t\t\t\tparam;\n\t    struct {\n\t\tu_int\t\t\tnattr;\n\t        u_char\t\t\tattr[UNI_CAUSE_ATTR_N][3];\n\t    }\t\t\t\tattr;\n\t} u;\n};\nenum uni_diag uni_diag(enum uni_cause, enum uni_coding);\n\n/* return a string for the cause (NULL if the coding/cause are illegal) */\nconst char *uni_ie_cause2str(enum uni_coding, u_int);\n\n/*************************************************************************\n *\n * Connection identifier information element\n */\nenum uni_connid_type {\n\tUNI_CONNID_VCI\t\t= 0,\n\tUNI_CONNID_ANYVCI\t= 1,\n\tUNI_CONNID_NOVCI\t= 4,\n};\nenum uni_connid_assoc {\n\tUNI_CONNID_ASSOC\t= 0,\n\tUNI_CONNID_NONASSOC\t= 1,\n};\nstruct uni_ie_connid {\n\tstruct uni_iehdr\th;\n\tenum uni_connid_assoc\tassoc;\n\tenum uni_connid_type\ttype;\n\tu_int\t\t\tvpci : 16;\n\tu_int\t\t\tvci : 16;\n};\n\n/*************************************************************************\n *\n * End point reference IE\n */\nstruct uni_ie_epref {\n\tstruct uni_iehdr\th;\n\tu_int\t\t\tflag : 1;\n\tu_int\t\t\tepref : 15;\n};\n\n/*************************************************************************\n *\n * End point state IE\n */\nenum uni_epstate {\n\tUNI_EPSTATE_NULL\t= 0x00,\n\tUNI_EPSTATE_ADD_INIT\t= 0x01,\n\tUNI_EPSTATE_ALERT_DLVD\t= 0x04,\n\tUNI_EPSTATE_ADD_RCVD\t= 0x06,\n\tUNI_EPSTATE_ALERT_RCVD\t= 0x07,\n\tUNI_EPSTATE_ACTIVE\t= 0x0a,\n\tUNI_EPSTATE_DROP_INIT\t= 0x0b,\n\tUNI_EPSTATE_DROP_RCVD\t= 0x0c,\n};\n\nstruct uni_ie_epstate {\n\tstruct uni_iehdr h;\n\tenum uni_epstate state;\n};\n\n/*************************************************************************\n *\n * Q.2932 Facility IE\n */\nenum {\n\tUNI_FACILITY_ROSE\t= 0x11,\n\n\tUNI_FACILITY_MAXAPDU\t= 128,\n};\n\nstruct uni_ie_facility {\n\tstruct uni_iehdr h;\n\n\tu_char\t\tproto;\n\tu_char\t\tapdu[UNI_FACILITY_MAXAPDU];\n\tu_int\t\tlen;\n};\n\n/*************************************************************************\n *\n * Notification indicator\n */\nenum {\n\tUNI_NOTIFY_MAXLEN\t= 128,\t/* maximum info length */\n};\nstruct uni_ie_notify {\n\tstruct uni_iehdr h;\n\tu_int\t\tlen;\n\tu_char\t\tnotify[UNI_NOTIFY_MAXLEN];\n};\n\n/*************************************************************************\n *\n * QoS information element\n */\nenum uni_qos {\n\tUNI_QOS_CLASS0\t= 0x00,\n\tUNI_QOS_CLASS1\t= 0x01,\n\tUNI_QOS_CLASS2\t= 0x02,\n\tUNI_QOS_CLASS3\t= 0x03,\n\tUNI_QOS_CLASS4\t= 0x04,\n};\n\nstruct uni_ie_qos {\n\tstruct uni_iehdr h;\n\tenum uni_qos\tfwd;\n\tenum uni_qos\tbwd;\n};\n\n/*************************************************************************\n *\n * Broadband repeat indicator information element\n */\nenum uni_repeat_type {\n\tUNI_REPEAT_PRIDESC\t= 0x02,\n\tUNI_REPEAT_STACK\t= 0x0a,\t\t/* PNNI */\n};\n\nstruct uni_ie_repeat {\n\tstruct uni_iehdr h;\n\tenum uni_repeat_type type;\n};\n\n/*************************************************************************\n *\n * Restart indicator information element\n */\nenum uni_restart_type {\n\tUNI_RESTART_CHANNEL\t= 0x0,\n\tUNI_RESTART_PATH\t= 0x1,\n\tUNI_RESTART_ALL\t\t= 0x2,\n};\n\nstruct uni_ie_restart {\n\tstruct uni_iehdr h;\n\tenum uni_restart_type rclass;\n};\n\n/*************************************************************************\n *\n * Broadband sending complete indicator information element\n */\nstruct uni_ie_scompl {\n\tstruct uni_iehdr h;\n};\n\n/*************************************************************************\n *\n * ATM traffic descriptor information element\n */\nenum {\n\tUNI_TRAFFIC_FMDCR_ID\t= 0x00,\n\tUNI_TRAFFIC_BMDCR_ID\t= 0x02,\n\tUNI_TRAFFIC_FPCR0_ID\t= 0x82,\n\tUNI_TRAFFIC_BPCR0_ID\t= 0x83,\n\tUNI_TRAFFIC_FPCR1_ID\t= 0x84,\n\tUNI_TRAFFIC_BPCR1_ID\t= 0x85,\n\tUNI_TRAFFIC_FSCR0_ID\t= 0x88,\n\tUNI_TRAFFIC_BSCR0_ID\t= 0x89,\n\tUNI_TRAFFIC_FSCR1_ID\t= 0x90,\n\tUNI_TRAFFIC_BSCR1_ID\t= 0x91,\n\tUNI_TRAFFIC_FABR1_ID\t= 0x92,\n\tUNI_TRAFFIC_BABR1_ID\t= 0x93,\n\tUNI_TRAFFIC_FMBS0_ID\t= 0xa0,\n\tUNI_TRAFFIC_BMBS0_ID\t= 0xa1,\n\tUNI_TRAFFIC_FMBS1_ID\t= 0xb0,\n\tUNI_TRAFFIC_BMBS1_ID\t= 0xb1,\n\tUNI_TRAFFIC_BEST_ID\t= 0xbe,\n\tUNI_TRAFFIC_MOPT_ID\t= 0xbf,\n\n\tUNI_TRAFFIC_FTAG\t= 0x01,\n\tUNI_TRAFFIC_BTAG\t= 0x02,\n\tUNI_TRAFFIC_FDISC\t= 0x80,\n\tUNI_TRAFFIC_BDISC\t= 0x40,\n\n\tUNI_MINTRAFFIC_FPCR0_ID\t= 0x82,\n\tUNI_MINTRAFFIC_BPCR0_ID\t= 0x83,\n\tUNI_MINTRAFFIC_FPCR1_ID\t= 0x84,\n\tUNI_MINTRAFFIC_BPCR1_ID\t= 0x85,\n\tUNI_MINTRAFFIC_FABR1_ID\t= 0x92,\n\tUNI_MINTRAFFIC_BABR1_ID\t= 0x93,\n\n\tUNI_MDCR_ORIGIN_USER\t= 0x00,\n\tUNI_MDCR_ORIGIN_NET\t= 0x01,\n};\n\n#define UNI_TRAFFIC_FPCR0_P\t0x0001\n#define UNI_TRAFFIC_BPCR0_P\t0x0002\n#define UNI_TRAFFIC_FPCR1_P\t0x0004\n#define UNI_TRAFFIC_BPCR1_P\t0x0008\n#define UNI_TRAFFIC_FSCR0_P\t0x0010\n#define UNI_TRAFFIC_BSCR0_P\t0x0020\n#define UNI_TRAFFIC_FSCR1_P\t0x0040\n#define UNI_TRAFFIC_BSCR1_P\t0x0080\n#define UNI_TRAFFIC_FMBS0_P\t0x0100\n#define UNI_TRAFFIC_BMBS0_P\t0x0200\n#define UNI_TRAFFIC_FMBS1_P\t0x0400\n#define UNI_TRAFFIC_BMBS1_P\t0x0800\n#define UNI_TRAFFIC_BEST_P\t0x1000\n#define UNI_TRAFFIC_MOPT_P\t0x2000\n#define UNI_TRAFFIC_FABR1_P\t0x4000\n#define UNI_TRAFFIC_BABR1_P\t0x8000\nstruct uni_xtraffic {\n\tu_int\tfpcr0, bpcr0;\n\tu_int\tfpcr1, bpcr1;\n\tu_int\tfscr0, bscr0;\n\tu_int\tfscr1, bscr1;\n\tu_int\tfmbs0, bmbs0;\n\tu_int\tfmbs1, bmbs1;\n\tu_int\tfabr1, babr1;\n\tu_int\tftag, btag;\n\tu_int\tfdisc, bdisc;\n};\n\nstruct uni_ie_traffic {\n\tstruct uni_iehdr h;\n\tstruct uni_xtraffic t;\n};\nstruct uni_ie_atraffic {\n\tstruct uni_iehdr h;\n\tstruct uni_xtraffic t;\n};\n\n/*\n * Q.2961 minimum traffic descriptor\n */\nstruct uni_ie_mintraffic {\n\tstruct uni_iehdr h;\n#define UNI_MINTRAFFIC_FPCR0_P\t0x0001\n#define UNI_MINTRAFFIC_BPCR0_P\t0x0002\n#define UNI_MINTRAFFIC_FPCR1_P\t0x0004\n#define UNI_MINTRAFFIC_BPCR1_P\t0x0008\n#define UNI_MINTRAFFIC_FABR1_P\t0x0010\n#define UNI_MINTRAFFIC_BABR1_P\t0x0020\n\n\tu_int\tfpcr0, bpcr0;\n\tu_int\tfpcr1, bpcr1;\n\tu_int\tfabr1, babr1;\n};\n\n/*\n * UNI4.0+ (af-cs-0147.000) Minimum Desired Cell Rate\n */\nstruct uni_ie_mdcr {\n\tstruct uni_iehdr h;\n\tu_int\torigin;\n\tu_int\tfmdcr, bmdcr;\n};\n\n/*************************************************************************\n *\n * User-user information information element\n */\nstruct uni_ie_uu {\n\tstruct uni_iehdr h;\n\tu_int\t\tlen;\n\tu_char\t\tuu[UNI_UU_MAXLEN];\n};\n\n/*************************************************************************\n *\n * Generic identifier transport\n */\nenum uni_git_std {\n\tUNI_GIT_STD_DSMCC\t= 0x01,\t/* DSM-CC */\n\tUNI_GIT_STD_H245\t= 0x02,\t/* H.245 */\n};\nenum uni_git_type {\n\tUNI_GIT_TYPE_SESS\t= 0x01,\t/* session id */\n\tUNI_GIT_TYPE_RES\t= 0x02,\t/* resource id */\n};\n\nenum {\n\tUNI_GIT_MAXSESS\t\t= 20,\t/* max session value length */\n\tUNI_GIT_MAXRES\t\t= 4,\t/* max resource value length */\n\n\tUNI_GIT_MAXVAL\t\t= 20,\t/* the maximum of the above */\n\tUNI_GIT_MAXSUB\t\t= 2,\t/* maximum number of og. 6 */\n};\n\nstruct uni_ie_git {\n\tstruct uni_iehdr\th;\n\n\tenum uni_git_std\tstd;\t/* identifier related standard/application */\n\tu_int\t\t\tnumsub;\n\tstruct {\n\t\tenum uni_git_type type;\t\n\t\tu_int\t\tlen;\n\t\tu_char\t\tval[UNI_GIT_MAXVAL];\n\t}\t\t\tsub[UNI_GIT_MAXSUB];\n};\n\n/*************************************************************************\n *\n * End-to-end transit delay\n */\nenum {\n\tUNI_EETD_CTD_ID\t\t= 0x01,\t/* cumulative transit delay */\n\tUNI_EETD_MTD_ID\t\t= 0x03,\t/* maximum transit delay */\n\tUNI_EETD_NET_ID\t\t= 0x0a,\t/* network generated */\n\tUNI_EETD_PMTD_ID\t= 0x0b,\t/* PNNI acceptable forward maximum ctd */\n\tUNI_EETD_PCTD_ID\t= 0x11,\t/* PNNI cumulative forward maximum ctd */\n\n\tUNI_EETD_ANYMAX\t\t= 0xffff,\n\tUNI_EETD_MAXVAL\t\t= 0xffff,\t/* maximum value */\n};\n\nstruct uni_ie_eetd {\n\tstruct uni_iehdr\th;\n#define UNI_EETD_CUM_P\t\t0x0001\n#define UNI_EETD_MAX_P\t\t0x0002\n#define UNI_EETD_NET_P\t\t0x0004\t/* UNI4.0 9.1.2.1 */\n#define UNI_EETD_PMTD_P\t\t0x0008\t/* PNNI1.0 6.4.5.24 */\n#define UNI_EETD_PCTD_P\t\t0x0010\t/* PNNI1.0 6.4.5.24 */\n\n\tu_int\tcumulative;\n\tu_int\tmaximum;\n\tu_int\tpmtd;\n\tu_int\tpctd;\n};\n\n/*************************************************************************\n * \n * Leaf-initiated-join call identifier\n */\nenum uni_lij_idtype {\n\tUNI_LIJ_IDTYPE_ROOT\t= 0x0,\t/* root created */\n};\n\nstruct uni_ie_lij_callid {\n\tstruct uni_iehdr\th;\n\n\tenum uni_lij_idtype\ttype;\n\tu_int\t\t\tcallid;\n};\n\n/*\n * LIJ parameters\n */\nenum uni_lij_screen {\n\tUNI_LIJ_SCREEN_NETJOIN\t= 0x0,\t/* without root notification */\n};\n\nstruct uni_ie_lij_param {\n\tstruct uni_iehdr\th;\n\n\tenum uni_lij_screen\tscreen;\n};\n\n/*\n * LIJ sequence number\n */\nstruct uni_ie_lij_seqno {\n\tstruct uni_iehdr\th;\n\n\tu_int\t\t\tseqno;\n};\n\n/*************************************************************************\n *\n * Locking/Non-locking shift not supported\n */\nstruct uni_ie_lshift {\n\tstruct uni_iehdr h;\n\tu_int\t\tset:3;\n};\n\nstruct uni_ie_nlshift {\n\tstruct uni_iehdr h;\n\tu_int\t\tset:3;\n};\n\n/*************************************************************************\n *\n * Externded QoS information element\n */\nenum {\n\tUNI_EXQOS_FACC_ID\t= 0x94,\n\tUNI_EXQOS_BACC_ID\t= 0x95,\n\tUNI_EXQOS_FCUM_ID\t= 0x96,\n\tUNI_EXQOS_BCUM_ID\t= 0x97,\n\tUNI_EXQOS_FCLR_ID\t= 0xa2,\n\tUNI_EXQOS_BCLR_ID\t= 0xa3,\n};\n\nenum uni_exqos_origin {\n\tUNI_EXQOS_USER\t= 0,\n\tUNI_EXQOS_NET\t= 1,\n};\n\nenum {\n\tUNI_EXQOS_ANY_CDV\t= 0xffffff,\n\tUNI_EXQOS_ANY_CLR\t= 0xff,\n};\n\nstruct uni_ie_exqos {\n\tstruct uni_iehdr\th;\n#define UNI_EXQOS_FACC_P\t0x0001\n#define UNI_EXQOS_BACC_P\t0x0002\n#define UNI_EXQOS_FCUM_P\t0x0004\n#define UNI_EXQOS_BCUM_P\t0x0008\n#define UNI_EXQOS_FCLR_P\t0x0010\n#define UNI_EXQOS_BCLR_P\t0x0020\n\n\tenum uni_exqos_origin\torigin;\n\tu_int\t\t\tfacc;\n\tu_int\t\t\tbacc;\n\tu_int\t\t\tfcum;\n\tu_int\t\t\tbcum;\n\tu_int\t\t\tfclr;\n\tu_int\t\t\tbclr;\n};\n\n/*************************************************************************\n *\n * Additional ABR parameters\n * ABR setup parameters\n */\nenum {\n\tUNI_ABRADD_FADD_ID\t= 0xc2,\n\tUNI_ABRADD_BADD_ID\t= 0xc3,\n\tUNI_ABRSETUP_FICR_ID\t= 0xc2,\n\tUNI_ABRSETUP_BICR_ID\t= 0xc3,\n\tUNI_ABRSETUP_FTBE_ID\t= 0xc4,\n\tUNI_ABRSETUP_BTBE_ID\t= 0xc5,\n\tUNI_ABRSETUP_RMFRT_ID\t= 0xc6,\n\tUNI_ABRSETUP_FRIF_ID\t= 0xc8,\n\tUNI_ABRSETUP_BRIF_ID\t= 0xc9,\n\tUNI_ABRSETUP_FRDF_ID\t= 0xca,\n\tUNI_ABRSETUP_BRDF_ID\t= 0xcb,\n};\n\nstruct uni_abr_rec {\n\tu_int\t\t\tpresent;\n#define UNI_ABR_REC_NRM_P\t0x80000000\n#define UNI_ABR_REC_TRM_P\t0x40000000\n#define UNI_ABR_REC_CDF_P\t0x20000000\n#define UNI_ABR_REC_ADTF_P\t0x10000000\n\tu_int\t\tnrm:3;\n\tu_int\t\ttrm:3;\n\tu_int\t\tcdf:3;\n\tu_int\t\tadtf:10;\n};\n\nstruct uni_ie_abradd {\n\tstruct uni_iehdr\th;\n\tstruct uni_abr_rec\tfwd, bwd;\n};\n\nstruct uni_ie_abrsetup {\n\tstruct uni_iehdr\th;\n#define UNI_ABRSETUP_FICR_P\t0x0001\n#define UNI_ABRSETUP_BICR_P\t0x0002\n#define UNI_ABRSETUP_FTBE_P\t0x0004\n#define UNI_ABRSETUP_BTBE_P\t0x0008\n#define UNI_ABRSETUP_FRIF_P\t0x0010\n#define UNI_ABRSETUP_BRIF_P\t0x0020\n#define UNI_ABRSETUP_FRDF_P\t0x0040\n#define UNI_ABRSETUP_BRDF_P\t0x0080\n#define UNI_ABRSETUP_RMFRT_P\t0x0100\n\n\tu_int\t\tficr, bicr;\n\tu_int\t\tftbe, btbe;\n\tu_int\t\trmfrt;\n\tu_int\t\tfrif, brif;\n\tu_int\t\tfrdf, brdf;\n};\n\n/*************************************************************************\n *\n * Connection scope information element\n */\nenum uni_cscope {\n\tUNI_CSCOPE_ORG\t= 0x01,\n};\n\nenum {\n\tUNI_CSCOPE_ORG_LOC\t= 0x01,\n\tUNI_CSCOPE_ORG_LOC_P1\t= 0x02,\n\tUNI_CSCOPE_ORG_LOC_P2\t= 0x03,\n\tUNI_CSCOPE_ORG_SITE_M1\t= 0x04,\n\tUNI_CSCOPE_ORG_SITE\t= 0x05,\n\tUNI_CSCOPE_ORG_SITE_P1\t= 0x06,\n\tUNI_CSCOPE_ORG_ORG_M1\t= 0x07,\n\tUNI_CSCOPE_ORG_ORG\t= 0x08,\n\tUNI_CSCOPE_ORG_ORG_P1\t= 0x09,\n\tUNI_CSCOPE_ORG_COMM_M1\t= 0x0a,\n\tUNI_CSCOPE_ORG_COMM\t= 0x0b,\n\tUNI_CSCOPE_ORG_COMM_P1\t= 0x0c,\n\tUNI_CSCOPE_ORG_REG\t= 0x0d,\n\tUNI_CSCOPE_ORG_INTER\t= 0x0e,\n\tUNI_CSCOPE_ORG_GLOBAL\t= 0x0f,\n};\n\nstruct uni_ie_cscope {\n\tstruct uni_iehdr\th;\n\tenum uni_cscope\t\ttype;\n\tu_int\t\t\tscope:8;\n};\n\n/*************************************************************************\n *\n * Connection scope information element\n */\nenum uni_report {\n\tUNI_REPORT_MODCONF\t= 0x01,\n\tUNI_REPORT_CLOCK\t= 0x02,\n\tUNI_REPORT_EEAVAIL\t= 0x04,\n\tUNI_REPORT_EEREQ\t= 0x05,\n\tUNI_REPORT_EECOMPL\t= 0x06,\n};\n\nstruct uni_ie_report {\n\tstruct uni_iehdr h;\n\tenum uni_report\treport;\n};\n\n/*************************************************************************\n *\n * PNNI Designated transit list information element\n */\nenum {\n\tUNI_DTL_LOGNP\t= 0x01,\n\tUNI_DTL_LOGNP_SIZE = 27,\n};\n\nstruct uni_ie_dtl {\n\tstruct uni_iehdr\th;\n\tu_int\t\t\tptr:16;\n\tu_int\t\t\tnum;\n\tstruct {\n\t  u_char\t\tnode_level;\n\t  u_char\t\tnode_id[21];\n\t  u_int\t\t\tport_id;\n\t}\t\t\tdtl[UNI_DTL_MAXNUM];\n};\n\n/*************************************************************************\n *\n * PNNI Crankback information element\n */\nenum uni_crankback {\n\tUNI_CRANKBACK_IF\t= 0x02,\n\tUNI_CRANKBACK_NODE\t= 0x03,\n\tUNI_CRANKBACK_LINK\t= 0x04,\n};\n\nenum {\n\tUNI_CAUSE_NXNODE_UNREACH = 128,\n\tUNI_CAUSE_DTL_NOT_MY_ID\t= 160,\n};\n\nstruct uni_ie_crankback {\n\tstruct uni_iehdr\th;\n#define UNI_CRANKBACK_TOP_P\t0x0001\n#define UNI_CRANKBACK_TOPX_P\t0x0002\n#define UNI_CRANKBACK_QOS_P\t0x0004\n\tu_int\t\t\tlevel:8;\n\tenum uni_crankback\ttype;\n\tunion {\n\t  struct {\n\t    u_char\t\tlevel;\n\t    u_char\t\tid[21];\n\t  }\t\t\tnode;\n\t  struct {\n\t    u_char\t\tplevel;\n\t    u_char\t\tpid[21];\n\t    u_int\t\tport;\n\t    u_char\t\tslevel;\n\t    u_char\t\tsid[21];\n\t  }\t\t\tlink;\n\t}\t\t\tid;\n\tu_int\t\t\tcause:8;\n\tunion {\n\t  struct {\n\t    u_int\t\tdir:8;\n\t    u_int\t\tport;\n\t    u_int\t\tavcr;\n\t    u_int\t\tcrm;\n\t    u_int\t\tvf;\n\t  }\t\t\ttop;\n\t  struct {\n\t    u_int\t\tctd:1;\n\t    u_int\t\tcdv:1;\n\t    u_int\t\tclr:1;\n\t    u_int\t\tother:1;\n\t  }\t\t\tqos;\n\t}\t\t\tdiag;\n};\n\n/*************************************************************************\n *\n * PNNI Call_ing/called party soft PVPC/PVCC information element\n */\nenum uni_soft_sel {\n\tUNI_SOFT_SEL_ANY\t= 0x00,\n\tUNI_SOFT_SEL_REQ\t= 0x02,\n\tUNI_SOFT_SEL_ASS\t= 0x04,\n};\n\nstruct uni_ie_calling_soft {\n\tstruct uni_iehdr h;\n#define UNI_CALLING_SOFT_VCI_P\t0x0001\n\tu_int\t\tvpi:12;\n\tu_int\t\tvci:16;\n};\nstruct uni_ie_called_soft {\n\tstruct uni_iehdr h;\n#define UNI_CALLED_SOFT_VPI_P\t0x0001\n#define UNI_CALLED_SOFT_VCI_P\t0x0002\n\tenum uni_soft_sel sel;\n\tu_int\t\tvpi:12;\n\tu_int\t\tvci:16;\n};\n\n/*************************************************************************/\n\n#include <netnatm/msg/uni_ie.h>\n#include <netnatm/msg/uni_msg.h>\n\nstruct uni_all {\n\tenum uni_msgtype\tmtype;\n\tunion uni_msgall\tu;\n};\n\nstruct uni_ie {\n\tenum uni_ietype\t\tietype;\n\tunion uni_ieall\t\tu;\n};\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/netnatm/natm.h",
    "content": "/*-\n * Copyright (c) 1996 Charles D. Cranor and Washington University.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. All advertising materials mentioning features or use of this software\n *    must display the following acknowledgement:\n *      This product includes software developed by Charles D. Cranor and\n *      Washington University.\n * 4. The name of the author may not be used to endorse or promote products\n *    derived from this software without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR\n * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES\n * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,\n * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF\n * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n *\n * $NetBSD: natm.h,v 1.1 1996/07/04 03:20:12 chuck Exp $\n * $FreeBSD: release/9.0.0/sys/netnatm/natm.h 168776 2007-04-16 12:31:35Z pjd $\n */\n\n/*\n * natm.h: native mode atm\n */\n\n/*\n * supported protocols\n */\n#define\tPROTO_NATMAAL0\t\t1\n#define\tPROTO_NATMAAL5\t\t2\t\n\n/*\n * sockaddr_natm\n */\n\nstruct sockaddr_natm {\n\tunsigned char\tsnatm_len;\t\t/* length */\n\tsa_family_t\tsnatm_family;\t\t/* AF_NATM */\n\tchar\t\tsnatm_if[IFNAMSIZ];\t/* interface name */\n\tu_int16_t\tsnatm_vci;\t\t/* vci */\n\tu_int8_t\tsnatm_vpi;\t\t/* vpi */\n};\n\n#ifdef _KERNEL\n\n/*\n * natm protocol control block\n */\nstruct natmpcb {\n\tLIST_ENTRY(natmpcb) pcblist;\t/* list pointers */\n\tu_int\t\tnpcb_inq;\t/* # of our pkts in proto q */\n\tstruct socket\t*npcb_socket;\t/* backpointer to socket */\n\tstruct ifnet\t*npcb_ifp;\t/* pointer to hardware */\n\tstruct in_addr\tipaddr;\t\t/* remote IP address, if APCB_IP */\n\tu_int16_t\tnpcb_vci;\t/* VCI */\n\tu_int8_t\tnpcb_vpi;\t/* VPI */\n\tu_int8_t\tnpcb_flags;\t/* flags */\n};\n\n/* flags */\n#define\tNPCB_FREE\t0x01\t\t/* free (not on any list) */\n#define\tNPCB_CONNECTED\t0x02\t\t/* connected */\n#define\tNPCB_IP\t\t0x04\t\t/* used by IP */\n#define\tNPCB_DRAIN\t0x08\t\t/* destroy as soon as inq == 0 */\n\n/* flag arg to npcb_free */\n#define\tNPCB_REMOVE\t0\t\t/* remove from global list */\n#define\tNPCB_DESTROY\t1\t\t/* destroy and be free */\n\nLIST_HEAD(npcblist, natmpcb);\n\n/* global data structures */\n\nextern struct mtx natm_mtx;\t\t/* global netnatm lock */\nextern struct npcblist natm_pcbs;\t/* global list of pcbs */\n#define\tNATM_STAT\n#ifdef NATM_STAT\nextern\tu_int\tnatm_sodropcnt;\nextern\tu_int\tnatm_sodropbytes;\t/* account of droppage */\nextern\tu_int\tnatm_sookcnt;\nextern\tu_int\tnatm_sookbytes;\t\t/* account of ok */\n#endif\n\n/* locking macros */\n#define\tNATM_LOCK_INIT()\tmtx_init(&natm_mtx, \"natm_mtx\", NULL, MTX_DEF)\n#define\tNATM_LOCK()\t\tmtx_lock(&natm_mtx)\n#define\tNATM_UNLOCK()\t\tmtx_unlock(&natm_mtx)\n#define\tNATM_LOCK_ASSERT()\tmtx_assert(&natm_mtx, MA_OWNED)\n\n/* external functions */\n\n/* natm_pcb.c */\nstruct\tnatmpcb *npcb_alloc(int);\nvoid\tnpcb_free(struct natmpcb *, int);\nstruct\tnatmpcb *npcb_add(struct natmpcb *, struct ifnet *, uint16_t, uint8_t);\n\n/* natm.c */\nextern struct pr_usrreqs natm_usrreqs;\n\n#ifdef SYSCTL_HANDLER_ARGS\nint\tnatm0_sysctl(SYSCTL_HANDLER_ARGS);\nint\tnatm5_sysctl(SYSCTL_HANDLER_ARGS);\n#endif\n\nvoid\tnatmintr(struct mbuf *);\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/netnatm/saal/sscfu.h",
    "content": "/*\n * Copyright (c) 1996-2003\n *\tFraunhofer Institute for Open Communication Systems (FhG Fokus).\n * \tAll rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * Author: Hartmut Brandt <harti@freebsd.org>\n *\n * $Begemot: libunimsg/netnatm/saal/sscfu.h,v 1.4 2004/07/08 08:22:15 brandt Exp $\n *\n * Public include file for UNI SSCF\n */\n#ifndef _NETNATM_SAAL_SSCFU_H_\n#define _NETNATM_SAAL_SSCFU_H_\n\n#include <sys/types.h>\n#include <netnatm/saal/sscopdef.h>\n#include <netnatm/saal/sscfudef.h>\n\n/*\n * Define how a buffer looks like.\n */\n#ifdef _KERNEL\n#ifdef __FreeBSD__\n#define SSCFU_MBUF_T mbuf\n#endif\n#else\n#define SSCFU_MBUF_T uni_msg\n#endif\n\nstruct SSCFU_MBUF_T;\nstruct sscfu;\n\n/* functions to be supplied by the SSCOP user */\nstruct sscfu_funcs {\n\t/* upper (SAAL) interface output */\n\tvoid\t(*send_upper)(struct sscfu *, void *, enum saal_sig,\n\t\t    struct SSCFU_MBUF_T *);\n\n\t/* lower (SSCOP) interface output */\n\tvoid\t(*send_lower)(struct sscfu *, void *, enum sscop_aasig,\n\t\t    struct SSCFU_MBUF_T *, u_int);\n\n\t/* function to move the SSCOP window */\n\tvoid\t(*window)(struct sscfu *, void *, u_int);\n\n\t/* debugging function */\n\tvoid\t(*verbose)(struct sscfu *, void *, const char *, ...)\n\t\t    __printflike(3, 4);\n};\n\n/* Function defined by the SSCF-UNI code */\n\n/* allocate and initialize a new SSCF instance */\nstruct sscfu *sscfu_create(void *, const struct sscfu_funcs *);\n\n/* destroy an SSCF instance and free all resources */\nvoid sscfu_destroy(struct sscfu *);\n\n/* reset the SSCF to the released state */\nvoid sscfu_reset(struct sscfu *);\n\n/* lower input interface (SSCOP signals) */\nvoid sscfu_input(struct sscfu *, enum sscop_aasig, struct SSCFU_MBUF_T *, u_int);\n\n/* upper input interface (SAAL) */\nint sscfu_saalsig(struct sscfu *, enum saal_sig, struct SSCFU_MBUF_T *);\n\n/* retrieve the current state */\nenum sscfu_state sscfu_getstate(const struct sscfu *);\n\n/* char'ify signals and states */\nconst char *sscfu_signame(enum saal_sig);\nconst char *sscfu_statename(enum sscfu_state);\n\n/* retrieve the default set of parameters for SSCOP */\nu_int sscfu_getdefparam(struct sscop_param *);\n\n/* get/set debugging flags */\nvoid sscfu_setdebug(struct sscfu *, u_int);\nu_int sscfu_getdebug(const struct sscfu *);\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/netnatm/saal/sscfudef.h",
    "content": "/*\n * Copyright (c) 1996-2003\n *\tFraunhofer Institute for Open Communication Systems (FhG Fokus).\n * \tAll rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * Author: Hartmut Brandt <harti@freebsd.org>\n *\n * $Begemot: libunimsg/netnatm/saal/sscfudef.h,v 1.4 2004/07/08 08:22:16 brandt Exp $\n *\n * Definitions of UNI SSCF constants.\n */\n#ifndef _NETNATM_SAAL_SSCFUDEF_H_\n#define _NETNATM_SAAL_SSCFUDEF_H_\n\n/*\n * Signals at the upper boundary of the SSCF.\n */\nenum saal_sig {\n\tSAAL_ESTABLISH_request,\t\t/* U -> SAAL: (UU) */\n\tSAAL_ESTABLISH_indication,\t/* SAAL -> U: (UU) */\n\tSAAL_ESTABLISH_confirm,\t\t/* SAAL -> U: (UU) */\n\tSAAL_RELEASE_request,\t\t/* U -> SAAL: (UU) */\n\tSAAL_RELEASE_confirm,\t\t/* SAAL -> U: */\n\tSAAL_RELEASE_indication,\t/* SAAL -> U: (UU) */\n\tSAAL_DATA_request,\t\t/* U -> SAAL: (DATA) */\n\tSAAL_DATA_indication,\t\t/* SAAL -> U: (DATA) */\n\tSAAL_UDATA_request,\t\t/* U -> SAAL: (UDATA) */\n\tSAAL_UDATA_indication,\t\t/* SAAL -> U: (UDATA) */\n};\n\n/*\n * States of the SSCF\n */\nenum sscfu_state {\n\tSSCFU_RELEASED,\t\t\t/* 1/1 */\n\tSSCFU_AWAITING_ESTABLISH,\t/* 2/2 */\n\tSSCFU_AWAITING_RELEASE,\t\t/* 4/10 */\n\tSSCFU_ESTABLISHED,\t\t/* 3/4 */\n\tSSCFU_RESYNC,\t\t\t/* 2/5 */\n};\n\n/*\n * Debugging flags\n */\nenum {\n\tSSCFU_DBG_LSIG\t\t= 0x01,\n\tSSCFU_DBG_ERR\t\t= 0x02,\n\tSSCFU_DBG_STATE\t\t= 0x04,\n\tSSCFU_DBG_EXEC\t\t= 0x08,\n};\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/netnatm/saal/sscop.h",
    "content": "/*\n * Copyright (c) 1996-2003\n *\tFraunhofer Institute for Open Communication Systems (FhG Fokus).\n * \tAll rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * Author: Hartmut Brandt <harti@freebsd.org>\n *\n * $Begemot: libunimsg/netnatm/saal/sscop.h,v 1.4 2004/07/08 08:22:16 brandt Exp $\n *\n * External interface to sscop.\n */\n#ifndef _NETNATM_SAAL_SSCOP_H_\n#define _NETNATM_SAAL_SSCOP_H_\n\n#include <netnatm/saal/sscopdef.h>\n\n/*\n * Define how a buffer looks like.\n */\n#ifdef _KERNEL\n#ifdef __FreeBSD__\n#define SSCOP_MBUF_T mbuf\n#endif\n#else\n#define SSCOP_MBUF_T uni_msg\n#endif\n\nstruct SSCOP_MBUF_T;\nstruct sscop;\n\n/*\n * Vector for user functions\n */\nstruct sscop_funcs {\n\t/* management signal from SSCOP */\n\tvoid\t(*send_manage)(struct sscop *, void *, enum sscop_maasig,\n\t\t    struct SSCOP_MBUF_T *, u_int, u_int);\n\n\t/* AAL signal from SSCOP */\n\tvoid\t(*send_upper)(struct sscop *, void *, enum sscop_aasig,\n\t\t    struct SSCOP_MBUF_T *, u_int);\n\n\t/* send a PDU to the wire */\n\tvoid\t(*send_lower)(struct sscop *, void *,\n\t\t    struct SSCOP_MBUF_T *);\n\n\t/* print a message */\n\tvoid\t(*verbose)(struct sscop *, void *, const char *, ...)\n\t\t    __printflike(3,4);\n\n#ifndef _KERNEL\n\t/* start a timer */\n\tvoid\t*(*start_timer)(struct sscop *, void *, u_int,\n\t\t    void (*)(void *));\n\n\t/* stop a timer */\n\tvoid\t(*stop_timer)(struct sscop *, void *, void *);\n#endif\n};\n\n/* Function defined by the SSCOP code */\n\n/* create a new SSCOP instance and initialize to default values */\nstruct sscop *sscop_create(void *, const struct sscop_funcs *);\n\n/* destroy an SSCOP instance */\nvoid sscop_destroy(struct sscop *);\n\n/* get the current parameters of an SSCOP */\nvoid sscop_getparam(const struct sscop *, struct sscop_param *);\n\n/* set new parameters in an SSCOP */\nint sscop_setparam(struct sscop *, struct sscop_param *, u_int *);\n\n/* deliver an signal to the SSCOP */\nint sscop_aasig(struct sscop *, enum sscop_aasig, struct SSCOP_MBUF_T *, u_int);\n\n/* deliver an management signal to the SSCOP */\nint sscop_maasig(struct sscop *, enum sscop_maasig, struct SSCOP_MBUF_T *);\n\n/* SSCOP input function */\nvoid sscop_input(struct sscop *, struct SSCOP_MBUF_T *);\n\n/* Move the window by a given number of messages. Return the new window */\nu_int sscop_window(struct sscop *, u_int);\n\n/* declare the lower layer busy or not busy */\nu_int sscop_setbusy(struct sscop *, int);\n\n/* retrieve the state */\nenum sscop_state sscop_getstate(const struct sscop *);\n\n/* map signals to strings */\nconst char *sscop_msigname(enum sscop_maasig);\nconst char *sscop_signame(enum sscop_aasig);\nconst char *sscop_statename(enum sscop_state);\n\n/* set/get debugging state */\nvoid sscop_setdebug(struct sscop *, u_int);\nu_int sscop_getdebug(const struct sscop *);\n\n/* reset the instance */\nvoid sscop_reset(struct sscop *);\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/netnatm/saal/sscopdef.h",
    "content": "/*\n * Copyright (c) 1996-2003\n *\tFraunhofer Institute for Open Communication Systems (FhG Fokus).\n * \tAll rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * Author: Hartmut Brandt <harti@freebsd.org>\n *\n * $Begemot: libunimsg/netnatm/saal/sscopdef.h,v 1.4 2004/07/08 08:22:17 brandt Exp $\n *\n * Definitions of SSCOP constants and parameter blocks. This is seen by\n * the outside world.\n */\n#ifndef _NETNATM_SAAL_SSCOPDEF_H_\n#define _NETNATM_SAAL_SSCOPDEF_H_\n\n#include <sys/types.h>\n#ifdef _KERNEL\n#include <sys/stdint.h>\n#else\n#include <stdint.h>\n#endif\n\n/*\n * AA-interface signals\n */\nenum sscop_aasig {\n\tSSCOP_ESTABLISH_request,\t/* <- UU, BR */\n\tSSCOP_ESTABLISH_indication,\t/* -> UU */\n\tSSCOP_ESTABLISH_response,\t/* <- UU, BR */\n\tSSCOP_ESTABLISH_confirm,\t/* -> UU */\n\n\tSSCOP_RELEASE_request,\t\t/* <- UU */\n\tSSCOP_RELEASE_indication,\t/* -> UU, SRC */\n\tSSCOP_RELEASE_confirm,\t\t/* -> */\n\n\tSSCOP_DATA_request,\t\t/* <- MU */\n\tSSCOP_DATA_indication,\t\t/* -> MU, SN */\n\n\tSSCOP_UDATA_request,\t\t/* <- MU */\n\tSSCOP_UDATA_indication,\t\t/* -> MU */\n\n\tSSCOP_RECOVER_indication,\t/* -> */\n\tSSCOP_RECOVER_response,\t\t/* <- */\n\n\tSSCOP_RESYNC_request,\t\t/* <- UU */\n\tSSCOP_RESYNC_indication,\t/* -> UU */\n\tSSCOP_RESYNC_response,\t\t/* <- */\n\tSSCOP_RESYNC_confirm,\t\t/* -> */\n\n\tSSCOP_RETRIEVE_request,\t\t/* <- RN */\n\tSSCOP_RETRIEVE_indication,\t/* -> MU */\n\tSSCOP_RETRIEVE_COMPL_indication,/* -> */\n};\n\nenum sscop_maasig {\n\tSSCOP_MDATA_request,\t\t/* <- MU */\n\tSSCOP_MDATA_indication,\t\t/* -> MU */\n\tSSCOP_MERROR_indication,\t/* -> CODE, CNT */\n};\n\n/*\n * Values for retrieval. Numbers in SSCOP are 24bit, so\n * we can use the large values\n */\nenum {\n\tSSCOP_MAXSEQNO\t\t= 0xffffff,\n\n\tSSCOP_RETRIEVE_UNKNOWN\t= SSCOP_MAXSEQNO + 1,\n\tSSCOP_RETRIEVE_TOTAL\t= SSCOP_MAXSEQNO + 2,\n};\n\n/*\n * SSCOP states\n */\nenum sscop_state {\n\tSSCOP_IDLE,\t\t/* initial state */\n\tSSCOP_OUT_PEND,\t\t/* outgoing connection pending */\n\tSSCOP_IN_PEND,\t\t/* incoming connection pending */\n\tSSCOP_OUT_DIS_PEND,\t/* outgoing disconnect pending */\n\tSSCOP_OUT_RESYNC_PEND,\t/* outgoing resynchronisation pending */\n\tSSCOP_IN_RESYNC_PEND,\t/* incoming resynchronisation pending */\n\tSSCOP_OUT_REC_PEND,\t/* outgoing recovery pending */\n\tSSCOP_REC_PEND,\t\t/* recovery response pending */\n\tSSCOP_IN_REC_PEND,\t/* incoming recovery pending */\n\tSSCOP_READY,\t\t/* data transfer ready */\n};\n#define SSCOP_NSTATES 10\n\nstruct sscop_param {\n\tuint32_t\ttimer_cc;\t/* timer_cc in msec */\n\tuint32_t\ttimer_poll;\t/* timer_poll im msec */\n\tuint32_t\ttimer_keep_alive;/* timer_keep_alive in msec */\n\tuint32_t\ttimer_no_response;/*timer_no_response in msec */\n\tuint32_t\ttimer_idle;\t/* timer_idle in msec */\n\tuint32_t\tmaxk;\t\t/* maximum user data in bytes */\n\tuint32_t\tmaxj;\t\t/* maximum u-u info in bytes */\n\tuint32_t\tmaxcc;\t\t/* max. retransmissions for control packets */\n\tuint32_t\tmaxpd;\t\t/* max. vt(pd) before sending poll */\n\tuint32_t\tmaxstat;\t/* max. number of elements in stat list */\n\tuint32_t\tmr;\t\t/* initial window */\n\tuint32_t\tflags;\t\t/* flags */\n};\nenum {\n\tSSCOP_ROBUST \t= 0x0001,\t/* atmf/97-0216 robustness */\n\tSSCOP_POLLREX\t= 0x0002,\t/* send POLL after retransmit */\n};\n\nenum {\n\tSSCOP_SET_TCC\t\t= 0x0001,\n\tSSCOP_SET_TPOLL\t\t= 0x0002,\n\tSSCOP_SET_TKA\t\t= 0x0004,\n\tSSCOP_SET_TNR\t\t= 0x0008,\n\tSSCOP_SET_TIDLE\t\t= 0x0010,\n\tSSCOP_SET_MAXK\t\t= 0x0020,\n\tSSCOP_SET_MAXJ\t\t= 0x0040,\n\tSSCOP_SET_MAXCC\t\t= 0x0080,\n\tSSCOP_SET_MAXPD\t\t= 0x0100,\n\tSSCOP_SET_MAXSTAT\t= 0x0200,\n\tSSCOP_SET_MR\t\t= 0x0400,\n\tSSCOP_SET_ROBUST\t= 0x0800,\n\tSSCOP_SET_POLLREX\t= 0x1000,\n\n\tSSCOP_SET_ALLMASK\t= 0x1fff,\n};\n\nenum {\n\tSSCOP_DBG_USIG\t= 0x0001,\n\tSSCOP_DBG_TIMER\t= 0x0002,\n\tSSCOP_DBG_BUG\t= 0x0004,\n\tSSCOP_DBG_INSIG\t= 0x0008,\n\tSSCOP_DBG_STATE\t= 0x0010,\n\tSSCOP_DBG_PDU\t= 0x0020,\n\tSSCOP_DBG_ERR\t= 0x0040,\n\tSSCOP_DBG_EXEC\t= 0x0080,\n\tSSCOP_DBG_FLOW\t= 0x0100,\n};\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/netnatm/sig/uni.h",
    "content": "/*\n * Copyright (c) 2001-2003\n *\tFraunhofer Institute for Open Communication Systems (FhG Fokus).\n * \tAll rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * Author: Hartmut Brandt <harti@freebsd.org>\n *\n * $Begemot: libunimsg/netnatm/sig/uni.h,v 1.5 2004/07/08 08:22:24 brandt Exp $\n *\n * Public UNI interface\n */\n#ifndef _NETNATM_SIG_UNI_H_\n#define _NETNATM_SIG_UNI_H_\n\n#include <netnatm/sig/unidef.h>\n\nstruct uni;\n\n/* functions to be supplied by the user */\nstruct uni_funcs {\n\t/* output to the upper layer */\n\tvoid\t(*uni_output)(struct uni *, void *, enum uni_sig,\n\t\t    uint32_t, struct uni_msg *);\n\n\t/* output to the SAAL */\n\tvoid\t(*saal_output)(struct uni *, void *, enum saal_sig,\n\t\t    struct uni_msg *);\n\n\t/* verbosity */\n\tvoid\t(*verbose)(struct uni *, void *, enum uni_verb,\n\t\t    const char *, ...) __printflike(4, 5);\n\n\t/* function to 'print' status */\n\tvoid\t(*status)(struct uni *, void *, void *,\n\t\t    const char *, ...) __printflike(4, 5);\n\n#ifndef _KERNEL\n\t/* start a timer */\n\tvoid\t*(*start_timer)(struct uni *, void *, u_int,\n\t\t    void (*)(void *), void *);\n\n\t/* stop a timer */\n\tvoid\t(*stop_timer)(struct uni *, void *, void *);\n#endif\n};\n\n/* create a UNI instance */\nstruct uni *uni_create(void *, const struct uni_funcs *);\n\n/* destroy a UNI instance, free all resources */\nvoid uni_destroy(struct uni *);\n\n/* generate a status report */\nvoid uni_status(struct uni *, void *);\n\n/* get current instance configuration */\nvoid uni_get_config(const struct uni *, struct uni_config *);\n\n/* set new instance configuration */\nvoid uni_set_config(struct uni *, const struct uni_config *,\n\tuint32_t *, uint32_t *, uint32_t *);\n\n/* input from the SAAL to the instance */\nvoid  uni_saal_input(struct uni *, enum saal_sig, struct uni_msg *);\n\n/* input from the upper layer to the instance */\nvoid uni_uni_input(struct uni *, enum uni_sig, uint32_t, struct uni_msg *);\n\n/* do work on pending signals */\nvoid uni_work(struct uni *);\n\n/* set debuging level */\nvoid uni_set_debug(struct uni *, enum uni_verb, u_int level);\nu_int uni_get_debug(const struct uni *, enum uni_verb);\n\n/* reset a UNI instance */\nvoid uni_reset(struct uni *);\n\n/* states */\nu_int uni_getcustate(const struct uni *);\n\n/* return a reference to the coding/decoding context */\nstruct unicx *uni_context(struct uni *);\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/netnatm/sig/unidef.h",
    "content": "/*\n * Copyright (c) 1996-2003\n *\tFraunhofer Institute for Open Communication Systems (FhG Fokus).\n * \tAll rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * Author: Hartmut Brandt <harti@freebsd.org>\n *\n * $Begemot: libunimsg/netnatm/sig/unidef.h,v 1.9 2004/07/08 08:22:24 brandt Exp $\n *\n * UNI public definitions.\n */\n#ifndef _ATM_SIG_UNIDEF_H_\n#define _ATM_SIG_UNIDEF_H_\n\n#ifdef _KERNEL\n#include <sys/stdint.h>\n#else\n#include <stdint.h>\n#endif\n\n/*\n * Debug facilities\n */\n#define UNI_DEBUG_FACILITIES\t\t\\\n\tUNI_DEBUG_DEFINE(TIMEOUT)\t\\\n\tUNI_DEBUG_DEFINE(RESTART)\t\\\n\tUNI_DEBUG_DEFINE(SAAL)\t\t\\\n\tUNI_DEBUG_DEFINE(PARSE)\t\t\\\n\tUNI_DEBUG_DEFINE(CALL)\t\t\\\n\tUNI_DEBUG_DEFINE(WARN)\t\t\\\n\tUNI_DEBUG_DEFINE(COORD)\t\t\\\n\tUNI_DEBUG_DEFINE(API)\t\t\\\n\tUNI_DEBUG_DEFINE(MSG)\t\t\\\n\tUNI_DEBUG_DEFINE(ERR)\t\t\\\n\tUNI_DEBUG_DEFINE(VERIFY)\t\\\n\nenum uni_verb {\n#define UNI_DEBUG_DEFINE(D) UNI_FAC_##D,\n\tUNI_DEBUG_FACILITIES\n#undef UNI_DEBUG_DEFINE\n\n\tUNI_MAXFACILITY,\n};\n\n/*\n * Default timer values and repeat counts\n */\n#define UNI_T301_DEFAULT\t180000\n#define UNI_T303_DEFAULT\t4000\n#define UNI_T303_CNT_DEFAULT\t2\n#define UNI_T308_DEFAULT\t30000\n#define UNI_T308_CNT_DEFAULT\t2\n#define UNI_T309_DEFAULT\t10000\n#define UNI_T310U_DEFAULT\t30000\n#define UNI_T310N_DEFAULT\t10000\n#define UNI_T313_DEFAULT\t4000\n#define UNI_T316_DEFAULT\t120000\n#define UNI_T316_CNT_DEFAULT\t2\n#define UNI_T317_DEFAULT\t90000\n#define UNI_T322_DEFAULT\t4000\n#define UNI_T322_CNT_DEFAULT\t2\n#define UNI_T397_DEFAULT\tUNI_T301_DEFAULT\n#define UNI_T398_DEFAULT\t4000\n#define UNI_T399U_DEFAULT\t(UNI_T303_DEFAULT + UNI_T310U_DEFAULT)\n#define UNI_T399N_DEFAULT\t(UNI_T303_DEFAULT + UNI_T310N_DEFAULT)\n\n/*\n * Protocol support\n */\nenum uni_proto {\n\tUNIPROTO_UNI40U,\t/* UNI4.0 user side */\n\tUNIPROTO_UNI40N,\t/* UNI4.0 network side */\n\tUNIPROTO_PNNI10,\t/* PNNI1.0 */\n};\nenum uni_popt {\n\tUNIPROTO_GFP\t= 0x0001,\t/* enable GFP */\n\tUNIPROTO_SB_TB\t= 0x0002,\t/* Coincident Sb-Tb/Tb */\n\n\tUNIPROTO_ALLMASK = 0x0003,\n};\n\n/*\n * Other options\n */\nenum uni_option {\n\tUNIOPT_GIT_HARD\t\t= 0x0001,\t/* harder check of GIT IE */\n\tUNIOPT_BEARER_HARD\t= 0x0002,\t/* harder check of BEARER IE */\n\tUNIOPT_CAUSE_HARD\t= 0x0004,\t/* harder check of CAUSE IE */\n\n\tUNIOPT_ALLMASK\t\t= 0x0007,\n};\n\n/*\n * UNI configuration\n */\nstruct uni_config {\n\tuint32_t\tproto;\t\t/* which protocol */\n\tuint32_t\tpopt;\t\t/* protocol option */\n\tuint32_t\toption;\t\t/* other options */\n\tuint32_t\ttimer301;\t/* T301 */\n\tuint32_t\ttimer303;\t/* T303 */\n\tuint32_t\tinit303;\t/* T303 retransmission count */\n\tuint32_t\ttimer308;\t/* T308 */\n\tuint32_t\tinit308;\t/* T308 retransmission count */\n\tuint32_t\ttimer309;\t/* T309 */\n\tuint32_t\ttimer310;\t/* T310 */\n\tuint32_t\ttimer313;\t/* T313 */\n\tuint32_t\ttimer316;\t/* T316 */\n\tuint32_t\tinit316;\t/* T316 retransmission count */\n\tuint32_t\ttimer317;\t/* T317 */\n\tuint32_t\ttimer322;\t/* T322 */\n\tuint32_t\tinit322;\t/* T322 retransmission count */\n\tuint32_t\ttimer397;\t/* T397 */\n\tuint32_t\ttimer398;\t/* T398 */\n\tuint32_t\ttimer399;\t/* T399 */\n};\nenum uni_config_mask {\n\tUNICFG_PROTO\t= 0x00000001,\n\tUNICFG_TIMER301\t= 0x00000002,\n\tUNICFG_TIMER303\t= 0x00000004,\n\tUNICFG_INIT303\t= 0x00000008,\n\tUNICFG_TIMER308\t= 0x00000010,\n\tUNICFG_INIT308\t= 0x00000020,\n\tUNICFG_TIMER309\t= 0x00000040,\n\tUNICFG_TIMER310\t= 0x00000080,\n\tUNICFG_TIMER313\t= 0x00000100,\n\tUNICFG_TIMER316\t= 0x00000200,\n\tUNICFG_INIT316\t= 0x00000400,\n\tUNICFG_TIMER317\t= 0x00000800,\n\tUNICFG_TIMER322\t= 0x00001000,\n\tUNICFG_INIT322\t= 0x00002000,\n\tUNICFG_TIMER397\t= 0x00004000,\n\tUNICFG_TIMER398\t= 0x00008000,\n\tUNICFG_TIMER399\t= 0x00010000,\n\n\tUNICFG_ALLMASK\t= 0x0001ffff,\n};\n\n/*\n * API signals\n */\nenum uni_sig {\n\tUNIAPI_ERROR\t\t\t= 0,\t/* UNI -> API */\n\n\tUNIAPI_CALL_CREATED\t\t= 1,\t/* UNI -> API */\n\tUNIAPI_CALL_DESTROYED\t\t= 2,\t/* UNI -> API */\n\tUNIAPI_PARTY_CREATED\t\t= 3,\t/* UNI -> API */\n\tUNIAPI_PARTY_DESTROYED\t\t= 4,\t/* UNI -> API */\n\n\tUNIAPI_LINK_ESTABLISH_request\t= 5,\t/* API -> UNI */\n\tUNIAPI_LINK_ESTABLISH_confirm\t= 6,\t/* UNI -> API */\n\tUNIAPI_LINK_RELEASE_request\t= 7,\t/* API -> UNI */\n\tUNIAPI_LINK_RELEASE_confirm\t= 8,\t/* UNI -> API */\n\n\tUNIAPI_RESET_request\t\t= 9,\t/* API -> UNI */\n\tUNIAPI_RESET_confirm\t\t= 10,\t/* UNI -> API */\n\tUNIAPI_RESET_indication\t\t= 11,\t/* UNI -> API */\n\tUNIAPI_RESET_ERROR_indication\t= 12,\t/* UNI -> API */\n\tUNIAPI_RESET_response\t\t= 13,\t/* API -> UNI */\n\tUNIAPI_RESET_ERROR_response\t= 14,\t/* API -> UNI */\n\tUNIAPI_RESET_STATUS_indication\t= 15,\t/* UNI -> API */\n\n\tUNIAPI_SETUP_request\t\t= 16,\t/* API -> UNI */\n\tUNIAPI_SETUP_indication\t\t= 17,\t/* UNI -> API */\n\tUNIAPI_SETUP_response\t\t= 18,\t/* API -> UNI */\n\tUNIAPI_SETUP_confirm\t\t= 19,\t/* UNI -> API */\n\tUNIAPI_SETUP_COMPLETE_indication= 20,\t/* U-UNI -> API */\n\tUNIAPI_SETUP_COMPLETE_request\t= 46,\t/* API -> N-UNI */\n\tUNIAPI_ALERTING_request\t\t= 21,\t/* API -> UNI */\n\tUNIAPI_ALERTING_indication\t= 22,\t/* UNI -> API */\n\tUNIAPI_PROCEEDING_request\t= 23,\t/* API -> UNI */\n\tUNIAPI_PROCEEDING_indication\t= 24,\t/* UNI -> API */\n\tUNIAPI_RELEASE_request\t\t= 25,\t/* API -> UNI */\n\tUNIAPI_RELEASE_indication\t= 26,\t/* UNI -> API */\n\tUNIAPI_RELEASE_response\t\t= 27,\t/* API -> UNI */\n\tUNIAPI_RELEASE_confirm\t\t= 28,\t/* UNI -> API */\n\tUNIAPI_NOTIFY_request\t\t= 29,\t/* API -> UNI */\n\tUNIAPI_NOTIFY_indication\t= 30,\t/* UNI -> API */\n\tUNIAPI_STATUS_indication\t= 31,\t/* UNI -> API */\n\tUNIAPI_STATUS_ENQUIRY_request\t= 32,\t/* API -> UNI */\n\n\tUNIAPI_ADD_PARTY_request\t= 33,\t/* API -> UNI */\n\tUNIAPI_ADD_PARTY_indication\t= 34,\t/* UNI -> API */\n\tUNIAPI_PARTY_ALERTING_request\t= 35,\t/* API -> UNI */\n\tUNIAPI_PARTY_ALERTING_indication= 36,\t/* UNI -> API */\n\tUNIAPI_ADD_PARTY_ACK_request\t= 37,\t/* API -> UNI */\n\tUNIAPI_ADD_PARTY_ACK_indication\t= 38,\t/* UNI -> API */\n\tUNIAPI_ADD_PARTY_REJ_request\t= 39,\t/* API -> UNI */\n\tUNIAPI_ADD_PARTY_REJ_indication\t= 40,\t/* UNI -> API */\n\tUNIAPI_DROP_PARTY_request\t= 41,\t/* API -> UNI */\n\tUNIAPI_DROP_PARTY_indication\t= 42,\t/* UNI -> API */\n\tUNIAPI_DROP_PARTY_ACK_request\t= 43,\t/* API -> UNI */\n\tUNIAPI_DROP_PARTY_ACK_indication= 44,\t/* UNI -> API */\n\n\tUNIAPI_ABORT_CALL_request\t= 45,\t/* API -> UNI */\n\n\tUNIAPI_MAXSIG = 47\n};\n\nstruct uniapi_error {\n\tuint32_t\treason;\n\tuint32_t\tstate;\n};\n/* keep this in sync with atmapi.h:enum atmerr */\n\n#define UNIAPI_DEF_ERRORS(MACRO)\t\t\t\t\t\\\n\tMACRO(OK, 0, \"no error\")\t\t\t\t\t\\\n\tMACRO(ERROR_BAD_SIGNAL,\t1, \"unknown signal\")\t\t\t\\\n\tMACRO(ERROR_BADCU,\t2, \"signal in bad co-ordinator state\")\t\\\n\tMACRO(ERROR_BAD_CALLSTATE, 3, \"signal in bad call state\")\t\\\n\tMACRO(ERROR_BAD_EPSTATE, 4, \"signal in bad endpoint state\")\t\\\n\tMACRO(ERROR_BAD_ARG,\t5, \"bad argument\")\t\t\t\\\n\tMACRO(ERROR_BAD_CALL,\t6, \"unknown call reference\")\t\t\\\n\tMACRO(ERROR_BAD_PARTY,\t7, \"unknown party\")\t\t\t\\\n\tMACRO(ERROR_BAD_CTYPE,\t8, \"bad type of call for signal\")\t\\\n\tMACRO(ERROR_BAD_IE,\t9, \"bad information element\")\t\t\\\n\tMACRO(ERROR_EPREF_INUSE, 10, \"endpoint reference already in use\") \\\n\tMACRO(ERROR_MISSING_IE,\t11, \"missing information element\")\t\\\n\tMACRO(ERROR_ENCODING,\t12, \"error during message encoding\")\t\\\n\tMACRO(ERROR_NOMEM,\t13, \"out of memory\")\t\t\t\\\n\tMACRO(ERROR_BUSY,\t14, \"status enquiry busy\")\n\nenum {\n#define DEF(NAME, VAL, STR) UNIAPI_##NAME = VAL,\nUNIAPI_DEF_ERRORS(DEF)\n#undef DEF\n};\n\nstruct uniapi_call_created {\n\tstruct uni_cref\t\tcref;\n};\nstruct uniapi_call_destroyed {\n\tstruct uni_cref\t\tcref;\n};\nstruct uniapi_party_created {\n\tstruct uni_cref\t\tcref;\n\tstruct uni_ie_epref\tepref;\n};\nstruct uniapi_party_destroyed {\n\tstruct uni_cref\t\tcref;\n\tstruct uni_ie_epref\tepref;\n};\nstruct uniapi_abort_call_request {\n\tstruct uni_cref\t\tcref;\n};\n\nstruct uniapi_reset_request {\n\tstruct uni_ie_restart\trestart;\n\tstruct uni_ie_connid\tconnid;\n};\n\nstruct uniapi_reset_confirm {\n\tstruct uni_ie_restart\trestart;\n\tstruct uni_ie_connid\tconnid;\n};\n\nstruct uniapi_reset_indication {\n\tstruct uni_ie_restart\trestart;\n\tstruct uni_ie_connid\tconnid;\n\n};\nstruct uniapi_reset_error_indication {\n\tuint32_t\t\tsource;\t\t/* 0 - start, 1 - response */\n\tuint32_t\t\treason;\n};\n\n#define UNIAPI_DEF_RESET_ERRORS(MACRO)\t\t\t\t\\\n\tMACRO(UNIAPI_RESET_ERROR_NO_CONFIRM,\t\t0,\t\\\n\t    \"no confirmation\")\t\t\t\t\t\\\n\tMACRO(UNIAPI_RESET_ERROR_NO_RESPONSE,\t\t1,\t\\\n\t    \"no response\")\t\t\t\t\t\\\n\tMACRO(UNIAPI_RESET_ERROR_PEER_INCOMP_STATE,\t2,\t\\\n\t    \"incompatible state\")\nenum {\n#define DEF(NAME, VALUE, STR) NAME = VALUE,\nUNIAPI_DEF_RESET_ERRORS(DEF)\n#undef DEF\n};\n\nstruct uniapi_reset_response {\n\tstruct uni_ie_restart\trestart;\n\tstruct uni_ie_connid\tconnid;\n};\n\nstruct uniapi_reset_error_response {\n\tstruct uni_ie_cause\tcause;\n};\n\nstruct uniapi_reset_status_indication {\n\tstruct uni_cref\t\tcref;\t\t/* STATUS message CREF */\n\tstruct uni_ie_callstate\tcallstate;\n\tstruct uni_ie_cause\tcause;\n};\n\nstruct uniapi_setup_request {\n\tstruct uni_setup\tsetup;\n};\nstruct uniapi_setup_indication {\n\tstruct uni_setup\tsetup;\n};\nstruct uniapi_setup_response {\n\tstruct uni_connect\tconnect;\n};\nstruct uniapi_setup_confirm {\n\tstruct uni_connect\tconnect;\n};\nstruct uniapi_setup_complete_indication {\n\tstruct uni_connect_ack\tconnect_ack;\n};\nstruct uniapi_setup_complete_request {\n\tstruct uni_connect_ack\tconnect_ack;\n};\n\nstruct uniapi_alerting_request {\n\tstruct uni_alerting\talerting;\n};\n\nstruct uniapi_alerting_indication {\n\tstruct uni_alerting\talerting;\n};\n\nstruct uniapi_proceeding_request {\n\tstruct uni_call_proc\tcall_proc;\n};\n\nstruct uniapi_proceeding_indication {\n\tstruct uni_call_proc\tcall_proc;\n};\n\n\nstruct uniapi_release_request {\n\tstruct uni_release\trelease;\n};\nstruct uniapi_release_indication {\n\tstruct uni_release\trelease;\n};\nstruct uniapi_release_response {\n\tstruct uni_release_compl release_compl;\n};\n/*\n * A release confirm can come from a RELEASE COMPLETE or a RELEASE.\n * Because the IEs in a RELEASE COMPLETE are a subset of a RELEASE,\n * use the RELEASE here.\n */\nstruct uniapi_release_confirm {\n\tstruct uni_release\trelease;\n};\n\nstruct uniapi_notify_request {\n\tstruct uni_notify\tnotify;\n};\nstruct uniapi_notify_indication {\n\tstruct uni_notify\tnotify;\n};\n\nstruct uniapi_status_indication {\n\tstruct uni_cref\t\tcref;\n\tenum uni_callstate\tmy_state;\n\tenum uni_cause\t\tmy_cause;\n\tstruct uni_ie_callstate\this_state;\n\tstruct uni_ie_cause\this_cause;\n\tstruct uni_ie_epref\tepref;\n\tstruct uni_ie_epstate\tepstate;\n};\nstruct uniapi_status_enquiry_request {\n\tstruct uni_cref\t\tcref;\n\tstruct uni_ie_epref\tepref;\n};\n\nstruct uniapi_add_party_request {\n\tstruct uni_add_party\tadd;\n};\nstruct uniapi_add_party_indication {\n\tstruct uni_add_party\tadd;\n};\n\nstruct uniapi_party_alerting_request {\n\tstruct uni_party_alerting alert;\n};\nstruct uniapi_party_alerting_indication {\n\tstruct uni_party_alerting alert;\n};\n\nstruct uniapi_add_party_ack_request {\n\tstruct uni_add_party_ack ack;\n};\nstruct uniapi_add_party_ack_indication {\n\tstruct uni_add_party_ack ack;\n};\nstruct uniapi_add_party_rej_request {\n\tstruct uni_add_party_rej rej;\n};\nstruct uniapi_add_party_rej_indication {\n\tstruct uni_add_party_rej rej;\n};\n\nstruct uniapi_drop_party_request {\n\tstruct uni_drop_party\tdrop;\n};\nstruct uniapi_drop_party_indication {\n\tstruct uni_drop_party\tdrop;\n\tstruct uni_ie_cause\tmy_cause;\n};\n\nstruct uniapi_drop_party_ack_request {\n\tstruct uni_drop_party_ack ack;\n};\nstruct uniapi_drop_party_ack_indication {\n\tstruct uni_drop_party\tdrop;\n\tstruct uni_ie_crankback\tcrankback;\n};\n\nunion uniapi_all {\n\tstruct uniapi_error\t\t\terror;\n\tstruct uniapi_call_created\t\tcall_created;\n\tstruct uniapi_call_destroyed\t\tcall_destroyed;\n\tstruct uniapi_party_created\t\tparty_created;\n\tstruct uniapi_party_destroyed\t\tparty_destroyed;\n\tstruct uniapi_abort_call_request\tabort_call_request;\n\tstruct uniapi_reset_request\t\treset_request;\n\tstruct uniapi_reset_confirm\t\treset_confirm;\n\tstruct uniapi_reset_indication\t\treset_indication;\n\tstruct uniapi_reset_error_indication\treset_error_indication;\n\tstruct uniapi_reset_response\t\treset_response;\n\tstruct uniapi_reset_error_response\treset_error_response;\n\tstruct uniapi_reset_status_indication\treset_status_indication;\n\tstruct uniapi_setup_request\t\tsetup_request;\n\tstruct uniapi_setup_indication\t\tsetup_indication;\n\tstruct uniapi_setup_response\t\tsetup_response;\n\tstruct uniapi_setup_confirm\t\tsetup_confirm;\n\tstruct uniapi_setup_complete_indication\tsetup_complete_indication;\n\tstruct uniapi_setup_complete_request\tsetup_complete_request;\n\tstruct uniapi_alerting_request\t\talerting_request;\n\tstruct uniapi_alerting_indication\talerting_indication;\n\tstruct uniapi_proceeding_request\tproceeding_request;\n\tstruct uniapi_proceeding_indication\tproceeding_indication;\n\tstruct uniapi_release_request\t\trelease_request;\n\tstruct uniapi_release_indication\trelease_indication;\n\tstruct uniapi_release_response\t\trelease_response;\n\tstruct uniapi_release_confirm\t\trelease_confirm;\n\tstruct uniapi_notify_request\t\tnotify_request;\n\tstruct uniapi_notify_indication\t\tnotify_indication;\n\tstruct uniapi_status_indication\t\tstatus_indication;\n\tstruct uniapi_status_enquiry_request\tstatus_enquiry_request;\n\tstruct uniapi_add_party_request\t\tadd_party_request;\n\tstruct uniapi_add_party_indication\tadd_party_indication;\n\tstruct uniapi_party_alerting_request\tparty_alerting_request;\n\tstruct uniapi_party_alerting_indication\tparty_alerting_indication;\n\tstruct uniapi_add_party_ack_request\tadd_party_ack_request;\n\tstruct uniapi_add_party_ack_indication\tadd_party_ack_indication;\n\tstruct uniapi_add_party_rej_request\tadd_party_rej_request;\n\tstruct uniapi_add_party_rej_indication\tadd_party_rej_indication;\n\tstruct uniapi_drop_party_request\tdrop_party_request;\n\tstruct uniapi_drop_party_indication\tdrop_party_indication;\n\tstruct uniapi_drop_party_ack_request\tdrop_party_ack_request;\n\tstruct uniapi_drop_party_ack_indication\tdrop_party_ack_indication;\n};\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/netnatm/sig/unisig.h",
    "content": "/*\n * Copyright (c) 2001-2003\n *\tFraunhofer Institute for Open Communication Systems (FhG Fokus).\n * \tAll rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * Author: Hartmut Brandt <harti@freebsd.org>\n *\n * $Begemot: libunimsg/netnatm/sig/unisig.h,v 1.4 2004/07/08 08:22:26 brandt Exp $\n *\n * Utility functions for signalling stuff\n */\n#ifndef _NETNATM_SIG_UNISIG_H_\n#define _NETNATM_SIG_UNISIG_H_\n\n#include <netnatm/sig/unidef.h>\n\n/* names */\nconst char *uni_signame(enum uni_sig);\nconst char *uni_facname(enum uni_verb);\n\n/* return a string for the error code */\nconst char *uni_strerr(u_int _err);\n\n/* format an API message */\nvoid uni_print_api(char *_buf, size_t _bufsiz, u_int _type, u_int _cookie,\n    const void *_msg, struct unicx *_cx);\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/netnatm/unimsg.h",
    "content": "/*\n * Copyright (c) 1996-2003\n *\tFraunhofer Institute for Open Communication Systems (FhG Fokus).\n * \tAll rights reserved.\n *\n * Author: Hartmut Brandt <harti@freebsd.org>\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $Begemot: libunimsg/netnatm/unimsg.h,v 1.4 2004/07/08 08:21:46 brandt Exp $\n *\n * This defines the structure of messages as handled by this library.\n */\n#ifndef _NETNATM_UNIMSG_H_\n#define _NETNATM_UNIMSG_H_\n\n#include <sys/types.h>\n#ifdef _KERNEL\n#ifdef __FreeBSD__\n#include <sys/systm.h>\n#endif\n#include <sys/stdint.h>\n#else\n#include <string.h>\n#include <stdint.h>\n#endif\n\nstruct uni_msg {\n\tu_char\t\t*b_wptr;\t/* tail pointer */\n\tu_char\t\t*b_rptr;\t/* head pointer */\n\tu_char\t\t*b_buf;\t\t/* data buffer */\n\tu_char\t\t*b_lim;\t\t/* end of data buffer */\n};\n\n/* return the current length of the message */\n#define uni_msg_len(M)\t\t((size_t)((M)->b_wptr - (M)->b_rptr))\n\n/* return the number of space behind the message */\n#define uni_msg_space(M)\t((size_t)((M)->b_lim - (M)->b_wptr))\n\n/* return the amount of leading free space */\n#define uni_msg_leading(M)\t((size_t)((M)->b_rptr - (M)->b_buf))\n\n/* return the maximum size of the message (length plus free space) */\n#define uni_msg_size(M)\t\t((size_t)((M)->b_lim - (M)->b_buf));\n\n/* ensure that there is space for another S bytes. If reallocation fails\n * free message and return -1 */\n#define uni_msg_ensure(M, S)\t\t\t\t\t\\\n\t((uni_msg_space(M) >= (S)) ? 0 : uni_msg_extend(M, S))\n\nint uni_msg_append(struct uni_msg *, void *, size_t);\nint uni_msg_extend(struct uni_msg *, size_t);\n\n#define uni_msg_rptr(MSG, TYPE) ((TYPE)(void *)(MSG)->b_rptr)\n#define uni_msg_wptr(MSG, TYPE) ((TYPE)(void *)(MSG)->b_wptr)\n\nint uni_msg_prepend(struct uni_msg *, size_t);\n\n#ifndef _KERNEL\n\nstruct uni_msg *uni_msg_alloc(size_t);\nstruct uni_msg *uni_msg_build(void *, ...);\nvoid uni_msg_destroy(struct uni_msg *);\nu_int uni_msg_strip32(struct uni_msg *);\nu_int uni_msg_get32(struct uni_msg *);\nint uni_msg_append32(struct uni_msg *, u_int);\nint uni_msg_append8(struct uni_msg *, u_int);\nu_int uni_msg_trail32(const struct uni_msg *, int);\nstruct uni_msg *uni_msg_dup(const struct uni_msg *);\n\n#endif /* _KERNEL */\n#endif\n"
  },
  {
    "path": "freebsd-headers/netncp/ncp.h",
    "content": "/*\n *  ncp.h\n */\n/*-\n *  Copyright (C) 1995 by Volker Lendecke\n *  New version derived from original ncp.h, 1998 Boris Popov\n *\n * $FreeBSD: release/9.0.0/sys/netncp/ncp.h 139823 2005-01-07 01:45:51Z imp $\n */\n\n#ifndef _NETNCP_NCP_H_\n#define _NETNCP_NCP_H_\n\n#define NCP_VERMAJ\t1\n#define NCP_VERMIN\t3500\n#define NCP_VERSION\t(NCP_VERMAJ*100000 + NCP_VERMIN)\n\ntypedef u_int32_t\tnwdirent;\n\ntypedef char\t\tnstr8;\ntypedef\tnstr8*\t\tpnstr8;\ntypedef u_int8_t\tnuint8;\ntypedef u_int8_t*\tpnuint8;\ntypedef u_int16_t\tnuint16;\ntypedef\tnuint16*\tpnuint16;\ntypedef u_int32_t\tnuint32;\ntypedef\tnuint32*\tpnuint32;\n\n\n#define NCP_DEFAULT_BUFSIZE \t1024\n#define NCP_MAX_BUFSIZE\t\t1024\n#define NCP_MAX_PACKET_SIZE \t4070\n#define\tNCP_MAXUSERNAMELEN\t255\n#define\tNCP_MAXPASSWORDLEN\t255\n#define NCP_MAXPATHLEN\t\t255\n#define NCP_MAX_FILENAME \t14\n#define NCP_FILE_ID_LEN\t\t6\n\n#define NCP_BINDERY_USER\t0x0001\n#define NCP_BINDERY_UGROUP\t0x0002\n#define NCP_BINDERY_PQUEUE\t0x0003\n#define NCP_BINDERY_FSERVER\t0x0004\n#define NCP_BINDERY_PSERVER\t0x0007\n#define NCP_BINDERY_NAME_LEN\t48\n\n/* Handle Flags */\n#define\tNCP_HF_DIRSHORT\t\t0\t\t/* short directory handle */\n#define\tNCP_HF_DIRBASE\t\t1\t\t/* directory base */\n#define\tNCP_HF_NONE\t\t0xff\t\t/* no handle or dirbase */\n\n/* Options to negotiate */\n#define\tNCP_IPX_CHECKSUM\t\t1\n#define\tNCP_SECURITY_LEVEL_SIGN_HEADERS\t2\n\n#ifndef NWCONN_HANDLE\n#define NWCONN_HANDLE   unsigned int\n#define pNWCONN_HANDLE  (unsigned int*)\n#define NWCONN_NUM      u_int16_t\n#define NWCCODE         unsigned int\n#define NWDIR_HANDLE    u_int8_t\n#define NWFILE_HANDLE   int\n#endif\n\nstruct ncp_fh_s {\n\tu_int16_t val1; \n\tunion {\n\t\tu_int32_t val32;\n\t\tu_int16_t val16;\n\t} val;\n} __packed;\n\ntypedef\tstruct ncp_fh_s ncp_fh;\n\ntypedef struct ncpfid_s {\n\tnwdirent\tf_parent;\n\tnwdirent\tf_id;\n} ncpfid;\n\n/* -- Bindery properties -- */\nstruct ncp_bindery_object {\n\tu_int32_t\tobject_id;\n\tu_int16_t\tobject_type;\n\tu_int8_t\tobject_name[NCP_BINDERY_NAME_LEN];\n\tu_int8_t\tobject_flags;\n\tu_int8_t\tobject_security;\n\tu_int8_t\tobject_has_prop;\n};\n\nstruct nw_property {\n\tu_int8_t\tvalue[128];\n\tu_int8_t\tmore_flag;\n\tu_int8_t\tproperty_flag;\n};\n\nstruct ncp_filesearch_info {\n\tu_int8_t\tvolume_number;\n\tu_int16_t\tdirectory_id;\n\tu_int16_t\tsequence_no;\n\tu_int8_t\taccess_rights;\n};\n\n\nstruct ncp_file_info {\n\tu_int8_t\tfile_id[NCP_FILE_ID_LEN];\n\tchar\t\tfile_name[NCP_MAX_FILENAME + 1];\n\tu_int8_t\tfile_attributes;\n\tu_int8_t\tfile_mode;\n\tu_int32_t\tfile_length;\n\tu_int16_t\tcreation_date;\n\tu_int16_t\taccess_date;\n\tu_int16_t\tupdate_date;\n\tu_int16_t\tupdate_time;\n};\n\nstruct nw_queue_job_entry {\n\tu_int16_t\tInUse;\n\tu_int32_t\tprev;\n\tu_int32_t\tnext;\n\tu_int32_t\tClientStation;\n\tu_int32_t\tClientTask;\n\tu_int32_t\tClientObjectID;\n\tu_int32_t\tTargetServerID;\n\tu_int8_t\tTargetExecTime[6];\n\tu_int8_t\tJobEntryTime[6];\n\tu_int32_t\tJobNumber;\n\tu_int16_t\tJobType;\n\tu_int16_t\tJobPosition;\n\tu_int16_t\tJobControlFlags;\n\tu_int8_t\tFileNameLen;\n\tchar\t\tJobFileName[13];\n\tu_int32_t\tJobFileHandle;\n\tu_int32_t\tServerStation;\n\tu_int32_t\tServerTaskNumber;\n\tu_int32_t\tServerObjectID;\n\tchar\t\tJobTextDescription[50];\n\tchar\t\tClientRecordArea[152];\n} __packed;\n\nstruct queue_job {\n\tstruct nw_queue_job_entry j;\n\tncp_fh file_handle;\n};\n\n#define QJE_OPER_HOLD\t0x80\n#define QJE_USER_HOLD\t0x40\n#define QJE_ENTRYOPEN\t0x20\n#define QJE_SERV_RESTART    0x10\n#define QJE_SERV_AUTO\t    0x08\n\n/* ClientRecordArea for print jobs */\n\n#define   KEEP_ON        0x0400\n#define   NO_FORM_FEED   0x0800\n#define   NOTIFICATION   0x1000\n#define   DELETE_FILE    0x2000\n#define   EXPAND_TABS    0x4000\n#define   PRINT_BANNER   0x8000\n\nstruct print_job_record {\n\tu_int8_t\tVersion;\n\tu_int8_t\tTabSize;\n\tu_int16_t\tCopies;\n\tu_int16_t\tCtrlFlags;\n\tu_int16_t\tLines;\n\tu_int16_t\tRows;\n\tchar\t\tFormName[16];\n\tu_int8_t\tReserved[6];\n\tchar\t\tBannerName[13];\n\tchar\t\tFnameBanner[13];\n\tchar\t\tFnameHeader[14];\n\tchar\t\tPath[80];\n} __packed;\n\nstruct ncp_station_addr {\n\tu_int32_t\tNetWork;\n\tu_int8_t\tNode[6];\n\tu_int16_t\tSocket;\n} __packed;\n\nstruct ncp_prop_login_control {\n\tu_int8_t\tAccountExpireDate[3];\n\tu_int8_t\tDisabled;\n\tu_int8_t\tPasswordExpireDate[3];\n\tu_int8_t\tGraceLogins;\n\tu_int16_t\tPasswordExpireInterval;\n\tu_int8_t\tMaxGraceLogins;\n\tu_int8_t\tMinPasswordLength;\n\tu_int16_t\tMaxConnections;\n\tu_int8_t\tConnectionTimeMask[42];\n\tu_int8_t\tLastLogin[6];\n\tu_int8_t\tRestrictionMask;\n\tu_int8_t\treserved;\n\tu_int32_t\tMaxDiskUsage;\n\tu_int16_t\tBadLoginCount;\n\tu_int32_t\tBadLoginCountDown;\n\tstruct ncp_station_addr LastIntruder;\n} __packed;\n\n#define NCP_VOLNAME_LEN (16)\n#define NCP_NUMBER_OF_VOLUMES (64)\nstruct ncp_volume_info {\n\tu_int32_t total_blocks;\n\tu_int32_t free_blocks;\n\tu_int32_t purgeable_blocks;\n\tu_int32_t not_yet_purgeable_blocks;\n\tu_int32_t total_dir_entries;\n\tu_int32_t available_dir_entries;\n\tu_int8_t sectors_per_block;\n\tchar volume_name[NCP_VOLNAME_LEN + 1];\n};\n/*\n * Name space constants, taken from NDK\n */\n#define aRONLY     (ntohl(0x01000000))\n#define aHIDDEN    (ntohl(0x02000000))\n#define aSYSTEM    (ntohl(0x04000000))\n#define aEXECUTE   (ntohl(0x08000000))\n#define aDIR       (ntohl(0x10000000))\n#define aARCH      (ntohl(0x20000000))\n\n/* Defines for Name Spaces */\n#define NW_NS_DOS     0\n#define NW_NS_MAC     1\n#define NW_NS_NFS     2\n#define NW_NS_FTAM    3\n#define NW_NS_OS2     4\n\n/* for _ScanNSEntryInfo */\n#define\tIM_NAME\t\t\t0x00000001\n#define\tIM_SPACE_ALLOCATED\t0x00000002\n#define IM_ATTRIBUTES\t\t0x00000004\n#define IM_SIZE\t\t\t0x00000008\n#define IM_TOTAL_SIZE\t\t0x00000010\n#define IM_EA\t\t\t0x00000020\n#define IM_ARCHIVE\t\t0x00000040\n#define IM_MODIFY\t\t0x00000080\n#define IM_CREATION\t\t0x00000100\n#define IM_OWNING_NAMESPACE\t0x00000200\n#define IM_DIRECTORY\t\t0x00000400\n#define IM_RIGHTS\t\t0x00000800\n#define\tIM_ALMOST_ALL\t\t0x00000FED\n#define IM_ALL\t\t\t0x00000FFF\n#define\tIM_REFERENCE_ID\t\t0x00001000\n#define\tIM_NS_ATTRIBUTES\t0x00002000\n#define IM_COMPRESSED_INFO\t0x80000000UL\n\n/* open/create modes */\n#define OC_MODE_OPEN\t\t0x01\n#define OC_MODE_TRUNCATE\t0x02\n#define OC_MODE_REPLACE\t\t0x02\n#define OC_MODE_CREATE\t\t0x08\n\n/* open/create results */\n#define OC_ACTION_NONE\t\t0x00\n#define OC_ACTION_OPEN\t\t0x01\n#define OC_ACTION_CREATE\t0x02\n#define OC_ACTION_TRUNCATE\t0x04\n#define OC_ACTION_REPLACE\t0x04\n\n/* renameFlag in NSRename */\n#define\tNW_TYPE_FILE\t\t0x8000\n#define\tNW_TYPE_SUBDIR\t\t0x0010\n\n#define\tNW_NAME_CONVERT\t\t0x0003\t/* don't report error and set comp mode */\n#define\tNW_NO_NAME_CONVERT\t0x0004\t/* only in specified name space */\n\n/* search attributes */\n#ifndef SA_HIDDEN\n#define SA_NORMAL         0x0000\n#define SA_HIDDEN         0x0002\n#define SA_SYSTEM         0x0004\n#define SA_SUBDIR_ONLY    0x0010\n#define SA_SUBDIR_FILES   0x8000\n#define SA_ALL            0x8006\n#endif\n\n/* access rights attributes */\n#ifndef AR_READ\n#define AR_READ\t\t\t0x0001\n#define AR_WRITE\t\t0x0002\n#define AR_READ_ONLY\t\t0x0001\n#define AR_WRITE_ONLY\t\t0x0002\n#define AR_DENY_READ\t\t0x0004\n#define AR_DENY_WRITE\t\t0x0008\n#define AR_COMPATIBILITY\t0x0010\n#define AR_WRITE_THROUGH\t0x0040\n#define AR_OPEN_COMPRESSED\t0x0100\n#endif\n\nstruct nw_entry_info {\n\tu_int32_t\tspaceAlloc;\n\tu_int32_t\tattributes;\t/* LH */\n\tu_int16_t\tflags;\t\t/* internal */\n\tu_int32_t\tdataStreamSize;\n\tu_int32_t\ttotalStreamSize;\n\tu_int16_t\tnumberOfStreams;\n\tu_int16_t\tcreationTime;\t/* LH */\n\tu_int16_t\tcreationDate;\t/* LH */\n\tu_int32_t\tcreatorID;\t/* HL */\n\tu_int16_t\tmodifyTime;\t/* LH */\n\tu_int16_t\tmodifyDate;\t/* LH */\n\tu_int32_t\tmodifierID;\t/* HL */\n\tu_int16_t\tlastAccessDate;\t/* LH */\n\tu_int16_t\tarchiveTime;\t/* LH */\n\tu_int16_t\tarchiveDate;\t/* LH */\n\tu_int32_t\tarchiverID;\t/* HL */\n\tu_int16_t\tinheritedRightsMask;\t/* LH */\n\tu_int32_t\tdirEntNum;\n\tu_int32_t\tDosDirNum;\n\tu_int32_t\tvolNumber;\n\tu_int32_t\tEADataSize;\n\tu_int32_t\tEAKeyCount;\n\tu_int32_t\tEAKeySize;\n\tu_int32_t\tNSCreator;\n\tu_int8_t\tnameLen;\n\tu_int8_t\tentryName[256];\n} __packed;\n\ntypedef struct nw_entry_info NW_ENTRY_INFO;\n\n/* modify mask - use with MODIFY_DOS_INFO structure */\n#define DM_ATTRIBUTES\t\t0x0002L\n#define DM_CREATE_DATE\t\t0x0004L\n#define DM_CREATE_TIME\t\t0x0008L\n#define DM_CREATOR_ID\t\t0x0010L\n#define DM_ARCHIVE_DATE\t\t0x0020L\n#define DM_ARCHIVE_TIME\t\t0x0040L\n#define DM_ARCHIVER_ID\t\t0x0080L\n#define DM_MODIFY_DATE\t\t0x0100L\n#define DM_MODIFY_TIME\t\t0x0200L\n#define DM_MODIFIER_ID\t\t0x0400L\n#define DM_LAST_ACCESS_DATE\t0x0800L\n#define DM_INHERITED_RIGHTS_MASK\t0x1000L\n#define DM_MAXIMUM_SPACE\t0x2000L\n\nstruct nw_modify_dos_info {\n\tu_int32_t attributes;\n\tu_int16_t creationDate;\n\tu_int16_t creationTime;\n\tu_int32_t creatorID;\n\tu_int16_t modifyDate;\n\tu_int16_t modifyTime;\n\tu_int32_t modifierID;\n\tu_int16_t archiveDate;\n\tu_int16_t archiveTime;\n\tu_int32_t archiverID;\n\tu_int16_t lastAccessDate;\n\tu_int16_t inheritanceGrantMask;\n\tu_int16_t inheritanceRevokeMask;\n\tu_int32_t maximumSpace;\n}  __packed;\n\nstruct nw_search_seq {\n\tu_int8_t\tvolNumber;\n\tu_int32_t\tdirNumber;\n\tu_int32_t\tsearchDirNumber;\n}  __packed;\n\ntypedef struct nw_search_seq SEARCH_SEQUENCE;\n\nstruct ncp_file_server_info {\n\tu_int8_t\tServerName[48];\n\tu_int8_t\tFileServiceVersion;\n\tu_int8_t\tFileServiceSubVersion;\n\tu_int16_t\tMaximumServiceConnections;\n\tu_int16_t\tConnectionsInUse;\n\tu_int16_t\tNumberMountedVolumes;\n\tu_int8_t\tRevision;\n\tu_int8_t\tSFTLevel;\n\tu_int8_t\tTTSLevel;\n\tu_int16_t\tMaxConnectionsEverUsed;\n\tu_int8_t\tAccountVersion;\n\tu_int8_t\tVAPVersion;\n\tu_int8_t\tQueueVersion;\n\tu_int8_t\tPrintVersion;\n\tu_int8_t\tVirtualConsoleVersion;\n\tu_int8_t\tRestrictionLevel;\n\tu_int8_t\tInternetBridge;\n\tu_int8_t\tReserved[60];\n} __packed;\n\nstruct nw_time_buffer {\n\tu_int8_t\tyear;\n\tu_int8_t\tmonth;\n\tu_int8_t\tday;\n\tu_int8_t\thour;\n\tu_int8_t\tminute;\n\tu_int8_t\tsecond;\n\tu_int8_t\twday;\n} __packed;\n\n#endif /*_NCP_H_ */\n"
  },
  {
    "path": "freebsd-headers/netncp/ncp_cfg.h",
    "content": "/* \n * static configuration for libncp\n *\n * $FreeBSD: release/9.0.0/sys/netncp/ncp_cfg.h 52153 1999-10-12 11:56:41Z bp $\n */\n\n#define NCP_NLS_KOI2CP866\n#define NCP_NLS_DEFAULT NCP_NLS_KOI_866\n#define NCP_PREFIX\t\"\"\n"
  },
  {
    "path": "freebsd-headers/netncp/ncp_conn.h",
    "content": "/*-\n * Copyright (c) 1999 Boris Popov\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/netncp/ncp_conn.h 206361 2010-04-07 16:50:38Z joel $\n */\n#ifndef _NETNCP_NCP_CONN_H_\n#define _NETNCP_NCP_CONN_H_\n\n#ifndef _NETINET_IN_H_\n#include <netinet/in.h>\n#endif\n\n#ifndef _NETIPX_IPX_H_\n#include <netipx/ipx.h>\n#endif\n\n#ifndef _SYS_SOCKET_H_\n#include <sys/socket.h>\n#endif\n\n/* type of transport we use */\n/*#define\tNCP_ON_IPX\t0\n#define\tNCP_ON_TCP\t1*/\n\n/* flags field in conn structure */\n#define\tNCPFL_SOCONN\t\t0x0001\t/* socket layer is up */\n#define\tNCPFL_ATTACHED\t\t0x0002\t/* ncp layer is up */\n#define\tNCPFL_LOGGED\t\t0x0004\t/* logged in to server */\n#define NCPFL_INVALID\t\t0x0008\t/* last request was not completed */\n#define\tNCPFL_INTR\t\t0x0010\t/* interrupted call */\n#define\tNCPFL_RESTORING\t\t0x0020\t/* trying to reconnect */\n#define\tNCPFL_PERMANENT\t\t0x0040\t/* no way to kill conn, when this set */\n#define\tNCPFL_PRIMARY\t\t0x0080\t/* have meaning only for owner */\n#define\tNCPFL_WASATTACHED\t0x0100\t/* there was at least one successfull connect */\n#define\tNCPFL_WASLOGGED\t\t0x0200\t/* there was at least one successfull login */\n#define\tNCPFL_SIGNACTIVE\t0x1000\t/* packet signing active */\n#define\tNCPFL_SIGNWANTED\t0x2000\t/* signing should start */\n\n/* access mode for connection */\n#define\tNCPM_READ\t\t0400\t/* able to fetch conn params */\n#define\tNCPM_WRITE\t\t0200\t/* modify/close */\n#define\tNCPM_EXECUTE\t\t0100\t/* run requests */\n\n#define\tNCP_DEFAULT_OWNER\t((uid_t)-1)\n#define\tNCP_DEFAULT_GROUP\t((uid_t)-1)\n\n\n/* args used to create connection */\n#define\tncp_conn_loginfo\tncp_conn_args\nstruct ncp_conn_args {\n\tint\t\topt;\n#define\tNCP_OPT_WDOG\t\t1\t/* need watch dog socket */\n#define\tNCP_OPT_MSG\t\t2\t/* need message socket */\n#define\tNCP_OPT_SIGN\t\t4\t/* signatures wanted */\n#define NCP_OPT_BIND\t\t8\t/* force bindery login */\n#define NCP_OPT_PERMANENT\t0x10\t/* only for refernce, completly ignored */\n#define\tNCP_OPT_NOUPCASEPASS\t0x20\t/* leave password as is */\n\tint\t\tsig_level;\t/* wanted signature level */\n\tchar \t\tserver[NCP_BINDERY_NAME_LEN+1];\n\tchar\t\t*user;\n\tchar\t\t*password;\n\tu_int32_t\tobjtype;\n\tunion {\n\t\tstruct sockaddr\taddr;\n\t\tstruct sockaddr_ipx ipxaddr;\n\t\tstruct sockaddr_in inaddr;\n\t} addr;\n\tint\t \ttimeout;\t/* ncp rq timeout */\n\tint\t \tretry_count;\t/* counts to give an error */\n\tuid_t\t\towner;\t\t/* proposed owner of connection */\n\tgid_t\t\tgroup;\t\t/* proposed group of connection */\n\tmode_t\t\taccess_mode;\t/* R/W - can do rq's, X - can see the conn */\n};\n\n#define ipxaddr\t\taddr.ipxaddr\n#define\tinaddr\t\taddr.inaddr\n#define\tsaddr\t\taddr.addr\n\n/* user side structure to issue ncp calls */\nstruct ncp_buf {\n\tint\trqsize;\t\t\t/* request size without ncp header */\n\tint\trpsize;\t\t\t/* reply size minus ncp header */\n\tint\tcc;\t\t\t/* completion code */\n\tint\tcs;\t\t\t/* connection state */\n\tchar\tpacket[NCP_MAX_PACKET_SIZE];/* Here we prepare requests and receive replies */\n};\n\n/*\n * Connection status, returned via sysctl(vfs.nwfs.connstat)\n */\nstruct ncp_conn_stat {\n\tstruct ncp_conn_args li;\n\tint\t\tconnRef;\n\tint \t\tref_cnt;\n\tint \t\tconnid;\n\tint\t\tbuffer_size;\n\tint\t\tflags;\n\tint \t\tsign_active;\n\tuid_t\t\towner;\n\tgid_t\t\tgroup;\n\tchar\t\tuser[NCP_MAXUSERNAMELEN+1];\n};\n\n#ifdef _KERNEL\n\n#ifndef LK_SHARED\n#include <sys/lock.h>\n#include <sys/lockmgr.h>\n#endif\n\nstruct socket;\nstruct u_cred;\n\nSLIST_HEAD(ncp_conn_head,ncp_conn);\n\nstruct ncp_rq;\nstruct ncp_conn;\n\n/*\n * External and internal processes can reference connection only by handle.\n * This gives us a freedom in maintance of underlying connections.\n */\nstruct ncp_handle {\n\tSLIST_ENTRY(ncp_handle)\tnh_next;\n\tint\t\tnh_id;\t\t/* handle id */\n\tstruct ncp_conn*nh_conn;\t/* which conn we are refernce */\n\tstruct thread *\tnh_td;\t\t/* who owns the handle\t*/\n\tint\t\tnh_ref;\t\t/* one process can asquire many handles, but we return the one */\n};\n\n/* \n * Describes any connection to server \n */\nstruct ncp_conn {\n\tSLIST_ENTRY(ncp_conn) nc_next;\n\tstruct ncp_conn_args li;\n\tstruct ucred \t*nc_owner;\n\tgid_t\t\tnc_group;\n\tint\t\tflags;\n\tint\t\tnc_id;\n\tstruct socket \t*ncp_so;\n\tstruct socket \t*wdg_so;\n\tstruct socket\t*msg_so;\n\tstruct socket \t*bc_so;\n\tint \t\tref_cnt;\t\t/* how many handles leased */\n\tSLIST_HEAD(ncp_ref_hd,ncp_ref) ref_list;/* list of handles */\n\tstruct lock\tnc_lock;\t\t/* excl locks */\n\tint\t\tnc_lwant;\t\t/* number of wanted locks */\n\tstruct thread\t*td;\t\t\t/* pid currently operates */\n\tstruct ucred\t*ucred;\t\t\t/* usr currently operates */\n\t/* Fields used to process ncp requests */\n\tint \t\tconnid;\t\t\t/* assigned by server */\n\tu_int8_t\tseq;\n\tint\t\tbuffer_size;\t\t/* Negotiated bufsize */\n\t/* Fields used to make packet signatures */\n\tu_int32_t\tsign_root[2];\n\tu_int32_t\tsign_state[4];\t\t/* md4 state */\n#ifdef NCPBURST\n\t/* Fields used for packet bursting */\n\tu_long\t\tbc_pktseq;\t\t/* raw packet sequence */\n\tu_short\t\tbc_seq;\t\t\t/* burst sequence */\n\tu_long\t\tbc_locid;\t\t/* local connection id */\n\tu_long\t\tbc_remid;\t\t/* remote connection id */\n\tu_long\t\tbc_pktsize;\t\t/* negotiated burst packet size */\n#endif\n};\n\nint  ncp_conn_init(void);\nint  ncp_conn_destroy(void);\nint  ncp_conn_alloc(struct ncp_conn_args *cap,\n\tstruct thread *td, struct ucred *cred, struct ncp_conn **connid);\nint  ncp_conn_free(struct ncp_conn *conn);\nint  ncp_conn_access(struct ncp_conn *conn,struct ucred *cred,mode_t mode);\nint  ncp_conn_lock(struct ncp_conn *conn,struct thread *td, struct ucred *cred,int mode);\nvoid ncp_conn_unlock(struct ncp_conn *conn,struct thread *td);\nint  ncp_conn_assert_locked(struct ncp_conn *conn,const char *checker,struct thread *td);\nvoid ncp_conn_invalidate(struct ncp_conn *ncp);\nint  ncp_conn_invalid(struct ncp_conn *ncp);\n/*int  ncp_conn_ref(struct ncp_conn *conn, pid_t pid);\nint  ncp_conn_rm_ref(struct ncp_conn *conn, pid_t pid, int force);\nvoid ncp_conn_list_rm_ref(pid_t pid);*/\nint  ncp_conn_getbyref(int connRef,struct thread *td, struct ucred *cred, int mode,\n\tstruct ncp_conn **connpp);\nint  ncp_conn_getbyli(struct ncp_conn_loginfo *li,struct thread *td, struct ucred *cred, \n\tint mode, struct ncp_conn **connpp);\nint  ncp_conn_setprimary(struct ncp_conn *conn, int on);\nint  ncp_conn_locklist(int flags, struct thread *td);\nvoid ncp_conn_unlocklist(struct thread *td);\nint  ncp_conn_gethandle(struct ncp_conn *conn, struct thread *td, struct ncp_handle **handle);\nint  ncp_conn_puthandle(struct ncp_handle *handle, struct thread *td, int force);\nint  ncp_conn_findhandle(int connHandle, struct thread *td, struct ncp_handle **handle);\nint  ncp_conn_getattached(struct ncp_conn_args *li,struct thread *td, struct ucred *cred,int mode, struct ncp_conn **connpp);\nint  ncp_conn_putprochandles(struct thread *td);\nint  ncp_conn_getinfo(struct ncp_conn *ncp, struct ncp_conn_stat *ncs);\n\nint  ncp_conn_reconnect(struct ncp_conn *ncp);\nint  ncp_conn_login(struct ncp_conn *conn, struct thread *td, struct ucred *cred);\n\nextern struct ncp_conn_head conn_list;\nextern int ncp_burst_enabled;\n\n#ifdef MALLOC_DECLARE\nMALLOC_DECLARE(M_NCPDATA);\n#endif\n\n#endif /* _KERNEL */\n#endif /* _NCP_CONN_H_ */\n"
  },
  {
    "path": "freebsd-headers/netncp/ncp_file.h",
    "content": "/*-\n * Copyright (c) 1999 Boris Popov\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/netncp/ncp_file.h 206361 2010-04-07 16:50:38Z joel $\n */\n\n#ifndef _NETNCP_NCP_FILE_H_\n#define _NETNCP_NCP_FILE_H_\n\ntypedef struct {\n   nuint32  sequence;\n   nuint32  parent;\n   nuint32  attributes;\n   nuint8   uniqueID;\n   nuint8   flags;\n   nuint8   nameSpace;\n   nuint8   nameLength;\n   nuint8   name [256];\n   nuint32  creationDateAndTime;\n   nuint32  ownerID;\n   nuint32  lastArchiveDateAndTime;\n   nuint32  lastArchiverID;\n   nuint32  updateDateAndTime;\n   nuint32  updatorID;\n   nuint32  fileSize;\n   nuint8   reserved[44];\n   nuint16  inheritedRightsMask;\n   nuint16  lastAccessDate;\n   nuint32  deletedTime;\n   nuint32  deletedDateAndTime;\n   nuint32  deletorID;\n   nuint8   reserved3 [16];\n} __packed NWDELETED_INFO;\n\n__BEGIN_DECLS\n\nint\tncp_AllocTempDirHandle(char *, NWDIR_HANDLE *);\nint\tncp_DeallocateDirHandle(NWDIR_HANDLE);\nint\tncp_GetNSEntryInfo(NWDIR_HANDLE, struct nw_entry_info *, int *);\n\nNWCCODE\tncp_ScanNSEntryInfo(NWCONN_HANDLE, nuint8, nuint16,\n\tSEARCH_SEQUENCE *, pnstr8, nuint32, NW_ENTRY_INFO *);\n\nNWCCODE ncp_PurgeDeletedFile(NWCONN_HANDLE, nuint32, nuint32, nuint32, nuint8);\n\nNWCCODE NWRecoverDeletedFile(NWCONN_HANDLE, NWDIR_HANDLE,\n\tnuint32, nuint32, nuint32, pnstr8, pnstr8);\n\nNWCCODE ncp_ScanForDeletedFiles(NWCONN_HANDLE, pnuint32, pnuint32, pnuint32,\n\tnuint8,\tNWDELETED_INFO *);\n\n__END_DECLS\n\n#endif /* _NCP_NCP_FILE_ */\n"
  },
  {
    "path": "freebsd-headers/netncp/ncp_lib.h",
    "content": "/*-\n * Copyright (c) 1999, 2000, 2001 Boris Popov\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/netncp/ncp_lib.h 206361 2010-04-07 16:50:38Z joel $\n */\n\n#ifndef _NETNCP_NCP_LIB_H_\n#define _NETNCP_NCP_LIB_H_\n\n#define IPX\n#define INET\n\n#include <netncp/ncp.h>\n#include <netncp/ncp_conn.h>\n#include <netncp/ncp_user.h>\n#include <netncp/ncp_rq.h>\n\n#define ncp_printf printf\n\n#define sipx_cnetwork\tsipx_addr.x_net.c_net\n#define sipx_node\tsipx_addr.x_host.c_host\n#define ipx_netlong(iaddr) (((union ipx_net_u *)(&((iaddr).x_net)))->long_e)\n\n#define\tSTDPARAM_ARGS\t'A':case 'B':case 'C':case 'I':case 'M': \\\n\t\t   case 'N':case 'U':case 'R':case 'S':case 'T': \\\n\t\t   case 'W':case 'O':case 'P'\n\n#define STDPARAM_OPT\t\"A:BCI:M:NO:P:U:R:S:T:W:\"\n\n#ifndef min\n#define\tmin(a,b)\t(((a)<(b)) ? (a) : (b))\n#endif\n\n\n/*\n * An attempt to do a unified options parser\n */\nenum ncp_argtype {NCA_STR,NCA_INT,NCA_BOOL};\n\nstruct ncp_args;\n\ntypedef int ncp_setopt_t (struct ncp_args*);\n\n#define\tNAFL_NONE\t0x0000\n#define\tNAFL_HAVEMIN\t0x0001\n#define\tNAFL_HAVEMAX\t0x0002\n#define\tNAFL_MINMAX\tNAFL_HAVEMIN | NAFL_HAVEMAX\n\nstruct ncp_args {\n\tenum ncp_argtype at;\n\tint\topt;\t/* command line option */\n\tchar\t*name;\t/* rc file equiv */\n\tint\tflag;\t/* NAFL_* */\n\tint\tival;\t/* int/bool values, or max len for str value */\n\tchar\t*str;\t/* string value */\n\tint\tmin;\t/* min for ival */\n\tint\tmax;\t/* max for ival */\n\tncp_setopt_t *fn;/* call back to validate */\n};\n\ntypedef struct {\n  nuint8    day;\n  nuint8    month;\n  nuint16   year;\n} NW_DATE;\n\n/* hours is a nuint16  so that this structure will be the same length as a dword */\ntypedef struct {\n  nuint8    seconds;\n  nuint8    minutes;\n  nuint16   hours;\n} NW_TIME;\n\nstruct ncp_bitname {\n\tu_int\tbn_bit;\n\tconst char\t*bn_name;\n};\n\n__BEGIN_DECLS\n\nint ncp_args_parserc(struct ncp_args *, char *, ncp_setopt_t *);\nint ncp_args_parseopt(struct ncp_args *, int, char *, ncp_setopt_t *);\n\n\nstruct sockaddr_ipx;\nstruct ipx_addr;\nstruct sockaddr;\nstruct ncp_buf;\nstruct rcfile;\n\nint  ncp_initlib(void);\nint  ncp_connect(struct ncp_conn_args *, int *);\nint  ncp_connect_addr(struct sockaddr *, NWCONN_HANDLE *);\nint  ncp_disconnect(int);\nint  ncp_request(int, int, struct ncp_buf *);\nint  ncp_conn_request(int, struct ncp_buf *);\nint  ncp_login(int, const char *, int, const char *);\nint  ncp_conn_scan(struct ncp_conn_loginfo *, int *);\nint  ncp_conn_cnt(void);\nvoid *ncp_conn_list(void);\nint  ncp_conn_getinfo(int, struct ncp_conn_stat *);\nint  ncp_conn_getuser(int, char **);\nint  ncp_conn2ref(int, int *);\nint  ncp_conn_dup(NWCONN_HANDLE, NWCONN_HANDLE *);\nint  ncp_path2conn(char *, int *);\nint  ncp_li_init(struct ncp_conn_loginfo *, int, char *[]);\nvoid ncp_li_done(struct ncp_conn_loginfo *);\nint  ncp_li_login(struct ncp_conn_loginfo *, int *);\nint  ncp_li_readrc(struct ncp_conn_loginfo *);\nint  ncp_li_check(struct ncp_conn_loginfo *);\nint  ncp_li_arg(struct ncp_conn_loginfo *, int, char *);\nint  ncp_li_setserver(struct ncp_conn_loginfo *, const char *);\nint  ncp_li_setuser(struct ncp_conn_loginfo *, char *);\nint  ncp_li_setpassword(struct ncp_conn_loginfo *, const char *);\nint  ncp_conn_setflags(int, u_int16_t, u_int16_t);\nint  ncp_conn_find(char *, char *);\nNWCCODE NWRequest(NWCONN_HANDLE, nuint16, nuint16, NW_FRAGMENT *,\n    nuint16, NW_FRAGMENT *);\n\n#define ncp_setpermanent(connHandle,on)\tncp_conn_setflags(connHandle, NCPFL_PERMANENT, (on) ? NCPFL_PERMANENT : 0)\n#define ncp_setprimary(connHandle,on)\tncp_conn_setflags(connHandle, NCPFL_PRIMARY, (on) ? NCPFL_PRIMARY : 0)\n\nint  ncp_find_fileserver(struct ncp_conn_loginfo *, int, char *);\nint  ncp_find_server(struct ncp_conn_loginfo *, int, int, char *);\n\n/* misc rotines */\nchar* ncp_str_upper(char *);\nint  ncp_open_rcfile(void);\nint  ncp_getopt(int, char * const *, const char *);\nvoid NWUnpackDateTime(nuint32, NW_DATE *, NW_TIME *);\nvoid NWUnpackDate(nuint16, NW_DATE *);\nvoid NWUnpackTime(nuint16, NW_TIME *);\ntime_t ncp_UnpackDateTime(nuint32);\nint  ncp_GetFileServerDateAndTime(NWCONN_HANDLE, time_t *);\nint  ncp_SetFileServerDateAndTime(NWCONN_HANDLE, time_t *);\nNWCCODE NWDownFileServer(NWCONN_HANDLE, int);\nNWCCODE NWCloseBindery(NWCONN_HANDLE);\nNWCCODE NWOpenBindery(NWCONN_HANDLE);\nNWCCODE NWDisableTTS(NWCONN_HANDLE);\nNWCCODE NWEnableTTS(NWCONN_HANDLE);\nNWCCODE NWDisableFileServerLogin(NWCONN_HANDLE);\nNWCCODE NWEnableFileServerLogin(NWCONN_HANDLE);\nvoid ncp_error(const char *, int, ...) __printf0like(1, 3);\nchar *ncp_printb(char *, int, const struct ncp_bitname *);\nvoid nw_keyhash(const u_char *, const u_char *, int, u_char *);\nvoid nw_encrypt(const u_char *, const u_char *, u_char *);\nvoid ipx_print_addr(struct ipx_addr *);\n\n/* bindery calls */\nint  ncp_get_bindery_object_id(NWCONN_HANDLE, u_int16_t, const char *,\n\t\tstruct ncp_bindery_object *);\nint  ncp_get_bindery_object_name(NWCONN_HANDLE, u_int32_t,\n\t\tstruct ncp_bindery_object *);\nint  ncp_scan_bindery_object(NWCONN_HANDLE, u_int32_t, u_int16_t, \n\t\tchar *, struct ncp_bindery_object *);\nint  ncp_read_property_value(NWCONN_HANDLE, int object_type, const char *,\n\t\tint, const char *, struct nw_property *);\nint  ncp_get_encryption_key(NWCONN_HANDLE, char *);\nint  ncp_change_obj_passwd(NWCONN_HANDLE, \n\tconst struct ncp_bindery_object *, const u_char *,\n\tconst u_char *, const u_char *);\nint  ncp_keyed_verify_password(NWCONN_HANDLE, char *, char *,\n\t\tstruct ncp_bindery_object *);\n\n/* queue calls */\nint  ncp_create_queue_job_and_file(NWCONN_HANDLE, u_int32_t, struct queue_job *);\nint  ncp_close_file_and_start_job(NWCONN_HANDLE, u_int32_t, struct queue_job *);\nint  ncp_attach_to_queue(NWCONN_HANDLE, u_int32_t);\nint  ncp_detach_from_queue(NWCONN_HANDLE, u_int32_t);\nint  ncp_service_queue_job(NWCONN_HANDLE, u_int32_t, u_int16_t,\n\t\tstruct queue_job *);\nint  ncp_finish_servicing_job(NWCONN_HANDLE, u_int32_t, u_int32_t, u_int32_t);\nint  ncp_abort_servicing_job(NWCONN_HANDLE, u_int32_t, u_int32_t);\nint  ncp_get_queue_length(NWCONN_HANDLE, u_int32_t, u_int32_t *);\nint  ncp_get_queue_job_ids(NWCONN_HANDLE, u_int32_t, u_int32_t,\n\t\tu_int32_t *, u_int32_t *, u_int32_t []);\nint  ncp_get_queue_job_info(NWCONN_HANDLE, u_int32_t, u_int32_t,\n\t\tstruct nw_queue_job_entry *);\n/*\n * filesystem and volume calls \n */\nint  ncp_read(NWCONN_HANDLE, ncp_fh *, off_t, size_t, char *);\nint  ncp_write(NWCONN_HANDLE, ncp_fh *, off_t, size_t, char *);\nint  ncp_geteinfo(char *, struct nw_entry_info *);\nint  ncp_NSEntryInfo(NWCONN_HANDLE, nuint8, nuint8, nuint32, NW_ENTRY_INFO *);\n\nNWCCODE NWGetVolumeName(NWCONN_HANDLE, u_char, char *);\n\n/* misc ncp calls */\nint  ncp_get_file_server_information(NWCONN_HANDLE, struct ncp_file_server_info *);\nint  ncp_get_stations_logged_info(NWCONN_HANDLE, u_int32_t,\n\t\tstruct ncp_bindery_object *, time_t *);\nint  ncp_get_internet_address(NWCONN_HANDLE, u_int32_t, struct ipx_addr *,\n\t\tu_int8_t *);\nNWCCODE NWGetObjectConnectionNumbers(NWCONN_HANDLE, pnstr8, nuint16,\n\t\tpnuint16, pnuint16, nuint16);\n/*\n * Message broadcast\n */\nNWCCODE NWDisableBroadcasts(NWCONN_HANDLE);\nNWCCODE\tNWEnableBroadcasts(NWCONN_HANDLE);\nNWCCODE\tNWBroadcastToConsole(NWCONN_HANDLE, pnstr8);\nNWCCODE NWSendBroadcastMessage(NWCONN_HANDLE, pnstr8, nuint16, pnuint16, pnuint8);\nNWCCODE NWGetBroadcastMessage(NWCONN_HANDLE, pnstr8);\n\n/*\n * RPC calls\n */\nNWCCODE\tNWSMExecuteNCFFile(NWCONN_HANDLE, pnstr8);\nNWCCODE\tNWSMLoadNLM(NWCONN_HANDLE, pnstr8);\nNWCCODE NWSMUnloadNLM(NWCONN_HANDLE, pnstr8);\nNWCCODE NWSMMountVolume(NWCONN_HANDLE, pnstr8, nuint32 *);\nNWCCODE NWSMDismountVolumeByName(NWCONN_HANDLE, pnstr8);\nNWCCODE NWSMSetDynamicCmdIntValue(NWCONN_HANDLE, pnstr8, nuint32);\nNWCCODE NWSMSetDynamicCmdStrValue(NWCONN_HANDLE, pnstr8, pnstr8);\n\n__END_DECLS\n\nextern int ncp_opterr, ncp_optind, ncp_optopt, ncp_optreset;\nextern char *ncp_optarg;\n\nextern struct rcfile *ncp_rc;\nextern int sysentoffset;\n#endif /* _NETNCP_NCP_LIB_H_ */\n"
  },
  {
    "path": "freebsd-headers/netncp/ncp_ncp.h",
    "content": "/*-\n * Copyright (c) 1999 Boris Popov\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/netncp/ncp_ncp.h 206361 2010-04-07 16:50:38Z joel $\n */\n#ifndef _NETNCP_NCP_NCP_H_\n#define _NETNCP_NCP_NCP_H_\n\n#define NCP_ALLOC_SLOT\t\t0x1111\n#define NCP_REQUEST\t\t0x2222\n#define NCP_REPLY\t\t0x3333\n#define NCP_FREE_SLOT\t\t0x5555\n#define\tNCP_PACKET_BURST\t0x7777\n#define NCP_POSITIVE_ACK\t0x9999\n\n/*\n * Bits for connection state field in ncp_rphdr\n */\n#define\tNCP_CS_BAD_CONN\t\t0x01\t/* no such connection */\n#define\tNCP_CS_NO_SLOTS\t\t0x04\t/* no connection slots available */\n#define\tNCP_CS_SERVER_DOWN\t0x10\t/* server in down state */\n#define\tNCP_CS_HAVE_BROADCAST\t0x40\t/* server holds broadcast for us */\n\n#define NCP_RETRY_COUNT\t\t5\n#define\tNCP_RETRY_TIMEOUT\t10\n#define\tNCP_RESTORE_COUNT\t2\t/* how many times try to restore per \n\t\t\t\t\t * single request, should be an _even_ */\n\nstruct ncp_rqhdr {\n\tu_int16_t type;\n\tu_int8_t  seq;\n\tu_int8_t  conn_low;\n\tu_int8_t  task;\n\tu_int8_t  conn_high;\n\tu_int8_t  fn;\n\tu_int8_t  data[0];\n} __packed;\n\n\nstruct ncp_rphdr {\n\tu_int16_t\ttype;\n\tu_int8_t\tseq;\n\tu_int8_t\tconn_low;\n\tu_int8_t\ttask;\n\tu_int8_t\tconn_high;\n\tu_int8_t\tcompletion_code;\n\tu_int8_t\tconnection_state;\n\tu_int8_t\tdata[0];\n}__packed;\n\n#define\tBFL_ABT\t\t0x04\n#define\tBFL_EOB\t\t0x10\n#define\tBFL_SYS\t\t0x80\n\n#define\tBOP_READ\t1L\n#define\tBOP_WRITE\t2L\n\n#define\tBERR_NONE\t0\n#define\tBERR_INIT\t1\n#define\tBERR_IO\t\t2\n#define\tBERR_NODATA\t3\n#define\tBERR_WRITE\t4\n\nstruct ncp_bursthdr {\n\tu_short\tbh_type;\n\tu_char\tbh_flags;\n\tu_char\tbh_streamtype;\n\tu_long\tbh_srcid;\n\tu_long\tbh_dstid;\n\tu_long\tbh_seq;\t\t\t/* HL */\n\tu_long\tbh_send_delay;\t\t/* HL */\n\tu_short\tbh_bseq;\t\t/* HL */\n\tu_short\tbh_aseq;\t\t/* HL */\n\tu_long\tbh_blen;\t\t/* HL */\n\tu_long\tbh_dofs;\t\t/* HL */\n\tu_short\tbh_dlen;\t\t/* HL */\n\tu_short\tbh_misfrags;\t\t/* HL */\n} __packed;\n\nstruct ncp_conn;\nstruct ncp_conn_args;\nstruct ncp_rq;\nstruct ucred;\n\nint  ncp_ncp_connect(struct ncp_conn *conn);\nint  ncp_ncp_disconnect(struct ncp_conn *conn);\nint  ncp_negotiate_buffersize(struct ncp_conn *conn, int size, int *target);\nint  ncp_renegotiate_connparam(struct ncp_conn *conn, int buffsize,\n\tu_int8_t in_options);\nint  ncp_get_bindery_object_id(struct ncp_conn *conn, \n\t\tu_int16_t object_type, char *object_name, \n\t\tstruct ncp_bindery_object *target,\n\t\tstruct thread *td,struct ucred *cred);\nint  ncp_get_encryption_key(struct ncp_conn *conn, char *target);\nint  ncp_login_encrypted(struct ncp_conn *conn,\n\tstruct ncp_bindery_object *object,\n\tconst u_char *key, const u_char *passwd,\n\tstruct thread *td, struct ucred *cred);\nint ncp_login_unencrypted(struct ncp_conn *conn, u_int16_t object_type, \n\tconst char *object_name, const u_char *passwd,\n\tstruct thread *td, struct ucred *cred);\nint  ncp_read(struct ncp_conn *conn, ncp_fh *file, struct uio *uiop, struct ucred *cred);\nint  ncp_write(struct ncp_conn *conn, ncp_fh *file, struct uio *uiop, struct ucred *cred);\n\n#endif /* _NCP_NCP_H_ */\n"
  },
  {
    "path": "freebsd-headers/netncp/ncp_nls.h",
    "content": "/*-\n * Copyright (c) 1999 Boris Popov\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/netncp/ncp_nls.h 206361 2010-04-07 16:50:38Z joel $\n */\n#ifndef _NETNCP_NCP_NLS_H_\n#define _NETNCP_NCP_NLS_H_\n\n/* options for handle path & caseopt in mount struct */\n#define NWHP_HDB\t0x01\t/* have dir base */\n#define\tNWHP_UPPER\t0x02\t/* local names has upper case */\n#define\tNWHP_LOWER\t0x04\t/* --\"-- lower case */\n#define\tNWHP_DOS\t0x08\t/* using dos name space */\n#define\tNWHP_NLS\t0x10\t/* do name translation via tables, any nmspc */\n#define\tNWHP_NOSTRICT\t0x20\t/* pretend to be a case insensitive */\n\nstruct ncp_nlstables {\n\tu_char\t*to_lower;\t/* local charset to lower case */\n\tu_char\t*to_upper;\t/* local charset to upper case */\n\tu_char\t*n2u;\t\t/* NetWare to Unix */\n\tu_char\t*u2n;\n\tint\topt;\t\t/* may depend on context */\n};\n\n#ifndef _KERNEL\n/*\n * NLS, supported character conversion schemes.\n * NCP_NLS_UNIXCHARSET_NETWARECHARSET\n */\n#define\tNCP_NLS_AS_IS\t\t1\n#define\tNCP_NLS_AS_IS_NAME\t\"asis\"\n#define\tNCP_NLS_KOI_866\t\t2\n#define\tNCP_NLS_SE\t\t3\n#define\tNCP_NLS_KOI_866_NAME\t\"koi2cp866\"\n#define\tNCP_NLS_SE_NAME\t\t\"se\"\n\nextern struct ncp_nlstables ncp_nls;\t/* active nls */\n\n__BEGIN_DECLS\n\nint   ncp_nls_setrecode(int scheme);\nint   ncp_nls_setrecodebyname(char *name);\nint   ncp_nls_setlocale(char *name);\nchar* ncp_nls_str_n2u(char *dst, const char *src);\nchar* ncp_nls_str_u2n(char *dst, const char *src);\nchar* ncp_nls_mem_n2u(char *dst, const char *src, int size);\nchar* ncp_nls_mem_u2n(char *dst, const char *src, int size);\n\n__END_DECLS\n\n#else /* !_KERNEL */\n\n\nextern struct ncp_nlstables ncp_defnls;\n\nvoid ncp_str_upper(char *name);\nvoid ncp_str_lower(char *name);\nvoid ncp_pathcopy(const char *src, char *dst, int len, struct ncp_nlstables *nt);\nint  ncp_pathcheck(char *s, int len, struct ncp_nlstables *nt, int strict);\nvoid ncp_path2unix(char *src, char *dst, int len, struct ncp_nlstables *nt);\n\n#endif /* !_KERNEL */\n\n#endif /* _NCP_NCP_NLS_H_ */\n"
  },
  {
    "path": "freebsd-headers/netncp/ncp_rcfile.h",
    "content": "/*-\n * Copyright (c) 1999 Boris Popov\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/netncp/ncp_rcfile.h 206361 2010-04-07 16:50:38Z joel $\n */\n#ifndef _NETNCP_NCP_RCFILE_H_\n#define _NETNCP_NCP_RCFILE_H_\n#include <sys/queue.h>\n\nstruct rckey {\n\tSLIST_ENTRY(rckey)\trk_next;\n\tchar \t\t\t*rk_name;\n\tchar\t\t\t*rk_value;\n};\n\nstruct rcsection {\n\tSLIST_ENTRY(rcsection)\trs_next;\n\tSLIST_HEAD(rckey_head,rckey) rs_keys;\n\tchar\t\t\t*rs_name;\n};\n    \nstruct rcfile {\n\tSLIST_ENTRY(rcfile)\trf_next;\n\tSLIST_HEAD(rcsec_head, rcsection) rf_sect;\n\tchar\t\t\t*rf_name;\n\tFILE\t\t\t*rf_f;\n};\n\n__BEGIN_DECLS\n\nint  rc_open(char *, char *,struct rcfile **);\nint  rc_close(struct rcfile *);\nint  rc_getstringptr(struct rcfile *, char *, char *, char **);\nint  rc_getstring(struct rcfile *, char *, char *, int, char *);\nint  rc_getint(struct rcfile *, char *, char *, int *);\nint  rc_getbool(struct rcfile *, char *, char *, int *);\n\n__END_DECLS\n\n#endif\t/* _NETNCP_NCP_RCFILE_H_ */\n"
  },
  {
    "path": "freebsd-headers/netncp/ncp_rq.h",
    "content": "/*-\n * Copyright (c) 1999, 2000, 2001 Boris Popov\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/netncp/ncp_rq.h 206361 2010-04-07 16:50:38Z joel $\n */\n#ifndef _NETNCP_NCP_RQ_H_\n#define _NETNCP_NCP_RQ_H_\n\n#include <sys/endian.h>\n\n#define getb(buf,ofs) \t\t(((const u_int8_t *)(buf))[ofs])\n#define setb(buf,ofs,val)\t(((u_int8_t*)(buf))[ofs])=val\n#define getbw(buf,ofs)\t\t((u_int16_t)(getb(buf,ofs)))\n\n#define\tgetwle(buf,ofs) (le16toh(*((u_int16_t*)(&((u_int8_t*)(buf))[ofs]))))\n#define\tgetdle(buf,ofs) (le32toh(*((u_int32_t*)(&((u_int8_t*)(buf))[ofs]))))\n#define\tgetwbe(buf,ofs) (be16toh(*((u_int16_t*)(&((u_int8_t*)(buf))[ofs]))))\n#define\tgetdbe(buf,ofs) (be32toh(*((u_int32_t*)(&((u_int8_t*)(buf))[ofs]))))\n\n#define\tsetwle(buf,ofs,val) \\\n\t(*((u_int16_t*)(&((u_int8_t*)(buf))[ofs])))=htole16(val)\n#define\tsetdle(buf,ofs,val) \\\n\t(*((u_int32_t*)(&((u_int8_t*)(buf))[ofs])))=htole32(val)\n#define\tsetwbe(buf,ofs,val) \\\n\t(*((u_int16_t*)(&((u_int8_t*)(buf))[ofs])))=htobe16(val)\n#define\tsetdbe(buf,ofs,val) \\\n\t(*((u_int32_t*)(&((u_int8_t*)(buf))[ofs])))=htobe32(val)\n\n#ifdef _KERNEL\n\n#include <sys/mchain.h>\n\n#define\tNCPR_ALLOCED\t\t0x0001\t/* request structure was allocated */\n#define\tNCPR_DONTFREEONERR\t0x0002\t/* do not free structure on error */\n\n/* \n * Structure to prepare ncp request and receive reply \n */\nstruct ncp_rq {\n\tint\t\tnr_flags;\n\tstruct mbchain\trq;\n\tstruct mdchain\trp;\n\tint\t\tnr_minrplen;\t/* minimal rp size (-1 if not known) */\n\tint\t\tnr_rpsize;\t/* reply size minus ncp header */\n\tint\t\tnr_cc;\t\t/* completion code */\n\tint\t\tnr_cs;\t\t/* connection state */\n\tstruct thread *\tnr_td;\t\t/* thread that did rq */\n\tstruct ucred *\tnr_cred;\t/* user that did rq */\n\tint\t\trexmit;\n\tstruct ncp_conn*nr_conn;\t/* back link */\n};\n\nint  ncp_rq_alloc(u_int8_t fn, struct ncp_conn *ncp, struct thread *td,\n\tstruct ucred *cred, struct ncp_rq **rqpp);\nint  ncp_rq_alloc_any(u_int32_t ptype, u_int8_t fn, struct ncp_conn *ncp,\n\tstruct thread *td,\tstruct ucred *cred, struct ncp_rq **rqpp);\nint  ncp_rq_alloc_subfn(u_int8_t fn, u_int8_t subfn, struct ncp_conn *ncp,\n\tstruct thread *td,\tstruct ucred *cred, struct ncp_rq **rqpp);\nint  ncp_rq_init_any(struct ncp_rq *rqp, u_int32_t ptype, u_int8_t fn,\n\tstruct ncp_conn *ncp, \n\tstruct thread *td, struct ucred *cred);\nvoid ncp_rq_done(struct ncp_rq *rqp);\nint  ncp_request(struct ncp_rq *rqp);\nint  ncp_request_int(struct ncp_rq *rqp);\n\nstruct ncp_nlstables;\n\nint  ncp_rq_pathstring(struct ncp_rq *rqp, int size, const char *name, struct ncp_nlstables*);\nint  ncp_rq_dbase_path(struct ncp_rq *, u_int8_t vol_num,\n\t\t    u_int32_t dir_base, int namelen, u_char *name, struct ncp_nlstables *nt);\nint  ncp_rq_pstring(struct ncp_rq *rqp, const char *s);\n\nvoid ncp_sign_init(const char *logindata, char *sign_root);\n\n#else /* ifdef _KERNEL */\n\n#define\tDECLARE_RQ\tstruct ncp_buf conn1, *conn=&conn1\n\n#define\tncp_add_byte(conn,x) (conn)->packet[(conn)->rqsize++]=x\n\nstruct ncp_buf;\n\n__BEGIN_DECLS\n\nvoid ncp_init_request(struct ncp_buf *);\nvoid ncp_init_request_s(struct ncp_buf *, int);\nvoid ncp_add_word_lh(struct ncp_buf *, u_int16_t);\nvoid ncp_add_dword_lh(struct ncp_buf *, u_int32_t);\nvoid ncp_add_word_hl(struct ncp_buf *, u_int16_t);\nvoid ncp_add_dword_hl(struct ncp_buf *, u_int32_t);\nvoid ncp_add_mem(struct ncp_buf *, const void *, int);\nvoid ncp_add_mem_nls(struct ncp_buf *, const void *, int);\nvoid ncp_add_pstring(struct ncp_buf *, const char *);\nvoid ncp_add_handle_path(struct ncp_buf *, nuint32, nuint32, int, const char *);\n\n#define ncp_reply_data(conn,offset) ((conn)->packet+offset)\n#define ncp_reply_byte(conn,offset) (*(u_int8_t*)(ncp_reply_data(conn, offset)))\n\nu_int16_t ncp_reply_word_hl(struct ncp_buf *, int);\nu_int16_t ncp_reply_word_lh(struct ncp_buf *, int);\nu_int32_t ncp_reply_dword_hl(struct ncp_buf *, int);\nu_int32_t ncp_reply_dword_lh(struct ncp_buf *, int);\n\nstatic __inline void\nConvertToNWfromDWORD(u_int32_t sfd, ncp_fh *fh) {\n\tfh->val1 = (fh->val.val32 = sfd);\n\treturn;\n}\n\n__END_DECLS\n\n#endif /* ifdef _KERNEL */\n\n#endif\t/* !_NETNCP_NCP_RQ_H_ */\n"
  },
  {
    "path": "freebsd-headers/netncp/ncp_sock.h",
    "content": "/*-\n * Copyright (c) 1999 Boris Popov\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/netncp/ncp_sock.h 206361 2010-04-07 16:50:38Z joel $\n */\n#ifndef _NETNCP_NCP_SOCK_H_\n#define _NETNCP_NCP_SOCK_H_\n\nstruct ncp_conn;\nstruct mbuf;\nstruct ncp_rq;\nstruct proc;\nstruct socket;\nstruct timeval;\n\nint  ncp_sock_connect(struct ncp_conn *ncp);\nint  ncp_sock_recv(struct socket *so, struct mbuf **mp, int *rlen);\nint  ncp_sock_send(struct socket *so, struct mbuf *data, struct ncp_rq *rqp);\nint  ncp_sock_disconnect(struct ncp_conn *conn);\nint  ncp_sock_checksum(struct ncp_conn *conn, int enable);\n\nvoid ncp_check_rq(struct ncp_conn *conn);\nvoid ncp_check_conn(struct ncp_conn *conn);\n\nvoid ncp_check_wd(struct ncp_conn *conn);\n\n#endif /* _NCP_SOCK_H_ */\n"
  },
  {
    "path": "freebsd-headers/netncp/ncp_subr.h",
    "content": "/*-\n * Copyright (c) 1999 Boris Popov\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/netncp/ncp_subr.h 206361 2010-04-07 16:50:38Z joel $\n */\n#ifndef _NETNCP_NCP_SUBR_H_\n#define _NETNCP_NCP_SUBR_H_\n\n#define NCP_TIMER_TICK\t2*hz\t/* 1sec */\n#define\tNCP_SIGMASK(set) \t\t\t\t\t\t\\\n\t(SIGISMEMBER(set, SIGINT) || SIGISMEMBER(set, SIGTERM) ||\t\\\n\t SIGISMEMBER(set, SIGHUP) || SIGISMEMBER(set, SIGKILL) ||\t\\\n\t SIGISMEMBER(set, SIGQUIT))\n\n\n#define\tNCP_PRINT(format, args...) printf(\"FATAL: %s: \"format, __func__ ,## args)\n#define nwfs_printf\tNCP_PRINT\n/* Maybe this should panic, but I dont like that */\n#define NCPFATAL\tNCP_PRINT\n#define NCPERROR\tNCP_PRINT\n\n/* socket debugging */\n#ifdef NCP_SOCKET_DEBUG\n#define NCPSDEBUG(format, args...) printf(\"%s: \"format, __func__ ,## args)\n#else\n#define NCPSDEBUG(format, args...)\n#endif\n\n/* NCP calls debug */\n#ifdef NCP_NCP_DEBUG\n#define NCPNDEBUG(format, args...) printf(\"%s: \"format, __func__ ,## args)\n#else\n#define NCPNDEBUG(format, args...)\n#endif\n\n/* NCP data dump */\n#ifdef NCP_DATA_DEBUG\n#define NCPDDEBUG(m) m_dumpm(m)\n#else\n#define NCPDDEBUG(m)\n#endif\n\n/* FS VOPS debug */\n#ifdef NWFS_VOPS_DEBUG\n#define NCPVODEBUG(format, args...) printf(\"%s: \"format, __func__ ,## args)\n#else\n#define NCPVODEBUG(format, args...)\n#endif\n\n/* FS VNOPS debug */\n#ifdef NWFS_VNOPS_DEBUG\n#define NCPVNDEBUG(format, args...) printf(\"%s: \"format, __func__ ,## args)\n#else\n#define NCPVNDEBUG(format, args...)\n#endif\n\n#define checkbad(fn) {error=(fn);if(error) goto bad;}\n\n#define\tncp_suser(cred)\tpriv_check_cred(cred, PRIV_NETNCP, 0)\n\n#define ncp_isowner(conn,cred) ((cred)->cr_uid == (conn)->nc_owner->cr_uid)\n\nstruct ncp_conn;\n\nstruct nwmount;\nstruct vnode;\nstruct nwnode;\nstruct vattr;\nstruct uio;\nstruct ncp_nlstables;\n\nstruct ncp_open_info {\n\tu_int32_t \t\torigfh;\n\tncp_fh\t\t\tfh;\n\tu_int8_t \t\taction;\n\tstruct nw_entry_info\tfattr;\n};\n\nextern int ncp_debuglevel;\n\nstruct proc;\nstruct ucred;\n\nint  ncp_init(void);\nint  ncp_done(void);\nint  ncp_chkintr(struct ncp_conn *conn, struct thread *td);\nchar*ncp_str_dup(char *s);\n\n/* ncp_crypt.c */\nvoid nw_keyhash(const u_char *key, const u_char *buf, int buflen, u_char *target);\nvoid nw_encrypt(const u_char *fra, const u_char *buf, u_char *target);\nvoid ncp_sign(const u_int32_t *state, const char *x, u_int32_t *ostate);\n\n#endif /* _NCP_SUBR_H_ */\n"
  },
  {
    "path": "freebsd-headers/netncp/ncp_user.h",
    "content": "/*-\n * Copyright (c) 1999 Boris Popov\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/netncp/ncp_user.h 206361 2010-04-07 16:50:38Z joel $\n */\n#ifndef _NETNCP_NCP_USER_H_\n#define _NETNCP_NCP_USER_H_\n\n/* \n * \"ncp\" interface to kernel, this can be done via syscalls but may eat\n * a lot of them, so we select internal code, define req's and replays\n * as necessary. Structure for call is simple:\n * byte=NCP_CONN\n * byte=NCP_CONN_SUBFN\n * ....=data\n */\n#define\tNCP_CONN\t\t0xF5\t/* change if that will occupied */\n#define\tNCP_CONN_READ\t\t0x01\t/* read from file handle */\n#define\tNCP_CONN_WRITE\t\t0x02\t/* write to file handle */\n#define\tNCP_CONN_SETFLAGS\t0x03\t/* word mask, word flags */\n#define\tNCP_CONN_LOGIN\t\t0x04\t/* bind login on handle */\n#define\tNCP_CONN_GETINFO\t0x05\t/* get information about connection */\n#define\tNCP_CONN_GETUSER\t0x06\t/* get user name for connection */\n#define\tNCP_CONN_CONN2REF\t0x07\t/* convert handle to reference */\n#define\tNCP_CONN_CONNCLOSE\t0x08\t/* release connection handle */\n#define\tNCP_CONN_FRAG\t\t0x09\t/* ncp fragmented request */\n#define\tNCP_CONN_DUP\t\t0x0A\t/* get an additional handle */\n#define\tNCP_CONN_GETDATA\t0x0B\t/* retrieve NCP_CD_* vals */\n#define\tNCP_CONN_SETDATA\t0x0C\t/* store NCP_CD_* vals */\n\n/*\n * Internal connection data can be set by owner or superuser and retrieved\n * only by superuser\n */\n#define\tNCP_CD_NDSLOGINKEY\t0x01\n#define\tNCP_CD_NDSPRIVATEKEY\t0x02\n#define NCP_CD_NDSUFLAGS\t0x03\n\n/* user side structures to issue fragmented ncp calls */\ntypedef struct {\n\tchar\t*fragAddress;\n\tu_int32_t fragSize;\n} NW_FRAGMENT;\n\n\nstruct ncp_rw {\n\tncp_fh\tnrw_fh;\n\tchar \t*nrw_base;\n\toff_t\tnrw_offset;\n\tint\tnrw_cnt;\n};\n\nstruct ncp_conn_login {\n\tchar\t*username;\n\tint\tobjtype;\n\tchar\t*password;\n};\n\nstruct ncp_conn_frag {\n\tint\t\tcc;\t\t/* completion code */\n\tint\t\tcs;\t\t/* connection state */\n\tint\t\tfn;\n\tint\t\trqfcnt;\n\tNW_FRAGMENT\t*rqf;\n\tint\t\trpfcnt;\n\tNW_FRAGMENT\t*rpf;\n};\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/netncp/ncpio.h",
    "content": "/*-\n * Copyright (c) 2003 Tim J. Robbins.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/netncp/ncpio.h 111657 2003-02-28 04:31:29Z tjr $\n */\n\n#ifndef _NETNCP_NCPIO_H_\n#define _NETNCP_NCPIO_H_\n\n#ifndef _KERNEL\n#include <sys/types.h>\n#endif\n#include <sys/ioccom.h>\n\n#define\tNCP_NAME\t\"ncp\"\n\nstruct ncp_conn_args;\nstruct ncp_buf;\n\nstruct ncpioc_connect {\n\tstruct ncp_conn_args\t*ioc_li;\n\tint\t\t\t*ioc_connhandle;\n};\n\nstruct ncpioc_request {\n\tint\t\t\tioc_connhandle;\n\tint\t\t\tioc_fn;\n\tstruct ncp_buf\t\t*ioc_ncpbuf;\n};\n\nstruct ncpioc_connscan {\n\tstruct ncp_conn_args\t*ioc_li;\n\tint\t\t\t*ioc_connhandle;\n};\n\n#define\tNCPIOC_CONNECT\t\t_IOW('N',  100, struct ncpioc_connect)\n#define\tNCPIOC_REQUEST\t\t_IOW('N',  101, struct ncpioc_request)\n#define\tNCPIOC_CONNSCAN\t\t_IOW('N',  102, struct ncpioc_connscan)\n\n#endif /* _NETNCP_NCPIO_H_ */\n"
  },
  {
    "path": "freebsd-headers/netncp/nwerror.h",
    "content": "/*\n * NetWare requestor error codes, they taken from NDK\n *\n * $FreeBSD: release/9.0.0/sys/netncp/nwerror.h 54477 1999-12-12 05:50:07Z bp $\n */\n#ifndef _NETNCP_NWERROR_H_\n#define _NETNCP_NWERROR_H_\n\n#ifndef SUCCESS\n#define SUCCESS                        0\n#endif\n\n#define SHELL_ERROR                    0x8800\n#define VLM_ERROR                      0x8800\n#define ALREADY_ATTACHED               0x8800  /* 0  - Attach attempted to server with valid, existing connection */\n#define INVALID_CONNECTION             0x8801  /* 1  - Request attempted with invalid or non-attached connection handle */\n#define DRIVE_IN_USE                   0x8802  /* 2  - OS/2 only (NOT USED) */\n#define CANT_ADD_CDS                   0x8803  /* 3  - Map drive attempted but unable to add new current directory structure */\n#define DRIVE_CANNOT_MAP               0x8803\n#define BAD_DRIVE_BASE                 0x8804  /* 4  - Map drive attempted with invalid path specification */\n#define NET_READ_ERROR                 0x8805  /* 5  - Attempt to receive from the selected transport failed */\n#define NET_RECV_ERROR                 0x8805  /* 5  */\n#define UNKNOWN_NET_ERROR              0x8806  /* 6  - Network send attempted with an un-specific network error */\n#define SERVER_INVALID_SLOT            0x8807  /* 7  - Server request attempted with invalid server connection slot */\n#define BAD_SERVER_SLOT                0x8807  /* 7  */\n#define NO_SERVER_SLOTS                0x8808  /* 8  - Attach attempted to server with no connection slots available */\n#define NET_WRITE_ERROR                0x8809  /* 9  - Attempt to send on the selected transport failed */\n#define CONNECTION_IN_ERROR_STATE      0x8809  /* Client-32 */\n#define NET_SEND_ERROR                 0x8809  /* 9  */\n#define SERVER_NO_ROUTE                0x880A  /* 10 - Attempted to find route to server where no route exists */\n#define BAD_LOCAL_TARGET               0x880B  /* 11 - OS/2 only */\n#define TOO_MANY_REQ_FRAGS             0x880C  /* 12 - Attempted request with too many request fragments specified */\n#define CONNECT_LIST_OVERFLOW          0x880D  /* 13 */\n#define BUFFER_OVERFLOW                0x880E  /* 14 - Attempt to receive more data than the reply buffer had room for */\n#define MORE_DATA_ERROR                0x880E  /* Client-32 */\n#define NO_CONN_TO_SERVER              0x880F  /* 15 */\n#define NO_CONNECTION_TO_SERVER        0x880F  /* 15 - Attempt to get connection for a server not connected */\n#define NO_ROUTER_FOUND                0x8810  /* 16 - OS/2 only */\n#define BAD_FUNC_ERROR                 0x8811  /* 17 */\n#define INVALID_SHELL_CALL             0x8811  /* 17 - Attempted function call to non- existent or illegal function */\n#define SCAN_COMPLETE                  0x8812\n#define LIP_RESIZE_ERROR               0x8812  /* Client-32 */\n#define UNSUPPORTED_NAME_FORMAT_TYPE   0x8813\n#define INVALID_DIR_HANDLE             0x8813  /* Client-32 */\n#define HANDLE_ALREADY_LICENSED        0x8814\n#define OUT_OF_CLIENT_MEMORY           0x8814  /* Client-32 */\n#define HANDLE_ALREADY_UNLICENSED      0x8815\n#define PATH_NOT_OURS                  0x8815  /* Client-32 */\n#define INVALID_NCP_PACKET_LENGTH      0x8816\n#define PATH_IS_PRINT_DEVICE           0x8816  /* Client-32 */\n#define SETTING_UP_TIMEOUT             0x8817\n#define PATH_IS_EXCLUDED_DEVICE        0x8817  /* Client-32 */\n#define SETTING_SIGNALS                0x8818\n#define PATH_IS_INVALID                0x8818  /* Client-32 */\n#define SERVER_CONNECTION_LOST         0x8819\n#define NOT_SAME_DEVICE                0x8819  /* Client-32 */\n#define OUT_OF_HEAP_SPACE              0x881A\n#define INVALID_SERVICE_REQUEST        0x881B\n#define INVALID_SEARCH_HANDLE          0x881B  /* Client-32 */\n#define INVALID_TASK_NUMBER            0x881C\n#define INVALID_DEVICE_HANDLE          0x881C  /* Client-32 */\n#define INVALID_MESSAGE_LENGTH         0x881D\n#define INVALID_SEM_HANDLE             0x881D  /* Client-32 */\n#define EA_SCAN_DONE                   0x881E\n#define INVALID_CFG_HANDLE             0x881E  /* Client-32 */\n#define BAD_CONNECTION_NUMBER          0x881F\n#define INVALID_MOD_HANDLE             0x881F  /* Client-32 */\n#define ASYN_FIRST_PASS                0x8820\n#define INVALID_DEVICE_INDEX           0x8821\n#define INVALID_CONN_HANDLE            0x8822\n#define INVALID_QUEUE_ID               0x8823\n#define INVALID_PDEVICE_HANDLE         0x8824\n#define INVALID_JOB_HANDLE             0x8825\n#define INVALID_ELEMENT_ID             0x8826\n#define ALIAS_NOT_FOUND                0x8827\n#define RESOURCE_SUSPENDED             0x8828\n#define INVALID_QUEUE_SPECIFIED        0x8829\n#define DEVICE_ALREADY_OPEN            0x882A\n#define JOB_ALREADY_OPEN               0x882B\n#define QUEUE_NAME_ID_MISMATCH         0x882C\n#define JOB_ALREADY_STARTED            0x882D\n#define SPECT_DAA_TYPE_NOT_SUPPORTED   0x882E\n#define INVALID_ENVIR_HANDLE           0x882F\n#define NOT_SAME_CONNECTION            0x8830  /* 48 - Internal server request attempted accross different server connections */\n#define PRIMARY_CONNECTION_NOT_SET     0x8831  /* 49 - Attempt to retrieve default connection with no primary connection set */\n#define NO_PRIMARY_SET                 0x8831  /* 49 */\n#define KEYWORD_NOT_FOUND              0x8832  /* Client-32 */\n#define PRINT_CAPTURE_NOT_IN_PROGRESS  0x8832  /* Client-32 */\n#define NO_CAPTURE_SET                 0x8832  /* 50 */\n#define NO_CAPTURE_IN_PROGRESS         0x8832  /* 50 - Capture information requested on port with no capture in progress */\n#define BAD_BUFFER_LENGTH              0x8833  /* 51 */\n#define INVALID_BUFFER_LENGTH          0x8833  /* 51 - Used to indicate length which caller requested on a GetDNC or SetDNC was too large */\n#define NO_USER_NAME                   0x8834  /* 52 */\n#define NO_NETWARE_PRINT_SPOOLER       0x8835  /* 53 - Capture requested without having the local print spooler installed */\n#define INVALID_PARAMETER              0x8836  /* 54 - Attempted function with an invalid function parameter specified */\n#define CONFIG_FILE_OPEN_FAILED        0x8837  /* 55 - OS/2 only */\n#define NO_CONFIG_FILE                 0x8838  /* 56 - OS/2 only */\n#define CONFIG_FILE_READ_FAILED        0x8839  /* 57 - OS/2 only */\n#define CONFIG_LINE_TOO_LONG           0x883A  /* 58 - OS/2 only */\n#define CONFIG_LINES_IGNORED           0x883B  /* 59 - OS/2 only */\n#define NOT_MY_RESOURCE                0x883C  /* 60 - Attempted request made with a parameter using foriegn resource */\n#define DAEMON_INSTALLED               0x883D  /* 61 - OS/2 only */\n#define SPOOLER_INSTALLED              0x883E  /* 62 - Attempted load of print spooler with print spooler already installed */\n#define CONN_TABLE_FULL                0x883F  /* 63 */\n#define CONNECTION_TABLE_FULL          0x883F  /* 63 - Attempted to allocate a connection handle with no more local connection table entries */\n#define CONFIG_SECTION_NOT_FOUND       0x8840  /* 64 - OS/2 only */\n#define BAD_TRAN_TYPE                  0x8841  /* 65 */\n#define INVALID_TRANSPORT_TYPE         0x8841  /* 65 - Attempted function on a connection with an invalid transport selected */\n#define TDS_TAG_IN_USE                 0x8842  /* 66 - OS/2 only */\n#define TDS_OUT_OF_MEMORY              0x8843  /* 67 - OS/2 only */\n#define TDS_INVALID_TAG                0x8844  /* 68 - Attempted TDS function with invalid tag */\n#define TDS_WRITE_TRUNCATED            0x8845  /* 69 - Attempted TDS write with buffer that exceeded buffer */\n#define NO_CONNECTION_TO_DS            0x8846  /* Client-32 */\n#define NO_DIRECTORY_SERVICE_CONNECTION 0x8846  /* 70 */\n#define SERVICE_BUSY                   0x8846  /* 70 - Attempted request made to partially asynchronous function in busy state */\n#define NO_SERVER_ERROR                0x8847  /* 71 - Attempted connect failed to find any servers responding */\n#define BAD_VLM_ERROR                  0x8848  /* 72 - Attempted function call to non-existant or not-loaded overlay */\n#define NETWORK_DRIVE_IN_USE           0x8849  /* 73 - Attempted map to network drive that was already mapped */\n#define LOCAL_DRIVE_IN_USE             0x884A  /* 74 - Attempted map to local drive that was in use */\n#define NO_DRIVES_AVAILABLE            0x884B  /* 75 - Attempted map to next available drive when none were available */\n#define DEVICE_NOT_REDIRECTED          0x884C  /* 76 - The device is not redirected */\n#define NO_MORE_SFT_ENTRIES            0x884D  /* 77 - Maximum number of files was reached */\n#define UNLOAD_ERROR                   0x884E  /* 78 - Attempted unload failed */\n#define IN_USE_ERROR                   0x884F  /* 79 - Attempted re-use of already in use connection entry */\n#define TOO_MANY_REP_FRAGS             0x8850  /* 80 - Attempted request with too many reply fragments specified */\n#define TABLE_FULL                     0x8851  /* 81 - Attempted to add a name into the name table after it was full */\n#ifndef SOCKET_NOT_OPEN\n#define SOCKET_NOT_OPEN                0x8852  /* 82 - Listen was posted on unopened socket */\n#endif\n#define MEM_MGR_ERROR                  0x8853  /* 83 - Attempted enhanced memory operation failed */\n#define SFT3_ERROR                     0x8854  /* 84 - An SFT3 switch occured mid-transfer */\n#define PREFERRED_NOT_FOUND            0x8855  /* 85 - the preferred directory server was not established but another directory server was returned */\n#define DEVICE_NOT_RECOGNIZED          0x8856  /* 86 - used to determine if the device is not used by VISE so pass it on to the next redirector, if any. */\n#define BAD_NET_TYPE                   0x8857  /* 87 - the network type (Bind/NDS) does not match the server version */\n#define ERROR_OPENING_FILE             0x8858  /* 88 - generic open failure error, invalid path, access denied, etc.. */\n#define NO_PREFERRED_SPECIFIED         0x8859  /* 89 - no preferred name specified */\n#define ERROR_OPENING_SOCKET           0x885A  /* 90 - error opening a socket */\n#define REQUESTER_FAILURE              0x885A  /* Client-32 */\n#define RESOURCE_ACCESS_DENIED         0x885B  /* Client-32 */\n#define SIGNATURE_LEVEL_CONFLICT       0x8861\n#define NO_LOCK_FOUND                  0x8862  /* OS/2 - process lock on conn handle failed, process ID not recognized */\n#define LOCK_TABLE_FULL                0x8863  /* OS/2 - process lock on conn handle failed, process lock table full */\n#define INVALID_MATCH_DATA             0x8864\n#define MATCH_FAILED                   0x8865\n#define NO_MORE_ENTRIES                0x8866\n#define INSUFFICIENT_RESOURCES         0x8867\n#define STRING_TRANSLATION             0x8868\n#define STRING_TRANSLATION_NEEDED      0x8868  /* Client-32 */\n#define ACCESS_VIOLATION               0x8869\n#define NOT_AUTHENTICATED              0x886A\n#define INVALID_LEVEL                  0x886B\n#define RESOURCE_LOCK_ERROR            0x886C\n#define INVALID_NAME_FORMAT            0x886D\n#define OBJECT_EXISTS                  0x886E\n#define OBJECT_NOT_FOUND               0x886F\n#define UNSUPPORTED_TRAN_TYPE          0x8870\n#define INVALID_STRING_TYPE            0x8871\n#define INVALID_OWNER                  0x8872\n#define UNSUPPORTED_AUTHENTICATOR      0x8873\n#define IO_PENDING                     0x8874\n#define INVALID_DRIVE_NUM              0x8875\n#define SHELL_FAILURE                  0x88FF\n#define VLM_FAILURE                    0x88FF\n\n#define  SVC_ALREADY_REGISTERED        0x8880 /* Client-32 */\n#define  SVC_REGISTRY_FULL             0x8881 /* Client-32 */\n#define  SVC_NOT_REGISTERED            0x8882 /* Client-32 */\n#define  OUT_OF_RESOURCES              0x8883 /* Client-32 */\n#define  RESOLVE_SVC_FAILED            0x8884 /* Client-32 */\n#define  CONNECT_FAILED                0x8885 /* Client-32 */\n#define  PROTOCOL_NOT_BOUND            0x8886 /* Client-32 */\n#define  AUTHENTICATION_FAILED         0x8887 /* Client-32 */\n#define  INVALID_AUTHEN_HANDLE         0x8888 /* Client-32 */\n#define  AUTHEN_HANDLE_ALREADY_EXISTS  0x8889 /* Client-32 */\n\n#define  DIFF_OBJECT_ALREADY_AUTHEN    0x8890 /* Client-32 */\n#define  REQUEST_NOT_SERVICEABLE       0x8891 /* Client-32 */\n#define  AUTO_RECONNECT_SO_REBUILD     0x8892 /* Client-32 */\n#define  AUTO_RECONNECT_RETRY_REQUEST  0x8893 /* Client-32 */\n#define  ASYNC_REQUEST_IN_USE          0x8894 /* Client-32 */\n#define  ASYNC_REQUEST_CANCELED        0x8895 /* Client-32 */\n#define  SESS_SVC_ALREADY_REGISTERED   0x8896 /* Client-32 */\n#define  SESS_SVC_NOT_REGISTERED       0x8897 /* Client-32 */\n#define  PREVIOUSLY_AUTHENTICATED      0x8899 /* Client-32 */\n#define  RESOLVE_SVC_PARTIAL           0x889A /* Client-32 */\n#define  NO_DEFAULT_SPECIFIED          0x889B /* Client-32 */\n#define  HOOK_REQUEST_NOT_HANDLED      0x889C /* Client-32 */\n#define  HOOK_REQUEST_BUSY             0x889D /* Client-32 */\n#define  HOOK_REQUEST_QUEUED           0x889D /* Client-32 */\n#define  AUTO_RECONNECT_SO_IGNORE      0x889E /* Client-32 */\n#define  ASYNC_REQUEST_NOT_IN_USE      0x889F /* Client-32 */\n#define  AUTO_RECONNECT_FAILURE        0x88A0 /* Client-32 */\n#define  NET_ERROR_ABORT_APPLICATION   0x88A1 /* Client-32 */\n#define  NET_ERROR_SUSPEND_APPLICATION 0x88A2 /* Client-32 */\n#define  NET_ERROR_ABORTED_PROCESS_GROUP  0x88A3 /* Client-32 */\n#define  NET_ERROR_PASSWORD_HAS_EXPIRED   0x88A5 /* Client-32 */\n#define  NET_ERROR_NETWORK_INACTIVE       0x88A6 /* Client-32 */\n#define  REPLY_TRUNCATED            0x88e6    /* 230 NLM */\n\n\n/* Server Errors */\n\n#define ERR_INSUFFICIENT_SPACE          0x8901  /* 001 */\n#define ERR_NO_MORE_ENTRY           0x8914   /* 020 */\n#define NLM_INVALID_CONNECTION         0x890a   /* 010 */\n#define ERR_BUFFER_TOO_SMALL            0x8977  /* 119 */\n#define ERR_VOLUME_FLAG_NOT_SET         0x8978  /* 120 the service requested, not avail. on the selected vol. */\n#define ERR_NO_ITEMS_FOUND              0x8979  /* 121 */\n#define ERR_CONN_ALREADY_TEMP           0x897a  /* 122 */\n#define ERR_CONN_ALREADY_LOGGED_IN      0x897b  /* 123 */\n#define ERR_CONN_NOT_AUTHENTICATED      0x897c  /* 124 */\n#define ERR_CONN_NOT_LOGGED_IN          0x897d  /* 125 */\n#define NCP_BOUNDARY_CHECK_FAILED       0x897e  /* 126 */\n#define ERR_LOCK_WAITING                0x897f  /* 127 */\n#define ERR_LOCK_FAIL                   0x8980  /* 128 */\n#define FILE_IN_USE_ERROR               0x8980  /* 128 */\n#define NO_MORE_FILE_HANDLES            0x8981  /* 129 */\n#define NO_OPEN_PRIVILEGES              0x8982  /* 130 */\n#define IO_ERROR_NETWORK_DISK           0x8983  /* 131 */\n#define ERR_AUDITING_HARD_IO_ERROR      0x8983  /* 131 */\n#define NO_CREATE_PRIVILEGES            0x8984  /* 132 */\n#define ERR_AUDITING_NOT_SUPV           0x8984  /* 132 */\n#define NO_CREATE_DELETE_PRIVILEGES     0x8985  /* 133 */\n#define CREATE_FILE_EXISTS_READ_ONLY    0x8986  /* 134 */\n#define WILD_CARDS_IN_CREATE_FILE_NAME  0x8987  /* 135 */\n#define CREATE_FILENAME_ERROR           0x8987  /* 135 */\n#define INVALID_FILE_HANDLE             0x8988  /* 136 */\n#define NO_SEARCH_PRIVILEGES            0x8989  /* 137 */\n#define NO_DELETE_PRIVILEGES            0x898A  /* 138 */\n#define NO_RENAME_PRIVILEGES            0x898B  /* 139 */\n#define NO_MODIFY_PRIVILEGES            0x898C  /* 140 */\n#define SOME_FILES_AFFECTED_IN_USE      0x898D  /* 141 */\n#define NO_FILES_AFFECTED_IN_USE        0x898E  /* 142 */\n#define SOME_FILES_AFFECTED_READ_ONLY   0x898F  /* 143 */\n#define NO_FILES_AFFECTED_READ_ONLY     0x8990  /* 144 */\n#define SOME_FILES_RENAMED_NAME_EXISTS  0x8991  /* 145 */\n#define NO_FILES_RENAMED_NAME_EXISTS    0x8992  /* 146 */\n#define NO_READ_PRIVILEGES              0x8993  /* 147 */\n#define NO_WRITE_PRIVILEGES_OR_READONLY 0x8994  /* 148 */\n#define FILE_DETACHED                   0x8995  /* 149 */\n#define SERVER_OUT_OF_MEMORY            0x8996  /* 150 */\n#define ERR_TARGET_NOT_A_SUBDIRECTORY   0x8996  /* 150 can be changed later (note written by server people). */\n#define NO_DISK_SPACE_FOR_SPOOL_FILE    0x8997  /* 151 */\n#define ERR_AUDITING_NOT_ENABLED        0x8997  /* 151 */\n#define VOLUME_DOES_NOT_EXIST           0x8998  /* 152 */\n#define DIRECTORY_FULL                  0x8999  /* 153 */\n#define RENAMING_ACROSS_VOLUMES         0x899A  /* 154 */\n#define BAD_DIRECTORY_HANDLE            0x899B  /* 155 */\n#define INVALID_PATH                    0x899C  /* 156 */\n#define NO_MORE_TRUSTEES                0x899C  /* 156 */\n#define NO_MORE_DIRECTORY_HANDLES       0x899D  /* 157 */\n#define INVALID_FILENAME                0x899E  /* 158 */\n#define DIRECTORY_ACTIVE                0x899F  /* 159 */\n#define DIRECTORY_NOT_EMPTY             0x89A0  /* 160 */\n#define DIRECTORY_IO_ERROR              0x89A1  /* 161 */\n#define READ_FILE_WITH_RECORD_LOCKED    0x89A2  /* 162 */\n#define ERR_TRANSACTION_RESTARTED       0x89A3  /* 163 */\n#define ERR_RENAME_DIR_INVALID          0x89A4  /* 164 */\n#define ERR_INVALID_OPENCREATE_MODE     0x89A5  /* 165 */\n#define ERR_ALREADY_IN_USE              0x89A6  /* 166 */\n#define ERR_AUDITING_ACTIVE             0x89A6  /* 166 */\n#define ERR_INVALID_RESOURCE_TAG        0x89A7  /* 167 */\n#define ERR_ACCESS_DENIED               0x89A8  /* 168 */\n#define ERR_AUDITING_NO_RIGHTS          0x89A8  /* 168 */\n#define INVALID_DATA_STREAM             0x89BE  /* 190 */\n#define INVALID_NAME_SPACE              0x89BF  /* 191 */\n#define NO_ACCOUNTING_PRIVILEGES        0x89C0  /* 192 */\n#define LOGIN_DENIED_NO_ACCOUNT_BALANCE 0x89C1  /* 193 */\n#define LOGIN_DENIED_NO_CREDIT          0x89C2  /* 194 */\n#define ERR_AUDITING_RECORD_SIZE        0x89C2  /* 194 */\n#define ERR_TOO_MANY_HOLDS              0x89C3  /* 195 */\n#define ACCOUNTING_DISABLED             0x89C4  /* 196 */\n#define INTRUDER_DETECTION_LOCK         0x89C5  /* 197 */\n#define NO_CONSOLE_OPERATOR             0x89C6  /* 198 */\n#define NO_CONSOLE_PRIVILEGES           0x89C6  /* 198 */\n#define ERR_Q_IO_FAILURE                0x89D0  /* 208 */\n#define ERR_NO_QUEUE                    0x89D1  /* 209 */\n#define ERR_NO_Q_SERVER                 0x89D2  /* 210 */\n#define ERR_NO_Q_RIGHTS                 0x89D3  /* 211 */\n#define ERR_Q_FULL                      0x89D4  /* 212 */\n#define ERR_NO_Q_JOB                    0x89D5  /* 213 */\n#define ERR_NO_Q_JOB_RIGHTS             0x89D6  /* 214 */\n#define ERR_Q_IN_SERVICE                0x89D7  /* 215 */\n#define PASSWORD_NOT_UNIQUE             0x89D7  /* 215 */\n#define ERR_Q_NOT_ACTIVE                0x89D8  /* 216 */\n#define PASSWORD_TOO_SHORT              0x89D8  /* 216 */\n#define ERR_Q_STN_NOT_SERVER            0x89D9  /* 217 */\n#define LOGIN_DENIED_NO_CONNECTION      0x89D9  /* 217 */\n#define ERR_MAXIMUM_LOGINS_EXCEEDED     0x89D9  /* 217 */\n#define ERR_Q_HALTED                    0x89DA  /* 218 */\n#define UNAUTHORIZED_LOGIN_TIME         0x89DA  /* 218 */\n#define UNAUTHORIZED_LOGIN_STATION      0x89DB  /* 219 */\n#define ERR_Q_MAX_SERVERS               0x89DB  /* 219 */\n#define ACCOUNT_DISABLED                0x89DC  /* 220 */\n#define PASSWORD_HAS_EXPIRED_NO_GRACE   0x89DE  /* 222 */\n#define PASSWORD_HAS_EXPIRED            0x89DF  /* 223 */\n#define E_NO_MORE_USERS                 0x89E7  /* 231 */\n#define NOT_ITEM_PROPERTY               0x89E8  /* 232 */\n#define WRITE_PROPERTY_TO_GROUP         0x89E8  /* 232 */\n#define MEMBER_ALREADY_EXISTS           0x89E9  /* 233 */\n#define NO_SUCH_MEMBER                  0x89EA  /* 234 */\n#define NOT_GROUP_PROPERTY              0x89EB  /* 235 */\n#define NO_SUCH_SEGMENT                 0x89EC  /* 236 */\n#define PROPERTY_ALREADY_EXISTS         0x89ED  /* 237 */\n#define OBJECT_ALREADY_EXISTS           0x89EE  /* 238 */\n#define INVALID_NAME                    0x89EF  /* 239 */\n#define WILD_CARD_NOT_ALLOWED           0x89F0  /* 240 */\n#define INVALID_BINDERY_SECURITY        0x89F1  /* 241 */\n#define NO_OBJECT_READ_PRIVILEGE        0x89F2  /* 242 */\n#define NO_OBJECT_RENAME_PRIVILEGE      0x89F3  /* 243 */\n#define NO_OBJECT_DELETE_PRIVILEGE      0x89F4  /* 244 */\n#define NO_OBJECT_CREATE_PRIVILEGE      0x89F5  /* 245 */\n#define NO_PROPERTY_DELETE_PRIVILEGE    0x89F6  /* 246 */\n#define NO_PROPERTY_CREATE_PRIVILEGE    0x89F7  /* 247 */\n#define NO_PROPERTY_WRITE_PRIVILEGE     0x89F8  /* 248 */\n#define NO_FREE_CONNECTION_SLOTS        0x89F9  /* 249 */\n#define NO_PROPERTY_READ_PRIVILEGE      0x89F9  /* 249 */\n#define NO_MORE_SERVER_SLOTS            0x89FA  /* 250 */\n#define TEMP_REMAP_ERROR                0x89FA  /* 250 */\n#define INVALID_PARAMETERS              0x89FB  /* 251 */\n#define NO_SUCH_PROPERTY                0x89FB  /* 251 */\n#define ERR_NCP_NOT_SUPPORTED           0x89FB  /* 251 */\n#define INTERNET_PACKET_REQT_CANCELED   0x89FC  /* 252 */\n#define UNKNOWN_FILE_SERVER             0x89FC  /* 252 */\n#define MESSAGE_QUEUE_FULL              0x89FC  /* 252 */\n#define NO_SUCH_OBJECT                  0x89FC  /* 252 */\n#define LOCK_COLLISION                  0x89FD  /* 253 */\n#define BAD_STATION_NUMBER              0x89FD  /* 253 */\n#define INVALID_PACKET_LENGTH           0x89FD  /* 253 */\n#define UNKNOWN_REQUEST                 0x89FD  /* 253 */\n#define BINDERY_LOCKED                  0x89FE  /* 254 */\n#define TRUSTEE_NOT_FOUND               0x89FE  /* 254 */\n#define DIRECTORY_LOCKED                0x89FE  /* 254 */\n#define INVALID_SEMAPHORE_NAME_LENGTH   0x89FE  /* 254 */\n#define PACKET_NOT_DELIVERABLE          0x89FE  /* 254 */\n#define SERVER_BINDERY_LOCKED           0x89FE  /* 254 */\n#define SOCKET_TABLE_FULL               0x89FE  /* 254 */\n#define SPOOL_DIRECTORY_ERROR           0x89FE  /* 254 */\n#define SUPERVISOR_HAS_DISABLED_LOGIN   0x89FE  /* 254 */\n#define TIMEOUT_FAILURE                 0x89FE  /* 254 */\n#define BAD_PRINTER_ERROR               0x89FF  /* 255 */\n#define BAD_RECORD_OFFSET               0x89FF  /* 255 */\n#define CLOSE_FCB_ERROR                 0x89FF  /* 255 */\n#define FILE_EXTENSION_ERROR            0x89FF  /* 255 */\n#define FILE_NAME_ERROR                 0x89FF  /* 255 */\n#define HARDWARE_FAILURE                0x89FF  /* 255 */\n#define INVALID_DRIVE_NUMBER            0x89FF  /* 255 */\n#define DOS_INVALID_DRIVE               0x000F  /* 255 */\n#define INVALID_INITIAL_SEMAPHORE_VALUE 0x89FF  /* 255 */\n#define INVALID_SEMAPHORE_HANDLE        0x89FF  /* 255 */\n#define IO_BOUND_ERROR                  0x89FF  /* 255 */\n#define NO_FILES_FOUND_ERROR            0x89FF  /* 255 */\n#define NO_RESPONSE_FROM_SERVER         0x89FF  /* 255 */\n#define NO_SUCH_OBJECT_OR_BAD_PASSWORD  0x89FF  /* 255 */\n#define PATH_NOT_LOCATABLE              0x89FF  /* 255 */\n#define QUEUE_FULL_ERROR                0x89FF  /* 255 */\n#define REQUEST_NOT_OUTSTANDING         0x89FF  /* 255 */\n#ifndef SOCKET_ALREADY_OPEN\n#define SOCKET_ALREADY_OPEN             0x89FF  /* 255 */\n#endif\n#define LOCK_ERROR                      0x89FF  /* 255 */\n#ifndef FAILURE\n#define FAILURE                         0x89FF  /* 255 Generic Failure */\n#endif\n\n/* #define NOT_SAME_LOCAL_DRIVE         0x89F6 */\n/* #define TARGET_DRIVE_NOT_LOCAL       0x89F7 */\n/* #define ALREADY_ATTACHED_TO_SERVER   0x89F8 */ /* 248 */\n/* #define NOT_ATTACHED_TO_SERVER       0x89F8 */\n\n/**** Network errors ****/\n/* Decimal values at end of line are 32768 lower than actual */\n\n#define NWE_ALREADY_ATTACHED            0x8800  /* 0  - Attach attempted to server with valid, existing connection */\n#define NWE_CONN_INVALID                0x8801  /* 1  - Request attempted with invalid or non-attached connection handle */\n#define NWE_DRIVE_IN_USE                0x8802  /* 2  - OS/2 only (NOT USED) */\n#define NWE_DRIVE_CANNOT_MAP            0x8803  /* 3  - Map drive attempted but unable to add new current directory structure */\n#define NWE_DRIVE_BAD_PATH              0x8804  /* 4  - Map drive attempted with invalid path specification */\n#define NWE_NET_RECEIVE                 0x8805  /* 5  - Attempt to receive from the selected transport failed */\n#define NWE_NET_UNKNOWN                 0x8806  /* 6  - Network send attempted with an un-specific network error */\n#define NWE_SERVER_BAD_SLOT             0x8807  /* 7  - Server request attempted with invalid server connection slot */\n#define NWE_SERVER_NO_SLOTS             0x8808  /* 8  - Attach attempted to server with no connection slots available */\n#define NWE_NET_SEND                    0x8809  /* 9  - Attempt to send on the selected transport failed */\n#define NWE_SERVER_NO_ROUTE             0x880A  /* 10 - Attempted to find route to server where no route exists */\n#define NWE_BAD_LOCAL_TARGET            0x880B  /* 11 - OS/2 only */\n#define NWE_REQ_TOO_MANY_REQ_FRAGS      0x880C  /* 12 - Attempted request with too many request fragments specified */\n#define NWE_CONN_LIST_OVERFLOW          0x880D  /* 13 */\n#define NWE_BUFFER_OVERFLOW             0x880E  /* 14 - Attempt to receive more data than the reply buffer had room for */\n#define NWE_SERVER_NO_CONN              0x880F  /* 15 - Attempt to get connection for a server not connected */\n#define NWE_NO_ROUTER_FOUND             0x8810  /* 16 - OS/2 only */\n#define NWE_FUNCTION_INVALID            0x8811  /* 17 - Attempted function call to non- existent or illegal function */\n#define NWE_SCAN_COMPLETE               0x8812\n#define NWE_UNSUPPORTED_NAME_FORMAT_TYP 0x8813\n#define NWE_HANDLE_ALREADY_LICENSED     0x8814\n#define NWE_HANDLE_ALREADY_UNLICENSED   0x8815\n#define NWE_INVALID_NCP_PACKET_LENGTH   0x8816\n#define NWE_SETTING_UP_TIMEOUT          0x8817\n#define NWE_SETTING_SIGNALS             0x8818\n#define NWE_SERVER_CONNECTION_LOST      0x8819\n#define NWE_OUT_OF_HEAP_SPACE           0x881A\n#define NWE_INVALID_SERVICE_REQUEST     0x881B\n#define NWE_INVALID_TASK_NUMBER         0x881C\n#define NWE_INVALID_MESSAGE_LENGTH      0x881D\n#define NWE_EA_SCAN_DONE                0x881E\n#define NWE_BAD_CONNECTION_NUMBER       0x881F\n#define NWE_MULT_TREES_NOT_SUPPORTED    0x8820  /* 32 - Attempt to open a connection to a DS tree other than the default tree */\n#define NWE_CONN_NOT_SAME               0x8830  /* 48 - Internal server request attempted across different server connections */\n#define NWE_CONN_PRIMARY_NOT_SET        0x8831  /* 49 - Attempt to retrieve default connection with no primary connection set */\n#define NWE_PRN_CAPTURE_NOT_IN_PROGRESS 0x8832  /* 50 - Capture information requested on port with no capture in progress */\n#define NWE_BUFFER_INVALID_LEN          0x8833  /* 51 - Used to indicate length which caller requested on a GetDNC or SetDNC was too large */\n#define NWE_USER_NO_NAME                0x8834  /* 52 */\n#define NWE_PRN_NO_LOCAL_SPOOLER        0x8835  /* 53 - Capture requested without having the local print spooler installed */\n#define NWE_PARAM_INVALID               0x8836  /* 54 - Attempted function with an invalid function parameter specified */\n#define NWE_CFG_OPEN_FAILED             0x8837  /* 55 - OS/2 only */\n#define NWE_CFG_NO_FILE                 0x8838  /* 56 - OS/2 only */\n#define NWE_CFG_READ_FAILED             0x8839  /* 57 - OS/2 only */\n#define NWE_CFG_LINE_TOO_LONG           0x883A  /* 58 - OS/2 only */\n#define NWE_CFG_LINES_IGNORED           0x883B  /* 59 - OS/2 only */\n#define NWE_RESOURCE_NOT_OWNED          0x883C  /* 60 - Attempted request made with a parameter using foriegn resource */\n#define NWE_DAEMON_INSTALLED            0x883D  /* 61 - OS/2 only */\n#define NWE_PRN_SPOOLER_INSTALLED       0x883E  /* 62 - Attempted load of print spooler with print spooler already installed */\n#define NWE_CONN_TABLE_FULL             0x883F  /* 63 - Attempted to allocate a connection handle with no more local connection table entries */\n#define NWE_CFG_SECTION_NOT_FOUND       0x8840  /* 64 - OS/2 only */\n#define NWE_TRAN_INVALID_TYPE           0x8841  /* 65 - Attempted function on a connection with an invalid transport selected */\n#define NWE_TDS_TAG_IN_USE              0x8842  /* 66 - OS/2 only */\n#define NWE_TDS_OUT_OF_MEMORY           0x8843  /* 67 - OS/2 only */\n#define NWE_TDS_INVALID_TAG             0x8844  /* 68 - Attempted TDS function with invalid tag */\n#define NWE_TDS_WRITE_TRUNCATED         0x8845  /* 69 - Attempted TDS write with buffer that exceeded buffer */\n#define NWE_DS_NO_CONN                  0x8846  /* 70 */\n#define NWE_SERVICE_BUSY                0x8846  /* 70 - Attempted request made to partially asynchronous function in busy state */\n#define NWE_SERVER_NOT_FOUND            0x8847  /* 71 - Attempted connect failed to find any servers responding */\n#define NWE_VLM_INVALID                 0x8848  /* 72 - Attempted function call to non-existant or not-loaded overlay */\n#define NWE_DRIVE_ALREADY_MAPPED        0x8849  /* 73 - Attempted map to network drive that was already mapped */\n#define NWE_DRIVE_LOCAL_IN_USE          0x884A  /* 74 - Attempted map to local drive that was in use */\n#define NWE_DRIVE_NONE_AVAILABLE        0x884B  /* 75 - Attempted map to next available drive when none were available */\n#define NWE_DEVICE_NOT_REDIRECTED       0x884C  /* 76 - The device is not redirected */\n#define NWE_FILE_MAX_REACHED            0x884D  /* 77 - Maximum number of files was reached */\n#define NWE_UNLOAD_FAILED               0x884E  /* 78 - Attempted unload failed */\n#define NWE_CONN_IN_USE                 0x884F  /* 79 - Attempted re-use of already in use connection entry */\n#define NWE_REQ_TOO_MANY_REP_FRAGS      0x8850  /* 80 - Attempted request with too many reply fragments specified */\n#define NWE_NAME_TABLE_FULL             0x8851  /* 81 - Attempted to add a name into the name table after it was full */\n#define NWE_SOCKET_NOT_OPEN             0x8852  /* 82 - Listen was posted on unopened socket */\n#define NWE_MEMORY_MGR_ERROR            0x8853  /* 83 - Attempted enhanced memory operation failed */\n#define NWE_SFT3_ERROR                  0x8854  /* 84 - An SFT3 switch occured mid-transfer */\n#define NWE_DS_PREFERRED_NOT_FOUND      0x8855  /* 85 - the preferred directory server was not established but another directory server was returned */\n#define NWE_DEVICE_NOT_RECOGNIZED       0x8856  /* 86 - used to determine if the device is not used by VISE so pass it on to the next redirector, if any. */\n#define NWE_NET_INVALID_TYPE            0x8857  /* 87 - the network type (Bind/NDS) does not match the server version */\n#define NWE_FILE_OPEN_FAILED            0x8858  /* 88 - generic open failure error, invalid path, access denied, etc.. */\n#define NWE_DS_PREFERRED_NOT_SPECIFIED  0x8859  /* 89 - no preferred name specified */\n#define NWE_SOCKET_OPEN_FAILED          0x885A  /* 90 - error opening a socket */\n#define NWE_SIGNATURE_LEVEL_CONFLICT    0x8861\n#define NWE_NO_LOCK_FOUND               0x8862  /* OS/2 - process lock on conn handle failed, process ID not recognized */\n#define NWE_LOCK_TABLE_FULL             0x8863  /* OS/2 - process lock on conn handle failed, process lock table full */\n#define NWE_INVALID_MATCH_DATA          0x8864\n#define NWE_MATCH_FAILED                0x8865\n#define NWE_NO_MORE_ENTRIES             0x8866\n#define NWE_INSUFFICIENT_RESOURCES      0x8867\n#define NWE_STRING_TRANSLATION          0x8868\n#define NWE_ACCESS_VIOLATION            0x8869\n#define NWE_NOT_AUTHENTICATED           0x886A\n#define NWE_INVALID_LEVEL               0x886B\n#define NWE_RESOURCE_LOCK               0x886C\n#define NWE_INVALID_NAME_FORMAT         0x886D\n#define NWE_OBJECT_EXISTS               0x886E\n#define NWE_OBJECT_NOT_FOUND            0x886F\n#define NWE_UNSUPPORTED_TRAN_TYPE       0x8870\n#define NWE_INVALID_STRING_TYPE         0x8871\n#define NWE_INVALID_OWNER               0x8872\n#define NWE_UNSUPPORTED_AUTHENTICATOR   0x8873\n#define NWE_IO_PENDING                  0x8874\n#define NWE_INVALID_DRIVE_NUMBER        0x8875\n#define NWE_REPLY_TRUNCATED            0x88e6    /* 230 NLM */\n#define NWE_REQUESTER_FAILURE           0x88FF\n\n/* Server Errors */\n\n#define NWE_INSUFFICIENT_SPACE          0x8901  /* 001 */\n#define NWE_BUFFER_TOO_SMALL            0x8977  /* 119 */\n#define NWE_VOL_FLAG_NOT_SET            0x8978  /* 120 the service requested, not avail. on the selected vol. */\n#define NWE_NO_ITEMS_FOUND              0x8979  /* 121 */\n#define NWE_CONN_ALREADY_TEMP           0x897a  /* 122 */\n#define NWE_CONN_ALREADY_LOGGED_IN      0x897b  /* 123 */\n#define NWE_CONN_NOT_AUTHENTICATED      0x897c  /* 124 */\n#define NWE_CONN_NOT_LOGGED_IN          0x897d  /* 125 */\n#define NWE_NCP_BOUNDARY_CHECK_FAILED   0x897e  /* 126 */\n#define NWE_LOCK_WAITING                0x897f  /* 127 */\n#define NWE_LOCK_FAIL                   0x8980  /* 128 */\n#define NWE_FILE_IN_USE                 0x8980  /* 128 */\n#define NWE_FILE_NO_HANDLES             0x8981  /* 129 */\n#define NWE_FILE_NO_OPEN_PRIV           0x8982  /* 130 */\n#define NWE_DISK_IO_ERROR               0x8983  /* 131 */\n#define NWE_AUDITING_HARD_IO_ERROR      0x8983  /* 131 */\n#define NWE_FILE_NO_CREATE_PRIV         0x8984  /* 132 */\n#define NWE_AUDITING_NOT_SUPV           0x8984  /* 132 */\n#define NWE_FILE_NO_CREATE_DEL_PRIV     0x8985  /* 133 */\n#define NWE_FILE_EXISTS_READ_ONLY       0x8986  /* 134 */\n#define NWE_FILE_WILD_CARDS_IN_NAME     0x8987  /* 135 */\n#define NWE_FILE_INVALID_HANDLE         0x8988  /* 136 */\n#define NWE_FILE_NO_SRCH_PRIV           0x8989  /* 137 */\n#define NWE_FILE_NO_DEL_PRIV            0x898A  /* 138 */\n#define NWE_FILE_NO_RENAME_PRIV         0x898B  /* 139 */\n#define NWE_FILE_NO_MOD_PRIV            0x898C  /* 140 */\n#define NWE_FILE_SOME_IN_USE            0x898D  /* 141 */\n#define NWE_FILE_NONE_IN_USE            0x898E  /* 142 */\n#define NWE_FILE_SOME_READ_ONLY         0x898F  /* 143 */\n#define NWE_FILE_NONE_READ_ONLY         0x8990  /* 144 */\n#define NWE_FILE_SOME_RENAMED_EXIST     0x8991  /* 145 */\n#define NWE_FILE_NONE_RENAMED_EXIST     0x8992  /* 146 */\n#define NWE_FILE_NO_READ_PRIV           0x8993  /* 147 */\n#define NWE_FILE_NO_WRITE_PRIV          0x8994  /* 148 */\n#define NWE_FILE_READ_ONLY              0x8994  /* 148 */\n#define NWE_FILE_DETACHED               0x8995  /* 149 */\n#define NWE_SERVER_OUT_OF_MEMORY        0x8996  /* 150 */\n#define NWE_DIR_TARGET_INVALID          0x8996  /* 150 */\n#define NWE_DISK_NO_SPOOL_SPACE         0x8997  /* 151 */\n#define NWE_AUDITING_NOT_ENABLED        0x8997  /* 151 */\n#define NWE_VOL_INVALID                 0x8998  /* 152 */\n#define NWE_DIR_FULL                    0x8999  /* 153 */\n#define NWE_VOL_RENAMING_ACROSS         0x899A  /* 154 */\n#define NWE_DIRHANDLE_INVALID           0x899B  /* 155 */\n#define NWE_PATH_INVALID                0x899C  /* 156 */\n#define NWE_TRUSTEES_NO_MORE            0x899C  /* 156 */\n#define NWE_DIRHANDLE_NO_MORE           0x899D  /* 157 */\n#define NWE_FILE_NAME_INVALID           0x899E  /* 158 */\n#define NWE_DIR_ACTIVE                  0x899F  /* 159 */\n#define NWE_DIR_NOT_EMPTY               0x89A0  /* 160 */\n#define NWE_DIR_IO_ERROR                0x89A1  /* 161 */\n#define NWE_FILE_IO_LOCKED              0x89A2  /* 162 */\n#define NWE_TTS_RANSACTION_RESTARTED    0x89A3  /* 163 */\n#define NWE_TTS_TRANSACTION_RESTARTED   0x89A3  /* 163 */\n#define NWE_DIR_RENAME_INVALID          0x89A4  /* 164 */\n#define NWE_FILE_OPENCREAT_MODE_INVALID 0x89A5  /* 165 */\n#define NWE_ALREADY_IN_USE              0x89A6  /* 166 */\n#define NWE_AUDITING_ACTIVE             0x89A6  /* 166 */\n#define NWE_RESOURCE_TAG_INVALID        0x89A7  /* 167 */\n#define NWE_ACCESS_DENIED               0x89A8  /* 168 */\n#define NWE_AUDITING_NO_RIGHTS          0x89A8  /* 168 */\n#define NWE_DATA_STREAM_INVALID         0x89BE  /* 190 */\n#define NWE_NAME_SPACE_INVALID          0x89BF  /* 191 */\n#define NWE_ACCTING_NO_PRIV             0x89C0  /* 192 */\n#define NWE_ACCTING_NO_BALANCE          0x89C1  /* 193 */\n#define NWE_ACCTING_NO_CREDIT           0x89C2  /* 194 */\n#define NWE_AUDITING_RECORD_SIZE        0x89C2  /* 194 */\n#define NWE_ACCTING_TOO_MANY_HOLDS      0x89C3  /* 195 */\n#define NWE_ACCTING_DISABLED            0x89C4  /* 196 */\n#define NWE_LOGIN_LOCKOUT               0x89C5  /* 197 */\n#define NWE_CONSOLE_NO_PRIV             0x89C6  /* 198 */\n#define NWE_Q_IO_FAILURE                0x89D0  /* 208 */\n#define NWE_Q_NONE                      0x89D1  /* 209 */\n#define NWE_Q_NO_SERVER                 0x89D2  /* 210 */\n#define NWE_Q_NO_RIGHTS                 0x89D3  /* 211 */\n#define NWE_Q_FULL                      0x89D4  /* 212 */\n#define NWE_Q_NO_JOB                    0x89D5  /* 213 */\n#define NWE_Q_NO_JOB_RIGHTS             0x89D6  /* 214 */\n#define NWE_PASSWORD_UNENCRYPTED        0x89D6  /* 214 */\n#define NWE_Q_IN_SERVICE                0x89D7  /* 215 */\n#define NWE_PASSWORD_NOT_UNIQUE         0x89D7  /* 215 */\n#define NWE_Q_NOT_ACTIVE                0x89D8  /* 216 */\n#define NWE_PASSWORD_TOO_SHORT          0x89D8  /* 216 */\n#define NWE_Q_STN_NOT_SERVER            0x89D9  /* 217 */\n#define NWE_LOGIN_NO_CONN               0x89D9  /* 217 */\n#define NWE_LOGIN_MAX_EXCEEDED          0x89D9  /* 217 */\n#define NWE_Q_HALTED                    0x89DA  /* 218 */\n#define NWE_LOGIN_UNAUTHORIZED_TIME     0x89DA  /* 218 */\n#define NWE_LOGIN_UNAUTHORIZED_STATION  0x89DB  /* 219 */\n#define NWE_Q_MAX_SERVERS               0x89DB  /* 219 */\n#define NWE_ACCT_DISABLED               0x89DC  /* 220 */\n#define NWE_PASSWORD_INVALID            0x89DE  /* 222 */\n#define NWE_PASSWORD_EXPIRED            0x89DF  /* 223 */\n#define NWE_LOGIN_NO_CONN_AVAIL         0x89E0  /* 224 */\n#define NWE_E_NO_MORE_USERS             0x89E7  /* 231 */\n#define NWE_BIND_NOT_ITEM_PROP          0x89E8  /* 232 */\n#define NWE_BIND_WRITE_TO_GROUP_PROP    0x89E8  /* 232 */\n#define NWE_BIND_MEMBER_ALREADY_EXISTS  0x89E9  /* 233 */\n#define NWE_BIND_NO_SUCH_MEMBER         0x89EA  /* 234 */\n#define NWE_BIND_NOT_GROUP_PROP         0x89EB  /* 235 */\n#define NWE_BIND_NO_SUCH_SEGMENT        0x89EC  /* 236 */\n#define NWE_BIND_PROP_ALREADY_EXISTS    0x89ED  /* 237 */\n#define NWE_BIND_OBJ_ALREADY_EXISTS     0x89EE  /* 238 */\n#define NWE_BIND_NAME_INVALID           0x89EF  /* 239 */\n#define NWE_BIND_WILDCARD_INVALID       0x89F0  /* 240 */\n#define NWE_BIND_SECURITY_INVALID       0x89F1  /* 241 */\n#define NWE_BIND_OBJ_NO_READ_PRIV       0x89F2  /* 242 */\n#define NWE_BIND_OBJ_NO_RENAME_PRIV     0x89F3  /* 243 */\n#define NWE_BIND_OBJ_NO_DELETE_PRIV     0x89F4  /* 244 */\n#define NWE_BIND_OBJ_NO_CREATE_PRIV     0x89F5  /* 245 */\n#define NWE_BIND_PROP_NO_DELETE_PRIV    0x89F6  /* 246 */\n#define NWE_BIND_PROP_NO_CREATE_PRIV    0x89F7  /* 247 */\n#define NWE_BIND_PROP_NO_WRITE_PRIV     0x89F8  /* 248 */\n#define NWE_BIND_PROP_NO_READ_PRIV      0x89F9  /* 249 */\n#define NWE_NO_FREE_CONN_SLOTS          0x89F9  /* 249 */\n#define NWE_NO_MORE_SERVER_SLOTS        0x89FA  /* 250 */\n#define NWE_TEMP_REMAP_ERROR            0x89FA  /* 250 */\n#define NWE_PARAMETERS_INVALID          0x89FB  /* 251 */\n#define NWE_BIND_NO_SUCH_PROP           0x89FB  /* 251 */\n#define NWE_NCP_NOT_SUPPORTED           0x89FB  /* 251 */\n#define NWE_INET_PACKET_REQ_CANCELED    0x89FC  /* 252 */\n#define NWE_SERVER_UNKNOWN              0x89FC  /* 252 */\n#define NWE_MSG_Q_FULL                  0x89FC  /* 252 */\n#define NWE_BIND_NO_SUCH_OBJ            0x89FC  /* 252 */\n#define NWE_LOCK_COLLISION              0x89FD  /* 253 */\n#define NWE_CONN_NUM_INVALID            0x89FD  /* 253 */\n#define NWE_PACKET_LEN_INVALID          0x89FD  /* 253 */\n#define NWE_UNKNOWN_REQ                 0x89FD  /* 253 */\n#define NWE_BIND_LOCKED                 0x89FE  /* 254 */\n#define NWE_TRUSTEE_NOT_FOUND           0x89FE  /* 254 */\n#define NWE_DIR_LOCKED                  0x89FE  /* 254 */\n#define NWE_SEM_INVALID_NAME_LEN        0x89FE  /* 254 */\n#define NWE_PACKET_NOT_DELIVERABLE      0x89FE  /* 254 */\n#define NWE_SOCKET_TABLE_FULL           0x89FE  /* 254 */\n#define NWE_SPOOL_DIR_ERROR             0x89FE  /* 254 */\n#define NWE_LOGIN_DISABLED_BY_SUPER     0x89FE  /* 254 */\n#define NWE_TIMEOUT_FAILURE             0x89FE  /* 254 */\n#define NWE_FILE_EXT                    0x89FF  /* 255 */\n#define NWE_FILE_NAME                   0x89FF  /* 255 */\n#define NWE_HARD_FAILURE                0x89FF  /* 255 */\n#define NWE_FCB_CLOSE                   0x89FF  /* 255 */\n#define NWE_IO_BOUND                    0x89FF  /* 255 */\n#define NWE_BAD_SPOOL_PRINTER           0x89FF  /* 255 */\n#define NWE_BAD_RECORD_OFFSET           0x89FF  /* 255 */\n#define NWE_DRIVE_INVALID_NUM           0x89FF  /* 255 */\n#define NWE_SEM_INVALID_INIT_VAL        0x89FF  /* 255 */\n#define NWE_SEM_INVALID_HANDLE          0x89FF  /* 255 */\n#define NWE_NO_FILES_FOUND_ERROR        0x89FF  /* 255 */\n#define NWE_NO_RESPONSE_FROM_SERVER     0x89FF  /* 255 */\n#define NWE_NO_OBJ_OR_BAD_PASSWORD      0x89FF  /* 255 */\n#define NWE_PATH_NOT_LOCATABLE          0x89FF  /* 255 */\n#define NWE_Q_FULL_ERROR                0x89FF  /* 255 */\n#define NWE_REQ_NOT_OUTSTANDING         0x89FF  /* 255 */\n#define NWE_SOCKET_ALREADY_OPEN         0x89FF  /* 255 */\n#define NWE_LOCK_ERROR                  0x89FF  /* 255 */\n#define NWE_FAILURE                     0x89FF  /* 255 Generic Failure */\n\n#endif /* !_NWERROR_H_ */\n"
  },
  {
    "path": "freebsd-headers/netsmb/netbios.h",
    "content": "/*-\n * Copyright (c) 2000-2001 Boris Popov\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/netsmb/netbios.h 206361 2010-04-07 16:50:38Z joel $\n */\n#ifndef _NETSMB_NETBIOS_H_\n#define\t_NETSMB_NETBIOS_H_\n\n/*\n * make this file dirty...\n */\n#ifndef _NETINET_IN_H_\n#include <netinet/in.h>\n#endif\n\n#ifndef _NETIPX_IPX_H_\n#include <netipx/ipx.h>\n#endif\n\n#define\tNMB_TCP_PORT\t137\n\n#define\tNBPROTO_TCPSSN\t1\t\t/* NETBIOS session over TCP */\n#define\tNBPROTO_IPXSSN\t11\t\t/* NETBIOS over IPX */\n\n#define NB_NAMELEN\t16\n#define\tNB_ENCNAMELEN\tNB_NAMELEN * 2\n#define\tNB_MAXLABLEN\t63\n\n#define\tNB_MINSALEN\t(sizeof(struct sockaddr_nb))\n\n/*\n * name types\n */\n#define\tNBT_WKSTA\t\t0x00\n#define\tNBT_MESSENGER\t\t0x03\n#define\tNBT_RAS_SERVER\t\t0x06\n#define\tNBT_DOMAIN_MASTER_BROWSER\t0x1B\n#define\tNBT_DOMAIN_CONTROLLER\t0x1C\n#define\tNBT_MASTER_BROWSER\t0x1D\n#define\tNBT_NETDDE\t\t0x1F\n#define\tNBT_SERVER\t\t0x20\n#define\tNBT_RAS_CLIENT\t\t0x21\n\n/*\n * Session packet types\n */\n#define\tNB_SSN_MESSAGE\t\t0x0\n#define\tNB_SSN_REQUEST\t\t0x81\n#define\tNB_SSN_POSRESP\t\t0x82\n#define\tNB_SSN_NEGRESP\t\t0x83\n#define\tNB_SSN_RTGRESP\t\t0x84\n#define\tNB_SSN_KEEPALIVE\t0x85\n\n/*\n * resolver: Opcodes\n */\n#define\tNBNS_OPCODE_QUERY\t0x00\n#define\tNBNS_OPCODE_REGISTER\t0x05\n#define\tNBNS_OPCODE_RELEASE\t0x06\n#define\tNBNS_OPCODE_WACK\t0x07\n#define\tNBNS_OPCODE_REFRESH\t0x08\n#define\tNBNS_OPCODE_RESPONSE\t0x10\t/* or'ed with other opcodes */\n\n/*\n * resolver: NM_FLAGS\n */\n#define\tNBNS_NMFLAG_BCAST\t0x01\n#define\tNBNS_NMFLAG_RA\t\t0x08\t/* recursion available */\n#define\tNBNS_NMFLAG_RD\t\t0x10\t/* recursion desired */\n#define\tNBNS_NMFLAG_TC\t\t0x20\t/* truncation occurred */\n#define\tNBNS_NMFLAG_AA\t\t0x40\t/* authoritative answer */\n\n/* \n * resolver: Question types\n */\n#define\tNBNS_QUESTION_TYPE_NB\t\t0x0020\n#define NBNS_QUESTION_TYPE_NBSTAT\t0x0021\n\n/* \n * resolver: Question class \n */\n#define NBNS_QUESTION_CLASS_IN\t0x0001\n\n/*\n * resolver: Limits\n */\n#define\tNBNS_MAXREDIRECTS\t3\t/* maximum number of accepted redirects */\n#define\tNBDG_MAXSIZE\t\t576\t/* maximum nbns datagram size */\n\n/*\n * NETBIOS addressing\n */\nunion nb_tran {\n\tstruct sockaddr_in\tx_in;\n\tstruct sockaddr_ipx\tx_ipx;\n};\n\nstruct nb_name {\n\tu_int\t\tnn_type;\n\tu_char\t\tnn_name[NB_NAMELEN + 1];\n\tu_char *\tnn_scope;\n};\n\n/*\n * Socket address\n */\nstruct sockaddr_nb {\n\tu_char\t\tsnb_len;\n\tu_char\t\tsnb_family;\n\tunion nb_tran\tsnb_tran;\t\t/* transport */\n\tu_char\t\tsnb_name[1 + NB_ENCNAMELEN + 1];\t/* encoded */\n};\n\n#define\tsnb_addrin\tsnb_tran.x_in\n\n#endif /* !_NETSMB_NETBIOS_H_ */\n"
  },
  {
    "path": "freebsd-headers/netsmb/smb.h",
    "content": "/*-\n * Copyright (c) 2000-2001 Boris Popov\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/netsmb/smb.h 206361 2010-04-07 16:50:38Z joel $\n */\n\n/*\n * Common definitions and structures for SMB/CIFS protocol\n */\n \n#ifndef _NETSMB_SMB_H_\n#define _NETSMB_SMB_H_\n\n#define\tSMB_TCP_PORT\t139\n/*\n * SMB dialects that we have to deal with.\n */\nenum smb_dialects { \n\tSMB_DIALECT_NONE,\n\tSMB_DIALECT_CORE,\t\t/* PC NETWORK PROGRAM 1.0, PCLAN1.0 */\n\tSMB_DIALECT_COREPLUS,\t\t/* MICROSOFT NETWORKS 1.03 */\n\tSMB_DIALECT_LANMAN1_0,\t\t/* MICROSOFT NETWORKS 3.0, LANMAN1.0 */\n\tSMB_DIALECT_LANMAN2_0,\t\t/* LM1.2X002, DOS LM1.2X002, Samba */\n\tSMB_DIALECT_LANMAN2_1,\t\t/* DOS LANMAN2.1, LANMAN2.1 */\n\tSMB_DIALECT_NTLM0_12\t\t/* NT LM 0.12, Windows for Workgroups 3.1a,\n\t\t\t\t\t * NT LANMAN 1.0 */\n};\n\n/*\n * Formats of data/string buffers\n */\n#define\tSMB_DT_DATA\t\t1\n#define\tSMB_DT_DIALECT\t\t2\n#define\tSMB_DT_PATHNAME\t\t3\n#define\tSMB_DT_ASCII\t\t4\n#define\tSMB_DT_VARIABLE\t\t5\n\n/*\n * SMB header\n */\n#define\tSMB_SIGNATURE\t\t\"\\xFFSMB\"\n#define\tSMB_SIGLEN\t\t4\n#define\tSMB_HDRMID(p)\t\t(le16toh(*(u_short*)((u_char*)(p) + 30)))\n#define\tSMB_HDRLEN\t\t32\n/*\n * bits in the smb_flags field\n */\n#define\tSMB_FLAGS_CASELESS\t0x08\n#define SMB_FLAGS_SERVER_RESP\t0x80\t/* indicates a response */\n\n/*\n * bits in the smb_flags2 field\n */\n#define\tSMB_FLAGS2_KNOWS_LONG_NAMES\t0x0001\n#define\tSMB_FLAGS2_KNOWS_EAS\t\t0x0002\t/* client know about EAs */\n#define\tSMB_FLAGS2_SECURITY_SIGNATURE\t0x0004\t/* check SMB integrity */\n#define\tSMB_FLAGS2_IS_LONG_NAME\t\t0x0040\t/* any path name is a long name */\n#define\tSMB_FLAGS2_EXT_SEC\t\t0x0800\t/* client aware of Extended\n\t\t\t\t\t\t * Security negotiation */\n#define\tSMB_FLAGS2_DFS\t\t\t0x1000\t/* resolve paths in DFS */\n#define\tSMB_FLAGS2_PAGING_IO\t\t0x2000\t/* for exec */\n#define\tSMB_FLAGS2_ERR_STATUS\t\t0x4000\t/* 1 - status.status */\n#define\tSMB_FLAGS2_UNICODE\t\t0x8000\t/* use Unicode for all strings */\n\n#define\tSMB_UID_UNKNOWN\t\t0xffff\n#define\tSMB_TID_UNKNOWN\t\t0xffff\n\n/*\n * Security mode bits\n */\n#define SMB_SM_USER\t\t0x01\t\t/* server in the user security mode */\n#define\tSMB_SM_ENCRYPT\t\t0x02\t\t/* use challenge/response */\n#define\tSMB_SM_SIGS\t\t0x04\n#define\tSMB_SM_SIGS_REQUIRE\t0x08\n\n/*\n * NTLM capabilities\n */\n#define\tSMB_CAP_RAW_MODE\t\t0x0001\n#define\tSMB_CAP_MPX_MODE\t\t0x0002\n#define\tSMB_CAP_UNICODE\t\t\t0x0004\n#define\tSMB_CAP_LARGE_FILES\t\t0x0008\t\t/* 64 bit offsets supported */\n#define\tSMB_CAP_NT_SMBS\t\t\t0x0010\n#define\tSMB_CAP_RPC_REMOTE_APIS\t\t0x0020\n#define\tSMB_CAP_STATUS32\t\t0x0040\n#define\tSMB_CAP_LEVEL_II_OPLOCKS\t0x0080\n#define\tSMB_CAP_LOCK_AND_READ\t\t0x0100\n#define\tSMB_CAP_NT_FIND\t\t\t0x0200\n#define\tSMB_CAP_DFS\t\t\t0x1000\n#define\tSMB_CAP_INFOLEVEL_PASSTHRU\t0x2000\n#define\tSMB_CAP_LARGE_READX\t\t0x4000\n#define\tSMB_CAP_LARGE_WRITEX\t\t0x8000\n#define\tSMB_CAP_UNIX\t\t\t0x00800000\n#define\tSMB_CAP_BULK_TRANSFER\t\t0x20000000\n#define\tSMB_CAP_COMPRESSED_DATA\t\t0x40000000\n#define\tSMB_CAP_EXT_SECURITY\t\t0x80000000\n\n/*\n * File attributes\n */\n#define\tSMB_FA_RDONLY\t\t0x01\n#define\tSMB_FA_HIDDEN\t\t0x02\n#define\tSMB_FA_SYSTEM\t\t0x04\n#define\tSMB_FA_VOLUME\t\t0x08\n#define\tSMB_FA_DIR\t\t0x10\n#define\tSMB_FA_ARCHIVE\t\t0x20\n\n/*\n * Extended file attributes\n */\n#define\tSMB_EFA_RDONLY\t\t0x0001\n#define\tSMB_EFA_HIDDEN\t\t0x0002\n#define\tSMB_EFA_SYSTEM\t\t0x0004\n#define\tSMB_EFA_DIRECTORY\t0x0010\n#define\tSMB_EFA_ARCHIVE\t\t0x0020\n#define\tSMB_EFA_NORMAL\t\t0x0080\n#define\tSMB_EFA_TEMPORARY\t0x0100\n#define\tSMB_EFA_COMPRESSED\t0x0800\n#define\tSMB_EFA_POSIX_SEMANTICS\t0x01000000\n#define\tSMB_EFA_BACKUP_SEMANTICS 0x02000000\n#define\tSMB_EFA_DELETE_ON_CLOSE\t0x04000000\n#define\tSMB_EFA_SEQUENTIAL_SCAN\t0x08000000\n#define\tSMB_EFA_RANDOM_ACCESS\t0x10000000\n#define\tSMB_EFA_NO_BUFFERING\t0x20000000\n#define\tSMB_EFA_WRITE_THROUGH\t0x80000000\n\n/*\n * Access Mode Encoding\n */\n#define\tSMB_AM_OPENREAD\t\t0x0000\n#define\tSMB_AM_OPENWRITE\t0x0001\n#define\tSMB_AM_OPENRW\t\t0x0002\n#define\tSMB_AM_OPENEXEC\t\t0x0003\n#define\tSMB_SM_COMPAT\t\t0x0000\n#define\tSMB_SM_EXCLUSIVE\t0x0010\n#define\tSMB_SM_DENYWRITE\t0x0020\n#define\tSMB_SM_DENYREADEXEC\t0x0030\n#define\tSMB_SM_DENYNONE\t\t0x0040\n\n/*\n * SMB commands\n */\n#define\tSMB_COM_CREATE_DIRECTORY        0x00\n#define\tSMB_COM_DELETE_DIRECTORY        0x01\n#define\tSMB_COM_OPEN                    0x02\n#define\tSMB_COM_CREATE                  0x03\n#define\tSMB_COM_CLOSE                   0x04\n#define\tSMB_COM_FLUSH                   0x05\n#define\tSMB_COM_DELETE                  0x06\n#define\tSMB_COM_RENAME                  0x07\n#define\tSMB_COM_QUERY_INFORMATION       0x08\n#define\tSMB_COM_SET_INFORMATION         0x09\n#define\tSMB_COM_READ                    0x0A\n#define\tSMB_COM_WRITE                   0x0B\n#define\tSMB_COM_LOCK_BYTE_RANGE         0x0C\n#define\tSMB_COM_UNLOCK_BYTE_RANGE       0x0D\n#define\tSMB_COM_CREATE_TEMPORARY        0x0E\n#define\tSMB_COM_CREATE_NEW              0x0F\n#define\tSMB_COM_CHECK_DIRECTORY         0x10\n#define\tSMB_COM_PROCESS_EXIT            0x11\n#define\tSMB_COM_SEEK                    0x12\n#define\tSMB_COM_LOCK_AND_READ           0x13\n#define\tSMB_COM_WRITE_AND_UNLOCK        0x14\n#define\tSMB_COM_READ_RAW                0x1A\n#define\tSMB_COM_READ_MPX                0x1B\n#define\tSMB_COM_READ_MPX_SECONDARY      0x1C\n#define\tSMB_COM_WRITE_RAW               0x1D\n#define\tSMB_COM_WRITE_MPX               0x1E\n#define\tSMB_COM_WRITE_COMPLETE          0x20\n#define\tSMB_COM_SET_INFORMATION2        0x22\n#define\tSMB_COM_QUERY_INFORMATION2      0x23\n#define\tSMB_COM_LOCKING_ANDX            0x24\n#define\tSMB_COM_TRANSACTION             0x25\n#define\tSMB_COM_TRANSACTION_SECONDARY   0x26\n#define\tSMB_COM_IOCTL                   0x27\n#define\tSMB_COM_IOCTL_SECONDARY         0x28\n#define\tSMB_COM_COPY                    0x29\n#define\tSMB_COM_MOVE                    0x2A\n#define\tSMB_COM_ECHO                    0x2B\n#define\tSMB_COM_WRITE_AND_CLOSE         0x2C\n#define\tSMB_COM_OPEN_ANDX               0x2D\n#define\tSMB_COM_READ_ANDX               0x2E\n#define\tSMB_COM_WRITE_ANDX              0x2F\n#define\tSMB_COM_CLOSE_AND_TREE_DISC     0x31\n#define\tSMB_COM_TRANSACTION2            0x32\n#define\tSMB_COM_TRANSACTION2_SECONDARY  0x33\n#define\tSMB_COM_FIND_CLOSE2             0x34\n#define\tSMB_COM_FIND_NOTIFY_CLOSE       0x35\n#define\tSMB_COM_TREE_CONNECT\t\t0x70\n#define\tSMB_COM_TREE_DISCONNECT         0x71\n#define\tSMB_COM_NEGOTIATE               0x72\n#define\tSMB_COM_SESSION_SETUP_ANDX      0x73\n#define\tSMB_COM_LOGOFF_ANDX             0x74\n#define\tSMB_COM_TREE_CONNECT_ANDX       0x75\n#define\tSMB_COM_QUERY_INFORMATION_DISK  0x80\n#define\tSMB_COM_SEARCH                  0x81\n#define\tSMB_COM_FIND                    0x82\n#define\tSMB_COM_FIND_UNIQUE             0x83\n#define\tSMB_COM_NT_TRANSACT             0xA0\n#define\tSMB_COM_NT_TRANSACT_SECONDARY   0xA1\n#define\tSMB_COM_NT_CREATE_ANDX          0xA2\n#define\tSMB_COM_NT_CANCEL               0xA4\n#define\tSMB_COM_OPEN_PRINT_FILE         0xC0\n#define\tSMB_COM_WRITE_PRINT_FILE        0xC1\n#define\tSMB_COM_CLOSE_PRINT_FILE        0xC2\n#define\tSMB_COM_GET_PRINT_QUEUE         0xC3\n#define\tSMB_COM_READ_BULK               0xD8\n#define\tSMB_COM_WRITE_BULK              0xD9\n#define\tSMB_COM_WRITE_BULK_DATA         0xDA\n\n/*\n * TRANS2 commands\n */\n#define\tSMB_TRANS2_OPEN2\t\t\t0x00\n#define\tSMB_TRANS2_FIND_FIRST2\t\t\t0x01\n#define\tSMB_TRANS2_FIND_NEXT2\t\t\t0x02\n#define\tSMB_TRANS2_QUERY_FS_INFORMATION\t\t0x03\n#define\tSMB_TRANS2_QUERY_PATH_INFORMATION\t0x05\n#define\tSMB_TRANS2_SET_PATH_INFORMATION\t\t0x06\n#define\tSMB_TRANS2_QUERY_FILE_INFORMATION\t0x07\n#define\tSMB_TRANS2_SET_FILE_INFORMATION\t\t0x08\n#define\tSMB_TRANS2_FSCTL\t\t\t0x09\n#define\tSMB_TRANS2_IOCTL2\t\t\t0x0A\n#define\tSMB_TRANS2_FIND_NOTIFY_FIRST\t\t0x0B\n#define\tSMB_TRANS2_FIND_NOTIFY_NEXT\t\t0x0C\n#define\tSMB_TRANS2_CREATE_DIRECTORY\t\t0x0D\n#define\tSMB_TRANS2_SESSION_SETUP\t\t0x0E\n#define\tSMB_TRANS2_GET_DFS_REFERRAL\t\t0x10\n#define\tSMB_TRANS2_REPORT_DFS_INCONSISTENCY\t0x11\n\n/*\n * SMB_TRANS2_QUERY_FS_INFORMATION levels\n */\n#define SMB_INFO_ALLOCATION\t\t1\n#define SMB_INFO_VOLUME\t\t\t2\n#define SMB_QUERY_FS_VOLUME_INFO\t0x102\n#define SMB_QUERY_FS_SIZE_INFO\t\t0x103\n#define SMB_QUERY_FS_DEVICE_INFO\t0x104\n#define SMB_QUERY_FS_ATTRIBUTE_INFO\t0x105\n\n/*\n * SMB_TRANS2_QUERY_PATH levels\n */\n#define\tSMB_QUERY_FILE_STANDARD\t\t\t1\n#define\tSMB_QUERY_FILE_EA_SIZE\t\t\t2\n#define\tSMB_QUERY_FILE_EAS_FROM_LIST\t\t3\n#define\tSMB_QUERY_FILE_ALL_EAS\t\t\t4\n#define\tSMB_QUERY_FILE_IS_NAME_VALID\t\t6\n#define\tSMB_QUERY_FILE_BASIC_INFO\t\t0x101\n#define\tSMB_QUERY_FILE_STANDARD_INFO\t\t0x102\n#define\tSMB_QUERY_FILE_EA_INFO\t\t\t0x103\n#define\tSMB_QUERY_FILE_NAME_INFO\t\t0x104\n#define\tSMB_QUERY_FILE_ALL_INFO\t\t\t0x107\n#define\tSMB_QUERY_FILE_ALT_NAME_INFO\t\t0x108\n#define\tSMB_QUERY_FILE_STREAM_INFO\t\t0x109\n#define\tSMB_QUERY_FILE_COMPRESSION_INFO\t\t0x10b\n#define\tSMB_QUERY_FILE_UNIX_BASIC\t\t0x200\n#define\tSMB_QUERY_FILE_UNIX_LINK\t\t0x201\n#define\tSMB_QUERY_FILE_MAC_DT_GET_APPL\t\t0x306\n#define\tSMB_QUERY_FILE_MAC_DT_GET_ICON\t\t0x307\n#define\tSMB_QUERY_FILE_MAC_DT_GET_ICON_INFO\t0x308\n\n/*\n * SMB_TRANS2_FIND_FIRST2 information levels\n */\n#define SMB_INFO_STANDARD\t\t1\n#define SMB_INFO_QUERY_EA_SIZE\t\t2\n#define SMB_INFO_QUERY_EAS_FROM_LIST\t3\n#define SMB_FIND_FILE_DIRECTORY_INFO\t0x101\n#define SMB_FIND_FULL_DIRECTORY_INFO\t0x102\n#define SMB_FIND_FILE_NAMES_INFO\t0x103\n#define SMB_FIND_BOTH_DIRECTORY_INFO\t0x104\n\n/*\n * Set PATH/FILE information levels\n */\n#define\tSMB_SET_FILE_BASIC_INFO\t\t0x101\n#define\tSMB_SET_FILE_END_OF_FILE_INFO\t0x104\n\n/*\n * LOCKING_ANDX LockType flags\n */\n#define SMB_LOCKING_ANDX_SHARED_LOCK\t0x01\n#define SMB_LOCKING_ANDX_OPLOCK_RELEASE\t0x02\n#define SMB_LOCKING_ANDX_CHANGE_LOCKTYPE 0x04\n#define SMB_LOCKING_ANDX_CANCEL_LOCK\t0x08\n#define SMB_LOCKING_ANDX_LARGE_FILES\t0x10\n\n/*\n * Some names length limitations. Some of them aren't declared by specs,\n * but we need reasonable limits.\n */\n#define SMB_MAXSRVNAMELEN\t15\t/* NetBIOS limit */\n#define SMB_MAXUSERNAMELEN\t128\n#define SMB_MAXPASSWORDLEN\t128\n#define\tSMB_MAXSHARENAMELEN\t128\n#define\tSMB_MAXPKTLEN\t\t0x1FFFF\n#define\tSMB_MAXCHALLENGELEN\t8\n#define\tSMB_MAXFNAMELEN\t\t255\t/* Keep in sync with MAXNAMLEN */\n\n#define\tSMB_MAXRCN\t\t3\t/* number of reconnect attempts */\n\n/*\n * Error classes\n */\n#define SMBSUCCESS\t0x00\n#define ERRDOS\t\t0x01\n#define ERRSRV\t\t0x02\n#define ERRHRD\t\t0x03\t/* Error is a hardware error. */\n#define ERRCMD\t\t0xFF\t/* Command was not in the \"SMB\" format. */\n\n/*\n * Error codes for the ERRDOS class\n */\n#define ERRbadfunc\t1\t/* Invalid function */\n#define ERRbadfile\t2\t/* File not found (last component) */\n#define ERRbadpath\t3\t/* Directory invalid */\n#define ERRnofids\t4\t/* Too many open files */\n#define ERRnoaccess\t5\t/* Access denied */\n#define ERRbadfid\t6\t/* Invalid file handle */\n#define ERRbadmcb\t7\t/* Memory control blocks destroyed (huh ?) */\n#define ERRnomem\t8\t/* Insufficient memory */\n#define ERRbadmem\t9\t/* Invalid memory block address */\n#define ERRbadenv\t10\t/* Invalid environment */\n#define ERRbadformat\t11\t/* Invalid format */\n#define ERRbadaccess\t12\t/* Invalid open mode */\n#define ERRbaddata\t13\t/* Invalid data */\n#define ERRbaddrive\t15\t/* Invalid drive specified */\n#define ERRremcd\t16\t/* An attempt to delete current directory */\n#define ERRdiffdevice\t17\t/* cross fs rename/move */\n#define ERRnofiles\t18\t/* no more files found in file search */\n#define ERRbadshare\t32\t/* Share mode can't be granted */\n#define ERRlock\t\t33\t/* A lock request conflicts with existing lock */\n#define ERRunsup\t50\t/* unsupported - Win 95 */\n#define ERRnoipc\t66\t/* ipc unsupported */\n#define ERRnosuchshare\t67\t/* invalid share name */\n#define ERRfilexists\t80\t/* The file named in the request already exists */\n#define\tERRquota\t112\t/* W2K returns this if quota space exceeds */\n#define ERRcannotopen\t110\t/* cannot open the file */\n#define ERRinvalidname\t123\n#define ERRunknownlevel 124\n#define ERRnotlocked\t158\t/* region was not locked by this context */\n#define ERRrename\t183\n#define ERRbadpipe\t230\t/* named pipe invalid */\n#define ERRpipebusy\t231\t/* all pipe instances are busy */\n#define ERRpipeclosing\t232\t/* close in progress */\n#define ERRnotconnected\t233\t/* nobody on other end of pipe */\n#define ERRmoredata\t234\t/* more data to be returned */\n#define ERRbaddirectory\t267\t/* invalid directory name */\n#define ERReasunsupported\t282\t/* extended attributes not supported */\n#define ERRunknownipc\t2142\n#define ERRbuftoosmall\t2123\n#define ERRnosuchprintjob\t2151\n\n/*\n * Error codes for the ERRSRV class\n */\n#define ERRerror\t1\t/* Non-specific error code */\n#define ERRbadpw\t2\t/* Bad password */\n#define ERRbadtype\t3\t/* reserved */\n#define ERRaccess\t4\t/* The client doesn't have enough access rights */\n#define ERRinvnid\t5\t/* The Tid specified in a command is invalid */\n#define ERRinvnetname\t6\t/* Invalid server name in the tree connect */\n#define ERRinvdevice\t7\t/* Printer and not printer devices are mixed */\n#define ERRqfull\t49\t/* Print queue full */\n#define ERRqtoobig\t50\t/* Print queue full - no space */\n#define ERRinvpfid\t52\t/* Invalid print file FID */\n#define ERRsmbcmd\t64\t/* The server did not recognize the command */\n#define ERRsrverror\t65\t/* The server encountered and internal error */\n#define ERRfilespecs\t67\t/* The Fid and path name contains an invalid combination */\n#define ERRbadpermits\t69\t/* Access mode invalid */\n#define ERRsetattrmode\t71\t/* Attribute mode invalid */\n#define ERRpaused\t81\t/* Server is paused */\n#define ERRmsgoff\t82\t/* Not receiving messages */\n#define ERRnoroom\t83\t/* No room to buffer message */\n#define ERRrmuns\t87\t/* Too many remote user names */\n#define ERRtimeout\t88\t/* Operation timed out */\n#define ERRnoresource\t89\t/* No resources currently available for request */\n#define ERRtoomanyuids\t90      /* Too many UIDs active on this session */\n#define ERRbaduid\t91\t/* The UID is not known in this session */\n#define ERRusempx\t250\t/* Temporarily unable to support Raw, use MPX mode */\n#define ERRusestd\t251\t/* Temporarily unable to support Raw, use standard r/w */\n#define ERRcontmpx\t252\t/* Continue in MPX mode */\n#define ERRbadPassword\t254\n#define\tERRaccountExpired 2239\n#define\tERRbadClient\t2240\t/* Cannot access the server from this workstation */\n#define\tERRbadLogonTime\t2241\t/* Cannot access the server at this time **/\n#define\tERRpasswordExpired 2242\n#define ERRnosupport\t65535\t/* Invalid function */\n\n/*\n * Error codes for the ERRHRD class\n */\n#define ERRnowrite\t19\t/* write protected media */\n#define ERRbadunit\t20\t/* Unknown unit */\n#define ERRnotready\t21\t/* Drive not ready */\n#define ERRbadcmd\t22\t/* Unknown command */\n#define ERRdata\t\t23\t/* Data error (CRC) */\n#define ERRbadreq\t24\t/* Bad request structure length */\n#define ERRseek\t\t25\t/* Seek error */\n#define ERRbadmedia\t26\t/* Unknown media type */\n#define ERRbadsector\t27\t/* Sector not found */\n#define ERRnopaper\t28\t/* Printer out of paper */\n#define ERRwrite\t29\t/* Write fault */\n#define ERRread\t\t30\t/* Read fault */\n#define ERRgeneral\t31\t/* General failure */\n#define\tERRbadshare\t32\t/* An open conflicts with an existing open */\n#define\tERRlock\t\t33\t/* lock/unlock conflict */\n#define ERRwrongdisk\t34\t/* The wrong disk was found in a drive */\n#define ERRFCBunavail\t35\t/* No FCBs available */\n#define ERRsharebufexc\t36\t/* A sharing buffer has been exceeded */\n#define ERRdiskfull\t39\n\n/*\n * RAP error codes (it seems that they returned not only by RAP)\n */\n#define\tSMB_ERROR_ACCESS_DENIED\t\t5\n#define\tSMB_ERROR_NETWORK_ACCESS_DENIED\t65\n#define\tSMB_ERROR_MORE_DATA\t\t234\n\ntypedef u_int16_t\tsmbfh;\n\n#endif /* _NETSMB_SMB_H_ */\n"
  },
  {
    "path": "freebsd-headers/netsmb/smb_conn.h",
    "content": "/*-\n * Copyright (c) 2000-2001 Boris Popov\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/netsmb/smb_conn.h 206361 2010-04-07 16:50:38Z joel $\n */\n\n/*\n * Two levels of connection hierarchy\n */\n#define\tSMBL_SM\t\t0\n#define SMBL_VC\t\t1\n#define SMBL_SHARE\t2\n#define SMBL_NUM\t3\n#define SMBL_NONE\t(-1)\n\n#define\tSMB_CS_NONE\t0x0000\n#define\tSMB_CS_UPPER\t0x0001\t\t/* convert passed string to upper case */\n#define\tSMB_CS_LOWER\t0x0002\t\t/* convert passed string to lower case */\n\n/*\n * Common object flags\n */\n#define SMBO_GONE\t\t0x1000000\n\n/*\n * access modes\n */\n#define\tSMBM_READ\t\t0400\t/* read conn attrs.(like list shares) */\n#define\tSMBM_WRITE\t\t0200\t/* modify conn attrs */\n#define\tSMBM_EXEC\t\t0100\t/* can send SMB requests */\n#define\tSMBM_READGRP\t\t0040\n#define\tSMBM_WRITEGRP\t\t0020\n#define\tSMBM_EXECGRP\t\t0010\n#define\tSMBM_READOTH\t\t0004\n#define\tSMBM_WRITEOTH\t\t0002\n#define\tSMBM_EXECOTH\t\t0001\n#define\tSMBM_MASK\t\t0777\n#define\tSMBM_EXACT\t\t010000\t/* check for specified mode exactly */\n#define\tSMBM_ALL\t\t(SMBM_READ | SMBM_WRITE | SMBM_EXEC)\n#define\tSMBM_DEFAULT\t\t(SMBM_READ | SMBM_WRITE | SMBM_EXEC)\n#define\tSMBM_ANY_OWNER\t\t((uid_t)-1)\n#define\tSMBM_ANY_GROUP\t\t((gid_t)-1)\n\n/*\n * VC flags\n */\n#define SMBV_PERMANENT\t\t0x0002\n#define SMBV_LONGNAMES\t\t0x0004\t/* connection is configured to use long names */\n#define\tSMBV_ENCRYPT\t\t0x0008\t/* server asked for encrypted password */\n#define\tSMBV_WIN95\t\t0x0010\t/* used to apply bugfixes for this OS */\n#define\tSMBV_PRIVATE\t\t0x0020\t/* connection can be used only by creator */\n#define\tSMBV_RECONNECTING\t0x0040\t/* conn is in the process of reconnection */\n#define SMBV_SINGLESHARE\t0x0080\t/* only one share connecting should be allowed */\n#define SMBV_CREATE\t\t0x0100\t/* lookup for create operation */\n/*#define SMBV_FAILED\t\t0x0200*/\t/* last reconnect attempt has failed */\n#define SMBV_UNICODE\t\t0x0400\t/* connection is configured to use Unicode */\n\n\n/*\n * smb_share flags\n */\n#define SMBS_PERMANENT\t\t0x0001\n#define SMBS_RECONNECTING\t0x0002\n#define SMBS_CONNECTED\t\t0x0004\n\n/*\n * share types\n */\n#define\tSMB_ST_DISK\t\t0x0\t/* A: */\n#define\tSMB_ST_PRINTER\t\t0x1\t/* LPT: */\n#define\tSMB_ST_PIPE\t\t0x2\t/* IPC */\n#define\tSMB_ST_COMM\t\t0x3\t/* COMM */\n#define\tSMB_ST_ANY\t\t0x4\n#define\tSMB_ST_MAX\t\t0x4\n#define SMB_ST_NONE\t\t0xff\t/* not a part of protocol */\n\n/*\n * Negotiated protocol parameters\n */\nstruct smb_sopt {\n\tint\t\tsv_proto;\n\tint16_t\t\tsv_tz;\t\t/* offset in min relative to UTC */\n\tu_int32_t\tsv_maxtx;\t/* maximum transmit buf size */\n\tu_char\t\tsv_sm;\t\t/* security mode */\n\tu_int16_t\tsv_maxmux;\t/* max number of outstanding rq's */\n\tu_int16_t \tsv_maxvcs;\t/* max number of VCs */\n\tu_int16_t\tsv_rawmode;\n\tu_int32_t\tsv_maxraw;\t/* maximum raw-buffer size */\n\tu_int32_t\tsv_skey;\t/* session key */\n\tu_int32_t\tsv_caps;\t/* capabilities SMB_CAP_ */\n};\n\n/*\n * network IO daemon states\n */\nenum smbiod_state {\n\tSMBIOD_ST_NOTCONN,\t/* no connect request was made */\n\tSMBIOD_ST_RECONNECT,\t/* a [re]connect attempt is in progress */\n\tSMBIOD_ST_TRANACTIVE,\t/* transport level is up */\n\tSMBIOD_ST_VCACTIVE,\t/* session established */\n\tSMBIOD_ST_DEAD\t\t/* connection broken, transport is down */\n};\n\n\n/*\n * Info structures\n */\n#define\tSMB_INFO_NONE\t\t0\n#define\tSMB_INFO_VC\t\t2\n#define\tSMB_INFO_SHARE\t\t3\n\nstruct smb_vc_info {\n\tint\t\titype;\n\tint\t\tusecount;\n\tuid_t\t\tuid;\t\t/* user id of connection */\n\tgid_t\t\tgid;\t\t/* group of connection */\n\tmode_t\t\tmode;\t\t/* access mode */\n\tint\t\tflags;\n\tenum smbiod_state iodstate;\n\tstruct smb_sopt\tsopt;\n\tchar\t\tsrvname[SMB_MAXSRVNAMELEN + 1];\n\tchar\t\tvcname[128];\n};\n\nstruct smb_share_info {\n\tint\t\titype;\n\tint\t\tusecount;\n\tu_short\t\ttid;\t\t/* TID */\n\tint\t\ttype;\t\t/* share type */\n\tuid_t\t\tuid;\t\t/* user id of connection */\n\tgid_t\t\tgid;\t\t/* group of connection */\n\tmode_t\t\tmode;\t\t/* access mode */\n\tint\t\tflags;\n\tchar\t\tsname[128];\n};\n\n#ifdef _KERNEL\n\n#include <sys/lock.h>\n#include <sys/lockmgr.h>\n#include <netsmb/smb_subr.h>\n\n#define CONNADDREQ(a1,a2)\t((a1)->sa_len == (a2)->sa_len && \\\n\t\t\t\t bcmp(a1, a2, (a1)->sa_len) == 0)\n\nstruct smb_vc;\nstruct smb_share;\nstruct smb_cred;\nstruct smb_rq;\nstruct mbdata;\nstruct smbioc_oshare;\nstruct smbioc_ossn;\nstruct uio;\n\nTAILQ_HEAD(smb_rqhead, smb_rq);\n\n#define SMB_DEFRQTIMO\t5\n\n#define SMB_DIALECT(vcp)\t((vcp)->vc_sopt.sv_proto)\n\nstruct smb_tran_desc;\n\n/*\n * Connection object\n */\nstruct smb_connobj;\n\ntypedef void smb_co_gone_t (struct smb_connobj *cp, struct smb_cred *scred);\ntypedef void smb_co_free_t (struct smb_connobj *cp);\n\n#define\tSMB_CO_LOCK(cp)\t\tsmb_sl_lock(&(cp)->co_interlock)\n#define\tSMB_CO_UNLOCK(cp)\tsmb_sl_unlock(&(cp)->co_interlock)\n\nstruct smb_connobj {\n\tint\t\t\tco_level;\t/* SMBL_ */\n\tint\t\t\tco_flags;\n\tstruct lock\t\tco_lock;\n\tstruct smb_slock\tco_interlock;\n\tint\t\t\tco_usecount;\n\tstruct smb_connobj *\tco_parent;\n\tSLIST_HEAD(,smb_connobj)co_children;\n\tSLIST_ENTRY(smb_connobj)co_next;\n\tsmb_co_gone_t *\t\tco_gone;\n\tsmb_co_free_t *\t\tco_free;\n};\n\n#define\tSMBCO_FOREACH(var, cp)\tSLIST_FOREACH((var), &(cp)->co_children, co_next)\n\n/*\n * Virtual Circuit (session) to a server.\n * This is the most (over)complicated part of SMB protocol.\n * For the user security level (usl), each session with different remote\n * user name has its own VC.\n * It is unclear however, should share security level (ssl) allow additional\n * VCs, because user name is not used and can be the same. On other hand,\n * multiple VCs allows us to create separate sessions to server on a per\n * user basis.\n */\n\n/*\n * This lock protects vc_flags\n */\n#define\tSMBC_ST_LOCK(vcp)\tsmb_sl_lock(&(vcp)->vc_stlock)\n#define\tSMBC_ST_UNLOCK(vcp)\tsmb_sl_unlock(&(vcp)->vc_stlock)\n\n\nstruct smb_vc {\n\tstruct smb_connobj obj;\n\tchar *\t\tvc_srvname;\n\tstruct sockaddr*vc_paddr;\t/* server addr */\n\tstruct sockaddr*vc_laddr;\t/* local addr, if any */\n\tchar *\t\tvc_username;\n\tchar *\t\tvc_pass;\t/* password for usl case */\n\tchar *\t\tvc_domain;\t/* workgroup/primary domain */\n\n\tu_int\t\tvc_timo;\t/* default request timeout */\n\tint\t\tvc_maxvcs;\t/* maximum number of VC per connection */\n\n\tvoid *\t\tvc_tolower;\t/* local charset */\n\tvoid *\t\tvc_toupper;\t/* local charset */\n\tvoid *\t\tvc_toserver;\t/* local charset to server one */\n\tvoid *\t\tvc_tolocal;\t/* server charset to local one */\n\tint\t\tvc_number;\t/* number of this VC from the client side */\n\tint\t\tvc_genid;\n\tuid_t\t\tvc_uid;\t\t/* user id of connection */\n\tgid_t\t\tvc_grp;\t\t/* group of connection */\n\tmode_t\t\tvc_mode;\t/* access mode */\n\tu_short\t\tvc_smbuid;\t/* unique vc id assigned by server */\n\n\tu_char\t\tvc_hflags;\t/* or'ed with flags in the smb header */\n\tu_short\t\tvc_hflags2;\t/* or'ed with flags in the smb header */\n\tvoid *\t\tvc_tdata;\t/* transport control block */\n\tstruct smb_tran_desc *vc_tdesc;\n\tint\t\tvc_chlen;\t/* actual challenge length */\n\tu_char \t\tvc_ch[SMB_MAXCHALLENGELEN];\n\tu_short\t\tvc_mid;\t\t/* multiplex id */\n\tstruct smb_sopt\tvc_sopt;\t/* server options */\n\tint\t\tvc_txmax;\t/* max tx/rx packet size */\n\tint\t\tvc_rxmax;\t/* max readx data size */\n\tint\t\tvc_wxmax;\t/* max writex data size */\n\tstruct smbiod *\tvc_iod;\n\tstruct smb_slock vc_stlock;\n\tu_int32_t\tvc_seqno;\t/* my next sequence number */\n\tu_int8_t\t*vc_mackey;\t/* MAC key */\n\tint\t\tvc_mackeylen;\t/* length of MAC key */\n};\n\n#define vc_maxmux\tvc_sopt.sv_maxmux\n#define\tvc_flags\tobj.co_flags\n\n#define SMB_UNICODE_STRINGS(vcp)\t((vcp)->vc_hflags2 & SMB_FLAGS2_UNICODE)\n\n/*\n * smb_share structure describes connection to the given SMB share (tree).\n * Connection to share is always built on top of the VC.\n */\n\n/*\n * This lock protects ss_flags\n */\n#define\tSMBS_ST_LOCK(ssp)\tsmb_sl_lock(&(ssp)->ss_stlock)\n#define\tSMBS_ST_LOCKPTR(ssp)\t(&(ssp)->ss_stlock)\n#define\tSMBS_ST_UNLOCK(ssp)\tsmb_sl_unlock(&(ssp)->ss_stlock)\n\nstruct smb_share {\n\tstruct smb_connobj obj;\n\tchar *\t\tss_name;\n\tu_short\t\tss_tid;\t\t/* TID */\n\tint\t\tss_type;\t/* share type */\n\tuid_t\t\tss_uid;\t\t/* user id of connection */\n\tgid_t\t\tss_grp;\t\t/* group of connection */\n\tmode_t\t\tss_mode;\t/* access mode */\n\tint\t\tss_vcgenid;\n\tchar *\t\tss_pass;\t/* password to a share, can be null */\n\tstruct smb_slock ss_stlock;\n};\n\n#define\tss_flags\tobj.co_flags\n\n#define CPTOVC(cp)\t((struct smb_vc*)(cp))\n#define VCTOCP(vcp)\t(&(vcp)->obj)\n#define CPTOSS(cp)\t((struct smb_share*)(cp))\n#define\tSSTOVC(ssp)\tCPTOVC(((ssp)->obj.co_parent))\n#define SSTOCP(ssp)\t(&(ssp)->obj)\n\nstruct smb_vcspec {\n\tchar *\t\tsrvname;\n\tstruct sockaddr*sap;\n\tstruct sockaddr*lap;\n\tint\t\tflags;\n\tchar *\t\tusername;\n\tchar *\t\tpass;\n\tchar *\t\tdomain;\n\tmode_t\t\tmode;\n\tmode_t\t\trights;\n\tuid_t\t\towner;\n\tgid_t\t\tgroup;\n\tchar *\t\tlocalcs;\n\tchar *\t\tservercs;\n\tstruct smb_sharespec *shspec;\n\tstruct smb_share *ssp;\t\t/* returned */\n\t/*\n\t * The rest is an internal data\n\t */\n\tstruct smb_cred *scred;\n};\n\nstruct smb_sharespec {\n\tchar *\t\tname;\n\tchar *\t\tpass;\n\tmode_t\t\tmode;\n\tmode_t\t\trights;\n\tuid_t\t\towner;\n\tgid_t\t\tgroup;\n\tint\t\tstype;\n\t/*\n\t * The rest is an internal data\n\t */\n\tstruct smb_cred *scred;\n};\n\n/*\n * Session level functions\n */\nint  smb_sm_init(void);\nint  smb_sm_done(void);\nint  smb_sm_lookup(struct smb_vcspec *vcspec,\n\tstruct smb_sharespec *shspec, struct smb_cred *scred,\n\tstruct smb_vc **vcpp);\n\n/*\n * Connection object\n */\nvoid smb_co_ref(struct smb_connobj *cp);\nvoid smb_co_rele(struct smb_connobj *cp, struct smb_cred *scred);\nint  smb_co_get(struct smb_connobj *cp, int flags, struct smb_cred *scred);\nvoid smb_co_put(struct smb_connobj *cp, struct smb_cred *scred);\nint  smb_co_lock(struct smb_connobj *cp, int flags);\nvoid smb_co_unlock(struct smb_connobj *cp, int flags);\n\n/*\n * session level functions\n */\nint  smb_vc_create(struct smb_vcspec *vcspec,\n\tstruct smb_cred *scred, struct smb_vc **vcpp);\nint  smb_vc_connect(struct smb_vc *vcp, struct smb_cred *scred);\nint  smb_vc_access(struct smb_vc *vcp, struct smb_cred *scred, mode_t mode);\nint  smb_vc_get(struct smb_vc *vcp, int flags, struct smb_cred *scred);\nvoid smb_vc_put(struct smb_vc *vcp, struct smb_cred *scred);\nvoid smb_vc_ref(struct smb_vc *vcp);\nvoid smb_vc_rele(struct smb_vc *vcp, struct smb_cred *scred);\nint  smb_vc_lock(struct smb_vc *vcp, int flags);\nvoid smb_vc_unlock(struct smb_vc *vcp, int flags);\nint  smb_vc_lookupshare(struct smb_vc *vcp, struct smb_sharespec *shspec,\n\tstruct smb_cred *scred, struct smb_share **sspp);\nconst char * smb_vc_getpass(struct smb_vc *vcp);\nu_short smb_vc_nextmid(struct smb_vc *vcp);\n\n/*\n * share level functions\n */\nint  smb_share_create(struct smb_vc *vcp, struct smb_sharespec *shspec,\n\tstruct smb_cred *scred, struct smb_share **sspp);\nint  smb_share_access(struct smb_share *ssp, struct smb_cred *scred, mode_t mode);\nvoid smb_share_ref(struct smb_share *ssp);\nvoid smb_share_rele(struct smb_share *ssp, struct smb_cred *scred);\nint  smb_share_get(struct smb_share *ssp, int flags, struct smb_cred *scred);\nvoid smb_share_put(struct smb_share *ssp, struct smb_cred *scred);\nint  smb_share_lock(struct smb_share *ssp, int flags);\nvoid smb_share_unlock(struct smb_share *ssp, int flags);\nvoid smb_share_invalidate(struct smb_share *ssp);\nint  smb_share_valid(struct smb_share *ssp);\nconst char * smb_share_getpass(struct smb_share *ssp);\n\n/*\n * SMB protocol level functions\n */\nint  smb_smb_negotiate(struct smb_vc *vcp, struct smb_cred *scred);\nint  smb_smb_ssnsetup(struct smb_vc *vcp, struct smb_cred *scred);\nint  smb_smb_ssnclose(struct smb_vc *vcp, struct smb_cred *scred);\nint  smb_smb_treeconnect(struct smb_share *ssp, struct smb_cred *scred);\nint  smb_smb_treedisconnect(struct smb_share *ssp, struct smb_cred *scred);\nint  smb_read(struct smb_share *ssp, u_int16_t fid, struct uio *uio,\n\tstruct smb_cred *scred);\nint  smb_write(struct smb_share *ssp, u_int16_t fid, struct uio *uio,\n\tstruct smb_cred *scred);\nint  smb_smb_echo(struct smb_vc *vcp, struct smb_cred *scred);\n\n/*\n * smbiod thread\n */\n\n#define\tSMBIOD_EV_NEWRQ\t\t0x0001\n#define\tSMBIOD_EV_SHUTDOWN\t0x0002\n#define\tSMBIOD_EV_CONNECT\t0x0003\n#define\tSMBIOD_EV_DISCONNECT\t0x0004\n#define\tSMBIOD_EV_TREECONNECT\t0x0005\n#define\tSMBIOD_EV_MASK\t\t0x00ff\n#define\tSMBIOD_EV_SYNC\t\t0x0100\n#define\tSMBIOD_EV_PROCESSING\t0x0200\n\nstruct smbiod_event {\n\tint\tev_type;\n\tint\tev_error;\n\tvoid *\tev_ident;\n\tSTAILQ_ENTRY(smbiod_event)\tev_link;\n};\n\n#define\tSMBIOD_SHUTDOWN\t\t0x0001\n\nstruct smbiod {\n\tint\t\t\tiod_id;\n\tint\t\t\tiod_flags;\n\tenum smbiod_state\tiod_state;\n\tint\t\t\tiod_muxcnt;\t/* number of active outstanding requests */\n\tint\t\t\tiod_sleeptimo;\n\tstruct smb_vc *\t\tiod_vc;\n\tstruct smb_slock\tiod_rqlock;\t/* iod_rqlist, iod_muxwant */\n\tstruct smb_rqhead\tiod_rqlist;\t/* list of outstanding requests */\n\tint\t\t\tiod_muxwant;\n\tstruct proc *\t\tiod_p;\n\tstruct thread *\t\tiod_td;\n\tstruct smb_cred\t\tiod_scred;\n\tstruct smb_slock\tiod_evlock;\t/* iod_evlist */\n\tSTAILQ_HEAD(,smbiod_event) iod_evlist;\n\tstruct timespec \tiod_lastrqsent;\n\tstruct timespec \tiod_pingtimo;\n};\n\nint  smb_iod_init(void);\nint  smb_iod_done(void);\nint  smb_iod_create(struct smb_vc *vcp);\nint  smb_iod_destroy(struct smbiod *iod);\nint  smb_iod_request(struct smbiod *iod, int event, void *ident);\nint  smb_iod_addrq(struct smb_rq *rqp);\nint  smb_iod_waitrq(struct smb_rq *rqp);\nint  smb_iod_removerq(struct smb_rq *rqp);\n\n#endif /* _KERNEL */\n"
  },
  {
    "path": "freebsd-headers/netsmb/smb_dev.h",
    "content": "/*-\n * Copyright (c) 2000-2001 Boris Popov\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/netsmb/smb_dev.h 217174 2011-01-08 23:06:54Z csjp $\n */\n#ifndef _NETSMB_DEV_H_\n#define _NETSMB_DEV_H_\n\n#ifndef _KERNEL\n#include <sys/types.h>\n#endif\n#include <sys/ioccom.h>\n\n#include <netsmb/smb.h>\n\n#define\tNSMB_NAME\t\t\"nsmb\"\n\n#define NSMB_VERMAJ\t1\n#define NSMB_VERMIN\t3006\n#define NSMB_VERSION\t(NSMB_VERMAJ * 100000 + NSMB_VERMIN)\n\n#define NSMBFL_OPEN\t\t0x0001\n\n#define\tSMBVOPT_CREATE\t\t0x0001\t/* create object if necessary */\n#define\tSMBVOPT_PRIVATE\t\t0x0002\t/* connection should be private */\n#define\tSMBVOPT_SINGLESHARE\t0x0004\t/* keep only one share at this VC */\n#define\tSMBVOPT_PERMANENT\t0x0010\t/* object will keep last reference */\n\n#define\tSMBSOPT_CREATE\t\t0x0001\t/* create object if necessary */\n#define\tSMBSOPT_PERMANENT\t0x0010\t/* object will keep last reference */\n\n/*\n * SMBIOC_LOOKUP flags\n */\n#define SMBLK_CREATE\t\t0x0001\n\nstruct smbioc_ossn {\n\tint\t\tioc_opt;\n\tuint32_t\tioc_svlen;\t/* size of ioc_server address */\n\tstruct sockaddr*ioc_server;\n\tuint32_t\tioc_lolen;\t/* size of ioc_local address */\n\tstruct sockaddr*ioc_local;\n\tchar\t\tioc_srvname[SMB_MAXSRVNAMELEN + 1];\n\tint\t\tioc_timeout;\n\tint\t\tioc_retrycount;\t/* number of retries before giveup */\n\tchar\t\tioc_localcs[16];/* local charset */\n\tchar\t\tioc_servercs[16];/* server charset */\n\tchar\t\tioc_user[SMB_MAXUSERNAMELEN + 1];\n\tchar\t\tioc_workgroup[SMB_MAXUSERNAMELEN + 1];\n\tchar\t\tioc_password[SMB_MAXPASSWORDLEN + 1];\n\tuid_t\t\tioc_owner;\t/* proposed owner */\n\tgid_t\t\tioc_group;\t/* proposed group */\n\tmode_t\t\tioc_mode;\t/* desired access mode */\n\tmode_t\t\tioc_rights;\t/* SMBM_* */\n};\n\nstruct smbioc_oshare {\n\tint\t\tioc_opt;\n\tint\t\tioc_stype;\t/* share type */\n\tchar\t\tioc_share[SMB_MAXSHARENAMELEN + 1];\n\tchar\t\tioc_password[SMB_MAXPASSWORDLEN + 1];\n\tuid_t\t\tioc_owner;\t/* proposed owner of share */\n\tgid_t\t\tioc_group;\t/* proposed group of share */\n\tmode_t\t\tioc_mode;\t/* desired access mode to share */\n\tmode_t\t\tioc_rights;\t/* SMBM_* */\n};\n\nstruct smbioc_rq {\n\tu_char\t\tioc_cmd;\n\tu_char\t\tioc_twc;\n\tvoid *\t\tioc_twords;\n\tu_short\t\tioc_tbc;\n\tvoid *\t\tioc_tbytes;\n\tint\t\tioc_rpbufsz;\n\tchar *\t\tioc_rpbuf;\n\tu_char\t\tioc_rwc;\n\tu_short\t\tioc_rbc;\n\tu_int8_t\tioc_errclass;\n\tu_int16_t\tioc_serror;\n\tu_int32_t\tioc_error;\n};\n\nstruct smbioc_t2rq {\n\tu_int16_t\tioc_setup[3];\n\tint\t\tioc_setupcnt;\n\tchar *\t\tioc_name;\n\tu_short\t\tioc_tparamcnt;\n\tvoid *\t\tioc_tparam;\n\tu_short\t\tioc_tdatacnt;\n\tvoid *\t\tioc_tdata;\n\tu_short\t\tioc_rparamcnt;\n\tvoid *\t\tioc_rparam;\n\tu_short\t\tioc_rdatacnt;\n\tvoid *\t\tioc_rdata;\n};\n\nstruct smbioc_flags {\n\tint\t\tioc_level;\t/* 0 - session, 1 - share */\n\tint\t\tioc_mask;\n\tint\t\tioc_flags;\n};\n\nstruct smbioc_lookup {\n\tint\t\tioc_level;\n\tint\t\tioc_flags;\n\tstruct smbioc_ossn\tioc_ssn;\n\tstruct smbioc_oshare\tioc_sh;\n};\n\nstruct smbioc_rw {\n\tsmbfh\tioc_fh;\n\tchar *\tioc_base;\n\toff_t\tioc_offset;\n\tint\tioc_cnt;\n};\n\n/*\n * Device IOCTLs\n */\n#define\tSMBIOC_OPENSESSION\t_IOW('n',  100, struct smbioc_ossn)\n#define\tSMBIOC_OPENSHARE\t_IOW('n',  101, struct smbioc_oshare)\n#define\tSMBIOC_REQUEST\t\t_IOWR('n', 102, struct smbioc_rq)\n#define\tSMBIOC_T2RQ\t\t_IOWR('n', 103, struct smbioc_t2rq)\n#define\tSMBIOC_SETFLAGS\t\t_IOW('n',  104, struct smbioc_flags)\n#define\tSMBIOC_LOOKUP\t\t_IOW('n',  106, struct smbioc_lookup)\n#define\tSMBIOC_READ\t\t_IOWR('n', 107, struct smbioc_rw)\n#define\tSMBIOC_WRITE\t\t_IOWR('n', 108, struct smbioc_rw)\n\n#ifdef _KERNEL\n\n#define SMBST_CONNECTED\t1\n\nSTAILQ_HEAD(smbrqh, smb_rq);\n\nstruct smb_dev {\n\tint\t\tsd_opened;\n\tint\t\tsd_level;\n\tstruct smb_vc * sd_vc;\t\t/* reference to VC */\n\tstruct smb_share *sd_share;\t/* reference to share if any */\n\tint\t\tsd_poll;\n\tint\t\tsd_seq;\n/*\tstruct ifqueue\tsd_rdqueue;\n\tstruct ifqueue\tsd_wrqueue;\n\tstruct selinfo\tsd_pollinfo;\n\tstruct smbrqh\tsd_rqlist;\n\tstruct smbrqh\tsd_rplist;\n\tstruct ucred \t*sd_owner;*/\n\tint\t\tsd_flags;\n};\n\nstruct smb_cred;\n/*\n * Compound user interface\n */\nint  smb_usr_lookup(struct smbioc_lookup *dp, struct smb_cred *scred,\n\tstruct smb_vc **vcpp, struct smb_share **sspp);\nint  smb_usr_opensession(struct smbioc_ossn *data,\n\tstruct smb_cred *scred,\tstruct smb_vc **vcpp);\nint  smb_usr_openshare(struct smb_vc *vcp, struct smbioc_oshare *data,\n\tstruct smb_cred *scred, struct smb_share **sspp);\nint  smb_usr_simplerequest(struct smb_share *ssp, struct smbioc_rq *data,\n\tstruct smb_cred *scred);\nint  smb_usr_t2request(struct smb_share *ssp, struct smbioc_t2rq *data,\n\tstruct smb_cred *scred);\nint  smb_dev2share(int fd, int mode, struct smb_cred *scred,\n\tstruct smb_share **sspp);\n\n\n#endif /* _KERNEL */\n\n#endif /* _NETSMB_DEV_H_ */\n"
  },
  {
    "path": "freebsd-headers/netsmb/smb_rq.h",
    "content": "/*-\n * Copyright (c) 2000-2001 Boris Popov\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/netsmb/smb_rq.h 206361 2010-04-07 16:50:38Z joel $\n */\n#ifndef _NETSMB_SMB_RQ_H_\n#define\t_NETSMB_SMB_RQ_H_\n\n#ifndef MB_MSYSTEM\n#include <sys/mchain.h>\n#endif\n\n#define\tSMBR_ALLOCED\t\t0x0001\t/* structure was malloced */\n#define\tSMBR_SENT\t\t0x0002\t/* request successfully transmitted */\n#define\tSMBR_REXMIT\t\t0x0004\t/* request should be retransmitted */\n#define\tSMBR_INTR\t\t0x0008\t/* request interrupted */\n#define\tSMBR_RESTART\t\t0x0010\t/* request should be repeated if possible */\n#define\tSMBR_NORESTART\t\t0x0020\t/* request is not restartable */\n#define\tSMBR_MULTIPACKET\t0x0040\t/* multiple packets can be sent and received */\n#define\tSMBR_INTERNAL\t\t0x0080\t/* request is internal to smbrqd */\n#define\tSMBR_XLOCK\t\t0x0100\t/* request locked and can't be moved */\n#define\tSMBR_XLOCKWANT\t\t0x0200\t/* waiter on XLOCK */\n\n#define SMBT2_ALLSENT\t\t0x0001\t/* all data and params are sent */\n#define SMBT2_ALLRECV\t\t0x0002\t/* all data and params are received */\n#define\tSMBT2_ALLOCED\t\t0x0004\n#define\tSMBT2_RESTART\t\t0x0008\n#define\tSMBT2_NORESTART\t\t0x0010\n#define\tSMBT2_SECONDARY\t\t0x0020\t/* secondary request */\n\n#define SMBRQ_SLOCK(rqp)\tsmb_sl_lock(&(rqp)->sr_slock)\n#define SMBRQ_SUNLOCK(rqp)\tsmb_sl_unlock(&(rqp)->sr_slock)\n#define SMBRQ_SLOCKPTR(rqp)\t(&(rqp)->sr_slock)\n\n\nenum smbrq_state {\n\tSMBRQ_NOTSENT,\t\t/* rq have data to send */\n\tSMBRQ_SENT,\t\t/* send procedure completed */\n\tSMBRQ_REPLYRECEIVED,\n\tSMBRQ_NOTIFIED\t\t/* owner notified about completion */\n};\n\nstruct smb_vc;\nstruct smb_t2rq;\n\nstruct smb_rq {\n\tenum smbrq_state\tsr_state;\n\tstruct smb_vc * \tsr_vc;\n\tstruct smb_share*\tsr_share;\n\tu_short\t\t\tsr_mid;\n\tu_int32_t\t\tsr_seqno;\n\tu_int32_t\t\tsr_rseqno;\n\tstruct mbchain\t\tsr_rq;\n\tu_int8_t\t\tsr_rqflags;\n\tu_int16_t\t\tsr_rqflags2;\n\tu_char *\t\tsr_wcount;\n\tvoid *\t\t\tsr_bcount;\t/* Points to 2-byte buffer. */\n\tstruct mdchain\t\tsr_rp;\n\tint\t\t\tsr_rpgen;\n\tint\t\t\tsr_rplast;\n\tint\t\t\tsr_flags;\t/* SMBR_* */\n\tint\t\t\tsr_rpsize;\n\tstruct smb_cred *\tsr_cred;\n\tint\t\t\tsr_timo;\n\tint\t\t\tsr_rexmit;\n\tint\t\t\tsr_sendcnt;\n\tstruct timespec \tsr_timesent;\n\tint\t\t\tsr_lerror;\n\tu_int8_t *\t\tsr_rqsig;\n\tvoid *\t\t\tsr_rqtid;\t/* Points to 2-byte buffer. */\n\tvoid *\t\t\tsr_rquid;\t/* Points to 2-byte buffer. */\n\tu_int8_t\t\tsr_errclass;\n\tu_int16_t\t\tsr_serror;\n\tu_int32_t\t\tsr_error;\n\tu_int8_t\t\tsr_rpflags;\n\tu_int16_t\t\tsr_rpflags2;\n\tu_int16_t\t\tsr_rptid;\n\tu_int16_t\t\tsr_rppid;\n\tu_int16_t\t\tsr_rpuid;\n\tu_int16_t\t\tsr_rpmid;\n\tstruct smb_slock\tsr_slock;\t/* short term locks */\n\tstruct smb_t2rq *\tsr_t2;\n\tTAILQ_ENTRY(smb_rq)\tsr_link;\n};\n\nstruct smb_t2rq {\n\tu_int16_t\tt2_setupcount;\n\tu_int16_t *\tt2_setupdata;\n\tu_int16_t\tt2_setup[2];\t/* most of rqs has setupcount of 1 */\n\tu_int8_t\tt2_maxscount;\t/* max setup words to return */\n\tu_int16_t\tt2_maxpcount;\t/* max param bytes to return */\n\tu_int16_t\tt2_maxdcount;\t/* max data bytes to return */\n\tu_int16_t\tt2_fid;\t\t/* for T2 request */\n\tchar *\t\tt_name;\t\t/* for T request, should be zero for T2 */\n\tint\t\tt2_flags;\t/* SMBT2_ */\n\tstruct mbchain\tt2_tparam;\t/* parameters to transmit */\n\tstruct mbchain\tt2_tdata;\t/* data to transmit */\n\tstruct mdchain\tt2_rparam;\t/* received parameters */\n\tstruct mdchain\tt2_rdata;\t/* received data */\n\tstruct smb_cred*t2_cred;\n\tstruct smb_connobj *t2_source;\n\tstruct smb_rq *\tt2_rq;\n\tstruct smb_vc * t2_vc;\n};\n\nint  smb_rq_alloc(struct smb_connobj *layer, u_char cmd,\n\tstruct smb_cred *scred, struct smb_rq **rqpp);\nint  smb_rq_init(struct smb_rq *rqp, struct smb_connobj *layer, u_char cmd,\n\tstruct smb_cred *scred);\nvoid smb_rq_done(struct smb_rq *rqp);\nint  smb_rq_getrequest(struct smb_rq *rqp, struct mbchain **mbpp);\nint  smb_rq_getreply(struct smb_rq *rqp, struct mdchain **mbpp);\nvoid smb_rq_wstart(struct smb_rq *rqp);\nvoid smb_rq_wend(struct smb_rq *rqp);\nvoid smb_rq_bstart(struct smb_rq *rqp);\nvoid smb_rq_bend(struct smb_rq *rqp);\nint  smb_rq_intr(struct smb_rq *rqp);\nint  smb_rq_simple(struct smb_rq *rqp);\n\nint  smb_t2_alloc(struct smb_connobj *layer, u_short setup, struct smb_cred *scred,\n\tstruct smb_t2rq **rqpp);\nint  smb_t2_init(struct smb_t2rq *rqp, struct smb_connobj *layer, u_short setup,\n\tstruct smb_cred *scred);\nvoid smb_t2_done(struct smb_t2rq *t2p);\nint  smb_t2_request(struct smb_t2rq *t2p);\n\n#endif /* !_NETSMB_SMB_RQ_H_ */\n"
  },
  {
    "path": "freebsd-headers/netsmb/smb_subr.h",
    "content": "/*-\n * Copyright (c) 2000-2001 Boris Popov\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/netsmb/smb_subr.h 217174 2011-01-08 23:06:54Z csjp $\n */\n#ifndef _NETSMB_SMB_SUBR_H_\n#define _NETSMB_SMB_SUBR_H_\n\n#ifndef _KERNEL\n#error \"This file shouldn't be included from userland programs\"\n#endif\n\n#ifdef MALLOC_DECLARE\nMALLOC_DECLARE(M_SMBTEMP);\n#endif\n\n#define SMBERROR(format, args...) printf(\"%s: \"format, __func__ ,## args)\n#define SMBPANIC(format, args...) printf(\"%s: \"format, __func__ ,## args)\n\n#ifdef SMB_SOCKET_DEBUG\n#define SMBSDEBUG(format, args...) printf(\"%s: \"format, __func__ ,## args)\n#else\n#define SMBSDEBUG(format, args...)\n#endif\n\n#ifdef SMB_IOD_DEBUG\n#define SMBIODEBUG(format, args...) printf(\"%s: \"format, __func__ ,## args)\n#else\n#define SMBIODEBUG(format, args...)\n#endif\n\n#ifdef SMB_SOCKETDATA_DEBUG\nvoid m_dumpm(struct mbuf *m);\n#else\n#define m_dumpm(m)\n#endif\n\n#define\tSMB_SIGMASK(set) \t\t\t\t\t\t\\\n\t(SIGISMEMBER(set, SIGINT) || SIGISMEMBER(set, SIGTERM) ||\t\\\n\t SIGISMEMBER(set, SIGHUP) || SIGISMEMBER(set, SIGKILL) ||\t\\\n\t SIGISMEMBER(set, SIGQUIT))\n\n#define\tsmb_suser(cred)\tpriv_check_cred(cred, PRIV_NETSMB, 0)\n\n/*\n * Compatibility wrappers for simple locks\n */\n\n#include <sys/lock.h>\n#include <sys/mutex.h>\n\n#define\tsmb_slock\t\t\tmtx\n#define\tsmb_sl_init(mtx, desc)\t\tmtx_init(mtx, desc, NULL, MTX_DEF)\n#define\tsmb_sl_destroy(mtx)\t\tmtx_destroy(mtx)\n#define\tsmb_sl_lock(mtx)\t\tmtx_lock(mtx)\n#define\tsmb_sl_unlock(mtx)\t\tmtx_unlock(mtx)\n\n\n#define SMB_STRFREE(p)\tdo { if (p) smb_strfree(p); } while(0)\n\ntypedef u_int16_t\tsmb_unichar;\ntypedef\tsmb_unichar\t*smb_uniptr;\n\n/*\n * Crediantials of user/process being processing in the connection procedures\n */\nstruct smb_cred {\n\tstruct thread *\tscr_td;\n\tstruct ucred *\tscr_cred;\n};\n\nextern smb_unichar smb_unieol;\n\nstruct mbchain;\nstruct smb_vc;\nstruct smb_rq;\n\nvoid smb_makescred(struct smb_cred *scred, struct thread *td, struct ucred *cred);\nint  smb_td_intr(struct thread *);\nchar *smb_strdup(const char *s);\nvoid *smb_memdup(const void *umem, int len);\nchar *smb_strdupin(char *s, size_t maxlen);\nvoid *smb_memdupin(void *umem, size_t len);\nvoid smb_strtouni(u_int16_t *dst, const char *src);\nvoid smb_strfree(char *s);\nvoid smb_memfree(void *s);\nvoid *smb_zmalloc(size_t size, struct malloc_type *type, int flags);\n\nint  smb_calcmackey(struct smb_vc *vcp);\nint  smb_encrypt(const u_char *apwd, u_char *C8, u_char *RN);\nint  smb_ntencrypt(const u_char *apwd, u_char *C8, u_char *RN);\nint  smb_maperror(int eclass, int eno);\nint  smb_put_dmem(struct mbchain *mbp, struct smb_vc *vcp,\n\tconst char *src, size_t len, int caseopt);\nint  smb_put_dstring(struct mbchain *mbp, struct smb_vc *vcp,\n\tconst char *src, int caseopt);\nint  smb_put_string(struct smb_rq *rqp, const char *src);\nint  smb_put_asunistring(struct smb_rq *rqp, const char *src);\nint  smb_rq_sign(struct smb_rq *rqp);\nint  smb_rq_verify(struct smb_rq *rqp);\n\n#endif /* !_NETSMB_SMB_SUBR_H_ */\n"
  },
  {
    "path": "freebsd-headers/netsmb/smb_tran.h",
    "content": "/*-\n * Copyright (c) 2000-2001 Boris Popov\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/netsmb/smb_tran.h 206361 2010-04-07 16:50:38Z joel $\n */\n\n#ifndef _NETSMB_SMB_TRAN_H_\n#define\t_NETSMB_SMB_TRAN_H_\n\n#include <sys/socket.h>\n\n/*\n * Known transports\n */\n#define\tSMBT_NBTCP\t1\n\n/*\n * Transport parameters\n */\n#define\tSMBTP_SNDSZ\t1\t\t/* R  - int */\n#define\tSMBTP_RCVSZ\t2\t\t/* R  - int */\n#define\tSMBTP_TIMEOUT\t3\t\t/* RW - struct timespec */\n#define\tSMBTP_SELECTID\t4\t\t/* RW - (void *) */\n#define SMBTP_UPCALL\t5\t\t/* RW - (* void)(void *) */\n\nstruct smb_tran_ops;\n\nstruct smb_tran_desc {\n\tsa_family_t\ttr_type;\n\tint\t(*tr_create)(struct smb_vc *vcp, struct thread *td);\n\tint\t(*tr_done)(struct smb_vc *vcp, struct thread *td);\n\tint\t(*tr_bind)(struct smb_vc *vcp, struct sockaddr *sap, struct thread *td);\n\tint\t(*tr_connect)(struct smb_vc *vcp, struct sockaddr *sap, struct thread *td);\n\tint\t(*tr_disconnect)(struct smb_vc *vcp, struct thread *td);\n\tint\t(*tr_send)(struct smb_vc *vcp, struct mbuf *m0, struct thread *td);\n\tint\t(*tr_recv)(struct smb_vc *vcp, struct mbuf **mpp, struct thread *td);\n\tvoid\t(*tr_timo)(struct smb_vc *vcp);\n\tvoid\t(*tr_intr)(struct smb_vc *vcp);\n\tint\t(*tr_getparam)(struct smb_vc *vcp, int param, void *data);\n\tint\t(*tr_setparam)(struct smb_vc *vcp, int param, void *data);\n\tint\t(*tr_fatal)(struct smb_vc *vcp, int error);\n#ifdef notyet\n\tint\t(*tr_poll)(struct smb_vc *vcp, struct thread *td);\n\tint\t(*tr_cmpaddr)(void *addr1, void *addr2);\n#endif\n\tLIST_ENTRY(smb_tran_desc)\ttr_link;\n};\n\n#define SMB_TRAN_CREATE(vcp,p)\t\t(vcp)->vc_tdesc->tr_create(vcp,p)\n#define SMB_TRAN_DONE(vcp,p)\t\t(vcp)->vc_tdesc->tr_done(vcp,p)\n#define\tSMB_TRAN_BIND(vcp,sap,p)\t(vcp)->vc_tdesc->tr_bind(vcp,sap,p)\n#define\tSMB_TRAN_CONNECT(vcp,sap,p)\t(vcp)->vc_tdesc->tr_connect(vcp,sap,p)\n#define\tSMB_TRAN_DISCONNECT(vcp,p)\t(vcp)->vc_tdesc->tr_disconnect(vcp,p)\n#define\tSMB_TRAN_SEND(vcp,m0,p)\t\t(vcp)->vc_tdesc->tr_send(vcp,m0,p)\n#define\tSMB_TRAN_RECV(vcp,m,p)\t\t(vcp)->vc_tdesc->tr_recv(vcp,m,p)\n#define\tSMB_TRAN_TIMO(vcp)\t\t(vcp)->vc_tdesc->tr_timo(vcp)\n#define\tSMB_TRAN_INTR(vcp)\t\t(vcp)->vc_tdesc->tr_intr(vcp)\n#define\tSMB_TRAN_GETPARAM(vcp,par,data)\t(vcp)->vc_tdesc->tr_getparam(vcp, par, data)\n#define\tSMB_TRAN_SETPARAM(vcp,par,data)\t(vcp)->vc_tdesc->tr_setparam(vcp, par, data)\n#define\tSMB_TRAN_FATAL(vcp, error)\t(vcp)->vc_tdesc->tr_fatal(vcp, error)\n\n#endif /* _NETSMB_SMB_TRAN_H_ */\n"
  },
  {
    "path": "freebsd-headers/netsmb/smb_trantcp.h",
    "content": "/*-\n * Copyright (c) 2000-2001 Boris Popov\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/netsmb/smb_trantcp.h 206361 2010-04-07 16:50:38Z joel $\n */\n#ifndef _NETSMB_SMB_TRANTCP_H_\n#define\t_NETSMB_SMB_TRANTCP_H_\n\n#ifdef _KERNEL\n\n#ifdef NB_DEBUG\n#define NBDEBUG(format, args...)\t printf(\"%s(%d): \"format,\t\\\n\t\t\t\t\t    __func__ , __LINE__ ,## args)\n#else\n#define NBDEBUG(format, args...)\n#endif\n\nenum nbstate {\n\tNBST_CLOSED,\n\tNBST_RQSENT,\n\tNBST_SESSION,\n\tNBST_RETARGET,\n\tNBST_REFUSED\n};\n\n\n/*\n * socket specific data\n */\nstruct nbpcb {\n\tstruct smb_vc *\tnbp_vc;\n\tstruct socket *\tnbp_tso;\t/* transport socket */\n\tstruct sockaddr_nb *nbp_laddr;\t/* local address */\n\tstruct sockaddr_nb *nbp_paddr;\t/* peer address */\n\n\tint\t\tnbp_flags;\n#define\tNBF_LOCADDR\t0x0001\t\t/* has local addr */\n#define\tNBF_CONNECTED\t0x0002\n#define\tNBF_RECVLOCK\t0x0004\n\n\tenum nbstate\tnbp_state;\n\tstruct timespec\tnbp_timo;\n\tint\t\tnbp_sndbuf;\n\tint\t\tnbp_rcvbuf;\n\tvoid *\t\tnbp_selectid;\n\n/*\tLIST_ENTRY(nbpcb) nbp_link;*/\n};\n\n/*\n * Nominal space allocated per a NETBIOS socket.\n */\n#define\tNB_SNDQ\t\t(64 * 1024)\n#define\tNB_RCVQ\t\t(64 * 1024)\n\n/*\n * TCP slowstart presents a problem in conjunction with large\n * reads.  To ensure a steady stream of ACKs while reading using\n * large transaction sizes, we call soreceive() with a smaller\n * buffer size.  See nbssn_recv().\n */\n#define NB_SORECEIVE_CHUNK\t(8 * 1024)\n\nextern struct smb_tran_desc smb_tran_nbtcp_desc;\n\n#endif /* _KERNEL */\n\n#endif /* !_NETSMB_SMB_TRANTCP_H_ */\n"
  },
  {
    "path": "freebsd-headers/nfs/krpc.h",
    "content": "/*\t$NetBSD: krpc.h,v 1.4 1995/12/19 23:07:11 cgd Exp $\t*/\n/* $FreeBSD: release/9.0.0/sys/nfs/krpc.h 221032 2011-04-25 22:22:51Z rmacklem $\t*/\n\n#include <sys/cdefs.h>\n\nstruct mbuf;\nstruct thread;\nstruct sockaddr;\nstruct sockaddr_in;\n\nint krpc_call(struct sockaddr_in *_sin,\n\tu_int prog, u_int vers, u_int func,\n\tstruct mbuf **data, struct sockaddr **from, struct thread *td);\n\nint krpc_portmap(struct sockaddr_in *_sin,\n\tu_int prog, u_int vers, u_int16_t *portp, struct thread *td);\n\nstruct mbuf *xdr_string_encode(char *str, int len);\n\n/*\n * RPC definitions for the portmapper\n */\n#define\tPMAPPORT\t\t111\n#define\tPMAPPROG\t\t100000\n#define\tPMAPVERS\t\t2\n#define\tPMAPPROC_NULL\t\t0\n#define\tPMAPPROC_SET\t\t1\n#define\tPMAPPROC_UNSET\t\t2\n#define\tPMAPPROC_GETPORT\t3\n#define\tPMAPPROC_DUMP\t\t4\n#define\tPMAPPROC_CALLIT\t\t5\n"
  },
  {
    "path": "freebsd-headers/nfs/nfs_common.h",
    "content": "/*-\n * Copyright (c) 1989, 1993\n *\tThe Regents of the University of California.  All rights reserved.\n *\n * This code is derived from software contributed to Berkeley by\n * Rick Macklem at The University of Guelph.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 4. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t@(#)nfsm_subs.h\t8.2 (Berkeley) 3/30/95\n * $FreeBSD: release/9.0.0/sys/nfs/nfs_common.h 203732 2010-02-09 23:45:14Z marius $\n */\n\n#ifndef _NFS_NFS_COMMON_H_\n#define _NFS_NFS_COMMON_H_\n\nextern enum vtype nv3tov_type[];\nextern nfstype nfsv3_type[];\n\n#define\tvtonfsv2_mode(t, m) \\\n    txdr_unsigned(((t) == VFIFO) ? MAKEIMODE(VCHR, (m)) : MAKEIMODE((t), (m)))\n\n#define\tnfsv3tov_type(a)\tnv3tov_type[fxdr_unsigned(u_int32_t,(a))&0x7]\n#define\tvtonfsv3_type(a)\ttxdr_unsigned(nfsv3_type[((int32_t)(a))])\n\nint\tnfs_adv(struct mbuf **, caddr_t *, int, int);\nu_quad_t nfs_curusec(void);\nvoid\t*nfsm_disct(struct mbuf **, caddr_t *, int, int, int);\nint\tnfs_realign(struct mbuf **, int);\n\n/* ****************************** */\n/* Build request/reply phase macros */\n\nvoid\t*nfsm_build_xx(int s, struct mbuf **mb, caddr_t *bpos);\n\n#define\tnfsm_build(c, s) \\\n\t(c)nfsm_build_xx((s), &mb, &bpos)\n\n/* ****************************** */\n/* Interpretation phase macros */\n\nvoid\t*nfsm_dissect_xx(int s, struct mbuf **md, caddr_t *dpos);\nvoid\t*nfsm_dissect_xx_nonblock(int s, struct mbuf **md, caddr_t *dpos);\nint\tnfsm_strsiz_xx(int *s, int m, struct mbuf **md, caddr_t *dpos);\nint\tnfsm_adv_xx(int s, struct mbuf **md, caddr_t *dpos);\n\n/* Error check helpers */\n#define nfsm_dcheck(t1, mrep) \\\ndo { \\\n\tif (t1 != 0) { \\\n\t\terror = t1; \\\n\t\tm_freem((mrep)); \\\n\t\t(mrep) = NULL; \\\n\t\tgoto nfsmout; \\\n\t} \\\n} while (0)\n\n#define nfsm_dcheckp(retp, mrep) \\\ndo { \\\n\tif (retp == NULL) { \\\n\t\terror = EBADRPC; \\\n\t\tm_freem((mrep)); \\\n\t\t(mrep) = NULL; \\\n\t\tgoto nfsmout; \\\n\t} \\\n} while (0)\n\n#define\tnfsm_dissect(c, s) \\\n({ \\\n\tvoid *ret; \\\n\tret = nfsm_dissect_xx((s), &md, &dpos); \\\n\tnfsm_dcheckp(ret, mrep); \\\n\t(c)ret; \\\n})\n\n#define\tnfsm_dissect_nonblock(c, s) \\\n({ \\\n\tvoid *ret; \\\n\tret = nfsm_dissect_xx_nonblock((s), &md, &dpos); \\\n\tnfsm_dcheckp(ret, mrep); \\\n\t(c)ret; \\\n})\n\n#define\tnfsm_strsiz(s,m) \\\ndo { \\\n\tint t1; \\\n\tt1 = nfsm_strsiz_xx(&(s), (m), &md, &dpos); \\\n\tnfsm_dcheck(t1, mrep); \\\n} while(0)\n\n#define nfsm_mtouio(p,s) \\\ndo {\\\n\tint32_t t1 = 0; \\\n\tif ((s) > 0) \\\n\t\tt1 = nfsm_mbuftouio(&md, (p), (s), &dpos); \\\n\tnfsm_dcheck(t1, mrep); \\\n} while (0)\n\n#define nfsm_rndup(a)\t(((a)+3)&(~0x3))\n\n#define\tnfsm_adv(s) \\\ndo { \\\n\tint t1; \\\n\tt1 = nfsm_adv_xx((s), &md, &dpos); \\\n\tnfsm_dcheck(t1, mrep); \\\n} while (0)\n\n#ifdef __NO_STRICT_ALIGNMENT\n#define nfsm_aligned(p, t)\t1\n#else\n#define nfsm_aligned(p, t)\t((((u_long)(p)) & (sizeof(t) - 1)) == 0)\n#endif\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/nfs/nfs_kdtrace.h",
    "content": "/*-\n * Copyright (c) 2009 Robert N. M. Watson\n * All rights reserved.\n *\n * This software was developed at the University of Cambridge Computer\n * Laboratory with support from a grant from Google, Inc.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/nfs/nfs_kdtrace.h 222813 2011-06-07 08:46:13Z attilio $\n */\n\n#ifndef _NFSCLIENT_NFS_KDTRACE_H_\n#define\t_NFSCLIENT_NFS_KDTRACE_H_\n\n#ifdef KDTRACE_HOOKS\n#include <sys/dtrace_bsd.h>\n\n/*\n * Definitions for NFS access cache probes.\n */\nextern uint32_t nfsclient_accesscache_flush_done_id;\nextern uint32_t nfsclient_accesscache_get_hit_id;\nextern uint32_t nfsclient_accesscache_get_miss_id;\nextern uint32_t nfsclient_accesscache_load_done_id;\n\n#define\tKDTRACE_NFS_ACCESSCACHE_FLUSH_DONE(vp)\tdo {\t\t\t\\\n\tif (dtrace_nfsclient_accesscache_flush_done_probe != NULL)\t\\\n\t\t(dtrace_nfsclient_accesscache_flush_done_probe)(\t\\\n\t\t    nfsclient_accesscache_flush_done_id, (vp));\t\t\\\n} while (0)\n\n#define\tKDTRACE_NFS_ACCESSCACHE_GET_HIT(vp, uid, mode)\tdo {\t\t\\\n\tif (dtrace_nfsclient_accesscache_get_hit_probe != NULL)\t\t\\\n\t\t(dtrace_nfsclient_accesscache_get_hit_probe)(\t\t\\\n\t\t    nfsclient_accesscache_get_hit_id, (vp), (uid),\t\\\n\t\t    (mode));\t\t\t\t\t\t\\\n} while (0)\n\t\n#define\tKDTRACE_NFS_ACCESSCACHE_GET_MISS(vp, uid, mode)\tdo {\t\t\\\n\tif (dtrace_nfsclient_accesscache_get_miss_probe != NULL)\t\\\n\t\t(dtrace_nfsclient_accesscache_get_miss_probe)(\t\t\\\n\t\t    nfsclient_accesscache_get_miss_id, (vp), (uid),\t\\\n\t\t    (mode));\t\t\t\t\t\t\\\n} while (0)\n\n#define\tKDTRACE_NFS_ACCESSCACHE_LOAD_DONE(vp, uid, rmode, error) do {\t\\\n\tif (dtrace_nfsclient_accesscache_load_done_probe != NULL)\t\\\n\t\t(dtrace_nfsclient_accesscache_load_done_probe)(\t\t\\\n\t\t    nfsclient_accesscache_load_done_id, (vp), (uid),\t\\\n\t\t    (rmode), (error));\t\t\t\t\t\\\n} while (0)\n\n/*\n * Definitions for NFS attribute cache probes.\n */\nextern uint32_t nfsclient_attrcache_flush_done_id;\nextern uint32_t nfsclient_attrcache_get_hit_id;\nextern uint32_t nfsclient_attrcache_get_miss_id;\nextern uint32_t nfsclient_attrcache_load_done_id;\n\n#define\tKDTRACE_NFS_ATTRCACHE_FLUSH_DONE(vp)\tdo {\t\t\t\\\n\tif (dtrace_nfsclient_attrcache_flush_done_probe != NULL)\t\\\n\t\t(dtrace_nfsclient_attrcache_flush_done_probe)(\t\t\\\n\t\t    nfsclient_attrcache_flush_done_id, (vp));\t\t\\\n} while (0)\n\n#define\tKDTRACE_NFS_ATTRCACHE_GET_HIT(vp, vap)\tdo {\t\t\t\\\n\tif (dtrace_nfsclient_attrcache_get_hit_probe != NULL)\t\t\\\n\t\t(dtrace_nfsclient_attrcache_get_hit_probe)(\t\t\\\n\t\t    nfsclient_attrcache_get_hit_id, (vp), (vap));\t\\\n} while (0)\n\n#define\tKDTRACE_NFS_ATTRCACHE_GET_MISS(vp)\tdo {\t\t\t\\\n\tif (dtrace_nfsclient_attrcache_get_miss_probe != NULL)\t\t\\\n\t\t(dtrace_nfsclient_attrcache_get_miss_probe)(\t\t\\\n\t\t\t    nfsclient_attrcache_get_miss_id, (vp));\t\\\n} while (0)\n\n#define\tKDTRACE_NFS_ATTRCACHE_LOAD_DONE(vp, vap, error)\tdo {\t\t\\\n\tif (dtrace_nfsclient_attrcache_load_done_probe != NULL)\t\t\\\n\t\t(dtrace_nfsclient_attrcache_load_done_probe)(\t\t\\\n\t\t    nfsclient_attrcache_load_done_id, (vp), (vap),\t\\\n\t\t    (error));\t\t\t\t\t\t\\\n} while (0)\n\n#else /* !KDTRACE_HOOKS */\n\n#define\tKDTRACE_NFS_ACCESSCACHE_FLUSH_DONE(vp)\n#define\tKDTRACE_NFS_ACCESSCACHE_GET_HIT(vp, uid, mode)\n#define\tKDTRACE_NFS_ACCESSCACHE_GET_MISS(vp, uid, mode)\n#define\tKDTRACE_NFS_ACCESSCACHE_LOAD_DONE(vp, uid, rmode, error)\n\n#define\tKDTRACE_NFS_ATTRCACHE_FLUSH_DONE(vp)\n#define\tKDTRACE_NFS_ATTRCACHE_GET_HIT(vp, vap)\n#define\tKDTRACE_NFS_ATTRCACHE_GET_MISS(vp)\n#define\tKDTRACE_NFS_ATTRCACHE_LOAD_DONE(vp, vap, error)\n\n#endif /* KDTRACE_HOOKS */\n\n#endif /* !_NFSCLIENT_NFS_KDTRACE_H_ */\n"
  },
  {
    "path": "freebsd-headers/nfs/nfs_lock.h",
    "content": "/*-\n * Copyright (c) 1998 Berkeley Software Design, Inc. All rights reserved.\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. Berkeley Software Design Inc's name may not be used to endorse or\n *    promote products derived from this software without specific prior\n *    written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY BERKELEY SOFTWARE DESIGN INC ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL BERKELEY SOFTWARE DESIGN INC BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *      from nfs_lock.h,v 2.2 1998/04/28 19:38:41 don Exp\n * $FreeBSD: release/9.0.0/sys/nfs/nfs_lock.h 214048 2010-10-19 00:20:00Z rmacklem $\n */\n\n/*\n * lockd uses the nfssvc system call to get the unique kernel services it needs.\n * It passes in a request structure with a version number at the start.\n * This prevents libc from needing to change if the information passed\n * between lockd and the kernel needs to change.\n *\n * If a structure changes, you must bump the version number.\n */\n\n/*\n * The fifo where the kernel writes requests for locks on remote NFS files,\n * and where lockd reads these requests.\n *\n */\n#define\t_PATH_NFSLCKDEV\t\"nfslock\"\n\n/*\n * This structure is used to uniquely identify the process which originated\n * a particular message to lockd.  A sequence number is used to differentiate\n * multiple messages from the same process.  A process start time is used to\n * detect the unlikely, but possible, event of the recycling of a pid.\n */\nstruct lockd_msg_ident {\n\tpid_t\t\tpid;            /* The process ID. */\n\tstruct timeval\tpid_start;\t/* Start time of process id */\n\tint\t\tmsg_seq;\t/* Sequence number of message */\n};\n\n#define LOCKD_MSG_VERSION\t3\n\n/*\n * The structure that the kernel hands us for each lock request.\n */\ntypedef struct __lock_msg {\n\tTAILQ_ENTRY(__lock_msg)\tlm_link;\t/* internal linkage */\n\tint\t\t\tlm_version;\t/* which version is this */\n\tstruct lockd_msg_ident\tlm_msg_ident;\t/* originator of the message */\n\tstruct flock\t\tlm_fl;             /* The lock request. */\n\tint\t\t\tlm_wait;           /* The F_WAIT flag. */\n\tint\t\t\tlm_getlk;\t\t/* is this a F_GETLK request */\n\tstruct sockaddr_storage lm_addr;\t\t/* The address. */\n\tint\t\t\tlm_nfsv3;\t\t/* If NFS version 3. */\n\tsize_t\t\t\tlm_fh_len;\t\t/* The file handle length. */\n\tstruct xucred\t\tlm_cred;\t\t/* user cred for lock req */\n\tu_int8_t\t\tlm_fh[NFSX_V3FHMAX];/* The file handle. */\n} LOCKD_MSG;\n\n#define LOCKD_ANS_VERSION\t1\n\nstruct lockd_ans {\n\tint\t\tla_vers;\n\tstruct lockd_msg_ident\tla_msg_ident;\t/* originator of the message */\n\tint\t\tla_errno;\n\tint\t\tla_set_getlk_pid;\t\t/* use returned pid */\n\tint\t\tla_getlk_pid;\t\t/* returned pid for F_GETLK */\n};\n\n#ifdef _KERNEL\nint\tnfs_dolock(struct vop_advlock_args *ap);\nextern\tvop_advlock_t *nfs_advlock_p;\nextern\tvop_reclaim_t *nfs_reclaim_p;\n#endif\n"
  },
  {
    "path": "freebsd-headers/nfs/nfs_mountcommon.h",
    "content": "/*-\n * Copyright (c) 2009 Rick Macklem, University of Guelph\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/nfs/nfs_mountcommon.h 216931 2011-01-03 20:37:31Z rmacklem $\n */\n\n#ifndef _NFS_MOUNTCOMMON_H_\n#define\t_NFS_MOUNTCOMMON_H_\n\n/*\n * The common fields of the nfsmount structure for the two clients\n * used by the nlm. It includes a function pointer that provides\n * a mechanism for getting the client specific info for an nfs vnode.\n */\ntypedef void\tnfs_getinfofromvp_ftype(struct vnode *, uint8_t *, size_t *,\n\t\t    struct sockaddr_storage *, int *, off_t *,\n\t\t    struct timeval *);\ntypedef int\tnfs_vinvalbuf_ftype(struct vnode *, int, struct thread *, int);\n\nstruct\tnfsmount_common {\n\tstruct mtx\tnmcom_mtx;\n\tint\tnmcom_flag;\t\t/* Flags for soft/hard... */\n\tint\tnmcom_state;\t\t/* Internal state flags */\n\tstruct\tmount *nmcom_mountp;\t/* Vfs structure for this filesystem */\n\tint\tnmcom_timeo;\t\t/* Init timer for NFSMNT_DUMBTIMR */\n\tint\tnmcom_retry;\t\t/* Max retries */\n\tchar\tnmcom_hostname[MNAMELEN];\t/* server's name */\n\tnfs_getinfofromvp_ftype\t*nmcom_getinfo;\t/* Get info from nfsnode */\n\tnfs_vinvalbuf_ftype\t*nmcom_vinvalbuf; /* Invalidate buffers */\n};\n\n#endif\t/* _NFS_MOUNTCOMMON_H_ */\n"
  },
  {
    "path": "freebsd-headers/nfs/nfsdiskless.h",
    "content": "/*-\n * Copyright (c) 1991, 1993\n *\tThe Regents of the University of California.  All rights reserved.\n *\n * This code is derived from software contributed to Berkeley by\n * Rick Macklem at The University of Guelph.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 4. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t@(#)nfsdiskless.h\t8.2 (Berkeley) 3/30/95\n * $FreeBSD: release/9.0.0/sys/nfs/nfsdiskless.h 221032 2011-04-25 22:22:51Z rmacklem $\n */\n\n#ifndef _NFSCLIENT_NFSDISKLESS_H_\n#define _NFSCLIENT_NFSDISKLESS_H_\n\n/*\n * Structure that must be initialized for a diskless nfs client.\n * This structure is used by nfs_mountroot() to set up the root vnode,\n * and to do a partial ifconfig(8) and route(8) so that the critical net\n * interface can communicate with the server.\n * The primary bootstrap is expected to fill in the appropriate fields before\n * starting the kernel.\n * Currently only works for AF_INET protocols.\n * NB: All fields are stored in net byte order to avoid hassles with\n * client/server byte ordering differences.\n */\n\n/*\n * I have defined a new structure that can handle an NFS Version 3 file handle\n * but the kernel still expects the old Version 2 one to be provided. The\n * changes required in nfs_vfsops.c for using the new are documented there in\n * comments. (I felt that breaking network booting code by changing this\n * structure would not be prudent at this time, since almost all servers are\n * still Version 2 anyhow.)\n */\nstruct nfsv3_diskless {\n\tstruct ifaliasreq myif;\t\t\t/* Default interface */\n\tstruct sockaddr_in mygateway;\t\t/* Default gateway */\n\tstruct nfs_args\troot_args;\t\t/* Mount args for root fs */\n\tint\t\troot_fhsize;\t\t/* Size of root file handle */\n\tu_char\t\troot_fh[NFSX_V3FHMAX];\t/* File handle of root dir */\n\tstruct sockaddr_in root_saddr;\t\t/* Address of root server */\n\tchar\t\troot_hostnam[MNAMELEN];\t/* Host name for mount pt */\n\tlong\t\troot_time;\t\t/* Timestamp of root fs */\n\tchar\t\tmy_hostnam[MAXHOSTNAMELEN]; /* Client host name */\n};\n\n/*\n * Old arguments to mount NFS\n */\nstruct onfs_args {\n\tstruct sockaddr\t*addr;\t\t/* file server address */\n\tint\t\taddrlen;\t/* length of address */\n\tint\t\tsotype;\t\t/* Socket type */\n\tint\t\tproto;\t\t/* and Protocol */\n\tu_char\t\t*fh;\t\t/* File handle to be mounted */\n\tint\t\tfhsize;\t\t/* Size, in bytes, of fh */\n\tint\t\tflags;\t\t/* flags */\n\tint\t\twsize;\t\t/* write size in bytes */\n\tint\t\trsize;\t\t/* read size in bytes */\n\tint\t\treaddirsize;\t/* readdir size in bytes */\n\tint\t\ttimeo;\t\t/* initial timeout in .1 secs */\n\tint\t\tretrans;\t/* times to retry send */\n\tint\t\tmaxgrouplist;\t/* Max. size of group list */\n\tint\t\treadahead;\t/* # of blocks to readahead */\n\tint\t\tleaseterm;\t/* Term (sec) of lease */\n\tint\t\tdeadthresh;\t/* Retrans threshold */\n\tchar\t\t*hostname;\t/* server's name */\n};\n\nstruct nfs_diskless {\n\tstruct ifaliasreq myif;\t\t\t/* Default interface */\n\tstruct sockaddr_in mygateway;\t\t/* Default gateway */\n\tstruct onfs_args root_args;\t\t/* Mount args for root fs */\n\tu_char\t\troot_fh[NFSX_V2FH];\t/* File handle of root dir */\n\tstruct sockaddr_in root_saddr;\t\t/* Address of root server */\n\tchar\t\troot_hostnam[MNAMELEN];\t/* Host name for mount pt */\n\tlong\t\troot_time;\t\t/* Timestamp of root fs */\n\tchar\t\tmy_hostnam[MAXHOSTNAMELEN]; /* Client host name */\n};\n\n#ifdef _KERNEL\nextern struct nfsv3_diskless nfsv3_diskless;\nextern struct nfs_diskless nfs_diskless;\nextern int\tnfs_diskless_valid;\nvoid bootpc_init(void);\nvoid nfs_setup_diskless(void);\nvoid nfs_parse_options(const char *, struct nfs_args *);\n#endif\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/nfs/nfsproto.h",
    "content": "/*-\n * Copyright (c) 1989, 1993\n *\tThe Regents of the University of California.  All rights reserved.\n *\n * This code is derived from software contributed to Berkeley by\n * Rick Macklem at The University of Guelph.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 4. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t@(#)nfsproto.h  8.2 (Berkeley) 3/30/95\n * $FreeBSD: release/9.0.0/sys/nfs/nfsproto.h 164725 2006-11-28 19:33:28Z rees $\n */\n\n#ifndef _NFS_NFSPROTO_H_\n#define _NFS_NFSPROTO_H_\n\n/*\n * nfs definitions as per the Version 2 and 3 specs\n */\n\n/*\n * Constants as defined in the Sun NFS Version 2 and 3 specs.\n * \"NFS: Network File System Protocol Specification\" RFC1094\n * and in the \"NFS: Network File System Version 3 Protocol\n * Specification\"\n */\n\n#define NFS_PORT\t2049\n#define\tNFS_PROG\t100003\n#define NFS_VER2\t2\n#define\tNFS_VER3\t3\n#define NFS_VER4\t4\n\n#define NFS_V2MAXDATA\t8192\n#define\tNFS_MAXDGRAMDATA 16384\n#define\tNFS_MAXDATA\t32768\n#define\tNFS_MAXPATHLEN\t1024\n#define\tNFS_MAXNAMLEN\t255\n#define\tNFS_MAXPKTHDR\t404\t/* XXXv4 this needs to be adjust for v4 */\n#define NFS_MAXPACKET\t(NFS_MAXPKTHDR + NFS_MAXDATA)\n#define\tNFS_MINPACKET\t20\n#define\tNFS_FABLKSIZE\t512\t/* Size in bytes of a block wrt fa_blocks */\n\n/* Stat numbers for rpc returns (version 2, 3 and 4) */\n#define\tNFS_OK\t\t\t0\n#define\tNFSERR_PERM\t\t1\n#define\tNFSERR_NOENT\t\t2\n#define\tNFSERR_IO\t\t5\n#define\tNFSERR_NXIO\t\t6\n#define\tNFSERR_ACCES\t\t13\n#define\tNFSERR_EXIST\t\t17\n#define\tNFSERR_XDEV\t\t18\t/* Version 3 only */\n#define\tNFSERR_NODEV\t\t19\n#define\tNFSERR_NOTDIR\t\t20\n#define\tNFSERR_ISDIR\t\t21\n#define\tNFSERR_INVAL\t\t22\t/* Version 3 only */\n#define\tNFSERR_FBIG\t\t27\n#define\tNFSERR_NOSPC\t\t28\n#define\tNFSERR_ROFS\t\t30\n#define\tNFSERR_MLINK\t\t31\t/* Version 3 only */\n#define\tNFSERR_NAMETOL\t\t63\n#define\tNFSERR_NOTEMPTY\t\t66\n#define\tNFSERR_DQUOT\t\t69\n#define\tNFSERR_STALE\t\t70\n#define\tNFSERR_REMOTE\t\t71\t/* Version 3 only */\n#define\tNFSERR_WFLUSH\t\t99\t/* Version 2 only */\n#define\tNFSERR_BADHANDLE\t10001\t/* The rest Version 3, 4 only */\n#define\tNFSERR_NOT_SYNC\t\t10002\n#define\tNFSERR_BAD_COOKIE\t10003\n#define\tNFSERR_NOTSUPP\t\t10004\n#define\tNFSERR_TOOSMALL\t\t10005\n#define\tNFSERR_SERVERFAULT\t10006\n#define\tNFSERR_BADTYPE\t\t10007\n#define\tNFSERR_JUKEBOX\t\t10008\n#define NFSERR_TRYLATER\t\tNFSERR_JUKEBOX\n#define\tNFSERR_SAME\t\t10009   /* The rest Version 4 only */\n#define\tNFSERR_DENIED\t\t10010\n#define\tNFSERR_EXPIRED\t\t10011\n#define\tNFSERR_LOCKED\t\t10012\n#define\tNFSERR_GRACE\t\t10013\n#define\tNFSERR_FHEXPIRED\t10014\n#define\tNFSERR_SHARDE_DENIED\t10015\n#define\tNFSERR_WRONGSEC\t\t10016\n#define\tNFSERR_CLID_INUSE\t10017\n#define\tNFSERR_RESOURCE\t\t10018\n#define\tNFSERR_MOVED\t\t10019\n#define\tNFSERR_NOFILEHANDLE\t10020\n#define\tNFSERR_MINOR_VERS_MISMATCH 10021\n#define\tNFSERR_STALE_CLIENTID\t10022\n#define\tNFSERR_STALE_STATEID\t10023\n#define\tNFSERR_OLD_STATEID\t10024\n#define\tNFSERR_BAD_STATEID\t10025\n#define\tNFSERR_BAD_SEQID\t10026\n#define\tNFSERR_NOT_SAME\t\t10027\n#define\tNFSERR_LOCK_RANGE\t10028\n#define\tNFSERR_SYMLINK\t\t10029\n#define\tNFSERR_READDIR_NOSPC\t10030\n#define\tNFSERR_LEASE_MOVED\t10031\n#define\tNFSERR_ATTRNOTSUPP\t10032\n#define\tNFSERR_NO_GRACE\t\t10033\n#define\tNFSERR_RECLAIM_BAD\t10034\n#define\tNFSERR_RECLAIM_CONFLICT\t10035\n#define\tNFSERR_BADXDR\t\t10036\n#define\tNFSERR_LOCKS_HELD\t10037\n#define\tNFSERR_OPENMODE\t\t10038\n#define\tNFSERR_BADOWNER\t\t10039\n#define\tNFSERR_BADCHAR\t\t10040\n#define\tNFSERR_BADNAME\t\t10041\n#define\tNFSERR_BAD_RANGE\t10042\n#define\tNFSERR_LOCK_NOTSUPP\t10043\n#define\tNFSERR_OP_ILLEGAL\t10044\n#define\tNFSERR_DEADLOCK\t\t10045\n#define\tNFSERR_FILE_OPEN\t10046\n#define\tNFSERR_STALEWRITEVERF\t30001\t/* Fake return for nfs_commit() */\n\n\n\n#define NFSERR_RETVOID\t\t0x20000000 /* Return void, not error */\n#define NFSERR_AUTHERR\t\t0x40000000 /* Mark an authentication error */\n#define NFSERR_RETERR\t\t0x80000000 /* Mark an error return for V3 */\n\n/* Sizes in bytes of various nfs rpc components */\n#define\tNFSX_UNSIGNED\t4\n\n/* specific to NFS Version 2 */\n#define\tNFSX_V2FH\t32\n#define\tNFSX_V2FATTR\t68\n#define\tNFSX_V2SATTR\t32\n#define\tNFSX_V2COOKIE\t4\n#define NFSX_V2STATFS\t20\n\n/* specific to NFS Version 3 */\n#define NFSX_V3FH\t\t(sizeof (fhandle_t)) /* size this server uses */\n#define\tNFSX_V3FHMAX\t\t64\t/* max. allowed by protocol */\n#define NFSX_V3FATTR\t\t84\n#define NFSX_V3SATTR\t\t60\t/* max. all fields filled in */\n#define NFSX_V3SRVSATTR\t\t(sizeof (struct nfsv3_sattr))\n#define NFSX_V3POSTOPATTR\t(NFSX_V3FATTR + NFSX_UNSIGNED)\n#define NFSX_V3WCCDATA\t\t(NFSX_V3POSTOPATTR + 8 * NFSX_UNSIGNED)\n#define NFSX_V3COOKIEVERF \t8\n#define NFSX_V3WRITEVERF \t8\n#define NFSX_V3CREATEVERF\t8\n#define NFSX_V3STATFS\t\t52\n#define NFSX_V3FSINFO\t\t48\n#define NFSX_V3PATHCONF\t\t24\n\n/* specific to NFS Version 4 */\n#define NFSX_V4VERF\t\t8\n#define NFSX_V4FH\t\t128\n#define NFSX_V4STATEID\t\t16\n\n/* variants for both versions */\n#define NFSX_FH(v3)\t\t((v3) ? (NFSX_V3FHMAX + NFSX_UNSIGNED) : \\\n\t\t\t\t\tNFSX_V2FH)\n#define NFSX_SRVFH(v3)\t\t((v3) ? NFSX_V3FH : NFSX_V2FH)\n#define\tNFSX_FATTR(v3)\t\t((v3) ? NFSX_V3FATTR : NFSX_V2FATTR)\n#define NFSX_PREOPATTR(v3)\t((v3) ? (7 * NFSX_UNSIGNED) : 0)\n#define NFSX_POSTOPATTR(v3)\t((v3) ? (NFSX_V3FATTR + NFSX_UNSIGNED) : 0)\n#define NFSX_POSTOPORFATTR(v3)\t((v3) ? (NFSX_V3FATTR + NFSX_UNSIGNED) : \\\n\t\t\t\t\tNFSX_V2FATTR)\n#define NFSX_WCCDATA(v3)\t((v3) ? NFSX_V3WCCDATA : 0)\n#define NFSX_WCCORFATTR(v3)\t((v3) ? NFSX_V3WCCDATA : NFSX_V2FATTR)\n#define\tNFSX_SATTR(v3)\t\t((v3) ? NFSX_V3SATTR : NFSX_V2SATTR)\n#define\tNFSX_COOKIEVERF(v3)\t((v3) ? NFSX_V3COOKIEVERF : 0)\n#define\tNFSX_WRITEVERF(v3)\t((v3) ? NFSX_V3WRITEVERF : 0)\n#define NFSX_READDIR(v3)\t((v3) ? (5 * NFSX_UNSIGNED) : \\\n\t\t\t\t\t(2 * NFSX_UNSIGNED))\n#define\tNFSX_STATFS(v3)\t\t((v3) ? NFSX_V3STATFS : NFSX_V2STATFS)\n\n/* nfs rpc procedure numbers (before version mapping) */\n#define\tNFSPROC_NULL\t\t0\n#define\tNFSPROC_GETATTR\t\t1\n#define\tNFSPROC_SETATTR\t\t2\n#define\tNFSPROC_LOOKUP\t\t3\n#define\tNFSPROC_ACCESS\t\t4\n#define\tNFSPROC_READLINK\t5\n#define\tNFSPROC_READ\t\t6\n#define\tNFSPROC_WRITE\t\t7\n#define\tNFSPROC_CREATE\t\t8\n#define\tNFSPROC_MKDIR\t\t9\n#define\tNFSPROC_SYMLINK\t\t10\n#define\tNFSPROC_MKNOD\t\t11\n#define\tNFSPROC_REMOVE\t\t12\n#define\tNFSPROC_RMDIR\t\t13\n#define\tNFSPROC_RENAME\t\t14\n#define\tNFSPROC_LINK\t\t15\n#define\tNFSPROC_READDIR\t\t16\n#define\tNFSPROC_READDIRPLUS\t17\n#define\tNFSPROC_FSSTAT\t\t18\n#define\tNFSPROC_FSINFO\t\t19\n#define\tNFSPROC_PATHCONF\t20\n#define\tNFSPROC_COMMIT\t\t21\n#define NFSPROC_NOOP\t\t22\n#define\tNFS_NPROCS\t\t23\n\n/* Actual Version 2 procedure numbers */\n#define\tNFSV2PROC_NULL\t\t0\n#define\tNFSV2PROC_GETATTR\t1\n#define\tNFSV2PROC_SETATTR\t2\n#define\tNFSV2PROC_NOOP\t\t3\n#define\tNFSV2PROC_ROOT\t\tNFSV2PROC_NOOP\t/* Obsolete */\n#define\tNFSV2PROC_LOOKUP\t4\n#define\tNFSV2PROC_READLINK\t5\n#define\tNFSV2PROC_READ\t\t6\n#define\tNFSV2PROC_WRITECACHE\tNFSV2PROC_NOOP\t/* Obsolete */\n#define\tNFSV2PROC_WRITE\t\t8\n#define\tNFSV2PROC_CREATE\t9\n#define\tNFSV2PROC_REMOVE\t10\n#define\tNFSV2PROC_RENAME\t11\n#define\tNFSV2PROC_LINK\t\t12\n#define\tNFSV2PROC_SYMLINK\t13\n#define\tNFSV2PROC_MKDIR\t\t14\n#define\tNFSV2PROC_RMDIR\t\t15\n#define\tNFSV2PROC_READDIR\t16\n#define\tNFSV2PROC_STATFS\t17\n\n/* Version 4 procedure numbers */\n#define NFSV4PROC_NULL         0\n#define NFSV4PROC_COMPOUND     1\n\n/* Version 4 operation numbers */\n#define NFSV4OP_ACCESS\t\t3\n#define NFSV4OP_CLOSE\t\t4\n#define NFSV4OP_COMMIT\t\t5\n#define NFSV4OP_CREATE\t\t6\n#define NFSV4OP_DELEGPURGE\t7\n#define NFSV4OP_DELEGRETURN\t8\n#define NFSV4OP_GETATTR\t\t9\n#define NFSV4OP_GETFH\t\t10\n#define NFSV4OP_LINK\t\t11\n#define NFSV4OP_LOCK\t\t12\n#define NFSV4OP_LOCKT\t\t13\n#define NFSV4OP_LOCKU\t\t14\n#define NFSV4OP_LOOKUP\t\t15\n#define NFSV4OP_LOOKUPP\t\t16\n#define NFSV4OP_NVERIFY\t\t17\n#define NFSV4OP_OPEN\t\t18\n#define NFSV4OP_OPENATTR\t19\n#define NFSV4OP_OPEN_CONFIRM\t20\n#define NFSV4OP_OPEN_DOWNGRADE\t21\n#define NFSV4OP_PUTFH\t\t22\n#define NFSV4OP_PUTPUBFH\t23\n#define NFSV4OP_PUTROOTFH\t24\n#define NFSV4OP_READ\t\t25\n#define NFSV4OP_READDIR\t\t26\n#define NFSV4OP_READLINK\t27\n#define NFSV4OP_REMOVE\t\t28\n#define NFSV4OP_RENAME\t\t29\n#define NFSV4OP_RENEW\t\t30\n#define NFSV4OP_RESTOREFH\t31\n#define NFSV4OP_SAVEFH\t\t32\n#define NFSV4OP_SECINFO\t\t33\n#define NFSV4OP_SETATTR\t\t34\n#define NFSV4OP_SETCLIENTID\t35\n#define NFSV4OP_SETCLIENTID_CONFIRM 36\n#define NFSV4OP_VERIFY\t\t37\n#define NFSV4OP_WRITE\t\t38\n\n/*\n * Constants used by the Version 3 protocol for various RPCs\n */\n#define NFSV3SATTRTIME_DONTCHANGE\t0\n#define NFSV3SATTRTIME_TOSERVER\t\t1\n#define NFSV3SATTRTIME_TOCLIENT\t\t2\n\n#define NFSV3ACCESS_READ\t\t0x01\n#define NFSV3ACCESS_LOOKUP\t\t0x02\n#define NFSV3ACCESS_MODIFY\t\t0x04\n#define NFSV3ACCESS_EXTEND\t\t0x08\n#define NFSV3ACCESS_DELETE\t\t0x10\n#define NFSV3ACCESS_EXECUTE\t\t0x20\n\n#define NFSV3WRITE_UNSTABLE\t\t0\n#define NFSV3WRITE_DATASYNC\t\t1\n#define NFSV3WRITE_FILESYNC\t\t2\n\n#define NFSV3CREATE_UNCHECKED\t\t0\n#define NFSV3CREATE_GUARDED\t\t1\n#define NFSV3CREATE_EXCLUSIVE\t\t2\n\n#define NFSV3FSINFO_LINK\t\t0x01\n#define NFSV3FSINFO_SYMLINK\t\t0x02\n#define NFSV3FSINFO_HOMOGENEOUS\t\t0x08\n#define NFSV3FSINFO_CANSETTIME\t\t0x10\n\n/*\n * Constants used by the Version 4 protocol for various RPCs\n */\n\n#define NFSV4ACCESS_READ\t\t0x01\n#define NFSV4ACCESS_LOOKUP\t\t0x02\n#define NFSV4ACCESS_MODIFY\t\t0x04\n#define NFSV4ACCESS_EXTEND\t\t0x08\n#define NFSV4ACCESS_DELETE\t\t0x10\n#define NFSV4ACCESS_EXECUTE\t\t0x20\n\n#define NFSV4OPENRES_MLOCK\t\t0x01\n#define NFSV4OPENRES_CONFIRM\t\t0x02\n\n#define NFSV4OPENSHARE_ACCESS_READ\t0x01\n#define NFSV4OPENSHARE_ACCESS_WRITE\t0x02\n#define NFSV4OPENSHARE_ACCESS_BOTH\t0x03\n#define NFSV4OPENSHARE_DENY_NONE\t0x00\n#define NFSV4OPENSHARE_DENY_READ\t0x01\n#define NFSV4OPENSHARE_DENY_WRITE\t0x02\n#define NFSV4OPENSHARE_DENY_BOTH\t0x03\n\n/* File types */\ntypedef enum {\n\tNFNON=0,\n\tNFREG=1,\n\tNFDIR=2,\n\tNFBLK=3,\n\tNFCHR=4,\n\tNFLNK=5,\n\tNFSOCK=6,\n\tNFFIFO=7,\n\tNFATTRDIR = 8,\n\tNFNAMEDATTR = 9,\n\tNFBAD = 10,\n} nfstype;\t\n\n/* NFSv4 claim type */\ntypedef enum {\n\tNCLNULL = 0,\n\tNCLPREV = 1,\n\tNCLDELEGCUR = 2,\n\tNCLDELEGPREV = 3,\n} nfsv4cltype;\n\n/* Other NFSv4 types */\ntypedef enum {\n\tNSHUNSTABLE = 0,\n\tNSHDATASYNC = 1,\n\tNSHFILESYNC = 2,\n} nfsv4stablehow;\n\ntypedef enum { OTNOCREATE = 0, OTCREATE = 1 } nfsv4opentype;\ntypedef enum { CMUNCHECKED = 0, CMGUARDED = 1, CMEXCLUSIVE = 2 } nfsv4createmode;\ntypedef enum { THSERVERTIME = 0, THCLIENTTIME = 1 } nfsv4timehow;\ntypedef enum { ODNONE = 0, ODREAD = 1, ODWRITE = 2 } nfsv4opendelegtype;\n\n/* Structs for common parts of the rpc's */\n\n/*\n * File Handle (32 bytes for version 2), variable up to 64 for version 3.\n * File Handles of up to NFS_SMALLFH in size are stored directly in the\n * nfs node, whereas larger ones are malloc'd. (This never happens when\n * NFS_SMALLFH is set to 64.)\n * NFS_SMALLFH should be in the range of 32 to 64 and be divisible by 4.\n */\n#ifndef NFS_SMALLFH\n#define NFS_SMALLFH\t128\n#endif\nunion nfsfh {\n\tfhandle_t\tfh_generic;\n\tu_char\t\tfh_bytes[NFS_SMALLFH];\n};\ntypedef union nfsfh nfsfh_t;\n\nstruct nfsv2_time {\n\tu_int32_t\tnfsv2_sec;\n\tu_int32_t\tnfsv2_usec;\n};\ntypedef struct nfsv2_time\tnfstime2;\n\nstruct nfsv3_time {\n\tu_int32_t\tnfsv3_sec;\n\tu_int32_t\tnfsv3_nsec;\n};\ntypedef struct nfsv3_time\tnfstime3;\n\n/*\n * Quads are defined as arrays of 2 longs to ensure dense packing for the\n * protocol and to facilitate xdr conversion.\n */\nstruct nfs_uquad {\n\tu_int32_t\tnfsuquad[2];\n};\ntypedef\tstruct nfs_uquad\tnfsuint64;\n\n/*\n * Used to convert between two u_longs and a u_quad_t.\n */\nunion nfs_quadconvert {\n\tu_int32_t\tlval[2];\n\tu_quad_t\tqval;\n};\ntypedef union nfs_quadconvert\tnfsquad_t;\n\n/*\n * NFS Version 3 special file number.\n */\nstruct nfsv3_spec {\n\tu_int32_t\tspecdata1;\n\tu_int32_t\tspecdata2;\n};\ntypedef\tstruct nfsv3_spec\tnfsv3spec;\n\n/*\n * NFS Version 4 bitmap.\n */\nstruct nfsv4_bitmap {\n\tuint32_t\tbmlen;\n\tuint32_t\t*bmval;\n};\ntypedef struct nfsv4_bitmap nfsv4bitmap;\n\nstruct nfsv4_changeinfo {\n\tu_int\t\tciatomic;\n\tuint64_t\tcibefore;\n\tuint64_t\tciafter;\n};\ntypedef struct nfsv4_changeinfo nfsv4changeinfo;\n\n/*\n * File attributes and setable attributes. These structures cover both\n * NFS version 2 and the version 3 protocol. Note that the union is only\n * used so that one pointer can refer to both variants. These structures\n * go out on the wire and must be densely packed, so no quad data types\n * are used. (all fields are longs or u_longs or structures of same)\n * NB: You can't do sizeof(struct nfs_fattr), you must use the\n *     NFSX_FATTR(v3) macro.\n */\nstruct nfs_fattr {\n\tu_int32_t\tfa_type;\n\tu_int32_t\tfa_mode;\n\tu_int32_t\tfa_nlink;\n\tu_int32_t\tfa_uid;\n\tu_int32_t\tfa_gid;\n\tunion {\n\t\tstruct {\n\t\t\tu_int32_t\tnfsv2fa_size;\n\t\t\tu_int32_t\tnfsv2fa_blocksize;\n\t\t\tu_int32_t\tnfsv2fa_rdev;\n\t\t\tu_int32_t\tnfsv2fa_blocks;\n\t\t\tu_int32_t\tnfsv2fa_fsid;\n\t\t\tu_int32_t\tnfsv2fa_fileid;\n\t\t\tnfstime2\tnfsv2fa_atime;\n\t\t\tnfstime2\tnfsv2fa_mtime;\n\t\t\tnfstime2\tnfsv2fa_ctime;\n\t\t} fa_nfsv2;\n\t\tstruct {\n\t\t\tnfsuint64\tnfsv3fa_size;\n\t\t\tnfsuint64\tnfsv3fa_used;\n\t\t\tnfsv3spec\tnfsv3fa_rdev;\n\t\t\tnfsuint64\tnfsv3fa_fsid;\n\t\t\tnfsuint64\tnfsv3fa_fileid;\n\t\t\tnfstime3\tnfsv3fa_atime;\n\t\t\tnfstime3\tnfsv3fa_mtime;\n\t\t\tnfstime3\tnfsv3fa_ctime;\n\t\t} fa_nfsv3;\n\t} fa_un;\n};\n\n/* and some ugly defines for accessing union components */\n#define\tfa2_size\t\tfa_un.fa_nfsv2.nfsv2fa_size\n#define\tfa2_blocksize\t\tfa_un.fa_nfsv2.nfsv2fa_blocksize\n#define\tfa2_rdev\t\tfa_un.fa_nfsv2.nfsv2fa_rdev\n#define\tfa2_blocks\t\tfa_un.fa_nfsv2.nfsv2fa_blocks\n#define\tfa2_fsid\t\tfa_un.fa_nfsv2.nfsv2fa_fsid\n#define\tfa2_fileid\t\tfa_un.fa_nfsv2.nfsv2fa_fileid\n#define\tfa2_atime\t\tfa_un.fa_nfsv2.nfsv2fa_atime\n#define\tfa2_mtime\t\tfa_un.fa_nfsv2.nfsv2fa_mtime\n#define\tfa2_ctime\t\tfa_un.fa_nfsv2.nfsv2fa_ctime\n#define\tfa3_size\t\tfa_un.fa_nfsv3.nfsv3fa_size\n#define\tfa3_used\t\tfa_un.fa_nfsv3.nfsv3fa_used\n#define\tfa3_rdev\t\tfa_un.fa_nfsv3.nfsv3fa_rdev\n#define\tfa3_fsid\t\tfa_un.fa_nfsv3.nfsv3fa_fsid\n#define\tfa3_fileid\t\tfa_un.fa_nfsv3.nfsv3fa_fileid\n#define\tfa3_atime\t\tfa_un.fa_nfsv3.nfsv3fa_atime\n#define\tfa3_mtime\t\tfa_un.fa_nfsv3.nfsv3fa_mtime\n#define\tfa3_ctime\t\tfa_un.fa_nfsv3.nfsv3fa_ctime\n\nstruct nfsv4_fattr {\n\tu_int\t\tfa4_valid;\n\tnfstype\t\tfa4_type;\n\toff_t\t\tfa4_size;\n\tuint64_t\tfa4_fsid_major;\n\tuint64_t\tfa4_fsid_minor;\n\tuint64_t\tfa4_fileid;\n\tmode_t\t\tfa4_mode;\n\tnlink_t\t\tfa4_nlink;\n\tuid_t\t\tfa4_uid;\n\tgid_t\t\tfa4_gid;\n\tuint32_t\tfa4_rdev_major;\n\tuint32_t\tfa4_rdev_minor;\n\tstruct timespec\tfa4_atime;\n\tstruct timespec\tfa4_btime;\n\tstruct timespec\tfa4_ctime;\n\tstruct timespec\tfa4_mtime;\n\tuint64_t\tfa4_maxread;\n\tuint64_t\tfa4_maxwrite;\n\tuint64_t\tfa4_ffree;\n\tuint64_t\tfa4_ftotal;\n\tuint32_t\tfa4_maxname;\n\tuint64_t\tfa4_savail;\n\tuint64_t\tfa4_sfree;\n\tuint64_t\tfa4_stotal;\n\tuint64_t\tfa4_changeid;\n\tuint32_t\tfa4_lease_time;\n\tuint64_t\tfa4_maxfilesize;\n};\n\n/* Flags for fa4_valid */\n#define FA4V_SIZE\t0x00000001\n#define FA4V_FSID\t0x00000002\n#define FA4V_FILEID\t0x00000004\n#define FA4V_MODE\t0x00000008\n#define FA4V_NLINK\t0x00000010\n#define FA4V_UID\t0x00000020\n#define FA4V_GID\t0x00000040\n#define FA4V_RDEV\t0x00000080\n#define FA4V_ATIME\t0x00000100\n#define FA4V_BTIME\t0x00000200\n#define FA4V_CTIME\t0x00000400\n#define FA4V_MTIME\t0x00000800\n#define FA4V_MAXREAD\t0x00001000\n#define FA4V_MAXWRITE\t0x00002000\n#define FA4V_TYPE\t0x00004000\n#define FA4V_FFREE\t0x00008000\n#define FA4V_FTOTAL\t0x00010000\n#define FA4V_MAXNAME\t0x00020000\n#define FA4V_SAVAIL\t0x00040000\n#define FA4V_SFREE\t0x00080000\n#define FA4V_STOTAL\t0x00100000\n#define FA4V_CHANGEID\t0x00200000\n#define FA4V_LEASE_TIME\t0x00400000\n#define FA4V_MAXFILESIZE 0x00800000\n#define FA4V_ACL\t0x01000000\n\n/* Offsets into bitmask */\n#define FA4_SUPPORTED_ATTRS\t0\n#define FA4_TYPE\t\t1\n#define FA4_FH_EXPIRE_TYPE\t2\n#define FA4_CHANGE\t\t3\n#define FA4_SIZE\t\t4\n#define FA4_LINK_SUPPORT\t5\n#define FA4_SYMLINK_SUPPORT\t6\n#define FA4_NAMED_ATTR\t\t7\n#define FA4_FSID\t\t8\n#define FA4_UNIQUE_HANDLES\t9\n#define FA4_LEASE_TIME\t\t10\n#define FA4_RDATTR_ERROR\t11\n#define FA4_ACL\t\t\t12\n#define FA4_ACLSUPPORT\t\t13\n#define FA4_ARCHIVE\t\t14\n#define FA4_CANSETTIME\t\t15\n#define FA4_CASE_INSENSITIVE\t16\n#define FA4_CASE_PRESERVING\t17 \n#define FA4_CHOWN_RESTRICTED\t18\n#define FA4_FILEHANDLE\t\t19\n#define FA4_FILEID\t\t20\n#define FA4_FILES_AVAIL\t\t21\n#define FA4_FILES_FREE\t\t22\n#define FA4_FILES_TOTAL\t\t23\n#define FA4_FS_LOCATIONS\t24\n#define FA4_HIDDEN\t\t25\n#define FA4_HOMOGENEOUS\t\t26\n#define FA4_MAXFILESIZE\t\t27\n#define FA4_MAXLINK\t\t28\n#define FA4_MAXNAME\t\t29\n#define FA4_MAXREAD\t\t30\n#define FA4_MAXWRITE\t\t31\n#define FA4_MIMETYPE\t\t32\n#define FA4_MODE\t\t33\n#define FA4_NO_TRUNC\t\t34\n#define FA4_NUMLINKS\t\t35\n#define FA4_OWNER\t\t36\n#define FA4_OWNER_GROUP\t\t37\n#define FA4_QUOTA_HARD\t\t38\n#define FA4_QUOTA_SOFT\t\t39\n#define FA4_QUOTA_USED\t\t40\n#define FA4_RAWDEV\t\t41\n#define FA4_SPACE_AVAIL\t\t42\n#define FA4_SPACE_FREE\t\t43\n#define FA4_SPACE_TOTAL\t\t44\n#define FA4_SPACE_USED\t\t45\n#define FA4_SYSTEM\t\t46\n#define FA4_TIME_ACCESS\t\t47\n#define FA4_TIME_ACCESS_SET\t48\n#define FA4_TIME_BACKUP\t\t49\n#define FA4_TIME_CREATE\t\t50\n#define FA4_TIME_DELTA\t\t51\n#define FA4_TIME_METADATA\t52\n#define FA4_TIME_MODIFY\t\t53\n#define FA4_TIME_MODIFY_SET\t54\n#define FA4_ATTR_MAX\t\t55\n\n/* Macros for v4 fattr manipulation */\n#define FA4_SET(n, p)\t((p)[(n)/32] |= (1 << ((n) % 32)))\n#define FA4_CLR(n, p)\t((p)[(n)/32] &= ~(1 << ((n) % 32)))\n#define FA4_ISSET(n, p)\t((p)[(n)/32] & (1 << ((n) % 32)))\n#define FA4_ZERO(p)\tbzero((p), 8)\n#define FA4_SKIP(p)\t((p) += 2)\n\nstruct nfsv2_sattr {\n\tu_int32_t\tsa_mode;\n\tu_int32_t\tsa_uid;\n\tu_int32_t\tsa_gid;\n\tu_int32_t\tsa_size;\n\tnfstime2\tsa_atime;\n\tnfstime2\tsa_mtime;\n};\n\n/*\n * NFS Version 3 sattr structure for the new node creation case.\n */\nstruct nfsv3_sattr {\n\tu_int32_t\tsa_modetrue;\n\tu_int32_t\tsa_mode;\n\tu_int32_t\tsa_uidfalse;\n\tu_int32_t\tsa_gidfalse;\n\tu_int32_t\tsa_sizefalse;\n\tu_int32_t\tsa_atimetype;\n\tnfstime3\tsa_atime;\n\tu_int32_t\tsa_mtimetype;\n\tnfstime3\tsa_mtime;\n};\n\nstruct nfs_statfs {\n\tunion {\n\t\tstruct {\n\t\t\tu_int32_t\tnfsv2sf_tsize;\n\t\t\tu_int32_t\tnfsv2sf_bsize;\n\t\t\tu_int32_t\tnfsv2sf_blocks;\n\t\t\tu_int32_t\tnfsv2sf_bfree;\n\t\t\tu_int32_t\tnfsv2sf_bavail;\n\t\t} sf_nfsv2;\n\t\tstruct {\n\t\t\tnfsuint64\tnfsv3sf_tbytes;\n\t\t\tnfsuint64\tnfsv3sf_fbytes;\n\t\t\tnfsuint64\tnfsv3sf_abytes;\n\t\t\tnfsuint64\tnfsv3sf_tfiles;\n\t\t\tnfsuint64\tnfsv3sf_ffiles;\n\t\t\tnfsuint64\tnfsv3sf_afiles;\n\t\t\tu_int32_t\tnfsv3sf_invarsec;\n\t\t} sf_nfsv3;\n\t} sf_un;\n};\n\n#define sf_tsize\tsf_un.sf_nfsv2.nfsv2sf_tsize\n#define sf_bsize\tsf_un.sf_nfsv2.nfsv2sf_bsize\n#define sf_blocks\tsf_un.sf_nfsv2.nfsv2sf_blocks\n#define sf_bfree\tsf_un.sf_nfsv2.nfsv2sf_bfree\n#define sf_bavail\tsf_un.sf_nfsv2.nfsv2sf_bavail\n#define sf_tbytes\tsf_un.sf_nfsv3.nfsv3sf_tbytes\n#define sf_fbytes\tsf_un.sf_nfsv3.nfsv3sf_fbytes\n#define sf_abytes\tsf_un.sf_nfsv3.nfsv3sf_abytes\n#define sf_tfiles\tsf_un.sf_nfsv3.nfsv3sf_tfiles\n#define sf_ffiles\tsf_un.sf_nfsv3.nfsv3sf_ffiles\n#define sf_afiles\tsf_un.sf_nfsv3.nfsv3sf_afiles\n#define sf_invarsec\tsf_un.sf_nfsv3.nfsv3sf_invarsec\n\nstruct nfsv3_fsinfo {\n\tu_int32_t\tfs_rtmax;\n\tu_int32_t\tfs_rtpref;\n\tu_int32_t\tfs_rtmult;\n\tu_int32_t\tfs_wtmax;\n\tu_int32_t\tfs_wtpref;\n\tu_int32_t\tfs_wtmult;\n\tu_int32_t\tfs_dtpref;\n\tnfsuint64\tfs_maxfilesize;\n\tnfstime3\tfs_timedelta;\n\tu_int32_t\tfs_properties;\n};\n\nstruct nfsv3_pathconf {\n\tu_int32_t\tpc_linkmax;\n\tu_int32_t\tpc_namemax;\n\tu_int32_t\tpc_notrunc;\n\tu_int32_t\tpc_chownrestricted;\n\tu_int32_t\tpc_caseinsensitive;\n\tu_int32_t\tpc_casepreserving;\n};\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/nfs/nfssvc.h",
    "content": "/*-\n * Copyright (c) 1989, 1993, 1995\n *\tThe Regents of the University of California.  All rights reserved.\n *\n * This code is derived from software contributed to Berkeley by\n * Rick Macklem at The University of Guelph.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 4. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/nfs/nfssvc.h 221439 2011-05-04 13:36:18Z rmacklem $\n */\n\n#ifndef _NFS_NFSSVC_H_\n#define _NFS_NFSSVC_H_\n\n/*\n * Flags for nfssvc() system call.\n */\n#define\tNFSSVC_OLDNFSD\t0x004\n#define\tNFSSVC_ADDSOCK\t0x008\n#define\tNFSSVC_NFSD\t0x010\n\n/*\n * and ones for nfsv4.\n */\n#define\tNFSSVC_NOPUBLICFH\t0x00000020\n#define\tNFSSVC_STABLERESTART\t0x00000040\n#define\tNFSSVC_NFSDNFSD\t\t0x00000080\n#define\tNFSSVC_NFSDADDSOCK\t0x00000100\n#define\tNFSSVC_IDNAME\t\t0x00000200\n#define\tNFSSVC_GSSDDELETEALL\t0x00000400\n#define\tNFSSVC_GSSDADDPORT\t0x00000800\n#define\tNFSSVC_NFSUSERDPORT\t0x00001000\n#define\tNFSSVC_NFSUSERDDELPORT\t0x00002000\n#define\tNFSSVC_V4ROOTEXPORT\t0x00004000\n#define\tNFSSVC_ADMINREVOKE\t0x00008000\n#define\tNFSSVC_DUMPCLIENTS\t0x00010000\n#define\tNFSSVC_DUMPLOCKS\t0x00020000\n#define\tNFSSVC_GSSDADDFIRST\t0x00040000\n#define\tNFSSVC_PUBLICFH\t\t0x00080000\n#define\tNFSSVC_NFSCBD\t\t0x00100000\n#define\tNFSSVC_CBADDSOCK\t0x00200000\n#define\tNFSSVC_GETSTATS\t\t0x00400000\n#define\tNFSSVC_BACKUPSTABLE\t0x00800000\n#define\tNFSSVC_ZEROCLTSTATS\t0x01000000\t/* modifier for GETSTATS */\n#define\tNFSSVC_ZEROSRVSTATS\t0x02000000\t/* modifier for GETSTATS */\n\n#endif /* _NFS_NFSSVC_H */\n"
  },
  {
    "path": "freebsd-headers/nfs/xdr_subs.h",
    "content": "/*-\n * Copyright (c) 1989, 1993\n *\tThe Regents of the University of California.  All rights reserved.\n *\n * This code is derived from software contributed to Berkeley by\n * Rick Macklem at The University of Guelph.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 4. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t@(#)xdr_subs.h\t8.3 (Berkeley) 3/30/95\n * $FreeBSD: release/9.0.0/sys/nfs/xdr_subs.h 139823 2005-01-07 01:45:51Z imp $\n */\n\n\n#ifndef _NFS_XDR_SUBS_H_\n#define _NFS_XDR_SUBS_H_\n\n/*\n * Macros used for conversion to/from xdr representation by nfs...\n * These use the MACHINE DEPENDENT routines ntohl, htonl\n * As defined by \"XDR: External Data Representation Standard\" RFC1014\n *\n * To simplify the implementation, we use ntohl/htonl even on big-endian\n * machines, and count on them being `#define'd away.  Some of these\n * might be slightly more efficient as quad_t copies on a big-endian,\n * but we cannot count on their alignment anyway.\n */\n\n#define\tfxdr_unsigned(t, v)\t((t)ntohl((int32_t)(v)))\n#define\ttxdr_unsigned(v)\t(htonl((int32_t)(v)))\n\n#define\tfxdr_nfsv2time(f, t) \\\ndo { \\\n\t(t)->tv_sec = ntohl(((struct nfsv2_time *)(f))->nfsv2_sec); \\\n\tif (((struct nfsv2_time *)(f))->nfsv2_usec != 0xffffffff) \\\n\t\t(t)->tv_nsec = 1000 * ntohl(((struct nfsv2_time *)(f))->nfsv2_usec); \\\n\telse \\\n\t\t(t)->tv_nsec = 0; \\\n} while (0)\n#define\ttxdr_nfsv2time(f, t) \\\ndo { \\\n\t((struct nfsv2_time *)(t))->nfsv2_sec = htonl((f)->tv_sec); \\\n\tif ((f)->tv_nsec != -1) \\\n\t\t((struct nfsv2_time *)(t))->nfsv2_usec = htonl((f)->tv_nsec / 1000); \\\n\telse \\\n\t\t((struct nfsv2_time *)(t))->nfsv2_usec = 0xffffffff; \\\n} while (0)\n\n#define\tfxdr_nfsv3time(f, t) \\\ndo { \\\n\t(t)->tv_sec = ntohl(((struct nfsv3_time *)(f))->nfsv3_sec); \\\n\t(t)->tv_nsec = ntohl(((struct nfsv3_time *)(f))->nfsv3_nsec); \\\n} while (0)\n#define\ttxdr_nfsv3time(f, t) \\\ndo { \\\n\t((struct nfsv3_time *)(t))->nfsv3_sec = htonl((f)->tv_sec); \\\n\t((struct nfsv3_time *)(t))->nfsv3_nsec = htonl((f)->tv_nsec); \\\n} while (0)\n\n#define\tfxdr_hyper(f) \\\n\t((((u_quad_t)ntohl(((u_int32_t *)(f))[0])) << 32) | \\\n\t (u_quad_t)(ntohl(((u_int32_t *)(f))[1])))\n#define\ttxdr_hyper(f, t) \\\ndo { \\\n\t((u_int32_t *)(t))[0] = htonl((u_int32_t)((f) >> 32)); \\\n\t((u_int32_t *)(t))[1] = htonl((u_int32_t)((f) & 0xffffffff)); \\\n} while (0)\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/nfsclient/nfs.h",
    "content": "/*-\n * Copyright (c) 1989, 1993, 1995\n *\tThe Regents of the University of California.  All rights reserved.\n *\n * This code is derived from software contributed to Berkeley by\n * Rick Macklem at The University of Guelph.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 4. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t@(#)nfs.h\t8.4 (Berkeley) 5/1/95\n * $FreeBSD: release/9.0.0/sys/nfsclient/nfs.h 221986 2011-05-16 13:12:09Z rmacklem $\n */\n\n#ifndef _NFSCLIENT_NFS_H_\n#define _NFSCLIENT_NFS_H_\n\n#ifdef _KERNEL\n#include \"opt_nfs.h\"\n#endif\n\n#include <nfsclient/nfsargs.h>\n\n/*\n * Tunable constants for nfs\n */\n\n#define NFS_TICKINTVL\t10\t\t/* Desired time for a tick (msec) */\n#define NFS_HZ\t\t(hz / nfs_ticks) /* Ticks/sec */\n#define\tNFS_TIMEO\t(1 * NFS_HZ)\t/* Default timeout = 1 second */\n#define\tNFS_MINTIMEO\t(1 * NFS_HZ)\t/* Min timeout to use */\n#define\tNFS_MAXTIMEO\t(60 * NFS_HZ)\t/* Max timeout to backoff to */\n#define\tNFS_MINIDEMTIMEO (5 * NFS_HZ)\t/* Min timeout for non-idempotent ops*/\n#define\tNFS_MAXREXMIT\t100\t\t/* Stop counting after this many */\n#define\tNFS_RETRANS\t10\t\t/* Num of retrans for UDP soft mounts */\n#define\tNFS_RETRANS_TCP\t2\t\t/* Num of retrans for TCP soft mounts */\n#define\tNFS_MAXGRPS\t16\t\t/* Max. size of groups list */\n#ifndef NFS_MINATTRTIMO\n#define\tNFS_MINATTRTIMO 3\t\t/* VREG attrib cache timeout in sec */\n#endif\n#ifndef NFS_MAXATTRTIMO\n#define\tNFS_MAXATTRTIMO 60\n#endif\n#ifndef NFS_MINDIRATTRTIMO\n#define\tNFS_MINDIRATTRTIMO 3\t\t/* VDIR attrib cache timeout in sec */\n#endif\n#ifndef NFS_MAXDIRATTRTIMO\n#define\tNFS_MAXDIRATTRTIMO 60\n#endif\n#ifndef\tNFS_ACCESSCACHESIZE\n#define\tNFS_ACCESSCACHESIZE 8\t\t/* Per-node access cache entries */\n#endif\n#define\tNFS_WSIZE\t8192\t\t/* Def. write data size <= 8192 */\n#define\tNFS_RSIZE\t8192\t\t/* Def. read data size <= 8192 */\n#define NFS_READDIRSIZE\t8192\t\t/* Def. readdir size */\n#define\tNFS_DEFRAHEAD\t1\t\t/* Def. read ahead # blocks */\n#define\tNFS_MAXRAHEAD\t4\t\t/* Max. read ahead # blocks */\n#define\tNFS_MAXASYNCDAEMON \t64\t/* Max. number async_daemons runnable */\n#define\tNFS_DIRBLKSIZ\t4096\t\t/* Must be a multiple of DIRBLKSIZ */\n#ifdef _KERNEL\n#define\tDIRBLKSIZ\t512\t\t/* XXX we used to use ufs's DIRBLKSIZ */\n#endif\n#define NFS_MAXDEADTHRESH\t9\t/* How long till we say 'server not responding' */\n\n/*\n * Oddballs\n */\n#define NFS_CMPFH(n, f, s) \\\n\t((n)->n_fhsize == (s) && !bcmp((caddr_t)(n)->n_fhp, (caddr_t)(f), (s)))\n#define NFS_ISV3(v)\t(VFSTONFS((v)->v_mount)->nm_flag & NFSMNT_NFSV3)\n#define NFS_ISV4(v)\t(VFSTONFS((v)->v_mount)->nm_flag & NFSMNT_NFSV4)\n\n#define NFSSTA_HASWRITEVERF\t0x00040000  /* Has write verifier for V3 */\n#define NFSSTA_GOTFSINFO\t0x00100000  /* Got the V3 fsinfo */\n#define\tNFSSTA_SNDLOCK\t\t0x01000000  /* Send socket lock */\n#define\tNFSSTA_WANTSND\t\t0x02000000  /* Want above */\n#define\tNFSSTA_TIMEO\t\t0x10000000  /* Experiencing a timeout */\n#define\tNFSSTA_LOCKTIMEO\t0x20000000  /* Experiencing a lockd timeout */\n\n\n/*\n * XXX to allow amd to include nfs.h without nfsproto.h\n */\n#ifdef NFS_NPROCS\n#include <nfsclient/nfsstats.h>\n#endif\n\n/*\n * vfs.oldnfs sysctl(3) identifiers\n */\n#define NFS_NFSSTATS\t1\t\t/* struct: struct nfsstats */\n\n#ifdef _KERNEL\n\n#ifdef MALLOC_DECLARE\nMALLOC_DECLARE(M_NFSREQ);\nMALLOC_DECLARE(M_NFSDIROFF);\nMALLOC_DECLARE(M_NFSBIGFH);\nMALLOC_DECLARE(M_NFSHASH);\nMALLOC_DECLARE(M_NFSDIRECTIO);\n#endif\n\nextern struct uma_zone *nfsmount_zone;\n\nextern struct nfsstats nfsstats;\nextern struct mtx nfs_iod_mtx;\nextern struct task nfs_nfsiodnew_task;\n\nextern int nfs_numasync;\nextern unsigned int nfs_iodmax;\nextern int nfs_pbuf_freecnt;\nextern int nfs_ticks;\n\n/* Data constants in XDR form */\nextern u_int32_t nfs_true, nfs_false, nfs_xdrneg1;\nextern u_int32_t rpc_reply, rpc_msgdenied, rpc_mismatch, rpc_vers;\nextern u_int32_t rpc_auth_unix, rpc_msgaccepted, rpc_call, rpc_autherr;\n\nextern int nfsv3_procid[NFS_NPROCS];\n\n/*\n * Socket errors ignored for connectionless sockets??\n * For now, ignore them all\n */\n#define\tNFSIGNORE_SOERROR(s, e) \\\n\t\t((e) != EINTR && (e) != EIO && \\\n\t\t(e) != ERESTART && (e) != EWOULDBLOCK && \\\n\t\t((s) & PR_CONNREQUIRED) == 0)\n\nstruct nfsmount;\n\nstruct buf;\nstruct socket;\nstruct uio;\nstruct vattr;\n\n/*\n * Pointers to ops that differ from v3 to v4\n */\nstruct nfs_rpcops {\n\tint\t(*nr_readrpc)(struct vnode *vp, struct uio *uiop,\n\t\t    struct ucred *cred);\n\tint\t(*nr_writerpc)(struct vnode *vp, struct uio *uiop,\n\t\t    struct ucred *cred, int *iomode, int *must_commit);\n\tint\t(*nr_writebp)(struct buf *bp, int force, struct thread *td);\n\tint\t(*nr_readlinkrpc)(struct vnode *vp, struct uio *uiop,\n\t\t    struct ucred *cred);\n\tvoid\t(*nr_invaldir)(struct vnode *vp);\n\tint\t(*nr_commit)(struct vnode *vp, u_quad_t offset, int cnt,\n\t\t    struct ucred *cred, struct thread *td);\n};\n\n/*\n * Defines for WebNFS\n */\n\n#define WEBNFS_ESC_CHAR\t\t'%'\n#define WEBNFS_SPECCHAR_START\t0x80\n\n#define WEBNFS_NATIVE_CHAR\t0x80\n/*\n * ..\n * Possibly more here in the future.\n */\n\n/*\n * Macro for converting escape characters in WebNFS pathnames.\n * Should really be in libkern.\n */\n\n#define HEXTOC(c) \\\n\t((c) >= 'a' ? ((c) - ('a' - 10)) : \\\n\t    ((c) >= 'A' ? ((c) - ('A' - 10)) : ((c) - '0')))\n#define HEXSTRTOI(p) \\\n\t((HEXTOC(p[0]) << 4) + HEXTOC(p[1]))\n\n/* nfs_sigintr() helper, when 'rep' has all we need */\n#define NFS_SIGREP(rep)\t\tnfs_sigintr((rep)->r_nmp, (rep), (rep)->r_td)\n\n#ifdef NFS_DEBUG\n\nextern int nfs_debug;\n#define NFS_DEBUG_ASYNCIO\t1 /* asynchronous i/o */\n#define NFS_DEBUG_WG\t\t2 /* server write gathering */\n#define NFS_DEBUG_RC\t\t4 /* server request caching */\n\n#define NFS_DPF(cat, args)\t\t\t\t\t\\\n\tdo {\t\t\t\t\t\t\t\\\n\t\tif (nfs_debug & NFS_DEBUG_##cat) printf args;\t\\\n\t} while (0)\n\n#else\n\n#define NFS_DPF(cat, args)\n\n#endif\n\n/*\n * On fast networks, the estimator will try to reduce the\n * timeout lower than the latency of the server's disks,\n * which results in too many timeouts, so cap the lower\n * bound.\n */\n#define NFS_MINRTO\t(NFS_HZ >> 2)\n\n/*\n * Keep the RTO from increasing to unreasonably large values\n * when a server is not responding.\n */\n#define NFS_MAXRTO\t(20 * NFS_HZ)\n\nenum nfs_rto_timer_t {\n\tNFS_DEFAULT_TIMER,\n\tNFS_GETATTR_TIMER,\n\tNFS_LOOKUP_TIMER,\n\tNFS_READ_TIMER,\n\tNFS_WRITE_TIMER,\n};\n#define NFS_MAX_TIMER\t(NFS_WRITE_TIMER)\n\n#define NFS_INITRTT\t(NFS_HZ << 3)\n\nvfs_init_t nfs_init;\nvfs_uninit_t nfs_uninit;\nint\tnfs_mountroot(struct mount *mp);\n\nvoid\tnfs_purgecache(struct vnode *);\nint\tnfs_vinvalbuf(struct vnode *, int, struct thread *, int);\nint\tnfs_readrpc(struct vnode *, struct uio *, struct ucred *);\nint\tnfs_writerpc(struct vnode *, struct uio *, struct ucred *, int *,\n\t    int *);\nint\tnfs_commit(struct vnode *vp, u_quad_t offset, int cnt,\n\t    struct ucred *cred, struct thread *td);\nint\tnfs_readdirrpc(struct vnode *, struct uio *, struct ucred *);\nvoid\tnfs_nfsiodnew(void);\nvoid\tnfs_nfsiodnew_tq(__unused void *, int);\nint\tnfs_asyncio(struct nfsmount *, struct buf *, struct ucred *, struct thread *);\nint\tnfs_doio(struct vnode *, struct buf *, struct ucred *, struct thread *);\nvoid\tnfs_doio_directwrite (struct buf *);\nint\tnfs_readlinkrpc(struct vnode *, struct uio *, struct ucred *);\nint\tnfs_sigintr(struct nfsmount *, struct thread *);\nint\tnfs_readdirplusrpc(struct vnode *, struct uio *, struct ucred *);\nint\tnfs_request(struct vnode *, struct mbuf *, int, struct thread *,\n\t    struct ucred *, struct mbuf **, struct mbuf **, caddr_t *);\nint\tnfs_loadattrcache(struct vnode **, struct mbuf **, caddr_t *,\n\t    struct vattr *, int);\nint\tnfsm_mbuftouio(struct mbuf **, struct uio *, int, caddr_t *);\nvoid\tnfs_nhinit(void);\nvoid\tnfs_nhuninit(void);\nint\tnfs_nmcancelreqs(struct nfsmount *);\nvoid\tnfs_timer(void*);\n\nint\tnfs_connect(struct nfsmount *);\nvoid\tnfs_disconnect(struct nfsmount *);\nvoid\tnfs_safedisconnect(struct nfsmount *);\nint\tnfs_getattrcache(struct vnode *, struct vattr *);\nint\tnfs_iosize(struct nfsmount *nmp);\nint\tnfsm_strtmbuf(struct mbuf **, char **, const char *, long);\nint\tnfs_bioread(struct vnode *, struct uio *, int, struct ucred *);\nint\tnfsm_uiotombuf(struct uio *, struct mbuf **, int, caddr_t *);\nvoid\tnfs_clearcommit(struct mount *);\nint\tnfs_writebp(struct buf *, int, struct thread *);\nint\tnfs_fsinfo(struct nfsmount *, struct vnode *, struct ucred *,\n\t    struct thread *);\nint\tnfs_meta_setsize (struct vnode *, struct ucred *,\n\t    struct thread *, u_quad_t);\n\nvoid\tnfs_set_sigmask(struct thread *td, sigset_t *oldset);\nvoid\tnfs_restore_sigmask(struct thread *td, sigset_t *set);\nint\tnfs_msleep(struct thread *td, void *ident, struct mtx *mtx,\n\t    int priority, char *wmesg, int timo);\n\n#endif\t/* _KERNEL */\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/nfsclient/nfsargs.h",
    "content": "/*-\n * Copyright (c) 1989, 1993, 1995\n *\tThe Regents of the University of California.  All rights reserved.\n *\n * This code is derived from software contributed to Berkeley by\n * Rick Macklem at The University of Guelph.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 4. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t@(#)nfs.h\t8.4 (Berkeley) 5/1/95\n * $FreeBSD: release/9.0.0/sys/nfsclient/nfsargs.h 221436 2011-05-04 13:27:45Z ru $\n */\n\n#ifndef _NFSCLIENT_NFSARGS_H_\n#define _NFSCLIENT_NFSARGS_H_\n\n/*\n * Arguments to mount NFS\n */\n#define NFS_ARGSVERSION\t3\t\t/* change when nfs_args changes */\nstruct nfs_args {\n\tint\t\tversion;\t/* args structure version number */\n\tstruct sockaddr\t*addr;\t\t/* file server address */\n\tint\t\taddrlen;\t/* length of address */\n\tint\t\tsotype;\t\t/* Socket type */\n\tint\t\tproto;\t\t/* and Protocol */\n\tu_char\t\t*fh;\t\t/* File handle to be mounted */\n\tint\t\tfhsize;\t\t/* Size, in bytes, of fh */\n\tint\t\tflags;\t\t/* flags */\n\tint\t\twsize;\t\t/* write size in bytes */\n\tint\t\trsize;\t\t/* read size in bytes */\n\tint\t\treaddirsize;\t/* readdir size in bytes */\n\tint\t\ttimeo;\t\t/* initial timeout in .1 secs */\n\tint\t\tretrans;\t/* times to retry send */\n\tint\t\tmaxgrouplist;\t/* Max. size of group list */\n\tint\t\treadahead;\t/* # of blocks to readahead */\n\tint\t\twcommitsize;\t/* Max. write commit size in bytes */\n\tint\t\tdeadthresh;\t/* Retrans threshold */\n\tchar\t\t*hostname;\t/* server's name */\n\tint\t\tacregmin;\t/* cache attrs for reg files min time */\n\tint\t\tacregmax;\t/* cache attrs for reg files max time */\n\tint\t\tacdirmin;\t/* cache attrs for dirs min time */\n\tint\t\tacdirmax;\t/* cache attrs for dirs max time */\n};\n\n/*\n * NFS mount option flags\n */\n#define\tNFSMNT_SOFT\t\t0x00000001  /* soft mount (hard is default) */\n#define\tNFSMNT_WSIZE\t\t0x00000002  /* set write size */\n#define\tNFSMNT_RSIZE\t\t0x00000004  /* set read size */\n#define\tNFSMNT_TIMEO\t\t0x00000008  /* set initial timeout */\n#define\tNFSMNT_RETRANS\t\t0x00000010  /* set number of request retries */\n#define\tNFSMNT_MAXGRPS\t\t0x00000020  /* set maximum grouplist size */\n#define\tNFSMNT_INT\t\t0x00000040  /* allow interrupts on hard mount */\n#define\tNFSMNT_NOCONN\t\t0x00000080  /* Don't Connect the socket */\n/* 0x100 free, was NFSMNT_NQNFS */\n#define\tNFSMNT_NFSV3\t\t0x00000200  /* Use NFS Version 3 protocol */\n#define\tNFSMNT_KERB\t\t0x00000400  /* Use RPCSEC_GSS/Krb5 */\n#define\tNFSMNT_DUMBTIMR\t\t0x00000800  /* Don't estimate rtt dynamically */\n#define\tNFSMNT_WCOMMITSIZE\t0x00001000  /* set max write commit size */\n#define\tNFSMNT_READAHEAD\t0x00002000  /* set read ahead */\n#define\tNFSMNT_DEADTHRESH\t0x00004000  /* set dead server retry thresh */\n#define\tNFSMNT_RESVPORT\t\t0x00008000  /* Allocate a reserved port */\n#define\tNFSMNT_RDIRPLUS\t\t0x00010000  /* Use Readdirplus for V3 */\n#define\tNFSMNT_READDIRSIZE\t0x00020000  /* Set readdir size */\n#define\tNFSMNT_ACREGMIN\t\t0x00040000\n#define\tNFSMNT_ACREGMAX\t\t0x00080000\n#define\tNFSMNT_ACDIRMIN\t\t0x00100000\n#define\tNFSMNT_ACDIRMAX\t\t0x00200000\n#define\tNFSMNT_NOLOCKD\t\t0x00400000 /* Locks are local */\n#define\tNFSMNT_NFSV4\t\t0x00800000 /* Use NFS Version 4 protocol */\n#define\tNFSMNT_HASWRITEVERF\t0x01000000 /* NFSv4 Write verifier */\n#define\tNFSMNT_INTEGRITY\t0x02000000 /* Use integrity with RPCSEC_GSS */\n#define\tNFSMNT_PRIVACY\t\t0x04000000 /* Use privacy with RPCSEC_GSS */\n#define\tNFSMNT_ALLGSSNAME\t0x08000000 /* Use principal for all accesses */\n#define\tNFSMNT_STRICT3530\t0x10000000 /* Adhere strictly to RFC3530 */\n#define\tNFSMNT_NOCTO\t\t0x20000000 /* Don't flush attrcache on open */\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/nfsclient/nfsm_subs.h",
    "content": "/*-\n * Copyright (c) 1989, 1993\n *\tThe Regents of the University of California.  All rights reserved.\n *\n * This code is derived from software contributed to Berkeley by\n * Rick Macklem at The University of Guelph.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 4. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t@(#)nfsm_subs.h\t8.2 (Berkeley) 3/30/95\n * $FreeBSD: release/9.0.0/sys/nfsclient/nfsm_subs.h 195202 2009-06-30 19:03:27Z dfr $\n */\n\n#ifndef _NFSCLIENT_NFSM_SUBS_H_\n#define _NFSCLIENT_NFSM_SUBS_H_\n\n#include <nfs/nfs_common.h>\n\n#define\tnfsv2tov_type(a)\tnv2tov_type[fxdr_unsigned(u_int32_t,(a))&0x7]\n\nstruct ucred;\nstruct vnode;\n\n/*\n * These macros do strange and peculiar things to mbuf chains for\n * the assistance of the nfs code. To attempt to use them for any\n * other purpose will be dangerous. (they make weird assumptions)\n */\n\n/*\n * First define what the actual subs. return\n */\nu_int32_t nfs_xid_gen(void);\nstruct mbuf *nfsm_reqhead(struct vnode *vp, u_long procid, int hsiz);\n\n#define\tM_HASCL(m)\t((m)->m_flags & M_EXT)\n#define\tNFSMINOFF(m) \\\n\tdo { \\\n\t\tif (M_HASCL(m)) \\\n\t\t\t(m)->m_data = (m)->m_ext.ext_buf; \\\n\t\telse if ((m)->m_flags & M_PKTHDR) \\\n\t\t\t(m)->m_data = (m)->m_pktdat; \\\n\t\telse \\\n\t\t\t(m)->m_data = (m)->m_dat; \\\n\t} while (0)\n#define\tNFSMSIZ(m)\t((M_HASCL(m))?MCLBYTES: \\\n\t\t\t\t(((m)->m_flags & M_PKTHDR)?MHLEN:MLEN))\n\n/*\n * Now for the macros that do the simple stuff and call the functions\n * for the hard stuff.\n * These macros use several vars. declared in nfsm_reqhead and these\n * vars. must not be used elsewhere unless you are careful not to corrupt\n * them. The vars. starting with pN and tN (N=1,2,3,..) are temporaries\n * that may be used so long as the value is not expected to retained\n * after a macro.\n * I know, this is kind of dorkey, but it makes the actual op functions\n * fairly clean and deals with the mess caused by the xdr discriminating\n * unions.\n */\n\n\n/* *********************************** */\n/* Request generation phase macros */\n\nint\tnfsm_fhtom_xx(struct vnode *v, int v3, struct mbuf **mb,\n\t    caddr_t *bpos);\nvoid\tnfsm_v3attrbuild_xx(struct vattr *va, int full, struct mbuf **mb,\n\t    caddr_t *bpos);\nint\tnfsm_strtom_xx(const char *a, int s, int m, struct mbuf **mb,\n\t    caddr_t *bpos);\n\n#define nfsm_bcheck(t1, mreq) \\\ndo { \\\n\tif (t1) { \\\n\t\terror = t1; \\\n\t\tm_freem(mreq); \\\n\t\tgoto nfsmout; \\\n\t} \\\n} while (0)\n\n#define nfsm_fhtom(v, v3) \\\ndo { \\\n\tint32_t t1; \\\n\tt1 = nfsm_fhtom_xx((v), (v3), &mb, &bpos); \\\n\tnfsm_bcheck(t1, mreq); \\\n} while (0)\n\n/* If full is true, set all fields, otherwise just set mode and time fields */\n#define nfsm_v3attrbuild(a, full) \\\n\tnfsm_v3attrbuild_xx(a, full, &mb, &bpos)\n\n#define nfsm_uiotom(p, s) \\\ndo { \\\n\tint t1; \\\n\tt1 = nfsm_uiotombuf((p), &mb, (s), &bpos); \\\n\tnfsm_bcheck(t1, mreq); \\\n} while (0)\n\n#define\tnfsm_strtom(a, s, m) \\\ndo { \\\n\tint t1; \\\n\tt1 = nfsm_strtom_xx((a), (s), (m), &mb, &bpos); \\\n\tnfsm_bcheck(t1, mreq); \\\n} while (0)\n\n/* *********************************** */\n/* Send the request */\n\n#define\tnfsm_request(v, t, p, c) \\\ndo { \\\n\tsigset_t oldset; \\\n\tnfs_set_sigmask(p, &oldset); \\\n\terror = nfs_request((v), mreq, (t), (p), (c), &mrep, &md, &dpos); \\\n\tnfs_restore_sigmask(p, &oldset); \\\n\tif (error != 0) { \\\n\t\tif (error & NFSERR_RETERR) \\\n\t\t\terror &= ~NFSERR_RETERR; \\\n\t\telse \\\n\t\t\tgoto nfsmout; \\\n\t} \\\n} while (0)\n\n/* *********************************** */\n/* Reply interpretation phase macros */\n\nint\tnfsm_mtofh_xx(struct vnode *d, struct vnode **v, int v3, int *f,\n\t    struct mbuf **md, caddr_t *dpos);\nint\tnfsm_getfh_xx(nfsfh_t **f, int *s, int v3, struct mbuf **md,\n\t    caddr_t *dpos);\nint\tnfsm_loadattr_xx(struct vnode **v, struct vattr *va, struct mbuf **md,\n\t    caddr_t *dpos);\nint\tnfsm_postop_attr_xx(struct vnode **v, int *f, struct mbuf **md,\n\t    caddr_t *dpos);\nint\tnfsm_wcc_data_xx(struct vnode **v, int *f, struct mbuf **md,\n\t    caddr_t *dpos);\n\n#define nfsm_mtofh(d, v, v3, f) \\\ndo { \\\n\tint32_t t1; \\\n\tt1 = nfsm_mtofh_xx((d), &(v), (v3), &(f), &md, &dpos); \\\n\tnfsm_dcheck(t1, mrep); \\\n} while (0)\n\n#define nfsm_getfh(f, s, v3) \\\ndo { \\\n\tint32_t t1; \\\n\tt1 = nfsm_getfh_xx(&(f), &(s), (v3), &md, &dpos); \\\n\tnfsm_dcheck(t1, mrep); \\\n} while (0)\n\n#define\tnfsm_loadattr(v, a) \\\ndo { \\\n\tint32_t t1; \\\n\tt1 = nfsm_loadattr_xx(&v, a, &md, &dpos); \\\n\tnfsm_dcheck(t1, mrep); \\\n} while (0)\n\n#define\tnfsm_postop_attr(v, f) \\\ndo { \\\n\tint32_t t1; \\\n\tt1 = nfsm_postop_attr_xx(&v, &f, &md, &dpos); \\\n\tnfsm_dcheck(t1, mrep); \\\n} while (0)\n\n/* Used as (f) for nfsm_wcc_data() */\n#define NFSV3_WCCRATTR\t0\n#define NFSV3_WCCCHK\t1\n\n#define\tnfsm_wcc_data(v, f) \\\ndo { \\\n\tint32_t t1; \\\n\tt1 = nfsm_wcc_data_xx(&v, &f, &md, &dpos); \\\n\tnfsm_dcheck(t1, mrep); \\\n} while (0)\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/nfsclient/nfsmount.h",
    "content": "/*-\n * Copyright (c) 1989, 1993\n *\tThe Regents of the University of California.  All rights reserved.\n *\n * This code is derived from software contributed to Berkeley by\n * Rick Macklem at The University of Guelph.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 4. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t@(#)nfsmount.h\t8.3 (Berkeley) 3/30/95\n * $FreeBSD: release/9.0.0/sys/nfsclient/nfsmount.h 216931 2011-01-03 20:37:31Z rmacklem $\n */\n\n#ifndef _NFSCLIENT_NFSMOUNT_H_\n#define _NFSCLIENT_NFSMOUNT_H_\n\n#include <sys/socket.h>\n\n#include <nfs/nfs_mountcommon.h>\n\n#include <rpc/types.h>\n#include <rpc/auth.h>\n#include <rpc/clnt.h>\n#include <rpc/rpcsec_gss.h>\n\n/*\n * Mount structure.\n * One allocated on every NFS mount.\n * Holds NFS specific information for mount.\n */\nstruct\tnfsmount {\n\tstruct\tnfsmount_common nm_com;\t/* Common fields for nlm */\n\tint\tnm_numgrps;\t\t/* Max. size of groupslist */\n\tu_char\tnm_fh[NFSX_V4FH];\t/* File handle of root dir */\n\tint\tnm_fhsize;\t\t/* Size of root file handle */\n\tint\tnm_sotype;\t\t/* Type of socket */\n\tint\tnm_soproto;\t\t/* and protocol */\n\tint\tnm_soflags;\t\t/* pr_flags for socket protocol */\n\tstruct\tsockaddr *nm_nam;\t/* Addr of server */\n\tint\tnm_deadthresh;\t\t/* Threshold of timeouts-->dead server*/\n\tint\tnm_rsize;\t\t/* Max size of read rpc */\n\tint\tnm_wsize;\t\t/* Max size of write rpc */\n\tint\tnm_readdirsize;\t\t/* Size of a readdir rpc */\n\tint\tnm_readahead;\t\t/* Num. of blocks to readahead */\n\tint\tnm_wcommitsize;\t\t/* Max size of commit for write */\n\tint\tnm_acdirmin;\t\t/* Directory attr cache min lifetime */\n\tint\tnm_acdirmax;\t\t/* Directory attr cache max lifetime */\n\tint\tnm_acregmin;\t\t/* Reg file attr cache min lifetime */\n\tint\tnm_acregmax;\t\t/* Reg file attr cache max lifetime */\n\tu_char\tnm_verf[NFSX_V3WRITEVERF]; /* V3 write verifier */\n\tTAILQ_HEAD(, buf) nm_bufq;\t/* async io buffer queue */\n\tshort\tnm_bufqlen;\t\t/* number of buffers in queue */\n\tshort\tnm_bufqwant;\t\t/* process wants to add to the queue */\n\tint\tnm_bufqiods;\t\t/* number of iods processing queue */\n\tu_int64_t nm_maxfilesize;\t/* maximum file size */\n\tstruct nfs_rpcops *nm_rpcops;\n\tint\tnm_tprintf_initial_delay;\t/* initial delay */\n\tint\tnm_tprintf_delay;\t\t/* interval for messages */\n\tint\tnm_secflavor;\t\t /* auth flavor to use for rpc */\n\tstruct __rpc_client *nm_client;\n\tstruct rpc_timers nm_timers[NFS_MAX_TIMER]; /* RTT Timers for rpcs */\n\tchar\tnm_principal[MNAMELEN];\t/* GSS-API principal of server */\n\tgss_OID\tnm_mech_oid;\t\t/* OID of selected GSS-API mechanism */\n\tint\tnm_negnametimeo;\t/* timeout for -ve entries (sec) */\n\n\t/* NFSv4 */\n\tuint64_t nm_clientid;\n\tfsid_t\tnm_fsid;\n\tu_int\tnm_lease_time;\n\ttime_t\tnm_last_renewal;\n};\n\n#define\tnm_mtx\t\tnm_com.nmcom_mtx\n#define\tnm_flag\t\tnm_com.nmcom_flag\n#define\tnm_state\tnm_com.nmcom_state\n#define\tnm_mountp\tnm_com.nmcom_mountp\n#define\tnm_timeo\tnm_com.nmcom_timeo\n#define\tnm_retry\tnm_com.nmcom_retry\n#define\tnm_hostname\tnm_com.nmcom_hostname\n#define\tnm_getinfo\tnm_com.nmcom_getinfo\n#define\tnm_vinvalbuf\tnm_com.nmcom_vinvalbuf\n\n#if defined(_KERNEL)\n/*\n * Convert mount ptr to nfsmount ptr.\n */\n#define VFSTONFS(mp)\t((struct nfsmount *)((mp)->mnt_data))\n\n#ifndef NFS_TPRINTF_INITIAL_DELAY\n#define NFS_TPRINTF_INITIAL_DELAY       12\n#endif\n\n#ifndef NFS_TPRINTF_DELAY\n#define NFS_TPRINTF_DELAY               30\n#endif\n\n#ifndef NFS_DEFAULT_NEGNAMETIMEO\n#define NFS_DEFAULT_NEGNAMETIMEO\t60\n#endif\n\n#define\tNFS_PCATCH\t(PCATCH | PBDRY)\n\n#endif\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/nfsclient/nfsnode.h",
    "content": "/*-\n * Copyright (c) 1989, 1993\n *\tThe Regents of the University of California.  All rights reserved.\n *\n * This code is derived from software contributed to Berkeley by\n * Rick Macklem at The University of Guelph.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 4. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t@(#)nfsnode.h\t8.9 (Berkeley) 5/14/95\n * $FreeBSD: release/9.0.0/sys/nfsclient/nfsnode.h 224604 2011-08-02 11:24:42Z rmacklem $\n */\n\n#ifndef _NFSCLIENT_NFSNODE_H_\n#define _NFSCLIENT_NFSNODE_H_\n\n#include <sys/_task.h>\n#if !defined(_NFSCLIENT_NFS_H_) && !defined(_KERNEL)\n#include <nfs/nfs.h>\n#endif\n\n/*\n * Silly rename structure that hangs off the nfsnode until the name\n * can be removed by nfs_inactive()\n */\nstruct sillyrename {\n\tstruct\ttask s_task;\n\tstruct\tucred *s_cred;\n\tstruct\tvnode *s_dvp;\n\tint\t(*s_removeit)(struct sillyrename *sp);\n\tlong\ts_namlen;\n\tchar\ts_name[32];\n};\n\n/*\n * This structure is used to save the logical directory offset to\n * NFS cookie mappings.\n * The mappings are stored in a list headed\n * by n_cookies, as required.\n * There is one mapping for each NFS_DIRBLKSIZ bytes of directory information\n * stored in increasing logical offset byte order.\n */\n#define NFSNUMCOOKIES\t\t31\n\nstruct nfsdmap {\n\tLIST_ENTRY(nfsdmap)\tndm_list;\n\tint\t\t\tndm_eocookie;\n\tunion {\n\t\tnfsuint64\tndmu3_cookies[NFSNUMCOOKIES];\n\t\tuint64_t\tndmu4_cookies[NFSNUMCOOKIES];\n\t} ndm_un1;\n};\n\n#define ndm_cookies\tndm_un1.ndmu3_cookies\n#define ndm4_cookies\tndm_un1.ndmu4_cookies\n\nstruct nfs_accesscache {\n\tu_int32_t\t\tmode;\t\t/* ACCESS mode cache */\n\tuid_t\t\t\tuid;\t\t/* credentials having mode */\n\ttime_t\t\t\tstamp;\t\t/* mode cache timestamp */\n};\n\t\n/*\n * The nfsnode is the nfs equivalent to ufs's inode. Any similarity\n * is purely coincidental.\n * There is a unique nfsnode allocated for each active file,\n * each current directory, each mounted-on file, text file, and the root.\n * An nfsnode is 'named' by its file handle. (nget/nfs_node.c)\n * If this structure exceeds 256 bytes (it is currently 256 using 4.4BSD-Lite\n * type definitions), file handles of > 32 bytes should probably be split out\n * into a separate MALLOC()'d data structure. (Reduce the size of nfsfh_t by\n * changing the definition in nfsproto.h of NFS_SMALLFH.)\n * NB: Hopefully the current order of the fields is such that everything will\n *     be well aligned and, therefore, tightly packed.\n */\nstruct nfsnode {\n\tstruct mtx \t\tn_mtx;\t\t/* Protects all of these members */\n\tu_quad_t\t\tn_size;\t\t/* Current size of file */\n\tu_quad_t\t\tn_brev;\t\t/* Modify rev when cached */\n\tu_quad_t\t\tn_lrev;\t\t/* Modify rev for lease */\n\tstruct vattr\t\tn_vattr;\t/* Vnode attribute cache */\n\ttime_t\t\t\tn_attrstamp;\t/* Attr. cache timestamp */\n\tstruct nfs_accesscache\tn_accesscache[NFS_ACCESSCACHESIZE];\n\tstruct timespec\t\tn_mtime;\t/* Prev modify time. */\n\tstruct timespec\t\tn_ctime;\t/* Prev create time. */\n\tstruct timespec\t\tn_dmtime;\t/* Prev dir modify time. */\n\tint\t\t\tn_dmtime_ticks;\t/* Tick of -ve cache entry */\n\tnfsfh_t\t\t\t*n_fhp;\t\t/* NFS File Handle */\n\tstruct vnode\t\t*n_vnode;\t/* associated vnode */\n\tstruct vnode\t\t*n_dvp;\t\t/* parent vnode */\n\tint\t\t\tn_error;\t/* Save write error value */\n\tunion {\n\t\tstruct timespec\tnf_atim;\t/* Special file times */\n\t\tnfsuint64\tnd_cookieverf;\t/* Cookie verifier (dir only) */\n\t\tu_char\t\tnd4_cookieverf[NFSX_V4VERF];\n\t} n_un1;\n\tunion {\n\t\tstruct timespec\tnf_mtim;\n\t\toff_t\t\tnd_direof;\t/* Dir. EOF offset cache */\n\t} n_un2;\n\tunion {\n\t\tstruct sillyrename *nf_silly;\t/* Ptr to silly rename struct */\n\t\tLIST_HEAD(, nfsdmap) nd_cook;\t/* cookies */\n\t} n_un3;\n\tshort\t\t\tn_fhsize;\t/* size in bytes, of fh */\n\tshort\t\t\tn_flag;\t\t/* Flag for locking.. */\n\tnfsfh_t\t\t\tn_fh;\t\t/* Small File Handle */\n\tu_char\t\t\t*n_name;\t/* leaf name, for v4 OPEN op */\n\tuint32_t\t\tn_namelen;\n\tint\t\t\tn_directio_opens;\n\tint                     n_directio_asyncwr;\n};\n\n#define n_atim\t\tn_un1.nf_atim\n#define n_mtim\t\tn_un2.nf_mtim\n#define n_sillyrename\tn_un3.nf_silly\n#define n_cookieverf\tn_un1.nd_cookieverf\n#define n4_cookieverf\tn_un1.nd4_cookieverf\n#define n_direofoffset\tn_un2.nd_direof\n#define n_cookies\tn_un3.nd_cook\n\n/*\n * Flags for n_flag\n */\n#define NFSYNCWAIT      0x0002  /* fsync waiting for all directio async writes\n\t\t\t\t  to drain */\n#define\tNMODIFIED\t0x0004\t/* Might have a modified buffer in bio */\n#define\tNWRITEERR\t0x0008\t/* Flag write errors so close will know */\n/* 0x20, 0x40, 0x80 free */\n#define\tNACC\t\t0x0100\t/* Special file accessed */\n#define\tNUPD\t\t0x0200\t/* Special file updated */\n#define\tNCHG\t\t0x0400\t/* Special file times changed */\n#define\tNCREATED\t0x0800\t/* Opened by nfs_create() */\n#define\tNTRUNCATE\t0x1000\t/* Opened by nfs_setattr() */\n#define\tNSIZECHANGED\t0x2000  /* File size has changed: need cache inval */\n#define NNONCACHE\t0x4000  /* Node marked as noncacheable */\n#define NDIRCOOKIELK\t0x8000\t/* Lock to serialize access to directory cookies */\n\n/*\n * Convert between nfsnode pointers and vnode pointers\n */\n#define VTONFS(vp)\t((struct nfsnode *)(vp)->v_data)\n#define NFSTOV(np)\t((struct vnode *)(np)->n_vnode)\n\n#define NFS_TIMESPEC_COMPARE(T1, T2)\t(((T1)->tv_sec != (T2)->tv_sec) || ((T1)->tv_nsec != (T2)->tv_nsec))\n\n/*\n * NFS iod threads can be in one of these two states once spawned.\n * NFSIOD_NOT_AVAILABLE - Cannot be assigned an I/O operation at this time.\n * NFSIOD_AVAILABLE - Available to be assigned an I/O operation.\n */\nenum nfsiod_state {\n\tNFSIOD_NOT_AVAILABLE = 0,\n\tNFSIOD_AVAILABLE = 1,\n};\n\n/*\n * Queue head for nfsiod's\n */\nextern TAILQ_HEAD(nfs_bufq, buf) nfs_bufq;\nextern enum nfsiod_state nfs_iodwant[NFS_MAXASYNCDAEMON];\nextern struct nfsmount *nfs_iodmount[NFS_MAXASYNCDAEMON];\n\n#if defined(_KERNEL)\n\nextern\tstruct vop_vector\tnfs_fifoops;\nextern\tstruct vop_vector\tnfs_vnodeops;\nextern struct buf_ops buf_ops_nfs;\n\n/*\n * Prototypes for NFS vnode operations\n */\nint\tnfs_getpages(struct vop_getpages_args *);\nint\tnfs_putpages(struct vop_putpages_args *);\nint\tnfs_write(struct vop_write_args *);\nint\tnfs_inactive(struct vop_inactive_args *);\nint\tnfs_reclaim(struct vop_reclaim_args *);\n\n/* other stuff */\nint\tnfs_removeit(struct sillyrename *);\nint\tnfs_nget(struct mount *, nfsfh_t *, int, struct nfsnode **, int flags);\nnfsuint64 *nfs_getcookie(struct nfsnode *, off_t, int);\nvoid\tnfs_invaldir(struct vnode *);\nint\tnfs_upgrade_vnlock(struct vnode *vp);\nvoid\tnfs_downgrade_vnlock(struct vnode *vp, int old_lock);\nvoid\tnfs_printf(const char *fmt, ...);\n\nvoid nfs_dircookie_lock(struct nfsnode *np);\nvoid nfs_dircookie_unlock(struct nfsnode *np);\n\n#endif /* _KERNEL */\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/nfsclient/nfsstats.h",
    "content": "/*-\n * Copyright (c) 1989, 1993, 1995\n *\tThe Regents of the University of California.  All rights reserved.\n *\n * This code is derived from software contributed to Berkeley by\n * Rick Macklem at The University of Guelph.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 4. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t@(#)nfs.h\t8.4 (Berkeley) 5/1/95\n * $FreeBSD: release/9.0.0/sys/nfsclient/nfsstats.h 139823 2005-01-07 01:45:51Z imp $\n */\n\n#ifndef _NFSCLIENT_NFSSTATS_H_\n#define _NFSCLIENT_NFSSTATS_H_\n\n/*\n * Stats structure\n */\nstruct nfsstats {\n\tint\tattrcache_hits;\n\tint\tattrcache_misses;\n\tint\tlookupcache_hits;\n\tint\tlookupcache_misses;\n\tint\tdireofcache_hits;\n\tint\tdireofcache_misses;\n\tint\taccesscache_hits;\n\tint\taccesscache_misses;\n\tint\tbiocache_reads;\n\tint\tread_bios;\n\tint\tread_physios;\n\tint\tbiocache_writes;\n\tint\twrite_bios;\n\tint\twrite_physios;\n\tint\tbiocache_readlinks;\n\tint\treadlink_bios;\n\tint\tbiocache_readdirs;\n\tint\treaddir_bios;\n\tint\trpcretries;\n\tint\trpcrequests;\n\tint\trpctimeouts;\n\tint\trpcunexpected;\n\tint\trpcinvalid;\n\tint\trpccnt[NFS_NPROCS];\n};\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/nfsclient/nlminfo.h",
    "content": "/*-\n * Copyright (c) 1998 Berkeley Software Design, Inc. All rights reserved.\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. Berkeley Software Design Inc's name may not be used to endorse or\n *    promote products derived from this software without specific prior\n *    written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY BERKELEY SOFTWARE DESIGN INC ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL BERKELEY SOFTWARE DESIGN INC BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *      from BSDI nlminfo.h,v 2.1 1998/03/18 01:30:38 don Exp\n * $FreeBSD: release/9.0.0/sys/nfsclient/nlminfo.h 151695 2005-10-26 07:18:37Z glebius $\n */\n\n/*\n * Misc NLM informationi, some needed for the master lockd process, and some\n * needed by every process doing nlm based locking.\n */\nstruct  nlminfo {\n\t/* these are used by any process doing nlm locking */\n        int             msg_seq;        /* sequence counter for lock requests */\n        int             retcode;        /* return code for lock requests */\n\tint\t\tset_getlk_pid;\n\tint\t\tgetlk_pid;\n        struct  timeval pid_start;      /* process starting time */\n};\n"
  },
  {
    "path": "freebsd-headers/nfsserver/nfs.h",
    "content": "/*-\n * Copyright (c) 1989, 1993, 1995\n *\tThe Regents of the University of California.  All rights reserved.\n *\n * This code is derived from software contributed to Berkeley by\n * Rick Macklem at The University of Guelph.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 4. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t@(#)nfs.h\t8.4 (Berkeley) 5/1/95\n * $FreeBSD: release/9.0.0/sys/nfsserver/nfs.h 216632 2010-12-21 23:12:45Z pjd $\n */\n\n#ifndef _NFSSERVER_NFS_H_\n#define _NFSSERVER_NFS_H_\n\n#ifdef _KERNEL\n#include \"opt_nfs.h\"\n#endif\n\n#include <nfs/nfssvc.h>\n\n/*\n * Tunable constants for nfs\n */\n\n#define NFS_TICKINTVL\t10\t\t/* Desired time for a tick (msec) */\n#define NFS_HZ\t\t(hz / nfs_ticks) /* Ticks/sec */\n#define\tNFS_TIMEO\t(1 * NFS_HZ)\t/* Default timeout = 1 second */\n#define\tNFS_MINTIMEO\t(1 * NFS_HZ)\t/* Min timeout to use */\n#define\tNFS_MAXTIMEO\t(60 * NFS_HZ)\t/* Max timeout to backoff to */\n#define\tNFS_MINIDEMTIMEO (5 * NFS_HZ)\t/* Min timeout for non-idempotent ops*/\n#define\tNFS_MAXUIDHASH\t64\t\t/* Max. # of hashed uid entries/mp */\n#ifndef NFS_GATHERDELAY\n#define NFS_GATHERDELAY\t\t10\t/* Default write gather delay (msec) */\n#endif\n#ifdef _KERNEL\n#define\tDIRBLKSIZ\t512\t\t/* XXX we used to use ufs's DIRBLKSIZ */\n#endif\n\n/*\n * Oddballs\n */\n#define NFS_SRVMAXDATA(n) \\\n\t\t(((n)->nd_flag & ND_NFSV3) ? (((n)->nd_nam2) ? \\\n\t\t NFS_MAXDGRAMDATA : NFS_MAXDATA) : NFS_V2MAXDATA)\n\n/*\n * XXX\n * The B_INVAFTERWRITE flag should be set to whatever is required by the\n * buffer cache code to say \"Invalidate the block after it is written back\".\n */\n#define\tB_INVAFTERWRITE\tB_NOCACHE\n\n/*\n * The IO_METASYNC flag should be implemented for local filesystems.\n * (Until then, it is nothin at all.)\n */\n#ifndef IO_METASYNC\n#define IO_METASYNC\t0\n#endif\n\n/* NFS state flags XXX -Wunused */\n#define\tNFSRV_SNDLOCK\t\t0x01000000  /* Send socket lock */\n#define\tNFSRV_WANTSND\t\t0x02000000  /* Want above */\n\n/*\n * Structures for the nfssvc(2) syscall.  Not that anyone but nfsd and\n * mount_nfs should ever try and use it.\n */\n\n/*\n * Add a socket to monitor for NFS requests.\n */\nstruct nfsd_addsock_args {\n\tint\tsock;\t\t/* Socket to serve */\n\tcaddr_t\tname;\t\t/* Client addr for connection based sockets */\n\tint\tnamelen;\t/* Length of name */\n};\n\n/*\n * Start processing requests.\n */\nstruct nfsd_nfsd_args {\n\tconst char *principal;\t/* GSS-API service principal name */\n\tint\tminthreads;\t/* minimum service thread count */\n\tint\tmaxthreads;\t/* maximum service thread count */\n};\n\n/*\n * XXX to allow amd to include nfs.h without nfsproto.h\n */\n#ifdef NFS_NPROCS\n#include <nfsserver/nfsrvstats.h>\n#endif\n\n/*\n * vfs.nfsrv sysctl(3) identifiers\n */\n#define NFS_NFSRVSTATS\t1\t\t/* struct: struct nfsrvstats */\n#define NFS_NFSPRIVPORT\t2\t\t/* int: prohibit nfs to resvports */\n\n#ifdef _KERNEL\n\nextern struct mtx nfsd_mtx;\n#define\tNFSD_LOCK_ASSERT()\tmtx_assert(&nfsd_mtx, MA_OWNED)\n#define\tNFSD_UNLOCK_ASSERT()\tmtx_assert(&nfsd_mtx, MA_NOTOWNED)\n#define\tNFSD_LOCK_DONTCARE()\n#define\tNFSD_LOCK()\tmtx_lock(&nfsd_mtx)\n#define\tNFSD_UNLOCK()\tmtx_unlock(&nfsd_mtx)\n\n#ifdef MALLOC_DECLARE\nMALLOC_DECLARE(M_NFSRVDESC);\nMALLOC_DECLARE(M_NFSD);\n#endif\n\n/* Forward declarations */\nstruct nfssvc_sock;\nstruct nfsrv_descript;\nstruct uio;\nstruct vattr;\nstruct nameidata;\n\nextern struct callout nfsrv_callout;\nextern struct nfsrvstats nfsrvstats;\n\nextern int\tnfsrv_ticks;\nextern int\tnfsrvw_procrastinate;\nextern int\tnfsrvw_procrastinate_v3;\nextern int \tnfsrv_numnfsd;\n\n/* Various values converted to XDR form. */\nextern u_int32_t nfsrv_nfs_false, nfsrv_nfs_true, nfsrv_nfs_xdrneg1,\n\tnfsrv_nfs_prog;\nextern u_int32_t nfsrv_rpc_reply, nfsrv_rpc_msgdenied, nfsrv_rpc_mismatch,\n\tnfsrv_rpc_vers;\nextern u_int32_t nfsrv_rpc_auth_unix, nfsrv_rpc_msgaccepted, nfsrv_rpc_call,\n\tnfsrv_rpc_autherr;\n\n/* Procedure table data */\nextern const int\tnfsrvv2_procid[NFS_NPROCS];\nextern const int\tnfsrv_nfsv3_procid[NFS_NPROCS];\nextern int32_t (*nfsrv3_procs[NFS_NPROCS])(struct nfsrv_descript *nd,\n\t\t    struct nfssvc_sock *slp, struct mbuf **mreqp);\n\n/*\n * A list of nfssvc_sock structures is maintained with all the sockets\n * that require service by the nfsd.\n */\n#ifndef NFS_WDELAYHASHSIZ\n#define\tNFS_WDELAYHASHSIZ 16\t/* and with this */\n#endif\n#define\tNWDELAYHASH(sock, f) \\\n\t(&(sock)->ns_wdelayhashtbl[(*((u_int32_t *)(f))) % NFS_WDELAYHASHSIZ])\n\n/*\n * This structure is used by the server for describing each request.\n */\nstruct nfsrv_descript {\n\tstruct mbuf\t\t*nd_mrep;\t/* Request mbuf list */\n\tstruct mbuf\t\t*nd_md;\t\t/* Current dissect mbuf */\n\tstruct mbuf\t\t*nd_mreq;\t/* Reply mbuf list */\n\tstruct sockaddr\t\t*nd_nam;\t/* and socket addr */\n\tstruct sockaddr\t\t*nd_nam2;\t/* return socket addr */\n\tcaddr_t\t\t\tnd_dpos;\t/* Current dissect pos */\n\tu_int32_t\t\tnd_procnum;\t/* RPC # */\n\tint\t\t\tnd_stable;\t/* storage type */\n\tint\t\t\tnd_flag;\t/* nd_flag */\n\tint\t\t\tnd_repstat;\t/* Reply status */\n\tfhandle_t\t\tnd_fh;\t\t/* File handle */\n\tstruct ucred\t\t*nd_cr;\t\t/* Credentials */\n\tint\t\t\tnd_credflavor;\t/* Security flavor */\n};\n\n/* Bits for \"nd_flag\" */\n#define ND_NFSV3\t0x08\n\n/*\n * Defines for WebNFS\n */\n\n#define WEBNFS_ESC_CHAR\t\t'%'\n#define WEBNFS_SPECCHAR_START\t0x80\n\n#define WEBNFS_NATIVE_CHAR\t0x80\n/*\n * ..\n * Possibly more here in the future.\n */\n\n/*\n * Macro for converting escape characters in WebNFS pathnames.\n * Should really be in libkern.\n */\n\n#define HEXTOC(c) \\\n\t((c) >= 'a' ? ((c) - ('a' - 10)) : \\\n\t    ((c) >= 'A' ? ((c) - ('A' - 10)) : ((c) - '0')))\n#define HEXSTRTOI(p) \\\n\t((HEXTOC(p[0]) << 4) + HEXTOC(p[1]))\n\n#ifdef NFS_DEBUG\n\nextern int nfs_debug;\n#define NFS_DEBUG_ASYNCIO\t1 /* asynchronous i/o */\n#define NFS_DEBUG_WG\t\t2 /* server write gathering */\n#define NFS_DEBUG_RC\t\t4 /* server request caching */\n\n#define NFS_DPF(cat, args)\t\t\t\t\t\\\n\tdo {\t\t\t\t\t\t\t\\\n\t\tif (nfs_debug & NFS_DEBUG_##cat) printf args;\t\\\n\t} while (0)\n\n#else\n\n#define NFS_DPF(cat, args)\n\n#endif\n\n/*\n * The following flags can be passed to nfsrv_fhtovp() function.\n */\n/* Leave file system busy on success. */\n#define\tNFSRV_FLAG_BUSY\t\t0x01\n\nstruct mbuf *nfs_rephead(int, struct nfsrv_descript *, int, struct mbuf **,\n\t    caddr_t *);\nvoid\tnfsm_srvfattr(struct nfsrv_descript *, struct vattr *,\n\t    struct nfs_fattr *);\nvoid\tnfsm_srvwcc(struct nfsrv_descript *, int, struct vattr *, int,\n\t    struct vattr *, struct mbuf **, char **);\nvoid\tnfsm_srvpostopattr(struct nfsrv_descript *, int, struct vattr *,\n\t    struct mbuf **, char **);\nint\tnfs_namei(struct nameidata *, struct nfsrv_descript *, fhandle_t *,\n\t    int, struct nfssvc_sock *, struct sockaddr *, struct mbuf **,\n\t    caddr_t *, struct vnode **, int, struct vattr *, int *, int);\nvoid\tnfsm_adj(struct mbuf *, int, int);\nint\tnfsm_mbuftouio(struct mbuf **, struct uio *, int, caddr_t *);\nvoid\tnfsrv_init(int);\nint\tnfsrv_errmap(struct nfsrv_descript *, int);\nvoid\tnfsrvw_sort(gid_t *, int);\n\nint\tnfsrv3_access(struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,\n\t    struct mbuf **mrq);\nint\tnfsrv_commit(struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,\n\t    struct mbuf **mrq);\nint\tnfsrv_create(struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,\n\t    struct mbuf **mrq);\nint\tnfsrv_fhtovp(fhandle_t *, int, struct vnode **, int *,\n\t    struct nfsrv_descript *, struct nfssvc_sock *, struct sockaddr *,\n\t    int *);\nint\tnfsrv_setpublicfs(struct mount *, struct netexport *,\n\t    struct export_args *);\nint\tnfs_ispublicfh(fhandle_t *);\nint\tnfsrv_fsinfo(struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,\n\t    struct mbuf **mrq);\nint\tnfsrv_getattr(struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,\n\t    struct mbuf **mrq);\nint\tnfsrv_link(struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,\n\t    struct mbuf **mrq);\nint\tnfsrv_lookup(struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,\n\t    struct mbuf **mrq);\nint\tnfsrv_mkdir(struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,\n\t    struct mbuf **mrq);\nint\tnfsrv_mknod(struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,\n\t    struct mbuf **mrq);\nint\tnfsrv_noop(struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,\n\t    struct mbuf **mrq);\nint\tnfsrv_null(struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,\n\t    struct mbuf **mrq);\nint\tnfsrv_pathconf(struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,\n\t    struct mbuf **mrq);\nint\tnfsrv_read(struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,\n\t    struct mbuf **mrq);\nint\tnfsrv_readdir(struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,\n\t    struct mbuf **mrq);\nint\tnfsrv_readdirplus(struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,\n\t    struct mbuf **mrq);\nint\tnfsrv_readlink(struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,\n\t    struct mbuf **mrq);\nint\tnfsrv_remove(struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,\n\t    struct mbuf **mrq);\nint\tnfsrv_rename(struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,\n\t    struct mbuf **mrq);\nint\tnfsrv_rmdir(struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,\n\t    struct mbuf **mrq);\nint\tnfsrv_setattr(struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,\n\t    struct mbuf **mrq);\nint\tnfsrv_statfs(struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,\n\t    struct mbuf **mrq);\nint\tnfsrv_symlink(struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,\n\t    struct mbuf **mrq);\nint\tnfsrv_write(struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,\n\t    struct mbuf **mrq);\n/*\n * #ifdef _SYS_SYSPROTO_H_ so that it is only defined when sysproto.h\n * has been included, so that \"struct nfssvc_args\" is defined.\n */\n#ifdef _SYS_SYSPROTO_H_\nint nfssvc_nfsserver(struct thread *, struct nfssvc_args *);\n#endif\n#endif\t/* _KERNEL */\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/nfsserver/nfs_fha.h",
    "content": "/*-\n * Copyright (c) 2008 Isilon Inc http://www.isilon.com/\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n */\n/* $FreeBSD: release/9.0.0/sys/nfsserver/nfs_fha.h 184588 2008-11-03 10:38:00Z dfr $ */\n\nvoid fha_nd_complete(SVCTHREAD *, struct svc_req *);\nSVCTHREAD *fha_assign(SVCTHREAD *, struct svc_req *);\n"
  },
  {
    "path": "freebsd-headers/nfsserver/nfsm_subs.h",
    "content": "/*-\n * Copyright (c) 1989, 1993\n *\tThe Regents of the University of California.  All rights reserved.\n *\n * This code is derived from software contributed to Berkeley by\n * Rick Macklem at The University of Guelph.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 4. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t@(#)nfsm_subs.h\t8.2 (Berkeley) 3/30/95\n * $FreeBSD: release/9.0.0/sys/nfsserver/nfsm_subs.h 184588 2008-11-03 10:38:00Z dfr $\n */\n\n#ifndef _NFSSERVER_NFSM_SUBS_H_\n#define _NFSSERVER_NFSM_SUBS_H_\n\n#include <nfs/nfs_common.h>\n\n#define\tnfstov_mode(a)\t(fxdr_unsigned(u_int32_t, (a)) & ALLPERMS)\n\n/*\n * These macros do strange and peculiar things to mbuf chains for\n * the assistance of the nfs code. To attempt to use them for any\n * other purpose will be dangerous. (they make weird assumptions)\n */\n\n/*\n * First define what the actual subs. return\n */\n\n#define\tM_HASCL(m)\t((m)->m_flags & M_EXT)\n#define\tNFSMSIZ(m)\t((M_HASCL(m))?MCLBYTES: \\\n\t\t\t\t(((m)->m_flags & M_PKTHDR)?MHLEN:MLEN))\n\n/*\n * Now for the macros that do the simple stuff and call the functions\n * for the hard stuff.\n * These macros use several vars. declared in nfsm_reqhead and these\n * vars. must not be used elsewhere unless you are careful not to corrupt\n * them. The vars. starting with pN and tN (N=1,2,3,..) are temporaries\n * that may be used so long as the value is not expected to retained\n * after a macro.\n * I know, this is kind of dorkey, but it makes the actual op functions\n * fairly clean and deals with the mess caused by the xdr discriminating\n * unions.\n */\n\n\n\n/* ************************************* */\n/* Dissection phase macros */\n\nint\tnfsm_srvstrsiz_xx(int *s, int m, struct mbuf **md, caddr_t *dpos);\nint\tnfsm_srvnamesiz_xx(int *s, int m, struct mbuf **md, caddr_t *dpos);\nint\tnfsm_srvnamesiz0_xx(int *s, int m, struct mbuf **md, caddr_t *dpos);\nint\tnfsm_srvmtofh_xx(fhandle_t *f, int v3, struct mbuf **md, caddr_t *dpos);\nint\tnfsm_srvsattr_xx(struct vattr *a, struct mbuf **md, caddr_t *dpos);\n\n#define\tnfsm_srvstrsiz(s, m) \\\ndo { \\\n\tint t1; \\\n\tt1 = nfsm_srvstrsiz_xx(&(s), (m), &md, &dpos); \\\n\tif (t1) { \\\n\t\terror = t1; \\\n\t\tnfsm_reply(0); \\\n\t} \\\n} while (0)\n\n#define\tnfsm_srvnamesiz(s) \\\ndo { \\\n\tint t1; \\\n\tt1 = nfsm_srvnamesiz_xx(&(s), NFS_MAXNAMLEN, &md, &dpos); \\\n\tif (t1) { \\\n\t\terror = t1; \\\n\t\tnfsm_reply(0); \\\n\t} \\\n} while (0)\n\n#define\tnfsm_srvpathsiz(s) \\\ndo { \\\n\tint t1; \\\n\tt1 = nfsm_srvnamesiz0_xx(&(s), NFS_MAXPATHLEN, &md, &dpos); \\\n\tif (t1) { \\\n\t\terror = t1; \\\n\t\tnfsm_reply(0); \\\n\t} \\\n} while (0)\n\n#define nfsm_srvmtofh(f) \\\ndo { \\\n\tint t1; \\\n\tt1 = nfsm_srvmtofh_xx((f), nfsd->nd_flag & ND_NFSV3, &md, &dpos); \\\n\tif (t1) { \\\n\t\terror = t1; \\\n\t\tnfsm_reply(0); \\\n\t} \\\n} while (0)\n\n/* XXX why is this different? */\n#define nfsm_srvsattr(a) \\\ndo { \\\n\tint t1; \\\n\tt1 = nfsm_srvsattr_xx((a), &md, &dpos); \\\n\tif (t1) { \\\n\t\terror = t1; \\\n\t\tm_freem(mrep); \\\n\t\tmrep = NULL; \\\n\t\tgoto nfsmout; \\\n\t} \\\n} while (0)\n\n/* ************************************* */\n/* Prepare the reply */\n\n#define\tnfsm_reply(s) \\\ndo { \\\n\tif (mrep != NULL) { \\\n\t\tm_freem(mrep); \\\n\t\tmrep = NULL; \\\n\t} \\\n\tmreq = nfs_rephead((s), nfsd, error, &mb, &bpos); \\\n\t*mrq = mreq; \\\n\tif (error == EBADRPC) { \\\n\t\terror = 0; \\\n\t\tgoto nfsmout; \\\n\t} \\\n} while (0)\n\n#define\tnfsm_writereply(s) \\\ndo { \\\n\tmreq = nfs_rephead((s), nfsd, error, &mb, &bpos); \\\n} while(0)\n\n/* ************************************* */\n/* Reply phase macros - add additional reply info */\n\nvoid\tnfsm_srvfhtom_xx(fhandle_t *f, int v3, struct mbuf **mb,\n\t    caddr_t *bpos);\nvoid\tnfsm_srvpostop_fh_xx(fhandle_t *f, struct mbuf **mb, caddr_t *bpos);\nvoid\tnfsm_clget_xx(u_int32_t **tl, struct mbuf *mb, struct mbuf **mp,\n\t    char **bp, char **be, caddr_t bpos);\n\n#define nfsm_srvfhtom(f, v3) \\\n\tnfsm_srvfhtom_xx((f), (v3), &mb, &bpos)\n\n#define nfsm_srvpostop_fh(f) \\\n\tnfsm_srvpostop_fh_xx((f), &mb, &bpos)\n\n#define nfsm_srvwcc_data(br, b, ar, a) \\\n\tnfsm_srvwcc(nfsd, (br), (b), (ar), (a), &mb, &bpos)\n\n#define nfsm_srvpostop_attr(r, a) \\\n\tnfsm_srvpostopattr(nfsd, (r), (a), &mb, &bpos)\n\n#define\tnfsm_srvfillattr(a, f) \\\n\tnfsm_srvfattr(nfsd, (a), (f))\n\n#define nfsm_clget \\\n\tnfsm_clget_xx(&tl, mb, &mp, &bp, &be, bpos)\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/nfsserver/nfsrvcache.h",
    "content": "/*-\n * Copyright (c) 1989, 1993\n *\tThe Regents of the University of California.  All rights reserved.\n *\n * This code is derived from software contributed to Berkeley by\n * Rick Macklem at The University of Guelph.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 4. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t@(#)nfsrvcache.h\t8.3 (Berkeley) 3/30/95\n * $FreeBSD: release/9.0.0/sys/nfsserver/nfsrvcache.h 195202 2009-06-30 19:03:27Z dfr $\n */\n\n#ifndef _NFSSERVER_NFSRVCACHE_H_\n#define _NFSSERVER_NFSRVCACHE_H_\n\n#include <sys/queue.h>\n\n/*\n * Definitions for the server recent request cache\n */\n#define NFSRVCACHE_MAX_SIZE\t2048\n#define NFSRVCACHE_MIN_SIZE\t  64\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/nfsserver/nfsrvstats.h",
    "content": "/*-\n * Copyright (c) 1989, 1993, 1995\n *\tThe Regents of the University of California.  All rights reserved.\n *\n * This code is derived from software contributed to Berkeley by\n * Rick Macklem at The University of Guelph.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 4. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t@(#)nfs.h\t8.4 (Berkeley) 5/1/95\n * $FreeBSD: release/9.0.0/sys/nfsserver/nfsrvstats.h 139823 2005-01-07 01:45:51Z imp $\n */\n\n#ifndef _NFSSERVER_NFSRVSTATS_H_\n#define _NFSSERVER_NFSRVSTATS_H_\n\n/*\n * Server stats structure\n */\nstruct nfsrvstats {\n\tint\tsrvrpc_errs;\n\tint\tsrv_errs;\n\tint\tsrvcache_inproghits;\n\tint\tsrvcache_idemdonehits;\n\tint\tsrvcache_nonidemdonehits;\n\tint\tsrvcache_misses;\n\tint\tsrvvop_writes;\n\tint\tsrvrpccnt[NFS_NPROCS];\n};\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/nl_types.h",
    "content": "/*\t$NetBSD: nl_types.h,v 1.9 2000/10/03 19:53:32 sommerfeld Exp $\t*/\n\n/*-\n * Copyright (c) 1996 The NetBSD Foundation, Inc.\n * All rights reserved.\n *\n * This code is derived from software contributed to The NetBSD Foundation\n * by J.T. Conklin.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS\n * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED\n * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\n * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS\n * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\n * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\n * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\n * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\n * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/include/nl_types.h 203963 2010-02-16 19:28:10Z imp $\n */\n\n#ifndef _NL_TYPES_H_\n#define _NL_TYPES_H_\n\n#include <sys/cdefs.h>\n#include <sys/types.h>\n\n#ifdef _NLS_PRIVATE\n/*\n * MESSAGE CATALOG FILE FORMAT.\n *\n * The NetBSD/FreeBSD message catalog format is similar to the format used by\n * Svr4 systems.  The differences are:\n *   * fixed byte order (big endian)\n *   * fixed data field sizes\n *\n * A message catalog contains four data types: a catalog header, one\n * or more set headers, one or more message headers, and one or more\n * text strings.\n */\n\n#define _NLS_MAGIC\t0xff88ff89\n\nstruct _nls_cat_hdr {\n\tint32_t __magic;\n\tint32_t __nsets;\n\tint32_t __mem;\n\tint32_t __msg_hdr_offset;\n\tint32_t __msg_txt_offset;\n} ;\n\nstruct _nls_set_hdr {\n\tint32_t __setno;\t/* set number: 0 < x <= NL_SETMAX */\n\tint32_t __nmsgs;\t/* number of messages in the set  */\n\tint32_t __index;\t/* index of first msg_hdr in msg_hdr table */\n} ;\n\nstruct _nls_msg_hdr {\n\tint32_t __msgno;\t/* msg number: 0 < x <= NL_MSGMAX */\n\tint32_t __msglen;\n\tint32_t __offset;\n} ;\n\n#endif\t/* _NLS_PRIVATE */\n\n#define\tNL_SETD\t\t0\n#define\tNL_CAT_LOCALE\t1\n\ntypedef struct __nl_cat_d {\n\tvoid\t*__data;\n\tint\t__size;\n} *nl_catd;\n\n#ifndef _NL_ITEM_DECLARED\ntypedef\t__nl_item\tnl_item;\n#define\t_NL_ITEM_DECLARED\n#endif\n\n__BEGIN_DECLS\nnl_catd  catopen(const char *, int);\nchar    *catgets(nl_catd, int, int, const char *) __format_arg(4);\nint\t catclose(nl_catd);\n__END_DECLS\n\n#endif\t/* _NL_TYPES_H_ */\n"
  },
  {
    "path": "freebsd-headers/nlist.h",
    "content": "/*-\n * Copyright (c) 1991, 1993\n *\tThe Regents of the University of California.  All rights reserved.\n * (c) UNIX System Laboratories, Inc.\n * All or some portions of this file are derived from material licensed\n * to the University of California by American Telephone and Telegraph\n * Co. or Unix System Laboratories, Inc. and are reproduced herein with\n * the permission of UNIX System Laboratories, Inc.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t@(#)nlist.h\t8.2 (Berkeley) 1/21/94\n *\n * $FreeBSD: release/9.0.0/include/nlist.h 203964 2010-02-16 19:39:50Z imp $\n */\n\n#ifndef _NLIST_H_\n#define\t_NLIST_H_\n\n#include <sys/nlist_aout.h>\n#include <sys/cdefs.h>\n\n__BEGIN_DECLS\nint nlist(const char *, struct nlist *);\n__END_DECLS\n\n#endif /* !_NLIST_H_ */\n"
  },
  {
    "path": "freebsd-headers/nss.h",
    "content": "/*-\n * Copyright (c) 2003 Networks Associates Technology, Inc.\n * All rights reserved.\n *\n * This software was developed for the FreeBSD Project by\n * Jacques A. Vidrine, Safeport Network Services, and Network\n * Associates Laboratories, the Security Research Division of Network\n * Associates, Inc. under DARPA/SPAWAR contract N66001-01-C-8035\n * (\"CBOSS\"), as part of the DARPA CHATS research program.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/include/nss.h 124289 2004-01-09 13:43:49Z nectar $\n *\n * Compatibility header for the GNU C Library-style nsswitch interface.\n */\n#ifndef _NSS_H_\n#define _NSS_H_\n\n#include <nsswitch.h>\n\nenum nss_status {\n\tNSS_STATUS_TRYAGAIN = -2,\n\tNSS_STATUS_UNAVAIL,\n\tNSS_STATUS_NOTFOUND,\n\tNSS_STATUS_SUCCESS,\n\tNSS_STATUS_RETURN\n};\n\n#define __nss_compat_result(rv, err)\t\t\\\n((rv == NSS_STATUS_TRYAGAIN && err == ERANGE) ? NS_RETURN : \\\n (rv == NSS_STATUS_TRYAGAIN) ? NS_TRYAGAIN :\t\\\n (rv == NSS_STATUS_UNAVAIL)  ? NS_UNAVAIL  :\t\\\n (rv == NSS_STATUS_NOTFOUND) ? NS_NOTFOUND :\t\\\n (rv == NSS_STATUS_SUCCESS)  ? NS_SUCCESS  :\t\\\n (rv == NSS_STATUS_RETURN)   ? NS_RETURN   : 0)\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/nsswitch.h",
    "content": "/*\t$NetBSD: nsswitch.h,v 1.6 1999/01/26 01:04:07 lukem Exp $\t*/\n/*\t$FreeBSD: release/9.0.0/include/nsswitch.h 206155 2010-04-04 08:31:03Z ume $ */\n\n/*-\n * Copyright (c) 1997, 1998, 1999 The NetBSD Foundation, Inc.\n * All rights reserved.\n *\n * This code is derived from software contributed to The NetBSD Foundation\n * by Luke Mewburn.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS\n * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED\n * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\n * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS\n * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\n * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\n * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\n * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\n * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\n#ifndef _NSSWITCH_H\n#define _NSSWITCH_H\t1\n\n#include <sys/types.h>\n#include <stdarg.h>\n\n#define NSS_MODULE_INTERFACE_VERSION 1\n\n#ifndef _PATH_NS_CONF\n#define _PATH_NS_CONF\t\"/etc/nsswitch.conf\"\n#endif\n\n/* NSS source actions */\n#define\tNS_ACTION_CONTINUE\t0\t/* try the next source */\n#define\tNS_ACTION_RETURN\t1\t/* look no further */\n\n#define\tNS_SUCCESS\t(1<<0)\t\t/* entry was found */\n#define\tNS_UNAVAIL\t(1<<1)\t\t/* source not responding, or corrupt */\n#define\tNS_NOTFOUND\t(1<<2)\t\t/* source responded 'no such entry' */\n#define\tNS_TRYAGAIN\t(1<<3)\t\t/* source busy, may respond to retry */\n#define NS_RETURN\t(1<<4)\t\t/* stop search, e.g. for ERANGE */\n#define NS_TERMINATE\t(NS_SUCCESS|NS_RETURN) /* flags that end search */\n#define\tNS_STATUSMASK\t0x000000ff\t/* bitmask to get the status flags */\n\n/*\n * currently implemented sources\n */\n#define NSSRC_FILES\t\"files\"\t\t/* local files */\n#define\tNSSRC_DB\t\"db\"\t\t/* database */\n#define\tNSSRC_DNS\t\"dns\"\t\t/* DNS; IN for hosts, HS for others */\n#define\tNSSRC_NIS\t\"nis\"\t\t/* YP/NIS */\n#define\tNSSRC_COMPAT\t\"compat\"\t/* passwd,group in YP compat mode */\n#define\tNSSRC_CACHE\t\"cache\"\t\t/* nscd daemon */\n#define NSSRC_FALLBACK\t\"__fallback\"\t/* internal fallback source */\n\n/*\n * currently implemented databases\n */\n#define NSDB_HOSTS\t\t\"hosts\"\n#define NSDB_GROUP\t\t\"group\"\n#define NSDB_GROUP_COMPAT\t\"group_compat\"\n#define NSDB_NETGROUP\t\t\"netgroup\"\n#define NSDB_NETWORKS\t\t\"networks\"\n#define NSDB_PASSWD\t\t\"passwd\"\n#define NSDB_PASSWD_COMPAT\t\"passwd_compat\"\n#define NSDB_SHELLS\t\t\"shells\"\n#define NSDB_SERVICES\t\t\"services\"\n#define NSDB_SERVICES_COMPAT\t\"services_compat\"\n#define NSDB_SSH_HOSTKEYS\t\"ssh_hostkeys\"\n#define NSDB_PROTOCOLS\t\t\"protocols\"\n#define NSDB_RPC\t\t\"rpc\"\n\n/*\n * suggested databases to implement\n */\n#define NSDB_ALIASES\t\t\"aliases\"\n#define NSDB_AUTH\t\t\"auth\"\n#define NSDB_AUTOMOUNT\t\t\"automount\"\n#define NSDB_BOOTPARAMS\t\t\"bootparams\"\n#define NSDB_ETHERS\t\t\"ethers\"\n#define NSDB_EXPORTS\t\t\"exports\"\n#define NSDB_NETMASKS\t\t\"netmasks\"\n#define NSDB_PHONES\t\t\"phones\"\n#define NSDB_PRINTCAP\t\t\"printcap\"\n#define NSDB_REMOTE\t\t\"remote\"\n#define NSDB_SENDMAILVARS\t\"sendmailvars\"\n#define NSDB_TERMCAP\t\t\"termcap\"\n#define NSDB_TTYS\t\t\"ttys\"\n\n/*\n * ns_dtab `method' function signature.\n */ \ntypedef int (*nss_method)(void *_retval, void *_mdata, va_list _ap);\n\n/*\n * Macro for generating method prototypes.\n */\n#define NSS_METHOD_PROTOTYPE(method) \\\n\tint method(void *, void *, va_list)\n\n/*\n * ns_dtab - `nsswitch dispatch table'\n * Contains an entry for each source and the appropriate function to\n * call.  ns_dtabs are used in the nsdispatch() API in order to allow\n * the application to override built-in actions.\n */\ntypedef struct _ns_dtab {\n\tconst char\t *src;\t\t/* Source this entry implements */\n\tnss_method\t  method;\t/* Method to be called */\n\tvoid\t\t *mdata;\t/* Data passed to method */\n} ns_dtab;\n\n/*\n * macros to help build an ns_dtab[]\n */\n#define NS_FILES_CB(F,C)\t{ NSSRC_FILES,\tF,\tC },\n#define NS_COMPAT_CB(F,C)\t{ NSSRC_COMPAT,\tF,\tC },\n#define NS_FALLBACK_CB(F)\t{ NSSRC_FALLBACK, F,\tNULL },\n \n#ifdef HESIOD\n#   define NS_DNS_CB(F,C)\t{ NSSRC_DNS,\tF,\tC },\n#else\n#   define NS_DNS_CB(F,C)\n#endif\n\n#ifdef YP\n#   define NS_NIS_CB(F,C)\t{ NSSRC_NIS,\tF,\tC },\n#else\n#   define NS_NIS_CB(F,C)\n#endif\n\n/*\n * ns_src - `nsswitch source'\n * used by the nsparser routines to store a mapping between a source\n * and its dispatch control flags for a given database.\n */\ntypedef struct _ns_src {\n\tconst char\t*name;\n\tu_int32_t\t flags;\n} ns_src;\n\n\n/*\n * default sourcelist (if nsswitch.conf is missing, corrupt,\n * or the requested database doesn't have an entry.\n */\nextern const ns_src __nsdefaultsrc[];\n\n/*\n * ns_mtab - NSS method table\n * An NSS module provides a mapping from (database name, method name)\n * tuples to the nss_method and associated data.\n */\ntypedef struct _ns_mtab {\n\tconst char\t*database;\n\tconst char\t*name;\n\tnss_method\t method;\n\tvoid\t\t*mdata;\n} ns_mtab;\n\n/*\n * NSS module de-registration, called at module unload.\n */\ntypedef void\t (*nss_module_unregister_fn)(ns_mtab *, unsigned int);\n\n/*\n * NSS module registration, called at module load.\n */\ntypedef ns_mtab *(*nss_module_register_fn)(const char *, unsigned int *,\n\t\t       nss_module_unregister_fn *);\n\n/* \n * Many NSS interfaces follow the getXXnam, getXXid, getXXent pattern.\n * Developers are encouraged to use nss_lookup_type where approriate.\n */\nenum nss_lookup_type {\n\tnss_lt_name = 1,\n\tnss_lt_id   = 2,\n\tnss_lt_all  = 3\n};\n\n#ifdef _NS_PRIVATE\n/*\n * private data structures for back-end nsswitch implementation\n */\n\n/*\n * ns_dbt - `nsswitch database thang'\n * for each database in /etc/nsswitch.conf there is a ns_dbt, with its\n * name and a list of ns_src's containing the source information.\n */\ntypedef struct _ns_dbt {\n\tconst char\t*name;\t\t/* name of database */\n\tns_src\t\t*srclist;\t/* list of sources */\n\tint\t\t srclistsize;\t/* size of srclist */\n} ns_dbt;\n\n/*\n * ns_mod - NSS module\n */\ntypedef struct _ns_mod {\n\tchar\t\t*name;\t\t/* module name */\n\tvoid\t\t*handle;\t/* handle from dlopen */\n\tns_mtab\t\t*mtab;\t\t/* method table */\n\tunsigned int\t mtabsize;\t/* count of entries in method table */\n\tnss_module_unregister_fn unregister; /* called to unload module */\n} ns_mod;\n\n#endif /* _NS_PRIVATE */\n\n\n#include <sys/cdefs.h>\n\n__BEGIN_DECLS\nextern\tint\tnsdispatch(void *, const ns_dtab [], const char *,\n\t\t\t   const char *, const ns_src [], ...);\n\n#ifdef _NS_PRIVATE\nextern\tvoid\t\t _nsdbtaddsrc(ns_dbt *, const ns_src *);\nextern\tvoid\t\t _nsdbtput(const ns_dbt *);\nextern\tvoid\t\t _nsyyerror(const char *);\nextern\tint\t\t _nsyylex(void);\nextern\tint\t\t _nsyyparse(void);\nextern\tint\t\t _nsyylineno;\n#ifdef _NSS_DEBUG\nextern\tvoid\t\t _nsdbtdump(const ns_dbt *);\n#endif\n#endif /* _NS_PRIVATE */\n\n__END_DECLS\n\n#endif /* !_NSSWITCH_H */\n"
  },
  {
    "path": "freebsd-headers/ocsp_asn1.h",
    "content": "/* Generated from /usr/src/kerberos5/lib/libhx509/../../../crypto/heimdal/lib/hx509/ocsp.asn1 */\n/* Do not edit */\n\n#ifndef __ocsp_asn1_h__\n#define __ocsp_asn1_h__\n\n#include <stddef.h>\n#include <time.h>\n\n#ifndef __asn1_common_definitions__\n#define __asn1_common_definitions__\n\ntypedef struct heim_integer {\n  size_t length;\n  void *data;\n  int negative;\n} heim_integer;\n\ntypedef struct heim_octet_string {\n  size_t length;\n  void *data;\n} heim_octet_string;\n\ntypedef char *heim_general_string;\n\ntypedef char *heim_utf8_string;\n\ntypedef char *heim_printable_string;\n\ntypedef char *heim_ia5_string;\n\ntypedef struct heim_bmp_string {\n  size_t length;\n  uint16_t *data;\n} heim_bmp_string;\n\ntypedef struct heim_universal_string {\n  size_t length;\n  uint32_t *data;\n} heim_universal_string;\n\ntypedef char *heim_visible_string;\n\ntypedef struct heim_oid {\n  size_t length;\n  unsigned *components;\n} heim_oid;\n\ntypedef struct heim_bit_string {\n  size_t length;\n  void *data;\n} heim_bit_string;\n\ntypedef struct heim_octet_string heim_any;\ntypedef struct heim_octet_string heim_any_set;\n\n#define ASN1_MALLOC_ENCODE(T, B, BL, S, L, R)                  \\\n  do {                                                         \\\n    (BL) = length_##T((S));                                    \\\n    (B) = malloc((BL));                                        \\\n    if((B) == NULL) {                                          \\\n      (R) = ENOMEM;                                            \\\n    } else {                                                   \\\n      (R) = encode_##T(((unsigned char*)(B)) + (BL) - 1, (BL), \\\n                       (S), (L));                              \\\n      if((R) != 0) {                                           \\\n        free((B));                                             \\\n        (B) = NULL;                                            \\\n      }                                                        \\\n    }                                                          \\\n  } while (0)\n\nstruct units;\n\n#endif\n\n#include <rfc2459_asn1.h>\n/*\nOCSPVersion ::= INTEGER {\n  ocsp_v1(0)\n}\n*/\n\ntypedef enum OCSPVersion {\n  ocsp_v1 = 0\n} OCSPVersion;\n\nint    encode_OCSPVersion(unsigned char *, size_t, const OCSPVersion *, size_t *);\nint    decode_OCSPVersion(const unsigned char *, size_t, OCSPVersion *, size_t *);\nvoid   free_OCSPVersion  (OCSPVersion *);\nsize_t length_OCSPVersion(const OCSPVersion *);\nint    copy_OCSPVersion  (const OCSPVersion *, OCSPVersion *);\n\n\n/*\nOCSPCertStatus ::= CHOICE {\n  good            [0] IMPLICIT   NULL,\n  revoked         [1] IMPLICIT SEQUENCE {\n    revocationTime     GeneralizedTime,\n    revocationReason   [0] CRLReason OPTIONAL,\n  },\n  unknown         [2] IMPLICIT   NULL,\n}\n*/\n\ntypedef struct OCSPCertStatus {\n  enum {\n    choice_OCSPCertStatus_good = 1,\n    choice_OCSPCertStatus_revoked,\n    choice_OCSPCertStatus_unknown\n  } element;\n  union {\n    int good;\n    struct  {\n      time_t revocationTime;\n      CRLReason *revocationReason;\n    } revoked;\n    int unknown;\n  } u;\n} OCSPCertStatus;\n\nint    encode_OCSPCertStatus(unsigned char *, size_t, const OCSPCertStatus *, size_t *);\nint    decode_OCSPCertStatus(const unsigned char *, size_t, OCSPCertStatus *, size_t *);\nvoid   free_OCSPCertStatus  (OCSPCertStatus *);\nsize_t length_OCSPCertStatus(const OCSPCertStatus *);\nint    copy_OCSPCertStatus  (const OCSPCertStatus *, OCSPCertStatus *);\n\n\n/*\nOCSPCertID ::= SEQUENCE {\n  hashAlgorithm    AlgorithmIdentifier,\n  issuerNameHash   OCTET STRING,\n  issuerKeyHash    OCTET STRING,\n  serialNumber     CertificateSerialNumber,\n}\n*/\n\ntypedef struct OCSPCertID {\n  AlgorithmIdentifier hashAlgorithm;\n  heim_octet_string issuerNameHash;\n  heim_octet_string issuerKeyHash;\n  CertificateSerialNumber serialNumber;\n} OCSPCertID;\n\nint    encode_OCSPCertID(unsigned char *, size_t, const OCSPCertID *, size_t *);\nint    decode_OCSPCertID(const unsigned char *, size_t, OCSPCertID *, size_t *);\nvoid   free_OCSPCertID  (OCSPCertID *);\nsize_t length_OCSPCertID(const OCSPCertID *);\nint    copy_OCSPCertID  (const OCSPCertID *, OCSPCertID *);\n\n\n/*\nOCSPSingleResponse ::= SEQUENCE {\n  certID             OCSPCertID,\n  certStatus         OCSPCertStatus,\n  thisUpdate         GeneralizedTime,\n  nextUpdate         [0] GeneralizedTime OPTIONAL,\n  singleExtensions   [1] Extensions OPTIONAL,\n}\n*/\n\ntypedef struct OCSPSingleResponse {\n  OCSPCertID certID;\n  OCSPCertStatus certStatus;\n  time_t thisUpdate;\n  time_t *nextUpdate;\n  Extensions *singleExtensions;\n} OCSPSingleResponse;\n\nint    encode_OCSPSingleResponse(unsigned char *, size_t, const OCSPSingleResponse *, size_t *);\nint    decode_OCSPSingleResponse(const unsigned char *, size_t, OCSPSingleResponse *, size_t *);\nvoid   free_OCSPSingleResponse  (OCSPSingleResponse *);\nsize_t length_OCSPSingleResponse(const OCSPSingleResponse *);\nint    copy_OCSPSingleResponse  (const OCSPSingleResponse *, OCSPSingleResponse *);\n\n\n/*\nOCSPInnerRequest ::= SEQUENCE {\n  reqCert                   OCSPCertID,\n  singleRequestExtensions   [0] Extensions OPTIONAL,\n}\n*/\n\ntypedef struct OCSPInnerRequest {\n  OCSPCertID reqCert;\n  Extensions *singleRequestExtensions;\n} OCSPInnerRequest;\n\nint    encode_OCSPInnerRequest(unsigned char *, size_t, const OCSPInnerRequest *, size_t *);\nint    decode_OCSPInnerRequest(const unsigned char *, size_t, OCSPInnerRequest *, size_t *);\nvoid   free_OCSPInnerRequest  (OCSPInnerRequest *);\nsize_t length_OCSPInnerRequest(const OCSPInnerRequest *);\nint    copy_OCSPInnerRequest  (const OCSPInnerRequest *, OCSPInnerRequest *);\n\n\n/*\nOCSPTBSRequest ::= SEQUENCE {\n  version             [0] OCSPVersion OPTIONAL,\n  requestorName       [1] GeneralName OPTIONAL,\n  requestList         SEQUENCE OF OCSPInnerRequest,\n  requestExtensions   [2] Extensions OPTIONAL,\n}\n*/\n\ntypedef struct OCSPTBSRequest {\n  heim_octet_string _save;\n  OCSPVersion *version;\n  GeneralName *requestorName;\n  struct  {\n    unsigned int len;\n    OCSPInnerRequest *val;\n  } requestList;\n  Extensions *requestExtensions;\n} OCSPTBSRequest;\n\nint    encode_OCSPTBSRequest(unsigned char *, size_t, const OCSPTBSRequest *, size_t *);\nint    decode_OCSPTBSRequest(const unsigned char *, size_t, OCSPTBSRequest *, size_t *);\nvoid   free_OCSPTBSRequest  (OCSPTBSRequest *);\nsize_t length_OCSPTBSRequest(const OCSPTBSRequest *);\nint    copy_OCSPTBSRequest  (const OCSPTBSRequest *, OCSPTBSRequest *);\n\n\n/*\nOCSPSignature ::= SEQUENCE {\n  signatureAlgorithm   AlgorithmIdentifier,\n  signature              BIT STRING {\n  },\n  certs                [0] SEQUENCE OF Certificate OPTIONAL,\n}\n*/\n\ntypedef struct OCSPSignature {\n  AlgorithmIdentifier signatureAlgorithm;\n  heim_bit_string signature;\n  struct  {\n    unsigned int len;\n    Certificate *val;\n  } *certs;\n} OCSPSignature;\n\nint    encode_OCSPSignature(unsigned char *, size_t, const OCSPSignature *, size_t *);\nint    decode_OCSPSignature(const unsigned char *, size_t, OCSPSignature *, size_t *);\nvoid   free_OCSPSignature  (OCSPSignature *);\nsize_t length_OCSPSignature(const OCSPSignature *);\nint    copy_OCSPSignature  (const OCSPSignature *, OCSPSignature *);\n\n\n/*\nOCSPRequest ::= SEQUENCE {\n  tbsRequest          OCSPTBSRequest,\n  optionalSignature   [0] OCSPSignature OPTIONAL,\n}\n*/\n\ntypedef struct OCSPRequest {\n  OCSPTBSRequest tbsRequest;\n  OCSPSignature *optionalSignature;\n} OCSPRequest;\n\nint    encode_OCSPRequest(unsigned char *, size_t, const OCSPRequest *, size_t *);\nint    decode_OCSPRequest(const unsigned char *, size_t, OCSPRequest *, size_t *);\nvoid   free_OCSPRequest  (OCSPRequest *);\nsize_t length_OCSPRequest(const OCSPRequest *);\nint    copy_OCSPRequest  (const OCSPRequest *, OCSPRequest *);\n\n\n/*\nOCSPResponseBytes ::= SEQUENCE {\n  responseType      OBJECT IDENTIFIER,\n  response        OCTET STRING,\n}\n*/\n\ntypedef struct OCSPResponseBytes {\n  heim_oid responseType;\n  heim_octet_string response;\n} OCSPResponseBytes;\n\nint    encode_OCSPResponseBytes(unsigned char *, size_t, const OCSPResponseBytes *, size_t *);\nint    decode_OCSPResponseBytes(const unsigned char *, size_t, OCSPResponseBytes *, size_t *);\nvoid   free_OCSPResponseBytes  (OCSPResponseBytes *);\nsize_t length_OCSPResponseBytes(const OCSPResponseBytes *);\nint    copy_OCSPResponseBytes  (const OCSPResponseBytes *, OCSPResponseBytes *);\n\n\n/*\nOCSPResponseStatus ::= INTEGER {\n  successful(0),\n  malformedRequest(1),\n  internalError(2),\n  tryLater(3),\n  sigRequired(5),\n  unauthorized(6)\n}\n*/\n\ntypedef enum OCSPResponseStatus {\n  successful = 0,\n  malformedRequest = 1,\n  internalError = 2,\n  tryLater = 3,\n  sigRequired = 5,\n  unauthorized = 6\n} OCSPResponseStatus;\n\nint    encode_OCSPResponseStatus(unsigned char *, size_t, const OCSPResponseStatus *, size_t *);\nint    decode_OCSPResponseStatus(const unsigned char *, size_t, OCSPResponseStatus *, size_t *);\nvoid   free_OCSPResponseStatus  (OCSPResponseStatus *);\nsize_t length_OCSPResponseStatus(const OCSPResponseStatus *);\nint    copy_OCSPResponseStatus  (const OCSPResponseStatus *, OCSPResponseStatus *);\n\n\n/*\nOCSPResponse ::= SEQUENCE {\n  responseStatus   OCSPResponseStatus,\n  responseBytes    [0] OCSPResponseBytes OPTIONAL,\n}\n*/\n\ntypedef struct OCSPResponse {\n  OCSPResponseStatus responseStatus;\n  OCSPResponseBytes *responseBytes;\n} OCSPResponse;\n\nint    encode_OCSPResponse(unsigned char *, size_t, const OCSPResponse *, size_t *);\nint    decode_OCSPResponse(const unsigned char *, size_t, OCSPResponse *, size_t *);\nvoid   free_OCSPResponse  (OCSPResponse *);\nsize_t length_OCSPResponse(const OCSPResponse *);\nint    copy_OCSPResponse  (const OCSPResponse *, OCSPResponse *);\n\n\n/*\nOCSPKeyHash ::= OCTET STRING\n*/\n\ntypedef heim_octet_string OCSPKeyHash;\n\nint    encode_OCSPKeyHash(unsigned char *, size_t, const OCSPKeyHash *, size_t *);\nint    decode_OCSPKeyHash(const unsigned char *, size_t, OCSPKeyHash *, size_t *);\nvoid   free_OCSPKeyHash  (OCSPKeyHash *);\nsize_t length_OCSPKeyHash(const OCSPKeyHash *);\nint    copy_OCSPKeyHash  (const OCSPKeyHash *, OCSPKeyHash *);\n\n\n/*\nOCSPResponderID ::= CHOICE {\n  byName          [1] Name,\n  byKey           [2] OCSPKeyHash,\n}\n*/\n\ntypedef struct OCSPResponderID {\n  enum {\n    choice_OCSPResponderID_byName = 1,\n    choice_OCSPResponderID_byKey\n  } element;\n  union {\n    Name byName;\n    OCSPKeyHash byKey;\n  } u;\n} OCSPResponderID;\n\nint    encode_OCSPResponderID(unsigned char *, size_t, const OCSPResponderID *, size_t *);\nint    decode_OCSPResponderID(const unsigned char *, size_t, OCSPResponderID *, size_t *);\nvoid   free_OCSPResponderID  (OCSPResponderID *);\nsize_t length_OCSPResponderID(const OCSPResponderID *);\nint    copy_OCSPResponderID  (const OCSPResponderID *, OCSPResponderID *);\n\n\n/*\nOCSPResponseData ::= SEQUENCE {\n  version              [0] OCSPVersion OPTIONAL,\n  responderID          OCSPResponderID,\n  producedAt           GeneralizedTime,\n  responses            SEQUENCE OF OCSPSingleResponse,\n  responseExtensions   [1] Extensions OPTIONAL,\n}\n*/\n\ntypedef struct OCSPResponseData {\n  heim_octet_string _save;\n  OCSPVersion *version;\n  OCSPResponderID responderID;\n  time_t producedAt;\n  struct  {\n    unsigned int len;\n    OCSPSingleResponse *val;\n  } responses;\n  Extensions *responseExtensions;\n} OCSPResponseData;\n\nint    encode_OCSPResponseData(unsigned char *, size_t, const OCSPResponseData *, size_t *);\nint    decode_OCSPResponseData(const unsigned char *, size_t, OCSPResponseData *, size_t *);\nvoid   free_OCSPResponseData  (OCSPResponseData *);\nsize_t length_OCSPResponseData(const OCSPResponseData *);\nint    copy_OCSPResponseData  (const OCSPResponseData *, OCSPResponseData *);\n\n\n/*\nOCSPBasicOCSPResponse ::= SEQUENCE {\n  tbsResponseData      OCSPResponseData,\n  signatureAlgorithm   AlgorithmIdentifier,\n  signature              BIT STRING {\n  },\n  certs                [0] SEQUENCE OF Certificate OPTIONAL,\n}\n*/\n\ntypedef struct OCSPBasicOCSPResponse {\n  OCSPResponseData tbsResponseData;\n  AlgorithmIdentifier signatureAlgorithm;\n  heim_bit_string signature;\n  struct  {\n    unsigned int len;\n    Certificate *val;\n  } *certs;\n} OCSPBasicOCSPResponse;\n\nint    encode_OCSPBasicOCSPResponse(unsigned char *, size_t, const OCSPBasicOCSPResponse *, size_t *);\nint    decode_OCSPBasicOCSPResponse(const unsigned char *, size_t, OCSPBasicOCSPResponse *, size_t *);\nvoid   free_OCSPBasicOCSPResponse  (OCSPBasicOCSPResponse *);\nsize_t length_OCSPBasicOCSPResponse(const OCSPBasicOCSPResponse *);\nint    copy_OCSPBasicOCSPResponse  (const OCSPBasicOCSPResponse *, OCSPBasicOCSPResponse *);\n\n\n/* OBJECT IDENTIFIER id-pkix-ocsp ::= { iso(1) identified-organization(3) dod(6) internet(1) security(5) mechanisms(5) pkix(7) pkix-ad(48) label-less(1) } */\nconst heim_oid *oid_id_pkix_ocsp(void);\n\n/* OBJECT IDENTIFIER id-pkix-ocsp-basic ::= { iso(1) identified-organization(3) dod(6) internet(1) security(5) mechanisms(5) pkix(7) pkix-ad(48) label-less(1) label-less(1) } */\nconst heim_oid *oid_id_pkix_ocsp_basic(void);\n\n/* OBJECT IDENTIFIER id-pkix-ocsp-nonce ::= { iso(1) identified-organization(3) dod(6) internet(1) security(5) mechanisms(5) pkix(7) pkix-ad(48) label-less(1) label-less(2) } */\nconst heim_oid *oid_id_pkix_ocsp_nonce(void);\n\n#endif /* __ocsp_asn1_h__ */\n"
  },
  {
    "path": "freebsd-headers/omp.h",
    "content": "/* Copyright (C) 2005 Free Software Foundation, Inc.\n   Contributed by Richard Henderson <rth@redhat.com>.\n\n   This file is part of the GNU OpenMP Library (libgomp).\n\n   Libgomp is free software; you can redistribute it and/or modify it\n   under the terms of the GNU Lesser General Public License as published by\n   the Free Software Foundation; either version 2.1 of the License, or\n   (at your option) any later version.\n\n   Libgomp is distributed in the hope that it will be useful, but WITHOUT ANY\n   WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS\n   FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for\n   more details.\n\n   You should have received a copy of the GNU Lesser General Public License \n   along with libgomp; see the file COPYING.LIB.  If not, write to the\n   Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,\n   MA 02110-1301, USA.  */\n\n/* As a special exception, if you link this library with other files, some\n   of which are compiled with GCC, to produce an executable, this library\n   does not by itself cause the resulting executable to be covered by the\n   GNU General Public License.  This exception does not however invalidate\n   any other reasons why the executable file might be covered by the GNU\n   General Public License.  */\n\n#ifndef OMP_H\n#define OMP_H 1\n\n#ifndef _LIBGOMP_OMP_LOCK_DEFINED\n#define _LIBGOMP_OMP_LOCK_DEFINED 1\n/* These two structures get edited by the libgomp build process to \n   reflect the shape of the two types.  Their internals are private\n   to the library.  */\n\ntypedef struct\n{\n  unsigned char _x[8] \n    __attribute__((__aligned__(8)));\n} omp_lock_t;\n\ntypedef struct\n{\n  unsigned char _x[16] \n    __attribute__((__aligned__(8)));\n} omp_nest_lock_t;\n#endif\n\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\nextern void omp_set_num_threads (int);\nextern int omp_get_num_threads (void);\nextern int omp_get_max_threads (void);\nextern int omp_get_thread_num (void);\nextern int omp_get_num_procs (void);\n\nextern int omp_in_parallel (void);\n\nextern void omp_set_dynamic (int);\nextern int omp_get_dynamic (void);\n\nextern void omp_set_nested (int);\nextern int omp_get_nested (void);\n\nextern void omp_init_lock (omp_lock_t *);\nextern void omp_destroy_lock (omp_lock_t *);\nextern void omp_set_lock (omp_lock_t *);\nextern void omp_unset_lock (omp_lock_t *);\nextern int omp_test_lock (omp_lock_t *);\n\nextern void omp_init_nest_lock (omp_nest_lock_t *);\nextern void omp_destroy_nest_lock (omp_nest_lock_t *);\nextern void omp_set_nest_lock (omp_nest_lock_t *);\nextern void omp_unset_nest_lock (omp_nest_lock_t *);\nextern int omp_test_nest_lock (omp_nest_lock_t *);\n\nextern double omp_get_wtime (void);\nextern double omp_get_wtick (void);\n\n#ifdef __cplusplus\n}\n#endif\n\n#endif /* OMP_H */\n"
  },
  {
    "path": "freebsd-headers/openssl/aes.h",
    "content": "/* crypto/aes/aes.h -*- mode:C; c-file-style: \"eay\" -*- */\n/* ====================================================================\n * Copyright (c) 1998-2002 The OpenSSL Project.  All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n *\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer. \n *\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in\n *    the documentation and/or other materials provided with the\n *    distribution.\n *\n * 3. All advertising materials mentioning features or use of this\n *    software must display the following acknowledgment:\n *    \"This product includes software developed by the OpenSSL Project\n *    for use in the OpenSSL Toolkit. (http://www.openssl.org/)\"\n *\n * 4. The names \"OpenSSL Toolkit\" and \"OpenSSL Project\" must not be used to\n *    endorse or promote products derived from this software without\n *    prior written permission. For written permission, please contact\n *    openssl-core@openssl.org.\n *\n * 5. Products derived from this software may not be called \"OpenSSL\"\n *    nor may \"OpenSSL\" appear in their names without prior written\n *    permission of the OpenSSL Project.\n *\n * 6. Redistributions of any form whatsoever must retain the following\n *    acknowledgment:\n *    \"This product includes software developed by the OpenSSL Project\n *    for use in the OpenSSL Toolkit (http://www.openssl.org/)\"\n *\n * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY\n * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\n * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE OpenSSL PROJECT OR\n * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\n * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,\n * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED\n * OF THE POSSIBILITY OF SUCH DAMAGE.\n * ====================================================================\n *\n */\n\n#ifndef HEADER_AES_H\n#define HEADER_AES_H\n\n#include <openssl/opensslconf.h>\n\n#ifdef OPENSSL_NO_AES\n#error AES is disabled.\n#endif\n\n#define AES_ENCRYPT\t1\n#define AES_DECRYPT\t0\n\n/* Because array size can't be a const in C, the following two are macros.\n   Both sizes are in bytes. */\n#define AES_MAXNR 14\n#define AES_BLOCK_SIZE 16\n\n#ifdef OPENSSL_FIPS\n#define FIPS_AES_SIZE_T\tint\n#endif\n\n#ifdef  __cplusplus\nextern \"C\" {\n#endif\n\n/* This should be a hidden type, but EVP requires that the size be known */\nstruct aes_key_st {\n#ifdef AES_LONG\n    unsigned long rd_key[4 *(AES_MAXNR + 1)];\n#else\n    unsigned int rd_key[4 *(AES_MAXNR + 1)];\n#endif\n    int rounds;\n};\ntypedef struct aes_key_st AES_KEY;\n\nconst char *AES_options(void);\n\nint AES_set_encrypt_key(const unsigned char *userKey, const int bits,\n\tAES_KEY *key);\nint AES_set_decrypt_key(const unsigned char *userKey, const int bits,\n\tAES_KEY *key);\n\nvoid AES_encrypt(const unsigned char *in, unsigned char *out,\n\tconst AES_KEY *key);\nvoid AES_decrypt(const unsigned char *in, unsigned char *out,\n\tconst AES_KEY *key);\n\nvoid AES_ecb_encrypt(const unsigned char *in, unsigned char *out,\n\tconst AES_KEY *key, const int enc);\nvoid AES_cbc_encrypt(const unsigned char *in, unsigned char *out,\n\tconst unsigned long length, const AES_KEY *key,\n\tunsigned char *ivec, const int enc);\nvoid AES_cfb128_encrypt(const unsigned char *in, unsigned char *out,\n\tconst unsigned long length, const AES_KEY *key,\n\tunsigned char *ivec, int *num, const int enc);\nvoid AES_cfb1_encrypt(const unsigned char *in, unsigned char *out,\n\tconst unsigned long length, const AES_KEY *key,\n\tunsigned char *ivec, int *num, const int enc);\nvoid AES_cfb8_encrypt(const unsigned char *in, unsigned char *out,\n\tconst unsigned long length, const AES_KEY *key,\n\tunsigned char *ivec, int *num, const int enc);\nvoid AES_cfbr_encrypt_block(const unsigned char *in,unsigned char *out,\n\t\t\t    const int nbits,const AES_KEY *key,\n\t\t\t    unsigned char *ivec,const int enc);\nvoid AES_ofb128_encrypt(const unsigned char *in, unsigned char *out,\n\tconst unsigned long length, const AES_KEY *key,\n\tunsigned char *ivec, int *num);\nvoid AES_ctr128_encrypt(const unsigned char *in, unsigned char *out,\n\tconst unsigned long length, const AES_KEY *key,\n\tunsigned char ivec[AES_BLOCK_SIZE],\n\tunsigned char ecount_buf[AES_BLOCK_SIZE],\n\tunsigned int *num);\n\n/* For IGE, see also http://www.links.org/files/openssl-ige.pdf */\n/* NB: the IV is _two_ blocks long */\nvoid AES_ige_encrypt(const unsigned char *in, unsigned char *out,\n\t\t     const unsigned long length, const AES_KEY *key,\n\t\t     unsigned char *ivec, const int enc);\n/* NB: the IV is _four_ blocks long */\nvoid AES_bi_ige_encrypt(const unsigned char *in, unsigned char *out,\n\t\t\tconst unsigned long length, const AES_KEY *key,\n\t\t\tconst AES_KEY *key2, const unsigned char *ivec,\n\t\t\tconst int enc);\n\nint AES_wrap_key(AES_KEY *key, const unsigned char *iv,\n\t\tunsigned char *out,\n\t\tconst unsigned char *in, unsigned int inlen);\nint AES_unwrap_key(AES_KEY *key, const unsigned char *iv,\n\t\tunsigned char *out,\n\t\tconst unsigned char *in, unsigned int inlen);\n\n#ifdef  __cplusplus\n}\n#endif\n\n#endif /* !HEADER_AES_H */\n"
  },
  {
    "path": "freebsd-headers/openssl/aes_locl.h",
    "content": "/* crypto/aes/aes.h -*- mode:C; c-file-style: \"eay\" -*- */\n/* ====================================================================\n * Copyright (c) 1998-2002 The OpenSSL Project.  All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n *\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer. \n *\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in\n *    the documentation and/or other materials provided with the\n *    distribution.\n *\n * 3. All advertising materials mentioning features or use of this\n *    software must display the following acknowledgment:\n *    \"This product includes software developed by the OpenSSL Project\n *    for use in the OpenSSL Toolkit. (http://www.openssl.org/)\"\n *\n * 4. The names \"OpenSSL Toolkit\" and \"OpenSSL Project\" must not be used to\n *    endorse or promote products derived from this software without\n *    prior written permission. For written permission, please contact\n *    openssl-core@openssl.org.\n *\n * 5. Products derived from this software may not be called \"OpenSSL\"\n *    nor may \"OpenSSL\" appear in their names without prior written\n *    permission of the OpenSSL Project.\n *\n * 6. Redistributions of any form whatsoever must retain the following\n *    acknowledgment:\n *    \"This product includes software developed by the OpenSSL Project\n *    for use in the OpenSSL Toolkit (http://www.openssl.org/)\"\n *\n * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY\n * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\n * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE OpenSSL PROJECT OR\n * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\n * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,\n * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED\n * OF THE POSSIBILITY OF SUCH DAMAGE.\n * ====================================================================\n *\n */\n\n#ifndef HEADER_AES_LOCL_H\n#define HEADER_AES_LOCL_H\n\n#include <openssl/e_os2.h>\n\n#ifdef OPENSSL_NO_AES\n#error AES is disabled.\n#endif\n\n#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n\n#if defined(_MSC_VER) && (defined(_M_IX86) || defined(_M_AMD64) || defined(_M_X64))\n# define SWAP(x) (_lrotl(x, 8) & 0x00ff00ff | _lrotr(x, 8) & 0xff00ff00)\n# define GETU32(p) SWAP(*((u32 *)(p)))\n# define PUTU32(ct, st) { *((u32 *)(ct)) = SWAP((st)); }\n#else\n# define GETU32(pt) (((u32)(pt)[0] << 24) ^ ((u32)(pt)[1] << 16) ^ ((u32)(pt)[2] <<  8) ^ ((u32)(pt)[3]))\n# define PUTU32(ct, st) { (ct)[0] = (u8)((st) >> 24); (ct)[1] = (u8)((st) >> 16); (ct)[2] = (u8)((st) >>  8); (ct)[3] = (u8)(st); }\n#endif\n\n#ifdef AES_LONG\ntypedef unsigned long u32;\n#else\ntypedef unsigned int u32;\n#endif\ntypedef unsigned short u16;\ntypedef unsigned char u8;\n\n#define MAXKC   (256/32)\n#define MAXKB   (256/8)\n#define MAXNR   14\n\n/* This controls loop-unrolling in aes_core.c */\n#undef FULL_UNROLL\n\n#endif /* !HEADER_AES_LOCL_H */\n"
  },
  {
    "path": "freebsd-headers/openssl/asn1.h",
    "content": "/* crypto/asn1/asn1.h */\n/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)\n * All rights reserved.\n *\n * This package is an SSL implementation written\n * by Eric Young (eay@cryptsoft.com).\n * The implementation was written so as to conform with Netscapes SSL.\n * \n * This library is free for commercial and non-commercial use as long as\n * the following conditions are aheared to.  The following conditions\n * apply to all code found in this distribution, be it the RC4, RSA,\n * lhash, DES, etc., code; not just the SSL code.  The SSL documentation\n * included with this distribution is covered by the same copyright terms\n * except that the holder is Tim Hudson (tjh@cryptsoft.com).\n * \n * Copyright remains Eric Young's, and as such any Copyright notices in\n * the code are not to be removed.\n * If this package is used in a product, Eric Young should be given attribution\n * as the author of the parts of the library used.\n * This can be in the form of a textual message at program startup or\n * in documentation (online or textual) provided with the package.\n * \n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. All advertising materials mentioning features or use of this software\n *    must display the following acknowledgement:\n *    \"This product includes cryptographic software written by\n *     Eric Young (eay@cryptsoft.com)\"\n *    The word 'cryptographic' can be left out if the rouines from the library\n *    being used are not cryptographic related :-).\n * 4. If you include any Windows specific code (or a derivative thereof) from \n *    the apps directory (application code) you must include an acknowledgement:\n *    \"This product includes software written by Tim Hudson (tjh@cryptsoft.com)\"\n * \n * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n * \n * The licence and distribution terms for any publically available version or\n * derivative of this code cannot be changed.  i.e. this code cannot simply be\n * copied and put under another distribution licence\n * [including the GNU Public Licence.]\n */\n\n#ifndef HEADER_ASN1_H\n#define HEADER_ASN1_H\n\n#include <time.h>\n#include <openssl/e_os2.h>\n#ifndef OPENSSL_NO_BIO\n#include <openssl/bio.h>\n#endif\n#include <openssl/stack.h>\n#include <openssl/safestack.h>\n\n#include <openssl/symhacks.h>\n\n#include <openssl/ossl_typ.h>\n#ifndef OPENSSL_NO_DEPRECATED\n#include <openssl/bn.h>\n#endif\n\n#ifdef OPENSSL_BUILD_SHLIBCRYPTO\n# undef OPENSSL_EXTERN\n# define OPENSSL_EXTERN OPENSSL_EXPORT\n#endif\n\n#ifdef  __cplusplus\nextern \"C\" {\n#endif\n\n#define V_ASN1_UNIVERSAL\t\t0x00\n#define\tV_ASN1_APPLICATION\t\t0x40\n#define V_ASN1_CONTEXT_SPECIFIC\t\t0x80\n#define V_ASN1_PRIVATE\t\t\t0xc0\n\n#define V_ASN1_CONSTRUCTED\t\t0x20\n#define V_ASN1_PRIMITIVE_TAG\t\t0x1f\n#define V_ASN1_PRIMATIVE_TAG\t\t0x1f\n\n#define V_ASN1_APP_CHOOSE\t\t-2\t/* let the recipient choose */\n#define V_ASN1_OTHER\t\t\t-3\t/* used in ASN1_TYPE */\n#define V_ASN1_ANY\t\t\t-4\t/* used in ASN1 template code */\n\n#define V_ASN1_NEG\t\t\t0x100\t/* negative flag */\n\n#define V_ASN1_UNDEF\t\t\t-1\n#define V_ASN1_EOC\t\t\t0\n#define V_ASN1_BOOLEAN\t\t\t1\t/**/\n#define V_ASN1_INTEGER\t\t\t2\n#define V_ASN1_NEG_INTEGER\t\t(2 | V_ASN1_NEG)\n#define V_ASN1_BIT_STRING\t\t3\n#define V_ASN1_OCTET_STRING\t\t4\n#define V_ASN1_NULL\t\t\t5\n#define V_ASN1_OBJECT\t\t\t6\n#define V_ASN1_OBJECT_DESCRIPTOR\t7\n#define V_ASN1_EXTERNAL\t\t\t8\n#define V_ASN1_REAL\t\t\t9\n#define V_ASN1_ENUMERATED\t\t10\n#define V_ASN1_NEG_ENUMERATED\t\t(10 | V_ASN1_NEG)\n#define V_ASN1_UTF8STRING\t\t12\n#define V_ASN1_SEQUENCE\t\t\t16\n#define V_ASN1_SET\t\t\t17\n#define V_ASN1_NUMERICSTRING\t\t18\t/**/\n#define V_ASN1_PRINTABLESTRING\t\t19\n#define V_ASN1_T61STRING\t\t20\n#define V_ASN1_TELETEXSTRING\t\t20\t/* alias */\n#define V_ASN1_VIDEOTEXSTRING\t\t21\t/**/\n#define V_ASN1_IA5STRING\t\t22\n#define V_ASN1_UTCTIME\t\t\t23\n#define V_ASN1_GENERALIZEDTIME\t\t24\t/**/\n#define V_ASN1_GRAPHICSTRING\t\t25\t/**/\n#define V_ASN1_ISO64STRING\t\t26\t/**/\n#define V_ASN1_VISIBLESTRING\t\t26\t/* alias */\n#define V_ASN1_GENERALSTRING\t\t27\t/**/\n#define V_ASN1_UNIVERSALSTRING\t\t28\t/**/\n#define V_ASN1_BMPSTRING\t\t30\n\n/* For use with d2i_ASN1_type_bytes() */\n#define B_ASN1_NUMERICSTRING\t0x0001\n#define B_ASN1_PRINTABLESTRING\t0x0002\n#define B_ASN1_T61STRING\t0x0004\n#define B_ASN1_TELETEXSTRING\t0x0004\n#define B_ASN1_VIDEOTEXSTRING\t0x0008\n#define B_ASN1_IA5STRING\t0x0010\n#define B_ASN1_GRAPHICSTRING\t0x0020\n#define B_ASN1_ISO64STRING\t0x0040\n#define B_ASN1_VISIBLESTRING\t0x0040\n#define B_ASN1_GENERALSTRING\t0x0080\n#define B_ASN1_UNIVERSALSTRING\t0x0100\n#define B_ASN1_OCTET_STRING\t0x0200\n#define B_ASN1_BIT_STRING\t0x0400\n#define B_ASN1_BMPSTRING\t0x0800\n#define B_ASN1_UNKNOWN\t\t0x1000\n#define B_ASN1_UTF8STRING\t0x2000\n#define B_ASN1_UTCTIME\t\t0x4000\n#define B_ASN1_GENERALIZEDTIME\t0x8000\n#define B_ASN1_SEQUENCE\t\t0x10000\n\n/* For use with ASN1_mbstring_copy() */\n#define MBSTRING_FLAG\t\t0x1000\n#define MBSTRING_UTF8\t\t(MBSTRING_FLAG)\n#define MBSTRING_ASC\t\t(MBSTRING_FLAG|1)\n#define MBSTRING_BMP\t\t(MBSTRING_FLAG|2)\n#define MBSTRING_UNIV\t\t(MBSTRING_FLAG|4)\n\n#define SMIME_OLDMIME\t\t0x400\n#define SMIME_CRLFEOL\t\t0x800\n#define SMIME_STREAM\t\t0x1000\n\nstruct X509_algor_st;\nDECLARE_STACK_OF(X509_ALGOR)\n\n#define DECLARE_ASN1_SET_OF(type) /* filled in by mkstack.pl */\n#define IMPLEMENT_ASN1_SET_OF(type) /* nothing, no longer needed */\n\n/* We MUST make sure that, except for constness, asn1_ctx_st and\n   asn1_const_ctx are exactly the same.  Fortunately, as soon as\n   the old ASN1 parsing macros are gone, we can throw this away\n   as well... */\ntypedef struct asn1_ctx_st\n\t{\n\tunsigned char *p;/* work char pointer */\n\tint eos;\t/* end of sequence read for indefinite encoding */\n\tint error;\t/* error code to use when returning an error */\n\tint inf;\t/* constructed if 0x20, indefinite is 0x21 */\n\tint tag;\t/* tag from last 'get object' */\n\tint xclass;\t/* class from last 'get object' */\n\tlong slen;\t/* length of last 'get object' */\n\tunsigned char *max; /* largest value of p allowed */\n\tunsigned char *q;/* temporary variable */\n\tunsigned char **pp;/* variable */\n\tint line;\t/* used in error processing */\n\t} ASN1_CTX;\n\ntypedef struct asn1_const_ctx_st\n\t{\n\tconst unsigned char *p;/* work char pointer */\n\tint eos;\t/* end of sequence read for indefinite encoding */\n\tint error;\t/* error code to use when returning an error */\n\tint inf;\t/* constructed if 0x20, indefinite is 0x21 */\n\tint tag;\t/* tag from last 'get object' */\n\tint xclass;\t/* class from last 'get object' */\n\tlong slen;\t/* length of last 'get object' */\n\tconst unsigned char *max; /* largest value of p allowed */\n\tconst unsigned char *q;/* temporary variable */\n\tconst unsigned char **pp;/* variable */\n\tint line;\t/* used in error processing */\n\t} ASN1_const_CTX;\n\n/* These are used internally in the ASN1_OBJECT to keep track of\n * whether the names and data need to be free()ed */\n#define ASN1_OBJECT_FLAG_DYNAMIC\t 0x01\t/* internal use */\n#define ASN1_OBJECT_FLAG_CRITICAL\t 0x02\t/* critical x509v3 object id */\n#define ASN1_OBJECT_FLAG_DYNAMIC_STRINGS 0x04\t/* internal use */\n#define ASN1_OBJECT_FLAG_DYNAMIC_DATA \t 0x08\t/* internal use */\ntypedef struct asn1_object_st\n\t{\n\tconst char *sn,*ln;\n\tint nid;\n\tint length;\n\tunsigned char *data;\n\tint flags;\t/* Should we free this one */\n\t} ASN1_OBJECT;\n\n#define ASN1_STRING_FLAG_BITS_LEFT 0x08 /* Set if 0x07 has bits left value */\n/* This indicates that the ASN1_STRING is not a real value but just a place\n * holder for the location where indefinite length constructed data should\n * be inserted in the memory buffer \n */\n#define ASN1_STRING_FLAG_NDEF 0x010 \n\n/* This flag is used by the CMS code to indicate that a string is not\n * complete and is a place holder for content when it had all been \n * accessed. The flag will be reset when content has been written to it.\n */\n#define ASN1_STRING_FLAG_CONT 0x020 \n\n/* This is the base type that holds just about everything :-) */\ntypedef struct asn1_string_st\n\t{\n\tint length;\n\tint type;\n\tunsigned char *data;\n\t/* The value of the following field depends on the type being\n\t * held.  It is mostly being used for BIT_STRING so if the\n\t * input data has a non-zero 'unused bits' value, it will be\n\t * handled correctly */\n\tlong flags;\n\t} ASN1_STRING;\n\n/* ASN1_ENCODING structure: this is used to save the received\n * encoding of an ASN1 type. This is useful to get round\n * problems with invalid encodings which can break signatures.\n */\n\ntypedef struct ASN1_ENCODING_st\n\t{\n\tunsigned char *enc;\t/* DER encoding */\n\tlong len;\t\t/* Length of encoding */\n\tint modified;\t\t /* set to 1 if 'enc' is invalid */\n\t} ASN1_ENCODING;\n\n/* Used with ASN1 LONG type: if a long is set to this it is omitted */\n#define ASN1_LONG_UNDEF\t0x7fffffffL\n\n#define STABLE_FLAGS_MALLOC\t0x01\n#define STABLE_NO_MASK\t\t0x02\n#define DIRSTRING_TYPE\t\\\n (B_ASN1_PRINTABLESTRING|B_ASN1_T61STRING|B_ASN1_BMPSTRING|B_ASN1_UTF8STRING)\n#define PKCS9STRING_TYPE (DIRSTRING_TYPE|B_ASN1_IA5STRING)\n\ntypedef struct asn1_string_table_st {\n\tint nid;\n\tlong minsize;\n\tlong maxsize;\n\tunsigned long mask;\n\tunsigned long flags;\n} ASN1_STRING_TABLE;\n\nDECLARE_STACK_OF(ASN1_STRING_TABLE)\n\n/* size limits: this stuff is taken straight from RFC2459 */\n\n#define ub_name\t\t\t\t32768\n#define ub_common_name\t\t\t64\n#define ub_locality_name\t\t128\n#define ub_state_name\t\t\t128\n#define ub_organization_name\t\t64\n#define ub_organization_unit_name\t64\n#define ub_title\t\t\t64\n#define ub_email_address\t\t128\n\n/* Declarations for template structures: for full definitions\n * see asn1t.h\n */\ntypedef struct ASN1_TEMPLATE_st ASN1_TEMPLATE;\ntypedef struct ASN1_ITEM_st ASN1_ITEM;\ntypedef struct ASN1_TLC_st ASN1_TLC;\n/* This is just an opaque pointer */\ntypedef struct ASN1_VALUE_st ASN1_VALUE;\n\n/* Declare ASN1 functions: the implement macro in in asn1t.h */\n\n#define DECLARE_ASN1_FUNCTIONS(type) DECLARE_ASN1_FUNCTIONS_name(type, type)\n\n#define DECLARE_ASN1_ALLOC_FUNCTIONS(type) \\\n\tDECLARE_ASN1_ALLOC_FUNCTIONS_name(type, type)\n\n#define DECLARE_ASN1_FUNCTIONS_name(type, name) \\\n\tDECLARE_ASN1_ALLOC_FUNCTIONS_name(type, name) \\\n\tDECLARE_ASN1_ENCODE_FUNCTIONS(type, name, name)\n\n#define DECLARE_ASN1_FUNCTIONS_fname(type, itname, name) \\\n\tDECLARE_ASN1_ALLOC_FUNCTIONS_name(type, name) \\\n\tDECLARE_ASN1_ENCODE_FUNCTIONS(type, itname, name)\n\n#define\tDECLARE_ASN1_ENCODE_FUNCTIONS(type, itname, name) \\\n\ttype *d2i_##name(type **a, const unsigned char **in, long len); \\\n\tint i2d_##name(type *a, unsigned char **out); \\\n\tDECLARE_ASN1_ITEM(itname)\n\n#define\tDECLARE_ASN1_ENCODE_FUNCTIONS_const(type, name) \\\n\ttype *d2i_##name(type **a, const unsigned char **in, long len); \\\n\tint i2d_##name(const type *a, unsigned char **out); \\\n\tDECLARE_ASN1_ITEM(name)\n\n#define\tDECLARE_ASN1_NDEF_FUNCTION(name) \\\n\tint i2d_##name##_NDEF(name *a, unsigned char **out);\n\n#define DECLARE_ASN1_FUNCTIONS_const(name) \\\n\tDECLARE_ASN1_ALLOC_FUNCTIONS(name) \\\n\tDECLARE_ASN1_ENCODE_FUNCTIONS_const(name, name)\n\n#define DECLARE_ASN1_ALLOC_FUNCTIONS_name(type, name) \\\n\ttype *name##_new(void); \\\n\tvoid name##_free(type *a);\n\n#define D2I_OF(type) type *(*)(type **,const unsigned char **,long)\n#define I2D_OF(type) int (*)(type *,unsigned char **)\n#define I2D_OF_const(type) int (*)(const type *,unsigned char **)\n\n#define CHECKED_D2I_OF(type, d2i) \\\n    ((d2i_of_void*) (1 ? d2i : ((D2I_OF(type))0)))\n#define CHECKED_I2D_OF(type, i2d) \\\n    ((i2d_of_void*) (1 ? i2d : ((I2D_OF(type))0)))\n#define CHECKED_NEW_OF(type, xnew) \\\n    ((void *(*)(void)) (1 ? xnew : ((type *(*)(void))0)))\n#define CHECKED_PTR_OF(type, p) \\\n    ((void*) (1 ? p : (type*)0))\n#define CHECKED_PPTR_OF(type, p) \\\n    ((void**) (1 ? p : (type**)0))\n#define CHECKED_PTR_OF_TO_CHAR(type, p) \\\n    ((char*) (1 ? p : (type*)0))\n\n#define TYPEDEF_D2I_OF(type) typedef type *d2i_of_##type(type **,const unsigned char **,long)\n#define TYPEDEF_I2D_OF(type) typedef int i2d_of_##type(type *,unsigned char **)\n#define TYPEDEF_D2I2D_OF(type) TYPEDEF_D2I_OF(type); TYPEDEF_I2D_OF(type)\n\nTYPEDEF_D2I2D_OF(void);\n\n/* The following macros and typedefs allow an ASN1_ITEM\n * to be embedded in a structure and referenced. Since\n * the ASN1_ITEM pointers need to be globally accessible\n * (possibly from shared libraries) they may exist in\n * different forms. On platforms that support it the\n * ASN1_ITEM structure itself will be globally exported.\n * Other platforms will export a function that returns\n * an ASN1_ITEM pointer.\n *\n * To handle both cases transparently the macros below\n * should be used instead of hard coding an ASN1_ITEM\n * pointer in a structure.\n *\n * The structure will look like this:\n *\n * typedef struct SOMETHING_st {\n *      ...\n *      ASN1_ITEM_EXP *iptr;\n *      ...\n * } SOMETHING; \n *\n * It would be initialised as e.g.:\n *\n * SOMETHING somevar = {...,ASN1_ITEM_ref(X509),...};\n *\n * and the actual pointer extracted with:\n *\n * const ASN1_ITEM *it = ASN1_ITEM_ptr(somevar.iptr);\n *\n * Finally an ASN1_ITEM pointer can be extracted from an\n * appropriate reference with: ASN1_ITEM_rptr(X509). This\n * would be used when a function takes an ASN1_ITEM * argument.\n *\n */\n\n#ifndef OPENSSL_EXPORT_VAR_AS_FUNCTION\n\n/* ASN1_ITEM pointer exported type */\ntypedef const ASN1_ITEM ASN1_ITEM_EXP;\n\n/* Macro to obtain ASN1_ITEM pointer from exported type */\n#define ASN1_ITEM_ptr(iptr) (iptr)\n\n/* Macro to include ASN1_ITEM pointer from base type */\n#define ASN1_ITEM_ref(iptr) (&(iptr##_it))\n\n#define ASN1_ITEM_rptr(ref) (&(ref##_it))\n\n#define DECLARE_ASN1_ITEM(name) \\\n\tOPENSSL_EXTERN const ASN1_ITEM name##_it;\n\n#else\n\n/* Platforms that can't easily handle shared global variables are declared\n * as functions returning ASN1_ITEM pointers.\n */\n\n/* ASN1_ITEM pointer exported type */\ntypedef const ASN1_ITEM * ASN1_ITEM_EXP(void);\n\n/* Macro to obtain ASN1_ITEM pointer from exported type */\n#define ASN1_ITEM_ptr(iptr) (iptr())\n\n/* Macro to include ASN1_ITEM pointer from base type */\n#define ASN1_ITEM_ref(iptr) (iptr##_it)\n\n#define ASN1_ITEM_rptr(ref) (ref##_it())\n\n#define DECLARE_ASN1_ITEM(name) \\\n\tconst ASN1_ITEM * name##_it(void);\n\n#endif\n\n/* Parameters used by ASN1_STRING_print_ex() */\n\n/* These determine which characters to escape:\n * RFC2253 special characters, control characters and\n * MSB set characters\n */\n\n#define ASN1_STRFLGS_ESC_2253\t\t1\n#define ASN1_STRFLGS_ESC_CTRL\t\t2\n#define ASN1_STRFLGS_ESC_MSB\t\t4\n\n\n/* This flag determines how we do escaping: normally\n * RC2253 backslash only, set this to use backslash and\n * quote.\n */\n\n#define ASN1_STRFLGS_ESC_QUOTE\t\t8\n\n\n/* These three flags are internal use only. */\n\n/* Character is a valid PrintableString character */\n#define CHARTYPE_PRINTABLESTRING\t0x10\n/* Character needs escaping if it is the first character */\n#define CHARTYPE_FIRST_ESC_2253\t\t0x20\n/* Character needs escaping if it is the last character */\n#define CHARTYPE_LAST_ESC_2253\t\t0x40\n\n/* NB the internal flags are safely reused below by flags\n * handled at the top level.\n */\n\n/* If this is set we convert all character strings\n * to UTF8 first \n */\n\n#define ASN1_STRFLGS_UTF8_CONVERT\t0x10\n\n/* If this is set we don't attempt to interpret content:\n * just assume all strings are 1 byte per character. This\n * will produce some pretty odd looking output!\n */\n\n#define ASN1_STRFLGS_IGNORE_TYPE\t0x20\n\n/* If this is set we include the string type in the output */\n#define ASN1_STRFLGS_SHOW_TYPE\t\t0x40\n\n/* This determines which strings to display and which to\n * 'dump' (hex dump of content octets or DER encoding). We can\n * only dump non character strings or everything. If we\n * don't dump 'unknown' they are interpreted as character\n * strings with 1 octet per character and are subject to\n * the usual escaping options.\n */\n\n#define ASN1_STRFLGS_DUMP_ALL\t\t0x80\n#define ASN1_STRFLGS_DUMP_UNKNOWN\t0x100\n\n/* These determine what 'dumping' does, we can dump the\n * content octets or the DER encoding: both use the\n * RFC2253 #XXXXX notation.\n */\n\n#define ASN1_STRFLGS_DUMP_DER\t\t0x200\n\n/* All the string flags consistent with RFC2253,\n * escaping control characters isn't essential in\n * RFC2253 but it is advisable anyway.\n */\n\n#define ASN1_STRFLGS_RFC2253\t(ASN1_STRFLGS_ESC_2253 | \\\n\t\t\t\tASN1_STRFLGS_ESC_CTRL | \\\n\t\t\t\tASN1_STRFLGS_ESC_MSB | \\\n\t\t\t\tASN1_STRFLGS_UTF8_CONVERT | \\\n\t\t\t\tASN1_STRFLGS_DUMP_UNKNOWN | \\\n\t\t\t\tASN1_STRFLGS_DUMP_DER)\n\nDECLARE_STACK_OF(ASN1_INTEGER)\nDECLARE_ASN1_SET_OF(ASN1_INTEGER)\n\nDECLARE_STACK_OF(ASN1_GENERALSTRING)\n\ntypedef struct asn1_type_st\n\t{\n\tint type;\n\tunion\t{\n\t\tchar *ptr;\n\t\tASN1_BOOLEAN\t\tboolean;\n\t\tASN1_STRING *\t\tasn1_string;\n\t\tASN1_OBJECT *\t\tobject;\n\t\tASN1_INTEGER *\t\tinteger;\n\t\tASN1_ENUMERATED *\tenumerated;\n\t\tASN1_BIT_STRING *\tbit_string;\n\t\tASN1_OCTET_STRING *\toctet_string;\n\t\tASN1_PRINTABLESTRING *\tprintablestring;\n\t\tASN1_T61STRING *\tt61string;\n\t\tASN1_IA5STRING *\tia5string;\n\t\tASN1_GENERALSTRING *\tgeneralstring;\n\t\tASN1_BMPSTRING *\tbmpstring;\n\t\tASN1_UNIVERSALSTRING *\tuniversalstring;\n\t\tASN1_UTCTIME *\t\tutctime;\n\t\tASN1_GENERALIZEDTIME *\tgeneralizedtime;\n\t\tASN1_VISIBLESTRING *\tvisiblestring;\n\t\tASN1_UTF8STRING *\tutf8string;\n\t\t/* set and sequence are left complete and still\n\t\t * contain the set or sequence bytes */\n\t\tASN1_STRING *\t\tset;\n\t\tASN1_STRING *\t\tsequence;\n\t\tASN1_VALUE  *\t\tasn1_value;\n\t\t} value;\n\t} ASN1_TYPE;\n\nDECLARE_STACK_OF(ASN1_TYPE)\nDECLARE_ASN1_SET_OF(ASN1_TYPE)\n\ntypedef struct asn1_method_st\n\t{\n\ti2d_of_void *i2d;\n\td2i_of_void *d2i;\n\tvoid *(*create)(void);\n\tvoid (*destroy)(void *);\n\t} ASN1_METHOD;\n\n/* This is used when parsing some Netscape objects */\ntypedef struct asn1_header_st\n\t{\n\tASN1_OCTET_STRING *header;\n\tvoid *data;\n\tASN1_METHOD *meth;\n\t} ASN1_HEADER;\n\n/* This is used to contain a list of bit names */\ntypedef struct BIT_STRING_BITNAME_st {\n\tint bitnum;\n\tconst char *lname;\n\tconst char *sname;\n} BIT_STRING_BITNAME;\n\n\n#define M_ASN1_STRING_length(x)\t((x)->length)\n#define M_ASN1_STRING_length_set(x, n)\t((x)->length = (n))\n#define M_ASN1_STRING_type(x)\t((x)->type)\n#define M_ASN1_STRING_data(x)\t((x)->data)\n\n/* Macros for string operations */\n#define M_ASN1_BIT_STRING_new()\t(ASN1_BIT_STRING *)\\\n\t\tASN1_STRING_type_new(V_ASN1_BIT_STRING)\n#define M_ASN1_BIT_STRING_free(a)\tASN1_STRING_free((ASN1_STRING *)a)\n#define M_ASN1_BIT_STRING_dup(a) (ASN1_BIT_STRING *)\\\n\t\tASN1_STRING_dup((ASN1_STRING *)a)\n#define M_ASN1_BIT_STRING_cmp(a,b) ASN1_STRING_cmp(\\\n\t\t(ASN1_STRING *)a,(ASN1_STRING *)b)\n#define M_ASN1_BIT_STRING_set(a,b,c) ASN1_STRING_set((ASN1_STRING *)a,b,c)\n\n#define M_ASN1_INTEGER_new()\t(ASN1_INTEGER *)\\\n\t\tASN1_STRING_type_new(V_ASN1_INTEGER)\n#define M_ASN1_INTEGER_free(a)\t\tASN1_STRING_free((ASN1_STRING *)a)\n#define M_ASN1_INTEGER_dup(a) (ASN1_INTEGER *)ASN1_STRING_dup((ASN1_STRING *)a)\n#define M_ASN1_INTEGER_cmp(a,b)\tASN1_STRING_cmp(\\\n\t\t(ASN1_STRING *)a,(ASN1_STRING *)b)\n\n#define M_ASN1_ENUMERATED_new()\t(ASN1_ENUMERATED *)\\\n\t\tASN1_STRING_type_new(V_ASN1_ENUMERATED)\n#define M_ASN1_ENUMERATED_free(a)\tASN1_STRING_free((ASN1_STRING *)a)\n#define M_ASN1_ENUMERATED_dup(a) (ASN1_ENUMERATED *)ASN1_STRING_dup((ASN1_STRING *)a)\n#define M_ASN1_ENUMERATED_cmp(a,b)\tASN1_STRING_cmp(\\\n\t\t(ASN1_STRING *)a,(ASN1_STRING *)b)\n\n#define M_ASN1_OCTET_STRING_new()\t(ASN1_OCTET_STRING *)\\\n\t\tASN1_STRING_type_new(V_ASN1_OCTET_STRING)\n#define M_ASN1_OCTET_STRING_free(a)\tASN1_STRING_free((ASN1_STRING *)a)\n#define M_ASN1_OCTET_STRING_dup(a) (ASN1_OCTET_STRING *)\\\n\t\tASN1_STRING_dup((ASN1_STRING *)a)\n#define M_ASN1_OCTET_STRING_cmp(a,b) ASN1_STRING_cmp(\\\n\t\t(ASN1_STRING *)a,(ASN1_STRING *)b)\n#define M_ASN1_OCTET_STRING_set(a,b,c)\tASN1_STRING_set((ASN1_STRING *)a,b,c)\n#define M_ASN1_OCTET_STRING_print(a,b)\tASN1_STRING_print(a,(ASN1_STRING *)b)\n#define M_i2d_ASN1_OCTET_STRING(a,pp) \\\n\t\ti2d_ASN1_bytes((ASN1_STRING *)a,pp,V_ASN1_OCTET_STRING,\\\n\t\tV_ASN1_UNIVERSAL)\n\n#define B_ASN1_TIME \\\n\t\t\tB_ASN1_UTCTIME | \\\n\t\t\tB_ASN1_GENERALIZEDTIME\n\n#define B_ASN1_PRINTABLE \\\n\t\t\tB_ASN1_NUMERICSTRING| \\\n\t\t\tB_ASN1_PRINTABLESTRING| \\\n\t\t\tB_ASN1_T61STRING| \\\n\t\t\tB_ASN1_IA5STRING| \\\n\t\t\tB_ASN1_BIT_STRING| \\\n\t\t\tB_ASN1_UNIVERSALSTRING|\\\n\t\t\tB_ASN1_BMPSTRING|\\\n\t\t\tB_ASN1_UTF8STRING|\\\n\t\t\tB_ASN1_SEQUENCE|\\\n\t\t\tB_ASN1_UNKNOWN\n\n#define B_ASN1_DIRECTORYSTRING \\\n\t\t\tB_ASN1_PRINTABLESTRING| \\\n\t\t\tB_ASN1_TELETEXSTRING|\\\n\t\t\tB_ASN1_BMPSTRING|\\\n\t\t\tB_ASN1_UNIVERSALSTRING|\\\n\t\t\tB_ASN1_UTF8STRING\n\n#define B_ASN1_DISPLAYTEXT \\\n\t\t\tB_ASN1_IA5STRING| \\\n\t\t\tB_ASN1_VISIBLESTRING| \\\n\t\t\tB_ASN1_BMPSTRING|\\\n\t\t\tB_ASN1_UTF8STRING\n\n#define M_ASN1_PRINTABLE_new()\tASN1_STRING_type_new(V_ASN1_T61STRING)\n#define M_ASN1_PRINTABLE_free(a)\tASN1_STRING_free((ASN1_STRING *)a)\n#define M_i2d_ASN1_PRINTABLE(a,pp) i2d_ASN1_bytes((ASN1_STRING *)a,\\\n\t\tpp,a->type,V_ASN1_UNIVERSAL)\n#define M_d2i_ASN1_PRINTABLE(a,pp,l) \\\n\t\td2i_ASN1_type_bytes((ASN1_STRING **)a,pp,l, \\\n\t\t\tB_ASN1_PRINTABLE)\n\n#define M_DIRECTORYSTRING_new() ASN1_STRING_type_new(V_ASN1_PRINTABLESTRING)\n#define M_DIRECTORYSTRING_free(a)\tASN1_STRING_free((ASN1_STRING *)a)\n#define M_i2d_DIRECTORYSTRING(a,pp) i2d_ASN1_bytes((ASN1_STRING *)a,\\\n\t\t\t\t\t\tpp,a->type,V_ASN1_UNIVERSAL)\n#define M_d2i_DIRECTORYSTRING(a,pp,l) \\\n\t\td2i_ASN1_type_bytes((ASN1_STRING **)a,pp,l, \\\n\t\t\tB_ASN1_DIRECTORYSTRING)\n\n#define M_DISPLAYTEXT_new() ASN1_STRING_type_new(V_ASN1_VISIBLESTRING)\n#define M_DISPLAYTEXT_free(a) ASN1_STRING_free((ASN1_STRING *)a)\n#define M_i2d_DISPLAYTEXT(a,pp) i2d_ASN1_bytes((ASN1_STRING *)a,\\\n\t\t\t\t\t\tpp,a->type,V_ASN1_UNIVERSAL)\n#define M_d2i_DISPLAYTEXT(a,pp,l) \\\n\t\td2i_ASN1_type_bytes((ASN1_STRING **)a,pp,l, \\\n\t\t\tB_ASN1_DISPLAYTEXT)\n\n#define M_ASN1_PRINTABLESTRING_new() (ASN1_PRINTABLESTRING *)\\\n\t\tASN1_STRING_type_new(V_ASN1_PRINTABLESTRING)\n#define M_ASN1_PRINTABLESTRING_free(a)\tASN1_STRING_free((ASN1_STRING *)a)\n#define M_i2d_ASN1_PRINTABLESTRING(a,pp) \\\n\t\ti2d_ASN1_bytes((ASN1_STRING *)a,pp,V_ASN1_PRINTABLESTRING,\\\n\t\tV_ASN1_UNIVERSAL)\n#define M_d2i_ASN1_PRINTABLESTRING(a,pp,l) \\\n\t\t(ASN1_PRINTABLESTRING *)d2i_ASN1_type_bytes\\\n\t\t((ASN1_STRING **)a,pp,l,B_ASN1_PRINTABLESTRING)\n\n#define M_ASN1_T61STRING_new()\t(ASN1_T61STRING *)\\\n\t\tASN1_STRING_type_new(V_ASN1_T61STRING)\n#define M_ASN1_T61STRING_free(a)\tASN1_STRING_free((ASN1_STRING *)a)\n#define M_i2d_ASN1_T61STRING(a,pp) \\\n\t\ti2d_ASN1_bytes((ASN1_STRING *)a,pp,V_ASN1_T61STRING,\\\n\t\tV_ASN1_UNIVERSAL)\n#define M_d2i_ASN1_T61STRING(a,pp,l) \\\n\t\t(ASN1_T61STRING *)d2i_ASN1_type_bytes\\\n\t\t((ASN1_STRING **)a,pp,l,B_ASN1_T61STRING)\n\n#define M_ASN1_IA5STRING_new()\t(ASN1_IA5STRING *)\\\n\t\tASN1_STRING_type_new(V_ASN1_IA5STRING)\n#define M_ASN1_IA5STRING_free(a)\tASN1_STRING_free((ASN1_STRING *)a)\n#define M_ASN1_IA5STRING_dup(a)\t\\\n\t\t\t(ASN1_IA5STRING *)ASN1_STRING_dup((ASN1_STRING *)a)\n#define M_i2d_ASN1_IA5STRING(a,pp) \\\n\t\ti2d_ASN1_bytes((ASN1_STRING *)a,pp,V_ASN1_IA5STRING,\\\n\t\t\tV_ASN1_UNIVERSAL)\n#define M_d2i_ASN1_IA5STRING(a,pp,l) \\\n\t\t(ASN1_IA5STRING *)d2i_ASN1_type_bytes((ASN1_STRING **)a,pp,l,\\\n\t\t\tB_ASN1_IA5STRING)\n\n#define M_ASN1_UTCTIME_new()\t(ASN1_UTCTIME *)\\\n\t\tASN1_STRING_type_new(V_ASN1_UTCTIME)\n#define M_ASN1_UTCTIME_free(a)\tASN1_STRING_free((ASN1_STRING *)a)\n#define M_ASN1_UTCTIME_dup(a) (ASN1_UTCTIME *)ASN1_STRING_dup((ASN1_STRING *)a)\n\n#define M_ASN1_GENERALIZEDTIME_new()\t(ASN1_GENERALIZEDTIME *)\\\n\t\tASN1_STRING_type_new(V_ASN1_GENERALIZEDTIME)\n#define M_ASN1_GENERALIZEDTIME_free(a)\tASN1_STRING_free((ASN1_STRING *)a)\n#define M_ASN1_GENERALIZEDTIME_dup(a) (ASN1_GENERALIZEDTIME *)ASN1_STRING_dup(\\\n\t(ASN1_STRING *)a)\n\n#define M_ASN1_TIME_new()\t(ASN1_TIME *)\\\n\t\tASN1_STRING_type_new(V_ASN1_UTCTIME)\n#define M_ASN1_TIME_free(a)\tASN1_STRING_free((ASN1_STRING *)a)\n#define M_ASN1_TIME_dup(a) (ASN1_TIME *)ASN1_STRING_dup((ASN1_STRING *)a)\n\n#define M_ASN1_GENERALSTRING_new()\t(ASN1_GENERALSTRING *)\\\n\t\tASN1_STRING_type_new(V_ASN1_GENERALSTRING)\n#define M_ASN1_GENERALSTRING_free(a)\tASN1_STRING_free((ASN1_STRING *)a)\n#define M_i2d_ASN1_GENERALSTRING(a,pp) \\\n\t\ti2d_ASN1_bytes((ASN1_STRING *)a,pp,V_ASN1_GENERALSTRING,\\\n\t\t\tV_ASN1_UNIVERSAL)\n#define M_d2i_ASN1_GENERALSTRING(a,pp,l) \\\n\t\t(ASN1_GENERALSTRING *)d2i_ASN1_type_bytes\\\n\t\t((ASN1_STRING **)a,pp,l,B_ASN1_GENERALSTRING)\n\n#define M_ASN1_UNIVERSALSTRING_new()\t(ASN1_UNIVERSALSTRING *)\\\n\t\tASN1_STRING_type_new(V_ASN1_UNIVERSALSTRING)\n#define M_ASN1_UNIVERSALSTRING_free(a)\tASN1_STRING_free((ASN1_STRING *)a)\n#define M_i2d_ASN1_UNIVERSALSTRING(a,pp) \\\n\t\ti2d_ASN1_bytes((ASN1_STRING *)a,pp,V_ASN1_UNIVERSALSTRING,\\\n\t\t\tV_ASN1_UNIVERSAL)\n#define M_d2i_ASN1_UNIVERSALSTRING(a,pp,l) \\\n\t\t(ASN1_UNIVERSALSTRING *)d2i_ASN1_type_bytes\\\n\t\t((ASN1_STRING **)a,pp,l,B_ASN1_UNIVERSALSTRING)\n\n#define M_ASN1_BMPSTRING_new()\t(ASN1_BMPSTRING *)\\\n\t\tASN1_STRING_type_new(V_ASN1_BMPSTRING)\n#define M_ASN1_BMPSTRING_free(a)\tASN1_STRING_free((ASN1_STRING *)a)\n#define M_i2d_ASN1_BMPSTRING(a,pp) \\\n\t\ti2d_ASN1_bytes((ASN1_STRING *)a,pp,V_ASN1_BMPSTRING,\\\n\t\t\tV_ASN1_UNIVERSAL)\n#define M_d2i_ASN1_BMPSTRING(a,pp,l) \\\n\t\t(ASN1_BMPSTRING *)d2i_ASN1_type_bytes\\\n\t\t((ASN1_STRING **)a,pp,l,B_ASN1_BMPSTRING)\n\n#define M_ASN1_VISIBLESTRING_new()\t(ASN1_VISIBLESTRING *)\\\n\t\tASN1_STRING_type_new(V_ASN1_VISIBLESTRING)\n#define M_ASN1_VISIBLESTRING_free(a)\tASN1_STRING_free((ASN1_STRING *)a)\n#define M_i2d_ASN1_VISIBLESTRING(a,pp) \\\n\t\ti2d_ASN1_bytes((ASN1_STRING *)a,pp,V_ASN1_VISIBLESTRING,\\\n\t\t\tV_ASN1_UNIVERSAL)\n#define M_d2i_ASN1_VISIBLESTRING(a,pp,l) \\\n\t\t(ASN1_VISIBLESTRING *)d2i_ASN1_type_bytes\\\n\t\t((ASN1_STRING **)a,pp,l,B_ASN1_VISIBLESTRING)\n\n#define M_ASN1_UTF8STRING_new()\t(ASN1_UTF8STRING *)\\\n\t\tASN1_STRING_type_new(V_ASN1_UTF8STRING)\n#define M_ASN1_UTF8STRING_free(a)\tASN1_STRING_free((ASN1_STRING *)a)\n#define M_i2d_ASN1_UTF8STRING(a,pp) \\\n\t\ti2d_ASN1_bytes((ASN1_STRING *)a,pp,V_ASN1_UTF8STRING,\\\n\t\t\tV_ASN1_UNIVERSAL)\n#define M_d2i_ASN1_UTF8STRING(a,pp,l) \\\n\t\t(ASN1_UTF8STRING *)d2i_ASN1_type_bytes\\\n\t\t((ASN1_STRING **)a,pp,l,B_ASN1_UTF8STRING)\n\n  /* for the is_set parameter to i2d_ASN1_SET */\n#define IS_SEQUENCE\t0\n#define IS_SET\t\t1\n\nDECLARE_ASN1_FUNCTIONS_fname(ASN1_TYPE, ASN1_ANY, ASN1_TYPE)\n\nint ASN1_TYPE_get(ASN1_TYPE *a);\nvoid ASN1_TYPE_set(ASN1_TYPE *a, int type, void *value);\nint ASN1_TYPE_set1(ASN1_TYPE *a, int type, const void *value);\n\nASN1_OBJECT *\tASN1_OBJECT_new(void );\nvoid\t\tASN1_OBJECT_free(ASN1_OBJECT *a);\nint\t\ti2d_ASN1_OBJECT(ASN1_OBJECT *a,unsigned char **pp);\nASN1_OBJECT *\tc2i_ASN1_OBJECT(ASN1_OBJECT **a,const unsigned char **pp,\n\t\t\tlong length);\nASN1_OBJECT *\td2i_ASN1_OBJECT(ASN1_OBJECT **a,const unsigned char **pp,\n\t\t\tlong length);\n\nDECLARE_ASN1_ITEM(ASN1_OBJECT)\n\nDECLARE_STACK_OF(ASN1_OBJECT)\nDECLARE_ASN1_SET_OF(ASN1_OBJECT)\n\nASN1_STRING *\tASN1_STRING_new(void);\nvoid\t\tASN1_STRING_free(ASN1_STRING *a);\nASN1_STRING *\tASN1_STRING_dup(ASN1_STRING *a);\nASN1_STRING *\tASN1_STRING_type_new(int type );\nint \t\tASN1_STRING_cmp(ASN1_STRING *a, ASN1_STRING *b);\n  /* Since this is used to store all sorts of things, via macros, for now, make\n     its data void * */\nint \t\tASN1_STRING_set(ASN1_STRING *str, const void *data, int len);\nvoid\t\tASN1_STRING_set0(ASN1_STRING *str, void *data, int len);\nint ASN1_STRING_length(ASN1_STRING *x);\nvoid ASN1_STRING_length_set(ASN1_STRING *x, int n);\nint ASN1_STRING_type(ASN1_STRING *x);\nunsigned char * ASN1_STRING_data(ASN1_STRING *x);\n\nDECLARE_ASN1_FUNCTIONS(ASN1_BIT_STRING)\nint\t\ti2c_ASN1_BIT_STRING(ASN1_BIT_STRING *a,unsigned char **pp);\nASN1_BIT_STRING *c2i_ASN1_BIT_STRING(ASN1_BIT_STRING **a,const unsigned char **pp,\n\t\t\tlong length);\nint\t\tASN1_BIT_STRING_set(ASN1_BIT_STRING *a, unsigned char *d,\n\t\t\tint length );\nint\t\tASN1_BIT_STRING_set_bit(ASN1_BIT_STRING *a, int n, int value);\nint\t\tASN1_BIT_STRING_get_bit(ASN1_BIT_STRING *a, int n);\n\n#ifndef OPENSSL_NO_BIO\nint ASN1_BIT_STRING_name_print(BIO *out, ASN1_BIT_STRING *bs,\n\t\t\t\tBIT_STRING_BITNAME *tbl, int indent);\n#endif\nint ASN1_BIT_STRING_num_asc(char *name, BIT_STRING_BITNAME *tbl);\nint ASN1_BIT_STRING_set_asc(ASN1_BIT_STRING *bs, char *name, int value,\n\t\t\t\tBIT_STRING_BITNAME *tbl);\n\nint\t\ti2d_ASN1_BOOLEAN(int a,unsigned char **pp);\nint \t\td2i_ASN1_BOOLEAN(int *a,const unsigned char **pp,long length);\n\nDECLARE_ASN1_FUNCTIONS(ASN1_INTEGER)\nint\t\ti2c_ASN1_INTEGER(ASN1_INTEGER *a,unsigned char **pp);\nASN1_INTEGER *c2i_ASN1_INTEGER(ASN1_INTEGER **a,const unsigned char **pp,\n\t\t\tlong length);\nASN1_INTEGER *d2i_ASN1_UINTEGER(ASN1_INTEGER **a,const unsigned char **pp,\n\t\t\tlong length);\nASN1_INTEGER *\tASN1_INTEGER_dup(ASN1_INTEGER *x);\nint ASN1_INTEGER_cmp(ASN1_INTEGER *x, ASN1_INTEGER *y);\n\nDECLARE_ASN1_FUNCTIONS(ASN1_ENUMERATED)\n\nint ASN1_UTCTIME_check(ASN1_UTCTIME *a);\nASN1_UTCTIME *ASN1_UTCTIME_set(ASN1_UTCTIME *s,time_t t);\nint ASN1_UTCTIME_set_string(ASN1_UTCTIME *s, const char *str);\nint ASN1_UTCTIME_cmp_time_t(const ASN1_UTCTIME *s, time_t t);\n#if 0\ntime_t ASN1_UTCTIME_get(const ASN1_UTCTIME *s);\n#endif\n\nint ASN1_GENERALIZEDTIME_check(ASN1_GENERALIZEDTIME *a);\nASN1_GENERALIZEDTIME *ASN1_GENERALIZEDTIME_set(ASN1_GENERALIZEDTIME *s,time_t t);\nint ASN1_GENERALIZEDTIME_set_string(ASN1_GENERALIZEDTIME *s, const char *str);\n\nDECLARE_ASN1_FUNCTIONS(ASN1_OCTET_STRING)\nASN1_OCTET_STRING *\tASN1_OCTET_STRING_dup(ASN1_OCTET_STRING *a);\nint \tASN1_OCTET_STRING_cmp(ASN1_OCTET_STRING *a, ASN1_OCTET_STRING *b);\nint \tASN1_OCTET_STRING_set(ASN1_OCTET_STRING *str, const unsigned char *data, int len);\n\nDECLARE_ASN1_FUNCTIONS(ASN1_VISIBLESTRING)\nDECLARE_ASN1_FUNCTIONS(ASN1_UNIVERSALSTRING)\nDECLARE_ASN1_FUNCTIONS(ASN1_UTF8STRING)\nDECLARE_ASN1_FUNCTIONS(ASN1_NULL)\nDECLARE_ASN1_FUNCTIONS(ASN1_BMPSTRING)\n\nint UTF8_getc(const unsigned char *str, int len, unsigned long *val);\nint UTF8_putc(unsigned char *str, int len, unsigned long value);\n\nDECLARE_ASN1_FUNCTIONS_name(ASN1_STRING, ASN1_PRINTABLE)\n\nDECLARE_ASN1_FUNCTIONS_name(ASN1_STRING, DIRECTORYSTRING)\nDECLARE_ASN1_FUNCTIONS_name(ASN1_STRING, DISPLAYTEXT)\nDECLARE_ASN1_FUNCTIONS(ASN1_PRINTABLESTRING)\nDECLARE_ASN1_FUNCTIONS(ASN1_T61STRING)\nDECLARE_ASN1_FUNCTIONS(ASN1_IA5STRING)\nDECLARE_ASN1_FUNCTIONS(ASN1_GENERALSTRING)\nDECLARE_ASN1_FUNCTIONS(ASN1_UTCTIME)\nDECLARE_ASN1_FUNCTIONS(ASN1_GENERALIZEDTIME)\nDECLARE_ASN1_FUNCTIONS(ASN1_TIME)\n\nDECLARE_ASN1_ITEM(ASN1_OCTET_STRING_NDEF)\n\nASN1_TIME *ASN1_TIME_set(ASN1_TIME *s,time_t t);\nint ASN1_TIME_check(ASN1_TIME *t);\nASN1_GENERALIZEDTIME *ASN1_TIME_to_generalizedtime(ASN1_TIME *t, ASN1_GENERALIZEDTIME **out);\n\nint i2d_ASN1_SET(STACK *a, unsigned char **pp,\n\t\t i2d_of_void *i2d, int ex_tag, int ex_class, int is_set);\nSTACK *\td2i_ASN1_SET(STACK **a, const unsigned char **pp, long length,\n\t\t     d2i_of_void *d2i, void (*free_func)(void *),\n\t\t     int ex_tag, int ex_class);\n\n#ifndef OPENSSL_NO_BIO\nint i2a_ASN1_INTEGER(BIO *bp, ASN1_INTEGER *a);\nint a2i_ASN1_INTEGER(BIO *bp,ASN1_INTEGER *bs,char *buf,int size);\nint i2a_ASN1_ENUMERATED(BIO *bp, ASN1_ENUMERATED *a);\nint a2i_ASN1_ENUMERATED(BIO *bp,ASN1_ENUMERATED *bs,char *buf,int size);\nint i2a_ASN1_OBJECT(BIO *bp,ASN1_OBJECT *a);\nint a2i_ASN1_STRING(BIO *bp,ASN1_STRING *bs,char *buf,int size);\nint i2a_ASN1_STRING(BIO *bp, ASN1_STRING *a, int type);\n#endif\nint i2t_ASN1_OBJECT(char *buf,int buf_len,ASN1_OBJECT *a);\n\nint a2d_ASN1_OBJECT(unsigned char *out,int olen, const char *buf, int num);\nASN1_OBJECT *ASN1_OBJECT_create(int nid, unsigned char *data,int len,\n\tconst char *sn, const char *ln);\n\nint ASN1_INTEGER_set(ASN1_INTEGER *a, long v);\nlong ASN1_INTEGER_get(ASN1_INTEGER *a);\nASN1_INTEGER *BN_to_ASN1_INTEGER(BIGNUM *bn, ASN1_INTEGER *ai);\nBIGNUM *ASN1_INTEGER_to_BN(ASN1_INTEGER *ai,BIGNUM *bn);\n\nint ASN1_ENUMERATED_set(ASN1_ENUMERATED *a, long v);\nlong ASN1_ENUMERATED_get(ASN1_ENUMERATED *a);\nASN1_ENUMERATED *BN_to_ASN1_ENUMERATED(BIGNUM *bn, ASN1_ENUMERATED *ai);\nBIGNUM *ASN1_ENUMERATED_to_BN(ASN1_ENUMERATED *ai,BIGNUM *bn);\n\n/* General */\n/* given a string, return the correct type, max is the maximum length */\nint ASN1_PRINTABLE_type(const unsigned char *s, int max);\n\nint i2d_ASN1_bytes(ASN1_STRING *a, unsigned char **pp, int tag, int xclass);\nASN1_STRING *d2i_ASN1_bytes(ASN1_STRING **a, const unsigned char **pp,\n\tlong length, int Ptag, int Pclass);\nunsigned long ASN1_tag2bit(int tag);\n/* type is one or more of the B_ASN1_ values. */\nASN1_STRING *d2i_ASN1_type_bytes(ASN1_STRING **a,const unsigned char **pp,\n\t\tlong length,int type);\n\n/* PARSING */\nint asn1_Finish(ASN1_CTX *c);\nint asn1_const_Finish(ASN1_const_CTX *c);\n\n/* SPECIALS */\nint ASN1_get_object(const unsigned char **pp, long *plength, int *ptag,\n\tint *pclass, long omax);\nint ASN1_check_infinite_end(unsigned char **p,long len);\nint ASN1_const_check_infinite_end(const unsigned char **p,long len);\nvoid ASN1_put_object(unsigned char **pp, int constructed, int length,\n\tint tag, int xclass);\nint ASN1_put_eoc(unsigned char **pp);\nint ASN1_object_size(int constructed, int length, int tag);\n\n/* Used to implement other functions */\nvoid *ASN1_dup(i2d_of_void *i2d, d2i_of_void *d2i, char *x);\n\n#define ASN1_dup_of(type,i2d,d2i,x) \\\n    ((type*)ASN1_dup(CHECKED_I2D_OF(type, i2d), \\\n\t\t     CHECKED_D2I_OF(type, d2i), \\\n\t\t     CHECKED_PTR_OF_TO_CHAR(type, x)))\n\n#define ASN1_dup_of_const(type,i2d,d2i,x) \\\n    ((type*)ASN1_dup(CHECKED_I2D_OF(const type, i2d), \\\n\t\t     CHECKED_D2I_OF(type, d2i), \\\n\t\t     CHECKED_PTR_OF_TO_CHAR(const type, x)))\n\nvoid *ASN1_item_dup(const ASN1_ITEM *it, void *x);\n\n/* ASN1 alloc/free macros for when a type is only used internally */\n\n#define M_ASN1_new_of(type) (type *)ASN1_item_new(ASN1_ITEM_rptr(type))\n#define M_ASN1_free_of(x, type) \\\n\t\tASN1_item_free(CHECKED_PTR_OF(type, x), ASN1_ITEM_rptr(type))\n\n#ifndef OPENSSL_NO_FP_API\nvoid *ASN1_d2i_fp(void *(*xnew)(void), d2i_of_void *d2i, FILE *in, void **x);\n\n#define ASN1_d2i_fp_of(type,xnew,d2i,in,x) \\\n    ((type*)ASN1_d2i_fp(CHECKED_NEW_OF(type, xnew), \\\n\t\t\tCHECKED_D2I_OF(type, d2i), \\\n\t\t\tin, \\\n\t\t\tCHECKED_PPTR_OF(type, x)))\n\nvoid *ASN1_item_d2i_fp(const ASN1_ITEM *it, FILE *in, void *x);\nint ASN1_i2d_fp(i2d_of_void *i2d,FILE *out,void *x);\n\n#define ASN1_i2d_fp_of(type,i2d,out,x) \\\n    (ASN1_i2d_fp(CHECKED_I2D_OF(type, i2d), \\\n\t\t out, \\\n\t\t CHECKED_PTR_OF(type, x)))\n\n#define ASN1_i2d_fp_of_const(type,i2d,out,x) \\\n    (ASN1_i2d_fp(CHECKED_I2D_OF(const type, i2d), \\\n\t\t out, \\\n\t\t CHECKED_PTR_OF(const type, x)))\n\nint ASN1_item_i2d_fp(const ASN1_ITEM *it, FILE *out, void *x);\nint ASN1_STRING_print_ex_fp(FILE *fp, ASN1_STRING *str, unsigned long flags);\n#endif\n\nint ASN1_STRING_to_UTF8(unsigned char **out, ASN1_STRING *in);\n\n#ifndef OPENSSL_NO_BIO\nvoid *ASN1_d2i_bio(void *(*xnew)(void), d2i_of_void *d2i, BIO *in, void **x);\n\n#define ASN1_d2i_bio_of(type,xnew,d2i,in,x) \\\n    ((type*)ASN1_d2i_bio( CHECKED_NEW_OF(type, xnew), \\\n\t\t\t  CHECKED_D2I_OF(type, d2i), \\\n\t\t\t  in, \\\n\t\t\t  CHECKED_PPTR_OF(type, x)))\n\nvoid *ASN1_item_d2i_bio(const ASN1_ITEM *it, BIO *in, void *x);\nint ASN1_i2d_bio(i2d_of_void *i2d,BIO *out, unsigned char *x);\n\n#define ASN1_i2d_bio_of(type,i2d,out,x) \\\n    (ASN1_i2d_bio(CHECKED_I2D_OF(type, i2d), \\\n\t\t  out, \\\n\t\t  CHECKED_PTR_OF(type, x)))\n\n#define ASN1_i2d_bio_of_const(type,i2d,out,x) \\\n    (ASN1_i2d_bio(CHECKED_I2D_OF(const type, i2d), \\\n\t\t  out, \\\n\t\t  CHECKED_PTR_OF(const type, x)))\n\nint ASN1_item_i2d_bio(const ASN1_ITEM *it, BIO *out, void *x);\nint ASN1_UTCTIME_print(BIO *fp,ASN1_UTCTIME *a);\nint ASN1_GENERALIZEDTIME_print(BIO *fp,ASN1_GENERALIZEDTIME *a);\nint ASN1_TIME_print(BIO *fp,ASN1_TIME *a);\nint ASN1_STRING_print(BIO *bp,ASN1_STRING *v);\nint ASN1_STRING_print_ex(BIO *out, ASN1_STRING *str, unsigned long flags);\nint ASN1_parse(BIO *bp,const unsigned char *pp,long len,int indent);\nint ASN1_parse_dump(BIO *bp,const unsigned char *pp,long len,int indent,int dump);\n#endif\nconst char *ASN1_tag2str(int tag);\n\n/* Used to load and write netscape format cert/key */\nint i2d_ASN1_HEADER(ASN1_HEADER *a,unsigned char **pp);\nASN1_HEADER *d2i_ASN1_HEADER(ASN1_HEADER **a,const unsigned char **pp, long length);\nASN1_HEADER *ASN1_HEADER_new(void );\nvoid ASN1_HEADER_free(ASN1_HEADER *a);\n\nint ASN1_UNIVERSALSTRING_to_string(ASN1_UNIVERSALSTRING *s);\n\n/* Not used that much at this point, except for the first two */\nASN1_METHOD *X509_asn1_meth(void);\nASN1_METHOD *RSAPrivateKey_asn1_meth(void);\nASN1_METHOD *ASN1_IA5STRING_asn1_meth(void);\nASN1_METHOD *ASN1_BIT_STRING_asn1_meth(void);\n\nint ASN1_TYPE_set_octetstring(ASN1_TYPE *a,\n\tunsigned char *data, int len);\nint ASN1_TYPE_get_octetstring(ASN1_TYPE *a,\n\tunsigned char *data, int max_len);\nint ASN1_TYPE_set_int_octetstring(ASN1_TYPE *a, long num,\n\tunsigned char *data, int len);\nint ASN1_TYPE_get_int_octetstring(ASN1_TYPE *a,long *num,\n\tunsigned char *data, int max_len);\n\nSTACK *ASN1_seq_unpack(const unsigned char *buf, int len,\n\t\t       d2i_of_void *d2i, void (*free_func)(void *));\nunsigned char *ASN1_seq_pack(STACK *safes, i2d_of_void *i2d,\n\t\t\t     unsigned char **buf, int *len );\nvoid *ASN1_unpack_string(ASN1_STRING *oct, d2i_of_void *d2i);\nvoid *ASN1_item_unpack(ASN1_STRING *oct, const ASN1_ITEM *it);\nASN1_STRING *ASN1_pack_string(void *obj, i2d_of_void *i2d,\n\t\t\t      ASN1_OCTET_STRING **oct);\n\n#define ASN1_pack_string_of(type,obj,i2d,oct) \\\n    (ASN1_pack_string(CHECKED_PTR_OF(type, obj), \\\n\t\t      CHECKED_I2D_OF(type, i2d), \\\n\t\t      oct))\n\nASN1_STRING *ASN1_item_pack(void *obj, const ASN1_ITEM *it, ASN1_OCTET_STRING **oct);\n\nvoid ASN1_STRING_set_default_mask(unsigned long mask);\nint ASN1_STRING_set_default_mask_asc(char *p);\nunsigned long ASN1_STRING_get_default_mask(void);\nint ASN1_mbstring_copy(ASN1_STRING **out, const unsigned char *in, int len,\n\t\t\t\t\tint inform, unsigned long mask);\nint ASN1_mbstring_ncopy(ASN1_STRING **out, const unsigned char *in, int len,\n\t\t\t\t\tint inform, unsigned long mask, \n\t\t\t\t\tlong minsize, long maxsize);\n\nASN1_STRING *ASN1_STRING_set_by_NID(ASN1_STRING **out, \n\t\tconst unsigned char *in, int inlen, int inform, int nid);\nASN1_STRING_TABLE *ASN1_STRING_TABLE_get(int nid);\nint ASN1_STRING_TABLE_add(int, long, long, unsigned long, unsigned long);\nvoid ASN1_STRING_TABLE_cleanup(void);\n\n/* ASN1 template functions */\n\n/* Old API compatible functions */\nASN1_VALUE *ASN1_item_new(const ASN1_ITEM *it);\nvoid ASN1_item_free(ASN1_VALUE *val, const ASN1_ITEM *it);\nASN1_VALUE * ASN1_item_d2i(ASN1_VALUE **val, const unsigned char **in, long len, const ASN1_ITEM *it);\nint ASN1_item_i2d(ASN1_VALUE *val, unsigned char **out, const ASN1_ITEM *it);\nint ASN1_item_ndef_i2d(ASN1_VALUE *val, unsigned char **out, const ASN1_ITEM *it);\n\nvoid ASN1_add_oid_module(void);\n\nASN1_TYPE *ASN1_generate_nconf(char *str, CONF *nconf);\nASN1_TYPE *ASN1_generate_v3(char *str, X509V3_CTX *cnf);\n\ntypedef int asn1_output_data_fn(BIO *out, BIO *data, ASN1_VALUE *val, int flags,\n\t\t\t\t\tconst ASN1_ITEM *it);\n\nint int_smime_write_ASN1(BIO *bio, ASN1_VALUE *val, BIO *data, int flags,\n\t\t\t\tint ctype_nid, int econt_nid,\n\t\t\t\tSTACK_OF(X509_ALGOR) *mdalgs,\n\t\t\t\tasn1_output_data_fn *data_fn,\n\t\t\t\tconst ASN1_ITEM *it);\nASN1_VALUE *SMIME_read_ASN1(BIO *bio, BIO **bcont, const ASN1_ITEM *it);\n\n/* BEGIN ERROR CODES */\n/* The following lines are auto generated by the script mkerr.pl. Any changes\n * made after this point may be overwritten when the script is next run.\n */\nvoid ERR_load_ASN1_strings(void);\n\n/* Error codes for the ASN1 functions. */\n\n/* Function codes. */\n#define ASN1_F_A2D_ASN1_OBJECT\t\t\t\t 100\n#define ASN1_F_A2I_ASN1_ENUMERATED\t\t\t 101\n#define ASN1_F_A2I_ASN1_INTEGER\t\t\t\t 102\n#define ASN1_F_A2I_ASN1_STRING\t\t\t\t 103\n#define ASN1_F_APPEND_EXP\t\t\t\t 176\n#define ASN1_F_ASN1_BIT_STRING_SET_BIT\t\t\t 183\n#define ASN1_F_ASN1_CB\t\t\t\t\t 177\n#define ASN1_F_ASN1_CHECK_TLEN\t\t\t\t 104\n#define ASN1_F_ASN1_COLLATE_PRIMITIVE\t\t\t 105\n#define ASN1_F_ASN1_COLLECT\t\t\t\t 106\n#define ASN1_F_ASN1_D2I_EX_PRIMITIVE\t\t\t 108\n#define ASN1_F_ASN1_D2I_FP\t\t\t\t 109\n#define ASN1_F_ASN1_D2I_READ_BIO\t\t\t 107\n#define ASN1_F_ASN1_DIGEST\t\t\t\t 184\n#define ASN1_F_ASN1_DO_ADB\t\t\t\t 110\n#define ASN1_F_ASN1_DUP\t\t\t\t\t 111\n#define ASN1_F_ASN1_ENUMERATED_SET\t\t\t 112\n#define ASN1_F_ASN1_ENUMERATED_TO_BN\t\t\t 113\n#define ASN1_F_ASN1_EX_C2I\t\t\t\t 204\n#define ASN1_F_ASN1_FIND_END\t\t\t\t 190\n#define ASN1_F_ASN1_GENERALIZEDTIME_SET\t\t\t 185\n#define ASN1_F_ASN1_GENERATE_V3\t\t\t\t 178\n#define ASN1_F_ASN1_GET_OBJECT\t\t\t\t 114\n#define ASN1_F_ASN1_HEADER_NEW\t\t\t\t 115\n#define ASN1_F_ASN1_I2D_BIO\t\t\t\t 116\n#define ASN1_F_ASN1_I2D_FP\t\t\t\t 117\n#define ASN1_F_ASN1_INTEGER_SET\t\t\t\t 118\n#define ASN1_F_ASN1_INTEGER_TO_BN\t\t\t 119\n#define ASN1_F_ASN1_ITEM_D2I_FP\t\t\t\t 206\n#define ASN1_F_ASN1_ITEM_DUP\t\t\t\t 191\n#define ASN1_F_ASN1_ITEM_EX_COMBINE_NEW\t\t\t 121\n#define ASN1_F_ASN1_ITEM_EX_D2I\t\t\t\t 120\n#define ASN1_F_ASN1_ITEM_I2D_BIO\t\t\t 192\n#define ASN1_F_ASN1_ITEM_I2D_FP\t\t\t\t 193\n#define ASN1_F_ASN1_ITEM_PACK\t\t\t\t 198\n#define ASN1_F_ASN1_ITEM_SIGN\t\t\t\t 195\n#define ASN1_F_ASN1_ITEM_UNPACK\t\t\t\t 199\n#define ASN1_F_ASN1_ITEM_VERIFY\t\t\t\t 197\n#define ASN1_F_ASN1_MBSTRING_NCOPY\t\t\t 122\n#define ASN1_F_ASN1_OBJECT_NEW\t\t\t\t 123\n#define ASN1_F_ASN1_OUTPUT_DATA\t\t\t\t 207\n#define ASN1_F_ASN1_PACK_STRING\t\t\t\t 124\n#define ASN1_F_ASN1_PCTX_NEW\t\t\t\t 205\n#define ASN1_F_ASN1_PKCS5_PBE_SET\t\t\t 125\n#define ASN1_F_ASN1_SEQ_PACK\t\t\t\t 126\n#define ASN1_F_ASN1_SEQ_UNPACK\t\t\t\t 127\n#define ASN1_F_ASN1_SIGN\t\t\t\t 128\n#define ASN1_F_ASN1_STR2TYPE\t\t\t\t 179\n#define ASN1_F_ASN1_STRING_SET\t\t\t\t 186\n#define ASN1_F_ASN1_STRING_TABLE_ADD\t\t\t 129\n#define ASN1_F_ASN1_STRING_TYPE_NEW\t\t\t 130\n#define ASN1_F_ASN1_TEMPLATE_EX_D2I\t\t\t 132\n#define ASN1_F_ASN1_TEMPLATE_NEW\t\t\t 133\n#define ASN1_F_ASN1_TEMPLATE_NOEXP_D2I\t\t\t 131\n#define ASN1_F_ASN1_TIME_SET\t\t\t\t 175\n#define ASN1_F_ASN1_TYPE_GET_INT_OCTETSTRING\t\t 134\n#define ASN1_F_ASN1_TYPE_GET_OCTETSTRING\t\t 135\n#define ASN1_F_ASN1_UNPACK_STRING\t\t\t 136\n#define ASN1_F_ASN1_UTCTIME_SET\t\t\t\t 187\n#define ASN1_F_ASN1_VERIFY\t\t\t\t 137\n#define ASN1_F_B64_READ_ASN1\t\t\t\t 208\n#define ASN1_F_B64_WRITE_ASN1\t\t\t\t 209\n#define ASN1_F_BITSTR_CB\t\t\t\t 180\n#define ASN1_F_BN_TO_ASN1_ENUMERATED\t\t\t 138\n#define ASN1_F_BN_TO_ASN1_INTEGER\t\t\t 139\n#define ASN1_F_C2I_ASN1_BIT_STRING\t\t\t 189\n#define ASN1_F_C2I_ASN1_INTEGER\t\t\t\t 194\n#define ASN1_F_C2I_ASN1_OBJECT\t\t\t\t 196\n#define ASN1_F_COLLECT_DATA\t\t\t\t 140\n#define ASN1_F_D2I_ASN1_BIT_STRING\t\t\t 141\n#define ASN1_F_D2I_ASN1_BOOLEAN\t\t\t\t 142\n#define ASN1_F_D2I_ASN1_BYTES\t\t\t\t 143\n#define ASN1_F_D2I_ASN1_GENERALIZEDTIME\t\t\t 144\n#define ASN1_F_D2I_ASN1_HEADER\t\t\t\t 145\n#define ASN1_F_D2I_ASN1_INTEGER\t\t\t\t 146\n#define ASN1_F_D2I_ASN1_OBJECT\t\t\t\t 147\n#define ASN1_F_D2I_ASN1_SET\t\t\t\t 148\n#define ASN1_F_D2I_ASN1_TYPE_BYTES\t\t\t 149\n#define ASN1_F_D2I_ASN1_UINTEGER\t\t\t 150\n#define ASN1_F_D2I_ASN1_UTCTIME\t\t\t\t 151\n#define ASN1_F_D2I_NETSCAPE_RSA\t\t\t\t 152\n#define ASN1_F_D2I_NETSCAPE_RSA_2\t\t\t 153\n#define ASN1_F_D2I_PRIVATEKEY\t\t\t\t 154\n#define ASN1_F_D2I_PUBLICKEY\t\t\t\t 155\n#define ASN1_F_D2I_RSA_NET\t\t\t\t 200\n#define ASN1_F_D2I_RSA_NET_2\t\t\t\t 201\n#define ASN1_F_D2I_X509\t\t\t\t\t 156\n#define ASN1_F_D2I_X509_CINF\t\t\t\t 157\n#define ASN1_F_D2I_X509_PKEY\t\t\t\t 159\n#define ASN1_F_I2D_ASN1_SET\t\t\t\t 188\n#define ASN1_F_I2D_ASN1_TIME\t\t\t\t 160\n#define ASN1_F_I2D_DSA_PUBKEY\t\t\t\t 161\n#define ASN1_F_I2D_EC_PUBKEY\t\t\t\t 181\n#define ASN1_F_I2D_PRIVATEKEY\t\t\t\t 163\n#define ASN1_F_I2D_PUBLICKEY\t\t\t\t 164\n#define ASN1_F_I2D_RSA_NET\t\t\t\t 162\n#define ASN1_F_I2D_RSA_PUBKEY\t\t\t\t 165\n#define ASN1_F_LONG_C2I\t\t\t\t\t 166\n#define ASN1_F_OID_MODULE_INIT\t\t\t\t 174\n#define ASN1_F_PARSE_TAGGING\t\t\t\t 182\n#define ASN1_F_PKCS5_PBE2_SET\t\t\t\t 167\n#define ASN1_F_PKCS5_PBE_SET\t\t\t\t 202\n#define ASN1_F_SMIME_READ_ASN1\t\t\t\t 210\n#define ASN1_F_SMIME_TEXT\t\t\t\t 211\n#define ASN1_F_X509_CINF_NEW\t\t\t\t 168\n#define ASN1_F_X509_CRL_ADD0_REVOKED\t\t\t 169\n#define ASN1_F_X509_INFO_NEW\t\t\t\t 170\n#define ASN1_F_X509_NAME_ENCODE\t\t\t\t 203\n#define ASN1_F_X509_NAME_EX_D2I\t\t\t\t 158\n#define ASN1_F_X509_NAME_EX_NEW\t\t\t\t 171\n#define ASN1_F_X509_NEW\t\t\t\t\t 172\n#define ASN1_F_X509_PKEY_NEW\t\t\t\t 173\n\n/* Reason codes. */\n#define ASN1_R_ADDING_OBJECT\t\t\t\t 171\n#define ASN1_R_ASN1_PARSE_ERROR\t\t\t\t 198\n#define ASN1_R_ASN1_SIG_PARSE_ERROR\t\t\t 199\n#define ASN1_R_AUX_ERROR\t\t\t\t 100\n#define ASN1_R_BAD_CLASS\t\t\t\t 101\n#define ASN1_R_BAD_OBJECT_HEADER\t\t\t 102\n#define ASN1_R_BAD_PASSWORD_READ\t\t\t 103\n#define ASN1_R_BAD_TAG\t\t\t\t\t 104\n#define ASN1_R_BMPSTRING_IS_WRONG_LENGTH\t\t 210\n#define ASN1_R_BN_LIB\t\t\t\t\t 105\n#define ASN1_R_BOOLEAN_IS_WRONG_LENGTH\t\t\t 106\n#define ASN1_R_BUFFER_TOO_SMALL\t\t\t\t 107\n#define ASN1_R_CIPHER_HAS_NO_OBJECT_IDENTIFIER\t\t 108\n#define ASN1_R_DATA_IS_WRONG\t\t\t\t 109\n#define ASN1_R_DECODE_ERROR\t\t\t\t 110\n#define ASN1_R_DECODING_ERROR\t\t\t\t 111\n#define ASN1_R_DEPTH_EXCEEDED\t\t\t\t 174\n#define ASN1_R_ENCODE_ERROR\t\t\t\t 112\n#define ASN1_R_ERROR_GETTING_TIME\t\t\t 173\n#define ASN1_R_ERROR_LOADING_SECTION\t\t\t 172\n#define ASN1_R_ERROR_PARSING_SET_ELEMENT\t\t 113\n#define ASN1_R_ERROR_SETTING_CIPHER_PARAMS\t\t 114\n#define ASN1_R_EXPECTING_AN_INTEGER\t\t\t 115\n#define ASN1_R_EXPECTING_AN_OBJECT\t\t\t 116\n#define ASN1_R_EXPECTING_A_BOOLEAN\t\t\t 117\n#define ASN1_R_EXPECTING_A_TIME\t\t\t\t 118\n#define ASN1_R_EXPLICIT_LENGTH_MISMATCH\t\t\t 119\n#define ASN1_R_EXPLICIT_TAG_NOT_CONSTRUCTED\t\t 120\n#define ASN1_R_FIELD_MISSING\t\t\t\t 121\n#define ASN1_R_FIRST_NUM_TOO_LARGE\t\t\t 122\n#define ASN1_R_HEADER_TOO_LONG\t\t\t\t 123\n#define ASN1_R_ILLEGAL_BITSTRING_FORMAT\t\t\t 175\n#define ASN1_R_ILLEGAL_BOOLEAN\t\t\t\t 176\n#define ASN1_R_ILLEGAL_CHARACTERS\t\t\t 124\n#define ASN1_R_ILLEGAL_FORMAT\t\t\t\t 177\n#define ASN1_R_ILLEGAL_HEX\t\t\t\t 178\n#define ASN1_R_ILLEGAL_IMPLICIT_TAG\t\t\t 179\n#define ASN1_R_ILLEGAL_INTEGER\t\t\t\t 180\n#define ASN1_R_ILLEGAL_NESTED_TAGGING\t\t\t 181\n#define ASN1_R_ILLEGAL_NULL\t\t\t\t 125\n#define ASN1_R_ILLEGAL_NULL_VALUE\t\t\t 182\n#define ASN1_R_ILLEGAL_OBJECT\t\t\t\t 183\n#define ASN1_R_ILLEGAL_OPTIONAL_ANY\t\t\t 126\n#define ASN1_R_ILLEGAL_OPTIONS_ON_ITEM_TEMPLATE\t\t 170\n#define ASN1_R_ILLEGAL_TAGGED_ANY\t\t\t 127\n#define ASN1_R_ILLEGAL_TIME_VALUE\t\t\t 184\n#define ASN1_R_INTEGER_NOT_ASCII_FORMAT\t\t\t 185\n#define ASN1_R_INTEGER_TOO_LARGE_FOR_LONG\t\t 128\n#define ASN1_R_INVALID_BMPSTRING_LENGTH\t\t\t 129\n#define ASN1_R_INVALID_DIGIT\t\t\t\t 130\n#define ASN1_R_INVALID_MIME_TYPE\t\t\t 200\n#define ASN1_R_INVALID_MODIFIER\t\t\t\t 186\n#define ASN1_R_INVALID_NUMBER\t\t\t\t 187\n#define ASN1_R_INVALID_OBJECT_ENCODING\t\t\t 212\n#define ASN1_R_INVALID_SEPARATOR\t\t\t 131\n#define ASN1_R_INVALID_TIME_FORMAT\t\t\t 132\n#define ASN1_R_INVALID_UNIVERSALSTRING_LENGTH\t\t 133\n#define ASN1_R_INVALID_UTF8STRING\t\t\t 134\n#define ASN1_R_IV_TOO_LARGE\t\t\t\t 135\n#define ASN1_R_LENGTH_ERROR\t\t\t\t 136\n#define ASN1_R_LIST_ERROR\t\t\t\t 188\n#define ASN1_R_MIME_NO_CONTENT_TYPE\t\t\t 201\n#define ASN1_R_MIME_PARSE_ERROR\t\t\t\t 202\n#define ASN1_R_MIME_SIG_PARSE_ERROR\t\t\t 203\n#define ASN1_R_MISSING_EOC\t\t\t\t 137\n#define ASN1_R_MISSING_SECOND_NUMBER\t\t\t 138\n#define ASN1_R_MISSING_VALUE\t\t\t\t 189\n#define ASN1_R_MSTRING_NOT_UNIVERSAL\t\t\t 139\n#define ASN1_R_MSTRING_WRONG_TAG\t\t\t 140\n#define ASN1_R_NESTED_ASN1_STRING\t\t\t 197\n#define ASN1_R_NON_HEX_CHARACTERS\t\t\t 141\n#define ASN1_R_NOT_ASCII_FORMAT\t\t\t\t 190\n#define ASN1_R_NOT_ENOUGH_DATA\t\t\t\t 142\n#define ASN1_R_NO_CONTENT_TYPE\t\t\t\t 204\n#define ASN1_R_NO_MATCHING_CHOICE_TYPE\t\t\t 143\n#define ASN1_R_NO_MULTIPART_BODY_FAILURE\t\t 205\n#define ASN1_R_NO_MULTIPART_BOUNDARY\t\t\t 206\n#define ASN1_R_NO_SIG_CONTENT_TYPE\t\t\t 207\n#define ASN1_R_NULL_IS_WRONG_LENGTH\t\t\t 144\n#define ASN1_R_OBJECT_NOT_ASCII_FORMAT\t\t\t 191\n#define ASN1_R_ODD_NUMBER_OF_CHARS\t\t\t 145\n#define ASN1_R_PRIVATE_KEY_HEADER_MISSING\t\t 146\n#define ASN1_R_SECOND_NUMBER_TOO_LARGE\t\t\t 147\n#define ASN1_R_SEQUENCE_LENGTH_MISMATCH\t\t\t 148\n#define ASN1_R_SEQUENCE_NOT_CONSTRUCTED\t\t\t 149\n#define ASN1_R_SEQUENCE_OR_SET_NEEDS_CONFIG\t\t 192\n#define ASN1_R_SHORT_LINE\t\t\t\t 150\n#define ASN1_R_SIG_INVALID_MIME_TYPE\t\t\t 208\n#define ASN1_R_STREAMING_NOT_SUPPORTED\t\t\t 209\n#define ASN1_R_STRING_TOO_LONG\t\t\t\t 151\n#define ASN1_R_STRING_TOO_SHORT\t\t\t\t 152\n#define ASN1_R_TAG_VALUE_TOO_HIGH\t\t\t 153\n#define ASN1_R_THE_ASN1_OBJECT_IDENTIFIER_IS_NOT_KNOWN_FOR_THIS_MD 154\n#define ASN1_R_TIME_NOT_ASCII_FORMAT\t\t\t 193\n#define ASN1_R_TOO_LONG\t\t\t\t\t 155\n#define ASN1_R_TYPE_NOT_CONSTRUCTED\t\t\t 156\n#define ASN1_R_UNABLE_TO_DECODE_RSA_KEY\t\t\t 157\n#define ASN1_R_UNABLE_TO_DECODE_RSA_PRIVATE_KEY\t\t 158\n#define ASN1_R_UNEXPECTED_EOC\t\t\t\t 159\n#define ASN1_R_UNIVERSALSTRING_IS_WRONG_LENGTH\t\t 211\n#define ASN1_R_UNKNOWN_FORMAT\t\t\t\t 160\n#define ASN1_R_UNKNOWN_MESSAGE_DIGEST_ALGORITHM\t\t 161\n#define ASN1_R_UNKNOWN_OBJECT_TYPE\t\t\t 162\n#define ASN1_R_UNKNOWN_PUBLIC_KEY_TYPE\t\t\t 163\n#define ASN1_R_UNKNOWN_TAG\t\t\t\t 194\n#define ASN1_R_UNKOWN_FORMAT\t\t\t\t 195\n#define ASN1_R_UNSUPPORTED_ANY_DEFINED_BY_TYPE\t\t 164\n#define ASN1_R_UNSUPPORTED_CIPHER\t\t\t 165\n#define ASN1_R_UNSUPPORTED_ENCRYPTION_ALGORITHM\t\t 166\n#define ASN1_R_UNSUPPORTED_PUBLIC_KEY_TYPE\t\t 167\n#define ASN1_R_UNSUPPORTED_TYPE\t\t\t\t 196\n#define ASN1_R_WRONG_TAG\t\t\t\t 168\n#define ASN1_R_WRONG_TYPE\t\t\t\t 169\n\n#ifdef  __cplusplus\n}\n#endif\n#endif\n"
  },
  {
    "path": "freebsd-headers/openssl/asn1_mac.h",
    "content": "/* crypto/asn1/asn1_mac.h */\n/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)\n * All rights reserved.\n *\n * This package is an SSL implementation written\n * by Eric Young (eay@cryptsoft.com).\n * The implementation was written so as to conform with Netscapes SSL.\n * \n * This library is free for commercial and non-commercial use as long as\n * the following conditions are aheared to.  The following conditions\n * apply to all code found in this distribution, be it the RC4, RSA,\n * lhash, DES, etc., code; not just the SSL code.  The SSL documentation\n * included with this distribution is covered by the same copyright terms\n * except that the holder is Tim Hudson (tjh@cryptsoft.com).\n * \n * Copyright remains Eric Young's, and as such any Copyright notices in\n * the code are not to be removed.\n * If this package is used in a product, Eric Young should be given attribution\n * as the author of the parts of the library used.\n * This can be in the form of a textual message at program startup or\n * in documentation (online or textual) provided with the package.\n * \n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. All advertising materials mentioning features or use of this software\n *    must display the following acknowledgement:\n *    \"This product includes cryptographic software written by\n *     Eric Young (eay@cryptsoft.com)\"\n *    The word 'cryptographic' can be left out if the rouines from the library\n *    being used are not cryptographic related :-).\n * 4. If you include any Windows specific code (or a derivative thereof) from \n *    the apps directory (application code) you must include an acknowledgement:\n *    \"This product includes software written by Tim Hudson (tjh@cryptsoft.com)\"\n * \n * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n * \n * The licence and distribution terms for any publically available version or\n * derivative of this code cannot be changed.  i.e. this code cannot simply be\n * copied and put under another distribution licence\n * [including the GNU Public Licence.]\n */\n\n#ifndef HEADER_ASN1_MAC_H\n#define HEADER_ASN1_MAC_H\n\n#include <openssl/asn1.h>\n\n#ifdef  __cplusplus\nextern \"C\" {\n#endif\n\n#ifndef ASN1_MAC_ERR_LIB\n#define ASN1_MAC_ERR_LIB\tERR_LIB_ASN1\n#endif \n\n#define ASN1_MAC_H_err(f,r,line) \\\n\tERR_PUT_error(ASN1_MAC_ERR_LIB,(f),(r),__FILE__,(line))\n\n#define M_ASN1_D2I_vars(a,type,func) \\\n\tASN1_const_CTX c; \\\n\ttype ret=NULL; \\\n\t\\\n\tc.pp=(const unsigned char **)pp; \\\n\tc.q= *(const unsigned char **)pp; \\\n\tc.error=ERR_R_NESTED_ASN1_ERROR; \\\n\tif ((a == NULL) || ((*a) == NULL)) \\\n\t\t{ if ((ret=(type)func()) == NULL) \\\n\t\t\t{ c.line=__LINE__; goto err; } } \\\n\telse\tret=(*a);\n\n#define M_ASN1_D2I_Init() \\\n\tc.p= *(const unsigned char **)pp; \\\n\tc.max=(length == 0)?0:(c.p+length);\n\n#define M_ASN1_D2I_Finish_2(a) \\\n\tif (!asn1_const_Finish(&c)) \\\n\t\t{ c.line=__LINE__; goto err; } \\\n\t*(const unsigned char **)pp=c.p; \\\n\tif (a != NULL) (*a)=ret; \\\n\treturn(ret);\n\n#define M_ASN1_D2I_Finish(a,func,e) \\\n\tM_ASN1_D2I_Finish_2(a); \\\nerr:\\\n\tASN1_MAC_H_err((e),c.error,c.line); \\\n\tasn1_add_error(*(const unsigned char **)pp,(int)(c.q- *pp)); \\\n\tif ((ret != NULL) && ((a == NULL) || (*a != ret))) func(ret); \\\n\treturn(NULL)\n\n#define M_ASN1_D2I_start_sequence() \\\n\tif (!asn1_GetSequence(&c,&length)) \\\n\t\t{ c.line=__LINE__; goto err; }\n/* Begin reading ASN1 without a surrounding sequence */\n#define M_ASN1_D2I_begin() \\\n\tc.slen = length;\n\n/* End reading ASN1 with no check on length */\n#define M_ASN1_D2I_Finish_nolen(a, func, e) \\\n\t*pp=c.p; \\\n\tif (a != NULL) (*a)=ret; \\\n\treturn(ret); \\\nerr:\\\n\tASN1_MAC_H_err((e),c.error,c.line); \\\n\tasn1_add_error(*pp,(int)(c.q- *pp)); \\\n\tif ((ret != NULL) && ((a == NULL) || (*a != ret))) func(ret); \\\n\treturn(NULL)\n\n#define M_ASN1_D2I_end_sequence() \\\n\t(((c.inf&1) == 0)?(c.slen <= 0): \\\n\t\t(c.eos=ASN1_const_check_infinite_end(&c.p,c.slen)))\n\n/* Don't use this with d2i_ASN1_BOOLEAN() */\n#define M_ASN1_D2I_get(b, func) \\\n\tc.q=c.p; \\\n\tif (func(&(b),&c.p,c.slen) == NULL) \\\n\t\t{c.line=__LINE__; goto err; } \\\n\tc.slen-=(c.p-c.q);\n\n/* Don't use this with d2i_ASN1_BOOLEAN() */\n#define M_ASN1_D2I_get_x(type,b,func) \\\n\tc.q=c.p; \\\n\tif (((D2I_OF(type))func)(&(b),&c.p,c.slen) == NULL) \\\n\t\t{c.line=__LINE__; goto err; } \\\n\tc.slen-=(c.p-c.q);\n\n/* use this instead () */\n#define M_ASN1_D2I_get_int(b,func) \\\n\tc.q=c.p; \\\n\tif (func(&(b),&c.p,c.slen) < 0) \\\n\t\t{c.line=__LINE__; goto err; } \\\n\tc.slen-=(c.p-c.q);\n\n#define M_ASN1_D2I_get_opt(b,func,type) \\\n\tif ((c.slen != 0) && ((M_ASN1_next & (~V_ASN1_CONSTRUCTED)) \\\n\t\t== (V_ASN1_UNIVERSAL|(type)))) \\\n\t\t{ \\\n\t\tM_ASN1_D2I_get(b,func); \\\n\t\t}\n\n#define M_ASN1_D2I_get_imp(b,func, type) \\\n\tM_ASN1_next=(_tmp& V_ASN1_CONSTRUCTED)|type; \\\n\tc.q=c.p; \\\n\tif (func(&(b),&c.p,c.slen) == NULL) \\\n\t\t{c.line=__LINE__; M_ASN1_next_prev = _tmp; goto err; } \\\n\tc.slen-=(c.p-c.q);\\\n\tM_ASN1_next_prev=_tmp;\n\n#define M_ASN1_D2I_get_IMP_opt(b,func,tag,type) \\\n\tif ((c.slen != 0) && ((M_ASN1_next & (~V_ASN1_CONSTRUCTED)) == \\\n\t\t(V_ASN1_CONTEXT_SPECIFIC|(tag)))) \\\n\t\t{ \\\n\t\tunsigned char _tmp = M_ASN1_next; \\\n\t\tM_ASN1_D2I_get_imp(b,func, type);\\\n\t\t}\n\n#define M_ASN1_D2I_get_set(r,func,free_func) \\\n\t\tM_ASN1_D2I_get_imp_set(r,func,free_func, \\\n\t\t\tV_ASN1_SET,V_ASN1_UNIVERSAL);\n\n#define M_ASN1_D2I_get_set_type(type,r,func,free_func) \\\n\t\tM_ASN1_D2I_get_imp_set_type(type,r,func,free_func, \\\n\t\t\tV_ASN1_SET,V_ASN1_UNIVERSAL);\n\n#define M_ASN1_D2I_get_set_opt(r,func,free_func) \\\n\tif ((c.slen != 0) && (M_ASN1_next == (V_ASN1_UNIVERSAL| \\\n\t\tV_ASN1_CONSTRUCTED|V_ASN1_SET)))\\\n\t\t{ M_ASN1_D2I_get_set(r,func,free_func); }\n\n#define M_ASN1_D2I_get_set_opt_type(type,r,func,free_func) \\\n\tif ((c.slen != 0) && (M_ASN1_next == (V_ASN1_UNIVERSAL| \\\n\t\tV_ASN1_CONSTRUCTED|V_ASN1_SET)))\\\n\t\t{ M_ASN1_D2I_get_set_type(type,r,func,free_func); }\n\n#define M_ASN1_I2D_len_SET_opt(a,f) \\\n\tif ((a != NULL) && (sk_num(a) != 0)) \\\n\t\tM_ASN1_I2D_len_SET(a,f);\n\n#define M_ASN1_I2D_put_SET_opt(a,f) \\\n\tif ((a != NULL) && (sk_num(a) != 0)) \\\n\t\tM_ASN1_I2D_put_SET(a,f);\n\n#define M_ASN1_I2D_put_SEQUENCE_opt(a,f) \\\n\tif ((a != NULL) && (sk_num(a) != 0)) \\\n\t\tM_ASN1_I2D_put_SEQUENCE(a,f);\n\n#define M_ASN1_I2D_put_SEQUENCE_opt_type(type,a,f) \\\n\tif ((a != NULL) && (sk_##type##_num(a) != 0)) \\\n\t\tM_ASN1_I2D_put_SEQUENCE_type(type,a,f);\n\n#define M_ASN1_D2I_get_IMP_set_opt(b,func,free_func,tag) \\\n\tif ((c.slen != 0) && \\\n\t\t(M_ASN1_next == \\\n\t\t(V_ASN1_CONTEXT_SPECIFIC|V_ASN1_CONSTRUCTED|(tag))))\\\n\t\t{ \\\n\t\tM_ASN1_D2I_get_imp_set(b,func,free_func,\\\n\t\t\ttag,V_ASN1_CONTEXT_SPECIFIC); \\\n\t\t}\n\n#define M_ASN1_D2I_get_IMP_set_opt_type(type,b,func,free_func,tag) \\\n\tif ((c.slen != 0) && \\\n\t\t(M_ASN1_next == \\\n\t\t(V_ASN1_CONTEXT_SPECIFIC|V_ASN1_CONSTRUCTED|(tag))))\\\n\t\t{ \\\n\t\tM_ASN1_D2I_get_imp_set_type(type,b,func,free_func,\\\n\t\t\ttag,V_ASN1_CONTEXT_SPECIFIC); \\\n\t\t}\n\n#define M_ASN1_D2I_get_seq(r,func,free_func) \\\n\t\tM_ASN1_D2I_get_imp_set(r,func,free_func,\\\n\t\t\tV_ASN1_SEQUENCE,V_ASN1_UNIVERSAL);\n\n#define M_ASN1_D2I_get_seq_type(type,r,func,free_func) \\\n\t\tM_ASN1_D2I_get_imp_set_type(type,r,func,free_func,\\\n\t\t\t\t\t    V_ASN1_SEQUENCE,V_ASN1_UNIVERSAL)\n\n#define M_ASN1_D2I_get_seq_opt(r,func,free_func) \\\n\tif ((c.slen != 0) && (M_ASN1_next == (V_ASN1_UNIVERSAL| \\\n\t\tV_ASN1_CONSTRUCTED|V_ASN1_SEQUENCE)))\\\n\t\t{ M_ASN1_D2I_get_seq(r,func,free_func); }\n\n#define M_ASN1_D2I_get_seq_opt_type(type,r,func,free_func) \\\n\tif ((c.slen != 0) && (M_ASN1_next == (V_ASN1_UNIVERSAL| \\\n\t\tV_ASN1_CONSTRUCTED|V_ASN1_SEQUENCE)))\\\n\t\t{ M_ASN1_D2I_get_seq_type(type,r,func,free_func); }\n\n#define M_ASN1_D2I_get_IMP_set(r,func,free_func,x) \\\n\t\tM_ASN1_D2I_get_imp_set(r,func,free_func,\\\n\t\t\tx,V_ASN1_CONTEXT_SPECIFIC);\n\n#define M_ASN1_D2I_get_IMP_set_type(type,r,func,free_func,x) \\\n\t\tM_ASN1_D2I_get_imp_set_type(type,r,func,free_func,\\\n\t\t\tx,V_ASN1_CONTEXT_SPECIFIC);\n\n#define M_ASN1_D2I_get_imp_set(r,func,free_func,a,b) \\\n\tc.q=c.p; \\\n\tif (d2i_ASN1_SET(&(r),&c.p,c.slen,(char *(*)())func,\\\n\t\t(void (*)())free_func,a,b) == NULL) \\\n\t\t{ c.line=__LINE__; goto err; } \\\n\tc.slen-=(c.p-c.q);\n\n#define M_ASN1_D2I_get_imp_set_type(type,r,func,free_func,a,b) \\\n\tc.q=c.p; \\\n\tif (d2i_ASN1_SET_OF_##type(&(r),&c.p,c.slen,func,\\\n\t\t\t\t   free_func,a,b) == NULL) \\\n\t\t{ c.line=__LINE__; goto err; } \\\n\tc.slen-=(c.p-c.q);\n\n#define M_ASN1_D2I_get_set_strings(r,func,a,b) \\\n\tc.q=c.p; \\\n\tif (d2i_ASN1_STRING_SET(&(r),&c.p,c.slen,a,b) == NULL) \\\n\t\t{ c.line=__LINE__; goto err; } \\\n\tc.slen-=(c.p-c.q);\n\n#define M_ASN1_D2I_get_EXP_opt(r,func,tag) \\\n\tif ((c.slen != 0L) && (M_ASN1_next == \\\n\t\t(V_ASN1_CONSTRUCTED|V_ASN1_CONTEXT_SPECIFIC|tag))) \\\n\t\t{ \\\n\t\tint Tinf,Ttag,Tclass; \\\n\t\tlong Tlen; \\\n\t\t\\\n\t\tc.q=c.p; \\\n\t\tTinf=ASN1_get_object(&c.p,&Tlen,&Ttag,&Tclass,c.slen); \\\n\t\tif (Tinf & 0x80) \\\n\t\t\t{ c.error=ERR_R_BAD_ASN1_OBJECT_HEADER; \\\n\t\t\tc.line=__LINE__; goto err; } \\\n\t\tif (Tinf == (V_ASN1_CONSTRUCTED+1)) \\\n\t\t\t\t\tTlen = c.slen - (c.p - c.q) - 2; \\\n\t\tif (func(&(r),&c.p,Tlen) == NULL) \\\n\t\t\t{ c.line=__LINE__; goto err; } \\\n\t\tif (Tinf == (V_ASN1_CONSTRUCTED+1)) { \\\n\t\t\tTlen = c.slen - (c.p - c.q); \\\n\t\t\tif(!ASN1_const_check_infinite_end(&c.p, Tlen)) \\\n\t\t\t\t{ c.error=ERR_R_MISSING_ASN1_EOS; \\\n\t\t\t\tc.line=__LINE__; goto err; } \\\n\t\t}\\\n\t\tc.slen-=(c.p-c.q); \\\n\t\t}\n\n#define M_ASN1_D2I_get_EXP_set_opt(r,func,free_func,tag,b) \\\n\tif ((c.slen != 0) && (M_ASN1_next == \\\n\t\t(V_ASN1_CONSTRUCTED|V_ASN1_CONTEXT_SPECIFIC|tag))) \\\n\t\t{ \\\n\t\tint Tinf,Ttag,Tclass; \\\n\t\tlong Tlen; \\\n\t\t\\\n\t\tc.q=c.p; \\\n\t\tTinf=ASN1_get_object(&c.p,&Tlen,&Ttag,&Tclass,c.slen); \\\n\t\tif (Tinf & 0x80) \\\n\t\t\t{ c.error=ERR_R_BAD_ASN1_OBJECT_HEADER; \\\n\t\t\tc.line=__LINE__; goto err; } \\\n\t\tif (Tinf == (V_ASN1_CONSTRUCTED+1)) \\\n\t\t\t\t\tTlen = c.slen - (c.p - c.q) - 2; \\\n\t\tif (d2i_ASN1_SET(&(r),&c.p,Tlen,(char *(*)())func, \\\n\t\t\t(void (*)())free_func, \\\n\t\t\tb,V_ASN1_UNIVERSAL) == NULL) \\\n\t\t\t{ c.line=__LINE__; goto err; } \\\n\t\tif (Tinf == (V_ASN1_CONSTRUCTED+1)) { \\\n\t\t\tTlen = c.slen - (c.p - c.q); \\\n\t\t\tif(!ASN1_check_infinite_end(&c.p, Tlen)) \\\n\t\t\t\t{ c.error=ERR_R_MISSING_ASN1_EOS; \\\n\t\t\t\tc.line=__LINE__; goto err; } \\\n\t\t}\\\n\t\tc.slen-=(c.p-c.q); \\\n\t\t}\n\n#define M_ASN1_D2I_get_EXP_set_opt_type(type,r,func,free_func,tag,b) \\\n\tif ((c.slen != 0) && (M_ASN1_next == \\\n\t\t(V_ASN1_CONSTRUCTED|V_ASN1_CONTEXT_SPECIFIC|tag))) \\\n\t\t{ \\\n\t\tint Tinf,Ttag,Tclass; \\\n\t\tlong Tlen; \\\n\t\t\\\n\t\tc.q=c.p; \\\n\t\tTinf=ASN1_get_object(&c.p,&Tlen,&Ttag,&Tclass,c.slen); \\\n\t\tif (Tinf & 0x80) \\\n\t\t\t{ c.error=ERR_R_BAD_ASN1_OBJECT_HEADER; \\\n\t\t\tc.line=__LINE__; goto err; } \\\n\t\tif (Tinf == (V_ASN1_CONSTRUCTED+1)) \\\n\t\t\t\t\tTlen = c.slen - (c.p - c.q) - 2; \\\n\t\tif (d2i_ASN1_SET_OF_##type(&(r),&c.p,Tlen,func, \\\n\t\t\tfree_func,b,V_ASN1_UNIVERSAL) == NULL) \\\n\t\t\t{ c.line=__LINE__; goto err; } \\\n\t\tif (Tinf == (V_ASN1_CONSTRUCTED+1)) { \\\n\t\t\tTlen = c.slen - (c.p - c.q); \\\n\t\t\tif(!ASN1_check_infinite_end(&c.p, Tlen)) \\\n\t\t\t\t{ c.error=ERR_R_MISSING_ASN1_EOS; \\\n\t\t\t\tc.line=__LINE__; goto err; } \\\n\t\t}\\\n\t\tc.slen-=(c.p-c.q); \\\n\t\t}\n\n/* New macros */\n#define M_ASN1_New_Malloc(ret,type) \\\n\tif ((ret=(type *)OPENSSL_malloc(sizeof(type))) == NULL) \\\n\t\t{ c.line=__LINE__; goto err2; }\n\n#define M_ASN1_New(arg,func) \\\n\tif (((arg)=func()) == NULL) return(NULL)\n\n#define M_ASN1_New_Error(a) \\\n/*\terr:\tASN1_MAC_H_err((a),ERR_R_NESTED_ASN1_ERROR,c.line); \\\n\t\treturn(NULL);*/ \\\n\terr2:\tASN1_MAC_H_err((a),ERR_R_MALLOC_FAILURE,c.line); \\\n\t\treturn(NULL)\n\n\n/* BIG UGLY WARNING!  This is so damn ugly I wanna puke.  Unfortunately,\n   some macros that use ASN1_const_CTX still insist on writing in the input\n   stream.  ARGH!  ARGH!  ARGH!  Let's get rid of this macro package.\n   Please?\t\t\t\t\t\t-- Richard Levitte */\n#define M_ASN1_next\t\t(*((unsigned char *)(c.p)))\n#define M_ASN1_next_prev\t(*((unsigned char *)(c.q)))\n\n/*************************************************/\n\n#define M_ASN1_I2D_vars(a)\tint r=0,ret=0; \\\n\t\t\t\tunsigned char *p; \\\n\t\t\t\tif (a == NULL) return(0)\n\n/* Length Macros */\n#define M_ASN1_I2D_len(a,f)\tret+=f(a,NULL)\n#define M_ASN1_I2D_len_IMP_opt(a,f)\tif (a != NULL) M_ASN1_I2D_len(a,f)\n\n#define M_ASN1_I2D_len_SET(a,f) \\\n\t\tret+=i2d_ASN1_SET(a,NULL,f,V_ASN1_SET,V_ASN1_UNIVERSAL,IS_SET);\n\n#define M_ASN1_I2D_len_SET_type(type,a,f) \\\n\t\tret+=i2d_ASN1_SET_OF_##type(a,NULL,f,V_ASN1_SET, \\\n\t\t\t\t\t    V_ASN1_UNIVERSAL,IS_SET);\n\n#define M_ASN1_I2D_len_SEQUENCE(a,f) \\\n\t\tret+=i2d_ASN1_SET(a,NULL,f,V_ASN1_SEQUENCE,V_ASN1_UNIVERSAL, \\\n\t\t\t\t  IS_SEQUENCE);\n\n#define M_ASN1_I2D_len_SEQUENCE_type(type,a,f) \\\n\t\tret+=i2d_ASN1_SET_OF_##type(a,NULL,f,V_ASN1_SEQUENCE, \\\n\t\t\t\t\t    V_ASN1_UNIVERSAL,IS_SEQUENCE)\n\n#define M_ASN1_I2D_len_SEQUENCE_opt(a,f) \\\n\t\tif ((a != NULL) && (sk_num(a) != 0)) \\\n\t\t\tM_ASN1_I2D_len_SEQUENCE(a,f);\n\n#define M_ASN1_I2D_len_SEQUENCE_opt_type(type,a,f) \\\n\t\tif ((a != NULL) && (sk_##type##_num(a) != 0)) \\\n\t\t\tM_ASN1_I2D_len_SEQUENCE_type(type,a,f);\n\n#define M_ASN1_I2D_len_IMP_SET(a,f,x) \\\n\t\tret+=i2d_ASN1_SET(a,NULL,f,x,V_ASN1_CONTEXT_SPECIFIC,IS_SET);\n\n#define M_ASN1_I2D_len_IMP_SET_type(type,a,f,x) \\\n\t\tret+=i2d_ASN1_SET_OF_##type(a,NULL,f,x, \\\n\t\t\t\t\t    V_ASN1_CONTEXT_SPECIFIC,IS_SET);\n\n#define M_ASN1_I2D_len_IMP_SET_opt(a,f,x) \\\n\t\tif ((a != NULL) && (sk_num(a) != 0)) \\\n\t\t\tret+=i2d_ASN1_SET(a,NULL,f,x,V_ASN1_CONTEXT_SPECIFIC, \\\n\t\t\t\t\t  IS_SET);\n\n#define M_ASN1_I2D_len_IMP_SET_opt_type(type,a,f,x) \\\n\t\tif ((a != NULL) && (sk_##type##_num(a) != 0)) \\\n\t\t\tret+=i2d_ASN1_SET_OF_##type(a,NULL,f,x, \\\n\t\t\t\t\t       V_ASN1_CONTEXT_SPECIFIC,IS_SET);\n\n#define M_ASN1_I2D_len_IMP_SEQUENCE(a,f,x) \\\n\t\tret+=i2d_ASN1_SET(a,NULL,f,x,V_ASN1_CONTEXT_SPECIFIC, \\\n\t\t\t\t  IS_SEQUENCE);\n\n#define M_ASN1_I2D_len_IMP_SEQUENCE_opt(a,f,x) \\\n\t\tif ((a != NULL) && (sk_num(a) != 0)) \\\n\t\t\tret+=i2d_ASN1_SET(a,NULL,f,x,V_ASN1_CONTEXT_SPECIFIC, \\\n\t\t\t\t\t  IS_SEQUENCE);\n\n#define M_ASN1_I2D_len_IMP_SEQUENCE_opt_type(type,a,f,x) \\\n\t\tif ((a != NULL) && (sk_##type##_num(a) != 0)) \\\n\t\t\tret+=i2d_ASN1_SET_OF_##type(a,NULL,f,x, \\\n\t\t\t\t\t\t    V_ASN1_CONTEXT_SPECIFIC, \\\n\t\t\t\t\t\t    IS_SEQUENCE);\n\n#define M_ASN1_I2D_len_EXP_opt(a,f,mtag,v) \\\n\t\tif (a != NULL)\\\n\t\t\t{ \\\n\t\t\tv=f(a,NULL); \\\n\t\t\tret+=ASN1_object_size(1,v,mtag); \\\n\t\t\t}\n\n#define M_ASN1_I2D_len_EXP_SET_opt(a,f,mtag,tag,v) \\\n\t\tif ((a != NULL) && (sk_num(a) != 0))\\\n\t\t\t{ \\\n\t\t\tv=i2d_ASN1_SET(a,NULL,f,tag,V_ASN1_UNIVERSAL,IS_SET); \\\n\t\t\tret+=ASN1_object_size(1,v,mtag); \\\n\t\t\t}\n\n#define M_ASN1_I2D_len_EXP_SEQUENCE_opt(a,f,mtag,tag,v) \\\n\t\tif ((a != NULL) && (sk_num(a) != 0))\\\n\t\t\t{ \\\n\t\t\tv=i2d_ASN1_SET(a,NULL,f,tag,V_ASN1_UNIVERSAL, \\\n\t\t\t\t       IS_SEQUENCE); \\\n\t\t\tret+=ASN1_object_size(1,v,mtag); \\\n\t\t\t}\n\n#define M_ASN1_I2D_len_EXP_SEQUENCE_opt_type(type,a,f,mtag,tag,v) \\\n\t\tif ((a != NULL) && (sk_##type##_num(a) != 0))\\\n\t\t\t{ \\\n\t\t\tv=i2d_ASN1_SET_OF_##type(a,NULL,f,tag, \\\n\t\t\t\t\t\t V_ASN1_UNIVERSAL, \\\n\t\t\t\t\t\t IS_SEQUENCE); \\\n\t\t\tret+=ASN1_object_size(1,v,mtag); \\\n\t\t\t}\n\n/* Put Macros */\n#define M_ASN1_I2D_put(a,f)\tf(a,&p)\n\n#define M_ASN1_I2D_put_IMP_opt(a,f,t)\t\\\n\t\tif (a != NULL) \\\n\t\t\t{ \\\n\t\t\tunsigned char *q=p; \\\n\t\t\tf(a,&p); \\\n\t\t\t*q=(V_ASN1_CONTEXT_SPECIFIC|t|(*q&V_ASN1_CONSTRUCTED));\\\n\t\t\t}\n\n#define M_ASN1_I2D_put_SET(a,f) i2d_ASN1_SET(a,&p,f,V_ASN1_SET,\\\n\t\t\tV_ASN1_UNIVERSAL,IS_SET)\n#define M_ASN1_I2D_put_SET_type(type,a,f) \\\n     i2d_ASN1_SET_OF_##type(a,&p,f,V_ASN1_SET,V_ASN1_UNIVERSAL,IS_SET)\n#define M_ASN1_I2D_put_IMP_SET(a,f,x) i2d_ASN1_SET(a,&p,f,x,\\\n\t\t\tV_ASN1_CONTEXT_SPECIFIC,IS_SET)\n#define M_ASN1_I2D_put_IMP_SET_type(type,a,f,x) \\\n     i2d_ASN1_SET_OF_##type(a,&p,f,x,V_ASN1_CONTEXT_SPECIFIC,IS_SET)\n#define M_ASN1_I2D_put_IMP_SEQUENCE(a,f,x) i2d_ASN1_SET(a,&p,f,x,\\\n\t\t\tV_ASN1_CONTEXT_SPECIFIC,IS_SEQUENCE)\n\n#define M_ASN1_I2D_put_SEQUENCE(a,f) i2d_ASN1_SET(a,&p,f,V_ASN1_SEQUENCE,\\\n\t\t\t\t\t     V_ASN1_UNIVERSAL,IS_SEQUENCE)\n\n#define M_ASN1_I2D_put_SEQUENCE_type(type,a,f) \\\n     i2d_ASN1_SET_OF_##type(a,&p,f,V_ASN1_SEQUENCE,V_ASN1_UNIVERSAL, \\\n\t\t\t    IS_SEQUENCE)\n\n#define M_ASN1_I2D_put_SEQUENCE_opt(a,f) \\\n\t\tif ((a != NULL) && (sk_num(a) != 0)) \\\n\t\t\tM_ASN1_I2D_put_SEQUENCE(a,f);\n\n#define M_ASN1_I2D_put_IMP_SET_opt(a,f,x) \\\n\t\tif ((a != NULL) && (sk_num(a) != 0)) \\\n\t\t\t{ i2d_ASN1_SET(a,&p,f,x,V_ASN1_CONTEXT_SPECIFIC, \\\n\t\t\t\t       IS_SET); }\n\n#define M_ASN1_I2D_put_IMP_SET_opt_type(type,a,f,x) \\\n\t\tif ((a != NULL) && (sk_##type##_num(a) != 0)) \\\n\t\t\t{ i2d_ASN1_SET_OF_##type(a,&p,f,x, \\\n\t\t\t\t\t\t V_ASN1_CONTEXT_SPECIFIC, \\\n\t\t\t\t\t\t IS_SET); }\n\n#define M_ASN1_I2D_put_IMP_SEQUENCE_opt(a,f,x) \\\n\t\tif ((a != NULL) && (sk_num(a) != 0)) \\\n\t\t\t{ i2d_ASN1_SET(a,&p,f,x,V_ASN1_CONTEXT_SPECIFIC, \\\n\t\t\t\t       IS_SEQUENCE); }\n\n#define M_ASN1_I2D_put_IMP_SEQUENCE_opt_type(type,a,f,x) \\\n\t\tif ((a != NULL) && (sk_##type##_num(a) != 0)) \\\n\t\t\t{ i2d_ASN1_SET_OF_##type(a,&p,f,x, \\\n\t\t\t\t\t\t V_ASN1_CONTEXT_SPECIFIC, \\\n\t\t\t\t\t\t IS_SEQUENCE); }\n\n#define M_ASN1_I2D_put_EXP_opt(a,f,tag,v) \\\n\t\tif (a != NULL) \\\n\t\t\t{ \\\n\t\t\tASN1_put_object(&p,1,v,tag,V_ASN1_CONTEXT_SPECIFIC); \\\n\t\t\tf(a,&p); \\\n\t\t\t}\n\n#define M_ASN1_I2D_put_EXP_SET_opt(a,f,mtag,tag,v) \\\n\t\tif ((a != NULL) && (sk_num(a) != 0)) \\\n\t\t\t{ \\\n\t\t\tASN1_put_object(&p,1,v,mtag,V_ASN1_CONTEXT_SPECIFIC); \\\n\t\t\ti2d_ASN1_SET(a,&p,f,tag,V_ASN1_UNIVERSAL,IS_SET); \\\n\t\t\t}\n\n#define M_ASN1_I2D_put_EXP_SEQUENCE_opt(a,f,mtag,tag,v) \\\n\t\tif ((a != NULL) && (sk_num(a) != 0)) \\\n\t\t\t{ \\\n\t\t\tASN1_put_object(&p,1,v,mtag,V_ASN1_CONTEXT_SPECIFIC); \\\n\t\t\ti2d_ASN1_SET(a,&p,f,tag,V_ASN1_UNIVERSAL,IS_SEQUENCE); \\\n\t\t\t}\n\n#define M_ASN1_I2D_put_EXP_SEQUENCE_opt_type(type,a,f,mtag,tag,v) \\\n\t\tif ((a != NULL) && (sk_##type##_num(a) != 0)) \\\n\t\t\t{ \\\n\t\t\tASN1_put_object(&p,1,v,mtag,V_ASN1_CONTEXT_SPECIFIC); \\\n\t\t\ti2d_ASN1_SET_OF_##type(a,&p,f,tag,V_ASN1_UNIVERSAL, \\\n\t\t\t\t\t       IS_SEQUENCE); \\\n\t\t\t}\n\n#define M_ASN1_I2D_seq_total() \\\n\t\tr=ASN1_object_size(1,ret,V_ASN1_SEQUENCE); \\\n\t\tif (pp == NULL) return(r); \\\n\t\tp= *pp; \\\n\t\tASN1_put_object(&p,1,ret,V_ASN1_SEQUENCE,V_ASN1_UNIVERSAL)\n\n#define M_ASN1_I2D_INF_seq_start(tag,ctx) \\\n\t\t*(p++)=(V_ASN1_CONSTRUCTED|(tag)|(ctx)); \\\n\t\t*(p++)=0x80\n\n#define M_ASN1_I2D_INF_seq_end() *(p++)=0x00; *(p++)=0x00\n\n#define M_ASN1_I2D_finish()\t*pp=p; \\\n\t\t\t\treturn(r);\n\nint asn1_GetSequence(ASN1_const_CTX *c, long *length);\nvoid asn1_add_error(const unsigned char *address,int offset);\n#ifdef  __cplusplus\n}\n#endif\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/openssl/asn1t.h",
    "content": "/* asn1t.h */\n/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL\n * project 2000.\n */\n/* ====================================================================\n * Copyright (c) 2000 The OpenSSL Project.  All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n *\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer. \n *\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in\n *    the documentation and/or other materials provided with the\n *    distribution.\n *\n * 3. All advertising materials mentioning features or use of this\n *    software must display the following acknowledgment:\n *    \"This product includes software developed by the OpenSSL Project\n *    for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)\"\n *\n * 4. The names \"OpenSSL Toolkit\" and \"OpenSSL Project\" must not be used to\n *    endorse or promote products derived from this software without\n *    prior written permission. For written permission, please contact\n *    licensing@OpenSSL.org.\n *\n * 5. Products derived from this software may not be called \"OpenSSL\"\n *    nor may \"OpenSSL\" appear in their names without prior written\n *    permission of the OpenSSL Project.\n *\n * 6. Redistributions of any form whatsoever must retain the following\n *    acknowledgment:\n *    \"This product includes software developed by the OpenSSL Project\n *    for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)\"\n *\n * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY\n * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\n * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE OpenSSL PROJECT OR\n * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\n * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,\n * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED\n * OF THE POSSIBILITY OF SUCH DAMAGE.\n * ====================================================================\n *\n * This product includes cryptographic software written by Eric Young\n * (eay@cryptsoft.com).  This product includes software written by Tim\n * Hudson (tjh@cryptsoft.com).\n *\n */\n#ifndef HEADER_ASN1T_H\n#define HEADER_ASN1T_H\n\n#include <stddef.h>\n#include <openssl/e_os2.h>\n#include <openssl/asn1.h>\n\n#ifdef OPENSSL_BUILD_SHLIBCRYPTO\n# undef OPENSSL_EXTERN\n# define OPENSSL_EXTERN OPENSSL_EXPORT\n#endif\n\n/* ASN1 template defines, structures and functions */\n\n#ifdef  __cplusplus\nextern \"C\" {\n#endif\n\n\n#ifndef OPENSSL_EXPORT_VAR_AS_FUNCTION\n\n/* Macro to obtain ASN1_ADB pointer from a type (only used internally) */\n#define ASN1_ADB_ptr(iptr) ((const ASN1_ADB *)(iptr))\n\n\n/* Macros for start and end of ASN1_ITEM definition */\n\n#define ASN1_ITEM_start(itname) \\\n\tOPENSSL_GLOBAL const ASN1_ITEM itname##_it = {\n\n#define ASN1_ITEM_end(itname) \\\n\t\t};\n\n#else\n\n/* Macro to obtain ASN1_ADB pointer from a type (only used internally) */\n#define ASN1_ADB_ptr(iptr) ((const ASN1_ADB *)(iptr()))\n\n\n/* Macros for start and end of ASN1_ITEM definition */\n\n#define ASN1_ITEM_start(itname) \\\n\tconst ASN1_ITEM * itname##_it(void) \\\n\t{ \\\n\t\tstatic const ASN1_ITEM local_it = { \n\n#define ASN1_ITEM_end(itname) \\\n\t\t}; \\\n\treturn &local_it; \\\n\t}\n\n#endif\n\n\n/* Macros to aid ASN1 template writing */\n\n#define ASN1_ITEM_TEMPLATE(tname) \\\n\tstatic const ASN1_TEMPLATE tname##_item_tt \n\n#define ASN1_ITEM_TEMPLATE_END(tname) \\\n\t;\\\n\tASN1_ITEM_start(tname) \\\n\t\tASN1_ITYPE_PRIMITIVE,\\\n\t\t-1,\\\n\t\t&tname##_item_tt,\\\n\t\t0,\\\n\t\tNULL,\\\n\t\t0,\\\n\t\t#tname \\\n\tASN1_ITEM_end(tname)\n\n\n/* This is a ASN1 type which just embeds a template */\n \n/* This pair helps declare a SEQUENCE. We can do:\n *\n * \tASN1_SEQUENCE(stname) = {\n * \t\t... SEQUENCE components ...\n * \t} ASN1_SEQUENCE_END(stname)\n *\n * \tThis will produce an ASN1_ITEM called stname_it\n *\tfor a structure called stname.\n *\n * \tIf you want the same structure but a different\n *\tname then use:\n *\n * \tASN1_SEQUENCE(itname) = {\n * \t\t... SEQUENCE components ...\n * \t} ASN1_SEQUENCE_END_name(stname, itname)\n *\n *\tThis will create an item called itname_it using\n *\ta structure called stname.\n */\n\n#define ASN1_SEQUENCE(tname) \\\n\tstatic const ASN1_TEMPLATE tname##_seq_tt[] \n\n#define ASN1_SEQUENCE_END(stname) ASN1_SEQUENCE_END_name(stname, stname)\n\n#define ASN1_SEQUENCE_END_name(stname, tname) \\\n\t;\\\n\tASN1_ITEM_start(tname) \\\n\t\tASN1_ITYPE_SEQUENCE,\\\n\t\tV_ASN1_SEQUENCE,\\\n\t\ttname##_seq_tt,\\\n\t\tsizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\\\n\t\tNULL,\\\n\t\tsizeof(stname),\\\n\t\t#stname \\\n\tASN1_ITEM_end(tname)\n\n#define ASN1_NDEF_SEQUENCE(tname) \\\n\tASN1_SEQUENCE(tname)\n\n#define ASN1_NDEF_SEQUENCE_cb(tname, cb) \\\n\tASN1_SEQUENCE_cb(tname, cb)\n\n#define ASN1_SEQUENCE_cb(tname, cb) \\\n\tstatic const ASN1_AUX tname##_aux = {NULL, 0, 0, 0, cb, 0}; \\\n\tASN1_SEQUENCE(tname)\n\n#define ASN1_BROKEN_SEQUENCE(tname) \\\n\tstatic const ASN1_AUX tname##_aux = {NULL, ASN1_AFLG_BROKEN, 0, 0, 0, 0}; \\\n\tASN1_SEQUENCE(tname)\n\n#define ASN1_SEQUENCE_ref(tname, cb, lck) \\\n\tstatic const ASN1_AUX tname##_aux = {NULL, ASN1_AFLG_REFCOUNT, offsetof(tname, references), lck, cb, 0}; \\\n\tASN1_SEQUENCE(tname)\n\n#define ASN1_SEQUENCE_enc(tname, enc, cb) \\\n\tstatic const ASN1_AUX tname##_aux = {NULL, ASN1_AFLG_ENCODING, 0, 0, cb, offsetof(tname, enc)}; \\\n\tASN1_SEQUENCE(tname)\n\n#define ASN1_NDEF_SEQUENCE_END(tname) \\\n\t;\\\n\tASN1_ITEM_start(tname) \\\n\t\tASN1_ITYPE_NDEF_SEQUENCE,\\\n\t\tV_ASN1_SEQUENCE,\\\n\t\ttname##_seq_tt,\\\n\t\tsizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\\\n\t\tNULL,\\\n\t\tsizeof(tname),\\\n\t\t#tname \\\n\tASN1_ITEM_end(tname)\n\n#define ASN1_BROKEN_SEQUENCE_END(stname) ASN1_SEQUENCE_END_ref(stname, stname)\n\n#define ASN1_SEQUENCE_END_enc(stname, tname) ASN1_SEQUENCE_END_ref(stname, tname)\n\n#define ASN1_SEQUENCE_END_cb(stname, tname) ASN1_SEQUENCE_END_ref(stname, tname)\n\n#define ASN1_SEQUENCE_END_ref(stname, tname) \\\n\t;\\\n\tASN1_ITEM_start(tname) \\\n\t\tASN1_ITYPE_SEQUENCE,\\\n\t\tV_ASN1_SEQUENCE,\\\n\t\ttname##_seq_tt,\\\n\t\tsizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\\\n\t\t&tname##_aux,\\\n\t\tsizeof(stname),\\\n\t\t#stname \\\n\tASN1_ITEM_end(tname)\n\n\n/* This pair helps declare a CHOICE type. We can do:\n *\n * \tASN1_CHOICE(chname) = {\n * \t\t... CHOICE options ...\n * \tASN1_CHOICE_END(chname)\n *\n * \tThis will produce an ASN1_ITEM called chname_it\n *\tfor a structure called chname. The structure\n *\tdefinition must look like this:\n *\ttypedef struct {\n *\t\tint type;\n *\t\tunion {\n *\t\t\tASN1_SOMETHING *opt1;\n *\t\t\tASN1_SOMEOTHER *opt2;\n *\t\t} value;\n *\t} chname;\n *\t\n *\tthe name of the selector must be 'type'.\n * \tto use an alternative selector name use the\n *      ASN1_CHOICE_END_selector() version.\n */\n\n#define ASN1_CHOICE(tname) \\\n\tstatic const ASN1_TEMPLATE tname##_ch_tt[] \n\n#define ASN1_CHOICE_cb(tname, cb) \\\n\tstatic const ASN1_AUX tname##_aux = {NULL, 0, 0, 0, cb, 0}; \\\n\tASN1_CHOICE(tname)\n\n#define ASN1_CHOICE_END(stname) ASN1_CHOICE_END_name(stname, stname)\n\n#define ASN1_CHOICE_END_name(stname, tname) ASN1_CHOICE_END_selector(stname, tname, type)\n\n#define ASN1_CHOICE_END_selector(stname, tname, selname) \\\n\t;\\\n\tASN1_ITEM_start(tname) \\\n\t\tASN1_ITYPE_CHOICE,\\\n\t\toffsetof(stname,selname) ,\\\n\t\ttname##_ch_tt,\\\n\t\tsizeof(tname##_ch_tt) / sizeof(ASN1_TEMPLATE),\\\n\t\tNULL,\\\n\t\tsizeof(stname),\\\n\t\t#stname \\\n\tASN1_ITEM_end(tname)\n\n#define ASN1_CHOICE_END_cb(stname, tname, selname) \\\n\t;\\\n\tASN1_ITEM_start(tname) \\\n\t\tASN1_ITYPE_CHOICE,\\\n\t\toffsetof(stname,selname) ,\\\n\t\ttname##_ch_tt,\\\n\t\tsizeof(tname##_ch_tt) / sizeof(ASN1_TEMPLATE),\\\n\t\t&tname##_aux,\\\n\t\tsizeof(stname),\\\n\t\t#stname \\\n\tASN1_ITEM_end(tname)\n\n/* This helps with the template wrapper form of ASN1_ITEM */\n\n#define ASN1_EX_TEMPLATE_TYPE(flags, tag, name, type) { \\\n\t(flags), (tag), 0,\\\n\t#name, ASN1_ITEM_ref(type) }\n\n/* These help with SEQUENCE or CHOICE components */\n\n/* used to declare other types */\n\n#define ASN1_EX_TYPE(flags, tag, stname, field, type) { \\\n\t(flags), (tag), offsetof(stname, field),\\\n\t#field, ASN1_ITEM_ref(type) }\n\n/* used when the structure is combined with the parent */\n\n#define ASN1_EX_COMBINE(flags, tag, type) { \\\n\t(flags)|ASN1_TFLG_COMBINE, (tag), 0, NULL, ASN1_ITEM_ref(type) }\n\n/* implicit and explicit helper macros */\n\n#define ASN1_IMP_EX(stname, field, type, tag, ex) \\\n\t\tASN1_EX_TYPE(ASN1_TFLG_IMPLICIT | ex, tag, stname, field, type)\n\n#define ASN1_EXP_EX(stname, field, type, tag, ex) \\\n\t\tASN1_EX_TYPE(ASN1_TFLG_EXPLICIT | ex, tag, stname, field, type)\n\n/* Any defined by macros: the field used is in the table itself */\n\n#ifndef OPENSSL_EXPORT_VAR_AS_FUNCTION\n#define ASN1_ADB_OBJECT(tblname) { ASN1_TFLG_ADB_OID, -1, 0, #tblname, (const ASN1_ITEM *)&(tblname##_adb) }\n#define ASN1_ADB_INTEGER(tblname) { ASN1_TFLG_ADB_INT, -1, 0, #tblname, (const ASN1_ITEM *)&(tblname##_adb) }\n#else\n#define ASN1_ADB_OBJECT(tblname) { ASN1_TFLG_ADB_OID, -1, 0, #tblname, tblname##_adb }\n#define ASN1_ADB_INTEGER(tblname) { ASN1_TFLG_ADB_INT, -1, 0, #tblname, tblname##_adb }\n#endif\n/* Plain simple type */\n#define ASN1_SIMPLE(stname, field, type) ASN1_EX_TYPE(0,0, stname, field, type)\n\n/* OPTIONAL simple type */\n#define ASN1_OPT(stname, field, type) ASN1_EX_TYPE(ASN1_TFLG_OPTIONAL, 0, stname, field, type)\n\n/* IMPLICIT tagged simple type */\n#define ASN1_IMP(stname, field, type, tag) ASN1_IMP_EX(stname, field, type, tag, 0)\n\n/* IMPLICIT tagged OPTIONAL simple type */\n#define ASN1_IMP_OPT(stname, field, type, tag) ASN1_IMP_EX(stname, field, type, tag, ASN1_TFLG_OPTIONAL)\n\n/* Same as above but EXPLICIT */\n\n#define ASN1_EXP(stname, field, type, tag) ASN1_EXP_EX(stname, field, type, tag, 0)\n#define ASN1_EXP_OPT(stname, field, type, tag) ASN1_EXP_EX(stname, field, type, tag, ASN1_TFLG_OPTIONAL)\n\n/* SEQUENCE OF type */\n#define ASN1_SEQUENCE_OF(stname, field, type) \\\n\t\tASN1_EX_TYPE(ASN1_TFLG_SEQUENCE_OF, 0, stname, field, type)\n\n/* OPTIONAL SEQUENCE OF */\n#define ASN1_SEQUENCE_OF_OPT(stname, field, type) \\\n\t\tASN1_EX_TYPE(ASN1_TFLG_SEQUENCE_OF|ASN1_TFLG_OPTIONAL, 0, stname, field, type)\n\n/* Same as above but for SET OF */\n\n#define ASN1_SET_OF(stname, field, type) \\\n\t\tASN1_EX_TYPE(ASN1_TFLG_SET_OF, 0, stname, field, type)\n\n#define ASN1_SET_OF_OPT(stname, field, type) \\\n\t\tASN1_EX_TYPE(ASN1_TFLG_SET_OF|ASN1_TFLG_OPTIONAL, 0, stname, field, type)\n\n/* Finally compound types of SEQUENCE, SET, IMPLICIT, EXPLICIT and OPTIONAL */\n\n#define ASN1_IMP_SET_OF(stname, field, type, tag) \\\n\t\t\tASN1_IMP_EX(stname, field, type, tag, ASN1_TFLG_SET_OF)\n\n#define ASN1_EXP_SET_OF(stname, field, type, tag) \\\n\t\t\tASN1_EXP_EX(stname, field, type, tag, ASN1_TFLG_SET_OF)\n\n#define ASN1_IMP_SET_OF_OPT(stname, field, type, tag) \\\n\t\t\tASN1_IMP_EX(stname, field, type, tag, ASN1_TFLG_SET_OF|ASN1_TFLG_OPTIONAL)\n\n#define ASN1_EXP_SET_OF_OPT(stname, field, type, tag) \\\n\t\t\tASN1_EXP_EX(stname, field, type, tag, ASN1_TFLG_SET_OF|ASN1_TFLG_OPTIONAL)\n\n#define ASN1_IMP_SEQUENCE_OF(stname, field, type, tag) \\\n\t\t\tASN1_IMP_EX(stname, field, type, tag, ASN1_TFLG_SEQUENCE_OF)\n\n#define ASN1_IMP_SEQUENCE_OF_OPT(stname, field, type, tag) \\\n\t\t\tASN1_IMP_EX(stname, field, type, tag, ASN1_TFLG_SEQUENCE_OF|ASN1_TFLG_OPTIONAL)\n\n#define ASN1_EXP_SEQUENCE_OF(stname, field, type, tag) \\\n\t\t\tASN1_EXP_EX(stname, field, type, tag, ASN1_TFLG_SEQUENCE_OF)\n\n#define ASN1_EXP_SEQUENCE_OF_OPT(stname, field, type, tag) \\\n\t\t\tASN1_EXP_EX(stname, field, type, tag, ASN1_TFLG_SEQUENCE_OF|ASN1_TFLG_OPTIONAL)\n\n/* EXPLICIT using indefinite length constructed form */\n#define ASN1_NDEF_EXP(stname, field, type, tag) \\\n\t\t\tASN1_EXP_EX(stname, field, type, tag, ASN1_TFLG_NDEF)\n\n/* EXPLICIT OPTIONAL using indefinite length constructed form */\n#define ASN1_NDEF_EXP_OPT(stname, field, type, tag) \\\n\t\t\tASN1_EXP_EX(stname, field, type, tag, ASN1_TFLG_OPTIONAL|ASN1_TFLG_NDEF)\n\n/* Macros for the ASN1_ADB structure */\n\n#define ASN1_ADB(name) \\\n\tstatic const ASN1_ADB_TABLE name##_adbtbl[] \n\n#ifndef OPENSSL_EXPORT_VAR_AS_FUNCTION\n\n#define ASN1_ADB_END(name, flags, field, app_table, def, none) \\\n\t;\\\n\tstatic const ASN1_ADB name##_adb = {\\\n\t\tflags,\\\n\t\toffsetof(name, field),\\\n\t\tapp_table,\\\n\t\tname##_adbtbl,\\\n\t\tsizeof(name##_adbtbl) / sizeof(ASN1_ADB_TABLE),\\\n\t\tdef,\\\n\t\tnone\\\n\t}\n\n#else\n\n#define ASN1_ADB_END(name, flags, field, app_table, def, none) \\\n\t;\\\n\tstatic const ASN1_ITEM *name##_adb(void) \\\n\t{ \\\n\tstatic const ASN1_ADB internal_adb = \\\n\t\t{\\\n\t\tflags,\\\n\t\toffsetof(name, field),\\\n\t\tapp_table,\\\n\t\tname##_adbtbl,\\\n\t\tsizeof(name##_adbtbl) / sizeof(ASN1_ADB_TABLE),\\\n\t\tdef,\\\n\t\tnone\\\n\t\t}; \\\n\t\treturn (const ASN1_ITEM *) &internal_adb; \\\n\t} \\\n\tvoid dummy_function(void)\n\n#endif\n\n#define ADB_ENTRY(val, template) {val, template}\n\n#define ASN1_ADB_TEMPLATE(name) \\\n\tstatic const ASN1_TEMPLATE name##_tt \n\n/* This is the ASN1 template structure that defines\n * a wrapper round the actual type. It determines the\n * actual position of the field in the value structure,\n * various flags such as OPTIONAL and the field name.\n */\n\nstruct ASN1_TEMPLATE_st {\nunsigned long flags;\t\t/* Various flags */\nlong tag;\t\t\t/* tag, not used if no tagging */\nunsigned long offset;\t\t/* Offset of this field in structure */\n#ifndef NO_ASN1_FIELD_NAMES\nconst char *field_name;\t\t/* Field name */\n#endif\nASN1_ITEM_EXP *item;\t\t/* Relevant ASN1_ITEM or ASN1_ADB */\n};\n\n/* Macro to extract ASN1_ITEM and ASN1_ADB pointer from ASN1_TEMPLATE */\n\n#define ASN1_TEMPLATE_item(t) (t->item_ptr)\n#define ASN1_TEMPLATE_adb(t) (t->item_ptr)\n\ntypedef struct ASN1_ADB_TABLE_st ASN1_ADB_TABLE;\ntypedef struct ASN1_ADB_st ASN1_ADB;\n\nstruct ASN1_ADB_st {\n\tunsigned long flags;\t/* Various flags */\n\tunsigned long offset;\t/* Offset of selector field */\n\tSTACK_OF(ASN1_ADB_TABLE) **app_items; /* Application defined items */\n\tconst ASN1_ADB_TABLE *tbl;\t/* Table of possible types */\n\tlong tblcount;\t\t/* Number of entries in tbl */\n\tconst ASN1_TEMPLATE *default_tt;  /* Type to use if no match */\n\tconst ASN1_TEMPLATE *null_tt;  /* Type to use if selector is NULL */\n};\n\nstruct ASN1_ADB_TABLE_st {\n\tlong value;\t\t/* NID for an object or value for an int */\n\tconst ASN1_TEMPLATE tt;\t\t/* item for this value */\n};\n\n/* template flags */\n\n/* Field is optional */\n#define ASN1_TFLG_OPTIONAL\t(0x1)\n\n/* Field is a SET OF */\n#define ASN1_TFLG_SET_OF\t(0x1 << 1)\n\n/* Field is a SEQUENCE OF */\n#define ASN1_TFLG_SEQUENCE_OF\t(0x2 << 1)\n\n/* Special case: this refers to a SET OF that\n * will be sorted into DER order when encoded *and*\n * the corresponding STACK will be modified to match\n * the new order.\n */\n#define ASN1_TFLG_SET_ORDER\t(0x3 << 1)\n\n/* Mask for SET OF or SEQUENCE OF */\n#define ASN1_TFLG_SK_MASK\t(0x3 << 1)\n\n/* These flags mean the tag should be taken from the\n * tag field. If EXPLICIT then the underlying type\n * is used for the inner tag.\n */\n\n/* IMPLICIT tagging */\n#define ASN1_TFLG_IMPTAG\t(0x1 << 3)\n\n\n/* EXPLICIT tagging, inner tag from underlying type */\n#define ASN1_TFLG_EXPTAG\t(0x2 << 3)\n\n#define ASN1_TFLG_TAG_MASK\t(0x3 << 3)\n\n/* context specific IMPLICIT */\n#define ASN1_TFLG_IMPLICIT\tASN1_TFLG_IMPTAG|ASN1_TFLG_CONTEXT\n\n/* context specific EXPLICIT */\n#define ASN1_TFLG_EXPLICIT\tASN1_TFLG_EXPTAG|ASN1_TFLG_CONTEXT\n\n/* If tagging is in force these determine the\n * type of tag to use. Otherwise the tag is\n * determined by the underlying type. These \n * values reflect the actual octet format.\n */\n\n/* Universal tag */ \n#define ASN1_TFLG_UNIVERSAL\t(0x0<<6)\n/* Application tag */ \n#define ASN1_TFLG_APPLICATION\t(0x1<<6)\n/* Context specific tag */ \n#define ASN1_TFLG_CONTEXT\t(0x2<<6)\n/* Private tag */ \n#define ASN1_TFLG_PRIVATE\t(0x3<<6)\n\n#define ASN1_TFLG_TAG_CLASS\t(0x3<<6)\n\n/* These are for ANY DEFINED BY type. In this case\n * the 'item' field points to an ASN1_ADB structure\n * which contains a table of values to decode the\n * relevant type\n */\n\n#define ASN1_TFLG_ADB_MASK\t(0x3<<8)\n\n#define ASN1_TFLG_ADB_OID\t(0x1<<8)\n\n#define ASN1_TFLG_ADB_INT\t(0x1<<9)\n\n/* This flag means a parent structure is passed\n * instead of the field: this is useful is a\n * SEQUENCE is being combined with a CHOICE for\n * example. Since this means the structure and\n * item name will differ we need to use the\n * ASN1_CHOICE_END_name() macro for example.\n */\n\n#define ASN1_TFLG_COMBINE\t(0x1<<10)\n\n/* This flag when present in a SEQUENCE OF, SET OF\n * or EXPLICIT causes indefinite length constructed\n * encoding to be used if required.\n */\n\n#define ASN1_TFLG_NDEF\t\t(0x1<<11)\n\n/* This is the actual ASN1 item itself */\n\nstruct ASN1_ITEM_st {\nchar itype;\t\t\t/* The item type, primitive, SEQUENCE, CHOICE or extern */\nlong utype;\t\t\t/* underlying type */\nconst ASN1_TEMPLATE *templates;\t/* If SEQUENCE or CHOICE this contains the contents */\nlong tcount;\t\t\t/* Number of templates if SEQUENCE or CHOICE */\nconst void *funcs;\t\t/* functions that handle this type */\nlong size;\t\t\t/* Structure size (usually)*/\n#ifndef NO_ASN1_FIELD_NAMES\nconst char *sname;\t\t/* Structure name */\n#endif\n};\n\n/* These are values for the itype field and\n * determine how the type is interpreted.\n *\n * For PRIMITIVE types the underlying type\n * determines the behaviour if items is NULL.\n *\n * Otherwise templates must contain a single \n * template and the type is treated in the\n * same way as the type specified in the template.\n *\n * For SEQUENCE types the templates field points\n * to the members, the size field is the\n * structure size.\n *\n * For CHOICE types the templates field points\n * to each possible member (typically a union)\n * and the 'size' field is the offset of the\n * selector.\n *\n * The 'funcs' field is used for application\n * specific functions. \n *\n * For COMPAT types the funcs field gives a\n * set of functions that handle this type, this\n * supports the old d2i, i2d convention.\n *\n * The EXTERN type uses a new style d2i/i2d.\n * The new style should be used where possible\n * because it avoids things like the d2i IMPLICIT\n * hack.\n *\n * MSTRING is a multiple string type, it is used\n * for a CHOICE of character strings where the\n * actual strings all occupy an ASN1_STRING\n * structure. In this case the 'utype' field\n * has a special meaning, it is used as a mask\n * of acceptable types using the B_ASN1 constants.\n *\n * NDEF_SEQUENCE is the same as SEQUENCE except\n * that it will use indefinite length constructed\n * encoding if requested.\n *\n */\n\n#define ASN1_ITYPE_PRIMITIVE\t\t0x0\n\n#define ASN1_ITYPE_SEQUENCE\t\t0x1\n\n#define ASN1_ITYPE_CHOICE\t\t0x2\n\n#define ASN1_ITYPE_COMPAT\t\t0x3\n\n#define ASN1_ITYPE_EXTERN\t\t0x4\n\n#define ASN1_ITYPE_MSTRING\t\t0x5\n\n#define ASN1_ITYPE_NDEF_SEQUENCE\t0x6\n\n/* Cache for ASN1 tag and length, so we\n * don't keep re-reading it for things\n * like CHOICE\n */\n\nstruct ASN1_TLC_st{\n\tchar valid;\t/* Values below are valid */\n\tint ret;\t/* return value */\n\tlong plen;\t/* length */\n\tint ptag;\t/* class value */\n\tint pclass;\t/* class value */\n\tint hdrlen;\t/* header length */\n};\n\n/* Typedefs for ASN1 function pointers */\n\ntypedef ASN1_VALUE * ASN1_new_func(void);\ntypedef void ASN1_free_func(ASN1_VALUE *a);\ntypedef ASN1_VALUE * ASN1_d2i_func(ASN1_VALUE **a, const unsigned char ** in, long length);\ntypedef int ASN1_i2d_func(ASN1_VALUE * a, unsigned char **in);\n\ntypedef int ASN1_ex_d2i(ASN1_VALUE **pval, const unsigned char **in, long len, const ASN1_ITEM *it,\n\t\t\t\t\tint tag, int aclass, char opt, ASN1_TLC *ctx);\n\ntypedef int ASN1_ex_i2d(ASN1_VALUE **pval, unsigned char **out, const ASN1_ITEM *it, int tag, int aclass);\ntypedef int ASN1_ex_new_func(ASN1_VALUE **pval, const ASN1_ITEM *it);\ntypedef void ASN1_ex_free_func(ASN1_VALUE **pval, const ASN1_ITEM *it);\n\ntypedef int ASN1_primitive_i2c(ASN1_VALUE **pval, unsigned char *cont, int *putype, const ASN1_ITEM *it);\ntypedef int ASN1_primitive_c2i(ASN1_VALUE **pval, const unsigned char *cont, int len, int utype, char *free_cont, const ASN1_ITEM *it);\n\ntypedef struct ASN1_COMPAT_FUNCS_st {\n\tASN1_new_func *asn1_new;\n\tASN1_free_func *asn1_free;\n\tASN1_d2i_func *asn1_d2i;\n\tASN1_i2d_func *asn1_i2d;\n} ASN1_COMPAT_FUNCS;\n\ntypedef struct ASN1_EXTERN_FUNCS_st {\n\tvoid *app_data;\n\tASN1_ex_new_func *asn1_ex_new;\n\tASN1_ex_free_func *asn1_ex_free;\n\tASN1_ex_free_func *asn1_ex_clear;\n\tASN1_ex_d2i *asn1_ex_d2i;\n\tASN1_ex_i2d *asn1_ex_i2d;\n} ASN1_EXTERN_FUNCS;\n\ntypedef struct ASN1_PRIMITIVE_FUNCS_st {\n\tvoid *app_data;\n\tunsigned long flags;\n\tASN1_ex_new_func *prim_new;\n\tASN1_ex_free_func *prim_free;\n\tASN1_ex_free_func *prim_clear;\n\tASN1_primitive_c2i *prim_c2i;\n\tASN1_primitive_i2c *prim_i2c;\n} ASN1_PRIMITIVE_FUNCS;\n\n/* This is the ASN1_AUX structure: it handles various\n * miscellaneous requirements. For example the use of\n * reference counts and an informational callback.\n *\n * The \"informational callback\" is called at various\n * points during the ASN1 encoding and decoding. It can\n * be used to provide minor customisation of the structures\n * used. This is most useful where the supplied routines\n * *almost* do the right thing but need some extra help\n * at a few points. If the callback returns zero then\n * it is assumed a fatal error has occurred and the \n * main operation should be abandoned.\n *\n * If major changes in the default behaviour are required\n * then an external type is more appropriate.\n */\n\ntypedef int ASN1_aux_cb(int operation, ASN1_VALUE **in, const ASN1_ITEM *it);\n\ntypedef struct ASN1_AUX_st {\n\tvoid *app_data;\n\tint flags;\n\tint ref_offset;\t\t/* Offset of reference value */\n\tint ref_lock;\t\t/* Lock type to use */\n\tASN1_aux_cb *asn1_cb;\n\tint enc_offset;\t\t/* Offset of ASN1_ENCODING structure */\n} ASN1_AUX;\n\n/* Flags in ASN1_AUX */\n\n/* Use a reference count */\n#define ASN1_AFLG_REFCOUNT\t1\n/* Save the encoding of structure (useful for signatures) */\n#define ASN1_AFLG_ENCODING\t2\n/* The Sequence length is invalid */\n#define ASN1_AFLG_BROKEN\t4\n\n/* operation values for asn1_cb */\n\n#define ASN1_OP_NEW_PRE\t\t0\n#define ASN1_OP_NEW_POST\t1\n#define ASN1_OP_FREE_PRE\t2\n#define ASN1_OP_FREE_POST\t3\n#define ASN1_OP_D2I_PRE\t\t4\n#define ASN1_OP_D2I_POST\t5\n#define ASN1_OP_I2D_PRE\t\t6\n#define ASN1_OP_I2D_POST\t7\n\n/* Macro to implement a primitive type */\n#define IMPLEMENT_ASN1_TYPE(stname) IMPLEMENT_ASN1_TYPE_ex(stname, stname, 0)\n#define IMPLEMENT_ASN1_TYPE_ex(itname, vname, ex) \\\n\t\t\t\tASN1_ITEM_start(itname) \\\n\t\t\t\t\tASN1_ITYPE_PRIMITIVE, V_##vname, NULL, 0, NULL, ex, #itname \\\n\t\t\t\tASN1_ITEM_end(itname)\n\n/* Macro to implement a multi string type */\n#define IMPLEMENT_ASN1_MSTRING(itname, mask) \\\n\t\t\t\tASN1_ITEM_start(itname) \\\n\t\t\t\t\tASN1_ITYPE_MSTRING, mask, NULL, 0, NULL, sizeof(ASN1_STRING), #itname \\\n\t\t\t\tASN1_ITEM_end(itname)\n\n/* Macro to implement an ASN1_ITEM in terms of old style funcs */\n\n#define IMPLEMENT_COMPAT_ASN1(sname) IMPLEMENT_COMPAT_ASN1_type(sname, V_ASN1_SEQUENCE)\n\n#define IMPLEMENT_COMPAT_ASN1_type(sname, tag) \\\n\tstatic const ASN1_COMPAT_FUNCS sname##_ff = { \\\n\t\t(ASN1_new_func *)sname##_new, \\\n\t\t(ASN1_free_func *)sname##_free, \\\n\t\t(ASN1_d2i_func *)d2i_##sname, \\\n\t\t(ASN1_i2d_func *)i2d_##sname, \\\n\t}; \\\n\tASN1_ITEM_start(sname) \\\n\t\tASN1_ITYPE_COMPAT, \\\n\t\ttag, \\\n\t\tNULL, \\\n\t\t0, \\\n\t\t&sname##_ff, \\\n\t\t0, \\\n\t\t#sname \\\n\tASN1_ITEM_end(sname)\n\n#define IMPLEMENT_EXTERN_ASN1(sname, tag, fptrs) \\\n\tASN1_ITEM_start(sname) \\\n\t\tASN1_ITYPE_EXTERN, \\\n\t\ttag, \\\n\t\tNULL, \\\n\t\t0, \\\n\t\t&fptrs, \\\n\t\t0, \\\n\t\t#sname \\\n\tASN1_ITEM_end(sname)\n\n/* Macro to implement standard functions in terms of ASN1_ITEM structures */\n\n#define IMPLEMENT_ASN1_FUNCTIONS(stname) IMPLEMENT_ASN1_FUNCTIONS_fname(stname, stname, stname)\n\n#define IMPLEMENT_ASN1_FUNCTIONS_name(stname, itname) IMPLEMENT_ASN1_FUNCTIONS_fname(stname, itname, itname)\n\n#define IMPLEMENT_ASN1_FUNCTIONS_ENCODE_name(stname, itname) \\\n\t\t\tIMPLEMENT_ASN1_FUNCTIONS_ENCODE_fname(stname, itname, itname)\n\n#define IMPLEMENT_ASN1_ALLOC_FUNCTIONS(stname) \\\n\t\tIMPLEMENT_ASN1_ALLOC_FUNCTIONS_fname(stname, stname, stname)\n\n#define IMPLEMENT_ASN1_ALLOC_FUNCTIONS_fname(stname, itname, fname) \\\n\tstname *fname##_new(void) \\\n\t{ \\\n\t\treturn (stname *)ASN1_item_new(ASN1_ITEM_rptr(itname)); \\\n\t} \\\n\tvoid fname##_free(stname *a) \\\n\t{ \\\n\t\tASN1_item_free((ASN1_VALUE *)a, ASN1_ITEM_rptr(itname)); \\\n\t}\n\n#define IMPLEMENT_ASN1_FUNCTIONS_fname(stname, itname, fname) \\\n\tIMPLEMENT_ASN1_ENCODE_FUNCTIONS_fname(stname, itname, fname) \\\n\tIMPLEMENT_ASN1_ALLOC_FUNCTIONS_fname(stname, itname, fname)\n\n#define IMPLEMENT_ASN1_ENCODE_FUNCTIONS_fname(stname, itname, fname) \\\n\tstname *d2i_##fname(stname **a, const unsigned char **in, long len) \\\n\t{ \\\n\t\treturn (stname *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, ASN1_ITEM_rptr(itname));\\\n\t} \\\n\tint i2d_##fname(stname *a, unsigned char **out) \\\n\t{ \\\n\t\treturn ASN1_item_i2d((ASN1_VALUE *)a, out, ASN1_ITEM_rptr(itname));\\\n\t} \n\n#define IMPLEMENT_ASN1_NDEF_FUNCTION(stname) \\\n\tint i2d_##stname##_NDEF(stname *a, unsigned char **out) \\\n\t{ \\\n\t\treturn ASN1_item_ndef_i2d((ASN1_VALUE *)a, out, ASN1_ITEM_rptr(stname));\\\n\t} \n\n/* This includes evil casts to remove const: they will go away when full\n * ASN1 constification is done.\n */\n#define IMPLEMENT_ASN1_ENCODE_FUNCTIONS_const_fname(stname, itname, fname) \\\n\tstname *d2i_##fname(stname **a, const unsigned char **in, long len) \\\n\t{ \\\n\t\treturn (stname *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, ASN1_ITEM_rptr(itname));\\\n\t} \\\n\tint i2d_##fname(const stname *a, unsigned char **out) \\\n\t{ \\\n\t\treturn ASN1_item_i2d((ASN1_VALUE *)a, out, ASN1_ITEM_rptr(itname));\\\n\t} \n\n#define IMPLEMENT_ASN1_DUP_FUNCTION(stname) \\\n\tstname * stname##_dup(stname *x) \\\n        { \\\n        return ASN1_item_dup(ASN1_ITEM_rptr(stname), x); \\\n        }\n\n#define IMPLEMENT_ASN1_FUNCTIONS_const(name) \\\n\t\tIMPLEMENT_ASN1_FUNCTIONS_const_fname(name, name, name)\n\n#define IMPLEMENT_ASN1_FUNCTIONS_const_fname(stname, itname, fname) \\\n\tIMPLEMENT_ASN1_ENCODE_FUNCTIONS_const_fname(stname, itname, fname) \\\n\tIMPLEMENT_ASN1_ALLOC_FUNCTIONS_fname(stname, itname, fname)\n\n/* external definitions for primitive types */\n\nDECLARE_ASN1_ITEM(ASN1_BOOLEAN)\nDECLARE_ASN1_ITEM(ASN1_TBOOLEAN)\nDECLARE_ASN1_ITEM(ASN1_FBOOLEAN)\nDECLARE_ASN1_ITEM(ASN1_SEQUENCE)\nDECLARE_ASN1_ITEM(CBIGNUM)\nDECLARE_ASN1_ITEM(BIGNUM)\nDECLARE_ASN1_ITEM(LONG)\nDECLARE_ASN1_ITEM(ZLONG)\n\nDECLARE_STACK_OF(ASN1_VALUE)\n\n/* Functions used internally by the ASN1 code */\n\nint ASN1_item_ex_new(ASN1_VALUE **pval, const ASN1_ITEM *it);\nvoid ASN1_item_ex_free(ASN1_VALUE **pval, const ASN1_ITEM *it);\nint ASN1_template_new(ASN1_VALUE **pval, const ASN1_TEMPLATE *tt);\nint ASN1_primitive_new(ASN1_VALUE **pval, const ASN1_ITEM *it);\n\nvoid ASN1_template_free(ASN1_VALUE **pval, const ASN1_TEMPLATE *tt);\nint ASN1_template_d2i(ASN1_VALUE **pval, const unsigned char **in, long len, const ASN1_TEMPLATE *tt);\nint ASN1_item_ex_d2i(ASN1_VALUE **pval, const unsigned char **in, long len, const ASN1_ITEM *it,\n\t\t\t\tint tag, int aclass, char opt, ASN1_TLC *ctx);\n\nint ASN1_item_ex_i2d(ASN1_VALUE **pval, unsigned char **out, const ASN1_ITEM *it, int tag, int aclass);\nint ASN1_template_i2d(ASN1_VALUE **pval, unsigned char **out, const ASN1_TEMPLATE *tt);\nvoid ASN1_primitive_free(ASN1_VALUE **pval, const ASN1_ITEM *it);\n\nint asn1_ex_i2c(ASN1_VALUE **pval, unsigned char *cont, int *putype, const ASN1_ITEM *it);\nint asn1_ex_c2i(ASN1_VALUE **pval, const unsigned char *cont, int len, int utype, char *free_cont, const ASN1_ITEM *it);\n\nint asn1_get_choice_selector(ASN1_VALUE **pval, const ASN1_ITEM *it);\nint asn1_set_choice_selector(ASN1_VALUE **pval, int value, const ASN1_ITEM *it);\n\nASN1_VALUE ** asn1_get_field_ptr(ASN1_VALUE **pval, const ASN1_TEMPLATE *tt);\n\nconst ASN1_TEMPLATE *asn1_do_adb(ASN1_VALUE **pval, const ASN1_TEMPLATE *tt, int nullerr);\n\nint asn1_do_lock(ASN1_VALUE **pval, int op, const ASN1_ITEM *it);\n\nvoid asn1_enc_init(ASN1_VALUE **pval, const ASN1_ITEM *it);\nvoid asn1_enc_free(ASN1_VALUE **pval, const ASN1_ITEM *it);\nint asn1_enc_restore(int *len, unsigned char **out, ASN1_VALUE **pval, const ASN1_ITEM *it);\nint asn1_enc_save(ASN1_VALUE **pval, const unsigned char *in, int inlen, const ASN1_ITEM *it);\n\n#ifdef  __cplusplus\n}\n#endif\n#endif\n"
  },
  {
    "path": "freebsd-headers/openssl/bio.h",
    "content": "/* crypto/bio/bio.h */\n/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)\n * All rights reserved.\n *\n * This package is an SSL implementation written\n * by Eric Young (eay@cryptsoft.com).\n * The implementation was written so as to conform with Netscapes SSL.\n * \n * This library is free for commercial and non-commercial use as long as\n * the following conditions are aheared to.  The following conditions\n * apply to all code found in this distribution, be it the RC4, RSA,\n * lhash, DES, etc., code; not just the SSL code.  The SSL documentation\n * included with this distribution is covered by the same copyright terms\n * except that the holder is Tim Hudson (tjh@cryptsoft.com).\n * \n * Copyright remains Eric Young's, and as such any Copyright notices in\n * the code are not to be removed.\n * If this package is used in a product, Eric Young should be given attribution\n * as the author of the parts of the library used.\n * This can be in the form of a textual message at program startup or\n * in documentation (online or textual) provided with the package.\n * \n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. All advertising materials mentioning features or use of this software\n *    must display the following acknowledgement:\n *    \"This product includes cryptographic software written by\n *     Eric Young (eay@cryptsoft.com)\"\n *    The word 'cryptographic' can be left out if the rouines from the library\n *    being used are not cryptographic related :-).\n * 4. If you include any Windows specific code (or a derivative thereof) from \n *    the apps directory (application code) you must include an acknowledgement:\n *    \"This product includes software written by Tim Hudson (tjh@cryptsoft.com)\"\n * \n * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n * \n * The licence and distribution terms for any publically available version or\n * derivative of this code cannot be changed.  i.e. this code cannot simply be\n * copied and put under another distribution licence\n * [including the GNU Public Licence.]\n */\n\n#ifndef HEADER_BIO_H\n#define HEADER_BIO_H\n\n#include <openssl/e_os2.h>\n\n#ifndef OPENSSL_NO_FP_API\n# include <stdio.h>\n#endif\n#include <stdarg.h>\n\n#include <openssl/crypto.h>\n\n#ifdef  __cplusplus\nextern \"C\" {\n#endif\n\n/* These are the 'types' of BIOs */\n#define BIO_TYPE_NONE\t\t0\n#define BIO_TYPE_MEM\t\t(1|0x0400)\n#define BIO_TYPE_FILE\t\t(2|0x0400)\n\n#define BIO_TYPE_FD\t\t(4|0x0400|0x0100)\n#define BIO_TYPE_SOCKET\t\t(5|0x0400|0x0100)\n#define BIO_TYPE_NULL\t\t(6|0x0400)\n#define BIO_TYPE_SSL\t\t(7|0x0200)\n#define BIO_TYPE_MD\t\t(8|0x0200)\t\t/* passive filter */\n#define BIO_TYPE_BUFFER\t\t(9|0x0200)\t\t/* filter */\n#define BIO_TYPE_CIPHER\t\t(10|0x0200)\t\t/* filter */\n#define BIO_TYPE_BASE64\t\t(11|0x0200)\t\t/* filter */\n#define BIO_TYPE_CONNECT\t(12|0x0400|0x0100)\t/* socket - connect */\n#define BIO_TYPE_ACCEPT\t\t(13|0x0400|0x0100)\t/* socket for accept */\n#define BIO_TYPE_PROXY_CLIENT\t(14|0x0200)\t\t/* client proxy BIO */\n#define BIO_TYPE_PROXY_SERVER\t(15|0x0200)\t\t/* server proxy BIO */\n#define BIO_TYPE_NBIO_TEST\t(16|0x0200)\t\t/* server proxy BIO */\n#define BIO_TYPE_NULL_FILTER\t(17|0x0200)\n#define BIO_TYPE_BER\t\t(18|0x0200)\t\t/* BER -> bin filter */\n#define BIO_TYPE_BIO\t\t(19|0x0400)\t\t/* (half a) BIO pair */\n#define BIO_TYPE_LINEBUFFER\t(20|0x0200)\t\t/* filter */\n#define BIO_TYPE_DGRAM\t\t(21|0x0400|0x0100)\n#define BIO_TYPE_COMP \t\t(23|0x0200)\t\t/* filter */\n\n#define BIO_TYPE_DESCRIPTOR\t0x0100\t/* socket, fd, connect or accept */\n#define BIO_TYPE_FILTER\t\t0x0200\n#define BIO_TYPE_SOURCE_SINK\t0x0400\n\n/* BIO_FILENAME_READ|BIO_CLOSE to open or close on free.\n * BIO_set_fp(in,stdin,BIO_NOCLOSE); */\n#define BIO_NOCLOSE\t\t0x00\n#define BIO_CLOSE\t\t0x01\n\n/* These are used in the following macros and are passed to\n * BIO_ctrl() */\n#define BIO_CTRL_RESET\t\t1  /* opt - rewind/zero etc */\n#define BIO_CTRL_EOF\t\t2  /* opt - are we at the eof */\n#define BIO_CTRL_INFO\t\t3  /* opt - extra tit-bits */\n#define BIO_CTRL_SET\t\t4  /* man - set the 'IO' type */\n#define BIO_CTRL_GET\t\t5  /* man - get the 'IO' type */\n#define BIO_CTRL_PUSH\t\t6  /* opt - internal, used to signify change */\n#define BIO_CTRL_POP\t\t7  /* opt - internal, used to signify change */\n#define BIO_CTRL_GET_CLOSE\t8  /* man - set the 'close' on free */\n#define BIO_CTRL_SET_CLOSE\t9  /* man - set the 'close' on free */\n#define BIO_CTRL_PENDING\t10  /* opt - is their more data buffered */\n#define BIO_CTRL_FLUSH\t\t11  /* opt - 'flush' buffered output */\n#define BIO_CTRL_DUP\t\t12  /* man - extra stuff for 'duped' BIO */\n#define BIO_CTRL_WPENDING\t13  /* opt - number of bytes still to write */\n/* callback is int cb(BIO *bio,state,ret); */\n#define BIO_CTRL_SET_CALLBACK\t14  /* opt - set callback function */\n#define BIO_CTRL_GET_CALLBACK\t15  /* opt - set callback function */\n\n#define BIO_CTRL_SET_FILENAME\t30\t/* BIO_s_file special */\n\n/* dgram BIO stuff */\n#define BIO_CTRL_DGRAM_CONNECT       31  /* BIO dgram special */\n#define BIO_CTRL_DGRAM_SET_CONNECTED 32  /* allow for an externally\n\t\t\t\t\t  * connected socket to be\n\t\t\t\t\t  * passed in */ \n#define BIO_CTRL_DGRAM_SET_RECV_TIMEOUT 33 /* setsockopt, essentially */\n#define BIO_CTRL_DGRAM_GET_RECV_TIMEOUT 34 /* getsockopt, essentially */\n#define BIO_CTRL_DGRAM_SET_SEND_TIMEOUT 35 /* setsockopt, essentially */\n#define BIO_CTRL_DGRAM_GET_SEND_TIMEOUT 36 /* getsockopt, essentially */\n\n#define BIO_CTRL_DGRAM_GET_RECV_TIMER_EXP 37 /* flag whether the last */\n#define BIO_CTRL_DGRAM_GET_SEND_TIMER_EXP 38 /* I/O operation tiemd out */\n\t\t\t\t\t\n/* #ifdef IP_MTU_DISCOVER */\n#define BIO_CTRL_DGRAM_MTU_DISCOVER       39 /* set DF bit on egress packets */\n/* #endif */\n\n#define BIO_CTRL_DGRAM_QUERY_MTU          40 /* as kernel for current MTU */\n#define BIO_CTRL_DGRAM_GET_MTU            41 /* get cached value for MTU */\n#define BIO_CTRL_DGRAM_SET_MTU            42 /* set cached value for\n\t\t\t\t\t      * MTU. want to use this\n\t\t\t\t\t      * if asking the kernel\n\t\t\t\t\t      * fails */\n\n#define BIO_CTRL_DGRAM_MTU_EXCEEDED       43 /* check whether the MTU\n\t\t\t\t\t      * was exceed in the\n\t\t\t\t\t      * previous write\n\t\t\t\t\t      * operation */\n\n#define BIO_CTRL_DGRAM_GET_PEER           46\n#define BIO_CTRL_DGRAM_SET_PEER           44 /* Destination for the data */\n\n#define BIO_CTRL_DGRAM_SET_NEXT_TIMEOUT   45 /* Next DTLS handshake timeout to\n\t\t\t\t\t\t\t\t\t\t\t  * adjust socket timeouts */\n\n/* modifiers */\n#define BIO_FP_READ\t\t0x02\n#define BIO_FP_WRITE\t\t0x04\n#define BIO_FP_APPEND\t\t0x08\n#define BIO_FP_TEXT\t\t0x10\n\n#define BIO_FLAGS_READ\t\t0x01\n#define BIO_FLAGS_WRITE\t\t0x02\n#define BIO_FLAGS_IO_SPECIAL\t0x04\n#define BIO_FLAGS_RWS (BIO_FLAGS_READ|BIO_FLAGS_WRITE|BIO_FLAGS_IO_SPECIAL)\n#define BIO_FLAGS_SHOULD_RETRY\t0x08\n#ifndef\tBIO_FLAGS_UPLINK\n/* \"UPLINK\" flag denotes file descriptors provided by application.\n   It defaults to 0, as most platforms don't require UPLINK interface. */\n#define\tBIO_FLAGS_UPLINK\t0\n#endif\n\n/* Used in BIO_gethostbyname() */\n#define BIO_GHBN_CTRL_HITS\t\t1\n#define BIO_GHBN_CTRL_MISSES\t\t2\n#define BIO_GHBN_CTRL_CACHE_SIZE\t3\n#define BIO_GHBN_CTRL_GET_ENTRY\t\t4\n#define BIO_GHBN_CTRL_FLUSH\t\t5\n\n/* Mostly used in the SSL BIO */\n/* Not used anymore\n * #define BIO_FLAGS_PROTOCOL_DELAYED_READ 0x10\n * #define BIO_FLAGS_PROTOCOL_DELAYED_WRITE 0x20\n * #define BIO_FLAGS_PROTOCOL_STARTUP\t0x40\n */\n\n#define BIO_FLAGS_BASE64_NO_NL\t0x100\n\n/* This is used with memory BIOs: it means we shouldn't free up or change the\n * data in any way.\n */\n#define BIO_FLAGS_MEM_RDONLY\t0x200\n\ntypedef struct bio_st BIO;\n\nvoid BIO_set_flags(BIO *b, int flags);\nint  BIO_test_flags(const BIO *b, int flags);\nvoid BIO_clear_flags(BIO *b, int flags);\n\n#define BIO_get_flags(b) BIO_test_flags(b, ~(0x0))\n#define BIO_set_retry_special(b) \\\n\t\tBIO_set_flags(b, (BIO_FLAGS_IO_SPECIAL|BIO_FLAGS_SHOULD_RETRY))\n#define BIO_set_retry_read(b) \\\n\t\tBIO_set_flags(b, (BIO_FLAGS_READ|BIO_FLAGS_SHOULD_RETRY))\n#define BIO_set_retry_write(b) \\\n\t\tBIO_set_flags(b, (BIO_FLAGS_WRITE|BIO_FLAGS_SHOULD_RETRY))\n\n/* These are normally used internally in BIOs */\n#define BIO_clear_retry_flags(b) \\\n\t\tBIO_clear_flags(b, (BIO_FLAGS_RWS|BIO_FLAGS_SHOULD_RETRY))\n#define BIO_get_retry_flags(b) \\\n\t\tBIO_test_flags(b, (BIO_FLAGS_RWS|BIO_FLAGS_SHOULD_RETRY))\n\n/* These should be used by the application to tell why we should retry */\n#define BIO_should_read(a)\t\tBIO_test_flags(a, BIO_FLAGS_READ)\n#define BIO_should_write(a)\t\tBIO_test_flags(a, BIO_FLAGS_WRITE)\n#define BIO_should_io_special(a)\tBIO_test_flags(a, BIO_FLAGS_IO_SPECIAL)\n#define BIO_retry_type(a)\t\tBIO_test_flags(a, BIO_FLAGS_RWS)\n#define BIO_should_retry(a)\t\tBIO_test_flags(a, BIO_FLAGS_SHOULD_RETRY)\n\n/* The next three are used in conjunction with the\n * BIO_should_io_special() condition.  After this returns true,\n * BIO *BIO_get_retry_BIO(BIO *bio, int *reason); will walk the BIO \n * stack and return the 'reason' for the special and the offending BIO.\n * Given a BIO, BIO_get_retry_reason(bio) will return the code. */\n/* Returned from the SSL bio when the certificate retrieval code had an error */\n#define BIO_RR_SSL_X509_LOOKUP\t\t0x01\n/* Returned from the connect BIO when a connect would have blocked */\n#define BIO_RR_CONNECT\t\t\t0x02\n/* Returned from the accept BIO when an accept would have blocked */\n#define BIO_RR_ACCEPT\t\t\t0x03\n\n/* These are passed by the BIO callback */\n#define BIO_CB_FREE\t0x01\n#define BIO_CB_READ\t0x02\n#define BIO_CB_WRITE\t0x03\n#define BIO_CB_PUTS\t0x04\n#define BIO_CB_GETS\t0x05\n#define BIO_CB_CTRL\t0x06\n\n/* The callback is called before and after the underling operation,\n * The BIO_CB_RETURN flag indicates if it is after the call */\n#define BIO_CB_RETURN\t0x80\n#define BIO_CB_return(a) ((a)|BIO_CB_RETURN))\n#define BIO_cb_pre(a)\t(!((a)&BIO_CB_RETURN))\n#define BIO_cb_post(a)\t((a)&BIO_CB_RETURN)\n\nlong (*BIO_get_callback(const BIO *b)) (struct bio_st *,int,const char *,int, long,long);\nvoid BIO_set_callback(BIO *b, \n\tlong (*callback)(struct bio_st *,int,const char *,int, long,long));\nchar *BIO_get_callback_arg(const BIO *b);\nvoid BIO_set_callback_arg(BIO *b, char *arg);\n\nconst char * BIO_method_name(const BIO *b);\nint BIO_method_type(const BIO *b);\n\ntypedef void bio_info_cb(struct bio_st *, int, const char *, int, long, long);\n\n#ifndef OPENSSL_SYS_WIN16\ntypedef struct bio_method_st\n\t{\n\tint type;\n\tconst char *name;\n\tint (*bwrite)(BIO *, const char *, int);\n\tint (*bread)(BIO *, char *, int);\n\tint (*bputs)(BIO *, const char *);\n\tint (*bgets)(BIO *, char *, int);\n\tlong (*ctrl)(BIO *, int, long, void *);\n\tint (*create)(BIO *);\n\tint (*destroy)(BIO *);\n        long (*callback_ctrl)(BIO *, int, bio_info_cb *);\n\t} BIO_METHOD;\n#else\ntypedef struct bio_method_st\n\t{\n\tint type;\n\tconst char *name;\n\tint (_far *bwrite)();\n\tint (_far *bread)();\n\tint (_far *bputs)();\n\tint (_far *bgets)();\n\tlong (_far *ctrl)();\n\tint (_far *create)();\n\tint (_far *destroy)();\n\tlong (_far *callback_ctrl)();\n\t} BIO_METHOD;\n#endif\n\nstruct bio_st\n\t{\n\tBIO_METHOD *method;\n\t/* bio, mode, argp, argi, argl, ret */\n\tlong (*callback)(struct bio_st *,int,const char *,int, long,long);\n\tchar *cb_arg; /* first argument for the callback */\n\n\tint init;\n\tint shutdown;\n\tint flags;\t/* extra storage */\n\tint retry_reason;\n\tint num;\n\tvoid *ptr;\n\tstruct bio_st *next_bio;\t/* used by filter BIOs */\n\tstruct bio_st *prev_bio;\t/* used by filter BIOs */\n\tint references;\n\tunsigned long num_read;\n\tunsigned long num_write;\n\n\tCRYPTO_EX_DATA ex_data;\n\t};\n\nDECLARE_STACK_OF(BIO)\n\ntypedef struct bio_f_buffer_ctx_struct\n\t{\n\t/* BIO *bio; */ /* this is now in the BIO struct */\n\tint ibuf_size;\t/* how big is the input buffer */\n\tint obuf_size;\t/* how big is the output buffer */\n\n\tchar *ibuf;\t\t/* the char array */\n\tint ibuf_len;\t\t/* how many bytes are in it */\n\tint ibuf_off;\t\t/* write/read offset */\n\n\tchar *obuf;\t\t/* the char array */\n\tint obuf_len;\t\t/* how many bytes are in it */\n\tint obuf_off;\t\t/* write/read offset */\n\t} BIO_F_BUFFER_CTX;\n\n/* connect BIO stuff */\n#define BIO_CONN_S_BEFORE\t\t1\n#define BIO_CONN_S_GET_IP\t\t2\n#define BIO_CONN_S_GET_PORT\t\t3\n#define BIO_CONN_S_CREATE_SOCKET\t4\n#define BIO_CONN_S_CONNECT\t\t5\n#define BIO_CONN_S_OK\t\t\t6\n#define BIO_CONN_S_BLOCKED_CONNECT\t7\n#define BIO_CONN_S_NBIO\t\t\t8\n/*#define BIO_CONN_get_param_hostname\tBIO_ctrl */\n\n#define BIO_C_SET_CONNECT\t\t\t100\n#define BIO_C_DO_STATE_MACHINE\t\t\t101\n#define BIO_C_SET_NBIO\t\t\t\t102\n#define BIO_C_SET_PROXY_PARAM\t\t\t103\n#define BIO_C_SET_FD\t\t\t\t104\n#define BIO_C_GET_FD\t\t\t\t105\n#define BIO_C_SET_FILE_PTR\t\t\t106\n#define BIO_C_GET_FILE_PTR\t\t\t107\n#define BIO_C_SET_FILENAME\t\t\t108\n#define BIO_C_SET_SSL\t\t\t\t109\n#define BIO_C_GET_SSL\t\t\t\t110\n#define BIO_C_SET_MD\t\t\t\t111\n#define BIO_C_GET_MD\t\t\t\t112\n#define BIO_C_GET_CIPHER_STATUS\t\t\t113\n#define BIO_C_SET_BUF_MEM\t\t\t114\n#define BIO_C_GET_BUF_MEM_PTR\t\t\t115\n#define BIO_C_GET_BUFF_NUM_LINES\t\t116\n#define BIO_C_SET_BUFF_SIZE\t\t\t117\n#define BIO_C_SET_ACCEPT\t\t\t118\n#define BIO_C_SSL_MODE\t\t\t\t119\n#define BIO_C_GET_MD_CTX\t\t\t120\n#define BIO_C_GET_PROXY_PARAM\t\t\t121\n#define BIO_C_SET_BUFF_READ_DATA\t\t122 /* data to read first */\n#define BIO_C_GET_CONNECT\t\t\t123\n#define BIO_C_GET_ACCEPT\t\t\t124\n#define BIO_C_SET_SSL_RENEGOTIATE_BYTES\t\t125\n#define BIO_C_GET_SSL_NUM_RENEGOTIATES\t\t126\n#define BIO_C_SET_SSL_RENEGOTIATE_TIMEOUT\t127\n#define BIO_C_FILE_SEEK\t\t\t\t128\n#define BIO_C_GET_CIPHER_CTX\t\t\t129\n#define BIO_C_SET_BUF_MEM_EOF_RETURN\t\t130/*return end of input value*/\n#define BIO_C_SET_BIND_MODE\t\t\t131\n#define BIO_C_GET_BIND_MODE\t\t\t132\n#define BIO_C_FILE_TELL\t\t\t\t133\n#define BIO_C_GET_SOCKS\t\t\t\t134\n#define BIO_C_SET_SOCKS\t\t\t\t135\n\n#define BIO_C_SET_WRITE_BUF_SIZE\t\t136/* for BIO_s_bio */\n#define BIO_C_GET_WRITE_BUF_SIZE\t\t137\n#define BIO_C_MAKE_BIO_PAIR\t\t\t138\n#define BIO_C_DESTROY_BIO_PAIR\t\t\t139\n#define BIO_C_GET_WRITE_GUARANTEE\t\t140\n#define BIO_C_GET_READ_REQUEST\t\t\t141\n#define BIO_C_SHUTDOWN_WR\t\t\t142\n#define BIO_C_NREAD0\t\t\t\t143\n#define BIO_C_NREAD\t\t\t\t144\n#define BIO_C_NWRITE0\t\t\t\t145\n#define BIO_C_NWRITE\t\t\t\t146\n#define BIO_C_RESET_READ_REQUEST\t\t147\n#define BIO_C_SET_MD_CTX\t\t\t148\n\n\n#define BIO_set_app_data(s,arg)\t\tBIO_set_ex_data(s,0,arg)\n#define BIO_get_app_data(s)\t\tBIO_get_ex_data(s,0)\n\n/* BIO_s_connect() and BIO_s_socks4a_connect() */\n#define BIO_set_conn_hostname(b,name) BIO_ctrl(b,BIO_C_SET_CONNECT,0,(char *)name)\n#define BIO_set_conn_port(b,port) BIO_ctrl(b,BIO_C_SET_CONNECT,1,(char *)port)\n#define BIO_set_conn_ip(b,ip)\t  BIO_ctrl(b,BIO_C_SET_CONNECT,2,(char *)ip)\n#define BIO_set_conn_int_port(b,port) BIO_ctrl(b,BIO_C_SET_CONNECT,3,(char *)port)\n#define BIO_get_conn_hostname(b)  BIO_ptr_ctrl(b,BIO_C_GET_CONNECT,0)\n#define BIO_get_conn_port(b)      BIO_ptr_ctrl(b,BIO_C_GET_CONNECT,1)\n#define BIO_get_conn_ip(b) \t\t BIO_ptr_ctrl(b,BIO_C_GET_CONNECT,2)\n#define BIO_get_conn_int_port(b) BIO_int_ctrl(b,BIO_C_GET_CONNECT,3,0)\n\n\n#define BIO_set_nbio(b,n)\tBIO_ctrl(b,BIO_C_SET_NBIO,(n),NULL)\n\n/* BIO_s_accept_socket() */\n#define BIO_set_accept_port(b,name) BIO_ctrl(b,BIO_C_SET_ACCEPT,0,(char *)name)\n#define BIO_get_accept_port(b)\tBIO_ptr_ctrl(b,BIO_C_GET_ACCEPT,0)\n/* #define BIO_set_nbio(b,n)\tBIO_ctrl(b,BIO_C_SET_NBIO,(n),NULL) */\n#define BIO_set_nbio_accept(b,n) BIO_ctrl(b,BIO_C_SET_ACCEPT,1,(n)?(void *)\"a\":NULL)\n#define BIO_set_accept_bios(b,bio) BIO_ctrl(b,BIO_C_SET_ACCEPT,2,(char *)bio)\n\n#define BIO_BIND_NORMAL\t\t\t0\n#define BIO_BIND_REUSEADDR_IF_UNUSED\t1\n#define BIO_BIND_REUSEADDR\t\t2\n#define BIO_set_bind_mode(b,mode) BIO_ctrl(b,BIO_C_SET_BIND_MODE,mode,NULL)\n#define BIO_get_bind_mode(b,mode) BIO_ctrl(b,BIO_C_GET_BIND_MODE,0,NULL)\n\n#define BIO_do_connect(b)\tBIO_do_handshake(b)\n#define BIO_do_accept(b)\tBIO_do_handshake(b)\n#define BIO_do_handshake(b)\tBIO_ctrl(b,BIO_C_DO_STATE_MACHINE,0,NULL)\n\n/* BIO_s_proxy_client() */\n#define BIO_set_url(b,url)\tBIO_ctrl(b,BIO_C_SET_PROXY_PARAM,0,(char *)(url))\n#define BIO_set_proxies(b,p)\tBIO_ctrl(b,BIO_C_SET_PROXY_PARAM,1,(char *)(p))\n/* BIO_set_nbio(b,n) */\n#define BIO_set_filter_bio(b,s) BIO_ctrl(b,BIO_C_SET_PROXY_PARAM,2,(char *)(s))\n/* BIO *BIO_get_filter_bio(BIO *bio); */\n#define BIO_set_proxy_cb(b,cb) BIO_callback_ctrl(b,BIO_C_SET_PROXY_PARAM,3,(void *(*cb)()))\n#define BIO_set_proxy_header(b,sk) BIO_ctrl(b,BIO_C_SET_PROXY_PARAM,4,(char *)sk)\n#define BIO_set_no_connect_return(b,bool) BIO_int_ctrl(b,BIO_C_SET_PROXY_PARAM,5,bool)\n\n#define BIO_get_proxy_header(b,skp) BIO_ctrl(b,BIO_C_GET_PROXY_PARAM,0,(char *)skp)\n#define BIO_get_proxies(b,pxy_p) BIO_ctrl(b,BIO_C_GET_PROXY_PARAM,1,(char *)(pxy_p))\n#define BIO_get_url(b,url)\tBIO_ctrl(b,BIO_C_GET_PROXY_PARAM,2,(char *)(url))\n#define BIO_get_no_connect_return(b)\tBIO_ctrl(b,BIO_C_GET_PROXY_PARAM,5,NULL)\n\n#define BIO_set_fd(b,fd,c)\tBIO_int_ctrl(b,BIO_C_SET_FD,c,fd)\n#define BIO_get_fd(b,c)\t\tBIO_ctrl(b,BIO_C_GET_FD,0,(char *)c)\n\n#define BIO_set_fp(b,fp,c)\tBIO_ctrl(b,BIO_C_SET_FILE_PTR,c,(char *)fp)\n#define BIO_get_fp(b,fpp)\tBIO_ctrl(b,BIO_C_GET_FILE_PTR,0,(char *)fpp)\n\n#define BIO_seek(b,ofs)\t(int)BIO_ctrl(b,BIO_C_FILE_SEEK,ofs,NULL)\n#define BIO_tell(b)\t(int)BIO_ctrl(b,BIO_C_FILE_TELL,0,NULL)\n\n/* name is cast to lose const, but might be better to route through a function\n   so we can do it safely */\n#ifdef CONST_STRICT\n/* If you are wondering why this isn't defined, its because CONST_STRICT is\n * purely a compile-time kludge to allow const to be checked.\n */\nint BIO_read_filename(BIO *b,const char *name);\n#else\n#define BIO_read_filename(b,name) BIO_ctrl(b,BIO_C_SET_FILENAME, \\\n\t\tBIO_CLOSE|BIO_FP_READ,(char *)name)\n#endif\n#define BIO_write_filename(b,name) BIO_ctrl(b,BIO_C_SET_FILENAME, \\\n\t\tBIO_CLOSE|BIO_FP_WRITE,name)\n#define BIO_append_filename(b,name) BIO_ctrl(b,BIO_C_SET_FILENAME, \\\n\t\tBIO_CLOSE|BIO_FP_APPEND,name)\n#define BIO_rw_filename(b,name) BIO_ctrl(b,BIO_C_SET_FILENAME, \\\n\t\tBIO_CLOSE|BIO_FP_READ|BIO_FP_WRITE,name)\n\n/* WARNING WARNING, this ups the reference count on the read bio of the\n * SSL structure.  This is because the ssl read BIO is now pointed to by\n * the next_bio field in the bio.  So when you free the BIO, make sure\n * you are doing a BIO_free_all() to catch the underlying BIO. */\n#define BIO_set_ssl(b,ssl,c)\tBIO_ctrl(b,BIO_C_SET_SSL,c,(char *)ssl)\n#define BIO_get_ssl(b,sslp)\tBIO_ctrl(b,BIO_C_GET_SSL,0,(char *)sslp)\n#define BIO_set_ssl_mode(b,client)\tBIO_ctrl(b,BIO_C_SSL_MODE,client,NULL)\n#define BIO_set_ssl_renegotiate_bytes(b,num) \\\n\tBIO_ctrl(b,BIO_C_SET_SSL_RENEGOTIATE_BYTES,num,NULL);\n#define BIO_get_num_renegotiates(b) \\\n\tBIO_ctrl(b,BIO_C_GET_SSL_NUM_RENEGOTIATES,0,NULL);\n#define BIO_set_ssl_renegotiate_timeout(b,seconds) \\\n\tBIO_ctrl(b,BIO_C_SET_SSL_RENEGOTIATE_TIMEOUT,seconds,NULL);\n\n/* defined in evp.h */\n/* #define BIO_set_md(b,md)\tBIO_ctrl(b,BIO_C_SET_MD,1,(char *)md) */\n\n#define BIO_get_mem_data(b,pp)\tBIO_ctrl(b,BIO_CTRL_INFO,0,(char *)pp)\n#define BIO_set_mem_buf(b,bm,c)\tBIO_ctrl(b,BIO_C_SET_BUF_MEM,c,(char *)bm)\n#define BIO_get_mem_ptr(b,pp)\tBIO_ctrl(b,BIO_C_GET_BUF_MEM_PTR,0,(char *)pp)\n#define BIO_set_mem_eof_return(b,v) \\\n\t\t\t\tBIO_ctrl(b,BIO_C_SET_BUF_MEM_EOF_RETURN,v,NULL)\n\n/* For the BIO_f_buffer() type */\n#define BIO_get_buffer_num_lines(b)\tBIO_ctrl(b,BIO_C_GET_BUFF_NUM_LINES,0,NULL)\n#define BIO_set_buffer_size(b,size)\tBIO_ctrl(b,BIO_C_SET_BUFF_SIZE,size,NULL)\n#define BIO_set_read_buffer_size(b,size) BIO_int_ctrl(b,BIO_C_SET_BUFF_SIZE,size,0)\n#define BIO_set_write_buffer_size(b,size) BIO_int_ctrl(b,BIO_C_SET_BUFF_SIZE,size,1)\n#define BIO_set_buffer_read_data(b,buf,num) BIO_ctrl(b,BIO_C_SET_BUFF_READ_DATA,num,buf)\n\n/* Don't use the next one unless you know what you are doing :-) */\n#define BIO_dup_state(b,ret)\tBIO_ctrl(b,BIO_CTRL_DUP,0,(char *)(ret))\n\n#define BIO_reset(b)\t\t(int)BIO_ctrl(b,BIO_CTRL_RESET,0,NULL)\n#define BIO_eof(b)\t\t(int)BIO_ctrl(b,BIO_CTRL_EOF,0,NULL)\n#define BIO_set_close(b,c)\t(int)BIO_ctrl(b,BIO_CTRL_SET_CLOSE,(c),NULL)\n#define BIO_get_close(b)\t(int)BIO_ctrl(b,BIO_CTRL_GET_CLOSE,0,NULL)\n#define BIO_pending(b)\t\t(int)BIO_ctrl(b,BIO_CTRL_PENDING,0,NULL)\n#define BIO_wpending(b)\t\t(int)BIO_ctrl(b,BIO_CTRL_WPENDING,0,NULL)\n/* ...pending macros have inappropriate return type */\nsize_t BIO_ctrl_pending(BIO *b);\nsize_t BIO_ctrl_wpending(BIO *b);\n#define BIO_flush(b)\t\t(int)BIO_ctrl(b,BIO_CTRL_FLUSH,0,NULL)\n#define BIO_get_info_callback(b,cbp) (int)BIO_ctrl(b,BIO_CTRL_GET_CALLBACK,0, \\\n\t\t\t\t\t\t   cbp)\n#define BIO_set_info_callback(b,cb) (int)BIO_callback_ctrl(b,BIO_CTRL_SET_CALLBACK,cb)\n\n/* For the BIO_f_buffer() type */\n#define BIO_buffer_get_num_lines(b) BIO_ctrl(b,BIO_CTRL_GET,0,NULL)\n\n/* For BIO_s_bio() */\n#define BIO_set_write_buf_size(b,size) (int)BIO_ctrl(b,BIO_C_SET_WRITE_BUF_SIZE,size,NULL)\n#define BIO_get_write_buf_size(b,size) (size_t)BIO_ctrl(b,BIO_C_GET_WRITE_BUF_SIZE,size,NULL)\n#define BIO_make_bio_pair(b1,b2)   (int)BIO_ctrl(b1,BIO_C_MAKE_BIO_PAIR,0,b2)\n#define BIO_destroy_bio_pair(b)    (int)BIO_ctrl(b,BIO_C_DESTROY_BIO_PAIR,0,NULL)\n#define BIO_shutdown_wr(b) (int)BIO_ctrl(b, BIO_C_SHUTDOWN_WR, 0, NULL)\n/* macros with inappropriate type -- but ...pending macros use int too: */\n#define BIO_get_write_guarantee(b) (int)BIO_ctrl(b,BIO_C_GET_WRITE_GUARANTEE,0,NULL)\n#define BIO_get_read_request(b)    (int)BIO_ctrl(b,BIO_C_GET_READ_REQUEST,0,NULL)\nsize_t BIO_ctrl_get_write_guarantee(BIO *b);\nsize_t BIO_ctrl_get_read_request(BIO *b);\nint BIO_ctrl_reset_read_request(BIO *b);\n\n/* ctrl macros for dgram */\n#define BIO_ctrl_dgram_connect(b,peer)  \\\n                     (int)BIO_ctrl(b,BIO_CTRL_DGRAM_CONNECT,0, (char *)peer)\n#define BIO_ctrl_set_connected(b, state, peer) \\\n         (int)BIO_ctrl(b, BIO_CTRL_DGRAM_SET_CONNECTED, state, (char *)peer)\n#define BIO_dgram_recv_timedout(b) \\\n         (int)BIO_ctrl(b, BIO_CTRL_DGRAM_GET_RECV_TIMER_EXP, 0, NULL)\n#define BIO_dgram_send_timedout(b) \\\n         (int)BIO_ctrl(b, BIO_CTRL_DGRAM_GET_SEND_TIMER_EXP, 0, NULL)\n#define BIO_dgram_get_peer(b,peer) \\\n         (int)BIO_ctrl(b, BIO_CTRL_DGRAM_GET_PEER, 0, (char *)peer)\n#define BIO_dgram_set_peer(b,peer) \\\n         (int)BIO_ctrl(b, BIO_CTRL_DGRAM_SET_PEER, 0, (char *)peer)\n\n/* These two aren't currently implemented */\n/* int BIO_get_ex_num(BIO *bio); */\n/* void BIO_set_ex_free_func(BIO *bio,int idx,void (*cb)()); */\nint BIO_set_ex_data(BIO *bio,int idx,void *data);\nvoid *BIO_get_ex_data(BIO *bio,int idx);\nint BIO_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func,\n\tCRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func);\nunsigned long BIO_number_read(BIO *bio);\nunsigned long BIO_number_written(BIO *bio);\n\n# ifndef OPENSSL_NO_FP_API\n#  if defined(OPENSSL_SYS_WIN16) && defined(_WINDLL)\nBIO_METHOD *BIO_s_file_internal(void);\nBIO *BIO_new_file_internal(char *filename, char *mode);\nBIO *BIO_new_fp_internal(FILE *stream, int close_flag);\n#    define BIO_s_file\tBIO_s_file_internal\n#    define BIO_new_file\tBIO_new_file_internal\n#    define BIO_new_fp\tBIO_new_fp_internal\n#  else /* FP_API */\nBIO_METHOD *BIO_s_file(void );\nBIO *BIO_new_file(const char *filename, const char *mode);\nBIO *BIO_new_fp(FILE *stream, int close_flag);\n#    define BIO_s_file_internal\t\tBIO_s_file\n#    define BIO_new_file_internal\tBIO_new_file\n#    define BIO_new_fp_internal\t\tBIO_s_file\n#  endif /* FP_API */\n# endif\nBIO *\tBIO_new(BIO_METHOD *type);\nint\tBIO_set(BIO *a,BIO_METHOD *type);\nint\tBIO_free(BIO *a);\nvoid\tBIO_vfree(BIO *a);\nint\tBIO_read(BIO *b, void *data, int len);\nint\tBIO_gets(BIO *bp,char *buf, int size);\nint\tBIO_write(BIO *b, const void *data, int len);\nint\tBIO_puts(BIO *bp,const char *buf);\nint\tBIO_indent(BIO *b,int indent,int max);\nlong\tBIO_ctrl(BIO *bp,int cmd,long larg,void *parg);\nlong BIO_callback_ctrl(BIO *b, int cmd, void (*fp)(struct bio_st *, int, const char *, int, long, long));\nchar *\tBIO_ptr_ctrl(BIO *bp,int cmd,long larg);\nlong\tBIO_int_ctrl(BIO *bp,int cmd,long larg,int iarg);\nBIO *\tBIO_push(BIO *b,BIO *append);\nBIO *\tBIO_pop(BIO *b);\nvoid\tBIO_free_all(BIO *a);\nBIO *\tBIO_find_type(BIO *b,int bio_type);\nBIO *\tBIO_next(BIO *b);\nBIO *\tBIO_get_retry_BIO(BIO *bio, int *reason);\nint\tBIO_get_retry_reason(BIO *bio);\nBIO *\tBIO_dup_chain(BIO *in);\n\nint BIO_nread0(BIO *bio, char **buf);\nint BIO_nread(BIO *bio, char **buf, int num);\nint BIO_nwrite0(BIO *bio, char **buf);\nint BIO_nwrite(BIO *bio, char **buf, int num);\n\n#ifndef OPENSSL_SYS_WIN16\nlong BIO_debug_callback(BIO *bio,int cmd,const char *argp,int argi,\n\tlong argl,long ret);\n#else\nlong _far _loadds BIO_debug_callback(BIO *bio,int cmd,const char *argp,int argi,\n\tlong argl,long ret);\n#endif\n\nBIO_METHOD *BIO_s_mem(void);\nBIO *BIO_new_mem_buf(void *buf, int len);\nBIO_METHOD *BIO_s_socket(void);\nBIO_METHOD *BIO_s_connect(void);\nBIO_METHOD *BIO_s_accept(void);\nBIO_METHOD *BIO_s_fd(void);\n#ifndef OPENSSL_SYS_OS2\nBIO_METHOD *BIO_s_log(void);\n#endif\nBIO_METHOD *BIO_s_bio(void);\nBIO_METHOD *BIO_s_null(void);\nBIO_METHOD *BIO_f_null(void);\nBIO_METHOD *BIO_f_buffer(void);\n#ifdef OPENSSL_SYS_VMS\nBIO_METHOD *BIO_f_linebuffer(void);\n#endif\nBIO_METHOD *BIO_f_nbio_test(void);\n#ifndef OPENSSL_NO_DGRAM\nBIO_METHOD *BIO_s_datagram(void);\n#endif\n\n/* BIO_METHOD *BIO_f_ber(void); */\n\nint BIO_sock_should_retry(int i);\nint BIO_sock_non_fatal_error(int error);\nint BIO_dgram_non_fatal_error(int error);\n\nint BIO_fd_should_retry(int i);\nint BIO_fd_non_fatal_error(int error);\nint BIO_dump_cb(int (*cb)(const void *data, size_t len, void *u),\n\t\tvoid *u, const char *s, int len);\nint BIO_dump_indent_cb(int (*cb)(const void *data, size_t len, void *u),\n\t\t       void *u, const char *s, int len, int indent);\nint BIO_dump(BIO *b,const char *bytes,int len);\nint BIO_dump_indent(BIO *b,const char *bytes,int len,int indent);\n#ifndef OPENSSL_NO_FP_API\nint BIO_dump_fp(FILE *fp, const char *s, int len);\nint BIO_dump_indent_fp(FILE *fp, const char *s, int len, int indent);\n#endif\nstruct hostent *BIO_gethostbyname(const char *name);\n/* We might want a thread-safe interface too:\n * struct hostent *BIO_gethostbyname_r(const char *name,\n *     struct hostent *result, void *buffer, size_t buflen);\n * or something similar (caller allocates a struct hostent,\n * pointed to by \"result\", and additional buffer space for the various\n * substructures; if the buffer does not suffice, NULL is returned\n * and an appropriate error code is set).\n */\nint BIO_sock_error(int sock);\nint BIO_socket_ioctl(int fd, long type, void *arg);\nint BIO_socket_nbio(int fd,int mode);\nint BIO_get_port(const char *str, unsigned short *port_ptr);\nint BIO_get_host_ip(const char *str, unsigned char *ip);\nint BIO_get_accept_socket(char *host_port,int mode);\nint BIO_accept(int sock,char **ip_port);\nint BIO_sock_init(void );\nvoid BIO_sock_cleanup(void);\nint BIO_set_tcp_ndelay(int sock,int turn_on);\n\nBIO *BIO_new_socket(int sock, int close_flag);\nBIO *BIO_new_dgram(int fd, int close_flag);\nBIO *BIO_new_fd(int fd, int close_flag);\nBIO *BIO_new_connect(char *host_port);\nBIO *BIO_new_accept(char *host_port);\n\nint BIO_new_bio_pair(BIO **bio1, size_t writebuf1,\n\tBIO **bio2, size_t writebuf2);\n/* If successful, returns 1 and in *bio1, *bio2 two BIO pair endpoints.\n * Otherwise returns 0 and sets *bio1 and *bio2 to NULL.\n * Size 0 uses default value.\n */\n\nvoid BIO_copy_next_retry(BIO *b);\n\n/*long BIO_ghbn_ctrl(int cmd,int iarg,char *parg);*/\n\n#ifdef __GNUC__\n#  define __bio_h__attr__ __attribute__\n#else\n#  define __bio_h__attr__(x)\n#endif\nint BIO_printf(BIO *bio, const char *format, ...)\n\t__bio_h__attr__((__format__(__printf__,2,3)));\nint BIO_vprintf(BIO *bio, const char *format, va_list args)\n\t__bio_h__attr__((__format__(__printf__,2,0)));\nint BIO_snprintf(char *buf, size_t n, const char *format, ...)\n\t__bio_h__attr__((__format__(__printf__,3,4)));\nint BIO_vsnprintf(char *buf, size_t n, const char *format, va_list args)\n\t__bio_h__attr__((__format__(__printf__,3,0)));\n#undef __bio_h__attr__\n\n/* BEGIN ERROR CODES */\n/* The following lines are auto generated by the script mkerr.pl. Any changes\n * made after this point may be overwritten when the script is next run.\n */\nvoid ERR_load_BIO_strings(void);\n\n/* Error codes for the BIO functions. */\n\n/* Function codes. */\n#define BIO_F_ACPT_STATE\t\t\t\t 100\n#define BIO_F_BIO_ACCEPT\t\t\t\t 101\n#define BIO_F_BIO_BER_GET_HEADER\t\t\t 102\n#define BIO_F_BIO_CALLBACK_CTRL\t\t\t\t 131\n#define BIO_F_BIO_CTRL\t\t\t\t\t 103\n#define BIO_F_BIO_GETHOSTBYNAME\t\t\t\t 120\n#define BIO_F_BIO_GETS\t\t\t\t\t 104\n#define BIO_F_BIO_GET_ACCEPT_SOCKET\t\t\t 105\n#define BIO_F_BIO_GET_HOST_IP\t\t\t\t 106\n#define BIO_F_BIO_GET_PORT\t\t\t\t 107\n#define BIO_F_BIO_MAKE_PAIR\t\t\t\t 121\n#define BIO_F_BIO_NEW\t\t\t\t\t 108\n#define BIO_F_BIO_NEW_FILE\t\t\t\t 109\n#define BIO_F_BIO_NEW_MEM_BUF\t\t\t\t 126\n#define BIO_F_BIO_NREAD\t\t\t\t\t 123\n#define BIO_F_BIO_NREAD0\t\t\t\t 124\n#define BIO_F_BIO_NWRITE\t\t\t\t 125\n#define BIO_F_BIO_NWRITE0\t\t\t\t 122\n#define BIO_F_BIO_PUTS\t\t\t\t\t 110\n#define BIO_F_BIO_READ\t\t\t\t\t 111\n#define BIO_F_BIO_SOCK_INIT\t\t\t\t 112\n#define BIO_F_BIO_WRITE\t\t\t\t\t 113\n#define BIO_F_BUFFER_CTRL\t\t\t\t 114\n#define BIO_F_CONN_CTRL\t\t\t\t\t 127\n#define BIO_F_CONN_STATE\t\t\t\t 115\n#define BIO_F_FILE_CTRL\t\t\t\t\t 116\n#define BIO_F_FILE_READ\t\t\t\t\t 130\n#define BIO_F_LINEBUFFER_CTRL\t\t\t\t 129\n#define BIO_F_MEM_READ\t\t\t\t\t 128\n#define BIO_F_MEM_WRITE\t\t\t\t\t 117\n#define BIO_F_SSL_NEW\t\t\t\t\t 118\n#define BIO_F_WSASTARTUP\t\t\t\t 119\n\n/* Reason codes. */\n#define BIO_R_ACCEPT_ERROR\t\t\t\t 100\n#define BIO_R_BAD_FOPEN_MODE\t\t\t\t 101\n#define BIO_R_BAD_HOSTNAME_LOOKUP\t\t\t 102\n#define BIO_R_BROKEN_PIPE\t\t\t\t 124\n#define BIO_R_CONNECT_ERROR\t\t\t\t 103\n#define BIO_R_EOF_ON_MEMORY_BIO\t\t\t\t 127\n#define BIO_R_ERROR_SETTING_NBIO\t\t\t 104\n#define BIO_R_ERROR_SETTING_NBIO_ON_ACCEPTED_SOCKET\t 105\n#define BIO_R_ERROR_SETTING_NBIO_ON_ACCEPT_SOCKET\t 106\n#define BIO_R_GETHOSTBYNAME_ADDR_IS_NOT_AF_INET\t\t 107\n#define BIO_R_INVALID_ARGUMENT\t\t\t\t 125\n#define BIO_R_INVALID_IP_ADDRESS\t\t\t 108\n#define BIO_R_IN_USE\t\t\t\t\t 123\n#define BIO_R_KEEPALIVE\t\t\t\t\t 109\n#define BIO_R_NBIO_CONNECT_ERROR\t\t\t 110\n#define BIO_R_NO_ACCEPT_PORT_SPECIFIED\t\t\t 111\n#define BIO_R_NO_HOSTNAME_SPECIFIED\t\t\t 112\n#define BIO_R_NO_PORT_DEFINED\t\t\t\t 113\n#define BIO_R_NO_PORT_SPECIFIED\t\t\t\t 114\n#define BIO_R_NO_SUCH_FILE\t\t\t\t 128\n#define BIO_R_NULL_PARAMETER\t\t\t\t 115\n#define BIO_R_TAG_MISMATCH\t\t\t\t 116\n#define BIO_R_UNABLE_TO_BIND_SOCKET\t\t\t 117\n#define BIO_R_UNABLE_TO_CREATE_SOCKET\t\t\t 118\n#define BIO_R_UNABLE_TO_LISTEN_SOCKET\t\t\t 119\n#define BIO_R_UNINITIALIZED\t\t\t\t 120\n#define BIO_R_UNSUPPORTED_METHOD\t\t\t 121\n#define BIO_R_WRITE_TO_READ_ONLY_BIO\t\t\t 126\n#define BIO_R_WSASTARTUP\t\t\t\t 122\n\n#ifdef  __cplusplus\n}\n#endif\n#endif\n"
  },
  {
    "path": "freebsd-headers/openssl/bio_lcl.h",
    "content": "#include <openssl/bio.h>\n\n#if BIO_FLAGS_UPLINK==0\n/* Shortcut UPLINK calls on most platforms... */\n#define\tUP_stdin\tstdin\n#define\tUP_stdout\tstdout\n#define\tUP_stderr\tstderr\n#define\tUP_fprintf\tfprintf\n#define\tUP_fgets\tfgets\n#define\tUP_fread\tfread\n#define\tUP_fwrite\tfwrite\n#undef\tUP_fsetmod\n#define\tUP_feof\t\tfeof\n#define\tUP_fclose\tfclose\n\n#define\tUP_fopen\tfopen\n#define\tUP_fseek\tfseek\n#define\tUP_ftell\tftell\n#define\tUP_fflush\tfflush\n#define\tUP_ferror\tferror\n#define\tUP_fileno\tfileno\n\n#define\tUP_open\t\topen\n#define\tUP_read\t\tread\n#define\tUP_write\twrite\n#define\tUP_lseek\tlseek\n#define\tUP_close\tclose\n#endif\n"
  },
  {
    "path": "freebsd-headers/openssl/blowfish.h",
    "content": "/* crypto/bf/blowfish.h */\n/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)\n * All rights reserved.\n *\n * This package is an SSL implementation written\n * by Eric Young (eay@cryptsoft.com).\n * The implementation was written so as to conform with Netscapes SSL.\n * \n * This library is free for commercial and non-commercial use as long as\n * the following conditions are aheared to.  The following conditions\n * apply to all code found in this distribution, be it the RC4, RSA,\n * lhash, DES, etc., code; not just the SSL code.  The SSL documentation\n * included with this distribution is covered by the same copyright terms\n * except that the holder is Tim Hudson (tjh@cryptsoft.com).\n * \n * Copyright remains Eric Young's, and as such any Copyright notices in\n * the code are not to be removed.\n * If this package is used in a product, Eric Young should be given attribution\n * as the author of the parts of the library used.\n * This can be in the form of a textual message at program startup or\n * in documentation (online or textual) provided with the package.\n * \n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. All advertising materials mentioning features or use of this software\n *    must display the following acknowledgement:\n *    \"This product includes cryptographic software written by\n *     Eric Young (eay@cryptsoft.com)\"\n *    The word 'cryptographic' can be left out if the rouines from the library\n *    being used are not cryptographic related :-).\n * 4. If you include any Windows specific code (or a derivative thereof) from \n *    the apps directory (application code) you must include an acknowledgement:\n *    \"This product includes software written by Tim Hudson (tjh@cryptsoft.com)\"\n * \n * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n * \n * The licence and distribution terms for any publically available version or\n * derivative of this code cannot be changed.  i.e. this code cannot simply be\n * copied and put under another distribution licence\n * [including the GNU Public Licence.]\n */\n\n#ifndef HEADER_BLOWFISH_H\n#define HEADER_BLOWFISH_H\n\n#include <openssl/e_os2.h>\n\n#ifdef  __cplusplus\nextern \"C\" {\n#endif\n\n#ifdef OPENSSL_NO_BF\n#error BF is disabled.\n#endif\n\n#define BF_ENCRYPT\t1\n#define BF_DECRYPT\t0\n\n/*\n * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n * ! BF_LONG has to be at least 32 bits wide. If it's wider, then !\n * ! BF_LONG_LOG2 has to be defined along.                        !\n * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n */\n\n#if defined(OPENSSL_SYS_WIN16) || defined(__LP32__)\n#define BF_LONG unsigned long\n#elif defined(OPENSSL_SYS_CRAY) || defined(__ILP64__)\n#define BF_LONG unsigned long\n#define BF_LONG_LOG2 3\n/*\n * _CRAY note. I could declare short, but I have no idea what impact\n * does it have on performance on none-T3E machines. I could declare\n * int, but at least on C90 sizeof(int) can be chosen at compile time.\n * So I've chosen long...\n *\t\t\t\t\t<appro@fy.chalmers.se>\n */\n#else\n#define BF_LONG unsigned int\n#endif\n\n#define BF_ROUNDS\t16\n#define BF_BLOCK\t8\n\ntypedef struct bf_key_st\n\t{\n\tBF_LONG P[BF_ROUNDS+2];\n\tBF_LONG S[4*256];\n\t} BF_KEY;\n\n#ifdef OPENSSL_FIPS \nvoid private_BF_set_key(BF_KEY *key, int len, const unsigned char *data);\n#endif\nvoid BF_set_key(BF_KEY *key, int len, const unsigned char *data);\n\nvoid BF_encrypt(BF_LONG *data,const BF_KEY *key);\nvoid BF_decrypt(BF_LONG *data,const BF_KEY *key);\n\nvoid BF_ecb_encrypt(const unsigned char *in, unsigned char *out,\n\tconst BF_KEY *key, int enc);\nvoid BF_cbc_encrypt(const unsigned char *in, unsigned char *out, long length,\n\tconst BF_KEY *schedule, unsigned char *ivec, int enc);\nvoid BF_cfb64_encrypt(const unsigned char *in, unsigned char *out, long length,\n\tconst BF_KEY *schedule, unsigned char *ivec, int *num, int enc);\nvoid BF_ofb64_encrypt(const unsigned char *in, unsigned char *out, long length,\n\tconst BF_KEY *schedule, unsigned char *ivec, int *num);\nconst char *BF_options(void);\n\n#ifdef  __cplusplus\n}\n#endif\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/openssl/bn.h",
    "content": "/* crypto/bn/bn.h */\n/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com)\n * All rights reserved.\n *\n * This package is an SSL implementation written\n * by Eric Young (eay@cryptsoft.com).\n * The implementation was written so as to conform with Netscapes SSL.\n * \n * This library is free for commercial and non-commercial use as long as\n * the following conditions are aheared to.  The following conditions\n * apply to all code found in this distribution, be it the RC4, RSA,\n * lhash, DES, etc., code; not just the SSL code.  The SSL documentation\n * included with this distribution is covered by the same copyright terms\n * except that the holder is Tim Hudson (tjh@cryptsoft.com).\n * \n * Copyright remains Eric Young's, and as such any Copyright notices in\n * the code are not to be removed.\n * If this package is used in a product, Eric Young should be given attribution\n * as the author of the parts of the library used.\n * This can be in the form of a textual message at program startup or\n * in documentation (online or textual) provided with the package.\n * \n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. All advertising materials mentioning features or use of this software\n *    must display the following acknowledgement:\n *    \"This product includes cryptographic software written by\n *     Eric Young (eay@cryptsoft.com)\"\n *    The word 'cryptographic' can be left out if the rouines from the library\n *    being used are not cryptographic related :-).\n * 4. If you include any Windows specific code (or a derivative thereof) from \n *    the apps directory (application code) you must include an acknowledgement:\n *    \"This product includes software written by Tim Hudson (tjh@cryptsoft.com)\"\n * \n * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n * \n * The licence and distribution terms for any publically available version or\n * derivative of this code cannot be changed.  i.e. this code cannot simply be\n * copied and put under another distribution licence\n * [including the GNU Public Licence.]\n */\n/* ====================================================================\n * Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED.\n *\n * Portions of the attached software (\"Contribution\") are developed by \n * SUN MICROSYSTEMS, INC., and are contributed to the OpenSSL project.\n *\n * The Contribution is licensed pursuant to the Eric Young open source\n * license provided above.\n *\n * The binary polynomial arithmetic software is originally written by \n * Sheueling Chang Shantz and Douglas Stebila of Sun Microsystems Laboratories.\n *\n */\n\n#ifndef HEADER_BN_H\n#define HEADER_BN_H\n\n#include <openssl/e_os2.h>\n#ifndef OPENSSL_NO_FP_API\n#include <stdio.h> /* FILE */\n#endif\n#include <openssl/ossl_typ.h>\n\n#ifdef  __cplusplus\nextern \"C\" {\n#endif\n\n/* These preprocessor symbols control various aspects of the bignum headers and\n * library code. They're not defined by any \"normal\" configuration, as they are\n * intended for development and testing purposes. NB: defining all three can be\n * useful for debugging application code as well as openssl itself.\n *\n * BN_DEBUG - turn on various debugging alterations to the bignum code\n * BN_DEBUG_RAND - uses random poisoning of unused words to trip up\n * mismanagement of bignum internals. You must also define BN_DEBUG.\n */\n/* #define BN_DEBUG */\n/* #define BN_DEBUG_RAND */\n\n#define BN_MUL_COMBA\n#define BN_SQR_COMBA\n#define BN_RECURSION\n\n/* This next option uses the C libraries (2 word)/(1 word) function.\n * If it is not defined, I use my C version (which is slower).\n * The reason for this flag is that when the particular C compiler\n * library routine is used, and the library is linked with a different\n * compiler, the library is missing.  This mostly happens when the\n * library is built with gcc and then linked using normal cc.  This would\n * be a common occurrence because gcc normally produces code that is\n * 2 times faster than system compilers for the big number stuff.\n * For machines with only one compiler (or shared libraries), this should\n * be on.  Again this in only really a problem on machines\n * using \"long long's\", are 32bit, and are not using my assembler code. */\n#if defined(OPENSSL_SYS_MSDOS) || defined(OPENSSL_SYS_WINDOWS) || \\\n    defined(OPENSSL_SYS_WIN32) || defined(linux)\n# ifndef BN_DIV2W\n#  define BN_DIV2W\n# endif\n#endif\n\n/* assuming long is 64bit - this is the DEC Alpha\n * unsigned long long is only 64 bits :-(, don't define\n * BN_LLONG for the DEC Alpha */\n#ifdef SIXTY_FOUR_BIT_LONG\n#define BN_ULLONG\tunsigned long long\n#define BN_ULONG\tunsigned long\n#define BN_LONG\t\tlong\n#define BN_BITS\t\t128\n#define BN_BYTES\t8\n#define BN_BITS2\t64\n#define BN_BITS4\t32\n#define BN_MASK\t\t(0xffffffffffffffffffffffffffffffffLL)\n#define BN_MASK2\t(0xffffffffffffffffL)\n#define BN_MASK2l\t(0xffffffffL)\n#define BN_MASK2h\t(0xffffffff00000000L)\n#define BN_MASK2h1\t(0xffffffff80000000L)\n#define BN_TBIT\t\t(0x8000000000000000L)\n#define BN_DEC_CONV\t(10000000000000000000UL)\n#define BN_DEC_FMT1\t\"%lu\"\n#define BN_DEC_FMT2\t\"%019lu\"\n#define BN_DEC_NUM\t19\n#endif\n\n/* This is where the long long data type is 64 bits, but long is 32.\n * For machines where there are 64bit registers, this is the mode to use.\n * IRIX, on R4000 and above should use this mode, along with the relevant\n * assembler code :-).  Do NOT define BN_LLONG.\n */\n#ifdef SIXTY_FOUR_BIT\n#undef BN_LLONG\n#undef BN_ULLONG\n#define BN_ULONG\tunsigned long long\n#define BN_LONG\t\tlong long\n#define BN_BITS\t\t128\n#define BN_BYTES\t8\n#define BN_BITS2\t64\n#define BN_BITS4\t32\n#define BN_MASK2\t(0xffffffffffffffffLL)\n#define BN_MASK2l\t(0xffffffffL)\n#define BN_MASK2h\t(0xffffffff00000000LL)\n#define BN_MASK2h1\t(0xffffffff80000000LL)\n#define BN_TBIT\t\t(0x8000000000000000LL)\n#define BN_DEC_CONV\t(10000000000000000000ULL)\n#define BN_DEC_FMT1\t\"%llu\"\n#define BN_DEC_FMT2\t\"%019llu\"\n#define BN_DEC_NUM\t19\n#endif\n\n#ifdef THIRTY_TWO_BIT\n#ifdef BN_LLONG\n# if defined(OPENSSL_SYS_WIN32) && !defined(__GNUC__)\n#  define BN_ULLONG\tunsigned __int64\n# else\n#  define BN_ULLONG\tunsigned long long\n# endif\n#endif\n#define BN_ULONG\tunsigned long\n#define BN_LONG\t\tlong\n#define BN_BITS\t\t64\n#define BN_BYTES\t4\n#define BN_BITS2\t32\n#define BN_BITS4\t16\n#ifdef OPENSSL_SYS_WIN32\n/* VC++ doesn't like the LL suffix */\n#define BN_MASK\t\t(0xffffffffffffffffL)\n#else\n#define BN_MASK\t\t(0xffffffffffffffffLL)\n#endif\n#define BN_MASK2\t(0xffffffffL)\n#define BN_MASK2l\t(0xffff)\n#define BN_MASK2h1\t(0xffff8000L)\n#define BN_MASK2h\t(0xffff0000L)\n#define BN_TBIT\t\t(0x80000000L)\n#define BN_DEC_CONV\t(1000000000L)\n#define BN_DEC_FMT1\t\"%lu\"\n#define BN_DEC_FMT2\t\"%09lu\"\n#define BN_DEC_NUM\t9\n#endif\n\n#ifdef SIXTEEN_BIT\n#ifndef BN_DIV2W\n#define BN_DIV2W\n#endif\n#define BN_ULLONG\tunsigned long\n#define BN_ULONG\tunsigned short\n#define BN_LONG\t\tshort\n#define BN_BITS\t\t32\n#define BN_BYTES\t2\n#define BN_BITS2\t16\n#define BN_BITS4\t8\n#define BN_MASK\t\t(0xffffffff)\n#define BN_MASK2\t(0xffff)\n#define BN_MASK2l\t(0xff)\n#define BN_MASK2h1\t(0xff80)\n#define BN_MASK2h\t(0xff00)\n#define BN_TBIT\t\t(0x8000)\n#define BN_DEC_CONV\t(100000)\n#define BN_DEC_FMT1\t\"%u\"\n#define BN_DEC_FMT2\t\"%05u\"\n#define BN_DEC_NUM\t5\n#endif\n\n#ifdef EIGHT_BIT\n#ifndef BN_DIV2W\n#define BN_DIV2W\n#endif\n#define BN_ULLONG\tunsigned short\n#define BN_ULONG\tunsigned char\n#define BN_LONG\t\tchar\n#define BN_BITS\t\t16\n#define BN_BYTES\t1\n#define BN_BITS2\t8\n#define BN_BITS4\t4\n#define BN_MASK\t\t(0xffff)\n#define BN_MASK2\t(0xff)\n#define BN_MASK2l\t(0xf)\n#define BN_MASK2h1\t(0xf8)\n#define BN_MASK2h\t(0xf0)\n#define BN_TBIT\t\t(0x80)\n#define BN_DEC_CONV\t(100)\n#define BN_DEC_FMT1\t\"%u\"\n#define BN_DEC_FMT2\t\"%02u\"\n#define BN_DEC_NUM\t2\n#endif\n\n#define BN_DEFAULT_BITS\t1280\n\n#define BN_FLG_MALLOCED\t\t0x01\n#define BN_FLG_STATIC_DATA\t0x02\n#define BN_FLG_CONSTTIME\t0x04 /* avoid leaking exponent information through timing,\n                                      * BN_mod_exp_mont() will call BN_mod_exp_mont_consttime,\n                                      * BN_div() will call BN_div_no_branch,\n                                      * BN_mod_inverse() will call BN_mod_inverse_no_branch.\n                                      */\n\n#ifndef OPENSSL_NO_DEPRECATED\n#define BN_FLG_EXP_CONSTTIME BN_FLG_CONSTTIME /* deprecated name for the flag */\n                                      /* avoid leaking exponent information through timings\n                                      * (BN_mod_exp_mont() will call BN_mod_exp_mont_consttime) */\n#endif\n\n#ifndef OPENSSL_NO_DEPRECATED\n#define BN_FLG_FREE\t\t0x8000\t/* used for debuging */\n#endif\n#define BN_set_flags(b,n)\t((b)->flags|=(n))\n#define BN_get_flags(b,n)\t((b)->flags&(n))\n\n/* get a clone of a BIGNUM with changed flags, for *temporary* use only\n * (the two BIGNUMs cannot not be used in parallel!) */\n#define BN_with_flags(dest,b,n)  ((dest)->d=(b)->d, \\\n                                  (dest)->top=(b)->top, \\\n                                  (dest)->dmax=(b)->dmax, \\\n                                  (dest)->neg=(b)->neg, \\\n                                  (dest)->flags=(((dest)->flags & BN_FLG_MALLOCED) \\\n                                                 |  ((b)->flags & ~BN_FLG_MALLOCED) \\\n                                                 |  BN_FLG_STATIC_DATA \\\n                                                 |  (n)))\n\n/* Already declared in ossl_typ.h */\n#if 0\ntypedef struct bignum_st BIGNUM;\n/* Used for temp variables (declaration hidden in bn_lcl.h) */\ntypedef struct bignum_ctx BN_CTX;\ntypedef struct bn_blinding_st BN_BLINDING;\ntypedef struct bn_mont_ctx_st BN_MONT_CTX;\ntypedef struct bn_recp_ctx_st BN_RECP_CTX;\ntypedef struct bn_gencb_st BN_GENCB;\n#endif\n\nstruct bignum_st\n\t{\n\tBN_ULONG *d;\t/* Pointer to an array of 'BN_BITS2' bit chunks. */\n\tint top;\t/* Index of last used d +1. */\n\t/* The next are internal book keeping for bn_expand. */\n\tint dmax;\t/* Size of the d array. */\n\tint neg;\t/* one if the number is negative */\n\tint flags;\n\t};\n\n/* Used for montgomery multiplication */\nstruct bn_mont_ctx_st\n\t{\n\tint ri;        /* number of bits in R */\n\tBIGNUM RR;     /* used to convert to montgomery form */\n\tBIGNUM N;      /* The modulus */\n\tBIGNUM Ni;     /* R*(1/R mod N) - N*Ni = 1\n\t                * (Ni is only stored for bignum algorithm) */\n#if 0\n\t/* OpenSSL 0.9.9 preview: */\n\tBN_ULONG n0[2];/* least significant word(s) of Ni */\n#else\n\tBN_ULONG n0;   /* least significant word of Ni */\n#endif\n\tint flags;\n\t};\n\n/* Used for reciprocal division/mod functions\n * It cannot be shared between threads\n */\nstruct bn_recp_ctx_st\n\t{\n\tBIGNUM N;\t/* the divisor */\n\tBIGNUM Nr;\t/* the reciprocal */\n\tint num_bits;\n\tint shift;\n\tint flags;\n\t};\n\n/* Used for slow \"generation\" functions. */\nstruct bn_gencb_st\n\t{\n\tunsigned int ver;\t/* To handle binary (in)compatibility */\n\tvoid *arg;\t\t/* callback-specific data */\n\tunion\n\t\t{\n\t\t/* if(ver==1) - handles old style callbacks */\n\t\tvoid (*cb_1)(int, int, void *);\n\t\t/* if(ver==2) - new callback style */\n\t\tint (*cb_2)(int, int, BN_GENCB *);\n\t\t} cb;\n\t};\n/* Wrapper function to make using BN_GENCB easier,  */\nint BN_GENCB_call(BN_GENCB *cb, int a, int b);\n/* Macro to populate a BN_GENCB structure with an \"old\"-style callback */\n#define BN_GENCB_set_old(gencb, callback, cb_arg) { \\\n\t\tBN_GENCB *tmp_gencb = (gencb); \\\n\t\ttmp_gencb->ver = 1; \\\n\t\ttmp_gencb->arg = (cb_arg); \\\n\t\ttmp_gencb->cb.cb_1 = (callback); }\n/* Macro to populate a BN_GENCB structure with a \"new\"-style callback */\n#define BN_GENCB_set(gencb, callback, cb_arg) { \\\n\t\tBN_GENCB *tmp_gencb = (gencb); \\\n\t\ttmp_gencb->ver = 2; \\\n\t\ttmp_gencb->arg = (cb_arg); \\\n\t\ttmp_gencb->cb.cb_2 = (callback); }\n\n#define BN_prime_checks 0 /* default: select number of iterations\n\t\t\t     based on the size of the number */\n\n/* number of Miller-Rabin iterations for an error rate  of less than 2^-80\n * for random 'b'-bit input, b >= 100 (taken from table 4.4 in the Handbook\n * of Applied Cryptography [Menezes, van Oorschot, Vanstone; CRC Press 1996];\n * original paper: Damgaard, Landrock, Pomerance: Average case error estimates\n * for the strong probable prime test. -- Math. Comp. 61 (1993) 177-194) */\n#define BN_prime_checks_for_size(b) ((b) >= 1300 ?  2 : \\\n                                (b) >=  850 ?  3 : \\\n                                (b) >=  650 ?  4 : \\\n                                (b) >=  550 ?  5 : \\\n                                (b) >=  450 ?  6 : \\\n                                (b) >=  400 ?  7 : \\\n                                (b) >=  350 ?  8 : \\\n                                (b) >=  300 ?  9 : \\\n                                (b) >=  250 ? 12 : \\\n                                (b) >=  200 ? 15 : \\\n                                (b) >=  150 ? 18 : \\\n                                /* b >= 100 */ 27)\n\n#define BN_num_bytes(a)\t((BN_num_bits(a)+7)/8)\n\n/* Note that BN_abs_is_word didn't work reliably for w == 0 until 0.9.8 */\n#define BN_abs_is_word(a,w) ((((a)->top == 1) && ((a)->d[0] == (BN_ULONG)(w))) || \\\n\t\t\t\t(((w) == 0) && ((a)->top == 0)))\n#define BN_is_zero(a)       ((a)->top == 0)\n#define BN_is_one(a)        (BN_abs_is_word((a),1) && !(a)->neg)\n#define BN_is_word(a,w)     (BN_abs_is_word((a),(w)) && (!(w) || !(a)->neg))\n#define BN_is_odd(a)\t    (((a)->top > 0) && ((a)->d[0] & 1))\n\n#define BN_one(a)\t(BN_set_word((a),1))\n#define BN_zero_ex(a) \\\n\tdo { \\\n\t\tBIGNUM *_tmp_bn = (a); \\\n\t\t_tmp_bn->top = 0; \\\n\t\t_tmp_bn->neg = 0; \\\n\t} while(0)\n#ifdef OPENSSL_NO_DEPRECATED\n#define BN_zero(a)\tBN_zero_ex(a)\n#else\n#define BN_zero(a)\t(BN_set_word((a),0))\n#endif\n\nconst BIGNUM *BN_value_one(void);\nchar *\tBN_options(void);\nBN_CTX *BN_CTX_new(void);\n#ifndef OPENSSL_NO_DEPRECATED\nvoid\tBN_CTX_init(BN_CTX *c);\n#endif\nvoid\tBN_CTX_free(BN_CTX *c);\nvoid\tBN_CTX_start(BN_CTX *ctx);\nBIGNUM *BN_CTX_get(BN_CTX *ctx);\nvoid\tBN_CTX_end(BN_CTX *ctx);\nint     BN_rand(BIGNUM *rnd, int bits, int top,int bottom);\nint     BN_pseudo_rand(BIGNUM *rnd, int bits, int top,int bottom);\nint\tBN_rand_range(BIGNUM *rnd, const BIGNUM *range);\nint\tBN_pseudo_rand_range(BIGNUM *rnd, const BIGNUM *range);\nint\tBN_num_bits(const BIGNUM *a);\nint\tBN_num_bits_word(BN_ULONG);\nBIGNUM *BN_new(void);\nvoid\tBN_init(BIGNUM *);\nvoid\tBN_clear_free(BIGNUM *a);\nBIGNUM *BN_copy(BIGNUM *a, const BIGNUM *b);\nvoid\tBN_swap(BIGNUM *a, BIGNUM *b);\nBIGNUM *BN_bin2bn(const unsigned char *s,int len,BIGNUM *ret);\nint\tBN_bn2bin(const BIGNUM *a, unsigned char *to);\nBIGNUM *BN_mpi2bn(const unsigned char *s,int len,BIGNUM *ret);\nint\tBN_bn2mpi(const BIGNUM *a, unsigned char *to);\nint\tBN_sub(BIGNUM *r, const BIGNUM *a, const BIGNUM *b);\nint\tBN_usub(BIGNUM *r, const BIGNUM *a, const BIGNUM *b);\nint\tBN_uadd(BIGNUM *r, const BIGNUM *a, const BIGNUM *b);\nint\tBN_add(BIGNUM *r, const BIGNUM *a, const BIGNUM *b);\nint\tBN_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx);\nint\tBN_sqr(BIGNUM *r, const BIGNUM *a,BN_CTX *ctx);\n/** BN_set_negative sets sign of a BIGNUM\n * \\param  b  pointer to the BIGNUM object\n * \\param  n  0 if the BIGNUM b should be positive and a value != 0 otherwise \n */\nvoid\tBN_set_negative(BIGNUM *b, int n);\n/** BN_is_negative returns 1 if the BIGNUM is negative\n * \\param  a  pointer to the BIGNUM object\n * \\return 1 if a < 0 and 0 otherwise\n */\n#define BN_is_negative(a) ((a)->neg != 0)\n\nint\tBN_div(BIGNUM *dv, BIGNUM *rem, const BIGNUM *m, const BIGNUM *d,\n\tBN_CTX *ctx);\n#define BN_mod(rem,m,d,ctx) BN_div(NULL,(rem),(m),(d),(ctx))\nint\tBN_nnmod(BIGNUM *r, const BIGNUM *m, const BIGNUM *d, BN_CTX *ctx);\nint\tBN_mod_add(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const BIGNUM *m, BN_CTX *ctx);\nint\tBN_mod_add_quick(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const BIGNUM *m);\nint\tBN_mod_sub(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const BIGNUM *m, BN_CTX *ctx);\nint\tBN_mod_sub_quick(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const BIGNUM *m);\nint\tBN_mod_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b,\n\tconst BIGNUM *m, BN_CTX *ctx);\nint\tBN_mod_sqr(BIGNUM *r, const BIGNUM *a, const BIGNUM *m, BN_CTX *ctx);\nint\tBN_mod_lshift1(BIGNUM *r, const BIGNUM *a, const BIGNUM *m, BN_CTX *ctx);\nint\tBN_mod_lshift1_quick(BIGNUM *r, const BIGNUM *a, const BIGNUM *m);\nint\tBN_mod_lshift(BIGNUM *r, const BIGNUM *a, int n, const BIGNUM *m, BN_CTX *ctx);\nint\tBN_mod_lshift_quick(BIGNUM *r, const BIGNUM *a, int n, const BIGNUM *m);\n\nBN_ULONG BN_mod_word(const BIGNUM *a, BN_ULONG w);\nBN_ULONG BN_div_word(BIGNUM *a, BN_ULONG w);\nint\tBN_mul_word(BIGNUM *a, BN_ULONG w);\nint\tBN_add_word(BIGNUM *a, BN_ULONG w);\nint\tBN_sub_word(BIGNUM *a, BN_ULONG w);\nint\tBN_set_word(BIGNUM *a, BN_ULONG w);\nBN_ULONG BN_get_word(const BIGNUM *a);\n\nint\tBN_cmp(const BIGNUM *a, const BIGNUM *b);\nvoid\tBN_free(BIGNUM *a);\nint\tBN_is_bit_set(const BIGNUM *a, int n);\nint\tBN_lshift(BIGNUM *r, const BIGNUM *a, int n);\nint\tBN_lshift1(BIGNUM *r, const BIGNUM *a);\nint\tBN_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,BN_CTX *ctx);\n\nint\tBN_mod_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,\n\tconst BIGNUM *m,BN_CTX *ctx);\nint\tBN_mod_exp_mont(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,\n\tconst BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx);\nint BN_mod_exp_mont_consttime(BIGNUM *rr, const BIGNUM *a, const BIGNUM *p,\n\tconst BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *in_mont);\nint\tBN_mod_exp_mont_word(BIGNUM *r, BN_ULONG a, const BIGNUM *p,\n\tconst BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx);\nint\tBN_mod_exp2_mont(BIGNUM *r, const BIGNUM *a1, const BIGNUM *p1,\n\tconst BIGNUM *a2, const BIGNUM *p2,const BIGNUM *m,\n\tBN_CTX *ctx,BN_MONT_CTX *m_ctx);\nint\tBN_mod_exp_simple(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,\n\tconst BIGNUM *m,BN_CTX *ctx);\n\nint\tBN_mask_bits(BIGNUM *a,int n);\n#ifndef OPENSSL_NO_FP_API\nint\tBN_print_fp(FILE *fp, const BIGNUM *a);\n#endif\n#ifdef HEADER_BIO_H\nint\tBN_print(BIO *fp, const BIGNUM *a);\n#else\nint\tBN_print(void *fp, const BIGNUM *a);\n#endif\nint\tBN_reciprocal(BIGNUM *r, const BIGNUM *m, int len, BN_CTX *ctx);\nint\tBN_rshift(BIGNUM *r, const BIGNUM *a, int n);\nint\tBN_rshift1(BIGNUM *r, const BIGNUM *a);\nvoid\tBN_clear(BIGNUM *a);\nBIGNUM *BN_dup(const BIGNUM *a);\nint\tBN_ucmp(const BIGNUM *a, const BIGNUM *b);\nint\tBN_set_bit(BIGNUM *a, int n);\nint\tBN_clear_bit(BIGNUM *a, int n);\nchar *\tBN_bn2hex(const BIGNUM *a);\nchar *\tBN_bn2dec(const BIGNUM *a);\nint \tBN_hex2bn(BIGNUM **a, const char *str);\nint \tBN_dec2bn(BIGNUM **a, const char *str);\nint\tBN_gcd(BIGNUM *r,const BIGNUM *a,const BIGNUM *b,BN_CTX *ctx);\nint\tBN_kronecker(const BIGNUM *a,const BIGNUM *b,BN_CTX *ctx); /* returns -2 for error */\nBIGNUM *BN_mod_inverse(BIGNUM *ret,\n\tconst BIGNUM *a, const BIGNUM *n,BN_CTX *ctx);\nBIGNUM *BN_mod_sqrt(BIGNUM *ret,\n\tconst BIGNUM *a, const BIGNUM *n,BN_CTX *ctx);\n\n/* Deprecated versions */\n#ifndef OPENSSL_NO_DEPRECATED\nBIGNUM *BN_generate_prime(BIGNUM *ret,int bits,int safe,\n\tconst BIGNUM *add, const BIGNUM *rem,\n\tvoid (*callback)(int,int,void *),void *cb_arg);\nint\tBN_is_prime(const BIGNUM *p,int nchecks,\n\tvoid (*callback)(int,int,void *),\n\tBN_CTX *ctx,void *cb_arg);\nint\tBN_is_prime_fasttest(const BIGNUM *p,int nchecks,\n\tvoid (*callback)(int,int,void *),BN_CTX *ctx,void *cb_arg,\n\tint do_trial_division);\n#endif /* !defined(OPENSSL_NO_DEPRECATED) */\n\n/* Newer versions */\nint\tBN_generate_prime_ex(BIGNUM *ret,int bits,int safe, const BIGNUM *add,\n\t\tconst BIGNUM *rem, BN_GENCB *cb);\nint\tBN_is_prime_ex(const BIGNUM *p,int nchecks, BN_CTX *ctx, BN_GENCB *cb);\nint\tBN_is_prime_fasttest_ex(const BIGNUM *p,int nchecks, BN_CTX *ctx,\n\t\tint do_trial_division, BN_GENCB *cb);\n\nint BN_X931_generate_Xpq(BIGNUM *Xp, BIGNUM *Xq, int nbits, BN_CTX *ctx);\n\nint BN_X931_derive_prime_ex(BIGNUM *p, BIGNUM *p1, BIGNUM *p2,\n\t\t\tconst BIGNUM *Xp, const BIGNUM *Xp1, const BIGNUM *Xp2,\n\t\t\tconst BIGNUM *e, BN_CTX *ctx, BN_GENCB *cb);\nint BN_X931_generate_prime_ex(BIGNUM *p, BIGNUM *p1, BIGNUM *p2,\n\t\t\tBIGNUM *Xp1, BIGNUM *Xp2,\n\t\t\tconst BIGNUM *Xp,\n\t\t\tconst BIGNUM *e, BN_CTX *ctx,\n\t\t\tBN_GENCB *cb);\n\nBN_MONT_CTX *BN_MONT_CTX_new(void );\nvoid BN_MONT_CTX_init(BN_MONT_CTX *ctx);\nint BN_mod_mul_montgomery(BIGNUM *r,const BIGNUM *a,const BIGNUM *b,\n\tBN_MONT_CTX *mont, BN_CTX *ctx);\n#define BN_to_montgomery(r,a,mont,ctx)\tBN_mod_mul_montgomery(\\\n\t(r),(a),&((mont)->RR),(mont),(ctx))\nint BN_from_montgomery(BIGNUM *r,const BIGNUM *a,\n\tBN_MONT_CTX *mont, BN_CTX *ctx);\nvoid BN_MONT_CTX_free(BN_MONT_CTX *mont);\nint BN_MONT_CTX_set(BN_MONT_CTX *mont,const BIGNUM *mod,BN_CTX *ctx);\nBN_MONT_CTX *BN_MONT_CTX_copy(BN_MONT_CTX *to,BN_MONT_CTX *from);\nBN_MONT_CTX *BN_MONT_CTX_set_locked(BN_MONT_CTX **pmont, int lock,\n\t\t\t\t\tconst BIGNUM *mod, BN_CTX *ctx);\n\n/* BN_BLINDING flags */\n#define\tBN_BLINDING_NO_UPDATE\t0x00000001\n#define\tBN_BLINDING_NO_RECREATE\t0x00000002\n\nBN_BLINDING *BN_BLINDING_new(const BIGNUM *A, const BIGNUM *Ai, /* const */ BIGNUM *mod);\nvoid BN_BLINDING_free(BN_BLINDING *b);\nint BN_BLINDING_update(BN_BLINDING *b,BN_CTX *ctx);\nint BN_BLINDING_convert(BIGNUM *n, BN_BLINDING *b, BN_CTX *ctx);\nint BN_BLINDING_invert(BIGNUM *n, BN_BLINDING *b, BN_CTX *ctx);\nint BN_BLINDING_convert_ex(BIGNUM *n, BIGNUM *r, BN_BLINDING *b, BN_CTX *);\nint BN_BLINDING_invert_ex(BIGNUM *n, const BIGNUM *r, BN_BLINDING *b, BN_CTX *);\nunsigned long BN_BLINDING_get_thread_id(const BN_BLINDING *);\nvoid BN_BLINDING_set_thread_id(BN_BLINDING *, unsigned long);\nunsigned long BN_BLINDING_get_flags(const BN_BLINDING *);\nvoid BN_BLINDING_set_flags(BN_BLINDING *, unsigned long);\nBN_BLINDING *BN_BLINDING_create_param(BN_BLINDING *b,\n\tconst BIGNUM *e, /* const */ BIGNUM *m, BN_CTX *ctx,\n\tint (*bn_mod_exp)(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,\n\t\t\t  const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx),\n\tBN_MONT_CTX *m_ctx);\n\n#ifndef OPENSSL_NO_DEPRECATED\nvoid BN_set_params(int mul,int high,int low,int mont);\nint BN_get_params(int which); /* 0, mul, 1 high, 2 low, 3 mont */\n#endif\n\nvoid\tBN_RECP_CTX_init(BN_RECP_CTX *recp);\nBN_RECP_CTX *BN_RECP_CTX_new(void);\nvoid\tBN_RECP_CTX_free(BN_RECP_CTX *recp);\nint\tBN_RECP_CTX_set(BN_RECP_CTX *recp,const BIGNUM *rdiv,BN_CTX *ctx);\nint\tBN_mod_mul_reciprocal(BIGNUM *r, const BIGNUM *x, const BIGNUM *y,\n\tBN_RECP_CTX *recp,BN_CTX *ctx);\nint\tBN_mod_exp_recp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,\n\tconst BIGNUM *m, BN_CTX *ctx);\nint\tBN_div_recp(BIGNUM *dv, BIGNUM *rem, const BIGNUM *m,\n\tBN_RECP_CTX *recp, BN_CTX *ctx);\n\n/* Functions for arithmetic over binary polynomials represented by BIGNUMs. \n *\n * The BIGNUM::neg property of BIGNUMs representing binary polynomials is\n * ignored.\n *\n * Note that input arguments are not const so that their bit arrays can\n * be expanded to the appropriate size if needed.\n */\n\nint\tBN_GF2m_add(BIGNUM *r, const BIGNUM *a, const BIGNUM *b); /*r = a + b*/\n#define BN_GF2m_sub(r, a, b) BN_GF2m_add(r, a, b)\nint\tBN_GF2m_mod(BIGNUM *r, const BIGNUM *a, const BIGNUM *p); /*r=a mod p*/\nint\tBN_GF2m_mod_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b,\n\tconst BIGNUM *p, BN_CTX *ctx); /* r = (a * b) mod p */\nint\tBN_GF2m_mod_sqr(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,\n\tBN_CTX *ctx); /* r = (a * a) mod p */\nint\tBN_GF2m_mod_inv(BIGNUM *r, const BIGNUM *b, const BIGNUM *p,\n\tBN_CTX *ctx); /* r = (1 / b) mod p */\nint\tBN_GF2m_mod_div(BIGNUM *r, const BIGNUM *a, const BIGNUM *b,\n\tconst BIGNUM *p, BN_CTX *ctx); /* r = (a / b) mod p */\nint\tBN_GF2m_mod_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *b,\n\tconst BIGNUM *p, BN_CTX *ctx); /* r = (a ^ b) mod p */\nint\tBN_GF2m_mod_sqrt(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,\n\tBN_CTX *ctx); /* r = sqrt(a) mod p */\nint\tBN_GF2m_mod_solve_quad(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,\n\tBN_CTX *ctx); /* r^2 + r = a mod p */\n#define BN_GF2m_cmp(a, b) BN_ucmp((a), (b))\n/* Some functions allow for representation of the irreducible polynomials\n * as an unsigned int[], say p.  The irreducible f(t) is then of the form:\n *     t^p[0] + t^p[1] + ... + t^p[k]\n * where m = p[0] > p[1] > ... > p[k] = 0.\n */\nint\tBN_GF2m_mod_arr(BIGNUM *r, const BIGNUM *a, const unsigned int p[]);\n\t/* r = a mod p */\nint\tBN_GF2m_mod_mul_arr(BIGNUM *r, const BIGNUM *a, const BIGNUM *b,\n\tconst unsigned int p[], BN_CTX *ctx); /* r = (a * b) mod p */\nint\tBN_GF2m_mod_sqr_arr(BIGNUM *r, const BIGNUM *a, const unsigned int p[],\n\tBN_CTX *ctx); /* r = (a * a) mod p */\nint\tBN_GF2m_mod_inv_arr(BIGNUM *r, const BIGNUM *b, const unsigned int p[],\n\tBN_CTX *ctx); /* r = (1 / b) mod p */\nint\tBN_GF2m_mod_div_arr(BIGNUM *r, const BIGNUM *a, const BIGNUM *b,\n\tconst unsigned int p[], BN_CTX *ctx); /* r = (a / b) mod p */\nint\tBN_GF2m_mod_exp_arr(BIGNUM *r, const BIGNUM *a, const BIGNUM *b,\n\tconst unsigned int p[], BN_CTX *ctx); /* r = (a ^ b) mod p */\nint\tBN_GF2m_mod_sqrt_arr(BIGNUM *r, const BIGNUM *a,\n\tconst unsigned int p[], BN_CTX *ctx); /* r = sqrt(a) mod p */\nint\tBN_GF2m_mod_solve_quad_arr(BIGNUM *r, const BIGNUM *a,\n\tconst unsigned int p[], BN_CTX *ctx); /* r^2 + r = a mod p */\nint\tBN_GF2m_poly2arr(const BIGNUM *a, unsigned int p[], int max);\nint\tBN_GF2m_arr2poly(const unsigned int p[], BIGNUM *a);\n\n/* faster mod functions for the 'NIST primes' \n * 0 <= a < p^2 */\nint BN_nist_mod_192(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx);\nint BN_nist_mod_224(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx);\nint BN_nist_mod_256(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx);\nint BN_nist_mod_384(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx);\nint BN_nist_mod_521(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx);\n\nconst BIGNUM *BN_get0_nist_prime_192(void);\nconst BIGNUM *BN_get0_nist_prime_224(void);\nconst BIGNUM *BN_get0_nist_prime_256(void);\nconst BIGNUM *BN_get0_nist_prime_384(void);\nconst BIGNUM *BN_get0_nist_prime_521(void);\n\n/* library internal functions */\n\n#define bn_expand(a,bits) ((((((bits+BN_BITS2-1))/BN_BITS2)) <= (a)->dmax)?\\\n\t(a):bn_expand2((a),(bits+BN_BITS2-1)/BN_BITS2))\n#define bn_wexpand(a,words) (((words) <= (a)->dmax)?(a):bn_expand2((a),(words)))\nBIGNUM *bn_expand2(BIGNUM *a, int words);\n#ifndef OPENSSL_NO_DEPRECATED\nBIGNUM *bn_dup_expand(const BIGNUM *a, int words); /* unused */\n#endif\n\n/* Bignum consistency macros\n * There is one \"API\" macro, bn_fix_top(), for stripping leading zeroes from\n * bignum data after direct manipulations on the data. There is also an\n * \"internal\" macro, bn_check_top(), for verifying that there are no leading\n * zeroes. Unfortunately, some auditing is required due to the fact that\n * bn_fix_top() has become an overabused duct-tape because bignum data is\n * occasionally passed around in an inconsistent state. So the following\n * changes have been made to sort this out;\n * - bn_fix_top()s implementation has been moved to bn_correct_top()\n * - if BN_DEBUG isn't defined, bn_fix_top() maps to bn_correct_top(), and\n *   bn_check_top() is as before.\n * - if BN_DEBUG *is* defined;\n *   - bn_check_top() tries to pollute unused words even if the bignum 'top' is\n *     consistent. (ed: only if BN_DEBUG_RAND is defined)\n *   - bn_fix_top() maps to bn_check_top() rather than \"fixing\" anything.\n * The idea is to have debug builds flag up inconsistent bignums when they\n * occur. If that occurs in a bn_fix_top(), we examine the code in question; if\n * the use of bn_fix_top() was appropriate (ie. it follows directly after code\n * that manipulates the bignum) it is converted to bn_correct_top(), and if it\n * was not appropriate, we convert it permanently to bn_check_top() and track\n * down the cause of the bug. Eventually, no internal code should be using the\n * bn_fix_top() macro. External applications and libraries should try this with\n * their own code too, both in terms of building against the openssl headers\n * with BN_DEBUG defined *and* linking with a version of OpenSSL built with it\n * defined. This not only improves external code, it provides more test\n * coverage for openssl's own code.\n */\n\n#ifdef BN_DEBUG\n\n/* We only need assert() when debugging */\n#include <assert.h>\n\n#ifdef BN_DEBUG_RAND\n/* To avoid \"make update\" cvs wars due to BN_DEBUG, use some tricks */\n#ifndef RAND_pseudo_bytes\nint RAND_pseudo_bytes(unsigned char *buf,int num);\n#define BN_DEBUG_TRIX\n#endif\n#define bn_pollute(a) \\\n\tdo { \\\n\t\tconst BIGNUM *_bnum1 = (a); \\\n\t\tif(_bnum1->top < _bnum1->dmax) { \\\n\t\t\tunsigned char _tmp_char; \\\n\t\t\t/* We cast away const without the compiler knowing, any \\\n\t\t\t * *genuinely* constant variables that aren't mutable \\\n\t\t\t * wouldn't be constructed with top!=dmax. */ \\\n\t\t\tBN_ULONG *_not_const; \\\n\t\t\tmemcpy(&_not_const, &_bnum1->d, sizeof(BN_ULONG*)); \\\n\t\t\tRAND_pseudo_bytes(&_tmp_char, 1); \\\n\t\t\tmemset((unsigned char *)(_not_const + _bnum1->top), _tmp_char, \\\n\t\t\t\t(_bnum1->dmax - _bnum1->top) * sizeof(BN_ULONG)); \\\n\t\t} \\\n\t} while(0)\n#ifdef BN_DEBUG_TRIX\n#undef RAND_pseudo_bytes\n#endif\n#else\n#define bn_pollute(a)\n#endif\n#define bn_check_top(a) \\\n\tdo { \\\n\t\tconst BIGNUM *_bnum2 = (a); \\\n\t\tif (_bnum2 != NULL) { \\\n\t\t\tassert((_bnum2->top == 0) || \\\n\t\t\t\t(_bnum2->d[_bnum2->top - 1] != 0)); \\\n\t\t\tbn_pollute(_bnum2); \\\n\t\t} \\\n\t} while(0)\n\n#define bn_fix_top(a)\t\tbn_check_top(a)\n\n#else /* !BN_DEBUG */\n\n#define bn_pollute(a)\n#define bn_check_top(a)\n#define bn_fix_top(a)\t\tbn_correct_top(a)\n\n#endif\n\n#define bn_correct_top(a) \\\n        { \\\n        BN_ULONG *ftl; \\\n\tif ((a)->top > 0) \\\n\t\t{ \\\n\t\tfor (ftl= &((a)->d[(a)->top-1]); (a)->top > 0; (a)->top--) \\\n\t\tif (*(ftl--)) break; \\\n\t\t} \\\n\tbn_pollute(a); \\\n\t}\n\nBN_ULONG bn_mul_add_words(BN_ULONG *rp, const BN_ULONG *ap, int num, BN_ULONG w);\nBN_ULONG bn_mul_words(BN_ULONG *rp, const BN_ULONG *ap, int num, BN_ULONG w);\nvoid     bn_sqr_words(BN_ULONG *rp, const BN_ULONG *ap, int num);\nBN_ULONG bn_div_words(BN_ULONG h, BN_ULONG l, BN_ULONG d);\nBN_ULONG bn_add_words(BN_ULONG *rp, const BN_ULONG *ap, const BN_ULONG *bp,int num);\nBN_ULONG bn_sub_words(BN_ULONG *rp, const BN_ULONG *ap, const BN_ULONG *bp,int num);\n\n/* Primes from RFC 2409 */\nBIGNUM *get_rfc2409_prime_768(BIGNUM *bn);\nBIGNUM *get_rfc2409_prime_1024(BIGNUM *bn);\n\n/* Primes from RFC 3526 */\nBIGNUM *get_rfc3526_prime_1536(BIGNUM *bn);\nBIGNUM *get_rfc3526_prime_2048(BIGNUM *bn);\nBIGNUM *get_rfc3526_prime_3072(BIGNUM *bn);\nBIGNUM *get_rfc3526_prime_4096(BIGNUM *bn);\nBIGNUM *get_rfc3526_prime_6144(BIGNUM *bn);\nBIGNUM *get_rfc3526_prime_8192(BIGNUM *bn);\n\nint BN_bntest_rand(BIGNUM *rnd, int bits, int top,int bottom);\n\n/* BEGIN ERROR CODES */\n/* The following lines are auto generated by the script mkerr.pl. Any changes\n * made after this point may be overwritten when the script is next run.\n */\nvoid ERR_load_BN_strings(void);\n\n/* Error codes for the BN functions. */\n\n/* Function codes. */\n#define BN_F_BNRAND\t\t\t\t\t 127\n#define BN_F_BN_BLINDING_CONVERT_EX\t\t\t 100\n#define BN_F_BN_BLINDING_CREATE_PARAM\t\t\t 128\n#define BN_F_BN_BLINDING_INVERT_EX\t\t\t 101\n#define BN_F_BN_BLINDING_NEW\t\t\t\t 102\n#define BN_F_BN_BLINDING_UPDATE\t\t\t\t 103\n#define BN_F_BN_BN2DEC\t\t\t\t\t 104\n#define BN_F_BN_BN2HEX\t\t\t\t\t 105\n#define BN_F_BN_CTX_GET\t\t\t\t\t 116\n#define BN_F_BN_CTX_NEW\t\t\t\t\t 106\n#define BN_F_BN_CTX_START\t\t\t\t 129\n#define BN_F_BN_DIV\t\t\t\t\t 107\n#define BN_F_BN_DIV_NO_BRANCH\t\t\t\t 138\n#define BN_F_BN_DIV_RECP\t\t\t\t 130\n#define BN_F_BN_EXP\t\t\t\t\t 123\n#define BN_F_BN_EXPAND2\t\t\t\t\t 108\n#define BN_F_BN_EXPAND_INTERNAL\t\t\t\t 120\n#define BN_F_BN_GF2M_MOD\t\t\t\t 131\n#define BN_F_BN_GF2M_MOD_EXP\t\t\t\t 132\n#define BN_F_BN_GF2M_MOD_MUL\t\t\t\t 133\n#define BN_F_BN_GF2M_MOD_SOLVE_QUAD\t\t\t 134\n#define BN_F_BN_GF2M_MOD_SOLVE_QUAD_ARR\t\t\t 135\n#define BN_F_BN_GF2M_MOD_SQR\t\t\t\t 136\n#define BN_F_BN_GF2M_MOD_SQRT\t\t\t\t 137\n#define BN_F_BN_MOD_EXP2_MONT\t\t\t\t 118\n#define BN_F_BN_MOD_EXP_MONT\t\t\t\t 109\n#define BN_F_BN_MOD_EXP_MONT_CONSTTIME\t\t\t 124\n#define BN_F_BN_MOD_EXP_MONT_WORD\t\t\t 117\n#define BN_F_BN_MOD_EXP_RECP\t\t\t\t 125\n#define BN_F_BN_MOD_EXP_SIMPLE\t\t\t\t 126\n#define BN_F_BN_MOD_INVERSE\t\t\t\t 110\n#define BN_F_BN_MOD_INVERSE_NO_BRANCH\t\t\t 139\n#define BN_F_BN_MOD_LSHIFT_QUICK\t\t\t 119\n#define BN_F_BN_MOD_MUL_RECIPROCAL\t\t\t 111\n#define BN_F_BN_MOD_SQRT\t\t\t\t 121\n#define BN_F_BN_MPI2BN\t\t\t\t\t 112\n#define BN_F_BN_NEW\t\t\t\t\t 113\n#define BN_F_BN_RAND\t\t\t\t\t 114\n#define BN_F_BN_RAND_RANGE\t\t\t\t 122\n#define BN_F_BN_USUB\t\t\t\t\t 115\n\n/* Reason codes. */\n#define BN_R_ARG2_LT_ARG3\t\t\t\t 100\n#define BN_R_BAD_RECIPROCAL\t\t\t\t 101\n#define BN_R_BIGNUM_TOO_LONG\t\t\t\t 114\n#define BN_R_CALLED_WITH_EVEN_MODULUS\t\t\t 102\n#define BN_R_DIV_BY_ZERO\t\t\t\t 103\n#define BN_R_ENCODING_ERROR\t\t\t\t 104\n#define BN_R_EXPAND_ON_STATIC_BIGNUM_DATA\t\t 105\n#define BN_R_INPUT_NOT_REDUCED\t\t\t\t 110\n#define BN_R_INVALID_LENGTH\t\t\t\t 106\n#define BN_R_INVALID_RANGE\t\t\t\t 115\n#define BN_R_NOT_A_SQUARE\t\t\t\t 111\n#define BN_R_NOT_INITIALIZED\t\t\t\t 107\n#define BN_R_NO_INVERSE\t\t\t\t\t 108\n#define BN_R_NO_SOLUTION\t\t\t\t 116\n#define BN_R_P_IS_NOT_PRIME\t\t\t\t 112\n#define BN_R_TOO_MANY_ITERATIONS\t\t\t 113\n#define BN_R_TOO_MANY_TEMPORARY_VARIABLES\t\t 109\n\n#ifdef  __cplusplus\n}\n#endif\n#endif\n"
  },
  {
    "path": "freebsd-headers/openssl/buffer.h",
    "content": "/* crypto/buffer/buffer.h */\n/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)\n * All rights reserved.\n *\n * This package is an SSL implementation written\n * by Eric Young (eay@cryptsoft.com).\n * The implementation was written so as to conform with Netscapes SSL.\n * \n * This library is free for commercial and non-commercial use as long as\n * the following conditions are aheared to.  The following conditions\n * apply to all code found in this distribution, be it the RC4, RSA,\n * lhash, DES, etc., code; not just the SSL code.  The SSL documentation\n * included with this distribution is covered by the same copyright terms\n * except that the holder is Tim Hudson (tjh@cryptsoft.com).\n * \n * Copyright remains Eric Young's, and as such any Copyright notices in\n * the code are not to be removed.\n * If this package is used in a product, Eric Young should be given attribution\n * as the author of the parts of the library used.\n * This can be in the form of a textual message at program startup or\n * in documentation (online or textual) provided with the package.\n * \n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. All advertising materials mentioning features or use of this software\n *    must display the following acknowledgement:\n *    \"This product includes cryptographic software written by\n *     Eric Young (eay@cryptsoft.com)\"\n *    The word 'cryptographic' can be left out if the rouines from the library\n *    being used are not cryptographic related :-).\n * 4. If you include any Windows specific code (or a derivative thereof) from \n *    the apps directory (application code) you must include an acknowledgement:\n *    \"This product includes software written by Tim Hudson (tjh@cryptsoft.com)\"\n * \n * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n * \n * The licence and distribution terms for any publically available version or\n * derivative of this code cannot be changed.  i.e. this code cannot simply be\n * copied and put under another distribution licence\n * [including the GNU Public Licence.]\n */\n\n#ifndef HEADER_BUFFER_H\n#define HEADER_BUFFER_H\n\n#include <openssl/ossl_typ.h>\n\n#ifdef  __cplusplus\nextern \"C\" {\n#endif\n\n#include <stddef.h>\n\n#if !defined(NO_SYS_TYPES_H)\n#include <sys/types.h>\n#endif\n\n/* Already declared in ossl_typ.h */\n/* typedef struct buf_mem_st BUF_MEM; */\n\nstruct buf_mem_st\n\t{\n\tint length;\t/* current number of bytes */\n\tchar *data;\n\tint max;\t/* size of buffer */\n\t};\n\nBUF_MEM *BUF_MEM_new(void);\nvoid\tBUF_MEM_free(BUF_MEM *a);\nint\tBUF_MEM_grow(BUF_MEM *str, int len);\nint\tBUF_MEM_grow_clean(BUF_MEM *str, int len);\nchar *\tBUF_strdup(const char *str);\nchar *\tBUF_strndup(const char *str, size_t siz);\nvoid *\tBUF_memdup(const void *data, size_t siz);\n\n/* safe string functions */\nsize_t BUF_strlcpy(char *dst,const char *src,size_t siz);\nsize_t BUF_strlcat(char *dst,const char *src,size_t siz);\n\n\n/* BEGIN ERROR CODES */\n/* The following lines are auto generated by the script mkerr.pl. Any changes\n * made after this point may be overwritten when the script is next run.\n */\nvoid ERR_load_BUF_strings(void);\n\n/* Error codes for the BUF functions. */\n\n/* Function codes. */\n#define BUF_F_BUF_MEMDUP\t\t\t\t 103\n#define BUF_F_BUF_MEM_GROW\t\t\t\t 100\n#define BUF_F_BUF_MEM_GROW_CLEAN\t\t\t 105\n#define BUF_F_BUF_MEM_NEW\t\t\t\t 101\n#define BUF_F_BUF_STRDUP\t\t\t\t 102\n#define BUF_F_BUF_STRNDUP\t\t\t\t 104\n\n/* Reason codes. */\n\n#ifdef  __cplusplus\n}\n#endif\n#endif\n"
  },
  {
    "path": "freebsd-headers/openssl/camellia.h",
    "content": "/* crypto/camellia/camellia.h -*- mode:C; c-file-style: \"eay\" -*- */\n/* ====================================================================\n * Copyright (c) 2006 The OpenSSL Project.  All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n *\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer. \n *\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in\n *    the documentation and/or other materials provided with the\n *    distribution.\n *\n * 3. All advertising materials mentioning features or use of this\n *    software must display the following acknowledgment:\n *    \"This product includes software developed by the OpenSSL Project\n *    for use in the OpenSSL Toolkit. (http://www.openssl.org/)\"\n *\n * 4. The names \"OpenSSL Toolkit\" and \"OpenSSL Project\" must not be used to\n *    endorse or promote products derived from this software without\n *    prior written permission. For written permission, please contact\n *    openssl-core@openssl.org.\n *\n * 5. Products derived from this software may not be called \"OpenSSL\"\n *    nor may \"OpenSSL\" appear in their names without prior written\n *    permission of the OpenSSL Project.\n *\n * 6. Redistributions of any form whatsoever must retain the following\n *    acknowledgment:\n *    \"This product includes software developed by the OpenSSL Project\n *    for use in the OpenSSL Toolkit (http://www.openssl.org/)\"\n *\n * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY\n * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\n * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE OpenSSL PROJECT OR\n * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\n * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,\n * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED\n * OF THE POSSIBILITY OF SUCH DAMAGE.\n * ====================================================================\n *\n */\n\n#ifndef HEADER_CAMELLIA_H\n#define HEADER_CAMELLIA_H\n\n#include <openssl/opensslconf.h>\n\n#ifdef OPENSSL_NO_CAMELLIA\n#error CAMELLIA is disabled.\n#endif\n\n#define CAMELLIA_ENCRYPT\t1\n#define CAMELLIA_DECRYPT\t0\n\n/* Because array size can't be a const in C, the following two are macros.\n   Both sizes are in bytes. */\n\n#ifdef  __cplusplus\nextern \"C\" {\n#endif\n\n/* This should be a hidden type, but EVP requires that the size be known */\n\n#define CAMELLIA_BLOCK_SIZE 16\n#define CAMELLIA_TABLE_BYTE_LEN 272\n#define CAMELLIA_TABLE_WORD_LEN (CAMELLIA_TABLE_BYTE_LEN / 4)\n\n /* to match with WORD */\ntypedef unsigned int KEY_TABLE_TYPE[CAMELLIA_TABLE_WORD_LEN];\n\nstruct camellia_key_st \n\t{\n\tKEY_TABLE_TYPE rd_key;\n\tint bitLength;\n\tvoid (*enc)(const unsigned int *subkey, unsigned int *io);\n\tvoid (*dec)(const unsigned int *subkey, unsigned int *io);\n\t};\n\ntypedef struct camellia_key_st CAMELLIA_KEY;\n\n#ifdef OPENSSL_FIPS\nint private_Camellia_set_key(const unsigned char *userKey, const int bits,\n\tCAMELLIA_KEY *key);\n#endif\n\nint Camellia_set_key(const unsigned char *userKey, const int bits,\n\tCAMELLIA_KEY *key);\n\nvoid Camellia_encrypt(const unsigned char *in, unsigned char *out,\n\tconst CAMELLIA_KEY *key);\nvoid Camellia_decrypt(const unsigned char *in, unsigned char *out,\n\tconst CAMELLIA_KEY *key);\n\nvoid Camellia_ecb_encrypt(const unsigned char *in, unsigned char *out,\n\tconst CAMELLIA_KEY *key, const int enc);\nvoid Camellia_cbc_encrypt(const unsigned char *in, unsigned char *out,\n\tconst unsigned long length, const CAMELLIA_KEY *key,\n\tunsigned char *ivec, const int enc);\nvoid Camellia_cfb128_encrypt(const unsigned char *in, unsigned char *out,\n\tconst unsigned long length, const CAMELLIA_KEY *key,\n\tunsigned char *ivec, int *num, const int enc);\nvoid Camellia_cfb1_encrypt(const unsigned char *in, unsigned char *out,\n\tconst unsigned long length, const CAMELLIA_KEY *key,\n\tunsigned char *ivec, int *num, const int enc);\nvoid Camellia_cfb8_encrypt(const unsigned char *in, unsigned char *out,\n\tconst unsigned long length, const CAMELLIA_KEY *key,\n\tunsigned char *ivec, int *num, const int enc);\nvoid Camellia_cfbr_encrypt_block(const unsigned char *in,unsigned char *out,\n\tconst int nbits,const CAMELLIA_KEY *key,\n\tunsigned char *ivec,const int enc);\nvoid Camellia_ofb128_encrypt(const unsigned char *in, unsigned char *out,\n\tconst unsigned long length, const CAMELLIA_KEY *key,\n\tunsigned char *ivec, int *num);\nvoid Camellia_ctr128_encrypt(const unsigned char *in, unsigned char *out,\n\tconst unsigned long length, const CAMELLIA_KEY *key,\n\tunsigned char ivec[CAMELLIA_BLOCK_SIZE],\n\tunsigned char ecount_buf[CAMELLIA_BLOCK_SIZE],\n\tunsigned int *num);\n\n#ifdef  __cplusplus\n}\n#endif\n\n#endif /* !HEADER_Camellia_H */\n\n"
  },
  {
    "path": "freebsd-headers/openssl/cast.h",
    "content": "/* crypto/cast/cast.h */\n/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)\n * All rights reserved.\n *\n * This package is an SSL implementation written\n * by Eric Young (eay@cryptsoft.com).\n * The implementation was written so as to conform with Netscapes SSL.\n * \n * This library is free for commercial and non-commercial use as long as\n * the following conditions are aheared to.  The following conditions\n * apply to all code found in this distribution, be it the RC4, RSA,\n * lhash, DES, etc., code; not just the SSL code.  The SSL documentation\n * included with this distribution is covered by the same copyright terms\n * except that the holder is Tim Hudson (tjh@cryptsoft.com).\n * \n * Copyright remains Eric Young's, and as such any Copyright notices in\n * the code are not to be removed.\n * If this package is used in a product, Eric Young should be given attribution\n * as the author of the parts of the library used.\n * This can be in the form of a textual message at program startup or\n * in documentation (online or textual) provided with the package.\n * \n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. All advertising materials mentioning features or use of this software\n *    must display the following acknowledgement:\n *    \"This product includes cryptographic software written by\n *     Eric Young (eay@cryptsoft.com)\"\n *    The word 'cryptographic' can be left out if the rouines from the library\n *    being used are not cryptographic related :-).\n * 4. If you include any Windows specific code (or a derivative thereof) from \n *    the apps directory (application code) you must include an acknowledgement:\n *    \"This product includes software written by Tim Hudson (tjh@cryptsoft.com)\"\n * \n * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n * \n * The licence and distribution terms for any publically available version or\n * derivative of this code cannot be changed.  i.e. this code cannot simply be\n * copied and put under another distribution licence\n * [including the GNU Public Licence.]\n */\n\n#ifndef HEADER_CAST_H\n#define HEADER_CAST_H\n\n#ifdef  __cplusplus\nextern \"C\" {\n#endif\n\n#include <openssl/opensslconf.h>\n\n#ifdef OPENSSL_NO_CAST\n#error CAST is disabled.\n#endif\n\n#define CAST_ENCRYPT\t1\n#define CAST_DECRYPT\t0\n\n#define CAST_LONG unsigned long\n\n#define CAST_BLOCK\t8\n#define CAST_KEY_LENGTH\t16\n\ntypedef struct cast_key_st\n\t{\n\tCAST_LONG data[32];\n\tint short_key;\t/* Use reduced rounds for short key */\n\t} CAST_KEY;\n\n#ifdef OPENSSL_FIPS \nvoid private_CAST_set_key(CAST_KEY *key, int len, const unsigned char *data);\n#endif\nvoid CAST_set_key(CAST_KEY *key, int len, const unsigned char *data);\nvoid CAST_ecb_encrypt(const unsigned char *in, unsigned char *out, const CAST_KEY *key,\n\t\t      int enc);\nvoid CAST_encrypt(CAST_LONG *data, const CAST_KEY *key);\nvoid CAST_decrypt(CAST_LONG *data, const CAST_KEY *key);\nvoid CAST_cbc_encrypt(const unsigned char *in, unsigned char *out, long length,\n\t\t      const CAST_KEY *ks, unsigned char *iv, int enc);\nvoid CAST_cfb64_encrypt(const unsigned char *in, unsigned char *out,\n\t\t\tlong length, const CAST_KEY *schedule, unsigned char *ivec,\n\t\t\tint *num, int enc);\nvoid CAST_ofb64_encrypt(const unsigned char *in, unsigned char *out, \n\t\t\tlong length, const CAST_KEY *schedule, unsigned char *ivec,\n\t\t\tint *num);\n\n#ifdef  __cplusplus\n}\n#endif\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/openssl/comp.h",
    "content": "\n#ifndef HEADER_COMP_H\n#define HEADER_COMP_H\n\n#include <openssl/crypto.h>\n\n#ifdef  __cplusplus\nextern \"C\" {\n#endif\n\ntypedef struct comp_ctx_st COMP_CTX;\n\ntypedef struct comp_method_st\n\t{\n\tint type;\t\t/* NID for compression library */\n\tconst char *name;\t/* A text string to identify the library */\n\tint (*init)(COMP_CTX *ctx);\n\tvoid (*finish)(COMP_CTX *ctx);\n\tint (*compress)(COMP_CTX *ctx,\n\t\t\tunsigned char *out, unsigned int olen,\n\t\t\tunsigned char *in, unsigned int ilen);\n\tint (*expand)(COMP_CTX *ctx,\n\t\t      unsigned char *out, unsigned int olen,\n\t\t      unsigned char *in, unsigned int ilen);\n\t/* The following two do NOTHING, but are kept for backward compatibility */\n\tlong (*ctrl)(void);\n\tlong (*callback_ctrl)(void);\n\t} COMP_METHOD;\n\nstruct comp_ctx_st\n\t{\n\tCOMP_METHOD *meth;\n\tunsigned long compress_in;\n\tunsigned long compress_out;\n\tunsigned long expand_in;\n\tunsigned long expand_out;\n\n\tCRYPTO_EX_DATA\tex_data;\n\t};\n\n\nCOMP_CTX *COMP_CTX_new(COMP_METHOD *meth);\nvoid COMP_CTX_free(COMP_CTX *ctx);\nint COMP_compress_block(COMP_CTX *ctx, unsigned char *out, int olen,\n\tunsigned char *in, int ilen);\nint COMP_expand_block(COMP_CTX *ctx, unsigned char *out, int olen,\n\tunsigned char *in, int ilen);\nCOMP_METHOD *COMP_rle(void );\nCOMP_METHOD *COMP_zlib(void );\nvoid COMP_zlib_cleanup(void);\n\n#ifdef HEADER_BIO_H\n#ifdef ZLIB\nBIO_METHOD *BIO_f_zlib(void);\n#endif\n#endif\n\n/* BEGIN ERROR CODES */\n/* The following lines are auto generated by the script mkerr.pl. Any changes\n * made after this point may be overwritten when the script is next run.\n */\nvoid ERR_load_COMP_strings(void);\n\n/* Error codes for the COMP functions. */\n\n/* Function codes. */\n#define COMP_F_BIO_ZLIB_FLUSH\t\t\t\t 99\n#define COMP_F_BIO_ZLIB_NEW\t\t\t\t 100\n#define COMP_F_BIO_ZLIB_READ\t\t\t\t 101\n#define COMP_F_BIO_ZLIB_WRITE\t\t\t\t 102\n\n/* Reason codes. */\n#define COMP_R_ZLIB_DEFLATE_ERROR\t\t\t 99\n#define COMP_R_ZLIB_INFLATE_ERROR\t\t\t 100\n#define COMP_R_ZLIB_NOT_SUPPORTED\t\t\t 101\n\n#ifdef  __cplusplus\n}\n#endif\n#endif\n"
  },
  {
    "path": "freebsd-headers/openssl/conf.h",
    "content": "/* crypto/conf/conf.h */\n/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)\n * All rights reserved.\n *\n * This package is an SSL implementation written\n * by Eric Young (eay@cryptsoft.com).\n * The implementation was written so as to conform with Netscapes SSL.\n * \n * This library is free for commercial and non-commercial use as long as\n * the following conditions are aheared to.  The following conditions\n * apply to all code found in this distribution, be it the RC4, RSA,\n * lhash, DES, etc., code; not just the SSL code.  The SSL documentation\n * included with this distribution is covered by the same copyright terms\n * except that the holder is Tim Hudson (tjh@cryptsoft.com).\n * \n * Copyright remains Eric Young's, and as such any Copyright notices in\n * the code are not to be removed.\n * If this package is used in a product, Eric Young should be given attribution\n * as the author of the parts of the library used.\n * This can be in the form of a textual message at program startup or\n * in documentation (online or textual) provided with the package.\n * \n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. All advertising materials mentioning features or use of this software\n *    must display the following acknowledgement:\n *    \"This product includes cryptographic software written by\n *     Eric Young (eay@cryptsoft.com)\"\n *    The word 'cryptographic' can be left out if the rouines from the library\n *    being used are not cryptographic related :-).\n * 4. If you include any Windows specific code (or a derivative thereof) from \n *    the apps directory (application code) you must include an acknowledgement:\n *    \"This product includes software written by Tim Hudson (tjh@cryptsoft.com)\"\n * \n * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n * \n * The licence and distribution terms for any publically available version or\n * derivative of this code cannot be changed.  i.e. this code cannot simply be\n * copied and put under another distribution licence\n * [including the GNU Public Licence.]\n */\n\n#ifndef  HEADER_CONF_H\n#define HEADER_CONF_H\n\n#include <openssl/bio.h>\n#include <openssl/lhash.h>\n#include <openssl/stack.h>\n#include <openssl/safestack.h>\n#include <openssl/e_os2.h>\n\n#include <openssl/ossl_typ.h>\n\n#ifdef  __cplusplus\nextern \"C\" {\n#endif\n\ntypedef struct\n\t{\n\tchar *section;\n\tchar *name;\n\tchar *value;\n\t} CONF_VALUE;\n\nDECLARE_STACK_OF(CONF_VALUE)\nDECLARE_STACK_OF(CONF_MODULE)\nDECLARE_STACK_OF(CONF_IMODULE)\n\nstruct conf_st;\nstruct conf_method_st;\ntypedef struct conf_method_st CONF_METHOD;\n\nstruct conf_method_st\n\t{\n\tconst char *name;\n\tCONF *(*create)(CONF_METHOD *meth);\n\tint (*init)(CONF *conf);\n\tint (*destroy)(CONF *conf);\n\tint (*destroy_data)(CONF *conf);\n\tint (*load_bio)(CONF *conf, BIO *bp, long *eline);\n\tint (*dump)(const CONF *conf, BIO *bp);\n\tint (*is_number)(const CONF *conf, char c);\n\tint (*to_int)(const CONF *conf, char c);\n\tint (*load)(CONF *conf, const char *name, long *eline);\n\t};\n\n/* Module definitions */\n\ntypedef struct conf_imodule_st CONF_IMODULE;\ntypedef struct conf_module_st CONF_MODULE;\n\n/* DSO module function typedefs */\ntypedef int conf_init_func(CONF_IMODULE *md, const CONF *cnf);\ntypedef void conf_finish_func(CONF_IMODULE *md);\n\n#define\tCONF_MFLAGS_IGNORE_ERRORS\t0x1\n#define CONF_MFLAGS_IGNORE_RETURN_CODES\t0x2\n#define CONF_MFLAGS_SILENT\t\t0x4\n#define CONF_MFLAGS_NO_DSO\t\t0x8\n#define CONF_MFLAGS_IGNORE_MISSING_FILE\t0x10\n#define CONF_MFLAGS_DEFAULT_SECTION\t0x20\n\nint CONF_set_default_method(CONF_METHOD *meth);\nvoid CONF_set_nconf(CONF *conf,LHASH *hash);\nLHASH *CONF_load(LHASH *conf,const char *file,long *eline);\n#ifndef OPENSSL_NO_FP_API\nLHASH *CONF_load_fp(LHASH *conf, FILE *fp,long *eline);\n#endif\nLHASH *CONF_load_bio(LHASH *conf, BIO *bp,long *eline);\nSTACK_OF(CONF_VALUE) *CONF_get_section(LHASH *conf,const char *section);\nchar *CONF_get_string(LHASH *conf,const char *group,const char *name);\nlong CONF_get_number(LHASH *conf,const char *group,const char *name);\nvoid CONF_free(LHASH *conf);\nint CONF_dump_fp(LHASH *conf, FILE *out);\nint CONF_dump_bio(LHASH *conf, BIO *out);\n\nvoid OPENSSL_config(const char *config_name);\nvoid OPENSSL_no_config(void);\n\n/* New conf code.  The semantics are different from the functions above.\n   If that wasn't the case, the above functions would have been replaced */\n\nstruct conf_st\n\t{\n\tCONF_METHOD *meth;\n\tvoid *meth_data;\n\tLHASH *data;\n\t};\n\nCONF *NCONF_new(CONF_METHOD *meth);\nCONF_METHOD *NCONF_default(void);\nCONF_METHOD *NCONF_WIN32(void);\n#if 0 /* Just to give you an idea of what I have in mind */\nCONF_METHOD *NCONF_XML(void);\n#endif\nvoid NCONF_free(CONF *conf);\nvoid NCONF_free_data(CONF *conf);\n\nint NCONF_load(CONF *conf,const char *file,long *eline);\n#ifndef OPENSSL_NO_FP_API\nint NCONF_load_fp(CONF *conf, FILE *fp,long *eline);\n#endif\nint NCONF_load_bio(CONF *conf, BIO *bp,long *eline);\nSTACK_OF(CONF_VALUE) *NCONF_get_section(const CONF *conf,const char *section);\nchar *NCONF_get_string(const CONF *conf,const char *group,const char *name);\nint NCONF_get_number_e(const CONF *conf,const char *group,const char *name,\n\t\t       long *result);\nint NCONF_dump_fp(const CONF *conf, FILE *out);\nint NCONF_dump_bio(const CONF *conf, BIO *out);\n\n#if 0 /* The following function has no error checking,\n\t and should therefore be avoided */\nlong NCONF_get_number(CONF *conf,char *group,char *name);\n#else\n#define NCONF_get_number(c,g,n,r) NCONF_get_number_e(c,g,n,r)\n#endif\n  \n/* Module functions */\n\nint CONF_modules_load(const CONF *cnf, const char *appname,\n\t\t      unsigned long flags);\nint CONF_modules_load_file(const char *filename, const char *appname,\n\t\t\t   unsigned long flags);\nvoid CONF_modules_unload(int all);\nvoid CONF_modules_finish(void);\nvoid CONF_modules_free(void);\nint CONF_module_add(const char *name, conf_init_func *ifunc,\n\t\t    conf_finish_func *ffunc);\n\nconst char *CONF_imodule_get_name(const CONF_IMODULE *md);\nconst char *CONF_imodule_get_value(const CONF_IMODULE *md);\nvoid *CONF_imodule_get_usr_data(const CONF_IMODULE *md);\nvoid CONF_imodule_set_usr_data(CONF_IMODULE *md, void *usr_data);\nCONF_MODULE *CONF_imodule_get_module(const CONF_IMODULE *md);\nunsigned long CONF_imodule_get_flags(const CONF_IMODULE *md);\nvoid CONF_imodule_set_flags(CONF_IMODULE *md, unsigned long flags);\nvoid *CONF_module_get_usr_data(CONF_MODULE *pmod);\nvoid CONF_module_set_usr_data(CONF_MODULE *pmod, void *usr_data);\n\nchar *CONF_get1_default_config_file(void);\n\nint CONF_parse_list(const char *list, int sep, int nospc,\n\tint (*list_cb)(const char *elem, int len, void *usr), void *arg);\n\nvoid OPENSSL_load_builtin_modules(void);\n\n/* BEGIN ERROR CODES */\n/* The following lines are auto generated by the script mkerr.pl. Any changes\n * made after this point may be overwritten when the script is next run.\n */\nvoid ERR_load_CONF_strings(void);\n\n/* Error codes for the CONF functions. */\n\n/* Function codes. */\n#define CONF_F_CONF_DUMP_FP\t\t\t\t 104\n#define CONF_F_CONF_LOAD\t\t\t\t 100\n#define CONF_F_CONF_LOAD_BIO\t\t\t\t 102\n#define CONF_F_CONF_LOAD_FP\t\t\t\t 103\n#define CONF_F_CONF_MODULES_LOAD\t\t\t 116\n#define CONF_F_DEF_LOAD\t\t\t\t\t 120\n#define CONF_F_DEF_LOAD_BIO\t\t\t\t 121\n#define CONF_F_MODULE_INIT\t\t\t\t 115\n#define CONF_F_MODULE_LOAD_DSO\t\t\t\t 117\n#define CONF_F_MODULE_RUN\t\t\t\t 118\n#define CONF_F_NCONF_DUMP_BIO\t\t\t\t 105\n#define CONF_F_NCONF_DUMP_FP\t\t\t\t 106\n#define CONF_F_NCONF_GET_NUMBER\t\t\t\t 107\n#define CONF_F_NCONF_GET_NUMBER_E\t\t\t 112\n#define CONF_F_NCONF_GET_SECTION\t\t\t 108\n#define CONF_F_NCONF_GET_STRING\t\t\t\t 109\n#define CONF_F_NCONF_LOAD\t\t\t\t 113\n#define CONF_F_NCONF_LOAD_BIO\t\t\t\t 110\n#define CONF_F_NCONF_LOAD_FP\t\t\t\t 114\n#define CONF_F_NCONF_NEW\t\t\t\t 111\n#define CONF_F_STR_COPY\t\t\t\t\t 101\n\n/* Reason codes. */\n#define CONF_R_ERROR_LOADING_DSO\t\t\t 110\n#define CONF_R_MISSING_CLOSE_SQUARE_BRACKET\t\t 100\n#define CONF_R_MISSING_EQUAL_SIGN\t\t\t 101\n#define CONF_R_MISSING_FINISH_FUNCTION\t\t\t 111\n#define CONF_R_MISSING_INIT_FUNCTION\t\t\t 112\n#define CONF_R_MODULE_INITIALIZATION_ERROR\t\t 109\n#define CONF_R_NO_CLOSE_BRACE\t\t\t\t 102\n#define CONF_R_NO_CONF\t\t\t\t\t 105\n#define CONF_R_NO_CONF_OR_ENVIRONMENT_VARIABLE\t\t 106\n#define CONF_R_NO_SECTION\t\t\t\t 107\n#define CONF_R_NO_SUCH_FILE\t\t\t\t 114\n#define CONF_R_NO_VALUE\t\t\t\t\t 108\n#define CONF_R_UNABLE_TO_CREATE_NEW_SECTION\t\t 103\n#define CONF_R_UNKNOWN_MODULE_NAME\t\t\t 113\n#define CONF_R_VARIABLE_HAS_NO_VALUE\t\t\t 104\n\n#ifdef  __cplusplus\n}\n#endif\n#endif\n"
  },
  {
    "path": "freebsd-headers/openssl/conf_api.h",
    "content": "/* conf_api.h */\n/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)\n * All rights reserved.\n *\n * This package is an SSL implementation written\n * by Eric Young (eay@cryptsoft.com).\n * The implementation was written so as to conform with Netscapes SSL.\n * \n * This library is free for commercial and non-commercial use as long as\n * the following conditions are aheared to.  The following conditions\n * apply to all code found in this distribution, be it the RC4, RSA,\n * lhash, DES, etc., code; not just the SSL code.  The SSL documentation\n * included with this distribution is covered by the same copyright terms\n * except that the holder is Tim Hudson (tjh@cryptsoft.com).\n * \n * Copyright remains Eric Young's, and as such any Copyright notices in\n * the code are not to be removed.\n * If this package is used in a product, Eric Young should be given attribution\n * as the author of the parts of the library used.\n * This can be in the form of a textual message at program startup or\n * in documentation (online or textual) provided with the package.\n * \n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. All advertising materials mentioning features or use of this software\n *    must display the following acknowledgement:\n *    \"This product includes cryptographic software written by\n *     Eric Young (eay@cryptsoft.com)\"\n *    The word 'cryptographic' can be left out if the rouines from the library\n *    being used are not cryptographic related :-).\n * 4. If you include any Windows specific code (or a derivative thereof) from \n *    the apps directory (application code) you must include an acknowledgement:\n *    \"This product includes software written by Tim Hudson (tjh@cryptsoft.com)\"\n * \n * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n * \n * The licence and distribution terms for any publically available version or\n * derivative of this code cannot be changed.  i.e. this code cannot simply be\n * copied and put under another distribution licence\n * [including the GNU Public Licence.]\n */\n\n#ifndef  HEADER_CONF_API_H\n#define HEADER_CONF_API_H\n\n#include <openssl/lhash.h>\n#include <openssl/conf.h>\n\n#ifdef  __cplusplus\nextern \"C\" {\n#endif\n\n/* Up until OpenSSL 0.9.5a, this was new_section */\nCONF_VALUE *_CONF_new_section(CONF *conf, const char *section);\n/* Up until OpenSSL 0.9.5a, this was get_section */\nCONF_VALUE *_CONF_get_section(const CONF *conf, const char *section);\n/* Up until OpenSSL 0.9.5a, this was CONF_get_section */\nSTACK_OF(CONF_VALUE) *_CONF_get_section_values(const CONF *conf,\n\t\t\t\t\t       const char *section);\n\nint _CONF_add_string(CONF *conf, CONF_VALUE *section, CONF_VALUE *value);\nchar *_CONF_get_string(const CONF *conf, const char *section,\n\t\t       const char *name);\nlong _CONF_get_number(const CONF *conf, const char *section, const char *name);\n\nint _CONF_new_data(CONF *conf);\nvoid _CONF_free_data(CONF *conf);\n\n#ifdef  __cplusplus\n}\n#endif\n#endif\n\n"
  },
  {
    "path": "freebsd-headers/openssl/crypto.h",
    "content": "/* crypto/crypto.h */\n/* ====================================================================\n * Copyright (c) 1998-2003 The OpenSSL Project.  All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n *\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer. \n *\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in\n *    the documentation and/or other materials provided with the\n *    distribution.\n *\n * 3. All advertising materials mentioning features or use of this\n *    software must display the following acknowledgment:\n *    \"This product includes software developed by the OpenSSL Project\n *    for use in the OpenSSL Toolkit. (http://www.openssl.org/)\"\n *\n * 4. The names \"OpenSSL Toolkit\" and \"OpenSSL Project\" must not be used to\n *    endorse or promote products derived from this software without\n *    prior written permission. For written permission, please contact\n *    openssl-core@openssl.org.\n *\n * 5. Products derived from this software may not be called \"OpenSSL\"\n *    nor may \"OpenSSL\" appear in their names without prior written\n *    permission of the OpenSSL Project.\n *\n * 6. Redistributions of any form whatsoever must retain the following\n *    acknowledgment:\n *    \"This product includes software developed by the OpenSSL Project\n *    for use in the OpenSSL Toolkit (http://www.openssl.org/)\"\n *\n * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY\n * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\n * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE OpenSSL PROJECT OR\n * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\n * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,\n * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED\n * OF THE POSSIBILITY OF SUCH DAMAGE.\n * ====================================================================\n *\n * This product includes cryptographic software written by Eric Young\n * (eay@cryptsoft.com).  This product includes software written by Tim\n * Hudson (tjh@cryptsoft.com).\n *\n */\n/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)\n * All rights reserved.\n *\n * This package is an SSL implementation written\n * by Eric Young (eay@cryptsoft.com).\n * The implementation was written so as to conform with Netscapes SSL.\n * \n * This library is free for commercial and non-commercial use as long as\n * the following conditions are aheared to.  The following conditions\n * apply to all code found in this distribution, be it the RC4, RSA,\n * lhash, DES, etc., code; not just the SSL code.  The SSL documentation\n * included with this distribution is covered by the same copyright terms\n * except that the holder is Tim Hudson (tjh@cryptsoft.com).\n * \n * Copyright remains Eric Young's, and as such any Copyright notices in\n * the code are not to be removed.\n * If this package is used in a product, Eric Young should be given attribution\n * as the author of the parts of the library used.\n * This can be in the form of a textual message at program startup or\n * in documentation (online or textual) provided with the package.\n * \n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. All advertising materials mentioning features or use of this software\n *    must display the following acknowledgement:\n *    \"This product includes cryptographic software written by\n *     Eric Young (eay@cryptsoft.com)\"\n *    The word 'cryptographic' can be left out if the rouines from the library\n *    being used are not cryptographic related :-).\n * 4. If you include any Windows specific code (or a derivative thereof) from \n *    the apps directory (application code) you must include an acknowledgement:\n *    \"This product includes software written by Tim Hudson (tjh@cryptsoft.com)\"\n * \n * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n * \n * The licence and distribution terms for any publically available version or\n * derivative of this code cannot be changed.  i.e. this code cannot simply be\n * copied and put under another distribution licence\n * [including the GNU Public Licence.]\n */\n/* ====================================================================\n * Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED.\n * ECDH support in OpenSSL originally developed by \n * SUN MICROSYSTEMS, INC., and contributed to the OpenSSL project.\n */\n\n#ifndef HEADER_CRYPTO_H\n#define HEADER_CRYPTO_H\n\n#include <stdlib.h>\n\n#include <openssl/e_os2.h>\n\n#ifndef OPENSSL_NO_FP_API\n#include <stdio.h>\n#endif\n\n#include <openssl/stack.h>\n#include <openssl/safestack.h>\n#include <openssl/opensslv.h>\n#include <openssl/ossl_typ.h>\n\n#ifdef CHARSET_EBCDIC\n#include <openssl/ebcdic.h>\n#endif\n\n/* Resolve problems on some operating systems with symbol names that clash\n   one way or another */\n#include <openssl/symhacks.h>\n\n#ifdef  __cplusplus\nextern \"C\" {\n#endif\n\n/* Backward compatibility to SSLeay */\n/* This is more to be used to check the correct DLL is being used\n * in the MS world. */\n#define SSLEAY_VERSION_NUMBER\tOPENSSL_VERSION_NUMBER\n#define SSLEAY_VERSION\t\t0\n/* #define SSLEAY_OPTIONS\t1 no longer supported */\n#define SSLEAY_CFLAGS\t\t2\n#define SSLEAY_BUILT_ON\t\t3\n#define SSLEAY_PLATFORM\t\t4\n#define SSLEAY_DIR\t\t5\n\n/* Already declared in ossl_typ.h */\n#if 0\ntypedef struct crypto_ex_data_st CRYPTO_EX_DATA;\n/* Called when a new object is created */\ntypedef int CRYPTO_EX_new(void *parent, void *ptr, CRYPTO_EX_DATA *ad,\n\t\t\t\t\tint idx, long argl, void *argp);\n/* Called when an object is free()ed */\ntypedef void CRYPTO_EX_free(void *parent, void *ptr, CRYPTO_EX_DATA *ad,\n\t\t\t\t\tint idx, long argl, void *argp);\n/* Called when we need to dup an object */\ntypedef int CRYPTO_EX_dup(CRYPTO_EX_DATA *to, CRYPTO_EX_DATA *from, void *from_d, \n\t\t\t\t\tint idx, long argl, void *argp);\n#endif\n\n/* A generic structure to pass assorted data in a expandable way */\ntypedef struct openssl_item_st\n\t{\n\tint code;\n\tvoid *value;\t\t/* Not used for flag attributes */\n\tsize_t value_size;\t/* Max size of value for output, length for input */\n\tsize_t *value_length;\t/* Returned length of value for output */\n\t} OPENSSL_ITEM;\n\n\n/* When changing the CRYPTO_LOCK_* list, be sure to maintin the text lock\n * names in cryptlib.c\n */\n\n#define\tCRYPTO_LOCK_ERR\t\t\t1\n#define\tCRYPTO_LOCK_EX_DATA\t\t2\n#define\tCRYPTO_LOCK_X509\t\t3\n#define\tCRYPTO_LOCK_X509_INFO\t\t4\n#define\tCRYPTO_LOCK_X509_PKEY\t\t5\n#define CRYPTO_LOCK_X509_CRL\t\t6\n#define CRYPTO_LOCK_X509_REQ\t\t7\n#define CRYPTO_LOCK_DSA\t\t\t8\n#define CRYPTO_LOCK_RSA\t\t\t9\n#define CRYPTO_LOCK_EVP_PKEY\t\t10\n#define CRYPTO_LOCK_X509_STORE\t\t11\n#define CRYPTO_LOCK_SSL_CTX\t\t12\n#define CRYPTO_LOCK_SSL_CERT\t\t13\n#define CRYPTO_LOCK_SSL_SESSION\t\t14\n#define CRYPTO_LOCK_SSL_SESS_CERT\t15\n#define CRYPTO_LOCK_SSL\t\t\t16\n#define CRYPTO_LOCK_SSL_METHOD\t\t17\n#define CRYPTO_LOCK_RAND\t\t18\n#define CRYPTO_LOCK_RAND2\t\t19\n#define CRYPTO_LOCK_MALLOC\t\t20\n#define CRYPTO_LOCK_BIO\t\t\t21\n#define CRYPTO_LOCK_GETHOSTBYNAME\t22\n#define CRYPTO_LOCK_GETSERVBYNAME\t23\n#define CRYPTO_LOCK_READDIR\t\t24\n#define CRYPTO_LOCK_RSA_BLINDING\t25\n#define CRYPTO_LOCK_DH\t\t\t26\n#define CRYPTO_LOCK_MALLOC2\t\t27\n#define CRYPTO_LOCK_DSO\t\t\t28\n#define CRYPTO_LOCK_DYNLOCK\t\t29\n#define CRYPTO_LOCK_ENGINE\t\t30\n#define CRYPTO_LOCK_UI\t\t\t31\n#define CRYPTO_LOCK_ECDSA               32\n#define CRYPTO_LOCK_EC\t\t\t33\n#define CRYPTO_LOCK_ECDH\t\t34\n#define CRYPTO_LOCK_BN  \t\t35\n#define CRYPTO_LOCK_EC_PRE_COMP\t\t36\n#define CRYPTO_LOCK_STORE\t\t37\n#define CRYPTO_LOCK_COMP\t\t38\n#ifndef OPENSSL_FIPS\n#define CRYPTO_NUM_LOCKS\t\t39\n#else\n#define CRYPTO_LOCK_FIPS\t\t39\n#define CRYPTO_LOCK_FIPS2\t\t40\n#define CRYPTO_NUM_LOCKS\t\t41\n#endif\n\n#define CRYPTO_LOCK\t\t1\n#define CRYPTO_UNLOCK\t\t2\n#define CRYPTO_READ\t\t4\n#define CRYPTO_WRITE\t\t8\n\n#ifndef OPENSSL_NO_LOCKING\n#ifndef CRYPTO_w_lock\n#define CRYPTO_w_lock(type)\t\\\n\tCRYPTO_lock(CRYPTO_LOCK|CRYPTO_WRITE,type,__FILE__,__LINE__)\n#define CRYPTO_w_unlock(type)\t\\\n\tCRYPTO_lock(CRYPTO_UNLOCK|CRYPTO_WRITE,type,__FILE__,__LINE__)\n#define CRYPTO_r_lock(type)\t\\\n\tCRYPTO_lock(CRYPTO_LOCK|CRYPTO_READ,type,__FILE__,__LINE__)\n#define CRYPTO_r_unlock(type)\t\\\n\tCRYPTO_lock(CRYPTO_UNLOCK|CRYPTO_READ,type,__FILE__,__LINE__)\n#define CRYPTO_add(addr,amount,type)\t\\\n\tCRYPTO_add_lock(addr,amount,type,__FILE__,__LINE__)\n#endif\n#else\n#define CRYPTO_w_lock(a)\n#define CRYPTO_w_unlock(a)\n#define CRYPTO_r_lock(a)\n#define CRYPTO_r_unlock(a)\n#define CRYPTO_add(a,b,c)\t((*(a))+=(b))\n#endif\n\n/* Some applications as well as some parts of OpenSSL need to allocate\n   and deallocate locks in a dynamic fashion.  The following typedef\n   makes this possible in a type-safe manner.  */\n/* struct CRYPTO_dynlock_value has to be defined by the application. */\ntypedef struct\n\t{\n\tint references;\n\tstruct CRYPTO_dynlock_value *data;\n\t} CRYPTO_dynlock;\n\n\n/* The following can be used to detect memory leaks in the SSLeay library.\n * It used, it turns on malloc checking */\n\n#define CRYPTO_MEM_CHECK_OFF\t0x0\t/* an enume */\n#define CRYPTO_MEM_CHECK_ON\t0x1\t/* a bit */\n#define CRYPTO_MEM_CHECK_ENABLE\t0x2\t/* a bit */\n#define CRYPTO_MEM_CHECK_DISABLE 0x3\t/* an enume */\n\n/* The following are bit values to turn on or off options connected to the\n * malloc checking functionality */\n\n/* Adds time to the memory checking information */\n#define V_CRYPTO_MDEBUG_TIME\t0x1 /* a bit */\n/* Adds thread number to the memory checking information */\n#define V_CRYPTO_MDEBUG_THREAD\t0x2 /* a bit */\n\n#define V_CRYPTO_MDEBUG_ALL (V_CRYPTO_MDEBUG_TIME | V_CRYPTO_MDEBUG_THREAD)\n\n\n/* predec of the BIO type */\ntypedef struct bio_st BIO_dummy;\n\nstruct crypto_ex_data_st\n\t{\n\tSTACK *sk;\n\tint dummy; /* gcc is screwing up this data structure :-( */\n\t};\n\n/* This stuff is basically class callback functions\n * The current classes are SSL_CTX, SSL, SSL_SESSION, and a few more */\n\ntypedef struct crypto_ex_data_func_st\n\t{\n\tlong argl;\t/* Arbitary long */\n\tvoid *argp;\t/* Arbitary void * */\n\tCRYPTO_EX_new *new_func;\n\tCRYPTO_EX_free *free_func;\n\tCRYPTO_EX_dup *dup_func;\n\t} CRYPTO_EX_DATA_FUNCS;\n\nDECLARE_STACK_OF(CRYPTO_EX_DATA_FUNCS)\n\n/* Per class, we have a STACK of CRYPTO_EX_DATA_FUNCS for each CRYPTO_EX_DATA\n * entry.\n */\n\n#define CRYPTO_EX_INDEX_BIO\t\t0\n#define CRYPTO_EX_INDEX_SSL\t\t1\n#define CRYPTO_EX_INDEX_SSL_CTX\t\t2\n#define CRYPTO_EX_INDEX_SSL_SESSION\t3\n#define CRYPTO_EX_INDEX_X509_STORE\t4\n#define CRYPTO_EX_INDEX_X509_STORE_CTX\t5\n#define CRYPTO_EX_INDEX_RSA\t\t6\n#define CRYPTO_EX_INDEX_DSA\t\t7\n#define CRYPTO_EX_INDEX_DH\t\t8\n#define CRYPTO_EX_INDEX_ENGINE\t\t9\n#define CRYPTO_EX_INDEX_X509\t\t10\n#define CRYPTO_EX_INDEX_UI\t\t11\n#define CRYPTO_EX_INDEX_ECDSA\t\t12\n#define CRYPTO_EX_INDEX_ECDH\t\t13\n#define CRYPTO_EX_INDEX_COMP\t\t14\n#define CRYPTO_EX_INDEX_STORE\t\t15\n\n/* Dynamically assigned indexes start from this value (don't use directly, use\n * via CRYPTO_ex_data_new_class). */\n#define CRYPTO_EX_INDEX_USER\t\t100\n\n\n/* This is the default callbacks, but we can have others as well:\n * this is needed in Win32 where the application malloc and the\n * library malloc may not be the same.\n */\n#define CRYPTO_malloc_init()\tCRYPTO_set_mem_functions(\\\n\tmalloc, realloc, free)\n\n#if defined CRYPTO_MDEBUG_ALL || defined CRYPTO_MDEBUG_TIME || defined CRYPTO_MDEBUG_THREAD\n# ifndef CRYPTO_MDEBUG /* avoid duplicate #define */\n#  define CRYPTO_MDEBUG\n# endif\n#endif\n\n/* Set standard debugging functions (not done by default\n * unless CRYPTO_MDEBUG is defined) */\nvoid CRYPTO_malloc_debug_init(void);\n\nint CRYPTO_mem_ctrl(int mode);\nint CRYPTO_is_mem_check_on(void);\n\n/* for applications */\n#define MemCheck_start() CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ON)\n#define MemCheck_stop()\tCRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_OFF)\n\n/* for library-internal use */\n#define MemCheck_on()\tCRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ENABLE)\n#define MemCheck_off()\tCRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_DISABLE)\n#define is_MemCheck_on() CRYPTO_is_mem_check_on()\n\n#define OPENSSL_malloc(num)\tCRYPTO_malloc((int)num,__FILE__,__LINE__)\n#define OPENSSL_strdup(str)\tCRYPTO_strdup((str),__FILE__,__LINE__)\n#define OPENSSL_realloc(addr,num) \\\n\tCRYPTO_realloc((char *)addr,(int)num,__FILE__,__LINE__)\n#define OPENSSL_realloc_clean(addr,old_num,num) \\\n\tCRYPTO_realloc_clean(addr,old_num,num,__FILE__,__LINE__)\n#define OPENSSL_remalloc(addr,num) \\\n\tCRYPTO_remalloc((char **)addr,(int)num,__FILE__,__LINE__)\n#define OPENSSL_freeFunc\tCRYPTO_free\n#define OPENSSL_free(addr)\tCRYPTO_free(addr)\n\n#define OPENSSL_malloc_locked(num) \\\n\tCRYPTO_malloc_locked((int)num,__FILE__,__LINE__)\n#define OPENSSL_free_locked(addr) CRYPTO_free_locked(addr)\n\n\nconst char *SSLeay_version(int type);\nunsigned long SSLeay(void);\n\nint OPENSSL_issetugid(void);\n\n/* An opaque type representing an implementation of \"ex_data\" support */\ntypedef struct st_CRYPTO_EX_DATA_IMPL\tCRYPTO_EX_DATA_IMPL;\n/* Return an opaque pointer to the current \"ex_data\" implementation */\nconst CRYPTO_EX_DATA_IMPL *CRYPTO_get_ex_data_implementation(void);\n/* Sets the \"ex_data\" implementation to be used (if it's not too late) */\nint CRYPTO_set_ex_data_implementation(const CRYPTO_EX_DATA_IMPL *i);\n/* Get a new \"ex_data\" class, and return the corresponding \"class_index\" */\nint CRYPTO_ex_data_new_class(void);\n/* Within a given class, get/register a new index */\nint CRYPTO_get_ex_new_index(int class_index, long argl, void *argp,\n\t\tCRYPTO_EX_new *new_func, CRYPTO_EX_dup *dup_func,\n\t\tCRYPTO_EX_free *free_func);\n/* Initialise/duplicate/free CRYPTO_EX_DATA variables corresponding to a given\n * class (invokes whatever per-class callbacks are applicable) */\nint CRYPTO_new_ex_data(int class_index, void *obj, CRYPTO_EX_DATA *ad);\nint CRYPTO_dup_ex_data(int class_index, CRYPTO_EX_DATA *to,\n\t\tCRYPTO_EX_DATA *from);\nvoid CRYPTO_free_ex_data(int class_index, void *obj, CRYPTO_EX_DATA *ad);\n/* Get/set data in a CRYPTO_EX_DATA variable corresponding to a particular index\n * (relative to the class type involved) */\nint CRYPTO_set_ex_data(CRYPTO_EX_DATA *ad, int idx, void *val);\nvoid *CRYPTO_get_ex_data(const CRYPTO_EX_DATA *ad,int idx);\n/* This function cleans up all \"ex_data\" state. It mustn't be called under\n * potential race-conditions. */\nvoid CRYPTO_cleanup_all_ex_data(void);\n\nint CRYPTO_get_new_lockid(char *name);\n\nint CRYPTO_num_locks(void); /* return CRYPTO_NUM_LOCKS (shared libs!) */\nvoid CRYPTO_lock(int mode, int type,const char *file,int line);\nvoid CRYPTO_set_locking_callback(void (*func)(int mode,int type,\n\t\t\t\t\t      const char *file,int line));\nvoid (*CRYPTO_get_locking_callback(void))(int mode,int type,const char *file,\n\t\tint line);\nvoid CRYPTO_set_add_lock_callback(int (*func)(int *num,int mount,int type,\n\t\t\t\t\t      const char *file, int line));\nint (*CRYPTO_get_add_lock_callback(void))(int *num,int mount,int type,\n\t\t\t\t\t  const char *file,int line);\nvoid CRYPTO_set_id_callback(unsigned long (*func)(void));\nunsigned long (*CRYPTO_get_id_callback(void))(void);\nunsigned long CRYPTO_thread_id(void);\nconst char *CRYPTO_get_lock_name(int type);\nint CRYPTO_add_lock(int *pointer,int amount,int type, const char *file,\n\t\t    int line);\n\nvoid int_CRYPTO_set_do_dynlock_callback(\n\tvoid (*do_dynlock_cb)(int mode, int type, const char *file, int line));\n\nint CRYPTO_get_new_dynlockid(void);\nvoid CRYPTO_destroy_dynlockid(int i);\nstruct CRYPTO_dynlock_value *CRYPTO_get_dynlock_value(int i);\nvoid CRYPTO_set_dynlock_create_callback(struct CRYPTO_dynlock_value *(*dyn_create_function)(const char *file, int line));\nvoid CRYPTO_set_dynlock_lock_callback(void (*dyn_lock_function)(int mode, struct CRYPTO_dynlock_value *l, const char *file, int line));\nvoid CRYPTO_set_dynlock_destroy_callback(void (*dyn_destroy_function)(struct CRYPTO_dynlock_value *l, const char *file, int line));\nstruct CRYPTO_dynlock_value *(*CRYPTO_get_dynlock_create_callback(void))(const char *file,int line);\nvoid (*CRYPTO_get_dynlock_lock_callback(void))(int mode, struct CRYPTO_dynlock_value *l, const char *file,int line);\nvoid (*CRYPTO_get_dynlock_destroy_callback(void))(struct CRYPTO_dynlock_value *l, const char *file,int line);\n\n/* CRYPTO_set_mem_functions includes CRYPTO_set_locked_mem_functions --\n * call the latter last if you need different functions */\nint CRYPTO_set_mem_functions(void *(*m)(size_t),void *(*r)(void *,size_t), void (*f)(void *));\nint CRYPTO_set_locked_mem_functions(void *(*m)(size_t), void (*free_func)(void *));\nint CRYPTO_set_mem_ex_functions(void *(*m)(size_t,const char *,int),\n                                void *(*r)(void *,size_t,const char *,int),\n                                void (*f)(void *));\nint CRYPTO_set_locked_mem_ex_functions(void *(*m)(size_t,const char *,int),\n                                       void (*free_func)(void *));\nint CRYPTO_set_mem_debug_functions(void (*m)(void *,int,const char *,int,int),\n\t\t\t\t   void (*r)(void *,void *,int,const char *,int,int),\n\t\t\t\t   void (*f)(void *,int),\n\t\t\t\t   void (*so)(long),\n\t\t\t\t   long (*go)(void));\nvoid CRYPTO_set_mem_info_functions(\n\tint  (*push_info_fn)(const char *info, const char *file, int line),\n\tint  (*pop_info_fn)(void),\n\tint (*remove_all_info_fn)(void));\nvoid CRYPTO_get_mem_functions(void *(**m)(size_t),void *(**r)(void *, size_t), void (**f)(void *));\nvoid CRYPTO_get_locked_mem_functions(void *(**m)(size_t), void (**f)(void *));\nvoid CRYPTO_get_mem_ex_functions(void *(**m)(size_t,const char *,int),\n                                 void *(**r)(void *, size_t,const char *,int),\n                                 void (**f)(void *));\nvoid CRYPTO_get_locked_mem_ex_functions(void *(**m)(size_t,const char *,int),\n                                        void (**f)(void *));\nvoid CRYPTO_get_mem_debug_functions(void (**m)(void *,int,const char *,int,int),\n\t\t\t\t    void (**r)(void *,void *,int,const char *,int,int),\n\t\t\t\t    void (**f)(void *,int),\n\t\t\t\t    void (**so)(long),\n\t\t\t\t    long (**go)(void));\n\nvoid *CRYPTO_malloc_locked(int num, const char *file, int line);\nvoid CRYPTO_free_locked(void *);\nvoid *CRYPTO_malloc(int num, const char *file, int line);\nchar *CRYPTO_strdup(const char *str, const char *file, int line);\nvoid CRYPTO_free(void *);\nvoid *CRYPTO_realloc(void *addr,int num, const char *file, int line);\nvoid *CRYPTO_realloc_clean(void *addr,int old_num,int num,const char *file,\n\t\t\t   int line);\nvoid *CRYPTO_remalloc(void *addr,int num, const char *file, int line);\n\nvoid OPENSSL_cleanse(void *ptr, size_t len);\n\nvoid CRYPTO_set_mem_debug_options(long bits);\nlong CRYPTO_get_mem_debug_options(void);\n\n#define CRYPTO_push_info(info) \\\n        CRYPTO_push_info_(info, __FILE__, __LINE__);\nint CRYPTO_push_info_(const char *info, const char *file, int line);\nint CRYPTO_pop_info(void);\nint CRYPTO_remove_all_info(void);\n\n\n/* Default debugging functions (enabled by CRYPTO_malloc_debug_init() macro;\n * used as default in CRYPTO_MDEBUG compilations): */\n/* The last argument has the following significance:\n *\n * 0:\tcalled before the actual memory allocation has taken place\n * 1:\tcalled after the actual memory allocation has taken place\n */\nvoid CRYPTO_dbg_malloc(void *addr,int num,const char *file,int line,int before_p);\nvoid CRYPTO_dbg_realloc(void *addr1,void *addr2,int num,const char *file,int line,int before_p);\nvoid CRYPTO_dbg_free(void *addr,int before_p);\n/* Tell the debugging code about options.  By default, the following values\n * apply:\n *\n * 0:                           Clear all options.\n * V_CRYPTO_MDEBUG_TIME (1):    Set the \"Show Time\" option.\n * V_CRYPTO_MDEBUG_THREAD (2):  Set the \"Show Thread Number\" option.\n * V_CRYPTO_MDEBUG_ALL (3):     1 + 2\n */\nvoid CRYPTO_dbg_set_options(long bits);\nlong CRYPTO_dbg_get_options(void);\n\nint CRYPTO_dbg_push_info(const char *info, const char *file, int line);\nint CRYPTO_dbg_pop_info(void);\nint CRYPTO_dbg_remove_all_info(void);\n\n#ifndef OPENSSL_NO_FP_API\nvoid CRYPTO_mem_leaks_fp(FILE *);\n#endif\nvoid CRYPTO_mem_leaks(struct bio_st *bio);\n/* unsigned long order, char *file, int line, int num_bytes, char *addr */\ntypedef void *CRYPTO_MEM_LEAK_CB(unsigned long, const char *, int, int, void *);\nvoid CRYPTO_mem_leaks_cb(CRYPTO_MEM_LEAK_CB *cb);\n\n/* die if we have to */\nvoid OpenSSLDie(const char *file,int line,const char *assertion);\n#define OPENSSL_assert(e)       (void)((e) ? 0 : (OpenSSLDie(__FILE__, __LINE__, #e),1))\n\nunsigned long *OPENSSL_ia32cap_loc(void);\n#define OPENSSL_ia32cap (*(OPENSSL_ia32cap_loc()))\nint OPENSSL_isservice(void);\n\n#ifdef OPENSSL_FIPS\n#define FIPS_ERROR_IGNORED(alg) OpenSSLDie(__FILE__, __LINE__, \\\n\t\talg \" previous FIPS forbidden algorithm error ignored\");\n\n#define FIPS_BAD_ABORT(alg) OpenSSLDie(__FILE__, __LINE__, \\\n\t\t#alg \" Algorithm forbidden in FIPS mode\");\n\n#ifdef OPENSSL_FIPS_STRICT\n#define FIPS_BAD_ALGORITHM(alg) FIPS_BAD_ABORT(alg)\n#else\n#define FIPS_BAD_ALGORITHM(alg) \\\n\t{ \\\n\tFIPSerr(FIPS_F_HASH_FINAL,FIPS_R_NON_FIPS_METHOD); \\\n\tERR_add_error_data(2, \"Algorithm=\", #alg); \\\n\treturn 0; \\\n\t}\n#endif\n\n/* Low level digest API blocking macro */\n\n#define FIPS_NON_FIPS_MD_Init(alg) \\\n\tint alg##_Init(alg##_CTX *c) \\\n\t\t{ \\\n\t\tif (FIPS_mode()) \\\n\t\t\tFIPS_BAD_ALGORITHM(alg) \\\n\t\treturn private_##alg##_Init(c); \\\n\t\t} \\\n\tint private_##alg##_Init(alg##_CTX *c)\n\n/* For ciphers the API often varies from cipher to cipher and each needs to\n * be treated as a special case. Variable key length ciphers (Blowfish, RC4,\n * CAST) however are very similar and can use a blocking macro.\n */\n\n#define FIPS_NON_FIPS_VCIPHER_Init(alg) \\\n\tvoid alg##_set_key(alg##_KEY *key, int len, const unsigned char *data) \\\n\t\t{ \\\n\t\tif (FIPS_mode()) \\\n\t\t\tFIPS_BAD_ABORT(alg) \\\n\t\tprivate_##alg##_set_key(key, len, data); \\\n\t\t} \\\n\tvoid private_##alg##_set_key(alg##_KEY *key, int len, \\\n\t\t\t\t\tconst unsigned char *data)\n\n#else\n\n#define FIPS_NON_FIPS_VCIPHER_Init(alg) \\\n\tvoid alg##_set_key(alg##_KEY *key, int len, const unsigned char *data)\n\n#define FIPS_NON_FIPS_MD_Init(alg) \\\n\tint alg##_Init(alg##_CTX *c) \n\n#endif /* def OPENSSL_FIPS */\n\n/* BEGIN ERROR CODES */\n/* The following lines are auto generated by the script mkerr.pl. Any changes\n * made after this point may be overwritten when the script is next run.\n */\nvoid ERR_load_CRYPTO_strings(void);\n\n#define OPENSSL_HAVE_INIT\t1\nvoid OPENSSL_init(void);\n\n/* Error codes for the CRYPTO functions. */\n\n/* Function codes. */\n#define CRYPTO_F_CRYPTO_GET_EX_NEW_INDEX\t\t 100\n#define CRYPTO_F_CRYPTO_GET_NEW_DYNLOCKID\t\t 103\n#define CRYPTO_F_CRYPTO_GET_NEW_LOCKID\t\t\t 101\n#define CRYPTO_F_CRYPTO_SET_EX_DATA\t\t\t 102\n#define CRYPTO_F_DEF_ADD_INDEX\t\t\t\t 104\n#define CRYPTO_F_DEF_GET_CLASS\t\t\t\t 105\n#define CRYPTO_F_INT_DUP_EX_DATA\t\t\t 106\n#define CRYPTO_F_INT_FREE_EX_DATA\t\t\t 107\n#define CRYPTO_F_INT_NEW_EX_DATA\t\t\t 108\n\n/* Reason codes. */\n#define CRYPTO_R_NO_DYNLOCK_CREATE_CALLBACK\t\t 100\n\n#ifdef  __cplusplus\n}\n#endif\n#endif\n"
  },
  {
    "path": "freebsd-headers/openssl/des.h",
    "content": "/* crypto/des/des.h */\n/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com)\n * All rights reserved.\n *\n * This package is an SSL implementation written\n * by Eric Young (eay@cryptsoft.com).\n * The implementation was written so as to conform with Netscapes SSL.\n * \n * This library is free for commercial and non-commercial use as long as\n * the following conditions are aheared to.  The following conditions\n * apply to all code found in this distribution, be it the RC4, RSA,\n * lhash, DES, etc., code; not just the SSL code.  The SSL documentation\n * included with this distribution is covered by the same copyright terms\n * except that the holder is Tim Hudson (tjh@cryptsoft.com).\n * \n * Copyright remains Eric Young's, and as such any Copyright notices in\n * the code are not to be removed.\n * If this package is used in a product, Eric Young should be given attribution\n * as the author of the parts of the library used.\n * This can be in the form of a textual message at program startup or\n * in documentation (online or textual) provided with the package.\n * \n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. All advertising materials mentioning features or use of this software\n *    must display the following acknowledgement:\n *    \"This product includes cryptographic software written by\n *     Eric Young (eay@cryptsoft.com)\"\n *    The word 'cryptographic' can be left out if the rouines from the library\n *    being used are not cryptographic related :-).\n * 4. If you include any Windows specific code (or a derivative thereof) from \n *    the apps directory (application code) you must include an acknowledgement:\n *    \"This product includes software written by Tim Hudson (tjh@cryptsoft.com)\"\n * \n * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n * \n * The licence and distribution terms for any publically available version or\n * derivative of this code cannot be changed.  i.e. this code cannot simply be\n * copied and put under another distribution licence\n * [including the GNU Public Licence.]\n */\n\n#ifndef HEADER_NEW_DES_H\n#define HEADER_NEW_DES_H\n\n#include <openssl/e_os2.h>\t/* OPENSSL_EXTERN, OPENSSL_NO_DES,\n\t\t\t\t   DES_LONG (via openssl/opensslconf.h */\n\n#ifdef OPENSSL_NO_DES\n#error DES is disabled.\n#endif\n\n#ifdef OPENSSL_BUILD_SHLIBCRYPTO\n# undef OPENSSL_EXTERN\n# define OPENSSL_EXTERN OPENSSL_EXPORT\n#endif\n\n#ifdef  __cplusplus\nextern \"C\" {\n#endif\n\ntypedef unsigned char DES_cblock[8];\ntypedef /* const */ unsigned char const_DES_cblock[8];\n/* With \"const\", gcc 2.8.1 on Solaris thinks that DES_cblock *\n * and const_DES_cblock * are incompatible pointer types. */\n\ntypedef struct DES_ks\n    {\n    union\n\t{\n\tDES_cblock cblock;\n\t/* make sure things are correct size on machines with\n\t * 8 byte longs */\n\tDES_LONG deslong[2];\n\t} ks[16];\n    } DES_key_schedule;\n\n#ifndef OPENSSL_DISABLE_OLD_DES_SUPPORT\n# ifndef OPENSSL_ENABLE_OLD_DES_SUPPORT\n#  define OPENSSL_ENABLE_OLD_DES_SUPPORT\n# endif\n#endif\n\n#ifdef OPENSSL_ENABLE_OLD_DES_SUPPORT\n# include <openssl/des_old.h>\n#endif\n\n#define DES_KEY_SZ \t(sizeof(DES_cblock))\n#define DES_SCHEDULE_SZ (sizeof(DES_key_schedule))\n\n#define DES_ENCRYPT\t1\n#define DES_DECRYPT\t0\n\n#define DES_CBC_MODE\t0\n#define DES_PCBC_MODE\t1\n\n#define DES_ecb2_encrypt(i,o,k1,k2,e) \\\n\tDES_ecb3_encrypt((i),(o),(k1),(k2),(k1),(e))\n\n#define DES_ede2_cbc_encrypt(i,o,l,k1,k2,iv,e) \\\n\tDES_ede3_cbc_encrypt((i),(o),(l),(k1),(k2),(k1),(iv),(e))\n\n#define DES_ede2_cfb64_encrypt(i,o,l,k1,k2,iv,n,e) \\\n\tDES_ede3_cfb64_encrypt((i),(o),(l),(k1),(k2),(k1),(iv),(n),(e))\n\n#define DES_ede2_ofb64_encrypt(i,o,l,k1,k2,iv,n) \\\n\tDES_ede3_ofb64_encrypt((i),(o),(l),(k1),(k2),(k1),(iv),(n))\n\nOPENSSL_DECLARE_GLOBAL(int,DES_check_key);\t/* defaults to false */\n#define DES_check_key OPENSSL_GLOBAL_REF(DES_check_key)\nOPENSSL_DECLARE_GLOBAL(int,DES_rw_mode);\t/* defaults to DES_PCBC_MODE */\n#define DES_rw_mode OPENSSL_GLOBAL_REF(DES_rw_mode)\n\nconst char *DES_options(void);\nvoid DES_ecb3_encrypt(const_DES_cblock *input, DES_cblock *output,\n\t\t      DES_key_schedule *ks1,DES_key_schedule *ks2,\n\t\t      DES_key_schedule *ks3, int enc);\nDES_LONG DES_cbc_cksum(const unsigned char *input,DES_cblock *output,\n\t\t       long length,DES_key_schedule *schedule,\n\t\t       const_DES_cblock *ivec);\n/* DES_cbc_encrypt does not update the IV!  Use DES_ncbc_encrypt instead. */\nvoid DES_cbc_encrypt(const unsigned char *input,unsigned char *output,\n\t\t     long length,DES_key_schedule *schedule,DES_cblock *ivec,\n\t\t     int enc);\nvoid DES_ncbc_encrypt(const unsigned char *input,unsigned char *output,\n\t\t      long length,DES_key_schedule *schedule,DES_cblock *ivec,\n\t\t      int enc);\nvoid DES_xcbc_encrypt(const unsigned char *input,unsigned char *output,\n\t\t      long length,DES_key_schedule *schedule,DES_cblock *ivec,\n\t\t      const_DES_cblock *inw,const_DES_cblock *outw,int enc);\nvoid DES_cfb_encrypt(const unsigned char *in,unsigned char *out,int numbits,\n\t\t     long length,DES_key_schedule *schedule,DES_cblock *ivec,\n\t\t     int enc);\nvoid DES_ecb_encrypt(const_DES_cblock *input,DES_cblock *output,\n\t\t     DES_key_schedule *ks,int enc);\n\n/* \tThis is the DES encryption function that gets called by just about\n\tevery other DES routine in the library.  You should not use this\n\tfunction except to implement 'modes' of DES.  I say this because the\n\tfunctions that call this routine do the conversion from 'char *' to\n\tlong, and this needs to be done to make sure 'non-aligned' memory\n\taccess do not occur.  The characters are loaded 'little endian'.\n\tData is a pointer to 2 unsigned long's and ks is the\n\tDES_key_schedule to use.  enc, is non zero specifies encryption,\n\tzero if decryption. */\nvoid DES_encrypt1(DES_LONG *data,DES_key_schedule *ks, int enc);\n\n/* \tThis functions is the same as DES_encrypt1() except that the DES\n\tinitial permutation (IP) and final permutation (FP) have been left\n\tout.  As for DES_encrypt1(), you should not use this function.\n\tIt is used by the routines in the library that implement triple DES.\n\tIP() DES_encrypt2() DES_encrypt2() DES_encrypt2() FP() is the same\n\tas DES_encrypt1() DES_encrypt1() DES_encrypt1() except faster :-). */\nvoid DES_encrypt2(DES_LONG *data,DES_key_schedule *ks, int enc);\n\nvoid DES_encrypt3(DES_LONG *data, DES_key_schedule *ks1,\n\t\t  DES_key_schedule *ks2, DES_key_schedule *ks3);\nvoid DES_decrypt3(DES_LONG *data, DES_key_schedule *ks1,\n\t\t  DES_key_schedule *ks2, DES_key_schedule *ks3);\nvoid DES_ede3_cbc_encrypt(const unsigned char *input,unsigned char *output, \n\t\t\t  long length,\n\t\t\t  DES_key_schedule *ks1,DES_key_schedule *ks2,\n\t\t\t  DES_key_schedule *ks3,DES_cblock *ivec,int enc);\nvoid DES_ede3_cbcm_encrypt(const unsigned char *in,unsigned char *out,\n\t\t\t   long length,\n\t\t\t   DES_key_schedule *ks1,DES_key_schedule *ks2,\n\t\t\t   DES_key_schedule *ks3,\n\t\t\t   DES_cblock *ivec1,DES_cblock *ivec2,\n\t\t\t   int enc);\nvoid DES_ede3_cfb64_encrypt(const unsigned char *in,unsigned char *out,\n\t\t\t    long length,DES_key_schedule *ks1,\n\t\t\t    DES_key_schedule *ks2,DES_key_schedule *ks3,\n\t\t\t    DES_cblock *ivec,int *num,int enc);\nvoid DES_ede3_cfb_encrypt(const unsigned char *in,unsigned char *out,\n\t\t\t  int numbits,long length,DES_key_schedule *ks1,\n\t\t\t  DES_key_schedule *ks2,DES_key_schedule *ks3,\n\t\t\t  DES_cblock *ivec,int enc);\nvoid DES_ede3_ofb64_encrypt(const unsigned char *in,unsigned char *out,\n\t\t\t    long length,DES_key_schedule *ks1,\n\t\t\t    DES_key_schedule *ks2,DES_key_schedule *ks3,\n\t\t\t    DES_cblock *ivec,int *num);\n#if 0\nvoid DES_xwhite_in2out(const_DES_cblock *DES_key,const_DES_cblock *in_white,\n\t\t       DES_cblock *out_white);\n#endif\n\nint DES_enc_read(int fd,void *buf,int len,DES_key_schedule *sched,\n\t\t DES_cblock *iv);\nint DES_enc_write(int fd,const void *buf,int len,DES_key_schedule *sched,\n\t\t  DES_cblock *iv);\nchar *DES_fcrypt(const char *buf,const char *salt, char *ret);\nchar *DES_crypt(const char *buf,const char *salt);\nvoid DES_ofb_encrypt(const unsigned char *in,unsigned char *out,int numbits,\n\t\t     long length,DES_key_schedule *schedule,DES_cblock *ivec);\nvoid DES_pcbc_encrypt(const unsigned char *input,unsigned char *output,\n\t\t      long length,DES_key_schedule *schedule,DES_cblock *ivec,\n\t\t      int enc);\nDES_LONG DES_quad_cksum(const unsigned char *input,DES_cblock output[],\n\t\t\tlong length,int out_count,DES_cblock *seed);\nint DES_random_key(DES_cblock *ret);\nvoid DES_set_odd_parity(DES_cblock *key);\nint DES_check_key_parity(const_DES_cblock *key);\nint DES_is_weak_key(const_DES_cblock *key);\n/* DES_set_key (= set_key = DES_key_sched = key_sched) calls\n * DES_set_key_checked if global variable DES_check_key is set,\n * DES_set_key_unchecked otherwise. */\nint DES_set_key(const_DES_cblock *key,DES_key_schedule *schedule);\nint DES_key_sched(const_DES_cblock *key,DES_key_schedule *schedule);\nint DES_set_key_checked(const_DES_cblock *key,DES_key_schedule *schedule);\nvoid DES_set_key_unchecked(const_DES_cblock *key,DES_key_schedule *schedule);\nvoid DES_string_to_key(const char *str,DES_cblock *key);\nvoid DES_string_to_2keys(const char *str,DES_cblock *key1,DES_cblock *key2);\nvoid DES_cfb64_encrypt(const unsigned char *in,unsigned char *out,long length,\n\t\t       DES_key_schedule *schedule,DES_cblock *ivec,int *num,\n\t\t       int enc);\nvoid DES_ofb64_encrypt(const unsigned char *in,unsigned char *out,long length,\n\t\t       DES_key_schedule *schedule,DES_cblock *ivec,int *num);\n\nint DES_read_password(DES_cblock *key, const char *prompt, int verify);\nint DES_read_2passwords(DES_cblock *key1, DES_cblock *key2, const char *prompt,\n\tint verify);\n\n#define DES_fixup_key_parity DES_set_odd_parity\n\n#ifdef  __cplusplus\n}\n#endif\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/openssl/des_old.h",
    "content": "/* crypto/des/des_old.h -*- mode:C; c-file-style: \"eay\" -*- */\n\n/* WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING\n *\n * The function names in here are deprecated and are only present to\n * provide an interface compatible with openssl 0.9.6 and older as\n * well as libdes.  OpenSSL now provides functions where \"des_\" has\n * been replaced with \"DES_\" in the names, to make it possible to\n * make incompatible changes that are needed for C type security and\n * other stuff.\n *\n * This include files has two compatibility modes:\n *\n *   - If OPENSSL_DES_LIBDES_COMPATIBILITY is defined, you get an API\n *     that is compatible with libdes and SSLeay.\n *   - If OPENSSL_DES_LIBDES_COMPATIBILITY isn't defined, you get an\n *     API that is compatible with OpenSSL 0.9.5x to 0.9.6x.\n *\n * Note that these modes break earlier snapshots of OpenSSL, where\n * libdes compatibility was the only available mode or (later on) the\n * prefered compatibility mode.  However, after much consideration\n * (and more or less violent discussions with external parties), it\n * was concluded that OpenSSL should be compatible with earlier versions\n * of itself before anything else.  Also, in all honesty, libdes is\n * an old beast that shouldn't really be used any more.\n *\n * Please consider starting to use the DES_ functions rather than the\n * des_ ones.  The des_ functions will disappear completely before\n * OpenSSL 1.0!\n *\n * WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING\n */\n\n/* Written by Richard Levitte (richard@levitte.org) for the OpenSSL\n * project 2001.\n */\n/* ====================================================================\n * Copyright (c) 1998-2002 The OpenSSL Project.  All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n *\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer. \n *\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in\n *    the documentation and/or other materials provided with the\n *    distribution.\n *\n * 3. All advertising materials mentioning features or use of this\n *    software must display the following acknowledgment:\n *    \"This product includes software developed by the OpenSSL Project\n *    for use in the OpenSSL Toolkit. (http://www.openssl.org/)\"\n *\n * 4. The names \"OpenSSL Toolkit\" and \"OpenSSL Project\" must not be used to\n *    endorse or promote products derived from this software without\n *    prior written permission. For written permission, please contact\n *    openssl-core@openssl.org.\n *\n * 5. Products derived from this software may not be called \"OpenSSL\"\n *    nor may \"OpenSSL\" appear in their names without prior written\n *    permission of the OpenSSL Project.\n *\n * 6. Redistributions of any form whatsoever must retain the following\n *    acknowledgment:\n *    \"This product includes software developed by the OpenSSL Project\n *    for use in the OpenSSL Toolkit (http://www.openssl.org/)\"\n *\n * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY\n * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\n * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE OpenSSL PROJECT OR\n * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\n * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,\n * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED\n * OF THE POSSIBILITY OF SUCH DAMAGE.\n * ====================================================================\n *\n * This product includes cryptographic software written by Eric Young\n * (eay@cryptsoft.com).  This product includes software written by Tim\n * Hudson (tjh@cryptsoft.com).\n *\n */\n\n#ifndef HEADER_DES_H\n#define HEADER_DES_H\n\n#include <openssl/e_os2.h>\t/* OPENSSL_EXTERN, OPENSSL_NO_DES, DES_LONG */\n\n#ifdef OPENSSL_NO_DES\n#error DES is disabled.\n#endif\n\n#ifndef HEADER_NEW_DES_H\n#error You must include des.h, not des_old.h directly.\n#endif\n\n#ifdef _KERBEROS_DES_H\n#error <openssl/des_old.h> replaces <kerberos/des.h>.\n#endif\n\n#include <openssl/symhacks.h>\n\n#ifdef OPENSSL_BUILD_SHLIBCRYPTO\n# undef OPENSSL_EXTERN\n# define OPENSSL_EXTERN OPENSSL_EXPORT\n#endif\n\n#ifdef  __cplusplus\nextern \"C\" {\n#endif\n\n#ifdef _\n#undef _\n#endif\n\ntypedef unsigned char _ossl_old_des_cblock[8];\ntypedef struct _ossl_old_des_ks_struct\n\t{\n\tunion\t{\n\t\t_ossl_old_des_cblock _;\n\t\t/* make sure things are correct size on machines with\n\t\t * 8 byte longs */\n\t\tDES_LONG pad[2];\n\t\t} ks;\n\t} _ossl_old_des_key_schedule[16];\n\n#ifndef OPENSSL_DES_LIBDES_COMPATIBILITY\n#define des_cblock DES_cblock\n#define const_des_cblock const_DES_cblock\n#define des_key_schedule DES_key_schedule\n#define des_ecb3_encrypt(i,o,k1,k2,k3,e)\\\n\tDES_ecb3_encrypt((i),(o),&(k1),&(k2),&(k3),(e))\n#define des_ede3_cbc_encrypt(i,o,l,k1,k2,k3,iv,e)\\\n\tDES_ede3_cbc_encrypt((i),(o),(l),&(k1),&(k2),&(k3),(iv),(e))\n#define des_ede3_cbcm_encrypt(i,o,l,k1,k2,k3,iv1,iv2,e)\\\n\tDES_ede3_cbcm_encrypt((i),(o),(l),&(k1),&(k2),&(k3),(iv1),(iv2),(e))\n#define des_ede3_cfb64_encrypt(i,o,l,k1,k2,k3,iv,n,e)\\\n\tDES_ede3_cfb64_encrypt((i),(o),(l),&(k1),&(k2),&(k3),(iv),(n),(e))\n#define des_ede3_ofb64_encrypt(i,o,l,k1,k2,k3,iv,n)\\\n\tDES_ede3_ofb64_encrypt((i),(o),(l),&(k1),&(k2),&(k3),(iv),(n))\n#define des_options()\\\n\tDES_options()\n#define des_cbc_cksum(i,o,l,k,iv)\\\n\tDES_cbc_cksum((i),(o),(l),&(k),(iv))\n#define des_cbc_encrypt(i,o,l,k,iv,e)\\\n\tDES_cbc_encrypt((i),(o),(l),&(k),(iv),(e))\n#define des_ncbc_encrypt(i,o,l,k,iv,e)\\\n\tDES_ncbc_encrypt((i),(o),(l),&(k),(iv),(e))\n#define des_xcbc_encrypt(i,o,l,k,iv,inw,outw,e)\\\n\tDES_xcbc_encrypt((i),(o),(l),&(k),(iv),(inw),(outw),(e))\n#define des_cfb_encrypt(i,o,n,l,k,iv,e)\\\n\tDES_cfb_encrypt((i),(o),(n),(l),&(k),(iv),(e))\n#define des_ecb_encrypt(i,o,k,e)\\\n\tDES_ecb_encrypt((i),(o),&(k),(e))\n#define des_encrypt1(d,k,e)\\\n\tDES_encrypt1((d),&(k),(e))\n#define des_encrypt2(d,k,e)\\\n\tDES_encrypt2((d),&(k),(e))\n#define des_encrypt3(d,k1,k2,k3)\\\n\tDES_encrypt3((d),&(k1),&(k2),&(k3))\n#define des_decrypt3(d,k1,k2,k3)\\\n\tDES_decrypt3((d),&(k1),&(k2),&(k3))\n#define des_xwhite_in2out(k,i,o)\\\n\tDES_xwhite_in2out((k),(i),(o))\n#define des_enc_read(f,b,l,k,iv)\\\n\tDES_enc_read((f),(b),(l),&(k),(iv))\n#define des_enc_write(f,b,l,k,iv)\\\n\tDES_enc_write((f),(b),(l),&(k),(iv))\n#define des_fcrypt(b,s,r)\\\n\tDES_fcrypt((b),(s),(r))\n#if 0\n#define des_crypt(b,s)\\\n\tDES_crypt((b),(s))\n#if !defined(PERL5) && !defined(__FreeBSD__) && !defined(NeXT) && !defined(__OpenBSD__)\n#define crypt(b,s)\\\n\tDES_crypt((b),(s))\n#endif\n#endif\n#define des_ofb_encrypt(i,o,n,l,k,iv)\\\n\tDES_ofb_encrypt((i),(o),(n),(l),&(k),(iv))\n#define des_pcbc_encrypt(i,o,l,k,iv,e)\\\n\tDES_pcbc_encrypt((i),(o),(l),&(k),(iv),(e))\n#define des_quad_cksum(i,o,l,c,s)\\\n\tDES_quad_cksum((i),(o),(l),(c),(s))\n#define des_random_seed(k)\\\n\t_ossl_096_des_random_seed((k))\n#define des_random_key(r)\\\n\tDES_random_key((r))\n#define des_read_password(k,p,v) \\\n\tDES_read_password((k),(p),(v))\n#define des_read_2passwords(k1,k2,p,v) \\\n\tDES_read_2passwords((k1),(k2),(p),(v))\n#define des_set_odd_parity(k)\\\n\tDES_set_odd_parity((k))\n#define des_check_key_parity(k)\\\n\tDES_check_key_parity((k))\n#define des_is_weak_key(k)\\\n\tDES_is_weak_key((k))\n#define des_set_key(k,ks)\\\n\tDES_set_key((k),&(ks))\n#define des_key_sched(k,ks)\\\n\tDES_key_sched((k),&(ks))\n#define des_set_key_checked(k,ks)\\\n\tDES_set_key_checked((k),&(ks))\n#define des_set_key_unchecked(k,ks)\\\n\tDES_set_key_unchecked((k),&(ks))\n#define des_string_to_key(s,k)\\\n\tDES_string_to_key((s),(k))\n#define des_string_to_2keys(s,k1,k2)\\\n\tDES_string_to_2keys((s),(k1),(k2))\n#define des_cfb64_encrypt(i,o,l,ks,iv,n,e)\\\n\tDES_cfb64_encrypt((i),(o),(l),&(ks),(iv),(n),(e))\n#define des_ofb64_encrypt(i,o,l,ks,iv,n)\\\n\tDES_ofb64_encrypt((i),(o),(l),&(ks),(iv),(n))\n\t\t\n\n#define des_ecb2_encrypt(i,o,k1,k2,e) \\\n\tdes_ecb3_encrypt((i),(o),(k1),(k2),(k1),(e))\n\n#define des_ede2_cbc_encrypt(i,o,l,k1,k2,iv,e) \\\n\tdes_ede3_cbc_encrypt((i),(o),(l),(k1),(k2),(k1),(iv),(e))\n\n#define des_ede2_cfb64_encrypt(i,o,l,k1,k2,iv,n,e) \\\n\tdes_ede3_cfb64_encrypt((i),(o),(l),(k1),(k2),(k1),(iv),(n),(e))\n\n#define des_ede2_ofb64_encrypt(i,o,l,k1,k2,iv,n) \\\n\tdes_ede3_ofb64_encrypt((i),(o),(l),(k1),(k2),(k1),(iv),(n))\n\n#define des_check_key DES_check_key\n#define des_rw_mode DES_rw_mode\n#else /* libdes compatibility */\n/* Map all symbol names to _ossl_old_des_* form, so we avoid all\n   clashes with libdes */\n#define des_cblock _ossl_old_des_cblock\n#define des_key_schedule _ossl_old_des_key_schedule\n#define des_ecb3_encrypt(i,o,k1,k2,k3,e)\\\n\t_ossl_old_des_ecb3_encrypt((i),(o),(k1),(k2),(k3),(e))\n#define des_ede3_cbc_encrypt(i,o,l,k1,k2,k3,iv,e)\\\n\t_ossl_old_des_ede3_cbc_encrypt((i),(o),(l),(k1),(k2),(k3),(iv),(e))\n#define des_ede3_cfb64_encrypt(i,o,l,k1,k2,k3,iv,n,e)\\\n\t_ossl_old_des_ede3_cfb64_encrypt((i),(o),(l),(k1),(k2),(k3),(iv),(n),(e))\n#define des_ede3_ofb64_encrypt(i,o,l,k1,k2,k3,iv,n)\\\n\t_ossl_old_des_ede3_ofb64_encrypt((i),(o),(l),(k1),(k2),(k3),(iv),(n))\n#define des_options()\\\n\t_ossl_old_des_options()\n#define des_cbc_cksum(i,o,l,k,iv)\\\n\t_ossl_old_des_cbc_cksum((i),(o),(l),(k),(iv))\n#define des_cbc_encrypt(i,o,l,k,iv,e)\\\n\t_ossl_old_des_cbc_encrypt((i),(o),(l),(k),(iv),(e))\n#define des_ncbc_encrypt(i,o,l,k,iv,e)\\\n\t_ossl_old_des_ncbc_encrypt((i),(o),(l),(k),(iv),(e))\n#define des_xcbc_encrypt(i,o,l,k,iv,inw,outw,e)\\\n\t_ossl_old_des_xcbc_encrypt((i),(o),(l),(k),(iv),(inw),(outw),(e))\n#define des_cfb_encrypt(i,o,n,l,k,iv,e)\\\n\t_ossl_old_des_cfb_encrypt((i),(o),(n),(l),(k),(iv),(e))\n#define des_ecb_encrypt(i,o,k,e)\\\n\t_ossl_old_des_ecb_encrypt((i),(o),(k),(e))\n#define des_encrypt(d,k,e)\\\n\t_ossl_old_des_encrypt((d),(k),(e))\n#define des_encrypt2(d,k,e)\\\n\t_ossl_old_des_encrypt2((d),(k),(e))\n#define des_encrypt3(d,k1,k2,k3)\\\n\t_ossl_old_des_encrypt3((d),(k1),(k2),(k3))\n#define des_decrypt3(d,k1,k2,k3)\\\n\t_ossl_old_des_decrypt3((d),(k1),(k2),(k3))\n#define des_xwhite_in2out(k,i,o)\\\n\t_ossl_old_des_xwhite_in2out((k),(i),(o))\n#define des_enc_read(f,b,l,k,iv)\\\n\t_ossl_old_des_enc_read((f),(b),(l),(k),(iv))\n#define des_enc_write(f,b,l,k,iv)\\\n\t_ossl_old_des_enc_write((f),(b),(l),(k),(iv))\n#define des_fcrypt(b,s,r)\\\n\t_ossl_old_des_fcrypt((b),(s),(r))\n#define des_crypt(b,s)\\\n\t_ossl_old_des_crypt((b),(s))\n#if 0\n#define crypt(b,s)\\\n\t_ossl_old_crypt((b),(s))\n#endif\n#define des_ofb_encrypt(i,o,n,l,k,iv)\\\n\t_ossl_old_des_ofb_encrypt((i),(o),(n),(l),(k),(iv))\n#define des_pcbc_encrypt(i,o,l,k,iv,e)\\\n\t_ossl_old_des_pcbc_encrypt((i),(o),(l),(k),(iv),(e))\n#define des_quad_cksum(i,o,l,c,s)\\\n\t_ossl_old_des_quad_cksum((i),(o),(l),(c),(s))\n#define des_random_seed(k)\\\n\t_ossl_old_des_random_seed((k))\n#define des_random_key(r)\\\n\t_ossl_old_des_random_key((r))\n#define des_read_password(k,p,v) \\\n\t_ossl_old_des_read_password((k),(p),(v))\n#define des_read_2passwords(k1,k2,p,v) \\\n\t_ossl_old_des_read_2passwords((k1),(k2),(p),(v))\n#define des_set_odd_parity(k)\\\n\t_ossl_old_des_set_odd_parity((k))\n#define des_is_weak_key(k)\\\n\t_ossl_old_des_is_weak_key((k))\n#define des_set_key(k,ks)\\\n\t_ossl_old_des_set_key((k),(ks))\n#define des_key_sched(k,ks)\\\n\t_ossl_old_des_key_sched((k),(ks))\n#define des_string_to_key(s,k)\\\n\t_ossl_old_des_string_to_key((s),(k))\n#define des_string_to_2keys(s,k1,k2)\\\n\t_ossl_old_des_string_to_2keys((s),(k1),(k2))\n#define des_cfb64_encrypt(i,o,l,ks,iv,n,e)\\\n\t_ossl_old_des_cfb64_encrypt((i),(o),(l),(ks),(iv),(n),(e))\n#define des_ofb64_encrypt(i,o,l,ks,iv,n)\\\n\t_ossl_old_des_ofb64_encrypt((i),(o),(l),(ks),(iv),(n))\n\t\t\n\n#define des_ecb2_encrypt(i,o,k1,k2,e) \\\n\tdes_ecb3_encrypt((i),(o),(k1),(k2),(k1),(e))\n\n#define des_ede2_cbc_encrypt(i,o,l,k1,k2,iv,e) \\\n\tdes_ede3_cbc_encrypt((i),(o),(l),(k1),(k2),(k1),(iv),(e))\n\n#define des_ede2_cfb64_encrypt(i,o,l,k1,k2,iv,n,e) \\\n\tdes_ede3_cfb64_encrypt((i),(o),(l),(k1),(k2),(k1),(iv),(n),(e))\n\n#define des_ede2_ofb64_encrypt(i,o,l,k1,k2,iv,n) \\\n\tdes_ede3_ofb64_encrypt((i),(o),(l),(k1),(k2),(k1),(iv),(n))\n\n#define des_check_key DES_check_key\n#define des_rw_mode DES_rw_mode\n#endif\n\nconst char *_ossl_old_des_options(void);\nvoid _ossl_old_des_ecb3_encrypt(_ossl_old_des_cblock *input,_ossl_old_des_cblock *output,\n\t_ossl_old_des_key_schedule ks1,_ossl_old_des_key_schedule ks2,\n\t_ossl_old_des_key_schedule ks3, int enc);\nDES_LONG _ossl_old_des_cbc_cksum(_ossl_old_des_cblock *input,_ossl_old_des_cblock *output,\n\tlong length,_ossl_old_des_key_schedule schedule,_ossl_old_des_cblock *ivec);\nvoid _ossl_old_des_cbc_encrypt(_ossl_old_des_cblock *input,_ossl_old_des_cblock *output,long length,\n\t_ossl_old_des_key_schedule schedule,_ossl_old_des_cblock *ivec,int enc);\nvoid _ossl_old_des_ncbc_encrypt(_ossl_old_des_cblock *input,_ossl_old_des_cblock *output,long length,\n\t_ossl_old_des_key_schedule schedule,_ossl_old_des_cblock *ivec,int enc);\nvoid _ossl_old_des_xcbc_encrypt(_ossl_old_des_cblock *input,_ossl_old_des_cblock *output,long length,\n\t_ossl_old_des_key_schedule schedule,_ossl_old_des_cblock *ivec,\n\t_ossl_old_des_cblock *inw,_ossl_old_des_cblock *outw,int enc);\nvoid _ossl_old_des_cfb_encrypt(unsigned char *in,unsigned char *out,int numbits,\n\tlong length,_ossl_old_des_key_schedule schedule,_ossl_old_des_cblock *ivec,int enc);\nvoid _ossl_old_des_ecb_encrypt(_ossl_old_des_cblock *input,_ossl_old_des_cblock *output,\n\t_ossl_old_des_key_schedule ks,int enc);\nvoid _ossl_old_des_encrypt(DES_LONG *data,_ossl_old_des_key_schedule ks, int enc);\nvoid _ossl_old_des_encrypt2(DES_LONG *data,_ossl_old_des_key_schedule ks, int enc);\nvoid _ossl_old_des_encrypt3(DES_LONG *data, _ossl_old_des_key_schedule ks1,\n\t_ossl_old_des_key_schedule ks2, _ossl_old_des_key_schedule ks3);\nvoid _ossl_old_des_decrypt3(DES_LONG *data, _ossl_old_des_key_schedule ks1,\n\t_ossl_old_des_key_schedule ks2, _ossl_old_des_key_schedule ks3);\nvoid _ossl_old_des_ede3_cbc_encrypt(_ossl_old_des_cblock *input, _ossl_old_des_cblock *output, \n\tlong length, _ossl_old_des_key_schedule ks1, _ossl_old_des_key_schedule ks2, \n\t_ossl_old_des_key_schedule ks3, _ossl_old_des_cblock *ivec, int enc);\nvoid _ossl_old_des_ede3_cfb64_encrypt(unsigned char *in, unsigned char *out,\n\tlong length, _ossl_old_des_key_schedule ks1, _ossl_old_des_key_schedule ks2,\n\t_ossl_old_des_key_schedule ks3, _ossl_old_des_cblock *ivec, int *num, int enc);\nvoid _ossl_old_des_ede3_ofb64_encrypt(unsigned char *in, unsigned char *out,\n\tlong length, _ossl_old_des_key_schedule ks1, _ossl_old_des_key_schedule ks2,\n\t_ossl_old_des_key_schedule ks3, _ossl_old_des_cblock *ivec, int *num);\n#if 0\nvoid _ossl_old_des_xwhite_in2out(_ossl_old_des_cblock (*des_key), _ossl_old_des_cblock (*in_white),\n\t_ossl_old_des_cblock (*out_white));\n#endif\n\nint _ossl_old_des_enc_read(int fd,char *buf,int len,_ossl_old_des_key_schedule sched,\n\t_ossl_old_des_cblock *iv);\nint _ossl_old_des_enc_write(int fd,char *buf,int len,_ossl_old_des_key_schedule sched,\n\t_ossl_old_des_cblock *iv);\nchar *_ossl_old_des_fcrypt(const char *buf,const char *salt, char *ret);\nchar *_ossl_old_des_crypt(const char *buf,const char *salt);\n#if !defined(PERL5) && !defined(NeXT)\nchar *_ossl_old_crypt(const char *buf,const char *salt);\n#endif\nvoid _ossl_old_des_ofb_encrypt(unsigned char *in,unsigned char *out,\n\tint numbits,long length,_ossl_old_des_key_schedule schedule,_ossl_old_des_cblock *ivec);\nvoid _ossl_old_des_pcbc_encrypt(_ossl_old_des_cblock *input,_ossl_old_des_cblock *output,long length,\n\t_ossl_old_des_key_schedule schedule,_ossl_old_des_cblock *ivec,int enc);\nDES_LONG _ossl_old_des_quad_cksum(_ossl_old_des_cblock *input,_ossl_old_des_cblock *output,\n\tlong length,int out_count,_ossl_old_des_cblock *seed);\nvoid _ossl_old_des_random_seed(_ossl_old_des_cblock key);\nvoid _ossl_old_des_random_key(_ossl_old_des_cblock ret);\nint _ossl_old_des_read_password(_ossl_old_des_cblock *key,const char *prompt,int verify);\nint _ossl_old_des_read_2passwords(_ossl_old_des_cblock *key1,_ossl_old_des_cblock *key2,\n\tconst char *prompt,int verify);\nvoid _ossl_old_des_set_odd_parity(_ossl_old_des_cblock *key);\nint _ossl_old_des_is_weak_key(_ossl_old_des_cblock *key);\nint _ossl_old_des_set_key(_ossl_old_des_cblock *key,_ossl_old_des_key_schedule schedule);\nint _ossl_old_des_key_sched(_ossl_old_des_cblock *key,_ossl_old_des_key_schedule schedule);\nvoid _ossl_old_des_string_to_key(char *str,_ossl_old_des_cblock *key);\nvoid _ossl_old_des_string_to_2keys(char *str,_ossl_old_des_cblock *key1,_ossl_old_des_cblock *key2);\nvoid _ossl_old_des_cfb64_encrypt(unsigned char *in, unsigned char *out, long length,\n\t_ossl_old_des_key_schedule schedule, _ossl_old_des_cblock *ivec, int *num, int enc);\nvoid _ossl_old_des_ofb64_encrypt(unsigned char *in, unsigned char *out, long length,\n\t_ossl_old_des_key_schedule schedule, _ossl_old_des_cblock *ivec, int *num);\n\nvoid _ossl_096_des_random_seed(des_cblock *key);\n\n/* The following definitions provide compatibility with the MIT Kerberos\n * library. The _ossl_old_des_key_schedule structure is not binary compatible. */\n\n#define _KERBEROS_DES_H\n\n#define KRBDES_ENCRYPT DES_ENCRYPT\n#define KRBDES_DECRYPT DES_DECRYPT\n\n#ifdef KERBEROS\n#  define ENCRYPT DES_ENCRYPT\n#  define DECRYPT DES_DECRYPT\n#endif\n\n#ifndef NCOMPAT\n#  define C_Block des_cblock\n#  define Key_schedule des_key_schedule\n#  define KEY_SZ DES_KEY_SZ\n#  define string_to_key des_string_to_key\n#  define read_pw_string des_read_pw_string\n#  define random_key des_random_key\n#  define pcbc_encrypt des_pcbc_encrypt\n#  define set_key des_set_key\n#  define key_sched des_key_sched\n#  define ecb_encrypt des_ecb_encrypt\n#  define cbc_encrypt des_cbc_encrypt\n#  define ncbc_encrypt des_ncbc_encrypt\n#  define xcbc_encrypt des_xcbc_encrypt\n#  define cbc_cksum des_cbc_cksum\n#  define quad_cksum des_quad_cksum\n#  define check_parity des_check_key_parity\n#endif\n\n#define des_fixup_key_parity DES_fixup_key_parity\n\n#ifdef  __cplusplus\n}\n#endif\n\n/* for DES_read_pw_string et al */\n#include <openssl/ui_compat.h>\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/openssl/dh.h",
    "content": "/* crypto/dh/dh.h */\n/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)\n * All rights reserved.\n *\n * This package is an SSL implementation written\n * by Eric Young (eay@cryptsoft.com).\n * The implementation was written so as to conform with Netscapes SSL.\n * \n * This library is free for commercial and non-commercial use as long as\n * the following conditions are aheared to.  The following conditions\n * apply to all code found in this distribution, be it the RC4, RSA,\n * lhash, DES, etc., code; not just the SSL code.  The SSL documentation\n * included with this distribution is covered by the same copyright terms\n * except that the holder is Tim Hudson (tjh@cryptsoft.com).\n * \n * Copyright remains Eric Young's, and as such any Copyright notices in\n * the code are not to be removed.\n * If this package is used in a product, Eric Young should be given attribution\n * as the author of the parts of the library used.\n * This can be in the form of a textual message at program startup or\n * in documentation (online or textual) provided with the package.\n * \n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. All advertising materials mentioning features or use of this software\n *    must display the following acknowledgement:\n *    \"This product includes cryptographic software written by\n *     Eric Young (eay@cryptsoft.com)\"\n *    The word 'cryptographic' can be left out if the rouines from the library\n *    being used are not cryptographic related :-).\n * 4. If you include any Windows specific code (or a derivative thereof) from \n *    the apps directory (application code) you must include an acknowledgement:\n *    \"This product includes software written by Tim Hudson (tjh@cryptsoft.com)\"\n * \n * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n * \n * The licence and distribution terms for any publically available version or\n * derivative of this code cannot be changed.  i.e. this code cannot simply be\n * copied and put under another distribution licence\n * [including the GNU Public Licence.]\n */\n\n#ifndef HEADER_DH_H\n#define HEADER_DH_H\n\n#include <openssl/e_os2.h>\n\n#ifdef OPENSSL_NO_DH\n#error DH is disabled.\n#endif\n\n#ifndef OPENSSL_NO_BIO\n#include <openssl/bio.h>\n#endif\n#include <openssl/ossl_typ.h>\n#ifndef OPENSSL_NO_DEPRECATED\n#include <openssl/bn.h>\n#endif\n\t\n#ifndef OPENSSL_DH_MAX_MODULUS_BITS\n# define OPENSSL_DH_MAX_MODULUS_BITS\t10000\n#endif\n\n#define OPENSSL_DH_FIPS_MIN_MODULUS_BITS 1024\n\n#define DH_FLAG_CACHE_MONT_P     0x01\n#define DH_FLAG_NO_EXP_CONSTTIME 0x02 /* new with 0.9.7h; the built-in DH\n                                       * implementation now uses constant time\n                                       * modular exponentiation for secret exponents\n                                       * by default. This flag causes the\n                                       * faster variable sliding window method to\n                                       * be used for all exponents.\n                                       */\n\n#ifdef  __cplusplus\nextern \"C\" {\n#endif\n\n/* Already defined in ossl_typ.h */\n/* typedef struct dh_st DH; */\n/* typedef struct dh_method DH_METHOD; */\n\nstruct dh_method\n\t{\n\tconst char *name;\n\t/* Methods here */\n\tint (*generate_key)(DH *dh);\n\tint (*compute_key)(unsigned char *key,const BIGNUM *pub_key,DH *dh);\n\tint (*bn_mod_exp)(const DH *dh, BIGNUM *r, const BIGNUM *a,\n\t\t\t\tconst BIGNUM *p, const BIGNUM *m, BN_CTX *ctx,\n\t\t\t\tBN_MONT_CTX *m_ctx); /* Can be null */\n\n\tint (*init)(DH *dh);\n\tint (*finish)(DH *dh);\n\tint flags;\n\tchar *app_data;\n\t/* If this is non-NULL, it will be used to generate parameters */\n\tint (*generate_params)(DH *dh, int prime_len, int generator, BN_GENCB *cb);\n\t};\n\nstruct dh_st\n\t{\n\t/* This first argument is used to pick up errors when\n\t * a DH is passed instead of a EVP_PKEY */\n\tint pad;\n\tint version;\n\tBIGNUM *p;\n\tBIGNUM *g;\n\tlong length; /* optional */\n\tBIGNUM *pub_key;\t/* g^x */\n\tBIGNUM *priv_key;\t/* x */\n\n\tint flags;\n\tBN_MONT_CTX *method_mont_p;\n\t/* Place holders if we want to do X9.42 DH */\n\tBIGNUM *q;\n\tBIGNUM *j;\n\tunsigned char *seed;\n\tint seedlen;\n\tBIGNUM *counter;\n\n\tint references;\n\tCRYPTO_EX_DATA ex_data;\n\tconst DH_METHOD *meth;\n\tENGINE *engine;\n\t};\n\n#define DH_GENERATOR_2\t\t2\n/* #define DH_GENERATOR_3\t3 */\n#define DH_GENERATOR_5\t\t5\n\n/* DH_check error codes */\n#define DH_CHECK_P_NOT_PRIME\t\t0x01\n#define DH_CHECK_P_NOT_SAFE_PRIME\t0x02\n#define DH_UNABLE_TO_CHECK_GENERATOR\t0x04\n#define DH_NOT_SUITABLE_GENERATOR\t0x08\n\n/* DH_check_pub_key error codes */\n#define DH_CHECK_PUBKEY_TOO_SMALL\t0x01\n#define DH_CHECK_PUBKEY_TOO_LARGE\t0x02\n\n/* primes p where (p-1)/2 is prime too are called \"safe\"; we define\n   this for backward compatibility: */\n#define DH_CHECK_P_NOT_STRONG_PRIME\tDH_CHECK_P_NOT_SAFE_PRIME\n\n#define DHparams_dup(x) ASN1_dup_of_const(DH,i2d_DHparams,d2i_DHparams,x)\n#define d2i_DHparams_fp(fp,x) (DH *)ASN1_d2i_fp((char *(*)())DH_new, \\\n\t\t(char *(*)())d2i_DHparams,(fp),(unsigned char **)(x))\n#define i2d_DHparams_fp(fp,x) ASN1_i2d_fp(i2d_DHparams,(fp), \\\n\t\t(unsigned char *)(x))\n#define d2i_DHparams_bio(bp,x) ASN1_d2i_bio_of(DH,DH_new,d2i_DHparams,bp,x)\n#define i2d_DHparams_bio(bp,x) ASN1_i2d_bio_of_const(DH,i2d_DHparams,bp,x)\n\nconst DH_METHOD *DH_OpenSSL(void);\n\n#ifdef OPENSSL_FIPS\nDH *\tFIPS_dh_new(void);\nvoid\tFIPS_dh_free(DH *dh);\n#endif\n\nvoid DH_set_default_method(const DH_METHOD *meth);\nconst DH_METHOD *DH_get_default_method(void);\nint DH_set_method(DH *dh, const DH_METHOD *meth);\nDH *DH_new_method(ENGINE *engine);\n\nDH *\tDH_new(void);\nvoid\tDH_free(DH *dh);\nint\tDH_up_ref(DH *dh);\nint\tDH_size(const DH *dh);\nint DH_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func,\n\t     CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func);\nint DH_set_ex_data(DH *d, int idx, void *arg);\nvoid *DH_get_ex_data(DH *d, int idx);\n\n/* Deprecated version */\n#ifndef OPENSSL_NO_DEPRECATED\nDH *\tDH_generate_parameters(int prime_len,int generator,\n\t\tvoid (*callback)(int,int,void *),void *cb_arg);\n#endif /* !defined(OPENSSL_NO_DEPRECATED) */\n\n/* New version */\nint\tDH_generate_parameters_ex(DH *dh, int prime_len,int generator, BN_GENCB *cb);\n\nint\tDH_check(const DH *dh,int *codes);\nint\tDH_check_pub_key(const DH *dh,const BIGNUM *pub_key, int *codes);\nint\tDH_generate_key(DH *dh);\nint\tDH_compute_key(unsigned char *key,const BIGNUM *pub_key,DH *dh);\nDH *\td2i_DHparams(DH **a,const unsigned char **pp, long length);\nint\ti2d_DHparams(const DH *a,unsigned char **pp);\n#ifndef OPENSSL_NO_FP_API\nint\tDHparams_print_fp(FILE *fp, const DH *x);\n#endif\n#ifndef OPENSSL_NO_BIO\nint\tDHparams_print(BIO *bp, const DH *x);\n#else\nint\tDHparams_print(char *bp, const DH *x);\n#endif\n\n/* BEGIN ERROR CODES */\n/* The following lines are auto generated by the script mkerr.pl. Any changes\n * made after this point may be overwritten when the script is next run.\n */\nvoid ERR_load_DH_strings(void);\n\n/* Error codes for the DH functions. */\n\n/* Function codes. */\n#define DH_F_COMPUTE_KEY\t\t\t\t 102\n#define DH_F_DHPARAMS_PRINT\t\t\t\t 100\n#define DH_F_DHPARAMS_PRINT_FP\t\t\t\t 101\n#define DH_F_DH_BUILTIN_GENPARAMS\t\t\t 106\n#define DH_F_DH_COMPUTE_KEY\t\t\t\t 107\n#define DH_F_DH_GENERATE_KEY\t\t\t\t 108\n#define DH_F_DH_GENERATE_PARAMETERS\t\t\t 109\n#define DH_F_DH_NEW_METHOD\t\t\t\t 105\n#define DH_F_GENERATE_KEY\t\t\t\t 103\n#define DH_F_GENERATE_PARAMETERS\t\t\t 104\n\n/* Reason codes. */\n#define DH_R_BAD_GENERATOR\t\t\t\t 101\n#define DH_R_INVALID_PUBKEY\t\t\t\t 102\n#define DH_R_KEY_SIZE_TOO_SMALL\t\t\t\t 104\n#define DH_R_MODULUS_TOO_LARGE\t\t\t\t 103\n#define DH_R_NO_PRIVATE_VALUE\t\t\t\t 100\n\n#ifdef  __cplusplus\n}\n#endif\n#endif\n"
  },
  {
    "path": "freebsd-headers/openssl/dsa.h",
    "content": "/* crypto/dsa/dsa.h */\n/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)\n * All rights reserved.\n *\n * This package is an SSL implementation written\n * by Eric Young (eay@cryptsoft.com).\n * The implementation was written so as to conform with Netscapes SSL.\n * \n * This library is free for commercial and non-commercial use as long as\n * the following conditions are aheared to.  The following conditions\n * apply to all code found in this distribution, be it the RC4, RSA,\n * lhash, DES, etc., code; not just the SSL code.  The SSL documentation\n * included with this distribution is covered by the same copyright terms\n * except that the holder is Tim Hudson (tjh@cryptsoft.com).\n * \n * Copyright remains Eric Young's, and as such any Copyright notices in\n * the code are not to be removed.\n * If this package is used in a product, Eric Young should be given attribution\n * as the author of the parts of the library used.\n * This can be in the form of a textual message at program startup or\n * in documentation (online or textual) provided with the package.\n * \n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. All advertising materials mentioning features or use of this software\n *    must display the following acknowledgement:\n *    \"This product includes cryptographic software written by\n *     Eric Young (eay@cryptsoft.com)\"\n *    The word 'cryptographic' can be left out if the rouines from the library\n *    being used are not cryptographic related :-).\n * 4. If you include any Windows specific code (or a derivative thereof) from \n *    the apps directory (application code) you must include an acknowledgement:\n *    \"This product includes software written by Tim Hudson (tjh@cryptsoft.com)\"\n * \n * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n * \n * The licence and distribution terms for any publically available version or\n * derivative of this code cannot be changed.  i.e. this code cannot simply be\n * copied and put under another distribution licence\n * [including the GNU Public Licence.]\n */\n\n/*\n * The DSS routines are based on patches supplied by\n * Steven Schoch <schoch@sheba.arc.nasa.gov>.  He basically did the\n * work and I have just tweaked them a little to fit into my\n * stylistic vision for SSLeay :-) */\n\n#ifndef HEADER_DSA_H\n#define HEADER_DSA_H\n\n#include <openssl/e_os2.h>\n\n#ifdef OPENSSL_NO_DSA\n#error DSA is disabled.\n#endif\n\n#ifndef OPENSSL_NO_BIO\n#include <openssl/bio.h>\n#endif\n#include <openssl/crypto.h>\n#include <openssl/ossl_typ.h>\n\n#ifndef OPENSSL_NO_DEPRECATED\n#include <openssl/bn.h>\n#ifndef OPENSSL_NO_DH\n# include <openssl/dh.h>\n#endif\n#endif\n\n#ifndef OPENSSL_DSA_MAX_MODULUS_BITS\n# define OPENSSL_DSA_MAX_MODULUS_BITS\t10000\n#endif\n\n#define OPENSSL_DSA_FIPS_MIN_MODULUS_BITS 1024\n\n#define DSA_FLAG_CACHE_MONT_P\t0x01\n#define DSA_FLAG_NO_EXP_CONSTTIME       0x02 /* new with 0.9.7h; the built-in DSA\n                                              * implementation now uses constant time\n                                              * modular exponentiation for secret exponents\n                                              * by default. This flag causes the\n                                              * faster variable sliding window method to\n                                              * be used for all exponents.\n                                              */\n\n/* If this flag is set the DSA method is FIPS compliant and can be used\n * in FIPS mode. This is set in the validated module method. If an\n * application sets this flag in its own methods it is its reposibility\n * to ensure the result is compliant.\n */\n\n#define DSA_FLAG_FIPS_METHOD\t\t\t0x0400\n\n/* If this flag is set the operations normally disabled in FIPS mode are\n * permitted it is then the applications responsibility to ensure that the\n * usage is compliant.\n */\n\n#define DSA_FLAG_NON_FIPS_ALLOW\t\t\t0x0400\n\n#ifdef OPENSSL_FIPS\n#define FIPS_DSA_SIZE_T\tint\n#endif\n\n#ifdef  __cplusplus\nextern \"C\" {\n#endif\n\n/* Already defined in ossl_typ.h */\n/* typedef struct dsa_st DSA; */\n/* typedef struct dsa_method DSA_METHOD; */\n\ntypedef struct DSA_SIG_st\n\t{\n\tBIGNUM *r;\n\tBIGNUM *s;\n\t} DSA_SIG;\n\nstruct dsa_method\n\t{\n\tconst char *name;\n\tDSA_SIG * (*dsa_do_sign)(const unsigned char *dgst, int dlen, DSA *dsa);\n\tint (*dsa_sign_setup)(DSA *dsa, BN_CTX *ctx_in, BIGNUM **kinvp,\n\t\t\t\t\t\t\t\tBIGNUM **rp);\n\tint (*dsa_do_verify)(const unsigned char *dgst, int dgst_len,\n\t\t\t\t\t\t\tDSA_SIG *sig, DSA *dsa);\n\tint (*dsa_mod_exp)(DSA *dsa, BIGNUM *rr, BIGNUM *a1, BIGNUM *p1,\n\t\t\tBIGNUM *a2, BIGNUM *p2, BIGNUM *m, BN_CTX *ctx,\n\t\t\tBN_MONT_CTX *in_mont);\n\tint (*bn_mod_exp)(DSA *dsa, BIGNUM *r, BIGNUM *a, const BIGNUM *p,\n\t\t\t\tconst BIGNUM *m, BN_CTX *ctx,\n\t\t\t\tBN_MONT_CTX *m_ctx); /* Can be null */\n\tint (*init)(DSA *dsa);\n\tint (*finish)(DSA *dsa);\n\tint flags;\n\tchar *app_data;\n\t/* If this is non-NULL, it is used to generate DSA parameters */\n\tint (*dsa_paramgen)(DSA *dsa, int bits,\n\t\t\tunsigned char *seed, int seed_len,\n\t\t\tint *counter_ret, unsigned long *h_ret,\n\t\t\tBN_GENCB *cb);\n\t/* If this is non-NULL, it is used to generate DSA keys */\n\tint (*dsa_keygen)(DSA *dsa);\n\t};\n\nstruct dsa_st\n\t{\n\t/* This first variable is used to pick up errors where\n\t * a DSA is passed instead of of a EVP_PKEY */\n\tint pad;\n\tlong version;\n\tint write_params;\n\tBIGNUM *p;\n\tBIGNUM *q;\t/* == 20 */\n\tBIGNUM *g;\n\n\tBIGNUM *pub_key;  /* y public key */\n\tBIGNUM *priv_key; /* x private key */\n\n\tBIGNUM *kinv;\t/* Signing pre-calc */\n\tBIGNUM *r;\t/* Signing pre-calc */\n\n\tint flags;\n\t/* Normally used to cache montgomery values */\n\tBN_MONT_CTX *method_mont_p;\n\tint references;\n\tCRYPTO_EX_DATA ex_data;\n\tconst DSA_METHOD *meth;\n\t/* functional reference if 'meth' is ENGINE-provided */\n\tENGINE *engine;\n\t};\n\n#define DSAparams_dup(x) ASN1_dup_of_const(DSA,i2d_DSAparams,d2i_DSAparams,x)\n#define d2i_DSAparams_fp(fp,x) (DSA *)ASN1_d2i_fp((char *(*)())DSA_new, \\\n\t\t(char *(*)())d2i_DSAparams,(fp),(unsigned char **)(x))\n#define i2d_DSAparams_fp(fp,x) ASN1_i2d_fp(i2d_DSAparams,(fp), \\\n\t\t(unsigned char *)(x))\n#define d2i_DSAparams_bio(bp,x) ASN1_d2i_bio_of(DSA,DSA_new,d2i_DSAparams,bp,x)\n#define i2d_DSAparams_bio(bp,x) ASN1_i2d_bio_of_const(DSA,i2d_DSAparams,bp,x)\n\n\nDSA_SIG * DSA_SIG_new(void);\nvoid\tDSA_SIG_free(DSA_SIG *a);\nint\ti2d_DSA_SIG(const DSA_SIG *a, unsigned char **pp);\nDSA_SIG * d2i_DSA_SIG(DSA_SIG **v, const unsigned char **pp, long length);\n\nDSA_SIG * DSA_do_sign(const unsigned char *dgst,int dlen,DSA *dsa);\nint\tDSA_do_verify(const unsigned char *dgst,int dgst_len,\n\t\t      DSA_SIG *sig,DSA *dsa);\n\nconst DSA_METHOD *DSA_OpenSSL(void);\n\nvoid\tDSA_set_default_method(const DSA_METHOD *);\nconst DSA_METHOD *DSA_get_default_method(void);\nint\tDSA_set_method(DSA *dsa, const DSA_METHOD *);\n\n#ifdef OPENSSL_FIPS\nDSA *\tFIPS_dsa_new(void);\nvoid\tFIPS_dsa_free (DSA *r);\n#endif\n\nDSA *\tDSA_new(void);\nDSA *\tDSA_new_method(ENGINE *engine);\nvoid\tDSA_free (DSA *r);\n/* \"up\" the DSA object's reference count */\nint\tDSA_up_ref(DSA *r);\nint\tDSA_size(const DSA *);\n\t/* next 4 return -1 on error */\nint\tDSA_sign_setup( DSA *dsa,BN_CTX *ctx_in,BIGNUM **kinvp,BIGNUM **rp);\nint\tDSA_sign(int type,const unsigned char *dgst,int dlen,\n\t\tunsigned char *sig, unsigned int *siglen, DSA *dsa);\nint\tDSA_verify(int type,const unsigned char *dgst,int dgst_len,\n\t\tconst unsigned char *sigbuf, int siglen, DSA *dsa);\nint DSA_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func,\n\t     CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func);\nint DSA_set_ex_data(DSA *d, int idx, void *arg);\nvoid *DSA_get_ex_data(DSA *d, int idx);\n\nDSA *\td2i_DSAPublicKey(DSA **a, const unsigned char **pp, long length);\nDSA *\td2i_DSAPrivateKey(DSA **a, const unsigned char **pp, long length);\nDSA * \td2i_DSAparams(DSA **a, const unsigned char **pp, long length);\n\n/* Deprecated version */\n#ifndef OPENSSL_NO_DEPRECATED\nDSA *\tDSA_generate_parameters(int bits,\n\t\tunsigned char *seed,int seed_len,\n\t\tint *counter_ret, unsigned long *h_ret,void\n\t\t(*callback)(int, int, void *),void *cb_arg);\n#endif /* !defined(OPENSSL_NO_DEPRECATED) */\n\n/* New version */\nint\tDSA_generate_parameters_ex(DSA *dsa, int bits,\n\t\tunsigned char *seed,int seed_len,\n\t\tint *counter_ret, unsigned long *h_ret, BN_GENCB *cb);\n\nint\tDSA_generate_key(DSA *a);\nint\ti2d_DSAPublicKey(const DSA *a, unsigned char **pp);\nint \ti2d_DSAPrivateKey(const DSA *a, unsigned char **pp);\nint\ti2d_DSAparams(const DSA *a,unsigned char **pp);\n\n#ifndef OPENSSL_NO_BIO\nint\tDSAparams_print(BIO *bp, const DSA *x);\nint\tDSA_print(BIO *bp, const DSA *x, int off);\n#endif\n#ifndef OPENSSL_NO_FP_API\nint\tDSAparams_print_fp(FILE *fp, const DSA *x);\nint\tDSA_print_fp(FILE *bp, const DSA *x, int off);\n#endif\n\n#define DSS_prime_checks 50\n/* Primality test according to FIPS PUB 186[-1], Appendix 2.1:\n * 50 rounds of Rabin-Miller */\n#define DSA_is_prime(n, callback, cb_arg) \\\n\tBN_is_prime(n, DSS_prime_checks, callback, NULL, cb_arg)\n\n#ifndef OPENSSL_NO_DH\n/* Convert DSA structure (key or just parameters) into DH structure\n * (be careful to avoid small subgroup attacks when using this!) */\nDH *DSA_dup_DH(const DSA *r);\n#endif\n\n#ifdef OPENSSL_FIPS\nint FIPS_dsa_sig_encode(unsigned char *out, DSA_SIG *sig);\nint FIPS_dsa_sig_decode(DSA_SIG *sig, const unsigned char *in, int inlen);\n#endif\n\n/* BEGIN ERROR CODES */\n/* The following lines are auto generated by the script mkerr.pl. Any changes\n * made after this point may be overwritten when the script is next run.\n */\nvoid ERR_load_DSA_strings(void);\n\n/* Error codes for the DSA functions. */\n\n/* Function codes. */\n#define DSA_F_D2I_DSA_SIG\t\t\t\t 110\n#define DSA_F_DSAPARAMS_PRINT\t\t\t\t 100\n#define DSA_F_DSAPARAMS_PRINT_FP\t\t\t 101\n#define DSA_F_DSA_BUILTIN_KEYGEN\t\t\t 119\n#define DSA_F_DSA_BUILTIN_PARAMGEN\t\t\t 118\n#define DSA_F_DSA_DO_SIGN\t\t\t\t 112\n#define DSA_F_DSA_DO_VERIFY\t\t\t\t 113\n#define DSA_F_DSA_GENERATE_PARAMETERS\t\t\t 117\n#define DSA_F_DSA_NEW_METHOD\t\t\t\t 103\n#define DSA_F_DSA_PRINT\t\t\t\t\t 104\n#define DSA_F_DSA_PRINT_FP\t\t\t\t 105\n#define DSA_F_DSA_SET_DEFAULT_METHOD\t\t\t 115\n#define DSA_F_DSA_SET_METHOD\t\t\t\t 116\n#define DSA_F_DSA_SIGN\t\t\t\t\t 106\n#define DSA_F_DSA_SIGN_SETUP\t\t\t\t 107\n#define DSA_F_DSA_SIG_NEW\t\t\t\t 109\n#define DSA_F_DSA_VERIFY\t\t\t\t 108\n#define DSA_F_I2D_DSA_SIG\t\t\t\t 111\n#define DSA_F_SIG_CB\t\t\t\t\t 114\n\n/* Reason codes. */\n#define DSA_R_BAD_Q_VALUE\t\t\t\t 102\n#define DSA_R_DATA_TOO_LARGE_FOR_KEY_SIZE\t\t 100\n#define DSA_R_KEY_SIZE_TOO_SMALL\t\t\t 106\n#define DSA_R_MISSING_PARAMETERS\t\t\t 101\n#define DSA_R_MODULUS_TOO_LARGE\t\t\t\t 103\n#define DSA_R_NON_FIPS_METHOD\t\t\t\t 104\n#define DSA_R_OPERATION_NOT_ALLOWED_IN_FIPS_MODE\t 105\n\n#ifdef  __cplusplus\n}\n#endif\n#endif\n"
  },
  {
    "path": "freebsd-headers/openssl/dso.h",
    "content": "/* dso.h -*- mode:C; c-file-style: \"eay\" -*- */\n/* Written by Geoff Thorpe (geoff@geoffthorpe.net) for the OpenSSL\n * project 2000.\n */\n/* ====================================================================\n * Copyright (c) 2000 The OpenSSL Project.  All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n *\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer. \n *\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in\n *    the documentation and/or other materials provided with the\n *    distribution.\n *\n * 3. All advertising materials mentioning features or use of this\n *    software must display the following acknowledgment:\n *    \"This product includes software developed by the OpenSSL Project\n *    for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)\"\n *\n * 4. The names \"OpenSSL Toolkit\" and \"OpenSSL Project\" must not be used to\n *    endorse or promote products derived from this software without\n *    prior written permission. For written permission, please contact\n *    licensing@OpenSSL.org.\n *\n * 5. Products derived from this software may not be called \"OpenSSL\"\n *    nor may \"OpenSSL\" appear in their names without prior written\n *    permission of the OpenSSL Project.\n *\n * 6. Redistributions of any form whatsoever must retain the following\n *    acknowledgment:\n *    \"This product includes software developed by the OpenSSL Project\n *    for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)\"\n *\n * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY\n * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\n * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE OpenSSL PROJECT OR\n * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\n * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,\n * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED\n * OF THE POSSIBILITY OF SUCH DAMAGE.\n * ====================================================================\n *\n * This product includes cryptographic software written by Eric Young\n * (eay@cryptsoft.com).  This product includes software written by Tim\n * Hudson (tjh@cryptsoft.com).\n *\n */\n\n#ifndef HEADER_DSO_H\n#define HEADER_DSO_H\n\n#include <openssl/crypto.h>\n\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\n/* These values are used as commands to DSO_ctrl() */\n#define DSO_CTRL_GET_FLAGS\t1\n#define DSO_CTRL_SET_FLAGS\t2\n#define DSO_CTRL_OR_FLAGS\t3\n\n/* By default, DSO_load() will translate the provided filename into a form\n * typical for the platform (more specifically the DSO_METHOD) using the\n * dso_name_converter function of the method. Eg. win32 will transform \"blah\"\n * into \"blah.dll\", and dlfcn will transform it into \"libblah.so\". The\n * behaviour can be overriden by setting the name_converter callback in the DSO\n * object (using DSO_set_name_converter()). This callback could even utilise\n * the DSO_METHOD's converter too if it only wants to override behaviour for\n * one or two possible DSO methods. However, the following flag can be set in a\n * DSO to prevent *any* native name-translation at all - eg. if the caller has\n * prompted the user for a path to a driver library so the filename should be\n * interpreted as-is. */\n#define DSO_FLAG_NO_NAME_TRANSLATION\t\t0x01\n/* An extra flag to give if only the extension should be added as\n * translation.  This is obviously only of importance on Unix and\n * other operating systems where the translation also may prefix\n * the name with something, like 'lib', and ignored everywhere else.\n * This flag is also ignored if DSO_FLAG_NO_NAME_TRANSLATION is used\n * at the same time. */\n#define DSO_FLAG_NAME_TRANSLATION_EXT_ONLY\t0x02\n\n/* The following flag controls the translation of symbol names to upper\n * case.  This is currently only being implemented for OpenVMS.\n */\n#define DSO_FLAG_UPCASE_SYMBOL\t\t\t0x10\n\n/* This flag loads the library with public symbols.\n * Meaning: The exported symbols of this library are public\n * to all libraries loaded after this library.\n * At the moment only implemented in unix.\n */\n#define DSO_FLAG_GLOBAL_SYMBOLS\t\t\t0x20\n\n\ntypedef void (*DSO_FUNC_TYPE)(void);\n\ntypedef struct dso_st DSO;\n\n/* The function prototype used for method functions (or caller-provided\n * callbacks) that transform filenames. They are passed a DSO structure pointer\n * (or NULL if they are to be used independantly of a DSO object) and a\n * filename to transform. They should either return NULL (if there is an error\n * condition) or a newly allocated string containing the transformed form that\n * the caller will need to free with OPENSSL_free() when done. */\ntypedef char* (*DSO_NAME_CONVERTER_FUNC)(DSO *, const char *);\n/* The function prototype used for method functions (or caller-provided\n * callbacks) that merge two file specifications. They are passed a\n * DSO structure pointer (or NULL if they are to be used independantly of\n * a DSO object) and two file specifications to merge. They should\n * either return NULL (if there is an error condition) or a newly allocated\n * string containing the result of merging that the caller will need\n * to free with OPENSSL_free() when done.\n * Here, merging means that bits and pieces are taken from each of the\n * file specifications and added together in whatever fashion that is\n * sensible for the DSO method in question.  The only rule that really\n * applies is that if the two specification contain pieces of the same\n * type, the copy from the first string takes priority.  One could see\n * it as the first specification is the one given by the user and the\n * second being a bunch of defaults to add on if they're missing in the\n * first. */\ntypedef char* (*DSO_MERGER_FUNC)(DSO *, const char *, const char *);\n\ntypedef struct dso_meth_st\n\t{\n\tconst char *name;\n\t/* Loads a shared library, NB: new DSO_METHODs must ensure that a\n\t * successful load populates the loaded_filename field, and likewise a\n\t * successful unload OPENSSL_frees and NULLs it out. */\n\tint (*dso_load)(DSO *dso);\n\t/* Unloads a shared library */\n\tint (*dso_unload)(DSO *dso);\n\t/* Binds a variable */\n\tvoid *(*dso_bind_var)(DSO *dso, const char *symname);\n\t/* Binds a function - assumes a return type of DSO_FUNC_TYPE.\n\t * This should be cast to the real function prototype by the\n\t * caller. Platforms that don't have compatible representations\n\t * for different prototypes (this is possible within ANSI C)\n\t * are highly unlikely to have shared libraries at all, let\n\t * alone a DSO_METHOD implemented for them. */\n\tDSO_FUNC_TYPE (*dso_bind_func)(DSO *dso, const char *symname);\n\n/* I don't think this would actually be used in any circumstances. */\n#if 0\n\t/* Unbinds a variable */\n\tint (*dso_unbind_var)(DSO *dso, char *symname, void *symptr);\n\t/* Unbinds a function */\n\tint (*dso_unbind_func)(DSO *dso, char *symname, DSO_FUNC_TYPE symptr);\n#endif\n\t/* The generic (yuck) \"ctrl()\" function. NB: Negative return\n\t * values (rather than zero) indicate errors. */\n\tlong (*dso_ctrl)(DSO *dso, int cmd, long larg, void *parg);\n\t/* The default DSO_METHOD-specific function for converting filenames to\n\t * a canonical native form. */\n\tDSO_NAME_CONVERTER_FUNC dso_name_converter;\n\t/* The default DSO_METHOD-specific function for converting filenames to\n\t * a canonical native form. */\n\tDSO_MERGER_FUNC dso_merger;\n\n\t/* [De]Initialisation handlers. */\n\tint (*init)(DSO *dso);\n\tint (*finish)(DSO *dso);\n\t} DSO_METHOD;\n\n/**********************************************************************/\n/* The low-level handle type used to refer to a loaded shared library */\n\nstruct dso_st\n\t{\n\tDSO_METHOD *meth;\n\t/* Standard dlopen uses a (void *). Win32 uses a HANDLE. VMS\n\t * doesn't use anything but will need to cache the filename\n\t * for use in the dso_bind handler. All in all, let each\n\t * method control its own destiny. \"Handles\" and such go in\n\t * a STACK. */\n\tSTACK *meth_data;\n\tint references;\n\tint flags;\n\t/* For use by applications etc ... use this for your bits'n'pieces,\n\t * don't touch meth_data! */\n\tCRYPTO_EX_DATA ex_data;\n\t/* If this callback function pointer is set to non-NULL, then it will\n\t * be used in DSO_load() in place of meth->dso_name_converter. NB: This\n\t * should normally set using DSO_set_name_converter(). */\n\tDSO_NAME_CONVERTER_FUNC name_converter;\n\t/* If this callback function pointer is set to non-NULL, then it will\n\t * be used in DSO_load() in place of meth->dso_merger. NB: This\n\t * should normally set using DSO_set_merger(). */\n\tDSO_MERGER_FUNC merger;\n\t/* This is populated with (a copy of) the platform-independant\n\t * filename used for this DSO. */\n\tchar *filename;\n\t/* This is populated with (a copy of) the translated filename by which\n\t * the DSO was actually loaded. It is NULL iff the DSO is not currently\n\t * loaded. NB: This is here because the filename translation process\n\t * may involve a callback being invoked more than once not only to\n\t * convert to a platform-specific form, but also to try different\n\t * filenames in the process of trying to perform a load. As such, this\n\t * variable can be used to indicate (a) whether this DSO structure\n\t * corresponds to a loaded library or not, and (b) the filename with\n\t * which it was actually loaded. */\n\tchar *loaded_filename;\n\t};\n\n\nDSO *\tDSO_new(void);\nDSO *\tDSO_new_method(DSO_METHOD *method);\nint\tDSO_free(DSO *dso);\nint\tDSO_flags(DSO *dso);\nint\tDSO_up_ref(DSO *dso);\nlong\tDSO_ctrl(DSO *dso, int cmd, long larg, void *parg);\n\n/* This function sets the DSO's name_converter callback. If it is non-NULL,\n * then it will be used instead of the associated DSO_METHOD's function. If\n * oldcb is non-NULL then it is set to the function pointer value being\n * replaced. Return value is non-zero for success. */\nint\tDSO_set_name_converter(DSO *dso, DSO_NAME_CONVERTER_FUNC cb,\n\t\t\t\tDSO_NAME_CONVERTER_FUNC *oldcb);\n/* These functions can be used to get/set the platform-independant filename\n * used for a DSO. NB: set will fail if the DSO is already loaded. */\nconst char *DSO_get_filename(DSO *dso);\nint\tDSO_set_filename(DSO *dso, const char *filename);\n/* This function will invoke the DSO's name_converter callback to translate a\n * filename, or if the callback isn't set it will instead use the DSO_METHOD's\n * converter. If \"filename\" is NULL, the \"filename\" in the DSO itself will be\n * used. If the DSO_FLAG_NO_NAME_TRANSLATION flag is set, then the filename is\n * simply duplicated. NB: This function is usually called from within a\n * DSO_METHOD during the processing of a DSO_load() call, and is exposed so that\n * caller-created DSO_METHODs can do the same thing. A non-NULL return value\n * will need to be OPENSSL_free()'d. */\nchar\t*DSO_convert_filename(DSO *dso, const char *filename);\n/* This function will invoke the DSO's merger callback to merge two file\n * specifications, or if the callback isn't set it will instead use the\n * DSO_METHOD's merger.  A non-NULL return value will need to be\n * OPENSSL_free()'d. */\nchar\t*DSO_merge(DSO *dso, const char *filespec1, const char *filespec2);\n/* If the DSO is currently loaded, this returns the filename that it was loaded\n * under, otherwise it returns NULL. So it is also useful as a test as to\n * whether the DSO is currently loaded. NB: This will not necessarily return\n * the same value as DSO_convert_filename(dso, dso->filename), because the\n * DSO_METHOD's load function may have tried a variety of filenames (with\n * and/or without the aid of the converters) before settling on the one it\n * actually loaded. */\nconst char *DSO_get_loaded_filename(DSO *dso);\n\nvoid\tDSO_set_default_method(DSO_METHOD *meth);\nDSO_METHOD *DSO_get_default_method(void);\nDSO_METHOD *DSO_get_method(DSO *dso);\nDSO_METHOD *DSO_set_method(DSO *dso, DSO_METHOD *meth);\n\n/* The all-singing all-dancing load function, you normally pass NULL\n * for the first and third parameters. Use DSO_up and DSO_free for\n * subsequent reference count handling. Any flags passed in will be set\n * in the constructed DSO after its init() function but before the\n * load operation. If 'dso' is non-NULL, 'flags' is ignored. */\nDSO *DSO_load(DSO *dso, const char *filename, DSO_METHOD *meth, int flags);\n\n/* This function binds to a variable inside a shared library. */\nvoid *DSO_bind_var(DSO *dso, const char *symname);\n\n/* This function binds to a function inside a shared library. */\nDSO_FUNC_TYPE DSO_bind_func(DSO *dso, const char *symname);\n\n/* This method is the default, but will beg, borrow, or steal whatever\n * method should be the default on any particular platform (including\n * DSO_METH_null() if necessary). */\nDSO_METHOD *DSO_METHOD_openssl(void);\n\n/* This method is defined for all platforms - if a platform has no\n * DSO support then this will be the only method! */\nDSO_METHOD *DSO_METHOD_null(void);\n\n/* If DSO_DLFCN is defined, the standard dlfcn.h-style functions\n * (dlopen, dlclose, dlsym, etc) will be used and incorporated into\n * this method. If not, this method will return NULL. */\nDSO_METHOD *DSO_METHOD_dlfcn(void);\n\n/* If DSO_DL is defined, the standard dl.h-style functions (shl_load, \n * shl_unload, shl_findsym, etc) will be used and incorporated into\n * this method. If not, this method will return NULL. */\nDSO_METHOD *DSO_METHOD_dl(void);\n\n/* If WIN32 is defined, use DLLs. If not, return NULL. */\nDSO_METHOD *DSO_METHOD_win32(void);\n\n/* If VMS is defined, use shared images. If not, return NULL. */\nDSO_METHOD *DSO_METHOD_vms(void);\n\n/* BEGIN ERROR CODES */\n/* The following lines are auto generated by the script mkerr.pl. Any changes\n * made after this point may be overwritten when the script is next run.\n */\nvoid ERR_load_DSO_strings(void);\n\n/* Error codes for the DSO functions. */\n\n/* Function codes. */\n#define DSO_F_DLFCN_BIND_FUNC\t\t\t\t 100\n#define DSO_F_DLFCN_BIND_VAR\t\t\t\t 101\n#define DSO_F_DLFCN_LOAD\t\t\t\t 102\n#define DSO_F_DLFCN_MERGER\t\t\t\t 130\n#define DSO_F_DLFCN_NAME_CONVERTER\t\t\t 123\n#define DSO_F_DLFCN_UNLOAD\t\t\t\t 103\n#define DSO_F_DL_BIND_FUNC\t\t\t\t 104\n#define DSO_F_DL_BIND_VAR\t\t\t\t 105\n#define DSO_F_DL_LOAD\t\t\t\t\t 106\n#define DSO_F_DL_MERGER\t\t\t\t\t 131\n#define DSO_F_DL_NAME_CONVERTER\t\t\t\t 124\n#define DSO_F_DL_UNLOAD\t\t\t\t\t 107\n#define DSO_F_DSO_BIND_FUNC\t\t\t\t 108\n#define DSO_F_DSO_BIND_VAR\t\t\t\t 109\n#define DSO_F_DSO_CONVERT_FILENAME\t\t\t 126\n#define DSO_F_DSO_CTRL\t\t\t\t\t 110\n#define DSO_F_DSO_FREE\t\t\t\t\t 111\n#define DSO_F_DSO_GET_FILENAME\t\t\t\t 127\n#define DSO_F_DSO_GET_LOADED_FILENAME\t\t\t 128\n#define DSO_F_DSO_LOAD\t\t\t\t\t 112\n#define DSO_F_DSO_MERGE\t\t\t\t\t 132\n#define DSO_F_DSO_NEW_METHOD\t\t\t\t 113\n#define DSO_F_DSO_SET_FILENAME\t\t\t\t 129\n#define DSO_F_DSO_SET_NAME_CONVERTER\t\t\t 122\n#define DSO_F_DSO_UP_REF\t\t\t\t 114\n#define DSO_F_VMS_BIND_SYM\t\t\t\t 115\n#define DSO_F_VMS_LOAD\t\t\t\t\t 116\n#define DSO_F_VMS_MERGER\t\t\t\t 133\n#define DSO_F_VMS_UNLOAD\t\t\t\t 117\n#define DSO_F_WIN32_BIND_FUNC\t\t\t\t 118\n#define DSO_F_WIN32_BIND_VAR\t\t\t\t 119\n#define DSO_F_WIN32_JOINER\t\t\t\t 135\n#define DSO_F_WIN32_LOAD\t\t\t\t 120\n#define DSO_F_WIN32_MERGER\t\t\t\t 134\n#define DSO_F_WIN32_NAME_CONVERTER\t\t\t 125\n#define DSO_F_WIN32_SPLITTER\t\t\t\t 136\n#define DSO_F_WIN32_UNLOAD\t\t\t\t 121\n\n/* Reason codes. */\n#define DSO_R_CTRL_FAILED\t\t\t\t 100\n#define DSO_R_DSO_ALREADY_LOADED\t\t\t 110\n#define DSO_R_EMPTY_FILE_STRUCTURE\t\t\t 113\n#define DSO_R_FAILURE\t\t\t\t\t 114\n#define DSO_R_FILENAME_TOO_BIG\t\t\t\t 101\n#define DSO_R_FINISH_FAILED\t\t\t\t 102\n#define DSO_R_INCORRECT_FILE_SYNTAX\t\t\t 115\n#define DSO_R_LOAD_FAILED\t\t\t\t 103\n#define DSO_R_NAME_TRANSLATION_FAILED\t\t\t 109\n#define DSO_R_NO_FILENAME\t\t\t\t 111\n#define DSO_R_NO_FILE_SPECIFICATION\t\t\t 116\n#define DSO_R_NULL_HANDLE\t\t\t\t 104\n#define DSO_R_SET_FILENAME_FAILED\t\t\t 112\n#define DSO_R_STACK_ERROR\t\t\t\t 105\n#define DSO_R_SYM_FAILURE\t\t\t\t 106\n#define DSO_R_UNLOAD_FAILED\t\t\t\t 107\n#define DSO_R_UNSUPPORTED\t\t\t\t 108\n\n#ifdef  __cplusplus\n}\n#endif\n#endif\n"
  },
  {
    "path": "freebsd-headers/openssl/dtls1.h",
    "content": "/* ssl/dtls1.h */\n/* \n * DTLS implementation written by Nagendra Modadugu\n * (nagendra@cs.stanford.edu) for the OpenSSL project 2005.  \n */\n/* ====================================================================\n * Copyright (c) 1999-2005 The OpenSSL Project.  All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n *\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer. \n *\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in\n *    the documentation and/or other materials provided with the\n *    distribution.\n *\n * 3. All advertising materials mentioning features or use of this\n *    software must display the following acknowledgment:\n *    \"This product includes software developed by the OpenSSL Project\n *    for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)\"\n *\n * 4. The names \"OpenSSL Toolkit\" and \"OpenSSL Project\" must not be used to\n *    endorse or promote products derived from this software without\n *    prior written permission. For written permission, please contact\n *    openssl-core@OpenSSL.org.\n *\n * 5. Products derived from this software may not be called \"OpenSSL\"\n *    nor may \"OpenSSL\" appear in their names without prior written\n *    permission of the OpenSSL Project.\n *\n * 6. Redistributions of any form whatsoever must retain the following\n *    acknowledgment:\n *    \"This product includes software developed by the OpenSSL Project\n *    for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)\"\n *\n * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY\n * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\n * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE OpenSSL PROJECT OR\n * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\n * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,\n * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED\n * OF THE POSSIBILITY OF SUCH DAMAGE.\n * ====================================================================\n *\n * This product includes cryptographic software written by Eric Young\n * (eay@cryptsoft.com).  This product includes software written by Tim\n * Hudson (tjh@cryptsoft.com).\n *\n */\n\n#ifndef HEADER_DTLS1_H \n#define HEADER_DTLS1_H \n\n#include <openssl/buffer.h>\n#include <openssl/pqueue.h>\n#ifdef OPENSSL_SYS_VMS\n#include <resource.h>\n#include <sys/timeb.h>\n#endif\n#ifdef OPENSSL_SYS_WIN32\n/* Needed for struct timeval */\n#include <winsock.h>\n#elif defined(OPENSSL_SYS_NETWARE) && !defined(_WINSOCK2API_)\n#include <sys/timeval.h>\n#else\n#include <sys/time.h>\n#endif\n\n#ifdef  __cplusplus\nextern \"C\" {\n#endif\n\n#define DTLS1_VERSION\t\t\t0xFEFF\n#define DTLS1_BAD_VER\t\t\t0x0100\n\n#if 0\n/* this alert description is not specified anywhere... */\n#define DTLS1_AD_MISSING_HANDSHAKE_MESSAGE    110\n#endif\n\n/* lengths of messages */\n#define DTLS1_COOKIE_LENGTH                     256\n\n#define DTLS1_RT_HEADER_LENGTH                  13\n\n#define DTLS1_HM_HEADER_LENGTH                  12\n\n#define DTLS1_HM_BAD_FRAGMENT                   -2\n#define DTLS1_HM_FRAGMENT_RETRY                 -3\n\n#define DTLS1_CCS_HEADER_LENGTH                  1\n\n#ifdef DTLS1_AD_MISSING_HANDSHAKE_MESSAGE\n#define DTLS1_AL_HEADER_LENGTH                   7\n#else\n#define DTLS1_AL_HEADER_LENGTH                   2\n#endif\n\n\ntypedef struct dtls1_bitmap_st\n\t{\n\tPQ_64BIT map;\n\tunsigned long length;     /* sizeof the bitmap in bits */\n\tPQ_64BIT max_seq_num;  /* max record number seen so far */\n\t} DTLS1_BITMAP;\n\nstruct dtls1_retransmit_state\n\t{\n\tEVP_CIPHER_CTX *enc_write_ctx;\t/* cryptographic state */\n\tconst EVP_MD *write_hash;\t\t/* used for mac generation */\n#ifndef OPENSSL_NO_COMP\n\tCOMP_CTX *compress;\t\t\t\t/* compression */\n#else\n\tchar *compress;\t\n#endif\n\tSSL_SESSION *session;\n\tunsigned short epoch;\n\t};\n\nstruct hm_header_st\n\t{\n\tunsigned char type;\n\tunsigned long msg_len;\n\tunsigned short seq;\n\tunsigned long frag_off;\n\tunsigned long frag_len;\n\tunsigned int is_ccs;\n\tstruct dtls1_retransmit_state saved_retransmit_state;\n\t};\n\nstruct ccs_header_st\n\t{\n\tunsigned char type;\n\tunsigned short seq;\n\t};\n\nstruct dtls1_timeout_st\n\t{\n\t/* Number of read timeouts so far */\n\tunsigned int read_timeouts;\n\t\n\t/* Number of write timeouts so far */\n\tunsigned int write_timeouts;\n\t\n\t/* Number of alerts received so far */\n\tunsigned int num_alerts;\n\t};\n\ntypedef struct record_pqueue_st\n\t{\n\tunsigned short epoch;\n\tpqueue q;\n\t} record_pqueue;\n\ntypedef struct hm_fragment_st\n\t{\n\tstruct hm_header_st msg_header;\n\tunsigned char *fragment;\n\tunsigned char *reassembly;\n\t} hm_fragment;\n\ntypedef struct dtls1_state_st\n\t{\n\tunsigned int send_cookie;\n\tunsigned char cookie[DTLS1_COOKIE_LENGTH];\n\tunsigned char rcvd_cookie[DTLS1_COOKIE_LENGTH];\n\tunsigned int cookie_len;\n\n\t/* \n\t * The current data and handshake epoch.  This is initially\n\t * undefined, and starts at zero once the initial handshake is\n\t * completed \n\t */\n\tunsigned short r_epoch;\n\tunsigned short w_epoch;\n\n\t/* records being received in the current epoch */\n\tDTLS1_BITMAP bitmap;\n\n\t/* renegotiation starts a new set of sequence numbers */\n\tDTLS1_BITMAP next_bitmap;\n\n\t/* handshake message numbers */\n\tunsigned short handshake_write_seq;\n\tunsigned short next_handshake_write_seq;\n\n\tunsigned short handshake_read_seq;\n\n\t/* save last sequence number for retransmissions */\n\tunsigned char last_write_sequence[8];\n\n\t/* Received handshake records (processed and unprocessed) */\n\trecord_pqueue unprocessed_rcds;\n\trecord_pqueue processed_rcds;\n\n\t/* Buffered handshake messages */\n\tpqueue buffered_messages;\n\n\t/* Buffered (sent) handshake records */\n\tpqueue sent_messages;\n\n\t/* Buffered application records.\n\t * Only for records between CCS and Finished\n\t * to prevent either protocol violation or\n\t * unnecessary message loss.\n\t */\n\trecord_pqueue buffered_app_data;\n\n\t/* Is set when listening for new connections with dtls1_listen() */\n\tunsigned int listen;\n\n\tunsigned int mtu; /* max DTLS packet size */\n\n\tstruct hm_header_st w_msg_hdr;\n\tstruct hm_header_st r_msg_hdr;\n\n\tstruct dtls1_timeout_st timeout;\n\n\t/* Indicates when the last handshake msg sent will timeout */\n\tstruct timeval next_timeout;\n\n\t/* Timeout duration */\n\tunsigned short timeout_duration;\n\n\t/* storage for Alert/Handshake protocol data received but not\n\t * yet processed by ssl3_read_bytes: */\n\tunsigned char alert_fragment[DTLS1_AL_HEADER_LENGTH];\n\tunsigned int alert_fragment_len;\n\tunsigned char handshake_fragment[DTLS1_HM_HEADER_LENGTH];\n\tunsigned int handshake_fragment_len;\n\n\tunsigned int retransmitting;\n\tunsigned int change_cipher_spec_ok;\n\n\t} DTLS1_STATE;\n\ntypedef struct dtls1_record_data_st\n\t{\n\tunsigned char *packet;\n\tunsigned int   packet_length;\n\tSSL3_BUFFER    rbuf;\n\tSSL3_RECORD    rrec;\n\t} DTLS1_RECORD_DATA;\n\n\n/* Timeout multipliers (timeout slice is defined in apps/timeouts.h */\n#define DTLS1_TMO_READ_COUNT                      2\n#define DTLS1_TMO_WRITE_COUNT                     2\n\n#define DTLS1_TMO_ALERT_COUNT                     12\n\n#ifdef  __cplusplus\n}\n#endif\n#endif\n\n"
  },
  {
    "path": "freebsd-headers/openssl/e_os.h",
    "content": "/* e_os.h */\n/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)\n * All rights reserved.\n *\n * This package is an SSL implementation written\n * by Eric Young (eay@cryptsoft.com).\n * The implementation was written so as to conform with Netscapes SSL.\n * \n * This library is free for commercial and non-commercial use as long as\n * the following conditions are aheared to.  The following conditions\n * apply to all code found in this distribution, be it the RC4, RSA,\n * lhash, DES, etc., code; not just the SSL code.  The SSL documentation\n * included with this distribution is covered by the same copyright terms\n * except that the holder is Tim Hudson (tjh@cryptsoft.com).\n * \n * Copyright remains Eric Young's, and as such any Copyright notices in\n * the code are not to be removed.\n * If this package is used in a product, Eric Young should be given attribution\n * as the author of the parts of the library used.\n * This can be in the form of a textual message at program startup or\n * in documentation (online or textual) provided with the package.\n * \n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. All advertising materials mentioning features or use of this software\n *    must display the following acknowledgement:\n *    \"This product includes cryptographic software written by\n *     Eric Young (eay@cryptsoft.com)\"\n *    The word 'cryptographic' can be left out if the rouines from the library\n *    being used are not cryptographic related :-).\n * 4. If you include any Windows specific code (or a derivative thereof) from \n *    the apps directory (application code) you must include an acknowledgement:\n *    \"This product includes software written by Tim Hudson (tjh@cryptsoft.com)\"\n * \n * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n * \n * The licence and distribution terms for any publically available version or\n * derivative of this code cannot be changed.  i.e. this code cannot simply be\n * copied and put under another distribution licence\n * [including the GNU Public Licence.]\n */\n\n#ifndef HEADER_E_OS_H\n#define HEADER_E_OS_H\n\n#include <openssl/opensslconf.h>\n\n#include <openssl/e_os2.h>\n/* <openssl/e_os2.h> contains what we can justify to make visible\n * to the outside; this file e_os.h is not part of the exported\n * interface. */\n\n#ifdef  __cplusplus\nextern \"C\" {\n#endif\n\n/* Used to checking reference counts, most while doing perl5 stuff :-) */\n#ifdef REF_PRINT\n#undef REF_PRINT\n#define REF_PRINT(a,b)\tfprintf(stderr,\"%08X:%4d:%s\\n\",(int)b,b->references,a)\n#endif\n\n#ifndef DEVRANDOM\n/* set this to a comma-separated list of 'random' device files to try out.\n * My default, we will try to read at least one of these files */\n#define DEVRANDOM \"/dev/urandom\",\"/dev/random\",\"/dev/srandom\"\n#endif\n#ifndef DEVRANDOM_EGD\n/* set this to a comma-seperated list of 'egd' sockets to try out. These\n * sockets will be tried in the order listed in case accessing the device files\n * listed in DEVRANDOM did not return enough entropy. */\n#define DEVRANDOM_EGD \"/var/run/egd-pool\",\"/dev/egd-pool\",\"/etc/egd-pool\",\"/etc/entropy\"\n#endif\n\n#if defined(OPENSSL_SYS_VXWORKS)\n#  define NO_SYS_PARAM_H\n#  define NO_CHMOD\n#  define NO_SYSLOG\n#endif\n  \n#if defined(OPENSSL_SYS_MACINTOSH_CLASSIC)\n# if macintosh==1\n#  ifndef MAC_OS_GUSI_SOURCE\n#    define MAC_OS_pre_X\n#    define NO_SYS_TYPES_H\n     typedef long ssize_t;\n#  endif\n#  define NO_SYS_PARAM_H\n#  define NO_CHMOD\n#  define NO_SYSLOG\n#  undef  DEVRANDOM\n#  define GETPID_IS_MEANINGLESS\n# endif\n#endif\n\n/********************************************************************\n The Microsoft section\n ********************************************************************/\n/* The following is used becaue of the small stack in some\n * Microsoft operating systems */\n#if defined(OPENSSL_SYS_MSDOS) && !defined(OPENSSL_SYSNAME_WIN32)\n#  define MS_STATIC\tstatic\n#else\n#  define MS_STATIC\n#endif\n\n#if defined(OPENSSL_SYS_WIN32) && !defined(WIN32)\n#  define WIN32\n#endif\n#if defined(OPENSSL_SYS_WIN16) && !defined(WIN16)\n#  define WIN16\n#endif\n#if defined(OPENSSL_SYS_WINDOWS) && !defined(WINDOWS)\n#  define WINDOWS\n#endif\n#if defined(OPENSSL_SYS_MSDOS) && !defined(MSDOS)\n#  define MSDOS\n#endif\n\n#if defined(MSDOS) && !defined(GETPID_IS_MEANINGLESS)\n#  define GETPID_IS_MEANINGLESS\n#endif\n\n#ifdef WIN32\n#define get_last_sys_error()\tGetLastError()\n#define clear_sys_error()\tSetLastError(0)\n#if !defined(WINNT)\n#define WIN_CONSOLE_BUG\n#endif\n#else\n#define get_last_sys_error()\terrno\n#define clear_sys_error()\terrno=0\n#endif\n\n#if defined(WINDOWS)\n#define get_last_socket_error()\tWSAGetLastError()\n#define clear_socket_error()\tWSASetLastError(0)\n#define readsocket(s,b,n)\trecv((s),(b),(n),0)\n#define writesocket(s,b,n)\tsend((s),(b),(n),0)\n#elif defined(__DJGPP__)\n#define WATT32\n#define get_last_socket_error()\terrno\n#define clear_socket_error()\terrno=0\n#define closesocket(s)\t\tclose_s(s)\n#define readsocket(s,b,n)\tread_s(s,b,n)\n#define writesocket(s,b,n)\tsend(s,b,n,0)\n#elif defined(MAC_OS_pre_X)\n#define get_last_socket_error()\terrno\n#define clear_socket_error()\terrno=0\n#define closesocket(s)\t\tMacSocket_close(s)\n#define readsocket(s,b,n)\tMacSocket_recv((s),(b),(n),true)\n#define writesocket(s,b,n)\tMacSocket_send((s),(b),(n))\n#elif defined(OPENSSL_SYS_VMS)\n#define get_last_socket_error() errno\n#define clear_socket_error()    errno=0\n#define ioctlsocket(a,b,c)      ioctl(a,b,c)\n#define closesocket(s)          close(s)\n#define readsocket(s,b,n)       recv((s),(b),(n),0)\n#define writesocket(s,b,n)      send((s),(b),(n),0)\n#elif defined(OPENSSL_SYS_VXWORKS)\n#define get_last_socket_error()\terrno\n#define clear_socket_error()\terrno=0\n#define ioctlsocket(a,b,c)\t    ioctl((a),(b),(int)(c))\n#define closesocket(s)\t\t    close(s)\n#define readsocket(s,b,n)\t    read((s),(b),(n))\n#define writesocket(s,b,n)\t    write((s),(char *)(b),(n))\n#elif defined(OPENSSL_SYS_NETWARE)\n#if defined(NETWARE_BSDSOCK)\n#define get_last_socket_error() errno\n#define clear_socket_error()    errno=0\n#define closesocket(s)          close(s)\n#define ioctlsocket(a,b,c)      ioctl(a,b,c)\n#if defined(NETWARE_LIBC)\n#define readsocket(s,b,n)       recv((s),(b),(n),0)\n#define writesocket(s,b,n)      send((s),(b),(n),0)\n#else\n#define readsocket(s,b,n)       recv((s),(char*)(b),(n),0)\n#define writesocket(s,b,n)      send((s),(char*)(b),(n),0)\n#endif\n#else\n#define get_last_socket_error()\tWSAGetLastError()\n#define clear_socket_error()\tWSASetLastError(0)\n#define readsocket(s,b,n)\t\trecv((s),(b),(n),0)\n#define writesocket(s,b,n)\t\tsend((s),(b),(n),0)\n#endif\n#else\n#define get_last_socket_error()\terrno\n#define clear_socket_error()\terrno=0\n#define ioctlsocket(a,b,c)\tioctl(a,b,c)\n#define closesocket(s)\t\tclose(s)\n#define readsocket(s,b,n)\tread((s),(b),(n))\n#define writesocket(s,b,n)\twrite((s),(b),(n))\n#endif\n\n#ifdef WIN16\n#  define MS_CALLBACK\t_far _loadds\n#  define MS_FAR\t_far\n#else\n#  define MS_CALLBACK\n#  define MS_FAR\n#endif\n\n#ifdef OPENSSL_NO_STDIO\n#  undef OPENSSL_NO_FP_API\n#  define OPENSSL_NO_FP_API\n#endif\n\n#if (defined(WINDOWS) || defined(MSDOS))\n\n#  ifdef __DJGPP__\n#    include <unistd.h>\n#    include <sys/stat.h>\n#    include <sys/socket.h>\n#    include <tcp.h>\n#    include <netdb.h>\n#    define _setmode setmode\n#    define _O_TEXT O_TEXT\n#    define _O_BINARY O_BINARY\n#    undef DEVRANDOM\n#    define DEVRANDOM \"/dev/urandom\\x24\"\n#  endif /* __DJGPP__ */\n\n#  ifndef S_IFDIR\n#    define S_IFDIR\t_S_IFDIR\n#  endif\n\n#  ifndef S_IFMT\n#    define S_IFMT\t_S_IFMT\n#  endif\n\n#  if !defined(WINNT) && !defined(__DJGPP__)\n#    define NO_SYSLOG\n#  endif\n#  define NO_DIRENT\n\n#  ifdef WINDOWS\n#    if !defined(_WIN32_WCE) && !defined(_WIN32_WINNT)\n       /*\n\t* Defining _WIN32_WINNT here in e_os.h implies certain \"discipline.\"\n\t* Most notably we ought to check for availability of each specific\n\t* routine with GetProcAddress() and/or quard NT-specific calls with\n\t* GetVersion() < 0x80000000. One can argue that in latter \"or\" case\n\t* we ought to /DELAYLOAD some .DLLs in order to protect ourselves\n\t* against run-time link errors. This doesn't seem to be necessary,\n\t* because it turned out that already Windows 95, first non-NT Win32\n\t* implementation, is equipped with at least NT 3.51 stubs, dummy\n\t* routines with same name, but which do nothing. Meaning that it's\n\t* apparently appropriate to guard generic NT calls with GetVersion\n\t* alone, while NT 4.0 and above calls ought to be additionally\n\t* checked upon with GetProcAddress.\n\t*/\n#      define _WIN32_WINNT 0x0400\n#    endif\n#    include <windows.h>\n#    include <stdio.h>\n#    include <stddef.h>\n#    include <errno.h>\n#    include <string.h>\n#    ifdef _WIN64\n#      define strlen(s) _strlen31(s)\n/* cut strings to 2GB */\nstatic unsigned int _strlen31(const char *str)\n\t{\n\tunsigned int len=0;\n\twhile (*str && len<0x80000000U) str++, len++;\n\treturn len&0x7FFFFFFF;\n\t}\n#    endif\n#    include <malloc.h>\n#    if defined(_MSC_VER) && _MSC_VER<=1200 && defined(_MT) && defined(isspace)\n       /* compensate for bug in VC6 ctype.h */\n#      undef isspace\n#      undef isdigit\n#      undef isalnum\n#      undef isupper\n#      undef isxdigit\n#    endif\n#    if defined(_MSC_VER) && !defined(_DLL) && defined(stdin)\n#      if _MSC_VER>=1300\n#        undef stdin\n#        undef stdout\n#        undef stderr\n         FILE *__iob_func();\n#        define stdin  (&__iob_func()[0])\n#        define stdout (&__iob_func()[1])\n#        define stderr (&__iob_func()[2])\n#      elif defined(I_CAN_LIVE_WITH_LNK4049)\n#        undef stdin\n#        undef stdout\n#        undef stderr\n         /* pre-1300 has __p__iob(), but it's available only in msvcrt.lib,\n          * or in other words with /MD. Declaring implicit import, i.e.\n          * with _imp_ prefix, works correctly with all compiler options,\n          * but without /MD results in LINK warning LNK4049:\n          * 'locally defined symbol \"__iob\" imported'.\n          */\n         extern FILE *_imp___iob;\n#        define stdin  (&_imp___iob[0])\n#        define stdout (&_imp___iob[1])\n#        define stderr (&_imp___iob[2])\n#      endif\n#    endif\n#  endif\n#  include <io.h>\n#  include <fcntl.h>\n\n#  ifdef OPENSSL_SYS_WINCE\n#    include <winsock_extras.h>\n#  endif\n\n#  define ssize_t long\n\n#  if defined (__BORLANDC__)\n#    define _setmode setmode\n#    define _O_TEXT O_TEXT\n#    define _O_BINARY O_BINARY\n#    define _int64 __int64\n#    define _kbhit kbhit\n#  endif\n\n#  if defined(WIN16) && defined(SSLEAY) && defined(_WINEXITNOPERSIST)\n#    define EXIT(n) _wsetexit(_WINEXITNOPERSIST)\n#    define OPENSSL_EXIT(n) do { if (n == 0) EXIT(n); return(n); } while(0)\n#  else\n#    define EXIT(n) exit(n)\n#  endif\n#  define LIST_SEPARATOR_CHAR ';'\n#  ifndef X_OK\n#    define X_OK\t0\n#  endif\n#  ifndef W_OK\n#    define W_OK\t2\n#  endif\n#  ifndef R_OK\n#    define R_OK\t4\n#  endif\n#  define OPENSSL_CONF\t\"openssl.cnf\"\n#  define SSLEAY_CONF\tOPENSSL_CONF\n#  define NUL_DEV\t\"nul\"\n#  define RFILE\t\t\".rnd\"\n#  ifdef OPENSSL_SYS_WINCE\n#    define DEFAULT_HOME  \"\"\n#  else\n#    define DEFAULT_HOME  \"C:\"\n#  endif\n\n#else /* The non-microsoft world world */\n\n#  ifdef OPENSSL_SYS_VMS\n#    define VMS 1\n  /* some programs don't include stdlib, so exit() and others give implicit \n     function warnings */\n#    include <stdlib.h>\n#    if defined(__DECC)\n#      include <unistd.h>\n#    else\n#      include <unixlib.h>\n#    endif\n#    define OPENSSL_CONF\t\"openssl.cnf\"\n#    define SSLEAY_CONF\t\tOPENSSL_CONF\n#    define RFILE\t\t\".rnd\"\n#    define LIST_SEPARATOR_CHAR ','\n#    define NUL_DEV\t\t\"NLA0:\"\n  /* We don't have any well-defined random devices on VMS, yet... */\n#    undef DEVRANDOM\n  /* We need to do this since VMS has the following coding on status codes:\n\n     Bits 0-2: status type: 0 = warning, 1 = success, 2 = error, 3 = info ...\n               The important thing to know is that odd numbers are considered\n\t       good, while even ones are considered errors.\n     Bits 3-15: actual status number\n     Bits 16-27: facility number.  0 is considered \"unknown\"\n     Bits 28-31: control bits.  If bit 28 is set, the shell won't try to\n                 output the message (which, for random codes, just looks ugly)\n\n     So, what we do here is to change 0 to 1 to get the default success status,\n     and everything else is shifted up to fit into the status number field, and\n     the status is tagged as an error, which I believe is what is wanted here.\n     -- Richard Levitte\n  */\n#    define EXIT(n)\t\tdo { int __VMS_EXIT = n; \\\n                                     if (__VMS_EXIT == 0) \\\n\t\t\t\t       __VMS_EXIT = 1; \\\n\t\t\t\t     else \\\n\t\t\t\t       __VMS_EXIT = (n << 3) | 2; \\\n                                     __VMS_EXIT |= 0x10000000; \\\n\t\t\t\t     exit(__VMS_EXIT); } while(0)\n#    define NO_SYS_PARAM_H\n\n#  elif defined(OPENSSL_SYS_NETWARE)\n#    include <fcntl.h>\n#    include <unistd.h>\n#    define NO_SYS_TYPES_H\n#    undef  DEVRANDOM\n#    ifdef NETWARE_CLIB\n#      define getpid GetThreadID\n       extern int GetThreadID(void);\n/* #      include <conio.h> */\n       extern int kbhit(void);\n       extern void delay(unsigned milliseconds);\n#    else\n#      include <screen.h>\n#    endif\n#    define NO_SYSLOG\n#    define _setmode setmode\n#    define _kbhit kbhit\n#    define _O_TEXT O_TEXT\n#    define _O_BINARY O_BINARY\n#    define OPENSSL_CONF   \"openssl.cnf\"\n#    define SSLEAY_CONF    OPENSSL_CONF\n#    define RFILE    \".rnd\"\n#    define LIST_SEPARATOR_CHAR ';'\n#    define EXIT(n)  { if (n) printf(\"ERROR: %d\\n\", (int)n); exit(n); }\n\n#  else\n     /* !defined VMS */\n#    ifdef OPENSSL_SYS_MPE\n#      define NO_SYS_PARAM_H\n#    endif\n#    ifdef OPENSSL_UNISTD\n#      include OPENSSL_UNISTD\n#    else\n#      include <unistd.h>\n#    endif\n#    ifndef NO_SYS_TYPES_H\n#      include <sys/types.h>\n#    endif\n#    if defined(NeXT) || defined(OPENSSL_SYS_NEWS4)\n#      define pid_t int /* pid_t is missing on NEXTSTEP/OPENSTEP\n                         * (unless when compiling with -D_POSIX_SOURCE,\n                         * which doesn't work for us) */\n#    endif\n#    if defined(NeXT) || defined(OPENSSL_SYS_NEWS4) || defined(OPENSSL_SYS_SUNOS)\n#      define ssize_t int /* ditto */\n#    endif\n#    ifdef OPENSSL_SYS_NEWS4 /* setvbuf is missing on mips-sony-bsd */\n#      define setvbuf(a, b, c, d) setbuffer((a), (b), (d))\n       typedef unsigned long clock_t;\n#    endif\n\n#    define OPENSSL_CONF\t\"openssl.cnf\"\n#    define SSLEAY_CONF\t\tOPENSSL_CONF\n#    define RFILE\t\t\".rnd\"\n#    define LIST_SEPARATOR_CHAR ':'\n#    define NUL_DEV\t\t\"/dev/null\"\n#    define EXIT(n)\t\texit(n)\n#  endif\n\n#  define SSLeay_getpid()\tgetpid()\n\n#endif\n\n\n/*************/\n\n#ifdef USE_SOCKETS\n#  if defined(WINDOWS) || defined(MSDOS)\n      /* windows world */\n\n#    ifdef OPENSSL_NO_SOCK\n#      define SSLeay_Write(a,b,c)\t(-1)\n#      define SSLeay_Read(a,b,c)\t(-1)\n#      define SHUTDOWN(fd)\t\tclose(fd)\n#      define SHUTDOWN2(fd)\t\tclose(fd)\n#    elif !defined(__DJGPP__)\n#      include <winsock.h>\nextern HINSTANCE _hInstance;\n#      ifdef _WIN64\n/*\n * Even though sizeof(SOCKET) is 8, it's safe to cast it to int, because\n * the value constitutes an index in per-process table of limited size\n * and not a real pointer.\n */\n#        define socket(d,t,p)\t((int)socket(d,t,p))\n#        define accept(s,f,l)\t((int)accept(s,f,l))\n#      endif\n#      define SSLeay_Write(a,b,c)\tsend((a),(b),(c),0)\n#      define SSLeay_Read(a,b,c)\trecv((a),(b),(c),0)\n#      define SHUTDOWN(fd)\t\t{ shutdown((fd),0); closesocket(fd); }\n#      define SHUTDOWN2(fd)\t\t{ shutdown((fd),2); closesocket(fd); }\n#    else\n#      define SSLeay_Write(a,b,c)\twrite_s(a,b,c,0)\n#      define SSLeay_Read(a,b,c)\tread_s(a,b,c)\n#      define SHUTDOWN(fd)\t\tclose_s(fd)\n#      define SHUTDOWN2(fd)\t\tclose_s(fd)\n#    endif\n\n#  elif defined(MAC_OS_pre_X)\n\n#    include \"MacSocket.h\"\n#    define SSLeay_Write(a,b,c)\t\tMacSocket_send((a),(b),(c))\n#    define SSLeay_Read(a,b,c)\t\tMacSocket_recv((a),(b),(c),true)\n#    define SHUTDOWN(fd)\t\tMacSocket_close(fd)\n#    define SHUTDOWN2(fd)\t\tMacSocket_close(fd)\n\n#  elif defined(OPENSSL_SYS_NETWARE)\n         /* NetWare uses the WinSock2 interfaces by default, but can be configured for BSD\n         */\n#      if defined(NETWARE_BSDSOCK)\n#        include <sys/socket.h>\n#        include <netinet/in.h>\n#        include <sys/time.h>\n#        if defined(NETWARE_CLIB)\n#          include <sys/bsdskt.h>\n#        else\n#          include <sys/select.h>\n#        endif\n#        define INVALID_SOCKET (int)(~0)\n#      else\n#        include <novsock2.h>\n#      endif\n#      define SSLeay_Write(a,b,c)   send((a),(b),(c),0)\n#      define SSLeay_Read(a,b,c) recv((a),(b),(c),0)\n#      define SHUTDOWN(fd)    { shutdown((fd),0); closesocket(fd); }\n#      define SHUTDOWN2(fd)      { shutdown((fd),2); closesocket(fd); }\n\n#  else\n\n#    ifndef NO_SYS_PARAM_H\n#      include <sys/param.h>\n#    endif\n#    ifdef OPENSSL_SYS_VXWORKS\n#      include <time.h> \n#    elif !defined(OPENSSL_SYS_MPE)\n#      include <sys/time.h> /* Needed under linux for FD_XXX */\n#    endif\n\n#    include <netdb.h>\n#    if defined(OPENSSL_SYS_VMS_NODECC)\n#      include <socket.h>\n#      include <in.h>\n#      include <inet.h>\n#    else\n#      include <sys/socket.h>\n#      ifdef FILIO_H\n#        include <sys/filio.h> /* Added for FIONBIO under unixware */\n#      endif\n#      include <netinet/in.h>\n#      include <arpa/inet.h>\n#    endif\n\n#    if defined(NeXT) || defined(_NEXT_SOURCE)\n#      include <sys/fcntl.h>\n#      include <sys/types.h>\n#    endif\n\n#    ifdef OPENSSL_SYS_AIX\n#      include <sys/select.h>\n#    endif\n\n#    ifdef __QNX__\n#      include <sys/select.h>\n#    endif\n\n#    if defined(sun)\n#      include <sys/filio.h>\n#    else\n#      ifndef VMS\n#        include <sys/ioctl.h>\n#      else\n\t /* ioctl is only in VMS > 7.0 and when socketshr is not used */\n#        if !defined(TCPIP_TYPE_SOCKETSHR) && defined(__VMS_VER) && (__VMS_VER > 70000000)\n#          include <sys/ioctl.h>\n#        endif\n#      endif\n#    endif\n\n#    ifdef VMS\n#      include <unixio.h>\n#      if defined(TCPIP_TYPE_SOCKETSHR)\n#        include <socketshr.h>\n#      endif\n#    endif\n\n#    define SSLeay_Read(a,b,c)     read((a),(b),(c))\n#    define SSLeay_Write(a,b,c)    write((a),(b),(c))\n#    define SHUTDOWN(fd)    { shutdown((fd),0); closesocket((fd)); }\n#    define SHUTDOWN2(fd)   { shutdown((fd),2); closesocket((fd)); }\n#    ifndef INVALID_SOCKET\n#    define INVALID_SOCKET\t(-1)\n#    endif /* INVALID_SOCKET */\n#  endif\n#endif\n\n#if defined(__ultrix)\n#  ifndef ssize_t\n#    define ssize_t int \n#  endif\n#endif\n\n#if defined(sun) && !defined(__svr4__) && !defined(__SVR4)\n  /* include headers first, so our defines don't break it */\n#include <stdlib.h>\n#include <string.h>\n  /* bcopy can handle overlapping moves according to SunOS 4.1.4 manpage */\n# define memmove(s1,s2,n) bcopy((s2),(s1),(n))\n# define strtoul(s,e,b) ((unsigned long int)strtol((s),(e),(b)))\nextern char *sys_errlist[]; extern int sys_nerr;\n# define strerror(errnum) \\\n\t(((errnum)<0 || (errnum)>=sys_nerr) ? NULL : sys_errlist[errnum])\n  /* Being signed SunOS 4.x memcpy breaks ASN1_OBJECT table lookup */\n#include \"crypto/o_str.h\"\n# define memcmp OPENSSL_memcmp\n#endif\n\n#ifndef OPENSSL_EXIT\n# if defined(MONOLITH) && !defined(OPENSSL_C)\n#  define OPENSSL_EXIT(n) return(n)\n# else\n#  define OPENSSL_EXIT(n) do { EXIT(n); return(n); } while(0)\n# endif\n#endif\n\n/***********************************************/\n\n/* do we need to do this for getenv.\n * Just define getenv for use under windows */\n\n#ifdef WIN16\n/* How to do this needs to be thought out a bit more.... */\n/*char *GETENV(char *);\n#define Getenv\tGETENV*/\n#define Getenv\tgetenv\n#else\n#define Getenv getenv\n#endif\n\n#define DG_GCC_BUG\t/* gcc < 2.6.3 on DGUX */\n\n#ifdef sgi\n#define IRIX_CC_BUG\t/* all version of IRIX I've tested (4.* 5.*) */\n#endif\n#ifdef OPENSSL_SYS_SNI\n#define IRIX_CC_BUG\t/* CDS++ up to V2.0Bsomething suffered from the same bug.*/\n#endif\n\n#if defined(OPENSSL_SYS_WINDOWS)\n#  define strcasecmp _stricmp\n#  define strncasecmp _strnicmp\n#elif defined(OPENSSL_SYS_VMS)\n/* VMS below version 7.0 doesn't have strcasecmp() */\n#  include \"o_str.h\"\n#  define strcasecmp OPENSSL_strcasecmp\n#  define strncasecmp OPENSSL_strncasecmp\n#  define OPENSSL_IMPLEMENTS_strncasecmp\n#elif defined(OPENSSL_SYS_OS2) && defined(__EMX__)\n#  define strcasecmp stricmp\n#  define strncasecmp strnicmp\n#elif defined(OPENSSL_SYS_NETWARE)\n#  include <string.h>\n#  if defined(NETWARE_CLIB)\n#    define strcasecmp stricmp\n#    define strncasecmp strnicmp\n#  endif /* NETWARE_CLIB */\n#endif\n\n#if defined(OPENSSL_SYS_OS2) && defined(__EMX__)\n# include <io.h>\n# include <fcntl.h>\n# define NO_SYSLOG\n#endif\n\n/* vxworks */\n#if defined(OPENSSL_SYS_VXWORKS)\n#include <ioLib.h>\n#include <tickLib.h>\n#include <sysLib.h>\n\n#define TTY_STRUCT int\n\n#define sleep(a) taskDelay((a) * sysClkRateGet())\n\n#include <vxWorks.h>\n#include <sockLib.h>\n#include <taskLib.h>\n\n#define getpid taskIdSelf\n\n/* NOTE: these are implemented by helpers in database app!\n * if the database is not linked, we need to implement them\n * elswhere */\nstruct hostent *gethostbyname(const char *name);\nstruct hostent *gethostbyaddr(const char *addr, int length, int type);\nstruct servent *getservbyname(const char *name, const char *proto);\n\n#endif\n/* end vxworks */\n\n#ifdef  __cplusplus\n}\n#endif\n\n#endif\n\n"
  },
  {
    "path": "freebsd-headers/openssl/e_os2.h",
    "content": "/* e_os2.h */\n/* ====================================================================\n * Copyright (c) 1998-2000 The OpenSSL Project.  All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n *\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer. \n *\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in\n *    the documentation and/or other materials provided with the\n *    distribution.\n *\n * 3. All advertising materials mentioning features or use of this\n *    software must display the following acknowledgment:\n *    \"This product includes software developed by the OpenSSL Project\n *    for use in the OpenSSL Toolkit. (http://www.openssl.org/)\"\n *\n * 4. The names \"OpenSSL Toolkit\" and \"OpenSSL Project\" must not be used to\n *    endorse or promote products derived from this software without\n *    prior written permission. For written permission, please contact\n *    openssl-core@openssl.org.\n *\n * 5. Products derived from this software may not be called \"OpenSSL\"\n *    nor may \"OpenSSL\" appear in their names without prior written\n *    permission of the OpenSSL Project.\n *\n * 6. Redistributions of any form whatsoever must retain the following\n *    acknowledgment:\n *    \"This product includes software developed by the OpenSSL Project\n *    for use in the OpenSSL Toolkit (http://www.openssl.org/)\"\n *\n * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY\n * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\n * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE OpenSSL PROJECT OR\n * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\n * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,\n * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED\n * OF THE POSSIBILITY OF SUCH DAMAGE.\n * ====================================================================\n *\n * This product includes cryptographic software written by Eric Young\n * (eay@cryptsoft.com).  This product includes software written by Tim\n * Hudson (tjh@cryptsoft.com).\n *\n */\n\n#include <openssl/opensslconf.h>\n\n#ifndef HEADER_E_OS2_H\n#define HEADER_E_OS2_H\n\n#ifdef  __cplusplus\nextern \"C\" {\n#endif\n\n/******************************************************************************\n * Detect operating systems.  This probably needs completing.\n * The result is that at least one OPENSSL_SYS_os macro should be defined.\n * However, if none is defined, Unix is assumed.\n **/\n\n#define OPENSSL_SYS_UNIX\n\n/* ----------------------- Macintosh, before MacOS X ----------------------- */\n#if defined(__MWERKS__) && defined(macintosh) || defined(OPENSSL_SYSNAME_MAC)\n# undef OPENSSL_SYS_UNIX\n# define OPENSSL_SYS_MACINTOSH_CLASSIC\n#endif\n\n/* ----------------------- NetWare ----------------------------------------- */\n#if defined(NETWARE) || defined(OPENSSL_SYSNAME_NETWARE)\n# undef OPENSSL_SYS_UNIX\n# define OPENSSL_SYS_NETWARE\n#endif\n\n/* ---------------------- Microsoft operating systems ---------------------- */\n\n/* Note that MSDOS actually denotes 32-bit environments running on top of\n   MS-DOS, such as DJGPP one. */\n#if defined(OPENSSL_SYSNAME_MSDOS)\n# undef OPENSSL_SYS_UNIX\n# define OPENSSL_SYS_MSDOS\n#endif\n\n/* For 32 bit environment, there seems to be the CygWin environment and then\n   all the others that try to do the same thing Microsoft does... */\n#if defined(OPENSSL_SYSNAME_UWIN)\n# undef OPENSSL_SYS_UNIX\n# define OPENSSL_SYS_WIN32_UWIN\n#else\n# if defined(__CYGWIN32__) || defined(OPENSSL_SYSNAME_CYGWIN32)\n#  undef OPENSSL_SYS_UNIX\n#  define OPENSSL_SYS_WIN32_CYGWIN\n# else\n#  if defined(_WIN32) || defined(OPENSSL_SYSNAME_WIN32)\n#   undef OPENSSL_SYS_UNIX\n#   define OPENSSL_SYS_WIN32\n#  endif\n#  if defined(OPENSSL_SYSNAME_WINNT)\n#   undef OPENSSL_SYS_UNIX\n#   define OPENSSL_SYS_WINNT\n#  endif\n#  if defined(OPENSSL_SYSNAME_WINCE)\n#   undef OPENSSL_SYS_UNIX\n#   define OPENSSL_SYS_WINCE\n#  endif\n# endif\n#endif\n\n/* Anything that tries to look like Microsoft is \"Windows\" */\n#if defined(OPENSSL_SYS_WIN32) || defined(OPENSSL_SYS_WINNT) || defined(OPENSSL_SYS_WINCE)\n# undef OPENSSL_SYS_UNIX\n# define OPENSSL_SYS_WINDOWS\n# ifndef OPENSSL_SYS_MSDOS\n#  define OPENSSL_SYS_MSDOS\n# endif\n#endif\n\n/* DLL settings.  This part is a bit tough, because it's up to the application\n   implementor how he or she will link the application, so it requires some\n   macro to be used. */\n#ifdef OPENSSL_SYS_WINDOWS\n# ifndef OPENSSL_OPT_WINDLL\n#  if defined(_WINDLL) /* This is used when building OpenSSL to indicate that\n                          DLL linkage should be used */\n#   define OPENSSL_OPT_WINDLL\n#  endif\n# endif\n#endif\n\n/* -------------------------------- OpenVMS -------------------------------- */\n#if defined(__VMS) || defined(VMS) || defined(OPENSSL_SYSNAME_VMS)\n# undef OPENSSL_SYS_UNIX\n# define OPENSSL_SYS_VMS\n# if defined(__DECC)\n#  define OPENSSL_SYS_VMS_DECC\n# elif defined(__DECCXX)\n#  define OPENSSL_SYS_VMS_DECC\n#  define OPENSSL_SYS_VMS_DECCXX\n# else\n#  define OPENSSL_SYS_VMS_NODECC\n# endif\n#endif\n\n/* --------------------------------- OS/2 ---------------------------------- */\n#if defined(__EMX__) || defined(__OS2__)\n# undef OPENSSL_SYS_UNIX\n# define OPENSSL_SYS_OS2\n#endif\n\n/* --------------------------------- Unix ---------------------------------- */\n#ifdef OPENSSL_SYS_UNIX\n# if defined(linux) || defined(__linux__) || defined(OPENSSL_SYSNAME_LINUX)\n#  define OPENSSL_SYS_LINUX\n# endif\n# ifdef OPENSSL_SYSNAME_MPE\n#  define OPENSSL_SYS_MPE\n# endif\n# ifdef OPENSSL_SYSNAME_SNI\n#  define OPENSSL_SYS_SNI\n# endif\n# ifdef OPENSSL_SYSNAME_ULTRASPARC\n#  define OPENSSL_SYS_ULTRASPARC\n# endif\n# ifdef OPENSSL_SYSNAME_NEWS4\n#  define OPENSSL_SYS_NEWS4\n# endif\n# ifdef OPENSSL_SYSNAME_MACOSX\n#  define OPENSSL_SYS_MACOSX\n# endif\n# ifdef OPENSSL_SYSNAME_MACOSX_RHAPSODY\n#  define OPENSSL_SYS_MACOSX_RHAPSODY\n#  define OPENSSL_SYS_MACOSX\n# endif\n# ifdef OPENSSL_SYSNAME_SUNOS\n#  define OPENSSL_SYS_SUNOS\n#endif\n# if defined(_CRAY) || defined(OPENSSL_SYSNAME_CRAY)\n#  define OPENSSL_SYS_CRAY\n# endif\n# if defined(_AIX) || defined(OPENSSL_SYSNAME_AIX)\n#  define OPENSSL_SYS_AIX\n# endif\n#endif\n\n/* --------------------------------- VOS ----------------------------------- */\n#ifdef OPENSSL_SYSNAME_VOS\n# define OPENSSL_SYS_VOS\n#endif\n\n/* ------------------------------- VxWorks --------------------------------- */\n#ifdef OPENSSL_SYSNAME_VXWORKS\n# define OPENSSL_SYS_VXWORKS\n#endif\n\n/**\n * That's it for OS-specific stuff\n *****************************************************************************/\n\n\n/* Specials for I/O an exit */\n#ifdef OPENSSL_SYS_MSDOS\n# define OPENSSL_UNISTD_IO <io.h>\n# define OPENSSL_DECLARE_EXIT extern void exit(int);\n#else\n# define OPENSSL_UNISTD_IO OPENSSL_UNISTD\n# define OPENSSL_DECLARE_EXIT /* declared in unistd.h */\n#endif\n\n/* Definitions of OPENSSL_GLOBAL and OPENSSL_EXTERN, to define and declare\n   certain global symbols that, with some compilers under VMS, have to be\n   defined and declared explicitely with globaldef and globalref.\n   Definitions of OPENSSL_EXPORT and OPENSSL_IMPORT, to define and declare\n   DLL exports and imports for compilers under Win32.  These are a little\n   more complicated to use.  Basically, for any library that exports some\n   global variables, the following code must be present in the header file\n   that declares them, before OPENSSL_EXTERN is used:\n\n   #ifdef SOME_BUILD_FLAG_MACRO\n   # undef OPENSSL_EXTERN\n   # define OPENSSL_EXTERN OPENSSL_EXPORT\n   #endif\n\n   The default is to have OPENSSL_EXPORT, OPENSSL_IMPORT and OPENSSL_GLOBAL\n   have some generally sensible values, and for OPENSSL_EXTERN to have the\n   value OPENSSL_IMPORT.\n*/\n\n#if defined(OPENSSL_SYS_VMS_NODECC)\n# define OPENSSL_EXPORT globalref\n# define OPENSSL_IMPORT globalref\n# define OPENSSL_GLOBAL globaldef\n#elif defined(OPENSSL_SYS_WINDOWS) && defined(OPENSSL_OPT_WINDLL)\n# define OPENSSL_EXPORT extern __declspec(dllexport)\n# define OPENSSL_IMPORT extern __declspec(dllimport)\n# define OPENSSL_GLOBAL\n#else\n# define OPENSSL_EXPORT extern\n# define OPENSSL_IMPORT extern\n# define OPENSSL_GLOBAL\n#endif\n#define OPENSSL_EXTERN OPENSSL_IMPORT\n\n/* Macros to allow global variables to be reached through function calls when\n   required (if a shared library version requvres it, for example.\n   The way it's done allows definitions like this:\n\n\t// in foobar.c\n\tOPENSSL_IMPLEMENT_GLOBAL(int,foobar) = 0;\n\t// in foobar.h\n\tOPENSSL_DECLARE_GLOBAL(int,foobar);\n\t#define foobar OPENSSL_GLOBAL_REF(foobar)\n*/\n#ifdef OPENSSL_EXPORT_VAR_AS_FUNCTION\n# define OPENSSL_IMPLEMENT_GLOBAL(type,name)\t\t\t     \\\n\textern type _hide_##name;\t\t\t\t     \\\n\ttype *_shadow_##name(void) { return &_hide_##name; }\t     \\\n\tstatic type _hide_##name\n# define OPENSSL_DECLARE_GLOBAL(type,name) type *_shadow_##name(void)\n# define OPENSSL_GLOBAL_REF(name) (*(_shadow_##name()))\n#else\n# define OPENSSL_IMPLEMENT_GLOBAL(type,name) OPENSSL_GLOBAL type _shadow_##name\n# define OPENSSL_DECLARE_GLOBAL(type,name) OPENSSL_EXPORT type _shadow_##name\n# define OPENSSL_GLOBAL_REF(name) _shadow_##name\n#endif\n\n#ifdef  __cplusplus\n}\n#endif\n#endif\n"
  },
  {
    "path": "freebsd-headers/openssl/ebcdic.h",
    "content": "/* crypto/ebcdic.h */\n\n#ifndef HEADER_EBCDIC_H\n#define HEADER_EBCDIC_H\n\n#include <sys/types.h>\n\n/* Avoid name clashes with other applications */\n#define os_toascii   _openssl_os_toascii\n#define os_toebcdic  _openssl_os_toebcdic\n#define ebcdic2ascii _openssl_ebcdic2ascii\n#define ascii2ebcdic _openssl_ascii2ebcdic\n\nextern const unsigned char os_toascii[256];\nextern const unsigned char os_toebcdic[256];\nvoid *ebcdic2ascii(void *dest, const void *srce, size_t count);\nvoid *ascii2ebcdic(void *dest, const void *srce, size_t count);\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/openssl/ec.h",
    "content": "/* crypto/ec/ec.h */\n/*\n * Originally written by Bodo Moeller for the OpenSSL project.\n */\n/* ====================================================================\n * Copyright (c) 1998-2003 The OpenSSL Project.  All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n *\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer. \n *\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in\n *    the documentation and/or other materials provided with the\n *    distribution.\n *\n * 3. All advertising materials mentioning features or use of this\n *    software must display the following acknowledgment:\n *    \"This product includes software developed by the OpenSSL Project\n *    for use in the OpenSSL Toolkit. (http://www.openssl.org/)\"\n *\n * 4. The names \"OpenSSL Toolkit\" and \"OpenSSL Project\" must not be used to\n *    endorse or promote products derived from this software without\n *    prior written permission. For written permission, please contact\n *    openssl-core@openssl.org.\n *\n * 5. Products derived from this software may not be called \"OpenSSL\"\n *    nor may \"OpenSSL\" appear in their names without prior written\n *    permission of the OpenSSL Project.\n *\n * 6. Redistributions of any form whatsoever must retain the following\n *    acknowledgment:\n *    \"This product includes software developed by the OpenSSL Project\n *    for use in the OpenSSL Toolkit (http://www.openssl.org/)\"\n *\n * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY\n * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\n * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE OpenSSL PROJECT OR\n * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\n * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,\n * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED\n * OF THE POSSIBILITY OF SUCH DAMAGE.\n * ====================================================================\n *\n * This product includes cryptographic software written by Eric Young\n * (eay@cryptsoft.com).  This product includes software written by Tim\n * Hudson (tjh@cryptsoft.com).\n *\n */\n/* ====================================================================\n * Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED.\n *\n * Portions of the attached software (\"Contribution\") are developed by \n * SUN MICROSYSTEMS, INC., and are contributed to the OpenSSL project.\n *\n * The Contribution is licensed pursuant to the OpenSSL open source\n * license provided above.\n *\n * The elliptic curve binary polynomial software is originally written by \n * Sheueling Chang Shantz and Douglas Stebila of Sun Microsystems Laboratories.\n *\n */\n\n#ifndef HEADER_EC_H\n#define HEADER_EC_H\n\n#include <openssl/opensslconf.h>\n\n#ifdef OPENSSL_NO_EC\n#error EC is disabled.\n#endif\n\n#include <openssl/asn1.h>\n#include <openssl/symhacks.h>\n#ifndef OPENSSL_NO_DEPRECATED\n#include <openssl/bn.h>\n#endif\n\n#ifdef  __cplusplus\nextern \"C\" {\n#elif defined(__SUNPRO_C)\n# if __SUNPRO_C >= 0x520\n# pragma error_messages (off,E_ARRAY_OF_INCOMPLETE_NONAME,E_ARRAY_OF_INCOMPLETE)\n# endif\n#endif\n\n\n#ifndef OPENSSL_ECC_MAX_FIELD_BITS\n# define OPENSSL_ECC_MAX_FIELD_BITS 661\n#endif\n\ntypedef enum {\n\t/* values as defined in X9.62 (ECDSA) and elsewhere */\n\tPOINT_CONVERSION_COMPRESSED = 2,\n\tPOINT_CONVERSION_UNCOMPRESSED = 4,\n\tPOINT_CONVERSION_HYBRID = 6\n} point_conversion_form_t;\n\n\ntypedef struct ec_method_st EC_METHOD;\n\ntypedef struct ec_group_st\n\t/*\n\t EC_METHOD *meth;\n\t -- field definition\n\t -- curve coefficients\n\t -- optional generator with associated information (order, cofactor)\n\t -- optional extra data (precomputed table for fast computation of multiples of generator)\n\t -- ASN1 stuff\n\t*/\n\tEC_GROUP;\n\ntypedef struct ec_point_st EC_POINT;\n\n\n/* EC_METHODs for curves over GF(p).\n * EC_GFp_simple_method provides the basis for the optimized methods.\n */\nconst EC_METHOD *EC_GFp_simple_method(void);\nconst EC_METHOD *EC_GFp_mont_method(void);\nconst EC_METHOD *EC_GFp_nist_method(void);\n\n/* EC_METHOD for curves over GF(2^m).\n */\nconst EC_METHOD *EC_GF2m_simple_method(void);\n\n\nEC_GROUP *EC_GROUP_new(const EC_METHOD *);\nvoid EC_GROUP_free(EC_GROUP *);\nvoid EC_GROUP_clear_free(EC_GROUP *);\nint EC_GROUP_copy(EC_GROUP *, const EC_GROUP *);\nEC_GROUP *EC_GROUP_dup(const EC_GROUP *);\n\nconst EC_METHOD *EC_GROUP_method_of(const EC_GROUP *);\nint EC_METHOD_get_field_type(const EC_METHOD *);\n\nint EC_GROUP_set_generator(EC_GROUP *, const EC_POINT *generator, const BIGNUM *order, const BIGNUM *cofactor);\nconst EC_POINT *EC_GROUP_get0_generator(const EC_GROUP *);\nint EC_GROUP_get_order(const EC_GROUP *, BIGNUM *order, BN_CTX *);\nint EC_GROUP_get_cofactor(const EC_GROUP *, BIGNUM *cofactor, BN_CTX *);\n\nvoid EC_GROUP_set_curve_name(EC_GROUP *, int nid);\nint EC_GROUP_get_curve_name(const EC_GROUP *);\n\nvoid EC_GROUP_set_asn1_flag(EC_GROUP *, int flag);\nint EC_GROUP_get_asn1_flag(const EC_GROUP *);\n\nvoid EC_GROUP_set_point_conversion_form(EC_GROUP *, point_conversion_form_t);\npoint_conversion_form_t EC_GROUP_get_point_conversion_form(const EC_GROUP *);\n\nunsigned char *EC_GROUP_get0_seed(const EC_GROUP *);\nsize_t EC_GROUP_get_seed_len(const EC_GROUP *);\nsize_t EC_GROUP_set_seed(EC_GROUP *, const unsigned char *, size_t len);\n\nint EC_GROUP_set_curve_GFp(EC_GROUP *, const BIGNUM *p, const BIGNUM *a, const BIGNUM *b, BN_CTX *);\nint EC_GROUP_get_curve_GFp(const EC_GROUP *, BIGNUM *p, BIGNUM *a, BIGNUM *b, BN_CTX *);\nint EC_GROUP_set_curve_GF2m(EC_GROUP *, const BIGNUM *p, const BIGNUM *a, const BIGNUM *b, BN_CTX *);\nint EC_GROUP_get_curve_GF2m(const EC_GROUP *, BIGNUM *p, BIGNUM *a, BIGNUM *b, BN_CTX *);\n\n/* returns the number of bits needed to represent a field element */\nint EC_GROUP_get_degree(const EC_GROUP *);\n\n/* EC_GROUP_check() returns 1 if 'group' defines a valid group, 0 otherwise */\nint EC_GROUP_check(const EC_GROUP *group, BN_CTX *ctx);\n/* EC_GROUP_check_discriminant() returns 1 if the discriminant of the\n * elliptic curve is not zero, 0 otherwise */\nint EC_GROUP_check_discriminant(const EC_GROUP *, BN_CTX *);\n\n/* EC_GROUP_cmp() returns 0 if both groups are equal and 1 otherwise */\nint EC_GROUP_cmp(const EC_GROUP *, const EC_GROUP *, BN_CTX *);\n\n/* EC_GROUP_new_GF*() calls EC_GROUP_new() and EC_GROUP_set_GF*()\n * after choosing an appropriate EC_METHOD */\nEC_GROUP *EC_GROUP_new_curve_GFp(const BIGNUM *p, const BIGNUM *a, const BIGNUM *b, BN_CTX *);\nEC_GROUP *EC_GROUP_new_curve_GF2m(const BIGNUM *p, const BIGNUM *a, const BIGNUM *b, BN_CTX *);\n\n/* EC_GROUP_new_by_curve_name() creates a EC_GROUP structure\n * specified by a curve name (in form of a NID) */\nEC_GROUP *EC_GROUP_new_by_curve_name(int nid);\n/* handling of internal curves */\ntypedef struct { \n\tint nid;\n\tconst char *comment;\n\t} EC_builtin_curve;\n/* EC_builtin_curves(EC_builtin_curve *r, size_t size) returns number \n * of all available curves or zero if a error occurred. \n * In case r ist not zero nitems EC_builtin_curve structures \n * are filled with the data of the first nitems internal groups */\nsize_t EC_get_builtin_curves(EC_builtin_curve *r, size_t nitems);\n\n\n/* EC_POINT functions */\n\nEC_POINT *EC_POINT_new(const EC_GROUP *);\nvoid EC_POINT_free(EC_POINT *);\nvoid EC_POINT_clear_free(EC_POINT *);\nint EC_POINT_copy(EC_POINT *, const EC_POINT *);\nEC_POINT *EC_POINT_dup(const EC_POINT *, const EC_GROUP *);\n \nconst EC_METHOD *EC_POINT_method_of(const EC_POINT *);\n\nint EC_POINT_set_to_infinity(const EC_GROUP *, EC_POINT *);\nint EC_POINT_set_Jprojective_coordinates_GFp(const EC_GROUP *, EC_POINT *,\n\tconst BIGNUM *x, const BIGNUM *y, const BIGNUM *z, BN_CTX *);\nint EC_POINT_get_Jprojective_coordinates_GFp(const EC_GROUP *, const EC_POINT *,\n\tBIGNUM *x, BIGNUM *y, BIGNUM *z, BN_CTX *);\nint EC_POINT_set_affine_coordinates_GFp(const EC_GROUP *, EC_POINT *,\n\tconst BIGNUM *x, const BIGNUM *y, BN_CTX *);\nint EC_POINT_get_affine_coordinates_GFp(const EC_GROUP *, const EC_POINT *,\n\tBIGNUM *x, BIGNUM *y, BN_CTX *);\nint EC_POINT_set_compressed_coordinates_GFp(const EC_GROUP *, EC_POINT *,\n\tconst BIGNUM *x, int y_bit, BN_CTX *);\n\nint EC_POINT_set_affine_coordinates_GF2m(const EC_GROUP *, EC_POINT *,\n\tconst BIGNUM *x, const BIGNUM *y, BN_CTX *);\nint EC_POINT_get_affine_coordinates_GF2m(const EC_GROUP *, const EC_POINT *,\n\tBIGNUM *x, BIGNUM *y, BN_CTX *);\nint EC_POINT_set_compressed_coordinates_GF2m(const EC_GROUP *, EC_POINT *,\n\tconst BIGNUM *x, int y_bit, BN_CTX *);\n\nsize_t EC_POINT_point2oct(const EC_GROUP *, const EC_POINT *, point_conversion_form_t form,\n        unsigned char *buf, size_t len, BN_CTX *);\nint EC_POINT_oct2point(const EC_GROUP *, EC_POINT *,\n        const unsigned char *buf, size_t len, BN_CTX *);\n\n/* other interfaces to point2oct/oct2point: */\nBIGNUM *EC_POINT_point2bn(const EC_GROUP *, const EC_POINT *,\n\tpoint_conversion_form_t form, BIGNUM *, BN_CTX *);\nEC_POINT *EC_POINT_bn2point(const EC_GROUP *, const BIGNUM *,\n\tEC_POINT *, BN_CTX *);\nchar *EC_POINT_point2hex(const EC_GROUP *, const EC_POINT *,\n\tpoint_conversion_form_t form, BN_CTX *);\nEC_POINT *EC_POINT_hex2point(const EC_GROUP *, const char *,\n\tEC_POINT *, BN_CTX *);\n\nint EC_POINT_add(const EC_GROUP *, EC_POINT *r, const EC_POINT *a, const EC_POINT *b, BN_CTX *);\nint EC_POINT_dbl(const EC_GROUP *, EC_POINT *r, const EC_POINT *a, BN_CTX *);\nint EC_POINT_invert(const EC_GROUP *, EC_POINT *, BN_CTX *);\n\nint EC_POINT_is_at_infinity(const EC_GROUP *, const EC_POINT *);\nint EC_POINT_is_on_curve(const EC_GROUP *, const EC_POINT *, BN_CTX *);\nint EC_POINT_cmp(const EC_GROUP *, const EC_POINT *a, const EC_POINT *b, BN_CTX *);\n\nint EC_POINT_make_affine(const EC_GROUP *, EC_POINT *, BN_CTX *);\nint EC_POINTs_make_affine(const EC_GROUP *, size_t num, EC_POINT *[], BN_CTX *);\n\n\nint EC_POINTs_mul(const EC_GROUP *, EC_POINT *r, const BIGNUM *, size_t num, const EC_POINT *[], const BIGNUM *[], BN_CTX *);\nint EC_POINT_mul(const EC_GROUP *, EC_POINT *r, const BIGNUM *, const EC_POINT *, const BIGNUM *, BN_CTX *);\n\n/* EC_GROUP_precompute_mult() stores multiples of generator for faster point multiplication */\nint EC_GROUP_precompute_mult(EC_GROUP *, BN_CTX *);\n/* EC_GROUP_have_precompute_mult() reports whether such precomputation has been done */\nint EC_GROUP_have_precompute_mult(const EC_GROUP *);\n\n\n\n/* ASN1 stuff */\n\n/* EC_GROUP_get_basis_type() returns the NID of the basis type\n * used to represent the field elements */\nint EC_GROUP_get_basis_type(const EC_GROUP *);\nint EC_GROUP_get_trinomial_basis(const EC_GROUP *, unsigned int *k);\nint EC_GROUP_get_pentanomial_basis(const EC_GROUP *, unsigned int *k1, \n\tunsigned int *k2, unsigned int *k3);\n\n#define OPENSSL_EC_NAMED_CURVE\t0x001\n\ntypedef struct ecpk_parameters_st ECPKPARAMETERS;\n\nEC_GROUP *d2i_ECPKParameters(EC_GROUP **, const unsigned char **in, long len);\nint i2d_ECPKParameters(const EC_GROUP *, unsigned char **out);\n\n#define d2i_ECPKParameters_bio(bp,x) ASN1_d2i_bio_of(EC_GROUP,NULL,d2i_ECPKParameters,bp,x)\n#define i2d_ECPKParameters_bio(bp,x) ASN1_i2d_bio_of_const(EC_GROUP,i2d_ECPKParameters,bp,x)\n#define d2i_ECPKParameters_fp(fp,x) (EC_GROUP *)ASN1_d2i_fp(NULL, \\\n                (char *(*)())d2i_ECPKParameters,(fp),(unsigned char **)(x))\n#define i2d_ECPKParameters_fp(fp,x) ASN1_i2d_fp(i2d_ECPKParameters,(fp), \\\n\t\t(unsigned char *)(x))\n\n#ifndef OPENSSL_NO_BIO\nint     ECPKParameters_print(BIO *bp, const EC_GROUP *x, int off);\n#endif\n#ifndef OPENSSL_NO_FP_API\nint     ECPKParameters_print_fp(FILE *fp, const EC_GROUP *x, int off);\n#endif\n\n/* the EC_KEY stuff */\ntypedef struct ec_key_st EC_KEY;\n\n/* some values for the encoding_flag */\n#define EC_PKEY_NO_PARAMETERS\t0x001\n#define EC_PKEY_NO_PUBKEY\t0x002\n\nEC_KEY *EC_KEY_new(void);\nEC_KEY *EC_KEY_new_by_curve_name(int nid);\nvoid EC_KEY_free(EC_KEY *);\nEC_KEY *EC_KEY_copy(EC_KEY *, const EC_KEY *);\nEC_KEY *EC_KEY_dup(const EC_KEY *);\n\nint EC_KEY_up_ref(EC_KEY *);\n\nconst EC_GROUP *EC_KEY_get0_group(const EC_KEY *);\nint EC_KEY_set_group(EC_KEY *, const EC_GROUP *);\nconst BIGNUM *EC_KEY_get0_private_key(const EC_KEY *);\nint EC_KEY_set_private_key(EC_KEY *, const BIGNUM *);\nconst EC_POINT *EC_KEY_get0_public_key(const EC_KEY *);\nint EC_KEY_set_public_key(EC_KEY *, const EC_POINT *);\nunsigned EC_KEY_get_enc_flags(const EC_KEY *);\nvoid EC_KEY_set_enc_flags(EC_KEY *, unsigned int);\npoint_conversion_form_t EC_KEY_get_conv_form(const EC_KEY *);\nvoid EC_KEY_set_conv_form(EC_KEY *, point_conversion_form_t);\n/* functions to set/get method specific data  */\nvoid *EC_KEY_get_key_method_data(EC_KEY *, \n\tvoid *(*dup_func)(void *), void (*free_func)(void *), void (*clear_free_func)(void *));\nvoid EC_KEY_insert_key_method_data(EC_KEY *, void *data,\n\tvoid *(*dup_func)(void *), void (*free_func)(void *), void (*clear_free_func)(void *));\n/* wrapper functions for the underlying EC_GROUP object */\nvoid EC_KEY_set_asn1_flag(EC_KEY *, int);\nint EC_KEY_precompute_mult(EC_KEY *, BN_CTX *ctx);\n\n/* EC_KEY_generate_key() creates a ec private (public) key */\nint EC_KEY_generate_key(EC_KEY *);\n/* EC_KEY_check_key() */\nint EC_KEY_check_key(const EC_KEY *);\n\n/* de- and encoding functions for SEC1 ECPrivateKey */\nEC_KEY *d2i_ECPrivateKey(EC_KEY **a, const unsigned char **in, long len);\nint i2d_ECPrivateKey(EC_KEY *a, unsigned char **out);\n/* de- and encoding functions for EC parameters */\nEC_KEY *d2i_ECParameters(EC_KEY **a, const unsigned char **in, long len);\nint i2d_ECParameters(EC_KEY *a, unsigned char **out);\n/* de- and encoding functions for EC public key\n * (octet string, not DER -- hence 'o2i' and 'i2o') */\nEC_KEY *o2i_ECPublicKey(EC_KEY **a, const unsigned char **in, long len);\nint i2o_ECPublicKey(EC_KEY *a, unsigned char **out);\n\n#ifndef OPENSSL_NO_BIO\nint\tECParameters_print(BIO *bp, const EC_KEY *x);\nint\tEC_KEY_print(BIO *bp, const EC_KEY *x, int off);\n#endif\n#ifndef OPENSSL_NO_FP_API\nint\tECParameters_print_fp(FILE *fp, const EC_KEY *x);\nint\tEC_KEY_print_fp(FILE *fp, const EC_KEY *x, int off);\n#endif\n\n#define ECParameters_dup(x) ASN1_dup_of(EC_KEY,i2d_ECParameters,d2i_ECParameters,x)\n\n#ifndef __cplusplus\n#if defined(__SUNPRO_C)\n#  if __SUNPRO_C >= 0x520\n# pragma error_messages (default,E_ARRAY_OF_INCOMPLETE_NONAME,E_ARRAY_OF_INCOMPLETE)\n#  endif\n# endif\n#endif\n\n/* BEGIN ERROR CODES */\n/* The following lines are auto generated by the script mkerr.pl. Any changes\n * made after this point may be overwritten when the script is next run.\n */\nvoid ERR_load_EC_strings(void);\n\n/* Error codes for the EC functions. */\n\n/* Function codes. */\n#define EC_F_COMPUTE_WNAF\t\t\t\t 143\n#define EC_F_D2I_ECPARAMETERS\t\t\t\t 144\n#define EC_F_D2I_ECPKPARAMETERS\t\t\t\t 145\n#define EC_F_D2I_ECPRIVATEKEY\t\t\t\t 146\n#define EC_F_ECPARAMETERS_PRINT\t\t\t\t 147\n#define EC_F_ECPARAMETERS_PRINT_FP\t\t\t 148\n#define EC_F_ECPKPARAMETERS_PRINT\t\t\t 149\n#define EC_F_ECPKPARAMETERS_PRINT_FP\t\t\t 150\n#define EC_F_ECP_NIST_MOD_192\t\t\t\t 203\n#define EC_F_ECP_NIST_MOD_224\t\t\t\t 204\n#define EC_F_ECP_NIST_MOD_256\t\t\t\t 205\n#define EC_F_ECP_NIST_MOD_521\t\t\t\t 206\n#define EC_F_EC_ASN1_GROUP2CURVE\t\t\t 153\n#define EC_F_EC_ASN1_GROUP2FIELDID\t\t\t 154\n#define EC_F_EC_ASN1_GROUP2PARAMETERS\t\t\t 155\n#define EC_F_EC_ASN1_GROUP2PKPARAMETERS\t\t\t 156\n#define EC_F_EC_ASN1_PARAMETERS2GROUP\t\t\t 157\n#define EC_F_EC_ASN1_PKPARAMETERS2GROUP\t\t\t 158\n#define EC_F_EC_EX_DATA_SET_DATA\t\t\t 211\n#define EC_F_EC_GF2M_MONTGOMERY_POINT_MULTIPLY\t\t 208\n#define EC_F_EC_GF2M_SIMPLE_GROUP_CHECK_DISCRIMINANT\t 159\n#define EC_F_EC_GF2M_SIMPLE_GROUP_SET_CURVE\t\t 195\n#define EC_F_EC_GF2M_SIMPLE_OCT2POINT\t\t\t 160\n#define EC_F_EC_GF2M_SIMPLE_POINT2OCT\t\t\t 161\n#define EC_F_EC_GF2M_SIMPLE_POINT_GET_AFFINE_COORDINATES 162\n#define EC_F_EC_GF2M_SIMPLE_POINT_SET_AFFINE_COORDINATES 163\n#define EC_F_EC_GF2M_SIMPLE_SET_COMPRESSED_COORDINATES\t 164\n#define EC_F_EC_GFP_MONT_FIELD_DECODE\t\t\t 133\n#define EC_F_EC_GFP_MONT_FIELD_ENCODE\t\t\t 134\n#define EC_F_EC_GFP_MONT_FIELD_MUL\t\t\t 131\n#define EC_F_EC_GFP_MONT_FIELD_SET_TO_ONE\t\t 209\n#define EC_F_EC_GFP_MONT_FIELD_SQR\t\t\t 132\n#define EC_F_EC_GFP_MONT_GROUP_SET_CURVE\t\t 189\n#define EC_F_EC_GFP_MONT_GROUP_SET_CURVE_GFP\t\t 135\n#define EC_F_EC_GFP_NIST_FIELD_MUL\t\t\t 200\n#define EC_F_EC_GFP_NIST_FIELD_SQR\t\t\t 201\n#define EC_F_EC_GFP_NIST_GROUP_SET_CURVE\t\t 202\n#define EC_F_EC_GFP_SIMPLE_GROUP_CHECK_DISCRIMINANT\t 165\n#define EC_F_EC_GFP_SIMPLE_GROUP_SET_CURVE\t\t 166\n#define EC_F_EC_GFP_SIMPLE_GROUP_SET_CURVE_GFP\t\t 100\n#define EC_F_EC_GFP_SIMPLE_GROUP_SET_GENERATOR\t\t 101\n#define EC_F_EC_GFP_SIMPLE_MAKE_AFFINE\t\t\t 102\n#define EC_F_EC_GFP_SIMPLE_OCT2POINT\t\t\t 103\n#define EC_F_EC_GFP_SIMPLE_POINT2OCT\t\t\t 104\n#define EC_F_EC_GFP_SIMPLE_POINTS_MAKE_AFFINE\t\t 137\n#define EC_F_EC_GFP_SIMPLE_POINT_GET_AFFINE_COORDINATES\t 167\n#define EC_F_EC_GFP_SIMPLE_POINT_GET_AFFINE_COORDINATES_GFP 105\n#define EC_F_EC_GFP_SIMPLE_POINT_SET_AFFINE_COORDINATES\t 168\n#define EC_F_EC_GFP_SIMPLE_POINT_SET_AFFINE_COORDINATES_GFP 128\n#define EC_F_EC_GFP_SIMPLE_SET_COMPRESSED_COORDINATES\t 169\n#define EC_F_EC_GFP_SIMPLE_SET_COMPRESSED_COORDINATES_GFP 129\n#define EC_F_EC_GROUP_CHECK\t\t\t\t 170\n#define EC_F_EC_GROUP_CHECK_DISCRIMINANT\t\t 171\n#define EC_F_EC_GROUP_COPY\t\t\t\t 106\n#define EC_F_EC_GROUP_GET0_GENERATOR\t\t\t 139\n#define EC_F_EC_GROUP_GET_COFACTOR\t\t\t 140\n#define EC_F_EC_GROUP_GET_CURVE_GF2M\t\t\t 172\n#define EC_F_EC_GROUP_GET_CURVE_GFP\t\t\t 130\n#define EC_F_EC_GROUP_GET_DEGREE\t\t\t 173\n#define EC_F_EC_GROUP_GET_ORDER\t\t\t\t 141\n#define EC_F_EC_GROUP_GET_PENTANOMIAL_BASIS\t\t 193\n#define EC_F_EC_GROUP_GET_TRINOMIAL_BASIS\t\t 194\n#define EC_F_EC_GROUP_NEW\t\t\t\t 108\n#define EC_F_EC_GROUP_NEW_BY_CURVE_NAME\t\t\t 174\n#define EC_F_EC_GROUP_NEW_FROM_DATA\t\t\t 175\n#define EC_F_EC_GROUP_PRECOMPUTE_MULT\t\t\t 142\n#define EC_F_EC_GROUP_SET_CURVE_GF2M\t\t\t 176\n#define EC_F_EC_GROUP_SET_CURVE_GFP\t\t\t 109\n#define EC_F_EC_GROUP_SET_EXTRA_DATA\t\t\t 110\n#define EC_F_EC_GROUP_SET_GENERATOR\t\t\t 111\n#define EC_F_EC_KEY_CHECK_KEY\t\t\t\t 177\n#define EC_F_EC_KEY_COPY\t\t\t\t 178\n#define EC_F_EC_KEY_GENERATE_KEY\t\t\t 179\n#define EC_F_EC_KEY_NEW\t\t\t\t\t 182\n#define EC_F_EC_KEY_PRINT\t\t\t\t 180\n#define EC_F_EC_KEY_PRINT_FP\t\t\t\t 181\n#define EC_F_EC_POINTS_MAKE_AFFINE\t\t\t 136\n#define EC_F_EC_POINTS_MUL\t\t\t\t 138\n#define EC_F_EC_POINT_ADD\t\t\t\t 112\n#define EC_F_EC_POINT_CMP\t\t\t\t 113\n#define EC_F_EC_POINT_COPY\t\t\t\t 114\n#define EC_F_EC_POINT_DBL\t\t\t\t 115\n#define EC_F_EC_POINT_GET_AFFINE_COORDINATES_GF2M\t 183\n#define EC_F_EC_POINT_GET_AFFINE_COORDINATES_GFP\t 116\n#define EC_F_EC_POINT_GET_JPROJECTIVE_COORDINATES_GFP\t 117\n#define EC_F_EC_POINT_INVERT\t\t\t\t 210\n#define EC_F_EC_POINT_IS_AT_INFINITY\t\t\t 118\n#define EC_F_EC_POINT_IS_ON_CURVE\t\t\t 119\n#define EC_F_EC_POINT_MAKE_AFFINE\t\t\t 120\n#define EC_F_EC_POINT_MUL\t\t\t\t 184\n#define EC_F_EC_POINT_NEW\t\t\t\t 121\n#define EC_F_EC_POINT_OCT2POINT\t\t\t\t 122\n#define EC_F_EC_POINT_POINT2OCT\t\t\t\t 123\n#define EC_F_EC_POINT_SET_AFFINE_COORDINATES_GF2M\t 185\n#define EC_F_EC_POINT_SET_AFFINE_COORDINATES_GFP\t 124\n#define EC_F_EC_POINT_SET_COMPRESSED_COORDINATES_GF2M\t 186\n#define EC_F_EC_POINT_SET_COMPRESSED_COORDINATES_GFP\t 125\n#define EC_F_EC_POINT_SET_JPROJECTIVE_COORDINATES_GFP\t 126\n#define EC_F_EC_POINT_SET_TO_INFINITY\t\t\t 127\n#define EC_F_EC_PRE_COMP_DUP\t\t\t\t 207\n#define EC_F_EC_PRE_COMP_NEW\t\t\t\t 196\n#define EC_F_EC_WNAF_MUL\t\t\t\t 187\n#define EC_F_EC_WNAF_PRECOMPUTE_MULT\t\t\t 188\n#define EC_F_I2D_ECPARAMETERS\t\t\t\t 190\n#define EC_F_I2D_ECPKPARAMETERS\t\t\t\t 191\n#define EC_F_I2D_ECPRIVATEKEY\t\t\t\t 192\n#define EC_F_I2O_ECPUBLICKEY\t\t\t\t 151\n#define EC_F_O2I_ECPUBLICKEY\t\t\t\t 152\n\n/* Reason codes. */\n#define EC_R_ASN1_ERROR\t\t\t\t\t 115\n#define EC_R_ASN1_UNKNOWN_FIELD\t\t\t\t 116\n#define EC_R_BUFFER_TOO_SMALL\t\t\t\t 100\n#define EC_R_D2I_ECPKPARAMETERS_FAILURE\t\t\t 117\n#define EC_R_DISCRIMINANT_IS_ZERO\t\t\t 118\n#define EC_R_EC_GROUP_NEW_BY_NAME_FAILURE\t\t 119\n#define EC_R_FIELD_TOO_LARGE\t\t\t\t 138\n#define EC_R_GROUP2PKPARAMETERS_FAILURE\t\t\t 120\n#define EC_R_I2D_ECPKPARAMETERS_FAILURE\t\t\t 121\n#define EC_R_INCOMPATIBLE_OBJECTS\t\t\t 101\n#define EC_R_INVALID_ARGUMENT\t\t\t\t 112\n#define EC_R_INVALID_COMPRESSED_POINT\t\t\t 110\n#define EC_R_INVALID_COMPRESSION_BIT\t\t\t 109\n#define EC_R_INVALID_ENCODING\t\t\t\t 102\n#define EC_R_INVALID_FIELD\t\t\t\t 103\n#define EC_R_INVALID_FORM\t\t\t\t 104\n#define EC_R_INVALID_GROUP_ORDER\t\t\t 122\n#define EC_R_INVALID_PENTANOMIAL_BASIS\t\t\t 132\n#define EC_R_INVALID_PRIVATE_KEY\t\t\t 123\n#define EC_R_INVALID_TRINOMIAL_BASIS\t\t\t 137\n#define EC_R_MISSING_PARAMETERS\t\t\t\t 124\n#define EC_R_MISSING_PRIVATE_KEY\t\t\t 125\n#define EC_R_NOT_A_NIST_PRIME\t\t\t\t 135\n#define EC_R_NOT_A_SUPPORTED_NIST_PRIME\t\t\t 136\n#define EC_R_NOT_IMPLEMENTED\t\t\t\t 126\n#define EC_R_NOT_INITIALIZED\t\t\t\t 111\n#define EC_R_NO_FIELD_MOD\t\t\t\t 133\n#define EC_R_PASSED_NULL_PARAMETER\t\t\t 134\n#define EC_R_PKPARAMETERS2GROUP_FAILURE\t\t\t 127\n#define EC_R_POINT_AT_INFINITY\t\t\t\t 106\n#define EC_R_POINT_IS_NOT_ON_CURVE\t\t\t 107\n#define EC_R_SLOT_FULL\t\t\t\t\t 108\n#define EC_R_UNDEFINED_GENERATOR\t\t\t 113\n#define EC_R_UNDEFINED_ORDER\t\t\t\t 128\n#define EC_R_UNKNOWN_GROUP\t\t\t\t 129\n#define EC_R_UNKNOWN_ORDER\t\t\t\t 114\n#define EC_R_UNSUPPORTED_FIELD\t\t\t\t 131\n#define EC_R_WRONG_ORDER\t\t\t\t 130\n\n#ifdef  __cplusplus\n}\n#endif\n#endif\n"
  },
  {
    "path": "freebsd-headers/openssl/ecdh.h",
    "content": "/* crypto/ecdh/ecdh.h */\n/* ====================================================================\n * Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED.\n *\n * The Elliptic Curve Public-Key Crypto Library (ECC Code) included\n * herein is developed by SUN MICROSYSTEMS, INC., and is contributed\n * to the OpenSSL project.\n *\n * The ECC Code is licensed pursuant to the OpenSSL open source\n * license provided below.\n *\n * The ECDH software is originally written by Douglas Stebila of\n * Sun Microsystems Laboratories.\n *\n */\n/* ====================================================================\n * Copyright (c) 2000-2002 The OpenSSL Project.  All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n *\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer. \n *\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in\n *    the documentation and/or other materials provided with the\n *    distribution.\n *\n * 3. All advertising materials mentioning features or use of this\n *    software must display the following acknowledgment:\n *    \"This product includes software developed by the OpenSSL Project\n *    for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)\"\n *\n * 4. The names \"OpenSSL Toolkit\" and \"OpenSSL Project\" must not be used to\n *    endorse or promote products derived from this software without\n *    prior written permission. For written permission, please contact\n *    licensing@OpenSSL.org.\n *\n * 5. Products derived from this software may not be called \"OpenSSL\"\n *    nor may \"OpenSSL\" appear in their names without prior written\n *    permission of the OpenSSL Project.\n *\n * 6. Redistributions of any form whatsoever must retain the following\n *    acknowledgment:\n *    \"This product includes software developed by the OpenSSL Project\n *    for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)\"\n *\n * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY\n * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\n * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE OpenSSL PROJECT OR\n * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\n * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,\n * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED\n * OF THE POSSIBILITY OF SUCH DAMAGE.\n * ====================================================================\n *\n * This product includes cryptographic software written by Eric Young\n * (eay@cryptsoft.com).  This product includes software written by Tim\n * Hudson (tjh@cryptsoft.com).\n *\n */\n#ifndef HEADER_ECDH_H\n#define HEADER_ECDH_H\n\n#include <openssl/opensslconf.h>\n\n#ifdef OPENSSL_NO_ECDH\n#error ECDH is disabled.\n#endif\n\n#include <openssl/ec.h>\n#include <openssl/ossl_typ.h>\n#ifndef OPENSSL_NO_DEPRECATED\n#include <openssl/bn.h>\n#endif\n\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\nconst ECDH_METHOD *ECDH_OpenSSL(void);\n\nvoid\t  ECDH_set_default_method(const ECDH_METHOD *);\nconst ECDH_METHOD *ECDH_get_default_method(void);\nint \t  ECDH_set_method(EC_KEY *, const ECDH_METHOD *);\n\nint ECDH_compute_key(void *out, size_t outlen, const EC_POINT *pub_key, EC_KEY *ecdh,\n                     void *(*KDF)(const void *in, size_t inlen, void *out, size_t *outlen));\n\nint \t  ECDH_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new \n\t\t*new_func, CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func);\nint \t  ECDH_set_ex_data(EC_KEY *d, int idx, void *arg);\nvoid \t  *ECDH_get_ex_data(EC_KEY *d, int idx);\n\n\n/* BEGIN ERROR CODES */\n/* The following lines are auto generated by the script mkerr.pl. Any changes\n * made after this point may be overwritten when the script is next run.\n */\nvoid ERR_load_ECDH_strings(void);\n\n/* Error codes for the ECDH functions. */\n\n/* Function codes. */\n#define ECDH_F_ECDH_COMPUTE_KEY\t\t\t\t 100\n#define ECDH_F_ECDH_DATA_NEW_METHOD\t\t\t 101\n\n/* Reason codes. */\n#define ECDH_R_KDF_FAILED\t\t\t\t 102\n#define ECDH_R_NO_PRIVATE_VALUE\t\t\t\t 100\n#define ECDH_R_POINT_ARITHMETIC_FAILURE\t\t\t 101\n\n#ifdef  __cplusplus\n}\n#endif\n#endif\n"
  },
  {
    "path": "freebsd-headers/openssl/ecdsa.h",
    "content": "/* crypto/ecdsa/ecdsa.h */\n/**\n * \\file   crypto/ecdsa/ecdsa.h Include file for the OpenSSL ECDSA functions\n * \\author Written by Nils Larsch for the OpenSSL project\n */\n/* ====================================================================\n * Copyright (c) 2000-2003 The OpenSSL Project.  All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n *\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer. \n *\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in\n *    the documentation and/or other materials provided with the\n *    distribution.\n *\n * 3. All advertising materials mentioning features or use of this\n *    software must display the following acknowledgment:\n *    \"This product includes software developed by the OpenSSL Project\n *    for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)\"\n *\n * 4. The names \"OpenSSL Toolkit\" and \"OpenSSL Project\" must not be used to\n *    endorse or promote products derived from this software without\n *    prior written permission. For written permission, please contact\n *    licensing@OpenSSL.org.\n *\n * 5. Products derived from this software may not be called \"OpenSSL\"\n *    nor may \"OpenSSL\" appear in their names without prior written\n *    permission of the OpenSSL Project.\n *\n * 6. Redistributions of any form whatsoever must retain the following\n *    acknowledgment:\n *    \"This product includes software developed by the OpenSSL Project\n *    for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)\"\n *\n * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY\n * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\n * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE OpenSSL PROJECT OR\n * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\n * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,\n * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED\n * OF THE POSSIBILITY OF SUCH DAMAGE.\n * ====================================================================\n *\n * This product includes cryptographic software written by Eric Young\n * (eay@cryptsoft.com).  This product includes software written by Tim\n * Hudson (tjh@cryptsoft.com).\n *\n */\n#ifndef HEADER_ECDSA_H\n#define HEADER_ECDSA_H\n\n#include <openssl/opensslconf.h>\n\n#ifdef OPENSSL_NO_ECDSA\n#error ECDSA is disabled.\n#endif\n\n#include <openssl/ec.h>\n#include <openssl/ossl_typ.h>\n#ifndef OPENSSL_NO_DEPRECATED\n#include <openssl/bn.h>\n#endif\n\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\ntypedef struct ECDSA_SIG_st\n\t{\n\tBIGNUM *r;\n\tBIGNUM *s;\n\t} ECDSA_SIG;\n\n/** ECDSA_SIG *ECDSA_SIG_new(void)\n * allocates and initialize a ECDSA_SIG structure\n * \\return pointer to a ECDSA_SIG structure or NULL if an error occurred\n */\nECDSA_SIG *ECDSA_SIG_new(void);\n\n/** ECDSA_SIG_free\n * frees a ECDSA_SIG structure\n * \\param a pointer to the ECDSA_SIG structure\n */\nvoid\t  ECDSA_SIG_free(ECDSA_SIG *a);\n\n/** i2d_ECDSA_SIG\n * DER encode content of ECDSA_SIG object (note: this function modifies *pp\n * (*pp += length of the DER encoded signature)).\n * \\param a  pointer to the ECDSA_SIG object\n * \\param pp pointer to a unsigned char pointer for the output or NULL\n * \\return the length of the DER encoded ECDSA_SIG object or 0 \n */\nint\t  i2d_ECDSA_SIG(const ECDSA_SIG *a, unsigned char **pp);\n\n/** d2i_ECDSA_SIG\n * decodes a DER encoded ECDSA signature (note: this function changes *pp\n * (*pp += len)). \n * \\param v pointer to ECDSA_SIG pointer (may be NULL)\n * \\param pp buffer with the DER encoded signature\n * \\param len bufferlength\n * \\return pointer to the decoded ECDSA_SIG structure (or NULL)\n */\nECDSA_SIG *d2i_ECDSA_SIG(ECDSA_SIG **v, const unsigned char **pp, long len);\n\n/** ECDSA_do_sign\n * computes the ECDSA signature of the given hash value using\n * the supplied private key and returns the created signature.\n * \\param dgst pointer to the hash value\n * \\param dgst_len length of the hash value\n * \\param eckey pointer to the EC_KEY object containing a private EC key\n * \\return pointer to a ECDSA_SIG structure or NULL\n */\nECDSA_SIG *ECDSA_do_sign(const unsigned char *dgst,int dgst_len,EC_KEY *eckey);\n\n/** ECDSA_do_sign_ex\n * computes ECDSA signature of a given hash value using the supplied\n * private key (note: sig must point to ECDSA_size(eckey) bytes of memory).\n * \\param dgst pointer to the hash value to sign\n * \\param dgstlen length of the hash value\n * \\param kinv optional pointer to a pre-computed inverse k\n * \\param rp optional pointer to the pre-computed rp value (see \n *        ECDSA_sign_setup\n * \\param eckey pointer to the EC_KEY object containing a private EC key\n * \\return pointer to a ECDSA_SIG structure or NULL\n */\nECDSA_SIG *ECDSA_do_sign_ex(const unsigned char *dgst, int dgstlen, \n\t\tconst BIGNUM *kinv, const BIGNUM *rp, EC_KEY *eckey);\n\n/** ECDSA_do_verify\n * verifies that the supplied signature is a valid ECDSA\n * signature of the supplied hash value using the supplied public key.\n * \\param dgst pointer to the hash value\n * \\param dgst_len length of the hash value\n * \\param sig  pointer to the ECDSA_SIG structure\n * \\param eckey pointer to the EC_KEY object containing a public EC key\n * \\return 1 if the signature is valid, 0 if the signature is invalid and -1 on error\n */\nint\t  ECDSA_do_verify(const unsigned char *dgst, int dgst_len,\n\t\tconst ECDSA_SIG *sig, EC_KEY* eckey);\n\nconst ECDSA_METHOD *ECDSA_OpenSSL(void);\n\n/** ECDSA_set_default_method\n * sets the default ECDSA method\n * \\param meth the new default ECDSA_METHOD\n */\nvoid\t  ECDSA_set_default_method(const ECDSA_METHOD *meth);\n\n/** ECDSA_get_default_method\n * returns the default ECDSA method\n * \\return pointer to ECDSA_METHOD structure containing the default method\n */\nconst ECDSA_METHOD *ECDSA_get_default_method(void);\n\n/** ECDSA_set_method\n * sets method to be used for the ECDSA operations\n * \\param eckey pointer to the EC_KEY object\n * \\param meth  pointer to the new method\n * \\return 1 on success and 0 otherwise \n */\nint \t  ECDSA_set_method(EC_KEY *eckey, const ECDSA_METHOD *meth);\n\n/** ECDSA_size\n * returns the maximum length of the DER encoded signature\n * \\param  eckey pointer to a EC_KEY object\n * \\return numbers of bytes required for the DER encoded signature\n */\nint\t  ECDSA_size(const EC_KEY *eckey);\n\n/** ECDSA_sign_setup\n * precompute parts of the signing operation. \n * \\param eckey pointer to the EC_KEY object containing a private EC key\n * \\param ctx  pointer to a BN_CTX object (may be NULL)\n * \\param kinv pointer to a BIGNUM pointer for the inverse of k\n * \\param rp   pointer to a BIGNUM pointer for x coordinate of k * generator\n * \\return 1 on success and 0 otherwise\n */\nint \t  ECDSA_sign_setup(EC_KEY *eckey, BN_CTX *ctx, BIGNUM **kinv, \n\t\tBIGNUM **rp);\n\n/** ECDSA_sign\n * computes ECDSA signature of a given hash value using the supplied\n * private key (note: sig must point to ECDSA_size(eckey) bytes of memory).\n * \\param type this parameter is ignored\n * \\param dgst pointer to the hash value to sign\n * \\param dgstlen length of the hash value\n * \\param sig buffer to hold the DER encoded signature\n * \\param siglen pointer to the length of the returned signature\n * \\param eckey pointer to the EC_KEY object containing a private EC key\n * \\return 1 on success and 0 otherwise\n */\nint\t  ECDSA_sign(int type, const unsigned char *dgst, int dgstlen, \n\t\tunsigned char *sig, unsigned int *siglen, EC_KEY *eckey);\n\n\n/** ECDSA_sign_ex\n * computes ECDSA signature of a given hash value using the supplied\n * private key (note: sig must point to ECDSA_size(eckey) bytes of memory).\n * \\param type this parameter is ignored\n * \\param dgst pointer to the hash value to sign\n * \\param dgstlen length of the hash value\n * \\param sig buffer to hold the DER encoded signature\n * \\param siglen pointer to the length of the returned signature\n * \\param kinv optional pointer to a pre-computed inverse k\n * \\param rp optional pointer to the pre-computed rp value (see \n *        ECDSA_sign_setup\n * \\param eckey pointer to the EC_KEY object containing a private EC key\n * \\return 1 on success and 0 otherwise\n */\nint\t  ECDSA_sign_ex(int type, const unsigned char *dgst, int dgstlen, \n\t\tunsigned char *sig, unsigned int *siglen, const BIGNUM *kinv,\n\t\tconst BIGNUM *rp, EC_KEY *eckey);\n\n/** ECDSA_verify\n * verifies that the given signature is valid ECDSA signature\n * of the supplied hash value using the specified public key.\n * \\param type this parameter is ignored\n * \\param dgst pointer to the hash value \n * \\param dgstlen length of the hash value\n * \\param sig  pointer to the DER encoded signature\n * \\param siglen length of the DER encoded signature\n * \\param eckey pointer to the EC_KEY object containing a public EC key\n * \\return 1 if the signature is valid, 0 if the signature is invalid and -1 on error\n */\nint \t  ECDSA_verify(int type, const unsigned char *dgst, int dgstlen, \n\t\tconst unsigned char *sig, int siglen, EC_KEY *eckey);\n\n/* the standard ex_data functions */\nint \t  ECDSA_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new \n\t\t*new_func, CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func);\nint \t  ECDSA_set_ex_data(EC_KEY *d, int idx, void *arg);\nvoid \t  *ECDSA_get_ex_data(EC_KEY *d, int idx);\n\n\n/* BEGIN ERROR CODES */\n/* The following lines are auto generated by the script mkerr.pl. Any changes\n * made after this point may be overwritten when the script is next run.\n */\nvoid ERR_load_ECDSA_strings(void);\n\n/* Error codes for the ECDSA functions. */\n\n/* Function codes. */\n#define ECDSA_F_ECDSA_DATA_NEW_METHOD\t\t\t 100\n#define ECDSA_F_ECDSA_DO_SIGN\t\t\t\t 101\n#define ECDSA_F_ECDSA_DO_VERIFY\t\t\t\t 102\n#define ECDSA_F_ECDSA_SIGN_SETUP\t\t\t 103\n\n/* Reason codes. */\n#define ECDSA_R_BAD_SIGNATURE\t\t\t\t 100\n#define ECDSA_R_DATA_TOO_LARGE_FOR_KEY_SIZE\t\t 101\n#define ECDSA_R_ERR_EC_LIB\t\t\t\t 102\n#define ECDSA_R_MISSING_PARAMETERS\t\t\t 103\n#define ECDSA_R_NEED_NEW_SETUP_VALUES\t\t\t 106\n#define ECDSA_R_RANDOM_NUMBER_GENERATION_FAILED\t\t 104\n#define ECDSA_R_SIGNATURE_MALLOC_FAILED\t\t\t 105\n\n#ifdef  __cplusplus\n}\n#endif\n#endif\n"
  },
  {
    "path": "freebsd-headers/openssl/engine.h",
    "content": "/* openssl/engine.h */\n/* Written by Geoff Thorpe (geoff@geoffthorpe.net) for the OpenSSL\n * project 2000.\n */\n/* ====================================================================\n * Copyright (c) 1999-2004 The OpenSSL Project.  All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n *\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer. \n *\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in\n *    the documentation and/or other materials provided with the\n *    distribution.\n *\n * 3. All advertising materials mentioning features or use of this\n *    software must display the following acknowledgment:\n *    \"This product includes software developed by the OpenSSL Project\n *    for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)\"\n *\n * 4. The names \"OpenSSL Toolkit\" and \"OpenSSL Project\" must not be used to\n *    endorse or promote products derived from this software without\n *    prior written permission. For written permission, please contact\n *    licensing@OpenSSL.org.\n *\n * 5. Products derived from this software may not be called \"OpenSSL\"\n *    nor may \"OpenSSL\" appear in their names without prior written\n *    permission of the OpenSSL Project.\n *\n * 6. Redistributions of any form whatsoever must retain the following\n *    acknowledgment:\n *    \"This product includes software developed by the OpenSSL Project\n *    for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)\"\n *\n * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY\n * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\n * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE OpenSSL PROJECT OR\n * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\n * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,\n * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED\n * OF THE POSSIBILITY OF SUCH DAMAGE.\n * ====================================================================\n *\n * This product includes cryptographic software written by Eric Young\n * (eay@cryptsoft.com).  This product includes software written by Tim\n * Hudson (tjh@cryptsoft.com).\n *\n */\n/* ====================================================================\n * Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED.\n * ECDH support in OpenSSL originally developed by \n * SUN MICROSYSTEMS, INC., and contributed to the OpenSSL project.\n */\n\n#ifndef HEADER_ENGINE_H\n#define HEADER_ENGINE_H\n\n#include <openssl/opensslconf.h>\n\n#ifdef OPENSSL_NO_ENGINE\n#error ENGINE is disabled.\n#endif\n\n#ifndef OPENSSL_NO_DEPRECATED\n#include <openssl/bn.h>\n#ifndef OPENSSL_NO_RSA\n#include <openssl/rsa.h>\n#endif\n#ifndef OPENSSL_NO_DSA\n#include <openssl/dsa.h>\n#endif\n#ifndef OPENSSL_NO_DH\n#include <openssl/dh.h>\n#endif\n#ifndef OPENSSL_NO_ECDH\n#include <openssl/ecdh.h>\n#endif\n#ifndef OPENSSL_NO_ECDSA\n#include <openssl/ecdsa.h>\n#endif\n#include <openssl/rand.h>\n#include <openssl/store.h>\n#include <openssl/ui.h>\n#include <openssl/err.h>\n#endif\n\n#include <openssl/x509.h>\n\n#include <openssl/ossl_typ.h>\n#include <openssl/symhacks.h>\n\n#ifdef  __cplusplus\nextern \"C\" {\n#endif\n\n/* These flags are used to control combinations of algorithm (methods)\n * by bitwise \"OR\"ing. */\n#define ENGINE_METHOD_RSA\t\t(unsigned int)0x0001\n#define ENGINE_METHOD_DSA\t\t(unsigned int)0x0002\n#define ENGINE_METHOD_DH\t\t(unsigned int)0x0004\n#define ENGINE_METHOD_RAND\t\t(unsigned int)0x0008\n#define ENGINE_METHOD_ECDH\t\t(unsigned int)0x0010\n#define ENGINE_METHOD_ECDSA\t\t(unsigned int)0x0020\n#define ENGINE_METHOD_CIPHERS\t\t(unsigned int)0x0040\n#define ENGINE_METHOD_DIGESTS\t\t(unsigned int)0x0080\n#define ENGINE_METHOD_STORE\t\t(unsigned int)0x0100\n/* Obvious all-or-nothing cases. */\n#define ENGINE_METHOD_ALL\t\t(unsigned int)0xFFFF\n#define ENGINE_METHOD_NONE\t\t(unsigned int)0x0000\n\n/* This(ese) flag(s) controls behaviour of the ENGINE_TABLE mechanism used\n * internally to control registration of ENGINE implementations, and can be set\n * by ENGINE_set_table_flags(). The \"NOINIT\" flag prevents attempts to\n * initialise registered ENGINEs if they are not already initialised. */\n#define ENGINE_TABLE_FLAG_NOINIT\t(unsigned int)0x0001\n\n/* ENGINE flags that can be set by ENGINE_set_flags(). */\n/* #define ENGINE_FLAGS_MALLOCED\t0x0001 */ /* Not used */\n\n/* This flag is for ENGINEs that wish to handle the various 'CMD'-related\n * control commands on their own. Without this flag, ENGINE_ctrl() handles these\n * control commands on behalf of the ENGINE using their \"cmd_defns\" data. */\n#define ENGINE_FLAGS_MANUAL_CMD_CTRL\t(int)0x0002\n\n/* This flag is for ENGINEs who return new duplicate structures when found via\n * \"ENGINE_by_id()\". When an ENGINE must store state (eg. if ENGINE_ctrl()\n * commands are called in sequence as part of some stateful process like\n * key-generation setup and execution), it can set this flag - then each attempt\n * to obtain the ENGINE will result in it being copied into a new structure.\n * Normally, ENGINEs don't declare this flag so ENGINE_by_id() just increments\n * the existing ENGINE's structural reference count. */\n#define ENGINE_FLAGS_BY_ID_COPY\t\t(int)0x0004\n\n/* ENGINEs can support their own command types, and these flags are used in\n * ENGINE_CTRL_GET_CMD_FLAGS to indicate to the caller what kind of input each\n * command expects. Currently only numeric and string input is supported. If a\n * control command supports none of the _NUMERIC, _STRING, or _NO_INPUT options,\n * then it is regarded as an \"internal\" control command - and not for use in\n * config setting situations. As such, they're not available to the\n * ENGINE_ctrl_cmd_string() function, only raw ENGINE_ctrl() access. Changes to\n * this list of 'command types' should be reflected carefully in\n * ENGINE_cmd_is_executable() and ENGINE_ctrl_cmd_string(). */\n\n/* accepts a 'long' input value (3rd parameter to ENGINE_ctrl) */\n#define ENGINE_CMD_FLAG_NUMERIC\t\t(unsigned int)0x0001\n/* accepts string input (cast from 'void*' to 'const char *', 4th parameter to\n * ENGINE_ctrl) */\n#define ENGINE_CMD_FLAG_STRING\t\t(unsigned int)0x0002\n/* Indicates that the control command takes *no* input. Ie. the control command\n * is unparameterised. */\n#define ENGINE_CMD_FLAG_NO_INPUT\t(unsigned int)0x0004\n/* Indicates that the control command is internal. This control command won't\n * be shown in any output, and is only usable through the ENGINE_ctrl_cmd()\n * function. */\n#define ENGINE_CMD_FLAG_INTERNAL\t(unsigned int)0x0008\n\n/* NB: These 3 control commands are deprecated and should not be used. ENGINEs\n * relying on these commands should compile conditional support for\n * compatibility (eg. if these symbols are defined) but should also migrate the\n * same functionality to their own ENGINE-specific control functions that can be\n * \"discovered\" by calling applications. The fact these control commands\n * wouldn't be \"executable\" (ie. usable by text-based config) doesn't change the\n * fact that application code can find and use them without requiring per-ENGINE\n * hacking. */\n\n/* These flags are used to tell the ctrl function what should be done.\n * All command numbers are shared between all engines, even if some don't\n * make sense to some engines.  In such a case, they do nothing but return\n * the error ENGINE_R_CTRL_COMMAND_NOT_IMPLEMENTED. */\n#define ENGINE_CTRL_SET_LOGSTREAM\t\t1\n#define ENGINE_CTRL_SET_PASSWORD_CALLBACK\t2\n#define ENGINE_CTRL_HUP\t\t\t\t3 /* Close and reinitialise any\n\t\t\t\t\t\t     handles/connections etc. */\n#define ENGINE_CTRL_SET_USER_INTERFACE          4 /* Alternative to callback */\n#define ENGINE_CTRL_SET_CALLBACK_DATA           5 /* User-specific data, used\n\t\t\t\t\t\t     when calling the password\n\t\t\t\t\t\t     callback and the user\n\t\t\t\t\t\t     interface */\n#define ENGINE_CTRL_LOAD_CONFIGURATION\t\t6 /* Load a configuration, given\n\t\t\t\t\t\t     a string that represents a\n\t\t\t\t\t\t     file name or so */\n#define ENGINE_CTRL_LOAD_SECTION\t\t7 /* Load data from a given\n\t\t\t\t\t\t     section in the already loaded\n\t\t\t\t\t\t     configuration */\n\n/* These control commands allow an application to deal with an arbitrary engine\n * in a dynamic way. Warn: Negative return values indicate errors FOR THESE\n * COMMANDS because zero is used to indicate 'end-of-list'. Other commands,\n * including ENGINE-specific command types, return zero for an error.\n *\n * An ENGINE can choose to implement these ctrl functions, and can internally\n * manage things however it chooses - it does so by setting the\n * ENGINE_FLAGS_MANUAL_CMD_CTRL flag (using ENGINE_set_flags()). Otherwise the\n * ENGINE_ctrl() code handles this on the ENGINE's behalf using the cmd_defns\n * data (set using ENGINE_set_cmd_defns()). This means an ENGINE's ctrl()\n * handler need only implement its own commands - the above \"meta\" commands will\n * be taken care of. */\n\n/* Returns non-zero if the supplied ENGINE has a ctrl() handler. If \"not\", then\n * all the remaining control commands will return failure, so it is worth\n * checking this first if the caller is trying to \"discover\" the engine's\n * capabilities and doesn't want errors generated unnecessarily. */\n#define ENGINE_CTRL_HAS_CTRL_FUNCTION\t\t10\n/* Returns a positive command number for the first command supported by the\n * engine. Returns zero if no ctrl commands are supported. */\n#define ENGINE_CTRL_GET_FIRST_CMD_TYPE\t\t11\n/* The 'long' argument specifies a command implemented by the engine, and the\n * return value is the next command supported, or zero if there are no more. */\n#define ENGINE_CTRL_GET_NEXT_CMD_TYPE\t\t12\n/* The 'void*' argument is a command name (cast from 'const char *'), and the\n * return value is the command that corresponds to it. */\n#define ENGINE_CTRL_GET_CMD_FROM_NAME\t\t13\n/* The next two allow a command to be converted into its corresponding string\n * form. In each case, the 'long' argument supplies the command. In the NAME_LEN\n * case, the return value is the length of the command name (not counting a\n * trailing EOL). In the NAME case, the 'void*' argument must be a string buffer\n * large enough, and it will be populated with the name of the command (WITH a\n * trailing EOL). */\n#define ENGINE_CTRL_GET_NAME_LEN_FROM_CMD\t14\n#define ENGINE_CTRL_GET_NAME_FROM_CMD\t\t15\n/* The next two are similar but give a \"short description\" of a command. */\n#define ENGINE_CTRL_GET_DESC_LEN_FROM_CMD\t16\n#define ENGINE_CTRL_GET_DESC_FROM_CMD\t\t17\n/* With this command, the return value is the OR'd combination of\n * ENGINE_CMD_FLAG_*** values that indicate what kind of input a given\n * engine-specific ctrl command expects. */\n#define ENGINE_CTRL_GET_CMD_FLAGS\t\t18\n\n/* ENGINE implementations should start the numbering of their own control\n * commands from this value. (ie. ENGINE_CMD_BASE, ENGINE_CMD_BASE + 1, etc). */\n#define ENGINE_CMD_BASE\t\t\t\t200\n\n/* NB: These 2 nCipher \"chil\" control commands are deprecated, and their\n * functionality is now available through ENGINE-specific control commands\n * (exposed through the above-mentioned 'CMD'-handling). Code using these 2\n * commands should be migrated to the more general command handling before these\n * are removed. */\n\n/* Flags specific to the nCipher \"chil\" engine */\n#define ENGINE_CTRL_CHIL_SET_FORKCHECK\t\t100\n\t/* Depending on the value of the (long)i argument, this sets or\n\t * unsets the SimpleForkCheck flag in the CHIL API to enable or\n\t * disable checking and workarounds for applications that fork().\n\t */\n#define ENGINE_CTRL_CHIL_NO_LOCKING\t\t101\n\t/* This prevents the initialisation function from providing mutex\n\t * callbacks to the nCipher library. */\n\n/* If an ENGINE supports its own specific control commands and wishes the\n * framework to handle the above 'ENGINE_CMD_***'-manipulation commands on its\n * behalf, it should supply a null-terminated array of ENGINE_CMD_DEFN entries\n * to ENGINE_set_cmd_defns(). It should also implement a ctrl() handler that\n * supports the stated commands (ie. the \"cmd_num\" entries as described by the\n * array). NB: The array must be ordered in increasing order of cmd_num.\n * \"null-terminated\" means that the last ENGINE_CMD_DEFN element has cmd_num set\n * to zero and/or cmd_name set to NULL. */\ntypedef struct ENGINE_CMD_DEFN_st\n\t{\n\tunsigned int cmd_num; /* The command number */\n\tconst char *cmd_name; /* The command name itself */\n\tconst char *cmd_desc; /* A short description of the command */\n\tunsigned int cmd_flags; /* The input the command expects */\n\t} ENGINE_CMD_DEFN;\n\n/* Generic function pointer */\ntypedef int (*ENGINE_GEN_FUNC_PTR)(void);\n/* Generic function pointer taking no arguments */\ntypedef int (*ENGINE_GEN_INT_FUNC_PTR)(ENGINE *);\n/* Specific control function pointer */\ntypedef int (*ENGINE_CTRL_FUNC_PTR)(ENGINE *, int, long, void *, void (*f)(void));\n/* Generic load_key function pointer */\ntypedef EVP_PKEY * (*ENGINE_LOAD_KEY_PTR)(ENGINE *, const char *,\n\tUI_METHOD *ui_method, void *callback_data);\ntypedef int (*ENGINE_SSL_CLIENT_CERT_PTR)(ENGINE *, SSL *ssl,\n\tSTACK_OF(X509_NAME) *ca_dn, X509 **pcert, EVP_PKEY **pkey,\n\tSTACK_OF(X509) **pother, UI_METHOD *ui_method, void *callback_data);\n/* These callback types are for an ENGINE's handler for cipher and digest logic.\n * These handlers have these prototypes;\n *   int foo(ENGINE *e, const EVP_CIPHER **cipher, const int **nids, int nid);\n *   int foo(ENGINE *e, const EVP_MD **digest, const int **nids, int nid);\n * Looking at how to implement these handlers in the case of cipher support, if\n * the framework wants the EVP_CIPHER for 'nid', it will call;\n *   foo(e, &p_evp_cipher, NULL, nid);    (return zero for failure)\n * If the framework wants a list of supported 'nid's, it will call;\n *   foo(e, NULL, &p_nids, 0); (returns number of 'nids' or -1 for error)\n */\n/* Returns to a pointer to the array of supported cipher 'nid's. If the second\n * parameter is non-NULL it is set to the size of the returned array. */\ntypedef int (*ENGINE_CIPHERS_PTR)(ENGINE *, const EVP_CIPHER **, const int **, int);\ntypedef int (*ENGINE_DIGESTS_PTR)(ENGINE *, const EVP_MD **, const int **, int);\n\n/* STRUCTURE functions ... all of these functions deal with pointers to ENGINE\n * structures where the pointers have a \"structural reference\". This means that\n * their reference is to allowed access to the structure but it does not imply\n * that the structure is functional. To simply increment or decrement the\n * structural reference count, use ENGINE_by_id and ENGINE_free. NB: This is not\n * required when iterating using ENGINE_get_next as it will automatically\n * decrement the structural reference count of the \"current\" ENGINE and\n * increment the structural reference count of the ENGINE it returns (unless it\n * is NULL). */\n\n/* Get the first/last \"ENGINE\" type available. */\nENGINE *ENGINE_get_first(void);\nENGINE *ENGINE_get_last(void);\n/* Iterate to the next/previous \"ENGINE\" type (NULL = end of the list). */\nENGINE *ENGINE_get_next(ENGINE *e);\nENGINE *ENGINE_get_prev(ENGINE *e);\n/* Add another \"ENGINE\" type into the array. */\nint ENGINE_add(ENGINE *e);\n/* Remove an existing \"ENGINE\" type from the array. */\nint ENGINE_remove(ENGINE *e);\n/* Retrieve an engine from the list by its unique \"id\" value. */\nENGINE *ENGINE_by_id(const char *id);\n/* Add all the built-in engines. */\nvoid ENGINE_load_openssl(void);\nvoid ENGINE_load_dynamic(void);\n#ifndef OPENSSL_NO_STATIC_ENGINE\nvoid ENGINE_load_4758cca(void);\nvoid ENGINE_load_aep(void);\nvoid ENGINE_load_atalla(void);\nvoid ENGINE_load_chil(void);\nvoid ENGINE_load_cswift(void);\n#ifndef OPENSSL_NO_GMP\nvoid ENGINE_load_gmp(void);\n#endif\nvoid ENGINE_load_nuron(void);\nvoid ENGINE_load_sureware(void);\nvoid ENGINE_load_ubsec(void);\n#endif\nvoid ENGINE_load_cryptodev(void);\nvoid ENGINE_load_padlock(void);\nvoid ENGINE_load_builtin_engines(void);\n#ifdef OPENSSL_SYS_WIN32\n#ifndef OPENSSL_NO_CAPIENG\nvoid ENGINE_load_capi(void);\n#endif\n#endif\n\n/* Get and set global flags (ENGINE_TABLE_FLAG_***) for the implementation\n * \"registry\" handling. */\nunsigned int ENGINE_get_table_flags(void);\nvoid ENGINE_set_table_flags(unsigned int flags);\n\n/* Manage registration of ENGINEs per \"table\". For each type, there are 3\n * functions;\n *   ENGINE_register_***(e) - registers the implementation from 'e' (if it has one)\n *   ENGINE_unregister_***(e) - unregister the implementation from 'e'\n *   ENGINE_register_all_***() - call ENGINE_register_***() for each 'e' in the list\n * Cleanup is automatically registered from each table when required, so\n * ENGINE_cleanup() will reverse any \"register\" operations. */\n\nint ENGINE_register_RSA(ENGINE *e);\nvoid ENGINE_unregister_RSA(ENGINE *e);\nvoid ENGINE_register_all_RSA(void);\n\nint ENGINE_register_DSA(ENGINE *e);\nvoid ENGINE_unregister_DSA(ENGINE *e);\nvoid ENGINE_register_all_DSA(void);\n\nint ENGINE_register_ECDH(ENGINE *e);\nvoid ENGINE_unregister_ECDH(ENGINE *e);\nvoid ENGINE_register_all_ECDH(void);\n\nint ENGINE_register_ECDSA(ENGINE *e);\nvoid ENGINE_unregister_ECDSA(ENGINE *e);\nvoid ENGINE_register_all_ECDSA(void);\n\nint ENGINE_register_DH(ENGINE *e);\nvoid ENGINE_unregister_DH(ENGINE *e);\nvoid ENGINE_register_all_DH(void);\n\nint ENGINE_register_RAND(ENGINE *e);\nvoid ENGINE_unregister_RAND(ENGINE *e);\nvoid ENGINE_register_all_RAND(void);\n\nint ENGINE_register_STORE(ENGINE *e);\nvoid ENGINE_unregister_STORE(ENGINE *e);\nvoid ENGINE_register_all_STORE(void);\n\nint ENGINE_register_ciphers(ENGINE *e);\nvoid ENGINE_unregister_ciphers(ENGINE *e);\nvoid ENGINE_register_all_ciphers(void);\n\nint ENGINE_register_digests(ENGINE *e);\nvoid ENGINE_unregister_digests(ENGINE *e);\nvoid ENGINE_register_all_digests(void);\n\n/* These functions register all support from the above categories. Note, use of\n * these functions can result in static linkage of code your application may not\n * need. If you only need a subset of functionality, consider using more\n * selective initialisation. */\nint ENGINE_register_complete(ENGINE *e);\nint ENGINE_register_all_complete(void);\n\n/* Send parametrised control commands to the engine. The possibilities to send\n * down an integer, a pointer to data or a function pointer are provided. Any of\n * the parameters may or may not be NULL, depending on the command number. In\n * actuality, this function only requires a structural (rather than functional)\n * reference to an engine, but many control commands may require the engine be\n * functional. The caller should be aware of trying commands that require an\n * operational ENGINE, and only use functional references in such situations. */\nint ENGINE_ctrl(ENGINE *e, int cmd, long i, void *p, void (*f)(void));\n\n/* This function tests if an ENGINE-specific command is usable as a \"setting\".\n * Eg. in an application's config file that gets processed through\n * ENGINE_ctrl_cmd_string(). If this returns zero, it is not available to\n * ENGINE_ctrl_cmd_string(), only ENGINE_ctrl(). */\nint ENGINE_cmd_is_executable(ENGINE *e, int cmd);\n\n/* This function works like ENGINE_ctrl() with the exception of taking a\n * command name instead of a command number, and can handle optional commands.\n * See the comment on ENGINE_ctrl_cmd_string() for an explanation on how to\n * use the cmd_name and cmd_optional. */\nint ENGINE_ctrl_cmd(ENGINE *e, const char *cmd_name,\n        long i, void *p, void (*f)(void), int cmd_optional);\n\n/* This function passes a command-name and argument to an ENGINE. The cmd_name\n * is converted to a command number and the control command is called using\n * 'arg' as an argument (unless the ENGINE doesn't support such a command, in\n * which case no control command is called). The command is checked for input\n * flags, and if necessary the argument will be converted to a numeric value. If\n * cmd_optional is non-zero, then if the ENGINE doesn't support the given\n * cmd_name the return value will be success anyway. This function is intended\n * for applications to use so that users (or config files) can supply\n * engine-specific config data to the ENGINE at run-time to control behaviour of\n * specific engines. As such, it shouldn't be used for calling ENGINE_ctrl()\n * functions that return data, deal with binary data, or that are otherwise\n * supposed to be used directly through ENGINE_ctrl() in application code. Any\n * \"return\" data from an ENGINE_ctrl() operation in this function will be lost -\n * the return value is interpreted as failure if the return value is zero,\n * success otherwise, and this function returns a boolean value as a result. In\n * other words, vendors of 'ENGINE'-enabled devices should write ENGINE\n * implementations with parameterisations that work in this scheme, so that\n * compliant ENGINE-based applications can work consistently with the same\n * configuration for the same ENGINE-enabled devices, across applications. */\nint ENGINE_ctrl_cmd_string(ENGINE *e, const char *cmd_name, const char *arg,\n\t\t\t\tint cmd_optional);\n\n/* These functions are useful for manufacturing new ENGINE structures. They\n * don't address reference counting at all - one uses them to populate an ENGINE\n * structure with personalised implementations of things prior to using it\n * directly or adding it to the builtin ENGINE list in OpenSSL. These are also\n * here so that the ENGINE structure doesn't have to be exposed and break binary\n * compatibility! */\nENGINE *ENGINE_new(void);\nint ENGINE_free(ENGINE *e);\nint ENGINE_up_ref(ENGINE *e);\nint ENGINE_set_id(ENGINE *e, const char *id);\nint ENGINE_set_name(ENGINE *e, const char *name);\nint ENGINE_set_RSA(ENGINE *e, const RSA_METHOD *rsa_meth);\nint ENGINE_set_DSA(ENGINE *e, const DSA_METHOD *dsa_meth);\nint ENGINE_set_ECDH(ENGINE *e, const ECDH_METHOD *ecdh_meth);\nint ENGINE_set_ECDSA(ENGINE *e, const ECDSA_METHOD *ecdsa_meth);\nint ENGINE_set_DH(ENGINE *e, const DH_METHOD *dh_meth);\nint ENGINE_set_RAND(ENGINE *e, const RAND_METHOD *rand_meth);\nint ENGINE_set_STORE(ENGINE *e, const STORE_METHOD *store_meth);\nint ENGINE_set_destroy_function(ENGINE *e, ENGINE_GEN_INT_FUNC_PTR destroy_f);\nint ENGINE_set_init_function(ENGINE *e, ENGINE_GEN_INT_FUNC_PTR init_f);\nint ENGINE_set_finish_function(ENGINE *e, ENGINE_GEN_INT_FUNC_PTR finish_f);\nint ENGINE_set_ctrl_function(ENGINE *e, ENGINE_CTRL_FUNC_PTR ctrl_f);\nint ENGINE_set_load_privkey_function(ENGINE *e, ENGINE_LOAD_KEY_PTR loadpriv_f);\nint ENGINE_set_load_pubkey_function(ENGINE *e, ENGINE_LOAD_KEY_PTR loadpub_f);\nint ENGINE_set_load_ssl_client_cert_function(ENGINE *e,\n\t\t\t\tENGINE_SSL_CLIENT_CERT_PTR loadssl_f);\nint ENGINE_set_ciphers(ENGINE *e, ENGINE_CIPHERS_PTR f);\nint ENGINE_set_digests(ENGINE *e, ENGINE_DIGESTS_PTR f);\nint ENGINE_set_flags(ENGINE *e, int flags);\nint ENGINE_set_cmd_defns(ENGINE *e, const ENGINE_CMD_DEFN *defns);\n/* These functions allow control over any per-structure ENGINE data. */\nint ENGINE_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func,\n\t\tCRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func);\nint ENGINE_set_ex_data(ENGINE *e, int idx, void *arg);\nvoid *ENGINE_get_ex_data(const ENGINE *e, int idx);\n\n/* This function cleans up anything that needs it. Eg. the ENGINE_add() function\n * automatically ensures the list cleanup function is registered to be called\n * from ENGINE_cleanup(). Similarly, all ENGINE_register_*** functions ensure\n * ENGINE_cleanup() will clean up after them. */\nvoid ENGINE_cleanup(void);\n\n/* These return values from within the ENGINE structure. These can be useful\n * with functional references as well as structural references - it depends\n * which you obtained. Using the result for functional purposes if you only\n * obtained a structural reference may be problematic! */\nconst char *ENGINE_get_id(const ENGINE *e);\nconst char *ENGINE_get_name(const ENGINE *e);\nconst RSA_METHOD *ENGINE_get_RSA(const ENGINE *e);\nconst DSA_METHOD *ENGINE_get_DSA(const ENGINE *e);\nconst ECDH_METHOD *ENGINE_get_ECDH(const ENGINE *e);\nconst ECDSA_METHOD *ENGINE_get_ECDSA(const ENGINE *e);\nconst DH_METHOD *ENGINE_get_DH(const ENGINE *e);\nconst RAND_METHOD *ENGINE_get_RAND(const ENGINE *e);\nconst STORE_METHOD *ENGINE_get_STORE(const ENGINE *e);\nENGINE_GEN_INT_FUNC_PTR ENGINE_get_destroy_function(const ENGINE *e);\nENGINE_GEN_INT_FUNC_PTR ENGINE_get_init_function(const ENGINE *e);\nENGINE_GEN_INT_FUNC_PTR ENGINE_get_finish_function(const ENGINE *e);\nENGINE_CTRL_FUNC_PTR ENGINE_get_ctrl_function(const ENGINE *e);\nENGINE_LOAD_KEY_PTR ENGINE_get_load_privkey_function(const ENGINE *e);\nENGINE_LOAD_KEY_PTR ENGINE_get_load_pubkey_function(const ENGINE *e);\nENGINE_SSL_CLIENT_CERT_PTR ENGINE_get_ssl_client_cert_function(const ENGINE *e);\nENGINE_CIPHERS_PTR ENGINE_get_ciphers(const ENGINE *e);\nENGINE_DIGESTS_PTR ENGINE_get_digests(const ENGINE *e);\nconst EVP_CIPHER *ENGINE_get_cipher(ENGINE *e, int nid);\nconst EVP_MD *ENGINE_get_digest(ENGINE *e, int nid);\nconst ENGINE_CMD_DEFN *ENGINE_get_cmd_defns(const ENGINE *e);\nint ENGINE_get_flags(const ENGINE *e);\n\n/* FUNCTIONAL functions. These functions deal with ENGINE structures\n * that have (or will) be initialised for use. Broadly speaking, the\n * structural functions are useful for iterating the list of available\n * engine types, creating new engine types, and other \"list\" operations.\n * These functions actually deal with ENGINEs that are to be used. As\n * such these functions can fail (if applicable) when particular\n * engines are unavailable - eg. if a hardware accelerator is not\n * attached or not functioning correctly. Each ENGINE has 2 reference\n * counts; structural and functional. Every time a functional reference\n * is obtained or released, a corresponding structural reference is\n * automatically obtained or released too. */\n\n/* Initialise a engine type for use (or up its reference count if it's\n * already in use). This will fail if the engine is not currently\n * operational and cannot initialise. */\nint ENGINE_init(ENGINE *e);\n/* Free a functional reference to a engine type. This does not require\n * a corresponding call to ENGINE_free as it also releases a structural\n * reference. */\nint ENGINE_finish(ENGINE *e);\n\n/* The following functions handle keys that are stored in some secondary\n * location, handled by the engine.  The storage may be on a card or\n * whatever. */\nEVP_PKEY *ENGINE_load_private_key(ENGINE *e, const char *key_id,\n\tUI_METHOD *ui_method, void *callback_data);\nEVP_PKEY *ENGINE_load_public_key(ENGINE *e, const char *key_id,\n\tUI_METHOD *ui_method, void *callback_data);\nint ENGINE_load_ssl_client_cert(ENGINE *e, SSL *s,\n\tSTACK_OF(X509_NAME) *ca_dn, X509 **pcert, EVP_PKEY **ppkey,\n\tSTACK_OF(X509) **pother,\n\tUI_METHOD *ui_method, void *callback_data);\n\n/* This returns a pointer for the current ENGINE structure that\n * is (by default) performing any RSA operations. The value returned\n * is an incremented reference, so it should be free'd (ENGINE_finish)\n * before it is discarded. */\nENGINE *ENGINE_get_default_RSA(void);\n/* Same for the other \"methods\" */\nENGINE *ENGINE_get_default_DSA(void);\nENGINE *ENGINE_get_default_ECDH(void);\nENGINE *ENGINE_get_default_ECDSA(void);\nENGINE *ENGINE_get_default_DH(void);\nENGINE *ENGINE_get_default_RAND(void);\n/* These functions can be used to get a functional reference to perform\n * ciphering or digesting corresponding to \"nid\". */\nENGINE *ENGINE_get_cipher_engine(int nid);\nENGINE *ENGINE_get_digest_engine(int nid);\n\n/* This sets a new default ENGINE structure for performing RSA\n * operations. If the result is non-zero (success) then the ENGINE\n * structure will have had its reference count up'd so the caller\n * should still free their own reference 'e'. */\nint ENGINE_set_default_RSA(ENGINE *e);\nint ENGINE_set_default_string(ENGINE *e, const char *def_list);\n/* Same for the other \"methods\" */\nint ENGINE_set_default_DSA(ENGINE *e);\nint ENGINE_set_default_ECDH(ENGINE *e);\nint ENGINE_set_default_ECDSA(ENGINE *e);\nint ENGINE_set_default_DH(ENGINE *e);\nint ENGINE_set_default_RAND(ENGINE *e);\nint ENGINE_set_default_ciphers(ENGINE *e);\nint ENGINE_set_default_digests(ENGINE *e);\n\n/* The combination \"set\" - the flags are bitwise \"OR\"d from the\n * ENGINE_METHOD_*** defines above. As with the \"ENGINE_register_complete()\"\n * function, this function can result in unnecessary static linkage. If your\n * application requires only specific functionality, consider using more\n * selective functions. */\nint ENGINE_set_default(ENGINE *e, unsigned int flags);\n\nvoid ENGINE_add_conf_module(void);\n\n/* Deprecated functions ... */\n/* int ENGINE_clear_defaults(void); */\n\n/**************************/\n/* DYNAMIC ENGINE SUPPORT */\n/**************************/\n\n/* Binary/behaviour compatibility levels */\n#define OSSL_DYNAMIC_VERSION\t\t(unsigned long)0x00020000\n/* Binary versions older than this are too old for us (whether we're a loader or\n * a loadee) */\n#define OSSL_DYNAMIC_OLDEST\t\t(unsigned long)0x00020000\n\n/* When compiling an ENGINE entirely as an external shared library, loadable by\n * the \"dynamic\" ENGINE, these types are needed. The 'dynamic_fns' structure\n * type provides the calling application's (or library's) error functionality\n * and memory management function pointers to the loaded library. These should\n * be used/set in the loaded library code so that the loading application's\n * 'state' will be used/changed in all operations. The 'static_state' pointer\n * allows the loaded library to know if it shares the same static data as the\n * calling application (or library), and thus whether these callbacks need to be\n * set or not. */\ntypedef void *(*dyn_MEM_malloc_cb)(size_t);\ntypedef void *(*dyn_MEM_realloc_cb)(void *, size_t);\ntypedef void (*dyn_MEM_free_cb)(void *);\ntypedef struct st_dynamic_MEM_fns {\n\tdyn_MEM_malloc_cb\t\t\tmalloc_cb;\n\tdyn_MEM_realloc_cb\t\t\trealloc_cb;\n\tdyn_MEM_free_cb\t\t\t\tfree_cb;\n\t} dynamic_MEM_fns;\n/* FIXME: Perhaps the memory and locking code (crypto.h) should declare and use\n * these types so we (and any other dependant code) can simplify a bit?? */\ntypedef void (*dyn_lock_locking_cb)(int,int,const char *,int);\ntypedef int (*dyn_lock_add_lock_cb)(int*,int,int,const char *,int);\ntypedef struct CRYPTO_dynlock_value *(*dyn_dynlock_create_cb)(\n\t\t\t\t\t\tconst char *,int);\ntypedef void (*dyn_dynlock_lock_cb)(int,struct CRYPTO_dynlock_value *,\n\t\t\t\t\t\tconst char *,int);\ntypedef void (*dyn_dynlock_destroy_cb)(struct CRYPTO_dynlock_value *,\n\t\t\t\t\t\tconst char *,int);\ntypedef struct st_dynamic_LOCK_fns {\n\tdyn_lock_locking_cb\t\t\tlock_locking_cb;\n\tdyn_lock_add_lock_cb\t\t\tlock_add_lock_cb;\n\tdyn_dynlock_create_cb\t\t\tdynlock_create_cb;\n\tdyn_dynlock_lock_cb\t\t\tdynlock_lock_cb;\n\tdyn_dynlock_destroy_cb\t\t\tdynlock_destroy_cb;\n\t} dynamic_LOCK_fns;\n/* The top-level structure */\ntypedef struct st_dynamic_fns {\n\tvoid \t\t\t\t\t*static_state;\n\tconst ERR_FNS\t\t\t\t*err_fns;\n\tconst CRYPTO_EX_DATA_IMPL\t\t*ex_data_fns;\n\tdynamic_MEM_fns\t\t\t\tmem_fns;\n\tdynamic_LOCK_fns\t\t\tlock_fns;\n\t} dynamic_fns;\n\n/* The version checking function should be of this prototype. NB: The\n * ossl_version value passed in is the OSSL_DYNAMIC_VERSION of the loading code.\n * If this function returns zero, it indicates a (potential) version\n * incompatibility and the loaded library doesn't believe it can proceed.\n * Otherwise, the returned value is the (latest) version supported by the\n * loading library. The loader may still decide that the loaded code's version\n * is unsatisfactory and could veto the load. The function is expected to\n * be implemented with the symbol name \"v_check\", and a default implementation\n * can be fully instantiated with IMPLEMENT_DYNAMIC_CHECK_FN(). */\ntypedef unsigned long (*dynamic_v_check_fn)(unsigned long ossl_version);\n#define IMPLEMENT_DYNAMIC_CHECK_FN() \\\n\tOPENSSL_EXPORT unsigned long v_check(unsigned long v) { \\\n\t\tif(v >= OSSL_DYNAMIC_OLDEST) return OSSL_DYNAMIC_VERSION; \\\n\t\treturn 0; }\n\n/* This function is passed the ENGINE structure to initialise with its own\n * function and command settings. It should not adjust the structural or\n * functional reference counts. If this function returns zero, (a) the load will\n * be aborted, (b) the previous ENGINE state will be memcpy'd back onto the\n * structure, and (c) the shared library will be unloaded. So implementations\n * should do their own internal cleanup in failure circumstances otherwise they\n * could leak. The 'id' parameter, if non-NULL, represents the ENGINE id that\n * the loader is looking for. If this is NULL, the shared library can choose to\n * return failure or to initialise a 'default' ENGINE. If non-NULL, the shared\n * library must initialise only an ENGINE matching the passed 'id'. The function\n * is expected to be implemented with the symbol name \"bind_engine\". A standard\n * implementation can be instantiated with IMPLEMENT_DYNAMIC_BIND_FN(fn) where\n * the parameter 'fn' is a callback function that populates the ENGINE structure\n * and returns an int value (zero for failure). 'fn' should have prototype;\n *    [static] int fn(ENGINE *e, const char *id); */\ntypedef int (*dynamic_bind_engine)(ENGINE *e, const char *id,\n\t\t\t\tconst dynamic_fns *fns);\n#define IMPLEMENT_DYNAMIC_BIND_FN(fn) \\\n\tOPENSSL_EXPORT \\\n\tint bind_engine(ENGINE *e, const char *id, const dynamic_fns *fns) { \\\n\t\tif(ENGINE_get_static_state() == fns->static_state) goto skip_cbs; \\\n\t\tif(!CRYPTO_set_mem_functions(fns->mem_fns.malloc_cb, \\\n\t\t\tfns->mem_fns.realloc_cb, fns->mem_fns.free_cb)) \\\n\t\t\treturn 0; \\\n\t\tCRYPTO_set_locking_callback(fns->lock_fns.lock_locking_cb); \\\n\t\tCRYPTO_set_add_lock_callback(fns->lock_fns.lock_add_lock_cb); \\\n\t\tCRYPTO_set_dynlock_create_callback(fns->lock_fns.dynlock_create_cb); \\\n\t\tCRYPTO_set_dynlock_lock_callback(fns->lock_fns.dynlock_lock_cb); \\\n\t\tCRYPTO_set_dynlock_destroy_callback(fns->lock_fns.dynlock_destroy_cb); \\\n\t\tif(!CRYPTO_set_ex_data_implementation(fns->ex_data_fns)) \\\n\t\t\treturn 0; \\\n\t\tif(!ERR_set_implementation(fns->err_fns)) return 0; \\\n\tskip_cbs: \\\n\t\tif(!fn(e,id)) return 0; \\\n\t\treturn 1; }\n\n/* If the loading application (or library) and the loaded ENGINE library share\n * the same static data (eg. they're both dynamically linked to the same\n * libcrypto.so) we need a way to avoid trying to set system callbacks - this\n * would fail, and for the same reason that it's unnecessary to try. If the\n * loaded ENGINE has (or gets from through the loader) its own copy of the\n * libcrypto static data, we will need to set the callbacks. The easiest way to\n * detect this is to have a function that returns a pointer to some static data\n * and let the loading application and loaded ENGINE compare their respective\n * values. */\nvoid *ENGINE_get_static_state(void);\n\n#if defined(__OpenBSD__) || defined(__FreeBSD__)\nvoid ENGINE_setup_bsd_cryptodev(void);\n#endif\n\n/* BEGIN ERROR CODES */\n/* The following lines are auto generated by the script mkerr.pl. Any changes\n * made after this point may be overwritten when the script is next run.\n */\nvoid ERR_load_ENGINE_strings(void);\n\n/* Error codes for the ENGINE functions. */\n\n/* Function codes. */\n#define ENGINE_F_DYNAMIC_CTRL\t\t\t\t 180\n#define ENGINE_F_DYNAMIC_GET_DATA_CTX\t\t\t 181\n#define ENGINE_F_DYNAMIC_LOAD\t\t\t\t 182\n#define ENGINE_F_DYNAMIC_SET_DATA_CTX\t\t\t 183\n#define ENGINE_F_ENGINE_ADD\t\t\t\t 105\n#define ENGINE_F_ENGINE_BY_ID\t\t\t\t 106\n#define ENGINE_F_ENGINE_CMD_IS_EXECUTABLE\t\t 170\n#define ENGINE_F_ENGINE_CTRL\t\t\t\t 142\n#define ENGINE_F_ENGINE_CTRL_CMD\t\t\t 178\n#define ENGINE_F_ENGINE_CTRL_CMD_STRING\t\t\t 171\n#define ENGINE_F_ENGINE_FINISH\t\t\t\t 107\n#define ENGINE_F_ENGINE_FREE_UTIL\t\t\t 108\n#define ENGINE_F_ENGINE_GET_CIPHER\t\t\t 185\n#define ENGINE_F_ENGINE_GET_DEFAULT_TYPE\t\t 177\n#define ENGINE_F_ENGINE_GET_DIGEST\t\t\t 186\n#define ENGINE_F_ENGINE_GET_NEXT\t\t\t 115\n#define ENGINE_F_ENGINE_GET_PREV\t\t\t 116\n#define ENGINE_F_ENGINE_INIT\t\t\t\t 119\n#define ENGINE_F_ENGINE_LIST_ADD\t\t\t 120\n#define ENGINE_F_ENGINE_LIST_REMOVE\t\t\t 121\n#define ENGINE_F_ENGINE_LOAD_PRIVATE_KEY\t\t 150\n#define ENGINE_F_ENGINE_LOAD_PUBLIC_KEY\t\t\t 151\n#define ENGINE_F_ENGINE_LOAD_SSL_CLIENT_CERT\t\t 192\n#define ENGINE_F_ENGINE_NEW\t\t\t\t 122\n#define ENGINE_F_ENGINE_REMOVE\t\t\t\t 123\n#define ENGINE_F_ENGINE_SET_DEFAULT_STRING\t\t 189\n#define ENGINE_F_ENGINE_SET_DEFAULT_TYPE\t\t 126\n#define ENGINE_F_ENGINE_SET_ID\t\t\t\t 129\n#define ENGINE_F_ENGINE_SET_NAME\t\t\t 130\n#define ENGINE_F_ENGINE_TABLE_REGISTER\t\t\t 184\n#define ENGINE_F_ENGINE_UNLOAD_KEY\t\t\t 152\n#define ENGINE_F_ENGINE_UNLOCKED_FINISH\t\t\t 191\n#define ENGINE_F_ENGINE_UP_REF\t\t\t\t 190\n#define ENGINE_F_INT_CTRL_HELPER\t\t\t 172\n#define ENGINE_F_INT_ENGINE_CONFIGURE\t\t\t 188\n#define ENGINE_F_INT_ENGINE_MODULE_INIT\t\t\t 187\n#define ENGINE_F_LOG_MESSAGE\t\t\t\t 141\n\n/* Reason codes. */\n#define ENGINE_R_ALREADY_LOADED\t\t\t\t 100\n#define ENGINE_R_ARGUMENT_IS_NOT_A_NUMBER\t\t 133\n#define ENGINE_R_CMD_NOT_EXECUTABLE\t\t\t 134\n#define ENGINE_R_COMMAND_TAKES_INPUT\t\t\t 135\n#define ENGINE_R_COMMAND_TAKES_NO_INPUT\t\t\t 136\n#define ENGINE_R_CONFLICTING_ENGINE_ID\t\t\t 103\n#define ENGINE_R_CTRL_COMMAND_NOT_IMPLEMENTED\t\t 119\n#define ENGINE_R_DH_NOT_IMPLEMENTED\t\t\t 139\n#define ENGINE_R_DSA_NOT_IMPLEMENTED\t\t\t 140\n#define ENGINE_R_DSO_FAILURE\t\t\t\t 104\n#define ENGINE_R_DSO_NOT_FOUND\t\t\t\t 132\n#define ENGINE_R_ENGINES_SECTION_ERROR\t\t\t 148\n#define ENGINE_R_ENGINE_CONFIGURATION_ERROR\t\t 101\n#define ENGINE_R_ENGINE_IS_NOT_IN_LIST\t\t\t 105\n#define ENGINE_R_ENGINE_SECTION_ERROR\t\t\t 149\n#define ENGINE_R_FAILED_LOADING_PRIVATE_KEY\t\t 128\n#define ENGINE_R_FAILED_LOADING_PUBLIC_KEY\t\t 129\n#define ENGINE_R_FINISH_FAILED\t\t\t\t 106\n#define ENGINE_R_GET_HANDLE_FAILED\t\t\t 107\n#define ENGINE_R_ID_OR_NAME_MISSING\t\t\t 108\n#define ENGINE_R_INIT_FAILED\t\t\t\t 109\n#define ENGINE_R_INTERNAL_LIST_ERROR\t\t\t 110\n#define ENGINE_R_INVALID_ARGUMENT\t\t\t 143\n#define ENGINE_R_INVALID_CMD_NAME\t\t\t 137\n#define ENGINE_R_INVALID_CMD_NUMBER\t\t\t 138\n#define ENGINE_R_INVALID_INIT_VALUE\t\t\t 151\n#define ENGINE_R_INVALID_STRING\t\t\t\t 150\n#define ENGINE_R_NOT_INITIALISED\t\t\t 117\n#define ENGINE_R_NOT_LOADED\t\t\t\t 112\n#define ENGINE_R_NO_CONTROL_FUNCTION\t\t\t 120\n#define ENGINE_R_NO_INDEX\t\t\t\t 144\n#define ENGINE_R_NO_LOAD_FUNCTION\t\t\t 125\n#define ENGINE_R_NO_REFERENCE\t\t\t\t 130\n#define ENGINE_R_NO_SUCH_ENGINE\t\t\t\t 116\n#define ENGINE_R_NO_UNLOAD_FUNCTION\t\t\t 126\n#define ENGINE_R_PROVIDE_PARAMETERS\t\t\t 113\n#define ENGINE_R_RSA_NOT_IMPLEMENTED\t\t\t 141\n#define ENGINE_R_UNIMPLEMENTED_CIPHER\t\t\t 146\n#define ENGINE_R_UNIMPLEMENTED_DIGEST\t\t\t 147\n#define ENGINE_R_VERSION_INCOMPATIBILITY\t\t 145\n\n#ifdef  __cplusplus\n}\n#endif\n#endif\n"
  },
  {
    "path": "freebsd-headers/openssl/err.h",
    "content": "/* crypto/err/err.h */\n/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)\n * All rights reserved.\n *\n * This package is an SSL implementation written\n * by Eric Young (eay@cryptsoft.com).\n * The implementation was written so as to conform with Netscapes SSL.\n * \n * This library is free for commercial and non-commercial use as long as\n * the following conditions are aheared to.  The following conditions\n * apply to all code found in this distribution, be it the RC4, RSA,\n * lhash, DES, etc., code; not just the SSL code.  The SSL documentation\n * included with this distribution is covered by the same copyright terms\n * except that the holder is Tim Hudson (tjh@cryptsoft.com).\n * \n * Copyright remains Eric Young's, and as such any Copyright notices in\n * the code are not to be removed.\n * If this package is used in a product, Eric Young should be given attribution\n * as the author of the parts of the library used.\n * This can be in the form of a textual message at program startup or\n * in documentation (online or textual) provided with the package.\n * \n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. All advertising materials mentioning features or use of this software\n *    must display the following acknowledgement:\n *    \"This product includes cryptographic software written by\n *     Eric Young (eay@cryptsoft.com)\"\n *    The word 'cryptographic' can be left out if the rouines from the library\n *    being used are not cryptographic related :-).\n * 4. If you include any Windows specific code (or a derivative thereof) from \n *    the apps directory (application code) you must include an acknowledgement:\n *    \"This product includes software written by Tim Hudson (tjh@cryptsoft.com)\"\n * \n * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n * \n * The licence and distribution terms for any publically available version or\n * derivative of this code cannot be changed.  i.e. this code cannot simply be\n * copied and put under another distribution licence\n * [including the GNU Public Licence.]\n */\n\n#ifndef HEADER_ERR_H\n#define HEADER_ERR_H\n\n#include <openssl/e_os2.h>\n\n#ifndef OPENSSL_NO_FP_API\n#include <stdio.h>\n#include <stdlib.h>\n#endif\n\n#include <openssl/ossl_typ.h>\n#ifndef OPENSSL_NO_BIO\n#include <openssl/bio.h>\n#endif\n#ifndef OPENSSL_NO_LHASH\n#include <openssl/lhash.h>\n#endif\n\n#ifdef\t__cplusplus\nextern \"C\" {\n#endif\n\n#ifndef OPENSSL_NO_ERR\n#define ERR_PUT_error(a,b,c,d,e)\tERR_put_error(a,b,c,d,e)\n#else\n#define ERR_PUT_error(a,b,c,d,e)\tERR_put_error(a,b,c,NULL,0)\n#endif\n\n#include <errno.h>\n\n#define ERR_TXT_MALLOCED\t0x01\n#define ERR_TXT_STRING\t\t0x02\n\n#define ERR_FLAG_MARK\t\t0x01\n\n#define ERR_NUM_ERRORS\t16\ntypedef struct err_state_st\n\t{\n\tunsigned long pid;\n\tint err_flags[ERR_NUM_ERRORS];\n\tunsigned long err_buffer[ERR_NUM_ERRORS];\n\tchar *err_data[ERR_NUM_ERRORS];\n\tint err_data_flags[ERR_NUM_ERRORS];\n\tconst char *err_file[ERR_NUM_ERRORS];\n\tint err_line[ERR_NUM_ERRORS];\n\tint top,bottom;\n\t} ERR_STATE;\n\n/* library */\n#define ERR_LIB_NONE\t\t1\n#define ERR_LIB_SYS\t\t2\n#define ERR_LIB_BN\t\t3\n#define ERR_LIB_RSA\t\t4\n#define ERR_LIB_DH\t\t5\n#define ERR_LIB_EVP\t\t6\n#define ERR_LIB_BUF\t\t7\n#define ERR_LIB_OBJ\t\t8\n#define ERR_LIB_PEM\t\t9\n#define ERR_LIB_DSA\t\t10\n#define ERR_LIB_X509\t\t11\n/* #define ERR_LIB_METH         12 */\n#define ERR_LIB_ASN1\t\t13\n#define ERR_LIB_CONF\t\t14\n#define ERR_LIB_CRYPTO\t\t15\n#define ERR_LIB_EC\t\t16\n#define ERR_LIB_SSL\t\t20\n/* #define ERR_LIB_SSL23        21 */\n/* #define ERR_LIB_SSL2         22 */\n/* #define ERR_LIB_SSL3         23 */\n/* #define ERR_LIB_RSAREF       30 */\n/* #define ERR_LIB_PROXY        31 */\n#define ERR_LIB_BIO\t\t32\n#define ERR_LIB_PKCS7\t\t33\n#define ERR_LIB_X509V3\t\t34\n#define ERR_LIB_PKCS12\t\t35\n#define ERR_LIB_RAND\t\t36\n#define ERR_LIB_DSO\t\t37\n#define ERR_LIB_ENGINE\t\t38\n#define ERR_LIB_OCSP            39\n#define ERR_LIB_UI              40\n#define ERR_LIB_COMP            41\n#define ERR_LIB_ECDSA\t\t42\n#define ERR_LIB_ECDH\t\t43\n#define ERR_LIB_STORE           44\n#define ERR_LIB_FIPS\t\t45\n#define ERR_LIB_CMS\t\t46\n#define ERR_LIB_JPAKE\t\t47\n\n#define ERR_LIB_USER\t\t128\n\n#define SYSerr(f,r)  ERR_PUT_error(ERR_LIB_SYS,(f),(r),__FILE__,__LINE__)\n#define BNerr(f,r)   ERR_PUT_error(ERR_LIB_BN,(f),(r),__FILE__,__LINE__)\n#define RSAerr(f,r)  ERR_PUT_error(ERR_LIB_RSA,(f),(r),__FILE__,__LINE__)\n#define DHerr(f,r)   ERR_PUT_error(ERR_LIB_DH,(f),(r),__FILE__,__LINE__)\n#define EVPerr(f,r)  ERR_PUT_error(ERR_LIB_EVP,(f),(r),__FILE__,__LINE__)\n#define BUFerr(f,r)  ERR_PUT_error(ERR_LIB_BUF,(f),(r),__FILE__,__LINE__)\n#define OBJerr(f,r)  ERR_PUT_error(ERR_LIB_OBJ,(f),(r),__FILE__,__LINE__)\n#define PEMerr(f,r)  ERR_PUT_error(ERR_LIB_PEM,(f),(r),__FILE__,__LINE__)\n#define DSAerr(f,r)  ERR_PUT_error(ERR_LIB_DSA,(f),(r),__FILE__,__LINE__)\n#define X509err(f,r) ERR_PUT_error(ERR_LIB_X509,(f),(r),__FILE__,__LINE__)\n#define ASN1err(f,r) ERR_PUT_error(ERR_LIB_ASN1,(f),(r),__FILE__,__LINE__)\n#define CONFerr(f,r) ERR_PUT_error(ERR_LIB_CONF,(f),(r),__FILE__,__LINE__)\n#define CRYPTOerr(f,r) ERR_PUT_error(ERR_LIB_CRYPTO,(f),(r),__FILE__,__LINE__)\n#define ECerr(f,r)   ERR_PUT_error(ERR_LIB_EC,(f),(r),__FILE__,__LINE__)\n#define SSLerr(f,r)  ERR_PUT_error(ERR_LIB_SSL,(f),(r),__FILE__,__LINE__)\n#define BIOerr(f,r)  ERR_PUT_error(ERR_LIB_BIO,(f),(r),__FILE__,__LINE__)\n#define PKCS7err(f,r) ERR_PUT_error(ERR_LIB_PKCS7,(f),(r),__FILE__,__LINE__)\n#define X509V3err(f,r) ERR_PUT_error(ERR_LIB_X509V3,(f),(r),__FILE__,__LINE__)\n#define PKCS12err(f,r) ERR_PUT_error(ERR_LIB_PKCS12,(f),(r),__FILE__,__LINE__)\n#define RANDerr(f,r) ERR_PUT_error(ERR_LIB_RAND,(f),(r),__FILE__,__LINE__)\n#define DSOerr(f,r) ERR_PUT_error(ERR_LIB_DSO,(f),(r),__FILE__,__LINE__)\n#define ENGINEerr(f,r) ERR_PUT_error(ERR_LIB_ENGINE,(f),(r),__FILE__,__LINE__)\n#define OCSPerr(f,r) ERR_PUT_error(ERR_LIB_OCSP,(f),(r),__FILE__,__LINE__)\n#define UIerr(f,r) ERR_PUT_error(ERR_LIB_UI,(f),(r),__FILE__,__LINE__)\n#define COMPerr(f,r) ERR_PUT_error(ERR_LIB_COMP,(f),(r),__FILE__,__LINE__)\n#define ECDSAerr(f,r)  ERR_PUT_error(ERR_LIB_ECDSA,(f),(r),__FILE__,__LINE__)\n#define ECDHerr(f,r)  ERR_PUT_error(ERR_LIB_ECDH,(f),(r),__FILE__,__LINE__)\n#define STOREerr(f,r) ERR_PUT_error(ERR_LIB_STORE,(f),(r),__FILE__,__LINE__)\n#define FIPSerr(f,r) ERR_PUT_error(ERR_LIB_FIPS,(f),(r),__FILE__,__LINE__)\n#define CMSerr(f,r) ERR_PUT_error(ERR_LIB_CMS,(f),(r),__FILE__,__LINE__)\n#define JPAKEerr(f,r) ERR_PUT_error(ERR_LIB_JPAKE,(f),(r),__FILE__,__LINE__)\n\n/* Borland C seems too stupid to be able to shift and do longs in\n * the pre-processor :-( */\n#define ERR_PACK(l,f,r)\t\t(((((unsigned long)l)&0xffL)*0x1000000)| \\\n\t\t\t\t((((unsigned long)f)&0xfffL)*0x1000)| \\\n\t\t\t\t((((unsigned long)r)&0xfffL)))\n#define ERR_GET_LIB(l)\t\t(int)((((unsigned long)l)>>24L)&0xffL)\n#define ERR_GET_FUNC(l)\t\t(int)((((unsigned long)l)>>12L)&0xfffL)\n#define ERR_GET_REASON(l)\t(int)((l)&0xfffL)\n#define ERR_FATAL_ERROR(l)\t(int)((l)&ERR_R_FATAL)\n\n\n/* OS functions */\n#define SYS_F_FOPEN\t\t1\n#define SYS_F_CONNECT\t\t2\n#define SYS_F_GETSERVBYNAME\t3\n#define SYS_F_SOCKET\t\t4\n#define SYS_F_IOCTLSOCKET\t5\n#define SYS_F_BIND\t\t6\n#define SYS_F_LISTEN\t\t7\n#define SYS_F_ACCEPT\t\t8\n#define SYS_F_WSASTARTUP\t9 /* Winsock stuff */\n#define SYS_F_OPENDIR\t\t10\n#define SYS_F_FREAD\t\t11\n\n\n/* reasons */\n#define ERR_R_SYS_LIB\tERR_LIB_SYS       /* 2 */\n#define ERR_R_BN_LIB\tERR_LIB_BN        /* 3 */\n#define ERR_R_RSA_LIB\tERR_LIB_RSA       /* 4 */\n#define ERR_R_DH_LIB\tERR_LIB_DH        /* 5 */\n#define ERR_R_EVP_LIB\tERR_LIB_EVP       /* 6 */\n#define ERR_R_BUF_LIB\tERR_LIB_BUF       /* 7 */\n#define ERR_R_OBJ_LIB\tERR_LIB_OBJ       /* 8 */\n#define ERR_R_PEM_LIB\tERR_LIB_PEM       /* 9 */\n#define ERR_R_DSA_LIB\tERR_LIB_DSA      /* 10 */\n#define ERR_R_X509_LIB\tERR_LIB_X509     /* 11 */\n#define ERR_R_ASN1_LIB\tERR_LIB_ASN1     /* 13 */\n#define ERR_R_CONF_LIB\tERR_LIB_CONF     /* 14 */\n#define ERR_R_CRYPTO_LIB ERR_LIB_CRYPTO  /* 15 */\n#define ERR_R_EC_LIB\tERR_LIB_EC       /* 16 */\n#define ERR_R_SSL_LIB\tERR_LIB_SSL      /* 20 */\n#define ERR_R_BIO_LIB\tERR_LIB_BIO      /* 32 */\n#define ERR_R_PKCS7_LIB\tERR_LIB_PKCS7    /* 33 */\n#define ERR_R_X509V3_LIB ERR_LIB_X509V3  /* 34 */\n#define ERR_R_PKCS12_LIB ERR_LIB_PKCS12  /* 35 */\n#define ERR_R_RAND_LIB\tERR_LIB_RAND     /* 36 */\n#define ERR_R_DSO_LIB\tERR_LIB_DSO      /* 37 */\n#define ERR_R_ENGINE_LIB ERR_LIB_ENGINE  /* 38 */\n#define ERR_R_OCSP_LIB  ERR_LIB_OCSP     /* 39 */\n#define ERR_R_UI_LIB    ERR_LIB_UI       /* 40 */\n#define ERR_R_COMP_LIB\tERR_LIB_COMP     /* 41 */\n#define ERR_R_ECDSA_LIB ERR_LIB_ECDSA\t /* 42 */\n#define ERR_R_ECDH_LIB  ERR_LIB_ECDH\t /* 43 */\n#define ERR_R_STORE_LIB ERR_LIB_STORE    /* 44 */\n\n#define ERR_R_NESTED_ASN1_ERROR\t\t\t58\n#define ERR_R_BAD_ASN1_OBJECT_HEADER\t\t59\n#define ERR_R_BAD_GET_ASN1_OBJECT_CALL\t\t60\n#define ERR_R_EXPECTING_AN_ASN1_SEQUENCE\t61\n#define ERR_R_ASN1_LENGTH_MISMATCH\t\t62\n#define ERR_R_MISSING_ASN1_EOS\t\t\t63\n\n/* fatal error */\n#define ERR_R_FATAL\t\t\t\t64\n#define\tERR_R_MALLOC_FAILURE\t\t\t(1|ERR_R_FATAL)\n#define\tERR_R_SHOULD_NOT_HAVE_BEEN_CALLED\t(2|ERR_R_FATAL)\n#define\tERR_R_PASSED_NULL_PARAMETER\t\t(3|ERR_R_FATAL)\n#define\tERR_R_INTERNAL_ERROR\t\t\t(4|ERR_R_FATAL)\n#define\tERR_R_DISABLED\t\t\t\t(5|ERR_R_FATAL)\n\n/* 99 is the maximum possible ERR_R_... code, higher values\n * are reserved for the individual libraries */\n\n\ntypedef struct ERR_string_data_st\n\t{\n\tunsigned long error;\n\tconst char *string;\n\t} ERR_STRING_DATA;\n\nvoid ERR_put_error(int lib, int func,int reason,const char *file,int line);\nvoid ERR_set_error_data(char *data,int flags);\n\nunsigned long ERR_get_error(void);\nunsigned long ERR_get_error_line(const char **file,int *line);\nunsigned long ERR_get_error_line_data(const char **file,int *line,\n\t\t\t\t      const char **data, int *flags);\nunsigned long ERR_peek_error(void);\nunsigned long ERR_peek_error_line(const char **file,int *line);\nunsigned long ERR_peek_error_line_data(const char **file,int *line,\n\t\t\t\t       const char **data,int *flags);\nunsigned long ERR_peek_last_error(void);\nunsigned long ERR_peek_last_error_line(const char **file,int *line);\nunsigned long ERR_peek_last_error_line_data(const char **file,int *line,\n\t\t\t\t       const char **data,int *flags);\nvoid ERR_clear_error(void );\nchar *ERR_error_string(unsigned long e,char *buf);\nvoid ERR_error_string_n(unsigned long e, char *buf, size_t len);\nconst char *ERR_lib_error_string(unsigned long e);\nconst char *ERR_func_error_string(unsigned long e);\nconst char *ERR_reason_error_string(unsigned long e);\nvoid ERR_print_errors_cb(int (*cb)(const char *str, size_t len, void *u),\n\t\t\t void *u);\n#ifndef OPENSSL_NO_FP_API\nvoid ERR_print_errors_fp(FILE *fp);\n#endif\n#ifndef OPENSSL_NO_BIO\nvoid ERR_print_errors(BIO *bp);\nvoid ERR_add_error_data(int num, ...);\n#endif\nvoid ERR_load_strings(int lib,ERR_STRING_DATA str[]);\nvoid ERR_unload_strings(int lib,ERR_STRING_DATA str[]);\nvoid ERR_load_ERR_strings(void);\nvoid ERR_load_crypto_strings(void);\nvoid ERR_free_strings(void);\n\nvoid ERR_remove_state(unsigned long pid); /* if zero we look it up */\nERR_STATE *ERR_get_state(void);\n\n#ifndef OPENSSL_NO_LHASH\nLHASH *ERR_get_string_table(void);\nLHASH *ERR_get_err_state_table(void);\nvoid ERR_release_err_state_table(LHASH **hash);\n#endif\n\nint ERR_get_next_error_library(void);\n\nint ERR_set_mark(void);\nint ERR_pop_to_mark(void);\n\n#ifdef OPENSSL_FIPS\nvoid int_ERR_set_state_func(ERR_STATE *(*get_func)(void),\n\t\t\t\tvoid (*remove_func)(unsigned long pid));\nvoid int_ERR_lib_init(void);\n#endif\n\n/* Already defined in ossl_typ.h */\n/* typedef struct st_ERR_FNS ERR_FNS; */\n/* An application can use this function and provide the return value to loaded\n * modules that should use the application's ERR state/functionality */\nconst ERR_FNS *ERR_get_implementation(void);\n/* A loaded module should call this function prior to any ERR operations using\n * the application's \"ERR_FNS\". */\nint ERR_set_implementation(const ERR_FNS *fns);\n\n#ifdef\t__cplusplus\n}\n#endif\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/openssl/evp.h",
    "content": "/* crypto/evp/evp.h */\n/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)\n * All rights reserved.\n *\n * This package is an SSL implementation written\n * by Eric Young (eay@cryptsoft.com).\n * The implementation was written so as to conform with Netscapes SSL.\n * \n * This library is free for commercial and non-commercial use as long as\n * the following conditions are aheared to.  The following conditions\n * apply to all code found in this distribution, be it the RC4, RSA,\n * lhash, DES, etc., code; not just the SSL code.  The SSL documentation\n * included with this distribution is covered by the same copyright terms\n * except that the holder is Tim Hudson (tjh@cryptsoft.com).\n * \n * Copyright remains Eric Young's, and as such any Copyright notices in\n * the code are not to be removed.\n * If this package is used in a product, Eric Young should be given attribution\n * as the author of the parts of the library used.\n * This can be in the form of a textual message at program startup or\n * in documentation (online or textual) provided with the package.\n * \n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. All advertising materials mentioning features or use of this software\n *    must display the following acknowledgement:\n *    \"This product includes cryptographic software written by\n *     Eric Young (eay@cryptsoft.com)\"\n *    The word 'cryptographic' can be left out if the rouines from the library\n *    being used are not cryptographic related :-).\n * 4. If you include any Windows specific code (or a derivative thereof) from \n *    the apps directory (application code) you must include an acknowledgement:\n *    \"This product includes software written by Tim Hudson (tjh@cryptsoft.com)\"\n * \n * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n * \n * The licence and distribution terms for any publically available version or\n * derivative of this code cannot be changed.  i.e. this code cannot simply be\n * copied and put under another distribution licence\n * [including the GNU Public Licence.]\n */\n\n#ifndef HEADER_ENVELOPE_H\n#define HEADER_ENVELOPE_H\n\n#ifdef OPENSSL_ALGORITHM_DEFINES\n# include <openssl/opensslconf.h>\n#else\n# define OPENSSL_ALGORITHM_DEFINES\n# include <openssl/opensslconf.h>\n# undef OPENSSL_ALGORITHM_DEFINES\n#endif\n\n#include <openssl/ossl_typ.h>\n\n#include <openssl/symhacks.h>\n\n#ifndef OPENSSL_NO_BIO\n#include <openssl/bio.h>\n#endif\n\n#ifdef OPENSSL_FIPS\n#include <openssl/fips.h>\n#endif\n\n/*\n#define EVP_RC2_KEY_SIZE\t\t16\n#define EVP_RC4_KEY_SIZE\t\t16\n#define EVP_BLOWFISH_KEY_SIZE\t\t16\n#define EVP_CAST5_KEY_SIZE\t\t16\n#define EVP_RC5_32_12_16_KEY_SIZE\t16\n*/\n#define EVP_MAX_MD_SIZE\t\t\t64\t/* longest known is SHA512 */\n#define EVP_MAX_KEY_LENGTH\t\t32\n#define EVP_MAX_IV_LENGTH\t\t16\n#define EVP_MAX_BLOCK_LENGTH\t\t32\n\n#define PKCS5_SALT_LEN\t\t\t8\n/* Default PKCS#5 iteration count */\n#define PKCS5_DEFAULT_ITER\t\t2048\n\n#include <openssl/objects.h>\n\n#define EVP_PK_RSA\t0x0001\n#define EVP_PK_DSA\t0x0002\n#define EVP_PK_DH\t0x0004\n#define EVP_PK_EC\t0x0008\n#define EVP_PKT_SIGN\t0x0010\n#define EVP_PKT_ENC\t0x0020\n#define EVP_PKT_EXCH\t0x0040\n#define EVP_PKS_RSA\t0x0100\n#define EVP_PKS_DSA\t0x0200\n#define EVP_PKS_EC\t0x0400\n#define EVP_PKT_EXP\t0x1000 /* <= 512 bit key */\n\n#define EVP_PKEY_NONE\tNID_undef\n#define EVP_PKEY_RSA\tNID_rsaEncryption\n#define EVP_PKEY_RSA2\tNID_rsa\n#define EVP_PKEY_DSA\tNID_dsa\n#define EVP_PKEY_DSA1\tNID_dsa_2\n#define EVP_PKEY_DSA2\tNID_dsaWithSHA\n#define EVP_PKEY_DSA3\tNID_dsaWithSHA1\n#define EVP_PKEY_DSA4\tNID_dsaWithSHA1_2\n#define EVP_PKEY_DH\tNID_dhKeyAgreement\n#define EVP_PKEY_EC\tNID_X9_62_id_ecPublicKey\n\n#ifdef\t__cplusplus\nextern \"C\" {\n#endif\n\n/* Type needs to be a bit field\n * Sub-type needs to be for variations on the method, as in, can it do\n * arbitrary encryption.... */\nstruct evp_pkey_st\n\t{\n\tint type;\n\tint save_type;\n\tint references;\n\tunion\t{\n\t\tchar *ptr;\n#ifndef OPENSSL_NO_RSA\n\t\tstruct rsa_st *rsa;\t/* RSA */\n#endif\n#ifndef OPENSSL_NO_DSA\n\t\tstruct dsa_st *dsa;\t/* DSA */\n#endif\n#ifndef OPENSSL_NO_DH\n\t\tstruct dh_st *dh;\t/* DH */\n#endif\n#ifndef OPENSSL_NO_EC\n\t\tstruct ec_key_st *ec;\t/* ECC */\n#endif\n\t\t} pkey;\n\tint save_parameters;\n\tSTACK_OF(X509_ATTRIBUTE) *attributes; /* [ 0 ] */\n\t} /* EVP_PKEY */;\n\n#define EVP_PKEY_MO_SIGN\t0x0001\n#define EVP_PKEY_MO_VERIFY\t0x0002\n#define EVP_PKEY_MO_ENCRYPT\t0x0004\n#define EVP_PKEY_MO_DECRYPT\t0x0008\n\n#if 0\n/* This structure is required to tie the message digest and signing together.\n * The lookup can be done by md/pkey_method, oid, oid/pkey_method, or\n * oid, md and pkey.\n * This is required because for various smart-card perform the digest and\n * signing/verification on-board.  To handle this case, the specific\n * EVP_MD and EVP_PKEY_METHODs need to be closely associated.\n * When a PKEY is created, it will have a EVP_PKEY_METHOD associated with it.\n * This can either be software or a token to provide the required low level\n * routines.\n */\ntypedef struct evp_pkey_md_st\n\t{\n\tint oid;\n\tEVP_MD *md;\n\tEVP_PKEY_METHOD *pkey;\n\t} EVP_PKEY_MD;\n\n#define EVP_rsa_md2() \\\n\t\tEVP_PKEY_MD_add(NID_md2WithRSAEncryption,\\\n\t\t\tEVP_rsa_pkcs1(),EVP_md2())\n#define EVP_rsa_md5() \\\n\t\tEVP_PKEY_MD_add(NID_md5WithRSAEncryption,\\\n\t\t\tEVP_rsa_pkcs1(),EVP_md5())\n#define EVP_rsa_sha0() \\\n\t\tEVP_PKEY_MD_add(NID_shaWithRSAEncryption,\\\n\t\t\tEVP_rsa_pkcs1(),EVP_sha())\n#define EVP_rsa_sha1() \\\n\t\tEVP_PKEY_MD_add(NID_sha1WithRSAEncryption,\\\n\t\t\tEVP_rsa_pkcs1(),EVP_sha1())\n#define EVP_rsa_ripemd160() \\\n\t\tEVP_PKEY_MD_add(NID_ripemd160WithRSA,\\\n\t\t\tEVP_rsa_pkcs1(),EVP_ripemd160())\n#define EVP_rsa_mdc2() \\\n\t\tEVP_PKEY_MD_add(NID_mdc2WithRSA,\\\n\t\t\tEVP_rsa_octet_string(),EVP_mdc2())\n#define EVP_dsa_sha() \\\n\t\tEVP_PKEY_MD_add(NID_dsaWithSHA,\\\n\t\t\tEVP_dsa(),EVP_sha())\n#define EVP_dsa_sha1() \\\n\t\tEVP_PKEY_MD_add(NID_dsaWithSHA1,\\\n\t\t\tEVP_dsa(),EVP_sha1())\n\ntypedef struct evp_pkey_method_st\n\t{\n\tchar *name;\n\tint flags;\n\tint type;\t\t/* RSA, DSA, an SSLeay specific constant */\n\tint oid;\t\t/* For the pub-key type */\n\tint encrypt_oid;\t/* pub/priv key encryption */\n\n\tint (*sign)();\n\tint (*verify)();\n\tstruct\t{\n\t\tint (*set)();\t/* get and/or set the underlying type */\n\t\tint (*get)();\n\t\tint (*encrypt)();\n\t\tint (*decrypt)();\n\t\tint (*i2d)();\n\t\tint (*d2i)();\n\t\tint (*dup)();\n\t\t} pub,priv;\n\tint (*set_asn1_parameters)();\n\tint (*get_asn1_parameters)();\n\t} EVP_PKEY_METHOD;\n#endif\n\n#ifndef EVP_MD\nstruct env_md_st\n\t{\n\tint type;\n\tint pkey_type;\n\tint md_size;\n\tunsigned long flags;\n\tint (*init)(EVP_MD_CTX *ctx);\n\tint (*update)(EVP_MD_CTX *ctx,const void *data,size_t count);\n\tint (*final)(EVP_MD_CTX *ctx,unsigned char *md);\n\tint (*copy)(EVP_MD_CTX *to,const EVP_MD_CTX *from);\n\tint (*cleanup)(EVP_MD_CTX *ctx);\n\n\t/* FIXME: prototype these some day */\n\tint (*sign)(int type, const unsigned char *m, unsigned int m_length,\n\t\t    unsigned char *sigret, unsigned int *siglen, void *key);\n\tint (*verify)(int type, const unsigned char *m, unsigned int m_length,\n\t\t      const unsigned char *sigbuf, unsigned int siglen,\n\t\t      void *key);\n\tint required_pkey_type[5]; /*EVP_PKEY_xxx */\n\tint block_size;\n\tint ctx_size; /* how big does the ctx->md_data need to be */\n\t} /* EVP_MD */;\n\ntypedef int evp_sign_method(int type,const unsigned char *m,\n\t\t\t    unsigned int m_length,unsigned char *sigret,\n\t\t\t    unsigned int *siglen, void *key);\ntypedef int evp_verify_method(int type,const unsigned char *m,\n\t\t\t    unsigned int m_length,const unsigned char *sigbuf,\n\t\t\t    unsigned int siglen, void *key);\n\ntypedef struct\n\t{\n\tEVP_MD_CTX *mctx;\n\tvoid *key;\n\t} EVP_MD_SVCTX;\n\n#define EVP_MD_FLAG_ONESHOT\t0x0001 /* digest can only handle a single\n\t\t\t\t\t* block */\n\n#define EVP_MD_FLAG_FIPS\t0x0400 /* Note if suitable for use in FIPS mode */\n\n#define EVP_MD_FLAG_SVCTX\t0x0800 /* pass EVP_MD_SVCTX to sign/verify */\n\n#define EVP_PKEY_NULL_method\tNULL,NULL,{0,0,0,0}\n\n#ifndef OPENSSL_NO_DSA\n#define EVP_PKEY_DSA_method\t(evp_sign_method *)DSA_sign, \\\n\t\t\t\t(evp_verify_method *)DSA_verify, \\\n\t\t\t\t{EVP_PKEY_DSA,EVP_PKEY_DSA2,EVP_PKEY_DSA3, \\\n\t\t\t\t\tEVP_PKEY_DSA4,0}\n#else\n#define EVP_PKEY_DSA_method\tEVP_PKEY_NULL_method\n#endif\n\n#ifndef OPENSSL_NO_ECDSA\n#define EVP_PKEY_ECDSA_method   (evp_sign_method *)ECDSA_sign, \\\n\t\t\t\t(evp_verify_method *)ECDSA_verify, \\\n                                 {EVP_PKEY_EC,0,0,0}\n#else   \n#define EVP_PKEY_ECDSA_method   EVP_PKEY_NULL_method\n#endif\n\n#ifndef OPENSSL_NO_RSA\n#define EVP_PKEY_RSA_method\t(evp_sign_method *)RSA_sign, \\\n\t\t\t\t(evp_verify_method *)RSA_verify, \\\n\t\t\t\t{EVP_PKEY_RSA,EVP_PKEY_RSA2,0,0}\n#define EVP_PKEY_RSA_ASN1_OCTET_STRING_method \\\n\t\t\t\t(evp_sign_method *)RSA_sign_ASN1_OCTET_STRING, \\\n\t\t\t\t(evp_verify_method *)RSA_verify_ASN1_OCTET_STRING, \\\n\t\t\t\t{EVP_PKEY_RSA,EVP_PKEY_RSA2,0,0}\n#else\n#define EVP_PKEY_RSA_method\tEVP_PKEY_NULL_method\n#define EVP_PKEY_RSA_ASN1_OCTET_STRING_method EVP_PKEY_NULL_method\n#endif\n\n#endif /* !EVP_MD */\n\nstruct env_md_ctx_st\n\t{\n\tconst EVP_MD *digest;\n\tENGINE *engine; /* functional reference if 'digest' is ENGINE-provided */\n\tunsigned long flags;\n\tvoid *md_data;\n\t} /* EVP_MD_CTX */;\n\n/* values for EVP_MD_CTX flags */\n\n#define EVP_MD_CTX_FLAG_ONESHOT\t\t0x0001 /* digest update will be called\n\t\t\t\t\t\t* once only */\n#define EVP_MD_CTX_FLAG_CLEANED\t\t0x0002 /* context has already been\n\t\t\t\t\t\t* cleaned */\n#define EVP_MD_CTX_FLAG_REUSE\t\t0x0004 /* Don't free up ctx->md_data\n\t\t\t\t\t\t* in EVP_MD_CTX_cleanup */\n#define EVP_MD_CTX_FLAG_NON_FIPS_ALLOW\t0x0008\t/* Allow use of non FIPS digest\n\t\t\t\t\t\t * in FIPS mode */\n\n#define EVP_MD_CTX_FLAG_PAD_MASK\t0xF0\t/* RSA mode to use */\n#define EVP_MD_CTX_FLAG_PAD_PKCS1\t0x00\t/* PKCS#1 v1.5 mode */\n#define EVP_MD_CTX_FLAG_PAD_X931\t0x10\t/* X9.31 mode */\n#define EVP_MD_CTX_FLAG_PAD_PSS\t\t0x20\t/* PSS mode */\n#define M_EVP_MD_CTX_FLAG_PSS_SALT(ctx) \\\n\t\t((ctx->flags>>16) &0xFFFF) /* seed length */\n#define EVP_MD_CTX_FLAG_PSS_MDLEN\t0xFFFF\t/* salt len same as digest */\n#define EVP_MD_CTX_FLAG_PSS_MREC\t0xFFFE\t/* salt max or auto recovered */\n\nstruct evp_cipher_st\n\t{\n\tint nid;\n\tint block_size;\n\tint key_len;\t\t/* Default value for variable length ciphers */\n\tint iv_len;\n\tunsigned long flags;\t/* Various flags */\n\tint (*init)(EVP_CIPHER_CTX *ctx, const unsigned char *key,\n\t\t    const unsigned char *iv, int enc);\t/* init key */\n\tint (*do_cipher)(EVP_CIPHER_CTX *ctx, unsigned char *out,\n\t\t\t const unsigned char *in, unsigned int inl);/* encrypt/decrypt data */\n\tint (*cleanup)(EVP_CIPHER_CTX *); /* cleanup ctx */\n\tint ctx_size;\t\t/* how big ctx->cipher_data needs to be */\n\tint (*set_asn1_parameters)(EVP_CIPHER_CTX *, ASN1_TYPE *); /* Populate a ASN1_TYPE with parameters */\n\tint (*get_asn1_parameters)(EVP_CIPHER_CTX *, ASN1_TYPE *); /* Get parameters from a ASN1_TYPE */\n\tint (*ctrl)(EVP_CIPHER_CTX *, int type, int arg, void *ptr); /* Miscellaneous operations */\n\tvoid *app_data;\t\t/* Application data */\n\t} /* EVP_CIPHER */;\n\n/* Values for cipher flags */\n\n/* Modes for ciphers */\n\n#define\t\tEVP_CIPH_STREAM_CIPHER\t\t0x0\n#define\t\tEVP_CIPH_ECB_MODE\t\t0x1\n#define\t\tEVP_CIPH_CBC_MODE\t\t0x2\n#define\t\tEVP_CIPH_CFB_MODE\t\t0x3\n#define\t\tEVP_CIPH_OFB_MODE\t\t0x4\n#define \tEVP_CIPH_MODE\t\t\t0x7\n/* Set if variable length cipher */\n#define \tEVP_CIPH_VARIABLE_LENGTH\t0x8\n/* Set if the iv handling should be done by the cipher itself */\n#define \tEVP_CIPH_CUSTOM_IV\t\t0x10\n/* Set if the cipher's init() function should be called if key is NULL */\n#define \tEVP_CIPH_ALWAYS_CALL_INIT\t0x20\n/* Call ctrl() to init cipher parameters */\n#define \tEVP_CIPH_CTRL_INIT\t\t0x40\n/* Don't use standard key length function */\n#define \tEVP_CIPH_CUSTOM_KEY_LENGTH\t0x80\n/* Don't use standard block padding */\n#define \tEVP_CIPH_NO_PADDING\t\t0x100\n/* cipher handles random key generation */\n#define \tEVP_CIPH_RAND_KEY\t\t0x200\n/* Note if suitable for use in FIPS mode */\n#define\t\tEVP_CIPH_FLAG_FIPS\t\t0x400\n/* Allow non FIPS cipher in FIPS mode */\n#define\t\tEVP_CIPH_FLAG_NON_FIPS_ALLOW\t0x800\n/* Allow use default ASN1 get/set iv */\n#define\t\tEVP_CIPH_FLAG_DEFAULT_ASN1\t0x1000\n/* Buffer length in bits not bytes: CFB1 mode only */\n#define\t\tEVP_CIPH_FLAG_LENGTH_BITS\t0x2000\n\n/* ctrl() values */\n\n#define\t\tEVP_CTRL_INIT\t\t\t0x0\n#define \tEVP_CTRL_SET_KEY_LENGTH\t\t0x1\n#define \tEVP_CTRL_GET_RC2_KEY_BITS\t0x2\n#define \tEVP_CTRL_SET_RC2_KEY_BITS\t0x3\n#define \tEVP_CTRL_GET_RC5_ROUNDS\t\t0x4\n#define \tEVP_CTRL_SET_RC5_ROUNDS\t\t0x5\n#define \tEVP_CTRL_RAND_KEY\t\t0x6\n\ntypedef struct evp_cipher_info_st\n\t{\n\tconst EVP_CIPHER *cipher;\n\tunsigned char iv[EVP_MAX_IV_LENGTH];\n\t} EVP_CIPHER_INFO;\n\nstruct evp_cipher_ctx_st\n\t{\n\tconst EVP_CIPHER *cipher;\n\tENGINE *engine;\t/* functional reference if 'cipher' is ENGINE-provided */\n\tint encrypt;\t\t/* encrypt or decrypt */\n\tint buf_len;\t\t/* number we have left */\n\n\tunsigned char  oiv[EVP_MAX_IV_LENGTH];\t/* original iv */\n\tunsigned char  iv[EVP_MAX_IV_LENGTH];\t/* working iv */\n\tunsigned char buf[EVP_MAX_BLOCK_LENGTH];/* saved partial block */\n\tint num;\t\t\t\t/* used by cfb/ofb mode */\n\n\tvoid *app_data;\t\t/* application stuff */\n\tint key_len;\t\t/* May change for variable length cipher */\n\tunsigned long flags;\t/* Various flags */\n\tvoid *cipher_data; /* per EVP data */\n\tint final_used;\n\tint block_mask;\n\tunsigned char final[EVP_MAX_BLOCK_LENGTH];/* possible final block */\n\t} /* EVP_CIPHER_CTX */;\n\ntypedef struct evp_Encode_Ctx_st\n\t{\n\tint num;\t/* number saved in a partial encode/decode */\n\tint length;\t/* The length is either the output line length\n\t\t\t * (in input bytes) or the shortest input line\n\t\t\t * length that is ok.  Once decoding begins,\n\t\t\t * the length is adjusted up each time a longer\n\t\t\t * line is decoded */\n\tunsigned char enc_data[80];\t/* data to encode */\n\tint line_num;\t/* number read on current line */\n\tint expect_nl;\n\t} EVP_ENCODE_CTX;\n\n/* Password based encryption function */\ntypedef int (EVP_PBE_KEYGEN)(EVP_CIPHER_CTX *ctx, const char *pass, int passlen,\n\t\tASN1_TYPE *param, const EVP_CIPHER *cipher,\n                const EVP_MD *md, int en_de);\n\n#ifndef OPENSSL_NO_RSA\n#define EVP_PKEY_assign_RSA(pkey,rsa) EVP_PKEY_assign((pkey),EVP_PKEY_RSA,\\\n\t\t\t\t\t(char *)(rsa))\n#endif\n\n#ifndef OPENSSL_NO_DSA\n#define EVP_PKEY_assign_DSA(pkey,dsa) EVP_PKEY_assign((pkey),EVP_PKEY_DSA,\\\n\t\t\t\t\t(char *)(dsa))\n#endif\n\n#ifndef OPENSSL_NO_DH\n#define EVP_PKEY_assign_DH(pkey,dh) EVP_PKEY_assign((pkey),EVP_PKEY_DH,\\\n\t\t\t\t\t(char *)(dh))\n#endif\n\n#ifndef OPENSSL_NO_EC\n#define EVP_PKEY_assign_EC_KEY(pkey,eckey) EVP_PKEY_assign((pkey),EVP_PKEY_EC,\\\n                                        (char *)(eckey))\n#endif\n\n/* Add some extra combinations */\n#define EVP_get_digestbynid(a) EVP_get_digestbyname(OBJ_nid2sn(a))\n#define EVP_get_digestbyobj(a) EVP_get_digestbynid(OBJ_obj2nid(a))\n#define EVP_get_cipherbynid(a) EVP_get_cipherbyname(OBJ_nid2sn(a))\n#define EVP_get_cipherbyobj(a) EVP_get_cipherbynid(OBJ_obj2nid(a))\n\n/* Macros to reduce FIPS dependencies: do NOT use in applications */\n#define M_EVP_MD_size(e)\t\t((e)->md_size)\n#define M_EVP_MD_block_size(e)\t\t((e)->block_size)\n#define M_EVP_MD_CTX_set_flags(ctx,flgs) ((ctx)->flags|=(flgs))\n#define M_EVP_MD_CTX_clear_flags(ctx,flgs) ((ctx)->flags&=~(flgs))\n#define M_EVP_MD_CTX_test_flags(ctx,flgs) ((ctx)->flags&(flgs))\n#define M_EVP_MD_type(e)\t\t\t((e)->type)\n#define M_EVP_MD_CTX_type(e)\t\tM_EVP_MD_type(M_EVP_MD_CTX_md(e))\n#define M_EVP_MD_CTX_md(e)\t\t\t((e)->digest)\n\n#define M_EVP_CIPHER_CTX_set_flags(ctx,flgs) ((ctx)->flags|=(flgs))\n\nint EVP_MD_type(const EVP_MD *md);\n#define EVP_MD_nid(e)\t\t\tEVP_MD_type(e)\n#define EVP_MD_name(e)\t\t\tOBJ_nid2sn(EVP_MD_nid(e))\nint EVP_MD_pkey_type(const EVP_MD *md);\t\nint EVP_MD_size(const EVP_MD *md);\nint EVP_MD_block_size(const EVP_MD *md);\n\nconst EVP_MD * EVP_MD_CTX_md(const EVP_MD_CTX *ctx);\n#define EVP_MD_CTX_size(e)\t\tEVP_MD_size(EVP_MD_CTX_md(e))\n#define EVP_MD_CTX_block_size(e)\tEVP_MD_block_size(EVP_MD_CTX_md(e))\n#define EVP_MD_CTX_type(e)\t\tEVP_MD_type(EVP_MD_CTX_md(e))\n\nint EVP_CIPHER_nid(const EVP_CIPHER *cipher);\n#define EVP_CIPHER_name(e)\t\tOBJ_nid2sn(EVP_CIPHER_nid(e))\nint EVP_CIPHER_block_size(const EVP_CIPHER *cipher);\nint EVP_CIPHER_key_length(const EVP_CIPHER *cipher);\nint EVP_CIPHER_iv_length(const EVP_CIPHER *cipher);\nunsigned long EVP_CIPHER_flags(const EVP_CIPHER *cipher);\n#define EVP_CIPHER_mode(e)\t\t(EVP_CIPHER_flags(e) & EVP_CIPH_MODE)\n\nconst EVP_CIPHER * EVP_CIPHER_CTX_cipher(const EVP_CIPHER_CTX *ctx);\nint EVP_CIPHER_CTX_nid(const EVP_CIPHER_CTX *ctx);\nint EVP_CIPHER_CTX_block_size(const EVP_CIPHER_CTX *ctx);\nint EVP_CIPHER_CTX_key_length(const EVP_CIPHER_CTX *ctx);\nint EVP_CIPHER_CTX_iv_length(const EVP_CIPHER_CTX *ctx);\nvoid * EVP_CIPHER_CTX_get_app_data(const EVP_CIPHER_CTX *ctx);\nvoid EVP_CIPHER_CTX_set_app_data(EVP_CIPHER_CTX *ctx, void *data);\n#define EVP_CIPHER_CTX_type(c)         EVP_CIPHER_type(EVP_CIPHER_CTX_cipher(c))\nunsigned long EVP_CIPHER_CTX_flags(const EVP_CIPHER_CTX *ctx);\n#define EVP_CIPHER_CTX_mode(e)\t\t(EVP_CIPHER_CTX_flags(e) & EVP_CIPH_MODE)\n\n#define EVP_ENCODE_LENGTH(l)\t(((l+2)/3*4)+(l/48+1)*2+80)\n#define EVP_DECODE_LENGTH(l)\t((l+3)/4*3+80)\n\n#define EVP_SignInit_ex(a,b,c)\t\tEVP_DigestInit_ex(a,b,c)\n#define EVP_SignInit(a,b)\t\tEVP_DigestInit(a,b)\n#define EVP_SignUpdate(a,b,c)\t\tEVP_DigestUpdate(a,b,c)\n#define\tEVP_VerifyInit_ex(a,b,c)\tEVP_DigestInit_ex(a,b,c)\n#define\tEVP_VerifyInit(a,b)\t\tEVP_DigestInit(a,b)\n#define\tEVP_VerifyUpdate(a,b,c)\t\tEVP_DigestUpdate(a,b,c)\n#define EVP_OpenUpdate(a,b,c,d,e)\tEVP_DecryptUpdate(a,b,c,d,e)\n#define EVP_SealUpdate(a,b,c,d,e)\tEVP_EncryptUpdate(a,b,c,d,e)\t\n\n#ifdef CONST_STRICT\nvoid BIO_set_md(BIO *,const EVP_MD *md);\n#else\n# define BIO_set_md(b,md)\t\tBIO_ctrl(b,BIO_C_SET_MD,0,(char *)md)\n#endif\n#define BIO_get_md(b,mdp)\t\tBIO_ctrl(b,BIO_C_GET_MD,0,(char *)mdp)\n#define BIO_get_md_ctx(b,mdcp)     BIO_ctrl(b,BIO_C_GET_MD_CTX,0,(char *)mdcp)\n#define BIO_set_md_ctx(b,mdcp)     BIO_ctrl(b,BIO_C_SET_MD_CTX,0,(char *)mdcp)\n#define BIO_get_cipher_status(b)\tBIO_ctrl(b,BIO_C_GET_CIPHER_STATUS,0,NULL)\n#define BIO_get_cipher_ctx(b,c_pp)\tBIO_ctrl(b,BIO_C_GET_CIPHER_CTX,0,(char *)c_pp)\n\nint EVP_Cipher(EVP_CIPHER_CTX *c,\n\t\tunsigned char *out,\n\t\tconst unsigned char *in,\n\t\tunsigned int inl);\n\n#define EVP_add_cipher_alias(n,alias) \\\n\tOBJ_NAME_add((alias),OBJ_NAME_TYPE_CIPHER_METH|OBJ_NAME_ALIAS,(n))\n#define EVP_add_digest_alias(n,alias) \\\n\tOBJ_NAME_add((alias),OBJ_NAME_TYPE_MD_METH|OBJ_NAME_ALIAS,(n))\n#define EVP_delete_cipher_alias(alias) \\\n\tOBJ_NAME_remove(alias,OBJ_NAME_TYPE_CIPHER_METH|OBJ_NAME_ALIAS);\n#define EVP_delete_digest_alias(alias) \\\n\tOBJ_NAME_remove(alias,OBJ_NAME_TYPE_MD_METH|OBJ_NAME_ALIAS);\n\nvoid\tEVP_MD_CTX_init(EVP_MD_CTX *ctx);\nint\tEVP_MD_CTX_cleanup(EVP_MD_CTX *ctx);\nEVP_MD_CTX *EVP_MD_CTX_create(void);\nvoid\tEVP_MD_CTX_destroy(EVP_MD_CTX *ctx);\nint     EVP_MD_CTX_copy_ex(EVP_MD_CTX *out,const EVP_MD_CTX *in);  \nvoid\tEVP_MD_CTX_set_flags(EVP_MD_CTX *ctx, int flags);\nvoid\tEVP_MD_CTX_clear_flags(EVP_MD_CTX *ctx, int flags);\nint \tEVP_MD_CTX_test_flags(const EVP_MD_CTX *ctx,int flags);\nint\tEVP_DigestInit_ex(EVP_MD_CTX *ctx, const EVP_MD *type, ENGINE *impl);\nint\tEVP_DigestUpdate(EVP_MD_CTX *ctx,const void *d,\n\t\t\t size_t cnt);\nint\tEVP_DigestFinal_ex(EVP_MD_CTX *ctx,unsigned char *md,unsigned int *s);\nint\tEVP_Digest(const void *data, size_t count,\n\t\tunsigned char *md, unsigned int *size, const EVP_MD *type, ENGINE *impl);\n\nint     EVP_MD_CTX_copy(EVP_MD_CTX *out,const EVP_MD_CTX *in);  \nint\tEVP_DigestInit(EVP_MD_CTX *ctx, const EVP_MD *type);\nint\tEVP_DigestFinal(EVP_MD_CTX *ctx,unsigned char *md,unsigned int *s);\n\nint\tEVP_read_pw_string(char *buf,int length,const char *prompt,int verify);\nvoid\tEVP_set_pw_prompt(const char *prompt);\nchar *\tEVP_get_pw_prompt(void);\n\nint\tEVP_BytesToKey(const EVP_CIPHER *type,const EVP_MD *md,\n\t\tconst unsigned char *salt, const unsigned char *data,\n\t\tint datal, int count, unsigned char *key,unsigned char *iv);\n\nvoid\tEVP_CIPHER_CTX_set_flags(EVP_CIPHER_CTX *ctx, int flags);\nvoid\tEVP_CIPHER_CTX_clear_flags(EVP_CIPHER_CTX *ctx, int flags);\nint \tEVP_CIPHER_CTX_test_flags(const EVP_CIPHER_CTX *ctx,int flags);\n\nint\tEVP_EncryptInit(EVP_CIPHER_CTX *ctx,const EVP_CIPHER *cipher,\n\t\tconst unsigned char *key, const unsigned char *iv);\nint\tEVP_EncryptInit_ex(EVP_CIPHER_CTX *ctx,const EVP_CIPHER *cipher, ENGINE *impl,\n\t\tconst unsigned char *key, const unsigned char *iv);\nint\tEVP_EncryptUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out,\n\t\tint *outl, const unsigned char *in, int inl);\nint\tEVP_EncryptFinal_ex(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl);\nint\tEVP_EncryptFinal(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl);\n\nint\tEVP_DecryptInit(EVP_CIPHER_CTX *ctx,const EVP_CIPHER *cipher,\n\t\tconst unsigned char *key, const unsigned char *iv);\nint\tEVP_DecryptInit_ex(EVP_CIPHER_CTX *ctx,const EVP_CIPHER *cipher, ENGINE *impl,\n\t\tconst unsigned char *key, const unsigned char *iv);\nint\tEVP_DecryptUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out,\n\t\tint *outl, const unsigned char *in, int inl);\nint\tEVP_DecryptFinal(EVP_CIPHER_CTX *ctx, unsigned char *outm, int *outl);\nint\tEVP_DecryptFinal_ex(EVP_CIPHER_CTX *ctx, unsigned char *outm, int *outl);\n\nint\tEVP_CipherInit(EVP_CIPHER_CTX *ctx,const EVP_CIPHER *cipher,\n\t\t       const unsigned char *key,const unsigned char *iv,\n\t\t       int enc);\nint\tEVP_CipherInit_ex(EVP_CIPHER_CTX *ctx,const EVP_CIPHER *cipher, ENGINE *impl,\n\t\t       const unsigned char *key,const unsigned char *iv,\n\t\t       int enc);\nint\tEVP_CipherUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out,\n\t\tint *outl, const unsigned char *in, int inl);\nint\tEVP_CipherFinal(EVP_CIPHER_CTX *ctx, unsigned char *outm, int *outl);\nint\tEVP_CipherFinal_ex(EVP_CIPHER_CTX *ctx, unsigned char *outm, int *outl);\n\nint\tEVP_SignFinal(EVP_MD_CTX *ctx,unsigned char *md,unsigned int *s,\n\t\tEVP_PKEY *pkey);\n\nint\tEVP_VerifyFinal(EVP_MD_CTX *ctx,const unsigned char *sigbuf,\n\t\tunsigned int siglen,EVP_PKEY *pkey);\n\nint\tEVP_OpenInit(EVP_CIPHER_CTX *ctx,const EVP_CIPHER *type,\n\t\tconst unsigned char *ek, int ekl, const unsigned char *iv,\n\t\tEVP_PKEY *priv);\nint\tEVP_OpenFinal(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl);\n\nint\tEVP_SealInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *type,\n\t\t unsigned char **ek, int *ekl, unsigned char *iv,\n\t\tEVP_PKEY **pubk, int npubk);\nint\tEVP_SealFinal(EVP_CIPHER_CTX *ctx,unsigned char *out,int *outl);\n\nvoid\tEVP_EncodeInit(EVP_ENCODE_CTX *ctx);\nvoid\tEVP_EncodeUpdate(EVP_ENCODE_CTX *ctx,unsigned char *out,int *outl,\n\t\tconst unsigned char *in,int inl);\nvoid\tEVP_EncodeFinal(EVP_ENCODE_CTX *ctx,unsigned char *out,int *outl);\nint\tEVP_EncodeBlock(unsigned char *t, const unsigned char *f, int n);\n\nvoid\tEVP_DecodeInit(EVP_ENCODE_CTX *ctx);\nint\tEVP_DecodeUpdate(EVP_ENCODE_CTX *ctx,unsigned char *out,int *outl,\n\t\tconst unsigned char *in, int inl);\nint\tEVP_DecodeFinal(EVP_ENCODE_CTX *ctx, unsigned\n\t\tchar *out, int *outl);\nint\tEVP_DecodeBlock(unsigned char *t, const unsigned char *f, int n);\n\nvoid EVP_CIPHER_CTX_init(EVP_CIPHER_CTX *a);\nint EVP_CIPHER_CTX_cleanup(EVP_CIPHER_CTX *a);\nEVP_CIPHER_CTX *EVP_CIPHER_CTX_new(void);\nvoid EVP_CIPHER_CTX_free(EVP_CIPHER_CTX *a);\nint EVP_CIPHER_CTX_set_key_length(EVP_CIPHER_CTX *x, int keylen);\nint EVP_CIPHER_CTX_set_padding(EVP_CIPHER_CTX *c, int pad);\nint EVP_CIPHER_CTX_ctrl(EVP_CIPHER_CTX *ctx, int type, int arg, void *ptr);\nint EVP_CIPHER_CTX_rand_key(EVP_CIPHER_CTX *ctx, unsigned char *key);\n\n#ifndef OPENSSL_NO_BIO\nBIO_METHOD *BIO_f_md(void);\nBIO_METHOD *BIO_f_base64(void);\nBIO_METHOD *BIO_f_cipher(void);\nBIO_METHOD *BIO_f_reliable(void);\nvoid BIO_set_cipher(BIO *b,const EVP_CIPHER *c,const unsigned char *k,\n\t\tconst unsigned char *i, int enc);\n#endif\n\nconst EVP_MD *EVP_md_null(void);\n#ifndef OPENSSL_NO_MD2\nconst EVP_MD *EVP_md2(void);\n#endif\n#ifndef OPENSSL_NO_MD4\nconst EVP_MD *EVP_md4(void);\n#endif\n#ifndef OPENSSL_NO_MD5\nconst EVP_MD *EVP_md5(void);\n#endif\n#ifndef OPENSSL_NO_SHA\nconst EVP_MD *EVP_sha(void);\nconst EVP_MD *EVP_sha1(void);\nconst EVP_MD *EVP_dss(void);\nconst EVP_MD *EVP_dss1(void);\nconst EVP_MD *EVP_ecdsa(void);\n#endif\n#ifndef OPENSSL_NO_SHA256\nconst EVP_MD *EVP_sha224(void);\nconst EVP_MD *EVP_sha256(void);\n#endif\n#ifndef OPENSSL_NO_SHA512\nconst EVP_MD *EVP_sha384(void);\nconst EVP_MD *EVP_sha512(void);\n#endif\n#ifndef OPENSSL_NO_MDC2\nconst EVP_MD *EVP_mdc2(void);\n#endif\n#ifndef OPENSSL_NO_RIPEMD\nconst EVP_MD *EVP_ripemd160(void);\n#endif\nconst EVP_CIPHER *EVP_enc_null(void);\t\t/* does nothing :-) */\n#ifndef OPENSSL_NO_DES\nconst EVP_CIPHER *EVP_des_ecb(void);\nconst EVP_CIPHER *EVP_des_ede(void);\nconst EVP_CIPHER *EVP_des_ede3(void);\nconst EVP_CIPHER *EVP_des_ede_ecb(void);\nconst EVP_CIPHER *EVP_des_ede3_ecb(void);\nconst EVP_CIPHER *EVP_des_cfb64(void);\n# define EVP_des_cfb EVP_des_cfb64\nconst EVP_CIPHER *EVP_des_cfb1(void);\nconst EVP_CIPHER *EVP_des_cfb8(void);\nconst EVP_CIPHER *EVP_des_ede_cfb64(void);\n# define EVP_des_ede_cfb EVP_des_ede_cfb64\n#if 0\nconst EVP_CIPHER *EVP_des_ede_cfb1(void);\nconst EVP_CIPHER *EVP_des_ede_cfb8(void);\n#endif\nconst EVP_CIPHER *EVP_des_ede3_cfb64(void);\n# define EVP_des_ede3_cfb EVP_des_ede3_cfb64\nconst EVP_CIPHER *EVP_des_ede3_cfb1(void);\nconst EVP_CIPHER *EVP_des_ede3_cfb8(void);\nconst EVP_CIPHER *EVP_des_ofb(void);\nconst EVP_CIPHER *EVP_des_ede_ofb(void);\nconst EVP_CIPHER *EVP_des_ede3_ofb(void);\nconst EVP_CIPHER *EVP_des_cbc(void);\nconst EVP_CIPHER *EVP_des_ede_cbc(void);\nconst EVP_CIPHER *EVP_des_ede3_cbc(void);\nconst EVP_CIPHER *EVP_desx_cbc(void);\n/* This should now be supported through the dev_crypto ENGINE. But also, why are\n * rc4 and md5 declarations made here inside a \"NO_DES\" precompiler branch? */\n#if 0\n# ifdef OPENSSL_OPENBSD_DEV_CRYPTO\nconst EVP_CIPHER *EVP_dev_crypto_des_ede3_cbc(void);\nconst EVP_CIPHER *EVP_dev_crypto_rc4(void);\nconst EVP_MD *EVP_dev_crypto_md5(void);\n# endif\n#endif\n#endif\n#ifndef OPENSSL_NO_RC4\nconst EVP_CIPHER *EVP_rc4(void);\nconst EVP_CIPHER *EVP_rc4_40(void);\n#endif\n#ifndef OPENSSL_NO_RC2\nconst EVP_CIPHER *EVP_rc2_ecb(void);\nconst EVP_CIPHER *EVP_rc2_cbc(void);\nconst EVP_CIPHER *EVP_rc2_40_cbc(void);\nconst EVP_CIPHER *EVP_rc2_64_cbc(void);\nconst EVP_CIPHER *EVP_rc2_cfb64(void);\n# define EVP_rc2_cfb EVP_rc2_cfb64\nconst EVP_CIPHER *EVP_rc2_ofb(void);\n#endif\n#ifndef OPENSSL_NO_BF\nconst EVP_CIPHER *EVP_bf_ecb(void);\nconst EVP_CIPHER *EVP_bf_cbc(void);\nconst EVP_CIPHER *EVP_bf_cfb64(void);\n# define EVP_bf_cfb EVP_bf_cfb64\nconst EVP_CIPHER *EVP_bf_ofb(void);\n#endif\n#ifndef OPENSSL_NO_CAST\nconst EVP_CIPHER *EVP_cast5_ecb(void);\nconst EVP_CIPHER *EVP_cast5_cbc(void);\nconst EVP_CIPHER *EVP_cast5_cfb64(void);\n# define EVP_cast5_cfb EVP_cast5_cfb64\nconst EVP_CIPHER *EVP_cast5_ofb(void);\n#endif\n#ifndef OPENSSL_NO_RC5\nconst EVP_CIPHER *EVP_rc5_32_12_16_cbc(void);\nconst EVP_CIPHER *EVP_rc5_32_12_16_ecb(void);\nconst EVP_CIPHER *EVP_rc5_32_12_16_cfb64(void);\n# define EVP_rc5_32_12_16_cfb EVP_rc5_32_12_16_cfb64\nconst EVP_CIPHER *EVP_rc5_32_12_16_ofb(void);\n#endif\n#ifndef OPENSSL_NO_AES\nconst EVP_CIPHER *EVP_aes_128_ecb(void);\nconst EVP_CIPHER *EVP_aes_128_cbc(void);\nconst EVP_CIPHER *EVP_aes_128_cfb1(void);\nconst EVP_CIPHER *EVP_aes_128_cfb8(void);\nconst EVP_CIPHER *EVP_aes_128_cfb128(void);\n# define EVP_aes_128_cfb EVP_aes_128_cfb128\nconst EVP_CIPHER *EVP_aes_128_ofb(void);\n#if 0\nconst EVP_CIPHER *EVP_aes_128_ctr(void);\n#endif\nconst EVP_CIPHER *EVP_aes_192_ecb(void);\nconst EVP_CIPHER *EVP_aes_192_cbc(void);\nconst EVP_CIPHER *EVP_aes_192_cfb1(void);\nconst EVP_CIPHER *EVP_aes_192_cfb8(void);\nconst EVP_CIPHER *EVP_aes_192_cfb128(void);\n# define EVP_aes_192_cfb EVP_aes_192_cfb128\nconst EVP_CIPHER *EVP_aes_192_ofb(void);\n#if 0\nconst EVP_CIPHER *EVP_aes_192_ctr(void);\n#endif\nconst EVP_CIPHER *EVP_aes_256_ecb(void);\nconst EVP_CIPHER *EVP_aes_256_cbc(void);\nconst EVP_CIPHER *EVP_aes_256_cfb1(void);\nconst EVP_CIPHER *EVP_aes_256_cfb8(void);\nconst EVP_CIPHER *EVP_aes_256_cfb128(void);\n# define EVP_aes_256_cfb EVP_aes_256_cfb128\nconst EVP_CIPHER *EVP_aes_256_ofb(void);\n#if 0\nconst EVP_CIPHER *EVP_aes_256_ctr(void);\n#endif\n#endif\n#ifndef OPENSSL_NO_CAMELLIA\nconst EVP_CIPHER *EVP_camellia_128_ecb(void);\nconst EVP_CIPHER *EVP_camellia_128_cbc(void);\nconst EVP_CIPHER *EVP_camellia_128_cfb1(void);\nconst EVP_CIPHER *EVP_camellia_128_cfb8(void);\nconst EVP_CIPHER *EVP_camellia_128_cfb128(void);\n# define EVP_camellia_128_cfb EVP_camellia_128_cfb128\nconst EVP_CIPHER *EVP_camellia_128_ofb(void);\nconst EVP_CIPHER *EVP_camellia_192_ecb(void);\nconst EVP_CIPHER *EVP_camellia_192_cbc(void);\nconst EVP_CIPHER *EVP_camellia_192_cfb1(void);\nconst EVP_CIPHER *EVP_camellia_192_cfb8(void);\nconst EVP_CIPHER *EVP_camellia_192_cfb128(void);\n# define EVP_camellia_192_cfb EVP_camellia_192_cfb128\nconst EVP_CIPHER *EVP_camellia_192_ofb(void);\nconst EVP_CIPHER *EVP_camellia_256_ecb(void);\nconst EVP_CIPHER *EVP_camellia_256_cbc(void);\nconst EVP_CIPHER *EVP_camellia_256_cfb1(void);\nconst EVP_CIPHER *EVP_camellia_256_cfb8(void);\nconst EVP_CIPHER *EVP_camellia_256_cfb128(void);\n# define EVP_camellia_256_cfb EVP_camellia_256_cfb128\nconst EVP_CIPHER *EVP_camellia_256_ofb(void);\n#endif\n\n#ifndef OPENSSL_NO_SEED\nconst EVP_CIPHER *EVP_seed_ecb(void);\nconst EVP_CIPHER *EVP_seed_cbc(void);\nconst EVP_CIPHER *EVP_seed_cfb128(void);\n# define EVP_seed_cfb EVP_seed_cfb128\nconst EVP_CIPHER *EVP_seed_ofb(void);\n#endif\n\nvoid OPENSSL_add_all_algorithms_noconf(void);\nvoid OPENSSL_add_all_algorithms_conf(void);\n\n#ifdef OPENSSL_LOAD_CONF\n#define OpenSSL_add_all_algorithms() \\\n\t\tOPENSSL_add_all_algorithms_conf()\n#else\n#define OpenSSL_add_all_algorithms() \\\n\t\tOPENSSL_add_all_algorithms_noconf()\n#endif\n\nvoid OpenSSL_add_all_ciphers(void);\nvoid OpenSSL_add_all_digests(void);\n#define SSLeay_add_all_algorithms() OpenSSL_add_all_algorithms()\n#define SSLeay_add_all_ciphers() OpenSSL_add_all_ciphers()\n#define SSLeay_add_all_digests() OpenSSL_add_all_digests()\n\nint EVP_add_cipher(const EVP_CIPHER *cipher);\nint EVP_add_digest(const EVP_MD *digest);\n\nconst EVP_CIPHER *EVP_get_cipherbyname(const char *name);\nconst EVP_MD *EVP_get_digestbyname(const char *name);\nvoid EVP_cleanup(void);\n\nint\t\tEVP_PKEY_decrypt(unsigned char *dec_key,\n\t\t\tconst unsigned char *enc_key,int enc_key_len,\n\t\t\tEVP_PKEY *private_key);\nint\t\tEVP_PKEY_encrypt(unsigned char *enc_key,\n\t\t\tconst unsigned char *key,int key_len,\n\t\t\tEVP_PKEY *pub_key);\nint\t\tEVP_PKEY_type(int type);\nint\t\tEVP_PKEY_bits(EVP_PKEY *pkey);\nint\t\tEVP_PKEY_size(EVP_PKEY *pkey);\nint \t\tEVP_PKEY_assign(EVP_PKEY *pkey,int type,char *key);\n\n#ifndef OPENSSL_NO_RSA\nstruct rsa_st;\nint EVP_PKEY_set1_RSA(EVP_PKEY *pkey,struct rsa_st *key);\nstruct rsa_st *EVP_PKEY_get1_RSA(EVP_PKEY *pkey);\n#endif\n#ifndef OPENSSL_NO_DSA\nstruct dsa_st;\nint EVP_PKEY_set1_DSA(EVP_PKEY *pkey,struct dsa_st *key);\nstruct dsa_st *EVP_PKEY_get1_DSA(EVP_PKEY *pkey);\n#endif\n#ifndef OPENSSL_NO_DH\nstruct dh_st;\nint EVP_PKEY_set1_DH(EVP_PKEY *pkey,struct dh_st *key);\nstruct dh_st *EVP_PKEY_get1_DH(EVP_PKEY *pkey);\n#endif\n#ifndef OPENSSL_NO_EC\nstruct ec_key_st;\nint EVP_PKEY_set1_EC_KEY(EVP_PKEY *pkey,struct ec_key_st *key);\nstruct ec_key_st *EVP_PKEY_get1_EC_KEY(EVP_PKEY *pkey);\n#endif\n\nEVP_PKEY *\tEVP_PKEY_new(void);\nvoid\t\tEVP_PKEY_free(EVP_PKEY *pkey);\n\nEVP_PKEY *\td2i_PublicKey(int type,EVP_PKEY **a, const unsigned char **pp,\n\t\t\tlong length);\nint\t\ti2d_PublicKey(EVP_PKEY *a, unsigned char **pp);\n\nEVP_PKEY *\td2i_PrivateKey(int type,EVP_PKEY **a, const unsigned char **pp,\n\t\t\tlong length);\nEVP_PKEY *\td2i_AutoPrivateKey(EVP_PKEY **a, const unsigned char **pp,\n\t\t\tlong length);\nint\t\ti2d_PrivateKey(EVP_PKEY *a, unsigned char **pp);\n\nint EVP_PKEY_copy_parameters(EVP_PKEY *to, const EVP_PKEY *from);\nint EVP_PKEY_missing_parameters(const EVP_PKEY *pkey);\nint EVP_PKEY_save_parameters(EVP_PKEY *pkey,int mode);\nint EVP_PKEY_cmp_parameters(const EVP_PKEY *a, const EVP_PKEY *b);\n\nint EVP_PKEY_cmp(const EVP_PKEY *a, const EVP_PKEY *b);\n\nint EVP_CIPHER_type(const EVP_CIPHER *ctx);\n\n/* calls methods */\nint EVP_CIPHER_param_to_asn1(EVP_CIPHER_CTX *c, ASN1_TYPE *type);\nint EVP_CIPHER_asn1_to_param(EVP_CIPHER_CTX *c, ASN1_TYPE *type);\n\n/* These are used by EVP_CIPHER methods */\nint EVP_CIPHER_set_asn1_iv(EVP_CIPHER_CTX *c,ASN1_TYPE *type);\nint EVP_CIPHER_get_asn1_iv(EVP_CIPHER_CTX *c,ASN1_TYPE *type);\n\n/* PKCS5 password based encryption */\nint PKCS5_PBE_keyivgen(EVP_CIPHER_CTX *ctx, const char *pass, int passlen,\n\t\t\t ASN1_TYPE *param, const EVP_CIPHER *cipher, const EVP_MD *md,\n\t\t\t int en_de);\nint PKCS5_PBKDF2_HMAC_SHA1(const char *pass, int passlen,\n\t\t\t   const unsigned char *salt, int saltlen, int iter,\n\t\t\t   int keylen, unsigned char *out);\nint PKCS5_v2_PBE_keyivgen(EVP_CIPHER_CTX *ctx, const char *pass, int passlen,\n\t\t\t ASN1_TYPE *param, const EVP_CIPHER *cipher, const EVP_MD *md,\n\t\t\t int en_de);\n\nvoid PKCS5_PBE_add(void);\n\nint EVP_PBE_CipherInit (ASN1_OBJECT *pbe_obj, const char *pass, int passlen,\n\t     ASN1_TYPE *param, EVP_CIPHER_CTX *ctx, int en_de);\nint EVP_PBE_alg_add(int nid, const EVP_CIPHER *cipher, const EVP_MD *md,\n\t\t    EVP_PBE_KEYGEN *keygen);\nvoid EVP_PBE_cleanup(void);\n\n#ifdef OPENSSL_FIPS\n#ifndef OPENSSL_NO_ENGINE\nvoid int_EVP_MD_set_engine_callbacks(\n\tint (*eng_md_init)(ENGINE *impl),\n\tint (*eng_md_fin)(ENGINE *impl),\n\tint (*eng_md_evp)\n\t\t(EVP_MD_CTX *ctx, const EVP_MD **ptype, ENGINE *impl));\nvoid int_EVP_MD_init_engine_callbacks(void);\nvoid int_EVP_CIPHER_set_engine_callbacks(\n\tint (*eng_ciph_fin)(ENGINE *impl),\n\tint (*eng_ciph_evp)\n\t\t(EVP_CIPHER_CTX *ctx, const EVP_CIPHER **pciph, ENGINE *impl));\nvoid int_EVP_CIPHER_init_engine_callbacks(void);\n#endif\n#endif\n\nvoid EVP_add_alg_module(void);\n\n/* BEGIN ERROR CODES */\n/* The following lines are auto generated by the script mkerr.pl. Any changes\n * made after this point may be overwritten when the script is next run.\n */\nvoid ERR_load_EVP_strings(void);\n\n/* Error codes for the EVP functions. */\n\n/* Function codes. */\n#define EVP_F_AES_INIT_KEY\t\t\t\t 133\n#define EVP_F_ALG_MODULE_INIT\t\t\t\t 138\n#define EVP_F_CAMELLIA_INIT_KEY\t\t\t\t 159\n#define EVP_F_D2I_PKEY\t\t\t\t\t 100\n#define EVP_F_DO_EVP_ENC_ENGINE\t\t\t\t 140\n#define EVP_F_DO_EVP_ENC_ENGINE_FULL\t\t\t 141\n#define EVP_F_DO_EVP_MD_ENGINE\t\t\t\t 139\n#define EVP_F_DO_EVP_MD_ENGINE_FULL\t\t\t 142\n#define EVP_F_DSAPKEY2PKCS8\t\t\t\t 134\n#define EVP_F_DSA_PKEY2PKCS8\t\t\t\t 135\n#define EVP_F_ECDSA_PKEY2PKCS8\t\t\t\t 129\n#define EVP_F_ECKEY_PKEY2PKCS8\t\t\t\t 132\n#define EVP_F_EVP_CIPHERINIT\t\t\t\t 137\n#define EVP_F_EVP_CIPHERINIT_EX\t\t\t\t 123\n#define EVP_F_EVP_CIPHER_CTX_CTRL\t\t\t 124\n#define EVP_F_EVP_CIPHER_CTX_SET_KEY_LENGTH\t\t 122\n#define EVP_F_EVP_DECRYPTFINAL_EX\t\t\t 101\n#define EVP_F_EVP_DIGESTINIT\t\t\t\t 136\n#define EVP_F_EVP_DIGESTINIT_EX\t\t\t\t 128\n#define EVP_F_EVP_ENCRYPTFINAL_EX\t\t\t 127\n#define EVP_F_EVP_MD_CTX_COPY_EX\t\t\t 110\n#define EVP_F_EVP_OPENINIT\t\t\t\t 102\n#define EVP_F_EVP_PBE_ALG_ADD\t\t\t\t 115\n#define EVP_F_EVP_PBE_CIPHERINIT\t\t\t 116\n#define EVP_F_EVP_PKCS82PKEY\t\t\t\t 111\n#define EVP_F_EVP_PKEY2PKCS8_BROKEN\t\t\t 113\n#define EVP_F_EVP_PKEY_COPY_PARAMETERS\t\t\t 103\n#define EVP_F_EVP_PKEY_DECRYPT\t\t\t\t 104\n#define EVP_F_EVP_PKEY_ENCRYPT\t\t\t\t 105\n#define EVP_F_EVP_PKEY_GET1_DH\t\t\t\t 119\n#define EVP_F_EVP_PKEY_GET1_DSA\t\t\t\t 120\n#define EVP_F_EVP_PKEY_GET1_ECDSA\t\t\t 130\n#define EVP_F_EVP_PKEY_GET1_EC_KEY\t\t\t 131\n#define EVP_F_EVP_PKEY_GET1_RSA\t\t\t\t 121\n#define EVP_F_EVP_PKEY_NEW\t\t\t\t 106\n#define EVP_F_EVP_RIJNDAEL\t\t\t\t 126\n#define EVP_F_EVP_SIGNFINAL\t\t\t\t 107\n#define EVP_F_EVP_VERIFYFINAL\t\t\t\t 108\n#define EVP_F_PKCS5_PBE_KEYIVGEN\t\t\t 117\n#define EVP_F_PKCS5_V2_PBE_KEYIVGEN\t\t\t 118\n#define EVP_F_PKCS8_SET_BROKEN\t\t\t\t 112\n#define EVP_F_RC2_MAGIC_TO_METH\t\t\t\t 109\n#define EVP_F_RC5_CTRL\t\t\t\t\t 125\n\n/* Reason codes. */\n#define EVP_R_AES_KEY_SETUP_FAILED\t\t\t 143\n#define EVP_R_ASN1_LIB\t\t\t\t\t 140\n#define EVP_R_BAD_BLOCK_LENGTH\t\t\t\t 136\n#define EVP_R_BAD_DECRYPT\t\t\t\t 100\n#define EVP_R_BAD_KEY_LENGTH\t\t\t\t 137\n#define EVP_R_BN_DECODE_ERROR\t\t\t\t 112\n#define EVP_R_BN_PUBKEY_ERROR\t\t\t\t 113\n#define EVP_R_CAMELLIA_KEY_SETUP_FAILED\t\t\t 157\n#define EVP_R_CIPHER_PARAMETER_ERROR\t\t\t 122\n#define EVP_R_CTRL_NOT_IMPLEMENTED\t\t\t 132\n#define EVP_R_CTRL_OPERATION_NOT_IMPLEMENTED\t\t 133\n#define EVP_R_DATA_NOT_MULTIPLE_OF_BLOCK_LENGTH\t\t 138\n#define EVP_R_DECODE_ERROR\t\t\t\t 114\n#define EVP_R_DIFFERENT_KEY_TYPES\t\t\t 101\n#define EVP_R_DISABLED_FOR_FIPS\t\t\t\t 144\n#define EVP_R_ENCODE_ERROR\t\t\t\t 115\n#define EVP_R_ERROR_LOADING_SECTION\t\t\t 145\n#define EVP_R_ERROR_SETTING_FIPS_MODE\t\t\t 146\n#define EVP_R_EVP_PBE_CIPHERINIT_ERROR\t\t\t 119\n#define EVP_R_EXPECTING_AN_RSA_KEY\t\t\t 127\n#define EVP_R_EXPECTING_A_DH_KEY\t\t\t 128\n#define EVP_R_EXPECTING_A_DSA_KEY\t\t\t 129\n#define EVP_R_EXPECTING_A_ECDSA_KEY\t\t\t 141\n#define EVP_R_EXPECTING_A_EC_KEY\t\t\t 142\n#define EVP_R_FIPS_MODE_NOT_SUPPORTED\t\t\t 147\n#define EVP_R_INITIALIZATION_ERROR\t\t\t 134\n#define EVP_R_INPUT_NOT_INITIALIZED\t\t\t 111\n#define EVP_R_INVALID_FIPS_MODE\t\t\t\t 148\n#define EVP_R_INVALID_KEY_LENGTH\t\t\t 130\n#define EVP_R_IV_TOO_LARGE\t\t\t\t 102\n#define EVP_R_KEYGEN_FAILURE\t\t\t\t 120\n#define EVP_R_MISSING_PARAMETERS\t\t\t 103\n#define EVP_R_NO_CIPHER_SET\t\t\t\t 131\n#define EVP_R_NO_DIGEST_SET\t\t\t\t 139\n#define EVP_R_NO_DSA_PARAMETERS\t\t\t\t 116\n#define EVP_R_NO_SIGN_FUNCTION_CONFIGURED\t\t 104\n#define EVP_R_NO_VERIFY_FUNCTION_CONFIGURED\t\t 105\n#define EVP_R_PKCS8_UNKNOWN_BROKEN_TYPE\t\t\t 117\n#define EVP_R_PUBLIC_KEY_NOT_RSA\t\t\t 106\n#define EVP_R_UNKNOWN_OPTION\t\t\t\t 149\n#define EVP_R_UNKNOWN_PBE_ALGORITHM\t\t\t 121\n#define EVP_R_UNSUPORTED_NUMBER_OF_ROUNDS\t\t 135\n#define EVP_R_UNSUPPORTED_CIPHER\t\t\t 107\n#define EVP_R_UNSUPPORTED_KEYLENGTH\t\t\t 123\n#define EVP_R_UNSUPPORTED_KEY_DERIVATION_FUNCTION\t 124\n#define EVP_R_UNSUPPORTED_KEY_SIZE\t\t\t 108\n#define EVP_R_UNSUPPORTED_PRF\t\t\t\t 125\n#define EVP_R_UNSUPPORTED_PRIVATE_KEY_ALGORITHM\t\t 118\n#define EVP_R_UNSUPPORTED_SALT_TYPE\t\t\t 126\n#define EVP_R_WRONG_FINAL_BLOCK_LENGTH\t\t\t 109\n#define EVP_R_WRONG_PUBLIC_KEY_TYPE\t\t\t 110\n#define EVP_R_SEED_KEY_SETUP_FAILED\t\t\t 162\n\n#ifdef  __cplusplus\n}\n#endif\n#endif\n"
  },
  {
    "path": "freebsd-headers/openssl/fips.h",
    "content": "/* dummy fips.h */\n"
  },
  {
    "path": "freebsd-headers/openssl/fips_rand.h",
    "content": "/* dummy fips_rand.h */\n"
  },
  {
    "path": "freebsd-headers/openssl/hmac.h",
    "content": "/* crypto/hmac/hmac.h */\n/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)\n * All rights reserved.\n *\n * This package is an SSL implementation written\n * by Eric Young (eay@cryptsoft.com).\n * The implementation was written so as to conform with Netscapes SSL.\n * \n * This library is free for commercial and non-commercial use as long as\n * the following conditions are aheared to.  The following conditions\n * apply to all code found in this distribution, be it the RC4, RSA,\n * lhash, DES, etc., code; not just the SSL code.  The SSL documentation\n * included with this distribution is covered by the same copyright terms\n * except that the holder is Tim Hudson (tjh@cryptsoft.com).\n * \n * Copyright remains Eric Young's, and as such any Copyright notices in\n * the code are not to be removed.\n * If this package is used in a product, Eric Young should be given attribution\n * as the author of the parts of the library used.\n * This can be in the form of a textual message at program startup or\n * in documentation (online or textual) provided with the package.\n * \n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. All advertising materials mentioning features or use of this software\n *    must display the following acknowledgement:\n *    \"This product includes cryptographic software written by\n *     Eric Young (eay@cryptsoft.com)\"\n *    The word 'cryptographic' can be left out if the rouines from the library\n *    being used are not cryptographic related :-).\n * 4. If you include any Windows specific code (or a derivative thereof) from \n *    the apps directory (application code) you must include an acknowledgement:\n *    \"This product includes software written by Tim Hudson (tjh@cryptsoft.com)\"\n * \n * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n * \n * The licence and distribution terms for any publically available version or\n * derivative of this code cannot be changed.  i.e. this code cannot simply be\n * copied and put under another distribution licence\n * [including the GNU Public Licence.]\n */\n#ifndef HEADER_HMAC_H\n#define HEADER_HMAC_H\n\n#include <openssl/opensslconf.h>\n\n#ifdef OPENSSL_NO_HMAC\n#error HMAC is disabled.\n#endif\n\n#include <openssl/evp.h>\n\n#define HMAC_MAX_MD_CBLOCK\t128\t/* largest known is SHA512 */\n\n#ifdef  __cplusplus\nextern \"C\" {\n#endif\n\ntypedef struct hmac_ctx_st\n\t{\n\tconst EVP_MD *md;\n\tEVP_MD_CTX md_ctx;\n\tEVP_MD_CTX i_ctx;\n\tEVP_MD_CTX o_ctx;\n\tunsigned int key_length;\n\tunsigned char key[HMAC_MAX_MD_CBLOCK];\n\t} HMAC_CTX;\n\n#define HMAC_size(e)\t(EVP_MD_size((e)->md))\n\n\nvoid HMAC_CTX_init(HMAC_CTX *ctx);\nvoid HMAC_CTX_cleanup(HMAC_CTX *ctx);\n\n#define HMAC_cleanup(ctx) HMAC_CTX_cleanup(ctx) /* deprecated */\n\nvoid HMAC_Init(HMAC_CTX *ctx, const void *key, int len,\n\t       const EVP_MD *md); /* deprecated */\nvoid HMAC_Init_ex(HMAC_CTX *ctx, const void *key, int len,\n\t\t  const EVP_MD *md, ENGINE *impl);\nvoid HMAC_Update(HMAC_CTX *ctx, const unsigned char *data, size_t len);\nvoid HMAC_Final(HMAC_CTX *ctx, unsigned char *md, unsigned int *len);\nunsigned char *HMAC(const EVP_MD *evp_md, const void *key, int key_len,\n\t\t    const unsigned char *d, size_t n, unsigned char *md,\n\t\t    unsigned int *md_len);\n\nvoid HMAC_CTX_set_flags(HMAC_CTX *ctx, unsigned long flags);\n\n#ifdef  __cplusplus\n}\n#endif\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/openssl/krb5_asn.h",
    "content": "/* krb5_asn.h */\n/* Written by Vern Staats <staatsvr@asc.hpc.mil> for the OpenSSL project,\n** using ocsp/{*.h,*asn*.c} as a starting point\n*/\n\n/* ====================================================================\n * Copyright (c) 1998-2000 The OpenSSL Project.  All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n *\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer. \n *\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in\n *    the documentation and/or other materials provided with the\n *    distribution.\n *\n * 3. All advertising materials mentioning features or use of this\n *    software must display the following acknowledgment:\n *    \"This product includes software developed by the OpenSSL Project\n *    for use in the OpenSSL Toolkit. (http://www.openssl.org/)\"\n *\n * 4. The names \"OpenSSL Toolkit\" and \"OpenSSL Project\" must not be used to\n *    endorse or promote products derived from this software without\n *    prior written permission. For written permission, please contact\n *    openssl-core@openssl.org.\n *\n * 5. Products derived from this software may not be called \"OpenSSL\"\n *    nor may \"OpenSSL\" appear in their names without prior written\n *    permission of the OpenSSL Project.\n *\n * 6. Redistributions of any form whatsoever must retain the following\n *    acknowledgment:\n *    \"This product includes software developed by the OpenSSL Project\n *    for use in the OpenSSL Toolkit (http://www.openssl.org/)\"\n *\n * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY\n * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\n * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE OpenSSL PROJECT OR\n * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\n * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,\n * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED\n * OF THE POSSIBILITY OF SUCH DAMAGE.\n * ====================================================================\n *\n * This product includes cryptographic software written by Eric Young\n * (eay@cryptsoft.com).  This product includes software written by Tim\n * Hudson (tjh@cryptsoft.com).\n *\n */\n\n#ifndef HEADER_KRB5_ASN_H\n#define HEADER_KRB5_ASN_H\n\n/*\n#include <krb5.h>\n*/\n#include <openssl/safestack.h>\n\n#ifdef  __cplusplus\nextern \"C\" {\n#endif\n\n\n/*\tASN.1 from Kerberos RFC 1510\n*/\n\n/*\tEncryptedData ::=   SEQUENCE {\n**\t\tetype[0]                      INTEGER, -- EncryptionType\n**\t\tkvno[1]                       INTEGER OPTIONAL,\n**\t\tcipher[2]                     OCTET STRING -- ciphertext\n**\t}\n*/\ntypedef\tstruct\tkrb5_encdata_st\n\t{\n\tASN1_INTEGER\t\t\t*etype;\n\tASN1_INTEGER\t\t\t*kvno;\n\tASN1_OCTET_STRING\t\t*cipher;\n\t}\tKRB5_ENCDATA;\n\nDECLARE_STACK_OF(KRB5_ENCDATA)\n\n/*\tPrincipalName ::=   SEQUENCE {\n**\t\tname-type[0]                  INTEGER,\n**\t\tname-string[1]                SEQUENCE OF GeneralString\n**\t}\n*/\ntypedef\tstruct\tkrb5_princname_st\n\t{\n\tASN1_INTEGER\t\t\t*nametype;\n\tSTACK_OF(ASN1_GENERALSTRING)\t*namestring;\n\t}\tKRB5_PRINCNAME;\n\nDECLARE_STACK_OF(KRB5_PRINCNAME)\n\n\n/*\tTicket ::=\t[APPLICATION 1] SEQUENCE {\n**\t\ttkt-vno[0]                    INTEGER,\n**\t\trealm[1]                      Realm,\n**\t\tsname[2]                      PrincipalName,\n**\t\tenc-part[3]                   EncryptedData\n**\t}\n*/\ntypedef\tstruct\tkrb5_tktbody_st\n\t{\n\tASN1_INTEGER\t\t\t*tktvno;\n\tASN1_GENERALSTRING\t\t*realm;\n\tKRB5_PRINCNAME\t\t\t*sname;\n\tKRB5_ENCDATA\t\t\t*encdata;\n\t}\tKRB5_TKTBODY;\n\ntypedef STACK_OF(KRB5_TKTBODY) KRB5_TICKET;\nDECLARE_STACK_OF(KRB5_TKTBODY)\n\n\n/*\tAP-REQ ::=      [APPLICATION 14] SEQUENCE {\n**\t\tpvno[0]                       INTEGER,\n**\t\tmsg-type[1]                   INTEGER,\n**\t\tap-options[2]                 APOptions,\n**\t\tticket[3]                     Ticket,\n**\t\tauthenticator[4]              EncryptedData\n**\t}\n**\n**\tAPOptions ::=   BIT STRING {\n**\t\treserved(0), use-session-key(1), mutual-required(2) }\n*/\ntypedef\tstruct\tkrb5_ap_req_st\n\t{\n\tASN1_INTEGER\t\t\t*pvno;\n\tASN1_INTEGER\t\t\t*msgtype;\n\tASN1_BIT_STRING\t\t\t*apoptions;\n\tKRB5_TICKET\t\t\t*ticket;\n\tKRB5_ENCDATA\t\t\t*authenticator;\n\t}\tKRB5_APREQBODY;\n\ntypedef STACK_OF(KRB5_APREQBODY) KRB5_APREQ;\nDECLARE_STACK_OF(KRB5_APREQBODY)\n\n\n/*\tAuthenticator Stuff\t*/\n\n\n/*\tChecksum ::=   SEQUENCE {\n**\t\tcksumtype[0]                  INTEGER,\n**\t\tchecksum[1]                   OCTET STRING\n**\t}\n*/\ntypedef\tstruct\tkrb5_checksum_st\n\t{\n\tASN1_INTEGER\t\t\t*ctype;\n\tASN1_OCTET_STRING\t\t*checksum;\n\t}\tKRB5_CHECKSUM;\n\nDECLARE_STACK_OF(KRB5_CHECKSUM)\n\n\n/*\tEncryptionKey ::=   SEQUENCE {\n**\t\tkeytype[0]                    INTEGER,\n**\t\tkeyvalue[1]                   OCTET STRING\n**\t}\n*/\ntypedef struct  krb5_encryptionkey_st\n\t{\n\tASN1_INTEGER\t\t\t*ktype;\n\tASN1_OCTET_STRING\t\t*keyvalue;\n\t}\tKRB5_ENCKEY;\n\nDECLARE_STACK_OF(KRB5_ENCKEY)\n\n\n/*\tAuthorizationData ::=   SEQUENCE OF SEQUENCE {\n**\t\tad-type[0]                    INTEGER,\n**              ad-data[1]                    OCTET STRING\n**\t}\n*/\ntypedef struct\tkrb5_authorization_st\n\t{\n\tASN1_INTEGER\t\t\t*adtype;\n\tASN1_OCTET_STRING\t\t*addata;\n\t}\tKRB5_AUTHDATA;\n\nDECLARE_STACK_OF(KRB5_AUTHDATA)\n\n\t\t\t\n/*\t-- Unencrypted authenticator\n**\tAuthenticator ::=    [APPLICATION 2] SEQUENCE    {\n**\t\tauthenticator-vno[0]          INTEGER,\n**\t\tcrealm[1]                     Realm,\n**\t\tcname[2]                      PrincipalName,\n**\t\tcksum[3]                      Checksum OPTIONAL,\n**\t\tcusec[4]                      INTEGER,\n**\t\tctime[5]                      KerberosTime,\n**\t\tsubkey[6]                     EncryptionKey OPTIONAL,\n**\t\tseq-number[7]                 INTEGER OPTIONAL,\n**\t\tauthorization-data[8]         AuthorizationData OPTIONAL\n**\t}\n*/\ntypedef struct\tkrb5_authenticator_st\n\t{\n\tASN1_INTEGER\t\t\t*avno;\n\tASN1_GENERALSTRING\t\t*crealm;\n\tKRB5_PRINCNAME\t\t\t*cname;\n\tKRB5_CHECKSUM\t\t\t*cksum;\n\tASN1_INTEGER\t\t\t*cusec;\n\tASN1_GENERALIZEDTIME\t\t*ctime;\n\tKRB5_ENCKEY\t\t\t*subkey;\n\tASN1_INTEGER\t\t\t*seqnum;\n\tKRB5_AUTHDATA\t\t\t*authorization;\n\t}\tKRB5_AUTHENTBODY;\n\ntypedef STACK_OF(KRB5_AUTHENTBODY) KRB5_AUTHENT;\nDECLARE_STACK_OF(KRB5_AUTHENTBODY)\n\n\n/*  DECLARE_ASN1_FUNCTIONS(type) = DECLARE_ASN1_FUNCTIONS_name(type, type) =\n**\ttype *name##_new(void);\n**\tvoid name##_free(type *a);\n**\tDECLARE_ASN1_ENCODE_FUNCTIONS(type, name, name) =\n**\t DECLARE_ASN1_ENCODE_FUNCTIONS(type, itname, name) =\n**\t  type *d2i_##name(type **a, const unsigned char **in, long len);\n**\t  int i2d_##name(type *a, unsigned char **out);\n**\t  DECLARE_ASN1_ITEM(itname) = OPENSSL_EXTERN const ASN1_ITEM itname##_it\n*/\n\nDECLARE_ASN1_FUNCTIONS(KRB5_ENCDATA)\nDECLARE_ASN1_FUNCTIONS(KRB5_PRINCNAME)\nDECLARE_ASN1_FUNCTIONS(KRB5_TKTBODY)\nDECLARE_ASN1_FUNCTIONS(KRB5_APREQBODY)\nDECLARE_ASN1_FUNCTIONS(KRB5_TICKET)\nDECLARE_ASN1_FUNCTIONS(KRB5_APREQ)\n\nDECLARE_ASN1_FUNCTIONS(KRB5_CHECKSUM)\nDECLARE_ASN1_FUNCTIONS(KRB5_ENCKEY)\nDECLARE_ASN1_FUNCTIONS(KRB5_AUTHDATA)\nDECLARE_ASN1_FUNCTIONS(KRB5_AUTHENTBODY)\nDECLARE_ASN1_FUNCTIONS(KRB5_AUTHENT)\n\n\n/* BEGIN ERROR CODES */\n/* The following lines are auto generated by the script mkerr.pl. Any changes\n * made after this point may be overwritten when the script is next run.\n */\n\n#ifdef  __cplusplus\n}\n#endif\n#endif\n\n"
  },
  {
    "path": "freebsd-headers/openssl/kssl.h",
    "content": "/* ssl/kssl.h -*- mode: C; c-file-style: \"eay\" -*- */\n/* Written by Vern Staats <staatsvr@asc.hpc.mil> for the OpenSSL project 2000.\n * project 2000.\n */\n/* ====================================================================\n * Copyright (c) 2000 The OpenSSL Project.  All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n *\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer. \n *\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in\n *    the documentation and/or other materials provided with the\n *    distribution.\n *\n * 3. All advertising materials mentioning features or use of this\n *    software must display the following acknowledgment:\n *    \"This product includes software developed by the OpenSSL Project\n *    for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)\"\n *\n * 4. The names \"OpenSSL Toolkit\" and \"OpenSSL Project\" must not be used to\n *    endorse or promote products derived from this software without\n *    prior written permission. For written permission, please contact\n *    licensing@OpenSSL.org.\n *\n * 5. Products derived from this software may not be called \"OpenSSL\"\n *    nor may \"OpenSSL\" appear in their names without prior written\n *    permission of the OpenSSL Project.\n *\n * 6. Redistributions of any form whatsoever must retain the following\n *    acknowledgment:\n *    \"This product includes software developed by the OpenSSL Project\n *    for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)\"\n *\n * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY\n * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\n * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE OpenSSL PROJECT OR\n * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\n * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,\n * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED\n * OF THE POSSIBILITY OF SUCH DAMAGE.\n * ====================================================================\n *\n * This product includes cryptographic software written by Eric Young\n * (eay@cryptsoft.com).  This product includes software written by Tim\n * Hudson (tjh@cryptsoft.com).\n *\n */\n\n/*\n**\t19990701\tVRS \tStarted.\n*/\n\n#ifndef\tKSSL_H\n#define\tKSSL_H\n\n#include <openssl/opensslconf.h>\n\n#ifndef OPENSSL_NO_KRB5\n\n#include <stdio.h>\n#include <ctype.h>\n#include <krb5.h>\n\n#ifdef  __cplusplus\nextern \"C\" {\n#endif\n\n/*\n**\tDepending on which KRB5 implementation used, some types from\n**\tthe other may be missing.  Resolve that here and now\n*/\n#ifdef KRB5_HEIMDAL\ntypedef unsigned char krb5_octet;\n#define FAR\n#else\n\n#ifndef FAR\n#define FAR\n#endif\n\n#endif\n\n/*\tUncomment this to debug kssl problems or\n**\tto trace usage of the Kerberos session key\n**\n**\t#define\t\tKSSL_DEBUG\n*/\n\n#ifndef\tKRB5SVC\n#define KRB5SVC\t\"host\"\n#endif\n\n#ifndef\tKRB5KEYTAB\n#define KRB5KEYTAB\t\"/etc/krb5.keytab\"\n#endif\n\n#ifndef KRB5SENDAUTH\n#define KRB5SENDAUTH\t1\n#endif\n\n#ifndef KRB5CHECKAUTH\n#define KRB5CHECKAUTH\t1\n#endif\n\n#ifndef KSSL_CLOCKSKEW\n#define\tKSSL_CLOCKSKEW\t300;\n#endif\n\n#define\tKSSL_ERR_MAX\t255\ntypedef struct kssl_err_st  {\n\tint  reason;\n\tchar text[KSSL_ERR_MAX+1];\n\t} KSSL_ERR;\n\n\n/*\tContext for passing\n**\t\t(1) Kerberos session key to SSL, and\n**\t\t(2)\tConfig data between application and SSL lib\n*/\ntypedef struct kssl_ctx_st\n        {\n                                /*\tused by:    disposition:            */\n\tchar *service_name;\t/*\tC,S\t    default ok (kssl)       */\n\tchar *service_host;\t/*\tC\t    input, REQUIRED         */\n\tchar *client_princ;\t/*\tS\t    output from krb5 ticket */\n\tchar *keytab_file;\t/*      S\t    NULL (/etc/krb5.keytab) */\n\tchar *cred_cache;\t/*\tC\t    NULL (default)          */\n\tkrb5_enctype enctype;\n\tint length;\n\tkrb5_octet FAR *key;\n\t} KSSL_CTX;\n\n#define\tKSSL_CLIENT \t1\n#define KSSL_SERVER \t2\n#define\tKSSL_SERVICE\t3\n#define\tKSSL_KEYTAB \t4\n\n#define KSSL_CTX_OK \t0\n#define KSSL_CTX_ERR\t1\n#define KSSL_NOMEM\t2\n\n/* Public (for use by applications that use OpenSSL with Kerberos 5 support */\nkrb5_error_code kssl_ctx_setstring(KSSL_CTX *kssl_ctx, int which, char *text);\nKSSL_CTX *kssl_ctx_new(void);\nKSSL_CTX *kssl_ctx_free(KSSL_CTX *kssl_ctx);\nvoid kssl_ctx_show(KSSL_CTX *kssl_ctx);\nkrb5_error_code kssl_ctx_setprinc(KSSL_CTX *kssl_ctx, int which,\n        krb5_data *realm, krb5_data *entity, int nentities);\nkrb5_error_code\tkssl_cget_tkt(KSSL_CTX *kssl_ctx,  krb5_data **enc_tktp,\n        krb5_data *authenp, KSSL_ERR *kssl_err);\nkrb5_error_code\tkssl_sget_tkt(KSSL_CTX *kssl_ctx,  krb5_data *indata,\n        krb5_ticket_times *ttimes, KSSL_ERR *kssl_err);\nkrb5_error_code kssl_ctx_setkey(KSSL_CTX *kssl_ctx, krb5_keyblock *session);\nvoid\tkssl_err_set(KSSL_ERR *kssl_err, int reason, char *text);\nvoid kssl_krb5_free_data_contents(krb5_context context, krb5_data *data);\nkrb5_error_code  kssl_build_principal_2(krb5_context context,\n\t\t\tkrb5_principal *princ, int rlen, const char *realm,\n\t\t\tint slen, const char *svc, int hlen, const char *host);\nkrb5_error_code  kssl_validate_times(krb5_timestamp atime,\n\t\t\t\t\tkrb5_ticket_times *ttimes);\nkrb5_error_code  kssl_check_authent(KSSL_CTX *kssl_ctx, krb5_data *authentp,\n\t\t\t            krb5_timestamp *atimep, KSSL_ERR *kssl_err);\nunsigned char\t*kssl_skip_confound(krb5_enctype enctype, unsigned char *authn);\n\n#ifdef  __cplusplus\n}\n#endif\n#endif\t/* OPENSSL_NO_KRB5\t*/\n#endif\t/* KSSL_H \t*/\n"
  },
  {
    "path": "freebsd-headers/openssl/lhash.h",
    "content": "/* crypto/lhash/lhash.h */\n/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)\n * All rights reserved.\n *\n * This package is an SSL implementation written\n * by Eric Young (eay@cryptsoft.com).\n * The implementation was written so as to conform with Netscapes SSL.\n * \n * This library is free for commercial and non-commercial use as long as\n * the following conditions are aheared to.  The following conditions\n * apply to all code found in this distribution, be it the RC4, RSA,\n * lhash, DES, etc., code; not just the SSL code.  The SSL documentation\n * included with this distribution is covered by the same copyright terms\n * except that the holder is Tim Hudson (tjh@cryptsoft.com).\n * \n * Copyright remains Eric Young's, and as such any Copyright notices in\n * the code are not to be removed.\n * If this package is used in a product, Eric Young should be given attribution\n * as the author of the parts of the library used.\n * This can be in the form of a textual message at program startup or\n * in documentation (online or textual) provided with the package.\n * \n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. All advertising materials mentioning features or use of this software\n *    must display the following acknowledgement:\n *    \"This product includes cryptographic software written by\n *     Eric Young (eay@cryptsoft.com)\"\n *    The word 'cryptographic' can be left out if the rouines from the library\n *    being used are not cryptographic related :-).\n * 4. If you include any Windows specific code (or a derivative thereof) from \n *    the apps directory (application code) you must include an acknowledgement:\n *    \"This product includes software written by Tim Hudson (tjh@cryptsoft.com)\"\n * \n * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n * \n * The licence and distribution terms for any publically available version or\n * derivative of this code cannot be changed.  i.e. this code cannot simply be\n * copied and put under another distribution licence\n * [including the GNU Public Licence.]\n */\n\n/* Header for dynamic hash table routines\n * Author - Eric Young\n */\n\n#ifndef HEADER_LHASH_H\n#define HEADER_LHASH_H\n\n#include <openssl/e_os2.h>\n#ifndef OPENSSL_NO_FP_API\n#include <stdio.h>\n#endif\n\n#ifndef OPENSSL_NO_BIO\n#include <openssl/bio.h>\n#endif\n\n#ifdef  __cplusplus\nextern \"C\" {\n#endif\n\ntypedef struct lhash_node_st\n\t{\n\tvoid *data;\n\tstruct lhash_node_st *next;\n#ifndef OPENSSL_NO_HASH_COMP\n\tunsigned long hash;\n#endif\n\t} LHASH_NODE;\n\ntypedef int (*LHASH_COMP_FN_TYPE)(const void *, const void *);\ntypedef unsigned long (*LHASH_HASH_FN_TYPE)(const void *);\ntypedef void (*LHASH_DOALL_FN_TYPE)(void *);\ntypedef void (*LHASH_DOALL_ARG_FN_TYPE)(void *, void *);\n\n/* Macros for declaring and implementing type-safe wrappers for LHASH callbacks.\n * This way, callbacks can be provided to LHASH structures without function\n * pointer casting and the macro-defined callbacks provide per-variable casting\n * before deferring to the underlying type-specific callbacks. NB: It is\n * possible to place a \"static\" in front of both the DECLARE and IMPLEMENT\n * macros if the functions are strictly internal. */\n\n/* First: \"hash\" functions */\n#define DECLARE_LHASH_HASH_FN(f_name,o_type) \\\n\tunsigned long f_name##_LHASH_HASH(const void *);\n#define IMPLEMENT_LHASH_HASH_FN(f_name,o_type) \\\n\tunsigned long f_name##_LHASH_HASH(const void *arg) { \\\n\t\to_type a = (o_type)arg; \\\n\t\treturn f_name(a); }\n#define LHASH_HASH_FN(f_name) f_name##_LHASH_HASH\n\n/* Second: \"compare\" functions */\n#define DECLARE_LHASH_COMP_FN(f_name,o_type) \\\n\tint f_name##_LHASH_COMP(const void *, const void *);\n#define IMPLEMENT_LHASH_COMP_FN(f_name,o_type) \\\n\tint f_name##_LHASH_COMP(const void *arg1, const void *arg2) { \\\n\t\to_type a = (o_type)arg1; \\\n\t\to_type b = (o_type)arg2; \\\n\t\treturn f_name(a,b); }\n#define LHASH_COMP_FN(f_name) f_name##_LHASH_COMP\n\n/* Third: \"doall\" functions */\n#define DECLARE_LHASH_DOALL_FN(f_name,o_type) \\\n\tvoid f_name##_LHASH_DOALL(void *);\n#define IMPLEMENT_LHASH_DOALL_FN(f_name,o_type) \\\n\tvoid f_name##_LHASH_DOALL(void *arg) { \\\n\t\to_type a = (o_type)arg; \\\n\t\tf_name(a); }\n#define LHASH_DOALL_FN(f_name) f_name##_LHASH_DOALL\n\n/* Fourth: \"doall_arg\" functions */\n#define DECLARE_LHASH_DOALL_ARG_FN(f_name,o_type,a_type) \\\n\tvoid f_name##_LHASH_DOALL_ARG(void *, void *);\n#define IMPLEMENT_LHASH_DOALL_ARG_FN(f_name,o_type,a_type) \\\n\tvoid f_name##_LHASH_DOALL_ARG(void *arg1, void *arg2) { \\\n\t\to_type a = (o_type)arg1; \\\n\t\ta_type b = (a_type)arg2; \\\n\t\tf_name(a,b); }\n#define LHASH_DOALL_ARG_FN(f_name) f_name##_LHASH_DOALL_ARG\n\ntypedef struct lhash_st\n\t{\n\tLHASH_NODE **b;\n\tLHASH_COMP_FN_TYPE comp;\n\tLHASH_HASH_FN_TYPE hash;\n\tunsigned int num_nodes;\n\tunsigned int num_alloc_nodes;\n\tunsigned int p;\n\tunsigned int pmax;\n\tunsigned long up_load; /* load times 256 */\n\tunsigned long down_load; /* load times 256 */\n\tunsigned long num_items;\n\n\tunsigned long num_expands;\n\tunsigned long num_expand_reallocs;\n\tunsigned long num_contracts;\n\tunsigned long num_contract_reallocs;\n\tunsigned long num_hash_calls;\n\tunsigned long num_comp_calls;\n\tunsigned long num_insert;\n\tunsigned long num_replace;\n\tunsigned long num_delete;\n\tunsigned long num_no_delete;\n\tunsigned long num_retrieve;\n\tunsigned long num_retrieve_miss;\n\tunsigned long num_hash_comps;\n\n\tint error;\n\t} LHASH;\n\n#define LH_LOAD_MULT\t256\n\n/* Indicates a malloc() error in the last call, this is only bad\n * in lh_insert(). */\n#define lh_error(lh)\t((lh)->error)\n\nLHASH *lh_new(LHASH_HASH_FN_TYPE h, LHASH_COMP_FN_TYPE c);\nvoid lh_free(LHASH *lh);\nvoid *lh_insert(LHASH *lh, void *data);\nvoid *lh_delete(LHASH *lh, const void *data);\nvoid *lh_retrieve(LHASH *lh, const void *data);\nvoid lh_doall(LHASH *lh, LHASH_DOALL_FN_TYPE func);\nvoid lh_doall_arg(LHASH *lh, LHASH_DOALL_ARG_FN_TYPE func, void *arg);\nunsigned long lh_strhash(const char *c);\nunsigned long lh_num_items(const LHASH *lh);\n\n#ifndef OPENSSL_NO_FP_API\nvoid lh_stats(const LHASH *lh, FILE *out);\nvoid lh_node_stats(const LHASH *lh, FILE *out);\nvoid lh_node_usage_stats(const LHASH *lh, FILE *out);\n#endif\n\n#ifndef OPENSSL_NO_BIO\nvoid lh_stats_bio(const LHASH *lh, BIO *out);\nvoid lh_node_stats_bio(const LHASH *lh, BIO *out);\nvoid lh_node_usage_stats_bio(const LHASH *lh, BIO *out);\n#endif\n#ifdef  __cplusplus\n}\n#endif\n\n#endif\n\n"
  },
  {
    "path": "freebsd-headers/openssl/md2.h",
    "content": "/* crypto/md/md2.h */\n/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com)\n * All rights reserved.\n *\n * This package is an SSL implementation written\n * by Eric Young (eay@cryptsoft.com).\n * The implementation was written so as to conform with Netscapes SSL.\n * \n * This library is free for commercial and non-commercial use as long as\n * the following conditions are aheared to.  The following conditions\n * apply to all code found in this distribution, be it the RC4, RSA,\n * lhash, DES, etc., code; not just the SSL code.  The SSL documentation\n * included with this distribution is covered by the same copyright terms\n * except that the holder is Tim Hudson (tjh@cryptsoft.com).\n * \n * Copyright remains Eric Young's, and as such any Copyright notices in\n * the code are not to be removed.\n * If this package is used in a product, Eric Young should be given attribution\n * as the author of the parts of the library used.\n * This can be in the form of a textual message at program startup or\n * in documentation (online or textual) provided with the package.\n * \n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. All advertising materials mentioning features or use of this software\n *    must display the following acknowledgement:\n *    \"This product includes cryptographic software written by\n *     Eric Young (eay@cryptsoft.com)\"\n *    The word 'cryptographic' can be left out if the rouines from the library\n *    being used are not cryptographic related :-).\n * 4. If you include any Windows specific code (or a derivative thereof) from \n *    the apps directory (application code) you must include an acknowledgement:\n *    \"This product includes software written by Tim Hudson (tjh@cryptsoft.com)\"\n * \n * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n * \n * The licence and distribution terms for any publically available version or\n * derivative of this code cannot be changed.  i.e. this code cannot simply be\n * copied and put under another distribution licence\n * [including the GNU Public Licence.]\n */\n\n#ifndef HEADER_MD2_H\n#define HEADER_MD2_H\n\n#include <openssl/opensslconf.h> /* OPENSSL_NO_MD2, MD2_INT */\n#ifdef OPENSSL_NO_MD2\n#error MD2 is disabled.\n#endif\n#include <stddef.h>\n\n#define MD2_DIGEST_LENGTH\t16\n#define MD2_BLOCK       \t16\n\n#ifdef  __cplusplus\nextern \"C\" {\n#endif\n\ntypedef struct MD2state_st\n\t{\n\tunsigned int num;\n\tunsigned char data[MD2_BLOCK];\n\tMD2_INT cksm[MD2_BLOCK];\n\tMD2_INT state[MD2_BLOCK];\n\t} MD2_CTX;\n\nconst char *MD2_options(void);\n#ifdef OPENSSL_FIPS\nint private_MD2_Init(MD2_CTX *c);\n#endif\nint MD2_Init(MD2_CTX *c);\nint MD2_Update(MD2_CTX *c, const unsigned char *data, size_t len);\nint MD2_Final(unsigned char *md, MD2_CTX *c);\nunsigned char *MD2(const unsigned char *d, size_t n,unsigned char *md);\n#ifdef  __cplusplus\n}\n#endif\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/openssl/md4.h",
    "content": "/* crypto/md4/md4.h */\n/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)\n * All rights reserved.\n *\n * This package is an SSL implementation written\n * by Eric Young (eay@cryptsoft.com).\n * The implementation was written so as to conform with Netscapes SSL.\n * \n * This library is free for commercial and non-commercial use as long as\n * the following conditions are aheared to.  The following conditions\n * apply to all code found in this distribution, be it the RC4, RSA,\n * lhash, DES, etc., code; not just the SSL code.  The SSL documentation\n * included with this distribution is covered by the same copyright terms\n * except that the holder is Tim Hudson (tjh@cryptsoft.com).\n * \n * Copyright remains Eric Young's, and as such any Copyright notices in\n * the code are not to be removed.\n * If this package is used in a product, Eric Young should be given attribution\n * as the author of the parts of the library used.\n * This can be in the form of a textual message at program startup or\n * in documentation (online or textual) provided with the package.\n * \n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. All advertising materials mentioning features or use of this software\n *    must display the following acknowledgement:\n *    \"This product includes cryptographic software written by\n *     Eric Young (eay@cryptsoft.com)\"\n *    The word 'cryptographic' can be left out if the rouines from the library\n *    being used are not cryptographic related :-).\n * 4. If you include any Windows specific code (or a derivative thereof) from \n *    the apps directory (application code) you must include an acknowledgement:\n *    \"This product includes software written by Tim Hudson (tjh@cryptsoft.com)\"\n * \n * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n * \n * The licence and distribution terms for any publically available version or\n * derivative of this code cannot be changed.  i.e. this code cannot simply be\n * copied and put under another distribution licence\n * [including the GNU Public Licence.]\n */\n\n#ifndef HEADER_MD4_H\n#define HEADER_MD4_H\n\n#include <openssl/e_os2.h>\n#include <stddef.h>\n\n#ifdef  __cplusplus\nextern \"C\" {\n#endif\n\n#ifdef OPENSSL_NO_MD4\n#error MD4 is disabled.\n#endif\n\n/*\n * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n * ! MD4_LONG has to be at least 32 bits wide. If it's wider, then !\n * ! MD4_LONG_LOG2 has to be defined along.\t\t\t   !\n * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n */\n\n#if defined(OPENSSL_SYS_WIN16) || defined(__LP32__)\n#define MD4_LONG unsigned long\n#elif defined(OPENSSL_SYS_CRAY) || defined(__ILP64__)\n#define MD4_LONG unsigned long\n#define MD4_LONG_LOG2 3\n/*\n * _CRAY note. I could declare short, but I have no idea what impact\n * does it have on performance on none-T3E machines. I could declare\n * int, but at least on C90 sizeof(int) can be chosen at compile time.\n * So I've chosen long...\n *\t\t\t\t\t<appro@fy.chalmers.se>\n */\n#else\n#define MD4_LONG unsigned int\n#endif\n\n#define MD4_CBLOCK\t64\n#define MD4_LBLOCK\t(MD4_CBLOCK/4)\n#define MD4_DIGEST_LENGTH 16\n\ntypedef struct MD4state_st\n\t{\n\tMD4_LONG A,B,C,D;\n\tMD4_LONG Nl,Nh;\n\tMD4_LONG data[MD4_LBLOCK];\n\tunsigned int num;\n\t} MD4_CTX;\n\n#ifdef OPENSSL_FIPS\nint private_MD4_Init(MD4_CTX *c);\n#endif\nint MD4_Init(MD4_CTX *c);\nint MD4_Update(MD4_CTX *c, const void *data, size_t len);\nint MD4_Final(unsigned char *md, MD4_CTX *c);\nunsigned char *MD4(const unsigned char *d, size_t n, unsigned char *md);\nvoid MD4_Transform(MD4_CTX *c, const unsigned char *b);\n#ifdef  __cplusplus\n}\n#endif\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/openssl/md5.h",
    "content": "/* crypto/md5/md5.h */\n/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)\n * All rights reserved.\n *\n * This package is an SSL implementation written\n * by Eric Young (eay@cryptsoft.com).\n * The implementation was written so as to conform with Netscapes SSL.\n * \n * This library is free for commercial and non-commercial use as long as\n * the following conditions are aheared to.  The following conditions\n * apply to all code found in this distribution, be it the RC4, RSA,\n * lhash, DES, etc., code; not just the SSL code.  The SSL documentation\n * included with this distribution is covered by the same copyright terms\n * except that the holder is Tim Hudson (tjh@cryptsoft.com).\n * \n * Copyright remains Eric Young's, and as such any Copyright notices in\n * the code are not to be removed.\n * If this package is used in a product, Eric Young should be given attribution\n * as the author of the parts of the library used.\n * This can be in the form of a textual message at program startup or\n * in documentation (online or textual) provided with the package.\n * \n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. All advertising materials mentioning features or use of this software\n *    must display the following acknowledgement:\n *    \"This product includes cryptographic software written by\n *     Eric Young (eay@cryptsoft.com)\"\n *    The word 'cryptographic' can be left out if the rouines from the library\n *    being used are not cryptographic related :-).\n * 4. If you include any Windows specific code (or a derivative thereof) from \n *    the apps directory (application code) you must include an acknowledgement:\n *    \"This product includes software written by Tim Hudson (tjh@cryptsoft.com)\"\n * \n * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n * \n * The licence and distribution terms for any publically available version or\n * derivative of this code cannot be changed.  i.e. this code cannot simply be\n * copied and put under another distribution licence\n * [including the GNU Public Licence.]\n */\n\n#ifndef HEADER_MD5_H\n#define HEADER_MD5_H\n\n#include <openssl/e_os2.h>\n#include <stddef.h>\n\n#ifdef  __cplusplus\nextern \"C\" {\n#endif\n\n#ifdef OPENSSL_NO_MD5\n#error MD5 is disabled.\n#endif\n\n/*\n * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n * ! MD5_LONG has to be at least 32 bits wide. If it's wider, then !\n * ! MD5_LONG_LOG2 has to be defined along.\t\t\t   !\n * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n */\n\n#if defined(OPENSSL_SYS_WIN16) || defined(__LP32__)\n#define MD5_LONG unsigned long\n#elif defined(OPENSSL_SYS_CRAY) || defined(__ILP64__)\n#define MD5_LONG unsigned long\n#define MD5_LONG_LOG2 3\n/*\n * _CRAY note. I could declare short, but I have no idea what impact\n * does it have on performance on none-T3E machines. I could declare\n * int, but at least on C90 sizeof(int) can be chosen at compile time.\n * So I've chosen long...\n *\t\t\t\t\t<appro@fy.chalmers.se>\n */\n#else\n#define MD5_LONG unsigned int\n#endif\n\n#define MD5_CBLOCK\t64\n#define MD5_LBLOCK\t(MD5_CBLOCK/4)\n#define MD5_DIGEST_LENGTH 16\n\ntypedef struct MD5state_st\n\t{\n\tMD5_LONG A,B,C,D;\n\tMD5_LONG Nl,Nh;\n\tMD5_LONG data[MD5_LBLOCK];\n\tunsigned int num;\n\t} MD5_CTX;\n\n#ifdef OPENSSL_FIPS\nint private_MD5_Init(MD5_CTX *c);\n#endif\nint MD5_Init(MD5_CTX *c);\nint MD5_Update(MD5_CTX *c, const void *data, size_t len);\nint MD5_Final(unsigned char *md, MD5_CTX *c);\nunsigned char *MD5(const unsigned char *d, size_t n, unsigned char *md);\nvoid MD5_Transform(MD5_CTX *c, const unsigned char *b);\n#ifdef  __cplusplus\n}\n#endif\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/openssl/mdc2.h",
    "content": "/* crypto/mdc2/mdc2.h */\n/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)\n * All rights reserved.\n *\n * This package is an SSL implementation written\n * by Eric Young (eay@cryptsoft.com).\n * The implementation was written so as to conform with Netscapes SSL.\n * \n * This library is free for commercial and non-commercial use as long as\n * the following conditions are aheared to.  The following conditions\n * apply to all code found in this distribution, be it the RC4, RSA,\n * lhash, DES, etc., code; not just the SSL code.  The SSL documentation\n * included with this distribution is covered by the same copyright terms\n * except that the holder is Tim Hudson (tjh@cryptsoft.com).\n * \n * Copyright remains Eric Young's, and as such any Copyright notices in\n * the code are not to be removed.\n * If this package is used in a product, Eric Young should be given attribution\n * as the author of the parts of the library used.\n * This can be in the form of a textual message at program startup or\n * in documentation (online or textual) provided with the package.\n * \n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. All advertising materials mentioning features or use of this software\n *    must display the following acknowledgement:\n *    \"This product includes cryptographic software written by\n *     Eric Young (eay@cryptsoft.com)\"\n *    The word 'cryptographic' can be left out if the rouines from the library\n *    being used are not cryptographic related :-).\n * 4. If you include any Windows specific code (or a derivative thereof) from \n *    the apps directory (application code) you must include an acknowledgement:\n *    \"This product includes software written by Tim Hudson (tjh@cryptsoft.com)\"\n * \n * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n * \n * The licence and distribution terms for any publically available version or\n * derivative of this code cannot be changed.  i.e. this code cannot simply be\n * copied and put under another distribution licence\n * [including the GNU Public Licence.]\n */\n\n#ifndef HEADER_MDC2_H\n#define HEADER_MDC2_H\n\n#include <openssl/des.h>\n\n#ifdef  __cplusplus\nextern \"C\" {\n#endif\n\n#ifdef OPENSSL_NO_MDC2\n#error MDC2 is disabled.\n#endif\n\n#define MDC2_BLOCK              8\n#define MDC2_DIGEST_LENGTH      16\n \ntypedef struct mdc2_ctx_st\n\t{\n\tunsigned int num;\n\tunsigned char data[MDC2_BLOCK];\n\tDES_cblock h,hh;\n\tint pad_type; /* either 1 or 2, default 1 */\n\t} MDC2_CTX;\n\n#ifdef OPENSSL_FIPS\nint private_MDC2_Init(MDC2_CTX *c);\n#endif\nint MDC2_Init(MDC2_CTX *c);\nint MDC2_Update(MDC2_CTX *c, const unsigned char *data, size_t len);\nint MDC2_Final(unsigned char *md, MDC2_CTX *c);\nunsigned char *MDC2(const unsigned char *d, size_t n,\n\tunsigned char *md);\n\n#ifdef  __cplusplus\n}\n#endif\n\n#endif\n\n"
  },
  {
    "path": "freebsd-headers/openssl/obj_mac.h",
    "content": "/* crypto/objects/obj_mac.h */\n\n/* THIS FILE IS GENERATED FROM objects.txt by objects.pl via the\n * following command:\n * perl objects.pl objects.txt obj_mac.num obj_mac.h\n */\n\n/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com)\n * All rights reserved.\n *\n * This package is an SSL implementation written\n * by Eric Young (eay@cryptsoft.com).\n * The implementation was written so as to conform with Netscapes SSL.\n * \n * This library is free for commercial and non-commercial use as long as\n * the following conditions are aheared to.  The following conditions\n * apply to all code found in this distribution, be it the RC4, RSA,\n * lhash, DES, etc., code; not just the SSL code.  The SSL documentation\n * included with this distribution is covered by the same copyright terms\n * except that the holder is Tim Hudson (tjh@cryptsoft.com).\n * \n * Copyright remains Eric Young's, and as such any Copyright notices in\n * the code are not to be removed.\n * If this package is used in a product, Eric Young should be given attribution\n * as the author of the parts of the library used.\n * This can be in the form of a textual message at program startup or\n * in documentation (online or textual) provided with the package.\n * \n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. All advertising materials mentioning features or use of this software\n *    must display the following acknowledgement:\n *    \"This product includes cryptographic software written by\n *     Eric Young (eay@cryptsoft.com)\"\n *    The word 'cryptographic' can be left out if the rouines from the library\n *    being used are not cryptographic related :-).\n * 4. If you include any Windows specific code (or a derivative thereof) from \n *    the apps directory (application code) you must include an acknowledgement:\n *    \"This product includes software written by Tim Hudson (tjh@cryptsoft.com)\"\n * \n * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n * \n * The licence and distribution terms for any publically available version or\n * derivative of this code cannot be changed.  i.e. this code cannot simply be\n * copied and put under another distribution licence\n * [including the GNU Public Licence.]\n */\n\n#define SN_undef\t\t\t\"UNDEF\"\n#define LN_undef\t\t\t\"undefined\"\n#define NID_undef\t\t\t0\n#define OBJ_undef\t\t\t0L\n\n#define SN_itu_t\t\t\"ITU-T\"\n#define LN_itu_t\t\t\"itu-t\"\n#define NID_itu_t\t\t645\n#define OBJ_itu_t\t\t0L\n\n#define NID_ccitt\t\t404\n#define OBJ_ccitt\t\tOBJ_itu_t\n\n#define SN_iso\t\t\"ISO\"\n#define LN_iso\t\t\"iso\"\n#define NID_iso\t\t181\n#define OBJ_iso\t\t1L\n\n#define SN_joint_iso_itu_t\t\t\"JOINT-ISO-ITU-T\"\n#define LN_joint_iso_itu_t\t\t\"joint-iso-itu-t\"\n#define NID_joint_iso_itu_t\t\t646\n#define OBJ_joint_iso_itu_t\t\t2L\n\n#define NID_joint_iso_ccitt\t\t393\n#define OBJ_joint_iso_ccitt\t\tOBJ_joint_iso_itu_t\n\n#define SN_member_body\t\t\"member-body\"\n#define LN_member_body\t\t\"ISO Member Body\"\n#define NID_member_body\t\t182\n#define OBJ_member_body\t\tOBJ_iso,2L\n\n#define SN_identified_organization\t\t\"identified-organization\"\n#define NID_identified_organization\t\t676\n#define OBJ_identified_organization\t\tOBJ_iso,3L\n\n#define SN_hmac_md5\t\t\"HMAC-MD5\"\n#define LN_hmac_md5\t\t\"hmac-md5\"\n#define NID_hmac_md5\t\t780\n#define OBJ_hmac_md5\t\tOBJ_identified_organization,6L,1L,5L,5L,8L,1L,1L\n\n#define SN_hmac_sha1\t\t\"HMAC-SHA1\"\n#define LN_hmac_sha1\t\t\"hmac-sha1\"\n#define NID_hmac_sha1\t\t781\n#define OBJ_hmac_sha1\t\tOBJ_identified_organization,6L,1L,5L,5L,8L,1L,2L\n\n#define SN_certicom_arc\t\t\"certicom-arc\"\n#define NID_certicom_arc\t\t677\n#define OBJ_certicom_arc\t\tOBJ_identified_organization,132L\n\n#define SN_international_organizations\t\t\"international-organizations\"\n#define LN_international_organizations\t\t\"International Organizations\"\n#define NID_international_organizations\t\t647\n#define OBJ_international_organizations\t\tOBJ_joint_iso_itu_t,23L\n\n#define SN_wap\t\t\"wap\"\n#define NID_wap\t\t678\n#define OBJ_wap\t\tOBJ_international_organizations,43L\n\n#define SN_wap_wsg\t\t\"wap-wsg\"\n#define NID_wap_wsg\t\t679\n#define OBJ_wap_wsg\t\tOBJ_wap,1L\n\n#define SN_selected_attribute_types\t\t\"selected-attribute-types\"\n#define LN_selected_attribute_types\t\t\"Selected Attribute Types\"\n#define NID_selected_attribute_types\t\t394\n#define OBJ_selected_attribute_types\t\tOBJ_joint_iso_itu_t,5L,1L,5L\n\n#define SN_clearance\t\t\"clearance\"\n#define NID_clearance\t\t395\n#define OBJ_clearance\t\tOBJ_selected_attribute_types,55L\n\n#define SN_ISO_US\t\t\"ISO-US\"\n#define LN_ISO_US\t\t\"ISO US Member Body\"\n#define NID_ISO_US\t\t183\n#define OBJ_ISO_US\t\tOBJ_member_body,840L\n\n#define SN_X9_57\t\t\"X9-57\"\n#define LN_X9_57\t\t\"X9.57\"\n#define NID_X9_57\t\t184\n#define OBJ_X9_57\t\tOBJ_ISO_US,10040L\n\n#define SN_X9cm\t\t\"X9cm\"\n#define LN_X9cm\t\t\"X9.57 CM ?\"\n#define NID_X9cm\t\t185\n#define OBJ_X9cm\t\tOBJ_X9_57,4L\n\n#define SN_dsa\t\t\"DSA\"\n#define LN_dsa\t\t\"dsaEncryption\"\n#define NID_dsa\t\t116\n#define OBJ_dsa\t\tOBJ_X9cm,1L\n\n#define SN_dsaWithSHA1\t\t\"DSA-SHA1\"\n#define LN_dsaWithSHA1\t\t\"dsaWithSHA1\"\n#define NID_dsaWithSHA1\t\t113\n#define OBJ_dsaWithSHA1\t\tOBJ_X9cm,3L\n\n#define SN_ansi_X9_62\t\t\"ansi-X9-62\"\n#define LN_ansi_X9_62\t\t\"ANSI X9.62\"\n#define NID_ansi_X9_62\t\t405\n#define OBJ_ansi_X9_62\t\tOBJ_ISO_US,10045L\n\n#define OBJ_X9_62_id_fieldType\t\tOBJ_ansi_X9_62,1L\n\n#define SN_X9_62_prime_field\t\t\"prime-field\"\n#define NID_X9_62_prime_field\t\t406\n#define OBJ_X9_62_prime_field\t\tOBJ_X9_62_id_fieldType,1L\n\n#define SN_X9_62_characteristic_two_field\t\t\"characteristic-two-field\"\n#define NID_X9_62_characteristic_two_field\t\t407\n#define OBJ_X9_62_characteristic_two_field\t\tOBJ_X9_62_id_fieldType,2L\n\n#define SN_X9_62_id_characteristic_two_basis\t\t\"id-characteristic-two-basis\"\n#define NID_X9_62_id_characteristic_two_basis\t\t680\n#define OBJ_X9_62_id_characteristic_two_basis\t\tOBJ_X9_62_characteristic_two_field,3L\n\n#define SN_X9_62_onBasis\t\t\"onBasis\"\n#define NID_X9_62_onBasis\t\t681\n#define OBJ_X9_62_onBasis\t\tOBJ_X9_62_id_characteristic_two_basis,1L\n\n#define SN_X9_62_tpBasis\t\t\"tpBasis\"\n#define NID_X9_62_tpBasis\t\t682\n#define OBJ_X9_62_tpBasis\t\tOBJ_X9_62_id_characteristic_two_basis,2L\n\n#define SN_X9_62_ppBasis\t\t\"ppBasis\"\n#define NID_X9_62_ppBasis\t\t683\n#define OBJ_X9_62_ppBasis\t\tOBJ_X9_62_id_characteristic_two_basis,3L\n\n#define OBJ_X9_62_id_publicKeyType\t\tOBJ_ansi_X9_62,2L\n\n#define SN_X9_62_id_ecPublicKey\t\t\"id-ecPublicKey\"\n#define NID_X9_62_id_ecPublicKey\t\t408\n#define OBJ_X9_62_id_ecPublicKey\t\tOBJ_X9_62_id_publicKeyType,1L\n\n#define OBJ_X9_62_ellipticCurve\t\tOBJ_ansi_X9_62,3L\n\n#define OBJ_X9_62_c_TwoCurve\t\tOBJ_X9_62_ellipticCurve,0L\n\n#define SN_X9_62_c2pnb163v1\t\t\"c2pnb163v1\"\n#define NID_X9_62_c2pnb163v1\t\t684\n#define OBJ_X9_62_c2pnb163v1\t\tOBJ_X9_62_c_TwoCurve,1L\n\n#define SN_X9_62_c2pnb163v2\t\t\"c2pnb163v2\"\n#define NID_X9_62_c2pnb163v2\t\t685\n#define OBJ_X9_62_c2pnb163v2\t\tOBJ_X9_62_c_TwoCurve,2L\n\n#define SN_X9_62_c2pnb163v3\t\t\"c2pnb163v3\"\n#define NID_X9_62_c2pnb163v3\t\t686\n#define OBJ_X9_62_c2pnb163v3\t\tOBJ_X9_62_c_TwoCurve,3L\n\n#define SN_X9_62_c2pnb176v1\t\t\"c2pnb176v1\"\n#define NID_X9_62_c2pnb176v1\t\t687\n#define OBJ_X9_62_c2pnb176v1\t\tOBJ_X9_62_c_TwoCurve,4L\n\n#define SN_X9_62_c2tnb191v1\t\t\"c2tnb191v1\"\n#define NID_X9_62_c2tnb191v1\t\t688\n#define OBJ_X9_62_c2tnb191v1\t\tOBJ_X9_62_c_TwoCurve,5L\n\n#define SN_X9_62_c2tnb191v2\t\t\"c2tnb191v2\"\n#define NID_X9_62_c2tnb191v2\t\t689\n#define OBJ_X9_62_c2tnb191v2\t\tOBJ_X9_62_c_TwoCurve,6L\n\n#define SN_X9_62_c2tnb191v3\t\t\"c2tnb191v3\"\n#define NID_X9_62_c2tnb191v3\t\t690\n#define OBJ_X9_62_c2tnb191v3\t\tOBJ_X9_62_c_TwoCurve,7L\n\n#define SN_X9_62_c2onb191v4\t\t\"c2onb191v4\"\n#define NID_X9_62_c2onb191v4\t\t691\n#define OBJ_X9_62_c2onb191v4\t\tOBJ_X9_62_c_TwoCurve,8L\n\n#define SN_X9_62_c2onb191v5\t\t\"c2onb191v5\"\n#define NID_X9_62_c2onb191v5\t\t692\n#define OBJ_X9_62_c2onb191v5\t\tOBJ_X9_62_c_TwoCurve,9L\n\n#define SN_X9_62_c2pnb208w1\t\t\"c2pnb208w1\"\n#define NID_X9_62_c2pnb208w1\t\t693\n#define OBJ_X9_62_c2pnb208w1\t\tOBJ_X9_62_c_TwoCurve,10L\n\n#define SN_X9_62_c2tnb239v1\t\t\"c2tnb239v1\"\n#define NID_X9_62_c2tnb239v1\t\t694\n#define OBJ_X9_62_c2tnb239v1\t\tOBJ_X9_62_c_TwoCurve,11L\n\n#define SN_X9_62_c2tnb239v2\t\t\"c2tnb239v2\"\n#define NID_X9_62_c2tnb239v2\t\t695\n#define OBJ_X9_62_c2tnb239v2\t\tOBJ_X9_62_c_TwoCurve,12L\n\n#define SN_X9_62_c2tnb239v3\t\t\"c2tnb239v3\"\n#define NID_X9_62_c2tnb239v3\t\t696\n#define OBJ_X9_62_c2tnb239v3\t\tOBJ_X9_62_c_TwoCurve,13L\n\n#define SN_X9_62_c2onb239v4\t\t\"c2onb239v4\"\n#define NID_X9_62_c2onb239v4\t\t697\n#define OBJ_X9_62_c2onb239v4\t\tOBJ_X9_62_c_TwoCurve,14L\n\n#define SN_X9_62_c2onb239v5\t\t\"c2onb239v5\"\n#define NID_X9_62_c2onb239v5\t\t698\n#define OBJ_X9_62_c2onb239v5\t\tOBJ_X9_62_c_TwoCurve,15L\n\n#define SN_X9_62_c2pnb272w1\t\t\"c2pnb272w1\"\n#define NID_X9_62_c2pnb272w1\t\t699\n#define OBJ_X9_62_c2pnb272w1\t\tOBJ_X9_62_c_TwoCurve,16L\n\n#define SN_X9_62_c2pnb304w1\t\t\"c2pnb304w1\"\n#define NID_X9_62_c2pnb304w1\t\t700\n#define OBJ_X9_62_c2pnb304w1\t\tOBJ_X9_62_c_TwoCurve,17L\n\n#define SN_X9_62_c2tnb359v1\t\t\"c2tnb359v1\"\n#define NID_X9_62_c2tnb359v1\t\t701\n#define OBJ_X9_62_c2tnb359v1\t\tOBJ_X9_62_c_TwoCurve,18L\n\n#define SN_X9_62_c2pnb368w1\t\t\"c2pnb368w1\"\n#define NID_X9_62_c2pnb368w1\t\t702\n#define OBJ_X9_62_c2pnb368w1\t\tOBJ_X9_62_c_TwoCurve,19L\n\n#define SN_X9_62_c2tnb431r1\t\t\"c2tnb431r1\"\n#define NID_X9_62_c2tnb431r1\t\t703\n#define OBJ_X9_62_c2tnb431r1\t\tOBJ_X9_62_c_TwoCurve,20L\n\n#define OBJ_X9_62_primeCurve\t\tOBJ_X9_62_ellipticCurve,1L\n\n#define SN_X9_62_prime192v1\t\t\"prime192v1\"\n#define NID_X9_62_prime192v1\t\t409\n#define OBJ_X9_62_prime192v1\t\tOBJ_X9_62_primeCurve,1L\n\n#define SN_X9_62_prime192v2\t\t\"prime192v2\"\n#define NID_X9_62_prime192v2\t\t410\n#define OBJ_X9_62_prime192v2\t\tOBJ_X9_62_primeCurve,2L\n\n#define SN_X9_62_prime192v3\t\t\"prime192v3\"\n#define NID_X9_62_prime192v3\t\t411\n#define OBJ_X9_62_prime192v3\t\tOBJ_X9_62_primeCurve,3L\n\n#define SN_X9_62_prime239v1\t\t\"prime239v1\"\n#define NID_X9_62_prime239v1\t\t412\n#define OBJ_X9_62_prime239v1\t\tOBJ_X9_62_primeCurve,4L\n\n#define SN_X9_62_prime239v2\t\t\"prime239v2\"\n#define NID_X9_62_prime239v2\t\t413\n#define OBJ_X9_62_prime239v2\t\tOBJ_X9_62_primeCurve,5L\n\n#define SN_X9_62_prime239v3\t\t\"prime239v3\"\n#define NID_X9_62_prime239v3\t\t414\n#define OBJ_X9_62_prime239v3\t\tOBJ_X9_62_primeCurve,6L\n\n#define SN_X9_62_prime256v1\t\t\"prime256v1\"\n#define NID_X9_62_prime256v1\t\t415\n#define OBJ_X9_62_prime256v1\t\tOBJ_X9_62_primeCurve,7L\n\n#define OBJ_X9_62_id_ecSigType\t\tOBJ_ansi_X9_62,4L\n\n#define SN_ecdsa_with_SHA1\t\t\"ecdsa-with-SHA1\"\n#define NID_ecdsa_with_SHA1\t\t416\n#define OBJ_ecdsa_with_SHA1\t\tOBJ_X9_62_id_ecSigType,1L\n\n#define SN_ecdsa_with_Recommended\t\t\"ecdsa-with-Recommended\"\n#define NID_ecdsa_with_Recommended\t\t791\n#define OBJ_ecdsa_with_Recommended\t\tOBJ_X9_62_id_ecSigType,2L\n\n#define SN_ecdsa_with_Specified\t\t\"ecdsa-with-Specified\"\n#define NID_ecdsa_with_Specified\t\t792\n#define OBJ_ecdsa_with_Specified\t\tOBJ_X9_62_id_ecSigType,3L\n\n#define SN_ecdsa_with_SHA224\t\t\"ecdsa-with-SHA224\"\n#define NID_ecdsa_with_SHA224\t\t793\n#define OBJ_ecdsa_with_SHA224\t\tOBJ_ecdsa_with_Specified,1L\n\n#define SN_ecdsa_with_SHA256\t\t\"ecdsa-with-SHA256\"\n#define NID_ecdsa_with_SHA256\t\t794\n#define OBJ_ecdsa_with_SHA256\t\tOBJ_ecdsa_with_Specified,2L\n\n#define SN_ecdsa_with_SHA384\t\t\"ecdsa-with-SHA384\"\n#define NID_ecdsa_with_SHA384\t\t795\n#define OBJ_ecdsa_with_SHA384\t\tOBJ_ecdsa_with_Specified,3L\n\n#define SN_ecdsa_with_SHA512\t\t\"ecdsa-with-SHA512\"\n#define NID_ecdsa_with_SHA512\t\t796\n#define OBJ_ecdsa_with_SHA512\t\tOBJ_ecdsa_with_Specified,4L\n\n#define OBJ_secg_ellipticCurve\t\tOBJ_certicom_arc,0L\n\n#define SN_secp112r1\t\t\"secp112r1\"\n#define NID_secp112r1\t\t704\n#define OBJ_secp112r1\t\tOBJ_secg_ellipticCurve,6L\n\n#define SN_secp112r2\t\t\"secp112r2\"\n#define NID_secp112r2\t\t705\n#define OBJ_secp112r2\t\tOBJ_secg_ellipticCurve,7L\n\n#define SN_secp128r1\t\t\"secp128r1\"\n#define NID_secp128r1\t\t706\n#define OBJ_secp128r1\t\tOBJ_secg_ellipticCurve,28L\n\n#define SN_secp128r2\t\t\"secp128r2\"\n#define NID_secp128r2\t\t707\n#define OBJ_secp128r2\t\tOBJ_secg_ellipticCurve,29L\n\n#define SN_secp160k1\t\t\"secp160k1\"\n#define NID_secp160k1\t\t708\n#define OBJ_secp160k1\t\tOBJ_secg_ellipticCurve,9L\n\n#define SN_secp160r1\t\t\"secp160r1\"\n#define NID_secp160r1\t\t709\n#define OBJ_secp160r1\t\tOBJ_secg_ellipticCurve,8L\n\n#define SN_secp160r2\t\t\"secp160r2\"\n#define NID_secp160r2\t\t710\n#define OBJ_secp160r2\t\tOBJ_secg_ellipticCurve,30L\n\n#define SN_secp192k1\t\t\"secp192k1\"\n#define NID_secp192k1\t\t711\n#define OBJ_secp192k1\t\tOBJ_secg_ellipticCurve,31L\n\n#define SN_secp224k1\t\t\"secp224k1\"\n#define NID_secp224k1\t\t712\n#define OBJ_secp224k1\t\tOBJ_secg_ellipticCurve,32L\n\n#define SN_secp224r1\t\t\"secp224r1\"\n#define NID_secp224r1\t\t713\n#define OBJ_secp224r1\t\tOBJ_secg_ellipticCurve,33L\n\n#define SN_secp256k1\t\t\"secp256k1\"\n#define NID_secp256k1\t\t714\n#define OBJ_secp256k1\t\tOBJ_secg_ellipticCurve,10L\n\n#define SN_secp384r1\t\t\"secp384r1\"\n#define NID_secp384r1\t\t715\n#define OBJ_secp384r1\t\tOBJ_secg_ellipticCurve,34L\n\n#define SN_secp521r1\t\t\"secp521r1\"\n#define NID_secp521r1\t\t716\n#define OBJ_secp521r1\t\tOBJ_secg_ellipticCurve,35L\n\n#define SN_sect113r1\t\t\"sect113r1\"\n#define NID_sect113r1\t\t717\n#define OBJ_sect113r1\t\tOBJ_secg_ellipticCurve,4L\n\n#define SN_sect113r2\t\t\"sect113r2\"\n#define NID_sect113r2\t\t718\n#define OBJ_sect113r2\t\tOBJ_secg_ellipticCurve,5L\n\n#define SN_sect131r1\t\t\"sect131r1\"\n#define NID_sect131r1\t\t719\n#define OBJ_sect131r1\t\tOBJ_secg_ellipticCurve,22L\n\n#define SN_sect131r2\t\t\"sect131r2\"\n#define NID_sect131r2\t\t720\n#define OBJ_sect131r2\t\tOBJ_secg_ellipticCurve,23L\n\n#define SN_sect163k1\t\t\"sect163k1\"\n#define NID_sect163k1\t\t721\n#define OBJ_sect163k1\t\tOBJ_secg_ellipticCurve,1L\n\n#define SN_sect163r1\t\t\"sect163r1\"\n#define NID_sect163r1\t\t722\n#define OBJ_sect163r1\t\tOBJ_secg_ellipticCurve,2L\n\n#define SN_sect163r2\t\t\"sect163r2\"\n#define NID_sect163r2\t\t723\n#define OBJ_sect163r2\t\tOBJ_secg_ellipticCurve,15L\n\n#define SN_sect193r1\t\t\"sect193r1\"\n#define NID_sect193r1\t\t724\n#define OBJ_sect193r1\t\tOBJ_secg_ellipticCurve,24L\n\n#define SN_sect193r2\t\t\"sect193r2\"\n#define NID_sect193r2\t\t725\n#define OBJ_sect193r2\t\tOBJ_secg_ellipticCurve,25L\n\n#define SN_sect233k1\t\t\"sect233k1\"\n#define NID_sect233k1\t\t726\n#define OBJ_sect233k1\t\tOBJ_secg_ellipticCurve,26L\n\n#define SN_sect233r1\t\t\"sect233r1\"\n#define NID_sect233r1\t\t727\n#define OBJ_sect233r1\t\tOBJ_secg_ellipticCurve,27L\n\n#define SN_sect239k1\t\t\"sect239k1\"\n#define NID_sect239k1\t\t728\n#define OBJ_sect239k1\t\tOBJ_secg_ellipticCurve,3L\n\n#define SN_sect283k1\t\t\"sect283k1\"\n#define NID_sect283k1\t\t729\n#define OBJ_sect283k1\t\tOBJ_secg_ellipticCurve,16L\n\n#define SN_sect283r1\t\t\"sect283r1\"\n#define NID_sect283r1\t\t730\n#define OBJ_sect283r1\t\tOBJ_secg_ellipticCurve,17L\n\n#define SN_sect409k1\t\t\"sect409k1\"\n#define NID_sect409k1\t\t731\n#define OBJ_sect409k1\t\tOBJ_secg_ellipticCurve,36L\n\n#define SN_sect409r1\t\t\"sect409r1\"\n#define NID_sect409r1\t\t732\n#define OBJ_sect409r1\t\tOBJ_secg_ellipticCurve,37L\n\n#define SN_sect571k1\t\t\"sect571k1\"\n#define NID_sect571k1\t\t733\n#define OBJ_sect571k1\t\tOBJ_secg_ellipticCurve,38L\n\n#define SN_sect571r1\t\t\"sect571r1\"\n#define NID_sect571r1\t\t734\n#define OBJ_sect571r1\t\tOBJ_secg_ellipticCurve,39L\n\n#define OBJ_wap_wsg_idm_ecid\t\tOBJ_wap_wsg,4L\n\n#define SN_wap_wsg_idm_ecid_wtls1\t\t\"wap-wsg-idm-ecid-wtls1\"\n#define NID_wap_wsg_idm_ecid_wtls1\t\t735\n#define OBJ_wap_wsg_idm_ecid_wtls1\t\tOBJ_wap_wsg_idm_ecid,1L\n\n#define SN_wap_wsg_idm_ecid_wtls3\t\t\"wap-wsg-idm-ecid-wtls3\"\n#define NID_wap_wsg_idm_ecid_wtls3\t\t736\n#define OBJ_wap_wsg_idm_ecid_wtls3\t\tOBJ_wap_wsg_idm_ecid,3L\n\n#define SN_wap_wsg_idm_ecid_wtls4\t\t\"wap-wsg-idm-ecid-wtls4\"\n#define NID_wap_wsg_idm_ecid_wtls4\t\t737\n#define OBJ_wap_wsg_idm_ecid_wtls4\t\tOBJ_wap_wsg_idm_ecid,4L\n\n#define SN_wap_wsg_idm_ecid_wtls5\t\t\"wap-wsg-idm-ecid-wtls5\"\n#define NID_wap_wsg_idm_ecid_wtls5\t\t738\n#define OBJ_wap_wsg_idm_ecid_wtls5\t\tOBJ_wap_wsg_idm_ecid,5L\n\n#define SN_wap_wsg_idm_ecid_wtls6\t\t\"wap-wsg-idm-ecid-wtls6\"\n#define NID_wap_wsg_idm_ecid_wtls6\t\t739\n#define OBJ_wap_wsg_idm_ecid_wtls6\t\tOBJ_wap_wsg_idm_ecid,6L\n\n#define SN_wap_wsg_idm_ecid_wtls7\t\t\"wap-wsg-idm-ecid-wtls7\"\n#define NID_wap_wsg_idm_ecid_wtls7\t\t740\n#define OBJ_wap_wsg_idm_ecid_wtls7\t\tOBJ_wap_wsg_idm_ecid,7L\n\n#define SN_wap_wsg_idm_ecid_wtls8\t\t\"wap-wsg-idm-ecid-wtls8\"\n#define NID_wap_wsg_idm_ecid_wtls8\t\t741\n#define OBJ_wap_wsg_idm_ecid_wtls8\t\tOBJ_wap_wsg_idm_ecid,8L\n\n#define SN_wap_wsg_idm_ecid_wtls9\t\t\"wap-wsg-idm-ecid-wtls9\"\n#define NID_wap_wsg_idm_ecid_wtls9\t\t742\n#define OBJ_wap_wsg_idm_ecid_wtls9\t\tOBJ_wap_wsg_idm_ecid,9L\n\n#define SN_wap_wsg_idm_ecid_wtls10\t\t\"wap-wsg-idm-ecid-wtls10\"\n#define NID_wap_wsg_idm_ecid_wtls10\t\t743\n#define OBJ_wap_wsg_idm_ecid_wtls10\t\tOBJ_wap_wsg_idm_ecid,10L\n\n#define SN_wap_wsg_idm_ecid_wtls11\t\t\"wap-wsg-idm-ecid-wtls11\"\n#define NID_wap_wsg_idm_ecid_wtls11\t\t744\n#define OBJ_wap_wsg_idm_ecid_wtls11\t\tOBJ_wap_wsg_idm_ecid,11L\n\n#define SN_wap_wsg_idm_ecid_wtls12\t\t\"wap-wsg-idm-ecid-wtls12\"\n#define NID_wap_wsg_idm_ecid_wtls12\t\t745\n#define OBJ_wap_wsg_idm_ecid_wtls12\t\tOBJ_wap_wsg_idm_ecid,12L\n\n#define SN_cast5_cbc\t\t\"CAST5-CBC\"\n#define LN_cast5_cbc\t\t\"cast5-cbc\"\n#define NID_cast5_cbc\t\t108\n#define OBJ_cast5_cbc\t\tOBJ_ISO_US,113533L,7L,66L,10L\n\n#define SN_cast5_ecb\t\t\"CAST5-ECB\"\n#define LN_cast5_ecb\t\t\"cast5-ecb\"\n#define NID_cast5_ecb\t\t109\n\n#define SN_cast5_cfb64\t\t\"CAST5-CFB\"\n#define LN_cast5_cfb64\t\t\"cast5-cfb\"\n#define NID_cast5_cfb64\t\t110\n\n#define SN_cast5_ofb64\t\t\"CAST5-OFB\"\n#define LN_cast5_ofb64\t\t\"cast5-ofb\"\n#define NID_cast5_ofb64\t\t111\n\n#define LN_pbeWithMD5AndCast5_CBC\t\t\"pbeWithMD5AndCast5CBC\"\n#define NID_pbeWithMD5AndCast5_CBC\t\t112\n#define OBJ_pbeWithMD5AndCast5_CBC\t\tOBJ_ISO_US,113533L,7L,66L,12L\n\n#define SN_id_PasswordBasedMAC\t\t\"id-PasswordBasedMAC\"\n#define LN_id_PasswordBasedMAC\t\t\"password based MAC\"\n#define NID_id_PasswordBasedMAC\t\t782\n#define OBJ_id_PasswordBasedMAC\t\tOBJ_ISO_US,113533L,7L,66L,13L\n\n#define SN_id_DHBasedMac\t\t\"id-DHBasedMac\"\n#define LN_id_DHBasedMac\t\t\"Diffie-Hellman based MAC\"\n#define NID_id_DHBasedMac\t\t783\n#define OBJ_id_DHBasedMac\t\tOBJ_ISO_US,113533L,7L,66L,30L\n\n#define SN_rsadsi\t\t\"rsadsi\"\n#define LN_rsadsi\t\t\"RSA Data Security, Inc.\"\n#define NID_rsadsi\t\t1\n#define OBJ_rsadsi\t\tOBJ_ISO_US,113549L\n\n#define SN_pkcs\t\t\"pkcs\"\n#define LN_pkcs\t\t\"RSA Data Security, Inc. PKCS\"\n#define NID_pkcs\t\t2\n#define OBJ_pkcs\t\tOBJ_rsadsi,1L\n\n#define SN_pkcs1\t\t\"pkcs1\"\n#define NID_pkcs1\t\t186\n#define OBJ_pkcs1\t\tOBJ_pkcs,1L\n\n#define LN_rsaEncryption\t\t\"rsaEncryption\"\n#define NID_rsaEncryption\t\t6\n#define OBJ_rsaEncryption\t\tOBJ_pkcs1,1L\n\n#define SN_md2WithRSAEncryption\t\t\"RSA-MD2\"\n#define LN_md2WithRSAEncryption\t\t\"md2WithRSAEncryption\"\n#define NID_md2WithRSAEncryption\t\t7\n#define OBJ_md2WithRSAEncryption\t\tOBJ_pkcs1,2L\n\n#define SN_md4WithRSAEncryption\t\t\"RSA-MD4\"\n#define LN_md4WithRSAEncryption\t\t\"md4WithRSAEncryption\"\n#define NID_md4WithRSAEncryption\t\t396\n#define OBJ_md4WithRSAEncryption\t\tOBJ_pkcs1,3L\n\n#define SN_md5WithRSAEncryption\t\t\"RSA-MD5\"\n#define LN_md5WithRSAEncryption\t\t\"md5WithRSAEncryption\"\n#define NID_md5WithRSAEncryption\t\t8\n#define OBJ_md5WithRSAEncryption\t\tOBJ_pkcs1,4L\n\n#define SN_sha1WithRSAEncryption\t\t\"RSA-SHA1\"\n#define LN_sha1WithRSAEncryption\t\t\"sha1WithRSAEncryption\"\n#define NID_sha1WithRSAEncryption\t\t65\n#define OBJ_sha1WithRSAEncryption\t\tOBJ_pkcs1,5L\n\n#define SN_sha256WithRSAEncryption\t\t\"RSA-SHA256\"\n#define LN_sha256WithRSAEncryption\t\t\"sha256WithRSAEncryption\"\n#define NID_sha256WithRSAEncryption\t\t668\n#define OBJ_sha256WithRSAEncryption\t\tOBJ_pkcs1,11L\n\n#define SN_sha384WithRSAEncryption\t\t\"RSA-SHA384\"\n#define LN_sha384WithRSAEncryption\t\t\"sha384WithRSAEncryption\"\n#define NID_sha384WithRSAEncryption\t\t669\n#define OBJ_sha384WithRSAEncryption\t\tOBJ_pkcs1,12L\n\n#define SN_sha512WithRSAEncryption\t\t\"RSA-SHA512\"\n#define LN_sha512WithRSAEncryption\t\t\"sha512WithRSAEncryption\"\n#define NID_sha512WithRSAEncryption\t\t670\n#define OBJ_sha512WithRSAEncryption\t\tOBJ_pkcs1,13L\n\n#define SN_sha224WithRSAEncryption\t\t\"RSA-SHA224\"\n#define LN_sha224WithRSAEncryption\t\t\"sha224WithRSAEncryption\"\n#define NID_sha224WithRSAEncryption\t\t671\n#define OBJ_sha224WithRSAEncryption\t\tOBJ_pkcs1,14L\n\n#define SN_pkcs3\t\t\"pkcs3\"\n#define NID_pkcs3\t\t27\n#define OBJ_pkcs3\t\tOBJ_pkcs,3L\n\n#define LN_dhKeyAgreement\t\t\"dhKeyAgreement\"\n#define NID_dhKeyAgreement\t\t28\n#define OBJ_dhKeyAgreement\t\tOBJ_pkcs3,1L\n\n#define SN_pkcs5\t\t\"pkcs5\"\n#define NID_pkcs5\t\t187\n#define OBJ_pkcs5\t\tOBJ_pkcs,5L\n\n#define SN_pbeWithMD2AndDES_CBC\t\t\"PBE-MD2-DES\"\n#define LN_pbeWithMD2AndDES_CBC\t\t\"pbeWithMD2AndDES-CBC\"\n#define NID_pbeWithMD2AndDES_CBC\t\t9\n#define OBJ_pbeWithMD2AndDES_CBC\t\tOBJ_pkcs5,1L\n\n#define SN_pbeWithMD5AndDES_CBC\t\t\"PBE-MD5-DES\"\n#define LN_pbeWithMD5AndDES_CBC\t\t\"pbeWithMD5AndDES-CBC\"\n#define NID_pbeWithMD5AndDES_CBC\t\t10\n#define OBJ_pbeWithMD5AndDES_CBC\t\tOBJ_pkcs5,3L\n\n#define SN_pbeWithMD2AndRC2_CBC\t\t\"PBE-MD2-RC2-64\"\n#define LN_pbeWithMD2AndRC2_CBC\t\t\"pbeWithMD2AndRC2-CBC\"\n#define NID_pbeWithMD2AndRC2_CBC\t\t168\n#define OBJ_pbeWithMD2AndRC2_CBC\t\tOBJ_pkcs5,4L\n\n#define SN_pbeWithMD5AndRC2_CBC\t\t\"PBE-MD5-RC2-64\"\n#define LN_pbeWithMD5AndRC2_CBC\t\t\"pbeWithMD5AndRC2-CBC\"\n#define NID_pbeWithMD5AndRC2_CBC\t\t169\n#define OBJ_pbeWithMD5AndRC2_CBC\t\tOBJ_pkcs5,6L\n\n#define SN_pbeWithSHA1AndDES_CBC\t\t\"PBE-SHA1-DES\"\n#define LN_pbeWithSHA1AndDES_CBC\t\t\"pbeWithSHA1AndDES-CBC\"\n#define NID_pbeWithSHA1AndDES_CBC\t\t170\n#define OBJ_pbeWithSHA1AndDES_CBC\t\tOBJ_pkcs5,10L\n\n#define SN_pbeWithSHA1AndRC2_CBC\t\t\"PBE-SHA1-RC2-64\"\n#define LN_pbeWithSHA1AndRC2_CBC\t\t\"pbeWithSHA1AndRC2-CBC\"\n#define NID_pbeWithSHA1AndRC2_CBC\t\t68\n#define OBJ_pbeWithSHA1AndRC2_CBC\t\tOBJ_pkcs5,11L\n\n#define LN_id_pbkdf2\t\t\"PBKDF2\"\n#define NID_id_pbkdf2\t\t69\n#define OBJ_id_pbkdf2\t\tOBJ_pkcs5,12L\n\n#define LN_pbes2\t\t\"PBES2\"\n#define NID_pbes2\t\t161\n#define OBJ_pbes2\t\tOBJ_pkcs5,13L\n\n#define LN_pbmac1\t\t\"PBMAC1\"\n#define NID_pbmac1\t\t162\n#define OBJ_pbmac1\t\tOBJ_pkcs5,14L\n\n#define SN_pkcs7\t\t\"pkcs7\"\n#define NID_pkcs7\t\t20\n#define OBJ_pkcs7\t\tOBJ_pkcs,7L\n\n#define LN_pkcs7_data\t\t\"pkcs7-data\"\n#define NID_pkcs7_data\t\t21\n#define OBJ_pkcs7_data\t\tOBJ_pkcs7,1L\n\n#define LN_pkcs7_signed\t\t\"pkcs7-signedData\"\n#define NID_pkcs7_signed\t\t22\n#define OBJ_pkcs7_signed\t\tOBJ_pkcs7,2L\n\n#define LN_pkcs7_enveloped\t\t\"pkcs7-envelopedData\"\n#define NID_pkcs7_enveloped\t\t23\n#define OBJ_pkcs7_enveloped\t\tOBJ_pkcs7,3L\n\n#define LN_pkcs7_signedAndEnveloped\t\t\"pkcs7-signedAndEnvelopedData\"\n#define NID_pkcs7_signedAndEnveloped\t\t24\n#define OBJ_pkcs7_signedAndEnveloped\t\tOBJ_pkcs7,4L\n\n#define LN_pkcs7_digest\t\t\"pkcs7-digestData\"\n#define NID_pkcs7_digest\t\t25\n#define OBJ_pkcs7_digest\t\tOBJ_pkcs7,5L\n\n#define LN_pkcs7_encrypted\t\t\"pkcs7-encryptedData\"\n#define NID_pkcs7_encrypted\t\t26\n#define OBJ_pkcs7_encrypted\t\tOBJ_pkcs7,6L\n\n#define SN_pkcs9\t\t\"pkcs9\"\n#define NID_pkcs9\t\t47\n#define OBJ_pkcs9\t\tOBJ_pkcs,9L\n\n#define LN_pkcs9_emailAddress\t\t\"emailAddress\"\n#define NID_pkcs9_emailAddress\t\t48\n#define OBJ_pkcs9_emailAddress\t\tOBJ_pkcs9,1L\n\n#define LN_pkcs9_unstructuredName\t\t\"unstructuredName\"\n#define NID_pkcs9_unstructuredName\t\t49\n#define OBJ_pkcs9_unstructuredName\t\tOBJ_pkcs9,2L\n\n#define LN_pkcs9_contentType\t\t\"contentType\"\n#define NID_pkcs9_contentType\t\t50\n#define OBJ_pkcs9_contentType\t\tOBJ_pkcs9,3L\n\n#define LN_pkcs9_messageDigest\t\t\"messageDigest\"\n#define NID_pkcs9_messageDigest\t\t51\n#define OBJ_pkcs9_messageDigest\t\tOBJ_pkcs9,4L\n\n#define LN_pkcs9_signingTime\t\t\"signingTime\"\n#define NID_pkcs9_signingTime\t\t52\n#define OBJ_pkcs9_signingTime\t\tOBJ_pkcs9,5L\n\n#define LN_pkcs9_countersignature\t\t\"countersignature\"\n#define NID_pkcs9_countersignature\t\t53\n#define OBJ_pkcs9_countersignature\t\tOBJ_pkcs9,6L\n\n#define LN_pkcs9_challengePassword\t\t\"challengePassword\"\n#define NID_pkcs9_challengePassword\t\t54\n#define OBJ_pkcs9_challengePassword\t\tOBJ_pkcs9,7L\n\n#define LN_pkcs9_unstructuredAddress\t\t\"unstructuredAddress\"\n#define NID_pkcs9_unstructuredAddress\t\t55\n#define OBJ_pkcs9_unstructuredAddress\t\tOBJ_pkcs9,8L\n\n#define LN_pkcs9_extCertAttributes\t\t\"extendedCertificateAttributes\"\n#define NID_pkcs9_extCertAttributes\t\t56\n#define OBJ_pkcs9_extCertAttributes\t\tOBJ_pkcs9,9L\n\n#define SN_ext_req\t\t\"extReq\"\n#define LN_ext_req\t\t\"Extension Request\"\n#define NID_ext_req\t\t172\n#define OBJ_ext_req\t\tOBJ_pkcs9,14L\n\n#define SN_SMIMECapabilities\t\t\"SMIME-CAPS\"\n#define LN_SMIMECapabilities\t\t\"S/MIME Capabilities\"\n#define NID_SMIMECapabilities\t\t167\n#define OBJ_SMIMECapabilities\t\tOBJ_pkcs9,15L\n\n#define SN_SMIME\t\t\"SMIME\"\n#define LN_SMIME\t\t\"S/MIME\"\n#define NID_SMIME\t\t188\n#define OBJ_SMIME\t\tOBJ_pkcs9,16L\n\n#define SN_id_smime_mod\t\t\"id-smime-mod\"\n#define NID_id_smime_mod\t\t189\n#define OBJ_id_smime_mod\t\tOBJ_SMIME,0L\n\n#define SN_id_smime_ct\t\t\"id-smime-ct\"\n#define NID_id_smime_ct\t\t190\n#define OBJ_id_smime_ct\t\tOBJ_SMIME,1L\n\n#define SN_id_smime_aa\t\t\"id-smime-aa\"\n#define NID_id_smime_aa\t\t191\n#define OBJ_id_smime_aa\t\tOBJ_SMIME,2L\n\n#define SN_id_smime_alg\t\t\"id-smime-alg\"\n#define NID_id_smime_alg\t\t192\n#define OBJ_id_smime_alg\t\tOBJ_SMIME,3L\n\n#define SN_id_smime_cd\t\t\"id-smime-cd\"\n#define NID_id_smime_cd\t\t193\n#define OBJ_id_smime_cd\t\tOBJ_SMIME,4L\n\n#define SN_id_smime_spq\t\t\"id-smime-spq\"\n#define NID_id_smime_spq\t\t194\n#define OBJ_id_smime_spq\t\tOBJ_SMIME,5L\n\n#define SN_id_smime_cti\t\t\"id-smime-cti\"\n#define NID_id_smime_cti\t\t195\n#define OBJ_id_smime_cti\t\tOBJ_SMIME,6L\n\n#define SN_id_smime_mod_cms\t\t\"id-smime-mod-cms\"\n#define NID_id_smime_mod_cms\t\t196\n#define OBJ_id_smime_mod_cms\t\tOBJ_id_smime_mod,1L\n\n#define SN_id_smime_mod_ess\t\t\"id-smime-mod-ess\"\n#define NID_id_smime_mod_ess\t\t197\n#define OBJ_id_smime_mod_ess\t\tOBJ_id_smime_mod,2L\n\n#define SN_id_smime_mod_oid\t\t\"id-smime-mod-oid\"\n#define NID_id_smime_mod_oid\t\t198\n#define OBJ_id_smime_mod_oid\t\tOBJ_id_smime_mod,3L\n\n#define SN_id_smime_mod_msg_v3\t\t\"id-smime-mod-msg-v3\"\n#define NID_id_smime_mod_msg_v3\t\t199\n#define OBJ_id_smime_mod_msg_v3\t\tOBJ_id_smime_mod,4L\n\n#define SN_id_smime_mod_ets_eSignature_88\t\t\"id-smime-mod-ets-eSignature-88\"\n#define NID_id_smime_mod_ets_eSignature_88\t\t200\n#define OBJ_id_smime_mod_ets_eSignature_88\t\tOBJ_id_smime_mod,5L\n\n#define SN_id_smime_mod_ets_eSignature_97\t\t\"id-smime-mod-ets-eSignature-97\"\n#define NID_id_smime_mod_ets_eSignature_97\t\t201\n#define OBJ_id_smime_mod_ets_eSignature_97\t\tOBJ_id_smime_mod,6L\n\n#define SN_id_smime_mod_ets_eSigPolicy_88\t\t\"id-smime-mod-ets-eSigPolicy-88\"\n#define NID_id_smime_mod_ets_eSigPolicy_88\t\t202\n#define OBJ_id_smime_mod_ets_eSigPolicy_88\t\tOBJ_id_smime_mod,7L\n\n#define SN_id_smime_mod_ets_eSigPolicy_97\t\t\"id-smime-mod-ets-eSigPolicy-97\"\n#define NID_id_smime_mod_ets_eSigPolicy_97\t\t203\n#define OBJ_id_smime_mod_ets_eSigPolicy_97\t\tOBJ_id_smime_mod,8L\n\n#define SN_id_smime_ct_receipt\t\t\"id-smime-ct-receipt\"\n#define NID_id_smime_ct_receipt\t\t204\n#define OBJ_id_smime_ct_receipt\t\tOBJ_id_smime_ct,1L\n\n#define SN_id_smime_ct_authData\t\t\"id-smime-ct-authData\"\n#define NID_id_smime_ct_authData\t\t205\n#define OBJ_id_smime_ct_authData\t\tOBJ_id_smime_ct,2L\n\n#define SN_id_smime_ct_publishCert\t\t\"id-smime-ct-publishCert\"\n#define NID_id_smime_ct_publishCert\t\t206\n#define OBJ_id_smime_ct_publishCert\t\tOBJ_id_smime_ct,3L\n\n#define SN_id_smime_ct_TSTInfo\t\t\"id-smime-ct-TSTInfo\"\n#define NID_id_smime_ct_TSTInfo\t\t207\n#define OBJ_id_smime_ct_TSTInfo\t\tOBJ_id_smime_ct,4L\n\n#define SN_id_smime_ct_TDTInfo\t\t\"id-smime-ct-TDTInfo\"\n#define NID_id_smime_ct_TDTInfo\t\t208\n#define OBJ_id_smime_ct_TDTInfo\t\tOBJ_id_smime_ct,5L\n\n#define SN_id_smime_ct_contentInfo\t\t\"id-smime-ct-contentInfo\"\n#define NID_id_smime_ct_contentInfo\t\t209\n#define OBJ_id_smime_ct_contentInfo\t\tOBJ_id_smime_ct,6L\n\n#define SN_id_smime_ct_DVCSRequestData\t\t\"id-smime-ct-DVCSRequestData\"\n#define NID_id_smime_ct_DVCSRequestData\t\t210\n#define OBJ_id_smime_ct_DVCSRequestData\t\tOBJ_id_smime_ct,7L\n\n#define SN_id_smime_ct_DVCSResponseData\t\t\"id-smime-ct-DVCSResponseData\"\n#define NID_id_smime_ct_DVCSResponseData\t\t211\n#define OBJ_id_smime_ct_DVCSResponseData\t\tOBJ_id_smime_ct,8L\n\n#define SN_id_smime_ct_compressedData\t\t\"id-smime-ct-compressedData\"\n#define NID_id_smime_ct_compressedData\t\t786\n#define OBJ_id_smime_ct_compressedData\t\tOBJ_id_smime_ct,9L\n\n#define SN_id_ct_asciiTextWithCRLF\t\t\"id-ct-asciiTextWithCRLF\"\n#define NID_id_ct_asciiTextWithCRLF\t\t787\n#define OBJ_id_ct_asciiTextWithCRLF\t\tOBJ_id_smime_ct,27L\n\n#define SN_id_smime_aa_receiptRequest\t\t\"id-smime-aa-receiptRequest\"\n#define NID_id_smime_aa_receiptRequest\t\t212\n#define OBJ_id_smime_aa_receiptRequest\t\tOBJ_id_smime_aa,1L\n\n#define SN_id_smime_aa_securityLabel\t\t\"id-smime-aa-securityLabel\"\n#define NID_id_smime_aa_securityLabel\t\t213\n#define OBJ_id_smime_aa_securityLabel\t\tOBJ_id_smime_aa,2L\n\n#define SN_id_smime_aa_mlExpandHistory\t\t\"id-smime-aa-mlExpandHistory\"\n#define NID_id_smime_aa_mlExpandHistory\t\t214\n#define OBJ_id_smime_aa_mlExpandHistory\t\tOBJ_id_smime_aa,3L\n\n#define SN_id_smime_aa_contentHint\t\t\"id-smime-aa-contentHint\"\n#define NID_id_smime_aa_contentHint\t\t215\n#define OBJ_id_smime_aa_contentHint\t\tOBJ_id_smime_aa,4L\n\n#define SN_id_smime_aa_msgSigDigest\t\t\"id-smime-aa-msgSigDigest\"\n#define NID_id_smime_aa_msgSigDigest\t\t216\n#define OBJ_id_smime_aa_msgSigDigest\t\tOBJ_id_smime_aa,5L\n\n#define SN_id_smime_aa_encapContentType\t\t\"id-smime-aa-encapContentType\"\n#define NID_id_smime_aa_encapContentType\t\t217\n#define OBJ_id_smime_aa_encapContentType\t\tOBJ_id_smime_aa,6L\n\n#define SN_id_smime_aa_contentIdentifier\t\t\"id-smime-aa-contentIdentifier\"\n#define NID_id_smime_aa_contentIdentifier\t\t218\n#define OBJ_id_smime_aa_contentIdentifier\t\tOBJ_id_smime_aa,7L\n\n#define SN_id_smime_aa_macValue\t\t\"id-smime-aa-macValue\"\n#define NID_id_smime_aa_macValue\t\t219\n#define OBJ_id_smime_aa_macValue\t\tOBJ_id_smime_aa,8L\n\n#define SN_id_smime_aa_equivalentLabels\t\t\"id-smime-aa-equivalentLabels\"\n#define NID_id_smime_aa_equivalentLabels\t\t220\n#define OBJ_id_smime_aa_equivalentLabels\t\tOBJ_id_smime_aa,9L\n\n#define SN_id_smime_aa_contentReference\t\t\"id-smime-aa-contentReference\"\n#define NID_id_smime_aa_contentReference\t\t221\n#define OBJ_id_smime_aa_contentReference\t\tOBJ_id_smime_aa,10L\n\n#define SN_id_smime_aa_encrypKeyPref\t\t\"id-smime-aa-encrypKeyPref\"\n#define NID_id_smime_aa_encrypKeyPref\t\t222\n#define OBJ_id_smime_aa_encrypKeyPref\t\tOBJ_id_smime_aa,11L\n\n#define SN_id_smime_aa_signingCertificate\t\t\"id-smime-aa-signingCertificate\"\n#define NID_id_smime_aa_signingCertificate\t\t223\n#define OBJ_id_smime_aa_signingCertificate\t\tOBJ_id_smime_aa,12L\n\n#define SN_id_smime_aa_smimeEncryptCerts\t\t\"id-smime-aa-smimeEncryptCerts\"\n#define NID_id_smime_aa_smimeEncryptCerts\t\t224\n#define OBJ_id_smime_aa_smimeEncryptCerts\t\tOBJ_id_smime_aa,13L\n\n#define SN_id_smime_aa_timeStampToken\t\t\"id-smime-aa-timeStampToken\"\n#define NID_id_smime_aa_timeStampToken\t\t225\n#define OBJ_id_smime_aa_timeStampToken\t\tOBJ_id_smime_aa,14L\n\n#define SN_id_smime_aa_ets_sigPolicyId\t\t\"id-smime-aa-ets-sigPolicyId\"\n#define NID_id_smime_aa_ets_sigPolicyId\t\t226\n#define OBJ_id_smime_aa_ets_sigPolicyId\t\tOBJ_id_smime_aa,15L\n\n#define SN_id_smime_aa_ets_commitmentType\t\t\"id-smime-aa-ets-commitmentType\"\n#define NID_id_smime_aa_ets_commitmentType\t\t227\n#define OBJ_id_smime_aa_ets_commitmentType\t\tOBJ_id_smime_aa,16L\n\n#define SN_id_smime_aa_ets_signerLocation\t\t\"id-smime-aa-ets-signerLocation\"\n#define NID_id_smime_aa_ets_signerLocation\t\t228\n#define OBJ_id_smime_aa_ets_signerLocation\t\tOBJ_id_smime_aa,17L\n\n#define SN_id_smime_aa_ets_signerAttr\t\t\"id-smime-aa-ets-signerAttr\"\n#define NID_id_smime_aa_ets_signerAttr\t\t229\n#define OBJ_id_smime_aa_ets_signerAttr\t\tOBJ_id_smime_aa,18L\n\n#define SN_id_smime_aa_ets_otherSigCert\t\t\"id-smime-aa-ets-otherSigCert\"\n#define NID_id_smime_aa_ets_otherSigCert\t\t230\n#define OBJ_id_smime_aa_ets_otherSigCert\t\tOBJ_id_smime_aa,19L\n\n#define SN_id_smime_aa_ets_contentTimestamp\t\t\"id-smime-aa-ets-contentTimestamp\"\n#define NID_id_smime_aa_ets_contentTimestamp\t\t231\n#define OBJ_id_smime_aa_ets_contentTimestamp\t\tOBJ_id_smime_aa,20L\n\n#define SN_id_smime_aa_ets_CertificateRefs\t\t\"id-smime-aa-ets-CertificateRefs\"\n#define NID_id_smime_aa_ets_CertificateRefs\t\t232\n#define OBJ_id_smime_aa_ets_CertificateRefs\t\tOBJ_id_smime_aa,21L\n\n#define SN_id_smime_aa_ets_RevocationRefs\t\t\"id-smime-aa-ets-RevocationRefs\"\n#define NID_id_smime_aa_ets_RevocationRefs\t\t233\n#define OBJ_id_smime_aa_ets_RevocationRefs\t\tOBJ_id_smime_aa,22L\n\n#define SN_id_smime_aa_ets_certValues\t\t\"id-smime-aa-ets-certValues\"\n#define NID_id_smime_aa_ets_certValues\t\t234\n#define OBJ_id_smime_aa_ets_certValues\t\tOBJ_id_smime_aa,23L\n\n#define SN_id_smime_aa_ets_revocationValues\t\t\"id-smime-aa-ets-revocationValues\"\n#define NID_id_smime_aa_ets_revocationValues\t\t235\n#define OBJ_id_smime_aa_ets_revocationValues\t\tOBJ_id_smime_aa,24L\n\n#define SN_id_smime_aa_ets_escTimeStamp\t\t\"id-smime-aa-ets-escTimeStamp\"\n#define NID_id_smime_aa_ets_escTimeStamp\t\t236\n#define OBJ_id_smime_aa_ets_escTimeStamp\t\tOBJ_id_smime_aa,25L\n\n#define SN_id_smime_aa_ets_certCRLTimestamp\t\t\"id-smime-aa-ets-certCRLTimestamp\"\n#define NID_id_smime_aa_ets_certCRLTimestamp\t\t237\n#define OBJ_id_smime_aa_ets_certCRLTimestamp\t\tOBJ_id_smime_aa,26L\n\n#define SN_id_smime_aa_ets_archiveTimeStamp\t\t\"id-smime-aa-ets-archiveTimeStamp\"\n#define NID_id_smime_aa_ets_archiveTimeStamp\t\t238\n#define OBJ_id_smime_aa_ets_archiveTimeStamp\t\tOBJ_id_smime_aa,27L\n\n#define SN_id_smime_aa_signatureType\t\t\"id-smime-aa-signatureType\"\n#define NID_id_smime_aa_signatureType\t\t239\n#define OBJ_id_smime_aa_signatureType\t\tOBJ_id_smime_aa,28L\n\n#define SN_id_smime_aa_dvcs_dvc\t\t\"id-smime-aa-dvcs-dvc\"\n#define NID_id_smime_aa_dvcs_dvc\t\t240\n#define OBJ_id_smime_aa_dvcs_dvc\t\tOBJ_id_smime_aa,29L\n\n#define SN_id_smime_alg_ESDHwith3DES\t\t\"id-smime-alg-ESDHwith3DES\"\n#define NID_id_smime_alg_ESDHwith3DES\t\t241\n#define OBJ_id_smime_alg_ESDHwith3DES\t\tOBJ_id_smime_alg,1L\n\n#define SN_id_smime_alg_ESDHwithRC2\t\t\"id-smime-alg-ESDHwithRC2\"\n#define NID_id_smime_alg_ESDHwithRC2\t\t242\n#define OBJ_id_smime_alg_ESDHwithRC2\t\tOBJ_id_smime_alg,2L\n\n#define SN_id_smime_alg_3DESwrap\t\t\"id-smime-alg-3DESwrap\"\n#define NID_id_smime_alg_3DESwrap\t\t243\n#define OBJ_id_smime_alg_3DESwrap\t\tOBJ_id_smime_alg,3L\n\n#define SN_id_smime_alg_RC2wrap\t\t\"id-smime-alg-RC2wrap\"\n#define NID_id_smime_alg_RC2wrap\t\t244\n#define OBJ_id_smime_alg_RC2wrap\t\tOBJ_id_smime_alg,4L\n\n#define SN_id_smime_alg_ESDH\t\t\"id-smime-alg-ESDH\"\n#define NID_id_smime_alg_ESDH\t\t245\n#define OBJ_id_smime_alg_ESDH\t\tOBJ_id_smime_alg,5L\n\n#define SN_id_smime_alg_CMS3DESwrap\t\t\"id-smime-alg-CMS3DESwrap\"\n#define NID_id_smime_alg_CMS3DESwrap\t\t246\n#define OBJ_id_smime_alg_CMS3DESwrap\t\tOBJ_id_smime_alg,6L\n\n#define SN_id_smime_alg_CMSRC2wrap\t\t\"id-smime-alg-CMSRC2wrap\"\n#define NID_id_smime_alg_CMSRC2wrap\t\t247\n#define OBJ_id_smime_alg_CMSRC2wrap\t\tOBJ_id_smime_alg,7L\n\n#define SN_id_smime_cd_ldap\t\t\"id-smime-cd-ldap\"\n#define NID_id_smime_cd_ldap\t\t248\n#define OBJ_id_smime_cd_ldap\t\tOBJ_id_smime_cd,1L\n\n#define SN_id_smime_spq_ets_sqt_uri\t\t\"id-smime-spq-ets-sqt-uri\"\n#define NID_id_smime_spq_ets_sqt_uri\t\t249\n#define OBJ_id_smime_spq_ets_sqt_uri\t\tOBJ_id_smime_spq,1L\n\n#define SN_id_smime_spq_ets_sqt_unotice\t\t\"id-smime-spq-ets-sqt-unotice\"\n#define NID_id_smime_spq_ets_sqt_unotice\t\t250\n#define OBJ_id_smime_spq_ets_sqt_unotice\t\tOBJ_id_smime_spq,2L\n\n#define SN_id_smime_cti_ets_proofOfOrigin\t\t\"id-smime-cti-ets-proofOfOrigin\"\n#define NID_id_smime_cti_ets_proofOfOrigin\t\t251\n#define OBJ_id_smime_cti_ets_proofOfOrigin\t\tOBJ_id_smime_cti,1L\n\n#define SN_id_smime_cti_ets_proofOfReceipt\t\t\"id-smime-cti-ets-proofOfReceipt\"\n#define NID_id_smime_cti_ets_proofOfReceipt\t\t252\n#define OBJ_id_smime_cti_ets_proofOfReceipt\t\tOBJ_id_smime_cti,2L\n\n#define SN_id_smime_cti_ets_proofOfDelivery\t\t\"id-smime-cti-ets-proofOfDelivery\"\n#define NID_id_smime_cti_ets_proofOfDelivery\t\t253\n#define OBJ_id_smime_cti_ets_proofOfDelivery\t\tOBJ_id_smime_cti,3L\n\n#define SN_id_smime_cti_ets_proofOfSender\t\t\"id-smime-cti-ets-proofOfSender\"\n#define NID_id_smime_cti_ets_proofOfSender\t\t254\n#define OBJ_id_smime_cti_ets_proofOfSender\t\tOBJ_id_smime_cti,4L\n\n#define SN_id_smime_cti_ets_proofOfApproval\t\t\"id-smime-cti-ets-proofOfApproval\"\n#define NID_id_smime_cti_ets_proofOfApproval\t\t255\n#define OBJ_id_smime_cti_ets_proofOfApproval\t\tOBJ_id_smime_cti,5L\n\n#define SN_id_smime_cti_ets_proofOfCreation\t\t\"id-smime-cti-ets-proofOfCreation\"\n#define NID_id_smime_cti_ets_proofOfCreation\t\t256\n#define OBJ_id_smime_cti_ets_proofOfCreation\t\tOBJ_id_smime_cti,6L\n\n#define LN_friendlyName\t\t\"friendlyName\"\n#define NID_friendlyName\t\t156\n#define OBJ_friendlyName\t\tOBJ_pkcs9,20L\n\n#define LN_localKeyID\t\t\"localKeyID\"\n#define NID_localKeyID\t\t157\n#define OBJ_localKeyID\t\tOBJ_pkcs9,21L\n\n#define SN_ms_csp_name\t\t\"CSPName\"\n#define LN_ms_csp_name\t\t\"Microsoft CSP Name\"\n#define NID_ms_csp_name\t\t417\n#define OBJ_ms_csp_name\t\t1L,3L,6L,1L,4L,1L,311L,17L,1L\n\n#define SN_LocalKeySet\t\t\"LocalKeySet\"\n#define LN_LocalKeySet\t\t\"Microsoft Local Key set\"\n#define NID_LocalKeySet\t\t856\n#define OBJ_LocalKeySet\t\t1L,3L,6L,1L,4L,1L,311L,17L,2L\n\n#define OBJ_certTypes\t\tOBJ_pkcs9,22L\n\n#define LN_x509Certificate\t\t\"x509Certificate\"\n#define NID_x509Certificate\t\t158\n#define OBJ_x509Certificate\t\tOBJ_certTypes,1L\n\n#define LN_sdsiCertificate\t\t\"sdsiCertificate\"\n#define NID_sdsiCertificate\t\t159\n#define OBJ_sdsiCertificate\t\tOBJ_certTypes,2L\n\n#define OBJ_crlTypes\t\tOBJ_pkcs9,23L\n\n#define LN_x509Crl\t\t\"x509Crl\"\n#define NID_x509Crl\t\t160\n#define OBJ_x509Crl\t\tOBJ_crlTypes,1L\n\n#define OBJ_pkcs12\t\tOBJ_pkcs,12L\n\n#define OBJ_pkcs12_pbeids\t\tOBJ_pkcs12,1L\n\n#define SN_pbe_WithSHA1And128BitRC4\t\t\"PBE-SHA1-RC4-128\"\n#define LN_pbe_WithSHA1And128BitRC4\t\t\"pbeWithSHA1And128BitRC4\"\n#define NID_pbe_WithSHA1And128BitRC4\t\t144\n#define OBJ_pbe_WithSHA1And128BitRC4\t\tOBJ_pkcs12_pbeids,1L\n\n#define SN_pbe_WithSHA1And40BitRC4\t\t\"PBE-SHA1-RC4-40\"\n#define LN_pbe_WithSHA1And40BitRC4\t\t\"pbeWithSHA1And40BitRC4\"\n#define NID_pbe_WithSHA1And40BitRC4\t\t145\n#define OBJ_pbe_WithSHA1And40BitRC4\t\tOBJ_pkcs12_pbeids,2L\n\n#define SN_pbe_WithSHA1And3_Key_TripleDES_CBC\t\t\"PBE-SHA1-3DES\"\n#define LN_pbe_WithSHA1And3_Key_TripleDES_CBC\t\t\"pbeWithSHA1And3-KeyTripleDES-CBC\"\n#define NID_pbe_WithSHA1And3_Key_TripleDES_CBC\t\t146\n#define OBJ_pbe_WithSHA1And3_Key_TripleDES_CBC\t\tOBJ_pkcs12_pbeids,3L\n\n#define SN_pbe_WithSHA1And2_Key_TripleDES_CBC\t\t\"PBE-SHA1-2DES\"\n#define LN_pbe_WithSHA1And2_Key_TripleDES_CBC\t\t\"pbeWithSHA1And2-KeyTripleDES-CBC\"\n#define NID_pbe_WithSHA1And2_Key_TripleDES_CBC\t\t147\n#define OBJ_pbe_WithSHA1And2_Key_TripleDES_CBC\t\tOBJ_pkcs12_pbeids,4L\n\n#define SN_pbe_WithSHA1And128BitRC2_CBC\t\t\"PBE-SHA1-RC2-128\"\n#define LN_pbe_WithSHA1And128BitRC2_CBC\t\t\"pbeWithSHA1And128BitRC2-CBC\"\n#define NID_pbe_WithSHA1And128BitRC2_CBC\t\t148\n#define OBJ_pbe_WithSHA1And128BitRC2_CBC\t\tOBJ_pkcs12_pbeids,5L\n\n#define SN_pbe_WithSHA1And40BitRC2_CBC\t\t\"PBE-SHA1-RC2-40\"\n#define LN_pbe_WithSHA1And40BitRC2_CBC\t\t\"pbeWithSHA1And40BitRC2-CBC\"\n#define NID_pbe_WithSHA1And40BitRC2_CBC\t\t149\n#define OBJ_pbe_WithSHA1And40BitRC2_CBC\t\tOBJ_pkcs12_pbeids,6L\n\n#define OBJ_pkcs12_Version1\t\tOBJ_pkcs12,10L\n\n#define OBJ_pkcs12_BagIds\t\tOBJ_pkcs12_Version1,1L\n\n#define LN_keyBag\t\t\"keyBag\"\n#define NID_keyBag\t\t150\n#define OBJ_keyBag\t\tOBJ_pkcs12_BagIds,1L\n\n#define LN_pkcs8ShroudedKeyBag\t\t\"pkcs8ShroudedKeyBag\"\n#define NID_pkcs8ShroudedKeyBag\t\t151\n#define OBJ_pkcs8ShroudedKeyBag\t\tOBJ_pkcs12_BagIds,2L\n\n#define LN_certBag\t\t\"certBag\"\n#define NID_certBag\t\t152\n#define OBJ_certBag\t\tOBJ_pkcs12_BagIds,3L\n\n#define LN_crlBag\t\t\"crlBag\"\n#define NID_crlBag\t\t153\n#define OBJ_crlBag\t\tOBJ_pkcs12_BagIds,4L\n\n#define LN_secretBag\t\t\"secretBag\"\n#define NID_secretBag\t\t154\n#define OBJ_secretBag\t\tOBJ_pkcs12_BagIds,5L\n\n#define LN_safeContentsBag\t\t\"safeContentsBag\"\n#define NID_safeContentsBag\t\t155\n#define OBJ_safeContentsBag\t\tOBJ_pkcs12_BagIds,6L\n\n#define SN_md2\t\t\"MD2\"\n#define LN_md2\t\t\"md2\"\n#define NID_md2\t\t3\n#define OBJ_md2\t\tOBJ_rsadsi,2L,2L\n\n#define SN_md4\t\t\"MD4\"\n#define LN_md4\t\t\"md4\"\n#define NID_md4\t\t257\n#define OBJ_md4\t\tOBJ_rsadsi,2L,4L\n\n#define SN_md5\t\t\"MD5\"\n#define LN_md5\t\t\"md5\"\n#define NID_md5\t\t4\n#define OBJ_md5\t\tOBJ_rsadsi,2L,5L\n\n#define SN_md5_sha1\t\t\"MD5-SHA1\"\n#define LN_md5_sha1\t\t\"md5-sha1\"\n#define NID_md5_sha1\t\t114\n\n#define LN_hmacWithMD5\t\t\"hmacWithMD5\"\n#define NID_hmacWithMD5\t\t797\n#define OBJ_hmacWithMD5\t\tOBJ_rsadsi,2L,6L\n\n#define LN_hmacWithSHA1\t\t\"hmacWithSHA1\"\n#define NID_hmacWithSHA1\t\t163\n#define OBJ_hmacWithSHA1\t\tOBJ_rsadsi,2L,7L\n\n#define LN_hmacWithSHA224\t\t\"hmacWithSHA224\"\n#define NID_hmacWithSHA224\t\t798\n#define OBJ_hmacWithSHA224\t\tOBJ_rsadsi,2L,8L\n\n#define LN_hmacWithSHA256\t\t\"hmacWithSHA256\"\n#define NID_hmacWithSHA256\t\t799\n#define OBJ_hmacWithSHA256\t\tOBJ_rsadsi,2L,9L\n\n#define LN_hmacWithSHA384\t\t\"hmacWithSHA384\"\n#define NID_hmacWithSHA384\t\t800\n#define OBJ_hmacWithSHA384\t\tOBJ_rsadsi,2L,10L\n\n#define LN_hmacWithSHA512\t\t\"hmacWithSHA512\"\n#define NID_hmacWithSHA512\t\t801\n#define OBJ_hmacWithSHA512\t\tOBJ_rsadsi,2L,11L\n\n#define SN_rc2_cbc\t\t\"RC2-CBC\"\n#define LN_rc2_cbc\t\t\"rc2-cbc\"\n#define NID_rc2_cbc\t\t37\n#define OBJ_rc2_cbc\t\tOBJ_rsadsi,3L,2L\n\n#define SN_rc2_ecb\t\t\"RC2-ECB\"\n#define LN_rc2_ecb\t\t\"rc2-ecb\"\n#define NID_rc2_ecb\t\t38\n\n#define SN_rc2_cfb64\t\t\"RC2-CFB\"\n#define LN_rc2_cfb64\t\t\"rc2-cfb\"\n#define NID_rc2_cfb64\t\t39\n\n#define SN_rc2_ofb64\t\t\"RC2-OFB\"\n#define LN_rc2_ofb64\t\t\"rc2-ofb\"\n#define NID_rc2_ofb64\t\t40\n\n#define SN_rc2_40_cbc\t\t\"RC2-40-CBC\"\n#define LN_rc2_40_cbc\t\t\"rc2-40-cbc\"\n#define NID_rc2_40_cbc\t\t98\n\n#define SN_rc2_64_cbc\t\t\"RC2-64-CBC\"\n#define LN_rc2_64_cbc\t\t\"rc2-64-cbc\"\n#define NID_rc2_64_cbc\t\t166\n\n#define SN_rc4\t\t\"RC4\"\n#define LN_rc4\t\t\"rc4\"\n#define NID_rc4\t\t5\n#define OBJ_rc4\t\tOBJ_rsadsi,3L,4L\n\n#define SN_rc4_40\t\t\"RC4-40\"\n#define LN_rc4_40\t\t\"rc4-40\"\n#define NID_rc4_40\t\t97\n\n#define SN_des_ede3_cbc\t\t\"DES-EDE3-CBC\"\n#define LN_des_ede3_cbc\t\t\"des-ede3-cbc\"\n#define NID_des_ede3_cbc\t\t44\n#define OBJ_des_ede3_cbc\t\tOBJ_rsadsi,3L,7L\n\n#define SN_rc5_cbc\t\t\"RC5-CBC\"\n#define LN_rc5_cbc\t\t\"rc5-cbc\"\n#define NID_rc5_cbc\t\t120\n#define OBJ_rc5_cbc\t\tOBJ_rsadsi,3L,8L\n\n#define SN_rc5_ecb\t\t\"RC5-ECB\"\n#define LN_rc5_ecb\t\t\"rc5-ecb\"\n#define NID_rc5_ecb\t\t121\n\n#define SN_rc5_cfb64\t\t\"RC5-CFB\"\n#define LN_rc5_cfb64\t\t\"rc5-cfb\"\n#define NID_rc5_cfb64\t\t122\n\n#define SN_rc5_ofb64\t\t\"RC5-OFB\"\n#define LN_rc5_ofb64\t\t\"rc5-ofb\"\n#define NID_rc5_ofb64\t\t123\n\n#define SN_ms_ext_req\t\t\"msExtReq\"\n#define LN_ms_ext_req\t\t\"Microsoft Extension Request\"\n#define NID_ms_ext_req\t\t171\n#define OBJ_ms_ext_req\t\t1L,3L,6L,1L,4L,1L,311L,2L,1L,14L\n\n#define SN_ms_code_ind\t\t\"msCodeInd\"\n#define LN_ms_code_ind\t\t\"Microsoft Individual Code Signing\"\n#define NID_ms_code_ind\t\t134\n#define OBJ_ms_code_ind\t\t1L,3L,6L,1L,4L,1L,311L,2L,1L,21L\n\n#define SN_ms_code_com\t\t\"msCodeCom\"\n#define LN_ms_code_com\t\t\"Microsoft Commercial Code Signing\"\n#define NID_ms_code_com\t\t135\n#define OBJ_ms_code_com\t\t1L,3L,6L,1L,4L,1L,311L,2L,1L,22L\n\n#define SN_ms_ctl_sign\t\t\"msCTLSign\"\n#define LN_ms_ctl_sign\t\t\"Microsoft Trust List Signing\"\n#define NID_ms_ctl_sign\t\t136\n#define OBJ_ms_ctl_sign\t\t1L,3L,6L,1L,4L,1L,311L,10L,3L,1L\n\n#define SN_ms_sgc\t\t\"msSGC\"\n#define LN_ms_sgc\t\t\"Microsoft Server Gated Crypto\"\n#define NID_ms_sgc\t\t137\n#define OBJ_ms_sgc\t\t1L,3L,6L,1L,4L,1L,311L,10L,3L,3L\n\n#define SN_ms_efs\t\t\"msEFS\"\n#define LN_ms_efs\t\t\"Microsoft Encrypted File System\"\n#define NID_ms_efs\t\t138\n#define OBJ_ms_efs\t\t1L,3L,6L,1L,4L,1L,311L,10L,3L,4L\n\n#define SN_ms_smartcard_login\t\t\"msSmartcardLogin\"\n#define LN_ms_smartcard_login\t\t\"Microsoft Smartcardlogin\"\n#define NID_ms_smartcard_login\t\t648\n#define OBJ_ms_smartcard_login\t\t1L,3L,6L,1L,4L,1L,311L,20L,2L,2L\n\n#define SN_ms_upn\t\t\"msUPN\"\n#define LN_ms_upn\t\t\"Microsoft Universal Principal Name\"\n#define NID_ms_upn\t\t649\n#define OBJ_ms_upn\t\t1L,3L,6L,1L,4L,1L,311L,20L,2L,3L\n\n#define SN_idea_cbc\t\t\"IDEA-CBC\"\n#define LN_idea_cbc\t\t\"idea-cbc\"\n#define NID_idea_cbc\t\t34\n#define OBJ_idea_cbc\t\t1L,3L,6L,1L,4L,1L,188L,7L,1L,1L,2L\n\n#define SN_idea_ecb\t\t\"IDEA-ECB\"\n#define LN_idea_ecb\t\t\"idea-ecb\"\n#define NID_idea_ecb\t\t36\n\n#define SN_idea_cfb64\t\t\"IDEA-CFB\"\n#define LN_idea_cfb64\t\t\"idea-cfb\"\n#define NID_idea_cfb64\t\t35\n\n#define SN_idea_ofb64\t\t\"IDEA-OFB\"\n#define LN_idea_ofb64\t\t\"idea-ofb\"\n#define NID_idea_ofb64\t\t46\n\n#define SN_bf_cbc\t\t\"BF-CBC\"\n#define LN_bf_cbc\t\t\"bf-cbc\"\n#define NID_bf_cbc\t\t91\n#define OBJ_bf_cbc\t\t1L,3L,6L,1L,4L,1L,3029L,1L,2L\n\n#define SN_bf_ecb\t\t\"BF-ECB\"\n#define LN_bf_ecb\t\t\"bf-ecb\"\n#define NID_bf_ecb\t\t92\n\n#define SN_bf_cfb64\t\t\"BF-CFB\"\n#define LN_bf_cfb64\t\t\"bf-cfb\"\n#define NID_bf_cfb64\t\t93\n\n#define SN_bf_ofb64\t\t\"BF-OFB\"\n#define LN_bf_ofb64\t\t\"bf-ofb\"\n#define NID_bf_ofb64\t\t94\n\n#define SN_id_pkix\t\t\"PKIX\"\n#define NID_id_pkix\t\t127\n#define OBJ_id_pkix\t\t1L,3L,6L,1L,5L,5L,7L\n\n#define SN_id_pkix_mod\t\t\"id-pkix-mod\"\n#define NID_id_pkix_mod\t\t258\n#define OBJ_id_pkix_mod\t\tOBJ_id_pkix,0L\n\n#define SN_id_pe\t\t\"id-pe\"\n#define NID_id_pe\t\t175\n#define OBJ_id_pe\t\tOBJ_id_pkix,1L\n\n#define SN_id_qt\t\t\"id-qt\"\n#define NID_id_qt\t\t259\n#define OBJ_id_qt\t\tOBJ_id_pkix,2L\n\n#define SN_id_kp\t\t\"id-kp\"\n#define NID_id_kp\t\t128\n#define OBJ_id_kp\t\tOBJ_id_pkix,3L\n\n#define SN_id_it\t\t\"id-it\"\n#define NID_id_it\t\t260\n#define OBJ_id_it\t\tOBJ_id_pkix,4L\n\n#define SN_id_pkip\t\t\"id-pkip\"\n#define NID_id_pkip\t\t261\n#define OBJ_id_pkip\t\tOBJ_id_pkix,5L\n\n#define SN_id_alg\t\t\"id-alg\"\n#define NID_id_alg\t\t262\n#define OBJ_id_alg\t\tOBJ_id_pkix,6L\n\n#define SN_id_cmc\t\t\"id-cmc\"\n#define NID_id_cmc\t\t263\n#define OBJ_id_cmc\t\tOBJ_id_pkix,7L\n\n#define SN_id_on\t\t\"id-on\"\n#define NID_id_on\t\t264\n#define OBJ_id_on\t\tOBJ_id_pkix,8L\n\n#define SN_id_pda\t\t\"id-pda\"\n#define NID_id_pda\t\t265\n#define OBJ_id_pda\t\tOBJ_id_pkix,9L\n\n#define SN_id_aca\t\t\"id-aca\"\n#define NID_id_aca\t\t266\n#define OBJ_id_aca\t\tOBJ_id_pkix,10L\n\n#define SN_id_qcs\t\t\"id-qcs\"\n#define NID_id_qcs\t\t267\n#define OBJ_id_qcs\t\tOBJ_id_pkix,11L\n\n#define SN_id_cct\t\t\"id-cct\"\n#define NID_id_cct\t\t268\n#define OBJ_id_cct\t\tOBJ_id_pkix,12L\n\n#define SN_id_ppl\t\t\"id-ppl\"\n#define NID_id_ppl\t\t662\n#define OBJ_id_ppl\t\tOBJ_id_pkix,21L\n\n#define SN_id_ad\t\t\"id-ad\"\n#define NID_id_ad\t\t176\n#define OBJ_id_ad\t\tOBJ_id_pkix,48L\n\n#define SN_id_pkix1_explicit_88\t\t\"id-pkix1-explicit-88\"\n#define NID_id_pkix1_explicit_88\t\t269\n#define OBJ_id_pkix1_explicit_88\t\tOBJ_id_pkix_mod,1L\n\n#define SN_id_pkix1_implicit_88\t\t\"id-pkix1-implicit-88\"\n#define NID_id_pkix1_implicit_88\t\t270\n#define OBJ_id_pkix1_implicit_88\t\tOBJ_id_pkix_mod,2L\n\n#define SN_id_pkix1_explicit_93\t\t\"id-pkix1-explicit-93\"\n#define NID_id_pkix1_explicit_93\t\t271\n#define OBJ_id_pkix1_explicit_93\t\tOBJ_id_pkix_mod,3L\n\n#define SN_id_pkix1_implicit_93\t\t\"id-pkix1-implicit-93\"\n#define NID_id_pkix1_implicit_93\t\t272\n#define OBJ_id_pkix1_implicit_93\t\tOBJ_id_pkix_mod,4L\n\n#define SN_id_mod_crmf\t\t\"id-mod-crmf\"\n#define NID_id_mod_crmf\t\t273\n#define OBJ_id_mod_crmf\t\tOBJ_id_pkix_mod,5L\n\n#define SN_id_mod_cmc\t\t\"id-mod-cmc\"\n#define NID_id_mod_cmc\t\t274\n#define OBJ_id_mod_cmc\t\tOBJ_id_pkix_mod,6L\n\n#define SN_id_mod_kea_profile_88\t\t\"id-mod-kea-profile-88\"\n#define NID_id_mod_kea_profile_88\t\t275\n#define OBJ_id_mod_kea_profile_88\t\tOBJ_id_pkix_mod,7L\n\n#define SN_id_mod_kea_profile_93\t\t\"id-mod-kea-profile-93\"\n#define NID_id_mod_kea_profile_93\t\t276\n#define OBJ_id_mod_kea_profile_93\t\tOBJ_id_pkix_mod,8L\n\n#define SN_id_mod_cmp\t\t\"id-mod-cmp\"\n#define NID_id_mod_cmp\t\t277\n#define OBJ_id_mod_cmp\t\tOBJ_id_pkix_mod,9L\n\n#define SN_id_mod_qualified_cert_88\t\t\"id-mod-qualified-cert-88\"\n#define NID_id_mod_qualified_cert_88\t\t278\n#define OBJ_id_mod_qualified_cert_88\t\tOBJ_id_pkix_mod,10L\n\n#define SN_id_mod_qualified_cert_93\t\t\"id-mod-qualified-cert-93\"\n#define NID_id_mod_qualified_cert_93\t\t279\n#define OBJ_id_mod_qualified_cert_93\t\tOBJ_id_pkix_mod,11L\n\n#define SN_id_mod_attribute_cert\t\t\"id-mod-attribute-cert\"\n#define NID_id_mod_attribute_cert\t\t280\n#define OBJ_id_mod_attribute_cert\t\tOBJ_id_pkix_mod,12L\n\n#define SN_id_mod_timestamp_protocol\t\t\"id-mod-timestamp-protocol\"\n#define NID_id_mod_timestamp_protocol\t\t281\n#define OBJ_id_mod_timestamp_protocol\t\tOBJ_id_pkix_mod,13L\n\n#define SN_id_mod_ocsp\t\t\"id-mod-ocsp\"\n#define NID_id_mod_ocsp\t\t282\n#define OBJ_id_mod_ocsp\t\tOBJ_id_pkix_mod,14L\n\n#define SN_id_mod_dvcs\t\t\"id-mod-dvcs\"\n#define NID_id_mod_dvcs\t\t283\n#define OBJ_id_mod_dvcs\t\tOBJ_id_pkix_mod,15L\n\n#define SN_id_mod_cmp2000\t\t\"id-mod-cmp2000\"\n#define NID_id_mod_cmp2000\t\t284\n#define OBJ_id_mod_cmp2000\t\tOBJ_id_pkix_mod,16L\n\n#define SN_info_access\t\t\"authorityInfoAccess\"\n#define LN_info_access\t\t\"Authority Information Access\"\n#define NID_info_access\t\t177\n#define OBJ_info_access\t\tOBJ_id_pe,1L\n\n#define SN_biometricInfo\t\t\"biometricInfo\"\n#define LN_biometricInfo\t\t\"Biometric Info\"\n#define NID_biometricInfo\t\t285\n#define OBJ_biometricInfo\t\tOBJ_id_pe,2L\n\n#define SN_qcStatements\t\t\"qcStatements\"\n#define NID_qcStatements\t\t286\n#define OBJ_qcStatements\t\tOBJ_id_pe,3L\n\n#define SN_ac_auditEntity\t\t\"ac-auditEntity\"\n#define NID_ac_auditEntity\t\t287\n#define OBJ_ac_auditEntity\t\tOBJ_id_pe,4L\n\n#define SN_ac_targeting\t\t\"ac-targeting\"\n#define NID_ac_targeting\t\t288\n#define OBJ_ac_targeting\t\tOBJ_id_pe,5L\n\n#define SN_aaControls\t\t\"aaControls\"\n#define NID_aaControls\t\t289\n#define OBJ_aaControls\t\tOBJ_id_pe,6L\n\n#define SN_sbgp_ipAddrBlock\t\t\"sbgp-ipAddrBlock\"\n#define NID_sbgp_ipAddrBlock\t\t290\n#define OBJ_sbgp_ipAddrBlock\t\tOBJ_id_pe,7L\n\n#define SN_sbgp_autonomousSysNum\t\t\"sbgp-autonomousSysNum\"\n#define NID_sbgp_autonomousSysNum\t\t291\n#define OBJ_sbgp_autonomousSysNum\t\tOBJ_id_pe,8L\n\n#define SN_sbgp_routerIdentifier\t\t\"sbgp-routerIdentifier\"\n#define NID_sbgp_routerIdentifier\t\t292\n#define OBJ_sbgp_routerIdentifier\t\tOBJ_id_pe,9L\n\n#define SN_ac_proxying\t\t\"ac-proxying\"\n#define NID_ac_proxying\t\t397\n#define OBJ_ac_proxying\t\tOBJ_id_pe,10L\n\n#define SN_sinfo_access\t\t\"subjectInfoAccess\"\n#define LN_sinfo_access\t\t\"Subject Information Access\"\n#define NID_sinfo_access\t\t398\n#define OBJ_sinfo_access\t\tOBJ_id_pe,11L\n\n#define SN_proxyCertInfo\t\t\"proxyCertInfo\"\n#define LN_proxyCertInfo\t\t\"Proxy Certificate Information\"\n#define NID_proxyCertInfo\t\t663\n#define OBJ_proxyCertInfo\t\tOBJ_id_pe,14L\n\n#define SN_id_qt_cps\t\t\"id-qt-cps\"\n#define LN_id_qt_cps\t\t\"Policy Qualifier CPS\"\n#define NID_id_qt_cps\t\t164\n#define OBJ_id_qt_cps\t\tOBJ_id_qt,1L\n\n#define SN_id_qt_unotice\t\t\"id-qt-unotice\"\n#define LN_id_qt_unotice\t\t\"Policy Qualifier User Notice\"\n#define NID_id_qt_unotice\t\t165\n#define OBJ_id_qt_unotice\t\tOBJ_id_qt,2L\n\n#define SN_textNotice\t\t\"textNotice\"\n#define NID_textNotice\t\t293\n#define OBJ_textNotice\t\tOBJ_id_qt,3L\n\n#define SN_server_auth\t\t\"serverAuth\"\n#define LN_server_auth\t\t\"TLS Web Server Authentication\"\n#define NID_server_auth\t\t129\n#define OBJ_server_auth\t\tOBJ_id_kp,1L\n\n#define SN_client_auth\t\t\"clientAuth\"\n#define LN_client_auth\t\t\"TLS Web Client Authentication\"\n#define NID_client_auth\t\t130\n#define OBJ_client_auth\t\tOBJ_id_kp,2L\n\n#define SN_code_sign\t\t\"codeSigning\"\n#define LN_code_sign\t\t\"Code Signing\"\n#define NID_code_sign\t\t131\n#define OBJ_code_sign\t\tOBJ_id_kp,3L\n\n#define SN_email_protect\t\t\"emailProtection\"\n#define LN_email_protect\t\t\"E-mail Protection\"\n#define NID_email_protect\t\t132\n#define OBJ_email_protect\t\tOBJ_id_kp,4L\n\n#define SN_ipsecEndSystem\t\t\"ipsecEndSystem\"\n#define LN_ipsecEndSystem\t\t\"IPSec End System\"\n#define NID_ipsecEndSystem\t\t294\n#define OBJ_ipsecEndSystem\t\tOBJ_id_kp,5L\n\n#define SN_ipsecTunnel\t\t\"ipsecTunnel\"\n#define LN_ipsecTunnel\t\t\"IPSec Tunnel\"\n#define NID_ipsecTunnel\t\t295\n#define OBJ_ipsecTunnel\t\tOBJ_id_kp,6L\n\n#define SN_ipsecUser\t\t\"ipsecUser\"\n#define LN_ipsecUser\t\t\"IPSec User\"\n#define NID_ipsecUser\t\t296\n#define OBJ_ipsecUser\t\tOBJ_id_kp,7L\n\n#define SN_time_stamp\t\t\"timeStamping\"\n#define LN_time_stamp\t\t\"Time Stamping\"\n#define NID_time_stamp\t\t133\n#define OBJ_time_stamp\t\tOBJ_id_kp,8L\n\n#define SN_OCSP_sign\t\t\"OCSPSigning\"\n#define LN_OCSP_sign\t\t\"OCSP Signing\"\n#define NID_OCSP_sign\t\t180\n#define OBJ_OCSP_sign\t\tOBJ_id_kp,9L\n\n#define SN_dvcs\t\t\"DVCS\"\n#define LN_dvcs\t\t\"dvcs\"\n#define NID_dvcs\t\t297\n#define OBJ_dvcs\t\tOBJ_id_kp,10L\n\n#define SN_id_it_caProtEncCert\t\t\"id-it-caProtEncCert\"\n#define NID_id_it_caProtEncCert\t\t298\n#define OBJ_id_it_caProtEncCert\t\tOBJ_id_it,1L\n\n#define SN_id_it_signKeyPairTypes\t\t\"id-it-signKeyPairTypes\"\n#define NID_id_it_signKeyPairTypes\t\t299\n#define OBJ_id_it_signKeyPairTypes\t\tOBJ_id_it,2L\n\n#define SN_id_it_encKeyPairTypes\t\t\"id-it-encKeyPairTypes\"\n#define NID_id_it_encKeyPairTypes\t\t300\n#define OBJ_id_it_encKeyPairTypes\t\tOBJ_id_it,3L\n\n#define SN_id_it_preferredSymmAlg\t\t\"id-it-preferredSymmAlg\"\n#define NID_id_it_preferredSymmAlg\t\t301\n#define OBJ_id_it_preferredSymmAlg\t\tOBJ_id_it,4L\n\n#define SN_id_it_caKeyUpdateInfo\t\t\"id-it-caKeyUpdateInfo\"\n#define NID_id_it_caKeyUpdateInfo\t\t302\n#define OBJ_id_it_caKeyUpdateInfo\t\tOBJ_id_it,5L\n\n#define SN_id_it_currentCRL\t\t\"id-it-currentCRL\"\n#define NID_id_it_currentCRL\t\t303\n#define OBJ_id_it_currentCRL\t\tOBJ_id_it,6L\n\n#define SN_id_it_unsupportedOIDs\t\t\"id-it-unsupportedOIDs\"\n#define NID_id_it_unsupportedOIDs\t\t304\n#define OBJ_id_it_unsupportedOIDs\t\tOBJ_id_it,7L\n\n#define SN_id_it_subscriptionRequest\t\t\"id-it-subscriptionRequest\"\n#define NID_id_it_subscriptionRequest\t\t305\n#define OBJ_id_it_subscriptionRequest\t\tOBJ_id_it,8L\n\n#define SN_id_it_subscriptionResponse\t\t\"id-it-subscriptionResponse\"\n#define NID_id_it_subscriptionResponse\t\t306\n#define OBJ_id_it_subscriptionResponse\t\tOBJ_id_it,9L\n\n#define SN_id_it_keyPairParamReq\t\t\"id-it-keyPairParamReq\"\n#define NID_id_it_keyPairParamReq\t\t307\n#define OBJ_id_it_keyPairParamReq\t\tOBJ_id_it,10L\n\n#define SN_id_it_keyPairParamRep\t\t\"id-it-keyPairParamRep\"\n#define NID_id_it_keyPairParamRep\t\t308\n#define OBJ_id_it_keyPairParamRep\t\tOBJ_id_it,11L\n\n#define SN_id_it_revPassphrase\t\t\"id-it-revPassphrase\"\n#define NID_id_it_revPassphrase\t\t309\n#define OBJ_id_it_revPassphrase\t\tOBJ_id_it,12L\n\n#define SN_id_it_implicitConfirm\t\t\"id-it-implicitConfirm\"\n#define NID_id_it_implicitConfirm\t\t310\n#define OBJ_id_it_implicitConfirm\t\tOBJ_id_it,13L\n\n#define SN_id_it_confirmWaitTime\t\t\"id-it-confirmWaitTime\"\n#define NID_id_it_confirmWaitTime\t\t311\n#define OBJ_id_it_confirmWaitTime\t\tOBJ_id_it,14L\n\n#define SN_id_it_origPKIMessage\t\t\"id-it-origPKIMessage\"\n#define NID_id_it_origPKIMessage\t\t312\n#define OBJ_id_it_origPKIMessage\t\tOBJ_id_it,15L\n\n#define SN_id_it_suppLangTags\t\t\"id-it-suppLangTags\"\n#define NID_id_it_suppLangTags\t\t784\n#define OBJ_id_it_suppLangTags\t\tOBJ_id_it,16L\n\n#define SN_id_regCtrl\t\t\"id-regCtrl\"\n#define NID_id_regCtrl\t\t313\n#define OBJ_id_regCtrl\t\tOBJ_id_pkip,1L\n\n#define SN_id_regInfo\t\t\"id-regInfo\"\n#define NID_id_regInfo\t\t314\n#define OBJ_id_regInfo\t\tOBJ_id_pkip,2L\n\n#define SN_id_regCtrl_regToken\t\t\"id-regCtrl-regToken\"\n#define NID_id_regCtrl_regToken\t\t315\n#define OBJ_id_regCtrl_regToken\t\tOBJ_id_regCtrl,1L\n\n#define SN_id_regCtrl_authenticator\t\t\"id-regCtrl-authenticator\"\n#define NID_id_regCtrl_authenticator\t\t316\n#define OBJ_id_regCtrl_authenticator\t\tOBJ_id_regCtrl,2L\n\n#define SN_id_regCtrl_pkiPublicationInfo\t\t\"id-regCtrl-pkiPublicationInfo\"\n#define NID_id_regCtrl_pkiPublicationInfo\t\t317\n#define OBJ_id_regCtrl_pkiPublicationInfo\t\tOBJ_id_regCtrl,3L\n\n#define SN_id_regCtrl_pkiArchiveOptions\t\t\"id-regCtrl-pkiArchiveOptions\"\n#define NID_id_regCtrl_pkiArchiveOptions\t\t318\n#define OBJ_id_regCtrl_pkiArchiveOptions\t\tOBJ_id_regCtrl,4L\n\n#define SN_id_regCtrl_oldCertID\t\t\"id-regCtrl-oldCertID\"\n#define NID_id_regCtrl_oldCertID\t\t319\n#define OBJ_id_regCtrl_oldCertID\t\tOBJ_id_regCtrl,5L\n\n#define SN_id_regCtrl_protocolEncrKey\t\t\"id-regCtrl-protocolEncrKey\"\n#define NID_id_regCtrl_protocolEncrKey\t\t320\n#define OBJ_id_regCtrl_protocolEncrKey\t\tOBJ_id_regCtrl,6L\n\n#define SN_id_regInfo_utf8Pairs\t\t\"id-regInfo-utf8Pairs\"\n#define NID_id_regInfo_utf8Pairs\t\t321\n#define OBJ_id_regInfo_utf8Pairs\t\tOBJ_id_regInfo,1L\n\n#define SN_id_regInfo_certReq\t\t\"id-regInfo-certReq\"\n#define NID_id_regInfo_certReq\t\t322\n#define OBJ_id_regInfo_certReq\t\tOBJ_id_regInfo,2L\n\n#define SN_id_alg_des40\t\t\"id-alg-des40\"\n#define NID_id_alg_des40\t\t323\n#define OBJ_id_alg_des40\t\tOBJ_id_alg,1L\n\n#define SN_id_alg_noSignature\t\t\"id-alg-noSignature\"\n#define NID_id_alg_noSignature\t\t324\n#define OBJ_id_alg_noSignature\t\tOBJ_id_alg,2L\n\n#define SN_id_alg_dh_sig_hmac_sha1\t\t\"id-alg-dh-sig-hmac-sha1\"\n#define NID_id_alg_dh_sig_hmac_sha1\t\t325\n#define OBJ_id_alg_dh_sig_hmac_sha1\t\tOBJ_id_alg,3L\n\n#define SN_id_alg_dh_pop\t\t\"id-alg-dh-pop\"\n#define NID_id_alg_dh_pop\t\t326\n#define OBJ_id_alg_dh_pop\t\tOBJ_id_alg,4L\n\n#define SN_id_cmc_statusInfo\t\t\"id-cmc-statusInfo\"\n#define NID_id_cmc_statusInfo\t\t327\n#define OBJ_id_cmc_statusInfo\t\tOBJ_id_cmc,1L\n\n#define SN_id_cmc_identification\t\t\"id-cmc-identification\"\n#define NID_id_cmc_identification\t\t328\n#define OBJ_id_cmc_identification\t\tOBJ_id_cmc,2L\n\n#define SN_id_cmc_identityProof\t\t\"id-cmc-identityProof\"\n#define NID_id_cmc_identityProof\t\t329\n#define OBJ_id_cmc_identityProof\t\tOBJ_id_cmc,3L\n\n#define SN_id_cmc_dataReturn\t\t\"id-cmc-dataReturn\"\n#define NID_id_cmc_dataReturn\t\t330\n#define OBJ_id_cmc_dataReturn\t\tOBJ_id_cmc,4L\n\n#define SN_id_cmc_transactionId\t\t\"id-cmc-transactionId\"\n#define NID_id_cmc_transactionId\t\t331\n#define OBJ_id_cmc_transactionId\t\tOBJ_id_cmc,5L\n\n#define SN_id_cmc_senderNonce\t\t\"id-cmc-senderNonce\"\n#define NID_id_cmc_senderNonce\t\t332\n#define OBJ_id_cmc_senderNonce\t\tOBJ_id_cmc,6L\n\n#define SN_id_cmc_recipientNonce\t\t\"id-cmc-recipientNonce\"\n#define NID_id_cmc_recipientNonce\t\t333\n#define OBJ_id_cmc_recipientNonce\t\tOBJ_id_cmc,7L\n\n#define SN_id_cmc_addExtensions\t\t\"id-cmc-addExtensions\"\n#define NID_id_cmc_addExtensions\t\t334\n#define OBJ_id_cmc_addExtensions\t\tOBJ_id_cmc,8L\n\n#define SN_id_cmc_encryptedPOP\t\t\"id-cmc-encryptedPOP\"\n#define NID_id_cmc_encryptedPOP\t\t335\n#define OBJ_id_cmc_encryptedPOP\t\tOBJ_id_cmc,9L\n\n#define SN_id_cmc_decryptedPOP\t\t\"id-cmc-decryptedPOP\"\n#define NID_id_cmc_decryptedPOP\t\t336\n#define OBJ_id_cmc_decryptedPOP\t\tOBJ_id_cmc,10L\n\n#define SN_id_cmc_lraPOPWitness\t\t\"id-cmc-lraPOPWitness\"\n#define NID_id_cmc_lraPOPWitness\t\t337\n#define OBJ_id_cmc_lraPOPWitness\t\tOBJ_id_cmc,11L\n\n#define SN_id_cmc_getCert\t\t\"id-cmc-getCert\"\n#define NID_id_cmc_getCert\t\t338\n#define OBJ_id_cmc_getCert\t\tOBJ_id_cmc,15L\n\n#define SN_id_cmc_getCRL\t\t\"id-cmc-getCRL\"\n#define NID_id_cmc_getCRL\t\t339\n#define OBJ_id_cmc_getCRL\t\tOBJ_id_cmc,16L\n\n#define SN_id_cmc_revokeRequest\t\t\"id-cmc-revokeRequest\"\n#define NID_id_cmc_revokeRequest\t\t340\n#define OBJ_id_cmc_revokeRequest\t\tOBJ_id_cmc,17L\n\n#define SN_id_cmc_regInfo\t\t\"id-cmc-regInfo\"\n#define NID_id_cmc_regInfo\t\t341\n#define OBJ_id_cmc_regInfo\t\tOBJ_id_cmc,18L\n\n#define SN_id_cmc_responseInfo\t\t\"id-cmc-responseInfo\"\n#define NID_id_cmc_responseInfo\t\t342\n#define OBJ_id_cmc_responseInfo\t\tOBJ_id_cmc,19L\n\n#define SN_id_cmc_queryPending\t\t\"id-cmc-queryPending\"\n#define NID_id_cmc_queryPending\t\t343\n#define OBJ_id_cmc_queryPending\t\tOBJ_id_cmc,21L\n\n#define SN_id_cmc_popLinkRandom\t\t\"id-cmc-popLinkRandom\"\n#define NID_id_cmc_popLinkRandom\t\t344\n#define OBJ_id_cmc_popLinkRandom\t\tOBJ_id_cmc,22L\n\n#define SN_id_cmc_popLinkWitness\t\t\"id-cmc-popLinkWitness\"\n#define NID_id_cmc_popLinkWitness\t\t345\n#define OBJ_id_cmc_popLinkWitness\t\tOBJ_id_cmc,23L\n\n#define SN_id_cmc_confirmCertAcceptance\t\t\"id-cmc-confirmCertAcceptance\"\n#define NID_id_cmc_confirmCertAcceptance\t\t346\n#define OBJ_id_cmc_confirmCertAcceptance\t\tOBJ_id_cmc,24L\n\n#define SN_id_on_personalData\t\t\"id-on-personalData\"\n#define NID_id_on_personalData\t\t347\n#define OBJ_id_on_personalData\t\tOBJ_id_on,1L\n\n#define SN_id_on_permanentIdentifier\t\t\"id-on-permanentIdentifier\"\n#define LN_id_on_permanentIdentifier\t\t\"Permanent Identifier\"\n#define NID_id_on_permanentIdentifier\t\t858\n#define OBJ_id_on_permanentIdentifier\t\tOBJ_id_on,3L\n\n#define SN_id_pda_dateOfBirth\t\t\"id-pda-dateOfBirth\"\n#define NID_id_pda_dateOfBirth\t\t348\n#define OBJ_id_pda_dateOfBirth\t\tOBJ_id_pda,1L\n\n#define SN_id_pda_placeOfBirth\t\t\"id-pda-placeOfBirth\"\n#define NID_id_pda_placeOfBirth\t\t349\n#define OBJ_id_pda_placeOfBirth\t\tOBJ_id_pda,2L\n\n#define SN_id_pda_gender\t\t\"id-pda-gender\"\n#define NID_id_pda_gender\t\t351\n#define OBJ_id_pda_gender\t\tOBJ_id_pda,3L\n\n#define SN_id_pda_countryOfCitizenship\t\t\"id-pda-countryOfCitizenship\"\n#define NID_id_pda_countryOfCitizenship\t\t352\n#define OBJ_id_pda_countryOfCitizenship\t\tOBJ_id_pda,4L\n\n#define SN_id_pda_countryOfResidence\t\t\"id-pda-countryOfResidence\"\n#define NID_id_pda_countryOfResidence\t\t353\n#define OBJ_id_pda_countryOfResidence\t\tOBJ_id_pda,5L\n\n#define SN_id_aca_authenticationInfo\t\t\"id-aca-authenticationInfo\"\n#define NID_id_aca_authenticationInfo\t\t354\n#define OBJ_id_aca_authenticationInfo\t\tOBJ_id_aca,1L\n\n#define SN_id_aca_accessIdentity\t\t\"id-aca-accessIdentity\"\n#define NID_id_aca_accessIdentity\t\t355\n#define OBJ_id_aca_accessIdentity\t\tOBJ_id_aca,2L\n\n#define SN_id_aca_chargingIdentity\t\t\"id-aca-chargingIdentity\"\n#define NID_id_aca_chargingIdentity\t\t356\n#define OBJ_id_aca_chargingIdentity\t\tOBJ_id_aca,3L\n\n#define SN_id_aca_group\t\t\"id-aca-group\"\n#define NID_id_aca_group\t\t357\n#define OBJ_id_aca_group\t\tOBJ_id_aca,4L\n\n#define SN_id_aca_role\t\t\"id-aca-role\"\n#define NID_id_aca_role\t\t358\n#define OBJ_id_aca_role\t\tOBJ_id_aca,5L\n\n#define SN_id_aca_encAttrs\t\t\"id-aca-encAttrs\"\n#define NID_id_aca_encAttrs\t\t399\n#define OBJ_id_aca_encAttrs\t\tOBJ_id_aca,6L\n\n#define SN_id_qcs_pkixQCSyntax_v1\t\t\"id-qcs-pkixQCSyntax-v1\"\n#define NID_id_qcs_pkixQCSyntax_v1\t\t359\n#define OBJ_id_qcs_pkixQCSyntax_v1\t\tOBJ_id_qcs,1L\n\n#define SN_id_cct_crs\t\t\"id-cct-crs\"\n#define NID_id_cct_crs\t\t360\n#define OBJ_id_cct_crs\t\tOBJ_id_cct,1L\n\n#define SN_id_cct_PKIData\t\t\"id-cct-PKIData\"\n#define NID_id_cct_PKIData\t\t361\n#define OBJ_id_cct_PKIData\t\tOBJ_id_cct,2L\n\n#define SN_id_cct_PKIResponse\t\t\"id-cct-PKIResponse\"\n#define NID_id_cct_PKIResponse\t\t362\n#define OBJ_id_cct_PKIResponse\t\tOBJ_id_cct,3L\n\n#define SN_id_ppl_anyLanguage\t\t\"id-ppl-anyLanguage\"\n#define LN_id_ppl_anyLanguage\t\t\"Any language\"\n#define NID_id_ppl_anyLanguage\t\t664\n#define OBJ_id_ppl_anyLanguage\t\tOBJ_id_ppl,0L\n\n#define SN_id_ppl_inheritAll\t\t\"id-ppl-inheritAll\"\n#define LN_id_ppl_inheritAll\t\t\"Inherit all\"\n#define NID_id_ppl_inheritAll\t\t665\n#define OBJ_id_ppl_inheritAll\t\tOBJ_id_ppl,1L\n\n#define SN_Independent\t\t\"id-ppl-independent\"\n#define LN_Independent\t\t\"Independent\"\n#define NID_Independent\t\t667\n#define OBJ_Independent\t\tOBJ_id_ppl,2L\n\n#define SN_ad_OCSP\t\t\"OCSP\"\n#define LN_ad_OCSP\t\t\"OCSP\"\n#define NID_ad_OCSP\t\t178\n#define OBJ_ad_OCSP\t\tOBJ_id_ad,1L\n\n#define SN_ad_ca_issuers\t\t\"caIssuers\"\n#define LN_ad_ca_issuers\t\t\"CA Issuers\"\n#define NID_ad_ca_issuers\t\t179\n#define OBJ_ad_ca_issuers\t\tOBJ_id_ad,2L\n\n#define SN_ad_timeStamping\t\t\"ad_timestamping\"\n#define LN_ad_timeStamping\t\t\"AD Time Stamping\"\n#define NID_ad_timeStamping\t\t363\n#define OBJ_ad_timeStamping\t\tOBJ_id_ad,3L\n\n#define SN_ad_dvcs\t\t\"AD_DVCS\"\n#define LN_ad_dvcs\t\t\"ad dvcs\"\n#define NID_ad_dvcs\t\t364\n#define OBJ_ad_dvcs\t\tOBJ_id_ad,4L\n\n#define SN_caRepository\t\t\"caRepository\"\n#define LN_caRepository\t\t\"CA Repository\"\n#define NID_caRepository\t\t785\n#define OBJ_caRepository\t\tOBJ_id_ad,5L\n\n#define OBJ_id_pkix_OCSP\t\tOBJ_ad_OCSP\n\n#define SN_id_pkix_OCSP_basic\t\t\"basicOCSPResponse\"\n#define LN_id_pkix_OCSP_basic\t\t\"Basic OCSP Response\"\n#define NID_id_pkix_OCSP_basic\t\t365\n#define OBJ_id_pkix_OCSP_basic\t\tOBJ_id_pkix_OCSP,1L\n\n#define SN_id_pkix_OCSP_Nonce\t\t\"Nonce\"\n#define LN_id_pkix_OCSP_Nonce\t\t\"OCSP Nonce\"\n#define NID_id_pkix_OCSP_Nonce\t\t366\n#define OBJ_id_pkix_OCSP_Nonce\t\tOBJ_id_pkix_OCSP,2L\n\n#define SN_id_pkix_OCSP_CrlID\t\t\"CrlID\"\n#define LN_id_pkix_OCSP_CrlID\t\t\"OCSP CRL ID\"\n#define NID_id_pkix_OCSP_CrlID\t\t367\n#define OBJ_id_pkix_OCSP_CrlID\t\tOBJ_id_pkix_OCSP,3L\n\n#define SN_id_pkix_OCSP_acceptableResponses\t\t\"acceptableResponses\"\n#define LN_id_pkix_OCSP_acceptableResponses\t\t\"Acceptable OCSP Responses\"\n#define NID_id_pkix_OCSP_acceptableResponses\t\t368\n#define OBJ_id_pkix_OCSP_acceptableResponses\t\tOBJ_id_pkix_OCSP,4L\n\n#define SN_id_pkix_OCSP_noCheck\t\t\"noCheck\"\n#define LN_id_pkix_OCSP_noCheck\t\t\"OCSP No Check\"\n#define NID_id_pkix_OCSP_noCheck\t\t369\n#define OBJ_id_pkix_OCSP_noCheck\t\tOBJ_id_pkix_OCSP,5L\n\n#define SN_id_pkix_OCSP_archiveCutoff\t\t\"archiveCutoff\"\n#define LN_id_pkix_OCSP_archiveCutoff\t\t\"OCSP Archive Cutoff\"\n#define NID_id_pkix_OCSP_archiveCutoff\t\t370\n#define OBJ_id_pkix_OCSP_archiveCutoff\t\tOBJ_id_pkix_OCSP,6L\n\n#define SN_id_pkix_OCSP_serviceLocator\t\t\"serviceLocator\"\n#define LN_id_pkix_OCSP_serviceLocator\t\t\"OCSP Service Locator\"\n#define NID_id_pkix_OCSP_serviceLocator\t\t371\n#define OBJ_id_pkix_OCSP_serviceLocator\t\tOBJ_id_pkix_OCSP,7L\n\n#define SN_id_pkix_OCSP_extendedStatus\t\t\"extendedStatus\"\n#define LN_id_pkix_OCSP_extendedStatus\t\t\"Extended OCSP Status\"\n#define NID_id_pkix_OCSP_extendedStatus\t\t372\n#define OBJ_id_pkix_OCSP_extendedStatus\t\tOBJ_id_pkix_OCSP,8L\n\n#define SN_id_pkix_OCSP_valid\t\t\"valid\"\n#define NID_id_pkix_OCSP_valid\t\t373\n#define OBJ_id_pkix_OCSP_valid\t\tOBJ_id_pkix_OCSP,9L\n\n#define SN_id_pkix_OCSP_path\t\t\"path\"\n#define NID_id_pkix_OCSP_path\t\t374\n#define OBJ_id_pkix_OCSP_path\t\tOBJ_id_pkix_OCSP,10L\n\n#define SN_id_pkix_OCSP_trustRoot\t\t\"trustRoot\"\n#define LN_id_pkix_OCSP_trustRoot\t\t\"Trust Root\"\n#define NID_id_pkix_OCSP_trustRoot\t\t375\n#define OBJ_id_pkix_OCSP_trustRoot\t\tOBJ_id_pkix_OCSP,11L\n\n#define SN_algorithm\t\t\"algorithm\"\n#define LN_algorithm\t\t\"algorithm\"\n#define NID_algorithm\t\t376\n#define OBJ_algorithm\t\t1L,3L,14L,3L,2L\n\n#define SN_md5WithRSA\t\t\"RSA-NP-MD5\"\n#define LN_md5WithRSA\t\t\"md5WithRSA\"\n#define NID_md5WithRSA\t\t104\n#define OBJ_md5WithRSA\t\tOBJ_algorithm,3L\n\n#define SN_des_ecb\t\t\"DES-ECB\"\n#define LN_des_ecb\t\t\"des-ecb\"\n#define NID_des_ecb\t\t29\n#define OBJ_des_ecb\t\tOBJ_algorithm,6L\n\n#define SN_des_cbc\t\t\"DES-CBC\"\n#define LN_des_cbc\t\t\"des-cbc\"\n#define NID_des_cbc\t\t31\n#define OBJ_des_cbc\t\tOBJ_algorithm,7L\n\n#define SN_des_ofb64\t\t\"DES-OFB\"\n#define LN_des_ofb64\t\t\"des-ofb\"\n#define NID_des_ofb64\t\t45\n#define OBJ_des_ofb64\t\tOBJ_algorithm,8L\n\n#define SN_des_cfb64\t\t\"DES-CFB\"\n#define LN_des_cfb64\t\t\"des-cfb\"\n#define NID_des_cfb64\t\t30\n#define OBJ_des_cfb64\t\tOBJ_algorithm,9L\n\n#define SN_rsaSignature\t\t\"rsaSignature\"\n#define NID_rsaSignature\t\t377\n#define OBJ_rsaSignature\t\tOBJ_algorithm,11L\n\n#define SN_dsa_2\t\t\"DSA-old\"\n#define LN_dsa_2\t\t\"dsaEncryption-old\"\n#define NID_dsa_2\t\t67\n#define OBJ_dsa_2\t\tOBJ_algorithm,12L\n\n#define SN_dsaWithSHA\t\t\"DSA-SHA\"\n#define LN_dsaWithSHA\t\t\"dsaWithSHA\"\n#define NID_dsaWithSHA\t\t66\n#define OBJ_dsaWithSHA\t\tOBJ_algorithm,13L\n\n#define SN_shaWithRSAEncryption\t\t\"RSA-SHA\"\n#define LN_shaWithRSAEncryption\t\t\"shaWithRSAEncryption\"\n#define NID_shaWithRSAEncryption\t\t42\n#define OBJ_shaWithRSAEncryption\t\tOBJ_algorithm,15L\n\n#define SN_des_ede_ecb\t\t\"DES-EDE\"\n#define LN_des_ede_ecb\t\t\"des-ede\"\n#define NID_des_ede_ecb\t\t32\n#define OBJ_des_ede_ecb\t\tOBJ_algorithm,17L\n\n#define SN_des_ede3_ecb\t\t\"DES-EDE3\"\n#define LN_des_ede3_ecb\t\t\"des-ede3\"\n#define NID_des_ede3_ecb\t\t33\n\n#define SN_des_ede_cbc\t\t\"DES-EDE-CBC\"\n#define LN_des_ede_cbc\t\t\"des-ede-cbc\"\n#define NID_des_ede_cbc\t\t43\n\n#define SN_des_ede_cfb64\t\t\"DES-EDE-CFB\"\n#define LN_des_ede_cfb64\t\t\"des-ede-cfb\"\n#define NID_des_ede_cfb64\t\t60\n\n#define SN_des_ede3_cfb64\t\t\"DES-EDE3-CFB\"\n#define LN_des_ede3_cfb64\t\t\"des-ede3-cfb\"\n#define NID_des_ede3_cfb64\t\t61\n\n#define SN_des_ede_ofb64\t\t\"DES-EDE-OFB\"\n#define LN_des_ede_ofb64\t\t\"des-ede-ofb\"\n#define NID_des_ede_ofb64\t\t62\n\n#define SN_des_ede3_ofb64\t\t\"DES-EDE3-OFB\"\n#define LN_des_ede3_ofb64\t\t\"des-ede3-ofb\"\n#define NID_des_ede3_ofb64\t\t63\n\n#define SN_desx_cbc\t\t\"DESX-CBC\"\n#define LN_desx_cbc\t\t\"desx-cbc\"\n#define NID_desx_cbc\t\t80\n\n#define SN_sha\t\t\"SHA\"\n#define LN_sha\t\t\"sha\"\n#define NID_sha\t\t41\n#define OBJ_sha\t\tOBJ_algorithm,18L\n\n#define SN_sha1\t\t\"SHA1\"\n#define LN_sha1\t\t\"sha1\"\n#define NID_sha1\t\t64\n#define OBJ_sha1\t\tOBJ_algorithm,26L\n\n#define SN_dsaWithSHA1_2\t\t\"DSA-SHA1-old\"\n#define LN_dsaWithSHA1_2\t\t\"dsaWithSHA1-old\"\n#define NID_dsaWithSHA1_2\t\t70\n#define OBJ_dsaWithSHA1_2\t\tOBJ_algorithm,27L\n\n#define SN_sha1WithRSA\t\t\"RSA-SHA1-2\"\n#define LN_sha1WithRSA\t\t\"sha1WithRSA\"\n#define NID_sha1WithRSA\t\t115\n#define OBJ_sha1WithRSA\t\tOBJ_algorithm,29L\n\n#define SN_ripemd160\t\t\"RIPEMD160\"\n#define LN_ripemd160\t\t\"ripemd160\"\n#define NID_ripemd160\t\t117\n#define OBJ_ripemd160\t\t1L,3L,36L,3L,2L,1L\n\n#define SN_ripemd160WithRSA\t\t\"RSA-RIPEMD160\"\n#define LN_ripemd160WithRSA\t\t\"ripemd160WithRSA\"\n#define NID_ripemd160WithRSA\t\t119\n#define OBJ_ripemd160WithRSA\t\t1L,3L,36L,3L,3L,1L,2L\n\n#define SN_sxnet\t\t\"SXNetID\"\n#define LN_sxnet\t\t\"Strong Extranet ID\"\n#define NID_sxnet\t\t143\n#define OBJ_sxnet\t\t1L,3L,101L,1L,4L,1L\n\n#define SN_X500\t\t\"X500\"\n#define LN_X500\t\t\"directory services (X.500)\"\n#define NID_X500\t\t11\n#define OBJ_X500\t\t2L,5L\n\n#define SN_X509\t\t\"X509\"\n#define NID_X509\t\t12\n#define OBJ_X509\t\tOBJ_X500,4L\n\n#define SN_commonName\t\t\"CN\"\n#define LN_commonName\t\t\"commonName\"\n#define NID_commonName\t\t13\n#define OBJ_commonName\t\tOBJ_X509,3L\n\n#define SN_surname\t\t\"SN\"\n#define LN_surname\t\t\"surname\"\n#define NID_surname\t\t100\n#define OBJ_surname\t\tOBJ_X509,4L\n\n#define LN_serialNumber\t\t\"serialNumber\"\n#define NID_serialNumber\t\t105\n#define OBJ_serialNumber\t\tOBJ_X509,5L\n\n#define SN_countryName\t\t\"C\"\n#define LN_countryName\t\t\"countryName\"\n#define NID_countryName\t\t14\n#define OBJ_countryName\t\tOBJ_X509,6L\n\n#define SN_localityName\t\t\"L\"\n#define LN_localityName\t\t\"localityName\"\n#define NID_localityName\t\t15\n#define OBJ_localityName\t\tOBJ_X509,7L\n\n#define SN_stateOrProvinceName\t\t\"ST\"\n#define LN_stateOrProvinceName\t\t\"stateOrProvinceName\"\n#define NID_stateOrProvinceName\t\t16\n#define OBJ_stateOrProvinceName\t\tOBJ_X509,8L\n\n#define SN_streetAddress\t\t\"street\"\n#define LN_streetAddress\t\t\"streetAddress\"\n#define NID_streetAddress\t\t660\n#define OBJ_streetAddress\t\tOBJ_X509,9L\n\n#define SN_organizationName\t\t\"O\"\n#define LN_organizationName\t\t\"organizationName\"\n#define NID_organizationName\t\t17\n#define OBJ_organizationName\t\tOBJ_X509,10L\n\n#define SN_organizationalUnitName\t\t\"OU\"\n#define LN_organizationalUnitName\t\t\"organizationalUnitName\"\n#define NID_organizationalUnitName\t\t18\n#define OBJ_organizationalUnitName\t\tOBJ_X509,11L\n\n#define SN_title\t\t\"title\"\n#define LN_title\t\t\"title\"\n#define NID_title\t\t106\n#define OBJ_title\t\tOBJ_X509,12L\n\n#define LN_description\t\t\"description\"\n#define NID_description\t\t107\n#define OBJ_description\t\tOBJ_X509,13L\n\n#define LN_searchGuide\t\t\"searchGuide\"\n#define NID_searchGuide\t\t859\n#define OBJ_searchGuide\t\tOBJ_X509,14L\n\n#define LN_businessCategory\t\t\"businessCategory\"\n#define NID_businessCategory\t\t860\n#define OBJ_businessCategory\t\tOBJ_X509,15L\n\n#define LN_postalAddress\t\t\"postalAddress\"\n#define NID_postalAddress\t\t861\n#define OBJ_postalAddress\t\tOBJ_X509,16L\n\n#define LN_postalCode\t\t\"postalCode\"\n#define NID_postalCode\t\t661\n#define OBJ_postalCode\t\tOBJ_X509,17L\n\n#define LN_postOfficeBox\t\t\"postOfficeBox\"\n#define NID_postOfficeBox\t\t862\n#define OBJ_postOfficeBox\t\tOBJ_X509,18L\n\n#define LN_physicalDeliveryOfficeName\t\t\"physicalDeliveryOfficeName\"\n#define NID_physicalDeliveryOfficeName\t\t863\n#define OBJ_physicalDeliveryOfficeName\t\tOBJ_X509,19L\n\n#define LN_telephoneNumber\t\t\"telephoneNumber\"\n#define NID_telephoneNumber\t\t864\n#define OBJ_telephoneNumber\t\tOBJ_X509,20L\n\n#define LN_telexNumber\t\t\"telexNumber\"\n#define NID_telexNumber\t\t865\n#define OBJ_telexNumber\t\tOBJ_X509,21L\n\n#define LN_teletexTerminalIdentifier\t\t\"teletexTerminalIdentifier\"\n#define NID_teletexTerminalIdentifier\t\t866\n#define OBJ_teletexTerminalIdentifier\t\tOBJ_X509,22L\n\n#define LN_facsimileTelephoneNumber\t\t\"facsimileTelephoneNumber\"\n#define NID_facsimileTelephoneNumber\t\t867\n#define OBJ_facsimileTelephoneNumber\t\tOBJ_X509,23L\n\n#define LN_x121Address\t\t\"x121Address\"\n#define NID_x121Address\t\t868\n#define OBJ_x121Address\t\tOBJ_X509,24L\n\n#define LN_internationaliSDNNumber\t\t\"internationaliSDNNumber\"\n#define NID_internationaliSDNNumber\t\t869\n#define OBJ_internationaliSDNNumber\t\tOBJ_X509,25L\n\n#define LN_registeredAddress\t\t\"registeredAddress\"\n#define NID_registeredAddress\t\t870\n#define OBJ_registeredAddress\t\tOBJ_X509,26L\n\n#define LN_destinationIndicator\t\t\"destinationIndicator\"\n#define NID_destinationIndicator\t\t871\n#define OBJ_destinationIndicator\t\tOBJ_X509,27L\n\n#define LN_preferredDeliveryMethod\t\t\"preferredDeliveryMethod\"\n#define NID_preferredDeliveryMethod\t\t872\n#define OBJ_preferredDeliveryMethod\t\tOBJ_X509,28L\n\n#define LN_presentationAddress\t\t\"presentationAddress\"\n#define NID_presentationAddress\t\t873\n#define OBJ_presentationAddress\t\tOBJ_X509,29L\n\n#define LN_supportedApplicationContext\t\t\"supportedApplicationContext\"\n#define NID_supportedApplicationContext\t\t874\n#define OBJ_supportedApplicationContext\t\tOBJ_X509,30L\n\n#define SN_member\t\t\"member\"\n#define NID_member\t\t875\n#define OBJ_member\t\tOBJ_X509,31L\n\n#define SN_owner\t\t\"owner\"\n#define NID_owner\t\t876\n#define OBJ_owner\t\tOBJ_X509,32L\n\n#define LN_roleOccupant\t\t\"roleOccupant\"\n#define NID_roleOccupant\t\t877\n#define OBJ_roleOccupant\t\tOBJ_X509,33L\n\n#define SN_seeAlso\t\t\"seeAlso\"\n#define NID_seeAlso\t\t878\n#define OBJ_seeAlso\t\tOBJ_X509,34L\n\n#define LN_userPassword\t\t\"userPassword\"\n#define NID_userPassword\t\t879\n#define OBJ_userPassword\t\tOBJ_X509,35L\n\n#define LN_userCertificate\t\t\"userCertificate\"\n#define NID_userCertificate\t\t880\n#define OBJ_userCertificate\t\tOBJ_X509,36L\n\n#define LN_cACertificate\t\t\"cACertificate\"\n#define NID_cACertificate\t\t881\n#define OBJ_cACertificate\t\tOBJ_X509,37L\n\n#define LN_authorityRevocationList\t\t\"authorityRevocationList\"\n#define NID_authorityRevocationList\t\t882\n#define OBJ_authorityRevocationList\t\tOBJ_X509,38L\n\n#define LN_certificateRevocationList\t\t\"certificateRevocationList\"\n#define NID_certificateRevocationList\t\t883\n#define OBJ_certificateRevocationList\t\tOBJ_X509,39L\n\n#define LN_crossCertificatePair\t\t\"crossCertificatePair\"\n#define NID_crossCertificatePair\t\t884\n#define OBJ_crossCertificatePair\t\tOBJ_X509,40L\n\n#define SN_name\t\t\"name\"\n#define LN_name\t\t\"name\"\n#define NID_name\t\t173\n#define OBJ_name\t\tOBJ_X509,41L\n\n#define SN_givenName\t\t\"GN\"\n#define LN_givenName\t\t\"givenName\"\n#define NID_givenName\t\t99\n#define OBJ_givenName\t\tOBJ_X509,42L\n\n#define SN_initials\t\t\"initials\"\n#define LN_initials\t\t\"initials\"\n#define NID_initials\t\t101\n#define OBJ_initials\t\tOBJ_X509,43L\n\n#define LN_generationQualifier\t\t\"generationQualifier\"\n#define NID_generationQualifier\t\t509\n#define OBJ_generationQualifier\t\tOBJ_X509,44L\n\n#define LN_x500UniqueIdentifier\t\t\"x500UniqueIdentifier\"\n#define NID_x500UniqueIdentifier\t\t503\n#define OBJ_x500UniqueIdentifier\t\tOBJ_X509,45L\n\n#define SN_dnQualifier\t\t\"dnQualifier\"\n#define LN_dnQualifier\t\t\"dnQualifier\"\n#define NID_dnQualifier\t\t174\n#define OBJ_dnQualifier\t\tOBJ_X509,46L\n\n#define LN_enhancedSearchGuide\t\t\"enhancedSearchGuide\"\n#define NID_enhancedSearchGuide\t\t885\n#define OBJ_enhancedSearchGuide\t\tOBJ_X509,47L\n\n#define LN_protocolInformation\t\t\"protocolInformation\"\n#define NID_protocolInformation\t\t886\n#define OBJ_protocolInformation\t\tOBJ_X509,48L\n\n#define LN_distinguishedName\t\t\"distinguishedName\"\n#define NID_distinguishedName\t\t887\n#define OBJ_distinguishedName\t\tOBJ_X509,49L\n\n#define LN_uniqueMember\t\t\"uniqueMember\"\n#define NID_uniqueMember\t\t888\n#define OBJ_uniqueMember\t\tOBJ_X509,50L\n\n#define LN_houseIdentifier\t\t\"houseIdentifier\"\n#define NID_houseIdentifier\t\t889\n#define OBJ_houseIdentifier\t\tOBJ_X509,51L\n\n#define LN_supportedAlgorithms\t\t\"supportedAlgorithms\"\n#define NID_supportedAlgorithms\t\t890\n#define OBJ_supportedAlgorithms\t\tOBJ_X509,52L\n\n#define LN_deltaRevocationList\t\t\"deltaRevocationList\"\n#define NID_deltaRevocationList\t\t891\n#define OBJ_deltaRevocationList\t\tOBJ_X509,53L\n\n#define SN_dmdName\t\t\"dmdName\"\n#define NID_dmdName\t\t892\n#define OBJ_dmdName\t\tOBJ_X509,54L\n\n#define LN_pseudonym\t\t\"pseudonym\"\n#define NID_pseudonym\t\t510\n#define OBJ_pseudonym\t\tOBJ_X509,65L\n\n#define SN_role\t\t\"role\"\n#define LN_role\t\t\"role\"\n#define NID_role\t\t400\n#define OBJ_role\t\tOBJ_X509,72L\n\n#define SN_X500algorithms\t\t\"X500algorithms\"\n#define LN_X500algorithms\t\t\"directory services - algorithms\"\n#define NID_X500algorithms\t\t378\n#define OBJ_X500algorithms\t\tOBJ_X500,8L\n\n#define SN_rsa\t\t\"RSA\"\n#define LN_rsa\t\t\"rsa\"\n#define NID_rsa\t\t19\n#define OBJ_rsa\t\tOBJ_X500algorithms,1L,1L\n\n#define SN_mdc2WithRSA\t\t\"RSA-MDC2\"\n#define LN_mdc2WithRSA\t\t\"mdc2WithRSA\"\n#define NID_mdc2WithRSA\t\t96\n#define OBJ_mdc2WithRSA\t\tOBJ_X500algorithms,3L,100L\n\n#define SN_mdc2\t\t\"MDC2\"\n#define LN_mdc2\t\t\"mdc2\"\n#define NID_mdc2\t\t95\n#define OBJ_mdc2\t\tOBJ_X500algorithms,3L,101L\n\n#define SN_id_ce\t\t\"id-ce\"\n#define NID_id_ce\t\t81\n#define OBJ_id_ce\t\tOBJ_X500,29L\n\n#define SN_subject_directory_attributes\t\t\"subjectDirectoryAttributes\"\n#define LN_subject_directory_attributes\t\t\"X509v3 Subject Directory Attributes\"\n#define NID_subject_directory_attributes\t\t769\n#define OBJ_subject_directory_attributes\t\tOBJ_id_ce,9L\n\n#define SN_subject_key_identifier\t\t\"subjectKeyIdentifier\"\n#define LN_subject_key_identifier\t\t\"X509v3 Subject Key Identifier\"\n#define NID_subject_key_identifier\t\t82\n#define OBJ_subject_key_identifier\t\tOBJ_id_ce,14L\n\n#define SN_key_usage\t\t\"keyUsage\"\n#define LN_key_usage\t\t\"X509v3 Key Usage\"\n#define NID_key_usage\t\t83\n#define OBJ_key_usage\t\tOBJ_id_ce,15L\n\n#define SN_private_key_usage_period\t\t\"privateKeyUsagePeriod\"\n#define LN_private_key_usage_period\t\t\"X509v3 Private Key Usage Period\"\n#define NID_private_key_usage_period\t\t84\n#define OBJ_private_key_usage_period\t\tOBJ_id_ce,16L\n\n#define SN_subject_alt_name\t\t\"subjectAltName\"\n#define LN_subject_alt_name\t\t\"X509v3 Subject Alternative Name\"\n#define NID_subject_alt_name\t\t85\n#define OBJ_subject_alt_name\t\tOBJ_id_ce,17L\n\n#define SN_issuer_alt_name\t\t\"issuerAltName\"\n#define LN_issuer_alt_name\t\t\"X509v3 Issuer Alternative Name\"\n#define NID_issuer_alt_name\t\t86\n#define OBJ_issuer_alt_name\t\tOBJ_id_ce,18L\n\n#define SN_basic_constraints\t\t\"basicConstraints\"\n#define LN_basic_constraints\t\t\"X509v3 Basic Constraints\"\n#define NID_basic_constraints\t\t87\n#define OBJ_basic_constraints\t\tOBJ_id_ce,19L\n\n#define SN_crl_number\t\t\"crlNumber\"\n#define LN_crl_number\t\t\"X509v3 CRL Number\"\n#define NID_crl_number\t\t88\n#define OBJ_crl_number\t\tOBJ_id_ce,20L\n\n#define SN_crl_reason\t\t\"CRLReason\"\n#define LN_crl_reason\t\t\"X509v3 CRL Reason Code\"\n#define NID_crl_reason\t\t141\n#define OBJ_crl_reason\t\tOBJ_id_ce,21L\n\n#define SN_invalidity_date\t\t\"invalidityDate\"\n#define LN_invalidity_date\t\t\"Invalidity Date\"\n#define NID_invalidity_date\t\t142\n#define OBJ_invalidity_date\t\tOBJ_id_ce,24L\n\n#define SN_delta_crl\t\t\"deltaCRL\"\n#define LN_delta_crl\t\t\"X509v3 Delta CRL Indicator\"\n#define NID_delta_crl\t\t140\n#define OBJ_delta_crl\t\tOBJ_id_ce,27L\n\n#define SN_issuing_distribution_point\t\t\"issuingDistributionPoint\"\n#define LN_issuing_distribution_point\t\t\"X509v3 Issuing Distrubution Point\"\n#define NID_issuing_distribution_point\t\t770\n#define OBJ_issuing_distribution_point\t\tOBJ_id_ce,28L\n\n#define SN_certificate_issuer\t\t\"certificateIssuer\"\n#define LN_certificate_issuer\t\t\"X509v3 Certificate Issuer\"\n#define NID_certificate_issuer\t\t771\n#define OBJ_certificate_issuer\t\tOBJ_id_ce,29L\n\n#define SN_name_constraints\t\t\"nameConstraints\"\n#define LN_name_constraints\t\t\"X509v3 Name Constraints\"\n#define NID_name_constraints\t\t666\n#define OBJ_name_constraints\t\tOBJ_id_ce,30L\n\n#define SN_crl_distribution_points\t\t\"crlDistributionPoints\"\n#define LN_crl_distribution_points\t\t\"X509v3 CRL Distribution Points\"\n#define NID_crl_distribution_points\t\t103\n#define OBJ_crl_distribution_points\t\tOBJ_id_ce,31L\n\n#define SN_certificate_policies\t\t\"certificatePolicies\"\n#define LN_certificate_policies\t\t\"X509v3 Certificate Policies\"\n#define NID_certificate_policies\t\t89\n#define OBJ_certificate_policies\t\tOBJ_id_ce,32L\n\n#define SN_any_policy\t\t\"anyPolicy\"\n#define LN_any_policy\t\t\"X509v3 Any Policy\"\n#define NID_any_policy\t\t746\n#define OBJ_any_policy\t\tOBJ_certificate_policies,0L\n\n#define SN_policy_mappings\t\t\"policyMappings\"\n#define LN_policy_mappings\t\t\"X509v3 Policy Mappings\"\n#define NID_policy_mappings\t\t747\n#define OBJ_policy_mappings\t\tOBJ_id_ce,33L\n\n#define SN_authority_key_identifier\t\t\"authorityKeyIdentifier\"\n#define LN_authority_key_identifier\t\t\"X509v3 Authority Key Identifier\"\n#define NID_authority_key_identifier\t\t90\n#define OBJ_authority_key_identifier\t\tOBJ_id_ce,35L\n\n#define SN_policy_constraints\t\t\"policyConstraints\"\n#define LN_policy_constraints\t\t\"X509v3 Policy Constraints\"\n#define NID_policy_constraints\t\t401\n#define OBJ_policy_constraints\t\tOBJ_id_ce,36L\n\n#define SN_ext_key_usage\t\t\"extendedKeyUsage\"\n#define LN_ext_key_usage\t\t\"X509v3 Extended Key Usage\"\n#define NID_ext_key_usage\t\t126\n#define OBJ_ext_key_usage\t\tOBJ_id_ce,37L\n\n#define SN_freshest_crl\t\t\"freshestCRL\"\n#define LN_freshest_crl\t\t\"X509v3 Freshest CRL\"\n#define NID_freshest_crl\t\t857\n#define OBJ_freshest_crl\t\tOBJ_id_ce,46L\n\n#define SN_inhibit_any_policy\t\t\"inhibitAnyPolicy\"\n#define LN_inhibit_any_policy\t\t\"X509v3 Inhibit Any Policy\"\n#define NID_inhibit_any_policy\t\t748\n#define OBJ_inhibit_any_policy\t\tOBJ_id_ce,54L\n\n#define SN_target_information\t\t\"targetInformation\"\n#define LN_target_information\t\t\"X509v3 AC Targeting\"\n#define NID_target_information\t\t402\n#define OBJ_target_information\t\tOBJ_id_ce,55L\n\n#define SN_no_rev_avail\t\t\"noRevAvail\"\n#define LN_no_rev_avail\t\t\"X509v3 No Revocation Available\"\n#define NID_no_rev_avail\t\t403\n#define OBJ_no_rev_avail\t\tOBJ_id_ce,56L\n\n#define SN_netscape\t\t\"Netscape\"\n#define LN_netscape\t\t\"Netscape Communications Corp.\"\n#define NID_netscape\t\t57\n#define OBJ_netscape\t\t2L,16L,840L,1L,113730L\n\n#define SN_netscape_cert_extension\t\t\"nsCertExt\"\n#define LN_netscape_cert_extension\t\t\"Netscape Certificate Extension\"\n#define NID_netscape_cert_extension\t\t58\n#define OBJ_netscape_cert_extension\t\tOBJ_netscape,1L\n\n#define SN_netscape_data_type\t\t\"nsDataType\"\n#define LN_netscape_data_type\t\t\"Netscape Data Type\"\n#define NID_netscape_data_type\t\t59\n#define OBJ_netscape_data_type\t\tOBJ_netscape,2L\n\n#define SN_netscape_cert_type\t\t\"nsCertType\"\n#define LN_netscape_cert_type\t\t\"Netscape Cert Type\"\n#define NID_netscape_cert_type\t\t71\n#define OBJ_netscape_cert_type\t\tOBJ_netscape_cert_extension,1L\n\n#define SN_netscape_base_url\t\t\"nsBaseUrl\"\n#define LN_netscape_base_url\t\t\"Netscape Base Url\"\n#define NID_netscape_base_url\t\t72\n#define OBJ_netscape_base_url\t\tOBJ_netscape_cert_extension,2L\n\n#define SN_netscape_revocation_url\t\t\"nsRevocationUrl\"\n#define LN_netscape_revocation_url\t\t\"Netscape Revocation Url\"\n#define NID_netscape_revocation_url\t\t73\n#define OBJ_netscape_revocation_url\t\tOBJ_netscape_cert_extension,3L\n\n#define SN_netscape_ca_revocation_url\t\t\"nsCaRevocationUrl\"\n#define LN_netscape_ca_revocation_url\t\t\"Netscape CA Revocation Url\"\n#define NID_netscape_ca_revocation_url\t\t74\n#define OBJ_netscape_ca_revocation_url\t\tOBJ_netscape_cert_extension,4L\n\n#define SN_netscape_renewal_url\t\t\"nsRenewalUrl\"\n#define LN_netscape_renewal_url\t\t\"Netscape Renewal Url\"\n#define NID_netscape_renewal_url\t\t75\n#define OBJ_netscape_renewal_url\t\tOBJ_netscape_cert_extension,7L\n\n#define SN_netscape_ca_policy_url\t\t\"nsCaPolicyUrl\"\n#define LN_netscape_ca_policy_url\t\t\"Netscape CA Policy Url\"\n#define NID_netscape_ca_policy_url\t\t76\n#define OBJ_netscape_ca_policy_url\t\tOBJ_netscape_cert_extension,8L\n\n#define SN_netscape_ssl_server_name\t\t\"nsSslServerName\"\n#define LN_netscape_ssl_server_name\t\t\"Netscape SSL Server Name\"\n#define NID_netscape_ssl_server_name\t\t77\n#define OBJ_netscape_ssl_server_name\t\tOBJ_netscape_cert_extension,12L\n\n#define SN_netscape_comment\t\t\"nsComment\"\n#define LN_netscape_comment\t\t\"Netscape Comment\"\n#define NID_netscape_comment\t\t78\n#define OBJ_netscape_comment\t\tOBJ_netscape_cert_extension,13L\n\n#define SN_netscape_cert_sequence\t\t\"nsCertSequence\"\n#define LN_netscape_cert_sequence\t\t\"Netscape Certificate Sequence\"\n#define NID_netscape_cert_sequence\t\t79\n#define OBJ_netscape_cert_sequence\t\tOBJ_netscape_data_type,5L\n\n#define SN_ns_sgc\t\t\"nsSGC\"\n#define LN_ns_sgc\t\t\"Netscape Server Gated Crypto\"\n#define NID_ns_sgc\t\t139\n#define OBJ_ns_sgc\t\tOBJ_netscape,4L,1L\n\n#define SN_org\t\t\"ORG\"\n#define LN_org\t\t\"org\"\n#define NID_org\t\t379\n#define OBJ_org\t\tOBJ_iso,3L\n\n#define SN_dod\t\t\"DOD\"\n#define LN_dod\t\t\"dod\"\n#define NID_dod\t\t380\n#define OBJ_dod\t\tOBJ_org,6L\n\n#define SN_iana\t\t\"IANA\"\n#define LN_iana\t\t\"iana\"\n#define NID_iana\t\t381\n#define OBJ_iana\t\tOBJ_dod,1L\n\n#define OBJ_internet\t\tOBJ_iana\n\n#define SN_Directory\t\t\"directory\"\n#define LN_Directory\t\t\"Directory\"\n#define NID_Directory\t\t382\n#define OBJ_Directory\t\tOBJ_internet,1L\n\n#define SN_Management\t\t\"mgmt\"\n#define LN_Management\t\t\"Management\"\n#define NID_Management\t\t383\n#define OBJ_Management\t\tOBJ_internet,2L\n\n#define SN_Experimental\t\t\"experimental\"\n#define LN_Experimental\t\t\"Experimental\"\n#define NID_Experimental\t\t384\n#define OBJ_Experimental\t\tOBJ_internet,3L\n\n#define SN_Private\t\t\"private\"\n#define LN_Private\t\t\"Private\"\n#define NID_Private\t\t385\n#define OBJ_Private\t\tOBJ_internet,4L\n\n#define SN_Security\t\t\"security\"\n#define LN_Security\t\t\"Security\"\n#define NID_Security\t\t386\n#define OBJ_Security\t\tOBJ_internet,5L\n\n#define SN_SNMPv2\t\t\"snmpv2\"\n#define LN_SNMPv2\t\t\"SNMPv2\"\n#define NID_SNMPv2\t\t387\n#define OBJ_SNMPv2\t\tOBJ_internet,6L\n\n#define LN_Mail\t\t\"Mail\"\n#define NID_Mail\t\t388\n#define OBJ_Mail\t\tOBJ_internet,7L\n\n#define SN_Enterprises\t\t\"enterprises\"\n#define LN_Enterprises\t\t\"Enterprises\"\n#define NID_Enterprises\t\t389\n#define OBJ_Enterprises\t\tOBJ_Private,1L\n\n#define SN_dcObject\t\t\"dcobject\"\n#define LN_dcObject\t\t\"dcObject\"\n#define NID_dcObject\t\t390\n#define OBJ_dcObject\t\tOBJ_Enterprises,1466L,344L\n\n#define SN_mime_mhs\t\t\"mime-mhs\"\n#define LN_mime_mhs\t\t\"MIME MHS\"\n#define NID_mime_mhs\t\t504\n#define OBJ_mime_mhs\t\tOBJ_Mail,1L\n\n#define SN_mime_mhs_headings\t\t\"mime-mhs-headings\"\n#define LN_mime_mhs_headings\t\t\"mime-mhs-headings\"\n#define NID_mime_mhs_headings\t\t505\n#define OBJ_mime_mhs_headings\t\tOBJ_mime_mhs,1L\n\n#define SN_mime_mhs_bodies\t\t\"mime-mhs-bodies\"\n#define LN_mime_mhs_bodies\t\t\"mime-mhs-bodies\"\n#define NID_mime_mhs_bodies\t\t506\n#define OBJ_mime_mhs_bodies\t\tOBJ_mime_mhs,2L\n\n#define SN_id_hex_partial_message\t\t\"id-hex-partial-message\"\n#define LN_id_hex_partial_message\t\t\"id-hex-partial-message\"\n#define NID_id_hex_partial_message\t\t507\n#define OBJ_id_hex_partial_message\t\tOBJ_mime_mhs_headings,1L\n\n#define SN_id_hex_multipart_message\t\t\"id-hex-multipart-message\"\n#define LN_id_hex_multipart_message\t\t\"id-hex-multipart-message\"\n#define NID_id_hex_multipart_message\t\t508\n#define OBJ_id_hex_multipart_message\t\tOBJ_mime_mhs_headings,2L\n\n#define SN_rle_compression\t\t\"RLE\"\n#define LN_rle_compression\t\t\"run length compression\"\n#define NID_rle_compression\t\t124\n#define OBJ_rle_compression\t\t1L,1L,1L,1L,666L,1L\n\n#define SN_zlib_compression\t\t\"ZLIB\"\n#define LN_zlib_compression\t\t\"zlib compression\"\n#define NID_zlib_compression\t\t125\n#define OBJ_zlib_compression\t\tOBJ_id_smime_alg,8L\n\n#define OBJ_csor\t\t2L,16L,840L,1L,101L,3L\n\n#define OBJ_nistAlgorithms\t\tOBJ_csor,4L\n\n#define OBJ_aes\t\tOBJ_nistAlgorithms,1L\n\n#define SN_aes_128_ecb\t\t\"AES-128-ECB\"\n#define LN_aes_128_ecb\t\t\"aes-128-ecb\"\n#define NID_aes_128_ecb\t\t418\n#define OBJ_aes_128_ecb\t\tOBJ_aes,1L\n\n#define SN_aes_128_cbc\t\t\"AES-128-CBC\"\n#define LN_aes_128_cbc\t\t\"aes-128-cbc\"\n#define NID_aes_128_cbc\t\t419\n#define OBJ_aes_128_cbc\t\tOBJ_aes,2L\n\n#define SN_aes_128_ofb128\t\t\"AES-128-OFB\"\n#define LN_aes_128_ofb128\t\t\"aes-128-ofb\"\n#define NID_aes_128_ofb128\t\t420\n#define OBJ_aes_128_ofb128\t\tOBJ_aes,3L\n\n#define SN_aes_128_cfb128\t\t\"AES-128-CFB\"\n#define LN_aes_128_cfb128\t\t\"aes-128-cfb\"\n#define NID_aes_128_cfb128\t\t421\n#define OBJ_aes_128_cfb128\t\tOBJ_aes,4L\n\n#define SN_aes_192_ecb\t\t\"AES-192-ECB\"\n#define LN_aes_192_ecb\t\t\"aes-192-ecb\"\n#define NID_aes_192_ecb\t\t422\n#define OBJ_aes_192_ecb\t\tOBJ_aes,21L\n\n#define SN_aes_192_cbc\t\t\"AES-192-CBC\"\n#define LN_aes_192_cbc\t\t\"aes-192-cbc\"\n#define NID_aes_192_cbc\t\t423\n#define OBJ_aes_192_cbc\t\tOBJ_aes,22L\n\n#define SN_aes_192_ofb128\t\t\"AES-192-OFB\"\n#define LN_aes_192_ofb128\t\t\"aes-192-ofb\"\n#define NID_aes_192_ofb128\t\t424\n#define OBJ_aes_192_ofb128\t\tOBJ_aes,23L\n\n#define SN_aes_192_cfb128\t\t\"AES-192-CFB\"\n#define LN_aes_192_cfb128\t\t\"aes-192-cfb\"\n#define NID_aes_192_cfb128\t\t425\n#define OBJ_aes_192_cfb128\t\tOBJ_aes,24L\n\n#define SN_aes_256_ecb\t\t\"AES-256-ECB\"\n#define LN_aes_256_ecb\t\t\"aes-256-ecb\"\n#define NID_aes_256_ecb\t\t426\n#define OBJ_aes_256_ecb\t\tOBJ_aes,41L\n\n#define SN_aes_256_cbc\t\t\"AES-256-CBC\"\n#define LN_aes_256_cbc\t\t\"aes-256-cbc\"\n#define NID_aes_256_cbc\t\t427\n#define OBJ_aes_256_cbc\t\tOBJ_aes,42L\n\n#define SN_aes_256_ofb128\t\t\"AES-256-OFB\"\n#define LN_aes_256_ofb128\t\t\"aes-256-ofb\"\n#define NID_aes_256_ofb128\t\t428\n#define OBJ_aes_256_ofb128\t\tOBJ_aes,43L\n\n#define SN_aes_256_cfb128\t\t\"AES-256-CFB\"\n#define LN_aes_256_cfb128\t\t\"aes-256-cfb\"\n#define NID_aes_256_cfb128\t\t429\n#define OBJ_aes_256_cfb128\t\tOBJ_aes,44L\n\n#define SN_aes_128_cfb1\t\t\"AES-128-CFB1\"\n#define LN_aes_128_cfb1\t\t\"aes-128-cfb1\"\n#define NID_aes_128_cfb1\t\t650\n\n#define SN_aes_192_cfb1\t\t\"AES-192-CFB1\"\n#define LN_aes_192_cfb1\t\t\"aes-192-cfb1\"\n#define NID_aes_192_cfb1\t\t651\n\n#define SN_aes_256_cfb1\t\t\"AES-256-CFB1\"\n#define LN_aes_256_cfb1\t\t\"aes-256-cfb1\"\n#define NID_aes_256_cfb1\t\t652\n\n#define SN_aes_128_cfb8\t\t\"AES-128-CFB8\"\n#define LN_aes_128_cfb8\t\t\"aes-128-cfb8\"\n#define NID_aes_128_cfb8\t\t653\n\n#define SN_aes_192_cfb8\t\t\"AES-192-CFB8\"\n#define LN_aes_192_cfb8\t\t\"aes-192-cfb8\"\n#define NID_aes_192_cfb8\t\t654\n\n#define SN_aes_256_cfb8\t\t\"AES-256-CFB8\"\n#define LN_aes_256_cfb8\t\t\"aes-256-cfb8\"\n#define NID_aes_256_cfb8\t\t655\n\n#define SN_des_cfb1\t\t\"DES-CFB1\"\n#define LN_des_cfb1\t\t\"des-cfb1\"\n#define NID_des_cfb1\t\t656\n\n#define SN_des_cfb8\t\t\"DES-CFB8\"\n#define LN_des_cfb8\t\t\"des-cfb8\"\n#define NID_des_cfb8\t\t657\n\n#define SN_des_ede3_cfb1\t\t\"DES-EDE3-CFB1\"\n#define LN_des_ede3_cfb1\t\t\"des-ede3-cfb1\"\n#define NID_des_ede3_cfb1\t\t658\n\n#define SN_des_ede3_cfb8\t\t\"DES-EDE3-CFB8\"\n#define LN_des_ede3_cfb8\t\t\"des-ede3-cfb8\"\n#define NID_des_ede3_cfb8\t\t659\n\n#define SN_id_aes128_wrap\t\t\"id-aes128-wrap\"\n#define NID_id_aes128_wrap\t\t788\n#define OBJ_id_aes128_wrap\t\tOBJ_aes,5L\n\n#define SN_id_aes192_wrap\t\t\"id-aes192-wrap\"\n#define NID_id_aes192_wrap\t\t789\n#define OBJ_id_aes192_wrap\t\tOBJ_aes,25L\n\n#define SN_id_aes256_wrap\t\t\"id-aes256-wrap\"\n#define NID_id_aes256_wrap\t\t790\n#define OBJ_id_aes256_wrap\t\tOBJ_aes,45L\n\n#define OBJ_nist_hashalgs\t\tOBJ_nistAlgorithms,2L\n\n#define SN_sha256\t\t\"SHA256\"\n#define LN_sha256\t\t\"sha256\"\n#define NID_sha256\t\t672\n#define OBJ_sha256\t\tOBJ_nist_hashalgs,1L\n\n#define SN_sha384\t\t\"SHA384\"\n#define LN_sha384\t\t\"sha384\"\n#define NID_sha384\t\t673\n#define OBJ_sha384\t\tOBJ_nist_hashalgs,2L\n\n#define SN_sha512\t\t\"SHA512\"\n#define LN_sha512\t\t\"sha512\"\n#define NID_sha512\t\t674\n#define OBJ_sha512\t\tOBJ_nist_hashalgs,3L\n\n#define SN_sha224\t\t\"SHA224\"\n#define LN_sha224\t\t\"sha224\"\n#define NID_sha224\t\t675\n#define OBJ_sha224\t\tOBJ_nist_hashalgs,4L\n\n#define OBJ_dsa_with_sha2\t\tOBJ_nistAlgorithms,3L\n\n#define SN_dsa_with_SHA224\t\t\"dsa_with_SHA224\"\n#define NID_dsa_with_SHA224\t\t802\n#define OBJ_dsa_with_SHA224\t\tOBJ_dsa_with_sha2,1L\n\n#define SN_dsa_with_SHA256\t\t\"dsa_with_SHA256\"\n#define NID_dsa_with_SHA256\t\t803\n#define OBJ_dsa_with_SHA256\t\tOBJ_dsa_with_sha2,2L\n\n#define SN_hold_instruction_code\t\t\"holdInstructionCode\"\n#define LN_hold_instruction_code\t\t\"Hold Instruction Code\"\n#define NID_hold_instruction_code\t\t430\n#define OBJ_hold_instruction_code\t\tOBJ_id_ce,23L\n\n#define OBJ_holdInstruction\t\tOBJ_X9_57,2L\n\n#define SN_hold_instruction_none\t\t\"holdInstructionNone\"\n#define LN_hold_instruction_none\t\t\"Hold Instruction None\"\n#define NID_hold_instruction_none\t\t431\n#define OBJ_hold_instruction_none\t\tOBJ_holdInstruction,1L\n\n#define SN_hold_instruction_call_issuer\t\t\"holdInstructionCallIssuer\"\n#define LN_hold_instruction_call_issuer\t\t\"Hold Instruction Call Issuer\"\n#define NID_hold_instruction_call_issuer\t\t432\n#define OBJ_hold_instruction_call_issuer\t\tOBJ_holdInstruction,2L\n\n#define SN_hold_instruction_reject\t\t\"holdInstructionReject\"\n#define LN_hold_instruction_reject\t\t\"Hold Instruction Reject\"\n#define NID_hold_instruction_reject\t\t433\n#define OBJ_hold_instruction_reject\t\tOBJ_holdInstruction,3L\n\n#define SN_data\t\t\"data\"\n#define NID_data\t\t434\n#define OBJ_data\t\tOBJ_itu_t,9L\n\n#define SN_pss\t\t\"pss\"\n#define NID_pss\t\t435\n#define OBJ_pss\t\tOBJ_data,2342L\n\n#define SN_ucl\t\t\"ucl\"\n#define NID_ucl\t\t436\n#define OBJ_ucl\t\tOBJ_pss,19200300L\n\n#define SN_pilot\t\t\"pilot\"\n#define NID_pilot\t\t437\n#define OBJ_pilot\t\tOBJ_ucl,100L\n\n#define LN_pilotAttributeType\t\t\"pilotAttributeType\"\n#define NID_pilotAttributeType\t\t438\n#define OBJ_pilotAttributeType\t\tOBJ_pilot,1L\n\n#define LN_pilotAttributeSyntax\t\t\"pilotAttributeSyntax\"\n#define NID_pilotAttributeSyntax\t\t439\n#define OBJ_pilotAttributeSyntax\t\tOBJ_pilot,3L\n\n#define LN_pilotObjectClass\t\t\"pilotObjectClass\"\n#define NID_pilotObjectClass\t\t440\n#define OBJ_pilotObjectClass\t\tOBJ_pilot,4L\n\n#define LN_pilotGroups\t\t\"pilotGroups\"\n#define NID_pilotGroups\t\t441\n#define OBJ_pilotGroups\t\tOBJ_pilot,10L\n\n#define LN_iA5StringSyntax\t\t\"iA5StringSyntax\"\n#define NID_iA5StringSyntax\t\t442\n#define OBJ_iA5StringSyntax\t\tOBJ_pilotAttributeSyntax,4L\n\n#define LN_caseIgnoreIA5StringSyntax\t\t\"caseIgnoreIA5StringSyntax\"\n#define NID_caseIgnoreIA5StringSyntax\t\t443\n#define OBJ_caseIgnoreIA5StringSyntax\t\tOBJ_pilotAttributeSyntax,5L\n\n#define LN_pilotObject\t\t\"pilotObject\"\n#define NID_pilotObject\t\t444\n#define OBJ_pilotObject\t\tOBJ_pilotObjectClass,3L\n\n#define LN_pilotPerson\t\t\"pilotPerson\"\n#define NID_pilotPerson\t\t445\n#define OBJ_pilotPerson\t\tOBJ_pilotObjectClass,4L\n\n#define SN_account\t\t\"account\"\n#define NID_account\t\t446\n#define OBJ_account\t\tOBJ_pilotObjectClass,5L\n\n#define SN_document\t\t\"document\"\n#define NID_document\t\t447\n#define OBJ_document\t\tOBJ_pilotObjectClass,6L\n\n#define SN_room\t\t\"room\"\n#define NID_room\t\t448\n#define OBJ_room\t\tOBJ_pilotObjectClass,7L\n\n#define LN_documentSeries\t\t\"documentSeries\"\n#define NID_documentSeries\t\t449\n#define OBJ_documentSeries\t\tOBJ_pilotObjectClass,9L\n\n#define SN_Domain\t\t\"domain\"\n#define LN_Domain\t\t\"Domain\"\n#define NID_Domain\t\t392\n#define OBJ_Domain\t\tOBJ_pilotObjectClass,13L\n\n#define LN_rFC822localPart\t\t\"rFC822localPart\"\n#define NID_rFC822localPart\t\t450\n#define OBJ_rFC822localPart\t\tOBJ_pilotObjectClass,14L\n\n#define LN_dNSDomain\t\t\"dNSDomain\"\n#define NID_dNSDomain\t\t451\n#define OBJ_dNSDomain\t\tOBJ_pilotObjectClass,15L\n\n#define LN_domainRelatedObject\t\t\"domainRelatedObject\"\n#define NID_domainRelatedObject\t\t452\n#define OBJ_domainRelatedObject\t\tOBJ_pilotObjectClass,17L\n\n#define LN_friendlyCountry\t\t\"friendlyCountry\"\n#define NID_friendlyCountry\t\t453\n#define OBJ_friendlyCountry\t\tOBJ_pilotObjectClass,18L\n\n#define LN_simpleSecurityObject\t\t\"simpleSecurityObject\"\n#define NID_simpleSecurityObject\t\t454\n#define OBJ_simpleSecurityObject\t\tOBJ_pilotObjectClass,19L\n\n#define LN_pilotOrganization\t\t\"pilotOrganization\"\n#define NID_pilotOrganization\t\t455\n#define OBJ_pilotOrganization\t\tOBJ_pilotObjectClass,20L\n\n#define LN_pilotDSA\t\t\"pilotDSA\"\n#define NID_pilotDSA\t\t456\n#define OBJ_pilotDSA\t\tOBJ_pilotObjectClass,21L\n\n#define LN_qualityLabelledData\t\t\"qualityLabelledData\"\n#define NID_qualityLabelledData\t\t457\n#define OBJ_qualityLabelledData\t\tOBJ_pilotObjectClass,22L\n\n#define SN_userId\t\t\"UID\"\n#define LN_userId\t\t\"userId\"\n#define NID_userId\t\t458\n#define OBJ_userId\t\tOBJ_pilotAttributeType,1L\n\n#define LN_textEncodedORAddress\t\t\"textEncodedORAddress\"\n#define NID_textEncodedORAddress\t\t459\n#define OBJ_textEncodedORAddress\t\tOBJ_pilotAttributeType,2L\n\n#define SN_rfc822Mailbox\t\t\"mail\"\n#define LN_rfc822Mailbox\t\t\"rfc822Mailbox\"\n#define NID_rfc822Mailbox\t\t460\n#define OBJ_rfc822Mailbox\t\tOBJ_pilotAttributeType,3L\n\n#define SN_info\t\t\"info\"\n#define NID_info\t\t461\n#define OBJ_info\t\tOBJ_pilotAttributeType,4L\n\n#define LN_favouriteDrink\t\t\"favouriteDrink\"\n#define NID_favouriteDrink\t\t462\n#define OBJ_favouriteDrink\t\tOBJ_pilotAttributeType,5L\n\n#define LN_roomNumber\t\t\"roomNumber\"\n#define NID_roomNumber\t\t463\n#define OBJ_roomNumber\t\tOBJ_pilotAttributeType,6L\n\n#define SN_photo\t\t\"photo\"\n#define NID_photo\t\t464\n#define OBJ_photo\t\tOBJ_pilotAttributeType,7L\n\n#define LN_userClass\t\t\"userClass\"\n#define NID_userClass\t\t465\n#define OBJ_userClass\t\tOBJ_pilotAttributeType,8L\n\n#define SN_host\t\t\"host\"\n#define NID_host\t\t466\n#define OBJ_host\t\tOBJ_pilotAttributeType,9L\n\n#define SN_manager\t\t\"manager\"\n#define NID_manager\t\t467\n#define OBJ_manager\t\tOBJ_pilotAttributeType,10L\n\n#define LN_documentIdentifier\t\t\"documentIdentifier\"\n#define NID_documentIdentifier\t\t468\n#define OBJ_documentIdentifier\t\tOBJ_pilotAttributeType,11L\n\n#define LN_documentTitle\t\t\"documentTitle\"\n#define NID_documentTitle\t\t469\n#define OBJ_documentTitle\t\tOBJ_pilotAttributeType,12L\n\n#define LN_documentVersion\t\t\"documentVersion\"\n#define NID_documentVersion\t\t470\n#define OBJ_documentVersion\t\tOBJ_pilotAttributeType,13L\n\n#define LN_documentAuthor\t\t\"documentAuthor\"\n#define NID_documentAuthor\t\t471\n#define OBJ_documentAuthor\t\tOBJ_pilotAttributeType,14L\n\n#define LN_documentLocation\t\t\"documentLocation\"\n#define NID_documentLocation\t\t472\n#define OBJ_documentLocation\t\tOBJ_pilotAttributeType,15L\n\n#define LN_homeTelephoneNumber\t\t\"homeTelephoneNumber\"\n#define NID_homeTelephoneNumber\t\t473\n#define OBJ_homeTelephoneNumber\t\tOBJ_pilotAttributeType,20L\n\n#define SN_secretary\t\t\"secretary\"\n#define NID_secretary\t\t474\n#define OBJ_secretary\t\tOBJ_pilotAttributeType,21L\n\n#define LN_otherMailbox\t\t\"otherMailbox\"\n#define NID_otherMailbox\t\t475\n#define OBJ_otherMailbox\t\tOBJ_pilotAttributeType,22L\n\n#define LN_lastModifiedTime\t\t\"lastModifiedTime\"\n#define NID_lastModifiedTime\t\t476\n#define OBJ_lastModifiedTime\t\tOBJ_pilotAttributeType,23L\n\n#define LN_lastModifiedBy\t\t\"lastModifiedBy\"\n#define NID_lastModifiedBy\t\t477\n#define OBJ_lastModifiedBy\t\tOBJ_pilotAttributeType,24L\n\n#define SN_domainComponent\t\t\"DC\"\n#define LN_domainComponent\t\t\"domainComponent\"\n#define NID_domainComponent\t\t391\n#define OBJ_domainComponent\t\tOBJ_pilotAttributeType,25L\n\n#define LN_aRecord\t\t\"aRecord\"\n#define NID_aRecord\t\t478\n#define OBJ_aRecord\t\tOBJ_pilotAttributeType,26L\n\n#define LN_pilotAttributeType27\t\t\"pilotAttributeType27\"\n#define NID_pilotAttributeType27\t\t479\n#define OBJ_pilotAttributeType27\t\tOBJ_pilotAttributeType,27L\n\n#define LN_mXRecord\t\t\"mXRecord\"\n#define NID_mXRecord\t\t480\n#define OBJ_mXRecord\t\tOBJ_pilotAttributeType,28L\n\n#define LN_nSRecord\t\t\"nSRecord\"\n#define NID_nSRecord\t\t481\n#define OBJ_nSRecord\t\tOBJ_pilotAttributeType,29L\n\n#define LN_sOARecord\t\t\"sOARecord\"\n#define NID_sOARecord\t\t482\n#define OBJ_sOARecord\t\tOBJ_pilotAttributeType,30L\n\n#define LN_cNAMERecord\t\t\"cNAMERecord\"\n#define NID_cNAMERecord\t\t483\n#define OBJ_cNAMERecord\t\tOBJ_pilotAttributeType,31L\n\n#define LN_associatedDomain\t\t\"associatedDomain\"\n#define NID_associatedDomain\t\t484\n#define OBJ_associatedDomain\t\tOBJ_pilotAttributeType,37L\n\n#define LN_associatedName\t\t\"associatedName\"\n#define NID_associatedName\t\t485\n#define OBJ_associatedName\t\tOBJ_pilotAttributeType,38L\n\n#define LN_homePostalAddress\t\t\"homePostalAddress\"\n#define NID_homePostalAddress\t\t486\n#define OBJ_homePostalAddress\t\tOBJ_pilotAttributeType,39L\n\n#define LN_personalTitle\t\t\"personalTitle\"\n#define NID_personalTitle\t\t487\n#define OBJ_personalTitle\t\tOBJ_pilotAttributeType,40L\n\n#define LN_mobileTelephoneNumber\t\t\"mobileTelephoneNumber\"\n#define NID_mobileTelephoneNumber\t\t488\n#define OBJ_mobileTelephoneNumber\t\tOBJ_pilotAttributeType,41L\n\n#define LN_pagerTelephoneNumber\t\t\"pagerTelephoneNumber\"\n#define NID_pagerTelephoneNumber\t\t489\n#define OBJ_pagerTelephoneNumber\t\tOBJ_pilotAttributeType,42L\n\n#define LN_friendlyCountryName\t\t\"friendlyCountryName\"\n#define NID_friendlyCountryName\t\t490\n#define OBJ_friendlyCountryName\t\tOBJ_pilotAttributeType,43L\n\n#define LN_organizationalStatus\t\t\"organizationalStatus\"\n#define NID_organizationalStatus\t\t491\n#define OBJ_organizationalStatus\t\tOBJ_pilotAttributeType,45L\n\n#define LN_janetMailbox\t\t\"janetMailbox\"\n#define NID_janetMailbox\t\t492\n#define OBJ_janetMailbox\t\tOBJ_pilotAttributeType,46L\n\n#define LN_mailPreferenceOption\t\t\"mailPreferenceOption\"\n#define NID_mailPreferenceOption\t\t493\n#define OBJ_mailPreferenceOption\t\tOBJ_pilotAttributeType,47L\n\n#define LN_buildingName\t\t\"buildingName\"\n#define NID_buildingName\t\t494\n#define OBJ_buildingName\t\tOBJ_pilotAttributeType,48L\n\n#define LN_dSAQuality\t\t\"dSAQuality\"\n#define NID_dSAQuality\t\t495\n#define OBJ_dSAQuality\t\tOBJ_pilotAttributeType,49L\n\n#define LN_singleLevelQuality\t\t\"singleLevelQuality\"\n#define NID_singleLevelQuality\t\t496\n#define OBJ_singleLevelQuality\t\tOBJ_pilotAttributeType,50L\n\n#define LN_subtreeMinimumQuality\t\t\"subtreeMinimumQuality\"\n#define NID_subtreeMinimumQuality\t\t497\n#define OBJ_subtreeMinimumQuality\t\tOBJ_pilotAttributeType,51L\n\n#define LN_subtreeMaximumQuality\t\t\"subtreeMaximumQuality\"\n#define NID_subtreeMaximumQuality\t\t498\n#define OBJ_subtreeMaximumQuality\t\tOBJ_pilotAttributeType,52L\n\n#define LN_personalSignature\t\t\"personalSignature\"\n#define NID_personalSignature\t\t499\n#define OBJ_personalSignature\t\tOBJ_pilotAttributeType,53L\n\n#define LN_dITRedirect\t\t\"dITRedirect\"\n#define NID_dITRedirect\t\t500\n#define OBJ_dITRedirect\t\tOBJ_pilotAttributeType,54L\n\n#define SN_audio\t\t\"audio\"\n#define NID_audio\t\t501\n#define OBJ_audio\t\tOBJ_pilotAttributeType,55L\n\n#define LN_documentPublisher\t\t\"documentPublisher\"\n#define NID_documentPublisher\t\t502\n#define OBJ_documentPublisher\t\tOBJ_pilotAttributeType,56L\n\n#define SN_id_set\t\t\"id-set\"\n#define LN_id_set\t\t\"Secure Electronic Transactions\"\n#define NID_id_set\t\t512\n#define OBJ_id_set\t\tOBJ_international_organizations,42L\n\n#define SN_set_ctype\t\t\"set-ctype\"\n#define LN_set_ctype\t\t\"content types\"\n#define NID_set_ctype\t\t513\n#define OBJ_set_ctype\t\tOBJ_id_set,0L\n\n#define SN_set_msgExt\t\t\"set-msgExt\"\n#define LN_set_msgExt\t\t\"message extensions\"\n#define NID_set_msgExt\t\t514\n#define OBJ_set_msgExt\t\tOBJ_id_set,1L\n\n#define SN_set_attr\t\t\"set-attr\"\n#define NID_set_attr\t\t515\n#define OBJ_set_attr\t\tOBJ_id_set,3L\n\n#define SN_set_policy\t\t\"set-policy\"\n#define NID_set_policy\t\t516\n#define OBJ_set_policy\t\tOBJ_id_set,5L\n\n#define SN_set_certExt\t\t\"set-certExt\"\n#define LN_set_certExt\t\t\"certificate extensions\"\n#define NID_set_certExt\t\t517\n#define OBJ_set_certExt\t\tOBJ_id_set,7L\n\n#define SN_set_brand\t\t\"set-brand\"\n#define NID_set_brand\t\t518\n#define OBJ_set_brand\t\tOBJ_id_set,8L\n\n#define SN_setct_PANData\t\t\"setct-PANData\"\n#define NID_setct_PANData\t\t519\n#define OBJ_setct_PANData\t\tOBJ_set_ctype,0L\n\n#define SN_setct_PANToken\t\t\"setct-PANToken\"\n#define NID_setct_PANToken\t\t520\n#define OBJ_setct_PANToken\t\tOBJ_set_ctype,1L\n\n#define SN_setct_PANOnly\t\t\"setct-PANOnly\"\n#define NID_setct_PANOnly\t\t521\n#define OBJ_setct_PANOnly\t\tOBJ_set_ctype,2L\n\n#define SN_setct_OIData\t\t\"setct-OIData\"\n#define NID_setct_OIData\t\t522\n#define OBJ_setct_OIData\t\tOBJ_set_ctype,3L\n\n#define SN_setct_PI\t\t\"setct-PI\"\n#define NID_setct_PI\t\t523\n#define OBJ_setct_PI\t\tOBJ_set_ctype,4L\n\n#define SN_setct_PIData\t\t\"setct-PIData\"\n#define NID_setct_PIData\t\t524\n#define OBJ_setct_PIData\t\tOBJ_set_ctype,5L\n\n#define SN_setct_PIDataUnsigned\t\t\"setct-PIDataUnsigned\"\n#define NID_setct_PIDataUnsigned\t\t525\n#define OBJ_setct_PIDataUnsigned\t\tOBJ_set_ctype,6L\n\n#define SN_setct_HODInput\t\t\"setct-HODInput\"\n#define NID_setct_HODInput\t\t526\n#define OBJ_setct_HODInput\t\tOBJ_set_ctype,7L\n\n#define SN_setct_AuthResBaggage\t\t\"setct-AuthResBaggage\"\n#define NID_setct_AuthResBaggage\t\t527\n#define OBJ_setct_AuthResBaggage\t\tOBJ_set_ctype,8L\n\n#define SN_setct_AuthRevReqBaggage\t\t\"setct-AuthRevReqBaggage\"\n#define NID_setct_AuthRevReqBaggage\t\t528\n#define OBJ_setct_AuthRevReqBaggage\t\tOBJ_set_ctype,9L\n\n#define SN_setct_AuthRevResBaggage\t\t\"setct-AuthRevResBaggage\"\n#define NID_setct_AuthRevResBaggage\t\t529\n#define OBJ_setct_AuthRevResBaggage\t\tOBJ_set_ctype,10L\n\n#define SN_setct_CapTokenSeq\t\t\"setct-CapTokenSeq\"\n#define NID_setct_CapTokenSeq\t\t530\n#define OBJ_setct_CapTokenSeq\t\tOBJ_set_ctype,11L\n\n#define SN_setct_PInitResData\t\t\"setct-PInitResData\"\n#define NID_setct_PInitResData\t\t531\n#define OBJ_setct_PInitResData\t\tOBJ_set_ctype,12L\n\n#define SN_setct_PI_TBS\t\t\"setct-PI-TBS\"\n#define NID_setct_PI_TBS\t\t532\n#define OBJ_setct_PI_TBS\t\tOBJ_set_ctype,13L\n\n#define SN_setct_PResData\t\t\"setct-PResData\"\n#define NID_setct_PResData\t\t533\n#define OBJ_setct_PResData\t\tOBJ_set_ctype,14L\n\n#define SN_setct_AuthReqTBS\t\t\"setct-AuthReqTBS\"\n#define NID_setct_AuthReqTBS\t\t534\n#define OBJ_setct_AuthReqTBS\t\tOBJ_set_ctype,16L\n\n#define SN_setct_AuthResTBS\t\t\"setct-AuthResTBS\"\n#define NID_setct_AuthResTBS\t\t535\n#define OBJ_setct_AuthResTBS\t\tOBJ_set_ctype,17L\n\n#define SN_setct_AuthResTBSX\t\t\"setct-AuthResTBSX\"\n#define NID_setct_AuthResTBSX\t\t536\n#define OBJ_setct_AuthResTBSX\t\tOBJ_set_ctype,18L\n\n#define SN_setct_AuthTokenTBS\t\t\"setct-AuthTokenTBS\"\n#define NID_setct_AuthTokenTBS\t\t537\n#define OBJ_setct_AuthTokenTBS\t\tOBJ_set_ctype,19L\n\n#define SN_setct_CapTokenData\t\t\"setct-CapTokenData\"\n#define NID_setct_CapTokenData\t\t538\n#define OBJ_setct_CapTokenData\t\tOBJ_set_ctype,20L\n\n#define SN_setct_CapTokenTBS\t\t\"setct-CapTokenTBS\"\n#define NID_setct_CapTokenTBS\t\t539\n#define OBJ_setct_CapTokenTBS\t\tOBJ_set_ctype,21L\n\n#define SN_setct_AcqCardCodeMsg\t\t\"setct-AcqCardCodeMsg\"\n#define NID_setct_AcqCardCodeMsg\t\t540\n#define OBJ_setct_AcqCardCodeMsg\t\tOBJ_set_ctype,22L\n\n#define SN_setct_AuthRevReqTBS\t\t\"setct-AuthRevReqTBS\"\n#define NID_setct_AuthRevReqTBS\t\t541\n#define OBJ_setct_AuthRevReqTBS\t\tOBJ_set_ctype,23L\n\n#define SN_setct_AuthRevResData\t\t\"setct-AuthRevResData\"\n#define NID_setct_AuthRevResData\t\t542\n#define OBJ_setct_AuthRevResData\t\tOBJ_set_ctype,24L\n\n#define SN_setct_AuthRevResTBS\t\t\"setct-AuthRevResTBS\"\n#define NID_setct_AuthRevResTBS\t\t543\n#define OBJ_setct_AuthRevResTBS\t\tOBJ_set_ctype,25L\n\n#define SN_setct_CapReqTBS\t\t\"setct-CapReqTBS\"\n#define NID_setct_CapReqTBS\t\t544\n#define OBJ_setct_CapReqTBS\t\tOBJ_set_ctype,26L\n\n#define SN_setct_CapReqTBSX\t\t\"setct-CapReqTBSX\"\n#define NID_setct_CapReqTBSX\t\t545\n#define OBJ_setct_CapReqTBSX\t\tOBJ_set_ctype,27L\n\n#define SN_setct_CapResData\t\t\"setct-CapResData\"\n#define NID_setct_CapResData\t\t546\n#define OBJ_setct_CapResData\t\tOBJ_set_ctype,28L\n\n#define SN_setct_CapRevReqTBS\t\t\"setct-CapRevReqTBS\"\n#define NID_setct_CapRevReqTBS\t\t547\n#define OBJ_setct_CapRevReqTBS\t\tOBJ_set_ctype,29L\n\n#define SN_setct_CapRevReqTBSX\t\t\"setct-CapRevReqTBSX\"\n#define NID_setct_CapRevReqTBSX\t\t548\n#define OBJ_setct_CapRevReqTBSX\t\tOBJ_set_ctype,30L\n\n#define SN_setct_CapRevResData\t\t\"setct-CapRevResData\"\n#define NID_setct_CapRevResData\t\t549\n#define OBJ_setct_CapRevResData\t\tOBJ_set_ctype,31L\n\n#define SN_setct_CredReqTBS\t\t\"setct-CredReqTBS\"\n#define NID_setct_CredReqTBS\t\t550\n#define OBJ_setct_CredReqTBS\t\tOBJ_set_ctype,32L\n\n#define SN_setct_CredReqTBSX\t\t\"setct-CredReqTBSX\"\n#define NID_setct_CredReqTBSX\t\t551\n#define OBJ_setct_CredReqTBSX\t\tOBJ_set_ctype,33L\n\n#define SN_setct_CredResData\t\t\"setct-CredResData\"\n#define NID_setct_CredResData\t\t552\n#define OBJ_setct_CredResData\t\tOBJ_set_ctype,34L\n\n#define SN_setct_CredRevReqTBS\t\t\"setct-CredRevReqTBS\"\n#define NID_setct_CredRevReqTBS\t\t553\n#define OBJ_setct_CredRevReqTBS\t\tOBJ_set_ctype,35L\n\n#define SN_setct_CredRevReqTBSX\t\t\"setct-CredRevReqTBSX\"\n#define NID_setct_CredRevReqTBSX\t\t554\n#define OBJ_setct_CredRevReqTBSX\t\tOBJ_set_ctype,36L\n\n#define SN_setct_CredRevResData\t\t\"setct-CredRevResData\"\n#define NID_setct_CredRevResData\t\t555\n#define OBJ_setct_CredRevResData\t\tOBJ_set_ctype,37L\n\n#define SN_setct_PCertReqData\t\t\"setct-PCertReqData\"\n#define NID_setct_PCertReqData\t\t556\n#define OBJ_setct_PCertReqData\t\tOBJ_set_ctype,38L\n\n#define SN_setct_PCertResTBS\t\t\"setct-PCertResTBS\"\n#define NID_setct_PCertResTBS\t\t557\n#define OBJ_setct_PCertResTBS\t\tOBJ_set_ctype,39L\n\n#define SN_setct_BatchAdminReqData\t\t\"setct-BatchAdminReqData\"\n#define NID_setct_BatchAdminReqData\t\t558\n#define OBJ_setct_BatchAdminReqData\t\tOBJ_set_ctype,40L\n\n#define SN_setct_BatchAdminResData\t\t\"setct-BatchAdminResData\"\n#define NID_setct_BatchAdminResData\t\t559\n#define OBJ_setct_BatchAdminResData\t\tOBJ_set_ctype,41L\n\n#define SN_setct_CardCInitResTBS\t\t\"setct-CardCInitResTBS\"\n#define NID_setct_CardCInitResTBS\t\t560\n#define OBJ_setct_CardCInitResTBS\t\tOBJ_set_ctype,42L\n\n#define SN_setct_MeAqCInitResTBS\t\t\"setct-MeAqCInitResTBS\"\n#define NID_setct_MeAqCInitResTBS\t\t561\n#define OBJ_setct_MeAqCInitResTBS\t\tOBJ_set_ctype,43L\n\n#define SN_setct_RegFormResTBS\t\t\"setct-RegFormResTBS\"\n#define NID_setct_RegFormResTBS\t\t562\n#define OBJ_setct_RegFormResTBS\t\tOBJ_set_ctype,44L\n\n#define SN_setct_CertReqData\t\t\"setct-CertReqData\"\n#define NID_setct_CertReqData\t\t563\n#define OBJ_setct_CertReqData\t\tOBJ_set_ctype,45L\n\n#define SN_setct_CertReqTBS\t\t\"setct-CertReqTBS\"\n#define NID_setct_CertReqTBS\t\t564\n#define OBJ_setct_CertReqTBS\t\tOBJ_set_ctype,46L\n\n#define SN_setct_CertResData\t\t\"setct-CertResData\"\n#define NID_setct_CertResData\t\t565\n#define OBJ_setct_CertResData\t\tOBJ_set_ctype,47L\n\n#define SN_setct_CertInqReqTBS\t\t\"setct-CertInqReqTBS\"\n#define NID_setct_CertInqReqTBS\t\t566\n#define OBJ_setct_CertInqReqTBS\t\tOBJ_set_ctype,48L\n\n#define SN_setct_ErrorTBS\t\t\"setct-ErrorTBS\"\n#define NID_setct_ErrorTBS\t\t567\n#define OBJ_setct_ErrorTBS\t\tOBJ_set_ctype,49L\n\n#define SN_setct_PIDualSignedTBE\t\t\"setct-PIDualSignedTBE\"\n#define NID_setct_PIDualSignedTBE\t\t568\n#define OBJ_setct_PIDualSignedTBE\t\tOBJ_set_ctype,50L\n\n#define SN_setct_PIUnsignedTBE\t\t\"setct-PIUnsignedTBE\"\n#define NID_setct_PIUnsignedTBE\t\t569\n#define OBJ_setct_PIUnsignedTBE\t\tOBJ_set_ctype,51L\n\n#define SN_setct_AuthReqTBE\t\t\"setct-AuthReqTBE\"\n#define NID_setct_AuthReqTBE\t\t570\n#define OBJ_setct_AuthReqTBE\t\tOBJ_set_ctype,52L\n\n#define SN_setct_AuthResTBE\t\t\"setct-AuthResTBE\"\n#define NID_setct_AuthResTBE\t\t571\n#define OBJ_setct_AuthResTBE\t\tOBJ_set_ctype,53L\n\n#define SN_setct_AuthResTBEX\t\t\"setct-AuthResTBEX\"\n#define NID_setct_AuthResTBEX\t\t572\n#define OBJ_setct_AuthResTBEX\t\tOBJ_set_ctype,54L\n\n#define SN_setct_AuthTokenTBE\t\t\"setct-AuthTokenTBE\"\n#define NID_setct_AuthTokenTBE\t\t573\n#define OBJ_setct_AuthTokenTBE\t\tOBJ_set_ctype,55L\n\n#define SN_setct_CapTokenTBE\t\t\"setct-CapTokenTBE\"\n#define NID_setct_CapTokenTBE\t\t574\n#define OBJ_setct_CapTokenTBE\t\tOBJ_set_ctype,56L\n\n#define SN_setct_CapTokenTBEX\t\t\"setct-CapTokenTBEX\"\n#define NID_setct_CapTokenTBEX\t\t575\n#define OBJ_setct_CapTokenTBEX\t\tOBJ_set_ctype,57L\n\n#define SN_setct_AcqCardCodeMsgTBE\t\t\"setct-AcqCardCodeMsgTBE\"\n#define NID_setct_AcqCardCodeMsgTBE\t\t576\n#define OBJ_setct_AcqCardCodeMsgTBE\t\tOBJ_set_ctype,58L\n\n#define SN_setct_AuthRevReqTBE\t\t\"setct-AuthRevReqTBE\"\n#define NID_setct_AuthRevReqTBE\t\t577\n#define OBJ_setct_AuthRevReqTBE\t\tOBJ_set_ctype,59L\n\n#define SN_setct_AuthRevResTBE\t\t\"setct-AuthRevResTBE\"\n#define NID_setct_AuthRevResTBE\t\t578\n#define OBJ_setct_AuthRevResTBE\t\tOBJ_set_ctype,60L\n\n#define SN_setct_AuthRevResTBEB\t\t\"setct-AuthRevResTBEB\"\n#define NID_setct_AuthRevResTBEB\t\t579\n#define OBJ_setct_AuthRevResTBEB\t\tOBJ_set_ctype,61L\n\n#define SN_setct_CapReqTBE\t\t\"setct-CapReqTBE\"\n#define NID_setct_CapReqTBE\t\t580\n#define OBJ_setct_CapReqTBE\t\tOBJ_set_ctype,62L\n\n#define SN_setct_CapReqTBEX\t\t\"setct-CapReqTBEX\"\n#define NID_setct_CapReqTBEX\t\t581\n#define OBJ_setct_CapReqTBEX\t\tOBJ_set_ctype,63L\n\n#define SN_setct_CapResTBE\t\t\"setct-CapResTBE\"\n#define NID_setct_CapResTBE\t\t582\n#define OBJ_setct_CapResTBE\t\tOBJ_set_ctype,64L\n\n#define SN_setct_CapRevReqTBE\t\t\"setct-CapRevReqTBE\"\n#define NID_setct_CapRevReqTBE\t\t583\n#define OBJ_setct_CapRevReqTBE\t\tOBJ_set_ctype,65L\n\n#define SN_setct_CapRevReqTBEX\t\t\"setct-CapRevReqTBEX\"\n#define NID_setct_CapRevReqTBEX\t\t584\n#define OBJ_setct_CapRevReqTBEX\t\tOBJ_set_ctype,66L\n\n#define SN_setct_CapRevResTBE\t\t\"setct-CapRevResTBE\"\n#define NID_setct_CapRevResTBE\t\t585\n#define OBJ_setct_CapRevResTBE\t\tOBJ_set_ctype,67L\n\n#define SN_setct_CredReqTBE\t\t\"setct-CredReqTBE\"\n#define NID_setct_CredReqTBE\t\t586\n#define OBJ_setct_CredReqTBE\t\tOBJ_set_ctype,68L\n\n#define SN_setct_CredReqTBEX\t\t\"setct-CredReqTBEX\"\n#define NID_setct_CredReqTBEX\t\t587\n#define OBJ_setct_CredReqTBEX\t\tOBJ_set_ctype,69L\n\n#define SN_setct_CredResTBE\t\t\"setct-CredResTBE\"\n#define NID_setct_CredResTBE\t\t588\n#define OBJ_setct_CredResTBE\t\tOBJ_set_ctype,70L\n\n#define SN_setct_CredRevReqTBE\t\t\"setct-CredRevReqTBE\"\n#define NID_setct_CredRevReqTBE\t\t589\n#define OBJ_setct_CredRevReqTBE\t\tOBJ_set_ctype,71L\n\n#define SN_setct_CredRevReqTBEX\t\t\"setct-CredRevReqTBEX\"\n#define NID_setct_CredRevReqTBEX\t\t590\n#define OBJ_setct_CredRevReqTBEX\t\tOBJ_set_ctype,72L\n\n#define SN_setct_CredRevResTBE\t\t\"setct-CredRevResTBE\"\n#define NID_setct_CredRevResTBE\t\t591\n#define OBJ_setct_CredRevResTBE\t\tOBJ_set_ctype,73L\n\n#define SN_setct_BatchAdminReqTBE\t\t\"setct-BatchAdminReqTBE\"\n#define NID_setct_BatchAdminReqTBE\t\t592\n#define OBJ_setct_BatchAdminReqTBE\t\tOBJ_set_ctype,74L\n\n#define SN_setct_BatchAdminResTBE\t\t\"setct-BatchAdminResTBE\"\n#define NID_setct_BatchAdminResTBE\t\t593\n#define OBJ_setct_BatchAdminResTBE\t\tOBJ_set_ctype,75L\n\n#define SN_setct_RegFormReqTBE\t\t\"setct-RegFormReqTBE\"\n#define NID_setct_RegFormReqTBE\t\t594\n#define OBJ_setct_RegFormReqTBE\t\tOBJ_set_ctype,76L\n\n#define SN_setct_CertReqTBE\t\t\"setct-CertReqTBE\"\n#define NID_setct_CertReqTBE\t\t595\n#define OBJ_setct_CertReqTBE\t\tOBJ_set_ctype,77L\n\n#define SN_setct_CertReqTBEX\t\t\"setct-CertReqTBEX\"\n#define NID_setct_CertReqTBEX\t\t596\n#define OBJ_setct_CertReqTBEX\t\tOBJ_set_ctype,78L\n\n#define SN_setct_CertResTBE\t\t\"setct-CertResTBE\"\n#define NID_setct_CertResTBE\t\t597\n#define OBJ_setct_CertResTBE\t\tOBJ_set_ctype,79L\n\n#define SN_setct_CRLNotificationTBS\t\t\"setct-CRLNotificationTBS\"\n#define NID_setct_CRLNotificationTBS\t\t598\n#define OBJ_setct_CRLNotificationTBS\t\tOBJ_set_ctype,80L\n\n#define SN_setct_CRLNotificationResTBS\t\t\"setct-CRLNotificationResTBS\"\n#define NID_setct_CRLNotificationResTBS\t\t599\n#define OBJ_setct_CRLNotificationResTBS\t\tOBJ_set_ctype,81L\n\n#define SN_setct_BCIDistributionTBS\t\t\"setct-BCIDistributionTBS\"\n#define NID_setct_BCIDistributionTBS\t\t600\n#define OBJ_setct_BCIDistributionTBS\t\tOBJ_set_ctype,82L\n\n#define SN_setext_genCrypt\t\t\"setext-genCrypt\"\n#define LN_setext_genCrypt\t\t\"generic cryptogram\"\n#define NID_setext_genCrypt\t\t601\n#define OBJ_setext_genCrypt\t\tOBJ_set_msgExt,1L\n\n#define SN_setext_miAuth\t\t\"setext-miAuth\"\n#define LN_setext_miAuth\t\t\"merchant initiated auth\"\n#define NID_setext_miAuth\t\t602\n#define OBJ_setext_miAuth\t\tOBJ_set_msgExt,3L\n\n#define SN_setext_pinSecure\t\t\"setext-pinSecure\"\n#define NID_setext_pinSecure\t\t603\n#define OBJ_setext_pinSecure\t\tOBJ_set_msgExt,4L\n\n#define SN_setext_pinAny\t\t\"setext-pinAny\"\n#define NID_setext_pinAny\t\t604\n#define OBJ_setext_pinAny\t\tOBJ_set_msgExt,5L\n\n#define SN_setext_track2\t\t\"setext-track2\"\n#define NID_setext_track2\t\t605\n#define OBJ_setext_track2\t\tOBJ_set_msgExt,7L\n\n#define SN_setext_cv\t\t\"setext-cv\"\n#define LN_setext_cv\t\t\"additional verification\"\n#define NID_setext_cv\t\t606\n#define OBJ_setext_cv\t\tOBJ_set_msgExt,8L\n\n#define SN_set_policy_root\t\t\"set-policy-root\"\n#define NID_set_policy_root\t\t607\n#define OBJ_set_policy_root\t\tOBJ_set_policy,0L\n\n#define SN_setCext_hashedRoot\t\t\"setCext-hashedRoot\"\n#define NID_setCext_hashedRoot\t\t608\n#define OBJ_setCext_hashedRoot\t\tOBJ_set_certExt,0L\n\n#define SN_setCext_certType\t\t\"setCext-certType\"\n#define NID_setCext_certType\t\t609\n#define OBJ_setCext_certType\t\tOBJ_set_certExt,1L\n\n#define SN_setCext_merchData\t\t\"setCext-merchData\"\n#define NID_setCext_merchData\t\t610\n#define OBJ_setCext_merchData\t\tOBJ_set_certExt,2L\n\n#define SN_setCext_cCertRequired\t\t\"setCext-cCertRequired\"\n#define NID_setCext_cCertRequired\t\t611\n#define OBJ_setCext_cCertRequired\t\tOBJ_set_certExt,3L\n\n#define SN_setCext_tunneling\t\t\"setCext-tunneling\"\n#define NID_setCext_tunneling\t\t612\n#define OBJ_setCext_tunneling\t\tOBJ_set_certExt,4L\n\n#define SN_setCext_setExt\t\t\"setCext-setExt\"\n#define NID_setCext_setExt\t\t613\n#define OBJ_setCext_setExt\t\tOBJ_set_certExt,5L\n\n#define SN_setCext_setQualf\t\t\"setCext-setQualf\"\n#define NID_setCext_setQualf\t\t614\n#define OBJ_setCext_setQualf\t\tOBJ_set_certExt,6L\n\n#define SN_setCext_PGWYcapabilities\t\t\"setCext-PGWYcapabilities\"\n#define NID_setCext_PGWYcapabilities\t\t615\n#define OBJ_setCext_PGWYcapabilities\t\tOBJ_set_certExt,7L\n\n#define SN_setCext_TokenIdentifier\t\t\"setCext-TokenIdentifier\"\n#define NID_setCext_TokenIdentifier\t\t616\n#define OBJ_setCext_TokenIdentifier\t\tOBJ_set_certExt,8L\n\n#define SN_setCext_Track2Data\t\t\"setCext-Track2Data\"\n#define NID_setCext_Track2Data\t\t617\n#define OBJ_setCext_Track2Data\t\tOBJ_set_certExt,9L\n\n#define SN_setCext_TokenType\t\t\"setCext-TokenType\"\n#define NID_setCext_TokenType\t\t618\n#define OBJ_setCext_TokenType\t\tOBJ_set_certExt,10L\n\n#define SN_setCext_IssuerCapabilities\t\t\"setCext-IssuerCapabilities\"\n#define NID_setCext_IssuerCapabilities\t\t619\n#define OBJ_setCext_IssuerCapabilities\t\tOBJ_set_certExt,11L\n\n#define SN_setAttr_Cert\t\t\"setAttr-Cert\"\n#define NID_setAttr_Cert\t\t620\n#define OBJ_setAttr_Cert\t\tOBJ_set_attr,0L\n\n#define SN_setAttr_PGWYcap\t\t\"setAttr-PGWYcap\"\n#define LN_setAttr_PGWYcap\t\t\"payment gateway capabilities\"\n#define NID_setAttr_PGWYcap\t\t621\n#define OBJ_setAttr_PGWYcap\t\tOBJ_set_attr,1L\n\n#define SN_setAttr_TokenType\t\t\"setAttr-TokenType\"\n#define NID_setAttr_TokenType\t\t622\n#define OBJ_setAttr_TokenType\t\tOBJ_set_attr,2L\n\n#define SN_setAttr_IssCap\t\t\"setAttr-IssCap\"\n#define LN_setAttr_IssCap\t\t\"issuer capabilities\"\n#define NID_setAttr_IssCap\t\t623\n#define OBJ_setAttr_IssCap\t\tOBJ_set_attr,3L\n\n#define SN_set_rootKeyThumb\t\t\"set-rootKeyThumb\"\n#define NID_set_rootKeyThumb\t\t624\n#define OBJ_set_rootKeyThumb\t\tOBJ_setAttr_Cert,0L\n\n#define SN_set_addPolicy\t\t\"set-addPolicy\"\n#define NID_set_addPolicy\t\t625\n#define OBJ_set_addPolicy\t\tOBJ_setAttr_Cert,1L\n\n#define SN_setAttr_Token_EMV\t\t\"setAttr-Token-EMV\"\n#define NID_setAttr_Token_EMV\t\t626\n#define OBJ_setAttr_Token_EMV\t\tOBJ_setAttr_TokenType,1L\n\n#define SN_setAttr_Token_B0Prime\t\t\"setAttr-Token-B0Prime\"\n#define NID_setAttr_Token_B0Prime\t\t627\n#define OBJ_setAttr_Token_B0Prime\t\tOBJ_setAttr_TokenType,2L\n\n#define SN_setAttr_IssCap_CVM\t\t\"setAttr-IssCap-CVM\"\n#define NID_setAttr_IssCap_CVM\t\t628\n#define OBJ_setAttr_IssCap_CVM\t\tOBJ_setAttr_IssCap,3L\n\n#define SN_setAttr_IssCap_T2\t\t\"setAttr-IssCap-T2\"\n#define NID_setAttr_IssCap_T2\t\t629\n#define OBJ_setAttr_IssCap_T2\t\tOBJ_setAttr_IssCap,4L\n\n#define SN_setAttr_IssCap_Sig\t\t\"setAttr-IssCap-Sig\"\n#define NID_setAttr_IssCap_Sig\t\t630\n#define OBJ_setAttr_IssCap_Sig\t\tOBJ_setAttr_IssCap,5L\n\n#define SN_setAttr_GenCryptgrm\t\t\"setAttr-GenCryptgrm\"\n#define LN_setAttr_GenCryptgrm\t\t\"generate cryptogram\"\n#define NID_setAttr_GenCryptgrm\t\t631\n#define OBJ_setAttr_GenCryptgrm\t\tOBJ_setAttr_IssCap_CVM,1L\n\n#define SN_setAttr_T2Enc\t\t\"setAttr-T2Enc\"\n#define LN_setAttr_T2Enc\t\t\"encrypted track 2\"\n#define NID_setAttr_T2Enc\t\t632\n#define OBJ_setAttr_T2Enc\t\tOBJ_setAttr_IssCap_T2,1L\n\n#define SN_setAttr_T2cleartxt\t\t\"setAttr-T2cleartxt\"\n#define LN_setAttr_T2cleartxt\t\t\"cleartext track 2\"\n#define NID_setAttr_T2cleartxt\t\t633\n#define OBJ_setAttr_T2cleartxt\t\tOBJ_setAttr_IssCap_T2,2L\n\n#define SN_setAttr_TokICCsig\t\t\"setAttr-TokICCsig\"\n#define LN_setAttr_TokICCsig\t\t\"ICC or token signature\"\n#define NID_setAttr_TokICCsig\t\t634\n#define OBJ_setAttr_TokICCsig\t\tOBJ_setAttr_IssCap_Sig,1L\n\n#define SN_setAttr_SecDevSig\t\t\"setAttr-SecDevSig\"\n#define LN_setAttr_SecDevSig\t\t\"secure device signature\"\n#define NID_setAttr_SecDevSig\t\t635\n#define OBJ_setAttr_SecDevSig\t\tOBJ_setAttr_IssCap_Sig,2L\n\n#define SN_set_brand_IATA_ATA\t\t\"set-brand-IATA-ATA\"\n#define NID_set_brand_IATA_ATA\t\t636\n#define OBJ_set_brand_IATA_ATA\t\tOBJ_set_brand,1L\n\n#define SN_set_brand_Diners\t\t\"set-brand-Diners\"\n#define NID_set_brand_Diners\t\t637\n#define OBJ_set_brand_Diners\t\tOBJ_set_brand,30L\n\n#define SN_set_brand_AmericanExpress\t\t\"set-brand-AmericanExpress\"\n#define NID_set_brand_AmericanExpress\t\t638\n#define OBJ_set_brand_AmericanExpress\t\tOBJ_set_brand,34L\n\n#define SN_set_brand_JCB\t\t\"set-brand-JCB\"\n#define NID_set_brand_JCB\t\t639\n#define OBJ_set_brand_JCB\t\tOBJ_set_brand,35L\n\n#define SN_set_brand_Visa\t\t\"set-brand-Visa\"\n#define NID_set_brand_Visa\t\t640\n#define OBJ_set_brand_Visa\t\tOBJ_set_brand,4L\n\n#define SN_set_brand_MasterCard\t\t\"set-brand-MasterCard\"\n#define NID_set_brand_MasterCard\t\t641\n#define OBJ_set_brand_MasterCard\t\tOBJ_set_brand,5L\n\n#define SN_set_brand_Novus\t\t\"set-brand-Novus\"\n#define NID_set_brand_Novus\t\t642\n#define OBJ_set_brand_Novus\t\tOBJ_set_brand,6011L\n\n#define SN_des_cdmf\t\t\"DES-CDMF\"\n#define LN_des_cdmf\t\t\"des-cdmf\"\n#define NID_des_cdmf\t\t643\n#define OBJ_des_cdmf\t\tOBJ_rsadsi,3L,10L\n\n#define SN_rsaOAEPEncryptionSET\t\t\"rsaOAEPEncryptionSET\"\n#define NID_rsaOAEPEncryptionSET\t\t644\n#define OBJ_rsaOAEPEncryptionSET\t\tOBJ_rsadsi,1L,1L,6L\n\n#define SN_ipsec3\t\t\"Oakley-EC2N-3\"\n#define LN_ipsec3\t\t\"ipsec3\"\n#define NID_ipsec3\t\t749\n\n#define SN_ipsec4\t\t\"Oakley-EC2N-4\"\n#define LN_ipsec4\t\t\"ipsec4\"\n#define NID_ipsec4\t\t750\n\n#define SN_whirlpool\t\t\"whirlpool\"\n#define NID_whirlpool\t\t804\n#define OBJ_whirlpool\t\tOBJ_iso,0L,10118L,3L,0L,55L\n\n#define SN_cryptopro\t\t\"cryptopro\"\n#define NID_cryptopro\t\t805\n#define OBJ_cryptopro\t\tOBJ_member_body,643L,2L,2L\n\n#define SN_cryptocom\t\t\"cryptocom\"\n#define NID_cryptocom\t\t806\n#define OBJ_cryptocom\t\tOBJ_member_body,643L,2L,9L\n\n#define SN_id_GostR3411_94_with_GostR3410_2001\t\t\"id-GostR3411-94-with-GostR3410-2001\"\n#define LN_id_GostR3411_94_with_GostR3410_2001\t\t\"GOST R 34.11-94 with GOST R 34.10-2001\"\n#define NID_id_GostR3411_94_with_GostR3410_2001\t\t807\n#define OBJ_id_GostR3411_94_with_GostR3410_2001\t\tOBJ_cryptopro,3L\n\n#define SN_id_GostR3411_94_with_GostR3410_94\t\t\"id-GostR3411-94-with-GostR3410-94\"\n#define LN_id_GostR3411_94_with_GostR3410_94\t\t\"GOST R 34.11-94 with GOST R 34.10-94\"\n#define NID_id_GostR3411_94_with_GostR3410_94\t\t808\n#define OBJ_id_GostR3411_94_with_GostR3410_94\t\tOBJ_cryptopro,4L\n\n#define SN_id_GostR3411_94\t\t\"md_gost94\"\n#define LN_id_GostR3411_94\t\t\"GOST R 34.11-94\"\n#define NID_id_GostR3411_94\t\t809\n#define OBJ_id_GostR3411_94\t\tOBJ_cryptopro,9L\n\n#define SN_id_HMACGostR3411_94\t\t\"id-HMACGostR3411-94\"\n#define LN_id_HMACGostR3411_94\t\t\"HMAC GOST 34.11-94\"\n#define NID_id_HMACGostR3411_94\t\t810\n#define OBJ_id_HMACGostR3411_94\t\tOBJ_cryptopro,10L\n\n#define SN_id_GostR3410_2001\t\t\"gost2001\"\n#define LN_id_GostR3410_2001\t\t\"GOST R 34.10-2001\"\n#define NID_id_GostR3410_2001\t\t811\n#define OBJ_id_GostR3410_2001\t\tOBJ_cryptopro,19L\n\n#define SN_id_GostR3410_94\t\t\"gost94\"\n#define LN_id_GostR3410_94\t\t\"GOST R 34.10-94\"\n#define NID_id_GostR3410_94\t\t812\n#define OBJ_id_GostR3410_94\t\tOBJ_cryptopro,20L\n\n#define SN_id_Gost28147_89\t\t\"gost89\"\n#define LN_id_Gost28147_89\t\t\"GOST 28147-89\"\n#define NID_id_Gost28147_89\t\t813\n#define OBJ_id_Gost28147_89\t\tOBJ_cryptopro,21L\n\n#define SN_gost89_cnt\t\t\"gost89-cnt\"\n#define NID_gost89_cnt\t\t814\n\n#define SN_id_Gost28147_89_MAC\t\t\"gost-mac\"\n#define LN_id_Gost28147_89_MAC\t\t\"GOST 28147-89 MAC\"\n#define NID_id_Gost28147_89_MAC\t\t815\n#define OBJ_id_Gost28147_89_MAC\t\tOBJ_cryptopro,22L\n\n#define SN_id_GostR3411_94_prf\t\t\"prf-gostr3411-94\"\n#define LN_id_GostR3411_94_prf\t\t\"GOST R 34.11-94 PRF\"\n#define NID_id_GostR3411_94_prf\t\t816\n#define OBJ_id_GostR3411_94_prf\t\tOBJ_cryptopro,23L\n\n#define SN_id_GostR3410_2001DH\t\t\"id-GostR3410-2001DH\"\n#define LN_id_GostR3410_2001DH\t\t\"GOST R 34.10-2001 DH\"\n#define NID_id_GostR3410_2001DH\t\t817\n#define OBJ_id_GostR3410_2001DH\t\tOBJ_cryptopro,98L\n\n#define SN_id_GostR3410_94DH\t\t\"id-GostR3410-94DH\"\n#define LN_id_GostR3410_94DH\t\t\"GOST R 34.10-94 DH\"\n#define NID_id_GostR3410_94DH\t\t818\n#define OBJ_id_GostR3410_94DH\t\tOBJ_cryptopro,99L\n\n#define SN_id_Gost28147_89_CryptoPro_KeyMeshing\t\t\"id-Gost28147-89-CryptoPro-KeyMeshing\"\n#define NID_id_Gost28147_89_CryptoPro_KeyMeshing\t\t819\n#define OBJ_id_Gost28147_89_CryptoPro_KeyMeshing\t\tOBJ_cryptopro,14L,1L\n\n#define SN_id_Gost28147_89_None_KeyMeshing\t\t\"id-Gost28147-89-None-KeyMeshing\"\n#define NID_id_Gost28147_89_None_KeyMeshing\t\t820\n#define OBJ_id_Gost28147_89_None_KeyMeshing\t\tOBJ_cryptopro,14L,0L\n\n#define SN_id_GostR3411_94_TestParamSet\t\t\"id-GostR3411-94-TestParamSet\"\n#define NID_id_GostR3411_94_TestParamSet\t\t821\n#define OBJ_id_GostR3411_94_TestParamSet\t\tOBJ_cryptopro,30L,0L\n\n#define SN_id_GostR3411_94_CryptoProParamSet\t\t\"id-GostR3411-94-CryptoProParamSet\"\n#define NID_id_GostR3411_94_CryptoProParamSet\t\t822\n#define OBJ_id_GostR3411_94_CryptoProParamSet\t\tOBJ_cryptopro,30L,1L\n\n#define SN_id_Gost28147_89_TestParamSet\t\t\"id-Gost28147-89-TestParamSet\"\n#define NID_id_Gost28147_89_TestParamSet\t\t823\n#define OBJ_id_Gost28147_89_TestParamSet\t\tOBJ_cryptopro,31L,0L\n\n#define SN_id_Gost28147_89_CryptoPro_A_ParamSet\t\t\"id-Gost28147-89-CryptoPro-A-ParamSet\"\n#define NID_id_Gost28147_89_CryptoPro_A_ParamSet\t\t824\n#define OBJ_id_Gost28147_89_CryptoPro_A_ParamSet\t\tOBJ_cryptopro,31L,1L\n\n#define SN_id_Gost28147_89_CryptoPro_B_ParamSet\t\t\"id-Gost28147-89-CryptoPro-B-ParamSet\"\n#define NID_id_Gost28147_89_CryptoPro_B_ParamSet\t\t825\n#define OBJ_id_Gost28147_89_CryptoPro_B_ParamSet\t\tOBJ_cryptopro,31L,2L\n\n#define SN_id_Gost28147_89_CryptoPro_C_ParamSet\t\t\"id-Gost28147-89-CryptoPro-C-ParamSet\"\n#define NID_id_Gost28147_89_CryptoPro_C_ParamSet\t\t826\n#define OBJ_id_Gost28147_89_CryptoPro_C_ParamSet\t\tOBJ_cryptopro,31L,3L\n\n#define SN_id_Gost28147_89_CryptoPro_D_ParamSet\t\t\"id-Gost28147-89-CryptoPro-D-ParamSet\"\n#define NID_id_Gost28147_89_CryptoPro_D_ParamSet\t\t827\n#define OBJ_id_Gost28147_89_CryptoPro_D_ParamSet\t\tOBJ_cryptopro,31L,4L\n\n#define SN_id_Gost28147_89_CryptoPro_Oscar_1_1_ParamSet\t\t\"id-Gost28147-89-CryptoPro-Oscar-1-1-ParamSet\"\n#define NID_id_Gost28147_89_CryptoPro_Oscar_1_1_ParamSet\t\t828\n#define OBJ_id_Gost28147_89_CryptoPro_Oscar_1_1_ParamSet\t\tOBJ_cryptopro,31L,5L\n\n#define SN_id_Gost28147_89_CryptoPro_Oscar_1_0_ParamSet\t\t\"id-Gost28147-89-CryptoPro-Oscar-1-0-ParamSet\"\n#define NID_id_Gost28147_89_CryptoPro_Oscar_1_0_ParamSet\t\t829\n#define OBJ_id_Gost28147_89_CryptoPro_Oscar_1_0_ParamSet\t\tOBJ_cryptopro,31L,6L\n\n#define SN_id_Gost28147_89_CryptoPro_RIC_1_ParamSet\t\t\"id-Gost28147-89-CryptoPro-RIC-1-ParamSet\"\n#define NID_id_Gost28147_89_CryptoPro_RIC_1_ParamSet\t\t830\n#define OBJ_id_Gost28147_89_CryptoPro_RIC_1_ParamSet\t\tOBJ_cryptopro,31L,7L\n\n#define SN_id_GostR3410_94_TestParamSet\t\t\"id-GostR3410-94-TestParamSet\"\n#define NID_id_GostR3410_94_TestParamSet\t\t831\n#define OBJ_id_GostR3410_94_TestParamSet\t\tOBJ_cryptopro,32L,0L\n\n#define SN_id_GostR3410_94_CryptoPro_A_ParamSet\t\t\"id-GostR3410-94-CryptoPro-A-ParamSet\"\n#define NID_id_GostR3410_94_CryptoPro_A_ParamSet\t\t832\n#define OBJ_id_GostR3410_94_CryptoPro_A_ParamSet\t\tOBJ_cryptopro,32L,2L\n\n#define SN_id_GostR3410_94_CryptoPro_B_ParamSet\t\t\"id-GostR3410-94-CryptoPro-B-ParamSet\"\n#define NID_id_GostR3410_94_CryptoPro_B_ParamSet\t\t833\n#define OBJ_id_GostR3410_94_CryptoPro_B_ParamSet\t\tOBJ_cryptopro,32L,3L\n\n#define SN_id_GostR3410_94_CryptoPro_C_ParamSet\t\t\"id-GostR3410-94-CryptoPro-C-ParamSet\"\n#define NID_id_GostR3410_94_CryptoPro_C_ParamSet\t\t834\n#define OBJ_id_GostR3410_94_CryptoPro_C_ParamSet\t\tOBJ_cryptopro,32L,4L\n\n#define SN_id_GostR3410_94_CryptoPro_D_ParamSet\t\t\"id-GostR3410-94-CryptoPro-D-ParamSet\"\n#define NID_id_GostR3410_94_CryptoPro_D_ParamSet\t\t835\n#define OBJ_id_GostR3410_94_CryptoPro_D_ParamSet\t\tOBJ_cryptopro,32L,5L\n\n#define SN_id_GostR3410_94_CryptoPro_XchA_ParamSet\t\t\"id-GostR3410-94-CryptoPro-XchA-ParamSet\"\n#define NID_id_GostR3410_94_CryptoPro_XchA_ParamSet\t\t836\n#define OBJ_id_GostR3410_94_CryptoPro_XchA_ParamSet\t\tOBJ_cryptopro,33L,1L\n\n#define SN_id_GostR3410_94_CryptoPro_XchB_ParamSet\t\t\"id-GostR3410-94-CryptoPro-XchB-ParamSet\"\n#define NID_id_GostR3410_94_CryptoPro_XchB_ParamSet\t\t837\n#define OBJ_id_GostR3410_94_CryptoPro_XchB_ParamSet\t\tOBJ_cryptopro,33L,2L\n\n#define SN_id_GostR3410_94_CryptoPro_XchC_ParamSet\t\t\"id-GostR3410-94-CryptoPro-XchC-ParamSet\"\n#define NID_id_GostR3410_94_CryptoPro_XchC_ParamSet\t\t838\n#define OBJ_id_GostR3410_94_CryptoPro_XchC_ParamSet\t\tOBJ_cryptopro,33L,3L\n\n#define SN_id_GostR3410_2001_TestParamSet\t\t\"id-GostR3410-2001-TestParamSet\"\n#define NID_id_GostR3410_2001_TestParamSet\t\t839\n#define OBJ_id_GostR3410_2001_TestParamSet\t\tOBJ_cryptopro,35L,0L\n\n#define SN_id_GostR3410_2001_CryptoPro_A_ParamSet\t\t\"id-GostR3410-2001-CryptoPro-A-ParamSet\"\n#define NID_id_GostR3410_2001_CryptoPro_A_ParamSet\t\t840\n#define OBJ_id_GostR3410_2001_CryptoPro_A_ParamSet\t\tOBJ_cryptopro,35L,1L\n\n#define SN_id_GostR3410_2001_CryptoPro_B_ParamSet\t\t\"id-GostR3410-2001-CryptoPro-B-ParamSet\"\n#define NID_id_GostR3410_2001_CryptoPro_B_ParamSet\t\t841\n#define OBJ_id_GostR3410_2001_CryptoPro_B_ParamSet\t\tOBJ_cryptopro,35L,2L\n\n#define SN_id_GostR3410_2001_CryptoPro_C_ParamSet\t\t\"id-GostR3410-2001-CryptoPro-C-ParamSet\"\n#define NID_id_GostR3410_2001_CryptoPro_C_ParamSet\t\t842\n#define OBJ_id_GostR3410_2001_CryptoPro_C_ParamSet\t\tOBJ_cryptopro,35L,3L\n\n#define SN_id_GostR3410_2001_CryptoPro_XchA_ParamSet\t\t\"id-GostR3410-2001-CryptoPro-XchA-ParamSet\"\n#define NID_id_GostR3410_2001_CryptoPro_XchA_ParamSet\t\t843\n#define OBJ_id_GostR3410_2001_CryptoPro_XchA_ParamSet\t\tOBJ_cryptopro,36L,0L\n\n#define SN_id_GostR3410_2001_CryptoPro_XchB_ParamSet\t\t\"id-GostR3410-2001-CryptoPro-XchB-ParamSet\"\n#define NID_id_GostR3410_2001_CryptoPro_XchB_ParamSet\t\t844\n#define OBJ_id_GostR3410_2001_CryptoPro_XchB_ParamSet\t\tOBJ_cryptopro,36L,1L\n\n#define SN_id_GostR3410_94_a\t\t\"id-GostR3410-94-a\"\n#define NID_id_GostR3410_94_a\t\t845\n#define OBJ_id_GostR3410_94_a\t\tOBJ_id_GostR3410_94,1L\n\n#define SN_id_GostR3410_94_aBis\t\t\"id-GostR3410-94-aBis\"\n#define NID_id_GostR3410_94_aBis\t\t846\n#define OBJ_id_GostR3410_94_aBis\t\tOBJ_id_GostR3410_94,2L\n\n#define SN_id_GostR3410_94_b\t\t\"id-GostR3410-94-b\"\n#define NID_id_GostR3410_94_b\t\t847\n#define OBJ_id_GostR3410_94_b\t\tOBJ_id_GostR3410_94,3L\n\n#define SN_id_GostR3410_94_bBis\t\t\"id-GostR3410-94-bBis\"\n#define NID_id_GostR3410_94_bBis\t\t848\n#define OBJ_id_GostR3410_94_bBis\t\tOBJ_id_GostR3410_94,4L\n\n#define SN_id_Gost28147_89_cc\t\t\"id-Gost28147-89-cc\"\n#define LN_id_Gost28147_89_cc\t\t\"GOST 28147-89 Cryptocom ParamSet\"\n#define NID_id_Gost28147_89_cc\t\t849\n#define OBJ_id_Gost28147_89_cc\t\tOBJ_cryptocom,1L,6L,1L\n\n#define SN_id_GostR3410_94_cc\t\t\"gost94cc\"\n#define LN_id_GostR3410_94_cc\t\t\"GOST 34.10-94 Cryptocom\"\n#define NID_id_GostR3410_94_cc\t\t850\n#define OBJ_id_GostR3410_94_cc\t\tOBJ_cryptocom,1L,5L,3L\n\n#define SN_id_GostR3410_2001_cc\t\t\"gost2001cc\"\n#define LN_id_GostR3410_2001_cc\t\t\"GOST 34.10-2001 Cryptocom\"\n#define NID_id_GostR3410_2001_cc\t\t851\n#define OBJ_id_GostR3410_2001_cc\t\tOBJ_cryptocom,1L,5L,4L\n\n#define SN_id_GostR3411_94_with_GostR3410_94_cc\t\t\"id-GostR3411-94-with-GostR3410-94-cc\"\n#define LN_id_GostR3411_94_with_GostR3410_94_cc\t\t\"GOST R 34.11-94 with GOST R 34.10-94 Cryptocom\"\n#define NID_id_GostR3411_94_with_GostR3410_94_cc\t\t852\n#define OBJ_id_GostR3411_94_with_GostR3410_94_cc\t\tOBJ_cryptocom,1L,3L,3L\n\n#define SN_id_GostR3411_94_with_GostR3410_2001_cc\t\t\"id-GostR3411-94-with-GostR3410-2001-cc\"\n#define LN_id_GostR3411_94_with_GostR3410_2001_cc\t\t\"GOST R 34.11-94 with GOST R 34.10-2001 Cryptocom\"\n#define NID_id_GostR3411_94_with_GostR3410_2001_cc\t\t853\n#define OBJ_id_GostR3411_94_with_GostR3410_2001_cc\t\tOBJ_cryptocom,1L,3L,4L\n\n#define SN_id_GostR3410_2001_ParamSet_cc\t\t\"id-GostR3410-2001-ParamSet-cc\"\n#define LN_id_GostR3410_2001_ParamSet_cc\t\t\"GOST R 3410-2001 Parameter Set Cryptocom\"\n#define NID_id_GostR3410_2001_ParamSet_cc\t\t854\n#define OBJ_id_GostR3410_2001_ParamSet_cc\t\tOBJ_cryptocom,1L,8L,1L\n\n#define SN_camellia_128_cbc\t\t\"CAMELLIA-128-CBC\"\n#define LN_camellia_128_cbc\t\t\"camellia-128-cbc\"\n#define NID_camellia_128_cbc\t\t751\n#define OBJ_camellia_128_cbc\t\t1L,2L,392L,200011L,61L,1L,1L,1L,2L\n\n#define SN_camellia_192_cbc\t\t\"CAMELLIA-192-CBC\"\n#define LN_camellia_192_cbc\t\t\"camellia-192-cbc\"\n#define NID_camellia_192_cbc\t\t752\n#define OBJ_camellia_192_cbc\t\t1L,2L,392L,200011L,61L,1L,1L,1L,3L\n\n#define SN_camellia_256_cbc\t\t\"CAMELLIA-256-CBC\"\n#define LN_camellia_256_cbc\t\t\"camellia-256-cbc\"\n#define NID_camellia_256_cbc\t\t753\n#define OBJ_camellia_256_cbc\t\t1L,2L,392L,200011L,61L,1L,1L,1L,4L\n\n#define OBJ_ntt_ds\t\t0L,3L,4401L,5L\n\n#define OBJ_camellia\t\tOBJ_ntt_ds,3L,1L,9L\n\n#define SN_camellia_128_ecb\t\t\"CAMELLIA-128-ECB\"\n#define LN_camellia_128_ecb\t\t\"camellia-128-ecb\"\n#define NID_camellia_128_ecb\t\t754\n#define OBJ_camellia_128_ecb\t\tOBJ_camellia,1L\n\n#define SN_camellia_128_ofb128\t\t\"CAMELLIA-128-OFB\"\n#define LN_camellia_128_ofb128\t\t\"camellia-128-ofb\"\n#define NID_camellia_128_ofb128\t\t766\n#define OBJ_camellia_128_ofb128\t\tOBJ_camellia,3L\n\n#define SN_camellia_128_cfb128\t\t\"CAMELLIA-128-CFB\"\n#define LN_camellia_128_cfb128\t\t\"camellia-128-cfb\"\n#define NID_camellia_128_cfb128\t\t757\n#define OBJ_camellia_128_cfb128\t\tOBJ_camellia,4L\n\n#define SN_camellia_192_ecb\t\t\"CAMELLIA-192-ECB\"\n#define LN_camellia_192_ecb\t\t\"camellia-192-ecb\"\n#define NID_camellia_192_ecb\t\t755\n#define OBJ_camellia_192_ecb\t\tOBJ_camellia,21L\n\n#define SN_camellia_192_ofb128\t\t\"CAMELLIA-192-OFB\"\n#define LN_camellia_192_ofb128\t\t\"camellia-192-ofb\"\n#define NID_camellia_192_ofb128\t\t767\n#define OBJ_camellia_192_ofb128\t\tOBJ_camellia,23L\n\n#define SN_camellia_192_cfb128\t\t\"CAMELLIA-192-CFB\"\n#define LN_camellia_192_cfb128\t\t\"camellia-192-cfb\"\n#define NID_camellia_192_cfb128\t\t758\n#define OBJ_camellia_192_cfb128\t\tOBJ_camellia,24L\n\n#define SN_camellia_256_ecb\t\t\"CAMELLIA-256-ECB\"\n#define LN_camellia_256_ecb\t\t\"camellia-256-ecb\"\n#define NID_camellia_256_ecb\t\t756\n#define OBJ_camellia_256_ecb\t\tOBJ_camellia,41L\n\n#define SN_camellia_256_ofb128\t\t\"CAMELLIA-256-OFB\"\n#define LN_camellia_256_ofb128\t\t\"camellia-256-ofb\"\n#define NID_camellia_256_ofb128\t\t768\n#define OBJ_camellia_256_ofb128\t\tOBJ_camellia,43L\n\n#define SN_camellia_256_cfb128\t\t\"CAMELLIA-256-CFB\"\n#define LN_camellia_256_cfb128\t\t\"camellia-256-cfb\"\n#define NID_camellia_256_cfb128\t\t759\n#define OBJ_camellia_256_cfb128\t\tOBJ_camellia,44L\n\n#define SN_camellia_128_cfb1\t\t\"CAMELLIA-128-CFB1\"\n#define LN_camellia_128_cfb1\t\t\"camellia-128-cfb1\"\n#define NID_camellia_128_cfb1\t\t760\n\n#define SN_camellia_192_cfb1\t\t\"CAMELLIA-192-CFB1\"\n#define LN_camellia_192_cfb1\t\t\"camellia-192-cfb1\"\n#define NID_camellia_192_cfb1\t\t761\n\n#define SN_camellia_256_cfb1\t\t\"CAMELLIA-256-CFB1\"\n#define LN_camellia_256_cfb1\t\t\"camellia-256-cfb1\"\n#define NID_camellia_256_cfb1\t\t762\n\n#define SN_camellia_128_cfb8\t\t\"CAMELLIA-128-CFB8\"\n#define LN_camellia_128_cfb8\t\t\"camellia-128-cfb8\"\n#define NID_camellia_128_cfb8\t\t763\n\n#define SN_camellia_192_cfb8\t\t\"CAMELLIA-192-CFB8\"\n#define LN_camellia_192_cfb8\t\t\"camellia-192-cfb8\"\n#define NID_camellia_192_cfb8\t\t764\n\n#define SN_camellia_256_cfb8\t\t\"CAMELLIA-256-CFB8\"\n#define LN_camellia_256_cfb8\t\t\"camellia-256-cfb8\"\n#define NID_camellia_256_cfb8\t\t765\n\n#define SN_kisa\t\t\"KISA\"\n#define LN_kisa\t\t\"kisa\"\n#define NID_kisa\t\t773\n#define OBJ_kisa\t\tOBJ_member_body,410L,200004L\n\n#define SN_seed_ecb\t\t\"SEED-ECB\"\n#define LN_seed_ecb\t\t\"seed-ecb\"\n#define NID_seed_ecb\t\t776\n#define OBJ_seed_ecb\t\tOBJ_kisa,1L,3L\n\n#define SN_seed_cbc\t\t\"SEED-CBC\"\n#define LN_seed_cbc\t\t\"seed-cbc\"\n#define NID_seed_cbc\t\t777\n#define OBJ_seed_cbc\t\tOBJ_kisa,1L,4L\n\n#define SN_seed_cfb128\t\t\"SEED-CFB\"\n#define LN_seed_cfb128\t\t\"seed-cfb\"\n#define NID_seed_cfb128\t\t779\n#define OBJ_seed_cfb128\t\tOBJ_kisa,1L,5L\n\n#define SN_seed_ofb128\t\t\"SEED-OFB\"\n#define LN_seed_ofb128\t\t\"seed-ofb\"\n#define NID_seed_ofb128\t\t778\n#define OBJ_seed_ofb128\t\tOBJ_kisa,1L,6L\n\n#define SN_hmac\t\t\"HMAC\"\n#define LN_hmac\t\t\"hmac\"\n#define NID_hmac\t\t855\n\n"
  },
  {
    "path": "freebsd-headers/openssl/objects.h",
    "content": "/* crypto/objects/objects.h */\n/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)\n * All rights reserved.\n *\n * This package is an SSL implementation written\n * by Eric Young (eay@cryptsoft.com).\n * The implementation was written so as to conform with Netscapes SSL.\n * \n * This library is free for commercial and non-commercial use as long as\n * the following conditions are aheared to.  The following conditions\n * apply to all code found in this distribution, be it the RC4, RSA,\n * lhash, DES, etc., code; not just the SSL code.  The SSL documentation\n * included with this distribution is covered by the same copyright terms\n * except that the holder is Tim Hudson (tjh@cryptsoft.com).\n * \n * Copyright remains Eric Young's, and as such any Copyright notices in\n * the code are not to be removed.\n * If this package is used in a product, Eric Young should be given attribution\n * as the author of the parts of the library used.\n * This can be in the form of a textual message at program startup or\n * in documentation (online or textual) provided with the package.\n * \n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. All advertising materials mentioning features or use of this software\n *    must display the following acknowledgement:\n *    \"This product includes cryptographic software written by\n *     Eric Young (eay@cryptsoft.com)\"\n *    The word 'cryptographic' can be left out if the rouines from the library\n *    being used are not cryptographic related :-).\n * 4. If you include any Windows specific code (or a derivative thereof) from \n *    the apps directory (application code) you must include an acknowledgement:\n *    \"This product includes software written by Tim Hudson (tjh@cryptsoft.com)\"\n * \n * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n * \n * The licence and distribution terms for any publically available version or\n * derivative of this code cannot be changed.  i.e. this code cannot simply be\n * copied and put under another distribution licence\n * [including the GNU Public Licence.]\n */\n\n#ifndef HEADER_OBJECTS_H\n#define HEADER_OBJECTS_H\n\n#define USE_OBJ_MAC\n\n#ifdef USE_OBJ_MAC\n#include <openssl/obj_mac.h>\n#else\n#define SN_undef\t\t\t\"UNDEF\"\n#define LN_undef\t\t\t\"undefined\"\n#define NID_undef\t\t\t0\n#define OBJ_undef\t\t\t0L\n\n#define SN_Algorithm\t\t\t\"Algorithm\"\n#define LN_algorithm\t\t\t\"algorithm\"\n#define NID_algorithm\t\t\t38\n#define OBJ_algorithm\t\t\t1L,3L,14L,3L,2L\n\n#define LN_rsadsi\t\t\t\"rsadsi\"\n#define NID_rsadsi\t\t\t1\n#define OBJ_rsadsi\t\t\t1L,2L,840L,113549L\n\n#define LN_pkcs\t\t\t\t\"pkcs\"\n#define NID_pkcs\t\t\t2\n#define OBJ_pkcs\t\t\tOBJ_rsadsi,1L\n\n#define SN_md2\t\t\t\t\"MD2\"\n#define LN_md2\t\t\t\t\"md2\"\n#define NID_md2\t\t\t\t3\n#define OBJ_md2\t\t\t\tOBJ_rsadsi,2L,2L\n\n#define SN_md5\t\t\t\t\"MD5\"\n#define LN_md5\t\t\t\t\"md5\"\n#define NID_md5\t\t\t\t4\n#define OBJ_md5\t\t\t\tOBJ_rsadsi,2L,5L\n\n#define SN_rc4\t\t\t\t\"RC4\"\n#define LN_rc4\t\t\t\t\"rc4\"\n#define NID_rc4\t\t\t\t5\n#define OBJ_rc4\t\t\t\tOBJ_rsadsi,3L,4L\n\n#define LN_rsaEncryption\t\t\"rsaEncryption\"\n#define NID_rsaEncryption\t\t6\n#define OBJ_rsaEncryption\t\tOBJ_pkcs,1L,1L\n\n#define SN_md2WithRSAEncryption\t\t\"RSA-MD2\"\n#define LN_md2WithRSAEncryption\t\t\"md2WithRSAEncryption\"\n#define NID_md2WithRSAEncryption\t7\n#define OBJ_md2WithRSAEncryption\tOBJ_pkcs,1L,2L\n\n#define SN_md5WithRSAEncryption\t\t\"RSA-MD5\"\n#define LN_md5WithRSAEncryption\t\t\"md5WithRSAEncryption\"\n#define NID_md5WithRSAEncryption\t8\n#define OBJ_md5WithRSAEncryption\tOBJ_pkcs,1L,4L\n\n#define SN_pbeWithMD2AndDES_CBC\t\t\"PBE-MD2-DES\"\n#define LN_pbeWithMD2AndDES_CBC\t\t\"pbeWithMD2AndDES-CBC\"\n#define NID_pbeWithMD2AndDES_CBC\t9\n#define OBJ_pbeWithMD2AndDES_CBC\tOBJ_pkcs,5L,1L\n\n#define SN_pbeWithMD5AndDES_CBC\t\t\"PBE-MD5-DES\"\n#define LN_pbeWithMD5AndDES_CBC\t\t\"pbeWithMD5AndDES-CBC\"\n#define NID_pbeWithMD5AndDES_CBC\t10\n#define OBJ_pbeWithMD5AndDES_CBC\tOBJ_pkcs,5L,3L\n\n#define LN_X500\t\t\t\t\"X500\"\n#define NID_X500\t\t\t11\n#define OBJ_X500\t\t\t2L,5L\n\n#define LN_X509\t\t\t\t\"X509\"\n#define NID_X509\t\t\t12\n#define OBJ_X509\t\t\tOBJ_X500,4L\n\n#define SN_commonName\t\t\t\"CN\"\n#define LN_commonName\t\t\t\"commonName\"\n#define NID_commonName\t\t\t13\n#define OBJ_commonName\t\t\tOBJ_X509,3L\n\n#define SN_countryName\t\t\t\"C\"\n#define LN_countryName\t\t\t\"countryName\"\n#define NID_countryName\t\t\t14\n#define OBJ_countryName\t\t\tOBJ_X509,6L\n\n#define SN_localityName\t\t\t\"L\"\n#define LN_localityName\t\t\t\"localityName\"\n#define NID_localityName\t\t15\n#define OBJ_localityName\t\tOBJ_X509,7L\n\n/* Postal Address? PA */\n\n/* should be \"ST\" (rfc1327) but MS uses 'S' */\n#define SN_stateOrProvinceName\t\t\"ST\"\n#define LN_stateOrProvinceName\t\t\"stateOrProvinceName\"\n#define NID_stateOrProvinceName\t\t16\n#define OBJ_stateOrProvinceName\t\tOBJ_X509,8L\n\n#define SN_organizationName\t\t\"O\"\n#define LN_organizationName\t\t\"organizationName\"\n#define NID_organizationName\t\t17\n#define OBJ_organizationName\t\tOBJ_X509,10L\n\n#define SN_organizationalUnitName\t\"OU\"\n#define LN_organizationalUnitName\t\"organizationalUnitName\"\n#define NID_organizationalUnitName\t18\n#define OBJ_organizationalUnitName\tOBJ_X509,11L\n\n#define SN_rsa\t\t\t\t\"RSA\"\n#define LN_rsa\t\t\t\t\"rsa\"\n#define NID_rsa\t\t\t\t19\n#define OBJ_rsa\t\t\t\tOBJ_X500,8L,1L,1L\n\n#define LN_pkcs7\t\t\t\"pkcs7\"\n#define NID_pkcs7\t\t\t20\n#define OBJ_pkcs7\t\t\tOBJ_pkcs,7L\n\n#define LN_pkcs7_data\t\t\t\"pkcs7-data\"\n#define NID_pkcs7_data\t\t\t21\n#define OBJ_pkcs7_data\t\t\tOBJ_pkcs7,1L\n\n#define LN_pkcs7_signed\t\t\t\"pkcs7-signedData\"\n#define NID_pkcs7_signed\t\t22\n#define OBJ_pkcs7_signed\t\tOBJ_pkcs7,2L\n\n#define LN_pkcs7_enveloped\t\t\"pkcs7-envelopedData\"\n#define NID_pkcs7_enveloped\t\t23\n#define OBJ_pkcs7_enveloped\t\tOBJ_pkcs7,3L\n\n#define LN_pkcs7_signedAndEnveloped\t\"pkcs7-signedAndEnvelopedData\"\n#define NID_pkcs7_signedAndEnveloped\t24\n#define OBJ_pkcs7_signedAndEnveloped\tOBJ_pkcs7,4L\n\n#define LN_pkcs7_digest\t\t\t\"pkcs7-digestData\"\n#define NID_pkcs7_digest\t\t25\n#define OBJ_pkcs7_digest\t\tOBJ_pkcs7,5L\n\n#define LN_pkcs7_encrypted\t\t\"pkcs7-encryptedData\"\n#define NID_pkcs7_encrypted\t\t26\n#define OBJ_pkcs7_encrypted\t\tOBJ_pkcs7,6L\n\n#define LN_pkcs3\t\t\t\"pkcs3\"\n#define NID_pkcs3\t\t\t27\n#define OBJ_pkcs3\t\t\tOBJ_pkcs,3L\n\n#define LN_dhKeyAgreement\t\t\"dhKeyAgreement\"\n#define NID_dhKeyAgreement\t\t28\n#define OBJ_dhKeyAgreement\t\tOBJ_pkcs3,1L\n\n#define SN_des_ecb\t\t\t\"DES-ECB\"\n#define LN_des_ecb\t\t\t\"des-ecb\"\n#define NID_des_ecb\t\t\t29\n#define OBJ_des_ecb\t\t\tOBJ_algorithm,6L\n\n#define SN_des_cfb64\t\t\t\"DES-CFB\"\n#define LN_des_cfb64\t\t\t\"des-cfb\"\n#define NID_des_cfb64\t\t\t30\n/* IV + num */\n#define OBJ_des_cfb64\t\t\tOBJ_algorithm,9L\n\n#define SN_des_cbc\t\t\t\"DES-CBC\"\n#define LN_des_cbc\t\t\t\"des-cbc\"\n#define NID_des_cbc\t\t\t31\n/* IV */\n#define OBJ_des_cbc\t\t\tOBJ_algorithm,7L\n\n#define SN_des_ede\t\t\t\"DES-EDE\"\n#define LN_des_ede\t\t\t\"des-ede\"\n#define NID_des_ede\t\t\t32\n/* ?? */\n#define OBJ_des_ede\t\t\tOBJ_algorithm,17L\n\n#define SN_des_ede3\t\t\t\"DES-EDE3\"\n#define LN_des_ede3\t\t\t\"des-ede3\"\n#define NID_des_ede3\t\t\t33\n\n#define SN_idea_cbc\t\t\t\"IDEA-CBC\"\n#define LN_idea_cbc\t\t\t\"idea-cbc\"\n#define NID_idea_cbc\t\t\t34\n#define OBJ_idea_cbc\t\t\t1L,3L,6L,1L,4L,1L,188L,7L,1L,1L,2L\n\n#define SN_idea_cfb64\t\t\t\"IDEA-CFB\"\n#define LN_idea_cfb64\t\t\t\"idea-cfb\"\n#define NID_idea_cfb64\t\t\t35\n\n#define SN_idea_ecb\t\t\t\"IDEA-ECB\"\n#define LN_idea_ecb\t\t\t\"idea-ecb\"\n#define NID_idea_ecb\t\t\t36\n\n#define SN_rc2_cbc\t\t\t\"RC2-CBC\"\n#define LN_rc2_cbc\t\t\t\"rc2-cbc\"\n#define NID_rc2_cbc\t\t\t37\n#define OBJ_rc2_cbc\t\t\tOBJ_rsadsi,3L,2L\n\n#define SN_rc2_ecb\t\t\t\"RC2-ECB\"\n#define LN_rc2_ecb\t\t\t\"rc2-ecb\"\n#define NID_rc2_ecb\t\t\t38\n\n#define SN_rc2_cfb64\t\t\t\"RC2-CFB\"\n#define LN_rc2_cfb64\t\t\t\"rc2-cfb\"\n#define NID_rc2_cfb64\t\t\t39\n\n#define SN_rc2_ofb64\t\t\t\"RC2-OFB\"\n#define LN_rc2_ofb64\t\t\t\"rc2-ofb\"\n#define NID_rc2_ofb64\t\t\t40\n\n#define SN_sha\t\t\t\t\"SHA\"\n#define LN_sha\t\t\t\t\"sha\"\n#define NID_sha\t\t\t\t41\n#define OBJ_sha\t\t\t\tOBJ_algorithm,18L\n\n#define SN_shaWithRSAEncryption\t\t\"RSA-SHA\"\n#define LN_shaWithRSAEncryption\t\t\"shaWithRSAEncryption\"\n#define NID_shaWithRSAEncryption\t42\n#define OBJ_shaWithRSAEncryption\tOBJ_algorithm,15L\n\n#define SN_des_ede_cbc\t\t\t\"DES-EDE-CBC\"\n#define LN_des_ede_cbc\t\t\t\"des-ede-cbc\"\n#define NID_des_ede_cbc\t\t\t43\n\n#define SN_des_ede3_cbc\t\t\t\"DES-EDE3-CBC\"\n#define LN_des_ede3_cbc\t\t\t\"des-ede3-cbc\"\n#define NID_des_ede3_cbc\t\t44\n#define OBJ_des_ede3_cbc\t\tOBJ_rsadsi,3L,7L\n\n#define SN_des_ofb64\t\t\t\"DES-OFB\"\n#define LN_des_ofb64\t\t\t\"des-ofb\"\n#define NID_des_ofb64\t\t\t45\n#define OBJ_des_ofb64\t\t\tOBJ_algorithm,8L\n\n#define SN_idea_ofb64\t\t\t\"IDEA-OFB\"\n#define LN_idea_ofb64\t\t\t\"idea-ofb\"\n#define NID_idea_ofb64\t\t\t46\n\n#define LN_pkcs9\t\t\t\"pkcs9\"\n#define NID_pkcs9\t\t\t47\n#define OBJ_pkcs9\t\t\tOBJ_pkcs,9L\n\n#define SN_pkcs9_emailAddress\t\t\"Email\"\n#define LN_pkcs9_emailAddress\t\t\"emailAddress\"\n#define NID_pkcs9_emailAddress\t\t48\n#define OBJ_pkcs9_emailAddress\t\tOBJ_pkcs9,1L\n\n#define LN_pkcs9_unstructuredName\t\"unstructuredName\"\n#define NID_pkcs9_unstructuredName\t49\n#define OBJ_pkcs9_unstructuredName\tOBJ_pkcs9,2L\n\n#define LN_pkcs9_contentType\t\t\"contentType\"\n#define NID_pkcs9_contentType\t\t50\n#define OBJ_pkcs9_contentType\t\tOBJ_pkcs9,3L\n\n#define LN_pkcs9_messageDigest\t\t\"messageDigest\"\n#define NID_pkcs9_messageDigest\t\t51\n#define OBJ_pkcs9_messageDigest\t\tOBJ_pkcs9,4L\n\n#define LN_pkcs9_signingTime\t\t\"signingTime\"\n#define NID_pkcs9_signingTime\t\t52\n#define OBJ_pkcs9_signingTime\t\tOBJ_pkcs9,5L\n\n#define LN_pkcs9_countersignature\t\"countersignature\"\n#define NID_pkcs9_countersignature\t53\n#define OBJ_pkcs9_countersignature\tOBJ_pkcs9,6L\n\n#define LN_pkcs9_challengePassword\t\"challengePassword\"\n#define NID_pkcs9_challengePassword\t54\n#define OBJ_pkcs9_challengePassword\tOBJ_pkcs9,7L\n\n#define LN_pkcs9_unstructuredAddress\t\"unstructuredAddress\"\n#define NID_pkcs9_unstructuredAddress\t55\n#define OBJ_pkcs9_unstructuredAddress\tOBJ_pkcs9,8L\n\n#define LN_pkcs9_extCertAttributes\t\"extendedCertificateAttributes\"\n#define NID_pkcs9_extCertAttributes\t56\n#define OBJ_pkcs9_extCertAttributes\tOBJ_pkcs9,9L\n\n#define SN_netscape\t\t\t\"Netscape\"\n#define LN_netscape\t\t\t\"Netscape Communications Corp.\"\n#define NID_netscape\t\t\t57\n#define OBJ_netscape\t\t\t2L,16L,840L,1L,113730L\n\n#define SN_netscape_cert_extension\t\"nsCertExt\"\n#define LN_netscape_cert_extension\t\"Netscape Certificate Extension\"\n#define NID_netscape_cert_extension\t58\n#define OBJ_netscape_cert_extension\tOBJ_netscape,1L\n\n#define SN_netscape_data_type\t\t\"nsDataType\"\n#define LN_netscape_data_type\t\t\"Netscape Data Type\"\n#define NID_netscape_data_type\t\t59\n#define OBJ_netscape_data_type\t\tOBJ_netscape,2L\n\n#define SN_des_ede_cfb64\t\t\"DES-EDE-CFB\"\n#define LN_des_ede_cfb64\t\t\"des-ede-cfb\"\n#define NID_des_ede_cfb64\t\t60\n\n#define SN_des_ede3_cfb64\t\t\"DES-EDE3-CFB\"\n#define LN_des_ede3_cfb64\t\t\"des-ede3-cfb\"\n#define NID_des_ede3_cfb64\t\t61\n\n#define SN_des_ede_ofb64\t\t\"DES-EDE-OFB\"\n#define LN_des_ede_ofb64\t\t\"des-ede-ofb\"\n#define NID_des_ede_ofb64\t\t62\n\n#define SN_des_ede3_ofb64\t\t\"DES-EDE3-OFB\"\n#define LN_des_ede3_ofb64\t\t\"des-ede3-ofb\"\n#define NID_des_ede3_ofb64\t\t63\n\n/* I'm not sure about the object ID */\n#define SN_sha1\t\t\t\t\"SHA1\"\n#define LN_sha1\t\t\t\t\"sha1\"\n#define NID_sha1\t\t\t64\n#define OBJ_sha1\t\t\tOBJ_algorithm,26L\n/* 28 Jun 1996 - eay */\n/* #define OBJ_sha1\t\t\t1L,3L,14L,2L,26L,05L <- wrong */\n\n#define SN_sha1WithRSAEncryption\t\"RSA-SHA1\"\n#define LN_sha1WithRSAEncryption\t\"sha1WithRSAEncryption\"\n#define NID_sha1WithRSAEncryption\t65\n#define OBJ_sha1WithRSAEncryption\tOBJ_pkcs,1L,5L\n\n#define SN_dsaWithSHA\t\t\t\"DSA-SHA\"\n#define LN_dsaWithSHA\t\t\t\"dsaWithSHA\"\n#define NID_dsaWithSHA\t\t\t66\n#define OBJ_dsaWithSHA\t\t\tOBJ_algorithm,13L\n\n#define SN_dsa_2\t\t\t\"DSA-old\"\n#define LN_dsa_2\t\t\t\"dsaEncryption-old\"\n#define NID_dsa_2\t\t\t67\n#define OBJ_dsa_2\t\t\tOBJ_algorithm,12L\n\n/* proposed by microsoft to RSA */\n#define SN_pbeWithSHA1AndRC2_CBC\t\"PBE-SHA1-RC2-64\"\n#define LN_pbeWithSHA1AndRC2_CBC\t\"pbeWithSHA1AndRC2-CBC\"\n#define NID_pbeWithSHA1AndRC2_CBC\t68\n#define OBJ_pbeWithSHA1AndRC2_CBC\tOBJ_pkcs,5L,11L \n\n/* proposed by microsoft to RSA as pbeWithSHA1AndRC4: it is now\n * defined explicitly in PKCS#5 v2.0 as id-PBKDF2 which is something\n * completely different.\n */\n#define LN_id_pbkdf2\t\t\t\"PBKDF2\"\n#define NID_id_pbkdf2\t\t\t69\n#define OBJ_id_pbkdf2\t\t\tOBJ_pkcs,5L,12L \n\n#define SN_dsaWithSHA1_2\t\t\"DSA-SHA1-old\"\n#define LN_dsaWithSHA1_2\t\t\"dsaWithSHA1-old\"\n#define NID_dsaWithSHA1_2\t\t70\n/* Got this one from 'sdn706r20.pdf' which is actually an NSA document :-) */\n#define OBJ_dsaWithSHA1_2\t\tOBJ_algorithm,27L\n\n#define SN_netscape_cert_type\t\t\"nsCertType\"\n#define LN_netscape_cert_type\t\t\"Netscape Cert Type\"\n#define NID_netscape_cert_type\t\t71\n#define OBJ_netscape_cert_type\t\tOBJ_netscape_cert_extension,1L\n\n#define SN_netscape_base_url\t\t\"nsBaseUrl\"\n#define LN_netscape_base_url\t\t\"Netscape Base Url\"\n#define NID_netscape_base_url\t\t72\n#define OBJ_netscape_base_url\t\tOBJ_netscape_cert_extension,2L\n\n#define SN_netscape_revocation_url\t\"nsRevocationUrl\"\n#define LN_netscape_revocation_url\t\"Netscape Revocation Url\"\n#define NID_netscape_revocation_url\t73\n#define OBJ_netscape_revocation_url\tOBJ_netscape_cert_extension,3L\n\n#define SN_netscape_ca_revocation_url\t\"nsCaRevocationUrl\"\n#define LN_netscape_ca_revocation_url\t\"Netscape CA Revocation Url\"\n#define NID_netscape_ca_revocation_url\t74\n#define OBJ_netscape_ca_revocation_url\tOBJ_netscape_cert_extension,4L\n\n#define SN_netscape_renewal_url\t\t\"nsRenewalUrl\"\n#define LN_netscape_renewal_url\t\t\"Netscape Renewal Url\"\n#define NID_netscape_renewal_url\t75\n#define OBJ_netscape_renewal_url\tOBJ_netscape_cert_extension,7L\n\n#define SN_netscape_ca_policy_url\t\"nsCaPolicyUrl\"\n#define LN_netscape_ca_policy_url\t\"Netscape CA Policy Url\"\n#define NID_netscape_ca_policy_url\t76\n#define OBJ_netscape_ca_policy_url\tOBJ_netscape_cert_extension,8L\n\n#define SN_netscape_ssl_server_name\t\"nsSslServerName\"\n#define LN_netscape_ssl_server_name\t\"Netscape SSL Server Name\"\n#define NID_netscape_ssl_server_name\t77\n#define OBJ_netscape_ssl_server_name\tOBJ_netscape_cert_extension,12L\n\n#define SN_netscape_comment\t\t\"nsComment\"\n#define LN_netscape_comment\t\t\"Netscape Comment\"\n#define NID_netscape_comment\t\t78\n#define OBJ_netscape_comment\t\tOBJ_netscape_cert_extension,13L\n\n#define SN_netscape_cert_sequence\t\"nsCertSequence\"\n#define LN_netscape_cert_sequence\t\"Netscape Certificate Sequence\"\n#define NID_netscape_cert_sequence\t79\n#define OBJ_netscape_cert_sequence\tOBJ_netscape_data_type,5L\n\n#define SN_desx_cbc\t\t\t\"DESX-CBC\"\n#define LN_desx_cbc\t\t\t\"desx-cbc\"\n#define NID_desx_cbc\t\t\t80\n\n#define SN_id_ce\t\t\t\"id-ce\"\n#define NID_id_ce\t\t\t81\n#define OBJ_id_ce\t\t\t2L,5L,29L\n\n#define SN_subject_key_identifier\t\"subjectKeyIdentifier\"\n#define LN_subject_key_identifier\t\"X509v3 Subject Key Identifier\"\n#define NID_subject_key_identifier\t82\n#define OBJ_subject_key_identifier\tOBJ_id_ce,14L\n\n#define SN_key_usage\t\t\t\"keyUsage\"\n#define LN_key_usage\t\t\t\"X509v3 Key Usage\"\n#define NID_key_usage\t\t\t83\n#define OBJ_key_usage\t\t\tOBJ_id_ce,15L\n\n#define SN_private_key_usage_period\t\"privateKeyUsagePeriod\"\n#define LN_private_key_usage_period\t\"X509v3 Private Key Usage Period\"\n#define NID_private_key_usage_period\t84\n#define OBJ_private_key_usage_period\tOBJ_id_ce,16L\n\n#define SN_subject_alt_name\t\t\"subjectAltName\"\n#define LN_subject_alt_name\t\t\"X509v3 Subject Alternative Name\"\n#define NID_subject_alt_name\t\t85\n#define OBJ_subject_alt_name\t\tOBJ_id_ce,17L\n\n#define SN_issuer_alt_name\t\t\"issuerAltName\"\n#define LN_issuer_alt_name\t\t\"X509v3 Issuer Alternative Name\"\n#define NID_issuer_alt_name\t\t86\n#define OBJ_issuer_alt_name\t\tOBJ_id_ce,18L\n\n#define SN_basic_constraints\t\t\"basicConstraints\"\n#define LN_basic_constraints\t\t\"X509v3 Basic Constraints\"\n#define NID_basic_constraints\t\t87\n#define OBJ_basic_constraints\t\tOBJ_id_ce,19L\n\n#define SN_crl_number\t\t\t\"crlNumber\"\n#define LN_crl_number\t\t\t\"X509v3 CRL Number\"\n#define NID_crl_number\t\t\t88\n#define OBJ_crl_number\t\t\tOBJ_id_ce,20L\n\n#define SN_certificate_policies\t\t\"certificatePolicies\"\n#define LN_certificate_policies\t\t\"X509v3 Certificate Policies\"\n#define NID_certificate_policies\t89\n#define OBJ_certificate_policies\tOBJ_id_ce,32L\n\n#define SN_authority_key_identifier\t\"authorityKeyIdentifier\"\n#define LN_authority_key_identifier\t\"X509v3 Authority Key Identifier\"\n#define NID_authority_key_identifier\t90\n#define OBJ_authority_key_identifier\tOBJ_id_ce,35L\n\n#define SN_bf_cbc\t\t\t\"BF-CBC\"\n#define LN_bf_cbc\t\t\t\"bf-cbc\"\n#define NID_bf_cbc\t\t\t91\n#define OBJ_bf_cbc\t\t\t1L,3L,6L,1L,4L,1L,3029L,1L,2L\n\n#define SN_bf_ecb\t\t\t\"BF-ECB\"\n#define LN_bf_ecb\t\t\t\"bf-ecb\"\n#define NID_bf_ecb\t\t\t92\n\n#define SN_bf_cfb64\t\t\t\"BF-CFB\"\n#define LN_bf_cfb64\t\t\t\"bf-cfb\"\n#define NID_bf_cfb64\t\t\t93\n\n#define SN_bf_ofb64\t\t\t\"BF-OFB\"\n#define LN_bf_ofb64\t\t\t\"bf-ofb\"\n#define NID_bf_ofb64\t\t\t94\n\n#define SN_mdc2\t\t\t\t\"MDC2\"\n#define LN_mdc2\t\t\t\t\"mdc2\"\n#define NID_mdc2\t\t\t95\n#define OBJ_mdc2\t\t\t2L,5L,8L,3L,101L\n/* An alternative?\t\t\t1L,3L,14L,3L,2L,19L */\n\n#define SN_mdc2WithRSA\t\t\t\"RSA-MDC2\"\n#define LN_mdc2WithRSA\t\t\t\"mdc2withRSA\"\n#define NID_mdc2WithRSA\t\t\t96\n#define OBJ_mdc2WithRSA\t\t\t2L,5L,8L,3L,100L\n\n#define SN_rc4_40\t\t\t\"RC4-40\"\n#define LN_rc4_40\t\t\t\"rc4-40\"\n#define NID_rc4_40\t\t\t97\n\n#define SN_rc2_40_cbc\t\t\t\"RC2-40-CBC\"\n#define LN_rc2_40_cbc\t\t\t\"rc2-40-cbc\"\n#define NID_rc2_40_cbc\t\t\t98\n\n#define SN_givenName\t\t\t\"G\"\n#define LN_givenName\t\t\t\"givenName\"\n#define NID_givenName\t\t\t99\n#define OBJ_givenName\t\t\tOBJ_X509,42L\n\n#define SN_surname\t\t\t\"S\"\n#define LN_surname\t\t\t\"surname\"\n#define NID_surname\t\t\t100\n#define OBJ_surname\t\t\tOBJ_X509,4L\n\n#define SN_initials\t\t\t\"I\"\n#define LN_initials\t\t\t\"initials\"\n#define NID_initials\t\t\t101\n#define OBJ_initials\t\t\tOBJ_X509,43L\n\n#define SN_uniqueIdentifier\t\t\"UID\"\n#define LN_uniqueIdentifier\t\t\"uniqueIdentifier\"\n#define NID_uniqueIdentifier\t\t102\n#define OBJ_uniqueIdentifier\t\tOBJ_X509,45L\n\n#define SN_crl_distribution_points\t\"crlDistributionPoints\"\n#define LN_crl_distribution_points\t\"X509v3 CRL Distribution Points\"\n#define NID_crl_distribution_points\t103\n#define OBJ_crl_distribution_points\tOBJ_id_ce,31L\n\n#define SN_md5WithRSA\t\t\t\"RSA-NP-MD5\"\n#define LN_md5WithRSA\t\t\t\"md5WithRSA\"\n#define NID_md5WithRSA\t\t\t104\n#define OBJ_md5WithRSA\t\t\tOBJ_algorithm,3L\n\n#define SN_serialNumber\t\t\t\"SN\"\n#define LN_serialNumber\t\t\t\"serialNumber\"\n#define NID_serialNumber\t\t105\n#define OBJ_serialNumber\t\tOBJ_X509,5L\n\n#define SN_title\t\t\t\"T\"\n#define LN_title\t\t\t\"title\"\n#define NID_title\t\t\t106\n#define OBJ_title\t\t\tOBJ_X509,12L\n\n#define SN_description\t\t\t\"D\"\n#define LN_description\t\t\t\"description\"\n#define NID_description\t\t\t107\n#define OBJ_description\t\t\tOBJ_X509,13L\n\n/* CAST5 is CAST-128, I'm just sticking with the documentation */\n#define SN_cast5_cbc\t\t\t\"CAST5-CBC\"\n#define LN_cast5_cbc\t\t\t\"cast5-cbc\"\n#define NID_cast5_cbc\t\t\t108\n#define OBJ_cast5_cbc\t\t\t1L,2L,840L,113533L,7L,66L,10L\n\n#define SN_cast5_ecb\t\t\t\"CAST5-ECB\"\n#define LN_cast5_ecb\t\t\t\"cast5-ecb\"\n#define NID_cast5_ecb\t\t\t109\n\n#define SN_cast5_cfb64\t\t\t\"CAST5-CFB\"\n#define LN_cast5_cfb64\t\t\t\"cast5-cfb\"\n#define NID_cast5_cfb64\t\t\t110\n\n#define SN_cast5_ofb64\t\t\t\"CAST5-OFB\"\n#define LN_cast5_ofb64\t\t\t\"cast5-ofb\"\n#define NID_cast5_ofb64\t\t\t111\n\n#define LN_pbeWithMD5AndCast5_CBC\t\"pbeWithMD5AndCast5CBC\"\n#define NID_pbeWithMD5AndCast5_CBC\t112\n#define OBJ_pbeWithMD5AndCast5_CBC\t1L,2L,840L,113533L,7L,66L,12L\n\n/* This is one sun will soon be using :-(\n * id-dsa-with-sha1 ID  ::= {\n *   iso(1) member-body(2) us(840) x9-57 (10040) x9cm(4) 3 }\n */\n#define SN_dsaWithSHA1\t\t\t\"DSA-SHA1\"\n#define LN_dsaWithSHA1\t\t\t\"dsaWithSHA1\"\n#define NID_dsaWithSHA1\t\t\t113\n#define OBJ_dsaWithSHA1\t\t\t1L,2L,840L,10040L,4L,3L\n\n#define NID_md5_sha1\t\t\t114\n#define SN_md5_sha1\t\t\t\"MD5-SHA1\"\n#define LN_md5_sha1\t\t\t\"md5-sha1\"\n\n#define SN_sha1WithRSA\t\t\t\"RSA-SHA1-2\"\n#define LN_sha1WithRSA\t\t\t\"sha1WithRSA\"\n#define NID_sha1WithRSA\t\t\t115\n#define OBJ_sha1WithRSA\t\t\tOBJ_algorithm,29L\n\n#define SN_dsa\t\t\t\t\"DSA\"\n#define LN_dsa\t\t\t\t\"dsaEncryption\"\n#define NID_dsa\t\t\t\t116\n#define OBJ_dsa\t\t\t\t1L,2L,840L,10040L,4L,1L\n\n#define SN_ripemd160\t\t\t\"RIPEMD160\"\n#define LN_ripemd160\t\t\t\"ripemd160\"\n#define NID_ripemd160\t\t\t117\n#define OBJ_ripemd160\t\t\t1L,3L,36L,3L,2L,1L\n\n/* The name should actually be rsaSignatureWithripemd160, but I'm going\n * to continue using the convention I'm using with the other ciphers */\n#define SN_ripemd160WithRSA\t\t\"RSA-RIPEMD160\"\n#define LN_ripemd160WithRSA\t\t\"ripemd160WithRSA\"\n#define NID_ripemd160WithRSA\t\t119\n#define OBJ_ripemd160WithRSA\t\t1L,3L,36L,3L,3L,1L,2L\n\n/* Taken from rfc2040\n *  RC5_CBC_Parameters ::= SEQUENCE {\n *\tversion           INTEGER (v1_0(16)),\n *\trounds            INTEGER (8..127),\n *\tblockSizeInBits   INTEGER (64, 128),\n *\tiv                OCTET STRING OPTIONAL\n *\t}\n */\n#define SN_rc5_cbc\t\t\t\"RC5-CBC\"\n#define LN_rc5_cbc\t\t\t\"rc5-cbc\"\n#define NID_rc5_cbc\t\t\t120\n#define OBJ_rc5_cbc\t\t\tOBJ_rsadsi,3L,8L\n\n#define SN_rc5_ecb\t\t\t\"RC5-ECB\"\n#define LN_rc5_ecb\t\t\t\"rc5-ecb\"\n#define NID_rc5_ecb\t\t\t121\n\n#define SN_rc5_cfb64\t\t\t\"RC5-CFB\"\n#define LN_rc5_cfb64\t\t\t\"rc5-cfb\"\n#define NID_rc5_cfb64\t\t\t122\n\n#define SN_rc5_ofb64\t\t\t\"RC5-OFB\"\n#define LN_rc5_ofb64\t\t\t\"rc5-ofb\"\n#define NID_rc5_ofb64\t\t\t123\n\n#define SN_rle_compression\t\t\"RLE\"\n#define LN_rle_compression\t\t\"run length compression\"\n#define NID_rle_compression\t\t124\n#define OBJ_rle_compression\t\t1L,1L,1L,1L,666L,1L\n\n#define SN_zlib_compression\t\t\"ZLIB\"\n#define LN_zlib_compression\t\t\"zlib compression\"\n#define NID_zlib_compression\t\t125\n#define OBJ_zlib_compression\t\t1L,1L,1L,1L,666L,2L\n\n#define SN_ext_key_usage\t\t\"extendedKeyUsage\"\n#define LN_ext_key_usage\t\t\"X509v3 Extended Key Usage\"\n#define NID_ext_key_usage\t\t126\n#define OBJ_ext_key_usage\t\tOBJ_id_ce,37\n\n#define SN_id_pkix\t\t\t\"PKIX\"\n#define NID_id_pkix\t\t\t127\n#define OBJ_id_pkix\t\t\t1L,3L,6L,1L,5L,5L,7L\n\n#define SN_id_kp\t\t\t\"id-kp\"\n#define NID_id_kp\t\t\t128\n#define OBJ_id_kp\t\t\tOBJ_id_pkix,3L\n\n/* PKIX extended key usage OIDs */\n\n#define SN_server_auth\t\t\t\"serverAuth\"\n#define LN_server_auth\t\t\t\"TLS Web Server Authentication\"\n#define NID_server_auth\t\t\t129\n#define OBJ_server_auth\t\t\tOBJ_id_kp,1L\n\n#define SN_client_auth\t\t\t\"clientAuth\"\n#define LN_client_auth\t\t\t\"TLS Web Client Authentication\"\n#define NID_client_auth\t\t\t130\n#define OBJ_client_auth\t\t\tOBJ_id_kp,2L\n\n#define SN_code_sign\t\t\t\"codeSigning\"\n#define LN_code_sign\t\t\t\"Code Signing\"\n#define NID_code_sign\t\t\t131\n#define OBJ_code_sign\t\t\tOBJ_id_kp,3L\n\n#define SN_email_protect\t\t\"emailProtection\"\n#define LN_email_protect\t\t\"E-mail Protection\"\n#define NID_email_protect\t\t132\n#define OBJ_email_protect\t\tOBJ_id_kp,4L\n\n#define SN_time_stamp\t\t\t\"timeStamping\"\n#define LN_time_stamp\t\t\t\"Time Stamping\"\n#define NID_time_stamp\t\t\t133\n#define OBJ_time_stamp\t\t\tOBJ_id_kp,8L\n\n/* Additional extended key usage OIDs: Microsoft */\n\n#define SN_ms_code_ind\t\t\t\"msCodeInd\"\n#define LN_ms_code_ind\t\t\t\"Microsoft Individual Code Signing\"\n#define NID_ms_code_ind\t\t\t134\n#define OBJ_ms_code_ind\t\t\t1L,3L,6L,1L,4L,1L,311L,2L,1L,21L\n\n#define SN_ms_code_com\t\t\t\"msCodeCom\"\n#define LN_ms_code_com\t\t\t\"Microsoft Commercial Code Signing\"\n#define NID_ms_code_com\t\t\t135\n#define OBJ_ms_code_com\t\t\t1L,3L,6L,1L,4L,1L,311L,2L,1L,22L\n\n#define SN_ms_ctl_sign\t\t\t\"msCTLSign\"\n#define LN_ms_ctl_sign\t\t\t\"Microsoft Trust List Signing\"\n#define NID_ms_ctl_sign\t\t\t136\n#define OBJ_ms_ctl_sign\t\t\t1L,3L,6L,1L,4L,1L,311L,10L,3L,1L\n\n#define SN_ms_sgc\t\t\t\"msSGC\"\n#define LN_ms_sgc\t\t\t\"Microsoft Server Gated Crypto\"\n#define NID_ms_sgc\t\t\t137\n#define OBJ_ms_sgc\t\t\t1L,3L,6L,1L,4L,1L,311L,10L,3L,3L\n\n#define SN_ms_efs\t\t\t\"msEFS\"\n#define LN_ms_efs\t\t\t\"Microsoft Encrypted File System\"\n#define NID_ms_efs\t\t\t138\n#define OBJ_ms_efs\t\t\t1L,3L,6L,1L,4L,1L,311L,10L,3L,4L\n\n/* Additional usage: Netscape */\n\n#define SN_ns_sgc\t\t\t\"nsSGC\"\n#define LN_ns_sgc\t\t\t\"Netscape Server Gated Crypto\"\n#define NID_ns_sgc\t\t\t139\n#define OBJ_ns_sgc\t\t\tOBJ_netscape,4L,1L\n\n#define SN_delta_crl\t\t\t\"deltaCRL\"\n#define LN_delta_crl\t\t\t\"X509v3 Delta CRL Indicator\"\n#define NID_delta_crl\t\t\t140\n#define OBJ_delta_crl\t\t\tOBJ_id_ce,27L\n\n#define SN_crl_reason\t\t\t\"CRLReason\"\n#define LN_crl_reason\t\t\t\"CRL Reason Code\"\n#define NID_crl_reason\t\t\t141\n#define OBJ_crl_reason\t\t\tOBJ_id_ce,21L\n\n#define SN_invalidity_date\t\t\"invalidityDate\"\n#define LN_invalidity_date\t\t\"Invalidity Date\"\n#define NID_invalidity_date\t\t142\n#define OBJ_invalidity_date\t\tOBJ_id_ce,24L\n\n#define SN_sxnet\t\t\t\"SXNetID\"\n#define LN_sxnet\t\t\t\"Strong Extranet ID\"\n#define NID_sxnet\t\t\t143\n#define OBJ_sxnet\t\t\t1L,3L,101L,1L,4L,1L\n\n/* PKCS12 and related OBJECT IDENTIFIERS */\n\n#define OBJ_pkcs12\t\t\tOBJ_pkcs,12L\n#define OBJ_pkcs12_pbeids\t\tOBJ_pkcs12, 1\n\n#define SN_pbe_WithSHA1And128BitRC4\t\"PBE-SHA1-RC4-128\"\n#define LN_pbe_WithSHA1And128BitRC4\t\"pbeWithSHA1And128BitRC4\"\n#define NID_pbe_WithSHA1And128BitRC4\t144\n#define OBJ_pbe_WithSHA1And128BitRC4\tOBJ_pkcs12_pbeids, 1L\n\n#define SN_pbe_WithSHA1And40BitRC4\t\"PBE-SHA1-RC4-40\"\n#define LN_pbe_WithSHA1And40BitRC4\t\"pbeWithSHA1And40BitRC4\"\n#define NID_pbe_WithSHA1And40BitRC4\t145\n#define OBJ_pbe_WithSHA1And40BitRC4\tOBJ_pkcs12_pbeids, 2L\n\n#define SN_pbe_WithSHA1And3_Key_TripleDES_CBC\t\"PBE-SHA1-3DES\"\n#define LN_pbe_WithSHA1And3_Key_TripleDES_CBC\t\"pbeWithSHA1And3-KeyTripleDES-CBC\"\n#define NID_pbe_WithSHA1And3_Key_TripleDES_CBC\t146\n#define OBJ_pbe_WithSHA1And3_Key_TripleDES_CBC\tOBJ_pkcs12_pbeids, 3L\n\n#define SN_pbe_WithSHA1And2_Key_TripleDES_CBC\t\"PBE-SHA1-2DES\"\n#define LN_pbe_WithSHA1And2_Key_TripleDES_CBC\t\"pbeWithSHA1And2-KeyTripleDES-CBC\"\n#define NID_pbe_WithSHA1And2_Key_TripleDES_CBC\t147\n#define OBJ_pbe_WithSHA1And2_Key_TripleDES_CBC\tOBJ_pkcs12_pbeids, 4L\n\n#define SN_pbe_WithSHA1And128BitRC2_CBC\t\t\"PBE-SHA1-RC2-128\"\n#define LN_pbe_WithSHA1And128BitRC2_CBC\t\t\"pbeWithSHA1And128BitRC2-CBC\"\n#define NID_pbe_WithSHA1And128BitRC2_CBC\t148\n#define OBJ_pbe_WithSHA1And128BitRC2_CBC\tOBJ_pkcs12_pbeids, 5L\n\n#define SN_pbe_WithSHA1And40BitRC2_CBC\t\"PBE-SHA1-RC2-40\"\n#define LN_pbe_WithSHA1And40BitRC2_CBC\t\"pbeWithSHA1And40BitRC2-CBC\"\n#define NID_pbe_WithSHA1And40BitRC2_CBC\t149\n#define OBJ_pbe_WithSHA1And40BitRC2_CBC\tOBJ_pkcs12_pbeids, 6L\n\n#define OBJ_pkcs12_Version1\tOBJ_pkcs12, 10L\n\n#define OBJ_pkcs12_BagIds\tOBJ_pkcs12_Version1, 1L\n\n#define LN_keyBag\t\t\"keyBag\"\n#define NID_keyBag\t\t150\n#define OBJ_keyBag\t\tOBJ_pkcs12_BagIds, 1L\n\n#define LN_pkcs8ShroudedKeyBag\t\"pkcs8ShroudedKeyBag\"\n#define NID_pkcs8ShroudedKeyBag\t151\n#define OBJ_pkcs8ShroudedKeyBag\tOBJ_pkcs12_BagIds, 2L\n\n#define LN_certBag\t\t\"certBag\"\n#define NID_certBag\t\t152\n#define OBJ_certBag\t\tOBJ_pkcs12_BagIds, 3L\n\n#define LN_crlBag\t\t\"crlBag\"\n#define NID_crlBag\t\t153\n#define OBJ_crlBag\t\tOBJ_pkcs12_BagIds, 4L\n\n#define LN_secretBag\t\t\"secretBag\"\n#define NID_secretBag\t\t154\n#define OBJ_secretBag\t\tOBJ_pkcs12_BagIds, 5L\n\n#define LN_safeContentsBag\t\"safeContentsBag\"\n#define NID_safeContentsBag\t155\n#define OBJ_safeContentsBag\tOBJ_pkcs12_BagIds, 6L\n\n#define LN_friendlyName\t\t\"friendlyName\"\n#define\tNID_friendlyName\t156\n#define OBJ_friendlyName\tOBJ_pkcs9, 20L\n\n#define LN_localKeyID\t\t\"localKeyID\"\n#define\tNID_localKeyID\t\t157\n#define OBJ_localKeyID\t\tOBJ_pkcs9, 21L\n\n#define OBJ_certTypes\t\tOBJ_pkcs9, 22L\n\n#define LN_x509Certificate\t\"x509Certificate\"\n#define\tNID_x509Certificate\t158\n#define OBJ_x509Certificate\tOBJ_certTypes, 1L\n\n#define LN_sdsiCertificate\t\"sdsiCertificate\"\n#define\tNID_sdsiCertificate\t159\n#define OBJ_sdsiCertificate\tOBJ_certTypes, 2L\n\n#define OBJ_crlTypes\t\tOBJ_pkcs9, 23L\n\n#define LN_x509Crl\t\t\"x509Crl\"\n#define\tNID_x509Crl\t\t160\n#define OBJ_x509Crl\t\tOBJ_crlTypes, 1L\n\n/* PKCS#5 v2 OIDs */\n\n#define LN_pbes2\t\t\"PBES2\"\n#define NID_pbes2\t\t161\n#define OBJ_pbes2\t\tOBJ_pkcs,5L,13L\n\n#define LN_pbmac1\t\t\"PBMAC1\"\n#define NID_pbmac1\t\t162\n#define OBJ_pbmac1\t\tOBJ_pkcs,5L,14L\n\n#define LN_hmacWithSHA1\t\t\"hmacWithSHA1\"\n#define NID_hmacWithSHA1\t163\n#define OBJ_hmacWithSHA1\tOBJ_rsadsi,2L,7L\n\n/* Policy Qualifier Ids */\n\n#define LN_id_qt_cps\t\t\"Policy Qualifier CPS\"\n#define SN_id_qt_cps\t\t\"id-qt-cps\"\n#define NID_id_qt_cps\t\t164\n#define OBJ_id_qt_cps\t\tOBJ_id_pkix,2L,1L\n\n#define LN_id_qt_unotice\t\"Policy Qualifier User Notice\"\n#define SN_id_qt_unotice\t\"id-qt-unotice\"\n#define NID_id_qt_unotice\t165\n#define OBJ_id_qt_unotice\tOBJ_id_pkix,2L,2L\n\n#define SN_rc2_64_cbc\t\t\t\"RC2-64-CBC\"\n#define LN_rc2_64_cbc\t\t\t\"rc2-64-cbc\"\n#define NID_rc2_64_cbc\t\t\t166\n\n#define SN_SMIMECapabilities\t\t\"SMIME-CAPS\"\n#define LN_SMIMECapabilities\t\t\"S/MIME Capabilities\"\n#define NID_SMIMECapabilities\t\t167\n#define OBJ_SMIMECapabilities\t\tOBJ_pkcs9,15L\n\n#define SN_pbeWithMD2AndRC2_CBC\t\t\"PBE-MD2-RC2-64\"\n#define LN_pbeWithMD2AndRC2_CBC\t\t\"pbeWithMD2AndRC2-CBC\"\n#define NID_pbeWithMD2AndRC2_CBC\t168\n#define OBJ_pbeWithMD2AndRC2_CBC\tOBJ_pkcs,5L,4L\n\n#define SN_pbeWithMD5AndRC2_CBC\t\t\"PBE-MD5-RC2-64\"\n#define LN_pbeWithMD5AndRC2_CBC\t\t\"pbeWithMD5AndRC2-CBC\"\n#define NID_pbeWithMD5AndRC2_CBC\t169\n#define OBJ_pbeWithMD5AndRC2_CBC\tOBJ_pkcs,5L,6L\n\n#define SN_pbeWithSHA1AndDES_CBC\t\"PBE-SHA1-DES\"\n#define LN_pbeWithSHA1AndDES_CBC\t\"pbeWithSHA1AndDES-CBC\"\n#define NID_pbeWithSHA1AndDES_CBC\t170\n#define OBJ_pbeWithSHA1AndDES_CBC\tOBJ_pkcs,5L,10L\n\n/* Extension request OIDs */\n\n#define LN_ms_ext_req\t\t\t\"Microsoft Extension Request\"\n#define SN_ms_ext_req\t\t\t\"msExtReq\"\n#define NID_ms_ext_req\t\t\t171\n#define OBJ_ms_ext_req\t\t\t1L,3L,6L,1L,4L,1L,311L,2L,1L,14L\n\n#define LN_ext_req\t\t\t\"Extension Request\"\n#define SN_ext_req\t\t\t\"extReq\"\n#define NID_ext_req\t\t\t172\n#define OBJ_ext_req\t\t\tOBJ_pkcs9,14L\n\n#define SN_name\t\t\t\t\"name\"\n#define LN_name\t\t\t\t\"name\"\n#define NID_name\t\t\t173\n#define OBJ_name\t\t\tOBJ_X509,41L\n\n#define SN_dnQualifier\t\t\t\"dnQualifier\"\n#define LN_dnQualifier\t\t\t\"dnQualifier\"\n#define NID_dnQualifier\t\t\t174\n#define OBJ_dnQualifier\t\t\tOBJ_X509,46L\n\n#define SN_id_pe\t\t\t\"id-pe\"\n#define NID_id_pe\t\t\t175\n#define OBJ_id_pe\t\t\tOBJ_id_pkix,1L\n\n#define SN_id_ad\t\t\t\"id-ad\"\n#define NID_id_ad\t\t\t176\n#define OBJ_id_ad\t\t\tOBJ_id_pkix,48L\n\n#define SN_info_access\t\t\t\"authorityInfoAccess\"\n#define LN_info_access\t\t\t\"Authority Information Access\"\n#define NID_info_access\t\t\t177\n#define OBJ_info_access\t\t\tOBJ_id_pe,1L\n\n#define SN_ad_OCSP\t\t\t\"OCSP\"\n#define LN_ad_OCSP\t\t\t\"OCSP\"\n#define NID_ad_OCSP\t\t\t178\n#define OBJ_ad_OCSP\t\t\tOBJ_id_ad,1L\n\n#define SN_ad_ca_issuers\t\t\"caIssuers\"\n#define LN_ad_ca_issuers\t\t\"CA Issuers\"\n#define NID_ad_ca_issuers\t\t179\n#define OBJ_ad_ca_issuers\t\tOBJ_id_ad,2L\n\n#define SN_OCSP_sign\t\t\t\"OCSPSigning\"\n#define LN_OCSP_sign\t\t\t\"OCSP Signing\"\n#define NID_OCSP_sign\t\t\t180\n#define OBJ_OCSP_sign\t\t\tOBJ_id_kp,9L\n#endif /* USE_OBJ_MAC */\n\n#include <openssl/bio.h>\n#include <openssl/asn1.h>\n\n#define\tOBJ_NAME_TYPE_UNDEF\t\t0x00\n#define\tOBJ_NAME_TYPE_MD_METH\t\t0x01\n#define\tOBJ_NAME_TYPE_CIPHER_METH\t0x02\n#define\tOBJ_NAME_TYPE_PKEY_METH\t\t0x03\n#define\tOBJ_NAME_TYPE_COMP_METH\t\t0x04\n#define\tOBJ_NAME_TYPE_NUM\t\t0x05\n\n#define\tOBJ_NAME_ALIAS\t\t\t0x8000\n\n#define OBJ_BSEARCH_VALUE_ON_NOMATCH\t\t0x01\n#define OBJ_BSEARCH_FIRST_VALUE_ON_MATCH\t0x02\n\n\n#ifdef  __cplusplus\nextern \"C\" {\n#endif\n\ntypedef struct obj_name_st\n\t{\n\tint type;\n\tint alias;\n\tconst char *name;\n\tconst char *data;\n\t} OBJ_NAME;\n\n#define\t\tOBJ_create_and_add_object(a,b,c) OBJ_create(a,b,c)\n\n\nint OBJ_NAME_init(void);\nint OBJ_NAME_new_index(unsigned long (*hash_func)(const char *),\n\t\t       int (*cmp_func)(const char *, const char *),\n\t\t       void (*free_func)(const char *, int, const char *));\nconst char *OBJ_NAME_get(const char *name,int type);\nint OBJ_NAME_add(const char *name,int type,const char *data);\nint OBJ_NAME_remove(const char *name,int type);\nvoid OBJ_NAME_cleanup(int type); /* -1 for everything */\nvoid OBJ_NAME_do_all(int type,void (*fn)(const OBJ_NAME *,void *arg),\n\t\t     void *arg);\nvoid OBJ_NAME_do_all_sorted(int type,void (*fn)(const OBJ_NAME *,void *arg),\n\t\t\t    void *arg);\n\nASN1_OBJECT *\tOBJ_dup(const ASN1_OBJECT *o);\nASN1_OBJECT *\tOBJ_nid2obj(int n);\nconst char *\tOBJ_nid2ln(int n);\nconst char *\tOBJ_nid2sn(int n);\nint\t\tOBJ_obj2nid(const ASN1_OBJECT *o);\nASN1_OBJECT *\tOBJ_txt2obj(const char *s, int no_name);\nint\tOBJ_obj2txt(char *buf, int buf_len, const ASN1_OBJECT *a, int no_name);\nint\t\tOBJ_txt2nid(const char *s);\nint\t\tOBJ_ln2nid(const char *s);\nint\t\tOBJ_sn2nid(const char *s);\nint\t\tOBJ_cmp(const ASN1_OBJECT *a,const ASN1_OBJECT *b);\nconst char *\tOBJ_bsearch(const char *key,const char *base,int num,int size,\n\tint (*cmp)(const void *, const void *));\nconst char *\tOBJ_bsearch_ex(const char *key,const char *base,int num,\n\tint size, int (*cmp)(const void *, const void *), int flags);\n\nint\t\tOBJ_new_nid(int num);\nint\t\tOBJ_add_object(const ASN1_OBJECT *obj);\nint\t\tOBJ_create(const char *oid,const char *sn,const char *ln);\nvoid\t\tOBJ_cleanup(void );\nint\t\tOBJ_create_objects(BIO *in);\n\n/* BEGIN ERROR CODES */\n/* The following lines are auto generated by the script mkerr.pl. Any changes\n * made after this point may be overwritten when the script is next run.\n */\nvoid ERR_load_OBJ_strings(void);\n\n/* Error codes for the OBJ functions. */\n\n/* Function codes. */\n#define OBJ_F_OBJ_ADD_OBJECT\t\t\t\t 105\n#define OBJ_F_OBJ_CREATE\t\t\t\t 100\n#define OBJ_F_OBJ_DUP\t\t\t\t\t 101\n#define OBJ_F_OBJ_NAME_NEW_INDEX\t\t\t 106\n#define OBJ_F_OBJ_NID2LN\t\t\t\t 102\n#define OBJ_F_OBJ_NID2OBJ\t\t\t\t 103\n#define OBJ_F_OBJ_NID2SN\t\t\t\t 104\n\n/* Reason codes. */\n#define OBJ_R_MALLOC_FAILURE\t\t\t\t 100\n#define OBJ_R_UNKNOWN_NID\t\t\t\t 101\n\n#ifdef  __cplusplus\n}\n#endif\n#endif\n"
  },
  {
    "path": "freebsd-headers/openssl/ocsp.h",
    "content": "/* ocsp.h */\n/* Written by Tom Titchener <Tom_Titchener@groove.net> for the OpenSSL\n * project. */\n\n/* History:\n   This file was transfered to Richard Levitte from CertCo by Kathy\n   Weinhold in mid-spring 2000 to be included in OpenSSL or released\n   as a patch kit. */\n\n/* ====================================================================\n * Copyright (c) 1998-2000 The OpenSSL Project.  All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n *\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer. \n *\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in\n *    the documentation and/or other materials provided with the\n *    distribution.\n *\n * 3. All advertising materials mentioning features or use of this\n *    software must display the following acknowledgment:\n *    \"This product includes software developed by the OpenSSL Project\n *    for use in the OpenSSL Toolkit. (http://www.openssl.org/)\"\n *\n * 4. The names \"OpenSSL Toolkit\" and \"OpenSSL Project\" must not be used to\n *    endorse or promote products derived from this software without\n *    prior written permission. For written permission, please contact\n *    openssl-core@openssl.org.\n *\n * 5. Products derived from this software may not be called \"OpenSSL\"\n *    nor may \"OpenSSL\" appear in their names without prior written\n *    permission of the OpenSSL Project.\n *\n * 6. Redistributions of any form whatsoever must retain the following\n *    acknowledgment:\n *    \"This product includes software developed by the OpenSSL Project\n *    for use in the OpenSSL Toolkit (http://www.openssl.org/)\"\n *\n * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY\n * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\n * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE OpenSSL PROJECT OR\n * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\n * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,\n * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED\n * OF THE POSSIBILITY OF SUCH DAMAGE.\n * ====================================================================\n *\n * This product includes cryptographic software written by Eric Young\n * (eay@cryptsoft.com).  This product includes software written by Tim\n * Hudson (tjh@cryptsoft.com).\n *\n */\n\n#ifndef HEADER_OCSP_H\n#define HEADER_OCSP_H\n\n#include <openssl/x509.h>\n#include <openssl/x509v3.h>\n#include <openssl/safestack.h>\n\n#ifdef  __cplusplus\nextern \"C\" {\n#endif\n\n/* Various flags and values */\n\n#define OCSP_DEFAULT_NONCE_LENGTH\t16\n\n#define OCSP_NOCERTS\t\t\t0x1\n#define OCSP_NOINTERN\t\t\t0x2\n#define OCSP_NOSIGS\t\t\t0x4\n#define OCSP_NOCHAIN\t\t\t0x8\n#define OCSP_NOVERIFY\t\t\t0x10\n#define OCSP_NOEXPLICIT\t\t\t0x20\n#define OCSP_NOCASIGN\t\t\t0x40\n#define OCSP_NODELEGATED\t\t0x80\n#define OCSP_NOCHECKS\t\t\t0x100\n#define OCSP_TRUSTOTHER\t\t\t0x200\n#define OCSP_RESPID_KEY\t\t\t0x400\n#define OCSP_NOTIME\t\t\t0x800\n\n/*   CertID ::= SEQUENCE {\n *       hashAlgorithm            AlgorithmIdentifier,\n *       issuerNameHash     OCTET STRING, -- Hash of Issuer's DN\n *       issuerKeyHash      OCTET STRING, -- Hash of Issuers public key (excluding the tag & length fields)\n *       serialNumber       CertificateSerialNumber }\n */\ntypedef struct ocsp_cert_id_st\n\t{\n\tX509_ALGOR *hashAlgorithm;\n\tASN1_OCTET_STRING *issuerNameHash;\n\tASN1_OCTET_STRING *issuerKeyHash;\n\tASN1_INTEGER *serialNumber;\n\t} OCSP_CERTID;\n\nDECLARE_STACK_OF(OCSP_CERTID)\n\n/*   Request ::=     SEQUENCE {\n *       reqCert                    CertID,\n *       singleRequestExtensions    [0] EXPLICIT Extensions OPTIONAL }\n */\ntypedef struct ocsp_one_request_st\n\t{\n\tOCSP_CERTID *reqCert;\n\tSTACK_OF(X509_EXTENSION) *singleRequestExtensions;\n\t} OCSP_ONEREQ;\n\nDECLARE_STACK_OF(OCSP_ONEREQ)\nDECLARE_ASN1_SET_OF(OCSP_ONEREQ)\n\n\n/*   TBSRequest      ::=     SEQUENCE {\n *       version             [0] EXPLICIT Version DEFAULT v1,\n *       requestorName       [1] EXPLICIT GeneralName OPTIONAL,\n *       requestList             SEQUENCE OF Request,\n *       requestExtensions   [2] EXPLICIT Extensions OPTIONAL }\n */\ntypedef struct ocsp_req_info_st\n\t{\n\tASN1_INTEGER *version;\n\tGENERAL_NAME *requestorName;\n\tSTACK_OF(OCSP_ONEREQ) *requestList;\n\tSTACK_OF(X509_EXTENSION) *requestExtensions;\n\t} OCSP_REQINFO;\n\n/*   Signature       ::=     SEQUENCE {\n *       signatureAlgorithm   AlgorithmIdentifier,\n *       signature            BIT STRING,\n *       certs                [0] EXPLICIT SEQUENCE OF Certificate OPTIONAL }\n */\ntypedef struct ocsp_signature_st\n\t{\n\tX509_ALGOR *signatureAlgorithm;\n\tASN1_BIT_STRING *signature;\n\tSTACK_OF(X509) *certs;\n\t} OCSP_SIGNATURE;\n\n/*   OCSPRequest     ::=     SEQUENCE {\n *       tbsRequest                  TBSRequest,\n *       optionalSignature   [0]     EXPLICIT Signature OPTIONAL }\n */\ntypedef struct ocsp_request_st\n\t{\n\tOCSP_REQINFO *tbsRequest;\n\tOCSP_SIGNATURE *optionalSignature; /* OPTIONAL */\n\t} OCSP_REQUEST;\n\n/*   OCSPResponseStatus ::= ENUMERATED {\n *       successful            (0),      --Response has valid confirmations\n *       malformedRequest      (1),      --Illegal confirmation request\n *       internalError         (2),      --Internal error in issuer\n *       tryLater              (3),      --Try again later\n *                                       --(4) is not used\n *       sigRequired           (5),      --Must sign the request\n *       unauthorized          (6)       --Request unauthorized\n *   }\n */\n#define OCSP_RESPONSE_STATUS_SUCCESSFUL          0\n#define OCSP_RESPONSE_STATUS_MALFORMEDREQUEST     1\n#define OCSP_RESPONSE_STATUS_INTERNALERROR        2\n#define OCSP_RESPONSE_STATUS_TRYLATER             3\n#define OCSP_RESPONSE_STATUS_SIGREQUIRED          5\n#define OCSP_RESPONSE_STATUS_UNAUTHORIZED         6\n\n/*   ResponseBytes ::=       SEQUENCE {\n *       responseType   OBJECT IDENTIFIER,\n *       response       OCTET STRING }\n */\ntypedef struct ocsp_resp_bytes_st\n\t{\n\tASN1_OBJECT *responseType;\n\tASN1_OCTET_STRING *response;\n\t} OCSP_RESPBYTES;\n\n/*   OCSPResponse ::= SEQUENCE {\n *      responseStatus         OCSPResponseStatus,\n *      responseBytes          [0] EXPLICIT ResponseBytes OPTIONAL }\n */\nstruct ocsp_response_st\n\t{\n\tASN1_ENUMERATED *responseStatus;\n\tOCSP_RESPBYTES  *responseBytes;\n\t};\n\n/*   ResponderID ::= CHOICE {\n *      byName   [1] Name,\n *      byKey    [2] KeyHash }\n */\n#define V_OCSP_RESPID_NAME 0\n#define V_OCSP_RESPID_KEY  1\nstruct ocsp_responder_id_st\n\t{\n\tint type;\n\tunion   {\n\t\tX509_NAME* byName;\n        \tASN1_OCTET_STRING *byKey;\n\t\t} value;\n\t};\n\nDECLARE_STACK_OF(OCSP_RESPID)\nDECLARE_ASN1_FUNCTIONS(OCSP_RESPID)\n\n/*   KeyHash ::= OCTET STRING --SHA-1 hash of responder's public key\n *                            --(excluding the tag and length fields)\n */\n\n/*   RevokedInfo ::= SEQUENCE {\n *       revocationTime              GeneralizedTime,\n *       revocationReason    [0]     EXPLICIT CRLReason OPTIONAL }\n */\ntypedef struct ocsp_revoked_info_st\n\t{\n\tASN1_GENERALIZEDTIME *revocationTime;\n\tASN1_ENUMERATED *revocationReason;\n\t} OCSP_REVOKEDINFO;\n\n/*   CertStatus ::= CHOICE {\n *       good                [0]     IMPLICIT NULL,\n *       revoked             [1]     IMPLICIT RevokedInfo,\n *       unknown             [2]     IMPLICIT UnknownInfo }\n */\n#define V_OCSP_CERTSTATUS_GOOD    0\n#define V_OCSP_CERTSTATUS_REVOKED 1\n#define V_OCSP_CERTSTATUS_UNKNOWN 2\ntypedef struct ocsp_cert_status_st\n\t{\n\tint type;\n\tunion\t{\n\t\tASN1_NULL *good;\n\t\tOCSP_REVOKEDINFO *revoked;\n\t\tASN1_NULL *unknown;\n\t\t} value;\n\t} OCSP_CERTSTATUS;\n\n/*   SingleResponse ::= SEQUENCE {\n *      certID                       CertID,\n *      certStatus                   CertStatus,\n *      thisUpdate                   GeneralizedTime,\n *      nextUpdate           [0]     EXPLICIT GeneralizedTime OPTIONAL,\n *      singleExtensions     [1]     EXPLICIT Extensions OPTIONAL }\n */\ntypedef struct ocsp_single_response_st\n\t{\n\tOCSP_CERTID *certId;\n\tOCSP_CERTSTATUS *certStatus;\n\tASN1_GENERALIZEDTIME *thisUpdate;\n\tASN1_GENERALIZEDTIME *nextUpdate;\n\tSTACK_OF(X509_EXTENSION) *singleExtensions;\n\t} OCSP_SINGLERESP;\n\nDECLARE_STACK_OF(OCSP_SINGLERESP)\nDECLARE_ASN1_SET_OF(OCSP_SINGLERESP)\n\n/*   ResponseData ::= SEQUENCE {\n *      version              [0] EXPLICIT Version DEFAULT v1,\n *      responderID              ResponderID,\n *      producedAt               GeneralizedTime,\n *      responses                SEQUENCE OF SingleResponse,\n *      responseExtensions   [1] EXPLICIT Extensions OPTIONAL }\n */\ntypedef struct ocsp_response_data_st\n\t{\n\tASN1_INTEGER *version;\n\tOCSP_RESPID  *responderId;\n\tASN1_GENERALIZEDTIME *producedAt;\n\tSTACK_OF(OCSP_SINGLERESP) *responses;\n\tSTACK_OF(X509_EXTENSION) *responseExtensions;\n\t} OCSP_RESPDATA;\n\n/*   BasicOCSPResponse       ::= SEQUENCE {\n *      tbsResponseData      ResponseData,\n *      signatureAlgorithm   AlgorithmIdentifier,\n *      signature            BIT STRING,\n *      certs                [0] EXPLICIT SEQUENCE OF Certificate OPTIONAL }\n */\n  /* Note 1:\n     The value for \"signature\" is specified in the OCSP rfc2560 as follows:\n     \"The value for the signature SHALL be computed on the hash of the DER\n     encoding ResponseData.\"  This means that you must hash the DER-encoded\n     tbsResponseData, and then run it through a crypto-signing function, which\n     will (at least w/RSA) do a hash-'n'-private-encrypt operation.  This seems\n     a bit odd, but that's the spec.  Also note that the data structures do not\n     leave anywhere to independently specify the algorithm used for the initial\n     hash. So, we look at the signature-specification algorithm, and try to do\n     something intelligent.\t-- Kathy Weinhold, CertCo */\n  /* Note 2:\n     It seems that the mentioned passage from RFC 2560 (section 4.2.1) is open\n     for interpretation.  I've done tests against another responder, and found\n     that it doesn't do the double hashing that the RFC seems to say one\n     should.  Therefore, all relevant functions take a flag saying which\n     variant should be used.\t-- Richard Levitte, OpenSSL team and CeloCom */\ntypedef struct ocsp_basic_response_st\n\t{\n\tOCSP_RESPDATA *tbsResponseData;\n\tX509_ALGOR *signatureAlgorithm;\n\tASN1_BIT_STRING *signature;\n\tSTACK_OF(X509) *certs;\n\t} OCSP_BASICRESP;\n\n/*\n *   CRLReason ::= ENUMERATED {\n *        unspecified             (0),\n *        keyCompromise           (1),\n *        cACompromise            (2),\n *        affiliationChanged      (3),\n *        superseded              (4),\n *        cessationOfOperation    (5),\n *        certificateHold         (6),\n *        removeFromCRL           (8) }\n */\n#define OCSP_REVOKED_STATUS_NOSTATUS               -1\n#define OCSP_REVOKED_STATUS_UNSPECIFIED             0\n#define OCSP_REVOKED_STATUS_KEYCOMPROMISE           1\n#define OCSP_REVOKED_STATUS_CACOMPROMISE            2\n#define OCSP_REVOKED_STATUS_AFFILIATIONCHANGED      3\n#define OCSP_REVOKED_STATUS_SUPERSEDED              4\n#define OCSP_REVOKED_STATUS_CESSATIONOFOPERATION    5\n#define OCSP_REVOKED_STATUS_CERTIFICATEHOLD         6\n#define OCSP_REVOKED_STATUS_REMOVEFROMCRL           8\n\n/* CrlID ::= SEQUENCE {\n *     crlUrl               [0]     EXPLICIT IA5String OPTIONAL,\n *     crlNum               [1]     EXPLICIT INTEGER OPTIONAL,\n *     crlTime              [2]     EXPLICIT GeneralizedTime OPTIONAL }\n */\ntypedef struct ocsp_crl_id_st\n        {\n\tASN1_IA5STRING *crlUrl;\n\tASN1_INTEGER *crlNum;\n\tASN1_GENERALIZEDTIME *crlTime;\n        } OCSP_CRLID;\n\n/* ServiceLocator ::= SEQUENCE {\n *      issuer    Name,\n *      locator   AuthorityInfoAccessSyntax OPTIONAL }\n */\ntypedef struct ocsp_service_locator_st\n        {\n\tX509_NAME* issuer;\n\tSTACK_OF(ACCESS_DESCRIPTION) *locator;\n        } OCSP_SERVICELOC;\n \n#define PEM_STRING_OCSP_REQUEST\t\"OCSP REQUEST\"\n#define PEM_STRING_OCSP_RESPONSE \"OCSP RESPONSE\"\n\n#define d2i_OCSP_REQUEST_bio(bp,p) ASN1_d2i_bio_of(OCSP_REQUEST,OCSP_REQUEST_new,d2i_OCSP_REQUEST,bp,p)\n\n#define d2i_OCSP_RESPONSE_bio(bp,p) ASN1_d2i_bio_of(OCSP_RESPONSE,OCSP_RESPONSE_new,d2i_OCSP_RESPONSE,bp,p)\n\n#define\tPEM_read_bio_OCSP_REQUEST(bp,x,cb) (OCSP_REQUEST *)PEM_ASN1_read_bio( \\\n     (char *(*)())d2i_OCSP_REQUEST,PEM_STRING_OCSP_REQUEST,bp,(char **)x,cb,NULL)\n\n#define\tPEM_read_bio_OCSP_RESPONSE(bp,x,cb)(OCSP_RESPONSE *)PEM_ASN1_read_bio(\\\n     (char *(*)())d2i_OCSP_RESPONSE,PEM_STRING_OCSP_RESPONSE,bp,(char **)x,cb,NULL)\n\n#define PEM_write_bio_OCSP_REQUEST(bp,o) \\\n    PEM_ASN1_write_bio((int (*)())i2d_OCSP_REQUEST,PEM_STRING_OCSP_REQUEST,\\\n\t\t\tbp,(char *)o, NULL,NULL,0,NULL,NULL)\n\n#define PEM_write_bio_OCSP_RESPONSE(bp,o) \\\n    PEM_ASN1_write_bio((int (*)())i2d_OCSP_RESPONSE,PEM_STRING_OCSP_RESPONSE,\\\n\t\t\tbp,(char *)o, NULL,NULL,0,NULL,NULL)\n\n#define i2d_OCSP_RESPONSE_bio(bp,o) ASN1_i2d_bio_of(OCSP_RESPONSE,i2d_OCSP_RESPONSE,bp,o)\n\n#define i2d_OCSP_REQUEST_bio(bp,o) ASN1_i2d_bio_of(OCSP_REQUEST,i2d_OCSP_REQUEST,bp,o)\n\n#define OCSP_REQUEST_sign(o,pkey,md) \\\n\tASN1_item_sign(ASN1_ITEM_rptr(OCSP_REQINFO),\\\n\t\to->optionalSignature->signatureAlgorithm,NULL,\\\n\t        o->optionalSignature->signature,o->tbsRequest,pkey,md)\n\n#define OCSP_BASICRESP_sign(o,pkey,md,d) \\\n\tASN1_item_sign(ASN1_ITEM_rptr(OCSP_RESPDATA),o->signatureAlgorithm,NULL,\\\n\t\to->signature,o->tbsResponseData,pkey,md)\n\n#define OCSP_REQUEST_verify(a,r) ASN1_item_verify(ASN1_ITEM_rptr(OCSP_REQINFO),\\\n        a->optionalSignature->signatureAlgorithm,\\\n\ta->optionalSignature->signature,a->tbsRequest,r)\n\n#define OCSP_BASICRESP_verify(a,r,d) ASN1_item_verify(ASN1_ITEM_rptr(OCSP_RESPDATA),\\\n\ta->signatureAlgorithm,a->signature,a->tbsResponseData,r)\n\n#define ASN1_BIT_STRING_digest(data,type,md,len) \\\n\tASN1_item_digest(ASN1_ITEM_rptr(ASN1_BIT_STRING),type,data,md,len)\n\n#define OCSP_CERTID_dup(cid) ASN1_dup_of(OCSP_CERTID,i2d_OCSP_CERTID,d2i_OCSP_CERTID,cid)\n\n#define OCSP_CERTSTATUS_dup(cs)\\\n                (OCSP_CERTSTATUS*)ASN1_dup((int(*)())i2d_OCSP_CERTSTATUS,\\\n\t\t(char *(*)())d2i_OCSP_CERTSTATUS,(char *)(cs))\n\nOCSP_RESPONSE *OCSP_sendreq_bio(BIO *b, char *path, OCSP_REQUEST *req);\nOCSP_REQ_CTX *OCSP_sendreq_new(BIO *io, char *path, OCSP_REQUEST *req,\n\t\t\t\t\t\t\t\tint maxline);\nint OCSP_sendreq_nbio(OCSP_RESPONSE **presp, OCSP_REQ_CTX *rctx);\nvoid OCSP_REQ_CTX_free(OCSP_REQ_CTX *rctx);\n\nOCSP_CERTID *OCSP_cert_to_id(const EVP_MD *dgst, X509 *subject, X509 *issuer);\n\nOCSP_CERTID *OCSP_cert_id_new(const EVP_MD *dgst, \n\t\t\t      X509_NAME *issuerName, \n\t\t\t      ASN1_BIT_STRING* issuerKey, \n\t\t\t      ASN1_INTEGER *serialNumber);\n\nOCSP_ONEREQ *OCSP_request_add0_id(OCSP_REQUEST *req, OCSP_CERTID *cid);\n\nint OCSP_request_add1_nonce(OCSP_REQUEST *req, unsigned char *val, int len);\nint OCSP_basic_add1_nonce(OCSP_BASICRESP *resp, unsigned char *val, int len);\nint OCSP_check_nonce(OCSP_REQUEST *req, OCSP_BASICRESP *bs);\nint OCSP_copy_nonce(OCSP_BASICRESP *resp, OCSP_REQUEST *req);\n\nint OCSP_request_set1_name(OCSP_REQUEST *req, X509_NAME *nm);\nint OCSP_request_add1_cert(OCSP_REQUEST *req, X509 *cert);\n\nint OCSP_request_sign(OCSP_REQUEST   *req,\n\t\t      X509           *signer,\n\t\t      EVP_PKEY       *key,\n\t\t      const EVP_MD   *dgst,\n\t\t      STACK_OF(X509) *certs,\n\t\t      unsigned long flags);\n\nint OCSP_response_status(OCSP_RESPONSE *resp);\nOCSP_BASICRESP *OCSP_response_get1_basic(OCSP_RESPONSE *resp);\n\nint OCSP_resp_count(OCSP_BASICRESP *bs);\nOCSP_SINGLERESP *OCSP_resp_get0(OCSP_BASICRESP *bs, int idx);\nint OCSP_resp_find(OCSP_BASICRESP *bs, OCSP_CERTID *id, int last);\nint OCSP_single_get0_status(OCSP_SINGLERESP *single, int *reason,\n\t\t\t\tASN1_GENERALIZEDTIME **revtime,\n\t\t\t\tASN1_GENERALIZEDTIME **thisupd,\n\t\t\t\tASN1_GENERALIZEDTIME **nextupd);\nint OCSP_resp_find_status(OCSP_BASICRESP *bs, OCSP_CERTID *id, int *status,\n\t\t\t\tint *reason,\n\t\t\t\tASN1_GENERALIZEDTIME **revtime,\n\t\t\t\tASN1_GENERALIZEDTIME **thisupd,\n\t\t\t\tASN1_GENERALIZEDTIME **nextupd);\nint OCSP_check_validity(ASN1_GENERALIZEDTIME *thisupd,\n\t\t\tASN1_GENERALIZEDTIME *nextupd,\n\t\t\tlong sec, long maxsec);\n\nint OCSP_request_verify(OCSP_REQUEST *req, STACK_OF(X509) *certs, X509_STORE *store, unsigned long flags);\n\nint OCSP_parse_url(char *url, char **phost, char **pport, char **ppath, int *pssl);\n\nint OCSP_id_issuer_cmp(OCSP_CERTID *a, OCSP_CERTID *b);\nint OCSP_id_cmp(OCSP_CERTID *a, OCSP_CERTID *b);\n\nint OCSP_request_onereq_count(OCSP_REQUEST *req);\nOCSP_ONEREQ *OCSP_request_onereq_get0(OCSP_REQUEST *req, int i);\nOCSP_CERTID *OCSP_onereq_get0_id(OCSP_ONEREQ *one);\nint OCSP_id_get0_info(ASN1_OCTET_STRING **piNameHash, ASN1_OBJECT **pmd,\n\t\t\tASN1_OCTET_STRING **pikeyHash,\n\t\t\tASN1_INTEGER **pserial, OCSP_CERTID *cid);\nint OCSP_request_is_signed(OCSP_REQUEST *req);\nOCSP_RESPONSE *OCSP_response_create(int status, OCSP_BASICRESP *bs);\nOCSP_SINGLERESP *OCSP_basic_add1_status(OCSP_BASICRESP *rsp,\n\t\t\t\t\t\tOCSP_CERTID *cid,\n\t\t\t\t\t\tint status, int reason,\n\t\t\t\t\t\tASN1_TIME *revtime,\n\t\t\t\t\tASN1_TIME *thisupd, ASN1_TIME *nextupd);\nint OCSP_basic_add1_cert(OCSP_BASICRESP *resp, X509 *cert);\nint OCSP_basic_sign(OCSP_BASICRESP *brsp, \n\t\t\tX509 *signer, EVP_PKEY *key, const EVP_MD *dgst,\n\t\t\tSTACK_OF(X509) *certs, unsigned long flags);\n\nASN1_STRING *ASN1_STRING_encode(ASN1_STRING *s, i2d_of_void *i2d,\n\t\t\t\tvoid *data, STACK_OF(ASN1_OBJECT) *sk);\n#define ASN1_STRING_encode_of(type,s,i2d,data,sk) \\\n\tASN1_STRING_encode(s, CHECKED_I2D_OF(type, i2d), data, sk)\n\nX509_EXTENSION *OCSP_crlID_new(char *url, long *n, char *tim);\n\nX509_EXTENSION *OCSP_accept_responses_new(char **oids);\n\nX509_EXTENSION *OCSP_archive_cutoff_new(char* tim);\n\nX509_EXTENSION *OCSP_url_svcloc_new(X509_NAME* issuer, char **urls);\n\nint OCSP_REQUEST_get_ext_count(OCSP_REQUEST *x);\nint OCSP_REQUEST_get_ext_by_NID(OCSP_REQUEST *x, int nid, int lastpos);\nint OCSP_REQUEST_get_ext_by_OBJ(OCSP_REQUEST *x, ASN1_OBJECT *obj, int lastpos);\nint OCSP_REQUEST_get_ext_by_critical(OCSP_REQUEST *x, int crit, int lastpos);\nX509_EXTENSION *OCSP_REQUEST_get_ext(OCSP_REQUEST *x, int loc);\nX509_EXTENSION *OCSP_REQUEST_delete_ext(OCSP_REQUEST *x, int loc);\nvoid *OCSP_REQUEST_get1_ext_d2i(OCSP_REQUEST *x, int nid, int *crit, int *idx);\nint OCSP_REQUEST_add1_ext_i2d(OCSP_REQUEST *x, int nid, void *value, int crit,\n\t\t\t\t\t\t\tunsigned long flags);\nint OCSP_REQUEST_add_ext(OCSP_REQUEST *x, X509_EXTENSION *ex, int loc);\n\nint OCSP_ONEREQ_get_ext_count(OCSP_ONEREQ *x);\nint OCSP_ONEREQ_get_ext_by_NID(OCSP_ONEREQ *x, int nid, int lastpos);\nint OCSP_ONEREQ_get_ext_by_OBJ(OCSP_ONEREQ *x, ASN1_OBJECT *obj, int lastpos);\nint OCSP_ONEREQ_get_ext_by_critical(OCSP_ONEREQ *x, int crit, int lastpos);\nX509_EXTENSION *OCSP_ONEREQ_get_ext(OCSP_ONEREQ *x, int loc);\nX509_EXTENSION *OCSP_ONEREQ_delete_ext(OCSP_ONEREQ *x, int loc);\nvoid *OCSP_ONEREQ_get1_ext_d2i(OCSP_ONEREQ *x, int nid, int *crit, int *idx);\nint OCSP_ONEREQ_add1_ext_i2d(OCSP_ONEREQ *x, int nid, void *value, int crit,\n\t\t\t\t\t\t\tunsigned long flags);\nint OCSP_ONEREQ_add_ext(OCSP_ONEREQ *x, X509_EXTENSION *ex, int loc);\n\nint OCSP_BASICRESP_get_ext_count(OCSP_BASICRESP *x);\nint OCSP_BASICRESP_get_ext_by_NID(OCSP_BASICRESP *x, int nid, int lastpos);\nint OCSP_BASICRESP_get_ext_by_OBJ(OCSP_BASICRESP *x, ASN1_OBJECT *obj, int lastpos);\nint OCSP_BASICRESP_get_ext_by_critical(OCSP_BASICRESP *x, int crit, int lastpos);\nX509_EXTENSION *OCSP_BASICRESP_get_ext(OCSP_BASICRESP *x, int loc);\nX509_EXTENSION *OCSP_BASICRESP_delete_ext(OCSP_BASICRESP *x, int loc);\nvoid *OCSP_BASICRESP_get1_ext_d2i(OCSP_BASICRESP *x, int nid, int *crit, int *idx);\nint OCSP_BASICRESP_add1_ext_i2d(OCSP_BASICRESP *x, int nid, void *value, int crit,\n\t\t\t\t\t\t\tunsigned long flags);\nint OCSP_BASICRESP_add_ext(OCSP_BASICRESP *x, X509_EXTENSION *ex, int loc);\n\nint OCSP_SINGLERESP_get_ext_count(OCSP_SINGLERESP *x);\nint OCSP_SINGLERESP_get_ext_by_NID(OCSP_SINGLERESP *x, int nid, int lastpos);\nint OCSP_SINGLERESP_get_ext_by_OBJ(OCSP_SINGLERESP *x, ASN1_OBJECT *obj, int lastpos);\nint OCSP_SINGLERESP_get_ext_by_critical(OCSP_SINGLERESP *x, int crit, int lastpos);\nX509_EXTENSION *OCSP_SINGLERESP_get_ext(OCSP_SINGLERESP *x, int loc);\nX509_EXTENSION *OCSP_SINGLERESP_delete_ext(OCSP_SINGLERESP *x, int loc);\nvoid *OCSP_SINGLERESP_get1_ext_d2i(OCSP_SINGLERESP *x, int nid, int *crit, int *idx);\nint OCSP_SINGLERESP_add1_ext_i2d(OCSP_SINGLERESP *x, int nid, void *value, int crit,\n\t\t\t\t\t\t\tunsigned long flags);\nint OCSP_SINGLERESP_add_ext(OCSP_SINGLERESP *x, X509_EXTENSION *ex, int loc);\n\nDECLARE_ASN1_FUNCTIONS(OCSP_SINGLERESP)\nDECLARE_ASN1_FUNCTIONS(OCSP_CERTSTATUS)\nDECLARE_ASN1_FUNCTIONS(OCSP_REVOKEDINFO)\nDECLARE_ASN1_FUNCTIONS(OCSP_BASICRESP)\nDECLARE_ASN1_FUNCTIONS(OCSP_RESPDATA)\nDECLARE_ASN1_FUNCTIONS(OCSP_RESPID)\nDECLARE_ASN1_FUNCTIONS(OCSP_RESPONSE)\nDECLARE_ASN1_FUNCTIONS(OCSP_RESPBYTES)\nDECLARE_ASN1_FUNCTIONS(OCSP_ONEREQ)\nDECLARE_ASN1_FUNCTIONS(OCSP_CERTID)\nDECLARE_ASN1_FUNCTIONS(OCSP_REQUEST)\nDECLARE_ASN1_FUNCTIONS(OCSP_SIGNATURE)\nDECLARE_ASN1_FUNCTIONS(OCSP_REQINFO)\nDECLARE_ASN1_FUNCTIONS(OCSP_CRLID)\nDECLARE_ASN1_FUNCTIONS(OCSP_SERVICELOC)\n\nchar *OCSP_response_status_str(long s);\nchar *OCSP_cert_status_str(long s);\nchar *OCSP_crl_reason_str(long s);\n\nint OCSP_REQUEST_print(BIO *bp, OCSP_REQUEST* a, unsigned long flags);\nint OCSP_RESPONSE_print(BIO *bp, OCSP_RESPONSE* o, unsigned long flags);\n\nint OCSP_basic_verify(OCSP_BASICRESP *bs, STACK_OF(X509) *certs,\n\t\t\t\tX509_STORE *st, unsigned long flags);\n\n/* BEGIN ERROR CODES */\n/* The following lines are auto generated by the script mkerr.pl. Any changes\n * made after this point may be overwritten when the script is next run.\n */\nvoid ERR_load_OCSP_strings(void);\n\n/* Error codes for the OCSP functions. */\n\n/* Function codes. */\n#define OCSP_F_ASN1_STRING_ENCODE\t\t\t 100\n#define OCSP_F_D2I_OCSP_NONCE\t\t\t\t 102\n#define OCSP_F_OCSP_BASIC_ADD1_STATUS\t\t\t 103\n#define OCSP_F_OCSP_BASIC_SIGN\t\t\t\t 104\n#define OCSP_F_OCSP_BASIC_VERIFY\t\t\t 105\n#define OCSP_F_OCSP_CERT_ID_NEW\t\t\t\t 101\n#define OCSP_F_OCSP_CHECK_DELEGATED\t\t\t 106\n#define OCSP_F_OCSP_CHECK_IDS\t\t\t\t 107\n#define OCSP_F_OCSP_CHECK_ISSUER\t\t\t 108\n#define OCSP_F_OCSP_CHECK_VALIDITY\t\t\t 115\n#define OCSP_F_OCSP_MATCH_ISSUERID\t\t\t 109\n#define OCSP_F_OCSP_PARSE_URL\t\t\t\t 114\n#define OCSP_F_OCSP_REQUEST_SIGN\t\t\t 110\n#define OCSP_F_OCSP_REQUEST_VERIFY\t\t\t 116\n#define OCSP_F_OCSP_RESPONSE_GET1_BASIC\t\t\t 111\n#define OCSP_F_OCSP_SENDREQ_BIO\t\t\t\t 112\n#define OCSP_F_PARSE_HTTP_LINE1\t\t\t\t 117\n#define OCSP_F_REQUEST_VERIFY\t\t\t\t 113\n\n/* Reason codes. */\n#define OCSP_R_BAD_DATA\t\t\t\t\t 100\n#define OCSP_R_CERTIFICATE_VERIFY_ERROR\t\t\t 101\n#define OCSP_R_DIGEST_ERR\t\t\t\t 102\n#define OCSP_R_ERROR_IN_NEXTUPDATE_FIELD\t\t 122\n#define OCSP_R_ERROR_IN_THISUPDATE_FIELD\t\t 123\n#define OCSP_R_ERROR_PARSING_URL\t\t\t 121\n#define OCSP_R_MISSING_OCSPSIGNING_USAGE\t\t 103\n#define OCSP_R_NEXTUPDATE_BEFORE_THISUPDATE\t\t 124\n#define OCSP_R_NOT_BASIC_RESPONSE\t\t\t 104\n#define OCSP_R_NO_CERTIFICATES_IN_CHAIN\t\t\t 105\n#define OCSP_R_NO_CONTENT\t\t\t\t 106\n#define OCSP_R_NO_PUBLIC_KEY\t\t\t\t 107\n#define OCSP_R_NO_RESPONSE_DATA\t\t\t\t 108\n#define OCSP_R_NO_REVOKED_TIME\t\t\t\t 109\n#define OCSP_R_PRIVATE_KEY_DOES_NOT_MATCH_CERTIFICATE\t 110\n#define OCSP_R_REQUEST_NOT_SIGNED\t\t\t 128\n#define OCSP_R_RESPONSE_CONTAINS_NO_REVOCATION_DATA\t 111\n#define OCSP_R_ROOT_CA_NOT_TRUSTED\t\t\t 112\n#define OCSP_R_SERVER_READ_ERROR\t\t\t 113\n#define OCSP_R_SERVER_RESPONSE_ERROR\t\t\t 114\n#define OCSP_R_SERVER_RESPONSE_PARSE_ERROR\t\t 115\n#define OCSP_R_SERVER_WRITE_ERROR\t\t\t 116\n#define OCSP_R_SIGNATURE_FAILURE\t\t\t 117\n#define OCSP_R_SIGNER_CERTIFICATE_NOT_FOUND\t\t 118\n#define OCSP_R_STATUS_EXPIRED\t\t\t\t 125\n#define OCSP_R_STATUS_NOT_YET_VALID\t\t\t 126\n#define OCSP_R_STATUS_TOO_OLD\t\t\t\t 127\n#define OCSP_R_UNKNOWN_MESSAGE_DIGEST\t\t\t 119\n#define OCSP_R_UNKNOWN_NID\t\t\t\t 120\n#define OCSP_R_UNSUPPORTED_REQUESTORNAME_TYPE\t\t 129\n\n#ifdef  __cplusplus\n}\n#endif\n#endif\n"
  },
  {
    "path": "freebsd-headers/openssl/opensslconf.h",
    "content": "/* $FreeBSD: release/9.0.0/secure/lib/libcrypto/opensslconf-amd64.h 194207 2009-06-14 19:46:18Z simon $ */\n/* opensslconf.h */\n/* WARNING: Generated automatically from opensslconf.h.in by Configure. */\n\n/* OpenSSL was configured with the following options: */\n#ifndef OPENSSL_DOING_MAKEDEPEND\n\n/* Disabled by default in OpenSSL 0.9.8. */\n#ifndef OPENSSL_NO_CMS\n# define OPENSSL_NO_CMS\n#endif\n/* Disabled by default in OpenSSL 0.9.8. */\n#ifndef OPENSSL_NO_SEED\n# define OPENSSL_NO_SEED\n#endif\n/* libgmp is not in the FreeBSD base system. */\n#ifndef OPENSSL_NO_GMP\n# define OPENSSL_NO_GMP\n#endif\n/* jpake is marked experimental in OpenSSL 0.9.8. */\n#ifndef OPENSSL_NO_JPAKE\n# define OPENSSL_NO_JPAKE\n#endif\n/* The Kerberos 5 support is MIT-specific. */\n#ifndef OPENSSL_NO_KRB5\n# define OPENSSL_NO_KRB5\n#endif\n\n#endif /* OPENSSL_DOING_MAKEDEPEND */\n#ifndef OPENSSL_THREADS\n# define OPENSSL_THREADS\n#endif\n#ifndef OPENSSL_NO_STATIC_ENGINE\n# define OPENSSL_NO_STATIC_ENGINE\n#endif\n\n/* The OPENSSL_NO_* macros are also defined as NO_* if the application\n   asks for it.  This is a transient feature that is provided for those\n   who haven't had the time to do the appropriate changes in their\n   applications.  */\n#ifdef OPENSSL_ALGORITHM_DEFINES\n# if defined(OPENSSL_NO_GMP) && !defined(NO_GMP)\n#  define NO_GMP\n# endif\n# if defined(OPENSSL_NO_KRB5) && !defined(NO_KRB5)\n#  define NO_KRB5\n# endif\n# endif\n#ifdef OPENSSL_OTHER_DEFINES\n# ifndef NO_ASM\n#  define NO_ASM\n# endif\n#endif\n\n/* crypto/opensslconf.h.in */\n\n/* Generate 80386 code? */\n#undef I386_ONLY\n\n#if !(defined(VMS) || defined(__VMS)) /* VMS uses logical names instead */\n#if defined(HEADER_CRYPTLIB_H) && !defined(OPENSSLDIR)\n#define ENGINESDIR \"/usr/lib/engines\"\n#define OPENSSLDIR \"/etc/ssl\"\n#endif\n#endif\n\n#undef OPENSSL_UNISTD\n#define OPENSSL_UNISTD <unistd.h>\n\n#undef OPENSSL_EXPORT_VAR_AS_FUNCTION\n\n#if defined(HEADER_IDEA_H) && !defined(IDEA_INT)\n#define IDEA_INT unsigned int\n#endif\n\n#if defined(HEADER_MD2_H) && !defined(MD2_INT)\n#define MD2_INT unsigned int\n#endif\n\n#if defined(HEADER_RC2_H) && !defined(RC2_INT)\n/* I need to put in a mod for the alpha - eay */\n#define RC2_INT unsigned int\n#endif\n\n#if defined(HEADER_RC4_H)\n#if !defined(RC4_INT)\n/* using int types make the structure larger but make the code faster\n * on most boxes I have tested - up to %20 faster. */\n/*\n * I don't know what does \"most\" mean, but declaring \"int\" is a must on:\n * - Intel P6 because partial register stalls are very expensive;\n * - elder Alpha because it lacks byte load/store instructions;\n */\n#define RC4_INT unsigned int\n#endif\n#if !defined(RC4_CHUNK)\n/*\n * This enables code handling data aligned at natural CPU word\n * boundary. See crypto/rc4/rc4_enc.c for further details.\n */\n#define RC4_CHUNK unsigned long\n#endif\n#endif\n\n#if (defined(HEADER_NEW_DES_H) || defined(HEADER_DES_H)) && !defined(DES_LONG)\n/* If this is set to 'unsigned int' on a DEC Alpha, this gives about a\n * %20 speed up (longs are 8 bytes, int's are 4). */\n#ifndef DES_LONG\n#define DES_LONG unsigned int\n#endif\n#endif\n\n#if defined(HEADER_BN_H) && !defined(CONFIG_HEADER_BN_H)\n#define CONFIG_HEADER_BN_H\n#undef BN_LLONG\n\n/* Should we define BN_DIV2W here? */\n\n/* Only one for the following should be defined */\n/* The prime number generation stuff may not work when\n * EIGHT_BIT but I don't care since I've only used this mode\n * for debuging the bignum libraries */\n#define SIXTY_FOUR_BIT_LONG\n#undef SIXTY_FOUR_BIT\n#undef THIRTY_TWO_BIT\n#undef SIXTEEN_BIT\n#undef EIGHT_BIT\n#endif\n\n#if defined(HEADER_RC4_LOCL_H) && !defined(CONFIG_HEADER_RC4_LOCL_H)\n#define CONFIG_HEADER_RC4_LOCL_H\n/* if this is defined data[i] is used instead of *data, this is a %20\n * speedup on x86 */\n#undef RC4_INDEX\n#endif\n\n#if defined(HEADER_BF_LOCL_H) && !defined(CONFIG_HEADER_BF_LOCL_H)\n#define CONFIG_HEADER_BF_LOCL_H\n#undef BF_PTR\n#endif /* HEADER_BF_LOCL_H */\n\n#if defined(HEADER_DES_LOCL_H) && !defined(CONFIG_HEADER_DES_LOCL_H)\n#define CONFIG_HEADER_DES_LOCL_H\n#ifndef DES_DEFAULT_OPTIONS\n/* the following is tweaked from a config script, that is why it is a\n * protected undef/define */\n#ifndef DES_PTR\n#undef DES_PTR\n#endif\n\n/* This helps C compiler generate the correct code for multiple functional\n * units.  It reduces register dependancies at the expense of 2 more\n * registers */\n#ifndef DES_RISC1\n#undef DES_RISC1\n#endif\n\n#ifndef DES_RISC2\n#undef DES_RISC2\n#endif\n\n#if defined(DES_RISC1) && defined(DES_RISC2)\nYOU SHOULD NOT HAVE BOTH DES_RISC1 AND DES_RISC2 DEFINED!!!!!\n#endif\n\n/* Unroll the inner loop, this sometimes helps, sometimes hinders.\n * Very mucy CPU dependant */\n#ifndef DES_UNROLL\n#define DES_UNROLL\n#endif\n\n/* These default values were supplied by\n * Peter Gutman <pgut001@cs.auckland.ac.nz>\n * They are only used if nothing else has been defined */\n#if !defined(DES_PTR) && !defined(DES_RISC1) && !defined(DES_RISC2) && !defined(DES_UNROLL)\n/* Special defines which change the way the code is built depending on the\n   CPU and OS.  For SGI machines you can use _MIPS_SZLONG (32 or 64) to find\n   even newer MIPS CPU's, but at the moment one size fits all for\n   optimization options.  Older Sparc's work better with only UNROLL, but\n   there's no way to tell at compile time what it is you're running on */\n \n#if defined( sun )\t\t/* Newer Sparc's */\n#  define DES_PTR\n#  define DES_RISC1\n#  define DES_UNROLL\n#elif defined( __ultrix )\t/* Older MIPS */\n#  define DES_PTR\n#  define DES_RISC2\n#  define DES_UNROLL\n#elif defined( __osf1__ )\t/* Alpha */\n#  define DES_PTR\n#  define DES_RISC2\n#elif defined ( _AIX )\t\t/* RS6000 */\n  /* Unknown */\n#elif defined( __hpux )\t\t/* HP-PA */\n  /* Unknown */\n#elif defined( __aux )\t\t/* 68K */\n  /* Unknown */\n#elif defined( __dgux )\t\t/* 88K (but P6 in latest boxes) */\n#  define DES_UNROLL\n#elif defined( __sgi )\t\t/* Newer MIPS */\n#  define DES_PTR\n#  define DES_RISC2\n#  define DES_UNROLL\n#elif defined( i386 )\t\t/* x86 boxes, should be gcc */\n#  define DES_PTR\n#  define DES_RISC1\n#  define DES_UNROLL\n#endif /* Systems-specific speed defines */\n#endif\n\n#endif /* DES_DEFAULT_OPTIONS */\n#endif /* HEADER_DES_LOCL_H */\n"
  },
  {
    "path": "freebsd-headers/openssl/opensslv.h",
    "content": "#ifndef HEADER_OPENSSLV_H\n#define HEADER_OPENSSLV_H\n\n/* Numeric release version identifier:\n * MNNFFPPS: major minor fix patch status\n * The status nibble has one of the values 0 for development, 1 to e for betas\n * 1 to 14, and f for release.  The patch level is exactly that.\n * For example:\n * 0.9.3-dev\t  0x00903000\n * 0.9.3-beta1\t  0x00903001\n * 0.9.3-beta2-dev 0x00903002\n * 0.9.3-beta2    0x00903002 (same as ...beta2-dev)\n * 0.9.3\t  0x0090300f\n * 0.9.3a\t  0x0090301f\n * 0.9.4\t  0x0090400f\n * 1.2.3z\t  0x102031af\n *\n * For continuity reasons (because 0.9.5 is already out, and is coded\n * 0x00905100), between 0.9.5 and 0.9.6 the coding of the patch level\n * part is slightly different, by setting the highest bit.  This means\n * that 0.9.5a looks like this: 0x0090581f.  At 0.9.6, we can start\n * with 0x0090600S...\n *\n * (Prior to 0.9.3-dev a different scheme was used: 0.9.2b is 0x0922.)\n * (Prior to 0.9.5a beta1, a different scheme was used: MMNNFFRBB for\n *  major minor fix final patch/beta)\n */\n#define OPENSSL_VERSION_NUMBER\t0x0090811f\n#ifdef OPENSSL_FIPS\n#define OPENSSL_VERSION_TEXT\t\"OpenSSL 0.9.8q-fips 2 Dec 2010\"\n#else\n#define OPENSSL_VERSION_TEXT\t\"OpenSSL 0.9.8q 2 Dec 2010\"\n#endif\n#define OPENSSL_VERSION_PTEXT\t\" part of \" OPENSSL_VERSION_TEXT\n\n\n/* The macros below are to be used for shared library (.so, .dll, ...)\n * versioning.  That kind of versioning works a bit differently between\n * operating systems.  The most usual scheme is to set a major and a minor\n * number, and have the runtime loader check that the major number is equal\n * to what it was at application link time, while the minor number has to\n * be greater or equal to what it was at application link time.  With this\n * scheme, the version number is usually part of the file name, like this:\n *\n *\tlibcrypto.so.0.9\n *\n * Some unixen also make a softlink with the major verson number only:\n *\n *\tlibcrypto.so.0\n *\n * On Tru64 and IRIX 6.x it works a little bit differently.  There, the\n * shared library version is stored in the file, and is actually a series\n * of versions, separated by colons.  The rightmost version present in the\n * library when linking an application is stored in the application to be\n * matched at run time.  When the application is run, a check is done to\n * see if the library version stored in the application matches any of the\n * versions in the version string of the library itself.\n * This version string can be constructed in any way, depending on what\n * kind of matching is desired.  However, to implement the same scheme as\n * the one used in the other unixen, all compatible versions, from lowest\n * to highest, should be part of the string.  Consecutive builds would\n * give the following versions strings:\n *\n *\t3.0\n *\t3.0:3.1\n *\t3.0:3.1:3.2\n *\t4.0\n *\t4.0:4.1\n *\n * Notice how version 4 is completely incompatible with version, and\n * therefore give the breach you can see.\n *\n * There may be other schemes as well that I haven't yet discovered.\n *\n * So, here's the way it works here: first of all, the library version\n * number doesn't need at all to match the overall OpenSSL version.\n * However, it's nice and more understandable if it actually does.\n * The current library version is stored in the macro SHLIB_VERSION_NUMBER,\n * which is just a piece of text in the format \"M.m.e\" (Major, minor, edit).\n * For the sake of Tru64, IRIX, and any other OS that behaves in similar ways,\n * we need to keep a history of version numbers, which is done in the\n * macro SHLIB_VERSION_HISTORY.  The numbers are separated by colons and\n * should only keep the versions that are binary compatible with the current.\n */\n#define SHLIB_VERSION_HISTORY \"\"\n#define SHLIB_VERSION_NUMBER \"0.9.8\"\n\n\n#endif /* HEADER_OPENSSLV_H */\n"
  },
  {
    "path": "freebsd-headers/openssl/ossl_typ.h",
    "content": "/* ====================================================================\n * Copyright (c) 1998-2001 The OpenSSL Project.  All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n *\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer. \n *\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in\n *    the documentation and/or other materials provided with the\n *    distribution.\n *\n * 3. All advertising materials mentioning features or use of this\n *    software must display the following acknowledgment:\n *    \"This product includes software developed by the OpenSSL Project\n *    for use in the OpenSSL Toolkit. (http://www.openssl.org/)\"\n *\n * 4. The names \"OpenSSL Toolkit\" and \"OpenSSL Project\" must not be used to\n *    endorse or promote products derived from this software without\n *    prior written permission. For written permission, please contact\n *    openssl-core@openssl.org.\n *\n * 5. Products derived from this software may not be called \"OpenSSL\"\n *    nor may \"OpenSSL\" appear in their names without prior written\n *    permission of the OpenSSL Project.\n *\n * 6. Redistributions of any form whatsoever must retain the following\n *    acknowledgment:\n *    \"This product includes software developed by the OpenSSL Project\n *    for use in the OpenSSL Toolkit (http://www.openssl.org/)\"\n *\n * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY\n * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\n * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE OpenSSL PROJECT OR\n * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\n * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,\n * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED\n * OF THE POSSIBILITY OF SUCH DAMAGE.\n * ====================================================================\n *\n * This product includes cryptographic software written by Eric Young\n * (eay@cryptsoft.com).  This product includes software written by Tim\n * Hudson (tjh@cryptsoft.com).\n *\n */\n\n#ifndef HEADER_OPENSSL_TYPES_H\n#define HEADER_OPENSSL_TYPES_H\n\n#include <openssl/e_os2.h>\n\n#ifdef NO_ASN1_TYPEDEFS\n#define ASN1_INTEGER\t\tASN1_STRING\n#define ASN1_ENUMERATED\t\tASN1_STRING\n#define ASN1_BIT_STRING\t\tASN1_STRING\n#define ASN1_OCTET_STRING\tASN1_STRING\n#define ASN1_PRINTABLESTRING\tASN1_STRING\n#define ASN1_T61STRING\t\tASN1_STRING\n#define ASN1_IA5STRING\t\tASN1_STRING\n#define ASN1_UTCTIME\t\tASN1_STRING\n#define ASN1_GENERALIZEDTIME\tASN1_STRING\n#define ASN1_TIME\t\tASN1_STRING\n#define ASN1_GENERALSTRING\tASN1_STRING\n#define ASN1_UNIVERSALSTRING\tASN1_STRING\n#define ASN1_BMPSTRING\t\tASN1_STRING\n#define ASN1_VISIBLESTRING\tASN1_STRING\n#define ASN1_UTF8STRING\t\tASN1_STRING\n#define ASN1_BOOLEAN\t\tint\n#define ASN1_NULL\t\tint\n#else\ntypedef struct asn1_string_st ASN1_INTEGER;\ntypedef struct asn1_string_st ASN1_ENUMERATED;\ntypedef struct asn1_string_st ASN1_BIT_STRING;\ntypedef struct asn1_string_st ASN1_OCTET_STRING;\ntypedef struct asn1_string_st ASN1_PRINTABLESTRING;\ntypedef struct asn1_string_st ASN1_T61STRING;\ntypedef struct asn1_string_st ASN1_IA5STRING;\ntypedef struct asn1_string_st ASN1_GENERALSTRING;\ntypedef struct asn1_string_st ASN1_UNIVERSALSTRING;\ntypedef struct asn1_string_st ASN1_BMPSTRING;\ntypedef struct asn1_string_st ASN1_UTCTIME;\ntypedef struct asn1_string_st ASN1_TIME;\ntypedef struct asn1_string_st ASN1_GENERALIZEDTIME;\ntypedef struct asn1_string_st ASN1_VISIBLESTRING;\ntypedef struct asn1_string_st ASN1_UTF8STRING;\ntypedef int ASN1_BOOLEAN;\ntypedef int ASN1_NULL;\n#endif\n\n#ifdef OPENSSL_SYS_WIN32\n#undef X509_NAME\n#undef X509_EXTENSIONS\n#undef X509_CERT_PAIR\n#undef PKCS7_ISSUER_AND_SERIAL\n#undef OCSP_REQUEST\n#undef OCSP_RESPONSE\n#endif\n\n#ifdef BIGNUM\n#undef BIGNUM\n#endif\ntypedef struct bignum_st BIGNUM;\ntypedef struct bignum_ctx BN_CTX;\ntypedef struct bn_blinding_st BN_BLINDING;\ntypedef struct bn_mont_ctx_st BN_MONT_CTX;\ntypedef struct bn_recp_ctx_st BN_RECP_CTX;\ntypedef struct bn_gencb_st BN_GENCB;\n\ntypedef struct buf_mem_st BUF_MEM;\n\ntypedef struct evp_cipher_st EVP_CIPHER;\ntypedef struct evp_cipher_ctx_st EVP_CIPHER_CTX;\ntypedef struct env_md_st EVP_MD;\ntypedef struct env_md_ctx_st EVP_MD_CTX;\ntypedef struct evp_pkey_st EVP_PKEY;\n\ntypedef struct dh_st DH;\ntypedef struct dh_method DH_METHOD;\n\ntypedef struct dsa_st DSA;\ntypedef struct dsa_method DSA_METHOD;\n\ntypedef struct rsa_st RSA;\ntypedef struct rsa_meth_st RSA_METHOD;\n\ntypedef struct rand_meth_st RAND_METHOD;\n\ntypedef struct ecdh_method ECDH_METHOD;\ntypedef struct ecdsa_method ECDSA_METHOD;\n\ntypedef struct x509_st X509;\ntypedef struct X509_algor_st X509_ALGOR;\ntypedef struct X509_crl_st X509_CRL;\ntypedef struct X509_name_st X509_NAME;\ntypedef struct x509_store_st X509_STORE;\ntypedef struct x509_store_ctx_st X509_STORE_CTX;\ntypedef struct ssl_st SSL;\ntypedef struct ssl_ctx_st SSL_CTX;\n\ntypedef struct v3_ext_ctx X509V3_CTX;\ntypedef struct conf_st CONF;\n\ntypedef struct store_st STORE;\ntypedef struct store_method_st STORE_METHOD;\n\ntypedef struct ui_st UI;\ntypedef struct ui_method_st UI_METHOD;\n\ntypedef struct st_ERR_FNS ERR_FNS;\n\ntypedef struct engine_st ENGINE;\n\ntypedef struct X509_POLICY_NODE_st X509_POLICY_NODE;\ntypedef struct X509_POLICY_LEVEL_st X509_POLICY_LEVEL;\ntypedef struct X509_POLICY_TREE_st X509_POLICY_TREE;\ntypedef struct X509_POLICY_CACHE_st X509_POLICY_CACHE;\n\n  /* If placed in pkcs12.h, we end up with a circular depency with pkcs7.h */\n#define DECLARE_PKCS12_STACK_OF(type) /* Nothing */\n#define IMPLEMENT_PKCS12_STACK_OF(type) /* Nothing */\n\ntypedef struct crypto_ex_data_st CRYPTO_EX_DATA;\n/* Callback types for crypto.h */\ntypedef int CRYPTO_EX_new(void *parent, void *ptr, CRYPTO_EX_DATA *ad,\n\t\t\t\t\tint idx, long argl, void *argp);\ntypedef void CRYPTO_EX_free(void *parent, void *ptr, CRYPTO_EX_DATA *ad,\n\t\t\t\t\tint idx, long argl, void *argp);\ntypedef int CRYPTO_EX_dup(CRYPTO_EX_DATA *to, CRYPTO_EX_DATA *from, void *from_d, \n\t\t\t\t\tint idx, long argl, void *argp);\n\ntypedef struct ocsp_req_ctx_st OCSP_REQ_CTX;\ntypedef struct ocsp_response_st OCSP_RESPONSE;\ntypedef struct ocsp_responder_id_st OCSP_RESPID;\n\n#endif /* def HEADER_OPENSSL_TYPES_H */\n"
  },
  {
    "path": "freebsd-headers/openssl/pem.h",
    "content": "/* crypto/pem/pem.h */\n/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com)\n * All rights reserved.\n *\n * This package is an SSL implementation written\n * by Eric Young (eay@cryptsoft.com).\n * The implementation was written so as to conform with Netscapes SSL.\n * \n * This library is free for commercial and non-commercial use as long as\n * the following conditions are aheared to.  The following conditions\n * apply to all code found in this distribution, be it the RC4, RSA,\n * lhash, DES, etc., code; not just the SSL code.  The SSL documentation\n * included with this distribution is covered by the same copyright terms\n * except that the holder is Tim Hudson (tjh@cryptsoft.com).\n * \n * Copyright remains Eric Young's, and as such any Copyright notices in\n * the code are not to be removed.\n * If this package is used in a product, Eric Young should be given attribution\n * as the author of the parts of the library used.\n * This can be in the form of a textual message at program startup or\n * in documentation (online or textual) provided with the package.\n * \n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. All advertising materials mentioning features or use of this software\n *    must display the following acknowledgement:\n *    \"This product includes cryptographic software written by\n *     Eric Young (eay@cryptsoft.com)\"\n *    The word 'cryptographic' can be left out if the rouines from the library\n *    being used are not cryptographic related :-).\n * 4. If you include any Windows specific code (or a derivative thereof) from \n *    the apps directory (application code) you must include an acknowledgement:\n *    \"This product includes software written by Tim Hudson (tjh@cryptsoft.com)\"\n * \n * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n * \n * The licence and distribution terms for any publically available version or\n * derivative of this code cannot be changed.  i.e. this code cannot simply be\n * copied and put under another distribution licence\n * [including the GNU Public Licence.]\n */\n\n#ifndef HEADER_PEM_H\n#define HEADER_PEM_H\n\n#include <openssl/e_os2.h>\n#ifndef OPENSSL_NO_BIO\n#include <openssl/bio.h>\n#endif\n#ifndef OPENSSL_NO_STACK\n#include <openssl/stack.h>\n#endif\n#include <openssl/evp.h>\n#include <openssl/x509.h>\n#include <openssl/pem2.h>\n\n#ifdef  __cplusplus\nextern \"C\" {\n#endif\n\n#define PEM_BUFSIZE\t\t1024\n\n#define PEM_OBJ_UNDEF\t\t0\n#define PEM_OBJ_X509\t\t1\n#define PEM_OBJ_X509_REQ\t2\n#define PEM_OBJ_CRL\t\t3\n#define PEM_OBJ_SSL_SESSION\t4\n#define PEM_OBJ_PRIV_KEY\t10\n#define PEM_OBJ_PRIV_RSA\t11\n#define PEM_OBJ_PRIV_DSA\t12\n#define PEM_OBJ_PRIV_DH\t\t13\n#define PEM_OBJ_PUB_RSA\t\t14\n#define PEM_OBJ_PUB_DSA\t\t15\n#define PEM_OBJ_PUB_DH\t\t16\n#define PEM_OBJ_DHPARAMS\t17\n#define PEM_OBJ_DSAPARAMS\t18\n#define PEM_OBJ_PRIV_RSA_PUBLIC\t19\n#define PEM_OBJ_PRIV_ECDSA\t20\n#define PEM_OBJ_PUB_ECDSA\t21\n#define PEM_OBJ_ECPARAMETERS\t22\n\n#define PEM_ERROR\t\t30\n#define PEM_DEK_DES_CBC         40\n#define PEM_DEK_IDEA_CBC        45\n#define PEM_DEK_DES_EDE         50\n#define PEM_DEK_DES_ECB         60\n#define PEM_DEK_RSA             70\n#define PEM_DEK_RSA_MD2         80\n#define PEM_DEK_RSA_MD5         90\n\n#define PEM_MD_MD2\t\tNID_md2\n#define PEM_MD_MD5\t\tNID_md5\n#define PEM_MD_SHA\t\tNID_sha\n#define PEM_MD_MD2_RSA\t\tNID_md2WithRSAEncryption\n#define PEM_MD_MD5_RSA\t\tNID_md5WithRSAEncryption\n#define PEM_MD_SHA_RSA\t\tNID_sha1WithRSAEncryption\n\n#define PEM_STRING_X509_OLD\t\"X509 CERTIFICATE\"\n#define PEM_STRING_X509\t\t\"CERTIFICATE\"\n#define PEM_STRING_X509_PAIR\t\"CERTIFICATE PAIR\"\n#define PEM_STRING_X509_TRUSTED\t\"TRUSTED CERTIFICATE\"\n#define PEM_STRING_X509_REQ_OLD\t\"NEW CERTIFICATE REQUEST\"\n#define PEM_STRING_X509_REQ\t\"CERTIFICATE REQUEST\"\n#define PEM_STRING_X509_CRL\t\"X509 CRL\"\n#define PEM_STRING_EVP_PKEY\t\"ANY PRIVATE KEY\"\n#define PEM_STRING_PUBLIC\t\"PUBLIC KEY\"\n#define PEM_STRING_RSA\t\t\"RSA PRIVATE KEY\"\n#define PEM_STRING_RSA_PUBLIC\t\"RSA PUBLIC KEY\"\n#define PEM_STRING_DSA\t\t\"DSA PRIVATE KEY\"\n#define PEM_STRING_DSA_PUBLIC\t\"DSA PUBLIC KEY\"\n#define PEM_STRING_PKCS7\t\"PKCS7\"\n#define PEM_STRING_PKCS7_SIGNED\t\"PKCS #7 SIGNED DATA\"\n#define PEM_STRING_PKCS8\t\"ENCRYPTED PRIVATE KEY\"\n#define PEM_STRING_PKCS8INF\t\"PRIVATE KEY\"\n#define PEM_STRING_DHPARAMS\t\"DH PARAMETERS\"\n#define PEM_STRING_SSL_SESSION\t\"SSL SESSION PARAMETERS\"\n#define PEM_STRING_DSAPARAMS\t\"DSA PARAMETERS\"\n#define PEM_STRING_ECDSA_PUBLIC \"ECDSA PUBLIC KEY\"\n#define PEM_STRING_ECPARAMETERS \"EC PARAMETERS\"\n#define PEM_STRING_ECPRIVATEKEY\t\"EC PRIVATE KEY\"\n#define PEM_STRING_CMS\t\t\"CMS\"\n\n  /* Note that this structure is initialised by PEM_SealInit and cleaned up\n     by PEM_SealFinal (at least for now) */\ntypedef struct PEM_Encode_Seal_st\n\t{\n\tEVP_ENCODE_CTX encode;\n\tEVP_MD_CTX md;\n\tEVP_CIPHER_CTX cipher;\n\t} PEM_ENCODE_SEAL_CTX;\n\n/* enc_type is one off */\n#define PEM_TYPE_ENCRYPTED      10\n#define PEM_TYPE_MIC_ONLY       20\n#define PEM_TYPE_MIC_CLEAR      30\n#define PEM_TYPE_CLEAR\t\t40\n\ntypedef struct pem_recip_st\n\t{\n\tchar *name;\n\tX509_NAME *dn;\n\n\tint cipher;\n\tint key_enc;\n\t/*\tchar iv[8]; unused and wrong size */\n\t} PEM_USER;\n\ntypedef struct pem_ctx_st\n\t{\n\tint type;\t\t/* what type of object */\n\n\tstruct\t{\n\t\tint version;\t\n\t\tint mode;\t\t\n\t\t} proc_type;\n\n\tchar *domain;\n\n\tstruct\t{\n\t\tint cipher;\n\t/* unused, and wrong size\n\t   unsigned char iv[8]; */\n\t\t} DEK_info;\n\t\t\n\tPEM_USER *originator;\n\n\tint num_recipient;\n\tPEM_USER **recipient;\n\n#ifndef OPENSSL_NO_STACK\n\tSTACK *x509_chain;\t/* certificate chain */\n#else\n\tchar *x509_chain;\t/* certificate chain */\n#endif\n\tEVP_MD *md;\t\t/* signature type */\n\n\tint md_enc;\t\t/* is the md encrypted or not? */\n\tint md_len;\t\t/* length of md_data */\n\tchar *md_data;\t\t/* message digest, could be pkey encrypted */\n\n\tEVP_CIPHER *dec;\t/* date encryption cipher */\n\tint key_len;\t\t/* key length */\n\tunsigned char *key;\t/* key */\n\t/* unused, and wrong size\n\t   unsigned char iv[8]; */\n\n\t\n\tint  data_enc;\t\t/* is the data encrypted */\n\tint data_len;\n\tunsigned char *data;\n\t} PEM_CTX;\n\n/* These macros make the PEM_read/PEM_write functions easier to maintain and\n * write. Now they are all implemented with either:\n * IMPLEMENT_PEM_rw(...) or IMPLEMENT_PEM_rw_cb(...)\n */\n\n#ifdef OPENSSL_NO_FP_API\n\n#define IMPLEMENT_PEM_read_fp(name, type, str, asn1) /**/\n#define IMPLEMENT_PEM_write_fp(name, type, str, asn1) /**/\n#define IMPLEMENT_PEM_write_fp_const(name, type, str, asn1) /**/\n#define IMPLEMENT_PEM_write_cb_fp(name, type, str, asn1) /**/\n#define IMPLEMENT_PEM_write_cb_fp_const(name, type, str, asn1) /**/\n\n#else\n\n#define IMPLEMENT_PEM_read_fp(name, type, str, asn1) \\\ntype *PEM_read_##name(FILE *fp, type **x, pem_password_cb *cb, void *u)\\\n{ \\\n    return (type*)PEM_ASN1_read(CHECKED_D2I_OF(type, d2i_##asn1), \\\n\t\t\t\tstr, fp, \\\n\t\t\t\tCHECKED_PPTR_OF(type, x), \\\n\t\t\t\tcb, u); \\\n} \n\n#define IMPLEMENT_PEM_write_fp(name, type, str, asn1) \\\nint PEM_write_##name(FILE *fp, type *x) \\\n{ \\\n    return PEM_ASN1_write(CHECKED_I2D_OF(type, i2d_##asn1), \\\n\t\t\t  str, fp, \\\n\t\t\t  CHECKED_PTR_OF(type, x), \\\n\t\t\t  NULL, NULL, 0, NULL, NULL); \\\n}\n\n#define IMPLEMENT_PEM_write_fp_const(name, type, str, asn1) \\\nint PEM_write_##name(FILE *fp, const type *x) \\\n{ \\\n    return PEM_ASN1_write(CHECKED_I2D_OF(const type, i2d_##asn1), \\\n\t\t\t  str, fp, \\\n\t\t\t  CHECKED_PTR_OF(const type, x), \\\n\t\t\t  NULL, NULL, 0, NULL, NULL); \\\n}\n\n#define IMPLEMENT_PEM_write_cb_fp(name, type, str, asn1) \\\nint PEM_write_##name(FILE *fp, type *x, const EVP_CIPHER *enc, \\\n\t     unsigned char *kstr, int klen, pem_password_cb *cb, \\\n\t\t  void *u) \\\n\t{ \\\n\t    return PEM_ASN1_write(CHECKED_I2D_OF(type, i2d_##asn1), \\\n\t\t\t\t  str, fp, \\\n\t\t\t\t  CHECKED_PTR_OF(type, x), \\\n\t\t\t\t  enc, kstr, klen, cb, u); \\\n\t}\n\n#define IMPLEMENT_PEM_write_cb_fp_const(name, type, str, asn1) \\\nint PEM_write_##name(FILE *fp, type *x, const EVP_CIPHER *enc, \\\n\t     unsigned char *kstr, int klen, pem_password_cb *cb, \\\n\t\t  void *u) \\\n\t{ \\\n\t    return PEM_ASN1_write(CHECKED_I2D_OF(const type, i2d_##asn1), \\\n\t\t\t\t  str, fp, \\\n\t\t\t\t  CHECKED_PTR_OF(const type, x), \\\n\t\t\t\t  enc, kstr, klen, cb, u); \\\n\t}\n\n#endif\n\n#define IMPLEMENT_PEM_read_bio(name, type, str, asn1) \\\ntype *PEM_read_bio_##name(BIO *bp, type **x, pem_password_cb *cb, void *u)\\\n{ \\\n    return (type*)PEM_ASN1_read_bio(CHECKED_D2I_OF(type, d2i_##asn1), \\\n\t\t\t\t    str, bp, \\\n\t\t\t\t    CHECKED_PPTR_OF(type, x), \\\n\t\t\t\t    cb, u); \\\n}\n\n#define IMPLEMENT_PEM_write_bio(name, type, str, asn1) \\\nint PEM_write_bio_##name(BIO *bp, type *x) \\\n{ \\\n    return PEM_ASN1_write_bio(CHECKED_I2D_OF(type, i2d_##asn1), \\\n\t\t\t      str, bp, \\\n\t\t\t      CHECKED_PTR_OF(type, x), \\\n\t\t\t      NULL, NULL, 0, NULL, NULL); \\\n}\n\n#define IMPLEMENT_PEM_write_bio_const(name, type, str, asn1) \\\nint PEM_write_bio_##name(BIO *bp, const type *x) \\\n{ \\\n    return PEM_ASN1_write_bio(CHECKED_I2D_OF(const type, i2d_##asn1), \\\n\t\t\t      str, bp, \\\n\t\t\t      CHECKED_PTR_OF(const type, x), \\\n\t\t\t      NULL, NULL, 0, NULL, NULL); \\\n}\n\n#define IMPLEMENT_PEM_write_cb_bio(name, type, str, asn1) \\\nint PEM_write_bio_##name(BIO *bp, type *x, const EVP_CIPHER *enc, \\\n\t     unsigned char *kstr, int klen, pem_password_cb *cb, void *u) \\\n\t{ \\\n\t    return PEM_ASN1_write_bio(CHECKED_I2D_OF(type, i2d_##asn1), \\\n\t\t\t\t      str, bp, \\\n\t\t\t\t      CHECKED_PTR_OF(type, x), \\\n\t\t\t\t      enc, kstr, klen, cb, u); \\\n\t}\n\n#define IMPLEMENT_PEM_write_cb_bio_const(name, type, str, asn1) \\\nint PEM_write_bio_##name(BIO *bp, type *x, const EVP_CIPHER *enc, \\\n\t     unsigned char *kstr, int klen, pem_password_cb *cb, void *u) \\\n\t{ \\\n\t    return PEM_ASN1_write_bio(CHECKED_I2D_OF(const type, i2d_##asn1), \\\n\t\t\t\t      str, bp, \\\n\t\t\t\t      CHECKED_PTR_OF(const type, x), \\\n\t\t\t\t      enc, kstr, klen, cb, u); \\\n\t}\n\n#define IMPLEMENT_PEM_write(name, type, str, asn1) \\\n\tIMPLEMENT_PEM_write_bio(name, type, str, asn1) \\\n\tIMPLEMENT_PEM_write_fp(name, type, str, asn1) \n\n#define IMPLEMENT_PEM_write_const(name, type, str, asn1) \\\n\tIMPLEMENT_PEM_write_bio_const(name, type, str, asn1) \\\n\tIMPLEMENT_PEM_write_fp_const(name, type, str, asn1) \n\n#define IMPLEMENT_PEM_write_cb(name, type, str, asn1) \\\n\tIMPLEMENT_PEM_write_cb_bio(name, type, str, asn1) \\\n\tIMPLEMENT_PEM_write_cb_fp(name, type, str, asn1) \n\n#define IMPLEMENT_PEM_write_cb_const(name, type, str, asn1) \\\n\tIMPLEMENT_PEM_write_cb_bio_const(name, type, str, asn1) \\\n\tIMPLEMENT_PEM_write_cb_fp_const(name, type, str, asn1) \n\n#define IMPLEMENT_PEM_read(name, type, str, asn1) \\\n\tIMPLEMENT_PEM_read_bio(name, type, str, asn1) \\\n\tIMPLEMENT_PEM_read_fp(name, type, str, asn1) \n\n#define IMPLEMENT_PEM_rw(name, type, str, asn1) \\\n\tIMPLEMENT_PEM_read(name, type, str, asn1) \\\n\tIMPLEMENT_PEM_write(name, type, str, asn1)\n\n#define IMPLEMENT_PEM_rw_const(name, type, str, asn1) \\\n\tIMPLEMENT_PEM_read(name, type, str, asn1) \\\n\tIMPLEMENT_PEM_write_const(name, type, str, asn1)\n\n#define IMPLEMENT_PEM_rw_cb(name, type, str, asn1) \\\n\tIMPLEMENT_PEM_read(name, type, str, asn1) \\\n\tIMPLEMENT_PEM_write_cb(name, type, str, asn1)\n\n/* These are the same except they are for the declarations */\n\n#if defined(OPENSSL_SYS_WIN16) || defined(OPENSSL_NO_FP_API)\n\n#define DECLARE_PEM_read_fp(name, type) /**/\n#define DECLARE_PEM_write_fp(name, type) /**/\n#define DECLARE_PEM_write_fp_const(name, type) /**/\n#define DECLARE_PEM_write_cb_fp(name, type) /**/\n\n#else\n\n#define DECLARE_PEM_read_fp(name, type) \\\n\ttype *PEM_read_##name(FILE *fp, type **x, pem_password_cb *cb, void *u);\n\n#define DECLARE_PEM_write_fp(name, type) \\\n\tint PEM_write_##name(FILE *fp, type *x);\n\n#define DECLARE_PEM_write_fp_const(name, type) \\\n\tint PEM_write_##name(FILE *fp, const type *x);\n\n#define DECLARE_PEM_write_cb_fp(name, type) \\\n\tint PEM_write_##name(FILE *fp, type *x, const EVP_CIPHER *enc, \\\n\t     unsigned char *kstr, int klen, pem_password_cb *cb, void *u);\n\n#endif\n\n#ifndef OPENSSL_NO_BIO\n#define DECLARE_PEM_read_bio(name, type) \\\n\ttype *PEM_read_bio_##name(BIO *bp, type **x, pem_password_cb *cb, void *u);\n\n#define DECLARE_PEM_write_bio(name, type) \\\n\tint PEM_write_bio_##name(BIO *bp, type *x);\n\n#define DECLARE_PEM_write_bio_const(name, type) \\\n\tint PEM_write_bio_##name(BIO *bp, const type *x);\n\n#define DECLARE_PEM_write_cb_bio(name, type) \\\n\tint PEM_write_bio_##name(BIO *bp, type *x, const EVP_CIPHER *enc, \\\n\t     unsigned char *kstr, int klen, pem_password_cb *cb, void *u);\n\n#else\n\n#define DECLARE_PEM_read_bio(name, type) /**/\n#define DECLARE_PEM_write_bio(name, type) /**/\n#define DECLARE_PEM_write_bio_const(name, type) /**/\n#define DECLARE_PEM_write_cb_bio(name, type) /**/\n\n#endif\n\n#define DECLARE_PEM_write(name, type) \\\n\tDECLARE_PEM_write_bio(name, type) \\\n\tDECLARE_PEM_write_fp(name, type) \n\n#define DECLARE_PEM_write_const(name, type) \\\n\tDECLARE_PEM_write_bio_const(name, type) \\\n\tDECLARE_PEM_write_fp_const(name, type)\n\n#define DECLARE_PEM_write_cb(name, type) \\\n\tDECLARE_PEM_write_cb_bio(name, type) \\\n\tDECLARE_PEM_write_cb_fp(name, type) \n\n#define DECLARE_PEM_read(name, type) \\\n\tDECLARE_PEM_read_bio(name, type) \\\n\tDECLARE_PEM_read_fp(name, type)\n\n#define DECLARE_PEM_rw(name, type) \\\n\tDECLARE_PEM_read(name, type) \\\n\tDECLARE_PEM_write(name, type)\n\n#define DECLARE_PEM_rw_const(name, type) \\\n\tDECLARE_PEM_read(name, type) \\\n\tDECLARE_PEM_write_const(name, type)\n\n#define DECLARE_PEM_rw_cb(name, type) \\\n\tDECLARE_PEM_read(name, type) \\\n\tDECLARE_PEM_write_cb(name, type)\n\n#ifdef SSLEAY_MACROS\n\n#define PEM_write_SSL_SESSION(fp,x) \\\n\t\tPEM_ASN1_write((int (*)())i2d_SSL_SESSION, \\\n\t\t\tPEM_STRING_SSL_SESSION,fp, (char *)x, NULL,NULL,0,NULL,NULL)\n#define PEM_write_X509(fp,x) \\\n\t\tPEM_ASN1_write((int (*)())i2d_X509,PEM_STRING_X509,fp, \\\n\t\t\t(char *)x, NULL,NULL,0,NULL,NULL)\n#define PEM_write_X509_REQ(fp,x) PEM_ASN1_write( \\\n\t\t(int (*)())i2d_X509_REQ,PEM_STRING_X509_REQ,fp,(char *)x, \\\n\t\t\tNULL,NULL,0,NULL,NULL)\n#define PEM_write_X509_CRL(fp,x) \\\n\t\tPEM_ASN1_write((int (*)())i2d_X509_CRL,PEM_STRING_X509_CRL, \\\n\t\t\tfp,(char *)x, NULL,NULL,0,NULL,NULL)\n#define\tPEM_write_RSAPrivateKey(fp,x,enc,kstr,klen,cb,u) \\\n\t\tPEM_ASN1_write((int (*)())i2d_RSAPrivateKey,PEM_STRING_RSA,fp,\\\n\t\t\t(char *)x,enc,kstr,klen,cb,u)\n#define\tPEM_write_RSAPublicKey(fp,x) \\\n\t\tPEM_ASN1_write((int (*)())i2d_RSAPublicKey,\\\n\t\t\tPEM_STRING_RSA_PUBLIC,fp,(char *)x,NULL,NULL,0,NULL,NULL)\n#define\tPEM_write_DSAPrivateKey(fp,x,enc,kstr,klen,cb,u) \\\n\t\tPEM_ASN1_write((int (*)())i2d_DSAPrivateKey,PEM_STRING_DSA,fp,\\\n\t\t\t(char *)x,enc,kstr,klen,cb,u)\n#define\tPEM_write_PrivateKey(bp,x,enc,kstr,klen,cb,u) \\\n\t\tPEM_ASN1_write((int (*)())i2d_PrivateKey,\\\n\t\t(((x)->type == EVP_PKEY_DSA)?PEM_STRING_DSA:PEM_STRING_RSA),\\\n\t\t\tbp,(char *)x,enc,kstr,klen,cb,u)\n#define PEM_write_PKCS7(fp,x) \\\n\t\tPEM_ASN1_write((int (*)())i2d_PKCS7,PEM_STRING_PKCS7,fp, \\\n\t\t\t(char *)x, NULL,NULL,0,NULL,NULL)\n#define PEM_write_DHparams(fp,x) \\\n\t\tPEM_ASN1_write((int (*)())i2d_DHparams,PEM_STRING_DHPARAMS,fp,\\\n\t\t\t(char *)x,NULL,NULL,0,NULL,NULL)\n\n#define PEM_write_NETSCAPE_CERT_SEQUENCE(fp,x) \\\n                PEM_ASN1_write((int (*)())i2d_NETSCAPE_CERT_SEQUENCE, \\\n\t\t\tPEM_STRING_X509,fp, \\\n                        (char *)x, NULL,NULL,0,NULL,NULL)\n\n#define\tPEM_read_SSL_SESSION(fp,x,cb,u) (SSL_SESSION *)PEM_ASN1_read( \\\n\t(char *(*)())d2i_SSL_SESSION,PEM_STRING_SSL_SESSION,fp,(char **)x,cb,u)\n#define\tPEM_read_X509(fp,x,cb,u) (X509 *)PEM_ASN1_read( \\\n\t(char *(*)())d2i_X509,PEM_STRING_X509,fp,(char **)x,cb,u)\n#define\tPEM_read_X509_REQ(fp,x,cb,u) (X509_REQ *)PEM_ASN1_read( \\\n\t(char *(*)())d2i_X509_REQ,PEM_STRING_X509_REQ,fp,(char **)x,cb,u)\n#define\tPEM_read_X509_CRL(fp,x,cb,u) (X509_CRL *)PEM_ASN1_read( \\\n\t(char *(*)())d2i_X509_CRL,PEM_STRING_X509_CRL,fp,(char **)x,cb,u)\n#define\tPEM_read_RSAPrivateKey(fp,x,cb,u) (RSA *)PEM_ASN1_read( \\\n\t(char *(*)())d2i_RSAPrivateKey,PEM_STRING_RSA,fp,(char **)x,cb,u)\n#define\tPEM_read_RSAPublicKey(fp,x,cb,u) (RSA *)PEM_ASN1_read( \\\n\t(char *(*)())d2i_RSAPublicKey,PEM_STRING_RSA_PUBLIC,fp,(char **)x,cb,u)\n#define\tPEM_read_DSAPrivateKey(fp,x,cb,u) (DSA *)PEM_ASN1_read( \\\n\t(char *(*)())d2i_DSAPrivateKey,PEM_STRING_DSA,fp,(char **)x,cb,u)\n#define\tPEM_read_PrivateKey(fp,x,cb,u) (EVP_PKEY *)PEM_ASN1_read( \\\n\t(char *(*)())d2i_PrivateKey,PEM_STRING_EVP_PKEY,fp,(char **)x,cb,u)\n#define\tPEM_read_PKCS7(fp,x,cb,u) (PKCS7 *)PEM_ASN1_read( \\\n\t(char *(*)())d2i_PKCS7,PEM_STRING_PKCS7,fp,(char **)x,cb,u)\n#define\tPEM_read_DHparams(fp,x,cb,u) (DH *)PEM_ASN1_read( \\\n\t(char *(*)())d2i_DHparams,PEM_STRING_DHPARAMS,fp,(char **)x,cb,u)\n\n#define PEM_read_NETSCAPE_CERT_SEQUENCE(fp,x,cb,u) \\\n\t\t(NETSCAPE_CERT_SEQUENCE *)PEM_ASN1_read( \\\n        (char *(*)())d2i_NETSCAPE_CERT_SEQUENCE,PEM_STRING_X509,fp,\\\n\t\t\t\t\t\t\t(char **)x,cb,u)\n\n#define PEM_write_bio_X509(bp,x) \\\n\t\tPEM_ASN1_write_bio((int (*)())i2d_X509,PEM_STRING_X509,bp, \\\n\t\t\t(char *)x, NULL,NULL,0,NULL,NULL)\n#define PEM_write_bio_X509_REQ(bp,x) PEM_ASN1_write_bio( \\\n\t\t(int (*)())i2d_X509_REQ,PEM_STRING_X509_REQ,bp,(char *)x, \\\n\t\t\tNULL,NULL,0,NULL,NULL)\n#define PEM_write_bio_X509_CRL(bp,x) \\\n\t\tPEM_ASN1_write_bio((int (*)())i2d_X509_CRL,PEM_STRING_X509_CRL,\\\n\t\t\tbp,(char *)x, NULL,NULL,0,NULL,NULL)\n#define\tPEM_write_bio_RSAPrivateKey(bp,x,enc,kstr,klen,cb,u) \\\n\t\tPEM_ASN1_write_bio((int (*)())i2d_RSAPrivateKey,PEM_STRING_RSA,\\\n\t\t\tbp,(char *)x,enc,kstr,klen,cb,u)\n#define\tPEM_write_bio_RSAPublicKey(bp,x) \\\n\t\tPEM_ASN1_write_bio((int (*)())i2d_RSAPublicKey, \\\n\t\t\tPEM_STRING_RSA_PUBLIC,\\\n\t\t\tbp,(char *)x,NULL,NULL,0,NULL,NULL)\n#define\tPEM_write_bio_DSAPrivateKey(bp,x,enc,kstr,klen,cb,u) \\\n\t\tPEM_ASN1_write_bio((int (*)())i2d_DSAPrivateKey,PEM_STRING_DSA,\\\n\t\t\tbp,(char *)x,enc,kstr,klen,cb,u)\n#define\tPEM_write_bio_PrivateKey(bp,x,enc,kstr,klen,cb,u) \\\n\t\tPEM_ASN1_write_bio((int (*)())i2d_PrivateKey,\\\n\t\t(((x)->type == EVP_PKEY_DSA)?PEM_STRING_DSA:PEM_STRING_RSA),\\\n\t\t\tbp,(char *)x,enc,kstr,klen,cb,u)\n#define PEM_write_bio_PKCS7(bp,x) \\\n\t\tPEM_ASN1_write_bio((int (*)())i2d_PKCS7,PEM_STRING_PKCS7,bp, \\\n\t\t\t(char *)x, NULL,NULL,0,NULL,NULL)\n#define PEM_write_bio_DHparams(bp,x) \\\n\t\tPEM_ASN1_write_bio((int (*)())i2d_DHparams,PEM_STRING_DHPARAMS,\\\n\t\t\tbp,(char *)x,NULL,NULL,0,NULL,NULL)\n#define PEM_write_bio_DSAparams(bp,x) \\\n\t\tPEM_ASN1_write_bio((int (*)())i2d_DSAparams, \\\n\t\t\tPEM_STRING_DSAPARAMS,bp,(char *)x,NULL,NULL,0,NULL,NULL)\n\n#define PEM_write_bio_NETSCAPE_CERT_SEQUENCE(bp,x) \\\n                PEM_ASN1_write_bio((int (*)())i2d_NETSCAPE_CERT_SEQUENCE, \\\n\t\t\tPEM_STRING_X509,bp, \\\n                        (char *)x, NULL,NULL,0,NULL,NULL)\n\n#define\tPEM_read_bio_X509(bp,x,cb,u) (X509 *)PEM_ASN1_read_bio( \\\n\t(char *(*)())d2i_X509,PEM_STRING_X509,bp,(char **)x,cb,u)\n#define\tPEM_read_bio_X509_REQ(bp,x,cb,u) (X509_REQ *)PEM_ASN1_read_bio( \\\n\t(char *(*)())d2i_X509_REQ,PEM_STRING_X509_REQ,bp,(char **)x,cb,u)\n#define\tPEM_read_bio_X509_CRL(bp,x,cb,u) (X509_CRL *)PEM_ASN1_read_bio( \\\n\t(char *(*)())d2i_X509_CRL,PEM_STRING_X509_CRL,bp,(char **)x,cb,u)\n#define\tPEM_read_bio_RSAPrivateKey(bp,x,cb,u) (RSA *)PEM_ASN1_read_bio( \\\n\t(char *(*)())d2i_RSAPrivateKey,PEM_STRING_RSA,bp,(char **)x,cb,u)\n#define\tPEM_read_bio_RSAPublicKey(bp,x,cb,u) (RSA *)PEM_ASN1_read_bio( \\\n\t(char *(*)())d2i_RSAPublicKey,PEM_STRING_RSA_PUBLIC,bp,(char **)x,cb,u)\n#define\tPEM_read_bio_DSAPrivateKey(bp,x,cb,u) (DSA *)PEM_ASN1_read_bio( \\\n\t(char *(*)())d2i_DSAPrivateKey,PEM_STRING_DSA,bp,(char **)x,cb,u)\n#define\tPEM_read_bio_PrivateKey(bp,x,cb,u) (EVP_PKEY *)PEM_ASN1_read_bio( \\\n\t(char *(*)())d2i_PrivateKey,PEM_STRING_EVP_PKEY,bp,(char **)x,cb,u)\n\n#define\tPEM_read_bio_PKCS7(bp,x,cb,u) (PKCS7 *)PEM_ASN1_read_bio( \\\n\t(char *(*)())d2i_PKCS7,PEM_STRING_PKCS7,bp,(char **)x,cb,u)\n#define\tPEM_read_bio_DHparams(bp,x,cb,u) (DH *)PEM_ASN1_read_bio( \\\n\t(char *(*)())d2i_DHparams,PEM_STRING_DHPARAMS,bp,(char **)x,cb,u)\n#define\tPEM_read_bio_DSAparams(bp,x,cb,u) (DSA *)PEM_ASN1_read_bio( \\\n\t(char *(*)())d2i_DSAparams,PEM_STRING_DSAPARAMS,bp,(char **)x,cb,u)\n\n#define PEM_read_bio_NETSCAPE_CERT_SEQUENCE(bp,x,cb,u) \\\n\t\t(NETSCAPE_CERT_SEQUENCE *)PEM_ASN1_read_bio( \\\n        (char *(*)())d2i_NETSCAPE_CERT_SEQUENCE,PEM_STRING_X509,bp,\\\n\t\t\t\t\t\t\t(char **)x,cb,u)\n\n#endif\n\n#if 1\n/* \"userdata\": new with OpenSSL 0.9.4 */\ntypedef int pem_password_cb(char *buf, int size, int rwflag, void *userdata);\n#else\n/* OpenSSL 0.9.3, 0.9.3a */\ntypedef int pem_password_cb(char *buf, int size, int rwflag);\n#endif\n\nint\tPEM_get_EVP_CIPHER_INFO(char *header, EVP_CIPHER_INFO *cipher);\nint\tPEM_do_header (EVP_CIPHER_INFO *cipher, unsigned char *data,long *len,\n\tpem_password_cb *callback,void *u);\n\n#ifndef OPENSSL_NO_BIO\nint\tPEM_read_bio(BIO *bp, char **name, char **header,\n\t\tunsigned char **data,long *len);\nint\tPEM_write_bio(BIO *bp,const char *name,char *hdr,unsigned char *data,\n\t\tlong len);\nint PEM_bytes_read_bio(unsigned char **pdata, long *plen, char **pnm, const char *name, BIO *bp,\n\t     pem_password_cb *cb, void *u);\nvoid *\tPEM_ASN1_read_bio(d2i_of_void *d2i, const char *name, BIO *bp,\n\t\t\t  void **x, pem_password_cb *cb, void *u);\n\n#define PEM_ASN1_read_bio_of(type,d2i,name,bp,x,cb,u) \\\n    ((type*)PEM_ASN1_read_bio(CHECKED_D2I_OF(type, d2i), \\\n\t\t\t      name, bp,\t\t\t\\\n\t\t\t      CHECKED_PPTR_OF(type, x), \\\n\t\t\t      cb, u))\n\nint\tPEM_ASN1_write_bio(i2d_of_void *i2d,const char *name,BIO *bp,char *x,\n\t\t\t   const EVP_CIPHER *enc,unsigned char *kstr,int klen,\n\t\t\t   pem_password_cb *cb, void *u);\n\n#define PEM_ASN1_write_bio_of(type,i2d,name,bp,x,enc,kstr,klen,cb,u) \\\n    (PEM_ASN1_write_bio(CHECKED_I2D_OF(type, i2d), \\\n\t\t\tname, bp,\t\t   \\\n\t\t\tCHECKED_PTR_OF(type, x), \\\n\t\t\tenc, kstr, klen, cb, u))\n\nSTACK_OF(X509_INFO) *\tPEM_X509_INFO_read_bio(BIO *bp, STACK_OF(X509_INFO) *sk, pem_password_cb *cb, void *u);\nint\tPEM_X509_INFO_write_bio(BIO *bp,X509_INFO *xi, EVP_CIPHER *enc,\n\t\tunsigned char *kstr, int klen, pem_password_cb *cd, void *u);\n#endif\n\n#ifndef OPENSSL_SYS_WIN16\nint\tPEM_read(FILE *fp, char **name, char **header,\n\t\tunsigned char **data,long *len);\nint\tPEM_write(FILE *fp,char *name,char *hdr,unsigned char *data,long len);\nvoid *  PEM_ASN1_read(d2i_of_void *d2i, const char *name, FILE *fp, void **x,\n\t\t      pem_password_cb *cb, void *u);\nint\tPEM_ASN1_write(i2d_of_void *i2d,const char *name,FILE *fp,\n\t\t       char *x,const EVP_CIPHER *enc,unsigned char *kstr,\n\t\t       int klen,pem_password_cb *callback, void *u);\nSTACK_OF(X509_INFO) *\tPEM_X509_INFO_read(FILE *fp, STACK_OF(X509_INFO) *sk,\n\tpem_password_cb *cb, void *u);\n#endif\n\nint\tPEM_SealInit(PEM_ENCODE_SEAL_CTX *ctx, EVP_CIPHER *type,\n\t\tEVP_MD *md_type, unsigned char **ek, int *ekl,\n\t\tunsigned char *iv, EVP_PKEY **pubk, int npubk);\nvoid\tPEM_SealUpdate(PEM_ENCODE_SEAL_CTX *ctx, unsigned char *out, int *outl,\n\t\tunsigned char *in, int inl);\nint\tPEM_SealFinal(PEM_ENCODE_SEAL_CTX *ctx, unsigned char *sig,int *sigl,\n\t\tunsigned char *out, int *outl, EVP_PKEY *priv);\n\nvoid    PEM_SignInit(EVP_MD_CTX *ctx, EVP_MD *type);\nvoid    PEM_SignUpdate(EVP_MD_CTX *ctx,unsigned char *d,unsigned int cnt);\nint\tPEM_SignFinal(EVP_MD_CTX *ctx, unsigned char *sigret,\n\t\tunsigned int *siglen, EVP_PKEY *pkey);\n\nint\tPEM_def_callback(char *buf, int num, int w, void *key);\nvoid\tPEM_proc_type(char *buf, int type);\nvoid\tPEM_dek_info(char *buf, const char *type, int len, char *str);\n\n#ifndef SSLEAY_MACROS\n\n#include <openssl/symhacks.h>\n\nDECLARE_PEM_rw(X509, X509)\n\nDECLARE_PEM_rw(X509_AUX, X509)\n\nDECLARE_PEM_rw(X509_CERT_PAIR, X509_CERT_PAIR)\n\nDECLARE_PEM_rw(X509_REQ, X509_REQ)\nDECLARE_PEM_write(X509_REQ_NEW, X509_REQ)\n\nDECLARE_PEM_rw(X509_CRL, X509_CRL)\n\nDECLARE_PEM_rw(PKCS7, PKCS7)\n\nDECLARE_PEM_rw(NETSCAPE_CERT_SEQUENCE, NETSCAPE_CERT_SEQUENCE)\n\nDECLARE_PEM_rw(PKCS8, X509_SIG)\n\nDECLARE_PEM_rw(PKCS8_PRIV_KEY_INFO, PKCS8_PRIV_KEY_INFO)\n\n#ifndef OPENSSL_NO_RSA\n\nDECLARE_PEM_rw_cb(RSAPrivateKey, RSA)\n\nDECLARE_PEM_rw_const(RSAPublicKey, RSA)\nDECLARE_PEM_rw(RSA_PUBKEY, RSA)\n\n#endif\n\n#ifndef OPENSSL_NO_DSA\n\nDECLARE_PEM_rw_cb(DSAPrivateKey, DSA)\n\nDECLARE_PEM_rw(DSA_PUBKEY, DSA)\n\nDECLARE_PEM_rw_const(DSAparams, DSA)\n\n#endif\n\n#ifndef OPENSSL_NO_EC\nDECLARE_PEM_rw_const(ECPKParameters, EC_GROUP)\nDECLARE_PEM_rw_cb(ECPrivateKey, EC_KEY)\nDECLARE_PEM_rw(EC_PUBKEY, EC_KEY)\n#endif\n\n#ifndef OPENSSL_NO_DH\n\nDECLARE_PEM_rw_const(DHparams, DH)\n\n#endif\n\nDECLARE_PEM_rw_cb(PrivateKey, EVP_PKEY)\n\nDECLARE_PEM_rw(PUBKEY, EVP_PKEY)\n\nint PEM_write_bio_PKCS8PrivateKey_nid(BIO *bp, EVP_PKEY *x, int nid,\n\t\t\t\t  char *kstr, int klen,\n\t\t\t\t  pem_password_cb *cb, void *u);\nint PEM_write_bio_PKCS8PrivateKey(BIO *, EVP_PKEY *, const EVP_CIPHER *,\n                                  char *, int, pem_password_cb *, void *);\nint i2d_PKCS8PrivateKey_bio(BIO *bp, EVP_PKEY *x, const EVP_CIPHER *enc,\n\t\t\t\t  char *kstr, int klen,\n\t\t\t\t  pem_password_cb *cb, void *u);\nint i2d_PKCS8PrivateKey_nid_bio(BIO *bp, EVP_PKEY *x, int nid,\n\t\t\t\t  char *kstr, int klen,\n\t\t\t\t  pem_password_cb *cb, void *u);\nEVP_PKEY *d2i_PKCS8PrivateKey_bio(BIO *bp, EVP_PKEY **x, pem_password_cb *cb, void *u);\n\nint i2d_PKCS8PrivateKey_fp(FILE *fp, EVP_PKEY *x, const EVP_CIPHER *enc,\n\t\t\t\t  char *kstr, int klen,\n\t\t\t\t  pem_password_cb *cb, void *u);\nint i2d_PKCS8PrivateKey_nid_fp(FILE *fp, EVP_PKEY *x, int nid,\n\t\t\t\t  char *kstr, int klen,\n\t\t\t\t  pem_password_cb *cb, void *u);\nint PEM_write_PKCS8PrivateKey_nid(FILE *fp, EVP_PKEY *x, int nid,\n\t\t\t\t  char *kstr, int klen,\n\t\t\t\t  pem_password_cb *cb, void *u);\n\nEVP_PKEY *d2i_PKCS8PrivateKey_fp(FILE *fp, EVP_PKEY **x, pem_password_cb *cb, void *u);\n\nint PEM_write_PKCS8PrivateKey(FILE *fp,EVP_PKEY *x,const EVP_CIPHER *enc,\n\t\t\t      char *kstr,int klen, pem_password_cb *cd, void *u);\n\n#endif /* SSLEAY_MACROS */\n\n\n/* BEGIN ERROR CODES */\n/* The following lines are auto generated by the script mkerr.pl. Any changes\n * made after this point may be overwritten when the script is next run.\n */\nvoid ERR_load_PEM_strings(void);\n\n/* Error codes for the PEM functions. */\n\n/* Function codes. */\n#define PEM_F_D2I_PKCS8PRIVATEKEY_BIO\t\t\t 120\n#define PEM_F_D2I_PKCS8PRIVATEKEY_FP\t\t\t 121\n#define PEM_F_DO_PK8PKEY\t\t\t\t 126\n#define PEM_F_DO_PK8PKEY_FP\t\t\t\t 125\n#define PEM_F_LOAD_IV\t\t\t\t\t 101\n#define PEM_F_PEM_ASN1_READ\t\t\t\t 102\n#define PEM_F_PEM_ASN1_READ_BIO\t\t\t\t 103\n#define PEM_F_PEM_ASN1_WRITE\t\t\t\t 104\n#define PEM_F_PEM_ASN1_WRITE_BIO\t\t\t 105\n#define PEM_F_PEM_DEF_CALLBACK\t\t\t\t 100\n#define PEM_F_PEM_DO_HEADER\t\t\t\t 106\n#define PEM_F_PEM_F_PEM_WRITE_PKCS8PRIVATEKEY\t\t 118\n#define PEM_F_PEM_GET_EVP_CIPHER_INFO\t\t\t 107\n#define PEM_F_PEM_PK8PKEY\t\t\t\t 119\n#define PEM_F_PEM_READ\t\t\t\t\t 108\n#define PEM_F_PEM_READ_BIO\t\t\t\t 109\n#define PEM_F_PEM_READ_BIO_PRIVATEKEY\t\t\t 123\n#define PEM_F_PEM_READ_PRIVATEKEY\t\t\t 124\n#define PEM_F_PEM_SEALFINAL\t\t\t\t 110\n#define PEM_F_PEM_SEALINIT\t\t\t\t 111\n#define PEM_F_PEM_SIGNFINAL\t\t\t\t 112\n#define PEM_F_PEM_WRITE\t\t\t\t\t 113\n#define PEM_F_PEM_WRITE_BIO\t\t\t\t 114\n#define PEM_F_PEM_X509_INFO_READ\t\t\t 115\n#define PEM_F_PEM_X509_INFO_READ_BIO\t\t\t 116\n#define PEM_F_PEM_X509_INFO_WRITE_BIO\t\t\t 117\n\n/* Reason codes. */\n#define PEM_R_BAD_BASE64_DECODE\t\t\t\t 100\n#define PEM_R_BAD_DECRYPT\t\t\t\t 101\n#define PEM_R_BAD_END_LINE\t\t\t\t 102\n#define PEM_R_BAD_IV_CHARS\t\t\t\t 103\n#define PEM_R_BAD_PASSWORD_READ\t\t\t\t 104\n#define PEM_R_ERROR_CONVERTING_PRIVATE_KEY\t\t 115\n#define PEM_R_NOT_DEK_INFO\t\t\t\t 105\n#define PEM_R_NOT_ENCRYPTED\t\t\t\t 106\n#define PEM_R_NOT_PROC_TYPE\t\t\t\t 107\n#define PEM_R_NO_START_LINE\t\t\t\t 108\n#define PEM_R_PROBLEMS_GETTING_PASSWORD\t\t\t 109\n#define PEM_R_PUBLIC_KEY_NO_RSA\t\t\t\t 110\n#define PEM_R_READ_KEY\t\t\t\t\t 111\n#define PEM_R_SHORT_HEADER\t\t\t\t 112\n#define PEM_R_UNSUPPORTED_CIPHER\t\t\t 113\n#define PEM_R_UNSUPPORTED_ENCRYPTION\t\t\t 114\n\n#ifdef  __cplusplus\n}\n#endif\n#endif\n"
  },
  {
    "path": "freebsd-headers/openssl/pem2.h",
    "content": "/* ====================================================================\n * Copyright (c) 1999 The OpenSSL Project.  All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n *\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer. \n *\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in\n *    the documentation and/or other materials provided with the\n *    distribution.\n *\n * 3. All advertising materials mentioning features or use of this\n *    software must display the following acknowledgment:\n *    \"This product includes software developed by the OpenSSL Project\n *    for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)\"\n *\n * 4. The names \"OpenSSL Toolkit\" and \"OpenSSL Project\" must not be used to\n *    endorse or promote products derived from this software without\n *    prior written permission. For written permission, please contact\n *    licensing@OpenSSL.org.\n *\n * 5. Products derived from this software may not be called \"OpenSSL\"\n *    nor may \"OpenSSL\" appear in their names without prior written\n *    permission of the OpenSSL Project.\n *\n * 6. Redistributions of any form whatsoever must retain the following\n *    acknowledgment:\n *    \"This product includes software developed by the OpenSSL Project\n *    for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)\"\n *\n * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY\n * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\n * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE OpenSSL PROJECT OR\n * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\n * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,\n * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED\n * OF THE POSSIBILITY OF SUCH DAMAGE.\n * ====================================================================\n *\n * This product includes cryptographic software written by Eric Young\n * (eay@cryptsoft.com).  This product includes software written by Tim\n * Hudson (tjh@cryptsoft.com).\n *\n */\n\n/*\n * This header only exists to break a circular dependency between pem and err\n * Ben 30 Jan 1999.\n */\n\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\n#ifndef HEADER_PEM_H\nvoid ERR_load_PEM_strings(void);\n#endif\n\n#ifdef __cplusplus\n}\n#endif\n"
  },
  {
    "path": "freebsd-headers/openssl/pkcs12.h",
    "content": "/* pkcs12.h */\n/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL\n * project 1999.\n */\n/* ====================================================================\n * Copyright (c) 1999 The OpenSSL Project.  All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n *\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer. \n *\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in\n *    the documentation and/or other materials provided with the\n *    distribution.\n *\n * 3. All advertising materials mentioning features or use of this\n *    software must display the following acknowledgment:\n *    \"This product includes software developed by the OpenSSL Project\n *    for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)\"\n *\n * 4. The names \"OpenSSL Toolkit\" and \"OpenSSL Project\" must not be used to\n *    endorse or promote products derived from this software without\n *    prior written permission. For written permission, please contact\n *    licensing@OpenSSL.org.\n *\n * 5. Products derived from this software may not be called \"OpenSSL\"\n *    nor may \"OpenSSL\" appear in their names without prior written\n *    permission of the OpenSSL Project.\n *\n * 6. Redistributions of any form whatsoever must retain the following\n *    acknowledgment:\n *    \"This product includes software developed by the OpenSSL Project\n *    for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)\"\n *\n * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY\n * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\n * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE OpenSSL PROJECT OR\n * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\n * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,\n * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED\n * OF THE POSSIBILITY OF SUCH DAMAGE.\n * ====================================================================\n *\n * This product includes cryptographic software written by Eric Young\n * (eay@cryptsoft.com).  This product includes software written by Tim\n * Hudson (tjh@cryptsoft.com).\n *\n */\n\n#ifndef HEADER_PKCS12_H\n#define HEADER_PKCS12_H\n\n#include <openssl/bio.h>\n#include <openssl/x509.h>\n\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\n#define PKCS12_KEY_ID\t1\n#define PKCS12_IV_ID\t2\n#define PKCS12_MAC_ID\t3\n\n/* Default iteration count */\n#ifndef PKCS12_DEFAULT_ITER\n#define PKCS12_DEFAULT_ITER\tPKCS5_DEFAULT_ITER\n#endif\n\n#define PKCS12_MAC_KEY_LENGTH 20\n\n#define PKCS12_SALT_LEN\t8\n\n/* Uncomment out next line for unicode password and names, otherwise ASCII */\n\n/*#define PBE_UNICODE*/\n\n#ifdef PBE_UNICODE\n#define PKCS12_key_gen PKCS12_key_gen_uni\n#define PKCS12_add_friendlyname PKCS12_add_friendlyname_uni\n#else\n#define PKCS12_key_gen PKCS12_key_gen_asc\n#define PKCS12_add_friendlyname PKCS12_add_friendlyname_asc\n#endif\n\n/* MS key usage constants */\n\n#define KEY_EX\t0x10\n#define KEY_SIG 0x80\n\ntypedef struct {\nX509_SIG *dinfo;\nASN1_OCTET_STRING *salt;\nASN1_INTEGER *iter;\t/* defaults to 1 */\n} PKCS12_MAC_DATA;\n\ntypedef struct {\nASN1_INTEGER *version;\nPKCS12_MAC_DATA *mac;\nPKCS7 *authsafes;\n} PKCS12;\n\nPREDECLARE_STACK_OF(PKCS12_SAFEBAG)\n\ntypedef struct {\nASN1_OBJECT *type;\nunion {\n\tstruct pkcs12_bag_st *bag; /* secret, crl and certbag */\n\tstruct pkcs8_priv_key_info_st\t*keybag; /* keybag */\n\tX509_SIG *shkeybag; /* shrouded key bag */\n\tSTACK_OF(PKCS12_SAFEBAG) *safes;\n\tASN1_TYPE *other;\n}value;\nSTACK_OF(X509_ATTRIBUTE) *attrib;\n} PKCS12_SAFEBAG;\n\nDECLARE_STACK_OF(PKCS12_SAFEBAG)\nDECLARE_ASN1_SET_OF(PKCS12_SAFEBAG)\nDECLARE_PKCS12_STACK_OF(PKCS12_SAFEBAG)\n\ntypedef struct pkcs12_bag_st {\nASN1_OBJECT *type;\nunion {\n\tASN1_OCTET_STRING *x509cert;\n\tASN1_OCTET_STRING *x509crl;\n\tASN1_OCTET_STRING *octet;\n\tASN1_IA5STRING *sdsicert;\n\tASN1_TYPE *other; /* Secret or other bag */\n}value;\n} PKCS12_BAGS;\n\n#define PKCS12_ERROR\t0\n#define PKCS12_OK\t1\n\n/* Compatibility macros */\n\n#define M_PKCS12_x5092certbag PKCS12_x5092certbag\n#define M_PKCS12_x509crl2certbag PKCS12_x509crl2certbag\n\n#define M_PKCS12_certbag2x509 PKCS12_certbag2x509\n#define M_PKCS12_certbag2x509crl PKCS12_certbag2x509crl \n\n#define M_PKCS12_unpack_p7data PKCS12_unpack_p7data\n#define M_PKCS12_pack_authsafes PKCS12_pack_authsafes\n#define M_PKCS12_unpack_authsafes PKCS12_unpack_authsafes\n#define M_PKCS12_unpack_p7encdata PKCS12_unpack_p7encdata\n\n#define M_PKCS12_decrypt_skey PKCS12_decrypt_skey\n#define M_PKCS8_decrypt PKCS8_decrypt\n\n#define M_PKCS12_bag_type(bg) OBJ_obj2nid((bg)->type)\n#define M_PKCS12_cert_bag_type(bg) OBJ_obj2nid((bg)->value.bag->type)\n#define M_PKCS12_crl_bag_type M_PKCS12_cert_bag_type\n\n#define PKCS12_get_attr(bag, attr_nid) \\\n\t\t\t PKCS12_get_attr_gen(bag->attrib, attr_nid)\n\n#define PKCS8_get_attr(p8, attr_nid) \\\n\t\tPKCS12_get_attr_gen(p8->attributes, attr_nid)\n\n#define PKCS12_mac_present(p12) ((p12)->mac ? 1 : 0)\n\n\nPKCS12_SAFEBAG *PKCS12_x5092certbag(X509 *x509);\nPKCS12_SAFEBAG *PKCS12_x509crl2certbag(X509_CRL *crl);\nX509 *PKCS12_certbag2x509(PKCS12_SAFEBAG *bag);\nX509_CRL *PKCS12_certbag2x509crl(PKCS12_SAFEBAG *bag);\n\nPKCS12_SAFEBAG *PKCS12_item_pack_safebag(void *obj, const ASN1_ITEM *it, int nid1,\n\t     int nid2);\nPKCS12_SAFEBAG *PKCS12_MAKE_KEYBAG(PKCS8_PRIV_KEY_INFO *p8);\nPKCS8_PRIV_KEY_INFO *PKCS8_decrypt(X509_SIG *p8, const char *pass, int passlen);\nPKCS8_PRIV_KEY_INFO *PKCS12_decrypt_skey(PKCS12_SAFEBAG *bag, const char *pass,\n\t\t\t\t\t\t\t\tint passlen);\nX509_SIG *PKCS8_encrypt(int pbe_nid, const EVP_CIPHER *cipher, \n\t\t\tconst char *pass, int passlen,\n\t\t\tunsigned char *salt, int saltlen, int iter,\n\t\t\tPKCS8_PRIV_KEY_INFO *p8);\nPKCS12_SAFEBAG *PKCS12_MAKE_SHKEYBAG(int pbe_nid, const char *pass,\n\t\t\t\t     int passlen, unsigned char *salt,\n\t\t\t\t     int saltlen, int iter,\n\t\t\t\t     PKCS8_PRIV_KEY_INFO *p8);\nPKCS7 *PKCS12_pack_p7data(STACK_OF(PKCS12_SAFEBAG) *sk);\nSTACK_OF(PKCS12_SAFEBAG) *PKCS12_unpack_p7data(PKCS7 *p7);\nPKCS7 *PKCS12_pack_p7encdata(int pbe_nid, const char *pass, int passlen,\n\t\t\t     unsigned char *salt, int saltlen, int iter,\n\t\t\t     STACK_OF(PKCS12_SAFEBAG) *bags);\nSTACK_OF(PKCS12_SAFEBAG) *PKCS12_unpack_p7encdata(PKCS7 *p7, const char *pass, int passlen);\n\nint PKCS12_pack_authsafes(PKCS12 *p12, STACK_OF(PKCS7) *safes);\nSTACK_OF(PKCS7) *PKCS12_unpack_authsafes(PKCS12 *p12);\n\nint PKCS12_add_localkeyid(PKCS12_SAFEBAG *bag, unsigned char *name, int namelen);\nint PKCS12_add_friendlyname_asc(PKCS12_SAFEBAG *bag, const char *name,\n\t\t\t\tint namelen);\nint PKCS12_add_CSPName_asc(PKCS12_SAFEBAG *bag, const char *name,\n\t\t\t\tint namelen);\nint PKCS12_add_friendlyname_uni(PKCS12_SAFEBAG *bag, const unsigned char *name,\n\t\t\t\tint namelen);\nint PKCS8_add_keyusage(PKCS8_PRIV_KEY_INFO *p8, int usage);\nASN1_TYPE *PKCS12_get_attr_gen(STACK_OF(X509_ATTRIBUTE) *attrs, int attr_nid);\nchar *PKCS12_get_friendlyname(PKCS12_SAFEBAG *bag);\nunsigned char *PKCS12_pbe_crypt(X509_ALGOR *algor, const char *pass,\n\t\t\t\tint passlen, unsigned char *in, int inlen,\n\t\t\t\tunsigned char **data, int *datalen, int en_de);\nvoid * PKCS12_item_decrypt_d2i(X509_ALGOR *algor, const ASN1_ITEM *it,\n\t     const char *pass, int passlen, ASN1_OCTET_STRING *oct, int zbuf);\nASN1_OCTET_STRING *PKCS12_item_i2d_encrypt(X509_ALGOR *algor, const ASN1_ITEM *it,\n\t\t\t\t       const char *pass, int passlen,\n\t\t\t\t       void *obj, int zbuf);\nPKCS12 *PKCS12_init(int mode);\nint PKCS12_key_gen_asc(const char *pass, int passlen, unsigned char *salt,\n\t\t       int saltlen, int id, int iter, int n,\n\t\t       unsigned char *out, const EVP_MD *md_type);\nint 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);\nint PKCS12_PBE_keyivgen(EVP_CIPHER_CTX *ctx, const char *pass, int passlen,\n\t\t\t ASN1_TYPE *param, const EVP_CIPHER *cipher, const EVP_MD *md_type,\n\t\t\t int en_de);\nint PKCS12_gen_mac(PKCS12 *p12, const char *pass, int passlen,\n\t\t\t unsigned char *mac, unsigned int *maclen);\nint PKCS12_verify_mac(PKCS12 *p12, const char *pass, int passlen);\nint PKCS12_set_mac(PKCS12 *p12, const char *pass, int passlen,\n\t\t   unsigned char *salt, int saltlen, int iter,\n\t\t   const EVP_MD *md_type);\nint PKCS12_setup_mac(PKCS12 *p12, int iter, unsigned char *salt,\n\t\t\t\t\t int saltlen, const EVP_MD *md_type);\n#if defined(NETWARE) || defined(OPENSSL_SYS_NETWARE)\n/* Rename these functions to avoid name clashes on NetWare OS */\nunsigned char *OPENSSL_asc2uni(const char *asc, int asclen, unsigned char **uni, int *unilen);\nchar *OPENSSL_uni2asc(unsigned char *uni, int unilen);\n#else\nunsigned char *asc2uni(const char *asc, int asclen, unsigned char **uni, int *unilen);\nchar *uni2asc(unsigned char *uni, int unilen);\n#endif\nDECLARE_ASN1_FUNCTIONS(PKCS12)\nDECLARE_ASN1_FUNCTIONS(PKCS12_MAC_DATA)\nDECLARE_ASN1_FUNCTIONS(PKCS12_SAFEBAG)\nDECLARE_ASN1_FUNCTIONS(PKCS12_BAGS)\n\nDECLARE_ASN1_ITEM(PKCS12_SAFEBAGS)\nDECLARE_ASN1_ITEM(PKCS12_AUTHSAFES)\n\nvoid PKCS12_PBE_add(void);\nint PKCS12_parse(PKCS12 *p12, const char *pass, EVP_PKEY **pkey, X509 **cert,\n\t\t STACK_OF(X509) **ca);\nPKCS12 *PKCS12_create(char *pass, char *name, EVP_PKEY *pkey, X509 *cert,\n\t\t\t STACK_OF(X509) *ca, int nid_key, int nid_cert, int iter,\n\t\t\t\t\t\t int mac_iter, int keytype);\n\nPKCS12_SAFEBAG *PKCS12_add_cert(STACK_OF(PKCS12_SAFEBAG) **pbags, X509 *cert);\nPKCS12_SAFEBAG *PKCS12_add_key(STACK_OF(PKCS12_SAFEBAG) **pbags, EVP_PKEY *key,\n\t\t\t\t\t\tint key_usage, int iter,\n\t\t\t\t\t\tint key_nid, char *pass);\nint PKCS12_add_safe(STACK_OF(PKCS7) **psafes, STACK_OF(PKCS12_SAFEBAG) *bags,\n\t\t\t\t\tint safe_nid, int iter, char *pass);\nPKCS12 *PKCS12_add_safes(STACK_OF(PKCS7) *safes, int p7_nid);\n\nint i2d_PKCS12_bio(BIO *bp, PKCS12 *p12);\nint i2d_PKCS12_fp(FILE *fp, PKCS12 *p12);\nPKCS12 *d2i_PKCS12_bio(BIO *bp, PKCS12 **p12);\nPKCS12 *d2i_PKCS12_fp(FILE *fp, PKCS12 **p12);\nint PKCS12_newpass(PKCS12 *p12, char *oldpass, char *newpass);\n\n/* BEGIN ERROR CODES */\n/* The following lines are auto generated by the script mkerr.pl. Any changes\n * made after this point may be overwritten when the script is next run.\n */\nvoid ERR_load_PKCS12_strings(void);\n\n/* Error codes for the PKCS12 functions. */\n\n/* Function codes. */\n#define PKCS12_F_PARSE_BAG\t\t\t\t 129\n#define PKCS12_F_PARSE_BAGS\t\t\t\t 103\n#define PKCS12_F_PKCS12_ADD_FRIENDLYNAME\t\t 100\n#define PKCS12_F_PKCS12_ADD_FRIENDLYNAME_ASC\t\t 127\n#define PKCS12_F_PKCS12_ADD_FRIENDLYNAME_UNI\t\t 102\n#define PKCS12_F_PKCS12_ADD_LOCALKEYID\t\t\t 104\n#define PKCS12_F_PKCS12_CREATE\t\t\t\t 105\n#define PKCS12_F_PKCS12_GEN_MAC\t\t\t\t 107\n#define PKCS12_F_PKCS12_INIT\t\t\t\t 109\n#define PKCS12_F_PKCS12_ITEM_DECRYPT_D2I\t\t 106\n#define PKCS12_F_PKCS12_ITEM_I2D_ENCRYPT\t\t 108\n#define PKCS12_F_PKCS12_ITEM_PACK_SAFEBAG\t\t 117\n#define PKCS12_F_PKCS12_KEY_GEN_ASC\t\t\t 110\n#define PKCS12_F_PKCS12_KEY_GEN_UNI\t\t\t 111\n#define PKCS12_F_PKCS12_MAKE_KEYBAG\t\t\t 112\n#define PKCS12_F_PKCS12_MAKE_SHKEYBAG\t\t\t 113\n#define PKCS12_F_PKCS12_NEWPASS\t\t\t\t 128\n#define PKCS12_F_PKCS12_PACK_P7DATA\t\t\t 114\n#define PKCS12_F_PKCS12_PACK_P7ENCDATA\t\t\t 115\n#define PKCS12_F_PKCS12_PARSE\t\t\t\t 118\n#define PKCS12_F_PKCS12_PBE_CRYPT\t\t\t 119\n#define PKCS12_F_PKCS12_PBE_KEYIVGEN\t\t\t 120\n#define PKCS12_F_PKCS12_SETUP_MAC\t\t\t 122\n#define PKCS12_F_PKCS12_SET_MAC\t\t\t\t 123\n#define PKCS12_F_PKCS12_UNPACK_AUTHSAFES\t\t 130\n#define PKCS12_F_PKCS12_UNPACK_P7DATA\t\t\t 131\n#define PKCS12_F_PKCS12_VERIFY_MAC\t\t\t 126\n#define PKCS12_F_PKCS8_ADD_KEYUSAGE\t\t\t 124\n#define PKCS12_F_PKCS8_ENCRYPT\t\t\t\t 125\n\n/* Reason codes. */\n#define PKCS12_R_CANT_PACK_STRUCTURE\t\t\t 100\n#define PKCS12_R_CONTENT_TYPE_NOT_DATA\t\t\t 121\n#define PKCS12_R_DECODE_ERROR\t\t\t\t 101\n#define PKCS12_R_ENCODE_ERROR\t\t\t\t 102\n#define PKCS12_R_ENCRYPT_ERROR\t\t\t\t 103\n#define PKCS12_R_ERROR_SETTING_ENCRYPTED_DATA_TYPE\t 120\n#define PKCS12_R_INVALID_NULL_ARGUMENT\t\t\t 104\n#define PKCS12_R_INVALID_NULL_PKCS12_POINTER\t\t 105\n#define PKCS12_R_IV_GEN_ERROR\t\t\t\t 106\n#define PKCS12_R_KEY_GEN_ERROR\t\t\t\t 107\n#define PKCS12_R_MAC_ABSENT\t\t\t\t 108\n#define PKCS12_R_MAC_GENERATION_ERROR\t\t\t 109\n#define PKCS12_R_MAC_SETUP_ERROR\t\t\t 110\n#define PKCS12_R_MAC_STRING_SET_ERROR\t\t\t 111\n#define PKCS12_R_MAC_VERIFY_ERROR\t\t\t 112\n#define PKCS12_R_MAC_VERIFY_FAILURE\t\t\t 113\n#define PKCS12_R_PARSE_ERROR\t\t\t\t 114\n#define PKCS12_R_PKCS12_ALGOR_CIPHERINIT_ERROR\t\t 115\n#define PKCS12_R_PKCS12_CIPHERFINAL_ERROR\t\t 116\n#define PKCS12_R_PKCS12_PBE_CRYPT_ERROR\t\t\t 117\n#define PKCS12_R_UNKNOWN_DIGEST_ALGORITHM\t\t 118\n#define PKCS12_R_UNSUPPORTED_PKCS12_MODE\t\t 119\n\n#ifdef  __cplusplus\n}\n#endif\n#endif\n"
  },
  {
    "path": "freebsd-headers/openssl/pkcs7.h",
    "content": "/* crypto/pkcs7/pkcs7.h */\n/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)\n * All rights reserved.\n *\n * This package is an SSL implementation written\n * by Eric Young (eay@cryptsoft.com).\n * The implementation was written so as to conform with Netscapes SSL.\n * \n * This library is free for commercial and non-commercial use as long as\n * the following conditions are aheared to.  The following conditions\n * apply to all code found in this distribution, be it the RC4, RSA,\n * lhash, DES, etc., code; not just the SSL code.  The SSL documentation\n * included with this distribution is covered by the same copyright terms\n * except that the holder is Tim Hudson (tjh@cryptsoft.com).\n * \n * Copyright remains Eric Young's, and as such any Copyright notices in\n * the code are not to be removed.\n * If this package is used in a product, Eric Young should be given attribution\n * as the author of the parts of the library used.\n * This can be in the form of a textual message at program startup or\n * in documentation (online or textual) provided with the package.\n * \n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. All advertising materials mentioning features or use of this software\n *    must display the following acknowledgement:\n *    \"This product includes cryptographic software written by\n *     Eric Young (eay@cryptsoft.com)\"\n *    The word 'cryptographic' can be left out if the rouines from the library\n *    being used are not cryptographic related :-).\n * 4. If you include any Windows specific code (or a derivative thereof) from \n *    the apps directory (application code) you must include an acknowledgement:\n *    \"This product includes software written by Tim Hudson (tjh@cryptsoft.com)\"\n * \n * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n * \n * The licence and distribution terms for any publically available version or\n * derivative of this code cannot be changed.  i.e. this code cannot simply be\n * copied and put under another distribution licence\n * [including the GNU Public Licence.]\n */\n\n#ifndef HEADER_PKCS7_H\n#define HEADER_PKCS7_H\n\n#include <openssl/asn1.h>\n#include <openssl/bio.h>\n#include <openssl/e_os2.h>\n\n#include <openssl/symhacks.h>\n#include <openssl/ossl_typ.h>\n\n#ifdef  __cplusplus\nextern \"C\" {\n#endif\n\n#ifdef OPENSSL_SYS_WIN32\n/* Under Win32 thes are defined in wincrypt.h */\n#undef PKCS7_ISSUER_AND_SERIAL\n#undef PKCS7_SIGNER_INFO\n#endif\n\n/*\nEncryption_ID\t\tDES-CBC\nDigest_ID\t\tMD5\nDigest_Encryption_ID\trsaEncryption\nKey_Encryption_ID\trsaEncryption\n*/\n\ntypedef struct pkcs7_issuer_and_serial_st\n\t{\n\tX509_NAME *issuer;\n\tASN1_INTEGER *serial;\n\t} PKCS7_ISSUER_AND_SERIAL;\n\ntypedef struct pkcs7_signer_info_st\n\t{\n\tASN1_INTEGER \t\t\t*version;\t/* version 1 */\n\tPKCS7_ISSUER_AND_SERIAL\t\t*issuer_and_serial;\n\tX509_ALGOR\t\t\t*digest_alg;\n\tSTACK_OF(X509_ATTRIBUTE)\t*auth_attr;\t/* [ 0 ] */\n\tX509_ALGOR\t\t\t*digest_enc_alg;\n\tASN1_OCTET_STRING\t\t*enc_digest;\n\tSTACK_OF(X509_ATTRIBUTE)\t*unauth_attr;\t/* [ 1 ] */\n\n\t/* The private key to sign with */\n\tEVP_PKEY\t\t\t*pkey;\n\t} PKCS7_SIGNER_INFO;\n\nDECLARE_STACK_OF(PKCS7_SIGNER_INFO)\nDECLARE_ASN1_SET_OF(PKCS7_SIGNER_INFO)\n\ntypedef struct pkcs7_recip_info_st\n\t{\n\tASN1_INTEGER\t\t\t*version;\t/* version 0 */\n\tPKCS7_ISSUER_AND_SERIAL\t\t*issuer_and_serial;\n\tX509_ALGOR\t\t\t*key_enc_algor;\n\tASN1_OCTET_STRING\t\t*enc_key;\n\tX509\t\t\t\t*cert; /* get the pub-key from this */\n\t} PKCS7_RECIP_INFO;\n\nDECLARE_STACK_OF(PKCS7_RECIP_INFO)\nDECLARE_ASN1_SET_OF(PKCS7_RECIP_INFO)\n\ntypedef struct pkcs7_signed_st\n\t{\n\tASN1_INTEGER\t\t\t*version;\t/* version 1 */\n\tSTACK_OF(X509_ALGOR)\t\t*md_algs;\t/* md used */\n\tSTACK_OF(X509)\t\t\t*cert;\t\t/* [ 0 ] */\n\tSTACK_OF(X509_CRL)\t\t*crl;\t\t/* [ 1 ] */\n\tSTACK_OF(PKCS7_SIGNER_INFO)\t*signer_info;\n\n\tstruct pkcs7_st\t\t\t*contents;\n\t} PKCS7_SIGNED;\n/* The above structure is very very similar to PKCS7_SIGN_ENVELOPE.\n * How about merging the two */\n\ntypedef struct pkcs7_enc_content_st\n\t{\n\tASN1_OBJECT\t\t\t*content_type;\n\tX509_ALGOR\t\t\t*algorithm;\n\tASN1_OCTET_STRING\t\t*enc_data;\t/* [ 0 ] */\n\tconst EVP_CIPHER\t\t*cipher;\n\t} PKCS7_ENC_CONTENT;\n\ntypedef struct pkcs7_enveloped_st\n\t{\n\tASN1_INTEGER\t\t\t*version;\t/* version 0 */\n\tSTACK_OF(PKCS7_RECIP_INFO)\t*recipientinfo;\n\tPKCS7_ENC_CONTENT\t\t*enc_data;\n\t} PKCS7_ENVELOPE;\n\ntypedef struct pkcs7_signedandenveloped_st\n\t{\n\tASN1_INTEGER\t\t\t*version;\t/* version 1 */\n\tSTACK_OF(X509_ALGOR)\t\t*md_algs;\t/* md used */\n\tSTACK_OF(X509)\t\t\t*cert;\t\t/* [ 0 ] */\n\tSTACK_OF(X509_CRL)\t\t*crl;\t\t/* [ 1 ] */\n\tSTACK_OF(PKCS7_SIGNER_INFO)\t*signer_info;\n\n\tPKCS7_ENC_CONTENT\t\t*enc_data;\n\tSTACK_OF(PKCS7_RECIP_INFO)\t*recipientinfo;\n\t} PKCS7_SIGN_ENVELOPE;\n\ntypedef struct pkcs7_digest_st\n\t{\n\tASN1_INTEGER\t\t\t*version;\t/* version 0 */\n\tX509_ALGOR\t\t\t*md;\t\t/* md used */\n\tstruct pkcs7_st \t\t*contents;\n\tASN1_OCTET_STRING\t\t*digest;\n\t} PKCS7_DIGEST;\n\ntypedef struct pkcs7_encrypted_st\n\t{\n\tASN1_INTEGER\t\t\t*version;\t/* version 0 */\n\tPKCS7_ENC_CONTENT\t\t*enc_data;\n\t} PKCS7_ENCRYPT;\n\ntypedef struct pkcs7_st\n\t{\n\t/* The following is non NULL if it contains ASN1 encoding of\n\t * this structure */\n\tunsigned char *asn1;\n\tlong length;\n\n#define PKCS7_S_HEADER\t0\n#define PKCS7_S_BODY\t1\n#define PKCS7_S_TAIL\t2\n\tint state; /* used during processing */\n\n\tint detached;\n\n\tASN1_OBJECT *type;\n\t/* content as defined by the type */\n\t/* all encryption/message digests are applied to the 'contents',\n\t * leaving out the 'type' field. */\n\tunion\t{\n\t\tchar *ptr;\n\n\t\t/* NID_pkcs7_data */\n\t\tASN1_OCTET_STRING *data;\n\n\t\t/* NID_pkcs7_signed */\n\t\tPKCS7_SIGNED *sign;\n\n\t\t/* NID_pkcs7_enveloped */\n\t\tPKCS7_ENVELOPE *enveloped;\n\n\t\t/* NID_pkcs7_signedAndEnveloped */\n\t\tPKCS7_SIGN_ENVELOPE *signed_and_enveloped;\n\n\t\t/* NID_pkcs7_digest */\n\t\tPKCS7_DIGEST *digest;\n\n\t\t/* NID_pkcs7_encrypted */\n\t\tPKCS7_ENCRYPT *encrypted;\n\n\t\t/* Anything else */\n\t\tASN1_TYPE *other;\n\t\t} d;\n\t} PKCS7;\n\nDECLARE_STACK_OF(PKCS7)\nDECLARE_ASN1_SET_OF(PKCS7)\nDECLARE_PKCS12_STACK_OF(PKCS7)\n\n#define PKCS7_OP_SET_DETACHED_SIGNATURE\t1\n#define PKCS7_OP_GET_DETACHED_SIGNATURE\t2\n\n#define PKCS7_get_signed_attributes(si)\t((si)->auth_attr)\n#define PKCS7_get_attributes(si)\t((si)->unauth_attr)\n\n#define PKCS7_type_is_signed(a) (OBJ_obj2nid((a)->type) == NID_pkcs7_signed)\n#define PKCS7_type_is_encrypted(a) (OBJ_obj2nid((a)->type) == NID_pkcs7_encrypted)\n#define PKCS7_type_is_enveloped(a) (OBJ_obj2nid((a)->type) == NID_pkcs7_enveloped)\n#define PKCS7_type_is_signedAndEnveloped(a) \\\n\t\t(OBJ_obj2nid((a)->type) == NID_pkcs7_signedAndEnveloped)\n#define PKCS7_type_is_data(a)   (OBJ_obj2nid((a)->type) == NID_pkcs7_data)\n\n#define PKCS7_type_is_digest(a)   (OBJ_obj2nid((a)->type) == NID_pkcs7_digest)\n\n#define PKCS7_set_detached(p,v) \\\n\t\tPKCS7_ctrl(p,PKCS7_OP_SET_DETACHED_SIGNATURE,v,NULL)\n#define PKCS7_get_detached(p) \\\n\t\tPKCS7_ctrl(p,PKCS7_OP_GET_DETACHED_SIGNATURE,0,NULL)\n\n#define PKCS7_is_detached(p7) (PKCS7_type_is_signed(p7) && PKCS7_get_detached(p7))\n\n#ifdef SSLEAY_MACROS\n#ifndef PKCS7_ISSUER_AND_SERIAL_digest\n#define PKCS7_ISSUER_AND_SERIAL_digest(data,type,md,len) \\\n        ASN1_digest((int (*)())i2d_PKCS7_ISSUER_AND_SERIAL,type,\\\n\t                (char *)data,md,len)\n#endif\n#endif\n\n/* S/MIME related flags */\n\n#define PKCS7_TEXT\t\t0x1\n#define PKCS7_NOCERTS\t\t0x2\n#define PKCS7_NOSIGS\t\t0x4\n#define PKCS7_NOCHAIN\t\t0x8\n#define PKCS7_NOINTERN\t\t0x10\n#define PKCS7_NOVERIFY\t\t0x20\n#define PKCS7_DETACHED\t\t0x40\n#define PKCS7_BINARY\t\t0x80\n#define PKCS7_NOATTR\t\t0x100\n#define\tPKCS7_NOSMIMECAP\t0x200\n#define PKCS7_NOOLDMIMETYPE\t0x400\n#define PKCS7_CRLFEOL\t\t0x800\n#define PKCS7_STREAM\t\t0x1000\n#define PKCS7_NOCRL\t\t0x2000\n\n/* Flags: for compatibility with older code */\n\n#define SMIME_TEXT\tPKCS7_TEXT\n#define SMIME_NOCERTS\tPKCS7_NOCERTS\n#define SMIME_NOSIGS\tPKCS7_NOSIGS\n#define SMIME_NOCHAIN\tPKCS7_NOCHAIN\n#define SMIME_NOINTERN\tPKCS7_NOINTERN\n#define SMIME_NOVERIFY\tPKCS7_NOVERIFY\n#define SMIME_DETACHED\tPKCS7_DETACHED\n#define SMIME_BINARY\tPKCS7_BINARY\n#define SMIME_NOATTR\tPKCS7_NOATTR\n\nDECLARE_ASN1_FUNCTIONS(PKCS7_ISSUER_AND_SERIAL)\n\n#ifndef SSLEAY_MACROS\nint PKCS7_ISSUER_AND_SERIAL_digest(PKCS7_ISSUER_AND_SERIAL *data,const EVP_MD *type,\n\tunsigned char *md,unsigned int *len);\n#ifndef OPENSSL_NO_FP_API\nPKCS7 *d2i_PKCS7_fp(FILE *fp,PKCS7 **p7);\nint i2d_PKCS7_fp(FILE *fp,PKCS7 *p7);\n#endif\nPKCS7 *PKCS7_dup(PKCS7 *p7);\nPKCS7 *d2i_PKCS7_bio(BIO *bp,PKCS7 **p7);\nint i2d_PKCS7_bio(BIO *bp,PKCS7 *p7);\n#endif\n\nDECLARE_ASN1_FUNCTIONS(PKCS7_SIGNER_INFO)\nDECLARE_ASN1_FUNCTIONS(PKCS7_RECIP_INFO)\nDECLARE_ASN1_FUNCTIONS(PKCS7_SIGNED)\nDECLARE_ASN1_FUNCTIONS(PKCS7_ENC_CONTENT)\nDECLARE_ASN1_FUNCTIONS(PKCS7_ENVELOPE)\nDECLARE_ASN1_FUNCTIONS(PKCS7_SIGN_ENVELOPE)\nDECLARE_ASN1_FUNCTIONS(PKCS7_DIGEST)\nDECLARE_ASN1_FUNCTIONS(PKCS7_ENCRYPT)\nDECLARE_ASN1_FUNCTIONS(PKCS7)\n\nDECLARE_ASN1_ITEM(PKCS7_ATTR_SIGN)\nDECLARE_ASN1_ITEM(PKCS7_ATTR_VERIFY)\n\nDECLARE_ASN1_NDEF_FUNCTION(PKCS7)\n\nlong PKCS7_ctrl(PKCS7 *p7, int cmd, long larg, char *parg);\n\nint PKCS7_set_type(PKCS7 *p7, int type);\nint PKCS7_set0_type_other(PKCS7 *p7, int type, ASN1_TYPE *other);\nint PKCS7_set_content(PKCS7 *p7, PKCS7 *p7_data);\nint PKCS7_SIGNER_INFO_set(PKCS7_SIGNER_INFO *p7i, X509 *x509, EVP_PKEY *pkey,\n\tconst EVP_MD *dgst);\nint PKCS7_add_signer(PKCS7 *p7, PKCS7_SIGNER_INFO *p7i);\nint PKCS7_add_certificate(PKCS7 *p7, X509 *x509);\nint PKCS7_add_crl(PKCS7 *p7, X509_CRL *x509);\nint PKCS7_content_new(PKCS7 *p7, int nid);\nint PKCS7_dataVerify(X509_STORE *cert_store, X509_STORE_CTX *ctx,\n\tBIO *bio, PKCS7 *p7, PKCS7_SIGNER_INFO *si); \nint PKCS7_signatureVerify(BIO *bio, PKCS7 *p7, PKCS7_SIGNER_INFO *si,\n\t\t\t\t\t\t\t\tX509 *x509);\n\nBIO *PKCS7_dataInit(PKCS7 *p7, BIO *bio);\nint PKCS7_dataFinal(PKCS7 *p7, BIO *bio);\nBIO *PKCS7_dataDecode(PKCS7 *p7, EVP_PKEY *pkey, BIO *in_bio, X509 *pcert);\n\n\nPKCS7_SIGNER_INFO *PKCS7_add_signature(PKCS7 *p7, X509 *x509,\n\tEVP_PKEY *pkey, const EVP_MD *dgst);\nX509 *PKCS7_cert_from_signer_info(PKCS7 *p7, PKCS7_SIGNER_INFO *si);\nint PKCS7_set_digest(PKCS7 *p7, const EVP_MD *md);\nSTACK_OF(PKCS7_SIGNER_INFO) *PKCS7_get_signer_info(PKCS7 *p7);\n\nPKCS7_RECIP_INFO *PKCS7_add_recipient(PKCS7 *p7, X509 *x509);\nint PKCS7_add_recipient_info(PKCS7 *p7, PKCS7_RECIP_INFO *ri);\nint PKCS7_RECIP_INFO_set(PKCS7_RECIP_INFO *p7i, X509 *x509);\nint PKCS7_set_cipher(PKCS7 *p7, const EVP_CIPHER *cipher);\n\nPKCS7_ISSUER_AND_SERIAL *PKCS7_get_issuer_and_serial(PKCS7 *p7, int idx);\nASN1_OCTET_STRING *PKCS7_digest_from_attributes(STACK_OF(X509_ATTRIBUTE) *sk);\nint PKCS7_add_signed_attribute(PKCS7_SIGNER_INFO *p7si,int nid,int type,\n\tvoid *data);\nint PKCS7_add_attribute (PKCS7_SIGNER_INFO *p7si, int nid, int atrtype,\n\tvoid *value);\nASN1_TYPE *PKCS7_get_attribute(PKCS7_SIGNER_INFO *si, int nid);\nASN1_TYPE *PKCS7_get_signed_attribute(PKCS7_SIGNER_INFO *si, int nid);\nint PKCS7_set_signed_attributes(PKCS7_SIGNER_INFO *p7si,\n\t\t\t\tSTACK_OF(X509_ATTRIBUTE) *sk);\nint PKCS7_set_attributes(PKCS7_SIGNER_INFO *p7si,STACK_OF(X509_ATTRIBUTE) *sk);\n\n\nPKCS7 *PKCS7_sign(X509 *signcert, EVP_PKEY *pkey, STACK_OF(X509) *certs,\n\t\t\t\t\t\t\tBIO *data, int flags);\nint PKCS7_verify(PKCS7 *p7, STACK_OF(X509) *certs, X509_STORE *store,\n\t\t\t\t\tBIO *indata, BIO *out, int flags);\nSTACK_OF(X509) *PKCS7_get0_signers(PKCS7 *p7, STACK_OF(X509) *certs, int flags);\nPKCS7 *PKCS7_encrypt(STACK_OF(X509) *certs, BIO *in, const EVP_CIPHER *cipher,\n\t\t\t\t\t\t\t\tint flags);\nint PKCS7_decrypt(PKCS7 *p7, EVP_PKEY *pkey, X509 *cert, BIO *data, int flags);\n\nint PKCS7_add_attrib_smimecap(PKCS7_SIGNER_INFO *si,\n\t\t\t      STACK_OF(X509_ALGOR) *cap);\nSTACK_OF(X509_ALGOR) *PKCS7_get_smimecap(PKCS7_SIGNER_INFO *si);\nint PKCS7_simple_smimecap(STACK_OF(X509_ALGOR) *sk, int nid, int arg);\n\nint SMIME_write_PKCS7(BIO *bio, PKCS7 *p7, BIO *data, int flags);\nPKCS7 *SMIME_read_PKCS7(BIO *bio, BIO **bcont);\nint SMIME_crlf_copy(BIO *in, BIO *out, int flags);\nint SMIME_text(BIO *in, BIO *out);\n\n/* BEGIN ERROR CODES */\n/* The following lines are auto generated by the script mkerr.pl. Any changes\n * made after this point may be overwritten when the script is next run.\n */\nvoid ERR_load_PKCS7_strings(void);\n\n/* Error codes for the PKCS7 functions. */\n\n/* Function codes. */\n#define PKCS7_F_B64_READ_PKCS7\t\t\t\t 120\n#define PKCS7_F_B64_WRITE_PKCS7\t\t\t\t 121\n#define PKCS7_F_PKCS7_ADD_ATTRIB_SMIMECAP\t\t 118\n#define PKCS7_F_PKCS7_ADD_CERTIFICATE\t\t\t 100\n#define PKCS7_F_PKCS7_ADD_CRL\t\t\t\t 101\n#define PKCS7_F_PKCS7_ADD_RECIPIENT_INFO\t\t 102\n#define PKCS7_F_PKCS7_ADD_SIGNER\t\t\t 103\n#define PKCS7_F_PKCS7_BIO_ADD_DIGEST\t\t\t 125\n#define PKCS7_F_PKCS7_CTRL\t\t\t\t 104\n#define PKCS7_F_PKCS7_DATADECODE\t\t\t 112\n#define PKCS7_F_PKCS7_DATAFINAL\t\t\t\t 128\n#define PKCS7_F_PKCS7_DATAINIT\t\t\t\t 105\n#define PKCS7_F_PKCS7_DATASIGN\t\t\t\t 106\n#define PKCS7_F_PKCS7_DATAVERIFY\t\t\t 107\n#define PKCS7_F_PKCS7_DECRYPT\t\t\t\t 114\n#define PKCS7_F_PKCS7_ENCRYPT\t\t\t\t 115\n#define PKCS7_F_PKCS7_FIND_DIGEST\t\t\t 127\n#define PKCS7_F_PKCS7_GET0_SIGNERS\t\t\t 124\n#define PKCS7_F_PKCS7_SET_CIPHER\t\t\t 108\n#define PKCS7_F_PKCS7_SET_CONTENT\t\t\t 109\n#define PKCS7_F_PKCS7_SET_DIGEST\t\t\t 126\n#define PKCS7_F_PKCS7_SET_TYPE\t\t\t\t 110\n#define PKCS7_F_PKCS7_SIGN\t\t\t\t 116\n#define PKCS7_F_PKCS7_SIGNATUREVERIFY\t\t\t 113\n#define PKCS7_F_PKCS7_SIMPLE_SMIMECAP\t\t\t 119\n#define PKCS7_F_PKCS7_VERIFY\t\t\t\t 117\n#define PKCS7_F_SMIME_READ_PKCS7\t\t\t 122\n#define PKCS7_F_SMIME_TEXT\t\t\t\t 123\n\n/* Reason codes. */\n#define PKCS7_R_CERTIFICATE_VERIFY_ERROR\t\t 117\n#define PKCS7_R_CIPHER_HAS_NO_OBJECT_IDENTIFIER\t\t 144\n#define PKCS7_R_CIPHER_NOT_INITIALIZED\t\t\t 116\n#define PKCS7_R_CONTENT_AND_DATA_PRESENT\t\t 118\n#define PKCS7_R_DECODE_ERROR\t\t\t\t 130\n#define PKCS7_R_DECRYPTED_KEY_IS_WRONG_LENGTH\t\t 100\n#define PKCS7_R_DECRYPT_ERROR\t\t\t\t 119\n#define PKCS7_R_DIGEST_FAILURE\t\t\t\t 101\n#define PKCS7_R_ERROR_ADDING_RECIPIENT\t\t\t 120\n#define PKCS7_R_ERROR_SETTING_CIPHER\t\t\t 121\n#define PKCS7_R_INVALID_MIME_TYPE\t\t\t 131\n#define PKCS7_R_INVALID_NULL_POINTER\t\t\t 143\n#define PKCS7_R_MIME_NO_CONTENT_TYPE\t\t\t 132\n#define PKCS7_R_MIME_PARSE_ERROR\t\t\t 133\n#define PKCS7_R_MIME_SIG_PARSE_ERROR\t\t\t 134\n#define PKCS7_R_MISSING_CERIPEND_INFO\t\t\t 103\n#define PKCS7_R_NO_CONTENT\t\t\t\t 122\n#define PKCS7_R_NO_CONTENT_TYPE\t\t\t\t 135\n#define PKCS7_R_NO_MULTIPART_BODY_FAILURE\t\t 136\n#define PKCS7_R_NO_MULTIPART_BOUNDARY\t\t\t 137\n#define PKCS7_R_NO_RECIPIENT_MATCHES_CERTIFICATE\t 115\n#define PKCS7_R_NO_RECIPIENT_MATCHES_KEY\t\t 146\n#define PKCS7_R_NO_SIGNATURES_ON_DATA\t\t\t 123\n#define PKCS7_R_NO_SIGNERS\t\t\t\t 142\n#define PKCS7_R_NO_SIG_CONTENT_TYPE\t\t\t 138\n#define PKCS7_R_OPERATION_NOT_SUPPORTED_ON_THIS_TYPE\t 104\n#define PKCS7_R_PKCS7_ADD_SIGNATURE_ERROR\t\t 124\n#define PKCS7_R_PKCS7_DATAFINAL\t\t\t\t 126\n#define PKCS7_R_PKCS7_DATAFINAL_ERROR\t\t\t 125\n#define PKCS7_R_PKCS7_DATASIGN\t\t\t\t 145\n#define PKCS7_R_PKCS7_PARSE_ERROR\t\t\t 139\n#define PKCS7_R_PKCS7_SIG_PARSE_ERROR\t\t\t 140\n#define PKCS7_R_PRIVATE_KEY_DOES_NOT_MATCH_CERTIFICATE\t 127\n#define PKCS7_R_SIGNATURE_FAILURE\t\t\t 105\n#define PKCS7_R_SIGNER_CERTIFICATE_NOT_FOUND\t\t 128\n#define PKCS7_R_SIG_INVALID_MIME_TYPE\t\t\t 141\n#define PKCS7_R_SMIME_TEXT_ERROR\t\t\t 129\n#define PKCS7_R_UNABLE_TO_FIND_CERTIFICATE\t\t 106\n#define PKCS7_R_UNABLE_TO_FIND_MEM_BIO\t\t\t 107\n#define PKCS7_R_UNABLE_TO_FIND_MESSAGE_DIGEST\t\t 108\n#define PKCS7_R_UNKNOWN_DIGEST_TYPE\t\t\t 109\n#define PKCS7_R_UNKNOWN_OPERATION\t\t\t 110\n#define PKCS7_R_UNSUPPORTED_CIPHER_TYPE\t\t\t 111\n#define PKCS7_R_UNSUPPORTED_CONTENT_TYPE\t\t 112\n#define PKCS7_R_WRONG_CONTENT_TYPE\t\t\t 113\n#define PKCS7_R_WRONG_PKCS7_TYPE\t\t\t 114\n\n#ifdef  __cplusplus\n}\n#endif\n#endif\n"
  },
  {
    "path": "freebsd-headers/openssl/pq_compat.h",
    "content": "/* crypto/pqueue/pqueue_compat.h */\n/* \n * DTLS implementation written by Nagendra Modadugu\n * (nagendra@cs.stanford.edu) for the OpenSSL project 2005.  \n */\n/* ====================================================================\n * Copyright (c) 1999-2005 The OpenSSL Project.  All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n *\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer. \n *\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in\n *    the documentation and/or other materials provided with the\n *    distribution.\n *\n * 3. All advertising materials mentioning features or use of this\n *    software must display the following acknowledgment:\n *    \"This product includes software developed by the OpenSSL Project\n *    for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)\"\n *\n * 4. The names \"OpenSSL Toolkit\" and \"OpenSSL Project\" must not be used to\n *    endorse or promote products derived from this software without\n *    prior written permission. For written permission, please contact\n *    openssl-core@OpenSSL.org.\n *\n * 5. Products derived from this software may not be called \"OpenSSL\"\n *    nor may \"OpenSSL\" appear in their names without prior written\n *    permission of the OpenSSL Project.\n *\n * 6. Redistributions of any form whatsoever must retain the following\n *    acknowledgment:\n *    \"This product includes software developed by the OpenSSL Project\n *    for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)\"\n *\n * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY\n * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\n * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE OpenSSL PROJECT OR\n * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\n * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,\n * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED\n * OF THE POSSIBILITY OF SUCH DAMAGE.\n * ====================================================================\n *\n * This product includes cryptographic software written by Eric Young\n * (eay@cryptsoft.com).  This product includes software written by Tim\n * Hudson (tjh@cryptsoft.com).\n *\n */\n\n#ifndef HEADER_PQ_COMPAT_H\n#define HEADER_PQ_COMPAT_H\n\n#include <openssl/opensslconf.h>\n#include <openssl/bn.h>\n\n/* \n * The purpose of this header file is for supporting 64-bit integer\n * manipulation on 32-bit (and lower) machines.  Currently the only\n * such environment is VMS, Utrix and those with smaller default integer\n * sizes than 32 bits.  For all such environment, we fall back to using\n * BIGNUM.  We may need to fine tune the conditions for systems that\n * are incorrectly configured.\n *\n * The only clients of this code are (1) pqueue for priority, and\n * (2) DTLS, for sequence number manipulation.\n */\n\n#if (defined(THIRTY_TWO_BIT) && !defined(BN_LLONG)) || defined(SIXTEEN_BIT) || defined(EIGHT_BIT)\n\n#define PQ_64BIT_IS_INTEGER 0\n#define PQ_64BIT_IS_BIGNUM 1\n\n#define PQ_64BIT     BIGNUM\n#define PQ_64BIT_CTX BN_CTX\n\n#define pq_64bit_init(x)           BN_init(x)\n#define pq_64bit_free(x)           BN_free(x)\n\n#define pq_64bit_ctx_new(ctx)      BN_CTX_new()\n#define pq_64bit_ctx_free(x)       BN_CTX_free(x)\n\n#define pq_64bit_assign(x, y)      BN_copy(x, y)\n#define pq_64bit_assign_word(x, y) BN_set_word(x, y)\n#define pq_64bit_gt(x, y)          BN_ucmp(x, y) >= 1 ? 1 : 0\n#define pq_64bit_eq(x, y)          BN_ucmp(x, y) == 0 ? 1 : 0\n#define pq_64bit_add_word(x, w)    BN_add_word(x, w)\n#define pq_64bit_sub(r, x, y)      BN_sub(r, x, y)\n#define pq_64bit_sub_word(x, w)    BN_sub_word(x, w)\n#define pq_64bit_mod(r, x, n, ctx) BN_mod(r, x, n, ctx)\n\n#define pq_64bit_bin2num(bn, bytes, len)   BN_bin2bn(bytes, len, bn)\n#define pq_64bit_num2bin(bn, bytes)        BN_bn2bin(bn, bytes)\n#define pq_64bit_get_word(x)               BN_get_word(x)\n#define pq_64bit_is_bit_set(x, offset)     BN_is_bit_set(x, offset)\n#define pq_64bit_lshift(r, x, shift)       BN_lshift(r, x, shift)\n#define pq_64bit_set_bit(x, num)           BN_set_bit(x, num)\n#define pq_64bit_get_length(x)             BN_num_bits((x))\n\n#else\n\n#define PQ_64BIT_IS_INTEGER 1\n#define PQ_64BIT_IS_BIGNUM 0\n\n#if defined(SIXTY_FOUR_BIT)\n#define PQ_64BIT BN_ULONG\n#define PQ_64BIT_PRINT \"%lld\"\n#elif defined(SIXTY_FOUR_BIT_LONG)\n#define PQ_64BIT BN_ULONG\n#define PQ_64BIT_PRINT \"%ld\"\n#elif defined(THIRTY_TWO_BIT)\n#define PQ_64BIT BN_ULLONG\n#define PQ_64BIT_PRINT \"%lld\"\n#endif\n\n#define PQ_64BIT_CTX      void\n\n#define pq_64bit_init(x)\n#define pq_64bit_free(x)\n#define pq_64bit_ctx_new(ctx)        (ctx)\n#define pq_64bit_ctx_free(x)\n\n#define pq_64bit_assign(x, y)        (*(x) = *(y))\n#define pq_64bit_assign_word(x, y)   (*(x) = y)\n#define pq_64bit_gt(x, y)\t         (*(x) > *(y))\n#define pq_64bit_eq(x, y)            (*(x) == *(y))\n#define pq_64bit_add_word(x, w)      (*(x) = (*(x) + (w)))\n#define pq_64bit_sub(r, x, y)        (*(r) = (*(x) - *(y)))\n#define pq_64bit_sub_word(x, w)      (*(x) = (*(x) - (w)))\n#define pq_64bit_mod(r, x, n, ctx)\n\n#define pq_64bit_bin2num(num, bytes, len) bytes_to_long_long(bytes, num)\n#define pq_64bit_num2bin(num, bytes)      long_long_to_bytes(num, bytes)\n#define pq_64bit_get_word(x)              *(x)\n#define pq_64bit_lshift(r, x, shift)      (*(r) = (*(x) << (shift)))\n#define pq_64bit_set_bit(x, num)          do { \\\n                                              PQ_64BIT mask = 1; \\\n                                              mask = mask << (num); \\\n                                              *(x) |= mask; \\\n                                          } while(0)\n#endif /* OPENSSL_SYS_VMS */\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/openssl/pqueue.h",
    "content": "/* crypto/pqueue/pqueue.h */\n/* \n * DTLS implementation written by Nagendra Modadugu\n * (nagendra@cs.stanford.edu) for the OpenSSL project 2005.  \n */\n/* ====================================================================\n * Copyright (c) 1999-2005 The OpenSSL Project.  All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n *\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer. \n *\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in\n *    the documentation and/or other materials provided with the\n *    distribution.\n *\n * 3. All advertising materials mentioning features or use of this\n *    software must display the following acknowledgment:\n *    \"This product includes software developed by the OpenSSL Project\n *    for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)\"\n *\n * 4. The names \"OpenSSL Toolkit\" and \"OpenSSL Project\" must not be used to\n *    endorse or promote products derived from this software without\n *    prior written permission. For written permission, please contact\n *    openssl-core@OpenSSL.org.\n *\n * 5. Products derived from this software may not be called \"OpenSSL\"\n *    nor may \"OpenSSL\" appear in their names without prior written\n *    permission of the OpenSSL Project.\n *\n * 6. Redistributions of any form whatsoever must retain the following\n *    acknowledgment:\n *    \"This product includes software developed by the OpenSSL Project\n *    for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)\"\n *\n * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY\n * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\n * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE OpenSSL PROJECT OR\n * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\n * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,\n * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED\n * OF THE POSSIBILITY OF SUCH DAMAGE.\n * ====================================================================\n *\n * This product includes cryptographic software written by Eric Young\n * (eay@cryptsoft.com).  This product includes software written by Tim\n * Hudson (tjh@cryptsoft.com).\n *\n */\n\n#ifndef HEADER_PQUEUE_H\n#define HEADER_PQUEUE_H\n\n#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n\n#include <openssl/pq_compat.h>\n\ntypedef struct _pqueue *pqueue;\n\ntypedef struct _pitem\n\t{\n\tPQ_64BIT priority;\n\tvoid *data;\n\tstruct _pitem *next;\n\t} pitem;\n\ntypedef struct _pitem *piterator;\n\npitem *pitem_new(PQ_64BIT priority, void *data);\nvoid   pitem_free(pitem *item);\n\npqueue pqueue_new(void);\nvoid   pqueue_free(pqueue pq);\n\npitem *pqueue_insert(pqueue pq, pitem *item);\npitem *pqueue_peek(pqueue pq);\npitem *pqueue_pop(pqueue pq);\npitem *pqueue_find(pqueue pq, PQ_64BIT priority);\npitem *pqueue_iterator(pqueue pq);\npitem *pqueue_next(piterator *iter);\n\nvoid   pqueue_print(pqueue pq);\nint    pqueue_size(pqueue pq);\n\n#endif /* ! HEADER_PQUEUE_H */\n"
  },
  {
    "path": "freebsd-headers/openssl/rand.h",
    "content": "/* crypto/rand/rand.h */\n/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)\n * All rights reserved.\n *\n * This package is an SSL implementation written\n * by Eric Young (eay@cryptsoft.com).\n * The implementation was written so as to conform with Netscapes SSL.\n * \n * This library is free for commercial and non-commercial use as long as\n * the following conditions are aheared to.  The following conditions\n * apply to all code found in this distribution, be it the RC4, RSA,\n * lhash, DES, etc., code; not just the SSL code.  The SSL documentation\n * included with this distribution is covered by the same copyright terms\n * except that the holder is Tim Hudson (tjh@cryptsoft.com).\n * \n * Copyright remains Eric Young's, and as such any Copyright notices in\n * the code are not to be removed.\n * If this package is used in a product, Eric Young should be given attribution\n * as the author of the parts of the library used.\n * This can be in the form of a textual message at program startup or\n * in documentation (online or textual) provided with the package.\n * \n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. All advertising materials mentioning features or use of this software\n *    must display the following acknowledgement:\n *    \"This product includes cryptographic software written by\n *     Eric Young (eay@cryptsoft.com)\"\n *    The word 'cryptographic' can be left out if the rouines from the library\n *    being used are not cryptographic related :-).\n * 4. If you include any Windows specific code (or a derivative thereof) from \n *    the apps directory (application code) you must include an acknowledgement:\n *    \"This product includes software written by Tim Hudson (tjh@cryptsoft.com)\"\n * \n * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n * \n * The licence and distribution terms for any publically available version or\n * derivative of this code cannot be changed.  i.e. this code cannot simply be\n * copied and put under another distribution licence\n * [including the GNU Public Licence.]\n */\n\n#ifndef HEADER_RAND_H\n#define HEADER_RAND_H\n\n#include <stdlib.h>\n#include <openssl/ossl_typ.h>\n#include <openssl/e_os2.h>\n\n#if defined(OPENSSL_SYS_WINDOWS)\n#include <windows.h>\n#endif\n\n#ifdef  __cplusplus\nextern \"C\" {\n#endif\n\n#if defined(OPENSSL_FIPS)\n#define FIPS_RAND_SIZE_T int\n#endif\n\n/* Already defined in ossl_typ.h */\n/* typedef struct rand_meth_st RAND_METHOD; */\n\nstruct rand_meth_st\n\t{\n\tvoid (*seed)(const void *buf, int num);\n\tint (*bytes)(unsigned char *buf, int num);\n\tvoid (*cleanup)(void);\n\tvoid (*add)(const void *buf, int num, double entropy);\n\tint (*pseudorand)(unsigned char *buf, int num);\n\tint (*status)(void);\n\t};\n\n#ifdef BN_DEBUG\nextern int rand_predictable;\n#endif\n\nint RAND_set_rand_method(const RAND_METHOD *meth);\nconst RAND_METHOD *RAND_get_rand_method(void);\n#ifndef OPENSSL_NO_ENGINE\nint RAND_set_rand_engine(ENGINE *engine);\n#endif\nRAND_METHOD *RAND_SSLeay(void);\nvoid RAND_cleanup(void );\nint  RAND_bytes(unsigned char *buf,int num);\nint  RAND_pseudo_bytes(unsigned char *buf,int num);\nvoid RAND_seed(const void *buf,int num);\nvoid RAND_add(const void *buf,int num,double entropy);\nint  RAND_load_file(const char *file,long max_bytes);\nint  RAND_write_file(const char *file);\nconst char *RAND_file_name(char *file,size_t num);\nint RAND_status(void);\nint RAND_query_egd_bytes(const char *path, unsigned char *buf, int bytes);\nint RAND_egd(const char *path);\nint RAND_egd_bytes(const char *path,int bytes);\nint RAND_poll(void);\n#ifndef OPENSSL_NO_ENGINE\n#ifdef OPENSSL_FIPS\nvoid int_RAND_init_engine_callbacks(void);\nvoid int_RAND_set_callbacks(\n\tint (*set_rand_func)(const RAND_METHOD *meth,\n\t\t\t\t\t\tconst RAND_METHOD **pmeth),\n\tconst RAND_METHOD *(*get_rand_func)(const RAND_METHOD **pmeth));\n#endif\n#endif\n\n#if defined(OPENSSL_SYS_WINDOWS) || defined(OPENSSL_SYS_WIN32)\n\nvoid RAND_screen(void);\nint RAND_event(UINT, WPARAM, LPARAM);\n\n#endif\n\n/* BEGIN ERROR CODES */\n/* The following lines are auto generated by the script mkerr.pl. Any changes\n * made after this point may be overwritten when the script is next run.\n */\nvoid ERR_load_RAND_strings(void);\n\n/* Error codes for the RAND functions. */\n\n/* Function codes. */\n#define RAND_F_ENG_RAND_GET_RAND_METHOD\t\t\t 108\n#define RAND_F_FIPS_RAND\t\t\t\t 103\n#define RAND_F_FIPS_RAND_BYTES\t\t\t\t 102\n#define RAND_F_FIPS_RAND_GET_RAND_METHOD\t\t 109\n#define RAND_F_FIPS_RAND_SET_DT\t\t\t\t 106\n#define RAND_F_FIPS_SET_DT\t\t\t\t 104\n#define RAND_F_FIPS_SET_PRNG_SEED\t\t\t 107\n#define RAND_F_FIPS_SET_TEST_MODE\t\t\t 105\n#define RAND_F_RAND_GET_RAND_METHOD\t\t\t 101\n#define RAND_F_SSLEAY_RAND_BYTES\t\t\t 100\n\n/* Reason codes. */\n#define RAND_R_NON_FIPS_METHOD\t\t\t\t 105\n#define RAND_R_NOT_IN_TEST_MODE\t\t\t\t 106\n#define RAND_R_NO_KEY_SET\t\t\t\t 107\n#define RAND_R_PRNG_ASKING_FOR_TOO_MUCH\t\t\t 101\n#define RAND_R_PRNG_ERROR\t\t\t\t 108\n#define RAND_R_PRNG_KEYED\t\t\t\t 109\n#define RAND_R_PRNG_NOT_REKEYED\t\t\t\t 102\n#define RAND_R_PRNG_NOT_RESEEDED\t\t\t 103\n#define RAND_R_PRNG_NOT_SEEDED\t\t\t\t 100\n#define RAND_R_PRNG_SEED_MUST_NOT_MATCH_KEY\t\t 110\n#define RAND_R_PRNG_STUCK\t\t\t\t 104\n\n#ifdef  __cplusplus\n}\n#endif\n#endif\n"
  },
  {
    "path": "freebsd-headers/openssl/rc2.h",
    "content": "/* crypto/rc2/rc2.h */\n/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com)\n * All rights reserved.\n *\n * This package is an SSL implementation written\n * by Eric Young (eay@cryptsoft.com).\n * The implementation was written so as to conform with Netscapes SSL.\n * \n * This library is free for commercial and non-commercial use as long as\n * the following conditions are aheared to.  The following conditions\n * apply to all code found in this distribution, be it the RC4, RSA,\n * lhash, DES, etc., code; not just the SSL code.  The SSL documentation\n * included with this distribution is covered by the same copyright terms\n * except that the holder is Tim Hudson (tjh@cryptsoft.com).\n * \n * Copyright remains Eric Young's, and as such any Copyright notices in\n * the code are not to be removed.\n * If this package is used in a product, Eric Young should be given attribution\n * as the author of the parts of the library used.\n * This can be in the form of a textual message at program startup or\n * in documentation (online or textual) provided with the package.\n * \n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. All advertising materials mentioning features or use of this software\n *    must display the following acknowledgement:\n *    \"This product includes cryptographic software written by\n *     Eric Young (eay@cryptsoft.com)\"\n *    The word 'cryptographic' can be left out if the rouines from the library\n *    being used are not cryptographic related :-).\n * 4. If you include any Windows specific code (or a derivative thereof) from \n *    the apps directory (application code) you must include an acknowledgement:\n *    \"This product includes software written by Tim Hudson (tjh@cryptsoft.com)\"\n * \n * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n * \n * The licence and distribution terms for any publically available version or\n * derivative of this code cannot be changed.  i.e. this code cannot simply be\n * copied and put under another distribution licence\n * [including the GNU Public Licence.]\n */\n\n#ifndef HEADER_RC2_H\n#define HEADER_RC2_H\n\n#include <openssl/opensslconf.h> /* OPENSSL_NO_RC2, RC2_INT */\n#ifdef OPENSSL_NO_RC2\n#error RC2 is disabled.\n#endif\n\n#define RC2_ENCRYPT\t1\n#define RC2_DECRYPT\t0\n\n#define RC2_BLOCK\t8\n#define RC2_KEY_LENGTH\t16\n\n#ifdef  __cplusplus\nextern \"C\" {\n#endif\n\ntypedef struct rc2_key_st\n\t{\n\tRC2_INT data[64];\n\t} RC2_KEY;\n\n#ifdef OPENSSL_FIPS \nvoid private_RC2_set_key(RC2_KEY *key, int len, const unsigned char *data,int bits);\n#endif\nvoid RC2_set_key(RC2_KEY *key, int len, const unsigned char *data,int bits);\nvoid RC2_ecb_encrypt(const unsigned char *in,unsigned char *out,RC2_KEY *key,\n\t\t     int enc);\nvoid RC2_encrypt(unsigned long *data,RC2_KEY *key);\nvoid RC2_decrypt(unsigned long *data,RC2_KEY *key);\nvoid RC2_cbc_encrypt(const unsigned char *in, unsigned char *out, long length,\n\tRC2_KEY *ks, unsigned char *iv, int enc);\nvoid RC2_cfb64_encrypt(const unsigned char *in, unsigned char *out,\n\t\t       long length, RC2_KEY *schedule, unsigned char *ivec,\n\t\t       int *num, int enc);\nvoid RC2_ofb64_encrypt(const unsigned char *in, unsigned char *out,\n\t\t       long length, RC2_KEY *schedule, unsigned char *ivec,\n\t\t       int *num);\n\n#ifdef  __cplusplus\n}\n#endif\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/openssl/rc4.h",
    "content": "/* crypto/rc4/rc4.h */\n/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com)\n * All rights reserved.\n *\n * This package is an SSL implementation written\n * by Eric Young (eay@cryptsoft.com).\n * The implementation was written so as to conform with Netscapes SSL.\n * \n * This library is free for commercial and non-commercial use as long as\n * the following conditions are aheared to.  The following conditions\n * apply to all code found in this distribution, be it the RC4, RSA,\n * lhash, DES, etc., code; not just the SSL code.  The SSL documentation\n * included with this distribution is covered by the same copyright terms\n * except that the holder is Tim Hudson (tjh@cryptsoft.com).\n * \n * Copyright remains Eric Young's, and as such any Copyright notices in\n * the code are not to be removed.\n * If this package is used in a product, Eric Young should be given attribution\n * as the author of the parts of the library used.\n * This can be in the form of a textual message at program startup or\n * in documentation (online or textual) provided with the package.\n * \n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. All advertising materials mentioning features or use of this software\n *    must display the following acknowledgement:\n *    \"This product includes cryptographic software written by\n *     Eric Young (eay@cryptsoft.com)\"\n *    The word 'cryptographic' can be left out if the rouines from the library\n *    being used are not cryptographic related :-).\n * 4. If you include any Windows specific code (or a derivative thereof) from \n *    the apps directory (application code) you must include an acknowledgement:\n *    \"This product includes software written by Tim Hudson (tjh@cryptsoft.com)\"\n * \n * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n * \n * The licence and distribution terms for any publically available version or\n * derivative of this code cannot be changed.  i.e. this code cannot simply be\n * copied and put under another distribution licence\n * [including the GNU Public Licence.]\n */\n\n#ifndef HEADER_RC4_H\n#define HEADER_RC4_H\n\n#include <openssl/opensslconf.h> /* OPENSSL_NO_RC4, RC4_INT */\n#ifdef OPENSSL_NO_RC4\n#error RC4 is disabled.\n#endif\n\n#ifdef  __cplusplus\nextern \"C\" {\n#endif\n\ntypedef struct rc4_key_st\n\t{\n\tRC4_INT x,y;\n\tRC4_INT data[256];\n\t} RC4_KEY;\n\n \nconst char *RC4_options(void);\n#ifdef OPENSSL_FIPS\nvoid private_RC4_set_key(RC4_KEY *key, int len, const unsigned char *data);\n#endif\nvoid RC4_set_key(RC4_KEY *key, int len, const unsigned char *data);\nvoid RC4(RC4_KEY *key, unsigned long len, const unsigned char *indata,\n\t\tunsigned char *outdata);\n\n#ifdef  __cplusplus\n}\n#endif\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/openssl/rc5.h",
    "content": "/* crypto/rc5/rc5.h */\n/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)\n * All rights reserved.\n *\n * This package is an SSL implementation written\n * by Eric Young (eay@cryptsoft.com).\n * The implementation was written so as to conform with Netscapes SSL.\n * \n * This library is free for commercial and non-commercial use as long as\n * the following conditions are aheared to.  The following conditions\n * apply to all code found in this distribution, be it the RC4, RSA,\n * lhash, DES, etc., code; not just the SSL code.  The SSL documentation\n * included with this distribution is covered by the same copyright terms\n * except that the holder is Tim Hudson (tjh@cryptsoft.com).\n * \n * Copyright remains Eric Young's, and as such any Copyright notices in\n * the code are not to be removed.\n * If this package is used in a product, Eric Young should be given attribution\n * as the author of the parts of the library used.\n * This can be in the form of a textual message at program startup or\n * in documentation (online or textual) provided with the package.\n * \n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. All advertising materials mentioning features or use of this software\n *    must display the following acknowledgement:\n *    \"This product includes cryptographic software written by\n *     Eric Young (eay@cryptsoft.com)\"\n *    The word 'cryptographic' can be left out if the rouines from the library\n *    being used are not cryptographic related :-).\n * 4. If you include any Windows specific code (or a derivative thereof) from \n *    the apps directory (application code) you must include an acknowledgement:\n *    \"This product includes software written by Tim Hudson (tjh@cryptsoft.com)\"\n * \n * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n * \n * The licence and distribution terms for any publically available version or\n * derivative of this code cannot be changed.  i.e. this code cannot simply be\n * copied and put under another distribution licence\n * [including the GNU Public Licence.]\n */\n\n#ifndef HEADER_RC5_H\n#define HEADER_RC5_H\n\n#include <openssl/opensslconf.h> /* OPENSSL_NO_RC5 */\n\n#ifdef  __cplusplus\nextern \"C\" {\n#endif\n\n#ifdef OPENSSL_NO_RC5\n#error RC5 is disabled.\n#endif\n\n#define RC5_ENCRYPT\t1\n#define RC5_DECRYPT\t0\n\n/* 32 bit.  For Alpha, things may get weird */\n#define RC5_32_INT unsigned long\n\n#define RC5_32_BLOCK\t\t8\n#define RC5_32_KEY_LENGTH\t16 /* This is a default, max is 255 */\n\n/* This are the only values supported.  Tweak the code if you want more\n * The most supported modes will be\n * RC5-32/12/16\n * RC5-32/16/8\n */\n#define RC5_8_ROUNDS\t8\n#define RC5_12_ROUNDS\t12\n#define RC5_16_ROUNDS\t16\n\ntypedef struct rc5_key_st\n\t{\n\t/* Number of rounds */\n\tint rounds;\n\tRC5_32_INT data[2*(RC5_16_ROUNDS+1)];\n\t} RC5_32_KEY;\n\n#ifdef OPENSSL_FIPS \nvoid private_RC5_32_set_key(RC5_32_KEY *key, int len, const unsigned char *data,\n\tint rounds);\n#endif\nvoid RC5_32_set_key(RC5_32_KEY *key, int len, const unsigned char *data,\n\tint rounds);\nvoid RC5_32_ecb_encrypt(const unsigned char *in,unsigned char *out,RC5_32_KEY *key,\n\tint enc);\nvoid RC5_32_encrypt(unsigned long *data,RC5_32_KEY *key);\nvoid RC5_32_decrypt(unsigned long *data,RC5_32_KEY *key);\nvoid RC5_32_cbc_encrypt(const unsigned char *in, unsigned char *out,\n\t\t\tlong length, RC5_32_KEY *ks, unsigned char *iv,\n\t\t\tint enc);\nvoid RC5_32_cfb64_encrypt(const unsigned char *in, unsigned char *out,\n\t\t\t  long length, RC5_32_KEY *schedule,\n\t\t\t  unsigned char *ivec, int *num, int enc);\nvoid RC5_32_ofb64_encrypt(const unsigned char *in, unsigned char *out,\n\t\t\t  long length, RC5_32_KEY *schedule,\n\t\t\t  unsigned char *ivec, int *num);\n\n#ifdef  __cplusplus\n}\n#endif\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/openssl/ripemd.h",
    "content": "/* crypto/ripemd/ripemd.h */\n/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)\n * All rights reserved.\n *\n * This package is an SSL implementation written\n * by Eric Young (eay@cryptsoft.com).\n * The implementation was written so as to conform with Netscapes SSL.\n * \n * This library is free for commercial and non-commercial use as long as\n * the following conditions are aheared to.  The following conditions\n * apply to all code found in this distribution, be it the RC4, RSA,\n * lhash, DES, etc., code; not just the SSL code.  The SSL documentation\n * included with this distribution is covered by the same copyright terms\n * except that the holder is Tim Hudson (tjh@cryptsoft.com).\n * \n * Copyright remains Eric Young's, and as such any Copyright notices in\n * the code are not to be removed.\n * If this package is used in a product, Eric Young should be given attribution\n * as the author of the parts of the library used.\n * This can be in the form of a textual message at program startup or\n * in documentation (online or textual) provided with the package.\n * \n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. All advertising materials mentioning features or use of this software\n *    must display the following acknowledgement:\n *    \"This product includes cryptographic software written by\n *     Eric Young (eay@cryptsoft.com)\"\n *    The word 'cryptographic' can be left out if the rouines from the library\n *    being used are not cryptographic related :-).\n * 4. If you include any Windows specific code (or a derivative thereof) from \n *    the apps directory (application code) you must include an acknowledgement:\n *    \"This product includes software written by Tim Hudson (tjh@cryptsoft.com)\"\n * \n * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n * \n * The licence and distribution terms for any publically available version or\n * derivative of this code cannot be changed.  i.e. this code cannot simply be\n * copied and put under another distribution licence\n * [including the GNU Public Licence.]\n */\n\n#ifndef HEADER_RIPEMD_H\n#define HEADER_RIPEMD_H\n\n#include <openssl/e_os2.h>\n#include <stddef.h>\n\n#ifdef  __cplusplus\nextern \"C\" {\n#endif\n\n#ifdef OPENSSL_NO_RIPEMD\n#error RIPEMD is disabled.\n#endif\n\n#if defined(OPENSSL_SYS_WIN16) || defined(__LP32__)\n#define RIPEMD160_LONG unsigned long\n#elif defined(OPENSSL_SYS_CRAY) || defined(__ILP64__)\n#define RIPEMD160_LONG unsigned long\n#define RIPEMD160_LONG_LOG2 3\n#else\n#define RIPEMD160_LONG unsigned int\n#endif\n\n#define RIPEMD160_CBLOCK\t64\n#define RIPEMD160_LBLOCK\t(RIPEMD160_CBLOCK/4)\n#define RIPEMD160_DIGEST_LENGTH\t20\n\ntypedef struct RIPEMD160state_st\n\t{\n\tRIPEMD160_LONG A,B,C,D,E;\n\tRIPEMD160_LONG Nl,Nh;\n\tRIPEMD160_LONG data[RIPEMD160_LBLOCK];\n\tunsigned int   num;\n\t} RIPEMD160_CTX;\n#ifdef OPENSSL_FIPS\nint private_RIPEMD160_Init(RIPEMD160_CTX *c);\n#endif\nint RIPEMD160_Init(RIPEMD160_CTX *c);\nint RIPEMD160_Update(RIPEMD160_CTX *c, const void *data, size_t len);\nint RIPEMD160_Final(unsigned char *md, RIPEMD160_CTX *c);\nunsigned char *RIPEMD160(const unsigned char *d, size_t n,\n\tunsigned char *md);\nvoid RIPEMD160_Transform(RIPEMD160_CTX *c, const unsigned char *b);\n#ifdef  __cplusplus\n}\n#endif\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/openssl/rsa.h",
    "content": "/* crypto/rsa/rsa.h */\n/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)\n * All rights reserved.\n *\n * This package is an SSL implementation written\n * by Eric Young (eay@cryptsoft.com).\n * The implementation was written so as to conform with Netscapes SSL.\n * \n * This library is free for commercial and non-commercial use as long as\n * the following conditions are aheared to.  The following conditions\n * apply to all code found in this distribution, be it the RC4, RSA,\n * lhash, DES, etc., code; not just the SSL code.  The SSL documentation\n * included with this distribution is covered by the same copyright terms\n * except that the holder is Tim Hudson (tjh@cryptsoft.com).\n * \n * Copyright remains Eric Young's, and as such any Copyright notices in\n * the code are not to be removed.\n * If this package is used in a product, Eric Young should be given attribution\n * as the author of the parts of the library used.\n * This can be in the form of a textual message at program startup or\n * in documentation (online or textual) provided with the package.\n * \n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. All advertising materials mentioning features or use of this software\n *    must display the following acknowledgement:\n *    \"This product includes cryptographic software written by\n *     Eric Young (eay@cryptsoft.com)\"\n *    The word 'cryptographic' can be left out if the rouines from the library\n *    being used are not cryptographic related :-).\n * 4. If you include any Windows specific code (or a derivative thereof) from \n *    the apps directory (application code) you must include an acknowledgement:\n *    \"This product includes software written by Tim Hudson (tjh@cryptsoft.com)\"\n * \n * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n * \n * The licence and distribution terms for any publically available version or\n * derivative of this code cannot be changed.  i.e. this code cannot simply be\n * copied and put under another distribution licence\n * [including the GNU Public Licence.]\n */\n\n#ifndef HEADER_RSA_H\n#define HEADER_RSA_H\n\n#include <openssl/asn1.h>\n\n#ifndef OPENSSL_NO_BIO\n#include <openssl/bio.h>\n#endif\n#include <openssl/crypto.h>\n#include <openssl/ossl_typ.h>\n#ifndef OPENSSL_NO_DEPRECATED\n#include <openssl/bn.h>\n#endif\n\n#ifdef OPENSSL_NO_RSA\n#error RSA is disabled.\n#endif\n\n/* If this flag is set the RSA method is FIPS compliant and can be used\n * in FIPS mode. This is set in the validated module method. If an\n * application sets this flag in its own methods it is its reposibility\n * to ensure the result is compliant.\n */\n\n#define RSA_FLAG_FIPS_METHOD\t\t\t0x0400\n\n/* If this flag is set the operations normally disabled in FIPS mode are\n * permitted it is then the applications responsibility to ensure that the\n * usage is compliant.\n */\n\n#define RSA_FLAG_NON_FIPS_ALLOW\t\t\t0x0400\n\n#ifdef OPENSSL_FIPS\n#define FIPS_RSA_SIZE_T\tint\n#endif\n\n#ifdef  __cplusplus\nextern \"C\" {\n#endif\n\n/* Declared already in ossl_typ.h */\n/* typedef struct rsa_st RSA; */\n/* typedef struct rsa_meth_st RSA_METHOD; */\n\nstruct rsa_meth_st\n\t{\n\tconst char *name;\n\tint (*rsa_pub_enc)(int flen,const unsigned char *from,\n\t\t\t   unsigned char *to,\n\t\t\t   RSA *rsa,int padding);\n\tint (*rsa_pub_dec)(int flen,const unsigned char *from,\n\t\t\t   unsigned char *to,\n\t\t\t   RSA *rsa,int padding);\n\tint (*rsa_priv_enc)(int flen,const unsigned char *from,\n\t\t\t    unsigned char *to,\n\t\t\t    RSA *rsa,int padding);\n\tint (*rsa_priv_dec)(int flen,const unsigned char *from,\n\t\t\t    unsigned char *to,\n\t\t\t    RSA *rsa,int padding);\n\tint (*rsa_mod_exp)(BIGNUM *r0,const BIGNUM *I,RSA *rsa,BN_CTX *ctx); /* Can be null */\n\tint (*bn_mod_exp)(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,\n\t\t\t  const BIGNUM *m, BN_CTX *ctx,\n\t\t\t  BN_MONT_CTX *m_ctx); /* Can be null */\n\tint (*init)(RSA *rsa);\t\t/* called at new */\n\tint (*finish)(RSA *rsa);\t/* called at free */\n\tint flags;\t\t\t/* RSA_METHOD_FLAG_* things */\n\tchar *app_data;\t\t\t/* may be needed! */\n/* New sign and verify functions: some libraries don't allow arbitrary data\n * to be signed/verified: this allows them to be used. Note: for this to work\n * the RSA_public_decrypt() and RSA_private_encrypt() should *NOT* be used\n * RSA_sign(), RSA_verify() should be used instead. Note: for backwards\n * compatibility this functionality is only enabled if the RSA_FLAG_SIGN_VER\n * option is set in 'flags'.\n */\n\tint (*rsa_sign)(int type,\n\t\tconst unsigned char *m, unsigned int m_length,\n\t\tunsigned char *sigret, unsigned int *siglen, const RSA *rsa);\n\tint (*rsa_verify)(int dtype,\n\t\tconst unsigned char *m, unsigned int m_length,\n\t\tunsigned char *sigbuf, unsigned int siglen, const RSA *rsa);\n/* If this callback is NULL, the builtin software RSA key-gen will be used. This\n * is for behavioural compatibility whilst the code gets rewired, but one day\n * it would be nice to assume there are no such things as \"builtin software\"\n * implementations. */\n\tint (*rsa_keygen)(RSA *rsa, int bits, BIGNUM *e, BN_GENCB *cb);\n\t};\n\nstruct rsa_st\n\t{\n\t/* The first parameter is used to pickup errors where\n\t * this is passed instead of aEVP_PKEY, it is set to 0 */\n\tint pad;\n\tlong version;\n\tconst RSA_METHOD *meth;\n\t/* functional reference if 'meth' is ENGINE-provided */\n\tENGINE *engine;\n\tBIGNUM *n;\n\tBIGNUM *e;\n\tBIGNUM *d;\n\tBIGNUM *p;\n\tBIGNUM *q;\n\tBIGNUM *dmp1;\n\tBIGNUM *dmq1;\n\tBIGNUM *iqmp;\n\t/* be careful using this if the RSA structure is shared */\n\tCRYPTO_EX_DATA ex_data;\n\tint references;\n\tint flags;\n\n\t/* Used to cache montgomery values */\n\tBN_MONT_CTX *_method_mod_n;\n\tBN_MONT_CTX *_method_mod_p;\n\tBN_MONT_CTX *_method_mod_q;\n\n\t/* all BIGNUM values are actually in the following data, if it is not\n\t * NULL */\n\tchar *bignum_data;\n\tBN_BLINDING *blinding;\n\tBN_BLINDING *mt_blinding;\n\t};\n\n#ifndef OPENSSL_RSA_MAX_MODULUS_BITS\n# define OPENSSL_RSA_MAX_MODULUS_BITS\t16384\n#endif\n\n#define OPENSSL_RSA_FIPS_MIN_MODULUS_BITS 1024\n\n#ifndef OPENSSL_RSA_SMALL_MODULUS_BITS\n# define OPENSSL_RSA_SMALL_MODULUS_BITS\t3072\n#endif\n#ifndef OPENSSL_RSA_MAX_PUBEXP_BITS\n# define OPENSSL_RSA_MAX_PUBEXP_BITS\t64 /* exponent limit enforced for \"large\" modulus only */\n#endif\n\n#define RSA_3\t0x3L\n#define RSA_F4\t0x10001L\n\n#define RSA_METHOD_FLAG_NO_CHECK\t0x0001 /* don't check pub/private match */\n\n#define RSA_FLAG_CACHE_PUBLIC\t\t0x0002\n#define RSA_FLAG_CACHE_PRIVATE\t\t0x0004\n#define RSA_FLAG_BLINDING\t\t0x0008\n#define RSA_FLAG_THREAD_SAFE\t\t0x0010\n/* This flag means the private key operations will be handled by rsa_mod_exp\n * and that they do not depend on the private key components being present:\n * for example a key stored in external hardware. Without this flag bn_mod_exp\n * gets called when private key components are absent.\n */\n#define RSA_FLAG_EXT_PKEY\t\t0x0020\n\n/* This flag in the RSA_METHOD enables the new rsa_sign, rsa_verify functions.\n */\n#define RSA_FLAG_SIGN_VER\t\t0x0040\n\n#define RSA_FLAG_NO_BLINDING\t\t0x0080 /* new with 0.9.6j and 0.9.7b; the built-in\n                                                * RSA implementation now uses blinding by\n                                                * default (ignoring RSA_FLAG_BLINDING),\n                                                * but other engines might not need it\n                                                */\n#define RSA_FLAG_NO_CONSTTIME\t\t0x0100 /* new with 0.9.8f; the built-in RSA\n\t\t\t\t\t\t* implementation now uses constant time\n\t\t\t\t\t\t* operations by default in private key operations,\n\t\t\t\t\t\t* e.g., constant time modular exponentiation, \n                                                * modular inverse without leaking branches, \n                                                * division without leaking branches. This \n                                                * flag disables these constant time \n                                                * operations and results in faster RSA \n                                                * private key operations.\n                                                */ \n#ifndef OPENSSL_NO_DEPRECATED\n#define RSA_FLAG_NO_EXP_CONSTTIME RSA_FLAG_NO_CONSTTIME /* deprecated name for the flag*/\n                                                /* new with 0.9.7h; the built-in RSA\n                                                * implementation now uses constant time\n                                                * modular exponentiation for secret exponents\n                                                * by default. This flag causes the\n                                                * faster variable sliding window method to\n                                                * be used for all exponents.\n                                                */\n#endif\n\n\n#define RSA_PKCS1_PADDING\t1\n#define RSA_SSLV23_PADDING\t2\n#define RSA_NO_PADDING\t\t3\n#define RSA_PKCS1_OAEP_PADDING\t4\n#define RSA_X931_PADDING\t5\n\n#define RSA_PKCS1_PADDING_SIZE\t11\n\n#define RSA_set_app_data(s,arg)         RSA_set_ex_data(s,0,arg)\n#define RSA_get_app_data(s)             RSA_get_ex_data(s,0)\n\nRSA *\tRSA_new(void);\nRSA *\tRSA_new_method(ENGINE *engine);\nint\tRSA_size(const RSA *);\n\n/* Deprecated version */\n#ifndef OPENSSL_NO_DEPRECATED\nRSA *\tRSA_generate_key(int bits, unsigned long e,void\n\t\t(*callback)(int,int,void *),void *cb_arg);\n#endif /* !defined(OPENSSL_NO_DEPRECATED) */\n\n/* New version */\nint\tRSA_generate_key_ex(RSA *rsa, int bits, BIGNUM *e, BN_GENCB *cb);\nint RSA_X931_derive_ex(RSA *rsa, BIGNUM *p1, BIGNUM *p2, BIGNUM *q1, BIGNUM *q2,\n\t\t\tconst BIGNUM *Xp1, const BIGNUM *Xp2, const BIGNUM *Xp,\n\t\t\tconst BIGNUM *Xq1, const BIGNUM *Xq2, const BIGNUM *Xq,\n\t\t\tconst BIGNUM *e, BN_GENCB *cb);\nint RSA_X931_generate_key_ex(RSA *rsa, int bits, const BIGNUM *e, BN_GENCB *cb);\n\nint\tRSA_check_key(const RSA *);\n\t/* next 4 return -1 on error */\nint\tRSA_public_encrypt(int flen, const unsigned char *from,\n\t\tunsigned char *to, RSA *rsa,int padding);\nint\tRSA_private_encrypt(int flen, const unsigned char *from,\n\t\tunsigned char *to, RSA *rsa,int padding);\nint\tRSA_public_decrypt(int flen, const unsigned char *from, \n\t\tunsigned char *to, RSA *rsa,int padding);\nint\tRSA_private_decrypt(int flen, const unsigned char *from, \n\t\tunsigned char *to, RSA *rsa,int padding);\nvoid\tRSA_free (RSA *r);\n/* \"up\" the RSA object's reference count */\nint\tRSA_up_ref(RSA *r);\n\nint\tRSA_flags(const RSA *r);\n\n#ifdef OPENSSL_FIPS\nRSA *FIPS_rsa_new(void);\nvoid FIPS_rsa_free(RSA *r);\n#endif\n\nvoid RSA_set_default_method(const RSA_METHOD *meth);\nconst RSA_METHOD *RSA_get_default_method(void);\nconst RSA_METHOD *RSA_get_method(const RSA *rsa);\nint RSA_set_method(RSA *rsa, const RSA_METHOD *meth);\n\n/* This function needs the memory locking malloc callbacks to be installed */\nint RSA_memory_lock(RSA *r);\n\n/* these are the actual SSLeay RSA functions */\nconst RSA_METHOD *RSA_PKCS1_SSLeay(void);\n\nconst RSA_METHOD *RSA_null_method(void);\n\nDECLARE_ASN1_ENCODE_FUNCTIONS_const(RSA, RSAPublicKey)\nDECLARE_ASN1_ENCODE_FUNCTIONS_const(RSA, RSAPrivateKey)\n\n#ifndef OPENSSL_NO_FP_API\nint\tRSA_print_fp(FILE *fp, const RSA *r,int offset);\n#endif\n\n#ifndef OPENSSL_NO_BIO\nint\tRSA_print(BIO *bp, const RSA *r,int offset);\n#endif\n\n#ifndef OPENSSL_NO_RC4\nint i2d_RSA_NET(const RSA *a, unsigned char **pp,\n\t\tint (*cb)(char *buf, int len, const char *prompt, int verify),\n\t\tint sgckey);\nRSA *d2i_RSA_NET(RSA **a, const unsigned char **pp, long length,\n\t\t int (*cb)(char *buf, int len, const char *prompt, int verify),\n\t\t int sgckey);\n\nint i2d_Netscape_RSA(const RSA *a, unsigned char **pp,\n\t\t     int (*cb)(char *buf, int len, const char *prompt,\n\t\t\t       int verify));\nRSA *d2i_Netscape_RSA(RSA **a, const unsigned char **pp, long length,\n\t\t      int (*cb)(char *buf, int len, const char *prompt,\n\t\t\t\tint verify));\n#endif\n\n/* The following 2 functions sign and verify a X509_SIG ASN1 object\n * inside PKCS#1 padded RSA encryption */\nint RSA_sign(int type, const unsigned char *m, unsigned int m_length,\n\tunsigned char *sigret, unsigned int *siglen, RSA *rsa);\nint RSA_verify(int type, const unsigned char *m, unsigned int m_length,\n\tunsigned char *sigbuf, unsigned int siglen, RSA *rsa);\n\n/* The following 2 function sign and verify a ASN1_OCTET_STRING\n * object inside PKCS#1 padded RSA encryption */\nint RSA_sign_ASN1_OCTET_STRING(int type,\n\tconst unsigned char *m, unsigned int m_length,\n\tunsigned char *sigret, unsigned int *siglen, RSA *rsa);\nint RSA_verify_ASN1_OCTET_STRING(int type,\n\tconst unsigned char *m, unsigned int m_length,\n\tunsigned char *sigbuf, unsigned int siglen, RSA *rsa);\n\nint RSA_blinding_on(RSA *rsa, BN_CTX *ctx);\nvoid RSA_blinding_off(RSA *rsa);\nBN_BLINDING *RSA_setup_blinding(RSA *rsa, BN_CTX *ctx);\n\nint RSA_padding_add_PKCS1_type_1(unsigned char *to,int tlen,\n\tconst unsigned char *f,int fl);\nint RSA_padding_check_PKCS1_type_1(unsigned char *to,int tlen,\n\tconst unsigned char *f,int fl,int rsa_len);\nint RSA_padding_add_PKCS1_type_2(unsigned char *to,int tlen,\n\tconst unsigned char *f,int fl);\nint RSA_padding_check_PKCS1_type_2(unsigned char *to,int tlen,\n\tconst unsigned char *f,int fl,int rsa_len);\nint PKCS1_MGF1(unsigned char *mask, long len,\n\tconst unsigned char *seed, long seedlen, const EVP_MD *dgst);\nint RSA_padding_add_PKCS1_OAEP(unsigned char *to,int tlen,\n\tconst unsigned char *f,int fl,\n\tconst unsigned char *p,int pl);\nint RSA_padding_check_PKCS1_OAEP(unsigned char *to,int tlen,\n\tconst unsigned char *f,int fl,int rsa_len,\n\tconst unsigned char *p,int pl);\nint RSA_padding_add_SSLv23(unsigned char *to,int tlen,\n\tconst unsigned char *f,int fl);\nint RSA_padding_check_SSLv23(unsigned char *to,int tlen,\n\tconst unsigned char *f,int fl,int rsa_len);\nint RSA_padding_add_none(unsigned char *to,int tlen,\n\tconst unsigned char *f,int fl);\nint RSA_padding_check_none(unsigned char *to,int tlen,\n\tconst unsigned char *f,int fl,int rsa_len);\nint RSA_padding_add_X931(unsigned char *to,int tlen,\n\tconst unsigned char *f,int fl);\nint RSA_padding_check_X931(unsigned char *to,int tlen,\n\tconst unsigned char *f,int fl,int rsa_len);\nint RSA_X931_hash_id(int nid);\n\nint RSA_verify_PKCS1_PSS(RSA *rsa, const unsigned char *mHash,\n\t\t\tconst EVP_MD *Hash, const unsigned char *EM, int sLen);\nint RSA_padding_add_PKCS1_PSS(RSA *rsa, unsigned char *EM,\n\t\t\tconst unsigned char *mHash,\n\t\t\tconst EVP_MD *Hash, int sLen);\n\nint RSA_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func,\n\tCRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func);\nint RSA_set_ex_data(RSA *r,int idx,void *arg);\nvoid *RSA_get_ex_data(const RSA *r, int idx);\n\nRSA *RSAPublicKey_dup(RSA *rsa);\nRSA *RSAPrivateKey_dup(RSA *rsa);\n\n/* BEGIN ERROR CODES */\n/* The following lines are auto generated by the script mkerr.pl. Any changes\n * made after this point may be overwritten when the script is next run.\n */\nvoid ERR_load_RSA_strings(void);\n\n/* Error codes for the RSA functions. */\n\n/* Function codes. */\n#define RSA_F_FIPS_RSA_SIGN\t\t\t\t 140\n#define RSA_F_FIPS_RSA_VERIFY\t\t\t\t 141\n#define RSA_F_MEMORY_LOCK\t\t\t\t 100\n#define RSA_F_RSA_BUILTIN_KEYGEN\t\t\t 129\n#define RSA_F_RSA_CHECK_KEY\t\t\t\t 123\n#define RSA_F_RSA_EAY_PRIVATE_DECRYPT\t\t\t 101\n#define RSA_F_RSA_EAY_PRIVATE_ENCRYPT\t\t\t 102\n#define RSA_F_RSA_EAY_PUBLIC_DECRYPT\t\t\t 103\n#define RSA_F_RSA_EAY_PUBLIC_ENCRYPT\t\t\t 104\n#define RSA_F_RSA_GENERATE_KEY\t\t\t\t 105\n#define RSA_F_RSA_MEMORY_LOCK\t\t\t\t 130\n#define RSA_F_RSA_NEW_METHOD\t\t\t\t 106\n#define RSA_F_RSA_NULL\t\t\t\t\t 124\n#define RSA_F_RSA_NULL_MOD_EXP\t\t\t\t 131\n#define RSA_F_RSA_NULL_PRIVATE_DECRYPT\t\t\t 132\n#define RSA_F_RSA_NULL_PRIVATE_ENCRYPT\t\t\t 133\n#define RSA_F_RSA_NULL_PUBLIC_DECRYPT\t\t\t 134\n#define RSA_F_RSA_NULL_PUBLIC_ENCRYPT\t\t\t 135\n#define RSA_F_RSA_PADDING_ADD_NONE\t\t\t 107\n#define RSA_F_RSA_PADDING_ADD_PKCS1_OAEP\t\t 121\n#define RSA_F_RSA_PADDING_ADD_PKCS1_PSS\t\t\t 125\n#define RSA_F_RSA_PADDING_ADD_PKCS1_TYPE_1\t\t 108\n#define RSA_F_RSA_PADDING_ADD_PKCS1_TYPE_2\t\t 109\n#define RSA_F_RSA_PADDING_ADD_SSLV23\t\t\t 110\n#define RSA_F_RSA_PADDING_ADD_X931\t\t\t 127\n#define RSA_F_RSA_PADDING_CHECK_NONE\t\t\t 111\n#define RSA_F_RSA_PADDING_CHECK_PKCS1_OAEP\t\t 122\n#define RSA_F_RSA_PADDING_CHECK_PKCS1_TYPE_1\t\t 112\n#define RSA_F_RSA_PADDING_CHECK_PKCS1_TYPE_2\t\t 113\n#define RSA_F_RSA_PADDING_CHECK_SSLV23\t\t\t 114\n#define RSA_F_RSA_PADDING_CHECK_X931\t\t\t 128\n#define RSA_F_RSA_PRINT\t\t\t\t\t 115\n#define RSA_F_RSA_PRINT_FP\t\t\t\t 116\n#define RSA_F_RSA_PRIVATE_ENCRYPT\t\t\t 137\n#define RSA_F_RSA_PUBLIC_DECRYPT\t\t\t 138\n#define RSA_F_RSA_SETUP_BLINDING\t\t\t 136\n#define RSA_F_RSA_SET_DEFAULT_METHOD\t\t\t 139\n#define RSA_F_RSA_SET_METHOD\t\t\t\t 142\n#define RSA_F_RSA_SIGN\t\t\t\t\t 117\n#define RSA_F_RSA_SIGN_ASN1_OCTET_STRING\t\t 118\n#define RSA_F_RSA_VERIFY\t\t\t\t 119\n#define RSA_F_RSA_VERIFY_ASN1_OCTET_STRING\t\t 120\n#define RSA_F_RSA_VERIFY_PKCS1_PSS\t\t\t 126\n\n/* Reason codes. */\n#define RSA_R_ALGORITHM_MISMATCH\t\t\t 100\n#define RSA_R_BAD_E_VALUE\t\t\t\t 101\n#define RSA_R_BAD_FIXED_HEADER_DECRYPT\t\t\t 102\n#define RSA_R_BAD_PAD_BYTE_COUNT\t\t\t 103\n#define RSA_R_BAD_SIGNATURE\t\t\t\t 104\n#define RSA_R_BLOCK_TYPE_IS_NOT_01\t\t\t 106\n#define RSA_R_BLOCK_TYPE_IS_NOT_02\t\t\t 107\n#define RSA_R_DATA_GREATER_THAN_MOD_LEN\t\t\t 108\n#define RSA_R_DATA_TOO_LARGE\t\t\t\t 109\n#define RSA_R_DATA_TOO_LARGE_FOR_KEY_SIZE\t\t 110\n#define RSA_R_DATA_TOO_LARGE_FOR_MODULUS\t\t 132\n#define RSA_R_DATA_TOO_SMALL\t\t\t\t 111\n#define RSA_R_DATA_TOO_SMALL_FOR_KEY_SIZE\t\t 122\n#define RSA_R_DIGEST_TOO_BIG_FOR_RSA_KEY\t\t 112\n#define RSA_R_DMP1_NOT_CONGRUENT_TO_D\t\t\t 124\n#define RSA_R_DMQ1_NOT_CONGRUENT_TO_D\t\t\t 125\n#define RSA_R_D_E_NOT_CONGRUENT_TO_1\t\t\t 123\n#define RSA_R_FIRST_OCTET_INVALID\t\t\t 133\n#define RSA_R_INVALID_HEADER\t\t\t\t 137\n#define RSA_R_INVALID_MESSAGE_LENGTH\t\t\t 131\n#define RSA_R_INVALID_PADDING\t\t\t\t 138\n#define RSA_R_INVALID_TRAILER\t\t\t\t 139\n#define RSA_R_IQMP_NOT_INVERSE_OF_Q\t\t\t 126\n#define RSA_R_KEY_SIZE_TOO_SMALL\t\t\t 120\n#define RSA_R_LAST_OCTET_INVALID\t\t\t 134\n#define RSA_R_MODULUS_TOO_LARGE\t\t\t\t 105\n#define RSA_R_NON_FIPS_METHOD\t\t\t\t 141\n#define RSA_R_NO_PUBLIC_EXPONENT\t\t\t 140\n#define RSA_R_NULL_BEFORE_BLOCK_MISSING\t\t\t 113\n#define RSA_R_N_DOES_NOT_EQUAL_P_Q\t\t\t 127\n#define RSA_R_OAEP_DECODING_ERROR\t\t\t 121\n#define RSA_R_OPERATION_NOT_ALLOWED_IN_FIPS_MODE\t 142\n#define RSA_R_PADDING_CHECK_FAILED\t\t\t 114\n#define RSA_R_P_NOT_PRIME\t\t\t\t 128\n#define RSA_R_Q_NOT_PRIME\t\t\t\t 129\n#define RSA_R_RSA_OPERATIONS_NOT_SUPPORTED\t\t 130\n#define RSA_R_SLEN_CHECK_FAILED\t\t\t\t 136\n#define RSA_R_SLEN_RECOVERY_FAILED\t\t\t 135\n#define RSA_R_SSLV3_ROLLBACK_ATTACK\t\t\t 115\n#define RSA_R_THE_ASN1_OBJECT_IDENTIFIER_IS_NOT_KNOWN_FOR_THIS_MD 116\n#define RSA_R_UNKNOWN_ALGORITHM_TYPE\t\t\t 117\n#define RSA_R_UNKNOWN_PADDING_TYPE\t\t\t 118\n#define RSA_R_WRONG_SIGNATURE_LENGTH\t\t\t 119\n\n#ifdef  __cplusplus\n}\n#endif\n#endif\n"
  },
  {
    "path": "freebsd-headers/openssl/safestack.h",
    "content": "/* ====================================================================\n * Copyright (c) 1999 The OpenSSL Project.  All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n *\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer. \n *\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in\n *    the documentation and/or other materials provided with the\n *    distribution.\n *\n * 3. All advertising materials mentioning features or use of this\n *    software must display the following acknowledgment:\n *    \"This product includes software developed by the OpenSSL Project\n *    for use in the OpenSSL Toolkit. (http://www.openssl.org/)\"\n *\n * 4. The names \"OpenSSL Toolkit\" and \"OpenSSL Project\" must not be used to\n *    endorse or promote products derived from this software without\n *    prior written permission. For written permission, please contact\n *    openssl-core@openssl.org.\n *\n * 5. Products derived from this software may not be called \"OpenSSL\"\n *    nor may \"OpenSSL\" appear in their names without prior written\n *    permission of the OpenSSL Project.\n *\n * 6. Redistributions of any form whatsoever must retain the following\n *    acknowledgment:\n *    \"This product includes software developed by the OpenSSL Project\n *    for use in the OpenSSL Toolkit (http://www.openssl.org/)\"\n *\n * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY\n * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\n * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE OpenSSL PROJECT OR\n * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\n * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,\n * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED\n * OF THE POSSIBILITY OF SUCH DAMAGE.\n * ====================================================================\n *\n * This product includes cryptographic software written by Eric Young\n * (eay@cryptsoft.com).  This product includes software written by Tim\n * Hudson (tjh@cryptsoft.com).\n *\n */\n\n#ifndef HEADER_SAFESTACK_H\n#define HEADER_SAFESTACK_H\n\n#include <openssl/stack.h>\n\n#ifdef DEBUG_SAFESTACK\n\n#ifndef CHECKED_PTR_OF\n#define CHECKED_PTR_OF(type, p) \\\n    ((void*) (1 ? p : (type*)0))\n#endif\n\n#define CHECKED_SK_FREE_FUNC(type, p) \\\n    ((void (*)(void *)) ((1 ? p : (void (*)(type *))0)))\n\n#define CHECKED_SK_CMP_FUNC(type, p) \\\n    ((int (*)(const char * const *, const char * const *)) \\\n\t((1 ? p : (int (*)(const type * const *, const type * const *))0)))\n\n#define STACK_OF(type) struct stack_st_##type\n#define PREDECLARE_STACK_OF(type) STACK_OF(type);\n\n#define DECLARE_STACK_OF(type) \\\nSTACK_OF(type) \\\n    { \\\n    STACK stack; \\\n    };\n\n#define IMPLEMENT_STACK_OF(type) /* nada (obsolete in new safestack approach)*/\n\n/* SKM_sk_... stack macros are internal to safestack.h:\n * never use them directly, use sk_<type>_... instead */\n#define SKM_sk_new(type, cmp) \\\n\t((STACK_OF(type) *)sk_new(CHECKED_SK_CMP_FUNC(type, cmp)))\n#define SKM_sk_new_null(type) \\\n\t((STACK_OF(type) *)sk_new_null())\n#define SKM_sk_free(type, st) \\\n\tsk_free(CHECKED_PTR_OF(STACK_OF(type), st))\n#define SKM_sk_num(type, st) \\\n\tsk_num(CHECKED_PTR_OF(STACK_OF(type), st))\n#define SKM_sk_value(type, st,i) \\\n\t((type *)sk_value(CHECKED_PTR_OF(STACK_OF(type), st), i))\n#define SKM_sk_set(type, st,i,val) \\\n\tsk_set(CHECKED_PTR_OF(STACK_OF(type), st), i, CHECKED_PTR_OF(type, val))\n#define SKM_sk_zero(type, st) \\\n\tsk_zero(CHECKED_PTR_OF(STACK_OF(type), st))\n#define SKM_sk_push(type, st,val) \\\n\tsk_push(CHECKED_PTR_OF(STACK_OF(type), st), CHECKED_PTR_OF(type, val))\n#define SKM_sk_unshift(type, st,val) \\\n\tsk_unshift(CHECKED_PTR_OF(STACK_OF(type), st), CHECKED_PTR_OF(type, val))\n#define SKM_sk_find(type, st,val) \\\n\tsk_find(CHECKED_PTR_OF(STACK_OF(type), st), CHECKED_PTR_OF(type, val))\n#define SKM_sk_delete(type, st,i) \\\n\t(type *)sk_delete(CHECKED_PTR_OF(STACK_OF(type), st), i)\n#define SKM_sk_delete_ptr(type, st,ptr) \\\n\t(type *)sk_delete_ptr(CHECKED_PTR_OF(STACK_OF(type), st), CHECKED_PTR_OF(type, ptr))\n#define SKM_sk_insert(type, st,val,i) \\\n\tsk_insert(CHECKED_PTR_OF(STACK_OF(type), st), CHECKED_PTR_OF(type, val), i)\n#define SKM_sk_set_cmp_func(type, st,cmp) \\\n\t((int (*)(const type * const *,const type * const *)) \\\n\tsk_set_cmp_func(CHECKED_PTR_OF(STACK_OF(type), st), CHECKED_SK_CMP_FUNC(type, cmp)))\n#define SKM_sk_dup(type, st) \\\n\t(STACK_OF(type) *)sk_dup(CHECKED_PTR_OF(STACK_OF(type), st))\n#define SKM_sk_pop_free(type, st,free_func) \\\n\tsk_pop_free(CHECKED_PTR_OF(STACK_OF(type), st), CHECKED_SK_FREE_FUNC(type, free_func))\n#define SKM_sk_shift(type, st) \\\n\t(type *)sk_shift(CHECKED_PTR_OF(STACK_OF(type), st))\n#define SKM_sk_pop(type, st) \\\n\t(type *)sk_pop(CHECKED_PTR_OF(STACK_OF(type), st))\n#define SKM_sk_sort(type, st) \\\n\tsk_sort(CHECKED_PTR_OF(STACK_OF(type), st))\n#define SKM_sk_is_sorted(type, st) \\\n\tsk_is_sorted(CHECKED_PTR_OF(STACK_OF(type), st))\n\n#define\tSKM_ASN1_SET_OF_d2i(type, st, pp, length, d2i_func, free_func, ex_tag, ex_class) \\\n\t(STACK_OF(type) *)d2i_ASN1_SET(CHECKED_PTR_OF(STACK_OF(type)*, st), \\\n\t\t\t\tpp, length, \\\n\t\t\t\tCHECKED_D2I_OF(type, d2i_func), \\\n\t\t\t\tCHECKED_SK_FREE_FUNC(type, free_func), \\\n\t\t\t\tex_tag, ex_class)\n\n#define\tSKM_ASN1_SET_OF_i2d(type, st, pp, i2d_func, ex_tag, ex_class, is_set) \\\n\ti2d_ASN1_SET(CHECKED_PTR_OF(STACK_OF(type), st), pp, \\\n\t\t\t\tCHECKED_I2D_OF(type, i2d_func), \\\n\t\t\t\tex_tag, ex_class, is_set)\n\n#define\tSKM_ASN1_seq_pack(type, st, i2d_func, buf, len) \\\n\tASN1_seq_pack(CHECKED_PTR_OF(STACK_OF(type), st), \\\n\t\t\tCHECKED_I2D_OF(type, i2d_func), buf, len)\n\n#define\tSKM_ASN1_seq_unpack(type, buf, len, d2i_func, free_func) \\\n\t(STACK_OF(type) *)ASN1_seq_unpack(buf, len, CHECKED_D2I_OF(type, d2i_func), CHECKED_SK_FREE_FUNC(type, free_func))\n\n#define SKM_PKCS12_decrypt_d2i(type, algor, d2i_func, free_func, pass, passlen, oct, seq) \\\n\t(STACK_OF(type) *)PKCS12_decrypt_d2i(algor, \\\n\t\t\t\tCHECKED_D2I_OF(type, d2i_func), \\\n\t\t\t\tCHECKED_SK_FREE_FUNC(type, free_func), \\\n\t\t\t\tpass, passlen, oct, seq)\n\n#else\n\n#define STACK_OF(type) STACK\n#define PREDECLARE_STACK_OF(type) /* nada */\n#define DECLARE_STACK_OF(type)    /* nada */\n#define IMPLEMENT_STACK_OF(type)  /* nada */\n\n#define SKM_sk_new(type, cmp) \\\n\tsk_new((int (*)(const char * const *, const char * const *))(cmp))\n#define SKM_sk_new_null(type) \\\n\tsk_new_null()\n#define SKM_sk_free(type, st) \\\n\tsk_free(st)\n#define SKM_sk_num(type, st) \\\n\tsk_num(st)\n#define SKM_sk_value(type, st,i) \\\n\t((type *)sk_value(st, i))\n#define SKM_sk_set(type, st,i,val) \\\n\t((type *)sk_set(st, i,(char *)val))\n#define SKM_sk_zero(type, st) \\\n\tsk_zero(st)\n#define SKM_sk_push(type, st,val) \\\n\tsk_push(st, (char *)val)\n#define SKM_sk_unshift(type, st,val) \\\n\tsk_unshift(st, (char *)val)\n#define SKM_sk_find(type, st,val) \\\n\tsk_find(st, (char *)val)\n#define SKM_sk_delete(type, st,i) \\\n\t((type *)sk_delete(st, i))\n#define SKM_sk_delete_ptr(type, st,ptr) \\\n\t((type *)sk_delete_ptr(st,(char *)ptr))\n#define SKM_sk_insert(type, st,val,i) \\\n\tsk_insert(st, (char *)val, i)\n#define SKM_sk_set_cmp_func(type, st,cmp) \\\n\t((int (*)(const type * const *,const type * const *)) \\\n\tsk_set_cmp_func(st, (int (*)(const char * const *, const char * const *))(cmp)))\n#define SKM_sk_dup(type, st) \\\n\tsk_dup(st)\n#define SKM_sk_pop_free(type, st,free_func) \\\n\tsk_pop_free(st, (void (*)(void *))free_func)\n#define SKM_sk_shift(type, st) \\\n\t((type *)sk_shift(st))\n#define SKM_sk_pop(type, st) \\\n\t((type *)sk_pop(st))\n#define SKM_sk_sort(type, st) \\\n\tsk_sort(st)\n#define SKM_sk_is_sorted(type, st) \\\n\tsk_is_sorted(st)\n\n#define\tSKM_ASN1_SET_OF_d2i(type, st, pp, length, d2i_func, free_func, ex_tag, ex_class) \\\n\td2i_ASN1_SET(st,pp,length, (void *(*)(void ** ,const unsigned char ** ,long))d2i_func, (void (*)(void *))free_func, ex_tag,ex_class)\n#define\tSKM_ASN1_SET_OF_i2d(type, st, pp, i2d_func, ex_tag, ex_class, is_set) \\\n\ti2d_ASN1_SET(st,pp,(int (*)(void *, unsigned char **))i2d_func,ex_tag,ex_class,is_set)\n\n#define\tSKM_ASN1_seq_pack(type, st, i2d_func, buf, len) \\\n\tASN1_seq_pack(st, (int (*)(void *, unsigned char **))i2d_func, buf, len)\n#define\tSKM_ASN1_seq_unpack(type, buf, len, d2i_func, free_func) \\\n\tASN1_seq_unpack(buf,len,(void *(*)(void **,const unsigned char **,long))d2i_func, (void(*)(void *))free_func)\n\n#define SKM_PKCS12_decrypt_d2i(type, algor, d2i_func, free_func, pass, passlen, oct, seq) \\\n\t((STACK *)PKCS12_decrypt_d2i(algor,(char *(*)())d2i_func, (void(*)(void *))free_func,pass,passlen,oct,seq))\n\n#endif\n\n/* This block of defines is updated by util/mkstack.pl, please do not touch! */\n#define sk_ACCESS_DESCRIPTION_new(st) SKM_sk_new(ACCESS_DESCRIPTION, (st))\n#define sk_ACCESS_DESCRIPTION_new_null() SKM_sk_new_null(ACCESS_DESCRIPTION)\n#define sk_ACCESS_DESCRIPTION_free(st) SKM_sk_free(ACCESS_DESCRIPTION, (st))\n#define sk_ACCESS_DESCRIPTION_num(st) SKM_sk_num(ACCESS_DESCRIPTION, (st))\n#define sk_ACCESS_DESCRIPTION_value(st, i) SKM_sk_value(ACCESS_DESCRIPTION, (st), (i))\n#define sk_ACCESS_DESCRIPTION_set(st, i, val) SKM_sk_set(ACCESS_DESCRIPTION, (st), (i), (val))\n#define sk_ACCESS_DESCRIPTION_zero(st) SKM_sk_zero(ACCESS_DESCRIPTION, (st))\n#define sk_ACCESS_DESCRIPTION_push(st, val) SKM_sk_push(ACCESS_DESCRIPTION, (st), (val))\n#define sk_ACCESS_DESCRIPTION_unshift(st, val) SKM_sk_unshift(ACCESS_DESCRIPTION, (st), (val))\n#define sk_ACCESS_DESCRIPTION_find(st, val) SKM_sk_find(ACCESS_DESCRIPTION, (st), (val))\n#define sk_ACCESS_DESCRIPTION_find_ex(st, val) SKM_sk_find_ex(ACCESS_DESCRIPTION, (st), (val))\n#define sk_ACCESS_DESCRIPTION_delete(st, i) SKM_sk_delete(ACCESS_DESCRIPTION, (st), (i))\n#define sk_ACCESS_DESCRIPTION_delete_ptr(st, ptr) SKM_sk_delete_ptr(ACCESS_DESCRIPTION, (st), (ptr))\n#define sk_ACCESS_DESCRIPTION_insert(st, val, i) SKM_sk_insert(ACCESS_DESCRIPTION, (st), (val), (i))\n#define sk_ACCESS_DESCRIPTION_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(ACCESS_DESCRIPTION, (st), (cmp))\n#define sk_ACCESS_DESCRIPTION_dup(st) SKM_sk_dup(ACCESS_DESCRIPTION, st)\n#define sk_ACCESS_DESCRIPTION_pop_free(st, free_func) SKM_sk_pop_free(ACCESS_DESCRIPTION, (st), (free_func))\n#define sk_ACCESS_DESCRIPTION_shift(st) SKM_sk_shift(ACCESS_DESCRIPTION, (st))\n#define sk_ACCESS_DESCRIPTION_pop(st) SKM_sk_pop(ACCESS_DESCRIPTION, (st))\n#define sk_ACCESS_DESCRIPTION_sort(st) SKM_sk_sort(ACCESS_DESCRIPTION, (st))\n#define sk_ACCESS_DESCRIPTION_is_sorted(st) SKM_sk_is_sorted(ACCESS_DESCRIPTION, (st))\n\n#define sk_ASIdOrRange_new(st) SKM_sk_new(ASIdOrRange, (st))\n#define sk_ASIdOrRange_new_null() SKM_sk_new_null(ASIdOrRange)\n#define sk_ASIdOrRange_free(st) SKM_sk_free(ASIdOrRange, (st))\n#define sk_ASIdOrRange_num(st) SKM_sk_num(ASIdOrRange, (st))\n#define sk_ASIdOrRange_value(st, i) SKM_sk_value(ASIdOrRange, (st), (i))\n#define sk_ASIdOrRange_set(st, i, val) SKM_sk_set(ASIdOrRange, (st), (i), (val))\n#define sk_ASIdOrRange_zero(st) SKM_sk_zero(ASIdOrRange, (st))\n#define sk_ASIdOrRange_push(st, val) SKM_sk_push(ASIdOrRange, (st), (val))\n#define sk_ASIdOrRange_unshift(st, val) SKM_sk_unshift(ASIdOrRange, (st), (val))\n#define sk_ASIdOrRange_find(st, val) SKM_sk_find(ASIdOrRange, (st), (val))\n#define sk_ASIdOrRange_find_ex(st, val) SKM_sk_find_ex(ASIdOrRange, (st), (val))\n#define sk_ASIdOrRange_delete(st, i) SKM_sk_delete(ASIdOrRange, (st), (i))\n#define sk_ASIdOrRange_delete_ptr(st, ptr) SKM_sk_delete_ptr(ASIdOrRange, (st), (ptr))\n#define sk_ASIdOrRange_insert(st, val, i) SKM_sk_insert(ASIdOrRange, (st), (val), (i))\n#define sk_ASIdOrRange_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(ASIdOrRange, (st), (cmp))\n#define sk_ASIdOrRange_dup(st) SKM_sk_dup(ASIdOrRange, st)\n#define sk_ASIdOrRange_pop_free(st, free_func) SKM_sk_pop_free(ASIdOrRange, (st), (free_func))\n#define sk_ASIdOrRange_shift(st) SKM_sk_shift(ASIdOrRange, (st))\n#define sk_ASIdOrRange_pop(st) SKM_sk_pop(ASIdOrRange, (st))\n#define sk_ASIdOrRange_sort(st) SKM_sk_sort(ASIdOrRange, (st))\n#define sk_ASIdOrRange_is_sorted(st) SKM_sk_is_sorted(ASIdOrRange, (st))\n\n#define sk_ASN1_GENERALSTRING_new(st) SKM_sk_new(ASN1_GENERALSTRING, (st))\n#define sk_ASN1_GENERALSTRING_new_null() SKM_sk_new_null(ASN1_GENERALSTRING)\n#define sk_ASN1_GENERALSTRING_free(st) SKM_sk_free(ASN1_GENERALSTRING, (st))\n#define sk_ASN1_GENERALSTRING_num(st) SKM_sk_num(ASN1_GENERALSTRING, (st))\n#define sk_ASN1_GENERALSTRING_value(st, i) SKM_sk_value(ASN1_GENERALSTRING, (st), (i))\n#define sk_ASN1_GENERALSTRING_set(st, i, val) SKM_sk_set(ASN1_GENERALSTRING, (st), (i), (val))\n#define sk_ASN1_GENERALSTRING_zero(st) SKM_sk_zero(ASN1_GENERALSTRING, (st))\n#define sk_ASN1_GENERALSTRING_push(st, val) SKM_sk_push(ASN1_GENERALSTRING, (st), (val))\n#define sk_ASN1_GENERALSTRING_unshift(st, val) SKM_sk_unshift(ASN1_GENERALSTRING, (st), (val))\n#define sk_ASN1_GENERALSTRING_find(st, val) SKM_sk_find(ASN1_GENERALSTRING, (st), (val))\n#define sk_ASN1_GENERALSTRING_find_ex(st, val) SKM_sk_find_ex(ASN1_GENERALSTRING, (st), (val))\n#define sk_ASN1_GENERALSTRING_delete(st, i) SKM_sk_delete(ASN1_GENERALSTRING, (st), (i))\n#define sk_ASN1_GENERALSTRING_delete_ptr(st, ptr) SKM_sk_delete_ptr(ASN1_GENERALSTRING, (st), (ptr))\n#define sk_ASN1_GENERALSTRING_insert(st, val, i) SKM_sk_insert(ASN1_GENERALSTRING, (st), (val), (i))\n#define sk_ASN1_GENERALSTRING_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(ASN1_GENERALSTRING, (st), (cmp))\n#define sk_ASN1_GENERALSTRING_dup(st) SKM_sk_dup(ASN1_GENERALSTRING, st)\n#define sk_ASN1_GENERALSTRING_pop_free(st, free_func) SKM_sk_pop_free(ASN1_GENERALSTRING, (st), (free_func))\n#define sk_ASN1_GENERALSTRING_shift(st) SKM_sk_shift(ASN1_GENERALSTRING, (st))\n#define sk_ASN1_GENERALSTRING_pop(st) SKM_sk_pop(ASN1_GENERALSTRING, (st))\n#define sk_ASN1_GENERALSTRING_sort(st) SKM_sk_sort(ASN1_GENERALSTRING, (st))\n#define sk_ASN1_GENERALSTRING_is_sorted(st) SKM_sk_is_sorted(ASN1_GENERALSTRING, (st))\n\n#define sk_ASN1_INTEGER_new(st) SKM_sk_new(ASN1_INTEGER, (st))\n#define sk_ASN1_INTEGER_new_null() SKM_sk_new_null(ASN1_INTEGER)\n#define sk_ASN1_INTEGER_free(st) SKM_sk_free(ASN1_INTEGER, (st))\n#define sk_ASN1_INTEGER_num(st) SKM_sk_num(ASN1_INTEGER, (st))\n#define sk_ASN1_INTEGER_value(st, i) SKM_sk_value(ASN1_INTEGER, (st), (i))\n#define sk_ASN1_INTEGER_set(st, i, val) SKM_sk_set(ASN1_INTEGER, (st), (i), (val))\n#define sk_ASN1_INTEGER_zero(st) SKM_sk_zero(ASN1_INTEGER, (st))\n#define sk_ASN1_INTEGER_push(st, val) SKM_sk_push(ASN1_INTEGER, (st), (val))\n#define sk_ASN1_INTEGER_unshift(st, val) SKM_sk_unshift(ASN1_INTEGER, (st), (val))\n#define sk_ASN1_INTEGER_find(st, val) SKM_sk_find(ASN1_INTEGER, (st), (val))\n#define sk_ASN1_INTEGER_find_ex(st, val) SKM_sk_find_ex(ASN1_INTEGER, (st), (val))\n#define sk_ASN1_INTEGER_delete(st, i) SKM_sk_delete(ASN1_INTEGER, (st), (i))\n#define sk_ASN1_INTEGER_delete_ptr(st, ptr) SKM_sk_delete_ptr(ASN1_INTEGER, (st), (ptr))\n#define sk_ASN1_INTEGER_insert(st, val, i) SKM_sk_insert(ASN1_INTEGER, (st), (val), (i))\n#define sk_ASN1_INTEGER_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(ASN1_INTEGER, (st), (cmp))\n#define sk_ASN1_INTEGER_dup(st) SKM_sk_dup(ASN1_INTEGER, st)\n#define sk_ASN1_INTEGER_pop_free(st, free_func) SKM_sk_pop_free(ASN1_INTEGER, (st), (free_func))\n#define sk_ASN1_INTEGER_shift(st) SKM_sk_shift(ASN1_INTEGER, (st))\n#define sk_ASN1_INTEGER_pop(st) SKM_sk_pop(ASN1_INTEGER, (st))\n#define sk_ASN1_INTEGER_sort(st) SKM_sk_sort(ASN1_INTEGER, (st))\n#define sk_ASN1_INTEGER_is_sorted(st) SKM_sk_is_sorted(ASN1_INTEGER, (st))\n\n#define sk_ASN1_OBJECT_new(st) SKM_sk_new(ASN1_OBJECT, (st))\n#define sk_ASN1_OBJECT_new_null() SKM_sk_new_null(ASN1_OBJECT)\n#define sk_ASN1_OBJECT_free(st) SKM_sk_free(ASN1_OBJECT, (st))\n#define sk_ASN1_OBJECT_num(st) SKM_sk_num(ASN1_OBJECT, (st))\n#define sk_ASN1_OBJECT_value(st, i) SKM_sk_value(ASN1_OBJECT, (st), (i))\n#define sk_ASN1_OBJECT_set(st, i, val) SKM_sk_set(ASN1_OBJECT, (st), (i), (val))\n#define sk_ASN1_OBJECT_zero(st) SKM_sk_zero(ASN1_OBJECT, (st))\n#define sk_ASN1_OBJECT_push(st, val) SKM_sk_push(ASN1_OBJECT, (st), (val))\n#define sk_ASN1_OBJECT_unshift(st, val) SKM_sk_unshift(ASN1_OBJECT, (st), (val))\n#define sk_ASN1_OBJECT_find(st, val) SKM_sk_find(ASN1_OBJECT, (st), (val))\n#define sk_ASN1_OBJECT_find_ex(st, val) SKM_sk_find_ex(ASN1_OBJECT, (st), (val))\n#define sk_ASN1_OBJECT_delete(st, i) SKM_sk_delete(ASN1_OBJECT, (st), (i))\n#define sk_ASN1_OBJECT_delete_ptr(st, ptr) SKM_sk_delete_ptr(ASN1_OBJECT, (st), (ptr))\n#define sk_ASN1_OBJECT_insert(st, val, i) SKM_sk_insert(ASN1_OBJECT, (st), (val), (i))\n#define sk_ASN1_OBJECT_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(ASN1_OBJECT, (st), (cmp))\n#define sk_ASN1_OBJECT_dup(st) SKM_sk_dup(ASN1_OBJECT, st)\n#define sk_ASN1_OBJECT_pop_free(st, free_func) SKM_sk_pop_free(ASN1_OBJECT, (st), (free_func))\n#define sk_ASN1_OBJECT_shift(st) SKM_sk_shift(ASN1_OBJECT, (st))\n#define sk_ASN1_OBJECT_pop(st) SKM_sk_pop(ASN1_OBJECT, (st))\n#define sk_ASN1_OBJECT_sort(st) SKM_sk_sort(ASN1_OBJECT, (st))\n#define sk_ASN1_OBJECT_is_sorted(st) SKM_sk_is_sorted(ASN1_OBJECT, (st))\n\n#define sk_ASN1_STRING_TABLE_new(st) SKM_sk_new(ASN1_STRING_TABLE, (st))\n#define sk_ASN1_STRING_TABLE_new_null() SKM_sk_new_null(ASN1_STRING_TABLE)\n#define sk_ASN1_STRING_TABLE_free(st) SKM_sk_free(ASN1_STRING_TABLE, (st))\n#define sk_ASN1_STRING_TABLE_num(st) SKM_sk_num(ASN1_STRING_TABLE, (st))\n#define sk_ASN1_STRING_TABLE_value(st, i) SKM_sk_value(ASN1_STRING_TABLE, (st), (i))\n#define sk_ASN1_STRING_TABLE_set(st, i, val) SKM_sk_set(ASN1_STRING_TABLE, (st), (i), (val))\n#define sk_ASN1_STRING_TABLE_zero(st) SKM_sk_zero(ASN1_STRING_TABLE, (st))\n#define sk_ASN1_STRING_TABLE_push(st, val) SKM_sk_push(ASN1_STRING_TABLE, (st), (val))\n#define sk_ASN1_STRING_TABLE_unshift(st, val) SKM_sk_unshift(ASN1_STRING_TABLE, (st), (val))\n#define sk_ASN1_STRING_TABLE_find(st, val) SKM_sk_find(ASN1_STRING_TABLE, (st), (val))\n#define sk_ASN1_STRING_TABLE_find_ex(st, val) SKM_sk_find_ex(ASN1_STRING_TABLE, (st), (val))\n#define sk_ASN1_STRING_TABLE_delete(st, i) SKM_sk_delete(ASN1_STRING_TABLE, (st), (i))\n#define sk_ASN1_STRING_TABLE_delete_ptr(st, ptr) SKM_sk_delete_ptr(ASN1_STRING_TABLE, (st), (ptr))\n#define sk_ASN1_STRING_TABLE_insert(st, val, i) SKM_sk_insert(ASN1_STRING_TABLE, (st), (val), (i))\n#define sk_ASN1_STRING_TABLE_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(ASN1_STRING_TABLE, (st), (cmp))\n#define sk_ASN1_STRING_TABLE_dup(st) SKM_sk_dup(ASN1_STRING_TABLE, st)\n#define sk_ASN1_STRING_TABLE_pop_free(st, free_func) SKM_sk_pop_free(ASN1_STRING_TABLE, (st), (free_func))\n#define sk_ASN1_STRING_TABLE_shift(st) SKM_sk_shift(ASN1_STRING_TABLE, (st))\n#define sk_ASN1_STRING_TABLE_pop(st) SKM_sk_pop(ASN1_STRING_TABLE, (st))\n#define sk_ASN1_STRING_TABLE_sort(st) SKM_sk_sort(ASN1_STRING_TABLE, (st))\n#define sk_ASN1_STRING_TABLE_is_sorted(st) SKM_sk_is_sorted(ASN1_STRING_TABLE, (st))\n\n#define sk_ASN1_TYPE_new(st) SKM_sk_new(ASN1_TYPE, (st))\n#define sk_ASN1_TYPE_new_null() SKM_sk_new_null(ASN1_TYPE)\n#define sk_ASN1_TYPE_free(st) SKM_sk_free(ASN1_TYPE, (st))\n#define sk_ASN1_TYPE_num(st) SKM_sk_num(ASN1_TYPE, (st))\n#define sk_ASN1_TYPE_value(st, i) SKM_sk_value(ASN1_TYPE, (st), (i))\n#define sk_ASN1_TYPE_set(st, i, val) SKM_sk_set(ASN1_TYPE, (st), (i), (val))\n#define sk_ASN1_TYPE_zero(st) SKM_sk_zero(ASN1_TYPE, (st))\n#define sk_ASN1_TYPE_push(st, val) SKM_sk_push(ASN1_TYPE, (st), (val))\n#define sk_ASN1_TYPE_unshift(st, val) SKM_sk_unshift(ASN1_TYPE, (st), (val))\n#define sk_ASN1_TYPE_find(st, val) SKM_sk_find(ASN1_TYPE, (st), (val))\n#define sk_ASN1_TYPE_find_ex(st, val) SKM_sk_find_ex(ASN1_TYPE, (st), (val))\n#define sk_ASN1_TYPE_delete(st, i) SKM_sk_delete(ASN1_TYPE, (st), (i))\n#define sk_ASN1_TYPE_delete_ptr(st, ptr) SKM_sk_delete_ptr(ASN1_TYPE, (st), (ptr))\n#define sk_ASN1_TYPE_insert(st, val, i) SKM_sk_insert(ASN1_TYPE, (st), (val), (i))\n#define sk_ASN1_TYPE_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(ASN1_TYPE, (st), (cmp))\n#define sk_ASN1_TYPE_dup(st) SKM_sk_dup(ASN1_TYPE, st)\n#define sk_ASN1_TYPE_pop_free(st, free_func) SKM_sk_pop_free(ASN1_TYPE, (st), (free_func))\n#define sk_ASN1_TYPE_shift(st) SKM_sk_shift(ASN1_TYPE, (st))\n#define sk_ASN1_TYPE_pop(st) SKM_sk_pop(ASN1_TYPE, (st))\n#define sk_ASN1_TYPE_sort(st) SKM_sk_sort(ASN1_TYPE, (st))\n#define sk_ASN1_TYPE_is_sorted(st) SKM_sk_is_sorted(ASN1_TYPE, (st))\n\n#define sk_ASN1_VALUE_new(st) SKM_sk_new(ASN1_VALUE, (st))\n#define sk_ASN1_VALUE_new_null() SKM_sk_new_null(ASN1_VALUE)\n#define sk_ASN1_VALUE_free(st) SKM_sk_free(ASN1_VALUE, (st))\n#define sk_ASN1_VALUE_num(st) SKM_sk_num(ASN1_VALUE, (st))\n#define sk_ASN1_VALUE_value(st, i) SKM_sk_value(ASN1_VALUE, (st), (i))\n#define sk_ASN1_VALUE_set(st, i, val) SKM_sk_set(ASN1_VALUE, (st), (i), (val))\n#define sk_ASN1_VALUE_zero(st) SKM_sk_zero(ASN1_VALUE, (st))\n#define sk_ASN1_VALUE_push(st, val) SKM_sk_push(ASN1_VALUE, (st), (val))\n#define sk_ASN1_VALUE_unshift(st, val) SKM_sk_unshift(ASN1_VALUE, (st), (val))\n#define sk_ASN1_VALUE_find(st, val) SKM_sk_find(ASN1_VALUE, (st), (val))\n#define sk_ASN1_VALUE_find_ex(st, val) SKM_sk_find_ex(ASN1_VALUE, (st), (val))\n#define sk_ASN1_VALUE_delete(st, i) SKM_sk_delete(ASN1_VALUE, (st), (i))\n#define sk_ASN1_VALUE_delete_ptr(st, ptr) SKM_sk_delete_ptr(ASN1_VALUE, (st), (ptr))\n#define sk_ASN1_VALUE_insert(st, val, i) SKM_sk_insert(ASN1_VALUE, (st), (val), (i))\n#define sk_ASN1_VALUE_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(ASN1_VALUE, (st), (cmp))\n#define sk_ASN1_VALUE_dup(st) SKM_sk_dup(ASN1_VALUE, st)\n#define sk_ASN1_VALUE_pop_free(st, free_func) SKM_sk_pop_free(ASN1_VALUE, (st), (free_func))\n#define sk_ASN1_VALUE_shift(st) SKM_sk_shift(ASN1_VALUE, (st))\n#define sk_ASN1_VALUE_pop(st) SKM_sk_pop(ASN1_VALUE, (st))\n#define sk_ASN1_VALUE_sort(st) SKM_sk_sort(ASN1_VALUE, (st))\n#define sk_ASN1_VALUE_is_sorted(st) SKM_sk_is_sorted(ASN1_VALUE, (st))\n\n#define sk_BIO_new(st) SKM_sk_new(BIO, (st))\n#define sk_BIO_new_null() SKM_sk_new_null(BIO)\n#define sk_BIO_free(st) SKM_sk_free(BIO, (st))\n#define sk_BIO_num(st) SKM_sk_num(BIO, (st))\n#define sk_BIO_value(st, i) SKM_sk_value(BIO, (st), (i))\n#define sk_BIO_set(st, i, val) SKM_sk_set(BIO, (st), (i), (val))\n#define sk_BIO_zero(st) SKM_sk_zero(BIO, (st))\n#define sk_BIO_push(st, val) SKM_sk_push(BIO, (st), (val))\n#define sk_BIO_unshift(st, val) SKM_sk_unshift(BIO, (st), (val))\n#define sk_BIO_find(st, val) SKM_sk_find(BIO, (st), (val))\n#define sk_BIO_find_ex(st, val) SKM_sk_find_ex(BIO, (st), (val))\n#define sk_BIO_delete(st, i) SKM_sk_delete(BIO, (st), (i))\n#define sk_BIO_delete_ptr(st, ptr) SKM_sk_delete_ptr(BIO, (st), (ptr))\n#define sk_BIO_insert(st, val, i) SKM_sk_insert(BIO, (st), (val), (i))\n#define sk_BIO_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(BIO, (st), (cmp))\n#define sk_BIO_dup(st) SKM_sk_dup(BIO, st)\n#define sk_BIO_pop_free(st, free_func) SKM_sk_pop_free(BIO, (st), (free_func))\n#define sk_BIO_shift(st) SKM_sk_shift(BIO, (st))\n#define sk_BIO_pop(st) SKM_sk_pop(BIO, (st))\n#define sk_BIO_sort(st) SKM_sk_sort(BIO, (st))\n#define sk_BIO_is_sorted(st) SKM_sk_is_sorted(BIO, (st))\n\n#define sk_CMS_CertificateChoices_new(st) SKM_sk_new(CMS_CertificateChoices, (st))\n#define sk_CMS_CertificateChoices_new_null() SKM_sk_new_null(CMS_CertificateChoices)\n#define sk_CMS_CertificateChoices_free(st) SKM_sk_free(CMS_CertificateChoices, (st))\n#define sk_CMS_CertificateChoices_num(st) SKM_sk_num(CMS_CertificateChoices, (st))\n#define sk_CMS_CertificateChoices_value(st, i) SKM_sk_value(CMS_CertificateChoices, (st), (i))\n#define sk_CMS_CertificateChoices_set(st, i, val) SKM_sk_set(CMS_CertificateChoices, (st), (i), (val))\n#define sk_CMS_CertificateChoices_zero(st) SKM_sk_zero(CMS_CertificateChoices, (st))\n#define sk_CMS_CertificateChoices_push(st, val) SKM_sk_push(CMS_CertificateChoices, (st), (val))\n#define sk_CMS_CertificateChoices_unshift(st, val) SKM_sk_unshift(CMS_CertificateChoices, (st), (val))\n#define sk_CMS_CertificateChoices_find(st, val) SKM_sk_find(CMS_CertificateChoices, (st), (val))\n#define sk_CMS_CertificateChoices_find_ex(st, val) SKM_sk_find_ex(CMS_CertificateChoices, (st), (val))\n#define sk_CMS_CertificateChoices_delete(st, i) SKM_sk_delete(CMS_CertificateChoices, (st), (i))\n#define sk_CMS_CertificateChoices_delete_ptr(st, ptr) SKM_sk_delete_ptr(CMS_CertificateChoices, (st), (ptr))\n#define sk_CMS_CertificateChoices_insert(st, val, i) SKM_sk_insert(CMS_CertificateChoices, (st), (val), (i))\n#define sk_CMS_CertificateChoices_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(CMS_CertificateChoices, (st), (cmp))\n#define sk_CMS_CertificateChoices_dup(st) SKM_sk_dup(CMS_CertificateChoices, st)\n#define sk_CMS_CertificateChoices_pop_free(st, free_func) SKM_sk_pop_free(CMS_CertificateChoices, (st), (free_func))\n#define sk_CMS_CertificateChoices_shift(st) SKM_sk_shift(CMS_CertificateChoices, (st))\n#define sk_CMS_CertificateChoices_pop(st) SKM_sk_pop(CMS_CertificateChoices, (st))\n#define sk_CMS_CertificateChoices_sort(st) SKM_sk_sort(CMS_CertificateChoices, (st))\n#define sk_CMS_CertificateChoices_is_sorted(st) SKM_sk_is_sorted(CMS_CertificateChoices, (st))\n\n#define sk_CMS_RecipientInfo_new(st) SKM_sk_new(CMS_RecipientInfo, (st))\n#define sk_CMS_RecipientInfo_new_null() SKM_sk_new_null(CMS_RecipientInfo)\n#define sk_CMS_RecipientInfo_free(st) SKM_sk_free(CMS_RecipientInfo, (st))\n#define sk_CMS_RecipientInfo_num(st) SKM_sk_num(CMS_RecipientInfo, (st))\n#define sk_CMS_RecipientInfo_value(st, i) SKM_sk_value(CMS_RecipientInfo, (st), (i))\n#define sk_CMS_RecipientInfo_set(st, i, val) SKM_sk_set(CMS_RecipientInfo, (st), (i), (val))\n#define sk_CMS_RecipientInfo_zero(st) SKM_sk_zero(CMS_RecipientInfo, (st))\n#define sk_CMS_RecipientInfo_push(st, val) SKM_sk_push(CMS_RecipientInfo, (st), (val))\n#define sk_CMS_RecipientInfo_unshift(st, val) SKM_sk_unshift(CMS_RecipientInfo, (st), (val))\n#define sk_CMS_RecipientInfo_find(st, val) SKM_sk_find(CMS_RecipientInfo, (st), (val))\n#define sk_CMS_RecipientInfo_find_ex(st, val) SKM_sk_find_ex(CMS_RecipientInfo, (st), (val))\n#define sk_CMS_RecipientInfo_delete(st, i) SKM_sk_delete(CMS_RecipientInfo, (st), (i))\n#define sk_CMS_RecipientInfo_delete_ptr(st, ptr) SKM_sk_delete_ptr(CMS_RecipientInfo, (st), (ptr))\n#define sk_CMS_RecipientInfo_insert(st, val, i) SKM_sk_insert(CMS_RecipientInfo, (st), (val), (i))\n#define sk_CMS_RecipientInfo_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(CMS_RecipientInfo, (st), (cmp))\n#define sk_CMS_RecipientInfo_dup(st) SKM_sk_dup(CMS_RecipientInfo, st)\n#define sk_CMS_RecipientInfo_pop_free(st, free_func) SKM_sk_pop_free(CMS_RecipientInfo, (st), (free_func))\n#define sk_CMS_RecipientInfo_shift(st) SKM_sk_shift(CMS_RecipientInfo, (st))\n#define sk_CMS_RecipientInfo_pop(st) SKM_sk_pop(CMS_RecipientInfo, (st))\n#define sk_CMS_RecipientInfo_sort(st) SKM_sk_sort(CMS_RecipientInfo, (st))\n#define sk_CMS_RecipientInfo_is_sorted(st) SKM_sk_is_sorted(CMS_RecipientInfo, (st))\n\n#define sk_CMS_RevocationInfoChoice_new(st) SKM_sk_new(CMS_RevocationInfoChoice, (st))\n#define sk_CMS_RevocationInfoChoice_new_null() SKM_sk_new_null(CMS_RevocationInfoChoice)\n#define sk_CMS_RevocationInfoChoice_free(st) SKM_sk_free(CMS_RevocationInfoChoice, (st))\n#define sk_CMS_RevocationInfoChoice_num(st) SKM_sk_num(CMS_RevocationInfoChoice, (st))\n#define sk_CMS_RevocationInfoChoice_value(st, i) SKM_sk_value(CMS_RevocationInfoChoice, (st), (i))\n#define sk_CMS_RevocationInfoChoice_set(st, i, val) SKM_sk_set(CMS_RevocationInfoChoice, (st), (i), (val))\n#define sk_CMS_RevocationInfoChoice_zero(st) SKM_sk_zero(CMS_RevocationInfoChoice, (st))\n#define sk_CMS_RevocationInfoChoice_push(st, val) SKM_sk_push(CMS_RevocationInfoChoice, (st), (val))\n#define sk_CMS_RevocationInfoChoice_unshift(st, val) SKM_sk_unshift(CMS_RevocationInfoChoice, (st), (val))\n#define sk_CMS_RevocationInfoChoice_find(st, val) SKM_sk_find(CMS_RevocationInfoChoice, (st), (val))\n#define sk_CMS_RevocationInfoChoice_find_ex(st, val) SKM_sk_find_ex(CMS_RevocationInfoChoice, (st), (val))\n#define sk_CMS_RevocationInfoChoice_delete(st, i) SKM_sk_delete(CMS_RevocationInfoChoice, (st), (i))\n#define sk_CMS_RevocationInfoChoice_delete_ptr(st, ptr) SKM_sk_delete_ptr(CMS_RevocationInfoChoice, (st), (ptr))\n#define sk_CMS_RevocationInfoChoice_insert(st, val, i) SKM_sk_insert(CMS_RevocationInfoChoice, (st), (val), (i))\n#define sk_CMS_RevocationInfoChoice_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(CMS_RevocationInfoChoice, (st), (cmp))\n#define sk_CMS_RevocationInfoChoice_dup(st) SKM_sk_dup(CMS_RevocationInfoChoice, st)\n#define sk_CMS_RevocationInfoChoice_pop_free(st, free_func) SKM_sk_pop_free(CMS_RevocationInfoChoice, (st), (free_func))\n#define sk_CMS_RevocationInfoChoice_shift(st) SKM_sk_shift(CMS_RevocationInfoChoice, (st))\n#define sk_CMS_RevocationInfoChoice_pop(st) SKM_sk_pop(CMS_RevocationInfoChoice, (st))\n#define sk_CMS_RevocationInfoChoice_sort(st) SKM_sk_sort(CMS_RevocationInfoChoice, (st))\n#define sk_CMS_RevocationInfoChoice_is_sorted(st) SKM_sk_is_sorted(CMS_RevocationInfoChoice, (st))\n\n#define sk_CMS_SignerInfo_new(st) SKM_sk_new(CMS_SignerInfo, (st))\n#define sk_CMS_SignerInfo_new_null() SKM_sk_new_null(CMS_SignerInfo)\n#define sk_CMS_SignerInfo_free(st) SKM_sk_free(CMS_SignerInfo, (st))\n#define sk_CMS_SignerInfo_num(st) SKM_sk_num(CMS_SignerInfo, (st))\n#define sk_CMS_SignerInfo_value(st, i) SKM_sk_value(CMS_SignerInfo, (st), (i))\n#define sk_CMS_SignerInfo_set(st, i, val) SKM_sk_set(CMS_SignerInfo, (st), (i), (val))\n#define sk_CMS_SignerInfo_zero(st) SKM_sk_zero(CMS_SignerInfo, (st))\n#define sk_CMS_SignerInfo_push(st, val) SKM_sk_push(CMS_SignerInfo, (st), (val))\n#define sk_CMS_SignerInfo_unshift(st, val) SKM_sk_unshift(CMS_SignerInfo, (st), (val))\n#define sk_CMS_SignerInfo_find(st, val) SKM_sk_find(CMS_SignerInfo, (st), (val))\n#define sk_CMS_SignerInfo_find_ex(st, val) SKM_sk_find_ex(CMS_SignerInfo, (st), (val))\n#define sk_CMS_SignerInfo_delete(st, i) SKM_sk_delete(CMS_SignerInfo, (st), (i))\n#define sk_CMS_SignerInfo_delete_ptr(st, ptr) SKM_sk_delete_ptr(CMS_SignerInfo, (st), (ptr))\n#define sk_CMS_SignerInfo_insert(st, val, i) SKM_sk_insert(CMS_SignerInfo, (st), (val), (i))\n#define sk_CMS_SignerInfo_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(CMS_SignerInfo, (st), (cmp))\n#define sk_CMS_SignerInfo_dup(st) SKM_sk_dup(CMS_SignerInfo, st)\n#define sk_CMS_SignerInfo_pop_free(st, free_func) SKM_sk_pop_free(CMS_SignerInfo, (st), (free_func))\n#define sk_CMS_SignerInfo_shift(st) SKM_sk_shift(CMS_SignerInfo, (st))\n#define sk_CMS_SignerInfo_pop(st) SKM_sk_pop(CMS_SignerInfo, (st))\n#define sk_CMS_SignerInfo_sort(st) SKM_sk_sort(CMS_SignerInfo, (st))\n#define sk_CMS_SignerInfo_is_sorted(st) SKM_sk_is_sorted(CMS_SignerInfo, (st))\n\n#define sk_CONF_IMODULE_new(st) SKM_sk_new(CONF_IMODULE, (st))\n#define sk_CONF_IMODULE_new_null() SKM_sk_new_null(CONF_IMODULE)\n#define sk_CONF_IMODULE_free(st) SKM_sk_free(CONF_IMODULE, (st))\n#define sk_CONF_IMODULE_num(st) SKM_sk_num(CONF_IMODULE, (st))\n#define sk_CONF_IMODULE_value(st, i) SKM_sk_value(CONF_IMODULE, (st), (i))\n#define sk_CONF_IMODULE_set(st, i, val) SKM_sk_set(CONF_IMODULE, (st), (i), (val))\n#define sk_CONF_IMODULE_zero(st) SKM_sk_zero(CONF_IMODULE, (st))\n#define sk_CONF_IMODULE_push(st, val) SKM_sk_push(CONF_IMODULE, (st), (val))\n#define sk_CONF_IMODULE_unshift(st, val) SKM_sk_unshift(CONF_IMODULE, (st), (val))\n#define sk_CONF_IMODULE_find(st, val) SKM_sk_find(CONF_IMODULE, (st), (val))\n#define sk_CONF_IMODULE_find_ex(st, val) SKM_sk_find_ex(CONF_IMODULE, (st), (val))\n#define sk_CONF_IMODULE_delete(st, i) SKM_sk_delete(CONF_IMODULE, (st), (i))\n#define sk_CONF_IMODULE_delete_ptr(st, ptr) SKM_sk_delete_ptr(CONF_IMODULE, (st), (ptr))\n#define sk_CONF_IMODULE_insert(st, val, i) SKM_sk_insert(CONF_IMODULE, (st), (val), (i))\n#define sk_CONF_IMODULE_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(CONF_IMODULE, (st), (cmp))\n#define sk_CONF_IMODULE_dup(st) SKM_sk_dup(CONF_IMODULE, st)\n#define sk_CONF_IMODULE_pop_free(st, free_func) SKM_sk_pop_free(CONF_IMODULE, (st), (free_func))\n#define sk_CONF_IMODULE_shift(st) SKM_sk_shift(CONF_IMODULE, (st))\n#define sk_CONF_IMODULE_pop(st) SKM_sk_pop(CONF_IMODULE, (st))\n#define sk_CONF_IMODULE_sort(st) SKM_sk_sort(CONF_IMODULE, (st))\n#define sk_CONF_IMODULE_is_sorted(st) SKM_sk_is_sorted(CONF_IMODULE, (st))\n\n#define sk_CONF_MODULE_new(st) SKM_sk_new(CONF_MODULE, (st))\n#define sk_CONF_MODULE_new_null() SKM_sk_new_null(CONF_MODULE)\n#define sk_CONF_MODULE_free(st) SKM_sk_free(CONF_MODULE, (st))\n#define sk_CONF_MODULE_num(st) SKM_sk_num(CONF_MODULE, (st))\n#define sk_CONF_MODULE_value(st, i) SKM_sk_value(CONF_MODULE, (st), (i))\n#define sk_CONF_MODULE_set(st, i, val) SKM_sk_set(CONF_MODULE, (st), (i), (val))\n#define sk_CONF_MODULE_zero(st) SKM_sk_zero(CONF_MODULE, (st))\n#define sk_CONF_MODULE_push(st, val) SKM_sk_push(CONF_MODULE, (st), (val))\n#define sk_CONF_MODULE_unshift(st, val) SKM_sk_unshift(CONF_MODULE, (st), (val))\n#define sk_CONF_MODULE_find(st, val) SKM_sk_find(CONF_MODULE, (st), (val))\n#define sk_CONF_MODULE_find_ex(st, val) SKM_sk_find_ex(CONF_MODULE, (st), (val))\n#define sk_CONF_MODULE_delete(st, i) SKM_sk_delete(CONF_MODULE, (st), (i))\n#define sk_CONF_MODULE_delete_ptr(st, ptr) SKM_sk_delete_ptr(CONF_MODULE, (st), (ptr))\n#define sk_CONF_MODULE_insert(st, val, i) SKM_sk_insert(CONF_MODULE, (st), (val), (i))\n#define sk_CONF_MODULE_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(CONF_MODULE, (st), (cmp))\n#define sk_CONF_MODULE_dup(st) SKM_sk_dup(CONF_MODULE, st)\n#define sk_CONF_MODULE_pop_free(st, free_func) SKM_sk_pop_free(CONF_MODULE, (st), (free_func))\n#define sk_CONF_MODULE_shift(st) SKM_sk_shift(CONF_MODULE, (st))\n#define sk_CONF_MODULE_pop(st) SKM_sk_pop(CONF_MODULE, (st))\n#define sk_CONF_MODULE_sort(st) SKM_sk_sort(CONF_MODULE, (st))\n#define sk_CONF_MODULE_is_sorted(st) SKM_sk_is_sorted(CONF_MODULE, (st))\n\n#define sk_CONF_VALUE_new(st) SKM_sk_new(CONF_VALUE, (st))\n#define sk_CONF_VALUE_new_null() SKM_sk_new_null(CONF_VALUE)\n#define sk_CONF_VALUE_free(st) SKM_sk_free(CONF_VALUE, (st))\n#define sk_CONF_VALUE_num(st) SKM_sk_num(CONF_VALUE, (st))\n#define sk_CONF_VALUE_value(st, i) SKM_sk_value(CONF_VALUE, (st), (i))\n#define sk_CONF_VALUE_set(st, i, val) SKM_sk_set(CONF_VALUE, (st), (i), (val))\n#define sk_CONF_VALUE_zero(st) SKM_sk_zero(CONF_VALUE, (st))\n#define sk_CONF_VALUE_push(st, val) SKM_sk_push(CONF_VALUE, (st), (val))\n#define sk_CONF_VALUE_unshift(st, val) SKM_sk_unshift(CONF_VALUE, (st), (val))\n#define sk_CONF_VALUE_find(st, val) SKM_sk_find(CONF_VALUE, (st), (val))\n#define sk_CONF_VALUE_find_ex(st, val) SKM_sk_find_ex(CONF_VALUE, (st), (val))\n#define sk_CONF_VALUE_delete(st, i) SKM_sk_delete(CONF_VALUE, (st), (i))\n#define sk_CONF_VALUE_delete_ptr(st, ptr) SKM_sk_delete_ptr(CONF_VALUE, (st), (ptr))\n#define sk_CONF_VALUE_insert(st, val, i) SKM_sk_insert(CONF_VALUE, (st), (val), (i))\n#define sk_CONF_VALUE_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(CONF_VALUE, (st), (cmp))\n#define sk_CONF_VALUE_dup(st) SKM_sk_dup(CONF_VALUE, st)\n#define sk_CONF_VALUE_pop_free(st, free_func) SKM_sk_pop_free(CONF_VALUE, (st), (free_func))\n#define sk_CONF_VALUE_shift(st) SKM_sk_shift(CONF_VALUE, (st))\n#define sk_CONF_VALUE_pop(st) SKM_sk_pop(CONF_VALUE, (st))\n#define sk_CONF_VALUE_sort(st) SKM_sk_sort(CONF_VALUE, (st))\n#define sk_CONF_VALUE_is_sorted(st) SKM_sk_is_sorted(CONF_VALUE, (st))\n\n#define sk_CRYPTO_EX_DATA_FUNCS_new(st) SKM_sk_new(CRYPTO_EX_DATA_FUNCS, (st))\n#define sk_CRYPTO_EX_DATA_FUNCS_new_null() SKM_sk_new_null(CRYPTO_EX_DATA_FUNCS)\n#define sk_CRYPTO_EX_DATA_FUNCS_free(st) SKM_sk_free(CRYPTO_EX_DATA_FUNCS, (st))\n#define sk_CRYPTO_EX_DATA_FUNCS_num(st) SKM_sk_num(CRYPTO_EX_DATA_FUNCS, (st))\n#define sk_CRYPTO_EX_DATA_FUNCS_value(st, i) SKM_sk_value(CRYPTO_EX_DATA_FUNCS, (st), (i))\n#define sk_CRYPTO_EX_DATA_FUNCS_set(st, i, val) SKM_sk_set(CRYPTO_EX_DATA_FUNCS, (st), (i), (val))\n#define sk_CRYPTO_EX_DATA_FUNCS_zero(st) SKM_sk_zero(CRYPTO_EX_DATA_FUNCS, (st))\n#define sk_CRYPTO_EX_DATA_FUNCS_push(st, val) SKM_sk_push(CRYPTO_EX_DATA_FUNCS, (st), (val))\n#define sk_CRYPTO_EX_DATA_FUNCS_unshift(st, val) SKM_sk_unshift(CRYPTO_EX_DATA_FUNCS, (st), (val))\n#define sk_CRYPTO_EX_DATA_FUNCS_find(st, val) SKM_sk_find(CRYPTO_EX_DATA_FUNCS, (st), (val))\n#define sk_CRYPTO_EX_DATA_FUNCS_find_ex(st, val) SKM_sk_find_ex(CRYPTO_EX_DATA_FUNCS, (st), (val))\n#define sk_CRYPTO_EX_DATA_FUNCS_delete(st, i) SKM_sk_delete(CRYPTO_EX_DATA_FUNCS, (st), (i))\n#define sk_CRYPTO_EX_DATA_FUNCS_delete_ptr(st, ptr) SKM_sk_delete_ptr(CRYPTO_EX_DATA_FUNCS, (st), (ptr))\n#define sk_CRYPTO_EX_DATA_FUNCS_insert(st, val, i) SKM_sk_insert(CRYPTO_EX_DATA_FUNCS, (st), (val), (i))\n#define sk_CRYPTO_EX_DATA_FUNCS_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(CRYPTO_EX_DATA_FUNCS, (st), (cmp))\n#define sk_CRYPTO_EX_DATA_FUNCS_dup(st) SKM_sk_dup(CRYPTO_EX_DATA_FUNCS, st)\n#define sk_CRYPTO_EX_DATA_FUNCS_pop_free(st, free_func) SKM_sk_pop_free(CRYPTO_EX_DATA_FUNCS, (st), (free_func))\n#define sk_CRYPTO_EX_DATA_FUNCS_shift(st) SKM_sk_shift(CRYPTO_EX_DATA_FUNCS, (st))\n#define sk_CRYPTO_EX_DATA_FUNCS_pop(st) SKM_sk_pop(CRYPTO_EX_DATA_FUNCS, (st))\n#define sk_CRYPTO_EX_DATA_FUNCS_sort(st) SKM_sk_sort(CRYPTO_EX_DATA_FUNCS, (st))\n#define sk_CRYPTO_EX_DATA_FUNCS_is_sorted(st) SKM_sk_is_sorted(CRYPTO_EX_DATA_FUNCS, (st))\n\n#define sk_CRYPTO_dynlock_new(st) SKM_sk_new(CRYPTO_dynlock, (st))\n#define sk_CRYPTO_dynlock_new_null() SKM_sk_new_null(CRYPTO_dynlock)\n#define sk_CRYPTO_dynlock_free(st) SKM_sk_free(CRYPTO_dynlock, (st))\n#define sk_CRYPTO_dynlock_num(st) SKM_sk_num(CRYPTO_dynlock, (st))\n#define sk_CRYPTO_dynlock_value(st, i) SKM_sk_value(CRYPTO_dynlock, (st), (i))\n#define sk_CRYPTO_dynlock_set(st, i, val) SKM_sk_set(CRYPTO_dynlock, (st), (i), (val))\n#define sk_CRYPTO_dynlock_zero(st) SKM_sk_zero(CRYPTO_dynlock, (st))\n#define sk_CRYPTO_dynlock_push(st, val) SKM_sk_push(CRYPTO_dynlock, (st), (val))\n#define sk_CRYPTO_dynlock_unshift(st, val) SKM_sk_unshift(CRYPTO_dynlock, (st), (val))\n#define sk_CRYPTO_dynlock_find(st, val) SKM_sk_find(CRYPTO_dynlock, (st), (val))\n#define sk_CRYPTO_dynlock_find_ex(st, val) SKM_sk_find_ex(CRYPTO_dynlock, (st), (val))\n#define sk_CRYPTO_dynlock_delete(st, i) SKM_sk_delete(CRYPTO_dynlock, (st), (i))\n#define sk_CRYPTO_dynlock_delete_ptr(st, ptr) SKM_sk_delete_ptr(CRYPTO_dynlock, (st), (ptr))\n#define sk_CRYPTO_dynlock_insert(st, val, i) SKM_sk_insert(CRYPTO_dynlock, (st), (val), (i))\n#define sk_CRYPTO_dynlock_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(CRYPTO_dynlock, (st), (cmp))\n#define sk_CRYPTO_dynlock_dup(st) SKM_sk_dup(CRYPTO_dynlock, st)\n#define sk_CRYPTO_dynlock_pop_free(st, free_func) SKM_sk_pop_free(CRYPTO_dynlock, (st), (free_func))\n#define sk_CRYPTO_dynlock_shift(st) SKM_sk_shift(CRYPTO_dynlock, (st))\n#define sk_CRYPTO_dynlock_pop(st) SKM_sk_pop(CRYPTO_dynlock, (st))\n#define sk_CRYPTO_dynlock_sort(st) SKM_sk_sort(CRYPTO_dynlock, (st))\n#define sk_CRYPTO_dynlock_is_sorted(st) SKM_sk_is_sorted(CRYPTO_dynlock, (st))\n\n#define sk_DIST_POINT_new(st) SKM_sk_new(DIST_POINT, (st))\n#define sk_DIST_POINT_new_null() SKM_sk_new_null(DIST_POINT)\n#define sk_DIST_POINT_free(st) SKM_sk_free(DIST_POINT, (st))\n#define sk_DIST_POINT_num(st) SKM_sk_num(DIST_POINT, (st))\n#define sk_DIST_POINT_value(st, i) SKM_sk_value(DIST_POINT, (st), (i))\n#define sk_DIST_POINT_set(st, i, val) SKM_sk_set(DIST_POINT, (st), (i), (val))\n#define sk_DIST_POINT_zero(st) SKM_sk_zero(DIST_POINT, (st))\n#define sk_DIST_POINT_push(st, val) SKM_sk_push(DIST_POINT, (st), (val))\n#define sk_DIST_POINT_unshift(st, val) SKM_sk_unshift(DIST_POINT, (st), (val))\n#define sk_DIST_POINT_find(st, val) SKM_sk_find(DIST_POINT, (st), (val))\n#define sk_DIST_POINT_find_ex(st, val) SKM_sk_find_ex(DIST_POINT, (st), (val))\n#define sk_DIST_POINT_delete(st, i) SKM_sk_delete(DIST_POINT, (st), (i))\n#define sk_DIST_POINT_delete_ptr(st, ptr) SKM_sk_delete_ptr(DIST_POINT, (st), (ptr))\n#define sk_DIST_POINT_insert(st, val, i) SKM_sk_insert(DIST_POINT, (st), (val), (i))\n#define sk_DIST_POINT_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(DIST_POINT, (st), (cmp))\n#define sk_DIST_POINT_dup(st) SKM_sk_dup(DIST_POINT, st)\n#define sk_DIST_POINT_pop_free(st, free_func) SKM_sk_pop_free(DIST_POINT, (st), (free_func))\n#define sk_DIST_POINT_shift(st) SKM_sk_shift(DIST_POINT, (st))\n#define sk_DIST_POINT_pop(st) SKM_sk_pop(DIST_POINT, (st))\n#define sk_DIST_POINT_sort(st) SKM_sk_sort(DIST_POINT, (st))\n#define sk_DIST_POINT_is_sorted(st) SKM_sk_is_sorted(DIST_POINT, (st))\n\n#define sk_ENGINE_new(st) SKM_sk_new(ENGINE, (st))\n#define sk_ENGINE_new_null() SKM_sk_new_null(ENGINE)\n#define sk_ENGINE_free(st) SKM_sk_free(ENGINE, (st))\n#define sk_ENGINE_num(st) SKM_sk_num(ENGINE, (st))\n#define sk_ENGINE_value(st, i) SKM_sk_value(ENGINE, (st), (i))\n#define sk_ENGINE_set(st, i, val) SKM_sk_set(ENGINE, (st), (i), (val))\n#define sk_ENGINE_zero(st) SKM_sk_zero(ENGINE, (st))\n#define sk_ENGINE_push(st, val) SKM_sk_push(ENGINE, (st), (val))\n#define sk_ENGINE_unshift(st, val) SKM_sk_unshift(ENGINE, (st), (val))\n#define sk_ENGINE_find(st, val) SKM_sk_find(ENGINE, (st), (val))\n#define sk_ENGINE_find_ex(st, val) SKM_sk_find_ex(ENGINE, (st), (val))\n#define sk_ENGINE_delete(st, i) SKM_sk_delete(ENGINE, (st), (i))\n#define sk_ENGINE_delete_ptr(st, ptr) SKM_sk_delete_ptr(ENGINE, (st), (ptr))\n#define sk_ENGINE_insert(st, val, i) SKM_sk_insert(ENGINE, (st), (val), (i))\n#define sk_ENGINE_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(ENGINE, (st), (cmp))\n#define sk_ENGINE_dup(st) SKM_sk_dup(ENGINE, st)\n#define sk_ENGINE_pop_free(st, free_func) SKM_sk_pop_free(ENGINE, (st), (free_func))\n#define sk_ENGINE_shift(st) SKM_sk_shift(ENGINE, (st))\n#define sk_ENGINE_pop(st) SKM_sk_pop(ENGINE, (st))\n#define sk_ENGINE_sort(st) SKM_sk_sort(ENGINE, (st))\n#define sk_ENGINE_is_sorted(st) SKM_sk_is_sorted(ENGINE, (st))\n\n#define sk_ENGINE_CLEANUP_ITEM_new(st) SKM_sk_new(ENGINE_CLEANUP_ITEM, (st))\n#define sk_ENGINE_CLEANUP_ITEM_new_null() SKM_sk_new_null(ENGINE_CLEANUP_ITEM)\n#define sk_ENGINE_CLEANUP_ITEM_free(st) SKM_sk_free(ENGINE_CLEANUP_ITEM, (st))\n#define sk_ENGINE_CLEANUP_ITEM_num(st) SKM_sk_num(ENGINE_CLEANUP_ITEM, (st))\n#define sk_ENGINE_CLEANUP_ITEM_value(st, i) SKM_sk_value(ENGINE_CLEANUP_ITEM, (st), (i))\n#define sk_ENGINE_CLEANUP_ITEM_set(st, i, val) SKM_sk_set(ENGINE_CLEANUP_ITEM, (st), (i), (val))\n#define sk_ENGINE_CLEANUP_ITEM_zero(st) SKM_sk_zero(ENGINE_CLEANUP_ITEM, (st))\n#define sk_ENGINE_CLEANUP_ITEM_push(st, val) SKM_sk_push(ENGINE_CLEANUP_ITEM, (st), (val))\n#define sk_ENGINE_CLEANUP_ITEM_unshift(st, val) SKM_sk_unshift(ENGINE_CLEANUP_ITEM, (st), (val))\n#define sk_ENGINE_CLEANUP_ITEM_find(st, val) SKM_sk_find(ENGINE_CLEANUP_ITEM, (st), (val))\n#define sk_ENGINE_CLEANUP_ITEM_find_ex(st, val) SKM_sk_find_ex(ENGINE_CLEANUP_ITEM, (st), (val))\n#define sk_ENGINE_CLEANUP_ITEM_delete(st, i) SKM_sk_delete(ENGINE_CLEANUP_ITEM, (st), (i))\n#define sk_ENGINE_CLEANUP_ITEM_delete_ptr(st, ptr) SKM_sk_delete_ptr(ENGINE_CLEANUP_ITEM, (st), (ptr))\n#define sk_ENGINE_CLEANUP_ITEM_insert(st, val, i) SKM_sk_insert(ENGINE_CLEANUP_ITEM, (st), (val), (i))\n#define sk_ENGINE_CLEANUP_ITEM_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(ENGINE_CLEANUP_ITEM, (st), (cmp))\n#define sk_ENGINE_CLEANUP_ITEM_dup(st) SKM_sk_dup(ENGINE_CLEANUP_ITEM, st)\n#define sk_ENGINE_CLEANUP_ITEM_pop_free(st, free_func) SKM_sk_pop_free(ENGINE_CLEANUP_ITEM, (st), (free_func))\n#define sk_ENGINE_CLEANUP_ITEM_shift(st) SKM_sk_shift(ENGINE_CLEANUP_ITEM, (st))\n#define sk_ENGINE_CLEANUP_ITEM_pop(st) SKM_sk_pop(ENGINE_CLEANUP_ITEM, (st))\n#define sk_ENGINE_CLEANUP_ITEM_sort(st) SKM_sk_sort(ENGINE_CLEANUP_ITEM, (st))\n#define sk_ENGINE_CLEANUP_ITEM_is_sorted(st) SKM_sk_is_sorted(ENGINE_CLEANUP_ITEM, (st))\n\n#define sk_GENERAL_NAME_new(st) SKM_sk_new(GENERAL_NAME, (st))\n#define sk_GENERAL_NAME_new_null() SKM_sk_new_null(GENERAL_NAME)\n#define sk_GENERAL_NAME_free(st) SKM_sk_free(GENERAL_NAME, (st))\n#define sk_GENERAL_NAME_num(st) SKM_sk_num(GENERAL_NAME, (st))\n#define sk_GENERAL_NAME_value(st, i) SKM_sk_value(GENERAL_NAME, (st), (i))\n#define sk_GENERAL_NAME_set(st, i, val) SKM_sk_set(GENERAL_NAME, (st), (i), (val))\n#define sk_GENERAL_NAME_zero(st) SKM_sk_zero(GENERAL_NAME, (st))\n#define sk_GENERAL_NAME_push(st, val) SKM_sk_push(GENERAL_NAME, (st), (val))\n#define sk_GENERAL_NAME_unshift(st, val) SKM_sk_unshift(GENERAL_NAME, (st), (val))\n#define sk_GENERAL_NAME_find(st, val) SKM_sk_find(GENERAL_NAME, (st), (val))\n#define sk_GENERAL_NAME_find_ex(st, val) SKM_sk_find_ex(GENERAL_NAME, (st), (val))\n#define sk_GENERAL_NAME_delete(st, i) SKM_sk_delete(GENERAL_NAME, (st), (i))\n#define sk_GENERAL_NAME_delete_ptr(st, ptr) SKM_sk_delete_ptr(GENERAL_NAME, (st), (ptr))\n#define sk_GENERAL_NAME_insert(st, val, i) SKM_sk_insert(GENERAL_NAME, (st), (val), (i))\n#define sk_GENERAL_NAME_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(GENERAL_NAME, (st), (cmp))\n#define sk_GENERAL_NAME_dup(st) SKM_sk_dup(GENERAL_NAME, st)\n#define sk_GENERAL_NAME_pop_free(st, free_func) SKM_sk_pop_free(GENERAL_NAME, (st), (free_func))\n#define sk_GENERAL_NAME_shift(st) SKM_sk_shift(GENERAL_NAME, (st))\n#define sk_GENERAL_NAME_pop(st) SKM_sk_pop(GENERAL_NAME, (st))\n#define sk_GENERAL_NAME_sort(st) SKM_sk_sort(GENERAL_NAME, (st))\n#define sk_GENERAL_NAME_is_sorted(st) SKM_sk_is_sorted(GENERAL_NAME, (st))\n\n#define sk_GENERAL_NAMES_new(st) SKM_sk_new(GENERAL_NAMES, (st))\n#define sk_GENERAL_NAMES_new_null() SKM_sk_new_null(GENERAL_NAMES)\n#define sk_GENERAL_NAMES_free(st) SKM_sk_free(GENERAL_NAMES, (st))\n#define sk_GENERAL_NAMES_num(st) SKM_sk_num(GENERAL_NAMES, (st))\n#define sk_GENERAL_NAMES_value(st, i) SKM_sk_value(GENERAL_NAMES, (st), (i))\n#define sk_GENERAL_NAMES_set(st, i, val) SKM_sk_set(GENERAL_NAMES, (st), (i), (val))\n#define sk_GENERAL_NAMES_zero(st) SKM_sk_zero(GENERAL_NAMES, (st))\n#define sk_GENERAL_NAMES_push(st, val) SKM_sk_push(GENERAL_NAMES, (st), (val))\n#define sk_GENERAL_NAMES_unshift(st, val) SKM_sk_unshift(GENERAL_NAMES, (st), (val))\n#define sk_GENERAL_NAMES_find(st, val) SKM_sk_find(GENERAL_NAMES, (st), (val))\n#define sk_GENERAL_NAMES_find_ex(st, val) SKM_sk_find_ex(GENERAL_NAMES, (st), (val))\n#define sk_GENERAL_NAMES_delete(st, i) SKM_sk_delete(GENERAL_NAMES, (st), (i))\n#define sk_GENERAL_NAMES_delete_ptr(st, ptr) SKM_sk_delete_ptr(GENERAL_NAMES, (st), (ptr))\n#define sk_GENERAL_NAMES_insert(st, val, i) SKM_sk_insert(GENERAL_NAMES, (st), (val), (i))\n#define sk_GENERAL_NAMES_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(GENERAL_NAMES, (st), (cmp))\n#define sk_GENERAL_NAMES_dup(st) SKM_sk_dup(GENERAL_NAMES, st)\n#define sk_GENERAL_NAMES_pop_free(st, free_func) SKM_sk_pop_free(GENERAL_NAMES, (st), (free_func))\n#define sk_GENERAL_NAMES_shift(st) SKM_sk_shift(GENERAL_NAMES, (st))\n#define sk_GENERAL_NAMES_pop(st) SKM_sk_pop(GENERAL_NAMES, (st))\n#define sk_GENERAL_NAMES_sort(st) SKM_sk_sort(GENERAL_NAMES, (st))\n#define sk_GENERAL_NAMES_is_sorted(st) SKM_sk_is_sorted(GENERAL_NAMES, (st))\n\n#define sk_GENERAL_SUBTREE_new(st) SKM_sk_new(GENERAL_SUBTREE, (st))\n#define sk_GENERAL_SUBTREE_new_null() SKM_sk_new_null(GENERAL_SUBTREE)\n#define sk_GENERAL_SUBTREE_free(st) SKM_sk_free(GENERAL_SUBTREE, (st))\n#define sk_GENERAL_SUBTREE_num(st) SKM_sk_num(GENERAL_SUBTREE, (st))\n#define sk_GENERAL_SUBTREE_value(st, i) SKM_sk_value(GENERAL_SUBTREE, (st), (i))\n#define sk_GENERAL_SUBTREE_set(st, i, val) SKM_sk_set(GENERAL_SUBTREE, (st), (i), (val))\n#define sk_GENERAL_SUBTREE_zero(st) SKM_sk_zero(GENERAL_SUBTREE, (st))\n#define sk_GENERAL_SUBTREE_push(st, val) SKM_sk_push(GENERAL_SUBTREE, (st), (val))\n#define sk_GENERAL_SUBTREE_unshift(st, val) SKM_sk_unshift(GENERAL_SUBTREE, (st), (val))\n#define sk_GENERAL_SUBTREE_find(st, val) SKM_sk_find(GENERAL_SUBTREE, (st), (val))\n#define sk_GENERAL_SUBTREE_find_ex(st, val) SKM_sk_find_ex(GENERAL_SUBTREE, (st), (val))\n#define sk_GENERAL_SUBTREE_delete(st, i) SKM_sk_delete(GENERAL_SUBTREE, (st), (i))\n#define sk_GENERAL_SUBTREE_delete_ptr(st, ptr) SKM_sk_delete_ptr(GENERAL_SUBTREE, (st), (ptr))\n#define sk_GENERAL_SUBTREE_insert(st, val, i) SKM_sk_insert(GENERAL_SUBTREE, (st), (val), (i))\n#define sk_GENERAL_SUBTREE_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(GENERAL_SUBTREE, (st), (cmp))\n#define sk_GENERAL_SUBTREE_dup(st) SKM_sk_dup(GENERAL_SUBTREE, st)\n#define sk_GENERAL_SUBTREE_pop_free(st, free_func) SKM_sk_pop_free(GENERAL_SUBTREE, (st), (free_func))\n#define sk_GENERAL_SUBTREE_shift(st) SKM_sk_shift(GENERAL_SUBTREE, (st))\n#define sk_GENERAL_SUBTREE_pop(st) SKM_sk_pop(GENERAL_SUBTREE, (st))\n#define sk_GENERAL_SUBTREE_sort(st) SKM_sk_sort(GENERAL_SUBTREE, (st))\n#define sk_GENERAL_SUBTREE_is_sorted(st) SKM_sk_is_sorted(GENERAL_SUBTREE, (st))\n\n#define sk_IPAddressFamily_new(st) SKM_sk_new(IPAddressFamily, (st))\n#define sk_IPAddressFamily_new_null() SKM_sk_new_null(IPAddressFamily)\n#define sk_IPAddressFamily_free(st) SKM_sk_free(IPAddressFamily, (st))\n#define sk_IPAddressFamily_num(st) SKM_sk_num(IPAddressFamily, (st))\n#define sk_IPAddressFamily_value(st, i) SKM_sk_value(IPAddressFamily, (st), (i))\n#define sk_IPAddressFamily_set(st, i, val) SKM_sk_set(IPAddressFamily, (st), (i), (val))\n#define sk_IPAddressFamily_zero(st) SKM_sk_zero(IPAddressFamily, (st))\n#define sk_IPAddressFamily_push(st, val) SKM_sk_push(IPAddressFamily, (st), (val))\n#define sk_IPAddressFamily_unshift(st, val) SKM_sk_unshift(IPAddressFamily, (st), (val))\n#define sk_IPAddressFamily_find(st, val) SKM_sk_find(IPAddressFamily, (st), (val))\n#define sk_IPAddressFamily_find_ex(st, val) SKM_sk_find_ex(IPAddressFamily, (st), (val))\n#define sk_IPAddressFamily_delete(st, i) SKM_sk_delete(IPAddressFamily, (st), (i))\n#define sk_IPAddressFamily_delete_ptr(st, ptr) SKM_sk_delete_ptr(IPAddressFamily, (st), (ptr))\n#define sk_IPAddressFamily_insert(st, val, i) SKM_sk_insert(IPAddressFamily, (st), (val), (i))\n#define sk_IPAddressFamily_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(IPAddressFamily, (st), (cmp))\n#define sk_IPAddressFamily_dup(st) SKM_sk_dup(IPAddressFamily, st)\n#define sk_IPAddressFamily_pop_free(st, free_func) SKM_sk_pop_free(IPAddressFamily, (st), (free_func))\n#define sk_IPAddressFamily_shift(st) SKM_sk_shift(IPAddressFamily, (st))\n#define sk_IPAddressFamily_pop(st) SKM_sk_pop(IPAddressFamily, (st))\n#define sk_IPAddressFamily_sort(st) SKM_sk_sort(IPAddressFamily, (st))\n#define sk_IPAddressFamily_is_sorted(st) SKM_sk_is_sorted(IPAddressFamily, (st))\n\n#define sk_IPAddressOrRange_new(st) SKM_sk_new(IPAddressOrRange, (st))\n#define sk_IPAddressOrRange_new_null() SKM_sk_new_null(IPAddressOrRange)\n#define sk_IPAddressOrRange_free(st) SKM_sk_free(IPAddressOrRange, (st))\n#define sk_IPAddressOrRange_num(st) SKM_sk_num(IPAddressOrRange, (st))\n#define sk_IPAddressOrRange_value(st, i) SKM_sk_value(IPAddressOrRange, (st), (i))\n#define sk_IPAddressOrRange_set(st, i, val) SKM_sk_set(IPAddressOrRange, (st), (i), (val))\n#define sk_IPAddressOrRange_zero(st) SKM_sk_zero(IPAddressOrRange, (st))\n#define sk_IPAddressOrRange_push(st, val) SKM_sk_push(IPAddressOrRange, (st), (val))\n#define sk_IPAddressOrRange_unshift(st, val) SKM_sk_unshift(IPAddressOrRange, (st), (val))\n#define sk_IPAddressOrRange_find(st, val) SKM_sk_find(IPAddressOrRange, (st), (val))\n#define sk_IPAddressOrRange_find_ex(st, val) SKM_sk_find_ex(IPAddressOrRange, (st), (val))\n#define sk_IPAddressOrRange_delete(st, i) SKM_sk_delete(IPAddressOrRange, (st), (i))\n#define sk_IPAddressOrRange_delete_ptr(st, ptr) SKM_sk_delete_ptr(IPAddressOrRange, (st), (ptr))\n#define sk_IPAddressOrRange_insert(st, val, i) SKM_sk_insert(IPAddressOrRange, (st), (val), (i))\n#define sk_IPAddressOrRange_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(IPAddressOrRange, (st), (cmp))\n#define sk_IPAddressOrRange_dup(st) SKM_sk_dup(IPAddressOrRange, st)\n#define sk_IPAddressOrRange_pop_free(st, free_func) SKM_sk_pop_free(IPAddressOrRange, (st), (free_func))\n#define sk_IPAddressOrRange_shift(st) SKM_sk_shift(IPAddressOrRange, (st))\n#define sk_IPAddressOrRange_pop(st) SKM_sk_pop(IPAddressOrRange, (st))\n#define sk_IPAddressOrRange_sort(st) SKM_sk_sort(IPAddressOrRange, (st))\n#define sk_IPAddressOrRange_is_sorted(st) SKM_sk_is_sorted(IPAddressOrRange, (st))\n\n#define sk_KRB5_APREQBODY_new(st) SKM_sk_new(KRB5_APREQBODY, (st))\n#define sk_KRB5_APREQBODY_new_null() SKM_sk_new_null(KRB5_APREQBODY)\n#define sk_KRB5_APREQBODY_free(st) SKM_sk_free(KRB5_APREQBODY, (st))\n#define sk_KRB5_APREQBODY_num(st) SKM_sk_num(KRB5_APREQBODY, (st))\n#define sk_KRB5_APREQBODY_value(st, i) SKM_sk_value(KRB5_APREQBODY, (st), (i))\n#define sk_KRB5_APREQBODY_set(st, i, val) SKM_sk_set(KRB5_APREQBODY, (st), (i), (val))\n#define sk_KRB5_APREQBODY_zero(st) SKM_sk_zero(KRB5_APREQBODY, (st))\n#define sk_KRB5_APREQBODY_push(st, val) SKM_sk_push(KRB5_APREQBODY, (st), (val))\n#define sk_KRB5_APREQBODY_unshift(st, val) SKM_sk_unshift(KRB5_APREQBODY, (st), (val))\n#define sk_KRB5_APREQBODY_find(st, val) SKM_sk_find(KRB5_APREQBODY, (st), (val))\n#define sk_KRB5_APREQBODY_find_ex(st, val) SKM_sk_find_ex(KRB5_APREQBODY, (st), (val))\n#define sk_KRB5_APREQBODY_delete(st, i) SKM_sk_delete(KRB5_APREQBODY, (st), (i))\n#define sk_KRB5_APREQBODY_delete_ptr(st, ptr) SKM_sk_delete_ptr(KRB5_APREQBODY, (st), (ptr))\n#define sk_KRB5_APREQBODY_insert(st, val, i) SKM_sk_insert(KRB5_APREQBODY, (st), (val), (i))\n#define sk_KRB5_APREQBODY_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(KRB5_APREQBODY, (st), (cmp))\n#define sk_KRB5_APREQBODY_dup(st) SKM_sk_dup(KRB5_APREQBODY, st)\n#define sk_KRB5_APREQBODY_pop_free(st, free_func) SKM_sk_pop_free(KRB5_APREQBODY, (st), (free_func))\n#define sk_KRB5_APREQBODY_shift(st) SKM_sk_shift(KRB5_APREQBODY, (st))\n#define sk_KRB5_APREQBODY_pop(st) SKM_sk_pop(KRB5_APREQBODY, (st))\n#define sk_KRB5_APREQBODY_sort(st) SKM_sk_sort(KRB5_APREQBODY, (st))\n#define sk_KRB5_APREQBODY_is_sorted(st) SKM_sk_is_sorted(KRB5_APREQBODY, (st))\n\n#define sk_KRB5_AUTHDATA_new(st) SKM_sk_new(KRB5_AUTHDATA, (st))\n#define sk_KRB5_AUTHDATA_new_null() SKM_sk_new_null(KRB5_AUTHDATA)\n#define sk_KRB5_AUTHDATA_free(st) SKM_sk_free(KRB5_AUTHDATA, (st))\n#define sk_KRB5_AUTHDATA_num(st) SKM_sk_num(KRB5_AUTHDATA, (st))\n#define sk_KRB5_AUTHDATA_value(st, i) SKM_sk_value(KRB5_AUTHDATA, (st), (i))\n#define sk_KRB5_AUTHDATA_set(st, i, val) SKM_sk_set(KRB5_AUTHDATA, (st), (i), (val))\n#define sk_KRB5_AUTHDATA_zero(st) SKM_sk_zero(KRB5_AUTHDATA, (st))\n#define sk_KRB5_AUTHDATA_push(st, val) SKM_sk_push(KRB5_AUTHDATA, (st), (val))\n#define sk_KRB5_AUTHDATA_unshift(st, val) SKM_sk_unshift(KRB5_AUTHDATA, (st), (val))\n#define sk_KRB5_AUTHDATA_find(st, val) SKM_sk_find(KRB5_AUTHDATA, (st), (val))\n#define sk_KRB5_AUTHDATA_find_ex(st, val) SKM_sk_find_ex(KRB5_AUTHDATA, (st), (val))\n#define sk_KRB5_AUTHDATA_delete(st, i) SKM_sk_delete(KRB5_AUTHDATA, (st), (i))\n#define sk_KRB5_AUTHDATA_delete_ptr(st, ptr) SKM_sk_delete_ptr(KRB5_AUTHDATA, (st), (ptr))\n#define sk_KRB5_AUTHDATA_insert(st, val, i) SKM_sk_insert(KRB5_AUTHDATA, (st), (val), (i))\n#define sk_KRB5_AUTHDATA_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(KRB5_AUTHDATA, (st), (cmp))\n#define sk_KRB5_AUTHDATA_dup(st) SKM_sk_dup(KRB5_AUTHDATA, st)\n#define sk_KRB5_AUTHDATA_pop_free(st, free_func) SKM_sk_pop_free(KRB5_AUTHDATA, (st), (free_func))\n#define sk_KRB5_AUTHDATA_shift(st) SKM_sk_shift(KRB5_AUTHDATA, (st))\n#define sk_KRB5_AUTHDATA_pop(st) SKM_sk_pop(KRB5_AUTHDATA, (st))\n#define sk_KRB5_AUTHDATA_sort(st) SKM_sk_sort(KRB5_AUTHDATA, (st))\n#define sk_KRB5_AUTHDATA_is_sorted(st) SKM_sk_is_sorted(KRB5_AUTHDATA, (st))\n\n#define sk_KRB5_AUTHENTBODY_new(st) SKM_sk_new(KRB5_AUTHENTBODY, (st))\n#define sk_KRB5_AUTHENTBODY_new_null() SKM_sk_new_null(KRB5_AUTHENTBODY)\n#define sk_KRB5_AUTHENTBODY_free(st) SKM_sk_free(KRB5_AUTHENTBODY, (st))\n#define sk_KRB5_AUTHENTBODY_num(st) SKM_sk_num(KRB5_AUTHENTBODY, (st))\n#define sk_KRB5_AUTHENTBODY_value(st, i) SKM_sk_value(KRB5_AUTHENTBODY, (st), (i))\n#define sk_KRB5_AUTHENTBODY_set(st, i, val) SKM_sk_set(KRB5_AUTHENTBODY, (st), (i), (val))\n#define sk_KRB5_AUTHENTBODY_zero(st) SKM_sk_zero(KRB5_AUTHENTBODY, (st))\n#define sk_KRB5_AUTHENTBODY_push(st, val) SKM_sk_push(KRB5_AUTHENTBODY, (st), (val))\n#define sk_KRB5_AUTHENTBODY_unshift(st, val) SKM_sk_unshift(KRB5_AUTHENTBODY, (st), (val))\n#define sk_KRB5_AUTHENTBODY_find(st, val) SKM_sk_find(KRB5_AUTHENTBODY, (st), (val))\n#define sk_KRB5_AUTHENTBODY_find_ex(st, val) SKM_sk_find_ex(KRB5_AUTHENTBODY, (st), (val))\n#define sk_KRB5_AUTHENTBODY_delete(st, i) SKM_sk_delete(KRB5_AUTHENTBODY, (st), (i))\n#define sk_KRB5_AUTHENTBODY_delete_ptr(st, ptr) SKM_sk_delete_ptr(KRB5_AUTHENTBODY, (st), (ptr))\n#define sk_KRB5_AUTHENTBODY_insert(st, val, i) SKM_sk_insert(KRB5_AUTHENTBODY, (st), (val), (i))\n#define sk_KRB5_AUTHENTBODY_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(KRB5_AUTHENTBODY, (st), (cmp))\n#define sk_KRB5_AUTHENTBODY_dup(st) SKM_sk_dup(KRB5_AUTHENTBODY, st)\n#define sk_KRB5_AUTHENTBODY_pop_free(st, free_func) SKM_sk_pop_free(KRB5_AUTHENTBODY, (st), (free_func))\n#define sk_KRB5_AUTHENTBODY_shift(st) SKM_sk_shift(KRB5_AUTHENTBODY, (st))\n#define sk_KRB5_AUTHENTBODY_pop(st) SKM_sk_pop(KRB5_AUTHENTBODY, (st))\n#define sk_KRB5_AUTHENTBODY_sort(st) SKM_sk_sort(KRB5_AUTHENTBODY, (st))\n#define sk_KRB5_AUTHENTBODY_is_sorted(st) SKM_sk_is_sorted(KRB5_AUTHENTBODY, (st))\n\n#define sk_KRB5_CHECKSUM_new(st) SKM_sk_new(KRB5_CHECKSUM, (st))\n#define sk_KRB5_CHECKSUM_new_null() SKM_sk_new_null(KRB5_CHECKSUM)\n#define sk_KRB5_CHECKSUM_free(st) SKM_sk_free(KRB5_CHECKSUM, (st))\n#define sk_KRB5_CHECKSUM_num(st) SKM_sk_num(KRB5_CHECKSUM, (st))\n#define sk_KRB5_CHECKSUM_value(st, i) SKM_sk_value(KRB5_CHECKSUM, (st), (i))\n#define sk_KRB5_CHECKSUM_set(st, i, val) SKM_sk_set(KRB5_CHECKSUM, (st), (i), (val))\n#define sk_KRB5_CHECKSUM_zero(st) SKM_sk_zero(KRB5_CHECKSUM, (st))\n#define sk_KRB5_CHECKSUM_push(st, val) SKM_sk_push(KRB5_CHECKSUM, (st), (val))\n#define sk_KRB5_CHECKSUM_unshift(st, val) SKM_sk_unshift(KRB5_CHECKSUM, (st), (val))\n#define sk_KRB5_CHECKSUM_find(st, val) SKM_sk_find(KRB5_CHECKSUM, (st), (val))\n#define sk_KRB5_CHECKSUM_find_ex(st, val) SKM_sk_find_ex(KRB5_CHECKSUM, (st), (val))\n#define sk_KRB5_CHECKSUM_delete(st, i) SKM_sk_delete(KRB5_CHECKSUM, (st), (i))\n#define sk_KRB5_CHECKSUM_delete_ptr(st, ptr) SKM_sk_delete_ptr(KRB5_CHECKSUM, (st), (ptr))\n#define sk_KRB5_CHECKSUM_insert(st, val, i) SKM_sk_insert(KRB5_CHECKSUM, (st), (val), (i))\n#define sk_KRB5_CHECKSUM_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(KRB5_CHECKSUM, (st), (cmp))\n#define sk_KRB5_CHECKSUM_dup(st) SKM_sk_dup(KRB5_CHECKSUM, st)\n#define sk_KRB5_CHECKSUM_pop_free(st, free_func) SKM_sk_pop_free(KRB5_CHECKSUM, (st), (free_func))\n#define sk_KRB5_CHECKSUM_shift(st) SKM_sk_shift(KRB5_CHECKSUM, (st))\n#define sk_KRB5_CHECKSUM_pop(st) SKM_sk_pop(KRB5_CHECKSUM, (st))\n#define sk_KRB5_CHECKSUM_sort(st) SKM_sk_sort(KRB5_CHECKSUM, (st))\n#define sk_KRB5_CHECKSUM_is_sorted(st) SKM_sk_is_sorted(KRB5_CHECKSUM, (st))\n\n#define sk_KRB5_ENCDATA_new(st) SKM_sk_new(KRB5_ENCDATA, (st))\n#define sk_KRB5_ENCDATA_new_null() SKM_sk_new_null(KRB5_ENCDATA)\n#define sk_KRB5_ENCDATA_free(st) SKM_sk_free(KRB5_ENCDATA, (st))\n#define sk_KRB5_ENCDATA_num(st) SKM_sk_num(KRB5_ENCDATA, (st))\n#define sk_KRB5_ENCDATA_value(st, i) SKM_sk_value(KRB5_ENCDATA, (st), (i))\n#define sk_KRB5_ENCDATA_set(st, i, val) SKM_sk_set(KRB5_ENCDATA, (st), (i), (val))\n#define sk_KRB5_ENCDATA_zero(st) SKM_sk_zero(KRB5_ENCDATA, (st))\n#define sk_KRB5_ENCDATA_push(st, val) SKM_sk_push(KRB5_ENCDATA, (st), (val))\n#define sk_KRB5_ENCDATA_unshift(st, val) SKM_sk_unshift(KRB5_ENCDATA, (st), (val))\n#define sk_KRB5_ENCDATA_find(st, val) SKM_sk_find(KRB5_ENCDATA, (st), (val))\n#define sk_KRB5_ENCDATA_find_ex(st, val) SKM_sk_find_ex(KRB5_ENCDATA, (st), (val))\n#define sk_KRB5_ENCDATA_delete(st, i) SKM_sk_delete(KRB5_ENCDATA, (st), (i))\n#define sk_KRB5_ENCDATA_delete_ptr(st, ptr) SKM_sk_delete_ptr(KRB5_ENCDATA, (st), (ptr))\n#define sk_KRB5_ENCDATA_insert(st, val, i) SKM_sk_insert(KRB5_ENCDATA, (st), (val), (i))\n#define sk_KRB5_ENCDATA_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(KRB5_ENCDATA, (st), (cmp))\n#define sk_KRB5_ENCDATA_dup(st) SKM_sk_dup(KRB5_ENCDATA, st)\n#define sk_KRB5_ENCDATA_pop_free(st, free_func) SKM_sk_pop_free(KRB5_ENCDATA, (st), (free_func))\n#define sk_KRB5_ENCDATA_shift(st) SKM_sk_shift(KRB5_ENCDATA, (st))\n#define sk_KRB5_ENCDATA_pop(st) SKM_sk_pop(KRB5_ENCDATA, (st))\n#define sk_KRB5_ENCDATA_sort(st) SKM_sk_sort(KRB5_ENCDATA, (st))\n#define sk_KRB5_ENCDATA_is_sorted(st) SKM_sk_is_sorted(KRB5_ENCDATA, (st))\n\n#define sk_KRB5_ENCKEY_new(st) SKM_sk_new(KRB5_ENCKEY, (st))\n#define sk_KRB5_ENCKEY_new_null() SKM_sk_new_null(KRB5_ENCKEY)\n#define sk_KRB5_ENCKEY_free(st) SKM_sk_free(KRB5_ENCKEY, (st))\n#define sk_KRB5_ENCKEY_num(st) SKM_sk_num(KRB5_ENCKEY, (st))\n#define sk_KRB5_ENCKEY_value(st, i) SKM_sk_value(KRB5_ENCKEY, (st), (i))\n#define sk_KRB5_ENCKEY_set(st, i, val) SKM_sk_set(KRB5_ENCKEY, (st), (i), (val))\n#define sk_KRB5_ENCKEY_zero(st) SKM_sk_zero(KRB5_ENCKEY, (st))\n#define sk_KRB5_ENCKEY_push(st, val) SKM_sk_push(KRB5_ENCKEY, (st), (val))\n#define sk_KRB5_ENCKEY_unshift(st, val) SKM_sk_unshift(KRB5_ENCKEY, (st), (val))\n#define sk_KRB5_ENCKEY_find(st, val) SKM_sk_find(KRB5_ENCKEY, (st), (val))\n#define sk_KRB5_ENCKEY_find_ex(st, val) SKM_sk_find_ex(KRB5_ENCKEY, (st), (val))\n#define sk_KRB5_ENCKEY_delete(st, i) SKM_sk_delete(KRB5_ENCKEY, (st), (i))\n#define sk_KRB5_ENCKEY_delete_ptr(st, ptr) SKM_sk_delete_ptr(KRB5_ENCKEY, (st), (ptr))\n#define sk_KRB5_ENCKEY_insert(st, val, i) SKM_sk_insert(KRB5_ENCKEY, (st), (val), (i))\n#define sk_KRB5_ENCKEY_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(KRB5_ENCKEY, (st), (cmp))\n#define sk_KRB5_ENCKEY_dup(st) SKM_sk_dup(KRB5_ENCKEY, st)\n#define sk_KRB5_ENCKEY_pop_free(st, free_func) SKM_sk_pop_free(KRB5_ENCKEY, (st), (free_func))\n#define sk_KRB5_ENCKEY_shift(st) SKM_sk_shift(KRB5_ENCKEY, (st))\n#define sk_KRB5_ENCKEY_pop(st) SKM_sk_pop(KRB5_ENCKEY, (st))\n#define sk_KRB5_ENCKEY_sort(st) SKM_sk_sort(KRB5_ENCKEY, (st))\n#define sk_KRB5_ENCKEY_is_sorted(st) SKM_sk_is_sorted(KRB5_ENCKEY, (st))\n\n#define sk_KRB5_PRINCNAME_new(st) SKM_sk_new(KRB5_PRINCNAME, (st))\n#define sk_KRB5_PRINCNAME_new_null() SKM_sk_new_null(KRB5_PRINCNAME)\n#define sk_KRB5_PRINCNAME_free(st) SKM_sk_free(KRB5_PRINCNAME, (st))\n#define sk_KRB5_PRINCNAME_num(st) SKM_sk_num(KRB5_PRINCNAME, (st))\n#define sk_KRB5_PRINCNAME_value(st, i) SKM_sk_value(KRB5_PRINCNAME, (st), (i))\n#define sk_KRB5_PRINCNAME_set(st, i, val) SKM_sk_set(KRB5_PRINCNAME, (st), (i), (val))\n#define sk_KRB5_PRINCNAME_zero(st) SKM_sk_zero(KRB5_PRINCNAME, (st))\n#define sk_KRB5_PRINCNAME_push(st, val) SKM_sk_push(KRB5_PRINCNAME, (st), (val))\n#define sk_KRB5_PRINCNAME_unshift(st, val) SKM_sk_unshift(KRB5_PRINCNAME, (st), (val))\n#define sk_KRB5_PRINCNAME_find(st, val) SKM_sk_find(KRB5_PRINCNAME, (st), (val))\n#define sk_KRB5_PRINCNAME_find_ex(st, val) SKM_sk_find_ex(KRB5_PRINCNAME, (st), (val))\n#define sk_KRB5_PRINCNAME_delete(st, i) SKM_sk_delete(KRB5_PRINCNAME, (st), (i))\n#define sk_KRB5_PRINCNAME_delete_ptr(st, ptr) SKM_sk_delete_ptr(KRB5_PRINCNAME, (st), (ptr))\n#define sk_KRB5_PRINCNAME_insert(st, val, i) SKM_sk_insert(KRB5_PRINCNAME, (st), (val), (i))\n#define sk_KRB5_PRINCNAME_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(KRB5_PRINCNAME, (st), (cmp))\n#define sk_KRB5_PRINCNAME_dup(st) SKM_sk_dup(KRB5_PRINCNAME, st)\n#define sk_KRB5_PRINCNAME_pop_free(st, free_func) SKM_sk_pop_free(KRB5_PRINCNAME, (st), (free_func))\n#define sk_KRB5_PRINCNAME_shift(st) SKM_sk_shift(KRB5_PRINCNAME, (st))\n#define sk_KRB5_PRINCNAME_pop(st) SKM_sk_pop(KRB5_PRINCNAME, (st))\n#define sk_KRB5_PRINCNAME_sort(st) SKM_sk_sort(KRB5_PRINCNAME, (st))\n#define sk_KRB5_PRINCNAME_is_sorted(st) SKM_sk_is_sorted(KRB5_PRINCNAME, (st))\n\n#define sk_KRB5_TKTBODY_new(st) SKM_sk_new(KRB5_TKTBODY, (st))\n#define sk_KRB5_TKTBODY_new_null() SKM_sk_new_null(KRB5_TKTBODY)\n#define sk_KRB5_TKTBODY_free(st) SKM_sk_free(KRB5_TKTBODY, (st))\n#define sk_KRB5_TKTBODY_num(st) SKM_sk_num(KRB5_TKTBODY, (st))\n#define sk_KRB5_TKTBODY_value(st, i) SKM_sk_value(KRB5_TKTBODY, (st), (i))\n#define sk_KRB5_TKTBODY_set(st, i, val) SKM_sk_set(KRB5_TKTBODY, (st), (i), (val))\n#define sk_KRB5_TKTBODY_zero(st) SKM_sk_zero(KRB5_TKTBODY, (st))\n#define sk_KRB5_TKTBODY_push(st, val) SKM_sk_push(KRB5_TKTBODY, (st), (val))\n#define sk_KRB5_TKTBODY_unshift(st, val) SKM_sk_unshift(KRB5_TKTBODY, (st), (val))\n#define sk_KRB5_TKTBODY_find(st, val) SKM_sk_find(KRB5_TKTBODY, (st), (val))\n#define sk_KRB5_TKTBODY_find_ex(st, val) SKM_sk_find_ex(KRB5_TKTBODY, (st), (val))\n#define sk_KRB5_TKTBODY_delete(st, i) SKM_sk_delete(KRB5_TKTBODY, (st), (i))\n#define sk_KRB5_TKTBODY_delete_ptr(st, ptr) SKM_sk_delete_ptr(KRB5_TKTBODY, (st), (ptr))\n#define sk_KRB5_TKTBODY_insert(st, val, i) SKM_sk_insert(KRB5_TKTBODY, (st), (val), (i))\n#define sk_KRB5_TKTBODY_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(KRB5_TKTBODY, (st), (cmp))\n#define sk_KRB5_TKTBODY_dup(st) SKM_sk_dup(KRB5_TKTBODY, st)\n#define sk_KRB5_TKTBODY_pop_free(st, free_func) SKM_sk_pop_free(KRB5_TKTBODY, (st), (free_func))\n#define sk_KRB5_TKTBODY_shift(st) SKM_sk_shift(KRB5_TKTBODY, (st))\n#define sk_KRB5_TKTBODY_pop(st) SKM_sk_pop(KRB5_TKTBODY, (st))\n#define sk_KRB5_TKTBODY_sort(st) SKM_sk_sort(KRB5_TKTBODY, (st))\n#define sk_KRB5_TKTBODY_is_sorted(st) SKM_sk_is_sorted(KRB5_TKTBODY, (st))\n\n#define sk_MIME_HEADER_new(st) SKM_sk_new(MIME_HEADER, (st))\n#define sk_MIME_HEADER_new_null() SKM_sk_new_null(MIME_HEADER)\n#define sk_MIME_HEADER_free(st) SKM_sk_free(MIME_HEADER, (st))\n#define sk_MIME_HEADER_num(st) SKM_sk_num(MIME_HEADER, (st))\n#define sk_MIME_HEADER_value(st, i) SKM_sk_value(MIME_HEADER, (st), (i))\n#define sk_MIME_HEADER_set(st, i, val) SKM_sk_set(MIME_HEADER, (st), (i), (val))\n#define sk_MIME_HEADER_zero(st) SKM_sk_zero(MIME_HEADER, (st))\n#define sk_MIME_HEADER_push(st, val) SKM_sk_push(MIME_HEADER, (st), (val))\n#define sk_MIME_HEADER_unshift(st, val) SKM_sk_unshift(MIME_HEADER, (st), (val))\n#define sk_MIME_HEADER_find(st, val) SKM_sk_find(MIME_HEADER, (st), (val))\n#define sk_MIME_HEADER_find_ex(st, val) SKM_sk_find_ex(MIME_HEADER, (st), (val))\n#define sk_MIME_HEADER_delete(st, i) SKM_sk_delete(MIME_HEADER, (st), (i))\n#define sk_MIME_HEADER_delete_ptr(st, ptr) SKM_sk_delete_ptr(MIME_HEADER, (st), (ptr))\n#define sk_MIME_HEADER_insert(st, val, i) SKM_sk_insert(MIME_HEADER, (st), (val), (i))\n#define sk_MIME_HEADER_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(MIME_HEADER, (st), (cmp))\n#define sk_MIME_HEADER_dup(st) SKM_sk_dup(MIME_HEADER, st)\n#define sk_MIME_HEADER_pop_free(st, free_func) SKM_sk_pop_free(MIME_HEADER, (st), (free_func))\n#define sk_MIME_HEADER_shift(st) SKM_sk_shift(MIME_HEADER, (st))\n#define sk_MIME_HEADER_pop(st) SKM_sk_pop(MIME_HEADER, (st))\n#define sk_MIME_HEADER_sort(st) SKM_sk_sort(MIME_HEADER, (st))\n#define sk_MIME_HEADER_is_sorted(st) SKM_sk_is_sorted(MIME_HEADER, (st))\n\n#define sk_MIME_PARAM_new(st) SKM_sk_new(MIME_PARAM, (st))\n#define sk_MIME_PARAM_new_null() SKM_sk_new_null(MIME_PARAM)\n#define sk_MIME_PARAM_free(st) SKM_sk_free(MIME_PARAM, (st))\n#define sk_MIME_PARAM_num(st) SKM_sk_num(MIME_PARAM, (st))\n#define sk_MIME_PARAM_value(st, i) SKM_sk_value(MIME_PARAM, (st), (i))\n#define sk_MIME_PARAM_set(st, i, val) SKM_sk_set(MIME_PARAM, (st), (i), (val))\n#define sk_MIME_PARAM_zero(st) SKM_sk_zero(MIME_PARAM, (st))\n#define sk_MIME_PARAM_push(st, val) SKM_sk_push(MIME_PARAM, (st), (val))\n#define sk_MIME_PARAM_unshift(st, val) SKM_sk_unshift(MIME_PARAM, (st), (val))\n#define sk_MIME_PARAM_find(st, val) SKM_sk_find(MIME_PARAM, (st), (val))\n#define sk_MIME_PARAM_find_ex(st, val) SKM_sk_find_ex(MIME_PARAM, (st), (val))\n#define sk_MIME_PARAM_delete(st, i) SKM_sk_delete(MIME_PARAM, (st), (i))\n#define sk_MIME_PARAM_delete_ptr(st, ptr) SKM_sk_delete_ptr(MIME_PARAM, (st), (ptr))\n#define sk_MIME_PARAM_insert(st, val, i) SKM_sk_insert(MIME_PARAM, (st), (val), (i))\n#define sk_MIME_PARAM_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(MIME_PARAM, (st), (cmp))\n#define sk_MIME_PARAM_dup(st) SKM_sk_dup(MIME_PARAM, st)\n#define sk_MIME_PARAM_pop_free(st, free_func) SKM_sk_pop_free(MIME_PARAM, (st), (free_func))\n#define sk_MIME_PARAM_shift(st) SKM_sk_shift(MIME_PARAM, (st))\n#define sk_MIME_PARAM_pop(st) SKM_sk_pop(MIME_PARAM, (st))\n#define sk_MIME_PARAM_sort(st) SKM_sk_sort(MIME_PARAM, (st))\n#define sk_MIME_PARAM_is_sorted(st) SKM_sk_is_sorted(MIME_PARAM, (st))\n\n#define sk_NAME_FUNCS_new(st) SKM_sk_new(NAME_FUNCS, (st))\n#define sk_NAME_FUNCS_new_null() SKM_sk_new_null(NAME_FUNCS)\n#define sk_NAME_FUNCS_free(st) SKM_sk_free(NAME_FUNCS, (st))\n#define sk_NAME_FUNCS_num(st) SKM_sk_num(NAME_FUNCS, (st))\n#define sk_NAME_FUNCS_value(st, i) SKM_sk_value(NAME_FUNCS, (st), (i))\n#define sk_NAME_FUNCS_set(st, i, val) SKM_sk_set(NAME_FUNCS, (st), (i), (val))\n#define sk_NAME_FUNCS_zero(st) SKM_sk_zero(NAME_FUNCS, (st))\n#define sk_NAME_FUNCS_push(st, val) SKM_sk_push(NAME_FUNCS, (st), (val))\n#define sk_NAME_FUNCS_unshift(st, val) SKM_sk_unshift(NAME_FUNCS, (st), (val))\n#define sk_NAME_FUNCS_find(st, val) SKM_sk_find(NAME_FUNCS, (st), (val))\n#define sk_NAME_FUNCS_find_ex(st, val) SKM_sk_find_ex(NAME_FUNCS, (st), (val))\n#define sk_NAME_FUNCS_delete(st, i) SKM_sk_delete(NAME_FUNCS, (st), (i))\n#define sk_NAME_FUNCS_delete_ptr(st, ptr) SKM_sk_delete_ptr(NAME_FUNCS, (st), (ptr))\n#define sk_NAME_FUNCS_insert(st, val, i) SKM_sk_insert(NAME_FUNCS, (st), (val), (i))\n#define sk_NAME_FUNCS_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(NAME_FUNCS, (st), (cmp))\n#define sk_NAME_FUNCS_dup(st) SKM_sk_dup(NAME_FUNCS, st)\n#define sk_NAME_FUNCS_pop_free(st, free_func) SKM_sk_pop_free(NAME_FUNCS, (st), (free_func))\n#define sk_NAME_FUNCS_shift(st) SKM_sk_shift(NAME_FUNCS, (st))\n#define sk_NAME_FUNCS_pop(st) SKM_sk_pop(NAME_FUNCS, (st))\n#define sk_NAME_FUNCS_sort(st) SKM_sk_sort(NAME_FUNCS, (st))\n#define sk_NAME_FUNCS_is_sorted(st) SKM_sk_is_sorted(NAME_FUNCS, (st))\n\n#define sk_OCSP_CERTID_new(st) SKM_sk_new(OCSP_CERTID, (st))\n#define sk_OCSP_CERTID_new_null() SKM_sk_new_null(OCSP_CERTID)\n#define sk_OCSP_CERTID_free(st) SKM_sk_free(OCSP_CERTID, (st))\n#define sk_OCSP_CERTID_num(st) SKM_sk_num(OCSP_CERTID, (st))\n#define sk_OCSP_CERTID_value(st, i) SKM_sk_value(OCSP_CERTID, (st), (i))\n#define sk_OCSP_CERTID_set(st, i, val) SKM_sk_set(OCSP_CERTID, (st), (i), (val))\n#define sk_OCSP_CERTID_zero(st) SKM_sk_zero(OCSP_CERTID, (st))\n#define sk_OCSP_CERTID_push(st, val) SKM_sk_push(OCSP_CERTID, (st), (val))\n#define sk_OCSP_CERTID_unshift(st, val) SKM_sk_unshift(OCSP_CERTID, (st), (val))\n#define sk_OCSP_CERTID_find(st, val) SKM_sk_find(OCSP_CERTID, (st), (val))\n#define sk_OCSP_CERTID_find_ex(st, val) SKM_sk_find_ex(OCSP_CERTID, (st), (val))\n#define sk_OCSP_CERTID_delete(st, i) SKM_sk_delete(OCSP_CERTID, (st), (i))\n#define sk_OCSP_CERTID_delete_ptr(st, ptr) SKM_sk_delete_ptr(OCSP_CERTID, (st), (ptr))\n#define sk_OCSP_CERTID_insert(st, val, i) SKM_sk_insert(OCSP_CERTID, (st), (val), (i))\n#define sk_OCSP_CERTID_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(OCSP_CERTID, (st), (cmp))\n#define sk_OCSP_CERTID_dup(st) SKM_sk_dup(OCSP_CERTID, st)\n#define sk_OCSP_CERTID_pop_free(st, free_func) SKM_sk_pop_free(OCSP_CERTID, (st), (free_func))\n#define sk_OCSP_CERTID_shift(st) SKM_sk_shift(OCSP_CERTID, (st))\n#define sk_OCSP_CERTID_pop(st) SKM_sk_pop(OCSP_CERTID, (st))\n#define sk_OCSP_CERTID_sort(st) SKM_sk_sort(OCSP_CERTID, (st))\n#define sk_OCSP_CERTID_is_sorted(st) SKM_sk_is_sorted(OCSP_CERTID, (st))\n\n#define sk_OCSP_ONEREQ_new(st) SKM_sk_new(OCSP_ONEREQ, (st))\n#define sk_OCSP_ONEREQ_new_null() SKM_sk_new_null(OCSP_ONEREQ)\n#define sk_OCSP_ONEREQ_free(st) SKM_sk_free(OCSP_ONEREQ, (st))\n#define sk_OCSP_ONEREQ_num(st) SKM_sk_num(OCSP_ONEREQ, (st))\n#define sk_OCSP_ONEREQ_value(st, i) SKM_sk_value(OCSP_ONEREQ, (st), (i))\n#define sk_OCSP_ONEREQ_set(st, i, val) SKM_sk_set(OCSP_ONEREQ, (st), (i), (val))\n#define sk_OCSP_ONEREQ_zero(st) SKM_sk_zero(OCSP_ONEREQ, (st))\n#define sk_OCSP_ONEREQ_push(st, val) SKM_sk_push(OCSP_ONEREQ, (st), (val))\n#define sk_OCSP_ONEREQ_unshift(st, val) SKM_sk_unshift(OCSP_ONEREQ, (st), (val))\n#define sk_OCSP_ONEREQ_find(st, val) SKM_sk_find(OCSP_ONEREQ, (st), (val))\n#define sk_OCSP_ONEREQ_find_ex(st, val) SKM_sk_find_ex(OCSP_ONEREQ, (st), (val))\n#define sk_OCSP_ONEREQ_delete(st, i) SKM_sk_delete(OCSP_ONEREQ, (st), (i))\n#define sk_OCSP_ONEREQ_delete_ptr(st, ptr) SKM_sk_delete_ptr(OCSP_ONEREQ, (st), (ptr))\n#define sk_OCSP_ONEREQ_insert(st, val, i) SKM_sk_insert(OCSP_ONEREQ, (st), (val), (i))\n#define sk_OCSP_ONEREQ_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(OCSP_ONEREQ, (st), (cmp))\n#define sk_OCSP_ONEREQ_dup(st) SKM_sk_dup(OCSP_ONEREQ, st)\n#define sk_OCSP_ONEREQ_pop_free(st, free_func) SKM_sk_pop_free(OCSP_ONEREQ, (st), (free_func))\n#define sk_OCSP_ONEREQ_shift(st) SKM_sk_shift(OCSP_ONEREQ, (st))\n#define sk_OCSP_ONEREQ_pop(st) SKM_sk_pop(OCSP_ONEREQ, (st))\n#define sk_OCSP_ONEREQ_sort(st) SKM_sk_sort(OCSP_ONEREQ, (st))\n#define sk_OCSP_ONEREQ_is_sorted(st) SKM_sk_is_sorted(OCSP_ONEREQ, (st))\n\n#define sk_OCSP_RESPID_new(st) SKM_sk_new(OCSP_RESPID, (st))\n#define sk_OCSP_RESPID_new_null() SKM_sk_new_null(OCSP_RESPID)\n#define sk_OCSP_RESPID_free(st) SKM_sk_free(OCSP_RESPID, (st))\n#define sk_OCSP_RESPID_num(st) SKM_sk_num(OCSP_RESPID, (st))\n#define sk_OCSP_RESPID_value(st, i) SKM_sk_value(OCSP_RESPID, (st), (i))\n#define sk_OCSP_RESPID_set(st, i, val) SKM_sk_set(OCSP_RESPID, (st), (i), (val))\n#define sk_OCSP_RESPID_zero(st) SKM_sk_zero(OCSP_RESPID, (st))\n#define sk_OCSP_RESPID_push(st, val) SKM_sk_push(OCSP_RESPID, (st), (val))\n#define sk_OCSP_RESPID_unshift(st, val) SKM_sk_unshift(OCSP_RESPID, (st), (val))\n#define sk_OCSP_RESPID_find(st, val) SKM_sk_find(OCSP_RESPID, (st), (val))\n#define sk_OCSP_RESPID_find_ex(st, val) SKM_sk_find_ex(OCSP_RESPID, (st), (val))\n#define sk_OCSP_RESPID_delete(st, i) SKM_sk_delete(OCSP_RESPID, (st), (i))\n#define sk_OCSP_RESPID_delete_ptr(st, ptr) SKM_sk_delete_ptr(OCSP_RESPID, (st), (ptr))\n#define sk_OCSP_RESPID_insert(st, val, i) SKM_sk_insert(OCSP_RESPID, (st), (val), (i))\n#define sk_OCSP_RESPID_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(OCSP_RESPID, (st), (cmp))\n#define sk_OCSP_RESPID_dup(st) SKM_sk_dup(OCSP_RESPID, st)\n#define sk_OCSP_RESPID_pop_free(st, free_func) SKM_sk_pop_free(OCSP_RESPID, (st), (free_func))\n#define sk_OCSP_RESPID_shift(st) SKM_sk_shift(OCSP_RESPID, (st))\n#define sk_OCSP_RESPID_pop(st) SKM_sk_pop(OCSP_RESPID, (st))\n#define sk_OCSP_RESPID_sort(st) SKM_sk_sort(OCSP_RESPID, (st))\n#define sk_OCSP_RESPID_is_sorted(st) SKM_sk_is_sorted(OCSP_RESPID, (st))\n\n#define sk_OCSP_SINGLERESP_new(st) SKM_sk_new(OCSP_SINGLERESP, (st))\n#define sk_OCSP_SINGLERESP_new_null() SKM_sk_new_null(OCSP_SINGLERESP)\n#define sk_OCSP_SINGLERESP_free(st) SKM_sk_free(OCSP_SINGLERESP, (st))\n#define sk_OCSP_SINGLERESP_num(st) SKM_sk_num(OCSP_SINGLERESP, (st))\n#define sk_OCSP_SINGLERESP_value(st, i) SKM_sk_value(OCSP_SINGLERESP, (st), (i))\n#define sk_OCSP_SINGLERESP_set(st, i, val) SKM_sk_set(OCSP_SINGLERESP, (st), (i), (val))\n#define sk_OCSP_SINGLERESP_zero(st) SKM_sk_zero(OCSP_SINGLERESP, (st))\n#define sk_OCSP_SINGLERESP_push(st, val) SKM_sk_push(OCSP_SINGLERESP, (st), (val))\n#define sk_OCSP_SINGLERESP_unshift(st, val) SKM_sk_unshift(OCSP_SINGLERESP, (st), (val))\n#define sk_OCSP_SINGLERESP_find(st, val) SKM_sk_find(OCSP_SINGLERESP, (st), (val))\n#define sk_OCSP_SINGLERESP_find_ex(st, val) SKM_sk_find_ex(OCSP_SINGLERESP, (st), (val))\n#define sk_OCSP_SINGLERESP_delete(st, i) SKM_sk_delete(OCSP_SINGLERESP, (st), (i))\n#define sk_OCSP_SINGLERESP_delete_ptr(st, ptr) SKM_sk_delete_ptr(OCSP_SINGLERESP, (st), (ptr))\n#define sk_OCSP_SINGLERESP_insert(st, val, i) SKM_sk_insert(OCSP_SINGLERESP, (st), (val), (i))\n#define sk_OCSP_SINGLERESP_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(OCSP_SINGLERESP, (st), (cmp))\n#define sk_OCSP_SINGLERESP_dup(st) SKM_sk_dup(OCSP_SINGLERESP, st)\n#define sk_OCSP_SINGLERESP_pop_free(st, free_func) SKM_sk_pop_free(OCSP_SINGLERESP, (st), (free_func))\n#define sk_OCSP_SINGLERESP_shift(st) SKM_sk_shift(OCSP_SINGLERESP, (st))\n#define sk_OCSP_SINGLERESP_pop(st) SKM_sk_pop(OCSP_SINGLERESP, (st))\n#define sk_OCSP_SINGLERESP_sort(st) SKM_sk_sort(OCSP_SINGLERESP, (st))\n#define sk_OCSP_SINGLERESP_is_sorted(st) SKM_sk_is_sorted(OCSP_SINGLERESP, (st))\n\n#define sk_PKCS12_SAFEBAG_new(st) SKM_sk_new(PKCS12_SAFEBAG, (st))\n#define sk_PKCS12_SAFEBAG_new_null() SKM_sk_new_null(PKCS12_SAFEBAG)\n#define sk_PKCS12_SAFEBAG_free(st) SKM_sk_free(PKCS12_SAFEBAG, (st))\n#define sk_PKCS12_SAFEBAG_num(st) SKM_sk_num(PKCS12_SAFEBAG, (st))\n#define sk_PKCS12_SAFEBAG_value(st, i) SKM_sk_value(PKCS12_SAFEBAG, (st), (i))\n#define sk_PKCS12_SAFEBAG_set(st, i, val) SKM_sk_set(PKCS12_SAFEBAG, (st), (i), (val))\n#define sk_PKCS12_SAFEBAG_zero(st) SKM_sk_zero(PKCS12_SAFEBAG, (st))\n#define sk_PKCS12_SAFEBAG_push(st, val) SKM_sk_push(PKCS12_SAFEBAG, (st), (val))\n#define sk_PKCS12_SAFEBAG_unshift(st, val) SKM_sk_unshift(PKCS12_SAFEBAG, (st), (val))\n#define sk_PKCS12_SAFEBAG_find(st, val) SKM_sk_find(PKCS12_SAFEBAG, (st), (val))\n#define sk_PKCS12_SAFEBAG_find_ex(st, val) SKM_sk_find_ex(PKCS12_SAFEBAG, (st), (val))\n#define sk_PKCS12_SAFEBAG_delete(st, i) SKM_sk_delete(PKCS12_SAFEBAG, (st), (i))\n#define sk_PKCS12_SAFEBAG_delete_ptr(st, ptr) SKM_sk_delete_ptr(PKCS12_SAFEBAG, (st), (ptr))\n#define sk_PKCS12_SAFEBAG_insert(st, val, i) SKM_sk_insert(PKCS12_SAFEBAG, (st), (val), (i))\n#define sk_PKCS12_SAFEBAG_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(PKCS12_SAFEBAG, (st), (cmp))\n#define sk_PKCS12_SAFEBAG_dup(st) SKM_sk_dup(PKCS12_SAFEBAG, st)\n#define sk_PKCS12_SAFEBAG_pop_free(st, free_func) SKM_sk_pop_free(PKCS12_SAFEBAG, (st), (free_func))\n#define sk_PKCS12_SAFEBAG_shift(st) SKM_sk_shift(PKCS12_SAFEBAG, (st))\n#define sk_PKCS12_SAFEBAG_pop(st) SKM_sk_pop(PKCS12_SAFEBAG, (st))\n#define sk_PKCS12_SAFEBAG_sort(st) SKM_sk_sort(PKCS12_SAFEBAG, (st))\n#define sk_PKCS12_SAFEBAG_is_sorted(st) SKM_sk_is_sorted(PKCS12_SAFEBAG, (st))\n\n#define sk_PKCS7_new(st) SKM_sk_new(PKCS7, (st))\n#define sk_PKCS7_new_null() SKM_sk_new_null(PKCS7)\n#define sk_PKCS7_free(st) SKM_sk_free(PKCS7, (st))\n#define sk_PKCS7_num(st) SKM_sk_num(PKCS7, (st))\n#define sk_PKCS7_value(st, i) SKM_sk_value(PKCS7, (st), (i))\n#define sk_PKCS7_set(st, i, val) SKM_sk_set(PKCS7, (st), (i), (val))\n#define sk_PKCS7_zero(st) SKM_sk_zero(PKCS7, (st))\n#define sk_PKCS7_push(st, val) SKM_sk_push(PKCS7, (st), (val))\n#define sk_PKCS7_unshift(st, val) SKM_sk_unshift(PKCS7, (st), (val))\n#define sk_PKCS7_find(st, val) SKM_sk_find(PKCS7, (st), (val))\n#define sk_PKCS7_find_ex(st, val) SKM_sk_find_ex(PKCS7, (st), (val))\n#define sk_PKCS7_delete(st, i) SKM_sk_delete(PKCS7, (st), (i))\n#define sk_PKCS7_delete_ptr(st, ptr) SKM_sk_delete_ptr(PKCS7, (st), (ptr))\n#define sk_PKCS7_insert(st, val, i) SKM_sk_insert(PKCS7, (st), (val), (i))\n#define sk_PKCS7_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(PKCS7, (st), (cmp))\n#define sk_PKCS7_dup(st) SKM_sk_dup(PKCS7, st)\n#define sk_PKCS7_pop_free(st, free_func) SKM_sk_pop_free(PKCS7, (st), (free_func))\n#define sk_PKCS7_shift(st) SKM_sk_shift(PKCS7, (st))\n#define sk_PKCS7_pop(st) SKM_sk_pop(PKCS7, (st))\n#define sk_PKCS7_sort(st) SKM_sk_sort(PKCS7, (st))\n#define sk_PKCS7_is_sorted(st) SKM_sk_is_sorted(PKCS7, (st))\n\n#define sk_PKCS7_RECIP_INFO_new(st) SKM_sk_new(PKCS7_RECIP_INFO, (st))\n#define sk_PKCS7_RECIP_INFO_new_null() SKM_sk_new_null(PKCS7_RECIP_INFO)\n#define sk_PKCS7_RECIP_INFO_free(st) SKM_sk_free(PKCS7_RECIP_INFO, (st))\n#define sk_PKCS7_RECIP_INFO_num(st) SKM_sk_num(PKCS7_RECIP_INFO, (st))\n#define sk_PKCS7_RECIP_INFO_value(st, i) SKM_sk_value(PKCS7_RECIP_INFO, (st), (i))\n#define sk_PKCS7_RECIP_INFO_set(st, i, val) SKM_sk_set(PKCS7_RECIP_INFO, (st), (i), (val))\n#define sk_PKCS7_RECIP_INFO_zero(st) SKM_sk_zero(PKCS7_RECIP_INFO, (st))\n#define sk_PKCS7_RECIP_INFO_push(st, val) SKM_sk_push(PKCS7_RECIP_INFO, (st), (val))\n#define sk_PKCS7_RECIP_INFO_unshift(st, val) SKM_sk_unshift(PKCS7_RECIP_INFO, (st), (val))\n#define sk_PKCS7_RECIP_INFO_find(st, val) SKM_sk_find(PKCS7_RECIP_INFO, (st), (val))\n#define sk_PKCS7_RECIP_INFO_find_ex(st, val) SKM_sk_find_ex(PKCS7_RECIP_INFO, (st), (val))\n#define sk_PKCS7_RECIP_INFO_delete(st, i) SKM_sk_delete(PKCS7_RECIP_INFO, (st), (i))\n#define sk_PKCS7_RECIP_INFO_delete_ptr(st, ptr) SKM_sk_delete_ptr(PKCS7_RECIP_INFO, (st), (ptr))\n#define sk_PKCS7_RECIP_INFO_insert(st, val, i) SKM_sk_insert(PKCS7_RECIP_INFO, (st), (val), (i))\n#define sk_PKCS7_RECIP_INFO_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(PKCS7_RECIP_INFO, (st), (cmp))\n#define sk_PKCS7_RECIP_INFO_dup(st) SKM_sk_dup(PKCS7_RECIP_INFO, st)\n#define sk_PKCS7_RECIP_INFO_pop_free(st, free_func) SKM_sk_pop_free(PKCS7_RECIP_INFO, (st), (free_func))\n#define sk_PKCS7_RECIP_INFO_shift(st) SKM_sk_shift(PKCS7_RECIP_INFO, (st))\n#define sk_PKCS7_RECIP_INFO_pop(st) SKM_sk_pop(PKCS7_RECIP_INFO, (st))\n#define sk_PKCS7_RECIP_INFO_sort(st) SKM_sk_sort(PKCS7_RECIP_INFO, (st))\n#define sk_PKCS7_RECIP_INFO_is_sorted(st) SKM_sk_is_sorted(PKCS7_RECIP_INFO, (st))\n\n#define sk_PKCS7_SIGNER_INFO_new(st) SKM_sk_new(PKCS7_SIGNER_INFO, (st))\n#define sk_PKCS7_SIGNER_INFO_new_null() SKM_sk_new_null(PKCS7_SIGNER_INFO)\n#define sk_PKCS7_SIGNER_INFO_free(st) SKM_sk_free(PKCS7_SIGNER_INFO, (st))\n#define sk_PKCS7_SIGNER_INFO_num(st) SKM_sk_num(PKCS7_SIGNER_INFO, (st))\n#define sk_PKCS7_SIGNER_INFO_value(st, i) SKM_sk_value(PKCS7_SIGNER_INFO, (st), (i))\n#define sk_PKCS7_SIGNER_INFO_set(st, i, val) SKM_sk_set(PKCS7_SIGNER_INFO, (st), (i), (val))\n#define sk_PKCS7_SIGNER_INFO_zero(st) SKM_sk_zero(PKCS7_SIGNER_INFO, (st))\n#define sk_PKCS7_SIGNER_INFO_push(st, val) SKM_sk_push(PKCS7_SIGNER_INFO, (st), (val))\n#define sk_PKCS7_SIGNER_INFO_unshift(st, val) SKM_sk_unshift(PKCS7_SIGNER_INFO, (st), (val))\n#define sk_PKCS7_SIGNER_INFO_find(st, val) SKM_sk_find(PKCS7_SIGNER_INFO, (st), (val))\n#define sk_PKCS7_SIGNER_INFO_find_ex(st, val) SKM_sk_find_ex(PKCS7_SIGNER_INFO, (st), (val))\n#define sk_PKCS7_SIGNER_INFO_delete(st, i) SKM_sk_delete(PKCS7_SIGNER_INFO, (st), (i))\n#define sk_PKCS7_SIGNER_INFO_delete_ptr(st, ptr) SKM_sk_delete_ptr(PKCS7_SIGNER_INFO, (st), (ptr))\n#define sk_PKCS7_SIGNER_INFO_insert(st, val, i) SKM_sk_insert(PKCS7_SIGNER_INFO, (st), (val), (i))\n#define sk_PKCS7_SIGNER_INFO_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(PKCS7_SIGNER_INFO, (st), (cmp))\n#define sk_PKCS7_SIGNER_INFO_dup(st) SKM_sk_dup(PKCS7_SIGNER_INFO, st)\n#define sk_PKCS7_SIGNER_INFO_pop_free(st, free_func) SKM_sk_pop_free(PKCS7_SIGNER_INFO, (st), (free_func))\n#define sk_PKCS7_SIGNER_INFO_shift(st) SKM_sk_shift(PKCS7_SIGNER_INFO, (st))\n#define sk_PKCS7_SIGNER_INFO_pop(st) SKM_sk_pop(PKCS7_SIGNER_INFO, (st))\n#define sk_PKCS7_SIGNER_INFO_sort(st) SKM_sk_sort(PKCS7_SIGNER_INFO, (st))\n#define sk_PKCS7_SIGNER_INFO_is_sorted(st) SKM_sk_is_sorted(PKCS7_SIGNER_INFO, (st))\n\n#define sk_POLICYINFO_new(st) SKM_sk_new(POLICYINFO, (st))\n#define sk_POLICYINFO_new_null() SKM_sk_new_null(POLICYINFO)\n#define sk_POLICYINFO_free(st) SKM_sk_free(POLICYINFO, (st))\n#define sk_POLICYINFO_num(st) SKM_sk_num(POLICYINFO, (st))\n#define sk_POLICYINFO_value(st, i) SKM_sk_value(POLICYINFO, (st), (i))\n#define sk_POLICYINFO_set(st, i, val) SKM_sk_set(POLICYINFO, (st), (i), (val))\n#define sk_POLICYINFO_zero(st) SKM_sk_zero(POLICYINFO, (st))\n#define sk_POLICYINFO_push(st, val) SKM_sk_push(POLICYINFO, (st), (val))\n#define sk_POLICYINFO_unshift(st, val) SKM_sk_unshift(POLICYINFO, (st), (val))\n#define sk_POLICYINFO_find(st, val) SKM_sk_find(POLICYINFO, (st), (val))\n#define sk_POLICYINFO_find_ex(st, val) SKM_sk_find_ex(POLICYINFO, (st), (val))\n#define sk_POLICYINFO_delete(st, i) SKM_sk_delete(POLICYINFO, (st), (i))\n#define sk_POLICYINFO_delete_ptr(st, ptr) SKM_sk_delete_ptr(POLICYINFO, (st), (ptr))\n#define sk_POLICYINFO_insert(st, val, i) SKM_sk_insert(POLICYINFO, (st), (val), (i))\n#define sk_POLICYINFO_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(POLICYINFO, (st), (cmp))\n#define sk_POLICYINFO_dup(st) SKM_sk_dup(POLICYINFO, st)\n#define sk_POLICYINFO_pop_free(st, free_func) SKM_sk_pop_free(POLICYINFO, (st), (free_func))\n#define sk_POLICYINFO_shift(st) SKM_sk_shift(POLICYINFO, (st))\n#define sk_POLICYINFO_pop(st) SKM_sk_pop(POLICYINFO, (st))\n#define sk_POLICYINFO_sort(st) SKM_sk_sort(POLICYINFO, (st))\n#define sk_POLICYINFO_is_sorted(st) SKM_sk_is_sorted(POLICYINFO, (st))\n\n#define sk_POLICYQUALINFO_new(st) SKM_sk_new(POLICYQUALINFO, (st))\n#define sk_POLICYQUALINFO_new_null() SKM_sk_new_null(POLICYQUALINFO)\n#define sk_POLICYQUALINFO_free(st) SKM_sk_free(POLICYQUALINFO, (st))\n#define sk_POLICYQUALINFO_num(st) SKM_sk_num(POLICYQUALINFO, (st))\n#define sk_POLICYQUALINFO_value(st, i) SKM_sk_value(POLICYQUALINFO, (st), (i))\n#define sk_POLICYQUALINFO_set(st, i, val) SKM_sk_set(POLICYQUALINFO, (st), (i), (val))\n#define sk_POLICYQUALINFO_zero(st) SKM_sk_zero(POLICYQUALINFO, (st))\n#define sk_POLICYQUALINFO_push(st, val) SKM_sk_push(POLICYQUALINFO, (st), (val))\n#define sk_POLICYQUALINFO_unshift(st, val) SKM_sk_unshift(POLICYQUALINFO, (st), (val))\n#define sk_POLICYQUALINFO_find(st, val) SKM_sk_find(POLICYQUALINFO, (st), (val))\n#define sk_POLICYQUALINFO_find_ex(st, val) SKM_sk_find_ex(POLICYQUALINFO, (st), (val))\n#define sk_POLICYQUALINFO_delete(st, i) SKM_sk_delete(POLICYQUALINFO, (st), (i))\n#define sk_POLICYQUALINFO_delete_ptr(st, ptr) SKM_sk_delete_ptr(POLICYQUALINFO, (st), (ptr))\n#define sk_POLICYQUALINFO_insert(st, val, i) SKM_sk_insert(POLICYQUALINFO, (st), (val), (i))\n#define sk_POLICYQUALINFO_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(POLICYQUALINFO, (st), (cmp))\n#define sk_POLICYQUALINFO_dup(st) SKM_sk_dup(POLICYQUALINFO, st)\n#define sk_POLICYQUALINFO_pop_free(st, free_func) SKM_sk_pop_free(POLICYQUALINFO, (st), (free_func))\n#define sk_POLICYQUALINFO_shift(st) SKM_sk_shift(POLICYQUALINFO, (st))\n#define sk_POLICYQUALINFO_pop(st) SKM_sk_pop(POLICYQUALINFO, (st))\n#define sk_POLICYQUALINFO_sort(st) SKM_sk_sort(POLICYQUALINFO, (st))\n#define sk_POLICYQUALINFO_is_sorted(st) SKM_sk_is_sorted(POLICYQUALINFO, (st))\n\n#define sk_POLICY_MAPPING_new(st) SKM_sk_new(POLICY_MAPPING, (st))\n#define sk_POLICY_MAPPING_new_null() SKM_sk_new_null(POLICY_MAPPING)\n#define sk_POLICY_MAPPING_free(st) SKM_sk_free(POLICY_MAPPING, (st))\n#define sk_POLICY_MAPPING_num(st) SKM_sk_num(POLICY_MAPPING, (st))\n#define sk_POLICY_MAPPING_value(st, i) SKM_sk_value(POLICY_MAPPING, (st), (i))\n#define sk_POLICY_MAPPING_set(st, i, val) SKM_sk_set(POLICY_MAPPING, (st), (i), (val))\n#define sk_POLICY_MAPPING_zero(st) SKM_sk_zero(POLICY_MAPPING, (st))\n#define sk_POLICY_MAPPING_push(st, val) SKM_sk_push(POLICY_MAPPING, (st), (val))\n#define sk_POLICY_MAPPING_unshift(st, val) SKM_sk_unshift(POLICY_MAPPING, (st), (val))\n#define sk_POLICY_MAPPING_find(st, val) SKM_sk_find(POLICY_MAPPING, (st), (val))\n#define sk_POLICY_MAPPING_find_ex(st, val) SKM_sk_find_ex(POLICY_MAPPING, (st), (val))\n#define sk_POLICY_MAPPING_delete(st, i) SKM_sk_delete(POLICY_MAPPING, (st), (i))\n#define sk_POLICY_MAPPING_delete_ptr(st, ptr) SKM_sk_delete_ptr(POLICY_MAPPING, (st), (ptr))\n#define sk_POLICY_MAPPING_insert(st, val, i) SKM_sk_insert(POLICY_MAPPING, (st), (val), (i))\n#define sk_POLICY_MAPPING_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(POLICY_MAPPING, (st), (cmp))\n#define sk_POLICY_MAPPING_dup(st) SKM_sk_dup(POLICY_MAPPING, st)\n#define sk_POLICY_MAPPING_pop_free(st, free_func) SKM_sk_pop_free(POLICY_MAPPING, (st), (free_func))\n#define sk_POLICY_MAPPING_shift(st) SKM_sk_shift(POLICY_MAPPING, (st))\n#define sk_POLICY_MAPPING_pop(st) SKM_sk_pop(POLICY_MAPPING, (st))\n#define sk_POLICY_MAPPING_sort(st) SKM_sk_sort(POLICY_MAPPING, (st))\n#define sk_POLICY_MAPPING_is_sorted(st) SKM_sk_is_sorted(POLICY_MAPPING, (st))\n\n#define sk_SSL_CIPHER_new(st) SKM_sk_new(SSL_CIPHER, (st))\n#define sk_SSL_CIPHER_new_null() SKM_sk_new_null(SSL_CIPHER)\n#define sk_SSL_CIPHER_free(st) SKM_sk_free(SSL_CIPHER, (st))\n#define sk_SSL_CIPHER_num(st) SKM_sk_num(SSL_CIPHER, (st))\n#define sk_SSL_CIPHER_value(st, i) SKM_sk_value(SSL_CIPHER, (st), (i))\n#define sk_SSL_CIPHER_set(st, i, val) SKM_sk_set(SSL_CIPHER, (st), (i), (val))\n#define sk_SSL_CIPHER_zero(st) SKM_sk_zero(SSL_CIPHER, (st))\n#define sk_SSL_CIPHER_push(st, val) SKM_sk_push(SSL_CIPHER, (st), (val))\n#define sk_SSL_CIPHER_unshift(st, val) SKM_sk_unshift(SSL_CIPHER, (st), (val))\n#define sk_SSL_CIPHER_find(st, val) SKM_sk_find(SSL_CIPHER, (st), (val))\n#define sk_SSL_CIPHER_find_ex(st, val) SKM_sk_find_ex(SSL_CIPHER, (st), (val))\n#define sk_SSL_CIPHER_delete(st, i) SKM_sk_delete(SSL_CIPHER, (st), (i))\n#define sk_SSL_CIPHER_delete_ptr(st, ptr) SKM_sk_delete_ptr(SSL_CIPHER, (st), (ptr))\n#define sk_SSL_CIPHER_insert(st, val, i) SKM_sk_insert(SSL_CIPHER, (st), (val), (i))\n#define sk_SSL_CIPHER_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(SSL_CIPHER, (st), (cmp))\n#define sk_SSL_CIPHER_dup(st) SKM_sk_dup(SSL_CIPHER, st)\n#define sk_SSL_CIPHER_pop_free(st, free_func) SKM_sk_pop_free(SSL_CIPHER, (st), (free_func))\n#define sk_SSL_CIPHER_shift(st) SKM_sk_shift(SSL_CIPHER, (st))\n#define sk_SSL_CIPHER_pop(st) SKM_sk_pop(SSL_CIPHER, (st))\n#define sk_SSL_CIPHER_sort(st) SKM_sk_sort(SSL_CIPHER, (st))\n#define sk_SSL_CIPHER_is_sorted(st) SKM_sk_is_sorted(SSL_CIPHER, (st))\n\n#define sk_SSL_COMP_new(st) SKM_sk_new(SSL_COMP, (st))\n#define sk_SSL_COMP_new_null() SKM_sk_new_null(SSL_COMP)\n#define sk_SSL_COMP_free(st) SKM_sk_free(SSL_COMP, (st))\n#define sk_SSL_COMP_num(st) SKM_sk_num(SSL_COMP, (st))\n#define sk_SSL_COMP_value(st, i) SKM_sk_value(SSL_COMP, (st), (i))\n#define sk_SSL_COMP_set(st, i, val) SKM_sk_set(SSL_COMP, (st), (i), (val))\n#define sk_SSL_COMP_zero(st) SKM_sk_zero(SSL_COMP, (st))\n#define sk_SSL_COMP_push(st, val) SKM_sk_push(SSL_COMP, (st), (val))\n#define sk_SSL_COMP_unshift(st, val) SKM_sk_unshift(SSL_COMP, (st), (val))\n#define sk_SSL_COMP_find(st, val) SKM_sk_find(SSL_COMP, (st), (val))\n#define sk_SSL_COMP_find_ex(st, val) SKM_sk_find_ex(SSL_COMP, (st), (val))\n#define sk_SSL_COMP_delete(st, i) SKM_sk_delete(SSL_COMP, (st), (i))\n#define sk_SSL_COMP_delete_ptr(st, ptr) SKM_sk_delete_ptr(SSL_COMP, (st), (ptr))\n#define sk_SSL_COMP_insert(st, val, i) SKM_sk_insert(SSL_COMP, (st), (val), (i))\n#define sk_SSL_COMP_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(SSL_COMP, (st), (cmp))\n#define sk_SSL_COMP_dup(st) SKM_sk_dup(SSL_COMP, st)\n#define sk_SSL_COMP_pop_free(st, free_func) SKM_sk_pop_free(SSL_COMP, (st), (free_func))\n#define sk_SSL_COMP_shift(st) SKM_sk_shift(SSL_COMP, (st))\n#define sk_SSL_COMP_pop(st) SKM_sk_pop(SSL_COMP, (st))\n#define sk_SSL_COMP_sort(st) SKM_sk_sort(SSL_COMP, (st))\n#define sk_SSL_COMP_is_sorted(st) SKM_sk_is_sorted(SSL_COMP, (st))\n\n#define sk_STORE_OBJECT_new(st) SKM_sk_new(STORE_OBJECT, (st))\n#define sk_STORE_OBJECT_new_null() SKM_sk_new_null(STORE_OBJECT)\n#define sk_STORE_OBJECT_free(st) SKM_sk_free(STORE_OBJECT, (st))\n#define sk_STORE_OBJECT_num(st) SKM_sk_num(STORE_OBJECT, (st))\n#define sk_STORE_OBJECT_value(st, i) SKM_sk_value(STORE_OBJECT, (st), (i))\n#define sk_STORE_OBJECT_set(st, i, val) SKM_sk_set(STORE_OBJECT, (st), (i), (val))\n#define sk_STORE_OBJECT_zero(st) SKM_sk_zero(STORE_OBJECT, (st))\n#define sk_STORE_OBJECT_push(st, val) SKM_sk_push(STORE_OBJECT, (st), (val))\n#define sk_STORE_OBJECT_unshift(st, val) SKM_sk_unshift(STORE_OBJECT, (st), (val))\n#define sk_STORE_OBJECT_find(st, val) SKM_sk_find(STORE_OBJECT, (st), (val))\n#define sk_STORE_OBJECT_find_ex(st, val) SKM_sk_find_ex(STORE_OBJECT, (st), (val))\n#define sk_STORE_OBJECT_delete(st, i) SKM_sk_delete(STORE_OBJECT, (st), (i))\n#define sk_STORE_OBJECT_delete_ptr(st, ptr) SKM_sk_delete_ptr(STORE_OBJECT, (st), (ptr))\n#define sk_STORE_OBJECT_insert(st, val, i) SKM_sk_insert(STORE_OBJECT, (st), (val), (i))\n#define sk_STORE_OBJECT_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(STORE_OBJECT, (st), (cmp))\n#define sk_STORE_OBJECT_dup(st) SKM_sk_dup(STORE_OBJECT, st)\n#define sk_STORE_OBJECT_pop_free(st, free_func) SKM_sk_pop_free(STORE_OBJECT, (st), (free_func))\n#define sk_STORE_OBJECT_shift(st) SKM_sk_shift(STORE_OBJECT, (st))\n#define sk_STORE_OBJECT_pop(st) SKM_sk_pop(STORE_OBJECT, (st))\n#define sk_STORE_OBJECT_sort(st) SKM_sk_sort(STORE_OBJECT, (st))\n#define sk_STORE_OBJECT_is_sorted(st) SKM_sk_is_sorted(STORE_OBJECT, (st))\n\n#define sk_SXNETID_new(st) SKM_sk_new(SXNETID, (st))\n#define sk_SXNETID_new_null() SKM_sk_new_null(SXNETID)\n#define sk_SXNETID_free(st) SKM_sk_free(SXNETID, (st))\n#define sk_SXNETID_num(st) SKM_sk_num(SXNETID, (st))\n#define sk_SXNETID_value(st, i) SKM_sk_value(SXNETID, (st), (i))\n#define sk_SXNETID_set(st, i, val) SKM_sk_set(SXNETID, (st), (i), (val))\n#define sk_SXNETID_zero(st) SKM_sk_zero(SXNETID, (st))\n#define sk_SXNETID_push(st, val) SKM_sk_push(SXNETID, (st), (val))\n#define sk_SXNETID_unshift(st, val) SKM_sk_unshift(SXNETID, (st), (val))\n#define sk_SXNETID_find(st, val) SKM_sk_find(SXNETID, (st), (val))\n#define sk_SXNETID_find_ex(st, val) SKM_sk_find_ex(SXNETID, (st), (val))\n#define sk_SXNETID_delete(st, i) SKM_sk_delete(SXNETID, (st), (i))\n#define sk_SXNETID_delete_ptr(st, ptr) SKM_sk_delete_ptr(SXNETID, (st), (ptr))\n#define sk_SXNETID_insert(st, val, i) SKM_sk_insert(SXNETID, (st), (val), (i))\n#define sk_SXNETID_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(SXNETID, (st), (cmp))\n#define sk_SXNETID_dup(st) SKM_sk_dup(SXNETID, st)\n#define sk_SXNETID_pop_free(st, free_func) SKM_sk_pop_free(SXNETID, (st), (free_func))\n#define sk_SXNETID_shift(st) SKM_sk_shift(SXNETID, (st))\n#define sk_SXNETID_pop(st) SKM_sk_pop(SXNETID, (st))\n#define sk_SXNETID_sort(st) SKM_sk_sort(SXNETID, (st))\n#define sk_SXNETID_is_sorted(st) SKM_sk_is_sorted(SXNETID, (st))\n\n#define sk_UI_STRING_new(st) SKM_sk_new(UI_STRING, (st))\n#define sk_UI_STRING_new_null() SKM_sk_new_null(UI_STRING)\n#define sk_UI_STRING_free(st) SKM_sk_free(UI_STRING, (st))\n#define sk_UI_STRING_num(st) SKM_sk_num(UI_STRING, (st))\n#define sk_UI_STRING_value(st, i) SKM_sk_value(UI_STRING, (st), (i))\n#define sk_UI_STRING_set(st, i, val) SKM_sk_set(UI_STRING, (st), (i), (val))\n#define sk_UI_STRING_zero(st) SKM_sk_zero(UI_STRING, (st))\n#define sk_UI_STRING_push(st, val) SKM_sk_push(UI_STRING, (st), (val))\n#define sk_UI_STRING_unshift(st, val) SKM_sk_unshift(UI_STRING, (st), (val))\n#define sk_UI_STRING_find(st, val) SKM_sk_find(UI_STRING, (st), (val))\n#define sk_UI_STRING_find_ex(st, val) SKM_sk_find_ex(UI_STRING, (st), (val))\n#define sk_UI_STRING_delete(st, i) SKM_sk_delete(UI_STRING, (st), (i))\n#define sk_UI_STRING_delete_ptr(st, ptr) SKM_sk_delete_ptr(UI_STRING, (st), (ptr))\n#define sk_UI_STRING_insert(st, val, i) SKM_sk_insert(UI_STRING, (st), (val), (i))\n#define sk_UI_STRING_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(UI_STRING, (st), (cmp))\n#define sk_UI_STRING_dup(st) SKM_sk_dup(UI_STRING, st)\n#define sk_UI_STRING_pop_free(st, free_func) SKM_sk_pop_free(UI_STRING, (st), (free_func))\n#define sk_UI_STRING_shift(st) SKM_sk_shift(UI_STRING, (st))\n#define sk_UI_STRING_pop(st) SKM_sk_pop(UI_STRING, (st))\n#define sk_UI_STRING_sort(st) SKM_sk_sort(UI_STRING, (st))\n#define sk_UI_STRING_is_sorted(st) SKM_sk_is_sorted(UI_STRING, (st))\n\n#define sk_X509_new(st) SKM_sk_new(X509, (st))\n#define sk_X509_new_null() SKM_sk_new_null(X509)\n#define sk_X509_free(st) SKM_sk_free(X509, (st))\n#define sk_X509_num(st) SKM_sk_num(X509, (st))\n#define sk_X509_value(st, i) SKM_sk_value(X509, (st), (i))\n#define sk_X509_set(st, i, val) SKM_sk_set(X509, (st), (i), (val))\n#define sk_X509_zero(st) SKM_sk_zero(X509, (st))\n#define sk_X509_push(st, val) SKM_sk_push(X509, (st), (val))\n#define sk_X509_unshift(st, val) SKM_sk_unshift(X509, (st), (val))\n#define sk_X509_find(st, val) SKM_sk_find(X509, (st), (val))\n#define sk_X509_find_ex(st, val) SKM_sk_find_ex(X509, (st), (val))\n#define sk_X509_delete(st, i) SKM_sk_delete(X509, (st), (i))\n#define sk_X509_delete_ptr(st, ptr) SKM_sk_delete_ptr(X509, (st), (ptr))\n#define sk_X509_insert(st, val, i) SKM_sk_insert(X509, (st), (val), (i))\n#define sk_X509_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(X509, (st), (cmp))\n#define sk_X509_dup(st) SKM_sk_dup(X509, st)\n#define sk_X509_pop_free(st, free_func) SKM_sk_pop_free(X509, (st), (free_func))\n#define sk_X509_shift(st) SKM_sk_shift(X509, (st))\n#define sk_X509_pop(st) SKM_sk_pop(X509, (st))\n#define sk_X509_sort(st) SKM_sk_sort(X509, (st))\n#define sk_X509_is_sorted(st) SKM_sk_is_sorted(X509, (st))\n\n#define sk_X509V3_EXT_METHOD_new(st) SKM_sk_new(X509V3_EXT_METHOD, (st))\n#define sk_X509V3_EXT_METHOD_new_null() SKM_sk_new_null(X509V3_EXT_METHOD)\n#define sk_X509V3_EXT_METHOD_free(st) SKM_sk_free(X509V3_EXT_METHOD, (st))\n#define sk_X509V3_EXT_METHOD_num(st) SKM_sk_num(X509V3_EXT_METHOD, (st))\n#define sk_X509V3_EXT_METHOD_value(st, i) SKM_sk_value(X509V3_EXT_METHOD, (st), (i))\n#define sk_X509V3_EXT_METHOD_set(st, i, val) SKM_sk_set(X509V3_EXT_METHOD, (st), (i), (val))\n#define sk_X509V3_EXT_METHOD_zero(st) SKM_sk_zero(X509V3_EXT_METHOD, (st))\n#define sk_X509V3_EXT_METHOD_push(st, val) SKM_sk_push(X509V3_EXT_METHOD, (st), (val))\n#define sk_X509V3_EXT_METHOD_unshift(st, val) SKM_sk_unshift(X509V3_EXT_METHOD, (st), (val))\n#define sk_X509V3_EXT_METHOD_find(st, val) SKM_sk_find(X509V3_EXT_METHOD, (st), (val))\n#define sk_X509V3_EXT_METHOD_find_ex(st, val) SKM_sk_find_ex(X509V3_EXT_METHOD, (st), (val))\n#define sk_X509V3_EXT_METHOD_delete(st, i) SKM_sk_delete(X509V3_EXT_METHOD, (st), (i))\n#define sk_X509V3_EXT_METHOD_delete_ptr(st, ptr) SKM_sk_delete_ptr(X509V3_EXT_METHOD, (st), (ptr))\n#define sk_X509V3_EXT_METHOD_insert(st, val, i) SKM_sk_insert(X509V3_EXT_METHOD, (st), (val), (i))\n#define sk_X509V3_EXT_METHOD_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(X509V3_EXT_METHOD, (st), (cmp))\n#define sk_X509V3_EXT_METHOD_dup(st) SKM_sk_dup(X509V3_EXT_METHOD, st)\n#define sk_X509V3_EXT_METHOD_pop_free(st, free_func) SKM_sk_pop_free(X509V3_EXT_METHOD, (st), (free_func))\n#define sk_X509V3_EXT_METHOD_shift(st) SKM_sk_shift(X509V3_EXT_METHOD, (st))\n#define sk_X509V3_EXT_METHOD_pop(st) SKM_sk_pop(X509V3_EXT_METHOD, (st))\n#define sk_X509V3_EXT_METHOD_sort(st) SKM_sk_sort(X509V3_EXT_METHOD, (st))\n#define sk_X509V3_EXT_METHOD_is_sorted(st) SKM_sk_is_sorted(X509V3_EXT_METHOD, (st))\n\n#define sk_X509_ALGOR_new(st) SKM_sk_new(X509_ALGOR, (st))\n#define sk_X509_ALGOR_new_null() SKM_sk_new_null(X509_ALGOR)\n#define sk_X509_ALGOR_free(st) SKM_sk_free(X509_ALGOR, (st))\n#define sk_X509_ALGOR_num(st) SKM_sk_num(X509_ALGOR, (st))\n#define sk_X509_ALGOR_value(st, i) SKM_sk_value(X509_ALGOR, (st), (i))\n#define sk_X509_ALGOR_set(st, i, val) SKM_sk_set(X509_ALGOR, (st), (i), (val))\n#define sk_X509_ALGOR_zero(st) SKM_sk_zero(X509_ALGOR, (st))\n#define sk_X509_ALGOR_push(st, val) SKM_sk_push(X509_ALGOR, (st), (val))\n#define sk_X509_ALGOR_unshift(st, val) SKM_sk_unshift(X509_ALGOR, (st), (val))\n#define sk_X509_ALGOR_find(st, val) SKM_sk_find(X509_ALGOR, (st), (val))\n#define sk_X509_ALGOR_find_ex(st, val) SKM_sk_find_ex(X509_ALGOR, (st), (val))\n#define sk_X509_ALGOR_delete(st, i) SKM_sk_delete(X509_ALGOR, (st), (i))\n#define sk_X509_ALGOR_delete_ptr(st, ptr) SKM_sk_delete_ptr(X509_ALGOR, (st), (ptr))\n#define sk_X509_ALGOR_insert(st, val, i) SKM_sk_insert(X509_ALGOR, (st), (val), (i))\n#define sk_X509_ALGOR_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(X509_ALGOR, (st), (cmp))\n#define sk_X509_ALGOR_dup(st) SKM_sk_dup(X509_ALGOR, st)\n#define sk_X509_ALGOR_pop_free(st, free_func) SKM_sk_pop_free(X509_ALGOR, (st), (free_func))\n#define sk_X509_ALGOR_shift(st) SKM_sk_shift(X509_ALGOR, (st))\n#define sk_X509_ALGOR_pop(st) SKM_sk_pop(X509_ALGOR, (st))\n#define sk_X509_ALGOR_sort(st) SKM_sk_sort(X509_ALGOR, (st))\n#define sk_X509_ALGOR_is_sorted(st) SKM_sk_is_sorted(X509_ALGOR, (st))\n\n#define sk_X509_ATTRIBUTE_new(st) SKM_sk_new(X509_ATTRIBUTE, (st))\n#define sk_X509_ATTRIBUTE_new_null() SKM_sk_new_null(X509_ATTRIBUTE)\n#define sk_X509_ATTRIBUTE_free(st) SKM_sk_free(X509_ATTRIBUTE, (st))\n#define sk_X509_ATTRIBUTE_num(st) SKM_sk_num(X509_ATTRIBUTE, (st))\n#define sk_X509_ATTRIBUTE_value(st, i) SKM_sk_value(X509_ATTRIBUTE, (st), (i))\n#define sk_X509_ATTRIBUTE_set(st, i, val) SKM_sk_set(X509_ATTRIBUTE, (st), (i), (val))\n#define sk_X509_ATTRIBUTE_zero(st) SKM_sk_zero(X509_ATTRIBUTE, (st))\n#define sk_X509_ATTRIBUTE_push(st, val) SKM_sk_push(X509_ATTRIBUTE, (st), (val))\n#define sk_X509_ATTRIBUTE_unshift(st, val) SKM_sk_unshift(X509_ATTRIBUTE, (st), (val))\n#define sk_X509_ATTRIBUTE_find(st, val) SKM_sk_find(X509_ATTRIBUTE, (st), (val))\n#define sk_X509_ATTRIBUTE_find_ex(st, val) SKM_sk_find_ex(X509_ATTRIBUTE, (st), (val))\n#define sk_X509_ATTRIBUTE_delete(st, i) SKM_sk_delete(X509_ATTRIBUTE, (st), (i))\n#define sk_X509_ATTRIBUTE_delete_ptr(st, ptr) SKM_sk_delete_ptr(X509_ATTRIBUTE, (st), (ptr))\n#define sk_X509_ATTRIBUTE_insert(st, val, i) SKM_sk_insert(X509_ATTRIBUTE, (st), (val), (i))\n#define sk_X509_ATTRIBUTE_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(X509_ATTRIBUTE, (st), (cmp))\n#define sk_X509_ATTRIBUTE_dup(st) SKM_sk_dup(X509_ATTRIBUTE, st)\n#define sk_X509_ATTRIBUTE_pop_free(st, free_func) SKM_sk_pop_free(X509_ATTRIBUTE, (st), (free_func))\n#define sk_X509_ATTRIBUTE_shift(st) SKM_sk_shift(X509_ATTRIBUTE, (st))\n#define sk_X509_ATTRIBUTE_pop(st) SKM_sk_pop(X509_ATTRIBUTE, (st))\n#define sk_X509_ATTRIBUTE_sort(st) SKM_sk_sort(X509_ATTRIBUTE, (st))\n#define sk_X509_ATTRIBUTE_is_sorted(st) SKM_sk_is_sorted(X509_ATTRIBUTE, (st))\n\n#define sk_X509_CRL_new(st) SKM_sk_new(X509_CRL, (st))\n#define sk_X509_CRL_new_null() SKM_sk_new_null(X509_CRL)\n#define sk_X509_CRL_free(st) SKM_sk_free(X509_CRL, (st))\n#define sk_X509_CRL_num(st) SKM_sk_num(X509_CRL, (st))\n#define sk_X509_CRL_value(st, i) SKM_sk_value(X509_CRL, (st), (i))\n#define sk_X509_CRL_set(st, i, val) SKM_sk_set(X509_CRL, (st), (i), (val))\n#define sk_X509_CRL_zero(st) SKM_sk_zero(X509_CRL, (st))\n#define sk_X509_CRL_push(st, val) SKM_sk_push(X509_CRL, (st), (val))\n#define sk_X509_CRL_unshift(st, val) SKM_sk_unshift(X509_CRL, (st), (val))\n#define sk_X509_CRL_find(st, val) SKM_sk_find(X509_CRL, (st), (val))\n#define sk_X509_CRL_find_ex(st, val) SKM_sk_find_ex(X509_CRL, (st), (val))\n#define sk_X509_CRL_delete(st, i) SKM_sk_delete(X509_CRL, (st), (i))\n#define sk_X509_CRL_delete_ptr(st, ptr) SKM_sk_delete_ptr(X509_CRL, (st), (ptr))\n#define sk_X509_CRL_insert(st, val, i) SKM_sk_insert(X509_CRL, (st), (val), (i))\n#define sk_X509_CRL_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(X509_CRL, (st), (cmp))\n#define sk_X509_CRL_dup(st) SKM_sk_dup(X509_CRL, st)\n#define sk_X509_CRL_pop_free(st, free_func) SKM_sk_pop_free(X509_CRL, (st), (free_func))\n#define sk_X509_CRL_shift(st) SKM_sk_shift(X509_CRL, (st))\n#define sk_X509_CRL_pop(st) SKM_sk_pop(X509_CRL, (st))\n#define sk_X509_CRL_sort(st) SKM_sk_sort(X509_CRL, (st))\n#define sk_X509_CRL_is_sorted(st) SKM_sk_is_sorted(X509_CRL, (st))\n\n#define sk_X509_EXTENSION_new(st) SKM_sk_new(X509_EXTENSION, (st))\n#define sk_X509_EXTENSION_new_null() SKM_sk_new_null(X509_EXTENSION)\n#define sk_X509_EXTENSION_free(st) SKM_sk_free(X509_EXTENSION, (st))\n#define sk_X509_EXTENSION_num(st) SKM_sk_num(X509_EXTENSION, (st))\n#define sk_X509_EXTENSION_value(st, i) SKM_sk_value(X509_EXTENSION, (st), (i))\n#define sk_X509_EXTENSION_set(st, i, val) SKM_sk_set(X509_EXTENSION, (st), (i), (val))\n#define sk_X509_EXTENSION_zero(st) SKM_sk_zero(X509_EXTENSION, (st))\n#define sk_X509_EXTENSION_push(st, val) SKM_sk_push(X509_EXTENSION, (st), (val))\n#define sk_X509_EXTENSION_unshift(st, val) SKM_sk_unshift(X509_EXTENSION, (st), (val))\n#define sk_X509_EXTENSION_find(st, val) SKM_sk_find(X509_EXTENSION, (st), (val))\n#define sk_X509_EXTENSION_find_ex(st, val) SKM_sk_find_ex(X509_EXTENSION, (st), (val))\n#define sk_X509_EXTENSION_delete(st, i) SKM_sk_delete(X509_EXTENSION, (st), (i))\n#define sk_X509_EXTENSION_delete_ptr(st, ptr) SKM_sk_delete_ptr(X509_EXTENSION, (st), (ptr))\n#define sk_X509_EXTENSION_insert(st, val, i) SKM_sk_insert(X509_EXTENSION, (st), (val), (i))\n#define sk_X509_EXTENSION_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(X509_EXTENSION, (st), (cmp))\n#define sk_X509_EXTENSION_dup(st) SKM_sk_dup(X509_EXTENSION, st)\n#define sk_X509_EXTENSION_pop_free(st, free_func) SKM_sk_pop_free(X509_EXTENSION, (st), (free_func))\n#define sk_X509_EXTENSION_shift(st) SKM_sk_shift(X509_EXTENSION, (st))\n#define sk_X509_EXTENSION_pop(st) SKM_sk_pop(X509_EXTENSION, (st))\n#define sk_X509_EXTENSION_sort(st) SKM_sk_sort(X509_EXTENSION, (st))\n#define sk_X509_EXTENSION_is_sorted(st) SKM_sk_is_sorted(X509_EXTENSION, (st))\n\n#define sk_X509_INFO_new(st) SKM_sk_new(X509_INFO, (st))\n#define sk_X509_INFO_new_null() SKM_sk_new_null(X509_INFO)\n#define sk_X509_INFO_free(st) SKM_sk_free(X509_INFO, (st))\n#define sk_X509_INFO_num(st) SKM_sk_num(X509_INFO, (st))\n#define sk_X509_INFO_value(st, i) SKM_sk_value(X509_INFO, (st), (i))\n#define sk_X509_INFO_set(st, i, val) SKM_sk_set(X509_INFO, (st), (i), (val))\n#define sk_X509_INFO_zero(st) SKM_sk_zero(X509_INFO, (st))\n#define sk_X509_INFO_push(st, val) SKM_sk_push(X509_INFO, (st), (val))\n#define sk_X509_INFO_unshift(st, val) SKM_sk_unshift(X509_INFO, (st), (val))\n#define sk_X509_INFO_find(st, val) SKM_sk_find(X509_INFO, (st), (val))\n#define sk_X509_INFO_find_ex(st, val) SKM_sk_find_ex(X509_INFO, (st), (val))\n#define sk_X509_INFO_delete(st, i) SKM_sk_delete(X509_INFO, (st), (i))\n#define sk_X509_INFO_delete_ptr(st, ptr) SKM_sk_delete_ptr(X509_INFO, (st), (ptr))\n#define sk_X509_INFO_insert(st, val, i) SKM_sk_insert(X509_INFO, (st), (val), (i))\n#define sk_X509_INFO_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(X509_INFO, (st), (cmp))\n#define sk_X509_INFO_dup(st) SKM_sk_dup(X509_INFO, st)\n#define sk_X509_INFO_pop_free(st, free_func) SKM_sk_pop_free(X509_INFO, (st), (free_func))\n#define sk_X509_INFO_shift(st) SKM_sk_shift(X509_INFO, (st))\n#define sk_X509_INFO_pop(st) SKM_sk_pop(X509_INFO, (st))\n#define sk_X509_INFO_sort(st) SKM_sk_sort(X509_INFO, (st))\n#define sk_X509_INFO_is_sorted(st) SKM_sk_is_sorted(X509_INFO, (st))\n\n#define sk_X509_LOOKUP_new(st) SKM_sk_new(X509_LOOKUP, (st))\n#define sk_X509_LOOKUP_new_null() SKM_sk_new_null(X509_LOOKUP)\n#define sk_X509_LOOKUP_free(st) SKM_sk_free(X509_LOOKUP, (st))\n#define sk_X509_LOOKUP_num(st) SKM_sk_num(X509_LOOKUP, (st))\n#define sk_X509_LOOKUP_value(st, i) SKM_sk_value(X509_LOOKUP, (st), (i))\n#define sk_X509_LOOKUP_set(st, i, val) SKM_sk_set(X509_LOOKUP, (st), (i), (val))\n#define sk_X509_LOOKUP_zero(st) SKM_sk_zero(X509_LOOKUP, (st))\n#define sk_X509_LOOKUP_push(st, val) SKM_sk_push(X509_LOOKUP, (st), (val))\n#define sk_X509_LOOKUP_unshift(st, val) SKM_sk_unshift(X509_LOOKUP, (st), (val))\n#define sk_X509_LOOKUP_find(st, val) SKM_sk_find(X509_LOOKUP, (st), (val))\n#define sk_X509_LOOKUP_find_ex(st, val) SKM_sk_find_ex(X509_LOOKUP, (st), (val))\n#define sk_X509_LOOKUP_delete(st, i) SKM_sk_delete(X509_LOOKUP, (st), (i))\n#define sk_X509_LOOKUP_delete_ptr(st, ptr) SKM_sk_delete_ptr(X509_LOOKUP, (st), (ptr))\n#define sk_X509_LOOKUP_insert(st, val, i) SKM_sk_insert(X509_LOOKUP, (st), (val), (i))\n#define sk_X509_LOOKUP_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(X509_LOOKUP, (st), (cmp))\n#define sk_X509_LOOKUP_dup(st) SKM_sk_dup(X509_LOOKUP, st)\n#define sk_X509_LOOKUP_pop_free(st, free_func) SKM_sk_pop_free(X509_LOOKUP, (st), (free_func))\n#define sk_X509_LOOKUP_shift(st) SKM_sk_shift(X509_LOOKUP, (st))\n#define sk_X509_LOOKUP_pop(st) SKM_sk_pop(X509_LOOKUP, (st))\n#define sk_X509_LOOKUP_sort(st) SKM_sk_sort(X509_LOOKUP, (st))\n#define sk_X509_LOOKUP_is_sorted(st) SKM_sk_is_sorted(X509_LOOKUP, (st))\n\n#define sk_X509_NAME_new(st) SKM_sk_new(X509_NAME, (st))\n#define sk_X509_NAME_new_null() SKM_sk_new_null(X509_NAME)\n#define sk_X509_NAME_free(st) SKM_sk_free(X509_NAME, (st))\n#define sk_X509_NAME_num(st) SKM_sk_num(X509_NAME, (st))\n#define sk_X509_NAME_value(st, i) SKM_sk_value(X509_NAME, (st), (i))\n#define sk_X509_NAME_set(st, i, val) SKM_sk_set(X509_NAME, (st), (i), (val))\n#define sk_X509_NAME_zero(st) SKM_sk_zero(X509_NAME, (st))\n#define sk_X509_NAME_push(st, val) SKM_sk_push(X509_NAME, (st), (val))\n#define sk_X509_NAME_unshift(st, val) SKM_sk_unshift(X509_NAME, (st), (val))\n#define sk_X509_NAME_find(st, val) SKM_sk_find(X509_NAME, (st), (val))\n#define sk_X509_NAME_find_ex(st, val) SKM_sk_find_ex(X509_NAME, (st), (val))\n#define sk_X509_NAME_delete(st, i) SKM_sk_delete(X509_NAME, (st), (i))\n#define sk_X509_NAME_delete_ptr(st, ptr) SKM_sk_delete_ptr(X509_NAME, (st), (ptr))\n#define sk_X509_NAME_insert(st, val, i) SKM_sk_insert(X509_NAME, (st), (val), (i))\n#define sk_X509_NAME_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(X509_NAME, (st), (cmp))\n#define sk_X509_NAME_dup(st) SKM_sk_dup(X509_NAME, st)\n#define sk_X509_NAME_pop_free(st, free_func) SKM_sk_pop_free(X509_NAME, (st), (free_func))\n#define sk_X509_NAME_shift(st) SKM_sk_shift(X509_NAME, (st))\n#define sk_X509_NAME_pop(st) SKM_sk_pop(X509_NAME, (st))\n#define sk_X509_NAME_sort(st) SKM_sk_sort(X509_NAME, (st))\n#define sk_X509_NAME_is_sorted(st) SKM_sk_is_sorted(X509_NAME, (st))\n\n#define sk_X509_NAME_ENTRY_new(st) SKM_sk_new(X509_NAME_ENTRY, (st))\n#define sk_X509_NAME_ENTRY_new_null() SKM_sk_new_null(X509_NAME_ENTRY)\n#define sk_X509_NAME_ENTRY_free(st) SKM_sk_free(X509_NAME_ENTRY, (st))\n#define sk_X509_NAME_ENTRY_num(st) SKM_sk_num(X509_NAME_ENTRY, (st))\n#define sk_X509_NAME_ENTRY_value(st, i) SKM_sk_value(X509_NAME_ENTRY, (st), (i))\n#define sk_X509_NAME_ENTRY_set(st, i, val) SKM_sk_set(X509_NAME_ENTRY, (st), (i), (val))\n#define sk_X509_NAME_ENTRY_zero(st) SKM_sk_zero(X509_NAME_ENTRY, (st))\n#define sk_X509_NAME_ENTRY_push(st, val) SKM_sk_push(X509_NAME_ENTRY, (st), (val))\n#define sk_X509_NAME_ENTRY_unshift(st, val) SKM_sk_unshift(X509_NAME_ENTRY, (st), (val))\n#define sk_X509_NAME_ENTRY_find(st, val) SKM_sk_find(X509_NAME_ENTRY, (st), (val))\n#define sk_X509_NAME_ENTRY_find_ex(st, val) SKM_sk_find_ex(X509_NAME_ENTRY, (st), (val))\n#define sk_X509_NAME_ENTRY_delete(st, i) SKM_sk_delete(X509_NAME_ENTRY, (st), (i))\n#define sk_X509_NAME_ENTRY_delete_ptr(st, ptr) SKM_sk_delete_ptr(X509_NAME_ENTRY, (st), (ptr))\n#define sk_X509_NAME_ENTRY_insert(st, val, i) SKM_sk_insert(X509_NAME_ENTRY, (st), (val), (i))\n#define sk_X509_NAME_ENTRY_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(X509_NAME_ENTRY, (st), (cmp))\n#define sk_X509_NAME_ENTRY_dup(st) SKM_sk_dup(X509_NAME_ENTRY, st)\n#define sk_X509_NAME_ENTRY_pop_free(st, free_func) SKM_sk_pop_free(X509_NAME_ENTRY, (st), (free_func))\n#define sk_X509_NAME_ENTRY_shift(st) SKM_sk_shift(X509_NAME_ENTRY, (st))\n#define sk_X509_NAME_ENTRY_pop(st) SKM_sk_pop(X509_NAME_ENTRY, (st))\n#define sk_X509_NAME_ENTRY_sort(st) SKM_sk_sort(X509_NAME_ENTRY, (st))\n#define sk_X509_NAME_ENTRY_is_sorted(st) SKM_sk_is_sorted(X509_NAME_ENTRY, (st))\n\n#define sk_X509_OBJECT_new(st) SKM_sk_new(X509_OBJECT, (st))\n#define sk_X509_OBJECT_new_null() SKM_sk_new_null(X509_OBJECT)\n#define sk_X509_OBJECT_free(st) SKM_sk_free(X509_OBJECT, (st))\n#define sk_X509_OBJECT_num(st) SKM_sk_num(X509_OBJECT, (st))\n#define sk_X509_OBJECT_value(st, i) SKM_sk_value(X509_OBJECT, (st), (i))\n#define sk_X509_OBJECT_set(st, i, val) SKM_sk_set(X509_OBJECT, (st), (i), (val))\n#define sk_X509_OBJECT_zero(st) SKM_sk_zero(X509_OBJECT, (st))\n#define sk_X509_OBJECT_push(st, val) SKM_sk_push(X509_OBJECT, (st), (val))\n#define sk_X509_OBJECT_unshift(st, val) SKM_sk_unshift(X509_OBJECT, (st), (val))\n#define sk_X509_OBJECT_find(st, val) SKM_sk_find(X509_OBJECT, (st), (val))\n#define sk_X509_OBJECT_find_ex(st, val) SKM_sk_find_ex(X509_OBJECT, (st), (val))\n#define sk_X509_OBJECT_delete(st, i) SKM_sk_delete(X509_OBJECT, (st), (i))\n#define sk_X509_OBJECT_delete_ptr(st, ptr) SKM_sk_delete_ptr(X509_OBJECT, (st), (ptr))\n#define sk_X509_OBJECT_insert(st, val, i) SKM_sk_insert(X509_OBJECT, (st), (val), (i))\n#define sk_X509_OBJECT_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(X509_OBJECT, (st), (cmp))\n#define sk_X509_OBJECT_dup(st) SKM_sk_dup(X509_OBJECT, st)\n#define sk_X509_OBJECT_pop_free(st, free_func) SKM_sk_pop_free(X509_OBJECT, (st), (free_func))\n#define sk_X509_OBJECT_shift(st) SKM_sk_shift(X509_OBJECT, (st))\n#define sk_X509_OBJECT_pop(st) SKM_sk_pop(X509_OBJECT, (st))\n#define sk_X509_OBJECT_sort(st) SKM_sk_sort(X509_OBJECT, (st))\n#define sk_X509_OBJECT_is_sorted(st) SKM_sk_is_sorted(X509_OBJECT, (st))\n\n#define sk_X509_POLICY_DATA_new(st) SKM_sk_new(X509_POLICY_DATA, (st))\n#define sk_X509_POLICY_DATA_new_null() SKM_sk_new_null(X509_POLICY_DATA)\n#define sk_X509_POLICY_DATA_free(st) SKM_sk_free(X509_POLICY_DATA, (st))\n#define sk_X509_POLICY_DATA_num(st) SKM_sk_num(X509_POLICY_DATA, (st))\n#define sk_X509_POLICY_DATA_value(st, i) SKM_sk_value(X509_POLICY_DATA, (st), (i))\n#define sk_X509_POLICY_DATA_set(st, i, val) SKM_sk_set(X509_POLICY_DATA, (st), (i), (val))\n#define sk_X509_POLICY_DATA_zero(st) SKM_sk_zero(X509_POLICY_DATA, (st))\n#define sk_X509_POLICY_DATA_push(st, val) SKM_sk_push(X509_POLICY_DATA, (st), (val))\n#define sk_X509_POLICY_DATA_unshift(st, val) SKM_sk_unshift(X509_POLICY_DATA, (st), (val))\n#define sk_X509_POLICY_DATA_find(st, val) SKM_sk_find(X509_POLICY_DATA, (st), (val))\n#define sk_X509_POLICY_DATA_find_ex(st, val) SKM_sk_find_ex(X509_POLICY_DATA, (st), (val))\n#define sk_X509_POLICY_DATA_delete(st, i) SKM_sk_delete(X509_POLICY_DATA, (st), (i))\n#define sk_X509_POLICY_DATA_delete_ptr(st, ptr) SKM_sk_delete_ptr(X509_POLICY_DATA, (st), (ptr))\n#define sk_X509_POLICY_DATA_insert(st, val, i) SKM_sk_insert(X509_POLICY_DATA, (st), (val), (i))\n#define sk_X509_POLICY_DATA_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(X509_POLICY_DATA, (st), (cmp))\n#define sk_X509_POLICY_DATA_dup(st) SKM_sk_dup(X509_POLICY_DATA, st)\n#define sk_X509_POLICY_DATA_pop_free(st, free_func) SKM_sk_pop_free(X509_POLICY_DATA, (st), (free_func))\n#define sk_X509_POLICY_DATA_shift(st) SKM_sk_shift(X509_POLICY_DATA, (st))\n#define sk_X509_POLICY_DATA_pop(st) SKM_sk_pop(X509_POLICY_DATA, (st))\n#define sk_X509_POLICY_DATA_sort(st) SKM_sk_sort(X509_POLICY_DATA, (st))\n#define sk_X509_POLICY_DATA_is_sorted(st) SKM_sk_is_sorted(X509_POLICY_DATA, (st))\n\n#define sk_X509_POLICY_NODE_new(st) SKM_sk_new(X509_POLICY_NODE, (st))\n#define sk_X509_POLICY_NODE_new_null() SKM_sk_new_null(X509_POLICY_NODE)\n#define sk_X509_POLICY_NODE_free(st) SKM_sk_free(X509_POLICY_NODE, (st))\n#define sk_X509_POLICY_NODE_num(st) SKM_sk_num(X509_POLICY_NODE, (st))\n#define sk_X509_POLICY_NODE_value(st, i) SKM_sk_value(X509_POLICY_NODE, (st), (i))\n#define sk_X509_POLICY_NODE_set(st, i, val) SKM_sk_set(X509_POLICY_NODE, (st), (i), (val))\n#define sk_X509_POLICY_NODE_zero(st) SKM_sk_zero(X509_POLICY_NODE, (st))\n#define sk_X509_POLICY_NODE_push(st, val) SKM_sk_push(X509_POLICY_NODE, (st), (val))\n#define sk_X509_POLICY_NODE_unshift(st, val) SKM_sk_unshift(X509_POLICY_NODE, (st), (val))\n#define sk_X509_POLICY_NODE_find(st, val) SKM_sk_find(X509_POLICY_NODE, (st), (val))\n#define sk_X509_POLICY_NODE_find_ex(st, val) SKM_sk_find_ex(X509_POLICY_NODE, (st), (val))\n#define sk_X509_POLICY_NODE_delete(st, i) SKM_sk_delete(X509_POLICY_NODE, (st), (i))\n#define sk_X509_POLICY_NODE_delete_ptr(st, ptr) SKM_sk_delete_ptr(X509_POLICY_NODE, (st), (ptr))\n#define sk_X509_POLICY_NODE_insert(st, val, i) SKM_sk_insert(X509_POLICY_NODE, (st), (val), (i))\n#define sk_X509_POLICY_NODE_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(X509_POLICY_NODE, (st), (cmp))\n#define sk_X509_POLICY_NODE_dup(st) SKM_sk_dup(X509_POLICY_NODE, st)\n#define sk_X509_POLICY_NODE_pop_free(st, free_func) SKM_sk_pop_free(X509_POLICY_NODE, (st), (free_func))\n#define sk_X509_POLICY_NODE_shift(st) SKM_sk_shift(X509_POLICY_NODE, (st))\n#define sk_X509_POLICY_NODE_pop(st) SKM_sk_pop(X509_POLICY_NODE, (st))\n#define sk_X509_POLICY_NODE_sort(st) SKM_sk_sort(X509_POLICY_NODE, (st))\n#define sk_X509_POLICY_NODE_is_sorted(st) SKM_sk_is_sorted(X509_POLICY_NODE, (st))\n\n#define sk_X509_POLICY_REF_new(st) SKM_sk_new(X509_POLICY_REF, (st))\n#define sk_X509_POLICY_REF_new_null() SKM_sk_new_null(X509_POLICY_REF)\n#define sk_X509_POLICY_REF_free(st) SKM_sk_free(X509_POLICY_REF, (st))\n#define sk_X509_POLICY_REF_num(st) SKM_sk_num(X509_POLICY_REF, (st))\n#define sk_X509_POLICY_REF_value(st, i) SKM_sk_value(X509_POLICY_REF, (st), (i))\n#define sk_X509_POLICY_REF_set(st, i, val) SKM_sk_set(X509_POLICY_REF, (st), (i), (val))\n#define sk_X509_POLICY_REF_zero(st) SKM_sk_zero(X509_POLICY_REF, (st))\n#define sk_X509_POLICY_REF_push(st, val) SKM_sk_push(X509_POLICY_REF, (st), (val))\n#define sk_X509_POLICY_REF_unshift(st, val) SKM_sk_unshift(X509_POLICY_REF, (st), (val))\n#define sk_X509_POLICY_REF_find(st, val) SKM_sk_find(X509_POLICY_REF, (st), (val))\n#define sk_X509_POLICY_REF_find_ex(st, val) SKM_sk_find_ex(X509_POLICY_REF, (st), (val))\n#define sk_X509_POLICY_REF_delete(st, i) SKM_sk_delete(X509_POLICY_REF, (st), (i))\n#define sk_X509_POLICY_REF_delete_ptr(st, ptr) SKM_sk_delete_ptr(X509_POLICY_REF, (st), (ptr))\n#define sk_X509_POLICY_REF_insert(st, val, i) SKM_sk_insert(X509_POLICY_REF, (st), (val), (i))\n#define sk_X509_POLICY_REF_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(X509_POLICY_REF, (st), (cmp))\n#define sk_X509_POLICY_REF_dup(st) SKM_sk_dup(X509_POLICY_REF, st)\n#define sk_X509_POLICY_REF_pop_free(st, free_func) SKM_sk_pop_free(X509_POLICY_REF, (st), (free_func))\n#define sk_X509_POLICY_REF_shift(st) SKM_sk_shift(X509_POLICY_REF, (st))\n#define sk_X509_POLICY_REF_pop(st) SKM_sk_pop(X509_POLICY_REF, (st))\n#define sk_X509_POLICY_REF_sort(st) SKM_sk_sort(X509_POLICY_REF, (st))\n#define sk_X509_POLICY_REF_is_sorted(st) SKM_sk_is_sorted(X509_POLICY_REF, (st))\n\n#define sk_X509_PURPOSE_new(st) SKM_sk_new(X509_PURPOSE, (st))\n#define sk_X509_PURPOSE_new_null() SKM_sk_new_null(X509_PURPOSE)\n#define sk_X509_PURPOSE_free(st) SKM_sk_free(X509_PURPOSE, (st))\n#define sk_X509_PURPOSE_num(st) SKM_sk_num(X509_PURPOSE, (st))\n#define sk_X509_PURPOSE_value(st, i) SKM_sk_value(X509_PURPOSE, (st), (i))\n#define sk_X509_PURPOSE_set(st, i, val) SKM_sk_set(X509_PURPOSE, (st), (i), (val))\n#define sk_X509_PURPOSE_zero(st) SKM_sk_zero(X509_PURPOSE, (st))\n#define sk_X509_PURPOSE_push(st, val) SKM_sk_push(X509_PURPOSE, (st), (val))\n#define sk_X509_PURPOSE_unshift(st, val) SKM_sk_unshift(X509_PURPOSE, (st), (val))\n#define sk_X509_PURPOSE_find(st, val) SKM_sk_find(X509_PURPOSE, (st), (val))\n#define sk_X509_PURPOSE_find_ex(st, val) SKM_sk_find_ex(X509_PURPOSE, (st), (val))\n#define sk_X509_PURPOSE_delete(st, i) SKM_sk_delete(X509_PURPOSE, (st), (i))\n#define sk_X509_PURPOSE_delete_ptr(st, ptr) SKM_sk_delete_ptr(X509_PURPOSE, (st), (ptr))\n#define sk_X509_PURPOSE_insert(st, val, i) SKM_sk_insert(X509_PURPOSE, (st), (val), (i))\n#define sk_X509_PURPOSE_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(X509_PURPOSE, (st), (cmp))\n#define sk_X509_PURPOSE_dup(st) SKM_sk_dup(X509_PURPOSE, st)\n#define sk_X509_PURPOSE_pop_free(st, free_func) SKM_sk_pop_free(X509_PURPOSE, (st), (free_func))\n#define sk_X509_PURPOSE_shift(st) SKM_sk_shift(X509_PURPOSE, (st))\n#define sk_X509_PURPOSE_pop(st) SKM_sk_pop(X509_PURPOSE, (st))\n#define sk_X509_PURPOSE_sort(st) SKM_sk_sort(X509_PURPOSE, (st))\n#define sk_X509_PURPOSE_is_sorted(st) SKM_sk_is_sorted(X509_PURPOSE, (st))\n\n#define sk_X509_REVOKED_new(st) SKM_sk_new(X509_REVOKED, (st))\n#define sk_X509_REVOKED_new_null() SKM_sk_new_null(X509_REVOKED)\n#define sk_X509_REVOKED_free(st) SKM_sk_free(X509_REVOKED, (st))\n#define sk_X509_REVOKED_num(st) SKM_sk_num(X509_REVOKED, (st))\n#define sk_X509_REVOKED_value(st, i) SKM_sk_value(X509_REVOKED, (st), (i))\n#define sk_X509_REVOKED_set(st, i, val) SKM_sk_set(X509_REVOKED, (st), (i), (val))\n#define sk_X509_REVOKED_zero(st) SKM_sk_zero(X509_REVOKED, (st))\n#define sk_X509_REVOKED_push(st, val) SKM_sk_push(X509_REVOKED, (st), (val))\n#define sk_X509_REVOKED_unshift(st, val) SKM_sk_unshift(X509_REVOKED, (st), (val))\n#define sk_X509_REVOKED_find(st, val) SKM_sk_find(X509_REVOKED, (st), (val))\n#define sk_X509_REVOKED_find_ex(st, val) SKM_sk_find_ex(X509_REVOKED, (st), (val))\n#define sk_X509_REVOKED_delete(st, i) SKM_sk_delete(X509_REVOKED, (st), (i))\n#define sk_X509_REVOKED_delete_ptr(st, ptr) SKM_sk_delete_ptr(X509_REVOKED, (st), (ptr))\n#define sk_X509_REVOKED_insert(st, val, i) SKM_sk_insert(X509_REVOKED, (st), (val), (i))\n#define sk_X509_REVOKED_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(X509_REVOKED, (st), (cmp))\n#define sk_X509_REVOKED_dup(st) SKM_sk_dup(X509_REVOKED, st)\n#define sk_X509_REVOKED_pop_free(st, free_func) SKM_sk_pop_free(X509_REVOKED, (st), (free_func))\n#define sk_X509_REVOKED_shift(st) SKM_sk_shift(X509_REVOKED, (st))\n#define sk_X509_REVOKED_pop(st) SKM_sk_pop(X509_REVOKED, (st))\n#define sk_X509_REVOKED_sort(st) SKM_sk_sort(X509_REVOKED, (st))\n#define sk_X509_REVOKED_is_sorted(st) SKM_sk_is_sorted(X509_REVOKED, (st))\n\n#define sk_X509_TRUST_new(st) SKM_sk_new(X509_TRUST, (st))\n#define sk_X509_TRUST_new_null() SKM_sk_new_null(X509_TRUST)\n#define sk_X509_TRUST_free(st) SKM_sk_free(X509_TRUST, (st))\n#define sk_X509_TRUST_num(st) SKM_sk_num(X509_TRUST, (st))\n#define sk_X509_TRUST_value(st, i) SKM_sk_value(X509_TRUST, (st), (i))\n#define sk_X509_TRUST_set(st, i, val) SKM_sk_set(X509_TRUST, (st), (i), (val))\n#define sk_X509_TRUST_zero(st) SKM_sk_zero(X509_TRUST, (st))\n#define sk_X509_TRUST_push(st, val) SKM_sk_push(X509_TRUST, (st), (val))\n#define sk_X509_TRUST_unshift(st, val) SKM_sk_unshift(X509_TRUST, (st), (val))\n#define sk_X509_TRUST_find(st, val) SKM_sk_find(X509_TRUST, (st), (val))\n#define sk_X509_TRUST_find_ex(st, val) SKM_sk_find_ex(X509_TRUST, (st), (val))\n#define sk_X509_TRUST_delete(st, i) SKM_sk_delete(X509_TRUST, (st), (i))\n#define sk_X509_TRUST_delete_ptr(st, ptr) SKM_sk_delete_ptr(X509_TRUST, (st), (ptr))\n#define sk_X509_TRUST_insert(st, val, i) SKM_sk_insert(X509_TRUST, (st), (val), (i))\n#define sk_X509_TRUST_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(X509_TRUST, (st), (cmp))\n#define sk_X509_TRUST_dup(st) SKM_sk_dup(X509_TRUST, st)\n#define sk_X509_TRUST_pop_free(st, free_func) SKM_sk_pop_free(X509_TRUST, (st), (free_func))\n#define sk_X509_TRUST_shift(st) SKM_sk_shift(X509_TRUST, (st))\n#define sk_X509_TRUST_pop(st) SKM_sk_pop(X509_TRUST, (st))\n#define sk_X509_TRUST_sort(st) SKM_sk_sort(X509_TRUST, (st))\n#define sk_X509_TRUST_is_sorted(st) SKM_sk_is_sorted(X509_TRUST, (st))\n\n#define sk_X509_VERIFY_PARAM_new(st) SKM_sk_new(X509_VERIFY_PARAM, (st))\n#define sk_X509_VERIFY_PARAM_new_null() SKM_sk_new_null(X509_VERIFY_PARAM)\n#define sk_X509_VERIFY_PARAM_free(st) SKM_sk_free(X509_VERIFY_PARAM, (st))\n#define sk_X509_VERIFY_PARAM_num(st) SKM_sk_num(X509_VERIFY_PARAM, (st))\n#define sk_X509_VERIFY_PARAM_value(st, i) SKM_sk_value(X509_VERIFY_PARAM, (st), (i))\n#define sk_X509_VERIFY_PARAM_set(st, i, val) SKM_sk_set(X509_VERIFY_PARAM, (st), (i), (val))\n#define sk_X509_VERIFY_PARAM_zero(st) SKM_sk_zero(X509_VERIFY_PARAM, (st))\n#define sk_X509_VERIFY_PARAM_push(st, val) SKM_sk_push(X509_VERIFY_PARAM, (st), (val))\n#define sk_X509_VERIFY_PARAM_unshift(st, val) SKM_sk_unshift(X509_VERIFY_PARAM, (st), (val))\n#define sk_X509_VERIFY_PARAM_find(st, val) SKM_sk_find(X509_VERIFY_PARAM, (st), (val))\n#define sk_X509_VERIFY_PARAM_find_ex(st, val) SKM_sk_find_ex(X509_VERIFY_PARAM, (st), (val))\n#define sk_X509_VERIFY_PARAM_delete(st, i) SKM_sk_delete(X509_VERIFY_PARAM, (st), (i))\n#define sk_X509_VERIFY_PARAM_delete_ptr(st, ptr) SKM_sk_delete_ptr(X509_VERIFY_PARAM, (st), (ptr))\n#define sk_X509_VERIFY_PARAM_insert(st, val, i) SKM_sk_insert(X509_VERIFY_PARAM, (st), (val), (i))\n#define sk_X509_VERIFY_PARAM_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(X509_VERIFY_PARAM, (st), (cmp))\n#define sk_X509_VERIFY_PARAM_dup(st) SKM_sk_dup(X509_VERIFY_PARAM, st)\n#define sk_X509_VERIFY_PARAM_pop_free(st, free_func) SKM_sk_pop_free(X509_VERIFY_PARAM, (st), (free_func))\n#define sk_X509_VERIFY_PARAM_shift(st) SKM_sk_shift(X509_VERIFY_PARAM, (st))\n#define sk_X509_VERIFY_PARAM_pop(st) SKM_sk_pop(X509_VERIFY_PARAM, (st))\n#define sk_X509_VERIFY_PARAM_sort(st) SKM_sk_sort(X509_VERIFY_PARAM, (st))\n#define sk_X509_VERIFY_PARAM_is_sorted(st) SKM_sk_is_sorted(X509_VERIFY_PARAM, (st))\n\n#define d2i_ASN1_SET_OF_ACCESS_DESCRIPTION(st, pp, length, d2i_func, free_func, ex_tag, ex_class) \\\n\tSKM_ASN1_SET_OF_d2i(ACCESS_DESCRIPTION, (st), (pp), (length), (d2i_func), (free_func), (ex_tag), (ex_class)) \n#define i2d_ASN1_SET_OF_ACCESS_DESCRIPTION(st, pp, i2d_func, ex_tag, ex_class, is_set) \\\n\tSKM_ASN1_SET_OF_i2d(ACCESS_DESCRIPTION, (st), (pp), (i2d_func), (ex_tag), (ex_class), (is_set))\n#define ASN1_seq_pack_ACCESS_DESCRIPTION(st, i2d_func, buf, len) \\\n\tSKM_ASN1_seq_pack(ACCESS_DESCRIPTION, (st), (i2d_func), (buf), (len))\n#define ASN1_seq_unpack_ACCESS_DESCRIPTION(buf, len, d2i_func, free_func) \\\n\tSKM_ASN1_seq_unpack(ACCESS_DESCRIPTION, (buf), (len), (d2i_func), (free_func))\n\n#define d2i_ASN1_SET_OF_ASN1_INTEGER(st, pp, length, d2i_func, free_func, ex_tag, ex_class) \\\n\tSKM_ASN1_SET_OF_d2i(ASN1_INTEGER, (st), (pp), (length), (d2i_func), (free_func), (ex_tag), (ex_class)) \n#define i2d_ASN1_SET_OF_ASN1_INTEGER(st, pp, i2d_func, ex_tag, ex_class, is_set) \\\n\tSKM_ASN1_SET_OF_i2d(ASN1_INTEGER, (st), (pp), (i2d_func), (ex_tag), (ex_class), (is_set))\n#define ASN1_seq_pack_ASN1_INTEGER(st, i2d_func, buf, len) \\\n\tSKM_ASN1_seq_pack(ASN1_INTEGER, (st), (i2d_func), (buf), (len))\n#define ASN1_seq_unpack_ASN1_INTEGER(buf, len, d2i_func, free_func) \\\n\tSKM_ASN1_seq_unpack(ASN1_INTEGER, (buf), (len), (d2i_func), (free_func))\n\n#define d2i_ASN1_SET_OF_ASN1_OBJECT(st, pp, length, d2i_func, free_func, ex_tag, ex_class) \\\n\tSKM_ASN1_SET_OF_d2i(ASN1_OBJECT, (st), (pp), (length), (d2i_func), (free_func), (ex_tag), (ex_class)) \n#define i2d_ASN1_SET_OF_ASN1_OBJECT(st, pp, i2d_func, ex_tag, ex_class, is_set) \\\n\tSKM_ASN1_SET_OF_i2d(ASN1_OBJECT, (st), (pp), (i2d_func), (ex_tag), (ex_class), (is_set))\n#define ASN1_seq_pack_ASN1_OBJECT(st, i2d_func, buf, len) \\\n\tSKM_ASN1_seq_pack(ASN1_OBJECT, (st), (i2d_func), (buf), (len))\n#define ASN1_seq_unpack_ASN1_OBJECT(buf, len, d2i_func, free_func) \\\n\tSKM_ASN1_seq_unpack(ASN1_OBJECT, (buf), (len), (d2i_func), (free_func))\n\n#define d2i_ASN1_SET_OF_ASN1_TYPE(st, pp, length, d2i_func, free_func, ex_tag, ex_class) \\\n\tSKM_ASN1_SET_OF_d2i(ASN1_TYPE, (st), (pp), (length), (d2i_func), (free_func), (ex_tag), (ex_class)) \n#define i2d_ASN1_SET_OF_ASN1_TYPE(st, pp, i2d_func, ex_tag, ex_class, is_set) \\\n\tSKM_ASN1_SET_OF_i2d(ASN1_TYPE, (st), (pp), (i2d_func), (ex_tag), (ex_class), (is_set))\n#define ASN1_seq_pack_ASN1_TYPE(st, i2d_func, buf, len) \\\n\tSKM_ASN1_seq_pack(ASN1_TYPE, (st), (i2d_func), (buf), (len))\n#define ASN1_seq_unpack_ASN1_TYPE(buf, len, d2i_func, free_func) \\\n\tSKM_ASN1_seq_unpack(ASN1_TYPE, (buf), (len), (d2i_func), (free_func))\n\n#define d2i_ASN1_SET_OF_DIST_POINT(st, pp, length, d2i_func, free_func, ex_tag, ex_class) \\\n\tSKM_ASN1_SET_OF_d2i(DIST_POINT, (st), (pp), (length), (d2i_func), (free_func), (ex_tag), (ex_class)) \n#define i2d_ASN1_SET_OF_DIST_POINT(st, pp, i2d_func, ex_tag, ex_class, is_set) \\\n\tSKM_ASN1_SET_OF_i2d(DIST_POINT, (st), (pp), (i2d_func), (ex_tag), (ex_class), (is_set))\n#define ASN1_seq_pack_DIST_POINT(st, i2d_func, buf, len) \\\n\tSKM_ASN1_seq_pack(DIST_POINT, (st), (i2d_func), (buf), (len))\n#define ASN1_seq_unpack_DIST_POINT(buf, len, d2i_func, free_func) \\\n\tSKM_ASN1_seq_unpack(DIST_POINT, (buf), (len), (d2i_func), (free_func))\n\n#define d2i_ASN1_SET_OF_GENERAL_NAME(st, pp, length, d2i_func, free_func, ex_tag, ex_class) \\\n\tSKM_ASN1_SET_OF_d2i(GENERAL_NAME, (st), (pp), (length), (d2i_func), (free_func), (ex_tag), (ex_class)) \n#define i2d_ASN1_SET_OF_GENERAL_NAME(st, pp, i2d_func, ex_tag, ex_class, is_set) \\\n\tSKM_ASN1_SET_OF_i2d(GENERAL_NAME, (st), (pp), (i2d_func), (ex_tag), (ex_class), (is_set))\n#define ASN1_seq_pack_GENERAL_NAME(st, i2d_func, buf, len) \\\n\tSKM_ASN1_seq_pack(GENERAL_NAME, (st), (i2d_func), (buf), (len))\n#define ASN1_seq_unpack_GENERAL_NAME(buf, len, d2i_func, free_func) \\\n\tSKM_ASN1_seq_unpack(GENERAL_NAME, (buf), (len), (d2i_func), (free_func))\n\n#define d2i_ASN1_SET_OF_OCSP_ONEREQ(st, pp, length, d2i_func, free_func, ex_tag, ex_class) \\\n\tSKM_ASN1_SET_OF_d2i(OCSP_ONEREQ, (st), (pp), (length), (d2i_func), (free_func), (ex_tag), (ex_class)) \n#define i2d_ASN1_SET_OF_OCSP_ONEREQ(st, pp, i2d_func, ex_tag, ex_class, is_set) \\\n\tSKM_ASN1_SET_OF_i2d(OCSP_ONEREQ, (st), (pp), (i2d_func), (ex_tag), (ex_class), (is_set))\n#define ASN1_seq_pack_OCSP_ONEREQ(st, i2d_func, buf, len) \\\n\tSKM_ASN1_seq_pack(OCSP_ONEREQ, (st), (i2d_func), (buf), (len))\n#define ASN1_seq_unpack_OCSP_ONEREQ(buf, len, d2i_func, free_func) \\\n\tSKM_ASN1_seq_unpack(OCSP_ONEREQ, (buf), (len), (d2i_func), (free_func))\n\n#define d2i_ASN1_SET_OF_OCSP_SINGLERESP(st, pp, length, d2i_func, free_func, ex_tag, ex_class) \\\n\tSKM_ASN1_SET_OF_d2i(OCSP_SINGLERESP, (st), (pp), (length), (d2i_func), (free_func), (ex_tag), (ex_class)) \n#define i2d_ASN1_SET_OF_OCSP_SINGLERESP(st, pp, i2d_func, ex_tag, ex_class, is_set) \\\n\tSKM_ASN1_SET_OF_i2d(OCSP_SINGLERESP, (st), (pp), (i2d_func), (ex_tag), (ex_class), (is_set))\n#define ASN1_seq_pack_OCSP_SINGLERESP(st, i2d_func, buf, len) \\\n\tSKM_ASN1_seq_pack(OCSP_SINGLERESP, (st), (i2d_func), (buf), (len))\n#define ASN1_seq_unpack_OCSP_SINGLERESP(buf, len, d2i_func, free_func) \\\n\tSKM_ASN1_seq_unpack(OCSP_SINGLERESP, (buf), (len), (d2i_func), (free_func))\n\n#define d2i_ASN1_SET_OF_PKCS12_SAFEBAG(st, pp, length, d2i_func, free_func, ex_tag, ex_class) \\\n\tSKM_ASN1_SET_OF_d2i(PKCS12_SAFEBAG, (st), (pp), (length), (d2i_func), (free_func), (ex_tag), (ex_class)) \n#define i2d_ASN1_SET_OF_PKCS12_SAFEBAG(st, pp, i2d_func, ex_tag, ex_class, is_set) \\\n\tSKM_ASN1_SET_OF_i2d(PKCS12_SAFEBAG, (st), (pp), (i2d_func), (ex_tag), (ex_class), (is_set))\n#define ASN1_seq_pack_PKCS12_SAFEBAG(st, i2d_func, buf, len) \\\n\tSKM_ASN1_seq_pack(PKCS12_SAFEBAG, (st), (i2d_func), (buf), (len))\n#define ASN1_seq_unpack_PKCS12_SAFEBAG(buf, len, d2i_func, free_func) \\\n\tSKM_ASN1_seq_unpack(PKCS12_SAFEBAG, (buf), (len), (d2i_func), (free_func))\n\n#define d2i_ASN1_SET_OF_PKCS7(st, pp, length, d2i_func, free_func, ex_tag, ex_class) \\\n\tSKM_ASN1_SET_OF_d2i(PKCS7, (st), (pp), (length), (d2i_func), (free_func), (ex_tag), (ex_class)) \n#define i2d_ASN1_SET_OF_PKCS7(st, pp, i2d_func, ex_tag, ex_class, is_set) \\\n\tSKM_ASN1_SET_OF_i2d(PKCS7, (st), (pp), (i2d_func), (ex_tag), (ex_class), (is_set))\n#define ASN1_seq_pack_PKCS7(st, i2d_func, buf, len) \\\n\tSKM_ASN1_seq_pack(PKCS7, (st), (i2d_func), (buf), (len))\n#define ASN1_seq_unpack_PKCS7(buf, len, d2i_func, free_func) \\\n\tSKM_ASN1_seq_unpack(PKCS7, (buf), (len), (d2i_func), (free_func))\n\n#define d2i_ASN1_SET_OF_PKCS7_RECIP_INFO(st, pp, length, d2i_func, free_func, ex_tag, ex_class) \\\n\tSKM_ASN1_SET_OF_d2i(PKCS7_RECIP_INFO, (st), (pp), (length), (d2i_func), (free_func), (ex_tag), (ex_class)) \n#define i2d_ASN1_SET_OF_PKCS7_RECIP_INFO(st, pp, i2d_func, ex_tag, ex_class, is_set) \\\n\tSKM_ASN1_SET_OF_i2d(PKCS7_RECIP_INFO, (st), (pp), (i2d_func), (ex_tag), (ex_class), (is_set))\n#define ASN1_seq_pack_PKCS7_RECIP_INFO(st, i2d_func, buf, len) \\\n\tSKM_ASN1_seq_pack(PKCS7_RECIP_INFO, (st), (i2d_func), (buf), (len))\n#define ASN1_seq_unpack_PKCS7_RECIP_INFO(buf, len, d2i_func, free_func) \\\n\tSKM_ASN1_seq_unpack(PKCS7_RECIP_INFO, (buf), (len), (d2i_func), (free_func))\n\n#define d2i_ASN1_SET_OF_PKCS7_SIGNER_INFO(st, pp, length, d2i_func, free_func, ex_tag, ex_class) \\\n\tSKM_ASN1_SET_OF_d2i(PKCS7_SIGNER_INFO, (st), (pp), (length), (d2i_func), (free_func), (ex_tag), (ex_class)) \n#define i2d_ASN1_SET_OF_PKCS7_SIGNER_INFO(st, pp, i2d_func, ex_tag, ex_class, is_set) \\\n\tSKM_ASN1_SET_OF_i2d(PKCS7_SIGNER_INFO, (st), (pp), (i2d_func), (ex_tag), (ex_class), (is_set))\n#define ASN1_seq_pack_PKCS7_SIGNER_INFO(st, i2d_func, buf, len) \\\n\tSKM_ASN1_seq_pack(PKCS7_SIGNER_INFO, (st), (i2d_func), (buf), (len))\n#define ASN1_seq_unpack_PKCS7_SIGNER_INFO(buf, len, d2i_func, free_func) \\\n\tSKM_ASN1_seq_unpack(PKCS7_SIGNER_INFO, (buf), (len), (d2i_func), (free_func))\n\n#define d2i_ASN1_SET_OF_POLICYINFO(st, pp, length, d2i_func, free_func, ex_tag, ex_class) \\\n\tSKM_ASN1_SET_OF_d2i(POLICYINFO, (st), (pp), (length), (d2i_func), (free_func), (ex_tag), (ex_class)) \n#define i2d_ASN1_SET_OF_POLICYINFO(st, pp, i2d_func, ex_tag, ex_class, is_set) \\\n\tSKM_ASN1_SET_OF_i2d(POLICYINFO, (st), (pp), (i2d_func), (ex_tag), (ex_class), (is_set))\n#define ASN1_seq_pack_POLICYINFO(st, i2d_func, buf, len) \\\n\tSKM_ASN1_seq_pack(POLICYINFO, (st), (i2d_func), (buf), (len))\n#define ASN1_seq_unpack_POLICYINFO(buf, len, d2i_func, free_func) \\\n\tSKM_ASN1_seq_unpack(POLICYINFO, (buf), (len), (d2i_func), (free_func))\n\n#define d2i_ASN1_SET_OF_POLICYQUALINFO(st, pp, length, d2i_func, free_func, ex_tag, ex_class) \\\n\tSKM_ASN1_SET_OF_d2i(POLICYQUALINFO, (st), (pp), (length), (d2i_func), (free_func), (ex_tag), (ex_class)) \n#define i2d_ASN1_SET_OF_POLICYQUALINFO(st, pp, i2d_func, ex_tag, ex_class, is_set) \\\n\tSKM_ASN1_SET_OF_i2d(POLICYQUALINFO, (st), (pp), (i2d_func), (ex_tag), (ex_class), (is_set))\n#define ASN1_seq_pack_POLICYQUALINFO(st, i2d_func, buf, len) \\\n\tSKM_ASN1_seq_pack(POLICYQUALINFO, (st), (i2d_func), (buf), (len))\n#define ASN1_seq_unpack_POLICYQUALINFO(buf, len, d2i_func, free_func) \\\n\tSKM_ASN1_seq_unpack(POLICYQUALINFO, (buf), (len), (d2i_func), (free_func))\n\n#define d2i_ASN1_SET_OF_SXNETID(st, pp, length, d2i_func, free_func, ex_tag, ex_class) \\\n\tSKM_ASN1_SET_OF_d2i(SXNETID, (st), (pp), (length), (d2i_func), (free_func), (ex_tag), (ex_class)) \n#define i2d_ASN1_SET_OF_SXNETID(st, pp, i2d_func, ex_tag, ex_class, is_set) \\\n\tSKM_ASN1_SET_OF_i2d(SXNETID, (st), (pp), (i2d_func), (ex_tag), (ex_class), (is_set))\n#define ASN1_seq_pack_SXNETID(st, i2d_func, buf, len) \\\n\tSKM_ASN1_seq_pack(SXNETID, (st), (i2d_func), (buf), (len))\n#define ASN1_seq_unpack_SXNETID(buf, len, d2i_func, free_func) \\\n\tSKM_ASN1_seq_unpack(SXNETID, (buf), (len), (d2i_func), (free_func))\n\n#define d2i_ASN1_SET_OF_X509(st, pp, length, d2i_func, free_func, ex_tag, ex_class) \\\n\tSKM_ASN1_SET_OF_d2i(X509, (st), (pp), (length), (d2i_func), (free_func), (ex_tag), (ex_class)) \n#define i2d_ASN1_SET_OF_X509(st, pp, i2d_func, ex_tag, ex_class, is_set) \\\n\tSKM_ASN1_SET_OF_i2d(X509, (st), (pp), (i2d_func), (ex_tag), (ex_class), (is_set))\n#define ASN1_seq_pack_X509(st, i2d_func, buf, len) \\\n\tSKM_ASN1_seq_pack(X509, (st), (i2d_func), (buf), (len))\n#define ASN1_seq_unpack_X509(buf, len, d2i_func, free_func) \\\n\tSKM_ASN1_seq_unpack(X509, (buf), (len), (d2i_func), (free_func))\n\n#define d2i_ASN1_SET_OF_X509_ALGOR(st, pp, length, d2i_func, free_func, ex_tag, ex_class) \\\n\tSKM_ASN1_SET_OF_d2i(X509_ALGOR, (st), (pp), (length), (d2i_func), (free_func), (ex_tag), (ex_class)) \n#define i2d_ASN1_SET_OF_X509_ALGOR(st, pp, i2d_func, ex_tag, ex_class, is_set) \\\n\tSKM_ASN1_SET_OF_i2d(X509_ALGOR, (st), (pp), (i2d_func), (ex_tag), (ex_class), (is_set))\n#define ASN1_seq_pack_X509_ALGOR(st, i2d_func, buf, len) \\\n\tSKM_ASN1_seq_pack(X509_ALGOR, (st), (i2d_func), (buf), (len))\n#define ASN1_seq_unpack_X509_ALGOR(buf, len, d2i_func, free_func) \\\n\tSKM_ASN1_seq_unpack(X509_ALGOR, (buf), (len), (d2i_func), (free_func))\n\n#define d2i_ASN1_SET_OF_X509_ATTRIBUTE(st, pp, length, d2i_func, free_func, ex_tag, ex_class) \\\n\tSKM_ASN1_SET_OF_d2i(X509_ATTRIBUTE, (st), (pp), (length), (d2i_func), (free_func), (ex_tag), (ex_class)) \n#define i2d_ASN1_SET_OF_X509_ATTRIBUTE(st, pp, i2d_func, ex_tag, ex_class, is_set) \\\n\tSKM_ASN1_SET_OF_i2d(X509_ATTRIBUTE, (st), (pp), (i2d_func), (ex_tag), (ex_class), (is_set))\n#define ASN1_seq_pack_X509_ATTRIBUTE(st, i2d_func, buf, len) \\\n\tSKM_ASN1_seq_pack(X509_ATTRIBUTE, (st), (i2d_func), (buf), (len))\n#define ASN1_seq_unpack_X509_ATTRIBUTE(buf, len, d2i_func, free_func) \\\n\tSKM_ASN1_seq_unpack(X509_ATTRIBUTE, (buf), (len), (d2i_func), (free_func))\n\n#define d2i_ASN1_SET_OF_X509_CRL(st, pp, length, d2i_func, free_func, ex_tag, ex_class) \\\n\tSKM_ASN1_SET_OF_d2i(X509_CRL, (st), (pp), (length), (d2i_func), (free_func), (ex_tag), (ex_class)) \n#define i2d_ASN1_SET_OF_X509_CRL(st, pp, i2d_func, ex_tag, ex_class, is_set) \\\n\tSKM_ASN1_SET_OF_i2d(X509_CRL, (st), (pp), (i2d_func), (ex_tag), (ex_class), (is_set))\n#define ASN1_seq_pack_X509_CRL(st, i2d_func, buf, len) \\\n\tSKM_ASN1_seq_pack(X509_CRL, (st), (i2d_func), (buf), (len))\n#define ASN1_seq_unpack_X509_CRL(buf, len, d2i_func, free_func) \\\n\tSKM_ASN1_seq_unpack(X509_CRL, (buf), (len), (d2i_func), (free_func))\n\n#define d2i_ASN1_SET_OF_X509_EXTENSION(st, pp, length, d2i_func, free_func, ex_tag, ex_class) \\\n\tSKM_ASN1_SET_OF_d2i(X509_EXTENSION, (st), (pp), (length), (d2i_func), (free_func), (ex_tag), (ex_class)) \n#define i2d_ASN1_SET_OF_X509_EXTENSION(st, pp, i2d_func, ex_tag, ex_class, is_set) \\\n\tSKM_ASN1_SET_OF_i2d(X509_EXTENSION, (st), (pp), (i2d_func), (ex_tag), (ex_class), (is_set))\n#define ASN1_seq_pack_X509_EXTENSION(st, i2d_func, buf, len) \\\n\tSKM_ASN1_seq_pack(X509_EXTENSION, (st), (i2d_func), (buf), (len))\n#define ASN1_seq_unpack_X509_EXTENSION(buf, len, d2i_func, free_func) \\\n\tSKM_ASN1_seq_unpack(X509_EXTENSION, (buf), (len), (d2i_func), (free_func))\n\n#define d2i_ASN1_SET_OF_X509_NAME_ENTRY(st, pp, length, d2i_func, free_func, ex_tag, ex_class) \\\n\tSKM_ASN1_SET_OF_d2i(X509_NAME_ENTRY, (st), (pp), (length), (d2i_func), (free_func), (ex_tag), (ex_class)) \n#define i2d_ASN1_SET_OF_X509_NAME_ENTRY(st, pp, i2d_func, ex_tag, ex_class, is_set) \\\n\tSKM_ASN1_SET_OF_i2d(X509_NAME_ENTRY, (st), (pp), (i2d_func), (ex_tag), (ex_class), (is_set))\n#define ASN1_seq_pack_X509_NAME_ENTRY(st, i2d_func, buf, len) \\\n\tSKM_ASN1_seq_pack(X509_NAME_ENTRY, (st), (i2d_func), (buf), (len))\n#define ASN1_seq_unpack_X509_NAME_ENTRY(buf, len, d2i_func, free_func) \\\n\tSKM_ASN1_seq_unpack(X509_NAME_ENTRY, (buf), (len), (d2i_func), (free_func))\n\n#define d2i_ASN1_SET_OF_X509_REVOKED(st, pp, length, d2i_func, free_func, ex_tag, ex_class) \\\n\tSKM_ASN1_SET_OF_d2i(X509_REVOKED, (st), (pp), (length), (d2i_func), (free_func), (ex_tag), (ex_class)) \n#define i2d_ASN1_SET_OF_X509_REVOKED(st, pp, i2d_func, ex_tag, ex_class, is_set) \\\n\tSKM_ASN1_SET_OF_i2d(X509_REVOKED, (st), (pp), (i2d_func), (ex_tag), (ex_class), (is_set))\n#define ASN1_seq_pack_X509_REVOKED(st, i2d_func, buf, len) \\\n\tSKM_ASN1_seq_pack(X509_REVOKED, (st), (i2d_func), (buf), (len))\n#define ASN1_seq_unpack_X509_REVOKED(buf, len, d2i_func, free_func) \\\n\tSKM_ASN1_seq_unpack(X509_REVOKED, (buf), (len), (d2i_func), (free_func))\n\n#define PKCS12_decrypt_d2i_PKCS12_SAFEBAG(algor, d2i_func, free_func, pass, passlen, oct, seq) \\\n\tSKM_PKCS12_decrypt_d2i(PKCS12_SAFEBAG, (algor), (d2i_func), (free_func), (pass), (passlen), (oct), (seq))\n\n#define PKCS12_decrypt_d2i_PKCS7(algor, d2i_func, free_func, pass, passlen, oct, seq) \\\n\tSKM_PKCS12_decrypt_d2i(PKCS7, (algor), (d2i_func), (free_func), (pass), (passlen), (oct), (seq))\n/* End of util/mkstack.pl block, you may now edit :-) */\n\n#endif /* !defined HEADER_SAFESTACK_H */\n"
  },
  {
    "path": "freebsd-headers/openssl/sha.h",
    "content": "/* crypto/sha/sha.h */\n/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)\n * All rights reserved.\n *\n * This package is an SSL implementation written\n * by Eric Young (eay@cryptsoft.com).\n * The implementation was written so as to conform with Netscapes SSL.\n * \n * This library is free for commercial and non-commercial use as long as\n * the following conditions are aheared to.  The following conditions\n * apply to all code found in this distribution, be it the RC4, RSA,\n * lhash, DES, etc., code; not just the SSL code.  The SSL documentation\n * included with this distribution is covered by the same copyright terms\n * except that the holder is Tim Hudson (tjh@cryptsoft.com).\n * \n * Copyright remains Eric Young's, and as such any Copyright notices in\n * the code are not to be removed.\n * If this package is used in a product, Eric Young should be given attribution\n * as the author of the parts of the library used.\n * This can be in the form of a textual message at program startup or\n * in documentation (online or textual) provided with the package.\n * \n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. All advertising materials mentioning features or use of this software\n *    must display the following acknowledgement:\n *    \"This product includes cryptographic software written by\n *     Eric Young (eay@cryptsoft.com)\"\n *    The word 'cryptographic' can be left out if the rouines from the library\n *    being used are not cryptographic related :-).\n * 4. If you include any Windows specific code (or a derivative thereof) from \n *    the apps directory (application code) you must include an acknowledgement:\n *    \"This product includes software written by Tim Hudson (tjh@cryptsoft.com)\"\n * \n * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n * \n * The licence and distribution terms for any publically available version or\n * derivative of this code cannot be changed.  i.e. this code cannot simply be\n * copied and put under another distribution licence\n * [including the GNU Public Licence.]\n */\n\n#ifndef HEADER_SHA_H\n#define HEADER_SHA_H\n\n#include <openssl/e_os2.h>\n#include <stddef.h>\n\n#ifdef  __cplusplus\nextern \"C\" {\n#endif\n\n#if defined(OPENSSL_NO_SHA) || (defined(OPENSSL_NO_SHA0) && defined(OPENSSL_NO_SHA1))\n#error SHA is disabled.\n#endif\n\n#if defined(OPENSSL_FIPS)\n#define FIPS_SHA_SIZE_T size_t\n#endif\n\n/*\n * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n * ! SHA_LONG has to be at least 32 bits wide. If it's wider, then !\n * ! SHA_LONG_LOG2 has to be defined along.                        !\n * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n */\n\n#if defined(OPENSSL_SYS_WIN16) || defined(__LP32__)\n#define SHA_LONG unsigned long\n#elif defined(OPENSSL_SYS_CRAY) || defined(__ILP64__)\n#define SHA_LONG unsigned long\n#define SHA_LONG_LOG2 3\n#else\n#define SHA_LONG unsigned int\n#endif\n\n#define SHA_LBLOCK\t16\n#define SHA_CBLOCK\t(SHA_LBLOCK*4)\t/* SHA treats input data as a\n\t\t\t\t\t * contiguous array of 32 bit\n\t\t\t\t\t * wide big-endian values. */\n#define SHA_LAST_BLOCK  (SHA_CBLOCK-8)\n#define SHA_DIGEST_LENGTH 20\n\ntypedef struct SHAstate_st\n\t{\n\tSHA_LONG h0,h1,h2,h3,h4;\n\tSHA_LONG Nl,Nh;\n\tSHA_LONG data[SHA_LBLOCK];\n\tunsigned int num;\n\t} SHA_CTX;\n\n#ifndef OPENSSL_NO_SHA0\n#ifdef OPENSSL_FIPS\nint private_SHA_Init(SHA_CTX *c);\n#endif\nint SHA_Init(SHA_CTX *c);\nint SHA_Update(SHA_CTX *c, const void *data, size_t len);\nint SHA_Final(unsigned char *md, SHA_CTX *c);\nunsigned char *SHA(const unsigned char *d, size_t n, unsigned char *md);\nvoid SHA_Transform(SHA_CTX *c, const unsigned char *data);\n#endif\n#ifndef OPENSSL_NO_SHA1\nint SHA1_Init(SHA_CTX *c);\nint SHA1_Update(SHA_CTX *c, const void *data, size_t len);\nint SHA1_Final(unsigned char *md, SHA_CTX *c);\nunsigned char *SHA1(const unsigned char *d, size_t n, unsigned char *md);\nvoid SHA1_Transform(SHA_CTX *c, const unsigned char *data);\n#endif\n\n#define SHA256_CBLOCK\t(SHA_LBLOCK*4)\t/* SHA-256 treats input data as a\n\t\t\t\t\t * contiguous array of 32 bit\n\t\t\t\t\t * wide big-endian values. */\n#define SHA224_DIGEST_LENGTH\t28\n#define SHA256_DIGEST_LENGTH\t32\n\ntypedef struct SHA256state_st\n\t{\n\tSHA_LONG h[8];\n\tSHA_LONG Nl,Nh;\n\tSHA_LONG data[SHA_LBLOCK];\n\tunsigned int num,md_len;\n\t} SHA256_CTX;\n\n#ifndef OPENSSL_NO_SHA256\nint SHA224_Init(SHA256_CTX *c);\nint SHA224_Update(SHA256_CTX *c, const void *data, size_t len);\nint SHA224_Final(unsigned char *md, SHA256_CTX *c);\nunsigned char *SHA224(const unsigned char *d, size_t n,unsigned char *md);\nint SHA256_Init(SHA256_CTX *c);\nint SHA256_Update(SHA256_CTX *c, const void *data, size_t len);\nint SHA256_Final(unsigned char *md, SHA256_CTX *c);\nunsigned char *SHA256(const unsigned char *d, size_t n,unsigned char *md);\nvoid SHA256_Transform(SHA256_CTX *c, const unsigned char *data);\n#endif\n\n#define SHA384_DIGEST_LENGTH\t48\n#define SHA512_DIGEST_LENGTH\t64\n\n#ifndef OPENSSL_NO_SHA512\n/*\n * Unlike 32-bit digest algorithms, SHA-512 *relies* on SHA_LONG64\n * being exactly 64-bit wide. See Implementation Notes in sha512.c\n * for further details.\n */\n#define SHA512_CBLOCK\t(SHA_LBLOCK*8)\t/* SHA-512 treats input data as a\n\t\t\t\t\t * contiguous array of 64 bit\n\t\t\t\t\t * wide big-endian values. */\n#if (defined(_WIN32) || defined(_WIN64)) && !defined(__MINGW32__)\n#define SHA_LONG64 unsigned __int64\n#define U64(C)     C##UI64\n#elif defined(__arch64__)\n#define SHA_LONG64 unsigned long\n#define U64(C)     C##UL\n#else\n#define SHA_LONG64 unsigned long long\n#define U64(C)     C##ULL\n#endif\n\ntypedef struct SHA512state_st\n\t{\n\tSHA_LONG64 h[8];\n\tSHA_LONG64 Nl,Nh;\n\tunion {\n\t\tSHA_LONG64\td[SHA_LBLOCK];\n\t\tunsigned char\tp[SHA512_CBLOCK];\n\t} u;\n\tunsigned int num,md_len;\n\t} SHA512_CTX;\n#endif\n\n#ifndef OPENSSL_NO_SHA512\nint SHA384_Init(SHA512_CTX *c);\nint SHA384_Update(SHA512_CTX *c, const void *data, size_t len);\nint SHA384_Final(unsigned char *md, SHA512_CTX *c);\nunsigned char *SHA384(const unsigned char *d, size_t n,unsigned char *md);\nint SHA512_Init(SHA512_CTX *c);\nint SHA512_Update(SHA512_CTX *c, const void *data, size_t len);\nint SHA512_Final(unsigned char *md, SHA512_CTX *c);\nunsigned char *SHA512(const unsigned char *d, size_t n,unsigned char *md);\nvoid SHA512_Transform(SHA512_CTX *c, const unsigned char *data);\n#endif\n\n#ifdef  __cplusplus\n}\n#endif\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/openssl/ssl.h",
    "content": "/* ssl/ssl.h */\n/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)\n * All rights reserved.\n *\n * This package is an SSL implementation written\n * by Eric Young (eay@cryptsoft.com).\n * The implementation was written so as to conform with Netscapes SSL.\n * \n * This library is free for commercial and non-commercial use as long as\n * the following conditions are aheared to.  The following conditions\n * apply to all code found in this distribution, be it the RC4, RSA,\n * lhash, DES, etc., code; not just the SSL code.  The SSL documentation\n * included with this distribution is covered by the same copyright terms\n * except that the holder is Tim Hudson (tjh@cryptsoft.com).\n * \n * Copyright remains Eric Young's, and as such any Copyright notices in\n * the code are not to be removed.\n * If this package is used in a product, Eric Young should be given attribution\n * as the author of the parts of the library used.\n * This can be in the form of a textual message at program startup or\n * in documentation (online or textual) provided with the package.\n * \n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. All advertising materials mentioning features or use of this software\n *    must display the following acknowledgement:\n *    \"This product includes cryptographic software written by\n *     Eric Young (eay@cryptsoft.com)\"\n *    The word 'cryptographic' can be left out if the rouines from the library\n *    being used are not cryptographic related :-).\n * 4. If you include any Windows specific code (or a derivative thereof) from \n *    the apps directory (application code) you must include an acknowledgement:\n *    \"This product includes software written by Tim Hudson (tjh@cryptsoft.com)\"\n * \n * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n * \n * The licence and distribution terms for any publically available version or\n * derivative of this code cannot be changed.  i.e. this code cannot simply be\n * copied and put under another distribution licence\n * [including the GNU Public Licence.]\n */\n/* ====================================================================\n * Copyright (c) 1998-2001 The OpenSSL Project.  All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n *\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer. \n *\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in\n *    the documentation and/or other materials provided with the\n *    distribution.\n *\n * 3. All advertising materials mentioning features or use of this\n *    software must display the following acknowledgment:\n *    \"This product includes software developed by the OpenSSL Project\n *    for use in the OpenSSL Toolkit. (http://www.openssl.org/)\"\n *\n * 4. The names \"OpenSSL Toolkit\" and \"OpenSSL Project\" must not be used to\n *    endorse or promote products derived from this software without\n *    prior written permission. For written permission, please contact\n *    openssl-core@openssl.org.\n *\n * 5. Products derived from this software may not be called \"OpenSSL\"\n *    nor may \"OpenSSL\" appear in their names without prior written\n *    permission of the OpenSSL Project.\n *\n * 6. Redistributions of any form whatsoever must retain the following\n *    acknowledgment:\n *    \"This product includes software developed by the OpenSSL Project\n *    for use in the OpenSSL Toolkit (http://www.openssl.org/)\"\n *\n * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY\n * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\n * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE OpenSSL PROJECT OR\n * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\n * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,\n * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED\n * OF THE POSSIBILITY OF SUCH DAMAGE.\n * ====================================================================\n *\n * This product includes cryptographic software written by Eric Young\n * (eay@cryptsoft.com).  This product includes software written by Tim\n * Hudson (tjh@cryptsoft.com).\n *\n */\n/* ====================================================================\n * Copyright (c) 1998-2006 The OpenSSL Project.  All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n *\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer. \n *\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in\n *    the documentation and/or other materials provided with the\n *    distribution.\n *\n * 3. All advertising materials mentioning features or use of this\n *    software must display the following acknowledgment:\n *    \"This product includes software developed by the OpenSSL Project\n *    for use in the OpenSSL Toolkit. (http://www.openssl.org/)\"\n *\n * 4. The names \"OpenSSL Toolkit\" and \"OpenSSL Project\" must not be used to\n *    endorse or promote products derived from this software without\n *    prior written permission. For written permission, please contact\n *    openssl-core@openssl.org.\n *\n * 5. Products derived from this software may not be called \"OpenSSL\"\n *    nor may \"OpenSSL\" appear in their names without prior written\n *    permission of the OpenSSL Project.\n *\n * 6. Redistributions of any form whatsoever must retain the following\n *    acknowledgment:\n *    \"This product includes software developed by the OpenSSL Project\n *    for use in the OpenSSL Toolkit (http://www.openssl.org/)\"\n *\n * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY\n * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\n * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE OpenSSL PROJECT OR\n * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\n * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,\n * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED\n * OF THE POSSIBILITY OF SUCH DAMAGE.\n * ====================================================================\n *\n * This product includes cryptographic software written by Eric Young\n * (eay@cryptsoft.com).  This product includes software written by Tim\n * Hudson (tjh@cryptsoft.com).\n *\n */\n/* ====================================================================\n * Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED.\n * ECC cipher suite support in OpenSSL originally developed by \n * SUN MICROSYSTEMS, INC., and contributed to the OpenSSL project.\n */\n\n#ifndef HEADER_SSL_H \n#define HEADER_SSL_H \n\n#include <openssl/e_os2.h>\n\n#ifndef OPENSSL_NO_COMP\n#include <openssl/comp.h>\n#endif\n#ifndef OPENSSL_NO_BIO\n#include <openssl/bio.h>\n#endif\n#ifndef OPENSSL_NO_DEPRECATED\n#ifndef OPENSSL_NO_X509\n#include <openssl/x509.h>\n#endif\n#include <openssl/crypto.h>\n#include <openssl/lhash.h>\n#include <openssl/buffer.h>\n#endif\n#include <openssl/pem.h>\n#include <openssl/hmac.h>\n\n#include <openssl/kssl.h>\n#include <openssl/safestack.h>\n#include <openssl/symhacks.h>\n\n#ifdef  __cplusplus\nextern \"C\" {\n#endif\n\n/* SSLeay version number for ASN.1 encoding of the session information */\n/* Version 0 - initial version\n * Version 1 - added the optional peer certificate\n */\n#define SSL_SESSION_ASN1_VERSION 0x0001\n\n/* text strings for the ciphers */\n#define SSL_TXT_NULL_WITH_MD5\t\tSSL2_TXT_NULL_WITH_MD5\t\t\t\n#define SSL_TXT_RC4_128_WITH_MD5\tSSL2_TXT_RC4_128_WITH_MD5\t\t\n#define SSL_TXT_RC4_128_EXPORT40_WITH_MD5 SSL2_TXT_RC4_128_EXPORT40_WITH_MD5\t\n#define SSL_TXT_RC2_128_CBC_WITH_MD5\tSSL2_TXT_RC2_128_CBC_WITH_MD5\t\t\n#define SSL_TXT_RC2_128_CBC_EXPORT40_WITH_MD5 SSL2_TXT_RC2_128_CBC_EXPORT40_WITH_MD5\t\n#define SSL_TXT_IDEA_128_CBC_WITH_MD5\tSSL2_TXT_IDEA_128_CBC_WITH_MD5\t\t\n#define SSL_TXT_DES_64_CBC_WITH_MD5\tSSL2_TXT_DES_64_CBC_WITH_MD5\t\t\n#define SSL_TXT_DES_64_CBC_WITH_SHA\tSSL2_TXT_DES_64_CBC_WITH_SHA\t\t\n#define SSL_TXT_DES_192_EDE3_CBC_WITH_MD5 SSL2_TXT_DES_192_EDE3_CBC_WITH_MD5\t\n#define SSL_TXT_DES_192_EDE3_CBC_WITH_SHA SSL2_TXT_DES_192_EDE3_CBC_WITH_SHA\t\n\n/*    VRS Additional Kerberos5 entries\n */\n#define SSL_TXT_KRB5_DES_64_CBC_SHA   SSL3_TXT_KRB5_DES_64_CBC_SHA\n#define SSL_TXT_KRB5_DES_192_CBC3_SHA SSL3_TXT_KRB5_DES_192_CBC3_SHA\n#define SSL_TXT_KRB5_RC4_128_SHA      SSL3_TXT_KRB5_RC4_128_SHA\n#define SSL_TXT_KRB5_IDEA_128_CBC_SHA SSL3_TXT_KRB5_IDEA_128_CBC_SHA\n#define SSL_TXT_KRB5_DES_64_CBC_MD5   SSL3_TXT_KRB5_DES_64_CBC_MD5       \n#define SSL_TXT_KRB5_DES_192_CBC3_MD5 SSL3_TXT_KRB5_DES_192_CBC3_MD5       \n#define SSL_TXT_KRB5_RC4_128_MD5      SSL3_TXT_KRB5_RC4_128_MD5\n#define SSL_TXT_KRB5_IDEA_128_CBC_MD5 SSL3_TXT_KRB5_IDEA_128_CBC_MD5 \n\n#define SSL_TXT_KRB5_DES_40_CBC_SHA   SSL3_TXT_KRB5_DES_40_CBC_SHA \n#define SSL_TXT_KRB5_RC2_40_CBC_SHA   SSL3_TXT_KRB5_RC2_40_CBC_SHA \n#define SSL_TXT_KRB5_RC4_40_SHA\t      SSL3_TXT_KRB5_RC4_40_SHA\n#define SSL_TXT_KRB5_DES_40_CBC_MD5   SSL3_TXT_KRB5_DES_40_CBC_MD5 \n#define SSL_TXT_KRB5_RC2_40_CBC_MD5   SSL3_TXT_KRB5_RC2_40_CBC_MD5 \n#define SSL_TXT_KRB5_RC4_40_MD5\t      SSL3_TXT_KRB5_RC4_40_MD5\n\n#define SSL_TXT_KRB5_DES_40_CBC_SHA   SSL3_TXT_KRB5_DES_40_CBC_SHA\n#define SSL_TXT_KRB5_DES_40_CBC_MD5   SSL3_TXT_KRB5_DES_40_CBC_MD5\n#define SSL_TXT_KRB5_DES_64_CBC_SHA   SSL3_TXT_KRB5_DES_64_CBC_SHA\n#define SSL_TXT_KRB5_DES_64_CBC_MD5   SSL3_TXT_KRB5_DES_64_CBC_MD5\n#define SSL_TXT_KRB5_DES_192_CBC3_SHA SSL3_TXT_KRB5_DES_192_CBC3_SHA\n#define SSL_TXT_KRB5_DES_192_CBC3_MD5 SSL3_TXT_KRB5_DES_192_CBC3_MD5\n#define SSL_MAX_KRB5_PRINCIPAL_LENGTH  256\n\n#define SSL_MAX_SSL_SESSION_ID_LENGTH\t\t32\n#define SSL_MAX_SID_CTX_LENGTH\t\t\t32\n\n#define SSL_MIN_RSA_MODULUS_LENGTH_IN_BYTES\t(512/8)\n#define SSL_MAX_KEY_ARG_LENGTH\t\t\t8\n#define SSL_MAX_MASTER_KEY_LENGTH\t\t48\n\n/* These are used to specify which ciphers to use and not to use */\n#define SSL_TXT_LOW\t\t\"LOW\"\n#define SSL_TXT_MEDIUM\t\t\"MEDIUM\"\n#define SSL_TXT_HIGH\t\t\"HIGH\"\n#define SSL_TXT_FIPS\t\t\"FIPS\"\n#define SSL_TXT_kFZA\t\t\"kFZA\"\n#define\tSSL_TXT_aFZA\t\t\"aFZA\"\n#define SSL_TXT_eFZA\t\t\"eFZA\"\n#define SSL_TXT_FZA\t\t\"FZA\"\n\n#define\tSSL_TXT_aNULL\t\t\"aNULL\"\n#define\tSSL_TXT_eNULL\t\t\"eNULL\"\n#define\tSSL_TXT_NULL\t\t\"NULL\"\n\n#define SSL_TXT_kKRB5     \t\"kKRB5\"\n#define SSL_TXT_aKRB5     \t\"aKRB5\"\n#define SSL_TXT_KRB5      \t\"KRB5\"\n\n#define SSL_TXT_kRSA\t\t\"kRSA\"\n#define SSL_TXT_kDHr\t\t\"kDHr\"\n#define SSL_TXT_kDHd\t\t\"kDHd\"\n#define SSL_TXT_kEDH\t\t\"kEDH\"\n#define\tSSL_TXT_aRSA\t\t\"aRSA\"\n#define\tSSL_TXT_aDSS\t\t\"aDSS\"\n#define\tSSL_TXT_aDH\t\t\"aDH\"\n#define\tSSL_TXT_DSS\t\t\"DSS\"\n#define SSL_TXT_DH\t\t\"DH\"\n#define SSL_TXT_EDH\t\t\"EDH\"\n#define SSL_TXT_ADH\t\t\"ADH\"\n#define SSL_TXT_RSA\t\t\"RSA\"\n#define SSL_TXT_DES\t\t\"DES\"\n#define SSL_TXT_3DES\t\t\"3DES\"\n#define SSL_TXT_RC4\t\t\"RC4\"\n#define SSL_TXT_RC2\t\t\"RC2\"\n#define SSL_TXT_IDEA\t\t\"IDEA\"\n#define SSL_TXT_SEED\t\t\"SEED\"\n#define SSL_TXT_AES\t\t\"AES\"\n#define SSL_TXT_CAMELLIA\t\"CAMELLIA\"\n#define SSL_TXT_MD5\t\t\"MD5\"\n#define SSL_TXT_SHA1\t\t\"SHA1\"\n#define SSL_TXT_SHA\t\t\"SHA\"\n#define SSL_TXT_EXP\t\t\"EXP\"\n#define SSL_TXT_EXPORT\t\t\"EXPORT\"\n#define SSL_TXT_EXP40\t\t\"EXPORT40\"\n#define SSL_TXT_EXP56\t\t\"EXPORT56\"\n#define SSL_TXT_SSLV2\t\t\"SSLv2\"\n#define SSL_TXT_SSLV3\t\t\"SSLv3\"\n#define SSL_TXT_TLSV1\t\t\"TLSv1\"\n#define SSL_TXT_ALL\t\t\"ALL\"\n#define SSL_TXT_ECC\t\t\"ECCdraft\" /* ECC ciphersuites are not yet official */\n\n/*\n * COMPLEMENTOF* definitions. These identifiers are used to (de-select)\n * ciphers normally not being used.\n * Example: \"RC4\" will activate all ciphers using RC4 including ciphers\n * without authentication, which would normally disabled by DEFAULT (due\n * the \"!ADH\" being part of default). Therefore \"RC4:!COMPLEMENTOFDEFAULT\"\n * will make sure that it is also disabled in the specific selection.\n * COMPLEMENTOF* identifiers are portable between version, as adjustments\n * to the default cipher setup will also be included here.\n *\n * COMPLEMENTOFDEFAULT does not experience the same special treatment that\n * DEFAULT gets, as only selection is being done and no sorting as needed\n * for DEFAULT.\n */\n#define SSL_TXT_CMPALL\t\t\"COMPLEMENTOFALL\"\n#define SSL_TXT_CMPDEF\t\t\"COMPLEMENTOFDEFAULT\"\n\n/* The following cipher list is used by default.\n * It also is substituted when an application-defined cipher list string\n * starts with 'DEFAULT'. */\n#define SSL_DEFAULT_CIPHER_LIST\t\"AES:ALL:!aNULL:!eNULL:+RC4:@STRENGTH\" /* low priority for RC4 */\n\n/* Used in SSL_set_shutdown()/SSL_get_shutdown(); */\n#define SSL_SENT_SHUTDOWN\t1\n#define SSL_RECEIVED_SHUTDOWN\t2\n\n#ifdef __cplusplus\n}\n#endif\n\n#ifdef  __cplusplus\nextern \"C\" {\n#endif\n\n#if (defined(OPENSSL_NO_RSA) || defined(OPENSSL_NO_MD5)) && !defined(OPENSSL_NO_SSL2)\n#define OPENSSL_NO_SSL2\n#endif\n\n#define SSL_FILETYPE_ASN1\tX509_FILETYPE_ASN1\n#define SSL_FILETYPE_PEM\tX509_FILETYPE_PEM\n\n/* This is needed to stop compilers complaining about the\n * 'struct ssl_st *' function parameters used to prototype callbacks\n * in SSL_CTX. */\ntypedef struct ssl_st *ssl_crock_st;\n\n/* used to hold info on the particular ciphers used */\ntypedef struct ssl_cipher_st\n\t{\n\tint valid;\n\tconst char *name;\t\t/* text name */\n\tunsigned long id;\t\t/* id, 4 bytes, first is version */\n\tunsigned long algorithms;\t/* what ciphers are used */\n\tunsigned long algo_strength;\t/* strength and export flags */\n\tunsigned long algorithm2;\t/* Extra flags */\n\tint strength_bits;\t\t/* Number of bits really used */\n\tint alg_bits;\t\t\t/* Number of bits for algorithm */\n\tunsigned long mask;\t\t/* used for matching */\n\tunsigned long mask_strength;\t/* also used for matching */\n\t} SSL_CIPHER;\n\nDECLARE_STACK_OF(SSL_CIPHER)\n\n/* Used to hold functions for SSLv2 or SSLv3/TLSv1 functions */\ntypedef struct ssl_method_st\n\t{\n\tint version;\n\tint (*ssl_new)(SSL *s);\n\tvoid (*ssl_clear)(SSL *s);\n\tvoid (*ssl_free)(SSL *s);\n\tint (*ssl_accept)(SSL *s);\n\tint (*ssl_connect)(SSL *s);\n\tint (*ssl_read)(SSL *s,void *buf,int len);\n\tint (*ssl_peek)(SSL *s,void *buf,int len);\n\tint (*ssl_write)(SSL *s,const void *buf,int len);\n\tint (*ssl_shutdown)(SSL *s);\n\tint (*ssl_renegotiate)(SSL *s);\n\tint (*ssl_renegotiate_check)(SSL *s);\n\tlong (*ssl_get_message)(SSL *s, int st1, int stn, int mt, long\n\t\tmax, int *ok);\n\tint (*ssl_read_bytes)(SSL *s, int type, unsigned char *buf, int len, \n\t\tint peek);\n\tint (*ssl_write_bytes)(SSL *s, int type, const void *buf_, int len);\n\tint (*ssl_dispatch_alert)(SSL *s);\n\tlong (*ssl_ctrl)(SSL *s,int cmd,long larg,void *parg);\n\tlong (*ssl_ctx_ctrl)(SSL_CTX *ctx,int cmd,long larg,void *parg);\n\tSSL_CIPHER *(*get_cipher_by_char)(const unsigned char *ptr);\n\tint (*put_cipher_by_char)(const SSL_CIPHER *cipher,unsigned char *ptr);\n\tint (*ssl_pending)(const SSL *s);\n\tint (*num_ciphers)(void);\n\tSSL_CIPHER *(*get_cipher)(unsigned ncipher);\n\tstruct ssl_method_st *(*get_ssl_method)(int version);\n\tlong (*get_timeout)(void);\n\tstruct ssl3_enc_method *ssl3_enc; /* Extra SSLv3/TLS stuff */\n\tint (*ssl_version)(void);\n\tlong (*ssl_callback_ctrl)(SSL *s, int cb_id, void (*fp)(void));\n\tlong (*ssl_ctx_callback_ctrl)(SSL_CTX *s, int cb_id, void (*fp)(void));\n\t} SSL_METHOD;\n\n/* Lets make this into an ASN.1 type structure as follows\n * SSL_SESSION_ID ::= SEQUENCE {\n *\tversion \t\tINTEGER,\t-- structure version number\n *\tSSLversion \t\tINTEGER,\t-- SSL version number\n *\tCipher \t\t\tOCTET_STRING,\t-- the 3 byte cipher ID\n *\tSession_ID \t\tOCTET_STRING,\t-- the Session ID\n *\tMaster_key \t\tOCTET_STRING,\t-- the master key\n *\tKRB5_principal\t\tOCTET_STRING\t-- optional Kerberos principal\n *\tKey_Arg [ 0 ] IMPLICIT\tOCTET_STRING,\t-- the optional Key argument\n *\tTime [ 1 ] EXPLICIT\tINTEGER,\t-- optional Start Time\n *\tTimeout [ 2 ] EXPLICIT\tINTEGER,\t-- optional Timeout ins seconds\n *\tPeer [ 3 ] EXPLICIT\tX509,\t\t-- optional Peer Certificate\n *\tSession_ID_context [ 4 ] EXPLICIT OCTET_STRING,   -- the Session ID context\n *\tVerify_result [ 5 ] EXPLICIT INTEGER    -- X509_V_... code for `Peer'\n *\tCompression [6] IMPLICIT ASN1_OBJECT\t-- compression OID XXXXX\n *\t}\n * Look in ssl/ssl_asn1.c for more details\n * I'm using EXPLICIT tags so I can read the damn things using asn1parse :-).\n */\ntypedef struct ssl_session_st\n\t{\n\tint ssl_version;\t/* what ssl version session info is\n\t\t\t\t * being kept in here? */\n\n\t/* only really used in SSLv2 */\n\tunsigned int key_arg_length;\n\tunsigned char key_arg[SSL_MAX_KEY_ARG_LENGTH];\n\tint master_key_length;\n\tunsigned char master_key[SSL_MAX_MASTER_KEY_LENGTH];\n\t/* session_id - valid? */\n\tunsigned int session_id_length;\n\tunsigned char session_id[SSL_MAX_SSL_SESSION_ID_LENGTH];\n\t/* this is used to determine whether the session is being reused in\n\t * the appropriate context. It is up to the application to set this,\n\t * via SSL_new */\n\tunsigned int sid_ctx_length;\n\tunsigned char sid_ctx[SSL_MAX_SID_CTX_LENGTH];\n\n#ifndef OPENSSL_NO_KRB5\n        unsigned int krb5_client_princ_len;\n        unsigned char krb5_client_princ[SSL_MAX_KRB5_PRINCIPAL_LENGTH];\n#endif /* OPENSSL_NO_KRB5 */\n\n\tint not_resumable;\n\n\t/* The cert is the certificate used to establish this connection */\n\tstruct sess_cert_st /* SESS_CERT */ *sess_cert;\n\n\t/* This is the cert for the other end.\n\t * On clients, it will be the same as sess_cert->peer_key->x509\n\t * (the latter is not enough as sess_cert is not retained\n\t * in the external representation of sessions, see ssl_asn1.c). */\n\tX509 *peer;\n\t/* when app_verify_callback accepts a session where the peer's certificate\n\t * is not ok, we must remember the error for session reuse: */\n\tlong verify_result; /* only for servers */\n\n\tint references;\n\tlong timeout;\n\tlong time;\n\n\tint compress_meth;\t\t/* Need to lookup the method */\n\n\tSSL_CIPHER *cipher;\n\tunsigned long cipher_id;\t/* when ASN.1 loaded, this\n\t\t\t\t\t * needs to be used to load\n\t\t\t\t\t * the 'cipher' structure */\n\n\tSTACK_OF(SSL_CIPHER) *ciphers; /* shared ciphers? */\n\n\tCRYPTO_EX_DATA ex_data; /* application specific data */\n\n\t/* These are used to make removal of session-ids more\n\t * efficient and to implement a maximum cache size. */\n\tstruct ssl_session_st *prev,*next;\n#ifndef OPENSSL_NO_TLSEXT\n\tchar *tlsext_hostname;\n\t/* RFC4507 info */\n\tunsigned char *tlsext_tick;\t/* Session ticket */\n\tsize_t\ttlsext_ticklen;\t\t/* Session ticket length */\t\n\tlong tlsext_tick_lifetime_hint;\t/* Session lifetime hint in seconds */\n#endif\n\t} SSL_SESSION;\n\n\n#define SSL_OP_MICROSOFT_SESS_ID_BUG\t\t\t0x00000001L\n#define SSL_OP_NETSCAPE_CHALLENGE_BUG\t\t\t0x00000002L\n/* Allow initial connection to servers that don't support RI */\n#define SSL_OP_LEGACY_SERVER_CONNECT\t\t\t0x00000004L\n#define SSL_OP_NETSCAPE_REUSE_CIPHER_CHANGE_BUG\t\t0x00000008L\n#define SSL_OP_SSLREF2_REUSE_CERT_TYPE_BUG\t\t0x00000010L\n#define SSL_OP_MICROSOFT_BIG_SSLV3_BUFFER\t\t0x00000020L\n#define SSL_OP_MSIE_SSLV2_RSA_PADDING\t\t\t0x00000040L /* no effect since 0.9.7h and 0.9.8b */\n#define SSL_OP_SSLEAY_080_CLIENT_DH_BUG\t\t\t0x00000080L\n#define SSL_OP_TLS_D5_BUG\t\t\t\t0x00000100L\n#define SSL_OP_TLS_BLOCK_PADDING_BUG\t\t\t0x00000200L\n\n/* Disable SSL 3.0/TLS 1.0 CBC vulnerability workaround that was added\n * in OpenSSL 0.9.6d.  Usually (depending on the application protocol)\n * the workaround is not needed.  Unfortunately some broken SSL/TLS\n * implementations cannot handle it at all, which is why we include\n * it in SSL_OP_ALL. */\n#define SSL_OP_DONT_INSERT_EMPTY_FRAGMENTS              0x00000800L /* added in 0.9.6e */\n\n/* SSL_OP_ALL: various bug workarounds that should be rather harmless.\n *             This used to be 0x000FFFFFL before 0.9.7. */\n#define SSL_OP_ALL\t\t\t\t\t0x00000FFFL\n\n/* DTLS options */\n#define SSL_OP_NO_QUERY_MTU                 0x00001000L\n/* Turn on Cookie Exchange (on relevant for servers) */\n#define SSL_OP_COOKIE_EXCHANGE              0x00002000L\n/* Don't use RFC4507 ticket extension */\n#define SSL_OP_NO_TICKET\t            0x00004000L\n/* Use Cisco's \"speshul\" version of DTLS_BAD_VER (as client)  */\n#define SSL_OP_CISCO_ANYCONNECT\t\t    0x00008000L\n\n/* As server, disallow session resumption on renegotiation */\n#define SSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION\t0x00010000L\n/* Permit unsafe legacy renegotiation */\n#define SSL_OP_ALLOW_UNSAFE_LEGACY_RENEGOTIATION\t0x00040000L\n/* If set, always create a new key when using tmp_ecdh parameters */\n#define SSL_OP_SINGLE_ECDH_USE\t\t\t\t0x00080000L\n/* If set, always create a new key when using tmp_dh parameters */\n#define SSL_OP_SINGLE_DH_USE\t\t\t\t0x00100000L\n/* Set to always use the tmp_rsa key when doing RSA operations,\n * even when this violates protocol specs */\n#define SSL_OP_EPHEMERAL_RSA\t\t\t\t0x00200000L\n/* Set on servers to choose the cipher according to the server's\n * preferences */\n#define SSL_OP_CIPHER_SERVER_PREFERENCE\t\t\t0x00400000L\n/* If set, a server will allow a client to issue a SSLv3.0 version number\n * as latest version supported in the premaster secret, even when TLSv1.0\n * (version 3.1) was announced in the client hello. Normally this is\n * forbidden to prevent version rollback attacks. */\n#define SSL_OP_TLS_ROLLBACK_BUG\t\t\t\t0x00800000L\n\n#define SSL_OP_NO_SSLv2\t\t\t\t\t0x01000000L\n#define SSL_OP_NO_SSLv3\t\t\t\t\t0x02000000L\n#define SSL_OP_NO_TLSv1\t\t\t\t\t0x04000000L\n\n/* The next flag deliberately changes the ciphertest, this is a check\n * for the PKCS#1 attack */\n#define SSL_OP_PKCS1_CHECK_1\t\t\t\t0x08000000L\n#define SSL_OP_PKCS1_CHECK_2\t\t\t\t0x10000000L\n#define SSL_OP_NETSCAPE_CA_DN_BUG\t\t\t0x20000000L\n#define SSL_OP_NETSCAPE_DEMO_CIPHER_CHANGE_BUG\t\t0x40000000L\n\n\n/* Allow SSL_write(..., n) to return r with 0 < r < n (i.e. report success\n * when just a single record has been written): */\n#define SSL_MODE_ENABLE_PARTIAL_WRITE       0x00000001L\n/* Make it possible to retry SSL_write() with changed buffer location\n * (buffer contents must stay the same!); this is not the default to avoid\n * the misconception that non-blocking SSL_write() behaves like\n * non-blocking write(): */\n#define SSL_MODE_ACCEPT_MOVING_WRITE_BUFFER 0x00000002L\n/* Never bother the application with retries if the transport\n * is blocking: */\n#define SSL_MODE_AUTO_RETRY 0x00000004L\n/* Don't attempt to automatically build certificate chain */\n#define SSL_MODE_NO_AUTO_CHAIN 0x00000008L\n\n\n/* Note: SSL[_CTX]_set_{options,mode} use |= op on the previous value,\n * they cannot be used to clear bits. */\n\n#define SSL_CTX_set_options(ctx,op) \\\n\tSSL_CTX_ctrl((ctx),SSL_CTRL_OPTIONS,(op),NULL)\n#define SSL_CTX_clear_options(ctx,op) \\\n\tSSL_CTX_ctrl((ctx),SSL_CTRL_CLEAR_OPTIONS,(op),NULL)\n#define SSL_CTX_get_options(ctx) \\\n\tSSL_CTX_ctrl((ctx),SSL_CTRL_OPTIONS,0,NULL)\n#define SSL_set_options(ssl,op) \\\n\tSSL_ctrl((ssl),SSL_CTRL_OPTIONS,(op),NULL)\n#define SSL_clear_options(ssl,op) \\\n\tSSL_ctrl((ssl),SSL_CTRL_CLEAR_OPTIONS,(op),NULL)\n#define SSL_get_options(ssl) \\\n        SSL_ctrl((ssl),SSL_CTRL_OPTIONS,0,NULL)\n\n#define SSL_CTX_set_mode(ctx,op) \\\n\tSSL_CTX_ctrl((ctx),SSL_CTRL_MODE,(op),NULL)\n#define SSL_CTX_clear_mode(ctx,op) \\\n\tSSL_CTX_ctrl((ctx),SSL_CTRL_CLEAR_MODE,(op),NULL)\n#define SSL_CTX_get_mode(ctx) \\\n\tSSL_CTX_ctrl((ctx),SSL_CTRL_MODE,0,NULL)\n#define SSL_clear_mode(ssl,op) \\\n\tSSL_ctrl((ssl),SSL_CTRL_CLEAR_MODE,(op),NULL)\n#define SSL_set_mode(ssl,op) \\\n\tSSL_ctrl((ssl),SSL_CTRL_MODE,(op),NULL)\n#define SSL_get_mode(ssl) \\\n        SSL_ctrl((ssl),SSL_CTRL_MODE,0,NULL)\n#define SSL_set_mtu(ssl, mtu) \\\n        SSL_ctrl((ssl),SSL_CTRL_SET_MTU,(mtu),NULL)\n\n#define SSL_get_secure_renegotiation_support(ssl) \\\n\tSSL_ctrl((ssl), SSL_CTRL_GET_RI_SUPPORT, 0, NULL)\n\nvoid 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));\nvoid 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));\n#define SSL_CTX_set_msg_callback_arg(ctx, arg) SSL_CTX_ctrl((ctx), SSL_CTRL_SET_MSG_CALLBACK_ARG, 0, (arg))\n#define SSL_set_msg_callback_arg(ssl, arg) SSL_ctrl((ssl), SSL_CTRL_SET_MSG_CALLBACK_ARG, 0, (arg))\n\n\n\n#if defined(OPENSSL_SYS_MSDOS) && !defined(OPENSSL_SYS_WIN32)\n#define SSL_MAX_CERT_LIST_DEFAULT 1024*30 /* 30k max cert list :-) */\n#else\n#define SSL_MAX_CERT_LIST_DEFAULT 1024*100 /* 100k max cert list :-) */\n#endif\n\n#define SSL_SESSION_CACHE_MAX_SIZE_DEFAULT\t(1024*20)\n\n/* This callback type is used inside SSL_CTX, SSL, and in the functions that set\n * them. It is used to override the generation of SSL/TLS session IDs in a\n * server. Return value should be zero on an error, non-zero to proceed. Also,\n * callbacks should themselves check if the id they generate is unique otherwise\n * the SSL handshake will fail with an error - callbacks can do this using the\n * 'ssl' value they're passed by;\n *      SSL_has_matching_session_id(ssl, id, *id_len)\n * The length value passed in is set at the maximum size the session ID can be.\n * In SSLv2 this is 16 bytes, whereas SSLv3/TLSv1 it is 32 bytes. The callback\n * can alter this length to be less if desired, but under SSLv2 session IDs are\n * supposed to be fixed at 16 bytes so the id will be padded after the callback\n * returns in this case. It is also an error for the callback to set the size to\n * zero. */\ntypedef int (*GEN_SESSION_CB)(const SSL *ssl, unsigned char *id,\n\t\t\t\tunsigned int *id_len);\n\ntypedef struct ssl_comp_st\n\t{\n\tint id;\n\tconst char *name;\n#ifndef OPENSSL_NO_COMP\n\tCOMP_METHOD *method;\n#else\n\tchar *method;\n#endif\n\t} SSL_COMP;\n\nDECLARE_STACK_OF(SSL_COMP)\n\nstruct ssl_ctx_st\n\t{\n\tSSL_METHOD *method;\n\n\tSTACK_OF(SSL_CIPHER) *cipher_list;\n\t/* same as above but sorted for lookup */\n\tSTACK_OF(SSL_CIPHER) *cipher_list_by_id;\n\n\tstruct x509_store_st /* X509_STORE */ *cert_store;\n\tstruct lhash_st /* LHASH */ *sessions;\t/* a set of SSL_SESSIONs */\n\t/* Most session-ids that will be cached, default is\n\t * SSL_SESSION_CACHE_MAX_SIZE_DEFAULT. 0 is unlimited. */\n\tunsigned long session_cache_size;\n\tstruct ssl_session_st *session_cache_head;\n\tstruct ssl_session_st *session_cache_tail;\n\n\t/* This can have one of 2 values, ored together,\n\t * SSL_SESS_CACHE_CLIENT,\n\t * SSL_SESS_CACHE_SERVER,\n\t * Default is SSL_SESSION_CACHE_SERVER, which means only\n\t * SSL_accept which cache SSL_SESSIONS. */\n\tint session_cache_mode;\n\n\t/* If timeout is not 0, it is the default timeout value set\n\t * when SSL_new() is called.  This has been put in to make\n\t * life easier to set things up */\n\tlong session_timeout;\n\n\t/* If this callback is not null, it will be called each\n\t * time a session id is added to the cache.  If this function\n\t * returns 1, it means that the callback will do a\n\t * SSL_SESSION_free() when it has finished using it.  Otherwise,\n\t * on 0, it means the callback has finished with it.\n\t * If remove_session_cb is not null, it will be called when\n\t * a session-id is removed from the cache.  After the call,\n\t * OpenSSL will SSL_SESSION_free() it. */\n\tint (*new_session_cb)(struct ssl_st *ssl,SSL_SESSION *sess);\n\tvoid (*remove_session_cb)(struct ssl_ctx_st *ctx,SSL_SESSION *sess);\n\tSSL_SESSION *(*get_session_cb)(struct ssl_st *ssl,\n\t\tunsigned char *data,int len,int *copy);\n\n\tstruct\n\t\t{\n\t\tint sess_connect;\t/* SSL new conn - started */\n\t\tint sess_connect_renegotiate;/* SSL reneg - requested */\n\t\tint sess_connect_good;\t/* SSL new conne/reneg - finished */\n\t\tint sess_accept;\t/* SSL new accept - started */\n\t\tint sess_accept_renegotiate;/* SSL reneg - requested */\n\t\tint sess_accept_good;\t/* SSL accept/reneg - finished */\n\t\tint sess_miss;\t\t/* session lookup misses  */\n\t\tint sess_timeout;\t/* reuse attempt on timeouted session */\n\t\tint sess_cache_full;\t/* session removed due to full cache */\n\t\tint sess_hit;\t\t/* session reuse actually done */\n\t\tint sess_cb_hit;\t/* session-id that was not\n\t\t\t\t\t * in the cache was\n\t\t\t\t\t * passed back via the callback.  This\n\t\t\t\t\t * indicates that the application is\n\t\t\t\t\t * supplying session-id's from other\n\t\t\t\t\t * processes - spooky :-) */\n\t\t} stats;\n\n\tint references;\n\n\t/* if defined, these override the X509_verify_cert() calls */\n\tint (*app_verify_callback)(X509_STORE_CTX *, void *);\n\tvoid *app_verify_arg;\n\t/* before OpenSSL 0.9.7, 'app_verify_arg' was ignored\n\t * ('app_verify_callback' was called with just one argument) */\n\n\t/* Default password callback. */\n\tpem_password_cb *default_passwd_callback;\n\n\t/* Default password callback user data. */\n\tvoid *default_passwd_callback_userdata;\n\n\t/* get client cert callback */\n\tint (*client_cert_cb)(SSL *ssl, X509 **x509, EVP_PKEY **pkey);\n\n    /* cookie generate callback */\n    int (*app_gen_cookie_cb)(SSL *ssl, unsigned char *cookie, \n        unsigned int *cookie_len);\n\n    /* verify cookie callback */\n    int (*app_verify_cookie_cb)(SSL *ssl, unsigned char *cookie, \n        unsigned int cookie_len);\n\n\tCRYPTO_EX_DATA ex_data;\n\n\tconst EVP_MD *rsa_md5;/* For SSLv2 - name is 'ssl2-md5' */\n\tconst EVP_MD *md5;\t/* For SSLv3/TLSv1 'ssl3-md5' */\n\tconst EVP_MD *sha1;   /* For SSLv3/TLSv1 'ssl3->sha1' */\n\n\tSTACK_OF(X509) *extra_certs;\n\tSTACK_OF(SSL_COMP) *comp_methods; /* stack of SSL_COMP, SSLv3/TLSv1 */\n\n\n\t/* Default values used when no per-SSL value is defined follow */\n\n\tvoid (*info_callback)(const SSL *ssl,int type,int val); /* used if SSL's info_callback is NULL */\n\n\t/* what we put in client cert requests */\n\tSTACK_OF(X509_NAME) *client_CA;\n\n\n\t/* Default values to use in SSL structures follow (these are copied by SSL_new) */\n\n\tunsigned long options;\n\tunsigned long mode;\n\tlong max_cert_list;\n\n\tstruct cert_st /* CERT */ *cert;\n\tint read_ahead;\n\n\t/* callback that allows applications to peek at protocol messages */\n\tvoid (*msg_callback)(int write_p, int version, int content_type, const void *buf, size_t len, SSL *ssl, void *arg);\n\tvoid *msg_callback_arg;\n\n\tint verify_mode;\n\tunsigned int sid_ctx_length;\n\tunsigned char sid_ctx[SSL_MAX_SID_CTX_LENGTH];\n\tint (*default_verify_callback)(int ok,X509_STORE_CTX *ctx); /* called 'verify_callback' in the SSL */\n\n\t/* Default generate session ID callback. */\n\tGEN_SESSION_CB generate_session_id;\n\n\tX509_VERIFY_PARAM *param;\n\n#if 0\n\tint purpose;\t\t/* Purpose setting */\n\tint trust;\t\t/* Trust setting */\n#endif\n\n\tint quiet_shutdown;\n\n#ifndef OPENSSL_ENGINE\n\t/* Engine to pass requests for client certs to\n\t */\n\tENGINE *client_cert_engine;\n#endif\n\n#ifndef OPENSSL_NO_TLSEXT\n\t/* TLS extensions servername callback */\n\tint (*tlsext_servername_callback)(SSL*, int *, void *);\n\tvoid *tlsext_servername_arg;\n\t/* RFC 4507 session ticket keys */\n\tunsigned char tlsext_tick_key_name[16];\n\tunsigned char tlsext_tick_hmac_key[16];\n\tunsigned char tlsext_tick_aes_key[16];\n\t/* Callback to support customisation of ticket key setting */\n\tint (*tlsext_ticket_key_cb)(SSL *ssl,\n\t\t\t\t\tunsigned char *name, unsigned char *iv,\n\t\t\t\t\tEVP_CIPHER_CTX *ectx,\n\t\t\t\t\tHMAC_CTX *hctx, int enc);\n\n\t/* certificate status request info */\n\t/* Callback for status request */\n\tint (*tlsext_status_cb)(SSL *ssl, void *arg);\n\tvoid *tlsext_status_arg;\n#endif\n\n\t};\n\n#define SSL_SESS_CACHE_OFF\t\t\t0x0000\n#define SSL_SESS_CACHE_CLIENT\t\t\t0x0001\n#define SSL_SESS_CACHE_SERVER\t\t\t0x0002\n#define SSL_SESS_CACHE_BOTH\t(SSL_SESS_CACHE_CLIENT|SSL_SESS_CACHE_SERVER)\n#define SSL_SESS_CACHE_NO_AUTO_CLEAR\t\t0x0080\n/* enough comments already ... see SSL_CTX_set_session_cache_mode(3) */\n#define SSL_SESS_CACHE_NO_INTERNAL_LOOKUP\t0x0100\n#define SSL_SESS_CACHE_NO_INTERNAL_STORE\t0x0200\n#define SSL_SESS_CACHE_NO_INTERNAL \\\n\t(SSL_SESS_CACHE_NO_INTERNAL_LOOKUP|SSL_SESS_CACHE_NO_INTERNAL_STORE)\n\n  struct lhash_st *SSL_CTX_sessions(SSL_CTX *ctx);\n#define SSL_CTX_sess_number(ctx) \\\n\tSSL_CTX_ctrl(ctx,SSL_CTRL_SESS_NUMBER,0,NULL)\n#define SSL_CTX_sess_connect(ctx) \\\n\tSSL_CTX_ctrl(ctx,SSL_CTRL_SESS_CONNECT,0,NULL)\n#define SSL_CTX_sess_connect_good(ctx) \\\n\tSSL_CTX_ctrl(ctx,SSL_CTRL_SESS_CONNECT_GOOD,0,NULL)\n#define SSL_CTX_sess_connect_renegotiate(ctx) \\\n\tSSL_CTX_ctrl(ctx,SSL_CTRL_SESS_CONNECT_RENEGOTIATE,0,NULL)\n#define SSL_CTX_sess_accept(ctx) \\\n\tSSL_CTX_ctrl(ctx,SSL_CTRL_SESS_ACCEPT,0,NULL)\n#define SSL_CTX_sess_accept_renegotiate(ctx) \\\n\tSSL_CTX_ctrl(ctx,SSL_CTRL_SESS_ACCEPT_RENEGOTIATE,0,NULL)\n#define SSL_CTX_sess_accept_good(ctx) \\\n\tSSL_CTX_ctrl(ctx,SSL_CTRL_SESS_ACCEPT_GOOD,0,NULL)\n#define SSL_CTX_sess_hits(ctx) \\\n\tSSL_CTX_ctrl(ctx,SSL_CTRL_SESS_HIT,0,NULL)\n#define SSL_CTX_sess_cb_hits(ctx) \\\n\tSSL_CTX_ctrl(ctx,SSL_CTRL_SESS_CB_HIT,0,NULL)\n#define SSL_CTX_sess_misses(ctx) \\\n\tSSL_CTX_ctrl(ctx,SSL_CTRL_SESS_MISSES,0,NULL)\n#define SSL_CTX_sess_timeouts(ctx) \\\n\tSSL_CTX_ctrl(ctx,SSL_CTRL_SESS_TIMEOUTS,0,NULL)\n#define SSL_CTX_sess_cache_full(ctx) \\\n\tSSL_CTX_ctrl(ctx,SSL_CTRL_SESS_CACHE_FULL,0,NULL)\n\nvoid SSL_CTX_sess_set_new_cb(SSL_CTX *ctx, int (*new_session_cb)(struct ssl_st *ssl,SSL_SESSION *sess));\nint (*SSL_CTX_sess_get_new_cb(SSL_CTX *ctx))(struct ssl_st *ssl, SSL_SESSION *sess);\nvoid SSL_CTX_sess_set_remove_cb(SSL_CTX *ctx, void (*remove_session_cb)(struct ssl_ctx_st *ctx,SSL_SESSION *sess));\nvoid (*SSL_CTX_sess_get_remove_cb(SSL_CTX *ctx))(struct ssl_ctx_st *ctx, SSL_SESSION *sess);\nvoid 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));\nSSL_SESSION *(*SSL_CTX_sess_get_get_cb(SSL_CTX *ctx))(struct ssl_st *ssl, unsigned char *Data, int len, int *copy);\nvoid SSL_CTX_set_info_callback(SSL_CTX *ctx, void (*cb)(const SSL *ssl,int type,int val));\nvoid (*SSL_CTX_get_info_callback(SSL_CTX *ctx))(const SSL *ssl,int type,int val);\nvoid SSL_CTX_set_client_cert_cb(SSL_CTX *ctx, int (*client_cert_cb)(SSL *ssl, X509 **x509, EVP_PKEY **pkey));\nint (*SSL_CTX_get_client_cert_cb(SSL_CTX *ctx))(SSL *ssl, X509 **x509, EVP_PKEY **pkey);\n#ifndef OPENSSL_NO_ENGINE\nint SSL_CTX_set_client_cert_engine(SSL_CTX *ctx, ENGINE *e);\n#endif\nvoid SSL_CTX_set_cookie_generate_cb(SSL_CTX *ctx, int (*app_gen_cookie_cb)(SSL *ssl, unsigned char *cookie, unsigned int *cookie_len));\nvoid SSL_CTX_set_cookie_verify_cb(SSL_CTX *ctx, int (*app_verify_cookie_cb)(SSL *ssl, unsigned char *cookie, unsigned int cookie_len));\n\n#define SSL_NOTHING\t1\n#define SSL_WRITING\t2\n#define SSL_READING\t3\n#define SSL_X509_LOOKUP\t4\n\n/* These will only be used when doing non-blocking IO */\n#define SSL_want_nothing(s)\t(SSL_want(s) == SSL_NOTHING)\n#define SSL_want_read(s)\t(SSL_want(s) == SSL_READING)\n#define SSL_want_write(s)\t(SSL_want(s) == SSL_WRITING)\n#define SSL_want_x509_lookup(s)\t(SSL_want(s) == SSL_X509_LOOKUP)\n\nstruct ssl_st\n\t{\n\t/* protocol version\n\t * (one of SSL2_VERSION, SSL3_VERSION, TLS1_VERSION, DTLS1_VERSION)\n\t */\n\tint version;\n\tint type; /* SSL_ST_CONNECT or SSL_ST_ACCEPT */\n\n\tSSL_METHOD *method; /* SSLv3 */\n\n\t/* There are 2 BIO's even though they are normally both the\n\t * same.  This is so data can be read and written to different\n\t * handlers */\n\n#ifndef OPENSSL_NO_BIO\n\tBIO *rbio; /* used by SSL_read */\n\tBIO *wbio; /* used by SSL_write */\n\tBIO *bbio; /* used during session-id reuse to concatenate\n\t\t    * messages */\n#else\n\tchar *rbio; /* used by SSL_read */\n\tchar *wbio; /* used by SSL_write */\n\tchar *bbio;\n#endif\n\t/* This holds a variable that indicates what we were doing\n\t * when a 0 or -1 is returned.  This is needed for\n\t * non-blocking IO so we know what request needs re-doing when\n\t * in SSL_accept or SSL_connect */\n\tint rwstate;\n\n\t/* true when we are actually in SSL_accept() or SSL_connect() */\n\tint in_handshake;\n\tint (*handshake_func)(SSL *);\n\n\t/* Imagine that here's a boolean member \"init\" that is\n\t * switched as soon as SSL_set_{accept/connect}_state\n\t * is called for the first time, so that \"state\" and\n\t * \"handshake_func\" are properly initialized.  But as\n\t * handshake_func is == 0 until then, we use this\n\t * test instead of an \"init\" member.\n\t */\n\n\tint server;\t/* are we the server side? - mostly used by SSL_clear*/\n\n\tint new_session;/* 1 if we are to use a new session.\n\t                 * 2 if we are a server and are inside a handshake\n\t                 *   (i.e. not just sending a HelloRequest)\n\t                 * NB: For servers, the 'new' session may actually be a previously\n\t                 * cached session or even the previous session unless\n\t                 * SSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION is set */\n\tint quiet_shutdown;/* don't send shutdown packets */\n\tint shutdown;\t/* we have shut things down, 0x01 sent, 0x02\n\t\t\t * for received */\n\tint state;\t/* where we are */\n\tint rstate;\t/* where we are when reading */\n\n\tBUF_MEM *init_buf;\t/* buffer used during init */\n\tvoid *init_msg;   \t/* pointer to handshake message body, set by ssl3_get_message() */\n\tint init_num;\t\t/* amount read/written */\n\tint init_off;\t\t/* amount read/written */\n\n\t/* used internally to point at a raw packet */\n\tunsigned char *packet;\n\tunsigned int packet_length;\n\n\tstruct ssl2_state_st *s2; /* SSLv2 variables */\n\tstruct ssl3_state_st *s3; /* SSLv3 variables */\n\tstruct dtls1_state_st *d1; /* DTLSv1 variables */\n\n\tint read_ahead;\t\t/* Read as many input bytes as possible\n\t               \t \t * (for non-blocking reads) */\n\n\t/* callback that allows applications to peek at protocol messages */\n\tvoid (*msg_callback)(int write_p, int version, int content_type, const void *buf, size_t len, SSL *ssl, void *arg);\n\tvoid *msg_callback_arg;\n\n\tint hit;\t\t/* reusing a previous session */\n\n\tX509_VERIFY_PARAM *param;\n\n#if 0\n\tint purpose;\t\t/* Purpose setting */\n\tint trust;\t\t/* Trust setting */\n#endif\n\n\t/* crypto */\n\tSTACK_OF(SSL_CIPHER) *cipher_list;\n\tSTACK_OF(SSL_CIPHER) *cipher_list_by_id;\n\n\t/* These are the ones being used, the ones in SSL_SESSION are\n\t * the ones to be 'copied' into these ones */\n\n\tEVP_CIPHER_CTX *enc_read_ctx;\t\t/* cryptographic state */\n\tconst EVP_MD *read_hash;\t\t/* used for mac generation */\n#ifndef OPENSSL_NO_COMP\n\tCOMP_CTX *expand;\t\t\t/* uncompress */\n#else\n\tchar *expand;\n#endif\n\n\tEVP_CIPHER_CTX *enc_write_ctx;\t\t/* cryptographic state */\n\tconst EVP_MD *write_hash;\t\t/* used for mac generation */\n#ifndef OPENSSL_NO_COMP\n\tCOMP_CTX *compress;\t\t\t/* compression */\n#else\n\tchar *compress;\t\n#endif\n\n\t/* session info */\n\n\t/* client cert? */\n\t/* This is used to hold the server certificate used */\n\tstruct cert_st /* CERT */ *cert;\n\n\t/* the session_id_context is used to ensure sessions are only reused\n\t * in the appropriate context */\n\tunsigned int sid_ctx_length;\n\tunsigned char sid_ctx[SSL_MAX_SID_CTX_LENGTH];\n\n\t/* This can also be in the session once a session is established */\n\tSSL_SESSION *session;\n\n\t/* Default generate session ID callback. */\n\tGEN_SESSION_CB generate_session_id;\n\n\t/* Used in SSL2 and SSL3 */\n\tint verify_mode;\t/* 0 don't care about verify failure.\n\t\t\t\t * 1 fail if verify fails */\n\tint (*verify_callback)(int ok,X509_STORE_CTX *ctx); /* fail if callback returns 0 */\n\n\tvoid (*info_callback)(const SSL *ssl,int type,int val); /* optional informational callback */\n\n\tint error;\t\t/* error bytes to be written */\n\tint error_code;\t\t/* actual code */\n\n#ifndef OPENSSL_NO_KRB5\n\tKSSL_CTX *kssl_ctx;     /* Kerberos 5 context */\n#endif\t/* OPENSSL_NO_KRB5 */\n\n\tSSL_CTX *ctx;\n\t/* set this flag to 1 and a sleep(1) is put into all SSL_read()\n\t * and SSL_write() calls, good for nbio debuging :-) */\n\tint debug;\t\n\n\t/* extra application data */\n\tlong verify_result;\n\tCRYPTO_EX_DATA ex_data;\n\n\t/* for server side, keep the list of CA_dn we can use */\n\tSTACK_OF(X509_NAME) *client_CA;\n\n\tint references;\n\tunsigned long options; /* protocol behaviour */\n\tunsigned long mode; /* API behaviour */\n\tlong max_cert_list;\n\tint first_packet;\n\tint client_version;\t/* what was passed, used for\n\t\t\t\t * SSLv3/TLS rollback check */\n#ifndef OPENSSL_NO_TLSEXT\n\t/* TLS extension debug callback */\n\tvoid (*tlsext_debug_cb)(SSL *s, int client_server, int type,\n\t\t\t\t\tunsigned char *data, int len,\n\t\t\t\t\tvoid *arg);\n\tvoid *tlsext_debug_arg;\n\tchar *tlsext_hostname;\n\tint servername_done;   /* no further mod of servername \n\t                          0 : call the servername extension callback.\n\t                          1 : prepare 2, allow last ack just after in server callback.\n\t                          2 : don't call servername callback, no ack in server hello\n\t                       */\n\t/* certificate status request info */\n\t/* Status type or -1 if no status type */\n\tint tlsext_status_type;\n\t/* Expect OCSP CertificateStatus message */\n\tint tlsext_status_expected;\n\t/* OCSP status request only */\n\tSTACK_OF(OCSP_RESPID) *tlsext_ocsp_ids;\n\tX509_EXTENSIONS *tlsext_ocsp_exts;\n\t/* OCSP response received or to be sent */\n\tunsigned char *tlsext_ocsp_resp;\n\tint tlsext_ocsp_resplen;\n\n\t/* RFC4507 session ticket expected to be received or sent */\n\tint tlsext_ticket_expected;\n\tSSL_CTX * initial_ctx; /* initial ctx, used to store sessions */\n#define session_ctx initial_ctx\n#else\n#define session_ctx ctx\n#endif\n\t};\n\n#ifdef __cplusplus\n}\n#endif\n\n#include <openssl/ssl2.h>\n#include <openssl/ssl3.h>\n#include <openssl/tls1.h> /* This is mostly sslv3 with a few tweaks */\n#include <openssl/dtls1.h> /* Datagram TLS */\n#include <openssl/ssl23.h>\n\n#ifdef  __cplusplus\nextern \"C\" {\n#endif\n\n/* compatibility */\n#define SSL_set_app_data(s,arg)\t\t(SSL_set_ex_data(s,0,(char *)arg))\n#define SSL_get_app_data(s)\t\t(SSL_get_ex_data(s,0))\n#define SSL_SESSION_set_app_data(s,a)\t(SSL_SESSION_set_ex_data(s,0,(char *)a))\n#define SSL_SESSION_get_app_data(s)\t(SSL_SESSION_get_ex_data(s,0))\n#define SSL_CTX_get_app_data(ctx)\t(SSL_CTX_get_ex_data(ctx,0))\n#define SSL_CTX_set_app_data(ctx,arg)\t(SSL_CTX_set_ex_data(ctx,0,(char *)arg))\n\n/* The following are the possible values for ssl->state are are\n * used to indicate where we are up to in the SSL connection establishment.\n * The macros that follow are about the only things you should need to use\n * and even then, only when using non-blocking IO.\n * It can also be useful to work out where you were when the connection\n * failed */\n\n#define SSL_ST_CONNECT\t\t\t0x1000\n#define SSL_ST_ACCEPT\t\t\t0x2000\n#define SSL_ST_MASK\t\t\t0x0FFF\n#define SSL_ST_INIT\t\t\t(SSL_ST_CONNECT|SSL_ST_ACCEPT)\n#define SSL_ST_BEFORE\t\t\t0x4000\n#define SSL_ST_OK\t\t\t0x03\n#define SSL_ST_RENEGOTIATE\t\t(0x04|SSL_ST_INIT)\n\n#define SSL_CB_LOOP\t\t\t0x01\n#define SSL_CB_EXIT\t\t\t0x02\n#define SSL_CB_READ\t\t\t0x04\n#define SSL_CB_WRITE\t\t\t0x08\n#define SSL_CB_ALERT\t\t\t0x4000 /* used in callback */\n#define SSL_CB_READ_ALERT\t\t(SSL_CB_ALERT|SSL_CB_READ)\n#define SSL_CB_WRITE_ALERT\t\t(SSL_CB_ALERT|SSL_CB_WRITE)\n#define SSL_CB_ACCEPT_LOOP\t\t(SSL_ST_ACCEPT|SSL_CB_LOOP)\n#define SSL_CB_ACCEPT_EXIT\t\t(SSL_ST_ACCEPT|SSL_CB_EXIT)\n#define SSL_CB_CONNECT_LOOP\t\t(SSL_ST_CONNECT|SSL_CB_LOOP)\n#define SSL_CB_CONNECT_EXIT\t\t(SSL_ST_CONNECT|SSL_CB_EXIT)\n#define SSL_CB_HANDSHAKE_START\t\t0x10\n#define SSL_CB_HANDSHAKE_DONE\t\t0x20\n\n/* Is the SSL_connection established? */\n#define SSL_get_state(a)\t\tSSL_state(a)\n#define SSL_is_init_finished(a)\t\t(SSL_state(a) == SSL_ST_OK)\n#define SSL_in_init(a)\t\t\t(SSL_state(a)&SSL_ST_INIT)\n#define SSL_in_before(a)\t\t(SSL_state(a)&SSL_ST_BEFORE)\n#define SSL_in_connect_init(a)\t\t(SSL_state(a)&SSL_ST_CONNECT)\n#define SSL_in_accept_init(a)\t\t(SSL_state(a)&SSL_ST_ACCEPT)\n\n/* The following 2 states are kept in ssl->rstate when reads fail,\n * you should not need these */\n#define SSL_ST_READ_HEADER\t\t\t0xF0\n#define SSL_ST_READ_BODY\t\t\t0xF1\n#define SSL_ST_READ_DONE\t\t\t0xF2\n\n/* Obtain latest Finished message\n *   -- that we sent (SSL_get_finished)\n *   -- that we expected from peer (SSL_get_peer_finished).\n * Returns length (0 == no Finished so far), copies up to 'count' bytes. */\nsize_t SSL_get_finished(const SSL *s, void *buf, size_t count);\nsize_t SSL_get_peer_finished(const SSL *s, void *buf, size_t count);\n\n/* use either SSL_VERIFY_NONE or SSL_VERIFY_PEER, the last 2 options\n * are 'ored' with SSL_VERIFY_PEER if they are desired */\n#define SSL_VERIFY_NONE\t\t\t0x00\n#define SSL_VERIFY_PEER\t\t\t0x01\n#define SSL_VERIFY_FAIL_IF_NO_PEER_CERT\t0x02\n#define SSL_VERIFY_CLIENT_ONCE\t\t0x04\n\n#define OpenSSL_add_ssl_algorithms()\tSSL_library_init()\n#define SSLeay_add_ssl_algorithms()\tSSL_library_init()\n\n/* this is for backward compatibility */\n#if 0 /* NEW_SSLEAY */\n#define SSL_CTX_set_default_verify(a,b,c) SSL_CTX_set_verify(a,b,c)\n#define SSL_set_pref_cipher(c,n)\tSSL_set_cipher_list(c,n)\n#define SSL_add_session(a,b)            SSL_CTX_add_session((a),(b))\n#define SSL_remove_session(a,b)\t\tSSL_CTX_remove_session((a),(b))\n#define SSL_flush_sessions(a,b)\t\tSSL_CTX_flush_sessions((a),(b))\n#endif\n/* More backward compatibility */\n#define SSL_get_cipher(s) \\\n\t\tSSL_CIPHER_get_name(SSL_get_current_cipher(s))\n#define SSL_get_cipher_bits(s,np) \\\n\t\tSSL_CIPHER_get_bits(SSL_get_current_cipher(s),np)\n#define SSL_get_cipher_version(s) \\\n\t\tSSL_CIPHER_get_version(SSL_get_current_cipher(s))\n#define SSL_get_cipher_name(s) \\\n\t\tSSL_CIPHER_get_name(SSL_get_current_cipher(s))\n#define SSL_get_time(a)\t\tSSL_SESSION_get_time(a)\n#define SSL_set_time(a,b)\tSSL_SESSION_set_time((a),(b))\n#define SSL_get_timeout(a)\tSSL_SESSION_get_timeout(a)\n#define SSL_set_timeout(a,b)\tSSL_SESSION_set_timeout((a),(b))\n\n#if 1 /*SSLEAY_MACROS*/\n#define d2i_SSL_SESSION_bio(bp,s_id) ASN1_d2i_bio_of(SSL_SESSION,SSL_SESSION_new,d2i_SSL_SESSION,bp,s_id)\n#define i2d_SSL_SESSION_bio(bp,s_id) ASN1_i2d_bio_of(SSL_SESSION,i2d_SSL_SESSION,bp,s_id)\n#define PEM_read_SSL_SESSION(fp,x,cb,u) (SSL_SESSION *)PEM_ASN1_read( \\\n\t(char *(*)())d2i_SSL_SESSION,PEM_STRING_SSL_SESSION,fp,(char **)x,cb,u)\n#define PEM_read_bio_SSL_SESSION(bp,x,cb,u) PEM_ASN1_read_bio_of(SSL_SESSION,d2i_SSL_SESSION,PEM_STRING_SSL_SESSION,bp,x,cb,u)\n#define PEM_write_SSL_SESSION(fp,x) \\\n\tPEM_ASN1_write((int (*)())i2d_SSL_SESSION, \\\n\t\tPEM_STRING_SSL_SESSION,fp, (char *)x, NULL,NULL,0,NULL,NULL)\n#define PEM_write_bio_SSL_SESSION(bp,x) \\\n\tPEM_ASN1_write_bio_of(SSL_SESSION,i2d_SSL_SESSION,PEM_STRING_SSL_SESSION,bp,x,NULL,NULL,0,NULL,NULL)\n#endif\n\n#define SSL_AD_REASON_OFFSET\t\t1000\n/* These alert types are for SSLv3 and TLSv1 */\n#define SSL_AD_CLOSE_NOTIFY\t\tSSL3_AD_CLOSE_NOTIFY\n#define SSL_AD_UNEXPECTED_MESSAGE\tSSL3_AD_UNEXPECTED_MESSAGE /* fatal */\n#define SSL_AD_BAD_RECORD_MAC\t\tSSL3_AD_BAD_RECORD_MAC     /* fatal */\n#define SSL_AD_DECRYPTION_FAILED\tTLS1_AD_DECRYPTION_FAILED\n#define SSL_AD_RECORD_OVERFLOW\t\tTLS1_AD_RECORD_OVERFLOW\n#define SSL_AD_DECOMPRESSION_FAILURE\tSSL3_AD_DECOMPRESSION_FAILURE/* fatal */\n#define SSL_AD_HANDSHAKE_FAILURE\tSSL3_AD_HANDSHAKE_FAILURE/* fatal */\n#define SSL_AD_NO_CERTIFICATE\t\tSSL3_AD_NO_CERTIFICATE /* Not for TLS */\n#define SSL_AD_BAD_CERTIFICATE\t\tSSL3_AD_BAD_CERTIFICATE\n#define SSL_AD_UNSUPPORTED_CERTIFICATE\tSSL3_AD_UNSUPPORTED_CERTIFICATE\n#define SSL_AD_CERTIFICATE_REVOKED\tSSL3_AD_CERTIFICATE_REVOKED\n#define SSL_AD_CERTIFICATE_EXPIRED\tSSL3_AD_CERTIFICATE_EXPIRED\n#define SSL_AD_CERTIFICATE_UNKNOWN\tSSL3_AD_CERTIFICATE_UNKNOWN\n#define SSL_AD_ILLEGAL_PARAMETER\tSSL3_AD_ILLEGAL_PARAMETER   /* fatal */\n#define SSL_AD_UNKNOWN_CA\t\tTLS1_AD_UNKNOWN_CA\t/* fatal */\n#define SSL_AD_ACCESS_DENIED\t\tTLS1_AD_ACCESS_DENIED\t/* fatal */\n#define SSL_AD_DECODE_ERROR\t\tTLS1_AD_DECODE_ERROR\t/* fatal */\n#define SSL_AD_DECRYPT_ERROR\t\tTLS1_AD_DECRYPT_ERROR\n#define SSL_AD_EXPORT_RESTRICTION\tTLS1_AD_EXPORT_RESTRICTION/* fatal */\n#define SSL_AD_PROTOCOL_VERSION\t\tTLS1_AD_PROTOCOL_VERSION /* fatal */\n#define SSL_AD_INSUFFICIENT_SECURITY\tTLS1_AD_INSUFFICIENT_SECURITY/* fatal */\n#define SSL_AD_INTERNAL_ERROR\t\tTLS1_AD_INTERNAL_ERROR\t/* fatal */\n#define SSL_AD_USER_CANCELLED\t\tTLS1_AD_USER_CANCELLED\n#define SSL_AD_NO_RENEGOTIATION\t\tTLS1_AD_NO_RENEGOTIATION\n#define SSL_AD_UNSUPPORTED_EXTENSION\tTLS1_AD_UNSUPPORTED_EXTENSION\n#define SSL_AD_CERTIFICATE_UNOBTAINABLE TLS1_AD_CERTIFICATE_UNOBTAINABLE\n#define SSL_AD_UNRECOGNIZED_NAME\tTLS1_AD_UNRECOGNIZED_NAME\n#define SSL_AD_BAD_CERTIFICATE_STATUS_RESPONSE TLS1_AD_BAD_CERTIFICATE_STATUS_RESPONSE\n\n#define SSL_ERROR_NONE\t\t\t0\n#define SSL_ERROR_SSL\t\t\t1\n#define SSL_ERROR_WANT_READ\t\t2\n#define SSL_ERROR_WANT_WRITE\t\t3\n#define SSL_ERROR_WANT_X509_LOOKUP\t4\n#define SSL_ERROR_SYSCALL\t\t5 /* look at error stack/return value/errno */\n#define SSL_ERROR_ZERO_RETURN\t\t6\n#define SSL_ERROR_WANT_CONNECT\t\t7\n#define SSL_ERROR_WANT_ACCEPT\t\t8\n\n#define SSL_CTRL_NEED_TMP_RSA\t\t\t1\n#define SSL_CTRL_SET_TMP_RSA\t\t\t2\n#define SSL_CTRL_SET_TMP_DH\t\t\t3\n#define SSL_CTRL_SET_TMP_ECDH\t\t\t4\n#define SSL_CTRL_SET_TMP_RSA_CB\t\t\t5\n#define SSL_CTRL_SET_TMP_DH_CB\t\t\t6\n#define SSL_CTRL_SET_TMP_ECDH_CB\t\t7\n\n#define SSL_CTRL_GET_SESSION_REUSED\t\t8\n#define SSL_CTRL_GET_CLIENT_CERT_REQUEST\t9\n#define SSL_CTRL_GET_NUM_RENEGOTIATIONS\t\t10\n#define SSL_CTRL_CLEAR_NUM_RENEGOTIATIONS\t11\n#define SSL_CTRL_GET_TOTAL_RENEGOTIATIONS\t12\n#define SSL_CTRL_GET_FLAGS\t\t\t13\n#define SSL_CTRL_EXTRA_CHAIN_CERT\t\t14\n\n#define SSL_CTRL_SET_MSG_CALLBACK               15\n#define SSL_CTRL_SET_MSG_CALLBACK_ARG           16\n\n/* only applies to datagram connections */\n#define SSL_CTRL_SET_MTU                17\n/* Stats */\n#define SSL_CTRL_SESS_NUMBER\t\t\t20\n#define SSL_CTRL_SESS_CONNECT\t\t\t21\n#define SSL_CTRL_SESS_CONNECT_GOOD\t\t22\n#define SSL_CTRL_SESS_CONNECT_RENEGOTIATE\t23\n#define SSL_CTRL_SESS_ACCEPT\t\t\t24\n#define SSL_CTRL_SESS_ACCEPT_GOOD\t\t25\n#define SSL_CTRL_SESS_ACCEPT_RENEGOTIATE\t26\n#define SSL_CTRL_SESS_HIT\t\t\t27\n#define SSL_CTRL_SESS_CB_HIT\t\t\t28\n#define SSL_CTRL_SESS_MISSES\t\t\t29\n#define SSL_CTRL_SESS_TIMEOUTS\t\t\t30\n#define SSL_CTRL_SESS_CACHE_FULL\t\t31\n#define SSL_CTRL_OPTIONS\t\t\t32\n#define SSL_CTRL_MODE\t\t\t\t33\n\n#define SSL_CTRL_GET_READ_AHEAD\t\t\t40\n#define SSL_CTRL_SET_READ_AHEAD\t\t\t41\n#define SSL_CTRL_SET_SESS_CACHE_SIZE\t\t42\n#define SSL_CTRL_GET_SESS_CACHE_SIZE\t\t43\n#define SSL_CTRL_SET_SESS_CACHE_MODE\t\t44\n#define SSL_CTRL_GET_SESS_CACHE_MODE\t\t45\n\n#define SSL_CTRL_GET_MAX_CERT_LIST\t\t50\n#define SSL_CTRL_SET_MAX_CERT_LIST\t\t51\n\n/* see tls1.h for macros based on these */\n#ifndef OPENSSL_NO_TLSEXT\n#define SSL_CTRL_SET_TLSEXT_SERVERNAME_CB\t53\n#define SSL_CTRL_SET_TLSEXT_SERVERNAME_ARG\t54\n#define SSL_CTRL_SET_TLSEXT_HOSTNAME\t\t55\n#define SSL_CTRL_SET_TLSEXT_DEBUG_CB\t\t56\n#define SSL_CTRL_SET_TLSEXT_DEBUG_ARG\t\t57\n#define SSL_CTRL_GET_TLSEXT_TICKET_KEYS\t\t58\n#define SSL_CTRL_SET_TLSEXT_TICKET_KEYS\t\t59\n\n#define SSL_CTRL_SET_TLSEXT_STATUS_REQ_CB\t63\n#define SSL_CTRL_SET_TLSEXT_STATUS_REQ_CB_ARG\t64\n#define SSL_CTRL_SET_TLSEXT_STATUS_REQ_TYPE\t65\n#define SSL_CTRL_GET_TLSEXT_STATUS_REQ_EXTS\t66\n#define SSL_CTRL_SET_TLSEXT_STATUS_REQ_EXTS\t67\n#define SSL_CTRL_GET_TLSEXT_STATUS_REQ_IDS\t68\n#define SSL_CTRL_SET_TLSEXT_STATUS_REQ_IDS\t69\n#define SSL_CTRL_GET_TLSEXT_STATUS_REQ_OCSP_RESP\t70\n#define SSL_CTRL_SET_TLSEXT_STATUS_REQ_OCSP_RESP\t71\n\n#define SSL_CTRL_SET_TLSEXT_TICKET_KEY_CB\t72\n#endif\n\n#define DTLS_CTRL_GET_TIMEOUT\t\t73\n#define DTLS_CTRL_HANDLE_TIMEOUT\t74\n#define DTLS_CTRL_LISTEN\t\t\t75\n\n#define SSL_CTRL_GET_RI_SUPPORT\t\t\t76\n#define SSL_CTRL_CLEAR_OPTIONS\t\t\t77\n#define SSL_CTRL_CLEAR_MODE\t\t\t78\n\n#define DTLSv1_get_timeout(ssl, arg) \\\n\tSSL_ctrl(ssl,DTLS_CTRL_GET_TIMEOUT,0, (void *)arg)\n#define DTLSv1_handle_timeout(ssl) \\\n\tSSL_ctrl(ssl,DTLS_CTRL_HANDLE_TIMEOUT,0, NULL)\n#define DTLSv1_listen(ssl, peer) \\\n\tSSL_ctrl(ssl,DTLS_CTRL_LISTEN,0, (void *)peer)\n\n#define SSL_session_reused(ssl) \\\n\tSSL_ctrl((ssl),SSL_CTRL_GET_SESSION_REUSED,0,NULL)\n#define SSL_num_renegotiations(ssl) \\\n\tSSL_ctrl((ssl),SSL_CTRL_GET_NUM_RENEGOTIATIONS,0,NULL)\n#define SSL_clear_num_renegotiations(ssl) \\\n\tSSL_ctrl((ssl),SSL_CTRL_CLEAR_NUM_RENEGOTIATIONS,0,NULL)\n#define SSL_total_renegotiations(ssl) \\\n\tSSL_ctrl((ssl),SSL_CTRL_GET_TOTAL_RENEGOTIATIONS,0,NULL)\n\n#define SSL_CTX_need_tmp_RSA(ctx) \\\n\tSSL_CTX_ctrl(ctx,SSL_CTRL_NEED_TMP_RSA,0,NULL)\n#define SSL_CTX_set_tmp_rsa(ctx,rsa) \\\n\tSSL_CTX_ctrl(ctx,SSL_CTRL_SET_TMP_RSA,0,(char *)rsa)\n#define SSL_CTX_set_tmp_dh(ctx,dh) \\\n\tSSL_CTX_ctrl(ctx,SSL_CTRL_SET_TMP_DH,0,(char *)dh)\n#define SSL_CTX_set_tmp_ecdh(ctx,ecdh) \\\n\tSSL_CTX_ctrl(ctx,SSL_CTRL_SET_TMP_ECDH,0,(char *)ecdh)\n\n#define SSL_need_tmp_RSA(ssl) \\\n\tSSL_ctrl(ssl,SSL_CTRL_NEED_TMP_RSA,0,NULL)\n#define SSL_set_tmp_rsa(ssl,rsa) \\\n\tSSL_ctrl(ssl,SSL_CTRL_SET_TMP_RSA,0,(char *)rsa)\n#define SSL_set_tmp_dh(ssl,dh) \\\n\tSSL_ctrl(ssl,SSL_CTRL_SET_TMP_DH,0,(char *)dh)\n#define SSL_set_tmp_ecdh(ssl,ecdh) \\\n\tSSL_ctrl(ssl,SSL_CTRL_SET_TMP_ECDH,0,(char *)ecdh)\n\n#define SSL_CTX_add_extra_chain_cert(ctx,x509) \\\n\tSSL_CTX_ctrl(ctx,SSL_CTRL_EXTRA_CHAIN_CERT,0,(char *)x509)\n\n#ifndef OPENSSL_NO_BIO\nBIO_METHOD *BIO_f_ssl(void);\nBIO *BIO_new_ssl(SSL_CTX *ctx,int client);\nBIO *BIO_new_ssl_connect(SSL_CTX *ctx);\nBIO *BIO_new_buffer_ssl_connect(SSL_CTX *ctx);\nint BIO_ssl_copy_session_id(BIO *to,BIO *from);\nvoid BIO_ssl_shutdown(BIO *ssl_bio);\n\n#endif\n\nint\tSSL_CTX_set_cipher_list(SSL_CTX *,const char *str);\nSSL_CTX *SSL_CTX_new(SSL_METHOD *meth);\nvoid\tSSL_CTX_free(SSL_CTX *);\nlong SSL_CTX_set_timeout(SSL_CTX *ctx,long t);\nlong SSL_CTX_get_timeout(const SSL_CTX *ctx);\nX509_STORE *SSL_CTX_get_cert_store(const SSL_CTX *);\nvoid SSL_CTX_set_cert_store(SSL_CTX *,X509_STORE *);\nint SSL_want(const SSL *s);\nint\tSSL_clear(SSL *s);\n\nvoid\tSSL_CTX_flush_sessions(SSL_CTX *ctx,long tm);\n\nSSL_CIPHER *SSL_get_current_cipher(const SSL *s);\nint\tSSL_CIPHER_get_bits(const SSL_CIPHER *c,int *alg_bits);\nchar *\tSSL_CIPHER_get_version(const SSL_CIPHER *c);\nconst char *\tSSL_CIPHER_get_name(const SSL_CIPHER *c);\n\nint\tSSL_get_fd(const SSL *s);\nint\tSSL_get_rfd(const SSL *s);\nint\tSSL_get_wfd(const SSL *s);\nconst char  * SSL_get_cipher_list(const SSL *s,int n);\nchar *\tSSL_get_shared_ciphers(const SSL *s, char *buf, int len);\nint\tSSL_get_read_ahead(const SSL * s);\nint\tSSL_pending(const SSL *s);\n#ifndef OPENSSL_NO_SOCK\nint\tSSL_set_fd(SSL *s, int fd);\nint\tSSL_set_rfd(SSL *s, int fd);\nint\tSSL_set_wfd(SSL *s, int fd);\n#endif\n#ifndef OPENSSL_NO_BIO\nvoid\tSSL_set_bio(SSL *s, BIO *rbio,BIO *wbio);\nBIO *\tSSL_get_rbio(const SSL *s);\nBIO *\tSSL_get_wbio(const SSL *s);\n#endif\nint\tSSL_set_cipher_list(SSL *s, const char *str);\nvoid\tSSL_set_read_ahead(SSL *s, int yes);\nint\tSSL_get_verify_mode(const SSL *s);\nint\tSSL_get_verify_depth(const SSL *s);\nint\t(*SSL_get_verify_callback(const SSL *s))(int,X509_STORE_CTX *);\nvoid\tSSL_set_verify(SSL *s, int mode,\n\t\t       int (*callback)(int ok,X509_STORE_CTX *ctx));\nvoid\tSSL_set_verify_depth(SSL *s, int depth);\n#ifndef OPENSSL_NO_RSA\nint\tSSL_use_RSAPrivateKey(SSL *ssl, RSA *rsa);\n#endif\nint\tSSL_use_RSAPrivateKey_ASN1(SSL *ssl, unsigned char *d, long len);\nint\tSSL_use_PrivateKey(SSL *ssl, EVP_PKEY *pkey);\nint\tSSL_use_PrivateKey_ASN1(int pk,SSL *ssl, const unsigned char *d, long len);\nint\tSSL_use_certificate(SSL *ssl, X509 *x);\nint\tSSL_use_certificate_ASN1(SSL *ssl, const unsigned char *d, int len);\n\n#ifndef OPENSSL_NO_STDIO\nint\tSSL_use_RSAPrivateKey_file(SSL *ssl, const char *file, int type);\nint\tSSL_use_PrivateKey_file(SSL *ssl, const char *file, int type);\nint\tSSL_use_certificate_file(SSL *ssl, const char *file, int type);\nint\tSSL_CTX_use_RSAPrivateKey_file(SSL_CTX *ctx, const char *file, int type);\nint\tSSL_CTX_use_PrivateKey_file(SSL_CTX *ctx, const char *file, int type);\nint\tSSL_CTX_use_certificate_file(SSL_CTX *ctx, const char *file, int type);\nint\tSSL_CTX_use_certificate_chain_file(SSL_CTX *ctx, const char *file); /* PEM type */\nSTACK_OF(X509_NAME) *SSL_load_client_CA_file(const char *file);\nint\tSSL_add_file_cert_subjects_to_stack(STACK_OF(X509_NAME) *stackCAs,\n\t\t\t\t\t    const char *file);\n#ifndef OPENSSL_SYS_VMS\n#ifndef OPENSSL_SYS_MACINTOSH_CLASSIC /* XXXXX: Better scheme needed! [was: #ifndef MAC_OS_pre_X] */\nint\tSSL_add_dir_cert_subjects_to_stack(STACK_OF(X509_NAME) *stackCAs,\n\t\t\t\t\t   const char *dir);\n#endif\n#endif\n\n#endif\n\nvoid\tSSL_load_error_strings(void );\nconst char *SSL_state_string(const SSL *s);\nconst char *SSL_rstate_string(const SSL *s);\nconst char *SSL_state_string_long(const SSL *s);\nconst char *SSL_rstate_string_long(const SSL *s);\nlong\tSSL_SESSION_get_time(const SSL_SESSION *s);\nlong\tSSL_SESSION_set_time(SSL_SESSION *s, long t);\nlong\tSSL_SESSION_get_timeout(const SSL_SESSION *s);\nlong\tSSL_SESSION_set_timeout(SSL_SESSION *s, long t);\nvoid\tSSL_copy_session_id(SSL *to,const SSL *from);\n\nSSL_SESSION *SSL_SESSION_new(void);\nunsigned long SSL_SESSION_hash(const SSL_SESSION *a);\nint\tSSL_SESSION_cmp(const SSL_SESSION *a,const SSL_SESSION *b);\nconst unsigned char *SSL_SESSION_get_id(const SSL_SESSION *s, unsigned int *len);\n#ifndef OPENSSL_NO_FP_API\nint\tSSL_SESSION_print_fp(FILE *fp,const SSL_SESSION *ses);\n#endif\n#ifndef OPENSSL_NO_BIO\nint\tSSL_SESSION_print(BIO *fp,const SSL_SESSION *ses);\n#endif\nvoid\tSSL_SESSION_free(SSL_SESSION *ses);\nint\ti2d_SSL_SESSION(SSL_SESSION *in,unsigned char **pp);\nint\tSSL_set_session(SSL *to, SSL_SESSION *session);\nint\tSSL_CTX_add_session(SSL_CTX *s, SSL_SESSION *c);\nint\tSSL_CTX_remove_session(SSL_CTX *,SSL_SESSION *c);\nint\tSSL_CTX_set_generate_session_id(SSL_CTX *, GEN_SESSION_CB);\nint\tSSL_set_generate_session_id(SSL *, GEN_SESSION_CB);\nint\tSSL_has_matching_session_id(const SSL *ssl, const unsigned char *id,\n\t\t\t\t\tunsigned int id_len);\nSSL_SESSION *d2i_SSL_SESSION(SSL_SESSION **a,const unsigned char **pp,\n\t\t\t     long length);\n\n#ifdef HEADER_X509_H\nX509 *\tSSL_get_peer_certificate(const SSL *s);\n#endif\n\nSTACK_OF(X509) *SSL_get_peer_cert_chain(const SSL *s);\n\nint SSL_CTX_get_verify_mode(const SSL_CTX *ctx);\nint SSL_CTX_get_verify_depth(const SSL_CTX *ctx);\nint (*SSL_CTX_get_verify_callback(const SSL_CTX *ctx))(int,X509_STORE_CTX *);\nvoid SSL_CTX_set_verify(SSL_CTX *ctx,int mode,\n\t\t\tint (*callback)(int, X509_STORE_CTX *));\nvoid SSL_CTX_set_verify_depth(SSL_CTX *ctx,int depth);\nvoid SSL_CTX_set_cert_verify_callback(SSL_CTX *ctx, int (*cb)(X509_STORE_CTX *,void *), void *arg);\n#ifndef OPENSSL_NO_RSA\nint SSL_CTX_use_RSAPrivateKey(SSL_CTX *ctx, RSA *rsa);\n#endif\nint SSL_CTX_use_RSAPrivateKey_ASN1(SSL_CTX *ctx, const unsigned char *d, long len);\nint SSL_CTX_use_PrivateKey(SSL_CTX *ctx, EVP_PKEY *pkey);\nint SSL_CTX_use_PrivateKey_ASN1(int pk,SSL_CTX *ctx,\n\tconst unsigned char *d, long len);\nint SSL_CTX_use_certificate(SSL_CTX *ctx, X509 *x);\nint SSL_CTX_use_certificate_ASN1(SSL_CTX *ctx, int len, const unsigned char *d);\n\nvoid SSL_CTX_set_default_passwd_cb(SSL_CTX *ctx, pem_password_cb *cb);\nvoid SSL_CTX_set_default_passwd_cb_userdata(SSL_CTX *ctx, void *u);\n\nint SSL_CTX_check_private_key(const SSL_CTX *ctx);\nint SSL_check_private_key(const SSL *ctx);\n\nint\tSSL_CTX_set_session_id_context(SSL_CTX *ctx,const unsigned char *sid_ctx,\n\t\t\t\t       unsigned int sid_ctx_len);\n\nSSL *\tSSL_new(SSL_CTX *ctx);\nint\tSSL_set_session_id_context(SSL *ssl,const unsigned char *sid_ctx,\n\t\t\t\t   unsigned int sid_ctx_len);\n\nint SSL_CTX_set_purpose(SSL_CTX *s, int purpose);\nint SSL_set_purpose(SSL *s, int purpose);\nint SSL_CTX_set_trust(SSL_CTX *s, int trust);\nint SSL_set_trust(SSL *s, int trust);\n\nvoid\tSSL_free(SSL *ssl);\nint \tSSL_accept(SSL *ssl);\nint \tSSL_connect(SSL *ssl);\nint \tSSL_read(SSL *ssl,void *buf,int num);\nint \tSSL_peek(SSL *ssl,void *buf,int num);\nint \tSSL_write(SSL *ssl,const void *buf,int num);\nlong\tSSL_ctrl(SSL *ssl,int cmd, long larg, void *parg);\nlong\tSSL_callback_ctrl(SSL *, int, void (*)(void));\nlong\tSSL_CTX_ctrl(SSL_CTX *ctx,int cmd, long larg, void *parg);\nlong\tSSL_CTX_callback_ctrl(SSL_CTX *, int, void (*)(void));\n\nint\tSSL_get_error(const SSL *s,int ret_code);\nconst char *SSL_get_version(const SSL *s);\n\n/* This sets the 'default' SSL version that SSL_new() will create */\nint SSL_CTX_set_ssl_version(SSL_CTX *ctx,SSL_METHOD *meth);\n\nSSL_METHOD *SSLv2_method(void);\t\t/* SSLv2 */\nSSL_METHOD *SSLv2_server_method(void);\t/* SSLv2 */\nSSL_METHOD *SSLv2_client_method(void);\t/* SSLv2 */\n\nSSL_METHOD *SSLv3_method(void);\t\t/* SSLv3 */\nSSL_METHOD *SSLv3_server_method(void);\t/* SSLv3 */\nSSL_METHOD *SSLv3_client_method(void);\t/* SSLv3 */\n\nSSL_METHOD *SSLv23_method(void);\t/* SSLv3 but can rollback to v2 */\nSSL_METHOD *SSLv23_server_method(void);\t/* SSLv3 but can rollback to v2 */\nSSL_METHOD *SSLv23_client_method(void);\t/* SSLv3 but can rollback to v2 */\n\nSSL_METHOD *TLSv1_method(void);\t\t/* TLSv1.0 */\nSSL_METHOD *TLSv1_server_method(void);\t/* TLSv1.0 */\nSSL_METHOD *TLSv1_client_method(void);\t/* TLSv1.0 */\n\nSSL_METHOD *DTLSv1_method(void);\t\t/* DTLSv1.0 */\nSSL_METHOD *DTLSv1_server_method(void);\t/* DTLSv1.0 */\nSSL_METHOD *DTLSv1_client_method(void);\t/* DTLSv1.0 */\n\nSTACK_OF(SSL_CIPHER) *SSL_get_ciphers(const SSL *s);\n\nint SSL_do_handshake(SSL *s);\nint SSL_renegotiate(SSL *s);\nint SSL_renegotiate_pending(SSL *s);\nint SSL_shutdown(SSL *s);\n\nSSL_METHOD *SSL_get_ssl_method(SSL *s);\nint SSL_set_ssl_method(SSL *s,SSL_METHOD *method);\nconst char *SSL_alert_type_string_long(int value);\nconst char *SSL_alert_type_string(int value);\nconst char *SSL_alert_desc_string_long(int value);\nconst char *SSL_alert_desc_string(int value);\n\nvoid SSL_set_client_CA_list(SSL *s, STACK_OF(X509_NAME) *name_list);\nvoid SSL_CTX_set_client_CA_list(SSL_CTX *ctx, STACK_OF(X509_NAME) *name_list);\nSTACK_OF(X509_NAME) *SSL_get_client_CA_list(const SSL *s);\nSTACK_OF(X509_NAME) *SSL_CTX_get_client_CA_list(const SSL_CTX *s);\nint SSL_add_client_CA(SSL *ssl,X509 *x);\nint SSL_CTX_add_client_CA(SSL_CTX *ctx,X509 *x);\n\nvoid SSL_set_connect_state(SSL *s);\nvoid SSL_set_accept_state(SSL *s);\n\nlong SSL_get_default_timeout(const SSL *s);\n\nint SSL_library_init(void );\n\nchar *SSL_CIPHER_description(const SSL_CIPHER *,char *buf,int size);\nSTACK_OF(X509_NAME) *SSL_dup_CA_list(STACK_OF(X509_NAME) *sk);\n\nSSL *SSL_dup(SSL *ssl);\n\nX509 *SSL_get_certificate(const SSL *ssl);\n/* EVP_PKEY */ struct evp_pkey_st *SSL_get_privatekey(SSL *ssl);\n\nvoid SSL_CTX_set_quiet_shutdown(SSL_CTX *ctx,int mode);\nint SSL_CTX_get_quiet_shutdown(const SSL_CTX *ctx);\nvoid SSL_set_quiet_shutdown(SSL *ssl,int mode);\nint SSL_get_quiet_shutdown(const SSL *ssl);\nvoid SSL_set_shutdown(SSL *ssl,int mode);\nint SSL_get_shutdown(const SSL *ssl);\nint SSL_version(const SSL *ssl);\nint SSL_CTX_set_default_verify_paths(SSL_CTX *ctx);\nint SSL_CTX_load_verify_locations(SSL_CTX *ctx, const char *CAfile,\n\tconst char *CApath);\n#define SSL_get0_session SSL_get_session /* just peek at pointer */\nSSL_SESSION *SSL_get_session(const SSL *ssl);\nSSL_SESSION *SSL_get1_session(SSL *ssl); /* obtain a reference count */\nSSL_CTX *SSL_get_SSL_CTX(const SSL *ssl);\nSSL_CTX *SSL_set_SSL_CTX(SSL *ssl, SSL_CTX* ctx);\nvoid SSL_set_info_callback(SSL *ssl,\n\t\t\t   void (*cb)(const SSL *ssl,int type,int val));\nvoid (*SSL_get_info_callback(const SSL *ssl))(const SSL *ssl,int type,int val);\nint SSL_state(const SSL *ssl);\n\nvoid SSL_set_verify_result(SSL *ssl,long v);\nlong SSL_get_verify_result(const SSL *ssl);\n\nint SSL_set_ex_data(SSL *ssl,int idx,void *data);\nvoid *SSL_get_ex_data(const SSL *ssl,int idx);\nint SSL_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func,\n\tCRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func);\n\nint SSL_SESSION_set_ex_data(SSL_SESSION *ss,int idx,void *data);\nvoid *SSL_SESSION_get_ex_data(const SSL_SESSION *ss,int idx);\nint SSL_SESSION_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func,\n\tCRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func);\n\nint SSL_CTX_set_ex_data(SSL_CTX *ssl,int idx,void *data);\nvoid *SSL_CTX_get_ex_data(const SSL_CTX *ssl,int idx);\nint SSL_CTX_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func,\n\tCRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func);\n\nint SSL_get_ex_data_X509_STORE_CTX_idx(void );\n\n#define SSL_CTX_sess_set_cache_size(ctx,t) \\\n\tSSL_CTX_ctrl(ctx,SSL_CTRL_SET_SESS_CACHE_SIZE,t,NULL)\n#define SSL_CTX_sess_get_cache_size(ctx) \\\n\tSSL_CTX_ctrl(ctx,SSL_CTRL_GET_SESS_CACHE_SIZE,0,NULL)\n#define SSL_CTX_set_session_cache_mode(ctx,m) \\\n\tSSL_CTX_ctrl(ctx,SSL_CTRL_SET_SESS_CACHE_MODE,m,NULL)\n#define SSL_CTX_get_session_cache_mode(ctx) \\\n\tSSL_CTX_ctrl(ctx,SSL_CTRL_GET_SESS_CACHE_MODE,0,NULL)\n\n#define SSL_CTX_get_default_read_ahead(ctx) SSL_CTX_get_read_ahead(ctx)\n#define SSL_CTX_set_default_read_ahead(ctx,m) SSL_CTX_set_read_ahead(ctx,m)\n#define SSL_CTX_get_read_ahead(ctx) \\\n\tSSL_CTX_ctrl(ctx,SSL_CTRL_GET_READ_AHEAD,0,NULL)\n#define SSL_CTX_set_read_ahead(ctx,m) \\\n\tSSL_CTX_ctrl(ctx,SSL_CTRL_SET_READ_AHEAD,m,NULL)\n#define SSL_CTX_get_max_cert_list(ctx) \\\n\tSSL_CTX_ctrl(ctx,SSL_CTRL_GET_MAX_CERT_LIST,0,NULL)\n#define SSL_CTX_set_max_cert_list(ctx,m) \\\n\tSSL_CTX_ctrl(ctx,SSL_CTRL_SET_MAX_CERT_LIST,m,NULL)\n#define SSL_get_max_cert_list(ssl) \\\n\tSSL_ctrl(ssl,SSL_CTRL_GET_MAX_CERT_LIST,0,NULL)\n#define SSL_set_max_cert_list(ssl,m) \\\n\tSSL_ctrl(ssl,SSL_CTRL_SET_MAX_CERT_LIST,m,NULL)\n\n     /* NB: the keylength is only applicable when is_export is true */\n#ifndef OPENSSL_NO_RSA\nvoid SSL_CTX_set_tmp_rsa_callback(SSL_CTX *ctx,\n\t\t\t\t  RSA *(*cb)(SSL *ssl,int is_export,\n\t\t\t\t\t     int keylength));\n\nvoid SSL_set_tmp_rsa_callback(SSL *ssl,\n\t\t\t\t  RSA *(*cb)(SSL *ssl,int is_export,\n\t\t\t\t\t     int keylength));\n#endif\n#ifndef OPENSSL_NO_DH\nvoid SSL_CTX_set_tmp_dh_callback(SSL_CTX *ctx,\n\t\t\t\t DH *(*dh)(SSL *ssl,int is_export,\n\t\t\t\t\t   int keylength));\nvoid SSL_set_tmp_dh_callback(SSL *ssl,\n\t\t\t\t DH *(*dh)(SSL *ssl,int is_export,\n\t\t\t\t\t   int keylength));\n#endif\n#ifndef OPENSSL_NO_ECDH\nvoid SSL_CTX_set_tmp_ecdh_callback(SSL_CTX *ctx,\n\t\t\t\t EC_KEY *(*ecdh)(SSL *ssl,int is_export,\n\t\t\t\t\t   int keylength));\nvoid SSL_set_tmp_ecdh_callback(SSL *ssl,\n\t\t\t\t EC_KEY *(*ecdh)(SSL *ssl,int is_export,\n\t\t\t\t\t   int keylength));\n#endif\n\n#ifndef OPENSSL_NO_COMP\nconst COMP_METHOD *SSL_get_current_compression(SSL *s);\nconst COMP_METHOD *SSL_get_current_expansion(SSL *s);\nconst char *SSL_COMP_get_name(const COMP_METHOD *comp);\nSTACK_OF(SSL_COMP) *SSL_COMP_get_compression_methods(void);\nint SSL_COMP_add_compression_method(int id,COMP_METHOD *cm);\n#else\nconst void *SSL_get_current_compression(SSL *s);\nconst void *SSL_get_current_expansion(SSL *s);\nconst char *SSL_COMP_get_name(const void *comp);\nvoid *SSL_COMP_get_compression_methods(void);\nint SSL_COMP_add_compression_method(int id,void *cm);\n#endif\n\n/* BEGIN ERROR CODES */\n/* The following lines are auto generated by the script mkerr.pl. Any changes\n * made after this point may be overwritten when the script is next run.\n */\nvoid ERR_load_SSL_strings(void);\n\n/* Error codes for the SSL functions. */\n\n/* Function codes. */\n#define SSL_F_CLIENT_CERTIFICATE\t\t\t 100\n#define SSL_F_CLIENT_FINISHED\t\t\t\t 167\n#define SSL_F_CLIENT_HELLO\t\t\t\t 101\n#define SSL_F_CLIENT_MASTER_KEY\t\t\t\t 102\n#define SSL_F_D2I_SSL_SESSION\t\t\t\t 103\n#define SSL_F_DO_DTLS1_WRITE\t\t\t\t 245\n#define SSL_F_DO_SSL3_WRITE\t\t\t\t 104\n#define SSL_F_DTLS1_ACCEPT\t\t\t\t 246\n#define SSL_F_DTLS1_ADD_CERT_TO_BUF\t\t\t 280\n#define SSL_F_DTLS1_BUFFER_RECORD\t\t\t 247\n#define SSL_F_DTLS1_CLIENT_HELLO\t\t\t 248\n#define SSL_F_DTLS1_CONNECT\t\t\t\t 249\n#define SSL_F_DTLS1_ENC\t\t\t\t\t 250\n#define SSL_F_DTLS1_GET_HELLO_VERIFY\t\t\t 251\n#define SSL_F_DTLS1_GET_MESSAGE\t\t\t\t 252\n#define SSL_F_DTLS1_GET_MESSAGE_FRAGMENT\t\t 253\n#define SSL_F_DTLS1_GET_RECORD\t\t\t\t 254\n#define SSL_F_DTLS1_HANDLE_TIMEOUT\t\t\t 282\n#define SSL_F_DTLS1_OUTPUT_CERT_CHAIN\t\t\t 255\n#define SSL_F_DTLS1_PREPROCESS_FRAGMENT\t\t\t 277\n#define SSL_F_DTLS1_PROCESS_OUT_OF_SEQ_MESSAGE\t\t 256\n#define SSL_F_DTLS1_PROCESS_RECORD\t\t\t 257\n#define SSL_F_DTLS1_READ_BYTES\t\t\t\t 258\n#define SSL_F_DTLS1_READ_FAILED\t\t\t\t 259\n#define SSL_F_DTLS1_SEND_CERTIFICATE_REQUEST\t\t 260\n#define SSL_F_DTLS1_SEND_CLIENT_CERTIFICATE\t\t 261\n#define SSL_F_DTLS1_SEND_CLIENT_KEY_EXCHANGE\t\t 262\n#define SSL_F_DTLS1_SEND_CLIENT_VERIFY\t\t\t 263\n#define SSL_F_DTLS1_SEND_HELLO_VERIFY_REQUEST\t\t 264\n#define SSL_F_DTLS1_SEND_SERVER_CERTIFICATE\t\t 265\n#define SSL_F_DTLS1_SEND_SERVER_HELLO\t\t\t 266\n#define SSL_F_DTLS1_SEND_SERVER_KEY_EXCHANGE\t\t 267\n#define SSL_F_DTLS1_WRITE_APP_DATA_BYTES\t\t 268\n#define SSL_F_GET_CLIENT_FINISHED\t\t\t 105\n#define SSL_F_GET_CLIENT_HELLO\t\t\t\t 106\n#define SSL_F_GET_CLIENT_MASTER_KEY\t\t\t 107\n#define SSL_F_GET_SERVER_FINISHED\t\t\t 108\n#define SSL_F_GET_SERVER_HELLO\t\t\t\t 109\n#define SSL_F_GET_SERVER_VERIFY\t\t\t\t 110\n#define SSL_F_I2D_SSL_SESSION\t\t\t\t 111\n#define SSL_F_READ_N\t\t\t\t\t 112\n#define SSL_F_REQUEST_CERTIFICATE\t\t\t 113\n#define SSL_F_SERVER_FINISH\t\t\t\t 239\n#define SSL_F_SERVER_HELLO\t\t\t\t 114\n#define SSL_F_SERVER_VERIFY\t\t\t\t 240\n#define SSL_F_SSL23_ACCEPT\t\t\t\t 115\n#define SSL_F_SSL23_CLIENT_HELLO\t\t\t 116\n#define SSL_F_SSL23_CONNECT\t\t\t\t 117\n#define SSL_F_SSL23_GET_CLIENT_HELLO\t\t\t 118\n#define SSL_F_SSL23_GET_SERVER_HELLO\t\t\t 119\n#define SSL_F_SSL23_PEEK\t\t\t\t 237\n#define SSL_F_SSL23_READ\t\t\t\t 120\n#define SSL_F_SSL23_WRITE\t\t\t\t 121\n#define SSL_F_SSL2_ACCEPT\t\t\t\t 122\n#define SSL_F_SSL2_CONNECT\t\t\t\t 123\n#define SSL_F_SSL2_ENC_INIT\t\t\t\t 124\n#define SSL_F_SSL2_GENERATE_KEY_MATERIAL\t\t 241\n#define SSL_F_SSL2_PEEK\t\t\t\t\t 234\n#define SSL_F_SSL2_READ\t\t\t\t\t 125\n#define SSL_F_SSL2_READ_INTERNAL\t\t\t 236\n#define SSL_F_SSL2_SET_CERTIFICATE\t\t\t 126\n#define SSL_F_SSL2_WRITE\t\t\t\t 127\n#define SSL_F_SSL3_ACCEPT\t\t\t\t 128\n#define SSL_F_SSL3_ADD_CERT_TO_BUF\t\t\t 281\n#define SSL_F_SSL3_CALLBACK_CTRL\t\t\t 233\n#define SSL_F_SSL3_CHANGE_CIPHER_STATE\t\t\t 129\n#define SSL_F_SSL3_CHECK_CERT_AND_ALGORITHM\t\t 130\n#define SSL_F_SSL3_CLIENT_HELLO\t\t\t\t 131\n#define SSL_F_SSL3_CONNECT\t\t\t\t 132\n#define SSL_F_SSL3_CTRL\t\t\t\t\t 213\n#define SSL_F_SSL3_CTX_CTRL\t\t\t\t 133\n#define SSL_F_SSL3_DO_CHANGE_CIPHER_SPEC\t\t 279\n#define SSL_F_SSL3_ENC\t\t\t\t\t 134\n#define SSL_F_SSL3_GENERATE_KEY_BLOCK\t\t\t 238\n#define SSL_F_SSL3_GET_CERTIFICATE_REQUEST\t\t 135\n#define SSL_F_SSL3_GET_CERT_STATUS\t\t\t 288\n#define SSL_F_SSL3_GET_CERT_VERIFY\t\t\t 136\n#define SSL_F_SSL3_GET_CLIENT_CERTIFICATE\t\t 137\n#define SSL_F_SSL3_GET_CLIENT_HELLO\t\t\t 138\n#define SSL_F_SSL3_GET_CLIENT_KEY_EXCHANGE\t\t 139\n#define SSL_F_SSL3_GET_FINISHED\t\t\t\t 140\n#define SSL_F_SSL3_GET_KEY_EXCHANGE\t\t\t 141\n#define SSL_F_SSL3_GET_MESSAGE\t\t\t\t 142\n#define SSL_F_SSL3_GET_NEW_SESSION_TICKET\t\t 283\n#define SSL_F_SSL3_GET_RECORD\t\t\t\t 143\n#define SSL_F_SSL3_GET_SERVER_CERTIFICATE\t\t 144\n#define SSL_F_SSL3_GET_SERVER_DONE\t\t\t 145\n#define SSL_F_SSL3_GET_SERVER_HELLO\t\t\t 146\n#define SSL_F_SSL3_NEW_SESSION_TICKET\t\t\t 284\n#define SSL_F_SSL3_OUTPUT_CERT_CHAIN\t\t\t 147\n#define SSL_F_SSL3_PEEK\t\t\t\t\t 235\n#define SSL_F_SSL3_READ_BYTES\t\t\t\t 148\n#define SSL_F_SSL3_READ_N\t\t\t\t 149\n#define SSL_F_SSL3_SEND_CERTIFICATE_REQUEST\t\t 150\n#define SSL_F_SSL3_SEND_CLIENT_CERTIFICATE\t\t 151\n#define SSL_F_SSL3_SEND_CLIENT_KEY_EXCHANGE\t\t 152\n#define SSL_F_SSL3_SEND_CLIENT_VERIFY\t\t\t 153\n#define SSL_F_SSL3_SEND_SERVER_CERTIFICATE\t\t 154\n#define SSL_F_SSL3_SEND_SERVER_HELLO\t\t\t 242\n#define SSL_F_SSL3_SEND_SERVER_KEY_EXCHANGE\t\t 155\n#define SSL_F_SSL3_SETUP_BUFFERS\t\t\t 156\n#define SSL_F_SSL3_SETUP_KEY_BLOCK\t\t\t 157\n#define SSL_F_SSL3_WRITE_BYTES\t\t\t\t 158\n#define SSL_F_SSL3_WRITE_PENDING\t\t\t 159\n#define SSL_F_SSL_ADD_CLIENTHELLO_RENEGOTIATE_EXT\t 285\n#define SSL_F_SSL_ADD_CLIENTHELLO_TLSEXT\t\t 272\n#define SSL_F_SSL_ADD_DIR_CERT_SUBJECTS_TO_STACK\t 215\n#define SSL_F_SSL_ADD_FILE_CERT_SUBJECTS_TO_STACK\t 216\n#define SSL_F_SSL_ADD_SERVERHELLO_RENEGOTIATE_EXT\t 286\n#define SSL_F_SSL_ADD_SERVERHELLO_TLSEXT\t\t 273\n#define SSL_F_SSL_BAD_METHOD\t\t\t\t 160\n#define SSL_F_SSL_BYTES_TO_CIPHER_LIST\t\t\t 161\n#define SSL_F_SSL_CERT_DUP\t\t\t\t 221\n#define SSL_F_SSL_CERT_INST\t\t\t\t 222\n#define SSL_F_SSL_CERT_INSTANTIATE\t\t\t 214\n#define SSL_F_SSL_CERT_NEW\t\t\t\t 162\n#define SSL_F_SSL_CHECK_PRIVATE_KEY\t\t\t 163\n#define SSL_F_SSL_CHECK_SERVERHELLO_TLSEXT\t\t 274\n#define SSL_F_SSL_CIPHER_PROCESS_RULESTR\t\t 230\n#define SSL_F_SSL_CIPHER_STRENGTH_SORT\t\t\t 231\n#define SSL_F_SSL_CLEAR\t\t\t\t\t 164\n#define SSL_F_SSL_COMP_ADD_COMPRESSION_METHOD\t\t 165\n#define SSL_F_SSL_CREATE_CIPHER_LIST\t\t\t 166\n#define SSL_F_SSL_CTRL\t\t\t\t\t 232\n#define SSL_F_SSL_CTX_CHECK_PRIVATE_KEY\t\t\t 168\n#define SSL_F_SSL_CTX_NEW\t\t\t\t 169\n#define SSL_F_SSL_CTX_SET_CIPHER_LIST\t\t\t 269\n#define SSL_F_SSL_CTX_SET_CLIENT_CERT_ENGINE\t\t 278\n#define SSL_F_SSL_CTX_SET_PURPOSE\t\t\t 226\n#define SSL_F_SSL_CTX_SET_SESSION_ID_CONTEXT\t\t 219\n#define SSL_F_SSL_CTX_SET_SSL_VERSION\t\t\t 170\n#define SSL_F_SSL_CTX_SET_TRUST\t\t\t\t 229\n#define SSL_F_SSL_CTX_USE_CERTIFICATE\t\t\t 171\n#define SSL_F_SSL_CTX_USE_CERTIFICATE_ASN1\t\t 172\n#define SSL_F_SSL_CTX_USE_CERTIFICATE_CHAIN_FILE\t 220\n#define SSL_F_SSL_CTX_USE_CERTIFICATE_FILE\t\t 173\n#define SSL_F_SSL_CTX_USE_PRIVATEKEY\t\t\t 174\n#define SSL_F_SSL_CTX_USE_PRIVATEKEY_ASN1\t\t 175\n#define SSL_F_SSL_CTX_USE_PRIVATEKEY_FILE\t\t 176\n#define SSL_F_SSL_CTX_USE_RSAPRIVATEKEY\t\t\t 177\n#define SSL_F_SSL_CTX_USE_RSAPRIVATEKEY_ASN1\t\t 178\n#define SSL_F_SSL_CTX_USE_RSAPRIVATEKEY_FILE\t\t 179\n#define SSL_F_SSL_DO_HANDSHAKE\t\t\t\t 180\n#define SSL_F_SSL_GET_NEW_SESSION\t\t\t 181\n#define SSL_F_SSL_GET_PREV_SESSION\t\t\t 217\n#define SSL_F_SSL_GET_SERVER_SEND_CERT\t\t\t 182\n#define SSL_F_SSL_GET_SIGN_PKEY\t\t\t\t 183\n#define SSL_F_SSL_INIT_WBIO_BUFFER\t\t\t 184\n#define SSL_F_SSL_LOAD_CLIENT_CA_FILE\t\t\t 185\n#define SSL_F_SSL_NEW\t\t\t\t\t 186\n#define SSL_F_SSL_PARSE_CLIENTHELLO_RENEGOTIATE_EXT\t 287\n#define SSL_F_SSL_PARSE_CLIENTHELLO_TLSEXT\t\t 290\n#define SSL_F_SSL_PARSE_SERVERHELLO_RENEGOTIATE_EXT\t 289\n#define SSL_F_SSL_PARSE_SERVERHELLO_TLSEXT\t\t 291\n#define SSL_F_SSL_PEEK\t\t\t\t\t 270\n#define SSL_F_SSL_PREPARE_CLIENTHELLO_TLSEXT\t\t 275\n#define SSL_F_SSL_PREPARE_SERVERHELLO_TLSEXT\t\t 276\n#define SSL_F_SSL_READ\t\t\t\t\t 223\n#define SSL_F_SSL_RSA_PRIVATE_DECRYPT\t\t\t 187\n#define SSL_F_SSL_RSA_PUBLIC_ENCRYPT\t\t\t 188\n#define SSL_F_SSL_SESSION_NEW\t\t\t\t 189\n#define SSL_F_SSL_SESSION_PRINT_FP\t\t\t 190\n#define SSL_F_SSL_SESS_CERT_NEW\t\t\t\t 225\n#define SSL_F_SSL_SET_CERT\t\t\t\t 191\n#define SSL_F_SSL_SET_CIPHER_LIST\t\t\t 271\n#define SSL_F_SSL_SET_FD\t\t\t\t 192\n#define SSL_F_SSL_SET_PKEY\t\t\t\t 193\n#define SSL_F_SSL_SET_PURPOSE\t\t\t\t 227\n#define SSL_F_SSL_SET_RFD\t\t\t\t 194\n#define SSL_F_SSL_SET_SESSION\t\t\t\t 195\n#define SSL_F_SSL_SET_SESSION_ID_CONTEXT\t\t 218\n#define SSL_F_SSL_SET_TRUST\t\t\t\t 228\n#define SSL_F_SSL_SET_WFD\t\t\t\t 196\n#define SSL_F_SSL_SHUTDOWN\t\t\t\t 224\n#define SSL_F_SSL_UNDEFINED_CONST_FUNCTION\t\t 243\n#define SSL_F_SSL_UNDEFINED_FUNCTION\t\t\t 197\n#define SSL_F_SSL_UNDEFINED_VOID_FUNCTION\t\t 244\n#define SSL_F_SSL_USE_CERTIFICATE\t\t\t 198\n#define SSL_F_SSL_USE_CERTIFICATE_ASN1\t\t\t 199\n#define SSL_F_SSL_USE_CERTIFICATE_FILE\t\t\t 200\n#define SSL_F_SSL_USE_PRIVATEKEY\t\t\t 201\n#define SSL_F_SSL_USE_PRIVATEKEY_ASN1\t\t\t 202\n#define SSL_F_SSL_USE_PRIVATEKEY_FILE\t\t\t 203\n#define SSL_F_SSL_USE_RSAPRIVATEKEY\t\t\t 204\n#define SSL_F_SSL_USE_RSAPRIVATEKEY_ASN1\t\t 205\n#define SSL_F_SSL_USE_RSAPRIVATEKEY_FILE\t\t 206\n#define SSL_F_SSL_VERIFY_CERT_CHAIN\t\t\t 207\n#define SSL_F_SSL_WRITE\t\t\t\t\t 208\n#define SSL_F_TLS1_CHANGE_CIPHER_STATE\t\t\t 209\n#define SSL_F_TLS1_ENC\t\t\t\t\t 210\n#define SSL_F_TLS1_SETUP_KEY_BLOCK\t\t\t 211\n#define SSL_F_WRITE_PENDING\t\t\t\t 212\n\n/* Reason codes. */\n#define SSL_R_APP_DATA_IN_HANDSHAKE\t\t\t 100\n#define SSL_R_ATTEMPT_TO_REUSE_SESSION_IN_DIFFERENT_CONTEXT 272\n#define SSL_R_BAD_ALERT_RECORD\t\t\t\t 101\n#define SSL_R_BAD_AUTHENTICATION_TYPE\t\t\t 102\n#define SSL_R_BAD_CHANGE_CIPHER_SPEC\t\t\t 103\n#define SSL_R_BAD_CHECKSUM\t\t\t\t 104\n#define SSL_R_BAD_DATA_RETURNED_BY_CALLBACK\t\t 106\n#define SSL_R_BAD_DECOMPRESSION\t\t\t\t 107\n#define SSL_R_BAD_DH_G_LENGTH\t\t\t\t 108\n#define SSL_R_BAD_DH_PUB_KEY_LENGTH\t\t\t 109\n#define SSL_R_BAD_DH_P_LENGTH\t\t\t\t 110\n#define SSL_R_BAD_DIGEST_LENGTH\t\t\t\t 111\n#define SSL_R_BAD_DSA_SIGNATURE\t\t\t\t 112\n#define SSL_R_BAD_ECC_CERT\t\t\t\t 304\n#define SSL_R_BAD_ECDSA_SIGNATURE\t\t\t 305\n#define SSL_R_BAD_ECPOINT\t\t\t\t 306\n#define SSL_R_BAD_HELLO_REQUEST\t\t\t\t 105\n#define SSL_R_BAD_LENGTH\t\t\t\t 271\n#define SSL_R_BAD_MAC_DECODE\t\t\t\t 113\n#define SSL_R_BAD_MESSAGE_TYPE\t\t\t\t 114\n#define SSL_R_BAD_PACKET_LENGTH\t\t\t\t 115\n#define SSL_R_BAD_PROTOCOL_VERSION_NUMBER\t\t 116\n#define SSL_R_BAD_RESPONSE_ARGUMENT\t\t\t 117\n#define SSL_R_BAD_RSA_DECRYPT\t\t\t\t 118\n#define SSL_R_BAD_RSA_ENCRYPT\t\t\t\t 119\n#define SSL_R_BAD_RSA_E_LENGTH\t\t\t\t 120\n#define SSL_R_BAD_RSA_MODULUS_LENGTH\t\t\t 121\n#define SSL_R_BAD_RSA_SIGNATURE\t\t\t\t 122\n#define SSL_R_BAD_SIGNATURE\t\t\t\t 123\n#define SSL_R_BAD_SSL_FILETYPE\t\t\t\t 124\n#define SSL_R_BAD_SSL_SESSION_ID_LENGTH\t\t\t 125\n#define SSL_R_BAD_STATE\t\t\t\t\t 126\n#define SSL_R_BAD_WRITE_RETRY\t\t\t\t 127\n#define SSL_R_BIO_NOT_SET\t\t\t\t 128\n#define SSL_R_BLOCK_CIPHER_PAD_IS_WRONG\t\t\t 129\n#define SSL_R_BN_LIB\t\t\t\t\t 130\n#define SSL_R_CA_DN_LENGTH_MISMATCH\t\t\t 131\n#define SSL_R_CA_DN_TOO_LONG\t\t\t\t 132\n#define SSL_R_CCS_RECEIVED_EARLY\t\t\t 133\n#define SSL_R_CERTIFICATE_VERIFY_FAILED\t\t\t 134\n#define SSL_R_CERT_LENGTH_MISMATCH\t\t\t 135\n#define SSL_R_CHALLENGE_IS_DIFFERENT\t\t\t 136\n#define SSL_R_CIPHER_CODE_WRONG_LENGTH\t\t\t 137\n#define SSL_R_CIPHER_OR_HASH_UNAVAILABLE\t\t 138\n#define SSL_R_CIPHER_TABLE_SRC_ERROR\t\t\t 139\n#define SSL_R_CLIENTHELLO_TLSEXT\t\t\t 157\n#define SSL_R_COMPRESSED_LENGTH_TOO_LONG\t\t 140\n#define SSL_R_COMPRESSION_FAILURE\t\t\t 141\n#define SSL_R_COMPRESSION_ID_NOT_WITHIN_PRIVATE_RANGE\t 307\n#define SSL_R_COMPRESSION_LIBRARY_ERROR\t\t\t 142\n#define SSL_R_CONNECTION_ID_IS_DIFFERENT\t\t 143\n#define SSL_R_CONNECTION_TYPE_NOT_SET\t\t\t 144\n#define SSL_R_COOKIE_MISMATCH\t\t\t\t 308\n#define SSL_R_DATA_BETWEEN_CCS_AND_FINISHED\t\t 145\n#define SSL_R_DATA_LENGTH_TOO_LONG\t\t\t 146\n#define SSL_R_DECRYPTION_FAILED\t\t\t\t 147\n#define SSL_R_DECRYPTION_FAILED_OR_BAD_RECORD_MAC\t 281\n#define SSL_R_DH_PUBLIC_VALUE_LENGTH_IS_WRONG\t\t 148\n#define SSL_R_DIGEST_CHECK_FAILED\t\t\t 149\n#define SSL_R_DTLS_MESSAGE_TOO_BIG\t\t\t 318\n#define SSL_R_DUPLICATE_COMPRESSION_ID\t\t\t 309\n#define SSL_R_ECGROUP_TOO_LARGE_FOR_CIPHER\t\t 310\n#define SSL_R_ENCRYPTED_LENGTH_TOO_LONG\t\t\t 150\n#define SSL_R_ERROR_GENERATING_TMP_RSA_KEY\t\t 282\n#define SSL_R_ERROR_IN_RECEIVED_CIPHER_LIST\t\t 151\n#define SSL_R_EXCESSIVE_MESSAGE_SIZE\t\t\t 152\n#define SSL_R_EXTRA_DATA_IN_MESSAGE\t\t\t 153\n#define SSL_R_GOT_A_FIN_BEFORE_A_CCS\t\t\t 154\n#define SSL_R_HTTPS_PROXY_REQUEST\t\t\t 155\n#define SSL_R_HTTP_REQUEST\t\t\t\t 156\n#define SSL_R_ILLEGAL_PADDING\t\t\t\t 283\n#define SSL_R_INVALID_CHALLENGE_LENGTH\t\t\t 158\n#define SSL_R_INVALID_COMMAND\t\t\t\t 280\n#define SSL_R_INVALID_PURPOSE\t\t\t\t 278\n#define SSL_R_INVALID_STATUS_RESPONSE\t\t\t 316\n#define SSL_R_INVALID_TICKET_KEYS_LENGTH\t\t 275\n#define SSL_R_INVALID_TRUST\t\t\t\t 279\n#define SSL_R_KEY_ARG_TOO_LONG\t\t\t\t 284\n#define SSL_R_KRB5\t\t\t\t\t 285\n#define SSL_R_KRB5_C_CC_PRINC\t\t\t\t 286\n#define SSL_R_KRB5_C_GET_CRED\t\t\t\t 287\n#define SSL_R_KRB5_C_INIT\t\t\t\t 288\n#define SSL_R_KRB5_C_MK_REQ\t\t\t\t 289\n#define SSL_R_KRB5_S_BAD_TICKET\t\t\t\t 290\n#define SSL_R_KRB5_S_INIT\t\t\t\t 291\n#define SSL_R_KRB5_S_RD_REQ\t\t\t\t 292\n#define SSL_R_KRB5_S_TKT_EXPIRED\t\t\t 293\n#define SSL_R_KRB5_S_TKT_NYV\t\t\t\t 294\n#define SSL_R_KRB5_S_TKT_SKEW\t\t\t\t 295\n#define SSL_R_LENGTH_MISMATCH\t\t\t\t 159\n#define SSL_R_LENGTH_TOO_SHORT\t\t\t\t 160\n#define SSL_R_LIBRARY_BUG\t\t\t\t 274\n#define SSL_R_LIBRARY_HAS_NO_CIPHERS\t\t\t 161\n#define SSL_R_MESSAGE_TOO_LONG\t\t\t\t 296\n#define SSL_R_MISSING_DH_DSA_CERT\t\t\t 162\n#define SSL_R_MISSING_DH_KEY\t\t\t\t 163\n#define SSL_R_MISSING_DH_RSA_CERT\t\t\t 164\n#define SSL_R_MISSING_DSA_SIGNING_CERT\t\t\t 165\n#define SSL_R_MISSING_EXPORT_TMP_DH_KEY\t\t\t 166\n#define SSL_R_MISSING_EXPORT_TMP_RSA_KEY\t\t 167\n#define SSL_R_MISSING_RSA_CERTIFICATE\t\t\t 168\n#define SSL_R_MISSING_RSA_ENCRYPTING_CERT\t\t 169\n#define SSL_R_MISSING_RSA_SIGNING_CERT\t\t\t 170\n#define SSL_R_MISSING_TMP_DH_KEY\t\t\t 171\n#define SSL_R_MISSING_TMP_ECDH_KEY\t\t\t 311\n#define SSL_R_MISSING_TMP_RSA_KEY\t\t\t 172\n#define SSL_R_MISSING_TMP_RSA_PKEY\t\t\t 173\n#define SSL_R_MISSING_VERIFY_MESSAGE\t\t\t 174\n#define SSL_R_NON_SSLV2_INITIAL_PACKET\t\t\t 175\n#define SSL_R_NO_CERTIFICATES_RETURNED\t\t\t 176\n#define SSL_R_NO_CERTIFICATE_ASSIGNED\t\t\t 177\n#define SSL_R_NO_CERTIFICATE_RETURNED\t\t\t 178\n#define SSL_R_NO_CERTIFICATE_SET\t\t\t 179\n#define SSL_R_NO_CERTIFICATE_SPECIFIED\t\t\t 180\n#define SSL_R_NO_CIPHERS_AVAILABLE\t\t\t 181\n#define SSL_R_NO_CIPHERS_PASSED\t\t\t\t 182\n#define SSL_R_NO_CIPHERS_SPECIFIED\t\t\t 183\n#define SSL_R_NO_CIPHER_LIST\t\t\t\t 184\n#define SSL_R_NO_CIPHER_MATCH\t\t\t\t 185\n#define SSL_R_NO_CLIENT_CERT_METHOD\t\t\t 317\n#define SSL_R_NO_CLIENT_CERT_RECEIVED\t\t\t 186\n#define SSL_R_NO_COMPRESSION_SPECIFIED\t\t\t 187\n#define SSL_R_NO_METHOD_SPECIFIED\t\t\t 188\n#define SSL_R_NO_PRIVATEKEY\t\t\t\t 189\n#define SSL_R_NO_PRIVATE_KEY_ASSIGNED\t\t\t 190\n#define SSL_R_NO_PROTOCOLS_AVAILABLE\t\t\t 191\n#define SSL_R_NO_PUBLICKEY\t\t\t\t 192\n#define SSL_R_NO_RENEGOTIATION\t\t\t\t 319\n#define SSL_R_NO_SHARED_CIPHER\t\t\t\t 193\n#define SSL_R_NO_VERIFY_CALLBACK\t\t\t 194\n#define SSL_R_NULL_SSL_CTX\t\t\t\t 195\n#define SSL_R_NULL_SSL_METHOD_PASSED\t\t\t 196\n#define SSL_R_OLD_SESSION_CIPHER_NOT_RETURNED\t\t 197\n#define SSL_R_ONLY_TLS_ALLOWED_IN_FIPS_MODE\t\t 297\n#define SSL_R_PACKET_LENGTH_TOO_LONG\t\t\t 198\n#define SSL_R_PARSE_TLSEXT\t\t\t\t 223\n#define SSL_R_PATH_TOO_LONG\t\t\t\t 270\n#define SSL_R_PEER_DID_NOT_RETURN_A_CERTIFICATE\t\t 199\n#define SSL_R_PEER_ERROR\t\t\t\t 200\n#define SSL_R_PEER_ERROR_CERTIFICATE\t\t\t 201\n#define SSL_R_PEER_ERROR_NO_CERTIFICATE\t\t\t 202\n#define SSL_R_PEER_ERROR_NO_CIPHER\t\t\t 203\n#define SSL_R_PEER_ERROR_UNSUPPORTED_CERTIFICATE_TYPE\t 204\n#define SSL_R_PRE_MAC_LENGTH_TOO_LONG\t\t\t 205\n#define SSL_R_PROBLEMS_MAPPING_CIPHER_FUNCTIONS\t\t 206\n#define SSL_R_PROTOCOL_IS_SHUTDOWN\t\t\t 207\n#define SSL_R_PUBLIC_KEY_ENCRYPT_ERROR\t\t\t 208\n#define SSL_R_PUBLIC_KEY_IS_NOT_RSA\t\t\t 209\n#define SSL_R_PUBLIC_KEY_NOT_RSA\t\t\t 210\n#define SSL_R_READ_BIO_NOT_SET\t\t\t\t 211\n#define SSL_R_READ_TIMEOUT_EXPIRED\t\t\t 312\n#define SSL_R_READ_WRONG_PACKET_TYPE\t\t\t 212\n#define SSL_R_RECORD_LENGTH_MISMATCH\t\t\t 213\n#define SSL_R_RECORD_TOO_LARGE\t\t\t\t 214\n#define SSL_R_RECORD_TOO_SMALL\t\t\t\t 298\n#define SSL_R_RENEGOTIATE_EXT_TOO_LONG\t\t\t 320\n#define SSL_R_RENEGOTIATION_ENCODING_ERR\t\t 321\n#define SSL_R_RENEGOTIATION_MISMATCH\t\t\t 322\n#define SSL_R_REQUIRED_CIPHER_MISSING\t\t\t 215\n#define SSL_R_REUSE_CERT_LENGTH_NOT_ZERO\t\t 216\n#define SSL_R_REUSE_CERT_TYPE_NOT_ZERO\t\t\t 217\n#define SSL_R_REUSE_CIPHER_LIST_NOT_ZERO\t\t 218\n#define SSL_R_SCSV_RECEIVED_WHEN_RENEGOTIATING\t\t 324\n#define SSL_R_SERVERHELLO_TLSEXT\t\t\t 224\n#define SSL_R_SESSION_ID_CONTEXT_UNINITIALIZED\t\t 277\n#define SSL_R_SHORT_READ\t\t\t\t 219\n#define SSL_R_SIGNATURE_FOR_NON_SIGNING_CERTIFICATE\t 220\n#define SSL_R_SSL23_DOING_SESSION_ID_REUSE\t\t 221\n#define SSL_R_SSL2_CONNECTION_ID_TOO_LONG\t\t 299\n#define SSL_R_SSL3_EXT_INVALID_SERVERNAME\t\t 225\n#define SSL_R_SSL3_EXT_INVALID_SERVERNAME_TYPE\t\t 226\n#define SSL_R_SSL3_SESSION_ID_TOO_LONG\t\t\t 300\n#define SSL_R_SSL3_SESSION_ID_TOO_SHORT\t\t\t 222\n#define SSL_R_SSLV3_ALERT_BAD_CERTIFICATE\t\t 1042\n#define SSL_R_SSLV3_ALERT_BAD_RECORD_MAC\t\t 1020\n#define SSL_R_SSLV3_ALERT_CERTIFICATE_EXPIRED\t\t 1045\n#define SSL_R_SSLV3_ALERT_CERTIFICATE_REVOKED\t\t 1044\n#define SSL_R_SSLV3_ALERT_CERTIFICATE_UNKNOWN\t\t 1046\n#define SSL_R_SSLV3_ALERT_DECOMPRESSION_FAILURE\t\t 1030\n#define SSL_R_SSLV3_ALERT_HANDSHAKE_FAILURE\t\t 1040\n#define SSL_R_SSLV3_ALERT_ILLEGAL_PARAMETER\t\t 1047\n#define SSL_R_SSLV3_ALERT_NO_CERTIFICATE\t\t 1041\n#define SSL_R_SSLV3_ALERT_UNEXPECTED_MESSAGE\t\t 1010\n#define SSL_R_SSLV3_ALERT_UNSUPPORTED_CERTIFICATE\t 1043\n#define SSL_R_SSL_CTX_HAS_NO_DEFAULT_SSL_VERSION\t 228\n#define SSL_R_SSL_HANDSHAKE_FAILURE\t\t\t 229\n#define SSL_R_SSL_LIBRARY_HAS_NO_CIPHERS\t\t 230\n#define SSL_R_SSL_SESSION_ID_CALLBACK_FAILED\t\t 301\n#define SSL_R_SSL_SESSION_ID_CONFLICT\t\t\t 302\n#define SSL_R_SSL_SESSION_ID_CONTEXT_TOO_LONG\t\t 273\n#define SSL_R_SSL_SESSION_ID_HAS_BAD_LENGTH\t\t 303\n#define SSL_R_SSL_SESSION_ID_IS_DIFFERENT\t\t 231\n#define SSL_R_TLSV1_ALERT_ACCESS_DENIED\t\t\t 1049\n#define SSL_R_TLSV1_ALERT_DECODE_ERROR\t\t\t 1050\n#define SSL_R_TLSV1_ALERT_DECRYPTION_FAILED\t\t 1021\n#define SSL_R_TLSV1_ALERT_DECRYPT_ERROR\t\t\t 1051\n#define SSL_R_TLSV1_ALERT_EXPORT_RESTRICTION\t\t 1060\n#define SSL_R_TLSV1_ALERT_INSUFFICIENT_SECURITY\t\t 1071\n#define SSL_R_TLSV1_ALERT_INTERNAL_ERROR\t\t 1080\n#define SSL_R_TLSV1_ALERT_NO_RENEGOTIATION\t\t 1100\n#define SSL_R_TLSV1_ALERT_PROTOCOL_VERSION\t\t 1070\n#define SSL_R_TLSV1_ALERT_RECORD_OVERFLOW\t\t 1022\n#define SSL_R_TLSV1_ALERT_UNKNOWN_CA\t\t\t 1048\n#define SSL_R_TLSV1_ALERT_USER_CANCELLED\t\t 1090\n#define SSL_R_TLS_CLIENT_CERT_REQ_WITH_ANON_CIPHER\t 232\n#define SSL_R_TLS_INVALID_ECPOINTFORMAT_LIST\t\t 227\n#define SSL_R_TLS_PEER_DID_NOT_RESPOND_WITH_CERTIFICATE_LIST 233\n#define SSL_R_TLS_RSA_ENCRYPTED_VALUE_LENGTH_IS_WRONG\t 234\n#define SSL_R_TRIED_TO_USE_UNSUPPORTED_CIPHER\t\t 235\n#define SSL_R_UNABLE_TO_DECODE_DH_CERTS\t\t\t 236\n#define SSL_R_UNABLE_TO_DECODE_ECDH_CERTS\t\t 313\n#define SSL_R_UNABLE_TO_EXTRACT_PUBLIC_KEY\t\t 237\n#define SSL_R_UNABLE_TO_FIND_DH_PARAMETERS\t\t 238\n#define SSL_R_UNABLE_TO_FIND_ECDH_PARAMETERS\t\t 314\n#define SSL_R_UNABLE_TO_FIND_PUBLIC_KEY_PARAMETERS\t 239\n#define SSL_R_UNABLE_TO_FIND_SSL_METHOD\t\t\t 240\n#define SSL_R_UNABLE_TO_LOAD_SSL2_MD5_ROUTINES\t\t 241\n#define SSL_R_UNABLE_TO_LOAD_SSL3_MD5_ROUTINES\t\t 242\n#define SSL_R_UNABLE_TO_LOAD_SSL3_SHA1_ROUTINES\t\t 243\n#define SSL_R_UNEXPECTED_MESSAGE\t\t\t 244\n#define SSL_R_UNEXPECTED_RECORD\t\t\t\t 245\n#define SSL_R_UNINITIALIZED\t\t\t\t 276\n#define SSL_R_UNKNOWN_ALERT_TYPE\t\t\t 246\n#define SSL_R_UNKNOWN_CERTIFICATE_TYPE\t\t\t 247\n#define SSL_R_UNKNOWN_CIPHER_RETURNED\t\t\t 248\n#define SSL_R_UNKNOWN_CIPHER_TYPE\t\t\t 249\n#define SSL_R_UNKNOWN_KEY_EXCHANGE_TYPE\t\t\t 250\n#define SSL_R_UNKNOWN_PKEY_TYPE\t\t\t\t 251\n#define SSL_R_UNKNOWN_PROTOCOL\t\t\t\t 252\n#define SSL_R_UNKNOWN_REMOTE_ERROR_TYPE\t\t\t 253\n#define SSL_R_UNKNOWN_SSL_VERSION\t\t\t 254\n#define SSL_R_UNKNOWN_STATE\t\t\t\t 255\n#define SSL_R_UNSAFE_LEGACY_RENEGOTIATION_DISABLED\t 323\n#define SSL_R_UNSUPPORTED_CIPHER\t\t\t 256\n#define SSL_R_UNSUPPORTED_COMPRESSION_ALGORITHM\t\t 257\n#define SSL_R_UNSUPPORTED_ELLIPTIC_CURVE\t\t 315\n#define SSL_R_UNSUPPORTED_PROTOCOL\t\t\t 258\n#define SSL_R_UNSUPPORTED_SSL_VERSION\t\t\t 259\n#define SSL_R_UNSUPPORTED_STATUS_TYPE\t\t\t 329\n#define SSL_R_WRITE_BIO_NOT_SET\t\t\t\t 260\n#define SSL_R_WRONG_CIPHER_RETURNED\t\t\t 261\n#define SSL_R_WRONG_MESSAGE_TYPE\t\t\t 262\n#define SSL_R_WRONG_NUMBER_OF_KEY_BITS\t\t\t 263\n#define SSL_R_WRONG_SIGNATURE_LENGTH\t\t\t 264\n#define SSL_R_WRONG_SIGNATURE_SIZE\t\t\t 265\n#define SSL_R_WRONG_SSL_VERSION\t\t\t\t 266\n#define SSL_R_WRONG_VERSION_NUMBER\t\t\t 267\n#define SSL_R_X509_LIB\t\t\t\t\t 268\n#define SSL_R_X509_VERIFICATION_SETUP_PROBLEMS\t\t 269\n\n#ifdef  __cplusplus\n}\n#endif\n#endif\n"
  },
  {
    "path": "freebsd-headers/openssl/ssl2.h",
    "content": "/* ssl/ssl2.h */\n/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)\n * All rights reserved.\n *\n * This package is an SSL implementation written\n * by Eric Young (eay@cryptsoft.com).\n * The implementation was written so as to conform with Netscapes SSL.\n * \n * This library is free for commercial and non-commercial use as long as\n * the following conditions are aheared to.  The following conditions\n * apply to all code found in this distribution, be it the RC4, RSA,\n * lhash, DES, etc., code; not just the SSL code.  The SSL documentation\n * included with this distribution is covered by the same copyright terms\n * except that the holder is Tim Hudson (tjh@cryptsoft.com).\n * \n * Copyright remains Eric Young's, and as such any Copyright notices in\n * the code are not to be removed.\n * If this package is used in a product, Eric Young should be given attribution\n * as the author of the parts of the library used.\n * This can be in the form of a textual message at program startup or\n * in documentation (online or textual) provided with the package.\n * \n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. All advertising materials mentioning features or use of this software\n *    must display the following acknowledgement:\n *    \"This product includes cryptographic software written by\n *     Eric Young (eay@cryptsoft.com)\"\n *    The word 'cryptographic' can be left out if the rouines from the library\n *    being used are not cryptographic related :-).\n * 4. If you include any Windows specific code (or a derivative thereof) from \n *    the apps directory (application code) you must include an acknowledgement:\n *    \"This product includes software written by Tim Hudson (tjh@cryptsoft.com)\"\n * \n * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n * \n * The licence and distribution terms for any publically available version or\n * derivative of this code cannot be changed.  i.e. this code cannot simply be\n * copied and put under another distribution licence\n * [including the GNU Public Licence.]\n */\n\n#ifndef HEADER_SSL2_H \n#define HEADER_SSL2_H \n\n#ifdef  __cplusplus\nextern \"C\" {\n#endif\n\n/* Protocol Version Codes */\n#define SSL2_VERSION\t\t0x0002\n#define SSL2_VERSION_MAJOR\t0x00\n#define SSL2_VERSION_MINOR\t0x02\n/* #define SSL2_CLIENT_VERSION\t0x0002 */\n/* #define SSL2_SERVER_VERSION\t0x0002 */\n\n/* Protocol Message Codes */\n#define SSL2_MT_ERROR\t\t\t0\n#define SSL2_MT_CLIENT_HELLO\t\t1\n#define SSL2_MT_CLIENT_MASTER_KEY\t2\n#define SSL2_MT_CLIENT_FINISHED\t\t3\n#define SSL2_MT_SERVER_HELLO\t\t4\n#define SSL2_MT_SERVER_VERIFY\t\t5\n#define SSL2_MT_SERVER_FINISHED\t\t6\n#define SSL2_MT_REQUEST_CERTIFICATE\t7\n#define SSL2_MT_CLIENT_CERTIFICATE\t8\n\n/* Error Message Codes */\n#define SSL2_PE_UNDEFINED_ERROR\t\t0x0000\n#define SSL2_PE_NO_CIPHER\t\t0x0001\n#define SSL2_PE_NO_CERTIFICATE\t\t0x0002\n#define SSL2_PE_BAD_CERTIFICATE\t\t0x0004\n#define SSL2_PE_UNSUPPORTED_CERTIFICATE_TYPE 0x0006\n\n/* Cipher Kind Values */\n#define SSL2_CK_NULL_WITH_MD5\t\t\t0x02000000 /* v3 */\n#define SSL2_CK_RC4_128_WITH_MD5\t\t0x02010080\n#define SSL2_CK_RC4_128_EXPORT40_WITH_MD5\t0x02020080\n#define SSL2_CK_RC2_128_CBC_WITH_MD5\t\t0x02030080\n#define SSL2_CK_RC2_128_CBC_EXPORT40_WITH_MD5\t0x02040080\n#define SSL2_CK_IDEA_128_CBC_WITH_MD5\t\t0x02050080\n#define SSL2_CK_DES_64_CBC_WITH_MD5\t\t0x02060040\n#define SSL2_CK_DES_64_CBC_WITH_SHA\t\t0x02060140 /* v3 */\n#define SSL2_CK_DES_192_EDE3_CBC_WITH_MD5\t0x020700c0\n#define SSL2_CK_DES_192_EDE3_CBC_WITH_SHA\t0x020701c0 /* v3 */\n#define SSL2_CK_RC4_64_WITH_MD5\t\t\t0x02080080 /* MS hack */\n \n#define SSL2_CK_DES_64_CFB64_WITH_MD5_1\t\t0x02ff0800 /* SSLeay */\n#define SSL2_CK_NULL\t\t\t\t0x02ff0810 /* SSLeay */\n\n#define SSL2_TXT_DES_64_CFB64_WITH_MD5_1\t\"DES-CFB-M1\"\n#define SSL2_TXT_NULL_WITH_MD5\t\t\t\"NULL-MD5\"\n#define SSL2_TXT_RC4_128_WITH_MD5\t\t\"RC4-MD5\"\n#define SSL2_TXT_RC4_128_EXPORT40_WITH_MD5\t\"EXP-RC4-MD5\"\n#define SSL2_TXT_RC2_128_CBC_WITH_MD5\t\t\"RC2-CBC-MD5\"\n#define SSL2_TXT_RC2_128_CBC_EXPORT40_WITH_MD5\t\"EXP-RC2-CBC-MD5\"\n#define SSL2_TXT_IDEA_128_CBC_WITH_MD5\t\t\"IDEA-CBC-MD5\"\n#define SSL2_TXT_DES_64_CBC_WITH_MD5\t\t\"DES-CBC-MD5\"\n#define SSL2_TXT_DES_64_CBC_WITH_SHA\t\t\"DES-CBC-SHA\"\n#define SSL2_TXT_DES_192_EDE3_CBC_WITH_MD5\t\"DES-CBC3-MD5\"\n#define SSL2_TXT_DES_192_EDE3_CBC_WITH_SHA\t\"DES-CBC3-SHA\"\n#define SSL2_TXT_RC4_64_WITH_MD5\t\t\"RC4-64-MD5\"\n\n#define SSL2_TXT_NULL\t\t\t\t\"NULL\"\n\n/* Flags for the SSL_CIPHER.algorithm2 field */\n#define SSL2_CF_5_BYTE_ENC\t\t\t0x01\n#define SSL2_CF_8_BYTE_ENC\t\t\t0x02\n\n/* Certificate Type Codes */\n#define SSL2_CT_X509_CERTIFICATE\t\t0x01\n\n/* Authentication Type Code */\n#define SSL2_AT_MD5_WITH_RSA_ENCRYPTION\t\t0x01\n\n#define SSL2_MAX_SSL_SESSION_ID_LENGTH\t\t32\n\n/* Upper/Lower Bounds */\n#define SSL2_MAX_MASTER_KEY_LENGTH_IN_BITS\t256\n#ifdef OPENSSL_SYS_MPE\n#define SSL2_MAX_RECORD_LENGTH_2_BYTE_HEADER\t29998u\n#else\n#define SSL2_MAX_RECORD_LENGTH_2_BYTE_HEADER\t32767u  /* 2^15-1 */\n#endif\n#define SSL2_MAX_RECORD_LENGTH_3_BYTE_HEADER\t16383 /* 2^14-1 */\n\n#define SSL2_CHALLENGE_LENGTH\t16\n/*#define SSL2_CHALLENGE_LENGTH\t32 */\n#define SSL2_MIN_CHALLENGE_LENGTH\t16\n#define SSL2_MAX_CHALLENGE_LENGTH\t32\n#define SSL2_CONNECTION_ID_LENGTH\t16\n#define SSL2_MAX_CONNECTION_ID_LENGTH\t16\n#define SSL2_SSL_SESSION_ID_LENGTH\t16\n#define SSL2_MAX_CERT_CHALLENGE_LENGTH\t32\n#define SSL2_MIN_CERT_CHALLENGE_LENGTH\t16\n#define SSL2_MAX_KEY_MATERIAL_LENGTH\t24\n\n#ifndef HEADER_SSL_LOCL_H\n#define  CERT\t\tchar\n#endif\n\ntypedef struct ssl2_state_st\n\t{\n\tint three_byte_header;\n\tint clear_text;\t\t/* clear text */\n\tint escape;\t\t/* not used in SSLv2 */\n\tint ssl2_rollback;\t/* used if SSLv23 rolled back to SSLv2 */\n\n\t/* non-blocking io info, used to make sure the same\n\t * args were passwd */\n\tunsigned int wnum;\t/* number of bytes sent so far */\n\tint wpend_tot;\n\tconst unsigned char *wpend_buf;\n\n\tint wpend_off;\t/* offset to data to write */\n\tint wpend_len; \t/* number of bytes passwd to write */\n\tint wpend_ret; \t/* number of bytes to return to caller */\n\n\t/* buffer raw data */\n\tint rbuf_left;\n\tint rbuf_offs;\n\tunsigned char *rbuf;\n\tunsigned char *wbuf;\n\n\tunsigned char *write_ptr;/* used to point to the start due to\n\t\t\t\t  * 2/3 byte header. */\n\n\tunsigned int padding;\n\tunsigned int rlength; /* passed to ssl2_enc */\n\tint ract_data_length; /* Set when things are encrypted. */\n\tunsigned int wlength; /* passed to ssl2_enc */\n\tint wact_data_length; /* Set when things are decrypted. */\n\tunsigned char *ract_data;\n\tunsigned char *wact_data;\n\tunsigned char *mac_data;\n\n\tunsigned char *read_key;\n\tunsigned char *write_key;\n\n\t\t/* Stuff specifically to do with this SSL session */\n\tunsigned int challenge_length;\n\tunsigned char challenge[SSL2_MAX_CHALLENGE_LENGTH];\n\tunsigned int conn_id_length;\n\tunsigned char conn_id[SSL2_MAX_CONNECTION_ID_LENGTH];\n\tunsigned int key_material_length;\n\tunsigned char key_material[SSL2_MAX_KEY_MATERIAL_LENGTH*2];\n\n\tunsigned long read_sequence;\n\tunsigned long write_sequence;\n\n\tstruct\t{\n\t\tunsigned int conn_id_length;\n\t\tunsigned int cert_type;\t\n\t\tunsigned int cert_length;\n\t\tunsigned int csl; \n\t\tunsigned int clear;\n\t\tunsigned int enc; \n\t\tunsigned char ccl[SSL2_MAX_CERT_CHALLENGE_LENGTH];\n\t\tunsigned int cipher_spec_length;\n\t\tunsigned int session_id_length;\n\t\tunsigned int clen;\n\t\tunsigned int rlen;\n\t\t} tmp;\n\t} SSL2_STATE;\n\n/* SSLv2 */\n/* client */\n#define SSL2_ST_SEND_CLIENT_HELLO_A\t\t(0x10|SSL_ST_CONNECT)\n#define SSL2_ST_SEND_CLIENT_HELLO_B\t\t(0x11|SSL_ST_CONNECT)\n#define SSL2_ST_GET_SERVER_HELLO_A\t\t(0x20|SSL_ST_CONNECT)\n#define SSL2_ST_GET_SERVER_HELLO_B\t\t(0x21|SSL_ST_CONNECT)\n#define SSL2_ST_SEND_CLIENT_MASTER_KEY_A\t(0x30|SSL_ST_CONNECT)\n#define SSL2_ST_SEND_CLIENT_MASTER_KEY_B\t(0x31|SSL_ST_CONNECT)\n#define SSL2_ST_SEND_CLIENT_FINISHED_A\t\t(0x40|SSL_ST_CONNECT)\n#define SSL2_ST_SEND_CLIENT_FINISHED_B\t\t(0x41|SSL_ST_CONNECT)\n#define SSL2_ST_SEND_CLIENT_CERTIFICATE_A\t(0x50|SSL_ST_CONNECT)\n#define SSL2_ST_SEND_CLIENT_CERTIFICATE_B\t(0x51|SSL_ST_CONNECT)\n#define SSL2_ST_SEND_CLIENT_CERTIFICATE_C\t(0x52|SSL_ST_CONNECT)\n#define SSL2_ST_SEND_CLIENT_CERTIFICATE_D\t(0x53|SSL_ST_CONNECT)\n#define SSL2_ST_GET_SERVER_VERIFY_A\t\t(0x60|SSL_ST_CONNECT)\n#define SSL2_ST_GET_SERVER_VERIFY_B\t\t(0x61|SSL_ST_CONNECT)\n#define SSL2_ST_GET_SERVER_FINISHED_A\t\t(0x70|SSL_ST_CONNECT)\n#define SSL2_ST_GET_SERVER_FINISHED_B\t\t(0x71|SSL_ST_CONNECT)\n#define SSL2_ST_CLIENT_START_ENCRYPTION\t\t(0x80|SSL_ST_CONNECT)\n#define SSL2_ST_X509_GET_CLIENT_CERTIFICATE\t(0x90|SSL_ST_CONNECT)\n/* server */\n#define SSL2_ST_GET_CLIENT_HELLO_A\t\t(0x10|SSL_ST_ACCEPT)\n#define SSL2_ST_GET_CLIENT_HELLO_B\t\t(0x11|SSL_ST_ACCEPT)\n#define SSL2_ST_GET_CLIENT_HELLO_C\t\t(0x12|SSL_ST_ACCEPT)\n#define SSL2_ST_SEND_SERVER_HELLO_A\t\t(0x20|SSL_ST_ACCEPT)\n#define SSL2_ST_SEND_SERVER_HELLO_B\t\t(0x21|SSL_ST_ACCEPT)\n#define SSL2_ST_GET_CLIENT_MASTER_KEY_A\t\t(0x30|SSL_ST_ACCEPT)\n#define SSL2_ST_GET_CLIENT_MASTER_KEY_B\t\t(0x31|SSL_ST_ACCEPT)\n#define SSL2_ST_SEND_SERVER_VERIFY_A\t\t(0x40|SSL_ST_ACCEPT)\n#define SSL2_ST_SEND_SERVER_VERIFY_B\t\t(0x41|SSL_ST_ACCEPT)\n#define SSL2_ST_SEND_SERVER_VERIFY_C\t\t(0x42|SSL_ST_ACCEPT)\n#define SSL2_ST_GET_CLIENT_FINISHED_A\t\t(0x50|SSL_ST_ACCEPT)\n#define SSL2_ST_GET_CLIENT_FINISHED_B\t\t(0x51|SSL_ST_ACCEPT)\n#define SSL2_ST_SEND_SERVER_FINISHED_A\t\t(0x60|SSL_ST_ACCEPT)\n#define SSL2_ST_SEND_SERVER_FINISHED_B\t\t(0x61|SSL_ST_ACCEPT)\n#define SSL2_ST_SEND_REQUEST_CERTIFICATE_A\t(0x70|SSL_ST_ACCEPT)\n#define SSL2_ST_SEND_REQUEST_CERTIFICATE_B\t(0x71|SSL_ST_ACCEPT)\n#define SSL2_ST_SEND_REQUEST_CERTIFICATE_C\t(0x72|SSL_ST_ACCEPT)\n#define SSL2_ST_SEND_REQUEST_CERTIFICATE_D\t(0x73|SSL_ST_ACCEPT)\n#define SSL2_ST_SERVER_START_ENCRYPTION\t\t(0x80|SSL_ST_ACCEPT)\n#define SSL2_ST_X509_GET_SERVER_CERTIFICATE\t(0x90|SSL_ST_ACCEPT)\n\n#ifdef  __cplusplus\n}\n#endif\n#endif\n\n"
  },
  {
    "path": "freebsd-headers/openssl/ssl23.h",
    "content": "/* ssl/ssl23.h */\n/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)\n * All rights reserved.\n *\n * This package is an SSL implementation written\n * by Eric Young (eay@cryptsoft.com).\n * The implementation was written so as to conform with Netscapes SSL.\n * \n * This library is free for commercial and non-commercial use as long as\n * the following conditions are aheared to.  The following conditions\n * apply to all code found in this distribution, be it the RC4, RSA,\n * lhash, DES, etc., code; not just the SSL code.  The SSL documentation\n * included with this distribution is covered by the same copyright terms\n * except that the holder is Tim Hudson (tjh@cryptsoft.com).\n * \n * Copyright remains Eric Young's, and as such any Copyright notices in\n * the code are not to be removed.\n * If this package is used in a product, Eric Young should be given attribution\n * as the author of the parts of the library used.\n * This can be in the form of a textual message at program startup or\n * in documentation (online or textual) provided with the package.\n * \n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. All advertising materials mentioning features or use of this software\n *    must display the following acknowledgement:\n *    \"This product includes cryptographic software written by\n *     Eric Young (eay@cryptsoft.com)\"\n *    The word 'cryptographic' can be left out if the rouines from the library\n *    being used are not cryptographic related :-).\n * 4. If you include any Windows specific code (or a derivative thereof) from \n *    the apps directory (application code) you must include an acknowledgement:\n *    \"This product includes software written by Tim Hudson (tjh@cryptsoft.com)\"\n * \n * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n * \n * The licence and distribution terms for any publically available version or\n * derivative of this code cannot be changed.  i.e. this code cannot simply be\n * copied and put under another distribution licence\n * [including the GNU Public Licence.]\n */\n\n#ifndef HEADER_SSL23_H \n#define HEADER_SSL23_H \n\n#ifdef  __cplusplus\nextern \"C\" {\n#endif\n\n/*client */\n/* write to server */\n#define SSL23_ST_CW_CLNT_HELLO_A\t(0x210|SSL_ST_CONNECT)\n#define SSL23_ST_CW_CLNT_HELLO_B\t(0x211|SSL_ST_CONNECT)\n/* read from server */\n#define SSL23_ST_CR_SRVR_HELLO_A\t(0x220|SSL_ST_CONNECT)\n#define SSL23_ST_CR_SRVR_HELLO_B\t(0x221|SSL_ST_CONNECT)\n\n/* server */\n/* read from client */\n#define SSL23_ST_SR_CLNT_HELLO_A\t(0x210|SSL_ST_ACCEPT)\n#define SSL23_ST_SR_CLNT_HELLO_B\t(0x211|SSL_ST_ACCEPT)\n\n#ifdef  __cplusplus\n}\n#endif\n#endif\n\n"
  },
  {
    "path": "freebsd-headers/openssl/ssl3.h",
    "content": "/* ssl/ssl3.h */\n/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)\n * All rights reserved.\n *\n * This package is an SSL implementation written\n * by Eric Young (eay@cryptsoft.com).\n * The implementation was written so as to conform with Netscapes SSL.\n * \n * This library is free for commercial and non-commercial use as long as\n * the following conditions are aheared to.  The following conditions\n * apply to all code found in this distribution, be it the RC4, RSA,\n * lhash, DES, etc., code; not just the SSL code.  The SSL documentation\n * included with this distribution is covered by the same copyright terms\n * except that the holder is Tim Hudson (tjh@cryptsoft.com).\n * \n * Copyright remains Eric Young's, and as such any Copyright notices in\n * the code are not to be removed.\n * If this package is used in a product, Eric Young should be given attribution\n * as the author of the parts of the library used.\n * This can be in the form of a textual message at program startup or\n * in documentation (online or textual) provided with the package.\n * \n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. All advertising materials mentioning features or use of this software\n *    must display the following acknowledgement:\n *    \"This product includes cryptographic software written by\n *     Eric Young (eay@cryptsoft.com)\"\n *    The word 'cryptographic' can be left out if the rouines from the library\n *    being used are not cryptographic related :-).\n * 4. If you include any Windows specific code (or a derivative thereof) from \n *    the apps directory (application code) you must include an acknowledgement:\n *    \"This product includes software written by Tim Hudson (tjh@cryptsoft.com)\"\n * \n * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n * \n * The licence and distribution terms for any publically available version or\n * derivative of this code cannot be changed.  i.e. this code cannot simply be\n * copied and put under another distribution licence\n * [including the GNU Public Licence.]\n */\n/* ====================================================================\n * Copyright (c) 1998-2002 The OpenSSL Project.  All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n *\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer. \n *\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in\n *    the documentation and/or other materials provided with the\n *    distribution.\n *\n * 3. All advertising materials mentioning features or use of this\n *    software must display the following acknowledgment:\n *    \"This product includes software developed by the OpenSSL Project\n *    for use in the OpenSSL Toolkit. (http://www.openssl.org/)\"\n *\n * 4. The names \"OpenSSL Toolkit\" and \"OpenSSL Project\" must not be used to\n *    endorse or promote products derived from this software without\n *    prior written permission. For written permission, please contact\n *    openssl-core@openssl.org.\n *\n * 5. Products derived from this software may not be called \"OpenSSL\"\n *    nor may \"OpenSSL\" appear in their names without prior written\n *    permission of the OpenSSL Project.\n *\n * 6. Redistributions of any form whatsoever must retain the following\n *    acknowledgment:\n *    \"This product includes software developed by the OpenSSL Project\n *    for use in the OpenSSL Toolkit (http://www.openssl.org/)\"\n *\n * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY\n * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\n * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE OpenSSL PROJECT OR\n * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\n * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,\n * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED\n * OF THE POSSIBILITY OF SUCH DAMAGE.\n * ====================================================================\n *\n * This product includes cryptographic software written by Eric Young\n * (eay@cryptsoft.com).  This product includes software written by Tim\n * Hudson (tjh@cryptsoft.com).\n *\n */\n/* ====================================================================\n * Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED.\n * ECC cipher suite support in OpenSSL originally developed by \n * SUN MICROSYSTEMS, INC., and contributed to the OpenSSL project.\n */\n\n#ifndef HEADER_SSL3_H \n#define HEADER_SSL3_H \n\n#ifndef OPENSSL_NO_COMP\n#include <openssl/comp.h>\n#endif\n#include <openssl/buffer.h>\n#include <openssl/evp.h>\n#include <openssl/ssl.h>\n#include <openssl/pq_compat.h>\n\n#ifdef  __cplusplus\nextern \"C\" {\n#endif\n\n/* Signalling cipher suite value: from draft-ietf-tls-renegotiation-03.txt */\n#define SSL3_CK_SCSV\t\t\t\t0x030000FF\n\n#define SSL3_CK_RSA_NULL_MD5\t\t\t0x03000001\n#define SSL3_CK_RSA_NULL_SHA\t\t\t0x03000002\n#define SSL3_CK_RSA_RC4_40_MD5 \t\t\t0x03000003\n#define SSL3_CK_RSA_RC4_128_MD5\t\t\t0x03000004\n#define SSL3_CK_RSA_RC4_128_SHA\t\t\t0x03000005\n#define SSL3_CK_RSA_RC2_40_MD5\t\t\t0x03000006\n#define SSL3_CK_RSA_IDEA_128_SHA\t\t0x03000007\n#define SSL3_CK_RSA_DES_40_CBC_SHA\t\t0x03000008\n#define SSL3_CK_RSA_DES_64_CBC_SHA\t\t0x03000009\n#define SSL3_CK_RSA_DES_192_CBC3_SHA\t\t0x0300000A\n\n#define SSL3_CK_DH_DSS_DES_40_CBC_SHA\t\t0x0300000B\n#define SSL3_CK_DH_DSS_DES_64_CBC_SHA\t\t0x0300000C\n#define SSL3_CK_DH_DSS_DES_192_CBC3_SHA \t0x0300000D\n#define SSL3_CK_DH_RSA_DES_40_CBC_SHA\t\t0x0300000E\n#define SSL3_CK_DH_RSA_DES_64_CBC_SHA\t\t0x0300000F\n#define SSL3_CK_DH_RSA_DES_192_CBC3_SHA \t0x03000010\n\n#define SSL3_CK_EDH_DSS_DES_40_CBC_SHA\t\t0x03000011\n#define SSL3_CK_EDH_DSS_DES_64_CBC_SHA\t\t0x03000012\n#define SSL3_CK_EDH_DSS_DES_192_CBC3_SHA\t0x03000013\n#define SSL3_CK_EDH_RSA_DES_40_CBC_SHA\t\t0x03000014\n#define SSL3_CK_EDH_RSA_DES_64_CBC_SHA\t\t0x03000015\n#define SSL3_CK_EDH_RSA_DES_192_CBC3_SHA\t0x03000016\n\n#define SSL3_CK_ADH_RC4_40_MD5\t\t\t0x03000017\n#define SSL3_CK_ADH_RC4_128_MD5\t\t\t0x03000018\n#define SSL3_CK_ADH_DES_40_CBC_SHA\t\t0x03000019\n#define SSL3_CK_ADH_DES_64_CBC_SHA\t\t0x0300001A\n#define SSL3_CK_ADH_DES_192_CBC_SHA\t\t0x0300001B\n\n#define SSL3_CK_FZA_DMS_NULL_SHA\t\t0x0300001C\n#define SSL3_CK_FZA_DMS_FZA_SHA\t\t\t0x0300001D\n#if 0 /* Because it clashes with KRB5, is never used any more, and is safe\n\t to remove according to David Hopwood <david.hopwood@zetnet.co.uk>\n\t of the ietf-tls list */\n#define SSL3_CK_FZA_DMS_RC4_SHA\t\t\t0x0300001E\n#endif\n\n/*    VRS Additional Kerberos5 entries\n */\n#define SSL3_CK_KRB5_DES_64_CBC_SHA\t\t0x0300001E\n#define SSL3_CK_KRB5_DES_192_CBC3_SHA\t\t0x0300001F\n#define SSL3_CK_KRB5_RC4_128_SHA\t\t0x03000020\n#define SSL3_CK_KRB5_IDEA_128_CBC_SHA\t       \t0x03000021\n#define SSL3_CK_KRB5_DES_64_CBC_MD5       \t0x03000022\n#define SSL3_CK_KRB5_DES_192_CBC3_MD5       \t0x03000023\n#define SSL3_CK_KRB5_RC4_128_MD5\t       \t0x03000024\n#define SSL3_CK_KRB5_IDEA_128_CBC_MD5 \t\t0x03000025\n\n#define SSL3_CK_KRB5_DES_40_CBC_SHA \t\t0x03000026\n#define SSL3_CK_KRB5_RC2_40_CBC_SHA \t\t0x03000027\n#define SSL3_CK_KRB5_RC4_40_SHA\t \t\t0x03000028\n#define SSL3_CK_KRB5_DES_40_CBC_MD5 \t\t0x03000029\n#define SSL3_CK_KRB5_RC2_40_CBC_MD5 \t\t0x0300002A\n#define SSL3_CK_KRB5_RC4_40_MD5\t \t\t0x0300002B\n\n#define SSL3_TXT_RSA_NULL_MD5\t\t\t\"NULL-MD5\"\n#define SSL3_TXT_RSA_NULL_SHA\t\t\t\"NULL-SHA\"\n#define SSL3_TXT_RSA_RC4_40_MD5 \t\t\"EXP-RC4-MD5\"\n#define SSL3_TXT_RSA_RC4_128_MD5\t\t\"RC4-MD5\"\n#define SSL3_TXT_RSA_RC4_128_SHA\t\t\"RC4-SHA\"\n#define SSL3_TXT_RSA_RC2_40_MD5\t\t\t\"EXP-RC2-CBC-MD5\"\n#define SSL3_TXT_RSA_IDEA_128_SHA\t\t\"IDEA-CBC-SHA\"\n#define SSL3_TXT_RSA_DES_40_CBC_SHA\t\t\"EXP-DES-CBC-SHA\"\n#define SSL3_TXT_RSA_DES_64_CBC_SHA\t\t\"DES-CBC-SHA\"\n#define SSL3_TXT_RSA_DES_192_CBC3_SHA\t\t\"DES-CBC3-SHA\"\n\n#define SSL3_TXT_DH_DSS_DES_40_CBC_SHA\t\t\"EXP-DH-DSS-DES-CBC-SHA\"\n#define SSL3_TXT_DH_DSS_DES_64_CBC_SHA\t\t\"DH-DSS-DES-CBC-SHA\"\n#define SSL3_TXT_DH_DSS_DES_192_CBC3_SHA \t\"DH-DSS-DES-CBC3-SHA\"\n#define SSL3_TXT_DH_RSA_DES_40_CBC_SHA\t\t\"EXP-DH-RSA-DES-CBC-SHA\"\n#define SSL3_TXT_DH_RSA_DES_64_CBC_SHA\t\t\"DH-RSA-DES-CBC-SHA\"\n#define SSL3_TXT_DH_RSA_DES_192_CBC3_SHA \t\"DH-RSA-DES-CBC3-SHA\"\n\n#define SSL3_TXT_EDH_DSS_DES_40_CBC_SHA\t\t\"EXP-EDH-DSS-DES-CBC-SHA\"\n#define SSL3_TXT_EDH_DSS_DES_64_CBC_SHA\t\t\"EDH-DSS-DES-CBC-SHA\"\n#define SSL3_TXT_EDH_DSS_DES_192_CBC3_SHA\t\"EDH-DSS-DES-CBC3-SHA\"\n#define SSL3_TXT_EDH_RSA_DES_40_CBC_SHA\t\t\"EXP-EDH-RSA-DES-CBC-SHA\"\n#define SSL3_TXT_EDH_RSA_DES_64_CBC_SHA\t\t\"EDH-RSA-DES-CBC-SHA\"\n#define SSL3_TXT_EDH_RSA_DES_192_CBC3_SHA\t\"EDH-RSA-DES-CBC3-SHA\"\n\n#define SSL3_TXT_ADH_RC4_40_MD5\t\t\t\"EXP-ADH-RC4-MD5\"\n#define SSL3_TXT_ADH_RC4_128_MD5\t\t\"ADH-RC4-MD5\"\n#define SSL3_TXT_ADH_DES_40_CBC_SHA\t\t\"EXP-ADH-DES-CBC-SHA\"\n#define SSL3_TXT_ADH_DES_64_CBC_SHA\t\t\"ADH-DES-CBC-SHA\"\n#define SSL3_TXT_ADH_DES_192_CBC_SHA\t\t\"ADH-DES-CBC3-SHA\"\n\n#define SSL3_TXT_FZA_DMS_NULL_SHA\t\t\"FZA-NULL-SHA\"\n#define SSL3_TXT_FZA_DMS_FZA_SHA\t\t\"FZA-FZA-CBC-SHA\"\n#define SSL3_TXT_FZA_DMS_RC4_SHA\t\t\"FZA-RC4-SHA\"\n\n#define SSL3_TXT_KRB5_DES_64_CBC_SHA\t\t\"KRB5-DES-CBC-SHA\"\n#define SSL3_TXT_KRB5_DES_192_CBC3_SHA\t\t\"KRB5-DES-CBC3-SHA\"\n#define SSL3_TXT_KRB5_RC4_128_SHA\t\t\"KRB5-RC4-SHA\"\n#define SSL3_TXT_KRB5_IDEA_128_CBC_SHA\t       \t\"KRB5-IDEA-CBC-SHA\"\n#define SSL3_TXT_KRB5_DES_64_CBC_MD5       \t\"KRB5-DES-CBC-MD5\"\n#define SSL3_TXT_KRB5_DES_192_CBC3_MD5       \t\"KRB5-DES-CBC3-MD5\"\n#define SSL3_TXT_KRB5_RC4_128_MD5\t\t\"KRB5-RC4-MD5\"\n#define SSL3_TXT_KRB5_IDEA_128_CBC_MD5 \t\t\"KRB5-IDEA-CBC-MD5\"\n\n#define SSL3_TXT_KRB5_DES_40_CBC_SHA \t\t\"EXP-KRB5-DES-CBC-SHA\"\n#define SSL3_TXT_KRB5_RC2_40_CBC_SHA \t\t\"EXP-KRB5-RC2-CBC-SHA\"\n#define SSL3_TXT_KRB5_RC4_40_SHA\t \t\"EXP-KRB5-RC4-SHA\"\n#define SSL3_TXT_KRB5_DES_40_CBC_MD5 \t\t\"EXP-KRB5-DES-CBC-MD5\"\n#define SSL3_TXT_KRB5_RC2_40_CBC_MD5 \t\t\"EXP-KRB5-RC2-CBC-MD5\"\n#define SSL3_TXT_KRB5_RC4_40_MD5\t \t\"EXP-KRB5-RC4-MD5\"\n\n#define SSL3_SSL_SESSION_ID_LENGTH\t\t32\n#define SSL3_MAX_SSL_SESSION_ID_LENGTH\t\t32\n\n#define SSL3_MASTER_SECRET_SIZE\t\t\t48\n#define SSL3_RANDOM_SIZE\t\t\t32\n#define SSL3_SESSION_ID_SIZE\t\t\t32\n#define SSL3_RT_HEADER_LENGTH\t\t\t5\n\n/* Due to MS stuffing up, this can change.... */\n#if defined(OPENSSL_SYS_WIN16) || \\\n\t(defined(OPENSSL_SYS_MSDOS) && !defined(OPENSSL_SYS_WIN32))\n#define SSL3_RT_MAX_EXTRA\t\t\t(14000)\n#else\n#define SSL3_RT_MAX_EXTRA\t\t\t(16384)\n#endif\n\n#define SSL3_RT_MAX_PLAIN_LENGTH\t\t16384\n#ifdef OPENSSL_NO_COMP\n#define SSL3_RT_MAX_COMPRESSED_LENGTH\tSSL3_RT_MAX_PLAIN_LENGTH\n#else\n#define SSL3_RT_MAX_COMPRESSED_LENGTH\t(1024+SSL3_RT_MAX_PLAIN_LENGTH)\n#endif\n#define SSL3_RT_MAX_ENCRYPTED_LENGTH\t(1024+SSL3_RT_MAX_COMPRESSED_LENGTH)\n#define SSL3_RT_MAX_PACKET_SIZE\t\t(SSL3_RT_MAX_ENCRYPTED_LENGTH+SSL3_RT_HEADER_LENGTH)\n#define SSL3_RT_MAX_DATA_SIZE\t\t\t(1024*1024)\n\n#define SSL3_MD_CLIENT_FINISHED_CONST\t\"\\x43\\x4C\\x4E\\x54\"\n#define SSL3_MD_SERVER_FINISHED_CONST\t\"\\x53\\x52\\x56\\x52\"\n\n#define SSL3_VERSION\t\t\t0x0300\n#define SSL3_VERSION_MAJOR\t\t0x03\n#define SSL3_VERSION_MINOR\t\t0x00\n\n#define SSL3_RT_CHANGE_CIPHER_SPEC\t20\n#define SSL3_RT_ALERT\t\t\t21\n#define SSL3_RT_HANDSHAKE\t\t22\n#define SSL3_RT_APPLICATION_DATA\t23\n\n#define SSL3_AL_WARNING\t\t\t1\n#define SSL3_AL_FATAL\t\t\t2\n\n#define SSL3_AD_CLOSE_NOTIFY\t\t 0\n#define SSL3_AD_UNEXPECTED_MESSAGE\t10\t/* fatal */\n#define SSL3_AD_BAD_RECORD_MAC\t\t20\t/* fatal */\n#define SSL3_AD_DECOMPRESSION_FAILURE\t30\t/* fatal */\n#define SSL3_AD_HANDSHAKE_FAILURE\t40\t/* fatal */\n#define SSL3_AD_NO_CERTIFICATE\t\t41\n#define SSL3_AD_BAD_CERTIFICATE\t\t42\n#define SSL3_AD_UNSUPPORTED_CERTIFICATE\t43\n#define SSL3_AD_CERTIFICATE_REVOKED\t44\n#define SSL3_AD_CERTIFICATE_EXPIRED\t45\n#define SSL3_AD_CERTIFICATE_UNKNOWN\t46\n#define SSL3_AD_ILLEGAL_PARAMETER\t47\t/* fatal */\n\ntypedef struct ssl3_record_st\n\t{\n/*r */\tint type;               /* type of record */\n/*rw*/\tunsigned int length;    /* How many bytes available */\n/*r */\tunsigned int off;       /* read/write offset into 'buf' */\n/*rw*/\tunsigned char *data;    /* pointer to the record data */\n/*rw*/\tunsigned char *input;   /* where the decode bytes are */\n/*r */\tunsigned char *comp;    /* only used with decompression - malloc()ed */\n/*r */  unsigned long epoch;    /* epoch number, needed by DTLS1 */\n/*r */  PQ_64BIT seq_num;       /* sequence number, needed by DTLS1 */\n\t} SSL3_RECORD;\n\ntypedef struct ssl3_buffer_st\n\t{\n\tunsigned char *buf;     /* at least SSL3_RT_MAX_PACKET_SIZE bytes,\n\t                         * see ssl3_setup_buffers() */\n\tsize_t len;             /* buffer size */\n\tint offset;             /* where to 'copy from' */\n\tint left;               /* how many bytes left */\n\t} SSL3_BUFFER;\n\n#define SSL3_CT_RSA_SIGN\t\t\t1\n#define SSL3_CT_DSS_SIGN\t\t\t2\n#define SSL3_CT_RSA_FIXED_DH\t\t\t3\n#define SSL3_CT_DSS_FIXED_DH\t\t\t4\n#define SSL3_CT_RSA_EPHEMERAL_DH\t\t5\n#define SSL3_CT_DSS_EPHEMERAL_DH\t\t6\n#define SSL3_CT_FORTEZZA_DMS\t\t\t20\n/* SSL3_CT_NUMBER is used to size arrays and it must be large\n * enough to contain all of the cert types defined either for\n * SSLv3 and TLSv1.\n */\n#define SSL3_CT_NUMBER\t\t\t7\n\n\n#define SSL3_FLAGS_NO_RENEGOTIATE_CIPHERS\t0x0001\n#define SSL3_FLAGS_DELAY_CLIENT_FINISHED\t0x0002\n#define SSL3_FLAGS_POP_BUFFER\t\t\t0x0004\n#define TLS1_FLAGS_TLS_PADDING_BUG\t\t0x0008\n\ntypedef struct ssl3_state_st\n\t{\n\tlong flags;\n\tint delay_buf_pop_ret;\n\n\tunsigned char read_sequence[8];\n\tunsigned char read_mac_secret[EVP_MAX_MD_SIZE];\n\tunsigned char write_sequence[8];\n\tunsigned char write_mac_secret[EVP_MAX_MD_SIZE];\n\n\tunsigned char server_random[SSL3_RANDOM_SIZE];\n\tunsigned char client_random[SSL3_RANDOM_SIZE];\n\n\t/* flags for countermeasure against known-IV weakness */\n\tint need_empty_fragments;\n\tint empty_fragment_done;\n\n\tSSL3_BUFFER rbuf;\t/* read IO goes into here */\n\tSSL3_BUFFER wbuf;\t/* write IO goes into here */\n\n\tSSL3_RECORD rrec;\t/* each decoded record goes in here */\n\tSSL3_RECORD wrec;\t/* goes out from here */\n\n\t/* storage for Alert/Handshake protocol data received but not\n\t * yet processed by ssl3_read_bytes: */\n\tunsigned char alert_fragment[2];\n\tunsigned int alert_fragment_len;\n\tunsigned char handshake_fragment[4];\n\tunsigned int handshake_fragment_len;\n\n\t/* partial write - check the numbers match */\n\tunsigned int wnum;\t/* number of bytes sent so far */\n\tint wpend_tot;\t\t/* number bytes written */\n\tint wpend_type;\n\tint wpend_ret;\t\t/* number of bytes submitted */\n\tconst unsigned char *wpend_buf;\n\n\t/* used during startup, digest all incoming/outgoing packets */\n\tEVP_MD_CTX finish_dgst1;\n\tEVP_MD_CTX finish_dgst2;\n\n\t/* this is set whenerver we see a change_cipher_spec message\n\t * come in when we are not looking for one */\n\tint change_cipher_spec;\n\n\tint warn_alert;\n\tint fatal_alert;\n\t/* we allow one fatal and one warning alert to be outstanding,\n\t * send close alert via the warning alert */\n\tint alert_dispatch;\n\tunsigned char send_alert[2];\n\n\t/* This flag is set when we should renegotiate ASAP, basically when\n\t * there is no more data in the read or write buffers */\n\tint renegotiate;\n\tint total_renegotiations;\n\tint num_renegotiations;\n\n\tint in_read_app_data;\n\n\tstruct\t{\n\t\t/* actually only needs to be 16+20 */\n\t\tunsigned char cert_verify_md[EVP_MAX_MD_SIZE*2];\n\n\t\t/* actually only need to be 16+20 for SSLv3 and 12 for TLS */\n\t\tunsigned char finish_md[EVP_MAX_MD_SIZE*2];\n\t\tint finish_md_len;\n\t\tunsigned char peer_finish_md[EVP_MAX_MD_SIZE*2];\n\t\tint peer_finish_md_len;\n\t\t\n\t\tunsigned long message_size;\n\t\tint message_type;\n\n\t\t/* used to hold the new cipher we are going to use */\n\t\tSSL_CIPHER *new_cipher;\n#ifndef OPENSSL_NO_DH\n\t\tDH *dh;\n#endif\n\n#ifndef OPENSSL_NO_ECDH\n\t\tEC_KEY *ecdh; /* holds short lived ECDH key */\n#endif\n\n\t\t/* used when SSL_ST_FLUSH_DATA is entered */\n\t\tint next_state;\t\t\t\n\n\t\tint reuse_message;\n\n\t\t/* used for certificate requests */\n\t\tint cert_req;\n\t\tint ctype_num;\n\t\tchar ctype[SSL3_CT_NUMBER];\n\t\tSTACK_OF(X509_NAME) *ca_names;\n\n\t\tint use_rsa_tmp;\n\n\t\tint key_block_length;\n\t\tunsigned char *key_block;\n\n\t\tconst EVP_CIPHER *new_sym_enc;\n\t\tconst EVP_MD *new_hash;\n#ifndef OPENSSL_NO_COMP\n\t\tconst SSL_COMP *new_compression;\n#else\n\t\tchar *new_compression;\n#endif\n\t\tint cert_request;\n\t\t} tmp;\n\n        /* Connection binding to prevent renegotiation attacks */\n        unsigned char previous_client_finished[EVP_MAX_MD_SIZE];\n        unsigned char previous_client_finished_len;\n        unsigned char previous_server_finished[EVP_MAX_MD_SIZE];\n        unsigned char previous_server_finished_len;\n        int send_connection_binding; /* TODOEKR */\n\t} SSL3_STATE;\n\n\n/* SSLv3 */\n/*client */\n/* extra state */\n#define SSL3_ST_CW_FLUSH\t\t(0x100|SSL_ST_CONNECT)\n/* write to server */\n#define SSL3_ST_CW_CLNT_HELLO_A\t\t(0x110|SSL_ST_CONNECT)\n#define SSL3_ST_CW_CLNT_HELLO_B\t\t(0x111|SSL_ST_CONNECT)\n/* read from server */\n#define SSL3_ST_CR_SRVR_HELLO_A\t\t(0x120|SSL_ST_CONNECT)\n#define SSL3_ST_CR_SRVR_HELLO_B\t\t(0x121|SSL_ST_CONNECT)\n#define DTLS1_ST_CR_HELLO_VERIFY_REQUEST_A (0x126|SSL_ST_CONNECT)\n#define DTLS1_ST_CR_HELLO_VERIFY_REQUEST_B (0x127|SSL_ST_CONNECT)\n#define SSL3_ST_CR_CERT_A\t\t(0x130|SSL_ST_CONNECT)\n#define SSL3_ST_CR_CERT_B\t\t(0x131|SSL_ST_CONNECT)\n#define SSL3_ST_CR_KEY_EXCH_A\t\t(0x140|SSL_ST_CONNECT)\n#define SSL3_ST_CR_KEY_EXCH_B\t\t(0x141|SSL_ST_CONNECT)\n#define SSL3_ST_CR_CERT_REQ_A\t\t(0x150|SSL_ST_CONNECT)\n#define SSL3_ST_CR_CERT_REQ_B\t\t(0x151|SSL_ST_CONNECT)\n#define SSL3_ST_CR_SRVR_DONE_A\t\t(0x160|SSL_ST_CONNECT)\n#define SSL3_ST_CR_SRVR_DONE_B\t\t(0x161|SSL_ST_CONNECT)\n/* write to server */\n#define SSL3_ST_CW_CERT_A\t\t(0x170|SSL_ST_CONNECT)\n#define SSL3_ST_CW_CERT_B\t\t(0x171|SSL_ST_CONNECT)\n#define SSL3_ST_CW_CERT_C\t\t(0x172|SSL_ST_CONNECT)\n#define SSL3_ST_CW_CERT_D\t\t(0x173|SSL_ST_CONNECT)\n#define SSL3_ST_CW_KEY_EXCH_A\t\t(0x180|SSL_ST_CONNECT)\n#define SSL3_ST_CW_KEY_EXCH_B\t\t(0x181|SSL_ST_CONNECT)\n#define SSL3_ST_CW_CERT_VRFY_A\t\t(0x190|SSL_ST_CONNECT)\n#define SSL3_ST_CW_CERT_VRFY_B\t\t(0x191|SSL_ST_CONNECT)\n#define SSL3_ST_CW_CHANGE_A\t\t(0x1A0|SSL_ST_CONNECT)\n#define SSL3_ST_CW_CHANGE_B\t\t(0x1A1|SSL_ST_CONNECT)\n#define SSL3_ST_CW_FINISHED_A\t\t(0x1B0|SSL_ST_CONNECT)\n#define SSL3_ST_CW_FINISHED_B\t\t(0x1B1|SSL_ST_CONNECT)\n/* read from server */\n#define SSL3_ST_CR_CHANGE_A\t\t(0x1C0|SSL_ST_CONNECT)\n#define SSL3_ST_CR_CHANGE_B\t\t(0x1C1|SSL_ST_CONNECT)\n#define SSL3_ST_CR_FINISHED_A\t\t(0x1D0|SSL_ST_CONNECT)\n#define SSL3_ST_CR_FINISHED_B\t\t(0x1D1|SSL_ST_CONNECT)\n#define SSL3_ST_CR_SESSION_TICKET_A\t(0x1E0|SSL_ST_CONNECT)\n#define SSL3_ST_CR_SESSION_TICKET_B\t(0x1E1|SSL_ST_CONNECT)\n#define SSL3_ST_CR_CERT_STATUS_A\t(0x1F0|SSL_ST_CONNECT)\n#define SSL3_ST_CR_CERT_STATUS_B\t(0x1F1|SSL_ST_CONNECT)\n\n/* server */\n/* extra state */\n#define SSL3_ST_SW_FLUSH\t\t(0x100|SSL_ST_ACCEPT)\n/* read from client */\n/* Do not change the number values, they do matter */\n#define SSL3_ST_SR_CLNT_HELLO_A\t\t(0x110|SSL_ST_ACCEPT)\n#define SSL3_ST_SR_CLNT_HELLO_B\t\t(0x111|SSL_ST_ACCEPT)\n#define SSL3_ST_SR_CLNT_HELLO_C\t\t(0x112|SSL_ST_ACCEPT)\n/* write to client */\n#define DTLS1_ST_SW_HELLO_VERIFY_REQUEST_A (0x113|SSL_ST_ACCEPT)\n#define DTLS1_ST_SW_HELLO_VERIFY_REQUEST_B (0x114|SSL_ST_ACCEPT)\n#define SSL3_ST_SW_HELLO_REQ_A\t\t(0x120|SSL_ST_ACCEPT)\n#define SSL3_ST_SW_HELLO_REQ_B\t\t(0x121|SSL_ST_ACCEPT)\n#define SSL3_ST_SW_HELLO_REQ_C\t\t(0x122|SSL_ST_ACCEPT)\n#define SSL3_ST_SW_SRVR_HELLO_A\t\t(0x130|SSL_ST_ACCEPT)\n#define SSL3_ST_SW_SRVR_HELLO_B\t\t(0x131|SSL_ST_ACCEPT)\n#define SSL3_ST_SW_CERT_A\t\t(0x140|SSL_ST_ACCEPT)\n#define SSL3_ST_SW_CERT_B\t\t(0x141|SSL_ST_ACCEPT)\n#define SSL3_ST_SW_KEY_EXCH_A\t\t(0x150|SSL_ST_ACCEPT)\n#define SSL3_ST_SW_KEY_EXCH_B\t\t(0x151|SSL_ST_ACCEPT)\n#define SSL3_ST_SW_CERT_REQ_A\t\t(0x160|SSL_ST_ACCEPT)\n#define SSL3_ST_SW_CERT_REQ_B\t\t(0x161|SSL_ST_ACCEPT)\n#define SSL3_ST_SW_SRVR_DONE_A\t\t(0x170|SSL_ST_ACCEPT)\n#define SSL3_ST_SW_SRVR_DONE_B\t\t(0x171|SSL_ST_ACCEPT)\n/* read from client */\n#define SSL3_ST_SR_CERT_A\t\t(0x180|SSL_ST_ACCEPT)\n#define SSL3_ST_SR_CERT_B\t\t(0x181|SSL_ST_ACCEPT)\n#define SSL3_ST_SR_KEY_EXCH_A\t\t(0x190|SSL_ST_ACCEPT)\n#define SSL3_ST_SR_KEY_EXCH_B\t\t(0x191|SSL_ST_ACCEPT)\n#define SSL3_ST_SR_CERT_VRFY_A\t\t(0x1A0|SSL_ST_ACCEPT)\n#define SSL3_ST_SR_CERT_VRFY_B\t\t(0x1A1|SSL_ST_ACCEPT)\n#define SSL3_ST_SR_CHANGE_A\t\t(0x1B0|SSL_ST_ACCEPT)\n#define SSL3_ST_SR_CHANGE_B\t\t(0x1B1|SSL_ST_ACCEPT)\n#define SSL3_ST_SR_FINISHED_A\t\t(0x1C0|SSL_ST_ACCEPT)\n#define SSL3_ST_SR_FINISHED_B\t\t(0x1C1|SSL_ST_ACCEPT)\n/* write to client */\n#define SSL3_ST_SW_CHANGE_A\t\t(0x1D0|SSL_ST_ACCEPT)\n#define SSL3_ST_SW_CHANGE_B\t\t(0x1D1|SSL_ST_ACCEPT)\n#define SSL3_ST_SW_FINISHED_A\t\t(0x1E0|SSL_ST_ACCEPT)\n#define SSL3_ST_SW_FINISHED_B\t\t(0x1E1|SSL_ST_ACCEPT)\n#define SSL3_ST_SW_SESSION_TICKET_A\t(0x1F0|SSL_ST_ACCEPT)\n#define SSL3_ST_SW_SESSION_TICKET_B\t(0x1F1|SSL_ST_ACCEPT)\n#define SSL3_ST_SW_CERT_STATUS_A\t(0x200|SSL_ST_ACCEPT)\n#define SSL3_ST_SW_CERT_STATUS_B\t(0x201|SSL_ST_ACCEPT)\n\n#define SSL3_MT_HELLO_REQUEST\t\t\t0\n#define SSL3_MT_CLIENT_HELLO\t\t\t1\n#define SSL3_MT_SERVER_HELLO\t\t\t2\n#define\tSSL3_MT_NEWSESSION_TICKET\t\t4\n#define SSL3_MT_CERTIFICATE\t\t\t11\n#define SSL3_MT_SERVER_KEY_EXCHANGE\t\t12\n#define SSL3_MT_CERTIFICATE_REQUEST\t\t13\n#define SSL3_MT_SERVER_DONE\t\t\t14\n#define SSL3_MT_CERTIFICATE_VERIFY\t\t15\n#define SSL3_MT_CLIENT_KEY_EXCHANGE\t\t16\n#define SSL3_MT_FINISHED\t\t\t20\n#define SSL3_MT_CERTIFICATE_STATUS\t\t22\n#define DTLS1_MT_HELLO_VERIFY_REQUEST    3\n\n\n#define SSL3_MT_CCS\t\t\t\t1\n\n/* These are used when changing over to a new cipher */\n#define SSL3_CC_READ\t\t0x01\n#define SSL3_CC_WRITE\t\t0x02\n#define SSL3_CC_CLIENT\t\t0x10\n#define SSL3_CC_SERVER\t\t0x20\n#define SSL3_CHANGE_CIPHER_CLIENT_WRITE\t(SSL3_CC_CLIENT|SSL3_CC_WRITE)\t\n#define SSL3_CHANGE_CIPHER_SERVER_READ\t(SSL3_CC_SERVER|SSL3_CC_READ)\n#define SSL3_CHANGE_CIPHER_CLIENT_READ\t(SSL3_CC_CLIENT|SSL3_CC_READ)\n#define SSL3_CHANGE_CIPHER_SERVER_WRITE\t(SSL3_CC_SERVER|SSL3_CC_WRITE)\n\n#ifdef  __cplusplus\n}\n#endif\n#endif\n\n"
  },
  {
    "path": "freebsd-headers/openssl/stack.h",
    "content": "/* crypto/stack/stack.h */\n/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)\n * All rights reserved.\n *\n * This package is an SSL implementation written\n * by Eric Young (eay@cryptsoft.com).\n * The implementation was written so as to conform with Netscapes SSL.\n * \n * This library is free for commercial and non-commercial use as long as\n * the following conditions are aheared to.  The following conditions\n * apply to all code found in this distribution, be it the RC4, RSA,\n * lhash, DES, etc., code; not just the SSL code.  The SSL documentation\n * included with this distribution is covered by the same copyright terms\n * except that the holder is Tim Hudson (tjh@cryptsoft.com).\n * \n * Copyright remains Eric Young's, and as such any Copyright notices in\n * the code are not to be removed.\n * If this package is used in a product, Eric Young should be given attribution\n * as the author of the parts of the library used.\n * This can be in the form of a textual message at program startup or\n * in documentation (online or textual) provided with the package.\n * \n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. All advertising materials mentioning features or use of this software\n *    must display the following acknowledgement:\n *    \"This product includes cryptographic software written by\n *     Eric Young (eay@cryptsoft.com)\"\n *    The word 'cryptographic' can be left out if the rouines from the library\n *    being used are not cryptographic related :-).\n * 4. If you include any Windows specific code (or a derivative thereof) from \n *    the apps directory (application code) you must include an acknowledgement:\n *    \"This product includes software written by Tim Hudson (tjh@cryptsoft.com)\"\n * \n * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n * \n * The licence and distribution terms for any publically available version or\n * derivative of this code cannot be changed.  i.e. this code cannot simply be\n * copied and put under another distribution licence\n * [including the GNU Public Licence.]\n */\n\n#ifndef HEADER_STACK_H\n#define HEADER_STACK_H\n\n#ifdef  __cplusplus\nextern \"C\" {\n#endif\n\ntypedef struct stack_st\n\t{\n\tint num;\n\tchar **data;\n\tint sorted;\n\n\tint num_alloc;\n\tint (*comp)(const char * const *, const char * const *);\n\t} STACK;\n\n#define M_sk_num(sk)\t\t((sk) ? (sk)->num:-1)\n#define M_sk_value(sk,n)\t((sk) ? (sk)->data[n] : NULL)\n\nint sk_num(const STACK *);\nchar *sk_value(const STACK *, int);\n\nchar *sk_set(STACK *, int, char *);\n\nSTACK *sk_new(int (*cmp)(const char * const *, const char * const *));\nSTACK *sk_new_null(void);\nvoid sk_free(STACK *);\nvoid sk_pop_free(STACK *st, void (*func)(void *));\nint sk_insert(STACK *sk,char *data,int where);\nchar *sk_delete(STACK *st,int loc);\nchar *sk_delete_ptr(STACK *st, char *p);\nint sk_find(STACK *st,char *data);\nint sk_find_ex(STACK *st,char *data);\nint sk_push(STACK *st,char *data);\nint sk_unshift(STACK *st,char *data);\nchar *sk_shift(STACK *st);\nchar *sk_pop(STACK *st);\nvoid sk_zero(STACK *st);\nint (*sk_set_cmp_func(STACK *sk, int (*c)(const char * const *,\n\t\t\tconst char * const *)))\n\t\t\t(const char * const *, const char * const *);\nSTACK *sk_dup(STACK *st);\nvoid sk_sort(STACK *st);\nint sk_is_sorted(const STACK *st);\n\n#ifdef  __cplusplus\n}\n#endif\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/openssl/store.h",
    "content": "/* crypto/store/store.h -*- mode:C; c-file-style: \"eay\" -*- */\n/* Written by Richard Levitte (richard@levitte.org) for the OpenSSL\n * project 2003.\n */\n/* ====================================================================\n * Copyright (c) 2003 The OpenSSL Project.  All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n *\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer. \n *\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in\n *    the documentation and/or other materials provided with the\n *    distribution.\n *\n * 3. All advertising materials mentioning features or use of this\n *    software must display the following acknowledgment:\n *    \"This product includes software developed by the OpenSSL Project\n *    for use in the OpenSSL Toolkit. (http://www.openssl.org/)\"\n *\n * 4. The names \"OpenSSL Toolkit\" and \"OpenSSL Project\" must not be used to\n *    endorse or promote products derived from this software without\n *    prior written permission. For written permission, please contact\n *    openssl-core@openssl.org.\n *\n * 5. Products derived from this software may not be called \"OpenSSL\"\n *    nor may \"OpenSSL\" appear in their names without prior written\n *    permission of the OpenSSL Project.\n *\n * 6. Redistributions of any form whatsoever must retain the following\n *    acknowledgment:\n *    \"This product includes software developed by the OpenSSL Project\n *    for use in the OpenSSL Toolkit (http://www.openssl.org/)\"\n *\n * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY\n * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\n * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE OpenSSL PROJECT OR\n * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\n * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,\n * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED\n * OF THE POSSIBILITY OF SUCH DAMAGE.\n * ====================================================================\n *\n * This product includes cryptographic software written by Eric Young\n * (eay@cryptsoft.com).  This product includes software written by Tim\n * Hudson (tjh@cryptsoft.com).\n *\n */\n\n#ifndef HEADER_STORE_H\n#define HEADER_STORE_H\n\n#include <openssl/ossl_typ.h>\n#ifndef OPENSSL_NO_DEPRECATED\n#include <openssl/evp.h>\n#include <openssl/bn.h>\n#include <openssl/x509.h>\n#endif\n\n#ifdef  __cplusplus\nextern \"C\" {\n#endif\n\n/* Already defined in ossl_typ.h */\n/* typedef struct store_st STORE; */\n/* typedef struct store_method_st STORE_METHOD; */\n\n\n/* All the following functions return 0, a negative number or NULL on error.\n   When everything is fine, they return a positive value or a non-NULL\n   pointer, all depending on their purpose. */\n\n/* Creators and destructor.   */\nSTORE *STORE_new_method(const STORE_METHOD *method);\nSTORE *STORE_new_engine(ENGINE *engine);\nvoid STORE_free(STORE *ui);\n\n\n/* Give a user interface parametrised control commands.  This can be used to\n   send down an integer, a data pointer or a function pointer, as well as\n   be used to get information from a STORE. */\nint STORE_ctrl(STORE *store, int cmd, long i, void *p, void (*f)(void));\n\n/* A control to set the directory with keys and certificates.  Used by the\n   built-in directory level method. */\n#define STORE_CTRL_SET_DIRECTORY\t0x0001\n/* A control to set a file to load.  Used by the built-in file level method. */\n#define STORE_CTRL_SET_FILE\t\t0x0002\n/* A control to set a configuration file to load.  Can be used by any method\n   that wishes to load a configuration file. */\n#define STORE_CTRL_SET_CONF_FILE\t0x0003\n/* A control to set a the section of the loaded configuration file.  Can be\n   used by any method that wishes to load a configuration file. */\n#define STORE_CTRL_SET_CONF_SECTION\t0x0004\n\n\n/* Some methods may use extra data */\n#define STORE_set_app_data(s,arg)\tSTORE_set_ex_data(s,0,arg)\n#define STORE_get_app_data(s)\t\tSTORE_get_ex_data(s,0)\nint STORE_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func,\n\tCRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func);\nint STORE_set_ex_data(STORE *r,int idx,void *arg);\nvoid *STORE_get_ex_data(STORE *r, int idx);\n\n/* Use specific methods instead of the built-in one */\nconst STORE_METHOD *STORE_get_method(STORE *store);\nconst STORE_METHOD *STORE_set_method(STORE *store, const STORE_METHOD *meth);\n\n/* The standard OpenSSL methods. */\n/* This is the in-memory method.  It does everything except revoking and updating,\n   and is of course volatile.  It's used by other methods that have an in-memory\n   cache. */\nconst STORE_METHOD *STORE_Memory(void);\n#if 0 /* Not yet implemented */\n/* This is the directory store.  It does everything except revoking and updating,\n   and uses STORE_Memory() to cache things in memory. */\nconst STORE_METHOD *STORE_Directory(void);\n/* This is the file store.  It does everything except revoking and updating,\n   and uses STORE_Memory() to cache things in memory.  Certificates are added\n   to it with the store operation, and it will only get cached certificates. */\nconst STORE_METHOD *STORE_File(void);\n#endif\n\n/* Store functions take a type code for the type of data they should store\n   or fetch */\ntypedef enum STORE_object_types\n\t{\n\tSTORE_OBJECT_TYPE_X509_CERTIFICATE=\t0x01, /* X509 * */\n\tSTORE_OBJECT_TYPE_X509_CRL=\t\t0x02, /* X509_CRL * */\n\tSTORE_OBJECT_TYPE_PRIVATE_KEY=\t\t0x03, /* EVP_PKEY * */\n\tSTORE_OBJECT_TYPE_PUBLIC_KEY=\t\t0x04, /* EVP_PKEY * */\n\tSTORE_OBJECT_TYPE_NUMBER=\t\t0x05, /* BIGNUM * */\n\tSTORE_OBJECT_TYPE_ARBITRARY=\t\t0x06, /* BUF_MEM * */\n\tSTORE_OBJECT_TYPE_NUM=\t\t\t0x06  /* The amount of known\n\t\t\t\t\t\t\t object types */\n\t} STORE_OBJECT_TYPES;\n/* List of text strings corresponding to the object types. */\nextern const char * const STORE_object_type_string[STORE_OBJECT_TYPE_NUM+1];\n\n/* Some store functions take a parameter list.  Those parameters come with\n   one of the following codes. The comments following the codes below indicate\n   what type the value should be a pointer to. */\ntypedef enum STORE_params\n\t{\n\tSTORE_PARAM_EVP_TYPE=\t\t\t0x01, /* int */\n\tSTORE_PARAM_BITS=\t\t\t0x02, /* size_t */\n\tSTORE_PARAM_KEY_PARAMETERS=\t\t0x03, /* ??? */\n\tSTORE_PARAM_KEY_NO_PARAMETERS=\t\t0x04, /* N/A */\n\tSTORE_PARAM_AUTH_PASSPHRASE=\t\t0x05, /* char * */\n\tSTORE_PARAM_AUTH_KRB5_TICKET=\t\t0x06, /* void * */\n\tSTORE_PARAM_TYPE_NUM=\t\t\t0x06  /* The amount of known\n\t\t\t\t\t\t\t parameter types */\n\t} STORE_PARAM_TYPES;\n/* Parameter value sizes.  -1 means unknown, anything else is the required size. */\nextern const int STORE_param_sizes[STORE_PARAM_TYPE_NUM+1];\n\n/* Store functions take attribute lists.  Those attributes come with codes.\n   The comments following the codes below indicate what type the value should\n   be a pointer to. */\ntypedef enum STORE_attribs\n\t{\n\tSTORE_ATTR_END=\t\t\t\t0x00,\n\tSTORE_ATTR_FRIENDLYNAME=\t\t0x01, /* C string */\n\tSTORE_ATTR_KEYID=\t\t\t0x02, /* 160 bit string (SHA1) */\n\tSTORE_ATTR_ISSUERKEYID=\t\t\t0x03, /* 160 bit string (SHA1) */\n\tSTORE_ATTR_SUBJECTKEYID=\t\t0x04, /* 160 bit string (SHA1) */\n\tSTORE_ATTR_ISSUERSERIALHASH=\t\t0x05, /* 160 bit string (SHA1) */\n\tSTORE_ATTR_ISSUER=\t\t\t0x06, /* X509_NAME * */\n\tSTORE_ATTR_SERIAL=\t\t\t0x07, /* BIGNUM * */\n\tSTORE_ATTR_SUBJECT=\t\t\t0x08, /* X509_NAME * */\n\tSTORE_ATTR_CERTHASH=\t\t\t0x09, /* 160 bit string (SHA1) */\n\tSTORE_ATTR_EMAIL=\t\t\t0x0a, /* C string */\n\tSTORE_ATTR_FILENAME=\t\t\t0x0b, /* C string */\n\tSTORE_ATTR_TYPE_NUM=\t\t\t0x0b, /* The amount of known\n\t\t\t\t\t\t\t attribute types */\n\tSTORE_ATTR_OR=\t\t\t\t0xff  /* This is a special\n\t\t\t\t\t\t\t separator, which\n\t\t\t\t\t\t\t expresses the OR\n\t\t\t\t\t\t\t operation.  */\n\t} STORE_ATTR_TYPES;\n/* Attribute value sizes.  -1 means unknown, anything else is the required size. */\nextern const int STORE_attr_sizes[STORE_ATTR_TYPE_NUM+1];\n\ntypedef enum STORE_certificate_status\n\t{\n\tSTORE_X509_VALID=\t\t\t0x00,\n\tSTORE_X509_EXPIRED=\t\t\t0x01,\n\tSTORE_X509_SUSPENDED=\t\t\t0x02,\n\tSTORE_X509_REVOKED=\t\t\t0x03\n\t} STORE_CERTIFICATE_STATUS;\n\n/* Engine store functions will return a structure that contains all the necessary\n * information, including revokation status for certificates.  This is really not\n * needed for application authors, as the ENGINE framework functions will extract\n * the OpenSSL-specific information when at all possible.  However, for engine\n * authors, it's crucial to know this structure.  */\ntypedef struct STORE_OBJECT_st\n\t{\n\tSTORE_OBJECT_TYPES type;\n\tunion\n\t\t{\n\t\tstruct\n\t\t\t{\n\t\t\tSTORE_CERTIFICATE_STATUS status;\n\t\t\tX509 *certificate;\n\t\t\t} x509;\n\t\tX509_CRL *crl;\n\t\tEVP_PKEY *key;\n\t\tBIGNUM *number;\n\t\tBUF_MEM *arbitrary;\n\t\t} data;\n\t} STORE_OBJECT;\nDECLARE_STACK_OF(STORE_OBJECT)\nSTORE_OBJECT *STORE_OBJECT_new(void);\nvoid STORE_OBJECT_free(STORE_OBJECT *data);\n\n\n\n/* The following functions handle the storage. They return 0, a negative number\n   or NULL on error, anything else on success. */\nX509 *STORE_get_certificate(STORE *e, OPENSSL_ITEM attributes[],\n\tOPENSSL_ITEM parameters[]);\nint STORE_store_certificate(STORE *e, X509 *data, OPENSSL_ITEM attributes[],\n\tOPENSSL_ITEM parameters[]);\nint STORE_modify_certificate(STORE *e, OPENSSL_ITEM search_attributes[],\n\tOPENSSL_ITEM add_attributes[], OPENSSL_ITEM modify_attributes[],\n\tOPENSSL_ITEM delete_attributes[], OPENSSL_ITEM parameters[]);\nint STORE_revoke_certificate(STORE *e, OPENSSL_ITEM attributes[],\n\tOPENSSL_ITEM parameters[]);\nint STORE_delete_certificate(STORE *e, OPENSSL_ITEM attributes[],\n\tOPENSSL_ITEM parameters[]);\nvoid *STORE_list_certificate_start(STORE *e, OPENSSL_ITEM attributes[],\n\tOPENSSL_ITEM parameters[]);\nX509 *STORE_list_certificate_next(STORE *e, void *handle);\nint STORE_list_certificate_end(STORE *e, void *handle);\nint STORE_list_certificate_endp(STORE *e, void *handle);\nEVP_PKEY *STORE_generate_key(STORE *e, OPENSSL_ITEM attributes[],\n\tOPENSSL_ITEM parameters[]);\nEVP_PKEY *STORE_get_private_key(STORE *e, OPENSSL_ITEM attributes[],\n\tOPENSSL_ITEM parameters[]);\nint STORE_store_private_key(STORE *e, EVP_PKEY *data,\n\tOPENSSL_ITEM attributes[], OPENSSL_ITEM parameters[]);\nint STORE_modify_private_key(STORE *e, OPENSSL_ITEM search_attributes[],\n\tOPENSSL_ITEM add_sttributes[], OPENSSL_ITEM modify_attributes[],\n\tOPENSSL_ITEM delete_attributes[], OPENSSL_ITEM parameters[]);\nint STORE_revoke_private_key(STORE *e, OPENSSL_ITEM attributes[],\n\tOPENSSL_ITEM parameters[]);\nint STORE_delete_private_key(STORE *e, OPENSSL_ITEM attributes[],\n\tOPENSSL_ITEM parameters[]);\nvoid *STORE_list_private_key_start(STORE *e, OPENSSL_ITEM attributes[],\n\tOPENSSL_ITEM parameters[]);\nEVP_PKEY *STORE_list_private_key_next(STORE *e, void *handle);\nint STORE_list_private_key_end(STORE *e, void *handle);\nint STORE_list_private_key_endp(STORE *e, void *handle);\nEVP_PKEY *STORE_get_public_key(STORE *e, OPENSSL_ITEM attributes[],\n\tOPENSSL_ITEM parameters[]);\nint STORE_store_public_key(STORE *e, EVP_PKEY *data, OPENSSL_ITEM attributes[],\n\tOPENSSL_ITEM parameters[]);\nint STORE_modify_public_key(STORE *e, OPENSSL_ITEM search_attributes[],\n\tOPENSSL_ITEM add_sttributes[], OPENSSL_ITEM modify_attributes[],\n\tOPENSSL_ITEM delete_attributes[], OPENSSL_ITEM parameters[]);\nint STORE_revoke_public_key(STORE *e, OPENSSL_ITEM attributes[],\n\tOPENSSL_ITEM parameters[]);\nint STORE_delete_public_key(STORE *e, OPENSSL_ITEM attributes[],\n\tOPENSSL_ITEM parameters[]);\nvoid *STORE_list_public_key_start(STORE *e, OPENSSL_ITEM attributes[],\n\tOPENSSL_ITEM parameters[]);\nEVP_PKEY *STORE_list_public_key_next(STORE *e, void *handle);\nint STORE_list_public_key_end(STORE *e, void *handle);\nint STORE_list_public_key_endp(STORE *e, void *handle);\nX509_CRL *STORE_generate_crl(STORE *e, OPENSSL_ITEM attributes[],\n\tOPENSSL_ITEM parameters[]);\nX509_CRL *STORE_get_crl(STORE *e, OPENSSL_ITEM attributes[],\n\tOPENSSL_ITEM parameters[]);\nint STORE_store_crl(STORE *e, X509_CRL *data, OPENSSL_ITEM attributes[],\n\tOPENSSL_ITEM parameters[]);\nint STORE_modify_crl(STORE *e, OPENSSL_ITEM search_attributes[],\n\tOPENSSL_ITEM add_sttributes[], OPENSSL_ITEM modify_attributes[],\n\tOPENSSL_ITEM delete_attributes[], OPENSSL_ITEM parameters[]);\nint STORE_delete_crl(STORE *e, OPENSSL_ITEM attributes[],\n\tOPENSSL_ITEM parameters[]);\nvoid *STORE_list_crl_start(STORE *e, OPENSSL_ITEM attributes[],\n\tOPENSSL_ITEM parameters[]);\nX509_CRL *STORE_list_crl_next(STORE *e, void *handle);\nint STORE_list_crl_end(STORE *e, void *handle);\nint STORE_list_crl_endp(STORE *e, void *handle);\nint STORE_store_number(STORE *e, BIGNUM *data, OPENSSL_ITEM attributes[],\n\tOPENSSL_ITEM parameters[]);\nint STORE_modify_number(STORE *e, OPENSSL_ITEM search_attributes[],\n\tOPENSSL_ITEM add_sttributes[], OPENSSL_ITEM modify_attributes[],\n\tOPENSSL_ITEM delete_attributes[], OPENSSL_ITEM parameters[]);\nBIGNUM *STORE_get_number(STORE *e, OPENSSL_ITEM attributes[],\n\tOPENSSL_ITEM parameters[]);\nint STORE_delete_number(STORE *e, OPENSSL_ITEM attributes[],\n\tOPENSSL_ITEM parameters[]);\nint STORE_store_arbitrary(STORE *e, BUF_MEM *data, OPENSSL_ITEM attributes[],\n\tOPENSSL_ITEM parameters[]);\nint STORE_modify_arbitrary(STORE *e, OPENSSL_ITEM search_attributes[],\n\tOPENSSL_ITEM add_sttributes[], OPENSSL_ITEM modify_attributes[],\n\tOPENSSL_ITEM delete_attributes[], OPENSSL_ITEM parameters[]);\nBUF_MEM *STORE_get_arbitrary(STORE *e, OPENSSL_ITEM attributes[],\n\tOPENSSL_ITEM parameters[]);\nint STORE_delete_arbitrary(STORE *e, OPENSSL_ITEM attributes[],\n\tOPENSSL_ITEM parameters[]);\n\n\n/* Create and manipulate methods */\nSTORE_METHOD *STORE_create_method(char *name);\nvoid STORE_destroy_method(STORE_METHOD *store_method);\n\n/* These callback types are use for store handlers */\ntypedef int (*STORE_INITIALISE_FUNC_PTR)(STORE *);\ntypedef void (*STORE_CLEANUP_FUNC_PTR)(STORE *);\ntypedef STORE_OBJECT *(*STORE_GENERATE_OBJECT_FUNC_PTR)(STORE *, STORE_OBJECT_TYPES type, OPENSSL_ITEM attributes[], OPENSSL_ITEM parameters[]);\ntypedef STORE_OBJECT *(*STORE_GET_OBJECT_FUNC_PTR)(STORE *, STORE_OBJECT_TYPES type, OPENSSL_ITEM attributes[], OPENSSL_ITEM parameters[]);\ntypedef void *(*STORE_START_OBJECT_FUNC_PTR)(STORE *, STORE_OBJECT_TYPES type, OPENSSL_ITEM attributes[], OPENSSL_ITEM parameters[]);\ntypedef STORE_OBJECT *(*STORE_NEXT_OBJECT_FUNC_PTR)(STORE *, void *handle);\ntypedef int (*STORE_END_OBJECT_FUNC_PTR)(STORE *, void *handle);\ntypedef int (*STORE_HANDLE_OBJECT_FUNC_PTR)(STORE *, STORE_OBJECT_TYPES type, OPENSSL_ITEM attributes[], OPENSSL_ITEM parameters[]);\ntypedef int (*STORE_STORE_OBJECT_FUNC_PTR)(STORE *, STORE_OBJECT_TYPES type, STORE_OBJECT *data, OPENSSL_ITEM attributes[], OPENSSL_ITEM parameters[]);\ntypedef int (*STORE_MODIFY_OBJECT_FUNC_PTR)(STORE *, STORE_OBJECT_TYPES type, OPENSSL_ITEM search_attributes[], OPENSSL_ITEM add_attributes[], OPENSSL_ITEM modify_attributes[], OPENSSL_ITEM delete_attributes[], OPENSSL_ITEM parameters[]);\ntypedef int (*STORE_GENERIC_FUNC_PTR)(STORE *, OPENSSL_ITEM attributes[], OPENSSL_ITEM parameters[]);\ntypedef int (*STORE_CTRL_FUNC_PTR)(STORE *, int cmd, long l, void *p, void (*f)(void));\n\nint STORE_method_set_initialise_function(STORE_METHOD *sm, STORE_INITIALISE_FUNC_PTR init_f);\nint STORE_method_set_cleanup_function(STORE_METHOD *sm, STORE_CLEANUP_FUNC_PTR clean_f);\nint STORE_method_set_generate_function(STORE_METHOD *sm, STORE_GENERATE_OBJECT_FUNC_PTR generate_f);\nint STORE_method_set_get_function(STORE_METHOD *sm, STORE_GET_OBJECT_FUNC_PTR get_f);\nint STORE_method_set_store_function(STORE_METHOD *sm, STORE_STORE_OBJECT_FUNC_PTR store_f);\nint STORE_method_set_modify_function(STORE_METHOD *sm, STORE_MODIFY_OBJECT_FUNC_PTR store_f);\nint STORE_method_set_revoke_function(STORE_METHOD *sm, STORE_HANDLE_OBJECT_FUNC_PTR revoke_f);\nint STORE_method_set_delete_function(STORE_METHOD *sm, STORE_HANDLE_OBJECT_FUNC_PTR delete_f);\nint STORE_method_set_list_start_function(STORE_METHOD *sm, STORE_START_OBJECT_FUNC_PTR list_start_f);\nint STORE_method_set_list_next_function(STORE_METHOD *sm, STORE_NEXT_OBJECT_FUNC_PTR list_next_f);\nint STORE_method_set_list_end_function(STORE_METHOD *sm, STORE_END_OBJECT_FUNC_PTR list_end_f);\nint STORE_method_set_update_store_function(STORE_METHOD *sm, STORE_GENERIC_FUNC_PTR);\nint STORE_method_set_lock_store_function(STORE_METHOD *sm, STORE_GENERIC_FUNC_PTR);\nint STORE_method_set_unlock_store_function(STORE_METHOD *sm, STORE_GENERIC_FUNC_PTR);\nint STORE_method_set_ctrl_function(STORE_METHOD *sm, STORE_CTRL_FUNC_PTR ctrl_f);\n\nSTORE_INITIALISE_FUNC_PTR STORE_method_get_initialise_function(STORE_METHOD *sm);\nSTORE_CLEANUP_FUNC_PTR STORE_method_get_cleanup_function(STORE_METHOD *sm);\nSTORE_GENERATE_OBJECT_FUNC_PTR STORE_method_get_generate_function(STORE_METHOD *sm);\nSTORE_GET_OBJECT_FUNC_PTR STORE_method_get_get_function(STORE_METHOD *sm);\nSTORE_STORE_OBJECT_FUNC_PTR STORE_method_get_store_function(STORE_METHOD *sm);\nSTORE_MODIFY_OBJECT_FUNC_PTR STORE_method_get_modify_function(STORE_METHOD *sm);\nSTORE_HANDLE_OBJECT_FUNC_PTR STORE_method_get_revoke_function(STORE_METHOD *sm);\nSTORE_HANDLE_OBJECT_FUNC_PTR STORE_method_get_delete_function(STORE_METHOD *sm);\nSTORE_START_OBJECT_FUNC_PTR STORE_method_get_list_start_function(STORE_METHOD *sm);\nSTORE_NEXT_OBJECT_FUNC_PTR STORE_method_get_list_next_function(STORE_METHOD *sm);\nSTORE_END_OBJECT_FUNC_PTR STORE_method_get_list_end_function(STORE_METHOD *sm);\nSTORE_GENERIC_FUNC_PTR STORE_method_get_update_store_function(STORE_METHOD *sm);\nSTORE_GENERIC_FUNC_PTR STORE_method_get_lock_store_function(STORE_METHOD *sm);\nSTORE_GENERIC_FUNC_PTR STORE_method_get_unlock_store_function(STORE_METHOD *sm);\nSTORE_CTRL_FUNC_PTR STORE_method_get_ctrl_function(STORE_METHOD *sm);\n\n/* Method helper structures and functions. */\n\n/* This structure is the result of parsing through the information in a list\n   of OPENSSL_ITEMs.  It stores all the necessary information in a structured\n   way.*/\ntypedef struct STORE_attr_info_st STORE_ATTR_INFO;\n\n/* Parse a list of OPENSSL_ITEMs and return a pointer to a STORE_ATTR_INFO.\n   Note that we do this in the list form, since the list of OPENSSL_ITEMs can\n   come in blocks separated with STORE_ATTR_OR.  Note that the value returned\n   by STORE_parse_attrs_next() must be freed with STORE_ATTR_INFO_free(). */\nvoid *STORE_parse_attrs_start(OPENSSL_ITEM *attributes);\nSTORE_ATTR_INFO *STORE_parse_attrs_next(void *handle);\nint STORE_parse_attrs_end(void *handle);\nint STORE_parse_attrs_endp(void *handle);\n\n/* Creator and destructor */\nSTORE_ATTR_INFO *STORE_ATTR_INFO_new(void);\nint STORE_ATTR_INFO_free(STORE_ATTR_INFO *attrs);\n\n/* Manipulators */\nchar *STORE_ATTR_INFO_get0_cstr(STORE_ATTR_INFO *attrs, STORE_ATTR_TYPES code);\nunsigned char *STORE_ATTR_INFO_get0_sha1str(STORE_ATTR_INFO *attrs,\n\tSTORE_ATTR_TYPES code);\nX509_NAME *STORE_ATTR_INFO_get0_dn(STORE_ATTR_INFO *attrs, STORE_ATTR_TYPES code);\nBIGNUM *STORE_ATTR_INFO_get0_number(STORE_ATTR_INFO *attrs, STORE_ATTR_TYPES code);\nint STORE_ATTR_INFO_set_cstr(STORE_ATTR_INFO *attrs, STORE_ATTR_TYPES code,\n\tchar *cstr, size_t cstr_size);\nint STORE_ATTR_INFO_set_sha1str(STORE_ATTR_INFO *attrs, STORE_ATTR_TYPES code,\n\tunsigned char *sha1str, size_t sha1str_size);\nint STORE_ATTR_INFO_set_dn(STORE_ATTR_INFO *attrs, STORE_ATTR_TYPES code,\n\tX509_NAME *dn);\nint STORE_ATTR_INFO_set_number(STORE_ATTR_INFO *attrs, STORE_ATTR_TYPES code,\n\tBIGNUM *number);\nint STORE_ATTR_INFO_modify_cstr(STORE_ATTR_INFO *attrs, STORE_ATTR_TYPES code,\n\tchar *cstr, size_t cstr_size);\nint STORE_ATTR_INFO_modify_sha1str(STORE_ATTR_INFO *attrs, STORE_ATTR_TYPES code,\n\tunsigned char *sha1str, size_t sha1str_size);\nint STORE_ATTR_INFO_modify_dn(STORE_ATTR_INFO *attrs, STORE_ATTR_TYPES code,\n\tX509_NAME *dn);\nint STORE_ATTR_INFO_modify_number(STORE_ATTR_INFO *attrs, STORE_ATTR_TYPES code,\n\tBIGNUM *number);\n\n/* Compare on basis of a bit pattern formed by the STORE_ATTR_TYPES values\n   in each contained attribute. */\nint STORE_ATTR_INFO_compare(STORE_ATTR_INFO *a, STORE_ATTR_INFO *b);\n/* Check if the set of attributes in a is within the range of attributes\n   set in b. */\nint STORE_ATTR_INFO_in_range(STORE_ATTR_INFO *a, STORE_ATTR_INFO *b);\n/* Check if the set of attributes in a are also set in b. */\nint STORE_ATTR_INFO_in(STORE_ATTR_INFO *a, STORE_ATTR_INFO *b);\n/* Same as STORE_ATTR_INFO_in(), but also checks the attribute values. */\nint STORE_ATTR_INFO_in_ex(STORE_ATTR_INFO *a, STORE_ATTR_INFO *b);\n\n\n/* BEGIN ERROR CODES */\n/* The following lines are auto generated by the script mkerr.pl. Any changes\n * made after this point may be overwritten when the script is next run.\n */\nvoid ERR_load_STORE_strings(void);\n\n/* Error codes for the STORE functions. */\n\n/* Function codes. */\n#define STORE_F_MEM_DELETE\t\t\t\t 134\n#define STORE_F_MEM_GENERATE\t\t\t\t 135\n#define STORE_F_MEM_LIST_END\t\t\t\t 168\n#define STORE_F_MEM_LIST_NEXT\t\t\t\t 136\n#define STORE_F_MEM_LIST_START\t\t\t\t 137\n#define STORE_F_MEM_MODIFY\t\t\t\t 169\n#define STORE_F_MEM_STORE\t\t\t\t 138\n#define STORE_F_STORE_ATTR_INFO_GET0_CSTR\t\t 139\n#define STORE_F_STORE_ATTR_INFO_GET0_DN\t\t\t 140\n#define STORE_F_STORE_ATTR_INFO_GET0_NUMBER\t\t 141\n#define STORE_F_STORE_ATTR_INFO_GET0_SHA1STR\t\t 142\n#define STORE_F_STORE_ATTR_INFO_MODIFY_CSTR\t\t 143\n#define STORE_F_STORE_ATTR_INFO_MODIFY_DN\t\t 144\n#define STORE_F_STORE_ATTR_INFO_MODIFY_NUMBER\t\t 145\n#define STORE_F_STORE_ATTR_INFO_MODIFY_SHA1STR\t\t 146\n#define STORE_F_STORE_ATTR_INFO_SET_CSTR\t\t 147\n#define STORE_F_STORE_ATTR_INFO_SET_DN\t\t\t 148\n#define STORE_F_STORE_ATTR_INFO_SET_NUMBER\t\t 149\n#define STORE_F_STORE_ATTR_INFO_SET_SHA1STR\t\t 150\n#define STORE_F_STORE_CERTIFICATE\t\t\t 170\n#define STORE_F_STORE_CTRL\t\t\t\t 161\n#define STORE_F_STORE_DELETE_ARBITRARY\t\t\t 158\n#define STORE_F_STORE_DELETE_CERTIFICATE\t\t 102\n#define STORE_F_STORE_DELETE_CRL\t\t\t 103\n#define STORE_F_STORE_DELETE_NUMBER\t\t\t 104\n#define STORE_F_STORE_DELETE_PRIVATE_KEY\t\t 105\n#define STORE_F_STORE_DELETE_PUBLIC_KEY\t\t\t 106\n#define STORE_F_STORE_GENERATE_CRL\t\t\t 107\n#define STORE_F_STORE_GENERATE_KEY\t\t\t 108\n#define STORE_F_STORE_GET_ARBITRARY\t\t\t 159\n#define STORE_F_STORE_GET_CERTIFICATE\t\t\t 109\n#define STORE_F_STORE_GET_CRL\t\t\t\t 110\n#define STORE_F_STORE_GET_NUMBER\t\t\t 111\n#define STORE_F_STORE_GET_PRIVATE_KEY\t\t\t 112\n#define STORE_F_STORE_GET_PUBLIC_KEY\t\t\t 113\n#define STORE_F_STORE_LIST_CERTIFICATE_END\t\t 114\n#define STORE_F_STORE_LIST_CERTIFICATE_ENDP\t\t 153\n#define STORE_F_STORE_LIST_CERTIFICATE_NEXT\t\t 115\n#define STORE_F_STORE_LIST_CERTIFICATE_START\t\t 116\n#define STORE_F_STORE_LIST_CRL_END\t\t\t 117\n#define STORE_F_STORE_LIST_CRL_ENDP\t\t\t 154\n#define STORE_F_STORE_LIST_CRL_NEXT\t\t\t 118\n#define STORE_F_STORE_LIST_CRL_START\t\t\t 119\n#define STORE_F_STORE_LIST_PRIVATE_KEY_END\t\t 120\n#define STORE_F_STORE_LIST_PRIVATE_KEY_ENDP\t\t 155\n#define STORE_F_STORE_LIST_PRIVATE_KEY_NEXT\t\t 121\n#define STORE_F_STORE_LIST_PRIVATE_KEY_START\t\t 122\n#define STORE_F_STORE_LIST_PUBLIC_KEY_END\t\t 123\n#define STORE_F_STORE_LIST_PUBLIC_KEY_ENDP\t\t 156\n#define STORE_F_STORE_LIST_PUBLIC_KEY_NEXT\t\t 124\n#define STORE_F_STORE_LIST_PUBLIC_KEY_START\t\t 125\n#define STORE_F_STORE_MODIFY_ARBITRARY\t\t\t 162\n#define STORE_F_STORE_MODIFY_CERTIFICATE\t\t 163\n#define STORE_F_STORE_MODIFY_CRL\t\t\t 164\n#define STORE_F_STORE_MODIFY_NUMBER\t\t\t 165\n#define STORE_F_STORE_MODIFY_PRIVATE_KEY\t\t 166\n#define STORE_F_STORE_MODIFY_PUBLIC_KEY\t\t\t 167\n#define STORE_F_STORE_NEW_ENGINE\t\t\t 133\n#define STORE_F_STORE_NEW_METHOD\t\t\t 132\n#define STORE_F_STORE_PARSE_ATTRS_END\t\t\t 151\n#define STORE_F_STORE_PARSE_ATTRS_ENDP\t\t\t 172\n#define STORE_F_STORE_PARSE_ATTRS_NEXT\t\t\t 152\n#define STORE_F_STORE_PARSE_ATTRS_START\t\t\t 171\n#define STORE_F_STORE_REVOKE_CERTIFICATE\t\t 129\n#define STORE_F_STORE_REVOKE_PRIVATE_KEY\t\t 130\n#define STORE_F_STORE_REVOKE_PUBLIC_KEY\t\t\t 131\n#define STORE_F_STORE_STORE_ARBITRARY\t\t\t 157\n#define STORE_F_STORE_STORE_CERTIFICATE\t\t\t 100\n#define STORE_F_STORE_STORE_CRL\t\t\t\t 101\n#define STORE_F_STORE_STORE_NUMBER\t\t\t 126\n#define STORE_F_STORE_STORE_PRIVATE_KEY\t\t\t 127\n#define STORE_F_STORE_STORE_PUBLIC_KEY\t\t\t 128\n\n/* Reason codes. */\n#define STORE_R_ALREADY_HAS_A_VALUE\t\t\t 127\n#define STORE_R_FAILED_DELETING_ARBITRARY\t\t 132\n#define STORE_R_FAILED_DELETING_CERTIFICATE\t\t 100\n#define STORE_R_FAILED_DELETING_KEY\t\t\t 101\n#define STORE_R_FAILED_DELETING_NUMBER\t\t\t 102\n#define STORE_R_FAILED_GENERATING_CRL\t\t\t 103\n#define STORE_R_FAILED_GENERATING_KEY\t\t\t 104\n#define STORE_R_FAILED_GETTING_ARBITRARY\t\t 133\n#define STORE_R_FAILED_GETTING_CERTIFICATE\t\t 105\n#define STORE_R_FAILED_GETTING_KEY\t\t\t 106\n#define STORE_R_FAILED_GETTING_NUMBER\t\t\t 107\n#define STORE_R_FAILED_LISTING_CERTIFICATES\t\t 108\n#define STORE_R_FAILED_LISTING_KEYS\t\t\t 109\n#define STORE_R_FAILED_MODIFYING_ARBITRARY\t\t 138\n#define STORE_R_FAILED_MODIFYING_CERTIFICATE\t\t 139\n#define STORE_R_FAILED_MODIFYING_CRL\t\t\t 140\n#define STORE_R_FAILED_MODIFYING_NUMBER\t\t\t 141\n#define STORE_R_FAILED_MODIFYING_PRIVATE_KEY\t\t 142\n#define STORE_R_FAILED_MODIFYING_PUBLIC_KEY\t\t 143\n#define STORE_R_FAILED_REVOKING_CERTIFICATE\t\t 110\n#define STORE_R_FAILED_REVOKING_KEY\t\t\t 111\n#define STORE_R_FAILED_STORING_ARBITRARY\t\t 134\n#define STORE_R_FAILED_STORING_CERTIFICATE\t\t 112\n#define STORE_R_FAILED_STORING_KEY\t\t\t 113\n#define STORE_R_FAILED_STORING_NUMBER\t\t\t 114\n#define STORE_R_NOT_IMPLEMENTED\t\t\t\t 128\n#define STORE_R_NO_CONTROL_FUNCTION\t\t\t 144\n#define STORE_R_NO_DELETE_ARBITRARY_FUNCTION\t\t 135\n#define STORE_R_NO_DELETE_NUMBER_FUNCTION\t\t 115\n#define STORE_R_NO_DELETE_OBJECT_FUNCTION\t\t 116\n#define STORE_R_NO_GENERATE_CRL_FUNCTION\t\t 117\n#define STORE_R_NO_GENERATE_OBJECT_FUNCTION\t\t 118\n#define STORE_R_NO_GET_OBJECT_ARBITRARY_FUNCTION\t 136\n#define STORE_R_NO_GET_OBJECT_FUNCTION\t\t\t 119\n#define STORE_R_NO_GET_OBJECT_NUMBER_FUNCTION\t\t 120\n#define STORE_R_NO_LIST_OBJECT_ENDP_FUNCTION\t\t 131\n#define STORE_R_NO_LIST_OBJECT_END_FUNCTION\t\t 121\n#define STORE_R_NO_LIST_OBJECT_NEXT_FUNCTION\t\t 122\n#define STORE_R_NO_LIST_OBJECT_START_FUNCTION\t\t 123\n#define STORE_R_NO_MODIFY_OBJECT_FUNCTION\t\t 145\n#define STORE_R_NO_REVOKE_OBJECT_FUNCTION\t\t 124\n#define STORE_R_NO_STORE\t\t\t\t 129\n#define STORE_R_NO_STORE_OBJECT_ARBITRARY_FUNCTION\t 137\n#define STORE_R_NO_STORE_OBJECT_FUNCTION\t\t 125\n#define STORE_R_NO_STORE_OBJECT_NUMBER_FUNCTION\t\t 126\n#define STORE_R_NO_VALUE\t\t\t\t 130\n\n#ifdef  __cplusplus\n}\n#endif\n#endif\n"
  },
  {
    "path": "freebsd-headers/openssl/symhacks.h",
    "content": "/* ====================================================================\n * Copyright (c) 1999 The OpenSSL Project.  All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n *\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer. \n *\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in\n *    the documentation and/or other materials provided with the\n *    distribution.\n *\n * 3. All advertising materials mentioning features or use of this\n *    software must display the following acknowledgment:\n *    \"This product includes software developed by the OpenSSL Project\n *    for use in the OpenSSL Toolkit. (http://www.openssl.org/)\"\n *\n * 4. The names \"OpenSSL Toolkit\" and \"OpenSSL Project\" must not be used to\n *    endorse or promote products derived from this software without\n *    prior written permission. For written permission, please contact\n *    openssl-core@openssl.org.\n *\n * 5. Products derived from this software may not be called \"OpenSSL\"\n *    nor may \"OpenSSL\" appear in their names without prior written\n *    permission of the OpenSSL Project.\n *\n * 6. Redistributions of any form whatsoever must retain the following\n *    acknowledgment:\n *    \"This product includes software developed by the OpenSSL Project\n *    for use in the OpenSSL Toolkit (http://www.openssl.org/)\"\n *\n * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY\n * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\n * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE OpenSSL PROJECT OR\n * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\n * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,\n * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED\n * OF THE POSSIBILITY OF SUCH DAMAGE.\n * ====================================================================\n *\n * This product includes cryptographic software written by Eric Young\n * (eay@cryptsoft.com).  This product includes software written by Tim\n * Hudson (tjh@cryptsoft.com).\n *\n */\n\n#ifndef HEADER_SYMHACKS_H\n#define HEADER_SYMHACKS_H\n\n#include <openssl/e_os2.h>\n\n/* Hacks to solve the problem with linkers incapable of handling very long\n   symbol names.  In the case of VMS, the limit is 31 characters on VMS for\n   VAX. */\n/* Note that this affects util/libeay.num and util/ssleay.num...  you may\n   change those manually, but that's not recommended, as those files are\n   controlled centrally and updated on Unix, and the central definition\n   may disagree with yours, which in turn may come with shareable library\n   incompatibilities. */\n#ifdef OPENSSL_SYS_VMS\n\n/* Hack a long name in crypto/cryptlib.c */\n#undef int_CRYPTO_set_do_dynlock_callback\n#define int_CRYPTO_set_do_dynlock_callback\tint_CRYPTO_set_do_dynlock_cb\n\n/* Hack a long name in crypto/ex_data.c */\n#undef CRYPTO_get_ex_data_implementation\n#define CRYPTO_get_ex_data_implementation\tCRYPTO_get_ex_data_impl\n#undef CRYPTO_set_ex_data_implementation\n#define CRYPTO_set_ex_data_implementation\tCRYPTO_set_ex_data_impl\n\n/* Hack a long name in crypto/asn1/a_mbstr.c */\n#undef ASN1_STRING_set_default_mask_asc\n#define ASN1_STRING_set_default_mask_asc\tASN1_STRING_set_def_mask_asc\n\n#if 0 /* No longer needed, since safestack macro magic does the job */\n/* Hack the names created with DECLARE_ASN1_SET_OF(PKCS7_SIGNER_INFO) */\n#undef i2d_ASN1_SET_OF_PKCS7_SIGNER_INFO\n#define i2d_ASN1_SET_OF_PKCS7_SIGNER_INFO\ti2d_ASN1_SET_OF_PKCS7_SIGINF\n#undef d2i_ASN1_SET_OF_PKCS7_SIGNER_INFO\n#define d2i_ASN1_SET_OF_PKCS7_SIGNER_INFO\td2i_ASN1_SET_OF_PKCS7_SIGINF\n#endif\n\n#if 0 /* No longer needed, since safestack macro magic does the job */\n/* Hack the names created with DECLARE_ASN1_SET_OF(PKCS7_RECIP_INFO) */\n#undef i2d_ASN1_SET_OF_PKCS7_RECIP_INFO\n#define i2d_ASN1_SET_OF_PKCS7_RECIP_INFO\ti2d_ASN1_SET_OF_PKCS7_RECINF\n#undef d2i_ASN1_SET_OF_PKCS7_RECIP_INFO\n#define d2i_ASN1_SET_OF_PKCS7_RECIP_INFO\td2i_ASN1_SET_OF_PKCS7_RECINF\n#endif\n\n#if 0 /* No longer needed, since safestack macro magic does the job */\n/* Hack the names created with DECLARE_ASN1_SET_OF(ACCESS_DESCRIPTION) */\n#undef i2d_ASN1_SET_OF_ACCESS_DESCRIPTION\n#define i2d_ASN1_SET_OF_ACCESS_DESCRIPTION\ti2d_ASN1_SET_OF_ACC_DESC\n#undef d2i_ASN1_SET_OF_ACCESS_DESCRIPTION\n#define d2i_ASN1_SET_OF_ACCESS_DESCRIPTION\td2i_ASN1_SET_OF_ACC_DESC\n#endif\n\n/* Hack the names created with DECLARE_PEM_rw(NETSCAPE_CERT_SEQUENCE) */\n#undef PEM_read_NETSCAPE_CERT_SEQUENCE\n#define PEM_read_NETSCAPE_CERT_SEQUENCE\t\tPEM_read_NS_CERT_SEQ\n#undef PEM_write_NETSCAPE_CERT_SEQUENCE\n#define PEM_write_NETSCAPE_CERT_SEQUENCE\tPEM_write_NS_CERT_SEQ\n#undef PEM_read_bio_NETSCAPE_CERT_SEQUENCE\n#define PEM_read_bio_NETSCAPE_CERT_SEQUENCE\tPEM_read_bio_NS_CERT_SEQ\n#undef PEM_write_bio_NETSCAPE_CERT_SEQUENCE\n#define PEM_write_bio_NETSCAPE_CERT_SEQUENCE\tPEM_write_bio_NS_CERT_SEQ\n#undef PEM_write_cb_bio_NETSCAPE_CERT_SEQUENCE\n#define PEM_write_cb_bio_NETSCAPE_CERT_SEQUENCE\tPEM_write_cb_bio_NS_CERT_SEQ\n\n/* Hack the names created with DECLARE_PEM_rw(PKCS8_PRIV_KEY_INFO) */\n#undef PEM_read_PKCS8_PRIV_KEY_INFO\n#define PEM_read_PKCS8_PRIV_KEY_INFO\t\tPEM_read_P8_PRIV_KEY_INFO\n#undef PEM_write_PKCS8_PRIV_KEY_INFO\n#define PEM_write_PKCS8_PRIV_KEY_INFO\t\tPEM_write_P8_PRIV_KEY_INFO\n#undef PEM_read_bio_PKCS8_PRIV_KEY_INFO\n#define PEM_read_bio_PKCS8_PRIV_KEY_INFO\tPEM_read_bio_P8_PRIV_KEY_INFO\n#undef PEM_write_bio_PKCS8_PRIV_KEY_INFO\n#define PEM_write_bio_PKCS8_PRIV_KEY_INFO\tPEM_write_bio_P8_PRIV_KEY_INFO\n#undef PEM_write_cb_bio_PKCS8_PRIV_KEY_INFO\n#define PEM_write_cb_bio_PKCS8_PRIV_KEY_INFO\tPEM_wrt_cb_bio_P8_PRIV_KEY_INFO\n\n/* Hack other PEM names */\n#undef PEM_write_bio_PKCS8PrivateKey_nid\n#define PEM_write_bio_PKCS8PrivateKey_nid\tPEM_write_bio_PKCS8PrivKey_nid\n\n/* Hack some long X509 names */\n#undef X509_REVOKED_get_ext_by_critical\n#define X509_REVOKED_get_ext_by_critical\tX509_REVOKED_get_ext_by_critic\n#undef X509_policy_tree_get0_user_policies\n#define X509_policy_tree_get0_user_policies\tX509_pcy_tree_get0_usr_policies\n#undef X509_policy_node_get0_qualifiers\n#define X509_policy_node_get0_qualifiers\tX509_pcy_node_get0_qualifiers\n#undef X509_STORE_CTX_get_explicit_policy\n#define X509_STORE_CTX_get_explicit_policy\tX509_STORE_CTX_get_expl_policy\n#undef X509_STORE_CTX_get0_current_issuer\n#define X509_STORE_CTX_get0_current_issuer\tX509_STORE_CTX_get0_cur_issuer\n\n/* Hack some long CRYPTO names */\n#undef CRYPTO_set_dynlock_destroy_callback\n#define CRYPTO_set_dynlock_destroy_callback     CRYPTO_set_dynlock_destroy_cb\n#undef CRYPTO_set_dynlock_create_callback\n#define CRYPTO_set_dynlock_create_callback      CRYPTO_set_dynlock_create_cb\n#undef CRYPTO_set_dynlock_lock_callback\n#define CRYPTO_set_dynlock_lock_callback        CRYPTO_set_dynlock_lock_cb\n#undef CRYPTO_get_dynlock_lock_callback\n#define CRYPTO_get_dynlock_lock_callback        CRYPTO_get_dynlock_lock_cb\n#undef CRYPTO_get_dynlock_destroy_callback\n#define CRYPTO_get_dynlock_destroy_callback     CRYPTO_get_dynlock_destroy_cb\n#undef CRYPTO_get_dynlock_create_callback\n#define CRYPTO_get_dynlock_create_callback      CRYPTO_get_dynlock_create_cb\n#undef CRYPTO_set_locked_mem_ex_functions\n#define CRYPTO_set_locked_mem_ex_functions      CRYPTO_set_locked_mem_ex_funcs\n#undef CRYPTO_get_locked_mem_ex_functions\n#define CRYPTO_get_locked_mem_ex_functions      CRYPTO_get_locked_mem_ex_funcs\n\n/* Hack some long SSL names */\n#undef SSL_CTX_set_default_verify_paths\n#define SSL_CTX_set_default_verify_paths        SSL_CTX_set_def_verify_paths\n#undef SSL_get_ex_data_X509_STORE_CTX_idx\n#define SSL_get_ex_data_X509_STORE_CTX_idx      SSL_get_ex_d_X509_STORE_CTX_idx\n#undef SSL_add_file_cert_subjects_to_stack\n#define SSL_add_file_cert_subjects_to_stack     SSL_add_file_cert_subjs_to_stk\n#undef SSL_add_dir_cert_subjects_to_stack\n#define SSL_add_dir_cert_subjects_to_stack      SSL_add_dir_cert_subjs_to_stk\n#undef SSL_CTX_use_certificate_chain_file\n#define SSL_CTX_use_certificate_chain_file      SSL_CTX_use_cert_chain_file\n#undef SSL_CTX_set_cert_verify_callback\n#define SSL_CTX_set_cert_verify_callback        SSL_CTX_set_cert_verify_cb\n#undef SSL_CTX_set_default_passwd_cb_userdata\n#define SSL_CTX_set_default_passwd_cb_userdata  SSL_CTX_set_def_passwd_cb_ud\n#undef SSL_COMP_get_compression_methods\n#define SSL_COMP_get_compression_methods\tSSL_COMP_get_compress_methods\n\n#undef ssl_add_clienthello_renegotiate_ext\n#define ssl_add_clienthello_renegotiate_ext\tssl_add_clienthello_reneg_ext\n#undef ssl_add_serverhello_renegotiate_ext\n#define ssl_add_serverhello_renegotiate_ext\tssl_add_serverhello_reneg_ext\n#undef ssl_parse_clienthello_renegotiate_ext\n#define ssl_parse_clienthello_renegotiate_ext\tssl_parse_clienthello_reneg_ext\n#undef ssl_parse_serverhello_renegotiate_ext\n#define ssl_parse_serverhello_renegotiate_ext\tssl_parse_serverhello_reneg_ext\n\n/* Hack some long ENGINE names */\n#undef ENGINE_get_default_BN_mod_exp_crt\n#define ENGINE_get_default_BN_mod_exp_crt\tENGINE_get_def_BN_mod_exp_crt\n#undef ENGINE_set_default_BN_mod_exp_crt\n#define ENGINE_set_default_BN_mod_exp_crt\tENGINE_set_def_BN_mod_exp_crt\n#undef ENGINE_set_load_privkey_function\n#define ENGINE_set_load_privkey_function        ENGINE_set_load_privkey_fn\n#undef ENGINE_get_load_privkey_function\n#define ENGINE_get_load_privkey_function        ENGINE_get_load_privkey_fn\n#undef ENGINE_set_load_ssl_client_cert_function\n#define ENGINE_set_load_ssl_client_cert_function \\\n\t\t\t\t\t\tENGINE_set_ld_ssl_clnt_cert_fn\n#undef ENGINE_get_ssl_client_cert_function\n#define ENGINE_get_ssl_client_cert_function\tENGINE_get_ssl_client_cert_fn\n\n/* Hack some long OCSP names */\n#undef OCSP_REQUEST_get_ext_by_critical\n#define OCSP_REQUEST_get_ext_by_critical        OCSP_REQUEST_get_ext_by_crit\n#undef OCSP_BASICRESP_get_ext_by_critical\n#define OCSP_BASICRESP_get_ext_by_critical      OCSP_BASICRESP_get_ext_by_crit\n#undef OCSP_SINGLERESP_get_ext_by_critical\n#define OCSP_SINGLERESP_get_ext_by_critical     OCSP_SINGLERESP_get_ext_by_crit\n\n/* Hack some long DES names */\n#undef _ossl_old_des_ede3_cfb64_encrypt\n#define _ossl_old_des_ede3_cfb64_encrypt\t_ossl_odes_ede3_cfb64_encrypt\n#undef _ossl_old_des_ede3_ofb64_encrypt\n#define _ossl_old_des_ede3_ofb64_encrypt\t_ossl_odes_ede3_ofb64_encrypt\n\n/* Hack some long EVP names */\n#undef OPENSSL_add_all_algorithms_noconf\n#define OPENSSL_add_all_algorithms_noconf\tOPENSSL_add_all_algo_noconf\n#undef OPENSSL_add_all_algorithms_conf\n#define OPENSSL_add_all_algorithms_conf\t\tOPENSSL_add_all_algo_conf\n\n/* Hack some long EC names */\n#undef EC_GROUP_set_point_conversion_form\n#define EC_GROUP_set_point_conversion_form\tEC_GROUP_set_point_conv_form\n#undef EC_GROUP_get_point_conversion_form\n#define EC_GROUP_get_point_conversion_form\tEC_GROUP_get_point_conv_form\n#undef EC_GROUP_clear_free_all_extra_data\n#define EC_GROUP_clear_free_all_extra_data\tEC_GROUP_clr_free_all_xtra_data\n#undef EC_POINT_set_Jprojective_coordinates_GFp\n#define EC_POINT_set_Jprojective_coordinates_GFp \\\n                                                EC_POINT_set_Jproj_coords_GFp\n#undef EC_POINT_get_Jprojective_coordinates_GFp\n#define EC_POINT_get_Jprojective_coordinates_GFp \\\n                                                EC_POINT_get_Jproj_coords_GFp\n#undef EC_POINT_set_affine_coordinates_GFp\n#define EC_POINT_set_affine_coordinates_GFp     EC_POINT_set_affine_coords_GFp\n#undef EC_POINT_get_affine_coordinates_GFp\n#define EC_POINT_get_affine_coordinates_GFp     EC_POINT_get_affine_coords_GFp\n#undef EC_POINT_set_compressed_coordinates_GFp\n#define EC_POINT_set_compressed_coordinates_GFp EC_POINT_set_compr_coords_GFp\n#undef EC_POINT_set_affine_coordinates_GF2m\n#define EC_POINT_set_affine_coordinates_GF2m    EC_POINT_set_affine_coords_GF2m\n#undef EC_POINT_get_affine_coordinates_GF2m\n#define EC_POINT_get_affine_coordinates_GF2m    EC_POINT_get_affine_coords_GF2m\n#undef EC_POINT_set_compressed_coordinates_GF2m\n#define EC_POINT_set_compressed_coordinates_GF2m \\\n                                                EC_POINT_set_compr_coords_GF2m\n#undef ec_GF2m_simple_group_clear_finish\n#define ec_GF2m_simple_group_clear_finish        ec_GF2m_simple_grp_clr_finish\n#undef ec_GF2m_simple_group_check_discriminant\n#define ec_GF2m_simple_group_check_discriminant\tec_GF2m_simple_grp_chk_discrim\n#undef ec_GF2m_simple_point_clear_finish\n#define ec_GF2m_simple_point_clear_finish        ec_GF2m_simple_pt_clr_finish\n#undef ec_GF2m_simple_point_set_to_infinity\n#define ec_GF2m_simple_point_set_to_infinity     ec_GF2m_simple_pt_set_to_inf\n#undef ec_GF2m_simple_points_make_affine\n#define ec_GF2m_simple_points_make_affine        ec_GF2m_simple_pts_make_affine\n#undef ec_GF2m_simple_point_set_affine_coordinates\n#define ec_GF2m_simple_point_set_affine_coordinates \\\n                                                ec_GF2m_smp_pt_set_af_coords\n#undef ec_GF2m_simple_point_get_affine_coordinates\n#define ec_GF2m_simple_point_get_affine_coordinates \\\n                                                ec_GF2m_smp_pt_get_af_coords\n#undef ec_GF2m_simple_set_compressed_coordinates\n#define ec_GF2m_simple_set_compressed_coordinates \\\n                                                ec_GF2m_smp_set_compr_coords\n#undef ec_GFp_simple_group_set_curve_GFp\n#define ec_GFp_simple_group_set_curve_GFp       ec_GFp_simple_grp_set_curve_GFp\n#undef ec_GFp_simple_group_get_curve_GFp\n#define ec_GFp_simple_group_get_curve_GFp       ec_GFp_simple_grp_get_curve_GFp\n#undef ec_GFp_simple_group_clear_finish\n#define ec_GFp_simple_group_clear_finish        ec_GFp_simple_grp_clear_finish\n#undef ec_GFp_simple_group_set_generator\n#define ec_GFp_simple_group_set_generator       ec_GFp_simple_grp_set_generator\n#undef ec_GFp_simple_group_get0_generator\n#define ec_GFp_simple_group_get0_generator      ec_GFp_simple_grp_gt0_generator\n#undef ec_GFp_simple_group_get_cofactor\n#define ec_GFp_simple_group_get_cofactor        ec_GFp_simple_grp_get_cofactor\n#undef ec_GFp_simple_point_clear_finish\n#define ec_GFp_simple_point_clear_finish        ec_GFp_simple_pt_clear_finish\n#undef ec_GFp_simple_point_set_to_infinity\n#define ec_GFp_simple_point_set_to_infinity     ec_GFp_simple_pt_set_to_inf\n#undef ec_GFp_simple_points_make_affine\n#define ec_GFp_simple_points_make_affine        ec_GFp_simple_pts_make_affine\n#undef ec_GFp_simple_group_get_curve_GFp\n#define ec_GFp_simple_group_get_curve_GFp       ec_GFp_simple_grp_get_curve_GFp\n#undef ec_GFp_simple_set_Jprojective_coordinates_GFp\n#define ec_GFp_simple_set_Jprojective_coordinates_GFp \\\n                                                ec_GFp_smp_set_Jproj_coords_GFp\n#undef ec_GFp_simple_get_Jprojective_coordinates_GFp\n#define ec_GFp_simple_get_Jprojective_coordinates_GFp \\\n                                                ec_GFp_smp_get_Jproj_coords_GFp\n#undef ec_GFp_simple_point_set_affine_coordinates_GFp\n#define ec_GFp_simple_point_set_affine_coordinates_GFp \\\n                                                ec_GFp_smp_pt_set_af_coords_GFp\n#undef ec_GFp_simple_point_get_affine_coordinates_GFp\n#define ec_GFp_simple_point_get_affine_coordinates_GFp \\\n                                                ec_GFp_smp_pt_get_af_coords_GFp\n#undef ec_GFp_simple_set_compressed_coordinates_GFp\n#define ec_GFp_simple_set_compressed_coordinates_GFp \\\n                                                ec_GFp_smp_set_compr_coords_GFp\n#undef ec_GFp_simple_point_set_affine_coordinates\n#define ec_GFp_simple_point_set_affine_coordinates \\\n                                                ec_GFp_smp_pt_set_af_coords\n#undef ec_GFp_simple_point_get_affine_coordinates\n#define ec_GFp_simple_point_get_affine_coordinates \\\n                                                ec_GFp_smp_pt_get_af_coords\n#undef ec_GFp_simple_set_compressed_coordinates\n#define ec_GFp_simple_set_compressed_coordinates \\\n                                                ec_GFp_smp_set_compr_coords\n#undef ec_GFp_simple_group_check_discriminant\n#define ec_GFp_simple_group_check_discriminant\tec_GFp_simple_grp_chk_discrim\n\n/* Hack som long STORE names */\n#undef STORE_method_set_initialise_function\n#define STORE_method_set_initialise_function\tSTORE_meth_set_initialise_fn\n#undef STORE_method_set_cleanup_function\n#define STORE_method_set_cleanup_function\tSTORE_meth_set_cleanup_fn\n#undef STORE_method_set_generate_function\n#define STORE_method_set_generate_function\tSTORE_meth_set_generate_fn\n#undef STORE_method_set_modify_function\n#define STORE_method_set_modify_function\tSTORE_meth_set_modify_fn\n#undef STORE_method_set_revoke_function\n#define STORE_method_set_revoke_function\tSTORE_meth_set_revoke_fn\n#undef STORE_method_set_delete_function\n#define STORE_method_set_delete_function\tSTORE_meth_set_delete_fn\n#undef STORE_method_set_list_start_function\n#define STORE_method_set_list_start_function\tSTORE_meth_set_list_start_fn\n#undef STORE_method_set_list_next_function\n#define STORE_method_set_list_next_function\tSTORE_meth_set_list_next_fn\n#undef STORE_method_set_list_end_function\n#define STORE_method_set_list_end_function\tSTORE_meth_set_list_end_fn\n#undef STORE_method_set_update_store_function\n#define STORE_method_set_update_store_function\tSTORE_meth_set_update_store_fn\n#undef STORE_method_set_lock_store_function\n#define STORE_method_set_lock_store_function\tSTORE_meth_set_lock_store_fn\n#undef STORE_method_set_unlock_store_function\n#define STORE_method_set_unlock_store_function\tSTORE_meth_set_unlock_store_fn\n#undef STORE_method_get_initialise_function\n#define STORE_method_get_initialise_function\tSTORE_meth_get_initialise_fn\n#undef STORE_method_get_cleanup_function\n#define STORE_method_get_cleanup_function\tSTORE_meth_get_cleanup_fn\n#undef STORE_method_get_generate_function\n#define STORE_method_get_generate_function\tSTORE_meth_get_generate_fn\n#undef STORE_method_get_modify_function\n#define STORE_method_get_modify_function\tSTORE_meth_get_modify_fn\n#undef STORE_method_get_revoke_function\n#define STORE_method_get_revoke_function\tSTORE_meth_get_revoke_fn\n#undef STORE_method_get_delete_function\n#define STORE_method_get_delete_function\tSTORE_meth_get_delete_fn\n#undef STORE_method_get_list_start_function\n#define STORE_method_get_list_start_function\tSTORE_meth_get_list_start_fn\n#undef STORE_method_get_list_next_function\n#define STORE_method_get_list_next_function\tSTORE_meth_get_list_next_fn\n#undef STORE_method_get_list_end_function\n#define STORE_method_get_list_end_function\tSTORE_meth_get_list_end_fn\n#undef STORE_method_get_update_store_function\n#define STORE_method_get_update_store_function\tSTORE_meth_get_update_store_fn\n#undef STORE_method_get_lock_store_function\n#define STORE_method_get_lock_store_function\tSTORE_meth_get_lock_store_fn\n#undef STORE_method_get_unlock_store_function\n#define STORE_method_get_unlock_store_function\tSTORE_meth_get_unlock_store_fn\n\n/* Hack some long CMS names */\n#undef CMS_RecipientInfo_ktri_get0_algs\n#define CMS_RecipientInfo_ktri_get0_algs\tCMS_RecipInfo_ktri_get0_algs\n#undef CMS_RecipientInfo_ktri_get0_signer_id\n#define CMS_RecipientInfo_ktri_get0_signer_id\tCMS_RecipInfo_ktri_get0_sigr_id\n#undef CMS_OtherRevocationInfoFormat_it\n#define CMS_OtherRevocationInfoFormat_it\tCMS_OtherRevocInfoFormat_it\n#undef CMS_KeyAgreeRecipientIdentifier_it\n#define CMS_KeyAgreeRecipientIdentifier_it\tCMS_KeyAgreeRecipIdentifier_it\n#undef CMS_OriginatorIdentifierOrKey_it\n#define CMS_OriginatorIdentifierOrKey_it\tCMS_OriginatorIdOrKey_it\n#undef cms_SignerIdentifier_get0_signer_id\n#define cms_SignerIdentifier_get0_signer_id\tcms_SignerId_get0_signer_id\n\n/* Hack some long DTLS1 names */\n#undef dtls1_retransmit_buffered_messages\n#define dtls1_retransmit_buffered_messages\tdtls1_retransmit_buffered_msgs\n\n#endif /* defined OPENSSL_SYS_VMS */\n\n\n/* Case insensiteve linking causes problems.... */\n#if defined(OPENSSL_SYS_WIN16) || defined(OPENSSL_SYS_VMS) || defined(OPENSSL_SYS_OS2)\n#undef ERR_load_CRYPTO_strings\n#define ERR_load_CRYPTO_strings\t\t\tERR_load_CRYPTOlib_strings\n#undef OCSP_crlID_new\n#define OCSP_crlID_new                          OCSP_crlID2_new\n\n#undef d2i_ECPARAMETERS\n#define d2i_ECPARAMETERS                        d2i_UC_ECPARAMETERS\n#undef i2d_ECPARAMETERS\n#define i2d_ECPARAMETERS                        i2d_UC_ECPARAMETERS\n#undef d2i_ECPKPARAMETERS\n#define d2i_ECPKPARAMETERS                      d2i_UC_ECPKPARAMETERS\n#undef i2d_ECPKPARAMETERS\n#define i2d_ECPKPARAMETERS                      i2d_UC_ECPKPARAMETERS\n\n/* These functions do not seem to exist!  However, I'm paranoid...\n   Original command in x509v3.h:\n   These functions are being redefined in another directory,\n   and clash when the linker is case-insensitive, so let's\n   hide them a little, by giving them an extra 'o' at the\n   beginning of the name... */\n#undef X509v3_cleanup_extensions\n#define X509v3_cleanup_extensions               oX509v3_cleanup_extensions\n#undef X509v3_add_extension\n#define X509v3_add_extension                    oX509v3_add_extension\n#undef X509v3_add_netscape_extensions\n#define X509v3_add_netscape_extensions          oX509v3_add_netscape_extensions\n#undef X509v3_add_standard_extensions\n#define X509v3_add_standard_extensions          oX509v3_add_standard_extensions\n\n\n#endif\n\n\n#endif /* ! defined HEADER_VMS_IDHACKS_H */\n/* This one clashes with CMS_data_create */\n#undef cms_Data_create\n#define cms_Data_create\t\t\t\tpriv_cms_Data_create\n"
  },
  {
    "path": "freebsd-headers/openssl/tls1.h",
    "content": "/* ssl/tls1.h */\n/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)\n * All rights reserved.\n *\n * This package is an SSL implementation written\n * by Eric Young (eay@cryptsoft.com).\n * The implementation was written so as to conform with Netscapes SSL.\n * \n * This library is free for commercial and non-commercial use as long as\n * the following conditions are aheared to.  The following conditions\n * apply to all code found in this distribution, be it the RC4, RSA,\n * lhash, DES, etc., code; not just the SSL code.  The SSL documentation\n * included with this distribution is covered by the same copyright terms\n * except that the holder is Tim Hudson (tjh@cryptsoft.com).\n * \n * Copyright remains Eric Young's, and as such any Copyright notices in\n * the code are not to be removed.\n * If this package is used in a product, Eric Young should be given attribution\n * as the author of the parts of the library used.\n * This can be in the form of a textual message at program startup or\n * in documentation (online or textual) provided with the package.\n * \n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. All advertising materials mentioning features or use of this software\n *    must display the following acknowledgement:\n *    \"This product includes cryptographic software written by\n *     Eric Young (eay@cryptsoft.com)\"\n *    The word 'cryptographic' can be left out if the rouines from the library\n *    being used are not cryptographic related :-).\n * 4. If you include any Windows specific code (or a derivative thereof) from \n *    the apps directory (application code) you must include an acknowledgement:\n *    \"This product includes software written by Tim Hudson (tjh@cryptsoft.com)\"\n * \n * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n * \n * The licence and distribution terms for any publically available version or\n * derivative of this code cannot be changed.  i.e. this code cannot simply be\n * copied and put under another distribution licence\n * [including the GNU Public Licence.]\n */\n/* ====================================================================\n * Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED.\n *\n * Portions of the attached software (\"Contribution\") are developed by \n * SUN MICROSYSTEMS, INC., and are contributed to the OpenSSL project.\n *\n * The Contribution is licensed pursuant to the OpenSSL open source\n * license provided above.\n *\n * ECC cipher suite support in OpenSSL originally written by\n * Vipul Gupta and Sumit Gupta of Sun Microsystems Laboratories.\n *\n */\n\n#ifndef HEADER_TLS1_H \n#define HEADER_TLS1_H \n\n#include <openssl/buffer.h>\n\n#ifdef  __cplusplus\nextern \"C\" {\n#endif\n\n#define TLS1_ALLOW_EXPERIMENTAL_CIPHERSUITES\t0\n\n#define TLS1_VERSION\t\t\t0x0301\n#define TLS1_VERSION_MAJOR\t\t0x03\n#define TLS1_VERSION_MINOR\t\t0x01\n\n#define TLS1_AD_DECRYPTION_FAILED\t21\n#define TLS1_AD_RECORD_OVERFLOW\t\t22\n#define TLS1_AD_UNKNOWN_CA\t\t48\t/* fatal */\n#define TLS1_AD_ACCESS_DENIED\t\t49\t/* fatal */\n#define TLS1_AD_DECODE_ERROR\t\t50\t/* fatal */\n#define TLS1_AD_DECRYPT_ERROR\t\t51\n#define TLS1_AD_EXPORT_RESTRICTION\t60\t/* fatal */\n#define TLS1_AD_PROTOCOL_VERSION\t70\t/* fatal */\n#define TLS1_AD_INSUFFICIENT_SECURITY\t71\t/* fatal */\n#define TLS1_AD_INTERNAL_ERROR\t\t80\t/* fatal */\n#define TLS1_AD_USER_CANCELLED\t\t90\n#define TLS1_AD_NO_RENEGOTIATION\t100\n/* codes 110-114 are from RFC3546 */\n#define TLS1_AD_UNSUPPORTED_EXTENSION\t110\n#define TLS1_AD_CERTIFICATE_UNOBTAINABLE 111\n#define TLS1_AD_UNRECOGNIZED_NAME \t112\n#define TLS1_AD_BAD_CERTIFICATE_STATUS_RESPONSE 113\n#define TLS1_AD_BAD_CERTIFICATE_HASH_VALUE 114\n#define TLS1_AD_UNKNOWN_PSK_IDENTITY\t115\t/* fatal */\n\n/* ExtensionType values from RFC 3546 */\n#define TLSEXT_TYPE_server_name\t\t\t0\n#define TLSEXT_TYPE_max_fragment_length\t\t1\n#define TLSEXT_TYPE_client_certificate_url\t2\n#define TLSEXT_TYPE_trusted_ca_keys\t\t3\n#define TLSEXT_TYPE_truncated_hmac\t\t4\n#define TLSEXT_TYPE_status_request\t\t5\n#define TLSEXT_TYPE_elliptic_curves\t\t10\n#define TLSEXT_TYPE_ec_point_formats\t\t11\n#define TLSEXT_TYPE_session_ticket\t\t35\n\n/* Temporary extension type */\n#define TLSEXT_TYPE_renegotiate                 0xff01\n\n/* NameType value from RFC 3546 */\n#define TLSEXT_NAMETYPE_host_name 0\n/* status request value from RFC 3546 */\n#define TLSEXT_STATUSTYPE_ocsp 1\n\n#ifndef OPENSSL_NO_TLSEXT\n\n#define TLSEXT_MAXLEN_host_name 255\n\nconst char *SSL_get_servername(const SSL *s, const int type) ;\nint SSL_get_servername_type(const SSL *s) ;\n\n#define SSL_set_tlsext_host_name(s,name) \\\nSSL_ctrl(s,SSL_CTRL_SET_TLSEXT_HOSTNAME,TLSEXT_NAMETYPE_host_name,(char *)name)\n\n#define SSL_set_tlsext_debug_callback(ssl, cb) \\\nSSL_callback_ctrl(ssl,SSL_CTRL_SET_TLSEXT_DEBUG_CB,(void (*)(void))cb)\n\n#define SSL_set_tlsext_debug_arg(ssl, arg) \\\nSSL_ctrl(ssl,SSL_CTRL_SET_TLSEXT_DEBUG_ARG,0, (void *)arg)\n\n#define SSL_set_tlsext_status_type(ssl, type) \\\nSSL_ctrl(ssl,SSL_CTRL_SET_TLSEXT_STATUS_REQ_TYPE,type, NULL)\n\n#define SSL_get_tlsext_status_exts(ssl, arg) \\\nSSL_ctrl(ssl,SSL_CTRL_GET_TLSEXT_STATUS_REQ_EXTS,0, (void *)arg)\n\n#define SSL_set_tlsext_status_exts(ssl, arg) \\\nSSL_ctrl(ssl,SSL_CTRL_SET_TLSEXT_STATUS_REQ_EXTS,0, (void *)arg)\n\n#define SSL_get_tlsext_status_ids(ssl, arg) \\\nSSL_ctrl(ssl,SSL_CTRL_GET_TLSEXT_STATUS_REQ_IDS,0, (void *)arg)\n\n#define SSL_set_tlsext_status_ids(ssl, arg) \\\nSSL_ctrl(ssl,SSL_CTRL_SET_TLSEXT_STATUS_REQ_IDS,0, (void *)arg)\n\n#define SSL_get_tlsext_status_ocsp_resp(ssl, arg) \\\nSSL_ctrl(ssl,SSL_CTRL_GET_TLSEXT_STATUS_REQ_OCSP_RESP,0, (void *)arg)\n\n#define SSL_set_tlsext_status_ocsp_resp(ssl, arg, arglen) \\\nSSL_ctrl(ssl,SSL_CTRL_SET_TLSEXT_STATUS_REQ_OCSP_RESP,arglen, (void *)arg)\n\n#define SSL_CTX_set_tlsext_servername_callback(ctx, cb) \\\nSSL_CTX_callback_ctrl(ctx,SSL_CTRL_SET_TLSEXT_SERVERNAME_CB,(void (*)(void))cb)\n\n#define SSL_TLSEXT_ERR_OK 0\n#define SSL_TLSEXT_ERR_ALERT_WARNING 1\n#define SSL_TLSEXT_ERR_ALERT_FATAL 2\n#define SSL_TLSEXT_ERR_NOACK 3\n\n#define SSL_CTX_set_tlsext_servername_arg(ctx, arg) \\\nSSL_CTX_ctrl(ctx,SSL_CTRL_SET_TLSEXT_SERVERNAME_ARG,0, (void *)arg)\n\n#define SSL_CTX_get_tlsext_ticket_keys(ctx, keys, keylen) \\\n\tSSL_CTX_ctrl((ctx),SSL_CTRL_GET_TLSEXT_TICKET_KEYS,(keylen),(keys))\n#define SSL_CTX_set_tlsext_ticket_keys(ctx, keys, keylen) \\\n\tSSL_CTX_ctrl((ctx),SSL_CTRL_SET_TLSEXT_TICKET_KEYS,(keylen),(keys))\n\n#define SSL_CTX_set_tlsext_status_cb(ssl, cb) \\\nSSL_CTX_callback_ctrl(ssl,SSL_CTRL_SET_TLSEXT_STATUS_REQ_CB,(void (*)(void))cb)\n\n#define SSL_CTX_set_tlsext_status_arg(ssl, arg) \\\nSSL_CTX_ctrl(ssl,SSL_CTRL_SET_TLSEXT_STATUS_REQ_CB_ARG,0, (void *)arg)\n\n#define SSL_CTX_set_tlsext_ticket_key_cb(ssl, cb) \\\nSSL_CTX_callback_ctrl(ssl,SSL_CTRL_SET_TLSEXT_TICKET_KEY_CB,(void (*)(void))cb)\n\n#endif\n\n/* Additional TLS ciphersuites from draft-ietf-tls-56-bit-ciphersuites-00.txt\n * (available if TLS1_ALLOW_EXPERIMENTAL_CIPHERSUITES is defined, see\n * s3_lib.c).  We actually treat them like SSL 3.0 ciphers, which we probably\n * shouldn't. */\n#define TLS1_CK_RSA_EXPORT1024_WITH_RC4_56_MD5\t\t0x03000060\n#define TLS1_CK_RSA_EXPORT1024_WITH_RC2_CBC_56_MD5\t0x03000061\n#define TLS1_CK_RSA_EXPORT1024_WITH_DES_CBC_SHA\t\t0x03000062\n#define TLS1_CK_DHE_DSS_EXPORT1024_WITH_DES_CBC_SHA\t0x03000063\n#define TLS1_CK_RSA_EXPORT1024_WITH_RC4_56_SHA\t\t0x03000064\n#define TLS1_CK_DHE_DSS_EXPORT1024_WITH_RC4_56_SHA\t0x03000065\n#define TLS1_CK_DHE_DSS_WITH_RC4_128_SHA\t\t0x03000066\n\n/* AES ciphersuites from RFC3268 */\n\n#define TLS1_CK_RSA_WITH_AES_128_SHA\t\t\t0x0300002F\n#define TLS1_CK_DH_DSS_WITH_AES_128_SHA\t\t\t0x03000030\n#define TLS1_CK_DH_RSA_WITH_AES_128_SHA\t\t\t0x03000031\n#define TLS1_CK_DHE_DSS_WITH_AES_128_SHA\t\t0x03000032\n#define TLS1_CK_DHE_RSA_WITH_AES_128_SHA\t\t0x03000033\n#define TLS1_CK_ADH_WITH_AES_128_SHA\t\t\t0x03000034\n\n#define TLS1_CK_RSA_WITH_AES_256_SHA\t\t\t0x03000035\n#define TLS1_CK_DH_DSS_WITH_AES_256_SHA\t\t\t0x03000036\n#define TLS1_CK_DH_RSA_WITH_AES_256_SHA\t\t\t0x03000037\n#define TLS1_CK_DHE_DSS_WITH_AES_256_SHA\t\t0x03000038\n#define TLS1_CK_DHE_RSA_WITH_AES_256_SHA\t\t0x03000039\n#define TLS1_CK_ADH_WITH_AES_256_SHA\t\t\t0x0300003A\n\n/* Camellia ciphersuites from RFC4132 */\n#define TLS1_CK_RSA_WITH_CAMELLIA_128_CBC_SHA\t\t0x03000041\n#define TLS1_CK_DH_DSS_WITH_CAMELLIA_128_CBC_SHA\t0x03000042\n#define TLS1_CK_DH_RSA_WITH_CAMELLIA_128_CBC_SHA\t0x03000043\n#define TLS1_CK_DHE_DSS_WITH_CAMELLIA_128_CBC_SHA\t0x03000044\n#define TLS1_CK_DHE_RSA_WITH_CAMELLIA_128_CBC_SHA\t0x03000045\n#define TLS1_CK_ADH_WITH_CAMELLIA_128_CBC_SHA\t\t0x03000046\n\n#define TLS1_CK_RSA_WITH_CAMELLIA_256_CBC_SHA\t\t0x03000084\n#define TLS1_CK_DH_DSS_WITH_CAMELLIA_256_CBC_SHA\t0x03000085\n#define TLS1_CK_DH_RSA_WITH_CAMELLIA_256_CBC_SHA\t0x03000086\n#define TLS1_CK_DHE_DSS_WITH_CAMELLIA_256_CBC_SHA\t0x03000087\n#define TLS1_CK_DHE_RSA_WITH_CAMELLIA_256_CBC_SHA\t0x03000088\n#define TLS1_CK_ADH_WITH_CAMELLIA_256_CBC_SHA\t\t0x03000089\n\n/* SEED ciphersuites from RFC4162 */\n#define TLS1_CK_RSA_WITH_SEED_SHA                       0x03000096\n#define TLS1_CK_DH_DSS_WITH_SEED_SHA                    0x03000097\n#define TLS1_CK_DH_RSA_WITH_SEED_SHA                    0x03000098\n#define TLS1_CK_DHE_DSS_WITH_SEED_SHA                   0x03000099\n#define TLS1_CK_DHE_RSA_WITH_SEED_SHA                   0x0300009A\n#define TLS1_CK_ADH_WITH_SEED_SHA                \t0x0300009B\n\n/* ECC ciphersuites from draft-ietf-tls-ecc-12.txt with changes soon to be in draft 13 */\n#define TLS1_CK_ECDH_ECDSA_WITH_NULL_SHA                0x0300C001\n#define TLS1_CK_ECDH_ECDSA_WITH_RC4_128_SHA             0x0300C002\n#define TLS1_CK_ECDH_ECDSA_WITH_DES_192_CBC3_SHA        0x0300C003\n#define TLS1_CK_ECDH_ECDSA_WITH_AES_128_CBC_SHA         0x0300C004\n#define TLS1_CK_ECDH_ECDSA_WITH_AES_256_CBC_SHA         0x0300C005\n\n#define TLS1_CK_ECDHE_ECDSA_WITH_NULL_SHA               0x0300C006\n#define TLS1_CK_ECDHE_ECDSA_WITH_RC4_128_SHA            0x0300C007\n#define TLS1_CK_ECDHE_ECDSA_WITH_DES_192_CBC3_SHA       0x0300C008\n#define TLS1_CK_ECDHE_ECDSA_WITH_AES_128_CBC_SHA        0x0300C009\n#define TLS1_CK_ECDHE_ECDSA_WITH_AES_256_CBC_SHA        0x0300C00A\n\n#define TLS1_CK_ECDH_RSA_WITH_NULL_SHA                  0x0300C00B\n#define TLS1_CK_ECDH_RSA_WITH_RC4_128_SHA               0x0300C00C\n#define TLS1_CK_ECDH_RSA_WITH_DES_192_CBC3_SHA          0x0300C00D\n#define TLS1_CK_ECDH_RSA_WITH_AES_128_CBC_SHA           0x0300C00E\n#define TLS1_CK_ECDH_RSA_WITH_AES_256_CBC_SHA           0x0300C00F\n\n#define TLS1_CK_ECDHE_RSA_WITH_NULL_SHA                 0x0300C010\n#define TLS1_CK_ECDHE_RSA_WITH_RC4_128_SHA              0x0300C011\n#define TLS1_CK_ECDHE_RSA_WITH_DES_192_CBC3_SHA         0x0300C012\n#define TLS1_CK_ECDHE_RSA_WITH_AES_128_CBC_SHA          0x0300C013\n#define TLS1_CK_ECDHE_RSA_WITH_AES_256_CBC_SHA          0x0300C014\n\n#define TLS1_CK_ECDH_anon_WITH_NULL_SHA                 0x0300C015\n#define TLS1_CK_ECDH_anon_WITH_RC4_128_SHA              0x0300C016\n#define TLS1_CK_ECDH_anon_WITH_DES_192_CBC3_SHA         0x0300C017\n#define TLS1_CK_ECDH_anon_WITH_AES_128_CBC_SHA          0x0300C018\n#define TLS1_CK_ECDH_anon_WITH_AES_256_CBC_SHA          0x0300C019\n\n/* XXX\n * Inconsistency alert:\n * The OpenSSL names of ciphers with ephemeral DH here include the string\n * \"DHE\", while elsewhere it has always been \"EDH\".\n * (The alias for the list of all such ciphers also is \"EDH\".)\n * The specifications speak of \"EDH\"; maybe we should allow both forms\n * for everything. */\n#define TLS1_TXT_RSA_EXPORT1024_WITH_RC4_56_MD5\t\t\"EXP1024-RC4-MD5\"\n#define TLS1_TXT_RSA_EXPORT1024_WITH_RC2_CBC_56_MD5\t\"EXP1024-RC2-CBC-MD5\"\n#define TLS1_TXT_RSA_EXPORT1024_WITH_DES_CBC_SHA\t\"EXP1024-DES-CBC-SHA\"\n#define TLS1_TXT_DHE_DSS_EXPORT1024_WITH_DES_CBC_SHA\t\"EXP1024-DHE-DSS-DES-CBC-SHA\"\n#define TLS1_TXT_RSA_EXPORT1024_WITH_RC4_56_SHA\t\t\"EXP1024-RC4-SHA\"\n#define TLS1_TXT_DHE_DSS_EXPORT1024_WITH_RC4_56_SHA\t\"EXP1024-DHE-DSS-RC4-SHA\"\n#define TLS1_TXT_DHE_DSS_WITH_RC4_128_SHA\t\t\"DHE-DSS-RC4-SHA\"\n\n/* AES ciphersuites from RFC3268 */\n#define TLS1_TXT_RSA_WITH_AES_128_SHA\t\t\t\"AES128-SHA\"\n#define TLS1_TXT_DH_DSS_WITH_AES_128_SHA\t\t\"DH-DSS-AES128-SHA\"\n#define TLS1_TXT_DH_RSA_WITH_AES_128_SHA\t\t\"DH-RSA-AES128-SHA\"\n#define TLS1_TXT_DHE_DSS_WITH_AES_128_SHA\t\t\"DHE-DSS-AES128-SHA\"\n#define TLS1_TXT_DHE_RSA_WITH_AES_128_SHA\t\t\"DHE-RSA-AES128-SHA\"\n#define TLS1_TXT_ADH_WITH_AES_128_SHA\t\t\t\"ADH-AES128-SHA\"\n\n#define TLS1_TXT_RSA_WITH_AES_256_SHA\t\t\t\"AES256-SHA\"\n#define TLS1_TXT_DH_DSS_WITH_AES_256_SHA\t\t\"DH-DSS-AES256-SHA\"\n#define TLS1_TXT_DH_RSA_WITH_AES_256_SHA\t\t\"DH-RSA-AES256-SHA\"\n#define TLS1_TXT_DHE_DSS_WITH_AES_256_SHA\t\t\"DHE-DSS-AES256-SHA\"\n#define TLS1_TXT_DHE_RSA_WITH_AES_256_SHA\t\t\"DHE-RSA-AES256-SHA\"\n#define TLS1_TXT_ADH_WITH_AES_256_SHA\t\t\t\"ADH-AES256-SHA\"\n\n/* ECC ciphersuites from draft-ietf-tls-ecc-01.txt (Mar 15, 2001) */\n#define TLS1_TXT_ECDH_ECDSA_WITH_NULL_SHA               \"ECDH-ECDSA-NULL-SHA\"\n#define TLS1_TXT_ECDH_ECDSA_WITH_RC4_128_SHA            \"ECDH-ECDSA-RC4-SHA\"\n#define TLS1_TXT_ECDH_ECDSA_WITH_DES_192_CBC3_SHA       \"ECDH-ECDSA-DES-CBC3-SHA\"\n#define TLS1_TXT_ECDH_ECDSA_WITH_AES_128_CBC_SHA        \"ECDH-ECDSA-AES128-SHA\"\n#define TLS1_TXT_ECDH_ECDSA_WITH_AES_256_CBC_SHA        \"ECDH-ECDSA-AES256-SHA\"\n\n#define TLS1_TXT_ECDHE_ECDSA_WITH_NULL_SHA              \"ECDHE-ECDSA-NULL-SHA\"\n#define TLS1_TXT_ECDHE_ECDSA_WITH_RC4_128_SHA           \"ECDHE-ECDSA-RC4-SHA\"\n#define TLS1_TXT_ECDHE_ECDSA_WITH_DES_192_CBC3_SHA      \"ECDHE-ECDSA-DES-CBC3-SHA\"\n#define TLS1_TXT_ECDHE_ECDSA_WITH_AES_128_CBC_SHA       \"ECDHE-ECDSA-AES128-SHA\"\n#define TLS1_TXT_ECDHE_ECDSA_WITH_AES_256_CBC_SHA       \"ECDHE-ECDSA-AES256-SHA\"\n\n#define TLS1_TXT_ECDH_RSA_WITH_NULL_SHA                 \"ECDH-RSA-NULL-SHA\"\n#define TLS1_TXT_ECDH_RSA_WITH_RC4_128_SHA              \"ECDH-RSA-RC4-SHA\"\n#define TLS1_TXT_ECDH_RSA_WITH_DES_192_CBC3_SHA         \"ECDH-RSA-DES-CBC3-SHA\"\n#define TLS1_TXT_ECDH_RSA_WITH_AES_128_CBC_SHA          \"ECDH-RSA-AES128-SHA\"\n#define TLS1_TXT_ECDH_RSA_WITH_AES_256_CBC_SHA          \"ECDH-RSA-AES256-SHA\"\n\n#define TLS1_TXT_ECDHE_RSA_WITH_NULL_SHA                \"ECDHE-RSA-NULL-SHA\"\n#define TLS1_TXT_ECDHE_RSA_WITH_RC4_128_SHA             \"ECDHE-RSA-RC4-SHA\"\n#define TLS1_TXT_ECDHE_RSA_WITH_DES_192_CBC3_SHA        \"ECDHE-RSA-DES-CBC3-SHA\"\n#define TLS1_TXT_ECDHE_RSA_WITH_AES_128_CBC_SHA         \"ECDHE-RSA-AES128-SHA\"\n#define TLS1_TXT_ECDHE_RSA_WITH_AES_256_CBC_SHA         \"ECDHE-RSA-AES256-SHA\"\n\n#define TLS1_TXT_ECDH_anon_WITH_NULL_SHA                \"AECDH-NULL-SHA\"\n#define TLS1_TXT_ECDH_anon_WITH_RC4_128_SHA             \"AECDH-RC4-SHA\"\n#define TLS1_TXT_ECDH_anon_WITH_DES_192_CBC3_SHA        \"AECDH-DES-CBC3-SHA\"\n#define TLS1_TXT_ECDH_anon_WITH_AES_128_CBC_SHA         \"AECDH-AES128-SHA\"\n#define TLS1_TXT_ECDH_anon_WITH_AES_256_CBC_SHA         \"AECDH-AES256-SHA\"\n\n/* Camellia ciphersuites from RFC4132 */\n#define TLS1_TXT_RSA_WITH_CAMELLIA_128_CBC_SHA\t\t\"CAMELLIA128-SHA\"\n#define TLS1_TXT_DH_DSS_WITH_CAMELLIA_128_CBC_SHA\t\"DH-DSS-CAMELLIA128-SHA\"\n#define TLS1_TXT_DH_RSA_WITH_CAMELLIA_128_CBC_SHA\t\"DH-RSA-CAMELLIA128-SHA\"\n#define TLS1_TXT_DHE_DSS_WITH_CAMELLIA_128_CBC_SHA\t\"DHE-DSS-CAMELLIA128-SHA\"\n#define TLS1_TXT_DHE_RSA_WITH_CAMELLIA_128_CBC_SHA\t\"DHE-RSA-CAMELLIA128-SHA\"\n#define TLS1_TXT_ADH_WITH_CAMELLIA_128_CBC_SHA\t\t\"ADH-CAMELLIA128-SHA\"\n\n#define TLS1_TXT_RSA_WITH_CAMELLIA_256_CBC_SHA\t\t\"CAMELLIA256-SHA\"\n#define TLS1_TXT_DH_DSS_WITH_CAMELLIA_256_CBC_SHA\t\"DH-DSS-CAMELLIA256-SHA\"\n#define TLS1_TXT_DH_RSA_WITH_CAMELLIA_256_CBC_SHA\t\"DH-RSA-CAMELLIA256-SHA\"\n#define TLS1_TXT_DHE_DSS_WITH_CAMELLIA_256_CBC_SHA\t\"DHE-DSS-CAMELLIA256-SHA\"\n#define TLS1_TXT_DHE_RSA_WITH_CAMELLIA_256_CBC_SHA\t\"DHE-RSA-CAMELLIA256-SHA\"\n#define TLS1_TXT_ADH_WITH_CAMELLIA_256_CBC_SHA\t\t\"ADH-CAMELLIA256-SHA\"\n\n/* SEED ciphersuites from RFC4162 */\n#define TLS1_TXT_RSA_WITH_SEED_SHA                      \"SEED-SHA\"\n#define TLS1_TXT_DH_DSS_WITH_SEED_SHA                   \"DH-DSS-SEED-SHA\"\n#define TLS1_TXT_DH_RSA_WITH_SEED_SHA                   \"DH-RSA-SEED-SHA\"\n#define TLS1_TXT_DHE_DSS_WITH_SEED_SHA                  \"DHE-DSS-SEED-SHA\"\n#define TLS1_TXT_DHE_RSA_WITH_SEED_SHA                  \"DHE-RSA-SEED-SHA\"\n#define TLS1_TXT_ADH_WITH_SEED_SHA                      \"ADH-SEED-SHA\"\n\n#define TLS_CT_RSA_SIGN\t\t\t1\n#define TLS_CT_DSS_SIGN\t\t\t2\n#define TLS_CT_RSA_FIXED_DH\t\t3\n#define TLS_CT_DSS_FIXED_DH\t\t4\n#define TLS_CT_ECDSA_SIGN\t\t64\n#define TLS_CT_RSA_FIXED_ECDH\t\t65\n#define TLS_CT_ECDSA_FIXED_ECDH \t66\n#define TLS_CT_NUMBER\t\t\t7\n\n#define TLS1_FINISH_MAC_LENGTH\t\t12\n\n#define TLS_MD_MAX_CONST_SIZE\t\t\t20\n#define TLS_MD_CLIENT_FINISH_CONST\t\t\"client finished\"\n#define TLS_MD_CLIENT_FINISH_CONST_SIZE\t\t15\n#define TLS_MD_SERVER_FINISH_CONST\t\t\"server finished\"\n#define TLS_MD_SERVER_FINISH_CONST_SIZE\t\t15\n#define TLS_MD_SERVER_WRITE_KEY_CONST\t\t\"server write key\"\n#define TLS_MD_SERVER_WRITE_KEY_CONST_SIZE\t16\n#define TLS_MD_KEY_EXPANSION_CONST\t\t\"key expansion\"\n#define TLS_MD_KEY_EXPANSION_CONST_SIZE\t\t13\n#define TLS_MD_CLIENT_WRITE_KEY_CONST\t\t\"client write key\"\n#define TLS_MD_CLIENT_WRITE_KEY_CONST_SIZE\t16\n#define TLS_MD_SERVER_WRITE_KEY_CONST\t\t\"server write key\"\n#define TLS_MD_SERVER_WRITE_KEY_CONST_SIZE\t16\n#define TLS_MD_IV_BLOCK_CONST\t\t\t\"IV block\"\n#define TLS_MD_IV_BLOCK_CONST_SIZE\t\t8\n#define TLS_MD_MASTER_SECRET_CONST\t\t\"master secret\"\n#define TLS_MD_MASTER_SECRET_CONST_SIZE\t\t13\n\n#ifdef CHARSET_EBCDIC\n#undef TLS_MD_CLIENT_FINISH_CONST\n#define TLS_MD_CLIENT_FINISH_CONST    \"\\x63\\x6c\\x69\\x65\\x6e\\x74\\x20\\x66\\x69\\x6e\\x69\\x73\\x68\\x65\\x64\"  /*client finished*/\n#undef TLS_MD_SERVER_FINISH_CONST\n#define TLS_MD_SERVER_FINISH_CONST    \"\\x73\\x65\\x72\\x76\\x65\\x72\\x20\\x66\\x69\\x6e\\x69\\x73\\x68\\x65\\x64\"  /*server finished*/\n#undef TLS_MD_SERVER_WRITE_KEY_CONST\n#define TLS_MD_SERVER_WRITE_KEY_CONST \"\\x73\\x65\\x72\\x76\\x65\\x72\\x20\\x77\\x72\\x69\\x74\\x65\\x20\\x6b\\x65\\x79\"  /*server write key*/\n#undef TLS_MD_KEY_EXPANSION_CONST\n#define TLS_MD_KEY_EXPANSION_CONST    \"\\x6b\\x65\\x79\\x20\\x65\\x78\\x70\\x61\\x6e\\x73\\x69\\x6f\\x6e\"  /*key expansion*/\n#undef TLS_MD_CLIENT_WRITE_KEY_CONST\n#define TLS_MD_CLIENT_WRITE_KEY_CONST \"\\x63\\x6c\\x69\\x65\\x6e\\x74\\x20\\x77\\x72\\x69\\x74\\x65\\x20\\x6b\\x65\\x79\"  /*client write key*/\n#undef TLS_MD_SERVER_WRITE_KEY_CONST\n#define TLS_MD_SERVER_WRITE_KEY_CONST \"\\x73\\x65\\x72\\x76\\x65\\x72\\x20\\x77\\x72\\x69\\x74\\x65\\x20\\x6b\\x65\\x79\"  /*server write key*/\n#undef TLS_MD_IV_BLOCK_CONST\n#define TLS_MD_IV_BLOCK_CONST         \"\\x49\\x56\\x20\\x62\\x6c\\x6f\\x63\\x6b\"  /*IV block*/\n#undef TLS_MD_MASTER_SECRET_CONST\n#define TLS_MD_MASTER_SECRET_CONST    \"\\x6d\\x61\\x73\\x74\\x65\\x72\\x20\\x73\\x65\\x63\\x72\\x65\\x74\"  /*master secret*/\n#endif\n\n#ifdef  __cplusplus\n}\n#endif\n#endif\n\n\n\n"
  },
  {
    "path": "freebsd-headers/openssl/tmdiff.h",
    "content": "/* crypto/tmdiff.h */\n/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)\n * All rights reserved.\n *\n * This package is an SSL implementation written\n * by Eric Young (eay@cryptsoft.com).\n * The implementation was written so as to conform with Netscapes SSL.\n * \n * This library is free for commercial and non-commercial use as long as\n * the following conditions are aheared to.  The following conditions\n * apply to all code found in this distribution, be it the RC4, RSA,\n * lhash, DES, etc., code; not just the SSL code.  The SSL documentation\n * included with this distribution is covered by the same copyright terms\n * except that the holder is Tim Hudson (tjh@cryptsoft.com).\n * \n * Copyright remains Eric Young's, and as such any Copyright notices in\n * the code are not to be removed.\n * If this package is used in a product, Eric Young should be given attribution\n * as the author of the parts of the library used.\n * This can be in the form of a textual message at program startup or\n * in documentation (online or textual) provided with the package.\n * \n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. All advertising materials mentioning features or use of this software\n *    must display the following acknowledgement:\n *    \"This product includes cryptographic software written by\n *     Eric Young (eay@cryptsoft.com)\"\n *    The word 'cryptographic' can be left out if the rouines from the library\n *    being used are not cryptographic related :-).\n * 4. If you include any Windows specific code (or a derivative thereof) from \n *    the apps directory (application code) you must include an acknowledgement:\n *    \"This product includes software written by Tim Hudson (tjh@cryptsoft.com)\"\n * \n * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n * \n * The licence and distribution terms for any publically available version or\n * derivative of this code cannot be changed.  i.e. this code cannot simply be\n * copied and put under another distribution licence\n * [including the GNU Public Licence.]\n */\n\n/* Header for dynamic hash table routines\n * Author - Eric Young\n */\n/* ... erm yeah, \"dynamic hash tables\" you say?\n * \n * And what would dynamic hash tables have to do with any of this code *now*?\n * AFAICS, this code is only referenced by crypto/bn/exp.c which is an unused\n * file that I doubt compiles any more. speed.c is the only thing that could\n * use this (and it has nothing to do with hash tables), yet it instead has its\n * own duplication of all this stuff and looks, if anything, more complete. See\n * the corresponding note in apps/speed.c.\n * The Bemused - Geoff\n */\n\n#ifndef HEADER_TMDIFF_H\n#define HEADER_TMDIFF_H\n\n#ifdef  __cplusplus\nextern \"C\" {\n#endif\n\ntypedef struct ms_tm MS_TM;\n\nMS_TM *ms_time_new(void );\nvoid ms_time_free(MS_TM *a);\nvoid ms_time_get(MS_TM *a);\ndouble ms_time_diff(MS_TM *start, MS_TM *end);\nint ms_time_cmp(const MS_TM *ap, const MS_TM *bp);\n\n#ifdef  __cplusplus\n}\n#endif\n\n#endif\n\n"
  },
  {
    "path": "freebsd-headers/openssl/txt_db.h",
    "content": "/* crypto/txt_db/txt_db.h */\n/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)\n * All rights reserved.\n *\n * This package is an SSL implementation written\n * by Eric Young (eay@cryptsoft.com).\n * The implementation was written so as to conform with Netscapes SSL.\n * \n * This library is free for commercial and non-commercial use as long as\n * the following conditions are aheared to.  The following conditions\n * apply to all code found in this distribution, be it the RC4, RSA,\n * lhash, DES, etc., code; not just the SSL code.  The SSL documentation\n * included with this distribution is covered by the same copyright terms\n * except that the holder is Tim Hudson (tjh@cryptsoft.com).\n * \n * Copyright remains Eric Young's, and as such any Copyright notices in\n * the code are not to be removed.\n * If this package is used in a product, Eric Young should be given attribution\n * as the author of the parts of the library used.\n * This can be in the form of a textual message at program startup or\n * in documentation (online or textual) provided with the package.\n * \n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. All advertising materials mentioning features or use of this software\n *    must display the following acknowledgement:\n *    \"This product includes cryptographic software written by\n *     Eric Young (eay@cryptsoft.com)\"\n *    The word 'cryptographic' can be left out if the rouines from the library\n *    being used are not cryptographic related :-).\n * 4. If you include any Windows specific code (or a derivative thereof) from \n *    the apps directory (application code) you must include an acknowledgement:\n *    \"This product includes software written by Tim Hudson (tjh@cryptsoft.com)\"\n * \n * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n * \n * The licence and distribution terms for any publically available version or\n * derivative of this code cannot be changed.  i.e. this code cannot simply be\n * copied and put under another distribution licence\n * [including the GNU Public Licence.]\n */\n\n#ifndef HEADER_TXT_DB_H\n#define HEADER_TXT_DB_H\n\n#include <openssl/opensslconf.h>\n#ifndef OPENSSL_NO_BIO\n#include <openssl/bio.h>\n#endif\n#include <openssl/stack.h>\n#include <openssl/lhash.h>\n\n#define DB_ERROR_OK\t\t\t0\n#define DB_ERROR_MALLOC\t\t\t1\n#define DB_ERROR_INDEX_CLASH    \t2\n#define DB_ERROR_INDEX_OUT_OF_RANGE\t3\n#define DB_ERROR_NO_INDEX\t\t4\n#define DB_ERROR_INSERT_INDEX_CLASH    \t5\n\n#ifdef  __cplusplus\nextern \"C\" {\n#endif\n\ntypedef struct txt_db_st\n\t{\n\tint num_fields;\n\tSTACK /* char ** */ *data;\n\tLHASH **index;\n\tint (**qual)(char **);\n\tlong error;\n\tlong arg1;\n\tlong arg2;\n\tchar **arg_row;\n\t} TXT_DB;\n\n#ifndef OPENSSL_NO_BIO\nTXT_DB *TXT_DB_read(BIO *in, int num);\nlong TXT_DB_write(BIO *out, TXT_DB *db);\n#else\nTXT_DB *TXT_DB_read(char *in, int num);\nlong TXT_DB_write(char *out, TXT_DB *db);\n#endif\nint TXT_DB_create_index(TXT_DB *db,int field,int (*qual)(char **),\n\t\tLHASH_HASH_FN_TYPE hash, LHASH_COMP_FN_TYPE cmp);\nvoid TXT_DB_free(TXT_DB *db);\nchar **TXT_DB_get_by_index(TXT_DB *db, int idx, char **value);\nint TXT_DB_insert(TXT_DB *db,char **value);\n\n#ifdef  __cplusplus\n}\n#endif\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/openssl/ui.h",
    "content": "/* crypto/ui/ui.h -*- mode:C; c-file-style: \"eay\" -*- */\n/* Written by Richard Levitte (richard@levitte.org) for the OpenSSL\n * project 2001.\n */\n/* ====================================================================\n * Copyright (c) 2001 The OpenSSL Project.  All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n *\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer. \n *\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in\n *    the documentation and/or other materials provided with the\n *    distribution.\n *\n * 3. All advertising materials mentioning features or use of this\n *    software must display the following acknowledgment:\n *    \"This product includes software developed by the OpenSSL Project\n *    for use in the OpenSSL Toolkit. (http://www.openssl.org/)\"\n *\n * 4. The names \"OpenSSL Toolkit\" and \"OpenSSL Project\" must not be used to\n *    endorse or promote products derived from this software without\n *    prior written permission. For written permission, please contact\n *    openssl-core@openssl.org.\n *\n * 5. Products derived from this software may not be called \"OpenSSL\"\n *    nor may \"OpenSSL\" appear in their names without prior written\n *    permission of the OpenSSL Project.\n *\n * 6. Redistributions of any form whatsoever must retain the following\n *    acknowledgment:\n *    \"This product includes software developed by the OpenSSL Project\n *    for use in the OpenSSL Toolkit (http://www.openssl.org/)\"\n *\n * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY\n * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\n * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE OpenSSL PROJECT OR\n * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\n * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,\n * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED\n * OF THE POSSIBILITY OF SUCH DAMAGE.\n * ====================================================================\n *\n * This product includes cryptographic software written by Eric Young\n * (eay@cryptsoft.com).  This product includes software written by Tim\n * Hudson (tjh@cryptsoft.com).\n *\n */\n\n#ifndef HEADER_UI_H\n#define HEADER_UI_H\n\n#ifndef OPENSSL_NO_DEPRECATED\n#include <openssl/crypto.h>\n#endif\n#include <openssl/safestack.h>\n#include <openssl/ossl_typ.h>\n\n#ifdef  __cplusplus\nextern \"C\" {\n#endif\n\n/* Declared already in ossl_typ.h */\n/* typedef struct ui_st UI; */\n/* typedef struct ui_method_st UI_METHOD; */\n\n\n/* All the following functions return -1 or NULL on error and in some cases\n   (UI_process()) -2 if interrupted or in some other way cancelled.\n   When everything is fine, they return 0, a positive value or a non-NULL\n   pointer, all depending on their purpose. */\n\n/* Creators and destructor.   */\nUI *UI_new(void);\nUI *UI_new_method(const UI_METHOD *method);\nvoid UI_free(UI *ui);\n\n/* The following functions are used to add strings to be printed and prompt\n   strings to prompt for data.  The names are UI_{add,dup}_<function>_string\n   and UI_{add,dup}_input_boolean.\n\n   UI_{add,dup}_<function>_string have the following meanings:\n\tadd\tadd a text or prompt string.  The pointers given to these\n\t\tfunctions are used verbatim, no copying is done.\n\tdup\tmake a copy of the text or prompt string, then add the copy\n\t\tto the collection of strings in the user interface.\n\t<function>\n\t\tThe function is a name for the functionality that the given\n\t\tstring shall be used for.  It can be one of:\n\t\t\tinput\tuse the string as data prompt.\n\t\t\tverify\tuse the string as verification prompt.  This\n\t\t\t\tis used to verify a previous input.\n\t\t\tinfo\tuse the string for informational output.\n\t\t\terror\tuse the string for error output.\n   Honestly, there's currently no difference between info and error for the\n   moment.\n\n   UI_{add,dup}_input_boolean have the same semantics for \"add\" and \"dup\",\n   and are typically used when one wants to prompt for a yes/no response.\n\n\n   All of the functions in this group take a UI and a prompt string.\n   The string input and verify addition functions also take a flag argument,\n   a buffer for the result to end up with, a minimum input size and a maximum\n   input size (the result buffer MUST be large enough to be able to contain\n   the maximum number of characters).  Additionally, the verify addition\n   functions takes another buffer to compare the result against.\n   The boolean input functions take an action description string (which should\n   be safe to ignore if the expected user action is obvious, for example with\n   a dialog box with an OK button and a Cancel button), a string of acceptable\n   characters to mean OK and to mean Cancel.  The two last strings are checked\n   to make sure they don't have common characters.  Additionally, the same\n   flag argument as for the string input is taken, as well as a result buffer.\n   The result buffer is required to be at least one byte long.  Depending on\n   the answer, the first character from the OK or the Cancel character strings\n   will be stored in the first byte of the result buffer.  No NUL will be\n   added, so the result is *not* a string.\n\n   On success, the all return an index of the added information.  That index\n   is usefull when retrieving results with UI_get0_result(). */\nint UI_add_input_string(UI *ui, const char *prompt, int flags,\n\tchar *result_buf, int minsize, int maxsize);\nint UI_dup_input_string(UI *ui, const char *prompt, int flags,\n\tchar *result_buf, int minsize, int maxsize);\nint UI_add_verify_string(UI *ui, const char *prompt, int flags,\n\tchar *result_buf, int minsize, int maxsize, const char *test_buf);\nint UI_dup_verify_string(UI *ui, const char *prompt, int flags,\n\tchar *result_buf, int minsize, int maxsize, const char *test_buf);\nint UI_add_input_boolean(UI *ui, const char *prompt, const char *action_desc,\n\tconst char *ok_chars, const char *cancel_chars,\n\tint flags, char *result_buf);\nint UI_dup_input_boolean(UI *ui, const char *prompt, const char *action_desc,\n\tconst char *ok_chars, const char *cancel_chars,\n\tint flags, char *result_buf);\nint UI_add_info_string(UI *ui, const char *text);\nint UI_dup_info_string(UI *ui, const char *text);\nint UI_add_error_string(UI *ui, const char *text);\nint UI_dup_error_string(UI *ui, const char *text);\n\n/* These are the possible flags.  They can be or'ed together. */\n/* Use to have echoing of input */\n#define UI_INPUT_FLAG_ECHO\t\t0x01\n/* Use a default password.  Where that password is found is completely\n   up to the application, it might for example be in the user data set\n   with UI_add_user_data().  It is not recommended to have more than\n   one input in each UI being marked with this flag, or the application\n   might get confused. */\n#define UI_INPUT_FLAG_DEFAULT_PWD\t0x02\n\n/* The user of these routines may want to define flags of their own.  The core\n   UI won't look at those, but will pass them on to the method routines.  They\n   must use higher bits so they don't get confused with the UI bits above.\n   UI_INPUT_FLAG_USER_BASE tells which is the lowest bit to use.  A good\n   example of use is this:\n\n\t#define MY_UI_FLAG1\t(0x01 << UI_INPUT_FLAG_USER_BASE)\n\n*/\n#define UI_INPUT_FLAG_USER_BASE\t16\n\n\n/* The following function helps construct a prompt.  object_desc is a\n   textual short description of the object, for example \"pass phrase\",\n   and object_name is the name of the object (might be a card name or\n   a file name.\n   The returned string shall always be allocated on the heap with\n   OPENSSL_malloc(), and need to be free'd with OPENSSL_free().\n\n   If the ui_method doesn't contain a pointer to a user-defined prompt\n   constructor, a default string is built, looking like this:\n\n\t\"Enter {object_desc} for {object_name}:\"\n\n   So, if object_desc has the value \"pass phrase\" and object_name has\n   the value \"foo.key\", the resulting string is:\n\n\t\"Enter pass phrase for foo.key:\"\n*/\nchar *UI_construct_prompt(UI *ui_method,\n\tconst char *object_desc, const char *object_name);\n\n\n/* The following function is used to store a pointer to user-specific data.\n   Any previous such pointer will be returned and replaced.\n\n   For callback purposes, this function makes a lot more sense than using\n   ex_data, since the latter requires that different parts of OpenSSL or\n   applications share the same ex_data index.\n\n   Note that the UI_OpenSSL() method completely ignores the user data.\n   Other methods may not, however.  */\nvoid *UI_add_user_data(UI *ui, void *user_data);\n/* We need a user data retrieving function as well.  */\nvoid *UI_get0_user_data(UI *ui);\n\n/* Return the result associated with a prompt given with the index i. */\nconst char *UI_get0_result(UI *ui, int i);\n\n/* When all strings have been added, process the whole thing. */\nint UI_process(UI *ui);\n\n/* Give a user interface parametrised control commands.  This can be used to\n   send down an integer, a data pointer or a function pointer, as well as\n   be used to get information from a UI. */\nint UI_ctrl(UI *ui, int cmd, long i, void *p, void (*f)(void));\n\n/* The commands */\n/* Use UI_CONTROL_PRINT_ERRORS with the value 1 to have UI_process print the\n   OpenSSL error stack before printing any info or added error messages and\n   before any prompting. */\n#define UI_CTRL_PRINT_ERRORS\t\t1\n/* Check if a UI_process() is possible to do again with the same instance of\n   a user interface.  This makes UI_ctrl() return 1 if it is redoable, and 0\n   if not. */\n#define UI_CTRL_IS_REDOABLE\t\t2\n\n\n/* Some methods may use extra data */\n#define UI_set_app_data(s,arg)         UI_set_ex_data(s,0,arg)\n#define UI_get_app_data(s)             UI_get_ex_data(s,0)\nint UI_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func,\n\tCRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func);\nint UI_set_ex_data(UI *r,int idx,void *arg);\nvoid *UI_get_ex_data(UI *r, int idx);\n\n/* Use specific methods instead of the built-in one */\nvoid UI_set_default_method(const UI_METHOD *meth);\nconst UI_METHOD *UI_get_default_method(void);\nconst UI_METHOD *UI_get_method(UI *ui);\nconst UI_METHOD *UI_set_method(UI *ui, const UI_METHOD *meth);\n\n/* The method with all the built-in thingies */\nUI_METHOD *UI_OpenSSL(void);\n\n\n/* ---------- For method writers ---------- */\n/* A method contains a number of functions that implement the low level\n   of the User Interface.  The functions are:\n\n\tan opener\tThis function starts a session, maybe by opening\n\t\t\ta channel to a tty, or by opening a window.\n\ta writer\tThis function is called to write a given string,\n\t\t\tmaybe to the tty, maybe as a field label in a\n\t\t\twindow.\n\ta flusher\tThis function is called to flush everything that\n\t\t\thas been output so far.  It can be used to actually\n\t\t\tdisplay a dialog box after it has been built.\n\ta reader\tThis function is called to read a given prompt,\n\t\t\tmaybe from the tty, maybe from a field in a\n\t\t\twindow.  Note that it's called wth all string\n\t\t\tstructures, not only the prompt ones, so it must\n\t\t\tcheck such things itself.\n\ta closer\tThis function closes the session, maybe by closing\n\t\t\tthe channel to the tty, or closing the window.\n\n   All these functions are expected to return:\n\n\t0\ton error.\n\t1\ton success.\n\t-1\ton out-of-band events, for example if some prompting has\n\t\tbeen canceled (by pressing Ctrl-C, for example).  This is\n\t\tonly checked when returned by the flusher or the reader.\n\n   The way this is used, the opener is first called, then the writer for all\n   strings, then the flusher, then the reader for all strings and finally the\n   closer.  Note that if you want to prompt from a terminal or other command\n   line interface, the best is to have the reader also write the prompts\n   instead of having the writer do it.  If you want to prompt from a dialog\n   box, the writer can be used to build up the contents of the box, and the\n   flusher to actually display the box and run the event loop until all data\n   has been given, after which the reader only grabs the given data and puts\n   them back into the UI strings.\n\n   All method functions take a UI as argument.  Additionally, the writer and\n   the reader take a UI_STRING.\n*/\n\n/* The UI_STRING type is the data structure that contains all the needed info\n   about a string or a prompt, including test data for a verification prompt.\n*/\nDECLARE_STACK_OF(UI_STRING)\ntypedef struct ui_string_st UI_STRING;\n\n/* The different types of strings that are currently supported.\n   This is only needed by method authors. */\nenum UI_string_types\n\t{\n\tUIT_NONE=0,\n\tUIT_PROMPT,\t\t/* Prompt for a string */\n\tUIT_VERIFY,\t\t/* Prompt for a string and verify */\n\tUIT_BOOLEAN,\t\t/* Prompt for a yes/no response */\n\tUIT_INFO,\t\t/* Send info to the user */\n\tUIT_ERROR\t\t/* Send an error message to the user */\n\t};\n\n/* Create and manipulate methods */\nUI_METHOD *UI_create_method(char *name);\nvoid UI_destroy_method(UI_METHOD *ui_method);\nint UI_method_set_opener(UI_METHOD *method, int (*opener)(UI *ui));\nint UI_method_set_writer(UI_METHOD *method, int (*writer)(UI *ui, UI_STRING *uis));\nint UI_method_set_flusher(UI_METHOD *method, int (*flusher)(UI *ui));\nint UI_method_set_reader(UI_METHOD *method, int (*reader)(UI *ui, UI_STRING *uis));\nint UI_method_set_closer(UI_METHOD *method, int (*closer)(UI *ui));\nint (*UI_method_get_opener(UI_METHOD *method))(UI*);\nint (*UI_method_get_writer(UI_METHOD *method))(UI*,UI_STRING*);\nint (*UI_method_get_flusher(UI_METHOD *method))(UI*);\nint (*UI_method_get_reader(UI_METHOD *method))(UI*,UI_STRING*);\nint (*UI_method_get_closer(UI_METHOD *method))(UI*);\n\n/* The following functions are helpers for method writers to access relevant\n   data from a UI_STRING. */\n\n/* Return type of the UI_STRING */\nenum UI_string_types UI_get_string_type(UI_STRING *uis);\n/* Return input flags of the UI_STRING */\nint UI_get_input_flags(UI_STRING *uis);\n/* Return the actual string to output (the prompt, info or error) */\nconst char *UI_get0_output_string(UI_STRING *uis);\n/* Return the optional action string to output (the boolean promtp instruction) */\nconst char *UI_get0_action_string(UI_STRING *uis);\n/* Return the result of a prompt */\nconst char *UI_get0_result_string(UI_STRING *uis);\n/* Return the string to test the result against.  Only useful with verifies. */\nconst char *UI_get0_test_string(UI_STRING *uis);\n/* Return the required minimum size of the result */\nint UI_get_result_minsize(UI_STRING *uis);\n/* Return the required maximum size of the result */\nint UI_get_result_maxsize(UI_STRING *uis);\n/* Set the result of a UI_STRING. */\nint UI_set_result(UI *ui, UI_STRING *uis, const char *result);\n\n\n/* A couple of popular utility functions */\nint UI_UTIL_read_pw_string(char *buf,int length,const char *prompt,int verify);\nint UI_UTIL_read_pw(char *buf,char *buff,int size,const char *prompt,int verify);\n\n\n/* BEGIN ERROR CODES */\n/* The following lines are auto generated by the script mkerr.pl. Any changes\n * made after this point may be overwritten when the script is next run.\n */\nvoid ERR_load_UI_strings(void);\n\n/* Error codes for the UI functions. */\n\n/* Function codes. */\n#define UI_F_GENERAL_ALLOCATE_BOOLEAN\t\t\t 108\n#define UI_F_GENERAL_ALLOCATE_PROMPT\t\t\t 109\n#define UI_F_GENERAL_ALLOCATE_STRING\t\t\t 100\n#define UI_F_UI_CTRL\t\t\t\t\t 111\n#define UI_F_UI_DUP_ERROR_STRING\t\t\t 101\n#define UI_F_UI_DUP_INFO_STRING\t\t\t\t 102\n#define UI_F_UI_DUP_INPUT_BOOLEAN\t\t\t 110\n#define UI_F_UI_DUP_INPUT_STRING\t\t\t 103\n#define UI_F_UI_DUP_VERIFY_STRING\t\t\t 106\n#define UI_F_UI_GET0_RESULT\t\t\t\t 107\n#define UI_F_UI_NEW_METHOD\t\t\t\t 104\n#define UI_F_UI_SET_RESULT\t\t\t\t 105\n\n/* Reason codes. */\n#define UI_R_COMMON_OK_AND_CANCEL_CHARACTERS\t\t 104\n#define UI_R_INDEX_TOO_LARGE\t\t\t\t 102\n#define UI_R_INDEX_TOO_SMALL\t\t\t\t 103\n#define UI_R_NO_RESULT_BUFFER\t\t\t\t 105\n#define UI_R_RESULT_TOO_LARGE\t\t\t\t 100\n#define UI_R_RESULT_TOO_SMALL\t\t\t\t 101\n#define UI_R_UNKNOWN_CONTROL_COMMAND\t\t\t 106\n\n#ifdef  __cplusplus\n}\n#endif\n#endif\n"
  },
  {
    "path": "freebsd-headers/openssl/ui_compat.h",
    "content": "/* crypto/ui/ui.h -*- mode:C; c-file-style: \"eay\" -*- */\n/* Written by Richard Levitte (richard@levitte.org) for the OpenSSL\n * project 2001.\n */\n/* ====================================================================\n * Copyright (c) 2001 The OpenSSL Project.  All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n *\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer. \n *\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in\n *    the documentation and/or other materials provided with the\n *    distribution.\n *\n * 3. All advertising materials mentioning features or use of this\n *    software must display the following acknowledgment:\n *    \"This product includes software developed by the OpenSSL Project\n *    for use in the OpenSSL Toolkit. (http://www.openssl.org/)\"\n *\n * 4. The names \"OpenSSL Toolkit\" and \"OpenSSL Project\" must not be used to\n *    endorse or promote products derived from this software without\n *    prior written permission. For written permission, please contact\n *    openssl-core@openssl.org.\n *\n * 5. Products derived from this software may not be called \"OpenSSL\"\n *    nor may \"OpenSSL\" appear in their names without prior written\n *    permission of the OpenSSL Project.\n *\n * 6. Redistributions of any form whatsoever must retain the following\n *    acknowledgment:\n *    \"This product includes software developed by the OpenSSL Project\n *    for use in the OpenSSL Toolkit (http://www.openssl.org/)\"\n *\n * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY\n * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\n * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE OpenSSL PROJECT OR\n * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\n * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,\n * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED\n * OF THE POSSIBILITY OF SUCH DAMAGE.\n * ====================================================================\n *\n * This product includes cryptographic software written by Eric Young\n * (eay@cryptsoft.com).  This product includes software written by Tim\n * Hudson (tjh@cryptsoft.com).\n *\n */\n\n#ifndef HEADER_UI_COMPAT_H\n#define HEADER_UI_COMPAT_H\n\n#include <openssl/opensslconf.h>\n#include <openssl/ui.h>\n\n#ifdef  __cplusplus\nextern \"C\" {\n#endif\n\n/* The following functions were previously part of the DES section,\n   and are provided here for backward compatibility reasons. */\n\n#define des_read_pw_string(b,l,p,v) \\\n\t_ossl_old_des_read_pw_string((b),(l),(p),(v))\n#define des_read_pw(b,bf,s,p,v) \\\n\t_ossl_old_des_read_pw((b),(bf),(s),(p),(v))\n\nint _ossl_old_des_read_pw_string(char *buf,int length,const char *prompt,int verify);\nint _ossl_old_des_read_pw(char *buf,char *buff,int size,const char *prompt,int verify);\n\n#ifdef  __cplusplus\n}\n#endif\n#endif\n"
  },
  {
    "path": "freebsd-headers/openssl/ui_locl.h",
    "content": "/* crypto/ui/ui.h -*- mode:C; c-file-style: \"eay\" -*- */\n/* Written by Richard Levitte (richard@levitte.org) for the OpenSSL\n * project 2001.\n */\n/* ====================================================================\n * Copyright (c) 2001 The OpenSSL Project.  All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n *\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer. \n *\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in\n *    the documentation and/or other materials provided with the\n *    distribution.\n *\n * 3. All advertising materials mentioning features or use of this\n *    software must display the following acknowledgment:\n *    \"This product includes software developed by the OpenSSL Project\n *    for use in the OpenSSL Toolkit. (http://www.openssl.org/)\"\n *\n * 4. The names \"OpenSSL Toolkit\" and \"OpenSSL Project\" must not be used to\n *    endorse or promote products derived from this software without\n *    prior written permission. For written permission, please contact\n *    openssl-core@openssl.org.\n *\n * 5. Products derived from this software may not be called \"OpenSSL\"\n *    nor may \"OpenSSL\" appear in their names without prior written\n *    permission of the OpenSSL Project.\n *\n * 6. Redistributions of any form whatsoever must retain the following\n *    acknowledgment:\n *    \"This product includes software developed by the OpenSSL Project\n *    for use in the OpenSSL Toolkit (http://www.openssl.org/)\"\n *\n * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY\n * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\n * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE OpenSSL PROJECT OR\n * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\n * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,\n * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED\n * OF THE POSSIBILITY OF SUCH DAMAGE.\n * ====================================================================\n *\n * This product includes cryptographic software written by Eric Young\n * (eay@cryptsoft.com).  This product includes software written by Tim\n * Hudson (tjh@cryptsoft.com).\n *\n */\n\n#ifndef HEADER_UI_LOCL_H\n#define HEADER_UI_LOCL_H\n\n#include <openssl/ui.h>\n#include <openssl/crypto.h>\n\n#ifdef _\n#undef _\n#endif\n\nstruct ui_method_st\n\t{\n\tchar *name;\n\n\t/* All the functions return 1 or non-NULL for success and 0 or NULL\n\t   for failure */\n\n\t/* Open whatever channel for this, be it the console, an X window\n\t   or whatever.\n\t   This function should use the ex_data structure to save\n\t   intermediate data. */\n\tint (*ui_open_session)(UI *ui);\n\n\tint (*ui_write_string)(UI *ui, UI_STRING *uis);\n\n\t/* Flush the output.  If a GUI dialog box is used, this function can\n\t   be used to actually display it. */\n\tint (*ui_flush)(UI *ui);\n\n\tint (*ui_read_string)(UI *ui, UI_STRING *uis);\n\n\tint (*ui_close_session)(UI *ui);\n\n\t/* Construct a prompt in a user-defined manner.  object_desc is a\n\t   textual short description of the object, for example \"pass phrase\",\n\t   and object_name is the name of the object (might be a card name or\n\t   a file name.\n\t   The returned string shall always be allocated on the heap with\n\t   OPENSSL_malloc(), and need to be free'd with OPENSSL_free(). */\n\tchar *(*ui_construct_prompt)(UI *ui, const char *object_desc,\n\t\tconst char *object_name);\n\t};\n\nstruct ui_string_st\n\t{\n\tenum UI_string_types type; /* Input */\n\tconst char *out_string;\t/* Input */\n\tint input_flags;\t/* Flags from the user */\n\n\t/* The following parameters are completely irrelevant for UIT_INFO,\n\t   and can therefore be set to 0 or NULL */\n\tchar *result_buf;\t/* Input and Output: If not NULL, user-defined\n\t\t\t\t   with size in result_maxsize.  Otherwise, it\n\t\t\t\t   may be allocated by the UI routine, meaning\n\t\t\t\t   result_minsize is going to be overwritten.*/\n\tunion\n\t\t{\n\t\tstruct\n\t\t\t{\n\t\t\tint result_minsize;\t/* Input: minimum required\n\t\t\t\t\t\t   size of the result.\n\t\t\t\t\t\t*/\n\t\t\tint result_maxsize;\t/* Input: maximum permitted\n\t\t\t\t\t\t   size of the result */\n\n\t\t\tconst char *test_buf;\t/* Input: test string to verify\n\t\t\t\t\t\t   against */\n\t\t\t} string_data;\n\t\tstruct\n\t\t\t{\n\t\t\tconst char *action_desc; /* Input */\n\t\t\tconst char *ok_chars; /* Input */\n\t\t\tconst char *cancel_chars; /* Input */\n\t\t\t} boolean_data;\n\t\t} _;\n\n#define OUT_STRING_FREEABLE 0x01\n\tint flags;\t\t/* flags for internal use */\n\t};\n\nstruct ui_st\n\t{\n\tconst UI_METHOD *meth;\n\tSTACK_OF(UI_STRING) *strings; /* We might want to prompt for more\n\t\t\t\t\t than one thing at a time, and\n\t\t\t\t\t with different echoing status.  */\n\tvoid *user_data;\n\tCRYPTO_EX_DATA ex_data;\n\n#define UI_FLAG_REDOABLE\t0x0001\n#define UI_FLAG_PRINT_ERRORS\t0x0100\n\tint flags;\n\t};\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/openssl/x509.h",
    "content": "/* crypto/x509/x509.h */\n/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)\n * All rights reserved.\n *\n * This package is an SSL implementation written\n * by Eric Young (eay@cryptsoft.com).\n * The implementation was written so as to conform with Netscapes SSL.\n * \n * This library is free for commercial and non-commercial use as long as\n * the following conditions are aheared to.  The following conditions\n * apply to all code found in this distribution, be it the RC4, RSA,\n * lhash, DES, etc., code; not just the SSL code.  The SSL documentation\n * included with this distribution is covered by the same copyright terms\n * except that the holder is Tim Hudson (tjh@cryptsoft.com).\n * \n * Copyright remains Eric Young's, and as such any Copyright notices in\n * the code are not to be removed.\n * If this package is used in a product, Eric Young should be given attribution\n * as the author of the parts of the library used.\n * This can be in the form of a textual message at program startup or\n * in documentation (online or textual) provided with the package.\n * \n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. All advertising materials mentioning features or use of this software\n *    must display the following acknowledgement:\n *    \"This product includes cryptographic software written by\n *     Eric Young (eay@cryptsoft.com)\"\n *    The word 'cryptographic' can be left out if the rouines from the library\n *    being used are not cryptographic related :-).\n * 4. If you include any Windows specific code (or a derivative thereof) from \n *    the apps directory (application code) you must include an acknowledgement:\n *    \"This product includes software written by Tim Hudson (tjh@cryptsoft.com)\"\n * \n * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n * \n * The licence and distribution terms for any publically available version or\n * derivative of this code cannot be changed.  i.e. this code cannot simply be\n * copied and put under another distribution licence\n * [including the GNU Public Licence.]\n */\n/* ====================================================================\n * Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED.\n * ECDH support in OpenSSL originally developed by \n * SUN MICROSYSTEMS, INC., and contributed to the OpenSSL project.\n */\n\n#ifndef HEADER_X509_H\n#define HEADER_X509_H\n\n#include <openssl/e_os2.h>\n#include <openssl/symhacks.h>\n#ifndef OPENSSL_NO_BUFFER\n#include <openssl/buffer.h>\n#endif\n#ifndef OPENSSL_NO_EVP\n#include <openssl/evp.h>\n#endif\n#ifndef OPENSSL_NO_BIO\n#include <openssl/bio.h>\n#endif\n#include <openssl/stack.h>\n#include <openssl/asn1.h>\n#include <openssl/safestack.h>\n\n#ifndef OPENSSL_NO_EC\n#include <openssl/ec.h>\n#endif\n\n#ifndef OPENSSL_NO_ECDSA\n#include <openssl/ecdsa.h>\n#endif\n\n#ifndef OPENSSL_NO_ECDH\n#include <openssl/ecdh.h>\n#endif\n\n#ifndef OPENSSL_NO_DEPRECATED\n#ifndef OPENSSL_NO_RSA\n#include <openssl/rsa.h>\n#endif\n#ifndef OPENSSL_NO_DSA\n#include <openssl/dsa.h>\n#endif\n#ifndef OPENSSL_NO_DH\n#include <openssl/dh.h>\n#endif\n#endif\n\n#ifndef OPENSSL_NO_SHA\n#include <openssl/sha.h>\n#endif\n#include <openssl/ossl_typ.h>\n\n#ifdef  __cplusplus\nextern \"C\" {\n#endif\n\n#ifdef OPENSSL_SYS_WIN32\n/* Under Win32 these are defined in wincrypt.h */\n#undef X509_NAME\n#undef X509_CERT_PAIR\n#undef X509_EXTENSIONS\n#endif\n\n#define X509_FILETYPE_PEM\t1\n#define X509_FILETYPE_ASN1\t2\n#define X509_FILETYPE_DEFAULT\t3\n\n#define X509v3_KU_DIGITAL_SIGNATURE\t0x0080\n#define X509v3_KU_NON_REPUDIATION\t0x0040\n#define X509v3_KU_KEY_ENCIPHERMENT\t0x0020\n#define X509v3_KU_DATA_ENCIPHERMENT\t0x0010\n#define X509v3_KU_KEY_AGREEMENT\t\t0x0008\n#define X509v3_KU_KEY_CERT_SIGN\t\t0x0004\n#define X509v3_KU_CRL_SIGN\t\t0x0002\n#define X509v3_KU_ENCIPHER_ONLY\t\t0x0001\n#define X509v3_KU_DECIPHER_ONLY\t\t0x8000\n#define X509v3_KU_UNDEF\t\t\t0xffff\n\ntypedef struct X509_objects_st\n\t{\n\tint nid;\n\tint (*a2i)(void);\n\tint (*i2a)(void);\n\t} X509_OBJECTS;\n\nstruct X509_algor_st\n\t{\n\tASN1_OBJECT *algorithm;\n\tASN1_TYPE *parameter;\n\t} /* X509_ALGOR */;\n\nDECLARE_ASN1_SET_OF(X509_ALGOR)\n\ntypedef STACK_OF(X509_ALGOR) X509_ALGORS;\n\ntypedef struct X509_val_st\n\t{\n\tASN1_TIME *notBefore;\n\tASN1_TIME *notAfter;\n\t} X509_VAL;\n\ntypedef struct X509_pubkey_st\n\t{\n\tX509_ALGOR *algor;\n\tASN1_BIT_STRING *public_key;\n\tEVP_PKEY *pkey;\n\t} X509_PUBKEY;\n\ntypedef struct X509_sig_st\n\t{\n\tX509_ALGOR *algor;\n\tASN1_OCTET_STRING *digest;\n\t} X509_SIG;\n\ntypedef struct X509_name_entry_st\n\t{\n\tASN1_OBJECT *object;\n\tASN1_STRING *value;\n\tint set;\n\tint size; \t/* temp variable */\n\t} X509_NAME_ENTRY;\n\nDECLARE_STACK_OF(X509_NAME_ENTRY)\nDECLARE_ASN1_SET_OF(X509_NAME_ENTRY)\n\n/* we always keep X509_NAMEs in 2 forms. */\nstruct X509_name_st\n\t{\n\tSTACK_OF(X509_NAME_ENTRY) *entries;\n\tint modified;\t/* true if 'bytes' needs to be built */\n#ifndef OPENSSL_NO_BUFFER\n\tBUF_MEM *bytes;\n#else\n\tchar *bytes;\n#endif\n\tunsigned long hash; /* Keep the hash around for lookups */\n\t} /* X509_NAME */;\n\nDECLARE_STACK_OF(X509_NAME)\n\n#define X509_EX_V_NETSCAPE_HACK\t\t0x8000\n#define X509_EX_V_INIT\t\t\t0x0001\ntypedef struct X509_extension_st\n\t{\n\tASN1_OBJECT *object;\n\tASN1_BOOLEAN critical;\n\tASN1_OCTET_STRING *value;\n\t} X509_EXTENSION;\n\ntypedef STACK_OF(X509_EXTENSION) X509_EXTENSIONS;\n\nDECLARE_STACK_OF(X509_EXTENSION)\nDECLARE_ASN1_SET_OF(X509_EXTENSION)\n\n/* a sequence of these are used */\ntypedef struct x509_attributes_st\n\t{\n\tASN1_OBJECT *object;\n\tint single; /* 0 for a set, 1 for a single item (which is wrong) */\n\tunion\t{\n\t\tchar\t\t*ptr;\n/* 0 */\t\tSTACK_OF(ASN1_TYPE) *set;\n/* 1 */\t\tASN1_TYPE\t*single;\n\t\t} value;\n\t} X509_ATTRIBUTE;\n\nDECLARE_STACK_OF(X509_ATTRIBUTE)\nDECLARE_ASN1_SET_OF(X509_ATTRIBUTE)\n\n\ntypedef struct X509_req_info_st\n\t{\n\tASN1_ENCODING enc;\n\tASN1_INTEGER *version;\n\tX509_NAME *subject;\n\tX509_PUBKEY *pubkey;\n\t/*  d=2 hl=2 l=  0 cons: cont: 00 */\n\tSTACK_OF(X509_ATTRIBUTE) *attributes; /* [ 0 ] */\n\t} X509_REQ_INFO;\n\ntypedef struct X509_req_st\n\t{\n\tX509_REQ_INFO *req_info;\n\tX509_ALGOR *sig_alg;\n\tASN1_BIT_STRING *signature;\n\tint references;\n\t} X509_REQ;\n\ntypedef struct x509_cinf_st\n\t{\n\tASN1_INTEGER *version;\t\t/* [ 0 ] default of v1 */\n\tASN1_INTEGER *serialNumber;\n\tX509_ALGOR *signature;\n\tX509_NAME *issuer;\n\tX509_VAL *validity;\n\tX509_NAME *subject;\n\tX509_PUBKEY *key;\n\tASN1_BIT_STRING *issuerUID;\t\t/* [ 1 ] optional in v2 */\n\tASN1_BIT_STRING *subjectUID;\t\t/* [ 2 ] optional in v2 */\n\tSTACK_OF(X509_EXTENSION) *extensions;\t/* [ 3 ] optional in v3 */\n\tASN1_ENCODING enc;\n\t} X509_CINF;\n\n/* This stuff is certificate \"auxiliary info\"\n * it contains details which are useful in certificate\n * stores and databases. When used this is tagged onto\n * the end of the certificate itself\n */\n\ntypedef struct x509_cert_aux_st\n\t{\n\tSTACK_OF(ASN1_OBJECT) *trust;\t\t/* trusted uses */\n\tSTACK_OF(ASN1_OBJECT) *reject;\t\t/* rejected uses */\n\tASN1_UTF8STRING *alias;\t\t\t/* \"friendly name\" */\n\tASN1_OCTET_STRING *keyid;\t\t/* key id of private key */\n\tSTACK_OF(X509_ALGOR) *other;\t\t/* other unspecified info */\n\t} X509_CERT_AUX;\n\nstruct x509_st\n\t{\n\tX509_CINF *cert_info;\n\tX509_ALGOR *sig_alg;\n\tASN1_BIT_STRING *signature;\n\tint valid;\n\tint references;\n\tchar *name;\n\tCRYPTO_EX_DATA ex_data;\n\t/* These contain copies of various extension values */\n\tlong ex_pathlen;\n\tlong ex_pcpathlen;\n\tunsigned long ex_flags;\n\tunsigned long ex_kusage;\n\tunsigned long ex_xkusage;\n\tunsigned long ex_nscert;\n\tASN1_OCTET_STRING *skid;\n\tstruct AUTHORITY_KEYID_st *akid;\n\tX509_POLICY_CACHE *policy_cache;\n#ifndef OPENSSL_NO_RFC3779\n\tSTACK_OF(IPAddressFamily) *rfc3779_addr;\n\tstruct ASIdentifiers_st *rfc3779_asid;\n#endif\n#ifndef OPENSSL_NO_SHA\n\tunsigned char sha1_hash[SHA_DIGEST_LENGTH];\n#endif\n\tX509_CERT_AUX *aux;\n\t} /* X509 */;\n\nDECLARE_STACK_OF(X509)\nDECLARE_ASN1_SET_OF(X509)\n\n/* This is used for a table of trust checking functions */\n\ntypedef struct x509_trust_st {\n\tint trust;\n\tint flags;\n\tint (*check_trust)(struct x509_trust_st *, X509 *, int);\n\tchar *name;\n\tint arg1;\n\tvoid *arg2;\n} X509_TRUST;\n\nDECLARE_STACK_OF(X509_TRUST)\n\ntypedef struct x509_cert_pair_st {\n\tX509 *forward;\n\tX509 *reverse;\n} X509_CERT_PAIR;\n\n/* standard trust ids */\n\n#define X509_TRUST_DEFAULT\t-1\t/* Only valid in purpose settings */\n\n#define X509_TRUST_COMPAT\t1\n#define X509_TRUST_SSL_CLIENT\t2\n#define X509_TRUST_SSL_SERVER\t3\n#define X509_TRUST_EMAIL\t4\n#define X509_TRUST_OBJECT_SIGN\t5\n#define X509_TRUST_OCSP_SIGN\t6\n#define X509_TRUST_OCSP_REQUEST\t7\n\n/* Keep these up to date! */\n#define X509_TRUST_MIN\t\t1\n#define X509_TRUST_MAX\t\t7\n\n\n/* trust_flags values */\n#define\tX509_TRUST_DYNAMIC \t1\n#define\tX509_TRUST_DYNAMIC_NAME\t2\n\n/* check_trust return codes */\n\n#define X509_TRUST_TRUSTED\t1\n#define X509_TRUST_REJECTED\t2\n#define X509_TRUST_UNTRUSTED\t3\n\n/* Flags for X509_print_ex() */\n\n#define\tX509_FLAG_COMPAT\t\t0\n#define\tX509_FLAG_NO_HEADER\t\t1L\n#define\tX509_FLAG_NO_VERSION\t\t(1L << 1)\n#define\tX509_FLAG_NO_SERIAL\t\t(1L << 2)\n#define\tX509_FLAG_NO_SIGNAME\t\t(1L << 3)\n#define\tX509_FLAG_NO_ISSUER\t\t(1L << 4)\n#define\tX509_FLAG_NO_VALIDITY\t\t(1L << 5)\n#define\tX509_FLAG_NO_SUBJECT\t\t(1L << 6)\n#define\tX509_FLAG_NO_PUBKEY\t\t(1L << 7)\n#define\tX509_FLAG_NO_EXTENSIONS\t\t(1L << 8)\n#define\tX509_FLAG_NO_SIGDUMP\t\t(1L << 9)\n#define\tX509_FLAG_NO_AUX\t\t(1L << 10)\n#define\tX509_FLAG_NO_ATTRIBUTES\t\t(1L << 11)\n\n/* Flags specific to X509_NAME_print_ex() */\t\n\n/* The field separator information */\n\n#define XN_FLAG_SEP_MASK\t(0xf << 16)\n\n#define XN_FLAG_COMPAT\t\t0\t\t/* Traditional SSLeay: use old X509_NAME_print */\n#define XN_FLAG_SEP_COMMA_PLUS\t(1 << 16)\t/* RFC2253 ,+ */\n#define XN_FLAG_SEP_CPLUS_SPC\t(2 << 16)\t/* ,+ spaced: more readable */\n#define XN_FLAG_SEP_SPLUS_SPC\t(3 << 16)\t/* ;+ spaced */\n#define XN_FLAG_SEP_MULTILINE\t(4 << 16)\t/* One line per field */\n\n#define XN_FLAG_DN_REV\t\t(1 << 20)\t/* Reverse DN order */\n\n/* How the field name is shown */\n\n#define XN_FLAG_FN_MASK\t\t(0x3 << 21)\n\n#define XN_FLAG_FN_SN\t\t0\t\t/* Object short name */\n#define XN_FLAG_FN_LN\t\t(1 << 21)\t/* Object long name */\n#define XN_FLAG_FN_OID\t\t(2 << 21)\t/* Always use OIDs */\n#define XN_FLAG_FN_NONE\t\t(3 << 21)\t/* No field names */\n\n#define XN_FLAG_SPC_EQ\t\t(1 << 23)\t/* Put spaces round '=' */\n\n/* This determines if we dump fields we don't recognise:\n * RFC2253 requires this.\n */\n\n#define XN_FLAG_DUMP_UNKNOWN_FIELDS (1 << 24)\n\n#define XN_FLAG_FN_ALIGN\t(1 << 25)\t/* Align field names to 20 characters */\n\n/* Complete set of RFC2253 flags */\n\n#define XN_FLAG_RFC2253 (ASN1_STRFLGS_RFC2253 | \\\n\t\t\tXN_FLAG_SEP_COMMA_PLUS | \\\n\t\t\tXN_FLAG_DN_REV | \\\n\t\t\tXN_FLAG_FN_SN | \\\n\t\t\tXN_FLAG_DUMP_UNKNOWN_FIELDS)\n\n/* readable oneline form */\n\n#define XN_FLAG_ONELINE (ASN1_STRFLGS_RFC2253 | \\\n\t\t\tASN1_STRFLGS_ESC_QUOTE | \\\n\t\t\tXN_FLAG_SEP_CPLUS_SPC | \\\n\t\t\tXN_FLAG_SPC_EQ | \\\n\t\t\tXN_FLAG_FN_SN)\n\n/* readable multiline form */\n\n#define XN_FLAG_MULTILINE (ASN1_STRFLGS_ESC_CTRL | \\\n\t\t\tASN1_STRFLGS_ESC_MSB | \\\n\t\t\tXN_FLAG_SEP_MULTILINE | \\\n\t\t\tXN_FLAG_SPC_EQ | \\\n\t\t\tXN_FLAG_FN_LN | \\\n\t\t\tXN_FLAG_FN_ALIGN)\n\ntypedef struct X509_revoked_st\n\t{\n\tASN1_INTEGER *serialNumber;\n\tASN1_TIME *revocationDate;\n\tSTACK_OF(X509_EXTENSION) /* optional */ *extensions;\n\tint sequence; /* load sequence */\n\t} X509_REVOKED;\n\nDECLARE_STACK_OF(X509_REVOKED)\nDECLARE_ASN1_SET_OF(X509_REVOKED)\n\ntypedef struct X509_crl_info_st\n\t{\n\tASN1_INTEGER *version;\n\tX509_ALGOR *sig_alg;\n\tX509_NAME *issuer;\n\tASN1_TIME *lastUpdate;\n\tASN1_TIME *nextUpdate;\n\tSTACK_OF(X509_REVOKED) *revoked;\n\tSTACK_OF(X509_EXTENSION) /* [0] */ *extensions;\n\tASN1_ENCODING enc;\n\t} X509_CRL_INFO;\n\nstruct X509_crl_st\n\t{\n\t/* actual signature */\n\tX509_CRL_INFO *crl;\n\tX509_ALGOR *sig_alg;\n\tASN1_BIT_STRING *signature;\n\tint references;\n\t} /* X509_CRL */;\n\nDECLARE_STACK_OF(X509_CRL)\nDECLARE_ASN1_SET_OF(X509_CRL)\n\ntypedef struct private_key_st\n\t{\n\tint version;\n\t/* The PKCS#8 data types */\n\tX509_ALGOR *enc_algor;\n\tASN1_OCTET_STRING *enc_pkey;\t/* encrypted pub key */\n\n\t/* When decrypted, the following will not be NULL */\n\tEVP_PKEY *dec_pkey;\n\n\t/* used to encrypt and decrypt */\n\tint key_length;\n\tchar *key_data;\n\tint key_free;\t/* true if we should auto free key_data */\n\n\t/* expanded version of 'enc_algor' */\n\tEVP_CIPHER_INFO cipher;\n\n\tint references;\n\t} X509_PKEY;\n\n#ifndef OPENSSL_NO_EVP\ntypedef struct X509_info_st\n\t{\n\tX509 *x509;\n\tX509_CRL *crl;\n\tX509_PKEY *x_pkey;\n\n\tEVP_CIPHER_INFO enc_cipher;\n\tint enc_len;\n\tchar *enc_data;\n\n\tint references;\n\t} X509_INFO;\n\nDECLARE_STACK_OF(X509_INFO)\n#endif\n\n/* The next 2 structures and their 8 routines were sent to me by\n * Pat Richard <patr@x509.com> and are used to manipulate\n * Netscapes spki structures - useful if you are writing a CA web page\n */\ntypedef struct Netscape_spkac_st\n\t{\n\tX509_PUBKEY *pubkey;\n\tASN1_IA5STRING *challenge;\t/* challenge sent in atlas >= PR2 */\n\t} NETSCAPE_SPKAC;\n\ntypedef struct Netscape_spki_st\n\t{\n\tNETSCAPE_SPKAC *spkac;\t/* signed public key and challenge */\n\tX509_ALGOR *sig_algor;\n\tASN1_BIT_STRING *signature;\n\t} NETSCAPE_SPKI;\n\n/* Netscape certificate sequence structure */\ntypedef struct Netscape_certificate_sequence\n\t{\n\tASN1_OBJECT *type;\n\tSTACK_OF(X509) *certs;\n\t} NETSCAPE_CERT_SEQUENCE;\n\n/* Unused (and iv length is wrong)\ntypedef struct CBCParameter_st\n\t{\n\tunsigned char iv[8];\n\t} CBC_PARAM;\n*/\n\n/* Password based encryption structure */\n\ntypedef struct PBEPARAM_st {\nASN1_OCTET_STRING *salt;\nASN1_INTEGER *iter;\n} PBEPARAM;\n\n/* Password based encryption V2 structures */\n\ntypedef struct PBE2PARAM_st {\nX509_ALGOR *keyfunc;\nX509_ALGOR *encryption;\n} PBE2PARAM;\n\ntypedef struct PBKDF2PARAM_st {\nASN1_TYPE *salt;\t/* Usually OCTET STRING but could be anything */\nASN1_INTEGER *iter;\nASN1_INTEGER *keylength;\nX509_ALGOR *prf;\n} PBKDF2PARAM;\n\n\n/* PKCS#8 private key info structure */\n\ntypedef struct pkcs8_priv_key_info_st\n        {\n        int broken;     /* Flag for various broken formats */\n#define PKCS8_OK\t\t0\n#define PKCS8_NO_OCTET\t\t1\n#define PKCS8_EMBEDDED_PARAM\t2\n#define PKCS8_NS_DB\t\t3\n        ASN1_INTEGER *version;\n        X509_ALGOR *pkeyalg;\n        ASN1_TYPE *pkey; /* Should be OCTET STRING but some are broken */\n        STACK_OF(X509_ATTRIBUTE) *attributes;\n        } PKCS8_PRIV_KEY_INFO;\n\n#ifdef  __cplusplus\n}\n#endif\n\n#include <openssl/x509_vfy.h>\n#include <openssl/pkcs7.h>\n\n#ifdef  __cplusplus\nextern \"C\" {\n#endif\n\n#ifdef SSLEAY_MACROS\n#define X509_verify(a,r) ASN1_verify((int (*)())i2d_X509_CINF,a->sig_alg,\\\n\ta->signature,(char *)a->cert_info,r)\n#define X509_REQ_verify(a,r) ASN1_verify((int (*)())i2d_X509_REQ_INFO, \\\n\ta->sig_alg,a->signature,(char *)a->req_info,r)\n#define X509_CRL_verify(a,r) ASN1_verify((int (*)())i2d_X509_CRL_INFO, \\\n\ta->sig_alg, a->signature,(char *)a->crl,r)\n\n#define X509_sign(x,pkey,md) \\\n\tASN1_sign((int (*)())i2d_X509_CINF, x->cert_info->signature, \\\n\t\tx->sig_alg, x->signature, (char *)x->cert_info,pkey,md)\n#define X509_REQ_sign(x,pkey,md) \\\n\tASN1_sign((int (*)())i2d_X509_REQ_INFO,x->sig_alg, NULL, \\\n\t\tx->signature, (char *)x->req_info,pkey,md)\n#define X509_CRL_sign(x,pkey,md) \\\n\tASN1_sign((int (*)())i2d_X509_CRL_INFO,x->crl->sig_alg,x->sig_alg, \\\n\t\tx->signature, (char *)x->crl,pkey,md)\n#define NETSCAPE_SPKI_sign(x,pkey,md) \\\n\tASN1_sign((int (*)())i2d_NETSCAPE_SPKAC, x->sig_algor,NULL, \\\n\t\tx->signature, (char *)x->spkac,pkey,md)\n\n#define X509_dup(x509) (X509 *)ASN1_dup((int (*)())i2d_X509, \\\n\t\t(char *(*)())d2i_X509,(char *)x509)\n#define X509_ATTRIBUTE_dup(xa) (X509_ATTRIBUTE *)ASN1_dup(\\\n\t\t(int (*)())i2d_X509_ATTRIBUTE, \\\n\t\t(char *(*)())d2i_X509_ATTRIBUTE,(char *)xa)\n#define X509_EXTENSION_dup(ex) (X509_EXTENSION *)ASN1_dup( \\\n\t\t(int (*)())i2d_X509_EXTENSION, \\\n\t\t(char *(*)())d2i_X509_EXTENSION,(char *)ex)\n#define d2i_X509_fp(fp,x509) (X509 *)ASN1_d2i_fp((char *(*)())X509_new, \\\n\t\t(char *(*)())d2i_X509, (fp),(unsigned char **)(x509))\n#define i2d_X509_fp(fp,x509) ASN1_i2d_fp(i2d_X509,fp,(unsigned char *)x509)\n#define d2i_X509_bio(bp,x509) (X509 *)ASN1_d2i_bio((char *(*)())X509_new, \\\n\t\t(char *(*)())d2i_X509, (bp),(unsigned char **)(x509))\n#define i2d_X509_bio(bp,x509) ASN1_i2d_bio(i2d_X509,bp,(unsigned char *)x509)\n\n#define X509_CRL_dup(crl) (X509_CRL *)ASN1_dup((int (*)())i2d_X509_CRL, \\\n\t\t(char *(*)())d2i_X509_CRL,(char *)crl)\n#define d2i_X509_CRL_fp(fp,crl) (X509_CRL *)ASN1_d2i_fp((char *(*)()) \\\n\t\tX509_CRL_new,(char *(*)())d2i_X509_CRL, (fp),\\\n\t\t(unsigned char **)(crl))\n#define i2d_X509_CRL_fp(fp,crl) ASN1_i2d_fp(i2d_X509_CRL,fp,\\\n\t\t(unsigned char *)crl)\n#define d2i_X509_CRL_bio(bp,crl) (X509_CRL *)ASN1_d2i_bio((char *(*)()) \\\n\t\tX509_CRL_new,(char *(*)())d2i_X509_CRL, (bp),\\\n\t\t(unsigned char **)(crl))\n#define i2d_X509_CRL_bio(bp,crl) ASN1_i2d_bio(i2d_X509_CRL,bp,\\\n\t\t(unsigned char *)crl)\n\n#define PKCS7_dup(p7) (PKCS7 *)ASN1_dup((int (*)())i2d_PKCS7, \\\n\t\t(char *(*)())d2i_PKCS7,(char *)p7)\n#define d2i_PKCS7_fp(fp,p7) (PKCS7 *)ASN1_d2i_fp((char *(*)()) \\\n\t\tPKCS7_new,(char *(*)())d2i_PKCS7, (fp),\\\n\t\t(unsigned char **)(p7))\n#define i2d_PKCS7_fp(fp,p7) ASN1_i2d_fp(i2d_PKCS7,fp,\\\n\t\t(unsigned char *)p7)\n#define d2i_PKCS7_bio(bp,p7) (PKCS7 *)ASN1_d2i_bio((char *(*)()) \\\n\t\tPKCS7_new,(char *(*)())d2i_PKCS7, (bp),\\\n\t\t(unsigned char **)(p7))\n#define i2d_PKCS7_bio(bp,p7) ASN1_i2d_bio(i2d_PKCS7,bp,\\\n\t\t(unsigned char *)p7)\n\n#define X509_REQ_dup(req) (X509_REQ *)ASN1_dup((int (*)())i2d_X509_REQ, \\\n\t\t(char *(*)())d2i_X509_REQ,(char *)req)\n#define d2i_X509_REQ_fp(fp,req) (X509_REQ *)ASN1_d2i_fp((char *(*)())\\\n\t\tX509_REQ_new, (char *(*)())d2i_X509_REQ, (fp),\\\n\t\t(unsigned char **)(req))\n#define i2d_X509_REQ_fp(fp,req) ASN1_i2d_fp(i2d_X509_REQ,fp,\\\n\t\t(unsigned char *)req)\n#define d2i_X509_REQ_bio(bp,req) (X509_REQ *)ASN1_d2i_bio((char *(*)())\\\n\t\tX509_REQ_new, (char *(*)())d2i_X509_REQ, (bp),\\\n\t\t(unsigned char **)(req))\n#define i2d_X509_REQ_bio(bp,req) ASN1_i2d_bio(i2d_X509_REQ,bp,\\\n\t\t(unsigned char *)req)\n\n#define RSAPublicKey_dup(rsa) (RSA *)ASN1_dup((int (*)())i2d_RSAPublicKey, \\\n\t\t(char *(*)())d2i_RSAPublicKey,(char *)rsa)\n#define RSAPrivateKey_dup(rsa) (RSA *)ASN1_dup((int (*)())i2d_RSAPrivateKey, \\\n\t\t(char *(*)())d2i_RSAPrivateKey,(char *)rsa)\n\n#define d2i_RSAPrivateKey_fp(fp,rsa) (RSA *)ASN1_d2i_fp((char *(*)())\\\n\t\tRSA_new,(char *(*)())d2i_RSAPrivateKey, (fp), \\\n\t\t(unsigned char **)(rsa))\n#define i2d_RSAPrivateKey_fp(fp,rsa) ASN1_i2d_fp(i2d_RSAPrivateKey,fp, \\\n\t\t(unsigned char *)rsa)\n#define d2i_RSAPrivateKey_bio(bp,rsa) (RSA *)ASN1_d2i_bio((char *(*)())\\\n\t\tRSA_new,(char *(*)())d2i_RSAPrivateKey, (bp), \\\n\t\t(unsigned char **)(rsa))\n#define i2d_RSAPrivateKey_bio(bp,rsa) ASN1_i2d_bio(i2d_RSAPrivateKey,bp, \\\n\t\t(unsigned char *)rsa)\n\n#define d2i_RSAPublicKey_fp(fp,rsa) (RSA *)ASN1_d2i_fp((char *(*)())\\\n\t\tRSA_new,(char *(*)())d2i_RSAPublicKey, (fp), \\\n\t\t(unsigned char **)(rsa))\n#define i2d_RSAPublicKey_fp(fp,rsa) ASN1_i2d_fp(i2d_RSAPublicKey,fp, \\\n\t\t(unsigned char *)rsa)\n#define d2i_RSAPublicKey_bio(bp,rsa) (RSA *)ASN1_d2i_bio((char *(*)())\\\n\t\tRSA_new,(char *(*)())d2i_RSAPublicKey, (bp), \\\n\t\t(unsigned char **)(rsa))\n#define i2d_RSAPublicKey_bio(bp,rsa) ASN1_i2d_bio(i2d_RSAPublicKey,bp, \\\n\t\t(unsigned char *)rsa)\n\n#define d2i_DSAPrivateKey_fp(fp,dsa) (DSA *)ASN1_d2i_fp((char *(*)())\\\n\t\tDSA_new,(char *(*)())d2i_DSAPrivateKey, (fp), \\\n\t\t(unsigned char **)(dsa))\n#define i2d_DSAPrivateKey_fp(fp,dsa) ASN1_i2d_fp(i2d_DSAPrivateKey,fp, \\\n\t\t(unsigned char *)dsa)\n#define d2i_DSAPrivateKey_bio(bp,dsa) (DSA *)ASN1_d2i_bio((char *(*)())\\\n\t\tDSA_new,(char *(*)())d2i_DSAPrivateKey, (bp), \\\n\t\t(unsigned char **)(dsa))\n#define i2d_DSAPrivateKey_bio(bp,dsa) ASN1_i2d_bio(i2d_DSAPrivateKey,bp, \\\n\t\t(unsigned char *)dsa)\n\n#define d2i_ECPrivateKey_fp(fp,ecdsa) (EC_KEY *)ASN1_d2i_fp((char *(*)())\\\n\t\tEC_KEY_new,(char *(*)())d2i_ECPrivateKey, (fp), \\\n\t\t(unsigned char **)(ecdsa))\n#define i2d_ECPrivateKey_fp(fp,ecdsa) ASN1_i2d_fp(i2d_ECPrivateKey,fp, \\\n\t\t(unsigned char *)ecdsa)\n#define d2i_ECPrivateKey_bio(bp,ecdsa) (EC_KEY *)ASN1_d2i_bio((char *(*)())\\\n\t\tEC_KEY_new,(char *(*)())d2i_ECPrivateKey, (bp), \\\n\t\t(unsigned char **)(ecdsa))\n#define i2d_ECPrivateKey_bio(bp,ecdsa) ASN1_i2d_bio(i2d_ECPrivateKey,bp, \\\n\t\t(unsigned char *)ecdsa)\n\n#define X509_ALGOR_dup(xn) (X509_ALGOR *)ASN1_dup((int (*)())i2d_X509_ALGOR,\\\n\t\t(char *(*)())d2i_X509_ALGOR,(char *)xn)\n\n#define X509_NAME_dup(xn) (X509_NAME *)ASN1_dup((int (*)())i2d_X509_NAME, \\\n\t\t(char *(*)())d2i_X509_NAME,(char *)xn)\n#define X509_NAME_ENTRY_dup(ne) (X509_NAME_ENTRY *)ASN1_dup( \\\n\t\t(int (*)())i2d_X509_NAME_ENTRY, \\\n\t\t(char *(*)())d2i_X509_NAME_ENTRY,\\\n\t\t(char *)ne)\n\n#define X509_digest(data,type,md,len) \\\n\tASN1_digest((int (*)())i2d_X509,type,(char *)data,md,len)\n#define X509_NAME_digest(data,type,md,len) \\\n\tASN1_digest((int (*)())i2d_X509_NAME,type,(char *)data,md,len)\n#ifndef PKCS7_ISSUER_AND_SERIAL_digest\n#define PKCS7_ISSUER_AND_SERIAL_digest(data,type,md,len) \\\n\tASN1_digest((int (*)())i2d_PKCS7_ISSUER_AND_SERIAL,type,\\\n\t\t(char *)data,md,len)\n#endif\n#endif\n\n#define X509_EXT_PACK_UNKNOWN\t1\n#define X509_EXT_PACK_STRING\t2\n\n#define\t\tX509_get_version(x) ASN1_INTEGER_get((x)->cert_info->version)\n/* #define\tX509_get_serialNumber(x) ((x)->cert_info->serialNumber) */\n#define\t\tX509_get_notBefore(x) ((x)->cert_info->validity->notBefore)\n#define\t\tX509_get_notAfter(x) ((x)->cert_info->validity->notAfter)\n#define\t\tX509_extract_key(x)\tX509_get_pubkey(x) /*****/\n#define\t\tX509_REQ_get_version(x) ASN1_INTEGER_get((x)->req_info->version)\n#define\t\tX509_REQ_get_subject_name(x) ((x)->req_info->subject)\n#define\t\tX509_REQ_extract_key(a)\tX509_REQ_get_pubkey(a)\n#define\t\tX509_name_cmp(a,b)\tX509_NAME_cmp((a),(b))\n#define\t\tX509_get_signature_type(x) EVP_PKEY_type(OBJ_obj2nid((x)->sig_alg->algorithm))\n\n#define\t\tX509_CRL_get_version(x) ASN1_INTEGER_get((x)->crl->version)\n#define \tX509_CRL_get_lastUpdate(x) ((x)->crl->lastUpdate)\n#define \tX509_CRL_get_nextUpdate(x) ((x)->crl->nextUpdate)\n#define\t\tX509_CRL_get_issuer(x) ((x)->crl->issuer)\n#define\t\tX509_CRL_get_REVOKED(x) ((x)->crl->revoked)\n\n/* This one is only used so that a binary form can output, as in\n * i2d_X509_NAME(X509_get_X509_PUBKEY(x),&buf) */\n#define \tX509_get_X509_PUBKEY(x) ((x)->cert_info->key)\n\n\nconst char *X509_verify_cert_error_string(long n);\n\n#ifndef SSLEAY_MACROS\n#ifndef OPENSSL_NO_EVP\nint X509_verify(X509 *a, EVP_PKEY *r);\n\nint X509_REQ_verify(X509_REQ *a, EVP_PKEY *r);\nint X509_CRL_verify(X509_CRL *a, EVP_PKEY *r);\nint NETSCAPE_SPKI_verify(NETSCAPE_SPKI *a, EVP_PKEY *r);\n\nNETSCAPE_SPKI * NETSCAPE_SPKI_b64_decode(const char *str, int len);\nchar * NETSCAPE_SPKI_b64_encode(NETSCAPE_SPKI *x);\nEVP_PKEY *NETSCAPE_SPKI_get_pubkey(NETSCAPE_SPKI *x);\nint NETSCAPE_SPKI_set_pubkey(NETSCAPE_SPKI *x, EVP_PKEY *pkey);\n\nint NETSCAPE_SPKI_print(BIO *out, NETSCAPE_SPKI *spki);\n\nint X509_signature_print(BIO *bp,X509_ALGOR *alg, ASN1_STRING *sig);\n\nint X509_sign(X509 *x, EVP_PKEY *pkey, const EVP_MD *md);\nint X509_REQ_sign(X509_REQ *x, EVP_PKEY *pkey, const EVP_MD *md);\nint X509_CRL_sign(X509_CRL *x, EVP_PKEY *pkey, const EVP_MD *md);\nint NETSCAPE_SPKI_sign(NETSCAPE_SPKI *x, EVP_PKEY *pkey, const EVP_MD *md);\n\nint X509_pubkey_digest(const X509 *data,const EVP_MD *type,\n\t\tunsigned char *md, unsigned int *len);\nint X509_digest(const X509 *data,const EVP_MD *type,\n\t\tunsigned char *md, unsigned int *len);\nint X509_CRL_digest(const X509_CRL *data,const EVP_MD *type,\n\t\tunsigned char *md, unsigned int *len);\nint X509_REQ_digest(const X509_REQ *data,const EVP_MD *type,\n\t\tunsigned char *md, unsigned int *len);\nint X509_NAME_digest(const X509_NAME *data,const EVP_MD *type,\n\t\tunsigned char *md, unsigned int *len);\n#endif\n\n#ifndef OPENSSL_NO_FP_API\nX509 *d2i_X509_fp(FILE *fp, X509 **x509);\nint i2d_X509_fp(FILE *fp,X509 *x509);\nX509_CRL *d2i_X509_CRL_fp(FILE *fp,X509_CRL **crl);\nint i2d_X509_CRL_fp(FILE *fp,X509_CRL *crl);\nX509_REQ *d2i_X509_REQ_fp(FILE *fp,X509_REQ **req);\nint i2d_X509_REQ_fp(FILE *fp,X509_REQ *req);\n#ifndef OPENSSL_NO_RSA\nRSA *d2i_RSAPrivateKey_fp(FILE *fp,RSA **rsa);\nint i2d_RSAPrivateKey_fp(FILE *fp,RSA *rsa);\nRSA *d2i_RSAPublicKey_fp(FILE *fp,RSA **rsa);\nint i2d_RSAPublicKey_fp(FILE *fp,RSA *rsa);\nRSA *d2i_RSA_PUBKEY_fp(FILE *fp,RSA **rsa);\nint i2d_RSA_PUBKEY_fp(FILE *fp,RSA *rsa);\n#endif\n#ifndef OPENSSL_NO_DSA\nDSA *d2i_DSA_PUBKEY_fp(FILE *fp, DSA **dsa);\nint i2d_DSA_PUBKEY_fp(FILE *fp, DSA *dsa);\nDSA *d2i_DSAPrivateKey_fp(FILE *fp, DSA **dsa);\nint i2d_DSAPrivateKey_fp(FILE *fp, DSA *dsa);\n#endif\n#ifndef OPENSSL_NO_EC\nEC_KEY *d2i_EC_PUBKEY_fp(FILE *fp, EC_KEY **eckey);\nint   i2d_EC_PUBKEY_fp(FILE *fp, EC_KEY *eckey);\nEC_KEY *d2i_ECPrivateKey_fp(FILE *fp, EC_KEY **eckey);\nint   i2d_ECPrivateKey_fp(FILE *fp, EC_KEY *eckey);\n#endif\nX509_SIG *d2i_PKCS8_fp(FILE *fp,X509_SIG **p8);\nint i2d_PKCS8_fp(FILE *fp,X509_SIG *p8);\nPKCS8_PRIV_KEY_INFO *d2i_PKCS8_PRIV_KEY_INFO_fp(FILE *fp,\n\t\t\t\t\t\tPKCS8_PRIV_KEY_INFO **p8inf);\nint i2d_PKCS8_PRIV_KEY_INFO_fp(FILE *fp,PKCS8_PRIV_KEY_INFO *p8inf);\nint i2d_PKCS8PrivateKeyInfo_fp(FILE *fp, EVP_PKEY *key);\nint i2d_PrivateKey_fp(FILE *fp, EVP_PKEY *pkey);\nEVP_PKEY *d2i_PrivateKey_fp(FILE *fp, EVP_PKEY **a);\nint i2d_PUBKEY_fp(FILE *fp, EVP_PKEY *pkey);\nEVP_PKEY *d2i_PUBKEY_fp(FILE *fp, EVP_PKEY **a);\n#endif\n\n#ifndef OPENSSL_NO_BIO\nX509 *d2i_X509_bio(BIO *bp,X509 **x509);\nint i2d_X509_bio(BIO *bp,X509 *x509);\nX509_CRL *d2i_X509_CRL_bio(BIO *bp,X509_CRL **crl);\nint i2d_X509_CRL_bio(BIO *bp,X509_CRL *crl);\nX509_REQ *d2i_X509_REQ_bio(BIO *bp,X509_REQ **req);\nint i2d_X509_REQ_bio(BIO *bp,X509_REQ *req);\n#ifndef OPENSSL_NO_RSA\nRSA *d2i_RSAPrivateKey_bio(BIO *bp,RSA **rsa);\nint i2d_RSAPrivateKey_bio(BIO *bp,RSA *rsa);\nRSA *d2i_RSAPublicKey_bio(BIO *bp,RSA **rsa);\nint i2d_RSAPublicKey_bio(BIO *bp,RSA *rsa);\nRSA *d2i_RSA_PUBKEY_bio(BIO *bp,RSA **rsa);\nint i2d_RSA_PUBKEY_bio(BIO *bp,RSA *rsa);\n#endif\n#ifndef OPENSSL_NO_DSA\nDSA *d2i_DSA_PUBKEY_bio(BIO *bp, DSA **dsa);\nint i2d_DSA_PUBKEY_bio(BIO *bp, DSA *dsa);\nDSA *d2i_DSAPrivateKey_bio(BIO *bp, DSA **dsa);\nint i2d_DSAPrivateKey_bio(BIO *bp, DSA *dsa);\n#endif\n#ifndef OPENSSL_NO_EC\nEC_KEY *d2i_EC_PUBKEY_bio(BIO *bp, EC_KEY **eckey);\nint   i2d_EC_PUBKEY_bio(BIO *bp, EC_KEY *eckey);\nEC_KEY *d2i_ECPrivateKey_bio(BIO *bp, EC_KEY **eckey);\nint   i2d_ECPrivateKey_bio(BIO *bp, EC_KEY *eckey);\n#endif\nX509_SIG *d2i_PKCS8_bio(BIO *bp,X509_SIG **p8);\nint i2d_PKCS8_bio(BIO *bp,X509_SIG *p8);\nPKCS8_PRIV_KEY_INFO *d2i_PKCS8_PRIV_KEY_INFO_bio(BIO *bp,\n\t\t\t\t\t\tPKCS8_PRIV_KEY_INFO **p8inf);\nint i2d_PKCS8_PRIV_KEY_INFO_bio(BIO *bp,PKCS8_PRIV_KEY_INFO *p8inf);\nint i2d_PKCS8PrivateKeyInfo_bio(BIO *bp, EVP_PKEY *key);\nint i2d_PrivateKey_bio(BIO *bp, EVP_PKEY *pkey);\nEVP_PKEY *d2i_PrivateKey_bio(BIO *bp, EVP_PKEY **a);\nint i2d_PUBKEY_bio(BIO *bp, EVP_PKEY *pkey);\nEVP_PKEY *d2i_PUBKEY_bio(BIO *bp, EVP_PKEY **a);\n#endif\n\nX509 *X509_dup(X509 *x509);\nX509_ATTRIBUTE *X509_ATTRIBUTE_dup(X509_ATTRIBUTE *xa);\nX509_EXTENSION *X509_EXTENSION_dup(X509_EXTENSION *ex);\nX509_CRL *X509_CRL_dup(X509_CRL *crl);\nX509_REQ *X509_REQ_dup(X509_REQ *req);\nX509_ALGOR *X509_ALGOR_dup(X509_ALGOR *xn);\nint X509_ALGOR_set0(X509_ALGOR *alg, ASN1_OBJECT *aobj, int ptype, void *pval);\nvoid X509_ALGOR_get0(ASN1_OBJECT **paobj, int *pptype, void **ppval,\n\t\t\t\t\t\tX509_ALGOR *algor);\n\nX509_NAME *X509_NAME_dup(X509_NAME *xn);\nX509_NAME_ENTRY *X509_NAME_ENTRY_dup(X509_NAME_ENTRY *ne);\n\n#endif /* !SSLEAY_MACROS */\n\nint\t\tX509_cmp_time(ASN1_TIME *s, time_t *t);\nint\t\tX509_cmp_current_time(ASN1_TIME *s);\nASN1_TIME *\tX509_time_adj(ASN1_TIME *s, long adj, time_t *t);\nASN1_TIME *\tX509_gmtime_adj(ASN1_TIME *s, long adj);\n\nconst char *\tX509_get_default_cert_area(void );\nconst char *\tX509_get_default_cert_dir(void );\nconst char *\tX509_get_default_cert_file(void );\nconst char *\tX509_get_default_cert_dir_env(void );\nconst char *\tX509_get_default_cert_file_env(void );\nconst char *\tX509_get_default_private_dir(void );\n\nX509_REQ *\tX509_to_X509_REQ(X509 *x, EVP_PKEY *pkey, const EVP_MD *md);\nX509 *\t\tX509_REQ_to_X509(X509_REQ *r, int days,EVP_PKEY *pkey);\n\nDECLARE_ASN1_FUNCTIONS(X509_ALGOR)\nDECLARE_ASN1_ENCODE_FUNCTIONS(X509_ALGORS, X509_ALGORS, X509_ALGORS)\nDECLARE_ASN1_FUNCTIONS(X509_VAL)\n\nDECLARE_ASN1_FUNCTIONS(X509_PUBKEY)\n\nint\t\tX509_PUBKEY_set(X509_PUBKEY **x, EVP_PKEY *pkey);\nEVP_PKEY *\tX509_PUBKEY_get(X509_PUBKEY *key);\nint\t\tX509_get_pubkey_parameters(EVP_PKEY *pkey,\n\t\t\t\t\t   STACK_OF(X509) *chain);\nint\t\ti2d_PUBKEY(EVP_PKEY *a,unsigned char **pp);\nEVP_PKEY *\td2i_PUBKEY(EVP_PKEY **a,const unsigned char **pp,\n\t\t\tlong length);\n#ifndef OPENSSL_NO_RSA\nint\t\ti2d_RSA_PUBKEY(RSA *a,unsigned char **pp);\nRSA *\t\td2i_RSA_PUBKEY(RSA **a,const unsigned char **pp,\n\t\t\tlong length);\n#endif\n#ifndef OPENSSL_NO_DSA\nint\t\ti2d_DSA_PUBKEY(DSA *a,unsigned char **pp);\nDSA *\t\td2i_DSA_PUBKEY(DSA **a,const unsigned char **pp,\n\t\t\tlong length);\n#endif\n#ifndef OPENSSL_NO_EC\nint\t\ti2d_EC_PUBKEY(EC_KEY *a, unsigned char **pp);\nEC_KEY \t\t*d2i_EC_PUBKEY(EC_KEY **a, const unsigned char **pp,\n\t\t\tlong length);\n#endif\n\nDECLARE_ASN1_FUNCTIONS(X509_SIG)\nDECLARE_ASN1_FUNCTIONS(X509_REQ_INFO)\nDECLARE_ASN1_FUNCTIONS(X509_REQ)\n\nDECLARE_ASN1_FUNCTIONS(X509_ATTRIBUTE)\nX509_ATTRIBUTE *X509_ATTRIBUTE_create(int nid, int atrtype, void *value);\n\nDECLARE_ASN1_FUNCTIONS(X509_EXTENSION)\nDECLARE_ASN1_ENCODE_FUNCTIONS(X509_EXTENSIONS, X509_EXTENSIONS, X509_EXTENSIONS)\n\nDECLARE_ASN1_FUNCTIONS(X509_NAME_ENTRY)\n\nDECLARE_ASN1_FUNCTIONS(X509_NAME)\n\nint\t\tX509_NAME_set(X509_NAME **xn, X509_NAME *name);\n\nDECLARE_ASN1_FUNCTIONS(X509_CINF)\n\nDECLARE_ASN1_FUNCTIONS(X509)\nDECLARE_ASN1_FUNCTIONS(X509_CERT_AUX)\n\nDECLARE_ASN1_FUNCTIONS(X509_CERT_PAIR)\n\nint X509_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func,\n\t     CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func);\nint X509_set_ex_data(X509 *r, int idx, void *arg);\nvoid *X509_get_ex_data(X509 *r, int idx);\nint\t\ti2d_X509_AUX(X509 *a,unsigned char **pp);\nX509 *\t\td2i_X509_AUX(X509 **a,const unsigned char **pp,long length);\n\nint X509_alias_set1(X509 *x, unsigned char *name, int len);\nint X509_keyid_set1(X509 *x, unsigned char *id, int len);\nunsigned char * X509_alias_get0(X509 *x, int *len);\nunsigned char * X509_keyid_get0(X509 *x, int *len);\nint (*X509_TRUST_set_default(int (*trust)(int , X509 *, int)))(int, X509 *, int);\nint X509_TRUST_set(int *t, int trust);\nint X509_add1_trust_object(X509 *x, ASN1_OBJECT *obj);\nint X509_add1_reject_object(X509 *x, ASN1_OBJECT *obj);\nvoid X509_trust_clear(X509 *x);\nvoid X509_reject_clear(X509 *x);\n\nDECLARE_ASN1_FUNCTIONS(X509_REVOKED)\nDECLARE_ASN1_FUNCTIONS(X509_CRL_INFO)\nDECLARE_ASN1_FUNCTIONS(X509_CRL)\n\nint X509_CRL_add0_revoked(X509_CRL *crl, X509_REVOKED *rev);\n\nX509_PKEY *\tX509_PKEY_new(void );\nvoid\t\tX509_PKEY_free(X509_PKEY *a);\nint\t\ti2d_X509_PKEY(X509_PKEY *a,unsigned char **pp);\nX509_PKEY *\td2i_X509_PKEY(X509_PKEY **a,const unsigned char **pp,long length);\n\nDECLARE_ASN1_FUNCTIONS(NETSCAPE_SPKI)\nDECLARE_ASN1_FUNCTIONS(NETSCAPE_SPKAC)\nDECLARE_ASN1_FUNCTIONS(NETSCAPE_CERT_SEQUENCE)\n\n#ifndef OPENSSL_NO_EVP\nX509_INFO *\tX509_INFO_new(void);\nvoid\t\tX509_INFO_free(X509_INFO *a);\nchar *\t\tX509_NAME_oneline(X509_NAME *a,char *buf,int size);\n\nint ASN1_verify(i2d_of_void *i2d, X509_ALGOR *algor1,\n\t\tASN1_BIT_STRING *signature,char *data,EVP_PKEY *pkey);\n\nint ASN1_digest(i2d_of_void *i2d,const EVP_MD *type,char *data,\n\t\tunsigned char *md,unsigned int *len);\n\nint ASN1_sign(i2d_of_void *i2d, X509_ALGOR *algor1,\n\t      X509_ALGOR *algor2, ASN1_BIT_STRING *signature,\n\t      char *data,EVP_PKEY *pkey, const EVP_MD *type);\n\nint ASN1_item_digest(const ASN1_ITEM *it,const EVP_MD *type,void *data,\n\tunsigned char *md,unsigned int *len);\n\nint ASN1_item_verify(const ASN1_ITEM *it, X509_ALGOR *algor1,\n\tASN1_BIT_STRING *signature,void *data,EVP_PKEY *pkey);\n\nint ASN1_item_sign(const ASN1_ITEM *it, X509_ALGOR *algor1, X509_ALGOR *algor2,\n\tASN1_BIT_STRING *signature,\n\tvoid *data, EVP_PKEY *pkey, const EVP_MD *type);\n#endif\n\nint \t\tX509_set_version(X509 *x,long version);\nint \t\tX509_set_serialNumber(X509 *x, ASN1_INTEGER *serial);\nASN1_INTEGER *\tX509_get_serialNumber(X509 *x);\nint \t\tX509_set_issuer_name(X509 *x, X509_NAME *name);\nX509_NAME *\tX509_get_issuer_name(X509 *a);\nint \t\tX509_set_subject_name(X509 *x, X509_NAME *name);\nX509_NAME *\tX509_get_subject_name(X509 *a);\nint \t\tX509_set_notBefore(X509 *x, ASN1_TIME *tm);\nint \t\tX509_set_notAfter(X509 *x, ASN1_TIME *tm);\nint \t\tX509_set_pubkey(X509 *x, EVP_PKEY *pkey);\nEVP_PKEY *\tX509_get_pubkey(X509 *x);\nASN1_BIT_STRING * X509_get0_pubkey_bitstr(const X509 *x);\nint\t\tX509_certificate_type(X509 *x,EVP_PKEY *pubkey /* optional */);\n\nint\t\tX509_REQ_set_version(X509_REQ *x,long version);\nint\t\tX509_REQ_set_subject_name(X509_REQ *req,X509_NAME *name);\nint\t\tX509_REQ_set_pubkey(X509_REQ *x, EVP_PKEY *pkey);\nEVP_PKEY *\tX509_REQ_get_pubkey(X509_REQ *req);\nint\t\tX509_REQ_extension_nid(int nid);\nint *\t\tX509_REQ_get_extension_nids(void);\nvoid\t\tX509_REQ_set_extension_nids(int *nids);\nSTACK_OF(X509_EXTENSION) *X509_REQ_get_extensions(X509_REQ *req);\nint X509_REQ_add_extensions_nid(X509_REQ *req, STACK_OF(X509_EXTENSION) *exts,\n\t\t\t\tint nid);\nint X509_REQ_add_extensions(X509_REQ *req, STACK_OF(X509_EXTENSION) *exts);\nint X509_REQ_get_attr_count(const X509_REQ *req);\nint X509_REQ_get_attr_by_NID(const X509_REQ *req, int nid,\n\t\t\t  int lastpos);\nint X509_REQ_get_attr_by_OBJ(const X509_REQ *req, ASN1_OBJECT *obj,\n\t\t\t  int lastpos);\nX509_ATTRIBUTE *X509_REQ_get_attr(const X509_REQ *req, int loc);\nX509_ATTRIBUTE *X509_REQ_delete_attr(X509_REQ *req, int loc);\nint X509_REQ_add1_attr(X509_REQ *req, X509_ATTRIBUTE *attr);\nint X509_REQ_add1_attr_by_OBJ(X509_REQ *req,\n\t\t\tconst ASN1_OBJECT *obj, int type,\n\t\t\tconst unsigned char *bytes, int len);\nint X509_REQ_add1_attr_by_NID(X509_REQ *req,\n\t\t\tint nid, int type,\n\t\t\tconst unsigned char *bytes, int len);\nint X509_REQ_add1_attr_by_txt(X509_REQ *req,\n\t\t\tconst char *attrname, int type,\n\t\t\tconst unsigned char *bytes, int len);\n\nint X509_CRL_set_version(X509_CRL *x, long version);\nint X509_CRL_set_issuer_name(X509_CRL *x, X509_NAME *name);\nint X509_CRL_set_lastUpdate(X509_CRL *x, ASN1_TIME *tm);\nint X509_CRL_set_nextUpdate(X509_CRL *x, ASN1_TIME *tm);\nint X509_CRL_sort(X509_CRL *crl);\n\nint X509_REVOKED_set_serialNumber(X509_REVOKED *x, ASN1_INTEGER *serial);\nint X509_REVOKED_set_revocationDate(X509_REVOKED *r, ASN1_TIME *tm);\n\nint\t\tX509_REQ_check_private_key(X509_REQ *x509,EVP_PKEY *pkey);\n\nint\t\tX509_check_private_key(X509 *x509,EVP_PKEY *pkey);\n\nint\t\tX509_issuer_and_serial_cmp(const X509 *a, const X509 *b);\nunsigned long\tX509_issuer_and_serial_hash(X509 *a);\n\nint\t\tX509_issuer_name_cmp(const X509 *a, const X509 *b);\nunsigned long\tX509_issuer_name_hash(X509 *a);\n\nint\t\tX509_subject_name_cmp(const X509 *a, const X509 *b);\nunsigned long\tX509_subject_name_hash(X509 *x);\n\nint\t\tX509_cmp(const X509 *a, const X509 *b);\nint\t\tX509_NAME_cmp(const X509_NAME *a, const X509_NAME *b);\nunsigned long\tX509_NAME_hash(X509_NAME *x);\n\nint\t\tX509_CRL_cmp(const X509_CRL *a, const X509_CRL *b);\n#ifndef OPENSSL_NO_FP_API\nint\t\tX509_print_ex_fp(FILE *bp,X509 *x, unsigned long nmflag, unsigned long cflag);\nint\t\tX509_print_fp(FILE *bp,X509 *x);\nint\t\tX509_CRL_print_fp(FILE *bp,X509_CRL *x);\nint\t\tX509_REQ_print_fp(FILE *bp,X509_REQ *req);\nint X509_NAME_print_ex_fp(FILE *fp, X509_NAME *nm, int indent, unsigned long flags);\n#endif\n\n#ifndef OPENSSL_NO_BIO\nint\t\tX509_NAME_print(BIO *bp, X509_NAME *name, int obase);\nint X509_NAME_print_ex(BIO *out, X509_NAME *nm, int indent, unsigned long flags);\nint\t\tX509_print_ex(BIO *bp,X509 *x, unsigned long nmflag, unsigned long cflag);\nint\t\tX509_print(BIO *bp,X509 *x);\nint\t\tX509_ocspid_print(BIO *bp,X509 *x);\nint\t\tX509_CERT_AUX_print(BIO *bp,X509_CERT_AUX *x, int indent);\nint\t\tX509_CRL_print(BIO *bp,X509_CRL *x);\nint\t\tX509_REQ_print_ex(BIO *bp, X509_REQ *x, unsigned long nmflag, unsigned long cflag);\nint\t\tX509_REQ_print(BIO *bp,X509_REQ *req);\n#endif\n\nint \t\tX509_NAME_entry_count(X509_NAME *name);\nint \t\tX509_NAME_get_text_by_NID(X509_NAME *name, int nid,\n\t\t\tchar *buf,int len);\nint\t\tX509_NAME_get_text_by_OBJ(X509_NAME *name, ASN1_OBJECT *obj,\n\t\t\tchar *buf,int len);\n\n/* NOTE: you should be passsing -1, not 0 as lastpos.  The functions that use\n * lastpos, search after that position on. */\nint \t\tX509_NAME_get_index_by_NID(X509_NAME *name,int nid,int lastpos);\nint \t\tX509_NAME_get_index_by_OBJ(X509_NAME *name,ASN1_OBJECT *obj,\n\t\t\tint lastpos);\nX509_NAME_ENTRY *X509_NAME_get_entry(X509_NAME *name, int loc);\nX509_NAME_ENTRY *X509_NAME_delete_entry(X509_NAME *name, int loc);\nint \t\tX509_NAME_add_entry(X509_NAME *name,X509_NAME_ENTRY *ne,\n\t\t\tint loc, int set);\nint X509_NAME_add_entry_by_OBJ(X509_NAME *name, ASN1_OBJECT *obj, int type,\n\t\t\tunsigned char *bytes, int len, int loc, int set);\nint X509_NAME_add_entry_by_NID(X509_NAME *name, int nid, int type,\n\t\t\tunsigned char *bytes, int len, int loc, int set);\nX509_NAME_ENTRY *X509_NAME_ENTRY_create_by_txt(X509_NAME_ENTRY **ne,\n\t\tconst char *field, int type, const unsigned char *bytes, int len);\nX509_NAME_ENTRY *X509_NAME_ENTRY_create_by_NID(X509_NAME_ENTRY **ne, int nid,\n\t\t\tint type,unsigned char *bytes, int len);\nint X509_NAME_add_entry_by_txt(X509_NAME *name, const char *field, int type,\n\t\t\tconst unsigned char *bytes, int len, int loc, int set);\nX509_NAME_ENTRY *X509_NAME_ENTRY_create_by_OBJ(X509_NAME_ENTRY **ne,\n\t\t\tASN1_OBJECT *obj, int type,const unsigned char *bytes,\n\t\t\tint len);\nint \t\tX509_NAME_ENTRY_set_object(X509_NAME_ENTRY *ne,\n\t\t\tASN1_OBJECT *obj);\nint \t\tX509_NAME_ENTRY_set_data(X509_NAME_ENTRY *ne, int type,\n\t\t\tconst unsigned char *bytes, int len);\nASN1_OBJECT *\tX509_NAME_ENTRY_get_object(X509_NAME_ENTRY *ne);\nASN1_STRING *\tX509_NAME_ENTRY_get_data(X509_NAME_ENTRY *ne);\n\nint\t\tX509v3_get_ext_count(const STACK_OF(X509_EXTENSION) *x);\nint\t\tX509v3_get_ext_by_NID(const STACK_OF(X509_EXTENSION) *x,\n\t\t\t\t      int nid, int lastpos);\nint\t\tX509v3_get_ext_by_OBJ(const STACK_OF(X509_EXTENSION) *x,\n\t\t\t\t      ASN1_OBJECT *obj,int lastpos);\nint\t\tX509v3_get_ext_by_critical(const STACK_OF(X509_EXTENSION) *x,\n\t\t\t\t\t   int crit, int lastpos);\nX509_EXTENSION *X509v3_get_ext(const STACK_OF(X509_EXTENSION) *x, int loc);\nX509_EXTENSION *X509v3_delete_ext(STACK_OF(X509_EXTENSION) *x, int loc);\nSTACK_OF(X509_EXTENSION) *X509v3_add_ext(STACK_OF(X509_EXTENSION) **x,\n\t\t\t\t\t X509_EXTENSION *ex, int loc);\n\nint\t\tX509_get_ext_count(X509 *x);\nint\t\tX509_get_ext_by_NID(X509 *x, int nid, int lastpos);\nint\t\tX509_get_ext_by_OBJ(X509 *x,ASN1_OBJECT *obj,int lastpos);\nint\t\tX509_get_ext_by_critical(X509 *x, int crit, int lastpos);\nX509_EXTENSION *X509_get_ext(X509 *x, int loc);\nX509_EXTENSION *X509_delete_ext(X509 *x, int loc);\nint\t\tX509_add_ext(X509 *x, X509_EXTENSION *ex, int loc);\nvoid\t*\tX509_get_ext_d2i(X509 *x, int nid, int *crit, int *idx);\nint\t\tX509_add1_ext_i2d(X509 *x, int nid, void *value, int crit,\n\t\t\t\t\t\t\tunsigned long flags);\n\nint\t\tX509_CRL_get_ext_count(X509_CRL *x);\nint\t\tX509_CRL_get_ext_by_NID(X509_CRL *x, int nid, int lastpos);\nint\t\tX509_CRL_get_ext_by_OBJ(X509_CRL *x,ASN1_OBJECT *obj,int lastpos);\nint\t\tX509_CRL_get_ext_by_critical(X509_CRL *x, int crit, int lastpos);\nX509_EXTENSION *X509_CRL_get_ext(X509_CRL *x, int loc);\nX509_EXTENSION *X509_CRL_delete_ext(X509_CRL *x, int loc);\nint\t\tX509_CRL_add_ext(X509_CRL *x, X509_EXTENSION *ex, int loc);\nvoid\t*\tX509_CRL_get_ext_d2i(X509_CRL *x, int nid, int *crit, int *idx);\nint\t\tX509_CRL_add1_ext_i2d(X509_CRL *x, int nid, void *value, int crit,\n\t\t\t\t\t\t\tunsigned long flags);\n\nint\t\tX509_REVOKED_get_ext_count(X509_REVOKED *x);\nint\t\tX509_REVOKED_get_ext_by_NID(X509_REVOKED *x, int nid, int lastpos);\nint\t\tX509_REVOKED_get_ext_by_OBJ(X509_REVOKED *x,ASN1_OBJECT *obj,int lastpos);\nint\t\tX509_REVOKED_get_ext_by_critical(X509_REVOKED *x, int crit, int lastpos);\nX509_EXTENSION *X509_REVOKED_get_ext(X509_REVOKED *x, int loc);\nX509_EXTENSION *X509_REVOKED_delete_ext(X509_REVOKED *x, int loc);\nint\t\tX509_REVOKED_add_ext(X509_REVOKED *x, X509_EXTENSION *ex, int loc);\nvoid\t*\tX509_REVOKED_get_ext_d2i(X509_REVOKED *x, int nid, int *crit, int *idx);\nint\t\tX509_REVOKED_add1_ext_i2d(X509_REVOKED *x, int nid, void *value, int crit,\n\t\t\t\t\t\t\tunsigned long flags);\n\nX509_EXTENSION *X509_EXTENSION_create_by_NID(X509_EXTENSION **ex,\n\t\t\tint nid, int crit, ASN1_OCTET_STRING *data);\nX509_EXTENSION *X509_EXTENSION_create_by_OBJ(X509_EXTENSION **ex,\n\t\t\tASN1_OBJECT *obj,int crit,ASN1_OCTET_STRING *data);\nint\t\tX509_EXTENSION_set_object(X509_EXTENSION *ex,ASN1_OBJECT *obj);\nint\t\tX509_EXTENSION_set_critical(X509_EXTENSION *ex, int crit);\nint\t\tX509_EXTENSION_set_data(X509_EXTENSION *ex,\n\t\t\tASN1_OCTET_STRING *data);\nASN1_OBJECT *\tX509_EXTENSION_get_object(X509_EXTENSION *ex);\nASN1_OCTET_STRING *X509_EXTENSION_get_data(X509_EXTENSION *ne);\nint\t\tX509_EXTENSION_get_critical(X509_EXTENSION *ex);\n\nint X509at_get_attr_count(const STACK_OF(X509_ATTRIBUTE) *x);\nint X509at_get_attr_by_NID(const STACK_OF(X509_ATTRIBUTE) *x, int nid,\n\t\t\t  int lastpos);\nint X509at_get_attr_by_OBJ(const STACK_OF(X509_ATTRIBUTE) *sk, ASN1_OBJECT *obj,\n\t\t\t  int lastpos);\nX509_ATTRIBUTE *X509at_get_attr(const STACK_OF(X509_ATTRIBUTE) *x, int loc);\nX509_ATTRIBUTE *X509at_delete_attr(STACK_OF(X509_ATTRIBUTE) *x, int loc);\nSTACK_OF(X509_ATTRIBUTE) *X509at_add1_attr(STACK_OF(X509_ATTRIBUTE) **x,\n\t\t\t\t\t X509_ATTRIBUTE *attr);\nSTACK_OF(X509_ATTRIBUTE) *X509at_add1_attr_by_OBJ(STACK_OF(X509_ATTRIBUTE) **x,\n\t\t\tconst ASN1_OBJECT *obj, int type,\n\t\t\tconst unsigned char *bytes, int len);\nSTACK_OF(X509_ATTRIBUTE) *X509at_add1_attr_by_NID(STACK_OF(X509_ATTRIBUTE) **x,\n\t\t\tint nid, int type,\n\t\t\tconst unsigned char *bytes, int len);\nSTACK_OF(X509_ATTRIBUTE) *X509at_add1_attr_by_txt(STACK_OF(X509_ATTRIBUTE) **x,\n\t\t\tconst char *attrname, int type,\n\t\t\tconst unsigned char *bytes, int len);\nvoid *X509at_get0_data_by_OBJ(STACK_OF(X509_ATTRIBUTE) *x,\n\t\t\t\tASN1_OBJECT *obj, int lastpos, int type);\nX509_ATTRIBUTE *X509_ATTRIBUTE_create_by_NID(X509_ATTRIBUTE **attr, int nid,\n\t     int atrtype, const void *data, int len);\nX509_ATTRIBUTE *X509_ATTRIBUTE_create_by_OBJ(X509_ATTRIBUTE **attr,\n\t     const ASN1_OBJECT *obj, int atrtype, const void *data, int len);\nX509_ATTRIBUTE *X509_ATTRIBUTE_create_by_txt(X509_ATTRIBUTE **attr,\n\t\tconst char *atrname, int type, const unsigned char *bytes, int len);\nint X509_ATTRIBUTE_set1_object(X509_ATTRIBUTE *attr, const ASN1_OBJECT *obj);\nint X509_ATTRIBUTE_set1_data(X509_ATTRIBUTE *attr, int attrtype, const void *data, int len);\nvoid *X509_ATTRIBUTE_get0_data(X509_ATTRIBUTE *attr, int idx,\n\t\t\t\t\tint atrtype, void *data);\nint X509_ATTRIBUTE_count(X509_ATTRIBUTE *attr);\nASN1_OBJECT *X509_ATTRIBUTE_get0_object(X509_ATTRIBUTE *attr);\nASN1_TYPE *X509_ATTRIBUTE_get0_type(X509_ATTRIBUTE *attr, int idx);\n\nint EVP_PKEY_get_attr_count(const EVP_PKEY *key);\nint EVP_PKEY_get_attr_by_NID(const EVP_PKEY *key, int nid,\n\t\t\t  int lastpos);\nint EVP_PKEY_get_attr_by_OBJ(const EVP_PKEY *key, ASN1_OBJECT *obj,\n\t\t\t  int lastpos);\nX509_ATTRIBUTE *EVP_PKEY_get_attr(const EVP_PKEY *key, int loc);\nX509_ATTRIBUTE *EVP_PKEY_delete_attr(EVP_PKEY *key, int loc);\nint EVP_PKEY_add1_attr(EVP_PKEY *key, X509_ATTRIBUTE *attr);\nint EVP_PKEY_add1_attr_by_OBJ(EVP_PKEY *key,\n\t\t\tconst ASN1_OBJECT *obj, int type,\n\t\t\tconst unsigned char *bytes, int len);\nint EVP_PKEY_add1_attr_by_NID(EVP_PKEY *key,\n\t\t\tint nid, int type,\n\t\t\tconst unsigned char *bytes, int len);\nint EVP_PKEY_add1_attr_by_txt(EVP_PKEY *key,\n\t\t\tconst char *attrname, int type,\n\t\t\tconst unsigned char *bytes, int len);\n\nint\t\tX509_verify_cert(X509_STORE_CTX *ctx);\n\n/* lookup a cert from a X509 STACK */\nX509 *X509_find_by_issuer_and_serial(STACK_OF(X509) *sk,X509_NAME *name,\n\t\t\t\t     ASN1_INTEGER *serial);\nX509 *X509_find_by_subject(STACK_OF(X509) *sk,X509_NAME *name);\n\nDECLARE_ASN1_FUNCTIONS(PBEPARAM)\nDECLARE_ASN1_FUNCTIONS(PBE2PARAM)\nDECLARE_ASN1_FUNCTIONS(PBKDF2PARAM)\n\nX509_ALGOR *PKCS5_pbe_set(int alg, int iter, unsigned char *salt, int saltlen);\nX509_ALGOR *PKCS5_pbe2_set(const EVP_CIPHER *cipher, int iter,\n\t\t\t\t\t unsigned char *salt, int saltlen);\n\n/* PKCS#8 utilities */\n\nDECLARE_ASN1_FUNCTIONS(PKCS8_PRIV_KEY_INFO)\n\nEVP_PKEY *EVP_PKCS82PKEY(PKCS8_PRIV_KEY_INFO *p8);\nPKCS8_PRIV_KEY_INFO *EVP_PKEY2PKCS8(EVP_PKEY *pkey);\nPKCS8_PRIV_KEY_INFO *EVP_PKEY2PKCS8_broken(EVP_PKEY *pkey, int broken);\nPKCS8_PRIV_KEY_INFO *PKCS8_set_broken(PKCS8_PRIV_KEY_INFO *p8, int broken);\n\nint X509_check_trust(X509 *x, int id, int flags);\nint X509_TRUST_get_count(void);\nX509_TRUST * X509_TRUST_get0(int idx);\nint X509_TRUST_get_by_id(int id);\nint X509_TRUST_add(int id, int flags, int (*ck)(X509_TRUST *, X509 *, int),\n\t\t\t\t\tchar *name, int arg1, void *arg2);\nvoid X509_TRUST_cleanup(void);\nint X509_TRUST_get_flags(X509_TRUST *xp);\nchar *X509_TRUST_get0_name(X509_TRUST *xp);\nint X509_TRUST_get_trust(X509_TRUST *xp);\n\n/* BEGIN ERROR CODES */\n/* The following lines are auto generated by the script mkerr.pl. Any changes\n * made after this point may be overwritten when the script is next run.\n */\nvoid ERR_load_X509_strings(void);\n\n/* Error codes for the X509 functions. */\n\n/* Function codes. */\n#define X509_F_ADD_CERT_DIR\t\t\t\t 100\n#define X509_F_BY_FILE_CTRL\t\t\t\t 101\n#define X509_F_CHECK_POLICY\t\t\t\t 145\n#define X509_F_DIR_CTRL\t\t\t\t\t 102\n#define X509_F_GET_CERT_BY_SUBJECT\t\t\t 103\n#define X509_F_NETSCAPE_SPKI_B64_DECODE\t\t\t 129\n#define X509_F_NETSCAPE_SPKI_B64_ENCODE\t\t\t 130\n#define X509_F_X509AT_ADD1_ATTR\t\t\t\t 135\n#define X509_F_X509V3_ADD_EXT\t\t\t\t 104\n#define X509_F_X509_ATTRIBUTE_CREATE_BY_NID\t\t 136\n#define X509_F_X509_ATTRIBUTE_CREATE_BY_OBJ\t\t 137\n#define X509_F_X509_ATTRIBUTE_CREATE_BY_TXT\t\t 140\n#define X509_F_X509_ATTRIBUTE_GET0_DATA\t\t\t 139\n#define X509_F_X509_ATTRIBUTE_SET1_DATA\t\t\t 138\n#define X509_F_X509_CHECK_PRIVATE_KEY\t\t\t 128\n#define X509_F_X509_CRL_PRINT_FP\t\t\t 147\n#define X509_F_X509_EXTENSION_CREATE_BY_NID\t\t 108\n#define X509_F_X509_EXTENSION_CREATE_BY_OBJ\t\t 109\n#define X509_F_X509_GET_PUBKEY_PARAMETERS\t\t 110\n#define X509_F_X509_LOAD_CERT_CRL_FILE\t\t\t 132\n#define X509_F_X509_LOAD_CERT_FILE\t\t\t 111\n#define X509_F_X509_LOAD_CRL_FILE\t\t\t 112\n#define X509_F_X509_NAME_ADD_ENTRY\t\t\t 113\n#define X509_F_X509_NAME_ENTRY_CREATE_BY_NID\t\t 114\n#define X509_F_X509_NAME_ENTRY_CREATE_BY_TXT\t\t 131\n#define X509_F_X509_NAME_ENTRY_SET_OBJECT\t\t 115\n#define X509_F_X509_NAME_ONELINE\t\t\t 116\n#define X509_F_X509_NAME_PRINT\t\t\t\t 117\n#define X509_F_X509_PRINT_EX_FP\t\t\t\t 118\n#define X509_F_X509_PUBKEY_GET\t\t\t\t 119\n#define X509_F_X509_PUBKEY_SET\t\t\t\t 120\n#define X509_F_X509_REQ_CHECK_PRIVATE_KEY\t\t 144\n#define X509_F_X509_REQ_PRINT_EX\t\t\t 121\n#define X509_F_X509_REQ_PRINT_FP\t\t\t 122\n#define X509_F_X509_REQ_TO_X509\t\t\t\t 123\n#define X509_F_X509_STORE_ADD_CERT\t\t\t 124\n#define X509_F_X509_STORE_ADD_CRL\t\t\t 125\n#define X509_F_X509_STORE_CTX_GET1_ISSUER\t\t 146\n#define X509_F_X509_STORE_CTX_INIT\t\t\t 143\n#define X509_F_X509_STORE_CTX_NEW\t\t\t 142\n#define X509_F_X509_STORE_CTX_PURPOSE_INHERIT\t\t 134\n#define X509_F_X509_TO_X509_REQ\t\t\t\t 126\n#define X509_F_X509_TRUST_ADD\t\t\t\t 133\n#define X509_F_X509_TRUST_SET\t\t\t\t 141\n#define X509_F_X509_VERIFY_CERT\t\t\t\t 127\n\n/* Reason codes. */\n#define X509_R_BAD_X509_FILETYPE\t\t\t 100\n#define X509_R_BASE64_DECODE_ERROR\t\t\t 118\n#define X509_R_CANT_CHECK_DH_KEY\t\t\t 114\n#define X509_R_CERT_ALREADY_IN_HASH_TABLE\t\t 101\n#define X509_R_ERR_ASN1_LIB\t\t\t\t 102\n#define X509_R_INVALID_DIRECTORY\t\t\t 113\n#define X509_R_INVALID_FIELD_NAME\t\t\t 119\n#define X509_R_INVALID_TRUST\t\t\t\t 123\n#define X509_R_KEY_TYPE_MISMATCH\t\t\t 115\n#define X509_R_KEY_VALUES_MISMATCH\t\t\t 116\n#define X509_R_LOADING_CERT_DIR\t\t\t\t 103\n#define X509_R_LOADING_DEFAULTS\t\t\t\t 104\n#define X509_R_NO_CERT_SET_FOR_US_TO_VERIFY\t\t 105\n#define X509_R_SHOULD_RETRY\t\t\t\t 106\n#define X509_R_UNABLE_TO_FIND_PARAMETERS_IN_CHAIN\t 107\n#define X509_R_UNABLE_TO_GET_CERTS_PUBLIC_KEY\t\t 108\n#define X509_R_UNKNOWN_KEY_TYPE\t\t\t\t 117\n#define X509_R_UNKNOWN_NID\t\t\t\t 109\n#define X509_R_UNKNOWN_PURPOSE_ID\t\t\t 121\n#define X509_R_UNKNOWN_TRUST_ID\t\t\t\t 120\n#define X509_R_UNSUPPORTED_ALGORITHM\t\t\t 111\n#define X509_R_WRONG_LOOKUP_TYPE\t\t\t 112\n#define X509_R_WRONG_TYPE\t\t\t\t 122\n\n#ifdef  __cplusplus\n}\n#endif\n#endif\n"
  },
  {
    "path": "freebsd-headers/openssl/x509_vfy.h",
    "content": "/* crypto/x509/x509_vfy.h */\n/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)\n * All rights reserved.\n *\n * This package is an SSL implementation written\n * by Eric Young (eay@cryptsoft.com).\n * The implementation was written so as to conform with Netscapes SSL.\n * \n * This library is free for commercial and non-commercial use as long as\n * the following conditions are aheared to.  The following conditions\n * apply to all code found in this distribution, be it the RC4, RSA,\n * lhash, DES, etc., code; not just the SSL code.  The SSL documentation\n * included with this distribution is covered by the same copyright terms\n * except that the holder is Tim Hudson (tjh@cryptsoft.com).\n * \n * Copyright remains Eric Young's, and as such any Copyright notices in\n * the code are not to be removed.\n * If this package is used in a product, Eric Young should be given attribution\n * as the author of the parts of the library used.\n * This can be in the form of a textual message at program startup or\n * in documentation (online or textual) provided with the package.\n * \n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. All advertising materials mentioning features or use of this software\n *    must display the following acknowledgement:\n *    \"This product includes cryptographic software written by\n *     Eric Young (eay@cryptsoft.com)\"\n *    The word 'cryptographic' can be left out if the rouines from the library\n *    being used are not cryptographic related :-).\n * 4. If you include any Windows specific code (or a derivative thereof) from \n *    the apps directory (application code) you must include an acknowledgement:\n *    \"This product includes software written by Tim Hudson (tjh@cryptsoft.com)\"\n * \n * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n * \n * The licence and distribution terms for any publically available version or\n * derivative of this code cannot be changed.  i.e. this code cannot simply be\n * copied and put under another distribution licence\n * [including the GNU Public Licence.]\n */\n\n#ifndef HEADER_X509_H\n#include <openssl/x509.h>\n/* openssl/x509.h ends up #include-ing this file at about the only\n * appropriate moment. */\n#endif\n\n#ifndef HEADER_X509_VFY_H\n#define HEADER_X509_VFY_H\n\n#include <openssl/opensslconf.h>\n#ifndef OPENSSL_NO_LHASH\n#include <openssl/lhash.h>\n#endif\n#include <openssl/bio.h>\n#include <openssl/crypto.h>\n#include <openssl/symhacks.h>\n\n#ifdef  __cplusplus\nextern \"C\" {\n#endif\n\n/* Outer object */\ntypedef struct x509_hash_dir_st\n\t{\n\tint num_dirs;\n\tchar **dirs;\n\tint *dirs_type;\n\tint num_dirs_alloced;\n\t} X509_HASH_DIR_CTX;\n\ntypedef struct x509_file_st\n\t{\n\tint num_paths;\t/* number of paths to files or directories */\n\tint num_alloced;\n\tchar **paths;\t/* the list of paths or directories */\n\tint *path_type;\n\t} X509_CERT_FILE_CTX;\n\n/*******************************/\n/*\nSSL_CTX -> X509_STORE    \n\t\t-> X509_LOOKUP\n\t\t\t->X509_LOOKUP_METHOD\n\t\t-> X509_LOOKUP\n\t\t\t->X509_LOOKUP_METHOD\n \nSSL\t-> X509_STORE_CTX\n\t\t->X509_STORE    \n\nThe X509_STORE holds the tables etc for verification stuff.\nA X509_STORE_CTX is used while validating a single certificate.\nThe X509_STORE has X509_LOOKUPs for looking up certs.\nThe X509_STORE then calls a function to actually verify the\ncertificate chain.\n*/\n\n#define X509_LU_RETRY\t\t-1\n#define X509_LU_FAIL\t\t0\n#define X509_LU_X509\t\t1\n#define X509_LU_CRL\t\t2\n#define X509_LU_PKEY\t\t3\n\ntypedef struct x509_object_st\n\t{\n\t/* one of the above types */\n\tint type;\n\tunion\t{\n\t\tchar *ptr;\n\t\tX509 *x509;\n\t\tX509_CRL *crl;\n\t\tEVP_PKEY *pkey;\n\t\t} data;\n\t} X509_OBJECT;\n\ntypedef struct x509_lookup_st X509_LOOKUP;\n\nDECLARE_STACK_OF(X509_LOOKUP)\nDECLARE_STACK_OF(X509_OBJECT)\n\n/* This is a static that defines the function interface */\ntypedef struct x509_lookup_method_st\n\t{\n\tconst char *name;\n\tint (*new_item)(X509_LOOKUP *ctx);\n\tvoid (*free)(X509_LOOKUP *ctx);\n\tint (*init)(X509_LOOKUP *ctx);\n\tint (*shutdown)(X509_LOOKUP *ctx);\n\tint (*ctrl)(X509_LOOKUP *ctx,int cmd,const char *argc,long argl,\n\t\t\tchar **ret);\n\tint (*get_by_subject)(X509_LOOKUP *ctx,int type,X509_NAME *name,\n\t\t\t      X509_OBJECT *ret);\n\tint (*get_by_issuer_serial)(X509_LOOKUP *ctx,int type,X509_NAME *name,\n\t\t\t\t    ASN1_INTEGER *serial,X509_OBJECT *ret);\n\tint (*get_by_fingerprint)(X509_LOOKUP *ctx,int type,\n\t\t\t\t  unsigned char *bytes,int len,\n\t\t\t\t  X509_OBJECT *ret);\n\tint (*get_by_alias)(X509_LOOKUP *ctx,int type,char *str,int len,\n\t\t\t    X509_OBJECT *ret);\n\t} X509_LOOKUP_METHOD;\n\n/* This structure hold all parameters associated with a verify operation\n * by including an X509_VERIFY_PARAM structure in related structures the\n * parameters used can be customized\n */\n\ntypedef struct X509_VERIFY_PARAM_st\n\t{\n\tchar *name;\n\ttime_t check_time;\t/* Time to use */\n\tunsigned long inh_flags; /* Inheritance flags */\n\tunsigned long flags;\t/* Various verify flags */\n\tint purpose;\t\t/* purpose to check untrusted certificates */\n\tint trust;\t\t/* trust setting to check */\n\tint depth;\t\t/* Verify depth */\n\tSTACK_OF(ASN1_OBJECT) *policies;\t/* Permissible policies */\n\t} X509_VERIFY_PARAM;\n\nDECLARE_STACK_OF(X509_VERIFY_PARAM)\n\n/* This is used to hold everything.  It is used for all certificate\n * validation.  Once we have a certificate chain, the 'verify'\n * function is then called to actually check the cert chain. */\nstruct x509_store_st\n\t{\n\t/* The following is a cache of trusted certs */\n\tint cache; \t/* if true, stash any hits */\n\tSTACK_OF(X509_OBJECT) *objs;\t/* Cache of all objects */\n\n\t/* These are external lookup methods */\n\tSTACK_OF(X509_LOOKUP) *get_cert_methods;\n\n\tX509_VERIFY_PARAM *param;\n\n\t/* Callbacks for various operations */\n\tint (*verify)(X509_STORE_CTX *ctx);\t/* called to verify a certificate */\n\tint (*verify_cb)(int ok,X509_STORE_CTX *ctx);\t/* error callback */\n\tint (*get_issuer)(X509 **issuer, X509_STORE_CTX *ctx, X509 *x);\t/* get issuers cert from ctx */\n\tint (*check_issued)(X509_STORE_CTX *ctx, X509 *x, X509 *issuer); /* check issued */\n\tint (*check_revocation)(X509_STORE_CTX *ctx); /* Check revocation status of chain */\n\tint (*get_crl)(X509_STORE_CTX *ctx, X509_CRL **crl, X509 *x); /* retrieve CRL */\n\tint (*check_crl)(X509_STORE_CTX *ctx, X509_CRL *crl); /* Check CRL validity */\n\tint (*cert_crl)(X509_STORE_CTX *ctx, X509_CRL *crl, X509 *x); /* Check certificate against CRL */\n\tint (*cleanup)(X509_STORE_CTX *ctx);\n\n\tCRYPTO_EX_DATA ex_data;\n\tint references;\n\t} /* X509_STORE */;\n\nint X509_STORE_set_depth(X509_STORE *store, int depth);\n\n#define X509_STORE_set_verify_cb_func(ctx,func) ((ctx)->verify_cb=(func))\n#define X509_STORE_set_verify_func(ctx,func)\t((ctx)->verify=(func))\n\n/* This is the functions plus an instance of the local variables. */\nstruct x509_lookup_st\n\t{\n\tint init;\t\t\t/* have we been started */\n\tint skip;\t\t\t/* don't use us. */\n\tX509_LOOKUP_METHOD *method;\t/* the functions */\n\tchar *method_data;\t\t/* method data */\n\n\tX509_STORE *store_ctx;\t/* who owns us */\n\t} /* X509_LOOKUP */;\n\n/* This is a used when verifying cert chains.  Since the\n * gathering of the cert chain can take some time (and have to be\n * 'retried', this needs to be kept and passed around. */\nstruct x509_store_ctx_st      /* X509_STORE_CTX */\n\t{\n\tX509_STORE *ctx;\n\tint current_method;\t/* used when looking up certs */\n\n\t/* The following are set by the caller */\n\tX509 *cert;\t\t/* The cert to check */\n\tSTACK_OF(X509) *untrusted;\t/* chain of X509s - untrusted - passed in */\n\tSTACK_OF(X509_CRL) *crls;\t/* set of CRLs passed in */\n\n\tX509_VERIFY_PARAM *param;\n\tvoid *other_ctx;\t/* Other info for use with get_issuer() */\n\n\t/* Callbacks for various operations */\n\tint (*verify)(X509_STORE_CTX *ctx);\t/* called to verify a certificate */\n\tint (*verify_cb)(int ok,X509_STORE_CTX *ctx);\t\t/* error callback */\n\tint (*get_issuer)(X509 **issuer, X509_STORE_CTX *ctx, X509 *x);\t/* get issuers cert from ctx */\n\tint (*check_issued)(X509_STORE_CTX *ctx, X509 *x, X509 *issuer); /* check issued */\n\tint (*check_revocation)(X509_STORE_CTX *ctx); /* Check revocation status of chain */\n\tint (*get_crl)(X509_STORE_CTX *ctx, X509_CRL **crl, X509 *x); /* retrieve CRL */\n\tint (*check_crl)(X509_STORE_CTX *ctx, X509_CRL *crl); /* Check CRL validity */\n\tint (*cert_crl)(X509_STORE_CTX *ctx, X509_CRL *crl, X509 *x); /* Check certificate against CRL */\n\tint (*check_policy)(X509_STORE_CTX *ctx);\n\tint (*cleanup)(X509_STORE_CTX *ctx);\n\n\t/* The following is built up */\n\tint valid;\t\t/* if 0, rebuild chain */\n\tint last_untrusted;\t/* index of last untrusted cert */\n\tSTACK_OF(X509) *chain; \t\t/* chain of X509s - built up and trusted */\n\tX509_POLICY_TREE *tree;\t/* Valid policy tree */\n\n\tint explicit_policy;\t/* Require explicit policy value */\n\n\t/* When something goes wrong, this is why */\n\tint error_depth;\n\tint error;\n\tX509 *current_cert;\n\tX509 *current_issuer;\t/* cert currently being tested as valid issuer */\n\tX509_CRL *current_crl;\t/* current CRL */\n\n\tCRYPTO_EX_DATA ex_data;\n\t} /* X509_STORE_CTX */;\n\nvoid X509_STORE_CTX_set_depth(X509_STORE_CTX *ctx, int depth);\n\n#define X509_STORE_CTX_set_app_data(ctx,data) \\\n\tX509_STORE_CTX_set_ex_data(ctx,0,data)\n#define X509_STORE_CTX_get_app_data(ctx) \\\n\tX509_STORE_CTX_get_ex_data(ctx,0)\n\n#define X509_L_FILE_LOAD\t1\n#define X509_L_ADD_DIR\t\t2\n\n#define X509_LOOKUP_load_file(x,name,type) \\\n\t\tX509_LOOKUP_ctrl((x),X509_L_FILE_LOAD,(name),(long)(type),NULL)\n\n#define X509_LOOKUP_add_dir(x,name,type) \\\n\t\tX509_LOOKUP_ctrl((x),X509_L_ADD_DIR,(name),(long)(type),NULL)\n\n#define\t\tX509_V_OK\t\t\t\t\t0\n/* illegal error (for uninitialized values, to avoid X509_V_OK): 1 */\n\n#define\t\tX509_V_ERR_UNABLE_TO_GET_ISSUER_CERT\t\t2\n#define\t\tX509_V_ERR_UNABLE_TO_GET_CRL\t\t\t3\n#define\t\tX509_V_ERR_UNABLE_TO_DECRYPT_CERT_SIGNATURE\t4\n#define\t\tX509_V_ERR_UNABLE_TO_DECRYPT_CRL_SIGNATURE\t5\n#define\t\tX509_V_ERR_UNABLE_TO_DECODE_ISSUER_PUBLIC_KEY\t6\n#define\t\tX509_V_ERR_CERT_SIGNATURE_FAILURE\t\t7\n#define\t\tX509_V_ERR_CRL_SIGNATURE_FAILURE\t\t8\n#define\t\tX509_V_ERR_CERT_NOT_YET_VALID\t\t\t9\n#define\t\tX509_V_ERR_CERT_HAS_EXPIRED\t\t\t10\n#define\t\tX509_V_ERR_CRL_NOT_YET_VALID\t\t\t11\n#define\t\tX509_V_ERR_CRL_HAS_EXPIRED\t\t\t12\n#define\t\tX509_V_ERR_ERROR_IN_CERT_NOT_BEFORE_FIELD\t13\n#define\t\tX509_V_ERR_ERROR_IN_CERT_NOT_AFTER_FIELD\t14\n#define\t\tX509_V_ERR_ERROR_IN_CRL_LAST_UPDATE_FIELD\t15\n#define\t\tX509_V_ERR_ERROR_IN_CRL_NEXT_UPDATE_FIELD\t16\n#define\t\tX509_V_ERR_OUT_OF_MEM\t\t\t\t17\n#define\t\tX509_V_ERR_DEPTH_ZERO_SELF_SIGNED_CERT\t\t18\n#define\t\tX509_V_ERR_SELF_SIGNED_CERT_IN_CHAIN\t\t19\n#define\t\tX509_V_ERR_UNABLE_TO_GET_ISSUER_CERT_LOCALLY\t20\n#define\t\tX509_V_ERR_UNABLE_TO_VERIFY_LEAF_SIGNATURE\t21\n#define\t\tX509_V_ERR_CERT_CHAIN_TOO_LONG\t\t\t22\n#define\t\tX509_V_ERR_CERT_REVOKED\t\t\t\t23\n#define\t\tX509_V_ERR_INVALID_CA\t\t\t\t24\n#define\t\tX509_V_ERR_PATH_LENGTH_EXCEEDED\t\t\t25\n#define\t\tX509_V_ERR_INVALID_PURPOSE\t\t\t26\n#define\t\tX509_V_ERR_CERT_UNTRUSTED\t\t\t27\n#define\t\tX509_V_ERR_CERT_REJECTED\t\t\t28\n/* These are 'informational' when looking for issuer cert */\n#define\t\tX509_V_ERR_SUBJECT_ISSUER_MISMATCH\t\t29\n#define\t\tX509_V_ERR_AKID_SKID_MISMATCH\t\t\t30\n#define\t\tX509_V_ERR_AKID_ISSUER_SERIAL_MISMATCH\t\t31\n#define\t\tX509_V_ERR_KEYUSAGE_NO_CERTSIGN\t\t\t32\n\n#define\t\tX509_V_ERR_UNABLE_TO_GET_CRL_ISSUER\t\t33\n#define\t\tX509_V_ERR_UNHANDLED_CRITICAL_EXTENSION\t\t34\n#define\t\tX509_V_ERR_KEYUSAGE_NO_CRL_SIGN\t\t\t35\n#define\t\tX509_V_ERR_UNHANDLED_CRITICAL_CRL_EXTENSION\t36\n#define\t\tX509_V_ERR_INVALID_NON_CA\t\t\t37\n#define\t\tX509_V_ERR_PROXY_PATH_LENGTH_EXCEEDED\t\t38\n#define\t\tX509_V_ERR_KEYUSAGE_NO_DIGITAL_SIGNATURE\t39\n#define\t\tX509_V_ERR_PROXY_CERTIFICATES_NOT_ALLOWED\t40\n\n#define\t\tX509_V_ERR_INVALID_EXTENSION\t\t\t41\n#define\t\tX509_V_ERR_INVALID_POLICY_EXTENSION\t\t42\n#define\t\tX509_V_ERR_NO_EXPLICIT_POLICY\t\t\t43\n\n#define\t\tX509_V_ERR_UNNESTED_RESOURCE\t\t\t44\n\n/* The application is not happy */\n#define\t\tX509_V_ERR_APPLICATION_VERIFICATION\t\t50\n\n/* Certificate verify flags */\n\n/* Send issuer+subject checks to verify_cb */\n#define\tX509_V_FLAG_CB_ISSUER_CHECK\t\t0x1\n/* Use check time instead of current time */\n#define\tX509_V_FLAG_USE_CHECK_TIME\t\t0x2\n/* Lookup CRLs */\n#define\tX509_V_FLAG_CRL_CHECK\t\t\t0x4\n/* Lookup CRLs for whole chain */\n#define\tX509_V_FLAG_CRL_CHECK_ALL\t\t0x8\n/* Ignore unhandled critical extensions */\n#define\tX509_V_FLAG_IGNORE_CRITICAL\t\t0x10\n/* Disable workarounds for broken certificates */\n#define\tX509_V_FLAG_X509_STRICT\t\t\t0x20\n/* Enable proxy certificate validation */\n#define\tX509_V_FLAG_ALLOW_PROXY_CERTS\t\t0x40\n/* Enable policy checking */\n#define X509_V_FLAG_POLICY_CHECK\t\t0x80\n/* Policy variable require-explicit-policy */\n#define X509_V_FLAG_EXPLICIT_POLICY\t\t0x100\n/* Policy variable inhibit-any-policy */\n#define\tX509_V_FLAG_INHIBIT_ANY\t\t\t0x200\n/* Policy variable inhibit-policy-mapping */\n#define X509_V_FLAG_INHIBIT_MAP\t\t\t0x400\n/* Notify callback that policy is OK */\n#define X509_V_FLAG_NOTIFY_POLICY\t\t0x800\n\n/* Check selfsigned CA signature */\n#define X509_V_FLAG_CHECK_SS_SIGNATURE\t\t0x4000\n\n#define X509_VP_FLAG_DEFAULT\t\t\t0x1\n#define X509_VP_FLAG_OVERWRITE\t\t\t0x2\n#define X509_VP_FLAG_RESET_FLAGS\t\t0x4\n#define X509_VP_FLAG_LOCKED\t\t\t0x8\n#define X509_VP_FLAG_ONCE\t\t\t0x10\n\n/* Internal use: mask of policy related options */\n#define X509_V_FLAG_POLICY_MASK (X509_V_FLAG_POLICY_CHECK \\\n\t\t\t\t| X509_V_FLAG_EXPLICIT_POLICY \\\n\t\t\t\t| X509_V_FLAG_INHIBIT_ANY \\\n\t\t\t\t| X509_V_FLAG_INHIBIT_MAP)\n\nint X509_OBJECT_idx_by_subject(STACK_OF(X509_OBJECT) *h, int type,\n\t     X509_NAME *name);\nX509_OBJECT *X509_OBJECT_retrieve_by_subject(STACK_OF(X509_OBJECT) *h,int type,X509_NAME *name);\nX509_OBJECT *X509_OBJECT_retrieve_match(STACK_OF(X509_OBJECT) *h, X509_OBJECT *x);\nvoid X509_OBJECT_up_ref_count(X509_OBJECT *a);\nvoid X509_OBJECT_free_contents(X509_OBJECT *a);\nX509_STORE *X509_STORE_new(void );\nvoid X509_STORE_free(X509_STORE *v);\n\nint X509_STORE_set_flags(X509_STORE *ctx, unsigned long flags);\nint X509_STORE_set_purpose(X509_STORE *ctx, int purpose);\nint X509_STORE_set_trust(X509_STORE *ctx, int trust);\nint X509_STORE_set1_param(X509_STORE *ctx, X509_VERIFY_PARAM *pm);\n\nX509_STORE_CTX *X509_STORE_CTX_new(void);\n\nint X509_STORE_CTX_get1_issuer(X509 **issuer, X509_STORE_CTX *ctx, X509 *x);\n\nvoid X509_STORE_CTX_free(X509_STORE_CTX *ctx);\nint X509_STORE_CTX_init(X509_STORE_CTX *ctx, X509_STORE *store,\n\t\t\t X509 *x509, STACK_OF(X509) *chain);\nvoid X509_STORE_CTX_trusted_stack(X509_STORE_CTX *ctx, STACK_OF(X509) *sk);\nvoid X509_STORE_CTX_cleanup(X509_STORE_CTX *ctx);\n\nX509_LOOKUP *X509_STORE_add_lookup(X509_STORE *v, X509_LOOKUP_METHOD *m);\n\nX509_LOOKUP_METHOD *X509_LOOKUP_hash_dir(void);\nX509_LOOKUP_METHOD *X509_LOOKUP_file(void);\n\nint X509_STORE_add_cert(X509_STORE *ctx, X509 *x);\nint X509_STORE_add_crl(X509_STORE *ctx, X509_CRL *x);\n\nint X509_STORE_get_by_subject(X509_STORE_CTX *vs,int type,X509_NAME *name,\n\tX509_OBJECT *ret);\n\nint X509_LOOKUP_ctrl(X509_LOOKUP *ctx, int cmd, const char *argc,\n\tlong argl, char **ret);\n\n#ifndef OPENSSL_NO_STDIO\nint X509_load_cert_file(X509_LOOKUP *ctx, const char *file, int type);\nint X509_load_crl_file(X509_LOOKUP *ctx, const char *file, int type);\nint X509_load_cert_crl_file(X509_LOOKUP *ctx, const char *file, int type);\n#endif\n\n\nX509_LOOKUP *X509_LOOKUP_new(X509_LOOKUP_METHOD *method);\nvoid X509_LOOKUP_free(X509_LOOKUP *ctx);\nint X509_LOOKUP_init(X509_LOOKUP *ctx);\nint X509_LOOKUP_by_subject(X509_LOOKUP *ctx, int type, X509_NAME *name,\n\tX509_OBJECT *ret);\nint X509_LOOKUP_by_issuer_serial(X509_LOOKUP *ctx, int type, X509_NAME *name,\n\tASN1_INTEGER *serial, X509_OBJECT *ret);\nint X509_LOOKUP_by_fingerprint(X509_LOOKUP *ctx, int type,\n\tunsigned char *bytes, int len, X509_OBJECT *ret);\nint X509_LOOKUP_by_alias(X509_LOOKUP *ctx, int type, char *str,\n\tint len, X509_OBJECT *ret);\nint X509_LOOKUP_shutdown(X509_LOOKUP *ctx);\n\n#ifndef OPENSSL_NO_STDIO\nint\tX509_STORE_load_locations (X509_STORE *ctx,\n\t\tconst char *file, const char *dir);\nint\tX509_STORE_set_default_paths(X509_STORE *ctx);\n#endif\n\nint X509_STORE_CTX_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func,\n\tCRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func);\nint\tX509_STORE_CTX_set_ex_data(X509_STORE_CTX *ctx,int idx,void *data);\nvoid *\tX509_STORE_CTX_get_ex_data(X509_STORE_CTX *ctx,int idx);\nint\tX509_STORE_CTX_get_error(X509_STORE_CTX *ctx);\nvoid\tX509_STORE_CTX_set_error(X509_STORE_CTX *ctx,int s);\nint\tX509_STORE_CTX_get_error_depth(X509_STORE_CTX *ctx);\nX509 *\tX509_STORE_CTX_get_current_cert(X509_STORE_CTX *ctx);\nSTACK_OF(X509) *X509_STORE_CTX_get_chain(X509_STORE_CTX *ctx);\nSTACK_OF(X509) *X509_STORE_CTX_get1_chain(X509_STORE_CTX *ctx);\nvoid\tX509_STORE_CTX_set_cert(X509_STORE_CTX *c,X509 *x);\nvoid\tX509_STORE_CTX_set_chain(X509_STORE_CTX *c,STACK_OF(X509) *sk);\nvoid\tX509_STORE_CTX_set0_crls(X509_STORE_CTX *c,STACK_OF(X509_CRL) *sk);\nint X509_STORE_CTX_set_purpose(X509_STORE_CTX *ctx, int purpose);\nint X509_STORE_CTX_set_trust(X509_STORE_CTX *ctx, int trust);\nint X509_STORE_CTX_purpose_inherit(X509_STORE_CTX *ctx, int def_purpose,\n\t\t\t\tint purpose, int trust);\nvoid X509_STORE_CTX_set_flags(X509_STORE_CTX *ctx, unsigned long flags);\nvoid X509_STORE_CTX_set_time(X509_STORE_CTX *ctx, unsigned long flags,\n\t\t\t\t\t\t\t\ttime_t t);\nvoid X509_STORE_CTX_set_verify_cb(X509_STORE_CTX *ctx,\n\t\t\t\t  int (*verify_cb)(int, X509_STORE_CTX *));\n  \nX509_POLICY_TREE *X509_STORE_CTX_get0_policy_tree(X509_STORE_CTX *ctx);\nint X509_STORE_CTX_get_explicit_policy(X509_STORE_CTX *ctx);\n\nX509_VERIFY_PARAM *X509_STORE_CTX_get0_param(X509_STORE_CTX *ctx);\nvoid X509_STORE_CTX_set0_param(X509_STORE_CTX *ctx, X509_VERIFY_PARAM *param);\nint X509_STORE_CTX_set_default(X509_STORE_CTX *ctx, const char *name);\n\n/* X509_VERIFY_PARAM functions */\n\nX509_VERIFY_PARAM *X509_VERIFY_PARAM_new(void);\nvoid X509_VERIFY_PARAM_free(X509_VERIFY_PARAM *param);\nint X509_VERIFY_PARAM_inherit(X509_VERIFY_PARAM *to,\n\t\t\t\t\t\tconst X509_VERIFY_PARAM *from);\nint X509_VERIFY_PARAM_set1(X509_VERIFY_PARAM *to, \n\t\t\t\t\t\tconst X509_VERIFY_PARAM *from);\nint X509_VERIFY_PARAM_set1_name(X509_VERIFY_PARAM *param, const char *name);\nint X509_VERIFY_PARAM_set_flags(X509_VERIFY_PARAM *param, unsigned long flags);\nint X509_VERIFY_PARAM_clear_flags(X509_VERIFY_PARAM *param,\n\t\t\t\t\t\t\tunsigned long flags);\nunsigned long X509_VERIFY_PARAM_get_flags(X509_VERIFY_PARAM *param);\nint X509_VERIFY_PARAM_set_purpose(X509_VERIFY_PARAM *param, int purpose);\nint X509_VERIFY_PARAM_set_trust(X509_VERIFY_PARAM *param, int trust);\nvoid X509_VERIFY_PARAM_set_depth(X509_VERIFY_PARAM *param, int depth);\nvoid X509_VERIFY_PARAM_set_time(X509_VERIFY_PARAM *param, time_t t);\nint X509_VERIFY_PARAM_add0_policy(X509_VERIFY_PARAM *param,\n\t\t\t\t\t\tASN1_OBJECT *policy);\nint X509_VERIFY_PARAM_set1_policies(X509_VERIFY_PARAM *param, \n\t\t\t\t\tSTACK_OF(ASN1_OBJECT) *policies);\nint X509_VERIFY_PARAM_get_depth(const X509_VERIFY_PARAM *param);\n\nint X509_VERIFY_PARAM_add0_table(X509_VERIFY_PARAM *param);\nconst X509_VERIFY_PARAM *X509_VERIFY_PARAM_lookup(const char *name);\nvoid X509_VERIFY_PARAM_table_cleanup(void);\n\nint X509_policy_check(X509_POLICY_TREE **ptree, int *pexplicit_policy,\n\t\t\tSTACK_OF(X509) *certs,\n\t\t\tSTACK_OF(ASN1_OBJECT) *policy_oids,\n\t\t\tunsigned int flags);\n\nvoid X509_policy_tree_free(X509_POLICY_TREE *tree);\n\nint X509_policy_tree_level_count(const X509_POLICY_TREE *tree);\nX509_POLICY_LEVEL *\n\tX509_policy_tree_get0_level(const X509_POLICY_TREE *tree, int i);\n\nSTACK_OF(X509_POLICY_NODE) *\n\tX509_policy_tree_get0_policies(const X509_POLICY_TREE *tree);\n\nSTACK_OF(X509_POLICY_NODE) *\n\tX509_policy_tree_get0_user_policies(const X509_POLICY_TREE *tree);\n\nint X509_policy_level_node_count(X509_POLICY_LEVEL *level);\n\nX509_POLICY_NODE *X509_policy_level_get0_node(X509_POLICY_LEVEL *level, int i);\n\nconst ASN1_OBJECT *X509_policy_node_get0_policy(const X509_POLICY_NODE *node);\n\nSTACK_OF(POLICYQUALINFO) *\n\tX509_policy_node_get0_qualifiers(const X509_POLICY_NODE *node);\nconst X509_POLICY_NODE *\n\tX509_policy_node_get0_parent(const X509_POLICY_NODE *node);\n\n#ifdef  __cplusplus\n}\n#endif\n#endif\n\n"
  },
  {
    "path": "freebsd-headers/openssl/x509v3.h",
    "content": "/* x509v3.h */\n/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL\n * project 1999.\n */\n/* ====================================================================\n * Copyright (c) 1999-2004 The OpenSSL Project.  All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n *\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer. \n *\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in\n *    the documentation and/or other materials provided with the\n *    distribution.\n *\n * 3. All advertising materials mentioning features or use of this\n *    software must display the following acknowledgment:\n *    \"This product includes software developed by the OpenSSL Project\n *    for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)\"\n *\n * 4. The names \"OpenSSL Toolkit\" and \"OpenSSL Project\" must not be used to\n *    endorse or promote products derived from this software without\n *    prior written permission. For written permission, please contact\n *    licensing@OpenSSL.org.\n *\n * 5. Products derived from this software may not be called \"OpenSSL\"\n *    nor may \"OpenSSL\" appear in their names without prior written\n *    permission of the OpenSSL Project.\n *\n * 6. Redistributions of any form whatsoever must retain the following\n *    acknowledgment:\n *    \"This product includes software developed by the OpenSSL Project\n *    for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)\"\n *\n * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY\n * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\n * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE OpenSSL PROJECT OR\n * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\n * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,\n * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED\n * OF THE POSSIBILITY OF SUCH DAMAGE.\n * ====================================================================\n *\n * This product includes cryptographic software written by Eric Young\n * (eay@cryptsoft.com).  This product includes software written by Tim\n * Hudson (tjh@cryptsoft.com).\n *\n */\n#ifndef HEADER_X509V3_H\n#define HEADER_X509V3_H\n\n#include <openssl/bio.h>\n#include <openssl/x509.h>\n#include <openssl/conf.h>\n\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\n/* Forward reference */\nstruct v3_ext_method;\nstruct v3_ext_ctx;\n\n/* Useful typedefs */\n\ntypedef void * (*X509V3_EXT_NEW)(void);\ntypedef void (*X509V3_EXT_FREE)(void *);\ntypedef void * (*X509V3_EXT_D2I)(void *, const unsigned char ** , long);\ntypedef int (*X509V3_EXT_I2D)(void *, unsigned char **);\ntypedef STACK_OF(CONF_VALUE) * (*X509V3_EXT_I2V)(struct v3_ext_method *method, void *ext, STACK_OF(CONF_VALUE) *extlist);\ntypedef void * (*X509V3_EXT_V2I)(struct v3_ext_method *method, struct v3_ext_ctx *ctx, STACK_OF(CONF_VALUE) *values);\ntypedef char * (*X509V3_EXT_I2S)(struct v3_ext_method *method, void *ext);\ntypedef void * (*X509V3_EXT_S2I)(struct v3_ext_method *method, struct v3_ext_ctx *ctx, const char *str);\ntypedef int (*X509V3_EXT_I2R)(struct v3_ext_method *method, void *ext, BIO *out, int indent);\ntypedef void * (*X509V3_EXT_R2I)(struct v3_ext_method *method, struct v3_ext_ctx *ctx, const char *str);\n\n/* V3 extension structure */\n\nstruct v3_ext_method {\nint ext_nid;\nint ext_flags;\n/* If this is set the following four fields are ignored */\nASN1_ITEM_EXP *it;\n/* Old style ASN1 calls */\nX509V3_EXT_NEW ext_new;\nX509V3_EXT_FREE ext_free;\nX509V3_EXT_D2I d2i;\nX509V3_EXT_I2D i2d;\n\n/* The following pair is used for string extensions */\nX509V3_EXT_I2S i2s;\nX509V3_EXT_S2I s2i;\n\n/* The following pair is used for multi-valued extensions */\nX509V3_EXT_I2V i2v;\nX509V3_EXT_V2I v2i;\n\n/* The following are used for raw extensions */\nX509V3_EXT_I2R i2r;\nX509V3_EXT_R2I r2i;\n\nvoid *usr_data;\t/* Any extension specific data */\n};\n\ntypedef struct X509V3_CONF_METHOD_st {\nchar * (*get_string)(void *db, char *section, char *value);\nSTACK_OF(CONF_VALUE) * (*get_section)(void *db, char *section);\nvoid (*free_string)(void *db, char * string);\nvoid (*free_section)(void *db, STACK_OF(CONF_VALUE) *section);\n} X509V3_CONF_METHOD;\n\n/* Context specific info */\nstruct v3_ext_ctx {\n#define CTX_TEST 0x1\nint flags;\nX509 *issuer_cert;\nX509 *subject_cert;\nX509_REQ *subject_req;\nX509_CRL *crl;\nX509V3_CONF_METHOD *db_meth;\nvoid *db;\n/* Maybe more here */\n};\n\ntypedef struct v3_ext_method X509V3_EXT_METHOD;\n\nDECLARE_STACK_OF(X509V3_EXT_METHOD)\n\n/* ext_flags values */\n#define X509V3_EXT_DYNAMIC\t0x1\n#define X509V3_EXT_CTX_DEP\t0x2\n#define X509V3_EXT_MULTILINE\t0x4\n\ntypedef BIT_STRING_BITNAME ENUMERATED_NAMES;\n\ntypedef struct BASIC_CONSTRAINTS_st {\nint ca;\nASN1_INTEGER *pathlen;\n} BASIC_CONSTRAINTS;\n\n\ntypedef struct PKEY_USAGE_PERIOD_st {\nASN1_GENERALIZEDTIME *notBefore;\nASN1_GENERALIZEDTIME *notAfter;\n} PKEY_USAGE_PERIOD;\n\ntypedef struct otherName_st {\nASN1_OBJECT *type_id;\nASN1_TYPE *value;\n} OTHERNAME;\n\ntypedef struct EDIPartyName_st {\n\tASN1_STRING *nameAssigner;\n\tASN1_STRING *partyName;\n} EDIPARTYNAME;\n\ntypedef struct GENERAL_NAME_st {\n\n#define GEN_OTHERNAME\t0\n#define GEN_EMAIL\t1\n#define GEN_DNS\t\t2\n#define GEN_X400\t3\n#define GEN_DIRNAME\t4\n#define GEN_EDIPARTY\t5\n#define GEN_URI\t\t6\n#define GEN_IPADD\t7\n#define GEN_RID\t\t8\n\nint type;\nunion {\n\tchar *ptr;\n\tOTHERNAME *otherName; /* otherName */\n\tASN1_IA5STRING *rfc822Name;\n\tASN1_IA5STRING *dNSName;\n\tASN1_TYPE *x400Address;\n\tX509_NAME *directoryName;\n\tEDIPARTYNAME *ediPartyName;\n\tASN1_IA5STRING *uniformResourceIdentifier;\n\tASN1_OCTET_STRING *iPAddress;\n\tASN1_OBJECT *registeredID;\n\n\t/* Old names */\n\tASN1_OCTET_STRING *ip; /* iPAddress */\n\tX509_NAME *dirn;\t\t/* dirn */\n\tASN1_IA5STRING *ia5;/* rfc822Name, dNSName, uniformResourceIdentifier */\n\tASN1_OBJECT *rid; /* registeredID */\n\tASN1_TYPE *other; /* x400Address */\n} d;\n} GENERAL_NAME;\n\ntypedef STACK_OF(GENERAL_NAME) GENERAL_NAMES;\n\ntypedef struct ACCESS_DESCRIPTION_st {\n\tASN1_OBJECT *method;\n\tGENERAL_NAME *location;\n} ACCESS_DESCRIPTION;\n\ntypedef STACK_OF(ACCESS_DESCRIPTION) AUTHORITY_INFO_ACCESS;\n\ntypedef STACK_OF(ASN1_OBJECT) EXTENDED_KEY_USAGE;\n\nDECLARE_STACK_OF(GENERAL_NAME)\nDECLARE_ASN1_SET_OF(GENERAL_NAME)\n\nDECLARE_STACK_OF(ACCESS_DESCRIPTION)\nDECLARE_ASN1_SET_OF(ACCESS_DESCRIPTION)\n\ntypedef struct DIST_POINT_NAME_st {\nint type;\nunion {\n\tGENERAL_NAMES *fullname;\n\tSTACK_OF(X509_NAME_ENTRY) *relativename;\n} name;\n} DIST_POINT_NAME;\n\ntypedef struct DIST_POINT_st {\nDIST_POINT_NAME\t*distpoint;\nASN1_BIT_STRING *reasons;\nGENERAL_NAMES *CRLissuer;\n} DIST_POINT;\n\ntypedef STACK_OF(DIST_POINT) CRL_DIST_POINTS;\n\nDECLARE_STACK_OF(DIST_POINT)\nDECLARE_ASN1_SET_OF(DIST_POINT)\n\ntypedef struct AUTHORITY_KEYID_st {\nASN1_OCTET_STRING *keyid;\nGENERAL_NAMES *issuer;\nASN1_INTEGER *serial;\n} AUTHORITY_KEYID;\n\n/* Strong extranet structures */\n\ntypedef struct SXNET_ID_st {\n\tASN1_INTEGER *zone;\n\tASN1_OCTET_STRING *user;\n} SXNETID;\n\nDECLARE_STACK_OF(SXNETID)\nDECLARE_ASN1_SET_OF(SXNETID)\n\ntypedef struct SXNET_st {\n\tASN1_INTEGER *version;\n\tSTACK_OF(SXNETID) *ids;\n} SXNET;\n\ntypedef struct NOTICEREF_st {\n\tASN1_STRING *organization;\n\tSTACK_OF(ASN1_INTEGER) *noticenos;\n} NOTICEREF;\n\ntypedef struct USERNOTICE_st {\n\tNOTICEREF *noticeref;\n\tASN1_STRING *exptext;\n} USERNOTICE;\n\ntypedef struct POLICYQUALINFO_st {\n\tASN1_OBJECT *pqualid;\n\tunion {\n\t\tASN1_IA5STRING *cpsuri;\n\t\tUSERNOTICE *usernotice;\n\t\tASN1_TYPE *other;\n\t} d;\n} POLICYQUALINFO;\n\nDECLARE_STACK_OF(POLICYQUALINFO)\nDECLARE_ASN1_SET_OF(POLICYQUALINFO)\n\ntypedef struct POLICYINFO_st {\n\tASN1_OBJECT *policyid;\n\tSTACK_OF(POLICYQUALINFO) *qualifiers;\n} POLICYINFO;\n\ntypedef STACK_OF(POLICYINFO) CERTIFICATEPOLICIES;\n\nDECLARE_STACK_OF(POLICYINFO)\nDECLARE_ASN1_SET_OF(POLICYINFO)\n\ntypedef struct POLICY_MAPPING_st {\n\tASN1_OBJECT *issuerDomainPolicy;\n\tASN1_OBJECT *subjectDomainPolicy;\n} POLICY_MAPPING;\n\nDECLARE_STACK_OF(POLICY_MAPPING)\n\ntypedef STACK_OF(POLICY_MAPPING) POLICY_MAPPINGS;\n\ntypedef struct GENERAL_SUBTREE_st {\n\tGENERAL_NAME *base;\n\tASN1_INTEGER *minimum;\n\tASN1_INTEGER *maximum;\n} GENERAL_SUBTREE;\n\nDECLARE_STACK_OF(GENERAL_SUBTREE)\n\ntypedef struct NAME_CONSTRAINTS_st {\n\tSTACK_OF(GENERAL_SUBTREE) *permittedSubtrees;\n\tSTACK_OF(GENERAL_SUBTREE) *excludedSubtrees;\n} NAME_CONSTRAINTS;\n\ntypedef struct POLICY_CONSTRAINTS_st {\n\tASN1_INTEGER *requireExplicitPolicy;\n\tASN1_INTEGER *inhibitPolicyMapping;\n} POLICY_CONSTRAINTS;\n\n/* Proxy certificate structures, see RFC 3820 */\ntypedef struct PROXY_POLICY_st\n\t{\n\tASN1_OBJECT *policyLanguage;\n\tASN1_OCTET_STRING *policy;\n\t} PROXY_POLICY;\n\ntypedef struct PROXY_CERT_INFO_EXTENSION_st\n\t{\n\tASN1_INTEGER *pcPathLengthConstraint;\n\tPROXY_POLICY *proxyPolicy;\n\t} PROXY_CERT_INFO_EXTENSION;\n\nDECLARE_ASN1_FUNCTIONS(PROXY_POLICY)\nDECLARE_ASN1_FUNCTIONS(PROXY_CERT_INFO_EXTENSION)\n\n\n#define X509V3_conf_err(val) ERR_add_error_data(6, \"section:\", val->section, \\\n\",name:\", val->name, \",value:\", val->value);\n\n#define X509V3_set_ctx_test(ctx) \\\n\t\t\tX509V3_set_ctx(ctx, NULL, NULL, NULL, NULL, CTX_TEST)\n#define X509V3_set_ctx_nodb(ctx) (ctx)->db = NULL;\n\n#define EXT_BITSTRING(nid, table) { nid, 0, ASN1_ITEM_ref(ASN1_BIT_STRING), \\\n\t\t\t0,0,0,0, \\\n\t\t\t0,0, \\\n\t\t\t(X509V3_EXT_I2V)i2v_ASN1_BIT_STRING, \\\n\t\t\t(X509V3_EXT_V2I)v2i_ASN1_BIT_STRING, \\\n\t\t\tNULL, NULL, \\\n\t\t\ttable}\n\n#define EXT_IA5STRING(nid) { nid, 0, ASN1_ITEM_ref(ASN1_IA5STRING), \\\n\t\t\t0,0,0,0, \\\n\t\t\t(X509V3_EXT_I2S)i2s_ASN1_IA5STRING, \\\n\t\t\t(X509V3_EXT_S2I)s2i_ASN1_IA5STRING, \\\n\t\t\t0,0,0,0, \\\n\t\t\tNULL}\n\n#define EXT_END { -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}\n\n\n/* X509_PURPOSE stuff */\n\n#define EXFLAG_BCONS\t\t0x1\n#define EXFLAG_KUSAGE\t\t0x2\n#define EXFLAG_XKUSAGE\t\t0x4\n#define EXFLAG_NSCERT\t\t0x8\n\n#define EXFLAG_CA\t\t0x10\n/* Really self issued not necessarily self signed */\n#define EXFLAG_SI\t\t0x20\n#define EXFLAG_SS\t\t0x20\n#define EXFLAG_V1\t\t0x40\n#define EXFLAG_INVALID\t\t0x80\n#define EXFLAG_SET\t\t0x100\n#define EXFLAG_CRITICAL\t\t0x200\n#define EXFLAG_PROXY\t\t0x400\n\n#define EXFLAG_INVALID_POLICY\t0x800\n\n#define KU_DIGITAL_SIGNATURE\t0x0080\n#define KU_NON_REPUDIATION\t0x0040\n#define KU_KEY_ENCIPHERMENT\t0x0020\n#define KU_DATA_ENCIPHERMENT\t0x0010\n#define KU_KEY_AGREEMENT\t0x0008\n#define KU_KEY_CERT_SIGN\t0x0004\n#define KU_CRL_SIGN\t\t0x0002\n#define KU_ENCIPHER_ONLY\t0x0001\n#define KU_DECIPHER_ONLY\t0x8000\n\n#define NS_SSL_CLIENT\t\t0x80\n#define NS_SSL_SERVER\t\t0x40\n#define NS_SMIME\t\t0x20\n#define NS_OBJSIGN\t\t0x10\n#define NS_SSL_CA\t\t0x04\n#define NS_SMIME_CA\t\t0x02\n#define NS_OBJSIGN_CA\t\t0x01\n#define NS_ANY_CA\t\t(NS_SSL_CA|NS_SMIME_CA|NS_OBJSIGN_CA)\n\n#define XKU_SSL_SERVER\t\t0x1\t\n#define XKU_SSL_CLIENT\t\t0x2\n#define XKU_SMIME\t\t0x4\n#define XKU_CODE_SIGN\t\t0x8\n#define XKU_SGC\t\t\t0x10\n#define XKU_OCSP_SIGN\t\t0x20\n#define XKU_TIMESTAMP\t\t0x40\n#define XKU_DVCS\t\t0x80\n\n#define X509_PURPOSE_DYNAMIC\t0x1\n#define X509_PURPOSE_DYNAMIC_NAME\t0x2\n\ntypedef struct x509_purpose_st {\n\tint purpose;\n\tint trust;\t\t/* Default trust ID */\n\tint flags;\n\tint (*check_purpose)(const struct x509_purpose_st *,\n\t\t\t\tconst X509 *, int);\n\tchar *name;\n\tchar *sname;\n\tvoid *usr_data;\n} X509_PURPOSE;\n\n#define X509_PURPOSE_SSL_CLIENT\t\t1\n#define X509_PURPOSE_SSL_SERVER\t\t2\n#define X509_PURPOSE_NS_SSL_SERVER\t3\n#define X509_PURPOSE_SMIME_SIGN\t\t4\n#define X509_PURPOSE_SMIME_ENCRYPT\t5\n#define X509_PURPOSE_CRL_SIGN\t\t6\n#define X509_PURPOSE_ANY\t\t7\n#define X509_PURPOSE_OCSP_HELPER\t8\n\n#define X509_PURPOSE_MIN\t\t1\n#define X509_PURPOSE_MAX\t\t8\n\n/* Flags for X509V3_EXT_print() */\n\n#define X509V3_EXT_UNKNOWN_MASK\t\t(0xfL << 16)\n/* Return error for unknown extensions */\n#define X509V3_EXT_DEFAULT\t\t0\n/* Print error for unknown extensions */\n#define X509V3_EXT_ERROR_UNKNOWN\t(1L << 16)\n/* ASN1 parse unknown extensions */\n#define X509V3_EXT_PARSE_UNKNOWN\t(2L << 16)\n/* BIO_dump unknown extensions */\n#define X509V3_EXT_DUMP_UNKNOWN\t\t(3L << 16)\n\n/* Flags for X509V3_add1_i2d */\n\n#define X509V3_ADD_OP_MASK\t\t0xfL\n#define X509V3_ADD_DEFAULT\t\t0L\n#define X509V3_ADD_APPEND\t\t1L\n#define X509V3_ADD_REPLACE\t\t2L\n#define X509V3_ADD_REPLACE_EXISTING\t3L\n#define X509V3_ADD_KEEP_EXISTING\t4L\n#define X509V3_ADD_DELETE\t\t5L\n#define X509V3_ADD_SILENT\t\t0x10\n\nDECLARE_STACK_OF(X509_PURPOSE)\n\nDECLARE_ASN1_FUNCTIONS(BASIC_CONSTRAINTS)\n\nDECLARE_ASN1_FUNCTIONS(SXNET)\nDECLARE_ASN1_FUNCTIONS(SXNETID)\n\nint SXNET_add_id_asc(SXNET **psx, char *zone, char *user, int userlen); \nint SXNET_add_id_ulong(SXNET **psx, unsigned long lzone, char *user, int userlen); \nint SXNET_add_id_INTEGER(SXNET **psx, ASN1_INTEGER *izone, char *user, int userlen); \n\nASN1_OCTET_STRING *SXNET_get_id_asc(SXNET *sx, char *zone);\nASN1_OCTET_STRING *SXNET_get_id_ulong(SXNET *sx, unsigned long lzone);\nASN1_OCTET_STRING *SXNET_get_id_INTEGER(SXNET *sx, ASN1_INTEGER *zone);\n\nDECLARE_ASN1_FUNCTIONS(AUTHORITY_KEYID)\n\nDECLARE_ASN1_FUNCTIONS(PKEY_USAGE_PERIOD)\n\nDECLARE_ASN1_FUNCTIONS(GENERAL_NAME)\n\n\nASN1_BIT_STRING *v2i_ASN1_BIT_STRING(X509V3_EXT_METHOD *method,\n\t\t\t\tX509V3_CTX *ctx, STACK_OF(CONF_VALUE) *nval);\nSTACK_OF(CONF_VALUE) *i2v_ASN1_BIT_STRING(X509V3_EXT_METHOD *method,\n\t\t\t\tASN1_BIT_STRING *bits,\n\t\t\t\tSTACK_OF(CONF_VALUE) *extlist);\n\nSTACK_OF(CONF_VALUE) *i2v_GENERAL_NAME(X509V3_EXT_METHOD *method, GENERAL_NAME *gen, STACK_OF(CONF_VALUE) *ret);\nint GENERAL_NAME_print(BIO *out, GENERAL_NAME *gen);\n\nDECLARE_ASN1_FUNCTIONS(GENERAL_NAMES)\n\nSTACK_OF(CONF_VALUE) *i2v_GENERAL_NAMES(X509V3_EXT_METHOD *method,\n\t\tGENERAL_NAMES *gen, STACK_OF(CONF_VALUE) *extlist);\nGENERAL_NAMES *v2i_GENERAL_NAMES(X509V3_EXT_METHOD *method,\n\t\t\t\tX509V3_CTX *ctx, STACK_OF(CONF_VALUE) *nval);\n\nDECLARE_ASN1_FUNCTIONS(OTHERNAME)\nDECLARE_ASN1_FUNCTIONS(EDIPARTYNAME)\n\nchar *i2s_ASN1_OCTET_STRING(X509V3_EXT_METHOD *method, ASN1_OCTET_STRING *ia5);\nASN1_OCTET_STRING *s2i_ASN1_OCTET_STRING(X509V3_EXT_METHOD *method, X509V3_CTX *ctx, char *str);\n\nDECLARE_ASN1_FUNCTIONS(EXTENDED_KEY_USAGE)\nint i2a_ACCESS_DESCRIPTION(BIO *bp, ACCESS_DESCRIPTION* a);\n\nDECLARE_ASN1_FUNCTIONS(CERTIFICATEPOLICIES)\nDECLARE_ASN1_FUNCTIONS(POLICYINFO)\nDECLARE_ASN1_FUNCTIONS(POLICYQUALINFO)\nDECLARE_ASN1_FUNCTIONS(USERNOTICE)\nDECLARE_ASN1_FUNCTIONS(NOTICEREF)\n\nDECLARE_ASN1_FUNCTIONS(CRL_DIST_POINTS)\nDECLARE_ASN1_FUNCTIONS(DIST_POINT)\nDECLARE_ASN1_FUNCTIONS(DIST_POINT_NAME)\n\nDECLARE_ASN1_FUNCTIONS(ACCESS_DESCRIPTION)\nDECLARE_ASN1_FUNCTIONS(AUTHORITY_INFO_ACCESS)\n\nDECLARE_ASN1_ITEM(POLICY_MAPPING)\nDECLARE_ASN1_ALLOC_FUNCTIONS(POLICY_MAPPING)\nDECLARE_ASN1_ITEM(POLICY_MAPPINGS)\n\nDECLARE_ASN1_ITEM(GENERAL_SUBTREE)\nDECLARE_ASN1_ALLOC_FUNCTIONS(GENERAL_SUBTREE)\n\nDECLARE_ASN1_ITEM(NAME_CONSTRAINTS)\nDECLARE_ASN1_ALLOC_FUNCTIONS(NAME_CONSTRAINTS)\n\nDECLARE_ASN1_ALLOC_FUNCTIONS(POLICY_CONSTRAINTS)\nDECLARE_ASN1_ITEM(POLICY_CONSTRAINTS)\n\n#ifdef HEADER_CONF_H\nGENERAL_NAME *v2i_GENERAL_NAME(X509V3_EXT_METHOD *method, X509V3_CTX *ctx,\n\t\t\t\t\t\t\tCONF_VALUE *cnf);\nGENERAL_NAME *v2i_GENERAL_NAME_ex(GENERAL_NAME *out, X509V3_EXT_METHOD *method,\n\t\t\t\tX509V3_CTX *ctx, CONF_VALUE *cnf, int is_nc);\nvoid X509V3_conf_free(CONF_VALUE *val);\n\nX509_EXTENSION *X509V3_EXT_nconf_nid(CONF *conf, X509V3_CTX *ctx, int ext_nid, char *value);\nX509_EXTENSION *X509V3_EXT_nconf(CONF *conf, X509V3_CTX *ctx, char *name, char *value);\nint X509V3_EXT_add_nconf_sk(CONF *conf, X509V3_CTX *ctx, char *section, STACK_OF(X509_EXTENSION) **sk);\nint X509V3_EXT_add_nconf(CONF *conf, X509V3_CTX *ctx, char *section, X509 *cert);\nint X509V3_EXT_REQ_add_nconf(CONF *conf, X509V3_CTX *ctx, char *section, X509_REQ *req);\nint X509V3_EXT_CRL_add_nconf(CONF *conf, X509V3_CTX *ctx, char *section, X509_CRL *crl);\n\nX509_EXTENSION *X509V3_EXT_conf_nid(LHASH *conf, X509V3_CTX *ctx, int ext_nid, char *value);\nX509_EXTENSION *X509V3_EXT_conf(LHASH *conf, X509V3_CTX *ctx, char *name, char *value);\nint X509V3_EXT_add_conf(LHASH *conf, X509V3_CTX *ctx, char *section, X509 *cert);\nint X509V3_EXT_REQ_add_conf(LHASH *conf, X509V3_CTX *ctx, char *section, X509_REQ *req);\nint X509V3_EXT_CRL_add_conf(LHASH *conf, X509V3_CTX *ctx, char *section, X509_CRL *crl);\n\nint X509V3_add_value_bool_nf(char *name, int asn1_bool,\n\t\t\t\t\t\tSTACK_OF(CONF_VALUE) **extlist);\nint X509V3_get_value_bool(CONF_VALUE *value, int *asn1_bool);\nint X509V3_get_value_int(CONF_VALUE *value, ASN1_INTEGER **aint);\nvoid X509V3_set_nconf(X509V3_CTX *ctx, CONF *conf);\nvoid X509V3_set_conf_lhash(X509V3_CTX *ctx, LHASH *lhash);\n#endif\n\nchar * X509V3_get_string(X509V3_CTX *ctx, char *name, char *section);\nSTACK_OF(CONF_VALUE) * X509V3_get_section(X509V3_CTX *ctx, char *section);\nvoid X509V3_string_free(X509V3_CTX *ctx, char *str);\nvoid X509V3_section_free( X509V3_CTX *ctx, STACK_OF(CONF_VALUE) *section);\nvoid X509V3_set_ctx(X509V3_CTX *ctx, X509 *issuer, X509 *subject,\n\t\t\t\t X509_REQ *req, X509_CRL *crl, int flags);\n\nint X509V3_add_value(const char *name, const char *value,\n\t\t\t\t\t\tSTACK_OF(CONF_VALUE) **extlist);\nint X509V3_add_value_uchar(const char *name, const unsigned char *value,\n\t\t\t\t\t\tSTACK_OF(CONF_VALUE) **extlist);\nint X509V3_add_value_bool(const char *name, int asn1_bool,\n\t\t\t\t\t\tSTACK_OF(CONF_VALUE) **extlist);\nint X509V3_add_value_int(const char *name, ASN1_INTEGER *aint,\n\t\t\t\t\t\tSTACK_OF(CONF_VALUE) **extlist);\nchar * i2s_ASN1_INTEGER(X509V3_EXT_METHOD *meth, ASN1_INTEGER *aint);\nASN1_INTEGER * s2i_ASN1_INTEGER(X509V3_EXT_METHOD *meth, char *value);\nchar * i2s_ASN1_ENUMERATED(X509V3_EXT_METHOD *meth, ASN1_ENUMERATED *aint);\nchar * i2s_ASN1_ENUMERATED_TABLE(X509V3_EXT_METHOD *meth, ASN1_ENUMERATED *aint);\nint X509V3_EXT_add(X509V3_EXT_METHOD *ext);\nint X509V3_EXT_add_list(X509V3_EXT_METHOD *extlist);\nint X509V3_EXT_add_alias(int nid_to, int nid_from);\nvoid X509V3_EXT_cleanup(void);\n\nX509V3_EXT_METHOD *X509V3_EXT_get(X509_EXTENSION *ext);\nX509V3_EXT_METHOD *X509V3_EXT_get_nid(int nid);\nint X509V3_add_standard_extensions(void);\nSTACK_OF(CONF_VALUE) *X509V3_parse_list(const char *line);\nvoid *X509V3_EXT_d2i(X509_EXTENSION *ext);\nvoid *X509V3_get_d2i(STACK_OF(X509_EXTENSION) *x, int nid, int *crit, int *idx);\n\n\nX509_EXTENSION *X509V3_EXT_i2d(int ext_nid, int crit, void *ext_struc);\nint X509V3_add1_i2d(STACK_OF(X509_EXTENSION) **x, int nid, void *value, int crit, unsigned long flags);\n\nchar *hex_to_string(unsigned char *buffer, long len);\nunsigned char *string_to_hex(char *str, long *len);\nint name_cmp(const char *name, const char *cmp);\n\nvoid X509V3_EXT_val_prn(BIO *out, STACK_OF(CONF_VALUE) *val, int indent,\n\t\t\t\t\t\t\t\t int ml);\nint X509V3_EXT_print(BIO *out, X509_EXTENSION *ext, unsigned long flag, int indent);\nint X509V3_EXT_print_fp(FILE *out, X509_EXTENSION *ext, int flag, int indent);\n\nint X509V3_extensions_print(BIO *out, char *title, STACK_OF(X509_EXTENSION) *exts, unsigned long flag, int indent);\n\nint X509_check_ca(X509 *x);\nint X509_check_purpose(X509 *x, int id, int ca);\nint X509_supported_extension(X509_EXTENSION *ex);\nint X509_PURPOSE_set(int *p, int purpose);\nint X509_check_issued(X509 *issuer, X509 *subject);\nint X509_PURPOSE_get_count(void);\nX509_PURPOSE * X509_PURPOSE_get0(int idx);\nint X509_PURPOSE_get_by_sname(char *sname);\nint X509_PURPOSE_get_by_id(int id);\nint X509_PURPOSE_add(int id, int trust, int flags,\n\t\t\tint (*ck)(const X509_PURPOSE *, const X509 *, int),\n\t\t\t\tchar *name, char *sname, void *arg);\nchar *X509_PURPOSE_get0_name(X509_PURPOSE *xp);\nchar *X509_PURPOSE_get0_sname(X509_PURPOSE *xp);\nint X509_PURPOSE_get_trust(X509_PURPOSE *xp);\nvoid X509_PURPOSE_cleanup(void);\nint X509_PURPOSE_get_id(X509_PURPOSE *);\n\nSTACK *X509_get1_email(X509 *x);\nSTACK *X509_REQ_get1_email(X509_REQ *x);\nvoid X509_email_free(STACK *sk);\nSTACK *X509_get1_ocsp(X509 *x);\n\nASN1_OCTET_STRING *a2i_IPADDRESS(const char *ipasc);\nASN1_OCTET_STRING *a2i_IPADDRESS_NC(const char *ipasc);\nint a2i_ipadd(unsigned char *ipout, const char *ipasc);\nint X509V3_NAME_from_section(X509_NAME *nm, STACK_OF(CONF_VALUE)*dn_sk,\n\t\t\t\t\t\tunsigned long chtype);\n\nvoid X509_POLICY_NODE_print(BIO *out, X509_POLICY_NODE *node, int indent);\n\n#ifndef OPENSSL_NO_RFC3779\n\ntypedef struct ASRange_st {\n  ASN1_INTEGER *min, *max;\n} ASRange;\n\n#define\tASIdOrRange_id\t\t0\n#define\tASIdOrRange_range\t1\n\ntypedef struct ASIdOrRange_st {\n  int type;\n  union {\n    ASN1_INTEGER *id;\n    ASRange      *range;\n  } u;\n} ASIdOrRange;\n\ntypedef STACK_OF(ASIdOrRange) ASIdOrRanges;\nDECLARE_STACK_OF(ASIdOrRange)\n\n#define\tASIdentifierChoice_inherit\t\t0\n#define\tASIdentifierChoice_asIdsOrRanges\t1\n\ntypedef struct ASIdentifierChoice_st {\n  int type;\n  union {\n    ASN1_NULL    *inherit;\n    ASIdOrRanges *asIdsOrRanges;\n  } u;\n} ASIdentifierChoice;\n\ntypedef struct ASIdentifiers_st {\n  ASIdentifierChoice *asnum, *rdi;\n} ASIdentifiers;\n\nDECLARE_ASN1_FUNCTIONS(ASRange)\nDECLARE_ASN1_FUNCTIONS(ASIdOrRange)\nDECLARE_ASN1_FUNCTIONS(ASIdentifierChoice)\nDECLARE_ASN1_FUNCTIONS(ASIdentifiers)\n\n\ntypedef struct IPAddressRange_st {\n  ASN1_BIT_STRING\t*min, *max;\n} IPAddressRange;\n\n#define\tIPAddressOrRange_addressPrefix\t0\n#define\tIPAddressOrRange_addressRange\t1\n\ntypedef struct IPAddressOrRange_st {\n  int type;\n  union {\n    ASN1_BIT_STRING\t*addressPrefix;\n    IPAddressRange\t*addressRange;\n  } u;\n} IPAddressOrRange;\n\ntypedef STACK_OF(IPAddressOrRange) IPAddressOrRanges;\nDECLARE_STACK_OF(IPAddressOrRange)\n\n#define\tIPAddressChoice_inherit\t\t\t0\n#define\tIPAddressChoice_addressesOrRanges\t1\n\ntypedef struct IPAddressChoice_st {\n  int type;\n  union {\n    ASN1_NULL\t\t*inherit;\n    IPAddressOrRanges\t*addressesOrRanges;\n  } u;\n} IPAddressChoice;\n\ntypedef struct IPAddressFamily_st {\n  ASN1_OCTET_STRING\t*addressFamily;\n  IPAddressChoice\t*ipAddressChoice;\n} IPAddressFamily;\n\ntypedef STACK_OF(IPAddressFamily) IPAddrBlocks;\nDECLARE_STACK_OF(IPAddressFamily)\n\nDECLARE_ASN1_FUNCTIONS(IPAddressRange)\nDECLARE_ASN1_FUNCTIONS(IPAddressOrRange)\nDECLARE_ASN1_FUNCTIONS(IPAddressChoice)\nDECLARE_ASN1_FUNCTIONS(IPAddressFamily)\n\n/*\n * API tag for elements of the ASIdentifer SEQUENCE.\n */\n#define\tV3_ASID_ASNUM\t0\n#define\tV3_ASID_RDI\t1\n\n/*\n * AFI values, assigned by IANA.  It'd be nice to make the AFI\n * handling code totally generic, but there are too many little things\n * that would need to be defined for other address families for it to\n * be worth the trouble.\n */\n#define\tIANA_AFI_IPV4\t1\n#define\tIANA_AFI_IPV6\t2\n\n/*\n * Utilities to construct and extract values from RFC3779 extensions,\n * since some of the encodings (particularly for IP address prefixes\n * and ranges) are a bit tedious to work with directly.\n */\nint v3_asid_add_inherit(ASIdentifiers *asid, int which);\nint v3_asid_add_id_or_range(ASIdentifiers *asid, int which,\n\t\t\t    ASN1_INTEGER *min, ASN1_INTEGER *max);\nint v3_addr_add_inherit(IPAddrBlocks *addr,\n\t\t\tconst unsigned afi, const unsigned *safi);\nint v3_addr_add_prefix(IPAddrBlocks *addr,\n\t\t       const unsigned afi, const unsigned *safi,\n\t\t       unsigned char *a, const int prefixlen);\nint v3_addr_add_range(IPAddrBlocks *addr,\n\t\t      const unsigned afi, const unsigned *safi,\n\t\t      unsigned char *min, unsigned char *max);\nunsigned v3_addr_get_afi(const IPAddressFamily *f);\nint v3_addr_get_range(IPAddressOrRange *aor, const unsigned afi,\n\t\t      unsigned char *min, unsigned char *max,\n\t\t      const int length);\n\n/*\n * Canonical forms.\n */\nint v3_asid_is_canonical(ASIdentifiers *asid);\nint v3_addr_is_canonical(IPAddrBlocks *addr);\nint v3_asid_canonize(ASIdentifiers *asid);\nint v3_addr_canonize(IPAddrBlocks *addr);\n\n/*\n * Tests for inheritance and containment.\n */\nint v3_asid_inherits(ASIdentifiers *asid);\nint v3_addr_inherits(IPAddrBlocks *addr);\nint v3_asid_subset(ASIdentifiers *a, ASIdentifiers *b);\nint v3_addr_subset(IPAddrBlocks *a, IPAddrBlocks *b);\n\n/*\n * Check whether RFC 3779 extensions nest properly in chains.\n */\nint v3_asid_validate_path(X509_STORE_CTX *);\nint v3_addr_validate_path(X509_STORE_CTX *);\nint v3_asid_validate_resource_set(STACK_OF(X509) *chain,\n\t\t\t\t  ASIdentifiers *ext,\n\t\t\t\t  int allow_inheritance);\nint v3_addr_validate_resource_set(STACK_OF(X509) *chain,\n\t\t\t\t  IPAddrBlocks *ext,\n\t\t\t\t  int allow_inheritance);\n\n#endif /* OPENSSL_NO_RFC3779 */\n\n/* BEGIN ERROR CODES */\n/* The following lines are auto generated by the script mkerr.pl. Any changes\n * made after this point may be overwritten when the script is next run.\n */\nvoid ERR_load_X509V3_strings(void);\n\n/* Error codes for the X509V3 functions. */\n\n/* Function codes. */\n#define X509V3_F_ASIDENTIFIERCHOICE_CANONIZE\t\t 156\n#define X509V3_F_ASIDENTIFIERCHOICE_IS_CANONICAL\t 157\n#define X509V3_F_COPY_EMAIL\t\t\t\t 122\n#define X509V3_F_COPY_ISSUER\t\t\t\t 123\n#define X509V3_F_DO_DIRNAME\t\t\t\t 144\n#define X509V3_F_DO_EXT_CONF\t\t\t\t 124\n#define X509V3_F_DO_EXT_I2D\t\t\t\t 135\n#define X509V3_F_DO_EXT_NCONF\t\t\t\t 151\n#define X509V3_F_DO_I2V_NAME_CONSTRAINTS\t\t 148\n#define X509V3_F_HEX_TO_STRING\t\t\t\t 111\n#define X509V3_F_I2S_ASN1_ENUMERATED\t\t\t 121\n#define X509V3_F_I2S_ASN1_IA5STRING\t\t\t 149\n#define X509V3_F_I2S_ASN1_INTEGER\t\t\t 120\n#define X509V3_F_I2V_AUTHORITY_INFO_ACCESS\t\t 138\n#define X509V3_F_NOTICE_SECTION\t\t\t\t 132\n#define X509V3_F_NREF_NOS\t\t\t\t 133\n#define X509V3_F_POLICY_SECTION\t\t\t\t 131\n#define X509V3_F_PROCESS_PCI_VALUE\t\t\t 150\n#define X509V3_F_R2I_CERTPOL\t\t\t\t 130\n#define X509V3_F_R2I_PCI\t\t\t\t 155\n#define X509V3_F_S2I_ASN1_IA5STRING\t\t\t 100\n#define X509V3_F_S2I_ASN1_INTEGER\t\t\t 108\n#define X509V3_F_S2I_ASN1_OCTET_STRING\t\t\t 112\n#define X509V3_F_S2I_ASN1_SKEY_ID\t\t\t 114\n#define X509V3_F_S2I_SKEY_ID\t\t\t\t 115\n#define X509V3_F_STRING_TO_HEX\t\t\t\t 113\n#define X509V3_F_SXNET_ADD_ID_ASC\t\t\t 125\n#define X509V3_F_SXNET_ADD_ID_INTEGER\t\t\t 126\n#define X509V3_F_SXNET_ADD_ID_ULONG\t\t\t 127\n#define X509V3_F_SXNET_GET_ID_ASC\t\t\t 128\n#define X509V3_F_SXNET_GET_ID_ULONG\t\t\t 129\n#define X509V3_F_V2I_ASIDENTIFIERS\t\t\t 158\n#define X509V3_F_V2I_ASN1_BIT_STRING\t\t\t 101\n#define X509V3_F_V2I_AUTHORITY_INFO_ACCESS\t\t 139\n#define X509V3_F_V2I_AUTHORITY_KEYID\t\t\t 119\n#define X509V3_F_V2I_BASIC_CONSTRAINTS\t\t\t 102\n#define X509V3_F_V2I_CRLD\t\t\t\t 134\n#define X509V3_F_V2I_EXTENDED_KEY_USAGE\t\t\t 103\n#define X509V3_F_V2I_GENERAL_NAMES\t\t\t 118\n#define X509V3_F_V2I_GENERAL_NAME_EX\t\t\t 117\n#define X509V3_F_V2I_IPADDRBLOCKS\t\t\t 159\n#define X509V3_F_V2I_ISSUER_ALT\t\t\t\t 153\n#define X509V3_F_V2I_NAME_CONSTRAINTS\t\t\t 147\n#define X509V3_F_V2I_POLICY_CONSTRAINTS\t\t\t 146\n#define X509V3_F_V2I_POLICY_MAPPINGS\t\t\t 145\n#define X509V3_F_V2I_SUBJECT_ALT\t\t\t 154\n#define X509V3_F_V3_ADDR_VALIDATE_PATH_INTERNAL\t\t 160\n#define X509V3_F_V3_GENERIC_EXTENSION\t\t\t 116\n#define X509V3_F_X509V3_ADD1_I2D\t\t\t 140\n#define X509V3_F_X509V3_ADD_VALUE\t\t\t 105\n#define X509V3_F_X509V3_EXT_ADD\t\t\t\t 104\n#define X509V3_F_X509V3_EXT_ADD_ALIAS\t\t\t 106\n#define X509V3_F_X509V3_EXT_CONF\t\t\t 107\n#define X509V3_F_X509V3_EXT_I2D\t\t\t\t 136\n#define X509V3_F_X509V3_EXT_NCONF\t\t\t 152\n#define X509V3_F_X509V3_GET_SECTION\t\t\t 142\n#define X509V3_F_X509V3_GET_STRING\t\t\t 143\n#define X509V3_F_X509V3_GET_VALUE_BOOL\t\t\t 110\n#define X509V3_F_X509V3_PARSE_LIST\t\t\t 109\n#define X509V3_F_X509_PURPOSE_ADD\t\t\t 137\n#define X509V3_F_X509_PURPOSE_SET\t\t\t 141\n\n/* Reason codes. */\n#define X509V3_R_BAD_IP_ADDRESS\t\t\t\t 118\n#define X509V3_R_BAD_OBJECT\t\t\t\t 119\n#define X509V3_R_BN_DEC2BN_ERROR\t\t\t 100\n#define X509V3_R_BN_TO_ASN1_INTEGER_ERROR\t\t 101\n#define X509V3_R_DIRNAME_ERROR\t\t\t\t 149\n#define X509V3_R_DUPLICATE_ZONE_ID\t\t\t 133\n#define X509V3_R_ERROR_CONVERTING_ZONE\t\t\t 131\n#define X509V3_R_ERROR_CREATING_EXTENSION\t\t 144\n#define X509V3_R_ERROR_IN_EXTENSION\t\t\t 128\n#define X509V3_R_EXPECTED_A_SECTION_NAME\t\t 137\n#define X509V3_R_EXTENSION_EXISTS\t\t\t 145\n#define X509V3_R_EXTENSION_NAME_ERROR\t\t\t 115\n#define X509V3_R_EXTENSION_NOT_FOUND\t\t\t 102\n#define X509V3_R_EXTENSION_SETTING_NOT_SUPPORTED\t 103\n#define X509V3_R_EXTENSION_VALUE_ERROR\t\t\t 116\n#define X509V3_R_ILLEGAL_EMPTY_EXTENSION\t\t 151\n#define X509V3_R_ILLEGAL_HEX_DIGIT\t\t\t 113\n#define X509V3_R_INCORRECT_POLICY_SYNTAX_TAG\t\t 152\n#define X509V3_R_INVALID_ASNUMBER\t\t\t 160\n#define X509V3_R_INVALID_ASRANGE\t\t\t 161\n#define X509V3_R_INVALID_BOOLEAN_STRING\t\t\t 104\n#define X509V3_R_INVALID_EXTENSION_STRING\t\t 105\n#define X509V3_R_INVALID_INHERITANCE\t\t\t 162\n#define X509V3_R_INVALID_IPADDRESS\t\t\t 163\n#define X509V3_R_INVALID_NAME\t\t\t\t 106\n#define X509V3_R_INVALID_NULL_ARGUMENT\t\t\t 107\n#define X509V3_R_INVALID_NULL_NAME\t\t\t 108\n#define X509V3_R_INVALID_NULL_VALUE\t\t\t 109\n#define X509V3_R_INVALID_NUMBER\t\t\t\t 140\n#define X509V3_R_INVALID_NUMBERS\t\t\t 141\n#define X509V3_R_INVALID_OBJECT_IDENTIFIER\t\t 110\n#define X509V3_R_INVALID_OPTION\t\t\t\t 138\n#define X509V3_R_INVALID_POLICY_IDENTIFIER\t\t 134\n#define X509V3_R_INVALID_PROXY_POLICY_SETTING\t\t 153\n#define X509V3_R_INVALID_PURPOSE\t\t\t 146\n#define X509V3_R_INVALID_SAFI\t\t\t\t 164\n#define X509V3_R_INVALID_SECTION\t\t\t 135\n#define X509V3_R_INVALID_SYNTAX\t\t\t\t 143\n#define X509V3_R_ISSUER_DECODE_ERROR\t\t\t 126\n#define X509V3_R_MISSING_VALUE\t\t\t\t 124\n#define X509V3_R_NEED_ORGANIZATION_AND_NUMBERS\t\t 142\n#define X509V3_R_NO_CONFIG_DATABASE\t\t\t 136\n#define X509V3_R_NO_ISSUER_CERTIFICATE\t\t\t 121\n#define X509V3_R_NO_ISSUER_DETAILS\t\t\t 127\n#define X509V3_R_NO_POLICY_IDENTIFIER\t\t\t 139\n#define X509V3_R_NO_PROXY_CERT_POLICY_LANGUAGE_DEFINED\t 154\n#define X509V3_R_NO_PUBLIC_KEY\t\t\t\t 114\n#define X509V3_R_NO_SUBJECT_DETAILS\t\t\t 125\n#define X509V3_R_ODD_NUMBER_OF_DIGITS\t\t\t 112\n#define X509V3_R_OPERATION_NOT_DEFINED\t\t\t 148\n#define X509V3_R_OTHERNAME_ERROR\t\t\t 147\n#define X509V3_R_POLICY_LANGUAGE_ALREADTY_DEFINED\t 155\n#define X509V3_R_POLICY_PATH_LENGTH\t\t\t 156\n#define X509V3_R_POLICY_PATH_LENGTH_ALREADTY_DEFINED\t 157\n#define X509V3_R_POLICY_SYNTAX_NOT_CURRENTLY_SUPPORTED\t 158\n#define X509V3_R_POLICY_WHEN_PROXY_LANGUAGE_REQUIRES_NO_POLICY 159\n#define X509V3_R_SECTION_NOT_FOUND\t\t\t 150\n#define X509V3_R_UNABLE_TO_GET_ISSUER_DETAILS\t\t 122\n#define X509V3_R_UNABLE_TO_GET_ISSUER_KEYID\t\t 123\n#define X509V3_R_UNKNOWN_BIT_STRING_ARGUMENT\t\t 111\n#define X509V3_R_UNKNOWN_EXTENSION\t\t\t 129\n#define X509V3_R_UNKNOWN_EXTENSION_NAME\t\t\t 130\n#define X509V3_R_UNKNOWN_OPTION\t\t\t\t 120\n#define X509V3_R_UNSUPPORTED_OPTION\t\t\t 117\n#define X509V3_R_USER_TOO_LONG\t\t\t\t 132\n\n#ifdef  __cplusplus\n}\n#endif\n#endif\n"
  },
  {
    "path": "freebsd-headers/opie.h",
    "content": "/* opie.h: Data structures and values for the OPIE authentication\n\tsystem that a program might need.\n\n%%% portions-copyright-cmetz-96\nPortions of this software are Copyright 1996-1999 by Craig Metz, All Rights\nReserved. The Inner Net License Version 2 applies to these portions of\nthe software.\nYou should have received a copy of the license with this software. If\nyou didn't get a copy, you may request one from <license@inner.net>.\n\nPortions of this software are Copyright 1995 by Randall Atkinson and Dan\nMcDonald, All Rights Reserved. All Rights under this copyright are assigned\nto the U.S. Naval Research Laboratory (NRL). The NRL Copyright Notice and\nLicense Agreement applies to this software.\n\n\tHistory:\n\n\tModified by cmetz for OPIE 2.4. Added sequence number limits. Added\n\t\tstruct opie_otpkey and made many functions use it. Added\n\t\topiestrncpy(). Include header with libmissing prototypes.\n\tModified by cmetz for OPIE 2.32. Added symbolic flag names for\n\t\topiepasswd(). Added __opieparsechallenge() prototype.\n\tModified by cmetz for OPIE 2.31. Removed active attack protection.\n\tModified by cmetz for OPIE 2.3. Renamed PTR to VOIDPTR. Added\n\t\tre-init key and extension file fields to struct opie. Added\n\t\topie_ prefix on struct opie members. Added opie_flags field\n\t\tand definitions. Added more prototypes. Changed opiehash()\n\t\tprototype.\n\tModified by cmetz for OPIE 2.22. Define __P correctly if this file\n\t\tis included in a third-party program.\n\tModified by cmetz for OPIE 2.2. Re-did prototypes. Added FUNCTION\n                definition et al. Multiple-include protection. Added struct\n\t\tutsname fake. Got rid of gethostname() cruft. Moved UINT4\n                here. Provide for *seek whence values. Move MDx context here\n                and unify. Re-did prototypes.\n\tModified at NRL for OPIE 2.0.\n\tWritten at Bellcore for the S/Key Version 1 software distribution\n\t\t(skey.h).\n\n$FreeBSD: release/9.0.0/contrib/opie/opie.h 92914 2002-03-21 23:42:52Z markm $\n*/\n#ifndef _OPIE_H\n#define _OPIE_H 1\n\nstruct opie {\n  int opie_flags;\n  char opie_buf[256];\n  char *opie_principal;\n  int opie_n;\n  char *opie_seed;\n  char *opie_val;\n  long opie_recstart;\n};\n\n#define __OPIE_FLAGS_RW 1\n#define __OPIE_FLAGS_READ 2\n\n/* Minimum length of a secret password */\n#ifndef OPIE_SECRET_MIN\n#define OPIE_SECRET_MIN 10\n#endif\t/* OPIE_SECRET_MIN */\n\n/* Maximum length of a secret password */\n#define OPIE_SECRET_MAX 127\n\n/* Minimum length of a seed */\n#define OPIE_SEED_MIN 5\n\n/* Maximum length of a seed */\n#define OPIE_SEED_MAX 16\n\n/* Max length of hash algorithm name (md4/md5) */\n#define OPIE_HASHNAME_MAX 3\n\n/* Maximum length of a challenge (otp-md? 9999 seed) */\n#define OPIE_CHALLENGE_MAX (4+OPIE_HASHNAME_MAX+1+4+1+OPIE_SEED_MAX)\n\n/* Maximum length of a response that we allow */\n#define OPIE_RESPONSE_MAX (9+1+19+1+9+OPIE_SEED_MAX+1+19+1+19+1+19)\n\n/* Maximum length of a principal (read: user name) */\n#define OPIE_PRINCIPAL_MAX 32\n\n/* Maximum sequence number */\n#ifndef OPIE_SEQUENCE_MAX\n#define OPIE_SEQUENCE_MAX 9999\n#endif /* OPIE_SEQUENCE_MAX */\n\n/* Restricted sequence number */\n#ifndef OPIE_SEQUENCE_RESTRICT\n#define OPIE_SEQUENCE_RESTRICT 9\n#endif /* OPIE_SEQUENCE_RESTRICT */\n\n#define UINT4 u_int32_t\n\nstruct opie_otpkey {\n\tUINT4 words[2];\n};\n\n#ifndef SEEK_SET\n#define SEEK_SET 0\n#endif /* SEEK_SET */\n\n#ifndef SEEK_END\n#define SEEK_END 2\n#endif /* SEEK_END */\n\n__BEGIN_DECLS\nint  opieaccessfile __P((char *));\nint  rdnets __P((long));\nint  isaddr __P((register char *));\nint  opiealways __P((char *));\nchar *opieatob8 __P((struct opie_otpkey *, char *));\nvoid opiebackspace __P((char *));\nchar *opiebtoa8 __P((char *, struct opie_otpkey *));\nchar *opiebtoe __P((char *, struct opie_otpkey *));\nchar *opiebtoh __P((char *, struct opie_otpkey *));\nint  opieetob __P((struct opie_otpkey *, char *));\nint  opiechallenge __P((struct opie *,char *,char *));\nint  opiegenerator __P((char *,char *,char *));\nint  opiegetsequence __P((struct opie *));\nvoid opiehash __P((struct opie_otpkey *, unsigned));\nint  opiehtoi __P((register char));\nint  opiekeycrunch __P((int, struct opie_otpkey *, char *, char *));\nint  opielock __P((char *));\nint  opieunlock __P((void));\nvoid opieunlockaeh __P((void));\nvoid opiedisableaeh __P((void));\nint  opielookup __P((struct opie *,char *));\nint  opiepasscheck __P((char *));\nvoid opierandomchallenge __P((char *));\nchar * opieskipspace __P((register char *));\nvoid opiestripcrlf __P((char *));\nint  opieverify __P((struct opie *,char *));\nint opiepasswd __P((struct opie *, int, char *, int, char *, char *));\nchar *opiereadpass __P((char *, int, int));\nint opielogin __P((char *line, char *name, char *host));\nconst char *opie_get_algorithm __P((void));\nint  opie_haskey __P((char *username));\nchar *opie_keyinfo __P((char *));\nint  opie_passverify __P((char *username, char *passwd));\n__END_DECLS\n\n#if _OPIE\n#define VOIDPTR void *\n#define VOIDRET void\n#define NOARGS  void\n#define FUNCTION(arglist, args) (args)\n#define AND ,\n#define FUNCTION_NOARGS ()\n\n__BEGIN_DECLS\nstruct utmp;\nint __opiegetutmpentry __P((char *, struct utmp *));\n#ifdef EOF\nFILE *__opieopen __P((char *, int, int));\n#endif /* EOF */\nint __opiereadrec __P((struct opie *));\nint __opiewriterec __P((struct opie *));\nint __opieparsechallenge __P((char *buffer, int *algorithm, int *sequence, char **seed, int *exts));\n__END_DECLS\n\n#define opiestrncpy(dst, src, n) \\\n  do { \\\n    strncpy(dst, src, n-1); \\\n    dst[n-1] = 0; \\\n  } while(0)\n\n/* #include \"missing.h\" */\n#endif /* _OPIE */\n\n#define OPIEPASSWD_CONSOLE 1\n#define OPIEPASSWD_FORCE   2\n\n#endif /* _OPIE_H */\n"
  },
  {
    "path": "freebsd-headers/osreldate.h",
    "content": "/*-\n * Copyright (c) 1992-2012 The FreeBSD Project.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n */\n\n#ifdef _KERNEL\n#error \"<osreldate.h> cannot be used in the kernel, use <sys/param.h>\"\n#else\n#undef __FreeBSD_version\n#define __FreeBSD_version 900044\n#endif\n"
  },
  {
    "path": "freebsd-headers/panel.h",
    "content": "/****************************************************************************\n * Copyright (c) 1998-2001,2006 Free Software Foundation, Inc.              *\n *                                                                          *\n * Permission is hereby granted, free of charge, to any person obtaining a  *\n * copy of this software and associated documentation files (the            *\n * \"Software\"), to deal in the Software without restriction, including      *\n * without limitation the rights to use, copy, modify, merge, publish,      *\n * distribute, distribute with modifications, sublicense, and/or sell       *\n * copies of the Software, and to permit persons to whom the Software is    *\n * furnished to do so, subject to the following conditions:                 *\n *                                                                          *\n * The above copyright notice and this permission notice shall be included  *\n * in all copies or substantial portions of the Software.                   *\n *                                                                          *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS  *\n * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF               *\n * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.   *\n * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,   *\n * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR    *\n * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR    *\n * THE USE OR OTHER DEALINGS IN THE SOFTWARE.                               *\n *                                                                          *\n * Except as contained in this notice, the name(s) of the above copyright   *\n * holders shall not be used in advertising or otherwise to promote the     *\n * sale, use or other dealings in this Software without prior written       *\n * authorization.                                                           *\n ****************************************************************************/\n\n/****************************************************************************\n *  Author: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1995                    *\n *     and: Eric S. Raymond <esr@snark.thyrsus.com>                         *\n ****************************************************************************/\n\n/* $Id: panel.h,v 1.10 2006/05/27 19:49:40 tom Exp $ */\n\n/* panel.h -- interface file for panels library */\n\n#ifndef NCURSES_PANEL_H_incl\n#define NCURSES_PANEL_H_incl 1\n\n#include <curses.h>\n\ntypedef struct panel\n{\n  WINDOW *win;\n  struct panel *below;\n  struct panel *above;\n  NCURSES_CONST void *user;\n} PANEL;\n\n#if\tdefined(__cplusplus)\nextern \"C\" {\n#endif\n\nextern NCURSES_EXPORT(WINDOW*) panel_window (const PANEL *);\nextern NCURSES_EXPORT(void)    update_panels (void);\nextern NCURSES_EXPORT(int)     hide_panel (PANEL *);\nextern NCURSES_EXPORT(int)     show_panel (PANEL *);\nextern NCURSES_EXPORT(int)     del_panel (PANEL *);\nextern NCURSES_EXPORT(int)     top_panel (PANEL *);\nextern NCURSES_EXPORT(int)     bottom_panel (PANEL *);\nextern NCURSES_EXPORT(PANEL*)  new_panel (WINDOW *);\nextern NCURSES_EXPORT(PANEL*)  panel_above (const PANEL *);\nextern NCURSES_EXPORT(PANEL*)  panel_below (const PANEL *);\nextern NCURSES_EXPORT(int)     set_panel_userptr (PANEL *, NCURSES_CONST void *);\nextern NCURSES_EXPORT(NCURSES_CONST void*) panel_userptr (const PANEL *);\nextern NCURSES_EXPORT(int)     move_panel (PANEL *, int, int);\nextern NCURSES_EXPORT(int)     replace_panel (PANEL *,WINDOW *);\nextern NCURSES_EXPORT(int)     panel_hidden (const PANEL *);\n\n#if\tdefined(__cplusplus)\n}\n#endif\n\n#endif /* NCURSES_PANEL_H_incl */\n\n/* end of panel.h */\n"
  },
  {
    "path": "freebsd-headers/paths.h",
    "content": "/*\n * Copyright (c) 1989, 1993\n *\tThe Regents of the University of California.  All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t@(#)paths.h\t8.1 (Berkeley) 6/2/93\n * $FreeBSD: release/9.0.0/include/paths.h 219019 2011-02-25 00:04:39Z gabor $\n */\n\n#ifndef _PATHS_H_\n#define\t_PATHS_H_\n\n#include <sys/cdefs.h>\n\n/* Default search path. */\n#define\t_PATH_DEFPATH\t\"/usr/bin:/bin\"\n/* All standard utilities path. */\n#define\t_PATH_STDPATH\t\"/usr/bin:/bin:/usr/sbin:/sbin\"\n/* Locate system binaries. */\n#define\t_PATH_SYSPATH\t\"/sbin:/usr/sbin\"\n\n#define\t_PATH_AUTHCONF\t\"/etc/auth.conf\"\n#define\t_PATH_BSHELL\t\"/bin/sh\"\n#define\t_PATH_CAPABILITY\t\"/etc/capability\"\n#define\t_PATH_CAPABILITY_DB\t\"/etc/capability.db\"\n#define\t_PATH_CONSOLE\t\"/dev/console\"\n#define\t_PATH_CP\t\"/bin/cp\"\n#define\t_PATH_CSHELL\t\"/bin/csh\"\n#define\t_PATH_CSMAPPER\t\"/usr/share/i18n/csmapper\"\n#define\t_PATH_DEFTAPE\t\"/dev/sa0\"\n#define\t_PATH_DEVNULL\t\"/dev/null\"\n#define\t_PATH_DEVZERO\t\"/dev/zero\"\n#define\t_PATH_DRUM\t\"/dev/drum\"\n#define\t_PATH_ESDB\t\"/usr/share/i18n/esdb\"\n#define\t_PATH_ETC\t\"/etc\"\n#define\t_PATH_FTPUSERS\t\"/etc/ftpusers\"\n#define\t_PATH_FWMEM\t\"/dev/fwmem\"\n#define\t_PATH_HALT\t\"/sbin/halt\"\n#ifdef COMPAT_32BIT\n#define\t_PATH_I18NMODULE\t\"/usr/lib32/i18n\"\n#else\n#define\t_PATH_I18NMODULE\t\"/usr/lib/i18n\"\n#endif\n#define\t_PATH_IFCONFIG\t\"/sbin/ifconfig\"\n#define\t_PATH_KMEM\t\"/dev/kmem\"\n#define\t_PATH_LIBMAP_CONF\t\"/etc/libmap.conf\"\n#define\t_PATH_LOCALE\t\"/usr/share/locale\"\n#define\t_PATH_LOGIN\t\"/usr/bin/login\"\n#define\t_PATH_MAILDIR\t\"/var/mail\"\n#define\t_PATH_MAN\t\"/usr/share/man\"\n#define\t_PATH_MDCONFIG\t\"/sbin/mdconfig\"\n#define\t_PATH_MEM\t\"/dev/mem\"\n#define\t_PATH_MKSNAP_FFS\t\"/sbin/mksnap_ffs\"\n#define\t_PATH_MOUNT\t\"/sbin/mount\"\n#define\t_PATH_NEWFS\t\"/sbin/newfs\"\n#define\t_PATH_NOLOGIN\t\"/var/run/nologin\"\n#define\t_PATH_RCP\t\"/bin/rcp\"\n#define\t_PATH_REBOOT\t\"/sbin/reboot\"\n#define\t_PATH_RLOGIN\t\"/usr/bin/rlogin\"\n#define\t_PATH_RM\t\"/bin/rm\"\n#define\t_PATH_RSH\t\"/usr/bin/rsh\"\n#define\t_PATH_SENDMAIL\t\"/usr/sbin/sendmail\"\n#define\t_PATH_SHELLS\t\"/etc/shells\"\n#define\t_PATH_TTY\t\"/dev/tty\"\n#define\t_PATH_UNIX\t\"don't use _PATH_UNIX\"\n#define\t_PATH_VI\t\"/usr/bin/vi\"\n#define\t_PATH_WALL\t\"/usr/bin/wall\"\n\n/* Provide trailing slash, since mostly used for building pathnames. */\n#define\t_PATH_DEV\t\"/dev/\"\n#define\t_PATH_TMP\t\"/tmp/\"\n#define\t_PATH_VARDB\t\"/var/db/\"\n#define\t_PATH_VARRUN\t\"/var/run/\"\n#define\t_PATH_VARTMP\t\"/var/tmp/\"\n#define\t_PATH_YP\t\"/var/yp/\"\n#define\t_PATH_UUCPLOCK\t\"/var/spool/lock/\"\n\n/* How to get the correct name of the kernel. */\n__BEGIN_DECLS\nconst char *getbootfile(void);\n__END_DECLS\n\n#ifdef RESCUE\n#undef\t_PATH_DEFPATH\n#define\t_PATH_DEFPATH\t\"/rescue:/usr/bin:/bin\"\n#undef\t_PATH_STDPATH\n#define\t_PATH_STDPATH\t\"/rescue:/usr/bin:/bin:/usr/sbin:/sbin\"\n#undef\t_PATH_SYSPATH\n#define\t_PATH_SYSPATH\t\"/rescue:/sbin:/usr/sbin\"\n#undef\t_PATH_BSHELL\n#define\t_PATH_BSHELL\t\"/rescue/sh\"\n#undef\t_PATH_CP\n#define\t_PATH_CP\t\"/rescue/cp\"\n#undef\t_PATH_CSHELL\n#define\t_PATH_CSHELL\t\"/rescue/csh\"\n#undef\t_PATH_HALT\n#define\t_PATH_HALT\t\"/rescue/halt\"\n#undef\t_PATH_IFCONFIG\n#define\t_PATH_IFCONFIG\t\"/rescue/ifconfig\"\n#undef\t_PATH_MDCONFIG\n#define\t_PATH_MDCONFIG\t\"/rescue/mdconfig\"\n#undef\t_PATH_MOUNT\n#define\t_PATH_MOUNT\t\"/rescue/mount\"\n#undef\t_PATH_NEWFS\n#define\t_PATH_NEWFS\t\"/rescue/newfs\"\n#undef\t_PATH_RCP\n#define\t_PATH_RCP\t\"/rescue/rcp\"\n#undef\t_PATH_REBOOT\n#define\t_PATH_REBOOT\t\"/rescue/reboot\"\n#undef\t_PATH_RM\n#define\t_PATH_RM\t\"/rescue/rm\"\n#undef\t_PATH_VI\n#define\t_PATH_VI\t\"/rescue/vi\"\n#undef\t_PATH_WALL\n#define\t_PATH_WALL\t\"/rescue/wall\"\n#endif /* RESCUE */\n\n#endif /* !_PATHS_H_ */\n"
  },
  {
    "path": "freebsd-headers/pcap/bpf.h",
    "content": "/*-\n * Copyright (c) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997\n *\tThe Regents of the University of California.  All rights reserved.\n *\n * This code is derived from the Stanford/CMU enet packet filter,\n * (net/enet.c) distributed as part of 4.3BSD, and code contributed\n * to Berkeley by Steven McCanne and Van Jacobson both of Lawrence \n * Berkeley Laboratory.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. All advertising materials mentioning features or use of this software\n *    must display the following acknowledgement:\n *      This product includes software developed by the University of\n *      California, Berkeley and its contributors.\n * 4. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *      @(#)bpf.h       7.1 (Berkeley) 5/7/91\n *\n * @(#) $Header: /tcpdump/master/libpcap/pcap/bpf.h,v 1.32 2008-12-23 20:13:29 guy Exp $ (LBL)\n */\n\n/*\n * This is libpcap's cut-down version of bpf.h; it includes only\n * the stuff needed for the code generator and the userland BPF\n * interpreter, and the libpcap APIs for setting filters, etc..\n *\n * \"pcap-bpf.c\" will include the native OS version, as it deals with\n * the OS's BPF implementation.\n *\n * XXX - should this all just be moved to \"pcap.h\"?\n */\n\n#ifndef BPF_MAJOR_VERSION\n\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\n/* BSD style release date */\n#define BPF_RELEASE 199606\n\n#ifdef MSDOS /* must be 32-bit */\ntypedef long          bpf_int32;\ntypedef unsigned long bpf_u_int32;\n#else\ntypedef\tint bpf_int32;\ntypedef\tu_int bpf_u_int32;\n#endif\n\n/*\n * Alignment macros.  BPF_WORDALIGN rounds up to the next \n * even multiple of BPF_ALIGNMENT. \n */\n#ifndef __NetBSD__\n#define BPF_ALIGNMENT sizeof(bpf_int32)\n#else\n#define BPF_ALIGNMENT sizeof(long)\n#endif\n#define BPF_WORDALIGN(x) (((x)+(BPF_ALIGNMENT-1))&~(BPF_ALIGNMENT-1))\n\n#define BPF_MAXBUFSIZE 0x8000\n#define BPF_MINBUFSIZE 32\n\n/*\n * Structure for \"pcap_compile()\", \"pcap_setfilter()\", etc..\n */\nstruct bpf_program {\n\tu_int bf_len;\n\tstruct bpf_insn *bf_insns;\n};\n \n/*\n * Struct return by BIOCVERSION.  This represents the version number of \n * the filter language described by the instruction encodings below.\n * bpf understands a program iff kernel_major == filter_major &&\n * kernel_minor >= filter_minor, that is, if the value returned by the\n * running kernel has the same major number and a minor number equal\n * equal to or less than the filter being downloaded.  Otherwise, the\n * results are undefined, meaning an error may be returned or packets\n * may be accepted haphazardly.\n * It has nothing to do with the source code version.\n */\nstruct bpf_version {\n\tu_short bv_major;\n\tu_short bv_minor;\n};\n/* Current version number of filter architecture. */\n#define BPF_MAJOR_VERSION 1\n#define BPF_MINOR_VERSION 1\n\n/*\n * Data-link level type codes.\n *\n * Do *NOT* add new values to this list without asking\n * \"tcpdump-workers@lists.tcpdump.org\" for a value.  Otherwise, you run\n * the risk of using a value that's already being used for some other\n * purpose, and of having tools that read libpcap-format captures not\n * being able to handle captures with your new DLT_ value, with no hope\n * that they will ever be changed to do so (as that would destroy their\n * ability to read captures using that value for that other purpose).\n */\n\n/*\n * These are the types that are the same on all platforms, and that\n * have been defined by <net/bpf.h> for ages.\n */\n#define DLT_NULL\t0\t/* BSD loopback encapsulation */\n#define DLT_EN10MB\t1\t/* Ethernet (10Mb) */\n#define DLT_EN3MB\t2\t/* Experimental Ethernet (3Mb) */\n#define DLT_AX25\t3\t/* Amateur Radio AX.25 */\n#define DLT_PRONET\t4\t/* Proteon ProNET Token Ring */\n#define DLT_CHAOS\t5\t/* Chaos */\n#define DLT_IEEE802\t6\t/* 802.5 Token Ring */\n#define DLT_ARCNET\t7\t/* ARCNET, with BSD-style header */\n#define DLT_SLIP\t8\t/* Serial Line IP */\n#define DLT_PPP\t\t9\t/* Point-to-point Protocol */\n#define DLT_FDDI\t10\t/* FDDI */\n\n/*\n * These are types that are different on some platforms, and that\n * have been defined by <net/bpf.h> for ages.  We use #ifdefs to\n * detect the BSDs that define them differently from the traditional\n * libpcap <net/bpf.h>\n *\n * XXX - DLT_ATM_RFC1483 is 13 in BSD/OS, and DLT_RAW is 14 in BSD/OS,\n * but I don't know what the right #define is for BSD/OS.\n */\n#define DLT_ATM_RFC1483\t11\t/* LLC-encapsulated ATM */\n\n#ifdef __OpenBSD__\n#define DLT_RAW\t\t14\t/* raw IP */\n#else\n#define DLT_RAW\t\t12\t/* raw IP */\n#endif\n\n/*\n * Given that the only OS that currently generates BSD/OS SLIP or PPP\n * is, well, BSD/OS, arguably everybody should have chosen its values\n * for DLT_SLIP_BSDOS and DLT_PPP_BSDOS, which are 15 and 16, but they\n * didn't.  So it goes.\n */\n#if defined(__NetBSD__) || defined(__FreeBSD__)\n#ifndef DLT_SLIP_BSDOS\n#define DLT_SLIP_BSDOS\t13\t/* BSD/OS Serial Line IP */\n#define DLT_PPP_BSDOS\t14\t/* BSD/OS Point-to-point Protocol */\n#endif\n#else\n#define DLT_SLIP_BSDOS\t15\t/* BSD/OS Serial Line IP */\n#define DLT_PPP_BSDOS\t16\t/* BSD/OS Point-to-point Protocol */\n#endif\n\n/*\n * 17 is used for DLT_OLD_PFLOG in OpenBSD;\n *     OBSOLETE: DLT_PFLOG is 117 in OpenBSD now as well. See below.\n * 18 is used for DLT_PFSYNC in OpenBSD; don't use it for anything else.\n */\n\n#define DLT_ATM_CLIP\t19\t/* Linux Classical-IP over ATM */\n\n/*\n * Apparently Redback uses this for its SmartEdge 400/800.  I hope\n * nobody else decided to use it, too.\n */\n#define DLT_REDBACK_SMARTEDGE\t32\n\n/*\n * These values are defined by NetBSD; other platforms should refrain from\n * using them for other purposes, so that NetBSD savefiles with link\n * types of 50 or 51 can be read as this type on all platforms.\n */\n#define DLT_PPP_SERIAL\t50\t/* PPP over serial with HDLC encapsulation */\n#define DLT_PPP_ETHER\t51\t/* PPP over Ethernet */\n\n/*\n * The Axent Raptor firewall - now the Symantec Enterprise Firewall - uses\n * a link-layer type of 99 for the tcpdump it supplies.  The link-layer\n * header has 6 bytes of unknown data, something that appears to be an\n * Ethernet type, and 36 bytes that appear to be 0 in at least one capture\n * I've seen.\n */\n#define DLT_SYMANTEC_FIREWALL\t99\n\n/*\n * Values between 100 and 103 are used in capture file headers as\n * link-layer types corresponding to DLT_ types that differ\n * between platforms; don't use those values for new DLT_ new types.\n */\n\n/*\n * This value was defined by libpcap 0.5; platforms that have defined\n * it with a different value should define it here with that value -\n * a link type of 104 in a save file will be mapped to DLT_C_HDLC,\n * whatever value that happens to be, so programs will correctly\n * handle files with that link type regardless of the value of\n * DLT_C_HDLC.\n *\n * The name DLT_C_HDLC was used by BSD/OS; we use that name for source\n * compatibility with programs written for BSD/OS.\n *\n * libpcap 0.5 defined it as DLT_CHDLC; we define DLT_CHDLC as well,\n * for source compatibility with programs written for libpcap 0.5.\n */\n#define DLT_C_HDLC\t104\t/* Cisco HDLC */\n#define DLT_CHDLC\tDLT_C_HDLC\n\n#define DLT_IEEE802_11\t105\t/* IEEE 802.11 wireless */\n\n/*\n * 106 is reserved for Linux Classical IP over ATM; it's like DLT_RAW,\n * except when it isn't.  (I.e., sometimes it's just raw IP, and\n * sometimes it isn't.)  We currently handle it as DLT_LINUX_SLL,\n * so that we don't have to worry about the link-layer header.)\n */\n\n/*\n * Frame Relay; BSD/OS has a DLT_FR with a value of 11, but that collides\n * with other values.\n * DLT_FR and DLT_FRELAY packets start with the Q.922 Frame Relay header\n * (DLCI, etc.).\n */\n#define DLT_FRELAY\t107\n\n/*\n * OpenBSD DLT_LOOP, for loopback devices; it's like DLT_NULL, except\n * that the AF_ type in the link-layer header is in network byte order.\n *\n * DLT_LOOP is 12 in OpenBSD, but that's DLT_RAW in other OSes, so\n * we don't use 12 for it in OSes other than OpenBSD.\n */\n#ifdef __OpenBSD__\n#define DLT_LOOP\t12\n#else\n#define DLT_LOOP\t108\n#endif\n\n/*\n * Encapsulated packets for IPsec; DLT_ENC is 13 in OpenBSD, but that's\n * DLT_SLIP_BSDOS in NetBSD, so we don't use 13 for it in OSes other\n * than OpenBSD.\n */\n#ifdef __OpenBSD__\n#define DLT_ENC\t\t13\n#else\n#define DLT_ENC\t\t109\n#endif\n\n/*\n * Values between 110 and 112 are reserved for use in capture file headers\n * as link-layer types corresponding to DLT_ types that might differ\n * between platforms; don't use those values for new DLT_ types\n * other than the corresponding DLT_ types.\n */\n\n/*\n * This is for Linux cooked sockets.\n */\n#define DLT_LINUX_SLL\t113\n\n/*\n * Apple LocalTalk hardware.\n */\n#define DLT_LTALK\t114\n\n/*\n * Acorn Econet.\n */\n#define DLT_ECONET\t115\n\n/*\n * Reserved for use with OpenBSD ipfilter.\n */\n#define DLT_IPFILTER\t116\n\n/*\n * OpenBSD DLT_PFLOG; DLT_PFLOG is 17 in OpenBSD, but that's DLT_LANE8023\n * in SuSE 6.3, so we can't use 17 for it in capture-file headers.\n *\n * XXX: is there a conflict with DLT_PFSYNC 18 as well?\n */\n#ifdef __OpenBSD__\n#define DLT_OLD_PFLOG\t17\n#define DLT_PFSYNC\t18\n#endif\n#define DLT_PFLOG\t117\n\n/*\n * Registered for Cisco-internal use.\n */\n#define DLT_CISCO_IOS\t118\n\n/*\n * For 802.11 cards using the Prism II chips, with a link-layer\n * header including Prism monitor mode information plus an 802.11\n * header.\n */\n#define DLT_PRISM_HEADER\t119\n\n/*\n * Reserved for Aironet 802.11 cards, with an Aironet link-layer header\n * (see Doug Ambrisko's FreeBSD patches).\n */\n#define DLT_AIRONET_HEADER\t120\n\n/*\n * Reserved for Siemens HiPath HDLC.\n */\n#define DLT_HHDLC\t\t121\n\n/*\n * This is for RFC 2625 IP-over-Fibre Channel.\n *\n * This is not for use with raw Fibre Channel, where the link-layer\n * header starts with a Fibre Channel frame header; it's for IP-over-FC,\n * where the link-layer header starts with an RFC 2625 Network_Header\n * field.\n */\n#define DLT_IP_OVER_FC\t\t122\n\n/*\n * This is for Full Frontal ATM on Solaris with SunATM, with a\n * pseudo-header followed by an AALn PDU.\n *\n * There may be other forms of Full Frontal ATM on other OSes,\n * with different pseudo-headers.\n *\n * If ATM software returns a pseudo-header with VPI/VCI information\n * (and, ideally, packet type information, e.g. signalling, ILMI,\n * LANE, LLC-multiplexed traffic, etc.), it should not use\n * DLT_ATM_RFC1483, but should get a new DLT_ value, so tcpdump\n * and the like don't have to infer the presence or absence of a\n * pseudo-header and the form of the pseudo-header.\n */\n#define DLT_SUNATM\t\t123\t/* Solaris+SunATM */\n\n/* \n * Reserved as per request from Kent Dahlgren <kent@praesum.com>\n * for private use.\n */\n#define DLT_RIO                 124     /* RapidIO */\n#define DLT_PCI_EXP             125     /* PCI Express */\n#define DLT_AURORA              126     /* Xilinx Aurora link layer */\n\n/*\n * Header for 802.11 plus a number of bits of link-layer information\n * including radio information, used by some recent BSD drivers as\n * well as the madwifi Atheros driver for Linux.\n */\n#define DLT_IEEE802_11_RADIO\t127\t/* 802.11 plus radiotap radio header */\n\n/*\n * Reserved for the TZSP encapsulation, as per request from\n * Chris Waters <chris.waters@networkchemistry.com>\n * TZSP is a generic encapsulation for any other link type,\n * which includes a means to include meta-information\n * with the packet, e.g. signal strength and channel\n * for 802.11 packets.\n */\n#define DLT_TZSP                128     /* Tazmen Sniffer Protocol */\n\n/*\n * BSD's ARCNET headers have the source host, destination host,\n * and type at the beginning of the packet; that's what's handed\n * up to userland via BPF.\n *\n * Linux's ARCNET headers, however, have a 2-byte offset field\n * between the host IDs and the type; that's what's handed up\n * to userland via PF_PACKET sockets.\n *\n * We therefore have to have separate DLT_ values for them.\n */\n#define DLT_ARCNET_LINUX\t129\t/* ARCNET */\n\n/*\n * Juniper-private data link types, as per request from\n * Hannes Gredler <hannes@juniper.net>.  The DLT_s are used\n * for passing on chassis-internal metainformation such as\n * QOS profiles, etc..\n */\n#define DLT_JUNIPER_MLPPP       130\n#define DLT_JUNIPER_MLFR        131\n#define DLT_JUNIPER_ES          132\n#define DLT_JUNIPER_GGSN        133\n#define DLT_JUNIPER_MFR         134\n#define DLT_JUNIPER_ATM2        135\n#define DLT_JUNIPER_SERVICES    136\n#define DLT_JUNIPER_ATM1        137\n\n/*\n * Apple IP-over-IEEE 1394, as per a request from Dieter Siegmund\n * <dieter@apple.com>.  The header that's presented is an Ethernet-like\n * header:\n *\n *\t#define FIREWIRE_EUI64_LEN\t8\n *\tstruct firewire_header {\n *\t\tu_char  firewire_dhost[FIREWIRE_EUI64_LEN];\n *\t\tu_char  firewire_shost[FIREWIRE_EUI64_LEN];\n *\t\tu_short firewire_type;\n *\t};\n *\n * with \"firewire_type\" being an Ethernet type value, rather than,\n * for example, raw GASP frames being handed up.\n */\n#define DLT_APPLE_IP_OVER_IEEE1394\t138\n\n/*\n * Various SS7 encapsulations, as per a request from Jeff Morriss\n * <jeff.morriss[AT]ulticom.com> and subsequent discussions.\n */\n#define DLT_MTP2_WITH_PHDR\t139\t/* pseudo-header with various info, followed by MTP2 */\n#define DLT_MTP2\t\t140\t/* MTP2, without pseudo-header */\n#define DLT_MTP3\t\t141\t/* MTP3, without pseudo-header or MTP2 */\n#define DLT_SCCP\t\t142\t/* SCCP, without pseudo-header or MTP2 or MTP3 */\n\n/*\n * DOCSIS MAC frames.\n */\n#define DLT_DOCSIS\t\t143\n\n/*\n * Linux-IrDA packets. Protocol defined at http://www.irda.org.\n * Those packets include IrLAP headers and above (IrLMP...), but\n * don't include Phy framing (SOF/EOF/CRC & byte stuffing), because Phy\n * framing can be handled by the hardware and depend on the bitrate.\n * This is exactly the format you would get capturing on a Linux-IrDA\n * interface (irdaX), but not on a raw serial port.\n * Note the capture is done in \"Linux-cooked\" mode, so each packet include\n * a fake packet header (struct sll_header). This is because IrDA packet\n * decoding is dependant on the direction of the packet (incomming or\n * outgoing).\n * When/if other platform implement IrDA capture, we may revisit the\n * issue and define a real DLT_IRDA...\n * Jean II\n */\n#define DLT_LINUX_IRDA\t\t144\n\n/*\n * Reserved for IBM SP switch and IBM Next Federation switch.\n */\n#define DLT_IBM_SP\t\t145\n#define DLT_IBM_SN\t\t146\n\n/*\n * Reserved for private use.  If you have some link-layer header type\n * that you want to use within your organization, with the capture files\n * using that link-layer header type not ever be sent outside your\n * organization, you can use these values.\n *\n * No libpcap release will use these for any purpose, nor will any\n * tcpdump release use them, either.\n *\n * Do *NOT* use these in capture files that you expect anybody not using\n * your private versions of capture-file-reading tools to read; in\n * particular, do *NOT* use them in products, otherwise you may find that\n * people won't be able to use tcpdump, or snort, or Ethereal, or... to\n * read capture files from your firewall/intrusion detection/traffic\n * monitoring/etc. appliance, or whatever product uses that DLT_ value,\n * and you may also find that the developers of those applications will\n * not accept patches to let them read those files.\n *\n * Also, do not use them if somebody might send you a capture using them\n * for *their* private type and tools using them for *your* private type\n * would have to read them.\n *\n * Instead, ask \"tcpdump-workers@lists.tcpdump.org\" for a new DLT_ value,\n * as per the comment above, and use the type you're given.\n */\n#define DLT_USER0\t\t147\n#define DLT_USER1\t\t148\n#define DLT_USER2\t\t149\n#define DLT_USER3\t\t150\n#define DLT_USER4\t\t151\n#define DLT_USER5\t\t152\n#define DLT_USER6\t\t153\n#define DLT_USER7\t\t154\n#define DLT_USER8\t\t155\n#define DLT_USER9\t\t156\n#define DLT_USER10\t\t157\n#define DLT_USER11\t\t158\n#define DLT_USER12\t\t159\n#define DLT_USER13\t\t160\n#define DLT_USER14\t\t161\n#define DLT_USER15\t\t162\n\n/*\n * For future use with 802.11 captures - defined by AbsoluteValue\n * Systems to store a number of bits of link-layer information\n * including radio information:\n *\n *\thttp://www.shaftnet.org/~pizza/software/capturefrm.txt\n *\n * but it might be used by some non-AVS drivers now or in the\n * future.\n */\n#define DLT_IEEE802_11_RADIO_AVS 163\t/* 802.11 plus AVS radio header */\n\n/*\n * Juniper-private data link type, as per request from\n * Hannes Gredler <hannes@juniper.net>.  The DLT_s are used\n * for passing on chassis-internal metainformation such as\n * QOS profiles, etc..\n */\n#define DLT_JUNIPER_MONITOR     164\n\n/*\n * Reserved for BACnet MS/TP.\n */\n#define DLT_BACNET_MS_TP\t165\n\n/*\n * Another PPP variant as per request from Karsten Keil <kkeil@suse.de>.\n *\n * This is used in some OSes to allow a kernel socket filter to distinguish\n * between incoming and outgoing packets, on a socket intended to\n * supply pppd with outgoing packets so it can do dial-on-demand and\n * hangup-on-lack-of-demand; incoming packets are filtered out so they\n * don't cause pppd to hold the connection up (you don't want random\n * input packets such as port scans, packets from old lost connections,\n * etc. to force the connection to stay up).\n *\n * The first byte of the PPP header (0xff03) is modified to accomodate\n * the direction - 0x00 = IN, 0x01 = OUT.\n */\n#define DLT_PPP_PPPD\t\t166\n\n/*\n * Names for backwards compatibility with older versions of some PPP\n * software; new software should use DLT_PPP_PPPD.\n */\n#define DLT_PPP_WITH_DIRECTION\tDLT_PPP_PPPD\n#define DLT_LINUX_PPP_WITHDIRECTION\tDLT_PPP_PPPD\n\n/*\n * Juniper-private data link type, as per request from\n * Hannes Gredler <hannes@juniper.net>.  The DLT_s are used\n * for passing on chassis-internal metainformation such as\n * QOS profiles, cookies, etc..\n */\n#define DLT_JUNIPER_PPPOE       167\n#define DLT_JUNIPER_PPPOE_ATM   168\n\n#define DLT_GPRS_LLC\t\t169\t/* GPRS LLC */\n#define DLT_GPF_T\t\t170\t/* GPF-T (ITU-T G.7041/Y.1303) */\n#define DLT_GPF_F\t\t171\t/* GPF-F (ITU-T G.7041/Y.1303) */\n\n/*\n * Requested by Oolan Zimmer <oz@gcom.com> for use in Gcom's T1/E1 line\n * monitoring equipment.\n */\n#define DLT_GCOM_T1E1\t\t172\n#define DLT_GCOM_SERIAL\t\t173\n\n/*\n * Juniper-private data link type, as per request from\n * Hannes Gredler <hannes@juniper.net>.  The DLT_ is used\n * for internal communication to Physical Interface Cards (PIC)\n */\n#define DLT_JUNIPER_PIC_PEER    174\n\n/*\n * Link types requested by Gregor Maier <gregor@endace.com> of Endace\n * Measurement Systems.  They add an ERF header (see\n * http://www.endace.com/support/EndaceRecordFormat.pdf) in front of\n * the link-layer header.\n */\n#define DLT_ERF_ETH\t\t175\t/* Ethernet */\n#define DLT_ERF_POS\t\t176\t/* Packet-over-SONET */\n\n/*\n * Requested by Daniele Orlandi <daniele@orlandi.com> for raw LAPD\n * for vISDN (http://www.orlandi.com/visdn/).  Its link-layer header\n * includes additional information before the LAPD header, so it's\n * not necessarily a generic LAPD header.\n */\n#define DLT_LINUX_LAPD\t\t177\n\n/*\n * Juniper-private data link type, as per request from\n * Hannes Gredler <hannes@juniper.net>. \n * The DLT_ are used for prepending meta-information\n * like interface index, interface name\n * before standard Ethernet, PPP, Frelay & C-HDLC Frames\n */\n#define DLT_JUNIPER_ETHER       178\n#define DLT_JUNIPER_PPP         179\n#define DLT_JUNIPER_FRELAY      180\n#define DLT_JUNIPER_CHDLC       181\n\n/*\n * Multi Link Frame Relay (FRF.16)\n */\n#define DLT_MFR                 182\n\n/*\n * Juniper-private data link type, as per request from\n * Hannes Gredler <hannes@juniper.net>. \n * The DLT_ is used for internal communication with a\n * voice Adapter Card (PIC)\n */\n#define DLT_JUNIPER_VP          183\n\n/*\n * Arinc 429 frames.\n * DLT_ requested by Gianluca Varenni <gianluca.varenni@cacetech.com>.\n * Every frame contains a 32bit A429 label.\n * More documentation on Arinc 429 can be found at\n * http://www.condoreng.com/support/downloads/tutorials/ARINCTutorial.pdf\n */\n#define DLT_A429                184\n\n/*\n * Arinc 653 Interpartition Communication messages.\n * DLT_ requested by Gianluca Varenni <gianluca.varenni@cacetech.com>.\n * Please refer to the A653-1 standard for more information.\n */\n#define DLT_A653_ICM            185\n\n/*\n * USB packets, beginning with a USB setup header; requested by\n * Paolo Abeni <paolo.abeni@email.it>.\n */\n#define DLT_USB\t\t\t186\n\n/*\n * Bluetooth HCI UART transport layer (part H:4); requested by\n * Paolo Abeni.\n */\n#define DLT_BLUETOOTH_HCI_H4\t187\n\n/*\n * IEEE 802.16 MAC Common Part Sublayer; requested by Maria Cruz\n * <cruz_petagay@bah.com>.\n */\n#define DLT_IEEE802_16_MAC_CPS\t188\n\n/*\n * USB packets, beginning with a Linux USB header; requested by\n * Paolo Abeni <paolo.abeni@email.it>.\n */\n#define DLT_USB_LINUX\t\t189\n\n/*\n * Controller Area Network (CAN) v. 2.0B packets.\n * DLT_ requested by Gianluca Varenni <gianluca.varenni@cacetech.com>.\n * Used to dump CAN packets coming from a CAN Vector board.\n * More documentation on the CAN v2.0B frames can be found at\n * http://www.can-cia.org/downloads/?269\n */\n#define DLT_CAN20B              190\n\n/*\n * IEEE 802.15.4, with address fields padded, as is done by Linux\n * drivers; requested by Juergen Schimmer.\n */\n#define DLT_IEEE802_15_4_LINUX\t191\n\n/*\n * Per Packet Information encapsulated packets.\n * DLT_ requested by Gianluca Varenni <gianluca.varenni@cacetech.com>.\n */\n#define DLT_PPI\t\t\t192\n\n/*\n * Header for 802.16 MAC Common Part Sublayer plus a radiotap radio header;\n * requested by Charles Clancy.\n */\n#define DLT_IEEE802_16_MAC_CPS_RADIO\t193\n\n/*\n * Juniper-private data link type, as per request from\n * Hannes Gredler <hannes@juniper.net>. \n * The DLT_ is used for internal communication with a\n * integrated service module (ISM).\n */\n#define DLT_JUNIPER_ISM         194\n\n/*\n * IEEE 802.15.4, exactly as it appears in the spec (no padding, no\n * nothing); requested by Mikko Saarnivala <mikko.saarnivala@sensinode.com>.\n */\n#define DLT_IEEE802_15_4\t195\n\n/*\n * Various link-layer types, with a pseudo-header, for SITA\n * (http://www.sita.aero/); requested by Fulko Hew (fulko.hew@gmail.com).\n */\n#define DLT_SITA\t\t196\n\n/*\n * Various link-layer types, with a pseudo-header, for Endace DAG cards;\n * encapsulates Endace ERF records.  Requested by Stephen Donnelly\n * <stephen@endace.com>.\n */\n#define DLT_ERF\t\t\t197\n\n/*\n * Special header prepended to Ethernet packets when capturing from a\n * u10 Networks board.  Requested by Phil Mulholland\n * <phil@u10networks.com>.\n */\n#define DLT_RAIF1\t\t198\n\n/*\n * IPMB packet for IPMI, beginning with the I2C slave address, followed\n * by the netFn and LUN, etc..  Requested by Chanthy Toeung\n * <chanthy.toeung@ca.kontron.com>.\n */\n#define DLT_IPMB\t\t199\n\n/*\n * Juniper-private data link type, as per request from\n * Hannes Gredler <hannes@juniper.net>. \n * The DLT_ is used for capturing data on a secure tunnel interface.\n */\n#define DLT_JUNIPER_ST          200\n\n/*\n * Bluetooth HCI UART transport layer (part H:4), with pseudo-header\n * that includes direction information; requested by Paolo Abeni.\n */\n#define DLT_BLUETOOTH_HCI_H4_WITH_PHDR\t201\n\n/*\n * AX.25 packet with a 1-byte KISS header; see\n *\n *\thttp://www.ax25.net/kiss.htm\n *\n * as per Richard Stearn <richard@rns-stearn.demon.co.uk>.\n */\n#define DLT_AX25_KISS\t\t202\n\n/*\n * LAPD packets from an ISDN channel, starting with the address field,\n * with no pseudo-header.\n * Requested by Varuna De Silva <varunax@gmail.com>.\n */\n#define DLT_LAPD\t\t203\n\n/*\n * Variants of various link-layer headers, with a one-byte direction\n * pseudo-header prepended - zero means \"received by this host\",\n * non-zero (any non-zero value) means \"sent by this host\" - as per\n * Will Barker <w.barker@zen.co.uk>.\n */\n#define DLT_PPP_WITH_DIR\t204\t/* PPP - don't confuse with DLT_PPP_WITH_DIRECTION */\n#define DLT_C_HDLC_WITH_DIR\t205\t/* Cisco HDLC */\n#define DLT_FRELAY_WITH_DIR\t206\t/* Frame Relay */\n#define DLT_LAPB_WITH_DIR\t207\t/* LAPB */\n\n/*\n * 208 is reserved for an as-yet-unspecified proprietary link-layer\n * type, as requested by Will Barker.\n */\n\n/*\n * IPMB with a Linux-specific pseudo-header; as requested by Alexey Neyman\n * <avn@pigeonpoint.com>.\n */\n#define DLT_IPMB_LINUX\t\t209\n\n/*\n * FlexRay automotive bus - http://www.flexray.com/ - as requested\n * by Hannes Kaelber <hannes.kaelber@x2e.de>.\n */\n#define DLT_FLEXRAY\t\t210\n\n/*\n * Media Oriented Systems Transport (MOST) bus for multimedia\n * transport - http://www.mostcooperation.com/ - as requested\n * by Hannes Kaelber <hannes.kaelber@x2e.de>.\n */\n#define DLT_MOST\t\t211\n\n/*\n * Local Interconnect Network (LIN) bus for vehicle networks -\n * http://www.lin-subbus.org/ - as requested by Hannes Kaelber\n * <hannes.kaelber@x2e.de>.\n */\n#define DLT_LIN\t\t\t212\n\n/*\n * X2E-private data link type used for serial line capture,\n * as requested by Hannes Kaelber <hannes.kaelber@x2e.de>.\n */\n#define DLT_X2E_SERIAL\t\t213\n\n/*\n * X2E-private data link type used for the Xoraya data logger\n * family, as requested by Hannes Kaelber <hannes.kaelber@x2e.de>.\n */\n#define DLT_X2E_XORAYA\t\t214\n\n/*\n * IEEE 802.15.4, exactly as it appears in the spec (no padding, no\n * nothing), but with the PHY-level data for non-ASK PHYs (4 octets\n * of 0 as preamble, one octet of SFD, one octet of frame length+\n * reserved bit, and then the MAC-layer data, starting with the\n * frame control field).\n *\n * Requested by Max Filippov <jcmvbkbc@gmail.com>.\n */\n#define DLT_IEEE802_15_4_NONASK_PHY\t215\n\n/* \n * David Gibson <david@gibson.dropbear.id.au> requested this for\n * captures from the Linux kernel /dev/input/eventN devices. This\n * is used to communicate keystrokes and mouse movements from the\n * Linux kernel to display systems, such as Xorg. \n */\n#define DLT_LINUX_EVDEV\t\t216\n\n/*\n * GSM Um and Abis interfaces, preceded by a \"gsmtap\" header.\n *\n * Requested by Harald Welte <laforge@gnumonks.org>.\n */\n#define DLT_GSMTAP_UM\t\t217\n#define DLT_GSMTAP_ABIS\t\t218\n\n/*\n * MPLS, with an MPLS label as the link-layer header.\n * Requested by Michele Marchetto <michele@openbsd.org> on behalf\n * of OpenBSD.\n */\n#define DLT_MPLS\t\t219\n\n/*\n * USB packets, beginning with a Linux USB header, with the USB header\n * padded to 64 bytes; required for memory-mapped access.\n */\n#define DLT_USB_LINUX_MMAPPED\t220\n\n/*\n * DECT packets, with a pseudo-header; requested by\n * Matthias Wenzel <tcpdump@mazzoo.de>.\n */\n#define DLT_DECT\t\t221\n\n/*\n * From: \"Lidwa, Eric (GSFC-582.0)[SGT INC]\" <eric.lidwa-1@nasa.gov>\n * Date: Mon, 11 May 2009 11:18:30 -0500\n *\n * DLT_AOS. We need it for AOS Space Data Link Protocol.\n *   I have already written dissectors for but need an OK from\n *   legal before I can submit a patch.\n *\n */\n#define DLT_AOS                 222\n\n/*\n * Wireless HART (Highway Addressable Remote Transducer)\n * From the HART Communication Foundation\n * IES/PAS 62591\n *\n * Requested by Sam Roberts <vieuxtech@gmail.com>.\n */\n#define DLT_WIHART\t\t223\n\n/*\n * Fibre Channel FC-2 frames, beginning with a Frame_Header.\n * Requested by Kahou Lei <kahou82@gmail.com>.\n */\n#define DLT_FC_2\t\t224\n\n/*\n * Fibre Channel FC-2 frames, beginning with an encoding of the\n * SOF, and ending with an encoding of the EOF.\n *\n * The encodings represent the frame delimiters as 4-byte sequences\n * representing the corresponding ordered sets, with K28.5\n * represented as 0xBC, and the D symbols as the corresponding\n * byte values; for example, SOFi2, which is K28.5 - D21.5 - D1.2 - D21.2,\n * is represented as 0xBC 0xB5 0x55 0x55.\n *\n * Requested by Kahou Lei <kahou82@gmail.com>.\n */\n#define DLT_FC_2_WITH_FRAME_DELIMS\t225\n\n/*\n * Solaris ipnet pseudo-header; requested by Darren Reed <Darren.Reed@Sun.COM>.\n *\n * The pseudo-header starts with a one-byte version number; for version 2,\n * the pseudo-header is:\n *\n * struct dl_ipnetinfo {\n *     u_int8_t   dli_version;\n *     u_int8_t   dli_family;\n *     u_int16_t  dli_htype;\n *     u_int32_t  dli_pktlen;\n *     u_int32_t  dli_ifindex;\n *     u_int32_t  dli_grifindex;\n *     u_int32_t  dli_zsrc;\n *     u_int32_t  dli_zdst;\n * };\n *\n * dli_version is 2 for the current version of the pseudo-header.\n *\n * dli_family is a Solaris address family value, so it's 2 for IPv4\n * and 26 for IPv6.\n *\n * dli_htype is a \"hook type\" - 0 for incoming packets, 1 for outgoing\n * packets, and 2 for packets arriving from another zone on the same\n * machine.\n *\n * dli_pktlen is the length of the packet data following the pseudo-header\n * (so the captured length minus dli_pktlen is the length of the\n * pseudo-header, assuming the entire pseudo-header was captured).\n *\n * dli_ifindex is the interface index of the interface on which the\n * packet arrived.\n *\n * dli_grifindex is the group interface index number (for IPMP interfaces).\n *\n * dli_zsrc is the zone identifier for the source of the packet.\n *\n * dli_zdst is the zone identifier for the destination of the packet.\n *\n * A zone number of 0 is the global zone; a zone number of 0xffffffff\n * means that the packet arrived from another host on the network, not\n * from another zone on the same machine.\n *\n * An IPv4 or IPv6 datagram follows the pseudo-header; dli_family indicates\n * which of those it is.\n */\n#define DLT_IPNET\t\t\t226\n\n/*\n * CAN (Controller Area Network) frames, with a pseudo-header as supplied\n * by Linux SocketCAN.  See Documentation/networking/can.txt in the Linux\n * source.\n *\n * Requested by Felix Obenhuber <felix@obenhuber.de>.\n */\n#define DLT_CAN_SOCKETCAN\t\t227\n\n/*\n * Raw IPv4/IPv6; different from DLT_RAW in that the DLT_ value specifies\n * whether it's v4 or v6.  Requested by Darren Reed <Darren.Reed@Sun.COM>.\n */\n#define DLT_IPV4\t\t\t228\n#define DLT_IPV6\t\t\t229\n\n/*\n * DLT and savefile link type values are split into a class and\n * a member of that class.  A class value of 0 indicates a regular\n * DLT_/LINKTYPE_ value.\n */\n#define DLT_CLASS(x)\t\t((x) & 0x03ff0000)\n\n/*\n * NetBSD-specific generic \"raw\" link type.  The class value indicates\n * that this is the generic raw type, and the lower 16 bits are the\n * address family we're dealing with.  Those values are NetBSD-specific;\n * do not assume that they correspond to AF_ values for your operating\n * system.\n */\n#define\tDLT_CLASS_NETBSD_RAWAF\t0x02240000\n#define\tDLT_NETBSD_RAWAF(af)\t(DLT_CLASS_NETBSD_RAWAF | (af))\n#define\tDLT_NETBSD_RAWAF_AF(x)\t((x) & 0x0000ffff)\n#define\tDLT_IS_NETBSD_RAWAF(x)\t(DLT_CLASS(x) == DLT_CLASS_NETBSD_RAWAF)\n\n\n/*\n * The instruction encodings.\n */\n/* instruction classes */\n#define BPF_CLASS(code) ((code) & 0x07)\n#define\t\tBPF_LD\t\t0x00\n#define\t\tBPF_LDX\t\t0x01\n#define\t\tBPF_ST\t\t0x02\n#define\t\tBPF_STX\t\t0x03\n#define\t\tBPF_ALU\t\t0x04\n#define\t\tBPF_JMP\t\t0x05\n#define\t\tBPF_RET\t\t0x06\n#define\t\tBPF_MISC\t0x07\n\n/* ld/ldx fields */\n#define BPF_SIZE(code)\t((code) & 0x18)\n#define\t\tBPF_W\t\t0x00\n#define\t\tBPF_H\t\t0x08\n#define\t\tBPF_B\t\t0x10\n#define BPF_MODE(code)\t((code) & 0xe0)\n#define\t\tBPF_IMM \t0x00\n#define\t\tBPF_ABS\t\t0x20\n#define\t\tBPF_IND\t\t0x40\n#define\t\tBPF_MEM\t\t0x60\n#define\t\tBPF_LEN\t\t0x80\n#define\t\tBPF_MSH\t\t0xa0\n\n/* alu/jmp fields */\n#define BPF_OP(code)\t((code) & 0xf0)\n#define\t\tBPF_ADD\t\t0x00\n#define\t\tBPF_SUB\t\t0x10\n#define\t\tBPF_MUL\t\t0x20\n#define\t\tBPF_DIV\t\t0x30\n#define\t\tBPF_OR\t\t0x40\n#define\t\tBPF_AND\t\t0x50\n#define\t\tBPF_LSH\t\t0x60\n#define\t\tBPF_RSH\t\t0x70\n#define\t\tBPF_NEG\t\t0x80\n#define\t\tBPF_JA\t\t0x00\n#define\t\tBPF_JEQ\t\t0x10\n#define\t\tBPF_JGT\t\t0x20\n#define\t\tBPF_JGE\t\t0x30\n#define\t\tBPF_JSET\t0x40\n#define BPF_SRC(code)\t((code) & 0x08)\n#define\t\tBPF_K\t\t0x00\n#define\t\tBPF_X\t\t0x08\n\n/* ret - BPF_K and BPF_X also apply */\n#define BPF_RVAL(code)\t((code) & 0x18)\n#define\t\tBPF_A\t\t0x10\n\n/* misc */\n#define BPF_MISCOP(code) ((code) & 0xf8)\n#define\t\tBPF_TAX\t\t0x00\n#define\t\tBPF_TXA\t\t0x80\n\n/*\n * The instruction data structure.\n */\nstruct bpf_insn {\n\tu_short\tcode;\n\tu_char \tjt;\n\tu_char \tjf;\n\tbpf_u_int32 k;\n};\n\n/*\n * Macros for insn array initializers.\n */\n#define BPF_STMT(code, k) { (u_short)(code), 0, 0, k }\n#define BPF_JUMP(code, k, jt, jf) { (u_short)(code), jt, jf, k }\n\n#if __STDC__ || defined(__cplusplus)\nextern int bpf_validate(const struct bpf_insn *, int);\nextern u_int bpf_filter(struct bpf_insn *, u_char *, u_int, u_int);\n#else\nextern int bpf_validate();\nextern u_int bpf_filter();\n#endif\n\n/*\n * Number of scratch memory words (for BPF_LD|BPF_MEM and BPF_ST).\n */\n#define BPF_MEMWORDS 16\n\n#ifdef __cplusplus\n}\n#endif\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/pcap/namedb.h",
    "content": "/*\n * Copyright (c) 1994, 1996\n *\tThe Regents of the University of California.  All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. All advertising materials mentioning features or use of this software\n *    must display the following acknowledgement:\n *\tThis product includes software developed by the Computer Systems\n *\tEngineering Group at Lawrence Berkeley Laboratory.\n * 4. Neither the name of the University nor of the Laboratory may be used\n *    to endorse or promote products derived from this software without\n *    specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * @(#) $Header: /tcpdump/master/libpcap/pcap/namedb.h,v 1.1 2006-10-04 18:09:22 guy Exp $ (LBL)\n */\n\n#ifndef lib_pcap_namedb_h\n#define lib_pcap_namedb_h\n\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\n/*\n * As returned by the pcap_next_etherent()\n * XXX this stuff doesn't belong in this interface, but this\n * library already must do name to address translation, so\n * on systems that don't have support for /etc/ethers, we\n * export these hooks since they'll\n */\nstruct pcap_etherent {\n\tu_char addr[6];\n\tchar name[122];\n};\n#ifndef PCAP_ETHERS_FILE\n#define PCAP_ETHERS_FILE \"/etc/ethers\"\n#endif\nstruct\tpcap_etherent *pcap_next_etherent(FILE *);\nu_char *pcap_ether_hostton(const char*);\nu_char *pcap_ether_aton(const char *);\n\nbpf_u_int32 **pcap_nametoaddr(const char *);\n#ifdef INET6\nstruct addrinfo *pcap_nametoaddrinfo(const char *);\n#endif\nbpf_u_int32 pcap_nametonetaddr(const char *);\n\nint\tpcap_nametoport(const char *, int *, int *);\nint\tpcap_nametoportrange(const char *, int *, int *, int *);\nint\tpcap_nametoproto(const char *);\nint\tpcap_nametoeproto(const char *);\nint\tpcap_nametollc(const char *);\n/*\n * If a protocol is unknown, PROTO_UNDEF is returned.\n * Also, pcap_nametoport() returns the protocol along with the port number.\n * If there are ambiguous entried in /etc/services (i.e. domain\n * can be either tcp or udp) PROTO_UNDEF is returned.\n */\n#define PROTO_UNDEF\t\t-1\n\n/* XXX move these to pcap-int.h? */\nint __pcap_atodn(const char *, bpf_u_int32 *);\nint __pcap_atoin(const char *, bpf_u_int32 *);\nu_short\t__pcap_nametodnaddr(const char *);\n\n#ifdef __cplusplus\n}\n#endif\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/pcap/pcap.h",
    "content": "/* -*- Mode: c; tab-width: 8; indent-tabs-mode: 1; c-basic-offset: 8; -*- */\n/*\n * Copyright (c) 1993, 1994, 1995, 1996, 1997\n *\tThe Regents of the University of California.  All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. All advertising materials mentioning features or use of this software\n *    must display the following acknowledgement:\n *\tThis product includes software developed by the Computer Systems\n *\tEngineering Group at Lawrence Berkeley Laboratory.\n * 4. Neither the name of the University nor of the Laboratory may be used\n *    to endorse or promote products derived from this software without\n *    specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * @(#) $Header: /tcpdump/master/libpcap/pcap/pcap.h,v 1.15 2008-10-06 15:27:32 gianluca Exp $ (LBL)\n */\n\n#ifndef lib_pcap_pcap_h\n#define lib_pcap_pcap_h\n\n#if defined(WIN32)\n  #include <pcap-stdinc.h>\n#elif defined(MSDOS)\n  #include <sys/types.h>\n  #include <sys/socket.h>  /* u_int, u_char etc. */\n#else /* UN*X */\n  #include <sys/types.h>\n  #include <sys/time.h>\n#endif /* WIN32/MSDOS/UN*X */\n\n#include <net/bpf.h>\n\n#include <stdio.h>\n\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\n/*\n * Version number of the current version of the pcap file format.\n *\n * NOTE: this is *NOT* the version number of the libpcap library.\n * To fetch the version information for the version of libpcap\n * you're using, use pcap_lib_version().\n */\n#define PCAP_VERSION_MAJOR 2\n#define PCAP_VERSION_MINOR 4\n\n#define PCAP_ERRBUF_SIZE 256\n\n/*\n * Compatibility for systems that have a bpf.h that\n * predates the bpf typedefs for 64-bit support.\n */\n#if BPF_RELEASE - 0 < 199406\ntypedef\tint bpf_int32;\ntypedef\tu_int bpf_u_int32;\n#endif\n\ntypedef struct pcap pcap_t;\ntypedef struct pcap_dumper pcap_dumper_t;\ntypedef struct pcap_if pcap_if_t;\ntypedef struct pcap_addr pcap_addr_t;\n\n/*\n * The first record in the file contains saved values for some\n * of the flags used in the printout phases of tcpdump.\n * Many fields here are 32 bit ints so compilers won't insert unwanted\n * padding; these files need to be interchangeable across architectures.\n *\n * Do not change the layout of this structure, in any way (this includes\n * changes that only affect the length of fields in this structure).\n *\n * Also, do not change the interpretation of any of the members of this\n * structure, in any way (this includes using values other than\n * LINKTYPE_ values, as defined in \"savefile.c\", in the \"linktype\"\n * field).\n *\n * Instead:\n *\n *\tintroduce a new structure for the new format, if the layout\n *\tof the structure changed;\n *\n *\tsend mail to \"tcpdump-workers@lists.tcpdump.org\", requesting\n *\ta new magic number for your new capture file format, and, when\n *\tyou get the new magic number, put it in \"savefile.c\";\n *\n *\tuse that magic number for save files with the changed file\n *\theader;\n *\n *\tmake the code in \"savefile.c\" capable of reading files with\n *\tthe old file header as well as files with the new file header\n *\t(using the magic number to determine the header format).\n *\n * Then supply the changes as a patch at\n *\n *\thttp://sourceforge.net/projects/libpcap/\n *\n * so that future versions of libpcap and programs that use it (such as\n * tcpdump) will be able to read your new capture file format.\n */\nstruct pcap_file_header {\n\tbpf_u_int32 magic;\n\tu_short version_major;\n\tu_short version_minor;\n\tbpf_int32 thiszone;\t/* gmt to local correction */\n\tbpf_u_int32 sigfigs;\t/* accuracy of timestamps */\n\tbpf_u_int32 snaplen;\t/* max length saved portion of each pkt */\n\tbpf_u_int32 linktype;\t/* data link type (LINKTYPE_*) */\n};\n\n/*\n * Macros for the value returned by pcap_datalink_ext().\n * \n * If LT_FCS_LENGTH_PRESENT(x) is true, the LT_FCS_LENGTH(x) macro\n * gives the FCS length of packets in the capture.\n */\n#define LT_FCS_LENGTH_PRESENT(x)\t((x) & 0x04000000)\n#define LT_FCS_LENGTH(x)\t\t(((x) & 0xF0000000) >> 28)\n#define LT_FCS_DATALINK_EXT(x)\t\t((((x) & 0xF) << 28) | 0x04000000)\n\ntypedef enum {\n       PCAP_D_INOUT = 0,\n       PCAP_D_IN,\n       PCAP_D_OUT\n} pcap_direction_t;\n\n/*\n * Generic per-packet information, as supplied by libpcap.\n *\n * The time stamp can and should be a \"struct timeval\", regardless of\n * whether your system supports 32-bit tv_sec in \"struct timeval\",\n * 64-bit tv_sec in \"struct timeval\", or both if it supports both 32-bit\n * and 64-bit applications.  The on-disk format of savefiles uses 32-bit\n * tv_sec (and tv_usec); this structure is irrelevant to that.  32-bit\n * and 64-bit versions of libpcap, even if they're on the same platform,\n * should supply the appropriate version of \"struct timeval\", even if\n * that's not what the underlying packet capture mechanism supplies.\n */\nstruct pcap_pkthdr {\n\tstruct timeval ts;\t/* time stamp */\n\tbpf_u_int32 caplen;\t/* length of portion present */\n\tbpf_u_int32 len;\t/* length this packet (off wire) */\n};\n\n/*\n * As returned by the pcap_stats()\n */\nstruct pcap_stat {\n\tu_int ps_recv;\t\t/* number of packets received */\n\tu_int ps_drop;\t\t/* number of packets dropped */\n\tu_int ps_ifdrop;\t/* drops by interface -- only supported on some platforms */\n#ifdef WIN32\n\tu_int bs_capt;\t\t/* number of packets that reach the application */\n#endif /* WIN32 */\n};\n\n#ifdef MSDOS\n/*\n * As returned by the pcap_stats_ex()\n */\nstruct pcap_stat_ex {\n       u_long  rx_packets;        /* total packets received       */\n       u_long  tx_packets;        /* total packets transmitted    */\n       u_long  rx_bytes;          /* total bytes received         */\n       u_long  tx_bytes;          /* total bytes transmitted      */\n       u_long  rx_errors;         /* bad packets received         */\n       u_long  tx_errors;         /* packet transmit problems     */\n       u_long  rx_dropped;        /* no space in Rx buffers       */\n       u_long  tx_dropped;        /* no space available for Tx    */\n       u_long  multicast;         /* multicast packets received   */\n       u_long  collisions;\n\n       /* detailed rx_errors: */\n       u_long  rx_length_errors;\n       u_long  rx_over_errors;    /* receiver ring buff overflow  */\n       u_long  rx_crc_errors;     /* recv'd pkt with crc error    */\n       u_long  rx_frame_errors;   /* recv'd frame alignment error */\n       u_long  rx_fifo_errors;    /* recv'r fifo overrun          */\n       u_long  rx_missed_errors;  /* recv'r missed packet         */\n\n       /* detailed tx_errors */\n       u_long  tx_aborted_errors;\n       u_long  tx_carrier_errors;\n       u_long  tx_fifo_errors;\n       u_long  tx_heartbeat_errors;\n       u_long  tx_window_errors;\n     };\n#endif\n\n/*\n * Item in a list of interfaces.\n */\nstruct pcap_if {\n\tstruct pcap_if *next;\n\tchar *name;\t\t/* name to hand to \"pcap_open_live()\" */\n\tchar *description;\t/* textual description of interface, or NULL */\n\tstruct pcap_addr *addresses;\n\tbpf_u_int32 flags;\t/* PCAP_IF_ interface flags */\n};\n\n#define PCAP_IF_LOOPBACK\t0x00000001\t/* interface is loopback */\n\n/*\n * Representation of an interface address.\n */\nstruct pcap_addr {\n\tstruct pcap_addr *next;\n\tstruct sockaddr *addr;\t\t/* address */\n\tstruct sockaddr *netmask;\t/* netmask for that address */\n\tstruct sockaddr *broadaddr;\t/* broadcast address for that address */\n\tstruct sockaddr *dstaddr;\t/* P2P destination address for that address */\n};\n\ntypedef void (*pcap_handler)(u_char *, const struct pcap_pkthdr *,\n\t\t\t     const u_char *);\n\n/*\n * Error codes for the pcap API.\n * These will all be negative, so you can check for the success or\n * failure of a call that returns these codes by checking for a\n * negative value.\n */\n#define PCAP_ERROR\t\t\t-1\t/* generic error code */\n#define PCAP_ERROR_BREAK\t\t-2\t/* loop terminated by pcap_breakloop */\n#define PCAP_ERROR_NOT_ACTIVATED\t-3\t/* the capture needs to be activated */\n#define PCAP_ERROR_ACTIVATED\t\t-4\t/* the operation can't be performed on already activated captures */\n#define PCAP_ERROR_NO_SUCH_DEVICE\t-5\t/* no such device exists */\n#define PCAP_ERROR_RFMON_NOTSUP\t\t-6\t/* this device doesn't support rfmon (monitor) mode */\n#define PCAP_ERROR_NOT_RFMON\t\t-7\t/* operation supported only in monitor mode */\n#define PCAP_ERROR_PERM_DENIED\t\t-8\t/* no permission to open the device */\n#define PCAP_ERROR_IFACE_NOT_UP\t\t-9\t/* interface isn't up */\n\n/*\n * Warning codes for the pcap API.\n * These will all be positive and non-zero, so they won't look like\n * errors.\n */\n#define PCAP_WARNING\t\t\t1\t/* generic warning code */\n#define PCAP_WARNING_PROMISC_NOTSUP\t2\t/* this device doesn't support promiscuous mode */\n\n/*\n * Value to pass to pcap_compile() as the netmask if you don't know what\n * the netmask is.\n */\n#define PCAP_NETMASK_UNKNOWN\t0xffffffff\n\nchar\t*pcap_lookupdev(char *);\nint\tpcap_lookupnet(const char *, bpf_u_int32 *, bpf_u_int32 *, char *);\n\npcap_t\t*pcap_create(const char *, char *);\nint\tpcap_set_snaplen(pcap_t *, int);\nint\tpcap_set_promisc(pcap_t *, int);\nint\tpcap_can_set_rfmon(pcap_t *);\nint\tpcap_set_rfmon(pcap_t *, int);\nint\tpcap_set_timeout(pcap_t *, int);\nint\tpcap_set_buffer_size(pcap_t *, int);\nint\tpcap_activate(pcap_t *);\n\npcap_t\t*pcap_open_live(const char *, int, int, int, char *);\npcap_t\t*pcap_open_dead(int, int);\npcap_t\t*pcap_open_offline(const char *, char *);\n#if defined(WIN32)\npcap_t  *pcap_hopen_offline(intptr_t, char *);\n#if !defined(LIBPCAP_EXPORTS)\n#define pcap_fopen_offline(f,b) \\\n\tpcap_hopen_offline(_get_osfhandle(_fileno(f)), b)\n#else /*LIBPCAP_EXPORTS*/\nstatic pcap_t *pcap_fopen_offline(FILE *, char *);\n#endif\n#else /*WIN32*/\npcap_t\t*pcap_fopen_offline(FILE *, char *);\n#endif /*WIN32*/\n\nvoid\tpcap_close(pcap_t *);\nint\tpcap_loop(pcap_t *, int, pcap_handler, u_char *);\nint\tpcap_dispatch(pcap_t *, int, pcap_handler, u_char *);\nconst u_char*\n\tpcap_next(pcap_t *, struct pcap_pkthdr *);\nint \tpcap_next_ex(pcap_t *, struct pcap_pkthdr **, const u_char **);\nvoid\tpcap_breakloop(pcap_t *);\nint\tpcap_stats(pcap_t *, struct pcap_stat *);\nint\tpcap_setfilter(pcap_t *, struct bpf_program *);\nint \tpcap_setdirection(pcap_t *, pcap_direction_t);\nint\tpcap_getnonblock(pcap_t *, char *);\nint\tpcap_setnonblock(pcap_t *, int, char *);\nint\tpcap_inject(pcap_t *, const void *, size_t);\nint\tpcap_sendpacket(pcap_t *, const u_char *, int);\nconst char *pcap_statustostr(int);\nconst char *pcap_strerror(int);\nchar\t*pcap_geterr(pcap_t *);\nvoid\tpcap_perror(pcap_t *, char *);\nint\tpcap_compile(pcap_t *, struct bpf_program *, const char *, int,\n\t    bpf_u_int32);\nint\tpcap_compile_nopcap(int, int, struct bpf_program *,\n\t    const char *, int, bpf_u_int32);\nvoid\tpcap_freecode(struct bpf_program *);\nint\tpcap_offline_filter(struct bpf_program *, const struct pcap_pkthdr *,\n\t    const u_char *);\nint\tpcap_datalink(pcap_t *);\nint\tpcap_datalink_ext(pcap_t *);\nint\tpcap_list_datalinks(pcap_t *, int **);\nint\tpcap_set_datalink(pcap_t *, int);\nvoid\tpcap_free_datalinks(int *);\nint\tpcap_datalink_name_to_val(const char *);\nconst char *pcap_datalink_val_to_name(int);\nconst char *pcap_datalink_val_to_description(int);\nint\tpcap_snapshot(pcap_t *);\nint\tpcap_is_swapped(pcap_t *);\nint\tpcap_major_version(pcap_t *);\nint\tpcap_minor_version(pcap_t *);\n\n/* XXX */\nFILE\t*pcap_file(pcap_t *);\nint\tpcap_fileno(pcap_t *);\n\npcap_dumper_t *pcap_dump_open(pcap_t *, const char *);\npcap_dumper_t *pcap_dump_fopen(pcap_t *, FILE *fp);\nFILE\t*pcap_dump_file(pcap_dumper_t *);\nlong\tpcap_dump_ftell(pcap_dumper_t *);\nint\tpcap_dump_flush(pcap_dumper_t *);\nvoid\tpcap_dump_close(pcap_dumper_t *);\nvoid\tpcap_dump(u_char *, const struct pcap_pkthdr *, const u_char *);\n\nint\tpcap_findalldevs(pcap_if_t **, char *);\nvoid\tpcap_freealldevs(pcap_if_t *);\n\nconst char *pcap_lib_version(void);\n\n/* XXX this guy lives in the bpf tree */\nu_int\tbpf_filter(struct bpf_insn *, u_char *, u_int, u_int); \nint\tbpf_validate(const struct bpf_insn *f, int len);\nchar\t*bpf_image(struct bpf_insn *, int);\nvoid\tbpf_dump(struct bpf_program *, int);\n\n#if defined(WIN32)\n\n/*\n * Win32 definitions\n */\n\nint pcap_setbuff(pcap_t *p, int dim);\nint pcap_setmode(pcap_t *p, int mode);\nint pcap_setmintocopy(pcap_t *p, int size);\n\n#ifdef WPCAP\n/* Include file with the wpcap-specific extensions */\n#include <Win32-Extensions.h>\n#endif /* WPCAP */\n\n#define MODE_CAPT 0\n#define MODE_STAT 1\n#define MODE_MON 2\n\n#elif defined(MSDOS)\n\n/*\n * MS-DOS definitions\n */\n\nint  pcap_stats_ex (pcap_t *, struct pcap_stat_ex *);\nvoid pcap_set_wait (pcap_t *p, void (*yield)(void), int wait);\nu_long pcap_mac_packets (void);\n\n#else /* UN*X */\n\n/*\n * UN*X definitions\n */\n\nint\tpcap_get_selectable_fd(pcap_t *);\n\n#endif /* WIN32/MSDOS/UN*X */\n\n#ifdef __cplusplus\n}\n#endif\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/pcap-bpf.h",
    "content": "/*-\n * Copyright (c) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997\n *\tThe Regents of the University of California.  All rights reserved.\n *\n * This code is derived from the Stanford/CMU enet packet filter,\n * (net/enet.c) distributed as part of 4.3BSD, and code contributed\n * to Berkeley by Steven McCanne and Van Jacobson both of Lawrence \n * Berkeley Laboratory.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. All advertising materials mentioning features or use of this software\n *    must display the following acknowledgement:\n *      This product includes software developed by the University of\n *      California, Berkeley and its contributors.\n * 4. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * @(#) $Header: /tcpdump/master/libpcap/pcap-bpf.h,v 1.50 2007-04-01 21:43:55 guy Exp $ (LBL)\n */\n\n/*\n * For backwards compatibility.\n *\n * Note to OS vendors: do NOT get rid of this file!  Some applications\n * might expect to be able to include <pcap-bpf.h>.\n */\n#include <pcap/bpf.h>\n"
  },
  {
    "path": "freebsd-headers/pcap-int.h",
    "content": "/*\n * Copyright (c) 1994, 1995, 1996\n *\tThe Regents of the University of California.  All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. All advertising materials mentioning features or use of this software\n *    must display the following acknowledgement:\n *\tThis product includes software developed by the Computer Systems\n *\tEngineering Group at Lawrence Berkeley Laboratory.\n * 4. Neither the name of the University nor of the Laboratory may be used\n *    to endorse or promote products derived from this software without\n *    specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * @(#) $Header: /tcpdump/master/libpcap/pcap-int.h,v 1.94 2008-09-16 00:20:23 guy Exp $ (LBL)\n */\n\n#ifndef pcap_int_h\n#define\tpcap_int_h\n\n#include <pcap/pcap.h>\n\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\n#ifdef HAVE_LIBDLPI\n#include <libdlpi.h>\n#endif\n\n#ifdef WIN32\n#include <Packet32.h>\nextern CRITICAL_SECTION g_PcapCompileCriticalSection;\n#endif /* WIN32 */\n\n#ifdef MSDOS\n#include <fcntl.h>\n#include <io.h>\n#endif\n\n#ifdef HAVE_SNF_API\n#include <snf.h>\n#endif\n\n#if (defined(_MSC_VER) && (_MSC_VER <= 1200)) /* we are compiling with Visual Studio 6, that doesn't support the LL suffix*/\n\n/*\n * Swap byte ordering of unsigned long long timestamp on a big endian\n * machine.\n */\n#define SWAPLL(ull)  ((ull & 0xff00000000000000) >> 56) | \\\n                      ((ull & 0x00ff000000000000) >> 40) | \\\n                      ((ull & 0x0000ff0000000000) >> 24) | \\\n                      ((ull & 0x000000ff00000000) >> 8)  | \\\n                      ((ull & 0x00000000ff000000) << 8)  | \\\n                      ((ull & 0x0000000000ff0000) << 24) | \\\n                      ((ull & 0x000000000000ff00) << 40) | \\\n                      ((ull & 0x00000000000000ff) << 56)\n\n#else /* A recent Visual studio compiler or not VC */\n\n/*\n * Swap byte ordering of unsigned long long timestamp on a big endian\n * machine.\n */\n#define SWAPLL(ull)  ((ull & 0xff00000000000000LL) >> 56) | \\\n                      ((ull & 0x00ff000000000000LL) >> 40) | \\\n                      ((ull & 0x0000ff0000000000LL) >> 24) | \\\n                      ((ull & 0x000000ff00000000LL) >> 8)  | \\\n                      ((ull & 0x00000000ff000000LL) << 8)  | \\\n                      ((ull & 0x0000000000ff0000LL) << 24) | \\\n                      ((ull & 0x000000000000ff00LL) << 40) | \\\n                      ((ull & 0x00000000000000ffLL) << 56)\n\n#endif /* _MSC_VER */\n\n/*\n * Savefile\n */\ntypedef enum {\n\tNOT_SWAPPED,\n\tSWAPPED,\n\tMAYBE_SWAPPED\n} swapped_type_t;\n\n/*\n * Used when reading a savefile.\n */\nstruct pcap_sf {\n\tFILE *rfile;\n\tint (*next_packet_op)(pcap_t *, struct pcap_pkthdr *, u_char **);\n\tint swapped;\n\tsize_t hdrsize;\n\tswapped_type_t lengths_swapped;\n\tint version_major;\n\tint version_minor;\n\tbpf_u_int32 ifcount;\t/* number of interfaces seen in this capture */\n\tu_int tsresol;\t\t/* time stamp resolution */\n\tu_int tsscale;\t\t/* scaling factor for resolution -> microseconds */\n\tu_int64_t tsoffset;\t/* time stamp offset */\n};\n\n/*\n * Used when doing a live capture.\n */\nstruct pcap_md {\n\tstruct pcap_stat stat;\n\t/*XXX*/\n\tint use_bpf;\t\t/* using kernel filter */\n\tu_long\tTotPkts;\t/* can't oflow for 79 hrs on ether */\n\tu_long\tTotAccepted;\t/* count accepted by filter */\n\tu_long\tTotDrops;\t/* count of dropped packets */\n\tlong\tTotMissed;\t/* missed by i/f during this run */\n\tlong\tOrigMissed;\t/* missed by i/f before this run */\n\tchar\t*device;\t/* device name */\n\tint\ttimeout;\t/* timeout for buffering */\n\tint\tmust_do_on_close; /* stuff we must do when we close */\n\tstruct pcap *next;\t/* list of open pcaps that need stuff cleared on close */\n#ifdef linux\n\tint\tsock_packet;\t/* using Linux 2.0 compatible interface */\n\tint\tcooked;\t\t/* using SOCK_DGRAM rather than SOCK_RAW */\n\tint\tifindex;\t/* interface index of device we're bound to */\n\tint\tlo_ifindex;\t/* interface index of the loopback device */\n\tu_int\tpackets_read;\t/* count of packets read with recvfrom() */\n\tbpf_u_int32 oldmode;\t/* mode to restore when turning monitor mode off */\n\tchar\t*mondevice;\t/* mac80211 monitor device we created */\n\tu_char\t*mmapbuf;\t/* memory-mapped region pointer */\n\tsize_t\tmmapbuflen;\t/* size of region */\n\tu_int\ttp_version;\t/* version of tpacket_hdr for mmaped ring */\n\tu_int\ttp_hdrlen;\t/* hdrlen of tpacket_hdr for mmaped ring */\n\tu_char\t*oneshot_buffer; /* buffer for copy of packet */\n\tlong\tproc_dropped; /* packets reported dropped by /proc/net/dev */\n#endif /* linux */\n\n#ifdef HAVE_DAG_API\n#ifdef HAVE_DAG_STREAMS_API\n\tu_char\t*dag_mem_bottom;\t/* DAG card current memory bottom pointer */\n\tu_char\t*dag_mem_top;\t/* DAG card current memory top pointer */\n#else /* HAVE_DAG_STREAMS_API */\n\tvoid\t*dag_mem_base;\t/* DAG card memory base address */\n\tu_int\tdag_mem_bottom;\t/* DAG card current memory bottom offset */\n\tu_int\tdag_mem_top;\t/* DAG card current memory top offset */\n#endif /* HAVE_DAG_STREAMS_API */\n\tint\tdag_fcs_bits;\t/* Number of checksum bits from link layer */\n\tint\tdag_offset_flags; /* Flags to pass to dag_offset(). */\n\tint\tdag_stream;\t/* DAG stream number */\n\tint\tdag_timeout;\t/* timeout specified to pcap_open_live.\n\t\t\t\t * Same as in linux above, introduce\n\t\t\t\t * generally? */\n#endif /* HAVE_DAG_API */\n#ifdef HAVE_SNF_API\n\tsnf_handle_t snf_handle; /* opaque device handle */\n\tsnf_ring_t   snf_ring;   /* opaque device ring handle */\n        int          snf_timeout;\n        int          snf_boardnum;\n#endif /*HAVE_SNF_API*/\n\n#ifdef HAVE_ZEROCOPY_BPF\n       /*\n        * Zero-copy read buffer -- for zero-copy BPF.  'buffer' above will\n        * alternative between these two actual mmap'd buffers as required.\n        * As there is a header on the front size of the mmap'd buffer, only\n        * some of the buffer is exposed to libpcap as a whole via bufsize;\n        * zbufsize is the true size.  zbuffer tracks the current zbuf\n        * assocated with buffer so that it can be used to decide which the\n        * next buffer to read will be.\n        */\n       u_char *zbuf1, *zbuf2, *zbuffer;\n       u_int zbufsize;\n       u_int zerocopy;\n       u_int interrupted;\n       struct timespec firstsel;\n       /*\n        * If there's currently a buffer being actively processed, then it is\n        * referenced here; 'buffer' is also pointed at it, but offset by the\n        * size of the header.\n        */\n       struct bpf_zbuf_header *bzh;\n#endif /* HAVE_ZEROCOPY_BPF */\n};\n\n/*\n * Stuff to do when we close.\n */\n#define MUST_CLEAR_PROMISC\t0x00000001\t/* clear promiscuous mode */\n#define MUST_CLEAR_RFMON\t0x00000002\t/* clear rfmon (monitor) mode */\n#define MUST_DELETE_MONIF\t0x00000004\t/* delete monitor-mode interface */\n\nstruct pcap_opt {\n\tint\tbuffer_size;\n\tchar\t*source;\n\tint\tpromisc;\n\tint\trfmon;\n};\n\n/*\n * Ultrix, DEC OSF/1^H^H^H^H^H^H^H^H^HDigital UNIX^H^H^H^H^H^H^H^H^H^H^H^H\n * Tru64 UNIX, and some versions of NetBSD pad FDDI packets to make everything\n * line up on a nice boundary.\n */\n#ifdef __NetBSD__\n#include <sys/param.h>\t/* needed to declare __NetBSD_Version__ */\n#endif\n\n#if defined(ultrix) || defined(__osf__) || (defined(__NetBSD__) && __NetBSD_Version__ > 106000000)\n#define       PCAP_FDDIPAD 3\n#endif\n\ntypedef int\t(*activate_op_t)(pcap_t *);\ntypedef int\t(*can_set_rfmon_op_t)(pcap_t *);\ntypedef int\t(*read_op_t)(pcap_t *, int cnt, pcap_handler, u_char *);\ntypedef int\t(*inject_op_t)(pcap_t *, const void *, size_t);\ntypedef int\t(*setfilter_op_t)(pcap_t *, struct bpf_program *);\ntypedef int\t(*setdirection_op_t)(pcap_t *, pcap_direction_t);\ntypedef int\t(*set_datalink_op_t)(pcap_t *, int);\ntypedef int\t(*getnonblock_op_t)(pcap_t *, char *);\ntypedef int\t(*setnonblock_op_t)(pcap_t *, int, char *);\ntypedef int\t(*stats_op_t)(pcap_t *, struct pcap_stat *);\n#ifdef WIN32\ntypedef int\t(*setbuff_op_t)(pcap_t *, int);\ntypedef int\t(*setmode_op_t)(pcap_t *, int);\ntypedef int\t(*setmintocopy_op_t)(pcap_t *, int);\n#endif\ntypedef void\t(*cleanup_op_t)(pcap_t *);\n\nstruct pcap {\n#ifdef WIN32\n\tADAPTER *adapter;\n\tLPPACKET Packet;\n\tint nonblock;\n#else\n\tint fd;\n\tint selectable_fd;\n\tint send_fd;\n#endif /* WIN32 */\n\n#ifdef HAVE_LIBDLPI\n\tdlpi_handle_t dlpi_hd;\n#endif\n\tint snapshot;\n\tint linktype;\t\t/* Network linktype */\n\tint linktype_ext;       /* Extended information stored in the linktype field of a file */\n\tint tzoff;\t\t/* timezone offset */\n\tint offset;\t\t/* offset for proper alignment */\n\tint activated;\t\t/* true if the capture is really started */\n\tint oldstyle;\t\t/* if we're opening with pcap_open_live() */\n\n\tint break_loop;\t\t/* flag set to force break from packet-reading loop */\n\n#ifdef PCAP_FDDIPAD\n\tint fddipad;\n#endif\n\n#ifdef MSDOS\n        void (*wait_proc)(void); /*          call proc while waiting */\n#endif\n\n\tstruct pcap_sf sf;\n\tstruct pcap_md md;\n\tstruct pcap_opt opt;\n\n\t/*\n\t * Read buffer.\n\t */\n\tint bufsize;\n\tu_char *buffer;\n\tu_char *bp;\n\tint cc;\n\n\t/*\n\t * Place holder for pcap_next().\n\t */\n\tu_char *pkt;\n\n\t/* We're accepting only packets in this direction/these directions. */\n\tpcap_direction_t direction;\n\n\t/*\n\t * Methods.\n\t */\n\tactivate_op_t activate_op;\n\tcan_set_rfmon_op_t can_set_rfmon_op;\n\tread_op_t read_op;\n\tinject_op_t inject_op;\n\tsetfilter_op_t setfilter_op;\n\tsetdirection_op_t setdirection_op;\n\tset_datalink_op_t set_datalink_op;\n\tgetnonblock_op_t getnonblock_op;\n\tsetnonblock_op_t setnonblock_op;\n\tstats_op_t stats_op;\n\n\t/*\n\t * Routine to use as callback for pcap_next()/pcap_next_ex().\n\t */\n\tpcap_handler oneshot_callback;\n\n#ifdef WIN32\n\t/*\n\t * These are, at least currently, specific to the Win32 NPF\n\t * driver.\n\t */\n\tsetbuff_op_t setbuff_op;\n\tsetmode_op_t setmode_op;\n\tsetmintocopy_op_t setmintocopy_op;\n#endif\n\tcleanup_op_t cleanup_op;\n\n\t/*\n\t * Placeholder for filter code if bpf not in kernel.\n\t */\n\tstruct bpf_program fcode;\n\n\tchar errbuf[PCAP_ERRBUF_SIZE + 1];\n\tint dlt_count;\n\tu_int *dlt_list;\n\n\tstruct pcap_pkthdr pcap_header;\t/* This is needed for the pcap_next_ex() to work */\n};\n\n/*\n * This is a timeval as stored in a savefile.\n * It has to use the same types everywhere, independent of the actual\n * `struct timeval'; `struct timeval' has 32-bit tv_sec values on some\n * platforms and 64-bit tv_sec values on other platforms, and writing\n * out native `struct timeval' values would mean files could only be\n * read on systems with the same tv_sec size as the system on which\n * the file was written.\n */\n\nstruct pcap_timeval {\n    bpf_int32 tv_sec;\t\t/* seconds */\n    bpf_int32 tv_usec;\t\t/* microseconds */\n};\n\n/*\n * This is a `pcap_pkthdr' as actually stored in a savefile.\n *\n * Do not change the format of this structure, in any way (this includes\n * changes that only affect the length of fields in this structure),\n * and do not make the time stamp anything other than seconds and\n * microseconds (e.g., seconds and nanoseconds).  Instead:\n *\n *\tintroduce a new structure for the new format;\n *\n *\tsend mail to \"tcpdump-workers@lists.tcpdump.org\", requesting\n *\ta new magic number for your new capture file format, and, when\n *\tyou get the new magic number, put it in \"savefile.c\";\n *\n *\tuse that magic number for save files with the changed record\n *\theader;\n *\n *\tmake the code in \"savefile.c\" capable of reading files with\n *\tthe old record header as well as files with the new record header\n *\t(using the magic number to determine the header format).\n *\n * Then supply the changes as a patch at\n *\n *\thttp://sourceforge.net/projects/libpcap/\n *\n * so that future versions of libpcap and programs that use it (such as\n * tcpdump) will be able to read your new capture file format.\n */\n\nstruct pcap_sf_pkthdr {\n    struct pcap_timeval ts;\t/* time stamp */\n    bpf_u_int32 caplen;\t\t/* length of portion present */\n    bpf_u_int32 len;\t\t/* length this packet (off wire) */\n};\n\n/*\n * How a `pcap_pkthdr' is actually stored in savefiles written\n * by some patched versions of libpcap (e.g. the ones in Red\n * Hat Linux 6.1 and 6.2).\n *\n * Do not change the format of this structure, in any way (this includes\n * changes that only affect the length of fields in this structure).\n * Instead, introduce a new structure, as per the above.\n */\n\nstruct pcap_sf_patched_pkthdr {\n    struct pcap_timeval ts;\t/* time stamp */\n    bpf_u_int32 caplen;\t\t/* length of portion present */\n    bpf_u_int32 len;\t\t/* length this packet (off wire) */\n    int\t\tindex;\n    unsigned short protocol;\n    unsigned char pkt_type;\n};\n\n/*\n * User data structure for the one-shot callback used for pcap_next()\n * and pcap_next_ex().\n */\nstruct oneshot_userdata {\n\tstruct pcap_pkthdr *hdr;\n\tconst u_char **pkt;\n\tpcap_t *pd;\n};\n\nint\tyylex(void);\n\n#ifndef min\n#define min(a, b) ((a) > (b) ? (b) : (a))\n#endif\n\n/* XXX should these be in pcap.h? */\nint\tpcap_offline_read(pcap_t *, int, pcap_handler, u_char *);\nint\tpcap_read(pcap_t *, int cnt, pcap_handler, u_char *);\n\n#ifndef HAVE_STRLCPY\n#define strlcpy(x, y, z) \\\n\t(strncpy((x), (y), (z)), \\\n\t ((z) <= 0 ? 0 : ((x)[(z) - 1] = '\\0')), \\\n\t strlen((y)))\n#endif\n\n#include <stdarg.h>\n\n#if !defined(HAVE_SNPRINTF)\n#define snprintf pcap_snprintf\nextern int snprintf (char *, size_t, const char *, ...);\n#endif\n\n#if !defined(HAVE_VSNPRINTF)\n#define vsnprintf pcap_vsnprintf\nextern int vsnprintf (char *, size_t, const char *, va_list ap);\n#endif\n\n/*\n * Routines that most pcap implementations can use for non-blocking mode.\n */\n#if !defined(WIN32) && !defined(MSDOS)\nint\tpcap_getnonblock_fd(pcap_t *, char *);\nint\tpcap_setnonblock_fd(pcap_t *p, int, char *);\n#endif\n\npcap_t\t*pcap_create_common(const char *, char *);\nint\tpcap_do_addexit(pcap_t *);\nvoid\tpcap_add_to_pcaps_to_close(pcap_t *);\nvoid\tpcap_remove_from_pcaps_to_close(pcap_t *);\nvoid\tpcap_cleanup_live_common(pcap_t *);\nint\tpcap_not_initialized(pcap_t *);\nint\tpcap_check_activated(pcap_t *);\n\n/*\n * Internal interfaces for \"pcap_findalldevs()\".\n *\n * \"pcap_platform_finddevs()\" is a platform-dependent routine to\n * add devices not found by the \"standard\" mechanisms (SIOCGIFCONF,\n * \"getifaddrs()\", etc..\n *\n * \"pcap_add_if()\" adds an interface to the list of interfaces.\n */\nint\tpcap_platform_finddevs(pcap_if_t **, char *);\nint\tadd_addr_to_iflist(pcap_if_t **, const char *, u_int, struct sockaddr *,\n\t    size_t, struct sockaddr *, size_t, struct sockaddr *, size_t,\n\t    struct sockaddr *, size_t, char *);\nint\tpcap_add_if(pcap_if_t **, const char *, u_int, const char *, char *);\nstruct sockaddr *dup_sockaddr(struct sockaddr *, size_t);\nint\tadd_or_find_if(pcap_if_t **, pcap_if_t **, const char *, u_int,\n\t    const char *, char *);\n\n#ifdef WIN32\nchar\t*pcap_win32strerror(void);\n#endif\n\nint\tinstall_bpf_program(pcap_t *, struct bpf_program *);\n\nint\tpcap_strcasecmp(const char *, const char *);\n\n#ifdef __cplusplus\n}\n#endif\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/pcap-namedb.h",
    "content": "/*\n * Copyright (c) 1994, 1996\n *\tThe Regents of the University of California.  All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. All advertising materials mentioning features or use of this software\n *    must display the following acknowledgement:\n *\tThis product includes software developed by the Computer Systems\n *\tEngineering Group at Lawrence Berkeley Laboratory.\n * 4. Neither the name of the University nor of the Laboratory may be used\n *    to endorse or promote products derived from this software without\n *    specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * @(#) $Header: /tcpdump/master/libpcap/pcap-namedb.h,v 1.13 2006-10-04 18:13:32 guy Exp $ (LBL)\n */\n\n/*\n * For backwards compatibility.\n *\n * Note to OS vendors: do NOT get rid of this file!  Some applications\n * might expect to be able to include <pcap-namedb.h>.\n */\n#include <pcap/namedb.h>\n"
  },
  {
    "path": "freebsd-headers/pcap.h",
    "content": "/*\n * Copyright (c) 1993, 1994, 1995, 1996, 1997\n *\tThe Regents of the University of California.  All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. All advertising materials mentioning features or use of this software\n *    must display the following acknowledgement:\n *\tThis product includes software developed by the Computer Systems\n *\tEngineering Group at Lawrence Berkeley Laboratory.\n * 4. Neither the name of the University nor of the Laboratory may be used\n *    to endorse or promote products derived from this software without\n *    specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * @(#) $Header: /tcpdump/master/libpcap/pcap.h,v 1.59 2006-10-04 18:09:22 guy Exp $ (LBL)\n */\n\n/*\n * For backwards compatibility.\n *\n * Note to OS vendors: do NOT get rid of this file!  Many applications\n * expect to be able to include <pcap.h>, and at least some of them\n * go through contortions in their configure scripts to try to detect\n * OSes that have \"helpfully\" moved pcap.h to <pcap/pcap.h> without\n * leaving behind a <pcap.h> file.\n */\n#include <pcap/pcap.h>\n"
  },
  {
    "path": "freebsd-headers/pkcs10_asn1.h",
    "content": "/* Generated from /usr/src/kerberos5/lib/libhx509/../../../crypto/heimdal/lib/hx509/pkcs10.asn1 */\n/* Do not edit */\n\n#ifndef __pkcs10_asn1_h__\n#define __pkcs10_asn1_h__\n\n#include <stddef.h>\n#include <time.h>\n\n#ifndef __asn1_common_definitions__\n#define __asn1_common_definitions__\n\ntypedef struct heim_integer {\n  size_t length;\n  void *data;\n  int negative;\n} heim_integer;\n\ntypedef struct heim_octet_string {\n  size_t length;\n  void *data;\n} heim_octet_string;\n\ntypedef char *heim_general_string;\n\ntypedef char *heim_utf8_string;\n\ntypedef char *heim_printable_string;\n\ntypedef char *heim_ia5_string;\n\ntypedef struct heim_bmp_string {\n  size_t length;\n  uint16_t *data;\n} heim_bmp_string;\n\ntypedef struct heim_universal_string {\n  size_t length;\n  uint32_t *data;\n} heim_universal_string;\n\ntypedef char *heim_visible_string;\n\ntypedef struct heim_oid {\n  size_t length;\n  unsigned *components;\n} heim_oid;\n\ntypedef struct heim_bit_string {\n  size_t length;\n  void *data;\n} heim_bit_string;\n\ntypedef struct heim_octet_string heim_any;\ntypedef struct heim_octet_string heim_any_set;\n\n#define ASN1_MALLOC_ENCODE(T, B, BL, S, L, R)                  \\\n  do {                                                         \\\n    (BL) = length_##T((S));                                    \\\n    (B) = malloc((BL));                                        \\\n    if((B) == NULL) {                                          \\\n      (R) = ENOMEM;                                            \\\n    } else {                                                   \\\n      (R) = encode_##T(((unsigned char*)(B)) + (BL) - 1, (BL), \\\n                       (S), (L));                              \\\n      if((R) != 0) {                                           \\\n        free((B));                                             \\\n        (B) = NULL;                                            \\\n      }                                                        \\\n    }                                                          \\\n  } while (0)\n\nstruct units;\n\n#endif\n\n#include <rfc2459_asn1.h>\n/*\nCertificationRequestInfo ::= SEQUENCE {\n  version         INTEGER {\n    pkcs10_v1(0)\n  },\n  subject         Name,\n  subjectPKInfo   SubjectPublicKeyInfo,\n  attributes      [0] IMPLICIT SET OF Attribute OPTIONAL,\n}\n*/\n\ntypedef struct CertificationRequestInfo {\n  enum  {\n    pkcs10_v1 = 0\n} version;\n  Name subject;\n  SubjectPublicKeyInfo subjectPKInfo;\n  struct  {\n    unsigned int len;\n    Attribute *val;\n  } *attributes;\n} CertificationRequestInfo;\n\nint    encode_CertificationRequestInfo(unsigned char *, size_t, const CertificationRequestInfo *, size_t *);\nint    decode_CertificationRequestInfo(const unsigned char *, size_t, CertificationRequestInfo *, size_t *);\nvoid   free_CertificationRequestInfo  (CertificationRequestInfo *);\nsize_t length_CertificationRequestInfo(const CertificationRequestInfo *);\nint    copy_CertificationRequestInfo  (const CertificationRequestInfo *, CertificationRequestInfo *);\n\n\n/*\nCertificationRequest ::= SEQUENCE {\n  certificationRequestInfo   CertificationRequestInfo,\n  signatureAlgorithm         AlgorithmIdentifier,\n  signature                    BIT STRING {\n  },\n}\n*/\n\ntypedef struct CertificationRequest {\n  CertificationRequestInfo certificationRequestInfo;\n  AlgorithmIdentifier signatureAlgorithm;\n  heim_bit_string signature;\n} CertificationRequest;\n\nint    encode_CertificationRequest(unsigned char *, size_t, const CertificationRequest *, size_t *);\nint    decode_CertificationRequest(const unsigned char *, size_t, CertificationRequest *, size_t *);\nvoid   free_CertificationRequest  (CertificationRequest *);\nsize_t length_CertificationRequest(const CertificationRequest *);\nint    copy_CertificationRequest  (const CertificationRequest *, CertificationRequest *);\n\n\n#endif /* __pkcs10_asn1_h__ */\n"
  },
  {
    "path": "freebsd-headers/pkcs12_asn1.h",
    "content": "/* Generated from /usr/src/kerberos5/lib/libasn1/../../../crypto/heimdal/lib/asn1/pkcs12.asn1 */\n/* Do not edit */\n\n#ifndef __pkcs12_asn1_h__\n#define __pkcs12_asn1_h__\n\n#include <stddef.h>\n#include <time.h>\n\n#ifndef __asn1_common_definitions__\n#define __asn1_common_definitions__\n\ntypedef struct heim_integer {\n  size_t length;\n  void *data;\n  int negative;\n} heim_integer;\n\ntypedef struct heim_octet_string {\n  size_t length;\n  void *data;\n} heim_octet_string;\n\ntypedef char *heim_general_string;\n\ntypedef char *heim_utf8_string;\n\ntypedef char *heim_printable_string;\n\ntypedef char *heim_ia5_string;\n\ntypedef struct heim_bmp_string {\n  size_t length;\n  uint16_t *data;\n} heim_bmp_string;\n\ntypedef struct heim_universal_string {\n  size_t length;\n  uint32_t *data;\n} heim_universal_string;\n\ntypedef char *heim_visible_string;\n\ntypedef struct heim_oid {\n  size_t length;\n  unsigned *components;\n} heim_oid;\n\ntypedef struct heim_bit_string {\n  size_t length;\n  void *data;\n} heim_bit_string;\n\ntypedef struct heim_octet_string heim_any;\ntypedef struct heim_octet_string heim_any_set;\n\n#define ASN1_MALLOC_ENCODE(T, B, BL, S, L, R)                  \\\n  do {                                                         \\\n    (BL) = length_##T((S));                                    \\\n    (B) = malloc((BL));                                        \\\n    if((B) == NULL) {                                          \\\n      (R) = ENOMEM;                                            \\\n    } else {                                                   \\\n      (R) = encode_##T(((unsigned char*)(B)) + (BL) - 1, (BL), \\\n                       (S), (L));                              \\\n      if((R) != 0) {                                           \\\n        free((B));                                             \\\n        (B) = NULL;                                            \\\n      }                                                        \\\n    }                                                          \\\n  } while (0)\n\nstruct units;\n\n#endif\n\n#include <cms_asn1.h>\n#include <rfc2459_asn1.h>\n#include <heim_asn1.h>\n/* OBJECT IDENTIFIER id-pkcs-12 ::= { iso(1) member-body(2) us(840) rsadsi(113549) pkcs(1) pkcs-12(12) } */\nconst heim_oid *oid_id_pkcs_12(void);\n\n/* OBJECT IDENTIFIER id-pkcs-12PbeIds ::= { iso(1) member-body(2) us(840) rsadsi(113549) pkcs(1) pkcs-12(12) label-less(1) } */\nconst heim_oid *oid_id_pkcs_12PbeIds(void);\n\n/* OBJECT IDENTIFIER id-pbeWithSHAAnd128BitRC4 ::= { iso(1) member-body(2) us(840) rsadsi(113549) pkcs(1) pkcs-12(12) label-less(1) label-less(1) } */\nconst heim_oid *oid_id_pbeWithSHAAnd128BitRC4(void);\n\n/* OBJECT IDENTIFIER id-pbeWithSHAAnd40BitRC4 ::= { iso(1) member-body(2) us(840) rsadsi(113549) pkcs(1) pkcs-12(12) label-less(1) label-less(2) } */\nconst heim_oid *oid_id_pbeWithSHAAnd40BitRC4(void);\n\n/* OBJECT IDENTIFIER id-pbeWithSHAAnd3-KeyTripleDES-CBC ::= { iso(1) member-body(2) us(840) rsadsi(113549) pkcs(1) pkcs-12(12) label-less(1) label-less(3) } */\nconst heim_oid *oid_id_pbeWithSHAAnd3_KeyTripleDES_CBC(void);\n\n/* OBJECT IDENTIFIER id-pbeWithSHAAnd2-KeyTripleDES-CBC ::= { iso(1) member-body(2) us(840) rsadsi(113549) pkcs(1) pkcs-12(12) label-less(1) label-less(4) } */\nconst heim_oid *oid_id_pbeWithSHAAnd2_KeyTripleDES_CBC(void);\n\n/* OBJECT IDENTIFIER id-pbeWithSHAAnd128BitRC2-CBC ::= { iso(1) member-body(2) us(840) rsadsi(113549) pkcs(1) pkcs-12(12) label-less(1) label-less(5) } */\nconst heim_oid *oid_id_pbeWithSHAAnd128BitRC2_CBC(void);\n\n/* OBJECT IDENTIFIER id-pbewithSHAAnd40BitRC2-CBC ::= { iso(1) member-body(2) us(840) rsadsi(113549) pkcs(1) pkcs-12(12) label-less(1) label-less(6) } */\nconst heim_oid *oid_id_pbewithSHAAnd40BitRC2_CBC(void);\n\n/* OBJECT IDENTIFIER id-pkcs12-bagtypes ::= { iso(1) member-body(2) us(840) rsadsi(113549) pkcs(1) pkcs-12(12) label-less(10) label-less(1) } */\nconst heim_oid *oid_id_pkcs12_bagtypes(void);\n\n/* OBJECT IDENTIFIER id-pkcs12-keyBag ::= { iso(1) member-body(2) us(840) rsadsi(113549) pkcs(1) pkcs-12(12) label-less(10) label-less(1) label-less(1) } */\nconst heim_oid *oid_id_pkcs12_keyBag(void);\n\n/* OBJECT IDENTIFIER id-pkcs12-pkcs8ShroudedKeyBag ::= { iso(1) member-body(2) us(840) rsadsi(113549) pkcs(1) pkcs-12(12) label-less(10) label-less(1) label-less(2) } */\nconst heim_oid *oid_id_pkcs12_pkcs8ShroudedKeyBag(void);\n\n/* OBJECT IDENTIFIER id-pkcs12-certBag ::= { iso(1) member-body(2) us(840) rsadsi(113549) pkcs(1) pkcs-12(12) label-less(10) label-less(1) label-less(3) } */\nconst heim_oid *oid_id_pkcs12_certBag(void);\n\n/* OBJECT IDENTIFIER id-pkcs12-crlBag ::= { iso(1) member-body(2) us(840) rsadsi(113549) pkcs(1) pkcs-12(12) label-less(10) label-less(1) label-less(4) } */\nconst heim_oid *oid_id_pkcs12_crlBag(void);\n\n/* OBJECT IDENTIFIER id-pkcs12-secretBag ::= { iso(1) member-body(2) us(840) rsadsi(113549) pkcs(1) pkcs-12(12) label-less(10) label-less(1) label-less(5) } */\nconst heim_oid *oid_id_pkcs12_secretBag(void);\n\n/* OBJECT IDENTIFIER id-pkcs12-safeContentsBag ::= { iso(1) member-body(2) us(840) rsadsi(113549) pkcs(1) pkcs-12(12) label-less(10) label-less(1) label-less(6) } */\nconst heim_oid *oid_id_pkcs12_safeContentsBag(void);\n\n/*\nPKCS12-MacData ::= SEQUENCE {\n  mac             DigestInfo,\n  macSalt         OCTET STRING,\n  iterations      INTEGER OPTIONAL,\n}\n*/\n\ntypedef struct PKCS12_MacData {\n  DigestInfo mac;\n  heim_octet_string macSalt;\n  heim_integer *iterations;\n} PKCS12_MacData;\n\nint    encode_PKCS12_MacData(unsigned char *, size_t, const PKCS12_MacData *, size_t *);\nint    decode_PKCS12_MacData(const unsigned char *, size_t, PKCS12_MacData *, size_t *);\nvoid   free_PKCS12_MacData  (PKCS12_MacData *);\nsize_t length_PKCS12_MacData(const PKCS12_MacData *);\nint    copy_PKCS12_MacData  (const PKCS12_MacData *, PKCS12_MacData *);\n\n\n/*\nPKCS12-PFX ::= SEQUENCE {\n  version         INTEGER,\n  authSafe        ContentInfo,\n  macData         PKCS12-MacData OPTIONAL,\n}\n*/\n\ntypedef struct PKCS12_PFX {\n  heim_integer version;\n  ContentInfo authSafe;\n  PKCS12_MacData *macData;\n} PKCS12_PFX;\n\nint    encode_PKCS12_PFX(unsigned char *, size_t, const PKCS12_PFX *, size_t *);\nint    decode_PKCS12_PFX(const unsigned char *, size_t, PKCS12_PFX *, size_t *);\nvoid   free_PKCS12_PFX  (PKCS12_PFX *);\nsize_t length_PKCS12_PFX(const PKCS12_PFX *);\nint    copy_PKCS12_PFX  (const PKCS12_PFX *, PKCS12_PFX *);\n\n\n/*\nPKCS12-AuthenticatedSafe ::= SEQUENCE OF ContentInfo\n*/\n\ntypedef struct PKCS12_AuthenticatedSafe {\n  unsigned int len;\n  ContentInfo *val;\n} PKCS12_AuthenticatedSafe;\n\nint    encode_PKCS12_AuthenticatedSafe(unsigned char *, size_t, const PKCS12_AuthenticatedSafe *, size_t *);\nint    decode_PKCS12_AuthenticatedSafe(const unsigned char *, size_t, PKCS12_AuthenticatedSafe *, size_t *);\nvoid   free_PKCS12_AuthenticatedSafe  (PKCS12_AuthenticatedSafe *);\nsize_t length_PKCS12_AuthenticatedSafe(const PKCS12_AuthenticatedSafe *);\nint    copy_PKCS12_AuthenticatedSafe  (const PKCS12_AuthenticatedSafe *, PKCS12_AuthenticatedSafe *);\n\n\n/*\nPKCS12-Attribute ::= SEQUENCE {\n  attrId            OBJECT IDENTIFIER,\n  attrValues      heim_any_set,\n}\n*/\n\ntypedef struct PKCS12_Attribute {\n  heim_oid attrId;\n  heim_any_set attrValues;\n} PKCS12_Attribute;\n\nint    encode_PKCS12_Attribute(unsigned char *, size_t, const PKCS12_Attribute *, size_t *);\nint    decode_PKCS12_Attribute(const unsigned char *, size_t, PKCS12_Attribute *, size_t *);\nvoid   free_PKCS12_Attribute  (PKCS12_Attribute *);\nsize_t length_PKCS12_Attribute(const PKCS12_Attribute *);\nint    copy_PKCS12_Attribute  (const PKCS12_Attribute *, PKCS12_Attribute *);\n\n\n/*\nPKCS12-Attributes ::= SET OF PKCS12-Attribute\n*/\n\ntypedef struct PKCS12_Attributes {\n  unsigned int len;\n  PKCS12_Attribute *val;\n} PKCS12_Attributes;\n\nint    encode_PKCS12_Attributes(unsigned char *, size_t, const PKCS12_Attributes *, size_t *);\nint    decode_PKCS12_Attributes(const unsigned char *, size_t, PKCS12_Attributes *, size_t *);\nvoid   free_PKCS12_Attributes  (PKCS12_Attributes *);\nsize_t length_PKCS12_Attributes(const PKCS12_Attributes *);\nint    copy_PKCS12_Attributes  (const PKCS12_Attributes *, PKCS12_Attributes *);\n\n\n/*\nPKCS12-SafeBag ::= SEQUENCE {\n  bagId             OBJECT IDENTIFIER,\n  bagValue        [0] heim_any,\n  bagAttributes   PKCS12-Attributes OPTIONAL,\n}\n*/\n\ntypedef struct PKCS12_SafeBag {\n  heim_oid bagId;\n  heim_any bagValue;\n  PKCS12_Attributes *bagAttributes;\n} PKCS12_SafeBag;\n\nint    encode_PKCS12_SafeBag(unsigned char *, size_t, const PKCS12_SafeBag *, size_t *);\nint    decode_PKCS12_SafeBag(const unsigned char *, size_t, PKCS12_SafeBag *, size_t *);\nvoid   free_PKCS12_SafeBag  (PKCS12_SafeBag *);\nsize_t length_PKCS12_SafeBag(const PKCS12_SafeBag *);\nint    copy_PKCS12_SafeBag  (const PKCS12_SafeBag *, PKCS12_SafeBag *);\n\n\n/*\nPKCS12-SafeContents ::= SEQUENCE OF PKCS12-SafeBag\n*/\n\ntypedef struct PKCS12_SafeContents {\n  unsigned int len;\n  PKCS12_SafeBag *val;\n} PKCS12_SafeContents;\n\nint    encode_PKCS12_SafeContents(unsigned char *, size_t, const PKCS12_SafeContents *, size_t *);\nint    decode_PKCS12_SafeContents(const unsigned char *, size_t, PKCS12_SafeContents *, size_t *);\nvoid   free_PKCS12_SafeContents  (PKCS12_SafeContents *);\nsize_t length_PKCS12_SafeContents(const PKCS12_SafeContents *);\nint    copy_PKCS12_SafeContents  (const PKCS12_SafeContents *, PKCS12_SafeContents *);\n\n\n/*\nPKCS12-CertBag ::= SEQUENCE {\n  certType          OBJECT IDENTIFIER,\n  certValue       [0] heim_any,\n}\n*/\n\ntypedef struct PKCS12_CertBag {\n  heim_oid certType;\n  heim_any certValue;\n} PKCS12_CertBag;\n\nint    encode_PKCS12_CertBag(unsigned char *, size_t, const PKCS12_CertBag *, size_t *);\nint    decode_PKCS12_CertBag(const unsigned char *, size_t, PKCS12_CertBag *, size_t *);\nvoid   free_PKCS12_CertBag  (PKCS12_CertBag *);\nsize_t length_PKCS12_CertBag(const PKCS12_CertBag *);\nint    copy_PKCS12_CertBag  (const PKCS12_CertBag *, PKCS12_CertBag *);\n\n\n/*\nPKCS12-PBEParams ::= SEQUENCE {\n  salt            OCTET STRING,\n  iterations      INTEGER (0..-1) OPTIONAL,\n}\n*/\n\ntypedef struct PKCS12_PBEParams {\n  heim_octet_string salt;\n  unsigned int *iterations;\n} PKCS12_PBEParams;\n\nint    encode_PKCS12_PBEParams(unsigned char *, size_t, const PKCS12_PBEParams *, size_t *);\nint    decode_PKCS12_PBEParams(const unsigned char *, size_t, PKCS12_PBEParams *, size_t *);\nvoid   free_PKCS12_PBEParams  (PKCS12_PBEParams *);\nsize_t length_PKCS12_PBEParams(const PKCS12_PBEParams *);\nint    copy_PKCS12_PBEParams  (const PKCS12_PBEParams *, PKCS12_PBEParams *);\n\n\n/*\nPKCS12-OctetString ::= OCTET STRING\n*/\n\ntypedef heim_octet_string PKCS12_OctetString;\n\nint    encode_PKCS12_OctetString(unsigned char *, size_t, const PKCS12_OctetString *, size_t *);\nint    decode_PKCS12_OctetString(const unsigned char *, size_t, PKCS12_OctetString *, size_t *);\nvoid   free_PKCS12_OctetString  (PKCS12_OctetString *);\nsize_t length_PKCS12_OctetString(const PKCS12_OctetString *);\nint    copy_PKCS12_OctetString  (const PKCS12_OctetString *, PKCS12_OctetString *);\n\n\n#endif /* __pkcs12_asn1_h__ */\n"
  },
  {
    "path": "freebsd-headers/pkcs8_asn1.h",
    "content": "/* Generated from /usr/src/kerberos5/lib/libasn1/../../../crypto/heimdal/lib/asn1/pkcs8.asn1 */\n/* Do not edit */\n\n#ifndef __pkcs8_asn1_h__\n#define __pkcs8_asn1_h__\n\n#include <stddef.h>\n#include <time.h>\n\n#ifndef __asn1_common_definitions__\n#define __asn1_common_definitions__\n\ntypedef struct heim_integer {\n  size_t length;\n  void *data;\n  int negative;\n} heim_integer;\n\ntypedef struct heim_octet_string {\n  size_t length;\n  void *data;\n} heim_octet_string;\n\ntypedef char *heim_general_string;\n\ntypedef char *heim_utf8_string;\n\ntypedef char *heim_printable_string;\n\ntypedef char *heim_ia5_string;\n\ntypedef struct heim_bmp_string {\n  size_t length;\n  uint16_t *data;\n} heim_bmp_string;\n\ntypedef struct heim_universal_string {\n  size_t length;\n  uint32_t *data;\n} heim_universal_string;\n\ntypedef char *heim_visible_string;\n\ntypedef struct heim_oid {\n  size_t length;\n  unsigned *components;\n} heim_oid;\n\ntypedef struct heim_bit_string {\n  size_t length;\n  void *data;\n} heim_bit_string;\n\ntypedef struct heim_octet_string heim_any;\ntypedef struct heim_octet_string heim_any_set;\n\n#define ASN1_MALLOC_ENCODE(T, B, BL, S, L, R)                  \\\n  do {                                                         \\\n    (BL) = length_##T((S));                                    \\\n    (B) = malloc((BL));                                        \\\n    if((B) == NULL) {                                          \\\n      (R) = ENOMEM;                                            \\\n    } else {                                                   \\\n      (R) = encode_##T(((unsigned char*)(B)) + (BL) - 1, (BL), \\\n                       (S), (L));                              \\\n      if((R) != 0) {                                           \\\n        free((B));                                             \\\n        (B) = NULL;                                            \\\n      }                                                        \\\n    }                                                          \\\n  } while (0)\n\nstruct units;\n\n#endif\n\n#include <rfc2459_asn1.h>\n#include <heim_asn1.h>\n/*\nPKCS8PrivateKeyAlgorithmIdentifier ::= AlgorithmIdentifier\n*/\n\ntypedef AlgorithmIdentifier PKCS8PrivateKeyAlgorithmIdentifier;\n\nint    encode_PKCS8PrivateKeyAlgorithmIdentifier(unsigned char *, size_t, const PKCS8PrivateKeyAlgorithmIdentifier *, size_t *);\nint    decode_PKCS8PrivateKeyAlgorithmIdentifier(const unsigned char *, size_t, PKCS8PrivateKeyAlgorithmIdentifier *, size_t *);\nvoid   free_PKCS8PrivateKeyAlgorithmIdentifier  (PKCS8PrivateKeyAlgorithmIdentifier *);\nsize_t length_PKCS8PrivateKeyAlgorithmIdentifier(const PKCS8PrivateKeyAlgorithmIdentifier *);\nint    copy_PKCS8PrivateKeyAlgorithmIdentifier  (const PKCS8PrivateKeyAlgorithmIdentifier *, PKCS8PrivateKeyAlgorithmIdentifier *);\n\n\n/*\nPKCS8PrivateKey ::= OCTET STRING\n*/\n\ntypedef heim_octet_string PKCS8PrivateKey;\n\nint    encode_PKCS8PrivateKey(unsigned char *, size_t, const PKCS8PrivateKey *, size_t *);\nint    decode_PKCS8PrivateKey(const unsigned char *, size_t, PKCS8PrivateKey *, size_t *);\nvoid   free_PKCS8PrivateKey  (PKCS8PrivateKey *);\nsize_t length_PKCS8PrivateKey(const PKCS8PrivateKey *);\nint    copy_PKCS8PrivateKey  (const PKCS8PrivateKey *, PKCS8PrivateKey *);\n\n\n/*\nPKCS8Attributes ::= SET OF Attribute\n*/\n\ntypedef struct PKCS8Attributes {\n  unsigned int len;\n  Attribute *val;\n} PKCS8Attributes;\n\nint    encode_PKCS8Attributes(unsigned char *, size_t, const PKCS8Attributes *, size_t *);\nint    decode_PKCS8Attributes(const unsigned char *, size_t, PKCS8Attributes *, size_t *);\nvoid   free_PKCS8Attributes  (PKCS8Attributes *);\nsize_t length_PKCS8Attributes(const PKCS8Attributes *);\nint    copy_PKCS8Attributes  (const PKCS8Attributes *, PKCS8Attributes *);\n\n\n/*\nPKCS8PrivateKeyInfo ::= SEQUENCE {\n  version               INTEGER,\n  privateKeyAlgorithm   PKCS8PrivateKeyAlgorithmIdentifier,\n  privateKey            PKCS8PrivateKey,\n  attributes            [0] IMPLICIT SET OF Attribute OPTIONAL,\n}\n*/\n\ntypedef struct PKCS8PrivateKeyInfo {\n  heim_integer version;\n  PKCS8PrivateKeyAlgorithmIdentifier privateKeyAlgorithm;\n  PKCS8PrivateKey privateKey;\n  struct  {\n    unsigned int len;\n    Attribute *val;\n  } *attributes;\n} PKCS8PrivateKeyInfo;\n\nint    encode_PKCS8PrivateKeyInfo(unsigned char *, size_t, const PKCS8PrivateKeyInfo *, size_t *);\nint    decode_PKCS8PrivateKeyInfo(const unsigned char *, size_t, PKCS8PrivateKeyInfo *, size_t *);\nvoid   free_PKCS8PrivateKeyInfo  (PKCS8PrivateKeyInfo *);\nsize_t length_PKCS8PrivateKeyInfo(const PKCS8PrivateKeyInfo *);\nint    copy_PKCS8PrivateKeyInfo  (const PKCS8PrivateKeyInfo *, PKCS8PrivateKeyInfo *);\n\n\n/*\nPKCS8EncryptedData ::= OCTET STRING\n*/\n\ntypedef heim_octet_string PKCS8EncryptedData;\n\nint    encode_PKCS8EncryptedData(unsigned char *, size_t, const PKCS8EncryptedData *, size_t *);\nint    decode_PKCS8EncryptedData(const unsigned char *, size_t, PKCS8EncryptedData *, size_t *);\nvoid   free_PKCS8EncryptedData  (PKCS8EncryptedData *);\nsize_t length_PKCS8EncryptedData(const PKCS8EncryptedData *);\nint    copy_PKCS8EncryptedData  (const PKCS8EncryptedData *, PKCS8EncryptedData *);\n\n\n/*\nPKCS8EncryptedPrivateKeyInfo ::= SEQUENCE {\n  encryptionAlgorithm   AlgorithmIdentifier,\n  encryptedData         PKCS8EncryptedData,\n}\n*/\n\ntypedef struct PKCS8EncryptedPrivateKeyInfo {\n  AlgorithmIdentifier encryptionAlgorithm;\n  PKCS8EncryptedData encryptedData;\n} PKCS8EncryptedPrivateKeyInfo;\n\nint    encode_PKCS8EncryptedPrivateKeyInfo(unsigned char *, size_t, const PKCS8EncryptedPrivateKeyInfo *, size_t *);\nint    decode_PKCS8EncryptedPrivateKeyInfo(const unsigned char *, size_t, PKCS8EncryptedPrivateKeyInfo *, size_t *);\nvoid   free_PKCS8EncryptedPrivateKeyInfo  (PKCS8EncryptedPrivateKeyInfo *);\nsize_t length_PKCS8EncryptedPrivateKeyInfo(const PKCS8EncryptedPrivateKeyInfo *);\nint    copy_PKCS8EncryptedPrivateKeyInfo  (const PKCS8EncryptedPrivateKeyInfo *, PKCS8EncryptedPrivateKeyInfo *);\n\n\n#endif /* __pkcs8_asn1_h__ */\n"
  },
  {
    "path": "freebsd-headers/pkcs9_asn1.h",
    "content": "/* Generated from /usr/src/kerberos5/lib/libasn1/../../../crypto/heimdal/lib/asn1/pkcs9.asn1 */\n/* Do not edit */\n\n#ifndef __pkcs9_asn1_h__\n#define __pkcs9_asn1_h__\n\n#include <stddef.h>\n#include <time.h>\n\n#ifndef __asn1_common_definitions__\n#define __asn1_common_definitions__\n\ntypedef struct heim_integer {\n  size_t length;\n  void *data;\n  int negative;\n} heim_integer;\n\ntypedef struct heim_octet_string {\n  size_t length;\n  void *data;\n} heim_octet_string;\n\ntypedef char *heim_general_string;\n\ntypedef char *heim_utf8_string;\n\ntypedef char *heim_printable_string;\n\ntypedef char *heim_ia5_string;\n\ntypedef struct heim_bmp_string {\n  size_t length;\n  uint16_t *data;\n} heim_bmp_string;\n\ntypedef struct heim_universal_string {\n  size_t length;\n  uint32_t *data;\n} heim_universal_string;\n\ntypedef char *heim_visible_string;\n\ntypedef struct heim_oid {\n  size_t length;\n  unsigned *components;\n} heim_oid;\n\ntypedef struct heim_bit_string {\n  size_t length;\n  void *data;\n} heim_bit_string;\n\ntypedef struct heim_octet_string heim_any;\ntypedef struct heim_octet_string heim_any_set;\n\n#define ASN1_MALLOC_ENCODE(T, B, BL, S, L, R)                  \\\n  do {                                                         \\\n    (BL) = length_##T((S));                                    \\\n    (B) = malloc((BL));                                        \\\n    if((B) == NULL) {                                          \\\n      (R) = ENOMEM;                                            \\\n    } else {                                                   \\\n      (R) = encode_##T(((unsigned char*)(B)) + (BL) - 1, (BL), \\\n                       (S), (L));                              \\\n      if((R) != 0) {                                           \\\n        free((B));                                             \\\n        (B) = NULL;                                            \\\n      }                                                        \\\n    }                                                          \\\n  } while (0)\n\nstruct units;\n\n#endif\n\n/* OBJECT IDENTIFIER id-pkcs-9 ::= { iso(1) member-body(2) us(840) rsadsi(113549) pkcs(1) pkcs-9(9) } */\nconst heim_oid *oid_id_pkcs_9(void);\n\n/* OBJECT IDENTIFIER id-pkcs9-emailAddress ::= { iso(1) member-body(2) us(840) rsadsi(113549) pkcs(1) pkcs-9(9) label-less(1) } */\nconst heim_oid *oid_id_pkcs9_emailAddress(void);\n\n/* OBJECT IDENTIFIER id-pkcs9-contentType ::= { iso(1) member-body(2) us(840) rsadsi(113549) pkcs(1) pkcs-9(9) label-less(3) } */\nconst heim_oid *oid_id_pkcs9_contentType(void);\n\n/* OBJECT IDENTIFIER id-pkcs9-messageDigest ::= { iso(1) member-body(2) us(840) rsadsi(113549) pkcs(1) pkcs-9(9) label-less(4) } */\nconst heim_oid *oid_id_pkcs9_messageDigest(void);\n\n/* OBJECT IDENTIFIER id-pkcs9-signingTime ::= { iso(1) member-body(2) us(840) rsadsi(113549) pkcs(1) pkcs-9(9) label-less(5) } */\nconst heim_oid *oid_id_pkcs9_signingTime(void);\n\n/* OBJECT IDENTIFIER id-pkcs9-countersignature ::= { iso(1) member-body(2) us(840) rsadsi(113549) pkcs(1) pkcs-9(9) label-less(6) } */\nconst heim_oid *oid_id_pkcs9_countersignature(void);\n\n/* OBJECT IDENTIFIER id-pkcs-9-at-friendlyName ::= { iso(1) member-body(2) us(840) rsadsi(113549) pkcs(1) pkcs-9(9) label-less(20) } */\nconst heim_oid *oid_id_pkcs_9_at_friendlyName(void);\n\n/* OBJECT IDENTIFIER id-pkcs-9-at-localKeyId ::= { iso(1) member-body(2) us(840) rsadsi(113549) pkcs(1) pkcs-9(9) label-less(21) } */\nconst heim_oid *oid_id_pkcs_9_at_localKeyId(void);\n\n/* OBJECT IDENTIFIER id-pkcs-9-at-certTypes ::= { iso(1) member-body(2) us(840) rsadsi(113549) pkcs(1) pkcs-9(9) label-less(22) } */\nconst heim_oid *oid_id_pkcs_9_at_certTypes(void);\n\n/* OBJECT IDENTIFIER id-pkcs-9-at-certTypes-x509 ::= { iso(1) member-body(2) us(840) rsadsi(113549) pkcs(1) pkcs-9(9) label-less(22) label-less(1) } */\nconst heim_oid *oid_id_pkcs_9_at_certTypes_x509(void);\n\n/*\nPKCS9-BMPString ::= BMPString\n*/\n\ntypedef heim_bmp_string PKCS9_BMPString;\n\nint    encode_PKCS9_BMPString(unsigned char *, size_t, const PKCS9_BMPString *, size_t *);\nint    decode_PKCS9_BMPString(const unsigned char *, size_t, PKCS9_BMPString *, size_t *);\nvoid   free_PKCS9_BMPString  (PKCS9_BMPString *);\nsize_t length_PKCS9_BMPString(const PKCS9_BMPString *);\nint    copy_PKCS9_BMPString  (const PKCS9_BMPString *, PKCS9_BMPString *);\n\n\n/*\nPKCS9-friendlyName ::= SET OF PKCS9-BMPString\n*/\n\ntypedef struct PKCS9_friendlyName {\n  unsigned int len;\n  PKCS9_BMPString *val;\n} PKCS9_friendlyName;\n\nint    encode_PKCS9_friendlyName(unsigned char *, size_t, const PKCS9_friendlyName *, size_t *);\nint    decode_PKCS9_friendlyName(const unsigned char *, size_t, PKCS9_friendlyName *, size_t *);\nvoid   free_PKCS9_friendlyName  (PKCS9_friendlyName *);\nsize_t length_PKCS9_friendlyName(const PKCS9_friendlyName *);\nint    copy_PKCS9_friendlyName  (const PKCS9_friendlyName *, PKCS9_friendlyName *);\n\n\n#endif /* __pkcs9_asn1_h__ */\n"
  },
  {
    "path": "freebsd-headers/pkinit_asn1.h",
    "content": "/* Generated from /usr/src/kerberos5/lib/libasn1/../../../crypto/heimdal/lib/asn1/pkinit.asn1 */\n/* Do not edit */\n\n#ifndef __pkinit_asn1_h__\n#define __pkinit_asn1_h__\n\n#include <stddef.h>\n#include <time.h>\n\n#ifndef __asn1_common_definitions__\n#define __asn1_common_definitions__\n\ntypedef struct heim_integer {\n  size_t length;\n  void *data;\n  int negative;\n} heim_integer;\n\ntypedef struct heim_octet_string {\n  size_t length;\n  void *data;\n} heim_octet_string;\n\ntypedef char *heim_general_string;\n\ntypedef char *heim_utf8_string;\n\ntypedef char *heim_printable_string;\n\ntypedef char *heim_ia5_string;\n\ntypedef struct heim_bmp_string {\n  size_t length;\n  uint16_t *data;\n} heim_bmp_string;\n\ntypedef struct heim_universal_string {\n  size_t length;\n  uint32_t *data;\n} heim_universal_string;\n\ntypedef char *heim_visible_string;\n\ntypedef struct heim_oid {\n  size_t length;\n  unsigned *components;\n} heim_oid;\n\ntypedef struct heim_bit_string {\n  size_t length;\n  void *data;\n} heim_bit_string;\n\ntypedef struct heim_octet_string heim_any;\ntypedef struct heim_octet_string heim_any_set;\n\n#define ASN1_MALLOC_ENCODE(T, B, BL, S, L, R)                  \\\n  do {                                                         \\\n    (BL) = length_##T((S));                                    \\\n    (B) = malloc((BL));                                        \\\n    if((B) == NULL) {                                          \\\n      (R) = ENOMEM;                                            \\\n    } else {                                                   \\\n      (R) = encode_##T(((unsigned char*)(B)) + (BL) - 1, (BL), \\\n                       (S), (L));                              \\\n      if((R) != 0) {                                           \\\n        free((B));                                             \\\n        (B) = NULL;                                            \\\n      }                                                        \\\n    }                                                          \\\n  } while (0)\n\nstruct units;\n\n#endif\n\n#include <krb5_asn1.h>\n#include <cms_asn1.h>\n#include <rfc2459_asn1.h>\n#include <heim_asn1.h>\n/* OBJECT IDENTIFIER id-pkinit ::= { iso(1) org(3) dod(6) internet(1) security(5) kerberosv5(2) pkinit(3) } */\nconst heim_oid *oid_id_pkinit(void);\n\n/* OBJECT IDENTIFIER id-pkauthdata ::= { iso(1) org(3) dod(6) internet(1) security(5) kerberosv5(2) pkinit(3) label-less(1) } */\nconst heim_oid *oid_id_pkauthdata(void);\n\n/* OBJECT IDENTIFIER id-pkdhkeydata ::= { iso(1) org(3) dod(6) internet(1) security(5) kerberosv5(2) pkinit(3) label-less(2) } */\nconst heim_oid *oid_id_pkdhkeydata(void);\n\n/* OBJECT IDENTIFIER id-pkrkeydata ::= { iso(1) org(3) dod(6) internet(1) security(5) kerberosv5(2) pkinit(3) label-less(3) } */\nconst heim_oid *oid_id_pkrkeydata(void);\n\n/* OBJECT IDENTIFIER id-pkekuoid ::= { iso(1) org(3) dod(6) internet(1) security(5) kerberosv5(2) pkinit(3) label-less(4) } */\nconst heim_oid *oid_id_pkekuoid(void);\n\n/* OBJECT IDENTIFIER id-pkkdcekuoid ::= { iso(1) org(3) dod(6) internet(1) security(5) kerberosv5(2) pkinit(3) label-less(5) } */\nconst heim_oid *oid_id_pkkdcekuoid(void);\n\n/* OBJECT IDENTIFIER id-pkinit-san ::= { iso(1) org(3) dod(6) internet(1) security(5) kerberosv5(2) x509-sanan(2) } */\nconst heim_oid *oid_id_pkinit_san(void);\n\n/* OBJECT IDENTIFIER id-pkinit-ms-eku ::= { iso(1) org(3) dod(6) internet(1) private(4) enterprise(1) microsoft(311) label-less(20) label-less(2) label-less(2) } */\nconst heim_oid *oid_id_pkinit_ms_eku(void);\n\n/* OBJECT IDENTIFIER id-pkinit-ms-san ::= { iso(1) org(3) dod(6) internet(1) private(4) enterprise(1) microsoft(311) label-less(20) label-less(2) label-less(3) } */\nconst heim_oid *oid_id_pkinit_ms_san(void);\n\n/*\nMS-UPN-SAN ::= UTF8String\n*/\n\ntypedef heim_utf8_string MS_UPN_SAN;\n\nint    encode_MS_UPN_SAN(unsigned char *, size_t, const MS_UPN_SAN *, size_t *);\nint    decode_MS_UPN_SAN(const unsigned char *, size_t, MS_UPN_SAN *, size_t *);\nvoid   free_MS_UPN_SAN  (MS_UPN_SAN *);\nsize_t length_MS_UPN_SAN(const MS_UPN_SAN *);\nint    copy_MS_UPN_SAN  (const MS_UPN_SAN *, MS_UPN_SAN *);\n\n\nenum { pa_pk_as_req = 16 };\n\nenum { pa_pk_as_rep = 17 };\n\nenum { td_trusted_certifiers = 104 };\n\nenum { td_invalid_certificates = 105 };\n\nenum { td_dh_parameters = 109 };\n\n/*\nDHNonce ::= OCTET STRING\n*/\n\ntypedef heim_octet_string DHNonce;\n\nint    encode_DHNonce(unsigned char *, size_t, const DHNonce *, size_t *);\nint    decode_DHNonce(const unsigned char *, size_t, DHNonce *, size_t *);\nvoid   free_DHNonce  (DHNonce *);\nsize_t length_DHNonce(const DHNonce *);\nint    copy_DHNonce  (const DHNonce *, DHNonce *);\n\n\n/*\nKDFAlgorithmId ::= SEQUENCE {\n  kdf-id          [0]   OBJECT IDENTIFIER,\n  ...,\n}\n*/\n\ntypedef struct KDFAlgorithmId {\n  heim_oid kdf_id;\n} KDFAlgorithmId;\n\nint    encode_KDFAlgorithmId(unsigned char *, size_t, const KDFAlgorithmId *, size_t *);\nint    decode_KDFAlgorithmId(const unsigned char *, size_t, KDFAlgorithmId *, size_t *);\nvoid   free_KDFAlgorithmId  (KDFAlgorithmId *);\nsize_t length_KDFAlgorithmId(const KDFAlgorithmId *);\nint    copy_KDFAlgorithmId  (const KDFAlgorithmId *, KDFAlgorithmId *);\n\n\n/*\nTrustedCA ::= SEQUENCE {\n  caName                    [0] IMPLICIT OCTET STRING,\n  certificateSerialNumber   [1] INTEGER OPTIONAL,\n  subjectKeyIdentifier      [2] OCTET STRING OPTIONAL,\n  ...,\n}\n*/\n\ntypedef struct TrustedCA {\n  heim_octet_string caName;\n  heim_integer *certificateSerialNumber;\n  heim_octet_string *subjectKeyIdentifier;\n} TrustedCA;\n\nint    encode_TrustedCA(unsigned char *, size_t, const TrustedCA *, size_t *);\nint    decode_TrustedCA(const unsigned char *, size_t, TrustedCA *, size_t *);\nvoid   free_TrustedCA  (TrustedCA *);\nsize_t length_TrustedCA(const TrustedCA *);\nint    copy_TrustedCA  (const TrustedCA *, TrustedCA *);\n\n\n/*\nExternalPrincipalIdentifier ::= SEQUENCE {\n  subjectName             [0] IMPLICIT OCTET STRING OPTIONAL,\n  issuerAndSerialNumber   [1] IMPLICIT OCTET STRING OPTIONAL,\n  subjectKeyIdentifier    [2] IMPLICIT OCTET STRING OPTIONAL,\n  ...,\n}\n*/\n\ntypedef struct ExternalPrincipalIdentifier {\n  heim_octet_string *subjectName;\n  heim_octet_string *issuerAndSerialNumber;\n  heim_octet_string *subjectKeyIdentifier;\n} ExternalPrincipalIdentifier;\n\nint    encode_ExternalPrincipalIdentifier(unsigned char *, size_t, const ExternalPrincipalIdentifier *, size_t *);\nint    decode_ExternalPrincipalIdentifier(const unsigned char *, size_t, ExternalPrincipalIdentifier *, size_t *);\nvoid   free_ExternalPrincipalIdentifier  (ExternalPrincipalIdentifier *);\nsize_t length_ExternalPrincipalIdentifier(const ExternalPrincipalIdentifier *);\nint    copy_ExternalPrincipalIdentifier  (const ExternalPrincipalIdentifier *, ExternalPrincipalIdentifier *);\n\n\n/*\nExternalPrincipalIdentifiers ::= SEQUENCE OF ExternalPrincipalIdentifier\n*/\n\ntypedef struct ExternalPrincipalIdentifiers {\n  unsigned int len;\n  ExternalPrincipalIdentifier *val;\n} ExternalPrincipalIdentifiers;\n\nint    encode_ExternalPrincipalIdentifiers(unsigned char *, size_t, const ExternalPrincipalIdentifiers *, size_t *);\nint    decode_ExternalPrincipalIdentifiers(const unsigned char *, size_t, ExternalPrincipalIdentifiers *, size_t *);\nvoid   free_ExternalPrincipalIdentifiers  (ExternalPrincipalIdentifiers *);\nsize_t length_ExternalPrincipalIdentifiers(const ExternalPrincipalIdentifiers *);\nint    copy_ExternalPrincipalIdentifiers  (const ExternalPrincipalIdentifiers *, ExternalPrincipalIdentifiers *);\n\n\n/*\nPA-PK-AS-REQ ::= SEQUENCE {\n  signedAuthPack      [0] IMPLICIT OCTET STRING,\n  trustedCertifiers   [1] ExternalPrincipalIdentifiers OPTIONAL,\n  kdcPkId             [2] IMPLICIT OCTET STRING OPTIONAL,\n  ...,\n}\n*/\n\ntypedef struct PA_PK_AS_REQ {\n  heim_octet_string signedAuthPack;\n  ExternalPrincipalIdentifiers *trustedCertifiers;\n  heim_octet_string *kdcPkId;\n} PA_PK_AS_REQ;\n\nint    encode_PA_PK_AS_REQ(unsigned char *, size_t, const PA_PK_AS_REQ *, size_t *);\nint    decode_PA_PK_AS_REQ(const unsigned char *, size_t, PA_PK_AS_REQ *, size_t *);\nvoid   free_PA_PK_AS_REQ  (PA_PK_AS_REQ *);\nsize_t length_PA_PK_AS_REQ(const PA_PK_AS_REQ *);\nint    copy_PA_PK_AS_REQ  (const PA_PK_AS_REQ *, PA_PK_AS_REQ *);\n\n\n/*\nPKAuthenticator ::= SEQUENCE {\n  cusec           [0] INTEGER,\n  ctime           [1] KerberosTime,\n  nonce           [2] INTEGER (0..-1),\n  paChecksum      [3] OCTET STRING OPTIONAL,\n  ...,\n}\n*/\n\ntypedef struct PKAuthenticator {\n  heim_integer cusec;\n  KerberosTime ctime;\n  unsigned int nonce;\n  heim_octet_string *paChecksum;\n} PKAuthenticator;\n\nint    encode_PKAuthenticator(unsigned char *, size_t, const PKAuthenticator *, size_t *);\nint    decode_PKAuthenticator(const unsigned char *, size_t, PKAuthenticator *, size_t *);\nvoid   free_PKAuthenticator  (PKAuthenticator *);\nsize_t length_PKAuthenticator(const PKAuthenticator *);\nint    copy_PKAuthenticator  (const PKAuthenticator *, PKAuthenticator *);\n\n\n/*\nAuthPack ::= SEQUENCE {\n  pkAuthenticator     [0] PKAuthenticator,\n  clientPublicValue   [1] SubjectPublicKeyInfo OPTIONAL,\n  supportedCMSTypes   [2] SEQUENCE OF AlgorithmIdentifier OPTIONAL,\n  clientDHNonce       [3] DHNonce OPTIONAL,\n  ...,\n  supportedKDFs       [4] SEQUENCE OF KDFAlgorithmId OPTIONAL,\n  ...,\n}\n*/\n\ntypedef struct AuthPack {\n  PKAuthenticator pkAuthenticator;\n  SubjectPublicKeyInfo *clientPublicValue;\n  struct  {\n    unsigned int len;\n    AlgorithmIdentifier *val;\n  } *supportedCMSTypes;\n  DHNonce *clientDHNonce;\n  struct  {\n    unsigned int len;\n    KDFAlgorithmId *val;\n  } *supportedKDFs;\n} AuthPack;\n\nint    encode_AuthPack(unsigned char *, size_t, const AuthPack *, size_t *);\nint    decode_AuthPack(const unsigned char *, size_t, AuthPack *, size_t *);\nvoid   free_AuthPack  (AuthPack *);\nsize_t length_AuthPack(const AuthPack *);\nint    copy_AuthPack  (const AuthPack *, AuthPack *);\n\n\n/*\nTD-TRUSTED-CERTIFIERS ::= ExternalPrincipalIdentifiers\n*/\n\ntypedef ExternalPrincipalIdentifiers TD_TRUSTED_CERTIFIERS;\n\nint    encode_TD_TRUSTED_CERTIFIERS(unsigned char *, size_t, const TD_TRUSTED_CERTIFIERS *, size_t *);\nint    decode_TD_TRUSTED_CERTIFIERS(const unsigned char *, size_t, TD_TRUSTED_CERTIFIERS *, size_t *);\nvoid   free_TD_TRUSTED_CERTIFIERS  (TD_TRUSTED_CERTIFIERS *);\nsize_t length_TD_TRUSTED_CERTIFIERS(const TD_TRUSTED_CERTIFIERS *);\nint    copy_TD_TRUSTED_CERTIFIERS  (const TD_TRUSTED_CERTIFIERS *, TD_TRUSTED_CERTIFIERS *);\n\n\n/*\nTD-INVALID-CERTIFICATES ::= ExternalPrincipalIdentifiers\n*/\n\ntypedef ExternalPrincipalIdentifiers TD_INVALID_CERTIFICATES;\n\nint    encode_TD_INVALID_CERTIFICATES(unsigned char *, size_t, const TD_INVALID_CERTIFICATES *, size_t *);\nint    decode_TD_INVALID_CERTIFICATES(const unsigned char *, size_t, TD_INVALID_CERTIFICATES *, size_t *);\nvoid   free_TD_INVALID_CERTIFICATES  (TD_INVALID_CERTIFICATES *);\nsize_t length_TD_INVALID_CERTIFICATES(const TD_INVALID_CERTIFICATES *);\nint    copy_TD_INVALID_CERTIFICATES  (const TD_INVALID_CERTIFICATES *, TD_INVALID_CERTIFICATES *);\n\n\n/*\nKRB5PrincipalName ::= SEQUENCE {\n  realm           [0] Realm,\n  principalName   [1] PrincipalName,\n}\n*/\n\ntypedef struct KRB5PrincipalName {\n  Realm realm;\n  PrincipalName principalName;\n} KRB5PrincipalName;\n\nint    encode_KRB5PrincipalName(unsigned char *, size_t, const KRB5PrincipalName *, size_t *);\nint    decode_KRB5PrincipalName(const unsigned char *, size_t, KRB5PrincipalName *, size_t *);\nvoid   free_KRB5PrincipalName  (KRB5PrincipalName *);\nsize_t length_KRB5PrincipalName(const KRB5PrincipalName *);\nint    copy_KRB5PrincipalName  (const KRB5PrincipalName *, KRB5PrincipalName *);\n\n\n/*\nAD-INITIAL-VERIFIED-CAS ::= SEQUENCE OF ExternalPrincipalIdentifier\n*/\n\ntypedef struct AD_INITIAL_VERIFIED_CAS {\n  unsigned int len;\n  ExternalPrincipalIdentifier *val;\n} AD_INITIAL_VERIFIED_CAS;\n\nint    encode_AD_INITIAL_VERIFIED_CAS(unsigned char *, size_t, const AD_INITIAL_VERIFIED_CAS *, size_t *);\nint    decode_AD_INITIAL_VERIFIED_CAS(const unsigned char *, size_t, AD_INITIAL_VERIFIED_CAS *, size_t *);\nvoid   free_AD_INITIAL_VERIFIED_CAS  (AD_INITIAL_VERIFIED_CAS *);\nsize_t length_AD_INITIAL_VERIFIED_CAS(const AD_INITIAL_VERIFIED_CAS *);\nint    copy_AD_INITIAL_VERIFIED_CAS  (const AD_INITIAL_VERIFIED_CAS *, AD_INITIAL_VERIFIED_CAS *);\n\n\n/*\nDHRepInfo ::= SEQUENCE {\n  dhSignedData    [0] IMPLICIT OCTET STRING,\n  serverDHNonce   [1] DHNonce OPTIONAL,\n  ...,\n  kdf             [2] KDFAlgorithmId OPTIONAL,\n  ...,\n}\n*/\n\ntypedef struct DHRepInfo {\n  heim_octet_string dhSignedData;\n  DHNonce *serverDHNonce;\n  KDFAlgorithmId *kdf;\n} DHRepInfo;\n\nint    encode_DHRepInfo(unsigned char *, size_t, const DHRepInfo *, size_t *);\nint    decode_DHRepInfo(const unsigned char *, size_t, DHRepInfo *, size_t *);\nvoid   free_DHRepInfo  (DHRepInfo *);\nsize_t length_DHRepInfo(const DHRepInfo *);\nint    copy_DHRepInfo  (const DHRepInfo *, DHRepInfo *);\n\n\n/*\nPA-PK-AS-REP ::= CHOICE {\n  dhInfo          [0] DHRepInfo,\n  encKeyPack      [1] IMPLICIT OCTET STRING,\n  ...,\n}\n*/\n\ntypedef struct PA_PK_AS_REP {\n  enum {\n    choice_PA_PK_AS_REP_asn1_ellipsis = 0,\n    choice_PA_PK_AS_REP_dhInfo,\n    choice_PA_PK_AS_REP_encKeyPack\n    /* ... */\n  } element;\n  union {\n    DHRepInfo dhInfo;\n    heim_octet_string encKeyPack;\n    heim_octet_string asn1_ellipsis;\n  } u;\n} PA_PK_AS_REP;\n\nint    encode_PA_PK_AS_REP(unsigned char *, size_t, const PA_PK_AS_REP *, size_t *);\nint    decode_PA_PK_AS_REP(const unsigned char *, size_t, PA_PK_AS_REP *, size_t *);\nvoid   free_PA_PK_AS_REP  (PA_PK_AS_REP *);\nsize_t length_PA_PK_AS_REP(const PA_PK_AS_REP *);\nint    copy_PA_PK_AS_REP  (const PA_PK_AS_REP *, PA_PK_AS_REP *);\n\n\n/*\nKDCDHKeyInfo ::= SEQUENCE {\n  subjectPublicKey   [0]   BIT STRING {\n  },\n  nonce              [1] INTEGER (0..-1),\n  dhKeyExpiration    [2] KerberosTime OPTIONAL,\n  ...,\n}\n*/\n\ntypedef struct KDCDHKeyInfo {\n  heim_bit_string subjectPublicKey;\n  unsigned int nonce;\n  KerberosTime *dhKeyExpiration;\n} KDCDHKeyInfo;\n\nint    encode_KDCDHKeyInfo(unsigned char *, size_t, const KDCDHKeyInfo *, size_t *);\nint    decode_KDCDHKeyInfo(const unsigned char *, size_t, KDCDHKeyInfo *, size_t *);\nvoid   free_KDCDHKeyInfo  (KDCDHKeyInfo *);\nsize_t length_KDCDHKeyInfo(const KDCDHKeyInfo *);\nint    copy_KDCDHKeyInfo  (const KDCDHKeyInfo *, KDCDHKeyInfo *);\n\n\n/*\nReplyKeyPack ::= SEQUENCE {\n  replyKey        [0] EncryptionKey,\n  asChecksum      [1] Checksum,\n  ...,\n}\n*/\n\ntypedef struct ReplyKeyPack {\n  EncryptionKey replyKey;\n  Checksum asChecksum;\n} ReplyKeyPack;\n\nint    encode_ReplyKeyPack(unsigned char *, size_t, const ReplyKeyPack *, size_t *);\nint    decode_ReplyKeyPack(const unsigned char *, size_t, ReplyKeyPack *, size_t *);\nvoid   free_ReplyKeyPack  (ReplyKeyPack *);\nsize_t length_ReplyKeyPack(const ReplyKeyPack *);\nint    copy_ReplyKeyPack  (const ReplyKeyPack *, ReplyKeyPack *);\n\n\n/*\nTD-DH-PARAMETERS ::= SEQUENCE OF AlgorithmIdentifier\n*/\n\ntypedef struct TD_DH_PARAMETERS {\n  unsigned int len;\n  AlgorithmIdentifier *val;\n} TD_DH_PARAMETERS;\n\nint    encode_TD_DH_PARAMETERS(unsigned char *, size_t, const TD_DH_PARAMETERS *, size_t *);\nint    decode_TD_DH_PARAMETERS(const unsigned char *, size_t, TD_DH_PARAMETERS *, size_t *);\nvoid   free_TD_DH_PARAMETERS  (TD_DH_PARAMETERS *);\nsize_t length_TD_DH_PARAMETERS(const TD_DH_PARAMETERS *);\nint    copy_TD_DH_PARAMETERS  (const TD_DH_PARAMETERS *, TD_DH_PARAMETERS *);\n\n\n/*\nPKAuthenticator-Win2k ::= SEQUENCE {\n  kdcName         [0] PrincipalName,\n  kdcRealm        [1] Realm,\n  cusec           [2] INTEGER (0..-1),\n  ctime           [3] KerberosTime,\n  nonce           [4] INTEGER (-2147483648..2147483647),\n}\n*/\n\ntypedef struct PKAuthenticator_Win2k {\n  PrincipalName kdcName;\n  Realm kdcRealm;\n  unsigned int cusec;\n  KerberosTime ctime;\n  int nonce;\n} PKAuthenticator_Win2k;\n\nint    encode_PKAuthenticator_Win2k(unsigned char *, size_t, const PKAuthenticator_Win2k *, size_t *);\nint    decode_PKAuthenticator_Win2k(const unsigned char *, size_t, PKAuthenticator_Win2k *, size_t *);\nvoid   free_PKAuthenticator_Win2k  (PKAuthenticator_Win2k *);\nsize_t length_PKAuthenticator_Win2k(const PKAuthenticator_Win2k *);\nint    copy_PKAuthenticator_Win2k  (const PKAuthenticator_Win2k *, PKAuthenticator_Win2k *);\n\n\n/*\nAuthPack-Win2k ::= SEQUENCE {\n  pkAuthenticator     [0] PKAuthenticator-Win2k,\n  clientPublicValue   [1] SubjectPublicKeyInfo OPTIONAL,\n}\n*/\n\ntypedef struct AuthPack_Win2k {\n  PKAuthenticator_Win2k pkAuthenticator;\n  SubjectPublicKeyInfo *clientPublicValue;\n} AuthPack_Win2k;\n\nint    encode_AuthPack_Win2k(unsigned char *, size_t, const AuthPack_Win2k *, size_t *);\nint    decode_AuthPack_Win2k(const unsigned char *, size_t, AuthPack_Win2k *, size_t *);\nvoid   free_AuthPack_Win2k  (AuthPack_Win2k *);\nsize_t length_AuthPack_Win2k(const AuthPack_Win2k *);\nint    copy_AuthPack_Win2k  (const AuthPack_Win2k *, AuthPack_Win2k *);\n\n\n/*\nTrustedCA-Win2k ::= CHOICE {\n  caName            [1] heim_any,\n  issuerAndSerial   [2] IssuerAndSerialNumber,\n}\n*/\n\ntypedef struct TrustedCA_Win2k {\n  enum {\n    choice_TrustedCA_Win2k_caName = 1,\n    choice_TrustedCA_Win2k_issuerAndSerial\n  } element;\n  union {\n    heim_any caName;\n    IssuerAndSerialNumber issuerAndSerial;\n  } u;\n} TrustedCA_Win2k;\n\nint    encode_TrustedCA_Win2k(unsigned char *, size_t, const TrustedCA_Win2k *, size_t *);\nint    decode_TrustedCA_Win2k(const unsigned char *, size_t, TrustedCA_Win2k *, size_t *);\nvoid   free_TrustedCA_Win2k  (TrustedCA_Win2k *);\nsize_t length_TrustedCA_Win2k(const TrustedCA_Win2k *);\nint    copy_TrustedCA_Win2k  (const TrustedCA_Win2k *, TrustedCA_Win2k *);\n\n\n/*\nPA-PK-AS-REQ-Win2k ::= SEQUENCE {\n  signed-auth-pack     [0] IMPLICIT OCTET STRING,\n  trusted-certifiers   [2] SEQUENCE OF TrustedCA-Win2k OPTIONAL,\n  kdc-cert             [3] IMPLICIT OCTET STRING OPTIONAL,\n  encryption-cert      [4] IMPLICIT OCTET STRING OPTIONAL,\n}\n*/\n\ntypedef struct PA_PK_AS_REQ_Win2k {\n  heim_octet_string signed_auth_pack;\n  struct  {\n    unsigned int len;\n    TrustedCA_Win2k *val;\n  } *trusted_certifiers;\n  heim_octet_string *kdc_cert;\n  heim_octet_string *encryption_cert;\n} PA_PK_AS_REQ_Win2k;\n\nint    encode_PA_PK_AS_REQ_Win2k(unsigned char *, size_t, const PA_PK_AS_REQ_Win2k *, size_t *);\nint    decode_PA_PK_AS_REQ_Win2k(const unsigned char *, size_t, PA_PK_AS_REQ_Win2k *, size_t *);\nvoid   free_PA_PK_AS_REQ_Win2k  (PA_PK_AS_REQ_Win2k *);\nsize_t length_PA_PK_AS_REQ_Win2k(const PA_PK_AS_REQ_Win2k *);\nint    copy_PA_PK_AS_REQ_Win2k  (const PA_PK_AS_REQ_Win2k *, PA_PK_AS_REQ_Win2k *);\n\n\n/*\nPA-PK-AS-REP-Win2k ::= CHOICE {\n  dhSignedData    [0] IMPLICIT OCTET STRING,\n  encKeyPack      [1] IMPLICIT OCTET STRING,\n}\n*/\n\ntypedef struct PA_PK_AS_REP_Win2k {\n  enum {\n    choice_PA_PK_AS_REP_Win2k_dhSignedData = 1,\n    choice_PA_PK_AS_REP_Win2k_encKeyPack\n  } element;\n  union {\n    heim_octet_string dhSignedData;\n    heim_octet_string encKeyPack;\n  } u;\n} PA_PK_AS_REP_Win2k;\n\nint    encode_PA_PK_AS_REP_Win2k(unsigned char *, size_t, const PA_PK_AS_REP_Win2k *, size_t *);\nint    decode_PA_PK_AS_REP_Win2k(const unsigned char *, size_t, PA_PK_AS_REP_Win2k *, size_t *);\nvoid   free_PA_PK_AS_REP_Win2k  (PA_PK_AS_REP_Win2k *);\nsize_t length_PA_PK_AS_REP_Win2k(const PA_PK_AS_REP_Win2k *);\nint    copy_PA_PK_AS_REP_Win2k  (const PA_PK_AS_REP_Win2k *, PA_PK_AS_REP_Win2k *);\n\n\n/*\nKDCDHKeyInfo-Win2k ::= SEQUENCE {\n  nonce              [0] INTEGER (-2147483648..2147483647),\n  subjectPublicKey   [2]   BIT STRING {\n  },\n}\n*/\n\ntypedef struct KDCDHKeyInfo_Win2k {\n  int nonce;\n  heim_bit_string subjectPublicKey;\n} KDCDHKeyInfo_Win2k;\n\nint    encode_KDCDHKeyInfo_Win2k(unsigned char *, size_t, const KDCDHKeyInfo_Win2k *, size_t *);\nint    decode_KDCDHKeyInfo_Win2k(const unsigned char *, size_t, KDCDHKeyInfo_Win2k *, size_t *);\nvoid   free_KDCDHKeyInfo_Win2k  (KDCDHKeyInfo_Win2k *);\nsize_t length_KDCDHKeyInfo_Win2k(const KDCDHKeyInfo_Win2k *);\nint    copy_KDCDHKeyInfo_Win2k  (const KDCDHKeyInfo_Win2k *, KDCDHKeyInfo_Win2k *);\n\n\n/*\nReplyKeyPack-Win2k ::= SEQUENCE {\n  replyKey        [0] EncryptionKey,\n  nonce           [1] INTEGER (-2147483648..2147483647),\n  ...,\n}\n*/\n\ntypedef struct ReplyKeyPack_Win2k {\n  EncryptionKey replyKey;\n  int nonce;\n} ReplyKeyPack_Win2k;\n\nint    encode_ReplyKeyPack_Win2k(unsigned char *, size_t, const ReplyKeyPack_Win2k *, size_t *);\nint    decode_ReplyKeyPack_Win2k(const unsigned char *, size_t, ReplyKeyPack_Win2k *, size_t *);\nvoid   free_ReplyKeyPack_Win2k  (ReplyKeyPack_Win2k *);\nsize_t length_ReplyKeyPack_Win2k(const ReplyKeyPack_Win2k *);\nint    copy_ReplyKeyPack_Win2k  (const ReplyKeyPack_Win2k *, ReplyKeyPack_Win2k *);\n\n\n/*\nPkinitSuppPubInfo ::= SEQUENCE {\n  enctype         [0] INTEGER (-2147483648..2147483647),\n  as-REQ          [1] OCTET STRING,\n  pk-as-rep       [2] OCTET STRING,\n  ticket          [3] Ticket,\n  ...,\n}\n*/\n\ntypedef struct PkinitSuppPubInfo {\n  int enctype;\n  heim_octet_string as_REQ;\n  heim_octet_string pk_as_rep;\n  Ticket ticket;\n} PkinitSuppPubInfo;\n\nint    encode_PkinitSuppPubInfo(unsigned char *, size_t, const PkinitSuppPubInfo *, size_t *);\nint    decode_PkinitSuppPubInfo(const unsigned char *, size_t, PkinitSuppPubInfo *, size_t *);\nvoid   free_PkinitSuppPubInfo  (PkinitSuppPubInfo *);\nsize_t length_PkinitSuppPubInfo(const PkinitSuppPubInfo *);\nint    copy_PkinitSuppPubInfo  (const PkinitSuppPubInfo *, PkinitSuppPubInfo *);\n\n\n#endif /* __pkinit_asn1_h__ */\n"
  },
  {
    "path": "freebsd-headers/pmc.h",
    "content": "/*-\n * Copyright (c) 2003,2004 Joseph Koshy\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/lib/libpmc/pmc.h 190395 2009-03-24 22:35:05Z fabient $\n */\n\n#ifndef _PMC_H_\n#define _PMC_H_\n\n#include <sys/cdefs.h>\n#include <sys/pmc.h>\n\n/*\n * Driver statistics.\n */\nstruct pmc_driverstats {\n\tint\tpm_intr_ignored;\t/* #interrupts ignored */\n\tint\tpm_intr_processed;\t/* #interrupts processed */\n\tint\tpm_intr_bufferfull;\t/* #interrupts with ENOSPC */\n\tint\tpm_syscalls;\t\t/* #syscalls */\n\tint\tpm_syscall_errors;\t/* #syscalls with errors */\n\tint\tpm_buffer_requests;\t/* #buffer requests */\n\tint\tpm_buffer_requests_failed; /* #failed buffer requests */\n\tint\tpm_log_sweeps;\t\t/* #sample buffer processing passes */\n};\n\n/*\n * CPU information.\n */\nstruct pmc_cpuinfo {\n\tenum pmc_cputype pm_cputype;\t/* the kind of CPU */\n\tuint32_t\tpm_ncpu;\t/* number of CPUs */\n\tuint32_t\tpm_npmc;\t/* #PMCs per CPU */\n\tuint32_t\tpm_nclass;\t/* #classes of PMCs */\n\tstruct pmc_classinfo pm_classes[PMC_CLASS_MAX];\n};\n\n/*\n * Current PMC state.\n */\nstruct pmc_pmcinfo {\n\tint32_t\t\tpm_cpu;\t\t/* CPU number */\n\tstruct pmc_info\tpm_pmcs[];\t/* NPMC structs */\n};\n\n/*\n * Prototypes\n */\n\n__BEGIN_DECLS\nint\tpmc_allocate(const char *_ctrspec, enum pmc_mode _mode, uint32_t _flags,\n    int _cpu, pmc_id_t *_pmcid);\nint\tpmc_attach(pmc_id_t _pmcid, pid_t _pid);\nint\tpmc_capabilities(pmc_id_t _pmc, uint32_t *_caps);\nint\tpmc_configure_logfile(int _fd);\nint\tpmc_flush_logfile(void);\nint\tpmc_detach(pmc_id_t _pmcid, pid_t _pid);\nint\tpmc_disable(int _cpu, int _pmc);\nint\tpmc_enable(int _cpu, int _pmc);\nint\tpmc_get_driver_stats(struct pmc_driverstats *_gms);\nint\tpmc_get_msr(pmc_id_t _pmc, uint32_t *_msr);\nint\tpmc_init(void);\nint\tpmc_read(pmc_id_t _pmc, pmc_value_t *_value);\nint\tpmc_release(pmc_id_t _pmc);\nint\tpmc_rw(pmc_id_t _pmc, pmc_value_t _newvalue, pmc_value_t *_oldvalue);\nint\tpmc_set(pmc_id_t _pmc, pmc_value_t _value);\nint\tpmc_start(pmc_id_t _pmc);\nint\tpmc_stop(pmc_id_t _pmc);\nint\tpmc_width(pmc_id_t _pmc, uint32_t *_width);\nint\tpmc_write(pmc_id_t _pmc, pmc_value_t _value);\nint\tpmc_writelog(uint32_t _udata);\n\nint\tpmc_ncpu(void);\nint\tpmc_npmc(int _cpu);\nint\tpmc_cpuinfo(const struct pmc_cpuinfo **_cpu_info);\nint\tpmc_pmcinfo(int _cpu, struct pmc_pmcinfo **_pmc_info);\n\nconst char\t*pmc_name_of_capability(uint32_t _c);\nconst char\t*pmc_name_of_class(enum pmc_class _pc);\nconst char\t*pmc_name_of_cputype(enum pmc_cputype _cp);\nconst char\t*pmc_name_of_disposition(enum pmc_disp _pd);\nconst char\t*pmc_name_of_event(enum pmc_event _pe);\nconst char\t*pmc_name_of_mode(enum pmc_mode _pm);\nconst char\t*pmc_name_of_state(enum pmc_state _ps);\n\nint\tpmc_event_names_of_class(enum pmc_class _cl, const char ***_eventnames,\n    int *_nevents);\n__END_DECLS\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/pmclog.h",
    "content": "/*-\n * Copyright (c) 2005-2007 Joseph Koshy\n * Copyright (c) 2007 The FreeBSD Foundation\n * All rights reserved.\n *\n * Portions of this software were developed by A. Joseph Koshy under\n * sponsorship from the FreeBSD Foundation and Google, Inc.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/lib/libpmc/pmclog.h 190395 2009-03-24 22:35:05Z fabient $\n */\n\n#ifndef\t_PMCLOG_H_\n#define\t_PMCLOG_H_\n\n#include <sys/cdefs.h>\n#include <sys/pmclog.h>\n\nenum pmclog_state {\n\tPMCLOG_OK,\n\tPMCLOG_EOF,\n\tPMCLOG_REQUIRE_DATA,\n\tPMCLOG_ERROR\n};\n\nstruct pmclog_ev_callchain {\n\tuint32_t\tpl_pid;\n\tuint32_t\tpl_pmcid;\n\tuint32_t\tpl_cpuflags;\n\tuint32_t\tpl_npc;\n\tuintfptr_t\tpl_pc[PMC_CALLCHAIN_DEPTH_MAX];\n};\n\nstruct pmclog_ev_dropnotify {\n};\n\nstruct pmclog_ev_closelog {\n};\n\nstruct pmclog_ev_initialize {\n\tuint32_t\tpl_version;\n\tuint32_t\tpl_arch;\n};\n\nstruct pmclog_ev_map_in {\n\tpid_t\t\tpl_pid;\n\tuintfptr_t\tpl_start;\n\tchar\t\tpl_pathname[PATH_MAX];\n};\n\nstruct pmclog_ev_map_out {\n\tpid_t\t\tpl_pid;\n\tuintfptr_t\tpl_start;\n\tuintfptr_t\tpl_end;\n};\n\nstruct pmclog_ev_pcsample {\n\tuintfptr_t\tpl_pc;\n\tpid_t\t\tpl_pid;\n\tpmc_id_t\tpl_pmcid;\n\tuint32_t\tpl_usermode;\n};\n\nstruct pmclog_ev_pmcallocate {\n\tuint32_t\tpl_event;\n\tconst char *\tpl_evname;\n\tuint32_t\tpl_flags;\n\tpmc_id_t\tpl_pmcid;\n};\n\nstruct pmclog_ev_pmcattach {\n\tpmc_id_t\tpl_pmcid;\n\tpid_t\t\tpl_pid;\n\tchar\t\tpl_pathname[PATH_MAX];\n};\n\nstruct pmclog_ev_pmcdetach {\n\tpmc_id_t\tpl_pmcid;\n\tpid_t\t\tpl_pid;\n};\n\nstruct pmclog_ev_proccsw {\n\tpid_t\t\tpl_pid;\n\tpmc_id_t\tpl_pmcid;\n\tpmc_value_t\tpl_value;\n};\n\nstruct pmclog_ev_procexec {\n\tpid_t\t\tpl_pid;\n\tpmc_id_t\tpl_pmcid;\n\tuintfptr_t\tpl_entryaddr;\n\tchar\t\tpl_pathname[PATH_MAX];\n};\n\nstruct pmclog_ev_procexit {\n\tuint32_t\tpl_pid;\n\tpmc_id_t\tpl_pmcid;\n\tpmc_value_t\tpl_value;\n};\n\nstruct pmclog_ev_procfork {\n\tpid_t\t\tpl_oldpid;\n\tpid_t\t\tpl_newpid;\n};\n\nstruct pmclog_ev_sysexit {\n\tpid_t\t\tpl_pid;\n};\n\nstruct pmclog_ev_userdata {\n\tuint32_t\tpl_userdata;\n};\n\nstruct pmclog_ev {\n\tenum pmclog_state pl_state;\t/* state after 'get_event()' */\n\toff_t\t\t  pl_offset;\t/* byte offset in stream */\n\tsize_t\t\t  pl_count;\t/* count of records so far */\n\tstruct timespec   pl_ts;\t/* log entry timestamp */\n\tenum pmclog_type  pl_type;\t/* type of log entry */\n\tunion { \t\t\t/* log entry data */\n\t\tstruct pmclog_ev_callchain\tpl_cc;\n\t\tstruct pmclog_ev_closelog\tpl_cl;\n\t\tstruct pmclog_ev_dropnotify\tpl_dn;\n\t\tstruct pmclog_ev_initialize\tpl_i;\n\t\tstruct pmclog_ev_map_in\t\tpl_mi;\n\t\tstruct pmclog_ev_map_out\tpl_mo;\n\t\tstruct pmclog_ev_pcsample\tpl_s;\n\t\tstruct pmclog_ev_pmcallocate\tpl_a;\n\t\tstruct pmclog_ev_pmcattach\tpl_t;\n\t\tstruct pmclog_ev_pmcdetach\tpl_d;\n\t\tstruct pmclog_ev_proccsw\tpl_c;\n\t\tstruct pmclog_ev_procexec\tpl_x;\n\t\tstruct pmclog_ev_procexit\tpl_e;\n\t\tstruct pmclog_ev_procfork\tpl_f;\n\t\tstruct pmclog_ev_sysexit\tpl_se;\n\t\tstruct pmclog_ev_userdata\tpl_u;\n\t} pl_u;\n};\n\n#define\tPMCLOG_FD_NONE\t\t\t\t(-1)\n\n__BEGIN_DECLS\nvoid\t*pmclog_open(int _fd);\nint\tpmclog_feed(void *_cookie, char *_data, int _len);\nint\tpmclog_read(void *_cookie, struct pmclog_ev *_ev);\nvoid\tpmclog_close(void *_cookie);\n__END_DECLS\n\n#endif\n\n"
  },
  {
    "path": "freebsd-headers/printf.h",
    "content": "/*-\n * Copyright (c) 2005 Poul-Henning Kamp\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/include/printf.h 219343 2011-03-06 17:45:37Z pjd $\n */\n\n#ifndef _PRINTF_H_\n#define _PRINTF_H_\n\n#include <stdio.h>\n#include <wchar.h>\n\n/*\n * The API defined by glibc allows a renderer to take multiple arguments\n * This is obviously usable for things like (ptr+len) pairs etc.\n * But the do not actually provide support for it at the end of the day,\n * they offer only one argument to the arginfo function, but do accept\n * >1 returns, although the do not check the types of those arguments\n * argument\n * Be compatible for now.\n */\n#define __PRINTFMAXARG\t\t2\n\nstruct printf_info {\n\t/* GLIBC compatible */\n\tint\t\tprec;\n\tint\t\twidth;\n\twchar_t\t\tspec;\n\tunsigned \tis_long_double;\n\tunsigned \tis_char;\n\tunsigned\tis_short;\n\tunsigned\tis_long;\n\tunsigned\talt;\n\tunsigned\tspace;\n\tunsigned\tleft;\n\tunsigned\tshowsign;\n\tunsigned\tgroup;\n\tunsigned\textra;\n\tunsigned\twide;\n\twchar_t\t\tpad;\n\n\t/* FreeBSD extensions */\n\n\tunsigned\tis_quad;\n\tunsigned\tis_intmax;\n\tunsigned\tis_ptrdiff;\n\tunsigned\tis_size;\n\n\t/* private */\n\tint\t\tsofar;\n\tunsigned\tget_width;\n\tunsigned\tget_prec;\n\tconst char\t*begin;\n\tconst char\t*end;\n\tvoid \t\t*arg[__PRINTFMAXARG];\n};\n\nenum {\n\tPA_INT\t\t= (1 << 0),\t/* int */\n\tPA_CHAR\t\t= (1 << 1),\t/* int, cast to char */\n\tPA_WCHAR\t= (1 << 2),\t/* wide char */\n\tPA_STRING\t= (1 << 3),\t/* const char * (with '\\0') */\n\tPA_WSTRING\t= (1 << 4),\t/* const wchar_t * */\n\tPA_POINTER\t= (1 << 5),\t/* void * */\n\tPA_FLOAT\t= (1 << 6),\t/* float */\n\tPA_DOUBLE\t= (1 << 7) \t/* double */\n};\n\n#define\tPA_FLAG_MASK\t\t0xff0000\n#define\tPA_FLAG_LONG_LONG\t(1 << 16)\n#define\tPA_FLAG_LONG\t\t(1 << 17)\n#define\tPA_FLAG_SHORT\t\t(1 << 18)\n#define\tPA_FLAG_PTR\t\t(1 << 19)\n#define\tPA_FLAG_QUAD\t\t(1 << 20)\n#define\tPA_FLAG_INTMAX\t\t(1 << 21)\n#define\tPA_FLAG_SIZE\t\t(1 << 22)\n#define\tPA_FLAG_PTRDIFF\t\t(1 << 23)\n#define\tPA_FLAG_LONG_DOUBLE\tPA_FLAG_LONG_LONG\n\ntypedef int printf_arginfo_function(const struct printf_info *, size_t, int *);\ntypedef int printf_function(FILE *, const struct printf_info *, const void *const *);\n\n/* FreeBSD extension */\nstruct __printf_io;\ntypedef int printf_render(struct __printf_io *, const struct printf_info *, const void *const *);\n\n/* vprintf.c */\nextern const char __lowercase_hex[17];\nextern const char __uppercase_hex[17];\n\nvoid __printf_flush(struct __printf_io *io);\nint __printf_puts(struct __printf_io *io, const void *ptr, int len);\nint __printf_pad(struct __printf_io *io, int n, int zero);\nint __printf_out(struct __printf_io *io, const struct printf_info *pi, const void *ptr, int len);\n\nint __xvprintf(FILE *fp, const char *fmt0, va_list ap);\nextern int __use_xprintf;\n\n/* GLIBC compat */\nint register_printf_function(int spec, printf_function *render, printf_arginfo_function *arginfo);\n\n/* FreeBSD */\nint register_printf_render(int spec, printf_render *render, printf_arginfo_function *arginfo);\nint register_printf_render_std(const unsigned char *specs);\n\n/* vprintf_errno.c */\nprintf_arginfo_function\t\t__printf_arginfo_errno;\nprintf_render\t\t\t__printf_render_errno;\n\n/* vprintf_float.c */\nprintf_arginfo_function\t\t__printf_arginfo_float;\nprintf_render\t\t\t__printf_render_float;\n\n/* vprintf_hexdump.c */\nprintf_arginfo_function\t\t__printf_arginfo_hexdump;\nprintf_render \t\t\t__printf_render_hexdump;\n\n/* vprintf_int.c */\nprintf_arginfo_function\t\t__printf_arginfo_ptr;\nprintf_arginfo_function\t\t__printf_arginfo_int;\nprintf_render\t\t\t__printf_render_ptr;\nprintf_render\t\t\t__printf_render_int;\n\n/* vprintf_quoute.c */\nprintf_arginfo_function\t\t__printf_arginfo_quote;\nprintf_render \t\t\t__printf_render_quote;\n\n/* vprintf_str.c */\nprintf_arginfo_function\t\t__printf_arginfo_chr;\nprintf_render\t\t\t__printf_render_chr;\nprintf_arginfo_function\t\t__printf_arginfo_str;\nprintf_render\t\t\t__printf_render_str;\n\n/* vprintf_time.c */\nprintf_arginfo_function\t\t__printf_arginfo_time;\nprintf_render\t\t\t__printf_render_time;\n\n/* vprintf_vis.c */\nprintf_arginfo_function\t\t__printf_arginfo_vis;\nprintf_render \t\t\t__printf_render_vis;\n\n#endif /* !_PRINTF_H */\n"
  },
  {
    "path": "freebsd-headers/proc_service.h",
    "content": "/*\n * Copyright (c) 2004 David Xu <davidxu@freebsd.org>\n * Copyright (c) 2004 Marcel Moolenaar\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/include/proc_service.h 155412 2006-02-07 02:29:55Z davidxu $\n */\n\n#ifndef _PROC_SERVICE_H_\n#define\t_PROC_SERVICE_H_\n\n#include <sys/types.h>\n#include <sys/procfs.h>\n\ntypedef enum {\n\tPS_OK = 0,\t\t/* No errors. */\n\tPS_ERR,\t\t\t/* Generic error. */\n\tPS_BADADDR,\t\t/* Bad address. */\n\tPS_BADLID,\t\t/* Bad LWP Id. */\n\tPS_BADPID,\t\t/* Bad process Id. */\n\tPS_NOFREGS,\t\t/* FPU register set not available. */\n\tPS_NOSYM\t\t/* Symbol not found. */\n} ps_err_e;\n\nstruct ps_prochandle;\t\t/* Opaque type. Defined by the implementor. */\n\n__BEGIN_DECLS\nps_err_e ps_lcontinue(struct ps_prochandle *, lwpid_t);\nps_err_e ps_lgetfpregs(struct ps_prochandle *, lwpid_t, prfpregset_t *);\nps_err_e ps_lgetregs(struct ps_prochandle *, lwpid_t, prgregset_t);\nps_err_e ps_lsetfpregs(struct ps_prochandle *, lwpid_t, const prfpregset_t *);\nps_err_e ps_lsetregs(struct ps_prochandle *, lwpid_t, const prgregset_t);\n#ifdef __i386__\nps_err_e ps_lgetxmmregs (struct ps_prochandle *, lwpid_t, char *);\nps_err_e ps_lsetxmmregs (struct ps_prochandle *, lwpid_t, const char *);\n#endif\nps_err_e ps_lstop(struct ps_prochandle *, lwpid_t);\nps_err_e ps_linfo(struct ps_prochandle *, lwpid_t, void *);\nps_err_e ps_pcontinue(struct ps_prochandle *);\nps_err_e ps_pdmodel(struct ps_prochandle *, int *);\nps_err_e ps_pglobal_lookup(struct ps_prochandle *, const char *, const char *,\n    psaddr_t *);\nvoid\t ps_plog(const char *, ...);\nps_err_e ps_pread(struct ps_prochandle *, psaddr_t, void *, size_t);\nps_err_e ps_pstop(struct ps_prochandle *);\nps_err_e ps_pwrite(struct ps_prochandle *, psaddr_t, const void *, size_t);\n__END_DECLS\n\n#endif /* _PROC_SERVICE_H_ */\n"
  },
  {
    "path": "freebsd-headers/protocols/dumprestore.h",
    "content": "/*\n * Copyright (c) 1980, 1993\n *\tThe Regents of the University of California.  All rights reserved.\n * (c) UNIX System Laboratories, Inc.\n * All or some portions of this file are derived from material licensed\n * to the University of California by American Telephone and Telegraph\n * Co. or Unix System Laboratories, Inc. and are reproduced herein with\n * the permission of UNIX System Laboratories, Inc.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t@(#)dumprestore.h\t8.2 (Berkeley) 1/21/94\n *\n * $FreeBSD: release/9.0.0/include/protocols/dumprestore.h 203965 2010-02-16 19:46:46Z imp $\n */\n\n#ifndef _PROTOCOLS_DUMPRESTORE_H_\n#define _PROTOCOLS_DUMPRESTORE_H_\n\n/*\n * TP_BSIZE is the size of file blocks on the dump tapes.\n * Note that TP_BSIZE must be a multiple of DEV_BSIZE.\n *\n * NTREC is the number of TP_BSIZE blocks that are written\n * in each tape record. HIGHDENSITYTREC is the number of\n * TP_BSIZE blocks that are written in each tape record on\n * 6250 BPI or higher density tapes.\n *\n * TP_NINDIR is the number of indirect pointers in a TS_INODE\n * or TS_ADDR record. Note that it must be a power of two.\n */\n#define TP_BSIZE\t1024\n#define NTREC   \t10\n#define HIGHDENSITYTREC\t32\n#define TP_NINDIR\t(TP_BSIZE/2)\n#define LBLSIZE\t\t16\n#define NAMELEN\t\t64\n\n#define OFS_MAGIC   \t(int)60011\n#define NFS_MAGIC   \t(int)60012\n#ifndef FS_UFS2_MAGIC\n#define FS_UFS2_MAGIC  \t(int)0x19540119\n#endif\n#define CHECKSUM\t(int)84446\n\nunion u_spcl {\n\tchar dummy[TP_BSIZE];\n\tstruct\ts_spcl {\n\t\tint32_t\tc_type;\t\t    /* record type (see below) */\n\t\tint32_t\tc_old_date;\t    /* date of this dump */\n\t\tint32_t\tc_old_ddate;\t    /* date of previous dump */\n\t\tint32_t\tc_volume;\t    /* dump volume number */\n\t\tint32_t\tc_old_tapea;\t    /* logical block of this record */\n\t\tino_t\tc_inumber;\t    /* number of inode */\n\t\tint32_t\tc_magic;\t    /* magic number (see above) */\n\t\tint32_t\tc_checksum;\t    /* record checksum */\n\t\t/*\n\t\t * Start old dinode structure, expanded for binary\n\t\t * compatibility with UFS1.\n\t\t */\n\t\tu_int16_t c_mode;\t    /* file mode */\n\t\tint16_t\tc_spare1[3];\t    /* old nlink, ids */\n\t\tu_int64_t c_size;\t    /* file byte count */\n\t\tint32_t\tc_old_atime;\t    /* old last access time, seconds */\n\t\tint32_t\tc_atimensec;\t    /* last access time, nanoseconds */\n\t\tint32_t\tc_old_mtime;\t    /* old last modified time, secs */\n\t\tint32_t\tc_mtimensec;\t    /* last modified time, nanosecs */\n\t\tint32_t\tc_spare2[2];\t    /* old ctime */\n\t\tint32_t\tc_rdev;\t\t    /* for devices, device number */\n\t\tint32_t\tc_birthtimensec;    /* creation time, nanosecs */\n\t\tint64_t\tc_birthtime;\t    /* creation time, seconds */\n\t\tint64_t\tc_atime;\t    /* last access time, seconds */\n\t\tint64_t\tc_mtime;\t    /* last modified time, seconds */\n\t\tint32_t\tc_extsize;\t    /* external attribute size */\n\t\tint32_t\tc_spare4[6];\t    /* old block pointers */\n\t\tu_int32_t c_file_flags;\t    /* status flags (chflags) */\n\t\tint32_t\tc_spare5[2];\t    /* old blocks, generation number */\n\t\tu_int32_t c_uid;\t    /* file owner */\n\t\tu_int32_t c_gid;\t    /* file group */\n\t\tint32_t\tc_spare6[2];\t    /* previously unused spares */\n\t\t/*\n\t\t * End old dinode structure.\n\t\t */\n\t\tint32_t\tc_count;\t    /* number of valid c_addr entries */\n\t\tchar\tc_addr[TP_NINDIR];  /* 1 => data; 0 => hole in inode */\n\t\tchar\tc_label[LBLSIZE];   /* dump label */\n\t\tint32_t\tc_level;\t    /* level of this dump */\n\t\tchar\tc_filesys[NAMELEN]; /* name of dumpped file system */\n\t\tchar\tc_dev[NAMELEN];\t    /* name of dumpped device */\n\t\tchar\tc_host[NAMELEN];    /* name of dumpped host */\n\t\tint32_t\tc_flags;\t    /* additional information */\n\t\tint32_t\tc_old_firstrec;\t    /* first record on volume */\n\t\tint64_t\tc_date;\t\t    /* date of this dump */\n\t\tint64_t\tc_ddate;\t    /* date of previous dump */\n\t\tint64_t\tc_tapea;\t    /* logical block of this record */\n\t\tint64_t\tc_firstrec;\t    /* first record on volume */\n\t\tint32_t\tc_spare[24];\t    /* reserved for future uses */\n\t} s_spcl;\n} u_spcl;\n#define spcl u_spcl.s_spcl\n/*\n * special record types\n */\n#define TS_TAPE \t1\t/* dump tape header */\n#define TS_INODE\t2\t/* beginning of file record */\n#define TS_ADDR \t4\t/* continuation of file record */\n#define TS_BITS \t3\t/* map of inodes on tape */\n#define TS_CLRI \t6\t/* map of inodes deleted since last dump */\n#define TS_END  \t5\t/* end of volume marker */\n\n#endif /* !_DUMPRESTORE_H_ */\n"
  },
  {
    "path": "freebsd-headers/protocols/routed.h",
    "content": "/*-\n * Copyright (c) 1983, 1989, 1993\n *\tThe Regents of the University of California.  All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t@(#)routed.h\t8.1 (Berkeley) 6/2/93\n *\n * $FreeBSD: release/9.0.0/include/protocols/routed.h 203965 2010-02-16 19:46:46Z imp $\n *\t$Revision: 2.26 $\n */\n\n#ifndef _ROUTED_H_\n#define\t_ROUTED_H_\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\n/*\n * Routing Information Protocol\n *\n * Derived from Xerox NS Routing Information Protocol\n * by changing 32-bit net numbers to sockaddr's and\n * padding stuff to 32-bit boundaries.\n */\n\n#define\tRIPv1\t\t1\n#define\tRIPv2\t\t2\n#ifndef RIPVERSION\n#define\tRIPVERSION\tRIPv1\n#endif\n\n#define RIP_PORT\t520\n\n#if RIPVERSION == 1\n/* Note that this so called sockaddr has a 2-byte sa_family and no sa_len.\n * It is not a UNIX sockaddr, but the shape of an address as defined\n * in RIPv1.  It is still defined to allow old versions of programs\n * such as `gated` to use this file to define RIPv1.\n */\nstruct netinfo {\n\tstruct\tsockaddr rip_dst;\t/* destination net/host */\n\tu_int32_t   rip_metric;\t\t/* cost of route */\n};\n#else\nstruct netinfo {\n\tu_int16_t   n_family;\n#define\t    RIP_AF_INET\t    htons(AF_INET)\n#define\t    RIP_AF_UNSPEC   0\n#define\t    RIP_AF_AUTH\t    0xffff\n\tu_int16_t   n_tag;\t\t/* optional in RIPv2 */\n\tu_int32_t   n_dst;\t\t/* destination net or host */\n#define\t    RIP_DEFAULT\t    0\n\tu_int32_t   n_mask;\t\t/* netmask in RIPv2 */\n\tu_int32_t   n_nhop;\t\t/* optional next hop in RIPv2 */\n\tu_int32_t   n_metric;\t\t/* cost of route */\n};\n#endif\n\n/* RIPv2 authentication */\nstruct netauth {\n\tu_int16_t   a_family;\t\t/* always RIP_AF_AUTH */\n\tu_int16_t   a_type;\n#define\t    RIP_AUTH_NONE   0\n#define\t    RIP_AUTH_PW\t    htons(2)\t/* password type */\n#define\t    RIP_AUTH_MD5    htons(3)\t/* Keyed MD5 */\n\tunion {\n#define\t    RIP_AUTH_PW_LEN 16\n\t    u_int8_t    au_pw[RIP_AUTH_PW_LEN];\n\t    struct a_md5 {\n\t\tint16_t\tmd5_pkt_len;\t/* RIP-II packet length */\n\t\tint8_t\tmd5_keyid;\t/* key ID and auth data len */\n\t\tint8_t\tmd5_auth_len;\t/* 16 */\n\t\tu_int32_t md5_seqno;\t/* sequence number */\n\t\tu_int32_t rsvd[2];\t/* must be 0 */\n#define\t    RIP_AUTH_MD5_KEY_LEN   RIP_AUTH_PW_LEN\n#define\t    RIP_AUTH_MD5_HASH_XTRA (sizeof(struct netauth)-sizeof(struct a_md5))\n#define\t    RIP_AUTH_MD5_HASH_LEN  (RIP_AUTH_MD5_KEY_LEN+RIP_AUTH_MD5_HASH_XTRA)\n\t    } a_md5;\n\t} au;\n};\n\nstruct rip {\n\tu_int8_t    rip_cmd;\t\t/* request/response */\n\tu_int8_t    rip_vers;\t\t/* protocol version # */\n\tu_int16_t   rip_res1;\t\t/* pad to 32-bit boundary */\n\tunion {\t\t\t\t/* variable length... */\n\t    struct netinfo ru_nets[1];\n\t    int8_t    ru_tracefile[1];\n\t    struct netauth ru_auth[1];\n\t} ripun;\n#define\trip_nets\tripun.ru_nets\n#define rip_auths\tripun.ru_auth\n#define\trip_tracefile\tripun.ru_tracefile\n};\n\n/* Packet types.\n */\n#define\tRIPCMD_REQUEST\t\t1\t/* want info */\n#define\tRIPCMD_RESPONSE\t\t2\t/* responding to request */\n#define\tRIPCMD_TRACEON\t\t3\t/* turn tracing on */\n#define\tRIPCMD_TRACEOFF\t\t4\t/* turn it off */\n\n/* Gated extended RIP to include a \"poll\" command instead of using\n * RIPCMD_REQUEST with (RIP_AF_UNSPEC, RIP_DEFAULT).  RFC 1058 says\n * command 5 is used by Sun Microsystems for its own purposes.\n */\n#define RIPCMD_POLL\t\t5\n\n#define\tRIPCMD_MAX\t\t6\n\n#ifdef RIPCMDS\nconst char *ripcmds[RIPCMD_MAX] = {\n\t\"#0\", \"REQUEST\", \"RESPONSE\", \"TRACEON\", \"TRACEOFF\"\n};\n#endif\n\n#define\tHOPCNT_INFINITY\t\t16\n#define\tMAXPACKETSIZE\t\t512\t/* max broadcast size */\n#define NETS_LEN ((MAXPACKETSIZE-sizeof(struct rip))\t\\\n\t\t      / sizeof(struct netinfo) +1)\n\n#define INADDR_RIP_GROUP (u_int32_t)0xe0000009\t/* 224.0.0.9 */\n\n\n/* Timer values used in managing the routing table.\n *\n * Complete tables are broadcast every SUPPLY_INTERVAL seconds.\n * If changes occur between updates, dynamic updates containing only changes\n * may be sent.  When these are sent, a timer is set for a random value\n * between MIN_WAITTIME and MAX_WAITTIME, and no additional dynamic updates\n * are sent until the timer expires.\n *\n * Every update of a routing entry forces an entry's timer to be reset.\n * After EXPIRE_TIME without updates, the entry is marked invalid,\n * but held onto until GARBAGE_TIME so that others may see it, to\n * \"poison\" the bad route.\n */\n#define\tSUPPLY_INTERVAL\t\t30\t/* time to supply tables */\n#define\tMIN_WAITTIME\t\t2\t/* min sec until next flash updates */\n#define\tMAX_WAITTIME\t\t5\t/* max sec until flash update */\n\n#define STALE_TIME\t\t90\t/* switch to a new gateway */\n#define\tEXPIRE_TIME\t\t180\t/* time to mark entry invalid */\n#define\tGARBAGE_TIME\t\t240\t/* time to garbage collect */\n\n#ifdef __cplusplus\n}\n#endif\n#endif /* !_ROUTED_H_ */\n"
  },
  {
    "path": "freebsd-headers/protocols/rwhod.h",
    "content": "/*\n * Copyright (c) 1983, 1993\n *\tThe Regents of the University of California.  All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t@(#)rwhod.h\t8.1 (Berkeley) 6/2/93\n *\n * $FreeBSD: release/9.0.0/include/protocols/rwhod.h 203965 2010-02-16 19:46:46Z imp $\n */\n\n#ifndef _PROTOCOLS_RWHOD_H_\n#define\t_PROTOCOLS_RWHOD_H_\n\n/*\n * rwho protocol packet format.\n */\nstruct\toutmp {\n\tchar\tout_line[8];\t\t/* tty name */\n\tchar\tout_name[8];\t\t/* user id */\n\tint32_t\tout_time;\t\t/* time on */\n};\n\nstruct\twhod {\n\tchar\twd_vers;\t\t/* protocol version # */\n\tchar\twd_type;\t\t/* packet type, see below */\n\tchar\twd_pad[2];\n\tint\twd_sendtime;\t\t/* time stamp by sender */\n\tint\twd_recvtime;\t\t/* time stamp applied by receiver */\n\tchar\twd_hostname[32];\t/* hosts's name */\n\tint\twd_loadav[3];\t\t/* load average as in uptime */\n\tint\twd_boottime;\t\t/* time system booted */\n\tstruct\twhoent {\n\t\tstruct\toutmp we_utmp;\t/* active tty info */\n\t\tint\twe_idle;\t/* tty idle time */\n\t} wd_we[1024 / sizeof (struct whoent)];\n};\n\n#define\tWHODVERSION\t1\n#define\tWHODTYPE_STATUS\t1\t\t/* host status */\n\n#define\t_PATH_RWHODIR\t\"/var/rwho\"\n\n#endif /* !_RWHOD_H_ */\n"
  },
  {
    "path": "freebsd-headers/protocols/talkd.h",
    "content": "/*\n * Copyright (c) 1983, 1993\n *\tThe Regents of the University of California.  All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t@(#)talkd.h\t8.1 (Berkeley) 6/2/93\n *\n * $FreeBSD: release/9.0.0/include/protocols/talkd.h 203965 2010-02-16 19:46:46Z imp $\n */\n\n#ifndef _PROTOCOLS_TALKD_H_\n#define\t_PROTOCOLS_TALKD_H_\n\n/*\n * This describes the protocol used by the talk server and clients.\n *\n * The talk server acts a repository of invitations, responding to\n * requests by clients wishing to rendezvous for the purpose of\n * holding a conversation.  In normal operation, a client, the caller,\n * initiates a rendezvous by sending a CTL_MSG to the server of\n * type LOOK_UP.  This causes the server to search its invitation\n * tables to check if an invitation currently exists for the caller\n * (to speak to the callee specified in the message).  If the lookup\n * fails, the caller then sends an ANNOUNCE message causing the server\n * to broadcast an announcement on the callee's login ports requesting\n * contact.  When the callee responds, the local server uses the\n * recorded invitation to respond with the appropriate rendezvous\n * address and the caller and callee client programs establish a\n * stream connection through which the conversation takes place.\n */\n\n/*\n * Client->server request message format.\n */\ntypedef struct {\n\tu_char\tvers;\t\t/* protocol version */\n\tu_char\ttype;\t\t/* request type, see below */\n\tu_char\tanswer;\t\t/* not used */\n\tu_char\tpad;\n\tu_int32_t\tid_num;\t\t/* message id */\n\tstruct\tosockaddr addr;\t\t/* old (4.3) style */\n\tstruct\tosockaddr ctl_addr;\t/* old (4.3) style */\n\tint32_t\tpid;\t\t/* caller's process id */\n#define\tNAME_SIZE\t12\n\tchar\tl_name[NAME_SIZE];/* caller's name */\n\tchar\tr_name[NAME_SIZE];/* callee's name */\n#define\tTTY_SIZE\t16\n\tchar\tr_tty[TTY_SIZE];/* callee's tty name */\n} CTL_MSG;\n\n/*\n * Server->client response message format.\n */\ntypedef struct {\n\tu_char\tvers;\t\t/* protocol version */\n\tu_char\ttype;\t\t/* type of request message, see below */\n\tu_char\tanswer;\t\t/* respose to request message, see below */\n\tu_char\tpad;\n\tu_int32_t\tid_num;\t\t/* message id */\n\tstruct\tosockaddr addr;\t/* address for establishing conversation */\n} CTL_RESPONSE;\n\n#define\tTALK_VERSION\t1\t\t/* protocol version */\n\n/* message type values */\n#define LEAVE_INVITE\t0\t/* leave invitation with server */\n#define LOOK_UP\t\t1\t/* check for invitation by callee */\n#define DELETE\t\t2\t/* delete invitation by caller */\n#define ANNOUNCE\t3\t/* announce invitation by caller */\n\n/* answer values */\n#define SUCCESS\t\t0\t/* operation completed properly */\n#define NOT_HERE\t1\t/* callee not logged in */\n#define FAILED\t\t2\t/* operation failed for unexplained reason */\n#define MACHINE_UNKNOWN\t3\t/* caller's machine name unknown */\n#define PERMISSION_DENIED 4\t/* callee's tty doesn't permit announce */\n#define UNKNOWN_REQUEST\t5\t/* request has invalid type value */\n#define\tBADVERSION\t6\t/* request has invalid protocol version */\n#define\tBADADDR\t\t7\t/* request has invalid addr value */\n#define\tBADCTLADDR\t8\t/* request has invalid ctl_addr value */\n\n/*\n * Operational parameters.\n */\n#define MAX_LIFE\t60\t/* max time daemon saves invitations */\n/* RING_WAIT should be 10's of seconds less than MAX_LIFE */\n#define RING_WAIT\t30\t/* time to wait before resending invitation */\n\n#endif /* !_TALKD_H_ */\n"
  },
  {
    "path": "freebsd-headers/protocols/timed.h",
    "content": "/*\n * Copyright (c) 1983, 1993\n *\tThe Regents of the University of California.  All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t@(#)timed.h\t8.1 (Berkeley) 6/2/93\n *\n * $FreeBSD: release/9.0.0/include/protocols/timed.h 203965 2010-02-16 19:46:46Z imp $\n */\n\n#ifndef\t_PROTOCOLS_TIMED_H_\n#define\t_PROTOCOLS_TIMED_H_\n\n/*\n * Time Synchronization Protocol\n */\n\n#define\tTSPVERSION\t1\n#define ANYADDR \tNULL\n\nstruct tsp {\n\tu_int8_t\ttsp_type;\n\tu_int8_t\ttsp_vers;\n\tu_int16_t\ttsp_seq;\n\tunion {\n\t\tstruct {\n\t\t\tint32_t\ttv_sec;\n\t\t\tint32_t\ttv_usec;\n\t\t} tspu_time;\n\t\tchar tspu_hopcnt;\n\t} tsp_u;\n\tchar tsp_name[MAXHOSTNAMELEN];\n};\n\n#define\ttsp_time\ttsp_u.tspu_time\n#define\ttsp_hopcnt\ttsp_u.tspu_hopcnt\n\n/*\n * Command types.\n */\n#define\tTSP_ANY\t\t\t0\t/* match any types */\n#define\tTSP_ADJTIME\t\t1\t/* send adjtime */\n#define\tTSP_ACK\t\t\t2\t/* generic acknowledgement */\n#define\tTSP_MASTERREQ\t\t3\t/* ask for master's name */\n#define\tTSP_MASTERACK\t\t4\t/* acknowledge master request */\n#define\tTSP_SETTIME\t\t5\t/* send network time */\n#define\tTSP_MASTERUP\t\t6\t/* inform slaves that master is up */\n#define\tTSP_SLAVEUP\t\t7\t/* slave is up but not polled */\n#define\tTSP_ELECTION\t\t8\t/* advance candidature for master */\n#define\tTSP_ACCEPT\t\t9\t/* support candidature of master */\n#define\tTSP_REFUSE\t\t10\t/* reject candidature of master */\n#define\tTSP_CONFLICT\t\t11\t/* two or more masters present */\n#define\tTSP_RESOLVE\t\t12\t/* masters' conflict resolution */\n#define\tTSP_QUIT\t\t13\t/* reject candidature if master is up */\n#define\tTSP_DATE\t\t14\t/* reset the time (date command) */\n#define\tTSP_DATEREQ\t\t15\t/* remote request to reset the time */\n#define\tTSP_DATEACK\t\t16\t/* acknowledge time setting  */\n#define\tTSP_TRACEON\t\t17\t/* turn tracing on */\n#define\tTSP_TRACEOFF\t\t18\t/* turn tracing off */\n#define\tTSP_MSITE\t\t19\t/* find out master's site */\n#define\tTSP_MSITEREQ\t\t20\t/* remote master's site request */\n#define\tTSP_TEST\t\t21\t/* for testing election algo */\n#define\tTSP_SETDATE\t\t22\t/* New from date command */\n#define\tTSP_SETDATEREQ\t\t23\t/* New remote for above */\n#define\tTSP_LOOP\t\t24\t/* loop detection packet */\n\n#define\tTSPTYPENUMBER\t\t25\n\n#ifdef TSPTYPES\nconst char *tsptype[TSPTYPENUMBER] =\n  { \"ANY\", \"ADJTIME\", \"ACK\", \"MASTERREQ\", \"MASTERACK\", \"SETTIME\", \"MASTERUP\",\n  \"SLAVEUP\", \"ELECTION\", \"ACCEPT\", \"REFUSE\", \"CONFLICT\", \"RESOLVE\", \"QUIT\",\n  \"DATE\", \"DATEREQ\", \"DATEACK\", \"TRACEON\", \"TRACEOFF\", \"MSITE\", \"MSITEREQ\",\n  \"TEST\", \"SETDATE\", \"SETDATEREQ\", \"LOOP\" };\n#endif\n\n#endif /* !_TIMED_H_ */\n"
  },
  {
    "path": "freebsd-headers/ps4-offsets/672.h",
    "content": "#pragma once\n#define kernel_offset_xfast_syscall 0x1c0\n#define kernel_offset_allproc 0x22bbe80\n#define kernel_offset_vmspace_acquire_ref 0x44cb90\n#define kernel_offset_vmspace_free 0x44c9c0\n#define kernel_offset_printf 0x123280\n#define kernel_offset_kmem_alloc 0x250730\n#define kernel_offset_kernel_map 0x220dfc0\n#define kernel_offset_sysent 0x111e000\n#define kernel_offset_proc_rwmem 0x10ee10\n\n#define kernel_patch_kmem_alloc_1 0x2507f5\n#define kernel_patch_kmem_alloc_2 0x250803\n"
  },
  {
    "path": "freebsd-headers/ps4-offsets/702.h",
    "content": "#pragma once\n#define kernel_offset_xfast_syscall 0x1c0\n#define kernel_offset_allproc 0x1b48318\n#define kernel_offset_vmspace_acquire_ref 0x25f9f0\n#define kernel_offset_vmspace_free 0x25f820\n#define kernel_offset_printf 0xbc730\n#define kernel_offset_kmem_alloc 0x1170f0\n#define kernel_offset_kernel_map 0x21c8ee0\n#define kernel_offset_sysent 0x1125660\n#define kernel_offset_proc_rwmem 0x43e80\n\n#define kernel_patch_kmem_alloc_1 0x1171be\n#define kernel_patch_kmem_alloc_2 0x1171c6\n"
  },
  {
    "path": "freebsd-headers/ps4-offsets/755.h",
    "content": "#pragma once\n#define kernel_offset_xfast_syscall 0x1c0\n#define kernel_offset_allproc 0x213c828\n#define kernel_offset_vmspace_acquire_ref 0x2fc290\n#define kernel_offset_vmspace_free 0x2fc0c0\n#define kernel_offset_printf 0x26f740\n#define kernel_offset_kmem_alloc 0x1753e0\n#define kernel_offset_kernel_map 0x21405b8\n#define kernel_offset_sysent 0x1122340\n#define kernel_offset_proc_rwmem 0x361310\n\n#define kernel_patch_kmem_alloc_1 0x1754ac\n#define kernel_patch_kmem_alloc_2 0x1754b4\n"
  },
  {
    "path": "freebsd-headers/ps4-offsets/900.h",
    "content": "#pragma once\n#define kernel_offset_xfast_syscall 0x1c0\n#define kernel_offset_allproc 0x1b946e0\n#define kernel_offset_vmspace_acquire_ref 0x7b9e0\n#define kernel_offset_vmspace_free 0x7b810\n#define kernel_offset_printf 0xb7a30\n#define kernel_offset_kmem_alloc 0x37be70\n#define kernel_offset_kernel_map 0x2268d48\n#define kernel_offset_sysent 0x1100310\n#define kernel_offset_proc_rwmem 0x41eb00\n#define kernel_offset_copyin 0x2716a0\n\n#define kernel_patch_kmem_alloc_1 0x37bf3c\n#define kernel_patch_kmem_alloc_2 0x37bf44\n"
  },
  {
    "path": "freebsd-headers/ps4-offsets/kernel.h",
    "content": "#ifdef __9_00__\n#include \"900.h\"\n#else\n#ifdef __7_55__\n#include \"755.h\"\n#else\n#ifdef __7_02__\n#include \"702.h\"\n#else\n#ifdef __6_72__\n#include \"672.h\"\n#else\n#error \"unsupported firmware\"\n#endif\n#endif\n#endif\n#endif\n"
  },
  {
    "path": "freebsd-headers/pthread.h",
    "content": "/*\n * Copyright (c) 1993, 1994 by Chris Provenzano, proven@mit.edu\n * Copyright (c) 1995-1998 by John Birrell <jb@cimlogic.com.au>\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. All advertising materials mentioning features or use of this software\n *    must display the following acknowledgement:\n *  This product includes software developed by Chris Provenzano.\n * 4. The name of Chris Provenzano may not be used to endorse or promote \n *\t  products derived from this software without specific prior written\n *\t  permission.\n *\n * THIS SOFTWARE IS PROVIDED BY CHRIS PROVENZANO ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL CHRIS PROVENZANO BE LIABLE FOR ANY \n * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR \n * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT \n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF \n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/include/pthread.h 217039 2011-01-06 03:30:16Z davidxu $\n */\n#ifndef _PTHREAD_H_\n#define _PTHREAD_H_\n\n/*\n * Header files.\n */\n#include <sys/cdefs.h>\n#include <sys/_pthreadtypes.h>\n#include <machine/_limits.h>\n#include <machine/_types.h>\n#include <sys/_sigset.h>\n#include <sched.h>\n#include <time.h>\n\n/*\n * Run-time invariant values:\n */\n#define PTHREAD_DESTRUCTOR_ITERATIONS\t\t4\n#define PTHREAD_KEYS_MAX\t\t\t256\n#define PTHREAD_STACK_MIN\t\t\t__MINSIGSTKSZ\n#define PTHREAD_THREADS_MAX\t\t\t__ULONG_MAX\n#define PTHREAD_BARRIER_SERIAL_THREAD\t\t-1\n\n/*\n * Flags for threads and thread attributes.\n */\n#define PTHREAD_DETACHED            0x1\n#define PTHREAD_SCOPE_SYSTEM        0x2\n#define PTHREAD_INHERIT_SCHED       0x4\n#define PTHREAD_NOFLOAT             0x8\n\n#define PTHREAD_CREATE_DETACHED     PTHREAD_DETACHED\n#define PTHREAD_CREATE_JOINABLE     0\n#define PTHREAD_SCOPE_PROCESS       0\n#define PTHREAD_EXPLICIT_SCHED      0\n\n/*\n * Flags for read/write lock attributes\n */\n#define PTHREAD_PROCESS_PRIVATE     0\n#define PTHREAD_PROCESS_SHARED      1\t\n\n/*\n * Flags for cancelling threads\n */\n#define PTHREAD_CANCEL_ENABLE\t\t0\n#define PTHREAD_CANCEL_DISABLE\t\t1\n#define PTHREAD_CANCEL_DEFERRED\t\t0\n#define PTHREAD_CANCEL_ASYNCHRONOUS\t2\n#define PTHREAD_CANCELED\t\t((void *) 1)\n\n/*\n * Flags for once initialization.\n */\n#define PTHREAD_NEEDS_INIT  0\n#define PTHREAD_DONE_INIT   1\n\n/*\n * Static once initialization values. \n */\n#define PTHREAD_ONCE_INIT   { PTHREAD_NEEDS_INIT, NULL }\n\n/*\n * Static initialization values. \n */\n#define PTHREAD_MUTEX_INITIALIZER\tNULL\n#define PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP\t((pthread_mutex_t)1)\n#define PTHREAD_COND_INITIALIZER\tNULL\n#define PTHREAD_RWLOCK_INITIALIZER\tNULL\n\n/*\n * Default attribute arguments (draft 4, deprecated).\n */\n#ifndef PTHREAD_KERNEL\n#define pthread_condattr_default    NULL\n#define pthread_mutexattr_default   NULL\n#define pthread_attr_default        NULL\n#endif\n\n#define PTHREAD_PRIO_NONE\t0\n#define PTHREAD_PRIO_INHERIT\t1\n#define PTHREAD_PRIO_PROTECT\t2\n\n/*\n * Mutex types (Single UNIX Specification, Version 2, 1997).\n *\n * Note that a mutex attribute with one of the following types:\n *\n *\tPTHREAD_MUTEX_NORMAL\n *\tPTHREAD_MUTEX_RECURSIVE\n *\n * will deviate from POSIX specified semantics.\n */\nenum pthread_mutextype {\n\tPTHREAD_MUTEX_ERRORCHECK\t= 1,\t/* Default POSIX mutex */\n\tPTHREAD_MUTEX_RECURSIVE\t\t= 2,\t/* Recursive mutex */\n\tPTHREAD_MUTEX_NORMAL\t\t= 3,\t/* No error checking */\n\tPTHREAD_MUTEX_ADAPTIVE_NP\t= 4,\t/* Adaptive mutex, spins briefly before blocking on lock */\n\tPTHREAD_MUTEX_TYPE_MAX\n};\n\n#define PTHREAD_MUTEX_DEFAULT\t\tPTHREAD_MUTEX_ERRORCHECK\n\nstruct _pthread_cleanup_info {\n\t__uintptr_t\tpthread_cleanup_pad[8];\n};\n\n/*\n * Thread function prototype definitions:\n */\n__BEGIN_DECLS\nint\t\tpthread_atfork(void (*)(void), void (*)(void), void (*)(void));\nint\t\tpthread_attr_destroy(pthread_attr_t *);\nint\t\tpthread_attr_getstack(const pthread_attr_t * __restrict, \n\t\t\tvoid ** __restrict, size_t * __restrict);\nint\t\tpthread_attr_getstacksize(const pthread_attr_t *, size_t *);\nint\t\tpthread_attr_getguardsize(const pthread_attr_t *, size_t *);\nint\t\tpthread_attr_getstackaddr(const pthread_attr_t *, void **);\nint\t\tpthread_attr_getdetachstate(const pthread_attr_t *, int *);\nint\t\tpthread_attr_init(pthread_attr_t *);\nint\t\tpthread_attr_setstacksize(pthread_attr_t *, size_t);\nint\t\tpthread_attr_setguardsize(pthread_attr_t *, size_t);\nint\t\tpthread_attr_setstack(pthread_attr_t *, void *, size_t);\nint\t\tpthread_attr_setstackaddr(pthread_attr_t *, void *);\nint\t\tpthread_attr_setdetachstate(pthread_attr_t *, int);\nint\t\tpthread_barrier_destroy(pthread_barrier_t *);\nint\t\tpthread_barrier_init(pthread_barrier_t *,\n\t\t\tconst pthread_barrierattr_t *, unsigned);\nint\t\tpthread_barrier_wait(pthread_barrier_t *);\nint\t\tpthread_barrierattr_destroy(pthread_barrierattr_t *);\nint\t\tpthread_barrierattr_getpshared(const pthread_barrierattr_t *,\n\t\t\tint *);\nint\t\tpthread_barrierattr_init(pthread_barrierattr_t *);\nint\t\tpthread_barrierattr_setpshared(pthread_barrierattr_t *, int);\n\n#define\t\tpthread_cleanup_push(cleanup_routine, cleanup_arg)\t\t\\\n\t\t{\t\t\t\t\t\t\t\t\\\n\t\t\tstruct _pthread_cleanup_info __cleanup_info__;\t\t\\\n\t\t\t__pthread_cleanup_push_imp(cleanup_routine, cleanup_arg,\\\n\t\t\t\t&__cleanup_info__);\t\t\t\t\\\n\t\t\t{\n\n#define\t\tpthread_cleanup_pop(execute)\t\t\t\t\t\\\n\t\t\t}\t\t\t\t\t\t\t\\\n\t\t\t__pthread_cleanup_pop_imp(execute);\t\t\t\\\n\t\t}\n\nint\t\tpthread_condattr_destroy(pthread_condattr_t *);\nint\t\tpthread_condattr_getclock(const pthread_condattr_t *,\n\t\t\tclockid_t *);\nint\t\tpthread_condattr_getpshared(const pthread_condattr_t *, int *);\nint\t\tpthread_condattr_init(pthread_condattr_t *);\nint\t\tpthread_condattr_setclock(pthread_condattr_t *, clockid_t);\nint\t\tpthread_condattr_setpshared(pthread_condattr_t *, int);\nint\t\tpthread_cond_broadcast(pthread_cond_t *);\nint\t\tpthread_cond_destroy(pthread_cond_t *);\nint\t\tpthread_cond_init(pthread_cond_t *,\n\t\t\tconst pthread_condattr_t *);\nint\t\tpthread_cond_signal(pthread_cond_t *);\nint\t\tpthread_cond_timedwait(pthread_cond_t *,\n\t\t\tpthread_mutex_t *, const struct timespec *);\nint\t\tpthread_cond_wait(pthread_cond_t *, pthread_mutex_t *);\nint\t\tpthread_create(pthread_t *, const pthread_attr_t *,\n\t\t\tvoid *(*) (void *), void *);\nint\t\tpthread_detach(pthread_t);\nint\t\tpthread_equal(pthread_t, pthread_t);\nvoid\t\tpthread_exit(void *) __dead2;\nvoid\t\t*pthread_getspecific(pthread_key_t);\nint\t\tpthread_getcpuclockid(pthread_t, clockid_t *);\nint\t\tpthread_join(pthread_t, void **);\nint\t\tpthread_key_create(pthread_key_t *,\n\t\t\tvoid (*) (void *));\nint\t\tpthread_key_delete(pthread_key_t);\nint\t\tpthread_mutexattr_init(pthread_mutexattr_t *);\nint\t\tpthread_mutexattr_destroy(pthread_mutexattr_t *);\nint\t\tpthread_mutexattr_getpshared(const pthread_mutexattr_t *,\n\t\t\tint *);\nint\t\tpthread_mutexattr_gettype(pthread_mutexattr_t *, int *);\nint\t\tpthread_mutexattr_settype(pthread_mutexattr_t *, int);\nint\t\tpthread_mutexattr_setpshared(pthread_mutexattr_t *, int);\nint\t\tpthread_mutex_destroy(pthread_mutex_t *);\nint\t\tpthread_mutex_init(pthread_mutex_t *,\n\t\t\tconst pthread_mutexattr_t *);\nint\t\tpthread_mutex_lock(pthread_mutex_t *);\nint\t\tpthread_mutex_trylock(pthread_mutex_t *);\nint\t\tpthread_mutex_timedlock(pthread_mutex_t *,\n\t\t\tconst struct timespec *);\nint\t\tpthread_mutex_unlock(pthread_mutex_t *);\nint\t\tpthread_once(pthread_once_t *, void (*) (void));\nint\t\tpthread_rwlock_destroy(pthread_rwlock_t *);\nint\t\tpthread_rwlock_init(pthread_rwlock_t *,\n\t\t\tconst pthread_rwlockattr_t *);\nint\t\tpthread_rwlock_rdlock(pthread_rwlock_t *);\nint\t\tpthread_rwlock_timedrdlock(pthread_rwlock_t *,\n\t\t\tconst struct timespec *);\nint\t\tpthread_rwlock_timedwrlock(pthread_rwlock_t *,\n\t\t\tconst struct timespec *);\nint\t\tpthread_rwlock_tryrdlock(pthread_rwlock_t *);\nint\t\tpthread_rwlock_trywrlock(pthread_rwlock_t *);\nint\t\tpthread_rwlock_unlock(pthread_rwlock_t *);\nint\t\tpthread_rwlock_wrlock(pthread_rwlock_t *);\nint\t\tpthread_rwlockattr_destroy(pthread_rwlockattr_t *);\nint\t\tpthread_rwlockattr_getkind_np(const pthread_rwlockattr_t *,\n\t\t\tint *);\nint\t\tpthread_rwlockattr_getpshared(const pthread_rwlockattr_t *,\n\t\t\tint *);\nint\t\tpthread_rwlockattr_init(pthread_rwlockattr_t *);\nint\t\tpthread_rwlockattr_setkind_np(pthread_rwlockattr_t *, int);\nint\t\tpthread_rwlockattr_setpshared(pthread_rwlockattr_t *, int);\npthread_t\tpthread_self(void);\nint\t\tpthread_setspecific(pthread_key_t, const void *);\n\nint\t\tpthread_spin_init(pthread_spinlock_t *, int);\nint\t\tpthread_spin_destroy(pthread_spinlock_t *);\nint\t\tpthread_spin_lock(pthread_spinlock_t *);\nint\t\tpthread_spin_trylock(pthread_spinlock_t *);\nint\t\tpthread_spin_unlock(pthread_spinlock_t *);\nint\t\tpthread_cancel(pthread_t);\nint\t\tpthread_setcancelstate(int, int *);\nint\t\tpthread_setcanceltype(int, int *);\nvoid\t\tpthread_testcancel(void);\n\n#if __BSD_VISIBLE\nint\t\tpthread_getprio(pthread_t);\nint\t\tpthread_setprio(pthread_t, int);\nvoid\t\tpthread_yield(void);\n#endif\n\nint\t\tpthread_mutexattr_getprioceiling(pthread_mutexattr_t *,\n\t\t\tint *);\nint\t\tpthread_mutexattr_setprioceiling(pthread_mutexattr_t *,\n\t\t\tint);\nint\t\tpthread_mutex_getprioceiling(pthread_mutex_t *, int *);\nint\t\tpthread_mutex_setprioceiling(pthread_mutex_t *, int, int *);\n\nint\t\tpthread_mutexattr_getprotocol(pthread_mutexattr_t *, int *);\nint\t\tpthread_mutexattr_setprotocol(pthread_mutexattr_t *, int);\n\nint\t\tpthread_attr_getinheritsched(const pthread_attr_t *, int *);\nint\t\tpthread_attr_getschedparam(const pthread_attr_t *,\n\t\t\tstruct sched_param *);\nint\t\tpthread_attr_getschedpolicy(const pthread_attr_t *, int *);\nint\t\tpthread_attr_getscope(const pthread_attr_t *, int *);\nint\t\tpthread_attr_setinheritsched(pthread_attr_t *, int);\nint\t\tpthread_attr_setschedparam(pthread_attr_t *,\n\t\t\tconst struct sched_param *);\nint\t\tpthread_attr_setschedpolicy(pthread_attr_t *, int);\nint\t\tpthread_attr_setscope(pthread_attr_t *, int);\nint\t\tpthread_getschedparam(pthread_t pthread, int *,\n\t\t\tstruct sched_param *);\nint\t\tpthread_setschedparam(pthread_t, int,\n\t\t\tconst struct sched_param *);\n#if __XSI_VISIBLE\nint\t\tpthread_getconcurrency(void);\nint\t\tpthread_setconcurrency(int);\n#endif\n\nvoid\t\t__pthread_cleanup_push_imp(void (*)(void *), void *,\n\t\t\tstruct _pthread_cleanup_info *);\nvoid\t\t__pthread_cleanup_pop_imp(int);\n__END_DECLS\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/pthread_np.h",
    "content": "/*\n * Copyright (c) 1996-98 John Birrell <jb@cimlogic.com.au>.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. Neither the name of the author nor the names of any co-contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY JOHN BIRRELL AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/include/pthread_np.h 218414 2011-02-07 21:26:46Z jkim $\n */\n#ifndef _PTHREAD_NP_H_\n#define _PTHREAD_NP_H_\n\n#include <sys/param.h>\n#include <sys/cpuset.h>\n\n/*\n * Non-POSIX type definitions:\n */\ntypedef void\t(*pthread_switch_routine_t)(pthread_t, pthread_t);\n\n/*\n * Non-POSIX thread function prototype definitions:\n */\n__BEGIN_DECLS\nint pthread_attr_setcreatesuspend_np(pthread_attr_t *);\nint pthread_attr_get_np(pthread_t, pthread_attr_t *);\nint pthread_attr_getaffinity_np(const pthread_attr_t *, size_t, cpuset_t *);\nint pthread_attr_setaffinity_np(pthread_attr_t *, size_t, const cpuset_t *);\nint pthread_getaffinity_np(pthread_t, size_t, cpuset_t *);\nint pthread_getthreadid_np(void);\nint pthread_main_np(void);\nint pthread_multi_np(void);\nint pthread_mutexattr_getkind_np(pthread_mutexattr_t);\nint pthread_mutexattr_setkind_np(pthread_mutexattr_t *, int);\nvoid pthread_resume_all_np(void);\nint pthread_resume_np(pthread_t);\nvoid pthread_set_name_np(pthread_t, const char *);\nint pthread_mutex_getspinloops_np(pthread_mutex_t *mutex, int *count);\nint pthread_mutex_setspinloops_np(pthread_mutex_t *mutex, int count);\nint pthread_mutex_getyieldloops_np(pthread_mutex_t *mutex, int *count);\nint pthread_mutex_setyieldloops_np(pthread_mutex_t *mutex, int count);\nint pthread_mutex_isowned_np(pthread_mutex_t *mutex);\nint pthread_setaffinity_np(pthread_t, size_t, const cpuset_t *);\nint pthread_single_np(void);\nvoid pthread_suspend_all_np(void);\nint pthread_suspend_np(pthread_t);\nint pthread_switch_add_np(pthread_switch_routine_t);\nint pthread_switch_delete_np(pthread_switch_routine_t);\nint pthread_timedjoin_np(pthread_t, void **, const struct timespec *);\n__END_DECLS\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/pwd.h",
    "content": "/*-\n * Copyright (c) 1989, 1993\n *\tThe Regents of the University of California.  All rights reserved.\n * (c) UNIX System Laboratories, Inc.\n * All or some portions of this file are derived from material licensed\n * to the University of California by American Telephone and Telegraph\n * Co. or Unix System Laboratories, Inc. and are reproduced herein with\n * the permission of UNIX System Laboratories, Inc.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t@(#)pwd.h\t8.2 (Berkeley) 1/21/94\n * $FreeBSD: release/9.0.0/include/pwd.h 203964 2010-02-16 19:39:50Z imp $\n */\n\n#ifndef _PWD_H_\n#define\t_PWD_H_\n\n#include <sys/cdefs.h>\n#include <sys/_types.h>\n\n#ifndef _GID_T_DECLARED\ntypedef\t__gid_t\t\tgid_t;\n#define\t_GID_T_DECLARED\n#endif\n\n#ifndef _TIME_T_DECLARED\ntypedef\t__time_t\ttime_t;\n#define\t_TIME_T_DECLARED\n#endif\n\n#ifndef _UID_T_DECLARED\ntypedef\t__uid_t\t\tuid_t;\n#define\t_UID_T_DECLARED\n#endif\n\n#ifndef _SIZE_T_DECLARED\ntypedef __size_t\tsize_t;\n#define _SIZE_T_DECLARED\n#endif\n\n#define _PATH_PWD\t\t\"/etc\"\n#define\t_PATH_PASSWD\t\t\"/etc/passwd\"\n#define\t_PASSWD\t\t\t\"passwd\"\n#define\t_PATH_MASTERPASSWD\t\"/etc/master.passwd\"\n#define\t_MASTERPASSWD\t\t\"master.passwd\"\n\n#define\t_PATH_MP_DB\t\t\"/etc/pwd.db\"\n#define\t_MP_DB\t\t\t\"pwd.db\"\n#define\t_PATH_SMP_DB\t\t\"/etc/spwd.db\"\n#define\t_SMP_DB\t\t\t\"spwd.db\"\n\n#define\t_PATH_PWD_MKDB\t\t\"/usr/sbin/pwd_mkdb\"\n\n/* Historically, the keys in _PATH_MP_DB/_PATH_SMP_DB had the format\n * `1 octet tag | key', where the tag is one of the _PW_KEY* values\n * listed below.  These values happen to be ASCII digits.  Starting\n * with FreeBSD 5.1, the tag is now still a single octet, but the\n * upper 4 bits are interpreted as a version.  Pre-FreeBSD 5.1 format\n * entries are version `3' -- this conveniently results in the same\n * key values as before.  The new, architecture-independent entries\n * are version `4'.\n * As it happens, some applications read the database directly.\n * (Bad app, no cookie!)  Thus, we leave the _PW_KEY* symbols at their\n * old pre-FreeBSD 5.1 values so these apps still work.  Consequently\n * we have to muck around a bit more to get the correct, versioned\n * tag, and that is what the _PW_VERSIONED macro is about.\n */\n\n#define _PW_VERSION_MASK\t'\\xF0'\n#define _PW_VERSIONED(x, v)\t((unsigned char)(((x) & 0xCF) | ((v)<<4)))\n\n#define\t_PW_KEYBYNAME\t\t'\\x31'\t/* stored by name */\n#define\t_PW_KEYBYNUM\t\t'\\x32'\t/* stored by entry in the \"file\" */\n#define\t_PW_KEYBYUID\t\t'\\x33'\t/* stored by uid */\n#define _PW_KEYYPENABLED\t'\\x34'\t/* YP is enabled */\n#define\t_PW_KEYYPBYNUM\t\t'\\x35'\t/* special +@netgroup entries */\n\n/* The database also contains a key to indicate the format version of\n * the entries therein.  There may be other, older versioned entries\n * as well.\n */\n#define _PWD_VERSION_KEY\t\"\\xFF\" \"VERSION\"\n#define _PWD_CURRENT_VERSION\t'\\x04'\n\n#define\t_PASSWORD_EFMT1\t\t'_'\t/* extended encryption format */\n\n#define\t_PASSWORD_LEN\t\t128\t/* max length, not counting NULL */\n\nstruct passwd {\n\tchar\t*pw_name;\t\t/* user name */\n\tchar\t*pw_passwd;\t\t/* encrypted password */\n\tuid_t\tpw_uid;\t\t\t/* user uid */\n\tgid_t\tpw_gid;\t\t\t/* user gid */\n\ttime_t\tpw_change;\t\t/* password change time */\n\tchar\t*pw_class;\t\t/* user access class */\n\tchar\t*pw_gecos;\t\t/* Honeywell login info */\n\tchar\t*pw_dir;\t\t/* home directory */\n\tchar\t*pw_shell;\t\t/* default shell */\n\ttime_t\tpw_expire;\t\t/* account expiration */\n\tint\tpw_fields;\t\t/* internal: fields filled in */\n};\n\n/* Mapping from fields to bits for pw_fields. */\n#define _PWF(x)\t\t(1 << x)\n#define _PWF_NAME\t_PWF(0)\n#define _PWF_PASSWD\t_PWF(1)\n#define _PWF_UID\t_PWF(2)\n#define _PWF_GID\t_PWF(3)\n#define _PWF_CHANGE\t_PWF(4)\n#define _PWF_CLASS\t_PWF(5)\n#define _PWF_GECOS\t_PWF(6)\n#define _PWF_DIR\t_PWF(7)\n#define _PWF_SHELL\t_PWF(8)\n#define _PWF_EXPIRE\t_PWF(9)\n\n/* XXX These flags are bogus.  With nsswitch, there are many\n * possible sources and they cannot be represented in a small integer.\n */                           \n#define _PWF_SOURCE\t0x3000\n#define _PWF_FILES\t0x1000\n#define _PWF_NIS\t0x2000\n#define _PWF_HESIOD\t0x3000\n\n__BEGIN_DECLS\nstruct passwd\t*getpwnam(const char *);\nstruct passwd\t*getpwuid(uid_t);\n\n#if __XSI_VISIBLE >= 500\nvoid\t\t endpwent(void);\nstruct passwd\t*getpwent(void);\nvoid\t\t setpwent(void);\n#endif\n\n#if __POSIX_VISIBLE >= 200112 || __XSI_VISIBLE >= 500\nint\t\t getpwnam_r(const char *, struct passwd *, char *, size_t,\n\t\t    struct passwd **);\nint\t\t getpwuid_r(uid_t, struct passwd *, char *, size_t,\n\t\t    struct passwd **);\n#endif\n\n#if __BSD_VISIBLE\nint\t\t getpwent_r(struct passwd *, char *, size_t, struct passwd **);\nint\t\t setpassent(int);\nconst char\t*user_from_uid(uid_t, int);\n#endif\n__END_DECLS\n\n#endif /* !_PWD_H_ */\n"
  },
  {
    "path": "freebsd-headers/radlib.h",
    "content": "/*-\n * Copyright 1998 Juniper Networks, Inc.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t$FreeBSD: release/9.0.0/lib/libradius/radlib.h 197086 2009-09-11 11:42:56Z mav $\n */\n\n#ifndef _RADLIB_H_\n#define _RADLIB_H_\n\n#include <sys/types.h>\n#include <netinet/in.h>\n\n/* Limits */\n#define RAD_MAX_ATTR_LEN\t\t253\n\n/* Message types */\n#define RAD_ACCESS_REQUEST\t\t1\n#define RAD_ACCESS_ACCEPT\t\t2\n#define RAD_ACCESS_REJECT\t\t3\n#define RAD_ACCOUNTING_REQUEST\t\t4\n#define RAD_ACCOUNTING_RESPONSE\t\t5\n#define RAD_ACCESS_CHALLENGE\t\t11\n#define RAD_DISCONNECT_REQUEST\t\t40\n#define RAD_DISCONNECT_ACK\t\t41\n#define RAD_DISCONNECT_NAK\t\t42\n#define RAD_COA_REQUEST\t\t\t43\n#define RAD_COA_ACK\t\t\t44\n#define RAD_COA_NAK\t\t\t45\n\n/* Attribute types and values */\n#define RAD_USER_NAME\t\t\t1\t/* String */\n#define RAD_USER_PASSWORD\t\t2\t/* String */\n#define RAD_CHAP_PASSWORD\t\t3\t/* String */\n#define RAD_NAS_IP_ADDRESS\t\t4\t/* IP address */\n#define RAD_NAS_PORT\t\t\t5\t/* Integer */\n#define RAD_SERVICE_TYPE\t\t6\t/* Integer */\n\t#define RAD_LOGIN\t\t\t1\n\t#define RAD_FRAMED\t\t\t2\n\t#define RAD_CALLBACK_LOGIN\t\t3\n\t#define RAD_CALLBACK_FRAMED\t\t4\n\t#define RAD_OUTBOUND\t\t\t5\n\t#define RAD_ADMINISTRATIVE\t\t6\n\t#define RAD_NAS_PROMPT\t\t\t7\n\t#define RAD_AUTHENTICATE_ONLY\t\t8\n\t#define RAD_CALLBACK_NAS_PROMPT\t\t9\n#define RAD_FRAMED_PROTOCOL\t\t7\t/* Integer */\n\t#define RAD_PPP\t\t\t\t1\n\t#define RAD_SLIP\t\t\t2\n\t#define RAD_ARAP\t\t\t3\t/* Appletalk */\n\t#define RAD_GANDALF\t\t\t4\n\t#define RAD_XYLOGICS\t\t\t5\n#define RAD_FRAMED_IP_ADDRESS\t\t8\t/* IP address */\n#define RAD_FRAMED_IP_NETMASK\t\t9\t/* IP address */\n#define RAD_FRAMED_ROUTING\t\t10\t/* Integer */\n#define RAD_FILTER_ID\t\t\t11\t/* String */\n#define RAD_FRAMED_MTU\t\t\t12\t/* Integer */\n#define RAD_FRAMED_COMPRESSION\t\t13\t/* Integer */\n\t#define RAD_COMP_NONE\t\t\t0\n\t#define RAD_COMP_VJ\t\t\t1\n\t#define RAD_COMP_IPXHDR\t\t\t2\n#define RAD_LOGIN_IP_HOST\t\t14\t/* IP address */\n#define RAD_LOGIN_SERVICE\t\t15\t/* Integer */\n#define RAD_LOGIN_TCP_PORT\t\t16\t/* Integer */\n     /* unassiged\t\t\t17 */\n#define RAD_REPLY_MESSAGE\t\t18\t/* String */\n#define RAD_CALLBACK_NUMBER\t\t19\t/* String */\n#define RAD_CALLBACK_ID\t\t\t20\t/* String */\n     /* unassiged\t\t\t21 */\n#define RAD_FRAMED_ROUTE\t\t22\t/* String */\n#define RAD_FRAMED_IPX_NETWORK\t\t23\t/* IP address */\n#define RAD_STATE\t\t\t24\t/* String */\n#define RAD_CLASS\t\t\t25\t/* Integer */\n#define RAD_VENDOR_SPECIFIC\t\t26\t/* Integer */\n#define RAD_SESSION_TIMEOUT\t\t27\t/* Integer */\n#define RAD_IDLE_TIMEOUT\t\t28\t/* Integer */\n#define RAD_TERMINATION_ACTION\t\t29\t/* Integer */\n#define RAD_CALLED_STATION_ID\t\t30\t/* String */\n#define RAD_CALLING_STATION_ID\t\t31\t/* String */\n#define RAD_NAS_IDENTIFIER\t\t32\t/* Integer */\n#define RAD_PROXY_STATE\t\t\t33\t/* Integer */\n#define RAD_LOGIN_LAT_SERVICE\t\t34\t/* Integer */\n#define RAD_LOGIN_LAT_NODE\t\t35\t/* Integer */\n#define RAD_LOGIN_LAT_GROUP\t\t36\t/* Integer */\n#define RAD_FRAMED_APPLETALK_LINK\t37\t/* Integer */\n#define RAD_FRAMED_APPLETALK_NETWORK\t38\t/* Integer */\n#define RAD_FRAMED_APPLETALK_ZONE\t39\t/* Integer */\n     /* reserved for accounting\t\t40-59 */\n#define RAD_ACCT_INPUT_GIGAWORDS\t52\n#define RAD_ACCT_OUTPUT_GIGAWORDS\t53\n\n#define RAD_CHAP_CHALLENGE\t\t60\t/* String */\n#define RAD_NAS_PORT_TYPE\t\t61\t/* Integer */\n\t#define RAD_ASYNC\t\t\t0\n\t#define RAD_SYNC\t\t\t1\n\t#define RAD_ISDN_SYNC\t\t\t2\n\t#define RAD_ISDN_ASYNC_V120\t\t3\n\t#define RAD_ISDN_ASYNC_V110\t\t4\n\t#define RAD_VIRTUAL\t\t\t5\n\t#define RAD_PIAFS\t\t\t6\n\t#define RAD_HDLC_CLEAR_CHANNEL\t\t7\n\t#define RAD_X_25\t\t\t8\n\t#define RAD_X_75\t\t\t9\n\t#define RAD_G_3_FAX\t\t\t10\n\t#define RAD_SDSL\t\t\t11\n\t#define RAD_ADSL_CAP\t\t\t12\n\t#define RAD_ADSL_DMT\t\t\t13\n\t#define RAD_IDSL\t\t\t14\n\t#define RAD_ETHERNET\t\t\t15\n\t#define RAD_XDSL\t\t\t16\n\t#define RAD_CABLE\t\t\t17\n\t#define RAD_WIRELESS_OTHER\t\t18\n\t#define RAD_WIRELESS_IEEE_802_11\t19\n#define RAD_PORT_LIMIT\t\t\t62\t/* Integer */\n#define RAD_LOGIN_LAT_PORT\t\t63\t/* Integer */\n#define RAD_CONNECT_INFO\t\t77\t/* String */\n#define RAD_EAP_MESSAGE\t\t\t79\t/* Octets */\n#define RAD_MESSAGE_AUTHENTIC\t\t80\t/* Octets */\n#define RAD_ACCT_INTERIM_INTERVAL\t85\t/* Integer */\n#define RAD_NAS_IPV6_ADDRESS\t\t95\t/* IPv6 address */\n#define RAD_FRAMED_INTERFACE_ID\t\t96\t/* 8 octets */\n#define RAD_FRAMED_IPV6_PREFIX\t\t97\t/* Octets */\n#define RAD_LOGIN_IPV6_HOST\t\t98\t/* IPv6 address */\n#define RAD_FRAMED_IPV6_ROUTE\t\t99\t/* String */\n#define RAD_FRAMED_IPV6_POOL\t\t100\t/* String */\n\n/* Accounting attribute types and values */\n#define RAD_ACCT_STATUS_TYPE\t\t40\t/* Integer */\n\t#define RAD_START\t\t\t1\n\t#define RAD_STOP\t\t\t2\n\t#define RAD_UPDATE\t\t\t3\n\t#define RAD_ACCOUNTING_ON\t\t7\n\t#define RAD_ACCOUNTING_OFF\t\t8\n#define RAD_ACCT_DELAY_TIME\t\t41\t/* Integer */\n#define RAD_ACCT_INPUT_OCTETS\t\t42\t/* Integer */\n#define RAD_ACCT_OUTPUT_OCTETS\t\t43\t/* Integer */\n#define RAD_ACCT_SESSION_ID\t\t44\t/* String */\n#define RAD_ACCT_AUTHENTIC\t\t45\t/* Integer */\n\t#define RAD_AUTH_RADIUS\t\t\t1\n\t#define RAD_AUTH_LOCAL\t\t\t2\n\t#define RAD_AUTH_REMOTE\t\t\t3\n#define RAD_ACCT_SESSION_TIME\t\t46\t/* Integer */\n#define RAD_ACCT_INPUT_PACKETS\t\t47\t/* Integer */\n#define RAD_ACCT_OUTPUT_PACKETS\t\t48\t/* Integer */\n#define RAD_ACCT_TERMINATE_CAUSE\t49\t/* Integer */\n        #define RAD_TERM_USER_REQUEST\t\t1\n        #define RAD_TERM_LOST_CARRIER\t\t2\n        #define RAD_TERM_LOST_SERVICE\t\t3\n        #define RAD_TERM_IDLE_TIMEOUT\t\t4\n        #define RAD_TERM_SESSION_TIMEOUT\t5\n        #define RAD_TERM_ADMIN_RESET\t\t6\n        #define RAD_TERM_ADMIN_REBOOT\t\t7\n        #define RAD_TERM_PORT_ERROR\t\t8\n        #define RAD_TERM_NAS_ERROR\t\t9\n        #define RAD_TERM_NAS_REQUEST\t\t10\n        #define RAD_TERM_NAS_REBOOT\t\t11\n        #define RAD_TERM_PORT_UNNEEDED\t\t12\n        #define RAD_TERM_PORT_PREEMPTED\t\t13\n        #define RAD_TERM_PORT_SUSPENDED\t\t14\n        #define RAD_TERM_SERVICE_UNAVAILABLE    15\n        #define RAD_TERM_CALLBACK\t\t16\n        #define RAD_TERM_USER_ERROR\t\t17\n        #define RAD_TERM_HOST_REQUEST\t\t18\n#define\tRAD_ACCT_MULTI_SESSION_ID\t50\t/* String */\n#define\tRAD_ACCT_LINK_COUNT\t\t51\t/* Integer */\n\n#define\tRAD_ERROR_CAUSE\t\t\t101\t/* Integer */\n\nstruct rad_handle;\nstruct timeval;\n\n__BEGIN_DECLS\nstruct rad_handle\t*rad_acct_open(void);\nint\t\t\t rad_add_server(struct rad_handle *,\n\t\t\t    const char *, int, const char *, int, int);\nstruct rad_handle\t*rad_auth_open(void);\nvoid\t\t\t rad_close(struct rad_handle *);\nint\t\t\t rad_config(struct rad_handle *, const char *);\nint\t\t\t rad_continue_send_request(struct rad_handle *, int,\n\t\t\t    int *, struct timeval *);\nint\t\t\t rad_create_request(struct rad_handle *, int);\nint\t\t\t rad_create_response(struct rad_handle *, int);\nstruct in_addr\t\t rad_cvt_addr(const void *);\nu_int32_t\t\t rad_cvt_int(const void *);\nchar\t\t\t*rad_cvt_string(const void *, size_t);\nint\t\t\t rad_get_attr(struct rad_handle *, const void **,\n\t\t\t    size_t *);\nint\t\t\t rad_init_send_request(struct rad_handle *, int *,\n\t\t\t    struct timeval *);\nstruct rad_handle\t*rad_open(void);  /* Deprecated, == rad_auth_open */\nint\t\t\t rad_put_addr(struct rad_handle *, int, struct in_addr);\nint\t\t\t rad_put_attr(struct rad_handle *, int,\n\t\t\t    const void *, size_t);\nint\t\t\t rad_put_int(struct rad_handle *, int, u_int32_t);\nint\t\t\t rad_put_string(struct rad_handle *, int,\n\t\t\t    const char *);\nint\t\t\t rad_put_message_authentic(struct rad_handle *);\nssize_t\t\t\t rad_request_authenticator(struct rad_handle *, char *,\n\t\t\t    size_t);\nint\t\t\t rad_receive_request(struct rad_handle *);\nint\t\t\t rad_send_request(struct rad_handle *);\nint\t\t\t rad_send_response(struct rad_handle *);\nstruct rad_handle\t*rad_server_open(int fd);\nconst char\t\t*rad_server_secret(struct rad_handle *);\nconst char\t\t*rad_strerror(struct rad_handle *);\nu_char\t\t\t*rad_demangle(struct rad_handle *, const void *,\n\t\t\t    size_t);\n\n__END_DECLS\n\n#endif /* _RADLIB_H_ */\n"
  },
  {
    "path": "freebsd-headers/radlib_vs.h",
    "content": "/*-\n * Copyright (c) 2002 Brian Somers <brian@Awfulhak.org>\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/lib/libradius/radlib_vs.h 128684 2004-04-27 15:00:29Z ru $\n */\n\n#ifndef _RADLIB_VS_H_\n#define _RADLIB_VS_H_\n\n#include <sys/types.h>\n#include <netinet/in.h>\n\n#define\tRAD_VENDOR_MICROSOFT\t311\t\t/* rfc2548 */\n\t#define\tRAD_MICROSOFT_MS_CHAP_RESPONSE\t\t\t1\n\t#define\tRAD_MICROSOFT_MS_CHAP_ERROR\t\t\t2\n\t#define\tRAD_MICROSOFT_MS_CHAP_PW_1\t\t\t3\n\t#define\tRAD_MICROSOFT_MS_CHAP_PW_2\t\t\t4\n\t#define\tRAD_MICROSOFT_MS_CHAP_LM_ENC_PW\t\t\t5\n\t#define\tRAD_MICROSOFT_MS_CHAP_NT_ENC_PW\t\t\t6\n\t#define\tRAD_MICROSOFT_MS_MPPE_ENCRYPTION_POLICY\t\t7\n\t#define\tRAD_MICROSOFT_MS_MPPE_ENCRYPTION_TYPES\t\t8\n\t#define\tRAD_MICROSOFT_MS_RAS_VENDOR\t\t\t9\n\t#define\tRAD_MICROSOFT_MS_CHAP_DOMAIN\t\t\t10\n\t#define\tRAD_MICROSOFT_MS_CHAP_CHALLENGE\t\t\t11\n\t#define\tRAD_MICROSOFT_MS_CHAP_MPPE_KEYS\t\t\t12\n\t#define\tRAD_MICROSOFT_MS_BAP_USAGE\t\t\t13\n\t#define\tRAD_MICROSOFT_MS_LINK_UTILIZATION_THRESHOLD\t14\n\t#define\tRAD_MICROSOFT_MS_LINK_DROP_TIME_LIMIT\t\t15\n\t#define\tRAD_MICROSOFT_MS_MPPE_SEND_KEY\t\t\t16\n\t#define\tRAD_MICROSOFT_MS_MPPE_RECV_KEY\t\t\t17\n\t#define\tRAD_MICROSOFT_MS_RAS_VERSION\t\t\t18\n\t#define\tRAD_MICROSOFT_MS_OLD_ARAP_PASSWORD\t\t19\n\t#define\tRAD_MICROSOFT_MS_NEW_ARAP_PASSWORD\t\t20\n\t#define\tRAD_MICROSOFT_MS_ARAP_PASSWORD_CHANGE_REASON\t21\n\t#define\tRAD_MICROSOFT_MS_FILTER\t\t\t\t22\n\t#define\tRAD_MICROSOFT_MS_ACCT_AUTH_TYPE\t\t\t23\n\t#define\tRAD_MICROSOFT_MS_ACCT_EAP_TYPE\t\t\t24\n\t#define\tRAD_MICROSOFT_MS_CHAP2_RESPONSE\t\t\t25\n\t#define\tRAD_MICROSOFT_MS_CHAP2_SUCCESS\t\t\t26\n\t#define\tRAD_MICROSOFT_MS_CHAP2_PW\t\t\t27\n\t#define\tRAD_MICROSOFT_MS_PRIMARY_DNS_SERVER\t\t28\n\t#define\tRAD_MICROSOFT_MS_SECONDARY_DNS_SERVER\t\t29\n\t#define\tRAD_MICROSOFT_MS_PRIMARY_NBNS_SERVER\t\t30\n\t#define\tRAD_MICROSOFT_MS_SECONDARY_NBNS_SERVER\t\t31\n\t#define\tRAD_MICROSOFT_MS_ARAP_CHALLENGE\t\t\t33\n\n#define SALT_LEN    2\n\nstruct rad_handle;\n\n__BEGIN_DECLS\nint\t rad_get_vendor_attr(u_int32_t *, const void **, size_t *);\nint\t rad_put_vendor_addr(struct rad_handle *, int, int, struct in_addr);\nint\t rad_put_vendor_attr(struct rad_handle *, int, int, const void *,\n\t    size_t);\nint\t rad_put_vendor_int(struct rad_handle *, int, int, u_int32_t);\nint\t rad_put_vendor_string(struct rad_handle *, int, int, const char *);\nu_char\t*rad_demangle_mppe_key(struct rad_handle *, const void *, size_t,\n\t    size_t *);\n__END_DECLS\n\n#endif /* _RADLIB_VS_H_ */\n"
  },
  {
    "path": "freebsd-headers/ranlib.h",
    "content": "/*-\n * Copyright (c) 1990, 1993\n *\tThe Regents of the University of California.  All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t@(#)ranlib.h\t8.1 (Berkeley) 6/2/93\n *\n * $FreeBSD: release/9.0.0/include/ranlib.h 203964 2010-02-16 19:39:50Z imp $\n */\n\n#ifndef _RANLIB_H_\n#define\t_RANLIB_H_\n\n#define\tRANLIBMAG\t\"__.SYMDEF\"\t/* archive file name */\n#define\tRANLIBSKEW\t3\t\t/* creation time offset */\n\nstruct ranlib {\n\tunion {\n\t\tlong ran_strx;\t\t/* string table index */\n\t\tchar *ran_name;\t\t/* in memory symbol name */\n\t} ran_un;\n\tlong ran_off;\t\t\t/* archive file offset */\n};\n\n#endif /* !_RANLIB_H_ */\n"
  },
  {
    "path": "freebsd-headers/readline/chardefs.h",
    "content": "/* chardefs.h -- Character definitions for readline. */\n\n/* Copyright (C) 1994 Free Software Foundation, Inc.\n\n   This file is part of the GNU Readline Library, a library for\n   reading lines of text with interactive input and history editing.\n\n   The GNU Readline Library is free software; you can redistribute it\n   and/or modify it under the terms of the GNU General Public License\n   as published by the Free Software Foundation; either version 2, or\n   (at your option) any later version.\n\n   The GNU Readline Library is distributed in the hope that it will be\n   useful, but WITHOUT ANY WARRANTY; without even the implied warranty\n   of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n   GNU General Public License for more details.\n\n   The GNU General Public License is often shipped with GNU software, and\n   is generally kept in a file called COPYING or LICENSE.  If you do not\n   have a copy of the license, write to the Free Software Foundation,\n   59 Temple Place, Suite 330, Boston, MA 02111 USA. */\n\n#ifndef _CHARDEFS_H_\n#define _CHARDEFS_H_\n\n#include <ctype.h>\n\n#if defined (HAVE_CONFIG_H)\n#  if defined (HAVE_STRING_H)\n#    if ! defined (STDC_HEADERS) && defined (HAVE_MEMORY_H)\n#      include <memory.h>\n#    endif\n#    include <string.h>\n#  endif /* HAVE_STRING_H */\n#  if defined (HAVE_STRINGS_H)\n#    include <strings.h>\n#  endif /* HAVE_STRINGS_H */\n#else\n#  include <string.h>\n#endif /* !HAVE_CONFIG_H */\n\n#ifndef whitespace\n#define whitespace(c) (((c) == ' ') || ((c) == '\\t'))\n#endif\n\n#ifdef CTRL\n#  undef CTRL\n#endif\n#ifdef UNCTRL\n#  undef UNCTRL\n#endif\n\n/* Some character stuff. */\n#define control_character_threshold 0x020   /* Smaller than this is control. */\n#define control_character_mask 0x1f\t    /* 0x20 - 1 */\n#define meta_character_threshold 0x07f\t    /* Larger than this is Meta. */\n#define control_character_bit 0x40\t    /* 0x000000, must be off. */\n#define meta_character_bit 0x080\t    /* x0000000, must be on. */\n#define largest_char 255\t\t    /* Largest character value. */\n\n#define CTRL_CHAR(c) ((c) < control_character_threshold && (((c) & 0x80) == 0))\n#define META_CHAR(c) ((c) > meta_character_threshold && (c) <= largest_char)\n\n#define CTRL(c) ((c) & control_character_mask)\n#define META(c) ((c) | meta_character_bit)\n\n#define UNMETA(c) ((c) & (~meta_character_bit))\n#define UNCTRL(c) _rl_to_upper(((c)|control_character_bit))\n\n#if defined STDC_HEADERS || (!defined (isascii) && !defined (HAVE_ISASCII))\n#  define IN_CTYPE_DOMAIN(c) 1\n#else\n#  define IN_CTYPE_DOMAIN(c) isascii(c)\n#endif\n\n#if !defined (isxdigit) && !defined (HAVE_ISXDIGIT)\n#  define isxdigit(c)   (isdigit((c)) || ((c) >= 'a' && (c) <= 'f') || ((c) >= 'A' && (c) <= 'F'))\n#endif\n\n#if defined (CTYPE_NON_ASCII)\n#  define NON_NEGATIVE(c) 1\n#else\n#  define NON_NEGATIVE(c) ((unsigned char)(c) == (c))\n#endif\n\n/* Some systems define these; we want our definitions. */\n#undef ISPRINT\n\n/* Beware:  these only work with single-byte ASCII characters. */\n\n#define ISALNUM(c)\t(IN_CTYPE_DOMAIN (c) && isalnum (c))\n#define ISALPHA(c)\t(IN_CTYPE_DOMAIN (c) && isalpha (c))\n#define ISDIGIT(c)\t(IN_CTYPE_DOMAIN (c) && isdigit (c))\n#define ISLOWER(c)\t(IN_CTYPE_DOMAIN (c) && islower (c))\n#define ISPRINT(c)\t(IN_CTYPE_DOMAIN (c) && isprint (c))\n#define ISUPPER(c)\t(IN_CTYPE_DOMAIN (c) && isupper (c))\n#define ISXDIGIT(c)\t(IN_CTYPE_DOMAIN (c) && isxdigit (c))\n\n#define _rl_lowercase_p(c)\t(NON_NEGATIVE(c) && ISLOWER(c))\n#define _rl_uppercase_p(c)\t(NON_NEGATIVE(c) && ISUPPER(c))\n#define _rl_digit_p(c)\t\t((c) >= '0' && (c) <= '9')\n\n#define _rl_pure_alphabetic(c)\t(NON_NEGATIVE(c) && ISALPHA(c))\n#define ALPHABETIC(c)\t\t(NON_NEGATIVE(c) && ISALNUM(c))\n\n#ifndef _rl_to_upper\n#  define _rl_to_upper(c) (_rl_lowercase_p(c) ? toupper((unsigned char)c) : (c))\n#  define _rl_to_lower(c) (_rl_uppercase_p(c) ? tolower((unsigned char)c) : (c))\n#endif\n\n#ifndef _rl_digit_value\n#  define _rl_digit_value(x) ((x) - '0')\n#endif\n\n#ifndef _rl_isident\n#  define _rl_isident(c) (ISALNUM(c) || (c) == '_')\n#endif\n\n#ifndef ISOCTAL\n#  define ISOCTAL(c)\t((c) >= '0' && (c) <= '7')\n#endif\n#define OCTVALUE(c)\t((c) - '0')\n\n#define HEXVALUE(c) \\\n  (((c) >= 'a' && (c) <= 'f') \\\n  \t? (c)-'a'+10 \\\n  \t: (c) >= 'A' && (c) <= 'F' ? (c)-'A'+10 : (c)-'0')\n\n#ifndef NEWLINE\n#define NEWLINE '\\n'\n#endif\n\n#ifndef RETURN\n#define RETURN CTRL('M')\n#endif\n\n#ifndef RUBOUT\n#define RUBOUT 0x7f\n#endif\n\n#ifndef TAB\n#define TAB '\\t'\n#endif\n\n#ifdef ABORT_CHAR\n#undef ABORT_CHAR\n#endif\n#define ABORT_CHAR CTRL('G')\n\n#ifdef PAGE\n#undef PAGE\n#endif\n#define PAGE CTRL('L')\n\n#ifdef SPACE\n#undef SPACE\n#endif\n#define SPACE ' '\t/* XXX - was 0x20 */\n\n#ifdef ESC\n#undef ESC\n#endif\n#define ESC CTRL('[')\n\n#endif  /* _CHARDEFS_H_ */\n"
  },
  {
    "path": "freebsd-headers/readline/history.h",
    "content": "/* history.h -- the names of functions that you can call in history. */\n/* Copyright (C) 1989-2003 Free Software Foundation, Inc.\n\n   This file contains the GNU History Library (the Library), a set of\n   routines for managing the text of previously typed lines.\n\n   The Library is free software; you can redistribute it and/or modify\n   it under the terms of the GNU General Public License as published by\n   the Free Software Foundation; either version 2, or (at your option)\n   any later version.\n\n   The Library is distributed in the hope that it will be useful, but\n   WITHOUT ANY WARRANTY; without even the implied warranty of\n   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n   General Public License for more details.\n\n   The GNU General Public License is often shipped with GNU software, and\n   is generally kept in a file called COPYING or LICENSE.  If you do not\n   have a copy of the license, write to the Free Software Foundation,\n   59 Temple Place, Suite 330, Boston, MA 02111 USA. */\n\n#ifndef _HISTORY_H_\n#define _HISTORY_H_\n\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\n#include <time.h>\t\t/* XXX - for history timestamp code */\n\n#if defined READLINE_LIBRARY\n#  include \"rlstdc.h\"\n#  include \"rltypedefs.h\"\n#else\n#  include <readline/rlstdc.h>\n#  include <readline/rltypedefs.h>\n#endif\n\n#ifdef __STDC__\ntypedef void *histdata_t;\n#else\ntypedef char *histdata_t;\n#endif\n\n/* The structure used to store a history entry. */\ntypedef struct _hist_entry {\n  char *line;\n  char *timestamp;\t\t/* char * rather than time_t for read/write */\n  histdata_t data;\n} HIST_ENTRY;\n\n/* Size of the history-library-managed space in history entry HS. */\n#define HISTENT_BYTES(hs)\t(strlen ((hs)->line) + strlen ((hs)->timestamp))\n\n/* A structure used to pass the current state of the history stuff around. */\ntypedef struct _hist_state {\n  HIST_ENTRY **entries;\t\t/* Pointer to the entries themselves. */\n  int offset;\t\t\t/* The location pointer within this array. */\n  int length;\t\t\t/* Number of elements within this array. */\n  int size;\t\t\t/* Number of slots allocated to this array. */\n  int flags;\n} HISTORY_STATE;\n\n/* Flag values for the `flags' member of HISTORY_STATE. */\n#define HS_STIFLED\t0x01\n\n/* Initialization and state management. */\n\n/* Begin a session in which the history functions might be used.  This\n   just initializes the interactive variables. */\nextern void using_history PARAMS((void));\n\n/* Return the current HISTORY_STATE of the history. */\nextern HISTORY_STATE *history_get_history_state PARAMS((void));\n\n/* Set the state of the current history array to STATE. */\nextern void history_set_history_state PARAMS((HISTORY_STATE *));\n\n/* Manage the history list. */\n\n/* Place STRING at the end of the history list.\n   The associated data field (if any) is set to NULL. */\nextern void add_history PARAMS((const char *));\n\n/* Change the timestamp associated with the most recent history entry to\n   STRING. */\nextern void add_history_time PARAMS((const char *));\n\n/* A reasonably useless function, only here for completeness.  WHICH\n   is the magic number that tells us which element to delete.  The\n   elements are numbered from 0. */\nextern HIST_ENTRY *remove_history PARAMS((int));\n\n/* Free the history entry H and return any application-specific data\n   associated with it. */\nextern histdata_t free_history_entry PARAMS((HIST_ENTRY *));\n\n/* Make the history entry at WHICH have LINE and DATA.  This returns\n   the old entry so you can dispose of the data.  In the case of an\n   invalid WHICH, a NULL pointer is returned. */\nextern HIST_ENTRY *replace_history_entry PARAMS((int, const char *, histdata_t));\n\n/* Clear the history list and start over. */\nextern void clear_history PARAMS((void));\n\n/* Stifle the history list, remembering only MAX number of entries. */\nextern void stifle_history PARAMS((int));\n\n/* Stop stifling the history.  This returns the previous amount the\n   history was stifled by.  The value is positive if the history was\n   stifled, negative if it wasn't. */\nextern int unstifle_history PARAMS((void));\n\n/* Return 1 if the history is stifled, 0 if it is not. */\nextern int history_is_stifled PARAMS((void));\n\n/* Information about the history list. */\n\n/* Return a NULL terminated array of HIST_ENTRY which is the current input\n   history.  Element 0 of this list is the beginning of time.  If there\n   is no history, return NULL. */\nextern HIST_ENTRY **history_list PARAMS((void));\n\n/* Returns the number which says what history element we are now\n   looking at.  */\nextern int where_history PARAMS((void));\n  \n/* Return the history entry at the current position, as determined by\n   history_offset.  If there is no entry there, return a NULL pointer. */\nextern HIST_ENTRY *current_history PARAMS((void));\n\n/* Return the history entry which is logically at OFFSET in the history\n   array.  OFFSET is relative to history_base. */\nextern HIST_ENTRY *history_get PARAMS((int));\n\n/* Return the timestamp associated with the HIST_ENTRY * passed as an\n   argument */\nextern time_t history_get_time PARAMS((HIST_ENTRY *));\n\n/* Return the number of bytes that the primary history entries are using.\n   This just adds up the lengths of the_history->lines. */\nextern int history_total_bytes PARAMS((void));\n\n/* Moving around the history list. */\n\n/* Set the position in the history list to POS. */\nextern int history_set_pos PARAMS((int));\n\n/* Back up history_offset to the previous history entry, and return\n   a pointer to that entry.  If there is no previous entry, return\n   a NULL pointer. */\nextern HIST_ENTRY *previous_history PARAMS((void));\n\n/* Move history_offset forward to the next item in the input_history,\n   and return the a pointer to that entry.  If there is no next entry,\n   return a NULL pointer. */\nextern HIST_ENTRY *next_history PARAMS((void));\n\n/* Searching the history list. */\n\n/* Search the history for STRING, starting at history_offset.\n   If DIRECTION < 0, then the search is through previous entries,\n   else through subsequent.  If the string is found, then\n   current_history () is the history entry, and the value of this function\n   is the offset in the line of that history entry that the string was\n   found in.  Otherwise, nothing is changed, and a -1 is returned. */\nextern int history_search PARAMS((const char *, int));\n\n/* Search the history for STRING, starting at history_offset.\n   The search is anchored: matching lines must begin with string.\n   DIRECTION is as in history_search(). */\nextern int history_search_prefix PARAMS((const char *, int));\n\n/* Search for STRING in the history list, starting at POS, an\n   absolute index into the list.  DIR, if negative, says to search\n   backwards from POS, else forwards.\n   Returns the absolute index of the history element where STRING\n   was found, or -1 otherwise. */\nextern int history_search_pos PARAMS((const char *, int, int));\n\n/* Managing the history file. */\n\n/* Add the contents of FILENAME to the history list, a line at a time.\n   If FILENAME is NULL, then read from ~/.history.  Returns 0 if\n   successful, or errno if not. */\nextern int read_history PARAMS((const char *));\n\n/* Read a range of lines from FILENAME, adding them to the history list.\n   Start reading at the FROM'th line and end at the TO'th.  If FROM\n   is zero, start at the beginning.  If TO is less than FROM, read\n   until the end of the file.  If FILENAME is NULL, then read from\n   ~/.history.  Returns 0 if successful, or errno if not. */\nextern int read_history_range PARAMS((const char *, int, int));\n\n/* Write the current history to FILENAME.  If FILENAME is NULL,\n   then write the history list to ~/.history.  Values returned\n   are as in read_history ().  */\nextern int write_history PARAMS((const char *));\n\n/* Append NELEMENT entries to FILENAME.  The entries appended are from\n   the end of the list minus NELEMENTs up to the end of the list. */\nextern int append_history PARAMS((int, const char *));\n\n/* Truncate the history file, leaving only the last NLINES lines. */\nextern int history_truncate_file PARAMS((const char *, int));\n\n/* History expansion. */\n\n/* Expand the string STRING, placing the result into OUTPUT, a pointer\n   to a string.  Returns:\n\n   0) If no expansions took place (or, if the only change in\n      the text was the de-slashifying of the history expansion\n      character)\n   1) If expansions did take place\n  -1) If there was an error in expansion.\n   2) If the returned line should just be printed.\n\n  If an error ocurred in expansion, then OUTPUT contains a descriptive\n  error message. */\nextern int history_expand PARAMS((char *, char **));\n\n/* Extract a string segment consisting of the FIRST through LAST\n   arguments present in STRING.  Arguments are broken up as in\n   the shell. */\nextern char *history_arg_extract PARAMS((int, int, const char *));\n\n/* Return the text of the history event beginning at the current\n   offset into STRING.  Pass STRING with *INDEX equal to the\n   history_expansion_char that begins this specification.\n   DELIMITING_QUOTE is a character that is allowed to end the string\n   specification for what to search for in addition to the normal\n   characters `:', ` ', `\\t', `\\n', and sometimes `?'. */\nextern char *get_history_event PARAMS((const char *, int *, int));\n\n/* Return an array of tokens, much as the shell might.  The tokens are\n   parsed out of STRING. */\nextern char **history_tokenize PARAMS((const char *));\n\n/* Exported history variables. */\nextern int history_base;\nextern int history_length;\nextern int history_max_entries;\nextern char history_expansion_char;\nextern char history_subst_char;\nextern char *history_word_delimiters;\nextern char history_comment_char;\nextern char *history_no_expand_chars;\nextern char *history_search_delimiter_chars;\nextern int history_quotes_inhibit_expansion;\n\nextern int history_write_timestamps;\n\n/* Backwards compatibility */\nextern int max_input_history;\n\n/* If set, this function is called to decide whether or not a particular\n   history expansion should be treated as a special case for the calling\n   application and not expanded. */\nextern rl_linebuf_func_t *history_inhibit_expansion_function;\n\n#ifdef __cplusplus\n}\n#endif\n\n#endif /* !_HISTORY_H_ */\n"
  },
  {
    "path": "freebsd-headers/readline/keymaps.h",
    "content": "/* keymaps.h -- Manipulation of readline keymaps. */\n\n/* Copyright (C) 1987, 1989, 1992 Free Software Foundation, Inc.\n\n   This file is part of the GNU Readline Library, a library for\n   reading lines of text with interactive input and history editing.\n\n   The GNU Readline Library is free software; you can redistribute it\n   and/or modify it under the terms of the GNU General Public License\n   as published by the Free Software Foundation; either version 2, or\n   (at your option) any later version.\n\n   The GNU Readline Library is distributed in the hope that it will be\n   useful, but WITHOUT ANY WARRANTY; without even the implied warranty\n   of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n   GNU General Public License for more details.\n\n   The GNU General Public License is often shipped with GNU software, and\n   is generally kept in a file called COPYING or LICENSE.  If you do not\n   have a copy of the license, write to the Free Software Foundation,\n   59 Temple Place, Suite 330, Boston, MA 02111 USA. */\n\n#ifndef _KEYMAPS_H_\n#define _KEYMAPS_H_\n\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\n#if defined (READLINE_LIBRARY)\n#  include \"rlstdc.h\"\n#  include \"chardefs.h\"\n#  include \"rltypedefs.h\"\n#else\n#  include <readline/rlstdc.h>\n#  include <readline/chardefs.h>\n#  include <readline/rltypedefs.h>\n#endif\n\n/* A keymap contains one entry for each key in the ASCII set.\n   Each entry consists of a type and a pointer.\n   FUNCTION is the address of a function to run, or the\n   address of a keymap to indirect through.\n   TYPE says which kind of thing FUNCTION is. */\ntypedef struct _keymap_entry {\n  char type;\n  rl_command_func_t *function;\n} KEYMAP_ENTRY;\n\n/* This must be large enough to hold bindings for all of the characters\n   in a desired character set (e.g, 128 for ASCII, 256 for ISO Latin-x,\n   and so on) plus one for subsequence matching. */\n#define KEYMAP_SIZE 257\n#define ANYOTHERKEY KEYMAP_SIZE-1\n\n/* I wanted to make the above structure contain a union of:\n   union { rl_command_func_t *function; struct _keymap_entry *keymap; } value;\n   but this made it impossible for me to create a static array.\n   Maybe I need C lessons. */\n\ntypedef KEYMAP_ENTRY KEYMAP_ENTRY_ARRAY[KEYMAP_SIZE];\ntypedef KEYMAP_ENTRY *Keymap;\n\n/* The values that TYPE can have in a keymap entry. */\n#define ISFUNC 0\n#define ISKMAP 1\n#define ISMACR 2\n\nextern KEYMAP_ENTRY_ARRAY emacs_standard_keymap, emacs_meta_keymap, emacs_ctlx_keymap;\nextern KEYMAP_ENTRY_ARRAY vi_insertion_keymap, vi_movement_keymap;\n\n/* Return a new, empty keymap.\n   Free it with free() when you are done. */\nextern Keymap rl_make_bare_keymap PARAMS((void));\n\n/* Return a new keymap which is a copy of MAP. */\nextern Keymap rl_copy_keymap PARAMS((Keymap));\n\n/* Return a new keymap with the printing characters bound to rl_insert,\n   the lowercase Meta characters bound to run their equivalents, and\n   the Meta digits bound to produce numeric arguments. */\nextern Keymap rl_make_keymap PARAMS((void));\n\n/* Free the storage associated with a keymap. */\nextern void rl_discard_keymap PARAMS((Keymap));\n\n/* These functions actually appear in bind.c */\n\n/* Return the keymap corresponding to a given name.  Names look like\n   `emacs' or `emacs-meta' or `vi-insert'.  */\nextern Keymap rl_get_keymap_by_name PARAMS((const char *));\n\n/* Return the current keymap. */\nextern Keymap rl_get_keymap PARAMS((void));\n\n/* Set the current keymap to MAP. */\nextern void rl_set_keymap PARAMS((Keymap));\n\n#ifdef __cplusplus\n}\n#endif\n\n#endif /* _KEYMAPS_H_ */\n"
  },
  {
    "path": "freebsd-headers/readline/readline.h",
    "content": "/* $FreeBSD: release/9.0.0/contrib/libreadline/readline.h 165675 2006-12-31 09:22:31Z ache $ */\n/* Readline.h -- the names of functions callable from within readline. */\n\n/* Copyright (C) 1987-2005 Free Software Foundation, Inc.\n\n   This file is part of the GNU Readline Library, a library for\n   reading lines of text with interactive input and history editing.\n\n   The GNU Readline Library is free software; you can redistribute it\n   and/or modify it under the terms of the GNU General Public License\n   as published by the Free Software Foundation; either version 2, or\n   (at your option) any later version.\n\n   The GNU Readline Library is distributed in the hope that it will be\n   useful, but WITHOUT ANY WARRANTY; without even the implied warranty\n   of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n   GNU General Public License for more details.\n\n   The GNU General Public License is often shipped with GNU software, and\n   is generally kept in a file called COPYING or LICENSE.  If you do not\n   have a copy of the license, write to the Free Software Foundation,\n   59 Temple Place, Suite 330, Boston, MA 02111 USA. */\n\n#if !defined (_READLINE_H_)\n#define _READLINE_H_\n\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\n#if defined (READLINE_LIBRARY)\n#  include \"rlstdc.h\"\n#  include \"rltypedefs.h\"\n#  include \"keymaps.h\"\n#  include \"tilde.h\"\n#else\n#  include <readline/rlstdc.h>\n#  include <readline/rltypedefs.h>\n#  include <readline/keymaps.h>\n#  include <readline/tilde.h>\n#endif\n\n/* Hex-encoded Readline version number. */\n#define RL_READLINE_VERSION\t0x0502\t\t/* Readline 5.2 */\n#define RL_VERSION_MAJOR\t5\n#define RL_VERSION_MINOR\t2\n\n/* Readline data structures. */\n\n/* Maintaining the state of undo.  We remember individual deletes and inserts\n   on a chain of things to do. */\n\n/* The actions that undo knows how to undo.  Notice that UNDO_DELETE means\n   to insert some text, and UNDO_INSERT means to delete some text.   I.e.,\n   the code tells undo what to undo, not how to undo it. */\nenum undo_code { UNDO_DELETE, UNDO_INSERT, UNDO_BEGIN, UNDO_END };\n\n/* What an element of THE_UNDO_LIST looks like. */\ntypedef struct undo_list {\n  struct undo_list *next;\n  int start, end;\t\t/* Where the change took place. */\n  char *text;\t\t\t/* The text to insert, if undoing a delete. */\n  enum undo_code what;\t\t/* Delete, Insert, Begin, End. */\n} UNDO_LIST;\n\n/* The current undo list for RL_LINE_BUFFER. */\nextern UNDO_LIST *rl_undo_list;\n\n/* The data structure for mapping textual names to code addresses. */\ntypedef struct _funmap {\n  const char *name;\n  rl_command_func_t *function;\n} FUNMAP;\n\nextern FUNMAP **funmap;\n\n/* **************************************************************** */\n/*\t\t\t\t\t\t\t\t    */\n/*\t     Functions available to bind to key sequences\t    */\n/*\t\t\t\t\t\t\t\t    */\n/* **************************************************************** */\n\n/* Bindable commands for numeric arguments. */\nextern int rl_digit_argument PARAMS((int, int));\nextern int rl_universal_argument PARAMS((int, int));\n\n/* Bindable commands for moving the cursor. */\nextern int rl_forward_byte PARAMS((int, int));\nextern int rl_forward_char PARAMS((int, int));\nextern int rl_forward PARAMS((int, int));\nextern int rl_backward_byte PARAMS((int, int));\nextern int rl_backward_char PARAMS((int, int));\nextern int rl_backward PARAMS((int, int));\nextern int rl_beg_of_line PARAMS((int, int));\nextern int rl_end_of_line PARAMS((int, int));\nextern int rl_forward_word PARAMS((int, int));\nextern int rl_backward_word PARAMS((int, int));\nextern int rl_refresh_line PARAMS((int, int));\nextern int rl_clear_screen PARAMS((int, int));\nextern int rl_arrow_keys PARAMS((int, int));\n\n/* Bindable commands for inserting and deleting text. */\nextern int rl_insert PARAMS((int, int));\nextern int rl_quoted_insert PARAMS((int, int));\nextern int rl_tab_insert PARAMS((int, int));\nextern int rl_newline PARAMS((int, int));\nextern int rl_do_lowercase_version PARAMS((int, int));\nextern int rl_rubout PARAMS((int, int));\nextern int rl_delete PARAMS((int, int));\nextern int rl_rubout_or_delete PARAMS((int, int));\nextern int rl_delete_horizontal_space PARAMS((int, int));\nextern int rl_delete_or_show_completions PARAMS((int, int));\nextern int rl_insert_comment PARAMS((int, int));\n\n/* Bindable commands for changing case. */\nextern int rl_upcase_word PARAMS((int, int));\nextern int rl_downcase_word PARAMS((int, int));\nextern int rl_capitalize_word PARAMS((int, int));\n\n/* Bindable commands for transposing characters and words. */\nextern int rl_transpose_words PARAMS((int, int));\nextern int rl_transpose_chars PARAMS((int, int));\n\n/* Bindable commands for searching within a line. */\nextern int rl_char_search PARAMS((int, int));\nextern int rl_backward_char_search PARAMS((int, int));\n\n/* Bindable commands for readline's interface to the command history. */\nextern int rl_beginning_of_history PARAMS((int, int));\nextern int rl_end_of_history PARAMS((int, int));\nextern int rl_get_next_history PARAMS((int, int));\nextern int rl_get_previous_history PARAMS((int, int));\n\n/* Bindable commands for managing the mark and region. */\nextern int rl_set_mark PARAMS((int, int));\nextern int rl_exchange_point_and_mark PARAMS((int, int));\n\n/* Bindable commands to set the editing mode (emacs or vi). */\nextern int rl_vi_editing_mode PARAMS((int, int));\nextern int rl_emacs_editing_mode PARAMS((int, int));\n\n/* Bindable commands to change the insert mode (insert or overwrite) */\nextern int rl_overwrite_mode PARAMS((int, int));\n\n/* Bindable commands for managing key bindings. */\nextern int rl_re_read_init_file PARAMS((int, int));\nextern int rl_dump_functions PARAMS((int, int));\nextern int rl_dump_macros PARAMS((int, int));\nextern int rl_dump_variables PARAMS((int, int));\n\n/* Bindable commands for word completion. */\nextern int rl_complete PARAMS((int, int));\nextern int rl_possible_completions PARAMS((int, int));\nextern int rl_insert_completions PARAMS((int, int));\nextern int rl_menu_complete PARAMS((int, int));\n\n/* Bindable commands for killing and yanking text, and managing the kill ring. */\nextern int rl_kill_word PARAMS((int, int));\nextern int rl_backward_kill_word PARAMS((int, int));\nextern int rl_kill_line PARAMS((int, int));\nextern int rl_backward_kill_line PARAMS((int, int));\nextern int rl_kill_full_line PARAMS((int, int));\nextern int rl_unix_word_rubout PARAMS((int, int));\nextern int rl_unix_filename_rubout PARAMS((int, int));\nextern int rl_unix_line_discard PARAMS((int, int));\nextern int rl_copy_region_to_kill PARAMS((int, int));\nextern int rl_kill_region PARAMS((int, int));\nextern int rl_copy_forward_word PARAMS((int, int));\nextern int rl_copy_backward_word PARAMS((int, int));\nextern int rl_yank PARAMS((int, int));\nextern int rl_yank_pop PARAMS((int, int));\nextern int rl_yank_nth_arg PARAMS((int, int));\nextern int rl_yank_last_arg PARAMS((int, int));\n/* Not available unless __CYGWIN__ is defined. */\n#ifdef __CYGWIN__\nextern int rl_paste_from_clipboard PARAMS((int, int));\n#endif\n\n/* Bindable commands for incremental searching. */\nextern int rl_reverse_search_history PARAMS((int, int));\nextern int rl_forward_search_history PARAMS((int, int));\n\n/* Bindable keyboard macro commands. */\nextern int rl_start_kbd_macro PARAMS((int, int));\nextern int rl_end_kbd_macro PARAMS((int, int));\nextern int rl_call_last_kbd_macro PARAMS((int, int));\n\n/* Bindable undo commands. */\nextern int rl_revert_line PARAMS((int, int));\nextern int rl_undo_command PARAMS((int, int));\n\n/* Bindable tilde expansion commands. */\nextern int rl_tilde_expand PARAMS((int, int));\n\n/* Bindable terminal control commands. */\nextern int rl_restart_output PARAMS((int, int));\nextern int rl_stop_output PARAMS((int, int));\n\n/* Miscellaneous bindable commands. */\nextern int rl_abort PARAMS((int, int));\nextern int rl_tty_status PARAMS((int, int));\n\n/* Bindable commands for incremental and non-incremental history searching. */\nextern int rl_history_search_forward PARAMS((int, int));\nextern int rl_history_search_backward PARAMS((int, int));\nextern int rl_noninc_forward_search PARAMS((int, int));\nextern int rl_noninc_reverse_search PARAMS((int, int));\nextern int rl_noninc_forward_search_again PARAMS((int, int));\nextern int rl_noninc_reverse_search_again PARAMS((int, int));\n\n/* Bindable command used when inserting a matching close character. */\nextern int rl_insert_close PARAMS((int, int));\n\n/* Not available unless READLINE_CALLBACKS is defined. */\nextern void rl_callback_handler_install PARAMS((const char *, rl_vcpfunc_t *));\nextern void rl_callback_read_char PARAMS((void));\nextern void rl_callback_handler_remove PARAMS((void));\n\n/* Things for vi mode. Not available unless readline is compiled -DVI_MODE. */\n/* VI-mode bindable commands. */\nextern int rl_vi_redo PARAMS((int, int));\nextern int rl_vi_undo PARAMS((int, int));\nextern int rl_vi_yank_arg PARAMS((int, int));\nextern int rl_vi_fetch_history PARAMS((int, int));\nextern int rl_vi_search_again PARAMS((int, int));\nextern int rl_vi_search PARAMS((int, int));\nextern int rl_vi_complete PARAMS((int, int));\nextern int rl_vi_tilde_expand PARAMS((int, int));\nextern int rl_vi_prev_word PARAMS((int, int));\nextern int rl_vi_next_word PARAMS((int, int));\nextern int rl_vi_end_word PARAMS((int, int));\nextern int rl_vi_insert_beg PARAMS((int, int));\nextern int rl_vi_append_mode PARAMS((int, int));\nextern int rl_vi_append_eol PARAMS((int, int));\nextern int rl_vi_eof_maybe PARAMS((int, int));\nextern int rl_vi_insertion_mode PARAMS((int, int));\nextern int rl_vi_movement_mode PARAMS((int, int));\nextern int rl_vi_arg_digit PARAMS((int, int));\nextern int rl_vi_change_case PARAMS((int, int));\nextern int rl_vi_put PARAMS((int, int));\nextern int rl_vi_column PARAMS((int, int));\nextern int rl_vi_delete_to PARAMS((int, int));\nextern int rl_vi_change_to PARAMS((int, int));\nextern int rl_vi_yank_to PARAMS((int, int));\nextern int rl_vi_rubout PARAMS((int, int));\nextern int rl_vi_delete PARAMS((int, int));\nextern int rl_vi_back_to_indent PARAMS((int, int));\nextern int rl_vi_first_print PARAMS((int, int));\nextern int rl_vi_char_search PARAMS((int, int));\nextern int rl_vi_match PARAMS((int, int));\nextern int rl_vi_change_char PARAMS((int, int));\nextern int rl_vi_subst PARAMS((int, int));\nextern int rl_vi_overstrike PARAMS((int, int));\nextern int rl_vi_overstrike_delete PARAMS((int, int));\nextern int rl_vi_replace PARAMS((int, int));\nextern int rl_vi_set_mark PARAMS((int, int));\nextern int rl_vi_goto_mark PARAMS((int, int));\n\n/* VI-mode utility functions. */\nextern int rl_vi_check PARAMS((void));\nextern int rl_vi_domove PARAMS((int, int *));\nextern int rl_vi_bracktype PARAMS((int));\n\nextern void rl_vi_start_inserting PARAMS((int, int, int));\n\n/* VI-mode pseudo-bindable commands, used as utility functions. */\nextern int rl_vi_fWord PARAMS((int, int));\nextern int rl_vi_bWord PARAMS((int, int));\nextern int rl_vi_eWord PARAMS((int, int));\nextern int rl_vi_fword PARAMS((int, int));\nextern int rl_vi_bword PARAMS((int, int));\nextern int rl_vi_eword PARAMS((int, int));\n\n/* **************************************************************** */\n/*\t\t\t\t\t\t\t\t    */\n/*\t\t\tWell Published Functions\t\t    */\n/*\t\t\t\t\t\t\t\t    */\n/* **************************************************************** */\n\n/* Readline functions. */\n/* Read a line of input.  Prompt with PROMPT.  A NULL PROMPT means none. */\nextern char *readline PARAMS((const char *));\n\nextern int rl_set_prompt PARAMS((const char *));\nextern int rl_expand_prompt PARAMS((char *));\n\nextern int rl_initialize PARAMS((void));\n\n/* Undocumented; unused by readline */\nextern int rl_discard_argument PARAMS((void));\n\n/* Utility functions to bind keys to readline commands. */\nextern int rl_add_defun PARAMS((const char *, rl_command_func_t *, int));\nextern int rl_bind_key PARAMS((int, rl_command_func_t *));\nextern int rl_bind_key_in_map PARAMS((int, rl_command_func_t *, Keymap));\nextern int rl_unbind_key PARAMS((int));\nextern int rl_unbind_key_in_map PARAMS((int, Keymap));\nextern int rl_bind_key_if_unbound PARAMS((int, rl_command_func_t *));\nextern int rl_bind_key_if_unbound_in_map PARAMS((int, rl_command_func_t *, Keymap));\nextern int rl_unbind_function_in_map PARAMS((rl_command_func_t *, Keymap));\nextern int rl_unbind_command_in_map PARAMS((const char *, Keymap));\nextern int rl_bind_keyseq PARAMS((const char *, rl_command_func_t *));\nextern int rl_bind_keyseq_in_map PARAMS((const char *, rl_command_func_t *, Keymap));\nextern int rl_bind_keyseq_if_unbound PARAMS((const char *, rl_command_func_t *));\nextern int rl_bind_keyseq_if_unbound_in_map PARAMS((const char *, rl_command_func_t *, Keymap));\nextern int rl_generic_bind PARAMS((int, const char *, char *, Keymap));\n\nextern char *rl_variable_value PARAMS((const char *));\nextern int rl_variable_bind PARAMS((const char *, const char *));\n\n/* Backwards compatibility, use rl_bind_keyseq_in_map instead. */\nextern int rl_set_key PARAMS((const char *, rl_command_func_t *, Keymap));\n\n/* Backwards compatibility, use rl_generic_bind instead. */\nextern int rl_macro_bind PARAMS((const char *, const char *, Keymap));\n\n/* Undocumented in the texinfo manual; not really useful to programs. */\nextern int rl_translate_keyseq PARAMS((const char *, char *, int *));\nextern char *rl_untranslate_keyseq PARAMS((int));\n\nextern rl_command_func_t *rl_named_function PARAMS((const char *));\nextern rl_command_func_t *rl_function_of_keyseq PARAMS((const char *, Keymap, int *));\n\nextern void rl_list_funmap_names PARAMS((void));\nextern char **rl_invoking_keyseqs_in_map PARAMS((rl_command_func_t *, Keymap));\nextern char **rl_invoking_keyseqs PARAMS((rl_command_func_t *));\n \nextern void rl_function_dumper PARAMS((int));\nextern void rl_macro_dumper PARAMS((int));\nextern void rl_variable_dumper PARAMS((int));\n\nextern int rl_read_init_file PARAMS((const char *));\nextern int rl_parse_and_bind PARAMS((char *));\n\n/* Functions for manipulating keymaps. */\nextern Keymap rl_make_bare_keymap PARAMS((void));\nextern Keymap rl_copy_keymap PARAMS((Keymap));\nextern Keymap rl_make_keymap PARAMS((void));\nextern void rl_discard_keymap PARAMS((Keymap));\n\nextern Keymap rl_get_keymap_by_name PARAMS((const char *));\nextern char *rl_get_keymap_name PARAMS((Keymap));\nextern void rl_set_keymap PARAMS((Keymap));\nextern Keymap rl_get_keymap PARAMS((void));\n/* Undocumented; used internally only. */\nextern void rl_set_keymap_from_edit_mode PARAMS((void));\nextern char *rl_get_keymap_name_from_edit_mode PARAMS((void));\n\n/* Functions for manipulating the funmap, which maps command names to functions. */\nextern int rl_add_funmap_entry PARAMS((const char *, rl_command_func_t *));\nextern const char **rl_funmap_names PARAMS((void));\n/* Undocumented, only used internally -- there is only one funmap, and this\n   function may be called only once. */\nextern void rl_initialize_funmap PARAMS((void));\n\n/* Utility functions for managing keyboard macros. */\nextern void rl_push_macro_input PARAMS((char *));\n\n/* Functions for undoing, from undo.c */\nextern void rl_add_undo PARAMS((enum undo_code, int, int, char *));\nextern void rl_free_undo_list PARAMS((void));\nextern int rl_do_undo PARAMS((void));\nextern int rl_begin_undo_group PARAMS((void));\nextern int rl_end_undo_group PARAMS((void));\nextern int rl_modifying PARAMS((int, int));\n\n/* Functions for redisplay. */\nextern void rl_redisplay PARAMS((void));\nextern int rl_on_new_line PARAMS((void));\nextern int rl_on_new_line_with_prompt PARAMS((void));\nextern int rl_forced_update_display PARAMS((void));\nextern int rl_clear_message PARAMS((void));\nextern int rl_reset_line_state PARAMS((void));\nextern int rl_crlf PARAMS((void));\n\n#if defined (USE_VARARGS) && defined (PREFER_STDARG)\nextern int rl_message (const char *, ...)  __attribute__((__format__ (printf, 1, 2)));\n#else\nextern int rl_message ();\n#endif\n\nextern int rl_show_char PARAMS((int));\n\n/* Undocumented in texinfo manual. */\nextern int rl_character_len PARAMS((int, int));\n\n/* Save and restore internal prompt redisplay information. */\nextern void rl_save_prompt PARAMS((void));\nextern void rl_restore_prompt PARAMS((void));\n\n/* Modifying text. */\nextern void rl_replace_line PARAMS((const char *, int));\nextern int rl_insert_text PARAMS((const char *));\nextern int rl_delete_text PARAMS((int, int));\nextern int rl_kill_text PARAMS((int, int));\nextern char *rl_copy_text PARAMS((int, int));\n\n/* Terminal and tty mode management. */\nextern void rl_prep_terminal PARAMS((int));\nextern void rl_deprep_terminal PARAMS((void));\nextern void rl_tty_set_default_bindings PARAMS((Keymap));\nextern void rl_tty_unset_default_bindings PARAMS((Keymap));\n\nextern int rl_reset_terminal PARAMS((const char *));\nextern void rl_resize_terminal PARAMS((void));\nextern void rl_set_screen_size PARAMS((int, int));\nextern void rl_get_screen_size PARAMS((int *, int *));\nextern void rl_reset_screen_size PARAMS((void));\n\nextern char *rl_get_termcap PARAMS((const char *));\n\n/* Functions for character input. */\nextern int rl_stuff_char PARAMS((int));\nextern int rl_execute_next PARAMS((int));\nextern int rl_clear_pending_input PARAMS((void));\nextern int rl_read_key PARAMS((void));\nextern int rl_getc PARAMS((FILE *));\nextern int rl_set_keyboard_input_timeout PARAMS((int));\n\n/* `Public' utility functions . */\nextern void rl_extend_line_buffer PARAMS((int));\nextern int rl_ding PARAMS((void));\nextern int rl_alphabetic PARAMS((int));\n\n/* Readline signal handling, from signals.c */\nextern int rl_set_signals PARAMS((void));\nextern int rl_clear_signals PARAMS((void));\nextern void rl_cleanup_after_signal PARAMS((void));\nextern void rl_reset_after_signal PARAMS((void));\nextern void rl_free_line_state PARAMS((void));\n \nextern int rl_set_paren_blink_timeout PARAMS((int));\n\n/* Undocumented. */\nextern int rl_maybe_save_line PARAMS((void));\nextern int rl_maybe_unsave_line PARAMS((void));\nextern int rl_maybe_replace_line PARAMS((void));\n\n/* Completion functions. */\nextern int rl_complete_internal PARAMS((int));\nextern void rl_display_match_list PARAMS((char **, int, int));\n\nextern char **rl_completion_matches PARAMS((const char *, rl_compentry_func_t *));\nextern char *rl_username_completion_function PARAMS((const char *, int));\nextern char *rl_filename_completion_function PARAMS((const char *, int));\n\nextern int rl_completion_mode PARAMS((rl_command_func_t *));\n\n#if !defined(RL_NO_COMPAT)\n/* Backwards compatibility (compat.c).  These will go away sometime. */\nextern void free_undo_list PARAMS((void));\nextern int maybe_save_line PARAMS((void));\nextern int maybe_unsave_line PARAMS((void));\nextern int maybe_replace_line PARAMS((void));\n\nextern int ding PARAMS((void));\nextern int alphabetic PARAMS((int));\nextern int crlf PARAMS((void));\n\nextern char **completion_matches PARAMS((char *, rl_compentry_func_t *));\nextern char *username_completion_function PARAMS((const char *, int));\nextern char *filename_completion_function PARAMS((const char *, int));\n#endif\n\n/* **************************************************************** */\n/*\t\t\t\t\t\t\t\t    */\n/*\t\t\tWell Published Variables\t\t    */\n/*\t\t\t\t\t\t\t\t    */\n/* **************************************************************** */\n\n/* The version of this incarnation of the readline library. */\nextern const char *rl_library_version;\t\t/* e.g., \"4.2\" */\nextern int rl_readline_version;\t\t\t/* e.g., 0x0402 */\n\n/* True if this is real GNU readline. */\nextern int rl_gnu_readline_p;\n\n/* Flags word encapsulating the current readline state. */\nextern int rl_readline_state;\n\n/* Says which editing mode readline is currently using.  1 means emacs mode;\n   0 means vi mode. */\nextern int rl_editing_mode;\n\n/* Insert or overwrite mode for emacs mode.  1 means insert mode; 0 means\n   overwrite mode.  Reset to insert mode on each input line. */\nextern int rl_insert_mode;\n\n/* The name of the calling program.  You should initialize this to\n   whatever was in argv[0].  It is used when parsing conditionals. */\nextern const char *rl_readline_name;\n\n/* The prompt readline uses.  This is set from the argument to\n   readline (), and should not be assigned to directly. */\nextern char *rl_prompt;\n\n/* The line buffer that is in use. */\nextern char *rl_line_buffer;\n\n/* The location of point, and end. */\nextern int rl_point;\nextern int rl_end;\n\n/* The mark, or saved cursor position. */\nextern int rl_mark;\n\n/* Flag to indicate that readline has finished with the current input\n   line and should return it. */\nextern int rl_done;\n\n/* If set to a character value, that will be the next keystroke read. */\nextern int rl_pending_input;\n\n/* Non-zero if we called this function from _rl_dispatch().  It's present\n   so functions can find out whether they were called from a key binding\n   or directly from an application. */\nextern int rl_dispatching;\n\n/* Non-zero if the user typed a numeric argument before executing the\n   current function. */\nextern int rl_explicit_arg;\n\n/* The current value of the numeric argument specified by the user. */\nextern int rl_numeric_arg;\n\n/* The address of the last command function Readline executed. */\nextern rl_command_func_t *rl_last_func;\n\n/* The name of the terminal to use. */\nextern const char *rl_terminal_name;\n\n/* The input and output streams. */\nextern FILE *rl_instream;\nextern FILE *rl_outstream;\n\n/* If non-zero, Readline gives values of LINES and COLUMNS from the environment\n   greater precedence than values fetched from the kernel when computing the\n   screen dimensions. */\nextern int rl_prefer_env_winsize;\n\n/* If non-zero, then this is the address of a function to call just\n   before readline_internal () prints the first prompt. */\nextern rl_hook_func_t *rl_startup_hook;\n\n/* If non-zero, this is the address of a function to call just before\n   readline_internal_setup () returns and readline_internal starts\n   reading input characters. */\nextern rl_hook_func_t *rl_pre_input_hook;\n      \n/* The address of a function to call periodically while Readline is\n   awaiting character input, or NULL, for no event handling. */\nextern rl_hook_func_t *rl_event_hook;\n\n/* The address of the function to call to fetch a character from the current\n   Readline input stream */\nextern rl_getc_func_t *rl_getc_function;\n\nextern rl_voidfunc_t *rl_redisplay_function;\n\nextern rl_vintfunc_t *rl_prep_term_function;\nextern rl_voidfunc_t *rl_deprep_term_function;\n\n/* Dispatch variables. */\nextern Keymap rl_executing_keymap;\nextern Keymap rl_binding_keymap;\n\n/* Display variables. */\n/* If non-zero, readline will erase the entire line, including any prompt,\n   if the only thing typed on an otherwise-blank line is something bound to\n   rl_newline. */\nextern int rl_erase_empty_line;\n\n/* If non-zero, the application has already printed the prompt (rl_prompt)\n   before calling readline, so readline should not output it the first time\n   redisplay is done. */\nextern int rl_already_prompted;\n\n/* A non-zero value means to read only this many characters rather than\n   up to a character bound to accept-line. */\nextern int rl_num_chars_to_read;\n\n/* The text of a currently-executing keyboard macro. */\nextern char *rl_executing_macro;\n\n/* Variables to control readline signal handling. */\n/* If non-zero, readline will install its own signal handlers for\n   SIGINT, SIGTERM, SIGQUIT, SIGALRM, SIGTSTP, SIGTTIN, and SIGTTOU. */\nextern int rl_catch_signals;\n\n/* If non-zero, readline will install a signal handler for SIGWINCH\n   that also attempts to call any calling application's SIGWINCH signal\n   handler.  Note that the terminal is not cleaned up before the\n   application's signal handler is called; use rl_cleanup_after_signal()\n   to do that. */\nextern int rl_catch_sigwinch;\n\n/* Completion variables. */\n/* Pointer to the generator function for completion_matches ().\n   NULL means to use rl_filename_completion_function (), the default\n   filename completer. */\nextern rl_compentry_func_t *rl_completion_entry_function;\n\n/* If rl_ignore_some_completions_function is non-NULL it is the address\n   of a function to call after all of the possible matches have been\n   generated, but before the actual completion is done to the input line.\n   The function is called with one argument; a NULL terminated array\n   of (char *).  If your function removes any of the elements, they\n   must be free()'ed. */\nextern rl_compignore_func_t *rl_ignore_some_completions_function;\n\n/* Pointer to alternative function to create matches.\n   Function is called with TEXT, START, and END.\n   START and END are indices in RL_LINE_BUFFER saying what the boundaries\n   of TEXT are.\n   If this function exists and returns NULL then call the value of\n   rl_completion_entry_function to try to match, otherwise use the\n   array of strings returned. */\nextern rl_completion_func_t *rl_attempted_completion_function;\n\n/* The basic list of characters that signal a break between words for the\n   completer routine.  The initial contents of this variable is what\n   breaks words in the shell, i.e. \"n\\\"\\\\'`@$>\". */\nextern const char *rl_basic_word_break_characters;\n\n/* The list of characters that signal a break between words for\n   rl_complete_internal.  The default list is the contents of\n   rl_basic_word_break_characters.  */\nextern /*const*/ char *rl_completer_word_break_characters;\n\n/* Hook function to allow an application to set the completion word\n   break characters before readline breaks up the line.  Allows\n   position-dependent word break characters. */\nextern rl_cpvfunc_t *rl_completion_word_break_hook;\n\n/* List of characters which can be used to quote a substring of the line.\n   Completion occurs on the entire substring, and within the substring   \n   rl_completer_word_break_characters are treated as any other character,\n   unless they also appear within this list. */\nextern const char *rl_completer_quote_characters;\n\n/* List of quote characters which cause a word break. */\nextern const char *rl_basic_quote_characters;\n\n/* List of characters that need to be quoted in filenames by the completer. */\nextern const char *rl_filename_quote_characters;\n\n/* List of characters that are word break characters, but should be left\n   in TEXT when it is passed to the completion function.  The shell uses\n   this to help determine what kind of completing to do. */\nextern const char *rl_special_prefixes;\n\n/* If non-zero, then this is the address of a function to call when\n   completing on a directory name.  The function is called with\n   the address of a string (the current directory name) as an arg.  It\n   changes what is displayed when the possible completions are printed\n   or inserted. */\nextern rl_icppfunc_t *rl_directory_completion_hook;\n\n/* If non-zero, this is the address of a function to call when completing\n   a directory name.  This function takes the address of the directory name\n   to be modified as an argument.  Unlike rl_directory_completion_hook, it\n   only modifies the directory name used in opendir(2), not what is displayed\n   when the possible completions are printed or inserted.  It is called\n   before rl_directory_completion_hook.  I'm not happy with how this works\n   yet, so it's undocumented. */\nextern rl_icppfunc_t *rl_directory_rewrite_hook;\n\n/* Backwards compatibility with previous versions of readline. */\n#define rl_symbolic_link_hook rl_directory_completion_hook\n\n/* If non-zero, then this is the address of a function to call when\n   completing a word would normally display the list of possible matches.\n   This function is called instead of actually doing the display.\n   It takes three arguments: (char **matches, int num_matches, int max_length)\n   where MATCHES is the array of strings that matched, NUM_MATCHES is the\n   number of strings in that array, and MAX_LENGTH is the length of the\n   longest string in that array. */\nextern rl_compdisp_func_t *rl_completion_display_matches_hook;\n\n/* Non-zero means that the results of the matches are to be treated\n   as filenames.  This is ALWAYS zero on entry, and can only be changed\n   within a completion entry finder function. */\nextern int rl_filename_completion_desired;\n\n/* Non-zero means that the results of the matches are to be quoted using\n   double quotes (or an application-specific quoting mechanism) if the\n   filename contains any characters in rl_word_break_chars.  This is\n   ALWAYS non-zero on entry, and can only be changed within a completion\n   entry finder function. */\nextern int rl_filename_quoting_desired;\n\n/* Set to a function to quote a filename in an application-specific fashion.\n   Called with the text to quote, the type of match found (single or multiple)\n   and a pointer to the quoting character to be used, which the function can\n   reset if desired. */\nextern rl_quote_func_t *rl_filename_quoting_function;\n\n/* Function to call to remove quoting characters from a filename.  Called\n   before completion is attempted, so the embedded quotes do not interfere\n   with matching names in the file system. */\nextern rl_dequote_func_t *rl_filename_dequoting_function;\n\n/* Function to call to decide whether or not a word break character is\n   quoted.  If a character is quoted, it does not break words for the\n   completer. */\nextern rl_linebuf_func_t *rl_char_is_quoted_p;\n\n/* Non-zero means to suppress normal filename completion after the\n   user-specified completion function has been called. */\nextern int rl_attempted_completion_over;\n\n/* Set to a character describing the type of completion being attempted by\n   rl_complete_internal; available for use by application completion\n   functions. */\nextern int rl_completion_type;\n\n/* Up to this many items will be displayed in response to a\n   possible-completions call.  After that, we ask the user if she\n   is sure she wants to see them all.  The default value is 100. */\nextern int rl_completion_query_items;\n\n/* Character appended to completed words when at the end of the line.  The\n   default is a space.  Nothing is added if this is '\\0'. */\nextern int rl_completion_append_character;\n\n/* If set to non-zero by an application completion function,\n   rl_completion_append_character will not be appended. */\nextern int rl_completion_suppress_append;\n\n/* Set to any quote character readline thinks it finds before any application\n   completion function is called. */\nextern int rl_completion_quote_character;\n\n/* Set to a non-zero value if readline found quoting anywhere in the word to\n   be completed; set before any application completion function is called. */\nextern int rl_completion_found_quote;\n\n/* If non-zero, the completion functions don't append any closing quote.\n   This is set to 0 by rl_complete_internal and may be changed by an\n   application-specific completion function. */\nextern int rl_completion_suppress_quote;\n\n/* If non-zero, a slash will be appended to completed filenames that are\n   symbolic links to directory names, subject to the value of the\n   mark-directories variable (which is user-settable).  This exists so\n   that application completion functions can override the user's preference\n   (set via the mark-symlinked-directories variable) if appropriate.\n   It's set to the value of _rl_complete_mark_symlink_dirs in\n   rl_complete_internal before any application-specific completion\n   function is called, so without that function doing anything, the user's\n   preferences are honored. */\nextern int rl_completion_mark_symlink_dirs;\n\n/* If non-zero, then disallow duplicates in the matches. */\nextern int rl_ignore_completion_duplicates;\n\n/* If this is non-zero, completion is (temporarily) inhibited, and the\n   completion character will be inserted as any other. */\nextern int rl_inhibit_completion;\n\n/* Input error; can be returned by (*rl_getc_function) if readline is reading\n   a top-level command (RL_ISSTATE (RL_STATE_READCMD)). */\n#define READERR\t\t\t(-2)\n\n/* Definitions available for use by readline clients. */\n#define RL_PROMPT_START_IGNORE\t'\\001'\n#define RL_PROMPT_END_IGNORE\t'\\002'\n\n/* Possible values for do_replace argument to rl_filename_quoting_function,\n   called by rl_complete_internal. */\n#define NO_MATCH        0\n#define SINGLE_MATCH    1\n#define MULT_MATCH      2\n\n/* Possible state values for rl_readline_state */\n#define RL_STATE_NONE\t\t0x000000\t\t/* no state; before first call */\n\n#define RL_STATE_INITIALIZING\t0x000001\t/* initializing */\n#define RL_STATE_INITIALIZED\t0x000002\t/* initialization done */\n#define RL_STATE_TERMPREPPED\t0x000004\t/* terminal is prepped */\n#define RL_STATE_READCMD\t0x000008\t/* reading a command key */\n#define RL_STATE_METANEXT\t0x000010\t/* reading input after ESC */\n#define RL_STATE_DISPATCHING\t0x000020\t/* dispatching to a command */\n#define RL_STATE_MOREINPUT\t0x000040\t/* reading more input in a command function */\n#define RL_STATE_ISEARCH\t0x000080\t/* doing incremental search */\n#define RL_STATE_NSEARCH\t0x000100\t/* doing non-inc search */\n#define RL_STATE_SEARCH\t\t0x000200\t/* doing a history search */\n#define RL_STATE_NUMERICARG\t0x000400\t/* reading numeric argument */\n#define RL_STATE_MACROINPUT\t0x000800\t/* getting input from a macro */\n#define RL_STATE_MACRODEF\t0x001000\t/* defining keyboard macro */\n#define RL_STATE_OVERWRITE\t0x002000\t/* overwrite mode */\n#define RL_STATE_COMPLETING\t0x004000\t/* doing completion */\n#define RL_STATE_SIGHANDLER\t0x008000\t/* in readline sighandler */\n#define RL_STATE_UNDOING\t0x010000\t/* doing an undo */\n#define RL_STATE_INPUTPENDING\t0x020000\t/* rl_execute_next called */\n#define RL_STATE_TTYCSAVED\t0x040000\t/* tty special chars saved */\n#define RL_STATE_CALLBACK\t0x080000\t/* using the callback interface */\n#define RL_STATE_VIMOTION\t0x100000\t/* reading vi motion arg */\n#define RL_STATE_MULTIKEY\t0x200000\t/* reading multiple-key command */\n#define RL_STATE_VICMDONCE\t0x400000\t/* entered vi command mode at least once */\n\n#define RL_STATE_DONE\t\t0x800000\t/* done; accepted line */\n\n#define RL_SETSTATE(x)\t\t(rl_readline_state |= (x))\n#define RL_UNSETSTATE(x)\t(rl_readline_state &= ~(x))\n#define RL_ISSTATE(x)\t\t(rl_readline_state & (x))\n\nstruct readline_state {\n  /* line state */\n  int point;\n  int end;\n  int mark;\n  char *buffer;\n  int buflen;\n  UNDO_LIST *ul;\n  char *prompt;\n\n  /* global state */\n  int rlstate;\n  int done;\n  Keymap kmap;\n\n  /* input state */\n  rl_command_func_t *lastfunc;\n  int insmode;\n  int edmode;\n  int kseqlen;\n  FILE *inf;\n  FILE *outf;\n  int pendingin;\n  char *macro;\n\n  /* signal state */\n  int catchsigs;\n  int catchsigwinch;\n\n  /* search state */\n\n  /* completion state */\n\n  /* options state */\n\n  /* reserved for future expansion, so the struct size doesn't change */\n  char reserved[64];\n};\n\nextern int rl_save_state PARAMS((struct readline_state *));\nextern int rl_restore_state PARAMS((struct readline_state *));\n\n#if !defined(RL_NO_COMPAT)\n#if !defined (savestring)\n#define savestring rl_savestring\nextern char *savestring __P((char *));  /* XXX backwards compatibility */\n#endif\n#endif\n\n#ifdef __cplusplus\n}\n#endif\n\n#endif /* _READLINE_H_ */\n"
  },
  {
    "path": "freebsd-headers/readline/rlconf.h",
    "content": "/* $FreeBSD: release/9.0.0/contrib/libreadline/rlconf.h 165675 2006-12-31 09:22:31Z ache $ */\n/* rlconf.h -- readline configuration definitions */\n\n/* Copyright (C) 1994 Free Software Foundation, Inc.\n\n   This file contains the Readline Library (the Library), a set of\n   routines for providing Emacs style line input to programs that ask\n   for it.\n\n   The Library is free software; you can redistribute it and/or modify\n   it under the terms of the GNU General Public License as published by\n   the Free Software Foundation; either version 2, or (at your option)\n   any later version.\n\n   The Library is distributed in the hope that it will be useful, but\n   WITHOUT ANY WARRANTY; without even the implied warranty of\n   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n   General Public License for more details.\n\n   The GNU General Public License is often shipped with GNU software, and\n   is generally kept in a file called COPYING or LICENSE.  If you do not\n   have a copy of the license, write to the Free Software Foundation,\n   59 Temple Place, Suite 330, Boston, MA 02111 USA. */\n\n#if !defined (_RLCONF_H_)\n#define _RLCONF_H_\n\n/* Define this if you want the vi-mode editing available. */\n#define VI_MODE\n\n/* Define this to get an indication of file type when listing completions. */\n#define VISIBLE_STATS\n\n/* This definition is needed by readline.c, rltty.c, and signals.c. */\n/* If on, then readline handles signals in a way that doesn't screw. */\n#define HANDLE_SIGNALS\n\n/* Ugly but working hack for binding prefix meta. */\n#define PREFIX_META_HACK\n\n/* The next-to-last-ditch effort file name for a user-specific init file. */\n#define DEFAULT_INPUTRC \"~/.inputrc\"\n\n/* The ultimate last-ditch filenname for an init file -- system-wide. */\n#define SYS_INPUTRC \"/etc/inputrc\"\n\n/* If defined, expand tabs to spaces. */\n#define DISPLAY_TABS\n\n/* If defined, use the terminal escape sequence to move the cursor forward\n   over a character when updating the line rather than rewriting it. */\n/* #define HACK_TERMCAP_MOTION */\n\n/* The string inserted by the `insert comment' command. */\n#define RL_COMMENT_BEGIN_DEFAULT \"#\"\n\n/* Define this if you want code that allows readline to be used in an\n   X `callback' style. */\n#define READLINE_CALLBACKS\n\n/* Define this if you want the cursor to indicate insert or overwrite mode. */\n/* #define CURSOR_MODE */\n\n#endif /* _RLCONF_H_ */\n"
  },
  {
    "path": "freebsd-headers/readline/rlstdc.h",
    "content": "/* stdc.h -- macros to make source compile on both ANSI C and K&R C\n   compilers. */\n\n/* Copyright (C) 1993 Free Software Foundation, Inc.\n\n   This file is part of GNU Bash, the Bourne Again SHell.\n\n   Bash is free software; you can redistribute it and/or modify it\n   under the terms of the GNU General Public License as published by\n   the Free Software Foundation; either version 2, or (at your option)\n   any later version.\n\n   Bash is distributed in the hope that it will be useful, but WITHOUT\n   ANY WARRANTY; without even the implied warranty of MERCHANTABILITY\n   or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public\n   License for more details.\n\n   You should have received a copy of the GNU General Public License\n   along with Bash; see the file COPYING.  If not, write to the Free\n   Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA. */\n\n#if !defined (_RL_STDC_H_)\n#define _RL_STDC_H_\n\n/* Adapted from BSD /usr/include/sys/cdefs.h. */\n\n/* A function can be defined using prototypes and compile on both ANSI C\n   and traditional C compilers with something like this:\n\textern char *func PARAMS((char *, char *, int)); */\n\n#if !defined (PARAMS)\n#  if defined (__STDC__) || defined (__GNUC__) || defined (__cplusplus)\n#    define PARAMS(protos) protos\n#  else\n#    define PARAMS(protos) ()\n#  endif\n#endif\n\n#ifndef __attribute__\n#  if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 8)\n#    define __attribute__(x)\n#  endif\n#endif\n\n#endif /* !_RL_STDC_H_ */\n"
  },
  {
    "path": "freebsd-headers/readline/rltypedefs.h",
    "content": "/* rltypedefs.h -- Type declarations for readline functions. */\n\n/* Copyright (C) 2000-2004 Free Software Foundation, Inc.\n\n   This file is part of the GNU Readline Library, a library for\n   reading lines of text with interactive input and history editing.\n\n   The GNU Readline Library is free software; you can redistribute it\n   and/or modify it under the terms of the GNU General Public License\n   as published by the Free Software Foundation; either version 2, or\n   (at your option) any later version.\n\n   The GNU Readline Library is distributed in the hope that it will be\n   useful, but WITHOUT ANY WARRANTY; without even the implied warranty\n   of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n   GNU General Public License for more details.\n\n   The GNU General Public License is often shipped with GNU software, and\n   is generally kept in a file called COPYING or LICENSE.  If you do not\n   have a copy of the license, write to the Free Software Foundation,\n   59 Temple Place, Suite 330, Boston, MA 02111 USA. */\n\n#ifndef _RL_TYPEDEFS_H_\n#define _RL_TYPEDEFS_H_\n\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\n/* Old-style */\n\n#if !defined (_FUNCTION_DEF)\n#  define _FUNCTION_DEF\n\ntypedef int Function ();\ntypedef void VFunction ();\ntypedef char *CPFunction ();\ntypedef char **CPPFunction ();\n\n#endif /* _FUNCTION_DEF */\n\n/* New style. */\n\n#if !defined (_RL_FUNCTION_TYPEDEF)\n#  define _RL_FUNCTION_TYPEDEF\n\n/* Bindable functions */\ntypedef int rl_command_func_t PARAMS((int, int));\n\n/* Typedefs for the completion system */\ntypedef char *rl_compentry_func_t PARAMS((const char *, int));\ntypedef char **rl_completion_func_t PARAMS((const char *, int, int));\n\ntypedef char *rl_quote_func_t PARAMS((char *, int, char *));\ntypedef char *rl_dequote_func_t PARAMS((char *, int));\n\ntypedef int rl_compignore_func_t PARAMS((char **));\n\ntypedef void rl_compdisp_func_t PARAMS((char **, int, int));\n\n/* Type for input and pre-read hook functions like rl_event_hook */\ntypedef int rl_hook_func_t PARAMS((void));\n\n/* Input function type */\ntypedef int rl_getc_func_t PARAMS((FILE *));\n\n/* Generic function that takes a character buffer (which could be the readline\n   line buffer) and an index into it (which could be rl_point) and returns\n   an int. */\ntypedef int rl_linebuf_func_t PARAMS((char *, int));\n\n/* `Generic' function pointer typedefs */\ntypedef int rl_intfunc_t PARAMS((int));\n#define rl_ivoidfunc_t rl_hook_func_t\ntypedef int rl_icpfunc_t PARAMS((char *));\ntypedef int rl_icppfunc_t PARAMS((char **));\n\ntypedef void rl_voidfunc_t PARAMS((void));\ntypedef void rl_vintfunc_t PARAMS((int));\ntypedef void rl_vcpfunc_t PARAMS((char *));\ntypedef void rl_vcppfunc_t PARAMS((char **));\n\ntypedef char *rl_cpvfunc_t PARAMS((void));\ntypedef char *rl_cpifunc_t PARAMS((int));\ntypedef char *rl_cpcpfunc_t PARAMS((char  *));\ntypedef char *rl_cpcppfunc_t PARAMS((char  **));\n\n#endif /* _RL_FUNCTION_TYPEDEF */\n\n#ifdef __cplusplus\n}\n#endif\n\n#endif /* _RL_TYPEDEFS_H_ */\n"
  },
  {
    "path": "freebsd-headers/readline/tilde.h",
    "content": "/* tilde.h: Externally available variables and function in libtilde.a. */\n\n/* Copyright (C) 1992 Free Software Foundation, Inc.\n\n   This file contains the Readline Library (the Library), a set of\n   routines for providing Emacs style line input to programs that ask\n   for it.\n\n   The Library is free software; you can redistribute it and/or modify\n   it under the terms of the GNU General Public License as published by\n   the Free Software Foundation; either version 2, or (at your option)\n   any later version.\n\n   The Library is distributed in the hope that it will be useful, but\n   WITHOUT ANY WARRANTY; without even the implied warranty of\n   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n   General Public License for more details.\n\n   The GNU General Public License is often shipped with GNU software, and\n   is generally kept in a file called COPYING or LICENSE.  If you do not\n   have a copy of the license, write to the Free Software Foundation,\n   59 Temple Place, Suite 330, Boston, MA 02111 USA. */\n\n#if !defined (_TILDE_H_)\n#  define _TILDE_H_\n\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\n/* A function can be defined using prototypes and compile on both ANSI C\n   and traditional C compilers with something like this:\n\textern char *func PARAMS((char *, char *, int)); */\n\n#if !defined (PARAMS)\n#  if defined (__STDC__) || defined (__GNUC__) || defined (__cplusplus)\n#    define PARAMS(protos) protos\n#  else\n#    define PARAMS(protos) ()\n#  endif\n#endif\n\ntypedef char *tilde_hook_func_t PARAMS((char *));\n\n/* If non-null, this contains the address of a function that the application\n   wants called before trying the standard tilde expansions.  The function\n   is called with the text sans tilde, and returns a malloc()'ed string\n   which is the expansion, or a NULL pointer if the expansion fails. */\nextern tilde_hook_func_t *tilde_expansion_preexpansion_hook;\n\n/* If non-null, this contains the address of a function to call if the\n   standard meaning for expanding a tilde fails.  The function is called\n   with the text (sans tilde, as in \"foo\"), and returns a malloc()'ed string\n   which is the expansion, or a NULL pointer if there is no expansion. */\nextern tilde_hook_func_t *tilde_expansion_failure_hook;\n\n/* When non-null, this is a NULL terminated array of strings which\n   are duplicates for a tilde prefix.  Bash uses this to expand\n   `=~' and `:~'. */\nextern char **tilde_additional_prefixes;\n\n/* When non-null, this is a NULL terminated array of strings which match\n   the end of a username, instead of just \"/\".  Bash sets this to\n   `:' and `=~'. */\nextern char **tilde_additional_suffixes;\n\n/* Return a new string which is the result of tilde expanding STRING. */\nextern char *tilde_expand PARAMS((const char *));\n\n/* Do the work of tilde expansion on FILENAME.  FILENAME starts with a\n   tilde.  If there is no expansion, call tilde_expansion_failure_hook. */\nextern char *tilde_expand_word PARAMS((const char *));\n\n/* Find the portion of the string beginning with ~ that should be expanded. */\nextern char *tilde_find_word PARAMS((const char *, int, int *));\n\n#ifdef __cplusplus\n}\n#endif\n\n#endif /* _TILDE_H_ */\n"
  },
  {
    "path": "freebsd-headers/readpassphrase.h",
    "content": "/*\t$OpenBSD: readpassphrase.h,v 1.5 2003/06/17 21:56:23 millert Exp $\t*/\n/*\t$FreeBSD: release/9.0.0/include/readpassphrase.h 215236 2010-11-13 10:38:06Z delphij $\t*/\n\n/*\n * Copyright (c) 2000, 2002 Todd C. Miller <Todd.Miller@courtesan.com>\n *\n * Permission to use, copy, modify, and distribute this software for any\n * purpose with or without fee is hereby granted, provided that the above\n * copyright notice and this permission notice appear in all copies.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES\n * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF\n * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR\n * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES\n * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN\n * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF\n * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.\n *\n * Sponsored in part by the Defense Advanced Research Projects\n * Agency (DARPA) and Air Force Research Laboratory, Air Force\n * Materiel Command, USAF, under agreement number F39502-99-1-0512.\n */\n\n#ifndef _READPASSPHRASE_H_\n#define _READPASSPHRASE_H_\n\n#define RPP_ECHO_OFF    0x00\t\t/* Turn off echo (default). */\n#define RPP_ECHO_ON     0x01\t\t/* Leave echo on. */\n#define RPP_REQUIRE_TTY 0x02\t\t/* Fail if there is no tty. */\n#define RPP_FORCELOWER  0x04\t\t/* Force input to lower case. */\n#define RPP_FORCEUPPER  0x08\t\t/* Force input to upper case. */\n#define RPP_SEVENBIT    0x10\t\t/* Strip the high bit from input. */\n#define RPP_STDIN       0x20\t\t/* Read from stdin, not /dev/tty */\n\n#include <sys/cdefs.h>\n#include <sys/_types.h>\n\n#ifndef _SIZE_T_DECLARED\ntypedef\t__size_t\tsize_t;\n#define\t_SIZE_T_DECLARED\n#endif\n\n__BEGIN_DECLS\nchar * readpassphrase(const char *, char *, size_t, int);\n__END_DECLS\n\n#endif /* !_READPASSPHRASE_H_ */\n"
  },
  {
    "path": "freebsd-headers/regex.h",
    "content": "/*-\n * Copyright (c) 1992 Henry Spencer.\n * Copyright (c) 1992, 1993\n *\tThe Regents of the University of California.  All rights reserved.\n *\n * This code is derived from software contributed to Berkeley by\n * Henry Spencer of the University of Toronto.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t@(#)regex.h\t8.2 (Berkeley) 1/3/94\n * $FreeBSD: release/9.0.0/include/regex.h 203964 2010-02-16 19:39:50Z imp $\n */\n\n#ifndef _REGEX_H_\n#define\t_REGEX_H_\n\n#include <sys/cdefs.h>\n#include <sys/_types.h>\n\n/* types */\ntypedef\t__off_t\t\tregoff_t;\n\n#ifndef _SIZE_T_DECLARED\ntypedef\t__size_t\tsize_t;\n#define\t_SIZE_T_DECLARED\n#endif\n\ntypedef struct {\n\tint re_magic;\n\tsize_t re_nsub;\t\t/* number of parenthesized subexpressions */\n\t__const char *re_endp;\t/* end pointer for REG_PEND */\n\tstruct re_guts *re_g;\t/* none of your business :-) */\n} regex_t;\n\ntypedef struct {\n\tregoff_t rm_so;\t\t/* start of match */\n\tregoff_t rm_eo;\t\t/* end of match */\n} regmatch_t;\n\n/* regcomp() flags */\n#define\tREG_BASIC\t0000\n#define\tREG_EXTENDED\t0001\n#define\tREG_ICASE\t0002\n#define\tREG_NOSUB\t0004\n#define\tREG_NEWLINE\t0010\n#define\tREG_NOSPEC\t0020\n#define\tREG_PEND\t0040\n#define\tREG_DUMP\t0200\n\n/* regerror() flags */\n#define\tREG_ENOSYS\t(-1)\n#define\tREG_NOMATCH\t 1\n#define\tREG_BADPAT\t 2\n#define\tREG_ECOLLATE\t 3\n#define\tREG_ECTYPE\t 4\n#define\tREG_EESCAPE\t 5\n#define\tREG_ESUBREG\t 6\n#define\tREG_EBRACK\t 7\n#define\tREG_EPAREN\t 8\n#define\tREG_EBRACE\t 9\n#define\tREG_BADBR\t10\n#define\tREG_ERANGE\t11\n#define\tREG_ESPACE\t12\n#define\tREG_BADRPT\t13\n#define\tREG_EMPTY\t14\n#define\tREG_ASSERT\t15\n#define\tREG_INVARG\t16\n#define\tREG_ILLSEQ\t17\n#define\tREG_ATOI\t255\t/* convert name to number (!) */\n#define\tREG_ITOA\t0400\t/* convert number to name (!) */\n\n/* regexec() flags */\n#define\tREG_NOTBOL\t00001\n#define\tREG_NOTEOL\t00002\n#define\tREG_STARTEND\t00004\n#define\tREG_TRACE\t00400\t/* tracing of execution */\n#define\tREG_LARGE\t01000\t/* force large representation */\n#define\tREG_BACKR\t02000\t/* force use of backref code */\n\n__BEGIN_DECLS\nint\tregcomp(regex_t * __restrict, const char * __restrict, int);\nsize_t\tregerror(int, const regex_t * __restrict, char * __restrict, size_t);\n/*\n * XXX forth parameter should be `regmatch_t [__restrict]', but isn't because\n * of a bug in GCC 3.2 (when -std=c99 is specified) which perceives this as a\n * syntax error.\n */\nint\tregexec(const regex_t * __restrict, const char * __restrict, size_t,\n\t    regmatch_t * __restrict, int);\nvoid\tregfree(regex_t *);\n__END_DECLS\n\n#endif /* !_REGEX_H_ */\n"
  },
  {
    "path": "freebsd-headers/res_update.h",
    "content": "/*\n * Copyright (c) 2004 by Internet Systems Consortium, Inc. (\"ISC\")\n * Copyright (c) 1999 by Internet Software Consortium, Inc.\n *\n * Permission to use, copy, modify, and distribute this software for any\n * purpose with or without fee is hereby granted, provided that the above\n * copyright notice and this permission notice appear in all copies.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\" AND ISC DISCLAIMS ALL WARRANTIES\n * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF\n * MERCHANTABILITY AND FITNESS.  IN NO EVENT SHALL ISC BE LIABLE FOR\n * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES\n * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN\n * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT\n * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.\n */\n\n/*\n *\t$Id: res_update.h,v 1.2.18.1 2005/04/27 05:00:49 sra Exp $\n * $FreeBSD: release/9.0.0/include/res_update.h 170244 2007-06-03 17:20:27Z ume $\n */\n\n#ifndef __RES_UPDATE_H\n#define __RES_UPDATE_H\n\n/*! \\file */\n\n#include <sys/types.h>\n#include <arpa/nameser.h>\n#include <resolv.h>\n\n/*%\n * This RR-like structure is particular to UPDATE.\n */\nstruct ns_updrec {\n\tstruct {\n\t\tstruct ns_updrec *prev;\n\t\tstruct ns_updrec *next;\n\t} r_link, r_glink;\n\tns_sect\t\tr_section;\t/*%< ZONE/PREREQUISITE/UPDATE */\n\tchar *\t\tr_dname;\t/*%< owner of the RR */\n\tns_class\tr_class;\t/*%< class number */\n\tns_type\t\tr_type;\t\t/*%< type number */\n\tu_int32_t\tr_ttl;\t\t/*%< time to live */\n\tu_char *\tr_data;\t\t/*%< rdata fields as text string */\n\tu_int\t\tr_size;\t\t/*%< size of r_data field */\n\tint\t\tr_opcode;\t/*%< type of operation */\n\t/* following fields for private use by the resolver/server routines */\n\tstruct databuf *r_dp;\t\t/*%< databuf to process */\n\tstruct databuf *r_deldp;\t/*%< databuf's deleted/overwritten */\n\tu_int\t\tr_zone;\t\t/*%< zone number on server */\n};\ntypedef struct ns_updrec ns_updrec;\ntypedef struct {\n\tns_updrec *head;\n\tns_updrec *tail;\n} ns_updque;\n\n#define res_mkupdate\t\t__res_mkupdate\n#define res_update\t\t__res_update\n#define res_mkupdrec\t\t__res_mkupdrec\n#define res_freeupdrec\t\t__res_freeupdrec\n#define res_nmkupdate\t\t__res_nmkupdate\n#define res_nupdate\t\t__res_nupdate\n\nint\t\tres_mkupdate(ns_updrec *, u_char *, int);\nint\t\tres_update(ns_updrec *);\nns_updrec *\tres_mkupdrec(int, const char *, u_int, u_int, u_long);\nvoid\t\tres_freeupdrec(ns_updrec *);\nint\t\tres_nmkupdate(res_state, ns_updrec *, u_char *, int);\nint\t\tres_nupdate(res_state, ns_updrec *, ns_tsig_key *);\n\n#endif /*__RES_UPDATE_H*/\n\n/*! \\file */\n"
  },
  {
    "path": "freebsd-headers/resolv.h",
    "content": "/*\n * Copyright (c) 1983, 1987, 1989\n *    The Regents of the University of California.  All rights reserved.\n * \n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n * \n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n */\n\n/*\n * Copyright (c) 2004 by Internet Systems Consortium, Inc. (\"ISC\")\n * Portions Copyright (c) 1996-1999 by Internet Software Consortium.\n *\n * Permission to use, copy, modify, and distribute this software for any\n * purpose with or without fee is hereby granted, provided that the above\n * copyright notice and this permission notice appear in all copies.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\" AND ISC DISCLAIMS ALL WARRANTIES\n * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF\n * MERCHANTABILITY AND FITNESS.  IN NO EVENT SHALL ISC BE LIABLE FOR\n * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES\n * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN\n * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT\n * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.\n */\n\n/*%\n *\t@(#)resolv.h\t8.1 (Berkeley) 6/2/93\n *\t$Id: resolv.h,v 1.19.18.4 2008/04/03 23:15:15 marka Exp $\n * $FreeBSD: release/9.0.0/include/resolv.h 203964 2010-02-16 19:39:50Z imp $\n */\n\n#ifndef _RESOLV_H_\n#define\t_RESOLV_H_\n\n#include <sys/param.h>\n#include <sys/types.h>\n#include <sys/cdefs.h>\n#include <sys/socket.h>\n#include <stdio.h>\n#include <arpa/nameser.h>\n\n/*%\n * Revision information.  This is the release date in YYYYMMDD format.\n * It can change every day so the right thing to do with it is use it\n * in preprocessor commands such as \"#if (__RES > 19931104)\".  Do not\n * compare for equality; rather, use it to determine whether your resolver\n * is new enough to contain a certain feature.\n */\n\n#define\t__RES\t20030124\n\n/*%\n * This used to be defined in res_query.c, now it's in herror.c.\n * [XXX no it's not.  It's in irs/irs_data.c]\n * It was\n * never extern'd by any *.h file before it was placed here.  For thread\n * aware programs, the last h_errno value set is stored in res->h_errno.\n *\n * XXX:\tThere doesn't seem to be a good reason for exposing RES_SET_H_ERRNO\n *\t(and __h_errno_set) to the public via <resolv.h>.\n * XXX:\t__h_errno_set is really part of IRS, not part of the resolver.\n *\tIf somebody wants to build and use a resolver that doesn't use IRS,\n *\twhat do they do?  Perhaps something like\n *\t\t#ifdef WANT_IRS\n *\t\t# define RES_SET_H_ERRNO(r,x) __h_errno_set(r,x)\n *\t\t#else\n *\t\t# define RES_SET_H_ERRNO(r,x) (h_errno = (r)->res_h_errno = (x))\n *\t\t#endif\n */\n\n#define RES_SET_H_ERRNO(r,x) __h_errno_set(r,x)\nstruct __res_state; /*%< forward */\n__BEGIN_DECLS\nvoid __h_errno_set(struct __res_state *, int);\n__END_DECLS\n\n/*%\n * Resolver configuration file.\n * Normally not present, but may contain the address of the\n * initial name server(s) to query and the domain search list.\n */\n\n#ifndef _PATH_RESCONF\n#define\t_PATH_RESCONF        \"/etc/resolv.conf\"\n#endif\n\ntypedef enum { res_goahead, res_nextns, res_modified, res_done, res_error }\n\tres_sendhookact;\n\ntypedef res_sendhookact (*res_send_qhook)(struct sockaddr * const *,\n\t\t\t\t\t  const u_char **, int *,\n\t\t\t\t\t  u_char *, int, int *);\n\ntypedef res_sendhookact (*res_send_rhook)(const struct sockaddr *,\n\t\t\t\t\t  const u_char *, int, u_char *,\n\t\t\t\t\t  int, int *);\n\nstruct res_sym {\n\tint\t\tnumber;\t   /*%< Identifying number, like T_MX */\n\tconst char *\tname;\t   /*%< Its symbolic name, like \"MX\" */\n\tconst char *\thumanname; /*%< Its fun name, like \"mail exchanger\" */\n};\n\n/*%\n * Global defines and variables for resolver stub.\n */\n#define\tMAXNS\t\t\t3\t/*%< max # name servers we'll track */\n#define\tMAXDFLSRCH\t\t3\t/*%< # default domain levels to try */\n#define\tMAXDNSRCH\t\t6\t/*%< max # domains in search path */\n#define\tLOCALDOMAINPARTS\t2\t/*%< min levels in name that is \"local\" */\n#define\tRES_TIMEOUT\t\t5\t/*%< min. seconds between retries */\n#define\tMAXRESOLVSORT\t\t10\t/*%< number of net to sort on */\n#define\tRES_MAXNDOTS\t\t15\t/*%< should reflect bit field size */\n#define\tRES_MAXRETRANS\t\t30\t/*%< only for resolv.conf/RES_OPTIONS */\n#define\tRES_MAXRETRY\t\t5\t/*%< only for resolv.conf/RES_OPTIONS */\n#define\tRES_DFLRETRY\t\t2\t/*%< Default #/tries. */\n#define\tRES_MAXTIME\t\t65535\t/*%< Infinity, in milliseconds. */\nstruct __res_state_ext;\n\nstruct __res_state {\n\tint\tretrans;\t \t/*%< retransmission time interval */\n\tint\tretry;\t\t\t/*%< number of times to retransmit */\n\t/*\n\t * XXX: If `sun' is defined, `options' and `pfcode' are\n\t * defined as u_int in original BIND9 distribution.  However,\n\t * it breaks binary backward compatibility against FreeBSD's\n\t * resolver.  So, we changed not to see `sun'.\n\t */\n#if defined(sun) && 0\n\tu_int\toptions;\t\t/*%< option flags - see below. */\n#else\n\tu_long\toptions;\t\t/*%< option flags - see below. */\n#endif\n\tint\tnscount;\t\t/*%< number of name servers */\n\tstruct sockaddr_in\n\t\tnsaddr_list[MAXNS];\t/*%< address of name server */\n#define\tnsaddr\tnsaddr_list[0]\t\t/*%< for backward compatibility */\n\tu_short\tid;\t\t\t/*%< current message id */\n\tchar\t*dnsrch[MAXDNSRCH+1];\t/*%< components of domain to search */\n\tchar\tdefdname[256];\t\t/*%< default domain (deprecated) */\n#if defined(sun) && 0\n\tu_int\tpfcode;\t\t\t/*%< RES_PRF_ flags - see below. */\n#else\n\tu_long\tpfcode;\t\t\t/*%< RES_PRF_ flags - see below. */\n#endif\n\tunsigned ndots:4;\t\t/*%< threshold for initial abs. query */\n\tunsigned nsort:4;\t\t/*%< number of elements in sort_list[] */\n\tchar\tunused[3];\n\tstruct {\n\t\tstruct in_addr\taddr;\n\t\tu_int32_t\tmask;\n\t} sort_list[MAXRESOLVSORT];\n\tres_send_qhook qhook;\t\t/*%< query hook */\n\tres_send_rhook rhook;\t\t/*%< response hook */\n\tint\tres_h_errno;\t\t/*%< last one set for this context */\n\tint\t_vcsock;\t\t/*%< PRIVATE: for res_send VC i/o */\n\tu_int\t_flags;\t\t\t/*%< PRIVATE: see below */\n\tu_int\t_pad;\t\t\t/*%< make _u 64 bit aligned */\n\tunion {\n\t\t/* On an 32-bit arch this means 512b total. */\n\t\tchar\tpad[72 - 4*sizeof (int) - 2*sizeof (void *)];\n\t\tstruct {\n\t\t\tu_int16_t\t\tnscount;\n\t\t\tu_int16_t\t\tnstimes[MAXNS];\t/*%< ms. */\n\t\t\tint\t\t\tnssocks[MAXNS];\n\t\t\tstruct __res_state_ext *ext;\t/*%< extention for IPv6 */\n\t\t} _ext;\n\t} _u;\n};\n\ntypedef struct __res_state *res_state;\n\nunion res_sockaddr_union {\n\tstruct sockaddr_in\tsin;\n#ifdef IN6ADDR_ANY_INIT\n\tstruct sockaddr_in6\tsin6;\n#endif\n#ifdef ISC_ALIGN64\n\tint64_t\t\t\t__align64;\t/*%< 64bit alignment */\n#else\n\tint32_t\t\t\t__align32;\t/*%< 32bit alignment */\n#endif\n\tchar\t\t\t__space[128];   /*%< max size */\n};\n\n/*%\n * Resolver flags (used to be discrete per-module statics ints).\n */\n#define\tRES_F_VC\t0x00000001\t/*%< socket is TCP */\n#define\tRES_F_CONN\t0x00000002\t/*%< socket is connected */\n#define\tRES_F_EDNS0ERR\t0x00000004\t/*%< EDNS0 caused errors */\n#define\tRES_F__UNUSED\t0x00000008\t/*%< (unused) */\n#define\tRES_F_LASTMASK\t0x000000F0\t/*%< ordinal server of last res_nsend */\n#define\tRES_F_LASTSHIFT\t4\t\t/*%< bit position of LASTMASK \"flag\" */\n#define\tRES_GETLAST(res) (((res)._flags & RES_F_LASTMASK) >> RES_F_LASTSHIFT)\n\n/* res_findzonecut2() options */\n#define\tRES_EXHAUSTIVE\t0x00000001\t/*%< always do all queries */\n#define\tRES_IPV4ONLY\t0x00000002\t/*%< IPv4 only */\n#define\tRES_IPV6ONLY\t0x00000004\t/*%< IPv6 only */\n\n/*%\n * Resolver options (keep these in synch with res_debug.c, please)\n */\n#define RES_INIT\t0x00000001\t/*%< address initialized */\n#define RES_DEBUG\t0x00000002\t/*%< print debug messages */\n#define RES_AAONLY\t0x00000004\t/*%< authoritative answers only (!IMPL)*/\n#define RES_USEVC\t0x00000008\t/*%< use virtual circuit */\n#define RES_PRIMARY\t0x00000010\t/*%< query primary server only (!IMPL) */\n#define RES_IGNTC\t0x00000020\t/*%< ignore truncation errors */\n#define RES_RECURSE\t0x00000040\t/*%< recursion desired */\n#define RES_DEFNAMES\t0x00000080\t/*%< use default domain name */\n#define RES_STAYOPEN\t0x00000100\t/*%< Keep TCP socket open */\n#define RES_DNSRCH\t0x00000200\t/*%< search up local domain tree */\n#define\tRES_INSECURE1\t0x00000400\t/*%< type 1 security disabled */\n#define\tRES_INSECURE2\t0x00000800\t/*%< type 2 security disabled */\n#define\tRES_NOALIASES\t0x00001000\t/*%< shuts off HOSTALIASES feature */\n#define\tRES_USE_INET6\t0x00002000\t/*%< use/map IPv6 in gethostbyname() */\n#define RES_ROTATE\t0x00004000\t/*%< rotate ns list after each query */\n#define\tRES_NOCHECKNAME\t0x00008000\t/*%< do not check names for sanity. */\n#define\tRES_KEEPTSIG\t0x00010000\t/*%< do not strip TSIG records */\n#define\tRES_BLAST\t0x00020000\t/*%< blast all recursive servers */\n#define RES_NSID\t0x00040000      /*%< request name server ID */\n#define RES_NOTLDQUERY\t0x00100000\t/*%< don't unqualified name as a tld */\n#define RES_USE_DNSSEC\t0x00200000\t/*%< use DNSSEC using OK bit in OPT */\n/* #define RES_DEBUG2\t0x00400000 */\t/* nslookup internal */\n/* KAME extensions: use higher bit to avoid conflict with ISC use */\n#define RES_USE_DNAME\t0x10000000\t/*%< use DNAME */\n#define RES_USE_EDNS0\t0x40000000\t/*%< use EDNS0 if configured */\n#define RES_NO_NIBBLE2\t0x80000000\t/*%< disable alternate nibble lookup */\n\n#define RES_DEFAULT\t(RES_RECURSE | RES_DEFNAMES | \\\n\t\t\t RES_DNSRCH | RES_NO_NIBBLE2)\n\n/*%\n * Resolver \"pfcode\" values.  Used by dig.\n */\n#define\tRES_PRF_STATS\t0x00000001\n#define\tRES_PRF_UPDATE\t0x00000002\n#define\tRES_PRF_CLASS   0x00000004\n#define\tRES_PRF_CMD\t0x00000008\n#define\tRES_PRF_QUES\t0x00000010\n#define\tRES_PRF_ANS\t0x00000020\n#define\tRES_PRF_AUTH\t0x00000040\n#define\tRES_PRF_ADD\t0x00000080\n#define\tRES_PRF_HEAD1\t0x00000100\n#define\tRES_PRF_HEAD2\t0x00000200\n#define\tRES_PRF_TTLID\t0x00000400\n#define\tRES_PRF_HEADX\t0x00000800\n#define\tRES_PRF_QUERY\t0x00001000\n#define\tRES_PRF_REPLY\t0x00002000\n#define\tRES_PRF_INIT\t0x00004000\n#define\tRES_PRF_TRUNC\t0x00008000\n/*\t\t\t0x00010000\t*/\n\n/* Things involving an internal (static) resolver context. */\n__BEGIN_DECLS\nextern struct __res_state *__res_state(void);\n__END_DECLS\n#define _res (*__res_state())\n\n#ifndef __BIND_NOSTATIC\n#define fp_nquery\t\t__fp_nquery\n#define fp_query\t\t__fp_query\n#define hostalias\t\t__hostalias\n#define p_query\t\t\t__p_query\n#define res_close\t\t__res_close\n#define res_init\t\t__res_init\n#define res_isourserver\t\t__res_isourserver\n#define res_mkquery\t\t__res_mkquery\n#define res_opt\t\t\t__res_opt\n#define res_query\t\t__res_query\n#define res_querydomain\t\t__res_querydomain\n#define res_search\t\t__res_search\n#define res_send\t\t__res_send\n#define res_sendsigned\t\t__res_sendsigned\n\n__BEGIN_DECLS\nvoid\t\tfp_nquery(const u_char *, int, FILE *);\nvoid\t\tfp_query(const u_char *, FILE *);\nconst char *\thostalias(const char *);\nvoid\t\tp_query(const u_char *);\nvoid\t\tres_close(void);\nint\t\tres_init(void);\nint\t\tres_isourserver(const struct sockaddr_in *);\nint\t\tres_mkquery(int, const char *, int, int, const u_char *,\n\t\t\t\t int, const u_char *, u_char *, int);\nint\t\tres_opt(int, u_char *, int, int);\nint\t\tres_query(const char *, int, int, u_char *, int);\nint\t\tres_querydomain(const char *, const char *, int, int,\n\t\t\t\t     u_char *, int);\nint\t\tres_search(const char *, int, int, u_char *, int);\nint\t\tres_send(const u_char *, int, u_char *, int);\nint\t\tres_sendsigned(const u_char *, int, ns_tsig_key *,\n\t\t\t\t    u_char *, int);\n__END_DECLS\n#endif\n\n#if !defined(SHARED_LIBBIND) || defined(LIB)\n/*\n * If libbind is a shared object (well, DLL anyway)\n * these externs break the linker when resolv.h is \n * included by a lib client (like named)\n * Make them go away if a client is including this\n *\n */\nextern const struct res_sym __p_key_syms[];\nextern const struct res_sym __p_cert_syms[];\nextern const struct res_sym __p_class_syms[];\nextern const struct res_sym __p_type_syms[];\nextern const struct res_sym __p_rcode_syms[];\n#endif /* SHARED_LIBBIND */\n\n#define b64_ntop\t\t__b64_ntop\n#define b64_pton\t\t__b64_pton\n#define dn_comp\t\t\t__dn_comp\n#define dn_count_labels\t\t__dn_count_labels\n#define dn_expand\t\t__dn_expand\n#define dn_skipname\t\t__dn_skipname\n#define fp_resstat\t\t__fp_resstat\n#define loc_aton\t\t__loc_aton\n#define loc_ntoa\t\t__loc_ntoa\n#define p_cdname\t\t__p_cdname\n#define p_cdnname\t\t__p_cdnname\n#define p_class\t\t\t__p_class\n#define p_fqname\t\t__p_fqname\n#define p_fqnname\t\t__p_fqnname\n#define p_option\t\t__p_option\n#define p_secstodate\t\t__p_secstodate\n#define p_section\t\t__p_section\n#define p_time\t\t\t__p_time\n#define p_type\t\t\t__p_type\n#define p_rcode\t\t\t__p_rcode\n#define p_sockun\t\t__p_sockun\n#define putlong\t\t\t__putlong\n#define putshort\t\t__putshort\n#define res_dnok\t\t__res_dnok\n#if 0\n#define res_findzonecut\t\t__res_findzonecut\n#endif\n#define res_findzonecut2\t__res_findzonecut2\n#define res_hnok\t\t__res_hnok\n#define res_hostalias\t\t__res_hostalias\n#define res_mailok\t\t__res_mailok\n#define res_nameinquery\t\t__res_nameinquery\n#define res_nclose\t\t__res_nclose\n#define res_ninit\t\t__res_ninit\n#define res_nmkquery\t\t__res_nmkquery\n#define res_pquery\t\t__res_pquery\n#define res_nquery\t\t__res_nquery\n#define res_nquerydomain\t__res_nquerydomain\n#define res_nsearch\t\t__res_nsearch\n#define res_nsend\t\t__res_nsend\n#if 0\n#define res_nsendsigned\t\t__res_nsendsigned\n#endif\n#define res_nisourserver\t__res_nisourserver\n#define res_ownok\t\t__res_ownok\n#define res_queriesmatch\t__res_queriesmatch\n#define res_randomid\t\t__res_randomid\n#define sym_ntop\t\t__sym_ntop\n#define sym_ntos\t\t__sym_ntos\n#define sym_ston\t\t__sym_ston\n#define res_nopt\t\t__res_nopt\n#define res_nopt_rdata       \t__res_nopt_rdata\n#define res_ndestroy\t\t__res_ndestroy\n#define\tres_nametoclass\t\t__res_nametoclass\n#define\tres_nametotype\t\t__res_nametotype\n#define\tres_setservers\t\t__res_setservers\n#define\tres_getservers\t\t__res_getservers\n#if 0\n#define\tres_buildprotolist\t__res_buildprotolist\n#define\tres_destroyprotolist\t__res_destroyprotolist\n#define\tres_destroyservicelist\t__res_destroyservicelist\n#define\tres_get_nibblesuffix\t__res_get_nibblesuffix\n#define\tres_get_nibblesuffix2\t__res_get_nibblesuffix2\n#endif\n#define\tres_ourserver_p\t\t__res_ourserver_p\n#if 0\n#define\tres_protocolname\t__res_protocolname\n#define\tres_protocolnumber\t__res_protocolnumber\n#endif\n#define\tres_send_setqhook\t__res_send_setqhook\n#define\tres_send_setrhook\t__res_send_setrhook\n#if 0\n#define\tres_servicename\t\t__res_servicename\n#define\tres_servicenumber\t__res_servicenumber\n#endif\n__BEGIN_DECLS\nint\t\tres_hnok(const char *);\nint\t\tres_ownok(const char *);\nint\t\tres_mailok(const char *);\nint\t\tres_dnok(const char *);\nint\t\tsym_ston(const struct res_sym *, const char *, int *);\nconst char *\tsym_ntos(const struct res_sym *, int, int *);\nconst char *\tsym_ntop(const struct res_sym *, int, int *);\nint\t\tb64_ntop(u_char const *, size_t, char *, size_t);\nint\t\tb64_pton(char const *, u_char *, size_t);\nint\t\tloc_aton(const char *, u_char *);\nconst char *\tloc_ntoa(const u_char *, char *);\nint\t\tdn_skipname(const u_char *, const u_char *);\nvoid\t\tputlong(u_int32_t, u_char *);\nvoid\t\tputshort(u_int16_t, u_char *);\n#ifndef __ultrix__\nu_int16_t\t_getshort(const u_char *);\nu_int32_t\t_getlong(const u_char *);\n#endif\nconst char *\tp_class(int);\nconst char *\tp_time(u_int32_t);\nconst char *\tp_type(int);\nconst char *\tp_rcode(int);\nconst char *\tp_sockun(union res_sockaddr_union, char *, size_t);\nconst u_char *\tp_cdnname(const u_char *, const u_char *, int, FILE *);\nconst u_char *\tp_cdname(const u_char *, const u_char *, FILE *);\nconst u_char *\tp_fqnname(const u_char *, const u_char *, int, char *, int);\nconst u_char *\tp_fqname(const u_char *, const u_char *, FILE *);\nconst char *\tp_option(u_long);\nchar *\t\tp_secstodate(u_long);\nint\t\tdn_count_labels(const char *);\nint\t\tdn_comp(const char *, u_char *, int, u_char **, u_char **);\nint\t\tdn_expand(const u_char *, const u_char *, const u_char *,\n\t\t\t  char *, int);\nu_int\t\tres_randomid(void);\nint\t\tres_nameinquery(const char *, int, int, const u_char *,\n\t\t\t\tconst u_char *);\nint\t\tres_queriesmatch(const u_char *, const u_char *,\n\t\t\t\t const u_char *, const u_char *);\nconst char *\tp_section(int, int);\n/* Things involving a resolver context. */\nint\t\tres_ninit(res_state);\nint\t\tres_nisourserver(const res_state, const struct sockaddr_in *);\nvoid\t\tfp_resstat(const res_state, FILE *);\nvoid\t\tres_pquery(const res_state, const u_char *, int, FILE *);\nconst char *\tres_hostalias(const res_state, const char *, char *, size_t);\nint\t\tres_nquery(res_state, const char *, int, int, u_char *, int);\nint\t\tres_nsearch(res_state, const char *, int, int, u_char *, int);\nint\t\tres_nquerydomain(res_state, const char *, const char *,\n\t\t\t\t int, int, u_char *, int);\nint\t\tres_nmkquery(res_state, int, const char *, int, int,\n\t\t\t     const u_char *, int, const u_char *,\n\t\t\t     u_char *, int);\nint\t\tres_nsend(res_state, const u_char *, int, u_char *, int);\n#if 0\nint\t\tres_nsendsigned(res_state, const u_char *, int,\n\t\t\t\tns_tsig_key *, u_char *, int);\nint\t\tres_findzonecut(res_state, const char *, ns_class, int,\n\t\t\t\tchar *, size_t, struct in_addr *, int);\n#endif\nint\t\tres_findzonecut2(res_state, const char *, ns_class, int,\n\t\t\t\t char *, size_t,\n\t\t\t\t union res_sockaddr_union *, int);\nvoid\t\tres_nclose(res_state);\nint\t\tres_nopt(res_state, int, u_char *, int, int);\nint\t\tres_nopt_rdata(res_state, int, u_char *, int, u_char *,\n\t\t\t       u_short, u_short, u_char *);\nvoid\t\tres_send_setqhook(res_send_qhook);\nvoid\t\tres_send_setrhook(res_send_rhook);\nint\t\t__res_vinit(res_state, int);\n#if 0\nvoid\t\tres_destroyservicelist(void);\nconst char *\tres_servicename(u_int16_t, const char *);\nconst char *\tres_protocolname(int);\nvoid\t\tres_destroyprotolist(void);\nvoid\t\tres_buildprotolist(void);\nconst char *\tres_get_nibblesuffix(res_state);\nconst char *\tres_get_nibblesuffix2(res_state);\n#endif\nvoid\t\tres_ndestroy(res_state);\nu_int16_t\tres_nametoclass(const char *, int *);\nu_int16_t\tres_nametotype(const char *, int *);\nvoid\t\tres_setservers(res_state, const union res_sockaddr_union *,\n\t\t\t       int);\nint\t\tres_getservers(res_state, union res_sockaddr_union *, int);\n__END_DECLS\n\n#endif /* !_RESOLV_H_ */\n/*! \\file */\n"
  },
  {
    "path": "freebsd-headers/rfc2459_asn1.h",
    "content": "/* Generated from /usr/src/kerberos5/lib/libasn1/../../../crypto/heimdal/lib/asn1/rfc2459.asn1 */\n/* Do not edit */\n\n#ifndef __rfc2459_asn1_h__\n#define __rfc2459_asn1_h__\n\n#include <stddef.h>\n#include <time.h>\n\n#ifndef __asn1_common_definitions__\n#define __asn1_common_definitions__\n\ntypedef struct heim_integer {\n  size_t length;\n  void *data;\n  int negative;\n} heim_integer;\n\ntypedef struct heim_octet_string {\n  size_t length;\n  void *data;\n} heim_octet_string;\n\ntypedef char *heim_general_string;\n\ntypedef char *heim_utf8_string;\n\ntypedef char *heim_printable_string;\n\ntypedef char *heim_ia5_string;\n\ntypedef struct heim_bmp_string {\n  size_t length;\n  uint16_t *data;\n} heim_bmp_string;\n\ntypedef struct heim_universal_string {\n  size_t length;\n  uint32_t *data;\n} heim_universal_string;\n\ntypedef char *heim_visible_string;\n\ntypedef struct heim_oid {\n  size_t length;\n  unsigned *components;\n} heim_oid;\n\ntypedef struct heim_bit_string {\n  size_t length;\n  void *data;\n} heim_bit_string;\n\ntypedef struct heim_octet_string heim_any;\ntypedef struct heim_octet_string heim_any_set;\n\n#define ASN1_MALLOC_ENCODE(T, B, BL, S, L, R)                  \\\n  do {                                                         \\\n    (BL) = length_##T((S));                                    \\\n    (B) = malloc((BL));                                        \\\n    if((B) == NULL) {                                          \\\n      (R) = ENOMEM;                                            \\\n    } else {                                                   \\\n      (R) = encode_##T(((unsigned char*)(B)) + (BL) - 1, (BL), \\\n                       (S), (L));                              \\\n      if((R) != 0) {                                           \\\n        free((B));                                             \\\n        (B) = NULL;                                            \\\n      }                                                        \\\n    }                                                          \\\n  } while (0)\n\nstruct units;\n\n#endif\n\n#include <heim_asn1.h>\n/*\nVersion ::= INTEGER {\n  rfc3280_version_1(0),\n  rfc3280_version_2(1),\n  rfc3280_version_3(2)\n}\n*/\n\ntypedef enum Version {\n  rfc3280_version_1 = 0,\n  rfc3280_version_2 = 1,\n  rfc3280_version_3 = 2\n} Version;\n\nint    encode_Version(unsigned char *, size_t, const Version *, size_t *);\nint    decode_Version(const unsigned char *, size_t, Version *, size_t *);\nvoid   free_Version  (Version *);\nsize_t length_Version(const Version *);\nint    copy_Version  (const Version *, Version *);\n\n\n/* OBJECT IDENTIFIER id-pkcs-1 ::= { iso(1) member-body(2) us(840) rsadsi(113549) pkcs(1) label-less(1) } */\nconst heim_oid *oid_id_pkcs_1(void);\n\n/* OBJECT IDENTIFIER id-pkcs1-rsaEncryption ::= { iso(1) member-body(2) us(840) rsadsi(113549) pkcs(1) label-less(1) label-less(1) } */\nconst heim_oid *oid_id_pkcs1_rsaEncryption(void);\n\n/* OBJECT IDENTIFIER id-pkcs1-md2WithRSAEncryption ::= { iso(1) member-body(2) us(840) rsadsi(113549) pkcs(1) label-less(1) label-less(2) } */\nconst heim_oid *oid_id_pkcs1_md2WithRSAEncryption(void);\n\n/* OBJECT IDENTIFIER id-pkcs1-md5WithRSAEncryption ::= { iso(1) member-body(2) us(840) rsadsi(113549) pkcs(1) label-less(1) label-less(4) } */\nconst heim_oid *oid_id_pkcs1_md5WithRSAEncryption(void);\n\n/* OBJECT IDENTIFIER id-pkcs1-sha1WithRSAEncryption ::= { iso(1) member-body(2) us(840) rsadsi(113549) pkcs(1) label-less(1) label-less(5) } */\nconst heim_oid *oid_id_pkcs1_sha1WithRSAEncryption(void);\n\n/* OBJECT IDENTIFIER id-pkcs1-sha256WithRSAEncryption ::= { iso(1) member-body(2) us(840) rsadsi(113549) pkcs(1) label-less(1) label-less(11) } */\nconst heim_oid *oid_id_pkcs1_sha256WithRSAEncryption(void);\n\n/* OBJECT IDENTIFIER id-pkcs1-sha384WithRSAEncryption ::= { iso(1) member-body(2) us(840) rsadsi(113549) pkcs(1) label-less(1) label-less(12) } */\nconst heim_oid *oid_id_pkcs1_sha384WithRSAEncryption(void);\n\n/* OBJECT IDENTIFIER id-pkcs1-sha512WithRSAEncryption ::= { iso(1) member-body(2) us(840) rsadsi(113549) pkcs(1) label-less(1) label-less(13) } */\nconst heim_oid *oid_id_pkcs1_sha512WithRSAEncryption(void);\n\n/* OBJECT IDENTIFIER id-heim-rsa-pkcs1-x509 ::= { label-less(1) label-less(2) label-less(752) label-less(43) label-less(16) label-less(1) } */\nconst heim_oid *oid_id_heim_rsa_pkcs1_x509(void);\n\n/* OBJECT IDENTIFIER id-pkcs-2 ::= { iso(1) member-body(2) us(840) rsadsi(113549) pkcs(1) label-less(2) } */\nconst heim_oid *oid_id_pkcs_2(void);\n\n/* OBJECT IDENTIFIER id-pkcs2-md2 ::= { iso(1) member-body(2) us(840) rsadsi(113549) pkcs(1) label-less(2) label-less(2) } */\nconst heim_oid *oid_id_pkcs2_md2(void);\n\n/* OBJECT IDENTIFIER id-pkcs2-md4 ::= { iso(1) member-body(2) us(840) rsadsi(113549) pkcs(1) label-less(2) label-less(4) } */\nconst heim_oid *oid_id_pkcs2_md4(void);\n\n/* OBJECT IDENTIFIER id-pkcs2-md5 ::= { iso(1) member-body(2) us(840) rsadsi(113549) pkcs(1) label-less(2) label-less(5) } */\nconst heim_oid *oid_id_pkcs2_md5(void);\n\n/* OBJECT IDENTIFIER id-rsa-digestAlgorithm ::= { iso(1) member-body(2) us(840) rsadsi(113549) label-less(2) } */\nconst heim_oid *oid_id_rsa_digestAlgorithm(void);\n\n/* OBJECT IDENTIFIER id-rsa-digest-md2 ::= { iso(1) member-body(2) us(840) rsadsi(113549) label-less(2) label-less(2) } */\nconst heim_oid *oid_id_rsa_digest_md2(void);\n\n/* OBJECT IDENTIFIER id-rsa-digest-md4 ::= { iso(1) member-body(2) us(840) rsadsi(113549) label-less(2) label-less(4) } */\nconst heim_oid *oid_id_rsa_digest_md4(void);\n\n/* OBJECT IDENTIFIER id-rsa-digest-md5 ::= { iso(1) member-body(2) us(840) rsadsi(113549) label-less(2) label-less(5) } */\nconst heim_oid *oid_id_rsa_digest_md5(void);\n\n/* OBJECT IDENTIFIER id-pkcs-3 ::= { iso(1) member-body(2) us(840) rsadsi(113549) pkcs(1) label-less(3) } */\nconst heim_oid *oid_id_pkcs_3(void);\n\n/* OBJECT IDENTIFIER id-pkcs3-rc2-cbc ::= { iso(1) member-body(2) us(840) rsadsi(113549) pkcs(1) label-less(3) label-less(2) } */\nconst heim_oid *oid_id_pkcs3_rc2_cbc(void);\n\n/* OBJECT IDENTIFIER id-pkcs3-rc4 ::= { iso(1) member-body(2) us(840) rsadsi(113549) pkcs(1) label-less(3) label-less(4) } */\nconst heim_oid *oid_id_pkcs3_rc4(void);\n\n/* OBJECT IDENTIFIER id-pkcs3-des-ede3-cbc ::= { iso(1) member-body(2) us(840) rsadsi(113549) pkcs(1) label-less(3) label-less(7) } */\nconst heim_oid *oid_id_pkcs3_des_ede3_cbc(void);\n\n/* OBJECT IDENTIFIER id-rsadsi-encalg ::= { iso(1) member-body(2) us(840) rsadsi(113549) label-less(3) } */\nconst heim_oid *oid_id_rsadsi_encalg(void);\n\n/* OBJECT IDENTIFIER id-rsadsi-rc2-cbc ::= { iso(1) member-body(2) us(840) rsadsi(113549) label-less(3) label-less(2) } */\nconst heim_oid *oid_id_rsadsi_rc2_cbc(void);\n\n/* OBJECT IDENTIFIER id-rsadsi-des-ede3-cbc ::= { iso(1) member-body(2) us(840) rsadsi(113549) label-less(3) label-less(7) } */\nconst heim_oid *oid_id_rsadsi_des_ede3_cbc(void);\n\n/* OBJECT IDENTIFIER id-secsig-sha-1 ::= { iso(1) identified-organization(3) oiw(14) secsig(3) algorithm(2) label-less(26) } */\nconst heim_oid *oid_id_secsig_sha_1(void);\n\n/* OBJECT IDENTIFIER id-nistAlgorithm ::= { joint-iso-itu-t(2) country(16) us(840) organization(1) gov(101) csor(3) label-less(4) } */\nconst heim_oid *oid_id_nistAlgorithm(void);\n\n/* OBJECT IDENTIFIER id-nist-aes-algs ::= { joint-iso-itu-t(2) country(16) us(840) organization(1) gov(101) csor(3) label-less(4) label-less(1) } */\nconst heim_oid *oid_id_nist_aes_algs(void);\n\n/* OBJECT IDENTIFIER id-aes-128-cbc ::= { joint-iso-itu-t(2) country(16) us(840) organization(1) gov(101) csor(3) label-less(4) label-less(1) label-less(2) } */\nconst heim_oid *oid_id_aes_128_cbc(void);\n\n/* OBJECT IDENTIFIER id-aes-192-cbc ::= { joint-iso-itu-t(2) country(16) us(840) organization(1) gov(101) csor(3) label-less(4) label-less(1) label-less(22) } */\nconst heim_oid *oid_id_aes_192_cbc(void);\n\n/* OBJECT IDENTIFIER id-aes-256-cbc ::= { joint-iso-itu-t(2) country(16) us(840) organization(1) gov(101) csor(3) label-less(4) label-less(1) label-less(42) } */\nconst heim_oid *oid_id_aes_256_cbc(void);\n\n/* OBJECT IDENTIFIER id-nist-sha-algs ::= { joint-iso-itu-t(2) country(16) us(840) organization(1) gov(101) csor(3) label-less(4) label-less(2) } */\nconst heim_oid *oid_id_nist_sha_algs(void);\n\n/* OBJECT IDENTIFIER id-sha256 ::= { joint-iso-itu-t(2) country(16) us(840) organization(1) gov(101) csor(3) label-less(4) label-less(2) label-less(1) } */\nconst heim_oid *oid_id_sha256(void);\n\n/* OBJECT IDENTIFIER id-sha224 ::= { joint-iso-itu-t(2) country(16) us(840) organization(1) gov(101) csor(3) label-less(4) label-less(2) label-less(4) } */\nconst heim_oid *oid_id_sha224(void);\n\n/* OBJECT IDENTIFIER id-sha384 ::= { joint-iso-itu-t(2) country(16) us(840) organization(1) gov(101) csor(3) label-less(4) label-less(2) label-less(2) } */\nconst heim_oid *oid_id_sha384(void);\n\n/* OBJECT IDENTIFIER id-sha512 ::= { joint-iso-itu-t(2) country(16) us(840) organization(1) gov(101) csor(3) label-less(4) label-less(2) label-less(3) } */\nconst heim_oid *oid_id_sha512(void);\n\n/* OBJECT IDENTIFIER id-dhpublicnumber ::= { iso(1) member-body(2) us(840) ansi-x942(10046) number-type(2) label-less(1) } */\nconst heim_oid *oid_id_dhpublicnumber(void);\n\n/* OBJECT IDENTIFIER id-x9-57 ::= { iso(1) member-body(2) us(840) ansi-x942(10046) label-less(4) } */\nconst heim_oid *oid_id_x9_57(void);\n\n/* OBJECT IDENTIFIER id-dsa ::= { iso(1) member-body(2) us(840) ansi-x942(10046) label-less(4) label-less(1) } */\nconst heim_oid *oid_id_dsa(void);\n\n/* OBJECT IDENTIFIER id-dsa-with-sha1 ::= { iso(1) member-body(2) us(840) ansi-x942(10046) label-less(4) label-less(3) } */\nconst heim_oid *oid_id_dsa_with_sha1(void);\n\n/* OBJECT IDENTIFIER id-x520-at ::= { joint-iso-ccitt(2) ds(5) label-less(4) } */\nconst heim_oid *oid_id_x520_at(void);\n\n/* OBJECT IDENTIFIER id-at-commonName ::= { joint-iso-ccitt(2) ds(5) label-less(4) label-less(3) } */\nconst heim_oid *oid_id_at_commonName(void);\n\n/* OBJECT IDENTIFIER id-at-surname ::= { joint-iso-ccitt(2) ds(5) label-less(4) label-less(4) } */\nconst heim_oid *oid_id_at_surname(void);\n\n/* OBJECT IDENTIFIER id-at-serialNumber ::= { joint-iso-ccitt(2) ds(5) label-less(4) label-less(5) } */\nconst heim_oid *oid_id_at_serialNumber(void);\n\n/* OBJECT IDENTIFIER id-at-countryName ::= { joint-iso-ccitt(2) ds(5) label-less(4) label-less(6) } */\nconst heim_oid *oid_id_at_countryName(void);\n\n/* OBJECT IDENTIFIER id-at-localityName ::= { joint-iso-ccitt(2) ds(5) label-less(4) label-less(7) } */\nconst heim_oid *oid_id_at_localityName(void);\n\n/* OBJECT IDENTIFIER id-at-stateOrProvinceName ::= { joint-iso-ccitt(2) ds(5) label-less(4) label-less(8) } */\nconst heim_oid *oid_id_at_stateOrProvinceName(void);\n\n/* OBJECT IDENTIFIER id-at-streetAddress ::= { joint-iso-ccitt(2) ds(5) label-less(4) label-less(9) } */\nconst heim_oid *oid_id_at_streetAddress(void);\n\n/* OBJECT IDENTIFIER id-at-organizationName ::= { joint-iso-ccitt(2) ds(5) label-less(4) label-less(10) } */\nconst heim_oid *oid_id_at_organizationName(void);\n\n/* OBJECT IDENTIFIER id-at-organizationalUnitName ::= { joint-iso-ccitt(2) ds(5) label-less(4) label-less(11) } */\nconst heim_oid *oid_id_at_organizationalUnitName(void);\n\n/* OBJECT IDENTIFIER id-at-name ::= { joint-iso-ccitt(2) ds(5) label-less(4) label-less(41) } */\nconst heim_oid *oid_id_at_name(void);\n\n/* OBJECT IDENTIFIER id-at-givenName ::= { joint-iso-ccitt(2) ds(5) label-less(4) label-less(42) } */\nconst heim_oid *oid_id_at_givenName(void);\n\n/* OBJECT IDENTIFIER id-at-initials ::= { joint-iso-ccitt(2) ds(5) label-less(4) label-less(43) } */\nconst heim_oid *oid_id_at_initials(void);\n\n/* OBJECT IDENTIFIER id-at-generationQualifier ::= { joint-iso-ccitt(2) ds(5) label-less(4) label-less(44) } */\nconst heim_oid *oid_id_at_generationQualifier(void);\n\n/* OBJECT IDENTIFIER id-at-pseudonym ::= { joint-iso-ccitt(2) ds(5) label-less(4) label-less(65) } */\nconst heim_oid *oid_id_at_pseudonym(void);\n\n/* OBJECT IDENTIFIER id-Userid ::= { label-less(0) label-less(9) label-less(2342) label-less(19200300) label-less(100) label-less(1) label-less(1) } */\nconst heim_oid *oid_id_Userid(void);\n\n/* OBJECT IDENTIFIER id-domainComponent ::= { label-less(0) label-less(9) label-less(2342) label-less(19200300) label-less(100) label-less(1) label-less(25) } */\nconst heim_oid *oid_id_domainComponent(void);\n\n/* OBJECT IDENTIFIER id-x509-ce ::= { joint-iso-ccitt(2) ds(5) label-less(29) } */\nconst heim_oid *oid_id_x509_ce(void);\n\n/*\nAlgorithmIdentifier ::= SEQUENCE {\n  algorithm         OBJECT IDENTIFIER,\n  parameters      heim_any OPTIONAL,\n}\n*/\n\ntypedef struct AlgorithmIdentifier {\n  heim_oid algorithm;\n  heim_any *parameters;\n} AlgorithmIdentifier;\n\nint    encode_AlgorithmIdentifier(unsigned char *, size_t, const AlgorithmIdentifier *, size_t *);\nint    decode_AlgorithmIdentifier(const unsigned char *, size_t, AlgorithmIdentifier *, size_t *);\nvoid   free_AlgorithmIdentifier  (AlgorithmIdentifier *);\nsize_t length_AlgorithmIdentifier(const AlgorithmIdentifier *);\nint    copy_AlgorithmIdentifier  (const AlgorithmIdentifier *, AlgorithmIdentifier *);\n\n\n/*\nAttributeType ::= OBJECT IDENTIFIER\n*/\n\ntypedef heim_oid AttributeType;\n\nint    encode_AttributeType(unsigned char *, size_t, const AttributeType *, size_t *);\nint    decode_AttributeType(const unsigned char *, size_t, AttributeType *, size_t *);\nvoid   free_AttributeType  (AttributeType *);\nsize_t length_AttributeType(const AttributeType *);\nint    copy_AttributeType  (const AttributeType *, AttributeType *);\n\n\n/*\nAttributeValue ::= heim_any\n*/\n\ntypedef heim_any AttributeValue;\n\nint    encode_AttributeValue(unsigned char *, size_t, const AttributeValue *, size_t *);\nint    decode_AttributeValue(const unsigned char *, size_t, AttributeValue *, size_t *);\nvoid   free_AttributeValue  (AttributeValue *);\nsize_t length_AttributeValue(const AttributeValue *);\nint    copy_AttributeValue  (const AttributeValue *, AttributeValue *);\n\n\n/*\nTeletexStringx ::= IMPLICIT OCTET STRING\n*/\n\ntypedef heim_octet_string TeletexStringx;\n\nint    encode_TeletexStringx(unsigned char *, size_t, const TeletexStringx *, size_t *);\nint    decode_TeletexStringx(const unsigned char *, size_t, TeletexStringx *, size_t *);\nvoid   free_TeletexStringx  (TeletexStringx *);\nsize_t length_TeletexStringx(const TeletexStringx *);\nint    copy_TeletexStringx  (const TeletexStringx *, TeletexStringx *);\n\n\n/*\nDirectoryString ::= CHOICE {\n  ia5String           IA5String,\n  teletexString     TeletexStringx,\n  printableString     PrintableString,\n  universalString     UniversalString,\n  utf8String          UTF8String,\n  bmpString           BMPString,\n}\n*/\n\ntypedef struct DirectoryString {\n  enum {\n    choice_DirectoryString_ia5String = 1,\n    choice_DirectoryString_teletexString,\n    choice_DirectoryString_printableString,\n    choice_DirectoryString_universalString,\n    choice_DirectoryString_utf8String,\n    choice_DirectoryString_bmpString\n  } element;\n  union {\n    heim_ia5_string ia5String;\n    TeletexStringx teletexString;\n    heim_printable_string printableString;\n    heim_universal_string universalString;\n    heim_utf8_string utf8String;\n    heim_bmp_string bmpString;\n  } u;\n} DirectoryString;\n\nint    encode_DirectoryString(unsigned char *, size_t, const DirectoryString *, size_t *);\nint    decode_DirectoryString(const unsigned char *, size_t, DirectoryString *, size_t *);\nvoid   free_DirectoryString  (DirectoryString *);\nsize_t length_DirectoryString(const DirectoryString *);\nint    copy_DirectoryString  (const DirectoryString *, DirectoryString *);\n\n\n/*\nAttribute ::= SEQUENCE {\n  type            AttributeType,\n  value           SET OF heim_any,\n}\n*/\n\ntypedef struct Attribute {\n  AttributeType type;\n  struct  {\n    unsigned int len;\n    heim_any *val;\n  } value;\n} Attribute;\n\nint    encode_Attribute(unsigned char *, size_t, const Attribute *, size_t *);\nint    decode_Attribute(const unsigned char *, size_t, Attribute *, size_t *);\nvoid   free_Attribute  (Attribute *);\nsize_t length_Attribute(const Attribute *);\nint    copy_Attribute  (const Attribute *, Attribute *);\n\n\n/*\nAttributeTypeAndValue ::= SEQUENCE {\n  type            AttributeType,\n  value           DirectoryString,\n}\n*/\n\ntypedef struct AttributeTypeAndValue {\n  AttributeType type;\n  DirectoryString value;\n} AttributeTypeAndValue;\n\nint    encode_AttributeTypeAndValue(unsigned char *, size_t, const AttributeTypeAndValue *, size_t *);\nint    decode_AttributeTypeAndValue(const unsigned char *, size_t, AttributeTypeAndValue *, size_t *);\nvoid   free_AttributeTypeAndValue  (AttributeTypeAndValue *);\nsize_t length_AttributeTypeAndValue(const AttributeTypeAndValue *);\nint    copy_AttributeTypeAndValue  (const AttributeTypeAndValue *, AttributeTypeAndValue *);\n\n\n/*\nRelativeDistinguishedName ::= SET OF AttributeTypeAndValue\n*/\n\ntypedef struct RelativeDistinguishedName {\n  unsigned int len;\n  AttributeTypeAndValue *val;\n} RelativeDistinguishedName;\n\nint    encode_RelativeDistinguishedName(unsigned char *, size_t, const RelativeDistinguishedName *, size_t *);\nint    decode_RelativeDistinguishedName(const unsigned char *, size_t, RelativeDistinguishedName *, size_t *);\nvoid   free_RelativeDistinguishedName  (RelativeDistinguishedName *);\nsize_t length_RelativeDistinguishedName(const RelativeDistinguishedName *);\nint    copy_RelativeDistinguishedName  (const RelativeDistinguishedName *, RelativeDistinguishedName *);\n\n\n/*\nRDNSequence ::= SEQUENCE OF RelativeDistinguishedName\n*/\n\ntypedef struct RDNSequence {\n  unsigned int len;\n  RelativeDistinguishedName *val;\n} RDNSequence;\n\nint    encode_RDNSequence(unsigned char *, size_t, const RDNSequence *, size_t *);\nint    decode_RDNSequence(const unsigned char *, size_t, RDNSequence *, size_t *);\nvoid   free_RDNSequence  (RDNSequence *);\nsize_t length_RDNSequence(const RDNSequence *);\nint    copy_RDNSequence  (const RDNSequence *, RDNSequence *);\n\n\n/*\nName ::= CHOICE {\n  rdnSequence     RDNSequence,\n}\n*/\n\ntypedef struct Name {\n  heim_octet_string _save;\n  enum {\n    choice_Name_rdnSequence = 1\n  } element;\n  union {\n    RDNSequence rdnSequence;\n  } u;\n} Name;\n\nint    encode_Name(unsigned char *, size_t, const Name *, size_t *);\nint    decode_Name(const unsigned char *, size_t, Name *, size_t *);\nvoid   free_Name  (Name *);\nsize_t length_Name(const Name *);\nint    copy_Name  (const Name *, Name *);\n\n\n/*\nCertificateSerialNumber ::= INTEGER\n*/\n\ntypedef heim_integer CertificateSerialNumber;\n\nint    encode_CertificateSerialNumber(unsigned char *, size_t, const CertificateSerialNumber *, size_t *);\nint    decode_CertificateSerialNumber(const unsigned char *, size_t, CertificateSerialNumber *, size_t *);\nvoid   free_CertificateSerialNumber  (CertificateSerialNumber *);\nsize_t length_CertificateSerialNumber(const CertificateSerialNumber *);\nint    copy_CertificateSerialNumber  (const CertificateSerialNumber *, CertificateSerialNumber *);\n\n\n/*\nTime ::= CHOICE {\n  utcTime         UTCTime,\n  generalTime     GeneralizedTime,\n}\n*/\n\ntypedef struct Time {\n  enum {\n    choice_Time_utcTime = 1,\n    choice_Time_generalTime\n  } element;\n  union {\n    time_t utcTime;\n    time_t generalTime;\n  } u;\n} Time;\n\nint    encode_Time(unsigned char *, size_t, const Time *, size_t *);\nint    decode_Time(const unsigned char *, size_t, Time *, size_t *);\nvoid   free_Time  (Time *);\nsize_t length_Time(const Time *);\nint    copy_Time  (const Time *, Time *);\n\n\n/*\nValidity ::= SEQUENCE {\n  notBefore       Time,\n  notAfter        Time,\n}\n*/\n\ntypedef struct Validity {\n  Time notBefore;\n  Time notAfter;\n} Validity;\n\nint    encode_Validity(unsigned char *, size_t, const Validity *, size_t *);\nint    decode_Validity(const unsigned char *, size_t, Validity *, size_t *);\nvoid   free_Validity  (Validity *);\nsize_t length_Validity(const Validity *);\nint    copy_Validity  (const Validity *, Validity *);\n\n\n/*\nUniqueIdentifier ::= BIT STRING {\n}\n*/\n\ntypedef heim_bit_string UniqueIdentifier;\n\nint    encode_UniqueIdentifier(unsigned char *, size_t, const UniqueIdentifier *, size_t *);\nint    decode_UniqueIdentifier(const unsigned char *, size_t, UniqueIdentifier *, size_t *);\nvoid   free_UniqueIdentifier  (UniqueIdentifier *);\nsize_t length_UniqueIdentifier(const UniqueIdentifier *);\nint    copy_UniqueIdentifier  (const UniqueIdentifier *, UniqueIdentifier *);\n\n\n/*\nSubjectPublicKeyInfo ::= SEQUENCE {\n  algorithm          AlgorithmIdentifier,\n  subjectPublicKey     BIT STRING {\n  },\n}\n*/\n\ntypedef struct SubjectPublicKeyInfo {\n  AlgorithmIdentifier algorithm;\n  heim_bit_string subjectPublicKey;\n} SubjectPublicKeyInfo;\n\nint    encode_SubjectPublicKeyInfo(unsigned char *, size_t, const SubjectPublicKeyInfo *, size_t *);\nint    decode_SubjectPublicKeyInfo(const unsigned char *, size_t, SubjectPublicKeyInfo *, size_t *);\nvoid   free_SubjectPublicKeyInfo  (SubjectPublicKeyInfo *);\nsize_t length_SubjectPublicKeyInfo(const SubjectPublicKeyInfo *);\nint    copy_SubjectPublicKeyInfo  (const SubjectPublicKeyInfo *, SubjectPublicKeyInfo *);\n\n\n/*\nExtension ::= SEQUENCE {\n  extnID            OBJECT IDENTIFIER,\n  critical        BOOLEAN OPTIONAL,\n  extnValue       OCTET STRING,\n}\n*/\n\ntypedef struct Extension {\n  heim_oid extnID;\n  int *critical;\n  heim_octet_string extnValue;\n} Extension;\n\nint    encode_Extension(unsigned char *, size_t, const Extension *, size_t *);\nint    decode_Extension(const unsigned char *, size_t, Extension *, size_t *);\nvoid   free_Extension  (Extension *);\nsize_t length_Extension(const Extension *);\nint    copy_Extension  (const Extension *, Extension *);\n\n\n/*\nExtensions ::= SEQUENCE OF Extension\n*/\n\ntypedef struct Extensions {\n  unsigned int len;\n  Extension *val;\n} Extensions;\n\nint    encode_Extensions(unsigned char *, size_t, const Extensions *, size_t *);\nint    decode_Extensions(const unsigned char *, size_t, Extensions *, size_t *);\nvoid   free_Extensions  (Extensions *);\nsize_t length_Extensions(const Extensions *);\nint    copy_Extensions  (const Extensions *, Extensions *);\nint   add_Extensions  (Extensions *, const Extension *);\nint   remove_Extensions  (Extensions *, unsigned int);\n\n\n/*\nTBSCertificate ::= SEQUENCE {\n  version                [0] Version OPTIONAL,\n  serialNumber           CertificateSerialNumber,\n  signature              AlgorithmIdentifier,\n  issuer                 Name,\n  validity               Validity,\n  subject                Name,\n  subjectPublicKeyInfo   SubjectPublicKeyInfo,\n  issuerUniqueID         [1] IMPLICIT   BIT STRING {\n  } OPTIONAL,\n  subjectUniqueID        [2] IMPLICIT   BIT STRING {\n  } OPTIONAL,\n  extensions             [3] Extensions OPTIONAL,\n}\n*/\n\ntypedef struct TBSCertificate {\n  heim_octet_string _save;\n  Version *version;\n  CertificateSerialNumber serialNumber;\n  AlgorithmIdentifier signature;\n  Name issuer;\n  Validity validity;\n  Name subject;\n  SubjectPublicKeyInfo subjectPublicKeyInfo;\n  heim_bit_string *issuerUniqueID;\n  heim_bit_string *subjectUniqueID;\n  Extensions *extensions;\n} TBSCertificate;\n\nint    encode_TBSCertificate(unsigned char *, size_t, const TBSCertificate *, size_t *);\nint    decode_TBSCertificate(const unsigned char *, size_t, TBSCertificate *, size_t *);\nvoid   free_TBSCertificate  (TBSCertificate *);\nsize_t length_TBSCertificate(const TBSCertificate *);\nint    copy_TBSCertificate  (const TBSCertificate *, TBSCertificate *);\n\n\n/*\nCertificate ::= SEQUENCE {\n  tbsCertificate       TBSCertificate,\n  signatureAlgorithm   AlgorithmIdentifier,\n  signatureValue         BIT STRING {\n  },\n}\n*/\n\ntypedef struct Certificate {\n  TBSCertificate tbsCertificate;\n  AlgorithmIdentifier signatureAlgorithm;\n  heim_bit_string signatureValue;\n} Certificate;\n\nint    encode_Certificate(unsigned char *, size_t, const Certificate *, size_t *);\nint    decode_Certificate(const unsigned char *, size_t, Certificate *, size_t *);\nvoid   free_Certificate  (Certificate *);\nsize_t length_Certificate(const Certificate *);\nint    copy_Certificate  (const Certificate *, Certificate *);\n\n\n/*\nCertificates ::= SEQUENCE OF Certificate\n*/\n\ntypedef struct Certificates {\n  unsigned int len;\n  Certificate *val;\n} Certificates;\n\nint    encode_Certificates(unsigned char *, size_t, const Certificates *, size_t *);\nint    decode_Certificates(const unsigned char *, size_t, Certificates *, size_t *);\nvoid   free_Certificates  (Certificates *);\nsize_t length_Certificates(const Certificates *);\nint    copy_Certificates  (const Certificates *, Certificates *);\n\n\n/*\nValidationParms ::= SEQUENCE {\n  seed              BIT STRING {\n  },\n  pgenCounter     INTEGER,\n}\n*/\n\ntypedef struct ValidationParms {\n  heim_bit_string seed;\n  heim_integer pgenCounter;\n} ValidationParms;\n\nint    encode_ValidationParms(unsigned char *, size_t, const ValidationParms *, size_t *);\nint    decode_ValidationParms(const unsigned char *, size_t, ValidationParms *, size_t *);\nvoid   free_ValidationParms  (ValidationParms *);\nsize_t length_ValidationParms(const ValidationParms *);\nint    copy_ValidationParms  (const ValidationParms *, ValidationParms *);\n\n\n/*\nDomainParameters ::= SEQUENCE {\n  p                 INTEGER,\n  g                 INTEGER,\n  q                 INTEGER,\n  j                 INTEGER OPTIONAL,\n  validationParms   ValidationParms OPTIONAL,\n}\n*/\n\ntypedef struct DomainParameters {\n  heim_integer p;\n  heim_integer g;\n  heim_integer q;\n  heim_integer *j;\n  ValidationParms *validationParms;\n} DomainParameters;\n\nint    encode_DomainParameters(unsigned char *, size_t, const DomainParameters *, size_t *);\nint    decode_DomainParameters(const unsigned char *, size_t, DomainParameters *, size_t *);\nvoid   free_DomainParameters  (DomainParameters *);\nsize_t length_DomainParameters(const DomainParameters *);\nint    copy_DomainParameters  (const DomainParameters *, DomainParameters *);\n\n\n/*\nDHPublicKey ::= INTEGER\n*/\n\ntypedef heim_integer DHPublicKey;\n\nint    encode_DHPublicKey(unsigned char *, size_t, const DHPublicKey *, size_t *);\nint    decode_DHPublicKey(const unsigned char *, size_t, DHPublicKey *, size_t *);\nvoid   free_DHPublicKey  (DHPublicKey *);\nsize_t length_DHPublicKey(const DHPublicKey *);\nint    copy_DHPublicKey  (const DHPublicKey *, DHPublicKey *);\n\n\n/*\nOtherName ::= SEQUENCE {\n  type-id           OBJECT IDENTIFIER,\n  value           [0] heim_any,\n}\n*/\n\ntypedef struct OtherName {\n  heim_oid type_id;\n  heim_any value;\n} OtherName;\n\nint    encode_OtherName(unsigned char *, size_t, const OtherName *, size_t *);\nint    decode_OtherName(const unsigned char *, size_t, OtherName *, size_t *);\nvoid   free_OtherName  (OtherName *);\nsize_t length_OtherName(const OtherName *);\nint    copy_OtherName  (const OtherName *, OtherName *);\n\n\n/*\nGeneralName ::= CHOICE {\n  otherName                   [0] IMPLICIT SEQUENCE {\n    type-id             OBJECT IDENTIFIER,\n    value           [0] heim_any,\n  },\n  rfc822Name                  [1] IMPLICIT   IA5String,\n  dNSName                     [2] IMPLICIT   IA5String,\n  directoryName               [4] IMPLICIT CHOICE {\n    rdnSequence     RDNSequence,\n  },\n  uniformResourceIdentifier   [6] IMPLICIT   IA5String,\n  iPAddress                   [7] IMPLICIT OCTET STRING,\n  registeredID                [8] IMPLICIT   OBJECT IDENTIFIER,\n}\n*/\n\ntypedef struct GeneralName {\n  enum {\n    choice_GeneralName_otherName = 1,\n    choice_GeneralName_rfc822Name,\n    choice_GeneralName_dNSName,\n    choice_GeneralName_directoryName,\n    choice_GeneralName_uniformResourceIdentifier,\n    choice_GeneralName_iPAddress,\n    choice_GeneralName_registeredID\n  } element;\n  union {\n    struct  {\n      heim_oid type_id;\n      heim_any value;\n    } otherName;\n    heim_ia5_string rfc822Name;\n    heim_ia5_string dNSName;\n    struct  {\n      enum {\n        choice_GeneralName_directoryName_rdnSequence = 1\n      } element;\n      union {\n        RDNSequence rdnSequence;\n      } u;\n    } directoryName;\n    heim_ia5_string uniformResourceIdentifier;\n    heim_octet_string iPAddress;\n    heim_oid registeredID;\n  } u;\n} GeneralName;\n\nint    encode_GeneralName(unsigned char *, size_t, const GeneralName *, size_t *);\nint    decode_GeneralName(const unsigned char *, size_t, GeneralName *, size_t *);\nvoid   free_GeneralName  (GeneralName *);\nsize_t length_GeneralName(const GeneralName *);\nint    copy_GeneralName  (const GeneralName *, GeneralName *);\n\n\n/*\nGeneralNames ::= SEQUENCE OF GeneralName\n*/\n\ntypedef struct GeneralNames {\n  unsigned int len;\n  GeneralName *val;\n} GeneralNames;\n\nint    encode_GeneralNames(unsigned char *, size_t, const GeneralNames *, size_t *);\nint    decode_GeneralNames(const unsigned char *, size_t, GeneralNames *, size_t *);\nvoid   free_GeneralNames  (GeneralNames *);\nsize_t length_GeneralNames(const GeneralNames *);\nint    copy_GeneralNames  (const GeneralNames *, GeneralNames *);\nint   add_GeneralNames  (GeneralNames *, const GeneralName *);\nint   remove_GeneralNames  (GeneralNames *, unsigned int);\n\n\n/* OBJECT IDENTIFIER id-x509-ce-keyUsage ::= { joint-iso-ccitt(2) ds(5) label-less(29) label-less(15) } */\nconst heim_oid *oid_id_x509_ce_keyUsage(void);\n\n/*\nKeyUsage ::= BIT STRING {\n  digitalSignature(0),\n  nonRepudiation(1),\n  keyEncipherment(2),\n  dataEncipherment(3),\n  keyAgreement(4),\n  keyCertSign(5),\n  cRLSign(6),\n  encipherOnly(7),\n  decipherOnly(8)\n}\n*/\n\ntypedef struct KeyUsage {\n  unsigned int digitalSignature:1;\n  unsigned int nonRepudiation:1;\n  unsigned int keyEncipherment:1;\n  unsigned int dataEncipherment:1;\n  unsigned int keyAgreement:1;\n  unsigned int keyCertSign:1;\n  unsigned int cRLSign:1;\n  unsigned int encipherOnly:1;\n  unsigned int decipherOnly:1;\n} KeyUsage;\n\n\nint    encode_KeyUsage(unsigned char *, size_t, const KeyUsage *, size_t *);\nint    decode_KeyUsage(const unsigned char *, size_t, KeyUsage *, size_t *);\nvoid   free_KeyUsage  (KeyUsage *);\nsize_t length_KeyUsage(const KeyUsage *);\nint    copy_KeyUsage  (const KeyUsage *, KeyUsage *);\nunsigned KeyUsage2int(KeyUsage);\nKeyUsage int2KeyUsage(unsigned);\n#ifdef __PARSE_UNITS_H__\nconst struct units * asn1_KeyUsage_units(void);\n#endif\n\n\n/* OBJECT IDENTIFIER id-x509-ce-authorityKeyIdentifier ::= { joint-iso-ccitt(2) ds(5) label-less(29) label-less(35) } */\nconst heim_oid *oid_id_x509_ce_authorityKeyIdentifier(void);\n\n/*\nKeyIdentifier ::= OCTET STRING\n*/\n\ntypedef heim_octet_string KeyIdentifier;\n\nint    encode_KeyIdentifier(unsigned char *, size_t, const KeyIdentifier *, size_t *);\nint    decode_KeyIdentifier(const unsigned char *, size_t, KeyIdentifier *, size_t *);\nvoid   free_KeyIdentifier  (KeyIdentifier *);\nsize_t length_KeyIdentifier(const KeyIdentifier *);\nint    copy_KeyIdentifier  (const KeyIdentifier *, KeyIdentifier *);\n\n\n/*\nAuthorityKeyIdentifier ::= SEQUENCE {\n  keyIdentifier               [0] IMPLICIT OCTET STRING OPTIONAL,\n  authorityCertIssuer         [1] IMPLICIT SEQUENCE OF GeneralName OPTIONAL,\n  authorityCertSerialNumber   [2] IMPLICIT INTEGER OPTIONAL,\n}\n*/\n\ntypedef struct AuthorityKeyIdentifier {\n  heim_octet_string *keyIdentifier;\n  struct  {\n    unsigned int len;\n    GeneralName *val;\n  } *authorityCertIssuer;\n  heim_integer *authorityCertSerialNumber;\n} AuthorityKeyIdentifier;\n\nint    encode_AuthorityKeyIdentifier(unsigned char *, size_t, const AuthorityKeyIdentifier *, size_t *);\nint    decode_AuthorityKeyIdentifier(const unsigned char *, size_t, AuthorityKeyIdentifier *, size_t *);\nvoid   free_AuthorityKeyIdentifier  (AuthorityKeyIdentifier *);\nsize_t length_AuthorityKeyIdentifier(const AuthorityKeyIdentifier *);\nint    copy_AuthorityKeyIdentifier  (const AuthorityKeyIdentifier *, AuthorityKeyIdentifier *);\n\n\n/* OBJECT IDENTIFIER id-x509-ce-subjectKeyIdentifier ::= { joint-iso-ccitt(2) ds(5) label-less(29) label-less(14) } */\nconst heim_oid *oid_id_x509_ce_subjectKeyIdentifier(void);\n\n/*\nSubjectKeyIdentifier ::= KeyIdentifier\n*/\n\ntypedef KeyIdentifier SubjectKeyIdentifier;\n\nint    encode_SubjectKeyIdentifier(unsigned char *, size_t, const SubjectKeyIdentifier *, size_t *);\nint    decode_SubjectKeyIdentifier(const unsigned char *, size_t, SubjectKeyIdentifier *, size_t *);\nvoid   free_SubjectKeyIdentifier  (SubjectKeyIdentifier *);\nsize_t length_SubjectKeyIdentifier(const SubjectKeyIdentifier *);\nint    copy_SubjectKeyIdentifier  (const SubjectKeyIdentifier *, SubjectKeyIdentifier *);\n\n\n/* OBJECT IDENTIFIER id-x509-ce-basicConstraints ::= { joint-iso-ccitt(2) ds(5) label-less(29) label-less(19) } */\nconst heim_oid *oid_id_x509_ce_basicConstraints(void);\n\n/*\nBasicConstraints ::= SEQUENCE {\n  cA                  BOOLEAN OPTIONAL,\n  pathLenConstraint   INTEGER (0..-1) OPTIONAL,\n}\n*/\n\ntypedef struct BasicConstraints {\n  int *cA;\n  unsigned int *pathLenConstraint;\n} BasicConstraints;\n\nint    encode_BasicConstraints(unsigned char *, size_t, const BasicConstraints *, size_t *);\nint    decode_BasicConstraints(const unsigned char *, size_t, BasicConstraints *, size_t *);\nvoid   free_BasicConstraints  (BasicConstraints *);\nsize_t length_BasicConstraints(const BasicConstraints *);\nint    copy_BasicConstraints  (const BasicConstraints *, BasicConstraints *);\n\n\n/* OBJECT IDENTIFIER id-x509-ce-nameConstraints ::= { joint-iso-ccitt(2) ds(5) label-less(29) label-less(30) } */\nconst heim_oid *oid_id_x509_ce_nameConstraints(void);\n\n/*\nBaseDistance ::= INTEGER\n*/\n\ntypedef heim_integer BaseDistance;\n\nint    encode_BaseDistance(unsigned char *, size_t, const BaseDistance *, size_t *);\nint    decode_BaseDistance(const unsigned char *, size_t, BaseDistance *, size_t *);\nvoid   free_BaseDistance  (BaseDistance *);\nsize_t length_BaseDistance(const BaseDistance *);\nint    copy_BaseDistance  (const BaseDistance *, BaseDistance *);\n\n\n/*\nGeneralSubtree ::= SEQUENCE {\n  base            GeneralName,\n  minimum         [0] IMPLICIT INTEGER OPTIONAL,\n  maximum         [1] IMPLICIT INTEGER OPTIONAL,\n}\n*/\n\ntypedef struct GeneralSubtree {\n  GeneralName base;\n  heim_integer *minimum;\n  heim_integer *maximum;\n} GeneralSubtree;\n\nint    encode_GeneralSubtree(unsigned char *, size_t, const GeneralSubtree *, size_t *);\nint    decode_GeneralSubtree(const unsigned char *, size_t, GeneralSubtree *, size_t *);\nvoid   free_GeneralSubtree  (GeneralSubtree *);\nsize_t length_GeneralSubtree(const GeneralSubtree *);\nint    copy_GeneralSubtree  (const GeneralSubtree *, GeneralSubtree *);\n\n\n/*\nGeneralSubtrees ::= SEQUENCE OF GeneralSubtree\n*/\n\ntypedef struct GeneralSubtrees {\n  unsigned int len;\n  GeneralSubtree *val;\n} GeneralSubtrees;\n\nint    encode_GeneralSubtrees(unsigned char *, size_t, const GeneralSubtrees *, size_t *);\nint    decode_GeneralSubtrees(const unsigned char *, size_t, GeneralSubtrees *, size_t *);\nvoid   free_GeneralSubtrees  (GeneralSubtrees *);\nsize_t length_GeneralSubtrees(const GeneralSubtrees *);\nint    copy_GeneralSubtrees  (const GeneralSubtrees *, GeneralSubtrees *);\n\n\n/*\nNameConstraints ::= SEQUENCE {\n  permittedSubtrees   [0] IMPLICIT SEQUENCE OF GeneralSubtree OPTIONAL,\n  excludedSubtrees    [1] IMPLICIT SEQUENCE OF GeneralSubtree OPTIONAL,\n}\n*/\n\ntypedef struct NameConstraints {\n  struct  {\n    unsigned int len;\n    GeneralSubtree *val;\n  } *permittedSubtrees;\n  struct  {\n    unsigned int len;\n    GeneralSubtree *val;\n  } *excludedSubtrees;\n} NameConstraints;\n\nint    encode_NameConstraints(unsigned char *, size_t, const NameConstraints *, size_t *);\nint    decode_NameConstraints(const unsigned char *, size_t, NameConstraints *, size_t *);\nvoid   free_NameConstraints  (NameConstraints *);\nsize_t length_NameConstraints(const NameConstraints *);\nint    copy_NameConstraints  (const NameConstraints *, NameConstraints *);\n\n\n/* OBJECT IDENTIFIER id-x509-ce-privateKeyUsagePeriod ::= { joint-iso-ccitt(2) ds(5) label-less(29) label-less(16) } */\nconst heim_oid *oid_id_x509_ce_privateKeyUsagePeriod(void);\n\n/* OBJECT IDENTIFIER id-x509-ce-certificatePolicies ::= { joint-iso-ccitt(2) ds(5) label-less(29) label-less(32) } */\nconst heim_oid *oid_id_x509_ce_certificatePolicies(void);\n\n/* OBJECT IDENTIFIER id-x509-ce-policyMappings ::= { joint-iso-ccitt(2) ds(5) label-less(29) label-less(33) } */\nconst heim_oid *oid_id_x509_ce_policyMappings(void);\n\n/* OBJECT IDENTIFIER id-x509-ce-subjectAltName ::= { joint-iso-ccitt(2) ds(5) label-less(29) label-less(17) } */\nconst heim_oid *oid_id_x509_ce_subjectAltName(void);\n\n/* OBJECT IDENTIFIER id-x509-ce-issuerAltName ::= { joint-iso-ccitt(2) ds(5) label-less(29) label-less(18) } */\nconst heim_oid *oid_id_x509_ce_issuerAltName(void);\n\n/* OBJECT IDENTIFIER id-x509-ce-subjectDirectoryAttributes ::= { joint-iso-ccitt(2) ds(5) label-less(29) label-less(9) } */\nconst heim_oid *oid_id_x509_ce_subjectDirectoryAttributes(void);\n\n/* OBJECT IDENTIFIER id-x509-ce-policyConstraints ::= { joint-iso-ccitt(2) ds(5) label-less(29) label-less(36) } */\nconst heim_oid *oid_id_x509_ce_policyConstraints(void);\n\n/* OBJECT IDENTIFIER id-x509-ce-extKeyUsage ::= { joint-iso-ccitt(2) ds(5) label-less(29) label-less(37) } */\nconst heim_oid *oid_id_x509_ce_extKeyUsage(void);\n\n/*\nExtKeyUsage ::= SEQUENCE OF OBJECT IDENTIFIER\n*/\n\ntypedef struct ExtKeyUsage {\n  unsigned int len;\n  heim_oid *val;\n} ExtKeyUsage;\n\nint    encode_ExtKeyUsage(unsigned char *, size_t, const ExtKeyUsage *, size_t *);\nint    decode_ExtKeyUsage(const unsigned char *, size_t, ExtKeyUsage *, size_t *);\nvoid   free_ExtKeyUsage  (ExtKeyUsage *);\nsize_t length_ExtKeyUsage(const ExtKeyUsage *);\nint    copy_ExtKeyUsage  (const ExtKeyUsage *, ExtKeyUsage *);\n\n\n/* OBJECT IDENTIFIER id-x509-ce-cRLDistributionPoints ::= { joint-iso-ccitt(2) ds(5) label-less(29) label-less(31) } */\nconst heim_oid *oid_id_x509_ce_cRLDistributionPoints(void);\n\n/* OBJECT IDENTIFIER id-x509-ce-deltaCRLIndicator ::= { joint-iso-ccitt(2) ds(5) label-less(29) label-less(27) } */\nconst heim_oid *oid_id_x509_ce_deltaCRLIndicator(void);\n\n/* OBJECT IDENTIFIER id-x509-ce-issuingDistributionPoint ::= { joint-iso-ccitt(2) ds(5) label-less(29) label-less(28) } */\nconst heim_oid *oid_id_x509_ce_issuingDistributionPoint(void);\n\n/* OBJECT IDENTIFIER id-x509-ce-holdInstructionCode ::= { joint-iso-ccitt(2) ds(5) label-less(29) label-less(23) } */\nconst heim_oid *oid_id_x509_ce_holdInstructionCode(void);\n\n/* OBJECT IDENTIFIER id-x509-ce-invalidityDate ::= { joint-iso-ccitt(2) ds(5) label-less(29) label-less(24) } */\nconst heim_oid *oid_id_x509_ce_invalidityDate(void);\n\n/* OBJECT IDENTIFIER id-x509-ce-certificateIssuer ::= { joint-iso-ccitt(2) ds(5) label-less(29) label-less(29) } */\nconst heim_oid *oid_id_x509_ce_certificateIssuer(void);\n\n/* OBJECT IDENTIFIER id-x509-ce-inhibitAnyPolicy ::= { joint-iso-ccitt(2) ds(5) label-less(29) label-less(54) } */\nconst heim_oid *oid_id_x509_ce_inhibitAnyPolicy(void);\n\n/*\nDistributionPointReasonFlags ::= BIT STRING {\n  unused(0),\n  keyCompromise(1),\n  cACompromise(2),\n  affiliationChanged(3),\n  superseded(4),\n  cessationOfOperation(5),\n  certificateHold(6),\n  privilegeWithdrawn(7),\n  aACompromise(8)\n}\n*/\n\ntypedef struct DistributionPointReasonFlags {\n  unsigned int unused:1;\n  unsigned int keyCompromise:1;\n  unsigned int cACompromise:1;\n  unsigned int affiliationChanged:1;\n  unsigned int superseded:1;\n  unsigned int cessationOfOperation:1;\n  unsigned int certificateHold:1;\n  unsigned int privilegeWithdrawn:1;\n  unsigned int aACompromise:1;\n} DistributionPointReasonFlags;\n\n\nint    encode_DistributionPointReasonFlags(unsigned char *, size_t, const DistributionPointReasonFlags *, size_t *);\nint    decode_DistributionPointReasonFlags(const unsigned char *, size_t, DistributionPointReasonFlags *, size_t *);\nvoid   free_DistributionPointReasonFlags  (DistributionPointReasonFlags *);\nsize_t length_DistributionPointReasonFlags(const DistributionPointReasonFlags *);\nint    copy_DistributionPointReasonFlags  (const DistributionPointReasonFlags *, DistributionPointReasonFlags *);\nunsigned DistributionPointReasonFlags2int(DistributionPointReasonFlags);\nDistributionPointReasonFlags int2DistributionPointReasonFlags(unsigned);\n#ifdef __PARSE_UNITS_H__\nconst struct units * asn1_DistributionPointReasonFlags_units(void);\n#endif\n\n\n/*\nDistributionPointName ::= CHOICE {\n  fullName                  [0] IMPLICIT SEQUENCE OF GeneralName,\n  nameRelativeToCRLIssuer   [1] RelativeDistinguishedName,\n}\n*/\n\ntypedef struct DistributionPointName {\n  enum {\n    choice_DistributionPointName_fullName = 1,\n    choice_DistributionPointName_nameRelativeToCRLIssuer\n  } element;\n  union {\n    struct  {\n      unsigned int len;\n      GeneralName *val;\n    } fullName;\n    RelativeDistinguishedName nameRelativeToCRLIssuer;\n  } u;\n} DistributionPointName;\n\nint    encode_DistributionPointName(unsigned char *, size_t, const DistributionPointName *, size_t *);\nint    decode_DistributionPointName(const unsigned char *, size_t, DistributionPointName *, size_t *);\nvoid   free_DistributionPointName  (DistributionPointName *);\nsize_t length_DistributionPointName(const DistributionPointName *);\nint    copy_DistributionPointName  (const DistributionPointName *, DistributionPointName *);\n\n\n/*\nDistributionPoint ::= SEQUENCE {\n  distributionPoint   [0] IMPLICIT heim_any OPTIONAL,\n  reasons             [1] IMPLICIT heim_any OPTIONAL,\n  cRLIssuer           [2] IMPLICIT heim_any OPTIONAL,\n}\n*/\n\ntypedef struct DistributionPoint {\n  heim_any *distributionPoint;\n  heim_any *reasons;\n  heim_any *cRLIssuer;\n} DistributionPoint;\n\nint    encode_DistributionPoint(unsigned char *, size_t, const DistributionPoint *, size_t *);\nint    decode_DistributionPoint(const unsigned char *, size_t, DistributionPoint *, size_t *);\nvoid   free_DistributionPoint  (DistributionPoint *);\nsize_t length_DistributionPoint(const DistributionPoint *);\nint    copy_DistributionPoint  (const DistributionPoint *, DistributionPoint *);\n\n\n/*\nCRLDistributionPoints ::= SEQUENCE OF DistributionPoint\n*/\n\ntypedef struct CRLDistributionPoints {\n  unsigned int len;\n  DistributionPoint *val;\n} CRLDistributionPoints;\n\nint    encode_CRLDistributionPoints(unsigned char *, size_t, const CRLDistributionPoints *, size_t *);\nint    decode_CRLDistributionPoints(const unsigned char *, size_t, CRLDistributionPoints *, size_t *);\nvoid   free_CRLDistributionPoints  (CRLDistributionPoints *);\nsize_t length_CRLDistributionPoints(const CRLDistributionPoints *);\nint    copy_CRLDistributionPoints  (const CRLDistributionPoints *, CRLDistributionPoints *);\nint   add_CRLDistributionPoints  (CRLDistributionPoints *, const DistributionPoint *);\nint   remove_CRLDistributionPoints  (CRLDistributionPoints *, unsigned int);\n\n\n/*\nDSASigValue ::= SEQUENCE {\n  r               INTEGER,\n  s               INTEGER,\n}\n*/\n\ntypedef struct DSASigValue {\n  heim_integer r;\n  heim_integer s;\n} DSASigValue;\n\nint    encode_DSASigValue(unsigned char *, size_t, const DSASigValue *, size_t *);\nint    decode_DSASigValue(const unsigned char *, size_t, DSASigValue *, size_t *);\nvoid   free_DSASigValue  (DSASigValue *);\nsize_t length_DSASigValue(const DSASigValue *);\nint    copy_DSASigValue  (const DSASigValue *, DSASigValue *);\n\n\n/*\nDSAPublicKey ::= INTEGER\n*/\n\ntypedef heim_integer DSAPublicKey;\n\nint    encode_DSAPublicKey(unsigned char *, size_t, const DSAPublicKey *, size_t *);\nint    decode_DSAPublicKey(const unsigned char *, size_t, DSAPublicKey *, size_t *);\nvoid   free_DSAPublicKey  (DSAPublicKey *);\nsize_t length_DSAPublicKey(const DSAPublicKey *);\nint    copy_DSAPublicKey  (const DSAPublicKey *, DSAPublicKey *);\n\n\n/*\nDSAParams ::= SEQUENCE {\n  p               INTEGER,\n  q               INTEGER,\n  g               INTEGER,\n}\n*/\n\ntypedef struct DSAParams {\n  heim_integer p;\n  heim_integer q;\n  heim_integer g;\n} DSAParams;\n\nint    encode_DSAParams(unsigned char *, size_t, const DSAParams *, size_t *);\nint    decode_DSAParams(const unsigned char *, size_t, DSAParams *, size_t *);\nvoid   free_DSAParams  (DSAParams *);\nsize_t length_DSAParams(const DSAParams *);\nint    copy_DSAParams  (const DSAParams *, DSAParams *);\n\n\n/*\nRSAPublicKey ::= SEQUENCE {\n  modulus          INTEGER,\n  publicExponent   INTEGER,\n}\n*/\n\ntypedef struct RSAPublicKey {\n  heim_integer modulus;\n  heim_integer publicExponent;\n} RSAPublicKey;\n\nint    encode_RSAPublicKey(unsigned char *, size_t, const RSAPublicKey *, size_t *);\nint    decode_RSAPublicKey(const unsigned char *, size_t, RSAPublicKey *, size_t *);\nvoid   free_RSAPublicKey  (RSAPublicKey *);\nsize_t length_RSAPublicKey(const RSAPublicKey *);\nint    copy_RSAPublicKey  (const RSAPublicKey *, RSAPublicKey *);\n\n\n/*\nRSAPrivateKey ::= SEQUENCE {\n  version           INTEGER (0..-1),\n  modulus           INTEGER,\n  publicExponent    INTEGER,\n  privateExponent   INTEGER,\n  prime1            INTEGER,\n  prime2            INTEGER,\n  exponent1         INTEGER,\n  exponent2         INTEGER,\n  coefficient       INTEGER,\n}\n*/\n\ntypedef struct RSAPrivateKey {\n  unsigned int version;\n  heim_integer modulus;\n  heim_integer publicExponent;\n  heim_integer privateExponent;\n  heim_integer prime1;\n  heim_integer prime2;\n  heim_integer exponent1;\n  heim_integer exponent2;\n  heim_integer coefficient;\n} RSAPrivateKey;\n\nint    encode_RSAPrivateKey(unsigned char *, size_t, const RSAPrivateKey *, size_t *);\nint    decode_RSAPrivateKey(const unsigned char *, size_t, RSAPrivateKey *, size_t *);\nvoid   free_RSAPrivateKey  (RSAPrivateKey *);\nsize_t length_RSAPrivateKey(const RSAPrivateKey *);\nint    copy_RSAPrivateKey  (const RSAPrivateKey *, RSAPrivateKey *);\n\n\n/*\nDigestInfo ::= SEQUENCE {\n  digestAlgorithm   AlgorithmIdentifier,\n  digest            OCTET STRING,\n}\n*/\n\ntypedef struct DigestInfo {\n  AlgorithmIdentifier digestAlgorithm;\n  heim_octet_string digest;\n} DigestInfo;\n\nint    encode_DigestInfo(unsigned char *, size_t, const DigestInfo *, size_t *);\nint    decode_DigestInfo(const unsigned char *, size_t, DigestInfo *, size_t *);\nvoid   free_DigestInfo  (DigestInfo *);\nsize_t length_DigestInfo(const DigestInfo *);\nint    copy_DigestInfo  (const DigestInfo *, DigestInfo *);\n\n\n/*\nTBSCRLCertList ::= SEQUENCE {\n  version               Version OPTIONAL,\n  signature             AlgorithmIdentifier,\n  issuer                Name,\n  thisUpdate            Time,\n  nextUpdate            Time OPTIONAL,\n  revokedCertificates   SEQUENCE OF SEQUENCE {\n  userCertificate      CertificateSerialNumber,\n  revocationDate       Time,\n  crlEntryExtensions   Extensions OPTIONAL,\n} OPTIONAL,\n  crlExtensions         [0] Extensions OPTIONAL,\n}\n*/\n\ntypedef struct TBSCRLCertList {\n  heim_octet_string _save;\n  Version *version;\n  AlgorithmIdentifier signature;\n  Name issuer;\n  Time thisUpdate;\n  Time *nextUpdate;\n  struct  {\n    unsigned int len;\n    struct  {\n      CertificateSerialNumber userCertificate;\n      Time revocationDate;\n      Extensions *crlEntryExtensions;\n    } *val;\n  } *revokedCertificates;\n  Extensions *crlExtensions;\n} TBSCRLCertList;\n\nint    encode_TBSCRLCertList(unsigned char *, size_t, const TBSCRLCertList *, size_t *);\nint    decode_TBSCRLCertList(const unsigned char *, size_t, TBSCRLCertList *, size_t *);\nvoid   free_TBSCRLCertList  (TBSCRLCertList *);\nsize_t length_TBSCRLCertList(const TBSCRLCertList *);\nint    copy_TBSCRLCertList  (const TBSCRLCertList *, TBSCRLCertList *);\n\n\n/*\nCRLCertificateList ::= SEQUENCE {\n  tbsCertList          TBSCRLCertList,\n  signatureAlgorithm   AlgorithmIdentifier,\n  signatureValue         BIT STRING {\n  },\n}\n*/\n\ntypedef struct CRLCertificateList {\n  TBSCRLCertList tbsCertList;\n  AlgorithmIdentifier signatureAlgorithm;\n  heim_bit_string signatureValue;\n} CRLCertificateList;\n\nint    encode_CRLCertificateList(unsigned char *, size_t, const CRLCertificateList *, size_t *);\nint    decode_CRLCertificateList(const unsigned char *, size_t, CRLCertificateList *, size_t *);\nvoid   free_CRLCertificateList  (CRLCertificateList *);\nsize_t length_CRLCertificateList(const CRLCertificateList *);\nint    copy_CRLCertificateList  (const CRLCertificateList *, CRLCertificateList *);\n\n\n/* OBJECT IDENTIFIER id-x509-ce-cRLNumber ::= { joint-iso-ccitt(2) ds(5) label-less(29) label-less(20) } */\nconst heim_oid *oid_id_x509_ce_cRLNumber(void);\n\n/* OBJECT IDENTIFIER id-x509-ce-freshestCRL ::= { joint-iso-ccitt(2) ds(5) label-less(29) label-less(46) } */\nconst heim_oid *oid_id_x509_ce_freshestCRL(void);\n\n/* OBJECT IDENTIFIER id-x509-ce-cRLReason ::= { joint-iso-ccitt(2) ds(5) label-less(29) label-less(21) } */\nconst heim_oid *oid_id_x509_ce_cRLReason(void);\n\n/*\nCRLReason ::= INTEGER {\n  unspecified(0),\n  keyCompromise(1),\n  cACompromise(2),\n  affiliationChanged(3),\n  superseded(4),\n  cessationOfOperation(5),\n  certificateHold(6),\n  removeFromCRL(8),\n  privilegeWithdrawn(9),\n  aACompromise(10)\n}\n*/\n\ntypedef enum CRLReason {\n  unspecified = 0,\n  keyCompromise = 1,\n  cACompromise = 2,\n  affiliationChanged = 3,\n  superseded = 4,\n  cessationOfOperation = 5,\n  certificateHold = 6,\n  removeFromCRL = 8,\n  privilegeWithdrawn = 9,\n  aACompromise = 10\n} CRLReason;\n\nint    encode_CRLReason(unsigned char *, size_t, const CRLReason *, size_t *);\nint    decode_CRLReason(const unsigned char *, size_t, CRLReason *, size_t *);\nvoid   free_CRLReason  (CRLReason *);\nsize_t length_CRLReason(const CRLReason *);\nint    copy_CRLReason  (const CRLReason *, CRLReason *);\n\n\n/*\nPKIXXmppAddr ::= UTF8String\n*/\n\ntypedef heim_utf8_string PKIXXmppAddr;\n\nint    encode_PKIXXmppAddr(unsigned char *, size_t, const PKIXXmppAddr *, size_t *);\nint    decode_PKIXXmppAddr(const unsigned char *, size_t, PKIXXmppAddr *, size_t *);\nvoid   free_PKIXXmppAddr  (PKIXXmppAddr *);\nsize_t length_PKIXXmppAddr(const PKIXXmppAddr *);\nint    copy_PKIXXmppAddr  (const PKIXXmppAddr *, PKIXXmppAddr *);\n\n\n/* OBJECT IDENTIFIER id-pkix ::= { iso(1) identified-organization(3) dod(6) internet(1) security(5) mechanisms(5) pkix(7) } */\nconst heim_oid *oid_id_pkix(void);\n\n/* OBJECT IDENTIFIER id-pkix-on ::= { iso(1) identified-organization(3) dod(6) internet(1) security(5) mechanisms(5) pkix(7) label-less(8) } */\nconst heim_oid *oid_id_pkix_on(void);\n\n/* OBJECT IDENTIFIER id-pkix-on-xmppAddr ::= { iso(1) identified-organization(3) dod(6) internet(1) security(5) mechanisms(5) pkix(7) label-less(8) label-less(5) } */\nconst heim_oid *oid_id_pkix_on_xmppAddr(void);\n\n/* OBJECT IDENTIFIER id-pkix-on-dnsSRV ::= { iso(1) identified-organization(3) dod(6) internet(1) security(5) mechanisms(5) pkix(7) label-less(8) label-less(7) } */\nconst heim_oid *oid_id_pkix_on_dnsSRV(void);\n\n/* OBJECT IDENTIFIER id-pkix-kp ::= { iso(1) identified-organization(3) dod(6) internet(1) security(5) mechanisms(5) pkix(7) label-less(3) } */\nconst heim_oid *oid_id_pkix_kp(void);\n\n/* OBJECT IDENTIFIER id-pkix-kp-serverAuth ::= { iso(1) identified-organization(3) dod(6) internet(1) security(5) mechanisms(5) pkix(7) label-less(3) label-less(1) } */\nconst heim_oid *oid_id_pkix_kp_serverAuth(void);\n\n/* OBJECT IDENTIFIER id-pkix-kp-clientAuth ::= { iso(1) identified-organization(3) dod(6) internet(1) security(5) mechanisms(5) pkix(7) label-less(3) label-less(2) } */\nconst heim_oid *oid_id_pkix_kp_clientAuth(void);\n\n/* OBJECT IDENTIFIER id-pkix-kp-emailProtection ::= { iso(1) identified-organization(3) dod(6) internet(1) security(5) mechanisms(5) pkix(7) label-less(3) label-less(4) } */\nconst heim_oid *oid_id_pkix_kp_emailProtection(void);\n\n/* OBJECT IDENTIFIER id-pkix-kp-timeStamping ::= { iso(1) identified-organization(3) dod(6) internet(1) security(5) mechanisms(5) pkix(7) label-less(3) label-less(8) } */\nconst heim_oid *oid_id_pkix_kp_timeStamping(void);\n\n/* OBJECT IDENTIFIER id-pkix-kp-OCSPSigning ::= { iso(1) identified-organization(3) dod(6) internet(1) security(5) mechanisms(5) pkix(7) label-less(3) label-less(9) } */\nconst heim_oid *oid_id_pkix_kp_OCSPSigning(void);\n\n/* OBJECT IDENTIFIER id-pkix-pe ::= { iso(1) identified-organization(3) dod(6) internet(1) security(5) mechanisms(5) pkix(7) label-less(1) } */\nconst heim_oid *oid_id_pkix_pe(void);\n\n/* OBJECT IDENTIFIER id-pkix-pe-authorityInfoAccess ::= { iso(1) identified-organization(3) dod(6) internet(1) security(5) mechanisms(5) pkix(7) label-less(1) label-less(1) } */\nconst heim_oid *oid_id_pkix_pe_authorityInfoAccess(void);\n\n/*\nAccessDescription ::= SEQUENCE {\n  accessMethod       OBJECT IDENTIFIER,\n  accessLocation   GeneralName,\n}\n*/\n\ntypedef struct AccessDescription {\n  heim_oid accessMethod;\n  GeneralName accessLocation;\n} AccessDescription;\n\nint    encode_AccessDescription(unsigned char *, size_t, const AccessDescription *, size_t *);\nint    decode_AccessDescription(const unsigned char *, size_t, AccessDescription *, size_t *);\nvoid   free_AccessDescription  (AccessDescription *);\nsize_t length_AccessDescription(const AccessDescription *);\nint    copy_AccessDescription  (const AccessDescription *, AccessDescription *);\n\n\n/*\nAuthorityInfoAccessSyntax ::= SEQUENCE OF AccessDescription\n*/\n\ntypedef struct AuthorityInfoAccessSyntax {\n  unsigned int len;\n  AccessDescription *val;\n} AuthorityInfoAccessSyntax;\n\nint    encode_AuthorityInfoAccessSyntax(unsigned char *, size_t, const AuthorityInfoAccessSyntax *, size_t *);\nint    decode_AuthorityInfoAccessSyntax(const unsigned char *, size_t, AuthorityInfoAccessSyntax *, size_t *);\nvoid   free_AuthorityInfoAccessSyntax  (AuthorityInfoAccessSyntax *);\nsize_t length_AuthorityInfoAccessSyntax(const AuthorityInfoAccessSyntax *);\nint    copy_AuthorityInfoAccessSyntax  (const AuthorityInfoAccessSyntax *, AuthorityInfoAccessSyntax *);\n\n\n/* OBJECT IDENTIFIER id-pkix-pe-proxyCertInfo ::= { iso(1) identified-organization(3) dod(6) internet(1) security(5) mechanisms(5) pkix(7) label-less(1) label-less(14) } */\nconst heim_oid *oid_id_pkix_pe_proxyCertInfo(void);\n\n/* OBJECT IDENTIFIER id-pkix-ppl ::= { iso(1) identified-organization(3) dod(6) internet(1) security(5) mechanisms(5) pkix(7) label-less(21) } */\nconst heim_oid *oid_id_pkix_ppl(void);\n\n/* OBJECT IDENTIFIER id-pkix-ppl-anyLanguage ::= { iso(1) identified-organization(3) dod(6) internet(1) security(5) mechanisms(5) pkix(7) label-less(21) label-less(0) } */\nconst heim_oid *oid_id_pkix_ppl_anyLanguage(void);\n\n/* OBJECT IDENTIFIER id-pkix-ppl-inheritAll ::= { iso(1) identified-organization(3) dod(6) internet(1) security(5) mechanisms(5) pkix(7) label-less(21) label-less(1) } */\nconst heim_oid *oid_id_pkix_ppl_inheritAll(void);\n\n/* OBJECT IDENTIFIER id-pkix-ppl-independent ::= { iso(1) identified-organization(3) dod(6) internet(1) security(5) mechanisms(5) pkix(7) label-less(21) label-less(2) } */\nconst heim_oid *oid_id_pkix_ppl_independent(void);\n\n/*\nProxyPolicy ::= SEQUENCE {\n  policyLanguage     OBJECT IDENTIFIER,\n  policy           OCTET STRING OPTIONAL,\n}\n*/\n\ntypedef struct ProxyPolicy {\n  heim_oid policyLanguage;\n  heim_octet_string *policy;\n} ProxyPolicy;\n\nint    encode_ProxyPolicy(unsigned char *, size_t, const ProxyPolicy *, size_t *);\nint    decode_ProxyPolicy(const unsigned char *, size_t, ProxyPolicy *, size_t *);\nvoid   free_ProxyPolicy  (ProxyPolicy *);\nsize_t length_ProxyPolicy(const ProxyPolicy *);\nint    copy_ProxyPolicy  (const ProxyPolicy *, ProxyPolicy *);\n\n\n/*\nProxyCertInfo ::= SEQUENCE {\n  pCPathLenConstraint   INTEGER (0..-1) OPTIONAL,\n  proxyPolicy           ProxyPolicy,\n}\n*/\n\ntypedef struct ProxyCertInfo {\n  unsigned int *pCPathLenConstraint;\n  ProxyPolicy proxyPolicy;\n} ProxyCertInfo;\n\nint    encode_ProxyCertInfo(unsigned char *, size_t, const ProxyCertInfo *, size_t *);\nint    decode_ProxyCertInfo(const unsigned char *, size_t, ProxyCertInfo *, size_t *);\nvoid   free_ProxyCertInfo  (ProxyCertInfo *);\nsize_t length_ProxyCertInfo(const ProxyCertInfo *);\nint    copy_ProxyCertInfo  (const ProxyCertInfo *, ProxyCertInfo *);\n\n\n/* OBJECT IDENTIFIER id-uspkicommon-card-id ::= { label-less(2) label-less(16) label-less(840) label-less(1) label-less(101) label-less(3) label-less(6) label-less(6) } */\nconst heim_oid *oid_id_uspkicommon_card_id(void);\n\n/* OBJECT IDENTIFIER id-uspkicommon-piv-interim ::= { label-less(2) label-less(16) label-less(840) label-less(1) label-less(101) label-less(3) label-less(6) label-less(9) label-less(1) } */\nconst heim_oid *oid_id_uspkicommon_piv_interim(void);\n\n/* OBJECT IDENTIFIER id-netscape ::= { joint-iso-itu-t(2) country(16) us(840) organization(1) netscape(113730) } */\nconst heim_oid *oid_id_netscape(void);\n\n/* OBJECT IDENTIFIER id-netscape-cert-comment ::= { joint-iso-itu-t(2) country(16) us(840) organization(1) netscape(113730) label-less(1) label-less(13) } */\nconst heim_oid *oid_id_netscape_cert_comment(void);\n\n/* OBJECT IDENTIFIER id-ms-cert-enroll-domaincontroller ::= { label-less(1) label-less(3) label-less(6) label-less(1) label-less(4) label-less(1) label-less(311) label-less(20) label-less(2) } */\nconst heim_oid *oid_id_ms_cert_enroll_domaincontroller(void);\n\n/* OBJECT IDENTIFIER id-ms-client-authentication ::= { label-less(1) label-less(3) label-less(6) label-less(1) label-less(5) label-less(5) label-less(7) label-less(3) label-less(2) } */\nconst heim_oid *oid_id_ms_client_authentication(void);\n\n#endif /* __rfc2459_asn1_h__ */\n"
  },
  {
    "path": "freebsd-headers/ripemd.h",
    "content": "/* crypto/ripemd/ripemd.h */\n/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)\n * All rights reserved.\n *\n * This package is an SSL implementation written\n * by Eric Young (eay@cryptsoft.com).\n * The implementation was written so as to conform with Netscapes SSL.\n * \n * This library is free for commercial and non-commercial use as long as\n * the following conditions are aheared to.  The following conditions\n * apply to all code found in this distribution, be it the RC4, RSA,\n * lhash, DES, etc., code; not just the SSL code.  The SSL documentation\n * included with this distribution is covered by the same copyright terms\n * except that the holder is Tim Hudson (tjh@cryptsoft.com).\n * \n * Copyright remains Eric Young's, and as such any Copyright notices in\n * the code are not to be removed.\n * If this package is used in a product, Eric Young should be given attribution\n * as the author of the parts of the library used.\n * This can be in the form of a textual message at program startup or\n * in documentation (online or textual) provided with the package.\n * \n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. All advertising materials mentioning features or use of this software\n *    must display the following acknowledgement:\n *    \"This product includes cryptographic software written by\n *     Eric Young (eay@cryptsoft.com)\"\n *    The word 'cryptographic' can be left out if the rouines from the library\n *    being used are not cryptographic related :-).\n * 4. If you include any Windows specific code (or a derivative thereof) from \n *    the apps directory (application code) you must include an acknowledgement:\n *    \"This product includes software written by Tim Hudson (tjh@cryptsoft.com)\"\n * \n * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n * \n * The licence and distribution terms for any publically available version or\n * derivative of this code cannot be changed.  i.e. this code cannot simply be\n * copied and put under another distribution licence\n * [including the GNU Public Licence.]\n */\n\n/*\n * $FreeBSD: release/9.0.0/lib/libmd/ripemd.h 154479 2006-01-17 15:35:57Z phk $\n */\n\n#ifndef HEADER_RIPEMD_H\n#define HEADER_RIPEMD_H\n\n#include <sys/cdefs.h>\n#include <sys/types.h>\t\t/* XXX switch to machine/ansi.h and __ types */\n\n#define RIPEMD160_CBLOCK\t64\n#define RIPEMD160_LBLOCK\t16\n#define RIPEMD160_BLOCK\t\t16\n#define RIPEMD160_LAST_BLOCK\t56\n#define RIPEMD160_LENGTH_BLOCK\t8\n#define RIPEMD160_DIGEST_LENGTH\t20\n\ntypedef struct RIPEMD160state_st {\n\tu_int32_t A,B,C,D,E;\n\tu_int32_t Nl,Nh;\n\tu_int32_t data[RIPEMD160_LBLOCK];\n\tint num;\n} RIPEMD160_CTX;\n\n__BEGIN_DECLS\nvoid\tRIPEMD160_Init(RIPEMD160_CTX *c);\nvoid\tRIPEMD160_Update(RIPEMD160_CTX *c, const void *data,\n\t\t\t size_t len);\nvoid\tRIPEMD160_Final(unsigned char *md, RIPEMD160_CTX *c);\nchar   *RIPEMD160_End(RIPEMD160_CTX *, char *);\nchar   *RIPEMD160_File(const char *, char *);\nchar   *RIPEMD160_FileChunk(const char *, char *, off_t, off_t);\nchar   *RIPEMD160_Data(const void *, unsigned int, char *);\n__END_DECLS\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/roken-common.h",
    "content": "/*\n * Copyright (c) 1995 - 2005 Kungliga Tekniska Hgskolan\n * (Royal Institute of Technology, Stockholm, Sweden).\n * All rights reserved.\n * \n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * \n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * \n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * \n * 3. Neither the name of the Institute nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n * \n * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n */\n\n/* $Id: roken-common.h 20867 2007-06-03 21:00:45Z lha $ */\n\n#ifndef __ROKEN_COMMON_H__\n#define __ROKEN_COMMON_H__\n\n#ifndef ROKEN_LIB_FUNCTION\n#ifdef _WIN32\n#define ROKEN_LIB_FUNCTION _stdcall\n#else\n#define ROKEN_LIB_FUNCTION\n#endif\n#endif\n\n#ifdef __cplusplus\n#define ROKEN_CPP_START\textern \"C\" {\n#define ROKEN_CPP_END\t}\n#else\n#define ROKEN_CPP_START\n#define ROKEN_CPP_END\n#endif\n\n#ifndef INADDR_NONE\n#define INADDR_NONE 0xffffffff\n#endif\n\n#ifndef INADDR_LOOPBACK\n#define INADDR_LOOPBACK 0x7f000001\n#endif\n\n#ifndef SOMAXCONN\n#define SOMAXCONN 5\n#endif\n\n#ifndef STDIN_FILENO\n#define STDIN_FILENO 0\n#endif\n\n#ifndef STDOUT_FILENO\n#define STDOUT_FILENO 1\n#endif\n\n#ifndef STDERR_FILENO\n#define STDERR_FILENO 2\n#endif\n\n#ifndef max\n#define max(a,b) (((a)>(b))?(a):(b))\n#endif\n\n#ifndef min\n#define min(a,b) (((a)<(b))?(a):(b))\n#endif\n\n#ifndef TRUE\n#define TRUE 1\n#endif\n\n#ifndef FALSE\n#define FALSE 0\n#endif\n\n#ifndef LOG_DAEMON\n#define openlog(id,option,facility) openlog((id),(option))\n#define\tLOG_DAEMON\t0\n#endif\n#ifndef LOG_ODELAY\n#define LOG_ODELAY 0\n#endif\n#ifndef LOG_NDELAY\n#define LOG_NDELAY 0x08\n#endif\n#ifndef LOG_CONS\n#define LOG_CONS 0\n#endif\n#ifndef LOG_AUTH\n#define LOG_AUTH 0\n#endif\n#ifndef LOG_AUTHPRIV\n#define LOG_AUTHPRIV LOG_AUTH\n#endif\n\n#ifndef F_OK\n#define F_OK 0\n#endif\n\n#ifndef O_ACCMODE\n#define O_ACCMODE\t003\n#endif\n\n#ifndef _PATH_DEV\n#define _PATH_DEV \"/dev/\"\n#endif\n\n#ifndef _PATH_DEVNULL\n#define _PATH_DEVNULL \"/dev/null\"\n#endif\n\n#ifndef _PATH_HEQUIV\n#define _PATH_HEQUIV \"/etc/hosts.equiv\"\n#endif\n\n#ifndef _PATH_VARRUN\n#define _PATH_VARRUN \"/var/run/\"\n#endif\n\n#ifndef _PATH_BSHELL\n#define _PATH_BSHELL \"/bin/sh\"\n#endif\n\n#ifndef MAXPATHLEN\n#define MAXPATHLEN (1024+4)\n#endif\n\n#ifndef SIG_ERR\n#define SIG_ERR ((RETSIGTYPE (*)(int))-1)\n#endif\n\n/*\n * error code for getipnodeby{name,addr}\n */\n\n#ifndef HOST_NOT_FOUND\n#define HOST_NOT_FOUND 1\n#endif\n\n#ifndef TRY_AGAIN\n#define TRY_AGAIN 2\n#endif\n\n#ifndef NO_RECOVERY\n#define NO_RECOVERY 3\n#endif\n\n#ifndef NO_DATA\n#define NO_DATA 4\n#endif\n\n#ifndef NO_ADDRESS\n#define NO_ADDRESS NO_DATA\n#endif\n\n/*\n * error code for getaddrinfo\n */\n\n#ifndef EAI_NOERROR\n#define EAI_NOERROR\t0\t/* no error */\n#endif\n\n#ifndef EAI_NONAME\n\n#define EAI_ADDRFAMILY\t1\t/* address family for nodename not supported */\n#define EAI_AGAIN\t2\t/* temporary failure in name resolution */\n#define EAI_BADFLAGS\t3\t/* invalid value for ai_flags */\n#define EAI_FAIL\t4\t/* non-recoverable failure in name resolution */\n#define EAI_FAMILY\t5\t/* ai_family not supported */\n#define EAI_MEMORY\t6\t/* memory allocation failure */\n#define EAI_NODATA\t7\t/* no address associated with nodename */\n#define EAI_NONAME\t8\t/* nodename nor servname provided, or not known */\n#define EAI_SERVICE\t9\t/* servname not supported for ai_socktype */\n#define EAI_SOCKTYPE   10\t/* ai_socktype not supported */\n#define EAI_SYSTEM     11\t/* system error returned in errno */\n\n#endif /* EAI_NONAME */\n\n/* flags for getaddrinfo() */\n\n#ifndef AI_PASSIVE\n#define AI_PASSIVE\t0x01\n#define AI_CANONNAME\t0x02\n#endif /* AI_PASSIVE */\n\n#ifndef AI_NUMERICHOST\n#define AI_NUMERICHOST\t0x04\n#endif\n\n/* flags for getnameinfo() */\n\n#ifndef NI_DGRAM\n#define NI_DGRAM\t0x01\n#define NI_NAMEREQD\t0x02\n#define NI_NOFQDN\t0x04\n#define NI_NUMERICHOST\t0x08\n#define NI_NUMERICSERV\t0x10\n#endif\n\n/*\n * constants for getnameinfo\n */\n\n#ifndef NI_MAXHOST\n#define NI_MAXHOST  1025\n#define NI_MAXSERV    32\n#endif\n\n/*\n * constants for inet_ntop\n */\n\n#ifndef INET_ADDRSTRLEN\n#define INET_ADDRSTRLEN    16\n#endif\n\n#ifndef INET6_ADDRSTRLEN\n#define INET6_ADDRSTRLEN   46\n#endif\n\n/*\n * for shutdown(2)\n */\n\n#ifndef SHUT_RD\n#define SHUT_RD 0\n#endif\n\n#ifndef SHUT_WR\n#define SHUT_WR 1\n#endif\n\n#ifndef SHUT_RDWR\n#define SHUT_RDWR 2\n#endif\n\n#ifndef HAVE___ATTRIBUTE__\n#define __attribute__(x)\n#endif\n\nROKEN_CPP_START\n\n#ifndef IRIX4 /* fix for compiler bug */\n#ifdef RETSIGTYPE\ntypedef RETSIGTYPE (*SigAction)(int);\nSigAction signal(int iSig, SigAction pAction); /* BSD compatible */\n#endif\n#endif\n\nint ROKEN_LIB_FUNCTION\nsimple_execve(const char*, char*const[], char*const[]);\n\nint ROKEN_LIB_FUNCTION\nsimple_execve_timed(const char *, char *const[], \n\t\t    char *const [], time_t (*)(void *), \n\t\t    void *, time_t);\nint ROKEN_LIB_FUNCTION\nsimple_execvp(const char*, char *const[]);\n\nint ROKEN_LIB_FUNCTION\nsimple_execvp_timed(const char *, char *const[], \n\t\t    time_t (*)(void *), void *, time_t);\nint ROKEN_LIB_FUNCTION\nsimple_execlp(const char*, ...);\n\nint ROKEN_LIB_FUNCTION\nsimple_execle(const char*, ...);\n\nint ROKEN_LIB_FUNCTION\nsimple_execl(const char *file, ...);\n\nint ROKEN_LIB_FUNCTION\nwait_for_process(pid_t);\n\nint ROKEN_LIB_FUNCTION\nwait_for_process_timed(pid_t, time_t (*)(void *), \n\t\t\t\t\t      void *, time_t);\nint ROKEN_LIB_FUNCTION\npipe_execv(FILE**, FILE**, FILE**, const char*, ...);\n\nvoid ROKEN_LIB_FUNCTION\nprint_version(const char *);\n\nssize_t ROKEN_LIB_FUNCTION\neread (int fd, void *buf, size_t nbytes);\n\nssize_t ROKEN_LIB_FUNCTION\newrite (int fd, const void *buf, size_t nbytes);\n\nstruct hostent;\n\nconst char * ROKEN_LIB_FUNCTION\nhostent_find_fqdn (const struct hostent *);\n\nvoid ROKEN_LIB_FUNCTION\nesetenv(const char *, const char *, int);\n\nvoid ROKEN_LIB_FUNCTION\nsocket_set_address_and_port (struct sockaddr *, const void *, int);\n\nsize_t ROKEN_LIB_FUNCTION\nsocket_addr_size (const struct sockaddr *);\n\nvoid ROKEN_LIB_FUNCTION\nsocket_set_any (struct sockaddr *, int);\n\nsize_t ROKEN_LIB_FUNCTION\nsocket_sockaddr_size (const struct sockaddr *);\n\nvoid * ROKEN_LIB_FUNCTION\nsocket_get_address (struct sockaddr *);\n\nint ROKEN_LIB_FUNCTION\nsocket_get_port (const struct sockaddr *);\n\nvoid ROKEN_LIB_FUNCTION\nsocket_set_port (struct sockaddr *, int);\n\nvoid ROKEN_LIB_FUNCTION\nsocket_set_portrange (int, int, int);\n\nvoid ROKEN_LIB_FUNCTION\nsocket_set_debug (int);\n\nvoid ROKEN_LIB_FUNCTION\nsocket_set_tos (int, int);\n\nvoid ROKEN_LIB_FUNCTION\nsocket_set_reuseaddr (int, int);\n\nvoid ROKEN_LIB_FUNCTION\nsocket_set_ipv6only (int, int);\n\nchar ** ROKEN_LIB_FUNCTION\nvstrcollect(va_list *ap);\n\nchar ** ROKEN_LIB_FUNCTION\nstrcollect(char *first, ...);\n\nvoid ROKEN_LIB_FUNCTION\ntimevalfix(struct timeval *t1);\n\nvoid ROKEN_LIB_FUNCTION\ntimevaladd(struct timeval *t1, const struct timeval *t2);\n\nvoid ROKEN_LIB_FUNCTION\ntimevalsub(struct timeval *t1, const struct timeval *t2);\n\nchar *ROKEN_LIB_FUNCTION\npid_file_write (const char *progname);\n\nvoid ROKEN_LIB_FUNCTION\npid_file_delete (char **);\n\nint ROKEN_LIB_FUNCTION\nread_environment(const char *file, char ***env);\n\nvoid ROKEN_LIB_FUNCTION\nfree_environment(char **);\n\nvoid ROKEN_LIB_FUNCTION\nwarnerr(int doerrno, const char *fmt, va_list ap)\n    __attribute__ ((format (printf, 2, 0)));\n\nvoid * ROKEN_LIB_FUNCTION\nrk_realloc(void *, size_t);\n\nstruct rk_strpool;\n\nchar * ROKEN_LIB_FUNCTION\nrk_strpoolcollect(struct rk_strpool *);\n\nstruct rk_strpool * ROKEN_LIB_FUNCTION\nrk_strpoolprintf(struct rk_strpool *, const char *, ...)\n    __attribute__ ((format (printf, 2, 3)));\n\nvoid ROKEN_LIB_FUNCTION\nrk_strpoolfree(struct rk_strpool *);\n\nvoid ROKEN_LIB_FUNCTION\nrk_dumpdata (const char *, const void *, size_t);\n\nROKEN_CPP_END\n\n#endif /* __ROKEN_COMMON_H__ */\n"
  },
  {
    "path": "freebsd-headers/roken.h",
    "content": "/* This is an OS dependent, generated file */\n\n\n#ifndef __ROKEN_H__\n#define __ROKEN_H__\n\n/* -*- C -*- */\n/*\n * Copyright (c) 1995-2005 Kungliga Tekniska Hgskolan\n * (Royal Institute of Technology, Stockholm, Sweden).\n * All rights reserved.\n * \n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * \n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * \n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * \n * 3. Neither the name of the Institute nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n * \n * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n */\n\n/* $Id: roken.h.in 18612 2006-10-19 16:35:16Z lha $ */\n\n#include <stdio.h>\n#include <stdlib.h>\n#include <stdarg.h>\n#include <stdint.h>\n#include <string.h>\n#include <signal.h>\n\n#include <sys/param.h>\n#include <inttypes.h>\n#include <sys/types.h>\n#include <unistd.h>\n#include <sys/socket.h>\n#include <sys/uio.h>\n#include <grp.h>\n#include <sys/stat.h>\n#include <netinet/in.h>\n#include <arpa/inet.h>\n#include <netdb.h>\n#include <arpa/nameser.h>\n#include <resolv.h>\n#include <syslog.h>\n#include <fcntl.h>\n#include <errno.h>\n#include <err.h>\n#include <termios.h>\n#include <sys/ioctl.h>\n#include <sys/time.h>\n#include <time.h>\n#include <strings.h>\n\n#include <paths.h>\n\n\n#include <roken-common.h>\n\nROKEN_CPP_START\n\n#define rk_UNCONST(x) ((void *)(uintptr_t)(const void *)(x))\n\n\n\n\n\n\n\n\n\n\nint ROKEN_LIB_FUNCTION\n    asnprintf (char **, size_t, const char *, ...)\n     __attribute__ ((format (printf, 3, 4)));\n\nint ROKEN_LIB_FUNCTION\n    vasnprintf (char **, size_t, const char *, va_list)\n     __attribute__((format (printf, 3, 0)));\n\n\nchar * ROKEN_LIB_FUNCTION strndup(const char *, size_t);\n\nchar * ROKEN_LIB_FUNCTION strlwr(char *);\n\nsize_t ROKEN_LIB_FUNCTION strnlen(const char*, size_t);\n\n\nssize_t ROKEN_LIB_FUNCTION strsep_copy(const char**, const char*, char*, size_t);\n\n\n\n\nchar * ROKEN_LIB_FUNCTION strupr(char *);\n\n\n\n\n\n\n\n\n\n\n\n#include <pwd.h>\nstruct passwd * ROKEN_LIB_FUNCTION k_getpwnam (const char *);\nstruct passwd * ROKEN_LIB_FUNCTION k_getpwuid (uid_t);\n\nconst char * ROKEN_LIB_FUNCTION get_default_username (void);\n\n\n\n\n\n\n\n\nint ROKEN_LIB_FUNCTION daemon(int, int);\n\n\n\n\n\n\n\n\n\n\nvoid ROKEN_LIB_FUNCTION pidfile (const char*);\n\nunsigned int ROKEN_LIB_FUNCTION bswap32(unsigned int);\n\nunsigned short ROKEN_LIB_FUNCTION bswap16(unsigned short);\n\n\ntime_t ROKEN_LIB_FUNCTION tm2time (struct tm, int);\n\nint ROKEN_LIB_FUNCTION unix_verify_user(char *, char *);\n\nint ROKEN_LIB_FUNCTION roken_concat (char *, size_t, ...);\n\nsize_t ROKEN_LIB_FUNCTION roken_mconcat (char **, size_t, ...);\n\nint ROKEN_LIB_FUNCTION roken_vconcat (char *, size_t, va_list);\n\nsize_t ROKEN_LIB_FUNCTION\n    roken_vmconcat (char **, size_t, va_list);\n\nssize_t ROKEN_LIB_FUNCTION net_write (int, const void *, size_t);\n\nssize_t ROKEN_LIB_FUNCTION net_read (int, void *, size_t);\n\nint ROKEN_LIB_FUNCTION issuid(void);\n\n\nint ROKEN_LIB_FUNCTION get_window_size(int fd, struct winsize *);\n\n\n\nextern char **environ;\n\n\n\n\nstruct hostent * ROKEN_LIB_FUNCTION\ncopyhostent (const struct hostent *);\n\n\n\n\n\n\n\n\nint ROKEN_LIB_FUNCTION\ngetnameinfo_verified(const struct sockaddr *, socklen_t,\n\t\t     char *, size_t,\n\t\t     char *, size_t,\n\t\t     int);\n\nint ROKEN_LIB_FUNCTION\nroken_getaddrinfo_hostspec(const char *, int, struct addrinfo **); \nint ROKEN_LIB_FUNCTION\nroken_getaddrinfo_hostspec2(const char *, int, int, struct addrinfo **);\n\n\n\nvoid * ROKEN_LIB_FUNCTION emalloc (size_t);\nvoid * ROKEN_LIB_FUNCTION ecalloc(size_t, size_t);\nvoid * ROKEN_LIB_FUNCTION erealloc (void *, size_t);\nchar * ROKEN_LIB_FUNCTION estrdup (const char *);\n\n/*\n * kludges and such\n */\n\nint ROKEN_LIB_FUNCTION\nroken_gethostby_setup(const char*, const char*);\nstruct hostent* ROKEN_LIB_FUNCTION\nroken_gethostbyname(const char*);\nstruct hostent* ROKEN_LIB_FUNCTION \nroken_gethostbyaddr(const void*, size_t, int);\n\n#define roken_getservbyname(x,y) getservbyname(x,y)\n\n#define roken_openlog(a,b,c) openlog(a,b,c)\n\n#define roken_getsockname(a,b,c) getsockname(a,b,c)\n\n\n\n\nvoid ROKEN_LIB_FUNCTION mini_inetd_addrinfo (struct addrinfo*);\nvoid ROKEN_LIB_FUNCTION mini_inetd (int);\n\n\nint ROKEN_LIB_FUNCTION\nstrsvis(char *, const char *, int, const char *);\n\n\n\n\nchar * ROKEN_LIB_FUNCTION\nsvis(char *, int, int, int, const char *);\n\n\n\n\n\n\nROKEN_CPP_END\n#define ROKEN_VERSION 1.1\n\n#endif /* __ROKEN_H__ */\n"
  },
  {
    "path": "freebsd-headers/rpc/auth.h",
    "content": "/*\t$NetBSD: auth.h,v 1.15 2000/06/02 22:57:55 fvdl Exp $\t*/\n\n/*\n * Sun RPC is a product of Sun Microsystems, Inc. and is provided for\n * unrestricted use provided that this legend is included on all tape\n * media and as a part of the software program in whole or part.  Users\n * may copy or modify Sun RPC without charge, but are not authorized\n * to license or distribute it to anyone else except as part of a product or\n * program developed by the user.\n *\n * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE\n * WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR\n * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.\n *\n * Sun RPC is provided with no support and without any obligation on the\n * part of Sun Microsystems, Inc. to assist in its use, correction,\n * modification or enhancement.\n *\n * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE\n * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC\n * OR ANY PART THEREOF.\n *\n * In no event will Sun Microsystems, Inc. be liable for any lost revenue\n * or profits or other special, indirect and consequential damages, even if\n * Sun has been advised of the possibility of such damages.\n *\n * Sun Microsystems, Inc.\n * 2550 Garcia Avenue\n * Mountain View, California  94043\n *\n *\tfrom: @(#)auth.h 1.17 88/02/08 SMI\n *\tfrom: @(#)auth.h\t2.3 88/08/07 4.0 RPCSRC\n *\tfrom: @(#)auth.h\t1.43 \t98/02/02 SMI\n * $FreeBSD: release/9.0.0/include/rpc/auth.h 181344 2008-08-06 14:02:05Z dfr $\n */\n\n/*\n * auth.h, Authentication interface.\n *\n * Copyright (C) 1984, Sun Microsystems, Inc.\n *\n * The data structures are completely opaque to the client.  The client\n * is required to pass an AUTH * to routines that create rpc\n * \"sessions\".\n */\n\n#ifndef _RPC_AUTH_H\n#define _RPC_AUTH_H\n#include <rpc/xdr.h>\n#include <rpc/clnt_stat.h>\n#include <sys/cdefs.h>\n#include <sys/socket.h>\n\n#define MAX_AUTH_BYTES\t400\n#define MAXNETNAMELEN\t255\t/* maximum length of network user's name */\n\n/*\n *  Client side authentication/security data\n */\n\ntypedef struct sec_data {\n\tu_int\tsecmod;\t\t/* security mode number e.g. in nfssec.conf */\n\tu_int\trpcflavor;\t/* rpc flavors:AUTH_UNIX,AUTH_DES,RPCSEC_GSS */\n\tint\tflags;\t\t/* AUTH_F_xxx flags */\n\tcaddr_t data;\t\t/* opaque data per flavor */\n} sec_data_t;\n\n#ifdef _SYSCALL32_IMPL\nstruct sec_data32 {\n\tuint32_t secmod;\t/* security mode number e.g. in nfssec.conf */\n\tuint32_t rpcflavor;\t/* rpc flavors:AUTH_UNIX,AUTH_DES,RPCSEC_GSS */\n\tint32_t flags;\t\t/* AUTH_F_xxx flags */\n\tcaddr32_t data;\t\t/* opaque data per flavor */\n};\n#endif /* _SYSCALL32_IMPL */\n\n/*\n * AUTH_DES flavor specific data from sec_data opaque data field.\n * AUTH_KERB has the same structure.\n */\ntypedef struct des_clnt_data {\n\tstruct netbuf\tsyncaddr;\t/* time sync addr */\n\tstruct knetconfig *knconf;\t/* knetconfig info that associated */\n\t\t\t\t\t/* with the syncaddr. */\n\tchar\t\t*netname;\t/* server's netname */\n\tint\t\tnetnamelen;\t/* server's netname len */\n} dh_k4_clntdata_t;\n\n#ifdef _SYSCALL32_IMPL\nstruct des_clnt_data32 {\n\tstruct netbuf32 syncaddr;\t/* time sync addr */\n\tcaddr32_t knconf;\t\t/* knetconfig info that associated */\n\t\t\t\t\t/* with the syncaddr. */\n\tcaddr32_t netname;\t\t/* server's netname */\n\tint32_t netnamelen;\t\t/* server's netname len */\n};\n#endif /* _SYSCALL32_IMPL */\n\n#ifdef KERBEROS\n/*\n * flavor specific data to hold the data for AUTH_DES/AUTH_KERB(v4)\n * in sec_data->data opaque field.\n */\ntypedef struct krb4_svc_data {\n\tint\t\twindow;\t\t/* window option value */\n} krb4_svcdata_t;\n \ntypedef struct krb4_svc_data\tdes_svcdata_t;\n#endif /* KERBEROS */\n\n/*\n * authentication/security specific flags\n */\n#define AUTH_F_RPCTIMESYNC\t0x001\t/* use RPC to do time sync */\n#define AUTH_F_TRYNONE\t\t0x002\t/* allow fall back to AUTH_NONE */\n\n\n/*\n * Status returned from authentication check\n */\nenum auth_stat {\n\tAUTH_OK=0,\n\t/*\n\t * failed at remote end\n\t */\n\tAUTH_BADCRED=1,\t\t\t/* bogus credentials (seal broken) */\n\tAUTH_REJECTEDCRED=2,\t\t/* client should begin new session */\n\tAUTH_BADVERF=3,\t\t\t/* bogus verifier (seal broken) */\n\tAUTH_REJECTEDVERF=4,\t\t/* verifier expired or was replayed */\n\tAUTH_TOOWEAK=5,\t\t\t/* rejected due to security reasons */\n\t/*\n\t * failed locally\n\t*/\n\tAUTH_INVALIDRESP=6,\t\t/* bogus response verifier */\n\tAUTH_FAILED=7,\t\t\t/* some unknown reason */\n#ifdef KERBEROS\n\t/*\n\t * kerberos errors\n\t */\n\t,\n\tAUTH_KERB_GENERIC = 8,\t\t/* kerberos generic error */\n\tAUTH_TIMEEXPIRE = 9,\t\t/* time of credential expired */\n\tAUTH_TKT_FILE = 10,\t\t/* something wrong with ticket file */\n\tAUTH_DECODE = 11,\t\t\t/* can't decode authenticator */\n\tAUTH_NET_ADDR = 12,\t\t/* wrong net address in ticket */\n#endif /* KERBEROS */\n\t/*\n\t * RPCSEC_GSS errors\n\t */\n\tRPCSEC_GSS_CREDPROBLEM = 13,\n\tRPCSEC_GSS_CTXPROBLEM = 14,\n\tRPCSEC_GSS_NODISPATCH = 0x8000000\n};\n\nunion des_block {\n\tstruct {\n\t\tuint32_t high;\n\t\tuint32_t low;\n\t} key;\n\tchar c[8];\n};\ntypedef union des_block des_block;\n__BEGIN_DECLS\nextern bool_t xdr_des_block(XDR *, des_block *);\n__END_DECLS\n\n/*\n * Authentication info.  Opaque to client.\n */\nstruct opaque_auth {\n\tenum_t\toa_flavor;\t\t/* flavor of auth */\n\tcaddr_t\toa_base;\t\t/* address of more auth stuff */\n\tu_int\toa_length;\t\t/* not to exceed MAX_AUTH_BYTES */\n};\n\n\n/*\n * Auth handle, interface to client side authenticators.\n */\ntypedef struct __auth {\n\tstruct\topaque_auth\tah_cred;\n\tstruct\topaque_auth\tah_verf;\n\tunion\tdes_block\tah_key;\n\tstruct auth_ops {\n\t\tvoid\t(*ah_nextverf) (struct __auth *);\n\t\t/* nextverf & serialize */\n\t\tint\t(*ah_marshal) (struct __auth *, XDR *);\n\t\t/* validate verifier */\n\t\tint\t(*ah_validate) (struct __auth *,\n\t\t\t    struct opaque_auth *);\n\t\t/* refresh credentials */\n\t\tint\t(*ah_refresh) (struct __auth *, void *);\n\t\t/* destroy this structure */\n\t\tvoid\t(*ah_destroy) (struct __auth *);\n\t} *ah_ops;\n\tvoid *ah_private;\n} AUTH;\n\n\n/*\n * Authentication ops.\n * The ops and the auth handle provide the interface to the authenticators.\n *\n * AUTH\t*auth;\n * XDR\t*xdrs;\n * struct opaque_auth verf;\n */\n#define AUTH_NEXTVERF(auth)\t\t\\\n\t\t((*((auth)->ah_ops->ah_nextverf))(auth))\n#define auth_nextverf(auth)\t\t\\\n\t\t((*((auth)->ah_ops->ah_nextverf))(auth))\n\n#define AUTH_MARSHALL(auth, xdrs)\t\\\n\t\t((*((auth)->ah_ops->ah_marshal))(auth, xdrs))\n#define auth_marshall(auth, xdrs)\t\\\n\t\t((*((auth)->ah_ops->ah_marshal))(auth, xdrs))\n\n#define AUTH_VALIDATE(auth, verfp)\t\\\n\t\t((*((auth)->ah_ops->ah_validate))((auth), verfp))\n#define auth_validate(auth, verfp)\t\\\n\t\t((*((auth)->ah_ops->ah_validate))((auth), verfp))\n\n#define AUTH_REFRESH(auth, msg)\t\t\\\n\t\t((*((auth)->ah_ops->ah_refresh))(auth, msg))\n#define auth_refresh(auth, msg)\t\t\\\n\t\t((*((auth)->ah_ops->ah_refresh))(auth, msg))\n\n#define AUTH_DESTROY(auth)\t\t\\\n\t\t((*((auth)->ah_ops->ah_destroy))(auth))\n#define auth_destroy(auth)\t\t\\\n\t\t((*((auth)->ah_ops->ah_destroy))(auth))\n\n\n__BEGIN_DECLS\nextern struct opaque_auth _null_auth;\n__END_DECLS\n\n/*\n * These are the various implementations of client side authenticators.\n */\n\n/*\n * System style authentication\n * AUTH *authunix_create(machname, uid, gid, len, aup_gids)\n *\tchar *machname;\n *\tint uid;\n *\tint gid;\n *\tint len;\n *\tint *aup_gids;\n */\n__BEGIN_DECLS\nextern AUTH *authunix_create(char *, int, int, int,\n    int *);\nextern AUTH *authunix_create_default(void);\t/* takes no parameters */\nextern AUTH *authnone_create(void);\t\t/* takes no parameters */\n__END_DECLS\n/*\n * DES style authentication\n * AUTH *authsecdes_create(servername, window, timehost, ckey)\n * \tchar *servername;\t\t- network name of server\n *\tu_int window;\t\t\t- time to live\n * \tconst char *timehost;\t\t\t- optional hostname to sync with\n * \tdes_block *ckey;\t\t- optional conversation key to use\n */\n__BEGIN_DECLS\nextern AUTH *authdes_create (char *, u_int, struct sockaddr *, des_block *);\nextern AUTH *authdes_seccreate (const char *, const u_int, const  char *,\n    const  des_block *);\n__END_DECLS\n\n__BEGIN_DECLS\nextern bool_t xdr_opaque_auth\t\t(XDR *, struct opaque_auth *);\n__END_DECLS\n\n#define authsys_create(c,i1,i2,i3,ip) authunix_create((c),(i1),(i2),(i3),(ip))\n#define authsys_create_default() authunix_create_default()\n\n/*\n * Netname manipulation routines.\n */\n__BEGIN_DECLS\nextern int getnetname(char *);\nextern int host2netname(char *, const char *, const char *);\nextern int user2netname(char *, const uid_t, const char *);\nextern int netname2user(char *, uid_t *, gid_t *, int *, gid_t *);\nextern int netname2host(char *, char *, const int);\nextern void passwd2des ( char *, char * );\n__END_DECLS\n\n/*\n *\n * These routines interface to the keyserv daemon\n *\n */\n__BEGIN_DECLS\nextern int key_decryptsession(const char *, des_block *);\nextern int key_encryptsession(const char *, des_block *);\nextern int key_gendes(des_block *);\nextern int key_setsecret(const char *);\nextern int key_secretkey_is_set(void);\n__END_DECLS\n\n/*\n * Publickey routines.\n */\n__BEGIN_DECLS\nextern int getpublickey (const char *, char *);\nextern int getpublicandprivatekey (const char *, char *);\nextern int getsecretkey (char *, char *, char *);\n__END_DECLS\n\n#ifdef KERBEROS\n/*\n * Kerberos style authentication\n * AUTH *authkerb_seccreate(service, srv_inst, realm, window, timehost, status)\n *\tconst char *service;\t\t\t- service name\n *\tconst char *srv_inst;\t\t\t- server instance\n *\tconst char *realm;\t\t\t- server realm\n *\tconst u_int window;\t\t\t- time to live\n *\tconst char *timehost;\t\t\t- optional hostname to sync with\n *\tint *status;\t\t\t\t- kerberos status returned\n */\n__BEGIN_DECLS\nextern AUTH\t*authkerb_seccreate(const char *, const char *, const  char *,\n\t\t    const u_int, const char *, int *);\n__END_DECLS\n\n/*\n * Map a kerberos credential into a unix cred.\n *\n *\tauthkerb_getucred(rqst, uid, gid, grouplen, groups)\n *\tconst struct svc_req *rqst;\t\t- request pointer\n *\tuid_t *uid;\n *\tgid_t *gid;\n *\tshort *grouplen;\n *\tint *groups;\n *\n */\n__BEGIN_DECLS\nextern int\tauthkerb_getucred(/* struct svc_req *, uid_t *, gid_t *,\n\t\t    short *, int * */);\n__END_DECLS\n#endif /* KERBEROS */\n\n__BEGIN_DECLS\nstruct svc_req;\nstruct rpc_msg;\nenum auth_stat _svcauth_null (struct svc_req *, struct rpc_msg *);\nenum auth_stat _svcauth_short (struct svc_req *, struct rpc_msg *);\nenum auth_stat _svcauth_unix (struct svc_req *, struct rpc_msg *);\n__END_DECLS\n\n#define AUTH_NONE\t0\t\t/* no authentication */\n#define\tAUTH_NULL\t0\t\t/* backward compatibility */\n#define\tAUTH_SYS\t1\t\t/* unix style (uid, gids) */\n#define AUTH_UNIX\tAUTH_SYS\n#define\tAUTH_SHORT\t2\t\t/* short hand unix style */\n#define AUTH_DH\t\t3\t\t/* for Diffie-Hellman mechanism */\n#define AUTH_DES\tAUTH_DH\t\t/* for backward compatibility */\n#define AUTH_KERB\t4\t\t/* kerberos style */\n#define RPCSEC_GSS\t6\t\t/* RPCSEC_GSS */\n\n/*\n * Pseudo auth flavors for RPCSEC_GSS.\n */\n#define\tRPCSEC_GSS_KRB5\t\t390003\n#define\tRPCSEC_GSS_KRB5I\t390004\n#define\tRPCSEC_GSS_KRB5P\t390005\n\n#endif /* !_RPC_AUTH_H */\n"
  },
  {
    "path": "freebsd-headers/rpc/auth_des.h",
    "content": "/*\t@(#)auth_des.h\t2.2 88/07/29 4.0 RPCSRC; from 1.3 88/02/08 SMI */\n/*\t$FreeBSD: release/9.0.0/include/rpc/auth_des.h 93032 2002-03-23 17:24:55Z imp $ */\n/*\n * Sun RPC is a product of Sun Microsystems, Inc. and is provided for\n * unrestricted use provided that this legend is included on all tape\n * media and as a part of the software program in whole or part.  Users\n * may copy or modify Sun RPC without charge, but are not authorized\n * to license or distribute it to anyone else except as part of a product or\n * program developed by the user.\n * \n * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE\n * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR\n * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.\n * \n * Sun RPC is provided with no support and without any obligation on the\n * part of Sun Microsystems, Inc. to assist in its use, correction,\n * modification or enhancement.\n * \n * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE\n * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC\n * OR ANY PART THEREOF.\n * \n * In no event will Sun Microsystems, Inc. be liable for any lost revenue\n * or profits or other special, indirect and consequential damages, even if\n * Sun has been advised of the possibility of such damages.\n * \n * Sun Microsystems, Inc.\n * 2550 Garcia Avenue\n * Mountain View, California  94043\n * \n *\tfrom: @(#)auth_des.h 2.2 88/07/29 4.0 RPCSRC\n *\tfrom: @(#)auth_des.h 1.14    94/04/25 SMI\n */\n\n/*\n * Copyright (c) 1986 - 1991 by Sun Microsystems, Inc.\n */\n\n/*\n * auth_des.h, Protocol for DES style authentication for RPC\n */\n\n#ifndef _AUTH_DES_\n#define _AUTH_DES_\n\n/*\n * There are two kinds of \"names\": fullnames and nicknames\n */\nenum authdes_namekind {\n\tADN_FULLNAME, \n\tADN_NICKNAME\n};\n\n/*\n * A fullname contains the network name of the client, \n * a conversation key and the window\n */\nstruct authdes_fullname {\n\tchar *name;\t\t/* network name of client, up to MAXNETNAMELEN */\n\tdes_block key;\t\t/* conversation key */\n\tu_long window;\t\t/* associated window */\n};\n\n\n/*\n * A credential \n */\nstruct authdes_cred {\n\tenum authdes_namekind adc_namekind;\n\tstruct authdes_fullname adc_fullname;\n\tu_long adc_nickname;\n};\n\n\n\n/*\n * A des authentication verifier \n */\nstruct authdes_verf {\n\tunion {\n\t\tstruct timeval adv_ctime;\t/* clear time */\n\t\tdes_block adv_xtime;\t\t/* crypt time */\n\t} adv_time_u;\n\tu_long adv_int_u;\n};\n\n/*\n * des authentication verifier: client variety\n *\n * adv_timestamp is the current time.\n * adv_winverf is the credential window + 1.\n * Both are encrypted using the conversation key.\n */\n#define adv_timestamp\tadv_time_u.adv_ctime\n#define adv_xtimestamp\tadv_time_u.adv_xtime\n#define adv_winverf\tadv_int_u\n\n/*\n * des authentication verifier: server variety\n *\n * adv_timeverf is the client's timestamp + client's window\n * adv_nickname is the server's nickname for the client.\n * adv_timeverf is encrypted using the conversation key.\n */\n#define adv_timeverf\tadv_time_u.adv_ctime\n#define adv_xtimeverf\tadv_time_u.adv_xtime\n#define adv_nickname\tadv_int_u\n\n/*\n * Map a des credential into a unix cred.\n *\n */\n__BEGIN_DECLS\nextern int authdes_getucred( struct authdes_cred *, uid_t *, gid_t *, int *, gid_t * );\n__END_DECLS\n\n__BEGIN_DECLS\nextern bool_t\txdr_authdes_cred(XDR *, struct authdes_cred *);\nextern bool_t\txdr_authdes_verf(XDR *, struct authdes_verf *);\nextern int\trtime(dev_t, struct netbuf *, int, struct timeval *,\n\t\t    struct timeval *);\nextern void\tkgetnetname(char *);\nextern enum auth_stat _svcauth_des(struct svc_req *, struct rpc_msg *);\n__END_DECLS\n\n#endif /* ndef _AUTH_DES_ */\n"
  },
  {
    "path": "freebsd-headers/rpc/auth_kerb.h",
    "content": "/*\t$FreeBSD: release/9.0.0/include/rpc/auth_kerb.h 166431 2007-02-02 18:11:18Z schweikh $ */\n/*\n * Sun RPC is a product of Sun Microsystems, Inc. and is provided for\n * unrestricted use provided that this legend is included on all tape\n * media and as a part of the software program in whole or part.  Users\n * may copy or modify Sun RPC without charge, but are not authorized\n * to license or distribute it to anyone else except as part of a product or\n * program developed by the user.\n *\n * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE\n * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR\n * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.\n *\n * Sun RPC is provided with no support and without any obligation on the\n * part of Sun Microsystems, Inc. to assist in its use, correction,\n * modification or enhancement.\n *\n * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE\n * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC\n * OR ANY PART THEREOF.\n *\n * In no event will Sun Microsystems, Inc. be liable for any lost revenue\n * or profits or other special, indirect and consequential damages, even if\n * Sun has been advised of the possibility of such damages.\n *\n * Sun Microsystems, Inc.\n * 2550 Garcia Avenue\n * Mountain View, California  94043\n */\n/*\n * auth_kerb.h, Protocol for Kerberos style authentication for RPC\n *\n * Copyright (C) 1986, Sun Microsystems, Inc.\n */\n\n#ifndef\t_RPC_AUTH_KERB_H\n#define\t_RPC_AUTH_KERB_H\n\n#ifdef KERBEROS\n\n#include <kerberos/krb.h>\n#include <sys/socket.h>\n#include <sys/t_kuser.h>\n#include <netinet/in.h>\n#include <rpc/svc.h>\n\n/*\n * There are two kinds of \"names\": fullnames and nicknames\n */\nenum authkerb_namekind {\n\tAKN_FULLNAME,\n\tAKN_NICKNAME\n};\n/*\n * A fullname contains the ticket and the window\n */\nstruct authkerb_fullname {\n\tKTEXT_ST ticket;\n\tu_long window;\t\t/* associated window */\n};\n\n/*\n *  cooked credential stored in rq_clntcred\n */\nstruct authkerb_clnt_cred {\n\t/* start of AUTH_DAT */\n\tunsigned char k_flags;\t/* Flags from ticket */\n\tchar    pname[ANAME_SZ]; /* Principal's name */\n\tchar    pinst[INST_SZ];\t/* His Instance */\n\tchar    prealm[REALM_SZ]; /* His Realm */\n\tunsigned long checksum;\t/* Data checksum (opt) */\n\tC_Block session;\t/* Session Key */\n\tint\tlife;\t\t/* Life of ticket */\n\tunsigned long time_sec;\t/* Time ticket issued */\n\tunsigned long address;\t/* Address in ticket */\n\t/* KTEXT_ST reply;\tAuth reply (opt) */\n\t/* end of AUTH_DAT */\n\tunsigned long expiry;\t/* time the ticket is expiring */\n\tu_long nickname;\t/* Nickname into cache */\n\tu_long window;\t\t/* associated window */\n};\n\ntypedef struct authkerb_clnt_cred authkerb_clnt_cred;\n\n/*\n * A credential\n */\nstruct authkerb_cred {\n\tenum authkerb_namekind akc_namekind;\n\tstruct authkerb_fullname akc_fullname;\n\tu_long akc_nickname;\n};\n\n/*\n * A kerb authentication verifier\n */\nstruct authkerb_verf {\n\tunion {\n\t\tstruct timeval akv_ctime;\t/* clear time */\n\t\tdes_block akv_xtime;\t\t/* crypt time */\n\t} akv_time_u;\n\tu_long akv_int_u;\n};\n\n/*\n * des authentication verifier: client variety\n *\n * akv_timestamp is the current time.\n * akv_winverf is the credential window + 1.\n * Both are encrypted using the conversation key.\n */\n#ifndef akv_timestamp\n#define\takv_timestamp\takv_time_u.akv_ctime\n#define\takv_xtimestamp\takv_time_u.akv_xtime\n#define\takv_winverf\takv_int_u\n#endif\n/*\n * des authentication verifier: server variety\n *\n * akv_timeverf is the client's timestamp + client's window\n * akv_nickname is the server's nickname for the client.\n * akv_timeverf is encrypted using the conversation key.\n */\n#ifndef akv_timeverf\n#define\takv_timeverf\takv_time_u.akv_ctime\n#define\takv_xtimeverf\takv_time_u.akv_xtime\n#define\takv_nickname\takv_int_u\n#endif\n\n/*\n * Register the service name, instance and realm.\n */\nextern int\tauthkerb_create(char *, char *, char *, u_int,\n\t\t\tstruct netbuf *, int *, dev_t, int, AUTH **);\nextern bool_t\txdr_authkerb_cred(XDR *, struct authkerb_cred *);\nextern bool_t\txdr_authkerb_verf(XDR *, struct authkerb_verf *);\nextern int\tsvc_kerb_reg(SVCXPRT *, char *, char *, char *);\nextern enum auth_stat _svcauth_kerb(struct svc_req *, struct rpc_msg *);\n\n#endif\t/* KERBEROS */\n#endif\t/* !_RPC_AUTH_KERB_H */\n"
  },
  {
    "path": "freebsd-headers/rpc/auth_unix.h",
    "content": "/*\n * Sun RPC is a product of Sun Microsystems, Inc. and is provided for\n * unrestricted use provided that this legend is included on all tape\n * media and as a part of the software program in whole or part.  Users\n * may copy or modify Sun RPC without charge, but are not authorized\n * to license or distribute it to anyone else except as part of a product or\n * program developed by the user.\n *\n * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE\n * WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR\n * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.\n *\n * Sun RPC is provided with no support and without any obligation on the\n * part of Sun Microsystems, Inc. to assist in its use, correction,\n * modification or enhancement.\n *\n * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE\n * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC\n * OR ANY PART THEREOF.\n *\n * In no event will Sun Microsystems, Inc. be liable for any lost revenue\n * or profits or other special, indirect and consequential damages, even if\n * Sun has been advised of the possibility of such damages.\n *\n * Sun Microsystems, Inc.\n * 2550 Garcia Avenue\n * Mountain View, California  94043\n *\n *\tfrom: @(#)auth_unix.h 1.8 88/02/08 SMI\n *\tfrom: @(#)auth_unix.h\t2.2 88/07/29 4.0 RPCSRC\n * $FreeBSD: release/9.0.0/include/rpc/auth_unix.h 93032 2002-03-23 17:24:55Z imp $\n */\n\n/*\n * auth_unix.h, Protocol for UNIX style authentication parameters for RPC\n *\n * Copyright (C) 1984, Sun Microsystems, Inc.\n */\n\n/*\n * The system is very weak.  The client uses no encryption for  it\n * credentials and only sends null verifiers.  The server sends backs\n * null verifiers or optionally a verifier that suggests a new short hand\n * for the credentials.\n */\n\n#ifndef _RPC_AUTH_UNIX_H\n#define _RPC_AUTH_UNIX_H\n#include <sys/cdefs.h>\n\n/* The machine name is part of a credential; it may not exceed 255 bytes */\n#define MAX_MACHINE_NAME 255\n\n/* gids compose part of a credential; there may not be more than 16 of them */\n#define NGRPS 16\n\n/*\n * Unix style credentials.\n */\nstruct authunix_parms {\n\tu_long\t aup_time;\n\tchar\t*aup_machname;\n\tint\t aup_uid;\n\tint\t aup_gid;\n\tu_int\t aup_len;\n\tint\t*aup_gids;\n};\n\n#define authsys_parms authunix_parms\n\n__BEGIN_DECLS\nextern bool_t xdr_authunix_parms(XDR *, struct authunix_parms *);\n__END_DECLS\n\n/*\n * If a response verifier has flavor AUTH_SHORT,\n * then the body of the response verifier encapsulates the following structure;\n * again it is serialized in the obvious fashion.\n */\nstruct short_hand_verf {\n\tstruct opaque_auth new_cred;\n};\n\n#endif /* !_RPC_AUTH_UNIX_H */\n"
  },
  {
    "path": "freebsd-headers/rpc/clnt.h",
    "content": "/*\t$NetBSD: clnt.h,v 1.14 2000/06/02 22:57:55 fvdl Exp $\t*/\n\n/*\n * The contents of this file are subject to the Sun Standards\n * License Version 1.0 the (the \"License\";) You may not use\n * this file except in compliance with the License.  You may\n * obtain a copy of the License at lib/libc/rpc/LICENSE\n *\n * Software distributed under the License is distributed on\n * an \"AS IS\" basis, WITHOUT WARRANTY OF ANY KIND, either\n * express or implied.  See the License for the specific\n * language governing rights and limitations under the License.\n *\n * The Original Code is Copyright 1998 by Sun Microsystems, Inc\n *\n * The Initial Developer of the Original Code is:  Sun\n * Microsystems, Inc.\n *\n * All Rights Reserved.\n *\n * Sun RPC is a product of Sun Microsystems, Inc. and is provided for\n * unrestricted use provided that this legend is included on all tape\n * media and as a part of the software program in whole or part.  Users\n * may copy or modify Sun RPC without charge, but are not authorized\n * to license or distribute it to anyone else except as part of a product or\n * program developed by the user.\n *\n * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE\n * WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR\n * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.\n *\n * Sun RPC is provided with no support and without any obligation on the\n * part of Sun Microsystems, Inc. to assist in its use, correction,\n * modification or enhancement.\n *\n * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE\n * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC\n * OR ANY PART THEREOF.\n *\n * In no event will Sun Microsystems, Inc. be liable for any lost revenue\n * or profits or other special, indirect and consequential damages, even if\n * Sun has been advised of the possibility of such damages.\n *\n * Sun Microsystems, Inc.\n * 2550 Garcia Avenue\n * Mountain View, California  94043\n *\n *\tfrom: @(#)clnt.h 1.31 94/04/29 SMI\n *\tfrom: @(#)clnt.h\t2.1 88/07/29 4.0 RPCSRC\n * $FreeBSD: release/9.0.0/include/rpc/clnt.h 109773 2003-01-24 01:47:55Z fjoe $\n */\n\n/*\n * clnt.h - Client side remote procedure call interface.\n *\n * Copyright (c) 1986-1991,1994-1999 by Sun Microsystems, Inc.\n * All rights reserved.\n */\n\n#ifndef _RPC_CLNT_H_\n#define _RPC_CLNT_H_\n#include <rpc/clnt_stat.h>\n#include <sys/cdefs.h>\n#include <netconfig.h>\n#include <sys/un.h>\n\n/*\n * Well-known IPV6 RPC broadcast address.\n */\n#define RPCB_MULTICAST_ADDR \"ff02::202\"\n\n/*\n * the following errors are in general unrecoverable.  The caller\n * should give up rather than retry.\n */\n#define IS_UNRECOVERABLE_RPC(s) (((s) == RPC_AUTHERROR) || \\\n\t((s) == RPC_CANTENCODEARGS) || \\\n\t((s) == RPC_CANTDECODERES) || \\\n\t((s) == RPC_VERSMISMATCH) || \\\n\t((s) == RPC_PROCUNAVAIL) || \\\n\t((s) == RPC_PROGUNAVAIL) || \\\n\t((s) == RPC_PROGVERSMISMATCH) || \\\n\t((s) == RPC_CANTDECODEARGS))\n\n/*\n * Error info.\n */\nstruct rpc_err {\n\tenum clnt_stat re_status;\n\tunion {\n\t\tint RE_errno;\t\t/* related system error */\n\t\tenum auth_stat RE_why;\t/* why the auth error occurred */\n\t\tstruct {\n\t\t\trpcvers_t low;\t/* lowest version supported */\n\t\t\trpcvers_t high;\t/* highest version supported */\n\t\t} RE_vers;\n\t\tstruct {\t\t/* maybe meaningful if RPC_FAILED */\n\t\t\tint32_t s1;\n\t\t\tint32_t s2;\n\t\t} RE_lb;\t\t/* life boot & debugging only */\n\t} ru;\n#define\tre_errno\tru.RE_errno\n#define\tre_why\t\tru.RE_why\n#define\tre_vers\t\tru.RE_vers\n#define\tre_lb\t\tru.RE_lb\n};\n\n\n/*\n * Client rpc handle.\n * Created by individual implementations\n * Client is responsible for initializing auth, see e.g. auth_none.c.\n */\ntypedef struct __rpc_client {\n\tAUTH\t*cl_auth;\t\t\t/* authenticator */\n\tstruct clnt_ops {\n\t\t/* call remote procedure */\n\t\tenum clnt_stat\t(*cl_call)(struct __rpc_client *,\n\t\t\t\t    rpcproc_t, xdrproc_t, void *, xdrproc_t,\n\t\t\t\t        void *, struct timeval);\n\t\t/* abort a call */\n\t\tvoid\t\t(*cl_abort)(struct __rpc_client *);\n\t\t/* get specific error code */\n\t\tvoid\t\t(*cl_geterr)(struct __rpc_client *,\n\t\t\t\t\tstruct rpc_err *);\n\t\t/* frees results */\n\t\tbool_t\t\t(*cl_freeres)(struct __rpc_client *,\n\t\t\t\t\txdrproc_t, void *);\n\t\t/* destroy this structure */\n\t\tvoid\t\t(*cl_destroy)(struct __rpc_client *);\n\t\t/* the ioctl() of rpc */\n\t\tbool_t          (*cl_control)(struct __rpc_client *, u_int,\n\t\t\t\t    void *);\n\t} *cl_ops;\n\tvoid \t\t\t*cl_private;\t/* private stuff */\n\tchar\t\t\t*cl_netid;\t/* network token */\n\tchar\t\t\t*cl_tp;\t\t/* device name */\n} CLIENT;\n\n\n/*\n * Timers used for the pseudo-transport protocol when using datagrams\n */\nstruct rpc_timers {\n\tu_short\t\trt_srtt;\t/* smoothed round-trip time */\n\tu_short\t\trt_deviate;\t/* estimated deviation */\n\tu_long\t\trt_rtxcur;\t/* current (backed-off) rto */\n};\n\n/*      \n * Feedback values used for possible congestion and rate control\n */\n#define FEEDBACK_REXMIT1\t1\t/* first retransmit */\n#define FEEDBACK_OK\t\t2\t/* no retransmits */    \n\n/* Used to set version of portmapper used in broadcast */\n  \n#define CLCR_SET_LOWVERS\t3\n#define CLCR_GET_LOWVERS\t4\n \n#define RPCSMALLMSGSIZE 400\t/* a more reasonable packet size */\n\n/*\n * client side rpc interface ops\n *\n * Parameter types are:\n *\n */\n\n/*\n * enum clnt_stat\n * CLNT_CALL(rh, proc, xargs, argsp, xres, resp, timeout)\n * \tCLIENT *rh;\n *\trpcproc_t proc;\n *\txdrproc_t xargs;\n *\tvoid *argsp;\n *\txdrproc_t xres;\n *\tvoid *resp;\n *\tstruct timeval timeout;\n */\n#define\tCLNT_CALL(rh, proc, xargs, argsp, xres, resp, secs) \\\n\t((*(rh)->cl_ops->cl_call)(rh, proc, xargs, \\\n\t\targsp, xres, resp, secs))\n#define\tclnt_call(rh, proc, xargs, argsp, xres, resp, secs) \\\n\t((*(rh)->cl_ops->cl_call)(rh, proc, xargs, \\\n\t\targsp, xres, resp, secs))\n\n/*\n * void\n * CLNT_ABORT(rh);\n * \tCLIENT *rh;\n */\n#define\tCLNT_ABORT(rh)\t((*(rh)->cl_ops->cl_abort)(rh))\n#define\tclnt_abort(rh)\t((*(rh)->cl_ops->cl_abort)(rh))\n\n/*\n * struct rpc_err\n * CLNT_GETERR(rh);\n * \tCLIENT *rh;\n */\n#define\tCLNT_GETERR(rh,errp)\t((*(rh)->cl_ops->cl_geterr)(rh, errp))\n#define\tclnt_geterr(rh,errp)\t((*(rh)->cl_ops->cl_geterr)(rh, errp))\n\n\n/*\n * bool_t\n * CLNT_FREERES(rh, xres, resp);\n * \tCLIENT *rh;\n *\txdrproc_t xres;\n *\tvoid *resp;\n */\n#define\tCLNT_FREERES(rh,xres,resp) ((*(rh)->cl_ops->cl_freeres)(rh,xres,resp))\n#define\tclnt_freeres(rh,xres,resp) ((*(rh)->cl_ops->cl_freeres)(rh,xres,resp))\n\n/*\n * bool_t\n * CLNT_CONTROL(cl, request, info)\n *      CLIENT *cl;\n *      u_int request;\n *      char *info;\n */\n#define\tCLNT_CONTROL(cl,rq,in) ((*(cl)->cl_ops->cl_control)(cl,rq,in))\n#define\tclnt_control(cl,rq,in) ((*(cl)->cl_ops->cl_control)(cl,rq,in))\n\n/*\n * control operations that apply to both udp and tcp transports\n */\n#define CLSET_TIMEOUT\t\t1\t/* set timeout (timeval) */\n#define CLGET_TIMEOUT\t\t2\t/* get timeout (timeval) */\n#define CLGET_SERVER_ADDR\t3\t/* get server's address (sockaddr) */\n#define CLGET_FD\t\t6\t/* get connections file descriptor */\n#define CLGET_SVC_ADDR\t\t7\t/* get server's address (netbuf) */\n#define CLSET_FD_CLOSE\t\t8\t/* close fd while clnt_destroy */\n#define CLSET_FD_NCLOSE\t\t9\t/* Do not close fd while clnt_destroy */\n#define CLGET_XID \t\t10\t/* Get xid */\n#define CLSET_XID\t\t11\t/* Set xid */\n#define CLGET_VERS\t\t12\t/* Get version number */\n#define CLSET_VERS\t\t13\t/* Set version number */\n#define CLGET_PROG\t\t14\t/* Get program number */\n#define CLSET_PROG\t\t15\t/* Set program number */\n#define CLSET_SVC_ADDR\t\t16\t/* get server's address (netbuf) */\n#define CLSET_PUSH_TIMOD\t17\t/* push timod if not already present */\n#define CLSET_POP_TIMOD\t\t18\t/* pop timod */\n/*\n * Connectionless only control operations\n */\n#define CLSET_RETRY_TIMEOUT 4   /* set retry timeout (timeval) */\n#define CLGET_RETRY_TIMEOUT 5   /* get retry timeout (timeval) */\n#define CLSET_ASYNC\t\t19\n#define CLSET_CONNECT\t\t20\t/* Use connect() for UDP. (int) */\n\n/*\n * void\n * CLNT_DESTROY(rh);\n * \tCLIENT *rh;\n */\n#define\tCLNT_DESTROY(rh)\t((*(rh)->cl_ops->cl_destroy)(rh))\n#define\tclnt_destroy(rh)\t((*(rh)->cl_ops->cl_destroy)(rh))\n\n\n/*\n * RPCTEST is a test program which is accessible on every rpc\n * transport/port.  It is used for testing, performance evaluation,\n * and network administration.\n */\n\n#define RPCTEST_PROGRAM\t\t((rpcprog_t)1)\n#define RPCTEST_VERSION\t\t((rpcvers_t)1)\n#define RPCTEST_NULL_PROC\t((rpcproc_t)2)\n#define RPCTEST_NULL_BATCH_PROC\t((rpcproc_t)3)\n\n/*\n * By convention, procedure 0 takes null arguments and returns them\n */\n\n#define NULLPROC ((rpcproc_t)0)\n\n/*\n * Below are the client handle creation routines for the various\n * implementations of client side rpc.  They can return NULL if a\n * creation failure occurs.\n */\n\n/*\n * Generic client creation routine. Supported protocols are those that\n * belong to the nettype namespace (/etc/netconfig).\n */\n__BEGIN_DECLS\nextern CLIENT *clnt_create(const char *, const rpcprog_t, const rpcvers_t,\n\t\t\t   const char *);\n/*\n *\n * \tconst char *hostname;\t\t\t-- hostname\n *\tconst rpcprog_t prog;\t\t\t-- program number\n *\tconst rpcvers_t vers;\t\t\t-- version number\n *\tconst char *nettype;\t\t\t-- network type\n */\n\n /*\n * Generic client creation routine. Just like clnt_create(), except\n * it takes an additional timeout parameter.\n */\nextern CLIENT * clnt_create_timed(const char *, const rpcprog_t,\n\tconst rpcvers_t, const char *, const struct timeval *);\n/*\n *\n *\tconst char *hostname;\t\t\t-- hostname\n *\tconst rpcprog_t prog;\t\t\t-- program number\n *\tconst rpcvers_t vers;\t\t\t-- version number\n *\tconst char *nettype;\t\t\t-- network type\n *\tconst struct timeval *tp;\t\t-- timeout\n */\n\n/*\n * Generic client creation routine. Supported protocols are which belong\n * to the nettype name space.\n */\nextern CLIENT *clnt_create_vers(const char *, const rpcprog_t, rpcvers_t *,\n\t\t\t\tconst rpcvers_t, const rpcvers_t,\n\t\t\t\tconst char *);\n/*\n *\tconst char *host;\t\t-- hostname\n *\tconst rpcprog_t prog;\t\t-- program number\n *\trpcvers_t *vers_out;\t\t-- servers highest available version\n *\tconst rpcvers_t vers_low;\t-- low version number\n *\tconst rpcvers_t vers_high;\t-- high version number\n *\tconst char *nettype;\t\t-- network type\n */\n\n/*\n * Generic client creation routine. Supported protocols are which belong\n * to the nettype name space.\n */\nextern CLIENT * clnt_create_vers_timed(const char *, const rpcprog_t,\n\trpcvers_t *, const rpcvers_t, const rpcvers_t, const char *,\n\tconst struct timeval *);\n/*\n *\tconst char *host;\t\t-- hostname\n *\tconst rpcprog_t prog;\t\t-- program number\n *\trpcvers_t *vers_out;\t\t-- servers highest available version\n *\tconst rpcvers_t vers_low;\t-- low version number\n *\tconst rpcvers_t vers_high;\t-- high version number\n *\tconst char *nettype;\t\t-- network type\n *\tconst struct timeval *tp\t-- timeout\n */\n\n/*\n * Generic client creation routine. It takes a netconfig structure\n * instead of nettype\n */\nextern CLIENT *clnt_tp_create(const char *, const rpcprog_t,\n\t\t\t      const rpcvers_t, const struct netconfig *);\n/*\n *\tconst char *hostname;\t\t\t-- hostname\n *\tconst rpcprog_t prog;\t\t\t-- program number\n *\tconst rpcvers_t vers;\t\t\t-- version number\n *\tconst struct netconfig *netconf; \t-- network config structure\n */\n\n/*\n * Generic client creation routine. Just like clnt_tp_create(), except\n * it takes an additional timeout parameter.\n */\nextern CLIENT * clnt_tp_create_timed(const char *, const rpcprog_t,\n\tconst rpcvers_t, const struct netconfig *, const struct timeval *);\n/*\n *\tconst char *hostname;\t\t\t-- hostname\n *\tconst rpcprog_t prog;\t\t\t-- program number\n *\tconst rpcvers_t vers;\t\t\t-- version number\n *\tconst struct netconfig *netconf; \t-- network config structure\n *\tconst struct timeval *tp\t\t-- timeout\n */\n\n/*\n * Generic TLI create routine. Only provided for compatibility.\n */\n\nextern CLIENT *clnt_tli_create(const int, const struct netconfig *,\n\t\t\t       struct netbuf *, const rpcprog_t,\n\t\t\t       const rpcvers_t, const u_int, const u_int);\n/*\n *\tconst register int fd;\t\t-- fd\n *\tconst struct netconfig *nconf;\t-- netconfig structure\n *\tstruct netbuf *svcaddr;\t\t-- servers address\n *\tconst u_long prog;\t\t\t-- program number\n *\tconst u_long vers;\t\t\t-- version number\n *\tconst u_int sendsz;\t\t\t-- send size\n *\tconst u_int recvsz;\t\t\t-- recv size\n */\n\n/*\n * Low level clnt create routine for connectionful transports, e.g. tcp.\n */\nextern CLIENT *clnt_vc_create(const int, const struct netbuf *,\n\t\t\t      const rpcprog_t, const rpcvers_t,\n\t\t\t      u_int, u_int);\n/*\n * Added for compatibility to old rpc 4.0. Obsoleted by clnt_vc_create().\n */\nextern CLIENT *clntunix_create(struct sockaddr_un *,\n\t\t\t       u_long, u_long, int *, u_int, u_int);\n/*\n *\tconst int fd;\t\t\t\t-- open file descriptor\n *\tconst struct netbuf *svcaddr;\t\t-- servers address\n *\tconst rpcprog_t prog;\t\t\t-- program number\n *\tconst rpcvers_t vers;\t\t\t-- version number\n *\tconst u_int sendsz;\t\t\t-- buffer recv size\n *\tconst u_int recvsz;\t\t\t-- buffer send size\n */\n\n/*\n * Low level clnt create routine for connectionless transports, e.g. udp.\n */\nextern CLIENT *clnt_dg_create(const int, const struct netbuf *,\n\t\t\t      const rpcprog_t, const rpcvers_t,\n\t\t\t      const u_int, const u_int);\n/*\n *\tconst int fd;\t\t\t\t-- open file descriptor\n *\tconst struct netbuf *svcaddr;\t\t-- servers address\n *\tconst rpcprog_t program;\t\t-- program number\n *\tconst rpcvers_t version;\t\t-- version number\n *\tconst u_int sendsz;\t\t\t-- buffer recv size\n *\tconst u_int recvsz;\t\t\t-- buffer send size\n */\n\n/*\n * Memory based rpc (for speed check and testing)\n * CLIENT *\n * clnt_raw_create(prog, vers)\n *\tu_long prog;\n *\tu_long vers;\n */\nextern CLIENT *clnt_raw_create(rpcprog_t, rpcvers_t);\n\n__END_DECLS\n\n\n/*\n * Print why creation failed\n */\n__BEGIN_DECLS\nextern void clnt_pcreateerror(const char *);\t\t\t/* stderr */\nextern char *clnt_spcreateerror(const char *);\t\t\t/* string */\n__END_DECLS\n\n/*\n * Like clnt_perror(), but is more verbose in its output\n */\n__BEGIN_DECLS\nextern void clnt_perrno(enum clnt_stat);\t\t/* stderr */\nextern char *clnt_sperrno(enum clnt_stat);\t\t/* string */\n__END_DECLS\n\n/*\n * Print an English error message, given the client error code\n */\n__BEGIN_DECLS\nextern void clnt_perror(CLIENT *, const char *);\t \t/* stderr */\nextern char *clnt_sperror(CLIENT *, const char *);\t\t/* string */\n__END_DECLS\n\n\n/*\n * If a creation fails, the following allows the user to figure out why.\n */\nstruct rpc_createerr {\n\tenum clnt_stat cf_stat;\n\tstruct rpc_err cf_error; /* useful when cf_stat == RPC_PMAPFAILURE */\n};\n\n__BEGIN_DECLS\nextern struct rpc_createerr\t*__rpc_createerr(void);\n__END_DECLS\n#define rpc_createerr\t\t(*(__rpc_createerr()))\n\n/*\n * The simplified interface:\n * enum clnt_stat\n * rpc_call(host, prognum, versnum, procnum, inproc, in, outproc, out, nettype)\n *\tconst char *host;\n *\tconst rpcprog_t prognum;\n *\tconst rpcvers_t versnum;\n *\tconst rpcproc_t procnum;\n *\tconst xdrproc_t inproc, outproc;\n *\tconst char *in;\n *\tchar *out;\n *\tconst char *nettype;\n */\n__BEGIN_DECLS\nextern enum clnt_stat rpc_call(const char *, const rpcprog_t,\n\t\t\t       const rpcvers_t, const rpcproc_t,\n\t\t\t       const xdrproc_t, const char *,\n\t\t\t       const xdrproc_t, char *, const char *);\n__END_DECLS\n\n/*\n * RPC broadcast interface\n * The call is broadcasted to all locally connected nets.\n *\n * extern enum clnt_stat\n * rpc_broadcast(prog, vers, proc, xargs, argsp, xresults, resultsp,\n *\t\t\teachresult, nettype)\n *\tconst rpcprog_t\t\tprog;\t\t-- program number\n *\tconst rpcvers_t\t\tvers;\t\t-- version number\n *\tconst rpcproc_t\t\tproc;\t\t-- procedure number\n *\tconst xdrproc_t\txargs;\t\t-- xdr routine for args\n *\tcaddr_t\t\targsp;\t\t-- pointer to args\n *\tconst xdrproc_t\txresults;\t-- xdr routine for results\n *\tcaddr_t\t\tresultsp;\t-- pointer to results\n *\tconst resultproc_t\teachresult;\t-- call with each result\n *\tconst char\t\t*nettype;\t-- Transport type\n *\n * For each valid response received, the procedure eachresult is called.\n * Its form is:\n *\t\tdone = eachresult(resp, raddr, nconf)\n *\t\t\tbool_t done;\n *\t\t\tcaddr_t resp;\n *\t\t\tstruct netbuf *raddr;\n *\t\t\tstruct netconfig *nconf;\n * where resp points to the results of the call and raddr is the\n * address if the responder to the broadcast.  nconf is the transport\n * on which the response was received.\n *\n * extern enum clnt_stat\n * rpc_broadcast_exp(prog, vers, proc, xargs, argsp, xresults, resultsp,\n *\t\t\teachresult, inittime, waittime, nettype)\n *\tconst rpcprog_t\t\tprog;\t\t-- program number\n *\tconst rpcvers_t\t\tvers;\t\t-- version number\n *\tconst rpcproc_t\t\tproc;\t\t-- procedure number\n *\tconst xdrproc_t\txargs;\t\t-- xdr routine for args\n *\tcaddr_t\t\targsp;\t\t-- pointer to args\n *\tconst xdrproc_t\txresults;\t-- xdr routine for results\n *\tcaddr_t\t\tresultsp;\t-- pointer to results\n *\tconst resultproc_t\teachresult;\t-- call with each result\n *\tconst int \t\tinittime;\t-- how long to wait initially\n *\tconst int \t\twaittime;\t-- maximum time to wait\n *\tconst char\t\t*nettype;\t-- Transport type\n */\n\ntypedef bool_t (*resultproc_t)(caddr_t, ...);\n\n__BEGIN_DECLS\nextern enum clnt_stat rpc_broadcast(const rpcprog_t, const rpcvers_t,\n\t\t\t\t    const rpcproc_t, const xdrproc_t,\n\t\t\t\t    caddr_t, const xdrproc_t, caddr_t,\n\t\t\t\t    const resultproc_t, const char *);\nextern enum clnt_stat rpc_broadcast_exp(const rpcprog_t, const rpcvers_t,\n\t\t\t\t\tconst rpcproc_t, const xdrproc_t,\n\t\t\t\t\tcaddr_t, const xdrproc_t, caddr_t,\n\t\t\t\t\tconst resultproc_t, const int,\n\t\t\t\t\tconst int, const char *);\n__END_DECLS\n\n/* For backward compatibility */\n#include <rpc/clnt_soc.h>\n\n#endif /* !_RPC_CLNT_H_ */\n"
  },
  {
    "path": "freebsd-headers/rpc/clnt_soc.h",
    "content": "/*\t$NetBSD: clnt_soc.h,v 1.1 2000/06/02 22:57:55 fvdl Exp $\t*/\n/*\t$FreeBSD: release/9.0.0/include/rpc/clnt_soc.h 93032 2002-03-23 17:24:55Z imp $ */\n\n/*\n * Sun RPC is a product of Sun Microsystems, Inc. and is provided for\n * unrestricted use provided that this legend is included on all tape\n * media and as a part of the software program in whole or part.  Users\n * may copy or modify Sun RPC without charge, but are not authorized\n * to license or distribute it to anyone else except as part of a product or\n * program developed by the user.\n * \n * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE\n * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR\n * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.\n * \n * Sun RPC is provided with no support and without any obligation on the\n * part of Sun Microsystems, Inc. to assist in its use, correction,\n * modification or enhancement.\n * \n * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE\n * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC\n * OR ANY PART THEREOF.\n * \n * In no event will Sun Microsystems, Inc. be liable for any lost revenue\n * or profits or other special, indirect and consequential damages, even if\n * Sun has been advised of the possibility of such damages.\n * \n * Sun Microsystems, Inc.\n * 2550 Garcia Avenue\n * Mountain View, California  94043\n */\n/*\n * Copyright (c) 1984 - 1991 by Sun Microsystems, Inc.\n */\n\n/*\n * clnt.h - Client side remote procedure call interface.\n */\n\n#ifndef _RPC_CLNT_SOC_H\n#define _RPC_CLNT_SOC_H\n\n/* derived from clnt_soc.h 1.3 88/12/17 SMI     */\n\n/*\n * All the following declarations are only for backward compatibility\n * with TS-RPC.\n */\n\n#include <sys/cdefs.h>\n\n#define UDPMSGSIZE      8800    /* rpc imposed limit on udp msg size */  \n\n/*\n * TCP based rpc\n * CLIENT *\n * clnttcp_create(raddr, prog, vers, sockp, sendsz, recvsz)\n *\tstruct sockaddr_in *raddr;\n *\tu_long prog;\n *\tu_long version;\n *\tregister int *sockp;\n *\tu_int sendsz;\n *\tu_int recvsz;\n */\n__BEGIN_DECLS\nextern CLIENT *clnttcp_create(struct sockaddr_in *, u_long, u_long, int *,\n\t\t\t      u_int, u_int);\n__END_DECLS\n\n/*\n * Raw (memory) rpc.\n */\n__BEGIN_DECLS\nextern CLIENT *clntraw_create(u_long, u_long);\n__END_DECLS\n\n\n/*\n * UDP based rpc.\n * CLIENT *\n * clntudp_create(raddr, program, version, wait, sockp)\n *\tstruct sockaddr_in *raddr;\n *\tu_long program;\n *\tu_long version;\n *\tstruct timeval wait;\n *\tint *sockp;\n *\n * Same as above, but you specify max packet sizes.\n * CLIENT *\n * clntudp_bufcreate(raddr, program, version, wait, sockp, sendsz, recvsz)\n *\tstruct sockaddr_in *raddr;\n *\tu_long program;\n *\tu_long version;\n *\tstruct timeval wait;\n *\tint *sockp;\n *\tu_int sendsz;\n *\tu_int recvsz;\n */\n__BEGIN_DECLS\nextern CLIENT *clntudp_create(struct sockaddr_in *, u_long, u_long, \n\t\t\t      struct timeval, int *);\nextern CLIENT *clntudp_bufcreate(struct sockaddr_in *, u_long, u_long,\n\t\t\t\t struct timeval, int *, u_int, u_int);\n__END_DECLS\n\n#endif /* _RPC_CLNT_SOC_H */\n"
  },
  {
    "path": "freebsd-headers/rpc/clnt_stat.h",
    "content": "/*\t$FreeBSD: release/9.0.0/include/rpc/clnt_stat.h 74509 2001-03-20 08:20:50Z alfred $ */\n/*\n * Copyright (c) 1986 - 1991, 1994, 1996, 1997 by Sun Microsystems, Inc.\n * All rights reserved.\n */\n\n/*\n * clnt_stat.h - Client side remote procedure call enum\n *\n */\n\n#ifndef\t_RPC_CLNT_STAT_H\n#define\t_RPC_CLNT_STAT_H\n\n/* #pragma ident\t\"@(#)clnt_stat.h\t1.2\t97/04/28 SMI\" */\n\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\nenum clnt_stat {\n\tRPC_SUCCESS = 0,\t\t\t/* call succeeded */\n\t/*\n\t * local errors\n\t */\n\tRPC_CANTENCODEARGS = 1,\t\t/* can't encode arguments */\n\tRPC_CANTDECODERES = 2,\t\t/* can't decode results */\n\tRPC_CANTSEND = 3,\t\t\t/* failure in sending call */\n\tRPC_CANTRECV = 4,\n\t/* failure in receiving result */\n\tRPC_TIMEDOUT = 5,\t\t\t/* call timed out */\n\tRPC_INTR = 18,\t\t\t/* call interrupted */\n\tRPC_UDERROR = 23,\t\t\t/* recv got uderr indication */\n\t/*\n\t * remote errors\n\t */\n\tRPC_VERSMISMATCH = 6,\t\t/* rpc versions not compatible */\n\tRPC_AUTHERROR = 7,\t\t/* authentication error */\n\tRPC_PROGUNAVAIL = 8,\t\t/* program not available */\n\tRPC_PROGVERSMISMATCH = 9,\t/* program version mismatched */\n\tRPC_PROCUNAVAIL = 10,\t\t/* procedure unavailable */\n\tRPC_CANTDECODEARGS = 11,\t\t/* decode arguments error */\n\tRPC_SYSTEMERROR = 12,\t\t/* generic \"other problem\" */\n\n\t/*\n\t * rpc_call & clnt_create errors\n\t */\n\tRPC_UNKNOWNHOST = 13,\t\t/* unknown host name */\n\tRPC_UNKNOWNPROTO = 17,\t\t/* unknown protocol */\n\tRPC_UNKNOWNADDR = 19,\t\t/* Remote address unknown */\n\tRPC_NOBROADCAST = 21,\t\t/* Broadcasting not supported */\n\n\t/*\n\t * rpcbind errors\n\t */\n\tRPC_RPCBFAILURE = 14,\t\t/* the pmapper failed in its call */\n#define\tRPC_PMAPFAILURE RPC_RPCBFAILURE\n\tRPC_PROGNOTREGISTERED = 15,\t/* remote program is not registered */\n\tRPC_N2AXLATEFAILURE = 22,\n\t/* Name to address translation failed */\n\t/*\n\t * Misc error in the TLI library\n\t */\n\tRPC_TLIERROR = 20,\n\t/*\n\t * unspecified error\n\t */\n\tRPC_FAILED = 16,\n\t/*\n\t * asynchronous errors\n\t */\n\tRPC_INPROGRESS = 24,\n\tRPC_STALERACHANDLE = 25,\n\tRPC_CANTCONNECT = 26,\t\t/* couldn't make connection (cots) */\n\tRPC_XPRTFAILED = 27,\t\t/* received discon from remote (cots) */\n\tRPC_CANTCREATESTREAM = 28\t/* can't push rpc module (cots) */\n};\n\n#ifdef __cplusplus\n}\n#endif\n\n#endif\t/* !_RPC_CLNT_STAT_H */\n"
  },
  {
    "path": "freebsd-headers/rpc/des.h",
    "content": "/*  @(#)des.h\t2.2 88/08/10 4.0 RPCSRC; from 2.7 88/02/08 SMI  */\n/* $FreeBSD: release/9.0.0/include/rpc/des.h 93032 2002-03-23 17:24:55Z imp $ */\n/*\n * Sun RPC is a product of Sun Microsystems, Inc. and is provided for\n * unrestricted use provided that this legend is included on all tape\n * media and as a part of the software program in whole or part.  Users\n * may copy or modify Sun RPC without charge, but are not authorized\n * to license or distribute it to anyone else except as part of a product or\n * program developed by the user.\n * \n * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE\n * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR\n * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.\n * \n * Sun RPC is provided with no support and without any obligation on the\n * part of Sun Microsystems, Inc. to assist in its use, correction,\n * modification or enhancement.\n * \n * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE\n * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC\n * OR ANY PART THEREOF.\n * \n * In no event will Sun Microsystems, Inc. be liable for any lost revenue\n * or profits or other special, indirect and consequential damages, even if\n * Sun has been advised of the possibility of such damages.\n * \n * Sun Microsystems, Inc.\n * 2550 Garcia Avenue\n * Mountain View, California  94043\n */\n/*\n * Generic DES driver interface\n * Keep this file hardware independent!\n * Copyright (c) 1986 by Sun Microsystems, Inc.\n */\n\n#define DES_MAXLEN \t65536\t/* maximum # of bytes to encrypt  */\n#define DES_QUICKLEN\t16\t/* maximum # of bytes to encrypt quickly */\n\nenum desdir { ENCRYPT, DECRYPT };\nenum desmode { CBC, ECB };\n\n/*\n * parameters to ioctl call\n */\nstruct desparams {\n\tu_char des_key[8];\t/* key (with low bit parity) */\n\tenum desdir des_dir;\t/* direction */\n\tenum desmode des_mode;\t/* mode */\n\tu_char des_ivec[8];\t/* input vector */\n\tunsigned des_len;\t/* number of bytes to crypt */\n\tunion {\n\t\tu_char UDES_data[DES_QUICKLEN];\n\t\tu_char *UDES_buf;\n\t} UDES;\n#\tdefine des_data UDES.UDES_data\t/* direct data here if quick */\n#\tdefine des_buf\tUDES.UDES_buf\t/* otherwise, pointer to data */\n};\n\n#ifdef notdef\n\n/*\n * These ioctls are only implemented in SunOS. Maybe someday\n * if somebody writes a driver for DES hardware that works\n * with FreeBSD, we can being that back.\n */\n\n/*\n * Encrypt an arbitrary sized buffer\n */\n#define\tDESIOCBLOCK\t_IOWR('d', 6, struct desparams)\n\n/* \n * Encrypt of small amount of data, quickly\n */\n#define DESIOCQUICK\t_IOWR('d', 7, struct desparams) \n\n#endif\n\n/*\n * Software DES.\n */\nextern int _des_crypt( char *, int, struct desparams * );\n"
  },
  {
    "path": "freebsd-headers/rpc/des_crypt.h",
    "content": "/*\n * @(#)des_crypt.h\t2.1 88/08/11 4.0 RPCSRC;\tfrom 1.4 88/02/08 (C) 1986 SMI\n * $FreeBSD: release/9.0.0/include/rpc/des_crypt.h 93032 2002-03-23 17:24:55Z imp $\n *\n * des_crypt.h, des library routine interface\n * Copyright (C) 1986, Sun Microsystems, Inc.\n */\n/*\n * Sun RPC is a product of Sun Microsystems, Inc. and is provided for\n * unrestricted use provided that this legend is included on all tape\n * media and as a part of the software program in whole or part.  Users\n * may copy or modify Sun RPC without charge, but are not authorized\n * to license or distribute it to anyone else except as part of a product or\n * program developed by the user.\n * \n * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE\n * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR\n * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.\n * \n * Sun RPC is provided with no support and without any obligation on the\n * part of Sun Microsystems, Inc. to assist in its use, correction,\n * modification or enhancement.\n * \n * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE\n * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC\n * OR ANY PART THEREOF.\n * \n * In no event will Sun Microsystems, Inc. be liable for any lost revenue\n * or profits or other special, indirect and consequential damages, even if\n * Sun has been advised of the possibility of such damages.\n * \n * Sun Microsystems, Inc.\n * 2550 Garcia Avenue\n * Mountain View, California  94043\n */\n/*\n * Copyright (c) 1986 - 1991 by Sun Microsystems, Inc.\n */\n\n/*\n * des_crypt.h, des library routine interface\n */\n\n#ifndef _DES_DES_CRYPT_H\n#define _DES_DES_CRYPT_H\n\n#include <sys/cdefs.h>\n#include <rpc/rpc.h>\n\n#define DES_MAXDATA 8192\t/* max bytes encrypted in one call */\n#define DES_DIRMASK (1 << 0)\n#define DES_ENCRYPT (0*DES_DIRMASK)\t/* Encrypt */\n#define DES_DECRYPT (1*DES_DIRMASK)\t/* Decrypt */\n\n\n#define DES_DEVMASK (1 << 1)\n#define\tDES_HW (0*DES_DEVMASK)\t/* Use hardware device */ \n#define DES_SW (1*DES_DEVMASK)\t/* Use software device */\n\n\n#define DESERR_NONE 0\t/* succeeded */\n#define DESERR_NOHWDEVICE 1\t/* succeeded, but hw device not available */\n#define DESERR_HWERROR 2\t/* failed, hardware/driver error */\n#define DESERR_BADPARAM 3\t/* failed, bad parameter to call */\n\n#define DES_FAILED(err) \\\n\t((err) > DESERR_NOHWDEVICE)\n\n/*\n * cbc_crypt()\n * ecb_crypt()\n *\n * Encrypt (or decrypt) len bytes of a buffer buf.\n * The length must be a multiple of eight.\n * The key should have odd parity in the low bit of each byte.\n * ivec is the input vector, and is updated to the new one (cbc only).\n * The mode is created by oring together the appropriate parameters.\n * DESERR_NOHWDEVICE is returned if DES_HW was specified but\n * there was no hardware to do it on (the data will still be\n * encrypted though, in software).\n */\n\n\n/*\n * Cipher Block Chaining mode\n */\n__BEGIN_DECLS\nint cbc_crypt( char *, char *, unsigned int, unsigned int, char *);\n__END_DECLS\n\n/*\n * Electronic Code Book mode\n */\n__BEGIN_DECLS\nint ecb_crypt( char *, char *, unsigned int, unsigned int );\n__END_DECLS\n\n/* \n * Set des parity for a key.\n * DES parity is odd and in the low bit of each byte\n */\n__BEGIN_DECLS\nvoid des_setparity( char *);\n__END_DECLS\n\n#endif  /* _DES_DES_CRYPT_H */\n"
  },
  {
    "path": "freebsd-headers/rpc/key_prot.h",
    "content": "/*\n * Please do not edit this file.\n * It was generated using rpcgen.\n */\n\n#ifndef _KEY_PROT_H_RPCGEN\n#define\t_KEY_PROT_H_RPCGEN\n\n#include <rpc/rpc.h>\n\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\n/*\n * Sun RPC is a product of Sun Microsystems, Inc. and is provided for\n * unrestricted use provided that this legend is included on all tape\n * media and as a part of the software program in whole or part.  Users\n * may copy or modify Sun RPC without charge, but are not authorized\n * to license or distribute it to anyone else except as part of a product or\n * program developed by the user.\n *\n * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE\n * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR\n * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.\n *\n * Sun RPC is provided with no support and without any obligation on the\n * part of Sun Microsystems, Inc. to assist in its use, correction,\n * modification or enhancement.\n *\n * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE\n * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC\n * OR ANY PART THEREOF.\n *\n * In no event will Sun Microsystems, Inc. be liable for any lost revenue\n * or profits or other special, indirect and consequential damages, even if\n * Sun has been advised of the possibility of such damages.\n *\n * Sun Microsystems, Inc.\n * 2550 Garcia Avenue\n * Mountain View, California  94043\n */\n/* From: #pragma ident\t\"@(#)key_prot.x\t1.7\t94/04/29 SMI\" */\n/* Copyright (c)  1990, 1991 Sun Microsystems, Inc. */\n#include <sys/cdefs.h>\n__FBSDID(\"$FreeBSD: release/9.0.0/include/rpcsvc/key_prot.x 114629 2003-05-04 02:51:42Z obrien $\");\n\n/* \n * Compiled from key_prot.x using rpcgen.\n * DO NOT EDIT THIS FILE!\n * This is NOT source code!\n */\n#define\tPROOT 3\n#define\tHEXMODULUS \"d4a0ba0250b6fd2ec626e7efd637df76c716e22d0944b88b\"\n#define\tHEXKEYBYTES 48\n#define\tKEYSIZE 192\n#define\tKEYBYTES 24\n#define\tKEYCHECKSUMSIZE 16\n\nenum keystatus {\n\tKEY_SUCCESS = 0,\n\tKEY_NOSECRET = 1,\n\tKEY_UNKNOWN = 2,\n\tKEY_SYSTEMERR = 3\n};\ntypedef enum keystatus keystatus;\n\ntypedef char keybuf[HEXKEYBYTES];\n\ntypedef char *netnamestr;\n\nstruct cryptkeyarg {\n\tnetnamestr remotename;\n\tdes_block deskey;\n};\ntypedef struct cryptkeyarg cryptkeyarg;\n\nstruct cryptkeyarg2 {\n\tnetnamestr remotename;\n\tnetobj remotekey;\n\tdes_block deskey;\n};\ntypedef struct cryptkeyarg2 cryptkeyarg2;\n\nstruct cryptkeyres {\n\tkeystatus status;\n\tunion {\n\t\tdes_block deskey;\n\t} cryptkeyres_u;\n};\ntypedef struct cryptkeyres cryptkeyres;\n#define\tMAXGIDS 16\n\nstruct unixcred {\n\tu_int uid;\n\tu_int gid;\n\tstruct {\n\t\tu_int gids_len;\n\t\tu_int *gids_val;\n\t} gids;\n};\ntypedef struct unixcred unixcred;\n\nstruct getcredres {\n\tkeystatus status;\n\tunion {\n\t\tunixcred cred;\n\t} getcredres_u;\n};\ntypedef struct getcredres getcredres;\n\nstruct key_netstarg {\n\tkeybuf st_priv_key;\n\tkeybuf st_pub_key;\n\tnetnamestr st_netname;\n};\ntypedef struct key_netstarg key_netstarg;\n\nstruct key_netstres {\n\tkeystatus status;\n\tunion {\n\t\tkey_netstarg knet;\n\t} key_netstres_u;\n};\ntypedef struct key_netstres key_netstres;\n\n#ifndef opaque\n#define opaque char\n#endif\n\n\n#define\tKEY_PROG ((unsigned long)(100029))\n#define\tKEY_VERS ((unsigned long)(1))\n\nextern  void key_prog_1(struct svc_req *rqstp, SVCXPRT *transp);\n#define\tKEY_SET ((unsigned long)(1))\nextern  keystatus * key_set_1(char *, CLIENT *);\nextern  keystatus * key_set_1_svc(char *, struct svc_req *);\n#define\tKEY_ENCRYPT ((unsigned long)(2))\nextern  cryptkeyres * key_encrypt_1(cryptkeyarg *, CLIENT *);\nextern  cryptkeyres * key_encrypt_1_svc(cryptkeyarg *, struct svc_req *);\n#define\tKEY_DECRYPT ((unsigned long)(3))\nextern  cryptkeyres * key_decrypt_1(cryptkeyarg *, CLIENT *);\nextern  cryptkeyres * key_decrypt_1_svc(cryptkeyarg *, struct svc_req *);\n#define\tKEY_GEN ((unsigned long)(4))\nextern  des_block * key_gen_1(void *, CLIENT *);\nextern  des_block * key_gen_1_svc(void *, struct svc_req *);\n#define\tKEY_GETCRED ((unsigned long)(5))\nextern  getcredres * key_getcred_1(netnamestr *, CLIENT *);\nextern  getcredres * key_getcred_1_svc(netnamestr *, struct svc_req *);\nextern int key_prog_1_freeresult(SVCXPRT *, xdrproc_t, caddr_t);\n#define\tKEY_VERS2 ((unsigned long)(2))\n\nextern  void key_prog_2(struct svc_req *rqstp, SVCXPRT *transp);\nextern  keystatus * key_set_2(char *, CLIENT *);\nextern  keystatus * key_set_2_svc(char *, struct svc_req *);\nextern  cryptkeyres * key_encrypt_2(cryptkeyarg *, CLIENT *);\nextern  cryptkeyres * key_encrypt_2_svc(cryptkeyarg *, struct svc_req *);\nextern  cryptkeyres * key_decrypt_2(cryptkeyarg *, CLIENT *);\nextern  cryptkeyres * key_decrypt_2_svc(cryptkeyarg *, struct svc_req *);\nextern  des_block * key_gen_2(void *, CLIENT *);\nextern  des_block * key_gen_2_svc(void *, struct svc_req *);\nextern  getcredres * key_getcred_2(netnamestr *, CLIENT *);\nextern  getcredres * key_getcred_2_svc(netnamestr *, struct svc_req *);\n#define\tKEY_ENCRYPT_PK ((unsigned long)(6))\nextern  cryptkeyres * key_encrypt_pk_2(cryptkeyarg2 *, CLIENT *);\nextern  cryptkeyres * key_encrypt_pk_2_svc(cryptkeyarg2 *, struct svc_req *);\n#define\tKEY_DECRYPT_PK ((unsigned long)(7))\nextern  cryptkeyres * key_decrypt_pk_2(cryptkeyarg2 *, CLIENT *);\nextern  cryptkeyres * key_decrypt_pk_2_svc(cryptkeyarg2 *, struct svc_req *);\n#define\tKEY_NET_PUT ((unsigned long)(8))\nextern  keystatus * key_net_put_2(key_netstarg *, CLIENT *);\nextern  keystatus * key_net_put_2_svc(key_netstarg *, struct svc_req *);\n#define\tKEY_NET_GET ((unsigned long)(9))\nextern  key_netstres * key_net_get_2(void *, CLIENT *);\nextern  key_netstres * key_net_get_2_svc(void *, struct svc_req *);\n#define\tKEY_GET_CONV ((unsigned long)(10))\nextern  cryptkeyres * key_get_conv_2(char *, CLIENT *);\nextern  cryptkeyres * key_get_conv_2_svc(char *, struct svc_req *);\nextern int key_prog_2_freeresult(SVCXPRT *, xdrproc_t, caddr_t);\n\n/* the xdr functions */\nextern  bool_t xdr_keystatus(XDR *, keystatus*);\nextern  bool_t xdr_keybuf(XDR *, keybuf);\nextern  bool_t xdr_netnamestr(XDR *, netnamestr*);\nextern  bool_t xdr_cryptkeyarg(XDR *, cryptkeyarg*);\nextern  bool_t xdr_cryptkeyarg2(XDR *, cryptkeyarg2*);\nextern  bool_t xdr_cryptkeyres(XDR *, cryptkeyres*);\nextern  bool_t xdr_unixcred(XDR *, unixcred*);\nextern  bool_t xdr_getcredres(XDR *, getcredres*);\nextern  bool_t xdr_key_netstarg(XDR *, key_netstarg*);\nextern  bool_t xdr_key_netstres(XDR *, key_netstres*);\n\n#ifdef __cplusplus\n}\n#endif\n\n#endif /* !_KEY_PROT_H_RPCGEN */\n"
  },
  {
    "path": "freebsd-headers/rpc/nettype.h",
    "content": "/*\t$NetBSD: nettype.h,v 1.2 2000/07/06 03:17:19 christos Exp $\t*/\n/*\t$FreeBSD: release/9.0.0/include/rpc/nettype.h 93032 2002-03-23 17:24:55Z imp $ */\n\n/*\n * Sun RPC is a product of Sun Microsystems, Inc. and is provided for\n * unrestricted use provided that this legend is included on all tape\n * media and as a part of the software program in whole or part.  Users\n * may copy or modify Sun RPC without charge, but are not authorized\n * to license or distribute it to anyone else except as part of a product or\n * program developed by the user.\n *\n * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE\n * WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR\n * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.\n *\n * Sun RPC is provided with no support and without any obligation on the\n * part of Sun Microsystems, Inc. to assist in its use, correction,\n * modification or enhancement.\n *\n * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE\n * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC\n * OR ANY PART THEREOF.\n *\n * In no event will Sun Microsystems, Inc. be liable for any lost revenue\n * or profits or other special, indirect and consequential damages, even if\n * Sun has been advised of the possibility of such damages.\n *\n * Sun Microsystems, Inc.\n * 2550 Garcia Avenue\n * Mountain View, California  94043\n */\n/*\n * Copyright (c) 1986 - 1991 by Sun Microsystems, Inc.\n */\n\n/*\n * nettype.h, Nettype definitions.\n * All for the topmost layer of rpc\n *\n */\n\n#ifndef\t_RPC_NETTYPE_H\n#define\t_RPC_NETTYPE_H\n\n#include <netconfig.h>\n\n#define\t_RPC_NONE\t0\n#define\t_RPC_NETPATH\t1\n#define\t_RPC_VISIBLE\t2\n#define\t_RPC_CIRCUIT_V\t3\n#define\t_RPC_DATAGRAM_V\t4\n#define\t_RPC_CIRCUIT_N\t5\n#define\t_RPC_DATAGRAM_N\t6\n#define\t_RPC_TCP\t7\n#define\t_RPC_UDP\t8\n\n__BEGIN_DECLS\nextern void *__rpc_setconf(const char *);\nextern void __rpc_endconf(void *);\nextern struct netconfig *__rpc_getconf(void *);\nextern struct netconfig *__rpc_getconfip(const char *);\n__END_DECLS\n\n#endif\t/* !_RPC_NETTYPE_H */\n"
  },
  {
    "path": "freebsd-headers/rpc/pmap_clnt.h",
    "content": "/*\t$NetBSD: pmap_clnt.h,v 1.9 2000/06/02 22:57:55 fvdl Exp $\t*/\n\n/*\n * Sun RPC is a product of Sun Microsystems, Inc. and is provided for\n * unrestricted use provided that this legend is included on all tape\n * media and as a part of the software program in whole or part.  Users\n * may copy or modify Sun RPC without charge, but are not authorized\n * to license or distribute it to anyone else except as part of a product or\n * program developed by the user.\n *\n * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE\n * WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR\n * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.\n *\n * Sun RPC is provided with no support and without any obligation on the\n * part of Sun Microsystems, Inc. to assist in its use, correction,\n * modification or enhancement.\n *\n * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE\n * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC\n * OR ANY PART THEREOF.\n *\n * In no event will Sun Microsystems, Inc. be liable for any lost revenue\n * or profits or other special, indirect and consequential damages, even if\n * Sun has been advised of the possibility of such damages.\n *\n * Sun Microsystems, Inc.\n * 2550 Garcia Avenue\n * Mountain View, California  94043\n *\n *\tfrom: @(#)pmap_clnt.h 1.11 88/02/08 SMI \n *\tfrom: @(#)pmap_clnt.h\t2.1 88/07/29 4.0 RPCSRC\n * $FreeBSD: release/9.0.0/include/rpc/pmap_clnt.h 95658 2002-04-28 15:18:50Z des $\n */\n\n/*\n * pmap_clnt.h\n * Supplies C routines to get to portmap services.\n *\n * Copyright (C) 1984, Sun Microsystems, Inc.\n */\n\n/*\n * Usage:\n *\tsuccess = pmap_set(program, version, protocol, port);\n *\tsuccess = pmap_unset(program, version);\n *\tport = pmap_getport(address, program, version, protocol);\n *\thead = pmap_getmaps(address);\n *\tclnt_stat = pmap_rmtcall(address, program, version, procedure,\n *\t\txdrargs, argsp, xdrres, resp, tout, port_ptr)\n *\t\t(works for udp only.)\n * \tclnt_stat = clnt_broadcast(program, version, procedure,\n *\t\txdrargs, argsp,\txdrres, resp, eachresult)\n *\t\t(like pmap_rmtcall, except the call is broadcasted to all\n *\t\tlocally connected nets.  For each valid response received,\n *\t\tthe procedure eachresult is called.  Its form is:\n *\tdone = eachresult(resp, raddr)\n *\t\tbool_t done;\n *\t\tcaddr_t resp;\n *\t\tstruct sockaddr_in raddr;\n *\t\twhere resp points to the results of the call and raddr is the\n *\t\taddress if the responder to the broadcast.\n */\n\n#ifndef _RPC_PMAP_CLNT_H_\n#define _RPC_PMAP_CLNT_H_\n#include <sys/cdefs.h>\n\n__BEGIN_DECLS\nextern bool_t\t\tpmap_set(u_long, u_long, int, int);\nextern bool_t\t\tpmap_unset(u_long, u_long);\nextern struct pmaplist\t*pmap_getmaps(struct sockaddr_in *);\nextern enum clnt_stat\tpmap_rmtcall(struct sockaddr_in *,\n\t\t\t\t     u_long, u_long, u_long,\n\t\t\t\t     xdrproc_t, caddr_t,\n\t\t\t\t     xdrproc_t, caddr_t,\n\t\t\t\t     struct timeval, u_long *);\nextern enum clnt_stat\tclnt_broadcast(u_long, u_long, u_long,\n\t\t\t\t       xdrproc_t, void *,\n\t\t\t\t       xdrproc_t, void *,\n\t\t\t\t       resultproc_t);\nextern u_short\t\tpmap_getport(struct sockaddr_in *,\n\t\t\t\t     u_long, u_long, u_int);\n__END_DECLS\n\n#endif /* !_RPC_PMAP_CLNT_H_ */\n"
  },
  {
    "path": "freebsd-headers/rpc/pmap_prot.h",
    "content": "/*\t$NetBSD: pmap_prot.h,v 1.8 2000/06/02 22:57:55 fvdl Exp $\t*/\n\n/*\n * Sun RPC is a product of Sun Microsystems, Inc. and is provided for\n * unrestricted use provided that this legend is included on all tape\n * media and as a part of the software program in whole or part.  Users\n * may copy or modify Sun RPC without charge, but are not authorized\n * to license or distribute it to anyone else except as part of a product or\n * program developed by the user.\n *\n * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE\n * WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR\n * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.\n *\n * Sun RPC is provided with no support and without any obligation on the\n * part of Sun Microsystems, Inc. to assist in its use, correction,\n * modification or enhancement.\n *\n * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE\n * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC\n * OR ANY PART THEREOF.\n *\n * In no event will Sun Microsystems, Inc. be liable for any lost revenue\n * or profits or other special, indirect and consequential damages, even if\n * Sun has been advised of the possibility of such damages.\n *\n * Sun Microsystems, Inc.\n * 2550 Garcia Avenue\n * Mountain View, California  94043\n *\n *\tfrom: @(#)pmap_prot.h 1.14 88/02/08 SMI \n *\tfrom: @(#)pmap_prot.h\t2.1 88/07/29 4.0 RPCSRC\n * $FreeBSD: release/9.0.0/include/rpc/pmap_prot.h 93032 2002-03-23 17:24:55Z imp $\n */\n\n/*\n * pmap_prot.h\n * Protocol for the local binder service, or pmap.\n *\n * Copyright (C) 1984, Sun Microsystems, Inc.\n *\n * The following procedures are supported by the protocol:\n *\n * PMAPPROC_NULL() returns ()\n * \ttakes nothing, returns nothing\n *\n * PMAPPROC_SET(struct pmap) returns (bool_t)\n * \tTRUE is success, FALSE is failure.  Registers the tuple\n *\t[prog, vers, prot, port].\n *\n * PMAPPROC_UNSET(struct pmap) returns (bool_t)\n *\tTRUE is success, FALSE is failure.  Un-registers pair\n *\t[prog, vers].  prot and port are ignored.\n *\n * PMAPPROC_GETPORT(struct pmap) returns (long unsigned).\n *\t0 is failure.  Otherwise returns the port number where the pair\n *\t[prog, vers] is registered.  It may lie!\n *\n * PMAPPROC_DUMP() RETURNS (struct pmaplist *)\n *\n * PMAPPROC_CALLIT(unsigned, unsigned, unsigned, string<>)\n * \tRETURNS (port, string<>);\n * usage: encapsulatedresults = PMAPPROC_CALLIT(prog, vers, proc, encapsulatedargs);\n * \tCalls the procedure on the local machine.  If it is not registered,\n *\tthis procedure is quite; ie it does not return error information!!!\n *\tThis procedure only is supported on rpc/udp and calls via\n *\trpc/udp.  This routine only passes null authentication parameters.\n *\tThis file has no interface to xdr routines for PMAPPROC_CALLIT.\n *\n * The service supports remote procedure calls on udp/ip or tcp/ip socket 111.\n */\n\n#ifndef _RPC_PMAP_PROT_H\n#define _RPC_PMAP_PROT_H\n#include <sys/cdefs.h>\n\n#define PMAPPORT\t\t((u_short)111)\n#define PMAPPROG\t\t((u_long)100000)\n#define PMAPVERS\t\t((u_long)2)\n#define PMAPVERS_PROTO\t\t((u_long)2)\n#define PMAPVERS_ORIG\t\t((u_long)1)\n#define PMAPPROC_NULL\t\t((u_long)0)\n#define PMAPPROC_SET\t\t((u_long)1)\n#define PMAPPROC_UNSET\t\t((u_long)2)\n#define PMAPPROC_GETPORT\t((u_long)3)\n#define PMAPPROC_DUMP\t\t((u_long)4)\n#define PMAPPROC_CALLIT\t\t((u_long)5)\n\nstruct pmap {\n\tlong unsigned pm_prog;\n\tlong unsigned pm_vers;\n\tlong unsigned pm_prot;\n\tlong unsigned pm_port;\n};\n\nstruct pmaplist {\n\tstruct pmap\tpml_map;\n\tstruct pmaplist *pml_next;\n};\n\n__BEGIN_DECLS\nextern bool_t xdr_pmap(XDR *, struct pmap *);\nextern bool_t xdr_pmaplist(XDR *, struct pmaplist **);\nextern bool_t xdr_pmaplist_ptr(XDR *, struct pmaplist *);\n__END_DECLS\n\n#endif /* !_RPC_PMAP_PROT_H */\n"
  },
  {
    "path": "freebsd-headers/rpc/pmap_rmt.h",
    "content": "/*\t$NetBSD: pmap_rmt.h,v 1.7 1998/02/11 23:01:23 lukem Exp $\t*/\n\n/*\n * Sun RPC is a product of Sun Microsystems, Inc. and is provided for\n * unrestricted use provided that this legend is included on all tape\n * media and as a part of the software program in whole or part.  Users\n * may copy or modify Sun RPC without charge, but are not authorized\n * to license or distribute it to anyone else except as part of a product or\n * program developed by the user.\n *\n * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE\n * WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR\n * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.\n *\n * Sun RPC is provided with no support and without any obligation on the\n * part of Sun Microsystems, Inc. to assist in its use, correction,\n * modification or enhancement.\n *\n * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE\n * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC\n * OR ANY PART THEREOF.\n *\n * In no event will Sun Microsystems, Inc. be liable for any lost revenue\n * or profits or other special, indirect and consequential damages, even if\n * Sun has been advised of the possibility of such damages.\n *\n * Sun Microsystems, Inc.\n * 2550 Garcia Avenue\n * Mountain View, California  94043\n *\n *\tfrom: @(#)pmap_rmt.h 1.2 88/02/08 SMI\n *\tfrom: @(#)pmap_rmt.h\t2.1 88/07/29 4.0 RPCSRC\n * $FreeBSD: release/9.0.0/include/rpc/pmap_rmt.h 93032 2002-03-23 17:24:55Z imp $\n */\n\n/*\n * Structures and XDR routines for parameters to and replies from\n * the portmapper remote-call-service.\n *\n * Copyright (C) 1986, Sun Microsystems, Inc.\n */\n\n#ifndef _RPC_PMAP_RMT_H\n#define _RPC_PMAP_RMT_H\n#include <sys/cdefs.h>\n\nstruct rmtcallargs {\n\tu_long prog, vers, proc, arglen;\n\tcaddr_t args_ptr;\n\txdrproc_t xdr_args;\n};\n\nstruct rmtcallres {\n\tu_long *port_ptr;\n\tu_long resultslen;\n\tcaddr_t results_ptr;\n\txdrproc_t xdr_results;\n};\n\n__BEGIN_DECLS\nextern bool_t xdr_rmtcall_args(XDR *, struct rmtcallargs *);\nextern bool_t xdr_rmtcallres(XDR *, struct rmtcallres *);\n__END_DECLS\n\n#endif /* !_RPC_PMAP_RMT_H */\n"
  },
  {
    "path": "freebsd-headers/rpc/raw.h",
    "content": "/*\t$NetBSD: raw.h,v 1.1 2000/06/02 22:57:56 fvdl Exp $\t*/\n/*\t$FreeBSD: release/9.0.0/include/rpc/raw.h 74462 2001-03-19 12:50:13Z alfred $ */\n\n/*\n * Sun RPC is a product of Sun Microsystems, Inc. and is provided for\n * unrestricted use provided that this legend is included on all tape\n * media and as a part of the software program in whole or part.  Users\n * may copy or modify Sun RPC without charge, but are not authorized\n * to license or distribute it to anyone else except as part of a product or\n * program developed by the user.\n * \n * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE\n * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR\n * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.\n * \n * Sun RPC is provided with no support and without any obligation on the\n * part of Sun Microsystems, Inc. to assist in its use, correction,\n * modification or enhancement.\n * \n * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE\n * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC\n * OR ANY PART THEREOF.\n * \n * In no event will Sun Microsystems, Inc. be liable for any lost revenue\n * or profits or other special, indirect and consequential damages, even if\n * Sun has been advised of the possibility of such damages.\n * \n * Sun Microsystems, Inc.\n * 2550 Garcia Avenue\n * Mountain View, California  94043\n */\n/*\n * Copyright (c) 1986 - 1991 by Sun Microsystems, Inc.\n */\n\n#ifndef _RPC_RAW_H\n#define\t_RPC_RAW_H\n\n/* \tfrom: @(#)raw.h\t1.11\t94/04/25 SMI */\n/*\tfrom: @(#)raw.h 1.2 88/10/25 SMI\t*/\n\n#ifdef\t__cplusplus\nextern \"C\" {\n#endif\n\n/*\n * raw.h\n *\n * Raw interface\n * The common memory area over which they will communicate\n */\nextern char *__rpc_rawcombuf;\n\n#ifdef\t__cplusplus\n}\n#endif\n\n#endif\t/* _RPC_RAW_H */\n"
  },
  {
    "path": "freebsd-headers/rpc/rpc.h",
    "content": "/*\t$NetBSD: rpc.h,v 1.13 2000/06/02 22:57:56 fvdl Exp $\t*/\n\n/*\n * Sun RPC is a product of Sun Microsystems, Inc. and is provided for\n * unrestricted use provided that this legend is included on all tape\n * media and as a part of the software program in whole or part.  Users\n * may copy or modify Sun RPC without charge, but are not authorized\n * to license or distribute it to anyone else except as part of a product or\n * program developed by the user.\n *\n * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE\n * WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR\n * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.\n *\n * Sun RPC is provided with no support and without any obligation on the\n * part of Sun Microsystems, Inc. to assist in its use, correction,\n * modification or enhancement.\n *\n * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE\n * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC\n * OR ANY PART THEREOF.\n *\n * In no event will Sun Microsystems, Inc. be liable for any lost revenue\n * or profits or other special, indirect and consequential damages, even if\n * Sun has been advised of the possibility of such damages.\n *\n * Sun Microsystems, Inc.\n * 2550 Garcia Avenue\n * Mountain View, California  94043\n *\n *\tfrom: @(#)rpc.h 1.9 88/02/08 SMI\n *\tfrom: @(#)rpc.h\t2.4 89/07/11 4.0 RPCSRC\n * $FreeBSD: release/9.0.0/include/rpc/rpc.h 93032 2002-03-23 17:24:55Z imp $\n */\n\n/*\n * rpc.h, Just includes the billions of rpc header files necessary to\n * do remote procedure calling.\n *\n * Copyright (C) 1984, Sun Microsystems, Inc.\n */\n#ifndef _RPC_RPC_H\n#define _RPC_RPC_H\n\n#include <rpc/types.h>\t\t/* some typedefs */\n#include <sys/socket.h>\n#include <netinet/in.h>\n\n/* external data representation interfaces */\n#include <rpc/xdr.h>\t\t/* generic (de)serializer */\n\n/* Client side only authentication */\n#include <rpc/auth.h>\t\t/* generic authenticator (client side) */\n\n/* Client side (mostly) remote procedure call */\n#include <rpc/clnt.h>\t\t/* generic rpc stuff */\n\n/* semi-private protocol headers */\n#include <rpc/rpc_msg.h>\t/* protocol for rpc messages */\n#include <rpc/auth_unix.h>\t/* protocol for unix style cred */\n/*\n *  Uncomment-out the next line if you are building the rpc library with\n *  DES Authentication (see the README file in the secure_rpc/ directory).\n */\n#include <rpc/auth_des.h>\t/* protocol for des style cred */\n\n/* Server side only remote procedure callee */\n#include <rpc/svc.h>\t\t/* service manager and multiplexer */\n#include <rpc/svc_auth.h>\t/* service side authenticator */\n\n/* Portmapper client, server, and protocol headers */\n#include <rpc/pmap_clnt.h>\n#include <rpc/pmap_prot.h>\n\n#ifndef _KERNEL\n#include <rpc/rpcb_clnt.h>\t/* rpcbind interface functions */\n#endif\n\n#include <rpc/rpcent.h>\n\n__BEGIN_DECLS\nextern int get_myaddress(struct sockaddr_in *);\nextern int bindresvport(int, struct sockaddr_in *);\nextern int registerrpc(int, int, int, char *(*)(char [UDPMSGSIZE]),\n    xdrproc_t, xdrproc_t);\nextern int callrpc(const char *, int, int, int, xdrproc_t, void *,\n    xdrproc_t , void *);\nextern int getrpcport(char *, int, int, int);\n\nchar *taddr2uaddr(const struct netconfig *, const struct netbuf *);\nstruct netbuf *uaddr2taddr(const struct netconfig *, const char *);\n\nstruct sockaddr;\nextern int bindresvport_sa(int, struct sockaddr *);\n__END_DECLS\n\n/*\n * The following are not exported interfaces, they are for internal library\n * and rpcbind use only. Do not use, they may change without notice.\n */\n__BEGIN_DECLS\nint __rpc_nconf2fd(const struct netconfig *);\nint __rpc_nconf2sockinfo(const struct netconfig *, struct __rpc_sockinfo *);\nint __rpc_fd2sockinfo(int, struct __rpc_sockinfo *);\nu_int __rpc_get_t_size(int, int, int);\n__END_DECLS\n\n#endif /* !_RPC_RPC_H */\n"
  },
  {
    "path": "freebsd-headers/rpc/rpc_com.h",
    "content": "/*\t$NetBSD: rpc_com.h,v 1.3 2000/12/10 04:10:08 christos Exp $\t*/\n/*\t$FreeBSD: release/9.0.0/include/rpc/rpc_com.h 109359 2003-01-16 07:13:51Z mbr $ */\n\n/*\n * Sun RPC is a product of Sun Microsystems, Inc. and is provided for\n * unrestricted use provided that this legend is included on all tape\n * media and as a part of the software program in whole or part.  Users\n * may copy or modify Sun RPC without charge, but are not authorized\n * to license or distribute it to anyone else except as part of a product or\n * program developed by the user.\n * \n * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE\n * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR\n * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.\n * \n * Sun RPC is provided with no support and without any obligation on the\n * part of Sun Microsystems, Inc. to assist in its use, correction,\n * modification or enhancement.\n * \n * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE\n * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC\n * OR ANY PART THEREOF.\n * \n * In no event will Sun Microsystems, Inc. be liable for any lost revenue\n * or profits or other special, indirect and consequential damages, even if\n * Sun has been advised of the possibility of such damages.\n * \n * Sun Microsystems, Inc.\n * 2550 Garcia Avenue\n * Mountain View, California  94043\n */\n/*\n * Copyright (c) 1986 - 1991 by Sun Microsystems, Inc.\n */\n\n/*\n * rpc_com.h, Common definitions for both the server and client side.\n * All for the topmost layer of rpc\n *\n */\n\n#ifndef _RPC_RPCCOM_H\n#define\t_RPC_RPCCOM_H\n\n#include <sys/cdefs.h>\n\n/* #pragma ident\t\"@(#)rpc_com.h\t1.11\t93/07/05 SMI\" */\n\n/*\n * The max size of the transport, if the size cannot be determined\n * by other means.\n */\n#define\tRPC_MAXDATASIZE 9000\n#define\tRPC_MAXADDRSIZE 1024\n\n#define __RPC_GETXID(now) ((u_int32_t)getpid() ^ (u_int32_t)(now)->tv_sec ^ \\\n    (u_int32_t)(now)->tv_usec)\n\n__BEGIN_DECLS\nextern u_int __rpc_get_a_size(int);\nextern int __rpc_dtbsize(void);\nextern int _rpc_dtablesize(void);\nextern struct netconfig * __rpcgettp(int);\nextern  int  __rpc_get_default_domain(char **);\n\nchar *__rpc_taddr2uaddr_af(int, const struct netbuf *);\nstruct netbuf *__rpc_uaddr2taddr_af(int, const char *);\nint __rpc_fixup_addr(struct netbuf *, const struct netbuf *);\nint __rpc_sockinfo2netid(struct __rpc_sockinfo *, const char **);\nint __rpc_seman2socktype(int);\nint __rpc_socktype2seman(int);\nvoid *rpc_nullproc(CLIENT *);\nint __rpc_sockisbound(int);\n\nstruct netbuf *__rpcb_findaddr(rpcprog_t, rpcvers_t, const struct netconfig *,\n\t\t\t       const char *, CLIENT **);\nbool_t rpc_control(int,void *);\n\nchar *_get_next_token(char *, int);\n\n__END_DECLS\n\n#endif /* _RPC_RPCCOM_H */\n"
  },
  {
    "path": "freebsd-headers/rpc/rpc_msg.h",
    "content": "/*\t$NetBSD: rpc_msg.h,v 1.11 2000/06/02 22:57:56 fvdl Exp $\t*/\n\n/*\n * Sun RPC is a product of Sun Microsystems, Inc. and is provided for\n * unrestricted use provided that this legend is included on all tape\n * media and as a part of the software program in whole or part.  Users\n * may copy or modify Sun RPC without charge, but are not authorized\n * to license or distribute it to anyone else except as part of a product or\n * program developed by the user.\n *\n * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE\n * WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR\n * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.\n *\n * Sun RPC is provided with no support and without any obligation on the\n * part of Sun Microsystems, Inc. to assist in its use, correction,\n * modification or enhancement.\n *\n * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE\n * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC\n * OR ANY PART THEREOF.\n *\n * In no event will Sun Microsystems, Inc. be liable for any lost revenue\n * or profits or other special, indirect and consequential damages, even if\n * Sun has been advised of the possibility of such damages.\n *\n * Sun Microsystems, Inc.\n * 2550 Garcia Avenue\n * Mountain View, California  94043\n *\n *\tfrom: @(#)rpc_msg.h 1.7 86/07/16 SMI\n *\tfrom: @(#)rpc_msg.h\t2.1 88/07/29 4.0 RPCSRC\n * $FreeBSD: release/9.0.0/include/rpc/rpc_msg.h 108533 2003-01-01 18:49:04Z schweikh $\n */\n\n/*\n * rpc_msg.h\n * rpc message definition\n *\n * Copyright (C) 1984, Sun Microsystems, Inc.\n */\n\n#ifndef _RPC_RPC_MSG_H\n#define _RPC_RPC_MSG_H\n\n#define RPC_MSG_VERSION\t\t((u_int32_t) 2)\n#define RPC_SERVICE_PORT\t((u_short) 2048)\n\n/*\n * Bottom up definition of an rpc message.\n * NOTE: call and reply use the same overall stuct but\n * different parts of unions within it.\n */\n\nenum msg_type {\n\tCALL=0,\n\tREPLY=1\n};\n\nenum reply_stat {\n\tMSG_ACCEPTED=0,\n\tMSG_DENIED=1\n};\n\nenum accept_stat {\n\tSUCCESS=0,\n\tPROG_UNAVAIL=1,\n\tPROG_MISMATCH=2,\n\tPROC_UNAVAIL=3,\n\tGARBAGE_ARGS=4,\n\tSYSTEM_ERR=5\n};\n\nenum reject_stat {\n\tRPC_MISMATCH=0,\n\tAUTH_ERROR=1\n};\n\n/*\n * Reply part of an rpc exchange\n */\n\n/*\n * Reply to an rpc request that was accepted by the server.\n * Note: there could be an error even though the request was\n * accepted.\n */\nstruct accepted_reply {\n\tstruct opaque_auth\tar_verf;\n\tenum accept_stat\tar_stat;\n\tunion {\n\t\tstruct {\n\t\t\trpcvers_t low;\n\t\t\trpcvers_t high;\n\t\t} AR_versions;\n\t\tstruct {\n\t\t\tcaddr_t\twhere;\n\t\t\txdrproc_t proc;\n\t\t} AR_results;\n\t\t/* and many other null cases */\n\t} ru;\n#define\tar_results\tru.AR_results\n#define\tar_vers\t\tru.AR_versions\n};\n\n/*\n * Reply to an rpc request that was rejected by the server.\n */\nstruct rejected_reply {\n\tenum reject_stat rj_stat;\n\tunion {\n\t\tstruct {\n\t\t\trpcvers_t low;\n\t\t\trpcvers_t high;\n\t\t} RJ_versions;\n\t\tenum auth_stat RJ_why;  /* why authentication did not work */\n\t} ru;\n#define\trj_vers\tru.RJ_versions\n#define\trj_why\tru.RJ_why\n};\n\n/*\n * Body of a reply to an rpc request.\n */\nstruct reply_body {\n\tenum reply_stat rp_stat;\n\tunion {\n\t\tstruct accepted_reply RP_ar;\n\t\tstruct rejected_reply RP_dr;\n\t} ru;\n#define\trp_acpt\tru.RP_ar\n#define\trp_rjct\tru.RP_dr\n};\n\n/*\n * Body of an rpc request call.\n */\nstruct call_body {\n\trpcvers_t cb_rpcvers;\t/* must be equal to two */\n\trpcprog_t cb_prog;\n\trpcvers_t cb_vers;\n\trpcproc_t cb_proc;\n\tstruct opaque_auth cb_cred;\n\tstruct opaque_auth cb_verf; /* protocol specific - provided by client */\n};\n\n/*\n * The rpc message\n */\nstruct rpc_msg {\n\tu_int32_t\t\trm_xid;\n\tenum msg_type\t\trm_direction;\n\tunion {\n\t\tstruct call_body RM_cmb;\n\t\tstruct reply_body RM_rmb;\n\t} ru;\n#define\trm_call\t\tru.RM_cmb\n#define\trm_reply\tru.RM_rmb\n};\n#define\tacpted_rply\tru.RM_rmb.ru.RP_ar\n#define\trjcted_rply\tru.RM_rmb.ru.RP_dr\n\n__BEGIN_DECLS\n/*\n * XDR routine to handle a rpc message.\n * xdr_callmsg(xdrs, cmsg)\n * \tXDR *xdrs;\n * \tstruct rpc_msg *cmsg;\n */\nextern bool_t\txdr_callmsg(XDR *, struct rpc_msg *);\n\n/*\n * XDR routine to pre-serialize the static part of a rpc message.\n * xdr_callhdr(xdrs, cmsg)\n * \tXDR *xdrs;\n * \tstruct rpc_msg *cmsg;\n */\nextern bool_t\txdr_callhdr(XDR *, struct rpc_msg *);\n\n/*\n * XDR routine to handle a rpc reply.\n * xdr_replymsg(xdrs, rmsg)\n * \tXDR *xdrs;\n * \tstruct rpc_msg *rmsg;\n */\nextern bool_t\txdr_replymsg(XDR *, struct rpc_msg *);\n\n\n/*\n * XDR routine to handle an accepted rpc reply.\n * xdr_accepted_reply(xdrs, rej)\n * \tXDR *xdrs;\n * \tstruct accepted_reply *rej;\n */\nextern bool_t\txdr_accepted_reply(XDR *, struct accepted_reply *);\n\n/*\n * XDR routine to handle a rejected rpc reply.\n * xdr_rejected_reply(xdrs, rej)\n * \tXDR *xdrs;\n * \tstruct rejected_reply *rej;\n */\nextern bool_t\txdr_rejected_reply(XDR *, struct rejected_reply *);\n\n/*\n * Fills in the error part of a reply message.\n * _seterr_reply(msg, error)\n * \tstruct rpc_msg *msg;\n * \tstruct rpc_err *error;\n */\nextern void\t_seterr_reply(struct rpc_msg *, struct rpc_err *);\n__END_DECLS\n\n#endif /* !_RPC_RPC_MSG_H */\n"
  },
  {
    "path": "freebsd-headers/rpc/rpcb_clnt.h",
    "content": "/*\t$NetBSD: rpcb_clnt.h,v 1.1 2000/06/02 22:57:56 fvdl Exp $\t*/\n/*\t$FreeBSD: release/9.0.0/include/rpc/rpcb_clnt.h 93032 2002-03-23 17:24:55Z imp $ */\n\n/*\n * Sun RPC is a product of Sun Microsystems, Inc. and is provided for\n * unrestricted use provided that this legend is included on all tape\n * media and as a part of the software program in whole or part.  Users\n * may copy or modify Sun RPC without charge, but are not authorized\n * to license or distribute it to anyone else except as part of a product or\n * program developed by the user.\n * \n * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE\n * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR\n * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.\n * \n * Sun RPC is provided with no support and without any obligation on the\n * part of Sun Microsystems, Inc. to assist in its use, correction,\n * modification or enhancement.\n * \n * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE\n * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC\n * OR ANY PART THEREOF.\n * \n * In no event will Sun Microsystems, Inc. be liable for any lost revenue\n * or profits or other special, indirect and consequential damages, even if\n * Sun has been advised of the possibility of such damages.\n * \n * Sun Microsystems, Inc.\n * 2550 Garcia Avenue\n * Mountain View, California  94043\n */\n/*\n * Copyright (c) 1986 - 1991 by Sun Microsystems, Inc.\n */\n\n/*\n * rpcb_clnt.h\n * Supplies C routines to get to rpcbid services.\n *\n */\n\n/*\n * Usage:\n *\tsuccess = rpcb_set(program, version, nconf, address);\n *\tsuccess = rpcb_unset(program, version, nconf);\n *\tsuccess = rpcb_getaddr(program, version, nconf, host);\n *\thead = rpcb_getmaps(nconf, host);\n *\tclnt_stat = rpcb_rmtcall(nconf, host, program, version, procedure,\n *\t\txdrargs, argsp, xdrres, resp, tout, addr_ptr)\n *\tsuccess = rpcb_gettime(host, timep)\n *\tuaddr = rpcb_taddr2uaddr(nconf, taddr);\n *\ttaddr = rpcb_uaddr2uaddr(nconf, uaddr);\n */\n\n#ifndef _RPC_RPCB_CLNT_H\n#define\t_RPC_RPCB_CLNT_H\n\n/* #pragma ident\t\"@(#)rpcb_clnt.h\t1.13\t94/04/25 SMI\" */\n/* rpcb_clnt.h 1.3 88/12/05 SMI */\n\n#include <rpc/types.h>\n#include <rpc/rpcb_prot.h>\n\n__BEGIN_DECLS\nextern bool_t rpcb_set(const rpcprog_t, const rpcvers_t,\n\t\t       const struct netconfig  *, const struct netbuf *);\nextern bool_t rpcb_unset(const rpcprog_t, const rpcvers_t,\n\t\t\t const struct netconfig *);\nextern rpcblist\t*rpcb_getmaps(const struct netconfig *, const char *);\nextern enum clnt_stat rpcb_rmtcall(const struct netconfig *,\n\t\t\t\t   const char *, const rpcprog_t,\n\t\t\t\t   const rpcvers_t, const rpcproc_t,\n\t\t\t\t   const xdrproc_t, const caddr_t,\n\t\t\t\t   const xdrproc_t, const caddr_t,\n\t\t\t\t   const struct timeval,\n\t\t\t\t   const struct netbuf *);\nextern bool_t rpcb_getaddr(const rpcprog_t, const rpcvers_t,\n\t\t\t   const struct netconfig *, struct netbuf *,\n\t\t\t   const  char *);\nextern bool_t rpcb_gettime(const char *, time_t *);\nextern char *rpcb_taddr2uaddr(struct netconfig *, struct netbuf *);\nextern struct netbuf *rpcb_uaddr2taddr(struct netconfig *, char *);\n__END_DECLS\n\n#endif\t/* !_RPC_RPCB_CLNT_H */\n"
  },
  {
    "path": "freebsd-headers/rpc/rpcb_prot.h",
    "content": "/*\n * Please do not edit this file.\n * It was generated using rpcgen.\n */\n\n#ifndef _RPCB_PROT_H_RPCGEN\n#define\t_RPCB_PROT_H_RPCGEN\n\n#include <rpc/rpc.h>\n\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\n/*\n * $FreeBSD: release/9.0.0/include/rpc/rpcb_prot.x 92223 2002-03-13 10:29:06Z obrien $\n *\n * Sun RPC is a product of Sun Microsystems, Inc. and is provided for\n * unrestricted use provided that this legend is included on all tape\n * media and as a part of the software program in whole or part.  Users\n * may copy or modify Sun RPC without charge, but are not authorized\n * to license or distribute it to anyone else except as part of a product or\n * program developed by the user.\n *\n * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE\n * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR\n * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.\n *\n * Sun RPC is provided with no support and without any obligation on the\n * part of Sun Microsystems, Inc. to assist in its use, correction,\n * modification or enhancement.\n *\n * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE\n * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC\n * OR ANY PART THEREOF.\n *\n * In no event will Sun Microsystems, Inc. be liable for any lost revenue\n * or profits or other special, indirect and consequential damages, even if\n * Sun has been advised of the possibility of such damages.\n *\n * Sun Microsystems, Inc.\n * 2550 Garcia Avenue\n * Mountain View, California  94043\n */\n/*\n * Copyright (c) 1988 by Sun Microsystems, Inc.\n */\n/* from rpcb_prot.x */\n\n/* #pragma ident\t\"@(#)rpcb_prot.x\t1.5\t94/04/29 SMI\" */\n\n#ifndef _KERNEL\n\n\n/*\n * The following procedures are supported by the protocol in version 3:\n *\n * RPCBPROC_NULL() returns ()\n * \ttakes nothing, returns nothing\n *\n * RPCBPROC_SET(rpcb) returns (bool_t)\n * \tTRUE is success, FALSE is failure.  Registers the tuple\n *\t[prog, vers, address, owner, netid].\n *\tFinds out owner and netid information on its own.\n *\n * RPCBPROC_UNSET(rpcb) returns (bool_t)\n *\tTRUE is success, FALSE is failure.  Un-registers tuple\n *\t[prog, vers, netid].  addresses is ignored.\n *\tIf netid is NULL, unregister all.\n *\n * RPCBPROC_GETADDR(rpcb) returns (string).\n *\t0 is failure.  Otherwise returns the universal address where the\n *\ttriple [prog, vers, netid] is registered.  Ignore address and owner.\n *\n * RPCBPROC_DUMP() RETURNS (rpcblist_ptr)\n *\tused to dump the entire rpcbind maps\n *\n * RPCBPROC_CALLIT(rpcb_rmtcallargs)\n * \tRETURNS (rpcb_rmtcallres);\n * \tCalls the procedure on the remote machine.  If it is not registered,\n *\tthis procedure is quiet; i.e. it does not return error information!!!\n *\tThis routine only passes null authentication parameters.\n *\tIt has no interface to xdr routines for RPCBPROC_CALLIT.\n *\n * RPCBPROC_GETTIME() returns (int).\n *\tGets the remote machines time\n *\n * RPCBPROC_UADDR2TADDR(strint) RETURNS (struct netbuf)\n *\tReturns the netbuf address from universal address.\n *\n * RPCBPROC_TADDR2UADDR(struct netbuf) RETURNS (string)\n *\tReturns the universal address from netbuf address.\n *\n * END OF RPCBIND VERSION 3 PROCEDURES\n */\n/*\n * Except for RPCBPROC_CALLIT, the procedures above are carried over to\n * rpcbind version 4.  Those below are added or modified for version 4.\n * NOTE: RPCBPROC_BCAST HAS THE SAME FUNCTIONALITY AND PROCEDURE NUMBER\n * AS RPCBPROC_CALLIT.\n *\n * RPCBPROC_BCAST(rpcb_rmtcallargs)\n * \tRETURNS (rpcb_rmtcallres);\n * \tCalls the procedure on the remote machine.  If it is not registered,\n *\tthis procedure IS quiet; i.e. it DOES NOT return error information!!!\n *\tThis routine should be used for broadcasting and nothing else.\n *\n * RPCBPROC_GETVERSADDR(rpcb) returns (string).\n *\t0 is failure.  Otherwise returns the universal address where the\n *\ttriple [prog, vers, netid] is registered.  Ignore address and owner.\n *\tSame as RPCBPROC_GETADDR except that if the given version number\n *\tis not available, the address is not returned.\n *\n * RPCBPROC_INDIRECT(rpcb_rmtcallargs)\n * \tRETURNS (rpcb_rmtcallres);\n * \tCalls the procedure on the remote machine.  If it is not registered,\n *\tthis procedure is NOT quiet; i.e. it DOES return error information!!!\n * \tas any normal application would expect.\n *\n * RPCBPROC_GETADDRLIST(rpcb) returns (rpcb_entry_list_ptr).\n *\tSame as RPCBPROC_GETADDR except that it returns a list of all the\n *\taddresses registered for the combination (prog, vers) (for all\n *\ttransports).\n *\n * RPCBPROC_GETSTAT(void) returns (rpcb_stat_byvers)\n *\tReturns the statistics about the kind of requests received by rpcbind.\n */\n\n/*\n * A mapping of (program, version, network ID) to address\n */\n\nstruct rpcb {\n\trpcprog_t r_prog;\n\trpcvers_t r_vers;\n\tchar *r_netid;\n\tchar *r_addr;\n\tchar *r_owner;\n};\ntypedef struct rpcb rpcb;\n\ntypedef rpcb RPCB;\n\n\n/*\n * A list of mappings\n *\n * Below are two definitions for the rpcblist structure.  This is done because\n * xdr_rpcblist() is specified to take a struct rpcblist **, rather than a\n * struct rpcblist * that rpcgen would produce.  One version of the rpcblist\n * structure (actually called rp__list) is used with rpcgen, and the other is\n * defined only in the header file for compatibility with the specified\n * interface.\n */\n\nstruct rp__list {\n\trpcb rpcb_map;\n\tstruct rp__list *rpcb_next;\n};\ntypedef struct rp__list rp__list;\n\ntypedef rp__list *rpcblist_ptr;\n\ntypedef struct rp__list rpcblist;\ntypedef struct rp__list RPCBLIST;\n\n#ifndef __cplusplus\nstruct rpcblist {\n RPCB rpcb_map;\n struct rpcblist *rpcb_next;\n};\n#endif\n\n#ifdef __cplusplus\nextern \"C\" {\n#endif\nextern bool_t xdr_rpcblist(XDR *, rpcblist**);\n#ifdef __cplusplus\n}\n#endif\n\n\n/*\n * Arguments of remote calls\n */\n\nstruct rpcb_rmtcallargs {\n\trpcprog_t prog;\n\trpcvers_t vers;\n\trpcproc_t proc;\n\tstruct {\n\t\tu_int args_len;\n\t\tchar *args_val;\n\t} args;\n};\ntypedef struct rpcb_rmtcallargs rpcb_rmtcallargs;\n\n/*\n * Client-side only representation of rpcb_rmtcallargs structure.\n *\n * The routine that XDRs the rpcb_rmtcallargs structure must deal with the\n * opaque arguments in the \"args\" structure.  xdr_rpcb_rmtcallargs() needs to\n * be passed the XDR routine that knows the args' structure.  This routine\n * doesn't need to go over-the-wire (and it wouldn't make sense anyway) since\n * the application being called already knows the args structure.  So we use a\n * different \"XDR\" structure on the client side, r_rpcb_rmtcallargs, which\n * includes the args' XDR routine.\n */\nstruct r_rpcb_rmtcallargs {\n rpcprog_t prog;\n rpcvers_t vers;\n rpcproc_t proc;\n struct {\n u_int args_len;\n char *args_val;\n } args;\n xdrproc_t xdr_args; /* encodes args */\n};\n\n\n/*\n * Results of the remote call\n */\n\nstruct rpcb_rmtcallres {\n\tchar *addr;\n\tstruct {\n\t\tu_int results_len;\n\t\tchar *results_val;\n\t} results;\n};\ntypedef struct rpcb_rmtcallres rpcb_rmtcallres;\n\n/*\n * Client-side only representation of rpcb_rmtcallres structure.\n */\nstruct r_rpcb_rmtcallres {\n char *addr;\n struct {\n u_int32_t results_len;\n char *results_val;\n } results;\n xdrproc_t xdr_res; /* decodes results */\n};\n\n/*\n * rpcb_entry contains a merged address of a service on a particular\n * transport, plus associated netconfig information.  A list of rpcb_entrys\n * is returned by RPCBPROC_GETADDRLIST.  See netconfig.h for values used\n * in r_nc_* fields.\n */\n\nstruct rpcb_entry {\n\tchar *r_maddr;\n\tchar *r_nc_netid;\n\tu_int r_nc_semantics;\n\tchar *r_nc_protofmly;\n\tchar *r_nc_proto;\n};\ntypedef struct rpcb_entry rpcb_entry;\n\n/*\n * A list of addresses supported by a service.\n */\n\nstruct rpcb_entry_list {\n\trpcb_entry rpcb_entry_map;\n\tstruct rpcb_entry_list *rpcb_entry_next;\n};\ntypedef struct rpcb_entry_list rpcb_entry_list;\n\ntypedef rpcb_entry_list *rpcb_entry_list_ptr;\n\n/*\n * rpcbind statistics\n */\n\n#define\trpcb_highproc_2 RPCBPROC_CALLIT\n#define\trpcb_highproc_3 RPCBPROC_TADDR2UADDR\n#define\trpcb_highproc_4 RPCBPROC_GETSTAT\n#define\tRPCBSTAT_HIGHPROC 13\n#define\tRPCBVERS_STAT 3\n#define\tRPCBVERS_4_STAT 2\n#define\tRPCBVERS_3_STAT 1\n#define\tRPCBVERS_2_STAT 0\n\n/* Link list of all the stats about getport and getaddr */\n\nstruct rpcbs_addrlist {\n\trpcprog_t prog;\n\trpcvers_t vers;\n\tint success;\n\tint failure;\n\tchar *netid;\n\tstruct rpcbs_addrlist *next;\n};\ntypedef struct rpcbs_addrlist rpcbs_addrlist;\n\n/* Link list of all the stats about rmtcall */\n\nstruct rpcbs_rmtcalllist {\n\trpcprog_t prog;\n\trpcvers_t vers;\n\trpcproc_t proc;\n\tint success;\n\tint failure;\n\tint indirect;\n\tchar *netid;\n\tstruct rpcbs_rmtcalllist *next;\n};\ntypedef struct rpcbs_rmtcalllist rpcbs_rmtcalllist;\n\ntypedef int rpcbs_proc[RPCBSTAT_HIGHPROC];\n\ntypedef rpcbs_addrlist *rpcbs_addrlist_ptr;\n\ntypedef rpcbs_rmtcalllist *rpcbs_rmtcalllist_ptr;\n\nstruct rpcb_stat {\n\trpcbs_proc info;\n\tint setinfo;\n\tint unsetinfo;\n\trpcbs_addrlist_ptr addrinfo;\n\trpcbs_rmtcalllist_ptr rmtinfo;\n};\ntypedef struct rpcb_stat rpcb_stat;\n\n/*\n * One rpcb_stat structure is returned for each version of rpcbind\n * being monitored.\n */\n\ntypedef rpcb_stat rpcb_stat_byvers[RPCBVERS_STAT];\n\n/*\n * We don't define netbuf in RPCL, since it would contain structure member\n * names that would conflict with the definition of struct netbuf in\n * <tiuser.h>.  Instead we merely declare the XDR routine xdr_netbuf() here,\n * and implement it ourselves in rpc/rpcb_prot.c.\n */\n#ifdef __cplusplus\nextern \"C\" bool_t xdr_netbuf(XDR *, struct netbuf *);\n\n#else /* __STDC__ */\nextern bool_t xdr_netbuf(XDR *, struct netbuf *);\n\n#endif\n\n#define RPCBVERS_3 RPCBVERS\n#define RPCBVERS_4 RPCBVERS4\n\n#define _PATH_RPCBINDSOCK \"/var/run/rpcbind.sock\"\n\n#else /* ndef _KERNEL */\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\n/*\n * A mapping of (program, version, network ID) to address\n */\nstruct rpcb {\n rpcprog_t r_prog; /* program number */\n rpcvers_t r_vers; /* version number */\n char *r_netid; /* network id */\n char *r_addr; /* universal address */\n char *r_owner; /* owner of the mapping */\n};\ntypedef struct rpcb RPCB;\n\n/*\n * A list of mappings\n */\nstruct rpcblist {\n RPCB rpcb_map;\n struct rpcblist *rpcb_next;\n};\ntypedef struct rpcblist RPCBLIST;\ntypedef struct rpcblist *rpcblist_ptr;\n\n/*\n * Remote calls arguments\n */\nstruct rpcb_rmtcallargs {\n rpcprog_t prog; /* program number */\n rpcvers_t vers; /* version number */\n rpcproc_t proc; /* procedure number */\n u_int32_t arglen; /* arg len */\n caddr_t args_ptr; /* argument */\n xdrproc_t xdr_args; /* XDR routine for argument */\n};\ntypedef struct rpcb_rmtcallargs rpcb_rmtcallargs;\n\n/*\n * Remote calls results\n */\nstruct rpcb_rmtcallres {\n char *addr_ptr; /* remote universal address */\n u_int32_t resultslen; /* results length */\n caddr_t results_ptr; /* results */\n xdrproc_t xdr_results; /* XDR routine for result */\n};\ntypedef struct rpcb_rmtcallres rpcb_rmtcallres;\n\nstruct rpcb_entry {\n char *r_maddr;\n char *r_nc_netid;\n unsigned int r_nc_semantics;\n char *r_nc_protofmly;\n char *r_nc_proto;\n};\ntypedef struct rpcb_entry rpcb_entry;\n\n/*\n * A list of addresses supported by a service.\n */\n\nstruct rpcb_entry_list {\n rpcb_entry rpcb_entry_map;\n struct rpcb_entry_list *rpcb_entry_next;\n};\ntypedef struct rpcb_entry_list rpcb_entry_list;\n\ntypedef rpcb_entry_list *rpcb_entry_list_ptr;\n\n/*\n * rpcbind statistics\n */\n\n#define rpcb_highproc_2 RPCBPROC_CALLIT\n#define rpcb_highproc_3 RPCBPROC_TADDR2UADDR\n#define rpcb_highproc_4 RPCBPROC_GETSTAT\n#define RPCBSTAT_HIGHPROC 13\n#define RPCBVERS_STAT 3\n#define RPCBVERS_4_STAT 2\n#define RPCBVERS_3_STAT 1\n#define RPCBVERS_2_STAT 0\n\n/* Link list of all the stats about getport and getaddr */\n\nstruct rpcbs_addrlist {\n rpcprog_t prog;\n rpcvers_t vers;\n int success;\n int failure;\n char *netid;\n struct rpcbs_addrlist *next;\n};\ntypedef struct rpcbs_addrlist rpcbs_addrlist;\n\n/* Link list of all the stats about rmtcall */\n\nstruct rpcbs_rmtcalllist {\n rpcprog_t prog;\n rpcvers_t vers;\n rpcproc_t proc;\n int success;\n int failure;\n int indirect;\n char *netid;\n struct rpcbs_rmtcalllist *next;\n};\ntypedef struct rpcbs_rmtcalllist rpcbs_rmtcalllist;\n\ntypedef int rpcbs_proc[RPCBSTAT_HIGHPROC];\n\ntypedef rpcbs_addrlist *rpcbs_addrlist_ptr;\n\ntypedef rpcbs_rmtcalllist *rpcbs_rmtcalllist_ptr;\n\nstruct rpcb_stat {\n rpcbs_proc info;\n int setinfo;\n int unsetinfo;\n rpcbs_addrlist_ptr addrinfo;\n rpcbs_rmtcalllist_ptr rmtinfo;\n};\ntypedef struct rpcb_stat rpcb_stat;\n\n/*\n * One rpcb_stat structure is returned for each version of rpcbind\n * being monitored.\n */\n\ntypedef rpcb_stat rpcb_stat_byvers[RPCBVERS_STAT];\n\n#ifdef __cplusplus\n}\n#endif\n\n#endif /* ndef _KERNEL */\n\n#define\tRPCBPROG ((unsigned long)(100000))\n#define\tRPCBVERS ((unsigned long)(3))\n\nextern  void rpcbprog_3(struct svc_req *rqstp, SVCXPRT *transp);\n#define\tRPCBPROC_SET ((unsigned long)(1))\nextern  bool_t * rpcbproc_set_3(rpcb *, CLIENT *);\nextern  bool_t * rpcbproc_set_3_svc(rpcb *, struct svc_req *);\n#define\tRPCBPROC_UNSET ((unsigned long)(2))\nextern  bool_t * rpcbproc_unset_3(rpcb *, CLIENT *);\nextern  bool_t * rpcbproc_unset_3_svc(rpcb *, struct svc_req *);\n#define\tRPCBPROC_GETADDR ((unsigned long)(3))\nextern  char ** rpcbproc_getaddr_3(rpcb *, CLIENT *);\nextern  char ** rpcbproc_getaddr_3_svc(rpcb *, struct svc_req *);\n#define\tRPCBPROC_DUMP ((unsigned long)(4))\nextern  rpcblist_ptr * rpcbproc_dump_3(void *, CLIENT *);\nextern  rpcblist_ptr * rpcbproc_dump_3_svc(void *, struct svc_req *);\n#define\tRPCBPROC_CALLIT ((unsigned long)(5))\nextern  rpcb_rmtcallres * rpcbproc_callit_3(rpcb_rmtcallargs *, CLIENT *);\nextern  rpcb_rmtcallres * rpcbproc_callit_3_svc(rpcb_rmtcallargs *, struct svc_req *);\n#define\tRPCBPROC_GETTIME ((unsigned long)(6))\nextern  u_int * rpcbproc_gettime_3(void *, CLIENT *);\nextern  u_int * rpcbproc_gettime_3_svc(void *, struct svc_req *);\n#define\tRPCBPROC_UADDR2TADDR ((unsigned long)(7))\nextern  struct netbuf * rpcbproc_uaddr2taddr_3(char **, CLIENT *);\nextern  struct netbuf * rpcbproc_uaddr2taddr_3_svc(char **, struct svc_req *);\n#define\tRPCBPROC_TADDR2UADDR ((unsigned long)(8))\nextern  char ** rpcbproc_taddr2uaddr_3(struct netbuf *, CLIENT *);\nextern  char ** rpcbproc_taddr2uaddr_3_svc(struct netbuf *, struct svc_req *);\nextern int rpcbprog_3_freeresult(SVCXPRT *, xdrproc_t, caddr_t);\n#define\tRPCBVERS4 ((unsigned long)(4))\n\nextern  void rpcbprog_4(struct svc_req *rqstp, SVCXPRT *transp);\nextern  bool_t * rpcbproc_set_4(rpcb *, CLIENT *);\nextern  bool_t * rpcbproc_set_4_svc(rpcb *, struct svc_req *);\nextern  bool_t * rpcbproc_unset_4(rpcb *, CLIENT *);\nextern  bool_t * rpcbproc_unset_4_svc(rpcb *, struct svc_req *);\nextern  char ** rpcbproc_getaddr_4(rpcb *, CLIENT *);\nextern  char ** rpcbproc_getaddr_4_svc(rpcb *, struct svc_req *);\nextern  rpcblist_ptr * rpcbproc_dump_4(void *, CLIENT *);\nextern  rpcblist_ptr * rpcbproc_dump_4_svc(void *, struct svc_req *);\n#define\tRPCBPROC_BCAST ((unsigned long)(RPCBPROC_CALLIT))\nextern  rpcb_rmtcallres * rpcbproc_bcast_4(rpcb_rmtcallargs *, CLIENT *);\nextern  rpcb_rmtcallres * rpcbproc_bcast_4_svc(rpcb_rmtcallargs *, struct svc_req *);\nextern  u_int * rpcbproc_gettime_4(void *, CLIENT *);\nextern  u_int * rpcbproc_gettime_4_svc(void *, struct svc_req *);\nextern  struct netbuf * rpcbproc_uaddr2taddr_4(char **, CLIENT *);\nextern  struct netbuf * rpcbproc_uaddr2taddr_4_svc(char **, struct svc_req *);\nextern  char ** rpcbproc_taddr2uaddr_4(struct netbuf *, CLIENT *);\nextern  char ** rpcbproc_taddr2uaddr_4_svc(struct netbuf *, struct svc_req *);\n#define\tRPCBPROC_GETVERSADDR ((unsigned long)(9))\nextern  char ** rpcbproc_getversaddr_4(rpcb *, CLIENT *);\nextern  char ** rpcbproc_getversaddr_4_svc(rpcb *, struct svc_req *);\n#define\tRPCBPROC_INDIRECT ((unsigned long)(10))\nextern  rpcb_rmtcallres * rpcbproc_indirect_4(rpcb_rmtcallargs *, CLIENT *);\nextern  rpcb_rmtcallres * rpcbproc_indirect_4_svc(rpcb_rmtcallargs *, struct svc_req *);\n#define\tRPCBPROC_GETADDRLIST ((unsigned long)(11))\nextern  rpcb_entry_list_ptr * rpcbproc_getaddrlist_4(rpcb *, CLIENT *);\nextern  rpcb_entry_list_ptr * rpcbproc_getaddrlist_4_svc(rpcb *, struct svc_req *);\n#define\tRPCBPROC_GETSTAT ((unsigned long)(12))\nextern  rpcb_stat * rpcbproc_getstat_4(void *, CLIENT *);\nextern  rpcb_stat * rpcbproc_getstat_4_svc(void *, struct svc_req *);\nextern int rpcbprog_4_freeresult(SVCXPRT *, xdrproc_t, caddr_t);\n\n/* the xdr functions */\nextern  bool_t xdr_rpcb(XDR *, rpcb*);\nextern  bool_t xdr_rp__list(XDR *, rp__list*);\nextern  bool_t xdr_rpcblist_ptr(XDR *, rpcblist_ptr*);\nextern  bool_t xdr_rpcb_rmtcallargs(XDR *, rpcb_rmtcallargs*);\nextern  bool_t xdr_rpcb_rmtcallres(XDR *, rpcb_rmtcallres*);\nextern  bool_t xdr_rpcb_entry(XDR *, rpcb_entry*);\nextern  bool_t xdr_rpcb_entry_list(XDR *, rpcb_entry_list*);\nextern  bool_t xdr_rpcb_entry_list_ptr(XDR *, rpcb_entry_list_ptr*);\nextern  bool_t xdr_rpcbs_addrlist(XDR *, rpcbs_addrlist*);\nextern  bool_t xdr_rpcbs_rmtcalllist(XDR *, rpcbs_rmtcalllist*);\nextern  bool_t xdr_rpcbs_proc(XDR *, rpcbs_proc);\nextern  bool_t xdr_rpcbs_addrlist_ptr(XDR *, rpcbs_addrlist_ptr*);\nextern  bool_t xdr_rpcbs_rmtcalllist_ptr(XDR *, rpcbs_rmtcalllist_ptr*);\nextern  bool_t xdr_rpcb_stat(XDR *, rpcb_stat*);\nextern  bool_t xdr_rpcb_stat_byvers(XDR *, rpcb_stat_byvers);\n\n#ifdef __cplusplus\n}\n#endif\n\n#endif /* !_RPCB_PROT_H_RPCGEN */\n"
  },
  {
    "path": "freebsd-headers/rpc/rpcb_prot.x",
    "content": "%/*\n% * $FreeBSD: release/9.0.0/include/rpc/rpcb_prot.x 92223 2002-03-13 10:29:06Z obrien $\n% *\n% * Sun RPC is a product of Sun Microsystems, Inc. and is provided for\n% * unrestricted use provided that this legend is included on all tape\n% * media and as a part of the software program in whole or part.  Users\n% * may copy or modify Sun RPC without charge, but are not authorized\n% * to license or distribute it to anyone else except as part of a product or\n% * program developed by the user.\n% *\n% * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE\n% * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR\n% * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.\n% *\n% * Sun RPC is provided with no support and without any obligation on the\n% * part of Sun Microsystems, Inc. to assist in its use, correction,\n% * modification or enhancement.\n% *\n% * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE\n% * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC\n% * OR ANY PART THEREOF.\n% *\n% * In no event will Sun Microsystems, Inc. be liable for any lost revenue\n% * or profits or other special, indirect and consequential damages, even if\n% * Sun has been advised of the possibility of such damages.\n% *\n% * Sun Microsystems, Inc.\n% * 2550 Garcia Avenue\n% * Mountain View, California  94043\n% */\n%/*\n% * Copyright (c) 1988 by Sun Microsystems, Inc.\n% */\n\n%/* from rpcb_prot.x */\n\n#ifdef RPC_HDR\n%\n%/* #pragma ident\t\"@(#)rpcb_prot.x\t1.5\t94/04/29 SMI\" */\n%\n%#ifndef _KERNEL\n%\n#endif\n\n/*\n * rpcb_prot.x\n * rpcbind protocol, versions 3 and 4, in RPC Language\n */\n%\n%/*\n% * The following procedures are supported by the protocol in version 3:\n% *\n% * RPCBPROC_NULL() returns ()\n% * \ttakes nothing, returns nothing\n% *\n% * RPCBPROC_SET(rpcb) returns (bool_t)\n% * \tTRUE is success, FALSE is failure.  Registers the tuple\n% *\t[prog, vers, address, owner, netid].\n% *\tFinds out owner and netid information on its own.\n% *\n% * RPCBPROC_UNSET(rpcb) returns (bool_t)\n% *\tTRUE is success, FALSE is failure.  Un-registers tuple\n% *\t[prog, vers, netid].  addresses is ignored.\n% *\tIf netid is NULL, unregister all.\n% *\n% * RPCBPROC_GETADDR(rpcb) returns (string).\n% *\t0 is failure.  Otherwise returns the universal address where the\n% *\ttriple [prog, vers, netid] is registered.  Ignore address and owner.\n% *\n% * RPCBPROC_DUMP() RETURNS (rpcblist_ptr)\n% *\tused to dump the entire rpcbind maps\n% *\n% * RPCBPROC_CALLIT(rpcb_rmtcallargs)\n% * \tRETURNS (rpcb_rmtcallres);\n% * \tCalls the procedure on the remote machine.  If it is not registered,\n% *\tthis procedure is quiet; i.e. it does not return error information!!!\n% *\tThis routine only passes null authentication parameters.\n% *\tIt has no interface to xdr routines for RPCBPROC_CALLIT.\n% *\n% * RPCBPROC_GETTIME() returns (int).\n% *\tGets the remote machines time\n% *\n% * RPCBPROC_UADDR2TADDR(strint) RETURNS (struct netbuf)\n% *\tReturns the netbuf address from universal address.\n% *\n% * RPCBPROC_TADDR2UADDR(struct netbuf) RETURNS (string)\n% *\tReturns the universal address from netbuf address.\n% *\n% * END OF RPCBIND VERSION 3 PROCEDURES\n% */\n%/*\n% * Except for RPCBPROC_CALLIT, the procedures above are carried over to\n% * rpcbind version 4.  Those below are added or modified for version 4.\n% * NOTE: RPCBPROC_BCAST HAS THE SAME FUNCTIONALITY AND PROCEDURE NUMBER\n% * AS RPCBPROC_CALLIT.\n% *\n% * RPCBPROC_BCAST(rpcb_rmtcallargs)\n% * \tRETURNS (rpcb_rmtcallres);\n% * \tCalls the procedure on the remote machine.  If it is not registered,\n% *\tthis procedure IS quiet; i.e. it DOES NOT return error information!!!\n% *\tThis routine should be used for broadcasting and nothing else.\n% *\n% * RPCBPROC_GETVERSADDR(rpcb) returns (string).\n% *\t0 is failure.  Otherwise returns the universal address where the\n% *\ttriple [prog, vers, netid] is registered.  Ignore address and owner.\n% *\tSame as RPCBPROC_GETADDR except that if the given version number\n% *\tis not available, the address is not returned.\n% *\n% * RPCBPROC_INDIRECT(rpcb_rmtcallargs)\n% * \tRETURNS (rpcb_rmtcallres);\n% * \tCalls the procedure on the remote machine.  If it is not registered,\n% *\tthis procedure is NOT quiet; i.e. it DOES return error information!!!\n% * \tas any normal application would expect.\n% *\n% * RPCBPROC_GETADDRLIST(rpcb) returns (rpcb_entry_list_ptr).\n% *\tSame as RPCBPROC_GETADDR except that it returns a list of all the\n% *\taddresses registered for the combination (prog, vers) (for all\n% *\ttransports).\n% *\n% * RPCBPROC_GETSTAT(void) returns (rpcb_stat_byvers)\n% *\tReturns the statistics about the kind of requests received by rpcbind.\n% */\n%\n%/*\n% * A mapping of (program, version, network ID) to address\n% */\nstruct rpcb {\n\trpcprog_t r_prog;\t\t/* program number */\n\trpcvers_t r_vers;\t\t/* version number */\n\tstring r_netid<>;\t\t/* network id */\n\tstring r_addr<>;\t\t/* universal address */\n\tstring r_owner<>;\t\t/* owner of this service */\n};\n#ifdef RPC_HDR\n%\n%typedef rpcb RPCB;\n%\n#endif\n%\n%/*\n% * A list of mappings\n% *\n% * Below are two definitions for the rpcblist structure.  This is done because\n% * xdr_rpcblist() is specified to take a struct rpcblist **, rather than a\n% * struct rpcblist * that rpcgen would produce.  One version of the rpcblist\n% * structure (actually called rp__list) is used with rpcgen, and the other is\n% * defined only in the header file for compatibility with the specified\n% * interface.\n% */\n\nstruct rp__list {\n\trpcb rpcb_map;\n\tstruct rp__list *rpcb_next;\n};\n\ntypedef rp__list *rpcblist_ptr;\t\t/* results of RPCBPROC_DUMP */\n\n#ifdef RPC_HDR\n%\n%typedef struct rp__list rpcblist;\n%typedef struct rp__list RPCBLIST;\n%\n%#ifndef __cplusplus\n%struct rpcblist {\n%\tRPCB rpcb_map;\n%\tstruct rpcblist *rpcb_next;\n%};\n%#endif\n%\n%#ifdef __cplusplus\n%extern \"C\" {\n%#endif\n%extern  bool_t xdr_rpcblist(XDR *, rpcblist**);\n%#ifdef\t__cplusplus\n%}\n%#endif\n%\n#endif\n\n%\n%/*\n% * Arguments of remote calls\n% */\nstruct rpcb_rmtcallargs {\n\trpcprog_t prog;\t\t\t/* program number */\n\trpcvers_t vers;\t\t\t/* version number */\n\trpcproc_t proc;\t\t\t/* procedure number */\n\topaque args<>;\t\t\t/* argument */\n};\n#ifdef RPC_HDR\n%\n%/*\n% * Client-side only representation of rpcb_rmtcallargs structure.\n% *\n% * The routine that XDRs the rpcb_rmtcallargs structure must deal with the\n% * opaque arguments in the \"args\" structure.  xdr_rpcb_rmtcallargs() needs to\n% * be passed the XDR routine that knows the args' structure.  This routine\n% * doesn't need to go over-the-wire (and it wouldn't make sense anyway) since\n% * the application being called already knows the args structure.  So we use a\n% * different \"XDR\" structure on the client side, r_rpcb_rmtcallargs, which\n% * includes the args' XDR routine.\n% */\n%struct r_rpcb_rmtcallargs {\n%\trpcprog_t prog;\n%\trpcvers_t vers;\n%\trpcproc_t proc;\n%\tstruct {\n%\t\tu_int args_len;\n%\t\tchar *args_val;\n%\t} args;\n%\txdrproc_t\txdr_args;\t/* encodes args */\n%};\n%\n#endif\t/* def RPC_HDR */\n%\n%/*\n% * Results of the remote call\n% */\nstruct rpcb_rmtcallres {\n\tstring addr<>;\t\t\t/* remote universal address */\n\topaque results<>;\t\t/* result */\n};\n#ifdef RPC_HDR\n%\n%/*\n% * Client-side only representation of rpcb_rmtcallres structure.\n% */\n%struct r_rpcb_rmtcallres {\n%\tchar *addr;\n%\tstruct {\n%\t\tu_int32_t results_len;\n%\t\tchar *results_val;\n%\t} results;\n%\txdrproc_t\txdr_res;\t/* decodes results */\n%};\n#endif /* RPC_HDR */\n%\n%/*\n% * rpcb_entry contains a merged address of a service on a particular\n% * transport, plus associated netconfig information.  A list of rpcb_entrys\n% * is returned by RPCBPROC_GETADDRLIST.  See netconfig.h for values used\n% * in r_nc_* fields.\n% */\nstruct rpcb_entry {\n\tstring\t\tr_maddr<>;\t/* merged address of service */\n\tstring\t\tr_nc_netid<>;\t/* netid field */\n\tunsigned int\tr_nc_semantics;\t/* semantics of transport */\n\tstring\t\tr_nc_protofmly<>; /* protocol family */\n\tstring\t\tr_nc_proto<>;\t/* protocol name */\n};\n%\n%/*\n% * A list of addresses supported by a service.\n% */\nstruct rpcb_entry_list {\n\trpcb_entry rpcb_entry_map;\n\tstruct rpcb_entry_list *rpcb_entry_next;\n};\n\ntypedef rpcb_entry_list *rpcb_entry_list_ptr;\n\n%\n%/*\n% * rpcbind statistics\n% */\n%\nconst rpcb_highproc_2 = RPCBPROC_CALLIT;\nconst rpcb_highproc_3 = RPCBPROC_TADDR2UADDR;\nconst rpcb_highproc_4 = RPCBPROC_GETSTAT;\n\nconst RPCBSTAT_HIGHPROC = 13;\t/* # of procs in rpcbind V4 plus one */\nconst RPCBVERS_STAT = 3;\t/* provide only for rpcbind V2, V3 and V4 */\nconst RPCBVERS_4_STAT = 2;\nconst RPCBVERS_3_STAT = 1;\nconst RPCBVERS_2_STAT = 0;\n%\n%/* Link list of all the stats about getport and getaddr */\nstruct rpcbs_addrlist {\n\trpcprog_t prog;\n\trpcvers_t vers;\n\tint success;\n\tint failure;\n\tstring netid<>;\n\tstruct rpcbs_addrlist *next;\n};\n%\n%/* Link list of all the stats about rmtcall */\nstruct rpcbs_rmtcalllist {\n\trpcprog_t prog;\n\trpcvers_t vers;\n\trpcproc_t proc;\n\tint success;\n\tint failure;\n\tint indirect;\t/* whether callit or indirect */\n\tstring netid<>;\n\tstruct rpcbs_rmtcalllist *next;\n};\n\ntypedef int rpcbs_proc[RPCBSTAT_HIGHPROC];\ntypedef rpcbs_addrlist *rpcbs_addrlist_ptr;\ntypedef rpcbs_rmtcalllist *rpcbs_rmtcalllist_ptr;\n\nstruct rpcb_stat {\n\trpcbs_proc\t\tinfo;\n\tint\t\t\tsetinfo;\n\tint\t\t\tunsetinfo;\n\trpcbs_addrlist_ptr\taddrinfo;\n\trpcbs_rmtcalllist_ptr\trmtinfo;\n};\n%\n%/*\n% * One rpcb_stat structure is returned for each version of rpcbind\n% * being monitored.\n% */\n\ntypedef rpcb_stat rpcb_stat_byvers[RPCBVERS_STAT];\n\n#ifdef RPC_HDR\n%\n%/*\n% * We don't define netbuf in RPCL, since it would contain structure member\n% * names that would conflict with the definition of struct netbuf in\n% * <tiuser.h>.  Instead we merely declare the XDR routine xdr_netbuf() here,\n% * and implement it ourselves in rpc/rpcb_prot.c.\n% */\n%#ifdef __cplusplus\n%extern \"C\" bool_t xdr_netbuf(XDR *, struct netbuf *);\n%\n%#else /* __STDC__ */\n%extern  bool_t xdr_netbuf(XDR *, struct netbuf *);\n%\n%#endif\n#endif /* def RPC_HDR */\n\n/*\n * rpcbind procedures\n */\nprogram RPCBPROG {\n\tversion RPCBVERS {\n\t\tbool\n\t\tRPCBPROC_SET(rpcb) = 1;\n\n\t\tbool\n\t\tRPCBPROC_UNSET(rpcb) = 2;\n\n\t\tstring\n\t\tRPCBPROC_GETADDR(rpcb) = 3;\n\n\t\trpcblist_ptr\n\t\tRPCBPROC_DUMP(void) = 4;\n\n\t\trpcb_rmtcallres\n\t\tRPCBPROC_CALLIT(rpcb_rmtcallargs) = 5;\n\n\t\tunsigned int\n\t\tRPCBPROC_GETTIME(void) = 6;\n\n\t\tstruct netbuf\n\t\tRPCBPROC_UADDR2TADDR(string) = 7;\n\n\t\tstring\n\t\tRPCBPROC_TADDR2UADDR(struct netbuf) = 8;\n\t} = 3;\n\n\tversion RPCBVERS4 {\n\t\tbool\n\t\tRPCBPROC_SET(rpcb) = 1;\n\n\t\tbool\n\t\tRPCBPROC_UNSET(rpcb) = 2;\n\n\t\tstring\n\t\tRPCBPROC_GETADDR(rpcb) = 3;\n\n\t\trpcblist_ptr\n\t\tRPCBPROC_DUMP(void) = 4;\n\n\t\t/*\n\t\t * NOTE: RPCBPROC_BCAST has the same functionality as CALLIT;\n\t\t * the new name is intended to indicate that this\n\t\t * procedure should be used for broadcast RPC, and\n\t\t * RPCBPROC_INDIRECT should be used for indirect calls.\n\t\t */\n\t\trpcb_rmtcallres\n\t\tRPCBPROC_BCAST(rpcb_rmtcallargs) = RPCBPROC_CALLIT;\n\n\t\tunsigned int\n\t\tRPCBPROC_GETTIME(void) = 6;\n\n\t\tstruct netbuf\n\t\tRPCBPROC_UADDR2TADDR(string) = 7;\n\n\t\tstring\n\t\tRPCBPROC_TADDR2UADDR(struct netbuf) = 8;\n\n\t\tstring\n\t\tRPCBPROC_GETVERSADDR(rpcb) = 9;\n\n\t\trpcb_rmtcallres\n\t\tRPCBPROC_INDIRECT(rpcb_rmtcallargs) = 10;\n\n\t\trpcb_entry_list_ptr\n\t\tRPCBPROC_GETADDRLIST(rpcb) = 11;\n\n\t\trpcb_stat_byvers\n\t\tRPCBPROC_GETSTAT(void) = 12;\n\t} = 4;\n} = 100000;\n#ifdef RPC_HDR\n%\n%#define\tRPCBVERS_3\t\tRPCBVERS\n%#define\tRPCBVERS_4\t\tRPCBVERS4\n%\n%#define\t_PATH_RPCBINDSOCK\t\"/var/run/rpcbind.sock\"\n%\n%#else\t\t/* ndef _KERNEL */\n%#ifdef __cplusplus\n%extern \"C\" {\n%#endif\n%\n%/*\n% * A mapping of (program, version, network ID) to address\n% */\n%struct rpcb {\n%\trpcprog_t r_prog;\t\t/* program number */\n%\trpcvers_t r_vers;\t\t/* version number */\n%\tchar *r_netid;\t\t\t/* network id */\n%\tchar *r_addr;\t\t\t/* universal address */\n%\tchar *r_owner;\t\t\t/* owner of the mapping */\n%};\n%typedef struct rpcb RPCB;\n%\n%/*\n% * A list of mappings\n% */\n%struct rpcblist {\n%\tRPCB rpcb_map;\n%\tstruct rpcblist *rpcb_next;\n%};\n%typedef struct rpcblist RPCBLIST;\n%typedef struct rpcblist *rpcblist_ptr;\n%\n%/*\n% * Remote calls arguments\n% */\n%struct rpcb_rmtcallargs {\n%\trpcprog_t prog;\t\t\t/* program number */\n%\trpcvers_t vers;\t\t\t/* version number */\n%\trpcproc_t proc;\t\t\t/* procedure number */\n%\tu_int32_t arglen;\t\t\t/* arg len */\n%\tcaddr_t args_ptr;\t\t/* argument */\n%\txdrproc_t xdr_args;\t\t/* XDR routine for argument */\n%};\n%typedef struct rpcb_rmtcallargs rpcb_rmtcallargs;\n%\n%/*\n% * Remote calls results\n% */\n%struct rpcb_rmtcallres {\n%\tchar *addr_ptr;\t\t\t/* remote universal address */\n%\tu_int32_t resultslen;\t\t/* results length */\n%\tcaddr_t results_ptr;\t\t/* results */\n%\txdrproc_t xdr_results;\t\t/* XDR routine for result */\n%};\n%typedef struct rpcb_rmtcallres rpcb_rmtcallres;\n%\n%struct rpcb_entry {\n%\tchar *r_maddr;\n%\tchar *r_nc_netid;\n%\tunsigned int r_nc_semantics;\n%\tchar *r_nc_protofmly;\n%\tchar *r_nc_proto;\n%};\n%typedef struct rpcb_entry rpcb_entry;\n%\n%/*\n% * A list of addresses supported by a service.\n% */\n%\n%struct rpcb_entry_list {\n%\trpcb_entry rpcb_entry_map;\n%\tstruct rpcb_entry_list *rpcb_entry_next;\n%};\n%typedef struct rpcb_entry_list rpcb_entry_list;\n%\n%typedef rpcb_entry_list *rpcb_entry_list_ptr;\n%\n%/*\n% * rpcbind statistics\n% */\n%\n%#define\trpcb_highproc_2 RPCBPROC_CALLIT\n%#define\trpcb_highproc_3 RPCBPROC_TADDR2UADDR\n%#define\trpcb_highproc_4 RPCBPROC_GETSTAT\n%#define\tRPCBSTAT_HIGHPROC 13\n%#define\tRPCBVERS_STAT 3\n%#define\tRPCBVERS_4_STAT 2\n%#define\tRPCBVERS_3_STAT 1\n%#define\tRPCBVERS_2_STAT 0\n%\n%/* Link list of all the stats about getport and getaddr */\n%\n%struct rpcbs_addrlist {\n%\trpcprog_t prog;\n%\trpcvers_t vers;\n%\tint success;\n%\tint failure;\n%\tchar *netid;\n%\tstruct rpcbs_addrlist *next;\n%};\n%typedef struct rpcbs_addrlist rpcbs_addrlist;\n%\n%/* Link list of all the stats about rmtcall */\n%\n%struct rpcbs_rmtcalllist {\n%\trpcprog_t prog;\n%\trpcvers_t vers;\n%\trpcproc_t proc;\n%\tint success;\n%\tint failure;\n%\tint indirect;\n%\tchar *netid;\n%\tstruct rpcbs_rmtcalllist *next;\n%};\n%typedef struct rpcbs_rmtcalllist rpcbs_rmtcalllist;\n%\n%typedef int rpcbs_proc[RPCBSTAT_HIGHPROC];\n%\n%typedef rpcbs_addrlist *rpcbs_addrlist_ptr;\n%\n%typedef rpcbs_rmtcalllist *rpcbs_rmtcalllist_ptr;\n%\n%struct rpcb_stat {\n%\trpcbs_proc info;\n%\tint setinfo;\n%\tint unsetinfo;\n%\trpcbs_addrlist_ptr addrinfo;\n%\trpcbs_rmtcalllist_ptr rmtinfo;\n%};\n%typedef struct rpcb_stat rpcb_stat;\n%\n%/*\n% * One rpcb_stat structure is returned for each version of rpcbind\n% * being monitored.\n% */\n%\n%typedef rpcb_stat rpcb_stat_byvers[RPCBVERS_STAT];\n%\n%#ifdef __cplusplus\n%}\n%#endif\n%\n%#endif\t\t/* ndef _KERNEL */\n#endif\t\t/* RPC_HDR */\n"
  },
  {
    "path": "freebsd-headers/rpc/rpcent.h",
    "content": "/*\t$NetBSD: rpcent.h,v 1.1 2000/06/02 22:57:56 fvdl Exp $\t*/\n/*\t$FreeBSD: release/9.0.0/include/rpc/rpcent.h 158138 2006-04-29 04:26:16Z ume $ */\n\n/*\n * Sun RPC is a product of Sun Microsystems, Inc. and is provided for\n * unrestricted use provided that this legend is included on all tape\n * media and as a part of the software program in whole or part.  Users\n * may copy or modify Sun RPC without charge, but are not authorized\n * to license or distribute it to anyone else except as part of a product or\n * program developed by the user.\n * \n * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE\n * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR\n * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.\n * \n * Sun RPC is provided with no support and without any obligation on the\n * part of Sun Microsystems, Inc. to assist in its use, correction,\n * modification or enhancement.\n * \n * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE\n * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC\n * OR ANY PART THEREOF.\n * \n * In no event will Sun Microsystems, Inc. be liable for any lost revenue\n * or profits or other special, indirect and consequential damages, even if\n * Sun has been advised of the possibility of such damages.\n * \n * Sun Microsystems, Inc.\n * 2550 Garcia Avenue\n * Mountain View, California  94043\n */\n/*\n * Copyright (c) 1986 - 1991 by Sun Microsystems, Inc.\n */\n\n/*\n * rpcent.h,\n * For converting rpc program numbers to names etc.\n *\n */\n\n#ifndef _RPC_RPCENT_H\n#define _RPC_RPCENT_H\n\n/*\t#pragma ident \"@(#)rpcent.h   1.13    94/04/25 SMI\"\t*/\n/*      @(#)rpcent.h 1.1 88/12/06 SMI   */\n\n\nstruct rpcent {\n      char    *r_name;        /* name of server for this rpc program */\n      char    **r_aliases;    /* alias list */\n      int     r_number;       /* rpc program number */\n};\n\n__BEGIN_DECLS\n/*\n * These interfaces are currently implemented through nsswitch and are\n * MT-safe.\n */\nextern struct rpcent *getrpcbyname(char *);\nextern struct rpcent *getrpcbynumber(int);\nextern struct rpcent *getrpcent(void);\nextern void setrpcent(int);\nextern void endrpcent(void);\n__END_DECLS\n\n#endif /* !_RPC_CENT_H */\n"
  },
  {
    "path": "freebsd-headers/rpc/rpcsec_gss.h",
    "content": "/*-\n * Copyright (c) 2008 Doug Rabson\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t$FreeBSD: release/9.0.0/include/rpc/rpcsec_gss.h 181344 2008-08-06 14:02:05Z dfr $\n */\n\n#ifndef _RPCSEC_GSS_H\n#define _RPCSEC_GSS_H\n\n#include <gssapi/gssapi.h>\n\n#ifndef MAX_GSS_MECH\n#define MAX_GSS_MECH\t64\n#endif\n\n/*\n * Define the types of security service required for rpc_gss_seccreate().\n */\ntypedef enum {\n\trpc_gss_svc_default\t= 0,\n\trpc_gss_svc_none\t= 1,\n\trpc_gss_svc_integrity\t= 2,\n\trpc_gss_svc_privacy\t= 3\n} rpc_gss_service_t;\n\n/*\n * Structure containing options for rpc_gss_seccreate().\n */\ntypedef struct {\n\tint\t\treq_flags;\t/* GSS request bits */\n\tint\t\ttime_req;\t/* requested credential lifetime */\n\tgss_cred_id_t\tmy_cred;\t/* GSS credential */\n\tgss_channel_bindings_t input_channel_bindings;\n} rpc_gss_options_req_t;\n\n/*\n * Structure containing options returned by rpc_gss_seccreate().\n */\ntypedef struct {\n\tint\t\tmajor_status;\n\tint\t\tminor_status;\n\tu_int\t\trpcsec_version;\n\tint\t\tret_flags;\n\tint\t\ttime_req;\n\tgss_ctx_id_t\tgss_context;\n\tchar\t\tactual_mechanism[MAX_GSS_MECH];\n} rpc_gss_options_ret_t;\n\n/*\n * Client principal type. Used as an argument to\n * rpc_gss_get_principal_name(). Also referenced by the\n * rpc_gss_rawcred_t structure.\n */\ntypedef struct {\n\tint\t\tlen;\n\tchar\t\tname[1];\n} *rpc_gss_principal_t;\n\n/*\n * Structure for raw credentials used by rpc_gss_getcred() and\n * rpc_gss_set_callback().\n */\ntypedef struct {\n\tu_int\t\tversion;\t/* RPC version number */\n\tconst char\t*mechanism;\t/* security mechanism */\n\tconst char\t*qop;\t\t/* quality of protection */\n\trpc_gss_principal_t client_principal; /* client name */\n\tconst char\t*svc_principal;\t/* server name */\n\trpc_gss_service_t service;\t/* service type */\n} rpc_gss_rawcred_t;\n\n/*\n * Unix credentials derived from raw credentials. Returned by\n * rpc_gss_getcred().\n */\ntypedef struct {\n\tuid_t\t\tuid;\t\t/* user ID */\n\tgid_t\t\tgid;\t\t/* group ID */\n\tshort\t\tgidlen;\n\tgid_t\t\t*gidlist;\t/* list of groups */\n} rpc_gss_ucred_t;\n\n/*\n * Structure used to enforce a particular QOP and service.\n */\ntypedef struct {\n\tbool_t\t\tlocked;\n\trpc_gss_rawcred_t *raw_cred;\n} rpc_gss_lock_t;\n\n/*\n * Callback structure used by rpc_gss_set_callback().\n */\ntypedef struct {\n\tu_int\t\tprogram;\t/* RPC program number */\n\tu_int\t\tversion;\t/* RPC version number */\n\t\t\t\t\t/* user defined callback */\n\tbool_t\t\t(*callback)(struct svc_req *req,\n\t\t\t\t    gss_cred_id_t deleg,\n\t\t\t\t    gss_ctx_id_t gss_context,\n\t\t\t\t    rpc_gss_lock_t *lock,\n\t\t\t\t    void **cookie);\n} rpc_gss_callback_t;\n\n/*\n * Structure used to return error information by rpc_gss_get_error()\n */\ntypedef struct {\n\tint\t\trpc_gss_error;\n\tint\t\tsystem_error;\t/* same as errno */\n} rpc_gss_error_t;\n\n/*\n * Values for rpc_gss_error\n */\n#define RPC_GSS_ER_SUCCESS\t0\t/* no error */\n#define RPC_GSS_ER_SYSTEMERROR\t1\t/* system error */\n\n__BEGIN_DECLS\n\nAUTH\t*rpc_gss_seccreate(CLIENT *clnt, const char *principal,\n    const char *mechanism, rpc_gss_service_t service, const char *qop,\n    rpc_gss_options_req_t *options_req, rpc_gss_options_ret_t *options_ret);\nbool_t\trpc_gss_set_defaults(AUTH *auth, rpc_gss_service_t service,\n    const char *qop);\nint\trpc_gss_max_data_length(AUTH *handle, int max_tp_unit_len);\nvoid\trpc_gss_get_error(rpc_gss_error_t *error);\n\nbool_t\trpc_gss_mech_to_oid(const char *mech, gss_OID *oid_ret);\nbool_t\trpc_gss_oid_to_mech(gss_OID oid, const char **mech_ret);\nbool_t\trpc_gss_qop_to_num(const char *qop, const char *mech, u_int *num_ret);\nconst char **rpc_gss_get_mechanisms(void);\nconst char **rpc_gss_get_mech_info(const char *mech, rpc_gss_service_t *service);\nbool_t\trpc_gss_get_versions(u_int *vers_hi, u_int *vers_lo);\nbool_t\trpc_gss_is_installed(const char *mech);\n\nbool_t\trpc_gss_set_svc_name(const char *principal, const char *mechanism,\n    u_int req_time, u_int program, u_int version);\nbool_t\trpc_gss_getcred(struct svc_req *req, rpc_gss_rawcred_t **rcred,\n    rpc_gss_ucred_t **ucred, void **cookie);\nbool_t\trpc_gss_set_callback(rpc_gss_callback_t *cb);\nbool_t\trpc_gss_get_principal_name(rpc_gss_principal_t *principal,\n    const char *mech, const char *name, const char *node, const char *domain);\nint\trpc_gss_svc_max_data_length(struct svc_req *req, int max_tp_unit_len);\n\n/*\n * Internal interface from the RPC implementation.\n */\nbool_t\t__rpc_gss_wrap(AUTH *auth, void *header, size_t headerlen,\n    XDR* xdrs, xdrproc_t xdr_args, void *args_ptr);\nbool_t\t__rpc_gss_unwrap(AUTH *auth, XDR* xdrs, xdrproc_t xdr_args,\n    void *args_ptr);\nbool_t __rpc_gss_set_error(int rpc_gss_error, int system_error);\n\n__END_DECLS\n\n#endif /* !_RPCSEC_GSS_H */\n"
  },
  {
    "path": "freebsd-headers/rpc/svc.h",
    "content": "/*\t$NetBSD: svc.h,v 1.17 2000/06/02 22:57:56 fvdl Exp $\t*/\n\n/*\n * Sun RPC is a product of Sun Microsystems, Inc. and is provided for\n * unrestricted use provided that this legend is included on all tape\n * media and as a part of the software program in whole or part.  Users\n * may copy or modify Sun RPC without charge, but are not authorized\n * to license or distribute it to anyone else except as part of a product or\n * program developed by the user.\n *\n * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE\n * WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR\n * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.\n *\n * Sun RPC is provided with no support and without any obligation on the\n * part of Sun Microsystems, Inc. to assist in its use, correction,\n * modification or enhancement.\n *\n * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE\n * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC\n * OR ANY PART THEREOF.\n *\n * In no event will Sun Microsystems, Inc. be liable for any lost revenue\n * or profits or other special, indirect and consequential damages, even if\n * Sun has been advised of the possibility of such damages.\n *\n * Sun Microsystems, Inc.\n * 2550 Garcia Avenue\n * Mountain View, California  94043\n *\n *\tfrom: @(#)svc.h 1.35 88/12/17 SMI\n *\tfrom: @(#)svc.h      1.27    94/04/25 SMI\n * $FreeBSD: release/9.0.0/include/rpc/svc.h 181344 2008-08-06 14:02:05Z dfr $\n */\n\n/*\n * svc.h, Server-side remote procedure call interface.\n *\n * Copyright (C) 1986-1993 by Sun Microsystems, Inc.\n */\n\n#ifndef _RPC_SVC_H\n#define _RPC_SVC_H\n#include <sys/cdefs.h>\n\n/*\n * This interface must manage two items concerning remote procedure calling:\n *\n * 1) An arbitrary number of transport connections upon which rpc requests\n * are received.  The two most notable transports are TCP and UDP;  they are\n * created and registered by routines in svc_tcp.c and svc_udp.c, respectively;\n * they in turn call xprt_register and xprt_unregister.\n *\n * 2) An arbitrary number of locally registered services.  Services are\n * described by the following four data: program number, version number,\n * \"service dispatch\" function, a transport handle, and a boolean that\n * indicates whether or not the exported program should be registered with a\n * local binder service;  if true the program's number and version and the\n * port number from the transport handle are registered with the binder.\n * These data are registered with the rpc svc system via svc_register.\n *\n * A service's dispatch function is called whenever an rpc request comes in\n * on a transport.  The request's program and version numbers must match\n * those of the registered service.  The dispatch function is passed two\n * parameters, struct svc_req * and SVCXPRT *, defined below.\n */\n\n/*\n *      Service control requests\n */\n#define SVCGET_VERSQUIET\t1\n#define SVCSET_VERSQUIET\t2\n#define SVCGET_CONNMAXREC\t3\n#define SVCSET_CONNMAXREC\t4\n\n/*\n * Operations for rpc_control().\n */\n#define RPC_SVC_CONNMAXREC_SET  0\t/* set max rec size, enable nonblock */\n#define RPC_SVC_CONNMAXREC_GET  1\n\nenum xprt_stat {\n\tXPRT_DIED,\n\tXPRT_MOREREQS,\n\tXPRT_IDLE\n};\n\n/*\n * Server side transport handle\n */\ntypedef struct __rpc_svcxprt {\n\tint\t\txp_fd;\n\tu_short\t\txp_port;\t /* associated port number */\n\tconst struct xp_ops {\n\t    /* receive incoming requests */\n\t    bool_t\t(*xp_recv)(struct __rpc_svcxprt *, struct rpc_msg *);\n\t    /* get transport status */\n\t    enum xprt_stat (*xp_stat)(struct __rpc_svcxprt *);\n\t    /* get arguments */\n\t    bool_t\t(*xp_getargs)(struct __rpc_svcxprt *, xdrproc_t,\n\t\t\t\tvoid *);\n\t    /* send reply */\n\t    bool_t\t(*xp_reply)(struct __rpc_svcxprt *, struct rpc_msg *);\n\t    /* free mem allocated for args */\n\t    bool_t\t(*xp_freeargs)(struct __rpc_svcxprt *, xdrproc_t,\n\t\t\t\tvoid *);\n\t    /* destroy this struct */\n\t    void\t(*xp_destroy)(struct __rpc_svcxprt *);\n\t} *xp_ops;\n\tint\t\txp_addrlen;\t /* length of remote address */\n\tstruct sockaddr_in xp_raddr;\t /* remote addr. (backward ABI compat) */\n\t/* XXX - fvdl stick this here for ABI backward compat reasons */\n\tconst struct xp_ops2 {\n\t\t/* catch-all function */\n\t\tbool_t  (*xp_control)(struct __rpc_svcxprt *, const u_int,\n\t\t\t\tvoid *);\n\t} *xp_ops2;\n\tchar\t\t*xp_tp;\t\t /* transport provider device name */\n\tchar\t\t*xp_netid;\t /* network token */\n\tstruct netbuf\txp_ltaddr;\t /* local transport address */\n\tstruct netbuf\txp_rtaddr;\t /* remote transport address */\n\tstruct opaque_auth xp_verf;\t /* raw response verifier */\n\tvoid\t\t*xp_p1;\t\t /* private: for use by svc ops */\n\tvoid\t\t*xp_p2;\t\t /* private: for use by svc ops */\n\tvoid\t\t*xp_p3;\t\t /* private: for use by svc lib */\n\tint\t\txp_type;\t /* transport type */\n} SVCXPRT;\n\n/*\n * Interface to server-side authentication flavors.\n */\ntypedef struct __rpc_svcauth {\n\tstruct svc_auth_ops {\n\t\tint   (*svc_ah_wrap)(struct __rpc_svcauth *, XDR *,\n\t\t    xdrproc_t, caddr_t);\n\t\tint   (*svc_ah_unwrap)(struct __rpc_svcauth *, XDR *,\n\t\t    xdrproc_t, caddr_t);\n\t} *svc_ah_ops;\n\tvoid *svc_ah_private;\n} SVCAUTH;\n\n/*\n * Server transport extensions (accessed via xp_p3).\n */\ntypedef struct __rpc_svcxprt_ext {\n\tint\t\txp_flags;\t/* versquiet */\n\tSVCAUTH\t\txp_auth;\t/* interface to auth methods */\n} SVCXPRT_EXT;\n\n/*\n * Service request\n */\nstruct svc_req {\n\tu_int32_t\trq_prog;\t/* service program number */\n\tu_int32_t\trq_vers;\t/* service protocol version */\n\tu_int32_t\trq_proc;\t/* the desired procedure */\n\tstruct opaque_auth rq_cred;\t/* raw creds from the wire */\n\tvoid\t\t*rq_clntcred;\t/* read only cooked cred */\n\tSVCXPRT\t\t*rq_xprt;\t/* associated transport */\n};\n\n/*\n *  Approved way of getting address of caller\n */\n#define svc_getrpccaller(x) (&(x)->xp_rtaddr)\n\n/*\n * Operations defined on an SVCXPRT handle\n *\n * SVCXPRT\t\t*xprt;\n * struct rpc_msg\t*msg;\n * xdrproc_t\t\t xargs;\n * void *\t\t argsp;\n */\n#define SVC_RECV(xprt, msg)\t\t\t\t\\\n\t(*(xprt)->xp_ops->xp_recv)((xprt), (msg))\n#define svc_recv(xprt, msg)\t\t\t\t\\\n\t(*(xprt)->xp_ops->xp_recv)((xprt), (msg))\n\n#define SVC_STAT(xprt)\t\t\t\t\t\\\n\t(*(xprt)->xp_ops->xp_stat)(xprt)\n#define svc_stat(xprt)\t\t\t\t\t\\\n\t(*(xprt)->xp_ops->xp_stat)(xprt)\n\n#define SVC_GETARGS(xprt, xargs, argsp)\t\t\t\\\n\t(*(xprt)->xp_ops->xp_getargs)((xprt), (xargs), (argsp))\n#define svc_getargs(xprt, xargs, argsp)\t\t\t\\\n\t(*(xprt)->xp_ops->xp_getargs)((xprt), (xargs), (argsp))\n\n#define SVC_REPLY(xprt, msg)\t\t\t\t\\\n\t(*(xprt)->xp_ops->xp_reply) ((xprt), (msg))\n#define svc_reply(xprt, msg)\t\t\t\t\\\n\t(*(xprt)->xp_ops->xp_reply) ((xprt), (msg))\n\n#define SVC_FREEARGS(xprt, xargs, argsp)\t\t\\\n\t(*(xprt)->xp_ops->xp_freeargs)((xprt), (xargs), (argsp))\n#define svc_freeargs(xprt, xargs, argsp)\t\t\\\n\t(*(xprt)->xp_ops->xp_freeargs)((xprt), (xargs), (argsp))\n\n#define SVC_DESTROY(xprt)\t\t\t\t\\\n\t(*(xprt)->xp_ops->xp_destroy)(xprt)\n#define svc_destroy(xprt)\t\t\t\t\\\n\t(*(xprt)->xp_ops->xp_destroy)(xprt)\n\n#define SVC_CONTROL(xprt, rq, in)\t\t\t\\\n\t(*(xprt)->xp_ops2->xp_control)((xprt), (rq), (in))\n\n#define SVC_EXT(xprt)\t\t\t\t\t\\\n\t((SVCXPRT_EXT *) xprt->xp_p3)\n\n#define SVC_AUTH(xprt)\t\t\t\t\t\\\n\t(SVC_EXT(xprt)->xp_auth)\n\n/*\n * Operations defined on an SVCAUTH handle\n */\n#define SVCAUTH_WRAP(auth, xdrs, xfunc, xwhere)\t\t\\\n\t((auth)->svc_ah_ops->svc_ah_wrap(auth, xdrs, xfunc, xwhere))\n#define SVCAUTH_UNWRAP(auth, xdrs, xfunc, xwhere)\t\\\n\t((auth)->svc_ah_ops->svc_ah_unwrap(auth, xdrs, xfunc, xwhere))\n\n/*\n * Service registration\n *\n * svc_reg(xprt, prog, vers, dispatch, nconf)\n *\tconst SVCXPRT *xprt;\n *\tconst rpcprog_t prog;\n *\tconst rpcvers_t vers;\n *\tconst void (*dispatch)();\n *\tconst struct netconfig *nconf;\n */\n\n__BEGIN_DECLS\nextern bool_t\tsvc_reg(SVCXPRT *, const rpcprog_t, const rpcvers_t,\n\t\t\tvoid (*)(struct svc_req *, SVCXPRT *),\n\t\t\tconst struct netconfig *);\n__END_DECLS\n\n/*\n * Service un-registration\n *\n * svc_unreg(prog, vers)\n *\tconst rpcprog_t prog;\n *\tconst rpcvers_t vers;\n */\n\n__BEGIN_DECLS\nextern void\tsvc_unreg(const rpcprog_t, const rpcvers_t);\n__END_DECLS\n\n/*\n * Transport registration.\n *\n * xprt_register(xprt)\n *\tSVCXPRT *xprt;\n */\n__BEGIN_DECLS\nextern void\txprt_register(SVCXPRT *);\n__END_DECLS\n\n/*\n * Transport un-register\n *\n * xprt_unregister(xprt)\n *\tSVCXPRT *xprt;\n */\n__BEGIN_DECLS\nextern void\txprt_unregister(SVCXPRT *);\n__END_DECLS\n\n\n/*\n * When the service routine is called, it must first check to see if it\n * knows about the procedure;  if not, it should call svcerr_noproc\n * and return.  If so, it should deserialize its arguments via\n * SVC_GETARGS (defined above).  If the deserialization does not work,\n * svcerr_decode should be called followed by a return.  Successful\n * decoding of the arguments should be followed the execution of the\n * procedure's code and a call to svc_sendreply.\n *\n * Also, if the service refuses to execute the procedure due to too-\n * weak authentication parameters, svcerr_weakauth should be called.\n * Note: do not confuse access-control failure with weak authentication!\n *\n * NB: In pure implementations of rpc, the caller always waits for a reply\n * msg.  This message is sent when svc_sendreply is called.\n * Therefore pure service implementations should always call\n * svc_sendreply even if the function logically returns void;  use\n * xdr.h - xdr_void for the xdr routine.  HOWEVER, tcp based rpc allows\n * for the abuse of pure rpc via batched calling or pipelining.  In the\n * case of a batched call, svc_sendreply should NOT be called since\n * this would send a return message, which is what batching tries to avoid.\n * It is the service/protocol writer's responsibility to know which calls are\n * batched and which are not.  Warning: responding to batch calls may\n * deadlock the caller and server processes!\n */\n\n__BEGIN_DECLS\nextern bool_t\tsvc_sendreply(SVCXPRT *, xdrproc_t, void *);\nextern void\tsvcerr_decode(SVCXPRT *);\nextern void\tsvcerr_weakauth(SVCXPRT *);\nextern void\tsvcerr_noproc(SVCXPRT *);\nextern void\tsvcerr_progvers(SVCXPRT *, rpcvers_t, rpcvers_t);\nextern void\tsvcerr_auth(SVCXPRT *, enum auth_stat);\nextern void\tsvcerr_noprog(SVCXPRT *);\nextern void\tsvcerr_systemerr(SVCXPRT *);\nextern int\trpc_reg(rpcprog_t, rpcvers_t, rpcproc_t,\n\t\t\tchar *(*)(char *), xdrproc_t, xdrproc_t,\n\t\t\tchar *);\n__END_DECLS\n\n/*\n * Lowest level dispatching -OR- who owns this process anyway.\n * Somebody has to wait for incoming requests and then call the correct\n * service routine.  The routine svc_run does infinite waiting; i.e.,\n * svc_run never returns.\n * Since another (co-existant) package may wish to selectively wait for\n * incoming calls or other events outside of the rpc architecture, the\n * routine svc_getreq is provided.  It must be passed readfds, the\n * \"in-place\" results of a select system call (see select, section 2).\n */\n\n/*\n * Global keeper of rpc service descriptors in use\n * dynamic; must be inspected before each call to select\n */\nextern int svc_maxfd;\n#ifdef FD_SETSIZE\nextern fd_set svc_fdset;\n#define svc_fds svc_fdset.fds_bits[0]\t/* compatibility */\n#else\nextern int svc_fds;\n#endif /* def FD_SETSIZE */\n\n/*\n * A set of null auth methods used by any authentication protocols\n * that don't need to inspect or modify the message body.\n */\nextern SVCAUTH _svc_auth_null;\n\n/*\n * a small program implemented by the svc_rpc implementation itself;\n * also see clnt.h for protocol numbers.\n */\n__BEGIN_DECLS\nextern void rpctest_service(void);\n__END_DECLS\n\n__BEGIN_DECLS\nextern SVCXPRT *svc_xprt_alloc(void);\nextern void\tsvc_xprt_free(SVCXPRT *);\nextern void\tsvc_getreq(int);\nextern void\tsvc_getreqset(fd_set *);\nextern void\tsvc_getreq_common(int);\nstruct pollfd;\nextern void\tsvc_getreq_poll(struct pollfd *, int);\n\nextern void\tsvc_run(void);\nextern void\tsvc_exit(void);\n__END_DECLS\n\n/*\n * Socket to use on svcxxx_create call to get default socket\n */\n#define\tRPC_ANYSOCK\t-1\n#define RPC_ANYFD\tRPC_ANYSOCK\n\n/*\n * These are the existing service side transport implementations\n */\n\n__BEGIN_DECLS\n/*\n * Transport independent svc_create routine.\n */\nextern int svc_create(void (*)(struct svc_req *, SVCXPRT *),\n\t\t\t   const rpcprog_t, const rpcvers_t, const char *);\n/*\n *      void (*dispatch)();             -- dispatch routine\n *      const rpcprog_t prognum;        -- program number\n *      const rpcvers_t versnum;        -- version number\n *      const char *nettype;            -- network type\n */\n\n\n/*\n * Generic server creation routine. It takes a netconfig structure\n * instead of a nettype.\n */\n\nextern SVCXPRT *svc_tp_create(void (*)(struct svc_req *, SVCXPRT *),\n\t\t\t\t   const rpcprog_t, const rpcvers_t,\n\t\t\t\t   const struct netconfig *);\n        /*\n         * void (*dispatch)();            -- dispatch routine\n         * const rpcprog_t prognum;       -- program number\n         * const rpcvers_t versnum;       -- version number\n         * const struct netconfig *nconf; -- netconfig structure\n         */\n\n\n/*\n * Generic TLI create routine\n */\nextern SVCXPRT *svc_tli_create(const int, const struct netconfig *,\n\t\t\t       const struct t_bind *, const u_int,\n\t\t\t       const u_int);\n/*\n *      const int fd;                   -- connection end point\n *      const struct netconfig *nconf;  -- netconfig structure for network\n *      const struct t_bind *bindaddr;  -- local bind address\n *      const u_int sendsz;             -- max sendsize\n *      const u_int recvsz;             -- max recvsize\n */\n\n/*\n * Connectionless and connectionful create routines\n */\n\nextern SVCXPRT *svc_vc_create(const int, const u_int, const u_int);\n/*\n *      const int fd;                           -- open connection end point\n *      const u_int sendsize;                   -- max send size\n *      const u_int recvsize;                   -- max recv size\n */\n\n/*\n * Added for compatibility to old rpc 4.0. Obsoleted by svc_vc_create().\n */\nextern SVCXPRT *svcunix_create(int, u_int, u_int, char *);\n\nextern SVCXPRT *svc_dg_create(const int, const u_int, const u_int);\n        /*\n         * const int fd;                                -- open connection\n         * const u_int sendsize;                        -- max send size\n         * const u_int recvsize;                        -- max recv size\n         */\n\n\n/*\n * the routine takes any *open* connection\n * descriptor as its first input and is used for open connections.\n */\nextern SVCXPRT *svc_fd_create(const int, const u_int, const u_int);\n/*\n *      const int fd;                           -- open connection end point\n *      const u_int sendsize;                   -- max send size\n *      const u_int recvsize;                   -- max recv size\n */\n\n/*\n * Added for compatibility to old rpc 4.0. Obsoleted by svc_fd_create().\n */\nextern SVCXPRT *svcunixfd_create(int, u_int, u_int);\n\n/*\n * Memory based rpc (for speed check and testing)\n */\nextern SVCXPRT *svc_raw_create(void);\n\n/*\n * svc_dg_enable_cache() enables the cache on dg transports.\n */\nint svc_dg_enablecache(SVCXPRT *, const u_int);\n\nint __rpc_get_local_uid(SVCXPRT *_transp, uid_t *_uid);\n\n__END_DECLS\n\n\n/* for backward compatibility */\n#include <rpc/svc_soc.h>\n\n#endif /* !_RPC_SVC_H */\n"
  },
  {
    "path": "freebsd-headers/rpc/svc_auth.h",
    "content": "/*\t$NetBSD: svc_auth.h,v 1.8 2000/06/02 22:57:57 fvdl Exp $\t*/\n\n/*\n * Sun RPC is a product of Sun Microsystems, Inc. and is provided for\n * unrestricted use provided that this legend is included on all tape\n * media and as a part of the software program in whole or part.  Users\n * may copy or modify Sun RPC without charge, but are not authorized\n * to license or distribute it to anyone else except as part of a product or\n * program developed by the user.\n *\n * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE\n * WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR\n * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.\n *\n * Sun RPC is provided with no support and without any obligation on the\n * part of Sun Microsystems, Inc. to assist in its use, correction,\n * modification or enhancement.\n *\n * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE\n * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC\n * OR ANY PART THEREOF.\n *\n * In no event will Sun Microsystems, Inc. be liable for any lost revenue\n * or profits or other special, indirect and consequential damages, even if\n * Sun has been advised of the possibility of such damages.\n *\n * Sun Microsystems, Inc.\n * 2550 Garcia Avenue\n * Mountain View, California  94043\n *\n *\tfrom: @(#)svc_auth.h 1.6 86/07/16 SMI\n *\t@(#)svc_auth.h\t2.1 88/07/29 4.0 RPCSRC\n * $FreeBSD: release/9.0.0/include/rpc/svc_auth.h 182891 2008-09-09 14:15:55Z dfr $\n */\n\n/*\n * svc_auth.h, Service side of rpc authentication.\n *\n * Copyright (C) 1984, Sun Microsystems, Inc.\n */\n\n#ifndef _RPC_SVC_AUTH_H\n#define _RPC_SVC_AUTH_H\n\n/*\n * Server side authenticator\n */\n__BEGIN_DECLS\nextern struct svc_auth_ops svc_auth_null_ops;\n\nextern enum auth_stat _authenticate(struct svc_req *, struct rpc_msg *);\nextern int svc_auth_reg(int, enum auth_stat (*)(struct svc_req *,\n\t\t\t  struct rpc_msg *));\n\n__END_DECLS\n\n#endif /* !_RPC_SVC_AUTH_H */\n"
  },
  {
    "path": "freebsd-headers/rpc/svc_dg.h",
    "content": "/*\t$NetBSD: svc_dg.h,v 1.1 2000/06/02 23:11:16 fvdl Exp $\t*/\n/*\t$FreeBSD: release/9.0.0/include/rpc/svc_dg.h 194448 2009-06-18 17:10:43Z kan $ */\n\n/*\n * Sun RPC is a product of Sun Microsystems, Inc. and is provided for\n * unrestricted use provided that this legend is included on all tape\n * media and as a part of the software program in whole or part.  Users\n * may copy or modify Sun RPC without charge, but are not authorized\n * to license or distribute it to anyone else except as part of a product or\n * program developed by the user.\n * \n * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE\n * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR\n * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.\n * \n * Sun RPC is provided with no support and without any obligation on the\n * part of Sun Microsystems, Inc. to assist in its use, correction,\n * modification or enhancement.\n * \n * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE\n * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC\n * OR ANY PART THEREOF.\n * \n * In no event will Sun Microsystems, Inc. be liable for any lost revenue\n * or profits or other special, indirect and consequential damages, even if\n * Sun has been advised of the possibility of such damages.\n * \n * Sun Microsystems, Inc.\n * 2550 Garcia Avenue\n * Mountain View, California  94043\n */\n\n/*\n * XXX - this file exists only so that the rpcbind code can pull it in.\n * This should go away. It should only be include by svc_dg.c and\n * rpcb_svc_com.c in the rpcbind code.\n */\n\n/*\n * kept in xprt->xp_p2\n */\nstruct svc_dg_data {\n\t/* XXX: optbuf should be the first field, used by ti_opts.c code */\n\tsize_t\t\tsu_iosz;\t\t/* size of send.recv buffer */\n\tu_int32_t\tsu_xid;\t\t\t/* transaction id */\n\tXDR\t\tsu_xdrs;\t\t\t/* XDR handle */\n\tchar\t\tsu_verfbody[MAX_AUTH_BYTES];\t/* verifier body */\n\tvoid\t\t*su_cache;\t\t/* cached data, NULL if none */\n\tstruct netbuf   su_srcaddr;\t\t/* dst address of last msg */\n};\n\n#define __rpcb_get_dg_xidp(x)\t(&((struct svc_dg_data *)(x)->xp_p2)->su_xid)\n"
  },
  {
    "path": "freebsd-headers/rpc/svc_soc.h",
    "content": "/*\t$NetBSD: svc_soc.h,v 1.1 2000/06/02 22:57:57 fvdl Exp $\t*/\n/*\t$FreeBSD: release/9.0.0/include/rpc/svc_soc.h 93032 2002-03-23 17:24:55Z imp $ */\n\n/*\n * Sun RPC is a product of Sun Microsystems, Inc. and is provided for\n * unrestricted use provided that this legend is included on all tape\n * media and as a part of the software program in whole or part.  Users\n * may copy or modify Sun RPC without charge, but are not authorized\n * to license or distribute it to anyone else except as part of a product or\n * program developed by the user.\n * \n * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE\n * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR\n * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.\n * \n * Sun RPC is provided with no support and without any obligation on the\n * part of Sun Microsystems, Inc. to assist in its use, correction,\n * modification or enhancement.\n * \n * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE\n * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC\n * OR ANY PART THEREOF.\n * \n * In no event will Sun Microsystems, Inc. be liable for any lost revenue\n * or profits or other special, indirect and consequential damages, even if\n * Sun has been advised of the possibility of such damages.\n * \n * Sun Microsystems, Inc.\n * 2550 Garcia Avenue\n * Mountain View, California  94043\n */\n/*\n * Copyright (c) 1986 - 1991 by Sun Microsystems, Inc.\n */\n\n/*\n * svc.h, Server-side remote procedure call interface.\n */\n\n#ifndef _RPC_SVC_SOC_H\n#define _RPC_SVC_SOC_H\n#include <sys/cdefs.h>\n\n/* #pragma ident   \"@(#)svc_soc.h  1.11    94/04/25 SMI\" */\n/*      svc_soc.h 1.8 89/05/01 SMI      */\n\n/*\n * All the following declarations are only for backward compatibility\n * with TS-RPC\n */\n\n/*\n *  Approved way of getting address of caller\n */\n#define svc_getcaller(x) (&(x)->xp_raddr)\n\n/*\n * Service registration\n *\n * svc_register(xprt, prog, vers, dispatch, protocol)\n *\tSVCXPRT *xprt;\n *\tu_long prog;\n *\tu_long vers;\n *\tvoid (*dispatch)();\n *\tint protocol;    like TCP or UDP, zero means do not register \n */\n__BEGIN_DECLS\nextern bool_t\tsvc_register(SVCXPRT *, u_long, u_long,\n\t\t    void (*)(struct svc_req *, SVCXPRT *), int);\n__END_DECLS\n\n/*\n * Service un-registration\n *\n * svc_unregister(prog, vers)\n *\tu_long prog;\n *\tu_long vers;\n */\n__BEGIN_DECLS\nextern void\tsvc_unregister(u_long, u_long);\n__END_DECLS\n\n\n/*\n * Memory based rpc for testing and timing.\n */\n__BEGIN_DECLS\nextern SVCXPRT *svcraw_create(void);\n__END_DECLS\n\n\n/*\n * Udp based rpc.\n */\n__BEGIN_DECLS\nextern SVCXPRT *svcudp_create(int);\nextern SVCXPRT *svcudp_bufcreate(int, u_int, u_int);\nextern int svcudp_enablecache(SVCXPRT *, u_long);\n__END_DECLS\n\n\n/*\n * Tcp based rpc.\n */\n__BEGIN_DECLS\nextern SVCXPRT *svctcp_create(int, u_int, u_int);\n__END_DECLS\n\n/*\n * Fd based rpc.\n */\n__BEGIN_DECLS\nextern SVCXPRT *svcfd_create(int, u_int, u_int);\n__END_DECLS\n\n#endif /* !_RPC_SVC_SOC_H */\n"
  },
  {
    "path": "freebsd-headers/rpc/types.h",
    "content": "/*\t$NetBSD: types.h,v 1.13 2000/06/13 01:02:44 thorpej Exp $\t*/\n\n/*\n * Sun RPC is a product of Sun Microsystems, Inc. and is provided for\n * unrestricted use provided that this legend is included on all tape\n * media and as a part of the software program in whole or part.  Users\n * may copy or modify Sun RPC without charge, but are not authorized\n * to license or distribute it to anyone else except as part of a product or\n * program developed by the user.\n *\n * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE\n * WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR\n * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.\n *\n * Sun RPC is provided with no support and without any obligation on the\n * part of Sun Microsystems, Inc. to assist in its use, correction,\n * modification or enhancement.\n *\n * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE\n * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC\n * OR ANY PART THEREOF.\n *\n * In no event will Sun Microsystems, Inc. be liable for any lost revenue\n * or profits or other special, indirect and consequential damages, even if\n * Sun has been advised of the possibility of such damages.\n *\n * Sun Microsystems, Inc.\n * 2550 Garcia Avenue\n * Mountain View, California  94043\n *\n *\tfrom: @(#)types.h 1.18 87/07/24 SMI\n *\tfrom: @(#)types.h\t2.3 88/08/15 4.0 RPCSRC\n * $FreeBSD: release/9.0.0/sys/rpc/types.h 177633 2008-03-26 15:23:12Z dfr $\n */\n\n/*\n * Rpc additions to <sys/types.h>\n */\n#ifndef _RPC_TYPES_H\n#define _RPC_TYPES_H\n\n#include <sys/types.h>\n#include <sys/_null.h>\n\ntypedef int32_t bool_t;\ntypedef int32_t enum_t;\n\ntypedef uint32_t rpcprog_t;\ntypedef uint32_t rpcvers_t;\ntypedef uint32_t rpcproc_t;\ntypedef uint32_t rpcprot_t;\ntypedef uint32_t rpcport_t;\ntypedef  int32_t rpc_inline_t;\n\n#define __dontcare__\t-1\n\n#ifndef FALSE\n#\tdefine FALSE\t(0)\n#endif\n#ifndef TRUE\n#\tdefine TRUE\t(1)\n#endif\n\n#ifdef _KERNEL\n#ifdef _SYS_MALLOC_H_\nMALLOC_DECLARE(M_RPC);\n#endif\n#define mem_alloc(bsize)\tmalloc(bsize, M_RPC,  M_WAITOK|M_ZERO)\n#define mem_free(ptr, bsize)\tfree(ptr, M_RPC)\n#else\n#define mem_alloc(bsize)\tcalloc(1, bsize)\n#define mem_free(ptr, bsize)\tfree(ptr)\n#endif\n\n#include <sys/time.h>\n#ifdef _KERNEL\n#include <rpc/netconfig.h>\n#else\n#include <netconfig.h>\n#endif\n\n/*\n * The netbuf structure is defined here, because FreeBSD / NetBSD only use\n * it inside the RPC code. It's in <xti.h> on SVR4, but it would be confusing\n * to have an xti.h, since FreeBSD / NetBSD does not support XTI/TLI.\n */\n\n/*\n * The netbuf structure is used for transport-independent address storage.\n */\nstruct netbuf {\n\tunsigned int maxlen;\n\tunsigned int len;\n\tvoid *buf;\n};\n\n/*\n * The format of the addres and options arguments of the XTI t_bind call.\n * Only provided for compatibility, it should not be used.\n */\n\nstruct t_bind {\n\tstruct netbuf   addr;\n\tunsigned int    qlen;\n};\n\n/*\n * Internal library and rpcbind use. This is not an exported interface, do\n * not use.\n */\nstruct __rpc_sockinfo {\n\tint si_af; \n\tint si_proto;\n\tint si_socktype;\n\tint si_alen;\n};\n\n#endif /* !_RPC_TYPES_H */\n"
  },
  {
    "path": "freebsd-headers/rpc/xdr.h",
    "content": "/*\t$NetBSD: xdr.h,v 1.19 2000/07/17 05:00:45 matt Exp $\t*/\n\n/*\n * Sun RPC is a product of Sun Microsystems, Inc. and is provided for\n * unrestricted use provided that this legend is included on all tape\n * media and as a part of the software program in whole or part.  Users\n * may copy or modify Sun RPC without charge, but are not authorized\n * to license or distribute it to anyone else except as part of a product or\n * program developed by the user.\n *\n * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE\n * WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR\n * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.\n *\n * Sun RPC is provided with no support and without any obligation on the\n * part of Sun Microsystems, Inc. to assist in its use, correction,\n * modification or enhancement.\n *\n * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE\n * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC\n * OR ANY PART THEREOF.\n *\n * In no event will Sun Microsystems, Inc. be liable for any lost revenue\n * or profits or other special, indirect and consequential damages, even if\n * Sun has been advised of the possibility of such damages.\n *\n * Sun Microsystems, Inc.\n * 2550 Garcia Avenue\n * Mountain View, California  94043\n *\n *\tfrom: @(#)xdr.h 1.19 87/04/22 SMI\n *\tfrom: @(#)xdr.h\t2.2 88/07/29 4.0 RPCSRC\n * $FreeBSD: release/9.0.0/include/rpc/xdr.h 223906 2011-07-10 14:03:13Z kevlo $\n */\n\n/*\n * xdr.h, External Data Representation Serialization Routines.\n *\n * Copyright (C) 1984, Sun Microsystems, Inc.\n */\n\n#ifndef _RPC_XDR_H\n#define _RPC_XDR_H\n#include <sys/cdefs.h>\n\n/*\n * XDR provides a conventional way for converting between C data\n * types and an external bit-string representation.  Library supplied\n * routines provide for the conversion on built-in C data types.  These\n * routines and utility routines defined here are used to help implement\n * a type encode/decode routine for each user-defined type.\n *\n * Each data type provides a single procedure which takes two arguments:\n *\n *\tbool_t\n *\txdrproc(xdrs, argresp)\n *\t\tXDR *xdrs;\n *\t\t<type> *argresp;\n *\n * xdrs is an instance of a XDR handle, to which or from which the data\n * type is to be converted.  argresp is a pointer to the structure to be\n * converted.  The XDR handle contains an operation field which indicates\n * which of the operations (ENCODE, DECODE * or FREE) is to be performed.\n *\n * XDR_DECODE may allocate space if the pointer argresp is null.  This\n * data can be freed with the XDR_FREE operation.\n *\n * We write only one procedure per data type to make it easy\n * to keep the encode and decode procedures for a data type consistent.\n * In many cases the same code performs all operations on a user defined type,\n * because all the hard work is done in the component type routines.\n * decode as a series of calls on the nested data types.\n */\n\n/*\n * Xdr operations.  XDR_ENCODE causes the type to be encoded into the\n * stream.  XDR_DECODE causes the type to be extracted from the stream.\n * XDR_FREE can be used to release the space allocated by an XDR_DECODE\n * request.\n */\nenum xdr_op {\n\tXDR_ENCODE=0,\n\tXDR_DECODE=1,\n\tXDR_FREE=2\n};\n\n/*\n * This is the number of bytes per unit of external data.\n */\n#define BYTES_PER_XDR_UNIT\t(4)\n#define RNDUP(x)  ((((x) + BYTES_PER_XDR_UNIT - 1) / BYTES_PER_XDR_UNIT) \\\n\t\t    * BYTES_PER_XDR_UNIT)\n\n/*\n * The XDR handle.\n * Contains operation which is being applied to the stream,\n * an operations vector for the particular implementation (e.g. see xdr_mem.c),\n * and two private fields for the use of the particular implementation.\n */\ntypedef struct __rpc_xdr {\n\tenum xdr_op\tx_op;\t\t/* operation; fast additional param */\n\tconst struct xdr_ops {\n\t\t/* get a long from underlying stream */\n\t\tbool_t\t(*x_getlong)(struct __rpc_xdr *, long *);\n\t\t/* put a long to \" */\n\t\tbool_t\t(*x_putlong)(struct __rpc_xdr *, const long *);\n\t\t/* get some bytes from \" */\n\t\tbool_t\t(*x_getbytes)(struct __rpc_xdr *, char *, u_int);\n\t\t/* put some bytes to \" */\n\t\tbool_t\t(*x_putbytes)(struct __rpc_xdr *, const char *, u_int);\n\t\t/* returns bytes off from beginning */\n\t\tu_int\t(*x_getpostn)(struct __rpc_xdr *);\n\t\t/* lets you reposition the stream */\n\t\tbool_t  (*x_setpostn)(struct __rpc_xdr *, u_int);\n\t\t/* buf quick ptr to buffered data */\n\t\tint32_t *(*x_inline)(struct __rpc_xdr *, u_int);\n\t\t/* free privates of this xdr_stream */\n\t\tvoid\t(*x_destroy)(struct __rpc_xdr *);\n\t\tbool_t\t(*x_control)(struct __rpc_xdr *, int, void *);\n\t} *x_ops;\n\tchar *\t \tx_public;\t/* users' data */\n\tvoid *\t\tx_private;\t/* pointer to private data */\n\tchar * \t\tx_base;\t\t/* private used for position info */\n\tu_int\t\tx_handy;\t/* extra private word */\n} XDR;\n\n/*\n * A xdrproc_t exists for each data type which is to be encoded or decoded.\n *\n * The second argument to the xdrproc_t is a pointer to an opaque pointer.\n * The opaque pointer generally points to a structure of the data type\n * to be decoded.  If this pointer is 0, then the type routines should\n * allocate dynamic storage of the appropriate size and return it.\n */\n#ifdef _KERNEL\ntypedef\tbool_t (*xdrproc_t)(XDR *, void *, u_int);\n#else\n/*\n * XXX can't actually prototype it, because some take three args!!!\n */\ntypedef\tbool_t (*xdrproc_t)(XDR *, ...);\n#endif\n\n/*\n * Operations defined on a XDR handle\n *\n * XDR\t\t*xdrs;\n * long\t\t*longp;\n * char *\t addr;\n * u_int\t len;\n * u_int\t pos;\n */\n#define XDR_GETLONG(xdrs, longp)\t\t\t\\\n\t(*(xdrs)->x_ops->x_getlong)(xdrs, longp)\n#define xdr_getlong(xdrs, longp)\t\t\t\\\n\t(*(xdrs)->x_ops->x_getlong)(xdrs, longp)\n\n#define XDR_PUTLONG(xdrs, longp)\t\t\t\\\n\t(*(xdrs)->x_ops->x_putlong)(xdrs, longp)\n#define xdr_putlong(xdrs, longp)\t\t\t\\\n\t(*(xdrs)->x_ops->x_putlong)(xdrs, longp)\n\nstatic __inline int\nxdr_getint32(XDR *xdrs, int32_t *ip)\n{\n\tlong l;\n\n\tif (!xdr_getlong(xdrs, &l))\n\t\treturn (FALSE);\n\t*ip = (int32_t)l;\n\treturn (TRUE);\n}\n\nstatic __inline int\nxdr_putint32(XDR *xdrs, int32_t *ip)\n{\n\tlong l;\n\n\tl = (long)*ip;\n\treturn xdr_putlong(xdrs, &l);\n}\n\n#define XDR_GETINT32(xdrs, int32p)\txdr_getint32(xdrs, int32p)\n#define XDR_PUTINT32(xdrs, int32p)\txdr_putint32(xdrs, int32p)\n\n#define XDR_GETBYTES(xdrs, addr, len)\t\t\t\\\n\t(*(xdrs)->x_ops->x_getbytes)(xdrs, addr, len)\n#define xdr_getbytes(xdrs, addr, len)\t\t\t\\\n\t(*(xdrs)->x_ops->x_getbytes)(xdrs, addr, len)\n\n#define XDR_PUTBYTES(xdrs, addr, len)\t\t\t\\\n\t(*(xdrs)->x_ops->x_putbytes)(xdrs, addr, len)\n#define xdr_putbytes(xdrs, addr, len)\t\t\t\\\n\t(*(xdrs)->x_ops->x_putbytes)(xdrs, addr, len)\n\n#define XDR_GETPOS(xdrs)\t\t\t\t\\\n\t(*(xdrs)->x_ops->x_getpostn)(xdrs)\n#define xdr_getpos(xdrs)\t\t\t\t\\\n\t(*(xdrs)->x_ops->x_getpostn)(xdrs)\n\n#define XDR_SETPOS(xdrs, pos)\t\t\t\t\\\n\t(*(xdrs)->x_ops->x_setpostn)(xdrs, pos)\n#define xdr_setpos(xdrs, pos)\t\t\t\t\\\n\t(*(xdrs)->x_ops->x_setpostn)(xdrs, pos)\n\n#define\tXDR_INLINE(xdrs, len)\t\t\t\t\\\n\t(*(xdrs)->x_ops->x_inline)(xdrs, len)\n#define\txdr_inline(xdrs, len)\t\t\t\t\\\n\t(*(xdrs)->x_ops->x_inline)(xdrs, len)\n\n#define\tXDR_DESTROY(xdrs)\t\t\t\t\\\n\tif ((xdrs)->x_ops->x_destroy) \t\t\t\\\n\t\t(*(xdrs)->x_ops->x_destroy)(xdrs)\n#define\txdr_destroy(xdrs)\t\t\t\t\\\n\tif ((xdrs)->x_ops->x_destroy) \t\t\t\\\n\t\t(*(xdrs)->x_ops->x_destroy)(xdrs)\n\n#define XDR_CONTROL(xdrs, req, op)\t\t\t\\\n\tif ((xdrs)->x_ops->x_control)\t\t\t\\\n\t\t(*(xdrs)->x_ops->x_control)(xdrs, req, op)\n#define xdr_control(xdrs, req, op) XDR_CONTROL(xdrs, req, op)\n\n/*\n * Solaris strips the '_t' from these types -- not sure why.\n * But, let's be compatible.\n */\n#define xdr_rpcvers(xdrs, versp) xdr_u_int32(xdrs, versp)\n#define xdr_rpcprog(xdrs, progp) xdr_u_int32(xdrs, progp)\n#define xdr_rpcproc(xdrs, procp) xdr_u_int32(xdrs, procp)\n#define xdr_rpcprot(xdrs, protp) xdr_u_int32(xdrs, protp)\n#define xdr_rpcport(xdrs, portp) xdr_u_int32(xdrs, portp)\n\n/*\n * Support struct for discriminated unions.\n * You create an array of xdrdiscrim structures, terminated with\n * an entry with a null procedure pointer.  The xdr_union routine gets\n * the discriminant value and then searches the array of structures\n * for a matching value.  If a match is found the associated xdr routine\n * is called to handle that part of the union.  If there is\n * no match, then a default routine may be called.\n * If there is no match and no default routine it is an error.\n */\n#define NULL_xdrproc_t ((xdrproc_t)0)\nstruct xdr_discrim {\n\tint\tvalue;\n\txdrproc_t proc;\n};\n\n/*\n * In-line routines for fast encode/decode of primitive data types.\n * Caveat emptor: these use single memory cycles to get the\n * data from the underlying buffer, and will fail to operate\n * properly if the data is not aligned.  The standard way to use these\n * is to say:\n *\tif ((buf = XDR_INLINE(xdrs, count)) == NULL)\n *\t\treturn (FALSE);\n *\t<<< macro calls >>>\n * where ``count'' is the number of bytes of data occupied\n * by the primitive data types.\n *\n * N.B. and frozen for all time: each data type here uses 4 bytes\n * of external representation.\n */\n#define IXDR_GET_INT32(buf)\t\t((int32_t)__ntohl((u_int32_t)*(buf)++))\n#define IXDR_PUT_INT32(buf, v)\t\t(*(buf)++ =(int32_t)__htonl((u_int32_t)v))\n#define IXDR_GET_U_INT32(buf)\t\t((u_int32_t)IXDR_GET_INT32(buf))\n#define IXDR_PUT_U_INT32(buf, v)\tIXDR_PUT_INT32((buf), ((int32_t)(v)))\n\n#define IXDR_GET_LONG(buf)\t\t((long)__ntohl((u_int32_t)*(buf)++))\n#define IXDR_PUT_LONG(buf, v)\t\t(*(buf)++ =(int32_t)__htonl((u_int32_t)v))\n\n#define IXDR_GET_BOOL(buf)\t\t((bool_t)IXDR_GET_LONG(buf))\n#define IXDR_GET_ENUM(buf, t)\t\t((t)IXDR_GET_LONG(buf))\n#define IXDR_GET_U_LONG(buf)\t\t((u_long)IXDR_GET_LONG(buf))\n#define IXDR_GET_SHORT(buf)\t\t((short)IXDR_GET_LONG(buf))\n#define IXDR_GET_U_SHORT(buf)\t\t((u_short)IXDR_GET_LONG(buf))\n\n#define IXDR_PUT_BOOL(buf, v)\t\tIXDR_PUT_LONG((buf), (v))\n#define IXDR_PUT_ENUM(buf, v)\t\tIXDR_PUT_LONG((buf), (v))\n#define IXDR_PUT_U_LONG(buf, v)\t\tIXDR_PUT_LONG((buf), (v))\n#define IXDR_PUT_SHORT(buf, v)\t\tIXDR_PUT_LONG((buf), (v))\n#define IXDR_PUT_U_SHORT(buf, v)\tIXDR_PUT_LONG((buf), (v))\n\n/*\n * These are the \"generic\" xdr routines.\n */\n__BEGIN_DECLS\nextern bool_t\txdr_void(void);\nextern bool_t\txdr_int(XDR *, int *);\nextern bool_t\txdr_u_int(XDR *, u_int *);\nextern bool_t\txdr_long(XDR *, long *);\nextern bool_t\txdr_u_long(XDR *, u_long *);\nextern bool_t\txdr_short(XDR *, short *);\nextern bool_t\txdr_u_short(XDR *, u_short *);\nextern bool_t\txdr_int16_t(XDR *, int16_t *);\nextern bool_t\txdr_u_int16_t(XDR *, u_int16_t *);\nextern bool_t\txdr_uint16_t(XDR *, u_int16_t *);\nextern bool_t\txdr_int32_t(XDR *, int32_t *);\nextern bool_t\txdr_u_int32_t(XDR *, u_int32_t *);\nextern bool_t\txdr_uint32_t(XDR *, u_int32_t *);\nextern bool_t\txdr_int64_t(XDR *, int64_t *);\nextern bool_t\txdr_u_int64_t(XDR *, u_int64_t *);\nextern bool_t\txdr_uint64_t(XDR *, u_int64_t *);\nextern bool_t\txdr_bool(XDR *, bool_t *);\nextern bool_t\txdr_enum(XDR *, enum_t *);\nextern bool_t\txdr_array(XDR *, char **, u_int *, u_int, u_int, xdrproc_t);\nextern bool_t\txdr_bytes(XDR *, char **, u_int *, u_int);\nextern bool_t\txdr_opaque(XDR *, char *, u_int);\nextern bool_t\txdr_string(XDR *, char **, u_int);\nextern bool_t\txdr_union(XDR *, enum_t *, char *, const struct xdr_discrim *, xdrproc_t);\nextern bool_t\txdr_char(XDR *, char *);\nextern bool_t\txdr_u_char(XDR *, u_char *);\nextern bool_t\txdr_vector(XDR *, char *, u_int, u_int, xdrproc_t);\nextern bool_t\txdr_float(XDR *, float *);\nextern bool_t\txdr_double(XDR *, double *);\nextern bool_t\txdr_quadruple(XDR *, long double *);\nextern bool_t\txdr_reference(XDR *, char **, u_int, xdrproc_t);\nextern bool_t\txdr_pointer(XDR *, char **, u_int, xdrproc_t);\nextern bool_t\txdr_wrapstring(XDR *, char **);\nextern void\txdr_free(xdrproc_t, void *);\nextern bool_t\txdr_hyper(XDR *, quad_t *);\nextern bool_t\txdr_u_hyper(XDR *, u_quad_t *);\nextern bool_t\txdr_longlong_t(XDR *, quad_t *);\nextern bool_t\txdr_u_longlong_t(XDR *, u_quad_t *);\nextern unsigned long\txdr_sizeof(xdrproc_t, void *);\n__END_DECLS\n\n/*\n * Common opaque bytes objects used by many rpc protocols;\n * declared here due to commonality.\n */\n#define MAX_NETOBJ_SZ 1024\nstruct netobj {\n\tu_int\tn_len;\n\tchar\t*n_bytes;\n};\ntypedef struct netobj netobj;\nextern bool_t   xdr_netobj(XDR *, struct netobj *);\n\n/*\n * These are the public routines for the various implementations of\n * xdr streams.\n */\n__BEGIN_DECLS\n/* XDR using memory buffers */\nextern void   xdrmem_create(XDR *, char *, u_int, enum xdr_op);\n\n/* XDR using stdio library */\n#ifdef _STDIO_H_\nextern void   xdrstdio_create(XDR *, FILE *, enum xdr_op);\n#endif\n\n/* XDR pseudo records for tcp */\nextern void   xdrrec_create(XDR *, u_int, u_int, void *,\n\t\t\t    int (*)(void *, void *, int),\n\t\t\t    int (*)(void *, void *, int));\n\n/* make end of xdr record */\nextern bool_t xdrrec_endofrecord(XDR *, int);\n\n/* move to beginning of next record */\nextern bool_t xdrrec_skiprecord(XDR *);\n\n/* true if no more input */\nextern bool_t xdrrec_eof(XDR *);\nextern u_int xdrrec_readbytes(XDR *, caddr_t, u_int);\n__END_DECLS\n\n#endif /* !_RPC_XDR_H */\n"
  },
  {
    "path": "freebsd-headers/rpcsvc/bootparam_prot.h",
    "content": "/*\n * Please do not edit this file.\n * It was generated using rpcgen.\n */\n\n#ifndef _BOOTPARAM_PROT_H_RPCGEN\n#define\t_BOOTPARAM_PROT_H_RPCGEN\n\n#include <rpc/rpc.h>\n\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\n#include <rpc/types.h>\n#include <sys/time.h>\n#include <sys/errno.h>\n#include <sys/param.h>\n#include <sys/syslimits.h>\n#define\tMAX_MACHINE_NAME 255\n#define\tMAX_PATH_LEN 1024\n#define\tMAX_FILEID 32\n#define\tIP_ADDR_TYPE 1\n\ntypedef char *bp_machine_name_t;\n\ntypedef char *bp_path_t;\n\ntypedef char *bp_fileid_t;\n\nstruct ip_addr_t {\n\tchar net;\n\tchar host;\n\tchar lh;\n\tchar impno;\n};\ntypedef struct ip_addr_t ip_addr_t;\n\nstruct bp_address {\n\tint address_type;\n\tunion {\n\t\tip_addr_t ip_addr;\n\t} bp_address_u;\n};\ntypedef struct bp_address bp_address;\n\nstruct bp_whoami_arg {\n\tbp_address client_address;\n};\ntypedef struct bp_whoami_arg bp_whoami_arg;\n\nstruct bp_whoami_res {\n\tbp_machine_name_t client_name;\n\tbp_machine_name_t domain_name;\n\tbp_address router_address;\n};\ntypedef struct bp_whoami_res bp_whoami_res;\n\nstruct bp_getfile_arg {\n\tbp_machine_name_t client_name;\n\tbp_fileid_t file_id;\n};\ntypedef struct bp_getfile_arg bp_getfile_arg;\n\nstruct bp_getfile_res {\n\tbp_machine_name_t server_name;\n\tbp_address server_address;\n\tbp_path_t server_path;\n};\ntypedef struct bp_getfile_res bp_getfile_res;\n\n#define\tBOOTPARAMPROG ((unsigned long)(100026))\n#define\tBOOTPARAMVERS ((unsigned long)(1))\n\nextern  void bootparamprog_1(struct svc_req *rqstp, SVCXPRT *transp);\n#define\tBOOTPARAMPROC_WHOAMI ((unsigned long)(1))\nextern  bp_whoami_res * bootparamproc_whoami_1(bp_whoami_arg *, CLIENT *);\nextern  bp_whoami_res * bootparamproc_whoami_1_svc(bp_whoami_arg *, struct svc_req *);\n#define\tBOOTPARAMPROC_GETFILE ((unsigned long)(2))\nextern  bp_getfile_res * bootparamproc_getfile_1(bp_getfile_arg *, CLIENT *);\nextern  bp_getfile_res * bootparamproc_getfile_1_svc(bp_getfile_arg *, struct svc_req *);\nextern int bootparamprog_1_freeresult(SVCXPRT *, xdrproc_t, caddr_t);\n\n/* the xdr functions */\nextern  bool_t xdr_bp_machine_name_t(XDR *, bp_machine_name_t*);\nextern  bool_t xdr_bp_path_t(XDR *, bp_path_t*);\nextern  bool_t xdr_bp_fileid_t(XDR *, bp_fileid_t*);\nextern  bool_t xdr_ip_addr_t(XDR *, ip_addr_t*);\nextern  bool_t xdr_bp_address(XDR *, bp_address*);\nextern  bool_t xdr_bp_whoami_arg(XDR *, bp_whoami_arg*);\nextern  bool_t xdr_bp_whoami_res(XDR *, bp_whoami_res*);\nextern  bool_t xdr_bp_getfile_arg(XDR *, bp_getfile_arg*);\nextern  bool_t xdr_bp_getfile_res(XDR *, bp_getfile_res*);\n\n#ifdef __cplusplus\n}\n#endif\n\n#endif /* !_BOOTPARAM_PROT_H_RPCGEN */\n"
  },
  {
    "path": "freebsd-headers/rpcsvc/bootparam_prot.x",
    "content": "/*\n * Sun RPC is a product of Sun Microsystems, Inc. and is provided for\n * unrestricted use provided that this legend is included on all tape\n * media and as a part of the software program in whole or part.  Users\n * may copy or modify Sun RPC without charge, but are not authorized\n * to license or distribute it to anyone else except as part of a product or\n * program developed by the user.\n * \n * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE\n * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR\n * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.\n * \n * Sun RPC is provided with no support and without any obligation on the\n * part of Sun Microsystems, Inc. to assist in its use, correction,\n * modification or enhancement.\n * \n * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE\n * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC\n * OR ANY PART THEREOF.\n * \n * In no event will Sun Microsystems, Inc. be liable for any lost revenue\n * or profits or other special, indirect and consequential damages, even if\n * Sun has been advised of the possibility of such damages.\n * \n * Sun Microsystems, Inc.\n * 2550 Garcia Avenue\n * Mountain View, California  94043\n */\n\n/*\n * RPC for bootparms service.\n * There are two procedures:\n *   WHOAMI takes a net address and returns a client name and also a\n *\tlikely net address for routing\n *   GETFILE takes a client name and file identifier and returns the\n *\tserver name, server net address and pathname for the file.\n *   file identifiers typically include root, swap, pub and dump\n */\n\n#ifdef RPC_HDR\n%#include <rpc/types.h>\n%#include <sys/time.h>\n%#include <sys/errno.h>\n%#include <sys/param.h>\n%#include <sys/syslimits.h>\n#else\n%#ifndef lint\n%/*static char sccsid[] = \"from: @(#)bootparam_prot.x 1.2 87/06/24 Copyr 1987 Sun Micro\";*/\n%/*static char sccsid[] = \"from: @(#)bootparam_prot.x\t2.1 88/08/01 4.0 RPCSRC\";*/\n%#endif /* not lint */\n%#include <sys/cdefs.h>\n%__FBSDID(\"$FreeBSD: release/9.0.0/include/rpcsvc/bootparam_prot.x 114629 2003-05-04 02:51:42Z obrien $\");\n#endif\n\nconst MAX_MACHINE_NAME  = 255;\nconst MAX_PATH_LEN\t= 1024;\nconst MAX_FILEID\t= 32;\nconst IP_ADDR_TYPE\t= 1;\n\ntypedef\tstring\tbp_machine_name_t<MAX_MACHINE_NAME>;\ntypedef\tstring\tbp_path_t<MAX_PATH_LEN>;\ntypedef\tstring\tbp_fileid_t<MAX_FILEID>;\n\nstruct\tip_addr_t {\n\tchar\tnet;\n\tchar\thost;\n\tchar\tlh;\n\tchar\timpno;\n};\n\nunion bp_address switch (int address_type) {\n\tcase IP_ADDR_TYPE:\n\t\tip_addr_t\tip_addr;\n};\n\nstruct bp_whoami_arg {\n\tbp_address\t\tclient_address;\n};\n\nstruct bp_whoami_res {\n\tbp_machine_name_t\tclient_name;\n\tbp_machine_name_t\tdomain_name;\n\tbp_address\t\trouter_address;\n};\n\nstruct bp_getfile_arg {\n\tbp_machine_name_t\tclient_name;\n\tbp_fileid_t\t\tfile_id;\n};\n\t\nstruct bp_getfile_res {\n\tbp_machine_name_t\tserver_name;\n\tbp_address\t\tserver_address;\n\tbp_path_t\t\tserver_path;\n};\n\nprogram BOOTPARAMPROG {\n\tversion BOOTPARAMVERS {\n\t\tbp_whoami_res\tBOOTPARAMPROC_WHOAMI(bp_whoami_arg) = 1;\n\t\tbp_getfile_res\tBOOTPARAMPROC_GETFILE(bp_getfile_arg) = 2;\n\t} = 1;\n} = 100026;\n"
  },
  {
    "path": "freebsd-headers/rpcsvc/crypt.h",
    "content": "/*\n * Please do not edit this file.\n * It was generated using rpcgen.\n */\n\n#ifndef _CRYPT_H_RPCGEN\n#define\t_CRYPT_H_RPCGEN\n\n#include <rpc/rpc.h>\n\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\n\nenum des_dir {\n\tENCRYPT_DES = 0,\n\tDECRYPT_DES = 1\n};\ntypedef enum des_dir des_dir;\n\nenum des_mode {\n\tCBC_DES = 0,\n\tECB_DES = 1\n};\ntypedef enum des_mode des_mode;\n\nstruct desargs {\n\tu_char des_key[8];\n\tdes_dir des_dir;\n\tdes_mode des_mode;\n\tu_char des_ivec[8];\n\tstruct {\n\t\tu_int desbuf_len;\n\t\tchar *desbuf_val;\n\t} desbuf;\n};\ntypedef struct desargs desargs;\n\nstruct desresp {\n\tstruct {\n\t\tu_int desbuf_len;\n\t\tchar *desbuf_val;\n\t} desbuf;\n\tu_char des_ivec[8];\n\tint stat;\n};\ntypedef struct desresp desresp;\n\n#define\tCRYPT_PROG ((unsigned long)(600100029))\n#define\tCRYPT_VERS ((unsigned long)(1))\n\nextern  void crypt_prog_1(struct svc_req *rqstp, SVCXPRT *transp);\n#define\tDES_CRYPT ((unsigned long)(1))\nextern  desresp * des_crypt_1(desargs *, CLIENT *);\nextern  desresp * des_crypt_1_svc(desargs *, struct svc_req *);\nextern int crypt_prog_1_freeresult(SVCXPRT *, xdrproc_t, caddr_t);\n\n/* the xdr functions */\nextern  bool_t xdr_des_dir(XDR *, des_dir*);\nextern  bool_t xdr_des_mode(XDR *, des_mode*);\nextern  bool_t xdr_desargs(XDR *, desargs*);\nextern  bool_t xdr_desresp(XDR *, desresp*);\n\n#ifdef __cplusplus\n}\n#endif\n\n#endif /* !_CRYPT_H_RPCGEN */\n"
  },
  {
    "path": "freebsd-headers/rpcsvc/crypt.x",
    "content": "/*\n * Copyright (c) 1996\n *\tBill Paul <wpaul@ctr.columbia.edu>.  All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. All advertising materials mentioning features or use of this software\n *    must display the following acknowledgement:\n *\tThis product includes software developed by Bill Paul.\n * 4. Neither the name of the author nor the names of any co-contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY Bill Paul AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL Bill Paul OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n */\n\n#ifndef RPC_HDR\n%#include <sys/cdefs.h>\n%__FBSDID(\"$FreeBSD: release/9.0.0/include/rpcsvc/crypt.x 114629 2003-05-04 02:51:42Z obrien $\");\n#endif\n\n/*\n * This protocol definition exists because of the U.S. government and\n * its stupid export laws. We can't export DES code from the United\n * States to other countries (even though the code already exists\n * outside the U.S. -- go figure that one out) but we need to make\n * Secure RPC work. The normal way around this is to break the DES\n * code out into a shared library; we can then provide a dummy lib\n * in the base OS and provide the real lib in the secure dist, which\n * the user can install later. But we need Secure RPC for NIS+, and\n * there are several system programs that use NIS+ which are statically\n * linked. We would have to provide replacements for these programs\n * in the secure dist, but there are a lot, and this is a pain. The\n * shared lib trick won't work for these programs, and we can't change\n * them once they're compiled.\n *\n * One solution for this problem is to do the DES encryption as a system\n * call; no programs need to be changed and we can even supply the DES\n * support as an LKM. But this bloats the kernel. Maybe if we have\n * Secure NFS one day this will be worth it, but for now we should keep\n * this mess in user space.\n *\n * So we have this second solution: we provide a server that does the\n * DES encryption for us. In this case, the server is keyserv (we need\n * it to make Secure RPC work anyway) and we use this protocol to ship\n * the data back and forth between keyserv and the application.\n */\n\nenum des_dir { ENCRYPT_DES, DECRYPT_DES };\nenum des_mode { CBC_DES, ECB_DES };\n\nstruct desargs {\n\tu_char des_key[8];\t/* key (with low bit parity) */\n\tdes_dir des_dir;\t/* direction */\n\tdes_mode des_mode;\t/* mode */\n\tu_char des_ivec[8];\t/* input vector */\n\topaque desbuf<>;\n};\n\nstruct desresp {\n\topaque desbuf<>;\n\tu_char des_ivec[8];\n\tint stat;\n};\n\nprogram CRYPT_PROG {\n\tversion CRYPT_VERS {\n\t\tdesresp\n\t\tDES_CRYPT(desargs) = 1;\n\t} = 1;\n} = 600100029;\n"
  },
  {
    "path": "freebsd-headers/rpcsvc/key_prot.h",
    "content": "/*\n * Please do not edit this file.\n * It was generated using rpcgen.\n */\n\n#ifndef _KEY_PROT_H_RPCGEN\n#define\t_KEY_PROT_H_RPCGEN\n\n#include <rpc/rpc.h>\n\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\n/*\n * Sun RPC is a product of Sun Microsystems, Inc. and is provided for\n * unrestricted use provided that this legend is included on all tape\n * media and as a part of the software program in whole or part.  Users\n * may copy or modify Sun RPC without charge, but are not authorized\n * to license or distribute it to anyone else except as part of a product or\n * program developed by the user.\n *\n * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE\n * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR\n * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.\n *\n * Sun RPC is provided with no support and without any obligation on the\n * part of Sun Microsystems, Inc. to assist in its use, correction,\n * modification or enhancement.\n *\n * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE\n * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC\n * OR ANY PART THEREOF.\n *\n * In no event will Sun Microsystems, Inc. be liable for any lost revenue\n * or profits or other special, indirect and consequential damages, even if\n * Sun has been advised of the possibility of such damages.\n *\n * Sun Microsystems, Inc.\n * 2550 Garcia Avenue\n * Mountain View, California  94043\n */\n/* From: #pragma ident\t\"@(#)key_prot.x\t1.7\t94/04/29 SMI\" */\n/* Copyright (c)  1990, 1991 Sun Microsystems, Inc. */\n#include <sys/cdefs.h>\n__FBSDID(\"$FreeBSD: release/9.0.0/include/rpcsvc/key_prot.x 114629 2003-05-04 02:51:42Z obrien $\");\n\n/* \n * Compiled from key_prot.x using rpcgen.\n * DO NOT EDIT THIS FILE!\n * This is NOT source code!\n */\n#define\tPROOT 3\n#define\tHEXMODULUS \"d4a0ba0250b6fd2ec626e7efd637df76c716e22d0944b88b\"\n#define\tHEXKEYBYTES 48\n#define\tKEYSIZE 192\n#define\tKEYBYTES 24\n#define\tKEYCHECKSUMSIZE 16\n\nenum keystatus {\n\tKEY_SUCCESS = 0,\n\tKEY_NOSECRET = 1,\n\tKEY_UNKNOWN = 2,\n\tKEY_SYSTEMERR = 3\n};\ntypedef enum keystatus keystatus;\n\ntypedef char keybuf[HEXKEYBYTES];\n\ntypedef char *netnamestr;\n\nstruct cryptkeyarg {\n\tnetnamestr remotename;\n\tdes_block deskey;\n};\ntypedef struct cryptkeyarg cryptkeyarg;\n\nstruct cryptkeyarg2 {\n\tnetnamestr remotename;\n\tnetobj remotekey;\n\tdes_block deskey;\n};\ntypedef struct cryptkeyarg2 cryptkeyarg2;\n\nstruct cryptkeyres {\n\tkeystatus status;\n\tunion {\n\t\tdes_block deskey;\n\t} cryptkeyres_u;\n};\ntypedef struct cryptkeyres cryptkeyres;\n#define\tMAXGIDS 16\n\nstruct unixcred {\n\tu_int uid;\n\tu_int gid;\n\tstruct {\n\t\tu_int gids_len;\n\t\tu_int *gids_val;\n\t} gids;\n};\ntypedef struct unixcred unixcred;\n\nstruct getcredres {\n\tkeystatus status;\n\tunion {\n\t\tunixcred cred;\n\t} getcredres_u;\n};\ntypedef struct getcredres getcredres;\n\nstruct key_netstarg {\n\tkeybuf st_priv_key;\n\tkeybuf st_pub_key;\n\tnetnamestr st_netname;\n};\ntypedef struct key_netstarg key_netstarg;\n\nstruct key_netstres {\n\tkeystatus status;\n\tunion {\n\t\tkey_netstarg knet;\n\t} key_netstres_u;\n};\ntypedef struct key_netstres key_netstres;\n\n#ifndef opaque\n#define opaque char\n#endif\n\n\n#define\tKEY_PROG ((unsigned long)(100029))\n#define\tKEY_VERS ((unsigned long)(1))\n\nextern  void key_prog_1(struct svc_req *rqstp, SVCXPRT *transp);\n#define\tKEY_SET ((unsigned long)(1))\nextern  keystatus * key_set_1(char *, CLIENT *);\nextern  keystatus * key_set_1_svc(char *, struct svc_req *);\n#define\tKEY_ENCRYPT ((unsigned long)(2))\nextern  cryptkeyres * key_encrypt_1(cryptkeyarg *, CLIENT *);\nextern  cryptkeyres * key_encrypt_1_svc(cryptkeyarg *, struct svc_req *);\n#define\tKEY_DECRYPT ((unsigned long)(3))\nextern  cryptkeyres * key_decrypt_1(cryptkeyarg *, CLIENT *);\nextern  cryptkeyres * key_decrypt_1_svc(cryptkeyarg *, struct svc_req *);\n#define\tKEY_GEN ((unsigned long)(4))\nextern  des_block * key_gen_1(void *, CLIENT *);\nextern  des_block * key_gen_1_svc(void *, struct svc_req *);\n#define\tKEY_GETCRED ((unsigned long)(5))\nextern  getcredres * key_getcred_1(netnamestr *, CLIENT *);\nextern  getcredres * key_getcred_1_svc(netnamestr *, struct svc_req *);\nextern int key_prog_1_freeresult(SVCXPRT *, xdrproc_t, caddr_t);\n#define\tKEY_VERS2 ((unsigned long)(2))\n\nextern  void key_prog_2(struct svc_req *rqstp, SVCXPRT *transp);\nextern  keystatus * key_set_2(char *, CLIENT *);\nextern  keystatus * key_set_2_svc(char *, struct svc_req *);\nextern  cryptkeyres * key_encrypt_2(cryptkeyarg *, CLIENT *);\nextern  cryptkeyres * key_encrypt_2_svc(cryptkeyarg *, struct svc_req *);\nextern  cryptkeyres * key_decrypt_2(cryptkeyarg *, CLIENT *);\nextern  cryptkeyres * key_decrypt_2_svc(cryptkeyarg *, struct svc_req *);\nextern  des_block * key_gen_2(void *, CLIENT *);\nextern  des_block * key_gen_2_svc(void *, struct svc_req *);\nextern  getcredres * key_getcred_2(netnamestr *, CLIENT *);\nextern  getcredres * key_getcred_2_svc(netnamestr *, struct svc_req *);\n#define\tKEY_ENCRYPT_PK ((unsigned long)(6))\nextern  cryptkeyres * key_encrypt_pk_2(cryptkeyarg2 *, CLIENT *);\nextern  cryptkeyres * key_encrypt_pk_2_svc(cryptkeyarg2 *, struct svc_req *);\n#define\tKEY_DECRYPT_PK ((unsigned long)(7))\nextern  cryptkeyres * key_decrypt_pk_2(cryptkeyarg2 *, CLIENT *);\nextern  cryptkeyres * key_decrypt_pk_2_svc(cryptkeyarg2 *, struct svc_req *);\n#define\tKEY_NET_PUT ((unsigned long)(8))\nextern  keystatus * key_net_put_2(key_netstarg *, CLIENT *);\nextern  keystatus * key_net_put_2_svc(key_netstarg *, struct svc_req *);\n#define\tKEY_NET_GET ((unsigned long)(9))\nextern  key_netstres * key_net_get_2(void *, CLIENT *);\nextern  key_netstres * key_net_get_2_svc(void *, struct svc_req *);\n#define\tKEY_GET_CONV ((unsigned long)(10))\nextern  cryptkeyres * key_get_conv_2(char *, CLIENT *);\nextern  cryptkeyres * key_get_conv_2_svc(char *, struct svc_req *);\nextern int key_prog_2_freeresult(SVCXPRT *, xdrproc_t, caddr_t);\n\n/* the xdr functions */\nextern  bool_t xdr_keystatus(XDR *, keystatus*);\nextern  bool_t xdr_keybuf(XDR *, keybuf);\nextern  bool_t xdr_netnamestr(XDR *, netnamestr*);\nextern  bool_t xdr_cryptkeyarg(XDR *, cryptkeyarg*);\nextern  bool_t xdr_cryptkeyarg2(XDR *, cryptkeyarg2*);\nextern  bool_t xdr_cryptkeyres(XDR *, cryptkeyres*);\nextern  bool_t xdr_unixcred(XDR *, unixcred*);\nextern  bool_t xdr_getcredres(XDR *, getcredres*);\nextern  bool_t xdr_key_netstarg(XDR *, key_netstarg*);\nextern  bool_t xdr_key_netstres(XDR *, key_netstres*);\n\n#ifdef __cplusplus\n}\n#endif\n\n#endif /* !_KEY_PROT_H_RPCGEN */\n"
  },
  {
    "path": "freebsd-headers/rpcsvc/key_prot.x",
    "content": "%/*\n% * Sun RPC is a product of Sun Microsystems, Inc. and is provided for\n% * unrestricted use provided that this legend is included on all tape\n% * media and as a part of the software program in whole or part.  Users\n% * may copy or modify Sun RPC without charge, but are not authorized\n% * to license or distribute it to anyone else except as part of a product or\n% * program developed by the user.\n% *\n% * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE\n% * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR\n% * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.\n% *\n% * Sun RPC is provided with no support and without any obligation on the\n% * part of Sun Microsystems, Inc. to assist in its use, correction,\n% * modification or enhancement.\n% *\n% * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE\n% * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC\n% * OR ANY PART THEREOF.\n% *\n% * In no event will Sun Microsystems, Inc. be liable for any lost revenue\n% * or profits or other special, indirect and consequential damages, even if\n% * Sun has been advised of the possibility of such damages.\n% *\n% * Sun Microsystems, Inc.\n% * 2550 Garcia Avenue\n% * Mountain View, California  94043\n% */\n/*\n * Key server protocol definition\n * Copyright (C) 1990, 1991 Sun Microsystems, Inc.\n *\n * The keyserver is a public key storage/encryption/decryption service\n * The encryption method used is based on the Diffie-Hellman exponential\n * key exchange technology.\n *\n * The key server is local to each machine, akin to the portmapper.\n * Under TI-RPC, communication with the keyserver is through the\n * loopback transport.\n *\n * NOTE: This .x file generates the USER level headers for the keyserver.\n * the KERNEL level headers are created by hand as they kernel has special\n * requirements.\n */\n\n%/* From: #pragma ident\t\"@(#)key_prot.x\t1.7\t94/04/29 SMI\" */\n%/* Copyright (c)  1990, 1991 Sun Microsystems, Inc. */\n%#include <sys/cdefs.h>\n%__FBSDID(\"$FreeBSD: release/9.0.0/include/rpcsvc/key_prot.x 114629 2003-05-04 02:51:42Z obrien $\");\n%\n%/* \n% * Compiled from key_prot.x using rpcgen.\n% * DO NOT EDIT THIS FILE!\n% * This is NOT source code!\n% */\n\n/*\n * PROOT and MODULUS define the way the Diffie-Hellman key is generated.\n *\n * MODULUS should be chosen as a prime of the form: MODULUS == 2*p + 1,\n * where p is also prime.\n *\n * PROOT satisfies the following two conditions:\n * (1) (PROOT ** 2) % MODULUS != 1\n * (2) (PROOT ** p) % MODULUS != 1\n *\n */\n\nconst PROOT = 3;\nconst HEXMODULUS = \"d4a0ba0250b6fd2ec626e7efd637df76c716e22d0944b88b\";\n\nconst HEXKEYBYTES = 48;\t\t/* HEXKEYBYTES == strlen(HEXMODULUS) */\nconst KEYSIZE = 192;\t\t/* KEYSIZE == bit length of key */\nconst KEYBYTES = 24;\t\t/* byte length of key */\n\n/*\n * The first 16 hex digits of the encrypted secret key are used as\n * a checksum in the database.\n */\nconst KEYCHECKSUMSIZE = 16;\n\n/*\n * status of operation\n */\nenum keystatus {\n\tKEY_SUCCESS,\t/* no problems */\n\tKEY_NOSECRET,\t/* no secret key stored */\n\tKEY_UNKNOWN,\t/* unknown netname */\n\tKEY_SYSTEMERR \t/* system error (out of memory, encryption failure) */\n};\n\ntypedef opaque keybuf[HEXKEYBYTES];\t/* store key in hex */\n\ntypedef string netnamestr<MAXNETNAMELEN>;\n\n/*\n * Argument to ENCRYPT or DECRYPT \n */\nstruct cryptkeyarg {\n\tnetnamestr remotename;\n\tdes_block deskey;\n};\n\n/*\n * Argument to ENCRYPT_PK or DECRYPT_PK\n */\nstruct cryptkeyarg2 {\n\tnetnamestr remotename;\n\tnetobj\tremotekey;\t/* Contains a length up to 1024 bytes */\n\tdes_block deskey;\n};\n\n\n/*\n * Result of ENCRYPT, DECRYPT, ENCRYPT_PK, and DECRYPT_PK\n */\nunion cryptkeyres switch (keystatus status) {\ncase KEY_SUCCESS:\n\tdes_block deskey;\ndefault:\n\tvoid;\n};\n\nconst MAXGIDS  = 16;\t/* max number of gids in gid list */\n\n/*\n * Unix credential \n */\t\nstruct unixcred {\n\tu_int uid;\n\tu_int gid;\n\tu_int gids<MAXGIDS>;\t\n};\n\n/*\n * Result returned from GETCRED\n */\nunion getcredres switch (keystatus status) {\ncase KEY_SUCCESS:\n\tunixcred cred;\ndefault:\n\tvoid;\n};\n/*\n * key_netstarg;\n */\n\nstruct key_netstarg {\n\tkeybuf st_priv_key;\n\tkeybuf st_pub_key;\n\tnetnamestr st_netname;\n};\n\nunion key_netstres switch (keystatus status){\ncase KEY_SUCCESS:\n\tkey_netstarg knet;\ndefault:\n\tvoid;\n};\t\n\n#ifdef RPC_HDR\n%\n%#ifndef opaque\n%#define opaque char\n%#endif\n%\n#endif\nprogram KEY_PROG {\n\tversion KEY_VERS {\n\n\t\t/*\n\t\t * This is my secret key.\n\t \t * Store it for me.\n\t\t */\n\t\tkeystatus \n\t\tKEY_SET(keybuf) = 1;\t\n\t\n\t\t/*\n\t\t * I want to talk to X.\n\t\t * Encrypt a conversation key for me.\n\t \t */\n\t\tcryptkeyres\n\t\tKEY_ENCRYPT(cryptkeyarg) = 2;\t\n\n\t\t/*\n\t\t * X just sent me a message.\n\t\t * Decrypt the conversation key for me.\n\t\t */\n\t\tcryptkeyres\n\t\tKEY_DECRYPT(cryptkeyarg) = 3;\n\n\t\t/*\n\t\t * Generate a secure conversation key for me\n\t\t */\n\t\tdes_block \n\t\tKEY_GEN(void) = 4;\n\n\t\t/*\n\t\t * Get me the uid, gid and group-access-list associated\n\t\t * with this netname (for kernel which cannot use NIS)\n\t\t */\n\t\tgetcredres\n\t\tKEY_GETCRED(netnamestr) = 5;\n\t} = 1;\n\tversion KEY_VERS2 {\n\n\t\t/*\n\t\t * #######\n\t\t * Procedures 1-5 are identical to version 1\n\t\t * #######\n\t\t */\n\n\t\t/*\n\t\t * This is my secret key.\n\t \t * Store it for me.\n\t\t */\n\t\tkeystatus \n\t\tKEY_SET(keybuf) = 1;\t\n\t\n\t\t/*\n\t\t * I want to talk to X.\n\t\t * Encrypt a conversation key for me.\n\t \t */\n\t\tcryptkeyres\n\t\tKEY_ENCRYPT(cryptkeyarg) = 2;\t\n\n\t\t/*\n\t\t * X just sent me a message.\n\t\t * Decrypt the conversation key for me.\n\t\t */\n\t\tcryptkeyres\n\t\tKEY_DECRYPT(cryptkeyarg) = 3;\n\n\t\t/*\n\t\t * Generate a secure conversation key for me\n\t\t */\n\t\tdes_block \n\t\tKEY_GEN(void) = 4;\n\n\t\t/*\n\t\t * Get me the uid, gid and group-access-list associated\n\t\t * with this netname (for kernel which cannot use NIS)\n\t\t */\n\t\tgetcredres\n\t\tKEY_GETCRED(netnamestr) = 5;\n\t\t\n\t\t/*\n\t\t * I want to talk to X. and I know X's public key\n\t\t * Encrypt a conversation key for me.\n\t \t */\n\t\tcryptkeyres\n\t\tKEY_ENCRYPT_PK(cryptkeyarg2) = 6;\t\n\n\t\t/*\n\t\t * X just sent me a message. and I know X's public key\n\t\t * Decrypt the conversation key for me.\n\t\t */\n\t\tcryptkeyres\n\t\tKEY_DECRYPT_PK(cryptkeyarg2) = 7;\n\t\t\n\t\t/* \n\t\t * Store my public key, netname and private key. \n\t\t */\n\t\tkeystatus\n\t\tKEY_NET_PUT(key_netstarg) = 8;\n\t\t\n\t\t/*\n\t\t * Retrieve my public key, netname and private key. \n\t\t */\n \t\tkey_netstres\n\t\tKEY_NET_GET(void) = 9;\n\t\t\n\t\t/*\n\t\t * Return me the conversation key that is constructed \n\t\t * from my secret key and this publickey. \n\t\t */\n\n\t\tcryptkeyres \n\t\tKEY_GET_CONV(keybuf) = 10; \n\n\t\t\n\t} = 2;\n} = 100029;\n\n\n"
  },
  {
    "path": "freebsd-headers/rpcsvc/klm_prot.h",
    "content": "/*\n * Please do not edit this file.\n * It was generated using rpcgen.\n */\n\n#ifndef _KLM_PROT_H_RPCGEN\n#define\t_KLM_PROT_H_RPCGEN\n\n#include <rpc/rpc.h>\n\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\n#define\tLM_MAXSTRLEN 1024\n\nenum klm_stats {\n\tklm_granted = 0,\n\tklm_denied = 1,\n\tklm_denied_nolocks = 2,\n\tklm_working = 3\n};\ntypedef enum klm_stats klm_stats;\n\nstruct klm_lock {\n\tchar *server_name;\n\tnetobj fh;\n\tint pid;\n\tu_int l_offset;\n\tu_int l_len;\n};\ntypedef struct klm_lock klm_lock;\n\nstruct klm_holder {\n\tbool_t exclusive;\n\tint svid;\n\tu_int l_offset;\n\tu_int l_len;\n};\ntypedef struct klm_holder klm_holder;\n\nstruct klm_stat {\n\tklm_stats stat;\n};\ntypedef struct klm_stat klm_stat;\n\nstruct klm_testrply {\n\tklm_stats stat;\n\tunion {\n\t\tstruct klm_holder holder;\n\t} klm_testrply_u;\n};\ntypedef struct klm_testrply klm_testrply;\n\nstruct klm_lockargs {\n\tbool_t block;\n\tbool_t exclusive;\n\tstruct klm_lock alock;\n};\ntypedef struct klm_lockargs klm_lockargs;\n\nstruct klm_testargs {\n\tbool_t exclusive;\n\tstruct klm_lock alock;\n};\ntypedef struct klm_testargs klm_testargs;\n\nstruct klm_unlockargs {\n\tstruct klm_lock alock;\n};\ntypedef struct klm_unlockargs klm_unlockargs;\n\n#define\tKLM_PROG ((unsigned long)(100020))\n#define\tKLM_VERS ((unsigned long)(1))\n\nextern  void klm_prog_1(struct svc_req *rqstp, SVCXPRT *transp);\n#define\tKLM_TEST ((unsigned long)(1))\nextern  klm_testrply * klm_test_1(struct klm_testargs *, CLIENT *);\nextern  klm_testrply * klm_test_1_svc(struct klm_testargs *, struct svc_req *);\n#define\tKLM_LOCK ((unsigned long)(2))\nextern  klm_stat * klm_lock_1(struct klm_lockargs *, CLIENT *);\nextern  klm_stat * klm_lock_1_svc(struct klm_lockargs *, struct svc_req *);\n#define\tKLM_CANCEL ((unsigned long)(3))\nextern  klm_stat * klm_cancel_1(struct klm_lockargs *, CLIENT *);\nextern  klm_stat * klm_cancel_1_svc(struct klm_lockargs *, struct svc_req *);\n#define\tKLM_UNLOCK ((unsigned long)(4))\nextern  klm_stat * klm_unlock_1(struct klm_unlockargs *, CLIENT *);\nextern  klm_stat * klm_unlock_1_svc(struct klm_unlockargs *, struct svc_req *);\nextern int klm_prog_1_freeresult(SVCXPRT *, xdrproc_t, caddr_t);\n\n/* the xdr functions */\nextern  bool_t xdr_klm_stats(XDR *, klm_stats*);\nextern  bool_t xdr_klm_lock(XDR *, klm_lock*);\nextern  bool_t xdr_klm_holder(XDR *, klm_holder*);\nextern  bool_t xdr_klm_stat(XDR *, klm_stat*);\nextern  bool_t xdr_klm_testrply(XDR *, klm_testrply*);\nextern  bool_t xdr_klm_lockargs(XDR *, klm_lockargs*);\nextern  bool_t xdr_klm_testargs(XDR *, klm_testargs*);\nextern  bool_t xdr_klm_unlockargs(XDR *, klm_unlockargs*);\n\n#ifdef __cplusplus\n}\n#endif\n\n#endif /* !_KLM_PROT_H_RPCGEN */\n"
  },
  {
    "path": "freebsd-headers/rpcsvc/klm_prot.x",
    "content": "/*\n * Sun RPC is a product of Sun Microsystems, Inc. and is provided for\n * unrestricted use provided that this legend is included on all tape\n * media and as a part of the software program in whole or part.  Users\n * may copy or modify Sun RPC without charge, but are not authorized\n * to license or distribute it to anyone else except as part of a product or\n * program developed by the user.\n * \n * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE\n * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR\n * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.\n * \n * Sun RPC is provided with no support and without any obligation on the\n * part of Sun Microsystems, Inc. to assist in its use, correction,\n * modification or enhancement.\n * \n * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE\n * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC\n * OR ANY PART THEREOF.\n * \n * In no event will Sun Microsystems, Inc. be liable for any lost revenue\n * or profits or other special, indirect and consequential damages, even if\n * Sun has been advised of the possibility of such damages.\n * \n * Sun Microsystems, Inc.\n * 2550 Garcia Avenue\n * Mountain View, California  94043\n */\n\n/*\n * Kernel/lock manager protocol definition\n * Copyright (C) 1986 Sun Microsystems, Inc.\n *\n * protocol used between the UNIX kernel (the \"client\") and the\n * local lock manager.  The local lock manager is a deamon running\n * above the kernel.\n */\n\n#ifndef RPC_HDR\n%#ifndef lint\n%/*static char sccsid[] = \"from: @(#)klm_prot.x 1.7 87/07/08 Copyr 1987 Sun Micro\";*/\n%/*static char sccsid[] = \"from: @(#)klm_prot.x\t2.1 88/08/01 4.0 RPCSRC\";*/\n%#endif /* not lint */\n%#include <sys/cdefs.h>\n%__FBSDID(\"$FreeBSD: release/9.0.0/include/rpcsvc/klm_prot.x 114629 2003-05-04 02:51:42Z obrien $\");\n#endif\n\nconst\tLM_MAXSTRLEN = 1024;\n\n/*\n * lock manager status returns\n */\nenum klm_stats {\n\tklm_granted = 0,\t/* lock is granted */\n\tklm_denied = 1,\t\t/* lock is denied */\n\tklm_denied_nolocks = 2, /* no lock entry available */\n\tklm_working = 3 \t/* lock is being processed */\n};\n\n/*\n * lock manager lock identifier\n */\nstruct klm_lock {\n\tstring server_name<LM_MAXSTRLEN>;\n\tnetobj fh;\t\t/* a counted file handle */\n\tint pid;\t\t/* holder of the lock */\n\tunsigned l_offset;\t/* beginning offset of the lock */\n\tunsigned l_len;\t\t/* byte length of the lock;\n\t\t\t\t * zero means through end of file */\n};\n\n/*\n * lock holder identifier\n */\nstruct klm_holder {\n\tbool exclusive;\t\t/* FALSE if shared lock */\n\tint svid;\t\t/* holder of the lock (pid) */\n\tunsigned l_offset;\t/* beginning offset of the lock */\n\tunsigned l_len;\t\t/* byte length of the lock;\n\t\t\t\t * zero means through end of file */\n};\n\n/*\n * reply to KLM_LOCK / KLM_UNLOCK / KLM_CANCEL\n */\nstruct klm_stat {\n\tklm_stats stat;\n};\n\n/*\n * reply to a KLM_TEST call\n */\nunion klm_testrply switch (klm_stats stat) {\n\tcase klm_denied:\n\t\tstruct klm_holder holder;\n\tdefault: /* All other cases return no arguments */\n\t\tvoid;\n};\n\n\n/*\n * arguments to KLM_LOCK\n */\nstruct klm_lockargs {\n\tbool block;\n\tbool exclusive;\n\tstruct klm_lock alock;\n};\n\n/*\n * arguments to KLM_TEST\n */\nstruct klm_testargs {\n\tbool exclusive;\n\tstruct klm_lock alock;\n};\n\n/*\n * arguments to KLM_UNLOCK\n */\nstruct klm_unlockargs {\n\tstruct klm_lock alock;\n};\n\nprogram KLM_PROG {\n\tversion KLM_VERS {\n\n\t\tklm_testrply\tKLM_TEST (struct klm_testargs) =\t1;\n\n\t\tklm_stat\tKLM_LOCK (struct klm_lockargs) =\t2;\n\n\t\tklm_stat\tKLM_CANCEL (struct klm_lockargs) =\t3;\n\t\t/* klm_granted=> the cancel request fails due to lock is already granted */\n\t\t/* klm_denied=> the cancel request successfully aborts\nlock request  */\n\n\t\tklm_stat\tKLM_UNLOCK (struct klm_unlockargs) =\t4;\n\t} = 1;\n} = 100020;\n"
  },
  {
    "path": "freebsd-headers/rpcsvc/mount.h",
    "content": "/*\n * Please do not edit this file.\n * It was generated using rpcgen.\n */\n\n#ifndef _MOUNT_H_RPCGEN\n#define\t_MOUNT_H_RPCGEN\n\n#include <rpc/rpc.h>\n\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\n#define\tMNTPATHLEN 1024\n#define\tMNTNAMLEN 255\n#define\tFHSIZE 32\n#define\tFHSIZE3 64\n\ntypedef char fhandle[FHSIZE];\n\ntypedef struct {\n\tu_int fhandle3_len;\n\tchar *fhandle3_val;\n} fhandle3;\n\nstruct fhstatus {\n\tu_int fhs_status;\n\tunion {\n\t\tfhandle fhs_fhandle;\n\t} fhstatus_u;\n};\ntypedef struct fhstatus fhstatus;\n\nenum mountstat3 {\n\tMNT3_OK = 0,\n\tMNT3ERR_PERM = 1,\n\tMNT3ERR_NOENT = 2,\n\tMNT3ERR_IO = 5,\n\tMNT3ERR_ACCES = 13,\n\tMNT3ERR_NOTDIR = 20,\n\tMNT3ERR_INVAL = 22,\n\tMNT3ERR_NAMETOOLONG = 63,\n\tMNT3ERR_NOTSUPP = 10004,\n\tMNT3ERR_SERVERFAULT = 10006\n};\ntypedef enum mountstat3 mountstat3;\n\nstruct mountres3_ok {\n\tfhandle3 fhandle;\n\tstruct {\n\t\tu_int auth_flavors_len;\n\t\tint *auth_flavors_val;\n\t} auth_flavors;\n};\ntypedef struct mountres3_ok mountres3_ok;\n\nstruct mountres3 {\n\tmountstat3 fhs_status;\n\tunion {\n\t\tmountres3_ok mountinfo;\n\t} mountres3_u;\n};\ntypedef struct mountres3 mountres3;\n\ntypedef char *dirpath;\n\ntypedef char *name;\n\ntypedef struct mountbody *mountlist;\n\nstruct mountbody {\n\tname ml_hostname;\n\tdirpath ml_directory;\n\tmountlist ml_next;\n};\ntypedef struct mountbody mountbody;\n\ntypedef struct groupnode *groups;\n\nstruct groupnode {\n\tname gr_name;\n\tgroups gr_next;\n};\ntypedef struct groupnode groupnode;\n\ntypedef struct exportnode *exports;\n\nstruct exportnode {\n\tdirpath ex_dir;\n\tgroups ex_groups;\n\texports ex_next;\n};\ntypedef struct exportnode exportnode;\n\n#define\tMOUNTPROG ((unsigned long)(100005))\n#define\tMOUNTVERS ((unsigned long)(1))\n\nextern  void mountprog_1(struct svc_req *rqstp, SVCXPRT *transp);\n#define\tMOUNTPROC_NULL ((unsigned long)(0))\nextern  void * mountproc_null_1(void *, CLIENT *);\nextern  void * mountproc_null_1_svc(void *, struct svc_req *);\n#define\tMOUNTPROC_MNT ((unsigned long)(1))\nextern  fhstatus * mountproc_mnt_1(dirpath *, CLIENT *);\nextern  fhstatus * mountproc_mnt_1_svc(dirpath *, struct svc_req *);\n#define\tMOUNTPROC_DUMP ((unsigned long)(2))\nextern  mountlist * mountproc_dump_1(void *, CLIENT *);\nextern  mountlist * mountproc_dump_1_svc(void *, struct svc_req *);\n#define\tMOUNTPROC_UMNT ((unsigned long)(3))\nextern  void * mountproc_umnt_1(dirpath *, CLIENT *);\nextern  void * mountproc_umnt_1_svc(dirpath *, struct svc_req *);\n#define\tMOUNTPROC_UMNTALL ((unsigned long)(4))\nextern  void * mountproc_umntall_1(void *, CLIENT *);\nextern  void * mountproc_umntall_1_svc(void *, struct svc_req *);\n#define\tMOUNTPROC_EXPORT ((unsigned long)(5))\nextern  exports * mountproc_export_1(void *, CLIENT *);\nextern  exports * mountproc_export_1_svc(void *, struct svc_req *);\n#define\tMOUNTPROC_EXPORTALL ((unsigned long)(6))\nextern  exports * mountproc_exportall_1(void *, CLIENT *);\nextern  exports * mountproc_exportall_1_svc(void *, struct svc_req *);\nextern int mountprog_1_freeresult(SVCXPRT *, xdrproc_t, caddr_t);\n#define\tMOUNTVERS3 ((unsigned long)(3))\n\nextern  void mountprog_3(struct svc_req *rqstp, SVCXPRT *transp);\nextern  void * mountproc_null_3(void *, CLIENT *);\nextern  void * mountproc_null_3_svc(void *, struct svc_req *);\nextern  mountres3 * mountproc_mnt_3(dirpath *, CLIENT *);\nextern  mountres3 * mountproc_mnt_3_svc(dirpath *, struct svc_req *);\nextern  mountlist * mountproc_dump_3(void *, CLIENT *);\nextern  mountlist * mountproc_dump_3_svc(void *, struct svc_req *);\nextern  void * mountproc_umnt_3(dirpath *, CLIENT *);\nextern  void * mountproc_umnt_3_svc(dirpath *, struct svc_req *);\nextern  void * mountproc_umntall_3(void *, CLIENT *);\nextern  void * mountproc_umntall_3_svc(void *, struct svc_req *);\nextern  exports * mountproc_export_3(void *, CLIENT *);\nextern  exports * mountproc_export_3_svc(void *, struct svc_req *);\nextern int mountprog_3_freeresult(SVCXPRT *, xdrproc_t, caddr_t);\n\n/* the xdr functions */\nextern  bool_t xdr_fhandle(XDR *, fhandle);\nextern  bool_t xdr_fhandle3(XDR *, fhandle3*);\nextern  bool_t xdr_fhstatus(XDR *, fhstatus*);\nextern  bool_t xdr_mountstat3(XDR *, mountstat3*);\nextern  bool_t xdr_mountres3_ok(XDR *, mountres3_ok*);\nextern  bool_t xdr_mountres3(XDR *, mountres3*);\nextern  bool_t xdr_dirpath(XDR *, dirpath*);\nextern  bool_t xdr_name(XDR *, name*);\nextern  bool_t xdr_mountlist(XDR *, mountlist*);\nextern  bool_t xdr_mountbody(XDR *, mountbody*);\nextern  bool_t xdr_groups(XDR *, groups*);\nextern  bool_t xdr_groupnode(XDR *, groupnode*);\nextern  bool_t xdr_exports(XDR *, exports*);\nextern  bool_t xdr_exportnode(XDR *, exportnode*);\n\n#ifdef __cplusplus\n}\n#endif\n\n#endif /* !_MOUNT_H_RPCGEN */\n"
  },
  {
    "path": "freebsd-headers/rpcsvc/mount.x",
    "content": "/*\n * Sun RPC is a product of Sun Microsystems, Inc. and is provided for\n * unrestricted use provided that this legend is included on all tape\n * media and as a part of the software program in whole or part.  Users\n * may copy or modify Sun RPC without charge, but are not authorized\n * to license or distribute it to anyone else except as part of a product or\n * program developed by the user.\n * \n * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE\n * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR\n * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.\n * \n * Sun RPC is provided with no support and without any obligation on the\n * part of Sun Microsystems, Inc. to assist in its use, correction,\n * modification or enhancement.\n * \n * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE\n * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC\n * OR ANY PART THEREOF.\n * \n * In no event will Sun Microsystems, Inc. be liable for any lost revenue\n * or profits or other special, indirect and consequential damages, even if\n * Sun has been advised of the possibility of such damages.\n * \n * Sun Microsystems, Inc.\n * 2550 Garcia Avenue\n * Mountain View, California  94043\n */\n\n/*\n * Protocol description for the mount program\n */\n\n#ifndef RPC_HDR\n%#ifndef lint\n%/*static char sccsid[] = \"from: @(#)mount.x 1.2 87/09/18 Copyr 1987 Sun Micro\";*/\n%/*static char sccsid[] = \"from: @(#)mount.x\t2.1 88/08/01 4.0 RPCSRC\";*/\n%#endif /* not lint */\n%#include <sys/cdefs.h>\n%__FBSDID(\"$FreeBSD: release/9.0.0/include/rpcsvc/mount.x 114629 2003-05-04 02:51:42Z obrien $\");\n#endif\n\nconst MNTPATHLEN = 1024;\t/* maximum bytes in a pathname argument */\nconst MNTNAMLEN = 255;\t\t/* maximum bytes in a name argument */\nconst FHSIZE = 32;\t\t/* size in bytes of a file handle */\n#ifdef WANT_NFS3\nconst FHSIZE3 = 64;\t\t/* size in bytes of a file handle (v3) */\n#endif\n\n/*\n * The fhandle is the file handle that the server passes to the client.\n * All file operations are done using the file handles to refer to a file\n * or a directory. The file handle can contain whatever information the\n * server needs to distinguish an individual file.\n */\ntypedef opaque fhandle[FHSIZE];\t\n#ifdef WANT_NFS3\ntypedef opaque fhandle3<FHSIZE3>;\n#endif\n\n/*\n * If a status of zero is returned, the call completed successfully, and \n * a file handle for the directory follows. A non-zero status indicates\n * some sort of error. The status corresponds with UNIX error numbers.\n */\nunion fhstatus switch (unsigned fhs_status) {\ncase 0:\n\tfhandle fhs_fhandle;\ndefault:\n\tvoid;\n};\n\n#ifdef WANT_NFS3\n/*\n * Status codes returned by the version 3 mount call.\n */\nenum mountstat3 {\n\tMNT3_OK = 0,                 /* no error */\n\tMNT3ERR_PERM = 1,            /* Not owner */\n\tMNT3ERR_NOENT = 2,           /* No such file or directory */\n\tMNT3ERR_IO = 5,              /* I/O error */\n\tMNT3ERR_ACCES = 13,          /* Permission denied */\n\tMNT3ERR_NOTDIR = 20,         /* Not a directory */\n\tMNT3ERR_INVAL = 22,          /* Invalid argument */\n\tMNT3ERR_NAMETOOLONG = 63,    /* Filename too long */\n\tMNT3ERR_NOTSUPP = 10004,     /* Operation not supported */\n\tMNT3ERR_SERVERFAULT = 10006  /* A failure on the server */\n};\n\nstruct mountres3_ok {\n\tfhandle3\tfhandle;\n\tint\t\tauth_flavors<>;\n};\n\nunion mountres3 switch (mountstat3 fhs_status) {\ncase 0:\n\tmountres3_ok\tmountinfo;\ndefault:\n\tvoid;\n};\n#endif\n\n/*\n * The type dirpath is the pathname of a directory\n */\ntypedef string dirpath<MNTPATHLEN>;\n\n/*\n * The type name is used for arbitrary names (hostnames, groupnames)\n */\ntypedef string name<MNTNAMLEN>;\n\n/*\n * A list of who has what mounted\n */\ntypedef struct mountbody *mountlist;\nstruct mountbody {\n\tname ml_hostname;\n\tdirpath ml_directory;\n\tmountlist ml_next;\n};\n\n/*\n * A list of netgroups\n */\ntypedef struct groupnode *groups;\nstruct groupnode {\n\tname gr_name;\n\tgroups gr_next;\n};\n\n/*\n * A list of what is exported and to whom\n */\ntypedef struct exportnode *exports;\nstruct exportnode {\n\tdirpath ex_dir;\n\tgroups ex_groups;\n\texports ex_next;\n};\n\nprogram MOUNTPROG {\n\t/*\n\t * Version one of the mount protocol communicates with version two\n\t * of the NFS protocol. Version three communicates with\n\t * version three of the NFS protocol. The only connecting\n\t * point is the fhandle structure, which is the same for both\n\t * protocols.\n\t */\n\tversion MOUNTVERS {\n\t\t/*\n\t\t * Does no work. It is made available in all RPC services\n\t\t * to allow server reponse testing and timing\n\t\t */\n\t\tvoid\n\t\tMOUNTPROC_NULL(void) = 0;\n\n\t\t/*\t\n\t\t * If fhs_status is 0, then fhs_fhandle contains the\n\t \t * file handle for the directory. This file handle may\n\t\t * be used in the NFS protocol. This procedure also adds\n\t\t * a new entry to the mount list for this client mounting\n\t\t * the directory.\n\t\t * Unix authentication required.\n\t\t */\n\t\tfhstatus \n\t\tMOUNTPROC_MNT(dirpath) = 1;\n\n\t\t/*\n\t\t * Returns the list of remotely mounted filesystems. The \n\t\t * mountlist contains one entry for each hostname and \n\t\t * directory pair.\n\t\t */\n\t\tmountlist\n\t\tMOUNTPROC_DUMP(void) = 2;\n\n\t\t/*\n\t\t * Removes the mount list entry for the directory\n\t\t * Unix authentication required.\n\t\t */\n\t\tvoid\n\t\tMOUNTPROC_UMNT(dirpath) = 3;\n\n\t\t/*\n\t\t * Removes all of the mount list entries for this client\n\t\t * Unix authentication required.\n\t\t */\n\t\tvoid\n\t\tMOUNTPROC_UMNTALL(void) = 4;\n\n\t\t/*\n\t\t * Returns a list of all the exported filesystems, and which\n\t\t * machines are allowed to import it.\n\t\t */\n\t\texports\n\t\tMOUNTPROC_EXPORT(void)  = 5;\n\n\t\t/*\n\t\t * Identical to MOUNTPROC_EXPORT above\n\t\t */\n\t\texports\n\t\tMOUNTPROC_EXPORTALL(void) = 6;\n\t} = 1;\n#ifdef WANT_NFS3\n\tversion MOUNTVERS3 {\n\t\t/*\n\t\t * Does no work. It is made available in all RPC services\n\t\t * to allow server reponse testing and timing\n\t\t */\n\t\tvoid\n\t\tMOUNTPROC_NULL(void) = 0;\n\n\t\t/*\n\t\t * If mountres3.fhs_status is MNT3_OK, then\n\t\t * mountres3.mountinfo contains the file handle for\n\t\t * the directory and a list of acceptable\n\t\t * authentication flavors.  This file handle may only\n\t\t * be used in the NFS version 3 protocol.  This\n\t\t * procedure also results in the server adding a new\n\t\t * entry to its mount list recording that this client\n\t\t * has mounted the directory. AUTH_UNIX authentication\n\t\t * or better is required.\n\t\t */\n\t\tmountres3\n\t\tMOUNTPROC_MNT(dirpath) = 1;\n\n\t\t/*\n\t\t * Returns the list of remotely mounted filesystems. The \n\t\t * mountlist contains one entry for each hostname and \n\t\t * directory pair.\n\t\t */\n\t\tmountlist\n\t\tMOUNTPROC_DUMP(void) = 2;\n\n\t\t/*\n\t\t * Removes the mount list entry for the directory\n\t\t * Unix authentication required.\n\t\t */\n\t\tvoid\n\t\tMOUNTPROC_UMNT(dirpath) = 3;\n\n\t\t/*\n\t\t * Removes all of the mount list entries for this client\n\t\t * Unix authentication required.\n\t\t */\n\t\tvoid\n\t\tMOUNTPROC_UMNTALL(void) = 4;\n\n\t\t/*\n\t\t * Returns a list of all the exported filesystems, and which\n\t\t * machines are allowed to import it.\n\t\t */\n\t\texports\n\t\tMOUNTPROC_EXPORT(void)  = 5;\n\t} = 3;\n#endif\n} = 100005;\n"
  },
  {
    "path": "freebsd-headers/rpcsvc/nfs_prot.h",
    "content": "/*\n * Please do not edit this file.\n * It was generated using rpcgen.\n */\n\n#ifndef _NFS_PROT_H_RPCGEN\n#define\t_NFS_PROT_H_RPCGEN\n\n#include <rpc/rpc.h>\n\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\n#define\tNFS_PORT 2049\n#define\tNFS_MAXDATA 8192\n#define\tNFS_MAXPATHLEN 1024\n#define\tNFS_MAXNAMLEN 255\n#define\tNFS_FHSIZE 32\n#define\tNFS_COOKIESIZE 4\n#define\tNFS_FIFO_DEV -1\n#define\tNFSMODE_FMT 0170000\n#define\tNFSMODE_DIR 0040000\n#define\tNFSMODE_CHR 0020000\n#define\tNFSMODE_BLK 0060000\n#define\tNFSMODE_REG 0100000\n#define\tNFSMODE_LNK 0120000\n#define\tNFSMODE_SOCK 0140000\n#define\tNFSMODE_FIFO 0010000\n\nenum nfsstat {\n\tNFS_OK = 0,\n\tNFSERR_PERM = 1,\n\tNFSERR_NOENT = 2,\n\tNFSERR_IO = 5,\n\tNFSERR_NXIO = 6,\n\tNFSERR_ACCES = 13,\n\tNFSERR_EXIST = 17,\n\tNFSERR_NODEV = 19,\n\tNFSERR_NOTDIR = 20,\n\tNFSERR_ISDIR = 21,\n\tNFSERR_FBIG = 27,\n\tNFSERR_NOSPC = 28,\n\tNFSERR_ROFS = 30,\n\tNFSERR_NAMETOOLONG = 63,\n\tNFSERR_NOTEMPTY = 66,\n\tNFSERR_DQUOT = 69,\n\tNFSERR_STALE = 70,\n\tNFSERR_WFLUSH = 99\n};\ntypedef enum nfsstat nfsstat;\n\nenum ftype {\n\tNFNON = 0,\n\tNFREG = 1,\n\tNFDIR = 2,\n\tNFBLK = 3,\n\tNFCHR = 4,\n\tNFLNK = 5,\n\tNFSOCK = 6,\n\tNFBAD = 7,\n\tNFFIFO = 8\n};\ntypedef enum ftype ftype;\n\nstruct nfs_fh {\n\tchar data[NFS_FHSIZE];\n};\ntypedef struct nfs_fh nfs_fh;\n\nstruct nfstime {\n\tu_int seconds;\n\tu_int useconds;\n};\ntypedef struct nfstime nfstime;\n\nstruct fattr {\n\tftype type;\n\tu_int mode;\n\tu_int nlink;\n\tu_int uid;\n\tu_int gid;\n\tu_int size;\n\tu_int blocksize;\n\tu_int rdev;\n\tu_int blocks;\n\tu_int fsid;\n\tu_int fileid;\n\tnfstime atime;\n\tnfstime mtime;\n\tnfstime ctime;\n};\ntypedef struct fattr fattr;\n\nstruct sattr {\n\tu_int mode;\n\tu_int uid;\n\tu_int gid;\n\tu_int size;\n\tnfstime atime;\n\tnfstime mtime;\n};\ntypedef struct sattr sattr;\n\ntypedef char *filename;\n\ntypedef char *nfspath;\n\nstruct attrstat {\n\tnfsstat status;\n\tunion {\n\t\tfattr attributes;\n\t} attrstat_u;\n};\ntypedef struct attrstat attrstat;\n\nstruct sattrargs {\n\tnfs_fh file;\n\tsattr attributes;\n};\ntypedef struct sattrargs sattrargs;\n\nstruct diropargs {\n\tnfs_fh dir;\n\tfilename name;\n};\ntypedef struct diropargs diropargs;\n\nstruct diropokres {\n\tnfs_fh file;\n\tfattr attributes;\n};\ntypedef struct diropokres diropokres;\n\nstruct diropres {\n\tnfsstat status;\n\tunion {\n\t\tdiropokres diropres;\n\t} diropres_u;\n};\ntypedef struct diropres diropres;\n\nstruct readlinkres {\n\tnfsstat status;\n\tunion {\n\t\tnfspath data;\n\t} readlinkres_u;\n};\ntypedef struct readlinkres readlinkres;\n\nstruct readargs {\n\tnfs_fh file;\n\tu_int offset;\n\tu_int count;\n\tu_int totalcount;\n};\ntypedef struct readargs readargs;\n\nstruct readokres {\n\tfattr attributes;\n\tstruct {\n\t\tu_int data_len;\n\t\tchar *data_val;\n\t} data;\n};\ntypedef struct readokres readokres;\n\nstruct readres {\n\tnfsstat status;\n\tunion {\n\t\treadokres reply;\n\t} readres_u;\n};\ntypedef struct readres readres;\n\nstruct writeargs {\n\tnfs_fh file;\n\tu_int beginoffset;\n\tu_int offset;\n\tu_int totalcount;\n\tstruct {\n\t\tu_int data_len;\n\t\tchar *data_val;\n\t} data;\n};\ntypedef struct writeargs writeargs;\n\nstruct createargs {\n\tdiropargs where;\n\tsattr attributes;\n};\ntypedef struct createargs createargs;\n\nstruct renameargs {\n\tdiropargs from;\n\tdiropargs to;\n};\ntypedef struct renameargs renameargs;\n\nstruct linkargs {\n\tnfs_fh from;\n\tdiropargs to;\n};\ntypedef struct linkargs linkargs;\n\nstruct symlinkargs {\n\tdiropargs from;\n\tnfspath to;\n\tsattr attributes;\n};\ntypedef struct symlinkargs symlinkargs;\n\ntypedef char nfscookie[NFS_COOKIESIZE];\n\nstruct readdirargs {\n\tnfs_fh dir;\n\tnfscookie cookie;\n\tu_int count;\n};\ntypedef struct readdirargs readdirargs;\n\nstruct entry {\n\tu_int fileid;\n\tfilename name;\n\tnfscookie cookie;\n\tstruct entry *nextentry;\n};\ntypedef struct entry entry;\n\nstruct dirlist {\n\tentry *entries;\n\tbool_t eof;\n};\ntypedef struct dirlist dirlist;\n\nstruct readdirres {\n\tnfsstat status;\n\tunion {\n\t\tdirlist reply;\n\t} readdirres_u;\n};\ntypedef struct readdirres readdirres;\n\nstruct statfsokres {\n\tu_int tsize;\n\tu_int bsize;\n\tu_int blocks;\n\tu_int bfree;\n\tu_int bavail;\n};\ntypedef struct statfsokres statfsokres;\n\nstruct statfsres {\n\tnfsstat status;\n\tunion {\n\t\tstatfsokres reply;\n\t} statfsres_u;\n};\ntypedef struct statfsres statfsres;\n#define\tNFS3_FHSIZE 64\n#define\tNFS3_COOKIEVERFSIZE 8\n#define\tNFS3_CREATEVERFSIZE 8\n#define\tNFS3_WRITEVERFSIZE 8\n\ntypedef u_int64_t uint64;\n\ntypedef int64_t int64;\n\ntypedef u_long uint32;\n\ntypedef long int32;\n\ntypedef char *filename3;\n\ntypedef char *nfspath3;\n\ntypedef uint64 fileid3;\n\ntypedef uint64 cookie3;\n\ntypedef char cookieverf3[NFS3_COOKIEVERFSIZE];\n\ntypedef char createverf3[NFS3_CREATEVERFSIZE];\n\ntypedef char writeverf3[NFS3_WRITEVERFSIZE];\n\ntypedef uint32 uid3;\n\ntypedef uint32 gid3;\n\ntypedef uint64 size3;\n\ntypedef uint64 offset3;\n\ntypedef uint32 mode3;\n\ntypedef uint32 count3;\n\nenum nfsstat3 {\n\tNFS3_OK = 0,\n\tNFS3ERR_PERM = 1,\n\tNFS3ERR_NOENT = 2,\n\tNFS3ERR_IO = 5,\n\tNFS3ERR_NXIO = 6,\n\tNFS3ERR_ACCES = 13,\n\tNFS3ERR_EXIST = 17,\n\tNFS3ERR_XDEV = 18,\n\tNFS3ERR_NODEV = 19,\n\tNFS3ERR_NOTDIR = 20,\n\tNFS3ERR_ISDIR = 21,\n\tNFS3ERR_INVAL = 22,\n\tNFS3ERR_FBIG = 27,\n\tNFS3ERR_NOSPC = 28,\n\tNFS3ERR_ROFS = 30,\n\tNFS3ERR_MLINK = 31,\n\tNFS3ERR_NAMETOOLONG = 63,\n\tNFS3ERR_NOTEMPTY = 66,\n\tNFS3ERR_DQUOT = 69,\n\tNFS3ERR_STALE = 70,\n\tNFS3ERR_REMOTE = 71,\n\tNFS3ERR_BADHANDLE = 10001,\n\tNFS3ERR_NOT_SYNC = 10002,\n\tNFS3ERR_BAD_COOKIE = 10003,\n\tNFS3ERR_NOTSUPP = 10004,\n\tNFS3ERR_TOOSMALL = 10005,\n\tNFS3ERR_SERVERFAULT = 10006,\n\tNFS3ERR_BADTYPE = 10007,\n\tNFS3ERR_JUKEBOX = 10008\n};\ntypedef enum nfsstat3 nfsstat3;\n\nenum ftype3 {\n\tNF3REG = 1,\n\tNF3DIR = 2,\n\tNF3BLK = 3,\n\tNF3CHR = 4,\n\tNF3LNK = 5,\n\tNF3SOCK = 6,\n\tNF3FIFO = 7\n};\ntypedef enum ftype3 ftype3;\n\nstruct specdata3 {\n\tuint32 specdata1;\n\tuint32 specdata2;\n};\ntypedef struct specdata3 specdata3;\n\nstruct nfs_fh3 {\n\tstruct {\n\t\tu_int data_len;\n\t\tchar *data_val;\n\t} data;\n};\ntypedef struct nfs_fh3 nfs_fh3;\n\nstruct nfstime3 {\n\tuint32 seconds;\n\tuint32 nseconds;\n};\ntypedef struct nfstime3 nfstime3;\n\nstruct fattr3 {\n\tftype3 type;\n\tmode3 mode;\n\tuint32 nlink;\n\tuid3 uid;\n\tgid3 gid;\n\tsize3 size;\n\tsize3 used;\n\tspecdata3 rdev;\n\tuint64 fsid;\n\tfileid3 fileid;\n\tnfstime3 atime;\n\tnfstime3 mtime;\n\tnfstime3 ctime;\n};\ntypedef struct fattr3 fattr3;\n\nstruct post_op_attr {\n\tbool_t attributes_follow;\n\tunion {\n\t\tfattr3 attributes;\n\t} post_op_attr_u;\n};\ntypedef struct post_op_attr post_op_attr;\n\nstruct wcc_attr {\n\tsize3 size;\n\tnfstime3 mtime;\n\tnfstime3 ctime;\n};\ntypedef struct wcc_attr wcc_attr;\n\nstruct pre_op_attr {\n\tbool_t attributes_follow;\n\tunion {\n\t\twcc_attr attributes;\n\t} pre_op_attr_u;\n};\ntypedef struct pre_op_attr pre_op_attr;\n\nstruct wcc_data {\n\tpre_op_attr before;\n\tpost_op_attr after;\n};\ntypedef struct wcc_data wcc_data;\n\nstruct post_op_fh3 {\n\tbool_t handle_follows;\n\tunion {\n\t\tnfs_fh3 handle;\n\t} post_op_fh3_u;\n};\ntypedef struct post_op_fh3 post_op_fh3;\n\nenum time_how {\n\tDONT_CHANGE = 0,\n\tSET_TO_SERVER_TIME = 1,\n\tSET_TO_CLIENT_TIME = 2\n};\ntypedef enum time_how time_how;\n\nstruct set_mode3 {\n\tbool_t set_it;\n\tunion {\n\t\tmode3 mode;\n\t} set_mode3_u;\n};\ntypedef struct set_mode3 set_mode3;\n\nstruct set_uid3 {\n\tbool_t set_it;\n\tunion {\n\t\tuid3 uid;\n\t} set_uid3_u;\n};\ntypedef struct set_uid3 set_uid3;\n\nstruct set_gid3 {\n\tbool_t set_it;\n\tunion {\n\t\tgid3 gid;\n\t} set_gid3_u;\n};\ntypedef struct set_gid3 set_gid3;\n\nstruct set_size3 {\n\tbool_t set_it;\n\tunion {\n\t\tsize3 size;\n\t} set_size3_u;\n};\ntypedef struct set_size3 set_size3;\n\nstruct set_atime {\n\ttime_how set_it;\n\tunion {\n\t\tnfstime3 atime;\n\t} set_atime_u;\n};\ntypedef struct set_atime set_atime;\n\nstruct set_mtime {\n\ttime_how set_it;\n\tunion {\n\t\tnfstime3 mtime;\n\t} set_mtime_u;\n};\ntypedef struct set_mtime set_mtime;\n\nstruct sattr3 {\n\tset_mode3 mode;\n\tset_uid3 uid;\n\tset_gid3 gid;\n\tset_size3 size;\n\tset_atime atime;\n\tset_mtime mtime;\n};\ntypedef struct sattr3 sattr3;\n\nstruct diropargs3 {\n\tnfs_fh3 dir;\n\tfilename3 name;\n};\ntypedef struct diropargs3 diropargs3;\n\nstruct GETATTR3args {\n\tnfs_fh3 object;\n};\ntypedef struct GETATTR3args GETATTR3args;\n\nstruct GETATTR3resok {\n\tfattr3 obj_attributes;\n};\ntypedef struct GETATTR3resok GETATTR3resok;\n\nstruct GETATTR3res {\n\tnfsstat3 status;\n\tunion {\n\t\tGETATTR3resok resok;\n\t} GETATTR3res_u;\n};\ntypedef struct GETATTR3res GETATTR3res;\n\nstruct sattrguard3 {\n\tbool_t check;\n\tunion {\n\t\tnfstime3 obj_ctime;\n\t} sattrguard3_u;\n};\ntypedef struct sattrguard3 sattrguard3;\n\nstruct SETATTR3args {\n\tnfs_fh3 object;\n\tsattr3 new_attributes;\n\tsattrguard3 guard;\n};\ntypedef struct SETATTR3args SETATTR3args;\n\nstruct SETATTR3resok {\n\twcc_data obj_wcc;\n};\ntypedef struct SETATTR3resok SETATTR3resok;\n\nstruct SETATTR3resfail {\n\twcc_data obj_wcc;\n};\ntypedef struct SETATTR3resfail SETATTR3resfail;\n\nstruct SETATTR3res {\n\tnfsstat3 status;\n\tunion {\n\t\tSETATTR3resok resok;\n\t\tSETATTR3resfail resfail;\n\t} SETATTR3res_u;\n};\ntypedef struct SETATTR3res SETATTR3res;\n\nstruct LOOKUP3args {\n\tdiropargs3 what;\n};\ntypedef struct LOOKUP3args LOOKUP3args;\n\nstruct LOOKUP3resok {\n\tnfs_fh3 object;\n\tpost_op_attr obj_attributes;\n\tpost_op_attr dir_attributes;\n};\ntypedef struct LOOKUP3resok LOOKUP3resok;\n\nstruct LOOKUP3resfail {\n\tpost_op_attr dir_attributes;\n};\ntypedef struct LOOKUP3resfail LOOKUP3resfail;\n\nstruct LOOKUP3res {\n\tnfsstat3 status;\n\tunion {\n\t\tLOOKUP3resok resok;\n\t\tLOOKUP3resfail resfail;\n\t} LOOKUP3res_u;\n};\ntypedef struct LOOKUP3res LOOKUP3res;\n#define\tACCESS3_READ 0x0001\n#define\tACCESS3_LOOKUP 0x0002\n#define\tACCESS3_MODIFY 0x0004\n#define\tACCESS3_EXTEND 0x0008\n#define\tACCESS3_DELETE 0x0010\n#define\tACCESS3_EXECUTE 0x0020\n\nstruct ACCESS3args {\n\tnfs_fh3 object;\n\tuint32 access;\n};\ntypedef struct ACCESS3args ACCESS3args;\n\nstruct ACCESS3resok {\n\tpost_op_attr obj_attributes;\n\tuint32 access;\n};\ntypedef struct ACCESS3resok ACCESS3resok;\n\nstruct ACCESS3resfail {\n\tpost_op_attr obj_attributes;\n};\ntypedef struct ACCESS3resfail ACCESS3resfail;\n\nstruct ACCESS3res {\n\tnfsstat3 status;\n\tunion {\n\t\tACCESS3resok resok;\n\t\tACCESS3resfail resfail;\n\t} ACCESS3res_u;\n};\ntypedef struct ACCESS3res ACCESS3res;\n\nstruct READLINK3args {\n\tnfs_fh3 symlink;\n};\ntypedef struct READLINK3args READLINK3args;\n\nstruct READLINK3resok {\n\tpost_op_attr symlink_attributes;\n\tnfspath3 data;\n};\ntypedef struct READLINK3resok READLINK3resok;\n\nstruct READLINK3resfail {\n\tpost_op_attr symlink_attributes;\n};\ntypedef struct READLINK3resfail READLINK3resfail;\n\nstruct READLINK3res {\n\tnfsstat3 status;\n\tunion {\n\t\tREADLINK3resok resok;\n\t\tREADLINK3resfail resfail;\n\t} READLINK3res_u;\n};\ntypedef struct READLINK3res READLINK3res;\n\nstruct READ3args {\n\tnfs_fh3 file;\n\toffset3 offset;\n\tcount3 count;\n};\ntypedef struct READ3args READ3args;\n\nstruct READ3resok {\n\tpost_op_attr file_attributes;\n\tcount3 count;\n\tbool_t eof;\n\tstruct {\n\t\tu_int data_len;\n\t\tchar *data_val;\n\t} data;\n};\ntypedef struct READ3resok READ3resok;\n\nstruct READ3resfail {\n\tpost_op_attr file_attributes;\n};\ntypedef struct READ3resfail READ3resfail;\n\nstruct READ3res {\n\tnfsstat3 status;\n\tunion {\n\t\tREAD3resok resok;\n\t\tREAD3resfail resfail;\n\t} READ3res_u;\n};\ntypedef struct READ3res READ3res;\n\nenum stable_how {\n\tUNSTABLE = 0,\n\tDATA_SYNC = 1,\n\tFILE_SYNC = 2\n};\ntypedef enum stable_how stable_how;\n\nstruct WRITE3args {\n\tnfs_fh3 file;\n\toffset3 offset;\n\tcount3 count;\n\tstable_how stable;\n\tstruct {\n\t\tu_int data_len;\n\t\tchar *data_val;\n\t} data;\n};\ntypedef struct WRITE3args WRITE3args;\n\nstruct WRITE3resok {\n\twcc_data file_wcc;\n\tcount3 count;\n\tstable_how committed;\n\twriteverf3 verf;\n};\ntypedef struct WRITE3resok WRITE3resok;\n\nstruct WRITE3resfail {\n\twcc_data file_wcc;\n};\ntypedef struct WRITE3resfail WRITE3resfail;\n\nstruct WRITE3res {\n\tnfsstat3 status;\n\tunion {\n\t\tWRITE3resok resok;\n\t\tWRITE3resfail resfail;\n\t} WRITE3res_u;\n};\ntypedef struct WRITE3res WRITE3res;\n\nenum createmode3 {\n\tUNCHECKED = 0,\n\tGUARDED = 1,\n\tEXCLUSIVE = 2\n};\ntypedef enum createmode3 createmode3;\n\nstruct createhow3 {\n\tcreatemode3 mode;\n\tunion {\n\t\tsattr3 obj_attributes;\n\t\tcreateverf3 verf;\n\t} createhow3_u;\n};\ntypedef struct createhow3 createhow3;\n\nstruct CREATE3args {\n\tdiropargs3 where;\n\tcreatehow3 how;\n};\ntypedef struct CREATE3args CREATE3args;\n\nstruct CREATE3resok {\n\tpost_op_fh3 obj;\n\tpost_op_attr obj_attributes;\n\twcc_data dir_wcc;\n};\ntypedef struct CREATE3resok CREATE3resok;\n\nstruct CREATE3resfail {\n\twcc_data dir_wcc;\n};\ntypedef struct CREATE3resfail CREATE3resfail;\n\nstruct CREATE3res {\n\tnfsstat3 status;\n\tunion {\n\t\tCREATE3resok resok;\n\t\tCREATE3resfail resfail;\n\t} CREATE3res_u;\n};\ntypedef struct CREATE3res CREATE3res;\n\nstruct MKDIR3args {\n\tdiropargs3 where;\n\tsattr3 attributes;\n};\ntypedef struct MKDIR3args MKDIR3args;\n\nstruct MKDIR3resok {\n\tpost_op_fh3 obj;\n\tpost_op_attr obj_attributes;\n\twcc_data dir_wcc;\n};\ntypedef struct MKDIR3resok MKDIR3resok;\n\nstruct MKDIR3resfail {\n\twcc_data dir_wcc;\n};\ntypedef struct MKDIR3resfail MKDIR3resfail;\n\nstruct MKDIR3res {\n\tnfsstat3 status;\n\tunion {\n\t\tMKDIR3resok resok;\n\t\tMKDIR3resfail resfail;\n\t} MKDIR3res_u;\n};\ntypedef struct MKDIR3res MKDIR3res;\n\nstruct symlinkdata3 {\n\tsattr3 symlink_attributes;\n\tnfspath3 symlink_data;\n};\ntypedef struct symlinkdata3 symlinkdata3;\n\nstruct SYMLINK3args {\n\tdiropargs3 where;\n\tsymlinkdata3 symlink;\n};\ntypedef struct SYMLINK3args SYMLINK3args;\n\nstruct SYMLINK3resok {\n\tpost_op_fh3 obj;\n\tpost_op_attr obj_attributes;\n\twcc_data dir_wcc;\n};\ntypedef struct SYMLINK3resok SYMLINK3resok;\n\nstruct SYMLINK3resfail {\n\twcc_data dir_wcc;\n};\ntypedef struct SYMLINK3resfail SYMLINK3resfail;\n\nstruct SYMLINK3res {\n\tnfsstat3 status;\n\tunion {\n\t\tSYMLINK3resok resok;\n\t\tSYMLINK3resfail resfail;\n\t} SYMLINK3res_u;\n};\ntypedef struct SYMLINK3res SYMLINK3res;\n\nstruct devicedata3 {\n\tsattr3 dev_attributes;\n\tspecdata3 spec;\n};\ntypedef struct devicedata3 devicedata3;\n\nstruct mknoddata3 {\n\tftype3 type;\n\tunion {\n\t\tdevicedata3 device;\n\t\tsattr3 pipe_attributes;\n\t} mknoddata3_u;\n};\ntypedef struct mknoddata3 mknoddata3;\n\nstruct MKNOD3args {\n\tdiropargs3 where;\n\tmknoddata3 what;\n};\ntypedef struct MKNOD3args MKNOD3args;\n\nstruct MKNOD3resok {\n\tpost_op_fh3 obj;\n\tpost_op_attr obj_attributes;\n\twcc_data dir_wcc;\n};\ntypedef struct MKNOD3resok MKNOD3resok;\n\nstruct MKNOD3resfail {\n\twcc_data dir_wcc;\n};\ntypedef struct MKNOD3resfail MKNOD3resfail;\n\nstruct MKNOD3res {\n\tnfsstat3 status;\n\tunion {\n\t\tMKNOD3resok resok;\n\t\tMKNOD3resfail resfail;\n\t} MKNOD3res_u;\n};\ntypedef struct MKNOD3res MKNOD3res;\n\nstruct REMOVE3args {\n\tdiropargs3 object;\n};\ntypedef struct REMOVE3args REMOVE3args;\n\nstruct REMOVE3resok {\n\twcc_data dir_wcc;\n};\ntypedef struct REMOVE3resok REMOVE3resok;\n\nstruct REMOVE3resfail {\n\twcc_data dir_wcc;\n};\ntypedef struct REMOVE3resfail REMOVE3resfail;\n\nstruct REMOVE3res {\n\tnfsstat3 status;\n\tunion {\n\t\tREMOVE3resok resok;\n\t\tREMOVE3resfail resfail;\n\t} REMOVE3res_u;\n};\ntypedef struct REMOVE3res REMOVE3res;\n\nstruct RMDIR3args {\n\tdiropargs3 object;\n};\ntypedef struct RMDIR3args RMDIR3args;\n\nstruct RMDIR3resok {\n\twcc_data dir_wcc;\n};\ntypedef struct RMDIR3resok RMDIR3resok;\n\nstruct RMDIR3resfail {\n\twcc_data dir_wcc;\n};\ntypedef struct RMDIR3resfail RMDIR3resfail;\n\nstruct RMDIR3res {\n\tnfsstat3 status;\n\tunion {\n\t\tRMDIR3resok resok;\n\t\tRMDIR3resfail resfail;\n\t} RMDIR3res_u;\n};\ntypedef struct RMDIR3res RMDIR3res;\n\nstruct RENAME3args {\n\tdiropargs3 from;\n\tdiropargs3 to;\n};\ntypedef struct RENAME3args RENAME3args;\n\nstruct RENAME3resok {\n\twcc_data fromdir_wcc;\n\twcc_data todir_wcc;\n};\ntypedef struct RENAME3resok RENAME3resok;\n\nstruct RENAME3resfail {\n\twcc_data fromdir_wcc;\n\twcc_data todir_wcc;\n};\ntypedef struct RENAME3resfail RENAME3resfail;\n\nstruct RENAME3res {\n\tnfsstat3 status;\n\tunion {\n\t\tRENAME3resok resok;\n\t\tRENAME3resfail resfail;\n\t} RENAME3res_u;\n};\ntypedef struct RENAME3res RENAME3res;\n\nstruct LINK3args {\n\tnfs_fh3 file;\n\tdiropargs3 link;\n};\ntypedef struct LINK3args LINK3args;\n\nstruct LINK3resok {\n\tpost_op_attr file_attributes;\n\twcc_data linkdir_wcc;\n};\ntypedef struct LINK3resok LINK3resok;\n\nstruct LINK3resfail {\n\tpost_op_attr file_attributes;\n\twcc_data linkdir_wcc;\n};\ntypedef struct LINK3resfail LINK3resfail;\n\nstruct LINK3res {\n\tnfsstat3 status;\n\tunion {\n\t\tLINK3resok resok;\n\t\tLINK3resfail resfail;\n\t} LINK3res_u;\n};\ntypedef struct LINK3res LINK3res;\n\nstruct READDIR3args {\n\tnfs_fh3 dir;\n\tcookie3 cookie;\n\tcookieverf3 cookieverf;\n\tcount3 count;\n};\ntypedef struct READDIR3args READDIR3args;\n\nstruct entry3 {\n\tfileid3 fileid;\n\tfilename3 name;\n\tcookie3 cookie;\n\tstruct entry3 *nextentry;\n};\ntypedef struct entry3 entry3;\n\nstruct dirlist3 {\n\tentry3 *entries;\n\tbool_t eof;\n};\ntypedef struct dirlist3 dirlist3;\n\nstruct READDIR3resok {\n\tpost_op_attr dir_attributes;\n\tcookieverf3 cookieverf;\n\tdirlist3 reply;\n};\ntypedef struct READDIR3resok READDIR3resok;\n\nstruct READDIR3resfail {\n\tpost_op_attr dir_attributes;\n};\ntypedef struct READDIR3resfail READDIR3resfail;\n\nstruct READDIR3res {\n\tnfsstat3 status;\n\tunion {\n\t\tREADDIR3resok resok;\n\t\tREADDIR3resfail resfail;\n\t} READDIR3res_u;\n};\ntypedef struct READDIR3res READDIR3res;\n\nstruct READDIRPLUS3args {\n\tnfs_fh3 dir;\n\tcookie3 cookie;\n\tcookieverf3 cookieverf;\n\tcount3 dircount;\n\tcount3 maxcount;\n};\ntypedef struct READDIRPLUS3args READDIRPLUS3args;\n\nstruct entryplus3 {\n\tfileid3 fileid;\n\tfilename3 name;\n\tcookie3 cookie;\n\tpost_op_attr name_attributes;\n\tpost_op_fh3 name_handle;\n\tstruct entryplus3 *nextentry;\n};\ntypedef struct entryplus3 entryplus3;\n\nstruct dirlistplus3 {\n\tentryplus3 *entries;\n\tbool_t eof;\n};\ntypedef struct dirlistplus3 dirlistplus3;\n\nstruct READDIRPLUS3resok {\n\tpost_op_attr dir_attributes;\n\tcookieverf3 cookieverf;\n\tdirlistplus3 reply;\n};\ntypedef struct READDIRPLUS3resok READDIRPLUS3resok;\n\nstruct READDIRPLUS3resfail {\n\tpost_op_attr dir_attributes;\n};\ntypedef struct READDIRPLUS3resfail READDIRPLUS3resfail;\n\nstruct READDIRPLUS3res {\n\tnfsstat3 status;\n\tunion {\n\t\tREADDIRPLUS3resok resok;\n\t\tREADDIRPLUS3resfail resfail;\n\t} READDIRPLUS3res_u;\n};\ntypedef struct READDIRPLUS3res READDIRPLUS3res;\n\nstruct FSSTAT3args {\n\tnfs_fh3 fsroot;\n};\ntypedef struct FSSTAT3args FSSTAT3args;\n\nstruct FSSTAT3resok {\n\tpost_op_attr obj_attributes;\n\tsize3 tbytes;\n\tsize3 fbytes;\n\tsize3 abytes;\n\tsize3 tfiles;\n\tsize3 ffiles;\n\tsize3 afiles;\n\tuint32 invarsec;\n};\ntypedef struct FSSTAT3resok FSSTAT3resok;\n\nstruct FSSTAT3resfail {\n\tpost_op_attr obj_attributes;\n};\ntypedef struct FSSTAT3resfail FSSTAT3resfail;\n\nstruct FSSTAT3res {\n\tnfsstat3 status;\n\tunion {\n\t\tFSSTAT3resok resok;\n\t\tFSSTAT3resfail resfail;\n\t} FSSTAT3res_u;\n};\ntypedef struct FSSTAT3res FSSTAT3res;\n#define\tFSF3_LINK 0x0001\n#define\tFSF3_SYMLINK 0x0002\n#define\tFSF3_HOMOGENEOUS 0x0008\n#define\tFSF3_CANSETTIME 0x0010\n\nstruct FSINFO3args {\n\tnfs_fh3 fsroot;\n};\ntypedef struct FSINFO3args FSINFO3args;\n\nstruct FSINFO3resok {\n\tpost_op_attr obj_attributes;\n\tuint32 rtmax;\n\tuint32 rtpref;\n\tuint32 rtmult;\n\tuint32 wtmax;\n\tuint32 wtpref;\n\tuint32 wtmult;\n\tuint32 dtpref;\n\tsize3 maxfilesize;\n\tnfstime3 time_delta;\n\tuint32 properties;\n};\ntypedef struct FSINFO3resok FSINFO3resok;\n\nstruct FSINFO3resfail {\n\tpost_op_attr obj_attributes;\n};\ntypedef struct FSINFO3resfail FSINFO3resfail;\n\nstruct FSINFO3res {\n\tnfsstat3 status;\n\tunion {\n\t\tFSINFO3resok resok;\n\t\tFSINFO3resfail resfail;\n\t} FSINFO3res_u;\n};\ntypedef struct FSINFO3res FSINFO3res;\n\nstruct PATHCONF3args {\n\tnfs_fh3 object;\n};\ntypedef struct PATHCONF3args PATHCONF3args;\n\nstruct PATHCONF3resok {\n\tpost_op_attr obj_attributes;\n\tuint32 linkmax;\n\tuint32 name_max;\n\tbool_t no_trunc;\n\tbool_t chown_restricted;\n\tbool_t case_insensitive;\n\tbool_t case_preserving;\n};\ntypedef struct PATHCONF3resok PATHCONF3resok;\n\nstruct PATHCONF3resfail {\n\tpost_op_attr obj_attributes;\n};\ntypedef struct PATHCONF3resfail PATHCONF3resfail;\n\nstruct PATHCONF3res {\n\tnfsstat3 status;\n\tunion {\n\t\tPATHCONF3resok resok;\n\t\tPATHCONF3resfail resfail;\n\t} PATHCONF3res_u;\n};\ntypedef struct PATHCONF3res PATHCONF3res;\n\nstruct COMMIT3args {\n\tnfs_fh3 file;\n\toffset3 offset;\n\tcount3 count;\n};\ntypedef struct COMMIT3args COMMIT3args;\n\nstruct COMMIT3resok {\n\twcc_data file_wcc;\n\twriteverf3 verf;\n};\ntypedef struct COMMIT3resok COMMIT3resok;\n\nstruct COMMIT3resfail {\n\twcc_data file_wcc;\n};\ntypedef struct COMMIT3resfail COMMIT3resfail;\n\nstruct COMMIT3res {\n\tnfsstat3 status;\n\tunion {\n\t\tCOMMIT3resok resok;\n\t\tCOMMIT3resfail resfail;\n\t} COMMIT3res_u;\n};\ntypedef struct COMMIT3res COMMIT3res;\n\n#define\tNFS_PROGRAM ((unsigned long)(100003))\n#define\tNFS_VERSION ((unsigned long)(2))\n\nextern  void nfs_program_2(struct svc_req *rqstp, SVCXPRT *transp);\n#define\tNFSPROC_NULL ((unsigned long)(0))\nextern  void * nfsproc_null_2(void *, CLIENT *);\nextern  void * nfsproc_null_2_svc(void *, struct svc_req *);\n#define\tNFSPROC_GETATTR ((unsigned long)(1))\nextern  attrstat * nfsproc_getattr_2(nfs_fh *, CLIENT *);\nextern  attrstat * nfsproc_getattr_2_svc(nfs_fh *, struct svc_req *);\n#define\tNFSPROC_SETATTR ((unsigned long)(2))\nextern  attrstat * nfsproc_setattr_2(sattrargs *, CLIENT *);\nextern  attrstat * nfsproc_setattr_2_svc(sattrargs *, struct svc_req *);\n#define\tNFSPROC_ROOT ((unsigned long)(3))\nextern  void * nfsproc_root_2(void *, CLIENT *);\nextern  void * nfsproc_root_2_svc(void *, struct svc_req *);\n#define\tNFSPROC_LOOKUP ((unsigned long)(4))\nextern  diropres * nfsproc_lookup_2(diropargs *, CLIENT *);\nextern  diropres * nfsproc_lookup_2_svc(diropargs *, struct svc_req *);\n#define\tNFSPROC_READLINK ((unsigned long)(5))\nextern  readlinkres * nfsproc_readlink_2(nfs_fh *, CLIENT *);\nextern  readlinkres * nfsproc_readlink_2_svc(nfs_fh *, struct svc_req *);\n#define\tNFSPROC_READ ((unsigned long)(6))\nextern  readres * nfsproc_read_2(readargs *, CLIENT *);\nextern  readres * nfsproc_read_2_svc(readargs *, struct svc_req *);\n#define\tNFSPROC_WRITECACHE ((unsigned long)(7))\nextern  void * nfsproc_writecache_2(void *, CLIENT *);\nextern  void * nfsproc_writecache_2_svc(void *, struct svc_req *);\n#define\tNFSPROC_WRITE ((unsigned long)(8))\nextern  attrstat * nfsproc_write_2(writeargs *, CLIENT *);\nextern  attrstat * nfsproc_write_2_svc(writeargs *, struct svc_req *);\n#define\tNFSPROC_CREATE ((unsigned long)(9))\nextern  diropres * nfsproc_create_2(createargs *, CLIENT *);\nextern  diropres * nfsproc_create_2_svc(createargs *, struct svc_req *);\n#define\tNFSPROC_REMOVE ((unsigned long)(10))\nextern  nfsstat * nfsproc_remove_2(diropargs *, CLIENT *);\nextern  nfsstat * nfsproc_remove_2_svc(diropargs *, struct svc_req *);\n#define\tNFSPROC_RENAME ((unsigned long)(11))\nextern  nfsstat * nfsproc_rename_2(renameargs *, CLIENT *);\nextern  nfsstat * nfsproc_rename_2_svc(renameargs *, struct svc_req *);\n#define\tNFSPROC_LINK ((unsigned long)(12))\nextern  nfsstat * nfsproc_link_2(linkargs *, CLIENT *);\nextern  nfsstat * nfsproc_link_2_svc(linkargs *, struct svc_req *);\n#define\tNFSPROC_SYMLINK ((unsigned long)(13))\nextern  nfsstat * nfsproc_symlink_2(symlinkargs *, CLIENT *);\nextern  nfsstat * nfsproc_symlink_2_svc(symlinkargs *, struct svc_req *);\n#define\tNFSPROC_MKDIR ((unsigned long)(14))\nextern  diropres * nfsproc_mkdir_2(createargs *, CLIENT *);\nextern  diropres * nfsproc_mkdir_2_svc(createargs *, struct svc_req *);\n#define\tNFSPROC_RMDIR ((unsigned long)(15))\nextern  nfsstat * nfsproc_rmdir_2(diropargs *, CLIENT *);\nextern  nfsstat * nfsproc_rmdir_2_svc(diropargs *, struct svc_req *);\n#define\tNFSPROC_READDIR ((unsigned long)(16))\nextern  readdirres * nfsproc_readdir_2(readdirargs *, CLIENT *);\nextern  readdirres * nfsproc_readdir_2_svc(readdirargs *, struct svc_req *);\n#define\tNFSPROC_STATFS ((unsigned long)(17))\nextern  statfsres * nfsproc_statfs_2(nfs_fh *, CLIENT *);\nextern  statfsres * nfsproc_statfs_2_svc(nfs_fh *, struct svc_req *);\nextern int nfs_program_2_freeresult(SVCXPRT *, xdrproc_t, caddr_t);\n\n#define\tNFS3_PROGRAM ((unsigned long)(100003))\n#define\tNFS_V3 ((unsigned long)(3))\n\nextern  void nfs3_program_3(struct svc_req *rqstp, SVCXPRT *transp);\n#define\tNFSPROC3_NULL ((unsigned long)(0))\nextern  void * nfsproc3_null_3(void *, CLIENT *);\nextern  void * nfsproc3_null_3_svc(void *, struct svc_req *);\n#define\tNFSPROC3_GETATTR ((unsigned long)(1))\nextern  GETATTR3res * nfsproc3_getattr_3(GETATTR3args *, CLIENT *);\nextern  GETATTR3res * nfsproc3_getattr_3_svc(GETATTR3args *, struct svc_req *);\n#define\tNFSPROC3_SETATTR ((unsigned long)(2))\nextern  SETATTR3res * nfsproc3_setattr_3(SETATTR3args *, CLIENT *);\nextern  SETATTR3res * nfsproc3_setattr_3_svc(SETATTR3args *, struct svc_req *);\n#define\tNFSPROC3_LOOKUP ((unsigned long)(3))\nextern  LOOKUP3res * nfsproc3_lookup_3(LOOKUP3args *, CLIENT *);\nextern  LOOKUP3res * nfsproc3_lookup_3_svc(LOOKUP3args *, struct svc_req *);\n#define\tNFSPROC3_ACCESS ((unsigned long)(4))\nextern  ACCESS3res * nfsproc3_access_3(ACCESS3args *, CLIENT *);\nextern  ACCESS3res * nfsproc3_access_3_svc(ACCESS3args *, struct svc_req *);\n#define\tNFSPROC3_READLINK ((unsigned long)(5))\nextern  READLINK3res * nfsproc3_readlink_3(READLINK3args *, CLIENT *);\nextern  READLINK3res * nfsproc3_readlink_3_svc(READLINK3args *, struct svc_req *);\n#define\tNFSPROC3_READ ((unsigned long)(6))\nextern  READ3res * nfsproc3_read_3(READ3args *, CLIENT *);\nextern  READ3res * nfsproc3_read_3_svc(READ3args *, struct svc_req *);\n#define\tNFSPROC3_WRITE ((unsigned long)(7))\nextern  WRITE3res * nfsproc3_write_3(WRITE3args *, CLIENT *);\nextern  WRITE3res * nfsproc3_write_3_svc(WRITE3args *, struct svc_req *);\n#define\tNFSPROC3_CREATE ((unsigned long)(8))\nextern  CREATE3res * nfsproc3_create_3(CREATE3args *, CLIENT *);\nextern  CREATE3res * nfsproc3_create_3_svc(CREATE3args *, struct svc_req *);\n#define\tNFSPROC3_MKDIR ((unsigned long)(9))\nextern  MKDIR3res * nfsproc3_mkdir_3(MKDIR3args *, CLIENT *);\nextern  MKDIR3res * nfsproc3_mkdir_3_svc(MKDIR3args *, struct svc_req *);\n#define\tNFSPROC3_SYMLINK ((unsigned long)(10))\nextern  SYMLINK3res * nfsproc3_symlink_3(SYMLINK3args *, CLIENT *);\nextern  SYMLINK3res * nfsproc3_symlink_3_svc(SYMLINK3args *, struct svc_req *);\n#define\tNFSPROC3_MKNOD ((unsigned long)(11))\nextern  MKNOD3res * nfsproc3_mknod_3(MKNOD3args *, CLIENT *);\nextern  MKNOD3res * nfsproc3_mknod_3_svc(MKNOD3args *, struct svc_req *);\n#define\tNFSPROC3_REMOVE ((unsigned long)(12))\nextern  REMOVE3res * nfsproc3_remove_3(REMOVE3args *, CLIENT *);\nextern  REMOVE3res * nfsproc3_remove_3_svc(REMOVE3args *, struct svc_req *);\n#define\tNFSPROC3_RMDIR ((unsigned long)(13))\nextern  RMDIR3res * nfsproc3_rmdir_3(RMDIR3args *, CLIENT *);\nextern  RMDIR3res * nfsproc3_rmdir_3_svc(RMDIR3args *, struct svc_req *);\n#define\tNFSPROC3_RENAME ((unsigned long)(14))\nextern  RENAME3res * nfsproc3_rename_3(RENAME3args *, CLIENT *);\nextern  RENAME3res * nfsproc3_rename_3_svc(RENAME3args *, struct svc_req *);\n#define\tNFSPROC3_LINK ((unsigned long)(15))\nextern  LINK3res * nfsproc3_link_3(LINK3args *, CLIENT *);\nextern  LINK3res * nfsproc3_link_3_svc(LINK3args *, struct svc_req *);\n#define\tNFSPROC3_READDIR ((unsigned long)(16))\nextern  READDIR3res * nfsproc3_readdir_3(READDIR3args *, CLIENT *);\nextern  READDIR3res * nfsproc3_readdir_3_svc(READDIR3args *, struct svc_req *);\n#define\tNFSPROC3_READDIRPLUS ((unsigned long)(17))\nextern  READDIRPLUS3res * nfsproc3_readdirplus_3(READDIRPLUS3args *, CLIENT *);\nextern  READDIRPLUS3res * nfsproc3_readdirplus_3_svc(READDIRPLUS3args *, struct svc_req *);\n#define\tNFSPROC3_FSSTAT ((unsigned long)(18))\nextern  FSSTAT3res * nfsproc3_fsstat_3(FSSTAT3args *, CLIENT *);\nextern  FSSTAT3res * nfsproc3_fsstat_3_svc(FSSTAT3args *, struct svc_req *);\n#define\tNFSPROC3_FSINFO ((unsigned long)(19))\nextern  FSINFO3res * nfsproc3_fsinfo_3(FSINFO3args *, CLIENT *);\nextern  FSINFO3res * nfsproc3_fsinfo_3_svc(FSINFO3args *, struct svc_req *);\n#define\tNFSPROC3_PATHCONF ((unsigned long)(20))\nextern  PATHCONF3res * nfsproc3_pathconf_3(PATHCONF3args *, CLIENT *);\nextern  PATHCONF3res * nfsproc3_pathconf_3_svc(PATHCONF3args *, struct svc_req *);\n#define\tNFSPROC3_COMMIT ((unsigned long)(21))\nextern  COMMIT3res * nfsproc3_commit_3(COMMIT3args *, CLIENT *);\nextern  COMMIT3res * nfsproc3_commit_3_svc(COMMIT3args *, struct svc_req *);\nextern int nfs3_program_3_freeresult(SVCXPRT *, xdrproc_t, caddr_t);\n\n/* the xdr functions */\nextern  bool_t xdr_nfsstat(XDR *, nfsstat*);\nextern  bool_t xdr_ftype(XDR *, ftype*);\nextern  bool_t xdr_nfs_fh(XDR *, nfs_fh*);\nextern  bool_t xdr_nfstime(XDR *, nfstime*);\nextern  bool_t xdr_fattr(XDR *, fattr*);\nextern  bool_t xdr_sattr(XDR *, sattr*);\nextern  bool_t xdr_filename(XDR *, filename*);\nextern  bool_t xdr_nfspath(XDR *, nfspath*);\nextern  bool_t xdr_attrstat(XDR *, attrstat*);\nextern  bool_t xdr_sattrargs(XDR *, sattrargs*);\nextern  bool_t xdr_diropargs(XDR *, diropargs*);\nextern  bool_t xdr_diropokres(XDR *, diropokres*);\nextern  bool_t xdr_diropres(XDR *, diropres*);\nextern  bool_t xdr_readlinkres(XDR *, readlinkres*);\nextern  bool_t xdr_readargs(XDR *, readargs*);\nextern  bool_t xdr_readokres(XDR *, readokres*);\nextern  bool_t xdr_readres(XDR *, readres*);\nextern  bool_t xdr_writeargs(XDR *, writeargs*);\nextern  bool_t xdr_createargs(XDR *, createargs*);\nextern  bool_t xdr_renameargs(XDR *, renameargs*);\nextern  bool_t xdr_linkargs(XDR *, linkargs*);\nextern  bool_t xdr_symlinkargs(XDR *, symlinkargs*);\nextern  bool_t xdr_nfscookie(XDR *, nfscookie);\nextern  bool_t xdr_readdirargs(XDR *, readdirargs*);\nextern  bool_t xdr_entry(XDR *, entry*);\nextern  bool_t xdr_dirlist(XDR *, dirlist*);\nextern  bool_t xdr_readdirres(XDR *, readdirres*);\nextern  bool_t xdr_statfsokres(XDR *, statfsokres*);\nextern  bool_t xdr_statfsres(XDR *, statfsres*);\nextern  bool_t xdr_uint64(XDR *, uint64*);\nextern  bool_t xdr_int64(XDR *, int64*);\nextern  bool_t xdr_uint32(XDR *, uint32*);\nextern  bool_t xdr_int32(XDR *, int32*);\nextern  bool_t xdr_filename3(XDR *, filename3*);\nextern  bool_t xdr_nfspath3(XDR *, nfspath3*);\nextern  bool_t xdr_fileid3(XDR *, fileid3*);\nextern  bool_t xdr_cookie3(XDR *, cookie3*);\nextern  bool_t xdr_cookieverf3(XDR *, cookieverf3);\nextern  bool_t xdr_createverf3(XDR *, createverf3);\nextern  bool_t xdr_writeverf3(XDR *, writeverf3);\nextern  bool_t xdr_uid3(XDR *, uid3*);\nextern  bool_t xdr_gid3(XDR *, gid3*);\nextern  bool_t xdr_size3(XDR *, size3*);\nextern  bool_t xdr_offset3(XDR *, offset3*);\nextern  bool_t xdr_mode3(XDR *, mode3*);\nextern  bool_t xdr_count3(XDR *, count3*);\nextern  bool_t xdr_nfsstat3(XDR *, nfsstat3*);\nextern  bool_t xdr_ftype3(XDR *, ftype3*);\nextern  bool_t xdr_specdata3(XDR *, specdata3*);\nextern  bool_t xdr_nfs_fh3(XDR *, nfs_fh3*);\nextern  bool_t xdr_nfstime3(XDR *, nfstime3*);\nextern  bool_t xdr_fattr3(XDR *, fattr3*);\nextern  bool_t xdr_post_op_attr(XDR *, post_op_attr*);\nextern  bool_t xdr_wcc_attr(XDR *, wcc_attr*);\nextern  bool_t xdr_pre_op_attr(XDR *, pre_op_attr*);\nextern  bool_t xdr_wcc_data(XDR *, wcc_data*);\nextern  bool_t xdr_post_op_fh3(XDR *, post_op_fh3*);\nextern  bool_t xdr_time_how(XDR *, time_how*);\nextern  bool_t xdr_set_mode3(XDR *, set_mode3*);\nextern  bool_t xdr_set_uid3(XDR *, set_uid3*);\nextern  bool_t xdr_set_gid3(XDR *, set_gid3*);\nextern  bool_t xdr_set_size3(XDR *, set_size3*);\nextern  bool_t xdr_set_atime(XDR *, set_atime*);\nextern  bool_t xdr_set_mtime(XDR *, set_mtime*);\nextern  bool_t xdr_sattr3(XDR *, sattr3*);\nextern  bool_t xdr_diropargs3(XDR *, diropargs3*);\nextern  bool_t xdr_GETATTR3args(XDR *, GETATTR3args*);\nextern  bool_t xdr_GETATTR3resok(XDR *, GETATTR3resok*);\nextern  bool_t xdr_GETATTR3res(XDR *, GETATTR3res*);\nextern  bool_t xdr_sattrguard3(XDR *, sattrguard3*);\nextern  bool_t xdr_SETATTR3args(XDR *, SETATTR3args*);\nextern  bool_t xdr_SETATTR3resok(XDR *, SETATTR3resok*);\nextern  bool_t xdr_SETATTR3resfail(XDR *, SETATTR3resfail*);\nextern  bool_t xdr_SETATTR3res(XDR *, SETATTR3res*);\nextern  bool_t xdr_LOOKUP3args(XDR *, LOOKUP3args*);\nextern  bool_t xdr_LOOKUP3resok(XDR *, LOOKUP3resok*);\nextern  bool_t xdr_LOOKUP3resfail(XDR *, LOOKUP3resfail*);\nextern  bool_t xdr_LOOKUP3res(XDR *, LOOKUP3res*);\nextern  bool_t xdr_ACCESS3args(XDR *, ACCESS3args*);\nextern  bool_t xdr_ACCESS3resok(XDR *, ACCESS3resok*);\nextern  bool_t xdr_ACCESS3resfail(XDR *, ACCESS3resfail*);\nextern  bool_t xdr_ACCESS3res(XDR *, ACCESS3res*);\nextern  bool_t xdr_READLINK3args(XDR *, READLINK3args*);\nextern  bool_t xdr_READLINK3resok(XDR *, READLINK3resok*);\nextern  bool_t xdr_READLINK3resfail(XDR *, READLINK3resfail*);\nextern  bool_t xdr_READLINK3res(XDR *, READLINK3res*);\nextern  bool_t xdr_READ3args(XDR *, READ3args*);\nextern  bool_t xdr_READ3resok(XDR *, READ3resok*);\nextern  bool_t xdr_READ3resfail(XDR *, READ3resfail*);\nextern  bool_t xdr_READ3res(XDR *, READ3res*);\nextern  bool_t xdr_stable_how(XDR *, stable_how*);\nextern  bool_t xdr_WRITE3args(XDR *, WRITE3args*);\nextern  bool_t xdr_WRITE3resok(XDR *, WRITE3resok*);\nextern  bool_t xdr_WRITE3resfail(XDR *, WRITE3resfail*);\nextern  bool_t xdr_WRITE3res(XDR *, WRITE3res*);\nextern  bool_t xdr_createmode3(XDR *, createmode3*);\nextern  bool_t xdr_createhow3(XDR *, createhow3*);\nextern  bool_t xdr_CREATE3args(XDR *, CREATE3args*);\nextern  bool_t xdr_CREATE3resok(XDR *, CREATE3resok*);\nextern  bool_t xdr_CREATE3resfail(XDR *, CREATE3resfail*);\nextern  bool_t xdr_CREATE3res(XDR *, CREATE3res*);\nextern  bool_t xdr_MKDIR3args(XDR *, MKDIR3args*);\nextern  bool_t xdr_MKDIR3resok(XDR *, MKDIR3resok*);\nextern  bool_t xdr_MKDIR3resfail(XDR *, MKDIR3resfail*);\nextern  bool_t xdr_MKDIR3res(XDR *, MKDIR3res*);\nextern  bool_t xdr_symlinkdata3(XDR *, symlinkdata3*);\nextern  bool_t xdr_SYMLINK3args(XDR *, SYMLINK3args*);\nextern  bool_t xdr_SYMLINK3resok(XDR *, SYMLINK3resok*);\nextern  bool_t xdr_SYMLINK3resfail(XDR *, SYMLINK3resfail*);\nextern  bool_t xdr_SYMLINK3res(XDR *, SYMLINK3res*);\nextern  bool_t xdr_devicedata3(XDR *, devicedata3*);\nextern  bool_t xdr_mknoddata3(XDR *, mknoddata3*);\nextern  bool_t xdr_MKNOD3args(XDR *, MKNOD3args*);\nextern  bool_t xdr_MKNOD3resok(XDR *, MKNOD3resok*);\nextern  bool_t xdr_MKNOD3resfail(XDR *, MKNOD3resfail*);\nextern  bool_t xdr_MKNOD3res(XDR *, MKNOD3res*);\nextern  bool_t xdr_REMOVE3args(XDR *, REMOVE3args*);\nextern  bool_t xdr_REMOVE3resok(XDR *, REMOVE3resok*);\nextern  bool_t xdr_REMOVE3resfail(XDR *, REMOVE3resfail*);\nextern  bool_t xdr_REMOVE3res(XDR *, REMOVE3res*);\nextern  bool_t xdr_RMDIR3args(XDR *, RMDIR3args*);\nextern  bool_t xdr_RMDIR3resok(XDR *, RMDIR3resok*);\nextern  bool_t xdr_RMDIR3resfail(XDR *, RMDIR3resfail*);\nextern  bool_t xdr_RMDIR3res(XDR *, RMDIR3res*);\nextern  bool_t xdr_RENAME3args(XDR *, RENAME3args*);\nextern  bool_t xdr_RENAME3resok(XDR *, RENAME3resok*);\nextern  bool_t xdr_RENAME3resfail(XDR *, RENAME3resfail*);\nextern  bool_t xdr_RENAME3res(XDR *, RENAME3res*);\nextern  bool_t xdr_LINK3args(XDR *, LINK3args*);\nextern  bool_t xdr_LINK3resok(XDR *, LINK3resok*);\nextern  bool_t xdr_LINK3resfail(XDR *, LINK3resfail*);\nextern  bool_t xdr_LINK3res(XDR *, LINK3res*);\nextern  bool_t xdr_READDIR3args(XDR *, READDIR3args*);\nextern  bool_t xdr_entry3(XDR *, entry3*);\nextern  bool_t xdr_dirlist3(XDR *, dirlist3*);\nextern  bool_t xdr_READDIR3resok(XDR *, READDIR3resok*);\nextern  bool_t xdr_READDIR3resfail(XDR *, READDIR3resfail*);\nextern  bool_t xdr_READDIR3res(XDR *, READDIR3res*);\nextern  bool_t xdr_READDIRPLUS3args(XDR *, READDIRPLUS3args*);\nextern  bool_t xdr_entryplus3(XDR *, entryplus3*);\nextern  bool_t xdr_dirlistplus3(XDR *, dirlistplus3*);\nextern  bool_t xdr_READDIRPLUS3resok(XDR *, READDIRPLUS3resok*);\nextern  bool_t xdr_READDIRPLUS3resfail(XDR *, READDIRPLUS3resfail*);\nextern  bool_t xdr_READDIRPLUS3res(XDR *, READDIRPLUS3res*);\nextern  bool_t xdr_FSSTAT3args(XDR *, FSSTAT3args*);\nextern  bool_t xdr_FSSTAT3resok(XDR *, FSSTAT3resok*);\nextern  bool_t xdr_FSSTAT3resfail(XDR *, FSSTAT3resfail*);\nextern  bool_t xdr_FSSTAT3res(XDR *, FSSTAT3res*);\nextern  bool_t xdr_FSINFO3args(XDR *, FSINFO3args*);\nextern  bool_t xdr_FSINFO3resok(XDR *, FSINFO3resok*);\nextern  bool_t xdr_FSINFO3resfail(XDR *, FSINFO3resfail*);\nextern  bool_t xdr_FSINFO3res(XDR *, FSINFO3res*);\nextern  bool_t xdr_PATHCONF3args(XDR *, PATHCONF3args*);\nextern  bool_t xdr_PATHCONF3resok(XDR *, PATHCONF3resok*);\nextern  bool_t xdr_PATHCONF3resfail(XDR *, PATHCONF3resfail*);\nextern  bool_t xdr_PATHCONF3res(XDR *, PATHCONF3res*);\nextern  bool_t xdr_COMMIT3args(XDR *, COMMIT3args*);\nextern  bool_t xdr_COMMIT3resok(XDR *, COMMIT3resok*);\nextern  bool_t xdr_COMMIT3resfail(XDR *, COMMIT3resfail*);\nextern  bool_t xdr_COMMIT3res(XDR *, COMMIT3res*);\n\n#ifdef __cplusplus\n}\n#endif\n\n#endif /* !_NFS_PROT_H_RPCGEN */\n"
  },
  {
    "path": "freebsd-headers/rpcsvc/nfs_prot.x",
    "content": "/*\n * Sun RPC is a product of Sun Microsystems, Inc. and is provided for\n * unrestricted use provided that this legend is included on all tape\n * media and as a part of the software program in whole or part.  Users\n * may copy or modify Sun RPC without charge, but are not authorized\n * to license or distribute it to anyone else except as part of a product or\n * program developed by the user.\n * \n * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE\n * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR\n * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.\n * \n * Sun RPC is provided with no support and without any obligation on the\n * part of Sun Microsystems, Inc. to assist in its use, correction,\n * modification or enhancement.\n * \n * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE\n * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC\n * OR ANY PART THEREOF.\n * \n * In no event will Sun Microsystems, Inc. be liable for any lost revenue\n * or profits or other special, indirect and consequential damages, even if\n * Sun has been advised of the possibility of such damages.\n * \n * Sun Microsystems, Inc.\n * 2550 Garcia Avenue\n * Mountain View, California  94043\n */\n\n#ifndef RPC_HDR\n%#ifndef lint\n%/*static char sccsid[] = \"from: @(#)nfs_prot.x 1.2 87/10/12 Copyr 1987 Sun Micro\";*/\n%/*static char sccsid[] = \"from: @(#)nfs_prot.x\t2.1 88/08/01 4.0 RPCSRC\";*/\n%#endif /* not lint */\n%#include <sys/cdefs.h>\n%__FBSDID(\"$FreeBSD: release/9.0.0/include/rpcsvc/nfs_prot.x 114629 2003-05-04 02:51:42Z obrien $\");\n#endif\n\nconst NFS_PORT          = 2049;\nconst NFS_MAXDATA       = 8192;\nconst NFS_MAXPATHLEN    = 1024;\nconst NFS_MAXNAMLEN\t= 255;\nconst NFS_FHSIZE\t= 32;\nconst NFS_COOKIESIZE\t= 4;\nconst NFS_FIFO_DEV\t= -1;\t/* size kludge for named pipes */\n\n/*\n * File types\n */\nconst NFSMODE_FMT  = 0170000;\t/* type of file */\nconst NFSMODE_DIR  = 0040000;\t/* directory */\nconst NFSMODE_CHR  = 0020000;\t/* character special */\nconst NFSMODE_BLK  = 0060000;\t/* block special */\nconst NFSMODE_REG  = 0100000;\t/* regular */\nconst NFSMODE_LNK  = 0120000;\t/* symbolic link */\nconst NFSMODE_SOCK = 0140000;\t/* socket */\nconst NFSMODE_FIFO = 0010000;\t/* fifo */\n\n/*\n * Error status\n */\nenum nfsstat {\n\tNFS_OK= 0,\t\t/* no error */\n\tNFSERR_PERM=1,\t\t/* Not owner */\n\tNFSERR_NOENT=2,\t\t/* No such file or directory */\n\tNFSERR_IO=5,\t\t/* I/O error */\n\tNFSERR_NXIO=6,\t\t/* No such device or address */\n\tNFSERR_ACCES=13,\t/* Permission denied */\n\tNFSERR_EXIST=17,\t/* File exists */\n\tNFSERR_NODEV=19,\t/* No such device */\n\tNFSERR_NOTDIR=20,\t/* Not a directory*/\n\tNFSERR_ISDIR=21,\t/* Is a directory */\n\tNFSERR_FBIG=27,\t\t/* File too large */\n\tNFSERR_NOSPC=28,\t/* No space left on device */\n\tNFSERR_ROFS=30,\t\t/* Read-only file system */\n\tNFSERR_NAMETOOLONG=63,\t/* File name too long */\n\tNFSERR_NOTEMPTY=66,\t/* Directory not empty */\n\tNFSERR_DQUOT=69,\t/* Disc quota exceeded */\n\tNFSERR_STALE=70,\t/* Stale NFS file handle */\n\tNFSERR_WFLUSH=99\t/* write cache flushed */\n};\n\n/*\n * File types\n */\nenum ftype {\n\tNFNON = 0,\t/* non-file */\n\tNFREG = 1,\t/* regular file */\n\tNFDIR = 2,\t/* directory */\n\tNFBLK = 3,\t/* block special */\n\tNFCHR = 4,\t/* character special */\n\tNFLNK = 5,\t/* symbolic link */\n\tNFSOCK = 6,\t/* unix domain sockets */\n\tNFBAD = 7,\t/* unused */\n\tNFFIFO = 8 \t/* named pipe */\n};\n\n/*\n * File access handle\n */\nstruct nfs_fh {\n\topaque data[NFS_FHSIZE];\n};\n\n/* \n * Timeval\n */\nstruct nfstime {\n\tunsigned seconds;\n\tunsigned useconds;\n};\n\n\n/*\n * File attributes\n */\nstruct fattr {\n\tftype type;\t\t/* file type */\n\tunsigned mode;\t\t/* protection mode bits */\n\tunsigned nlink;\t\t/* # hard links */\n\tunsigned uid;\t\t/* owner user id */\n\tunsigned gid;\t\t/* owner group id */\n\tunsigned size;\t\t/* file size in bytes */\n\tunsigned blocksize;\t/* prefered block size */\n\tunsigned rdev;\t\t/* special device # */\n\tunsigned blocks;\t/* Kb of disk used by file */\n\tunsigned fsid;\t\t/* device # */\n\tunsigned fileid;\t/* inode # */\n\tnfstime\tatime;\t\t/* time of last access */\n\tnfstime\tmtime;\t\t/* time of last modification */\n\tnfstime\tctime;\t\t/* time of last change */\n};\n\n/*\n * File attributes which can be set\n */\nstruct sattr {\n\tunsigned mode;\t/* protection mode bits */\n\tunsigned uid;\t/* owner user id */\n\tunsigned gid;\t/* owner group id */\n\tunsigned size;\t/* file size in bytes */\n\tnfstime\tatime;\t/* time of last access */\n\tnfstime\tmtime;\t/* time of last modification */\n};\n\n\ntypedef string filename<NFS_MAXNAMLEN>; \ntypedef string nfspath<NFS_MAXPATHLEN>;\n\n/*\n * Reply status with file attributes\n */\nunion attrstat switch (nfsstat status) {\ncase NFS_OK:\n\tfattr attributes;\ndefault:\n\tvoid;\n};\n\nstruct sattrargs {\n\tnfs_fh file;\n\tsattr attributes;\n};\n\n/*\n * Arguments for directory operations\n */\nstruct diropargs {\n\tnfs_fh\tdir;\t/* directory file handle */\n\tfilename name;\t\t/* name (up to NFS_MAXNAMLEN bytes) */\n};\n\nstruct diropokres {\n\tnfs_fh file;\n\tfattr attributes;\n};\n\n/*\n * Results from directory operation\n */\nunion diropres switch (nfsstat status) {\ncase NFS_OK:\n\tdiropokres diropres;\ndefault:\n\tvoid;\n};\n\nunion readlinkres switch (nfsstat status) {\ncase NFS_OK:\n\tnfspath data;\ndefault:\n\tvoid;\n};\n\n/*\n * Arguments to remote read\n */\nstruct readargs {\n\tnfs_fh file;\t\t/* handle for file */\n\tunsigned offset;\t/* byte offset in file */\n\tunsigned count;\t\t/* immediate read count */\n\tunsigned totalcount;\t/* total read count (from this offset)*/\n};\n\n/*\n * Status OK portion of remote read reply\n */\nstruct readokres {\n\tfattr\tattributes;\t/* attributes, need for pagin*/\n\topaque data<NFS_MAXDATA>;\n};\n\nunion readres switch (nfsstat status) {\ncase NFS_OK:\n\treadokres reply;\ndefault:\n\tvoid;\n};\n\n/*\n * Arguments to remote write \n */\nstruct writeargs {\n\tnfs_fh\tfile;\t\t/* handle for file */\n\tunsigned beginoffset;\t/* beginning byte offset in file */\n\tunsigned offset;\t/* current byte offset in file */\n\tunsigned totalcount;\t/* total write count (to this offset)*/\n\topaque data<NFS_MAXDATA>;\n};\n\nstruct createargs {\n\tdiropargs where;\n\tsattr attributes;\n};\n\nstruct renameargs {\n\tdiropargs from;\n\tdiropargs to;\n};\n\nstruct linkargs {\n\tnfs_fh from;\n\tdiropargs to;\n};\n\nstruct symlinkargs {\n\tdiropargs from;\n\tnfspath to;\n\tsattr attributes;\n};\n\n\ntypedef opaque nfscookie[NFS_COOKIESIZE];\n\n/*\n * Arguments to readdir\n */\nstruct readdirargs {\n\tnfs_fh dir;\t\t/* directory handle */\n\tnfscookie cookie;\n\tunsigned count;\t\t/* number of directory bytes to read */\n};\n\nstruct entry {\n\tunsigned fileid;\n\tfilename name;\n\tnfscookie cookie;\n\tentry *nextentry;\n};\n\nstruct dirlist {\n\tentry *entries;\n\tbool eof;\n};\n\nunion readdirres switch (nfsstat status) {\ncase NFS_OK:\n\tdirlist reply;\ndefault:\n\tvoid;\n};\n\nstruct statfsokres {\n\tunsigned tsize;\t/* preferred transfer size in bytes */\n\tunsigned bsize;\t/* fundamental file system block size */\n\tunsigned blocks;\t/* total blocks in file system */\n\tunsigned bfree;\t/* free blocks in fs */\n\tunsigned bavail;\t/* free blocks avail to non-superuser */\n};\n\nunion statfsres switch (nfsstat status) {\ncase NFS_OK:\n\tstatfsokres reply;\ndefault:\n\tvoid;\n};\n\n#ifdef WANT_NFS3\n\n/*\n * NFSv3 constants and types\n */\nconst NFS3_FHSIZE\t= 64;\t/* maximum size in bytes of a file handle */\nconst NFS3_COOKIEVERFSIZE = 8;\t/* size of a cookie verifier for READDIR */\nconst NFS3_CREATEVERFSIZE = 8;\t/* size of the verifier used for CREATE */\nconst NFS3_WRITEVERFSIZE = 8;\t/* size of the verifier used for WRITE */\n\ntypedef unsigned hyper uint64;\ntypedef hyper int64;\ntypedef unsigned long uint32;\ntypedef long int32;\ntypedef string filename3<>;\ntypedef string nfspath3<>;\ntypedef uint64 fileid3;\ntypedef uint64 cookie3;\ntypedef opaque cookieverf3[NFS3_COOKIEVERFSIZE];\ntypedef opaque createverf3[NFS3_CREATEVERFSIZE];\ntypedef opaque writeverf3[NFS3_WRITEVERFSIZE];\ntypedef uint32 uid3;\ntypedef uint32 gid3;\ntypedef uint64 size3;\ntypedef uint64 offset3;\ntypedef uint32 mode3;\ntypedef uint32 count3;\n\n/*\n * Error status (v3)\n */\nenum nfsstat3 {\n\tNFS3_OK\t= 0,\n\tNFS3ERR_PERM\t\t= 1,\n\tNFS3ERR_NOENT\t\t= 2,\n\tNFS3ERR_IO\t\t= 5,\n\tNFS3ERR_NXIO\t\t= 6,\n\tNFS3ERR_ACCES\t\t= 13,\n\tNFS3ERR_EXIST\t\t= 17,\n\tNFS3ERR_XDEV\t\t= 18,\n\tNFS3ERR_NODEV\t\t= 19,\n\tNFS3ERR_NOTDIR\t\t= 20,\n\tNFS3ERR_ISDIR\t\t= 21,\n\tNFS3ERR_INVAL\t\t= 22,\n\tNFS3ERR_FBIG\t\t= 27,\n\tNFS3ERR_NOSPC\t\t= 28,\n\tNFS3ERR_ROFS\t\t= 30,\n\tNFS3ERR_MLINK\t\t= 31,\n\tNFS3ERR_NAMETOOLONG\t= 63,\n\tNFS3ERR_NOTEMPTY\t= 66,\n\tNFS3ERR_DQUOT\t\t= 69,\n\tNFS3ERR_STALE\t\t= 70,\n\tNFS3ERR_REMOTE\t\t= 71,\n\tNFS3ERR_BADHANDLE\t= 10001,\n\tNFS3ERR_NOT_SYNC\t= 10002,\n\tNFS3ERR_BAD_COOKIE\t= 10003,\n\tNFS3ERR_NOTSUPP\t\t= 10004,\n\tNFS3ERR_TOOSMALL\t= 10005,\n\tNFS3ERR_SERVERFAULT\t= 10006,\n\tNFS3ERR_BADTYPE\t\t= 10007,\n\tNFS3ERR_JUKEBOX\t\t= 10008\n};\n\n/*\n * File types (v3)\n */\nenum ftype3 {\n\tNF3REG\t= 1,\t\t/* regular file */\n\tNF3DIR\t= 2,\t\t/* directory */\n\tNF3BLK\t= 3,\t\t/* block special */\n\tNF3CHR\t= 4,\t\t/* character special */\n\tNF3LNK\t= 5,\t\t/* symbolic link */\n\tNF3SOCK\t= 6,\t\t/* unix domain sockets */\n\tNF3FIFO\t= 7\t\t/* named pipe */\n};\n\nstruct specdata3 {\n\tuint32\tspecdata1;\n\tuint32\tspecdata2;\n};\n\n/*\n * File access handle (v3)\n */\nstruct nfs_fh3 {\n\topaque data<NFS3_FHSIZE>;\n};\n\n/* \n * Timeval (v3)\n */\nstruct nfstime3 {\n\tuint32\tseconds;\n\tuint32\tnseconds;\n};\n\n\n/*\n * File attributes (v3)\n */\nstruct fattr3 {\n\tftype3\ttype;\t\t/* file type */\n\tmode3\tmode;\t\t/* protection mode bits */\n\tuint32\tnlink;\t\t/* # hard links */\n\tuid3\tuid;\t\t/* owner user id */\n\tgid3\tgid;\t\t/* owner group id */\n\tsize3\tsize;\t\t/* file size in bytes */\n\tsize3\tused;\t\t/* prefered block size */\n\tspecdata3 rdev;\t\t/* special device # */\n\tuint64 fsid;\t\t/* device # */\n\tfileid3\tfileid;\t\t/* inode # */\n\tnfstime3 atime;\t\t/* time of last access */\n\tnfstime3 mtime;\t\t/* time of last modification */\n\tnfstime3 ctime;\t\t/* time of last change */\n};\n\nunion post_op_attr switch (bool attributes_follow) {\ncase TRUE:\n\tfattr3\tattributes;\ncase FALSE:\n\tvoid;\n};\n\nstruct wcc_attr {\n\tsize3\tsize;\n\tnfstime3 mtime;\n\tnfstime3 ctime;\n};\n\nunion pre_op_attr switch (bool attributes_follow) {\ncase TRUE:\n\twcc_attr attributes;\ncase FALSE:\n\tvoid;\n};\n\nstruct wcc_data {\n\tpre_op_attr before;\n\tpost_op_attr after;\n};\n\nunion post_op_fh3 switch (bool handle_follows) {\ncase TRUE:\n\tnfs_fh3\thandle;\ncase FALSE:\n\tvoid;\n};\n\n/*\n * File attributes which can be set (v3)\n */\nenum time_how {\n\tDONT_CHANGE\t\t= 0,\n\tSET_TO_SERVER_TIME\t= 1,\n\tSET_TO_CLIENT_TIME\t= 2\n};\n\nunion set_mode3 switch (bool set_it) {\ncase TRUE:\n\tmode3\tmode;\ndefault:\n\tvoid;\n};\n\nunion set_uid3 switch (bool set_it) {\ncase TRUE:\n\tuid3\tuid;\ndefault:\n\tvoid;\n};\n\nunion set_gid3 switch (bool set_it) {\ncase TRUE:\n\tgid3\tgid;\ndefault:\n\tvoid;\n};\n\nunion set_size3 switch (bool set_it) {\ncase TRUE:\n\tsize3\tsize;\ndefault:\n\tvoid;\n};\n\nunion set_atime switch (time_how set_it) {\ncase SET_TO_CLIENT_TIME:\n\tnfstime3\tatime;\ndefault:\n\tvoid;\n};\n\nunion set_mtime switch (time_how set_it) {\ncase SET_TO_CLIENT_TIME:\n\tnfstime3\tmtime;\ndefault:\n\tvoid;\n};\n\nstruct sattr3 {\n\tset_mode3\tmode;\n\tset_uid3\tuid;\n\tset_gid3\tgid;\n\tset_size3\tsize;\n\tset_atime\tatime;\n\tset_mtime\tmtime;\n};\n\n/*\n * Arguments for directory operations (v3)\n */\nstruct diropargs3 {\n\tnfs_fh3\tdir;\t\t/* directory file handle */\n\tfilename3 name;\t\t/* name (up to NFS_MAXNAMLEN bytes) */\n};\n\n/*\n * Arguments to getattr (v3).\n */\nstruct GETATTR3args {\n\tnfs_fh3\t\tobject;\n};\n\nstruct GETATTR3resok {\n\tfattr3\t\tobj_attributes;\n};\n\nunion GETATTR3res switch (nfsstat3 status) {\ncase NFS3_OK:\n\tGETATTR3resok\tresok;\ndefault:\n\tvoid;\n};\n\n/*\n * Arguments to setattr (v3).\n */\nunion sattrguard3 switch (bool check) {\ncase TRUE:\n\tnfstime3\tobj_ctime;\ncase FALSE:\n\tvoid;\n};\n\nstruct SETATTR3args {\n\tnfs_fh3\t\tobject;\n\tsattr3\t\tnew_attributes;\n\tsattrguard3\tguard;\n};\n\nstruct SETATTR3resok {\n\twcc_data\tobj_wcc;\n};\n\nstruct SETATTR3resfail {\n\twcc_data\tobj_wcc;\n};\n\nunion SETATTR3res switch (nfsstat3 status) {\ncase NFS3_OK:\n\tSETATTR3resok\tresok;\ndefault:\n\tSETATTR3resfail\tresfail;\n};\n\n/*\n * Arguments to lookup (v3).\n */\nstruct LOOKUP3args {\n\tdiropargs3\twhat;\n};\n\nstruct LOOKUP3resok {\n\tnfs_fh3\t\tobject;\n\tpost_op_attr\tobj_attributes;\n\tpost_op_attr\tdir_attributes;\n};\n\nstruct LOOKUP3resfail {\n\tpost_op_attr\tdir_attributes;\n};\n\nunion LOOKUP3res switch (nfsstat3 status) {\ncase NFS3_OK:\n\tLOOKUP3resok\tresok;\ndefault:\n\tLOOKUP3resfail\tresfail;\n};\n\n/*\n * Arguments to access (v3).\n */\nconst ACCESS3_READ\t= 0x0001;\nconst ACCESS3_LOOKUP\t= 0x0002;\nconst ACCESS3_MODIFY\t= 0x0004;\nconst ACCESS3_EXTEND\t= 0x0008;\nconst ACCESS3_DELETE\t= 0x0010;\nconst ACCESS3_EXECUTE\t= 0x0020;\n\nstruct ACCESS3args {\n\tnfs_fh3\t\tobject;\n\tuint32\t\taccess;\n};\n\nstruct ACCESS3resok {\n\tpost_op_attr\tobj_attributes;\n\tuint32\t\taccess;\n};\n\nstruct ACCESS3resfail {\n\tpost_op_attr\tobj_attributes;\n};\n\nunion ACCESS3res switch (nfsstat3 status) {\ncase NFS3_OK:\n\tACCESS3resok\tresok;\ndefault:\n\tACCESS3resfail\tresfail;\n};\n\n/*\n * Arguments to readlink (v3).\n */\nstruct READLINK3args {\n\tnfs_fh3\t\tsymlink;\n};\n\nstruct READLINK3resok {\n\tpost_op_attr\tsymlink_attributes;\n\tnfspath3\tdata;\n};\n\nstruct READLINK3resfail {\n\tpost_op_attr\tsymlink_attributes;\n};\n\nunion READLINK3res switch (nfsstat3 status) {\ncase NFS3_OK:\n\tREADLINK3resok\tresok;\ndefault:\n\tREADLINK3resfail resfail;\n};\n\n/*\n * Arguments to read (v3).\n */\nstruct READ3args {\n\tnfs_fh3\t\tfile;\n\toffset3\t\toffset;\n\tcount3\t\tcount;\n};\n\nstruct READ3resok {\n\tpost_op_attr\tfile_attributes;\n\tcount3\t\tcount;\n\tbool\t\teof;\n\topaque\t\tdata<>;\n};\n\nstruct READ3resfail {\n\tpost_op_attr\tfile_attributes;\n};\n\n/* XXX: solaris 2.6 uses ``nfsstat'' here */\nunion READ3res switch (nfsstat3 status) {\ncase NFS3_OK:\n\tREAD3resok\tresok;\ndefault:\n\tREAD3resfail\tresfail;\n};\n\n/*\n * Arguments to write (v3).\n */\nenum stable_how {\n\tUNSTABLE\t= 0,\n\tDATA_SYNC\t= 1,\n\tFILE_SYNC\t= 2\n};\n\nstruct WRITE3args {\n\tnfs_fh3\t\tfile;\n\toffset3\t\toffset;\n\tcount3\t\tcount;\n\tstable_how\tstable;\n\topaque\t\tdata<>;\n};\n\nstruct WRITE3resok {\n\twcc_data\tfile_wcc;\n\tcount3\t\tcount;\n\tstable_how\tcommitted;\n\twriteverf3\tverf;\n};\n\nstruct WRITE3resfail {\n\twcc_data\tfile_wcc;\n};\n\nunion WRITE3res switch (nfsstat3 status) {\ncase NFS3_OK:\n\tWRITE3resok\tresok;\ndefault:\n\tWRITE3resfail\tresfail;\n};\n\n/*\n * Arguments to create (v3).\n */\nenum createmode3 {\n\tUNCHECKED\t= 0,\n\tGUARDED\t\t= 1,\n\tEXCLUSIVE\t= 2\n};\n\nunion createhow3 switch (createmode3 mode) {\ncase UNCHECKED:\ncase GUARDED:\n\tsattr3\t\tobj_attributes;\ncase EXCLUSIVE:\n\tcreateverf3\tverf;\n};\n\nstruct CREATE3args {\n\tdiropargs3\twhere;\n\tcreatehow3\thow;\n};\n\nstruct CREATE3resok {\n\tpost_op_fh3\tobj;\n\tpost_op_attr\tobj_attributes;\n\twcc_data\tdir_wcc;\n};\n\nstruct CREATE3resfail {\n\twcc_data\tdir_wcc;\n};\n\nunion CREATE3res switch (nfsstat3 status) {\ncase NFS3_OK:\n\tCREATE3resok\tresok;\ndefault:\n\tCREATE3resfail\tresfail;\n};\n\n/*\n * Arguments to mkdir (v3).\n */\nstruct MKDIR3args {\n\tdiropargs3\twhere;\n\tsattr3\t\tattributes;\n};\n\nstruct MKDIR3resok {\n\tpost_op_fh3\tobj;\n\tpost_op_attr\tobj_attributes;\n\twcc_data\tdir_wcc;\n};\n\nstruct MKDIR3resfail {\n\twcc_data\tdir_wcc;\n};\n\nunion MKDIR3res switch (nfsstat3 status) {\ncase NFS3_OK:\n\tMKDIR3resok\tresok;\ndefault:\n\tMKDIR3resfail\tresfail;\n};\n\n/*\n * Arguments to symlink (v3).\n */\nstruct symlinkdata3 {\n\tsattr3\t\tsymlink_attributes;\n\tnfspath3\tsymlink_data;\n};\n\nstruct SYMLINK3args {\n\tdiropargs3\twhere;\n\tsymlinkdata3\tsymlink;\n};\n\nstruct SYMLINK3resok {\n\tpost_op_fh3\tobj;\n\tpost_op_attr\tobj_attributes;\n\twcc_data\tdir_wcc;\n};\n\nstruct SYMLINK3resfail {\n\twcc_data\tdir_wcc;\n};\n\nunion SYMLINK3res switch (nfsstat3 status) {\ncase NFS3_OK:\n\tSYMLINK3resok\tresok;\ndefault:\n\tSYMLINK3resfail\tresfail;\n};\n\n/*\n * Arguments to mknod (v3).\n */\nstruct devicedata3 {\n\tsattr3\t\tdev_attributes;\n\tspecdata3\tspec;\n};\n\nunion mknoddata3 switch (ftype3 type) {\ncase NF3CHR:\ncase NF3BLK:\n\tdevicedata3\tdevice;\ncase NF3SOCK:\ncase NF3FIFO:\n\tsattr3\t\tpipe_attributes;\ndefault:\n\tvoid;\n};\n\nstruct MKNOD3args {\n\tdiropargs3\twhere;\n\tmknoddata3\twhat;\n};\n\nstruct MKNOD3resok {\n\tpost_op_fh3\tobj;\n\tpost_op_attr\tobj_attributes;\n\twcc_data\tdir_wcc;\n};\n\nstruct MKNOD3resfail {\n\twcc_data\tdir_wcc;\n};\n\nunion MKNOD3res switch (nfsstat3 status) {\ncase NFS3_OK:\n\tMKNOD3resok\tresok;\ndefault:\n\tMKNOD3resfail\tresfail;\n};\n\n/*\n * Arguments to remove (v3).\n */\nstruct REMOVE3args {\n\tdiropargs3\tobject;\n};\n\nstruct REMOVE3resok {\n\twcc_data\tdir_wcc;\n};\n\nstruct REMOVE3resfail {\n\twcc_data\tdir_wcc;\n};\n\nunion REMOVE3res switch (nfsstat3 status) {\ncase NFS3_OK:\n\tREMOVE3resok\tresok;\ndefault:\n\tREMOVE3resfail\tresfail;\n};\n\n/*\n * Arguments to rmdir (v3).\n */\nstruct RMDIR3args {\n\tdiropargs3\tobject;\n};\n\nstruct RMDIR3resok {\n\twcc_data\tdir_wcc;\n};\n\nstruct RMDIR3resfail {\n\twcc_data\tdir_wcc;\n};\n\nunion RMDIR3res switch (nfsstat3 status) {\ncase NFS3_OK:\n\tRMDIR3resok\tresok;\ndefault:\n\tRMDIR3resfail\tresfail;\n};\n\n/*\n * Arguments to rename (v3).\n */\nstruct RENAME3args {\n\tdiropargs3\tfrom;\n\tdiropargs3\tto;\n};\n\nstruct RENAME3resok {\n\twcc_data\tfromdir_wcc;\n\twcc_data\ttodir_wcc;\n};\n\nstruct RENAME3resfail {\n\twcc_data\tfromdir_wcc;\n\twcc_data\ttodir_wcc;\n};\n\nunion RENAME3res switch (nfsstat3 status) {\ncase NFS3_OK:\n\tRENAME3resok\tresok;\ndefault:\n\tRENAME3resfail\tresfail;\n};\n\n/*\n * Arguments to link (v3).\n */\nstruct LINK3args {\n\tnfs_fh3\t\tfile;\n\tdiropargs3\tlink;\n};\n\nstruct LINK3resok {\n\tpost_op_attr\tfile_attributes;\n\twcc_data\tlinkdir_wcc;\n};\n\nstruct LINK3resfail {\n\tpost_op_attr\tfile_attributes;\n\twcc_data\tlinkdir_wcc;\n};\n\nunion LINK3res switch (nfsstat3 status) {\ncase NFS3_OK:\n\tLINK3resok\tresok;\ndefault:\n\tLINK3resfail\tresfail;\n};\n\n/*\n * Arguments to readdir (v3).\n */\nstruct READDIR3args {\n\tnfs_fh3\t\tdir;\n\tcookie3\t\tcookie;\n\tcookieverf3\tcookieverf;\n\tcount3\t\tcount;\n};\n\nstruct entry3 {\n\tfileid3\t\tfileid;\n\tfilename3\tname;\n\tcookie3\t\tcookie;\n\tentry3\t\t*nextentry;\n};\n\nstruct dirlist3 {\n\tentry3\t\t*entries;\n\tbool\t\teof;\n};\n\nstruct READDIR3resok {\n\tpost_op_attr\tdir_attributes;\n\tcookieverf3\tcookieverf;\n\tdirlist3\treply;\n};\n\nstruct READDIR3resfail {\n\tpost_op_attr\tdir_attributes;\n};\n\nunion READDIR3res switch (nfsstat3 status) {\ncase NFS3_OK:\n\tREADDIR3resok\tresok;\ndefault:\n\tREADDIR3resfail\tresfail;\n};\n\n/*\n * Arguments to readdirplus (v3).\n */\nstruct READDIRPLUS3args {\n\tnfs_fh3\t\tdir;\n\tcookie3\t\tcookie;\n\tcookieverf3\tcookieverf;\n\tcount3\t\tdircount;\n\tcount3\t\tmaxcount;\n};\n\nstruct entryplus3 {\n\tfileid3\t\tfileid;\n\tfilename3\tname;\n\tcookie3\t\tcookie;\n\tpost_op_attr\tname_attributes;\n\tpost_op_fh3\tname_handle;\n\tentryplus3\t*nextentry;\n};\n\nstruct dirlistplus3 {\n\tentryplus3\t*entries;\n\tbool\t\teof;\n};\n\nstruct READDIRPLUS3resok {\n\tpost_op_attr\tdir_attributes;\n\tcookieverf3\tcookieverf;\n\tdirlistplus3\treply;\n};\n\nstruct READDIRPLUS3resfail {\n\tpost_op_attr\tdir_attributes;\n};\n\nunion READDIRPLUS3res switch (nfsstat3 status) {\ncase NFS3_OK:\n\tREADDIRPLUS3resok\tresok;\ndefault:\n\tREADDIRPLUS3resfail\tresfail;\n};\n\n/*\n * Arguments to fsstat (v3).\n */\nstruct FSSTAT3args {\n\tnfs_fh3\t\tfsroot;\n};\n\nstruct FSSTAT3resok {\n\tpost_op_attr\tobj_attributes;\n\tsize3\t\ttbytes;\n\tsize3\t\tfbytes;\n\tsize3\t\tabytes;\n\tsize3\t\ttfiles;\n\tsize3\t\tffiles;\n\tsize3\t\tafiles;\n\tuint32\t\tinvarsec;\n};\n\nstruct FSSTAT3resfail {\n\tpost_op_attr\tobj_attributes;\n};\n\nunion FSSTAT3res switch (nfsstat3 status) {\ncase NFS3_OK:\n\tFSSTAT3resok\tresok;\ndefault:\n\tFSSTAT3resfail\tresfail;\n};\n\n/*\n * Arguments to fsinfo (v3).\n */\nconst FSF3_LINK\t\t= 0x0001;\nconst FSF3_SYMLINK\t= 0x0002;\nconst FSF3_HOMOGENEOUS\t= 0x0008;\nconst FSF3_CANSETTIME\t= 0x0010;\n\nstruct FSINFO3args {\n\tnfs_fh3\t\tfsroot;\n};\n\nstruct FSINFO3resok {\n\tpost_op_attr\tobj_attributes;\n\tuint32\t\trtmax;\n\tuint32\t\trtpref;\n\tuint32\t\trtmult;\n\tuint32\t\twtmax;\n\tuint32\t\twtpref;\n\tuint32\t\twtmult;\n\tuint32\t\tdtpref;\n\tsize3\t\tmaxfilesize;\n\tnfstime3\ttime_delta;\n\tuint32\t\tproperties;\n};\n\nstruct FSINFO3resfail {\n\tpost_op_attr\tobj_attributes;\n};\n\nunion FSINFO3res switch (nfsstat3 status) {\ncase NFS3_OK:\n\tFSINFO3resok\tresok;\ndefault:\n\tFSINFO3resfail\tresfail;\n};\n\n/*\n * Arguments to pathconf (v3).\n */\nstruct PATHCONF3args {\n\tnfs_fh3\t\tobject;\n};\n\nstruct PATHCONF3resok {\n\tpost_op_attr\tobj_attributes;\n\tuint32\t\tlinkmax;\n\tuint32\t\tname_max;\n\tbool\t\tno_trunc;\n\tbool\t\tchown_restricted;\n\tbool\t\tcase_insensitive;\n\tbool\t\tcase_preserving;\n};\n\nstruct PATHCONF3resfail {\n\tpost_op_attr\tobj_attributes;\n};\n\nunion PATHCONF3res switch (nfsstat3 status) {\ncase NFS3_OK:\n\tPATHCONF3resok\tresok;\ndefault:\n\tPATHCONF3resfail\tresfail;\n};\n\n/*\n * Arguments to commit (v3).\n */\nstruct COMMIT3args {\n\tnfs_fh3\t\tfile;\n\toffset3\t\toffset;\n\tcount3\t\tcount;\n};\n\nstruct COMMIT3resok {\n\twcc_data\tfile_wcc;\n\twriteverf3\tverf;\n};\n\nstruct COMMIT3resfail {\n\twcc_data\tfile_wcc;\n};\n\nunion COMMIT3res switch (nfsstat3 status) {\ncase NFS3_OK:\n\tCOMMIT3resok\tresok;\ndefault:\n\tCOMMIT3resfail\tresfail;\n};\n\n#endif /* WANT_NFS3 */\n\n/*\n * Remote file service routines\n */\nprogram NFS_PROGRAM {\n\tversion NFS_VERSION {\n\t\tvoid \n\t\tNFSPROC_NULL(void) = 0;\n\n\t\tattrstat \n\t\tNFSPROC_GETATTR(nfs_fh) =\t1;\n\n\t\tattrstat \n\t\tNFSPROC_SETATTR(sattrargs) = 2;\n\n\t\tvoid \n\t\tNFSPROC_ROOT(void) = 3;\n\n\t\tdiropres \n\t\tNFSPROC_LOOKUP(diropargs) = 4;\n\n\t\treadlinkres \n\t\tNFSPROC_READLINK(nfs_fh) = 5;\n\n\t\treadres \n\t\tNFSPROC_READ(readargs) = 6;\n\n\t\tvoid \n\t\tNFSPROC_WRITECACHE(void) = 7;\n\n\t\tattrstat\n\t\tNFSPROC_WRITE(writeargs) = 8;\n\n\t\tdiropres\n\t\tNFSPROC_CREATE(createargs) = 9;\n\n\t\tnfsstat\n\t\tNFSPROC_REMOVE(diropargs) = 10;\n\n\t\tnfsstat\n\t\tNFSPROC_RENAME(renameargs) = 11;\n\n\t\tnfsstat\n\t\tNFSPROC_LINK(linkargs) = 12;\n\n\t\tnfsstat\n\t\tNFSPROC_SYMLINK(symlinkargs) = 13;\n\n\t\tdiropres\n\t\tNFSPROC_MKDIR(createargs) = 14;\n\n\t\tnfsstat\n\t\tNFSPROC_RMDIR(diropargs) = 15;\n\n\t\treaddirres\n\t\tNFSPROC_READDIR(readdirargs) = 16;\n\n\t\tstatfsres\n\t\tNFSPROC_STATFS(nfs_fh) = 17;\n\t} = 2;\n} = 100003;\n#ifdef WANT_NFS3\nprogram NFS3_PROGRAM {\n\tversion NFS_V3 {\n\t\tvoid\n\t\tNFSPROC3_NULL(void)\t\t\t= 0;\n\n\t\tGETATTR3res\n\t\tNFSPROC3_GETATTR(GETATTR3args)\t\t= 1;\n\n\t\tSETATTR3res\n\t\tNFSPROC3_SETATTR(SETATTR3args)\t\t= 2;\n\n\t\tLOOKUP3res\n\t\tNFSPROC3_LOOKUP(LOOKUP3args)\t\t= 3;\n\n\t\tACCESS3res\n\t\tNFSPROC3_ACCESS(ACCESS3args)\t\t= 4;\n\n\t\tREADLINK3res\n\t\tNFSPROC3_READLINK(READLINK3args)\t= 5;\n\n\t\tREAD3res\n\t\tNFSPROC3_READ(READ3args)\t\t= 6;\n\n\t\tWRITE3res\n\t\tNFSPROC3_WRITE(WRITE3args)\t\t= 7;\n\n\t\tCREATE3res\n\t\tNFSPROC3_CREATE(CREATE3args)\t\t= 8;\n\n\t\tMKDIR3res\n\t\tNFSPROC3_MKDIR(MKDIR3args)\t\t= 9;\n\n\t\tSYMLINK3res\n\t\tNFSPROC3_SYMLINK(SYMLINK3args)\t\t= 10;\n\n\t\tMKNOD3res\n\t\tNFSPROC3_MKNOD(MKNOD3args)\t\t= 11;\n\n\t\tREMOVE3res\n\t\tNFSPROC3_REMOVE(REMOVE3args)\t\t= 12;\n\n\t\tRMDIR3res\n\t\tNFSPROC3_RMDIR(RMDIR3args)\t\t= 13;\n\n\t\tRENAME3res\n\t\tNFSPROC3_RENAME(RENAME3args)\t\t= 14;\n\n\t\tLINK3res\n\t\tNFSPROC3_LINK(LINK3args)\t\t= 15;\n\n\t\tREADDIR3res\n\t\tNFSPROC3_READDIR(READDIR3args)\t\t= 16;\n\n\t\tREADDIRPLUS3res\n\t\tNFSPROC3_READDIRPLUS(READDIRPLUS3args)\t= 17;\n\n\t\tFSSTAT3res\n\t\tNFSPROC3_FSSTAT(FSSTAT3args)\t\t= 18;\n\n\t\tFSINFO3res\n\t\tNFSPROC3_FSINFO(FSINFO3args)\t\t= 19;\n\n\t\tPATHCONF3res\n\t\tNFSPROC3_PATHCONF(PATHCONF3args)\t= 20;\n\n\t\tCOMMIT3res\n\t\tNFSPROC3_COMMIT(COMMIT3args)\t\t= 21;\n\t} = 3;\n} = 100003;\n#endif\n\n"
  },
  {
    "path": "freebsd-headers/rpcsvc/nis.h",
    "content": "/*\n * Please do not edit this file.\n * It was generated using rpcgen.\n */\n\n#ifndef _NIS_H_RPCGEN\n#define\t_NIS_H_RPCGEN\n\n#include <rpc/rpc.h>\n\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\n/*\n * Sun RPC is a product of Sun Microsystems, Inc. and is provided for\n * unrestricted use provided that this legend is included on all tape\n * media and as a part of the software program in whole or part.  Users\n * may copy or modify Sun RPC without charge, but are not authorized\n * to license or distribute it to anyone else except as part of a product or\n * program developed by the user or with the express written consent of\n * Sun Microsystems, Inc.\n *\n * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE\n * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR\n * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.\n *\n * Sun RPC is provided with no support and without any obligation on the\n * part of Sun Microsystems, Inc. to assist in its use, correction,\n * modification or enhancement.\n *\n * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE\n * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC\n * OR ANY PART THEREOF.\n *\n * In no event will Sun Microsystems, Inc. be liable for any lost revenue\n * or profits or other special, indirect and consequential damages, even if\n * Sun has been advised of the possibility of such damages.\n *\n * Sun Microsystems, Inc.\n * 2550 Garcia Avenue\n * Mountain View, California  94043\n */\n/*\n *\tnis.h\n *\n *\tThis file is the main include file for NIS clients. It contains\n *\tboth the client library function defines and the various data\n * \tstructures used by the NIS service. It includes the file nis_tags.h\n *\twhich defines the tag values. This allows the tags to change without\n *\thaving to change the nis.x file.\n * \t\n *\tNOTE : DO NOT EDIT THIS FILE! It is automatically generated when\n *\t       rpcgen is run on the nis.x file. Note that there is a \n *\t       simple sed script to remove some unneeded lines. (See the\n *\t       Makefile target nis.h)\n *\n */\n#include <rpcsvc/nis_tags.h>\n#include <rpc/xdr.h>\n/*\n * Sun RPC is a product of Sun Microsystems, Inc. and is provided for\n * unrestricted use provided that this legend is included on all tape\n * media and as a part of the software program in whole or part.  Users\n * may copy or modify Sun RPC without charge, but are not authorized\n * to license or distribute it to anyone else except as part of a product or\n * program developed by the user or with the express written consent of\n * Sun Microsystems, Inc.\n *\n * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE\n * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR\n * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.\n *\n * Sun RPC is provided with no support and without any obligation on the\n * part of Sun Microsystems, Inc. to assist in its use, correction,\n * modification or enhancement.\n *\n * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE\n * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC\n * OR ANY PART THEREOF.\n *\n * In no event will Sun Microsystems, Inc. be liable for any lost revenue\n * or profits or other special, indirect and consequential damages, even if\n * Sun has been advised of the possibility of such damages.\n *\n * Sun Microsystems, Inc.\n * 2550 Garcia Avenue\n * Mountain View, California  94043\n */\n\n#ifndef __nis_object_h\n#define __nis_object_h\n\n#define\tNIS_MAXSTRINGLEN 255\n#define\tNIS_MAXNAMELEN 1024\n#define\tNIS_MAXATTRNAME 32\n#define\tNIS_MAXATTRVAL 2048\n#define\tNIS_MAXCOLUMNS 64\n#define\tNIS_MAXATTR 16\n#define\tNIS_MAXPATH 1024\n#define\tNIS_MAXREPLICAS 128\n#define\tNIS_MAXLINKS 16\n#define\tNIS_PK_NONE 0\n#define\tNIS_PK_DH 1\n#define\tNIS_PK_RSA 2\n#define\tNIS_PK_KERB 3\n\nstruct nis_attr {\n\tchar *zattr_ndx;\n\tstruct {\n\t\tu_int zattr_val_len;\n\t\tchar *zattr_val_val;\n\t} zattr_val;\n};\ntypedef struct nis_attr nis_attr;\n\ntypedef char *nis_name;\n\nenum zotypes {\n\tBOGUS_OBJ = 0,\n\tNO_OBJ = 1,\n\tDIRECTORY_OBJ = 2,\n\tGROUP_OBJ = 3,\n\tTABLE_OBJ = 4,\n\tENTRY_OBJ = 5,\n\tLINK_OBJ = 6,\n\tPRIVATE_OBJ = 7\n};\ntypedef enum zotypes zotypes;\n\nenum nstype {\n\tUNKNOWN = 0,\n\tNIS = 1,\n\tSUNYP = 2,\n\tIVY = 3,\n\tDNS = 4,\n\tX500 = 5,\n\tDNANS = 6,\n\tXCHS = 7,\n\tCDS = 8\n};\ntypedef enum nstype nstype;\n\nstruct oar_mask {\n\tu_long oa_rights;\n\tzotypes oa_otype;\n};\ntypedef struct oar_mask oar_mask;\n\nstruct endpoint {\n\tchar *uaddr;\n\tchar *family;\n\tchar *proto;\n};\ntypedef struct endpoint endpoint;\n\nstruct nis_server {\n\tnis_name name;\n\tstruct {\n\t\tu_int ep_len;\n\t\tendpoint *ep_val;\n\t} ep;\n\tu_long key_type;\n\tnetobj pkey;\n};\ntypedef struct nis_server nis_server;\n\nstruct directory_obj {\n\tnis_name do_name;\n\tnstype do_type;\n\tstruct {\n\t\tu_int do_servers_len;\n\t\tnis_server *do_servers_val;\n\t} do_servers;\n\tu_long do_ttl;\n\tstruct {\n\t\tu_int do_armask_len;\n\t\toar_mask *do_armask_val;\n\t} do_armask;\n};\ntypedef struct directory_obj directory_obj;\n#define\tEN_BINARY 1\n#define\tEN_CRYPT 2\n#define\tEN_XDR 4\n#define\tEN_MODIFIED 8\n#define\tEN_ASN1 64\n\nstruct entry_col {\n\tu_long ec_flags;\n\tstruct {\n\t\tu_int ec_value_len;\n\t\tchar *ec_value_val;\n\t} ec_value;\n};\ntypedef struct entry_col entry_col;\n\nstruct entry_obj {\n\tchar *en_type;\n\tstruct {\n\t\tu_int en_cols_len;\n\t\tentry_col *en_cols_val;\n\t} en_cols;\n};\ntypedef struct entry_obj entry_obj;\n\nstruct group_obj {\n\tu_long gr_flags;\n\tstruct {\n\t\tu_int gr_members_len;\n\t\tnis_name *gr_members_val;\n\t} gr_members;\n};\ntypedef struct group_obj group_obj;\n\nstruct link_obj {\n\tzotypes li_rtype;\n\tstruct {\n\t\tu_int li_attrs_len;\n\t\tnis_attr *li_attrs_val;\n\t} li_attrs;\n\tnis_name li_name;\n};\ntypedef struct link_obj link_obj;\n#define\tTA_BINARY 1\n#define\tTA_CRYPT 2\n#define\tTA_XDR 4\n#define\tTA_SEARCHABLE 8\n#define\tTA_CASE 16\n#define\tTA_MODIFIED 32\n#define\tTA_ASN1 64\n\nstruct table_col {\n\tchar *tc_name;\n\tu_long tc_flags;\n\tu_long tc_rights;\n};\ntypedef struct table_col table_col;\n\nstruct table_obj {\n\tchar *ta_type;\n\tint ta_maxcol;\n\tu_char ta_sep;\n\tstruct {\n\t\tu_int ta_cols_len;\n\t\ttable_col *ta_cols_val;\n\t} ta_cols;\n\tchar *ta_path;\n};\ntypedef struct table_obj table_obj;\n\nstruct objdata {\n\tzotypes zo_type;\n\tunion {\n\t\tstruct directory_obj di_data;\n\t\tstruct group_obj gr_data;\n\t\tstruct table_obj ta_data;\n\t\tstruct entry_obj en_data;\n\t\tstruct link_obj li_data;\n\t\tstruct {\n\t\t\tu_int po_data_len;\n\t\t\tchar *po_data_val;\n\t\t} po_data;\n\t} objdata_u;\n};\ntypedef struct objdata objdata;\n\nstruct nis_oid {\n\tu_long ctime;\n\tu_long mtime;\n};\ntypedef struct nis_oid nis_oid;\n\nstruct nis_object {\n\tnis_oid zo_oid;\n\tnis_name zo_name;\n\tnis_name zo_owner;\n\tnis_name zo_group;\n\tnis_name zo_domain;\n\tu_long zo_access;\n\tu_long zo_ttl;\n\tobjdata zo_data;\n};\ntypedef struct nis_object nis_object;\n\n#endif /* if __nis_object_h */\n\n\nenum nis_error {\n\tNIS_SUCCESS = 0,\n\tNIS_S_SUCCESS = 1,\n\tNIS_NOTFOUND = 2,\n\tNIS_S_NOTFOUND = 3,\n\tNIS_CACHEEXPIRED = 4,\n\tNIS_NAMEUNREACHABLE = 5,\n\tNIS_UNKNOWNOBJ = 6,\n\tNIS_TRYAGAIN = 7,\n\tNIS_SYSTEMERROR = 8,\n\tNIS_CHAINBROKEN = 9,\n\tNIS_PERMISSION = 10,\n\tNIS_NOTOWNER = 11,\n\tNIS_NOT_ME = 12,\n\tNIS_NOMEMORY = 13,\n\tNIS_NAMEEXISTS = 14,\n\tNIS_NOTMASTER = 15,\n\tNIS_INVALIDOBJ = 16,\n\tNIS_BADNAME = 17,\n\tNIS_NOCALLBACK = 18,\n\tNIS_CBRESULTS = 19,\n\tNIS_NOSUCHNAME = 20,\n\tNIS_NOTUNIQUE = 21,\n\tNIS_IBMODERROR = 22,\n\tNIS_NOSUCHTABLE = 23,\n\tNIS_TYPEMISMATCH = 24,\n\tNIS_LINKNAMEERROR = 25,\n\tNIS_PARTIAL = 26,\n\tNIS_TOOMANYATTRS = 27,\n\tNIS_RPCERROR = 28,\n\tNIS_BADATTRIBUTE = 29,\n\tNIS_NOTSEARCHABLE = 30,\n\tNIS_CBERROR = 31,\n\tNIS_FOREIGNNS = 32,\n\tNIS_BADOBJECT = 33,\n\tNIS_NOTSAMEOBJ = 34,\n\tNIS_MODFAIL = 35,\n\tNIS_BADREQUEST = 36,\n\tNIS_NOTEMPTY = 37,\n\tNIS_COLDSTART_ERR = 38,\n\tNIS_RESYNC = 39,\n\tNIS_FAIL = 40,\n\tNIS_UNAVAIL = 41,\n\tNIS_RES2BIG = 42,\n\tNIS_SRVAUTH = 43,\n\tNIS_CLNTAUTH = 44,\n\tNIS_NOFILESPACE = 45,\n\tNIS_NOPROC = 46,\n\tNIS_DUMPLATER = 47\n};\ntypedef enum nis_error nis_error;\n\nstruct nis_result {\n\tnis_error status;\n\tstruct {\n\t\tu_int objects_len;\n\t\tnis_object *objects_val;\n\t} objects;\n\tnetobj cookie;\n\tu_long zticks;\n\tu_long dticks;\n\tu_long aticks;\n\tu_long cticks;\n};\ntypedef struct nis_result nis_result;\n\nstruct ns_request {\n\tnis_name ns_name;\n\tstruct {\n\t\tu_int ns_object_len;\n\t\tnis_object *ns_object_val;\n\t} ns_object;\n};\ntypedef struct ns_request ns_request;\n\nstruct ib_request {\n\tnis_name ibr_name;\n\tstruct {\n\t\tu_int ibr_srch_len;\n\t\tnis_attr *ibr_srch_val;\n\t} ibr_srch;\n\tu_long ibr_flags;\n\tstruct {\n\t\tu_int ibr_obj_len;\n\t\tnis_object *ibr_obj_val;\n\t} ibr_obj;\n\tstruct {\n\t\tu_int ibr_cbhost_len;\n\t\tnis_server *ibr_cbhost_val;\n\t} ibr_cbhost;\n\tu_long ibr_bufsize;\n\tnetobj ibr_cookie;\n};\ntypedef struct ib_request ib_request;\n\nstruct ping_args {\n\tnis_name dir;\n\tu_long stamp;\n};\ntypedef struct ping_args ping_args;\n\nenum log_entry_t {\n\tLOG_NOP = 0,\n\tADD_NAME = 1,\n\tREM_NAME = 2,\n\tMOD_NAME_OLD = 3,\n\tMOD_NAME_NEW = 4,\n\tADD_IBASE = 5,\n\tREM_IBASE = 6,\n\tMOD_IBASE = 7,\n\tUPD_STAMP = 8\n};\ntypedef enum log_entry_t log_entry_t;\n\nstruct log_entry {\n\tu_long le_time;\n\tlog_entry_t le_type;\n\tnis_name le_princp;\n\tnis_name le_name;\n\tstruct {\n\t\tu_int le_attrs_len;\n\t\tnis_attr *le_attrs_val;\n\t} le_attrs;\n\tnis_object le_object;\n};\ntypedef struct log_entry log_entry;\n\nstruct log_result {\n\tnis_error lr_status;\n\tnetobj lr_cookie;\n\tstruct {\n\t\tu_int lr_entries_len;\n\t\tlog_entry *lr_entries_val;\n\t} lr_entries;\n};\ntypedef struct log_result log_result;\n\nstruct cp_result {\n\tnis_error cp_status;\n\tu_long cp_zticks;\n\tu_long cp_dticks;\n};\ntypedef struct cp_result cp_result;\n\nstruct nis_tag {\n\tu_long tag_type;\n\tchar *tag_val;\n};\ntypedef struct nis_tag nis_tag;\n\nstruct nis_taglist {\n\tstruct {\n\t\tu_int tags_len;\n\t\tnis_tag *tags_val;\n\t} tags;\n};\ntypedef struct nis_taglist nis_taglist;\n\nstruct dump_args {\n\tnis_name da_dir;\n\tu_long da_time;\n\tstruct {\n\t\tu_int da_cbhost_len;\n\t\tnis_server *da_cbhost_val;\n\t} da_cbhost;\n};\ntypedef struct dump_args dump_args;\n\nstruct fd_args {\n\tnis_name dir_name;\n\tnis_name requester;\n};\ntypedef struct fd_args fd_args;\n\nstruct fd_result {\n\tnis_error status;\n\tnis_name source;\n\tstruct {\n\t\tu_int dir_data_len;\n\t\tchar *dir_data_val;\n\t} dir_data;\n\tstruct {\n\t\tu_int signature_len;\n\t\tchar *signature_val;\n\t} signature;\n};\ntypedef struct fd_result fd_result;\n/*\n * Generic \"hash\" datastructures, used by all types of hashed data.\n */\nstruct nis_hash_data {\n nis_name name; /* NIS name of hashed item      */\n int keychain; /* It's hash key (for pop)      */\n struct nis_hash_data *next; /* Hash collision pointer       */\n struct nis_hash_data *prv_item; /* A serial, doubly linked list */\n struct nis_hash_data *nxt_item; /* of items in the hash table   */\n};\ntypedef struct nis_hash_data NIS_HASH_ITEM;\n\nstruct nis_hash_table {\n NIS_HASH_ITEM *keys[64]; /* A hash table of items           */\n NIS_HASH_ITEM *first; /* The first \"item\" in serial list */\n};\ntypedef struct nis_hash_table NIS_HASH_TABLE;\n\n/* Structure for storing dynamically allocated static data */\nstruct nis_sdata {\n void *buf; /* Memory allocation pointer \t*/\n u_long size; /* Buffer size\t\t\t*/\n};\n\n/* Generic client creating flags */\n#define ZMH_VC 1\n#define ZMH_DG 2\n#define ZMH_AUTH 4\n\n/* Testing Access rights for objects */\n\n#define NIS_READ_ACC 1\n#define NIS_MODIFY_ACC 2\n#define NIS_CREATE_ACC 4\n#define NIS_DESTROY_ACC 8\n/* Test macros. a == access rights, m == desired rights. */\n#define WORLD(a, m) (((a) & (m)) != 0)\n#define GROUP(a, m) (((a) & ((m) << 8)) != 0)\n#define OWNER(a, m) (((a) & ((m) << 16)) != 0)\n#define NOBODY(a, m) (((a) & ((m) << 24)) != 0)\n\n#define OATYPE(d, n) (((d)->do_armask.do_armask_val+n)->oa_otype)\n#define OARIGHTS(d, n) (((d)->do_armask.do_armask_val+n)->oa_rights)\n#define WORLD_DEFAULT (NIS_READ_ACC)\n#define GROUP_DEFAULT (NIS_READ_ACC << 8)\n#define OWNER_DEFAULT ((NIS_READ_ACC + NIS_MODIFY_ACC + NIS_CREATE_ACC + NIS_DESTROY_ACC) << 16)\n#define DEFAULT_RIGHTS (WORLD_DEFAULT | GROUP_DEFAULT | OWNER_DEFAULT)\n\n/* Result manipulation defines ... */\n#define NIS_RES_NUMOBJ(x) ((x)->objects.objects_len)\n#define NIS_RES_OBJECT(x) ((x)->objects.objects_val)\n#define NIS_RES_COOKIE(x) ((x)->cookie)\n#define NIS_RES_STATUS(x) ((x)->status)\n\n/* These defines make getting at the variant part of the object easier. */\n#define TA_data zo_data.objdata_u.ta_data\n#define EN_data zo_data.objdata_u.en_data\n#define DI_data zo_data.objdata_u.di_data\n#define LI_data zo_data.objdata_u.li_data\n#define GR_data zo_data.objdata_u.gr_data\n\n#define __type_of(o) ((o)->zo_data.zo_type)\n\n/* Declarations for the internal subroutines in nislib.c */\nenum name_pos {SAME_NAME, HIGHER_NAME, LOWER_NAME, NOT_SEQUENTIAL, BAD_NAME};\ntypedef enum name_pos name_pos;\n\n/*\n * Defines for getting at column data in entry objects. Because RPCGEN\n * generates some rather wordy structures, we create some defines that\n * collapse the needed keystrokes to access a particular value using\n * these definitions they take an nis_object *, and an int and return\n * a u_char * for Value, and an int for length.\n */\n#define ENTRY_VAL(obj, col) (obj)->EN_data.en_cols.en_cols_val[col].ec_value.ec_value_val\n#define ENTRY_LEN(obj, col) (obj)->EN_data.en_cols.en_cols_val[col].ec_value.ec_value_len\n\n#ifdef __cplusplus\n}\n#endif\n\n/* Prototypes, and extern declarations for the NIS library functions. */\n#include <rpcsvc/nislib.h>\n#endif /* __NIS_RPCGEN_H */\n/* EDIT_START */\n\n/*\n * nis_3.h\n * \n * This file contains definitions that are only of interest to the actual\n * service daemon and client stubs. Normal users of NIS will not include\n * this file.\n *\n * NOTE : This include file is automatically created by a combination \n * of rpcgen and sed. DO NOT EDIT IT, change the nis.x file instead\n * and then remake this file.\n */\n#ifndef __nis_3_h\n#define __nis_3_h\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\n#define\tNIS_PROG ((unsigned long)(100300))\n#define\tNIS_VERSION ((unsigned long)(3))\n\nextern  void nis_prog_3(struct svc_req *rqstp, SVCXPRT *transp);\n#define\tNIS_LOOKUP ((unsigned long)(1))\nextern  nis_result * nis_lookup_3(ns_request *, CLIENT *);\nextern  nis_result * nis_lookup_3_svc(ns_request *, struct svc_req *);\n#define\tNIS_ADD ((unsigned long)(2))\nextern  nis_result * nis_add_3(ns_request *, CLIENT *);\nextern  nis_result * nis_add_3_svc(ns_request *, struct svc_req *);\n#define\tNIS_MODIFY ((unsigned long)(3))\nextern  nis_result * nis_modify_3(ns_request *, CLIENT *);\nextern  nis_result * nis_modify_3_svc(ns_request *, struct svc_req *);\n#define\tNIS_REMOVE ((unsigned long)(4))\nextern  nis_result * nis_remove_3(ns_request *, CLIENT *);\nextern  nis_result * nis_remove_3_svc(ns_request *, struct svc_req *);\n#define\tNIS_IBLIST ((unsigned long)(5))\nextern  nis_result * nis_iblist_3(ib_request *, CLIENT *);\nextern  nis_result * nis_iblist_3_svc(ib_request *, struct svc_req *);\n#define\tNIS_IBADD ((unsigned long)(6))\nextern  nis_result * nis_ibadd_3(ib_request *, CLIENT *);\nextern  nis_result * nis_ibadd_3_svc(ib_request *, struct svc_req *);\n#define\tNIS_IBMODIFY ((unsigned long)(7))\nextern  nis_result * nis_ibmodify_3(ib_request *, CLIENT *);\nextern  nis_result * nis_ibmodify_3_svc(ib_request *, struct svc_req *);\n#define\tNIS_IBREMOVE ((unsigned long)(8))\nextern  nis_result * nis_ibremove_3(ib_request *, CLIENT *);\nextern  nis_result * nis_ibremove_3_svc(ib_request *, struct svc_req *);\n#define\tNIS_IBFIRST ((unsigned long)(9))\nextern  nis_result * nis_ibfirst_3(ib_request *, CLIENT *);\nextern  nis_result * nis_ibfirst_3_svc(ib_request *, struct svc_req *);\n#define\tNIS_IBNEXT ((unsigned long)(10))\nextern  nis_result * nis_ibnext_3(ib_request *, CLIENT *);\nextern  nis_result * nis_ibnext_3_svc(ib_request *, struct svc_req *);\n#define\tNIS_FINDDIRECTORY ((unsigned long)(12))\nextern  fd_result * nis_finddirectory_3(fd_args *, CLIENT *);\nextern  fd_result * nis_finddirectory_3_svc(fd_args *, struct svc_req *);\n#define\tNIS_STATUS ((unsigned long)(14))\nextern  nis_taglist * nis_status_3(nis_taglist *, CLIENT *);\nextern  nis_taglist * nis_status_3_svc(nis_taglist *, struct svc_req *);\n#define\tNIS_DUMPLOG ((unsigned long)(15))\nextern  log_result * nis_dumplog_3(dump_args *, CLIENT *);\nextern  log_result * nis_dumplog_3_svc(dump_args *, struct svc_req *);\n#define\tNIS_DUMP ((unsigned long)(16))\nextern  log_result * nis_dump_3(dump_args *, CLIENT *);\nextern  log_result * nis_dump_3_svc(dump_args *, struct svc_req *);\n#define\tNIS_CALLBACK ((unsigned long)(17))\nextern  bool_t * nis_callback_3(netobj *, CLIENT *);\nextern  bool_t * nis_callback_3_svc(netobj *, struct svc_req *);\n#define\tNIS_CPTIME ((unsigned long)(18))\nextern  u_long * nis_cptime_3(nis_name *, CLIENT *);\nextern  u_long * nis_cptime_3_svc(nis_name *, struct svc_req *);\n#define\tNIS_CHECKPOINT ((unsigned long)(19))\nextern  cp_result * nis_checkpoint_3(nis_name *, CLIENT *);\nextern  cp_result * nis_checkpoint_3_svc(nis_name *, struct svc_req *);\n#define\tNIS_PING ((unsigned long)(20))\nextern  void * nis_ping_3(ping_args *, CLIENT *);\nextern  void * nis_ping_3_svc(ping_args *, struct svc_req *);\n#define\tNIS_SERVSTATE ((unsigned long)(21))\nextern  nis_taglist * nis_servstate_3(nis_taglist *, CLIENT *);\nextern  nis_taglist * nis_servstate_3_svc(nis_taglist *, struct svc_req *);\n#define\tNIS_MKDIR ((unsigned long)(22))\nextern  nis_error * nis_mkdir_3(nis_name *, CLIENT *);\nextern  nis_error * nis_mkdir_3_svc(nis_name *, struct svc_req *);\n#define\tNIS_RMDIR ((unsigned long)(23))\nextern  nis_error * nis_rmdir_3(nis_name *, CLIENT *);\nextern  nis_error * nis_rmdir_3_svc(nis_name *, struct svc_req *);\n#define\tNIS_UPDKEYS ((unsigned long)(24))\nextern  nis_error * nis_updkeys_3(nis_name *, CLIENT *);\nextern  nis_error * nis_updkeys_3_svc(nis_name *, struct svc_req *);\nextern int nis_prog_3_freeresult(SVCXPRT *, xdrproc_t, caddr_t);\n\n/* the xdr functions */\nextern  bool_t xdr_nis_attr(XDR *, nis_attr*);\nextern  bool_t xdr_nis_name(XDR *, nis_name*);\nextern  bool_t xdr_zotypes(XDR *, zotypes*);\nextern  bool_t xdr_nstype(XDR *, nstype*);\nextern  bool_t xdr_oar_mask(XDR *, oar_mask*);\nextern  bool_t xdr_endpoint(XDR *, endpoint*);\nextern  bool_t xdr_nis_server(XDR *, nis_server*);\nextern  bool_t xdr_directory_obj(XDR *, directory_obj*);\nextern  bool_t xdr_entry_col(XDR *, entry_col*);\nextern  bool_t xdr_entry_obj(XDR *, entry_obj*);\nextern  bool_t xdr_group_obj(XDR *, group_obj*);\nextern  bool_t xdr_link_obj(XDR *, link_obj*);\nextern  bool_t xdr_table_col(XDR *, table_col*);\nextern  bool_t xdr_table_obj(XDR *, table_obj*);\nextern  bool_t xdr_objdata(XDR *, objdata*);\nextern  bool_t xdr_nis_oid(XDR *, nis_oid*);\nextern  bool_t xdr_nis_object(XDR *, nis_object*);\nextern  bool_t xdr_nis_error(XDR *, nis_error*);\nextern  bool_t xdr_nis_result(XDR *, nis_result*);\nextern  bool_t xdr_ns_request(XDR *, ns_request*);\nextern  bool_t xdr_ib_request(XDR *, ib_request*);\nextern  bool_t xdr_ping_args(XDR *, ping_args*);\nextern  bool_t xdr_log_entry_t(XDR *, log_entry_t*);\nextern  bool_t xdr_log_entry(XDR *, log_entry*);\nextern  bool_t xdr_log_result(XDR *, log_result*);\nextern  bool_t xdr_cp_result(XDR *, cp_result*);\nextern  bool_t xdr_nis_tag(XDR *, nis_tag*);\nextern  bool_t xdr_nis_taglist(XDR *, nis_taglist*);\nextern  bool_t xdr_dump_args(XDR *, dump_args*);\nextern  bool_t xdr_fd_args(XDR *, fd_args*);\nextern  bool_t xdr_fd_result(XDR *, fd_result*);\n\n#ifdef __cplusplus\n}\n#endif\n\n#endif /* !_NIS_H_RPCGEN */\n"
  },
  {
    "path": "freebsd-headers/rpcsvc/nis.x",
    "content": "%/*\n% * Sun RPC is a product of Sun Microsystems, Inc. and is provided for\n% * unrestricted use provided that this legend is included on all tape\n% * media and as a part of the software program in whole or part.  Users\n% * may copy or modify Sun RPC without charge, but are not authorized\n% * to license or distribute it to anyone else except as part of a product or\n% * program developed by the user or with the express written consent of\n% * Sun Microsystems, Inc.\n% *\n% * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE\n% * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR\n% * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.\n% *\n% * Sun RPC is provided with no support and without any obligation on the\n% * part of Sun Microsystems, Inc. to assist in its use, correction,\n% * modification or enhancement.\n% *\n% * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE\n% * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC\n% * OR ANY PART THEREOF.\n% *\n% * In no event will Sun Microsystems, Inc. be liable for any lost revenue\n% * or profits or other special, indirect and consequential damages, even if\n% * Sun has been advised of the possibility of such damages.\n% *\n% * Sun Microsystems, Inc.\n% * 2550 Garcia Avenue\n% * Mountain View, California  94043\n% */\n\n#ifndef RPC_HDR\n%#include <sys/cdefs.h>\n%__FBSDID(\"$FreeBSD: release/9.0.0/include/rpcsvc/nis.x 114629 2003-05-04 02:51:42Z obrien $\");\n#endif\n\n/* \n * From 4.1 : @(#)nis.x\t1.61 Copyright 1989 Sun Microsystems\n *\n * RPC Language Protocol description file for NIS Plus\n * This version : 1.61\n * Last Modified : 3/19/91\n */\n#ifdef RPC_HDR\n%/*\n% *\tnis.h\n% *\n% *\tThis file is the main include file for NIS clients. It contains\n% *\tboth the client library function defines and the various data\n% * \tstructures used by the NIS service. It includes the file nis_tags.h\n% *\twhich defines the tag values. This allows the tags to change without\n% *\thaving to change the nis.x file.\n% * \t\n% *\tNOTE : DO NOT EDIT THIS FILE! It is automatically generated when\n% *\t       rpcgen is run on the nis.x file. Note that there is a \n% *\t       simple sed script to remove some unneeded lines. (See the\n% *\t       Makefile target nis.h)\n% *\n% */\n%#include <rpcsvc/nis_tags.h>\n#endif\n\n/* This gets stuffed into the source files. */\n#if RPC_HDR\n%#include <rpc/xdr.h>\n#endif\n/*\n * This is just pointless.\n */\n#ifdef SUN_STUPIDITY\n#if RPC_SVC\n%#include \"nis_svc.h\"\n#endif\n#endif\n\n/* Include the RPC Language description of NIS objects */\n#include \"nis_object.x\"\n\n/* Errors  that can be returned by the service */\nenum nis_error {\n\tNIS_SUCCESS = 0,\t/* A-ok, let's rock n roll \t*/\n\tNIS_S_SUCCESS = 1,\t/* Name found (maybe)\t   \t*/\n\tNIS_NOTFOUND = 2,\t/* Name definitely not found \t*/\n\tNIS_S_NOTFOUND = 3,\t/* Name maybe not found \t*/\n\tNIS_CACHEEXPIRED = 4,\t/* Name exists but cache out of date */\n\tNIS_NAMEUNREACHABLE = 5, /* Can't get there from here */\n\tNIS_UNKNOWNOBJ = 6,\t/* Object type is bogus */\n\tNIS_TRYAGAIN = 7,\t/* I'm busy, call back */\n\tNIS_SYSTEMERROR = 8,\t/* Out of band failure */\n\tNIS_CHAINBROKEN = 9,\t/* First/Next warning */\n\tNIS_PERMISSION = 10,\t/* Not enough permission to access */\n\tNIS_NOTOWNER = 11,\t/* You don't own it, sorry */\n\tNIS_NOT_ME = 12,\t/* I don't serve this name */\n\tNIS_NOMEMORY = 13,\t/* Outta VM! Help! */\n\tNIS_NAMEEXISTS = 14,\t/* Can't create over another name */\n\tNIS_NOTMASTER = 15,\t/* I'm justa secondaray, don't ask me */\n\tNIS_INVALIDOBJ = 16,\t/* Object is broken somehow */\n\tNIS_BADNAME = 17,\t/* Unparsable name */\n\tNIS_NOCALLBACK = 18,\t/* Couldn't talk to call back proc */\n\tNIS_CBRESULTS = 19,\t/* Results being called back to you */\n\tNIS_NOSUCHNAME = 20,\t/* Name unknown */\n\tNIS_NOTUNIQUE = 21,\t/* Value is not uniques (entry) */\n\tNIS_IBMODERROR = 22,\t/* Inf. Base. Modify error. */\n\tNIS_NOSUCHTABLE = 23,\t/* Name for table was wrong */\n\tNIS_TYPEMISMATCH = 24, \t/* Entry and table type mismatch */\n\tNIS_LINKNAMEERROR = 25,\t/* Link points to bogus name */\n\tNIS_PARTIAL = 26,\t/* Partial success, found table */\n\tNIS_TOOMANYATTRS = 27,\t/* Too many attributes */\n\tNIS_RPCERROR = 28,\t/* RPC error encountered */\n\tNIS_BADATTRIBUTE = 29,\t/* Bad or invalid attribute */\n\tNIS_NOTSEARCHABLE = 30,\t/* Non-searchable object searched */\n\tNIS_CBERROR = 31,\t/* Error during callback (svc crash) */\n\tNIS_FOREIGNNS = 32,\t/* Foreign Namespace */\n\tNIS_BADOBJECT = 33,\t/* Malformed object structure */\n\tNIS_NOTSAMEOBJ = 34,\t/* Object swapped during deletion */\n\tNIS_MODFAIL = 35,\t/* Failure during a Modify. */\n\tNIS_BADREQUEST = 36,\t/* Illegal query for table */\n\tNIS_NOTEMPTY = 37,\t/* Attempt to remove a non-empty tbl */\n\tNIS_COLDSTART_ERR = 38, /* Error accesing the cold start file */\n\tNIS_RESYNC = 39,\t/* Transaction log too far out of date */\n\tNIS_FAIL = 40,\t\t/* NIS operation failed. */\n\tNIS_UNAVAIL = 41,\t/* NIS+ service is unavailable (client) */\n\tNIS_RES2BIG = 42,\t/* NIS+ result too big for datagram */\n\tNIS_SRVAUTH = 43,\t/* NIS+ server wasn't authenticated. */\n\tNIS_CLNTAUTH = 44,\t/* NIS+ Client wasn't authenticated. */\n\tNIS_NOFILESPACE = 45,\t/* NIS+ server ran out of disk space */\n\tNIS_NOPROC = 46,\t/* NIS+ server couldn't create new proc */\n\tNIS_DUMPLATER = 47\t/* NIS+ server already has dump child */\n};\n\n\n/* \n * Structure definitions for the parameters and results of the actual\n * NIS RPC calls.\n *\n * This is the standard result (in the protocol) of most of the nis \n * requests.\n */\n\nstruct nis_result {\n\tnis_error\tstatus;\t\t/* Status of the response */\n\tnis_object\tobjects<>;\t/* objects found \t  */\n\tnetobj\t\tcookie;\t\t/* Cookie Data \t\t  */\n\tu_long\t\tzticks;\t\t/* server ticks\t \t  */\n\tu_long\t\tdticks;\t\t/* DBM ticks.\t\t  */\n\tu_long\t\taticks;\t\t/* Cache (accel) ticks\t  */\n\tu_long\t\tcticks;\t\t/* Client ticks\t\t  */\n};\n\n/* \n * A Name Service request \n * This request is used to access the name space, ns_name is the name \n * of the object within the namespace and the object is it's value, for\n * add/modify, a copy of the original for remove. \n */\n\nstruct ns_request {\n\tnis_name\tns_name;\t/* Name in the NIS name space\t*/\n\tnis_object\tns_object<1>;\t/* Optional Object (add/remove)\t*/\n};\n\n/* \n * An information base request\n * This request includes the NIS name of the table we wish to search, the\n * search criteria in the form of attribute/value pairs and an optional\n * callback program number. If the callback program number is provided\n * the server will send back objects one at a time, otherwise it will\n * return them all in the response.\n */\n\nstruct ib_request {\n\tnis_name  \tibr_name;\t/* The name of the Table \t*/\n\tnis_attr  \tibr_srch<>; \t/* The search critereia \t*/\n\tu_long\t\tibr_flags;\t/* Optional flags \t\t*/\n\tnis_object\tibr_obj<1>;\t/* optional object (add/modify) */\n\tnis_server\tibr_cbhost<1>;\t/* Optional callback info\t*/\n\tu_long\t\tibr_bufsize;\t/* Optional first/next bufsize\t*/\n\tnetobj\t\tibr_cookie;\t/* The first/next cookie\t*/\n};\n\n/*\n * This argument to the PING call notifies the replicas that something in \n * a directory has changed and this is it's timestamp. The replica will use\n * the timestamp to determine if its resync operation was successful.\n */\nstruct ping_args {\n\tnis_name\tdir;\t/* Directory that had the change */\n\tu_long\t\tstamp;\t/* timestamp of the transaction  */\n};\n\n/* \n * These are the type of entries that are stored in the transaction log, \n * note that modifications will appear as two entries, for names, they have\n * an \"OLD\" entry followed by a \"NEW\" entry. For entries in tables, there\n * is a remove followed by an add. It is done this way so that we can read\n * the log backwards to back out transactions and forwards to propogate\n * updated.\n */\nenum log_entry_t {\n\tLOG_NOP = 0,\n\tADD_NAME = 1,\t\t/* Name Added to name space \t\t  */\n\tREM_NAME = 2,\t\t/* Name removed from name space \t  */\n\tMOD_NAME_OLD = 3,\t/* Name was modified in the name space \t  */\n\tMOD_NAME_NEW = 4,\t/* Name was modified in the name space \t  */\n\tADD_IBASE = 5,\t\t/* Entry added to information base \t  */\n\tREM_IBASE = 6,\t\t/* Entry removed from information base    */\n\tMOD_IBASE = 7,\t\t/* Entry was modified in information base */\n\tUPD_STAMP = 8\t\t/* Update timestamp (used as fenceposts)  */\n};\n\t\n/*\n * This result is returned from the name service when it is requested to \n * dump logged entries from its transaction log. Information base updates\n * will have the name of the information base in the le_name field and\n * a canonical set of attribute/value pairs to fully specify the entry's\n * 'name'. \n */\nstruct log_entry {\n\tu_long\t\tle_time;\t/* Time in seconds \t\t*/\n\tlog_entry_t\tle_type;\t/* Type of log entry \t\t*/\n\tnis_name\tle_princp;\t/* Principal making the change\t*/\n\tnis_name\tle_name;\t/* Name of table/dir involved \t*/\n\tnis_attr\tle_attrs<>;\t/* List of AV pairs.\t\t*/\n\tnis_object\tle_object;\t/* Actual object value \t\t*/\n};\n\nstruct log_result {\n\tnis_error \tlr_status;\t/* The status itself \t \t*/\n\tnetobj\t\tlr_cookie;\t/* Used by the dump callback\t*/\n\tlog_entry\tlr_entries<>;\t/* zero or more entries \t*/\n};\n\t\nstruct cp_result {\n\tnis_error\tcp_status;\t/* Status of the checkpoint \t*/\n\tu_long\t\tcp_zticks;\t/* Service 'ticks' \t    \t*/\n\tu_long\t\tcp_dticks;\t/* Database 'ticks'\t    \t*/\n};\n\n/*\n * This structure defines a generic NIS tag list. The taglist contains\n * zero or tags, each of which is a type and a value. (u_long). \n * These are used to report statistics (see tag definitions below)\n * and to set or reset state variables.\n */\nstruct nis_tag {\n\tu_long\ttag_type;\t/* Statistic tag (may vary) \t */\n\tstring\ttag_val<1024>;\t/* Statistic value may also vary */\n};\n\nstruct nis_taglist {\n\tnis_tag tags<>;\t\t/* List of tags */\n};\n\nstruct dump_args {\n\tnis_name\tda_dir;\t\t/* Directory to dump \t*/\n\tu_long\t\tda_time;\t/* From this timestamp\t*/\n\tnis_server\tda_cbhost<1>;\t/* Callback to use.\t*/\n};\n\nstruct fd_args {\n\tnis_name\tdir_name;  /* The directory we're looking for */\n\tnis_name\trequester; /* Host principal name for signature */\n};\n\nstruct fd_result {\n\tnis_error\tstatus;\t\t/* Status returned by function\t*/\n\tnis_name\tsource;\t\t/* Source of this answer   \t*/\n\topaque\t\tdir_data<>;\t/* Directory Data (XDR'ed) \t*/ \n\topaque\t\tsignature<>;\t/* Signature of the source \t*/\n};\n\n\n/* \n * What's going on here? Well, it's like this. When the service\n * is being compiled it wants to have the service definition specific\n * info included, and when the client is being compiled it wants that\n * info. This includes the appropriate file which was generated by\n * make in the protocols directory (probably /usr/include/rpcsvc).\n *\n * Uhm... guys? With RPC, you aren't supposed to have separate\n * server-specific and client-specific header files. You have one header\n * file that's suitable for both. If your code doesn't work using just\n * the one header file, I submit to you that it's broken.\n *\t\t\t\t\t\t\t-Bill\n */\n#ifdef SUN_STUPIDITY\n#ifdef RPC_SVC\n%#include \"nis_svc.h\"\n#endif\n#ifdef RPC_CLNT\n%#include \"nis_clnt.h\"\n#endif\n#endif\n\nprogram  NIS_PROG {\n\n\t/* RPC Language description of the NIS+ protocol */\n\tversion NIS_VERSION {\n\t\t/* The name service functions */\n\t\tnis_result  NIS_LOOKUP(ns_request) = 1;\n\t\tnis_result  NIS_ADD(ns_request) = 2;\n\t\tnis_result  NIS_MODIFY(ns_request) = 3;\n\t\tnis_result  NIS_REMOVE(ns_request) = 4;\n\n\t\t/* The information base functions */\n\t\tnis_result  NIS_IBLIST(ib_request) = 5;\n\t\tnis_result  NIS_IBADD(ib_request) = 6;\n\t\tnis_result  NIS_IBMODIFY(ib_request) = 7;\n\t\tnis_result  NIS_IBREMOVE(ib_request) = 8;\n\t\tnis_result  NIS_IBFIRST(ib_request) = 9;\n\t\tnis_result  NIS_IBNEXT(ib_request) = 10;\n\n\t\t/* NIS Administrative functions */\n\t\tfd_result   NIS_FINDDIRECTORY(fd_args) = 12;\n\n\t\t/* If fetch and optionally reset statistics */\n\t\tnis_taglist  NIS_STATUS(nis_taglist) = 14;\n\t\t\n\t\t/* Dump changes to directory since time in da_time */\n\t\tlog_result  NIS_DUMPLOG(dump_args) = 15;\n\t\t\n\t\t/* Dump contents of directory named */\n\t\tlog_result  NIS_DUMP(dump_args) = 16;\n\n\t\t/* Check status of callback thread */\n\t\tbool\t    NIS_CALLBACK(netobj) = 17;\n\n\t\t/* Return last update time for named dir */\n\t\tu_long      NIS_CPTIME(nis_name) = 18;\n\n\t\t/* Checkpoint directory or table named */\n\t\tcp_result   NIS_CHECKPOINT(nis_name) = 19;\n\n\t\t/* Send 'status changed' ping to replicates */\n\t\tvoid\t    NIS_PING(ping_args) = 20;\n\t\n\t\t/* Modify server behaviour (such as debugging) */\n\t\tnis_taglist NIS_SERVSTATE(nis_taglist) = 21;\n\t\n\t\t/* Create a Directory */\n\t\tnis_error   NIS_MKDIR(nis_name) = 22;\n\t\n\t\t/* Remove a Directory */\n\t\tnis_error   NIS_RMDIR(nis_name) = 23;\n\t\t\n\t\t/* Update public keys of a directory object */\n\t\tnis_error   NIS_UPDKEYS(nis_name) = 24;\n\t} = 3;\n} = 100300;\n\n/*\n * Included below are the defines that become part of nis.h,\n * they are technically not part of the protocol, but do define\n * key aspects of the implementation and are therefore useful\n * in building a conforming server or client.\n */\n#if RPC_HDR\n%/*\n% * Generic \"hash\" datastructures, used by all types of hashed data.\n% */\n%struct nis_hash_data {\n%\tnis_name\t\tname;\t   /* NIS name of hashed item      */\n%\tint\t\t\tkeychain;  /* It's hash key (for pop)      */\n%\tstruct nis_hash_data\t*next;\t   /* Hash collision pointer       */\n%\tstruct nis_hash_data\t*prv_item; /* A serial, doubly linked list */\n%\tstruct nis_hash_data\t*nxt_item; /* of items in the hash table   */\n%};\n%typedef struct nis_hash_data NIS_HASH_ITEM;\n%\n%struct nis_hash_table {\n%\tNIS_HASH_ITEM\t*keys[64];\t/* A hash table of items           */\n%\tNIS_HASH_ITEM\t*first;\t\t/* The first \"item\" in serial list */\n%};\n%typedef struct nis_hash_table NIS_HASH_TABLE;\n%\n%/* Structure for storing dynamically allocated static data */\n%struct nis_sdata {\n%\tvoid\t*buf;\t/* Memory allocation pointer \t*/\n%\tu_long\tsize;\t/* Buffer size\t\t\t*/\n%};\n%\n%/* Generic client creating flags */\n%#define ZMH_VC\t\t1\n%#define ZMH_DG\t\t2\n%#define ZMH_AUTH\t4\n%\n%/* Testing Access rights for objects */\n%\n%#define NIS_READ_ACC\t\t1\n%#define NIS_MODIFY_ACC\t\t2\n%#define NIS_CREATE_ACC\t\t4\n%#define NIS_DESTROY_ACC\t8\n%/* Test macros. a == access rights, m == desired rights. */\n%#define WORLD(a, m)\t(((a) & (m)) != 0)\n%#define GROUP(a, m)\t(((a) & ((m) << 8)) != 0)\n%#define OWNER(a, m)\t(((a) & ((m) << 16)) != 0)\n%#define NOBODY(a, m)\t(((a) & ((m) << 24)) != 0)\n%\n%#define OATYPE(d, n) (((d)->do_armask.do_armask_val+n)->oa_otype)\n%#define OARIGHTS(d, n) (((d)->do_armask.do_armask_val+n)->oa_rights)\n%#define WORLD_DEFAULT (NIS_READ_ACC)\n%#define GROUP_DEFAULT (NIS_READ_ACC << 8)\n%#define OWNER_DEFAULT ((NIS_READ_ACC +\\\n\t\t\t NIS_MODIFY_ACC +\\\n\t\t\t NIS_CREATE_ACC +\\\n\t\t\t NIS_DESTROY_ACC) << 16)\n%#define DEFAULT_RIGHTS (WORLD_DEFAULT | GROUP_DEFAULT | OWNER_DEFAULT)\n%\n%/* Result manipulation defines ... */\n%#define NIS_RES_NUMOBJ(x)\t((x)->objects.objects_len)\n%#define NIS_RES_OBJECT(x)\t((x)->objects.objects_val)\n%#define NIS_RES_COOKIE(x)\t((x)->cookie)\n%#define NIS_RES_STATUS(x)\t((x)->status)\n%\n%/* These defines make getting at the variant part of the object easier. */\n%#define TA_data zo_data.objdata_u.ta_data\n%#define EN_data zo_data.objdata_u.en_data\n%#define DI_data zo_data.objdata_u.di_data\n%#define LI_data zo_data.objdata_u.li_data\n%#define GR_data zo_data.objdata_u.gr_data\n%\n%#define __type_of(o) ((o)->zo_data.zo_type)\n%\n%/* Declarations for the internal subroutines in nislib.c */\n%enum name_pos {SAME_NAME, HIGHER_NAME, LOWER_NAME, NOT_SEQUENTIAL, BAD_NAME};\n%typedef enum name_pos name_pos;\n%\n%/*\n% * Defines for getting at column data in entry objects. Because RPCGEN\n% * generates some rather wordy structures, we create some defines that\n% * collapse the needed keystrokes to access a particular value using\n% * these definitions they take an nis_object *, and an int and return\n% * a u_char * for Value, and an int for length.\n% */\n%#define ENTRY_VAL(obj, col) \\\n\t(obj)->EN_data.en_cols.en_cols_val[col].ec_value.ec_value_val\n%#define ENTRY_LEN(obj, col) \\\n\t(obj)->EN_data.en_cols.en_cols_val[col].ec_value.ec_value_len\n%\n%#ifdef __cplusplus\n%}\n%#endif\n%\n%/* Prototypes, and extern declarations for the NIS library functions. */\n%#include <rpcsvc/nislib.h>\n%#endif /* __NIS_RPCGEN_H */\n%/* EDIT_START */\n%\n%/*\n% * nis_3.h\n% * \n% * This file contains definitions that are only of interest to the actual\n% * service daemon and client stubs. Normal users of NIS will not include\n% * this file.\n% *\n% * NOTE : This include file is automatically created by a combination \n% * of rpcgen and sed. DO NOT EDIT IT, change the nis.x file instead\n% * and then remake this file.\n% */\n%#ifndef __nis_3_h\n%#define __nis_3_h\n%#ifdef __cplusplus\n%extern \"C\" {\n%#endif\n#endif\n"
  },
  {
    "path": "freebsd-headers/rpcsvc/nis_cache.h",
    "content": "/*\n * Please do not edit this file.\n * It was generated using rpcgen.\n */\n\n#ifndef _NIS_CACHE_H_RPCGEN\n#define\t_NIS_CACHE_H_RPCGEN\n\n#include <rpc/rpc.h>\n\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\n/*\n * Sun RPC is a product of Sun Microsystems, Inc. and is provided for\n * unrestricted use provided that this legend is included on all tape\n * media and as a part of the software program in whole or part.  Users\n * may copy or modify Sun RPC without charge, but are not authorized\n * to license or distribute it to anyone else except as part of a product or\n * program developed by the user or with the express written consent of\n * Sun Microsystems, Inc.\n *\n * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE\n * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR\n * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.\n *\n * Sun RPC is provided with no support and without any obligation on the\n * part of Sun Microsystems, Inc. to assist in its use, correction,\n * modification or enhancement.\n *\n * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE\n * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC\n * OR ANY PART THEREOF.\n *\n * In no event will Sun Microsystems, Inc. be liable for any lost revenue\n * or profits or other special, indirect and consequential damages, even if\n * Sun has been advised of the possibility of such damages.\n *\n * Sun Microsystems, Inc.\n * 2550 Garcia Avenue\n * Mountain View, California  94043\n */\n#include <rpc/types.h>\n#include <rpcsvc/nis.h>\n\n/* default cache file */\n#define CACHEFILE \"/var/nis/NIS_SHARED_DIRCACHE\"\n\n/* clients have to read-lock the cache file, and SVR4 locking requires that */\n/*   the file be writable, but we don't want a world-writable cache file.   */\n/*   So... everyone agrees to use a different, world-writable file for the  */\n/*   locking operations, but the data is in CACHEFILE.                      */\n#define CACHELOCK \"/usr/tmp/.NIS_DIR_CACHELOCK\"\n\n/* the file containing one trusted XDR'ed directory object.\n * This has to be present for the system to work.\n */\n#define COLD_START_FILE \"/var/nis/NIS_COLD_START\"\n\nenum pc_status {HIT, MISS, NEAR_MISS};\n\nextern int __nis_debuglevel;\n\n\n\n#define\tCACHEPROG ((unsigned long)(100301))\n#define\tCACHE_VER_1 ((unsigned long)(1))\n\nextern  void cacheprog_1(struct svc_req *rqstp, SVCXPRT *transp);\n#define\tNIS_CACHE_ADD_ENTRY ((unsigned long)(1))\nextern  void * nis_cache_add_entry_1(fd_result *, CLIENT *);\nextern  void * nis_cache_add_entry_1_svc(fd_result *, struct svc_req *);\n#define\tNIS_CACHE_REMOVE_ENTRY ((unsigned long)(2))\nextern  void * nis_cache_remove_entry_1(directory_obj *, CLIENT *);\nextern  void * nis_cache_remove_entry_1_svc(directory_obj *, struct svc_req *);\n#define\tNIS_CACHE_READ_COLDSTART ((unsigned long)(3))\nextern  void * nis_cache_read_coldstart_1(void *, CLIENT *);\nextern  void * nis_cache_read_coldstart_1_svc(void *, struct svc_req *);\n#define\tNIS_CACHE_REFRESH_ENTRY ((unsigned long)(4))\nextern  void * nis_cache_refresh_entry_1(char **, CLIENT *);\nextern  void * nis_cache_refresh_entry_1_svc(char **, struct svc_req *);\nextern int cacheprog_1_freeresult(SVCXPRT *, xdrproc_t, caddr_t);\n\n#ifdef __cplusplus\n}\n#endif\n\n#endif /* !_NIS_CACHE_H_RPCGEN */\n"
  },
  {
    "path": "freebsd-headers/rpcsvc/nis_cache.x",
    "content": "%/*\n% * Sun RPC is a product of Sun Microsystems, Inc. and is provided for\n% * unrestricted use provided that this legend is included on all tape\n% * media and as a part of the software program in whole or part.  Users\n% * may copy or modify Sun RPC without charge, but are not authorized\n% * to license or distribute it to anyone else except as part of a product or\n% * program developed by the user or with the express written consent of\n% * Sun Microsystems, Inc.\n% *\n% * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE\n% * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR\n% * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.\n% *\n% * Sun RPC is provided with no support and without any obligation on the\n% * part of Sun Microsystems, Inc. to assist in its use, correction,\n% * modification or enhancement.\n% *\n% * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE\n% * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC\n% * OR ANY PART THEREOF.\n% *\n% * In no event will Sun Microsystems, Inc. be liable for any lost revenue\n% * or profits or other special, indirect and consequential damages, even if\n% * Sun has been advised of the possibility of such damages.\n% *\n% * Sun Microsystems, Inc.\n% * 2550 Garcia Avenue\n% * Mountain View, California  94043\n% */\n\n/*\n *\tnis_cache.x\n *\n *\tCopyright (c) 1988-1992 Sun Microsystems Inc\n *\tAll Rights Reserved.\n */\n\n/* From: %#pragma ident\t\"@(#)nis_cache.x\t1.11\t94/05/03 SMI\" */\n\n#ifndef RPC_HDR\n%#include <sys/cdefs.h>\n%__FBSDID(\"$FreeBSD: release/9.0.0/include/rpcsvc/nis_cache.x 114629 2003-05-04 02:51:42Z obrien $\");\n#endif\n\n#ifdef RPC_HDR\n%#include <rpc/types.h>\n%#include <rpcsvc/nis.h>\n%\n%/* default cache file */\n%#define CACHEFILE \"/var/nis/NIS_SHARED_DIRCACHE\" \n%\n%/* clients have to read-lock the cache file, and SVR4 locking requires that */\n%/*   the file be writable, but we don't want a world-writable cache file.   */\n%/*   So... everyone agrees to use a different, world-writable file for the  */\n%/*   locking operations, but the data is in CACHEFILE.                      */\n%#define CACHELOCK \"/usr/tmp/.NIS_DIR_CACHELOCK\"\n%\n%/* the file containing one trusted XDR'ed directory object.\n% * This has to be present for the system to work.\n% */\n%#define COLD_START_FILE \"/var/nis/NIS_COLD_START\"\n%\n%enum pc_status {HIT, MISS, NEAR_MISS};\n%\n%extern int __nis_debuglevel;\n%\n%\n#endif\n\n#ifdef RPC_CLNT\n#ifdef SOLARIS\n%#include \"../gen/nis_clnt.h\"\n#else\n%#include \"nis.h\"\n#endif\n#endif\n\nprogram CACHEPROG {\n\tversion CACHE_VER_1 {\n\t\tvoid NIS_CACHE_ADD_ENTRY(fd_result) = 1;\n\t\tvoid NIS_CACHE_REMOVE_ENTRY(directory_obj) = 2;\n\t\tvoid NIS_CACHE_READ_COLDSTART(void) = 3;\n\t\tvoid NIS_CACHE_REFRESH_ENTRY(string<>) = 4;\n\t} = 1;\n} = 100301;\n"
  },
  {
    "path": "freebsd-headers/rpcsvc/nis_callback.h",
    "content": "/*\n * Please do not edit this file.\n * It was generated using rpcgen.\n */\n\n#ifndef _NIS_CALLBACK_H_RPCGEN\n#define\t_NIS_CALLBACK_H_RPCGEN\n\n#include <rpc/rpc.h>\n\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\n/*\n * Sun RPC is a product of Sun Microsystems, Inc. and is provided for\n * unrestricted use provided that this legend is included on all tape\n * media and as a part of the software program in whole or part.  Users\n * may copy or modify Sun RPC without charge, but are not authorized\n * to license or distribute it to anyone else except as part of a product or\n * program developed by the user or with the express written consent of\n * Sun Microsystems, Inc.\n *\n * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE\n * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR\n * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.\n *\n * Sun RPC is provided with no support and without any obligation on the\n * part of Sun Microsystems, Inc. to assist in its use, correction,\n * modification or enhancement.\n *\n * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE\n * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC\n * OR ANY PART THEREOF.\n *\n * In no event will Sun Microsystems, Inc. be liable for any lost revenue\n * or profits or other special, indirect and consequential damages, even if\n * Sun has been advised of the possibility of such damages.\n *\n * Sun Microsystems, Inc.\n * 2550 Garcia Avenue\n * Mountain View, California  94043\n */\n#include <rpcsvc/nis.h>\n\ntypedef nis_object *obj_p;\n\nstruct cback_data {\n\tstruct {\n\t\tu_int entries_len;\n\t\tobj_p *entries_val;\n\t} entries;\n};\ntypedef struct cback_data cback_data;\n\n#define\tCB_PROG ((unsigned long)(100302))\n#define\tCB_VERS ((unsigned long)(1))\n\nextern  void cb_prog_1(struct svc_req *rqstp, SVCXPRT *transp);\n#define\tCBPROC_RECEIVE ((unsigned long)(1))\nextern  bool_t * cbproc_receive_1(cback_data *, CLIENT *);\nextern  bool_t * cbproc_receive_1_svc(cback_data *, struct svc_req *);\n#define\tCBPROC_FINISH ((unsigned long)(2))\nextern  void * cbproc_finish_1(void *, CLIENT *);\nextern  void * cbproc_finish_1_svc(void *, struct svc_req *);\n#define\tCBPROC_ERROR ((unsigned long)(3))\nextern  void * cbproc_error_1(nis_error *, CLIENT *);\nextern  void * cbproc_error_1_svc(nis_error *, struct svc_req *);\nextern int cb_prog_1_freeresult(SVCXPRT *, xdrproc_t, caddr_t);\n\n/* the xdr functions */\nextern  bool_t xdr_obj_p(XDR *, obj_p*);\nextern  bool_t xdr_cback_data(XDR *, cback_data*);\n\n#ifdef __cplusplus\n}\n#endif\n\n#endif /* !_NIS_CALLBACK_H_RPCGEN */\n"
  },
  {
    "path": "freebsd-headers/rpcsvc/nis_callback.x",
    "content": "%/*\n% * Sun RPC is a product of Sun Microsystems, Inc. and is provided for\n% * unrestricted use provided that this legend is included on all tape\n% * media and as a part of the software program in whole or part.  Users\n% * may copy or modify Sun RPC without charge, but are not authorized\n% * to license or distribute it to anyone else except as part of a product or\n% * program developed by the user or with the express written consent of\n% * Sun Microsystems, Inc.\n% *\n% * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE\n% * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR\n% * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.\n% *\n% * Sun RPC is provided with no support and without any obligation on the\n% * part of Sun Microsystems, Inc. to assist in its use, correction,\n% * modification or enhancement.\n% *\n% * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE\n% * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC\n% * OR ANY PART THEREOF.\n% *\n% * In no event will Sun Microsystems, Inc. be liable for any lost revenue\n% * or profits or other special, indirect and consequential damages, even if\n% * Sun has been advised of the possibility of such damages.\n% *\n% * Sun Microsystems, Inc.\n% * 2550 Garcia Avenue\n% * Mountain View, California  94043\n% */\n\n/*\n *\tnis_callback.x\n *\n *\tCopyright (c) 1988-1992 Sun Microsystems Inc\n *\tAll Rights Reserved.\n */\n\n/* From: %#pragma ident\t\"@(#)nis_callback.x\t1.7\t94/05/03 SMI\" */\n\n#ifndef RPC_HDR\n%#include <sys/cdefs.h>\n%__FBSDID(\"$FreeBSD: release/9.0.0/include/rpcsvc/nis_callback.x 114629 2003-05-04 02:51:42Z obrien $\");\n#endif\n\n/*\n * \"@(#)zns_cback.x 1.2 90/09/10 Copyr 1990 Sun Micro\" \n *\n * RPCL description of the Callback Service.\n */\n\n#ifdef RPC_HDR\n%#include <rpcsvc/nis.h>\n#endif\n#ifdef RPC_XDR\n#ifdef SOLARIS\n%#include \"nis_clnt.h\"\n#else\n%#include \"nis.h\"\n#endif\n#endif\n\ntypedef nis_object\t*obj_p;\n\nstruct cback_data {\n\tobj_p\t\tentries<>;\t/* List of objects */\n};\n\nprogram CB_PROG {\n\tversion CB_VERS {\n\t\tbool\tCBPROC_RECEIVE(cback_data) = 1;\n\t\tvoid\tCBPROC_FINISH(void) = 2;\n\t\tvoid\tCBPROC_ERROR(nis_error) = 3;\n\t} = 1;\n} = 100302;\n"
  },
  {
    "path": "freebsd-headers/rpcsvc/nis_db.h",
    "content": "/*\n * Sun RPC is a product of Sun Microsystems, Inc. and is provided for\n * unrestricted use provided that this legend is included on all tape\n * media and as a part of the software program in whole or part.  Users\n * may copy or modify Sun RPC without charge, but are not authorized\n * to license or distribute it to anyone else except as part of a product or\n * program developed by the user.\n * \n * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE\n * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR\n * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.\n * \n * Sun RPC is provided with no support and without any obligation on the\n * part of Sun Microsystems, Inc. to assist in its use, correction,\n * modification or enhancement.\n * \n * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE\n * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC\n * OR ANY PART THEREOF.\n * \n * In no event will Sun Microsystems, Inc. be liable for any lost revenue\n * or profits or other special, indirect and consequential damages, even if\n * Sun has been advised of the possibility of such damages.\n * \n * Sun Microsystems, Inc.\n * 2550 Garcia Avenue\n * Mountain View, California  94043\n *\n * $FreeBSD: release/9.0.0/include/rpcsvc/nis_db.h 93032 2002-03-23 17:24:55Z imp $\n */\n\n/*\n * Copyright (c) 1991, by Sun Microsystems Inc.\n */\n\n/*\n * This header file defines the interface to the NIS database. All\n * implementations of the database must export at least these routines.\n * They must also follow the conventions set herein. See the implementors\n * guide for specific semantics that are required.\n */\n\n#ifndef\t_RPCSVC_NIS_DB_H\n#define\t_RPCSVC_NIS_DB_H\n\n\n/* From: #pragma ident\t\"@(#)nis_db.h\t1.8\t94/05/03 SMI\" */\n\n/*\n * Note: although the version of <rpcsvc/nis_db.h> shipped with Solaris\n * 2.5/2.5.x is actually older than this one (according to the ident\n * string), it contains changes and a few added functions. Those changes\n * have been hand merged into this file to bring it up to date.\n */\n\n#include <rpc/rpc.h>\n#include <rpcsvc/nis.h>\n\n#ifdef\t__cplusplus\nextern \"C\" {\n#endif\n\nenum db_status {\n\tDB_SUCCESS = 0,\n\tDB_NOTFOUND = 1,\n\tDB_NOTUNIQUE = 2,\n\tDB_BADTABLE = 3,\n\tDB_BADQUERY = 4,\n\tDB_BADOBJECT = 5,\n\tDB_MEMORY_LIMIT = 6,\n\tDB_STORAGE_LIMIT = 7,\n\tDB_INTERNAL_ERROR = 8\n};\ntypedef enum db_status db_status;\n\nenum db_action {\n\tDB_LOOKUP = 0,\n\tDB_REMOVE = 1,\n\tDB_ADD = 2,\n\tDB_FIRST = 3,\n\tDB_NEXT = 4,\n\tDB_ALL = 5,\n\tDB_RESET_NEXT = 6\n};\ntypedef enum db_action db_action;\n\ntypedef entry_obj *entry_object_p;\n\ntypedef struct {\n\tu_int db_next_desc_len;\n\tchar *db_next_desc_val;\n} db_next_desc;\n\nstruct db_result {\n\tdb_status status;\n\tdb_next_desc nextinfo;\n\tstruct {\n\t\tu_int objects_len;\n\t\tentry_object_p *objects_val;\n\t} objects;\n\tlong ticks;\n};\ntypedef struct db_result db_result;\n\n/*\n * Prototypes for the database functions.\n */\n\nextern bool_t db_initialize(char *);\n#ifdef ORIGINAL_DECLS\nextern bool_t db_create_table(char *, table_obj *);\nextern bool_t db_destroy_table(char *);\n#else\nextern db_status db_create_table(char *, table_obj *);\nextern db_status db_destroy_table(char *);\n#endif\nextern db_result *db_first_entry(char *, int, nis_attr *);\nextern db_result *db_next_entry(char *, db_next_desc *);\nextern db_result *db_reset_next_entry(char *, db_next_desc *);\nextern db_result *db_list_entries(char *, int, nis_attr *);\nextern db_result *db_add_entry(char *, int,  nis_attr *, entry_obj *);\nextern db_result *db_remove_entry(char *, int, nis_attr *);\nextern db_status db_checkpoint(char *);\nextern db_status db_standby(char *);\n#ifndef ORIGINAL_DECLS\nextern db_status db_table_exists(char *);\nextern db_status db_unload_table(char *);\nextern void db_free_result(db_result *);\n#endif\n\n#ifdef __cplusplus\n}\n#endif\n\n#endif\t/* _RPCSVC_NIS_DB_H */\n"
  },
  {
    "path": "freebsd-headers/rpcsvc/nis_object.x",
    "content": "%/*\n% * Sun RPC is a product of Sun Microsystems, Inc. and is provided for\n% * unrestricted use provided that this legend is included on all tape\n% * media and as a part of the software program in whole or part.  Users\n% * may copy or modify Sun RPC without charge, but are not authorized\n% * to license or distribute it to anyone else except as part of a product or\n% * program developed by the user or with the express written consent of\n% * Sun Microsystems, Inc.\n% *\n% * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE\n% * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR\n% * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.\n% *\n% * Sun RPC is provided with no support and without any obligation on the\n% * part of Sun Microsystems, Inc. to assist in its use, correction,\n% * modification or enhancement.\n% *\n% * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE\n% * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC\n% * OR ANY PART THEREOF.\n% *\n% * In no event will Sun Microsystems, Inc. be liable for any lost revenue\n% * or profits or other special, indirect and consequential damages, even if\n% * Sun has been advised of the possibility of such damages.\n% *\n% * Sun Microsystems, Inc.\n% * 2550 Garcia Avenue\n% * Mountain View, California  94043\n% */\n\n/*\n *\tnis_object.x\n *\n *\tCopyright (c) 1988-1992 Sun Microsystems Inc\n *\tAll Rights Reserved.\n */\n\n/* From: %#pragma ident\t\"@(#)nis_object.x\t1.10\t94/05/03 SMI\" */\n\n#if RPC_HDR\n%\n%#ifndef __nis_object_h\n%#define __nis_object_h\n%\n#endif\n/* \n * \tThis file defines the format for a NIS object in RPC language.\n * It is included by the main .x file and the database access protocol\n * file. It is common because both of them need to deal with the same\n * type of object. Generating the actual code though is a bit messy because\n * the nis.x file and the nis_dba.x file will generate xdr routines to \n * encode/decode objects when only one set is needed. Such is life when\n * one is using rpcgen.\n *\n * Note, the protocol doesn't specify any limits on such things as\n * maximum name length, number of attributes, etc. These are enforced\n * by the database backend. When you hit them you will no. Also see\n * the db_getlimits() function for fetching the limit values.\n *\n */\n\n/* Some manifest constants, chosen to maximize flexibility without\n * plugging the wire full of data.\n */\nconst NIS_MAXSTRINGLEN = 255;\nconst NIS_MAXNAMELEN   = 1024;\nconst NIS_MAXATTRNAME  = 32;\nconst NIS_MAXATTRVAL   = 2048;\nconst NIS_MAXCOLUMNS   = 64;\nconst NIS_MAXATTR      = 16;\nconst NIS_MAXPATH      = 1024;\nconst NIS_MAXREPLICAS  = 128;\nconst NIS_MAXLINKS     = 16;\n\nconst NIS_PK_NONE      = 0;\t/* no public key (unix/sys auth) */\nconst NIS_PK_DH\t       = 1;\t/* Public key is Diffie-Hellman type */\nconst NIS_PK_RSA       = 2;\t/* Public key if RSA type */\nconst NIS_PK_KERB      = 3;\t/* Use kerberos style authentication */\n\n/*\n * The fundamental name type of NIS. The name may consist of two parts,\n * the first being the fully qualified name, and the second being an \n * optional set of attribute/value pairs.\n */\nstruct nis_attr {\n\tstring\tzattr_ndx<>;\t/* name of the index \t\t*/\n\topaque\tzattr_val<>;\t/* Value for the attribute. \t*/\n};\n\ntypedef string nis_name<>;\t/* The NIS name itself. */\n\n/* NIS object types are defined by the following enumeration. The numbers\n * they use are based on the following scheme :\n *\t\t     0 - 1023 are reserved for Sun,\n * \t\t1024 - 2047 are defined to be private to a particular tree.\n *\t\t2048 - 4095 are defined to be user defined.\n *\t\t4096 - ...  are reserved for future use.\n */\n\nenum zotypes {\n\tBOGUS_OBJ  \t= 0,\t/* Uninitialized object structure \t*/\n\tNO_OBJ   \t= 1,\t/* NULL object (no data)\t \t*/\n\tDIRECTORY_OBJ \t= 2,\t/* Directory object describing domain \t*/\n\tGROUP_OBJ  \t= 3,\t/* Group object (a list of names) \t*/\n\tTABLE_OBJ  \t= 4,\t/* Table object (a database schema) \t*/\n\tENTRY_OBJ  \t= 5,\t/* Entry object (a database record) \t*/\n\tLINK_OBJ   \t= 6, \t/* A name link.\t\t\t\t*/\n\tPRIVATE_OBJ   \t= 7 \t/* Private object (all opaque data) \t*/\n};\n\n/*\n * The types of Name services NIS knows about. They are enumerated\n * here. The Binder code will use this type to determine if it has\n * a set of library routines that will access the indicated name service.\n */\nenum nstype {\n\tUNKNOWN = 0,\n\tNIS = 1,\t/* Nis Plus Service\t\t*/\n\tSUNYP = 2,\t/* Old NIS Service\t\t*/\n\tIVY = 3,\t/* Nis Plus Plus Service\t*/\n\tDNS = 4,\t/* Domain Name Service\t\t*/\n\tX500 = 5,\t/* ISO/CCCIT X.500 Service\t*/\n\tDNANS = 6,\t/* Digital DECNet Name Service\t*/\n\tXCHS = 7,\t/* Xerox ClearingHouse Service\t*/\n\tCDS= 8\n};\n\n/*\n * DIRECTORY - The name service object. These objects identify other name\n * servers that are serving some portion of the name space. Each has a\n * type associated with it. The resolver library will note whether or not\n * is has the needed routines to access that type of service. \n * The oarmask structure defines an access rights mask on a per object \n * type basis for the name spaces. The only bits currently used are \n * create and destroy. By enabling or disabling these access rights for\n * a specific object type for a one of the accessor entities (owner,\n * group, world) the administrator can control what types of objects \n * may be freely added to the name space and which require the \n * administrator's approval.\n */\nstruct oar_mask {\n\tu_long\toa_rights;\t/* Access rights mask \t*/\n\tzotypes\toa_otype;\t/* Object type \t\t*/\n};\n\nstruct endpoint {\n\tstring\t\tuaddr<>;\n\tstring\t\tfamily<>;   /* Transport family (INET, OSI, etc) */\n\tstring\t\tproto<>;    /* Protocol (TCP, UDP, CLNP,  etc)   */\n};\n\n/*\n * Note: pkey is a netobj which is limited to 1024 bytes which limits the\n * keysize to 8192 bits. This is consider to be a reasonable limit for\n * the expected lifetime of this service.\n */\nstruct nis_server {\n\tnis_name\tname; \t \t/* Principal name of the server  */\n\tendpoint\tep<>;  \t\t/* Universal addr(s) for server  */\n\tu_long\t\tkey_type;\t/* Public key type\t\t */\n\tnetobj\t\tpkey;\t\t/* server's public key  \t */\n};\n\nstruct directory_obj {\n\tnis_name   do_name;\t /* Name of the directory being served   */\n\tnstype\t   do_type;\t /* one of NIS, DNS, IVY, YP, or X.500 \t */\n\tnis_server do_servers<>; /* <0> == Primary name server     \t */\n\tu_long\t   do_ttl;\t /* Time To Live (for caches) \t\t */\n\toar_mask   do_armask<>;  /* Create/Destroy rights by object type */\n};\n\n/* \n * ENTRY - This is one row of data from an information base. \n * The type value is used by the client library to convert the entry to \n * it's internal structure representation. The Table name is a back pointer\n * to the table where the entry is stored. This allows the client library \n * to determine where to send a request if the client wishes to change this\n * entry but got to it through a LINK rather than directly.\n * If the entry is a \"standalone\" entry then this field is void.\n */\nconst EN_BINARY   = 1;\t/* Indicates value is binary data \t*/\nconst EN_CRYPT    = 2;\t/* Indicates the value is encrypted\t*/\nconst EN_XDR      = 4;\t/* Indicates the value is XDR encoded\t*/\nconst EN_MODIFIED = 8;\t/* Indicates entry is modified. \t*/\nconst EN_ASN1     = 64;\t/* Means contents use ASN.1 encoding    */\n\nstruct entry_col {\n\tu_long\tec_flags;\t/* Flags for this value */\n\topaque\tec_value<>;\t/* It's textual value\t*/\n};\n\nstruct entry_obj {\n\tstring \ten_type<>;\t/* Type of entry such as \"passwd\" */\n\tentry_col en_cols<>;\t/* Value for the entry\t\t  */\n};\n\n/*\n * GROUP - The group object contains a list of NIS principal names. Groups\n * are used to authorize principals. Each object has a set of access rights\n * for members of its group. Principal names in groups are in the form \n * name.directory and recursive groups are expressed as @groupname.directory\n */\nstruct group_obj {\n\tu_long\t\tgr_flags;\t/* Flags controlling group\t*/\n\tnis_name\tgr_members<>;  \t/* List of names in group \t*/\n};\n\n/*\n * LINK - This is the LINK object. It is quite similar to a symbolic link\n * in the UNIX filesystem. The attributes in the main object structure are\n * relative to the LINK data and not what it points to (like the file system)\n * \"modify\" privleges here indicate the right to modify what the link points\n * at and not to modify that actual object pointed to by the link.\n */\nstruct link_obj {\n\tzotypes\t li_rtype;\t/* Real type of the object\t*/\n\tnis_attr li_attrs<>;\t/* Attribute/Values for tables\t*/\n\tnis_name li_name; \t/* The object's real NIS name\t*/\n};\n\n/*\n * TABLE - This is the table object. It implements a simple \n * data base that applications and use for configuration or \n * administration purposes. The role of the table is to group together\n * a set of related entries. Tables are the simple database component\n * of NIS. Like many databases, tables are logically divided into columns\n * and rows. The columns are labeled with indexes and each ENTRY makes\n * up a row. Rows may be addressed within the table by selecting one\n * or more indexes, and values for those indexes. Each row which has\n * a value for the given index that matches the desired value is returned.\n * Within the definition of each column there is a flags variable, this\n * variable contains flags which determine whether or not the column is\n * searchable, contains binary data, and access rights for the entry objects\n * column value. \n */\n\nconst TA_BINARY     = 1;\t/* Means table data is binary \t\t*/\nconst TA_CRYPT      = 2;\t/* Means value should be encrypted \t*/\nconst TA_XDR        = 4;\t/* Means value is XDR encoded\t\t*/\nconst TA_SEARCHABLE = 8;\t/* Means this column is searchable\t*/\nconst TA_CASE       = 16;\t/* Means this column is Case Sensitive\t*/\nconst TA_MODIFIED   = 32;\t/* Means this columns attrs are modified*/\nconst TA_ASN1       = 64;\t/* Means contents use ASN.1 encoding     */\n\nstruct table_col {\n\tstring\ttc_name<64>;\t/* Column Name \t \t   */\n\tu_long\ttc_flags;\t/* control flags\t   */\n\tu_long\ttc_rights;\t/* Access rights mask\t   */\n};\n\nstruct table_obj {\n\tstring \t  ta_type<64>;\t /* Table type such as \"passwd\"\t*/\n\tint\t  ta_maxcol;\t /* Total number of columns\t*/\n\tu_char\t  ta_sep;\t /* Separator character \t*/\n\ttable_col ta_cols<>; \t /* The number of table indexes */\n\tstring\t  ta_path<>;\t /* A search path for this table */\n};\n\n/*\n * This union joins together all of the currently known objects. \n */\nunion objdata switch (zotypes zo_type) {\n        case DIRECTORY_OBJ :\n                struct directory_obj di_data;\n        case GROUP_OBJ :\n                struct group_obj gr_data;\n        case TABLE_OBJ :\n                struct table_obj ta_data;\n        case ENTRY_OBJ:\n                struct entry_obj en_data;\n        case LINK_OBJ :\n                struct link_obj li_data;\n        case PRIVATE_OBJ :\n                opaque\tpo_data<>;\n\tcase NO_OBJ :\n\t\tvoid;\n        case BOGUS_OBJ :\n\t\tvoid;\n        default :\n                void;\n};\n\n/*\n * This is the basic NIS object data type. It consists of a generic part\n * which all objects contain, and a specialized part which varies depending\n * on the type of the object. All of the specialized sections have been\n * described above. You might have wondered why they all start with an \n * integer size, followed by the useful data. The answer is, when the \n * server doesn't recognize the type returned it treats it as opaque data. \n * And the definition for opaque data is {int size; char *data;}. In this\n * way, servers and utility routines that do not understand a given type\n * may still pass it around. One has to be careful in setting\n * this variable accurately, it must take into account such things as\n * XDR padding of structures etc. The best way to set it is to note one's\n * position in the XDR encoding stream, encode the structure, look at the\n * new position and calculate the size. \n */\nstruct nis_oid {\n\tu_long\tctime;\t\t/* Time of objects creation \t*/\n\tu_long\tmtime;\t\t/* Time of objects modification */\n};\n\nstruct nis_object {\n\tnis_oid\t zo_oid;\t/* object identity verifier.\t\t*/ \n\tnis_name zo_name;\t/* The NIS name for this object\t\t*/\n\tnis_name zo_owner;\t/* NIS name of object owner.\t\t*/\n\tnis_name zo_group;\t/* NIS name of access group.\t\t*/\n\tnis_name zo_domain;\t/* The administrator for the object\t*/\n\tu_long\t zo_access;\t/* Access rights (owner, group, world)\t*/\n\tu_long\t zo_ttl;\t/* Object's time to live in seconds.\t*/\n\tobjdata\t zo_data;\t/* Data structure for this type \t*/\n};\n#if RPC_HDR\n%\n%#endif /* if __nis_object_h */\n%\n#endif\n"
  },
  {
    "path": "freebsd-headers/rpcsvc/nis_tags.h",
    "content": "/*\n * Sun RPC is a product of Sun Microsystems, Inc. and is provided for\n * unrestricted use provided that this legend is included on all tape\n * media and as a part of the software program in whole or part.  Users\n * may copy or modify Sun RPC without charge, but are not authorized\n * to license or distribute it to anyone else except as part of a product or\n * program developed by the user.\n * \n * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE\n * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR\n * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.\n * \n * Sun RPC is provided with no support and without any obligation on the\n * part of Sun Microsystems, Inc. to assist in its use, correction,\n * modification or enhancement.\n * \n * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE\n * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC\n * OR ANY PART THEREOF.\n * \n * In no event will Sun Microsystems, Inc. be liable for any lost revenue\n * or profits or other special, indirect and consequential damages, even if\n * Sun has been advised of the possibility of such damages.\n * \n * Sun Microsystems, Inc.\n * 2550 Garcia Avenue\n * Mountain View, California  94043\n */\n\n/*\n * Copyright (c) 1991, Sun Microsystems Inc.\n */\n\n/*\n *\tnis_tags.h\n *\n *\tThis file contains the tags and statistics definitions. It is\n *\tautomatically included by nis.h\n */\n\n#ifndef\t_RPCSVC_NIS_TAGS_H\n#define\t_RPCSVC_NIS_TAGS_H\n\n/* From: #pragma ident\t\"@(#)nis_tags.h\t1.10\t94/05/03 SMI\" */\n/* from file: zns_tags.h\t1.7 Copyright (c) 1990 Sun Microsystems */\n\n#ifdef\t__cplusplus\nextern \"C\" {\n#endif\n\n#ifndef ORIGINAL_DECLS\n#define\t\tNIS_DIR \"data\"\n#endif\n\n/* Lookup and List function flags */\n#define\tFOLLOW_LINKS\t(1<<0)\t/* Follow link objects \t\t\t*/\n#define\tFOLLOW_PATH\t(1<<1)\t/* Follow the path in a table \t\t*/\n#define\tHARD_LOOKUP\t(1<<2)\t/* Block until successful \t\t*/\n#define\tALL_RESULTS\t(1<<3)\t/* Retrieve all results \t\t*/\n#define\tNO_CACHE\t(1<<4)\t/* Do not return 'cached' results \t*/\n#define\tMASTER_ONLY\t(1<<5)\t/* Get value only from master server\t*/\n#define\tEXPAND_NAME\t(1<<6)\t/* Expand partitially qualified names\t*/\n\n/* Semantic modification for table operations flags */\n#define\tRETURN_RESULT\t(1<<7)\t/* Return resulting object to client    */\n#define\tADD_OVERWRITE\t(1<<8)\t/* Allow overwrites on ADD\t\t*/\n#define\tREM_MULTIPLE\t(1<<9)\t/* Allow wildcard deletes\t\t*/\n#define\tMOD_SAMEOBJ\t(1<<10)\t/* Check modified object before write\t*/\n#define\tADD_RESERVED\t(1<<11)\t/* Spare ADD semantic\t\t\t*/\n#define\tREM_RESERVED\t(1<<12)\t/* Spare REM semantic\t\t\t*/\n#ifdef ORIGINAL_DECLS\n#define\tMOD_RESERVED\t(1<<13)\t/* Spare MOD semantic\t\t\t*/\n#else\n#define\tMOD_EXCLUSIVE\t(1<<13)\t/* Modify no overwrite on modified keys\t*/\n#endif\n\n/* Transport specific modifications to the operation */\n#define\tUSE_DGRAM\t(1<<16) /* Use a datagram transport \t\t*/\n#define\tNO_AUTHINFO\t(1<<17) /* Don't bother attaching auth info\t*/\n\n/*\n * Declarations for \"standard\" NIS+ tags\n * State variable tags have values\t0 - 2047\n * Statistic tags have values\t\t2048 - 65535\n * User Tags have values\t\t>2^16\n */\n#define\tTAG_DEBUG\t1\t/* set debug level \t\t*/\n#define\tTAG_STATS\t2\t/* Enable/disable statistics \t*/\n#define\tTAG_GCACHE\t3\t/* Flush the Group Cache\t*/\n#ifndef ORIGINAL_DECLS\n#define\tTAG_GCACHE_ALL\tTAG_GCACHE\n#endif\n#define\tTAG_DCACHE\t4\t/* Flush the directory cache\t*/\n#ifndef ORIGINAL_DECLS\n#define\tTAG_DCACHE_ONE\tTAG_DCACHE\n#endif\n#define\tTAG_OCACHE\t5\t/* Flush the Object Cache\t*/\n#define\tTAG_SECURE\t6\t/* Set the security level \t*/\n#ifndef ORIGINAL_DECLS\n#define\tTAG_TCACHE_ONE\t7\t/* Flush the table cache\t*/\n#define\tTAG_DCACHE_ALL\t8\t/* Flush entire directory cache */\n#define TAG_TCACHE_ALL\t9\t/* Flush entire table cache\t*/\n#define\tTAG_GCACHE_ONE\t10\t/* Flush one group object\t*/\n#define\tTAG_DCACHE_ONE_REFRESH 11 /* Flush and refresh one DO\t*/\n#endif\n\n#define\tTAG_OPSTATS\t2048\t/* NIS+ operations statistics   */\n#define\tTAG_THREADS\t2049\t/* Child process/thread status  */\n#define\tTAG_HEAP\t2050\t/* Heap usage statistics\t*/\n#define\tTAG_UPDATES\t2051\t/* Updates to this service\t*/\n#define\tTAG_VISIBLE\t2052\t/* First update that isn't replicated */\n#define\tTAG_S_DCACHE\t2053\t/* Directory cache statistics\t*/\n#define\tTAG_S_OCACHE\t2054\t/* Object cache statistics\t*/\n#define\tTAG_S_GCACHE\t2055\t/* Group cache statistics\t*/\n#define\tTAG_S_STORAGE\t2056\t/* Group cache statistics\t*/\n#define\tTAG_UPTIME\t2057\t/* Time that server has been up */\n#ifndef ORIGINAL_DECLS\n#define\tTAG_DIRLIST\t2058    /* Dir served by this server\t*/\n#define\tTAG_NISCOMPAT\t2059    /* Whether supports NIS compat mode */\n#define\tTAG_DNSFORWARDING 2060\t/* Whether DNS forwarding supported*/\n#define\tTAG_SECURITY_LEVEL 2061 /* Security level of the server */\n#define\tTAG_ROOTSERVER\t2062\t/* Whether root server\t\t*/\n#endif\n\n/*\n * Declarations for the Group object flags. Currently\n * there are only 3.\n */\n#define\tIMPMEM_GROUPS  1\t/* Implicit Membership allowed \t*/\n#define\tRECURS_GROUPS  2\t/* Recursive Groups allowed \t*/\n#define\tNEGMEM_GROUPS  4\t/* Negative Groups allowed\t*/\n\n#ifdef\t__cplusplus\n}\n#endif\n\n#endif\t/* _RPCSVC_NIS_TAGS_H */\n"
  },
  {
    "path": "freebsd-headers/rpcsvc/nislib.h",
    "content": "/*\n * Sun RPC is a product of Sun Microsystems, Inc. and is provided for\n * unrestricted use provided that this legend is included on all tape\n * media and as a part of the software program in whole or part.  Users\n * may copy or modify Sun RPC without charge, but are not authorized\n * to license or distribute it to anyone else except as part of a product or\n * program developed by the user.\n * \n * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE\n * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR\n * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.\n * \n * Sun RPC is provided with no support and without any obligation on the\n * part of Sun Microsystems, Inc. to assist in its use, correction,\n * modification or enhancement.\n * \n * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE\n * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC\n * OR ANY PART THEREOF.\n * \n * In no event will Sun Microsystems, Inc. be liable for any lost revenue\n * or profits or other special, indirect and consequential damages, even if\n * Sun has been advised of the possibility of such damages.\n * \n * Sun Microsystems, Inc.\n * 2550 Garcia Avenue\n * Mountain View, California  94043\n *\n * $FreeBSD: release/9.0.0/include/rpcsvc/nislib.h 93032 2002-03-23 17:24:55Z imp $\n */\n\n/*\n * Copyright (c) 1991, Sun Microsystems Inc.\n */\n\n/*\n * This file contains the interfaces that are visible in the SunOS 5.x\n * implementation of NIS Plus.\n */\n\n#ifndef\t_RPCSVC_NISLIB_H\n#define\t_RPCSVC_NISLIB_H\n\n/* From: #pragma ident\t\"@(#)nislib.h\t1.16\t94/05/03 SMI\" */\n\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\nstruct signature {\n\tint signature_len;\n\tchar *signature_val;\n};\n\nextern void nis_freeresult(nis_result *);\nextern nis_result * nis_lookup(nis_name, u_long);\nextern nis_result * nis_list(nis_name, u_long,\n\tint (*)(nis_name, nis_object *, void *), void *);\nextern nis_result * nis_add(nis_name, nis_object *);\nextern nis_result * nis_remove(nis_name, nis_object *);\nextern nis_result * nis_modify(nis_name, nis_object *);\n\nextern nis_result * nis_add_entry(nis_name, nis_object *, u_long);\nextern nis_result * nis_remove_entry(nis_name, nis_object *, u_long);\nextern nis_result * nis_modify_entry(nis_name, nis_object *, u_long);\nextern nis_result * nis_first_entry(nis_name);\nextern nis_result * nis_next_entry(nis_name, netobj *);\n\nextern nis_error nis_mkdir(nis_name, nis_server *);\nextern nis_error nis_rmdir(nis_name, nis_server *);\nextern name_pos nis_dir_cmp(nis_name, nis_name);\n\nextern nis_name * nis_getnames(nis_name);\nextern void nis_freenames(nis_name *);\nextern nis_name nis_domain_of(nis_name);\nextern nis_name nis_leaf_of(nis_name);\nextern nis_name nis_leaf_of_r(const nis_name, char *, size_t);\nextern nis_name nis_name_of(nis_name);\nextern nis_name nis_local_group(void);\nextern nis_name nis_local_directory(void);\nextern nis_name nis_local_principal(void);\nextern nis_name nis_local_host(void);\n\nextern void nis_destroy_object(nis_object *);\nextern nis_object * nis_clone_object(nis_object *, nis_object *);\nextern void nis_print_object(nis_object *);\n\nextern char * nis_sperrno(nis_error);\nextern void nis_perror(nis_error, char *);\nextern char * nis_sperror(nis_error, char *);\nextern void nis_lerror(nis_error, char *);\n\nextern void nis_print_group_entry(nis_name);\nextern bool_t nis_ismember(nis_name, nis_name);\nextern nis_error nis_creategroup(nis_name, u_long);\nextern nis_error nis_destroygroup(nis_name);\nextern nis_error nis_addmember(nis_name, nis_name);\nextern nis_error nis_removemember(nis_name, nis_name);\nextern nis_error nis_verifygroup(nis_name);\n\nextern void nis_freeservlist(nis_server **);\nextern nis_server ** nis_getservlist(nis_name);\nextern nis_error nis_stats(nis_server *, nis_tag *, int, nis_tag **);\nextern nis_error nis_servstate(nis_server *, nis_tag *, int, nis_tag **);\nextern void nis_freetags(nis_tag *, int);\n\nextern nis_result * nis_checkpoint(nis_name);\nextern void nis_ping(nis_name, u_long, nis_object *);\n\n/*\n * XXX: PLEASE NOTE THAT THE FOLLOWING FUNCTIONS ARE INTERNAL\n * TO NIS+ AND SHOULD NOT BE USED BY ANY APPLICATION PROGRAM.\n * THEIR SEMANTICS AND/OR SIGNATURE CAN CHANGE WITHOUT NOTICE.\n * SO, PLEASE DO NOT USE THEM.  YOU ARE WARNED!!!!\n */\n\nextern char ** __break_name(nis_name, int *);\nextern int __name_distance(char **, char **);\nextern nis_result * nis_make_error(nis_error, u_long, u_long, u_long, u_long);\nextern nis_attr * __cvt2attr(int *, char **);\nextern void nis_free_request(ib_request *);\nextern nis_error nis_get_request(nis_name, nis_object *, netobj*, ib_request*);\nextern nis_object * nis_read_obj(char *);\nextern int nis_write_obj(char *, nis_object *);\nextern int nis_in_table(nis_name, NIS_HASH_TABLE *, int *);\nextern int nis_insert_item(NIS_HASH_ITEM *, NIS_HASH_TABLE *);\nextern NIS_HASH_ITEM * nis_find_item(nis_name, NIS_HASH_TABLE *);\nextern NIS_HASH_ITEM * nis_remove_item(nis_name, NIS_HASH_TABLE *);\nextern void nis_insert_name(nis_name, NIS_HASH_TABLE *);\nextern void nis_remove_name(nis_name, NIS_HASH_TABLE *);\nextern CLIENT * nis_make_rpchandle(nis_server *, int, u_long, u_long, u_long,\n\t\t\t\t\t\t\t\tint, int);\nextern void * nis_get_static_storage(struct nis_sdata *, u_long, u_long);\nextern char * nis_data(char *);\nextern void nis_print_rights(u_long);\nextern void nis_print_directory(directory_obj *);\nextern void nis_print_group(group_obj *);\nextern void nis_print_table(table_obj *);\nextern void nis_print_link(link_obj *);\nextern void nis_print_entry(entry_obj *);\nextern nis_object * nis_get_object(char *, char *, char *, u_long, u_long,\n\t\t\t\t\t\t\t\t    zotypes);\nextern nis_server * __nis_init_callback(CLIENT *,\n    int (*)(nis_name, nis_object *, void *), void *);\nextern int nis_getdtblsize(void);\nextern int __nis_run_callback(netobj *, u_long, struct timeval *, CLIENT *);\n\nextern log_result *nis_dumplog(nis_server *, nis_name, u_long);\nextern log_result *nis_dump(nis_server *, nis_name,\n    int (*)(nis_name, nis_object *, void *));\n\nextern bool_t __do_ismember(nis_name, nis_name,\n    nis_result *(*)(nis_name, u_long));\nextern nis_name __nis_map_group(nis_name);\nextern nis_name __nis_map_group_r(nis_name, char*, size_t);\n\nextern nis_error __nis_CacheBind(char *, directory_obj *);\nextern nis_error __nis_CacheSearch(char *, directory_obj *);\nextern bool_t __nis_CacheRemoveEntry(directory_obj *);\nextern void __nis_CacheRestart(void);\nextern void __nis_CachePrint(void);\nextern void __nis_CacheDumpStatistics(void);\nextern bool_t writeColdStartFile(directory_obj *);\n\nextern CLIENT * __get_ti_clnt(char *, CLIENT *, char **, pid_t *);\nextern int __strcmp_case_insens(char *, char *);\nextern int __strncmp_case_insens(char *, char *);\n\nextern fd_result * nis_finddirectory(directory_obj *, nis_name);\nextern int __start_clock(int);\nextern u_long __stop_clock(int);\n\n/*\n * This particular function is part of the FreeBSD NIS+ implementation\n * only. Ideally it should be somewhere else, but it is used by both\n * rpc.nisd and nis_cachemgr, and there aren't that many headers common\n * to both programs.\n */\n\nextern struct signature *__nis_calculate_encrypted_cksum(unsigned char *, unsigned int, char *, int);\n\n#define\tNUL '\\0'\n\n#ifdef\t__cplusplus\n}\n#endif\n\n#endif\t/* _RPCSVC_NISLIB_H */\n"
  },
  {
    "path": "freebsd-headers/rpcsvc/nlm_prot.h",
    "content": "/*\n * Please do not edit this file.\n * It was generated using rpcgen.\n */\n\n#ifndef _NLM_PROT_H_RPCGEN\n#define\t_NLM_PROT_H_RPCGEN\n\n#include <rpc/rpc.h>\n\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\n#define LM_MAXSTRLEN 1024\n#define MAXNAMELEN LM_MAXSTRLEN+1\n\nenum nlm_stats {\n\tnlm_granted = 0,\n\tnlm_denied = 1,\n\tnlm_denied_nolocks = 2,\n\tnlm_blocked = 3,\n\tnlm_denied_grace_period = 4,\n\tnlm_deadlck = 5\n};\ntypedef enum nlm_stats nlm_stats;\n\nstruct nlm_holder {\n\tbool_t exclusive;\n\tint svid;\n\tnetobj oh;\n\tu_int l_offset;\n\tu_int l_len;\n};\ntypedef struct nlm_holder nlm_holder;\n\nstruct nlm_testrply {\n\tnlm_stats stat;\n\tunion {\n\t\tstruct nlm_holder holder;\n\t} nlm_testrply_u;\n};\ntypedef struct nlm_testrply nlm_testrply;\n\nstruct nlm_stat {\n\tnlm_stats stat;\n};\ntypedef struct nlm_stat nlm_stat;\n\nstruct nlm_res {\n\tnetobj cookie;\n\tnlm_stat stat;\n};\ntypedef struct nlm_res nlm_res;\n\nstruct nlm_testres {\n\tnetobj cookie;\n\tnlm_testrply stat;\n};\ntypedef struct nlm_testres nlm_testres;\n\nstruct nlm_lock {\n\tchar *caller_name;\n\tnetobj fh;\n\tnetobj oh;\n\tint svid;\n\tu_int l_offset;\n\tu_int l_len;\n};\ntypedef struct nlm_lock nlm_lock;\n\nstruct nlm_lockargs {\n\tnetobj cookie;\n\tbool_t block;\n\tbool_t exclusive;\n\tstruct nlm_lock alock;\n\tbool_t reclaim;\n\tint state;\n};\ntypedef struct nlm_lockargs nlm_lockargs;\n\nstruct nlm_cancargs {\n\tnetobj cookie;\n\tbool_t block;\n\tbool_t exclusive;\n\tstruct nlm_lock alock;\n};\ntypedef struct nlm_cancargs nlm_cancargs;\n\nstruct nlm_testargs {\n\tnetobj cookie;\n\tbool_t exclusive;\n\tstruct nlm_lock alock;\n};\ntypedef struct nlm_testargs nlm_testargs;\n\nstruct nlm_unlockargs {\n\tnetobj cookie;\n\tstruct nlm_lock alock;\n};\ntypedef struct nlm_unlockargs nlm_unlockargs;\n/*\n * The following enums are actually bit encoded for efficient\n * boolean algebra.... DON'T change them.....\n */\n\nenum fsh_mode {\n\tfsm_DN = 0,\n\tfsm_DR = 1,\n\tfsm_DW = 2,\n\tfsm_DRW = 3\n};\ntypedef enum fsh_mode fsh_mode;\n\nenum fsh_access {\n\tfsa_NONE = 0,\n\tfsa_R = 1,\n\tfsa_W = 2,\n\tfsa_RW = 3\n};\ntypedef enum fsh_access fsh_access;\n\nstruct nlm_share {\n\tchar *caller_name;\n\tnetobj fh;\n\tnetobj oh;\n\tfsh_mode mode;\n\tfsh_access access;\n};\ntypedef struct nlm_share nlm_share;\n\nstruct nlm_shareargs {\n\tnetobj cookie;\n\tnlm_share share;\n\tbool_t reclaim;\n};\ntypedef struct nlm_shareargs nlm_shareargs;\n\nstruct nlm_shareres {\n\tnetobj cookie;\n\tnlm_stats stat;\n\tint sequence;\n};\ntypedef struct nlm_shareres nlm_shareres;\n\nstruct nlm_notify {\n\tchar *name;\n\tlong state;\n};\ntypedef struct nlm_notify nlm_notify;\n/* definitions for NLM version 4 */\n\nenum nlm4_stats {\n\tnlm4_granted = 0,\n\tnlm4_denied = 1,\n\tnlm4_denied_nolocks = 2,\n\tnlm4_blocked = 3,\n\tnlm4_denied_grace_period = 4,\n\tnlm4_deadlck = 5,\n\tnlm4_rofs = 6,\n\tnlm4_stale_fh = 7,\n\tnlm4_fbig = 8,\n\tnlm4_failed = 9\n};\ntypedef enum nlm4_stats nlm4_stats;\n\nstruct nlm4_stat {\n\tnlm4_stats stat;\n};\ntypedef struct nlm4_stat nlm4_stat;\n\nstruct nlm4_holder {\n\tbool_t exclusive;\n\tu_int32_t svid;\n\tnetobj oh;\n\tu_int64_t l_offset;\n\tu_int64_t l_len;\n};\ntypedef struct nlm4_holder nlm4_holder;\n\nstruct nlm4_lock {\n\tchar *caller_name;\n\tnetobj fh;\n\tnetobj oh;\n\tu_int32_t svid;\n\tu_int64_t l_offset;\n\tu_int64_t l_len;\n};\ntypedef struct nlm4_lock nlm4_lock;\n\nstruct nlm4_share {\n\tchar *caller_name;\n\tnetobj fh;\n\tnetobj oh;\n\tfsh_mode mode;\n\tfsh_access access;\n};\ntypedef struct nlm4_share nlm4_share;\n\nstruct nlm4_testrply {\n\tnlm4_stats stat;\n\tunion {\n\t\tstruct nlm4_holder holder;\n\t} nlm4_testrply_u;\n};\ntypedef struct nlm4_testrply nlm4_testrply;\n\nstruct nlm4_testres {\n\tnetobj cookie;\n\tnlm4_testrply stat;\n};\ntypedef struct nlm4_testres nlm4_testres;\n\nstruct nlm4_testargs {\n\tnetobj cookie;\n\tbool_t exclusive;\n\tstruct nlm4_lock alock;\n};\ntypedef struct nlm4_testargs nlm4_testargs;\n\nstruct nlm4_res {\n\tnetobj cookie;\n\tnlm4_stat stat;\n};\ntypedef struct nlm4_res nlm4_res;\n\nstruct nlm4_lockargs {\n\tnetobj cookie;\n\tbool_t block;\n\tbool_t exclusive;\n\tstruct nlm4_lock alock;\n\tbool_t reclaim;\n\tint state;\n};\ntypedef struct nlm4_lockargs nlm4_lockargs;\n\nstruct nlm4_cancargs {\n\tnetobj cookie;\n\tbool_t block;\n\tbool_t exclusive;\n\tstruct nlm4_lock alock;\n};\ntypedef struct nlm4_cancargs nlm4_cancargs;\n\nstruct nlm4_unlockargs {\n\tnetobj cookie;\n\tstruct nlm4_lock alock;\n};\ntypedef struct nlm4_unlockargs nlm4_unlockargs;\n\nstruct nlm4_shareargs {\n\tnetobj cookie;\n\tnlm4_share share;\n\tbool_t reclaim;\n};\ntypedef struct nlm4_shareargs nlm4_shareargs;\n\nstruct nlm4_shareres {\n\tnetobj cookie;\n\tnlm4_stats stat;\n\tint sequence;\n};\ntypedef struct nlm4_shareres nlm4_shareres;\n\nstruct nlm_sm_status {\n\tchar *mon_name;\n\tint state;\n\tchar priv[16];\n};\ntypedef struct nlm_sm_status nlm_sm_status;\n\nstruct nlm4_notify {\n\tchar *name;\n\tint32_t state;\n};\ntypedef struct nlm4_notify nlm4_notify;\n\n#define\tNLM_PROG ((unsigned long)(100021))\n#define\tNLM_SM ((unsigned long)(0))\n\nextern  void nlm_prog_0(struct svc_req *rqstp, SVCXPRT *transp);\n#define\tNLM_SM_NOTIFY ((unsigned long)(1))\nextern  void * nlm_sm_notify_0(struct nlm_sm_status *, CLIENT *);\nextern  void * nlm_sm_notify_0_svc(struct nlm_sm_status *, struct svc_req *);\nextern int nlm_prog_0_freeresult(SVCXPRT *, xdrproc_t, caddr_t);\n#define\tNLM_VERS ((unsigned long)(1))\n\nextern  void nlm_prog_1(struct svc_req *rqstp, SVCXPRT *transp);\n#define\tNLM_TEST ((unsigned long)(1))\nextern  nlm_testres * nlm_test_1(struct nlm_testargs *, CLIENT *);\nextern  nlm_testres * nlm_test_1_svc(struct nlm_testargs *, struct svc_req *);\n#define\tNLM_LOCK ((unsigned long)(2))\nextern  nlm_res * nlm_lock_1(struct nlm_lockargs *, CLIENT *);\nextern  nlm_res * nlm_lock_1_svc(struct nlm_lockargs *, struct svc_req *);\n#define\tNLM_CANCEL ((unsigned long)(3))\nextern  nlm_res * nlm_cancel_1(struct nlm_cancargs *, CLIENT *);\nextern  nlm_res * nlm_cancel_1_svc(struct nlm_cancargs *, struct svc_req *);\n#define\tNLM_UNLOCK ((unsigned long)(4))\nextern  nlm_res * nlm_unlock_1(struct nlm_unlockargs *, CLIENT *);\nextern  nlm_res * nlm_unlock_1_svc(struct nlm_unlockargs *, struct svc_req *);\n#define\tNLM_GRANTED ((unsigned long)(5))\nextern  nlm_res * nlm_granted_1(struct nlm_testargs *, CLIENT *);\nextern  nlm_res * nlm_granted_1_svc(struct nlm_testargs *, struct svc_req *);\n#define\tNLM_TEST_MSG ((unsigned long)(6))\nextern  void * nlm_test_msg_1(struct nlm_testargs *, CLIENT *);\nextern  void * nlm_test_msg_1_svc(struct nlm_testargs *, struct svc_req *);\n#define\tNLM_LOCK_MSG ((unsigned long)(7))\nextern  void * nlm_lock_msg_1(struct nlm_lockargs *, CLIENT *);\nextern  void * nlm_lock_msg_1_svc(struct nlm_lockargs *, struct svc_req *);\n#define\tNLM_CANCEL_MSG ((unsigned long)(8))\nextern  void * nlm_cancel_msg_1(struct nlm_cancargs *, CLIENT *);\nextern  void * nlm_cancel_msg_1_svc(struct nlm_cancargs *, struct svc_req *);\n#define\tNLM_UNLOCK_MSG ((unsigned long)(9))\nextern  void * nlm_unlock_msg_1(struct nlm_unlockargs *, CLIENT *);\nextern  void * nlm_unlock_msg_1_svc(struct nlm_unlockargs *, struct svc_req *);\n#define\tNLM_GRANTED_MSG ((unsigned long)(10))\nextern  void * nlm_granted_msg_1(struct nlm_testargs *, CLIENT *);\nextern  void * nlm_granted_msg_1_svc(struct nlm_testargs *, struct svc_req *);\n#define\tNLM_TEST_RES ((unsigned long)(11))\nextern  void * nlm_test_res_1(nlm_testres *, CLIENT *);\nextern  void * nlm_test_res_1_svc(nlm_testres *, struct svc_req *);\n#define\tNLM_LOCK_RES ((unsigned long)(12))\nextern  void * nlm_lock_res_1(nlm_res *, CLIENT *);\nextern  void * nlm_lock_res_1_svc(nlm_res *, struct svc_req *);\n#define\tNLM_CANCEL_RES ((unsigned long)(13))\nextern  void * nlm_cancel_res_1(nlm_res *, CLIENT *);\nextern  void * nlm_cancel_res_1_svc(nlm_res *, struct svc_req *);\n#define\tNLM_UNLOCK_RES ((unsigned long)(14))\nextern  void * nlm_unlock_res_1(nlm_res *, CLIENT *);\nextern  void * nlm_unlock_res_1_svc(nlm_res *, struct svc_req *);\n#define\tNLM_GRANTED_RES ((unsigned long)(15))\nextern  void * nlm_granted_res_1(nlm_res *, CLIENT *);\nextern  void * nlm_granted_res_1_svc(nlm_res *, struct svc_req *);\nextern int nlm_prog_1_freeresult(SVCXPRT *, xdrproc_t, caddr_t);\n#define\tNLM_VERSX ((unsigned long)(3))\n\nextern  void nlm_prog_3(struct svc_req *rqstp, SVCXPRT *transp);\n#define\tNLM_SHARE ((unsigned long)(20))\nextern  nlm_shareres * nlm_share_3(nlm_shareargs *, CLIENT *);\nextern  nlm_shareres * nlm_share_3_svc(nlm_shareargs *, struct svc_req *);\n#define\tNLM_UNSHARE ((unsigned long)(21))\nextern  nlm_shareres * nlm_unshare_3(nlm_shareargs *, CLIENT *);\nextern  nlm_shareres * nlm_unshare_3_svc(nlm_shareargs *, struct svc_req *);\n#define\tNLM_NM_LOCK ((unsigned long)(22))\nextern  nlm_res * nlm_nm_lock_3(nlm_lockargs *, CLIENT *);\nextern  nlm_res * nlm_nm_lock_3_svc(nlm_lockargs *, struct svc_req *);\n#define\tNLM_FREE_ALL ((unsigned long)(23))\nextern  void * nlm_free_all_3(nlm_notify *, CLIENT *);\nextern  void * nlm_free_all_3_svc(nlm_notify *, struct svc_req *);\nextern int nlm_prog_3_freeresult(SVCXPRT *, xdrproc_t, caddr_t);\n#define\tNLM_VERS4 ((unsigned long)(4))\n\nextern  void nlm_prog_4(struct svc_req *rqstp, SVCXPRT *transp);\n#define\tNLM4_TEST ((unsigned long)(1))\nextern  nlm4_testres * nlm4_test_4(nlm4_testargs *, CLIENT *);\nextern  nlm4_testres * nlm4_test_4_svc(nlm4_testargs *, struct svc_req *);\n#define\tNLM4_LOCK ((unsigned long)(2))\nextern  nlm4_res * nlm4_lock_4(nlm4_lockargs *, CLIENT *);\nextern  nlm4_res * nlm4_lock_4_svc(nlm4_lockargs *, struct svc_req *);\n#define\tNLM4_CANCEL ((unsigned long)(3))\nextern  nlm4_res * nlm4_cancel_4(nlm4_cancargs *, CLIENT *);\nextern  nlm4_res * nlm4_cancel_4_svc(nlm4_cancargs *, struct svc_req *);\n#define\tNLM4_UNLOCK ((unsigned long)(4))\nextern  nlm4_res * nlm4_unlock_4(nlm4_unlockargs *, CLIENT *);\nextern  nlm4_res * nlm4_unlock_4_svc(nlm4_unlockargs *, struct svc_req *);\n#define\tNLM4_GRANTED ((unsigned long)(5))\nextern  nlm4_res * nlm4_granted_4(nlm4_testargs *, CLIENT *);\nextern  nlm4_res * nlm4_granted_4_svc(nlm4_testargs *, struct svc_req *);\n#define\tNLM4_TEST_MSG ((unsigned long)(6))\nextern  void * nlm4_test_msg_4(nlm4_testargs *, CLIENT *);\nextern  void * nlm4_test_msg_4_svc(nlm4_testargs *, struct svc_req *);\n#define\tNLM4_LOCK_MSG ((unsigned long)(7))\nextern  void * nlm4_lock_msg_4(nlm4_lockargs *, CLIENT *);\nextern  void * nlm4_lock_msg_4_svc(nlm4_lockargs *, struct svc_req *);\n#define\tNLM4_CANCEL_MSG ((unsigned long)(8))\nextern  void * nlm4_cancel_msg_4(nlm4_cancargs *, CLIENT *);\nextern  void * nlm4_cancel_msg_4_svc(nlm4_cancargs *, struct svc_req *);\n#define\tNLM4_UNLOCK_MSG ((unsigned long)(9))\nextern  void * nlm4_unlock_msg_4(nlm4_unlockargs *, CLIENT *);\nextern  void * nlm4_unlock_msg_4_svc(nlm4_unlockargs *, struct svc_req *);\n#define\tNLM4_GRANTED_MSG ((unsigned long)(10))\nextern  void * nlm4_granted_msg_4(nlm4_testargs *, CLIENT *);\nextern  void * nlm4_granted_msg_4_svc(nlm4_testargs *, struct svc_req *);\n#define\tNLM4_TEST_RES ((unsigned long)(11))\nextern  void * nlm4_test_res_4(nlm4_testres *, CLIENT *);\nextern  void * nlm4_test_res_4_svc(nlm4_testres *, struct svc_req *);\n#define\tNLM4_LOCK_RES ((unsigned long)(12))\nextern  void * nlm4_lock_res_4(nlm4_res *, CLIENT *);\nextern  void * nlm4_lock_res_4_svc(nlm4_res *, struct svc_req *);\n#define\tNLM4_CANCEL_RES ((unsigned long)(13))\nextern  void * nlm4_cancel_res_4(nlm4_res *, CLIENT *);\nextern  void * nlm4_cancel_res_4_svc(nlm4_res *, struct svc_req *);\n#define\tNLM4_UNLOCK_RES ((unsigned long)(14))\nextern  void * nlm4_unlock_res_4(nlm4_res *, CLIENT *);\nextern  void * nlm4_unlock_res_4_svc(nlm4_res *, struct svc_req *);\n#define\tNLM4_GRANTED_RES ((unsigned long)(15))\nextern  void * nlm4_granted_res_4(nlm4_res *, CLIENT *);\nextern  void * nlm4_granted_res_4_svc(nlm4_res *, struct svc_req *);\n#define\tNLM4_SHARE ((unsigned long)(20))\nextern  nlm4_shareres * nlm4_share_4(nlm4_shareargs *, CLIENT *);\nextern  nlm4_shareres * nlm4_share_4_svc(nlm4_shareargs *, struct svc_req *);\n#define\tNLM4_UNSHARE ((unsigned long)(21))\nextern  nlm4_shareres * nlm4_unshare_4(nlm4_shareargs *, CLIENT *);\nextern  nlm4_shareres * nlm4_unshare_4_svc(nlm4_shareargs *, struct svc_req *);\n#define\tNLM4_NM_LOCK ((unsigned long)(22))\nextern  nlm4_res * nlm4_nm_lock_4(nlm4_lockargs *, CLIENT *);\nextern  nlm4_res * nlm4_nm_lock_4_svc(nlm4_lockargs *, struct svc_req *);\n#define\tNLM4_FREE_ALL ((unsigned long)(23))\nextern  void * nlm4_free_all_4(nlm4_notify *, CLIENT *);\nextern  void * nlm4_free_all_4_svc(nlm4_notify *, struct svc_req *);\nextern int nlm_prog_4_freeresult(SVCXPRT *, xdrproc_t, caddr_t);\n\n/* the xdr functions */\nextern  bool_t xdr_nlm_stats(XDR *, nlm_stats*);\nextern  bool_t xdr_nlm_holder(XDR *, nlm_holder*);\nextern  bool_t xdr_nlm_testrply(XDR *, nlm_testrply*);\nextern  bool_t xdr_nlm_stat(XDR *, nlm_stat*);\nextern  bool_t xdr_nlm_res(XDR *, nlm_res*);\nextern  bool_t xdr_nlm_testres(XDR *, nlm_testres*);\nextern  bool_t xdr_nlm_lock(XDR *, nlm_lock*);\nextern  bool_t xdr_nlm_lockargs(XDR *, nlm_lockargs*);\nextern  bool_t xdr_nlm_cancargs(XDR *, nlm_cancargs*);\nextern  bool_t xdr_nlm_testargs(XDR *, nlm_testargs*);\nextern  bool_t xdr_nlm_unlockargs(XDR *, nlm_unlockargs*);\nextern  bool_t xdr_fsh_mode(XDR *, fsh_mode*);\nextern  bool_t xdr_fsh_access(XDR *, fsh_access*);\nextern  bool_t xdr_nlm_share(XDR *, nlm_share*);\nextern  bool_t xdr_nlm_shareargs(XDR *, nlm_shareargs*);\nextern  bool_t xdr_nlm_shareres(XDR *, nlm_shareres*);\nextern  bool_t xdr_nlm_notify(XDR *, nlm_notify*);\nextern  bool_t xdr_nlm4_stats(XDR *, nlm4_stats*);\nextern  bool_t xdr_nlm4_stat(XDR *, nlm4_stat*);\nextern  bool_t xdr_nlm4_holder(XDR *, nlm4_holder*);\nextern  bool_t xdr_nlm4_lock(XDR *, nlm4_lock*);\nextern  bool_t xdr_nlm4_share(XDR *, nlm4_share*);\nextern  bool_t xdr_nlm4_testrply(XDR *, nlm4_testrply*);\nextern  bool_t xdr_nlm4_testres(XDR *, nlm4_testres*);\nextern  bool_t xdr_nlm4_testargs(XDR *, nlm4_testargs*);\nextern  bool_t xdr_nlm4_res(XDR *, nlm4_res*);\nextern  bool_t xdr_nlm4_lockargs(XDR *, nlm4_lockargs*);\nextern  bool_t xdr_nlm4_cancargs(XDR *, nlm4_cancargs*);\nextern  bool_t xdr_nlm4_unlockargs(XDR *, nlm4_unlockargs*);\nextern  bool_t xdr_nlm4_shareargs(XDR *, nlm4_shareargs*);\nextern  bool_t xdr_nlm4_shareres(XDR *, nlm4_shareres*);\nextern  bool_t xdr_nlm_sm_status(XDR *, nlm_sm_status*);\nextern  bool_t xdr_nlm4_notify(XDR *, nlm4_notify*);\n\n#ifdef __cplusplus\n}\n#endif\n\n#endif /* !_NLM_PROT_H_RPCGEN */\n"
  },
  {
    "path": "freebsd-headers/rpcsvc/nlm_prot.x",
    "content": "/*\n * Network lock manager protocol definition\n * Copyright (C) 1986 Sun Microsystems, Inc.\n *\n * protocol used between local lock manager and remote lock manager\n */\n\n#ifdef RPC_HDR\n%#define LM_MAXSTRLEN\t1024\n%#define MAXNAMELEN\tLM_MAXSTRLEN+1\n#else\n%#include <sys/cdefs.h>\n%#ifndef lint\n%/*static char sccsid[] = \"from: @(#)nlm_prot.x 1.8 87/09/21 Copyr 1987 Sun Micro\";*/\n%/*static char sccsid[] = \"from: * @(#)nlm_prot.x\t2.1 88/08/01 4.0 RPCSRC\";*/\n%__RCSID(\"$NetBSD: nlm_prot.x,v 1.6 2000/06/07 14:30:15 bouyer Exp $\");\n%#endif /* not lint */\n%__FBSDID(\"$FreeBSD: release/9.0.0/include/rpcsvc/nlm_prot.x 114629 2003-05-04 02:51:42Z obrien $\");\n#endif\n\n/*\n * status of a call to the lock manager\n */\nenum nlm_stats {\n\tnlm_granted = 0,\n\tnlm_denied = 1,\n\tnlm_denied_nolocks = 2,\n\tnlm_blocked = 3,\n\tnlm_denied_grace_period = 4,\n\tnlm_deadlck = 5\n};\n\nstruct nlm_holder {\n\tbool exclusive;\n\tint svid;\n\tnetobj oh;\n\tunsigned l_offset;\n\tunsigned l_len;\n};\n\nunion nlm_testrply switch (nlm_stats stat) {\n\tcase nlm_denied:\n\t\tstruct nlm_holder holder;\n\tdefault:\n\t\tvoid;\n};\n\nstruct nlm_stat {\n\tnlm_stats stat;\n};\n\nstruct nlm_res {\n\tnetobj cookie;\n\tnlm_stat stat;\n};\n\nstruct nlm_testres {\n\tnetobj cookie;\n\tnlm_testrply stat;\n};\n\nstruct nlm_lock {\n\tstring caller_name<LM_MAXSTRLEN>;\n\tnetobj fh;\t\t/* identify a file */\n\tnetobj oh;\t\t/* identify owner of a lock */\n\tint svid;\t\t/* generated from pid for svid */\n\tunsigned l_offset;\n\tunsigned l_len;\n};\n\nstruct nlm_lockargs {\n\tnetobj cookie;\n\tbool block;\n\tbool exclusive;\n\tstruct nlm_lock alock;\n\tbool reclaim;\t\t/* used for recovering locks */\n\tint state;\t\t/* specify local status monitor state */\n};\n\nstruct nlm_cancargs {\n\tnetobj cookie;\n\tbool block;\n\tbool exclusive;\n\tstruct nlm_lock alock;\n};\n\nstruct nlm_testargs {\n\tnetobj cookie;\n\tbool exclusive;\n\tstruct nlm_lock alock;\n};\n\nstruct nlm_unlockargs {\n\tnetobj cookie;\n\tstruct nlm_lock alock;\n};\n\n\n#ifdef RPC_HDR\n%/*\n% * The following enums are actually bit encoded for efficient\n% * boolean algebra.... DON'T change them.....\n% */\n#endif\nenum\tfsh_mode {\n\tfsm_DN  = 0,\t/* deny none */\n\tfsm_DR  = 1,\t/* deny read */\n\tfsm_DW  = 2,\t/* deny write */\n\tfsm_DRW = 3\t/* deny read/write */\n};\n\nenum\tfsh_access {\n\tfsa_NONE = 0,\t/* for completeness */\n\tfsa_R    = 1,\t/* read only */\n\tfsa_W    = 2,\t/* write only */\n\tfsa_RW   = 3\t/* read/write */\n};\n\nstruct\tnlm_share {\n\tstring caller_name<LM_MAXSTRLEN>;\n\tnetobj\tfh;\n\tnetobj\toh;\n\tfsh_mode\tmode;\n\tfsh_access\taccess;\n};\n\nstruct\tnlm_shareargs {\n\tnetobj\tcookie;\n\tnlm_share\tshare;\n\tbool\treclaim;\n};\n\nstruct\tnlm_shareres {\n\tnetobj\tcookie;\n\tnlm_stats\tstat;\n\tint\tsequence;\n};\n\nstruct\tnlm_notify {\n\tstring name<MAXNAMELEN>;\n\tlong state;\n};\n\n#ifdef RPC_HDR\n%/* definitions for NLM version 4 */\n#endif\nenum nlm4_stats {\n\tnlm4_granted\t\t\t= 0,\n\tnlm4_denied\t\t\t= 1,\n\tnlm4_denied_nolocks\t\t= 2,\n\tnlm4_blocked\t\t\t= 3,\n\tnlm4_denied_grace_period\t= 4,\n\tnlm4_deadlck\t\t\t= 5,\n\tnlm4_rofs\t\t\t= 6,\n\tnlm4_stale_fh\t\t\t= 7,\n\tnlm4_fbig\t\t\t= 8,\n\tnlm4_failed\t\t\t= 9\n};\n\nstruct nlm4_stat {\n\tnlm4_stats stat;\n};\n\nstruct nlm4_holder {\n\tbool exclusive;\n\tu_int32_t svid;\n\tnetobj oh;\n\tu_int64_t l_offset;\n\tu_int64_t l_len;\n};\n\nstruct nlm4_lock {\n\tstring caller_name<MAXNAMELEN>;\n\tnetobj fh;\n\tnetobj oh;\n\tu_int32_t svid;\n\tu_int64_t l_offset;\n\tu_int64_t l_len;\n};\n\nstruct nlm4_share {\n\tstring caller_name<MAXNAMELEN>;\n\tnetobj fh;\n\tnetobj oh;\n\tfsh_mode mode;\n\tfsh_access access;\n};\n\nunion nlm4_testrply switch (nlm4_stats stat) {\n\tcase nlm_denied:\n\t\tstruct nlm4_holder holder;\n\tdefault:\n\t\tvoid;\n};\n\nstruct nlm4_testres {\n\tnetobj cookie;\n\tnlm4_testrply stat;\n};\n\nstruct nlm4_testargs {\n\tnetobj cookie;\n\tbool exclusive;\n\tstruct nlm4_lock alock;\n};\n\nstruct nlm4_res {\n\tnetobj cookie;\n\tnlm4_stat stat;\n};\n\nstruct nlm4_lockargs {\n\tnetobj cookie;\n\tbool block;\n\tbool exclusive;\n\tstruct nlm4_lock alock;\n\tbool reclaim;\t\t/* used for recovering locks */\n\tint state;\t\t/* specify local status monitor state */\n};\n\nstruct nlm4_cancargs {\n\tnetobj cookie;\n\tbool block;\n\tbool exclusive;\n\tstruct nlm4_lock alock;\n};\n\nstruct nlm4_unlockargs {\n\tnetobj cookie;\n\tstruct nlm4_lock alock;\n};\n\nstruct\tnlm4_shareargs {\n\tnetobj\tcookie;\n\tnlm4_share\tshare;\n\tbool\treclaim;\n};\n\nstruct\tnlm4_shareres {\n\tnetobj\tcookie;\n\tnlm4_stats\tstat;\n\tint\tsequence;\n};\n\n/*\n * argument for the procedure called by rpc.statd when a monitored host\n * status change.\n * XXX assumes LM_MAXSTRLEN == SM_MAXSTRLEN\n */\nstruct nlm_sm_status {\n\tstring mon_name<LM_MAXSTRLEN>; /* name of host */\n\tint state;\t\t\t/* new state */\n\topaque priv[16];\t\t/* private data */\n};\n\nstruct\tnlm4_notify {\n\tstring name<MAXNAMELEN>;\n\tint32_t state;\n};\n\n/*\n * Over-the-wire protocol used between the network lock managers\n */\n\nprogram NLM_PROG {\n\n\tversion NLM_SM {\n\t\tvoid NLM_SM_NOTIFY(struct nlm_sm_status) = 1;\n\t} = 0;\n\n\tversion NLM_VERS {\n\n\t\tnlm_testres\tNLM_TEST(struct nlm_testargs) =\t1;\n\n\t\tnlm_res\t\tNLM_LOCK(struct nlm_lockargs) =\t2;\n\n\t\tnlm_res\t\tNLM_CANCEL(struct nlm_cancargs) = 3;\n\t\tnlm_res\t\tNLM_UNLOCK(struct nlm_unlockargs) =\t4;\n\n\t\t/*\n\t\t * remote lock manager call-back to grant lock\n\t\t */\n\t\tnlm_res\t\tNLM_GRANTED(struct nlm_testargs)= 5;\n\t\t/*\n\t\t * message passing style of requesting lock\n\t\t */\n\t\tvoid\t\tNLM_TEST_MSG(struct nlm_testargs) = 6;\n\t\tvoid\t\tNLM_LOCK_MSG(struct nlm_lockargs) = 7;\n\t\tvoid\t\tNLM_CANCEL_MSG(struct nlm_cancargs) =8;\n\t\tvoid\t\tNLM_UNLOCK_MSG(struct nlm_unlockargs) = 9;\n\t\tvoid\t\tNLM_GRANTED_MSG(struct nlm_testargs) = 10;\n\t\tvoid\t\tNLM_TEST_RES(nlm_testres) = 11;\n\t\tvoid\t\tNLM_LOCK_RES(nlm_res) = 12;\n\t\tvoid\t\tNLM_CANCEL_RES(nlm_res) = 13;\n\t\tvoid\t\tNLM_UNLOCK_RES(nlm_res) = 14;\n\t\tvoid\t\tNLM_GRANTED_RES(nlm_res) = 15;\n\t} = 1;\n\n\tversion NLM_VERSX {\n\t\tnlm_shareres\tNLM_SHARE(nlm_shareargs) = 20;\n\t\tnlm_shareres\tNLM_UNSHARE(nlm_shareargs) = 21;\n\t\tnlm_res\t\tNLM_NM_LOCK(nlm_lockargs) = 22;\n\t\tvoid\t\tNLM_FREE_ALL(nlm_notify) = 23;\n\t} = 3;\n\n\tversion NLM_VERS4 {\n\t\tnlm4_testres NLM4_TEST(nlm4_testargs) = 1;\n\t\tnlm4_res NLM4_LOCK(nlm4_lockargs) = 2;\n\t\tnlm4_res NLM4_CANCEL(nlm4_cancargs) = 3;\n\t\tnlm4_res NLM4_UNLOCK(nlm4_unlockargs) = 4;\n\t\tnlm4_res NLM4_GRANTED(nlm4_testargs) = 5;\n\t\tvoid NLM4_TEST_MSG(nlm4_testargs) = 6;\n\t\tvoid NLM4_LOCK_MSG(nlm4_lockargs) = 7;\n\t\tvoid NLM4_CANCEL_MSG(nlm4_cancargs) = 8;\n\t\tvoid NLM4_UNLOCK_MSG(nlm4_unlockargs) = 9;\n\t\tvoid NLM4_GRANTED_MSG(nlm4_testargs) = 10;\n\t\tvoid NLM4_TEST_RES(nlm4_testres) = 11;\n\t\tvoid NLM4_LOCK_RES(nlm4_res) = 12;\n\t\tvoid NLM4_CANCEL_RES(nlm4_res) = 13;\n\t\tvoid NLM4_UNLOCK_RES(nlm4_res) = 14;\n\t\tvoid NLM4_GRANTED_RES(nlm4_res) = 15;\n\t\tnlm4_shareres NLM4_SHARE(nlm4_shareargs) = 20;\n\t\tnlm4_shareres NLM4_UNSHARE(nlm4_shareargs) = 21;\n\t\tnlm4_res NLM4_NM_LOCK(nlm4_lockargs) = 22;\n\t\tvoid NLM4_FREE_ALL(nlm4_notify) = 23;\n\t} = 4;\n} = 100021;\n"
  },
  {
    "path": "freebsd-headers/rpcsvc/rex.h",
    "content": "/*\n * Please do not edit this file.\n * It was generated using rpcgen.\n */\n\n#ifndef _REX_H_RPCGEN\n#define\t_REX_H_RPCGEN\n\n#include <rpc/rpc.h>\n\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\n#define\tSTRINGSIZE 1024\n\ntypedef char *rexstring;\n#define\tSIGINT 2\n#define\tREX_INTERACTIVE 1\n\nstruct rex_start {\n\tstruct {\n\t\tu_int rst_cmd_len;\n\t\trexstring *rst_cmd_val;\n\t} rst_cmd;\n\trexstring rst_host;\n\trexstring rst_fsname;\n\trexstring rst_dirwithin;\n\tstruct {\n\t\tu_int rst_env_len;\n\t\trexstring *rst_env_val;\n\t} rst_env;\n\tu_int rst_port0;\n\tu_int rst_port1;\n\tu_int rst_port2;\n\tu_int rst_flags;\n};\ntypedef struct rex_start rex_start;\n\nstruct rex_result {\n\tint rlt_stat;\n\trexstring rlt_message;\n};\ntypedef struct rex_result rex_result;\n\nstruct sgttyb {\n\tu_int four;\n\tchar chars[4];\n\tu_int flags;\n};\ntypedef struct sgttyb sgttyb;\n#define\tB0 0\n#define\tB50 1\n#define\tB75 2\n#define\tB110 3\n#define\tB134 4\n#define\tB150 5\n#define\tB200 6\n#define\tB300 7\n#define\tB600 8\n#define\tB1200 9\n#define\tB1800 10\n#define\tB2400 11\n#define\tB4800 12\n#define\tB9600 13\n#define\tB19200 14\n#define\tB38400 15\n#define\tTANDEM 0x00000001\n#define\tCBREAK 0x00000002\n#define\tLCASE 0x00000004\n#define\tECHO 0x00000008\n#define\tCRMOD 0x00000010\n#define\tRAW 0x00000020\n#define\tODDP 0x00000040\n#define\tEVENP 0x00000080\n#define\tANYP 0x000000c0\n#define\tNLDELAY 0x00000300\n#define\tNL0 0x00000000\n#define\tNL1 0x00000100\n#define\tNL2 0x00000200\n#define\tNL3 0x00000300\n#define\tTBDELAY 0x00000c00\n#define\tTAB0 0x00000000\n#define\tTAB1 0x00000400\n#define\tTAB2 0x00000800\n#define\tXTABS 0x00000c00\n#define\tCRDELAY 0x00003000\n#define\tCR0 0x00000000\n#define\tCR1 0x00001000\n#define\tCR2 0x00002000\n#define\tCR3 0x00003000\n#define\tVTDELAY 0x00004000\n#define\tFF0 0x00000000\n#define\tFF1 0x00004000\n#define\tBSDELAY 0x00008000\n#define\tBS0 0x00000000\n#define\tBS1 0x00008000\n#define\tCRTBS 0x00010000\n#define\tPRTERA 0x00020000\n#define\tCRTERA 0x00040000\n#define\tTILDE 0x00080000\n#define\tMDMBUF 0x00100000\n#define\tLITOUT 0x00200000\n#define\tTOSTOP 0x00400000\n#define\tFLUSHO 0x00800000\n#define\tNOHANG 0x01000000\n#define\tL001000 0x02000000\n#define\tCRTKIL 0x04000000\n#define\tPASS8 0x08000000\n#define\tCTLECH 0x10000000\n#define\tPENDIN 0x20000000\n#define\tDECCTQ 0x40000000\n#define\tNOFLSH 0x80000000\n\nstruct tchars {\n\tu_int six;\n\tchar chars[6];\n};\ntypedef struct tchars tchars;\n\nstruct ltchars {\n\tu_int six;\n\tchar chars[6];\n\tu_int mode;\n};\ntypedef struct ltchars ltchars;\n\nstruct rex_ttysize {\n\tint ts_lines;\n\tint ts_cols;\n};\ntypedef struct rex_ttysize rex_ttysize;\n\nstruct rex_ttymode {\n\tsgttyb basic;\n\ttchars more;\n\tltchars yetmore;\n\tu_int andmore;\n};\ntypedef struct rex_ttymode rex_ttymode;\n#define\tLCRTBS 0x0001\n#define\tLPRTERA 0x0002\n#define\tLCRTERA 0x0004\n#define\tLTILDE 0x0008\n#define\tLMDMBUF 0x0010\n#define\tLLITOUT 0x0020\n#define\tLTOSTOP 0x0040\n#define\tLFLUSHO 0x0080\n#define\tLNOHANG 0x0100\n#define\tLL001000 0x0200\n#define\tLCRTKIL 0x0400\n#define\tLPASS8 0x0800\n#define\tLCTLECH 0x1000\n#define\tLPENDIN 0x2000\n#define\tLDECCTQ 0x4000\n#define\tLNOFLSH 0x8000\n\n#define\tREXPROG ((unsigned long)(100017))\n#define\tREXVERS ((unsigned long)(1))\n\nextern  void rexprog_1(struct svc_req *rqstp, SVCXPRT *transp);\n#define\tREXPROC_START ((unsigned long)(1))\nextern  rex_result * rexproc_start_1(rex_start *, CLIENT *);\nextern  rex_result * rexproc_start_1_svc(rex_start *, struct svc_req *);\n#define\tREXPROC_WAIT ((unsigned long)(2))\nextern  rex_result * rexproc_wait_1(void *, CLIENT *);\nextern  rex_result * rexproc_wait_1_svc(void *, struct svc_req *);\n#define\tREXPROC_MODES ((unsigned long)(3))\nextern  void * rexproc_modes_1(rex_ttymode *, CLIENT *);\nextern  void * rexproc_modes_1_svc(rex_ttymode *, struct svc_req *);\n#define\tREXPROC_WINCH ((unsigned long)(4))\nextern  void * rexproc_winch_1(rex_ttysize *, CLIENT *);\nextern  void * rexproc_winch_1_svc(rex_ttysize *, struct svc_req *);\n#define\tREXPROC_SIGNAL ((unsigned long)(5))\nextern  void * rexproc_signal_1(int *, CLIENT *);\nextern  void * rexproc_signal_1_svc(int *, struct svc_req *);\nextern int rexprog_1_freeresult(SVCXPRT *, xdrproc_t, caddr_t);\n\n/* the xdr functions */\nextern  bool_t xdr_rexstring(XDR *, rexstring*);\nextern  bool_t xdr_rex_start(XDR *, rex_start*);\nextern  bool_t xdr_rex_result(XDR *, rex_result*);\nextern  bool_t xdr_sgttyb(XDR *, sgttyb*);\nextern  bool_t xdr_tchars(XDR *, tchars*);\nextern  bool_t xdr_ltchars(XDR *, ltchars*);\nextern  bool_t xdr_rex_ttysize(XDR *, rex_ttysize*);\nextern  bool_t xdr_rex_ttymode(XDR *, rex_ttymode*);\n\n#ifdef __cplusplus\n}\n#endif\n\n#endif /* !_REX_H_RPCGEN */\n"
  },
  {
    "path": "freebsd-headers/rpcsvc/rex.x",
    "content": "/*\n * Sun RPC is a product of Sun Microsystems, Inc. and is provided for\n * unrestricted use provided that this legend is included on all tape\n * media and as a part of the software program in whole or part.  Users\n * may copy or modify Sun RPC without charge, but are not authorized\n * to license or distribute it to anyone else except as part of a product or\n * program developed by the user.\n * \n * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE\n * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR\n * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.\n * \n * Sun RPC is provided with no support and without any obligation on the\n * part of Sun Microsystems, Inc. to assist in its use, correction,\n * modification or enhancement.\n * \n * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE\n * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC\n * OR ANY PART THEREOF.\n * \n * In no event will Sun Microsystems, Inc. be liable for any lost revenue\n * or profits or other special, indirect and consequential damages, even if\n * Sun has been advised of the possibility of such damages.\n * \n * Sun Microsystems, Inc.\n * 2550 Garcia Avenue\n * Mountain View, California  94043\n */\n\n/*\n * Remote execution (rex) protocol specification\n */\n\n#ifndef RPC_HDR\n%#ifndef lint\n%/*static char sccsid[] = \"from: @(#)rex.x 1.3 87/09/18 Copyr 1987 Sun Micro\";*/\n%/*static char sccsid[] = \"from: @(#)rex.x\t2.1 88/08/01 4.0 RPCSRC\";*/\n%#endif /* not lint */\n%#include <sys/cdefs.h>\n%__FBSDID(\"$FreeBSD: release/9.0.0/include/rpcsvc/rex.x 114629 2003-05-04 02:51:42Z obrien $\");\n#endif\n\nconst STRINGSIZE = 1024;\ntypedef string rexstring<1024>;\n\n/*\n * values to pass to REXPROC_SIGNAL\n */\nconst SIGINT = 2;\t/* interrupt */\n\n/*\n * Values for rst_flags, below \n */\nconst REX_INTERACTIVE = 1;\t/* interactive mode */\n\nstruct rex_start {\n\trexstring rst_cmd<>;\t/* list of command and args */\n\trexstring rst_host;\t/* working directory host name */\n\trexstring rst_fsname;\t/* working directory file system name */\n\trexstring rst_dirwithin;/* working directory within file system */\n\trexstring rst_env<>;\t/* list of environment */\n\tunsigned int rst_port0;\t/* port for stdin */\n\tunsigned int rst_port1;\t/* port for stdout */\n\tunsigned int rst_port2;\t/* port for stderr */\n\tunsigned int rst_flags;\t/* options - see const above */\n};\n\nstruct rex_result {\n   \tint rlt_stat;\t\t/* integer status code */\n\trexstring rlt_message;\t/* string message for human consumption */\n};\n\n\nstruct sgttyb {\n\tunsigned four;\t/* always equals 4 */\n\topaque chars[4];\n\t/* chars[0] == input speed */\n\t/* chars[1] == output speed */\n\t/* chars[2] == kill character */\n\t/* chars[3] == erase character */\n\tunsigned flags;\n};\n/* values for speeds above (baud rates)  */\nconst B0  = 0;\nconst B50 = 1;\nconst B75 = 2;\nconst B110 = 3;\nconst B134 = 4;\nconst B150 = 5;\nconst B200 = 6;\nconst B300 = 7;\nconst B600 = 8;\nconst B1200 = 9;\nconst B1800 = 10;\nconst B2400 = 11;\nconst B4800 = 12;\nconst B9600 = 13;\nconst B19200 = 14;\nconst B38400 = 15;\n\n/* values for flags above */\nconst TANDEM = 0x00000001; /* send stopc on out q full */\nconst CBREAK = 0x00000002; /* half-cooked mode */\nconst LCASE = 0x00000004; /* simulate lower case */\nconst ECHO = 0x00000008; /* echo input */\nconst CRMOD = 0x00000010; /* map \\r to \\r\\n on output */\nconst RAW = 0x00000020; /* no i/o processing */\nconst ODDP = 0x00000040; /* get/send odd parity */\nconst EVENP = 0x00000080; /* get/send even parity */\nconst ANYP = 0x000000c0; /* get any parity/send none */\nconst NLDELAY = 0x00000300; /* \\n delay */\nconst  NL0 = 0x00000000;\nconst  NL1 = 0x00000100; /* tty 37 */\nconst  NL2 = 0x00000200; /* vt05 */\nconst  NL3 = 0x00000300;\nconst TBDELAY = 0x00000c00; /* horizontal tab delay */\nconst  TAB0 = 0x00000000;\nconst  TAB1 = 0x00000400; /* tty 37 */\nconst  TAB2 = 0x00000800;\nconst XTABS = 0x00000c00; /* expand tabs on output */\nconst CRDELAY = 0x00003000; /* \\r delay */\nconst  CR0 = 0x00000000;\nconst  CR1 = 0x00001000; /* tn 300 */\nconst  CR2 = 0x00002000; /* tty 37 */\nconst  CR3 = 0x00003000; /* concept 100 */\nconst VTDELAY = 0x00004000; /* vertical tab delay */\nconst  FF0 = 0x00000000;\nconst  FF1 = 0x00004000; /* tty 37 */\nconst BSDELAY = 0x00008000; /* \\b delay */\nconst  BS0 = 0x00000000;\nconst  BS1 = 0x00008000;\nconst CRTBS = 0x00010000; /* do backspacing for crt */\nconst PRTERA = 0x00020000; /* \\ ... / erase */\nconst CRTERA = 0x00040000; /* \" \\b \" to wipe out char */\nconst TILDE = 0x00080000; /* hazeltine tilde kludge */\nconst MDMBUF = 0x00100000; /* start/stop output on carrier intr */\nconst LITOUT = 0x00200000; /* literal output */\nconst TOSTOP = 0x00400000; /* SIGTTOU on background output */\nconst FLUSHO = 0x00800000; /* flush output to terminal */\nconst NOHANG = 0x01000000; /* no SIGHUP on carrier drop */\nconst L001000 = 0x02000000;\nconst CRTKIL = 0x04000000; /* kill line with \" \\b \" */\nconst PASS8 = 0x08000000;\nconst CTLECH = 0x10000000; /* echo control chars as ^X */\nconst PENDIN = 0x20000000; /* tp->t_rawq needs reread */\nconst DECCTQ = 0x40000000; /* only ^Q starts after ^S */\nconst NOFLSH = 0x80000000; /* no output flush on signal */\n\nstruct tchars {\n\tunsigned six;\t/* always equals 6 */\n\topaque chars[6];\n\t/* chars[0] == interrupt char */\n\t/* chars[1] == quit char */\n\t/* chars[2] == start output char */\n\t/* chars[3] == stop output char */\n\t/* chars[4] == end-of-file char */\n\t/* chars[5] == input delimeter (like nl) */\n};\n\nstruct ltchars {\n\tunsigned six;\t/* always equals 6 */\n\topaque chars[6];\n\t/* chars[0] == stop process signal */\n\t/* chars[1] == delayed stop process signal */\n\t/* chars[2] == reprint line */\n\t/* chars[3] == flush output */\n\t/* chars[4] == word erase */\n\t/* chars[5] == literal next character */\n\tunsigned mode;\n};\n\nstruct rex_ttysize {\n\tint ts_lines;\n\tint ts_cols;\n};\n\nstruct rex_ttymode {\n    sgttyb basic;    /* standard unix tty flags */\n    tchars more; /* interrupt, kill characters, etc. */\n    ltchars yetmore; /* special Berkeley characters */\n    unsigned andmore;     /* and Berkeley modes */\n};\n\n/* values for andmore above */\nconst LCRTBS = 0x0001;\t/* do backspacing for crt */\nconst LPRTERA = 0x0002;\t/* \\ ... / erase */\nconst LCRTERA = 0x0004;\t/* \" \\b \" to wipe out char */\nconst LTILDE = 0x0008;\t/* hazeltine tilde kludge */\nconst LMDMBUF = 0x0010;\t/* start/stop output on carrier intr */\nconst LLITOUT = 0x0020;\t/* literal output */\nconst LTOSTOP = 0x0040;\t/* SIGTTOU on background output */\nconst LFLUSHO = 0x0080;\t/* flush output to terminal */\nconst LNOHANG = 0x0100;\t/* no SIGHUP on carrier drop */\nconst LL001000 = 0x0200;\nconst LCRTKIL = 0x0400;\t/* kill line with \" \\b \" */\nconst LPASS8 = 0x0800;\nconst LCTLECH = 0x1000;\t/* echo control chars as ^X */\nconst LPENDIN = 0x2000;\t/* needs reread */\nconst LDECCTQ = 0x4000;\t/* only ^Q starts after ^S */\nconst LNOFLSH = 0x8000;\t/* no output flush on signal */\n\nprogram REXPROG {\n\tversion REXVERS {\n\n\t\t/*\n\t\t * Start remote execution\n\t\t */\n\t\trex_result \n\t\tREXPROC_START(rex_start) = 1;\n\n\t\t/*\n\t\t * Wait for remote execution to terminate\n\t\t */\n\t\trex_result\n\t\tREXPROC_WAIT(void) = 2;\n\n\t\t/*\n\t\t * Send tty modes\n\t\t */\n\t\tvoid\n\t\tREXPROC_MODES(rex_ttymode) = 3;\n\n\t\t/*\n\t\t * Send window size change\n\t\t */\n\t\tvoid\n\t\tREXPROC_WINCH(rex_ttysize) = 4;\n\n\t\t/*\n\t\t * Send other signal\n\t\t */\n\t\tvoid\n\t\tREXPROC_SIGNAL(int) = 5;\n\t} = 1;\n} = 100017;\n"
  },
  {
    "path": "freebsd-headers/rpcsvc/rnusers.h",
    "content": "/*\n * Please do not edit this file.\n * It was generated using rpcgen.\n */\n\n#ifndef _RNUSERS_H_RPCGEN\n#define\t_RNUSERS_H_RPCGEN\n\n#include <rpc/rpc.h>\n\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\n#define\tMAXUSERS 100\n#define\tMAXUTLEN 256\n\nstruct utmp {\n\tchar *ut_line;\n\tchar *ut_name;\n\tchar *ut_host;\n\tint ut_time;\n};\ntypedef struct utmp utmp;\n\nstruct utmpidle {\n\tutmp ui_utmp;\n\tu_int ui_idle;\n};\ntypedef struct utmpidle utmpidle;\n\ntypedef struct {\n\tu_int utmparr_len;\n\tutmp *utmparr_val;\n} utmparr;\n\ntypedef struct {\n\tu_int utmpidlearr_len;\n\tutmpidle *utmpidlearr_val;\n} utmpidlearr;\n#define\tRUSERS_MAXUSERLEN 32\n#define\tRUSERS_MAXLINELEN 32\n#define\tRUSERS_MAXHOSTLEN 257\n\nstruct rusers_utmp {\n\tchar *ut_user;\n\tchar *ut_line;\n\tchar *ut_host;\n\tint ut_type;\n\tint ut_time;\n\tu_int ut_idle;\n};\ntypedef struct rusers_utmp rusers_utmp;\n\ntypedef struct {\n\tu_int utmp_array_len;\n\trusers_utmp *utmp_array_val;\n} utmp_array;\n\n#define\tRUSERSPROG ((unsigned long)(100002))\n#define\tRUSERSVERS_ORIG ((unsigned long)(1))\n\nextern  void rusersprog_1(struct svc_req *rqstp, SVCXPRT *transp);\n#define\tRUSERSPROC_NUM ((unsigned long)(1))\nextern  int * rusersproc_num_1(void *, CLIENT *);\nextern  int * rusersproc_num_1_svc(void *, struct svc_req *);\n#define\tRUSERSPROC_NAMES ((unsigned long)(2))\nextern  utmparr * rusersproc_names_1(void *, CLIENT *);\nextern  utmparr * rusersproc_names_1_svc(void *, struct svc_req *);\n#define\tRUSERSPROC_ALLNAMES ((unsigned long)(3))\nextern  utmparr * rusersproc_allnames_1(void *, CLIENT *);\nextern  utmparr * rusersproc_allnames_1_svc(void *, struct svc_req *);\nextern int rusersprog_1_freeresult(SVCXPRT *, xdrproc_t, caddr_t);\n#define\tRUSERSVERS_IDLE ((unsigned long)(2))\n\nextern  void rusersprog_2(struct svc_req *rqstp, SVCXPRT *transp);\nextern  int * rusersproc_num_2(void *, CLIENT *);\nextern  int * rusersproc_num_2_svc(void *, struct svc_req *);\nextern  utmpidlearr * rusersproc_names_2(void *, CLIENT *);\nextern  utmpidlearr * rusersproc_names_2_svc(void *, struct svc_req *);\nextern  utmpidlearr * rusersproc_allnames_2(void *, CLIENT *);\nextern  utmpidlearr * rusersproc_allnames_2_svc(void *, struct svc_req *);\nextern int rusersprog_2_freeresult(SVCXPRT *, xdrproc_t, caddr_t);\n#define\tRUSERSVERS_3 ((unsigned long)(3))\n\nextern  void rusersprog_3(struct svc_req *rqstp, SVCXPRT *transp);\nextern  int * rusersproc_num_3(void *, CLIENT *);\nextern  int * rusersproc_num_3_svc(void *, struct svc_req *);\nextern  utmp_array * rusersproc_names_3(void *, CLIENT *);\nextern  utmp_array * rusersproc_names_3_svc(void *, struct svc_req *);\nextern  utmp_array * rusersproc_allnames_3(void *, CLIENT *);\nextern  utmp_array * rusersproc_allnames_3_svc(void *, struct svc_req *);\nextern int rusersprog_3_freeresult(SVCXPRT *, xdrproc_t, caddr_t);\n\n/* the xdr functions */\nextern  bool_t xdr_utmp(XDR *, utmp*);\nextern  bool_t xdr_utmpidle(XDR *, utmpidle*);\nextern  bool_t xdr_utmparr(XDR *, utmparr*);\nextern  bool_t xdr_utmpidlearr(XDR *, utmpidlearr*);\nextern  bool_t xdr_rusers_utmp(XDR *, rusers_utmp*);\nextern  bool_t xdr_utmp_array(XDR *, utmp_array*);\n\n#ifdef __cplusplus\n}\n#endif\n\n#endif /* !_RNUSERS_H_RPCGEN */\n"
  },
  {
    "path": "freebsd-headers/rpcsvc/rnusers.x",
    "content": "/*\n * Sun RPC is a product of Sun Microsystems, Inc. and is provided for\n * unrestricted use provided that this legend is included on all tape\n * media and as a part of the software program in whole or part.  Users\n * may copy or modify Sun RPC without charge, but are not authorized\n * to license or distribute it to anyone else except as part of a product or\n * program developed by the user.\n * \n * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE\n * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR\n * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.\n * \n * Sun RPC is provided with no support and without any obligation on the\n * part of Sun Microsystems, Inc. to assist in its use, correction,\n * modification or enhancement.\n * \n * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE\n * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC\n * OR ANY PART THEREOF.\n * \n * In no event will Sun Microsystems, Inc. be liable for any lost revenue\n * or profits or other special, indirect and consequential damages, even if\n * Sun has been advised of the possibility of such damages.\n * \n * Sun Microsystems, Inc.\n * 2550 Garcia Avenue\n * Mountain View, California  94043\n */\n\n/*\n * Find out about remote users\n */\n\n#ifndef RPC_HDR\n%#ifndef lint\n%/*static char sccsid[] = \"from: @(#)rnusers.x 1.2 87/09/20 Copyr 1987 Sun Micro\";*/\n%/*static char sccsid[] = \"from: @(#)rnusers.x\t2.1 88/08/01 4.0 RPCSRC\";*/\n%#endif /* not lint */\n%#include <sys/cdefs.h>\n%__FBSDID(\"$FreeBSD: release/9.0.0/include/rpcsvc/rnusers.x 114629 2003-05-04 02:51:42Z obrien $\");\n#endif\n\nconst MAXUSERS = 100;\nconst MAXUTLEN = 256;\n\nstruct utmp {\n\tstring ut_line<MAXUTLEN>;\n\tstring ut_name<MAXUTLEN>;\n\tstring ut_host<MAXUTLEN>;\n\tint ut_time;\n};\n\n\nstruct utmpidle {\n\tutmp ui_utmp;\n\tunsigned int ui_idle;\n};\n\ntypedef utmp utmparr<MAXUSERS>;\n\ntypedef utmpidle utmpidlearr<MAXUSERS>;\n\nconst RUSERS_MAXUSERLEN = 32;\nconst RUSERS_MAXLINELEN = 32;\nconst RUSERS_MAXHOSTLEN = 257;\n\nstruct rusers_utmp {\n\tstring ut_user<RUSERS_MAXUSERLEN>;\t/* aka ut_name */\n\tstring ut_line<RUSERS_MAXLINELEN>;\t/* device */\n\tstring ut_host<RUSERS_MAXHOSTLEN>;\t/* host user logged on from */\n\tint ut_type;\t\t\t\t/* type of entry */\n\tint ut_time;\t\t\t\t/* time entry was made */\n\tunsigned int ut_idle;\t\t\t/* minutes idle */\n};\n\ntypedef rusers_utmp utmp_array<>;\n\nprogram RUSERSPROG {\n\t/*\n\t * Old version does not include idle information\n\t */\n\tversion RUSERSVERS_ORIG {\n\t\tint\n\t\tRUSERSPROC_NUM(void) = 1;\n\n\t\tutmparr\n\t\tRUSERSPROC_NAMES(void) = 2;\n\n\t\tutmparr\n\t\tRUSERSPROC_ALLNAMES(void) = 3;\n\t} = 1;\n\n\t/*\n\t * Includes idle information\n\t */\n\tversion RUSERSVERS_IDLE {\n\t\tint\n\t\tRUSERSPROC_NUM(void) = 1;\n\n\t\tutmpidlearr\n\t\tRUSERSPROC_NAMES(void) = 2;\n\n\t\tutmpidlearr\n\t\tRUSERSPROC_ALLNAMES(void) = 3;\n\t} = 2;\n\n\t/*\n\t * Version 3 rusers procedures (from Solaris).\n\t * (Thanks a lot Sun.)\n\t */\n\tversion RUSERSVERS_3 {\n\t\tint\n\t\tRUSERSPROC_NUM(void) = 1;\n\n\t\tutmp_array\n\t\tRUSERSPROC_NAMES(void) = 2;\n\n\t\tutmp_array\n\t\tRUSERSPROC_ALLNAMES(void) = 3;\n\t} = 3;\n\n} = 100002;\n\n"
  },
  {
    "path": "freebsd-headers/rpcsvc/rquota.h",
    "content": "/*\n * Please do not edit this file.\n * It was generated using rpcgen.\n */\n\n#ifndef _RQUOTA_H_RPCGEN\n#define\t_RQUOTA_H_RPCGEN\n\n#include <rpc/rpc.h>\n\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\n#define\tRQ_PATHLEN 1024\n\nstruct getquota_args {\n\tchar *gqa_pathp;\n\tint gqa_uid;\n};\ntypedef struct getquota_args getquota_args;\n\nstruct rquota {\n\tint rq_bsize;\n\tbool_t rq_active;\n\tu_int rq_bhardlimit;\n\tu_int rq_bsoftlimit;\n\tu_int rq_curblocks;\n\tu_int rq_fhardlimit;\n\tu_int rq_fsoftlimit;\n\tu_int rq_curfiles;\n\tu_int rq_btimeleft;\n\tu_int rq_ftimeleft;\n};\ntypedef struct rquota rquota;\n\nenum gqr_status {\n\tQ_OK = 1,\n\tQ_NOQUOTA = 2,\n\tQ_EPERM = 3\n};\ntypedef enum gqr_status gqr_status;\n\nstruct getquota_rslt {\n\tgqr_status status;\n\tunion {\n\t\trquota gqr_rquota;\n\t} getquota_rslt_u;\n};\ntypedef struct getquota_rslt getquota_rslt;\n\n#define\tRQUOTAPROG ((unsigned long)(100011))\n#define\tRQUOTAVERS ((unsigned long)(1))\n\nextern  void rquotaprog_1(struct svc_req *rqstp, SVCXPRT *transp);\n#define\tRQUOTAPROC_GETQUOTA ((unsigned long)(1))\nextern  getquota_rslt * rquotaproc_getquota_1(getquota_args *, CLIENT *);\nextern  getquota_rslt * rquotaproc_getquota_1_svc(getquota_args *, struct svc_req *);\n#define\tRQUOTAPROC_GETACTIVEQUOTA ((unsigned long)(2))\nextern  getquota_rslt * rquotaproc_getactivequota_1(getquota_args *, CLIENT *);\nextern  getquota_rslt * rquotaproc_getactivequota_1_svc(getquota_args *, struct svc_req *);\nextern int rquotaprog_1_freeresult(SVCXPRT *, xdrproc_t, caddr_t);\n\n/* the xdr functions */\nextern  bool_t xdr_getquota_args(XDR *, getquota_args*);\nextern  bool_t xdr_rquota(XDR *, rquota*);\nextern  bool_t xdr_gqr_status(XDR *, gqr_status*);\nextern  bool_t xdr_getquota_rslt(XDR *, getquota_rslt*);\n\n#ifdef __cplusplus\n}\n#endif\n\n#endif /* !_RQUOTA_H_RPCGEN */\n"
  },
  {
    "path": "freebsd-headers/rpcsvc/rquota.x",
    "content": "/*\n * Remote quota protocol\n * Requires unix authentication\n */\n\n#ifndef RPC_HDR\n%#ifndef lint\n%/*static char sccsid[] = \"from: @(#)rquota.x 1.2 87/09/20 Copyr 1987 Sun Micro\";*/\n%/*static char sccsid[] = \"from: @(#)rquota.x\t2.1 88/08/01 4.0 RPCSRC\";*/\n%#endif /* not lint */\n%#include <sys/cdefs.h>\n%__FBSDID(\"$FreeBSD: release/9.0.0/include/rpcsvc/rquota.x 114629 2003-05-04 02:51:42Z obrien $\");\n#endif\n\nconst RQ_PATHLEN = 1024;\n\nstruct getquota_args {\n\tstring gqa_pathp<RQ_PATHLEN>;  \t/* path to filesystem of interest */\n\tint gqa_uid;\t        \t/* inquire about quota for uid */\n};\n\n/*\n * remote quota structure\n */\nstruct rquota {\n\tint rq_bsize;\t\t\t/* block size for block counts */\n\tbool rq_active;  \t\t/* indicates whether quota is active */\n\tunsigned int rq_bhardlimit;\t/* absolute limit on disk blks alloc */\n\tunsigned int rq_bsoftlimit;\t/* preferred limit on disk blks */\n\tunsigned int rq_curblocks;\t/* current block count */\n\tunsigned int rq_fhardlimit;\t/* absolute limit on allocated files */\n\tunsigned int rq_fsoftlimit;\t/* preferred file limit */\n\tunsigned int rq_curfiles;\t/* current # allocated files */\n\tunsigned int rq_btimeleft;\t/* time left for excessive disk use */\n\tunsigned int rq_ftimeleft;\t/* time left for excessive files */\n};\t\n\nenum gqr_status {\n\tQ_OK = 1,\t\t/* quota returned */\n\tQ_NOQUOTA = 2,  \t/* noquota for uid */\n\tQ_EPERM = 3\t\t/* no permission to access quota */\n};\n\nunion getquota_rslt switch (gqr_status status) {\ncase Q_OK:\n\trquota gqr_rquota;\t/* valid if status == Q_OK */\ncase Q_NOQUOTA:\n\tvoid;\ncase Q_EPERM:\n\tvoid;\n};\n\nprogram RQUOTAPROG {\n\tversion RQUOTAVERS {\n\t\t/*\n\t\t * Get all quotas\n\t\t */\n\t\tgetquota_rslt\n\t\tRQUOTAPROC_GETQUOTA(getquota_args) = 1;\n\n\t\t/*\n\t \t * Get active quotas only\n\t\t */\n\t\tgetquota_rslt\n\t\tRQUOTAPROC_GETACTIVEQUOTA(getquota_args) = 2;\n\t} = 1;\n} = 100011;\n"
  },
  {
    "path": "freebsd-headers/rpcsvc/rstat.h",
    "content": "/*\n * Please do not edit this file.\n * It was generated using rpcgen.\n */\n\n#ifndef _RSTAT_H_RPCGEN\n#define\t_RSTAT_H_RPCGEN\n\n#include <rpc/rpc.h>\n\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\n#ifndef FSCALE\n/*\n * Scale factor for scaled integers used to count load averages.\n */\n#define FSHIFT 8 /* bits to right of fixed binary point */\n#define FSCALE (1<<FSHIFT)\n\n#endif /* ndef FSCALE */\n#define\tRSTAT_CPUSTATES 4\n#define\tRSTAT_DK_NDRIVE 4\n\nstruct rstat_timeval {\n\tu_int tv_sec;\n\tu_int tv_usec;\n};\ntypedef struct rstat_timeval rstat_timeval;\n\nstruct statstime {\n\tint cp_time[RSTAT_CPUSTATES];\n\tint dk_xfer[RSTAT_DK_NDRIVE];\n\tu_int v_pgpgin;\n\tu_int v_pgpgout;\n\tu_int v_pswpin;\n\tu_int v_pswpout;\n\tu_int v_intr;\n\tint if_ipackets;\n\tint if_ierrors;\n\tint if_oerrors;\n\tint if_collisions;\n\tu_int v_swtch;\n\tint avenrun[3];\n\trstat_timeval boottime;\n\trstat_timeval curtime;\n\tint if_opackets;\n};\ntypedef struct statstime statstime;\n\nstruct statsswtch {\n\tint cp_time[RSTAT_CPUSTATES];\n\tint dk_xfer[RSTAT_DK_NDRIVE];\n\tu_int v_pgpgin;\n\tu_int v_pgpgout;\n\tu_int v_pswpin;\n\tu_int v_pswpout;\n\tu_int v_intr;\n\tint if_ipackets;\n\tint if_ierrors;\n\tint if_oerrors;\n\tint if_collisions;\n\tu_int v_swtch;\n\tu_int avenrun[3];\n\trstat_timeval boottime;\n\tint if_opackets;\n};\ntypedef struct statsswtch statsswtch;\n\nstruct stats {\n\tint cp_time[RSTAT_CPUSTATES];\n\tint dk_xfer[RSTAT_DK_NDRIVE];\n\tu_int v_pgpgin;\n\tu_int v_pgpgout;\n\tu_int v_pswpin;\n\tu_int v_pswpout;\n\tu_int v_intr;\n\tint if_ipackets;\n\tint if_ierrors;\n\tint if_oerrors;\n\tint if_collisions;\n\tint if_opackets;\n};\ntypedef struct stats stats;\n\nenum clnt_stat rstat(char *, struct statstime *);\nint havedisk(char *);\n\n\n#define\tRSTATPROG ((unsigned long)(100001))\n#define\tRSTATVERS_TIME ((unsigned long)(3))\n\nextern  void rstatprog_3(struct svc_req *rqstp, SVCXPRT *transp);\n#define\tRSTATPROC_STATS ((unsigned long)(1))\nextern  statstime * rstatproc_stats_3(void *, CLIENT *);\nextern  statstime * rstatproc_stats_3_svc(void *, struct svc_req *);\n#define\tRSTATPROC_HAVEDISK ((unsigned long)(2))\nextern  u_int * rstatproc_havedisk_3(void *, CLIENT *);\nextern  u_int * rstatproc_havedisk_3_svc(void *, struct svc_req *);\nextern int rstatprog_3_freeresult(SVCXPRT *, xdrproc_t, caddr_t);\n#define\tRSTATVERS_SWTCH ((unsigned long)(2))\n\nextern  void rstatprog_2(struct svc_req *rqstp, SVCXPRT *transp);\nextern  statsswtch * rstatproc_stats_2(void *, CLIENT *);\nextern  statsswtch * rstatproc_stats_2_svc(void *, struct svc_req *);\nextern  u_int * rstatproc_havedisk_2(void *, CLIENT *);\nextern  u_int * rstatproc_havedisk_2_svc(void *, struct svc_req *);\nextern int rstatprog_2_freeresult(SVCXPRT *, xdrproc_t, caddr_t);\n#define\tRSTATVERS_ORIG ((unsigned long)(1))\n\nextern  void rstatprog_1(struct svc_req *rqstp, SVCXPRT *transp);\nextern  stats * rstatproc_stats_1(void *, CLIENT *);\nextern  stats * rstatproc_stats_1_svc(void *, struct svc_req *);\nextern  u_int * rstatproc_havedisk_1(void *, CLIENT *);\nextern  u_int * rstatproc_havedisk_1_svc(void *, struct svc_req *);\nextern int rstatprog_1_freeresult(SVCXPRT *, xdrproc_t, caddr_t);\n\n/* the xdr functions */\nextern  bool_t xdr_rstat_timeval(XDR *, rstat_timeval*);\nextern  bool_t xdr_statstime(XDR *, statstime*);\nextern  bool_t xdr_statsswtch(XDR *, statsswtch*);\nextern  bool_t xdr_stats(XDR *, stats*);\n\n#ifdef __cplusplus\n}\n#endif\n\n#endif /* !_RSTAT_H_RPCGEN */\n"
  },
  {
    "path": "freebsd-headers/rpcsvc/rstat.x",
    "content": "/*\n * Sun RPC is a product of Sun Microsystems, Inc. and is provided for\n * unrestricted use provided that this legend is included on all tape\n * media and as a part of the software program in whole or part.  Users\n * may copy or modify Sun RPC without charge, but are not authorized\n * to license or distribute it to anyone else except as part of a product or\n * program developed by the user.\n * \n * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE\n * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR\n * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.\n * \n * Sun RPC is provided with no support and without any obligation on the\n * part of Sun Microsystems, Inc. to assist in its use, correction,\n * modification or enhancement.\n * \n * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE\n * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC\n * OR ANY PART THEREOF.\n * \n * In no event will Sun Microsystems, Inc. be liable for any lost revenue\n * or profits or other special, indirect and consequential damages, even if\n * Sun has been advised of the possibility of such damages.\n * \n * Sun Microsystems, Inc.\n * 2550 Garcia Avenue\n * Mountain View, California  94043\n */\n\n/*\n * Gather statistics on remote machines\n */\n\n#ifdef RPC_HDR\n\n%#ifndef FSCALE\n%/*\n% * Scale factor for scaled integers used to count load averages.\n% */\n%#define FSHIFT  8               /* bits to right of fixed binary point */\n%#define FSCALE  (1<<FSHIFT)\n%\n%#endif /* ndef FSCALE */\n\n#else\n\n%#ifndef lint\n%/*static char sccsid[] = \"from: @(#)rstat.x 1.2 87/09/18 Copyr 1987 Sun Micro\";*/\n%/*static char sccsid[] = \"from: @(#)rstat.x\t2.2 88/08/01 4.0 RPCSRC\";*/\n%#endif /* not lint */\n%#include <sys/cdefs.h>\n%__FBSDID(\"$FreeBSD: release/9.0.0/include/rpcsvc/rstat.x 114629 2003-05-04 02:51:42Z obrien $\");\n\n#endif /* def RPC_HDR */\n\nconst RSTAT_CPUSTATES = 4;\nconst RSTAT_DK_NDRIVE = 4;\n\n/*\n * GMT since 0:00, January 1, 1970\n */\nstruct rstat_timeval {\n\tunsigned int tv_sec;\t/* seconds */\n\tunsigned int tv_usec;\t/* and microseconds */\n};\n\nstruct statstime {\t\t\t\t/* RSTATVERS_TIME */\n\tint cp_time[RSTAT_CPUSTATES];\n\tint dk_xfer[RSTAT_DK_NDRIVE];\n\tunsigned int v_pgpgin;\t/* these are cumulative sum */\n\tunsigned int v_pgpgout;\n\tunsigned int v_pswpin;\n\tunsigned int v_pswpout;\n\tunsigned int v_intr;\n\tint if_ipackets;\n\tint if_ierrors;\n\tint if_oerrors;\n\tint if_collisions;\n\tunsigned int v_swtch;\n\tint avenrun[3];         /* scaled by FSCALE */\n\trstat_timeval boottime;\n\trstat_timeval curtime;\n\tint if_opackets;\n};\n\nstruct statsswtch {\t\t\t/* RSTATVERS_SWTCH */\n\tint cp_time[RSTAT_CPUSTATES];\n\tint dk_xfer[RSTAT_DK_NDRIVE];\n\tunsigned int v_pgpgin;\t/* these are cumulative sum */\n\tunsigned int v_pgpgout;\n\tunsigned int v_pswpin;\n\tunsigned int v_pswpout;\n\tunsigned int v_intr;\n\tint if_ipackets;\n\tint if_ierrors;\n\tint if_oerrors;\n\tint if_collisions;\n\tunsigned int v_swtch;\n\tunsigned int avenrun[3];/* scaled by FSCALE */\n\trstat_timeval boottime;\n\tint if_opackets;\n};\n\nstruct stats {\t\t\t\t/* RSTATVERS_ORIG */\n\tint cp_time[RSTAT_CPUSTATES];\n\tint dk_xfer[RSTAT_DK_NDRIVE];\n\tunsigned int v_pgpgin;\t/* these are cumulative sum */\n\tunsigned int v_pgpgout;\n\tunsigned int v_pswpin;\n\tunsigned int v_pswpout;\n\tunsigned int v_intr;\n\tint if_ipackets;\n\tint if_ierrors;\n\tint if_oerrors;\n\tint if_collisions;\n\tint if_opackets;\n};\n\n\nprogram RSTATPROG {\n\t/*\n\t * Newest version includes current time and context switching info\n\t */\n\tversion RSTATVERS_TIME {\n\t\tstatstime\n\t\tRSTATPROC_STATS(void) = 1;\n\n\t\tunsigned int\n\t\tRSTATPROC_HAVEDISK(void) = 2;\n\t} = 3;\n\t/*\n\t * Does not have current time\n\t */\n\tversion RSTATVERS_SWTCH {\n\t\tstatsswtch\n\t\tRSTATPROC_STATS(void) = 1;\n\n\t\tunsigned int\n\t\tRSTATPROC_HAVEDISK(void) = 2;\n\t} = 2;\n\t/*\n\t * Old version has no info about current time or context switching\n\t */\n\tversion RSTATVERS_ORIG {\n\t\tstats\n\t\tRSTATPROC_STATS(void) = 1;\n\n\t\tunsigned int\n\t\tRSTATPROC_HAVEDISK(void) = 2;\n\t} = 1;\n} = 100001;\n\n#ifdef RPC_HDR\n%\n%enum clnt_stat rstat(char *, struct statstime *);\n%int havedisk(char *);\n%\n#endif\n"
  },
  {
    "path": "freebsd-headers/rpcsvc/rwall.h",
    "content": "/*\n * Please do not edit this file.\n * It was generated using rpcgen.\n */\n\n#ifndef _RWALL_H_RPCGEN\n#define\t_RWALL_H_RPCGEN\n\n#include <rpc/rpc.h>\n\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\n/*\n * Sun RPC is a product of Sun Microsystems, Inc. and is provided for\n * unrestricted use provided that this legend is included on all tape\n * media and as a part of the software program in whole or part.  Users\n * may copy or modify Sun RPC without charge, but are not authorized\n * to license or distribute it to anyone else except as part of a product or\n * program developed by the user or with the express written consent of\n * Sun Microsystems, Inc.\n *\n * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE\n * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR\n * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.\n *\n * Sun RPC is provided with no support and without any obligation on the\n * part of Sun Microsystems, Inc. to assist in its use, correction,\n * modification or enhancement.\n *\n * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE\n * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC\n * OR ANY PART THEREOF.\n *\n * In no event will Sun Microsystems, Inc. be liable for any lost revenue\n * or profits or other special, indirect and consequential damages, even if\n * Sun has been advised of the possibility of such damages.\n *\n * Sun Microsystems, Inc.\n * 2550 Garcia Avenue\n * Mountain View, California  94043\n */\n/*\n * Copyright (c) 1984, 1990 by Sun Microsystems, Inc.\n */\n\n/* from @(#)rwall.x\t1.6 91/03/11 TIRPC 1.0 */\n\n#ifndef _rpcsvc_rwall_h\n#define _rpcsvc_rwall_h\n\ntypedef char *wrapstring;\n\n\n#endif /* ! _rpcsvc_rwall_h */\n\n#define\tWALLPROG ((unsigned long)(100008))\n#define\tWALLVERS ((unsigned long)(1))\n\nextern  void wallprog_1(struct svc_req *rqstp, SVCXPRT *transp);\n#define\tWALLPROC_WALL ((unsigned long)(2))\nextern  void * wallproc_wall_1(wrapstring *, CLIENT *);\nextern  void * wallproc_wall_1_svc(wrapstring *, struct svc_req *);\nextern int wallprog_1_freeresult(SVCXPRT *, xdrproc_t, caddr_t);\n\n#ifdef __cplusplus\n}\n#endif\n\n#endif /* !_RWALL_H_RPCGEN */\n"
  },
  {
    "path": "freebsd-headers/rpcsvc/rwall.x",
    "content": "%/*\n% * Sun RPC is a product of Sun Microsystems, Inc. and is provided for\n% * unrestricted use provided that this legend is included on all tape\n% * media and as a part of the software program in whole or part.  Users\n% * may copy or modify Sun RPC without charge, but are not authorized\n% * to license or distribute it to anyone else except as part of a product or\n% * program developed by the user or with the express written consent of\n% * Sun Microsystems, Inc.\n% *\n% * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE\n% * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR\n% * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.\n% *\n% * Sun RPC is provided with no support and without any obligation on the\n% * part of Sun Microsystems, Inc. to assist in its use, correction,\n% * modification or enhancement.\n% *\n% * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE\n% * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC\n% * OR ANY PART THEREOF.\n% *\n% * In no event will Sun Microsystems, Inc. be liable for any lost revenue\n% * or profits or other special, indirect and consequential damages, even if\n% * Sun has been advised of the possibility of such damages.\n% *\n% * Sun Microsystems, Inc.\n% * 2550 Garcia Avenue\n% * Mountain View, California  94043\n% */\n\n%/*\n% * Copyright (c) 1984, 1990 by Sun Microsystems, Inc.\n% */\n%\n%/* from @(#)rwall.x\t1.6 91/03/11 TIRPC 1.0 */\n\n#ifdef RPC_HDR\n%\n%#ifndef _rpcsvc_rwall_h\n%#define _rpcsvc_rwall_h\n%\n%typedef char *wrapstring;\n%\n#endif\n\nprogram WALLPROG {\n\tversion WALLVERS {\n\t\tvoid\t\n\t\tWALLPROC_WALL(wrapstring) = 2;\n\n\t} = 1;\n} = 100008;\n\n#ifdef RPC_HDR\n%\n%#endif /* ! _rpcsvc_rwall_h */\n#endif\n"
  },
  {
    "path": "freebsd-headers/rpcsvc/sm_inter.h",
    "content": "/*\n * Please do not edit this file.\n * It was generated using rpcgen.\n */\n\n#ifndef _SM_INTER_H_RPCGEN\n#define\t_SM_INTER_H_RPCGEN\n\n#include <rpc/rpc.h>\n\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\n#define\tSM_MAXSTRLEN 1024\n\nstruct sm_name {\n\tchar *mon_name;\n};\ntypedef struct sm_name sm_name;\n\nstruct my_id {\n\tchar *my_name;\n\tint my_prog;\n\tint my_vers;\n\tint my_proc;\n};\ntypedef struct my_id my_id;\n\nstruct mon_id {\n\tchar *mon_name;\n\tstruct my_id my_id;\n};\ntypedef struct mon_id mon_id;\n\nstruct mon {\n\tstruct mon_id mon_id;\n\tchar priv[16];\n};\ntypedef struct mon mon;\n\nstruct stat_chge {\n\tchar *mon_name;\n\tint state;\n};\ntypedef struct stat_chge stat_chge;\n\nstruct sm_stat {\n\tint state;\n};\ntypedef struct sm_stat sm_stat;\n\nenum sm_res {\n\tstat_succ = 0,\n\tstat_fail = 1\n};\ntypedef enum sm_res sm_res;\n\nstruct sm_stat_res {\n\tsm_res res_stat;\n\tint state;\n};\ntypedef struct sm_stat_res sm_stat_res;\n\nstruct sm_status {\n\tchar *mon_name;\n\tint state;\n\tchar priv[16];\n};\ntypedef struct sm_status sm_status;\n\n#define\tSM_PROG ((unsigned long)(100024))\n#define\tSM_VERS ((unsigned long)(1))\n\nextern  void sm_prog_1(struct svc_req *rqstp, SVCXPRT *transp);\n#define\tSM_STAT ((unsigned long)(1))\nextern  struct sm_stat_res * sm_stat_1(struct sm_name *, CLIENT *);\nextern  struct sm_stat_res * sm_stat_1_svc(struct sm_name *, struct svc_req *);\n#define\tSM_MON ((unsigned long)(2))\nextern  struct sm_stat_res * sm_mon_1(struct mon *, CLIENT *);\nextern  struct sm_stat_res * sm_mon_1_svc(struct mon *, struct svc_req *);\n#define\tSM_UNMON ((unsigned long)(3))\nextern  struct sm_stat * sm_unmon_1(struct mon_id *, CLIENT *);\nextern  struct sm_stat * sm_unmon_1_svc(struct mon_id *, struct svc_req *);\n#define\tSM_UNMON_ALL ((unsigned long)(4))\nextern  struct sm_stat * sm_unmon_all_1(struct my_id *, CLIENT *);\nextern  struct sm_stat * sm_unmon_all_1_svc(struct my_id *, struct svc_req *);\n#define\tSM_SIMU_CRASH ((unsigned long)(5))\nextern  void * sm_simu_crash_1(void *, CLIENT *);\nextern  void * sm_simu_crash_1_svc(void *, struct svc_req *);\n#define\tSM_NOTIFY ((unsigned long)(6))\nextern  void * sm_notify_1(struct stat_chge *, CLIENT *);\nextern  void * sm_notify_1_svc(struct stat_chge *, struct svc_req *);\nextern int sm_prog_1_freeresult(SVCXPRT *, xdrproc_t, caddr_t);\n\n/* the xdr functions */\nextern  bool_t xdr_sm_name(XDR *, sm_name*);\nextern  bool_t xdr_my_id(XDR *, my_id*);\nextern  bool_t xdr_mon_id(XDR *, mon_id*);\nextern  bool_t xdr_mon(XDR *, mon*);\nextern  bool_t xdr_stat_chge(XDR *, stat_chge*);\nextern  bool_t xdr_sm_stat(XDR *, sm_stat*);\nextern  bool_t xdr_sm_res(XDR *, sm_res*);\nextern  bool_t xdr_sm_stat_res(XDR *, sm_stat_res*);\nextern  bool_t xdr_sm_status(XDR *, sm_status*);\n\n#ifdef __cplusplus\n}\n#endif\n\n#endif /* !_SM_INTER_H_RPCGEN */\n"
  },
  {
    "path": "freebsd-headers/rpcsvc/sm_inter.x",
    "content": "/* @(#)sm_inter.x\t2.2 88/08/01 4.0 RPCSRC */\n/* @(#)sm_inter.x 1.7 87/06/24 Copyr 1987 Sun Micro */\n\n/*\n * Sun RPC is a product of Sun Microsystems, Inc. and is provided for\n * unrestricted use provided that this legend is included on all tape\n * media and as a part of the software program in whole or part.  Users\n * may copy or modify Sun RPC without charge, but are not authorized\n * to license or distribute it to anyone else except as part of a product or\n * program developed by the user.\n * \n * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE\n * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR\n * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.\n * \n * Sun RPC is provided with no support and without any obligation on the\n * part of Sun Microsystems, Inc. to assist in its use, correction,\n * modification or enhancement.\n * \n * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE\n * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC\n * OR ANY PART THEREOF.\n * \n * In no event will Sun Microsystems, Inc. be liable for any lost revenue\n * or profits or other special, indirect and consequential damages, even if\n * Sun has been advised of the possibility of such damages.\n * \n * Sun Microsystems, Inc.\n * 2550 Garcia Avenue\n * Mountain View, California  94043\n */\n\n/*\n * Status monitor protocol specification\n * Copyright (C) 1986 Sun Microsystems, Inc.\n *\n */\n\n#ifndef RPC_HDR\n%#include <sys/cdefs.h>\n%__FBSDID(\"$FreeBSD: release/9.0.0/include/rpcsvc/sm_inter.x 114629 2003-05-04 02:51:42Z obrien $\");\n#endif\n\nprogram SM_PROG { \n\tversion SM_VERS  {\n\t\t/* res_stat = stat_succ if status monitor agrees to monitor */\n\t\t/* res_stat = stat_fail if status monitor cannot monitor */\n\t\t/* if res_stat == stat_succ, state = state number of site sm_name */\n\t\tstruct sm_stat_res\t\t\t SM_STAT(struct sm_name) = 1;\n\n\t\t/* res_stat = stat_succ if status monitor agrees to monitor */\n\t\t/* res_stat = stat_fail if status monitor cannot monitor */\n\t\t/* stat consists of state number of local site */\n\t\tstruct sm_stat_res\t\t\t SM_MON(struct mon) = 2;\n\n\t\t/* stat consists of state number of local site */\n\t\tstruct sm_stat\t\t\t\t SM_UNMON(struct mon_id) = 3;\n\n\t\t/* stat consists of state number of local site */\n\t\tstruct sm_stat\t\t\t\t SM_UNMON_ALL(struct my_id) = 4;\n\n\t\tvoid\t\t\t\t\t SM_SIMU_CRASH(void) = 5;\n\t\tvoid\t\t\t\t\t SM_NOTIFY(struct stat_chge) = 6;\n\n\t} = 1;\n} = 100024;\n\nconst\tSM_MAXSTRLEN = 1024;\n\nstruct sm_name {\n\tstring mon_name<SM_MAXSTRLEN>;\n};\n\nstruct my_id {\n\tstring\t my_name<SM_MAXSTRLEN>;\t\t/* name of the site iniates the monitoring request*/\n\tint\tmy_prog;\t\t\t/* rpc program # of the requesting process */\n\tint\tmy_vers;\t\t\t/* rpc version # of the requesting process */\n\tint\tmy_proc;\t\t\t/* rpc procedure # of the requesting process */\n};\n\nstruct mon_id {\n\tstring\tmon_name<SM_MAXSTRLEN>;\t\t/* name of the site to be monitored */\n\tstruct my_id my_id;\n};\n\n\nstruct mon{\n\tstruct mon_id mon_id;\n\topaque priv[16]; \t\t/* private information to store at monitor for requesting process */\n};\n\nstruct stat_chge {\n\tstring  mon_name<SM_MAXSTRLEN>;         /* name of the site that had the state change */\n\tint state;\n};\n\n/*\n * state # of status monitor monitonically increases each time\n * status of the site changes:\n * an even number (>= 0) indicates the site is down and\n * an odd number (> 0) indicates the site is up;\n */\nstruct sm_stat {\n\tint state;\t\t/* state # of status monitor */\n};\n\nenum sm_res {\n\tstat_succ = 0,\t\t/* status monitor agrees to monitor */\n\tstat_fail = 1\t\t/* status monitor cannot monitor */\n};\n\nstruct sm_stat_res {\n\tsm_res res_stat;\n\tint state;\n};\n\n/* \n * structure of the status message sent back by the status monitor\n * when monitor site status changes\n */\nstruct sm_status {\n\tstring mon_name<SM_MAXSTRLEN>;\n\tint state;\n\topaque priv[16];\t\t/* stored private information */\n};\n"
  },
  {
    "path": "freebsd-headers/rpcsvc/spray.h",
    "content": "/*\n * Please do not edit this file.\n * It was generated using rpcgen.\n */\n\n#ifndef _SPRAY_H_RPCGEN\n#define\t_SPRAY_H_RPCGEN\n\n#include <rpc/rpc.h>\n\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\n#define\tSPRAYMAX 8845\n\nstruct spraytimeval {\n\tu_int sec;\n\tu_int usec;\n};\ntypedef struct spraytimeval spraytimeval;\n\nstruct spraycumul {\n\tu_int counter;\n\tspraytimeval clock;\n};\ntypedef struct spraycumul spraycumul;\n\ntypedef struct {\n\tu_int sprayarr_len;\n\tchar *sprayarr_val;\n} sprayarr;\n\n#define\tSPRAYPROG ((unsigned long)(100012))\n#define\tSPRAYVERS ((unsigned long)(1))\n\nextern  void sprayprog_1(struct svc_req *rqstp, SVCXPRT *transp);\n#define\tSPRAYPROC_SPRAY ((unsigned long)(1))\nextern  void * sprayproc_spray_1(sprayarr *, CLIENT *);\nextern  void * sprayproc_spray_1_svc(sprayarr *, struct svc_req *);\n#define\tSPRAYPROC_GET ((unsigned long)(2))\nextern  spraycumul * sprayproc_get_1(void *, CLIENT *);\nextern  spraycumul * sprayproc_get_1_svc(void *, struct svc_req *);\n#define\tSPRAYPROC_CLEAR ((unsigned long)(3))\nextern  void * sprayproc_clear_1(void *, CLIENT *);\nextern  void * sprayproc_clear_1_svc(void *, struct svc_req *);\nextern int sprayprog_1_freeresult(SVCXPRT *, xdrproc_t, caddr_t);\n\n/* the xdr functions */\nextern  bool_t xdr_spraytimeval(XDR *, spraytimeval*);\nextern  bool_t xdr_spraycumul(XDR *, spraycumul*);\nextern  bool_t xdr_sprayarr(XDR *, sprayarr*);\n\n#ifdef __cplusplus\n}\n#endif\n\n#endif /* !_SPRAY_H_RPCGEN */\n"
  },
  {
    "path": "freebsd-headers/rpcsvc/spray.x",
    "content": "/*\n * Sun RPC is a product of Sun Microsystems, Inc. and is provided for\n * unrestricted use provided that this legend is included on all tape\n * media and as a part of the software program in whole or part.  Users\n * may copy or modify Sun RPC without charge, but are not authorized\n * to license or distribute it to anyone else except as part of a product or\n * program developed by the user.\n * \n * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE\n * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR\n * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.\n * \n * Sun RPC is provided with no support and without any obligation on the\n * part of Sun Microsystems, Inc. to assist in its use, correction,\n * modification or enhancement.\n * \n * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE\n * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC\n * OR ANY PART THEREOF.\n * \n * In no event will Sun Microsystems, Inc. be liable for any lost revenue\n * or profits or other special, indirect and consequential damages, even if\n * Sun has been advised of the possibility of such damages.\n * \n * Sun Microsystems, Inc.\n * 2550 Garcia Avenue\n * Mountain View, California  94043\n */\n\n/*\n * Spray a server with packets\n * Useful for testing flakiness of network interfaces\n */\n\n#ifndef RPC_HDR\n%#ifndef lint\n%/*static char sccsid[] = \"from: @(#)spray.x 1.2 87/09/18 Copyr 1987 Sun Micro\";*/\n%/*static char sccsid[] = \"from: @(#)spray.x\t2.1 88/08/01 4.0 RPCSRC\";*/\n%#endif /* not lint */\n%#include <sys/cdefs.h>\n%__FBSDID(\"$FreeBSD: release/9.0.0/include/rpcsvc/spray.x 114629 2003-05-04 02:51:42Z obrien $\");\n#endif\n\nconst SPRAYMAX = 8845;\t/* max amount can spray */\n\n/*\n * GMT since 0:00, 1 January 1970\n */\nstruct spraytimeval {\n\tunsigned int sec;\n\tunsigned int usec;\n};\n\n/*\n * spray statistics\n */\nstruct spraycumul {\n\tunsigned int counter;\n\tspraytimeval clock;\n};\n\n/*\n * spray data\n */\ntypedef opaque sprayarr<SPRAYMAX>;\n\nprogram SPRAYPROG {\n\tversion SPRAYVERS {\n\t\t/*\n\t\t * Just throw away the data and increment the counter\n\t\t * This call never returns, so the client should always \n\t\t * time it out.\n\t\t */\n\t\tvoid\n\t\tSPRAYPROC_SPRAY(sprayarr) = 1;\n\n\t\t/*\n\t\t * Get the value of the counter and elapsed time  since\n\t\t * last CLEAR.\n\t\t */\n\t\tspraycumul\t\n\t\tSPRAYPROC_GET(void) = 2;\n\n\t\t/*\n\t\t * Clear the counter and reset the elapsed time\n\t\t */\n\t\tvoid\n\t\tSPRAYPROC_CLEAR(void) = 3;\n\t} = 1;\n} = 100012;\n"
  },
  {
    "path": "freebsd-headers/rpcsvc/yp.h",
    "content": "/*\n * Please do not edit this file.\n * It was generated using rpcgen.\n */\n\n#ifndef _YP_H_RPCGEN\n#define\t_YP_H_RPCGEN\n\n#include <rpc/rpc.h>\n\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\n#define\tYPMAXRECORD 1024\n#define\tYPMAXDOMAIN 64\n#define\tYPMAXMAP 64\n#define\tYPMAXPEER 64\n\nenum ypstat {\n\tYP_TRUE = 1,\n\tYP_NOMORE = 2,\n\tYP_FALSE = 0,\n\tYP_NOMAP = -1,\n\tYP_NODOM = -2,\n\tYP_NOKEY = -3,\n\tYP_BADOP = -4,\n\tYP_BADDB = -5,\n\tYP_YPERR = -6,\n\tYP_BADARGS = -7,\n\tYP_VERS = -8\n};\ntypedef enum ypstat ypstat;\n\nenum ypxfrstat {\n\tYPXFR_SUCC = 1,\n\tYPXFR_AGE = 2,\n\tYPXFR_NOMAP = -1,\n\tYPXFR_NODOM = -2,\n\tYPXFR_RSRC = -3,\n\tYPXFR_RPC = -4,\n\tYPXFR_MADDR = -5,\n\tYPXFR_YPERR = -6,\n\tYPXFR_BADARGS = -7,\n\tYPXFR_DBM = -8,\n\tYPXFR_FILE = -9,\n\tYPXFR_SKEW = -10,\n\tYPXFR_CLEAR = -11,\n\tYPXFR_FORCE = -12,\n\tYPXFR_XFRERR = -13,\n\tYPXFR_REFUSED = -14\n};\ntypedef enum ypxfrstat ypxfrstat;\n\ntypedef char *domainname;\n\ntypedef char *mapname;\n\ntypedef char *peername;\n\ntypedef struct {\n\tu_int keydat_len;\n\tchar *keydat_val;\n} keydat;\n\ntypedef struct {\n\tu_int valdat_len;\n\tchar *valdat_val;\n} valdat;\n\nstruct ypmap_parms {\n\tdomainname domain;\n\tmapname map;\n\tu_int ordernum;\n\tpeername peer;\n};\ntypedef struct ypmap_parms ypmap_parms;\n\nstruct ypreq_key {\n\tdomainname domain;\n\tmapname map;\n\tkeydat key;\n};\ntypedef struct ypreq_key ypreq_key;\n\nstruct ypreq_nokey {\n\tdomainname domain;\n\tmapname map;\n};\ntypedef struct ypreq_nokey ypreq_nokey;\n\nstruct ypreq_xfr {\n\typmap_parms map_parms;\n\tu_int transid;\n\tu_int prog;\n\tu_int port;\n};\ntypedef struct ypreq_xfr ypreq_xfr;\n\nstruct ypresp_val {\n\typstat stat;\n\tvaldat val;\n};\ntypedef struct ypresp_val ypresp_val;\n\nstruct ypresp_key_val {\n\typstat stat;\n\tvaldat val;\n\tkeydat key;\n};\ntypedef struct ypresp_key_val ypresp_key_val;\n\nstruct ypresp_master {\n\typstat stat;\n\tpeername peer;\n};\ntypedef struct ypresp_master ypresp_master;\n\nstruct ypresp_order {\n\typstat stat;\n\tu_int ordernum;\n};\ntypedef struct ypresp_order ypresp_order;\n\nstruct ypresp_all {\n\tbool_t more;\n\tunion {\n\t\typresp_key_val val;\n\t} ypresp_all_u;\n};\ntypedef struct ypresp_all ypresp_all;\n\nstruct ypresp_xfr {\n\tu_int transid;\n\typxfrstat xfrstat;\n};\ntypedef struct ypresp_xfr ypresp_xfr;\n\nstruct ypmaplist {\n\tmapname map;\n\tstruct ypmaplist *next;\n};\ntypedef struct ypmaplist ypmaplist;\n\nstruct ypresp_maplist {\n\typstat stat;\n\typmaplist *maps;\n};\ntypedef struct ypresp_maplist ypresp_maplist;\n\nenum yppush_status {\n\tYPPUSH_SUCC = 1,\n\tYPPUSH_AGE = 2,\n\tYPPUSH_NOMAP = -1,\n\tYPPUSH_NODOM = -2,\n\tYPPUSH_RSRC = -3,\n\tYPPUSH_RPC = -4,\n\tYPPUSH_MADDR = -5,\n\tYPPUSH_YPERR = -6,\n\tYPPUSH_BADARGS = -7,\n\tYPPUSH_DBM = -8,\n\tYPPUSH_FILE = -9,\n\tYPPUSH_SKEW = -10,\n\tYPPUSH_CLEAR = -11,\n\tYPPUSH_FORCE = -12,\n\tYPPUSH_XFRERR = -13,\n\tYPPUSH_REFUSED = -14\n};\ntypedef enum yppush_status yppush_status;\n\nstruct yppushresp_xfr {\n\tu_int transid;\n\typpush_status status;\n};\ntypedef struct yppushresp_xfr yppushresp_xfr;\n\nenum ypbind_resptype {\n\tYPBIND_SUCC_VAL = 1,\n\tYPBIND_FAIL_VAL = 2\n};\ntypedef enum ypbind_resptype ypbind_resptype;\n\nstruct ypbind_binding {\n\tchar ypbind_binding_addr[4];\n\tchar ypbind_binding_port[2];\n};\ntypedef struct ypbind_binding ypbind_binding;\n\nstruct ypbind_resp {\n\typbind_resptype ypbind_status;\n\tunion {\n\t\tu_int ypbind_error;\n\t\typbind_binding ypbind_bindinfo;\n\t} ypbind_resp_u;\n};\ntypedef struct ypbind_resp ypbind_resp;\n#define\tYPBIND_ERR_ERR 1\n#define\tYPBIND_ERR_NOSERV 2\n#define\tYPBIND_ERR_RESC 3\n\nstruct ypbind_setdom {\n\tdomainname ypsetdom_domain;\n\typbind_binding ypsetdom_binding;\n\tu_int ypsetdom_vers;\n};\ntypedef struct ypbind_setdom ypbind_setdom;\n\nenum ypreqtype {\n\tYPREQ_KEY = 1,\n\tYPREQ_NOKEY = 2,\n\tYPREQ_MAP_PARMS = 3\n};\ntypedef enum ypreqtype ypreqtype;\n\nenum ypresptype {\n\tYPRESP_VAL = 1,\n\tYPRESP_KEY_VAL = 2,\n\tYPRESP_MAP_PARMS = 3\n};\ntypedef enum ypresptype ypresptype;\n\nstruct yprequest {\n\typreqtype yp_reqtype;\n\tunion {\n\t\typreq_key yp_req_keytype;\n\t\typreq_nokey yp_req_nokeytype;\n\t\typmap_parms yp_req_map_parmstype;\n\t} yprequest_u;\n};\ntypedef struct yprequest yprequest;\n\nstruct ypresponse {\n\typresptype yp_resptype;\n\tunion {\n\t\typresp_val yp_resp_valtype;\n\t\typresp_key_val yp_resp_key_valtype;\n\t\typmap_parms yp_resp_map_parmstype;\n\t} ypresponse_u;\n};\ntypedef struct ypresponse ypresponse;\n\n#define\tYPPROG ((unsigned long)(100004))\n#define\tYPOLDVERS ((unsigned long)(1))\n\nextern  void ypprog_1(struct svc_req *rqstp, SVCXPRT *transp);\n#define\tYPOLDPROC_NULL ((unsigned long)(0))\nextern  void * ypoldproc_null_1(void *, CLIENT *);\nextern  void * ypoldproc_null_1_svc(void *, struct svc_req *);\n#define\tYPOLDPROC_DOMAIN ((unsigned long)(1))\nextern  bool_t * ypoldproc_domain_1(domainname *, CLIENT *);\nextern  bool_t * ypoldproc_domain_1_svc(domainname *, struct svc_req *);\n#define\tYPOLDPROC_DOMAIN_NONACK ((unsigned long)(2))\nextern  bool_t * ypoldproc_domain_nonack_1(domainname *, CLIENT *);\nextern  bool_t * ypoldproc_domain_nonack_1_svc(domainname *, struct svc_req *);\n#define\tYPOLDPROC_MATCH ((unsigned long)(3))\nextern  ypresponse * ypoldproc_match_1(yprequest *, CLIENT *);\nextern  ypresponse * ypoldproc_match_1_svc(yprequest *, struct svc_req *);\n#define\tYPOLDPROC_FIRST ((unsigned long)(4))\nextern  ypresponse * ypoldproc_first_1(yprequest *, CLIENT *);\nextern  ypresponse * ypoldproc_first_1_svc(yprequest *, struct svc_req *);\n#define\tYPOLDPROC_NEXT ((unsigned long)(5))\nextern  ypresponse * ypoldproc_next_1(yprequest *, CLIENT *);\nextern  ypresponse * ypoldproc_next_1_svc(yprequest *, struct svc_req *);\n#define\tYPOLDPROC_POLL ((unsigned long)(6))\nextern  ypresponse * ypoldproc_poll_1(yprequest *, CLIENT *);\nextern  ypresponse * ypoldproc_poll_1_svc(yprequest *, struct svc_req *);\n#define\tYPOLDPROC_PUSH ((unsigned long)(7))\nextern  ypresponse * ypoldproc_push_1(yprequest *, CLIENT *);\nextern  ypresponse * ypoldproc_push_1_svc(yprequest *, struct svc_req *);\n#define\tYPOLDPROC_PULL ((unsigned long)(8))\nextern  ypresponse * ypoldproc_pull_1(yprequest *, CLIENT *);\nextern  ypresponse * ypoldproc_pull_1_svc(yprequest *, struct svc_req *);\n#define\tYPOLDPROC_GET ((unsigned long)(9))\nextern  ypresponse * ypoldproc_get_1(yprequest *, CLIENT *);\nextern  ypresponse * ypoldproc_get_1_svc(yprequest *, struct svc_req *);\nextern int ypprog_1_freeresult(SVCXPRT *, xdrproc_t, caddr_t);\n#define\tYPVERS ((unsigned long)(2))\n\nextern  void ypprog_2(struct svc_req *rqstp, SVCXPRT *transp);\n#define\tYPPROC_NULL ((unsigned long)(0))\nextern  void * ypproc_null_2(void *, CLIENT *);\nextern  void * ypproc_null_2_svc(void *, struct svc_req *);\n#define\tYPPROC_DOMAIN ((unsigned long)(1))\nextern  bool_t * ypproc_domain_2(domainname *, CLIENT *);\nextern  bool_t * ypproc_domain_2_svc(domainname *, struct svc_req *);\n#define\tYPPROC_DOMAIN_NONACK ((unsigned long)(2))\nextern  bool_t * ypproc_domain_nonack_2(domainname *, CLIENT *);\nextern  bool_t * ypproc_domain_nonack_2_svc(domainname *, struct svc_req *);\n#define\tYPPROC_MATCH ((unsigned long)(3))\nextern  ypresp_val * ypproc_match_2(ypreq_key *, CLIENT *);\nextern  ypresp_val * ypproc_match_2_svc(ypreq_key *, struct svc_req *);\n#define\tYPPROC_FIRST ((unsigned long)(4))\nextern  ypresp_key_val * ypproc_first_2(ypreq_nokey *, CLIENT *);\nextern  ypresp_key_val * ypproc_first_2_svc(ypreq_nokey *, struct svc_req *);\n#define\tYPPROC_NEXT ((unsigned long)(5))\nextern  ypresp_key_val * ypproc_next_2(ypreq_key *, CLIENT *);\nextern  ypresp_key_val * ypproc_next_2_svc(ypreq_key *, struct svc_req *);\n#define\tYPPROC_XFR ((unsigned long)(6))\nextern  ypresp_xfr * ypproc_xfr_2(ypreq_xfr *, CLIENT *);\nextern  ypresp_xfr * ypproc_xfr_2_svc(ypreq_xfr *, struct svc_req *);\n#define\tYPPROC_CLEAR ((unsigned long)(7))\nextern  void * ypproc_clear_2(void *, CLIENT *);\nextern  void * ypproc_clear_2_svc(void *, struct svc_req *);\n#define\tYPPROC_ALL ((unsigned long)(8))\nextern  ypresp_all * ypproc_all_2(ypreq_nokey *, CLIENT *);\nextern  ypresp_all * ypproc_all_2_svc(ypreq_nokey *, struct svc_req *);\n#define\tYPPROC_MASTER ((unsigned long)(9))\nextern  ypresp_master * ypproc_master_2(ypreq_nokey *, CLIENT *);\nextern  ypresp_master * ypproc_master_2_svc(ypreq_nokey *, struct svc_req *);\n#define\tYPPROC_ORDER ((unsigned long)(10))\nextern  ypresp_order * ypproc_order_2(ypreq_nokey *, CLIENT *);\nextern  ypresp_order * ypproc_order_2_svc(ypreq_nokey *, struct svc_req *);\n#define\tYPPROC_MAPLIST ((unsigned long)(11))\nextern  ypresp_maplist * ypproc_maplist_2(domainname *, CLIENT *);\nextern  ypresp_maplist * ypproc_maplist_2_svc(domainname *, struct svc_req *);\nextern int ypprog_2_freeresult(SVCXPRT *, xdrproc_t, caddr_t);\n\n#define\tYPPUSH_XFRRESPPROG ((unsigned long)(0x40000000))\n#define\tYPPUSH_XFRRESPVERS ((unsigned long)(1))\n\nextern  void yppush_xfrrespprog_1(struct svc_req *rqstp, SVCXPRT *transp);\n#define\tYPPUSHPROC_NULL ((unsigned long)(0))\nextern  void * yppushproc_null_1(void *, CLIENT *);\nextern  void * yppushproc_null_1_svc(void *, struct svc_req *);\n#define\tYPPUSHPROC_XFRRESP ((unsigned long)(1))\nextern  void * yppushproc_xfrresp_1(yppushresp_xfr *, CLIENT *);\nextern  void * yppushproc_xfrresp_1_svc(yppushresp_xfr *, struct svc_req *);\nextern int yppush_xfrrespprog_1_freeresult(SVCXPRT *, xdrproc_t, caddr_t);\n\n#define\tYPBINDPROG ((unsigned long)(100007))\n#define\tYPBINDVERS ((unsigned long)(2))\n\nextern  void ypbindprog_2(struct svc_req *rqstp, SVCXPRT *transp);\n#define\tYPBINDPROC_NULL ((unsigned long)(0))\nextern  void * ypbindproc_null_2(void *, CLIENT *);\nextern  void * ypbindproc_null_2_svc(void *, struct svc_req *);\n#define\tYPBINDPROC_DOMAIN ((unsigned long)(1))\nextern  ypbind_resp * ypbindproc_domain_2(domainname *, CLIENT *);\nextern  ypbind_resp * ypbindproc_domain_2_svc(domainname *, struct svc_req *);\n#define\tYPBINDPROC_SETDOM ((unsigned long)(2))\nextern  void * ypbindproc_setdom_2(ypbind_setdom *, CLIENT *);\nextern  void * ypbindproc_setdom_2_svc(ypbind_setdom *, struct svc_req *);\nextern int ypbindprog_2_freeresult(SVCXPRT *, xdrproc_t, caddr_t);\n\n/* the xdr functions */\nextern  bool_t xdr_ypstat(XDR *, ypstat*);\nextern  bool_t xdr_ypxfrstat(XDR *, ypxfrstat*);\nextern  bool_t xdr_domainname(XDR *, domainname*);\nextern  bool_t xdr_mapname(XDR *, mapname*);\nextern  bool_t xdr_peername(XDR *, peername*);\nextern  bool_t xdr_keydat(XDR *, keydat*);\nextern  bool_t xdr_valdat(XDR *, valdat*);\nextern  bool_t xdr_ypmap_parms(XDR *, ypmap_parms*);\nextern  bool_t xdr_ypreq_key(XDR *, ypreq_key*);\nextern  bool_t xdr_ypreq_nokey(XDR *, ypreq_nokey*);\nextern  bool_t xdr_ypreq_xfr(XDR *, ypreq_xfr*);\nextern  bool_t xdr_ypresp_val(XDR *, ypresp_val*);\nextern  bool_t xdr_ypresp_key_val(XDR *, ypresp_key_val*);\nextern  bool_t xdr_ypresp_master(XDR *, ypresp_master*);\nextern  bool_t xdr_ypresp_order(XDR *, ypresp_order*);\nextern  bool_t xdr_ypresp_all(XDR *, ypresp_all*);\nextern  bool_t xdr_ypresp_xfr(XDR *, ypresp_xfr*);\nextern  bool_t xdr_ypmaplist(XDR *, ypmaplist*);\nextern  bool_t xdr_ypresp_maplist(XDR *, ypresp_maplist*);\nextern  bool_t xdr_yppush_status(XDR *, yppush_status*);\nextern  bool_t xdr_yppushresp_xfr(XDR *, yppushresp_xfr*);\nextern  bool_t xdr_ypbind_resptype(XDR *, ypbind_resptype*);\nextern  bool_t xdr_ypbind_binding(XDR *, ypbind_binding*);\nextern  bool_t xdr_ypbind_resp(XDR *, ypbind_resp*);\nextern  bool_t xdr_ypbind_setdom(XDR *, ypbind_setdom*);\nextern  bool_t xdr_ypreqtype(XDR *, ypreqtype*);\nextern  bool_t xdr_ypresptype(XDR *, ypresptype*);\nextern  bool_t xdr_yprequest(XDR *, yprequest*);\nextern  bool_t xdr_ypresponse(XDR *, ypresponse*);\n\n#ifdef __cplusplus\n}\n#endif\n\n#endif /* !_YP_H_RPCGEN */\n"
  },
  {
    "path": "freebsd-headers/rpcsvc/yp.x",
    "content": "/* @(#)yp.x\t2.1 88/08/01 4.0 RPCSRC */\n\n/*\n * Sun RPC is a product of Sun Microsystems, Inc. and is provided for\n * unrestricted use provided that this legend is included on all tape\n * media and as a part of the software program in whole or part.  Users\n * may copy or modify Sun RPC without charge, but are not authorized\n * to license or distribute it to anyone else except as part of a product or\n * program developed by the user.\n * \n * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE\n * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR\n * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.\n * \n * Sun RPC is provided with no support and without any obligation on the\n * part of Sun Microsystems, Inc. to assist in its use, correction,\n * modification or enhancement.\n * \n * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE\n * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC\n * OR ANY PART THEREOF.\n * \n * In no event will Sun Microsystems, Inc. be liable for any lost revenue\n * or profits or other special, indirect and consequential damages, even if\n * Sun has been advised of the possibility of such damages.\n * \n * Sun Microsystems, Inc.\n * 2550 Garcia Avenue\n * Mountain View, California  94043\n */\n\n/*\n * Protocol description file for the Yellow Pages Service\n */\n\n#ifndef RPC_HDR\n%#include <sys/cdefs.h>\n%__FBSDID(\"$FreeBSD: release/9.0.0/include/rpcsvc/yp.x 114629 2003-05-04 02:51:42Z obrien $\");\n#endif\n\nconst YPMAXRECORD = 1024;\nconst YPMAXDOMAIN = 64;\nconst YPMAXMAP = 64;\nconst YPMAXPEER = 64;\n\n\nenum ypstat {\n\tYP_TRUE\t\t=  1,\n\tYP_NOMORE\t=  2,\n\tYP_FALSE\t=  0,\n\tYP_NOMAP\t= -1,\n\tYP_NODOM\t= -2,\n\tYP_NOKEY\t= -3,\n\tYP_BADOP\t= -4,\n\tYP_BADDB\t= -5,\n\tYP_YPERR\t= -6,\n\tYP_BADARGS\t= -7,\n\tYP_VERS\t\t= -8\n};\n\n\nenum ypxfrstat {\n\tYPXFR_SUCC\t=  1,\n\tYPXFR_AGE\t=  2,\n\tYPXFR_NOMAP\t= -1,\n\tYPXFR_NODOM\t= -2,\n\tYPXFR_RSRC\t= -3,\n\tYPXFR_RPC\t= -4,\n\tYPXFR_MADDR\t= -5,\n\tYPXFR_YPERR\t= -6,\n\tYPXFR_BADARGS\t= -7,\n\tYPXFR_DBM\t= -8,\n\tYPXFR_FILE\t= -9,\n\tYPXFR_SKEW\t= -10,\n\tYPXFR_CLEAR\t= -11,\n\tYPXFR_FORCE\t= -12,\n\tYPXFR_XFRERR\t= -13,\n\tYPXFR_REFUSED\t= -14\n};\n\n\ntypedef string domainname<YPMAXDOMAIN>;\ntypedef string mapname<YPMAXMAP>;\ntypedef string peername<YPMAXPEER>;\ntypedef opaque keydat<YPMAXRECORD>;\ntypedef opaque valdat<YPMAXRECORD>;\n\n\nstruct ypmap_parms {\n\tdomainname domain;\t\n\tmapname map;\n\tunsigned int ordernum;\n\tpeername peer;\n};\n\nstruct ypreq_key {\n\tdomainname domain;\n\tmapname map;\n\tkeydat key;\n};\n\nstruct ypreq_nokey {\n\tdomainname domain;\t\n\tmapname map;\n};\n\t\nstruct ypreq_xfr {\n\typmap_parms map_parms;\n\tunsigned int transid;\n\tunsigned int prog;\n\tunsigned int port;\n};\n\n\nstruct ypresp_val {\n\typstat stat;\n\tvaldat val;\n};\n\nstruct ypresp_key_val {\n\typstat stat;\n#ifdef STUPID_SUN_BUG /* These are backwards */\n\tkeydat key;\n\tvaldat val;\n#else\n\tvaldat val;\n\tkeydat key;\n#endif\n};\n\n\nstruct ypresp_master {\n\typstat stat;\t\n\tpeername peer;\n};\n\nstruct ypresp_order {\n\typstat stat;\n\tunsigned int ordernum;\n};\n\nunion ypresp_all switch (bool more) {\ncase TRUE:\n\typresp_key_val val;\ncase FALSE:\n\tvoid;\n};\n\nstruct ypresp_xfr {\n\tunsigned int transid;\n\typxfrstat xfrstat;\n};\n\nstruct ypmaplist {\n\tmapname map;\n\typmaplist *next;\n};\n\nstruct ypresp_maplist {\n\typstat stat;\n\typmaplist *maps;\n};\n\nenum yppush_status {\n\tYPPUSH_SUCC\t=  1,\t/* Success */\n\tYPPUSH_AGE \t=  2,\t/* Master's version not newer */\n\tYPPUSH_NOMAP\t= -1,\t/* Can't find server for map */\n\tYPPUSH_NODOM\t= -2,\t/* Domain not supported */\n\tYPPUSH_RSRC\t= -3,\t/* Local resource alloc failure */\n\tYPPUSH_RPC\t= -4,\t/* RPC failure talking to server */\n\tYPPUSH_MADDR \t= -5,\t/* Can't get master address */\n\tYPPUSH_YPERR\t= -6,\t/* YP server/map db error */\n\tYPPUSH_BADARGS\t= -7,\t/* Request arguments bad */\n\tYPPUSH_DBM\t= -8,\t/* Local dbm operation failed */\n\tYPPUSH_FILE\t= -9,\t/* Local file I/O operation failed */\n\tYPPUSH_SKEW\t= -10,\t/* Map version skew during transfer */\n\tYPPUSH_CLEAR\t= -11,\t/* Can't send \"Clear\" req to local ypserv */\n\tYPPUSH_FORCE\t= -12,\t/* No local order number in map  use -f flag. */\n\tYPPUSH_XFRERR \t= -13,\t/* ypxfr error */\n\tYPPUSH_REFUSED\t= -14 \t/* Transfer request refused by ypserv */\n};\n\nstruct yppushresp_xfr {\n\tunsigned transid;\n\typpush_status status;\n};\n\n/*\n * Response structure and overall result status codes.  Success and failure\n * represent two separate response message types.\n */\n \nenum ypbind_resptype {\n\tYPBIND_SUCC_VAL = 1, \n\tYPBIND_FAIL_VAL = 2\n};\n \nstruct ypbind_binding {\n    opaque ypbind_binding_addr[4]; /* In network order */\n    opaque ypbind_binding_port[2]; /* In network order */\n};   \n\nunion ypbind_resp switch (ypbind_resptype ypbind_status) {\ncase YPBIND_FAIL_VAL:\n        unsigned ypbind_error;\ncase YPBIND_SUCC_VAL:\n        ypbind_binding ypbind_bindinfo;\n};     \n\n/* Detailed failure reason codes for response field ypbind_error*/\n \nconst YPBIND_ERR_ERR    = 1;\t/* Internal error */\nconst YPBIND_ERR_NOSERV = 2;\t/* No bound server for passed domain */\nconst YPBIND_ERR_RESC   = 3;\t/* System resource allocation failure */\n \n \n/*\n * Request data structure for ypbind \"Set domain\" procedure.\n */\nstruct ypbind_setdom {\n\tdomainname ypsetdom_domain;\n\typbind_binding ypsetdom_binding;\n\tunsigned ypsetdom_vers;\n};\n\n\n/*\n * NIS v1 support for backwards compatibility\n */\nenum ypreqtype {\n\tYPREQ_KEY = 1,\n\tYPREQ_NOKEY = 2,\n\tYPREQ_MAP_PARMS = 3\n};\n\nenum ypresptype {\n\tYPRESP_VAL = 1,\n\tYPRESP_KEY_VAL = 2,\n\tYPRESP_MAP_PARMS = 3\n};\n\nunion yprequest switch (ypreqtype yp_reqtype) {\ncase YPREQ_KEY:\n\typreq_key yp_req_keytype;\ncase YPREQ_NOKEY:\n\typreq_nokey yp_req_nokeytype;\ncase YPREQ_MAP_PARMS:\n\typmap_parms yp_req_map_parmstype;\n};\n\nunion ypresponse switch (ypresptype yp_resptype) {\ncase YPRESP_VAL:\n\typresp_val yp_resp_valtype;\ncase YPRESP_KEY_VAL:\n\typresp_key_val yp_resp_key_valtype;\ncase YPRESP_MAP_PARMS:\n\typmap_parms yp_resp_map_parmstype;\n};\n\n#if !defined(YPBIND_ONLY) && !defined(YPPUSH_ONLY)\n/*\n * YP access protocol\n */\nprogram YPPROG {\n/*\n * NIS v1 support for backwards compatibility\n */\n\tversion YPOLDVERS {\n\t\tvoid\n\t\tYPOLDPROC_NULL(void) = 0;\n\n\t\tbool\n\t\tYPOLDPROC_DOMAIN(domainname) = 1;\n\n\t\tbool\n\t\tYPOLDPROC_DOMAIN_NONACK(domainname) = 2;\n\n\t\typresponse\n\t\tYPOLDPROC_MATCH(yprequest) = 3;\n\n\t\typresponse\n\t\tYPOLDPROC_FIRST(yprequest) = 4;\n\n\t\typresponse\n\t\tYPOLDPROC_NEXT(yprequest) = 5;\n\n\t\typresponse\n\t\tYPOLDPROC_POLL(yprequest) = 6;\n\n\t\typresponse\n\t\tYPOLDPROC_PUSH(yprequest) = 7;\n\n\t\typresponse\n\t\tYPOLDPROC_PULL(yprequest) = 8;\n\n\t\typresponse\n\t\tYPOLDPROC_GET(yprequest) = 9;\n\t} = 1;\n\n\tversion YPVERS {\n\t\tvoid \n\t\tYPPROC_NULL(void) = 0;\n\n\t\tbool \n\t\tYPPROC_DOMAIN(domainname) = 1;\t\n\n\t\tbool\n\t\tYPPROC_DOMAIN_NONACK(domainname) = 2;\n\n\t\typresp_val\n\t\tYPPROC_MATCH(ypreq_key) = 3;\n\n\t\typresp_key_val \n#ifdef STUPID_SUN_BUG /* should be ypreq_nokey */\n\t\tYPPROC_FIRST(ypreq_key) = 4;\n#else\n\t\tYPPROC_FIRST(ypreq_nokey) = 4;\n#endif\n\t\typresp_key_val \n\t\tYPPROC_NEXT(ypreq_key) = 5;\n\n\t\typresp_xfr\n\t\tYPPROC_XFR(ypreq_xfr) = 6;\n\n\t\tvoid\n\t\tYPPROC_CLEAR(void) = 7;\n\n\t\typresp_all\n\t\tYPPROC_ALL(ypreq_nokey) = 8;\n\n\t\typresp_master\n\t\tYPPROC_MASTER(ypreq_nokey) = 9;\n\n\t\typresp_order\n\t\tYPPROC_ORDER(ypreq_nokey) = 10;\n\n\t\typresp_maplist \n\t\tYPPROC_MAPLIST(domainname) = 11;\n\t} = 2;\n} = 100004;\n#endif\n#if !defined(YPSERV_ONLY) && !defined(YPBIND_ONLY)\n/*\n * YPPUSHPROC_XFRRESP is the callback routine for result of YPPROC_XFR\n */\nprogram YPPUSH_XFRRESPPROG {\n\tversion YPPUSH_XFRRESPVERS {\n\t\tvoid\n\t\tYPPUSHPROC_NULL(void) = 0;\n#ifdef STUPID_SUN_BUG /* argument and return value are backwards */\n\t\typpushresp_xfr\t\n\t\tYPPUSHPROC_XFRRESP(void) = 1;\n#else\n\t\tvoid\n\t\tYPPUSHPROC_XFRRESP(yppushresp_xfr) = 1;\n#endif\n\t} = 1;\n} = 0x40000000;\t/* transient: could be anything up to 0x5fffffff */\n#endif\n#if !defined(YPSERV_ONLY) && !defined(YPPUSH_ONLY)\n/*\n * YP binding protocol\n */\nprogram YPBINDPROG {\n\tversion YPBINDVERS {\n\t\tvoid\n\t\tYPBINDPROC_NULL(void) = 0;\n\t\n\t\typbind_resp\n\t\tYPBINDPROC_DOMAIN(domainname) = 1;\n\n\t\tvoid\n\t\tYPBINDPROC_SETDOM(ypbind_setdom) = 2;\n\t} = 2;\n} = 100007;\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/rpcsvc/yp_prot.h",
    "content": "/*\n * Copyright (c) 1992/3 Theo de Raadt <deraadt@fsa.ca>\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. The name of the author may not be used to endorse or promote\n *    products derived from this software without specific prior written\n *    permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS\n * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY\n * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/include/rpcsvc/yp_prot.h 153149 2005-12-06 02:01:06Z peter $\n */\n\n#ifndef _RPCSVC_YP_PROT_H_\n#define _RPCSVC_YP_PROT_H_\n\n/*\n * YPSERV PROTOCOL:\n *\n * ypserv supports the following procedures:\n *\n * YPPROC_NULL\t\ttakes (void), returns (void).\n * \t\t\tcalled to check if server is alive.\n * YPPROC_DOMAIN\ttakes (char *), returns (bool_t).\n * \t\t\ttrue if ypserv serves the named domain.\n * YPPROC_DOMAIN_NOACK\ttakes (char *), returns (bool_t).\n * \t\t\ttrue if ypserv serves the named domain.\n *\t\t\tused for broadcasts, does not ack if ypserv\n *\t\t\tdoesn't handle named domain.\n * YPPROC_MATCH\t\ttakes (struct ypreq_key), returns (struct ypresp_val)\n * \t\t\tdoes a lookup.\n * YPPROC_FIRST\t\ttakes (struct ypreq_nokey) returns (ypresp_key_val).\n * \t\t\tgets the first key/datum from the map.\n * YPPROC_NEXT\t\ttakes (struct ypreq_key) returns (ypresp_key_val).\n * \t\t\tgets the next key/datum from the map.\n * YPPROC_XFR\t\ttakes (struct ypreq_xfr), returns (void).\n * \t\t\ttells ypserv to check if there is a new version of\n *\t\t\tthe map.\n * YPPROC_CLEAR\t\ttakes (void), returns (void).\n * \t\t\ttells ypserv to flush it's file cache, so that\n *\t\t\tnewly transferred files will get read.\n * YPPROC_ALL\t\ttakes (struct ypreq_nokey), returns (bool_t and\n *\t\t\tstruct ypresp_key_val).\n * \t\t\treturns an array of data, with the bool_t being\n * \t\t\tfalse on the last datum. read the source, it's\n *\t\t\tconvoluted.\n * YPPROC_MASTER\ttakes (struct ypreq_nokey), returns (ypresp_master).\n * YPPROC_ORDER\t\ttakes (struct ypreq_nokey), returns (ypresp_order).\n * YPPROC_MAPLIST\ttakes (char *), returns (struct ypmaplist *).\n */\n\n#ifndef BOOL_DEFINED\ntypedef u_int bool;\n#define BOOL_DEFINED\n#endif\n\n/* Program and version symbols, magic numbers */\n\n#define YPPROG\t\t((u_long)100004)\n#define YPVERS\t\t((u_long)2)\n#define YPVERS_ORIG\t((u_long)1)\n#define YPMAXRECORD\t((u_long)1024)\n#define YPMAXDOMAIN\t((u_long)64)\n#define YPMAXMAP\t((u_long)64)\n#define YPMAXPEER\t((u_long)256)\n\n/*\n * I don't know if anything of sun's depends on this, or if they\n * simply defined it so that their own code wouldn't try to send\n * packets over the ethernet MTU. This YP code doesn't use it.\n */\n#define YPMSGSZ\t\t1600\n\n#ifndef DATUM\ntypedef struct {\n\tchar\t*dptr;\n\tint\tdsize;\n} datum;\n#define DATUM\n#endif\n\nstruct ypmap_parms {\n\tchar *domain;\n\tchar *map;\n\tu_int ordernum;\n\tchar *owner;\n};\n\nstruct ypreq_key {\n\tchar *domain;\n\tchar *map;\n\tdatum keydat;\n};\n\nstruct ypreq_nokey {\n\tchar *domain;\n\tchar *map;\n};\n\nstruct ypreq_xfr {\n\tstruct ypmap_parms map_parms;\n\tu_int transid;\n\tu_int proto;\n\tu_int port;\n};\n#define ypxfr_domain\tmap_parms.domain\n#define ypxfr_map\tmap_parms.map\n#define ypxfr_ordernum\tmap_parms.ordernum\n#define ypxfr_owner\tmap_parms.owner\n\nstruct ypresp_val {\n\tu_int status;\n\tdatum valdat;\n};\n\nstruct ypresp_key_val {\n\tu_int status;\n\tdatum keydat;\n\tdatum valdat;\n};\n\nstruct ypresp_master {\n\tu_int status;\n\tchar *master;\n};\n\nstruct ypresp_order {\n\tu_int status;\n\tu_int ordernum;\n};\n\nstruct ypmaplist {\n\tchar *ypml_name;\n\tstruct ypmaplist *ypml_next;\n};\n\nstruct ypresp_maplist {\n\tu_int status;\n\tstruct ypmaplist *list;\n};\n\n/* ypserv procedure numbers */\n#define YPPROC_NULL\t\t((u_long)0)\n#define YPPROC_DOMAIN\t\t((u_long)1)\n#define YPPROC_DOMAIN_NONACK\t((u_long)2)\n#define YPPROC_MATCH\t\t((u_long)3)\n#define YPPROC_FIRST\t\t((u_long)4)\n#define YPPROC_NEXT\t\t((u_long)5)\n#define YPPROC_XFR\t\t((u_long)6)\n#define YPPROC_CLEAR\t\t((u_long)7)\n#define YPPROC_ALL\t\t((u_long)8)\n#define YPPROC_MASTER\t\t((u_long)9)\n#define YPPROC_ORDER\t\t((u_long)10)\n#define YPPROC_MAPLIST\t\t((u_long)11)\n\n/* ypserv procedure return status values */\n#define YP_TRUE\t \t((long)1)\t/* general purpose success code */\n#define YP_NOMORE \t((long)2)\t/* no more entries in map */\n#define YP_FALSE \t((long)0)\t/* general purpose failure code */\n#define YP_NOMAP \t((long)-1)\t/* no such map in domain */\n#define YP_NODOM \t((long)-2)\t/* domain not supported */\n#define YP_NOKEY \t((long)-3)\t/* no such key in map */\n#define YP_BADOP \t((long)-4)\t/* invalid operation */\n#define YP_BADDB \t((long)-5)\t/* server data base is bad */\n#define YP_YPERR \t((long)-6)\t/* YP server error */\n#define YP_BADARGS \t((long)-7)\t/* request arguments bad */\n#define YP_VERS\t\t((long)-8)\t/* YP server version mismatch */\n\n/*\n * Sun's header file says:\n * \"Domain binding data structure, used by ypclnt package and ypserv modules.\n * Users of the ypclnt package (or of this protocol) don't HAVE to know about\n * it, but it must be available to users because _yp_dobind is a public\n * interface.\"\n *\n * This is totally bogus! Nowhere else does Sun state that _yp_dobind() is\n * a public interface, and I don't know any reason anyone would want to call\n * it. But, just in case anyone does actually expect it to be available..\n * we provide this.. exactly as Sun wants it.\n */\nstruct dom_binding {\n\tstruct dom_binding *dom_pnext;\n\tchar dom_domain[YPMAXDOMAIN + 1];\n\tstruct sockaddr_in dom_server_addr;\n\tu_short dom_server_port;\n\tint dom_socket;\n\tCLIENT *dom_client;\n\tu_short dom_local_port;\n\tlong dom_vers;\n};\n\n/*\n * YPBIND PROTOCOL:\n *\n * ypbind supports the following procedures:\n *\n * YPBINDPROC_NULL\ttakes (void), returns (void).\n *\t\t\tto check if ypbind is running.\n * YPBINDPROC_DOMAIN\ttakes (char *), returns (struct ypbind_resp).\n *\t\t\trequests that ypbind start to serve the\n *\t\t\tnamed domain (if it doesn't already)\n * YPBINDPROC_SETDOM\ttakes (struct ypbind_setdom), returns (void).\n *\t\t\tused by ypset.\n */\n\n#define YPBINDPROG\t\t((u_long)100007)\n#define YPBINDVERS\t\t((u_long)2)\n#define YPBINDVERS_ORIG\t\t((u_long)1)\n\n/* ypbind procedure numbers */\n#define YPBINDPROC_NULL\t\t((u_long)0)\n#define YPBINDPROC_DOMAIN\t((u_long)1)\n#define YPBINDPROC_SETDOM\t((u_long)2)\n\n/* error code in ypbind_resp.ypbind_status */\nenum ypbind_resptype {\n\tYPBIND_SUCC_VAL = 1,\n\tYPBIND_FAIL_VAL = 2\n};\n\n/* network order, of course */\nstruct ypbind_binding {\n\tstruct in_addr\typbind_binding_addr;\n\tu_short\t\typbind_binding_port;\n};\n\nstruct ypbind_resp {\n\tenum ypbind_resptype\typbind_status;\n\tunion {\n\t\tu_int\t\t\typbind_error;\n\t\tstruct ypbind_binding\typbind_bindinfo;\n\t} ypbind_respbody;\n};\n\n/* error code in ypbind_resp.ypbind_respbody.ypbind_error */\n#define YPBIND_ERR_ERR\t\t1\t/* internal error */\n#define YPBIND_ERR_NOSERV\t2\t/* no bound server for passed domain */\n#define YPBIND_ERR_RESC\t\t3\t/* system resource allocation failure */\n\n/*\n * Request data structure for ypbind \"Set domain\" procedure.\n */\nstruct ypbind_setdom {\n\tchar ypsetdom_domain[YPMAXDOMAIN + 1];\n\tstruct ypbind_binding ypsetdom_binding;\n\tu_int ypsetdom_vers;\n};\n#define ypsetdom_addr ypsetdom_binding.ypbind_binding_addr\n#define ypsetdom_port ypsetdom_binding.ypbind_binding_port\n\n/*\n * YPPUSH PROTOCOL:\n *\n * Sun says:\n * \"Protocol between clients (ypxfr, only) and yppush\n *  yppush speaks a protocol in the transient range, which\n *  is supplied to ypxfr as a command-line parameter when it\n *  is activated by ypserv.\"\n *\n * This protocol is not implemented, naturally, because this YP\n * implementation only does the client side.\n */\n#define YPPUSHVERS\t\t((u_long)1)\n#define YPPUSHVERS_ORIG\t\t((u_long)1)\n\n/* yppush procedure numbers */\n#define YPPUSHPROC_NULL\t\t((u_long)0)\n#define YPPUSHPROC_XFRRESP\t((u_long)1)\n\nstruct yppushresp_xfr {\n\tu_int\ttransid;\n\tu_int\tstatus;\n};\n\n/* yppush status value in yppushresp_xfr.status */\n#define YPPUSH_SUCC\t((long)1)\t/* Success */\n#define YPPUSH_AGE\t((long)2)\t/* Master's version not newer */\n#define YPPUSH_NOMAP \t((long)-1)\t/* Can't find server for map */\n#define YPPUSH_NODOM \t((long)-2)\t/* Domain not supported */\n#define YPPUSH_RSRC \t((long)-3)\t/* Local resource alloc failure */\n#define YPPUSH_RPC \t((long)-4)\t/* RPC failure talking to server */\n#define YPPUSH_MADDR\t((long)-5)\t/* Can't get master address */\n#define YPPUSH_YPERR \t((long)-6)\t/* YP server/map db error */\n#define YPPUSH_BADARGS \t((long)-7)\t/* Request arguments bad */\n#define YPPUSH_DBM\t((long)-8)\t/* Local dbm operation failed */\n#define YPPUSH_FILE\t((long)-9)\t/* Local file I/O operation failed */\n#define YPPUSH_SKEW\t((long)-10)\t/* Map version skew during transfer */\n#define YPPUSH_CLEAR\t((long)-11)\t/* Can't send \"Clear\" req to local ypserv */\n#define YPPUSH_FORCE\t((long)-12)\t/* No local order number in map - use -f */\n#define YPPUSH_XFRERR\t((long)-13)\t/* ypxfr error */\n#define YPPUSH_REFUSED\t((long)-14)\t/* Transfer request refused by ypserv */\n\nstruct inaddr;\n__BEGIN_DECLS\nbool_t\txdr_datum(XDR *, datum *);\nbool_t\txdr_ypreq_key(XDR *, struct ypreq_key *);\nbool_t\txdr_ypreq_nokey(XDR *, struct ypreq_nokey *);\nbool_t\txdr_ypreq_xfr(XDR *, struct ypreq_xfr *);\nbool_t\txdr_ypresp_val(XDR *, struct ypresp_val *);\nbool_t\txdr_ypresp_key_val(XDR *, struct ypresp_key_val *);\nbool_t\txdr_ypbind_resp(XDR *, struct ypbind_resp *);\nbool_t\txdr_ypbind_setdom(XDR *, struct ypbind_setdom *);\nbool_t\txdr_yp_inaddr(XDR *, struct inaddr *);\nbool_t\txdr_ypmap_parms(XDR *, struct ypmap_parms *);\nbool_t\txdr_yppushresp_xfr(XDR *, struct yppushresp_xfr *);\nbool_t\txdr_ypresp_order(XDR *, struct ypresp_order *);\nbool_t\txdr_ypresp_master(XDR *, struct ypresp_master *);\nbool_t\txdr_ypresp_maplist(XDR *, struct ypresp_maplist *);\n__END_DECLS\n\n#endif /* _RPCSVC_YP_PROT_H_ */\n"
  },
  {
    "path": "freebsd-headers/rpcsvc/ypclnt.h",
    "content": "/*\n * Copyright (c) 1992/3 Theo de Raadt <deraadt@fsa.ca>\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. The name of the author may not be used to endorse or promote\n *    products derived from this software without specific prior written\n *    permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS\n * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY\n * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/include/rpcsvc/ypclnt.h 121577 2003-10-26 16:35:11Z peter $\n */\n\n#ifndef _RPCSVC_YPCLNT_H_\n#define _RPCSVC_YPCLNT_H_\n\n#include <sys/cdefs.h>\n\n#define YPERR_BADARGS\t1\t\t/* args to function are bad */\n#define YPERR_RPC\t2\t\t/* RPC failure */\n#define YPERR_DOMAIN\t3\t\t/* can't bind to a server for domain */\n#define YPERR_MAP\t4\t\t/* no such map in server's domain */\n#define YPERR_KEY\t5\t\t/* no such key in map */\n#define YPERR_YPERR\t6\t\t/* some internal YP server or client error */\n#define YPERR_RESRC\t7\t\t/* local resource allocation failure */\n#define YPERR_NOMORE\t8\t\t/* no more records in map database */\n#define YPERR_PMAP\t9\t\t/* can't communicate with portmapper */\n#define YPERR_YPBIND\t10\t\t/* can't communicate with ypbind */\n#define YPERR_YPSERV\t11\t\t/* can't communicate with ypserv */\n#define YPERR_NODOM\t12\t\t/* local domain name not set */\n#define YPERR_BADDB\t13\t\t/* YP data base is bad */\n#define YPERR_VERS\t14\t\t/* YP version mismatch */\n#define YPERR_ACCESS\t15\t\t/* access violation */\n#define YPERR_BUSY\t16\t\t/* database is busy */\n\n/*\n * Types of update operations\n */\n#define YPOP_CHANGE\t1\t\t/* change, do not add */\n#define YPOP_INSERT\t2\t\t/* add, do not change */\n#define YPOP_DELETE\t3\t\t/* delete this entry */\n#define YPOP_STORE \t4\t\t/* add, or change */\n\nstruct ypall_callback {\n\t/* return non-0 to stop getting called */\n\tint (*foreach)(unsigned long, char *, int, char *, int, void *);\n\tchar *data;\t\t/* opaque pointer for use of callback fn */\n};\n\nstruct dom_binding;\nstruct ypmaplist;\nstruct ypall_callback;\n\n__BEGIN_DECLS\nint\typ_bind(char *dom);\nint\t_yp_dobind(char *dom, struct dom_binding **ypdb);\nvoid\typ_unbind(char *dom);\nint\typ_get_default_domain(char **domp);\nint\typ_match(char *indomain, char *inmap, const char *inkey, int inkeylen,\n\t    char **outval, int *outvallen);\nint\typ_first(char *indomain, char *inmap, char **outkey, int *outkeylen,\n\t    char **outval, int *outvallen);\nint\typ_next(char *indomain, char *inmap, char *inkey, int inkeylen,\n\t    char **outkey, int *outkeylen, char **outval, int *outvallen);\nint\typ_maplist(char *indomain, struct ypmaplist **outmaplist);\nint\typ_master(char *indomain, char *inmap, char **outname);\nint\typ_order(char *indomain, char *inmap, int *outorder);\nint\typ_all(char *indomain, char *inmap, struct ypall_callback *incallback);\nconst char *yperr_string(int incode);\nconst char *ypbinderr_string(int incode);\nint\typprot_err(unsigned int incode);\n__END_DECLS\n\n#endif /* _RPCSVC_YPCLNT_H_ */\n\n"
  },
  {
    "path": "freebsd-headers/rpcsvc/yppasswd.h",
    "content": "/*\n * Please do not edit this file.\n * It was generated using rpcgen.\n */\n\n#ifndef _YPPASSWD_H_RPCGEN\n#define\t_YPPASSWD_H_RPCGEN\n\n#include <rpc/rpc.h>\n\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\n\nstruct x_passwd {\n\tchar *pw_name;\n\tchar *pw_passwd;\n\tint pw_uid;\n\tint pw_gid;\n\tchar *pw_gecos;\n\tchar *pw_dir;\n\tchar *pw_shell;\n};\ntypedef struct x_passwd x_passwd;\n\nstruct yppasswd {\n\tchar *oldpass;\n\tx_passwd newpw;\n};\ntypedef struct yppasswd yppasswd;\n#include <sys/cdefs.h>\nextern int _yppasswd( char * , struct x_passwd * );\n#define yppasswd(x,y) _yppasswd(x,y)\n\n#define\tYPPASSWDPROG ((unsigned long)(100009))\n#define\tYPPASSWDVERS ((unsigned long)(1))\n\nextern  void yppasswdprog_1(struct svc_req *rqstp, SVCXPRT *transp);\n#define\tYPPASSWDPROC_UPDATE ((unsigned long)(1))\nextern  int * yppasswdproc_update_1(yppasswd *, CLIENT *);\nextern  int * yppasswdproc_update_1_svc(yppasswd *, struct svc_req *);\nextern int yppasswdprog_1_freeresult(SVCXPRT *, xdrproc_t, caddr_t);\n\n/* the xdr functions */\nextern  bool_t xdr_x_passwd(XDR *, x_passwd*);\nextern  bool_t xdr_yppasswd(XDR *, yppasswd*);\n\n#ifdef __cplusplus\n}\n#endif\n\n#endif /* !_YPPASSWD_H_RPCGEN */\n"
  },
  {
    "path": "freebsd-headers/rpcsvc/yppasswd.x",
    "content": "/*\n * Sun RPC is a product of Sun Microsystems, Inc. and is provided for\n * unrestricted use provided that this legend is included on all tape\n * media and as a part of the software program in whole or part.  Users\n * may copy or modify Sun RPC without charge, but are not authorized\n * to license or distribute it to anyone else except as part of a product or\n * program developed by the user.\n * \n * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE\n * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR\n * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.\n * \n * Sun RPC is provided with no support and without any obligation on the\n * part of Sun Microsystems, Inc. to assist in its use, correction,\n * modification or enhancement.\n * \n * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE\n * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC\n * OR ANY PART THEREOF.\n * \n * In no event will Sun Microsystems, Inc. be liable for any lost revenue\n * or profits or other special, indirect and consequential damages, even if\n * Sun has been advised of the possibility of such damages.\n * \n * Sun Microsystems, Inc.\n * 2550 Garcia Avenue\n * Mountain View, California  94043\n */\n\n/*\n * YP password update protocol\n * Requires unix authentication\n */\n\n#ifndef RPC_HDR\n%#ifndef lint\n%/*static char sccsid[] = \"from: @(#)yppasswd.x 1.1 87/04/13 Copyr 1987 Sun Micro\";*/\n%/*static char sccsid[] = \"from: @(#)yppasswd.x\t2.1 88/08/01 4.0 RPCSRC\";*/\n%#endif /* not lint */\n%#include <sys/cdefs.h>\n%__FBSDID(\"$FreeBSD: release/9.0.0/include/rpcsvc/yppasswd.x 114629 2003-05-04 02:51:42Z obrien $\");\n#endif\n\nprogram YPPASSWDPROG {\n\tversion YPPASSWDVERS {\n\t\t/*\n\t\t * Update my passwd entry \n\t\t */\n\t\tint\n\t\tYPPASSWDPROC_UPDATE(yppasswd) = 1;\n\t} = 1;\n} = 100009;\n\n\nstruct x_passwd {\n\tstring pw_name<>;\t/* username */\n\tstring pw_passwd<>;\t/* encrypted password */\n\tint pw_uid;\t\t/* user id */\n\tint pw_gid;\t\t/* group id */\n\tstring pw_gecos<>;\t/* in real life name */\n\tstring pw_dir<>;\t/* home directory */\n\tstring pw_shell<>;\t/* default shell */\n};\n\nstruct yppasswd {\n\tstring oldpass<>;\t/* unencrypted old password */\n\tx_passwd newpw;\t\t/* new passwd entry */\n};\n\n\n#ifdef RPC_HDR\n%#include <sys/cdefs.h>\n%extern int _yppasswd( char * , struct x_passwd * );\n%#define yppasswd(x,y) _yppasswd(x,y)\n#endif\n"
  },
  {
    "path": "freebsd-headers/rpcsvc/ypupdate_prot.h",
    "content": "/*\n * Please do not edit this file.\n * It was generated using rpcgen.\n */\n\n#ifndef _YPUPDATE_PROT_H_RPCGEN\n#define\t_YPUPDATE_PROT_H_RPCGEN\n\n#include <rpc/rpc.h>\n\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\n/*\n * Sun RPC is a product of Sun Microsystems, Inc. and is provided for\n * unrestricted use provided that this legend is included on all tape\n * media and as a part of the software program in whole or part.  Users\n * may copy or modify Sun RPC without charge, but are not authorized\n * to license or distribute it to anyone else except as part of a product or\n * program developed by the user or with the express written consent of\n * Sun Microsystems, Inc.\n *\n * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE\n * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR\n * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.\n *\n * Sun RPC is provided with no support and without any obligation on the\n * part of Sun Microsystems, Inc. to assist in its use, correction,\n * modification or enhancement.\n *\n * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE\n * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC\n * OR ANY PART THEREOF.\n *\n * In no event will Sun Microsystems, Inc. be liable for any lost revenue\n * or profits or other special, indirect and consequential damages, even if\n * Sun has been advised of the possibility of such damages.\n *\n * Sun Microsystems, Inc.\n * 2550 Garcia Avenue\n * Mountain View, California  94043\n */\n/*\n * Copyright (c) 1986, 1990 by Sun Microsystems, Inc.\n */\n\n/* from @(#)ypupdate_prot.x\t1.3 91/03/11 TIRPC 1.0 */\n\n/*\n * Compiled from ypupdate_prot.x using rpcgen\n * This is NOT source code!\n * DO NOT EDIT THIS FILE!\n */\n\n#ifndef _rpcsvc_ypupdate_prot_h\n#define _rpcsvc_ypupdate_prot_h\n\n#define\tMAXMAPNAMELEN 255\n#define\tMAXYPDATALEN 1023\n#define\tMAXERRMSGLEN 255\n\ntypedef struct {\n\tu_int yp_buf_len;\n\tchar *yp_buf_val;\n} yp_buf;\n\nstruct ypupdate_args {\n\tchar *mapname;\n\typ_buf key;\n\typ_buf datum;\n};\ntypedef struct ypupdate_args ypupdate_args;\n\nstruct ypdelete_args {\n\tchar *mapname;\n\typ_buf key;\n};\ntypedef struct ypdelete_args ypdelete_args;\n\n#endif /* !_rpcsvc_ypupdate_prot_h */\n\n#define\tYPU_PROG ((unsigned long)(100028))\n#define\tYPU_VERS ((unsigned long)(1))\n\nextern  void ypu_prog_1(struct svc_req *rqstp, SVCXPRT *transp);\n#define\tYPU_CHANGE ((unsigned long)(1))\nextern  u_int * ypu_change_1(ypupdate_args *, CLIENT *);\nextern  u_int * ypu_change_1_svc(ypupdate_args *, struct svc_req *);\n#define\tYPU_INSERT ((unsigned long)(2))\nextern  u_int * ypu_insert_1(ypupdate_args *, CLIENT *);\nextern  u_int * ypu_insert_1_svc(ypupdate_args *, struct svc_req *);\n#define\tYPU_DELETE ((unsigned long)(3))\nextern  u_int * ypu_delete_1(ypdelete_args *, CLIENT *);\nextern  u_int * ypu_delete_1_svc(ypdelete_args *, struct svc_req *);\n#define\tYPU_STORE ((unsigned long)(4))\nextern  u_int * ypu_store_1(ypupdate_args *, CLIENT *);\nextern  u_int * ypu_store_1_svc(ypupdate_args *, struct svc_req *);\nextern int ypu_prog_1_freeresult(SVCXPRT *, xdrproc_t, caddr_t);\n\n/* the xdr functions */\nextern  bool_t xdr_yp_buf(XDR *, yp_buf*);\nextern  bool_t xdr_ypupdate_args(XDR *, ypupdate_args*);\nextern  bool_t xdr_ypdelete_args(XDR *, ypdelete_args*);\n\n#ifdef __cplusplus\n}\n#endif\n\n#endif /* !_YPUPDATE_PROT_H_RPCGEN */\n"
  },
  {
    "path": "freebsd-headers/rpcsvc/ypupdate_prot.x",
    "content": "%/*\n% * Sun RPC is a product of Sun Microsystems, Inc. and is provided for\n% * unrestricted use provided that this legend is included on all tape\n% * media and as a part of the software program in whole or part.  Users\n% * may copy or modify Sun RPC without charge, but are not authorized\n% * to license or distribute it to anyone else except as part of a product or\n% * program developed by the user or with the express written consent of\n% * Sun Microsystems, Inc.\n% *\n% * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE\n% * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR\n% * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.\n% *\n% * Sun RPC is provided with no support and without any obligation on the\n% * part of Sun Microsystems, Inc. to assist in its use, correction,\n% * modification or enhancement.\n% *\n% * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE\n% * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC\n% * OR ANY PART THEREOF.\n% *\n% * In no event will Sun Microsystems, Inc. be liable for any lost revenue\n% * or profits or other special, indirect and consequential damages, even if\n% * Sun has been advised of the possibility of such damages.\n% *\n% * Sun Microsystems, Inc.\n% * 2550 Garcia Avenue\n% * Mountain View, California  94043\n% */\n\n%/*\n% * Copyright (c) 1986, 1990 by Sun Microsystems, Inc.\n% */\n%\n%/* from @(#)ypupdate_prot.x\t1.3 91/03/11 TIRPC 1.0 */\n#ifndef RPC_HDR\n%#include <sys/cdefs.h>\n%__FBSDID(\"$FreeBSD: release/9.0.0/include/rpcsvc/ypupdate_prot.x 114629 2003-05-04 02:51:42Z obrien $\");\n#endif\n%\n%/*\n% * Compiled from ypupdate_prot.x using rpcgen\n% * This is NOT source code!\n% * DO NOT EDIT THIS FILE!\n% */\n\n/*\n * YP update service protocol\n */\n#ifdef RPC_HDR\n%\n%#ifndef _rpcsvc_ypupdate_prot_h\n%#define _rpcsvc_ypupdate_prot_h\n%\n#endif\n\nconst MAXMAPNAMELEN = 255;\nconst MAXYPDATALEN  = 1023;\nconst MAXERRMSGLEN  = 255;\n\nprogram YPU_PROG {\n\tversion YPU_VERS {\n\t\tu_int YPU_CHANGE(ypupdate_args) = 1;\n\t\tu_int YPU_INSERT(ypupdate_args) = 2;\n\t\tu_int YPU_DELETE(ypdelete_args) = 3;\n\t\tu_int YPU_STORE(ypupdate_args)  = 4;\n\t} = 1;\n} = 100028;\n\ntypedef opaque yp_buf<MAXYPDATALEN>;\n\nstruct ypupdate_args {\n\tstring mapname<MAXMAPNAMELEN>;\n\typ_buf key;\n\typ_buf datum;\n};\n\nstruct ypdelete_args {\n\tstring mapname<MAXMAPNAMELEN>;\n\typ_buf key;\n};\n\n#ifdef RPC_HDR\n%\n%#endif /* !_rpcsvc_ypupdate_prot_h */\n#endif\n"
  },
  {
    "path": "freebsd-headers/rpcsvc/ypxfrd.h",
    "content": "/*\n * Please do not edit this file.\n * It was generated using rpcgen.\n */\n\n#ifndef _YPXFRD_H_RPCGEN\n#define\t_YPXFRD_H_RPCGEN\n\n#include <rpc/rpc.h>\n\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\n#define\t_YPMAXRECORD 1024\n#define\t_YPMAXDOMAIN 64\n#define\t_YPMAXMAP 64\n#define\t_YPMAXPEER 64\n#define\tYPXFRBLOCK 32767\n\nenum xfrstat {\n\tXFR_REQUEST_OK = 1,\n\tXFR_DENIED = 2,\n\tXFR_NOFILE = 3,\n\tXFR_ACCESS = 4,\n\tXFR_BADDB = 5,\n\tXFR_READ_OK = 6,\n\tXFR_READ_ERR = 7,\n\tXFR_DONE = 8,\n\tXFR_DB_ENDIAN_MISMATCH = 9,\n\tXFR_DB_TYPE_MISMATCH = 10\n};\ntypedef enum xfrstat xfrstat;\n\nenum xfr_db_type {\n\tXFR_DB_ASCII = 1,\n\tXFR_DB_BSD_HASH = 2,\n\tXFR_DB_BSD_BTREE = 3,\n\tXFR_DB_BSD_RECNO = 4,\n\tXFR_DB_BSD_MPOOL = 5,\n\tXFR_DB_BSD_NDBM = 6,\n\tXFR_DB_GNU_GDBM = 7,\n\tXFR_DB_DBM = 8,\n\tXFR_DB_NDBM = 9,\n\tXFR_DB_OPAQUE = 10,\n\tXFR_DB_ANY = 11,\n\tXFR_DB_UNKNOWN = 12\n};\ntypedef enum xfr_db_type xfr_db_type;\n\nenum xfr_byte_order {\n\tXFR_ENDIAN_BIG = 1,\n\tXFR_ENDIAN_LITTLE = 2,\n\tXFR_ENDIAN_ANY = 3\n};\ntypedef enum xfr_byte_order xfr_byte_order;\n\ntypedef char *xfrdomain;\n\ntypedef char *xfrmap;\n\ntypedef char *xfrmap_filename;\n\nstruct ypxfr_mapname {\n\txfrmap xfrmap;\n\txfrdomain xfrdomain;\n\txfrmap_filename xfrmap_filename;\n\txfr_db_type xfr_db_type;\n\txfr_byte_order xfr_byte_order;\n};\ntypedef struct ypxfr_mapname ypxfr_mapname;\n\nstruct xfr {\n\tbool_t ok;\n\tunion {\n\t\tstruct {\n\t\t\tu_int xfrblock_buf_len;\n\t\t\tchar *xfrblock_buf_val;\n\t\t} xfrblock_buf;\n\t\txfrstat xfrstat;\n\t} xfr_u;\n};\ntypedef struct xfr xfr;\n\n#define\tYPXFRD_FREEBSD_PROG ((unsigned long)(600100069))\n#define\tYPXFRD_FREEBSD_VERS ((unsigned long)(1))\n\nextern  void ypxfrd_freebsd_prog_1(struct svc_req *rqstp, SVCXPRT *transp);\n#define\tYPXFRD_GETMAP ((unsigned long)(1))\nextern  struct xfr * ypxfrd_getmap_1(ypxfr_mapname *, CLIENT *);\nextern  struct xfr * ypxfrd_getmap_1_svc(ypxfr_mapname *, struct svc_req *);\nextern int ypxfrd_freebsd_prog_1_freeresult(SVCXPRT *, xdrproc_t, caddr_t);\n\n/* the xdr functions */\nextern  bool_t xdr_xfrstat(XDR *, xfrstat*);\nextern  bool_t xdr_xfr_db_type(XDR *, xfr_db_type*);\nextern  bool_t xdr_xfr_byte_order(XDR *, xfr_byte_order*);\nextern  bool_t xdr_xfrdomain(XDR *, xfrdomain*);\nextern  bool_t xdr_xfrmap(XDR *, xfrmap*);\nextern  bool_t xdr_xfrmap_filename(XDR *, xfrmap_filename*);\nextern  bool_t xdr_ypxfr_mapname(XDR *, ypxfr_mapname*);\nextern  bool_t xdr_xfr(XDR *, xfr*);\n\n#ifdef __cplusplus\n}\n#endif\n\n#endif /* !_YPXFRD_H_RPCGEN */\n"
  },
  {
    "path": "freebsd-headers/rpcsvc/ypxfrd.x",
    "content": "/*\n * Copyright (c) 1995, 1996\n *\tBill Paul <wpaul@ctr.columbia.edu>.  All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. All advertising materials mentioning features or use of this software\n *    must display the following acknowledgement:\n *\tThis product includes software developed by Bill Paul.\n * 4. Neither the name of the author nor the names of any co-contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY Bill Paul AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL Bill Paul OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n */\n\n/*\n * This protocol definition file describes a file transfer\n * system used to very quickly move NIS maps from one host to\n * another. This is similar to what Sun does with their ypxfrd\n * protocol, but it must be stressed that this protocol is _NOT_\n * compatible with Sun's. There are a couple of reasons for this:\n *\n * 1) Sun's protocol is proprietary. The protocol definition is\n *    not freely available in any of the SunRPC source distributions,\n *    even though the NIS v2 protocol is.\n *\n * 2) The idea here is to transfer entire raw files rather than\n *    sending just the records. Sun uses ndbm for its NIS map files,\n *    while FreeBSD uses Berkeley DB. Both are hash databases, but the\n *    formats are incompatible, making it impossible for them to\n *    use each others' files. Even if FreeBSD adopted ndbm for its\n *    database format, FreeBSD/i386 is a little-endian OS and\n *    SunOS/SPARC is big-endian; ndbm is byte-order sensitive and\n *    not very smart about it, which means an attempt to read a\n *    database on a little-endian box that was created on a big-endian\n *    box (or vice-versa) can cause the ndbm code to eat itself.\n *    Luckily, Berkeley DB is able to deal with this situation in\n *    a more graceful manner.\n *\n * While the protocol is incompatible, the idea is the same: we just open\n * up a TCP pipe to the client and transfer the raw map database \n * from the master server to the slave. This is many times faster than\n * the standard yppush/ypxfr transfer method since it saves us from\n * having to recreate the map databases via the DB library each time.\n * For example: creating a passwd database with 30,000 entries with yp_mkdb\n * can take a couple of minutes, but to just copy the file takes only a few\n * seconds.\n */\n\n#ifndef RPC_HDR\n%#include <sys/cdefs.h>\n%__FBSDID(\"$FreeBSD: release/9.0.0/include/rpcsvc/ypxfrd.x 114629 2003-05-04 02:51:42Z obrien $\");\n#endif\n\n/* XXX cribbed from yp.x */\nconst _YPMAXRECORD = 1024;\nconst _YPMAXDOMAIN = 64;\nconst _YPMAXMAP = 64;\nconst _YPMAXPEER = 64;\n\n/* Suggested default -- not necesarrily the one used. */\nconst YPXFRBLOCK = 32767;\n\n/*\n * Possible return codes from the remote server.\n */\nenum xfrstat {\n\tXFR_REQUEST_OK\t= 1,\t/* Transfer request granted */\n\tXFR_DENIED\t= 2,\t/* Transfer request denied */\n\tXFR_NOFILE\t= 3,\t/* Requested map file doesn't exist */\n\tXFR_ACCESS\t= 4,\t/* File exists, but I couldn't access it */\n\tXFR_BADDB\t= 5,\t/* File is not a hash database */\n\tXFR_READ_OK\t= 6,\t/* Block read successfully */\n\tXFR_READ_ERR\t= 7,\t/* Read error during transfer */\n\tXFR_DONE\t= 8,\t/* Transfer completed */\n\tXFR_DB_ENDIAN_MISMATCH\t= 9,\t/* Database byte order mismatch */\n\tXFR_DB_TYPE_MISMATCH\t= 10\t/* Database type mismatch */\n};\n\n/*\n * Database type specifications. The client can use this to ask\n * the server for a particular type of database or just take whatever\n * the server has to offer.\n */\nenum xfr_db_type {\n\tXFR_DB_ASCII\t\t= 1,\t/* Flat ASCII text */\n\tXFR_DB_BSD_HASH\t\t= 2,\t/* Berkeley DB, hash method */\n\tXFR_DB_BSD_BTREE\t= 3,\t/* Berkeley DB, btree method */\n\tXFR_DB_BSD_RECNO\t= 4,\t/* Berkeley DB, recno method */\n\tXFR_DB_BSD_MPOOL\t= 5,\t/* Berkeley DB, mpool method */\n\tXFR_DB_BSD_NDBM\t\t= 6,\t/* Berkeley DB, hash, ndbm compat */\n\tXFR_DB_GNU_GDBM\t\t= 7,\t/* GNU GDBM */\n\tXFR_DB_DBM\t\t= 8,\t/* Old, deprecated dbm format */\n\tXFR_DB_NDBM\t\t= 9,\t/* ndbm format (used by Sun's NISv2) */\n\tXFR_DB_OPAQUE\t\t= 10,\t/* Mystery format -- just pass along */\n\tXFR_DB_ANY\t\t= 11,\t/* I'll take any format you've got */\n\tXFR_DB_UNKNOWN\t\t= 12\t/* Unknown format */\n};\n\n/*\n * Machine byte order specification. This allows the client to check\n * that it's copying a map database from a machine of similar byte sex.\n * This is necessary for handling database libraries that are fatally\n * byte order sensitive.\n *\n * The XFR_ENDIAN_ANY type is for use with the Berkeley DB database\n * formats; Berkeley DB is smart enough to make up for byte order\n * differences, so byte sex isn't important.\n */\nenum xfr_byte_order {\n\tXFR_ENDIAN_BIG\t\t= 1,\t/* We want big endian */\n\tXFR_ENDIAN_LITTLE\t= 2,\t/* We want little endian */\n\tXFR_ENDIAN_ANY\t\t= 3\t/* We'll take whatever you got */\n};\n\ntypedef string xfrdomain<_YPMAXDOMAIN>;\ntypedef string xfrmap<_YPMAXMAP>;\ntypedef string xfrmap_filename<_YPMAXMAP>;\t/* actual name of map file */\n\n/*\n * Ask the remote ypxfrd for a map using this structure.\n * Note: we supply both a map name and a map file name. These are not\n * the same thing. In the case of ndbm, maps are stored in two files:\n * map.bykey.pag and may.bykey.dir. We may also have to deal with\n * file extensions (on the off chance that the remote server is supporting\n * multiple DB formats). To handle this, we tell the remote server both\n * what map we want and, in the case of ndbm, whether we want the .dir\n * or the .pag part. This name should not be a fully qualified path:\n * it's up to the remote server to decide which directories to look in.\n */\nstruct ypxfr_mapname {\n\txfrmap xfrmap;\n\txfrdomain xfrdomain;\n\txfrmap_filename xfrmap_filename;\n\txfr_db_type xfr_db_type;\n\txfr_byte_order xfr_byte_order;\n};\n\n/* Read response using this structure. */\nunion xfr switch (bool ok) {\ncase TRUE:\n\topaque xfrblock_buf<>;\ncase FALSE:\n\txfrstat xfrstat;\n};\n\nprogram YPXFRD_FREEBSD_PROG {\n\tversion YPXFRD_FREEBSD_VERS {\n\t\tunion xfr\n\t\tYPXFRD_GETMAP(ypxfr_mapname) = 1;\n\t} = 1;\n} = 600100069;\t/* 100069 + 60000000 -- 100069 is the Sun ypxfrd prog number */\n"
  },
  {
    "path": "freebsd-headers/rpoll.h",
    "content": "/*\n * Copyright (c)1996-2002 by Hartmut Brandt\n *\tAll rights reserved.\n *\n * Author: Hartmut Brandt\n *\n * Redistribution of this software and documentation and use in source and\n * binary forms, with or without modification, are permitted provided that\n * the following conditions are met:\n * \n * 1. Redistributions of source code or documentation must retain the above\n *   copyright notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *   notice, this list of conditions and the following disclaimer in the\n *   documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE AND DOCUMENTATION IS PROVIDED BY THE AUTHOR \n * AND ITS CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,\n * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND\n * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL\n * THE AUTHOR OR ITS CONTRIBUTORS  BE LIABLE FOR ANY DIRECT, INDIRECT,\n * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,\n * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF\n * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING\n * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,\n * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n */\n/*\n * $Begemot: libbegemot/rpoll.h,v 1.5 2004/09/21 15:49:26 brandt Exp $\n */\n# ifndef rpoll_h_\n# define rpoll_h_\n\n# ifdef __cplusplus\nextern \"C\" {\n# endif\n\ntypedef void (*poll_f)(int fd, int mask, void *arg);\ntypedef void (*timer_f)(int, void *);\n\nint\tpoll_register(int fd, poll_f func, void *arg, int mask);\nvoid\tpoll_unregister(int);\nvoid\tpoll_dispatch(int wait);\nint\tpoll_start_timer(u_int msecs, int repeat, timer_f func, void *arg);\nint\tpoll_start_utimer(unsigned long long usecs, int repeat, timer_f func,\n    void *arg);\nvoid\tpoll_stop_timer(int);\n\n# if defined(POLL_IN)\n#  undef POLL_IN\n# endif\n# if defined(POLL_OUT)\n#  undef POLL_OUT\n# endif\n\n# define POLL_IN\t1\n# define POLL_OUT\t2\n# define POLL_EXCEPT\t4\n\nextern int\trpoll_policy;\nextern int\trpoll_trace;\n\n# ifdef __cplusplus\n}\n# endif\n\n# endif\n"
  },
  {
    "path": "freebsd-headers/rtld_db.h",
    "content": "/*\n * Copyright (c) 2010 The FreeBSD Foundation \n * All rights reserved. \n * \n * This software was developed by Rui Paulo under sponsorship from the\n * FreeBSD Foundation. \n *  \n * Redistribution and use in source and binary forms, with or without \n * modification, are permitted provided that the following conditions \n * are met: \n * 1. Redistributions of source code must retain the above copyright \n *    notice, this list of conditions and the following disclaimer. \n * 2. Redistributions in binary form must reproduce the above copyright \n *    notice, this list of conditions and the following disclaimer in the \n *    documentation and/or other materials provided with the distribution. \n * \n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND \n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE \n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE \n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE \n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL \n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS \n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) \n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT \n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY \n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF \n * SUCH DAMAGE. \n *\n * $FreeBSD: release/9.0.0/lib/librtld_db/rtld_db.h 210678 2010-07-31 14:26:10Z rpaulo $\n */ \n\n#ifndef _RTLD_DB_H_\n#define _RTLD_DB_H_\n\n#include <sys/param.h>\n#include <sys/cdefs.h>\n#include <sys/types.h>\n\n\n#define\tRD_VERSION\t1\n\ntypedef enum {\n\tRD_OK,\n\tRD_ERR,\n\tRD_DBERR,\n\tRD_NOCAPAB,\n\tRD_NODYNAM,\n\tRD_NOBASE,\n\tRD_NOMAPS\n} rd_err_e;\n\ntypedef struct rd_agent {\n\tstruct proc_handle *rda_php;\n\tuintptr_t rda_addr;\t\t/* address of r_debug_state */\n} rd_agent_t;\n\ntypedef struct rd_loadobj {\n\tuintptr_t\trdl_saddr;\t\t/* start address */\n\tuintptr_t\trdl_eaddr;\t\t/* end address */\n\tuint32_t\trdl_offset;\n\tuint8_t\t\trdl_prot;\n#define RD_RDL_R\t0x01\n#define RD_RDL_W\t0x02\n#define RD_RDL_X\t0x04\n\tenum {\n\t\tRDL_TYPE_NONE\t= 0,\n\t\tRDL_TYPE_DEF,\n\t\tRDL_TYPE_VNODE,\n\t\tRDL_TYPE_SWAP,\n\t\tRDL_TYPE_DEV,\n\t\t/* XXX some types missing */\n\t\tRDL_TYPE_UNKNOWN = 255\n\t} rdl_type;\n\tunsigned char\trdl_path[PATH_MAX];\n} rd_loadobj_t;\n\ntypedef enum {\n\tRD_NONE = 0,\n\tRD_PREINIT,\n\tRD_POSTINIT,\n\tRD_DLACTIVITY\n} rd_event_e;\n\ntypedef enum {\n\tRD_NOTIFY_BPT,\n\tRD_NOTIFY_AUTOBPT,\n\tRD_NOTIFY_SYSCALL\n} rd_notify_e;\n\ntypedef struct rd_notify {\n\trd_notify_e type;\n\tunion {\n\t\tuintptr_t bptaddr;\n\t\tlong      syscallno;\n\t} u;\n} rd_notify_t;\n\ntypedef enum {\n\tRD_NOSTATE = 0,\n\tRD_CONSISTENT,\n\tRD_ADD,\n\tRD_DELETE\n} rd_state_e;\n\ntypedef struct rd_event_msg {\n\trd_event_e type;\n\tunion {\n\t\trd_state_e state;\n\t} u;\n} rd_event_msg_t;\n\ntypedef enum {\n\tRD_RESOLVE_NONE,\n\tRD_RESOLVE_STEP,\n\tRD_RESOLVE_TARGET,\n\tRD_RESOLVE_TARGET_STEP\n} rd_skip_e;\n\ntypedef struct rd_plt_info {\n\trd_skip_e pi_skip_method;\n\tlong\t  pi_nstep;\n\tuintptr_t pi_target;\n\tuintptr_t pi_baddr;\n\tunsigned int pi_flags;\n} rd_plt_info_t;\n\n#define RD_FLG_PI_PLTBOUND\t0x0001\n\n__BEGIN_DECLS\n\nstruct proc_handle;\nvoid\t\trd_delete(rd_agent_t *);\nconst char \t*rd_errstr(rd_err_e);\nrd_err_e\trd_event_addr(rd_agent_t *, rd_event_e, rd_notify_t *);\nrd_err_e\trd_event_enable(rd_agent_t *, int);\nrd_err_e\trd_event_getmsg(rd_agent_t *, rd_event_msg_t *);\nrd_err_e\trd_init(int);\ntypedef int rl_iter_f(const rd_loadobj_t *, void *);\nrd_err_e\trd_loadobj_iter(rd_agent_t *, rl_iter_f *, void *);\nvoid\t\trd_log(const int);\nrd_agent_t \t*rd_new(struct proc_handle *);\nrd_err_e\trd_objpad_enable(rd_agent_t *, size_t);\nstruct proc;\nrd_err_e\trd_plt_resolution(rd_agent_t *, uintptr_t, struct proc *,\n\t\t    uintptr_t, rd_plt_info_t *);\nrd_err_e\trd_reset(rd_agent_t *);\n\n__END_DECLS\n\n#endif /* _RTLD_DB_H_ */\n"
  },
  {
    "path": "freebsd-headers/runetype.h",
    "content": "/*-\n * Copyright (c) 1993\n *\tThe Regents of the University of California.  All rights reserved.\n *\n * This code is derived from software contributed to Berkeley by\n * Paul Borman at Krystal Technologies.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t@(#)runetype.h\t8.1 (Berkeley) 6/2/93\n * $FreeBSD: release/9.0.0/include/runetype.h 203964 2010-02-16 19:39:50Z imp $\n */\n\n#ifndef\t_RUNETYPE_H_\n#define\t_RUNETYPE_H_\n\n#include <sys/cdefs.h>\n#include <sys/_types.h>\n\n#define\t_CACHED_RUNES\t(1 <<8 )\t/* Must be a power of 2 */\n#define\t_CRMASK\t\t(~(_CACHED_RUNES - 1))\n\n/*\n * The lower 8 bits of runetype[] contain the digit value of the rune.\n */\ntypedef struct {\n\t__rune_t\t__min;\t\t/* First rune of the range */\n\t__rune_t\t__max;\t\t/* Last rune (inclusive) of the range */\n\t__rune_t\t__map;\t\t/* What first maps to in maps */\n\tunsigned long\t*__types;\t/* Array of types in range */\n} _RuneEntry;\n\ntypedef struct {\n\tint\t\t__nranges;\t/* Number of ranges stored */\n\t_RuneEntry\t*__ranges;\t/* Pointer to the ranges */\n} _RuneRange;\n\ntypedef struct {\n\tchar\t\t__magic[8];\t/* Magic saying what version we are */\n\tchar\t\t__encoding[32];\t/* ASCII name of this encoding */\n\n\t__rune_t\t(*__sgetrune)(const char *, __size_t, char const **);\n\tint\t\t(*__sputrune)(__rune_t, char *, __size_t, char **);\n\t__rune_t\t__invalid_rune;\n\n\tunsigned long\t__runetype[_CACHED_RUNES];\n\t__rune_t\t__maplower[_CACHED_RUNES];\n\t__rune_t\t__mapupper[_CACHED_RUNES];\n\n\t/*\n\t * The following are to deal with Runes larger than _CACHED_RUNES - 1.\n\t * Their data is actually contiguous with this structure so as to make\n\t * it easier to read/write from/to disk.\n\t */\n\t_RuneRange\t__runetype_ext;\n\t_RuneRange\t__maplower_ext;\n\t_RuneRange\t__mapupper_ext;\n\n\tvoid\t\t*__variable;\t/* Data which depends on the encoding */\n\tint\t\t__variable_len;\t/* how long that data is */\n} _RuneLocale;\n\n#define\t_RUNE_MAGIC_1\t\"RuneMagi\"\t/* Indicates version 0 of RuneLocale */\n\nextern _RuneLocale _DefaultRuneLocale;\nextern _RuneLocale *_CurrentRuneLocale;\n\n#endif\t/* !_RUNETYPE_H_ */\n"
  },
  {
    "path": "freebsd-headers/sdp.h",
    "content": "/*\n * sdp.h\n *\n * Copyright (c) 2001-2003 Maksim Yevmenkin <m_evmenkin@yahoo.com>\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $Id: sdp.h,v 1.3 2003/09/05 00:33:59 max Exp $\n * $FreeBSD: release/9.0.0/lib/libsdp/sdp.h 177364 2008-03-19 00:06:30Z emax $\n */\n\n#ifndef _SDP_H_\n#define _SDP_H_\n\n__BEGIN_DECLS\n\n/*\n * Data representation (page 349)\n */\n\n/* Nil, the null type */\n#define SDP_DATA_NIL\t\t\t\t\t0x00\n\n/* Unsigned integer */\n#define SDP_DATA_UINT8\t\t\t\t\t0x08\n#define SDP_DATA_UINT16\t\t\t\t\t0x09\n#define SDP_DATA_UINT32\t\t\t\t\t0x0A\n#define SDP_DATA_UINT64\t\t\t\t\t0x0B\n#define SDP_DATA_UINT128\t\t\t\t0x0C\n\n/* Signed two's-complement integer */\n#define SDP_DATA_INT8\t\t\t\t\t0x10\n#define SDP_DATA_INT16\t\t\t\t\t0x11\n#define SDP_DATA_INT32\t\t\t\t\t0x12\n#define SDP_DATA_INT64\t\t\t\t\t0x13\n#define SDP_DATA_INT128\t\t\t\t\t0x14\n\n/* UUID, a universally unique identifier */\n#define SDP_DATA_UUID16\t\t\t\t\t0x19\n#define SDP_DATA_UUID32\t\t\t\t\t0x1A\n#define SDP_DATA_UUID128\t\t\t\t0x1C\n\n/* Text string */\n#define SDP_DATA_STR8\t\t\t\t\t0x25\n#define SDP_DATA_STR16\t\t\t\t\t0x26\n#define SDP_DATA_STR32\t\t\t\t\t0x27\n\n/* Boolean */\n#define SDP_DATA_BOOL\t\t\t\t\t0x28\n\n/* \n * Data element sequence.\n * A data element whose data field is a sequence of data elements\n */\n#define SDP_DATA_SEQ8\t\t\t\t\t0x35\n#define SDP_DATA_SEQ16\t\t\t\t\t0x36\n#define SDP_DATA_SEQ32\t\t\t\t\t0x37\n\n/*\n * Data element alternative.\n * A data element whose data field is a sequence of data elements from \n * which one data element is to be selected.\n */\n#define SDP_DATA_ALT8\t\t\t\t\t0x3D \n#define SDP_DATA_ALT16\t\t\t\t\t0x3E\n#define SDP_DATA_ALT32\t\t\t\t\t0x3F\n\n/* URL, a uniform resource locator */\n#define SDP_DATA_URL8\t\t\t\t\t0x45\n#define SDP_DATA_URL16\t\t\t\t\t0x46\n#define SDP_DATA_URL32\t\t\t\t\t0x47\n\n/*\n * Protocols UUID (short) https://www.bluetooth.org/assigned-numbers/service_discovery.php\n * BASE UUID 00000000-0000-1000-8000-00805F9B34FB\n */\n\n#define SDP_UUID_PROTOCOL_SDP\t\t\t\t0x0001\n#define SDP_UUID_PROTOCOL_UDP\t\t\t\t0x0002\n#define SDP_UUID_PROTOCOL_RFCOMM\t\t\t0x0003\n#define SDP_UUID_PROTOCOL_TCP\t\t\t\t0x0004\n#define SDP_UUID_PROTOCOL_TCS_BIN\t\t\t0x0005\n#define SDP_UUID_PROTOCOL_TCS_AT\t\t\t0x0006\n#define SDP_UUID_PROTOCOL_OBEX\t\t\t\t0x0008\n#define SDP_UUID_PROTOCOL_IP\t\t\t\t0x0009\n#define SDP_UUID_PROTOCOL_FTP\t\t\t\t0x000A\n#define SDP_UUID_PROTOCOL_HTTP\t\t\t\t0x000C\n#define SDP_UUID_PROTOCOL_WSP\t\t\t\t0x000E\n#define SDP_UUID_PROTOCOL_BNEP\t\t\t\t0x000F\n#define SDP_UUID_PROTOCOL_UPNP\t\t\t\t0x0010\n#define SDP_UUID_PROTOCOL_HIDP\t\t\t\t0x0011\n#define SDP_UUID_PROTOCOL_HARDCOPY_CONTROL_CHANNEL\t0x0012\n#define SDP_UUID_PROTOCOL_HARDCOPY_DATA_CHANNEL\t\t0x0014\n#define SDP_UUID_PROTOCOL_HARDCOPY_NOTIFICATION\t\t0x0016\n#define SDP_UUID_PROTOCOL_AVCTP\t\t\t\t0x0017\n#define SDP_UUID_PROTOCOL_AVDTP\t\t\t\t0x0019\n#define SDP_UUID_PROTOCOL_CMPT\t\t\t\t0x001B\n#define SDP_UUID_PROTOCOL_UDI_C_PLANE\t\t\t0x001D\n#define SDP_UUID_PROTOCOL_L2CAP\t\t\t\t0x0100\n\n/*\n * Service class IDs https://www.bluetooth.org/assigned-numbers/service_discovery.php\n */\n\n#define SDP_SERVICE_CLASS_SERVICE_DISCOVERY_SERVER\t0x1000\n#define SDP_SERVICE_CLASS_BROWSE_GROUP_DESCRIPTOR\t0x1001\n#define SDP_SERVICE_CLASS_PUBLIC_BROWSE_GROUP\t\t0x1002\n#define SDP_SERVICE_CLASS_SERIAL_PORT\t\t\t0x1101\n#define SDP_SERVICE_CLASS_LAN_ACCESS_USING_PPP\t\t0x1102\n#define SDP_SERVICE_CLASS_DIALUP_NETWORKING\t\t0x1103\n#define SDP_SERVICE_CLASS_IR_MC_SYNC\t\t\t0x1104\n#define SDP_SERVICE_CLASS_OBEX_OBJECT_PUSH\t\t0x1105\n#define SDP_SERVICE_CLASS_OBEX_FILE_TRANSFER\t\t0x1106\n#define SDP_SERVICE_CLASS_IR_MC_SYNC_COMMAND\t\t0x1107\n#define SDP_SERVICE_CLASS_HEADSET\t\t\t0x1108\n#define SDP_SERVICE_CLASS_CORDLESS_TELEPHONY\t\t0x1109\n#define SDP_SERVICE_CLASS_AUDIO_SOURCE\t\t\t0x110A\n#define SDP_SERVICE_CLASS_AUDIO_SINK\t\t\t0x110B\n#define SDP_SERVICE_CLASS_AV_REMOTE_CONTROL_TARGET\t0x110C\n#define SDP_SERVICE_CLASS_ADVANCED_AUDIO_DISTRIBUTION\t0x110D\n#define SDP_SERVICE_CLASS_AV_REMOTE_CONTROL\t\t0x110E\n#define SDP_SERVICE_CLASS_VIDEO_CONFERENCING\t\t0x110F\n#define SDP_SERVICE_CLASS_INTERCOM\t\t\t0x1110\n#define SDP_SERVICE_CLASS_FAX\t\t\t\t0x1111\n#define SDP_SERVICE_CLASS_HEADSET_AUDIO_GATEWAY\t\t0x1112\n#define SDP_SERVICE_CLASS_WAP\t\t\t\t0x1113\n#define SDP_SERVICE_CLASS_WAP_CLIENT\t\t\t0x1114\n#define SDP_SERVICE_CLASS_PANU\t\t\t\t0x1115\n#define SDP_SERVICE_CLASS_NAP\t\t\t\t0x1116\n#define SDP_SERVICE_CLASS_GN\t\t\t\t0x1117\n#define SDP_SERVICE_CLASS_DIRECT_PRINTING\t\t0x1118\n#define SDP_SERVICE_CLASS_REFERENCE_PRINTING\t\t0x1119\n#define SDP_SERVICE_CLASS_IMAGING\t\t\t0x111A\n#define SDP_SERVICE_CLASS_IMAGING_RESPONDER\t\t0x111B\n#define SDP_SERVICE_CLASS_IMAGING_AUTOMATIC_ARCHIVE\t0x111C\n#define SDP_SERVICE_CLASS_IMAGING_REFERENCED_OBJECTS\t0x111D\n#define SDP_SERVICE_CLASS_HANDSFREE\t\t\t0x111E\n#define SDP_SERVICE_CLASS_HANDSFREE_AUDIO_GATEWAY\t0x111F\n#define SDP_SERVICE_CLASS_DIRECT_PRINTING_REFERENCE_OBJECTS\t0x1120\n#define SDP_SERVICE_CLASS_REFLECTED_UI\t\t\t0x1121\n#define SDP_SERVICE_CLASS_BASIC_PRINTING\t\t0x1122\n#define SDP_SERVICE_CLASS_PRINTING_STATUS\t\t0x1123\n#define SDP_SERVICE_CLASS_HUMAN_INTERFACE_DEVICE\t0x1124\n#define SDP_SERVICE_CLASS_HARDCOPY_CABLE_REPLACEMENT\t0x1125\n#define SDP_SERVICE_CLASS_HCR_PRINT\t\t\t0x1126\n#define SDP_SERVICE_CLASS_HCR_SCAN\t\t\t0x1127\n#define SDP_SERVICE_CLASS_COMMON_ISDN_ACCESS\t\t0x1128\n#define SDP_SERVICE_CLASS_VIDEO_CONFERENCING_GW\t\t0x1129\n#define SDP_SERVICE_CLASS_UDI_MT\t\t\t0x112A\n#define SDP_SERVICE_CLASS_UDI_TA\t\t\t0x112B\n#define SDP_SERVICE_CLASS_AUDIO_VIDEO\t\t\t0x112C\n#define SDP_SERVICE_CLASS_SIM_ACCESS\t\t\t0x112D\n#define SDP_SERVICE_CLASS_PHONEBOOK_ACCESS_PCE\t\t0x112E\n#define SDP_SERVICE_CLASS_PHONEBOOK_ACCESS_PSE\t\t0x112F\n#define SDP_SERVICE_CLASS_PHONEBOOK_ACCESS\t\t0x1130\n#define SDP_SERVICE_CLASS_PNP_INFORMATION\t\t0x1200\n#define SDP_SERVICE_CLASS_GENERIC_NETWORKING\t\t0x1201\n#define SDP_SERVICE_CLASS_GENERIC_FILE_TRANSFER\t\t0x1202\n#define SDP_SERVICE_CLASS_GENERIC_AUDIO\t\t\t0x1203\n#define SDP_SERVICE_CLASS_GENERIC_TELEPHONY\t\t0x1204\n#define SDP_SERVICE_CLASS_UPNP\t\t\t\t0x1205\n#define SDP_SERVICE_CLASS_UPNP_IP\t\t\t0x1206\n#define SDP_SERVICE_CLASS_ESDP_UPNP_IP_PAN\t\t0x1300\n#define SDP_SERVICE_CLASS_ESDP_UPNP_IP_LAP\t\t0x1301\n#define SDP_SERVICE_CLASS_ESDP_UPNP_L2CAP\t\t0x1302\n#define SDP_SERVICE_CLASS_VIDEO_SOURCE\t\t\t0x1303\n#define SDP_SERVICE_CLASS_VIDEO_SINK\t\t\t0x1304\n#define SDP_SERVICE_CLASS_VIDEO_DISTRIBUTION\t\t0x1305\n\n/*\n * Universal attribute definitions (page 366) and\n * https://www.bluetooth.org/assigned-numbers/service_discovery.php\n */\n\n#define SDP_ATTR_RANGE(lo, hi) \\\n\t(uint32_t)(((uint16_t)(lo) << 16) | ((uint16_t)(hi)))\n\n#define SDP_ATTR_SERVICE_RECORD_HANDLE\t\t\t0x0000\n#define SDP_ATTR_SERVICE_CLASS_ID_LIST\t\t\t0x0001\n#define SDP_ATTR_SERVICE_RECORD_STATE\t\t\t0x0002\n#define SDP_ATTR_SERVICE_ID\t\t\t\t0x0003\n#define SDP_ATTR_PROTOCOL_DESCRIPTOR_LIST\t\t0x0004\n#define SDP_ATTR_BROWSE_GROUP_LIST\t\t\t0x0005\n#define SDP_ATTR_LANGUAGE_BASE_ATTRIBUTE_ID_LIST\t0x0006\n#define SDP_ATTR_SERVICE_INFO_TIME_TO_LIVE\t\t0x0007\n#define SDP_ATTR_SERVICE_AVAILABILITY\t\t\t0x0008\n#define SDP_ATTR_BLUETOOTH_PROFILE_DESCRIPTOR_LIST\t0x0009\n#define SDP_ATTR_DOCUMENTATION_URL\t\t\t0x000A\n#define SDP_ATTR_CLIENT_EXECUTABLE_URL\t\t\t0x000B\n#define SDP_ATTR_ICON_URL\t\t\t\t0x000C\n#define SDP_ATTR_ADDITIONAL_PROTOCOL_DESCRIPTOR_LISTS\t0x000D\n#define SDP_ATTR_GROUP_ID\t\t\t\t0x0200\n#define SDP_ATTR_IP_SUBNET\t\t\t\t0x0200\n#define SDP_ATTR_VERSION_NUMBER_LIST\t\t\t0x0200\n#define SDP_ATTR_SERVICE_DATABASE_STATE\t\t\t0x0201\n#define SDP_ATTR_SERVICE_VERSION\t\t\t0x0300\n#define SDP_ATTR_EXTERNAL_NETWORK\t\t\t0x0301\n#define SDP_ATTR_NETWORK\t\t\t\t0x0301\n#define SDP_ATTR_SUPPORTED_DATA_STORES_LIST\t\t0x0301\n#define SDP_ATTR_FAX_CLASS1_SUPPORT\t\t\t0x0302\n#define SDP_ATTR_REMOTE_AUDIO_VOLUME_CONTROL\t\t0x0302\n#define SDP_ATTR_FAX_CLASS20_SUPPORT\t\t\t0x0303\n#define SDP_ATTR_SUPPORTED_FORMATS_LIST\t\t\t0x0303\n#define SDP_ATTR_FAX_CLASS2_SUPPORT\t\t\t0x0304\n#define SDP_ATTR_AUDIO_FEEDBACK_SUPPORT\t\t\t0x0305\n#define SDP_ATTR_NETWORK_ADDRESS\t\t\t0x0306\n#define SDP_ATTR_WAP_GATEWAY\t\t\t\t0x0307\n#define SDP_ATTR_HOME_PAGE_URL\t\t\t\t0x0308\n#define SDP_ATTR_WAP_STACK_TYPE\t\t\t\t0x0309\n#define SDP_ATTR_SECURITY_DESCRIPTION\t\t\t0x030A\n#define SDP_ATTR_NET_ACCESS_TYPE\t\t\t0x030B\n#define SDP_ATTR_MAX_NET_ACCESS_RATE\t\t\t0x030C\n#define SDP_ATTR_IPV4_SUBNET\t\t\t\t0x030D\n#define SDP_ATTR_IPV6_SUBNET\t\t\t\t0x030E\n#define SDP_ATTR_SUPPORTED_CAPABALITIES\t\t\t0x0310\n#define SDP_ATTR_SUPPORTED_FEATURES\t\t\t0x0311\n#define SDP_ATTR_SUPPORTED_FUNCTIONS\t\t\t0x0312\n#define SDP_ATTR_TOTAL_IMAGING_DATA_CAPACITY\t\t0x0313\n#define SDP_ATTR_SUPPORTED_REPOSITORIES\t\t\t0x0314\n\n/*\n * The offset must be added to the attribute ID base (contained in the \n * LANGUAGE_BASE_ATTRIBUTE_ID_LIST attribute) in order to compute the \n * attribute ID for these attributes.\n */\n\n#define SDP_ATTR_PRIMARY_LANGUAGE_BASE_ID\t\t0x0100\n#define SDP_ATTR_SERVICE_NAME_OFFSET\t\t\t0x0000\n#define SDP_ATTR_SERVICE_DESCRIPTION_OFFSET\t\t0x0001\n#define SDP_ATTR_PROVIDER_NAME_OFFSET\t\t\t0x0002\n\n/*\n * Protocol data unit (PDU) format (page 352)\n */\n\n#define SDP_PDU_ERROR_RESPONSE\t\t\t\t0x01\n#define SDP_PDU_SERVICE_SEARCH_REQUEST\t\t\t0x02\n#define SDP_PDU_SERVICE_SEARCH_RESPONSE\t\t\t0x03\n#define SDP_PDU_SERVICE_ATTRIBUTE_REQUEST\t\t0x04\n#define SDP_PDU_SERVICE_ATTRIBUTE_RESPONSE\t\t0x05\n#define SDP_PDU_SERVICE_SEARCH_ATTRIBUTE_REQUEST\t0x06\n#define SDP_PDU_SERVICE_SEARCH_ATTRIBUTE_RESPONSE\t0x07\n\nstruct sdp_pdu {\n\tuint8_t\t\tpid;\t/* PDU ID - SDP_PDU_xxx */\n\tuint16_t\ttid;\t/* transaction ID */\n\tuint16_t\tlen;\t/* parameters length (in bytes) */\n} __attribute__ ((packed));\ntypedef struct sdp_pdu\t\tsdp_pdu_t;\ntypedef struct sdp_pdu *\tsdp_pdu_p;\n\n/*\n * Error codes for SDP_PDU_ERROR_RESPONSE\n */\n\n#define SDP_ERROR_CODE_INVALID_SDP_VERSION\t\t0x0001\n#define SDP_ERROR_CODE_INVALID_SERVICE_RECORD_HANDLE\t0x0002\n#define SDP_ERROR_CODE_INVALID_REQUEST_SYNTAX\t\t0x0003\n#define SDP_ERROR_CODE_INVALID_PDU_SIZE\t\t\t0x0004\n#define SDP_ERROR_CODE_INVALID_CONTINUATION_STATE\t0x0005\n#define SDP_ERROR_CODE_INSUFFICIENT_RESOURCES\t\t0x0006\n\n/*\n * SDP int128/uint128 parameter\n */\n\nstruct int128 {\n\tint8_t\tb[16];\n};\ntypedef struct int128\tint128_t;\ntypedef struct int128\tuint128_t;\n\n/*\n * SDP attribute\n */\n\nstruct sdp_attr {\n\tuint16_t\t flags;\n#define SDP_ATTR_OK\t\t(0 << 0)\n#define SDP_ATTR_INVALID\t(1 << 0)\n#define SDP_ATTR_TRUNCATED\t(1 << 1)\n\tuint16_t\t attr;  /* SDP_ATTR_xxx */\n\tuint32_t\t vlen;\t/* length of the value[] in bytes */\n\tuint8_t\t\t*value;\t/* base pointer */\n};\ntypedef struct sdp_attr\t\tsdp_attr_t;\ntypedef struct sdp_attr *\tsdp_attr_p;\n\n/******************************************************************************\n * User interface\n *****************************************************************************/\n\n/* Inline versions of get/put byte/short/long. Pointer is advanced */\n#define SDP_GET8(b, cp) { \\\n\tregister uint8_t *t_cp = (uint8_t *)(cp); \\\n\t(b) = *t_cp; \\\n\t(cp) ++; \\\n}\n\n#define SDP_GET16(s, cp) { \\\n\tregister uint8_t *t_cp = (uint8_t *)(cp); \\\n\t(s) = ((uint16_t)t_cp[0] << 8) \\\n\t    | ((uint16_t)t_cp[1]) \\\n\t    ; \\\n\t(cp) += 2; \\\n}\n\n#define SDP_GET32(l, cp) { \\\n\tregister uint8_t *t_cp = (uint8_t *)(cp); \\\n\t(l) = ((uint32_t)t_cp[0] << 24) \\\n\t    | ((uint32_t)t_cp[1] << 16) \\\n\t    | ((uint32_t)t_cp[2] << 8) \\\n\t    | ((uint32_t)t_cp[3]) \\\n\t    ; \\\n\t(cp) += 4; \\\n}\n\n#define SDP_GET64(l, cp) { \\\n\tregister uint8_t *t_cp = (uint8_t *)(cp); \\\n\t(l) = ((uint64_t)t_cp[0] << 56) \\\n\t    | ((uint64_t)t_cp[1] << 48) \\\n\t    | ((uint64_t)t_cp[2] << 40) \\\n\t    | ((uint64_t)t_cp[3] << 32) \\\n\t    | ((uint64_t)t_cp[4] << 24) \\\n\t    | ((uint64_t)t_cp[5] << 16) \\\n\t    | ((uint64_t)t_cp[6] << 8) \\\n\t    | ((uint64_t)t_cp[7]) \\\n\t    ; \\\n\t(cp) += 8; \\\n}\n\n#if BYTE_ORDER == LITTLE_ENDIAN\n#define SDP_GET128(l, cp) { \\\n\tregister uint8_t *t_cp = (uint8_t *)(cp); \\\n\t(l)->b[15] = *t_cp++; \\\n\t(l)->b[14] = *t_cp++; \\\n\t(l)->b[13] = *t_cp++; \\\n\t(l)->b[12] = *t_cp++; \\\n\t(l)->b[11] = *t_cp++; \\\n\t(l)->b[10] = *t_cp++; \\\n\t(l)->b[9]  = *t_cp++; \\\n\t(l)->b[8]  = *t_cp++; \\\n\t(l)->b[7]  = *t_cp++; \\\n\t(l)->b[6]  = *t_cp++; \\\n\t(l)->b[5]  = *t_cp++; \\\n\t(l)->b[4]  = *t_cp++; \\\n\t(l)->b[3]  = *t_cp++; \\\n\t(l)->b[2]  = *t_cp++; \\\n\t(l)->b[1]  = *t_cp++; \\\n\t(l)->b[0]  = *t_cp++; \\\n\t(cp) += 16; \\\n}\n\n#define SDP_GET_UUID128(l, cp) { \\\n\tregister uint8_t *t_cp = (uint8_t *)(cp); \\\n\t(l)->b[0]  = *t_cp++; \\\n\t(l)->b[1]  = *t_cp++; \\\n\t(l)->b[2]  = *t_cp++; \\\n\t(l)->b[3]  = *t_cp++; \\\n\t(l)->b[4]  = *t_cp++; \\\n\t(l)->b[5]  = *t_cp++; \\\n\t(l)->b[6]  = *t_cp++; \\\n\t(l)->b[7]  = *t_cp++; \\\n\t(l)->b[8]  = *t_cp++; \\\n\t(l)->b[9]  = *t_cp++; \\\n\t(l)->b[10] = *t_cp++; \\\n\t(l)->b[11] = *t_cp++; \\\n\t(l)->b[12] = *t_cp++; \\\n\t(l)->b[13] = *t_cp++; \\\n\t(l)->b[14] = *t_cp++; \\\n\t(l)->b[15] = *t_cp++; \\\n\t(cp) += 16; \\\n}\n#elif BYTE_ORDER == BIG_ENDIAN\n#define SDP_GET128(l, cp) { \\\n\tregister uint8_t *t_cp = (uint8_t *)(cp); \\\n\t(l)->b[0]  = *t_cp++; \\\n\t(l)->b[1]  = *t_cp++; \\\n\t(l)->b[2]  = *t_cp++; \\\n\t(l)->b[3]  = *t_cp++; \\\n\t(l)->b[4]  = *t_cp++; \\\n\t(l)->b[5]  = *t_cp++; \\\n\t(l)->b[6]  = *t_cp++; \\\n\t(l)->b[7]  = *t_cp++; \\\n\t(l)->b[8]  = *t_cp++; \\\n\t(l)->b[9]  = *t_cp++; \\\n\t(l)->b[10] = *t_cp++; \\\n\t(l)->b[11] = *t_cp++; \\\n\t(l)->b[12] = *t_cp++; \\\n\t(l)->b[13] = *t_cp++; \\\n\t(l)->b[14] = *t_cp++; \\\n\t(l)->b[15] = *t_cp++; \\\n\t(cp) += 16; \\\n}\n\n#define\tSDP_GET_UUID128(l, cp)\tSDP_GET128(l, cp)\n#else\n#error\t\"Unsupported BYTE_ORDER\"\n#endif /* BYTE_ORDER */\n\n#define SDP_PUT8(b, cp) { \\\n\tregister uint8_t t_b = (uint8_t)(b); \\\n\tregister uint8_t *t_cp = (uint8_t *)(cp); \\\n\t*t_cp = t_b; \\\n\t(cp) ++; \\\n}\n\n#define SDP_PUT16(s, cp) { \\\n\tregister uint16_t t_s = (uint16_t)(s); \\\n\tregister uint8_t *t_cp = (uint8_t *)(cp); \\\n\t*t_cp++ = t_s >> 8; \\\n\t*t_cp   = t_s; \\\n\t(cp) += 2; \\\n}\n\n#define SDP_PUT32(l, cp) { \\\n\tregister uint32_t t_l = (uint32_t)(l); \\\n\tregister uint8_t *t_cp = (uint8_t *)(cp); \\\n\t*t_cp++ = t_l >> 24; \\\n\t*t_cp++ = t_l >> 16; \\\n\t*t_cp++ = t_l >> 8; \\\n\t*t_cp   = t_l; \\\n\t(cp) += 4; \\\n}\n\n#define SDP_PUT64(l, cp) { \\\n\tregister uint64_t t_l = (uint64_t)(l); \\\n\tregister uint8_t *t_cp = (uint8_t *)(cp); \\\n\t*t_cp++ = t_l >> 56; \\\n\t*t_cp++ = t_l >> 48; \\\n\t*t_cp++ = t_l >> 40; \\\n\t*t_cp++ = t_l >> 32; \\\n\t*t_cp++ = t_l >> 24; \\\n\t*t_cp++ = t_l >> 16; \\\n\t*t_cp++ = t_l >> 8; \\\n\t*t_cp   = t_l; \\\n\t(cp) += 8; \\\n}\n\n#if BYTE_ORDER == LITTLE_ENDIAN\n#define SDP_PUT128(l, cp) { \\\n\tregister uint8_t *t_cp = (uint8_t *)(cp); \\\n\t*t_cp++ = (l)->b[15]; \\\n\t*t_cp++ = (l)->b[14]; \\\n\t*t_cp++ = (l)->b[13]; \\\n\t*t_cp++ = (l)->b[12]; \\\n\t*t_cp++ = (l)->b[11]; \\\n\t*t_cp++ = (l)->b[10]; \\\n\t*t_cp++ = (l)->b[9];  \\\n\t*t_cp++ = (l)->b[8];  \\\n\t*t_cp++ = (l)->b[7];  \\\n\t*t_cp++ = (l)->b[6];  \\\n\t*t_cp++ = (l)->b[5];  \\\n\t*t_cp++ = (l)->b[4];  \\\n\t*t_cp++ = (l)->b[3];  \\\n\t*t_cp++ = (l)->b[2];  \\\n\t*t_cp++ = (l)->b[1];  \\\n\t*t_cp   = (l)->b[0];  \\\n\t(cp) += 16; \\\n}\n\n#define SDP_PUT_UUID128(l, cp) { \\\n\tregister uint8_t *t_cp = (uint8_t *)(cp); \\\n\t*t_cp++ = (l)->b[0];  \\\n\t*t_cp++ = (l)->b[1];  \\\n\t*t_cp++ = (l)->b[2];  \\\n\t*t_cp++ = (l)->b[3];  \\\n\t*t_cp++ = (l)->b[4];  \\\n\t*t_cp++ = (l)->b[5];  \\\n\t*t_cp++ = (l)->b[6];  \\\n\t*t_cp++ = (l)->b[7];  \\\n\t*t_cp++ = (l)->b[8];  \\\n\t*t_cp++ = (l)->b[9];  \\\n\t*t_cp++ = (l)->b[10]; \\\n\t*t_cp++ = (l)->b[11]; \\\n\t*t_cp++ = (l)->b[12]; \\\n\t*t_cp++ = (l)->b[13]; \\\n\t*t_cp++ = (l)->b[14]; \\\n\t*t_cp   = (l)->b[15]; \\\n\t(cp) += 16; \\\n}\n#elif BYTE_ORDER == BIG_ENDIAN\n#define SDP_PUT128(l, cp) { \\\n\tregister uint8_t *t_cp = (uint8_t *)(cp); \\\n\t*t_cp++ = (l)->b[0];  \\\n\t*t_cp++ = (l)->b[1];  \\\n\t*t_cp++ = (l)->b[2];  \\\n\t*t_cp++ = (l)->b[3];  \\\n\t*t_cp++ = (l)->b[4];  \\\n\t*t_cp++ = (l)->b[5];  \\\n\t*t_cp++ = (l)->b[6];  \\\n\t*t_cp++ = (l)->b[7];  \\\n\t*t_cp++ = (l)->b[8];  \\\n\t*t_cp++ = (l)->b[9];  \\\n\t*t_cp++ = (l)->b[10]; \\\n\t*t_cp++ = (l)->b[11]; \\\n\t*t_cp++ = (l)->b[12]; \\\n\t*t_cp++ = (l)->b[13]; \\\n\t*t_cp++ = (l)->b[14]; \\\n\t*t_cp   = (l)->b[15]; \\\n\t(cp) += 16; \\\n}\n\n#define SDP_PUT_UUID128(l, cp)\tSDP_PUT128(l, cp)\n#else\n#error\t\"Unsupported BYTE_ORDER\"\n#endif /* BYTE_ORDER */\n\nvoid *             sdp_open       (bdaddr_t const *l, bdaddr_t const *r);\nvoid *             sdp_open_local (char const *control);\nint32_t            sdp_close      (void *xs);\nint32_t            sdp_error      (void *xs);\n\nint32_t            sdp_search     (void *xs,\n                                   uint32_t plen, uint16_t const *pp,\n                                   uint32_t alen, uint32_t const *ap,\n                                   uint32_t vlen, sdp_attr_t *vp);\n\nchar const *\t   sdp_attr2desc  (uint16_t attr);\nchar const *\t   sdp_uuid2desc  (uint16_t uuid);\nvoid               sdp_print      (uint32_t level, uint8_t const *start,\n                                   uint8_t const *end);\n\n/******************************************************************************\n * sdpd interface and Bluetooth profiles data\n *****************************************************************************/\n\n#define SDP_LOCAL_PATH\t\"/var/run/sdp\"\n#define SDP_LOCAL_MTU\t4096\n\n/*\n * These are NOT defined in spec and only accepted on control sockets.\n * The response to these request always will be SDP_PDU_ERROR_RESPONSE.\n * The first 2 bytes (after PDU header) is an error code (in network\n * byte order). The rest of the data (pdu->len - 2) is a response data\n * and depend on the request.\n *\n * SDP_PDU_SERVICE_REGISTER_REQUEST\n * \tpdu_header_t\thdr;\n *\tu_int16_t\tuuid;\tservice class UUID (network byte order)\n *\tbdaddr_t\tbdaddr;\tlocal BD_ADDR (or ANY)\n *\tprofile data[pdu->len - sizeof(uuid) - sizeof(bdaddr)]\n *\n * in successful reponse additional data will contain 4 bytes record handle\n *\n *\n * SDP_PDU_SERVICE_UNREGISTER_REQUEST\n *\tpdu_header_t\thdr;\n *\tu_int32_t\trecord_handle;\t(network byte order)\n * \n * no additional data in response.\n *\n *\n * SDP_PDU_SERVICE_CHANGE_REQUEST\n * \tpdu_header_t\thdr;\n *\tu_int32_t\trecord_handle;\t(network byte order)\n *\tprofile data[pdu->len - sizeof(record_handle)]\n *\n * no additional data in response.\n */\n\n#define SDP_PDU_SERVICE_REGISTER_REQUEST\t0x81\n#define SDP_PDU_SERVICE_UNREGISTER_REQUEST\t0x82\n#define SDP_PDU_SERVICE_CHANGE_REQUEST\t\t0x83\n\nstruct sdp_dun_profile\n{\n\tuint8_t\tserver_channel;\n\tuint8_t\taudio_feedback_support;\n\tuint8_t\treserved[2];\n};\ntypedef struct sdp_dun_profile\t\tsdp_dun_profile_t;\ntypedef struct sdp_dun_profile *\tsdp_dun_profile_p;\n\nstruct sdp_ftrn_profile\n{\n\tuint8_t\tserver_channel;\n\tuint8_t\treserved[3];\n};\ntypedef struct sdp_ftrn_profile\t\tsdp_ftrn_profile_t;\ntypedef struct sdp_ftrn_profile *\tsdp_ftrn_profile_p;\n\n/* Keep this in sync with sdp_opush_profile */\nstruct sdp_irmc_profile\n{\n\tuint8_t\tserver_channel;\n\tuint8_t\tsupported_formats_size;\n\tuint8_t\tsupported_formats[30];\n};\ntypedef struct sdp_irmc_profile\t\tsdp_irmc_profile_t;\ntypedef struct sdp_irmc_profile *\tsdp_irmc_profile_p;\n\nstruct sdp_irmc_command_profile\n{\n\tuint8_t\tserver_channel;\n\tuint8_t\treserved[3];\n};\ntypedef struct sdp_irmc_command_profile\t\tsdp_irmc_command_profile_t;\ntypedef struct sdp_irmc_command_profile *\tsdp_irmc_command_profile_p;\n\nstruct sdp_lan_profile\n{\n\tuint8_t\t\tserver_channel;\n\tuint8_t\t\tload_factor;\n\tuint8_t\t\treserved;\n\tuint8_t\t\tip_subnet_radius;\n\tuint32_t\tip_subnet;\n};\ntypedef struct sdp_lan_profile\t\tsdp_lan_profile_t;\ntypedef struct sdp_lan_profile *\tsdp_lan_profile_p;\n\n/* Keep this in sync with sdp_irmc_profile */\nstruct sdp_opush_profile\n{\n\tuint8_t\tserver_channel;\n\tuint8_t\tsupported_formats_size;\n\tuint8_t\tsupported_formats[30];\n};\ntypedef struct sdp_opush_profile\tsdp_opush_profile_t;\ntypedef struct sdp_opush_profile *\tsdp_opush_profile_p;\n\nstruct sdp_sp_profile\n{\n\tuint8_t\tserver_channel;\n\tuint8_t\treserved[3];\n};\ntypedef struct sdp_sp_profile\tsdp_sp_profile_t;\ntypedef struct sdp_sp_profile *\tsdp_sp_profile_p;\n\nstruct sdp_nap_profile\n{\n\tuint8_t\t\treserved;\n\tuint8_t\t\tload_factor;\n\tuint16_t\tpsm;\t\t\t/* HBO */\n\tuint16_t\tsecurity_description;\t/* HBO */\n\tuint16_t\tnet_access_type;\t/* HBO */\n\tuint32_t\tmax_net_access_rate;\t/* HBO */\n};\ntypedef struct sdp_nap_profile\t\tsdp_nap_profile_t;\ntypedef struct sdp_nap_profile *\tsdp_nap_profile_p;\n\nstruct sdp_gn_profile\n{\t\n\tuint8_t\t\treserved;\n\tuint8_t\t\tload_factor;\n\tuint16_t\tpsm;\t\t\t/* HBO */\n\tuint16_t\tsecurity_description;\t/* HBO */\n\tuint16_t\treserved2;\n};\ntypedef struct sdp_gn_profile\t\tsdp_gn_profile_t;\ntypedef struct sdp_gn_profile *\t\tsdp_gn_profile_p;\n\nstruct sdp_panu_profile\n{\n\tuint8_t\t\treserved;\n\tuint8_t\t\tload_factor;\n\tuint16_t\tpsm;\t\t\t/* HBO */\n\tuint16_t\tsecurity_description;\t/* HBO */\n\tuint16_t\treserved2;\n};\ntypedef struct sdp_panu_profile\t\tsdp_panu_profile_t;\ntypedef struct sdp_panu_profile *\tsdp_panu_profile_p;\n\nint32_t\tsdp_register_service\t(void *xss, uint16_t uuid,\n\t\t\t\t bdaddr_p const bdaddr, uint8_t const *data,\n\t\t\t\t uint32_t datalen, uint32_t *handle);\nint32_t\tsdp_unregister_service\t(void *xss, uint32_t handle);\nint32_t\tsdp_change_service\t(void *xss, uint32_t handle,\n\t\t\t\t uint8_t const *data, uint32_t datalen);\n\n__END_DECLS\n\n#endif /* ndef _SDP_H_ */\n\n"
  },
  {
    "path": "freebsd-headers/search.h",
    "content": "/*-\n * Written by J.T. Conklin <jtc@netbsd.org>\n * Public domain.\n *\n *\t$NetBSD: search.h,v 1.12 1999/02/22 10:34:28 christos Exp $\n * $FreeBSD: release/9.0.0/include/search.h 105250 2002-10-16 14:29:23Z robert $\n */\n\n#ifndef _SEARCH_H_\n#define _SEARCH_H_\n\n#include <sys/cdefs.h>\n#include <sys/_types.h>\n\n#ifndef _SIZE_T_DECLARED\ntypedef\t__size_t\tsize_t;\n#define\t_SIZE_T_DECLARED\n#endif\n\ntypedef\tstruct entry {\n\tchar\t*key;\n\tvoid\t*data;\n} ENTRY;\n\ntypedef\tenum {\n\tFIND, ENTER\n} ACTION;\n\ntypedef\tenum {\n\tpreorder,\n\tpostorder,\n\tendorder,\n\tleaf\n} VISIT;\n\n#ifdef _SEARCH_PRIVATE\ntypedef\tstruct node {\n\tchar         *key;\n\tstruct node  *llink, *rlink;\n} node_t;\n\nstruct que_elem {\n\tstruct que_elem *next;\n\tstruct que_elem *prev;\n};\n#endif\n\n__BEGIN_DECLS\nint\t hcreate(size_t);\nvoid\t hdestroy(void);\nENTRY\t*hsearch(ENTRY, ACTION);\nvoid\t insque(void *, void *);\nvoid\t*lfind(const void *, const void *, size_t *, size_t,\n\t    int (*)(const void *, const void *));\nvoid\t*lsearch(const void *, void *, size_t *, size_t,\n\t    int (*)(const void *, const void *));\nvoid\t remque(void *);\nvoid\t*tdelete(const void * __restrict, void ** __restrict,\n\t    int (*)(const void *, const void *));\nvoid\t*tfind(const void *, void * const *,\n\t    int (*)(const void *, const void *));\nvoid\t*tsearch(const void *, void **, int (*)(const void *, const void *));\nvoid\t twalk(const void *, void (*)(const void *, VISIT, int));\n__END_DECLS\n\n#endif /* !_SEARCH_H_ */\n"
  },
  {
    "path": "freebsd-headers/security/audit/audit.h",
    "content": "/*-\n * Copyright (c) 1999-2005 Apple Inc.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1.  Redistributions of source code must retain the above copyright\n *     notice, this list of conditions and the following disclaimer.\n * 2.  Redistributions in binary form must reproduce the above copyright\n *     notice, this list of conditions and the following disclaimer in the\n *     documentation and/or other materials provided with the distribution.\n * 3.  Neither the name of Apple Inc. (\"Apple\") nor the names of\n *     its contributors may be used to endorse or promote products derived\n *     from this software without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS \"AS IS\" AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR\n * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,\n * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING\n * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/security/audit/audit.h 224181 2011-07-18 12:58:18Z jonathan $\n */\n\n/*\n * This header includes function prototypes and type definitions that are\n * necessary for the kernel as a whole to interact with the audit subsystem.\n */\n\n#ifndef _SECURITY_AUDIT_KERNEL_H_\n#define\t_SECURITY_AUDIT_KERNEL_H_\n\n#ifndef _KERNEL\n#error \"no user-serviceable parts inside\"\n#endif\n\n#include <bsm/audit.h>\n\n#include <sys/file.h>\n#include <sys/sysctl.h>\n\n/*\n * Audit subsystem condition flags.  The audit_enabled flag is set and\n * removed automatically as a result of configuring log files, and can be\n * observed but should not be directly manipulated.  The audit suspension\n * flag permits audit to be temporarily disabled without reconfiguring the\n * audit target.\n */\nextern int\taudit_enabled;\nextern int\taudit_suspended;\n\nvoid\t audit_syscall_enter(unsigned short code, struct thread *td);\nvoid\t audit_syscall_exit(int error, struct thread *td);\n\n/*\n * The remaining kernel functions are conditionally compiled in as they are\n * wrapped by a macro, and the macro should be the only place in the source\n * tree where these functions are referenced.\n */\n#ifdef AUDIT\nstruct ipc_perm;\nstruct sockaddr;\nunion auditon_udata;\nvoid\t audit_arg_addr(void * addr);\nvoid\t audit_arg_exit(int status, int retval);\nvoid\t audit_arg_len(int len);\nvoid\t audit_arg_atfd1(int atfd);\nvoid\t audit_arg_atfd2(int atfd);\nvoid\t audit_arg_fd(int fd);\nvoid\t audit_arg_fflags(int fflags);\nvoid\t audit_arg_gid(gid_t gid);\nvoid\t audit_arg_uid(uid_t uid);\nvoid\t audit_arg_egid(gid_t egid);\nvoid\t audit_arg_euid(uid_t euid);\nvoid\t audit_arg_rgid(gid_t rgid);\nvoid\t audit_arg_ruid(uid_t ruid);\nvoid\t audit_arg_sgid(gid_t sgid);\nvoid\t audit_arg_suid(uid_t suid);\nvoid\t audit_arg_groupset(gid_t *gidset, u_int gidset_size);\nvoid\t audit_arg_login(char *login);\nvoid\t audit_arg_ctlname(int *name, int namelen);\nvoid\t audit_arg_mask(int mask);\nvoid\t audit_arg_mode(mode_t mode);\nvoid\t audit_arg_dev(int dev);\nvoid\t audit_arg_value(long value);\nvoid\t audit_arg_owner(uid_t uid, gid_t gid);\nvoid\t audit_arg_pid(pid_t pid);\nvoid\t audit_arg_process(struct proc *p);\nvoid\t audit_arg_signum(u_int signum);\nvoid\t audit_arg_socket(int sodomain, int sotype, int soprotocol);\nvoid\t audit_arg_sockaddr(struct thread *td, struct sockaddr *sa);\nvoid\t audit_arg_auid(uid_t auid);\nvoid\t audit_arg_auditinfo(struct auditinfo *au_info);\nvoid\t audit_arg_auditinfo_addr(struct auditinfo_addr *au_info);\nvoid\t audit_arg_upath1(struct thread *td, char *upath);\nvoid\t audit_arg_upath2(struct thread *td, char *upath);\nvoid\t audit_arg_vnode1(struct vnode *vp);\nvoid\t audit_arg_vnode2(struct vnode *vp);\nvoid\t audit_arg_text(char *text);\nvoid\t audit_arg_cmd(int cmd);\nvoid\t audit_arg_svipc_cmd(int cmd);\nvoid\t audit_arg_svipc_perm(struct ipc_perm *perm);\nvoid\t audit_arg_svipc_id(int id);\nvoid\t audit_arg_svipc_addr(void *addr);\nvoid\t audit_arg_posix_ipc_perm(uid_t uid, gid_t gid, mode_t mode);\nvoid\t audit_arg_auditon(union auditon_udata *udata);\nvoid\t audit_arg_file(struct proc *p, struct file *fp);\nvoid\t audit_arg_argv(char *argv, int argc, int length);\nvoid\t audit_arg_envv(char *envv, int envc, int length);\nvoid\t audit_arg_rights(cap_rights_t rights);\nvoid\t audit_sysclose(struct thread *td, int fd);\nvoid\t audit_cred_copy(struct ucred *src, struct ucred *dest);\nvoid\t audit_cred_destroy(struct ucred *cred);\nvoid\t audit_cred_init(struct ucred *cred);\nvoid\t audit_cred_kproc0(struct ucred *cred);\nvoid\t audit_cred_proc1(struct ucred *cred);\nvoid\t audit_proc_coredump(struct thread *td, char *path, int errcode);\nvoid\t audit_thread_alloc(struct thread *td);\nvoid\t audit_thread_free(struct thread *td);\n\n/*\n * Define macros to wrap the audit_arg_* calls by checking the global\n * audit_enabled flag before performing the actual call.\n */\n#define\tAUDITING_TD(td)\t\t((td)->td_pflags & TDP_AUDITREC)\n\n#define\tAUDIT_ARG_ADDR(addr) do {\t\t\t\t\t\\\n\tif (AUDITING_TD(curthread))\t\t\t\t\t\\\n\t\taudit_arg_addr((addr));\t\t\t\t\t\\\n} while (0)\n\n#define\tAUDIT_ARG_ARGV(argv, argc, length) do {\t\t\t\t\\\n\tif (AUDITING_TD(curthread))\t\t\t\t\t\\\n\t\taudit_arg_argv((argv), (argc), (length));\t\t\\\n} while (0)\n\n#define\tAUDIT_ARG_ATFD1(atfd) do {\t\t\t\t\t\\\n\tif (AUDITING_TD(curthread))\t\t\t\t\t\\\n\t\taudit_arg_atfd1((atfd));\t\t\t\t\\\n} while (0)\n\n#define\tAUDIT_ARG_ATFD2(atfd) do {\t\t\t\t\t\\\n\tif (AUDITING_TD(curthread))\t\t\t\t\t\\\n\t\taudit_arg_atfd2((atfd));\t\t\t\t\\\n} while (0)\n\n#define\tAUDIT_ARG_AUDITON(udata) do {\t\t\t\t\t\\\n\tif (AUDITING_TD(curthread))\t\t\t\t\t\\\n\t\taudit_arg_auditon((udata));\t\t\t\t\\\n} while (0)\n\n#define\tAUDIT_ARG_CMD(cmd) do {\t\t\t\t\t\t\\\n\tif (AUDITING_TD(curthread))\t\t\t\t\t\\\n\t\taudit_arg_cmd((cmd));\t\t\t\t\t\\\n} while (0)\n\n#define\tAUDIT_ARG_DEV(dev) do {\t\t\t\t\t\t\\\n\tif (AUDITING_TD(curthread))\t\t\t\t\t\\\n\t\taudit_arg_dev((dev));\t\t\t\t\t\\\n} while (0)\n\n#define\tAUDIT_ARG_EGID(egid) do {\t\t\t\t\t\\\n\tif (AUDITING_TD(curthread))\t\t\t\t\t\\\n\t\taudit_arg_egid((egid));\t\t\t\t\t\\\n} while (0)\n\n#define\tAUDIT_ARG_ENVV(envv, envc, length) do {\t\t\t\t\\\n\tif (AUDITING_TD(curthread))\t\t\t\t\t\\\n\t\taudit_arg_envv((envv), (envc), (length));\t\t\\\n} while (0)\n\n#define\tAUDIT_ARG_EXIT(status, retval) do {\t\t\t\t\\\n\tif (AUDITING_TD(curthread))\t\t\t\t\t\\\n\t\taudit_arg_exit((status), (retval));\t\t\t\\\n} while (0)\n\n#define\tAUDIT_ARG_EUID(euid) do {\t\t\t\t\t\\\n\tif (AUDITING_TD(curthread))\t\t\t\t\t\\\n\t\taudit_arg_euid((euid));\t\t\t\t\t\\\n} while (0)\n\n#define\tAUDIT_ARG_FD(fd) do {\t\t\t\t\t\t\\\n\tif (AUDITING_TD(curthread))\t\t\t\t\t\\\n\t\taudit_arg_fd((fd));\t\t\t\t\t\\\n} while (0)\n\n#define\tAUDIT_ARG_FILE(p, fp) do {\t\t\t\t\t\\\n\tif (AUDITING_TD(curthread))\t\t\t\t\t\\\n\t\taudit_arg_file((p), (fp));\t\t\t\t\\\n} while (0)\n\n#define\tAUDIT_ARG_FFLAGS(fflags) do {\t\t\t\t\t\\\n\tif (AUDITING_TD(curthread))\t\t\t\t\t\\\n\t\taudit_arg_fflags((fflags));\t\t\t\t\\\n} while (0)\n\n#define\tAUDIT_ARG_GID(gid) do {\t\t\t\t\t\t\\\n\tif (AUDITING_TD(curthread))\t\t\t\t\t\\\n\t\taudit_arg_gid((gid));\t\t\t\t\t\\\n} while (0)\n\n#define\tAUDIT_ARG_GROUPSET(gidset, gidset_size) do {\t\t\t\\\n\tif (AUDITING_TD(curthread))\t\t\t\t\t\\\n\t\taudit_arg_groupset((gidset), (gidset_size));\t\t\\\n} while (0)\n\n#define\tAUDIT_ARG_MODE(mode) do {\t\t\t\t\t\\\n\tif (AUDITING_TD(curthread))\t\t\t\t\t\\\n\t\taudit_arg_mode((mode));\t\t\t\t\t\\\n} while (0)\n\n#define\tAUDIT_ARG_OWNER(uid, gid) do {\t\t\t\t\t\\\n\tif (AUDITING_TD(curthread))\t\t\t\t\t\\\n\t\taudit_arg_owner((uid), (gid));\t\t\t\t\\\n} while (0)\n\n#define\tAUDIT_ARG_PID(pid) do {\t\t\t\t\t\t\\\n\tif (AUDITING_TD(curthread))\t\t\t\t\t\\\n\t\taudit_arg_pid((pid));\t\t\t\t\t\\\n} while (0)\n\n#define\tAUDIT_ARG_PROCESS(p) do {\t\t\t\t\t\\\n\tif (AUDITING_TD(curthread))\t\t\t\t\t\\\n\t\taudit_arg_process((p));\t\t\t\t\t\\\n} while (0)\n\n#define\tAUDIT_ARG_RGID(rgid) do {\t\t\t\t\t\\\n\tif (AUDITING_TD(curthread))\t\t\t\t\t\\\n\t\taudit_arg_rgid((rgid));\t\t\t\t\t\\\n} while (0)\n\n#define\tAUDIT_ARG_RIGHTS(rights) do {\t\t\t\t\t\\\n\tif (AUDITING_TD(curthread))\t\t\t\t\t\\\n\t\taudit_arg_rights((rights));\t\t\t\t\\\n} while (0)\n\n#define\tAUDIT_ARG_RUID(ruid) do {\t\t\t\t\t\\\n\tif (AUDITING_TD(curthread))\t\t\t\t\t\\\n\t\taudit_arg_ruid((ruid));\t\t\t\t\t\\\n} while (0)\n\n#define\tAUDIT_ARG_SIGNUM(signum) do {\t\t\t\t\t\\\n\tif (AUDITING_TD(curthread))\t\t\t\t\t\\\n\t\taudit_arg_signum((signum));\t\t\t\t\\\n} while (0)\n\n#define\tAUDIT_ARG_SGID(sgid) do {\t\t\t\t\t\\\n\tif (AUDITING_TD(curthread))\t\t\t\t\t\\\n\t\taudit_arg_sgid((sgid));\t\t\t\t\t\\\n} while (0)\n\n#define\tAUDIT_ARG_SOCKET(sodomain, sotype, soprotocol) do {\t\t\\\n\tif (AUDITING_TD(curthread))\t\t\t\t\t\\\n\t\taudit_arg_socket((sodomain), (sotype), (soprotocol));\t\\\n} while (0)\n\n#define\tAUDIT_ARG_SUID(suid) do {\t\t\t\t\t\\\n\tif (AUDITING_TD(curthread))\t\t\t\t\t\\\n\t\taudit_arg_suid((suid));\t\t\t\t\t\\\n} while (0)\n\n#define\tAUDIT_ARG_TEXT(text) do {\t\t\t\t\t\\\n\tif (AUDITING_TD(curthread))\t\t\t\t\t\\\n\t\taudit_arg_text((text));\t\t\t\t\t\\\n} while (0)\n\n#define\tAUDIT_ARG_UID(uid) do {\t\t\t\t\t\t\\\n\tif (AUDITING_TD(curthread))\t\t\t\t\t\\\n\t\taudit_arg_uid((uid));\t\t\t\t\t\\\n} while (0)\n\n#define\tAUDIT_ARG_UPATH1(td, upath) do {\t\t\t\t\\\n\tif (AUDITING_TD(curthread))\t\t\t\t\t\\\n\t\taudit_arg_upath1((td), (upath));\t\t\t\\\n} while (0)\n\n#define\tAUDIT_ARG_UPATH2(td, upath) do {\t\t\t\t\\\n\tif (AUDITING_TD(curthread))\t\t\t\t\t\\\n\t\taudit_arg_upath2((td), (upath));\t\t\t\\\n} while (0)\n\n#define\tAUDIT_ARG_VALUE(value) do {\t\t\t\t\t\\\n\tif (AUDITING_TD(curthread))\t\t\t\t\t\\\n\t\taudit_arg_value((value));\t\t\t\t\\\n} while (0)\n\n#define\tAUDIT_ARG_VNODE1(vp) do {\t\t\t\t\t\\\n\tif (AUDITING_TD(curthread))\t\t\t\t\t\\\n\t\taudit_arg_vnode1((vp));\t\t\t\t\t\\\n} while (0)\n\n#define\tAUDIT_ARG_VNODE2(vp) do {\t\t\t\t\t\\\n\tif (AUDITING_TD(curthread))\t\t\t\t\t\\\n\t\taudit_arg_vnode2((vp));\t\t\t\t\t\\\n} while (0)\n\n#define\tAUDIT_SYSCALL_ENTER(code, td)\tdo {\t\t\t\t\\\n\tif (audit_enabled) {\t\t\t\t\t\t\\\n\t\taudit_syscall_enter(code, td);\t\t\t\t\\\n\t}\t\t\t\t\t\t\t\t\\\n} while (0)\n\n/*\n * Wrap the audit_syscall_exit() function so that it is called only when\n * we have a audit record on the thread.  Audit records can persist after\n * auditing is disabled, so we don't just check audit_enabled here.\n */\n#define\tAUDIT_SYSCALL_EXIT(error, td)\tdo {\t\t\t\t\\\n\tif (td->td_pflags & TDP_AUDITREC)\t\t\t\t\\\n\t\taudit_syscall_exit(error, td);\t\t\t\t\\\n} while (0)\n\n/*\n * A Macro to wrap the audit_sysclose() function.\n */\n#define\tAUDIT_SYSCLOSE(td, fd)\tdo {\t\t\t\t\t\\\n\tif (td->td_pflags & TDP_AUDITREC)\t\t\t\t\\\n\t\taudit_sysclose(td, fd);\t\t\t\t\t\\\n} while (0)\n\n#else /* !AUDIT */\n\n#define\tAUDIT_ARG_ADDR(addr)\n#define\tAUDIT_ARG_ARGV(argv, argc, length)\n#define\tAUDIT_ARG_ATFD1(atfd)\n#define\tAUDIT_ARG_ATFD2(atfd)\n#define\tAUDIT_ARG_AUDITON(udata)\n#define\tAUDIT_ARG_CMD(cmd)\n#define\tAUDIT_ARG_DEV(dev)\n#define\tAUDIT_ARG_EGID(egid)\n#define\tAUDIT_ARG_ENVV(envv, envc, length)\n#define\tAUDIT_ARG_EXIT(status, retval)\n#define\tAUDIT_ARG_EUID(euid)\n#define\tAUDIT_ARG_FD(fd)\n#define\tAUDIT_ARG_FILE(p, fp)\n#define\tAUDIT_ARG_FFLAGS(fflags)\n#define\tAUDIT_ARG_GID(gid)\n#define\tAUDIT_ARG_GROUPSET(gidset, gidset_size)\n#define\tAUDIT_ARG_MODE(mode)\n#define\tAUDIT_ARG_OWNER(uid, gid)\n#define\tAUDIT_ARG_PID(pid)\n#define\tAUDIT_ARG_PROCESS(p)\n#define\tAUDIT_ARG_RGID(rgid)\n#define\tAUDIT_ARG_RIGHTS(rights)\n#define\tAUDIT_ARG_RUID(ruid)\n#define\tAUDIT_ARG_SIGNUM(signum)\n#define\tAUDIT_ARG_SGID(sgid)\n#define\tAUDIT_ARG_SOCKET(sodomain, sotype, soprotocol)\n#define\tAUDIT_ARG_SUID(suid)\n#define\tAUDIT_ARG_TEXT(text)\n#define\tAUDIT_ARG_UID(uid)\n#define\tAUDIT_ARG_UPATH1(td, upath)\n#define\tAUDIT_ARG_UPATH2(td, upath)\n#define\tAUDIT_ARG_VALUE(value)\n#define\tAUDIT_ARG_VNODE1(vp)\n#define\tAUDIT_ARG_VNODE2(vp)\n\n#define\tAUDIT_SYSCALL_ENTER(code, td)\n#define\tAUDIT_SYSCALL_EXIT(error, td)\n\n#define\tAUDIT_SYSCLOSE(p, fd)\n\n#endif /* AUDIT */\n\n#endif /* !_SECURITY_AUDIT_KERNEL_H_ */\n"
  },
  {
    "path": "freebsd-headers/security/audit/audit_ioctl.h",
    "content": "/*-\n * Copyright (c) 2006 Robert N. M. Watson\n * All rights reserved.\n *\n * This software was developed by Robert Watson for the TrustedBSD Project.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/security/audit/audit_ioctl.h 169097 2007-04-29 16:20:32Z rwatson $\n */\n\n#ifndef _SECURITY_AUDIT_AUDIT_IOCTL_H_\n#define\t_SECURITY_AUDIT_AUDIT_IOCTL_H_\n\n#define\tAUDITPIPE_IOBASE\t'A'\n\n/*\n * Data structures used for complex ioctl arguments.  Do not change existing\n * structures, add new revised ones to be used by new ioctls, and keep the\n * old structures and ioctls for backwards compatibility.\n */\nstruct auditpipe_ioctl_preselect {\n\tau_id_t\t\taip_auid;\n\tau_mask_t\taip_mask;\n};\n\n/*\n * Possible modes of operation for audit pipe preselection.\n */\n#define\tAUDITPIPE_PRESELECT_MODE_TRAIL\t1\t/* Global audit trail. */\n#define\tAUDITPIPE_PRESELECT_MODE_LOCAL\t2\t/* Local audit trail. */\n\n/*\n * Ioctls to read and control the behavior of individual audit pipe devices.\n */\n#define\tAUDITPIPE_GET_QLEN\t\t_IOR(AUDITPIPE_IOBASE, 1, u_int)\n#define\tAUDITPIPE_GET_QLIMIT\t\t_IOR(AUDITPIPE_IOBASE, 2, u_int)\n#define\tAUDITPIPE_SET_QLIMIT\t\t_IOW(AUDITPIPE_IOBASE, 3, u_int)\n#define\tAUDITPIPE_GET_QLIMIT_MIN\t_IOR(AUDITPIPE_IOBASE, 4, u_int)\n#define\tAUDITPIPE_GET_QLIMIT_MAX\t_IOR(AUDITPIPE_IOBASE, 5, u_int)\n#define\tAUDITPIPE_GET_PRESELECT_FLAGS\t_IOR(AUDITPIPE_IOBASE, 6, au_mask_t)\n#define\tAUDITPIPE_SET_PRESELECT_FLAGS\t_IOW(AUDITPIPE_IOBASE, 7, au_mask_t)\n#define\tAUDITPIPE_GET_PRESELECT_NAFLAGS\t_IOR(AUDITPIPE_IOBASE, 8, au_mask_t)\n#define\tAUDITPIPE_SET_PRESELECT_NAFLAGS\t_IOW(AUDITPIPE_IOBASE, 9, au_mask_t)\n#define\tAUDITPIPE_GET_PRESELECT_AUID\t_IOR(AUDITPIPE_IOBASE, 10,\t\\\n\t\t\t\t\t    struct auditpipe_ioctl_preselect)\n#define\tAUDITPIPE_SET_PRESELECT_AUID\t_IOW(AUDITPIPE_IOBASE, 11,\t\\\n\t\t\t\t\t    struct auditpipe_ioctl_preselect)\n#define\tAUDITPIPE_DELETE_PRESELECT_AUID\t_IOW(AUDITPIPE_IOBASE, 12, au_id_t)\n#define\tAUDITPIPE_FLUSH_PRESELECT_AUID\t_IO(AUDITPIPE_IOBASE, 13)\n#define\tAUDITPIPE_GET_PRESELECT_MODE\t_IOR(AUDITPIPE_IOBASE, 14, int)\n#define\tAUDITPIPE_SET_PRESELECT_MODE\t_IOW(AUDITPIPE_IOBASE, 15, int)\n#define\tAUDITPIPE_FLUSH\t\t\t_IO(AUDITPIPE_IOBASE, 16)\n#define\tAUDITPIPE_GET_MAXAUDITDATA\t_IOR(AUDITPIPE_IOBASE, 17, u_int)\n\n/*\n * Ioctls to retrieve audit pipe statistics.\n */\n#define\tAUDITPIPE_GET_INSERTS\t\t_IOR(AUDITPIPE_IOBASE, 100, u_int64_t)\n#define\tAUDITPIPE_GET_READS\t\t_IOR(AUDITPIPE_IOBASE, 101, u_int64_t)\n#define\tAUDITPIPE_GET_DROPS\t\t_IOR(AUDITPIPE_IOBASE, 102, u_int64_t)\n#define\tAUDITPIPE_GET_TRUNCATES\t\t_IOR(AUDITPIPE_IOBASE, 103, u_int64_t)\n\n#endif /* _SECURITY_AUDIT_AUDIT_IOCTL_H_ */\n"
  },
  {
    "path": "freebsd-headers/security/audit/audit_private.h",
    "content": "/*-\n * Copyright (c) 1999-2009 Apple Inc.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1.  Redistributions of source code must retain the above copyright\n *     notice, this list of conditions and the following disclaimer.\n * 2.  Redistributions in binary form must reproduce the above copyright\n *     notice, this list of conditions and the following disclaimer in the\n *     documentation and/or other materials provided with the distribution.\n * 3.  Neither the name of Apple Inc. (\"Apple\") nor the names of\n *     its contributors may be used to endorse or promote products derived\n *     from this software without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS \"AS IS\" AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR\n * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,\n * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING\n * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/security/audit/audit_private.h 224181 2011-07-18 12:58:18Z jonathan $\n */\n\n/*\n * This include file contains function prototypes and type definitions used\n * within the audit implementation.\n */\n\n#ifndef _SECURITY_AUDIT_PRIVATE_H_\n#define\t_SECURITY_AUDIT_PRIVATE_H_\n\n#ifndef _KERNEL\n#error \"no user-serviceable parts inside\"\n#endif\n\n#include <sys/ipc.h>\n#include <sys/socket.h>\n#include <sys/ucred.h>\n\n#ifdef MALLOC_DECLARE\nMALLOC_DECLARE(M_AUDITBSM);\nMALLOC_DECLARE(M_AUDITDATA);\nMALLOC_DECLARE(M_AUDITPATH);\nMALLOC_DECLARE(M_AUDITTEXT);\nMALLOC_DECLARE(M_AUDITGIDSET);\n#endif\n\n/*\n * Audit control variables that are usually set/read via system calls and\n * used to control various aspects of auditing.\n */\nextern struct au_qctrl\t\taudit_qctrl;\nextern struct audit_fstat\taudit_fstat;\nextern struct au_mask\t\taudit_nae_mask;\nextern int\t\t\taudit_panic_on_write_fail;\nextern int\t\t\taudit_fail_stop;\nextern int\t\t\taudit_argv;\nextern int\t\t\taudit_arge;\n\n/*\n * Success/failure conditions for the conversion of a kernel audit record to\n * BSM format.\n */\n#define\tBSM_SUCCESS\t0\n#define\tBSM_FAILURE\t1\n#define\tBSM_NOAUDIT\t2\n\n/*\n * Defines for the kernel audit record k_ar_commit field.  Flags are set to\n * indicate what sort of record it is, and which preselection mechanism\n * selected it.\n */\n#define\tAR_COMMIT_KERNEL\t0x00000001U\n#define\tAR_COMMIT_USER\t\t0x00000010U\n\n#define\tAR_PRESELECT_TRAIL\t0x00001000U\n#define\tAR_PRESELECT_PIPE\t0x00002000U\n\n#define\tAR_PRESELECT_USER_TRAIL\t0x00004000U\n#define\tAR_PRESELECT_USER_PIPE\t0x00008000U\n\n/*\n * Audit data is generated as a stream of struct audit_record structures,\n * linked by struct kaudit_record, and contain storage for possible audit so\n * that it will not need to be allocated during the processing of a system\n * call, both improving efficiency and avoiding sleeping at untimely moments.\n * This structure is converted to BSM format before being written to disk.\n */\nstruct vnode_au_info {\n\tmode_t\tvn_mode;\n\tuid_t\tvn_uid;\n\tgid_t\tvn_gid;\n\tdev_t\tvn_dev;\n\tlong\tvn_fsid;\n\tlong\tvn_fileid;\n\tlong\tvn_gen;\n};\n\nstruct groupset {\n\tgid_t\t*gidset;\n\tu_int\t gidset_size;\n};\n\nstruct socket_au_info {\n\tint\t\tso_domain;\n\tint\t\tso_type;\n\tint\t\tso_protocol;\n\tin_addr_t\tso_raddr;\t/* Remote address if INET socket. */\n\tin_addr_t\tso_laddr;\t/* Local address if INET socket. */\n\tu_short\t\tso_rport;\t/* Remote port. */\n\tu_short\t\tso_lport;\t/* Local port. */\n};\n\n/*\n * The following is used for A_OLDSETQCTRL and AU_OLDGETQCTRL and a 64-bit\n * userland.\n */\nstruct au_qctrl64 {\n\tu_int64_t\taq64_hiwater;\n\tu_int64_t\taq64_lowater;\n\tu_int64_t\taq64_bufsz;\n\tu_int64_t\taq64_delay;\n\tu_int64_t\taq64_minfree;\n};\ntypedef\tstruct au_qctrl64\tau_qctrl64_t;\n\nunion auditon_udata {\n\tchar\t\t\t*au_path;\n\tint\t\t\tau_cond;\n\tint\t\t\tau_flags;\n\tint\t\t\tau_policy;\n\tint\t\t\tau_trigger;\n\tint64_t\t\t\tau_cond64;\n\tint64_t\t\t\tau_policy64;\n\tau_evclass_map_t\tau_evclass;\n\tau_mask_t\t\tau_mask;\n\tauditinfo_t\t\tau_auinfo;\n\tauditpinfo_t\t\tau_aupinfo;\n\tauditpinfo_addr_t\tau_aupinfo_addr;\n\tau_qctrl_t\t\tau_qctrl;\n\tau_qctrl64_t\t\tau_qctrl64;\n\tau_stat_t\t\tau_stat;\n\tau_fstat_t\t\tau_fstat;\n\tauditinfo_addr_t\tau_kau_info;\n};\n\nstruct posix_ipc_perm {\n\tuid_t\tpipc_uid;\n\tgid_t\tpipc_gid;\n\tmode_t\tpipc_mode;\n};\n\nstruct audit_record {\n\t/* Audit record header. */\n\tu_int32_t\t\tar_magic;\n\tint\t\t\tar_event;\n\tint\t\t\tar_retval; /* value returned to the process */\n\tint\t\t\tar_errno;  /* return status of system call */\n\tstruct timespec\t\tar_starttime;\n\tstruct timespec\t\tar_endtime;\n\tu_int64_t\t\tar_valid_arg;  /* Bitmask of valid arguments */\n\n\t/* Audit subject information. */\n\tstruct xucred\t\tar_subj_cred;\n\tuid_t\t\t\tar_subj_ruid;\n\tgid_t\t\t\tar_subj_rgid;\n\tgid_t\t\t\tar_subj_egid;\n\tuid_t\t\t\tar_subj_auid; /* Audit user ID */\n\tpid_t\t\t\tar_subj_asid; /* Audit session ID */\n\tpid_t\t\t\tar_subj_pid;\n\tstruct au_tid\t\tar_subj_term;\n\tstruct au_tid_addr\tar_subj_term_addr;\n\tstruct au_mask\t\tar_subj_amask;\n\n\t/* Operation arguments. */\n\tuid_t\t\t\tar_arg_euid;\n\tuid_t\t\t\tar_arg_ruid;\n\tuid_t\t\t\tar_arg_suid;\n\tgid_t\t\t\tar_arg_egid;\n\tgid_t\t\t\tar_arg_rgid;\n\tgid_t\t\t\tar_arg_sgid;\n\tpid_t\t\t\tar_arg_pid;\n\tpid_t\t\t\tar_arg_asid;\n\tstruct au_tid\t\tar_arg_termid;\n\tstruct au_tid_addr\tar_arg_termid_addr;\n\tuid_t\t\t\tar_arg_uid;\n\tuid_t\t\t\tar_arg_auid;\n\tgid_t\t\t\tar_arg_gid;\n\tstruct groupset\t\tar_arg_groups;\n\tint\t\t\tar_arg_fd;\n\tint\t\t\tar_arg_atfd1;\n\tint\t\t\tar_arg_atfd2;\n\tint\t\t\tar_arg_fflags;\n\tmode_t\t\t\tar_arg_mode;\n\tint\t\t\tar_arg_dev;\n\tlong\t\t\tar_arg_value;\n\tvoid *\t\t\tar_arg_addr;\n\tint\t\t\tar_arg_len;\n\tint\t\t\tar_arg_mask;\n\tu_int\t\t\tar_arg_signum;\n\tchar\t\t\tar_arg_login[MAXLOGNAME];\n\tint\t\t\tar_arg_ctlname[CTL_MAXNAME];\n\tstruct socket_au_info\tar_arg_sockinfo;\n\tchar\t\t\t*ar_arg_upath1;\n\tchar\t\t\t*ar_arg_upath2;\n\tchar\t\t\t*ar_arg_text;\n\tstruct au_mask\t\tar_arg_amask;\n\tstruct vnode_au_info\tar_arg_vnode1;\n\tstruct vnode_au_info\tar_arg_vnode2;\n\tint\t\t\tar_arg_cmd;\n\tint\t\t\tar_arg_svipc_cmd;\n\tstruct ipc_perm\t\tar_arg_svipc_perm;\n\tint\t\t\tar_arg_svipc_id;\n\tvoid *\t\t\tar_arg_svipc_addr;\n\tstruct posix_ipc_perm\tar_arg_pipc_perm;\n\tunion auditon_udata\tar_arg_auditon;\n\tchar\t\t\t*ar_arg_argv;\n\tint\t\t\tar_arg_argc;\n\tchar\t\t\t*ar_arg_envv;\n\tint\t\t\tar_arg_envc;\n\tint\t\t\tar_arg_exitstatus;\n\tint\t\t\tar_arg_exitretval;\n\tstruct sockaddr_storage ar_arg_sockaddr;\n\tcap_rights_t\t\tar_arg_rights;\n};\n\n/*\n * Arguments in the audit record are initially not defined; flags are set to\n * indicate if they are present so they can be included in the audit log\n * stream only if defined.\n */\n#define\tARG_EUID\t\t0x0000000000000001ULL\n#define\tARG_RUID\t\t0x0000000000000002ULL\n#define\tARG_SUID\t\t0x0000000000000004ULL\n#define\tARG_EGID\t\t0x0000000000000008ULL\n#define\tARG_RGID\t\t0x0000000000000010ULL\n#define\tARG_SGID\t\t0x0000000000000020ULL\n#define\tARG_PID\t\t\t0x0000000000000040ULL\n#define\tARG_UID\t\t\t0x0000000000000080ULL\n#define\tARG_AUID\t\t0x0000000000000100ULL\n#define\tARG_GID\t\t\t0x0000000000000200ULL\n#define\tARG_FD\t\t\t0x0000000000000400ULL\n#define\tARG_POSIX_IPC_PERM\t0x0000000000000800ULL\n#define\tARG_FFLAGS\t\t0x0000000000001000ULL\n#define\tARG_MODE\t\t0x0000000000002000ULL\n#define\tARG_DEV\t\t\t0x0000000000004000ULL\n#define\tARG_ADDR\t\t0x0000000000008000ULL\n#define\tARG_LEN\t\t\t0x0000000000010000ULL\n#define\tARG_MASK\t\t0x0000000000020000ULL\n#define\tARG_SIGNUM\t\t0x0000000000040000ULL\n#define\tARG_LOGIN\t\t0x0000000000080000ULL\n#define\tARG_SADDRINET\t\t0x0000000000100000ULL\n#define\tARG_SADDRINET6\t\t0x0000000000200000ULL\n#define\tARG_SADDRUNIX\t\t0x0000000000400000ULL\n#define\tARG_TERMID_ADDR\t\t0x0000000000400000ULL\n#define\tARG_UNUSED2\t\t0x0000000001000000ULL\n#define\tARG_UPATH1\t\t0x0000000002000000ULL\n#define\tARG_UPATH2\t\t0x0000000004000000ULL\n#define\tARG_TEXT\t\t0x0000000008000000ULL\n#define\tARG_VNODE1\t\t0x0000000010000000ULL\n#define\tARG_VNODE2\t\t0x0000000020000000ULL\n#define\tARG_SVIPC_CMD\t\t0x0000000040000000ULL\n#define\tARG_SVIPC_PERM\t\t0x0000000080000000ULL\n#define\tARG_SVIPC_ID\t\t0x0000000100000000ULL\n#define\tARG_SVIPC_ADDR\t\t0x0000000200000000ULL\n#define\tARG_GROUPSET\t\t0x0000000400000000ULL\n#define\tARG_CMD\t\t\t0x0000000800000000ULL\n#define\tARG_SOCKINFO\t\t0x0000001000000000ULL\n#define\tARG_ASID\t\t0x0000002000000000ULL\n#define\tARG_TERMID\t\t0x0000004000000000ULL\n#define\tARG_AUDITON\t\t0x0000008000000000ULL\n#define\tARG_VALUE\t\t0x0000010000000000ULL\n#define\tARG_AMASK\t\t0x0000020000000000ULL\n#define\tARG_CTLNAME\t\t0x0000040000000000ULL\n#define\tARG_PROCESS\t\t0x0000080000000000ULL\n#define\tARG_MACHPORT1\t\t0x0000100000000000ULL\n#define\tARG_MACHPORT2\t\t0x0000200000000000ULL\n#define\tARG_EXIT\t\t0x0000400000000000ULL\n#define\tARG_IOVECSTR\t\t0x0000800000000000ULL\n#define\tARG_ARGV\t\t0x0001000000000000ULL\n#define\tARG_ENVV\t\t0x0002000000000000ULL\n#define\tARG_ATFD1\t\t0x0004000000000000ULL\n#define\tARG_ATFD2\t\t0x0008000000000000ULL\n#define\tARG_RIGHTS\t\t0x0010000000000000ULL\n#define\tARG_NONE\t\t0x0000000000000000ULL\n#define\tARG_ALL\t\t\t0xFFFFFFFFFFFFFFFFULL\n\n#define\tARG_IS_VALID(kar, arg)\t((kar)->k_ar.ar_valid_arg & (arg))\n#define\tARG_SET_VALID(kar, arg) do {\t\t\t\t\t\\\n\t(kar)->k_ar.ar_valid_arg |= (arg);\t\t\t\t\\\n} while (0)\n#define\tARG_CLEAR_VALID(kar, arg) do {\t\t\t\t\t\\\n\t(kar)->k_ar.ar_valid_arg &= ~(arg);\t\t\t\t\\\n} while (0)\n\n/*\n * In-kernel version of audit record; the basic record plus queue meta-data.\n * This record can also have a pointer set to some opaque data that will be\n * passed through to the audit writing mechanism.\n */\nstruct kaudit_record {\n\tstruct audit_record\t\t k_ar;\n\tu_int32_t\t\t\t k_ar_commit;\n\tvoid\t\t\t\t*k_udata;\t/* User data. */\n\tu_int\t\t\t\t k_ulen;\t/* User data length. */\n\tstruct uthread\t\t\t*k_uthread;\t/* Audited thread. */\n\tTAILQ_ENTRY(kaudit_record)\t k_q;\n};\nTAILQ_HEAD(kaudit_queue, kaudit_record);\n\n/*\n * Functions to manage the allocation, release, and commit of kernel audit\n * records.\n */\nvoid\t\t\t audit_abort(struct kaudit_record *ar);\nvoid\t\t\t audit_commit(struct kaudit_record *ar, int error,\n\t\t\t    int retval);\nstruct kaudit_record\t*audit_new(int event, struct thread *td);\n\n/*\n * Functions relating to the conversion of internal kernel audit records to\n * the BSM file format.\n */\nstruct au_record;\nint\t kaudit_to_bsm(struct kaudit_record *kar, struct au_record **pau);\nint\t bsm_rec_verify(void *rec);\n\n/*\n * Kernel versions of the libbsm audit record functions.\n */\nvoid\t kau_free(struct au_record *rec);\nvoid\t kau_init(void);\n\n/*\n * Return values for pre-selection and post-selection decisions.\n */\n#define\tAU_PRS_SUCCESS\t1\n#define\tAU_PRS_FAILURE\t2\n#define\tAU_PRS_BOTH\t(AU_PRS_SUCCESS|AU_PRS_FAILURE)\n\n/*\n * Data structures relating to the kernel audit queue.  Ideally, these might\n * be abstracted so that only accessor methods are exposed.\n */\nextern struct mtx\t\taudit_mtx;\nextern struct cv\t\taudit_watermark_cv;\nextern struct cv\t\taudit_worker_cv;\nextern struct kaudit_queue\taudit_q;\nextern int\t\t\taudit_q_len;\nextern int\t\t\taudit_pre_q_len;\nextern int\t\t\taudit_in_failure;\n\n/*\n * Flags to use on audit files when opening and closing.\n */\n#define\tAUDIT_OPEN_FLAGS\t(FWRITE | O_APPEND)\n#define\tAUDIT_CLOSE_FLAGS\t(FWRITE | O_APPEND)\n\n#include <sys/fcntl.h>\n#include <sys/kernel.h>\n#include <sys/malloc.h>\n\n/*\n * Some of the BSM tokenizer functions take different parameters in the\n * kernel implementations in order to save the copying of large kernel data\n * structures.  The prototypes of these functions are declared here.\n */\ntoken_t\t\t*kau_to_socket(struct socket_au_info *soi);\n\n/*\n * audit_klib prototypes\n */\nint\t\t au_preselect(au_event_t event, au_class_t class,\n\t\t    au_mask_t *mask_p, int sorf);\nvoid\t\t au_evclassmap_init(void);\nvoid\t\t au_evclassmap_insert(au_event_t event, au_class_t class);\nau_class_t\t au_event_class(au_event_t event);\nau_event_t\t audit_ctlname_to_sysctlevent(int name[], uint64_t valid_arg);\nau_event_t\t audit_flags_and_error_to_openevent(int oflags, int error);\nau_event_t\t audit_flags_and_error_to_openatevent(int oflags, int error);\nau_event_t\t audit_msgctl_to_event(int cmd);\nau_event_t\t audit_semctl_to_event(int cmr);\nvoid\t\t audit_canon_path(struct thread *td, char *path, char *cpath);\nau_event_t\t auditon_command_event(int cmd);\n\n/*\n * Audit trigger events notify user space of kernel audit conditions\n * asynchronously.\n */\nvoid\t\t audit_trigger_init(void);\nint\t\t audit_send_trigger(unsigned int trigger);\n\n/*\n * Accessor functions to manage global audit state.\n */\nvoid\t audit_set_kinfo(struct auditinfo_addr *);\nvoid\t audit_get_kinfo(struct auditinfo_addr *);\n\n/*\n * General audit related functions.\n */\nstruct kaudit_record\t*currecord(void);\nvoid\t\t\t audit_free(struct kaudit_record *ar);\nvoid\t\t\t audit_shutdown(void *arg, int howto);\nvoid\t\t\t audit_rotate_vnode(struct ucred *cred,\n\t\t\t    struct vnode *vp);\nvoid\t\t\t audit_worker_init(void);\n\n/*\n * Audit pipe functions.\n */\nint\t audit_pipe_preselect(au_id_t auid, au_event_t event,\n\t    au_class_t class, int sorf, int trail_select);\nvoid\t audit_pipe_submit(au_id_t auid, au_event_t event, au_class_t class,\n\t    int sorf, int trail_select, void *record, u_int record_len);\nvoid\t audit_pipe_submit_user(void *record, u_int record_len);\n\n#endif /* ! _SECURITY_AUDIT_PRIVATE_H_ */\n"
  },
  {
    "path": "freebsd-headers/security/mac_biba/mac_biba.h",
    "content": "/*-\n * Copyright (c) 1999-2002 Robert N. M. Watson\n * Copyright (c) 2001-2004 Networks Associates Technology, Inc.\n * All rights reserved.\n *\n * This software was developed by Robert Watson for the TrustedBSD Project.\n *\n * This software was developed for the FreeBSD Project in part by Network\n * Associates Laboratories, the Security Research Division of Network\n * Associates, Inc. under DARPA/SPAWAR contract N66001-01-C-8035 (\"CBOSS\"),\n * as part of the DARPA CHATS research program.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/security/mac_biba/mac_biba.h 132232 2004-07-16 02:03:50Z rwatson $\n */\n/*\n * Definitions for the TrustedBSD Biba integrity policy module.\n */\n#ifndef _SYS_SECURITY_MAC_BIBA_H\n#define\t_SYS_SECURITY_MAC_BIBA_H\n\n#define\tMAC_BIBA_EXTATTR_NAMESPACE\tEXTATTR_NAMESPACE_SYSTEM\n#define\tMAC_BIBA_EXTATTR_NAME\t\t\"mac_biba\"\n\n#define\tMAC_BIBA_LABEL_NAME\t\t\"biba\"\n\n#define\tMAC_BIBA_FLAG_EFFECTIVE\t0x00000001\t/* mb_effective initialized */\n#define\tMAC_BIBA_FLAG_RANGE\t0x00000002\t/* mb_range* initialized */\n#define\tMAC_BIBA_FLAGS_BOTH\t(MAC_BIBA_FLAG_EFFECTIVE | MAC_BIBA_FLAG_RANGE)\n\n#define\tMAC_BIBA_TYPE_UNDEF\t0\t/* Undefined */\n#define\tMAC_BIBA_TYPE_GRADE\t1\t/* Hierarchal grade with mb_grade. */\n#define\tMAC_BIBA_TYPE_LOW\t2\t/* Dominated by any\n\t\t\t\t\t * MAC_BIBA_TYPE_LABEL. */\n#define\tMAC_BIBA_TYPE_HIGH\t3\t/* Dominates any\n\t\t\t\t\t * MAC_BIBA_TYPE_LABEL. */\n#define\tMAC_BIBA_TYPE_EQUAL\t4\t/* Equivilent to any\n\t\t\t\t\t * MAC_BIBA_TYPE_LABEL. */\n\n/*\n * Structures and constants associated with a Biba Integrity policy.\n * mac_biba represents a Biba label, with mb_type determining its properties,\n * and mb_grade represents the hierarchal grade if valid for the current\n * mb_type.\n */\n\n#define\tMAC_BIBA_MAX_COMPARTMENTS\t256\n\nstruct mac_biba_element {\n\tu_short\tmbe_type;\n\tu_short\tmbe_grade;\n\tu_char\tmbe_compartments[MAC_BIBA_MAX_COMPARTMENTS >> 3];\n};\n\n/*\n * Biba labels consist of two components: an effective label, and a label\n * range.  Depending on the context, one or both may be used; the mb_flags\n * field permits the provider to indicate what fields are intended for\n * use.\n */\nstruct mac_biba {\n\tint\t\t\tmb_flags;\n\tstruct mac_biba_element\tmb_effective;\n\tstruct mac_biba_element\tmb_rangelow, mb_rangehigh;\n};\n\n/*\n * Biba compartments bit test/set macros.\n * The range is 1 to MAC_BIBA_MAX_COMPARTMENTS.\n */\n#define\tMAC_BIBA_BIT_TEST(b, w) \\\n\t((w)[(((b) - 1) >> 3)] & (1 << (((b) - 1) & 7)))\n#define\tMAC_BIBA_BIT_SET(b, w) \\\n\t((w)[(((b) - 1) >> 3)] |= (1 << (((b) - 1) & 7)))\n#define\tMAC_BIBA_BIT_SET_EMPTY(set)\tbiba_bit_set_empty(set)\n\n#endif /* !_SYS_SECURITY_MAC_BIBA_H */\n"
  },
  {
    "path": "freebsd-headers/security/mac_bsdextended/mac_bsdextended.h",
    "content": "/*-\n * Copyright (c) 1999-2002 Robert N. M. Watson\n * Copyright (c) 2001-2004 Networks Associates Technology, Inc.\n * All rights reserved.\n *\n * This software was developed by Robert Watson for the TrustedBSD Project.\n *\n * This software was developed for the FreeBSD Project in part by Network\n * Associates Laboratories, the Security Research Division of Network\n * Associates, Inc. under DARPA/SPAWAR contract N66001-01-C-8035 (\"CBOSS\"),\n * as part of the DARPA CHATS research program.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/security/mac_bsdextended/mac_bsdextended.h 171253 2007-07-05 13:16:04Z rwatson $\n */\n\n#ifndef _SYS_SECURITY_MAC_BSDEXTENDED_H\n#define\t_SYS_SECURITY_MAC_BSDEXTENDED_H\n\n#define MB_VERSION 2 /* Used to check library and kernel are the same. */\n\n/*\n * Rights that can be represented in mbr_mode.  These have the same values as\n * the V* rights in vnode.h, but in order to avoid sharing user and kernel\n * constants, we define them here.  That will also improve ABI stability if\n * the in-kernel values change.\n */\n#define\tMBI_EXEC\t000100\n#define\tMBI_WRITE\t000200\n#define\tMBI_READ\t000400\n#define\tMBI_ADMIN\t010000\n#define\tMBI_STAT\t020000\n#define\tMBI_APPEND\t040000\n#define\tMBI_ALLPERM\t(MBI_EXEC | MBI_WRITE | MBI_READ | MBI_ADMIN | \\\n\t\t\t    MBI_STAT | MBI_APPEND)\n\n#define\tMBS_UID_DEFINED\t0x00000001\t/* uid field should be matched */\n#define\tMBS_GID_DEFINED\t0x00000002\t/* gid field should be matched */\n#define\tMBS_PRISON_DEFINED 0x00000004\t/* prison field should be matched */\n\n#define MBS_ALL_FLAGS (MBS_UID_DEFINED | MBS_GID_DEFINED | MBS_PRISON_DEFINED)\n\nstruct mac_bsdextended_subject {\n\tint\tmbs_flags;\n\tint\tmbs_neg;\n\tuid_t\tmbs_uid_min;\n\tuid_t\tmbs_uid_max;\n\tgid_t\tmbs_gid_min;\n\tgid_t\tmbs_gid_max;\n\tint\tmbs_prison;\n};\n\n#define\tMBO_UID_DEFINED\t0x00000001\t/* uid field should be matched */\n#define\tMBO_GID_DEFINED\t0x00000002\t/* gid field should be matched */\n#define\tMBO_FSID_DEFINED 0x00000004\t/* fsid field should be matched */\n#define\tMBO_SUID\t0x00000008\t/* object must be suid */\n#define\tMBO_SGID\t0x00000010\t/* object must be sgid */\n#define\tMBO_UID_SUBJECT\t0x00000020\t/* uid must match subject */\n#define\tMBO_GID_SUBJECT\t0x00000040\t/* gid must match subject */\n#define\tMBO_TYPE_DEFINED 0x00000080\t/* object type should be matched */\n\n#define MBO_ALL_FLAGS (MBO_UID_DEFINED | MBO_GID_DEFINED | MBO_FSID_DEFINED | \\\n\t    MBO_SUID | MBO_SGID | MBO_UID_SUBJECT | MBO_GID_SUBJECT | \\\n\t    MBO_TYPE_DEFINED)\n\n#define MBO_TYPE_REG\t0x00000001\n#define MBO_TYPE_DIR\t0x00000002\n#define MBO_TYPE_BLK\t0x00000004\n#define MBO_TYPE_CHR\t0x00000008\n#define MBO_TYPE_LNK\t0x00000010\n#define MBO_TYPE_SOCK\t0x00000020\n#define MBO_TYPE_FIFO\t0x00000040\n\n#define MBO_ALL_TYPE\t(MBO_TYPE_REG | MBO_TYPE_DIR | MBO_TYPE_BLK | \\\n\t    MBO_TYPE_CHR | MBO_TYPE_LNK | MBO_TYPE_SOCK | MBO_TYPE_FIFO)\n\nstruct mac_bsdextended_object {\n\tint\tmbo_flags;\n\tint\tmbo_neg;\n\tuid_t\tmbo_uid_min;\n\tuid_t\tmbo_uid_max;\n\tgid_t\tmbo_gid_min;\n\tgid_t\tmbo_gid_max;\n\tstruct fsid mbo_fsid;\n\tint\tmbo_type;\n};\n\nstruct mac_bsdextended_rule {\n\tstruct mac_bsdextended_subject\tmbr_subject;\n\tstruct mac_bsdextended_object\tmbr_object;\n\tmode_t\t\t\t\tmbr_mode;\t/* maximum access */\n};\n\n#endif /* _SYS_SECURITY_MAC_BSDEXTENDED_H */\n"
  },
  {
    "path": "freebsd-headers/security/mac_bsdextended/ugidfw_internal.h",
    "content": "/*-\n * Copyright (c) 2008 Robert N. M. Watson\n * All rights reserved.\n *\n * This software was developed by Robert Watson for the TrustedBSD Project.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/security/mac_bsdextended/ugidfw_internal.h 189533 2009-03-08 12:32:06Z rwatson $\n */\n\n#ifndef _SYS_SECURITY_MAC_BSDEXTENDED_UGIDFW_INTERNAL_H\n#define\t_SYS_SECURITY_MAC_BSDEXTENDED_UGIDFW_INTERNAL_H\n\n/*\n * Central access control routines used by object-specific checks.\n */\nint\tugidfw_accmode2mbi(accmode_t accmode);\nint\tugidfw_check(struct ucred *cred, struct vnode *vp, struct vattr *vap,\n\t    int acc_mode);\nint\tugidfw_check_vp(struct ucred *cred, struct vnode *vp, int acc_mode);\n\n/*\n * System access control checks.\n */\nint\tugidfw_system_check_acct(struct ucred *cred, struct vnode *vp,\n\t    struct label *vplabel);\nint\tugidfw_system_check_auditctl(struct ucred *cred, struct vnode *vp,\n\t    struct label *vplabel);\nint\tugidfw_system_check_swapon(struct ucred *cred, struct vnode *vp,\n\t    struct label *vplabel);\n\n/*\n * Vnode access control checks.\n */\nint\tugidfw_vnode_check_access(struct ucred *cred, struct vnode *vp,\n\t    struct label *vplabel, accmode_t accmode);\nint\tugidfw_vnode_check_chdir(struct ucred *cred, struct vnode *dvp,\n\t    struct label *dvplabel);\nint\tugidfw_vnode_check_chroot(struct ucred *cred, struct vnode *dvp,\n\t    struct label *dvplabel);\nint\tugidfw_check_create_vnode(struct ucred *cred, struct vnode *dvp,\n\t    struct label *dvplabel, struct componentname *cnp,\n\t    struct vattr *vap);\nint\tugidfw_vnode_check_deleteacl(struct ucred *cred, struct vnode *vp,\n\t    struct label *vplabel, acl_type_t type);\nint\tugidfw_vnode_check_deleteextattr(struct ucred *cred,\n\t    struct vnode *vp, struct label *vplabel, int attrnamespace,\n\t    const char *name);\nint\tugidfw_vnode_check_exec(struct ucred *cred, struct vnode *vp,\n\t    struct label *vplabel, struct image_params *imgp,\n\t    struct label *execlabel);\nint\tugidfw_vnode_check_getacl(struct ucred *cred, struct vnode *vp,\n\t    struct label *vplabel, acl_type_t type);\nint\tugidfw_vnode_check_getextattr(struct ucred *cred, struct vnode *vp,\n\t    struct label *vplabel, int attrnamespace, const char *name);\nint\tugidfw_vnode_check_link(struct ucred *cred, struct vnode *dvp,\n\t    struct label *dvplabel, struct vnode *vp, struct label *label,\n\t    struct componentname *cnp);\nint\tugidfw_vnode_check_listextattr(struct ucred *cred, struct vnode *vp,\n\t    struct label *vplabel, int attrnamespace);\nint\tugidfw_vnode_check_lookup(struct ucred *cred, struct vnode *dvp,\n\t    struct label *dvplabel, struct componentname *cnp);\nint\tugidfw_vnode_check_open(struct ucred *cred, struct vnode *vp,\n\t    struct label *vplabel, accmode_t accmode);\nint\tugidfw_vnode_check_readdir(struct ucred *cred, struct vnode *dvp,\n\t    struct label *dvplabel);\nint\tugidfw_vnode_check_readdlink(struct ucred *cred, struct vnode *vp,\n\t    struct label *vplabel);\nint\tugidfw_vnode_check_rename_from(struct ucred *cred, struct vnode *dvp,\n\t    struct label *dvplabel, struct vnode *vp, struct label *vplabel,\n\t    struct componentname *cnp);\nint\tugidfw_vnode_check_rename_to(struct ucred *cred, struct vnode *dvp,\n\t    struct label *dvplabel, struct vnode *vp, struct label *vplabel,\n\t    int samedir, struct componentname *cnp);\nint\tugidfw_vnode_check_revoke(struct ucred *cred, struct vnode *vp,\n\t    struct label *vplabel);\nint\tugidfw_check_setacl_vnode(struct ucred *cred, struct vnode *vp,\n\t    struct label *vplabel, acl_type_t type, struct acl *acl);\nint\tugidfw_vnode_check_setextattr(struct ucred *cred, struct vnode *vp,\n\t    struct label *vplabel, int attrnamespace, const char *name);\nint\tugidfw_vnode_check_setflags(struct ucred *cred, struct vnode *vp,\n\t    struct label *vplabel, u_long flags);\nint\tugidfw_vnode_check_setmode(struct ucred *cred, struct vnode *vp,\n\t    struct label *vplabel, mode_t mode);\nint\tugidfw_vnode_check_setowner(struct ucred *cred, struct vnode *vp,\n\t    struct label *vplabel, uid_t uid, gid_t gid);\nint\tugidfw_vnode_check_setutimes(struct ucred *cred, struct vnode *vp,\n\t    struct label *vplabel, struct timespec atime,\n\t    struct timespec utime);\nint\tugidfw_vnode_check_stat(struct ucred *active_cred,\n\t    struct ucred *file_cred, struct vnode *vp, struct label *vplabel);\nint\tugidfw_vnode_check_unlink(struct ucred *cred, struct vnode *dvp,\n\t    struct label *dvplabel, struct vnode *vp, struct label *vplabel,\n\t    struct componentname *cnp);\n\n#endif /* _SYS_SECURITY_MAC_BSDEXTENDED_UGIDFW_INTERNAL_H */\n"
  },
  {
    "path": "freebsd-headers/security/mac_lomac/mac_lomac.h",
    "content": "/*-\n * Copyright (c) 1999-2002 Robert N. M. Watson\n * Copyright (c) 2001-2002 Networks Associates Technology, Inc.\n * All rights reserved.\n *\n * This software was developed by Robert Watson for the TrustedBSD Project.\n *\n * This software was developed for the FreeBSD Project in part by NAI Labs,\n * the Security Research Division of Network Associates, Inc. under\n * DARPA/SPAWAR contract N66001-01-C-8035 (\"CBOSS\"), as part of the DARPA\n * CHATS research program.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/security/mac_lomac/mac_lomac.h 140661 2005-01-23 14:26:09Z rwatson $\n */\n/*\n * Definitions for the TrustedBSD LOMAC integrity policy module.\n */\n#ifndef _SYS_SECURITY_MAC_LOMAC_H\n#define\t_SYS_SECURITY_MAC_LOMAC_H\n\n#define\tMAC_LOMAC_EXTATTR_NAMESPACE\tEXTATTR_NAMESPACE_SYSTEM\n#define\tMAC_LOMAC_EXTATTR_NAME\t\t\"mac_lomac\"\n\n#define\tMAC_LOMAC_LABEL_NAME\t\t\"lomac\"\n\n#define\tMAC_LOMAC_FLAG_SINGLE\t0x00000001\t/* ml_single initialized */\n#define\tMAC_LOMAC_FLAG_RANGE\t0x00000002\t/* ml_range* initialized */\n#define\tMAC_LOMAC_FLAG_AUX\t0x00000004\t/* ml_auxsingle initialized */\n#define\tMAC_LOMAC_FLAGS_BOTH\t(MAC_LOMAC_FLAG_SINGLE | MAC_LOMAC_FLAG_RANGE)\n#define\tMAC_LOMAC_FLAG_UPDATE\t0x00000008\t/* must demote this process */\n\n#define\tMAC_LOMAC_TYPE_UNDEF\t0\t/* Undefined */\n#define\tMAC_LOMAC_TYPE_GRADE\t1\t/* Hierarchal grade with mb_grade. */\n#define\tMAC_LOMAC_TYPE_LOW\t2\t/* Dominated by any\n\t\t\t\t\t * MAC_LOMAC_TYPE_LABEL. */\n#define\tMAC_LOMAC_TYPE_HIGH\t3\t/* Dominates any\n\t\t\t\t\t * MAC_LOMAC_TYPE_LABEL. */\n#define\tMAC_LOMAC_TYPE_EQUAL\t4\t/* Equivilent to any\n\t\t\t\t\t * MAC_LOMAC_TYPE_LABEL. */\n\n/*\n * Structures and constants associated with a LOMAC Integrity policy.\n * mac_lomac represents a LOMAC label, with mb_type determining its properties,\n * and mb_grade represents the hierarchal grade if valid for the current\n * mb_type.\n */\n\nstruct mac_lomac_element {\n\tu_short\tmle_type;\n\tu_short\tmle_grade;\n};\n\n/*\n * LOMAC labels start with two components: a single label, and a label\n * range.  Depending on the context, one or both may be used; the ml_flags\n * field permits the provider to indicate what fields are intended for\n * use.  The auxiliary label works the same way, but is only valid on\n * filesystem objects to provide inheritance semantics on directories\n * and \"non-demoting\" execution on executable files.\n */\nstruct mac_lomac {\n\tint\t\t\t\tml_flags;\n\tstruct mac_lomac_element\tml_single;\n\tstruct mac_lomac_element\tml_rangelow, ml_rangehigh;\n\tstruct mac_lomac_element\tml_auxsingle;\n};\n\n#endif /* !_SYS_SECURITY_MAC_LOMAC_H */\n"
  },
  {
    "path": "freebsd-headers/security/mac_mls/mac_mls.h",
    "content": "/*-\n * Copyright (c) 1999-2002 Robert N. M. Watson\n * Copyright (c) 2001-2004 Networks Associates Technology, Inc.\n * All rights reserved.\n *\n * This software was developed by Robert Watson for the TrustedBSD Project.\n *\n * This software was developed for the FreeBSD Project in part by Network\n * Associates Laboratories, the Security Research Division of Network\n * Associates, Inc. under DARPA/SPAWAR contract N66001-01-C-8035 (\"CBOSS\"),\n * as part of the DARPA CHATS research program.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/security/mac_mls/mac_mls.h 132232 2004-07-16 02:03:50Z rwatson $\n */\n/*\n * Definitions for the TrustedBSD MLS confidentiality policy module.\n */\n#ifndef _SYS_SECURITY_MAC_MLS_H\n#define\t_SYS_SECURITY_MAC_MLS_H\n\n#define\tMAC_MLS_EXTATTR_NAMESPACE\tEXTATTR_NAMESPACE_SYSTEM\n#define\tMAC_MLS_EXTATTR_NAME\t\t\"mac_mls\"\n\n#define\tMAC_MLS_LABEL_NAME\t\t\"mls\"\n\n#define\tMAC_MLS_FLAG_EFFECTIVE\t0x00000001\t/* mm_effective initialized */\n#define\tMAC_MLS_FLAG_RANGE\t0x00000002\t/* mm_range* initialized */\n#define\tMAC_MLS_FLAGS_BOTH\t(MAC_MLS_FLAG_EFFECTIVE | MAC_MLS_FLAG_RANGE)\n\n#define\tMAC_MLS_TYPE_UNDEF\t0\t/* Undefined */\n#define\tMAC_MLS_TYPE_LEVEL\t1\t/* Hierarchal level with mm_level. */\n#define\tMAC_MLS_TYPE_LOW\t2\t/* Dominated by any\n\t\t\t\t\t * MAC_MLS_TYPE_LABEL. */\n#define\tMAC_MLS_TYPE_HIGH\t3\t/* Dominates any\n\t\t\t\t\t * MAC_MLS_TYPE_LABEL. */\n#define\tMAC_MLS_TYPE_EQUAL\t4\t/* Equivilent to any\n\t\t\t\t\t * MAC_MLS_TYPE_LABEL. */\n\n/*\n * Structures and constants associated with a Multi-Level Security policy.\n * mac_mls represents an MLS label, with mm_type determining its properties,\n * and mm_level represents the hierarchal sensitivity level if valid for the\n * current mm_type.  If compartments are used, the same semantics apply as\n * long as the suject is in every compartment the object is in.  LOW, EQUAL\n * and HIGH cannot be in compartments.\n */\n\n/*\n * MLS compartments bit set size (in bits).\n */\n#define\tMAC_MLS_MAX_COMPARTMENTS\t256\n\nstruct mac_mls_element {\n\tu_short\tmme_type;\n\tu_short\tmme_level;\n\tu_char\tmme_compartments[MAC_MLS_MAX_COMPARTMENTS >> 3];\n};\n\n/*\n * MLS labels consist of two components: an effective label, and a label\n * range.  Depending on the context, one or both may be used; the mb_flags\n * field permits the provider to indicate what fields are intended for\n * use.\n */\nstruct mac_mls {\n\tint\t\t\tmm_flags;\n\tstruct mac_mls_element\tmm_effective;\n\tstruct mac_mls_element\tmm_rangelow, mm_rangehigh;\n};\n\n/*\n * MLS compartments bit test/set macros.\n * The range is 1 to MAC_MLS_MAX_COMPARTMENTS.\n */\n#define\tMAC_MLS_BIT_TEST(b, w) \\\n\t((w)[(((b) - 1) >> 3)] & (1 << (((b) - 1) & 7)))\n#define\tMAC_MLS_BIT_SET(b, w) \\\n\t((w)[(((b) - 1) >> 3)] |= (1 << (((b) - 1) & 7)))\n#define\tMAC_MLS_BIT_SET_EMPTY(set)\tmls_bit_set_empty(set)\n\n#endif /* !_SYS_SECURITY_MAC_MLS_H */\n"
  },
  {
    "path": "freebsd-headers/security/mac_partition/mac_partition.h",
    "content": "/*-\n * Copyright (c) 1999-2002 Robert N. M. Watson\n * Copyright (c) 2001-2002 Networks Associates Technology, Inc.\n * All rights reserved.\n *\n * This software was developed by Robert Watson for the TrustedBSD Project.\n *\n * This software was developed for the FreeBSD Project in part by Network\n * Associates Laboratories, the Security Research Division of Network\n * Associates, Inc. under DARPA/SPAWAR contract N66001-01-C-8035 (\"CBOSS\"),\n * as part of the DARPA CHATS research program.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/security/mac_partition/mac_partition.h 126097 2004-02-22 00:33:12Z rwatson $\n */\n\n/*\n * Definitions for the TrustedBSD partition policy module.\n */\n\n#ifndef _SYS_SECURITY_MAC_PARTITION_H\n#define\t_SYS_SECURITY_MAC_PARTITION_H\n\n#define\tMAC_PARTITION_LABEL_NAME\t\"partition\"\n\n#endif /* !_SYS_SECURITY_MAC_PARTITION_H */\n"
  },
  {
    "path": "freebsd-headers/security/openpam.h",
    "content": "/*-\n * Copyright (c) 2002-2003 Networks Associates Technology, Inc.\n * Copyright (c) 2004-2008 Dag-Erling Smørgrav\n * All rights reserved.\n *\n * This software was developed for the FreeBSD Project by ThinkSec AS and\n * Network Associates Laboratories, the Security Research Division of\n * Network Associates, Inc.  under DARPA/SPAWAR contract N66001-01-C-8035\n * (\"CBOSS\"), as part of the DARPA CHATS research program.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. The name of the author may not be used to endorse or promote\n *    products derived from this software without specific prior written\n *    permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $Id: openpam.h 418 2008-12-13 22:39:24Z des $\n */\n\n#ifndef SECURITY_OPENPAM_H_INCLUDED\n#define SECURITY_OPENPAM_H_INCLUDED\n\n/*\n * Annoying but necessary header pollution\n */\n#include <stdarg.h>\n\n#include <security/openpam_attr.h>\n\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\nstruct passwd;\n\n/*\n * API extensions\n */\nint\nopenpam_borrow_cred(pam_handle_t *_pamh,\n\tconst struct passwd *_pwd)\n\tOPENPAM_NONNULL((1,2));\n\nvoid\nopenpam_free_data(pam_handle_t *_pamh,\n\tvoid *_data,\n\tint _status);\n\nvoid\nopenpam_free_envlist(char **_envlist);\n\nconst char *\nopenpam_get_option(pam_handle_t *_pamh,\n\tconst char *_option);\n\nint\nopenpam_restore_cred(pam_handle_t *_pamh)\n\tOPENPAM_NONNULL((1));\n\nint\nopenpam_set_option(pam_handle_t *_pamh,\n\tconst char *_option,\n\tconst char *_value);\n\nint\npam_error(const pam_handle_t *_pamh,\n\tconst char *_fmt,\n\t...)\n\tOPENPAM_FORMAT ((__printf__, 2, 3))\n\tOPENPAM_NONNULL((1,2));\n\nint\npam_get_authtok(pam_handle_t *_pamh,\n\tint _item,\n\tconst char **_authtok,\n\tconst char *_prompt)\n\tOPENPAM_NONNULL((1,3));\n\nint\npam_info(const pam_handle_t *_pamh,\n\tconst char *_fmt,\n\t...)\n\tOPENPAM_FORMAT ((__printf__, 2, 3))\n\tOPENPAM_NONNULL((1,2));\n\nint\npam_prompt(const pam_handle_t *_pamh,\n\tint _style,\n\tchar **_resp,\n\tconst char *_fmt,\n\t...)\n\tOPENPAM_FORMAT ((__printf__, 4, 5))\n\tOPENPAM_NONNULL((1,4));\n\nint\npam_setenv(pam_handle_t *_pamh,\n\tconst char *_name,\n\tconst char *_value,\n\tint _overwrite)\n\tOPENPAM_NONNULL((1,2,3));\n\nint\npam_vinfo(const pam_handle_t *_pamh,\n\tconst char *_fmt,\n\tva_list _ap)\n\tOPENPAM_FORMAT ((__printf__, 2, 0))\n\tOPENPAM_NONNULL((1,2));\n\nint\npam_verror(const pam_handle_t *_pamh,\n\tconst char *_fmt,\n\tva_list _ap)\n\tOPENPAM_FORMAT ((__printf__, 2, 0))\n\tOPENPAM_NONNULL((1,2));\n\nint\npam_vprompt(const pam_handle_t *_pamh,\n\tint _style,\n\tchar **_resp,\n\tconst char *_fmt,\n\tva_list _ap)\n\tOPENPAM_FORMAT ((__printf__, 4, 0))\n\tOPENPAM_NONNULL((1,4));\n\n/*\n * Read cooked lines.\n * Checking for _IOFBF is a fairly reliable way to detect the presence\n * of <stdio.h>, as SUSv3 requires it to be defined there.\n */\n#ifdef _IOFBF\nchar *\nopenpam_readline(FILE *_f,\n\tint *_lineno,\n\tsize_t *_lenp)\n\tOPENPAM_NONNULL((1));\n#endif\n\n/*\n * Log levels\n */\nenum {\n\tPAM_LOG_DEBUG,\n\tPAM_LOG_VERBOSE,\n\tPAM_LOG_NOTICE,\n\tPAM_LOG_ERROR\n};\n\n/*\n * Log to syslog\n */\nvoid\n_openpam_log(int _level,\n\tconst char *_func,\n\tconst char *_fmt,\n\t...)\n\tOPENPAM_FORMAT ((__printf__, 3, 4))\n\tOPENPAM_NONNULL((3));\n\n#if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)\n#define openpam_log(lvl, ...) \\\n\t_openpam_log((lvl), __func__, __VA_ARGS__)\n#elif defined(__GNUC__) && (__GNUC__ >= 3)\n#define openpam_log(lvl, ...) \\\n\t_openpam_log((lvl), __func__, __VA_ARGS__)\n#elif defined(__GNUC__) && (__GNUC__ >= 2) && (__GNUC_MINOR__ >= 95)\n#define openpam_log(lvl, fmt...) \\\n\t_openpam_log((lvl), __func__, ##fmt)\n#elif defined(__GNUC__) && defined(__FUNCTION__)\n#define openpam_log(lvl, fmt...) \\\n\t_openpam_log((lvl), __FUNCTION__, ##fmt)\n#else\nvoid\nopenpam_log(int _level,\n\tconst char *_format,\n \t...)\n \tOPENPAM_FORMAT ((__printf__, 2, 3))\n\tOPENPAM_NONNULL((2));\n#endif\n\n/*\n * Generic conversation function\n */\nstruct pam_message;\nstruct pam_response;\nint openpam_ttyconv(int _n,\n\tconst struct pam_message **_msg,\n\tstruct pam_response **_resp,\n\tvoid *_data);\n\nextern int openpam_ttyconv_timeout;\n\n/*\n * Null conversation function\n */\nint openpam_nullconv(int _n,\n\tconst struct pam_message **_msg,\n\tstruct pam_response **_resp,\n\tvoid *_data);\n\n/*\n * PAM primitives\n */\nenum {\n\tPAM_SM_AUTHENTICATE,\n\tPAM_SM_SETCRED,\n\tPAM_SM_ACCT_MGMT,\n\tPAM_SM_OPEN_SESSION,\n\tPAM_SM_CLOSE_SESSION,\n\tPAM_SM_CHAUTHTOK,\n\t/* keep this last */\n\tPAM_NUM_PRIMITIVES\n};\n\n/*\n * Dummy service module function\n */\n#define PAM_SM_DUMMY(type)\t\t\t\t\t\t\\\nPAM_EXTERN int\t\t\t\t\t\t\t\t\\\npam_sm_##type(pam_handle_t *pamh, int flags,\t\t\t\t\\\n    int argc, const char *argv[])\t\t\t\t\t\\\n{\t\t\t\t\t\t\t\t\t\\\n\t\t\t\t\t\t\t\t\t\\\n\t(void)pamh;\t\t\t\t\t\t\t\\\n\t(void)flags;\t\t\t\t\t\t\t\\\n\t(void)argc;\t\t\t\t\t\t\t\\\n\t(void)argv;\t\t\t\t\t\t\t\\\n\treturn (PAM_IGNORE);\t\t\t\t\t\t\\\n}\n\n/*\n * PAM service module functions match this typedef\n */\nstruct pam_handle;\ntypedef int (*pam_func_t)(struct pam_handle *, int, int, const char **);\n\n/*\n * A struct that describes a module.\n */\ntypedef struct pam_module pam_module_t;\nstruct pam_module {\n\tchar\t\t*path;\n\tpam_func_t\t func[PAM_NUM_PRIMITIVES];\n\tvoid\t\t*dlh;\n};\n\n/*\n * Source-code compatibility with Linux-PAM modules\n */\n#if defined(PAM_SM_AUTH) || defined(PAM_SM_ACCOUNT) || \\\n\tdefined(PAM_SM_SESSION) || defined(PAM_SM_PASSWORD)\n# define LINUX_PAM_MODULE\n#endif\n\n#if defined(LINUX_PAM_MODULE) && !defined(PAM_SM_AUTH)\n# define _PAM_SM_AUTHENTICATE\t0\n# define _PAM_SM_SETCRED\t0\n#else\n# undef PAM_SM_AUTH\n# define PAM_SM_AUTH\n# define _PAM_SM_AUTHENTICATE\tpam_sm_authenticate\n# define _PAM_SM_SETCRED\tpam_sm_setcred\n#endif\n\n#if defined(LINUX_PAM_MODULE) && !defined(PAM_SM_ACCOUNT)\n# define _PAM_SM_ACCT_MGMT\t0\n#else\n# undef PAM_SM_ACCOUNT\n# define PAM_SM_ACCOUNT\n# define _PAM_SM_ACCT_MGMT\tpam_sm_acct_mgmt\n#endif\n\n#if defined(LINUX_PAM_MODULE) && !defined(PAM_SM_SESSION)\n# define _PAM_SM_OPEN_SESSION\t0\n# define _PAM_SM_CLOSE_SESSION\t0\n#else\n# undef PAM_SM_SESSION\n# define PAM_SM_SESSION\n# define _PAM_SM_OPEN_SESSION\tpam_sm_open_session\n# define _PAM_SM_CLOSE_SESSION\tpam_sm_close_session\n#endif\n\n#if defined(LINUX_PAM_MODULE) && !defined(PAM_SM_PASSWORD)\n# define _PAM_SM_CHAUTHTOK\t0\n#else\n# undef PAM_SM_PASSWORD\n# define PAM_SM_PASSWORD\n# define _PAM_SM_CHAUTHTOK\tpam_sm_chauthtok\n#endif\n\n/*\n * Infrastructure for static modules using GCC linker sets.\n * You are not expected to understand this.\n */\n#if !defined(PAM_SOEXT)\n# define PAM_SOEXT \".so\"\n#endif\n\n#if defined(OPENPAM_STATIC_MODULES)\n# if !defined(__GNUC__)\n#  error \"Don't know how to build static modules on non-GNU compilers\"\n# endif\n/* gcc, static linking */\n# include <sys/cdefs.h>\n# include <linker_set.h>\n# define PAM_EXTERN static\n# define PAM_MODULE_ENTRY(name)\t\t\t\t\t\t\\\n\tstatic char _pam_name[] = name PAM_SOEXT;\t\t\t\\\n\tstatic struct pam_module _pam_module = {\t\t\t\\\n\t\t.path = _pam_name,\t\t\t\t\t\\\n\t\t.func = {\t\t\t\t\t\t\\\n\t\t\t[PAM_SM_AUTHENTICATE] = _PAM_SM_AUTHENTICATE,\t\\\n\t\t\t[PAM_SM_SETCRED] = _PAM_SM_SETCRED,\t\t\\\n\t\t\t[PAM_SM_ACCT_MGMT] = _PAM_SM_ACCT_MGMT,\t\t\\\n\t\t\t[PAM_SM_OPEN_SESSION] = _PAM_SM_OPEN_SESSION,\t\\\n\t\t\t[PAM_SM_CLOSE_SESSION] = _PAM_SM_CLOSE_SESSION, \\\n\t\t\t[PAM_SM_CHAUTHTOK] = _PAM_SM_CHAUTHTOK\t\t\\\n\t\t},\t\t\t\t\t\t\t\\\n\t};\t\t\t\t\t\t\t\t\\\n\tDATA_SET(_openpam_static_modules, _pam_module)\n#else\n/* normal case */\n# define PAM_EXTERN\n# define PAM_MODULE_ENTRY(name)\n#endif\n\n#ifdef __cplusplus\n}\n#endif\n\n#endif /* !SECURITY_OPENPAM_H_INCLUDED */\n"
  },
  {
    "path": "freebsd-headers/security/openpam_attr.h",
    "content": "/*\n * $Id: openpam_attr.h 405 2007-12-19 11:38:27Z des $\n */\n\n#ifndef SECURITY_PAM_ATTRIBUTES_H_INCLUDED\n#define SECURITY_PAM_ATTRIBUTES_H_INCLUDED\n\n/* GCC attributes */\n#if defined(__GNUC__) && defined(__GNUC_MINOR__) && !defined(__STRICT_ANSI__)\n# define OPENPAM_GNUC_PREREQ(maj, min) \\\n        ((__GNUC__ << 16) + __GNUC_MINOR__ >= ((maj) << 16) + (min))\n#else\n# define OPENPAM_GNUC_PREREQ(maj, min) 0\n#endif\n\n#if OPENPAM_GNUC_PREREQ(2,5)\n# define OPENPAM_FORMAT(params) __attribute__((__format__ params))\n#else\n# define OPENPAM_FORMAT(params)\n#endif\n\n#if OPENPAM_GNUC_PREREQ(3,3)\n# define OPENPAM_NONNULL(params) __attribute__((__nonnull__ params))\n#else\n# define OPENPAM_NONNULL(params)\n#endif\n\n#endif /* !SECURITY_PAM_ATTRIBUTES_H_INCLUDED */\n"
  },
  {
    "path": "freebsd-headers/security/openpam_version.h",
    "content": "/*-\n * Copyright (c) 2002-2003 Networks Associates Technology, Inc.\n * Copyright (c) 2004-2007 Dag-Erling Smørgrav\n * All rights reserved.\n *\n * This software was developed for the FreeBSD Project by ThinkSec AS and\n * Network Associates Laboratories, the Security Research Division of\n * Network Associates, Inc.  under DARPA/SPAWAR contract N66001-01-C-8035\n * (\"CBOSS\"), as part of the DARPA CHATS research program.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. The name of the author may not be used to endorse or promote\n *    products derived from this software without specific prior written\n *    permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $Id: openpam_version.h 412 2008-01-29 19:31:46Z des $\n */\n\n#ifndef SECURITY_OPENPAM_VERSION_H_INCLUDED\n#define SECURITY_OPENPAM_VERSION_H_INCLUDED\n\n#define OPENPAM\n#define OPENPAM_VERSION\t20071221\n#define OPENPAM_RELEASE\t\"Hydrangea\"\n\n/* violates reserved namespace, but can't be removed for legacy reasons */\n#define _OPENPAM\n\n#endif /* !SECURITY_OPENPAM_VERSION_H_INCLUDED */\n"
  },
  {
    "path": "freebsd-headers/security/pam_appl.h",
    "content": "/*-\n * Copyright (c) 2002-2003 Networks Associates Technology, Inc.\n * Copyright (c) 2004-2007 Dag-Erling Smørgrav\n * All rights reserved.\n *\n * This software was developed for the FreeBSD Project by ThinkSec AS and\n * Network Associates Laboratories, the Security Research Division of\n * Network Associates, Inc.  under DARPA/SPAWAR contract N66001-01-C-8035\n * (\"CBOSS\"), as part of the DARPA CHATS research program.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. The name of the author may not be used to endorse or promote\n *    products derived from this software without specific prior written\n *    permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $Id: pam_appl.h 408 2007-12-21 11:36:24Z des $\n */\n\n#ifndef SECURITY_PAM_APPL_H_INCLUDED\n#define SECURITY_PAM_APPL_H_INCLUDED\n\n#include <security/pam_types.h>\n#include <security/pam_constants.h>\n#include <security/openpam_attr.h>\n\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\n/*\n * XSSO 4.2.1, 6\n */\n\nint\npam_acct_mgmt(pam_handle_t *_pamh,\n\tint _flags)\n\tOPENPAM_NONNULL((1));\n\nint\npam_authenticate(pam_handle_t *_pamh,\n\tint _flags)\n\tOPENPAM_NONNULL((1));\n\nint\npam_chauthtok(pam_handle_t *_pamh,\n\tint _flags)\n\tOPENPAM_NONNULL((1));\n\nint\npam_close_session(pam_handle_t *_pamh,\n\tint _flags)\n\tOPENPAM_NONNULL((1));\n\nint\npam_end(pam_handle_t *_pamh,\n\tint _status);\n\nint\npam_get_data(const pam_handle_t *_pamh,\n\tconst char *_module_data_name,\n\tconst void **_data)\n\tOPENPAM_NONNULL((1,2,3));\n\nint\npam_get_item(const pam_handle_t *_pamh,\n\tint _item_type,\n\tconst void **_item)\n\tOPENPAM_NONNULL((1,3));\n\nint\npam_get_user(pam_handle_t *_pamh,\n\tconst char **_user,\n\tconst char *_prompt)\n\tOPENPAM_NONNULL((1,2));\n\nconst char *\npam_getenv(pam_handle_t *_pamh,\n\tconst char *_name)\n\tOPENPAM_NONNULL((1,2));\n\nchar **\npam_getenvlist(pam_handle_t *_pamh)\n\tOPENPAM_NONNULL((1));\n\nint\npam_open_session(pam_handle_t *_pamh,\n\tint _flags)\n\tOPENPAM_NONNULL((1));\n\nint\npam_putenv(pam_handle_t *_pamh,\n\tconst char *_namevalue)\n\tOPENPAM_NONNULL((1,2));\n\nint\npam_set_data(pam_handle_t *_pamh,\n\tconst char *_module_data_name,\n\tvoid *_data,\n\tvoid (*_cleanup)(pam_handle_t *_pamh,\n\t\tvoid *_data,\n\t\tint _pam_end_status))\n\tOPENPAM_NONNULL((1,2));\n\nint\npam_set_item(pam_handle_t *_pamh,\n\tint _item_type,\n\tconst void *_item)\n\tOPENPAM_NONNULL((1));\n\nint\npam_setcred(pam_handle_t *_pamh,\n\tint _flags)\n\tOPENPAM_NONNULL((1));\n\nint\npam_start(const char *_service,\n\tconst char *_user,\n\tconst struct pam_conv *_pam_conv,\n\tpam_handle_t **_pamh)\n\tOPENPAM_NONNULL((4));\n\nconst char *\npam_strerror(const pam_handle_t *_pamh,\n\tint _error_number);\n\n/*\n * Single Sign-On extensions\n */\n#if 0\nint\npam_authenticate_secondary(pam_handle_t *_pamh,\n\tchar *_target_username,\n\tchar *_target_module_type,\n\tchar *_target_authn_domain,\n\tchar *_target_supp_data,\n\tchar *_target_module_authtok,\n\tint _flags);\n\nint\npam_get_mapped_authtok(pam_handle_t *_pamh,\n\tconst char *_target_module_username,\n\tconst char *_target_module_type,\n\tconst char *_target_authn_domain,\n\tsize_t *_target_authtok_len,\n\tunsigned char **_target_module_authtok);\n\nint\npam_get_mapped_username(pam_handle_t *_pamh,\n\tconst char *_src_username,\n\tconst char *_src_module_type,\n\tconst char *_src_authn_domain,\n\tconst char *_target_module_type,\n\tconst char *_target_authn_domain,\n\tchar **_target_module_username);\n\nint\npam_set_mapped_authtok(pam_handle_t *_pamh,\n\tconst char *_target_module_username,\n\tsize_t _target_authtok_len,\n\tunsigned char *_target_module_authtok,\n\tconst char *_target_module_type,\n\tconst char *_target_authn_domain);\n\nint\npam_set_mapped_username(pam_handle_t *_pamh,\n\tchar *_src_username,\n\tchar *_src_module_type,\n\tchar *_src_authn_domain,\n\tchar *_target_module_username,\n\tchar *_target_module_type,\n\tchar *_target_authn_domain);\n#endif /* 0 */\n\n#ifdef __cplusplus\n}\n#endif\n\n#endif /* !SECURITY_PAM_APPL_H_INCLUDED */\n"
  },
  {
    "path": "freebsd-headers/security/pam_constants.h",
    "content": "/*-\n * Copyright (c) 2002-2003 Networks Associates Technology, Inc.\n * Copyright (c) 2004-2007 Dag-Erling Smørgrav\n * All rights reserved.\n *\n * This software was developed for the FreeBSD Project by ThinkSec AS and\n * Network Associates Laboratories, the Security Research Division of\n * Network Associates, Inc.  under DARPA/SPAWAR contract N66001-01-C-8035\n * (\"CBOSS\"), as part of the DARPA CHATS research program.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. The name of the author may not be used to endorse or promote\n *    products derived from this software without specific prior written\n *    permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $Id: pam_constants.h 408 2007-12-21 11:36:24Z des $\n */\n\n#ifndef SECURITY_PAM_CONSTANTS_H_INCLUDED\n#define SECURITY_PAM_CONSTANTS_H_INCLUDED\n\n#include <security/openpam_version.h>\n\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\n/*\n * XSSO 5.2\n */\nenum {\n\tPAM_SUCCESS\t\t\t=   0,\n\tPAM_OPEN_ERR\t\t\t=   1,\n\tPAM_SYMBOL_ERR\t\t\t=   2,\n\tPAM_SERVICE_ERR\t\t\t=   3,\n\tPAM_SYSTEM_ERR\t\t\t=   4,\n\tPAM_BUF_ERR\t\t\t=   5,\n\tPAM_CONV_ERR\t\t\t=   6,\n\tPAM_PERM_DENIED\t\t\t=   7,\n\tPAM_MAXTRIES\t\t\t=   8,\n\tPAM_AUTH_ERR\t\t\t=   9,\n\tPAM_NEW_AUTHTOK_REQD\t\t=  10,\n\tPAM_CRED_INSUFFICIENT\t\t=  11,\n\tPAM_AUTHINFO_UNAVAIL\t\t=  12,\n\tPAM_USER_UNKNOWN\t\t=  13,\n\tPAM_CRED_UNAVAIL\t\t=  14,\n\tPAM_CRED_EXPIRED\t\t=  15,\n\tPAM_CRED_ERR\t\t\t=  16,\n\tPAM_ACCT_EXPIRED\t\t=  17,\n\tPAM_AUTHTOK_EXPIRED\t\t=  18,\n\tPAM_SESSION_ERR\t\t\t=  19,\n\tPAM_AUTHTOK_ERR\t\t\t=  20,\n\tPAM_AUTHTOK_RECOVERY_ERR\t=  21,\n\tPAM_AUTHTOK_LOCK_BUSY\t\t=  22,\n\tPAM_AUTHTOK_DISABLE_AGING\t=  23,\n\tPAM_NO_MODULE_DATA\t\t=  24,\n\tPAM_IGNORE\t\t\t=  25,\n\tPAM_ABORT\t\t\t=  26,\n\tPAM_TRY_AGAIN\t\t\t=  27,\n\tPAM_MODULE_UNKNOWN\t\t=  28,\n\tPAM_DOMAIN_UNKNOWN\t\t=  29,\n\tPAM_NUM_ERRORS\t\t\t\t\t/* OpenPAM extension */\n};\n\n/*\n * XSSO 5.3\n */\nenum {\n\tPAM_PROMPT_ECHO_OFF\t\t=   1,\n\tPAM_PROMPT_ECHO_ON\t\t=   2,\n\tPAM_ERROR_MSG\t\t\t=   3,\n\tPAM_TEXT_INFO\t\t\t=   4,\n\tPAM_MAX_NUM_MSG\t\t\t=  32,\n\tPAM_MAX_MSG_SIZE\t\t= 512,\n\tPAM_MAX_RESP_SIZE\t\t= 512\n};\n\n/*\n * XSSO 5.4\n */\nenum {\n\t/* some compilers promote 0x8000000 to long */\n\tPAM_SILENT\t\t\t= (-0x7fffffff - 1),\n\tPAM_DISALLOW_NULL_AUTHTOK\t= 0x1,\n\tPAM_ESTABLISH_CRED\t\t= 0x1,\n\tPAM_DELETE_CRED\t\t\t= 0x2,\n\tPAM_REINITIALIZE_CRED\t\t= 0x4,\n\tPAM_REFRESH_CRED\t\t= 0x8,\n\tPAM_PRELIM_CHECK\t\t= 0x1,\n\tPAM_UPDATE_AUTHTOK\t\t= 0x2,\n\tPAM_CHANGE_EXPIRED_AUTHTOK\t= 0x4\n};\n\n/*\n * XSSO 5.5\n */\nenum {\n\tPAM_SERVICE\t\t\t=   1,\n\tPAM_USER\t\t\t=   2,\n\tPAM_TTY\t\t\t\t=   3,\n\tPAM_RHOST\t\t\t=   4,\n\tPAM_CONV\t\t\t=   5,\n\tPAM_AUTHTOK\t\t\t=   6,\n\tPAM_OLDAUTHTOK\t\t\t=   7,\n\tPAM_RUSER\t\t\t=   8,\n\tPAM_USER_PROMPT\t\t\t=   9,\n\tPAM_REPOSITORY\t\t\t=  10,\n\tPAM_AUTHTOK_PROMPT\t\t=  11,\t\t/* OpenPAM extension */\n\tPAM_OLDAUTHTOK_PROMPT\t\t=  12,\t\t/* OpenPAM extension */\n\tPAM_NUM_ITEMS\t\t\t\t\t/* OpenPAM extension */\n};\n\n#ifdef __cplusplus\n}\n#endif\n\n#endif /* !SECURITY_PAM_CONSTANTS_H_INCLUDED */\n"
  },
  {
    "path": "freebsd-headers/security/pam_mod_misc.h",
    "content": "/*-\n * Copyright 1998 Juniper Networks, Inc.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t$FreeBSD: release/9.0.0/lib/libpam/libpam/security/pam_mod_misc.h 160434 2006-07-17 11:48:52Z stefanf $\n */\n\n#ifndef PAM_MOD_MISC_H\n#define PAM_MOD_MISC_H\n\n#include <sys/cdefs.h>\n\n/*\n * Common option names\n */\n#define\tPAM_OPT_NULLOK\t\t\"nullok\"\n#define PAM_OPT_AUTH_AS_SELF\t\"auth_as_self\"\n#define PAM_OPT_ECHO_PASS\t\"echo_pass\"\n#define PAM_OPT_DEBUG\t\t\"debug\"\n\n__BEGIN_DECLS\nvoid\t_pam_verbose_error(pam_handle_t *, int, const char *,\n\t\tconst char *, const char *, ...);\n__END_DECLS\n\n#define\tPAM_LOG(...) \\\n\topenpam_log(PAM_LOG_DEBUG, __VA_ARGS__)\n\n#define PAM_RETURN(arg) \\\n\treturn (arg)\n\n#define PAM_VERBOSE_ERROR(...) \\\n\t_pam_verbose_error(pamh, flags, __FILE__, __func__, __VA_ARGS__)\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/security/pam_modules.h",
    "content": "/*-\n * Copyright (c) 2002-2003 Networks Associates Technology, Inc.\n * Copyright (c) 2004-2007 Dag-Erling Smørgrav\n * All rights reserved.\n *\n * This software was developed for the FreeBSD Project by ThinkSec AS and\n * Network Associates Laboratories, the Security Research Division of\n * Network Associates, Inc.  under DARPA/SPAWAR contract N66001-01-C-8035\n * (\"CBOSS\"), as part of the DARPA CHATS research program.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. The name of the author may not be used to endorse or promote\n *    products derived from this software without specific prior written\n *    permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $Id: pam_modules.h 408 2007-12-21 11:36:24Z des $\n */\n\n#ifndef SECURITY_PAM_MODULES_H_INCLUDED\n#define SECURITY_PAM_MODULES_H_INCLUDED\n\n#include <security/pam_types.h>\n#include <security/pam_constants.h>\n#include <security/openpam.h>\n\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\n/*\n * XSSO 4.2.2, 6\n */\n\n#if defined(PAM_SM_ACCOUNT)\nPAM_EXTERN int\npam_sm_acct_mgmt(pam_handle_t *_pamh,\n\tint _flags,\n\tint _argc,\n\tconst char **_argv);\n#endif\n\n#if defined(PAM_SM_AUTH)\nPAM_EXTERN int\npam_sm_authenticate(pam_handle_t *_pamh,\n\tint _flags,\n\tint _argc,\n\tconst char **_argv);\n#endif\n\n#if defined(PAM_SM_PASSWORD)\nPAM_EXTERN int\npam_sm_chauthtok(pam_handle_t *_pamh,\n\tint _flags,\n\tint _argc,\n\tconst char **_argv);\n#endif\n\n#if defined(PAM_SM_SESSION)\nPAM_EXTERN int\npam_sm_close_session(pam_handle_t *_pamh,\n\tint _flags,\n\tint _args,\n\tconst char **_argv);\n#endif\n\n#if defined(PAM_SM_SESSION)\nPAM_EXTERN int\npam_sm_open_session(pam_handle_t *_pamh,\n\tint _flags,\n\tint _argc,\n\tconst char **_argv);\n#endif\n\n#if defined(PAM_SM_AUTH)\nPAM_EXTERN int\npam_sm_setcred(pam_handle_t *_pamh,\n\tint _flags,\n\tint _argc,\n\tconst char **_argv);\n#endif\n\n/*\n * Single Sign-On extensions\n */\n#if 0\nPAM_EXTERN int\npam_sm_authenticate_secondary(pam_handle_t *_pamh,\n\tchar *_target_username,\n\tchar *_target_module_type,\n\tchar *_target_authn_domain,\n\tchar *_target_supp_data,\n\tunsigned char *_target_module_authtok,\n\tint _flags,\n\tint _argc,\n\tconst char **_argv);\n\nPAM_EXTERN int\npam_sm_get_mapped_authtok(pam_handle_t *_pamh,\n\tchar *_target_module_username,\n\tchar *_target_module_type,\n\tchar *_target_authn_domain,\n\tsize_t *_target_authtok_len,\n\tunsigned char **_target_module_authtok,\n\tint _argc,\n\tchar *_argv);\n\nPAM_EXTERN int\npam_sm_get_mapped_username(pam_handle_t *_pamh,\n\tchar *_src_username,\n\tchar *_src_module_type,\n\tchar *_src_authn_domain,\n\tchar *_target_module_type,\n\tchar *_target_authn_domain,\n\tchar **_target_module_username,\n\tint _argc,\n\tconst char **_argv);\n\nPAM_EXTERN int\npam_sm_set_mapped_authtok(pam_handle_t *_pamh,\n\tchar *_target_module_username,\n\tsize_t _target_authtok_len,\n\tunsigned char *_target_module_authtok,\n\tchar *_target_module_type,\n\tchar *_target_authn_domain,\n\tint _argc,\n\tconst char *_argv);\n\nPAM_EXTERN int\npam_sm_set_mapped_username(pam_handle_t *_pamh,\n\tchar *_target_module_username,\n\tchar *_target_module_type,\n\tchar *_target_authn_domain,\n\tint _argc,\n\tconst char **_argv);\n\n#endif /* 0 */\n\n#ifdef __cplusplus\n}\n#endif\n\n#endif /* !SECURITY_PAM_MODULES_H_INCLUDED */\n"
  },
  {
    "path": "freebsd-headers/security/pam_types.h",
    "content": "/*-\n * Copyright (c) 2002-2003 Networks Associates Technology, Inc.\n * Copyright (c) 2004-2007 Dag-Erling Smørgrav\n * All rights reserved.\n *\n * This software was developed for the FreeBSD Project by ThinkSec AS and\n * Network Associates Laboratories, the Security Research Division of\n * Network Associates, Inc.  under DARPA/SPAWAR contract N66001-01-C-8035\n * (\"CBOSS\"), as part of the DARPA CHATS research program.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. The name of the author may not be used to endorse or promote\n *    products derived from this software without specific prior written\n *    permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $Id: pam_types.h 408 2007-12-21 11:36:24Z des $\n */\n\n#ifndef SECURITY_PAM_TYPES_H_INCLUDED\n#define SECURITY_PAM_TYPES_H_INCLUDED\n\n#include <stddef.h>\n\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\n/*\n * XSSO 5.1.1\n */\nstruct pam_message {\n\tint\t msg_style;\n\tchar\t*msg;\n};\n\nstruct pam_response {\n\tchar\t*resp;\n\tint\t resp_retcode;\n};\n\n/*\n * XSSO 5.1.2\n */\nstruct pam_conv {\n\tint\t(*conv)(int, const struct pam_message **,\n\t    struct pam_response **, void *);\n\tvoid\t*appdata_ptr;\n};\n\n/*\n * XSSO 5.1.3\n */\nstruct pam_handle;\ntypedef struct pam_handle pam_handle_t;\n\n/*\n * Solaris 9\n */\ntypedef struct pam_repository {\n\tchar\t*type;\n\tvoid\t*scope;\n\tsize_t\t scope_len;\n} pam_repository_t;\n\n#ifdef __cplusplus\n}\n#endif\n\n#endif /* !SECURITY_PAM_TYPES_H_INCLUDED */\n"
  },
  {
    "path": "freebsd-headers/semaphore.h",
    "content": "/*\n * Copyright (c) 2010 David Xu <davidxu@freebsd.org>\n *\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice unmodified, this list of conditions, and the following\n *    disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR\n * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES\n * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,\n * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF\n * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/include/semaphore.h 201546 2010-01-05 02:37:59Z davidxu $\n */\n\n/* semaphore.h: POSIX 1003.1b semaphores */\n\n#ifndef _SEMAPHORE_H_\n#define _SEMAPHORE_H_\n\n#include <sys/cdefs.h>\n#include <sys/_types.h>\n#include <sys/_umtx.h>\n\nstruct _sem {\n\t__uint32_t\t_magic;\n\tstruct _usem\t_kern;\n};\n\ntypedef\tstruct _sem\tsem_t;\n\n#define\tSEM_FAILED\t((sem_t *)0)\n#define\tSEM_VALUE_MAX\t__INT_MAX\n\nstruct timespec;\n\n__BEGIN_DECLS\nint\t sem_close(sem_t *);\nint\t sem_destroy(sem_t *);\nint\t sem_getvalue(sem_t * __restrict, int * __restrict);\nint\t sem_init(sem_t *, int, unsigned int);\nsem_t\t*sem_open(const char *, int, ...);\nint\t sem_post(sem_t *);\nint\t sem_timedwait(sem_t * __restrict, const struct timespec * __restrict);\nint\t sem_trywait(sem_t *);\nint\t sem_unlink(const char *);\nint\t sem_wait(sem_t *);\n__END_DECLS\n\n#endif /* !_SEMAPHORE_H_ */\n"
  },
  {
    "path": "freebsd-headers/setjmp.h",
    "content": "/*-\n * Copyright (c) 1990, 1993\n *\tThe Regents of the University of California.  All rights reserved.\n * (c) UNIX System Laboratories, Inc.\n * All or some portions of this file are derived from material licensed\n * to the University of California by American Telephone and Telegraph\n * Co. or Unix System Laboratories, Inc. and are reproduced herein with\n * the permission of UNIX System Laboratories, Inc.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t@(#)setjmp.h\t8.2 (Berkeley) 1/21/94\n * $FreeBSD: release/9.0.0/include/setjmp.h 203964 2010-02-16 19:39:50Z imp $\n */\n\n#ifndef _SETJMP_H_\n#define _SETJMP_H_\n\n#include <sys/cdefs.h>\n\n/* The size of the jmp_buf is machine dependent: */\n#include <machine/setjmp.h>\n\n__BEGIN_DECLS\n#if __BSD_VISIBLE || __XSI_VISIBLE >= 600\nvoid\t_longjmp(jmp_buf, int) __dead2;\nint\t_setjmp(jmp_buf);\n#endif\nvoid\tlongjmp(jmp_buf, int) __dead2;\n#if __BSD_VISIBLE\nvoid\tlongjmperror(void);\n#endif\nint\tsetjmp(jmp_buf);\n#if __BSD_VISIBLE || __POSIX_VISIBLE || __XSI_VISIBLE\nvoid\tsiglongjmp(sigjmp_buf, int) __dead2;\nint\tsigsetjmp(sigjmp_buf, int);\n#endif\n__END_DECLS\n\n#endif /* !_SETJMP_H_ */\n"
  },
  {
    "path": "freebsd-headers/sha.h",
    "content": "/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)\n * All rights reserved.\n *\n * This package is an SSL implementation written\n * by Eric Young (eay@cryptsoft.com).\n * The implementation was written so as to conform with Netscapes SSL.\n * \n * This library is free for commercial and non-commercial use as long as\n * the following conditions are aheared to.  The following conditions\n * apply to all code found in this distribution, be it the RC4, RSA,\n * lhash, DES, etc., code; not just the SSL code.  The SSL documentation\n * included with this distribution is covered by the same copyright terms\n * except that the holder is Tim Hudson (tjh@cryptsoft.com).\n * \n * Copyright remains Eric Young's, and as such any Copyright notices in\n * the code are not to be removed.\n * If this package is used in a product, Eric Young should be given attribution\n * as the author of the parts of the library used.\n * This can be in the form of a textual message at program startup or\n * in documentation (online or textual) provided with the package.\n * \n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. All advertising materials mentioning features or use of this software\n *    must display the following acknowledgement:\n *    \"This product includes cryptographic software written by\n *     Eric Young (eay@cryptsoft.com)\"\n *    The word 'cryptographic' can be left out if the rouines from the library\n *    being used are not cryptographic related :-).\n * 4. If you include any Windows specific code (or a derivative thereof) from \n *    the apps directory (application code) you must include an acknowledgement:\n *    \"This product includes software written by Tim Hudson (tjh@cryptsoft.com)\"\n * \n * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n * \n * The licence and distribution terms for any publically available version or\n * derivative of this code cannot be changed.  i.e. this code cannot simply be\n * copied and put under another distribution licence\n * [including the GNU Public Licence.]\n *\n * $FreeBSD: release/9.0.0/lib/libmd/sha.h 154479 2006-01-17 15:35:57Z phk $\n */\n\n#ifndef _SHA_H_\n#define _SHA_H_\t\t1\n\n#include <sys/cdefs.h>\n#include <sys/types.h>\t\t/* XXX switch to machine/ansi.h and __ types */\n\n#define\tSHA_CBLOCK\t64\n#define\tSHA_LBLOCK\t16\n#define\tSHA_BLOCK\t16\n#define\tSHA_LAST_BLOCK  56\n#define\tSHA_LENGTH_BLOCK 8\n#define\tSHA_DIGEST_LENGTH 20\n\ntypedef struct SHAstate_st {\n\tu_int32_t h0, h1, h2, h3, h4;\n\tu_int32_t Nl, Nh;\n\tu_int32_t data[SHA_LBLOCK];\n\tint num;\n} SHA_CTX;\n#define\tSHA1_CTX\tSHA_CTX\n\n__BEGIN_DECLS\nvoid\tSHA_Init(SHA_CTX *c);\nvoid\tSHA_Update(SHA_CTX *c, const void *data, size_t len);\nvoid\tSHA_Final(unsigned char *md, SHA_CTX *c);\nchar   *SHA_End(SHA_CTX *, char *);\nchar   *SHA_File(const char *, char *);\nchar   *SHA_FileChunk(const char *, char *, off_t, off_t);\nchar   *SHA_Data(const void *, unsigned int, char *);\nvoid\tSHA1_Init(SHA_CTX *c);\nvoid\tSHA1_Update(SHA_CTX *c, const void *data, size_t len);\nvoid\tSHA1_Final(unsigned char *md, SHA_CTX *c);\nchar   *SHA1_End(SHA_CTX *, char *);\nchar   *SHA1_File(const char *, char *);\nchar   *SHA1_FileChunk(const char *, char *, off_t, off_t);\nchar   *SHA1_Data(const void *, unsigned int, char *);\n__END_DECLS\n\n#endif /* !_SHA_H_ */\n"
  },
  {
    "path": "freebsd-headers/sha256.h",
    "content": "/*-\n * Copyright 2005 Colin Percival\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/lib/libmd/sha256.h 154479 2006-01-17 15:35:57Z phk $\n */\n\n#ifndef _SHA256_H_\n#define _SHA256_H_\n\n#include <sys/types.h>\n\ntypedef struct SHA256Context {\n\tuint32_t state[8];\n\tuint32_t count[2];\n\tunsigned char buf[64];\n} SHA256_CTX;\n\n__BEGIN_DECLS\nvoid\tSHA256_Init(SHA256_CTX *);\nvoid\tSHA256_Update(SHA256_CTX *, const void *, size_t);\nvoid\tSHA256_Final(unsigned char [32], SHA256_CTX *);\nchar   *SHA256_End(SHA256_CTX *, char *);\nchar   *SHA256_File(const char *, char *);\nchar   *SHA256_FileChunk(const char *, char *, off_t, off_t);\nchar   *SHA256_Data(const void *, unsigned int, char *);\n__END_DECLS\n\n#endif /* !_SHA256_H_ */\n"
  },
  {
    "path": "freebsd-headers/sha512.h",
    "content": "/*-\n * Copyright 2005 Colin Percival\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/lib/libmd/sha512.h 220496 2011-04-09 13:56:29Z markm $\n */\n\n#ifndef _SHA512_H_\n#define _SHA512_H_\n\n#include <sys/types.h>\n\ntypedef struct SHA512Context {\n\tuint64_t state[8];\n\tuint64_t count[2];\n\tunsigned char buf[128];\n} SHA512_CTX;\n\n__BEGIN_DECLS\nvoid\tSHA512_Init(SHA512_CTX *);\nvoid\tSHA512_Update(SHA512_CTX *, const void *, size_t);\nvoid\tSHA512_Final(unsigned char [64], SHA512_CTX *);\nchar   *SHA512_End(SHA512_CTX *, char *);\nchar   *SHA512_File(const char *, char *);\nchar   *SHA512_FileChunk(const char *, char *, off_t, off_t);\nchar   *SHA512_Data(const void *, unsigned int, char *);\n__END_DECLS\n\n#endif /* !_SHA512_H_ */\n"
  },
  {
    "path": "freebsd-headers/signal.h",
    "content": "/*-\n * Copyright (c) 1991, 1993\n *\tThe Regents of the University of California.  All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t@(#)signal.h\t8.3 (Berkeley) 3/30/94\n * $FreeBSD: release/9.0.0/include/signal.h 218881 2011-02-20 09:52:29Z kib $\n */\n\n#ifndef _SIGNAL_H_\n#define\t_SIGNAL_H_\n\n#include <sys/cdefs.h>\n#include <sys/_types.h>\n#include <sys/signal.h>\n\n#if __BSD_VISIBLE\n/*\n * XXX should enlarge these, if only to give empty names instead of bounds\n * errors for large signal numbers.\n */\nextern __const char *__const sys_signame[NSIG];\nextern __const char *__const sys_siglist[NSIG];\nextern __const int sys_nsig;\n#endif\n\n#if __POSIX_VISIBLE >= 200112 || __XSI_VISIBLE\n#ifndef _PID_T_DECLARED\ntypedef\t__pid_t\t\tpid_t;\n#define\t_PID_T_DECLARED\n#endif\n#endif\n\n#if __POSIX_VISIBLE || __XSI_VISIBLE\nstruct pthread;\t\t/* XXX */\ntypedef struct pthread *__pthread_t;\n#if !defined(_PTHREAD_T_DECLARED) && __POSIX_VISIBLE >= 200809\ntypedef __pthread_t pthread_t;\n#define\t_PTHREAD_T_DECLARED\n#endif\n#endif /* __POSIX_VISIBLE || __XSI_VISIBLE */\n\n__BEGIN_DECLS\nint\traise(int);\n\n#if __POSIX_VISIBLE || __XSI_VISIBLE\nint\tkill(__pid_t, int);\nint\tpthread_kill(__pthread_t, int);\nint\tpthread_sigmask(int, const __sigset_t * __restrict,\n\t    __sigset_t * __restrict);\nint\tsigaction(int, const struct sigaction * __restrict,\n\t    struct sigaction * __restrict);\nint\tsigaddset(sigset_t *, int);\nint\tsigdelset(sigset_t *, int);\nint\tsigemptyset(sigset_t *);\nint\tsigfillset(sigset_t *);\nint\tsigismember(const sigset_t *, int);\nint\tsigpending(sigset_t *);\nint\tsigprocmask(int, const sigset_t * __restrict, sigset_t * __restrict);\nint\tsigsuspend(const sigset_t *);\nint\tsigwait(const sigset_t * __restrict, int * __restrict);\n#endif\n\n#if __POSIX_VISIBLE >= 199506 || __XSI_VISIBLE >= 600\nint\tsigqueue(__pid_t, int, const union sigval);\n\nstruct timespec;\nint\tsigtimedwait(const sigset_t * __restrict, siginfo_t * __restrict,\n\t    const struct timespec * __restrict);\nint\tsigwaitinfo(const sigset_t * __restrict, siginfo_t * __restrict);\n#endif\n\n#if __XSI_VISIBLE\nint\tkillpg(__pid_t, int);\nint\tsigaltstack(const stack_t * __restrict, stack_t * __restrict); \nint\tsighold(int);\nint\tsigignore(int);\nint\tsigpause(int);\nint\tsigrelse(int);\nvoid\t(*sigset(int, void (*)(int)))(int);\nint\txsi_sigpause(int);\n#endif\n\n#if __XSI_VISIBLE >= 600\nint\tsiginterrupt(int, int);\n#endif\n\n#if __POSIX_VISIBLE >= 200809 || __BSD_VISIBLE\nvoid\tpsignal(unsigned int, const char *);\n#endif\n\n#if __BSD_VISIBLE\nint\tsigblock(int);\nstruct __ucontext;\t\t/* XXX spec requires a complete declaration. */\nint\tsigreturn(const struct __ucontext *);\nint\tsigsetmask(int);\nint\tsigstack(const struct sigstack *, struct sigstack *);\nint\tsigvec(int, struct sigvec *, struct sigvec *);\n#endif\n__END_DECLS\n\n#endif /* !_SIGNAL_H_ */\n"
  },
  {
    "path": "freebsd-headers/spawn.h",
    "content": "/*-\n * Copyright (c) 2008 Ed Schouten <ed@FreeBSD.org>\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/include/spawn.h 179873 2008-06-19 07:30:32Z ed $\n */\n\n#ifndef _SPAWN_H_\n#define _SPAWN_H_\n\n#include <sys/cdefs.h>\n#include <sys/_types.h>\n#include <sys/_sigset.h>\n\n#ifndef _MODE_T_DECLARED\ntypedef\t__mode_t\tmode_t;\n#define\t_MODE_T_DECLARED\n#endif\n\n#ifndef _PID_T_DECLARED\ntypedef\t__pid_t\t\tpid_t;\n#define\t_PID_T_DECLARED\n#endif\n\n#ifndef _SIGSET_T_DECLARED\n#define\t_SIGSET_T_DECLARED\ntypedef\t__sigset_t\tsigset_t;\n#endif\n\nstruct sched_param;\n\ntypedef struct __posix_spawnattr\t\t*posix_spawnattr_t;\ntypedef struct __posix_spawn_file_actions\t*posix_spawn_file_actions_t;\n\n#define POSIX_SPAWN_RESETIDS\t\t0x01\n#define POSIX_SPAWN_SETPGROUP\t\t0x02\n#define POSIX_SPAWN_SETSCHEDPARAM\t0x04\n#define POSIX_SPAWN_SETSCHEDULER\t0x08\n#define POSIX_SPAWN_SETSIGDEF\t\t0x10\n#define POSIX_SPAWN_SETSIGMASK\t\t0x20\n\n__BEGIN_DECLS\n/*\n * Spawn routines\n *\n * XXX both arrays should be __restrict, but this does not work when GCC\n * is invoked with -std=c99.\n */\nint posix_spawn(pid_t * __restrict, const char * __restrict,\n    const posix_spawn_file_actions_t *, const posix_spawnattr_t * __restrict,\n    char * const [], char * const []);\nint posix_spawnp(pid_t * __restrict, const char * __restrict,\n    const posix_spawn_file_actions_t *, const posix_spawnattr_t * __restrict,\n    char * const [], char * const []);\n\n/*\n * File descriptor actions\n */\nint posix_spawn_file_actions_init(posix_spawn_file_actions_t *);\nint posix_spawn_file_actions_destroy(posix_spawn_file_actions_t *);\n\nint posix_spawn_file_actions_addopen(posix_spawn_file_actions_t * __restrict,\n    int, const char * __restrict, int, mode_t);\nint posix_spawn_file_actions_adddup2(posix_spawn_file_actions_t *, int, int);\nint posix_spawn_file_actions_addclose(posix_spawn_file_actions_t *, int);\n\n/*\n * Spawn attributes\n */\nint posix_spawnattr_init(posix_spawnattr_t *);\nint posix_spawnattr_destroy(posix_spawnattr_t *);\n\nint posix_spawnattr_getflags(const posix_spawnattr_t * __restrict,\n    short * __restrict);\nint posix_spawnattr_getpgroup(const posix_spawnattr_t * __restrict,\n    pid_t * __restrict);\nint posix_spawnattr_getschedparam(const posix_spawnattr_t * __restrict,\n    struct sched_param * __restrict);\nint posix_spawnattr_getschedpolicy(const posix_spawnattr_t * __restrict,\n    int * __restrict);\nint posix_spawnattr_getsigdefault(const posix_spawnattr_t * __restrict,\n    sigset_t * __restrict);\nint posix_spawnattr_getsigmask(const posix_spawnattr_t * __restrict,\n    sigset_t * __restrict sigmask);\n\nint posix_spawnattr_setflags(posix_spawnattr_t *, short);\nint posix_spawnattr_setpgroup(posix_spawnattr_t *, pid_t);\nint posix_spawnattr_setschedparam(posix_spawnattr_t * __restrict,\n    const struct sched_param * __restrict);\nint posix_spawnattr_setschedpolicy(posix_spawnattr_t *, int);\nint posix_spawnattr_setsigdefault(posix_spawnattr_t * __restrict,\n    const sigset_t * __restrict);\nint posix_spawnattr_setsigmask(posix_spawnattr_t * __restrict,\n    const sigset_t * __restrict);\n__END_DECLS\n\n#endif /* !_SPAWN_H_ */\n"
  },
  {
    "path": "freebsd-headers/ssp/ssp.h",
    "content": "/* Object size checking support macros.\n   Copyright (C) 2004, 2005 Free Software Foundation, Inc.\n\nThis file is part of GCC.\n\nGCC is free software; you can redistribute it and/or modify it under\nthe terms of the GNU General Public License as published by the Free\nSoftware Foundation; either version 2, or (at your option) any later\nversion.\n\nIn addition to the permissions in the GNU General Public License, the\nFree Software Foundation gives you unlimited permission to link the\ncompiled version of this file into combinations with other programs,\nand to distribute those combinations without any restriction coming\nfrom the use of this file.  (The General Public License restrictions\ndo apply in other respects; for example, they cover modification of\nthe file, and distribution when not linked into a combine\nexecutable.)\n\nGCC is distributed in the hope that it will be useful, but WITHOUT ANY\nWARRANTY; without even the implied warranty of MERCHANTABILITY or\nFITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License\nfor more details.\n\nYou should have received a copy of the GNU General Public License\nalong with GCC; see the file COPYING.  If not, write to the Free\nSoftware Foundation, 51 Franklin Street, Fifth Floor, Boston, MA\n02110-1301, USA.  */\n\n/* As a special exception, if you link this library with files compiled with\n   GCC to produce an executable, this does not cause the resulting executable\n   to be covered by the GNU General Public License. This exception does not\n   however invalidate any other reasons why the executable file might be\n   covered by the GNU General Public License.  */\n\n#ifndef _SSP_H\n#define _SSP_H 1\n\n#if _FORTIFY_SOURCE > 0 && __OPTIMIZE__ > 0 \\\n    && defined __GNUC__ \\\n    && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 1)) \\\n    && !defined __cplusplus\n# if _FORTIFY_SOURCE == 1\n#  define __SSP_FORTIFY_LEVEL 1\n# elif _FORTIFY_SOURCE > 1\n#  define __SSP_FORTIFY_LEVEL 2\n# endif\n#endif\n\n#if __SSP_FORTIFY_LEVEL > 0\n# include <stddef.h>\n# define __ssp_bos(ptr) __builtin_object_size (ptr, __SSP_FORTIFY_LEVEL > 1)\n# define __ssp_bos0(ptr) __builtin_object_size (ptr, 0)\n\n# define __SSP_REDIRECT(name, proto, alias) \\\n  name proto __asm__ (__SSP_ASMNAME (#alias))\n# define __SSP_ASMNAME(cname)  __SSP_ASMNAME2 (__USER_LABEL_PREFIX__, cname)\n# define __SSP_ASMNAME2(prefix, cname) __SSP_ASMNAME3 (prefix) cname\n# define __SSP_ASMNAME3(prefix) #prefix\n\n# define __SSP_HAVE_VSNPRINTF\n\nextern void __chk_fail (void) __attribute__((__noreturn__));\n#endif\n\n#endif /* _SSP_H */\n"
  },
  {
    "path": "freebsd-headers/ssp/stdio.h",
    "content": "/* Checking macros for stdio functions.\n   Copyright (C) 2004, 2005 Free Software Foundation, Inc.\n\nThis file is part of GCC.\n\nGCC is free software; you can redistribute it and/or modify it under\nthe terms of the GNU General Public License as published by the Free\nSoftware Foundation; either version 2, or (at your option) any later\nversion.\n\nIn addition to the permissions in the GNU General Public License, the\nFree Software Foundation gives you unlimited permission to link the\ncompiled version of this file into combinations with other programs,\nand to distribute those combinations without any restriction coming\nfrom the use of this file.  (The General Public License restrictions\ndo apply in other respects; for example, they cover modification of\nthe file, and distribution when not linked into a combine\nexecutable.)\n\nGCC is distributed in the hope that it will be useful, but WITHOUT ANY\nWARRANTY; without even the implied warranty of MERCHANTABILITY or\nFITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License\nfor more details.\n\nYou should have received a copy of the GNU General Public License\nalong with GCC; see the file COPYING.  If not, write to the Free\nSoftware Foundation, 51 Franklin Street, Fifth Floor, Boston, MA\n02110-1301, USA.  */\n\n/* As a special exception, if you link this library with files compiled with\n   GCC to produce an executable, this does not cause the resulting executable\n   to be covered by the GNU General Public License. This exception does not\n   however invalidate any other reasons why the executable file might be\n   covered by the GNU General Public License.  */\n\n#ifndef _SSP_STDIO_H\n#define _SSP_STDIO_H 1\n\n#include <ssp.h>\n#include_next <stdio.h>\n\n#if __SSP_FORTIFY_LEVEL > 0\n\n#include <stdarg.h>\n\n#undef sprintf\n#undef vsprintf\n#undef snprintf\n#undef vsnprintf\n#undef gets\n#undef fgets\n\nextern int __sprintf_chk (char *__restrict__ __s, int __flag, size_t __slen,\n\t\t\t  __const char *__restrict__ __format, ...);\nextern int __vsprintf_chk (char *__restrict__ __s, int __flag, size_t __slen,\n\t\t\t   __const char *__restrict__ __format,\n\t\t\t   va_list __ap);\n\n#define sprintf(str, ...) \\\n  __builtin___sprintf_chk (str, 0, __ssp_bos (str), \\\n\t\t\t   __VA_ARGS__)\n#define vsprintf(str, fmt, ap) \\\n  __builtin___vsprintf_chk (str, 0, __ssp_bos (str), fmt, ap)\n\nextern int __snprintf_chk (char *__restrict__ __s, size_t __n, int __flag,\n\t\t\t   size_t __slen, __const char *__restrict__ __format,\n\t\t\t   ...);\nextern int __vsnprintf_chk (char *__restrict__ __s, size_t __n, int __flag,\n\t\t\t    size_t __slen, __const char *__restrict__ __format,\n\t\t\t    va_list __ap);\n\n#define snprintf(str, len, ...) \\\n  __builtin___snprintf_chk (str, len, 0, __ssp_bos (str), __VA_ARGS__)\n#define vsnprintf(str, len, fmt, ap) \\\n  __builtin___vsnprintf_chk (str, len, 0, __ssp_bos (str), fmt, ap)\n\nextern char *__gets_chk (char *__str, size_t);\nextern char *__SSP_REDIRECT (__gets_alias, (char *__str), gets);\n\nextern inline __attribute__((__always_inline__)) char *\ngets (char *__str)\n{\n  if (__ssp_bos (__str) != (size_t) -1)\n    return __gets_chk (__str, __ssp_bos (__str));\n  return __gets_alias (__str);\n}\n\nextern char *__SSP_REDIRECT (__fgets_alias,\n\t\t\t     (char *__restrict__ __s, int __n,\n\t\t\t      FILE *__restrict__ __stream), fgets);\n\nextern inline __attribute__((__always_inline__)) char *\nfgets (char *__restrict__ __s, int __n, FILE *__restrict__ __stream)\n{\n  if (__ssp_bos (__s) != (size_t) -1 && (size_t) __n > __ssp_bos (__s))\n    __chk_fail ();\n  return __fgets_alias (__s, __n, __stream);\n}\n\n#endif /* __SSP_FORTIFY_LEVEL > 0 */\n#endif /* _SSP_STDIO_H */\n"
  },
  {
    "path": "freebsd-headers/ssp/string.h",
    "content": "/* Checking macros for string functions.\n   Copyright (C) 2004, 2005 Free Software Foundation, Inc.\n\nThis file is part of GCC.\n\nGCC is free software; you can redistribute it and/or modify it under\nthe terms of the GNU General Public License as published by the Free\nSoftware Foundation; either version 2, or (at your option) any later\nversion.\n\nIn addition to the permissions in the GNU General Public License, the\nFree Software Foundation gives you unlimited permission to link the\ncompiled version of this file into combinations with other programs,\nand to distribute those combinations without any restriction coming\nfrom the use of this file.  (The General Public License restrictions\ndo apply in other respects; for example, they cover modification of\nthe file, and distribution when not linked into a combine\nexecutable.)\n\nGCC is distributed in the hope that it will be useful, but WITHOUT ANY\nWARRANTY; without even the implied warranty of MERCHANTABILITY or\nFITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License\nfor more details.\n\nYou should have received a copy of the GNU General Public License\nalong with GCC; see the file COPYING.  If not, write to the Free\nSoftware Foundation, 51 Franklin Street, Fifth Floor, Boston, MA\n02110-1301, USA.  */\n\n/* As a special exception, if you link this library with files compiled with\n   GCC to produce an executable, this does not cause the resulting executable\n   to be covered by the GNU General Public License. This exception does not\n   however invalidate any other reasons why the executable file might be\n   covered by the GNU General Public License.  */\n\n#ifndef _SSP_STRING_H\n#define _SSP_STRING_H 1\n\n#include <ssp.h>\n#include_next <string.h>\n\n#if __SSP_FORTIFY_LEVEL > 0\n\n#undef memcpy\n#undef memmove\n#undef memset\n#undef strcat\n#undef strcpy\n#undef strncat\n#undef strncpy\n#undef mempcpy\n#undef stpcpy\n#undef bcopy\n#undef bzero\n\n#define memcpy(dest, src, len) \\\n  ((__ssp_bos0 (dest) != (size_t) -1)\t\t\t\t\t\\\n   ? __builtin___memcpy_chk (dest, src, len, __ssp_bos0 (dest))\t\t\\\n   : __memcpy_ichk (dest, src, len))\nstatic inline __attribute__((__always_inline__)) void *\n__memcpy_ichk (void *__restrict__ __dest, const void *__restrict__ __src,\n\t       size_t __len)\n{\n  return __builtin___memcpy_chk (__dest, __src, __len, __ssp_bos0 (__dest));\n}\n\n\n#define memmove(dest, src, len) \\\n  ((__ssp_bos0 (dest) != (size_t) -1)\t\t\t\t\t\\\n   ? __builtin___memmove_chk (dest, src, len, __ssp_bos0 (dest))\t\t\\\n   : __memmove_ichk (dest, src, len))\nstatic inline __attribute__((__always_inline__)) void *\n__memmove_ichk (void *__dest, const void *__src, size_t __len)\n{\n  return __builtin___memmove_chk (__dest, __src, __len, __ssp_bos0 (__dest));\n}\n\n\n#define mempcpy(dest, src, len) \\\n  ((__ssp_bos0 (dest) != (size_t) -1)\t\t\t\t\t\\\n   ? __builtin___mempcpy_chk (dest, src, len, __ssp_bos0 (dest))\t\\\n   : __mempcpy_ichk (dest, src, len))\nstatic inline __attribute__((__always_inline__)) void *\n__mempcpy_ichk (void *__restrict__ __dest, const void *__restrict__ __src,\n\t\tsize_t __len)\n{\n  return __builtin___mempcpy_chk (__dest, __src, __len, __ssp_bos0 (__dest));\n}\n\n\n#define memset(dest, ch, len) \\\n  ((__ssp_bos0 (dest) != (size_t) -1)\t\t\t\t\t\\\n   ? __builtin___memset_chk (dest, ch, len, __ssp_bos0 (dest))\t\t\\\n   : __memset_ichk (dest, ch, len))\nstatic inline __attribute__((__always_inline__)) void *\n__memset_ichk (void *__dest, int __ch, size_t __len)\n{\n  return __builtin___memset_chk (__dest, __ch, __len, __ssp_bos0 (__dest));\n}\n\n#define bcopy(src, dest, len) ((void) \\\n ((__ssp_bos0 (dest) != (size_t) -1)\t\t\t\t\t\\\n   ? __builtin___memmove_chk (dest, src, len, __ssp_bos0 (dest))\t\\\n   : __memmove_ichk (dest, src, len)))\n#define bzero(dest, len) ((void) \\\n  ((__ssp_bos0 (dest) != (size_t) -1)\t\t\t\t\t\\\n   ? __builtin___memset_chk (dest, '\\0', len, __ssp_bos0 (dest))\t\\\n   : __memset_ichk (dest, '\\0', len)))\n\n\n#define strcpy(dest, src) \\\n  ((__ssp_bos (dest) != (size_t) -1)\t\t\t\t\t\\\n   ? __builtin___strcpy_chk (dest, src, __ssp_bos (dest))\t\t\\\n   : __strcpy_ichk (dest, src))\nstatic inline __attribute__((__always_inline__)) char *\n__strcpy_ichk (char *__restrict__ __dest, const char *__restrict__ __src)\n{\n  return __builtin___strcpy_chk (__dest, __src, __ssp_bos (__dest));\n}\n\n\n#define stpcpy(dest, src) \\\n  ((__ssp_bos (dest) != (size_t) -1)\t\t\t\t\t\\\n   ? __builtin___stpcpy_chk (dest, src, __ssp_bos (dest))\t\t\\\n   : __stpcpy_ichk (dest, src))\nstatic inline __attribute__((__always_inline__)) char *\n__stpcpy_ichk (char *__restrict__ __dest, const char *__restrict__ __src)\n{\n  return __builtin___stpcpy_chk (__dest, __src, __ssp_bos (__dest));\n}\n\n\n#define strncpy(dest, src, len) \\\n  ((__ssp_bos (dest) != (size_t) -1)\t\t\t\t\t\\\n   ? __builtin___strncpy_chk (dest, src, len, __ssp_bos (dest))\t\t\\\n   : __strncpy_ichk (dest, src, len))\nstatic inline __attribute__((__always_inline__)) char *\n__strncpy_ichk (char *__restrict__ __dest, const char *__restrict__ __src,\n\t\tsize_t __len)\n{\n  return __builtin___strncpy_chk (__dest, __src, __len, __ssp_bos (__dest));\n}\n\n\n#define strcat(dest, src) \\\n  ((__ssp_bos (dest) != (size_t) -1)\t\t\t\t\t\\\n   ? __builtin___strcat_chk (dest, src, __ssp_bos (dest))\t\t\\\n   : __strcat_ichk (dest, src))\nstatic inline __attribute__((__always_inline__)) char *\n__strcat_ichk (char *__restrict__ __dest, const char *__restrict__ __src)\n{\n  return __builtin___strcat_chk (__dest, __src, __ssp_bos (__dest));\n}\n\n\n#define strncat(dest, src, len) \\\n  ((__ssp_bos (dest) != (size_t) -1)\t\t\t\t\t\\\n   ? __builtin___strncat_chk (dest, src, len, __ssp_bos (dest))\t\t\\\n   : __strncat_ichk (dest, src, len))\nstatic inline __attribute__((__always_inline__)) char *\n__strncat_ichk (char *__restrict__ __dest, const char *__restrict__ __src,\n\t\tsize_t __len)\n{\n  return __builtin___strncat_chk (__dest, __src, __len, __ssp_bos (__dest));\n}\n\n#endif /* __SSP_FORTIFY_LEVEL > 0 */\n#endif /* _SSP_STRING_H */\n"
  },
  {
    "path": "freebsd-headers/ssp/unistd.h",
    "content": "/* Checking macros for unistd functions.\n   Copyright (C) 2005 Free Software Foundation, Inc.\n\nThis file is part of GCC.\n\nGCC is free software; you can redistribute it and/or modify it under\nthe terms of the GNU General Public License as published by the Free\nSoftware Foundation; either version 2, or (at your option) any later\nversion.\n\nIn addition to the permissions in the GNU General Public License, the\nFree Software Foundation gives you unlimited permission to link the\ncompiled version of this file into combinations with other programs,\nand to distribute those combinations without any restriction coming\nfrom the use of this file.  (The General Public License restrictions\ndo apply in other respects; for example, they cover modification of\nthe file, and distribution when not linked into a combine\nexecutable.)\n\nGCC is distributed in the hope that it will be useful, but WITHOUT ANY\nWARRANTY; without even the implied warranty of MERCHANTABILITY or\nFITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License\nfor more details.\n\nYou should have received a copy of the GNU General Public License\nalong with GCC; see the file COPYING.  If not, write to the Free\nSoftware Foundation, 51 Franklin Street, Fifth Floor, Boston, MA\n02110-1301, USA.  */\n\n/* As a special exception, if you link this library with files compiled with\n   GCC to produce an executable, this does not cause the resulting executable\n   to be covered by the GNU General Public License. This exception does not\n   however invalidate any other reasons why the executable file might be\n   covered by the GNU General Public License.  */\n\n#ifndef _SSP_UNISTD_H\n#define _SSP_UNISTD_H 1\n\n#include <ssp.h>\n#include_next <unistd.h>\n\n#if __SSP_FORTIFY_LEVEL > 0\n\n#undef read\n#undef readlink\n#undef getcwd\n\nextern ssize_t __SSP_REDIRECT (__read_alias, (int __fd, void *__buf,\n\t\t\t\t\t      size_t __nbytes), read);\n\nextern inline __attribute__((__always_inline__)) ssize_t\nread (int __fd, void *__buf, size_t __nbytes)\n{\n  if (__ssp_bos0 (__buf) != (size_t) -1 && __nbytes > __ssp_bos0 (__buf))\n    __chk_fail ();\n  return __read_alias (__fd, __buf, __nbytes);\n}\n\nextern int __SSP_REDIRECT (__readlink_alias,\n\t\t\t   (const char *__restrict__ __path,\n\t\t\t    char *__restrict__ __buf, size_t __len),\n\t\t\t   readlink);\n\nextern inline __attribute__((__always_inline__)) int\nreadlink (const char *__restrict__ __path, char *__restrict__ __buf,\n\t  size_t __len)\n{\n  if (__ssp_bos (__buf) != (size_t) -1 && __len > __ssp_bos (__buf))\n    __chk_fail ();\n  return __readlink_alias (__path, __buf, __len);\n}\n\nextern char *__SSP_REDIRECT (__getcwd_alias,\n\t\t\t     (char *__buf, size_t __size), getcwd);\n\nextern inline __attribute__((__always_inline__)) char *\ngetcwd (char *__buf, size_t __size)\n{\n  if (__ssp_bos (__buf) != (size_t) -1 && __size > __ssp_bos (__buf))\n    __chk_fail ();\n  return __getcwd_alias (__buf, __size);\n}\n\n#endif /* __SSP_FORTIFY_LEVEL > 0 */\n#endif /* _SSP_UNISTD_H */\n"
  },
  {
    "path": "freebsd-headers/stab.h",
    "content": "/*-\n * Copyright (c) 1991, 1993\n *\tThe Regents of the University of California.  All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t@(#)stab.h\t8.1 (Berkeley) 6/2/93\n *\n * $FreeBSD: release/9.0.0/include/stab.h 203964 2010-02-16 19:39:50Z imp $\n */\n\n#ifndef _STAB_H_\n#define _STAB_H_\n\n/*\n * The following are symbols used by various debuggers and by the Pascal\n * compiler.  Each of them must have one (or more) of the bits defined by\n * the N_STAB mask set.\n */\n\n#define\tN_GSYM\t\t0x20\t/* global symbol */\n#define\tN_FNAME\t\t0x22\t/* F77 function name */\n#define\tN_FUN\t\t0x24\t/* procedure name */\n#define\tN_STSYM\t\t0x26\t/* data segment variable */\n#define\tN_LCSYM\t\t0x28\t/* bss segment variable */\n#define\tN_MAIN\t\t0x2a\t/* main function name */\n#define\tN_PC\t\t0x30\t/* global Pascal symbol */\n#define\tN_RSYM\t\t0x40\t/* register variable */\n#define\tN_SLINE\t\t0x44\t/* text segment line number */\n#define\tN_DSLINE\t0x46\t/* data segment line number */\n#define\tN_BSLINE\t0x48\t/* bss segment line number */\n#define\tN_SSYM\t\t0x60\t/* structure/union element */\n#define\tN_SO\t\t0x64\t/* main source file name */\n#define\tN_LSYM\t\t0x80\t/* stack variable */\n#define\tN_BINCL\t\t0x82\t/* include file beginning */\n#define\tN_SOL\t\t0x84\t/* included source file name */\n#define\tN_PSYM\t\t0xa0\t/* parameter variable */\n#define\tN_EINCL\t\t0xa2\t/* include file end */\n#define\tN_ENTRY\t\t0xa4\t/* alternate entry point */\n#define\tN_LBRAC\t\t0xc0\t/* left bracket */\n#define\tN_EXCL\t\t0xc2\t/* deleted include file */\n#define\tN_RBRAC\t\t0xe0\t/* right bracket */\n#define\tN_BCOMM\t\t0xe2\t/* begin common */\n#define\tN_ECOMM\t\t0xe4\t/* end common */\n#define\tN_ECOML\t\t0xe8\t/* end common (local name) */\n#define\tN_LENG\t\t0xfe\t/* length of preceding entry */\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/stand.h",
    "content": "/*\n * Copyright (c) 1998 Michael Smith.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/lib/libstand/stand.h 223905 2011-07-10 07:25:34Z avatar $\n * From\t$NetBSD: stand.h,v 1.22 1997/06/26 19:17:40 drochner Exp $\t\n */\n\n/*-\n * Copyright (c) 1993\n *\tThe Regents of the University of California.  All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 4. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t@(#)stand.h\t8.1 (Berkeley) 6/11/93\n */\n\n#ifndef\tSTAND_H\n#define\tSTAND_H\n\n#include <sys/types.h>\n#include <sys/cdefs.h>\n#include <sys/stat.h>\n#include <sys/dirent.h>\n\n/* this header intentionally exports NULL from <string.h> */\n#include <string.h>\n\n#define CHK(fmt, args...)\tprintf(\"%s(%d): \" fmt \"\\n\", __func__, __LINE__ , ##args)\n#define PCHK(fmt, args...)\t{printf(\"%s(%d): \" fmt \"\\n\", __func__, __LINE__ , ##args); getchar();}\n\n/* Avoid unwanted userlandish components */\n#define _KERNEL\n#include <sys/errno.h>\n#undef _KERNEL\n\n/* special stand error codes */\n#define\tEADAPT\t(ELAST+1)\t/* bad adaptor */\n#define\tECTLR\t(ELAST+2)\t/* bad controller */\n#define\tEUNIT\t(ELAST+3)\t/* bad unit */\n#define ESLICE\t(ELAST+4)\t/* bad slice */\n#define\tEPART\t(ELAST+5)\t/* bad partition */\n#define\tERDLAB\t(ELAST+6)\t/* can't read disk label */\n#define\tEUNLAB\t(ELAST+7)\t/* unlabeled disk */\n#define\tEOFFSET\t(ELAST+8)\t/* relative seek not supported */\n#define\tESALAST\t(ELAST+8)\t/* */\n\nstruct open_file;\n\n/*\n * This structure is used to define file system operations in a file system\n * independent way.\n *\n * XXX note that filesystem providers should export a pointer to their fs_ops\n *     struct, so that consumers can reference this and thus include the\n *     filesystems that they require.\n */\nstruct fs_ops {\n    const char\t*fs_name;\n    int\t\t(*fo_open)(const char *path, struct open_file *f);\n    int\t\t(*fo_close)(struct open_file *f);\n    int\t\t(*fo_read)(struct open_file *f, void *buf,\n\t\t\t   size_t size, size_t *resid);\n    int\t\t(*fo_write)(struct open_file *f, void *buf,\n\t\t\t    size_t size, size_t *resid);\n    off_t\t(*fo_seek)(struct open_file *f, off_t offset, int where);\n    int\t\t(*fo_stat)(struct open_file *f, struct stat *sb);\n    int\t\t(*fo_readdir)(struct open_file *f, struct dirent *d);\n};\n\n/*\n * libstand-supplied filesystems\n */\nextern struct fs_ops ufs_fsops;\nextern struct fs_ops tftp_fsops;\nextern struct fs_ops nfs_fsops;\nextern struct fs_ops cd9660_fsops;\nextern struct fs_ops gzipfs_fsops;\nextern struct fs_ops bzipfs_fsops;\nextern struct fs_ops dosfs_fsops;\nextern struct fs_ops ext2fs_fsops;\nextern struct fs_ops splitfs_fsops;\n\n/* where values for lseek(2) */\n#define\tSEEK_SET\t0\t/* set file offset to offset */\n#define\tSEEK_CUR\t1\t/* set file offset to current plus offset */\n#define\tSEEK_END\t2\t/* set file offset to EOF plus offset */\n\n/* \n * Device switch\n */\nstruct devsw {\n    const char\tdv_name[8];\n    int\t\tdv_type;\t\t/* opaque type constant, arch-dependant */\n    int\t\t(*dv_init)(void);\t/* early probe call */\n    int\t\t(*dv_strategy)(void *devdata, int rw, daddr_t blk, size_t size,\n\t\t\t       char *buf, size_t *rsize);\n    int\t\t(*dv_open)(struct open_file *f, ...);\n    int\t\t(*dv_close)(struct open_file *f);\n    int\t\t(*dv_ioctl)(struct open_file *f, u_long cmd, void *data);\n    void\t(*dv_print)(int verbose);\t/* print device information */\n    void\t(*dv_cleanup)(void);\n};\n\n/*\n * libstand-supplied device switch\n */\nextern struct devsw netdev;\n\nextern int errno;\n\nstruct open_file {\n    int\t\t\tf_flags;\t/* see F_* below */\n    struct devsw\t*f_dev;\t\t/* pointer to device operations */\n    void\t\t*f_devdata;\t/* device specific data */\n    struct fs_ops\t*f_ops;\t\t/* pointer to file system operations */\n    void\t\t*f_fsdata;\t/* file system specific data */\n    off_t\t\tf_offset;\t/* current file offset */\n    char\t\t*f_rabuf;\t/* readahead buffer pointer */\n    size_t\t\tf_ralen;\t/* valid data in readahead buffer */\n    off_t\t\tf_raoffset;\t/* consumer offset in readahead buffer */\n#define SOPEN_RASIZE\t512\n};\n\n#define\tSOPEN_MAX\t64\nextern struct open_file files[];\n\n/* f_flags values */\n#define\tF_READ\t\t0x0001\t/* file opened for reading */\n#define\tF_WRITE\t\t0x0002\t/* file opened for writing */\n#define\tF_RAW\t\t0x0004\t/* raw device open - no file system */\n#define F_NODEV\t\t0x0008\t/* network open - no device */\n\n#define isascii(c)\t(((c) & ~0x7F) == 0)\n\nstatic __inline int isupper(int c)\n{\n    return c >= 'A' && c <= 'Z';\n}\n\nstatic __inline int islower(int c)\n{\n    return c >= 'a' && c <= 'z';\n}\n\nstatic __inline int isspace(int c)\n{\n    return c == ' ' || (c >= 0x9 && c <= 0xd);\n}\n\nstatic __inline int isdigit(int c)\n{\n    return c >= '0' && c <= '9';\n}\n\nstatic __inline int isxdigit(int c)\n{\n    return isdigit(c) || (c >= 'a' && c <= 'f') || (c >= 'A' && c <= 'F');\n}\n\nstatic __inline int isalpha(int c)\n{\n    return isupper(c) || islower(c);\n}\n\nstatic __inline int isalnum(int c)\n{\n    return isalpha(c) || isdigit(c);\n}\n\nstatic __inline int toupper(int c)\n{\n    return islower(c) ? c - 'a' + 'A' : c;\n}\n\nstatic __inline int tolower(int c)\n{\n    return isupper(c) ? c - 'A' + 'a' : c;\n}\n\n/* sbrk emulation */\nextern void\tsetheap(void *base, void *top);\nextern char\t*sbrk(int incr);\n\n/* Matt Dillon's zalloc/zmalloc */\nextern void\t*malloc(size_t bytes);\nextern void\tfree(void *ptr);\n/*#define free(p)\t{CHK(\"free %p\", p); free(p);} */ /* use for catching guard violations */\nextern void\t*calloc(size_t n1, size_t n2);\nextern void\t*realloc(void *ptr, size_t size);\nextern void\t*reallocf(void *ptr, size_t size);\nextern void\tmallocstats(void);\n\nextern int\tprintf(const char *fmt, ...) __printflike(1, 2);\nextern void\tvprintf(const char *fmt, __va_list);\nextern int\tsprintf(char *buf, const char *cfmt, ...) __printflike(2, 3);\nextern void\tvsprintf(char *buf, const char *cfmt, __va_list);\n\nextern void\ttwiddle(void);\n\nextern void\tngets(char *, int);\n#define gets(x)\tngets((x), 0)\nextern int\tfgetstr(char *buf, int size, int fd);\n\nextern int\topen(const char *, int);\n#define\tO_RDONLY\t0x0\n#define O_WRONLY\t0x1\n#define O_RDWR\t\t0x2\nextern int\tclose(int);\nextern void\tcloseall(void);\nextern ssize_t\tread(int, void *, size_t);\nextern ssize_t\twrite(int, void *, size_t);\nextern struct\tdirent *readdirfd(int);\n\nextern void\tsrandom(u_long seed);\nextern u_long\trandom(void);\n    \n/* imports from stdlib, locally modified */\nextern long\tstrtol(const char *, char **, int);\nextern char\t*optarg;\t\t\t/* getopt(3) external variables */\nextern int\toptind, opterr, optopt, optreset;\nextern int\tgetopt(int, char * const [], const char *);\n\n/* pager.c */\nextern void\tpager_open(void);\nextern void\tpager_close(void);\nextern int\tpager_output(const char *lines);\nextern int\tpager_file(const char *fname);\n\n/* No signal state to preserve */\n#define setjmp\t_setjmp\n#define longjmp\t_longjmp\n\n/* environment.c */\n#define EV_DYNAMIC\t(1<<0)\t\t/* value was dynamically allocated, free if changed/unset */\n#define EV_VOLATILE\t(1<<1)\t\t/* value is volatile, make a copy of it */\n#define EV_NOHOOK\t(1<<2)\t\t/* don't call hook when setting */\n\nstruct env_var;\ntypedef char\t*(ev_format_t)(struct env_var *ev);\ntypedef int\t(ev_sethook_t)(struct env_var *ev, int flags,\n\t\t    const void *value);\ntypedef int\t(ev_unsethook_t)(struct env_var *ev);\n\nstruct env_var\n{\n    char\t\t*ev_name;\n    int\t\t\tev_flags;\n    void\t\t*ev_value;\n    ev_sethook_t\t*ev_sethook;\n    ev_unsethook_t\t*ev_unsethook;\n    struct env_var\t*ev_next, *ev_prev;\n};\nextern struct env_var\t*environ;\n\nextern struct env_var\t*env_getenv(const char *name);\nextern int\t\tenv_setenv(const char *name, int flags,\n\t\t\t\t   const void *value, ev_sethook_t sethook,\n\t\t\t\t   ev_unsethook_t unsethook);\nextern char\t\t*getenv(const char *name);\nextern int\t\tsetenv(const char *name, const char *value,\n\t\t\t       int overwrite);\nextern int\t\tputenv(const char *string);\nextern int\t\tunsetenv(const char *name);\n\nextern ev_sethook_t\tenv_noset;\t\t/* refuse set operation */\nextern ev_unsethook_t\tenv_nounset;\t\t/* refuse unset operation */\n\n/* BCD conversions (undocumented) */\nextern u_char const\tbcd2bin_data[];\nextern u_char const\tbin2bcd_data[];\nextern char const\thex2ascii_data[];\n\n#define\tbcd2bin(bcd)\t(bcd2bin_data[bcd])\n#define\tbin2bcd(bin)\t(bin2bcd_data[bin])\n#define\thex2ascii(hex)\t(hex2ascii_data[hex])\n\n/* min/max (undocumented) */\nstatic __inline int imax(int a, int b) { return (a > b ? a : b); }\nstatic __inline int imin(int a, int b) { return (a < b ? a : b); }\nstatic __inline long lmax(long a, long b) { return (a > b ? a : b); }\nstatic __inline long lmin(long a, long b) { return (a < b ? a : b); }\nstatic __inline u_int max(u_int a, u_int b) { return (a > b ? a : b); }\nstatic __inline u_int min(u_int a, u_int b) { return (a < b ? a : b); }\nstatic __inline quad_t qmax(quad_t a, quad_t b) { return (a > b ? a : b); }\nstatic __inline quad_t qmin(quad_t a, quad_t b) { return (a < b ? a : b); }\nstatic __inline u_long ulmax(u_long a, u_long b) { return (a > b ? a : b); }\nstatic __inline u_long ulmin(u_long a, u_long b) { return (a < b ? a : b); }\n\n/* swaps (undocumented, useful?) */\n#ifdef __i386__\nextern u_int32_t\tbswap32(u_int32_t x);\nextern u_int64_t\tbswap64(u_int64_t x);\n#endif\n\n/* null functions for device/filesystem switches (undocumented) */\nextern int\tnodev(void);\nextern int\tnoioctl(struct open_file *, u_long, void *);\nextern void\tnullsys(void);\n\nextern int\tnull_open(const char *path, struct open_file *f);\nextern int\tnull_close(struct open_file *f);\nextern int\tnull_read(struct open_file *f, void *buf, size_t size, size_t *resid);\nextern int\tnull_write(struct open_file *f, void *buf, size_t size, size_t *resid);\nextern off_t\tnull_seek(struct open_file *f, off_t offset, int where);\nextern int\tnull_stat(struct open_file *f, struct stat *sb);\nextern int\tnull_readdir(struct open_file *f, struct dirent *d);\n\n\n/* \n * Machine dependent functions and data, must be provided or stubbed by \n * the consumer \n */\nextern int\t\tgetchar(void);\nextern int\t\tischar(void);\nextern void\t\tputchar(int);\nextern int\t\tdevopen(struct open_file *, const char *, const char **);\nextern int\t\tdevclose(struct open_file *f);\nextern void\t\tpanic(const char *, ...) __dead2 __printflike(1, 2);\nextern struct fs_ops\t*file_system[];\nextern struct devsw\t*devsw[];\n\n/*\n * Expose byteorder(3) functions.\n */\n#ifndef _BYTEORDER_PROTOTYPED\n#define\t_BYTEORDER_PROTOTYPED\nextern uint32_t\t\thtonl(uint32_t);\nextern uint16_t\t\thtons(uint16_t);\nextern uint32_t\t\tntohl(uint32_t);\nextern uint16_t\t\tntohs(uint16_t);\n#endif\n\n#ifndef _BYTEORDER_FUNC_DEFINED\n#define\t_BYTEORDER_FUNC_DEFINED\n#define\thtonl(x)\t__htonl(x)\n#define\thtons(x)\t__htons(x)\n#define\tntohl(x)\t__ntohl(x)\n#define\tntohs(x)\t__ntohs(x)\n#endif\n\nvoid *Malloc(size_t, const char *, int);\nvoid *Calloc(size_t, size_t, const char *, int);\nvoid *Realloc(void *, size_t, const char *, int);\nvoid Free(void *, const char *, int);\n\n#if 1\n#define malloc(x)\tMalloc(x, __FILE__, __LINE__)\n#define calloc(x, y)\tCalloc(x, y, __FILE__, __LINE__)\n#define free(x)\t\tFree(x, __FILE__, __LINE__)\n#define realloc(x, y)\tRealloc(x, y, __FILE__, __LINE__)\n#else\n#define malloc(x)\tMalloc(x, NULL, 0)\n#define calloc(x, y)\tCalloc(x, y, NULL, 0)\n#define free(x)\t\tFree(x, NULL, 0)\n#define realloc(x, y)\tRealloc(x, y, NULL, 0)\n#endif\n\n#endif\t/* STAND_H */\n"
  },
  {
    "path": "freebsd-headers/stdbool.h",
    "content": "/*\n * Copyright (c) 2000 Jeroen Ruigrok van der Werven <asmodai@FreeBSD.org>\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/include/stdbool.h 142088 2005-02-19 13:47:33Z marius $\n */\n\n#ifndef _STDBOOL_H_\n#define\t_STDBOOL_H_\t\n\n#define\t__bool_true_false_are_defined\t1\n\n#ifndef __cplusplus\n\n#define\tfalse\t0\n#define\ttrue\t1\n\n#define\tbool\t_Bool\n#if __STDC_VERSION__ < 199901L && __GNUC__ < 3 && !defined(__INTEL_COMPILER)\ntypedef\tint\t_Bool;\n#endif\n\n#endif /* !__cplusplus */\n\n#endif /* !_STDBOOL_H_ */\n"
  },
  {
    "path": "freebsd-headers/stddef.h",
    "content": "/*-\n * Copyright (c) 1990, 1993\n *\tThe Regents of the University of California.  All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t@(#)stddef.h\t8.1 (Berkeley) 6/2/93\n *\n * $FreeBSD: release/9.0.0/include/stddef.h 203964 2010-02-16 19:39:50Z imp $\n */\n\n#ifndef _STDDEF_H_\n#define _STDDEF_H_\n\n#include <sys/cdefs.h>\n#include <sys/_null.h>\n#include <sys/_types.h>\n\ntypedef\t__ptrdiff_t\tptrdiff_t;\n\n#if __BSD_VISIBLE\n#ifndef _RUNE_T_DECLARED\ntypedef\t__rune_t\trune_t;\n#define\t_RUNE_T_DECLARED\n#endif\n#endif\n\n#ifndef _SIZE_T_DECLARED\ntypedef\t__size_t\tsize_t;\n#define\t_SIZE_T_DECLARED\n#endif\n\n#ifndef\t__cplusplus\n#ifndef _WCHAR_T_DECLARED\ntypedef\t__wchar_t\twchar_t;\n#define\t_WCHAR_T_DECLARED\n#endif\n#endif\n\n#define\toffsetof(type, member)\t__offsetof(type, member)\n\n#endif /* _STDDEF_H_ */\n"
  },
  {
    "path": "freebsd-headers/stdio.h",
    "content": "/*-\n * Copyright (c) 1990, 1993\n *\tThe Regents of the University of California.  All rights reserved.\n *\n * This code is derived from software contributed to Berkeley by\n * Chris Torek.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t@(#)stdio.h\t8.5 (Berkeley) 4/29/95\n * $FreeBSD: release/9.0.0/include/stdio.h 210957 2010-08-06 19:35:40Z ed $\n */\n\n#ifndef\t_STDIO_H_\n#define\t_STDIO_H_\n\n#include <sys/cdefs.h>\n#include <sys/_null.h>\n#include <sys/_types.h>\n\ntypedef\t__off_t\t\tfpos_t;\n\n#ifndef _SIZE_T_DECLARED\ntypedef\t__size_t\tsize_t;\n#define\t_SIZE_T_DECLARED\n#endif\n\n#if __BSD_VISIBLE || __POSIX_VISIBLE >= 200809\n#ifndef _OFF_T_DECLARED\n#define\t_OFF_T_DECLARED\ntypedef\t__off_t\t\toff_t;\n#endif\n#ifndef _SSIZE_T_DECLARED\n#define\t_SSIZE_T_DECLARED\ntypedef\t__ssize_t\tssize_t;\n#endif\n#endif\n\n#if __BSD_VISIBLE || __POSIX_VISIBLE >= 200112 || __XSI_VISIBLE\n#ifndef _VA_LIST_DECLARED\ntypedef\t__va_list\tva_list;\n#define\t_VA_LIST_DECLARED\n#endif\n#endif\n\n#define\t_FSTDIO\t\t\t/* Define for new stdio with functions. */\n\n/*\n * NB: to fit things in six character monocase externals, the stdio\n * code uses the prefix `__s' for stdio objects, typically followed\n * by a three-character attempt at a mnemonic.\n */\n\n/* stdio buffers */\nstruct __sbuf {\n\tunsigned char *_base;\n\tint\t_size;\n};\n\n/*\n * stdio state variables.\n *\n * The following always hold:\n *\n *\tif (_flags&(__SLBF|__SWR)) == (__SLBF|__SWR),\n *\t\t_lbfsize is -_bf._size, else _lbfsize is 0\n *\tif _flags&__SRD, _w is 0\n *\tif _flags&__SWR, _r is 0\n *\n * This ensures that the getc and putc macros (or inline functions) never\n * try to write or read from a file that is in `read' or `write' mode.\n * (Moreover, they can, and do, automatically switch from read mode to\n * write mode, and back, on \"r+\" and \"w+\" files.)\n *\n * _lbfsize is used only to make the inline line-buffered output stream\n * code as compact as possible.\n *\n * _ub, _up, and _ur are used when ungetc() pushes back more characters\n * than fit in the current _bf, or when ungetc() pushes back a character\n * that does not match the previous one in _bf.  When this happens,\n * _ub._base becomes non-nil (i.e., a stream has ungetc() data iff\n * _ub._base!=NULL) and _up and _ur save the current values of _p and _r.\n *\n * Certain members of __sFILE are accessed directly via macros or\n * inline functions.  To preserve ABI compat, these members must not\n * be disturbed.  These members are marked below with (*).\n */\ntypedef\tstruct __sFILE {\n\tunsigned char *_p;\t/* (*) current position in (some) buffer */\n\tint\t_r;\t\t/* (*) read space left for getc() */\n\tint\t_w;\t\t/* (*) write space left for putc() */\n\tshort\t_flags;\t\t/* (*) flags, below; this FILE is free if 0 */\n\tshort\t_file;\t\t/* (*) fileno, if Unix descriptor, else -1 */\n\tstruct\t__sbuf _bf;\t/* (*) the buffer (at least 1 byte, if !NULL) */\n\tint\t_lbfsize;\t/* (*) 0 or -_bf._size, for inline putc */\n\n\t/* operations */\n\tvoid\t*_cookie;\t/* (*) cookie passed to io functions */\n\tint\t(*_close)(void *);\n\tint\t(*_read)(void *, char *, int);\n\tfpos_t\t(*_seek)(void *, fpos_t, int);\n\tint\t(*_write)(void *, const char *, int);\n\n\t/* separate buffer for long sequences of ungetc() */\n\tstruct\t__sbuf _ub;\t/* ungetc buffer */\n\tunsigned char\t*_up;\t/* saved _p when _p is doing ungetc data */\n\tint\t_ur;\t\t/* saved _r when _r is counting ungetc data */\n\n\t/* tricks to meet minimum requirements even when malloc() fails */\n\tunsigned char _ubuf[3];\t/* guarantee an ungetc() buffer */\n\tunsigned char _nbuf[1];\t/* guarantee a getc() buffer */\n\n\t/* separate buffer for fgetln() when line crosses buffer boundary */\n\tstruct\t__sbuf _lb;\t/* buffer for fgetln() */\n\n\t/* Unix stdio files get aligned to block boundaries on fseek() */\n\tint\t_blksize;\t/* stat.st_blksize (may be != _bf._size) */\n\tfpos_t\t_offset;\t/* current lseek offset */\n\n\tstruct pthread_mutex *_fl_mutex;\t/* used for MT-safety */\n\tstruct pthread *_fl_owner;\t/* current owner */\n\tint\t_fl_count;\t/* recursive lock count */\n\tint\t_orientation;\t/* orientation for fwide() */\n\t__mbstate_t _mbstate;\t/* multibyte conversion state */\n} FILE;\n\n#ifndef _STDSTREAM_DECLARED\n__BEGIN_DECLS\nextern FILE *__stdinp;\nextern FILE *__stdoutp;\nextern FILE *__stderrp;\n__END_DECLS\n#define\t_STDSTREAM_DECLARED\n#endif\n\n#define\t__SLBF\t0x0001\t\t/* line buffered */\n#define\t__SNBF\t0x0002\t\t/* unbuffered */\n#define\t__SRD\t0x0004\t\t/* OK to read */\n#define\t__SWR\t0x0008\t\t/* OK to write */\n\t/* RD and WR are never simultaneously asserted */\n#define\t__SRW\t0x0010\t\t/* open for reading & writing */\n#define\t__SEOF\t0x0020\t\t/* found EOF */\n#define\t__SERR\t0x0040\t\t/* found error */\n#define\t__SMBF\t0x0080\t\t/* _buf is from malloc */\n#define\t__SAPP\t0x0100\t\t/* fdopen()ed in append mode */\n#define\t__SSTR\t0x0200\t\t/* this is an sprintf/snprintf string */\n#define\t__SOPT\t0x0400\t\t/* do fseek() optimization */\n#define\t__SNPT\t0x0800\t\t/* do not do fseek() optimization */\n#define\t__SOFF\t0x1000\t\t/* set iff _offset is in fact correct */\n#define\t__SMOD\t0x2000\t\t/* true => fgetln modified _p text */\n#define\t__SALC\t0x4000\t\t/* allocate string space dynamically */\n#define\t__SIGN\t0x8000\t\t/* ignore this file in _fwalk */\n\n/*\n * The following three definitions are for ANSI C, which took them\n * from System V, which brilliantly took internal interface macros and\n * made them official arguments to setvbuf(), without renaming them.\n * Hence, these ugly _IOxxx names are *supposed* to appear in user code.\n *\n * Although numbered as their counterparts above, the implementation\n * does not rely on this.\n */\n#define\t_IOFBF\t0\t\t/* setvbuf should set fully buffered */\n#define\t_IOLBF\t1\t\t/* setvbuf should set line buffered */\n#define\t_IONBF\t2\t\t/* setvbuf should set unbuffered */\n\n#define\tBUFSIZ\t1024\t\t/* size of buffer used by setbuf */\n#define\tEOF\t(-1)\n\n/*\n * FOPEN_MAX is a minimum maximum, and is the number of streams that\n * stdio can provide without attempting to allocate further resources\n * (which could fail).  Do not use this for anything.\n */\n\t\t\t\t/* must be == _POSIX_STREAM_MAX <limits.h> */\n#ifndef FOPEN_MAX\n#define\tFOPEN_MAX\t20\t/* must be <= OPEN_MAX <sys/syslimits.h> */\n#endif\n#define\tFILENAME_MAX\t1024\t/* must be <= PATH_MAX <sys/syslimits.h> */\n\n/* System V/ANSI C; this is the wrong way to do this, do *not* use these. */\n#if __XSI_VISIBLE\n#define\tP_tmpdir\t\"/var/tmp/\"\n#endif\n#define\tL_tmpnam\t1024\t/* XXX must be == PATH_MAX */\n#define\tTMP_MAX\t\t308915776\n\n#ifndef SEEK_SET\n#define\tSEEK_SET\t0\t/* set file offset to offset */\n#endif\n#ifndef SEEK_CUR\n#define\tSEEK_CUR\t1\t/* set file offset to current plus offset */\n#endif\n#ifndef SEEK_END\n#define\tSEEK_END\t2\t/* set file offset to EOF plus offset */\n#endif\n\n#define\tstdin\t__stdinp\n#define\tstdout\t__stdoutp\n#define\tstderr\t__stderrp\n\n__BEGIN_DECLS\n/*\n * Functions defined in ANSI C standard.\n */\nvoid\t clearerr(FILE *);\nint\t fclose(FILE *);\nint\t feof(FILE *);\nint\t ferror(FILE *);\nint\t fflush(FILE *);\nint\t fgetc(FILE *);\nint\t fgetpos(FILE * __restrict, fpos_t * __restrict);\nchar\t*fgets(char * __restrict, int, FILE * __restrict);\nFILE\t*fopen(const char * __restrict, const char * __restrict);\nint\t fprintf(FILE * __restrict, const char * __restrict, ...);\nint\t fputc(int, FILE *);\nint\t fputs(const char * __restrict, FILE * __restrict);\nsize_t\t fread(void * __restrict, size_t, size_t, FILE * __restrict);\nFILE\t*freopen(const char * __restrict, const char * __restrict, FILE * __restrict);\nint\t fscanf(FILE * __restrict, const char * __restrict, ...);\nint\t fseek(FILE *, long, int);\nint\t fsetpos(FILE *, const fpos_t *);\nlong\t ftell(FILE *);\nsize_t\t fwrite(const void * __restrict, size_t, size_t, FILE * __restrict);\nint\t getc(FILE *);\nint\t getchar(void);\nchar\t*gets(char *);\nvoid\t perror(const char *);\nint\t printf(const char * __restrict, ...);\nint\t putc(int, FILE *);\nint\t putchar(int);\nint\t puts(const char *);\nint\t remove(const char *);\nint\t rename(const char *, const char *);\nvoid\t rewind(FILE *);\nint\t scanf(const char * __restrict, ...);\nvoid\t setbuf(FILE * __restrict, char * __restrict);\nint\t setvbuf(FILE * __restrict, char * __restrict, int, size_t);\nint\t sprintf(char * __restrict, const char * __restrict, ...);\nint\t sscanf(const char * __restrict, const char * __restrict, ...);\nFILE\t*tmpfile(void);\nchar\t*tmpnam(char *);\nint\t ungetc(int, FILE *);\nint\t vfprintf(FILE * __restrict, const char * __restrict,\n\t    __va_list);\nint\t vprintf(const char * __restrict, __va_list);\nint\t vsprintf(char * __restrict, const char * __restrict,\n\t    __va_list);\n\n#if __ISO_C_VISIBLE >= 1999\nint\t snprintf(char * __restrict, size_t, const char * __restrict,\n\t    ...) __printflike(3, 4);\nint\t vfscanf(FILE * __restrict, const char * __restrict, __va_list)\n\t    __scanflike(2, 0);\nint\t vscanf(const char * __restrict, __va_list) __scanflike(1, 0);\nint\t vsnprintf(char * __restrict, size_t, const char * __restrict,\n\t    __va_list) __printflike(3, 0);\nint\t vsscanf(const char * __restrict, const char * __restrict, __va_list)\n\t    __scanflike(2, 0);\n#endif\n\n/*\n * Functions defined in all versions of POSIX 1003.1.\n */\n#if __BSD_VISIBLE || __POSIX_VISIBLE <= 199506\n#define\tL_cuserid\t17\t/* size for cuserid(3); MAXLOGNAME, legacy */\n#endif\n\n#if __POSIX_VISIBLE\n#define\tL_ctermid\t1024\t/* size for ctermid(3); PATH_MAX */\n\nchar\t*ctermid(char *);\nFILE\t*fdopen(int, const char *);\nint\t fileno(FILE *);\n#endif /* __POSIX_VISIBLE */\n\n#if __POSIX_VISIBLE >= 199209\nint\t pclose(FILE *);\nFILE\t*popen(const char *, const char *);\n#endif\n\n#if __POSIX_VISIBLE >= 199506\nint\t ftrylockfile(FILE *);\nvoid\t flockfile(FILE *);\nvoid\t funlockfile(FILE *);\n\n/*\n * These are normally used through macros as defined below, but POSIX\n * requires functions as well.\n */\nint\t getc_unlocked(FILE *);\nint\t getchar_unlocked(void);\nint\t putc_unlocked(int, FILE *);\nint\t putchar_unlocked(int);\n#endif\n#if __BSD_VISIBLE\nvoid\t clearerr_unlocked(FILE *);\nint\t feof_unlocked(FILE *);\nint\t ferror_unlocked(FILE *);\nint\t fileno_unlocked(FILE *);\n#endif\n\n#if __POSIX_VISIBLE >= 200112\nint\t fseeko(FILE *, __off_t, int);\n__off_t\t ftello(FILE *);\n#endif\n\n#if __BSD_VISIBLE || __XSI_VISIBLE > 0 && __XSI_VISIBLE < 600\nint\t getw(FILE *);\nint\t putw(int, FILE *);\n#endif /* BSD or X/Open before issue 6 */\n\n#if __XSI_VISIBLE\nchar\t*tempnam(const char *, const char *);\n#endif\n\n#if __BSD_VISIBLE || __POSIX_VISIBLE >= 200809\nssize_t\t getdelim(char ** __restrict, size_t * __restrict, int,\n\t    FILE * __restrict);\nint\t renameat(int, const char *, int, const char *);\nint\t vdprintf(int, const char * __restrict, __va_list);\n\n/*\n * Every programmer and his dog wrote functions called getline() and dprintf()\n * before POSIX.1-2008 came along and decided to usurp the names, so we\n * don't prototype them by default unless one of the following is true:\n *   a) the app has requested them specifically by defining _WITH_GETLINE or\n *      _WITH_DPRINTF, respectively\n *   b) the app has requested a POSIX.1-2008 environment via _POSIX_C_SOURCE\n *   c) the app defines a GNUism such as _BSD_SOURCE or _GNU_SOURCE\n */\n#ifndef _WITH_GETLINE\n#if defined(_BSD_SOURCE) || defined(_GNU_SOURCE)\n#define\t_WITH_GETLINE\n#elif defined(_POSIX_C_SOURCE)\n#if _POSIX_C_SOURCE >= 200809\n#define\t_WITH_GETLINE\n#endif\n#endif\n#endif\n\n#ifdef _WITH_GETLINE\nssize_t\t getline(char ** __restrict, size_t * __restrict, FILE * __restrict);\n#endif\n\n#ifndef _WITH_DPRINTF\n#if defined(_BSD_SOURCE) || defined(_GNU_SOURCE)\n#define\t_WITH_DPRINTF\n#elif defined(_POSIX_C_SOURCE)\n#if _POSIX_C_SOURCE >= 200809\n#define\t_WITH_DPRINTF\n#endif\n#endif\n#endif\n\n#ifdef _WITH_DPRINTF\nint\t (dprintf)(int, const char * __restrict, ...);\n#endif\n\n#endif /* __BSD_VISIBLE || __POSIX_VISIBLE >= 200809 */\n\n/*\n * Routines that are purely local.\n */\n#if __BSD_VISIBLE\nint\t asprintf(char **, const char *, ...) __printflike(2, 3);\nchar\t*ctermid_r(char *);\nvoid\t fcloseall(void);\nchar\t*fgetln(FILE *, size_t *);\nconst char *fmtcheck(const char *, const char *) __format_arg(2);\nint\t fpurge(FILE *);\nvoid\t setbuffer(FILE *, char *, int);\nint\t setlinebuf(FILE *);\nint\t vasprintf(char **, const char *, __va_list)\n\t    __printflike(2, 0);\n\n/*\n * The system error table contains messages for the first sys_nerr\n * positive errno values.  Use strerror() or strerror_r() from <string.h>\n * instead.\n */\nextern __const int sys_nerr;\nextern __const char *__const sys_errlist[];\n\n/*\n * Stdio function-access interface.\n */\nFILE\t*funopen(const void *,\n\t    int (*)(void *, char *, int),\n\t    int (*)(void *, const char *, int),\n\t    fpos_t (*)(void *, fpos_t, int),\n\t    int (*)(void *));\n#define\tfropen(cookie, fn) funopen(cookie, fn, 0, 0, 0)\n#define\tfwopen(cookie, fn) funopen(cookie, 0, fn, 0, 0)\n\n/*\n * Portability hacks.  See <sys/types.h>.\n */\n#ifndef _FTRUNCATE_DECLARED\n#define\t_FTRUNCATE_DECLARED\nint\t ftruncate(int, __off_t);\n#endif\n#ifndef _LSEEK_DECLARED\n#define\t_LSEEK_DECLARED\n__off_t\t lseek(int, __off_t, int);\n#endif\n#ifndef _MMAP_DECLARED\n#define\t_MMAP_DECLARED\nvoid\t*mmap(void *, size_t, int, int, int, __off_t);\n#endif\n#ifndef _TRUNCATE_DECLARED\n#define\t_TRUNCATE_DECLARED\nint\t truncate(const char *, __off_t);\n#endif\n#endif /* __BSD_VISIBLE */\n\n/*\n * Functions internal to the implementation.\n */\nint\t__srget(FILE *);\nint\t__swbuf(int, FILE *);\n\n/*\n * The __sfoo macros are here so that we can\n * define function versions in the C library.\n */\n#define\t__sgetc(p) (--(p)->_r < 0 ? __srget(p) : (int)(*(p)->_p++))\n#if defined(__GNUC__) && defined(__STDC__)\nstatic __inline int __sputc(int _c, FILE *_p) {\n\tif (--_p->_w >= 0 || (_p->_w >= _p->_lbfsize && (char)_c != '\\n'))\n\t\treturn (*_p->_p++ = _c);\n\telse\n\t\treturn (__swbuf(_c, _p));\n}\n#else\n/*\n * This has been tuned to generate reasonable code on the vax using pcc.\n */\n#define\t__sputc(c, p) \\\n\t(--(p)->_w < 0 ? \\\n\t\t(p)->_w >= (p)->_lbfsize ? \\\n\t\t\t(*(p)->_p = (c)), *(p)->_p != '\\n' ? \\\n\t\t\t\t(int)*(p)->_p++ : \\\n\t\t\t\t__swbuf('\\n', p) : \\\n\t\t\t__swbuf((int)(c), p) : \\\n\t\t(*(p)->_p = (c), (int)*(p)->_p++))\n#endif\n\n#define\t__sfeof(p)\t(((p)->_flags & __SEOF) != 0)\n#define\t__sferror(p)\t(((p)->_flags & __SERR) != 0)\n#define\t__sclearerr(p)\t((void)((p)->_flags &= ~(__SERR|__SEOF)))\n#define\t__sfileno(p)\t((p)->_file)\n\nextern int __isthreaded;\n\n#define\tfeof(p)\t\t(!__isthreaded ? __sfeof(p) : (feof)(p))\n#define\tferror(p)\t(!__isthreaded ? __sferror(p) : (ferror)(p))\n#define\tclearerr(p)\t(!__isthreaded ? __sclearerr(p) : (clearerr)(p))\n\n#if __POSIX_VISIBLE\n#define\tfileno(p)\t(!__isthreaded ? __sfileno(p) : (fileno)(p))\n#endif\n\n#define\tgetc(fp)\t(!__isthreaded ? __sgetc(fp) : (getc)(fp))\n#define\tputc(x, fp)\t(!__isthreaded ? __sputc(x, fp) : (putc)(x, fp))\n\n#define\tgetchar()\tgetc(stdin)\n#define\tputchar(x)\tputc(x, stdout)\n\n#if __BSD_VISIBLE\n/*\n * See ISO/IEC 9945-1 ANSI/IEEE Std 1003.1 Second Edition 1996-07-12\n * B.8.2.7 for the rationale behind the *_unlocked() macros.\n */\n#define\tfeof_unlocked(p)\t__sfeof(p)\n#define\tferror_unlocked(p)\t__sferror(p)\n#define\tclearerr_unlocked(p)\t__sclearerr(p)\n#define\tfileno_unlocked(p)\t__sfileno(p)\n#endif\n#if __POSIX_VISIBLE >= 199506\n#define\tgetc_unlocked(fp)\t__sgetc(fp)\n#define\tputc_unlocked(x, fp)\t__sputc(x, fp)\n\n#define\tgetchar_unlocked()\tgetc_unlocked(stdin)\n#define\tputchar_unlocked(x)\tputc_unlocked(x, stdout)\n#endif\n\n__END_DECLS\n#endif /* !_STDIO_H_ */\n"
  },
  {
    "path": "freebsd-headers/stdlib.h",
    "content": "/*-\n * Copyright (c) 1990, 1993\n *\tThe Regents of the University of California.  All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t@(#)stdlib.h\t8.5 (Berkeley) 5/19/95\n * $FreeBSD: release/9.0.0/include/stdlib.h 206997 2010-04-21 16:38:37Z kib $\n */\n\n#ifndef _STDLIB_H_\n#define\t_STDLIB_H_\n\n#include <sys/cdefs.h>\n#include <sys/_null.h>\n#include <sys/_types.h>\n\n#if __BSD_VISIBLE\n#ifndef _RUNE_T_DECLARED\ntypedef\t__rune_t\trune_t;\n#define\t_RUNE_T_DECLARED\n#endif\n#endif\n\n#ifndef _SIZE_T_DECLARED\ntypedef\t__size_t\tsize_t;\n#define\t_SIZE_T_DECLARED\n#endif\n\n#ifndef\t__cplusplus\n#ifndef _WCHAR_T_DECLARED\ntypedef\t__wchar_t\twchar_t;\n#define\t_WCHAR_T_DECLARED\n#endif\n#endif\n\ntypedef struct {\n\tint\tquot;\t\t/* quotient */\n\tint\trem;\t\t/* remainder */\n} div_t;\n\ntypedef struct {\n\tlong\tquot;\n\tlong\trem;\n} ldiv_t;\n\n#define\tEXIT_FAILURE\t1\n#define\tEXIT_SUCCESS\t0\n\n#define\tRAND_MAX\t0x7fffffff\n\nextern int __mb_cur_max;\n#define\tMB_CUR_MAX\t__mb_cur_max\n\n__BEGIN_DECLS\nvoid\t abort(void) __dead2;\nint\t abs(int) __pure2;\nint\t atexit(void (*)(void));\ndouble\t atof(const char *);\nint\t atoi(const char *);\nlong\t atol(const char *);\nvoid\t*bsearch(const void *, const void *, size_t,\n\t    size_t, int (*)(const void *, const void *));\nvoid\t*calloc(size_t, size_t) __malloc_like;\ndiv_t\t div(int, int) __pure2;\nvoid\t exit(int) __dead2;\nvoid\t free(void *);\nchar\t*getenv(const char *);\nlong\t labs(long) __pure2;\nldiv_t\t ldiv(long, long) __pure2;\nvoid\t*malloc(size_t) __malloc_like;\nint\t mblen(const char *, size_t);\nsize_t\t mbstowcs(wchar_t * __restrict , const char * __restrict, size_t);\nint\t mbtowc(wchar_t * __restrict, const char * __restrict, size_t);\nvoid\t qsort(void *, size_t, size_t,\n\t    int (*)(const void *, const void *));\nint\t rand(void);\nvoid\t*realloc(void *, size_t);\nvoid\t srand(unsigned);\ndouble\t strtod(const char * __restrict, char ** __restrict);\nfloat\t strtof(const char * __restrict, char ** __restrict);\nlong\t strtol(const char * __restrict, char ** __restrict, int);\nlong double\n\t strtold(const char * __restrict, char ** __restrict);\nunsigned long\n\t strtoul(const char * __restrict, char ** __restrict, int);\nint\t system(const char *);\nint\t wctomb(char *, wchar_t);\nsize_t\t wcstombs(char * __restrict, const wchar_t * __restrict, size_t);\n\n/*\n * Functions added in C99 which we make conditionally available in the\n * BSD^C89 namespace if the compiler supports `long long'.\n * The #if test is more complicated than it ought to be because\n * __BSD_VISIBLE implies __ISO_C_VISIBLE == 1999 *even if* `long long'\n * is not supported in the compilation environment (which therefore means\n * that it can't really be ISO C99).\n *\n * (The only other extension made by C99 in thie header is _Exit().)\n */\n#if __ISO_C_VISIBLE >= 1999\n#ifdef __LONG_LONG_SUPPORTED\n/* LONGLONG */\ntypedef struct {\n\tlong long quot;\n\tlong long rem;\n} lldiv_t;\n\n/* LONGLONG */\nlong long\n\t atoll(const char *);\n/* LONGLONG */\nlong long\n\t llabs(long long) __pure2;\n/* LONGLONG */\nlldiv_t\t lldiv(long long, long long) __pure2;\n/* LONGLONG */\nlong long\n\t strtoll(const char * __restrict, char ** __restrict, int);\n/* LONGLONG */\nunsigned long long\n\t strtoull(const char * __restrict, char ** __restrict, int);\n#endif /* __LONG_LONG_SUPPORTED */\n\nvoid\t _Exit(int) __dead2;\n#endif /* __ISO_C_VISIBLE >= 1999 */\n\n/*\n * Extensions made by POSIX relative to C.  We don't know yet which edition\n * of POSIX made these extensions, so assume they've always been there until\n * research can be done.\n */\n#if __POSIX_VISIBLE /* >= ??? */\nint\t posix_memalign(void **, size_t, size_t); /* (ADV) */\nint\t rand_r(unsigned *);\t\t\t/* (TSF) */\nchar\t*realpath(const char * __restrict, char * __restrict);\nint\t setenv(const char *, const char *, int);\nint\t unsetenv(const char *);\n#endif\n\n#if __POSIX_VISIBLE >= 200809 || __XSI_VISIBLE\nint\t getsubopt(char **, char *const *, char **);\n#ifndef _MKDTEMP_DECLARED\nchar\t*mkdtemp(char *);\n#define\t_MKDTEMP_DECLARED\n#endif\n#ifndef _MKSTEMP_DECLARED\nint\t mkstemp(char *);\n#define\t_MKSTEMP_DECLARED\n#endif\n#endif /* __POSIX_VISIBLE >= 200809 || __XSI_VISIBLE */\n\n/*\n * The only changes to the XSI namespace in revision 6 were the deletion\n * of the ttyslot() and valloc() functions, which FreeBSD never declared\n * in this header.  For revision 7, ecvt(), fcvt(), and gcvt(), which\n * FreeBSD also does not have, and mktemp(), are to be deleted.\n */\n#if __XSI_VISIBLE\n/* XXX XSI requires pollution from <sys/wait.h> here.  We'd rather not. */\nlong\t a64l(const char *);\ndouble\t drand48(void);\n/* char\t*ecvt(double, int, int * __restrict, int * __restrict); */\ndouble\t erand48(unsigned short[3]);\n/* char\t*fcvt(double, int, int * __restrict, int * __restrict); */\n/* char\t*gcvt(double, int, int * __restrict, int * __restrict); */\nint\t grantpt(int);\nchar\t*initstate(unsigned long /* XSI requires u_int */, char *, long);\nlong\t jrand48(unsigned short[3]);\nchar\t*l64a(long);\nvoid\t lcong48(unsigned short[7]);\nlong\t lrand48(void);\n#if !defined(_MKTEMP_DECLARED) && (__BSD_VISIBLE || __XSI_VISIBLE <= 600)\nchar\t*mktemp(char *);\n#define\t_MKTEMP_DECLARED\n#endif\nlong\t mrand48(void);\nlong\t nrand48(unsigned short[3]);\nint\t posix_openpt(int);\nchar\t*ptsname(int);\nint\t putenv(char *);\nlong\t random(void);\nunsigned short\n\t*seed48(unsigned short[3]);\n#ifndef _SETKEY_DECLARED\nint\t setkey(const char *);\n#define\t_SETKEY_DECLARED\n#endif\nchar\t*setstate(/* const */ char *);\nvoid\t srand48(long);\nvoid\t srandom(unsigned long);\nint\t unlockpt(int);\n#endif /* __XSI_VISIBLE */\n\n#if __BSD_VISIBLE\nextern const char *_malloc_options;\nextern void (*_malloc_message)(const char *, const char *, const char *,\n\t    const char *);\n\n/*\n * The alloca() function can't be implemented in C, and on some\n * platforms it can't be implemented at all as a callable function.\n * The GNU C compiler provides a built-in alloca() which we can use;\n * in all other cases, provide a prototype, mainly to pacify various\n * incarnations of lint.  On platforms where alloca() is not in libc,\n * programs which use it will fail to link when compiled with non-GNU\n * compilers.\n */\n#if __GNUC__ >= 2 || defined(__INTEL_COMPILER)\n#undef  alloca\t/* some GNU bits try to get cute and define this on their own */\n#define alloca(sz) __builtin_alloca(sz)\n#elif defined(lint)\nvoid\t*alloca(size_t);\n#endif\n\nvoid\t abort2(const char *, int, void **) __dead2;\n__uint32_t\n\t arc4random(void);\nvoid\t arc4random_addrandom(unsigned char *, int);\nvoid\t arc4random_buf(void *, size_t);\nvoid\t arc4random_stir(void);\n__uint32_t \n\t arc4random_uniform(__uint32_t);\nchar\t*getbsize(int *, long *);\n\t\t\t\t\t/* getcap(3) functions */\nchar\t*cgetcap(char *, const char *, int);\nint\t cgetclose(void);\nint\t cgetent(char **, char **, const char *);\nint\t cgetfirst(char **, char **);\nint\t cgetmatch(const char *, const char *);\nint\t cgetnext(char **, char **);\nint\t cgetnum(char *, const char *, long *);\nint\t cgetset(const char *);\nint\t cgetstr(char *, const char *, char **);\nint\t cgetustr(char *, const char *, char **);\n\nint\t daemon(int, int);\nchar\t*devname(__dev_t, __mode_t);\nchar \t*devname_r(__dev_t, __mode_t, char *, int);\nchar\t*fdevname(int);\nchar \t*fdevname_r(int, char *, int);\nint\t getloadavg(double [], int);\n__const char *\n\t getprogname(void);\n\nint\t heapsort(void *, size_t, size_t, int (*)(const void *, const void *));\nint\t l64a_r(long, char *, int);\nint\t mergesort(void *, size_t, size_t, int (*)(const void *, const void *));\nvoid\t qsort_r(void *, size_t, size_t, void *,\n\t    int (*)(void *, const void *, const void *));\nint\t radixsort(const unsigned char **, int, const unsigned char *,\n\t    unsigned);\nvoid    *reallocf(void *, size_t);\nint\t rpmatch(const char *);\nvoid\t setprogname(const char *);\nint\t sradixsort(const unsigned char **, int, const unsigned char *,\n\t    unsigned);\nvoid\t sranddev(void);\nvoid\t srandomdev(void);\nlong long\n\tstrtonum(const char *, long long, long long, const char **);\n\n/* Deprecated interfaces, to be removed in FreeBSD 6.0. */\n__int64_t\n\t strtoq(const char *, char **, int);\n__uint64_t\n\t strtouq(const char *, char **, int);\n\nextern char *suboptarg;\t\t\t/* getsubopt(3) external variable */\n#endif /* __BSD_VISIBLE */\n__END_DECLS\n\n#endif /* !_STDLIB_H_ */\n"
  },
  {
    "path": "freebsd-headers/string.h",
    "content": "/*-\n * Copyright (c) 1990, 1993\n *\tThe Regents of the University of California.  All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t@(#)string.h\t8.1 (Berkeley) 6/2/93\n * $FreeBSD: release/9.0.0/include/string.h 203964 2010-02-16 19:39:50Z imp $\n */\n\n#ifndef _STRING_H_\n#define\t_STRING_H_\n\n#include <sys/cdefs.h>\n#include <sys/_null.h>\n#include <sys/_types.h>\n\n/*\n * Prototype functions which were historically defined in <string.h>, but\n * are required by POSIX to be prototyped in <strings.h>.\n */\n#if __BSD_VISIBLE\n#include <strings.h>\n#endif\n\n#ifndef _SIZE_T_DECLARED\ntypedef\t__size_t\tsize_t;\n#define\t_SIZE_T_DECLARED\n#endif\n\n__BEGIN_DECLS\n#if __XSI_VISIBLE >= 600\nvoid\t*memccpy(void * __restrict, const void * __restrict, int, size_t);\n#endif\nvoid\t*memchr(const void *, int, size_t) __pure;\n#if __BSD_VISIBLE\nvoid\t*memrchr(const void *, int, size_t) __pure;\n#endif\nint\t memcmp(const void *, const void *, size_t) __pure;\nvoid\t*memcpy(void * __restrict, const void * __restrict, size_t);\n#if __BSD_VISIBLE\nvoid\t*memmem(const void *, size_t, const void *, size_t) __pure;\n#endif\nvoid\t*memmove(void *, const void *, size_t);\nvoid\t*memset(void *, int, size_t);\n#if __POSIX_VISIBLE >= 200809 || __BSD_VISIBLE\nchar\t*stpcpy(char * __restrict, const char * __restrict);\nchar\t*stpncpy(char * __restrict, const char * __restrict, size_t);\n#endif\n#if __BSD_VISIBLE\nchar\t*strcasestr(const char *, const char *) __pure;\n#endif\nchar\t*strcat(char * __restrict, const char * __restrict);\nchar\t*strchr(const char *, int) __pure;\nint\t strcmp(const char *, const char *) __pure;\nint\t strcoll(const char *, const char *);\nchar\t*strcpy(char * __restrict, const char * __restrict);\nsize_t\t strcspn(const char *, const char *) __pure;\n#if __POSIX_VISIBLE >= 200112 || __XSI_VISIBLE\nchar\t*strdup(const char *) __malloc_like;\n#endif\nchar\t*strerror(int);\n#if __POSIX_VISIBLE >= 200112\nint\t strerror_r(int, char *, size_t);\n#endif\n#if __BSD_VISIBLE\nsize_t\t strlcat(char * __restrict, const char * __restrict, size_t);\nsize_t\t strlcpy(char * __restrict, const char * __restrict, size_t);\n#endif\nsize_t\t strlen(const char *) __pure;\n#if __BSD_VISIBLE\nvoid\t strmode(int, char *);\n#endif\nchar\t*strncat(char * __restrict, const char * __restrict, size_t);\nint\t strncmp(const char *, const char *, size_t) __pure;\nchar\t*strncpy(char * __restrict, const char * __restrict, size_t);\n#if __POSIX_VISIBLE >= 200809 || __BSD_VISIBLE\nchar\t*strndup(const char *, size_t) __malloc_like;\nsize_t\t strnlen(const char *, size_t) __pure;\n#endif\n#if __BSD_VISIBLE\nchar\t*strnstr(const char *, const char *, size_t) __pure;\n#endif\nchar\t*strpbrk(const char *, const char *) __pure;\nchar\t*strrchr(const char *, int) __pure;\n#if __BSD_VISIBLE\nchar\t*strsep(char **, const char *);\n#endif\n#if __POSIX_VISIBLE >= 200809 || __BSD_VISIBLE\nchar\t*strsignal(int);\n#endif\nsize_t\t strspn(const char *, const char *) __pure;\nchar\t*strstr(const char *, const char *) __pure;\nchar\t*strtok(char * __restrict, const char * __restrict);\n#if __POSIX_VISIBLE >= 199506 || __XSI_VISIBLE >= 500\nchar\t*strtok_r(char *, const char *, char **);\n#endif\nsize_t\t strxfrm(char * __restrict, const char * __restrict, size_t);\n#if __BSD_VISIBLE\n\n#ifndef _SWAB_DECLARED\n#define _SWAB_DECLARED\n\n#ifndef _SSIZE_T_DECLARED\ntypedef\t__ssize_t\tssize_t;\n#define\t_SSIZE_T_DECLARED\n#endif /* _SIZE_T_DECLARED */\n\nvoid\t swab(const void * __restrict, void * __restrict, ssize_t);\n#endif /* _SWAB_DECLARED */\n\n#endif /* __BSD_VISIBLE */\n__END_DECLS\n\n#endif /* _STRING_H_ */\n"
  },
  {
    "path": "freebsd-headers/stringlist.h",
    "content": "/*\t$NetBSD: stringlist.h,v 1.2 1997/01/17 06:11:36 lukem Exp $\t*/\n\n/*\n * Copyright (c) 1994 Christos Zoulas\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. All advertising materials mentioning features or use of this software\n *    must display the following acknowledgement:\n *\tThis product includes software developed by Christos Zoulas.\n * 4. The name of the author may not be used to endorse or promote products\n *    derived from this software without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS\n * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY\n * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/include/stringlist.h 109508 2003-01-19 01:16:01Z obrien $\n */\n\n#ifndef _STRINGLIST_H\n#define _STRINGLIST_H \n#include <sys/cdefs.h>\n#include <sys/types.h>\n\n/*\n * Simple string list\n */\ntypedef struct _stringlist {\n\tchar\t**sl_str;\n\tsize_t\t  sl_max;\n\tsize_t\t  sl_cur;\n} StringList;\n\n__BEGIN_DECLS\nStringList *sl_init(void);\nint\t sl_add(StringList *, char *);\nvoid\t sl_free(StringList *, int);\nchar\t*sl_find(StringList *, char *);\n__END_DECLS\n\n#endif /* _STRINGLIST_H */\n"
  },
  {
    "path": "freebsd-headers/strings.h",
    "content": "/*-\n * Copyright (c) 2002 Mike Barcroft <mike@FreeBSD.org>\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/include/strings.h 201525 2010-01-04 18:46:54Z ed $\n */\n\n#ifndef _STRINGS_H_\n#define\t_STRINGS_H_\n\n#include <sys/cdefs.h>\n#include <sys/_types.h>\n\n#ifndef _SIZE_T_DECLARED\ntypedef\t__size_t\tsize_t;\n#define\t_SIZE_T_DECLARED\n#endif\n\n__BEGIN_DECLS\n#if __BSD_VISIBLE || __POSIX_VISIBLE <= 200112\nint\t bcmp(const void *, const void *, size_t) __pure;\t/* LEGACY */\nvoid\t bcopy(const void *, void *, size_t);\t\t\t/* LEGACY */\nvoid\t bzero(void *, size_t);\t\t\t\t\t/* LEGACY */\n#endif\n#if __XSI_VISIBLE\nint\t ffs(int) __pure2;\n#endif\n#if __BSD_VISIBLE\nint\t ffsl(long) __pure2;\nint\t ffsll(long long) __pure2;\nint\t fls(int) __pure2;\nint\t flsl(long) __pure2;\nint\t flsll(long long) __pure2;\n#endif\n#if __BSD_VISIBLE || __POSIX_VISIBLE <= 200112\nchar\t*index(const char *, int) __pure;\t\t\t/* LEGACY */\nchar\t*rindex(const char *, int) __pure;\t\t\t/* LEGACY */\n#endif\nint\t strcasecmp(const char *, const char *) __pure;\nint\t strncasecmp(const char *, const char *, size_t) __pure;\n__END_DECLS\n\n#endif /* _STRINGS_H_ */\n"
  },
  {
    "path": "freebsd-headers/sys/_bus_dma.h",
    "content": "/*-\n * Copyright 2006 John-Mark Gurney.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/sys/_bus_dma.h 161927 2006-09-03 00:26:17Z jmg $\n *\n */\n\n#ifndef _SYS__BUS_DMA_H_\n#define _SYS__BUS_DMA_H_\n\ntypedef int bus_dmasync_op_t;\n\n/*\n *\tbus_dma_tag_t\n *\n *\tA machine-dependent opaque type describing the characteristics\n *\tof how to perform DMA mappings.  This structure encapsultes\n *\tinformation concerning address and alignment restrictions, number\n *\tof S/G segments, amount of data per S/G segment, etc.\n */\ntypedef struct bus_dma_tag\t*bus_dma_tag_t;\n\n/*\n *\tbus_dmamap_t\n *\n *\tDMA mapping instance information.\n */\ntypedef struct bus_dmamap\t*bus_dmamap_t;\n\n/*\n * A function that performs driver-specific synchronization on behalf of\n * busdma.\n */\ntypedef enum {\n\tBUS_DMA_LOCK\t= 0x01,\n\tBUS_DMA_UNLOCK\t= 0x02,\n} bus_dma_lock_op_t;\n\ntypedef void bus_dma_lock_t(void *, bus_dma_lock_op_t);\n\n#endif /* !_SYS__BUS_DMA_H_ */\n"
  },
  {
    "path": "freebsd-headers/sys/_callout.h",
    "content": "/*-\n * Copyright (c) 1990, 1993\n *\tThe Regents of the University of California.  All rights reserved.\n * (c) UNIX System Laboratories, Inc.\n * All or some portions of this file are derived from material licensed\n * to the University of California by American Telephone and Telegraph\n * Co. or Unix System Laboratories, Inc. and are reproduced herein with\n * the permission of UNIX System Laboratories, Inc.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 4. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t@(#)callout.h\t8.2 (Berkeley) 1/21/94\n * $FreeBSD: release/9.0.0/sys/sys/_callout.h 221059 2011-04-26 11:39:56Z kib $\n */\n\n#ifndef _SYS__CALLOUT_H\n#define\t_SYS__CALLOUT_H\n\n#include <sys/queue.h>\n\nstruct lock_object;\n\nSLIST_HEAD(callout_list, callout);\nTAILQ_HEAD(callout_tailq, callout);\n\nstruct callout {\n\tunion {\n\t\tSLIST_ENTRY(callout) sle;\n\t\tTAILQ_ENTRY(callout) tqe;\n\t} c_links;\n\tint\tc_time;\t\t\t\t/* ticks to the event */\n\tvoid\t*c_arg;\t\t\t\t/* function argument */\n\tvoid\t(*c_func)(void *);\t\t/* function to call */\n\tstruct lock_object *c_lock;\t\t/* lock to handle */\n\tint\tc_flags;\t\t\t/* state of this entry */\n\tvolatile int c_cpu;\t\t\t/* CPU we're scheduled on */\n};\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/sys/_cpuset.h",
    "content": "/*-\n * Copyright (c) 2008,\tJeffrey Roberson <jeff@freebsd.org>\n * All rights reserved.\n *\n * Copyright (c) 2008 Nokia Corporation\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice unmodified, this list of conditions, and the following\n *    disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR\n * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES\n * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,\n * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF\n * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/sys/_cpuset.h 222813 2011-06-07 08:46:13Z attilio $\n */\n\n#ifndef _SYS__CPUSET_H_\n#define\t_SYS__CPUSET_H_\n\n#ifdef _KERNEL\n#define\tCPU_SETSIZE\tMAXCPU\n#endif\n\n#define\tCPU_MAXSIZE\t128\n\n#ifndef\tCPU_SETSIZE\n#define\tCPU_SETSIZE\tCPU_MAXSIZE\n#endif\n\n#define\t_NCPUBITS\t(sizeof(long) * NBBY)\t/* bits per mask */\n#define\t_NCPUWORDS\thowmany(CPU_SETSIZE, _NCPUBITS)\n\ntypedef\tstruct _cpuset {\n\tlong\t__bits[howmany(CPU_SETSIZE, _NCPUBITS)];\n} cpuset_t;\n\n#endif /* !_SYS__CPUSET_H_ */\n"
  },
  {
    "path": "freebsd-headers/sys/_iovec.h",
    "content": "/*-\n * Copyright (c) 1982, 1986, 1993, 1994\n *\tThe Regents of the University of California.  All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 4. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t@(#)uio.h\t8.5 (Berkeley) 2/22/94\n * $FreeBSD: release/9.0.0/sys/sys/_iovec.h 139825 2005-01-07 02:29:27Z imp $\n */\n\n#ifndef _SYS__IOVEC_H_\n#define\t_SYS__IOVEC_H_\n\n#include <sys/_types.h>\n\n#ifndef _SIZE_T_DECLARED\ntypedef\t__size_t\tsize_t;\n#define\t_SIZE_T_DECLARED\n#endif\n\nstruct iovec {\n\tvoid\t*iov_base;\t/* Base address. */\n\tsize_t\t iov_len;\t/* Length. */\n};\n\n#endif /* !_SYS__IOVEC_H_ */\n"
  },
  {
    "path": "freebsd-headers/sys/_lock.h",
    "content": "/*-\n * Copyright (c) 1997 Berkeley Software Design, Inc. All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. Berkeley Software Design Inc's name may not be used to endorse or\n *    promote products derived from this software without specific prior\n *    written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY BERKELEY SOFTWARE DESIGN INC ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL BERKELEY SOFTWARE DESIGN INC BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/sys/_lock.h 179025 2008-05-15 20:10:06Z attilio $\n */\n\n#ifndef _SYS__LOCK_H_\n#define\t_SYS__LOCK_H_\n\nstruct lock_object {\n\tconst\tchar *lo_name;\t\t/* Individual lock name. */\n\tu_int\tlo_flags;\n\tu_int\tlo_data;\t\t/* General class specific data. */\n\tstruct\twitness *lo_witness;\t/* Data for witness. */\n};\n\n#endif /* !_SYS__LOCK_H_ */\n"
  },
  {
    "path": "freebsd-headers/sys/_lockmgr.h",
    "content": "/*-\n * Copyright (c) 2008 Attilio Rao <attilio@FreeBSD.org>\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice(s), this list of conditions and the following disclaimer as\n *    the first lines of this file unmodified other than the possible \n *    addition of one or more copyright notices.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice(s), this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\n * DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE LIABLE FOR ANY\n * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR\n * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH\n * DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/sys/_lockmgr.h 200447 2009-12-12 21:31:07Z attilio $\n */\n\n#ifndef _SYS__LOCKMGR_H_\n#define\t_SYS__LOCKMGR_H_\n\n#ifdef DEBUG_LOCKS\n#include <sys/_stack.h>\n#endif\n\nstruct lock {\n\tstruct lock_object\tlock_object;\n\tvolatile uintptr_t\tlk_lock;\n\tu_int\t\t\tlk_exslpfail;\n\tint\t\t\tlk_timo;\n\tint\t\t\tlk_pri;\n#ifdef DEBUG_LOCKS\n\tstruct stack\t\tlk_stack;\n#endif\n};\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/sys/_mutex.h",
    "content": "/*-\n * Copyright (c) 1997 Berkeley Software Design, Inc. All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. Berkeley Software Design Inc's name may not be used to endorse or\n *    promote products derived from this software without specific prior\n *    written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY BERKELEY SOFTWARE DESIGN INC ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL BERKELEY SOFTWARE DESIGN INC BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/sys/_mutex.h 179025 2008-05-15 20:10:06Z attilio $\n */\n\n#ifndef _SYS__MUTEX_H_\n#define\t_SYS__MUTEX_H_\n\n/*\n * Sleep/spin mutex.\n */\nstruct mtx {\n\tstruct lock_object\tlock_object;\t/* Common lock properties. */\n\tvolatile uintptr_t\tmtx_lock;\t/* Owner and flags. */\n};\n\n#endif /* !_SYS__MUTEX_H_ */\n"
  },
  {
    "path": "freebsd-headers/sys/_null.h",
    "content": "/*-\n * Copyright (c) 2003 Marcel Moolenaar\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n *\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR\n * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES\n * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,\n * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF\n * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/sys/_null.h 192002 2009-05-11 21:13:00Z jhb $\n */\n\n#ifndef NULL\n\n#if !defined(__cplusplus)\n#define\tNULL\t((void *)0)\n#else\n#if defined(__GNUG__) && defined(__GNUC__) && __GNUC__ >= 4\n#define\tNULL\t__null\n#else\n#if defined(__LP64__)\n#define\tNULL\t(0L)\n#else\n#define\tNULL\t0\n#endif\t/* __LP64__ */\n#endif\t/* __GNUG__ */\n#endif\t/* !__cplusplus */\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/sys/_pthreadtypes.h",
    "content": "/*\n * Copyright (c) 1993, 1994 by Chris Provenzano, proven@mit.edu\n * Copyright (c) 1995-1998 by John Birrell <jb@cimlogic.com.au>\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. All advertising materials mentioning features or use of this software\n *    must display the following acknowledgement:\n *  This product includes software developed by Chris Provenzano.\n * 4. The name of Chris Provenzano may not be used to endorse or promote \n *\t  products derived from this software without specific prior written\n *\t  permission.\n *\n * THIS SOFTWARE IS PROVIDED BY CHRIS PROVENZANO ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL CHRIS PROVENZANO BE LIABLE FOR ANY \n * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR \n * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT \n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF \n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/sys/_pthreadtypes.h 189828 2009-03-14 20:10:14Z das $\n */\n\n#ifndef _SYS__PTHREADTYPES_H_\n#define _SYS__PTHREADTYPES_H_\n\n/*\n * Forward structure definitions.\n *\n * These are mostly opaque to the user.\n */\nstruct pthread;\nstruct pthread_attr;\nstruct pthread_cond;\nstruct pthread_cond_attr;\nstruct pthread_mutex;\nstruct pthread_mutex_attr;\nstruct pthread_once;\nstruct pthread_rwlock;\nstruct pthread_rwlockattr;\nstruct pthread_barrier;\nstruct pthread_barrier_attr;\nstruct pthread_spinlock;\n\n/*\n * Primitive system data type definitions required by P1003.1c.\n *\n * Note that P1003.1c specifies that there are no defined comparison\n * or assignment operators for the types pthread_attr_t, pthread_cond_t,\n * pthread_condattr_t, pthread_mutex_t, pthread_mutexattr_t.\n */\n#ifndef _PTHREAD_T_DECLARED\ntypedef struct\tpthread\t\t\t*pthread_t;\n#define\t_PTHREAD_T_DECLARED\n#endif\ntypedef struct\tpthread_attr\t\t*pthread_attr_t;\ntypedef struct\tpthread_mutex\t\t*pthread_mutex_t;\ntypedef struct\tpthread_mutex_attr\t*pthread_mutexattr_t;\ntypedef struct\tpthread_cond\t\t*pthread_cond_t;\ntypedef struct\tpthread_cond_attr\t*pthread_condattr_t;\ntypedef int     \t\t\tpthread_key_t;\ntypedef struct\tpthread_once\t\tpthread_once_t;\ntypedef struct\tpthread_rwlock\t\t*pthread_rwlock_t;\ntypedef struct\tpthread_rwlockattr\t*pthread_rwlockattr_t;\ntypedef struct\tpthread_barrier\t\t*pthread_barrier_t;\ntypedef struct\tpthread_barrierattr\t*pthread_barrierattr_t;\ntypedef struct\tpthread_spinlock\t*pthread_spinlock_t;\n\n/*\n * Additional type definitions:\n *\n * Note that P1003.1c reserves the prefixes pthread_ and PTHREAD_ for\n * use in header symbols.\n */\ntypedef void\t*pthread_addr_t;\ntypedef void\t*(*pthread_startroutine_t)(void *);\n\n/*\n * Once definitions.\n */\nstruct pthread_once {\n\tint\t\tstate;\n\tpthread_mutex_t\tmutex;\n};\n\n#endif /* ! _SYS__PTHREADTYPES_H_ */\n"
  },
  {
    "path": "freebsd-headers/sys/_rmlock.h",
    "content": "/*-\n * Copyright (c) 2007 Stephan Uphoff <ups@FreeBSD.org>\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. Neither the name of the author nor the names of any co-contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/sys/_rmlock.h 222813 2011-06-07 08:46:13Z attilio $\n */\n\n#ifndef _SYS__RMLOCK_H_\n#define\t_SYS__RMLOCK_H_\n\n/* \n * XXXUPS remove as soon as we have per cpu variable\n * linker sets and  can define rm_queue in _rm_lock.h\n*/\n#include <sys/pcpu.h>\n/*\n * Mostly reader/occasional writer lock.\n */\n\nLIST_HEAD(rmpriolist,rm_priotracker);\n\nstruct rmlock {\n\tstruct lock_object lock_object; \n\tvolatile cpuset_t rm_writecpus;\n\tLIST_HEAD(,rm_priotracker) rm_activeReaders;\n\tunion {\n\t\tstruct mtx _rm_lock_mtx;\n\t\tstruct sx _rm_lock_sx;\n\t} _rm_lock;\n};\n#define\trm_lock_mtx\t_rm_lock._rm_lock_mtx\n#define\trm_lock_sx\t_rm_lock._rm_lock_sx\n\nstruct rm_priotracker {\n\tstruct rm_queue rmp_cpuQueue; /* Must be first */\n\tstruct rmlock *rmp_rmlock;\n\tstruct thread *rmp_thread;\n\tint rmp_flags;\n\tLIST_ENTRY(rm_priotracker) rmp_qentry;\n};\n\n#endif /* !_SYS__RMLOCK_H_ */\n"
  },
  {
    "path": "freebsd-headers/sys/_rwlock.h",
    "content": "/*-\n * Copyright (c) 2006 John Baldwin <jhb@FreeBSD.org>\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. Neither the name of the author nor the names of any co-contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/sys/_rwlock.h 179025 2008-05-15 20:10:06Z attilio $\n */\n\n#ifndef _SYS__RWLOCK_H_\n#define\t_SYS__RWLOCK_H_\n\n/*\n * Reader/writer lock.\n */\nstruct rwlock {\n\tstruct lock_object\tlock_object;\n\tvolatile uintptr_t\trw_lock;\n};\n\n#endif /* !_SYS__RWLOCK_H_ */\n"
  },
  {
    "path": "freebsd-headers/sys/_semaphore.h",
    "content": "/*-\n * Copyright (c) 2002 Alfred Perlstein <alfred@FreeBSD.org>\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t$FreeBSD: release/9.0.0/sys/sys/_semaphore.h 201546 2010-01-05 02:37:59Z davidxu $\n */\n#ifndef __SEMAPHORE_H_\n#define __SEMAPHORE_H_\n\ntypedef intptr_t semid_t;\nstruct timespec;\n\n#define SEM_VALUE_MAX  __INT_MAX\n\n#ifndef _KERNEL\n\n__BEGIN_DECLS\n\nint ksem_close(semid_t id);\nint ksem_post(semid_t id);\nint ksem_wait(semid_t id);\nint ksem_trywait(semid_t id);\nint ksem_timedwait(semid_t id, const struct timespec *abstime);\nint ksem_init(semid_t *idp, unsigned int value);\nint ksem_open(semid_t *idp, const char *name, int oflag, mode_t mode,\n    unsigned int value);\nint ksem_unlink(const char *name);\nint ksem_getvalue(semid_t id, int *val);\nint ksem_destroy(semid_t id);\n\n__END_DECLS\n\n#endif /* !_KERNEL */\n\n#endif /* __SEMAPHORE_H_ */\n"
  },
  {
    "path": "freebsd-headers/sys/_sigset.h",
    "content": "/*-\n * Copyright (c) 1982, 1986, 1989, 1991, 1993\n *\tThe Regents of the University of California.  All rights reserved.\n * (c) UNIX System Laboratories, Inc.\n * All or some portions of this file are derived from material licensed\n * to the University of California by American Telephone and Telegraph\n * Co. or Unix System Laboratories, Inc. and are reproduced herein with\n * the permission of UNIX System Laboratories, Inc.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 4. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t@(#)signal.h\t8.4 (Berkeley) 5/4/95\n * $FreeBSD: release/9.0.0/sys/sys/_sigset.h 139825 2005-01-07 02:29:27Z imp $\n */\n\n#ifndef _SYS__SIGSET_H_\n#define\t_SYS__SIGSET_H_\n\n/*\n * sigset_t macros.\n */\n#define\t_SIG_WORDS\t4\n#define\t_SIG_MAXSIG\t128\n#define\t_SIG_IDX(sig)\t((sig) - 1)\n#define\t_SIG_WORD(sig)\t(_SIG_IDX(sig) >> 5)\n#define\t_SIG_BIT(sig)\t(1 << (_SIG_IDX(sig) & 31))\n#define\t_SIG_VALID(sig)\t((sig) <= _SIG_MAXSIG && (sig) > 0)\n\ntypedef struct __sigset {\n\t__uint32_t __bits[_SIG_WORDS];\n} __sigset_t;\n\n#if defined(_KERNEL) && defined(COMPAT_43)\ntypedef unsigned int osigset_t;\n#endif\n\n#endif /* !_SYS__SIGSET_H_ */\n"
  },
  {
    "path": "freebsd-headers/sys/_sockaddr_storage.h",
    "content": "/*-\n * Copyright (c) 1982, 1985, 1986, 1988, 1993, 1994\n *\tThe Regents of the University of California.  All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 4. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t@(#)socket.h\t8.4 (Berkeley) 2/21/94\n * $FreeBSD: release/9.0.0/sys/sys/_sockaddr_storage.h 196967 2009-09-08 10:39:38Z phk $\n */\n\n#ifndef _SYS__SOCKADDR_STORAGE_H_\n#define\t_SYS__SOCKADDR_STORAGE_H_\n\n/*\n * RFC 2553: protocol-independent placeholder for socket addresses\n */\n#define\t_SS_MAXSIZE\t128U\n#define\t_SS_ALIGNSIZE\t(sizeof(__int64_t))\n#define\t_SS_PAD1SIZE\t(_SS_ALIGNSIZE - sizeof(unsigned char) - \\\n\t\t\t    sizeof(sa_family_t))\n#define\t_SS_PAD2SIZE\t(_SS_MAXSIZE - sizeof(unsigned char) - \\\n\t\t\t    sizeof(sa_family_t) - _SS_PAD1SIZE - _SS_ALIGNSIZE)\n\nstruct sockaddr_storage {\n\tunsigned char\tss_len;\t\t/* address length */\n\tsa_family_t\tss_family;\t/* address family */\n\tchar\t\t__ss_pad1[_SS_PAD1SIZE];\n\t__int64_t\t__ss_align;\t/* force desired struct alignment */\n\tchar\t\t__ss_pad2[_SS_PAD2SIZE];\n};\n\n#endif /* !_SYS__SOCKADDR_STORAGE_H_ */\n"
  },
  {
    "path": "freebsd-headers/sys/_stack.h",
    "content": "/*\n * Copyright (c) 2005 Antoine Brodin\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/sys/_stack.h 177957 2008-04-06 20:08:51Z attilio $\n */\n\n#ifndef _SYS__STACK_H_\n#define\t_SYS__STACK_H_\n\n#define\tSTACK_MAX\t18\t/* Don't change, stack_ktr relies on this. */\n\nstruct stack {\n\tint\t\tdepth;\n\tvm_offset_t\tpcs[STACK_MAX];\n};\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/sys/_stdint.h",
    "content": "/*-\n * Copyright (c) 2011 David E. O'Brien <obrien@FreeBSD.org>\n * Copyright (c) 2001 Mike Barcroft <mike@FreeBSD.org>\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/sys/_stdint.h 222813 2011-06-07 08:46:13Z attilio $\n */\n\n#ifndef _SYS__STDINT_H_\n#define _SYS__STDINT_H_\n\n#ifndef _INT8_T_DECLARED\ntypedef\t__int8_t\t\tint8_t;\n#define\t_INT8_T_DECLARED\n#endif\n\n#ifndef _INT16_T_DECLARED\ntypedef\t__int16_t\t\tint16_t;\n#define\t_INT16_T_DECLARED\n#endif\n\n#ifndef _INT32_T_DECLARED\ntypedef\t__int32_t\t\tint32_t;\n#define\t_INT32_T_DECLARED\n#endif\n\n#ifndef _INT64_T_DECLARED\ntypedef\t__int64_t\t\tint64_t;\n#define\t_INT64_T_DECLARED\n#endif\n\n#ifndef _UINT8_T_DECLARED\ntypedef\t__uint8_t\t\tuint8_t;\n#define\t_UINT8_T_DECLARED\n#endif\n\n#ifndef _UINT16_T_DECLARED\ntypedef\t__uint16_t\t\tuint16_t;\n#define\t_UINT16_T_DECLARED\n#endif\n\n#ifndef _UINT32_T_DECLARED\ntypedef\t__uint32_t\t\tuint32_t;\n#define\t_UINT32_T_DECLARED\n#endif\n\n#ifndef _UINT64_T_DECLARED\ntypedef\t__uint64_t\t\tuint64_t;\n#define\t_UINT64_T_DECLARED\n#endif\n\n#ifndef _INTPTR_T_DECLARED\ntypedef\t__intptr_t\t\tintptr_t;\n#define\t_INTPTR_T_DECLARED\n#endif\n#ifndef _UINTPTR_T_DECLARED\ntypedef\t__uintptr_t\t\tuintptr_t;\n#define\t_UINTPTR_T_DECLARED\n#endif\n\n#endif /* !_SYS__STDINT_H_ */\n"
  },
  {
    "path": "freebsd-headers/sys/_sx.h",
    "content": "/*-\n * Copyright (c) 2007 Attilio Rao <attilio@freebsd.org>\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice(s), this list of conditions and the following disclaimer as\n *    the first lines of this file unmodified other than the possible \n *    addition of one or more copyright notices.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice(s), this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\n * DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE LIABLE FOR ANY\n * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR\n * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH\n * DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/sys/_sx.h 179025 2008-05-15 20:10:06Z attilio $\n */\n\n#ifndef\t_SYS__SX_H_\n#define\t_SYS__SX_H_\n\n/*\n * Shared/exclusive lock main structure definition.\n */\nstruct sx {\n\tstruct lock_object\tlock_object;\n\tvolatile uintptr_t\tsx_lock;\n};\n\n#endif\t/* !_SYS__SX_H_ */\n"
  },
  {
    "path": "freebsd-headers/sys/_task.h",
    "content": "/*-\n * Copyright (c) 2000 Doug Rabson\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/sys/_task.h 213813 2010-10-13 22:59:04Z mdf $\n */\n\n#ifndef _SYS__TASK_H_\n#define _SYS__TASK_H_\n\n#include <sys/queue.h>\n\n/*\n * Each task includes a function which is called from\n * taskqueue_run().  The first argument is taken from the 'ta_context'\n * field of struct task and the second argument is a count of how many\n * times the task was enqueued before the call to taskqueue_run().\n *\n * List of locks\t \n * (c)\tconst after init\t \n * (q)\ttaskqueue lock\n */\ntypedef void task_fn_t(void *context, int pending);\n\nstruct task {\n\tSTAILQ_ENTRY(task) ta_link;\t/* (q) link for queue */\n\tu_short\tta_pending;\t\t/* (q) count times queued */\n\tu_short\tta_priority;\t\t/* (c) Priority */\n\ttask_fn_t *ta_func;\t\t/* (c) task handler */\n\tvoid\t*ta_context;\t\t/* (c) argument for handler */\n};\n\n#endif /* !_SYS__TASK_H_ */\n"
  },
  {
    "path": "freebsd-headers/sys/_termios.h",
    "content": "/*-\n * Copyright (c) 1988, 1989, 1993, 1994\n *\tThe Regents of the University of California.  All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 4. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t@(#)termios.h\t8.3 (Berkeley) 3/28/94\n * $FreeBSD: release/9.0.0/sys/sys/_termios.h 199898 2009-11-28 23:50:48Z ed $\n */\n\n#ifndef _SYS__TERMIOS_H_\n#define\t_SYS__TERMIOS_H_\n\n/*\n * Special Control Characters\n *\n * Index into c_cc[] character array.\n *\n *\tName\t     Subscript\tEnabled by\n */\n#define\tVEOF\t\t0\t/* ICANON */\n#define\tVEOL\t\t1\t/* ICANON */\n#ifndef _POSIX_SOURCE\n#define\tVEOL2\t\t2\t/* ICANON together with IEXTEN */\n#endif\n#define\tVERASE\t\t3\t/* ICANON */\n#ifndef _POSIX_SOURCE\n#define\tVWERASE \t4\t/* ICANON together with IEXTEN */\n#endif\n#define\tVKILL\t\t5\t/* ICANON */\n#ifndef _POSIX_SOURCE\n#define\tVREPRINT \t6\t/* ICANON together with IEXTEN */\n#define\tVERASE2 \t7\t/* ICANON */\n#endif\n/*\t\t\t7\t   ex-spare 1 */\n#define\tVINTR\t\t8\t/* ISIG */\n#define\tVQUIT\t\t9\t/* ISIG */\n#define\tVSUSP\t\t10\t/* ISIG */\n#ifndef _POSIX_SOURCE\n#define\tVDSUSP\t\t11\t/* ISIG together with IEXTEN */\n#endif\n#define\tVSTART\t\t12\t/* IXON, IXOFF */\n#define\tVSTOP\t\t13\t/* IXON, IXOFF */\n#ifndef _POSIX_SOURCE\n#define\tVLNEXT\t\t14\t/* IEXTEN */\n#define\tVDISCARD\t15\t/* IEXTEN */\n#endif\n#define\tVMIN\t\t16\t/* !ICANON */\n#define\tVTIME\t\t17\t/* !ICANON */\n#ifndef _POSIX_SOURCE\n#define\tVSTATUS\t\t18\t/* ICANON together with IEXTEN */\n/*\t\t\t19\t   spare 2 */\n#endif\n#define\tNCCS\t\t20\n\n#define\t_POSIX_VDISABLE\t0xff\n\n/*\n * Input flags - software input processing\n */\n#define\tIGNBRK\t\t0x00000001\t/* ignore BREAK condition */\n#define\tBRKINT\t\t0x00000002\t/* map BREAK to SIGINTR */\n#define\tIGNPAR\t\t0x00000004\t/* ignore (discard) parity errors */\n#define\tPARMRK\t\t0x00000008\t/* mark parity and framing errors */\n#define\tINPCK\t\t0x00000010\t/* enable checking of parity errors */\n#define\tISTRIP\t\t0x00000020\t/* strip 8th bit off chars */\n#define\tINLCR\t\t0x00000040\t/* map NL into CR */\n#define\tIGNCR\t\t0x00000080\t/* ignore CR */\n#define\tICRNL\t\t0x00000100\t/* map CR to NL (ala CRMOD) */\n#define\tIXON\t\t0x00000200\t/* enable output flow control */\n#define\tIXOFF\t\t0x00000400\t/* enable input flow control */\n#ifndef _POSIX_SOURCE\n#define\tIXANY\t\t0x00000800\t/* any char will restart after stop */\n#define\tIMAXBEL\t\t0x00002000\t/* ring bell on input queue full */\n#endif  /*_POSIX_SOURCE */\n\n/*\n * Output flags - software output processing\n */\n#define\tOPOST\t\t0x00000001\t/* enable following output processing */\n#ifndef _POSIX_SOURCE\n#define\tONLCR\t\t0x00000002\t/* map NL to CR-NL (ala CRMOD) */\n#define\tTABDLY\t\t0x00000004\t/* tab delay mask */\n#define\t    TAB0\t    0x00000000\t    /* no tab delay and expansion */\n#define\t    TAB3\t    0x00000004\t    /* expand tabs to spaces */\n#define\tONOEOT\t\t0x00000008\t/* discard EOT's (^D) on output) */\n#define\tOCRNL\t\t0x00000010\t/* map CR to NL on output */\n#define\tONOCR\t\t0x00000020\t/* no CR output at column 0 */\n#define\tONLRET\t\t0x00000040\t/* NL performs CR function */\n#endif  /*_POSIX_SOURCE */\n\n/*\n * Control flags - hardware control of terminal\n */\n#ifndef _POSIX_SOURCE\n#define\tCIGNORE\t\t0x00000001\t/* ignore control flags */\n#endif\n#define\tCSIZE\t\t0x00000300\t/* character size mask */\n#define\t    CS5\t\t    0x00000000\t    /* 5 bits (pseudo) */\n#define\t    CS6\t\t    0x00000100\t    /* 6 bits */\n#define\t    CS7\t\t    0x00000200\t    /* 7 bits */\n#define\t    CS8\t\t    0x00000300\t    /* 8 bits */\n#define\tCSTOPB\t\t0x00000400\t/* send 2 stop bits */\n#define\tCREAD\t\t0x00000800\t/* enable receiver */\n#define\tPARENB\t\t0x00001000\t/* parity enable */\n#define\tPARODD\t\t0x00002000\t/* odd parity, else even */\n#define\tHUPCL\t\t0x00004000\t/* hang up on last close */\n#define\tCLOCAL\t\t0x00008000\t/* ignore modem status lines */\n#ifndef _POSIX_SOURCE\n#define\tCCTS_OFLOW\t0x00010000\t/* CTS flow control of output */\n#define\tCRTSCTS\t\t(CCTS_OFLOW | CRTS_IFLOW)\n#define\tCRTS_IFLOW\t0x00020000\t/* RTS flow control of input */\n#define\tCDTR_IFLOW\t0x00040000\t/* DTR flow control of input */\n#define\tCDSR_OFLOW\t0x00080000\t/* DSR flow control of output */\n#define\tCCAR_OFLOW\t0x00100000\t/* DCD flow control of output */\n#endif\n\n\n/*\n * \"Local\" flags - dumping ground for other state\n *\n * Warning: some flags in this structure begin with\n * the letter \"I\" and look like they belong in the\n * input flag.\n */\n\n#ifndef _POSIX_SOURCE\n#define\tECHOKE\t\t0x00000001\t/* visual erase for line kill */\n#endif  /*_POSIX_SOURCE */\n#define\tECHOE\t\t0x00000002\t/* visually erase chars */\n#define\tECHOK\t\t0x00000004\t/* echo NL after line kill */\n#define\tECHO\t\t0x00000008\t/* enable echoing */\n#define\tECHONL\t\t0x00000010\t/* echo NL even if ECHO is off */\n#ifndef _POSIX_SOURCE\n#define\tECHOPRT\t\t0x00000020\t/* visual erase mode for hardcopy */\n#define\tECHOCTL  \t0x00000040\t/* echo control chars as ^(Char) */\n#endif  /*_POSIX_SOURCE */\n#define\tISIG\t\t0x00000080\t/* enable signals INTR, QUIT, [D]SUSP */\n#define\tICANON\t\t0x00000100\t/* canonicalize input lines */\n#ifndef _POSIX_SOURCE\n#define\tALTWERASE\t0x00000200\t/* use alternate WERASE algorithm */\n#endif  /*_POSIX_SOURCE */\n#define\tIEXTEN\t\t0x00000400\t/* enable DISCARD and LNEXT */\n#define\tEXTPROC         0x00000800      /* external processing */\n#define\tTOSTOP\t\t0x00400000\t/* stop background jobs from output */\n#ifndef _POSIX_SOURCE\n#define\tFLUSHO\t\t0x00800000\t/* output being flushed (state) */\n#define\tNOKERNINFO\t0x02000000\t/* no kernel output from VSTATUS */\n#define\tPENDIN\t\t0x20000000\t/* XXX retype pending input (state) */\n#endif  /*_POSIX_SOURCE */\n#define\tNOFLSH\t\t0x80000000\t/* don't flush after interrupt */\n\n/*\n * Standard speeds\n */\n#define\tB0\t0\n#define\tB50\t50\n#define\tB75\t75\n#define\tB110\t110\n#define\tB134\t134\n#define\tB150\t150\n#define\tB200\t200\n#define\tB300\t300\n#define\tB600\t600\n#define\tB1200\t1200\n#define\tB1800\t1800\n#define\tB2400\t2400\n#define\tB4800\t4800\n#define\tB9600\t9600\n#define\tB19200\t19200\n#define\tB38400\t38400\n#ifndef _POSIX_SOURCE\n#define\tB7200\t7200\n#define\tB14400\t14400\n#define\tB28800\t28800\n#define\tB57600\t57600\n#define\tB76800\t76800\n#define\tB115200\t115200\n#define\tB230400\t230400\n#define\tB460800\t460800\n#define\tB921600\t921600\n#define\tEXTA\t19200\n#define\tEXTB\t38400\n#endif  /* !_POSIX_SOURCE */\n\ntypedef unsigned int\ttcflag_t;\ntypedef unsigned char\tcc_t;\ntypedef unsigned int\tspeed_t;\n\nstruct termios {\n\ttcflag_t\tc_iflag;\t/* input flags */\n\ttcflag_t\tc_oflag;\t/* output flags */\n\ttcflag_t\tc_cflag;\t/* control flags */\n\ttcflag_t\tc_lflag;\t/* local flags */\n\tcc_t\t\tc_cc[NCCS];\t/* control chars */\n\tspeed_t\t\tc_ispeed;\t/* input speed */\n\tspeed_t\t\tc_ospeed;\t/* output speed */\n};\n\n#endif /* !_SYS__TERMIOS_H_ */\n"
  },
  {
    "path": "freebsd-headers/sys/_timespec.h",
    "content": "/*-\n * Copyright (c) 1982, 1986, 1993\n *\tThe Regents of the University of California.  All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 4. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t@(#)time.h\t8.5 (Berkeley) 5/4/95\n * from: FreeBSD: src/sys/sys/time.h,v 1.43 2000/03/20 14:09:05 phk Exp\n *\t$FreeBSD: release/9.0.0/sys/sys/_timespec.h 205792 2010-03-28 13:13:22Z ed $\n */\n\n#ifndef _SYS__TIMESPEC_H_\n#define\t_SYS__TIMESPEC_H_\n\n#include <sys/_types.h>\n\n#ifndef _TIME_T_DECLARED\ntypedef\t__time_t\ttime_t;\n#define\t_TIME_T_DECLARED\n#endif\n\nstruct timespec {\n\ttime_t\ttv_sec;\t\t/* seconds */\n\tlong\ttv_nsec;\t/* and nanoseconds */\n};\n\n#endif /* !_SYS__TIMESPEC_H_ */\n"
  },
  {
    "path": "freebsd-headers/sys/_timeval.h",
    "content": "/*-\n * Copyright (c) 2002 Mike Barcroft <mike@FreeBSD.org>\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/sys/_timeval.h 158471 2006-05-12 05:04:46Z jhb $\n */\n\n#ifndef _SYS__TIMEVAL_H_\n#define _SYS__TIMEVAL_H_\n\n#include <sys/_types.h>\n\n#ifndef _SUSECONDS_T_DECLARED\ntypedef\t__suseconds_t\tsuseconds_t;\n#define\t_SUSECONDS_T_DECLARED\n#endif\n\n#ifndef _TIME_T_DECLARED\ntypedef\t__time_t\ttime_t;\n#define\t_TIME_T_DECLARED\n#endif\n\n/*\n * Structure returned by gettimeofday(2) system call, and used in other calls.\n */\nstruct timeval {\n\ttime_t\t\ttv_sec;\t\t/* seconds */\n\tsuseconds_t\ttv_usec;\t/* and microseconds */\n};\n\n#endif /* !_SYS__TIMEVAL_H_ */\n"
  },
  {
    "path": "freebsd-headers/sys/_types.h",
    "content": "/*-\n * Copyright (c) 2002 Mike Barcroft <mike@FreeBSD.org>\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/sys/_types.h 223710 2011-07-01 12:13:48Z jonathan $\n */\n\n#ifndef _SYS__TYPES_H_\n#define _SYS__TYPES_H_\n\n#include <sys/cdefs.h>\n#include <machine/_types.h>\n\n/*\n * Standard type definitions.\n */\ntypedef\t__uint32_t\t__blksize_t;\t/* file block size */\ntypedef\t__int64_t\t__blkcnt_t;\t/* file block count */\ntypedef\t__int32_t\t__clockid_t;\t/* clock_gettime()... */\ntypedef\t__uint64_t\t__cap_rights_t;\t/* capability rights */\ntypedef\t__uint32_t\t__fflags_t;\t/* file flags */\ntypedef\t__uint64_t\t__fsblkcnt_t;\ntypedef\t__uint64_t\t__fsfilcnt_t;\ntypedef\t__uint32_t\t__gid_t;\ntypedef\t__int64_t\t__id_t;\t\t/* can hold a gid_t, pid_t, or uid_t */\ntypedef\t__uint32_t\t__ino_t;\t/* inode number */\ntypedef\tlong\t\t__key_t;\t/* IPC key (for Sys V IPC) */\ntypedef\t__int32_t\t__lwpid_t;\t/* Thread ID (a.k.a. LWP) */\ntypedef\t__uint16_t\t__mode_t;\t/* permissions */\ntypedef\tint\t\t__accmode_t;\t/* access permissions */\ntypedef\tint\t\t__nl_item;\ntypedef\t__uint16_t\t__nlink_t;\t/* link count */\ntypedef\t__int64_t\t__off_t;\t/* file offset */\ntypedef\t__int32_t\t__pid_t;\t/* process [group] */\ntypedef\t__int64_t\t__rlim_t;\t/* resource limit - intentionally */\n\t\t\t\t\t/* signed, because of legacy code */\n\t\t\t\t\t/* that uses -1 for RLIM_INFINITY */\ntypedef\t__uint8_t\t__sa_family_t;\ntypedef\t__uint32_t\t__socklen_t;\ntypedef\tlong\t\t__suseconds_t;\t/* microseconds (signed) */\ntypedef\tstruct __timer\t*__timer_t;\t/* timer_gettime()... */\ntypedef\tstruct __mq\t*__mqd_t;\t/* mq_open()... */\ntypedef\t__uint32_t\t__uid_t;\ntypedef\tunsigned int\t__useconds_t;\t/* microseconds (unsigned) */\ntypedef\tint\t\t__cpuwhich_t;\t/* which parameter for cpuset. */\ntypedef\tint\t\t__cpulevel_t;\t/* level parameter for cpuset. */\ntypedef int\t\t__cpusetid_t;\t/* cpuset identifier. */\n\n/*\n * Unusual type definitions.\n */\n/*\n * rune_t is declared to be an ``int'' instead of the more natural\n * ``unsigned long'' or ``long''.  Two things are happening here.  It is not\n * unsigned so that EOF (-1) can be naturally assigned to it and used.  Also,\n * it looks like 10646 will be a 31 bit standard.  This means that if your\n * ints cannot hold 32 bits, you will be in trouble.  The reason an int was\n * chosen over a long is that the is*() and to*() routines take ints (says\n * ANSI C), but they use __ct_rune_t instead of int.\n *\n * NOTE: rune_t is not covered by ANSI nor other standards, and should not\n * be instantiated outside of lib/libc/locale.  Use wchar_t.  wchar_t and\n * rune_t must be the same type.  Also, wint_t must be no narrower than\n * wchar_t, and should be able to hold all members of the largest\n * character set plus one extra value (WEOF), and must be at least 16 bits.\n */\ntypedef\tint\t\t__ct_rune_t;\t/* arg type for ctype funcs */\ntypedef\t__ct_rune_t\t__rune_t;\t/* rune_t (see above) */\ntypedef\t__ct_rune_t\t__wchar_t;\t/* wchar_t (see above) */\ntypedef\t__ct_rune_t\t__wint_t;\t/* wint_t (see above) */\n\ntypedef\t__uint32_t\t__dev_t;\t/* device number */\n\ntypedef\t__uint32_t\t__fixpt_t;\t/* fixed point number */\n\n/*\n * mbstate_t is an opaque object to keep conversion state during multibyte\n * stream conversions.\n */\ntypedef union {\n\tchar\t\t__mbstate8[128];\n\t__int64_t\t_mbstateL;\t/* for alignment */\n} __mbstate_t;\n\n#endif /* !_SYS__TYPES_H_ */\n"
  },
  {
    "path": "freebsd-headers/sys/_umtx.h",
    "content": "/*-\n * Copyright (c) 2010, David Xu <davidxu@freebsd.org>\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice unmodified, this list of conditions, and the following\n *    disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR\n * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES\n * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,\n * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF\n * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/sys/_umtx.h 216641 2010-12-22 05:01:52Z davidxu $\n *\n */\n\n#ifndef _SYS__UMTX_H_\n#define\t_SYS__UMTX_H_\n\n#include <sys/_types.h>\n\nstruct umtx {\n\tvolatile unsigned long\tu_owner;\t/* Owner of the mutex. */\n};\n\nstruct umutex {\n\tvolatile __lwpid_t\tm_owner;\t/* Owner of the mutex */\n\t__uint32_t\t\tm_flags;\t/* Flags of the mutex */\n\t__uint32_t\t\tm_ceilings[2];\t/* Priority protect ceiling */\n\t__uint32_t\t\tm_spare[4];\n};\n\nstruct ucond {\n\tvolatile __uint32_t\tc_has_waiters;\t/* Has waiters in kernel */\n\t__uint32_t\t\tc_flags;\t/* Flags of the condition variable */\n\t__uint32_t              c_clockid;\t/* Clock id */\n\t__uint32_t              c_spare[1];\t/* Spare space */\n};\n\nstruct urwlock {\n\tvolatile __int32_t\trw_state;\n\t__uint32_t\t\trw_flags;\n\t__uint32_t\t\trw_blocked_readers;\n\t__uint32_t\t\trw_blocked_writers;\n\t__uint32_t\t\trw_spare[4];\n};\n\nstruct _usem {\n\tvolatile __uint32_t\t_has_waiters;\n\tvolatile __uint32_t\t_count;\n\t__uint32_t\t\t_flags;\n};\n\n#endif /* !_SYS__UMTX_H_ */\n"
  },
  {
    "path": "freebsd-headers/sys/aac_ioctl.h",
    "content": "/*-\n * Copyright (c) 2000 Michael Smith\n * Copyright (c) 2000 Scott Long\n * Copyright (c) 2000 BSDi\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t$FreeBSD: release/9.0.0/sys/sys/aac_ioctl.h 218909 2011-02-21 09:01:34Z brucec $\n */\n\n/*\n * Command queue statistics\n */\n#define AACQ_FREE\t0\n#define AACQ_BIO\t1\n#define AACQ_READY\t2\n#define AACQ_BUSY\t3\n#define AACQ_COUNT\t4\t/* total number of queues */\n\nstruct aac_qstat {\n\tu_int32_t\tq_length;\n\tu_int32_t\tq_max;\n};\n\n/*\n * Statistics request\n */\nunion aac_statrequest {\n\tu_int32_t\t\tas_item;\n\tstruct aac_qstat\tas_qstat;\n};\n\n#define AACIO_STATS\t\t_IOWR('T', 101, union aac_statrequest)\n\n/*\n * Ioctl commands likely to be submitted from a Linux management application.\n * These bit encodings are actually descended from Windows NT.  Ick.\n */\n\n#define CTL_CODE(devType, func, meth, acc) (((devType) << 16) | ((acc) << 14) | ((func) << 2) | (meth))\n#define METHOD_BUFFERED                 0\n#define METHOD_IN_DIRECT                1\n#define METHOD_OUT_DIRECT               2\n#define METHOD_NEITHER                  3\n#define FILE_ANY_ACCESS                 0\n#define FILE_READ_ACCESS          \t( 0x0001 )\n#define FILE_WRITE_ACCESS         \t( 0x0002 )\n#define FILE_DEVICE_CONTROLLER          0x00000004\n\n#define FSACTL_LNX_SENDFIB\t\tCTL_CODE(FILE_DEVICE_CONTROLLER, 2050, \\\n\t\t\t\t\tMETHOD_BUFFERED, FILE_ANY_ACCESS)\n#define FSACTL_LNX_SEND_RAW_SRB\t\tCTL_CODE(FILE_DEVICE_CONTROLLER, 2067, \\\n\t\t\t\t\tMETHOD_BUFFERED, FILE_ANY_ACCESS)\n#define FSACTL_LNX_GET_COMM_PERF_DATA\tCTL_CODE(FILE_DEVICE_CONTROLLER, 2084, \\\n\t\t\t\t\tMETHOD_BUFFERED, FILE_ANY_ACCESS)\n#define FSACTL_LNX_OPENCLS_COMM_PERF_DATA CTL_CODE(FILE_DEVICE_CONTROLLER, \\\n\t\t\t\t\t2085, METHOD_BUFFERED, FILE_ANY_ACCESS)\n#define FSACTL_LNX_OPEN_GET_ADAPTER_FIB\tCTL_CODE(FILE_DEVICE_CONTROLLER, 2100, \\\n\t\t\t\t\tMETHOD_BUFFERED, FILE_ANY_ACCESS)\n#define FSACTL_LNX_GET_NEXT_ADAPTER_FIB\tCTL_CODE(FILE_DEVICE_CONTROLLER, 2101, \\\n\t\t\t\t\tMETHOD_BUFFERED, FILE_ANY_ACCESS)\n#define FSACTL_LNX_CLOSE_GET_ADAPTER_FIB CTL_CODE(FILE_DEVICE_CONTROLLER, \\\n\t\t\t\t\t2102, METHOD_BUFFERED, FILE_ANY_ACCESS)\n#define FSACTL_LNX_CLOSE_ADAPTER_CONFIG\tCTL_CODE(FILE_DEVICE_CONTROLLER, 2104, \\\n\t\t\t\t\tMETHOD_BUFFERED, FILE_ANY_ACCESS)\n#define FSACTL_LNX_OPEN_ADAPTER_CONFIG\tCTL_CODE(FILE_DEVICE_CONTROLLER, 2105, \\\n\t\t\t\t\tMETHOD_BUFFERED, FILE_ANY_ACCESS)\n#define FSACTL_LNX_MINIPORT_REV_CHECK\tCTL_CODE(FILE_DEVICE_CONTROLLER, 2107, \\\n\t\t\t\t\tMETHOD_BUFFERED, FILE_ANY_ACCESS)\n#define FSACTL_LNX_QUERY_ADAPTER_CONFIG\tCTL_CODE(FILE_DEVICE_CONTROLLER, 2113, \\\n\t\t\t\t\tMETHOD_BUFFERED, FILE_ANY_ACCESS)\n#define FSACTL_LNX_GET_PCI_INFO\t\tCTL_CODE(FILE_DEVICE_CONTROLLER, 2119, \\\n\t\t\t\t\tMETHOD_BUFFERED, FILE_ANY_ACCESS)\n#define FSACTL_LNX_FORCE_DELETE_DISK\tCTL_CODE(FILE_DEVICE_CONTROLLER, 2120, \\\n\t\t\t\t\tMETHOD_NEITHER, FILE_ANY_ACCESS)\n#define FSACTL_LNX_AIF_THREAD\t\tCTL_CODE(FILE_DEVICE_CONTROLLER, 2127, \\\n\t\t\t\t\tMETHOD_NEITHER, FILE_ANY_ACCESS)\n#define FSACTL_LNX_SEND_LARGE_FIB\tCTL_CODE(FILE_DEVICE_CONTROLLER, 2138, \\\n\t\t\t\t\tMETHOD_BUFFERED, FILE_ANY_ACCESS)\n#define\tFSACTL_LNX_GET_FEATURES\t\tCTL_CODE(FILE_DEVICE_CONTROLLER, 2139, \\\n\t\t\t\t\tMETHOD_BUFFERED, FILE_ANY_ACCESS)\n\n/* Why these don't follow the previous convention, I don't know */\n#define FSACTL_LNX_NULL_IO_TEST\t\t0x43\n#define FSACTL_LNX_SIM_IO_TEST\t\t0x53\n#define FSACTL_LNX_DOWNLOAD\t\t0x83\n#define FSACTL_LNX_GET_VAR\t\t0x93\n#define FSACTL_LNX_SET_VAR\t\t0xa3\n#define FSACTL_LNX_GET_FIBTIMES\t\t0xb3\n#define FSACTL_LNX_ZERO_FIBTIMES\t0xc3\n#define FSACTL_LNX_DELETE_DISK\t\t0x163\n#define FSACTL_LNX_QUERY_DISK\t\t0x173\n\n/* Ok, here it gets really lame */\n#define FSACTL_LNX_PROBE_CONTAINERS\t2131\t/* Just guessing */\n\n/* Do the native version of the ioctls.  Since the BSD encoding scheme\n * conflicts with the 'standard' AAC encoding scheme, the resulting numbers\n * will be different.  The '8' comes from the fact that the previous scheme\n * used 12 bits for the number, with the 12th bit being the only set\n * bit above bit 8.  Thus the value of 8, with the lower 8 bits holding the\n * command number.  9 is used for the odd overflow case.\n */\n#define FSACTL_SENDFIB\t\t\t_IO('8', 2)\n#define FSACTL_SEND_RAW_SRB\t\t_IO('8', 19)\n#define FSACTL_GET_COMM_PERF_DATA\t_IO('8', 36)\n#define FSACTL_OPENCLS_COMM_PERF_DATA\t_IO('8', 37)\n#define FSACTL_OPEN_GET_ADAPTER_FIB\t_IO('8', 52)\n#define FSACTL_GET_NEXT_ADAPTER_FIB\t_IO('8', 53)\n#define FSACTL_CLOSE_GET_ADAPTER_FIB\t_IO('8', 54)\n#define FSACTL_CLOSE_ADAPTER_CONFIG\t_IO('8', 56)\n#define FSACTL_OPEN_ADAPTER_CONFIG\t_IO('8', 57)\n#define FSACTL_MINIPORT_REV_CHECK\t_IO('8', 59)\n#define FSACTL_QUERY_ADAPTER_CONFIG\t_IO('8', 65)\n#define FSACTL_GET_PCI_INFO\t\t_IO('8', 71)\n#define FSACTL_FORCE_DELETE_DISK\t_IO('8', 72)\n#define FSACTL_AIF_THREAD\t\t_IO('8', 79)\n#define FSACTL_SEND_LARGE_FIB\t\t_IO('8', 90)\n#define\tFSACTL_GET_FEATURES\t\t_IO('8', 91)\n\n#define FSACTL_NULL_IO_TEST\t\t_IO('8', 67)\n#define FSACTL_SIM_IO_TEST\t\t_IO('8', 83)\n#define FSACTL_DOWNLOAD\t\t\t_IO('8', 131)\n#define FSACTL_GET_VAR\t\t\t_IO('8', 147)\n#define FSACTL_SET_VAR\t\t\t_IO('8', 163)\n#define FSACTL_GET_FIBTIMES\t\t_IO('8', 179)\n#define FSACTL_ZERO_FIBTIMES\t\t_IO('8', 195)\n#define FSACTL_DELETE_DISK\t\t_IO('8', 99)\n#define FSACTL_QUERY_DISK\t\t_IO('9', 115)\n\n#define FSACTL_PROBE_CONTAINERS\t\t_IO('9', 83)\t/* Just guessing */\n\n#ifdef _KERNEL\n/*\n * Support for faking the \"miniport\" version.\n */\nstruct aac_rev_check {\n\tRevComponent\t\tcallingComponent;\n\tstruct FsaRevision\tcallingRevision;\n};\n\nstruct aac_rev_check_resp {\n\tint\t\t\tpossiblyCompatible;\n\tstruct FsaRevision\tadapterSWRevision;\n};\n\n/*\n * Context passed in by a consumer looking to collect an AIF.\n */\nstruct get_adapter_fib_ioctl {\n\tu_int32_t\tAdapterFibContext;\n\tint\t  \tWait;\n\tcaddr_t\t\tAifFib;\n};\n\nstruct aac_query_disk {\n\tint32_t\t\tContainerNumber;\n\tint32_t\t\tBus;\n\tint32_t\t\tTarget;\n\tint32_t\t\tLun;\n\tu_int32_t\tValid;\n\tu_int32_t\tLocked;\n\tu_int32_t\tDeleted;\n\tint32_t\t\tInstance;\n\tchar\t\tdiskDeviceName[10];\n\tu_int32_t\tUnMapped;\n};\n\n/* Features, asked from the tools to know if the driver\n * supports drives >2TB\n */\ntypedef union {\n\tstruct {\n\t\tu_int32_t largeLBA  : 1;\t/* disk support greater 2TB */\n\t\tu_int32_t IoctlBuf  : 1;\t/* ARCIOCTL call support */\n\t\tu_int32_t AIFSupport: 1;\t/* AIF support */\n\t\tu_int32_t JBODSupport:1;\t/* fw + driver support JBOD */\n\t\tu_int32_t fReserved : 28;\n\t} fBits;\n\tu_int32_t fValue;\n} featuresState;\n\nstruct aac_features {\n\tfeaturesState feat;\n\tu_int32_t data[31];\n\tu_int32_t reserved[32];\n} __packed;\n#endif\n"
  },
  {
    "path": "freebsd-headers/sys/acct.h",
    "content": "/*-\n * Copyright (c) 1990, 1993, 1994\n *\tThe Regents of the University of California.  All rights reserved.\n * (c) UNIX System Laboratories, Inc.\n * All or some portions of this file are derived from material licensed\n * to the University of California by American Telephone and Telegraph\n * Co. or Unix System Laboratories, Inc. and are reproduced herein with\n * the permission of UNIX System Laboratories, Inc.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 4. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t@(#)acct.h\t8.4 (Berkeley) 1/9/95\n * $FreeBSD: release/9.0.0/sys/sys/acct.h 169857 2007-05-22 06:51:38Z dds $\n */\n\n#ifndef _SYS_ACCT_H_\n#define _SYS_ACCT_H_\n\n#ifdef _KERNEL\n#define float uint32_t\n#endif\n\n#define AC_COMM_LEN 16\n\n/*\n * Accounting structure version 2 (current).\n * The first byte is always zero.\n * Time units are microseconds.\n */\n\nstruct acctv2 {\n\tuint8_t   ac_zero;\t\t/* zero identifies new version */\n\tuint8_t   ac_version;\t\t/* record version number */\n\tuint16_t  ac_len;\t\t/* record length */\n\n\tchar\t  ac_comm[AC_COMM_LEN];\t/* command name */\n\tfloat\t  ac_utime;\t\t/* user time */\n\tfloat\t  ac_stime;\t\t/* system time */\n\tfloat\t  ac_etime;\t\t/* elapsed time */\n\ttime_t\t  ac_btime;\t\t/* starting time */\n\tuid_t\t  ac_uid;\t\t/* user id */\n\tgid_t\t  ac_gid;\t\t/* group id */\n\tfloat\t  ac_mem;\t\t/* average memory usage */\n\tfloat\t  ac_io;\t\t/* count of IO blocks */\n\t__dev_t   ac_tty;\t\t/* controlling tty */\n\n\tuint16_t  ac_len2;\t\t/* record length */\n\tunion {\n\t\t__dev_t\t  ac_align;\t/* force v1 compatible alignment */\n\n#define\tAFORK\t0x01\t\t\t/* forked but not exec'ed */\n/* ASU is no longer supported */\n#define\tASU\t0x02\t\t\t/* used super-user permissions */\n#define\tACOMPAT\t0x04\t\t\t/* used compatibility mode */\n#define\tACORE\t0x08\t\t\t/* dumped core */\n#define\tAXSIG\t0x10\t\t\t/* killed by a signal */\n#define ANVER\t0x20\t\t\t/* new record version */\n\n\t\tuint8_t   ac_flag;\t/* accounting flags */\n\t} ac_trailer;\n\n#define ac_flagx ac_trailer.ac_flag\n};\n\n\n/*\n * Legacy accounting structure (rev. 1.5-1.18).\n * The first byte is always non-zero.\n * Some fields use a comp_t type which is a 3 bits base 8\n * exponent, 13 bit fraction ``floating point'' number.\n * Units are 1/AHZV1 seconds.\n */\n\ntypedef uint16_t comp_t;\n\nstruct acctv1 {\n\tchar\t  ac_comm[AC_COMM_LEN];\t/* command name */\n\tcomp_t\t  ac_utime;\t\t/* user time */\n\tcomp_t\t  ac_stime;\t\t/* system time */\n\tcomp_t\t  ac_etime;\t\t/* elapsed time */\n\ttime_t\t  ac_btime;\t\t/* starting time */\n\tuid_t\t  ac_uid;\t\t/* user id */\n\tgid_t\t  ac_gid;\t\t/* group id */\n\tuint16_t  ac_mem;\t\t/* average memory usage */\n\tcomp_t\t  ac_io;\t\t/* count of IO blocks */\n\t__dev_t   ac_tty;\t\t/* controlling tty */\n\tuint8_t   ac_flag;\t\t/* accounting flags */\n};\n\n/*\n * 1/AHZV1 is the granularity of the data encoded in the comp_t fields.\n * This is not necessarily equal to hz.\n */\n#define\tAHZV1\t64\n\n#ifdef _KERNEL\nstruct thread;\n\nint\tacct_process(struct thread *td);\n#undef float\n#endif\n\n#endif /* !_SYS_ACCT_H_ */\n"
  },
  {
    "path": "freebsd-headers/sys/acl.h",
    "content": "/*-\n * Copyright (c) 1999-2001 Robert N. M. Watson\n * Copyright (c) 2008 Edward Tomasz Napierała <trasz@FreeBSD.org>\n * All rights reserved.\n *\n * This software was developed by Robert Watson for the TrustedBSD Project.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/sys/acl.h 220465 2011-04-09 07:42:25Z trasz $\n */\n/* \n * Developed by the TrustedBSD Project.\n * Support for POSIX.1e and NFSv4 access control lists.\n */\n\n#ifndef _SYS_ACL_H_\n#define\t_SYS_ACL_H_\n\n#include <sys/param.h>\n#include <sys/queue.h>\n#include <vm/uma.h>\n\n/*\n * POSIX.1e and NFSv4 ACL types and related constants.\n */\n\ntypedef uint32_t\tacl_tag_t;\ntypedef uint32_t\tacl_perm_t;\ntypedef uint16_t\tacl_entry_type_t;\ntypedef uint16_t\tacl_flag_t;\ntypedef int\t\tacl_type_t;\ntypedef int\t\t*acl_permset_t;\ntypedef uint16_t\t*acl_flagset_t;\n\n/*\n * With 254 entries, \"struct acl_t_struct\" is exactly one 4kB page big.\n * Note that with NFSv4 ACLs, the maximum number of ACL entries one\n * may set on file or directory is about half of ACL_MAX_ENTRIES.\n *\n * If you increase this, you might also need to increase\n * _ACL_T_ALIGNMENT_BITS in lib/libc/posix1e/acl_support.h.\n *\n * The maximum number of POSIX.1e ACLs is controlled\n * by OLDACL_MAX_ENTRIES.  Changing that one will break binary\n * compatibility with pre-8.0 userland and change on-disk ACL layout.\n */\n#define\tACL_MAX_ENTRIES\t\t\t\t254\n\n#if defined(_KERNEL) || defined(_ACL_PRIVATE)\n\n#define\tPOSIX1E_ACL_ACCESS_EXTATTR_NAMESPACE\tEXTATTR_NAMESPACE_SYSTEM\n#define\tPOSIX1E_ACL_ACCESS_EXTATTR_NAME\t\t\"posix1e.acl_access\"\n#define\tPOSIX1E_ACL_DEFAULT_EXTATTR_NAMESPACE\tEXTATTR_NAMESPACE_SYSTEM\n#define\tPOSIX1E_ACL_DEFAULT_EXTATTR_NAME\t\"posix1e.acl_default\"\n#define\tNFS4_ACL_EXTATTR_NAMESPACE\t\tEXTATTR_NAMESPACE_SYSTEM\n#define\tNFS4_ACL_EXTATTR_NAME\t\t\t\"nfs4.acl\"\n#define\tOLDACL_MAX_ENTRIES\t\t\t32\n\n/*\n * \"struct oldacl\" is used in compatibility ACL syscalls and for on-disk\n * storage of POSIX.1e ACLs.\n */\ntypedef int\toldacl_tag_t;\ntypedef mode_t\toldacl_perm_t;\n\nstruct oldacl_entry {\n\toldacl_tag_t\tae_tag;\n\tuid_t\t\tae_id;\n\toldacl_perm_t\tae_perm;\n};\ntypedef struct oldacl_entry\t*oldacl_entry_t;\n\nstruct oldacl {\n\tint\t\t\tacl_cnt;\n\tstruct oldacl_entry\tacl_entry[OLDACL_MAX_ENTRIES];\n};\n\n/*\n * Current \"struct acl\".\n */\nstruct acl_entry {\n\tacl_tag_t\t\tae_tag;\n\tuid_t\t\t\tae_id;\n\tacl_perm_t\t\tae_perm;\n\t/* NFSv4 entry type, \"allow\" or \"deny\".  Unused in POSIX.1e ACLs. */\n\tacl_entry_type_t\tae_entry_type;\n\t/* NFSv4 ACL inheritance.  Unused in POSIX.1e ACLs. */\n\tacl_flag_t\t\tae_flags;\n};\ntypedef struct acl_entry\t*acl_entry_t;\n\n/*\n * Internal ACL structure, used in libc, kernel APIs and for on-disk\n * storage of NFSv4 ACLs.  POSIX.1e ACLs use \"struct oldacl\" for on-disk\n * storage.\n */\nstruct acl {\n\tunsigned int\t\tacl_maxcnt;\n\tunsigned int\t\tacl_cnt;\n\t/* Will be required e.g. to implement NFSv4.1 ACL inheritance. */\n\tint\t\t\tacl_spare[4];\n\tstruct acl_entry\tacl_entry[ACL_MAX_ENTRIES];\n};\n\n/*\n * ACL structure internal to libc.\n */\nstruct acl_t_struct {\n\tstruct acl\t\tats_acl;\n\tint\t\t\tats_cur_entry;\n\t/*\n\t * ats_brand is for libc internal bookkeeping only.\n\t * Applications should use acl_get_brand_np(3).\n\t * Kernel code should use the \"type\" argument passed\n\t * to VOP_SETACL, VOP_GETACL or VOP_ACLCHECK calls;\n\t * ACL_TYPE_ACCESS or ACL_TYPE_DEFAULT mean POSIX.1e\n\t * ACL, ACL_TYPE_NFS4 means NFSv4 ACL.\n\t */\n\tint\t\t\tats_brand;\n};\ntypedef struct acl_t_struct *acl_t;\n\n#else /* _KERNEL || _ACL_PRIVATE */\n\ntypedef void *acl_entry_t;\ntypedef void *acl_t;\n\n#endif /* !_KERNEL && !_ACL_PRIVATE */\n\n/*\n * Possible valid values for ats_brand field.\n */\n#define\tACL_BRAND_UNKNOWN\t0\n#define\tACL_BRAND_POSIX\t\t1\n#define\tACL_BRAND_NFS4\t\t2\n\n/*\n * Possible valid values for ae_tag field.  For explanation, see acl(9).\n */\n#define\tACL_UNDEFINED_TAG\t0x00000000\n#define\tACL_USER_OBJ\t\t0x00000001\n#define\tACL_USER\t\t0x00000002\n#define\tACL_GROUP_OBJ\t\t0x00000004\n#define\tACL_GROUP\t\t0x00000008\n#define\tACL_MASK\t\t0x00000010\n#define\tACL_OTHER\t\t0x00000020\n#define\tACL_OTHER_OBJ\t\tACL_OTHER\n#define\tACL_EVERYONE\t\t0x00000040\n\n/*\n * Possible valid values for ae_entry_type field, valid only for NFSv4 ACLs.\n */\n#define\tACL_ENTRY_TYPE_ALLOW\t0x0100\n#define\tACL_ENTRY_TYPE_DENY\t0x0200\n#define\tACL_ENTRY_TYPE_AUDIT\t0x0400\n#define\tACL_ENTRY_TYPE_ALARM\t0x0800\n\n/*\n * Possible valid values for acl_type_t arguments.  First two\n * are provided only for backwards binary compatibility.\n */\n#define\tACL_TYPE_ACCESS_OLD\t0x00000000\n#define\tACL_TYPE_DEFAULT_OLD\t0x00000001\n#define\tACL_TYPE_ACCESS\t\t0x00000002\n#define\tACL_TYPE_DEFAULT\t0x00000003\n#define\tACL_TYPE_NFS4\t\t0x00000004\n\n/*\n * Possible bits in ae_perm field for POSIX.1e ACLs.  Note\n * that ACL_EXECUTE may be used in both NFSv4 and POSIX.1e ACLs.\n */\n#define\tACL_EXECUTE\t\t0x0001\n#define\tACL_WRITE\t\t0x0002\n#define\tACL_READ\t\t0x0004\n#define\tACL_PERM_NONE\t\t0x0000\n#define\tACL_PERM_BITS\t\t(ACL_EXECUTE | ACL_WRITE | ACL_READ)\n#define\tACL_POSIX1E_BITS\t(ACL_EXECUTE | ACL_WRITE | ACL_READ)\n\n/*\n * Possible bits in ae_perm field for NFSv4 ACLs.\n */\n#define\tACL_READ_DATA\t\t0x00000008\n#define\tACL_LIST_DIRECTORY\t0x00000008\n#define\tACL_WRITE_DATA\t\t0x00000010\n#define\tACL_ADD_FILE\t\t0x00000010\n#define\tACL_APPEND_DATA\t\t0x00000020\n#define\tACL_ADD_SUBDIRECTORY\t0x00000020\n#define\tACL_READ_NAMED_ATTRS\t0x00000040\n#define\tACL_WRITE_NAMED_ATTRS\t0x00000080\n/* ACL_EXECUTE is defined above. */\n#define\tACL_DELETE_CHILD\t0x00000100\n#define\tACL_READ_ATTRIBUTES\t0x00000200\n#define\tACL_WRITE_ATTRIBUTES\t0x00000400\n#define\tACL_DELETE\t\t0x00000800\n#define\tACL_READ_ACL\t\t0x00001000\n#define\tACL_WRITE_ACL\t\t0x00002000\n#define\tACL_WRITE_OWNER\t\t0x00004000\n#define\tACL_SYNCHRONIZE\t\t0x00008000\n\n#define\tACL_FULL_SET\t\t(ACL_READ_DATA | ACL_WRITE_DATA | \\\n    ACL_APPEND_DATA | ACL_READ_NAMED_ATTRS | ACL_WRITE_NAMED_ATTRS | \\\n    ACL_EXECUTE | ACL_DELETE_CHILD | ACL_READ_ATTRIBUTES | \\\n    ACL_WRITE_ATTRIBUTES | ACL_DELETE | ACL_READ_ACL | ACL_WRITE_ACL | \\\n    ACL_WRITE_OWNER | ACL_SYNCHRONIZE)\n\n#define\tACL_MODIFY_SET\t\t(ACL_FULL_SET & \\\n    ~(ACL_WRITE_ACL | ACL_WRITE_OWNER))\n\n#define\tACL_READ_SET\t\t(ACL_READ_DATA | ACL_READ_NAMED_ATTRS | \\\n    ACL_READ_ATTRIBUTES | ACL_READ_ACL)\n\n#define\tACL_WRITE_SET\t\t(ACL_WRITE_DATA | ACL_APPEND_DATA | \\\n    ACL_WRITE_NAMED_ATTRS | ACL_WRITE_ATTRIBUTES)\n\n#define\tACL_NFS4_PERM_BITS\tACL_FULL_SET\n\n/*\n * Possible entry_id values for acl_get_entry(3).\n */\n#define\tACL_FIRST_ENTRY\t\t0\n#define\tACL_NEXT_ENTRY\t\t1\n\n/*\n * Possible values in ae_flags field; valid only for NFSv4 ACLs.\n */\n#define\tACL_ENTRY_FILE_INHERIT\t\t0x0001\n#define\tACL_ENTRY_DIRECTORY_INHERIT\t0x0002\n#define\tACL_ENTRY_NO_PROPAGATE_INHERIT\t0x0004\n#define\tACL_ENTRY_INHERIT_ONLY\t\t0x0008\n#define\tACL_ENTRY_SUCCESSFUL_ACCESS\t0x0010\n#define\tACL_ENTRY_FAILED_ACCESS\t\t0x0020\n\n#define\tACL_FLAGS_BITS\t\t\t(ACL_ENTRY_FILE_INHERIT | \\\n    ACL_ENTRY_DIRECTORY_INHERIT | ACL_ENTRY_NO_PROPAGATE_INHERIT | \\\n    ACL_ENTRY_INHERIT_ONLY | ACL_ENTRY_SUCCESSFUL_ACCESS | \\\n    ACL_ENTRY_FAILED_ACCESS)\n\n/*\n * Undefined value in ae_id field.  ae_id should be set to this value\n * iff ae_tag is ACL_USER_OBJ, ACL_GROUP_OBJ, ACL_OTHER or ACL_EVERYONE.\n */\n#define\tACL_UNDEFINED_ID\t((uid_t)-1)\n\n/*\n * Possible values for _flags parameter in acl_to_text_np(3).\n */\n#define\tACL_TEXT_VERBOSE\t0x01\n#define\tACL_TEXT_NUMERIC_IDS\t0x02\n#define\tACL_TEXT_APPEND_ID\t0x04\n\n/*\n * POSIX.1e ACLs are capable of expressing the read, write, and execute bits\n * of the POSIX mode field.  We provide two masks: one that defines the bits\n * the ACL will replace in the mode, and the other that defines the bits that\n * must be preseved when an ACL is updating a mode.\n */\n#define\tACL_OVERRIDE_MASK\t(S_IRWXU | S_IRWXG | S_IRWXO)\n#define\tACL_PRESERVE_MASK\t(~ACL_OVERRIDE_MASK)\n\n#ifdef _KERNEL\n\n/*\n * Filesystem-independent code to move back and forth between POSIX mode and\n * POSIX.1e ACL representations.\n */\nacl_perm_t\t\tacl_posix1e_mode_to_perm(acl_tag_t tag, mode_t mode);\nstruct acl_entry\tacl_posix1e_mode_to_entry(acl_tag_t tag, uid_t uid,\n\t\t\t    gid_t gid, mode_t mode);\nmode_t\t\t\tacl_posix1e_perms_to_mode(\n\t\t\t    struct acl_entry *acl_user_obj_entry,\n\t\t\t    struct acl_entry *acl_group_obj_entry,\n\t\t\t    struct acl_entry *acl_other_entry);\nmode_t\t\t\tacl_posix1e_acl_to_mode(struct acl *acl);\nmode_t\t\t\tacl_posix1e_newfilemode(mode_t cmode,\n\t\t\t    struct acl *dacl);\nstruct acl\t\t*acl_alloc(int flags);\nvoid\t\t\tacl_free(struct acl *aclp);\n\nvoid\t\t\tacl_nfs4_sync_acl_from_mode(struct acl *aclp,\n\t\t\t    mode_t mode, int file_owner_id);\nvoid\t\t\tacl_nfs4_sync_mode_from_acl(mode_t *mode,\n\t\t\t    const struct acl *aclp);\nint\t\t\tacl_nfs4_is_trivial(const struct acl *aclp,\n\t\t\t    int file_owner_id);\nvoid\t\t\tacl_nfs4_compute_inherited_acl(\n\t\t\t    const struct acl *parent_aclp,\n\t\t\t    struct acl *child_aclp, mode_t mode,\n\t\t\t    int file_owner_id, int is_directory);\nint\t\t\tacl_copy_oldacl_into_acl(const struct oldacl *source,\n\t\t\t    struct acl *dest);\nint\t\t\tacl_copy_acl_into_oldacl(const struct acl *source,\n\t\t\t    struct oldacl *dest);\n\n/*\n * To allocate 'struct acl', use acl_alloc()/acl_free() instead of this.\n */\nMALLOC_DECLARE(M_ACL);\n/*\n * Filesystem-independent syntax check for a POSIX.1e ACL.\n */\nint\t\t\tacl_posix1e_check(struct acl *acl);\nint \t\t\tacl_nfs4_check(const struct acl *aclp, int is_directory);\n\n#else /* !_KERNEL */\n\n#if defined(_ACL_PRIVATE)\n\n/*\n * Syscall interface -- use the library calls instead as the syscalls have\n * strict ACL entry ordering requirements.\n */\n__BEGIN_DECLS\nint\t__acl_aclcheck_fd(int _filedes, acl_type_t _type, struct acl *_aclp);\nint\t__acl_aclcheck_file(const char *_path, acl_type_t _type,\n\t    struct acl *_aclp);\nint\t__acl_aclcheck_link(const char *_path, acl_type_t _type,\n\t    struct acl *_aclp);\nint\t__acl_delete_fd(int _filedes, acl_type_t _type);\nint\t__acl_delete_file(const char *_path_p, acl_type_t _type);\nint\t__acl_delete_link(const char *_path_p, acl_type_t _type);\nint\t__acl_get_fd(int _filedes, acl_type_t _type, struct acl *_aclp);\nint\t__acl_get_file(const char *_path, acl_type_t _type, struct acl *_aclp);\nint\t__acl_get_link(const char *_path, acl_type_t _type, struct acl *_aclp);\nint\t__acl_set_fd(int _filedes, acl_type_t _type, struct acl *_aclp);\nint\t__acl_set_file(const char *_path, acl_type_t _type, struct acl *_aclp);\nint\t__acl_set_link(const char *_path, acl_type_t _type, struct acl *_aclp);\n__END_DECLS\n\n#endif /* _ACL_PRIVATE */\n\n/*\n * Supported POSIX.1e ACL manipulation and assignment/retrieval API _np calls\n * are local extensions that reflect an environment capable of opening file\n * descriptors of directories, and allowing additional ACL type for different\n * filesystems (i.e., AFS).\n */\n__BEGIN_DECLS\nint\tacl_add_flag_np(acl_flagset_t _flagset_d, acl_flag_t _flag);\nint\tacl_add_perm(acl_permset_t _permset_d, acl_perm_t _perm);\nint\tacl_calc_mask(acl_t *_acl_p);\nint\tacl_clear_flags_np(acl_flagset_t _flagset_d);\nint\tacl_clear_perms(acl_permset_t _permset_d);\nint\tacl_copy_entry(acl_entry_t _dest_d, acl_entry_t _src_d);\nssize_t\tacl_copy_ext(void *_buf_p, acl_t _acl, ssize_t _size);\nacl_t\tacl_copy_int(const void *_buf_p);\nint\tacl_create_entry(acl_t *_acl_p, acl_entry_t *_entry_p);\nint\tacl_create_entry_np(acl_t *_acl_p, acl_entry_t *_entry_p, int _index);\nint\tacl_delete_entry(acl_t _acl, acl_entry_t _entry_d);\nint\tacl_delete_entry_np(acl_t _acl, int _index);\nint\tacl_delete_fd_np(int _filedes, acl_type_t _type);\nint\tacl_delete_file_np(const char *_path_p, acl_type_t _type);\nint\tacl_delete_link_np(const char *_path_p, acl_type_t _type);\nint\tacl_delete_def_file(const char *_path_p);\nint\tacl_delete_def_link_np(const char *_path_p);\nint\tacl_delete_flag_np(acl_flagset_t _flagset_d, acl_flag_t _flag);\nint\tacl_delete_perm(acl_permset_t _permset_d, acl_perm_t _perm);\nacl_t\tacl_dup(acl_t _acl);\nint\tacl_free(void *_obj_p);\nacl_t\tacl_from_text(const char *_buf_p);\nint\tacl_get_brand_np(acl_t _acl, int *_brand_p);\nint\tacl_get_entry(acl_t _acl, int _entry_id, acl_entry_t *_entry_p);\nacl_t\tacl_get_fd(int _fd);\nacl_t\tacl_get_fd_np(int fd, acl_type_t _type);\nacl_t\tacl_get_file(const char *_path_p, acl_type_t _type);\nint\tacl_get_entry_type_np(acl_entry_t _entry_d, acl_entry_type_t *_entry_type_p);\nacl_t\tacl_get_link_np(const char *_path_p, acl_type_t _type);\nvoid\t*acl_get_qualifier(acl_entry_t _entry_d);\nint\tacl_get_flag_np(acl_flagset_t _flagset_d, acl_flag_t _flag);\nint\tacl_get_perm_np(acl_permset_t _permset_d, acl_perm_t _perm);\nint\tacl_get_flagset_np(acl_entry_t _entry_d, acl_flagset_t *_flagset_p);\nint\tacl_get_permset(acl_entry_t _entry_d, acl_permset_t *_permset_p);\nint\tacl_get_tag_type(acl_entry_t _entry_d, acl_tag_t *_tag_type_p);\nacl_t\tacl_init(int _count);\nint\tacl_set_fd(int _fd, acl_t _acl);\nint\tacl_set_fd_np(int _fd, acl_t _acl, acl_type_t _type);\nint\tacl_set_file(const char *_path_p, acl_type_t _type, acl_t _acl);\nint\tacl_set_entry_type_np(acl_entry_t _entry_d, acl_entry_type_t _entry_type);\nint\tacl_set_link_np(const char *_path_p, acl_type_t _type, acl_t _acl);\nint\tacl_set_flagset_np(acl_entry_t _entry_d, acl_flagset_t _flagset_d);\nint\tacl_set_permset(acl_entry_t _entry_d, acl_permset_t _permset_d);\nint\tacl_set_qualifier(acl_entry_t _entry_d, const void *_tag_qualifier_p);\nint\tacl_set_tag_type(acl_entry_t _entry_d, acl_tag_t _tag_type);\nssize_t\tacl_size(acl_t _acl);\nchar\t*acl_to_text(acl_t _acl, ssize_t *_len_p);\nchar\t*acl_to_text_np(acl_t _acl, ssize_t *_len_p, int _flags);\nint\tacl_valid(acl_t _acl);\nint\tacl_valid_fd_np(int _fd, acl_type_t _type, acl_t _acl);\nint\tacl_valid_file_np(const char *_path_p, acl_type_t _type, acl_t _acl);\nint\tacl_valid_link_np(const char *_path_p, acl_type_t _type, acl_t _acl);\nint\tacl_is_trivial_np(const acl_t _acl, int *_trivialp);\nacl_t\tacl_strip_np(const acl_t _acl, int recalculate_mask);\n__END_DECLS\n\n#endif /* !_KERNEL */\n\n#endif /* !_SYS_ACL_H_ */\n"
  },
  {
    "path": "freebsd-headers/sys/agpio.h",
    "content": "/*-\n * Copyright (c) 2000 Doug Rabson\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t$FreeBSD: release/9.0.0/sys/sys/agpio.h 121440 2003-10-23 18:08:56Z jhb $\n */\n\n#ifndef _SYS_AGPIO_H_\n#define _SYS_AGPIO_H_\n\n/*\n * The AGP gatt uses 4k pages irrespective of the host page size.\n */\n#define AGP_PAGE_SIZE\t\t4096\n#define AGP_PAGE_SHIFT\t\t12\n\n/*\n * Macros to manipulate AGP mode words.\n *\n * SBA = Sideband Address Port\n * FW  = Fast Writes\n */\n#define AGP_MODE_GET_RQ(x)\t\t(((x) & 0xff000000U) >> 24)\n#define AGP_MODE_GET_ARQSZ(x)\t\t(((x) & 0x0000e000U) >> 13)\n#define AGP_MODE_GET_CAL(x)\t\t(((x) & 0x00001c00U) >> 10)\n#define AGP_MODE_GET_SBA(x)\t\t(((x) & 0x00000200U) >> 9)\n#define AGP_MODE_GET_AGP(x)\t\t(((x) & 0x00000100U) >> 8)\n#define AGP_MODE_GET_GART_64(x)\t\t(((x) & 0x00000080U) >> 7)\n#define AGP_MODE_GET_OVER_4G(x)\t\t(((x) & 0x00000020U) >> 5)\n#define AGP_MODE_GET_FW(x)\t\t(((x) & 0x00000010U) >> 4)\n#define AGP_MODE_GET_MODE_3(x)\t\t(((x) & 0x00000008U) >> 3)\n#define AGP_MODE_GET_RATE(x)\t\t((x) & 0x00000007U)\n#define AGP_MODE_SET_RQ(x,v)\t\t(((x) & ~0xff000000U) | ((v) << 24))\n#define AGP_MODE_SET_ARQSZ(x,v)\t\t(((x) & ~0x0000e000U) | ((v) << 13))\n#define AGP_MODE_SET_CAL(x,v)\t\t(((x) & ~0x00001c00U) | ((v) << 10))\n#define AGP_MODE_SET_SBA(x,v)\t\t(((x) & ~0x00000200U) | ((v) << 9))\n#define AGP_MODE_SET_AGP(x,v)\t\t(((x) & ~0x00000100U) | ((v) << 8))\n#define AGP_MODE_SET_GART_64(x,v)\t(((x) & ~0x00000080U) | ((v) << 7))\n#define AGP_MODE_SET_OVER_4G(x,v)\t(((x) & ~0x00000020U) | ((v) << 5))\n#define AGP_MODE_SET_FW(x,v)\t\t(((x) & ~0x00000010U) | ((v) << 4))\n#define AGP_MODE_SET_MODE_3(x,v)\t(((x) & ~0x00000008U) | ((v) << 3))\n#define AGP_MODE_SET_RATE(x,v)\t\t(((x) & ~0x00000007U) | (v))\n#define AGP_MODE_V2_RATE_1x\t\t0x00000001\n#define AGP_MODE_V2_RATE_2x\t\t0x00000002\n#define AGP_MODE_V2_RATE_4x\t\t0x00000004\n#define AGP_MODE_V3_RATE_4x\t\t0x00000001\n#define AGP_MODE_V3_RATE_8x\t\t0x00000002\n#define AGP_MODE_V3_RATE_RSVD\t\t0x00000004\n\n/* XXX: Compat */\n#define AGP_MODE_GET_4G(x)\t\tAGP_MODE_GET_OVER_4G(x)\n#define AGP_MODE_SET_4G(x)\t\tAGP_MODE_SET_OVER_4G(x)\n#define AGP_MODE_RATE_1x\t\tAGP_MODE_V2_RATE_1x\n#define AGP_MODE_RATE_2x\t\tAGP_MODE_V2_RATE_2x\n#define AGP_MODE_RATE_4x\t\tAGP_MODE_V2_RATE_4x\n\n#define AGPIOC_BASE       'A'\n#define AGPIOC_INFO       _IOR (AGPIOC_BASE, 0, agp_info)\n#define AGPIOC_ACQUIRE    _IO  (AGPIOC_BASE, 1)\n#define AGPIOC_RELEASE    _IO  (AGPIOC_BASE, 2)\n#define AGPIOC_SETUP      _IOW (AGPIOC_BASE, 3, agp_setup)\n#if 0\n#define AGPIOC_RESERVE    _IOW (AGPIOC_BASE, 4, agp_region)\n#define AGPIOC_PROTECT    _IOW (AGPIOC_BASE, 5, agp_region)\n#endif\n#define AGPIOC_ALLOCATE   _IOWR(AGPIOC_BASE, 6, agp_allocate)\n#define AGPIOC_DEALLOCATE _IOW (AGPIOC_BASE, 7, int)\n#define AGPIOC_BIND       _IOW (AGPIOC_BASE, 8, agp_bind)\n#define AGPIOC_UNBIND     _IOW (AGPIOC_BASE, 9, agp_unbind)\n\ntypedef struct _agp_version {\n\tu_int16_t major;\n\tu_int16_t minor;\n} agp_version;\n\ntypedef struct _agp_info {\n\tagp_version version;\t/* version of the driver        */\n\tu_int32_t bridge_id;\t/* bridge vendor/device         */\n\tu_int32_t agp_mode;\t/* mode info of bridge          */\n\toff_t aper_base;\t/* base of aperture             */\n\tsize_t aper_size;\t/* size of aperture             */\n\tsize_t pg_total;\t/* max pages (swap + system)    */\n\tsize_t pg_system;\t/* max pages (system)           */\n\tsize_t pg_used;\t\t/* current pages used           */\n} agp_info;\n\ntypedef struct _agp_setup {\n\tu_int32_t agp_mode;\t\t/* mode info of bridge          */\n} agp_setup;\n\n#if 0\n/*\n * The \"prot\" down below needs still a \"sleep\" flag somehow ...\n */\ntypedef struct _agp_segment {\n\toff_t pg_start;\t\t/* starting page to populate    */\n\tsize_t pg_count;\t/* number of pages              */\n\tint prot;\t\t/* prot flags for mmap          */\n} agp_segment;\n\ntypedef struct _agp_region {\n\tpid_t pid;\t\t/* pid of process               */\n\tsize_t seg_count;\t/* number of segments           */\n\tstruct _agp_segment *seg_list;\n} agp_region;\n#endif\n\ntypedef struct _agp_allocate {\n\tint key;\t\t/* tag of allocation            */\n\tsize_t pg_count;\t/* number of pages              */\n\tu_int32_t type;\t\t/* 0 == normal, other devspec   */\n   \tu_int32_t physical;     /* device specific (some devices  \n\t\t\t\t * need a phys address of the     \n\t\t\t\t * actual page behind the gatt    \n\t\t\t\t * table)                        */\n} agp_allocate;\n\ntypedef struct _agp_bind {\n\tint key;\t\t/* tag of allocation            */\n\toff_t pg_start;\t\t/* starting page to populate    */\n} agp_bind;\n\ntypedef struct _agp_unbind {\n\tint key;\t\t/* tag of allocation            */\n\tu_int32_t priority;\t/* priority for paging out      */\n} agp_unbind;\n\n#endif /* !_SYS_AGPIO_H_ */\n"
  },
  {
    "path": "freebsd-headers/sys/aio.h",
    "content": "/*-\n * Copyright (c) 1997 John S. Dyson.  All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. John S. Dyson's name may not be used to endorse or promote products\n *    derived from this software without specific prior written permission.\n *\n * DISCLAIMER:  This code isn't warranted to do anything useful.  Anything\n * bad that happens because of using this software isn't the responsibility\n * of the author.  This software is distributed AS-IS.\n *\n * $FreeBSD: release/9.0.0/sys/sys/aio.h 189822 2009-03-14 19:17:00Z das $\n */\n\n#ifndef _SYS_AIO_H_\n#define\t_SYS_AIO_H_\n\n#include <sys/types.h>\n#include <sys/signal.h>\n\n/*\n * Returned by aio_cancel:\n */\n#define\tAIO_CANCELED\t\t0x1\n#define\tAIO_NOTCANCELED\t\t0x2\n#define\tAIO_ALLDONE\t\t0x3\n\n/*\n * LIO opcodes\n */\n#define\tLIO_NOP\t\t\t0x0\n#define LIO_WRITE\t\t0x1\n#define\tLIO_READ\t\t0x2\n#ifdef _KERNEL\n#define\tLIO_SYNC\t\t0x3\n#endif\n\n/*\n * LIO modes\n */\n#define\tLIO_NOWAIT\t\t0x0\n#define\tLIO_WAIT\t\t0x1\n\n/*\n * Maximum number of allowed LIO operations\n */\n#define\tAIO_LISTIO_MAX\t\t16\n\n/*\n * Private members for aiocb -- don't access\n * directly.\n */\nstruct __aiocb_private {\n\tlong\tstatus;\n\tlong\terror;\n\tvoid\t*kernelinfo;\n};\n\n/*\n * I/O control block\n */\ntypedef struct aiocb {\n\tint\taio_fildes;\t\t/* File descriptor */\n\toff_t\taio_offset;\t\t/* File offset for I/O */\n\tvolatile void *aio_buf;         /* I/O buffer in process space */\n\tsize_t\taio_nbytes;\t\t/* Number of bytes for I/O */\n\tint\t__spare__[2];\n\tvoid\t*__spare2__;\n\tint\taio_lio_opcode;\t\t/* LIO opcode */\n\tint\taio_reqprio;\t\t/* Request priority -- ignored */\n\tstruct\t__aiocb_private\t_aiocb_private;\n\tstruct\tsigevent aio_sigevent;\t/* Signal to deliver */\n} aiocb_t;\n\n#ifndef _KERNEL\n\nstruct timespec;\n\n__BEGIN_DECLS\n/*\n * Asynchronously read from a file\n */\nint\taio_read(struct aiocb *);\n\n/*\n * Asynchronously write to file\n */\nint\taio_write(struct aiocb *);\n\n/*\n * List I/O Asynchronously/synchronously read/write to/from file\n *\t\"lio_mode\" specifies whether or not the I/O is synchronous.\n *\t\"acb_list\" is an array of \"nacb_listent\" I/O control blocks.\n *\twhen all I/Os are complete, the optional signal \"sig\" is sent.\n */\nint\tlio_listio(int, struct aiocb * const [], int, struct sigevent *);\n\n/*\n * Get completion status\n *\treturns EINPROGRESS until I/O is complete.\n *\tthis routine does not block.\n */\nint\taio_error(const struct aiocb *);\n\n/*\n * Finish up I/O, releasing I/O resources and returns the value\n *\tthat would have been associated with a synchronous I/O request.\n *\tThis routine must be called once and only once for each\n *\tI/O control block who has had I/O associated with it.\n */\nssize_t\taio_return(struct aiocb *);\n\n/*\n * Cancel I/O\n */\nint\taio_cancel(int, struct aiocb *);\n\n/*\n * Suspend until all specified I/O or timeout is complete.\n */\nint\taio_suspend(const struct aiocb * const[], int, const struct timespec *);\n\n#ifdef __BSD_VISIBLE\nint\taio_waitcomplete(struct aiocb **, struct timespec *);\n#endif\n\nint\taio_fsync(int op, struct aiocb *aiocbp);\n__END_DECLS\n\n#else\n\n/* Forward declarations for prototypes below. */\nstruct socket;\nstruct sockbuf;\n\nextern void (*aio_swake)(struct socket *, struct sockbuf *);\n\n#endif\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/sys/alq.h",
    "content": "/*-\n * Copyright (c) 2002, Jeffrey Roberson <jeff@freebsd.org>\n * Copyright (c) 2008-2009, Lawrence Stewart <lstewart@freebsd.org>\n * Copyright (c) 2010, The FreeBSD Foundation\n * All rights reserved.\n *\n * Portions of this software were developed at the Centre for Advanced\n * Internet Architectures, Swinburne University of Technology, Melbourne,\n * Australia by Lawrence Stewart under sponsorship from the FreeBSD Foundation.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice unmodified, this list of conditions, and the following\n *    disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR\n * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES\n * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,\n * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF\n * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/sys/alq.h 207223 2010-04-26 13:48:22Z lstewart $\n *\n */\n#ifndef _SYS_ALQ_H_\n#define\t_SYS_ALQ_H_\n\n/*\n * Opaque type for the Async. Logging Queue\n */\nstruct alq;\n\n/* The thread for the logging daemon */\nextern struct thread *ald_thread;\n\n/*\n * Async. Logging Entry\n */\nstruct ale {\n\tintptr_t\tae_bytesused;\t/* # bytes written to ALE. */\n\tchar\t\t*ae_data;\t/* Write ptr. */\n\tint\t\tae_pad;\t\t/* Unused, compat. */\n};\n\n/* Flag options. */\n#define\tALQ_NOWAIT\t0x0001\t/* ALQ may not sleep. */\n#define\tALQ_WAITOK\t0x0002\t/* ALQ may sleep. */\n#define\tALQ_NOACTIVATE\t0x0004\t/* Don't activate ALQ after write. */\n#define\tALQ_ORDERED\t0x0010\t/* Maintain write ordering between threads. */\n\n/* Suggested mode for file creation. */\n#define\tALQ_DEFAULT_CMODE\t0600\n\n/*\n * alq_open_flags:  Creates a new queue\n *\n * Arguments:\n *\talq\tStorage for a pointer to the newly created queue.\n *\tfile\tThe filename to open for logging.\n *\tcred\tCredential to authorize open and I/O with.\n *\tcmode\tCreation mode for file, if new.\n *\tsize\tThe size of the queue in bytes.\n *\tflags\tALQ_ORDERED\n * Returns:\n *\terror from open or 0 on success\n */\nstruct ucred;\nint alq_open_flags(struct alq **alqp, const char *file, struct ucred *cred, int cmode,\n\t    int size, int flags);\nint alq_open(struct alq **alqp, const char *file, struct ucred *cred, int cmode,\n\t    int size, int count);\n\n/*\n * alq_writen:  Write data into the queue\n *\n * Arguments:\n *\talq\tThe queue we're writing to\n *\tdata\tThe entry to be recorded\n *\tlen\tThe number of bytes to write from *data\n *\tflags\t(ALQ_NOWAIT || ALQ_WAITOK), ALQ_NOACTIVATE\n *\n * Returns:\n *\tEWOULDBLOCK if:\n *\t\tWaitok is ALQ_NOWAIT and the queue is full.\n *\t\tThe system is shutting down.\n *\t0 on success.\n */\nint alq_writen(struct alq *alq, void *data, int len, int flags);\nint alq_write(struct alq *alq, void *data, int flags);\n\n/*\n * alq_flush:  Flush the queue out to disk\n */\nvoid alq_flush(struct alq *alq);\n\n/*\n * alq_close:  Flush the queue and free all resources.\n */\nvoid alq_close(struct alq *alq);\n\n/*\n * alq_getn:  Return an entry for direct access\n *\n * Arguments:\n *\talq\tThe queue to retrieve an entry from\n *\tlen\tMax number of bytes required\n *\tflags\t(ALQ_NOWAIT || ALQ_WAITOK)\n *\n * Returns:\n *\tThe next available ale on success.\n *\tNULL if:\n *\t\tflags is ALQ_NOWAIT and the queue is full.\n *\t\tThe system is shutting down.\n *\n * This leaves the queue locked until a subsequent alq_post.\n */\nstruct ale *alq_getn(struct alq *alq, int len, int flags);\nstruct ale *alq_get(struct alq *alq, int flags);\n\n/*\n * alq_post_flags:  Schedule the ale retrieved by alq_get/alq_getn for writing.\n *\talq\tThe queue to post the entry to.\n *\tale\tAn asynch logging entry returned by alq_get.\n *\tflags\tALQ_NOACTIVATE\n */\nvoid alq_post_flags(struct alq *alq, struct ale *ale, int flags);\n\nstatic __inline void\nalq_post(struct alq *alq, struct ale *ale)\n{\n\talq_post_flags(alq, ale, 0);\n}\n\n#endif\t/* _SYS_ALQ_H_ */\n"
  },
  {
    "path": "freebsd-headers/sys/apm.h",
    "content": "/*-\n * Copyright (c) 2007 Marcel Moolenaar\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n *\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR\n * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES\n * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,\n * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF\n * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/sys/apm.h 200557 2009-12-14 22:47:09Z rpaulo $\n */\n\n#ifndef _SYS_APM_H_\n#define\t_SYS_APM_H_\n\n/* Driver Descriptor Record. */\nstruct apm_ddr {\n\tuint16_t\tddr_sig;\n#define\tAPM_DDR_SIG\t\t0x4552\n\tuint16_t\tddr_blksize;\n\tuint32_t\tddr_blkcount;\n};\n\n#define\tAPM_ENT_NAMELEN\t\t32\n#define\tAPM_ENT_TYPELEN\t\t32\n\n/* Partition Map Entry Record. */\nstruct apm_ent {\n\tuint16_t\tent_sig;\n#define\tAPM_ENT_SIG\t\t0x504d\n\tuint16_t\t_pad_;\n\tuint32_t\tent_pmblkcnt;\n\tuint32_t\tent_start;\n\tuint32_t\tent_size;\n\tchar\t\tent_name[APM_ENT_NAMELEN];\n\tchar\t\tent_type[APM_ENT_TYPELEN];\n};\n\n#define\tAPM_ENT_TYPE_SELF\t\t\"Apple_partition_map\"\n#define\tAPM_ENT_TYPE_UNUSED\t\t\"Apple_Free\"\n\n#define\tAPM_ENT_TYPE_FREEBSD\t\t\"FreeBSD\"\n#define\tAPM_ENT_TYPE_FREEBSD_SWAP\t\"FreeBSD-swap\"\n#define\tAPM_ENT_TYPE_FREEBSD_UFS\t\"FreeBSD-UFS\"\n#define\tAPM_ENT_TYPE_FREEBSD_VINUM\t\"FreeBSD-Vinum\"\n#define\tAPM_ENT_TYPE_FREEBSD_ZFS\t\"FreeBSD-ZFS\"\n\n#define\tAPM_ENT_TYPE_APPLE_BOOT\t\t\"Apple_Bootstrap\"\n#define\tAPM_ENT_TYPE_APPLE_HFS\t\t\"Apple_HFS\"\n#define\tAPM_ENT_TYPE_APPLE_UFS\t\t\"Apple_UNIX_SVR2\"\n\n#endif /* _SYS_APM_H_ */\n"
  },
  {
    "path": "freebsd-headers/sys/assym.h",
    "content": "/*-\n * Copyright (c) 1999 Marcel Moolenaar\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer \n *    in this position and unchanged.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. The name of the author may not be used to endorse or promote products\n *    derived from this software without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR\n * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES\n * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,\n * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF\n * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/sys/assym.h 126891 2004-03-12 21:45:33Z trhodes $\n */\n\n#ifndef _SYS_ASSYM_H_\n#define\t_SYS_ASSYM_H_\n\n#define\tASSYM_BIAS\t\t0x10000\t/* avoid zero-length arrays */\n#define\tASSYM_ABS(value)\t((value) < 0 ? -((value) + 1) + 1ULL : (value))\n\n#define\tASSYM(name, value)\t\t\t\t\t\t      \\\nchar name ## sign[((value) < 0 ? 1 : 0) + ASSYM_BIAS];\t\t\t      \\\nchar name ## w0[(ASSYM_ABS(value) & 0xFFFFU) + ASSYM_BIAS];\t\t      \\\nchar name ## w1[((ASSYM_ABS(value) & 0xFFFF0000UL) >> 16) + ASSYM_BIAS];      \\\nchar name ## w2[((ASSYM_ABS(value) & 0xFFFF00000000ULL) >> 32) + ASSYM_BIAS]; \\\nchar name ## w3[((ASSYM_ABS(value) & 0xFFFF000000000000ULL) >> 48) + ASSYM_BIAS]\n\n#endif /* !_SYS_ASSYM_H_ */\n"
  },
  {
    "path": "freebsd-headers/sys/ata.h",
    "content": "/*-\n * Copyright (c) 2000 - 2008 Sren Schmidt <sos@FreeBSD.org>\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer,\n *    without modification, immediately at the beginning of the file.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR\n * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES\n * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,\n * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF\n * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/sys/ata.h 220602 2011-04-13 16:20:54Z mav $\n */\n\n#ifndef _SYS_ATA_H_\n#define _SYS_ATA_H_\n\n#include <sys/ioccom.h>\n\n/* ATA/ATAPI device parameters */\nstruct ata_params {\n/*000*/ u_int16_t       config;         /* configuration info */\n#define ATA_PROTO_MASK                  0x8003\n#define ATA_PROTO_ATAPI                 0x8000\n#define ATA_PROTO_ATAPI_12              0x8000\n#define ATA_PROTO_ATAPI_16              0x8001\n#define ATA_PROTO_CFA                   0x848a\n#define ATA_ATAPI_TYPE_MASK             0x1f00\n#define ATA_ATAPI_TYPE_DIRECT           0x0000  /* disk/floppy */\n#define ATA_ATAPI_TYPE_TAPE             0x0100  /* streaming tape */\n#define ATA_ATAPI_TYPE_CDROM            0x0500  /* CD-ROM device */\n#define ATA_ATAPI_TYPE_OPTICAL          0x0700  /* optical disk */\n#define ATA_DRQ_MASK                    0x0060\n#define ATA_DRQ_SLOW                    0x0000  /* cpu 3 ms delay */\n#define ATA_DRQ_INTR                    0x0020  /* interrupt 10 ms delay */\n#define ATA_DRQ_FAST                    0x0040  /* accel 50 us delay */\n#define ATA_RESP_INCOMPLETE             0x0004\n\n/*001*/ u_int16_t       cylinders;              /* # of cylinders */\n/*002*/ u_int16_t       specconf;\t\t/* specific configuration */\n/*003*/ u_int16_t       heads;                  /* # heads */\n\tu_int16_t       obsolete4;\n\tu_int16_t       obsolete5;\n/*006*/ u_int16_t       sectors;                /* # sectors/track */\n/*007*/ u_int16_t       vendor7[3];\n/*010*/ u_int8_t        serial[20];             /* serial number */\n/*020*/ u_int16_t       retired20;\n\tu_int16_t       retired21;\n\tu_int16_t       obsolete22;\n/*023*/ u_int8_t        revision[8];            /* firmware revision */\n/*027*/ u_int8_t        model[40];              /* model name */\n/*047*/ u_int16_t       sectors_intr;           /* sectors per interrupt */\n/*048*/ u_int16_t       usedmovsd;              /* double word read/write? */\n/*049*/ u_int16_t       capabilities1;\n#define ATA_SUPPORT_DMA                 0x0100\n#define ATA_SUPPORT_LBA                 0x0200\n#define ATA_SUPPORT_IORDY               0x0400\n#define ATA_SUPPORT_IORDYDIS            0x0800\n#define ATA_SUPPORT_OVERLAP             0x4000\n\n/*050*/ u_int16_t       capabilities2;\n/*051*/ u_int16_t       retired_piomode;        /* PIO modes 0-2 */\n#define ATA_RETIRED_PIO_MASK            0x0300\n\n/*052*/ u_int16_t       retired_dmamode;        /* DMA modes */\n#define ATA_RETIRED_DMA_MASK            0x0003\n\n/*053*/ u_int16_t       atavalid;               /* fields valid */\n#define ATA_FLAG_54_58                  0x0001  /* words 54-58 valid */\n#define ATA_FLAG_64_70                  0x0002  /* words 64-70 valid */\n#define ATA_FLAG_88                     0x0004  /* word 88 valid */\n\n/*054*/ u_int16_t       current_cylinders;\n/*055*/ u_int16_t       current_heads;\n/*056*/ u_int16_t       current_sectors;\n/*057*/ u_int16_t       current_size_1;\n/*058*/ u_int16_t       current_size_2;\n/*059*/ u_int16_t       multi;\n#define ATA_MULTI_VALID                 0x0100\n\n/*060*/ u_int16_t       lba_size_1;\n\tu_int16_t       lba_size_2;\n\tu_int16_t       obsolete62;\n/*063*/ u_int16_t       mwdmamodes;             /* multiword DMA modes */\n/*064*/ u_int16_t       apiomodes;              /* advanced PIO modes */\n\n/*065*/ u_int16_t       mwdmamin;               /* min. M/W DMA time/word ns */\n/*066*/ u_int16_t       mwdmarec;               /* rec. M/W DMA time ns */\n/*067*/ u_int16_t       pioblind;               /* min. PIO cycle w/o flow */\n/*068*/ u_int16_t       pioiordy;               /* min. PIO cycle IORDY flow */\n/*069*/ u_int16_t       support3;\n#define ATA_SUPPORT_RZAT                0x0020\n#define ATA_SUPPORT_DRAT                0x4000\n\tu_int16_t       reserved70;\n/*071*/ u_int16_t       rlsovlap;               /* rel time (us) for overlap */\n/*072*/ u_int16_t       rlsservice;             /* rel time (us) for service */\n\tu_int16_t       reserved73;\n\tu_int16_t       reserved74;\n/*075*/ u_int16_t       queue;\n#define ATA_QUEUE_LEN(x)                ((x) & 0x001f)\n\n/*76*/  u_int16_t       satacapabilities;\n#define ATA_SATA_GEN1                   0x0002\n#define ATA_SATA_GEN2                   0x0004\n#define ATA_SATA_GEN3                   0x0008\n#define ATA_SUPPORT_NCQ                 0x0100\n#define ATA_SUPPORT_IFPWRMNGTRCV        0x0200\n#define ATA_SUPPORT_PHYEVENTCNT         0x0400\n#define ATA_SUPPORT_NCQ_UNLOAD          0x0800\n#define ATA_SUPPORT_NCQ_PRIO            0x1000\n#define ATA_SUPPORT_HAPST               0x2000\n#define ATA_SUPPORT_DAPST               0x4000\n#define ATA_SUPPORT_READLOGDMAEXT       0x8000\n\n/*77*/  u_int16_t       satacapabilities2;\n#define ATA_SATA_CURR_GEN_MASK          0x0006\n#define ATA_SUPPORT_NCQ_STREAM          0x0010\n#define ATA_SUPPORT_NCQ_QMANAGEMENT     0x0020\n/*78*/  u_int16_t       satasupport;\n#define ATA_SUPPORT_NONZERO             0x0002\n#define ATA_SUPPORT_AUTOACTIVATE        0x0004\n#define ATA_SUPPORT_IFPWRMNGT           0x0008\n#define ATA_SUPPORT_INORDERDATA         0x0010\n#define ATA_SUPPORT_ASYNCNOTIF          0x0020\n#define ATA_SUPPORT_SOFTSETPRESERVE     0x0040\n/*79*/  u_int16_t       sataenabled;\n#define ATA_ENABLED_DAPST               0x0080\n\n/*080*/ u_int16_t       version_major;\n/*081*/ u_int16_t       version_minor;\n\n\tstruct {\n/*082/085*/ u_int16_t   command1;\n#define ATA_SUPPORT_SMART               0x0001\n#define ATA_SUPPORT_SECURITY            0x0002\n#define ATA_SUPPORT_REMOVABLE           0x0004\n#define ATA_SUPPORT_POWERMGT            0x0008\n#define ATA_SUPPORT_PACKET              0x0010\n#define ATA_SUPPORT_WRITECACHE          0x0020\n#define ATA_SUPPORT_LOOKAHEAD           0x0040\n#define ATA_SUPPORT_RELEASEIRQ          0x0080\n#define ATA_SUPPORT_SERVICEIRQ          0x0100\n#define ATA_SUPPORT_RESET               0x0200\n#define ATA_SUPPORT_PROTECTED           0x0400\n#define ATA_SUPPORT_WRITEBUFFER         0x1000\n#define ATA_SUPPORT_READBUFFER          0x2000\n#define ATA_SUPPORT_NOP                 0x4000\n\n/*083/086*/ u_int16_t   command2;\n#define ATA_SUPPORT_MICROCODE           0x0001\n#define ATA_SUPPORT_QUEUED              0x0002\n#define ATA_SUPPORT_CFA                 0x0004\n#define ATA_SUPPORT_APM                 0x0008\n#define ATA_SUPPORT_NOTIFY              0x0010\n#define ATA_SUPPORT_STANDBY             0x0020\n#define ATA_SUPPORT_SPINUP              0x0040\n#define ATA_SUPPORT_MAXSECURITY         0x0100\n#define ATA_SUPPORT_AUTOACOUSTIC        0x0200\n#define ATA_SUPPORT_ADDRESS48           0x0400\n#define ATA_SUPPORT_OVERLAY             0x0800\n#define ATA_SUPPORT_FLUSHCACHE          0x1000\n#define ATA_SUPPORT_FLUSHCACHE48        0x2000\n\n/*084/087*/ u_int16_t   extension;\n#define ATA_SUPPORT_SMARTLOG\t\t0x0001\n#define ATA_SUPPORT_SMARTTEST\t\t0x0002\n#define ATA_SUPPORT_MEDIASN\t\t0x0004\n#define ATA_SUPPORT_MEDIAPASS\t\t0x0008\n#define ATA_SUPPORT_STREAMING\t\t0x0010\n#define ATA_SUPPORT_GENLOG\t\t0x0020\n#define ATA_SUPPORT_WRITEDMAFUAEXT\t0x0040\n#define ATA_SUPPORT_WRITEDMAQFUAEXT\t0x0080\n#define ATA_SUPPORT_64BITWWN\t\t0x0100\n#define ATA_SUPPORT_UNLOAD\t\t0x2000\n\t} __packed support, enabled;\n\n/*088*/ u_int16_t       udmamodes;              /* UltraDMA modes */\n/*089*/ u_int16_t       erase_time;\n/*090*/ u_int16_t       enhanced_erase_time;\n/*091*/ u_int16_t       apm_value;\n/*092*/ u_int16_t       master_passwd_revision;\n/*093*/ u_int16_t       hwres;\n#define ATA_CABLE_ID                    0x2000\n\n/*094*/ u_int16_t       acoustic;\n#define ATA_ACOUSTIC_CURRENT(x)         ((x) & 0x00ff)\n#define ATA_ACOUSTIC_VENDOR(x)          (((x) & 0xff00) >> 8)\n\n/*095*/ u_int16_t       stream_min_req_size;\n/*096*/ u_int16_t       stream_transfer_time;\n/*097*/ u_int16_t       stream_access_latency;\n/*098*/ u_int32_t       stream_granularity;\n/*100*/ u_int16_t       lba_size48_1;\n\tu_int16_t       lba_size48_2;\n\tu_int16_t       lba_size48_3;\n\tu_int16_t       lba_size48_4;\n\tu_int16_t       reserved104;\n/*105*/\tu_int16_t       max_dsm_blocks;\n/*106*/\tu_int16_t       pss;\n#define ATA_PSS_LSPPS\t\t\t0x000F\n#define ATA_PSS_LSSABOVE512\t\t0x1000\n#define ATA_PSS_MULTLS\t\t\t0x2000\n/*107*/ u_int16_t       isd;\n/*108*/ u_int16_t       wwn[4];\n\tu_int16_t       reserved112[5];\n/*117*/ u_int16_t       lss_1;\n/*118*/ u_int16_t       lss_2;\n/*119*/ u_int16_t       support2;\n#define ATA_SUPPORT_WRITEREADVERIFY\t0x0002\n#define ATA_SUPPORT_WRITEUNCORREXT\t0x0004\n#define ATA_SUPPORT_RWLOGDMAEXT\t\t0x0008\n#define ATA_SUPPORT_MICROCODE3\t\t0x0010\n#define ATA_SUPPORT_FREEFALL\t\t0x0020\n/*120*/ u_int16_t       enabled2;\n\tu_int16_t       reserved121[6];\n/*127*/ u_int16_t       removable_status;\n/*128*/ u_int16_t       security_status;\n\tu_int16_t       reserved129[31];\n/*160*/ u_int16_t       cfa_powermode1;\n\tu_int16_t       reserved161;\n/*162*/ u_int16_t       cfa_kms_support;\n/*163*/ u_int16_t       cfa_trueide_modes;\n/*164*/ u_int16_t       cfa_memory_modes;\n\tu_int16_t       reserved165[4];\n/*169*/\tu_int16_t       support_dsm;\n#define ATA_SUPPORT_DSM_TRIM\t\t0x0001\n\tu_int16_t       reserved170[6];\n/*176*/ u_int8_t        media_serial[60];\n/*206*/ u_int16_t       sct;\n\tu_int16_t       reserved206[2];\n/*209*/ u_int16_t       lsalign;\n/*210*/ u_int16_t       wrv_sectors_m3_1;\n\tu_int16_t       wrv_sectors_m3_2;\n/*212*/ u_int16_t       wrv_sectors_m2_1;\n\tu_int16_t       wrv_sectors_m2_2;\n/*214*/ u_int16_t       nv_cache_caps;\n/*215*/ u_int16_t       nv_cache_size_1;\n\tu_int16_t       nv_cache_size_2;\n/*217*/ u_int16_t       media_rotation_rate;\n\tu_int16_t       reserved218;\n/*219*/ u_int16_t       nv_cache_opt;\n/*220*/ u_int16_t       wrv_mode;\n\tu_int16_t       reserved221;\n/*222*/ u_int16_t       transport_major;\n/*223*/ u_int16_t       transport_minor;\n\tu_int16_t       reserved224[31];\n/*255*/ u_int16_t       integrity;\n} __packed;\n\n\n/* ATA transfer modes */\n#define ATA_MODE_MASK           0x0f\n#define ATA_DMA_MASK            0xf0\n#define ATA_PIO                 0x00\n#define ATA_PIO0                0x08\n#define ATA_PIO1                0x09\n#define ATA_PIO2                0x0a\n#define ATA_PIO3                0x0b\n#define ATA_PIO4                0x0c\n#define ATA_PIO_MAX             0x0f\n#define ATA_DMA                 0x10\n#define ATA_WDMA0               0x20\n#define ATA_WDMA1               0x21\n#define ATA_WDMA2               0x22\n#define ATA_UDMA0               0x40\n#define ATA_UDMA1               0x41\n#define ATA_UDMA2               0x42\n#define ATA_UDMA3               0x43\n#define ATA_UDMA4               0x44\n#define ATA_UDMA5               0x45\n#define ATA_UDMA6               0x46\n#define ATA_SA150               0x47\n#define ATA_SA300               0x48\n#define ATA_DMA_MAX             0x4f\n\n\n/* ATA commands */\n#define ATA_NOP                         0x00    /* NOP */\n#define         ATA_NF_FLUSHQUEUE       0x00    /* flush queued cmd's */\n#define         ATA_NF_AUTOPOLL         0x01    /* start autopoll function */\n#define ATA_DATA_SET_MANAGEMENT\t\t0x06\n#define \tATA_DSM_TRIM\t\t0x01\n#define ATA_DEVICE_RESET                0x08    /* reset device */\n#define ATA_READ                        0x20    /* read */\n#define ATA_READ48                      0x24    /* read 48bit LBA */\n#define ATA_READ_DMA48                  0x25    /* read DMA 48bit LBA */\n#define ATA_READ_DMA_QUEUED48           0x26    /* read DMA QUEUED 48bit LBA */\n#define ATA_READ_NATIVE_MAX_ADDRESS48   0x27    /* read native max addr 48bit */\n#define ATA_READ_MUL48                  0x29    /* read multi 48bit LBA */\n#define ATA_READ_STREAM_DMA48           0x2a    /* read DMA stream 48bit LBA */\n#define ATA_READ_STREAM48               0x2b    /* read stream 48bit LBA */\n#define ATA_WRITE                       0x30    /* write */\n#define ATA_WRITE48                     0x34    /* write 48bit LBA */\n#define ATA_WRITE_DMA48                 0x35    /* write DMA 48bit LBA */\n#define ATA_WRITE_DMA_QUEUED48          0x36    /* write DMA QUEUED 48bit LBA*/\n#define ATA_SET_MAX_ADDRESS48           0x37    /* set max address 48bit */\n#define ATA_WRITE_MUL48                 0x39    /* write multi 48bit LBA */\n#define ATA_WRITE_STREAM_DMA48          0x3a\n#define ATA_WRITE_STREAM48              0x3b\n#define ATA_WRITE_DMA_FUA48             0x3d\n#define ATA_WRITE_DMA_QUEUED_FUA48      0x3e\n#define ATA_WRITE_LOG_EXT               0x3f\n#define ATA_READ_VERIFY                 0x40\n#define ATA_READ_VERIFY48               0x42\n#define ATA_READ_FPDMA_QUEUED           0x60    /* read DMA NCQ */\n#define ATA_WRITE_FPDMA_QUEUED          0x61    /* write DMA NCQ */\n#define ATA_SEEK                        0x70    /* seek */\n#define ATA_PACKET_CMD                  0xa0    /* packet command */\n#define ATA_ATAPI_IDENTIFY              0xa1    /* get ATAPI params*/\n#define ATA_SERVICE                     0xa2    /* service command */\n#define ATA_SMART_CMD                   0xb0    /* SMART command */\n#define ATA_CFA_ERASE                   0xc0    /* CFA erase */\n#define ATA_READ_MUL                    0xc4    /* read multi */\n#define ATA_WRITE_MUL                   0xc5    /* write multi */\n#define ATA_SET_MULTI                   0xc6    /* set multi size */\n#define ATA_READ_DMA_QUEUED             0xc7    /* read DMA QUEUED */\n#define ATA_READ_DMA                    0xc8    /* read DMA */\n#define ATA_WRITE_DMA                   0xca    /* write DMA */\n#define ATA_WRITE_DMA_QUEUED            0xcc    /* write DMA QUEUED */\n#define ATA_WRITE_MUL_FUA48             0xce\n#define ATA_STANDBY_IMMEDIATE           0xe0    /* standby immediate */\n#define ATA_IDLE_IMMEDIATE              0xe1    /* idle immediate */\n#define ATA_STANDBY_CMD                 0xe2    /* standby */\n#define ATA_IDLE_CMD                    0xe3    /* idle */\n#define ATA_READ_BUFFER                 0xe4    /* read buffer */\n#define ATA_READ_PM                     0xe4    /* read portmultiplier */\n#define ATA_SLEEP                       0xe6    /* sleep */\n#define ATA_FLUSHCACHE                  0xe7    /* flush cache to disk */\n#define ATA_WRITE_PM                    0xe8    /* write portmultiplier */\n#define ATA_FLUSHCACHE48                0xea    /* flush cache to disk */\n#define ATA_ATA_IDENTIFY                0xec    /* get ATA params */\n#define ATA_SETFEATURES                 0xef    /* features command */\n#define         ATA_SF_SETXFER          0x03    /* set transfer mode */\n#define         ATA_SF_ENAB_WCACHE      0x02    /* enable write cache */\n#define         ATA_SF_DIS_WCACHE       0x82    /* disable write cache */\n#define         ATA_SF_ENAB_PUIS        0x06    /* enable PUIS */\n#define         ATA_SF_DIS_PUIS         0x86    /* disable PUIS */\n#define         ATA_SF_PUIS_SPINUP      0x07    /* PUIS spin-up */\n#define         ATA_SF_ENAB_RCACHE      0xaa    /* enable readahead cache */\n#define         ATA_SF_DIS_RCACHE       0x55    /* disable readahead cache */\n#define         ATA_SF_ENAB_RELIRQ      0x5d    /* enable release interrupt */\n#define         ATA_SF_DIS_RELIRQ       0xdd    /* disable release interrupt */\n#define         ATA_SF_ENAB_SRVIRQ      0x5e    /* enable service interrupt */\n#define         ATA_SF_DIS_SRVIRQ       0xde    /* disable service interrupt */\n#define ATA_SECURITY_FREEE_LOCK         0xf5    /* freeze security config */\n#define ATA_READ_NATIVE_MAX_ADDRESS     0xf8    /* read native max address */\n#define ATA_SET_MAX_ADDRESS             0xf9    /* set max address */\n\n\n/* ATAPI commands */\n#define ATAPI_TEST_UNIT_READY           0x00    /* check if device is ready */\n#define ATAPI_REZERO                    0x01    /* rewind */\n#define ATAPI_REQUEST_SENSE             0x03    /* get sense data */\n#define ATAPI_FORMAT                    0x04    /* format unit */\n#define ATAPI_READ                      0x08    /* read data */\n#define ATAPI_WRITE                     0x0a    /* write data */\n#define ATAPI_WEOF                      0x10    /* write filemark */\n#define         ATAPI_WF_WRITE          0x01\n#define ATAPI_SPACE                     0x11    /* space command */\n#define         ATAPI_SP_FM             0x01\n#define         ATAPI_SP_EOD            0x03\n#define ATAPI_INQUIRY\t\t\t0x12\t/* get inquiry data */\n#define ATAPI_MODE_SELECT               0x15    /* mode select */\n#define ATAPI_ERASE                     0x19    /* erase */\n#define ATAPI_MODE_SENSE                0x1a    /* mode sense */\n#define ATAPI_START_STOP                0x1b    /* start/stop unit */\n#define         ATAPI_SS_LOAD           0x01\n#define         ATAPI_SS_RETENSION      0x02\n#define         ATAPI_SS_EJECT          0x04\n#define ATAPI_PREVENT_ALLOW             0x1e    /* media removal */\n#define ATAPI_READ_FORMAT_CAPACITIES    0x23    /* get format capacities */\n#define ATAPI_READ_CAPACITY             0x25    /* get volume capacity */\n#define ATAPI_READ_BIG                  0x28    /* read data */\n#define ATAPI_WRITE_BIG                 0x2a    /* write data */\n#define ATAPI_LOCATE                    0x2b    /* locate to position */\n#define ATAPI_READ_POSITION             0x34    /* read position */\n#define ATAPI_SYNCHRONIZE_CACHE         0x35    /* flush buf, close channel */\n#define ATAPI_WRITE_BUFFER              0x3b    /* write device buffer */\n#define ATAPI_READ_BUFFER               0x3c    /* read device buffer */\n#define ATAPI_READ_SUBCHANNEL           0x42    /* get subchannel info */\n#define ATAPI_READ_TOC                  0x43    /* get table of contents */\n#define ATAPI_PLAY_10                   0x45    /* play by lba */\n#define ATAPI_PLAY_MSF                  0x47    /* play by MSF address */\n#define ATAPI_PLAY_TRACK                0x48    /* play by track number */\n#define ATAPI_PAUSE                     0x4b    /* pause audio operation */\n#define ATAPI_READ_DISK_INFO            0x51    /* get disk info structure */\n#define ATAPI_READ_TRACK_INFO           0x52    /* get track info structure */\n#define ATAPI_RESERVE_TRACK             0x53    /* reserve track */\n#define ATAPI_SEND_OPC_INFO             0x54    /* send OPC structurek */\n#define ATAPI_MODE_SELECT_BIG           0x55    /* set device parameters */\n#define ATAPI_REPAIR_TRACK              0x58    /* repair track */\n#define ATAPI_READ_MASTER_CUE           0x59    /* read master CUE info */\n#define ATAPI_MODE_SENSE_BIG            0x5a    /* get device parameters */\n#define ATAPI_CLOSE_TRACK               0x5b    /* close track/session */\n#define ATAPI_READ_BUFFER_CAPACITY      0x5c    /* get buffer capicity */\n#define ATAPI_SEND_CUE_SHEET            0x5d    /* send CUE sheet */\n#define ATAPI_SERVICE_ACTION_IN         0x96\t/* get service data */\n#define ATAPI_BLANK                     0xa1    /* blank the media */\n#define ATAPI_SEND_KEY                  0xa3    /* send DVD key structure */\n#define ATAPI_REPORT_KEY                0xa4    /* get DVD key structure */\n#define ATAPI_PLAY_12                   0xa5    /* play by lba */\n#define ATAPI_LOAD_UNLOAD               0xa6    /* changer control command */\n#define ATAPI_READ_STRUCTURE            0xad    /* get DVD structure */\n#define ATAPI_PLAY_CD                   0xb4    /* universal play command */\n#define ATAPI_SET_SPEED                 0xbb    /* set drive speed */\n#define ATAPI_MECH_STATUS               0xbd    /* get changer status */\n#define ATAPI_READ_CD                   0xbe    /* read data */\n#define ATAPI_POLL_DSC                  0xff    /* poll DSC status bit */\n\n\nstruct ata_ioc_devices {\n    int                 channel;\n    char                name[2][32];\n    struct ata_params   params[2];\n};\n\n/* pr channel ATA ioctl calls */\n#define IOCATAGMAXCHANNEL       _IOR('a',  1, int)\n#define IOCATAREINIT            _IOW('a',  2, int)\n#define IOCATAATTACH            _IOW('a',  3, int)\n#define IOCATADETACH            _IOW('a',  4, int)\n#define IOCATADEVICES           _IOWR('a',  5, struct ata_ioc_devices)\n\n/* ATAPI request sense structure */\nstruct atapi_sense {\n    u_int8_t\terror;\t\t\t\t/* current or deferred errors */\n#define\tATA_SENSE_VALID\t\t\t0x80\n\n    u_int8_t\tsegment;\t\t\t/* segment number */\n    u_int8_t\tkey;\t\t\t\t/* sense key */\n#define ATA_SENSE_KEY_MASK\t\t0x0f    /* sense key mask */\n#define ATA_SENSE_NO_SENSE\t\t0x00    /* no specific sense key info */\n#define ATA_SENSE_RECOVERED_ERROR \t0x01    /* command OK, data recovered */\n#define ATA_SENSE_NOT_READY\t\t0x02    /* no access to drive */\n#define ATA_SENSE_MEDIUM_ERROR\t\t0x03    /* non-recovered data error */\n#define ATA_SENSE_HARDWARE_ERROR\t0x04    /* non-recoverable HW failure */\n#define ATA_SENSE_ILLEGAL_REQUEST\t0x05    /* invalid command param(s) */\n#define ATA_SENSE_UNIT_ATTENTION\t0x06    /* media changed */\n#define ATA_SENSE_DATA_PROTECT\t\t0x07    /* write protect */\n#define ATA_SENSE_BLANK_CHECK\t\t0x08    /* blank check */\n#define ATA_SENSE_VENDOR_SPECIFIC\t0x09    /* vendor specific skey */\n#define ATA_SENSE_COPY_ABORTED\t\t0x0a    /* copy aborted */\n#define ATA_SENSE_ABORTED_COMMAND\t0x0b    /* command aborted, try again */\n#define ATA_SENSE_EQUAL\t\t\t0x0c    /* equal */\n#define ATA_SENSE_VOLUME_OVERFLOW\t0x0d    /* volume overflow */\n#define ATA_SENSE_MISCOMPARE\t\t0x0e    /* data dont match the medium */\n#define ATA_SENSE_RESERVED\t\t0x0f\n#define\tATA_SENSE_ILI\t\t\t0x20;\n#define\tATA_SENSE_EOM\t\t\t0x40;\n#define\tATA_SENSE_FILEMARK\t\t0x80;\n\n    u_int32_t   cmd_info;\t\t/* cmd information */\n    u_int8_t\tsense_length;\t\t/* additional sense len (n-7) */\n    u_int32_t   cmd_specific_info;\t/* additional cmd spec info */\n    u_int8_t    asc;\t\t\t/* additional sense code */\n    u_int8_t    ascq;\t\t\t/* additional sense code qual */\n    u_int8_t    replaceable_unit_code;\t/* replaceable unit code */\n    u_int8_t\tspecific;\t\t/* sense key specific */\n#define\tATA_SENSE_SPEC_VALID\t0x80\n#define\tATA_SENSE_SPEC_MASK\t0x7f\n\t\n    u_int8_t\tspecific1;\t\t/* sense key specific */\n    u_int8_t\tspecific2;\t\t/* sense key specific */\n} __packed;\n\nstruct ata_ioc_request {\n    union {\n\tstruct {\n\t    u_int8_t            command;\n\t    u_int8_t            feature;\n\t    u_int64_t           lba;\n\t    u_int16_t           count;\n\t} ata;\n\tstruct {\n\t    char                ccb[16];\n\t    struct atapi_sense\tsense;\n\t} atapi;\n    } u;\n    caddr_t             data;\n    int                 count;\n    int                 flags;\n#define ATA_CMD_CONTROL                 0x01\n#define ATA_CMD_READ                    0x02\n#define ATA_CMD_WRITE                   0x04\n#define ATA_CMD_ATAPI                   0x08\n\n    int                 timeout;\n    int                 error;\n};\n\n/* pr device ATA ioctl calls */\n#define IOCATAREQUEST           _IOWR('a', 100, struct ata_ioc_request)\n#define IOCATAGPARM             _IOR('a', 101, struct ata_params)\n#define IOCATAGMODE             _IOR('a', 102, int)\n#define IOCATASMODE             _IOW('a', 103, int)\n\n#define IOCATAGSPINDOWN\t\t_IOR('a', 104, int)\n#define IOCATASSPINDOWN\t\t_IOW('a', 105, int)\n\n\nstruct ata_ioc_raid_config {\n\t    int                 lun;\n\t    int                 type;\n#define AR_JBOD                         0x0001\n#define AR_SPAN                         0x0002\n#define AR_RAID0                        0x0004\n#define AR_RAID1                        0x0008\n#define AR_RAID01                       0x0010\n#define AR_RAID3                        0x0020\n#define AR_RAID4                        0x0040\n#define AR_RAID5                        0x0080\n\n\t    int                 interleave;\n\t    int                 status;\n#define AR_READY                        1\n#define AR_DEGRADED                     2\n#define AR_REBUILDING                   4\n\n\t    int                 progress;\n\t    int                 total_disks;\n\t    int                 disks[16];\n};\n\nstruct ata_ioc_raid_status {\n\t    int                 lun;\n\t    int                 type;\n\t    int                 interleave;\n\t    int                 status;\n\t    int                 progress;\n\t    int                 total_disks;\n\t    struct {\n\t\t    int\t\tstate;\n#define AR_DISK_ONLINE\t\t\t0x01\n#define AR_DISK_PRESENT\t\t\t0x02\n#define AR_DISK_SPARE\t\t\t0x04\n\t\t    int\t\tlun;\n\t    } disks[16];\n};\n\n/* ATA RAID ioctl calls */\n#define IOCATARAIDCREATE        _IOWR('a', 200, struct ata_ioc_raid_config)\n#define IOCATARAIDDELETE        _IOW('a', 201, int)\n#define IOCATARAIDSTATUS        _IOWR('a', 202, struct ata_ioc_raid_status)\n#define IOCATARAIDADDSPARE      _IOW('a', 203, struct ata_ioc_raid_config)\n#define IOCATARAIDREBUILD       _IOW('a', 204, int)\n\n#endif /* _SYS_ATA_H_ */\n"
  },
  {
    "path": "freebsd-headers/sys/bio.h",
    "content": "/*-\n * Copyright (c) 1982, 1986, 1989, 1993\n *\tThe Regents of the University of California.  All rights reserved.\n * (c) UNIX System Laboratories, Inc.\n * All or some portions of this file are derived from material licensed\n * to the University of California by American Telephone and Telegraph\n * Co. or Unix System Laboratories, Inc. and are reproduced herein with\n * the permission of UNIX System Laboratories, Inc.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 4. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t@(#)buf.h\t8.9 (Berkeley) 3/30/95\n * $FreeBSD: release/9.0.0/sys/sys/bio.h 212160 2010-09-02 19:40:28Z gibbs $\n */\n\n#ifndef _SYS_BIO_H_\n#define\t_SYS_BIO_H_\n\n#include <sys/queue.h>\n\n/* bio_cmd */\n#define BIO_READ\t0x01\n#define BIO_WRITE\t0x02\n#define BIO_DELETE\t0x04\n#define BIO_GETATTR\t0x08\n#define BIO_FLUSH\t0x10\n#define BIO_CMD0\t0x20\t/* Available for local hacks */\n#define BIO_CMD1\t0x40\t/* Available for local hacks */\n#define BIO_CMD2\t0x80\t/* Available for local hacks */\n\n/* bio_flags */\n#define BIO_ERROR\t0x01\n#define BIO_DONE\t0x02\n#define BIO_ONQUEUE\t0x04\n#define BIO_ORDERED\t0x08\n\n#ifdef _KERNEL\nstruct disk;\nstruct bio;\n\n/* Empty classifier tag, to prevent further classification. */\n#define\tBIO_NOTCLASSIFIED\t\t(void *)(~0UL)\n\ntypedef void bio_task_t(void *);\n\n/*\n * The bio structure describes an I/O operation in the kernel.\n */\nstruct bio {\n\tuint8_t\tbio_cmd;\t\t/* I/O operation. */\n\tuint8_t\tbio_flags;\t\t/* General flags. */\n\tuint8_t\tbio_cflags;\t\t/* Private use by the consumer. */\n\tuint8_t\tbio_pflags;\t\t/* Private use by the provider. */\n\tstruct cdev *bio_dev;\t\t/* Device to do I/O on. */\n\tstruct disk *bio_disk;\t\t/* Valid below geom_disk.c only */\n\toff_t\tbio_offset;\t\t/* Offset into file. */\n\tlong\tbio_bcount;\t\t/* Valid bytes in buffer. */\n\tcaddr_t\tbio_data;\t\t/* Memory, superblocks, indirect etc. */\n\tint\tbio_error;\t\t/* Errno for BIO_ERROR. */\n\tlong\tbio_resid;\t\t/* Remaining I/O in bytes. */\n\tvoid\t(*bio_done)(struct bio *);\n\tvoid\t*bio_driver1;\t\t/* Private use by the provider. */\n\tvoid\t*bio_driver2;\t\t/* Private use by the provider. */\n\tvoid\t*bio_caller1;\t\t/* Private use by the consumer. */\n\tvoid\t*bio_caller2;\t\t/* Private use by the consumer. */\n\tTAILQ_ENTRY(bio) bio_queue;\t/* Disksort queue. */\n\tconst char *bio_attribute;\t/* Attribute for BIO_[GS]ETATTR */\n\tstruct g_consumer *bio_from;\t/* GEOM linkage */\n\tstruct g_provider *bio_to;\t/* GEOM linkage */\n\toff_t\tbio_length;\t\t/* Like bio_bcount */\n\toff_t\tbio_completed;\t\t/* Inverse of bio_resid */\n\tu_int\tbio_children;\t\t/* Number of spawned bios */\n\tu_int\tbio_inbed;\t\t/* Children safely home by now */\n\tstruct bio *bio_parent;\t\t/* Pointer to parent */\n\tstruct bintime bio_t0;\t\t/* Time request started */\n\n\tbio_task_t *bio_task;\t\t/* Task_queue handler */\n\tvoid\t*bio_task_arg;\t\t/* Argument to above */\n\n\tvoid\t*bio_classifier1;\t/* Classifier tag. */\n\tvoid\t*bio_classifier2;\t/* Classifier tag. */\n\n#ifdef DIAGNOSTIC\n\tvoid\t*_bio_caller1;\n\tvoid\t*_bio_caller2;\n\tuint8_t\t_bio_cflags;\n#endif\n\n\t/* XXX: these go away when bio chaining is introduced */\n\tdaddr_t bio_pblkno;               /* physical block number */\n};\n\nstruct uio;\nstruct devstat;\n\nstruct bio_queue_head {\n\tTAILQ_HEAD(bio_queue, bio) queue;\n\toff_t last_offset;\n\tstruct\tbio *insert_point;\n};\n\nvoid biodone(struct bio *bp);\nvoid biofinish(struct bio *bp, struct devstat *stat, int error);\nint biowait(struct bio *bp, const char *wchan);\n\nvoid bioq_disksort(struct bio_queue_head *ap, struct bio *bp);\nstruct bio *bioq_first(struct bio_queue_head *head);\nstruct bio *bioq_takefirst(struct bio_queue_head *head);\nvoid bioq_flush(struct bio_queue_head *head, struct devstat *stp, int error);\nvoid bioq_init(struct bio_queue_head *head);\nvoid bioq_insert_head(struct bio_queue_head *head, struct bio *bp);\nvoid bioq_insert_tail(struct bio_queue_head *head, struct bio *bp);\nvoid bioq_remove(struct bio_queue_head *head, struct bio *bp);\n\nvoid bio_taskqueue(struct bio *bp, bio_task_t *fund, void *arg);\n\nint\tphysio(struct cdev *dev, struct uio *uio, int ioflag);\n#define physread physio\n#define physwrite physio\n\n#endif /* _KERNEL */\n\n#endif /* !_SYS_BIO_H_ */\n"
  },
  {
    "path": "freebsd-headers/sys/bitstring.h",
    "content": "/*-\n * Copyright (c) 1989, 1993\n *\tThe Regents of the University of California.  All rights reserved.\n *\n * This code is derived from software contributed to Berkeley by\n * Paul Vixie.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 4. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/sys/bitstring.h 139825 2005-01-07 02:29:27Z imp $\n */\n\n#ifndef _SYS_BITSTRING_H_\n#define\t_SYS_BITSTRING_H_\n\ntypedef\tunsigned char bitstr_t;\n\n/* internal macros */\n\t\t\t\t/* byte of the bitstring bit is in */\n#define\t_bit_byte(bit) \\\n\t((bit) >> 3)\n\n\t\t\t\t/* mask for the bit within its byte */\n#define\t_bit_mask(bit) \\\n\t(1 << ((bit)&0x7))\n\n/* external macros */\n\t\t\t\t/* bytes in a bitstring of nbits bits */\n#define\tbitstr_size(nbits) \\\n\t(((nbits) + 7) >> 3)\n\n\t\t\t\t/* allocate a bitstring */\n#define\tbit_alloc(nbits) \\\n\t(bitstr_t *)calloc((size_t)bitstr_size(nbits), sizeof(bitstr_t))\n\n\t\t\t\t/* allocate a bitstring on the stack */\n#define\tbit_decl(name, nbits) \\\n\t((name)[bitstr_size(nbits)])\n\n\t\t\t\t/* is bit N of bitstring name set? */\n#define\tbit_test(name, bit) \\\n\t((name)[_bit_byte(bit)] & _bit_mask(bit))\n\n\t\t\t\t/* set bit N of bitstring name */\n#define\tbit_set(name, bit) \\\n\t((name)[_bit_byte(bit)] |= _bit_mask(bit))\n\n\t\t\t\t/* clear bit N of bitstring name */\n#define\tbit_clear(name, bit) \\\n\t((name)[_bit_byte(bit)] &= ~_bit_mask(bit))\n\n\t\t\t\t/* clear bits start ... stop in bitstring */\n#define\tbit_nclear(name, start, stop) do { \\\n\tregister bitstr_t *_name = (name); \\\n\tregister int _start = (start), _stop = (stop); \\\n\tregister int _startbyte = _bit_byte(_start); \\\n\tregister int _stopbyte = _bit_byte(_stop); \\\n\tif (_startbyte == _stopbyte) { \\\n\t\t_name[_startbyte] &= ((0xff >> (8 - (_start&0x7))) | \\\n\t\t\t\t      (0xff << ((_stop&0x7) + 1))); \\\n\t} else { \\\n\t\t_name[_startbyte] &= 0xff >> (8 - (_start&0x7)); \\\n\t\twhile (++_startbyte < _stopbyte) \\\n\t\t\t_name[_startbyte] = 0; \\\n\t\t_name[_stopbyte] &= 0xff << ((_stop&0x7) + 1); \\\n\t} \\\n} while (0)\n\n\t\t\t\t/* set bits start ... stop in bitstring */\n#define\tbit_nset(name, start, stop) do { \\\n\tregister bitstr_t *_name = (name); \\\n\tregister int _start = (start), _stop = (stop); \\\n\tregister int _startbyte = _bit_byte(_start); \\\n\tregister int _stopbyte = _bit_byte(_stop); \\\n\tif (_startbyte == _stopbyte) { \\\n\t\t_name[_startbyte] |= ((0xff << (_start&0x7)) & \\\n\t\t\t\t    (0xff >> (7 - (_stop&0x7)))); \\\n\t} else { \\\n\t\t_name[_startbyte] |= 0xff << ((_start)&0x7); \\\n\t\twhile (++_startbyte < _stopbyte) \\\n\t    \t\t_name[_startbyte] = 0xff; \\\n\t\t_name[_stopbyte] |= 0xff >> (7 - (_stop&0x7)); \\\n\t} \\\n} while (0)\n\n\t\t\t\t/* find first bit clear in name */\n#define\tbit_ffc(name, nbits, value) do { \\\n\tregister bitstr_t *_name = (name); \\\n\tregister int _byte, _nbits = (nbits); \\\n\tregister int _stopbyte = _bit_byte(_nbits - 1), _value = -1; \\\n\tif (_nbits > 0) \\\n\t\tfor (_byte = 0; _byte <= _stopbyte; ++_byte) \\\n\t\t\tif (_name[_byte] != 0xff) { \\\n\t\t\t\tbitstr_t _lb; \\\n\t\t\t\t_value = _byte << 3; \\\n\t\t\t\tfor (_lb = _name[_byte]; (_lb&0x1); \\\n\t\t\t\t    ++_value, _lb >>= 1); \\\n\t\t\t\tbreak; \\\n\t\t\t} \\\n\tif (_value >= nbits) \\\n\t\t_value = -1; \\\n\t*(value) = _value; \\\n} while (0)\n\n\t\t\t\t/* find first bit set in name */\n#define\tbit_ffs(name, nbits, value) do { \\\n\tregister bitstr_t *_name = (name); \\\n\tregister int _byte, _nbits = (nbits); \\\n\tregister int _stopbyte = _bit_byte(_nbits - 1), _value = -1; \\\n\tif (_nbits > 0) \\\n\t\tfor (_byte = 0; _byte <= _stopbyte; ++_byte) \\\n\t\t\tif (_name[_byte]) { \\\n\t\t\t\tbitstr_t _lb; \\\n\t\t\t\t_value = _byte << 3; \\\n\t\t\t\tfor (_lb = _name[_byte]; !(_lb&0x1); \\\n\t\t\t\t    ++_value, _lb >>= 1); \\\n\t\t\t\tbreak; \\\n\t\t\t} \\\n\tif (_value >= nbits) \\\n\t\t_value = -1; \\\n\t*(value) = _value; \\\n} while (0)\n\n#endif /* !_SYS_BITSTRING_H_ */\n"
  },
  {
    "path": "freebsd-headers/sys/blist.h",
    "content": "/*-\n * Copyright (c) 1998 Matthew Dillon.  All Rights Reserved.\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 4. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS\n * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY\n * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE\n * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\n * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING\n * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\n * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n */\n\n/*\n * Implements bitmap resource lists.\n *\n *\tUsage:\n *\t\tblist = blist_create(blocks, flags)\n *\t\t(void)  blist_destroy(blist)\n *\t\tblkno = blist_alloc(blist, count)\n *\t\t(void)  blist_free(blist, blkno, count)\n *\t\tnblks = blist_fill(blist, blkno, count)\n *\t\t(void)  blist_resize(&blist, count, freeextra, flags)\n *\t\t\n *\n *\tNotes:\n *\t\ton creation, the entire list is marked reserved.  You should\n *\t\tfirst blist_free() the sections you want to make available\n *\t\tfor allocation before doing general blist_alloc()/free()\n *\t\tops.\n *\n *\t\tSWAPBLK_NONE is returned on failure.  This module is typically\n *\t\tcapable of managing up to (2^31) blocks per blist, though\n *\t\tthe memory utilization would be insane if you actually did\n *\t\tthat.  Managing something like 512MB worth of 4K blocks \n *\t\teats around 32 KBytes of memory. \n *\n * $FreeBSD: release/9.0.0/sys/sys/blist.h 178792 2008-05-05 19:48:54Z kmacy $\n\n */\n\n#ifndef _SYS_BLIST_H_\n#define _SYS_BLIST_H_\n\ntypedef\tu_int32_t\tu_daddr_t;\t/* unsigned disk address */\n\n/*\n * note: currently use SWAPBLK_NONE as an absolute value rather then \n * a flag bit.\n */\n\n#define SWAPBLK_MASK\t((daddr_t)((u_daddr_t)-1 >> 1))\t\t/* mask */\n#define SWAPBLK_NONE\t((daddr_t)((u_daddr_t)SWAPBLK_MASK + 1))/* flag */\n\n/*\n * blmeta and bl_bitmap_t MUST be a power of 2 in size.\n */\n\ntypedef struct blmeta {\n\tunion {\n\t    daddr_t\tbmu_avail;\t/* space available under us\t*/\n\t    u_daddr_t\tbmu_bitmap;\t/* bitmap if we are a leaf\t*/\n\t} u;\n\tdaddr_t\t\tbm_bighint;\t/* biggest contiguous block hint*/\n} blmeta_t;\n\ntypedef struct blist {\n\tdaddr_t\t\tbl_blocks;\t/* area of coverage\t\t*/\n\tdaddr_t\t\tbl_radix;\t/* coverage radix\t\t*/\n\tdaddr_t\t\tbl_skip;\t/* starting skip\t\t*/\n\tdaddr_t\t\tbl_free;\t/* number of free blocks\t*/\n\tblmeta_t\t*bl_root;\t/* root of radix tree\t\t*/\n\tdaddr_t\t\tbl_rootblks;\t/* daddr_t blks allocated for tree */\n} *blist_t;\n\n#define BLIST_META_RADIX\t16\n#define BLIST_BMAP_RADIX\t(sizeof(u_daddr_t)*8)\n\n#define BLIST_MAX_ALLOC\t\tBLIST_BMAP_RADIX\n\nextern blist_t blist_create(daddr_t blocks, int flags);\nextern void blist_destroy(blist_t blist);\nextern daddr_t blist_alloc(blist_t blist, daddr_t count);\nextern void blist_free(blist_t blist, daddr_t blkno, daddr_t count);\nextern int blist_fill(blist_t bl, daddr_t blkno, daddr_t count);\nextern void blist_print(blist_t blist);\nextern void blist_resize(blist_t *pblist, daddr_t count, int freenew, int flags);\n\n#endif\t/* _SYS_BLIST_H_ */\n\n"
  },
  {
    "path": "freebsd-headers/sys/buf.h",
    "content": "/*-\n * Copyright (c) 1982, 1986, 1989, 1993\n *\tThe Regents of the University of California.  All rights reserved.\n * (c) UNIX System Laboratories, Inc.\n * All or some portions of this file are derived from material licensed\n * to the University of California by American Telephone and Telegraph\n * Co. or Unix System Laboratories, Inc. and are reproduced herein with\n * the permission of UNIX System Laboratories, Inc.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 4. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t@(#)buf.h\t8.9 (Berkeley) 3/30/95\n * $FreeBSD: release/9.0.0/sys/sys/buf.h 225448 2011-09-08 12:56:26Z attilio $\n */\n\n#ifndef _SYS_BUF_H_\n#define\t_SYS_BUF_H_\n\n#include <sys/bufobj.h>\n#include <sys/queue.h>\n#include <sys/lock.h>\n#include <sys/lockmgr.h>\n\nstruct bio;\nstruct buf;\nstruct bufobj;\nstruct mount;\nstruct vnode;\nstruct uio;\n\n/*\n * To avoid including <ufs/ffs/softdep.h> \n */   \nLIST_HEAD(workhead, worklist);\n/*\n * These are currently used only by the soft dependency code, hence\n * are stored once in a global variable. If other subsystems wanted\n * to use these hooks, a pointer to a set of bio_ops could be added\n * to each buffer.\n */\nextern struct bio_ops {\n\tvoid\t(*io_start)(struct buf *);\n\tvoid\t(*io_complete)(struct buf *);\n\tvoid\t(*io_deallocate)(struct buf *);\n\tint\t(*io_countdeps)(struct buf *, int);\n} bioops;\n\nstruct vm_object;\n\ntypedef unsigned char b_xflags_t;\n\n/*\n * The buffer header describes an I/O operation in the kernel.\n *\n * NOTES:\n *\tb_bufsize, b_bcount.  b_bufsize is the allocation size of the\n *\tbuffer, either DEV_BSIZE or PAGE_SIZE aligned.  b_bcount is the\n *\toriginally requested buffer size and can serve as a bounds check\n *\tagainst EOF.  For most, but not all uses, b_bcount == b_bufsize.\n *\n *\tb_dirtyoff, b_dirtyend.  Buffers support piecemeal, unaligned\n *\tranges of dirty data that need to be written to backing store.\n *\tThe range is typically clipped at b_bcount ( not b_bufsize ).\n *\n *\tb_resid.  Number of bytes remaining in I/O.  After an I/O operation\n *\tcompletes, b_resid is usually 0 indicating 100% success.\n *\n *\tAll fields are protected by the buffer lock except those marked:\n *\t\tV - Protected by owning bufobj lock\n *\t\tQ - Protected by the buf queue lock\n *\t\tD - Protected by an dependency implementation specific lock\n */\nstruct buf {\n\tstruct bufobj\t*b_bufobj;\n\tlong\t\tb_bcount;\n\tvoid\t\t*b_caller1;\n\tcaddr_t\t\tb_data;\n\tint\t\tb_error;\n\tuint8_t\t\tb_iocmd;\n\tuint8_t\t\tb_ioflags;\n\toff_t\t\tb_iooffset;\n\tlong\t\tb_resid;\n\tvoid\t(*b_iodone)(struct buf *);\n\tdaddr_t b_blkno;\t\t/* Underlying physical block number. */\n\toff_t\tb_offset;\t\t/* Offset into file. */\n\tTAILQ_ENTRY(buf) b_bobufs;\t/* (V) Buffer's associated vnode. */\n\tstruct buf\t*b_left;\t/* (V) splay tree link */\n\tstruct buf\t*b_right;\t/* (V) splay tree link */\n\tuint32_t\tb_vflags;\t/* (V) BV_* flags */\n\tTAILQ_ENTRY(buf) b_freelist;\t/* (Q) Free list position inactive. */\n\tunsigned short b_qindex;\t/* (Q) buffer queue index */\n\tuint32_t\tb_flags;\t/* B_* flags. */\n\tb_xflags_t b_xflags;\t\t/* extra flags */\n\tstruct lock b_lock;\t\t/* Buffer lock */\n\tlong\tb_bufsize;\t\t/* Allocated buffer size. */\n\tlong\tb_runningbufspace;\t/* when I/O is running, pipelining */\n\tcaddr_t\tb_kvabase;\t\t/* base kva for buffer */\n\tint\tb_kvasize;\t\t/* size of kva for buffer */\n\tdaddr_t b_lblkno;\t\t/* Logical block number. */\n\tstruct\tvnode *b_vp;\t\t/* Device vnode. */\n\tint\tb_dirtyoff;\t\t/* Offset in buffer of dirty region. */\n\tint\tb_dirtyend;\t\t/* Offset of end of dirty region. */\n\tstruct\tucred *b_rcred;\t\t/* Read credentials reference. */\n\tstruct\tucred *b_wcred;\t\t/* Write credentials reference. */\n\tvoid\t*b_saveaddr;\t\t/* Original b_addr for physio. */\n\tunion\tpager_info {\n\t\tint\tpg_reqpage;\n\t} b_pager;\n\tunion\tcluster_info {\n\t\tTAILQ_HEAD(cluster_list_head, buf) cluster_head;\n\t\tTAILQ_ENTRY(buf) cluster_entry;\n\t} b_cluster;\n\tstruct\tvm_page *b_pages[btoc(MAXPHYS)];\n\tint\t\tb_npages;\n\tstruct\tworkhead b_dep;\t\t/* (D) List of filesystem dependencies. */\n\tvoid\t*b_fsprivate1;\n\tvoid\t*b_fsprivate2;\n\tvoid\t*b_fsprivate3;\n\tint\tb_pin_count;\n};\n\n#define b_object\tb_bufobj->bo_object\n\n/*\n * These flags are kept in b_flags.\n *\n * Notes:\n *\n *\tB_ASYNC\t\tVOP calls on bp's are usually async whether or not\n *\t\t\tB_ASYNC is set, but some subsystems, such as NFS, like \n *\t\t\tto know what is best for the caller so they can\n *\t\t\toptimize the I/O.\n *\n *\tB_PAGING\tIndicates that bp is being used by the paging system or\n *\t\t\tsome paging system and that the bp is not linked into\n *\t\t\tthe b_vp's clean/dirty linked lists or ref counts.\n *\t\t\tBuffer vp reassignments are illegal in this case.\n *\n *\tB_CACHE\t\tThis may only be set if the buffer is entirely valid.\n *\t\t\tThe situation where B_DELWRI is set and B_CACHE is\n *\t\t\tclear MUST be committed to disk by getblk() so \n *\t\t\tB_DELWRI can also be cleared.  See the comments for\n *\t\t\tgetblk() in kern/vfs_bio.c.  If B_CACHE is clear,\n *\t\t\tthe caller is expected to clear BIO_ERROR and B_INVAL,\n *\t\t\tset BIO_READ, and initiate an I/O.\n *\n *\t\t\tThe 'entire buffer' is defined to be the range from\n *\t\t\t0 through b_bcount.\n *\n *\tB_MALLOC\tRequest that the buffer be allocated from the malloc\n *\t\t\tpool, DEV_BSIZE aligned instead of PAGE_SIZE aligned.\n *\n *\tB_CLUSTEROK\tThis flag is typically set for B_DELWRI buffers\n *\t\t\tby filesystems that allow clustering when the buffer\n *\t\t\tis fully dirty and indicates that it may be clustered\n *\t\t\twith other adjacent dirty buffers.  Note the clustering\n *\t\t\tmay not be used with the stage 1 data write under NFS\n *\t\t\tbut may be used for the commit rpc portion.\n *\n *\tB_VMIO\t\tIndicates that the buffer is tied into an VM object.\n *\t\t\tThe buffer's data is always PAGE_SIZE aligned even\n *\t\t\tif b_bufsize and b_bcount are not.  ( b_bufsize is \n *\t\t\talways at least DEV_BSIZE aligned, though ).\n *\n *\tB_DIRECT\tHint that we should attempt to completely free\n *\t\t\tthe pages underlying the buffer.  B_DIRECT is\n *\t\t\tsticky until the buffer is released and typically\n *\t\t\tonly has an effect when B_RELBUF is also set.\n *\n */\n\n#define\tB_AGE\t\t0x00000001\t/* Move to age queue when I/O done. */\n#define\tB_NEEDCOMMIT\t0x00000002\t/* Append-write in progress. */\n#define\tB_ASYNC\t\t0x00000004\t/* Start I/O, do not wait. */\n#define\tB_DIRECT\t0x00000008\t/* direct I/O flag (pls free vmio) */\n#define\tB_DEFERRED\t0x00000010\t/* Skipped over for cleaning */\n#define\tB_CACHE\t\t0x00000020\t/* Bread found us in the cache. */\n#define\tB_VALIDSUSPWRT\t0x00000040\t/* Valid write during suspension. */\n#define\tB_DELWRI\t0x00000080\t/* Delay I/O until buffer reused. */\n#define\tB_PERSISTENT\t0x00000100\t/* Perm. ref'ed while EXT2FS mounted. */\n#define\tB_DONE\t\t0x00000200\t/* I/O completed. */\n#define\tB_EINTR\t\t0x00000400\t/* I/O was interrupted */\n#define\tB_00000800\t0x00000800\t/* Available flag. */\n#define\tB_00001000\t0x00001000\t/* Available flag. */\n#define\tB_INVAL\t\t0x00002000\t/* Does not contain valid info. */\n#define\tB_00004000\t0x00004000\t/* Available flag. */\n#define\tB_NOCACHE\t0x00008000\t/* Do not cache block after use. */\n#define\tB_MALLOC\t0x00010000\t/* malloced b_data */\n#define\tB_CLUSTEROK\t0x00020000\t/* Pagein op, so swap() can count it. */\n#define\tB_000400000\t0x00040000\t/* Available flag. */\n#define\tB_000800000\t0x00080000\t/* Available flag. */\n#define\tB_00100000\t0x00100000\t/* Available flag. */\n#define\tB_DIRTY\t\t0x00200000\t/* Needs writing later (in EXT2FS). */\n#define\tB_RELBUF\t0x00400000\t/* Release VMIO buffer. */\n#define\tB_00800000\t0x00800000\t/* Available flag. */\n#define\tB_NOCOPY\t0x01000000\t/* Don't copy-on-write this buf. */\n#define\tB_NEEDSGIANT\t0x02000000\t/* Buffer's vnode needs giant. */\n#define\tB_PAGING\t0x04000000\t/* volatile paging I/O -- bypass VMIO */\n#define B_MANAGED\t0x08000000\t/* Managed by FS. */\n#define B_RAM\t\t0x10000000\t/* Read ahead mark (flag) */\n#define B_VMIO\t\t0x20000000\t/* VMIO flag */\n#define B_CLUSTER\t0x40000000\t/* pagein op, so swap() can count it */\n#define B_REMFREE\t0x80000000\t/* Delayed bremfree */\n\n#define PRINT_BUF_FLAGS \"\\20\\40remfree\\37cluster\\36vmio\\35ram\\34b27\" \\\n\t\"\\33paging\\32b25\\31b24\\30b23\\27relbuf\\26dirty\\25b20\" \\\n\t\"\\24b19\\23b18\\22clusterok\\21malloc\\20nocache\\17b14\\16inval\" \\\n\t\"\\15b12\\14b11\\13eintr\\12done\\11persist\\10delwri\\7validsuspwrt\" \\\n\t\"\\6cache\\5deferred\\4direct\\3async\\2needcommit\\1age\"\n\n/*\n * These flags are kept in b_xflags.\n */\n#define\tBX_VNDIRTY\t0x00000001\t/* On vnode dirty list */\n#define\tBX_VNCLEAN\t0x00000002\t/* On vnode clean list */\n#define\tBX_BKGRDWRITE\t0x00000010\t/* Do writes in background */\n#define BX_BKGRDMARKER\t0x00000020\t/* Mark buffer for splay tree */\n#define\tBX_ALTDATA\t0x00000040\t/* Holds extended data */\n\n#define\tNOOFFSET\t(-1LL)\t\t/* No buffer offset calculated yet */\n\n/*\n * These flags are kept in b_vflags.\n */\n#define\tBV_SCANNED\t0x00000001\t/* VOP_FSYNC funcs mark written bufs */\n#define\tBV_BKGRDINPROG\t0x00000002\t/* Background write in progress */\n#define\tBV_BKGRDWAIT\t0x00000004\t/* Background write waiting */\n#define\tBV_INFREECNT\t0x80000000\t/* buf is counted in numfreebufs */\n\n#ifdef _KERNEL\n/*\n * Buffer locking\n */\nextern const char *buf_wmesg;\t\t/* Default buffer lock message */\n#define BUF_WMESG \"bufwait\"\n#include <sys/proc.h>\t\t\t/* XXX for curthread */\n#include <sys/mutex.h>\n\n/*\n * Initialize a lock.\n */\n#define BUF_LOCKINIT(bp)\t\t\t\t\t\t\\\n\tlockinit(&(bp)->b_lock, PRIBIO + 4, buf_wmesg, 0, 0)\n/*\n *\n * Get a lock sleeping non-interruptably until it becomes available.\n */\n#define\tBUF_LOCK(bp, locktype, interlock)\t\t\t\t\\\n\t_lockmgr_args(&(bp)->b_lock, (locktype), (interlock),\t\t\\\n\t    LK_WMESG_DEFAULT, LK_PRIO_DEFAULT, LK_TIMO_DEFAULT,\t\t\\\n\t    LOCK_FILE, LOCK_LINE)\n\n/*\n * Get a lock sleeping with specified interruptably and timeout.\n */\n#define\tBUF_TIMELOCK(bp, locktype, interlock, wmesg, catch, timo)\t\\\n\t_lockmgr_args(&(bp)->b_lock, (locktype) | LK_TIMELOCK,\t\t\\\n\t    (interlock), (wmesg), (PRIBIO + 4) | (catch), (timo),\t\\\n\t    LOCK_FILE, LOCK_LINE)\n\n/*\n * Release a lock. Only the acquiring process may free the lock unless\n * it has been handed off to biodone.\n */\n#define\tBUF_UNLOCK(bp) do {\t\t\t\t\t\t\\\n\tKASSERT(((bp)->b_flags & B_REMFREE) == 0,\t\t\t\\\n\t    (\"BUF_UNLOCK %p while B_REMFREE is still set.\", (bp)));\t\\\n\t\t\t\t\t\t\t\t\t\\\n\t(void)_lockmgr_args(&(bp)->b_lock, LK_RELEASE, NULL,\t\t\\\n\t    LK_WMESG_DEFAULT, LK_PRIO_DEFAULT, LK_TIMO_DEFAULT,\t\t\\\n\t    LOCK_FILE, LOCK_LINE);\t\t\t\t\t\\\n} while (0)\n\n/*\n * Check if a buffer lock is recursed.\n */\n#define\tBUF_LOCKRECURSED(bp)\t\t\t\t\t\t\\\n\tlockmgr_recursed(&(bp)->b_lock)\n\n/*\n * Check if a buffer lock is currently held.\n */\n#define\tBUF_ISLOCKED(bp)\t\t\t\t\t\t\\\n\tlockstatus(&(bp)->b_lock)\n/*\n * Free a buffer lock.\n */\n#define BUF_LOCKFREE(bp) \t\t\t\t\t\t\\\n\tlockdestroy(&(bp)->b_lock)\n\n/*\n * Print informations on a buffer lock.\n */\n#define BUF_LOCKPRINTINFO(bp) \t\t\t\t\t\t\\\n\tlockmgr_printinfo(&(bp)->b_lock)\n\n/*\n * Buffer lock assertions.\n */\n#if defined(INVARIANTS) && defined(INVARIANT_SUPPORT)\n#define\tBUF_ASSERT_LOCKED(bp)\t\t\t\t\t\t\\\n\t_lockmgr_assert(&(bp)->b_lock, KA_LOCKED, LOCK_FILE, LOCK_LINE)\n#define\tBUF_ASSERT_SLOCKED(bp)\t\t\t\t\t\t\\\n\t_lockmgr_assert(&(bp)->b_lock, KA_SLOCKED, LOCK_FILE, LOCK_LINE)\n#define\tBUF_ASSERT_XLOCKED(bp)\t\t\t\t\t\t\\\n\t_lockmgr_assert(&(bp)->b_lock, KA_XLOCKED, LOCK_FILE, LOCK_LINE)\n#define\tBUF_ASSERT_UNLOCKED(bp)\t\t\t\t\t\t\\\n\t_lockmgr_assert(&(bp)->b_lock, KA_UNLOCKED, LOCK_FILE, LOCK_LINE)\n#define\tBUF_ASSERT_HELD(bp)\n#define\tBUF_ASSERT_UNHELD(bp)\n#else\n#define\tBUF_ASSERT_LOCKED(bp)\n#define\tBUF_ASSERT_SLOCKED(bp)\n#define\tBUF_ASSERT_XLOCKED(bp)\n#define\tBUF_ASSERT_UNLOCKED(bp)\n#define\tBUF_ASSERT_HELD(bp)\n#define\tBUF_ASSERT_UNHELD(bp)\n#endif\n\n#ifdef _SYS_PROC_H_\t/* Avoid #include <sys/proc.h> pollution */\n/*\n * When initiating asynchronous I/O, change ownership of the lock to the\n * kernel. Once done, the lock may legally released by biodone. The\n * original owning process can no longer acquire it recursively, but must\n * wait until the I/O is completed and the lock has been freed by biodone.\n */\n#define\tBUF_KERNPROC(bp)\t\t\t\t\t\t\\\n\t_lockmgr_disown(&(bp)->b_lock, LOCK_FILE, LOCK_LINE)\n#endif\n\n/*\n * Find out if the lock has waiters or not.\n */\n#define\tBUF_LOCKWAITERS(bp)\t\t\t\t\t\t\\\n\tlockmgr_waiters(&(bp)->b_lock)\n\n#endif /* _KERNEL */\n\nstruct buf_queue_head {\n\tTAILQ_HEAD(buf_queue, buf) queue;\n\tdaddr_t last_pblkno;\n\tstruct\tbuf *insert_point;\n\tstruct\tbuf *switch_point;\n};\n\n/*\n * This structure describes a clustered I/O.  It is stored in the b_saveaddr\n * field of the buffer on which I/O is done.  At I/O completion, cluster\n * callback uses the structure to parcel I/O's to individual buffers, and\n * then free's this structure.\n */\nstruct cluster_save {\n\tlong\tbs_bcount;\t\t/* Saved b_bcount. */\n\tlong\tbs_bufsize;\t\t/* Saved b_bufsize. */\n\tvoid\t*bs_saveaddr;\t\t/* Saved b_addr. */\n\tint\tbs_nchildren;\t\t/* Number of associated buffers. */\n\tstruct buf **bs_children;\t/* List of associated buffers. */\n};\n\n#ifdef _KERNEL\n\nstatic __inline int\nbwrite(struct buf *bp)\n{\n\n\tKASSERT(bp->b_bufobj != NULL, (\"bwrite: no bufobj bp=%p\", bp));\n\tKASSERT(bp->b_bufobj->bo_ops != NULL, (\"bwrite: no bo_ops bp=%p\", bp));\n\tKASSERT(bp->b_bufobj->bo_ops->bop_write != NULL,\n\t    (\"bwrite: no bop_write bp=%p\", bp));\n\treturn (BO_WRITE(bp->b_bufobj, bp));\n}\n\nstatic __inline void\nbstrategy(struct buf *bp)\n{\n\n\tKASSERT(bp->b_bufobj != NULL, (\"bstrategy: no bufobj bp=%p\", bp));\n\tKASSERT(bp->b_bufobj->bo_ops != NULL,\n\t    (\"bstrategy: no bo_ops bp=%p\", bp));\n\tKASSERT(bp->b_bufobj->bo_ops->bop_strategy != NULL,\n\t    (\"bstrategy: no bop_strategy bp=%p\", bp));\n\tBO_STRATEGY(bp->b_bufobj, bp);\n}\n\nstatic __inline void\nbuf_start(struct buf *bp)\n{\n\tif (bioops.io_start)\n\t\t(*bioops.io_start)(bp);\n}\n\nstatic __inline void\nbuf_complete(struct buf *bp)\n{\n\tif (bioops.io_complete)\n\t\t(*bioops.io_complete)(bp);\n}\n\nstatic __inline void\nbuf_deallocate(struct buf *bp)\n{\n\tif (bioops.io_deallocate)\n\t\t(*bioops.io_deallocate)(bp);\n\tBUF_LOCKFREE(bp);\n}\n\nstatic __inline int\nbuf_countdeps(struct buf *bp, int i)\n{\n\tif (bioops.io_countdeps)\n\t\treturn ((*bioops.io_countdeps)(bp, i));\n\telse\n\t\treturn (0);\n}\n\n#endif /* _KERNEL */\n\n/*\n * Zero out the buffer's data area.\n */\n#define\tclrbuf(bp) {\t\t\t\t\t\t\t\\\n\tbzero((bp)->b_data, (u_int)(bp)->b_bcount);\t\t\t\\\n\t(bp)->b_resid = 0;\t\t\t\t\t\t\\\n}\n\n/*\n * Flags for getblk's last parameter.\n */\n#define\tGB_LOCK_NOWAIT\t0x0001\t\t/* Fail if we block on a buf lock. */\n#define\tGB_NOCREAT\t0x0002\t\t/* Don't create a buf if not found. */\n#define\tGB_NOWAIT_BD\t0x0004\t\t/* Do not wait for bufdaemon */\n\n#ifdef _KERNEL\nextern int\tnbuf;\t\t\t/* The number of buffer headers */\nextern long\tmaxswzone;\t\t/* Max KVA for swap structures */\nextern long\tmaxbcache;\t\t/* Max KVA for buffer cache */\nextern long\trunningbufspace;\nextern long\thibufspace;\nextern int\tdirtybufthresh;\nextern int\tbdwriteskip;\nextern int\tdirtybufferflushes;\nextern int\taltbufferflushes;\nextern int      buf_maxio;              /* nominal maximum I/O for buffer */\nextern struct\tbuf *buf;\t\t/* The buffer headers. */\nextern char\t*buffers;\t\t/* The buffer contents. */\nextern int\tbufpages;\t\t/* Number of memory pages in the buffer pool. */\nextern struct\tbuf *swbuf;\t\t/* Swap I/O buffer headers. */\nextern int\tnswbuf;\t\t\t/* Number of swap I/O buffer headers. */\nextern int\tcluster_pbuf_freecnt;\t/* Number of pbufs for clusters */\nextern int\tvnode_pbuf_freecnt;\t/* Number of pbufs for vnode pager */\n\nvoid\trunningbufwakeup(struct buf *);\nvoid\twaitrunningbufspace(void);\ncaddr_t\tkern_vfs_bio_buffer_alloc(caddr_t v, long physmem_est);\nvoid\tbufinit(void);\nvoid\tbwillwrite(void);\nint\tbuf_dirty_count_severe(void);\nvoid\tbremfree(struct buf *);\nvoid\tbremfreef(struct buf *);\t/* XXX Force bremfree, only for nfs. */\nint\tbread(struct vnode *, daddr_t, int, struct ucred *, struct buf **);\nvoid\tbreada(struct vnode *, daddr_t *, int *, int, struct ucred *);\nint\tbreadn(struct vnode *, daddr_t, int, daddr_t *, int *, int,\n\t    struct ucred *, struct buf **);\nvoid\tbdwrite(struct buf *);\nvoid\tbawrite(struct buf *);\nvoid\tbdirty(struct buf *);\nvoid\tbundirty(struct buf *);\nvoid\tbufstrategy(struct bufobj *, struct buf *);\nvoid\tbrelse(struct buf *);\nvoid\tbqrelse(struct buf *);\nint\tvfs_bio_awrite(struct buf *);\nstruct buf *     getpbuf(int *);\nstruct buf *incore(struct bufobj *, daddr_t);\nstruct buf *gbincore(struct bufobj *, daddr_t);\nstruct buf *getblk(struct vnode *, daddr_t, int, int, int, int);\nstruct buf *geteblk(int, int);\nint\tbufwait(struct buf *);\nint\tbufwrite(struct buf *);\nvoid\tbufdone(struct buf *);\nvoid\tbufdone_finish(struct buf *);\nvoid\tbd_speedup(void);\n\nint\tcluster_read(struct vnode *, u_quad_t, daddr_t, long,\n\t    struct ucred *, long, int, struct buf **);\nint\tcluster_wbuild(struct vnode *, long, daddr_t, int);\nvoid\tcluster_write(struct vnode *, struct buf *, u_quad_t, int);\nvoid\tvfs_bio_set_valid(struct buf *, int base, int size);\nvoid\tvfs_bio_clrbuf(struct buf *);\nvoid\tvfs_busy_pages(struct buf *, int clear_modify);\nvoid\tvfs_unbusy_pages(struct buf *);\nint\tvmapbuf(struct buf *);\nvoid\tvunmapbuf(struct buf *);\nvoid\trelpbuf(struct buf *, int *);\nvoid\tbrelvp(struct buf *);\nvoid\tbgetvp(struct vnode *, struct buf *);\nvoid\tpbgetbo(struct bufobj *bo, struct buf *bp);\nvoid\tpbgetvp(struct vnode *, struct buf *);\nvoid\tpbrelbo(struct buf *);\nvoid\tpbrelvp(struct buf *);\nint\tallocbuf(struct buf *bp, int size);\nvoid\treassignbuf(struct buf *);\nstruct\tbuf *trypbuf(int *);\nvoid\tbwait(struct buf *, u_char, const char *);\nvoid\tbdone(struct buf *);\nvoid\tbpin(struct buf *);\nvoid\tbunpin(struct buf *);\nvoid \tbunpin_wait(struct buf *);\n\n#endif /* _KERNEL */\n\n#endif /* !_SYS_BUF_H_ */\n"
  },
  {
    "path": "freebsd-headers/sys/buf_ring.h",
    "content": "/*-\n * Copyright (c) 2007-2009 Kip Macy <kmacy@freebsd.org>\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/sys/buf_ring.h 207673 2010-05-05 20:39:02Z joel $\n *\n */\n\n#ifndef\t_SYS_BUF_RING_H_\n#define\t_SYS_BUF_RING_H_\n\n#include <machine/cpu.h>\n\n#if defined(INVARIANTS) && !defined(DEBUG_BUFRING)\n#define DEBUG_BUFRING 1\n#endif\n\n#ifdef DEBUG_BUFRING\n#include <sys/lock.h>\n#include <sys/mutex.h>\n#endif\n\nstruct buf_ring {\n\tvolatile uint32_t\tbr_prod_head;\n\tvolatile uint32_t\tbr_prod_tail;\t\n\tint              \tbr_prod_size;\n\tint              \tbr_prod_mask;\n\tuint64_t\t\tbr_drops;\n\tuint64_t\t\tbr_prod_bufs;\n\tuint64_t\t\tbr_prod_bytes;\n\t/*\n\t * Pad out to next L2 cache line\n\t */\n\tuint64_t\t  \t_pad0[11];\n\n\tvolatile uint32_t\tbr_cons_head;\n\tvolatile uint32_t\tbr_cons_tail;\n\tint\t\t \tbr_cons_size;\n\tint              \tbr_cons_mask;\n\t\n\t/*\n\t * Pad out to next L2 cache line\n\t */\n\tuint64_t\t  \t_pad1[14];\n#ifdef DEBUG_BUFRING\n\tstruct mtx\t\t*br_lock;\n#endif\t\n\tvoid\t\t\t*br_ring[0];\n};\n\n/*\n * multi-producer safe lock-free ring buffer enqueue\n *\n */\nstatic __inline int\nbuf_ring_enqueue_bytes(struct buf_ring *br, void *buf, int nbytes)\n{\n\tuint32_t prod_head, prod_next;\n\tuint32_t cons_tail;\n\tint success;\n#ifdef DEBUG_BUFRING\n\tint i;\n\tfor (i = br->br_cons_head; i != br->br_prod_head;\n\t     i = ((i + 1) & br->br_cons_mask))\n\t\tif(br->br_ring[i] == buf)\n\t\t\tpanic(\"buf=%p already enqueue at %d prod=%d cons=%d\",\n\t\t\t    buf, i, br->br_prod_tail, br->br_cons_tail);\n#endif\t\n\tcritical_enter();\n\tdo {\n\t\tprod_head = br->br_prod_head;\n\t\tcons_tail = br->br_cons_tail;\n\n\t\tprod_next = (prod_head + 1) & br->br_prod_mask;\n\t\t\n\t\tif (prod_next == cons_tail) {\n\t\t\tcritical_exit();\n\t\t\treturn (ENOBUFS);\n\t\t}\n\t\t\n\t\tsuccess = atomic_cmpset_int(&br->br_prod_head, prod_head,\n\t\t    prod_next);\n\t} while (success == 0);\n#ifdef DEBUG_BUFRING\n\tif (br->br_ring[prod_head] != NULL)\n\t\tpanic(\"dangling value in enqueue\");\n#endif\t\n\tbr->br_ring[prod_head] = buf;\n\twmb();\n\n\t/*\n\t * If there are other enqueues in progress\n\t * that preceeded us, we need to wait for them\n\t * to complete \n\t */   \n\twhile (br->br_prod_tail != prod_head)\n\t\tcpu_spinwait();\n\tbr->br_prod_bufs++;\n\tbr->br_prod_bytes += nbytes;\n\tbr->br_prod_tail = prod_next;\n\tcritical_exit();\n\treturn (0);\n}\n\nstatic __inline int\nbuf_ring_enqueue(struct buf_ring *br, void *buf)\n{\n\n\treturn (buf_ring_enqueue_bytes(br, buf, 0));\n}\n\n/*\n * multi-consumer safe dequeue \n *\n */\nstatic __inline void *\nbuf_ring_dequeue_mc(struct buf_ring *br)\n{\n\tuint32_t cons_head, cons_next;\n\tuint32_t prod_tail;\n\tvoid *buf;\n\tint success;\n\n\tcritical_enter();\n\tdo {\n\t\tcons_head = br->br_cons_head;\n\t\tprod_tail = br->br_prod_tail;\n\n\t\tcons_next = (cons_head + 1) & br->br_cons_mask;\n\t\t\n\t\tif (cons_head == prod_tail) {\n\t\t\tcritical_exit();\n\t\t\treturn (NULL);\n\t\t}\n\t\t\n\t\tsuccess = atomic_cmpset_int(&br->br_cons_head, cons_head,\n\t\t    cons_next);\n\t} while (success == 0);\t\t\n\n\tbuf = br->br_ring[cons_head];\n#ifdef DEBUG_BUFRING\n\tbr->br_ring[cons_head] = NULL;\n#endif\n\trmb();\n\t\n\t/*\n\t * If there are other dequeues in progress\n\t * that preceeded us, we need to wait for them\n\t * to complete \n\t */   \n\twhile (br->br_cons_tail != cons_head)\n\t\tcpu_spinwait();\n\n\tbr->br_cons_tail = cons_next;\n\tcritical_exit();\n\n\treturn (buf);\n}\n\n/*\n * single-consumer dequeue \n * use where dequeue is protected by a lock\n * e.g. a network driver's tx queue lock\n */\nstatic __inline void *\nbuf_ring_dequeue_sc(struct buf_ring *br)\n{\n\tuint32_t cons_head, cons_next, cons_next_next;\n\tuint32_t prod_tail;\n\tvoid *buf;\n\t\n\tcons_head = br->br_cons_head;\n\tprod_tail = br->br_prod_tail;\n\t\n\tcons_next = (cons_head + 1) & br->br_cons_mask;\n\tcons_next_next = (cons_head + 2) & br->br_cons_mask;\n\t\n\tif (cons_head == prod_tail) \n\t\treturn (NULL);\n\n#ifdef PREFETCH_DEFINED\t\n\tif (cons_next != prod_tail) {\t\t\n\t\tprefetch(br->br_ring[cons_next]);\n\t\tif (cons_next_next != prod_tail) \n\t\t\tprefetch(br->br_ring[cons_next_next]);\n\t}\n#endif\n\tbr->br_cons_head = cons_next;\n\tbuf = br->br_ring[cons_head];\n\n#ifdef DEBUG_BUFRING\n\tbr->br_ring[cons_head] = NULL;\n\tif (!mtx_owned(br->br_lock))\n\t\tpanic(\"lock not held on single consumer dequeue\");\n\tif (br->br_cons_tail != cons_head)\n\t\tpanic(\"inconsistent list cons_tail=%d cons_head=%d\",\n\t\t    br->br_cons_tail, cons_head);\n#endif\n\tbr->br_cons_tail = cons_next;\n\treturn (buf);\n}\n\n/*\n * return a pointer to the first entry in the ring\n * without modifying it, or NULL if the ring is empty\n * race-prone if not protected by a lock\n */\nstatic __inline void *\nbuf_ring_peek(struct buf_ring *br)\n{\n\n#ifdef DEBUG_BUFRING\n\tif ((br->br_lock != NULL) && !mtx_owned(br->br_lock))\n\t\tpanic(\"lock not held on single consumer dequeue\");\n#endif\t\n\t/*\n\t * I believe it is safe to not have a memory barrier\n\t * here because we control cons and tail is worst case\n\t * a lagging indicator so we worst case we might\n\t * return NULL immediately after a buffer has been enqueued\n\t */\n\tif (br->br_cons_head == br->br_prod_tail)\n\t\treturn (NULL);\n\t\n\treturn (br->br_ring[br->br_cons_head]);\n}\n\nstatic __inline int\nbuf_ring_full(struct buf_ring *br)\n{\n\n\treturn (((br->br_prod_head + 1) & br->br_prod_mask) == br->br_cons_tail);\n}\n\nstatic __inline int\nbuf_ring_empty(struct buf_ring *br)\n{\n\n\treturn (br->br_cons_head == br->br_prod_tail);\n}\n\nstatic __inline int\nbuf_ring_count(struct buf_ring *br)\n{\n\n\treturn ((br->br_prod_size + br->br_prod_tail - br->br_cons_tail)\n\t    & br->br_prod_mask);\n}\n\nstruct buf_ring *buf_ring_alloc(int count, struct malloc_type *type, int flags,\n    struct mtx *);\nvoid buf_ring_free(struct buf_ring *br, struct malloc_type *type);\n\n\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/sys/bufobj.h",
    "content": "/*-\n * Copyright (c) 2004 Poul-Henning Kamp\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/sys/bufobj.h 183754 2008-10-10 21:23:50Z attilio $\n */\n\n/*\n * Architectural notes:\n *\n * bufobj is a new object which is what buffers hang from in the buffer\n * cache.\n *\n * This used to be vnodes, but we need non-vnode code to be able\n * to use the buffer cache as well, specifically geom classes like gbde,\n * raid3 and raid5.\n *\n * All vnodes will contain a bufobj initially, but down the road we may\n * want to only allocate bufobjs when they are needed.  There could be a\n * large number of vnodes in the system which wouldn't need a bufobj during\n * their lifetime.\n *\n * The exact relationship to the vmobject is not determined at this point,\n * it may in fact be that we find them to be two sides of the same object \n * once things starts to crystalize.\n */\n\n#ifndef _SYS_BUFOBJ_H_\n#define _SYS_BUFOBJ_H_\n\n#if defined(_KERNEL) || defined(_KVM_VNODE)\n\n#include <sys/queue.h>\n#include <sys/_lock.h>\n#include <sys/_mutex.h>\n\nstruct bufobj;\nstruct buf_ops;\n\nextern struct buf_ops buf_ops_bio;\n\nTAILQ_HEAD(buflists, buf);\n\n/* A Buffer splay list */\nstruct bufv {\n\tstruct buflists\tbv_hd;\t\t/* Sorted blocklist */\n\tstruct buf\t*bv_root;\t/* Buf splay tree */\n\tint\t\tbv_cnt;\t\t/* Number of buffers */\n};\n\ntypedef void b_strategy_t(struct bufobj *, struct buf *);\ntypedef int b_write_t(struct buf *);\ntypedef int b_sync_t(struct bufobj *, int waitfor);\ntypedef void b_bdflush_t(struct bufobj *, struct buf *);\n\nstruct buf_ops {\n\tchar\t\t*bop_name;\n\tb_write_t\t*bop_write;\n\tb_strategy_t\t*bop_strategy;\n\tb_sync_t\t*bop_sync;\n\tb_bdflush_t\t*bop_bdflush;\n};\n\n#define BO_STRATEGY(bo, bp)\t((bo)->bo_ops->bop_strategy((bo), (bp)))\n#define BO_SYNC(bo, w)\t\t((bo)->bo_ops->bop_sync((bo), (w)))\n#define BO_WRITE(bo, bp)\t((bo)->bo_ops->bop_write((bp)))\n#define BO_BDFLUSH(bo, bp)\t((bo)->bo_ops->bop_bdflush((bo), (bp)))\n\nstruct bufobj {\n\tstruct mtx\tbo_mtx;\t\t/* Mutex which protects \"i\" things */\n\tstruct bufv\tbo_clean;\t/* i Clean buffers */\n\tstruct bufv\tbo_dirty;\t/* i Dirty buffers */\n\tlong\t\tbo_numoutput;\t/* i Writes in progress */\n\tu_int\t\tbo_flag;\t/* i Flags */\n\tstruct buf_ops\t*bo_ops;\t/* - Buffer operations */\n\tint\t\tbo_bsize;\t/* - Block size for i/o */\n\tstruct vm_object *bo_object;\t/* v Place to store VM object */\n\tLIST_ENTRY(bufobj) bo_synclist;\t/* S dirty vnode list */\n\tvoid\t\t*bo_private;\t/* private pointer */\n\tstruct vnode\t*__bo_vnode;\t/*\n\t\t\t\t\t * XXX: This vnode pointer is here\n\t\t\t\t\t * XXX: only to keep the syncer working\n\t\t\t\t\t * XXX: for now.\n\t\t\t\t\t */\n};\n\n/*\n * XXX BO_ONWORKLST could be replaced with a check for NULL list elements\n * in v_synclist.\n */\n#define\tBO_ONWORKLST\t(1 << 0)\t/* On syncer work-list */\n#define\tBO_WWAIT\t(1 << 1)\t/* Wait for output to complete */\n#define\tBO_NEEDSGIANT\t(1 << 2)\t/* Require giant for child buffers. */\n\n#define\tBO_MTX(bo)\t\t(&(bo)->bo_mtx)\n#define\tBO_LOCK(bo)\t\tmtx_lock(BO_MTX((bo)))\n#define\tBO_UNLOCK(bo)\t\tmtx_unlock(BO_MTX((bo)))\n#define\tASSERT_BO_LOCKED(bo)\tmtx_assert(BO_MTX((bo)), MA_OWNED)\n#define\tASSERT_BO_UNLOCKED(bo)\tmtx_assert(BO_MTX((bo)), MA_NOTOWNED)\n\nvoid bufobj_wdrop(struct bufobj *bo);\nvoid bufobj_wref(struct bufobj *bo);\nvoid bufobj_wrefl(struct bufobj *bo);\nint bufobj_invalbuf(struct bufobj *bo, int flags, int slpflag, int slptimeo);\nint bufobj_wwait(struct bufobj *bo, int slpflag, int timeo);\nint bufsync(struct bufobj *bo, int waitfor);\nvoid bufbdflush(struct bufobj *bo, struct buf *bp);\n\n#endif /* defined(_KERNEL) || defined(_KVM_VNODE) */\n#endif /* _SYS_BUFOBJ_H_ */\n"
  },
  {
    "path": "freebsd-headers/sys/bus.h",
    "content": "/*-\n * Copyright (c) 1997,1998,2003 Doug Rabson\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/sys/bus.h 227977 2011-11-25 17:07:27Z marius $\n */\n\n#ifndef _SYS_BUS_H_\n#define _SYS_BUS_H_\n\n#include <machine/_limits.h>\n#include <sys/_bus_dma.h>\n\n/**\n * @defgroup NEWBUS newbus - a generic framework for managing devices\n * @{\n */\n\n/**\n * @brief Interface information structure.\n */\nstruct u_businfo {\n\tint\tub_version;\t\t/**< @brief interface version */\n#define BUS_USER_VERSION\t1\n\tint\tub_generation;\t\t/**< @brief generation count */\n};\n\n/**\n * @brief State of the device.\n */\ntypedef enum device_state {\n\tDS_NOTPRESENT = 10,\t\t/**< @brief not probed or probe failed */\n\tDS_ALIVE = 20,\t\t\t/**< @brief probe succeeded */\n\tDS_ATTACHED = 30,\t\t/**< @brief attach method called */\n\tDS_BUSY = 40\t\t\t/**< @brief device is open */\n} device_state_t;\n\n/**\n * @brief Device information exported to userspace.\n */\nstruct u_device {\n\tuintptr_t\tdv_handle;\n\tuintptr_t\tdv_parent;\n\n\tchar\t\tdv_name[32];\t\t/**< @brief Name of device in tree. */\n\tchar\t\tdv_desc[32];\t\t/**< @brief Driver description */\n\tchar\t\tdv_drivername[32];\t/**< @brief Driver name */\n\tchar\t\tdv_pnpinfo[128];\t/**< @brief Plug and play info */\n\tchar\t\tdv_location[128];\t/**< @brief Where is the device? */\n\tuint32_t\tdv_devflags;\t\t/**< @brief API Flags for device */\n\tuint16_t\tdv_flags;\t\t/**< @brief flags for dev date */\n\tdevice_state_t\tdv_state;\t\t/**< @brief State of attachment */\n\t/* XXX more driver info? */\n};\n\n#ifdef _KERNEL\n\n#include <sys/queue.h>\n#include <sys/kobj.h>\n\n/**\n * devctl hooks.  Typically one should use the devctl_notify\n * hook to send the message.  However, devctl_queue_data is also\n * included in case devctl_notify isn't sufficiently general.\n */\nboolean_t devctl_process_running(void);\nvoid devctl_notify_f(const char *__system, const char *__subsystem,\n    const char *__type, const char *__data, int __flags);\nvoid devctl_notify(const char *__system, const char *__subsystem,\n    const char *__type, const char *__data);\nvoid devctl_queue_data_f(char *__data, int __flags);\nvoid devctl_queue_data(char *__data);\n\n/**\n * @brief A device driver (included mainly for compatibility with\n * FreeBSD 4.x).\n */\ntypedef struct kobj_class\tdriver_t;\n\n/**\n * @brief A device class\n *\n * The devclass object has two main functions in the system. The first\n * is to manage the allocation of unit numbers for device instances\n * and the second is to hold the list of device drivers for a\n * particular bus type. Each devclass has a name and there cannot be\n * two devclasses with the same name. This ensures that unique unit\n * numbers are allocated to device instances.\n *\n * Drivers that support several different bus attachments (e.g. isa,\n * pci, pccard) should all use the same devclass to ensure that unit\n * numbers do not conflict.\n *\n * Each devclass may also have a parent devclass. This is used when\n * searching for device drivers to allow a form of inheritance. When\n * matching drivers with devices, first the driver list of the parent\n * device's devclass is searched. If no driver is found in that list,\n * the search continues in the parent devclass (if any).\n */\ntypedef struct devclass\t\t*devclass_t;\n\n/**\n * @brief A device method (included mainly for compatibility with\n * FreeBSD 4.x).\n */\n#define device_method_t\t\tkobj_method_t\n\n/**\n * @brief Driver interrupt filter return values\n *\n * If a driver provides an interrupt filter routine it must return an\n * integer consisting of oring together zero or more of the following\n * flags:\n *\n *\tFILTER_STRAY\t- this device did not trigger the interrupt\n *\tFILTER_HANDLED\t- the interrupt has been fully handled and can be EOId\n *\tFILTER_SCHEDULE_THREAD - the threaded interrupt handler should be\n *\t\t\t  scheduled to execute\n *\n * If the driver does not provide a filter, then the interrupt code will\n * act is if the filter had returned FILTER_SCHEDULE_THREAD.  Note that it\n * is illegal to specify any other flag with FILTER_STRAY and that it is\n * illegal to not specify either of FILTER_HANDLED or FILTER_SCHEDULE_THREAD\n * if FILTER_STRAY is not specified.\n */\n#define\tFILTER_STRAY\t\t0x01\n#define\tFILTER_HANDLED\t\t0x02\n#define\tFILTER_SCHEDULE_THREAD\t0x04\n\n/**\n * @brief Driver interrupt service routines\n *\n * The filter routine is run in primary interrupt context and may not\n * block or use regular mutexes.  It may only use spin mutexes for\n * synchronization.  The filter may either completely handle the\n * interrupt or it may perform some of the work and defer more\n * expensive work to the regular interrupt handler.  If a filter\n * routine is not registered by the driver, then the regular interrupt\n * handler is always used to handle interrupts from this device.\n *\n * The regular interrupt handler executes in its own thread context\n * and may use regular mutexes.  However, it is prohibited from\n * sleeping on a sleep queue.\n */\ntypedef int driver_filter_t(void*);\ntypedef void driver_intr_t(void*);\n\n/**\n * @brief Interrupt type bits.\n * \n * These flags are used both by newbus interrupt\n * registration (nexus.c) and also in struct intrec, which defines\n * interrupt properties.\n *\n * XXX We should probably revisit this and remove the vestiges of the\n * spls implicit in names like INTR_TYPE_TTY. In the meantime, don't\n * confuse things by renaming them (Grog, 18 July 2000).\n *\n * We define this in terms of bits because some devices may belong\n * to multiple classes (and therefore need to be included in\n * multiple interrupt masks, which is what this really serves to\n * indicate. Buses which do interrupt remapping will want to\n * change their type to reflect what sort of devices are underneath.\n */\nenum intr_type {\n\tINTR_TYPE_TTY = 1,\n\tINTR_TYPE_BIO = 2,\n\tINTR_TYPE_NET = 4,\n\tINTR_TYPE_CAM = 8,\n\tINTR_TYPE_MISC = 16,\n\tINTR_TYPE_CLK = 32,\n\tINTR_TYPE_AV = 64,\n\tINTR_EXCL = 256,\t\t/* exclusive interrupt */\n\tINTR_MPSAFE = 512,\t\t/* this interrupt is SMP safe */\n\tINTR_ENTROPY = 1024,\t\t/* this interrupt provides entropy */\n\tINTR_MD1 = 4096,\t\t/* flag reserved for MD use */\n\tINTR_MD2 = 8192,\t\t/* flag reserved for MD use */\n\tINTR_MD3 = 16384,\t\t/* flag reserved for MD use */\n\tINTR_MD4 = 32768\t\t/* flag reserved for MD use */\n};\n\nenum intr_trigger {\n\tINTR_TRIGGER_CONFORM = 0,\n\tINTR_TRIGGER_EDGE = 1,\n\tINTR_TRIGGER_LEVEL = 2\n};\n\nenum intr_polarity {\n\tINTR_POLARITY_CONFORM = 0,\n\tINTR_POLARITY_HIGH = 1,\n\tINTR_POLARITY_LOW = 2\n};\n\ntypedef int (*devop_t)(void);\n\n/**\n * @brief This structure is deprecated.\n *\n * Use the kobj(9) macro DEFINE_CLASS to\n * declare classes which implement device drivers.\n */\nstruct driver {\n\tKOBJ_CLASS_FIELDS;\n};\n\n/*\n * Definitions for drivers which need to keep simple lists of resources\n * for their child devices.\n */\nstruct\tresource;\n\n/**\n * @brief An entry for a single resource in a resource list.\n */\nstruct resource_list_entry {\n\tSTAILQ_ENTRY(resource_list_entry) link;\n\tint\ttype;\t\t\t/**< @brief type argument to alloc_resource */\n\tint\trid;\t\t\t/**< @brief resource identifier */\n\tint\tflags;\t\t\t/**< @brief resource flags */\n\tstruct\tresource *res;\t\t/**< @brief the real resource when allocated */\n\tu_long\tstart;\t\t\t/**< @brief start of resource range */\n\tu_long\tend;\t\t\t/**< @brief end of resource range */\n\tu_long\tcount;\t\t\t/**< @brief count within range */\n};\nSTAILQ_HEAD(resource_list, resource_list_entry);\n\n#define\tRLE_RESERVED\t\t0x0001\t/* Reserved by the parent bus. */\n#define\tRLE_ALLOCATED\t\t0x0002\t/* Reserved resource is allocated. */\n#define\tRLE_PREFETCH\t\t0x0004\t/* Resource is a prefetch range. */\n\nvoid\tresource_list_init(struct resource_list *rl);\nvoid\tresource_list_free(struct resource_list *rl);\nstruct resource_list_entry *\n\tresource_list_add(struct resource_list *rl,\n\t\t\t  int type, int rid,\n\t\t\t  u_long start, u_long end, u_long count);\nint\tresource_list_add_next(struct resource_list *rl,\n\t\t\t  int type,\n\t\t\t  u_long start, u_long end, u_long count);\nint\tresource_list_busy(struct resource_list *rl,\n\t\t\t   int type, int rid);\nint\tresource_list_reserved(struct resource_list *rl, int type, int rid);\nstruct resource_list_entry*\n\tresource_list_find(struct resource_list *rl,\n\t\t\t   int type, int rid);\nvoid\tresource_list_delete(struct resource_list *rl,\n\t\t\t     int type, int rid);\nstruct resource *\n\tresource_list_alloc(struct resource_list *rl,\n\t\t\t    device_t bus, device_t child,\n\t\t\t    int type, int *rid,\n\t\t\t    u_long start, u_long end,\n\t\t\t    u_long count, u_int flags);\nint\tresource_list_release(struct resource_list *rl,\n\t\t\t      device_t bus, device_t child,\n\t\t\t      int type, int rid, struct resource *res);\nstruct resource *\n\tresource_list_reserve(struct resource_list *rl,\n\t\t\t      device_t bus, device_t child,\n\t\t\t      int type, int *rid,\n\t\t\t      u_long start, u_long end,\n\t\t\t      u_long count, u_int flags);\nint\tresource_list_unreserve(struct resource_list *rl,\n\t\t\t\tdevice_t bus, device_t child,\n\t\t\t\tint type, int rid);\nvoid\tresource_list_purge(struct resource_list *rl);\nint\tresource_list_print_type(struct resource_list *rl,\n\t\t\t\t const char *name, int type,\n\t\t\t\t const char *format);\n\n/*\n * The root bus, to which all top-level busses are attached.\n */\nextern device_t root_bus;\nextern devclass_t root_devclass;\nvoid\troot_bus_configure(void);\n\n/*\n * Useful functions for implementing busses.\n */\n\nint\tbus_generic_activate_resource(device_t dev, device_t child, int type,\n\t\t\t\t      int rid, struct resource *r);\ndevice_t\n\tbus_generic_add_child(device_t dev, u_int order, const char *name,\n\t\t\t      int unit);\nint\tbus_generic_adjust_resource(device_t bus, device_t child, int type,\n\t\t\t\t    struct resource *r, u_long start,\n\t\t\t\t    u_long end);\nstruct resource *\n\tbus_generic_alloc_resource(device_t bus, device_t child, int type,\n\t\t\t\t   int *rid, u_long start, u_long end,\n\t\t\t\t   u_long count, u_int flags);\nint\tbus_generic_attach(device_t dev);\nint\tbus_generic_bind_intr(device_t dev, device_t child,\n\t\t\t      struct resource *irq, int cpu);\nint\tbus_generic_child_present(device_t dev, device_t child);\nint\tbus_generic_config_intr(device_t, int, enum intr_trigger,\n\t\t\t\tenum intr_polarity);\nint\tbus_generic_describe_intr(device_t dev, device_t child,\n\t\t\t\t  struct resource *irq, void *cookie,\n\t\t\t\t  const char *descr);\nint\tbus_generic_deactivate_resource(device_t dev, device_t child, int type,\n\t\t\t\t\tint rid, struct resource *r);\nint\tbus_generic_detach(device_t dev);\nvoid\tbus_generic_driver_added(device_t dev, driver_t *driver);\nbus_dma_tag_t\n\tbus_generic_get_dma_tag(device_t dev, device_t child);\nstruct resource_list *\n\tbus_generic_get_resource_list (device_t, device_t);\nvoid\tbus_generic_new_pass(device_t dev);\nint\tbus_print_child_header(device_t dev, device_t child);\nint\tbus_print_child_footer(device_t dev, device_t child);\nint\tbus_generic_print_child(device_t dev, device_t child);\nint\tbus_generic_probe(device_t dev);\nint\tbus_generic_read_ivar(device_t dev, device_t child, int which,\n\t\t\t      uintptr_t *result);\nint\tbus_generic_release_resource(device_t bus, device_t child,\n\t\t\t\t     int type, int rid, struct resource *r);\nint\tbus_generic_resume(device_t dev);\nint\tbus_generic_setup_intr(device_t dev, device_t child,\n\t\t\t       struct resource *irq, int flags,\n\t\t\t       driver_filter_t *filter, driver_intr_t *intr, \n\t\t\t       void *arg, void **cookiep);\n\nstruct resource *\n\tbus_generic_rl_alloc_resource (device_t, device_t, int, int *,\n\t\t\t\t       u_long, u_long, u_long, u_int);\nvoid\tbus_generic_rl_delete_resource (device_t, device_t, int, int);\nint\tbus_generic_rl_get_resource (device_t, device_t, int, int, u_long *,\n\t\t\t\t     u_long *);\nint\tbus_generic_rl_set_resource (device_t, device_t, int, int, u_long,\n\t\t\t\t     u_long);\nint\tbus_generic_rl_release_resource (device_t, device_t, int, int,\n\t\t\t\t\t struct resource *);\n\nint\tbus_generic_shutdown(device_t dev);\nint\tbus_generic_suspend(device_t dev);\nint\tbus_generic_teardown_intr(device_t dev, device_t child,\n\t\t\t\t  struct resource *irq, void *cookie);\nint\tbus_generic_write_ivar(device_t dev, device_t child, int which,\n\t\t\t       uintptr_t value);\n\n/*\n * Wrapper functions for the BUS_*_RESOURCE methods to make client code\n * a little simpler.\n */\n\nstruct resource_spec {\n\tint\ttype;\n\tint\trid;\n\tint\tflags;\n};\n\nint\tbus_alloc_resources(device_t dev, struct resource_spec *rs,\n\t\t\t    struct resource **res);\nvoid\tbus_release_resources(device_t dev, const struct resource_spec *rs,\n\t\t\t      struct resource **res);\n\nint\tbus_adjust_resource(device_t child, int type, struct resource *r,\n\t\t\t    u_long start, u_long end);\nstruct\tresource *bus_alloc_resource(device_t dev, int type, int *rid,\n\t\t\t\t     u_long start, u_long end, u_long count,\n\t\t\t\t     u_int flags);\nint\tbus_activate_resource(device_t dev, int type, int rid,\n\t\t\t      struct resource *r);\nint\tbus_deactivate_resource(device_t dev, int type, int rid,\n\t\t\t\tstruct resource *r);\nbus_dma_tag_t bus_get_dma_tag(device_t dev);\nint\tbus_release_resource(device_t dev, int type, int rid,\n\t\t\t     struct resource *r);\nint\tbus_free_resource(device_t dev, int type, struct resource *r);\nint\tbus_setup_intr(device_t dev, struct resource *r, int flags,\n\t\t       driver_filter_t filter, driver_intr_t handler, \n\t\t       void *arg, void **cookiep);\nint\tbus_teardown_intr(device_t dev, struct resource *r, void *cookie);\nint\tbus_bind_intr(device_t dev, struct resource *r, int cpu);\nint\tbus_describe_intr(device_t dev, struct resource *irq, void *cookie,\n\t\t\t  const char *fmt, ...);\nint\tbus_set_resource(device_t dev, int type, int rid,\n\t\t\t u_long start, u_long count);\nint\tbus_get_resource(device_t dev, int type, int rid,\n\t\t\t u_long *startp, u_long *countp);\nu_long\tbus_get_resource_start(device_t dev, int type, int rid);\nu_long\tbus_get_resource_count(device_t dev, int type, int rid);\nvoid\tbus_delete_resource(device_t dev, int type, int rid);\nint\tbus_child_present(device_t child);\nint\tbus_child_pnpinfo_str(device_t child, char *buf, size_t buflen);\nint\tbus_child_location_str(device_t child, char *buf, size_t buflen);\nvoid\tbus_enumerate_hinted_children(device_t bus);\n\nstatic __inline struct resource *\nbus_alloc_resource_any(device_t dev, int type, int *rid, u_int flags)\n{\n\treturn (bus_alloc_resource(dev, type, rid, 0ul, ~0ul, 1, flags));\n}\n\n/*\n * Access functions for device.\n */\ndevice_t\tdevice_add_child(device_t dev, const char *name, int unit);\ndevice_t\tdevice_add_child_ordered(device_t dev, u_int order,\n\t\t\t\t\t const char *name, int unit);\nvoid\tdevice_busy(device_t dev);\nint\tdevice_delete_child(device_t dev, device_t child);\nint\tdevice_attach(device_t dev);\nint\tdevice_detach(device_t dev);\nvoid\tdevice_disable(device_t dev);\nvoid\tdevice_enable(device_t dev);\ndevice_t\tdevice_find_child(device_t dev, const char *classname,\n\t\t\t\t  int unit);\nconst char\t*device_get_desc(device_t dev);\ndevclass_t\tdevice_get_devclass(device_t dev);\ndriver_t\t*device_get_driver(device_t dev);\nu_int32_t\tdevice_get_flags(device_t dev);\ndevice_t\tdevice_get_parent(device_t dev);\nint\tdevice_get_children(device_t dev, device_t **listp, int *countp);\nvoid\t*device_get_ivars(device_t dev);\nvoid\tdevice_set_ivars(device_t dev, void *ivars);\nconst\tchar *device_get_name(device_t dev);\nconst\tchar *device_get_nameunit(device_t dev);\nvoid\t*device_get_softc(device_t dev);\ndevice_state_t\tdevice_get_state(device_t dev);\nint\tdevice_get_unit(device_t dev);\nstruct sysctl_ctx_list *device_get_sysctl_ctx(device_t dev);\nstruct sysctl_oid *device_get_sysctl_tree(device_t dev);\nint\tdevice_is_alive(device_t dev);\t/* did probe succeed? */\nint\tdevice_is_attached(device_t dev);\t/* did attach succeed? */\nint\tdevice_is_enabled(device_t dev);\nint\tdevice_is_quiet(device_t dev);\nint\tdevice_print_prettyname(device_t dev);\nint\tdevice_printf(device_t dev, const char *, ...) __printflike(2, 3);\nint\tdevice_probe(device_t dev);\nint\tdevice_probe_and_attach(device_t dev);\nint\tdevice_probe_child(device_t bus, device_t dev);\nint\tdevice_quiesce(device_t dev);\nvoid\tdevice_quiet(device_t dev);\nvoid\tdevice_set_desc(device_t dev, const char* desc);\nvoid\tdevice_set_desc_copy(device_t dev, const char* desc);\nint\tdevice_set_devclass(device_t dev, const char *classname);\nint\tdevice_set_driver(device_t dev, driver_t *driver);\nvoid\tdevice_set_flags(device_t dev, u_int32_t flags);\nvoid\tdevice_set_softc(device_t dev, void *softc);\nint\tdevice_set_unit(device_t dev, int unit);\t/* XXX DONT USE XXX */\nint\tdevice_shutdown(device_t dev);\nvoid\tdevice_unbusy(device_t dev);\nvoid\tdevice_verbose(device_t dev);\n\n/*\n * Access functions for devclass.\n */\nint\t\tdevclass_add_driver(devclass_t dc, driver_t *driver,\n\t\t\t\t    int pass, devclass_t *dcp);\ndevclass_t\tdevclass_create(const char *classname);\nint\t\tdevclass_delete_driver(devclass_t busclass, driver_t *driver);\ndevclass_t\tdevclass_find(const char *classname);\nconst char\t*devclass_get_name(devclass_t dc);\ndevice_t\tdevclass_get_device(devclass_t dc, int unit);\nvoid\t*devclass_get_softc(devclass_t dc, int unit);\nint\tdevclass_get_devices(devclass_t dc, device_t **listp, int *countp);\nint\tdevclass_get_drivers(devclass_t dc, driver_t ***listp, int *countp);\nint\tdevclass_get_count(devclass_t dc);\nint\tdevclass_get_maxunit(devclass_t dc);\nint\tdevclass_find_free_unit(devclass_t dc, int unit);\nvoid\tdevclass_set_parent(devclass_t dc, devclass_t pdc);\ndevclass_t\tdevclass_get_parent(devclass_t dc);\nstruct sysctl_ctx_list *devclass_get_sysctl_ctx(devclass_t dc);\nstruct sysctl_oid *devclass_get_sysctl_tree(devclass_t dc);\n\n/*\n * Access functions for device resources.\n */\n\nint\tresource_int_value(const char *name, int unit, const char *resname,\n\t\t\t   int *result);\nint\tresource_long_value(const char *name, int unit, const char *resname,\n\t\t\t    long *result);\nint\tresource_string_value(const char *name, int unit, const char *resname,\n\t\t\t      const char **result);\nint\tresource_disabled(const char *name, int unit);\nint\tresource_find_match(int *anchor, const char **name, int *unit,\n\t\t\t    const char *resname, const char *value);\nint\tresource_find_dev(int *anchor, const char *name, int *unit,\n\t\t\t  const char *resname, const char *value);\nint\tresource_set_int(const char *name, int unit, const char *resname,\n\t\t\t int value);\nint\tresource_set_long(const char *name, int unit, const char *resname,\n\t\t\t  long value);\nint\tresource_set_string(const char *name, int unit, const char *resname,\n\t\t\t    const char *value);\n/*\n * Functions for maintaining and checking consistency of\n * bus information exported to userspace.\n */\nint\tbus_data_generation_check(int generation);\nvoid\tbus_data_generation_update(void);\n\n/**\n * Some convenience defines for probe routines to return.  These are just\n * suggested values, and there's nothing magical about them.\n * BUS_PROBE_SPECIFIC is for devices that cannot be reprobed, and that no\n * possible other driver may exist (typically legacy drivers who don't fallow\n * all the rules, or special needs drivers).  BUS_PROBE_VENDOR is the\n * suggested value that vendor supplied drivers use.  This is for source or\n * binary drivers that are not yet integrated into the FreeBSD tree.  Its use\n * in the base OS is prohibited.  BUS_PROBE_DEFAULT is the normal return value\n * for drivers to use.  It is intended that nearly all of the drivers in the\n * tree should return this value.  BUS_PROBE_LOW_PRIORITY are for drivers that\n * have special requirements like when there are two drivers that support\n * overlapping series of hardware devices.  In this case the one that supports\n * the older part of the line would return this value, while the one that\n * supports the newer ones would return BUS_PROBE_DEFAULT.  BUS_PROBE_GENERIC\n * is for drivers that wish to have a generic form and a specialized form,\n * like is done with the pci bus and the acpi pci bus.  BUS_PROBE_HOOVER is\n * for those busses that implement a generic device place-holder for devices on\n * the bus that have no more specific river for them (aka ugen).\n * BUS_PROBE_NOWILDCARD or lower means that the device isn't really bidding\n * for a device node, but accepts only devices that its parent has told it\n * use this driver.\n */\n#define BUS_PROBE_SPECIFIC\t0\t/* Only I can use this device */\n#define BUS_PROBE_VENDOR\t(-10)\t/* Vendor supplied driver */\n#define BUS_PROBE_DEFAULT\t(-20)\t/* Base OS default driver */\n#define BUS_PROBE_LOW_PRIORITY\t(-40)\t/* Older, less desirable drivers */\n#define BUS_PROBE_GENERIC\t(-100)\t/* generic driver for dev */\n#define BUS_PROBE_HOOVER\t(-500)\t/* Generic dev for all devs on bus */\n#define BUS_PROBE_NOWILDCARD\t(-2000000000) /* No wildcard device matches */\n\n/**\n * During boot, the device tree is scanned multiple times.  Each scan,\n * or pass, drivers may be attached to devices.  Each driver\n * attachment is assigned a pass number.  Drivers may only probe and\n * attach to devices if their pass number is less than or equal to the\n * current system-wide pass number.  The default pass is the last pass\n * and is used by most drivers.  Drivers needed by the scheduler are\n * probed in earlier passes.\n */\n#define\tBUS_PASS_ROOT\t\t0\t/* Used to attach root0. */\n#define\tBUS_PASS_BUS\t\t10\t/* Busses and bridges. */\n#define\tBUS_PASS_CPU\t\t20\t/* CPU devices. */\n#define\tBUS_PASS_RESOURCE\t30\t/* Resource discovery. */\n#define\tBUS_PASS_INTERRUPT\t40\t/* Interrupt controllers. */\n#define\tBUS_PASS_TIMER\t\t50\t/* Timers and clocks. */\n#define\tBUS_PASS_SCHEDULER\t60\t/* Start scheduler. */\n#define\tBUS_PASS_DEFAULT\t__INT_MAX /* Everything else. */\n\nextern int bus_current_pass;\n\nvoid\tbus_set_pass(int pass);\n\n/**\n * Shorthands for constructing method tables.\n */\n#define\tDEVMETHOD\tKOBJMETHOD\n#define\tDEVMETHOD_END\tKOBJMETHOD_END\n\n/*\n * Some common device interfaces.\n */\n#include \"device_if.h\"\n#include \"bus_if.h\"\n\nstruct\tmodule;\n\nint\tdriver_module_handler(struct module *, int, void *);\n\n/**\n * Module support for automatically adding drivers to busses.\n */\nstruct driver_module_data {\n\tint\t\t(*dmd_chainevh)(struct module *, int, void *);\n\tvoid\t\t*dmd_chainarg;\n\tconst char\t*dmd_busname;\n\tkobj_class_t\tdmd_driver;\n\tdevclass_t\t*dmd_devclass;\n\tint\t\tdmd_pass;\n};\n\n#define\tEARLY_DRIVER_MODULE_ORDERED(name, busname, driver, devclass,\t\\\n    evh, arg, order, pass)\t\t\t\t\t\t\\\n\t\t\t\t\t\t\t\t\t\\\nstatic struct driver_module_data name##_##busname##_driver_mod = {\t\\\n\tevh, arg,\t\t\t\t\t\t\t\\\n\t#busname,\t\t\t\t\t\t\t\\\n\t(kobj_class_t) &driver,\t\t\t\t\t\t\\\n\t&devclass,\t\t\t\t\t\t\t\\\n\tpass\t\t\t\t\t\t\t\t\\\n};\t\t\t\t\t\t\t\t\t\\\n\t\t\t\t\t\t\t\t\t\\\nstatic moduledata_t name##_##busname##_mod = {\t\t\t\t\\\n\t#busname \"/\" #name,\t\t\t\t\t\t\\\n\tdriver_module_handler,\t\t\t\t\t\t\\\n\t&name##_##busname##_driver_mod\t\t\t\t\t\\\n};\t\t\t\t\t\t\t\t\t\\\nDECLARE_MODULE(name##_##busname, name##_##busname##_mod,\t\t\\\n\t       SI_SUB_DRIVERS, order)\n\n#define\tEARLY_DRIVER_MODULE(name, busname, driver, devclass, evh, arg, pass) \\\n\tEARLY_DRIVER_MODULE_ORDERED(name, busname, driver, devclass,\t\\\n\t    evh, arg, SI_ORDER_MIDDLE, pass)\n\n#define\tDRIVER_MODULE_ORDERED(name, busname, driver, devclass, evh, arg,\\\n    order)\t\t\t\t\t\t\t\t\\\n\tEARLY_DRIVER_MODULE_ORDERED(name, busname, driver, devclass,\t\\\n\t    evh, arg, order, BUS_PASS_DEFAULT)\n\n#define\tDRIVER_MODULE(name, busname, driver, devclass, evh, arg)\t\\\n\tEARLY_DRIVER_MODULE(name, busname, driver, devclass, evh, arg,\t\\\n\t    BUS_PASS_DEFAULT)\n\n/**\n * Generic ivar accessor generation macros for bus drivers\n */\n#define __BUS_ACCESSOR(varp, var, ivarp, ivar, type)\t\t\t\\\n\t\t\t\t\t\t\t\t\t\\\nstatic __inline type varp ## _get_ ## var(device_t dev)\t\t\t\\\n{\t\t\t\t\t\t\t\t\t\\\n\tuintptr_t v;\t\t\t\t\t\t\t\\\n\tBUS_READ_IVAR(device_get_parent(dev), dev,\t\t\t\\\n\t    ivarp ## _IVAR_ ## ivar, &v);\t\t\t\t\\\n\treturn ((type) v);\t\t\t\t\t\t\\\n}\t\t\t\t\t\t\t\t\t\\\n\t\t\t\t\t\t\t\t\t\\\nstatic __inline void varp ## _set_ ## var(device_t dev, type t)\t\t\\\n{\t\t\t\t\t\t\t\t\t\\\n\tuintptr_t v = (uintptr_t) t;\t\t\t\t\t\\\n\tBUS_WRITE_IVAR(device_get_parent(dev), dev,\t\t\t\\\n\t    ivarp ## _IVAR_ ## ivar, v);\t\t\t\t\\\n}\n\n/**\n * Shorthand macros, taking resource argument\n * Generated with sys/tools/bus_macro.sh\n */\n\n#define bus_barrier(r, o, l, f) \\\n\tbus_space_barrier((r)->r_bustag, (r)->r_bushandle, (o), (l), (f))\n#define bus_read_1(r, o) \\\n\tbus_space_read_1((r)->r_bustag, (r)->r_bushandle, (o))\n#define bus_read_multi_1(r, o, d, c) \\\n\tbus_space_read_multi_1((r)->r_bustag, (r)->r_bushandle, (o), (d), (c))\n#define bus_read_region_1(r, o, d, c) \\\n\tbus_space_read_region_1((r)->r_bustag, (r)->r_bushandle, (o), (d), (c))\n#define bus_set_multi_1(r, o, v, c) \\\n\tbus_space_set_multi_1((r)->r_bustag, (r)->r_bushandle, (o), (v), (c))\n#define bus_set_region_1(r, o, v, c) \\\n\tbus_space_set_region_1((r)->r_bustag, (r)->r_bushandle, (o), (v), (c))\n#define bus_write_1(r, o, v) \\\n\tbus_space_write_1((r)->r_bustag, (r)->r_bushandle, (o), (v))\n#define bus_write_multi_1(r, o, d, c) \\\n\tbus_space_write_multi_1((r)->r_bustag, (r)->r_bushandle, (o), (d), (c))\n#define bus_write_region_1(r, o, d, c) \\\n\tbus_space_write_region_1((r)->r_bustag, (r)->r_bushandle, (o), (d), (c))\n#define bus_read_stream_1(r, o) \\\n\tbus_space_read_stream_1((r)->r_bustag, (r)->r_bushandle, (o))\n#define bus_read_multi_stream_1(r, o, d, c) \\\n\tbus_space_read_multi_stream_1((r)->r_bustag, (r)->r_bushandle, (o), (d), (c))\n#define bus_read_region_stream_1(r, o, d, c) \\\n\tbus_space_read_region_stream_1((r)->r_bustag, (r)->r_bushandle, (o), (d), (c))\n#define bus_set_multi_stream_1(r, o, v, c) \\\n\tbus_space_set_multi_stream_1((r)->r_bustag, (r)->r_bushandle, (o), (v), (c))\n#define bus_set_region_stream_1(r, o, v, c) \\\n\tbus_space_set_region_stream_1((r)->r_bustag, (r)->r_bushandle, (o), (v), (c))\n#define bus_write_stream_1(r, o, v) \\\n\tbus_space_write_stream_1((r)->r_bustag, (r)->r_bushandle, (o), (v))\n#define bus_write_multi_stream_1(r, o, d, c) \\\n\tbus_space_write_multi_stream_1((r)->r_bustag, (r)->r_bushandle, (o), (d), (c))\n#define bus_write_region_stream_1(r, o, d, c) \\\n\tbus_space_write_region_stream_1((r)->r_bustag, (r)->r_bushandle, (o), (d), (c))\n#define bus_read_2(r, o) \\\n\tbus_space_read_2((r)->r_bustag, (r)->r_bushandle, (o))\n#define bus_read_multi_2(r, o, d, c) \\\n\tbus_space_read_multi_2((r)->r_bustag, (r)->r_bushandle, (o), (d), (c))\n#define bus_read_region_2(r, o, d, c) \\\n\tbus_space_read_region_2((r)->r_bustag, (r)->r_bushandle, (o), (d), (c))\n#define bus_set_multi_2(r, o, v, c) \\\n\tbus_space_set_multi_2((r)->r_bustag, (r)->r_bushandle, (o), (v), (c))\n#define bus_set_region_2(r, o, v, c) \\\n\tbus_space_set_region_2((r)->r_bustag, (r)->r_bushandle, (o), (v), (c))\n#define bus_write_2(r, o, v) \\\n\tbus_space_write_2((r)->r_bustag, (r)->r_bushandle, (o), (v))\n#define bus_write_multi_2(r, o, d, c) \\\n\tbus_space_write_multi_2((r)->r_bustag, (r)->r_bushandle, (o), (d), (c))\n#define bus_write_region_2(r, o, d, c) \\\n\tbus_space_write_region_2((r)->r_bustag, (r)->r_bushandle, (o), (d), (c))\n#define bus_read_stream_2(r, o) \\\n\tbus_space_read_stream_2((r)->r_bustag, (r)->r_bushandle, (o))\n#define bus_read_multi_stream_2(r, o, d, c) \\\n\tbus_space_read_multi_stream_2((r)->r_bustag, (r)->r_bushandle, (o), (d), (c))\n#define bus_read_region_stream_2(r, o, d, c) \\\n\tbus_space_read_region_stream_2((r)->r_bustag, (r)->r_bushandle, (o), (d), (c))\n#define bus_set_multi_stream_2(r, o, v, c) \\\n\tbus_space_set_multi_stream_2((r)->r_bustag, (r)->r_bushandle, (o), (v), (c))\n#define bus_set_region_stream_2(r, o, v, c) \\\n\tbus_space_set_region_stream_2((r)->r_bustag, (r)->r_bushandle, (o), (v), (c))\n#define bus_write_stream_2(r, o, v) \\\n\tbus_space_write_stream_2((r)->r_bustag, (r)->r_bushandle, (o), (v))\n#define bus_write_multi_stream_2(r, o, d, c) \\\n\tbus_space_write_multi_stream_2((r)->r_bustag, (r)->r_bushandle, (o), (d), (c))\n#define bus_write_region_stream_2(r, o, d, c) \\\n\tbus_space_write_region_stream_2((r)->r_bustag, (r)->r_bushandle, (o), (d), (c))\n#define bus_read_4(r, o) \\\n\tbus_space_read_4((r)->r_bustag, (r)->r_bushandle, (o))\n#define bus_read_multi_4(r, o, d, c) \\\n\tbus_space_read_multi_4((r)->r_bustag, (r)->r_bushandle, (o), (d), (c))\n#define bus_read_region_4(r, o, d, c) \\\n\tbus_space_read_region_4((r)->r_bustag, (r)->r_bushandle, (o), (d), (c))\n#define bus_set_multi_4(r, o, v, c) \\\n\tbus_space_set_multi_4((r)->r_bustag, (r)->r_bushandle, (o), (v), (c))\n#define bus_set_region_4(r, o, v, c) \\\n\tbus_space_set_region_4((r)->r_bustag, (r)->r_bushandle, (o), (v), (c))\n#define bus_write_4(r, o, v) \\\n\tbus_space_write_4((r)->r_bustag, (r)->r_bushandle, (o), (v))\n#define bus_write_multi_4(r, o, d, c) \\\n\tbus_space_write_multi_4((r)->r_bustag, (r)->r_bushandle, (o), (d), (c))\n#define bus_write_region_4(r, o, d, c) \\\n\tbus_space_write_region_4((r)->r_bustag, (r)->r_bushandle, (o), (d), (c))\n#define bus_read_stream_4(r, o) \\\n\tbus_space_read_stream_4((r)->r_bustag, (r)->r_bushandle, (o))\n#define bus_read_multi_stream_4(r, o, d, c) \\\n\tbus_space_read_multi_stream_4((r)->r_bustag, (r)->r_bushandle, (o), (d), (c))\n#define bus_read_region_stream_4(r, o, d, c) \\\n\tbus_space_read_region_stream_4((r)->r_bustag, (r)->r_bushandle, (o), (d), (c))\n#define bus_set_multi_stream_4(r, o, v, c) \\\n\tbus_space_set_multi_stream_4((r)->r_bustag, (r)->r_bushandle, (o), (v), (c))\n#define bus_set_region_stream_4(r, o, v, c) \\\n\tbus_space_set_region_stream_4((r)->r_bustag, (r)->r_bushandle, (o), (v), (c))\n#define bus_write_stream_4(r, o, v) \\\n\tbus_space_write_stream_4((r)->r_bustag, (r)->r_bushandle, (o), (v))\n#define bus_write_multi_stream_4(r, o, d, c) \\\n\tbus_space_write_multi_stream_4((r)->r_bustag, (r)->r_bushandle, (o), (d), (c))\n#define bus_write_region_stream_4(r, o, d, c) \\\n\tbus_space_write_region_stream_4((r)->r_bustag, (r)->r_bushandle, (o), (d), (c))\n#define bus_read_8(r, o) \\\n\tbus_space_read_8((r)->r_bustag, (r)->r_bushandle, (o))\n#define bus_read_multi_8(r, o, d, c) \\\n\tbus_space_read_multi_8((r)->r_bustag, (r)->r_bushandle, (o), (d), (c))\n#define bus_read_region_8(r, o, d, c) \\\n\tbus_space_read_region_8((r)->r_bustag, (r)->r_bushandle, (o), (d), (c))\n#define bus_set_multi_8(r, o, v, c) \\\n\tbus_space_set_multi_8((r)->r_bustag, (r)->r_bushandle, (o), (v), (c))\n#define bus_set_region_8(r, o, v, c) \\\n\tbus_space_set_region_8((r)->r_bustag, (r)->r_bushandle, (o), (v), (c))\n#define bus_write_8(r, o, v) \\\n\tbus_space_write_8((r)->r_bustag, (r)->r_bushandle, (o), (v))\n#define bus_write_multi_8(r, o, d, c) \\\n\tbus_space_write_multi_8((r)->r_bustag, (r)->r_bushandle, (o), (d), (c))\n#define bus_write_region_8(r, o, d, c) \\\n\tbus_space_write_region_8((r)->r_bustag, (r)->r_bushandle, (o), (d), (c))\n#define bus_read_stream_8(r, o) \\\n\tbus_space_read_stream_8((r)->r_bustag, (r)->r_bushandle, (o))\n#define bus_read_multi_stream_8(r, o, d, c) \\\n\tbus_space_read_multi_stream_8((r)->r_bustag, (r)->r_bushandle, (o), (d), (c))\n#define bus_read_region_stream_8(r, o, d, c) \\\n\tbus_space_read_region_stream_8((r)->r_bustag, (r)->r_bushandle, (o), (d), (c))\n#define bus_set_multi_stream_8(r, o, v, c) \\\n\tbus_space_set_multi_stream_8((r)->r_bustag, (r)->r_bushandle, (o), (v), (c))\n#define bus_set_region_stream_8(r, o, v, c) \\\n\tbus_space_set_region_stream_8((r)->r_bustag, (r)->r_bushandle, (o), (v), (c))\n#define bus_write_stream_8(r, o, v) \\\n\tbus_space_write_stream_8((r)->r_bustag, (r)->r_bushandle, (o), (v))\n#define bus_write_multi_stream_8(r, o, d, c) \\\n\tbus_space_write_multi_stream_8((r)->r_bustag, (r)->r_bushandle, (o), (d), (c))\n#define bus_write_region_stream_8(r, o, d, c) \\\n\tbus_space_write_region_stream_8((r)->r_bustag, (r)->r_bushandle, (o), (d), (c))\n#endif /* _KERNEL */\n\n#endif /* !_SYS_BUS_H_ */\n"
  },
  {
    "path": "freebsd-headers/sys/bus_dma.h",
    "content": "/*\t$NetBSD: bus.h,v 1.12 1997/10/01 08:25:15 fvdl Exp $\t*/\n\n/*-\n * Copyright (c) 1996, 1997 The NetBSD Foundation, Inc.\n * All rights reserved.\n *\n * This code is derived from software contributed to The NetBSD Foundation\n * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility,\n * NASA Ames Research Center.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. All advertising materials mentioning features or use of this software\n *    must display the following acknowledgement:\n *\tThis product includes software developed by the NetBSD\n *\tFoundation, Inc. and its contributors.\n * 4. Neither the name of The NetBSD Foundation nor the names of its\n *    contributors may be used to endorse or promote products derived\n *    from this software without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS\n * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED\n * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\n * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS\n * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\n * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\n * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\n * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\n * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\n/*-\n * Copyright (c) 1996 Charles M. Hannum.  All rights reserved.\n * Copyright (c) 1996 Christopher G. Demetriou.  All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. All advertising materials mentioning features or use of this software\n *    must display the following acknowledgement:\n *      This product includes software developed by Christopher G. Demetriou\n *\tfor the NetBSD Project.\n * 4. The name of the author may not be used to endorse or promote products\n *    derived from this software without specific prior written permission\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR\n * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES\n * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,\n * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF\n * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n */\n/* $FreeBSD: release/9.0.0/sys/sys/bus_dma.h 188350 2009-02-08 22:54:58Z imp $ */\n\n#ifndef _BUS_DMA_H_\n#define _BUS_DMA_H_\n\n#include <sys/_bus_dma.h>\n\n/*\n * Machine independent interface for mapping physical addresses to peripheral\n * bus 'physical' addresses, and assisting with DMA operations.\n *\n * XXX This file is always included from <machine/bus_dma.h> and should not\n *     (yet) be included directly.\n */\n\n/*\n * Flags used in various bus DMA methods.\n */\n#define\tBUS_DMA_WAITOK\t\t0x00\t/* safe to sleep (pseudo-flag) */\n#define\tBUS_DMA_NOWAIT\t\t0x01\t/* not safe to sleep */\n#define\tBUS_DMA_ALLOCNOW\t0x02\t/* perform resource allocation now */\n#define\tBUS_DMA_COHERENT\t0x04\t/* hint: map memory in a coherent way */\n#define\tBUS_DMA_ZERO\t\t0x08\t/* allocate zero'ed memory */\n#define\tBUS_DMA_BUS1\t\t0x10\t/* placeholders for bus functions... */\n#define\tBUS_DMA_BUS2\t\t0x20\n#define\tBUS_DMA_BUS3\t\t0x40\n#define\tBUS_DMA_BUS4\t\t0x80\n\n/*\n * The following two flags are non-standard or specific to only certain\n * architectures\n */\n#define\tBUS_DMA_NOWRITE\t\t0x100\n#define\tBUS_DMA_NOCACHE\t\t0x200\n\n/*\n * The following flag is a DMA tag hint that the page offset of the\n * loaded kernel virtual address must be preserved in the first\n * physical segment address, when the KVA is loaded into DMA.\n */\n#define\tBUS_DMA_KEEP_PG_OFFSET\t0x400\n\n/* Forwards needed by prototypes below. */\nstruct mbuf;\nstruct uio;\n\n/*\n * Operations performed by bus_dmamap_sync().\n */\n#define\tBUS_DMASYNC_PREREAD\t1\n#define\tBUS_DMASYNC_POSTREAD\t2\n#define\tBUS_DMASYNC_PREWRITE\t4\n#define\tBUS_DMASYNC_POSTWRITE\t8\n\n/*\n *\tbus_dma_segment_t\n *\n *\tDescribes a single contiguous DMA transaction.  Values\n *\tare suitable for programming into DMA registers.\n */\ntypedef struct bus_dma_segment {\n\tbus_addr_t\tds_addr;\t/* DMA address */\n\tbus_size_t\tds_len;\t\t/* length of transfer */\n} bus_dma_segment_t;\n\n/*\n * A function that returns 1 if the address cannot be accessed by\n * a device and 0 if it can be.\n */\ntypedef int bus_dma_filter_t(void *, bus_addr_t);\n\n/*\n * Generic helper function for manipulating mutexes.\n */\nvoid busdma_lock_mutex(void *arg, bus_dma_lock_op_t op);\n\n/*\n * Allocate a device specific dma_tag encapsulating the constraints of\n * the parent tag in addition to other restrictions specified:\n *\n *\talignment:\tAlignment for segments.\n *\tboundary:\tBoundary that segments cannot cross.\n *\tlowaddr:\tLow restricted address that cannot appear in a mapping.\n *\thighaddr:\tHigh restricted address that cannot appear in a mapping.\n *\tfiltfunc:\tAn optional function to further test if an address\n *\t\t\twithin the range of lowaddr and highaddr cannot appear\n *\t\t\tin a mapping.\n *\tfiltfuncarg:\tAn argument that will be passed to filtfunc in addition\n *\t\t\tto the address to test.\n *\tmaxsize:\tMaximum mapping size supported by this tag.\n *\tnsegments:\tNumber of discontinuities allowed in maps.\n *\tmaxsegsz:\tMaximum size of a segment in the map.\n *\tflags:\t\tBus DMA flags.\n *\tlockfunc:\tAn optional function to handle driver-defined lock\n *\t\t\toperations.\n *\tlockfuncarg:\tAn argument that will be passed to lockfunc in addition\n *\t\t\tto the lock operation.\n *\tdmat:\t\tA pointer to set to a valid dma tag should the return\n *\t\t\tvalue of this function indicate success.\n */\n/* XXX Should probably allow specification of alignment */\nint bus_dma_tag_create(bus_dma_tag_t parent, bus_size_t alignment,\n\t\t       bus_size_t boundary, bus_addr_t lowaddr,\n\t\t       bus_addr_t highaddr, bus_dma_filter_t *filtfunc,\n\t\t       void *filtfuncarg, bus_size_t maxsize, int nsegments,\n\t\t       bus_size_t maxsegsz, int flags, bus_dma_lock_t *lockfunc,\n\t\t       void *lockfuncarg, bus_dma_tag_t *dmat);\n\nint bus_dma_tag_destroy(bus_dma_tag_t dmat);\n\n/*\n * A function that processes a successfully loaded dma map or an error\n * from a delayed load map.\n */\ntypedef void bus_dmamap_callback_t(void *, bus_dma_segment_t *, int, int);\n\n/*\n * Like bus_dmamap_callback but includes map size in bytes.  This is\n * defined as a separate interface to maintain compatibility for users\n * of bus_dmamap_callback_t--at some point these interfaces should be merged.\n */\ntypedef void bus_dmamap_callback2_t(void *, bus_dma_segment_t *, int, bus_size_t, int);\n\n/*\n * XXX sparc64 uses the same interface, but a much different implementation.\n *     <machine/bus_dma.h> for the sparc64 arch contains the equivalent\n *     declarations.\n */\n#if !defined(__sparc64__)\n\n/*\n * Allocate a handle for mapping from kva/uva/physical\n * address space into bus device space.\n */\nint bus_dmamap_create(bus_dma_tag_t dmat, int flags, bus_dmamap_t *mapp);\n\n/*\n * Destroy a handle for mapping from kva/uva/physical\n * address space into bus device space.\n */\nint bus_dmamap_destroy(bus_dma_tag_t dmat, bus_dmamap_t map);\n\n/*\n * Allocate a piece of memory that can be efficiently mapped into\n * bus device space based on the constraints listed in the dma tag.\n * A dmamap to for use with dmamap_load is also allocated.\n */\nint bus_dmamem_alloc(bus_dma_tag_t dmat, void** vaddr, int flags,\n\t\t     bus_dmamap_t *mapp);\n\n/*\n * Free a piece of memory and its allocated dmamap, that was allocated\n * via bus_dmamem_alloc.\n */\nvoid bus_dmamem_free(bus_dma_tag_t dmat, void *vaddr, bus_dmamap_t map);\n\n/*\n * Map the buffer buf into bus space using the dmamap map.\n */\nint bus_dmamap_load(bus_dma_tag_t dmat, bus_dmamap_t map, void *buf,\n\t\t    bus_size_t buflen, bus_dmamap_callback_t *callback,\n\t\t    void *callback_arg, int flags);\n\n/*\n * Like bus_dmamap_load but for mbufs.  Note the use of the\n * bus_dmamap_callback2_t interface.\n */\nint bus_dmamap_load_mbuf(bus_dma_tag_t dmat, bus_dmamap_t map,\n\t\t\t struct mbuf *mbuf,\n\t\t\t bus_dmamap_callback2_t *callback, void *callback_arg,\n\t\t\t int flags);\n\nint bus_dmamap_load_mbuf_sg(bus_dma_tag_t dmat, bus_dmamap_t map,\n\t\t\t    struct mbuf *mbuf, bus_dma_segment_t *segs,\n\t\t\t    int *nsegs, int flags);\n\n/*\n * Like bus_dmamap_load but for uios.  Note the use of the\n * bus_dmamap_callback2_t interface.\n */\nint bus_dmamap_load_uio(bus_dma_tag_t dmat, bus_dmamap_t map,\n\t\t\tstruct uio *ui,\n\t\t\tbus_dmamap_callback2_t *callback, void *callback_arg,\n\t\t\tint flags);\n\n/*\n * Perform a synchronization operation on the given map.\n */\nvoid _bus_dmamap_sync(bus_dma_tag_t, bus_dmamap_t, bus_dmasync_op_t);\n#define bus_dmamap_sync(dmat, dmamap, op) \t\t\t\\\n\tdo {\t\t\t\t\t\t\t\\\n\t\tif ((dmamap) != NULL)\t\t\t\t\\\n\t\t\t_bus_dmamap_sync(dmat, dmamap, op);\t\\\n\t} while (0)\n\n/*\n * Release the mapping held by map.\n */\nvoid _bus_dmamap_unload(bus_dma_tag_t dmat, bus_dmamap_t map);\n#define bus_dmamap_unload(dmat, dmamap) \t\t\t\\\n\tdo {\t\t\t\t\t\t\t\\\n\t\tif ((dmamap) != NULL)\t\t\t\t\\\n\t\t\t_bus_dmamap_unload(dmat, dmamap);\t\\\n\t} while (0)\n\n#endif /* __sparc64__ */\n\n#endif /* _BUS_DMA_H_ */\n"
  },
  {
    "path": "freebsd-headers/sys/callout.h",
    "content": "/*-\n * Copyright (c) 1990, 1993\n *\tThe Regents of the University of California.  All rights reserved.\n * (c) UNIX System Laboratories, Inc.\n * All or some portions of this file are derived from material licensed\n * to the University of California by American Telephone and Telegraph\n * Co. or Unix System Laboratories, Inc. and are reproduced herein with\n * the permission of UNIX System Laboratories, Inc.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 4. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t@(#)callout.h\t8.2 (Berkeley) 1/21/94\n * $FreeBSD: release/9.0.0/sys/sys/callout.h 221059 2011-04-26 11:39:56Z kib $\n */\n\n#ifndef _SYS_CALLOUT_H_\n#define _SYS_CALLOUT_H_\n\n#include <sys/_callout.h>\n\n#define\tCALLOUT_LOCAL_ALLOC\t0x0001 /* was allocated from callfree */\n#define\tCALLOUT_ACTIVE\t\t0x0002 /* callout is currently active */\n#define\tCALLOUT_PENDING\t\t0x0004 /* callout is waiting for timeout */\n#define\tCALLOUT_MPSAFE\t\t0x0008 /* callout handler is mp safe */\n#define\tCALLOUT_RETURNUNLOCKED\t0x0010 /* handler returns with mtx unlocked */\n#define\tCALLOUT_SHAREDLOCK\t0x0020 /* callout lock held in shared mode */\n\nstruct callout_handle {\n\tstruct callout *callout;\n};\n\n#ifdef _KERNEL\nextern int ncallout;\n\n#define\tcallout_active(c)\t((c)->c_flags & CALLOUT_ACTIVE)\n#define\tcallout_deactivate(c)\t((c)->c_flags &= ~CALLOUT_ACTIVE)\n#define\tcallout_drain(c)\t_callout_stop_safe(c, 1)\nvoid\tcallout_init(struct callout *, int);\nvoid\t_callout_init_lock(struct callout *, struct lock_object *, int);\n#define\tcallout_init_mtx(c, mtx, flags)\t\t\t\t\t\\\n\t_callout_init_lock((c), ((mtx) != NULL) ? &(mtx)->lock_object :\t\\\n\t    NULL, (flags))\n#define\tcallout_init_rw(c, rw, flags)\t\t\t\t\t\\\n\t_callout_init_lock((c), ((rw) != NULL) ? &(rw)->lock_object :\t\\\n\t   NULL, (flags))\n#define\tcallout_pending(c)\t((c)->c_flags & CALLOUT_PENDING)\nint\tcallout_reset_on(struct callout *, int, void (*)(void *), void *, int);\n#define\tcallout_reset(c, on_tick, fn, arg)\t\t\t\t\\\n    callout_reset_on((c), (on_tick), (fn), (arg), (c)->c_cpu)\n#define\tcallout_reset_curcpu(c, on_tick, fn, arg)\t\t\t\\\n    callout_reset_on((c), (on_tick), (fn), (arg), PCPU_GET(cpuid))\nint\tcallout_schedule(struct callout *, int);\nint\tcallout_schedule_on(struct callout *, int, int);\n#define\tcallout_schedule_curcpu(c, on_tick)\t\t\t\t\\\n    callout_schedule_on((c), (on_tick), PCPU_GET(cpuid))\n#define\tcallout_stop(c)\t\t_callout_stop_safe(c, 0)\nint\t_callout_stop_safe(struct callout *, int);\nvoid\tcallout_tick(void);\nint\tcallout_tickstofirst(int limit);\nextern void (*callout_new_inserted)(int cpu, int ticks);\n\n#endif\n\n#endif /* _SYS_CALLOUT_H_ */\n"
  },
  {
    "path": "freebsd-headers/sys/capability.h",
    "content": "/*-\n * Copyright (c) 2008-2010 Robert N. M. Watson\n * All rights reserved.\n *\n * This software was developed at the University of Cambridge Computer\n * Laboratory with support from a grant from Google, Inc.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/sys/capability.h 224987 2011-08-18 22:51:30Z jonathan $\n */\n\n/*\n * Definitions for FreeBSD capabilities facility.\n */\n#ifndef _SYS_CAPABILITY_H_\n#define\t_SYS_CAPABILITY_H_\n\n#include <sys/cdefs.h>\n#include <sys/types.h>\n\n#include <sys/file.h>\n\n/*\n * Possible rights on capabilities.\n *\n * Notes:\n * Some system calls don't require a capability in order to perform an\n * operation on an fd.  These include: close, dup, dup2.\n *\n * sendfile is authorized using CAP_READ on the file and CAP_WRITE on the\n * socket.\n *\n * mmap() and aio*() system calls will need special attention as they may\n * involve reads or writes depending a great deal on context.\n */\n\n/* General file I/O. */\n#define\tCAP_READ\t\t0x0000000000000001ULL\t/* read/recv */\n#define\tCAP_WRITE\t\t0x0000000000000002ULL\t/* write/send */\n#define\tCAP_MMAP\t\t0x0000000000000004ULL\t/* mmap */\n#define\tCAP_MAPEXEC\t\t0x0000000000000008ULL\t/* mmap(2) as exec */\n#define\tCAP_FEXECVE\t\t0x0000000000000010ULL\n#define\tCAP_FSYNC\t\t0x0000000000000020ULL\n#define\tCAP_FTRUNCATE\t\t0x0000000000000040ULL\n#define\tCAP_SEEK\t\t0x0000000000000080ULL\n\n/* VFS methods. */\n#define\tCAP_FCHFLAGS\t\t0x0000000000000100ULL\n#define\tCAP_FCHDIR\t\t0x0000000000000200ULL\n#define\tCAP_FCHMOD\t\t0x0000000000000400ULL\n#define\tCAP_FCHOWN\t\t0x0000000000000800ULL\n#define\tCAP_FCNTL\t\t0x0000000000001000ULL\n#define\tCAP_FPATHCONF\t\t0x0000000000002000ULL\n#define\tCAP_FLOCK\t\t0x0000000000004000ULL\n#define\tCAP_FSCK\t\t0x0000000000008000ULL\n#define\tCAP_FSTAT\t\t0x0000000000010000ULL\n#define\tCAP_FSTATFS\t\t0x0000000000020000ULL\n#define\tCAP_FUTIMES\t\t0x0000000000040000ULL\n#define\tCAP_CREATE\t\t0x0000000000080000ULL\n#define\tCAP_DELETE\t\t0x0000000000100000ULL\n#define\tCAP_MKDIR\t\t0x0000000000200000ULL\n#define\tCAP_RMDIR\t\t0x0000000000400000ULL\n#define\tCAP_MKFIFO\t\t0x0000000000800000ULL\n\n/* Lookups - used to constrain *at() calls. */\n#define\tCAP_LOOKUP\t\t0x0000000001000000ULL\n\n/* Extended attributes. */\n#define\tCAP_EXTATTR_DELETE\t0x0000000002000000ULL\n#define\tCAP_EXTATTR_GET\t\t0x0000000004000000ULL\n#define\tCAP_EXTATTR_LIST\t0x0000000008000000ULL\n#define\tCAP_EXTATTR_SET\t\t0x0000000010000000ULL\n\n/* Access Control Lists. */\n#define\tCAP_ACL_CHECK\t\t0x0000000020000000ULL\n#define\tCAP_ACL_DELETE\t\t0x0000000040000000ULL\n#define\tCAP_ACL_GET\t\t0x0000000080000000ULL\n#define\tCAP_ACL_SET\t\t0x0000000100000000ULL\n\n/* Socket operations. */\n#define\tCAP_ACCEPT\t\t0x0000000200000000ULL\n#define\tCAP_BIND\t\t0x0000000400000000ULL\n#define\tCAP_CONNECT\t\t0x0000000800000000ULL\n#define\tCAP_GETPEERNAME\t\t0x0000001000000000ULL\n#define\tCAP_GETSOCKNAME\t\t0x0000002000000000ULL\n#define\tCAP_GETSOCKOPT\t\t0x0000004000000000ULL\n#define\tCAP_LISTEN\t\t0x0000008000000000ULL\n#define\tCAP_PEELOFF\t\t0x0000010000000000ULL\n#define\tCAP_SETSOCKOPT\t\t0x0000020000000000ULL\n#define\tCAP_SHUTDOWN\t\t0x0000040000000000ULL\n\n#define\tCAP_SOCK_ALL \\\n\t(CAP_ACCEPT | CAP_BIND | CAP_CONNECT \\\n\t | CAP_GETPEERNAME | CAP_GETSOCKNAME | CAP_GETSOCKOPT \\\n\t | CAP_LISTEN | CAP_PEELOFF | CAP_SETSOCKOPT | CAP_SHUTDOWN)\n\n/* Mandatory Access Control. */\n#define\tCAP_MAC_GET\t\t0x0000080000000000ULL\n#define\tCAP_MAC_SET\t\t0x0000100000000000ULL\n\n/* Methods on semaphores. */\n#define\tCAP_SEM_GETVALUE\t0x0000200000000000ULL\n#define\tCAP_SEM_POST\t\t0x0000400000000000ULL\n#define\tCAP_SEM_WAIT\t\t0x0000800000000000ULL\n\n/* kqueue events. */\n#define\tCAP_POLL_EVENT\t\t0x0001000000000000ULL\n#define\tCAP_POST_EVENT\t\t0x0002000000000000ULL\n\n/* Strange and powerful rights that should not be given lightly. */\n#define\tCAP_IOCTL\t\t0x0004000000000000ULL\n#define\tCAP_TTYHOOK\t\t0x0008000000000000ULL\n\n/* Process management via process descriptors. */\n#define\tCAP_PDGETPID\t\t0x0010000000000000ULL\n#define\tCAP_PDWAIT\t\t0x0020000000000000ULL\n#define\tCAP_PDKILL\t\t0x0040000000000000ULL\n\n/* The mask of all valid method rights. */\n#define\tCAP_MASK_VALID\t\t0x007fffffffffffffULL\n\n#ifdef _KERNEL\n\n#define IN_CAPABILITY_MODE(td) (td->td_ucred->cr_flags & CRED_FLAG_CAPMODE)\n\n/*\n * Create a capability to wrap a file object.\n */\nint\tkern_capwrap(struct thread *td, struct file *fp, cap_rights_t rights,\n\t    int *capfd);\n\n/*\n * Unwrap a capability if its rights mask is a superset of 'rights'.\n *\n * Unwrapping a non-capability is effectively a no-op; the value of fp_cap\n * is simply copied into fpp.\n */\nint\tcap_funwrap(struct file *fp_cap, cap_rights_t rights,\n\t    struct file **fpp);\nint\tcap_funwrap_mmap(struct file *fp_cap, cap_rights_t rights,\n\t    u_char *maxprotp, struct file **fpp);\n\n/*\n * For the purposes of procstat(1) and similar tools, allow kern_descrip.c to\n * extract the rights from a capability.  However, this should not be used by\n * kernel code generally, instead cap_funwrap() should be used in order to\n * keep all access control in one place.\n */\ncap_rights_t\tcap_rights(struct file *fp_cap);\n\n#else /* !_KERNEL */\n\n__BEGIN_DECLS\n\n/*\n * cap_enter(): Cause the process to enter capability mode, which will\n * prevent it from directly accessing global namespaces.  System calls will\n * be limited to process-local, process-inherited, or file descriptor\n * operations.  If already in capability mode, a no-op.\n *\n * Currently, process-inherited operations are not properly handled -- in\n * particular, we're interested in things like waitpid(2), kill(2), etc,\n * being properly constrained.  One possible solution is to introduce process\n * descriptors.\n */\nint\tcap_enter(void);\n\n/*\n * cap_getmode(): Are we in capability mode?\n */\nint\tcap_getmode(u_int* modep);\n\n/*\n * cap_new(): Create a new capability derived from an existing file\n * descriptor with the specified rights.  If the existing file descriptor is\n * a capability, then the new rights must be a subset of the existing rights.\n */\nint\tcap_new(int fd, cap_rights_t rights);\n\n/*\n * cap_getrights(): Query the rights on a capability.\n */\nint\tcap_getrights(int fd, cap_rights_t *rightsp);\n\n__END_DECLS\n\n#endif /* !_KERNEL */\n\n#endif /* !_SYS_CAPABILITY_H_ */\n"
  },
  {
    "path": "freebsd-headers/sys/cdefs.h",
    "content": "/*-\n * Copyright (c) 1991, 1993\n *\tThe Regents of the University of California.  All rights reserved.\n *\n * This code is derived from software contributed to Berkeley by\n * Berkeley Software Design, Inc.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 4. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t@(#)cdefs.h\t8.8 (Berkeley) 1/9/95\n * $FreeBSD: release/9.0.0/sys/sys/cdefs.h 218824 2011-02-18 21:44:53Z nwhitehorn $\n */\n\n#ifndef\t_SYS_CDEFS_H_\n#define\t_SYS_CDEFS_H_\n\n#if defined(__cplusplus)\n#define\t__BEGIN_DECLS\textern \"C\" {\n#define\t__END_DECLS\t}\n#else\n#define\t__BEGIN_DECLS\n#define\t__END_DECLS\n#endif\n\n/*\n * This code has been put in place to help reduce the addition of\n * compiler specific defines in FreeBSD code.  It helps to aid in\n * having a compiler-agnostic source tree.\n */\n\n#if defined(__GNUC__) || defined(__INTEL_COMPILER)\n\n#if __GNUC__ >= 3 || defined(__INTEL_COMPILER)\n#define __GNUCLIKE_ASM 3\n#define __GNUCLIKE_MATH_BUILTIN_CONSTANTS\n#else\n#define __GNUCLIKE_ASM 2\n#endif\n#define __GNUCLIKE___TYPEOF 1\n#define __GNUCLIKE___OFFSETOF 1\n#define __GNUCLIKE___SECTION 1\n\n#ifndef __INTEL_COMPILER\n# define __GNUCLIKE_CTOR_SECTION_HANDLING 1\n#endif\n\n#define __GNUCLIKE_BUILTIN_CONSTANT_P 1\n# if defined(__INTEL_COMPILER) && defined(__cplusplus) \\\n    && __INTEL_COMPILER < 800\n#  undef __GNUCLIKE_BUILTIN_CONSTANT_P\n# endif\n\n#if (__GNUC_MINOR__ > 95 || __GNUC__ >= 3) && !defined(__INTEL_COMPILER)\n# define __GNUCLIKE_BUILTIN_VARARGS 1\n# define __GNUCLIKE_BUILTIN_STDARG 1\n# define __GNUCLIKE_BUILTIN_VAALIST 1\n#endif\n\n#if defined(__GNUC__)\n# define __GNUC_VA_LIST_COMPATIBILITY 1\n#endif\n\n#ifndef __INTEL_COMPILER\n# define __GNUCLIKE_BUILTIN_NEXT_ARG 1\n# define __GNUCLIKE_MATH_BUILTIN_RELOPS\n#endif\n\n#define __GNUCLIKE_BUILTIN_MEMCPY 1\n\n/* XXX: if __GNUC__ >= 2: not tested everywhere originally, where replaced */\n#define __CC_SUPPORTS_INLINE 1\n#define __CC_SUPPORTS___INLINE 1\n#define __CC_SUPPORTS___INLINE__ 1\n\n#define __CC_SUPPORTS___FUNC__ 1\n#define __CC_SUPPORTS_WARNING 1\n\n#define __CC_SUPPORTS_VARADIC_XXX 1 /* see varargs.h */\n\n#define __CC_SUPPORTS_DYNAMIC_ARRAY_INIT 1\n\n#endif /* __GNUC__ || __INTEL_COMPILER */\n\n/*\n * Macro to test if we're using a specific version of gcc or later.\n */\n#if defined(__GNUC__) && !defined(__INTEL_COMPILER)\n#define\t__GNUC_PREREQ__(ma, mi)\t\\\n\t(__GNUC__ > (ma) || __GNUC__ == (ma) && __GNUC_MINOR__ >= (mi))\n#else\n#define\t__GNUC_PREREQ__(ma, mi)\t0\n#endif\n\n/*\n * The __CONCAT macro is used to concatenate parts of symbol names, e.g.\n * with \"#define OLD(foo) __CONCAT(old,foo)\", OLD(foo) produces oldfoo.\n * The __CONCAT macro is a bit tricky to use if it must work in non-ANSI\n * mode -- there must be no spaces between its arguments, and for nested\n * __CONCAT's, all the __CONCAT's must be at the left.  __CONCAT can also\n * concatenate double-quoted strings produced by the __STRING macro, but\n * this only works with ANSI C.\n *\n * __XSTRING is like __STRING, but it expands any macros in its argument\n * first.  It is only available with ANSI C.\n */\n#if defined(__STDC__) || defined(__cplusplus)\n#define\t__P(protos)\tprotos\t\t/* full-blown ANSI C */\n#define\t__CONCAT1(x,y)\tx ## y\n#define\t__CONCAT(x,y)\t__CONCAT1(x,y)\n#define\t__STRING(x)\t#x\t\t/* stringify without expanding x */\n#define\t__XSTRING(x)\t__STRING(x)\t/* expand x, then stringify */\n\n#define\t__const\t\tconst\t\t/* define reserved names to standard */\n#define\t__signed\tsigned\n#define\t__volatile\tvolatile\n#if defined(__cplusplus)\n#define\t__inline\tinline\t\t/* convert to C++ keyword */\n#else\n#if !(defined(__CC_SUPPORTS___INLINE))\n#define\t__inline\t\t\t/* delete GCC keyword */\n#endif /* ! __CC_SUPPORTS___INLINE */\n#endif /* !__cplusplus */\n\n#else\t/* !(__STDC__ || __cplusplus) */\n#define\t__P(protos)\t()\t\t/* traditional C preprocessor */\n#define\t__CONCAT(x,y)\tx/**/y\n#define\t__STRING(x)\t\"x\"\n\n#if !defined(__CC_SUPPORTS___INLINE)\n#define\t__const\t\t\t\t/* delete pseudo-ANSI C keywords */\n#define\t__inline\n#define\t__signed\n#define\t__volatile\n/*\n * In non-ANSI C environments, new programs will want ANSI-only C keywords\n * deleted from the program and old programs will want them left alone.\n * When using a compiler other than gcc, programs using the ANSI C keywords\n * const, inline etc. as normal identifiers should define -DNO_ANSI_KEYWORDS.\n * When using \"gcc -traditional\", we assume that this is the intent; if\n * __GNUC__ is defined but __STDC__ is not, we leave the new keywords alone.\n */\n#ifndef\tNO_ANSI_KEYWORDS\n#define\tconst\t\t\t\t/* delete ANSI C keywords */\n#define\tinline\n#define\tsigned\n#define\tvolatile\n#endif\t/* !NO_ANSI_KEYWORDS */\n#endif\t/* !__CC_SUPPORTS___INLINE */\n#endif\t/* !(__STDC__ || __cplusplus) */\n\n/*\n * Compiler-dependent macros to help declare dead (non-returning) and\n * pure (no side effects) functions, and unused variables.  They are\n * null except for versions of gcc that are known to support the features\n * properly (old versions of gcc-2 supported the dead and pure features\n * in a different (wrong) way).  If we do not provide an implementation\n * for a given compiler, let the compile fail if it is told to use\n * a feature that we cannot live without.\n */\n#ifdef lint\n#define\t__dead2\n#define\t__pure2\n#define\t__unused\n#define\t__packed\n#define\t__aligned(x)\n#define\t__section(x)\n#else\n#if !__GNUC_PREREQ__(2, 5) && !defined(__INTEL_COMPILER)\n#define\t__dead2\n#define\t__pure2\n#define\t__unused\n#endif\n#if __GNUC__ == 2 && __GNUC_MINOR__ >= 5 && __GNUC_MINOR__ < 7 && !defined(__INTEL_COMPILER)\n#define\t__dead2\t\t__attribute__((__noreturn__))\n#define\t__pure2\t\t__attribute__((__const__))\n#define\t__unused\n/* XXX Find out what to do for __packed, __aligned and __section */\n#endif\n#if __GNUC_PREREQ__(2, 7)\n#define\t__dead2\t\t__attribute__((__noreturn__))\n#define\t__pure2\t\t__attribute__((__const__))\n#define\t__unused\t__attribute__((__unused__))\n#define\t__used\t\t__attribute__((__used__))\n#define\t__packed\t__attribute__((__packed__))\n#define\t__aligned(x)\t__attribute__((__aligned__(x)))\n#define\t__section(x)\t__attribute__((__section__(x)))\n#endif\n#if defined(__INTEL_COMPILER)\n#define __dead2\t\t__attribute__((__noreturn__))\n#define __pure2\t\t__attribute__((__const__))\n#define __unused\t__attribute__((__unused__))\n#define __used\t\t__attribute__((__used__))\n#define __packed\t__attribute__((__packed__))\n#define __aligned(x)\t__attribute__((__aligned__(x)))\n#define __section(x)\t__attribute__((__section__(x)))\n#endif\n#endif\n\n#if __GNUC_PREREQ__(2, 96)\n#define\t__malloc_like\t__attribute__((__malloc__))\n#define\t__pure\t\t__attribute__((__pure__))\n#else\n#define\t__malloc_like\n#define\t__pure\n#endif\n\n#if __GNUC_PREREQ__(3, 1) || (defined(__INTEL_COMPILER) && __INTEL_COMPILER >= 800)\n#define\t__always_inline\t__attribute__((__always_inline__))\n#else\n#define\t__always_inline\n#endif\n\n#if __GNUC_PREREQ__(3, 1)\n#define\t__noinline\t__attribute__ ((__noinline__))\n#else\n#define\t__noinline\n#endif\n\n#if __GNUC_PREREQ__(3, 3)\n#define __nonnull(x)\t__attribute__((__nonnull__(x)))\n#else\n#define __nonnull(x)\n#endif\n\n/* XXX: should use `#if __STDC_VERSION__ < 199901'. */\n#if !__GNUC_PREREQ__(2, 7) && !defined(__INTEL_COMPILER)\n#define\t__func__\tNULL\n#endif\n\n#if (defined(__INTEL_COMPILER) || (defined(__GNUC__) && __GNUC__ >= 2)) && !defined(__STRICT_ANSI__) || __STDC_VERSION__ >= 199901\n#define\t__LONG_LONG_SUPPORTED\n#endif\n\n/*\n * GCC 2.95 provides `__restrict' as an extension to C90 to support the\n * C99-specific `restrict' type qualifier.  We happen to use `__restrict' as\n * a way to define the `restrict' type qualifier without disturbing older\n * software that is unaware of C99 keywords.\n */\n#if !(__GNUC__ == 2 && __GNUC_MINOR__ == 95)\n#if !defined(__STDC_VERSION__) || __STDC_VERSION__ < 199901 || defined(lint)\n#define\t__restrict\n#else\n#define\t__restrict\trestrict\n#endif\n#endif\n\n/*\n * GNU C version 2.96 adds explicit branch prediction so that\n * the CPU back-end can hint the processor and also so that\n * code blocks can be reordered such that the predicted path\n * sees a more linear flow, thus improving cache behavior, etc.\n *\n * The following two macros provide us with a way to utilize this\n * compiler feature.  Use __predict_true() if you expect the expression\n * to evaluate to true, and __predict_false() if you expect the\n * expression to evaluate to false.\n *\n * A few notes about usage:\n *\n *\t* Generally, __predict_false() error condition checks (unless\n *\t  you have some _strong_ reason to do otherwise, in which case\n *\t  document it), and/or __predict_true() `no-error' condition\n *\t  checks, assuming you want to optimize for the no-error case.\n *\n *\t* Other than that, if you don't know the likelihood of a test\n *\t  succeeding from empirical or other `hard' evidence, don't\n *\t  make predictions.\n *\n *\t* These are meant to be used in places that are run `a lot'.\n *\t  It is wasteful to make predictions in code that is run\n *\t  seldomly (e.g. at subsystem initialization time) as the\n *\t  basic block reordering that this affects can often generate\n *\t  larger code.\n */\n#if __GNUC_PREREQ__(2, 96)\n#define __predict_true(exp)     __builtin_expect((exp), 1)\n#define __predict_false(exp)    __builtin_expect((exp), 0)\n#else\n#define __predict_true(exp)     (exp)\n#define __predict_false(exp)    (exp)\n#endif\n\n#if __GNUC_PREREQ__(4, 2)\n#define\t__hidden\t__attribute__((__visibility__(\"hidden\")))\n#define\t__exported\t__attribute__((__visibility__(\"default\")))\n#else\n#define\t__hidden\n#define\t__exported\n#endif\n\n/*\n * We define this here since <stddef.h>, <sys/queue.h>, and <sys/types.h>\n * require it.\n */\n#if __GNUC_PREREQ__(4, 1)\n#define __offsetof(type, field)\t __builtin_offsetof(type, field)\n#else\n#ifndef __cplusplus\n#define\t__offsetof(type, field)\t((size_t)(&((type *)0)->field))\n#else\n#define __offsetof(type, field)\t\t\t\t\t\\\n  (__offsetof__ (reinterpret_cast <size_t>\t\t\t\\\n                 (&reinterpret_cast <const volatile char &>\t\\\n                  (static_cast<type *> (0)->field))))\n#endif\n#endif\n#define\t__rangeof(type, start, end) \\\n\t(__offsetof(type, end) - __offsetof(type, start))\n\n/*\n * Compiler-dependent macros to declare that functions take printf-like\n * or scanf-like arguments.  They are null except for versions of gcc\n * that are known to support the features properly (old versions of gcc-2\n * didn't permit keeping the keywords out of the application namespace).\n */\n#if !__GNUC_PREREQ__(2, 7) && !defined(__INTEL_COMPILER)\n#define\t__printflike(fmtarg, firstvararg)\n#define\t__scanflike(fmtarg, firstvararg)\n#define\t__format_arg(fmtarg)\n#else\n#define\t__printflike(fmtarg, firstvararg) \\\n\t    __attribute__((__format__ (__printf__, fmtarg, firstvararg)))\n#define\t__scanflike(fmtarg, firstvararg) \\\n\t    __attribute__((__format__ (__scanf__, fmtarg, firstvararg)))\n#define\t__format_arg(fmtarg)\t__attribute__((__format_arg__ (fmtarg)))\n#endif\n\n/* Compiler-dependent macros that rely on FreeBSD-specific extensions. */\n#if __FreeBSD_cc_version >= 300001 && defined(__GNUC__) && !defined(__INTEL_COMPILER)\n#define\t__printf0like(fmtarg, firstvararg) \\\n\t    __attribute__((__format__ (__printf0__, fmtarg, firstvararg)))\n#else\n#define\t__printf0like(fmtarg, firstvararg)\n#endif\n\n#if defined(__GNUC__) || defined(__INTEL_COMPILER)\n#ifndef __INTEL_COMPILER\n#define\t__strong_reference(sym,aliassym)\t\\\n\textern __typeof (sym) aliassym __attribute__ ((__alias__ (#sym)))\n#endif\n#ifdef __STDC__\n#define\t__weak_reference(sym,alias)\t\\\n\t__asm__(\".weak \" #alias);\t\\\n\t__asm__(\".equ \"  #alias \", \" #sym)\n#define\t__warn_references(sym,msg)\t\\\n\t__asm__(\".section .gnu.warning.\" #sym);\t\\\n\t__asm__(\".asciz \\\"\" msg \"\\\"\");\t\\\n\t__asm__(\".previous\")\n#define\t__sym_compat(sym,impl,verid)\t\\\n\t__asm__(\".symver \" #impl \", \" #sym \"@\" #verid)\n#define\t__sym_default(sym,impl,verid)\t\\\n\t__asm__(\".symver \" #impl \", \" #sym \"@@\" #verid)\n#else\n#define\t__weak_reference(sym,alias)\t\\\n\t__asm__(\".weak alias\");\t\t\\\n\t__asm__(\".equ alias, sym\")\n#define\t__warn_references(sym,msg)\t\\\n\t__asm__(\".section .gnu.warning.sym\"); \\\n\t__asm__(\".asciz \\\"msg\\\"\");\t\\\n\t__asm__(\".previous\")\n#define\t__sym_compat(sym,impl,verid)\t\\\n\t__asm__(\".symver impl, sym@verid\")\n#define\t__sym_default(impl,sym,verid)\t\\\n\t__asm__(\".symver impl, sym@@verid\")\n#endif\t/* __STDC__ */\n#endif\t/* __GNUC__ || __INTEL_COMPILER */\n\n#define\t__GLOBL1(sym)\t__asm__(\".globl \" #sym)\n#define\t__GLOBL(sym)\t__GLOBL1(sym)\n\n#if defined(__GNUC__) || defined(__INTEL_COMPILER)\n#define\t__IDSTRING(name,string)\t__asm__(\".ident\\t\\\"\" string \"\\\"\")\n#else\n/*\n * The following definition might not work well if used in header files,\n * but it should be better than nothing.  If you want a \"do nothing\"\n * version, then it should generate some harmless declaration, such as:\n *    #define __IDSTRING(name,string)\tstruct __hack\n */\n#define\t__IDSTRING(name,string)\tstatic const char name[] __unused = string\n#endif\n\n/*\n * Embed the rcs id of a source file in the resulting library.  Note that in\n * more recent ELF binutils, we use .ident allowing the ID to be stripped.\n * Usage:\n *\t__FBSDID(\"$FreeBSD: release/9.0.0/sys/sys/cdefs.h 218824 2011-02-18 21:44:53Z nwhitehorn $\");\n */\n#ifndef\t__FBSDID\n#if !defined(lint) && !defined(STRIP_FBSDID)\n#define\t__FBSDID(s)\t__IDSTRING(__CONCAT(__rcsid_,__LINE__),s)\n#else\n#define\t__FBSDID(s)\tstruct __hack\n#endif\n#endif\n\n#ifndef\t__RCSID\n#ifndef\tNO__RCSID\n#define\t__RCSID(s)\t__IDSTRING(__CONCAT(__rcsid_,__LINE__),s)\n#else\n#define\t__RCSID(s)\tstruct __hack\n#endif\n#endif\n\n#ifndef\t__RCSID_SOURCE\n#ifndef\tNO__RCSID_SOURCE\n#define\t__RCSID_SOURCE(s)\t__IDSTRING(__CONCAT(__rcsid_source_,__LINE__),s)\n#else\n#define\t__RCSID_SOURCE(s)\tstruct __hack\n#endif\n#endif\n\n#ifndef\t__SCCSID\n#ifndef\tNO__SCCSID\n#define\t__SCCSID(s)\t__IDSTRING(__CONCAT(__sccsid_,__LINE__),s)\n#else\n#define\t__SCCSID(s)\tstruct __hack\n#endif\n#endif\n\n#ifndef\t__COPYRIGHT\n#ifndef\tNO__COPYRIGHT\n#define\t__COPYRIGHT(s)\t__IDSTRING(__CONCAT(__copyright_,__LINE__),s)\n#else\n#define\t__COPYRIGHT(s)\tstruct __hack\n#endif\n#endif\n\n#ifndef\t__DECONST\n#define\t__DECONST(type, var)\t((type)(uintptr_t)(const void *)(var))\n#endif\n\n#ifndef\t__DEVOLATILE\n#define\t__DEVOLATILE(type, var)\t((type)(uintptr_t)(volatile void *)(var))\n#endif\n\n#ifndef\t__DEQUALIFY\n#define\t__DEQUALIFY(type, var)\t((type)(uintptr_t)(const volatile void *)(var))\n#endif\n\n/*-\n * The following definitions are an extension of the behavior originally\n * implemented in <sys/_posix.h>, but with a different level of granularity.\n * POSIX.1 requires that the macros we test be defined before any standard\n * header file is included.\n *\n * Here's a quick run-down of the versions:\n *  defined(_POSIX_SOURCE)\t\t1003.1-1988\n *  _POSIX_C_SOURCE == 1\t\t1003.1-1990\n *  _POSIX_C_SOURCE == 2\t\t1003.2-1992 C Language Binding Option\n *  _POSIX_C_SOURCE == 199309\t\t1003.1b-1993\n *  _POSIX_C_SOURCE == 199506\t\t1003.1c-1995, 1003.1i-1995,\n *\t\t\t\t\tand the omnibus ISO/IEC 9945-1: 1996\n *  _POSIX_C_SOURCE == 200112\t\t1003.1-2001\n *  _POSIX_C_SOURCE == 200809\t\t1003.1-2008\n *\n * In addition, the X/Open Portability Guide, which is now the Single UNIX\n * Specification, defines a feature-test macro which indicates the version of\n * that specification, and which subsumes _POSIX_C_SOURCE.\n *\n * Our macros begin with two underscores to avoid namespace screwage.\n */\n\n/* Deal with IEEE Std. 1003.1-1990, in which _POSIX_C_SOURCE == 1. */\n#if defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE == 1\n#undef _POSIX_C_SOURCE\t\t/* Probably illegal, but beyond caring now. */\n#define\t_POSIX_C_SOURCE\t\t199009\n#endif\n\n/* Deal with IEEE Std. 1003.2-1992, in which _POSIX_C_SOURCE == 2. */\n#if defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE == 2\n#undef _POSIX_C_SOURCE\n#define\t_POSIX_C_SOURCE\t\t199209\n#endif\n\n/* Deal with various X/Open Portability Guides and Single UNIX Spec. */\n#ifdef _XOPEN_SOURCE\n#if _XOPEN_SOURCE - 0 >= 700\n#define\t__XSI_VISIBLE\t\t700\n#undef _POSIX_C_SOURCE\n#define\t_POSIX_C_SOURCE\t\t200809\n#elif _XOPEN_SOURCE - 0 >= 600\n#define\t__XSI_VISIBLE\t\t600\n#undef _POSIX_C_SOURCE\n#define\t_POSIX_C_SOURCE\t\t200112\n#elif _XOPEN_SOURCE - 0 >= 500\n#define\t__XSI_VISIBLE\t\t500\n#undef _POSIX_C_SOURCE\n#define\t_POSIX_C_SOURCE\t\t199506\n#endif\n#endif\n\n/*\n * Deal with all versions of POSIX.  The ordering relative to the tests above is\n * important.\n */\n#if defined(_POSIX_SOURCE) && !defined(_POSIX_C_SOURCE)\n#define\t_POSIX_C_SOURCE\t\t198808\n#endif\n#ifdef _POSIX_C_SOURCE\n#if _POSIX_C_SOURCE >= 200809\n#define\t__POSIX_VISIBLE\t\t200809\n#define\t__ISO_C_VISIBLE\t\t1999\n#elif _POSIX_C_SOURCE >= 200112\n#define\t__POSIX_VISIBLE\t\t200112\n#define\t__ISO_C_VISIBLE\t\t1999\n#elif _POSIX_C_SOURCE >= 199506\n#define\t__POSIX_VISIBLE\t\t199506\n#define\t__ISO_C_VISIBLE\t\t1990\n#elif _POSIX_C_SOURCE >= 199309\n#define\t__POSIX_VISIBLE\t\t199309\n#define\t__ISO_C_VISIBLE\t\t1990\n#elif _POSIX_C_SOURCE >= 199209\n#define\t__POSIX_VISIBLE\t\t199209\n#define\t__ISO_C_VISIBLE\t\t1990\n#elif _POSIX_C_SOURCE >= 199009\n#define\t__POSIX_VISIBLE\t\t199009\n#define\t__ISO_C_VISIBLE\t\t1990\n#else\n#define\t__POSIX_VISIBLE\t\t198808\n#define\t__ISO_C_VISIBLE\t\t0\n#endif /* _POSIX_C_SOURCE */\n#else\n/*-\n * Deal with _ANSI_SOURCE:\n * If it is defined, and no other compilation environment is explicitly\n * requested, then define our internal feature-test macros to zero.  This\n * makes no difference to the preprocessor (undefined symbols in preprocessing\n * expressions are defined to have value zero), but makes it more convenient for\n * a test program to print out the values.\n *\n * If a program mistakenly defines _ANSI_SOURCE and some other macro such as\n * _POSIX_C_SOURCE, we will assume that it wants the broader compilation\n * environment (and in fact we will never get here).\n */\n#if defined(_ANSI_SOURCE)\t/* Hide almost everything. */\n#define\t__POSIX_VISIBLE\t\t0\n#define\t__XSI_VISIBLE\t\t0\n#define\t__BSD_VISIBLE\t\t0\n#define\t__ISO_C_VISIBLE\t\t1990\n#elif defined(_C99_SOURCE)\t/* Localism to specify strict C99 env. */\n#define\t__POSIX_VISIBLE\t\t0\n#define\t__XSI_VISIBLE\t\t0\n#define\t__BSD_VISIBLE\t\t0\n#define\t__ISO_C_VISIBLE\t\t1999\n#else\t\t\t\t/* Default environment: show everything. */\n#define\t__POSIX_VISIBLE\t\t200809\n#define\t__XSI_VISIBLE\t\t700\n#define\t__BSD_VISIBLE\t\t1\n#define\t__ISO_C_VISIBLE\t\t1999\n#endif\n#endif\n\n#endif /* !_SYS_CDEFS_H_ */\n"
  },
  {
    "path": "freebsd-headers/sys/cdio.h",
    "content": "/*\n * 16 Feb 93\tJulian Elischer\t(julian@dialix.oz.au)\n *\n * $FreeBSD: release/9.0.0/sys/sys/cdio.h 141031 2005-01-30 08:12:37Z sobomax $\n */\n\n/*\n<1>\tFixed a conflict with ioctl usage.  There were two different\n\tfunctions using code #25.  Made file formatting consistent.\n\tAdded two new ioctl codes: door closing and audio pitch playback.\n\tAdded a STEREO union called STEREO.\n\t5-Mar-95  Frank Durda IV\tbsdmail@nemesis.lonestar.org\n\n<2>\tAdded a new ioctl that allows you to find out what capabilities\n\ta drive has and what commands it will accept.  This allows a\n\tuser application to only offer controls (buttons, sliders, etc)\n\tfor functions that drive can actually do.   Things it can't do\n\tcan disappear or be greyed-out (like some other system).\n\tIf the driver doesn't respond to this call, well, handle it the\n\tway you used to do it.\n\t2-Apr-95  Frank Durda IV\tbsdmail@nemesis.lonestar.org\n*/\n\n/* Shared between kernel & process */\n\n#ifndef\t_SYS_CDIO_H_\n#define\t_SYS_CDIO_H_\n\n#ifndef _KERNEL\n#include <sys/types.h>\n#endif\n#include <sys/ioccom.h>\n\nunion msf_lba {\n\tstruct {\n\t\tunsigned char   unused;\n\t\tunsigned char   minute;\n\t\tunsigned char   second;\n\t\tunsigned char   frame;\n\t} msf;\n\tint     lba;    /* network byte order */\n\tu_char\taddr[4];\n};\n\nstruct cd_toc_entry {\n#if BYTE_ORDER == LITTLE_ENDIAN\n\tu_int\t:8;\n\tu_int\tcontrol:4;\n\tu_int\taddr_type:4;\n#else\n\tu_int\t:8;\n\tu_int\taddr_type:4;\n\tu_int\tcontrol:4;\n#endif\n\tu_char  track;\n\tu_int\t:8;\n\tunion msf_lba  addr;\n};\n\nstruct cd_sub_channel_header {\n\tu_int\t:8;\n\tu_char\taudio_status;\n#define CD_AS_AUDIO_INVALID        0x00\n#define CD_AS_PLAY_IN_PROGRESS     0x11\n#define CD_AS_PLAY_PAUSED          0x12\n#define CD_AS_PLAY_COMPLETED       0x13\n#define CD_AS_PLAY_ERROR           0x14\n#define CD_AS_NO_STATUS            0x15\n\tu_char\tdata_len[2];\n};\n\nstruct cd_sub_channel_position_data {\n\tu_char\tdata_format;\n\tu_int\tcontrol:4;\n\tu_int\taddr_type:4;\n\tu_char\ttrack_number;\n\tu_char\tindex_number;\n\tunion msf_lba  absaddr;\n\tunion msf_lba  reladdr;\n};\n\nstruct cd_sub_channel_media_catalog {\n        u_char  data_format;\n        u_int   :8;\n        u_int   :8;\n        u_int   :8;\n        u_int   :7;\n        u_int   mc_valid:1;\n        u_char  mc_number[15];\n};\n\nstruct cd_sub_channel_track_info {\n        u_char  data_format;\n        u_int   :8;\n        u_char  track_number;\n        u_int   :8;\n        u_int   :7;\n        u_int   ti_valid:1;\n        u_char  ti_number[15];\n};\n\nstruct cd_sub_channel_info {\n\tstruct cd_sub_channel_header header;\n\tunion {\n\t\tstruct cd_sub_channel_position_data position;\n\t\tstruct cd_sub_channel_media_catalog media_catalog;\n\t\tstruct cd_sub_channel_track_info track_info;\n\t} what;\n};\n\n\n/***************************************************************\\\n* Ioctls for the CD drive\t\t\t\t\t*\n\\***************************************************************/\n\nstruct ioc_play_track {\n\tu_char\tstart_track;\n\tu_char\tstart_index;\n\tu_char\tend_track;\n\tu_char\tend_index;\n};\n#define\tCDIOCPLAYTRACKS\t_IOW('c',1,struct ioc_play_track)\n\n\nstruct ioc_play_blocks {\n\tint\tblk;\n\tint\tlen;\n};\n#define\tCDIOCPLAYBLOCKS\t_IOW('c',2,struct ioc_play_blocks)\n\n\nstruct ioc_read_subchannel {\n\tu_char address_format;\n#define CD_LBA_FORMAT\t1\n#define CD_MSF_FORMAT\t2\n\tu_char data_format;\n#define CD_SUBQ_DATA\t\t0\n#define CD_CURRENT_POSITION\t1\n#define CD_MEDIA_CATALOG\t2\n#define CD_TRACK_INFO\t\t3\n\tu_char track;\n\tint\tdata_len;\n\tstruct  cd_sub_channel_info *data;\n};\n#define CDIOCREADSUBCHANNEL _IOWR('c', 3 , struct ioc_read_subchannel )\n\n\nstruct ioc_toc_header {\n\tu_short len;\n\tu_char  starting_track;\n\tu_char  ending_track;\n};\n#define CDIOREADTOCHEADER _IOR('c',4,struct ioc_toc_header)\n\n\nstruct ioc_read_toc_entry {\n\tu_char\taddress_format;\n\tu_char\tstarting_track;\n\tu_short\tdata_len;\n\tstruct  cd_toc_entry *data;\n};\n#define CDIOREADTOCENTRYS _IOWR('c',5,struct ioc_read_toc_entry)\n\n\nstruct ioc_read_toc_single_entry {\n\tu_char\taddress_format;\n\tu_char\ttrack;\n\tstruct  cd_toc_entry entry;\n};\n#define CDIOREADTOCENTRY _IOWR('c',6,struct ioc_read_toc_single_entry)\n\n\nstruct ioc_patch {\n\tu_char\tpatch[4];\t/* one for each channel */\n};\n#define\tCDIOCSETPATCH\t_IOW('c',9,struct ioc_patch)\n\n\nstruct ioc_vol {\n\tu_char\tvol[4];\t/* one for each channel */\n};\n#define\tCDIOCGETVOL\t_IOR('c',10,struct ioc_vol)\n\n#define\tCDIOCSETVOL\t_IOW('c',11,struct ioc_vol)\n\n#define\tCDIOCSETMONO\t_IO('c',12)\n\n#define\tCDIOCSETSTERIO\t_IO('c',13)\n#define\tCDIOCSETSTEREO\t_IO('c',13)\n\n#define\tCDIOCSETMUTE\t_IO('c',14)\n\n#define\tCDIOCSETLEFT\t_IO('c',15)\n\n#define\tCDIOCSETRIGHT\t_IO('c',16)\n\n#define\tCDIOCSETDEBUG\t_IO('c',17)\n\n#define\tCDIOCCLRDEBUG\t_IO('c',18)\n\n#define\tCDIOCPAUSE\t_IO('c',19)\n\n#define\tCDIOCRESUME\t_IO('c',20)\n\n#define\tCDIOCRESET\t_IO('c',21)\n\n#define\tCDIOCSTART\t_IO('c',22)\n\n#define\tCDIOCSTOP\t_IO('c',23)\n\n#define\tCDIOCEJECT\t_IO('c',24)\n\n\nstruct ioc_play_msf {\n\tu_char\tstart_m;\n\tu_char\tstart_s;\n\tu_char\tstart_f;\n\tu_char\tend_m;\n\tu_char\tend_s;\n\tu_char\tend_f;\n};\n#define\tCDIOCPLAYMSF\t_IOW('c',25,struct ioc_play_msf)\n\n#define\tCDIOCALLOW\t_IO('c',26)\n\n#define\tCDIOCPREVENT\t_IO('c',27)\n\n\t\t\t\t/*<1>For drives that support it, this*/\n\t\t\t\t/*<1>causes the drive to close its door*/\n\t\t\t\t/*<1>and make the media (if any) ready*/\n#define CDIOCCLOSE\t_IO('c',28)\t/*<1>*/\n\n\nstruct ioc_pitch {\t\t/*<1>For drives that support it, this*/\n\t\t\t\t/*<1>call instructs the drive to play the*/\n\tshort\tspeed;\t\t/*<1>audio at a faster or slower-than-normal*/\n};\t\t\t\t/*<1>rate. -32767 to -1 is slower, 0==normal,*/\n\t\t\t\t/*<1>and 1 to 32767 is faster.  LSB bits are*/\n\t\t\t\t/*<1>discarded first by drives with less res.*/\n#define\tCDIOCPITCH\t_IOW('c',29,struct ioc_pitch)\t/*<1>*/\n\nstruct ioc_capability {\t\t\t/*<2>*/\n\tu_long\tplay_function;\t\t/*<2>*/\n#define CDDOPLAYTRK\t0x00000001\t/*<2>Can Play tracks/index*/\n#define\tCDDOPLAYMSF\t0x00000002\t/*<2>Can Play msf to msf*/\n#define\tCDDOPLAYBLOCKS\t0x00000004\t/*<2>Can Play range of blocks*/\n#define\tCDDOPAUSE\t0x00000100\t/*<2>Output can be paused*/\n#define\tCDDORESUME\t0x00000200\t/*<2>Output can be resumed*/\n#define\tCDDORESET\t0x00000400\t/*<2>Drive can be completely reset*/\n#define\tCDDOSTART\t0x00000800\t/*<2>Audio can be started*/\n#define CDDOSTOP\t0x00001000\t/*<2>Audio can be stopped*/\n#define CDDOPITCH\t0x00002000\t/*<2>Audio pitch */\n\n\tu_long\trouting_function;\t/*<2>*/\n#define CDREADVOLUME\t0x00000001\t/*<2>Volume settings can be read*/\n#define CDSETVOLUME\t0x00000002\t/*<2>Volume settings can be set*/\n#define\tCDSETMONO\t0x00000100\t/*<2>Output can be set to mono*/\n#define CDSETSTEREO\t0x00000200\t/*<2>Output can be set to stereo (def)*/\n#define\tCDSETLEFT\t0x00000400\t/*<2>Output can be set to left only*/\n#define\tCDSETRIGHT\t0x00000800\t/*<2>Output can be set to right only*/\n#define\tCDSETMUTE\t0x00001000\t/*<2>Output can be muted*/\n#define CDSETPATCH\t0x00008000\t/*<2>Direct routing control allowed*/\n\n\tu_long\tspecial_function;\t/*<2>*/\n#define\tCDDOEJECT\t0x00000001\t/*<2>The tray can be opened*/\n#define\tCDDOCLOSE\t0x00000002\t/*<2>The tray can be closed*/\n#define\tCDDOLOCK\t0x00000004\t/*<2>The tray can be locked*/\n#define CDREADHEADER\t0x00000100\t/*<2>Can read Table of Contents*/\n#define\tCDREADENTRIES\t0x00000200\t/*<2>Can read TOC Entries*/\n#define\tCDREADSUBQ\t0x00000200\t/*<2>Can read Subchannel info*/\n#define CDREADRW\t0x00000400\t/*<2>Can read subcodes R-W*/\n#define\tCDHASDEBUG\t0x00004000\t/*<2>The tray has dynamic debugging*/\n};\t\t\t\t\t/*<2>*/\n\n#define\tCDIOCCAPABILITY\t_IOR('c',30,struct ioc_capability)\t/*<2>*/\n\n/*\n * Special version of CDIOCREADSUBCHANNEL which assumes that\n * ioc_read_subchannel->data points to the kernel memory. For\n * use in compatibility layers.\n */\n#define CDIOCREADSUBCHANNEL_SYSSPACE _IOWR('c', 31, struct ioc_read_subchannel)\n\n#endif /* !_SYS_CDIO_H_ */\n"
  },
  {
    "path": "freebsd-headers/sys/cdrio.h",
    "content": "/*-\n * Copyright (c) 2000,2001,2002 Sren Schmidt <sos@FreeBSD.org>\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer,\n *    without modification, immediately at the beginning of the file.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. The name of the author may not be used to endorse or promote products\n *    derived from this software without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR\n * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES\n * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,\n * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF\n * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/sys/cdrio.h 105421 2002-10-18 22:03:39Z njl $\n */\n\n#ifndef\t_SYS_CDRIO_H_\n#define\t_SYS_CDRIO_H_\n\n#include <sys/ioccom.h>\n\nstruct cdr_track {\n        int datablock_type;         \t/* data type code */\n#define CDR_DB_RAW              0x0     /* 2352 bytes of raw data */\n#define CDR_DB_RAW_PQ           0x1     /* 2368 bytes raw data + P/Q subchan */\n#define CDR_DB_RAW_PW           0x2     /* 2448 bytes raw data + P-W subchan */\n#define CDR_DB_RAW_PW_R         0x3     /* 2448 bytes raw data + P-W raw sub */\n#define CDR_DB_RES_4            0x4     /* reserved */\n#define CDR_DB_RES_5            0x5     /* reserved */\n#define CDR_DB_RES_6            0x6     /* reserved */\n#define CDR_DB_VS_7             0x7     /* vendor specific */\n#define CDR_DB_ROM_MODE1        0x8     /* 2048 bytes Mode 1 (ISO/IEC 10149) */\n#define CDR_DB_ROM_MODE2        0x9     /* 2336 bytes Mode 2 (ISO/IEC 10149) */\n#define CDR_DB_XA_MODE1         0xa     /* 2048 bytes Mode 1 (CD-ROM XA 1) */\n#define CDR_DB_XA_MODE2_F1      0xb     /* 2056 bytes Mode 2 (CD-ROM XA 1) */\n#define CDR_DB_XA_MODE2_F2      0xc     /* 2324 bytes Mode 2 (CD-ROM XA 2) */\n#define CDR_DB_XA_MODE2_MIX     0xd     /* 2332 bytes Mode 2 (CD-ROM XA 1/2) */\n#define CDR_DB_RES_14           0xe     /* reserved */\n#define CDR_DB_VS_15            0xf     /* vendor specific */\n\n\tint preemp;\t\t\t/* preemphasis if audio track*/\n\tint test_write;\t\t\t/* use test writes, laser turned off */\n};\n\nstruct cdr_cue_entry {\n\tu_int8_t adr:4;\n    \tu_int8_t ctl:4;\n\tu_int8_t track;\n\tu_int8_t index;\n\tu_int8_t dataform;\n\tu_int8_t scms;\n\tu_int8_t min;\n\tu_int8_t sec;\n\tu_int8_t frame;\n};\n\nstruct cdr_cuesheet {\n    \tint32_t len;\n\tstruct cdr_cue_entry *entries;\n\tint session_format;\n#define CDR_SESS_CDROM          0x00\n#define CDR_SESS_CDI            0x10\n#define CDR_SESS_CDROM_XA       0x20\n\n\tint session_type;\n#define CDR_SESS_NONE           0x00\n#define CDR_SESS_FINAL          0x01\n#define CDR_SESS_RESERVED       0x02\n#define CDR_SESS_MULTI          0x03\n\n\tint test_write;\n};\n\nstruct cdr_format_capacity {\n\tu_int32_t blocks;\n\tu_int32_t reserved:2;\n\tu_int32_t type:6;\n\tu_int32_t param:24;\n};\n\nstruct cdr_format_capacities {\n\tu_int8_t reserved1[3];\n\tu_int8_t length;\n\tu_int32_t blocks;\n\tu_int32_t type:2;\n\tu_int32_t reserved2:6;\n\tu_int32_t block_size:24;\n\tstruct cdr_format_capacity format[32];\n};\n\nstruct cdr_format_params {\n\tu_int8_t reserved;\n\tu_int8_t vs:1;\n\tu_int8_t immed:1;\n\tu_int8_t try_out:1;\n\tu_int8_t ip:1;\n\tu_int8_t stpf:1;\n\tu_int8_t dcrt:1;\n\tu_int8_t dpry:1;\n\tu_int8_t fov:1;\n\tu_int16_t length;\n\tstruct cdr_format_capacity format;\n};\n\n#define CDRIOCBLANK\t\t_IOW('c', 100, int)\n#define CDR_B_ALL\t\t0x0\n#define CDR_B_MIN\t\t0x1\n#define CDR_B_SESSION\t\t0x6\n\n#define CDRIOCNEXTWRITEABLEADDR\t_IOR('c', 101, int)\n#define CDRIOCINITWRITER\t_IOW('c', 102, int)\n#define CDRIOCINITTRACK\t\t_IOW('c', 103, struct cdr_track)\n#define CDRIOCSENDCUE\t\t_IOW('c', 104, struct cdr_cuesheet)\n#define CDRIOCFLUSH\t\t_IO('c', 105)\n#define CDRIOCFIXATE\t\t_IOW('c', 106, int)\n#define CDRIOCREADSPEED\t\t_IOW('c', 107, int)\n#define CDRIOCWRITESPEED\t_IOW('c', 108, int)\n#define CDR_MAX_SPEED\t\t0xffff\n#define CDRIOCGETBLOCKSIZE\t_IOR('c', 109, int)\n#define CDRIOCSETBLOCKSIZE\t_IOW('c', 110, int)\n#define CDRIOCGETPROGRESS\t_IOR('c', 111, int)\n#define CDRIOCREADFORMATCAPS\t_IOR('c', 112, struct cdr_format_capacities)\n#define CDRIOCFORMAT\t\t_IOW('c', 113, struct cdr_format_params)\n\n#endif /* !_SYS_CDRIO_H_ */\n"
  },
  {
    "path": "freebsd-headers/sys/cfictl.h",
    "content": "/*-\n * Copyright (c) 2007, Juniper Networks, Inc.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. Neither the name of the author nor the names of any co-contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR\n * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES\n * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,\n * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,\n * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\n * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED\n * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,\n * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/sys/cfictl.h 188156 2009-02-05 18:12:07Z sam $\n */\n\n#ifndef _SYS_CFICTL_H_\n#define _SYS_CFICTL_H_\n\n/*\n * Allow reading of the CFI query structure.\n */\n\nstruct cfiocqry {\n\tunsigned long\toffset;\n\tunsigned long\tcount;\n\tu_char\t\t*buffer;\n};\n\n#define\tCFIOCQRY\t_IOWR('q', 0, struct cfiocqry)\n\n/* Intel StrataFlash Protection Register support */\n#define\tCFIOCGFACTORYPR\t_IOR('q', 1, uint64_t)\t/* get factory protection reg */\n#define\tCFIOCGOEMPR\t_IOR('q', 2, uint64_t)\t/* get oem protection reg */\n#define\tCFIOCSOEMPR\t_IOW('q', 3, uint64_t)\t/* set oem protection reg */\n#define\tCFIOCGPLR\t_IOR('q', 4, uint32_t)\t/* get protection lock reg */\n#define\tCFIOCSPLR\t_IO('q', 5)\t\t/* set protection log reg */\n#endif\t/* _SYS_CFICTL_H_ */\n"
  },
  {
    "path": "freebsd-headers/sys/chio.h",
    "content": "/*-\n * Copyright (c) 1996 Jason R. Thorpe <thorpej@and.com>\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. All advertising materials mentioning features or use of this software\n *    must display the following acknowledgements:\n *\tThis product includes software developed by Jason R. Thorpe\n *\tfor And Communications, http://www.and.com/\n * 4. The name of the author may not be used to endorse or promote products\n *    derived from this software without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR\n * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES\n * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,\n * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,\n * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\n * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED\n * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,\n * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/sys/chio.h 139825 2005-01-07 02:29:27Z imp $\n */\n\n#ifndef\t_SYS_CHIO_H_\n#define\t_SYS_CHIO_H_\n\n#ifndef _KERNEL\n#include <sys/types.h>\n#endif\n#include <sys/ioccom.h>\n\n/*\n * Element types.  Used as \"to\" and \"from\" type indicators in move\n * and exchange operations.\n *\n * Note that code in sys/scsi/ch.c relies on these values (uses them\n * as offsets in an array, and other evil), so don't muck with them\n * unless you know what you're doing.\n */\n#define CHET_MT\t\t0\t/* medium transport (picker) */\n#define CHET_ST\t\t1\t/* storage transport (slot) */\n#define CHET_IE\t\t2\t/* import/export (portal) */\n#define CHET_DT\t\t3\t/* data transfer (drive) */\n#define CHET_MAX\tCHET_DT\n\n/*\n * Maximum length of a volume identification string\n */\n#define CH_VOLTAG_MAXLEN\t32\n\n/*\n * Structure used to execute a MOVE MEDIUM command.\n */\nstruct changer_move {\n\tu_int16_t\tcm_fromtype;\t/* element type to move from */\n\tu_int16_t\tcm_fromunit;\t/* logical unit of from element */\n\tu_int16_t\tcm_totype;\t/* element type to move to */\n\tu_int16_t\tcm_tounit;\t/* logical unit of to element */\n\tu_int16_t\tcm_flags;\t/* misc. flags */\n};\n\n/* cm_flags */\n#define CM_INVERT\t0x01\t/* invert media */\n\n/*\n * Structure used to execute an EXCHANGE MEDIUM command.  In an\n * exchange operation, the following steps occur:\n *\n *\t- media from source is moved to first destination.\n *\n *\t- media previously occupying first destination is moved\n *\t  to the second destination.\n *\n * The second destination may or may not be the same as the source.\n * In the case of a simple exchange, the source and second destination\n * are the same.\n */\nstruct changer_exchange {\n\tu_int16_t\tce_srctype;\t/* element type of source */\n\tu_int16_t\tce_srcunit;\t/* logical unit of source */\n\tu_int16_t\tce_fdsttype;\t/* element type of first destination */\n\tu_int16_t\tce_fdstunit;\t/* logical unit of first destination */\n\tu_int16_t\tce_sdsttype;\t/* element type of second destination */\n\tu_int16_t\tce_sdstunit;\t/* logical unit of second destination */\n\tu_int16_t\tce_flags;\t/* misc. flags */\n};\n\n/* ce_flags */\n#define CE_INVERT1\t0x01\t/* invert media 1 */\n#define CE_INVERT2\t0x02\t/* invert media 2 */\n\n/*\n * Structure used to execute a POSITION TO ELEMENT command.  This\n * moves the current picker in front of the specified element.\n */\nstruct changer_position {\n\tu_int16_t\tcp_type;\t/* element type */\n\tu_int16_t\tcp_unit;\t/* logical unit of element */\n\tu_int16_t\tcp_flags;\t/* misc. flags */\n};\n\n/* cp_flags */\n#define CP_INVERT\t0x01\t/* invert picker */\n\n/*\n * Data returned by CHIOGPARAMS.\n */\nstruct changer_params {\n\tu_int16_t\tcp_npickers;\t/* number of pickers */\n\tu_int16_t\tcp_nslots;\t/* number of slots */\n\tu_int16_t\tcp_nportals;\t/* number of import/export portals */\n\tu_int16_t\tcp_ndrives;\t/* number of drives */\n};\n\n/*\n * Command used to get element status.\n */\n\nstruct changer_voltag {\n\tu_char\t\tcv_volid[CH_VOLTAG_MAXLEN+1];\n\tu_int16_t\tcv_serial;\n};\n\ntypedef struct changer_voltag changer_voltag_t;\n\n/*\n * Flags definitions for ces_status\n * Not all flags have meaning for all element types.\n */\ntypedef enum {\n\tCES_STATUS_FULL\t  = 0x001,\t/* element is full */\n\tCES_STATUS_IMPEXP = 0x002,\t/* media deposited by operator */\n\tCES_STATUS_EXCEPT = 0x004,\t/* element in abnormal state */\n\tCES_PICKER_MASK\t  = 0x005,\t/* flags valid for pickers */\n\tCES_STATUS_ACCESS = 0x008,\t/* media accessible by picker */\n\tCES_SLOT_MASK\t  = 0x00c,\t/* flags valid for slots */\n\tCES_DRIVE_MASK\t  = 0x00c,\t/* flags valid for drives */\n\tCES_STATUS_EXENAB = 0x010,\t/* element supports exporting */\n\tCES_STATUS_INENAB = 0x020,\t/* element supports importing */\n\tCES_PORTAL_MASK\t  = 0x03f,\t/* flags valid for portals */\n\tCES_INVERT\t  = 0x040,\t/* invert bit */\n\tCES_SOURCE_VALID  = 0x080,\t/* source address (ces_source) valid */\n\tCES_SCSIID_VALID  = 0x100,\t/* ces_scsi_id is valid */\n\tCES_LUN_VALID\t  = 0x200\t/* ces_scsi_lun is valid */\n} ces_status_flags;\n\nstruct changer_element_status {\n\tu_int8_t\t\tces_type;\t  /* element type */\n\tu_int16_t\t\tces_addr;\t  /* logical element address */\n\tu_int16_t\t\tces_int_addr;\t  /* changer element address */\n\tces_status_flags\tces_flags;\t  /* \n\t\t\t\t\t\t   * see CESTATUS definitions\n\t\t\t\t\t\t   * below \n\t\t\t\t\t\t   */ \n\tu_int8_t\t\tces_sensecode;\t  /* \n\t\t\t\t\t\t   * additional sense\n\t\t\t\t\t\t   * code for element */\n\tu_int8_t\t\tces_sensequal;\t  /*\n\t\t\t\t\t\t   * additional sense\n\t\t\t\t\t\t   * code qualifier \n\t\t\t\t\t\t   */\n\tu_int8_t\t\tces_source_type;  /* \n\t\t\t\t\t\t   * element type of\n\t\t\t\t\t\t   * source address \n\t\t\t\t\t\t   */\n\tu_int16_t\t\tces_source_addr;  /* \n\t\t\t\t\t\t   * source address of medium\n\t\t\t\t\t\t   */\n\tchanger_voltag_t     \tces_pvoltag;\t  /* primary volume tag */\n\tchanger_voltag_t\tces_avoltag;\t  /* alternate volume tag */\n\tu_int8_t\t\tces_scsi_id;\t  /* SCSI id of element */\n\tu_int8_t\t\tces_scsi_lun;\t  /* SCSI lun of element */\n};\n\nstruct changer_element_status_request {\n\tu_int16_t\t\t\tcesr_element_type;\n\tu_int16_t\t\t\tcesr_element_base;\n\tu_int16_t\t\t\tcesr_element_count;\n\n\tu_int16_t\t\t\tcesr_flags;\n#define CESR_VOLTAGS\t0x01\n\n\tstruct changer_element_status\t*cesr_element_status;\n};\n\n\nstruct changer_set_voltag_request {\n\tu_int16_t\t\tcsvr_type;\n\tu_int16_t\t\tcsvr_addr;\n\n\tu_int16_t\t\tcsvr_flags;\n#define CSVR_MODE_MASK\t\t0x0f\t/* mode mask, acceptable modes below: */\n#define\tCSVR_MODE_SET\t\t0x00\t/* set volume tag if not set */\n#define CSVR_MODE_REPLACE\t0x01\t/* unconditionally replace volume tag */\n#define CSVR_MODE_CLEAR\t\t0x02\t/* clear volume tag */\n\n#define CSVR_ALTERNATE\t\t0x10\t/* set to work with alternate voltag */\n\n\tchanger_voltag_t     \tcsvr_voltag;\n};\n\n\n#define CESTATUS_BITS\t\\\n\t\"\\20\\6INEAB\\5EXENAB\\4ACCESS\\3EXCEPT\\2IMPEXP\\1FULL\"\n\n#define CHIOMOVE\t_IOW('c', 0x01, struct changer_move)\n#define CHIOEXCHANGE\t_IOW('c', 0x02, struct changer_exchange)\n#define CHIOPOSITION\t_IOW('c', 0x03, struct changer_position)\n#define CHIOGPICKER\t_IOR('c', 0x04, int)\n#define CHIOSPICKER\t_IOW('c', 0x05, int)\n#define CHIOGPARAMS\t_IOR('c', 0x06, struct changer_params)\n#define CHIOIELEM\t_IOW('c', 0x07, u_int32_t)\n#define CHIOGSTATUS\t_IOW('c', 0x08, struct changer_element_status_request)\n#define CHIOSETVOLTAG\t_IOW('c', 0x09, struct changer_set_voltag_request)\n\n#endif /* !_SYS_CHIO_H_ */\n"
  },
  {
    "path": "freebsd-headers/sys/clock.h",
    "content": "/*-\n * Copyright (c) 1996 The NetBSD Foundation, Inc.\n * All rights reserved.\n *\n * This code is derived from software contributed to The NetBSD Foundation\n * by Gordon W. Ross\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS\n * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED\n * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\n * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS\n * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\n * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\n * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\n * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\n * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n *\n *\t$NetBSD: clock_subr.h,v 1.7 2000/10/03 13:41:07 tsutsui Exp $\n *\n *\n * This file is the central clearing-house for calendrical issues.\n *\n * In general the kernel does not know about minutes, hours, days, timezones,\n * daylight savings time, leap-years and such.  All that is theoretically a\n * matter for userland only.\n *\n * Parts of kernel code does however care: badly designed filesystems store\n * timestamps in local time and RTC chips sometimes track time in a local\n * timezone instead of UTC and so on.\n *\n * All that code should go here for service.\n *\n * $FreeBSD: release/9.0.0/sys/sys/clock.h 204646 2010-03-03 17:55:51Z joel $\n */\n\n#ifndef _SYS_CLOCK_H_\n#define _SYS_CLOCK_H_\n\n#ifdef _KERNEL\t\t/* No user serviceable parts */\n\n/*\n * Timezone info from settimeofday(2), usually not used\n */\nextern int tz_minuteswest;\nextern int tz_dsttime;\n\nint utc_offset(void);\n\n/*\n * Structure to hold the values typically reported by time-of-day clocks.\n * This can be passed to the generic conversion functions to be converted\n * to a struct timespec.\n */\nstruct clocktime {\n\tint\tyear;\t\t\t/* year (4 digit year) */\n\tint\tmon;\t\t\t/* month (1 - 12) */\n\tint\tday;\t\t\t/* day (1 - 31) */\n\tint\thour;\t\t\t/* hour (0 - 23) */\n\tint\tmin;\t\t\t/* minute (0 - 59) */\n\tint\tsec;\t\t\t/* second (0 - 59) */\n\tint\tdow;\t\t\t/* day of week (0 - 6; 0 = Sunday) */\n\tlong\tnsec;\t\t\t/* nano seconds */\n};\n\nint clock_ct_to_ts(struct clocktime *, struct timespec *);\nvoid clock_ts_to_ct(struct timespec *, struct clocktime *);\nvoid clock_register(device_t, long);\n\n/*\n * BCD to decimal and decimal to BCD.\n */\n#define\tFROMBCD(x)\tbcd2bin(x)\n#define\tTOBCD(x)\tbin2bcd(x)\n\n/* Some handy constants. */\n#define SECDAY\t\t(24 * 60 * 60)\n#define SECYR\t\t(SECDAY * 365)\n\n/* Traditional POSIX base year */\n#define\tPOSIX_BASE_YEAR\t1970\n\nvoid timespec2fattime(struct timespec *tsp, int utc, u_int16_t *ddp, u_int16_t *dtp, u_int8_t *dhp);\nvoid fattime2timespec(unsigned dd, unsigned dt, unsigned dh, int utc, struct timespec *tsp);\n\n#endif /* _KERNEL */\n\n#endif /* !_SYS_CLOCK_H_ */\n"
  },
  {
    "path": "freebsd-headers/sys/condvar.h",
    "content": "/*-\n * Copyright (c) 2000 Jake Burkholder <jake@freebsd.org>.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/sys/condvar.h 177085 2008-03-12 06:31:06Z jeff $\n */\n\n#ifndef\t_SYS_CONDVAR_H_\n#define\t_SYS_CONDVAR_H_\n\n#ifndef\tLOCORE\n#include <sys/queue.h>\n\nstruct lock_object;\nstruct thread;\n\nTAILQ_HEAD(cv_waitq, thread);\n\n/*\n * Condition variable.  The waiters count is protected by the mutex that\n * protects the condition; that is, the mutex that is passed to cv_wait*()\n * and is held across calls to cv_signal() and cv_broadcast().  It is an\n * optimization to avoid looking up the sleep queue if there are no waiters.\n */\nstruct cv {\n\tconst char\t*cv_description;\n\tint\t\tcv_waiters;\n};\n\n#ifdef _KERNEL\nvoid\tcv_init(struct cv *cvp, const char *desc);\nvoid\tcv_destroy(struct cv *cvp);\n\nvoid\t_cv_wait(struct cv *cvp, struct lock_object *lock);\nvoid\t_cv_wait_unlock(struct cv *cvp, struct lock_object *lock);\nint\t_cv_wait_sig(struct cv *cvp, struct lock_object *lock);\nint\t_cv_timedwait(struct cv *cvp, struct lock_object *lock, int timo);\nint\t_cv_timedwait_sig(struct cv *cvp, struct lock_object *lock, int timo);\n\nvoid\tcv_signal(struct cv *cvp);\nvoid\tcv_broadcastpri(struct cv *cvp, int pri);\n\n#define\tcv_wait(cvp, lock)\t\t\t\t\t\t\\\n\t_cv_wait((cvp), &(lock)->lock_object)\n#define\tcv_wait_unlock(cvp, lock)\t\t\t\t\t\\\n\t_cv_wait_unlock((cvp), &(lock)->lock_object)\n#define\tcv_wait_sig(cvp, lock)\t\t\t\t\t\t\\\n\t_cv_wait_sig((cvp), &(lock)->lock_object)\n#define\tcv_timedwait(cvp, lock, timo)\t\t\t\t\t\\\n\t_cv_timedwait((cvp), &(lock)->lock_object, (timo))\n#define\tcv_timedwait_sig(cvp, lock, timo)\t\t\t\t\\\n\t_cv_timedwait_sig((cvp), &(lock)->lock_object, (timo))\n\n#define cv_broadcast(cvp)\tcv_broadcastpri(cvp, 0)\n\n#define\tcv_wmesg(cvp)\t\t((cvp)->cv_description)\n\n#endif\t/* _KERNEL */\n#endif\t/* !LOCORE */\n#endif\t/* _SYS_CONDVAR_H_ */\n"
  },
  {
    "path": "freebsd-headers/sys/conf.h",
    "content": "/*-\n * Copyright (c) 1990, 1993\n *\tThe Regents of the University of California.  All rights reserved.\n * Copyright (c) 2000\n *\tPoul-Henning Kamp.  All rights reserved.\n * (c) UNIX System Laboratories, Inc.\n * All or some portions of this file are derived from material licensed\n * to the University of California by American Telephone and Telegraph\n * Co. or Unix System Laboratories, Inc. and are reproduced herein with\n * the permission of UNIX System Laboratories, Inc.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 4. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t@(#)conf.h\t8.5 (Berkeley) 1/9/95\n * $FreeBSD: release/9.0.0/sys/sys/conf.h 226577 2011-10-20 18:47:58Z kib $\n */\n\n#ifndef _SYS_CONF_H_\n#define\t_SYS_CONF_H_\n\n#ifdef _KERNEL\n#include <sys/eventhandler.h>\n#else\n#include <sys/queue.h>\n#endif\n\nstruct snapdata;\nstruct devfs_dirent;\nstruct cdevsw;\nstruct file;\n\nstruct cdev {\n\tvoid\t\t*__si_reserved;\n\tu_int\t\tsi_flags;\n#define\tSI_ETERNAL\t0x0001\t/* never destroyed */\n#define SI_ALIAS\t0x0002\t/* carrier of alias name */\n#define SI_NAMED\t0x0004\t/* make_dev{_alias} has been called */\n#define SI_CHEAPCLONE\t0x0008\t/* can be removed_dev'ed when vnode reclaims */\n#define SI_CHILD\t0x0010\t/* child of another struct cdev **/\n#define SI_DEVOPEN\t0x0020\t/* opened by device */\n#define SI_CONSOPEN\t0x0040\t/* opened by console */\n#define SI_DUMPDEV\t0x0080\t/* is kernel dumpdev */\n#define SI_CANDELETE\t0x0100\t/* can do BIO_DELETE */\n#define SI_CLONELIST\t0x0200\t/* on a clone list */\n\tstruct timespec\tsi_atime;\n\tstruct timespec\tsi_ctime;\n\tstruct timespec\tsi_mtime;\n\tuid_t\t\tsi_uid;\n\tgid_t\t\tsi_gid;\n\tmode_t\t\tsi_mode;\n\tstruct ucred\t*si_cred;\t/* cached clone-time credential */\n\tint\t\tsi_drv0;\n\tint\t\tsi_refcount;\n\tLIST_ENTRY(cdev)\tsi_list;\n\tLIST_ENTRY(cdev)\tsi_clone;\n\tLIST_HEAD(, cdev)\tsi_children;\n\tLIST_ENTRY(cdev)\tsi_siblings;\n\tstruct cdev *si_parent;\n\tchar\t\t*si_name;\n\tvoid\t\t*si_drv1, *si_drv2;\n\tstruct cdevsw\t*si_devsw;\n\tint\t\tsi_iosize_max;\t/* maximum I/O size (for physio &al) */\n\tu_long\t\tsi_usecount;\n\tu_long\t\tsi_threadcount;\n\tunion {\n\t\tstruct snapdata *__sid_snapdata;\n\t} __si_u;\n\tchar\t\t__si_namebuf[SPECNAMELEN + 1];\n};\n\n#define si_snapdata\t__si_u.__sid_snapdata\n\n#ifdef _KERNEL\n\n/*\n * Definitions of device driver entry switches\n */\n\nstruct bio;\nstruct buf;\nstruct thread;\nstruct uio;\nstruct knote;\nstruct clonedevs;\nstruct vm_object;\nstruct vnode;\n\n/*\n * Note: d_thread_t is provided as a transition aid for those drivers\n * that treat struct proc/struct thread as an opaque data type and\n * exist in substantially the same form in both 4.x and 5.x.  Writers\n * of drivers that dips into the d_thread_t structure should use\n * struct thread or struct proc as appropriate for the version of the\n * OS they are using.  It is provided in lieu of each device driver\n * inventing its own way of doing this.  While it does violate style(9)\n * in a number of ways, this violation is deemed to be less\n * important than the benefits that a uniform API between releases\n * gives.\n *\n * Users of struct thread/struct proc that aren't device drivers should\n * not use d_thread_t.\n */\n\ntypedef struct thread d_thread_t;\n\ntypedef int d_open_t(struct cdev *dev, int oflags, int devtype, struct thread *td);\ntypedef int d_fdopen_t(struct cdev *dev, int oflags, struct thread *td, struct file *fp);\ntypedef int d_close_t(struct cdev *dev, int fflag, int devtype, struct thread *td);\ntypedef void d_strategy_t(struct bio *bp);\ntypedef int d_ioctl_t(struct cdev *dev, u_long cmd, caddr_t data,\n\t\t      int fflag, struct thread *td);\n\ntypedef int d_read_t(struct cdev *dev, struct uio *uio, int ioflag);\ntypedef int d_write_t(struct cdev *dev, struct uio *uio, int ioflag);\ntypedef int d_poll_t(struct cdev *dev, int events, struct thread *td);\ntypedef int d_kqfilter_t(struct cdev *dev, struct knote *kn);\ntypedef int d_mmap_t(struct cdev *dev, vm_ooffset_t offset, vm_paddr_t *paddr,\n\t\t     int nprot, vm_memattr_t *memattr);\ntypedef int d_mmap_single_t(struct cdev *cdev, vm_ooffset_t *offset,\n    vm_size_t size, struct vm_object **object, int nprot);\ntypedef void d_purge_t(struct cdev *dev);\n\ntypedef int dumper_t(\n\tvoid *_priv,\t\t/* Private to the driver. */\n\tvoid *_virtual,\t\t/* Virtual (mapped) address. */\n\tvm_offset_t _physical,\t/* Physical address of virtual. */\n\toff_t _offset,\t\t/* Byte-offset to write at. */\n\tsize_t _length);\t/* Number of bytes to dump. */\n\n#endif /* _KERNEL */\n\n/*\n * Types for d_flags.\n */\n#define\tD_TAPE\t0x0001\n#define\tD_DISK\t0x0002\n#define\tD_TTY\t0x0004\n#define\tD_MEM\t0x0008\n\n#ifdef _KERNEL \n\n#define\tD_TYPEMASK\t0xffff\n\n/*\n * Flags for d_flags which the drivers can set.\n */\n#define\tD_TRACKCLOSE\t0x00080000\t/* track all closes */\n#define D_MMAP_ANON\t0x00100000\t/* special treatment in vm_mmap.c */\n#define D_PSEUDO\t0x00200000\t/* make_dev() can return NULL */\n#define D_NEEDGIANT\t0x00400000\t/* driver want Giant */\n#define\tD_NEEDMINOR\t0x00800000\t/* driver uses clone_create() */\n\n/*\n * Version numbers.\n */\n#define D_VERSION_00\t0x20011966\n#define D_VERSION_01\t0x17032005\t/* Add d_uid,gid,mode & kind */\n#define D_VERSION_02\t0x28042009\t/* Add d_mmap_single */\n#define D_VERSION_03\t0x17122009\t/* d_mmap takes memattr,vm_ooffset_t */\n#define D_VERSION\tD_VERSION_03\n\n/*\n * Flags used for internal housekeeping\n */\n#define D_INIT\t\t0x80000000\t/* cdevsw initialized */\n\n/*\n * Character device switch table\n */\nstruct cdevsw {\n\tint\t\t\td_version;\n\tu_int\t\t\td_flags;\n\tconst char\t\t*d_name;\n\td_open_t\t\t*d_open;\n\td_fdopen_t\t\t*d_fdopen;\n\td_close_t\t\t*d_close;\n\td_read_t\t\t*d_read;\n\td_write_t\t\t*d_write;\n\td_ioctl_t\t\t*d_ioctl;\n\td_poll_t\t\t*d_poll;\n\td_mmap_t\t\t*d_mmap;\n\td_strategy_t\t\t*d_strategy;\n\tdumper_t\t\t*d_dump;\n\td_kqfilter_t\t\t*d_kqfilter;\n\td_purge_t\t\t*d_purge;\n\td_mmap_single_t\t\t*d_mmap_single;\n\n\tint32_t\t\t\td_spare0[3];\n\tvoid\t\t\t*d_spare1[3];\n\n\t/* These fields should not be messed with by drivers */\n\tLIST_HEAD(, cdev)\td_devs;\n\tint\t\t\td_spare2;\n\tunion {\n\t\tstruct cdevsw\t\t*gianttrick;\n\t\tSLIST_ENTRY(cdevsw)\tpostfree_list;\n\t} __d_giant;\n};\n#define\td_gianttrick\t\t__d_giant.gianttrick\n#define\td_postfree_list\t\t__d_giant.postfree_list\n\nstruct module;\n\nstruct devsw_module_data {\n\tint\t(*chainevh)(struct module *, int, void *); /* next handler */\n\tvoid\t*chainarg;\t/* arg for next event handler */\n\t/* Do not initialize fields hereafter */\n};\n\n#define DEV_MODULE(name, evh, arg)\t\t\t\t\t\\\nstatic moduledata_t name##_mod = {\t\t\t\t\t\\\n    #name,\t\t\t\t\t\t\t\t\\\n    evh,\t\t\t\t\t\t\t\t\\\n    arg\t\t\t\t\t\t\t\t\t\\\n};\t\t\t\t\t\t\t\t\t\\\nDECLARE_MODULE(name, name##_mod, SI_SUB_DRIVERS, SI_ORDER_MIDDLE)\n\n\nvoid clone_setup(struct clonedevs **cdp);\nvoid clone_cleanup(struct clonedevs **);\n#define CLONE_UNITMASK 0xfffff\n#define CLONE_FLAG0 (CLONE_UNITMASK + 1)\nint clone_create(struct clonedevs **, struct cdevsw *, int *unit, struct cdev **dev, int extra);\n\nint\tcount_dev(struct cdev *_dev);\nvoid\tdestroy_dev(struct cdev *_dev);\nint\tdestroy_dev_sched(struct cdev *dev);\nint\tdestroy_dev_sched_cb(struct cdev *dev, void (*cb)(void *), void *arg);\nvoid\tdestroy_dev_drain(struct cdevsw *csw);\nvoid\tdrain_dev_clone_events(void);\nstruct cdevsw *dev_refthread(struct cdev *_dev, int *_ref);\nstruct cdevsw *devvn_refthread(struct vnode *vp, struct cdev **devp, int *_ref);\nvoid\tdev_relthread(struct cdev *_dev, int _ref);\nvoid\tdev_depends(struct cdev *_pdev, struct cdev *_cdev);\nvoid\tdev_ref(struct cdev *dev);\nvoid\tdev_refl(struct cdev *dev);\nvoid\tdev_rel(struct cdev *dev);\nvoid\tdev_strategy(struct cdev *dev, struct buf *bp);\nstruct cdev *make_dev(struct cdevsw *_devsw, int _unit, uid_t _uid, gid_t _gid,\n\t\tint _perms, const char *_fmt, ...) __printflike(6, 7);\nstruct cdev *make_dev_cred(struct cdevsw *_devsw, int _unit,\n\t\tstruct ucred *_cr, uid_t _uid, gid_t _gid, int _perms,\n\t\tconst char *_fmt, ...) __printflike(7, 8);\n#define\tMAKEDEV_REF\t\t0x01\n#define\tMAKEDEV_WHTOUT\t\t0x02\n#define\tMAKEDEV_NOWAIT\t\t0x04\n#define\tMAKEDEV_WAITOK\t\t0x08\n#define\tMAKEDEV_ETERNAL\t\t0x10\n#define\tMAKEDEV_CHECKNAME\t0x20\nstruct cdev *make_dev_credf(int _flags,\n\t\tstruct cdevsw *_devsw, int _unit,\n\t\tstruct ucred *_cr, uid_t _uid, gid_t _gid, int _mode,\n\t\tconst char *_fmt, ...) __printflike(8, 9);\nint\tmake_dev_p(int _flags, struct cdev **_cdev, struct cdevsw *_devsw,\n\t\tstruct ucred *_cr, uid_t _uid, gid_t _gid, int _mode,\n\t\tconst char *_fmt, ...) __printflike(8, 9);\nstruct cdev *make_dev_alias(struct cdev *_pdev, const char *_fmt, ...)\n\t\t__printflike(2, 3);\nint\tmake_dev_alias_p(int _flags, struct cdev **_cdev, struct cdev *_pdev,\n\t\tconst char *_fmt, ...) __printflike(4, 5);\nint\tmake_dev_physpath_alias(int _flags, struct cdev **_cdev,\n\t        struct cdev *_pdev, struct cdev *_old_alias,\n                const char *_physpath);\nvoid\tdev_lock(void);\nvoid\tdev_unlock(void);\nvoid\tsetconf(void);\n\n#ifdef KLD_MODULE\n#define\tMAKEDEV_ETERNAL_KLD\t0\n#else\n#define\tMAKEDEV_ETERNAL_KLD\tMAKEDEV_ETERNAL\n#endif\n\n#define\tdev2unit(d)\t((d)->si_drv0)\n\ntypedef\tvoid (*cdevpriv_dtr_t)(void *data);\nint\tdevfs_get_cdevpriv(void **datap);\nint\tdevfs_set_cdevpriv(void *priv, cdevpriv_dtr_t dtr);\nvoid\tdevfs_clear_cdevpriv(void);\nvoid\tdevfs_fpdrop(struct file *fp);\t/* XXX This is not public KPI */\n\nino_t\tdevfs_alloc_cdp_inode(void);\nvoid\tdevfs_free_cdp_inode(ino_t ino);\n\n#define\t\tUID_ROOT\t0\n#define\t\tUID_BIN\t\t3\n#define\t\tUID_UUCP\t66\n#define\t\tUID_NOBODY\t65534\n\n#define\t\tGID_WHEEL\t0\n#define\t\tGID_KMEM\t2\n#define\t\tGID_TTY\t\t4\n#define\t\tGID_OPERATOR\t5\n#define\t\tGID_BIN\t\t7\n#define\t\tGID_GAMES\t13\n#define\t\tGID_DIALER\t68\n#define\t\tGID_NOBODY\t65534\n\ntypedef void (*dev_clone_fn)(void *arg, struct ucred *cred, char *name,\n\t    int namelen, struct cdev **result);\n\nint dev_stdclone(char *_name, char **_namep, const char *_stem, int *_unit);\nEVENTHANDLER_DECLARE(dev_clone, dev_clone_fn);\n\n/* Stuff relating to kernel-dump */\n\nstruct dumperinfo {\n\tdumper_t *dumper;\t/* Dumping function. */\n\tvoid    *priv;\t\t/* Private parts. */\n\tu_int   blocksize;\t/* Size of block in bytes. */\n\tu_int\tmaxiosize;\t/* Max size allowed for an individual I/O */\n\toff_t   mediaoffset;\t/* Initial offset in bytes. */\n\toff_t   mediasize;\t/* Space available in bytes. */\n};\n\nint set_dumper(struct dumperinfo *);\nint dump_write(struct dumperinfo *, void *, vm_offset_t, off_t, size_t);\nvoid dumpsys(struct dumperinfo *);\nint doadump(boolean_t);\nextern int dumping;\t\t/* system is dumping */\n\n#endif /* _KERNEL */\n\n#endif /* !_SYS_CONF_H_ */\n"
  },
  {
    "path": "freebsd-headers/sys/cons.h",
    "content": "/*-\n * Copyright (c) 1988 University of Utah.\n * Copyright (c) 1991 The Regents of the University of California.\n * All rights reserved.\n *\n * This code is derived from software contributed to Berkeley by\n * the Systems Programming Group of the University of Utah Computer\n * Science Department.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 4. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\tfrom: @(#)cons.h\t7.2 (Berkeley) 5/9/91\n * $FreeBSD: release/9.0.0/sys/sys/cons.h 196506 2009-08-24 10:53:30Z ed $\n */\n\n#ifndef _MACHINE_CONS_H_\n#define\t_MACHINE_CONS_H_\n\nstruct consdev;\nstruct tty;\n\ntypedef\tvoid\tcn_probe_t(struct consdev *);\ntypedef\tvoid\tcn_init_t(struct consdev *);\ntypedef\tvoid\tcn_term_t(struct consdev *);\ntypedef\tint\tcn_getc_t(struct consdev *);\ntypedef\tvoid\tcn_putc_t(struct consdev *, int);\n\nstruct consdev_ops {\n\tcn_probe_t\t*cn_probe;\n\t\t\t\t/* probe hardware and fill in consdev info */\n\tcn_init_t\t*cn_init;\n\t\t\t\t/* turn on as console */\n\tcn_term_t\t*cn_term;\n\t\t\t\t/* turn off as console */\n\tcn_getc_t\t*cn_getc;\n\t\t\t\t/* kernel getchar interface */\n\tcn_putc_t\t*cn_putc;\n\t\t\t\t/* kernel putchar interface */\n};\n\nstruct consdev {\n\tconst struct consdev_ops *cn_ops;\n\t\t\t\t/* console device operations. */\n\tshort\tcn_pri;\t\t/* pecking order; the higher the better */\n\tvoid\t*cn_arg;\t/* drivers method argument */\n\tint\tcn_flags;\t/* capabilities of this console */\n\tchar\tcn_name[SPECNAMELEN + 1];\t/* console (device) name */\n};\n\n/* values for cn_pri - reflect our policy for console selection */\n#define\tCN_DEAD\t\t0\t/* device doesn't exist */\n#define CN_LOW\t\t1\t/* device is a last restort only */\n#define CN_NORMAL\t2\t/* device exists but is nothing special */\n#define CN_INTERNAL\t3\t/* \"internal\" bit-mapped display */\n#define CN_REMOTE\t4\t/* serial interface with remote bit set */\n\n/* Values for cn_flags. */\n#define\tCN_FLAG_NODEBUG\t0x00000001\t/* Not supported with debugger. */\n#define\tCN_FLAG_NOAVAIL\t0x00000002\t/* Temporarily not available. */\n\n#ifdef _KERNEL\n\nextern\tstruct msgbuf consmsgbuf; /* Message buffer for constty. */\nextern\tstruct tty *constty;\t/* Temporary virtual console. */\n\n#define\tCONSOLE_DEVICE(name, ops, arg)\t\t\t\t\t\\\n\tstatic struct consdev name = {\t\t\t\t\t\\\n\t\t.cn_ops = &ops,\t\t\t\t\t\t\\\n\t\t.cn_arg = (arg),\t\t\t\t\t\\\n\t};\t\t\t\t\t\t\t\t\\\n\tDATA_SET(cons_set, name)\n\n#define\tCONSOLE_DRIVER(name)\t\t\t\t\t\t\\\n\tstatic const struct consdev_ops name##_consdev_ops = {\t\t\\\n\t\t.cn_probe = name##_cnprobe,\t\t\t\t\\\n\t\t.cn_init = name##_cninit,\t\t\t\t\\\n\t\t.cn_term = name##_cnterm,\t\t\t\t\\\n\t\t.cn_getc = name##_cngetc,\t\t\t\t\\\n\t\t.cn_putc = name##_cnputc,\t\t\t\t\\\n\t};\t\t\t\t\t\t\t\t\\\n\tCONSOLE_DEVICE(name##_consdev, name##_consdev_ops, NULL)\n\n/* Other kernel entry points. */\nvoid\tcninit(void);\nvoid\tcninit_finish(void);\nint\tcnadd(struct consdev *);\nvoid\tcnavailable(struct consdev *, int);\nvoid\tcnremove(struct consdev *);\nvoid\tcnselect(struct consdev *);\nint\tcncheckc(void);\nint\tcngetc(void);\nvoid\tcnputc(int);\nvoid\tcnputs(char *);\nint\tcnunavailable(void);\nvoid\tconstty_set(struct tty *tp);\nvoid\tconstty_clear(void);\n\n#endif /* _KERNEL */\n\n#endif /* !_MACHINE_CONS_H_ */\n"
  },
  {
    "path": "freebsd-headers/sys/consio.h",
    "content": "/*-\n * Copyright (c) 1991-1996 Sren Schmidt\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer\n *    in this position and unchanged.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. The name of the author may not be used to endorse or promote products\n *    derived from this software without specific prior written permission\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR\n * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES\n * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,\n * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF\n * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/sys/consio.h 162711 2006-09-27 19:57:02Z ru $\n */\n\n#ifndef\t_SYS_CONSIO_H_\n#define\t_SYS_CONSIO_H_\n\n#ifndef _KERNEL\n#include <sys/types.h>\n#endif\n#include <sys/ioccom.h>\n\n/*\n * Console ioctl commands.  Some commands are named as KDXXXX, GIO_XXX, and\n * PIO_XXX, rather than CONS_XXX, for historical and compatibility reasons.\n * Some other CONS_XXX commands are works as wrapper around frame buffer \n * ioctl commands FBIO_XXX.  Do not try to change all these commands, \n * otherwise we shall have compatibility problems.\n */\n\n/* get/set video mode */\n#define KD_TEXT\t\t0\t\t/* set text mode restore fonts  */\n#define KD_TEXT0\t0\t\t/* ditto\t\t\t*/\n#define KD_GRAPHICS\t1\t\t/* set graphics mode \t\t*/\n#define KD_TEXT1\t2\t\t/* set text mode !restore fonts */\n#define KD_PIXEL\t3\t\t/* set pixel mode\t\t*/\n#define KDGETMODE\t_IOR('K', 9, int)\n#define KDSETMODE\t_IOWINT('K', 10)\n\n/* set border color */\n#define KDSBORDER\t_IOWINT('K', 13)\n\n/* set up raster(pixel) text mode */\nstruct _scr_size {\n\tint\t\tscr_size[3];\n};\ntypedef struct _scr_size\tscr_size_t;\n\n#define KDRASTER\t_IOW('K', 100, scr_size_t)\n\n/* get/set screen char map */\nstruct _scrmap {\n\tchar\t\tscrmap[256];\n};\ntypedef struct _scrmap\tscrmap_t;\n\n#define GIO_SCRNMAP\t_IOR('k', 2, scrmap_t)\n#define PIO_SCRNMAP\t_IOW('k', 3, scrmap_t)\n\n/* get the current text attribute */\n#define GIO_ATTR\t_IOR('a', 0, int)\n\n/* get the current text color */\n#define GIO_COLOR\t_IOR('c', 0, int)\n\n/* get the adapter type (equivalent to FBIO_ADPTYPE) */\n#define CONS_CURRENT\t_IOR('c', 1, int)\n\n/* get the current video mode (equivalent to FBIO_GETMODE) */\n#define CONS_GET\t_IOR('c', 2, int)\n\n/* not supported? */\n#define CONS_IO\t\t_IO('c', 3)\n\n/* set blank time interval */\n#define CONS_BLANKTIME\t_IOW('c', 4, int)\n\n/* set/get the screen saver (these ioctls are current noop) */\nstruct ssaver\t{\n#define MAXSSAVER\t16\n\tchar\t\tname[MAXSSAVER];\n\tint\t\tnum;\n\tlong\t\ttime;\n};\ntypedef struct ssaver\tssaver_t;\n\n#define CONS_SSAVER\t_IOW('c', 5, ssaver_t)\n#define CONS_GSAVER\t_IOWR('c', 6, ssaver_t)\n\n/* set the text cursor type (obsolete, see CONS_CURSORSHAPE below) */\n/*\n#define CONS_BLINK_CURSOR (1 << 0)\n#define CONS_CHAR_CURSOR (1 << 1)\n*/\n#define CONS_CURSORTYPE\t_IOW('c', 7, int)\n\n/* set the bell type to audible or visual */\n#define CONS_VISUAL_BELL (1 << 0)\n#define CONS_QUIET_BELL\t(1 << 1)\n#define CONS_BELLTYPE\t_IOW('c', 8, int)\n\n/* set the history (scroll back) buffer size (in lines) */\n#define CONS_HISTORY\t_IOW('c', 9, int)\n\n/* clear the history (scroll back) buffer */\n#define CONS_CLRHIST\t_IO('c', 10)\n\n/* mouse cursor ioctl */\nstruct mouse_data {\n\tint\t\tx;\n\tint \t\ty;\n\tint \t\tz;\n\tint \t\tbuttons;\n};\ntypedef struct mouse_data mouse_data_t;\n\nstruct mouse_mode {\n\tint\t\tmode;\n\tint\t\tsignal;\n};\ntypedef struct mouse_mode mouse_mode_t;\n\nstruct mouse_event {\n\tint\t\tid;\t\t\t/* one based */\n\tint\t\tvalue;\n};\ntypedef struct mouse_event mouse_event_t;\n\nstruct mouse_info {\n\tint\t\toperation;\n#define MOUSE_SHOW\t0x01\n#define MOUSE_HIDE\t0x02\n#define MOUSE_MOVEABS\t0x03\n#define MOUSE_MOVEREL\t0x04\n#define MOUSE_GETINFO\t0x05\n#define MOUSE_MODE\t0x06\n#define MOUSE_ACTION\t0x07\n#define MOUSE_MOTION_EVENT\t0x08\n#define MOUSE_BUTTON_EVENT\t0x09\n#define MOUSE_MOUSECHAR\t0x0a\n\tunion {\n\t\tmouse_data_t\tdata;\n\t\tmouse_mode_t\tmode;\n\t\tmouse_event_t\tevent;\n\t\tint\t\tmouse_char;\n\t}\t\tu;\n};\ntypedef struct mouse_info mouse_info_t;\n\n#define CONS_MOUSECTL\t_IOWR('c', 10, mouse_info_t)\n\n/* see if the vty has been idle */\n#define CONS_IDLE\t_IOR('c', 11, int)\n\n/* set the screen saver mode */\n#define CONS_NO_SAVER\t(-1)\n#define CONS_LKM_SAVER\t0\n#define CONS_USR_SAVER\t1\n#define CONS_SAVERMODE\t_IOW('c', 12, int)\n\n/* start the screen saver */\n#define CONS_SAVERSTART\t_IOW('c', 13, int)\n\n/* set the text cursor shape (see also CONS_CURSORTYPE above) */\n#define CONS_BLINK_CURSOR\t(1 << 0)\n#define CONS_CHAR_CURSOR\t(1 << 1)\n#define CONS_HIDDEN_CURSOR\t(1 << 2)\n#define CONS_CURSOR_ATTRS\t(CONS_BLINK_CURSOR | CONS_CHAR_CURSOR |\t\\\n\t\t\t\t CONS_HIDDEN_CURSOR)\n#define CONS_RESET_CURSOR\t(1 << 30)\n#define CONS_LOCAL_CURSOR\t(1 << 31)\n#define CONS_CURSOR_FLAGS\t(CONS_RESET_CURSOR | CONS_LOCAL_CURSOR)\nstruct cshape {\n\t/* shape[0]: flags, shape[1]: base, shape[2]: height */\n\tint\t\tshape[3];\n};\n#define CONS_GETCURSORSHAPE _IOWR('c', 14, struct cshape)\n#define CONS_SETCURSORSHAPE _IOW('c', 15, struct cshape)\n\n/* set/get font data */\nstruct fnt8 {\n\tchar\t\tfnt8x8[8*256];\n};\ntypedef struct fnt8\tfnt8_t;\n\nstruct fnt14 {\n\tchar\t\tfnt8x14[14*256];\n};\ntypedef struct fnt14\tfnt14_t;\n\nstruct fnt16 {\n\tchar\t\tfnt8x16[16*256];\n};\ntypedef struct fnt16\tfnt16_t;\n\n#define PIO_FONT8x8\t_IOW('c', 64, fnt8_t)\n#define GIO_FONT8x8\t_IOR('c', 65, fnt8_t)\n#define PIO_FONT8x14\t_IOW('c', 66, fnt14_t)\n#define GIO_FONT8x14\t_IOR('c', 67, fnt14_t)\n#define PIO_FONT8x16\t_IOW('c', 68, fnt16_t)\n#define GIO_FONT8x16\t_IOR('c', 69, fnt16_t)\n\n/* get video mode information */\nstruct colors\t{\n\tchar\t\tfore;\n\tchar\t\tback;\n};\n\nstruct vid_info {\n\tshort\t\tsize;\n\tshort\t\tm_num;\n\tu_short\t\tfont_size;\n\tu_short\t\tmv_row, mv_col;\n\tu_short\t\tmv_rsz, mv_csz;\n\tu_short\t\tmv_hsz;\n\tstruct colors\tmv_norm,\n\t\t\tmv_rev,\n\t\t\tmv_grfc;\n\tu_char\t\tmv_ovscan;\n\tu_char\t\tmk_keylock;\n};\ntypedef struct vid_info vid_info_t;\n\n#define CONS_GETINFO    _IOWR('c', 73, vid_info_t)\n\n/* get version */\n#define CONS_GETVERS\t_IOR('c', 74, int)\n\n/* get the video adapter index (equivalent to FBIO_ADAPTER) */\n#define CONS_CURRENTADP\t_IOR('c', 100, int)\n\n/* get the video adapter information (equivalent to FBIO_ADPINFO) */\n#define CONS_ADPINFO\t_IOWR('c', 101, video_adapter_info_t)\n\n/* get the video mode information (equivalent to FBIO_MODEINFO) */\n#define CONS_MODEINFO\t_IOWR('c', 102, video_info_t)\n\n/* find a video mode (equivalent to FBIO_FINDMODE) */\n#define CONS_FINDMODE\t_IOWR('c', 103, video_info_t)\n\n/* set the frame buffer window origin (equivalent to FBIO_SETWINORG) */\n#define CONS_SETWINORG\t_IOWINT('c', 104)\n\n/* use the specified keyboard */\n#define CONS_SETKBD\t_IOWINT('c', 110)\n\n/* release the current keyboard */\n#define CONS_RELKBD\t_IO('c', 111)\n\nstruct scrshot {\n\tint\t\tx;\n\tint\t\ty;\n\tint\t\txsize;\n\tint\t\tysize;\n\tu_int16_t*\tbuf;\n};\ntypedef struct scrshot scrshot_t;\n\n/* Snapshot the current video buffer */\n#define CONS_SCRSHOT\t_IOWR('c', 105, scrshot_t)\n\n/* get/set the current terminal emulator info. */\n#define TI_NAME_LEN\t32\n#define TI_DESC_LEN\t64\n\nstruct term_info {\n\tint\t\tti_index;\n\tint\t\tti_flags;\n\tu_char\t\tti_name[TI_NAME_LEN];\n\tu_char\t\tti_desc[TI_DESC_LEN];\n};\ntypedef struct term_info term_info_t;\n\n#define CONS_GETTERM\t_IOWR('c', 112, term_info_t)\n#define CONS_SETTERM\t_IOW('c', 113, term_info_t)\n\n/*\n * Vty switching ioctl commands.\n */\n\n/* get the next available vty */\n#define VT_OPENQRY\t_IOR('v', 1, int)\n\n/* set/get vty switching mode */\n#ifndef _VT_MODE_DECLARED\n#define\t_VT_MODE_DECLARED\nstruct vt_mode {\n\tchar\t\tmode;\n#define VT_AUTO\t\t0\t\t/* switching is automatic \t*/\n#define VT_PROCESS\t1\t\t/* switching controlled by prog */\n#define VT_KERNEL\t255\t\t/* switching controlled in kernel */\n\tchar\t\twaitv;\t\t/* not implemented yet \tSOS\t*/\n\tshort\t\trelsig;\n\tshort\t\tacqsig;\n\tshort\t\tfrsig;\t\t/* not implemented yet\tSOS\t*/\n};\ntypedef struct vt_mode vtmode_t;\n#endif /* !_VT_MODE_DECLARED */\n\n#define VT_SETMODE\t_IOW('v', 2, vtmode_t)\n#define VT_GETMODE\t_IOR('v', 3, vtmode_t)\n\n/* acknowledge release or acquisition of a vty */\n#define VT_FALSE\t0\n#define VT_TRUE\t\t1\n#define VT_ACKACQ\t2\n#define VT_RELDISP\t_IOWINT('v', 4)\n\n/* activate the specified vty */\n#define VT_ACTIVATE\t_IOWINT('v', 5)\n\n/* wait until the specified vty is activate */\n#define VT_WAITACTIVE\t_IOWINT('v', 6)\n\n/* get the currently active vty */\n#define VT_GETACTIVE\t_IOR('v', 7, int)\n\n/* get the index of the vty */\n#define VT_GETINDEX\t_IOR('v', 8, int)\n\n/* prevent switching vtys */\n#define VT_LOCKSWITCH\t_IOW('v', 9, int)\n\n/*\n * Video mode switching ioctl.  See sys/fbio.h for mode numbers.\n */\n\n#define SW_B40x25 \t_IO('S', M_B40x25)\n#define SW_C40x25  \t_IO('S', M_C40x25)\n#define SW_B80x25  \t_IO('S', M_B80x25)\n#define SW_C80x25  \t_IO('S', M_C80x25)\n#define SW_BG320   \t_IO('S', M_BG320)\n#define SW_CG320   \t_IO('S', M_CG320)\n#define SW_BG640   \t_IO('S', M_BG640)\n#define SW_EGAMONO80x25 _IO('S', M_EGAMONO80x25)\n#define SW_CG320_D    \t_IO('S', M_CG320_D)\n#define SW_CG640_E    \t_IO('S', M_CG640_E)\n#define SW_EGAMONOAPA \t_IO('S', M_EGAMONOAPA)\n#define SW_CG640x350  \t_IO('S', M_CG640x350)\n#define SW_ENH_MONOAPA2 _IO('S', M_ENHMONOAPA2)\n#define SW_ENH_CG640  \t_IO('S', M_ENH_CG640)\n#define SW_ENH_B40x25  \t_IO('S', M_ENH_B40x25)\n#define SW_ENH_C40x25  \t_IO('S', M_ENH_C40x25)\n#define SW_ENH_B80x25  \t_IO('S', M_ENH_B80x25)\n#define SW_ENH_C80x25  \t_IO('S', M_ENH_C80x25)\n#define SW_ENH_B80x43  \t_IO('S', M_ENH_B80x43)\n#define SW_ENH_C80x43  \t_IO('S', M_ENH_C80x43)\n#define SW_MCAMODE    \t_IO('S', M_MCA_MODE)\n#define SW_VGA_C40x25\t_IO('S', M_VGA_C40x25)\n#define SW_VGA_C80x25\t_IO('S', M_VGA_C80x25)\n#define SW_VGA_C80x30\t_IO('S', M_VGA_C80x30)\n#define SW_VGA_C80x50\t_IO('S', M_VGA_C80x50)\n#define SW_VGA_C80x60\t_IO('S', M_VGA_C80x60)\n#define SW_VGA_M80x25\t_IO('S', M_VGA_M80x25)\n#define SW_VGA_M80x30\t_IO('S', M_VGA_M80x30)\n#define SW_VGA_M80x50\t_IO('S', M_VGA_M80x50)\n#define SW_VGA_M80x60\t_IO('S', M_VGA_M80x60)\n#define SW_VGA11\t_IO('S', M_VGA11)\n#define SW_BG640x480\t_IO('S', M_VGA11)\n#define SW_VGA12\t_IO('S', M_VGA12)\n#define SW_CG640x480\t_IO('S', M_VGA12)\n#define SW_VGA13\t_IO('S', M_VGA13)\n#define SW_VGA_CG320\t_IO('S', M_VGA13)\n#define SW_VGA_CG640\t_IO('S', M_VGA_CG640)\n#define SW_VGA_MODEX\t_IO('S', M_VGA_MODEX)\n\n#define SW_PC98_80x25\t\t_IO('S', M_PC98_80x25)\n#define SW_PC98_80x30\t\t_IO('S', M_PC98_80x30)\n#define SW_PC98_EGC640x400\t_IO('S', M_PC98_EGC640x400)\n#define SW_PC98_PEGC640x400\t_IO('S', M_PC98_PEGC640x400)\n#define SW_PC98_PEGC640x480\t_IO('S', M_PC98_PEGC640x480)\n\n#define SW_VGA_C90x25\t_IO('S', M_VGA_C90x25)\n#define SW_VGA_M90x25\t_IO('S', M_VGA_M90x25)\n#define SW_VGA_C90x30\t_IO('S', M_VGA_C90x30)\n#define SW_VGA_M90x30\t_IO('S', M_VGA_M90x30)\n#define SW_VGA_C90x43\t_IO('S', M_VGA_C90x43)\n#define SW_VGA_M90x43\t_IO('S', M_VGA_M90x43)\n#define SW_VGA_C90x50\t_IO('S', M_VGA_C90x50)\n#define SW_VGA_M90x50\t_IO('S', M_VGA_M90x50)\n#define SW_VGA_C90x60\t_IO('S', M_VGA_C90x60)\n#define SW_VGA_M90x60\t_IO('S', M_VGA_M90x60)\n\n#define SW_TEXT_80x25\t_IO('S', M_TEXT_80x25)\n#define SW_TEXT_80x30\t_IO('S', M_TEXT_80x30)\n#define SW_TEXT_80x43\t_IO('S', M_TEXT_80x43)\n#define SW_TEXT_80x50\t_IO('S', M_TEXT_80x50)\n#define SW_TEXT_80x60\t_IO('S', M_TEXT_80x60)\n#define SW_TEXT_132x25\t_IO('S', M_TEXT_132x25)\n#define SW_TEXT_132x30\t_IO('S', M_TEXT_132x30)\n#define SW_TEXT_132x43\t_IO('S', M_TEXT_132x43)\n#define SW_TEXT_132x50\t_IO('S', M_TEXT_132x50)\n#define SW_TEXT_132x60\t_IO('S', M_TEXT_132x60)\n\n#define SW_VESA_CG640x400\t_IO('V', M_VESA_CG640x400 - M_VESA_BASE)\n#define SW_VESA_CG640x480\t_IO('V', M_VESA_CG640x480 - M_VESA_BASE)\n#define SW_VESA_800x600\t\t_IO('V', M_VESA_800x600 - M_VESA_BASE)\n#define SW_VESA_CG800x600\t_IO('V', M_VESA_CG800x600 - M_VESA_BASE)\n#define SW_VESA_1024x768\t_IO('V', M_VESA_1024x768 - M_VESA_BASE)\n#define SW_VESA_CG1024x768\t_IO('V', M_VESA_CG1024x768 - M_VESA_BASE)\n#define SW_VESA_1280x1024\t_IO('V', M_VESA_1280x1024 - M_VESA_BASE)\n#define SW_VESA_CG1280x1024\t_IO('V', M_VESA_CG1280x1024 - M_VESA_BASE)\n#define SW_VESA_C80x60\t\t_IO('V', M_VESA_C80x60 - M_VESA_BASE)\n#define SW_VESA_C132x25\t\t_IO('V', M_VESA_C132x25 - M_VESA_BASE)\n#define SW_VESA_C132x43\t\t_IO('V', M_VESA_C132x43 - M_VESA_BASE)\n#define SW_VESA_C132x50\t\t_IO('V', M_VESA_C132x50 - M_VESA_BASE)\n#define SW_VESA_C132x60\t\t_IO('V', M_VESA_C132x60 - M_VESA_BASE)\n#define SW_VESA_32K_320\t\t_IO('V', M_VESA_32K_320 - M_VESA_BASE)\n#define SW_VESA_64K_320\t\t_IO('V', M_VESA_64K_320 - M_VESA_BASE)\n#define SW_VESA_FULL_320\t_IO('V', M_VESA_FULL_320 - M_VESA_BASE)\n#define SW_VESA_32K_640\t\t_IO('V', M_VESA_32K_640 - M_VESA_BASE)\n#define SW_VESA_64K_640\t\t_IO('V', M_VESA_64K_640 - M_VESA_BASE)\n#define SW_VESA_FULL_640\t_IO('V', M_VESA_FULL_640 - M_VESA_BASE)\n#define SW_VESA_32K_800\t\t_IO('V', M_VESA_32K_800 - M_VESA_BASE)\n#define SW_VESA_64K_800\t\t_IO('V', M_VESA_64K_800 - M_VESA_BASE)\n#define SW_VESA_FULL_800\t_IO('V', M_VESA_FULL_800 - M_VESA_BASE)\n#define SW_VESA_32K_1024\t_IO('V', M_VESA_32K_1024 - M_VESA_BASE)\n#define SW_VESA_64K_1024\t_IO('V', M_VESA_64K_1024 - M_VESA_BASE)\n#define SW_VESA_FULL_1024\t_IO('V', M_VESA_FULL_1024 - M_VESA_BASE)\n#define SW_VESA_32K_1280\t_IO('V', M_VESA_32K_1280 - M_VESA_BASE)\n#define SW_VESA_64K_1280\t_IO('V', M_VESA_64K_1280 - M_VESA_BASE)\n#define SW_VESA_FULL_1280\t_IO('V', M_VESA_FULL_1280 - M_VESA_BASE)\n\n#endif /* !_SYS_CONSIO_H_ */\n"
  },
  {
    "path": "freebsd-headers/sys/copyright.h",
    "content": "/*-\n * Copyright (C) 1992-2012 The FreeBSD Project. All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/sys/copyright.h 229089 2011-12-31 13:44:10Z bz $\n */\n\n\n/* Copyrights macros  */\n\n/* FreeBSD */\n#define COPYRIGHT_FreeBSD \\\n\t\"Copyright (c) 1992-2012 The FreeBSD Project.\\n\"\n\n/* Foundation */\n#define\tTRADEMARK_Foundation \\\n\t\"FreeBSD is a registered trademark of The FreeBSD Foundation.\\n\"\n\n/* Berkeley */\n#define COPYRIGHT_UCB \\\n\t\"Copyright (c) 1979, 1980, 1983, 1986, 1988, 1989, 1991, 1992, 1993, 1994\\n\\tThe Regents of the University of California. All rights reserved.\\n\"\n\n/* a port of FreeBSD to the NEC PC98, Japan */\n#if defined(PC98)\n#define COPYRIGHT_PC98 \\\n\t\"Copyright (c) 1994-2003 FreeBSD(98) porting team.\\nCopyright (c) 1992  A.Kojima F.Ukai M.Ishii (KMC).\\n\"\n#else\n#define COPYRIGHT_PC98\n#endif\n\nchar copyright[] = COPYRIGHT_FreeBSD COPYRIGHT_PC98 COPYRIGHT_UCB;\nchar trademark[] = TRADEMARK_Foundation;\n"
  },
  {
    "path": "freebsd-headers/sys/cpu.h",
    "content": "/*-\n * Copyright (c) 2005-2007 Nate Lawson (SDG)\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/sys/cpu.h 193155 2009-05-31 08:59:15Z nwhitehorn $\n */\n\n#ifndef _SYS_CPU_H_\n#define _SYS_CPU_H_\n\n#include <sys/eventhandler.h>\n\n/*\n * CPU device support.\n */\n\n#define CPU_IVAR_PCPU\t\t1\n#define CPU_IVAR_NOMINAL_MHZ\t2\n\nstatic __inline struct pcpu *cpu_get_pcpu(device_t dev)\n{\n\tuintptr_t v = 0;\n\tBUS_READ_IVAR(device_get_parent(dev), dev, CPU_IVAR_PCPU, &v);\n\treturn ((struct pcpu *)v);\n}\n\nstatic __inline int32_t cpu_get_nominal_mhz(device_t dev)\n{\n\tuintptr_t v = 0;\n\tif (BUS_READ_IVAR(device_get_parent(dev), dev,\n\t    CPU_IVAR_NOMINAL_MHZ, &v) != 0)\n\t\treturn (-1);\n\treturn ((int32_t)v);\n}\n\n/*\n * CPU frequency control interface.\n */\n\n/* Each driver's CPU frequency setting is exported in this format. */\nstruct cf_setting {\n\tint\tfreq;\t/* CPU clock in Mhz or 100ths of a percent. */\n\tint\tvolts;\t/* Voltage in mV. */\n\tint\tpower;\t/* Power consumed in mW. */\n\tint\tlat;\t/* Transition latency in us. */\n\tdevice_t dev;\t/* Driver providing this setting. */\n\tint\tspec[4];/* Driver-specific storage for non-standard info. */\n};\n\n/* Maximum number of settings a given driver can have. */\n#define MAX_SETTINGS\t\t24\n\n/* A combination of settings is a level. */\nstruct cf_level {\n\tstruct cf_setting\ttotal_set;\n\tstruct cf_setting\tabs_set;\n\tstruct cf_setting\trel_set[MAX_SETTINGS];\n\tint\t\t\trel_count;\n\tTAILQ_ENTRY(cf_level)\tlink;\n};\n\nTAILQ_HEAD(cf_level_lst, cf_level);\n\n/* Drivers should set all unknown values to this. */\n#define CPUFREQ_VAL_UNKNOWN\t(-1)\n\n/*\n * Every driver offers a type of CPU control.  Absolute levels are mutually\n * exclusive while relative levels modify the current absolute level.  There\n * may be multiple absolute and relative drivers available on a given\n * system.\n *\n * For example, consider a system with two absolute drivers that provide\n * frequency settings of 100, 200 and 300, 400 and a relative driver that\n * provides settings of 50%, 100%.  The cpufreq core would export frequency\n * levels of 50, 100, 150, 200, 300, 400.\n *\n * The \"info only\" flag signifies that settings returned by\n * CPUFREQ_DRV_SETTINGS cannot be passed to the CPUFREQ_DRV_SET method and\n * are only informational.  This is for some drivers that can return\n * information about settings but rely on another machine-dependent driver\n * for actually performing the frequency transition (e.g., ACPI performance\n * states of type \"functional fixed hardware.\")\n */\n#define CPUFREQ_TYPE_MASK\t0xffff\n#define CPUFREQ_TYPE_RELATIVE\t(1<<0)\n#define CPUFREQ_TYPE_ABSOLUTE\t(1<<1)\n#define CPUFREQ_FLAG_INFO_ONLY\t(1<<16)\n\n/*\n * When setting a level, the caller indicates the priority of this request.\n * Priorities determine, among other things, whether a level can be\n * overridden by other callers.  For example, if the user sets a level but\n * the system thermal driver needs to override it for emergency cooling,\n * the driver would use a higher priority.  Once the event has passed, the\n * driver would call cpufreq to resume any previous level.\n */\n#define CPUFREQ_PRIO_HIGHEST\t1000000\n#define CPUFREQ_PRIO_KERN\t1000\n#define CPUFREQ_PRIO_USER\t100\n#define CPUFREQ_PRIO_LOWEST\t0\n\n/*\n * Register and unregister a driver with the cpufreq core.  Once a driver\n * is registered, it must support calls to its CPUFREQ_GET, CPUFREQ_GET_LEVEL,\n * and CPUFREQ_SET methods.  It must also unregister before returning from\n * its DEVICE_DETACH method.\n */\nint\tcpufreq_register(device_t dev);\nint\tcpufreq_unregister(device_t dev);\n\n/*\n * Notify the cpufreq core that the number of or values for settings have\n * changed.\n */\nint\tcpufreq_settings_changed(device_t dev);\n\n/*\n * Eventhandlers that are called before and after a change in frequency.\n * The new level and the result of the change (0 is success) is passed in.\n * If the driver wishes to revoke the change from cpufreq_pre_change, it\n * stores a non-zero error code in the result parameter and the change will\n * not be made.  If the post-change eventhandler gets a non-zero result, \n * no change was made and the previous level remains in effect.  If a change\n * is revoked, the post-change eventhandler is still called with the error\n * value supplied by the revoking driver.  This gives listeners who cached\n * some data in preparation for a level change a chance to clean up.\n */\ntypedef void (*cpufreq_pre_notify_fn)(void *, const struct cf_level *, int *);\ntypedef void (*cpufreq_post_notify_fn)(void *, const struct cf_level *, int);\nEVENTHANDLER_DECLARE(cpufreq_pre_change, cpufreq_pre_notify_fn);\nEVENTHANDLER_DECLARE(cpufreq_post_change, cpufreq_post_notify_fn);\n\n/*\n * Eventhandler called when the available list of levels changed.\n * The unit number of the device (i.e. \"cpufreq0\") whose levels changed\n * is provided so the listener can retrieve the new list of levels.\n */\ntypedef void (*cpufreq_levels_notify_fn)(void *, int);\nEVENTHANDLER_DECLARE(cpufreq_levels_changed, cpufreq_levels_notify_fn);\n\n/* Allow values to be +/- a bit since sometimes we have to estimate. */\n#define CPUFREQ_CMP(x, y)\t(abs((x) - (y)) < 25)\n\n/*\n * Machine-dependent functions.\n */\n\n/* Estimate the current clock rate for the given CPU id. */\nint\tcpu_est_clockrate(int cpu_id, uint64_t *rate);\n\n#endif /* !_SYS_CPU_H_ */\n"
  },
  {
    "path": "freebsd-headers/sys/cpuctl.h",
    "content": "/*-\n * Copyright (c) 2006-2008 Stanislav Sedov <stas@FreeBSD.org>\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/sys/cpuctl.h 195189 2009-06-30 12:35:47Z stas $\n */\n\n#ifndef _CPUCTL_H_\n#define\t_CPUCTL_H_\n\ntypedef struct {\n\tint\t\tmsr;\t/* MSR to read */\n\tuint64_t\tdata;\n} cpuctl_msr_args_t;\n\ntypedef struct {\n\tint\t\tlevel;\t/* CPUID level */\n\tuint32_t\tdata[4];\n} cpuctl_cpuid_args_t;\n\ntypedef struct {\n\tvoid\t*data;\n\tsize_t\tsize;\n} cpuctl_update_args_t;\n\n#define\tCPUCTL_RDMSR\t_IOWR('c', 1, cpuctl_msr_args_t)\n#define\tCPUCTL_WRMSR\t_IOWR('c', 2, cpuctl_msr_args_t)\n#define\tCPUCTL_CPUID\t_IOWR('c', 3, cpuctl_cpuid_args_t)\n#define\tCPUCTL_UPDATE\t_IOWR('c', 4, cpuctl_update_args_t)\n#define\tCPUCTL_MSRSBIT\t_IOWR('c', 5, cpuctl_msr_args_t)\n#define\tCPUCTL_MSRCBIT\t_IOWR('c', 6, cpuctl_msr_args_t)\n\n#endif /* _CPUCTL_H_ */\n"
  },
  {
    "path": "freebsd-headers/sys/cpuset.h",
    "content": "/*-\n * Copyright (c) 2008,\tJeffrey Roberson <jeff@freebsd.org>\n * All rights reserved.\n *\n * Copyright (c) 2008 Nokia Corporation\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice unmodified, this list of conditions, and the following\n *    disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR\n * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES\n * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,\n * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF\n * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/sys/cpuset.h 223759 2011-07-04 12:18:12Z attilio $\n */\n\n#ifndef _SYS_CPUSET_H_\n#define\t_SYS_CPUSET_H_\n\n#include <sys/_cpuset.h>\n\n#define\tCPUSETBUFSIZ\t((2 + sizeof(long) * 2) * _NCPUWORDS)\n\n#define\t__cpuset_mask(n)\t((long)1 << ((n) % _NCPUBITS))\n#define\tCPU_CLR(n, p)\t((p)->__bits[(n)/_NCPUBITS] &= ~__cpuset_mask(n))\n#define\tCPU_COPY(f, t)\t(void)(*(t) = *(f))\n#define\tCPU_ISSET(n, p)\t(((p)->__bits[(n)/_NCPUBITS] & __cpuset_mask(n)) != 0)\n#define\tCPU_SET(n, p)\t((p)->__bits[(n)/_NCPUBITS] |= __cpuset_mask(n))\n#define\tCPU_ZERO(p) do {\t\t\t\t\\\n\t__size_t __i;\t\t\t\t\t\\\n\tfor (__i = 0; __i < _NCPUWORDS; __i++)\t\t\\\n\t\t(p)->__bits[__i] = 0;\t\t\t\\\n} while (0)\n\n#define\tCPU_FILL(p) do {\t\t\t\t\\\n\t__size_t __i;\t\t\t\t\t\\\n\tfor (__i = 0; __i < _NCPUWORDS; __i++)\t\t\\\n\t\t(p)->__bits[__i] = -1;\t\t\t\\\n} while (0)\n\n#define\tCPU_SETOF(n, p) do {\t\t\t\t\t\\\n\tCPU_ZERO(p);\t\t\t\t\t\t\\\n\t((p)->__bits[(n)/_NCPUBITS] = __cpuset_mask(n));\t\\\n} while (0)\n\n/* Is p empty. */\n#define\tCPU_EMPTY(p) __extension__ ({\t\t\t\\\n\t__size_t __i;\t\t\t\t\t\\\n\tfor (__i = 0; __i < _NCPUWORDS; __i++)\t\t\\\n\t\tif ((p)->__bits[__i])\t\t\t\\\n\t\t\tbreak;\t\t\t\t\\\n\t__i == _NCPUWORDS;\t\t\t\t\\\n})\n\n/* Is p full set. */\n#define\tCPU_ISFULLSET(p) __extension__ ({\t\t\\\n\t__size_t __i;\t\t\t\t\t\\\n\tfor (__i = 0; __i < _NCPUWORDS; __i++)\t\t\\\n\t\tif ((p)->__bits[__i] != (long)-1)\t\\\n\t\t\tbreak;\t\t\t\t\\\n\t__i == _NCPUWORDS;\t\t\t\t\\\n})\n\n/* Is c a subset of p. */\n#define\tCPU_SUBSET(p, c) __extension__ ({\t\t\\\n\t__size_t __i;\t\t\t\t\t\\\n\tfor (__i = 0; __i < _NCPUWORDS; __i++)\t\t\\\n\t\tif (((c)->__bits[__i] &\t\t\t\\\n\t\t    (p)->__bits[__i]) !=\t\t\\\n\t\t    (c)->__bits[__i])\t\t\t\\\n\t\t\tbreak;\t\t\t\t\\\n\t__i == _NCPUWORDS;\t\t\t\t\\\n})\n\n/* Are there any common bits between b & c? */\n#define\tCPU_OVERLAP(p, c) __extension__ ({\t\t\\\n\t__size_t __i;\t\t\t\t\t\\\n\tfor (__i = 0; __i < _NCPUWORDS; __i++)\t\t\\\n\t\tif (((c)->__bits[__i] &\t\t\t\\\n\t\t    (p)->__bits[__i]) != 0)\t\t\\\n\t\t\tbreak;\t\t\t\t\\\n\t__i != _NCPUWORDS;\t\t\t\t\\\n})\n\n/* Compare two sets, returns 0 if equal 1 otherwise. */\n#define\tCPU_CMP(p, c) __extension__ ({\t\t\t\\\n\t__size_t __i;\t\t\t\t\t\\\n\tfor (__i = 0; __i < _NCPUWORDS; __i++)\t\t\\\n\t\tif (((c)->__bits[__i] !=\t\t\\\n\t\t    (p)->__bits[__i]))\t\t\t\\\n\t\t\tbreak;\t\t\t\t\\\n\t__i != _NCPUWORDS;\t\t\t\t\\\n})\n\n#define\tCPU_OR(d, s) do {\t\t\t\t\\\n\t__size_t __i;\t\t\t\t\t\\\n\tfor (__i = 0; __i < _NCPUWORDS; __i++)\t\t\\\n\t\t(d)->__bits[__i] |= (s)->__bits[__i];\t\\\n} while (0)\n\n#define\tCPU_AND(d, s) do {\t\t\t\t\\\n\t__size_t __i;\t\t\t\t\t\\\n\tfor (__i = 0; __i < _NCPUWORDS; __i++)\t\t\\\n\t\t(d)->__bits[__i] &= (s)->__bits[__i];\t\\\n} while (0)\n\n#define\tCPU_NAND(d, s) do {\t\t\t\t\\\n\t__size_t __i;\t\t\t\t\t\\\n\tfor (__i = 0; __i < _NCPUWORDS; __i++)\t\t\\\n\t\t(d)->__bits[__i] &= ~(s)->__bits[__i];\t\\\n} while (0)\n\n#define\tCPU_CLR_ATOMIC(n, p)\t\t\t\t\t\t\\\n\tatomic_clear_long(&(p)->__bits[(n)/_NCPUBITS], __cpuset_mask(n))\n\n#define\tCPU_SET_ATOMIC(n, p)\t\t\t\t\t\t\\\n\tatomic_set_long(&(p)->__bits[(n)/_NCPUBITS], __cpuset_mask(n))\n\n/* Convenience functions catering special cases. */ \n#define\tCPU_OR_ATOMIC(d, s) do {\t\t\t\\\n\t__size_t __i;\t\t\t\t\t\\\n\tfor (__i = 0; __i < _NCPUWORDS; __i++)\t\t\\\n\t\tatomic_set_long(&(d)->__bits[__i],\t\\\n\t\t    (s)->__bits[__i]);\t\t\t\\\n} while (0)\n\n#define\tCPU_COPY_STORE_REL(f, t) do {\t\t\t\t\\\n\t__size_t __i;\t\t\t\t\t\t\\\n\tfor (__i = 0; __i < _NCPUWORDS; __i++)\t\t\t\\\n\t\tatomic_store_rel_long(&(t)->__bits[__i],\t\\\n\t\t    (f)->__bits[__i]);\t\t\t\t\\\n} while (0)\n\n/*\n * Valid cpulevel_t values.\n */\n#define\tCPU_LEVEL_ROOT\t\t1\t/* All system cpus. */\n#define\tCPU_LEVEL_CPUSET\t2\t/* Available cpus for which. */\n#define\tCPU_LEVEL_WHICH\t\t3\t/* Actual mask/id for which. */\n\n/*\n * Valid cpuwhich_t values.\n */\n#define\tCPU_WHICH_TID\t\t1\t/* Specifies a thread id. */\n#define\tCPU_WHICH_PID\t\t2\t/* Specifies a process id. */\n#define\tCPU_WHICH_CPUSET\t3\t/* Specifies a set id. */\n#define\tCPU_WHICH_IRQ\t\t4\t/* Specifies an irq #. */\n#define\tCPU_WHICH_JAIL\t\t5\t/* Specifies a jail id. */\n\n/*\n * Reserved cpuset identifiers.\n */\n#define\tCPUSET_INVALID\t-1\n#define\tCPUSET_DEFAULT\t0\n\n#ifdef _KERNEL\nLIST_HEAD(setlist, cpuset);\n\n/*\n * cpusets encapsulate cpu binding information for one or more threads.\n *\n * \ta - Accessed with atomics.\n *\ts - Set at creation, never modified.  Only a ref required to read.\n *\tc - Locked internally by a cpuset lock.\n *\n * The bitmask is only modified while holding the cpuset lock.  It may be\n * read while only a reference is held but the consumer must be prepared\n * to deal with inconsistent results.\n */\nstruct cpuset {\n\tcpuset_t\t\tcs_mask;\t/* bitmask of valid cpus. */\n\tvolatile u_int\t\tcs_ref;\t\t/* (a) Reference count. */\n\tint\t\t\tcs_flags;\t/* (s) Flags from below. */\n\tcpusetid_t\t\tcs_id;\t\t/* (s) Id or INVALID. */\n\tstruct cpuset\t\t*cs_parent;\t/* (s) Pointer to our parent. */\n\tLIST_ENTRY(cpuset)\tcs_link;\t/* (c) All identified sets. */\n\tLIST_ENTRY(cpuset)\tcs_siblings;\t/* (c) Sibling set link. */\n\tstruct setlist\t\tcs_children;\t/* (c) List of children. */\n};\n\n#define CPU_SET_ROOT    0x0001  /* Set is a root set. */\n#define CPU_SET_RDONLY  0x0002  /* No modification allowed. */\n\nextern cpuset_t *cpuset_root;\nstruct prison;\nstruct proc;\n\nstruct cpuset *cpuset_thread0(void);\nstruct cpuset *cpuset_ref(struct cpuset *);\nvoid\tcpuset_rel(struct cpuset *);\nint\tcpuset_setthread(lwpid_t id, cpuset_t *);\nint\tcpuset_create_root(struct prison *, struct cpuset **);\nint\tcpuset_setproc_update_set(struct proc *, struct cpuset *);\nint\tcpusetobj_ffs(const cpuset_t *);\nchar\t*cpusetobj_strprint(char *, const cpuset_t *);\nint\tcpusetobj_strscan(cpuset_t *, const char *);\n\n#else\n__BEGIN_DECLS\nint\tcpuset(cpusetid_t *);\nint\tcpuset_setid(cpuwhich_t, id_t, cpusetid_t);\nint\tcpuset_getid(cpulevel_t, cpuwhich_t, id_t, cpusetid_t *);\nint\tcpuset_getaffinity(cpulevel_t, cpuwhich_t, id_t, size_t, cpuset_t *);\nint\tcpuset_setaffinity(cpulevel_t, cpuwhich_t, id_t, size_t, const cpuset_t *);\n__END_DECLS\n#endif\n#endif /* !_SYS_CPUSET_H_ */\n"
  },
  {
    "path": "freebsd-headers/sys/ctype.h",
    "content": "/*-\n * Copyright (c) 1982, 1988, 1991, 1993\n *\tThe Regents of the University of California.  All rights reserved.\n * (c) UNIX System Laboratories, Inc.\n * All or some portions of this file are derived from material licensed\n * to the University of California by American Telephone and Telegraph\n * Co. or Unix System Laboratories, Inc. and are reproduced herein with\n * the permission of UNIX System Laboratories, Inc.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 4. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/sys/ctype.h 127976 2004-04-07 04:19:52Z imp $\n */\n\n#ifndef _SYS_CTYPE_H_\n#define\t_SYS_CTYPE_H_\n\n#ifdef _KERNEL\n\n#define isspace(c)\t((c) == ' ' || ((c) >= '\\t' && (c) <= '\\r'))\n#define isascii(c)\t(((c) & ~0x7f) == 0)\n#define isupper(c)\t((c) >= 'A' && (c) <= 'Z')\n#define islower(c)\t((c) >= 'a' && (c) <= 'z')\n#define isalpha(c)\t(isupper(c) || islower(c))\n#define isdigit(c)\t((c) >= '0' && (c) <= '9')\n#define isxdigit(c)\t(isdigit(c) \\\n\t\t\t  || ((c) >= 'A' && (c) <= 'F') \\\n\t\t\t  || ((c) >= 'a' && (c) <= 'f'))\n#define isprint(c)\t((c) >= ' ' && (c) <= '~')\n\n#define toupper(c)\t((c) - 0x20 * (((c) >= 'a') && ((c) <= 'z')))\n#define tolower(c)\t((c) + 0x20 * (((c) >= 'A') && ((c) <= 'Z')))\n\n#endif\n#endif /* !_SYS_CTYPE_H_ */\n"
  },
  {
    "path": "freebsd-headers/sys/dataacq.h",
    "content": "/*\n * Header for general data acquisition definitions.\n *\n * $FreeBSD: release/9.0.0/sys/sys/dataacq.h 59874 2000-05-01 20:32:07Z peter $\n */\n\n#ifndef\t_SYS_DATAACQ_H_\n#define\t_SYS_DATAACQ_H_\n\n#include <sys/ioccom.h>\n\n/* Period in microseconds between analog I/O samples.\n */\n#define AD_MICRO_PERIOD_SET _IOW('A', 1, long)\n#define AD_MICRO_PERIOD_GET _IOR('A', 2, long)\n\n/* Gain list support.  Initially all gains are 1.  If the board\n * supports no gains at all then AD_NGAINS_GET will return a 0.\n *\n * AD_NGAINS_GET: Return the number of gains the board supports\n *\n * AD_SUPPORTED_GAINS: Get the supported gains.\n * The driver will copy out \"ngains\" doubles,\n * where \"ngains\" is obtained with AD_NGAINS_GET.\n *\n * AD_GAINS_SET: Set the gain list.  The driver will copy in \"ngains\" ints.\n *\n * AD_GAINS_GET: Get the gain list.  The driver will copy out \"ngains\" ints.\n */\n\n#define AD_NGAINS_GET     _IOR('A', 3, int)\n#define AD_NCHANS_GET     _IOR('A', 4, int)\n#define AD_SUPPORTED_GAINS _IO('A', 5)\n#define AD_GAINS_SET       _IO('A', 6)\n#define AD_GAINS_GET       _IO('A', 7)\n\n#endif /* !_SYS_DATAACQ_H_ */\n"
  },
  {
    "path": "freebsd-headers/sys/device_port.h",
    "content": "/*-\n * Copyright (c) 1999 Mitsuru IWASAKI <iwasaki@FreeBSD.org>\n * Copyright (c) 1999 Takanori Watanabe <takawata@jp.FreeBSD.org>\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/sys/device_port.h 140464 2005-01-19 01:31:33Z imp $\n */\n\n#if defined(__NetBSD__)\n# include <sys/device.h>\n#elif defined(__FreeBSD__)\n# include <sys/module.h>\n# include <sys/bus.h>\n#endif\n\n/*\n * Macro's to cope with the differences between operating systems and versions. \n */\n\n#if defined(__NetBSD__)\n# define DEVPORT_DEVICE\t\t\tstruct device\n# define DEVPORT_DEVNAME(dev)\t\t(dev).dv_xname\n# define DEVPORT_DEVUNIT(dev)\t\t(dev).dv_unit\n\n#elif defined(__FreeBSD__)\n/*\n * FreeBSD (compatibility for struct device)\n */\n#define DEVPORT_DEVICE\t\t\tdevice_t\n#define DEVPORT_DEVNAME(dev)\t\tdevice_get_name(dev)\n#define DEVPORT_DEVUNIT(dev)\t\tdevice_get_unit(dev)\n#define DEVPORT_ALLOC_SOFTC(dev) \tdevice_get_softc(dev)\n#define DEVPORT_GET_SOFTC(dev)\t\tdevice_get_softc(dev)\n\n#define UNCONF\t1\t\t/* print \" not configured\\n\" */\n\n/*\n * PC-Card device driver (compatibility for struct pccard_devinfo *)\n */\n#define DEVPORT_PDEVICE\t\t\tdevice_t\n#define DEVPORT_PDEVUNIT(pdev)\t\tdevice_get_unit(pdev)\n#define DEVPORT_PDEVFLAGS(pdev)\t\tdevice_get_flags(pdev)\n#define DEVPORT_PDEVIOBASE(pdev)\tbus_get_resource_start(pdev, SYS_RES_IOPORT, 0)\n#define DEVPORT_PDEVIRQ(pdev)\t\tbus_get_resource_start(pdev, SYS_RES_IRQ, 0)\n#define DEVPORT_PDEVMADDR(pdev)\t\tbus_get_resource_start(pdev, SYS_RES_MEMORY, 0)\n#define DEVPORT_PDEVALLOC_SOFTC(pdev)\tdevice_get_softc(pdev)\n#define DEVPORT_PDEVGET_SOFTC(pdev)\tdevice_get_softc(pdev)\n\n#endif /* __FreeBSD__ */\n"
  },
  {
    "path": "freebsd-headers/sys/devicestat.h",
    "content": "/*-\n * Copyright (c) 1997, 1998, 1999 Kenneth D. Merry.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. The name of the author may not be used to endorse or promote products\n *    derived from this software without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/sys/devicestat.h 139825 2005-01-07 02:29:27Z imp $\n */\n\n#ifndef _DEVICESTAT_H\n#define _DEVICESTAT_H\n\n#include <sys/queue.h>\n#include <sys/time.h>\n\n/*\n * XXX: Should really be SPECNAMELEN\n */\n#define DEVSTAT_NAME_LEN  16\n\n/*\n * device name for the mmap device\n */\n#define DEVSTAT_DEVICE_NAME \"devstat\"\n\n/*\n * ATTENTION:  The devstat version below should be incremented any time a\n * change is made in struct devstat, or any time a change is made in the\n * enumerated types that struct devstat uses.  (Only if those changes\n * would require a recompile -- i.e. re-arranging the order of an\n * enumerated type or something like that.)  This version number is used by\n * userland utilities to determine whether or not they are in sync with the\n * kernel.\n */\n#define DEVSTAT_VERSION\t   6\n\n/*\n * These flags specify which statistics features are supported or not\n * supported by a particular device.  The default is all statistics are\n * supported.\n */\ntypedef enum {\n\tDEVSTAT_ALL_SUPPORTED\t= 0x00,\n\tDEVSTAT_NO_BLOCKSIZE\t= 0x01,\n\tDEVSTAT_NO_ORDERED_TAGS\t= 0x02,\n\tDEVSTAT_BS_UNAVAILABLE\t= 0x04\n} devstat_support_flags;\n\ntypedef enum {\n\tDEVSTAT_NO_DATA\t= 0x00,\n\tDEVSTAT_READ\t= 0x01,\n\tDEVSTAT_WRITE\t= 0x02,\n\tDEVSTAT_FREE\t= 0x03\n} devstat_trans_flags;\n#define DEVSTAT_N_TRANS_FLAGS\t4\n\ntypedef enum {\n\tDEVSTAT_TAG_SIMPLE\t= 0x00,\n\tDEVSTAT_TAG_HEAD\t= 0x01,\n\tDEVSTAT_TAG_ORDERED\t= 0x02,\n\tDEVSTAT_TAG_NONE\t= 0x03\n} devstat_tag_type;\n\ntypedef enum {\n\tDEVSTAT_PRIORITY_MIN\t= 0x000,\n\tDEVSTAT_PRIORITY_OTHER\t= 0x020,\n\tDEVSTAT_PRIORITY_PASS\t= 0x030,\n\tDEVSTAT_PRIORITY_FD\t= 0x040,\n\tDEVSTAT_PRIORITY_WFD\t= 0x050,\n\tDEVSTAT_PRIORITY_TAPE\t= 0x060,\n\tDEVSTAT_PRIORITY_CD\t= 0x090,\n\tDEVSTAT_PRIORITY_DISK\t= 0x110,\n\tDEVSTAT_PRIORITY_ARRAY\t= 0x120,\n\tDEVSTAT_PRIORITY_MAX\t= 0xfff\n} devstat_priority;\n\n/*\n * These types are intended to aid statistics gathering/display programs.\n * The first 13 types (up to the 'target' flag) are identical numerically\n * to the SCSI device type numbers.  The next 3 types designate the device\n * interface.  Currently the choices are IDE, SCSI, and 'other'.  The last\n * flag specifies whether or not the given device is a passthrough device\n * or not.  If it is a passthrough device, the lower 4 bits specify which\n * type of physical device lies under the passthrough device, and the next\n * 4 bits specify the interface.\n */\ntypedef enum {\n\tDEVSTAT_TYPE_DIRECT\t= 0x000,\n\tDEVSTAT_TYPE_SEQUENTIAL\t= 0x001,\n\tDEVSTAT_TYPE_PRINTER\t= 0x002,\n\tDEVSTAT_TYPE_PROCESSOR\t= 0x003,\n\tDEVSTAT_TYPE_WORM\t= 0x004,\n\tDEVSTAT_TYPE_CDROM\t= 0x005,\n\tDEVSTAT_TYPE_SCANNER\t= 0x006,\n\tDEVSTAT_TYPE_OPTICAL\t= 0x007,\n\tDEVSTAT_TYPE_CHANGER\t= 0x008,\n\tDEVSTAT_TYPE_COMM\t= 0x009,\n\tDEVSTAT_TYPE_ASC0\t= 0x00a,\n\tDEVSTAT_TYPE_ASC1\t= 0x00b,\n\tDEVSTAT_TYPE_STORARRAY\t= 0x00c,\n\tDEVSTAT_TYPE_ENCLOSURE\t= 0x00d,\n\tDEVSTAT_TYPE_FLOPPY\t= 0x00e,\n\tDEVSTAT_TYPE_MASK\t= 0x00f,\n\tDEVSTAT_TYPE_IF_SCSI\t= 0x010,\n\tDEVSTAT_TYPE_IF_IDE\t= 0x020,\n\tDEVSTAT_TYPE_IF_OTHER\t= 0x030,\n\tDEVSTAT_TYPE_IF_MASK\t= 0x0f0,\n\tDEVSTAT_TYPE_PASS\t= 0x100\n} devstat_type_flags;\n\n/*\n * XXX: Next revision should add\n *\toff_t\t\toffset[DEVSTAT_N_TRANS_FLAGS];\n * XXX: which should contain the offset of the last completed transfer.\n */\nstruct devstat {\n\t/* Internal house-keeping fields */\n\tu_int\t\t\tsequence0;\t     /* Update sequence# */\n\tint\t\t\tallocated;\t     /* Allocated entry */\n\tu_int\t\t\tstart_count;\t     /* started ops */\n\tu_int\t\t\tend_count;\t     /* completed ops */\n\tstruct bintime\t\tbusy_from;\t     /*\n\t\t\t\t\t\t      * busy time unaccounted\n\t\t\t\t\t\t      * for since this time\n\t\t\t\t\t\t      */\n\tSTAILQ_ENTRY(devstat) \tdev_links;\n\tu_int32_t\t\tdevice_number;\t     /*\n\t\t\t\t\t\t      * Devstat device\n\t\t\t\t\t\t      * number.\n\t\t\t\t\t\t      */\n\tchar\t\t\tdevice_name[DEVSTAT_NAME_LEN];\n\tint\t\t\tunit_number;\n\tu_int64_t\t\tbytes[DEVSTAT_N_TRANS_FLAGS];\n\tu_int64_t\t\toperations[DEVSTAT_N_TRANS_FLAGS];\n\tstruct bintime\t\tduration[DEVSTAT_N_TRANS_FLAGS];\n\tstruct bintime\t\tbusy_time;\n\tstruct bintime          creation_time;       /* \n\t\t\t\t\t\t      * Time the device was\n\t\t\t\t\t\t      * created.\n\t\t\t\t\t\t      */\n\tu_int32_t\t\tblock_size;\t     /* Block size, bytes */\n\tu_int64_t\t\ttag_types[3];\t     /*\n\t\t\t\t\t\t      * The number of\n\t\t\t\t\t\t      * simple, ordered, \n\t\t\t\t\t\t      * and head of queue \n\t\t\t\t\t\t      * tags sent.\n\t\t\t\t\t\t      */\n\tdevstat_support_flags\tflags;\t\t     /*\n\t\t\t\t\t\t      * Which statistics\n\t\t\t\t\t\t      * are supported by a \n\t\t\t\t\t\t      * given device.\n\t\t\t\t\t\t      */\n\tdevstat_type_flags\tdevice_type;\t     /* Device type */\n\tdevstat_priority\tpriority;\t     /* Controls list pos. */\n\tconst void\t\t*id;\t\t     /*\n\t\t\t\t\t\t      * Identification for\n\t\t\t\t\t\t      * GEOM nodes\n\t\t\t\t\t\t      */\n\tu_int\t\t\tsequence1;\t     /* Update sequence# */\n};\n\nSTAILQ_HEAD(devstatlist, devstat);\n\n#ifdef _KERNEL\nstruct bio;\n\nstruct devstat *devstat_new_entry(const void *dev_name, int unit_number,\n\t\t\t\t  u_int32_t block_size,\n\t\t\t\t  devstat_support_flags flags,\n\t\t\t\t  devstat_type_flags device_type,\n\t\t\t\t  devstat_priority priority);\n\nvoid devstat_remove_entry(struct devstat *ds);\nvoid devstat_start_transaction(struct devstat *ds, struct bintime *now);\nvoid devstat_start_transaction_bio(struct devstat *ds, struct bio *bp);\nvoid devstat_end_transaction(struct devstat *ds, u_int32_t bytes, \n\t\t\t     devstat_tag_type tag_type,\n\t\t\t     devstat_trans_flags flags,\n\t\t\t     struct bintime *now, struct bintime *then);\nvoid devstat_end_transaction_bio(struct devstat *ds, struct bio *bp);\n#endif\n\n#endif /* _DEVICESTAT_H */\n"
  },
  {
    "path": "freebsd-headers/sys/digiio.h",
    "content": "/*-\n * Copyright (c) 2001 Brian Somers <brian@Awfulhak.org>\n *   based on work by Slawa Olhovchenkov\n *                    John Prince <johnp@knight-trosoft.com>\n *                    Eric Hernes\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/sys/digiio.h 162711 2006-09-27 19:57:02Z ru $\n */\n\n/*\n * A very small subset of cards.\n */\nenum digi_model {\n\tPCXE,\n\tPCXEVE,\n\tPCXI,\n\tPCXEM,\n\tPCCX,\n\tPCIEPCX,\n\tPCIXR\n};\n\nenum {\n\tDIGIDB_INIT = (1<<0),\n\tDIGIDB_OPEN = (1<<1),\n\tDIGIDB_CLOSE = (1<<2),\n\tDIGIDB_SET = (1<<3),\n\tDIGIDB_INT = (1<<4),\n\tDIGIDB_READ = (1<<5),\n\tDIGIDB_WRITE = (1<<6),\n\tDIGIDB_RX = (1<<7),\n\tDIGIDB_TX = (1<<8),\n\tDIGIDB_IRQ = (1<<9),\n\tDIGIDB_MODEM = (1<<10),\n\tDIGIDB_RI = (1<<11),\n};\n\n#define\tDIGIIO_REINIT\t\t_IO('e', 'A')\n#define\tDIGIIO_DEBUG\t\t_IOW('e', 'B', int)\n#define\tDIGIIO_RING\t\t_IOWINT('e', 'C')\n#define\tDIGIIO_MODEL\t\t_IOR('e', 'D', enum digi_model)\n#define\tDIGIIO_IDENT\t\t_IOW('e', 'E', char *)\n#define\tDIGIIO_SETALTPIN\t_IOW('e', 'F', int)\n#define\tDIGIIO_GETALTPIN\t_IOR('e', 'G', int)\n"
  },
  {
    "path": "freebsd-headers/sys/dir.h",
    "content": "/*-\n * Copyright (c) 1982, 1986, 1989, 1993\n *\tThe Regents of the University of California.  All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 4. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t@(#)dir.h\t8.2 (Berkeley) 1/4/94\n * $FreeBSD: release/9.0.0/sys/sys/dir.h 143063 2005-03-02 21:33:29Z joerg $\n */\n\n#ifndef _SYS_DIR_H_\n#define\t_SYS_DIR_H_\n\n#include <sys/cdefs.h>\n\n#ifdef __CC_SUPPORTS_WARNING\n#warning \"The information in this file should be obtained from <dirent.h>\"\n#warning \"and is provided solely (and temporarily) for backward compatibility.\"\n#endif\n\n#include <dirent.h>\n\n/*\n * Backwards compatibility.\n */\n#define\tdirect\t\tdirent\n#define\tDIRSIZ(dp)\t_GENERIC_DIRSIZ(dp)\n\n#endif /* !_SYS_DIR_H_ */\n"
  },
  {
    "path": "freebsd-headers/sys/dirent.h",
    "content": "/*-\n * Copyright (c) 1989, 1993\n *\tThe Regents of the University of California.  All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 4. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t@(#)dirent.h\t8.3 (Berkeley) 8/10/94\n * $FreeBSD: release/9.0.0/sys/sys/dirent.h 161347 2006-08-16 09:34:56Z maxim $\n */\n\n#ifndef\t_SYS_DIRENT_H_\n#define\t_SYS_DIRENT_H_\n\n#include <sys/cdefs.h>\n#include <sys/_types.h>\n\n/*\n * The dirent structure defines the format of directory entries returned by\n * the getdirentries(2) system call.\n *\n * A directory entry has a struct dirent at the front of it, containing its\n * inode number, the length of the entry, and the length of the name\n * contained in the entry.  These are followed by the name padded to a 4\n * byte boundary with null bytes.  All names are guaranteed null terminated.\n * The maximum length of a name in a directory is MAXNAMLEN.\n */\n\nstruct dirent {\n\t__uint32_t d_fileno;\t\t/* file number of entry */\n\t__uint16_t d_reclen;\t\t/* length of this record */\n\t__uint8_t  d_type; \t\t/* file type, see below */\n\t__uint8_t  d_namlen;\t\t/* length of string in d_name */\n#if __BSD_VISIBLE\n#define\tMAXNAMLEN\t255\n\tchar\td_name[MAXNAMLEN + 1];\t/* name must be no longer than this */\n#else\n\tchar\td_name[255 + 1];\t/* name must be no longer than this */\n#endif\n};\n\n#if __BSD_VISIBLE\n/*\n * File types\n */\n#define\tDT_UNKNOWN\t 0\n#define\tDT_FIFO\t\t 1\n#define\tDT_CHR\t\t 2\n#define\tDT_DIR\t\t 4\n#define\tDT_BLK\t\t 6\n#define\tDT_REG\t\t 8\n#define\tDT_LNK\t\t10\n#define\tDT_SOCK\t\t12\n#define\tDT_WHT\t\t14\n\n/*\n * Convert between stat structure types and directory types.\n */\n#define\tIFTODT(mode)\t(((mode) & 0170000) >> 12)\n#define\tDTTOIF(dirtype)\t((dirtype) << 12)\n\n/*\n * The _GENERIC_DIRSIZ macro gives the minimum record length which will hold\n * the directory entry.  This returns the amount of space in struct direct\n * without the d_name field, plus enough space for the name with a terminating\n * null byte (dp->d_namlen+1), rounded up to a 4 byte boundary.\n *\n * XXX although this macro is in the implementation namespace, it requires\n * a manifest constant that is not.\n */\n#define\t_GENERIC_DIRSIZ(dp) \\\n    ((sizeof (struct dirent) - (MAXNAMLEN+1)) + (((dp)->d_namlen+1 + 3) &~ 3))\n#endif /* __BSD_VISIBLE */\n\n#ifdef _KERNEL\n#define\tGENERIC_DIRSIZ(dp)\t_GENERIC_DIRSIZ(dp)\n#endif\n\n#endif /* !_SYS_DIRENT_H_ */\n"
  },
  {
    "path": "freebsd-headers/sys/disk.h",
    "content": "/*-\n * ----------------------------------------------------------------------------\n * \"THE BEER-WARE LICENSE\" (Revision 42):\n * <phk@FreeBSD.ORG> wrote this file.  As long as you retain this notice you\n * can do whatever you want with this stuff. If we meet some day, and you think\n * this stuff is worth it, you can buy me a beer in return.   Poul-Henning Kamp\n * ----------------------------------------------------------------------------\n *\n * $FreeBSD: release/9.0.0/sys/sys/disk.h 223089 2011-06-14 17:10:32Z gibbs $\n *\n */\n\n#ifndef _SYS_DISK_H_\n#define\t_SYS_DISK_H_\n\n#include <sys/ioccom.h>\n\n#ifdef _KERNEL\n\n#ifndef _SYS_CONF_H_\n#include <sys/conf.h>\t/* XXX: temporary to avoid breakage */\n#endif\n\nvoid disk_err(struct bio *bp, const char *what, int blkdone, int nl);\n\n#endif\n\n#define\tDIOCGSECTORSIZE\t_IOR('d', 128, u_int)\n\t/*\n\t * Get the sector size of the device in bytes.  The sector size is the\n\t * smallest unit of data which can be transferred from this device.\n\t * Usually this is a power of 2 but it might not be (i.e. CDROM audio).\n\t */\n\n#define\tDIOCGMEDIASIZE\t_IOR('d', 129, off_t)\t/* Get media size in bytes */\n\t/*\n\t * Get the size of the entire device in bytes.  This should be a\n\t * multiple of the sector size.\n\t */\n\n#define\tDIOCGFWSECTORS\t_IOR('d', 130, u_int)\t/* Get firmware's sectorcount */\n\t/*\n\t * Get the firmware's notion of number of sectors per track.  This\n\t * value is mostly used for compatibility with various ill designed\n\t * disk label formats.  Don't use it unless you have to.\n\t */\n\n#define\tDIOCGFWHEADS\t_IOR('d', 131, u_int)\t/* Get firmware's headcount */\n\t/*\n\t * Get the firmwares notion of number of heads per cylinder.  This\n\t * value is mostly used for compatibility with various ill designed\n\t * disk label formats.  Don't use it unless you have to.\n\t */\n\n#define\tDIOCSKERNELDUMP _IOW('d', 133, u_int)\t/* Set/Clear kernel dumps */\n\t/*\n\t * Enable/Disable (the argument is boolean) the device for kernel\n\t * core dumps.\n\t */\n\t\n#define\tDIOCGFRONTSTUFF _IOR('d', 134, off_t)\n\t/*\n\t * Many disk formats have some amount of space reserved at the\n\t * start of the disk to hold bootblocks, various disklabels and\n\t * similar stuff.  This ioctl returns the number of such bytes\n\t * which may apply to the device.\n\t */\n\n#define\tDIOCGFLUSH _IO('d', 135)\t\t/* Flush write cache */\n\t/*\n\t * Flush write cache of the device.\n\t */\n\n#define\tDIOCGDELETE _IOW('d', 136, off_t[2])\t/* Delete data */\n\t/*\n\t * Mark data on the device as unused.\n\t */\n\n#define\tDISK_IDENT_SIZE\t256\n#define\tDIOCGIDENT _IOR('d', 137, char[DISK_IDENT_SIZE])\n\t/*-\n\t * Get the ident of the given provider. Ident is (most of the time)\n\t * a uniqe and fixed provider's identifier. Ident's properties are as\n\t * follow:\n\t * - ident value is preserved between reboots,\n\t * - provider can be detached/attached and ident is preserved,\n\t * - provider's name can change - ident can't,\n\t * - ident value should not be based on on-disk metadata; in other\n\t *   words copying whole data from one disk to another should not\n\t *   yield the same ident for the other disk,\n\t * - there could be more than one provider with the same ident, but\n\t *   only if they point at exactly the same physical storage, this is\n\t *   the case for multipathing for example,\n\t * - GEOM classes that consumes single providers and provide single\n\t *   providers, like geli, gbde, should just attach class name to the\n\t *   ident of the underlying provider,\n\t * - ident is an ASCII string (is printable),\n\t * - ident is optional and applications can't relay on its presence.\n\t */\n\n#define\tDIOCGPROVIDERNAME _IOR('d', 138, char[MAXPATHLEN])\n\t/*\n\t * Store the provider name, given a device path, in a buffer. The buffer\n\t * must be at least MAXPATHLEN bytes long.\n\t */\n\n#define\tDIOCGSTRIPESIZE\t_IOR('d', 139, off_t)\t/* Get stripe size in bytes */\n\t/*\n\t * Get the size of the device's optimal access block in bytes.\n\t * This should be a multiple of the sector size.\n\t */\n\n#define\tDIOCGSTRIPEOFFSET _IOR('d', 140, off_t)\t/* Get stripe offset in bytes */\n\t/*\n\t * Get the offset of the first device's optimal access block in bytes.\n\t * This should be a multiple of the sector size.\n\t */\n\n#define\tDIOCGPHYSPATH _IOR('d', 141, char[MAXPATHLEN])\n\t/*\n\t * Get a string defining the physical path for a given provider.\n\t * This has similar rules to ident, but is intended to uniquely\n\t * identify the physical location of the device, not the current\n\t * occupant of that location.\n\t */\n\n#endif /* _SYS_DISK_H_ */\n"
  },
  {
    "path": "freebsd-headers/sys/disklabel.h",
    "content": "/*-\n * Copyright (c) 1987, 1988, 1993\n *\tThe Regents of the University of California.  All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 4. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t@(#)disklabel.h\t8.2 (Berkeley) 7/10/94\n * $FreeBSD: release/9.0.0/sys/sys/disklabel.h 213048 2010-09-23 05:24:50Z jchandra $\n */\n\n#ifndef _SYS_DISKLABEL_H_\n#define\t_SYS_DISKLABEL_H_\n\n#ifndef _KERNEL\n#include <sys/types.h>\n#endif\n#include <sys/ioccom.h>\n\n/*\n * Disk description table, see disktab(5)\n */\n#define\t_PATH_DISKTAB\t\"/etc/disktab\"\n\n/*\n * Each disk has a label which includes information about the hardware\n * disk geometry, filesystem partitions, and drive specific information.\n * The label is in block 0 or 1, possibly offset from the beginning\n * to leave room for a bootstrap, etc.\n */\n\n/* XXX these should be defined per controller (or drive) elsewhere, not here! */\n#if defined(__i386__) || defined(__amd64__) || defined(__arm__) || \\\n    defined(__ia64__) || defined(__powerpc__) || defined(__mips__)\n#define LABELSECTOR\t1\t\t\t/* sector containing label */\n#define LABELOFFSET\t0\t\t\t/* offset of label in sector */\n#endif\n\n#define DISKMAGIC\t((u_int32_t)0x82564557)\t/* The disk magic number */\n#ifndef MAXPARTITIONS\n#define\tMAXPARTITIONS\t8\n#endif\n\n/* Size of bootblock area in sector-size neutral bytes */\n#define BBSIZE\t\t8192\n\n#define\tLABEL_PART\t2\t\t/* partition containing label */\n#define\tRAW_PART\t2\t\t/* partition containing whole disk */\n#define\tSWAP_PART\t1\t\t/* partition normally containing swap */\n\nstruct disklabel {\n\tu_int32_t d_magic;\t\t/* the magic number */\n\tu_int16_t d_type;\t\t/* drive type */\n\tu_int16_t d_subtype;\t\t/* controller/d_type specific */\n\tchar\t  d_typename[16];\t/* type name, e.g. \"eagle\" */\n\n\tchar      d_packname[16];\t/* pack identifier */\n\n\t\t\t/* disk geometry: */\n\tu_int32_t d_secsize;\t\t/* # of bytes per sector */\n\tu_int32_t d_nsectors;\t\t/* # of data sectors per track */\n\tu_int32_t d_ntracks;\t\t/* # of tracks per cylinder */\n\tu_int32_t d_ncylinders;\t\t/* # of data cylinders per unit */\n\tu_int32_t d_secpercyl;\t\t/* # of data sectors per cylinder */\n\tu_int32_t d_secperunit;\t\t/* # of data sectors per unit */\n\n\t/*\n\t * Spares (bad sector replacements) below are not counted in\n\t * d_nsectors or d_secpercyl.  Spare sectors are assumed to\n\t * be physical sectors which occupy space at the end of each\n\t * track and/or cylinder.\n\t */\n\tu_int16_t d_sparespertrack;\t/* # of spare sectors per track */\n\tu_int16_t d_sparespercyl;\t/* # of spare sectors per cylinder */\n\t/*\n\t * Alternate cylinders include maintenance, replacement, configuration\n\t * description areas, etc.\n\t */\n\tu_int32_t d_acylinders;\t\t/* # of alt. cylinders per unit */\n\n\t\t\t/* hardware characteristics: */\n\t/*\n\t * d_interleave, d_trackskew and d_cylskew describe perturbations\n\t * in the media format used to compensate for a slow controller.\n\t * Interleave is physical sector interleave, set up by the\n\t * formatter or controller when formatting.  When interleaving is\n\t * in use, logically adjacent sectors are not physically\n\t * contiguous, but instead are separated by some number of\n\t * sectors.  It is specified as the ratio of physical sectors\n\t * traversed per logical sector.  Thus an interleave of 1:1\n\t * implies contiguous layout, while 2:1 implies that logical\n\t * sector 0 is separated by one sector from logical sector 1.\n\t * d_trackskew is the offset of sector 0 on track N relative to\n\t * sector 0 on track N-1 on the same cylinder.  Finally, d_cylskew\n\t * is the offset of sector 0 on cylinder N relative to sector 0\n\t * on cylinder N-1.\n\t */\n\tu_int16_t d_rpm;\t\t/* rotational speed */\n\tu_int16_t d_interleave;\t\t/* hardware sector interleave */\n\tu_int16_t d_trackskew;\t\t/* sector 0 skew, per track */\n\tu_int16_t d_cylskew;\t\t/* sector 0 skew, per cylinder */\n\tu_int32_t d_headswitch;\t\t/* head switch time, usec */\n\tu_int32_t d_trkseek;\t\t/* track-to-track seek, usec */\n\tu_int32_t d_flags;\t\t/* generic flags */\n#define NDDATA 5\n\tu_int32_t d_drivedata[NDDATA];\t/* drive-type specific information */\n#define NSPARE 5\n\tu_int32_t d_spare[NSPARE];\t/* reserved for future use */\n\tu_int32_t d_magic2;\t\t/* the magic number (again) */\n\tu_int16_t d_checksum;\t\t/* xor of data incl. partitions */\n\n\t\t\t/* filesystem and partition information: */\n\tu_int16_t d_npartitions;\t/* number of partitions in following */\n\tu_int32_t d_bbsize;\t\t/* size of boot area at sn0, bytes */\n\tu_int32_t d_sbsize;\t\t/* max size of fs superblock, bytes */\n\tstruct partition {\t\t/* the partition table */\n\t\tu_int32_t p_size;\t/* number of sectors in partition */\n\t\tu_int32_t p_offset;\t/* starting sector */\n\t\tu_int32_t p_fsize;\t/* filesystem basic fragment size */\n\t\tu_int8_t p_fstype;\t/* filesystem type, see below */\n\t\tu_int8_t p_frag;\t/* filesystem fragments per block */\n\t\tu_int16_t p_cpg;\t/* filesystem cylinders per group */\n\t} d_partitions[MAXPARTITIONS];\t/* actually may be more */\n};\n\n#ifdef CTASSERT\nCTASSERT(sizeof(struct disklabel) == 148 + MAXPARTITIONS * 16);\n#endif\n\nstatic __inline u_int16_t dkcksum(struct disklabel *lp);\nstatic __inline u_int16_t\ndkcksum(struct disklabel *lp)\n{\n\tu_int16_t *start, *end;\n\tu_int16_t sum = 0;\n\n\tstart = (u_int16_t *)lp;\n\tend = (u_int16_t *)&lp->d_partitions[lp->d_npartitions];\n\twhile (start < end)\n\t\tsum ^= *start++;\n\treturn (sum);\n}\n\n\n/* d_type values: */\n#define\tDTYPE_SMD\t\t1\t\t/* SMD, XSMD; VAX hp/up */\n#define\tDTYPE_MSCP\t\t2\t\t/* MSCP */\n#define\tDTYPE_DEC\t\t3\t\t/* other DEC (rk, rl) */\n#define\tDTYPE_SCSI\t\t4\t\t/* SCSI */\n#define\tDTYPE_ESDI\t\t5\t\t/* ESDI interface */\n#define\tDTYPE_ST506\t\t6\t\t/* ST506 etc. */\n#define\tDTYPE_HPIB\t\t7\t\t/* CS/80 on HP-IB */\n#define\tDTYPE_HPFL\t\t8\t\t/* HP Fiber-link */\n#define\tDTYPE_FLOPPY\t\t10\t\t/* floppy */\n#define\tDTYPE_CCD\t\t11\t\t/* concatenated disk */\n#define\tDTYPE_VINUM\t\t12\t\t/* vinum volume */\n#define\tDTYPE_DOC2K\t\t13\t\t/* Msys DiskOnChip */\n#define\tDTYPE_RAID\t\t14\t\t/* CMU RAIDFrame */\n#define\tDTYPE_JFS2\t\t16\t\t/* IBM JFS 2 */\n\n#ifdef DKTYPENAMES\nstatic const char *dktypenames[] = {\n\t\"unknown\",\n\t\"SMD\",\n\t\"MSCP\",\n\t\"old DEC\",\n\t\"SCSI\",\n\t\"ESDI\",\n\t\"ST506\",\n\t\"HP-IB\",\n\t\"HP-FL\",\n\t\"type 9\",\n\t\"floppy\",\n\t\"CCD\",\n\t\"Vinum\",\n\t\"DOC2K\",\n\t\"Raid\",\n\t\"?\",\n\t\"jfs\",\n\tNULL\n};\n#define DKMAXTYPES\t(sizeof(dktypenames) / sizeof(dktypenames[0]) - 1)\n#endif\n\n/*\n * Filesystem type and version.\n * Used to interpret other filesystem-specific\n * per-partition information.\n */\n#define\tFS_UNUSED\t0\t\t/* unused */\n#define\tFS_SWAP\t\t1\t\t/* swap */\n#define\tFS_V6\t\t2\t\t/* Sixth Edition */\n#define\tFS_V7\t\t3\t\t/* Seventh Edition */\n#define\tFS_SYSV\t\t4\t\t/* System V */\n#define\tFS_V71K\t\t5\t\t/* V7 with 1K blocks (4.1, 2.9) */\n#define\tFS_V8\t\t6\t\t/* Eighth Edition, 4K blocks */\n#define\tFS_BSDFFS\t7\t\t/* 4.2BSD fast filesystem */\n#define\tFS_MSDOS\t8\t\t/* MSDOS filesystem */\n#define\tFS_BSDLFS\t9\t\t/* 4.4BSD log-structured filesystem */\n#define\tFS_OTHER\t10\t\t/* in use, but unknown/unsupported */\n#define\tFS_HPFS\t\t11\t\t/* OS/2 high-performance filesystem */\n#define\tFS_ISO9660\t12\t\t/* ISO 9660, normally CD-ROM */\n#define\tFS_BOOT\t\t13\t\t/* partition contains bootstrap */\n#define\tFS_VINUM\t14\t\t/* Vinum drive */\n#define\tFS_RAID\t\t15\t\t/* RAIDFrame drive */\n#define\tFS_FILECORE\t16\t\t/* Acorn Filecore Filing System */\n#define\tFS_EXT2FS\t17\t\t/* ext2fs */\n#define\tFS_NTFS\t\t18\t\t/* Windows/NT file system */\n#define\tFS_CCD\t\t20\t\t/* concatenated disk component */\n#define\tFS_JFS2\t\t21\t\t/* IBM JFS2 */\n#define\tFS_UDF\t\t24\t\t/* UDF */\n#define\tFS_EFS\t\t26\t\t/* SGI's Extent File system */\n#define\tFS_ZFS\t\t27\t\t/* Sun's ZFS */\n\n#ifdef\tFSTYPENAMES\nstatic const char *fstypenames[] = {\n\t\"unused\",\n\t\"swap\",\n\t\"Version 6\",\n\t\"Version 7\",\n\t\"System V\",\n\t\"4.1BSD\",\n\t\"Eighth Edition\",\n\t\"4.2BSD\",\n\t\"MSDOS\",\n\t\"4.4LFS\",\n\t\"unknown\",\n\t\"HPFS\",\n\t\"ISO9660\",\n\t\"boot\",\n\t\"vinum\",\n\t\"raid\",\n\t\"Filecore\",\n\t\"EXT2FS\",\n\t\"NTFS\",\n\t\"?\",\n\t\"ccd\",\n\t\"jfs\",\n\t\"?\",\n\t\"?\",\n\t\"UDF\",\n\t\"?\",\n\t\"EFS\",\n\t\"ZFS\",\n\tNULL\n};\n#define FSMAXTYPES\t(sizeof(fstypenames) / sizeof(fstypenames[0]) - 1)\n#endif\n\n/*\n * flags shared by various drives:\n */\n#define\tD_REMOVABLE\t0x01\t\t/* removable media */\n#define\tD_ECC\t\t0x02\t\t/* supports ECC */\n#define\tD_BADSECT\t0x04\t\t/* supports bad sector forw. */\n#define\tD_RAMDISK\t0x08\t\t/* disk emulator */\n#define\tD_CHAIN\t\t0x10\t\t/* can do back-back transfers */\n\n/*\n * Disklabel-specific ioctls.\n *\n * NB: <sys/disk.h> defines ioctls from 'd'/128 and up.\n */\n\t\t/* get and set disklabel */\n#define DIOCGDINFO\t_IOR('d', 101, struct disklabel)/* get */\n#define DIOCSDINFO\t_IOW('d', 102, struct disklabel)/* set */\n#define DIOCWDINFO\t_IOW('d', 103, struct disklabel)/* set, update disk */\n#define DIOCBSDBB\t_IOW('d', 110, void *)\t/* write bootblocks */\n\n/*\n * Functions for proper encoding/decoding of struct disklabel into/from\n * bytestring.\n */\nvoid bsd_partition_le_dec(u_char *ptr, struct partition *d);\nint bsd_disklabel_le_dec(u_char *ptr, struct disklabel *d, int maxpart);\nvoid bsd_partition_le_enc(u_char *ptr, struct partition *d);\nvoid bsd_disklabel_le_enc(u_char *ptr, struct disklabel *d);\n\n#ifndef _KERNEL\n__BEGIN_DECLS\nstruct disklabel *getdiskbyname(const char *);\n__END_DECLS\n#endif\n\n#endif /* !_SYS_DISKLABEL_H_ */\n"
  },
  {
    "path": "freebsd-headers/sys/diskmbr.h",
    "content": "/*-\n * Copyright (c) 1987, 1988, 1993\n *\tThe Regents of the University of California.  All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 4. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t@(#)disklabel.h\t8.2 (Berkeley) 7/10/94\n * $FreeBSD: release/9.0.0/sys/sys/diskmbr.h 223587 2011-06-27 10:42:06Z ae $\n */\n\n#ifndef _SYS_DISKMBR_H_\n#define\t_SYS_DISKMBR_H_\n\n#include <sys/ioccom.h>\n\n#define\tDOSBBSECTOR\t0\t/* DOS boot block relative sector number */\n#define\tDOSDSNOFF\t440\t/* WinNT/2K/XP Drive Serial Number offset */\n#define\tDOSPARTOFF\t446\n#define\tDOSPARTSIZE\t16\n#define\tNDOSPART\t4\n#define\tNEXTDOSPART\t32\n#define\tDOSMAGICOFFSET\t510\n#define\tDOSMAGIC\t0xAA55\n\n#define\tDOSPTYP_EXT\t0x05\t/* DOS extended partition */\n#define\tDOSPTYP_NTFS\t0x07\t/* NTFS partition */\n#define\tDOSPTYP_FAT32\t0x0b\t/* FAT32 partition */\n#define\tDOSPTYP_EXTLBA\t0x0f\t/* DOS extended partition */\n#define\tDOSPTYP_386BSD\t0xa5\t/* 386BSD partition type */\n#define\tDOSPTYP_LINSWP\t0x82\t/* Linux swap partition */\n#define\tDOSPTYP_LINUX\t0x83\t/* Linux partition */\n#define\tDOSPTYP_LINLVM\t0x8e\t/* Linux LVM partition */\n#define\tDOSPTYP_PMBR\t0xee\t/* GPT Protective MBR */\n#define\tDOSPTYP_LINRAID\t0xfd\t/* Linux raid partition */\n\nstruct dos_partition {\n\tunsigned char\tdp_flag;\t/* bootstrap flags */\n\tunsigned char\tdp_shd;\t\t/* starting head */\n\tunsigned char\tdp_ssect;\t/* starting sector */\n\tunsigned char\tdp_scyl;\t/* starting cylinder */\n\tunsigned char\tdp_typ;\t\t/* partition type */\n\tunsigned char\tdp_ehd;\t\t/* end head */\n\tunsigned char\tdp_esect;\t/* end sector */\n\tunsigned char\tdp_ecyl;\t/* end cylinder */\n\tu_int32_t\tdp_start;\t/* absolute starting sector number */\n\tu_int32_t\tdp_size;\t/* partition size in sectors */\n};\n#ifdef CTASSERT\nCTASSERT(sizeof (struct dos_partition) == DOSPARTSIZE);\n#endif\n\nvoid dos_partition_dec(void const *pp, struct dos_partition *d);\nvoid dos_partition_enc(void *pp, struct dos_partition *d);\n\n#define\tDPSECT(s) ((s) & 0x3f)\t\t/* isolate relevant bits of sector */\n#define\tDPCYL(c, s) ((c) + (((s) & 0xc0)<<2)) /* and those that are cylinder */\n\n#define DIOCSMBR \t_IOW('M', 129, u_char[512])\n\n#endif /* !_SYS_DISKMBR_H_ */\n"
  },
  {
    "path": "freebsd-headers/sys/diskpc98.h",
    "content": "/*-\n * Copyright (c) 1987, 1988, 1993\n *\tThe Regents of the University of California.  All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 4. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t@(#)disklabel.h\t8.2 (Berkeley) 7/10/94\n * $FreeBSD: release/9.0.0/sys/sys/diskpc98.h 223262 2011-06-18 13:56:33Z benl $\n */\n\n#ifndef _SYS_DISKPC98_H_\n#define\t_SYS_DISKPC98_H_\n\n#include <sys/ioccom.h>\n\n#define\tDOSBBSECTOR\t0\t/* DOS boot block relative sector number */\n#undef DOSPARTOFF\n#define\tDOSPARTOFF\t0\n#undef DOSPARTSIZE\n#define\tDOSPARTSIZE\t32\n#undef NDOSPART\n#define\tNDOSPART\t16\n#define\tDOSMAGICOFFSET\t510\n#define\tDOSMAGIC\t0xAA55\n\n#define\tPC98_MID_BOOTABLE\t0x80\n#define\tPC98_MID_MASK\t\t0x7f\n#define\tPC98_MID_386BSD\t\t0x14\n\n#define\tPC98_SID_ACTIVE\t\t0x80\n#define\tPC98_SID_MASK\t\t0x7f\n#define\tPC98_SID_386BSD\t\t0x44\n\n#define\tDOSMID_386BSD\t\t(PC98_MID_386BSD | PC98_MID_BOOTABLE)\n#define\tDOSSID_386BSD\t\t(PC98_SID_386BSD | PC98_SID_ACTIVE)\n#undef DOSPTYP_386BSD\n#define\tDOSPTYP_386BSD\t\t(DOSSID_386BSD << 8 | DOSMID_386BSD)\n\nstruct pc98_partition {\n    \tunsigned char\tdp_mid;\n\tunsigned char\tdp_sid;\n\tunsigned char\tdp_dum1;\n\tunsigned char\tdp_dum2;\n\tunsigned char\tdp_ipl_sct;\n\tunsigned char\tdp_ipl_head;\n\tunsigned short\tdp_ipl_cyl;\n\tunsigned char\tdp_ssect;\t/* starting sector */\n\tunsigned char\tdp_shd;\t\t/* starting head */\n\tunsigned short\tdp_scyl;\t/* starting cylinder */\n\tunsigned char\tdp_esect;\t/* end sector */\n\tunsigned char\tdp_ehd;\t\t/* end head */\n\tunsigned short\tdp_ecyl;\t/* end cylinder */\n\tunsigned char\tdp_name[16];\n};\n#ifdef CTASSERT\nCTASSERT(sizeof (struct pc98_partition) == DOSPARTSIZE);\n#endif\n\nvoid pc98_partition_dec(void const *pp, struct pc98_partition *d);\nvoid pc98_partition_enc(void *pp, struct pc98_partition *d);\n\n#define DIOCSPC98\t_IOW('M', 129, u_char[8192])\n\n#endif /* !_SYS_DISKPC98_H_ */\n"
  },
  {
    "path": "freebsd-headers/sys/dkstat.h",
    "content": "/*-\n * Copyright (c) 1990, 1993\n *\tThe Regents of the University of California.  All rights reserved.\n * (c) UNIX System Laboratories, Inc.\n * All or some portions of this file are derived from material licensed\n * to the University of California by American Telephone and Telegraph\n * Co. or Unix System Laboratories, Inc. and are reproduced herein with\n * the permission of UNIX System Laboratories, Inc.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 4. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t@(#)dkstat.h\t8.2 (Berkeley) 1/21/94\n * $FreeBSD: release/9.0.0/sys/sys/dkstat.h 127976 2004-04-07 04:19:52Z imp $\n */\n\n#ifndef _SYS_DKSTAT_H_\n#define _SYS_DKSTAT_H_ 1\n\n#include <sys/resource.h>\n\n#endif /* _SYS_DKSTAT_H_ */\n"
  },
  {
    "path": "freebsd-headers/sys/domain.h",
    "content": "/*-\n * Copyright (c) 1982, 1986, 1993\n *\tThe Regents of the University of California.  All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 4. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t@(#)domain.h\t8.1 (Berkeley) 6/2/93\n * $FreeBSD: release/9.0.0/sys/sys/domain.h 195837 2009-07-23 20:46:49Z rwatson $\n */\n\n#ifndef _SYS_DOMAIN_H_\n#define _SYS_DOMAIN_H_\n\n/*\n * Structure per communications domain.\n */\n\n/*\n * Forward structure declarations for function prototypes [sic].\n */\nstruct\tmbuf;\nstruct\tifnet;\n\nstruct domain {\n\tint\tdom_family;\t\t/* AF_xxx */\n\tchar\t*dom_name;\n\tvoid\t(*dom_init)\t\t/* initialize domain data structures */\n\t\t(void);\n\tvoid\t(*dom_destroy)\t\t/* cleanup structures / state */\n\t\t(void);\n\tint\t(*dom_externalize)\t/* externalize access rights */\n\t\t(struct mbuf *, struct mbuf **);\n\tvoid\t(*dom_dispose)\t\t/* dispose of internalized rights */\n\t\t(struct mbuf *);\n\tstruct\tprotosw *dom_protosw, *dom_protoswNPROTOSW;\n\tstruct\tdomain *dom_next;\n\tint\t(*dom_rtattach)\t\t/* initialize routing table */\n\t\t(void **, int);\n\tint\t(*dom_rtdetach)\t\t/* clean up routing table */\n\t\t(void **, int);\n\tint\tdom_rtoffset;\t\t/* an arg to rtattach, in bits */\n\t\t/* XXX MRT.\n\t\t * rtoffset May be 0 if the domain supplies its own rtattach(),\n\t\t * in which case, a 0 indicates it's being called from \n\t\t * vfs_export.c (HACK)  Only for AF_INET{,6} at this time.\n\t\t * Temporary ABI compat hack.. fix post RELENG_7\n\t\t */\n\tint\tdom_maxrtkey;\t\t/* for routing layer */\n\tvoid\t*(*dom_ifattach)(struct ifnet *);\n\tvoid\t(*dom_ifdetach)(struct ifnet *, void *);\n\t\t\t\t\t/* af-dependent data on ifnet */\n};\n\n#ifdef _KERNEL\nextern int\tdomain_init_status;\nextern struct\tdomain *domains;\nvoid\t\tdomain_add(void *);\nvoid\t\tdomain_init(void *);\n#ifdef VIMAGE\nvoid\t\tvnet_domain_init(void *);\nvoid\t\tvnet_domain_uninit(void *);\n#endif\n\n#define\tDOMAIN_SET(name)\t\t\t\t\t\t\\\n\tSYSINIT(domain_add_ ## name, SI_SUB_PROTO_DOMAIN,\t\t\\\n\t    SI_ORDER_FIRST, domain_add, & name ## domain);\t\t\\\n\tSYSINIT(domain_init_ ## name, SI_SUB_PROTO_DOMAIN,\t\t\\\n\t    SI_ORDER_SECOND, domain_init, & name ## domain);\n#ifdef VIMAGE\n#define\tVNET_DOMAIN_SET(name)\t\t\t\t\t\t\\\n\tSYSINIT(domain_add_ ## name, SI_SUB_PROTO_DOMAIN,\t\t\\\n\t    SI_ORDER_FIRST, domain_add, & name ## domain);\t\t\\\n\tVNET_SYSINIT(vnet_domain_init_ ## name, SI_SUB_PROTO_DOMAIN,\t\\\n\t    SI_ORDER_SECOND, vnet_domain_init, & name ## domain);\t\\\n\tVNET_SYSUNINIT(vnet_domain_uninit_ ## name,\t\t\t\\\n\t    SI_SUB_PROTO_DOMAIN, SI_ORDER_SECOND, vnet_domain_uninit,\t\\\n\t    & name ## domain)\n#else /* !VIMAGE */\n#define\tVNET_DOMAIN_SET(name)\tDOMAIN_SET(name)\n#endif /* VIMAGE */\n\n#endif /* _KERNEL */\n\n#endif /* !_SYS_DOMAIN_H_ */\n"
  },
  {
    "path": "freebsd-headers/sys/dtrace_bsd.h",
    "content": "/*-\n * Copyright (c) 2007-2008 John Birrell (jb@freebsd.org)\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/sys/dtrace_bsd.h 223280 2011-06-18 23:02:53Z rmacklem $\n *\n * This file contains BSD shims for Sun's DTrace code.\n */\n\n#ifndef _SYS_DTRACE_BSD_H\n#define\t_SYS_DTRACE_BSD_H\n\n/* Forward definitions: */\nstruct mbuf;\nstruct trapframe;\nstruct thread;\nstruct vattr;\nstruct vnode;\nstruct reg;\n\n/*\n * Cyclic clock function type definition used to hook the cyclic\n * subsystem into the appropriate timer interrupt.\n */\ntypedef\tvoid (*cyclic_clock_func_t)(struct trapframe *);\nextern cyclic_clock_func_t\tcyclic_clock_func;\n\nvoid clocksource_cyc_set(const struct bintime *t);\n\n/*\n * The dtrace module handles traps that occur during a DTrace probe.\n * This type definition is used in the trap handler to provide a\n * hook for the dtrace module to register it's handler with.\n */\ntypedef int (*dtrace_trap_func_t)(struct trapframe *, u_int);\n\nint\tdtrace_trap(struct trapframe *, u_int);\n\nextern dtrace_trap_func_t\tdtrace_trap_func;\n\n/* Used by the machine dependent trap() code. */\ntypedef\tint (*dtrace_invop_func_t)(uintptr_t, uintptr_t *, uintptr_t);\ntypedef void (*dtrace_doubletrap_func_t)(void);\n\n/* Global variables in trap.c */\nextern\tdtrace_invop_func_t\tdtrace_invop_func;\nextern\tdtrace_doubletrap_func_t\tdtrace_doubletrap_func;\n\n/* Pid provider hooks */\ntypedef int (*dtrace_fasttrap_probe_ptr_t)(struct reg *);\nextern\tdtrace_fasttrap_probe_ptr_t\tdtrace_fasttrap_probe_ptr;\ntypedef int (*dtrace_pid_probe_ptr_t)(struct reg *);\nextern\tdtrace_pid_probe_ptr_t\tdtrace_pid_probe_ptr;\ntypedef int (*dtrace_return_probe_ptr_t)(struct reg *);\nextern\tdtrace_return_probe_ptr_t\tdtrace_return_probe_ptr;\n\n/* Virtual time hook function type. */\ntypedef\tvoid (*dtrace_vtime_switch_func_t)(struct thread *);\n\nextern int\t\t\tdtrace_vtime_active;\nextern dtrace_vtime_switch_func_t\tdtrace_vtime_switch_func;\n\n/* The fasttrap module hooks into the fork, exit and exit. */\ntypedef void (*dtrace_fork_func_t)(struct proc *, struct proc *);\ntypedef void (*dtrace_execexit_func_t)(struct proc *);\n\n/* Global variable in kern_fork.c */\nextern dtrace_fork_func_t\tdtrace_fasttrap_fork;\n\n/* Global variable in kern_exec.c */\nextern dtrace_execexit_func_t\tdtrace_fasttrap_exec;\n\n/* Global variable in kern_exit.c */\nextern dtrace_execexit_func_t\tdtrace_fasttrap_exit;\n\n/* The dtmalloc provider hooks into malloc. */\ntypedef\tvoid (*dtrace_malloc_probe_func_t)(u_int32_t, uintptr_t arg0,\n    uintptr_t arg1, uintptr_t arg2, uintptr_t arg3, uintptr_t arg4);\n\nextern dtrace_malloc_probe_func_t   dtrace_malloc_probe;\n\n/* dtnfsclient NFSv[34] access cache provider hooks. */\ntypedef void (*dtrace_nfsclient_accesscache_flush_probe_func_t)(uint32_t,\n    struct vnode *);\nextern dtrace_nfsclient_accesscache_flush_probe_func_t\n    dtrace_nfsclient_accesscache_flush_done_probe;\nextern dtrace_nfsclient_accesscache_flush_probe_func_t\n    dtrace_nfscl_accesscache_flush_done_probe;\n\ntypedef void (*dtrace_nfsclient_accesscache_get_probe_func_t)(uint32_t,\n    struct vnode *, uid_t, uint32_t);\nextern dtrace_nfsclient_accesscache_get_probe_func_t\n    dtrace_nfsclient_accesscache_get_hit_probe,\n    dtrace_nfsclient_accesscache_get_miss_probe;\nextern dtrace_nfsclient_accesscache_get_probe_func_t\n    dtrace_nfscl_accesscache_get_hit_probe,\n    dtrace_nfscl_accesscache_get_miss_probe;\n\ntypedef void (*dtrace_nfsclient_accesscache_load_probe_func_t)(uint32_t,\n    struct vnode *, uid_t, uint32_t, int);\nextern dtrace_nfsclient_accesscache_load_probe_func_t\n    dtrace_nfsclient_accesscache_load_done_probe;\nextern dtrace_nfsclient_accesscache_load_probe_func_t\n    dtrace_nfscl_accesscache_load_done_probe;\n\n/* dtnfsclient NFSv[234] attribute cache provider hooks. */\ntypedef void (*dtrace_nfsclient_attrcache_flush_probe_func_t)(uint32_t,\n    struct vnode *);\nextern dtrace_nfsclient_attrcache_flush_probe_func_t\n    dtrace_nfsclient_attrcache_flush_done_probe;\nextern dtrace_nfsclient_attrcache_flush_probe_func_t\n    dtrace_nfscl_attrcache_flush_done_probe;\n\ntypedef void (*dtrace_nfsclient_attrcache_get_hit_probe_func_t)(uint32_t,\n    struct vnode *, struct vattr *);\nextern dtrace_nfsclient_attrcache_get_hit_probe_func_t\n    dtrace_nfsclient_attrcache_get_hit_probe;\nextern dtrace_nfsclient_attrcache_get_hit_probe_func_t\n    dtrace_nfscl_attrcache_get_hit_probe;\n\ntypedef void (*dtrace_nfsclient_attrcache_get_miss_probe_func_t)(uint32_t,\n    struct vnode *);\nextern dtrace_nfsclient_attrcache_get_miss_probe_func_t\n    dtrace_nfsclient_attrcache_get_miss_probe;\nextern dtrace_nfsclient_attrcache_get_miss_probe_func_t\n    dtrace_nfscl_attrcache_get_miss_probe;\n\ntypedef void (*dtrace_nfsclient_attrcache_load_probe_func_t)(uint32_t,\n    struct vnode *, struct vattr *, int);\nextern dtrace_nfsclient_attrcache_load_probe_func_t\n    dtrace_nfsclient_attrcache_load_done_probe;\nextern dtrace_nfsclient_attrcache_load_probe_func_t\n    dtrace_nfscl_attrcache_load_done_probe;\n\n/* dtnfsclient NFSv[234] RPC provider hooks. */\ntypedef void (*dtrace_nfsclient_nfs23_start_probe_func_t)(uint32_t,\n    struct vnode *, struct mbuf *, struct ucred *, int);\nextern dtrace_nfsclient_nfs23_start_probe_func_t\n    dtrace_nfsclient_nfs23_start_probe;\nextern dtrace_nfsclient_nfs23_start_probe_func_t\n    dtrace_nfscl_nfs234_start_probe;\n\ntypedef void (*dtrace_nfsclient_nfs23_done_probe_func_t)(uint32_t,\n    struct vnode *, struct mbuf *, struct ucred *, int, int);\nextern dtrace_nfsclient_nfs23_done_probe_func_t\n    dtrace_nfsclient_nfs23_done_probe;\nextern dtrace_nfsclient_nfs23_done_probe_func_t\n    dtrace_nfscl_nfs234_done_probe;\n\n/*\n * Functions which allow the dtrace module to check that the kernel \n * hooks have been compiled with sufficient space for it's private\n * structures.\n */\nsize_t\tkdtrace_proc_size(void);\nsize_t\tkdtrace_thread_size(void);\n\n/*\n * OpenSolaris compatible time functions returning nanoseconds.\n * On OpenSolaris these return hrtime_t which we define as uint64_t.\n */\nuint64_t\tdtrace_gethrtime(void);\nuint64_t\tdtrace_gethrestime(void);\n\n#endif /* _SYS_DTRACE_BSD_H */\n"
  },
  {
    "path": "freebsd-headers/sys/dvdio.h",
    "content": "/*-\n * Copyright (c) 1999,2000,2001,2002 Sren Schmidt <sos@FreeBSD.org>\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer,\n *    without modification, immediately at the beginning of the file.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. The name of the author may not be used to endorse or promote products\n *    derived from this software without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR\n * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES\n * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,\n * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF\n * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/sys/dvdio.h 91645 2002-03-04 21:08:35Z sos $\n */\n\n#ifndef _SYS_DVDIO_H_\n#define _SYS_DVDIO_H_\n\nstruct dvd_layer {\n\tu_int8_t book_type\t:4;\n\tu_int8_t book_version\t:4;\n\tu_int8_t disc_size\t:4;\n\tu_int8_t max_rate\t:4;\n\tu_int8_t nlayers\t:2;\n\tu_int8_t track_path\t:1;\n\tu_int8_t layer_type\t:4;\n\tu_int8_t linear_density\t:4;\n\tu_int8_t track_density\t:4;\n\tu_int8_t bca\t\t:1;\n\tu_int32_t start_sector;\n\tu_int32_t end_sector;\n\tu_int32_t end_sector_l0;\n};\n\nstruct dvd_struct {\n\tu_char format;\n\tu_char layer_num;\n\tu_char cpst;\n\tu_char rmi;\n\tu_int8_t agid\t\t:2;\n\tu_int32_t length;\n\tu_char data[2048];\n};\n\nstruct dvd_authinfo {\n\tunsigned char format;\n\tu_int8_t agid\t\t:2;\n\tu_int8_t asf\t\t:1;\n\tu_int8_t cpm\t\t:1;\n\tu_int8_t cp_sec\t\t:1;\n\tu_int8_t cgms\t\t:2;\n\tu_int8_t reg_type\t:2;\n\tu_int8_t vend_rsts\t:3;\n\tu_int8_t user_rsts\t:3;\n\tu_int8_t region;\n\tu_int8_t rpc_scheme;\n\tu_int32_t lba;\n\tu_char keychal[10];\n};\n\n#define DVD_STRUCT_PHYSICAL\t0x00\n#define DVD_STRUCT_COPYRIGHT\t0x01\n#define DVD_STRUCT_DISCKEY\t0x02\n#define DVD_STRUCT_BCA\t\t0x03\n#define DVD_STRUCT_MANUFACT\t0x04\n#define DVD_STRUCT_CMI\t\t0x05\n#define DVD_STRUCT_PROTDISCID\t0x06\n#define DVD_STRUCT_DISCKEYBLOCK\t0x07\n#define DVD_STRUCT_DDS\t\t0x08\n#define DVD_STRUCT_MEDIUM_STAT\t0x09\n#define DVD_STRUCT_SPARE_AREA\t0x0A\n#define DVD_STRUCT_RMD_LAST\t0x0C\n#define DVD_STRUCT_RMD_RMA\t0x0D\n#define DVD_STRUCT_PRERECORDED\t0x0E\n#define DVD_STRUCT_UNIQUEID\t0x0F\n#define DVD_STRUCT_DCB\t\t0x30\n#define DVD_STRUCT_LIST\t\t0xFF\n\n#define DVD_REPORT_AGID\t\t0\n#define DVD_REPORT_CHALLENGE\t1\n#define DVD_REPORT_KEY1\t\t2\n#define DVD_REPORT_TITLE_KEY\t4\n#define DVD_REPORT_ASF\t\t5\n#define DVD_REPORT_RPC\t\t8\n#define DVD_INVALIDATE_AGID\t0x3f\n\n#define DVD_SEND_CHALLENGE\t1\n#define DVD_SEND_KEY2\t\t3\n#define DVD_SEND_RPC\t\t6\n\n#define DVDIOCREPORTKEY\t\t_IOWR('c', 200, struct dvd_authinfo)\n#define DVDIOCSENDKEY\t\t_IOWR('c', 201, struct dvd_authinfo)\n#define DVDIOCREADSTRUCTURE\t_IOWR('c', 202, struct dvd_struct)\n\n#endif /* _SYS_DVDIO_H_ */\n"
  },
  {
    "path": "freebsd-headers/sys/elf.h",
    "content": "/*-\n * Copyright (c) 2001 David E. O'Brien.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/sys/elf.h 174043 2007-11-28 21:54:46Z jb $\n */\n\n/*\n * This is a Solaris compatibility header\n */\n\n#ifndef\t_SYS_ELF_H_\n#define\t_SYS_ELF_H_\n\n#include <sys/types.h>\n#include <machine/elf.h>\n#include <sys/elf32.h>\n#include <sys/elf64.h>\n\n#endif /* !_SYS_ELF_H_ */\n"
  },
  {
    "path": "freebsd-headers/sys/elf32.h",
    "content": "/*-\n * Copyright (c) 1996-1998 John D. Polstra.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/sys/elf32.h 163457 2006-10-17 05:43:30Z jkoshy $\n */\n\n#ifndef _SYS_ELF32_H_\n#define _SYS_ELF32_H_ 1\n\n#include <sys/elf_common.h>\n\n/*\n * ELF definitions common to all 32-bit architectures.\n */\n\ntypedef uint32_t\tElf32_Addr;\ntypedef uint16_t\tElf32_Half;\ntypedef uint32_t\tElf32_Off;\ntypedef int32_t\t\tElf32_Sword;\ntypedef uint32_t\tElf32_Word;\ntypedef uint64_t\tElf32_Lword;\n\ntypedef Elf32_Word\tElf32_Hashelt;\n\n/* Non-standard class-dependent datatype used for abstraction. */\ntypedef Elf32_Word\tElf32_Size;\ntypedef Elf32_Sword\tElf32_Ssize;\n\n/*\n * ELF header.\n */\n\ntypedef struct {\n\tunsigned char\te_ident[EI_NIDENT];\t/* File identification. */\n\tElf32_Half\te_type;\t\t/* File type. */\n\tElf32_Half\te_machine;\t/* Machine architecture. */\n\tElf32_Word\te_version;\t/* ELF format version. */\n\tElf32_Addr\te_entry;\t/* Entry point. */\n\tElf32_Off\te_phoff;\t/* Program header file offset. */\n\tElf32_Off\te_shoff;\t/* Section header file offset. */\n\tElf32_Word\te_flags;\t/* Architecture-specific flags. */\n\tElf32_Half\te_ehsize;\t/* Size of ELF header in bytes. */\n\tElf32_Half\te_phentsize;\t/* Size of program header entry. */\n\tElf32_Half\te_phnum;\t/* Number of program header entries. */\n\tElf32_Half\te_shentsize;\t/* Size of section header entry. */\n\tElf32_Half\te_shnum;\t/* Number of section header entries. */\n\tElf32_Half\te_shstrndx;\t/* Section name strings section. */\n} Elf32_Ehdr;\n\n/*\n * Section header.\n */\n\ntypedef struct {\n\tElf32_Word\tsh_name;\t/* Section name (index into the\n\t\t\t\t\t   section header string table). */\n\tElf32_Word\tsh_type;\t/* Section type. */\n\tElf32_Word\tsh_flags;\t/* Section flags. */\n\tElf32_Addr\tsh_addr;\t/* Address in memory image. */\n\tElf32_Off\tsh_offset;\t/* Offset in file. */\n\tElf32_Word\tsh_size;\t/* Size in bytes. */\n\tElf32_Word\tsh_link;\t/* Index of a related section. */\n\tElf32_Word\tsh_info;\t/* Depends on section type. */\n\tElf32_Word\tsh_addralign;\t/* Alignment in bytes. */\n\tElf32_Word\tsh_entsize;\t/* Size of each entry in section. */\n} Elf32_Shdr;\n\n/*\n * Program header.\n */\n\ntypedef struct {\n\tElf32_Word\tp_type;\t\t/* Entry type. */\n\tElf32_Off\tp_offset;\t/* File offset of contents. */\n\tElf32_Addr\tp_vaddr;\t/* Virtual address in memory image. */\n\tElf32_Addr\tp_paddr;\t/* Physical address (not used). */\n\tElf32_Word\tp_filesz;\t/* Size of contents in file. */\n\tElf32_Word\tp_memsz;\t/* Size of contents in memory. */\n\tElf32_Word\tp_flags;\t/* Access permission flags. */\n\tElf32_Word\tp_align;\t/* Alignment in memory and file. */\n} Elf32_Phdr;\n\n/*\n * Dynamic structure.  The \".dynamic\" section contains an array of them.\n */\n\ntypedef struct {\n\tElf32_Sword\td_tag;\t\t/* Entry type. */\n\tunion {\n\t\tElf32_Word\td_val;\t/* Integer value. */\n\t\tElf32_Addr\td_ptr;\t/* Address value. */\n\t} d_un;\n} Elf32_Dyn;\n\n/*\n * Relocation entries.\n */\n\n/* Relocations that don't need an addend field. */\ntypedef struct {\n\tElf32_Addr\tr_offset;\t/* Location to be relocated. */\n\tElf32_Word\tr_info;\t\t/* Relocation type and symbol index. */\n} Elf32_Rel;\n\n/* Relocations that need an addend field. */\ntypedef struct {\n\tElf32_Addr\tr_offset;\t/* Location to be relocated. */\n\tElf32_Word\tr_info;\t\t/* Relocation type and symbol index. */\n\tElf32_Sword\tr_addend;\t/* Addend. */\n} Elf32_Rela;\n\n/* Macros for accessing the fields of r_info. */\n#define ELF32_R_SYM(info)\t((info) >> 8)\n#define ELF32_R_TYPE(info)\t((unsigned char)(info))\n\n/* Macro for constructing r_info from field values. */\n#define ELF32_R_INFO(sym, type)\t(((sym) << 8) + (unsigned char)(type))\n\n/*\n *\tNote entry header\n */\ntypedef Elf_Note Elf32_Nhdr;\n\n/*\n *\tMove entry\n */\ntypedef struct {\n\tElf32_Lword\tm_value;\t/* symbol value */\n\tElf32_Word \tm_info;\t\t/* size + index */\n\tElf32_Word\tm_poffset;\t/* symbol offset */\n\tElf32_Half\tm_repeat;\t/* repeat count */\n\tElf32_Half\tm_stride;\t/* stride info */\n} Elf32_Move;\n\n/*\n *\tThe macros compose and decompose values for Move.r_info\n *\n *\tsym = ELF32_M_SYM(M.m_info)\n *\tsize = ELF32_M_SIZE(M.m_info)\n *\tM.m_info = ELF32_M_INFO(sym, size)\n */\n#define\tELF32_M_SYM(info)\t((info)>>8)\n#define\tELF32_M_SIZE(info)\t((unsigned char)(info))\n#define\tELF32_M_INFO(sym, size)\t(((sym)<<8)+(unsigned char)(size))\n\n/*\n *\tHardware/Software capabilities entry\n */\ntypedef struct {\n\tElf32_Word\tc_tag;\t\t/* how to interpret value */\n\tunion {\n\t\tElf32_Word\tc_val;\n\t\tElf32_Addr\tc_ptr;\n\t} c_un;\n} Elf32_Cap;\n\n/*\n * Symbol table entries.\n */\n\ntypedef struct {\n\tElf32_Word\tst_name;\t/* String table index of name. */\n\tElf32_Addr\tst_value;\t/* Symbol value. */\n\tElf32_Word\tst_size;\t/* Size of associated object. */\n\tunsigned char\tst_info;\t/* Type and binding information. */\n\tunsigned char\tst_other;\t/* Reserved (not used). */\n\tElf32_Half\tst_shndx;\t/* Section index of symbol. */\n} Elf32_Sym;\n\n/* Macros for accessing the fields of st_info. */\n#define ELF32_ST_BIND(info)\t\t((info) >> 4)\n#define ELF32_ST_TYPE(info)\t\t((info) & 0xf)\n\n/* Macro for constructing st_info from field values. */\n#define ELF32_ST_INFO(bind, type)\t(((bind) << 4) + ((type) & 0xf))\n\n/* Macro for accessing the fields of st_other. */\n#define ELF32_ST_VISIBILITY(oth)\t((oth) & 0x3)\n\n/* Structures used by Sun & GNU symbol versioning. */\ntypedef struct\n{\n\tElf32_Half\tvd_version;\n\tElf32_Half\tvd_flags;\n\tElf32_Half\tvd_ndx;\n\tElf32_Half\tvd_cnt;\n\tElf32_Word\tvd_hash;\n\tElf32_Word\tvd_aux;\n\tElf32_Word\tvd_next;\n} Elf32_Verdef;\n\ntypedef struct\n{\n\tElf32_Word\tvda_name;\n\tElf32_Word\tvda_next;\n} Elf32_Verdaux;\n\ntypedef struct\n{\n\tElf32_Half\tvn_version;\n\tElf32_Half\tvn_cnt;\n\tElf32_Word\tvn_file;\n\tElf32_Word\tvn_aux;\n\tElf32_Word\tvn_next;\n} Elf32_Verneed;\n\ntypedef struct\n{\n\tElf32_Word\tvna_hash;\n\tElf32_Half\tvna_flags;\n\tElf32_Half\tvna_other;\n\tElf32_Word\tvna_name;\n\tElf32_Word\tvna_next;\n} Elf32_Vernaux;\n\ntypedef Elf32_Half Elf32_Versym;\n\ntypedef struct {\n\tElf32_Half\tsi_boundto;\t/* direct bindings - symbol bound to */\n\tElf32_Half\tsi_flags;\t/* per symbol flags */\n} Elf32_Syminfo;\n\n#endif /* !_SYS_ELF32_H_ */\n"
  },
  {
    "path": "freebsd-headers/sys/elf64.h",
    "content": "/*-\n * Copyright (c) 1996-1998 John D. Polstra.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/sys/elf64.h 186667 2009-01-01 02:08:56Z obrien $\n */\n\n#ifndef _SYS_ELF64_H_\n#define _SYS_ELF64_H_ 1\n\n#include <sys/elf_common.h>\n\n/*\n * ELF definitions common to all 64-bit architectures.\n */\n\ntypedef uint64_t\tElf64_Addr;\ntypedef uint16_t\tElf64_Half;\ntypedef uint64_t\tElf64_Off;\ntypedef int32_t\t\tElf64_Sword;\ntypedef int64_t\t\tElf64_Sxword;\ntypedef uint32_t\tElf64_Word;\ntypedef uint64_t\tElf64_Lword;\ntypedef uint64_t\tElf64_Xword;\n\n/*\n * Types of dynamic symbol hash table bucket and chain elements.\n *\n * This is inconsistent among 64 bit architectures, so a machine dependent\n * typedef is required.\n */\n\ntypedef Elf64_Word\tElf64_Hashelt;\n\n/* Non-standard class-dependent datatype used for abstraction. */\ntypedef Elf64_Xword\tElf64_Size;\ntypedef Elf64_Sxword\tElf64_Ssize;\n\n/*\n * ELF header.\n */\n\ntypedef struct {\n\tunsigned char\te_ident[EI_NIDENT];\t/* File identification. */\n\tElf64_Half\te_type;\t\t/* File type. */\n\tElf64_Half\te_machine;\t/* Machine architecture. */\n\tElf64_Word\te_version;\t/* ELF format version. */\n\tElf64_Addr\te_entry;\t/* Entry point. */\n\tElf64_Off\te_phoff;\t/* Program header file offset. */\n\tElf64_Off\te_shoff;\t/* Section header file offset. */\n\tElf64_Word\te_flags;\t/* Architecture-specific flags. */\n\tElf64_Half\te_ehsize;\t/* Size of ELF header in bytes. */\n\tElf64_Half\te_phentsize;\t/* Size of program header entry. */\n\tElf64_Half\te_phnum;\t/* Number of program header entries. */\n\tElf64_Half\te_shentsize;\t/* Size of section header entry. */\n\tElf64_Half\te_shnum;\t/* Number of section header entries. */\n\tElf64_Half\te_shstrndx;\t/* Section name strings section. */\n} Elf64_Ehdr;\n\n/*\n * Section header.\n */\n\ntypedef struct {\n\tElf64_Word\tsh_name;\t/* Section name (index into the\n\t\t\t\t\t   section header string table). */\n\tElf64_Word\tsh_type;\t/* Section type. */\n\tElf64_Xword\tsh_flags;\t/* Section flags. */\n\tElf64_Addr\tsh_addr;\t/* Address in memory image. */\n\tElf64_Off\tsh_offset;\t/* Offset in file. */\n\tElf64_Xword\tsh_size;\t/* Size in bytes. */\n\tElf64_Word\tsh_link;\t/* Index of a related section. */\n\tElf64_Word\tsh_info;\t/* Depends on section type. */\n\tElf64_Xword\tsh_addralign;\t/* Alignment in bytes. */\n\tElf64_Xword\tsh_entsize;\t/* Size of each entry in section. */\n} Elf64_Shdr;\n\n/*\n * Program header.\n */\n\ntypedef struct {\n\tElf64_Word\tp_type;\t\t/* Entry type. */\n\tElf64_Word\tp_flags;\t/* Access permission flags. */\n\tElf64_Off\tp_offset;\t/* File offset of contents. */\n\tElf64_Addr\tp_vaddr;\t/* Virtual address in memory image. */\n\tElf64_Addr\tp_paddr;\t/* Physical address (not used). */\n\tElf64_Xword\tp_filesz;\t/* Size of contents in file. */\n\tElf64_Xword\tp_memsz;\t/* Size of contents in memory. */\n\tElf64_Xword\tp_align;\t/* Alignment in memory and file. */\n} Elf64_Phdr;\n\n/*\n * Dynamic structure.  The \".dynamic\" section contains an array of them.\n */\n\ntypedef struct {\n\tElf64_Sxword\td_tag;\t\t/* Entry type. */\n\tunion {\n\t\tElf64_Xword\td_val;\t/* Integer value. */\n\t\tElf64_Addr\td_ptr;\t/* Address value. */\n\t} d_un;\n} Elf64_Dyn;\n\n/*\n * Relocation entries.\n */\n\n/* Relocations that don't need an addend field. */\ntypedef struct {\n\tElf64_Addr\tr_offset;\t/* Location to be relocated. */\n\tElf64_Xword\tr_info;\t\t/* Relocation type and symbol index. */\n} Elf64_Rel;\n\n/* Relocations that need an addend field. */\ntypedef struct {\n\tElf64_Addr\tr_offset;\t/* Location to be relocated. */\n\tElf64_Xword\tr_info;\t\t/* Relocation type and symbol index. */\n\tElf64_Sxword\tr_addend;\t/* Addend. */\n} Elf64_Rela;\n\n/* Macros for accessing the fields of r_info. */\n#define\tELF64_R_SYM(info)\t((info) >> 32)\n#define\tELF64_R_TYPE(info)\t((info) & 0xffffffffL)\n\n/* Macro for constructing r_info from field values. */\n#define\tELF64_R_INFO(sym, type)\t(((sym) << 32) + ((type) & 0xffffffffL))\n\n#define\tELF64_R_TYPE_DATA(info)\t(((Elf64_Xword)(info)<<32)>>40)\n#define\tELF64_R_TYPE_ID(info)\t(((Elf64_Xword)(info)<<56)>>56)\n#define\tELF64_R_TYPE_INFO(data, type)\t\\\n\t\t\t\t(((Elf64_Xword)(data)<<8)+(Elf64_Xword)(type))\n\n/*\n *\tNote entry header\n */\ntypedef Elf_Note Elf64_Nhdr;\n\n/*\n *\tMove entry\n */\ntypedef struct {\n\tElf64_Lword\tm_value;\t/* symbol value */\n\tElf64_Xword \tm_info;\t\t/* size + index */\n\tElf64_Xword\tm_poffset;\t/* symbol offset */\n\tElf64_Half\tm_repeat;\t/* repeat count */\n\tElf64_Half\tm_stride;\t/* stride info */\n} Elf64_Move;\n\n#define\tELF64_M_SYM(info)\t((info)>>8)\n#define\tELF64_M_SIZE(info)\t((unsigned char)(info))\n#define\tELF64_M_INFO(sym, size)\t(((sym)<<8)+(unsigned char)(size))\n\n/*\n *\tHardware/Software capabilities entry\n */\ntypedef struct {\n\tElf64_Xword\tc_tag;\t\t/* how to interpret value */\n\tunion {\n\t\tElf64_Xword\tc_val;\n\t\tElf64_Addr\tc_ptr;\n\t} c_un;\n} Elf64_Cap;\n\n/*\n * Symbol table entries.\n */\n\ntypedef struct {\n\tElf64_Word\tst_name;\t/* String table index of name. */\n\tunsigned char\tst_info;\t/* Type and binding information. */\n\tunsigned char\tst_other;\t/* Reserved (not used). */\n\tElf64_Half\tst_shndx;\t/* Section index of symbol. */\n\tElf64_Addr\tst_value;\t/* Symbol value. */\n\tElf64_Xword\tst_size;\t/* Size of associated object. */\n} Elf64_Sym;\n\n/* Macros for accessing the fields of st_info. */\n#define\tELF64_ST_BIND(info)\t\t((info) >> 4)\n#define\tELF64_ST_TYPE(info)\t\t((info) & 0xf)\n\n/* Macro for constructing st_info from field values. */\n#define\tELF64_ST_INFO(bind, type)\t(((bind) << 4) + ((type) & 0xf))\n\n/* Macro for accessing the fields of st_other. */\n#define\tELF64_ST_VISIBILITY(oth)\t((oth) & 0x3)\n\n/* Structures used by Sun & GNU-style symbol versioning. */\ntypedef struct {\n\tElf64_Half\tvd_version;\n\tElf64_Half\tvd_flags;\n\tElf64_Half\tvd_ndx;\n\tElf64_Half\tvd_cnt;\n\tElf64_Word\tvd_hash;\n\tElf64_Word\tvd_aux;\n\tElf64_Word\tvd_next;\n} Elf64_Verdef;\n\ntypedef struct {\n\tElf64_Word\tvda_name;\n\tElf64_Word\tvda_next;\n} Elf64_Verdaux;\n\ntypedef struct {\n\tElf64_Half\tvn_version;\n\tElf64_Half\tvn_cnt;\n\tElf64_Word\tvn_file;\n\tElf64_Word\tvn_aux;\n\tElf64_Word\tvn_next;\n} Elf64_Verneed;\n\ntypedef struct {\n\tElf64_Word\tvna_hash;\n\tElf64_Half\tvna_flags;\n\tElf64_Half\tvna_other;\n\tElf64_Word\tvna_name;\n\tElf64_Word\tvna_next;\n} Elf64_Vernaux;\n\ntypedef Elf64_Half Elf64_Versym;\n\ntypedef struct {\n\tElf64_Half\tsi_boundto;\t/* direct bindings - symbol bound to */\n\tElf64_Half\tsi_flags;\t/* per symbol flags */\n} Elf64_Syminfo;\n\n#endif /* !_SYS_ELF64_H_ */\n"
  },
  {
    "path": "freebsd-headers/sys/elf_common.h",
    "content": "/*-\n * Copyright (c) 2000, 2001, 2008, 2011, David E. O'Brien\n * Copyright (c) 1998 John D. Polstra.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/sys/elf_common.h 221569 2011-05-07 01:05:31Z obrien $\n */\n\n#ifndef _SYS_ELF_COMMON_H_\n#define\t_SYS_ELF_COMMON_H_ 1\n\n/*\n * ELF definitions that are independent of architecture or word size.\n */\n\n/*\n * Note header.  The \".note\" section contains an array of notes.  Each\n * begins with this header, aligned to a word boundary.  Immediately\n * following the note header is n_namesz bytes of name, padded to the\n * next word boundary.  Then comes n_descsz bytes of descriptor, again\n * padded to a word boundary.  The values of n_namesz and n_descsz do\n * not include the padding.\n */\n\ntypedef struct {\n\tu_int32_t\tn_namesz;\t/* Length of name. */\n\tu_int32_t\tn_descsz;\t/* Length of descriptor. */\n\tu_int32_t\tn_type;\t\t/* Type of this note. */\n} Elf_Note;\n\n/*\n * The header for GNU-style hash sections.\n */\n\ntypedef struct {\n\tu_int32_t\tgh_nbuckets;\t/* Number of hash buckets. */\n\tu_int32_t\tgh_symndx;\t/* First visible symbol in .dynsym. */\n\tu_int32_t\tgh_maskwords;\t/* #maskwords used in bloom filter. */\n\tu_int32_t\tgh_shift2;\t/* Bloom filter shift count. */\n} Elf_GNU_Hash_Header;\n\n/* Indexes into the e_ident array.  Keep synced with\n   http://www.sco.com/developers/gabi/latest/ch4.eheader.html */\n#define\tEI_MAG0\t\t0\t/* Magic number, byte 0. */\n#define\tEI_MAG1\t\t1\t/* Magic number, byte 1. */\n#define\tEI_MAG2\t\t2\t/* Magic number, byte 2. */\n#define\tEI_MAG3\t\t3\t/* Magic number, byte 3. */\n#define\tEI_CLASS\t4\t/* Class of machine. */\n#define\tEI_DATA\t\t5\t/* Data format. */\n#define\tEI_VERSION\t6\t/* ELF format version. */\n#define\tEI_OSABI\t7\t/* Operating system / ABI identification */\n#define\tEI_ABIVERSION\t8\t/* ABI version */\n#define\tOLD_EI_BRAND\t8\t/* Start of architecture identification. */\n#define\tEI_PAD\t\t9\t/* Start of padding (per SVR4 ABI). */\n#define\tEI_NIDENT\t16\t/* Size of e_ident array. */\n\n/* Values for the magic number bytes. */\n#define\tELFMAG0\t\t0x7f\n#define\tELFMAG1\t\t'E'\n#define\tELFMAG2\t\t'L'\n#define\tELFMAG3\t\t'F'\n#define\tELFMAG\t\t\"\\177ELF\"\t/* magic string */\n#define\tSELFMAG\t\t4\t\t/* magic string size */\n\n/* Values for e_ident[EI_VERSION] and e_version. */\n#define\tEV_NONE\t\t0\n#define\tEV_CURRENT\t1\n\n/* Values for e_ident[EI_CLASS]. */\n#define\tELFCLASSNONE\t0\t/* Unknown class. */\n#define\tELFCLASS32\t1\t/* 32-bit architecture. */\n#define\tELFCLASS64\t2\t/* 64-bit architecture. */\n\n/* Values for e_ident[EI_DATA]. */\n#define\tELFDATANONE\t0\t/* Unknown data format. */\n#define\tELFDATA2LSB\t1\t/* 2's complement little-endian. */\n#define\tELFDATA2MSB\t2\t/* 2's complement big-endian. */\n\n/* Values for e_ident[EI_OSABI]. */\n#define\tELFOSABI_NONE\t\t0\t/* UNIX System V ABI */\n#define\tELFOSABI_HPUX\t\t1\t/* HP-UX operating system */\n#define\tELFOSABI_NETBSD\t\t2\t/* NetBSD */\n#define\tELFOSABI_LINUX\t\t3\t/* GNU/Linux */\n#define\tELFOSABI_HURD\t\t4\t/* GNU/Hurd */\n#define\tELFOSABI_86OPEN\t\t5\t/* 86Open common IA32 ABI */\n#define\tELFOSABI_SOLARIS\t6\t/* Solaris */\n#define\tELFOSABI_AIX\t\t7\t/* AIX */\n#define\tELFOSABI_IRIX\t\t8\t/* IRIX */\n#define\tELFOSABI_FREEBSD\t9\t/* FreeBSD */\n#define\tELFOSABI_TRU64\t\t10\t/* TRU64 UNIX */\n#define\tELFOSABI_MODESTO\t11\t/* Novell Modesto */\n#define\tELFOSABI_OPENBSD\t12\t/* OpenBSD */\n#define\tELFOSABI_OPENVMS\t13\t/* Open VMS */\n#define\tELFOSABI_NSK\t\t14\t/* HP Non-Stop Kernel */\n#define\tELFOSABI_AROS\t\t15\t/* Amiga Research OS */\n#define\tELFOSABI_ARM\t\t97\t/* ARM */\n#define\tELFOSABI_STANDALONE\t255\t/* Standalone (embedded) application */\n\n#define\tELFOSABI_SYSV\t\tELFOSABI_NONE\t/* symbol used in old spec */\n#define\tELFOSABI_MONTEREY\tELFOSABI_AIX\t/* Monterey */\n\n/* e_ident */\n#define\tIS_ELF(ehdr)\t((ehdr).e_ident[EI_MAG0] == ELFMAG0 && \\\n\t\t\t (ehdr).e_ident[EI_MAG1] == ELFMAG1 && \\\n\t\t\t (ehdr).e_ident[EI_MAG2] == ELFMAG2 && \\\n\t\t\t (ehdr).e_ident[EI_MAG3] == ELFMAG3)\n\n/* Values for e_type. */\n#define\tET_NONE\t\t0\t/* Unknown type. */\n#define\tET_REL\t\t1\t/* Relocatable. */\n#define\tET_EXEC\t\t2\t/* Executable. */\n#define\tET_DYN\t\t3\t/* Shared object. */\n#define\tET_CORE\t\t4\t/* Core file. */\n#define\tET_LOOS\t\t0xfe00\t/* First operating system specific. */\n#define\tET_HIOS\t\t0xfeff\t/* Last operating system-specific. */\n#define\tET_LOPROC\t0xff00\t/* First processor-specific. */\n#define\tET_HIPROC\t0xffff\t/* Last processor-specific. */\n\n/* Values for e_machine. */\n#define\tEM_NONE\t\t0\t/* Unknown machine. */\n#define\tEM_M32\t\t1\t/* AT&T WE32100. */\n#define\tEM_SPARC\t2\t/* Sun SPARC. */\n#define\tEM_386\t\t3\t/* Intel i386. */\n#define\tEM_68K\t\t4\t/* Motorola 68000. */\n#define\tEM_88K\t\t5\t/* Motorola 88000. */\n#define\tEM_860\t\t7\t/* Intel i860. */\n#define\tEM_MIPS\t\t8\t/* MIPS R3000 Big-Endian only. */\n#define\tEM_S370\t\t9\t/* IBM System/370. */\n#define\tEM_MIPS_RS3_LE\t10\t/* MIPS R3000 Little-Endian. */\n#define\tEM_PARISC\t15\t/* HP PA-RISC. */\n#define\tEM_VPP500\t17\t/* Fujitsu VPP500. */\n#define\tEM_SPARC32PLUS\t18\t/* SPARC v8plus. */\n#define\tEM_960\t\t19\t/* Intel 80960. */\n#define\tEM_PPC\t\t20\t/* PowerPC 32-bit. */\n#define\tEM_PPC64\t21\t/* PowerPC 64-bit. */\n#define\tEM_S390\t\t22\t/* IBM System/390. */\n#define\tEM_V800\t\t36\t/* NEC V800. */\n#define\tEM_FR20\t\t37\t/* Fujitsu FR20. */\n#define\tEM_RH32\t\t38\t/* TRW RH-32. */\n#define\tEM_RCE\t\t39\t/* Motorola RCE. */\n#define\tEM_ARM\t\t40\t/* ARM. */\n#define\tEM_SH\t\t42\t/* Hitachi SH. */\n#define\tEM_SPARCV9\t43\t/* SPARC v9 64-bit. */\n#define\tEM_TRICORE\t44\t/* Siemens TriCore embedded processor. */\n#define\tEM_ARC\t\t45\t/* Argonaut RISC Core. */\n#define\tEM_H8_300\t46\t/* Hitachi H8/300. */\n#define\tEM_H8_300H\t47\t/* Hitachi H8/300H. */\n#define\tEM_H8S\t\t48\t/* Hitachi H8S. */\n#define\tEM_H8_500\t49\t/* Hitachi H8/500. */\n#define\tEM_IA_64\t50\t/* Intel IA-64 Processor. */\n#define\tEM_MIPS_X\t51\t/* Stanford MIPS-X. */\n#define\tEM_COLDFIRE\t52\t/* Motorola ColdFire. */\n#define\tEM_68HC12\t53\t/* Motorola M68HC12. */\n#define\tEM_MMA\t\t54\t/* Fujitsu MMA. */\n#define\tEM_PCP\t\t55\t/* Siemens PCP. */\n#define\tEM_NCPU\t\t56\t/* Sony nCPU. */\n#define\tEM_NDR1\t\t57\t/* Denso NDR1 microprocessor. */\n#define\tEM_STARCORE\t58\t/* Motorola Star*Core processor. */\n#define\tEM_ME16\t\t59\t/* Toyota ME16 processor. */\n#define\tEM_ST100\t60\t/* STMicroelectronics ST100 processor. */\n#define\tEM_TINYJ\t61\t/* Advanced Logic Corp. TinyJ processor. */\n#define\tEM_X86_64\t62\t/* Advanced Micro Devices x86-64 */\n#define\tEM_AMD64\tEM_X86_64\t/* Advanced Micro Devices x86-64 (compat) */\n#define\tEM_PDSP\t\t63\t/* Sony DSP Processor. */\n#define\tEM_FX66\t\t66\t/* Siemens FX66 microcontroller. */\n#define\tEM_ST9PLUS\t67\t/* STMicroelectronics ST9+ 8/16\n\t\t\t\t   microcontroller. */\n#define\tEM_ST7\t\t68\t/* STmicroelectronics ST7 8-bit\n\t\t\t\t   microcontroller. */\n#define\tEM_68HC16\t69\t/* Motorola MC68HC16 microcontroller. */\n#define\tEM_68HC11\t70\t/* Motorola MC68HC11 microcontroller. */\n#define\tEM_68HC08\t71\t/* Motorola MC68HC08 microcontroller. */\n#define\tEM_68HC05\t72\t/* Motorola MC68HC05 microcontroller. */\n#define\tEM_SVX\t\t73\t/* Silicon Graphics SVx. */\n#define\tEM_ST19\t\t74\t/* STMicroelectronics ST19 8-bit mc. */\n#define\tEM_VAX\t\t75\t/* Digital VAX. */\n#define\tEM_CRIS\t\t76\t/* Axis Communications 32-bit embedded\n\t\t\t\t   processor. */\n#define\tEM_JAVELIN\t77\t/* Infineon Technologies 32-bit embedded\n\t\t\t\t   processor. */\n#define\tEM_FIREPATH\t78\t/* Element 14 64-bit DSP Processor. */\n#define\tEM_ZSP\t\t79\t/* LSI Logic 16-bit DSP Processor. */\n#define\tEM_MMIX\t\t80\t/* Donald Knuth's educational 64-bit proc. */\n#define\tEM_HUANY\t81\t/* Harvard University machine-independent\n\t\t\t\t   object files. */\n#define\tEM_PRISM\t82\t/* SiTera Prism. */\n#define\tEM_AVR\t\t83\t/* Atmel AVR 8-bit microcontroller. */\n#define\tEM_FR30\t\t84\t/* Fujitsu FR30. */\n#define\tEM_D10V\t\t85\t/* Mitsubishi D10V. */\n#define\tEM_D30V\t\t86\t/* Mitsubishi D30V. */\n#define\tEM_V850\t\t87\t/* NEC v850. */\n#define\tEM_M32R\t\t88\t/* Mitsubishi M32R. */\n#define\tEM_MN10300\t89\t/* Matsushita MN10300. */\n#define\tEM_MN10200\t90\t/* Matsushita MN10200. */\n#define\tEM_PJ\t\t91\t/* picoJava. */\n#define\tEM_OPENRISC\t92\t/* OpenRISC 32-bit embedded processor. */\n#define\tEM_ARC_A5\t93\t/* ARC Cores Tangent-A5. */\n#define\tEM_XTENSA\t94\t/* Tensilica Xtensa Architecture. */\n#define\tEM_VIDEOCORE\t95\t/* Alphamosaic VideoCore processor. */\n#define\tEM_TMM_GPP\t96\t/* Thompson Multimedia General Purpose\n\t\t\t\t   Processor. */\n#define\tEM_NS32K\t97\t/* National Semiconductor 32000 series. */\n#define\tEM_TPC\t\t98\t/* Tenor Network TPC processor. */\n#define\tEM_SNP1K\t99\t/* Trebia SNP 1000 processor. */\n#define\tEM_ST200\t100\t/* STMicroelectronics ST200 microcontroller. */\n#define\tEM_IP2K\t\t101\t/* Ubicom IP2xxx microcontroller family. */\n#define\tEM_MAX\t\t102\t/* MAX Processor. */\n#define\tEM_CR\t\t103\t/* National Semiconductor CompactRISC\n\t\t\t\t   microprocessor. */\n#define\tEM_F2MC16\t104\t/* Fujitsu F2MC16. */\n#define\tEM_MSP430\t105\t/* Texas Instruments embedded microcontroller\n\t\t\t\t   msp430. */\n#define\tEM_BLACKFIN\t106\t/* Analog Devices Blackfin (DSP) processor. */\n#define\tEM_SE_C33\t107\t/* S1C33 Family of Seiko Epson processors. */\n#define\tEM_SEP\t\t108\t/* Sharp embedded microprocessor. */\n#define\tEM_ARCA\t\t109\t/* Arca RISC Microprocessor. */\n#define\tEM_UNICORE\t110\t/* Microprocessor series from PKU-Unity Ltd.\n\t\t\t\t   and MPRC of Peking University */\n\n/* Non-standard or deprecated. */\n#define\tEM_486\t\t6\t/* Intel i486. */\n#define\tEM_MIPS_RS4_BE\t10\t/* MIPS R4000 Big-Endian */\n#define\tEM_ALPHA_STD\t41\t/* Digital Alpha (standard value). */\n#define\tEM_ALPHA\t0x9026\t/* Alpha (written in the absence of an ABI) */\n\n/* Special section indexes. */\n#define\tSHN_UNDEF\t     0\t\t/* Undefined, missing, irrelevant. */\n#define\tSHN_LORESERVE\t0xff00\t\t/* First of reserved range. */\n#define\tSHN_LOPROC\t0xff00\t\t/* First processor-specific. */\n#define\tSHN_HIPROC\t0xff1f\t\t/* Last processor-specific. */\n#define\tSHN_LOOS\t0xff20\t\t/* First operating system-specific. */\n#define\tSHN_HIOS\t0xff3f\t\t/* Last operating system-specific. */\n#define\tSHN_ABS\t\t0xfff1\t\t/* Absolute values. */\n#define\tSHN_COMMON\t0xfff2\t\t/* Common data. */\n#define\tSHN_XINDEX\t0xffff\t\t/* Escape -- index stored elsewhere. */\n#define\tSHN_HIRESERVE\t0xffff\t\t/* Last of reserved range. */\n\n/* sh_type */\n#define\tSHT_NULL\t\t0\t/* inactive */\n#define\tSHT_PROGBITS\t\t1\t/* program defined information */\n#define\tSHT_SYMTAB\t\t2\t/* symbol table section */\n#define\tSHT_STRTAB\t\t3\t/* string table section */\n#define\tSHT_RELA\t\t4\t/* relocation section with addends */\n#define\tSHT_HASH\t\t5\t/* symbol hash table section */\n#define\tSHT_DYNAMIC\t\t6\t/* dynamic section */\n#define\tSHT_NOTE\t\t7\t/* note section */\n#define\tSHT_NOBITS\t\t8\t/* no space section */\n#define\tSHT_REL\t\t\t9\t/* relocation section - no addends */\n#define\tSHT_SHLIB\t\t10\t/* reserved - purpose unknown */\n#define\tSHT_DYNSYM\t\t11\t/* dynamic symbol table section */\n#define\tSHT_INIT_ARRAY\t\t14\t/* Initialization function pointers. */\n#define\tSHT_FINI_ARRAY\t\t15\t/* Termination function pointers. */\n#define\tSHT_PREINIT_ARRAY\t16\t/* Pre-initialization function ptrs. */\n#define\tSHT_GROUP\t\t17\t/* Section group. */\n#define\tSHT_SYMTAB_SHNDX\t18\t/* Section indexes (see SHN_XINDEX). */\n#define\tSHT_LOOS\t\t0x60000000\t/* First of OS specific semantics */\n#define\tSHT_LOSUNW\t\t0x6ffffff4\n#define\tSHT_SUNW_dof\t\t0x6ffffff4\n#define\tSHT_SUNW_cap\t\t0x6ffffff5\n#define\tSHT_SUNW_SIGNATURE\t0x6ffffff6\n#define\tSHT_GNU_HASH\t\t0x6ffffff6\n#define\tSHT_SUNW_ANNOTATE\t0x6ffffff7\n#define\tSHT_SUNW_DEBUGSTR\t0x6ffffff8\n#define\tSHT_SUNW_DEBUG\t\t0x6ffffff9\n#define\tSHT_SUNW_move\t\t0x6ffffffa\n#define\tSHT_SUNW_COMDAT\t\t0x6ffffffb\n#define\tSHT_SUNW_syminfo\t0x6ffffffc\n#define\tSHT_SUNW_verdef\t\t0x6ffffffd\n#define\tSHT_GNU_verdef\t\t0x6ffffffd\t/* Symbol versions provided */\n#define\tSHT_SUNW_verneed\t0x6ffffffe\n#define\tSHT_GNU_verneed\t\t0x6ffffffe\t/* Symbol versions required */\n#define\tSHT_SUNW_versym\t\t0x6fffffff\n#define\tSHT_GNU_versym\t\t0x6fffffff\t/* Symbol version table */\n#define\tSHT_HISUNW\t\t0x6fffffff\n#define\tSHT_HIOS\t\t0x6fffffff\t/* Last of OS specific semantics */\n#define\tSHT_LOPROC\t\t0x70000000\t/* reserved range for processor */\n#define\tSHT_AMD64_UNWIND\t0x70000001\t/* unwind information */\n#define\tSHT_MIPS_DWARF\t\t0x7000001e\t/* MIPS gcc uses MIPS_DWARF */\n#define\tSHT_HIPROC\t\t0x7fffffff\t/* specific section header types */\n#define\tSHT_LOUSER\t\t0x80000000\t/* reserved range for application */\n#define\tSHT_HIUSER\t\t0xffffffff\t/* specific indexes */\n\n/* Flags for sh_flags. */\n#define\tSHF_WRITE\t\t0x1\t/* Section contains writable data. */\n#define\tSHF_ALLOC\t\t0x2\t/* Section occupies memory. */\n#define\tSHF_EXECINSTR\t\t0x4\t/* Section contains instructions. */\n#define\tSHF_MERGE\t\t0x10\t/* Section may be merged. */\n#define\tSHF_STRINGS\t\t0x20\t/* Section contains strings. */\n#define\tSHF_INFO_LINK\t\t0x40\t/* sh_info holds section index. */\n#define\tSHF_LINK_ORDER\t\t0x80\t/* Special ordering requirements. */\n#define\tSHF_OS_NONCONFORMING\t0x100\t/* OS-specific processing required. */\n#define\tSHF_GROUP\t\t0x200\t/* Member of section group. */\n#define\tSHF_TLS\t\t\t0x400\t/* Section contains TLS data. */\n#define\tSHF_MASKOS\t0x0ff00000\t/* OS-specific semantics. */\n#define\tSHF_MASKPROC\t0xf0000000\t/* Processor-specific semantics. */\n\n/* Values for p_type. */\n#define\tPT_NULL\t\t0\t/* Unused entry. */\n#define\tPT_LOAD\t\t1\t/* Loadable segment. */\n#define\tPT_DYNAMIC\t2\t/* Dynamic linking information segment. */\n#define\tPT_INTERP\t3\t/* Pathname of interpreter. */\n#define\tPT_NOTE\t\t4\t/* Auxiliary information. */\n#define\tPT_SHLIB\t5\t/* Reserved (not used). */\n#define\tPT_PHDR\t\t6\t/* Location of program header itself. */\n#define\tPT_TLS\t\t7\t/* Thread local storage segment */\n#define\tPT_LOOS\t\t0x60000000\t/* First OS-specific. */\n#define\tPT_SUNW_UNWIND\t0x6464e550\t/* amd64 UNWIND program header */\n#define\tPT_GNU_EH_FRAME\t0x6474e550\n#define\tPT_GNU_STACK\t0x6474e551\n#define\tPT_LOSUNW\t0x6ffffffa\n#define\tPT_SUNWBSS\t0x6ffffffa\t/* Sun Specific segment */\n#define\tPT_SUNWSTACK\t0x6ffffffb\t/* describes the stack segment */\n#define\tPT_SUNWDTRACE\t0x6ffffffc\t/* private */\n#define\tPT_SUNWCAP\t0x6ffffffd\t/* hard/soft capabilities segment */\n#define\tPT_HISUNW\t0x6fffffff\n#define\tPT_HIOS\t\t0x6fffffff\t/* Last OS-specific. */\n#define\tPT_LOPROC\t0x70000000\t/* First processor-specific type. */\n#define\tPT_HIPROC\t0x7fffffff\t/* Last processor-specific type. */\n\n/* Values for p_flags. */\n#define\tPF_X\t\t0x1\t\t/* Executable. */\n#define\tPF_W\t\t0x2\t\t/* Writable. */\n#define\tPF_R\t\t0x4\t\t/* Readable. */\n#define\tPF_MASKOS\t0x0ff00000\t/* Operating system-specific. */\n#define\tPF_MASKPROC\t0xf0000000\t/* Processor-specific. */\n\n/* Extended program header index. */\n#define\tPN_XNUM\t\t0xffff\n\n/* Values for d_tag. */\n#define\tDT_NULL\t\t0\t/* Terminating entry. */\n#define\tDT_NEEDED\t1\t/* String table offset of a needed shared\n\t\t\t\t   library. */\n#define\tDT_PLTRELSZ\t2\t/* Total size in bytes of PLT relocations. */\n#define\tDT_PLTGOT\t3\t/* Processor-dependent address. */\n#define\tDT_HASH\t\t4\t/* Address of symbol hash table. */\n#define\tDT_STRTAB\t5\t/* Address of string table. */\n#define\tDT_SYMTAB\t6\t/* Address of symbol table. */\n#define\tDT_RELA\t\t7\t/* Address of ElfNN_Rela relocations. */\n#define\tDT_RELASZ\t8\t/* Total size of ElfNN_Rela relocations. */\n#define\tDT_RELAENT\t9\t/* Size of each ElfNN_Rela relocation entry. */\n#define\tDT_STRSZ\t10\t/* Size of string table. */\n#define\tDT_SYMENT\t11\t/* Size of each symbol table entry. */\n#define\tDT_INIT\t\t12\t/* Address of initialization function. */\n#define\tDT_FINI\t\t13\t/* Address of finalization function. */\n#define\tDT_SONAME\t14\t/* String table offset of shared object\n\t\t\t\t   name. */\n#define\tDT_RPATH\t15\t/* String table offset of library path. [sup] */\n#define\tDT_SYMBOLIC\t16\t/* Indicates \"symbolic\" linking. [sup] */\n#define\tDT_REL\t\t17\t/* Address of ElfNN_Rel relocations. */\n#define\tDT_RELSZ\t18\t/* Total size of ElfNN_Rel relocations. */\n#define\tDT_RELENT\t19\t/* Size of each ElfNN_Rel relocation. */\n#define\tDT_PLTREL\t20\t/* Type of relocation used for PLT. */\n#define\tDT_DEBUG\t21\t/* Reserved (not used). */\n#define\tDT_TEXTREL\t22\t/* Indicates there may be relocations in\n\t\t\t\t   non-writable segments. [sup] */\n#define\tDT_JMPREL\t23\t/* Address of PLT relocations. */\n#define\tDT_BIND_NOW\t24\t/* [sup] */\n#define\tDT_INIT_ARRAY\t25\t/* Address of the array of pointers to\n\t\t\t\t   initialization functions */\n#define\tDT_FINI_ARRAY\t26\t/* Address of the array of pointers to\n\t\t\t\t   termination functions */\n#define\tDT_INIT_ARRAYSZ\t27\t/* Size in bytes of the array of\n\t\t\t\t   initialization functions. */\n#define\tDT_FINI_ARRAYSZ\t28\t/* Size in bytes of the array of\n\t\t\t\t   terminationfunctions. */\n#define\tDT_RUNPATH\t29\t/* String table offset of a null-terminated\n\t\t\t\t   library search path string. */\n#define\tDT_FLAGS\t30\t/* Object specific flag values. */\n#define\tDT_ENCODING\t32\t/* Values greater than or equal to DT_ENCODING\n\t\t\t\t   and less than DT_LOOS follow the rules for\n\t\t\t\t   the interpretation of the d_un union\n\t\t\t\t   as follows: even == 'd_ptr', odd == 'd_val'\n\t\t\t\t   or none */\n#define\tDT_PREINIT_ARRAY 32\t/* Address of the array of pointers to\n\t\t\t\t   pre-initialization functions. */\n#define\tDT_PREINIT_ARRAYSZ 33\t/* Size in bytes of the array of\n\t\t\t\t   pre-initialization functions. */\n#define\tDT_MAXPOSTAGS\t34\t/* number of positive tags */\n#define\tDT_LOOS\t\t0x6000000d\t/* First OS-specific */\n#define\tDT_SUNW_AUXILIARY\t0x6000000d\t/* symbol auxiliary name */\n#define\tDT_SUNW_RTLDINF\t\t0x6000000e\t/* ld.so.1 info (private) */\n#define\tDT_SUNW_FILTER\t\t0x6000000f\t/* symbol filter name */\n#define\tDT_SUNW_CAP\t\t0x60000010\t/* hardware/software */\n#define\tDT_HIOS\t\t0x6ffff000\t/* Last OS-specific */\n\n/*\n * DT_* entries which fall between DT_VALRNGHI & DT_VALRNGLO use the\n * Dyn.d_un.d_val field of the Elf*_Dyn structure.\n */\n#define\tDT_VALRNGLO\t0x6ffffd00\n#define\tDT_CHECKSUM\t0x6ffffdf8\t/* elf checksum */\n#define\tDT_PLTPADSZ\t0x6ffffdf9\t/* pltpadding size */\n#define\tDT_MOVEENT\t0x6ffffdfa\t/* move table entry size */\n#define\tDT_MOVESZ\t0x6ffffdfb\t/* move table size */\n#define\tDT_FEATURE_1\t0x6ffffdfc\t/* feature holder */\n#define\tDT_POSFLAG_1\t0x6ffffdfd\t/* flags for DT_* entries, effecting */\n\t\t\t\t\t/*\tthe following DT_* entry. */\n\t\t\t\t\t/*\tSee DF_P1_* definitions */\n#define\tDT_SYMINSZ\t0x6ffffdfe\t/* syminfo table size (in bytes) */\n#define\tDT_SYMINENT\t0x6ffffdff\t/* syminfo entry size (in bytes) */\n#define\tDT_VALRNGHI\t0x6ffffdff\n\n/*\n * DT_* entries which fall between DT_ADDRRNGHI & DT_ADDRRNGLO use the\n * Dyn.d_un.d_ptr field of the Elf*_Dyn structure.\n *\n * If any adjustment is made to the ELF object after it has been\n * built, these entries will need to be adjusted.\n */\n#define\tDT_ADDRRNGLO\t0x6ffffe00\n#define\tDT_GNU_HASH\t0x6ffffef5\t/* GNU-style hash table */\n#define\tDT_CONFIG\t0x6ffffefa\t/* configuration information */\n#define\tDT_DEPAUDIT\t0x6ffffefb\t/* dependency auditing */\n#define\tDT_AUDIT\t0x6ffffefc\t/* object auditing */\n#define\tDT_PLTPAD\t0x6ffffefd\t/* pltpadding (sparcv9) */\n#define\tDT_MOVETAB\t0x6ffffefe\t/* move table */\n#define\tDT_SYMINFO\t0x6ffffeff\t/* syminfo table */\n#define\tDT_ADDRRNGHI\t0x6ffffeff\n\n#define\tDT_VERSYM\t0x6ffffff0\t/* Address of versym section. */\n#define\tDT_RELACOUNT\t0x6ffffff9\t/* number of RELATIVE relocations */\n#define\tDT_RELCOUNT\t0x6ffffffa\t/* number of RELATIVE relocations */\n#define\tDT_FLAGS_1\t0x6ffffffb\t/* state flags - see DF_1_* defs */\n#define\tDT_VERDEF\t0x6ffffffc\t/* Address of verdef section. */\n#define\tDT_VERDEFNUM\t0x6ffffffd\t/* Number of elems in verdef section */\n#define\tDT_VERNEED\t0x6ffffffe\t/* Address of verneed section. */\n#define\tDT_VERNEEDNUM\t0x6fffffff\t/* Number of elems in verneed section */\n\n#define\tDT_LOPROC\t0x70000000\t/* First processor-specific type. */\n#define\tDT_DEPRECATED_SPARC_REGISTER\t0x7000001\n#define\tDT_AUXILIARY\t0x7ffffffd\t/* shared library auxiliary name */\n#define\tDT_USED\t\t0x7ffffffe\t/* ignored - same as needed */\n#define\tDT_FILTER\t0x7fffffff\t/* shared library filter name */\n#define\tDT_HIPROC\t0x7fffffff\t/* Last processor-specific type. */\n\n/* Values for DT_FLAGS */\n#define\tDF_ORIGIN\t0x0001\t/* Indicates that the object being loaded may\n\t\t\t\t   make reference to the $ORIGIN substitution\n\t\t\t\t   string */\n#define\tDF_SYMBOLIC\t0x0002\t/* Indicates \"symbolic\" linking. */\n#define\tDF_TEXTREL\t0x0004\t/* Indicates there may be relocations in\n\t\t\t\t   non-writable segments. */\n#define\tDF_BIND_NOW\t0x0008\t/* Indicates that the dynamic linker should\n\t\t\t\t   process all relocations for the object\n\t\t\t\t   containing this entry before transferring\n\t\t\t\t   control to the program. */\n#define\tDF_STATIC_TLS\t0x0010\t/* Indicates that the shared object or\n\t\t\t\t   executable contains code using a static\n\t\t\t\t   thread-local storage scheme. */\n\n/* Values for DT_FLAGS_1 */\n#define\tDF_1_BIND_NOW\t0x00000001\t/* Same as DF_BIND_NOW */\n#define\tDF_1_GLOBAL\t0x00000002\t/* Set the RTLD_GLOBAL for object */\n#define\tDF_1_NODELETE\t0x00000008\t/* Set the RTLD_NODELETE for object */\n#define\tDF_1_LOADFLTR\t0x00000010\t/* Immediate loading of filtees */\n#define\tDF_1_NOOPEN     0x00000040\t/* Do not allow loading on dlopen() */\n#define\tDF_1_ORIGIN\t0x00000080\t/* Process $ORIGIN */\n\n/* Values for n_type.  Used in core files. */\n#define\tNT_PRSTATUS\t1\t/* Process status. */\n#define\tNT_FPREGSET\t2\t/* Floating point registers. */\n#define\tNT_PRPSINFO\t3\t/* Process state info. */\n#define\tNT_THRMISC\t7\t/* Thread miscellaneous info. */\n\n/* Symbol Binding - ELFNN_ST_BIND - st_info */\n#define\tSTB_LOCAL\t0\t/* Local symbol */\n#define\tSTB_GLOBAL\t1\t/* Global symbol */\n#define\tSTB_WEAK\t2\t/* like global - lower precedence */\n#define\tSTB_LOOS\t10\t/* Reserved range for operating system */\n#define\tSTB_HIOS\t12\t/*   specific semantics. */\n#define\tSTB_LOPROC\t13\t/* reserved range for processor */\n#define\tSTB_HIPROC\t15\t/*   specific semantics. */\n\n/* Symbol type - ELFNN_ST_TYPE - st_info */\n#define\tSTT_NOTYPE\t0\t/* Unspecified type. */\n#define\tSTT_OBJECT\t1\t/* Data object. */\n#define\tSTT_FUNC\t2\t/* Function. */\n#define\tSTT_SECTION\t3\t/* Section. */\n#define\tSTT_FILE\t4\t/* Source file. */\n#define\tSTT_COMMON\t5\t/* Uninitialized common block. */\n#define\tSTT_TLS\t\t6\t/* TLS object. */\n#define\tSTT_NUM\t\t7\n#define\tSTT_LOOS\t10\t/* Reserved range for operating system */\n#define\tSTT_HIOS\t12\t/*   specific semantics. */\n#define\tSTT_LOPROC\t13\t/* reserved range for processor */\n#define\tSTT_HIPROC\t15\t/*   specific semantics. */\n\n/* Symbol visibility - ELFNN_ST_VISIBILITY - st_other */\n#define\tSTV_DEFAULT\t0x0\t/* Default visibility (see binding). */\n#define\tSTV_INTERNAL\t0x1\t/* Special meaning in relocatable objects. */\n#define\tSTV_HIDDEN\t0x2\t/* Not visible. */\n#define\tSTV_PROTECTED\t0x3\t/* Visible but not preemptible. */\n#define\tSTV_EXPORTED\t0x4\n#define\tSTV_SINGLETON\t0x5\n#define\tSTV_ELIMINATE\t0x6\n\n/* Special symbol table indexes. */\n#define\tSTN_UNDEF\t0\t/* Undefined symbol index. */\n\n/* Symbol versioning flags. */\n#define\tVER_DEF_CURRENT\t1\n#define\tVER_DEF_IDX(x)\tVER_NDX(x)\n\n#define\tVER_FLG_BASE\t0x01\n#define\tVER_FLG_WEAK\t0x02\n\n#define\tVER_NEED_CURRENT\t1\n#define\tVER_NEED_WEAK\t(1u << 15)\n#define\tVER_NEED_HIDDEN\tVER_NDX_HIDDEN\n#define\tVER_NEED_IDX(x)\tVER_NDX(x)\n\n#define\tVER_NDX_LOCAL\t0\n#define\tVER_NDX_GLOBAL\t1\n#define\tVER_NDX_GIVEN\t2\n\n#define\tVER_NDX_HIDDEN\t(1u << 15)\n#define\tVER_NDX(x)\t((x) & ~(1u << 15))\n\n#define\tCA_SUNW_NULL\t0\n#define\tCA_SUNW_HW_1\t1\t\t/* first hardware capabilities entry */\n#define\tCA_SUNW_SF_1\t2\t\t/* first software capabilities entry */\n\n/*\n * Syminfo flag values\n */\n#define\tSYMINFO_FLG_DIRECT\t0x0001\t/* symbol ref has direct association */\n\t\t\t\t\t/*\tto object containing defn. */\n#define\tSYMINFO_FLG_PASSTHRU\t0x0002\t/* ignored - see SYMINFO_FLG_FILTER */\n#define\tSYMINFO_FLG_COPY\t0x0004\t/* symbol is a copy-reloc */\n#define\tSYMINFO_FLG_LAZYLOAD\t0x0008\t/* object containing defn should be */\n\t\t\t\t\t/*\tlazily-loaded */\n#define\tSYMINFO_FLG_DIRECTBIND\t0x0010\t/* ref should be bound directly to */\n\t\t\t\t\t/*\tobject containing defn. */\n#define\tSYMINFO_FLG_NOEXTDIRECT\t0x0020\t/* don't let an external reference */\n\t\t\t\t\t/*\tdirectly bind to this symbol */\n#define\tSYMINFO_FLG_FILTER\t0x0002\t/* symbol ref is associated to a */\n#define\tSYMINFO_FLG_AUXILIARY\t0x0040\t/* \tstandard or auxiliary filter */\n\n/*\n * Syminfo.si_boundto values.\n */\n#define\tSYMINFO_BT_SELF\t\t0xffff\t/* symbol bound to self */\n#define\tSYMINFO_BT_PARENT\t0xfffe\t/* symbol bound to parent */\n#define\tSYMINFO_BT_NONE\t\t0xfffd\t/* no special symbol binding */\n#define\tSYMINFO_BT_EXTERN\t0xfffc\t/* symbol defined as external */\n#define\tSYMINFO_BT_LOWRESERVE\t0xff00\t/* beginning of reserved entries */\n\n/*\n * Syminfo version values.\n */\n#define\tSYMINFO_NONE\t\t0\t/* Syminfo version */\n#define\tSYMINFO_CURRENT\t\t1\n#define\tSYMINFO_NUM\t\t2\n\n/*\n * Relocation types.\n *\n * All machine architectures are defined here to allow tools on one to\n * handle others.\n */\n\n#define\tR_386_NONE\t\t0\t/* No relocation. */\n#define\tR_386_32\t\t1\t/* Add symbol value. */\n#define\tR_386_PC32\t\t2\t/* Add PC-relative symbol value. */\n#define\tR_386_GOT32\t\t3\t/* Add PC-relative GOT offset. */\n#define\tR_386_PLT32\t\t4\t/* Add PC-relative PLT offset. */\n#define\tR_386_COPY\t\t5\t/* Copy data from shared object. */\n#define\tR_386_GLOB_DAT\t\t6\t/* Set GOT entry to data address. */\n#define\tR_386_JMP_SLOT\t\t7\t/* Set GOT entry to code address. */\n#define\tR_386_RELATIVE\t\t8\t/* Add load address of shared object. */\n#define\tR_386_GOTOFF\t\t9\t/* Add GOT-relative symbol address. */\n#define\tR_386_GOTPC\t\t10\t/* Add PC-relative GOT table address. */\n#define\tR_386_TLS_TPOFF\t\t14\t/* Negative offset in static TLS block */\n#define\tR_386_TLS_IE\t\t15\t/* Absolute address of GOT for -ve static TLS */\n#define\tR_386_TLS_GOTIE\t\t16\t/* GOT entry for negative static TLS block */\n#define\tR_386_TLS_LE\t\t17\t/* Negative offset relative to static TLS */\n#define\tR_386_TLS_GD\t\t18\t/* 32 bit offset to GOT (index,off) pair */\n#define\tR_386_TLS_LDM\t\t19\t/* 32 bit offset to GOT (index,zero) pair */\n#define\tR_386_TLS_GD_32\t\t24\t/* 32 bit offset to GOT (index,off) pair */\n#define\tR_386_TLS_GD_PUSH\t25\t/* pushl instruction for Sun ABI GD sequence */\n#define\tR_386_TLS_GD_CALL\t26\t/* call instruction for Sun ABI GD sequence */\n#define\tR_386_TLS_GD_POP\t27\t/* popl instruction for Sun ABI GD sequence */\n#define\tR_386_TLS_LDM_32\t28\t/* 32 bit offset to GOT (index,zero) pair */\n#define\tR_386_TLS_LDM_PUSH\t29\t/* pushl instruction for Sun ABI LD sequence */\n#define\tR_386_TLS_LDM_CALL\t30\t/* call instruction for Sun ABI LD sequence */\n#define\tR_386_TLS_LDM_POP\t31\t/* popl instruction for Sun ABI LD sequence */\n#define\tR_386_TLS_LDO_32\t32\t/* 32 bit offset from start of TLS block */\n#define\tR_386_TLS_IE_32\t\t33\t/* 32 bit offset to GOT static TLS offset entry */\n#define\tR_386_TLS_LE_32\t\t34\t/* 32 bit offset within static TLS block */\n#define\tR_386_TLS_DTPMOD32\t35\t/* GOT entry containing TLS index */\n#define\tR_386_TLS_DTPOFF32\t36\t/* GOT entry containing TLS offset */\n#define\tR_386_TLS_TPOFF32\t37\t/* GOT entry of -ve static TLS offset */\n\n#define\tR_ARM_NONE\t\t0\t/* No relocation. */\n#define\tR_ARM_PC24\t\t1\n#define\tR_ARM_ABS32\t\t2\n#define\tR_ARM_REL32\t\t3\n#define\tR_ARM_PC13\t\t4\n#define\tR_ARM_ABS16\t\t5\n#define\tR_ARM_ABS12\t\t6\n#define\tR_ARM_THM_ABS5\t\t7\n#define\tR_ARM_ABS8\t\t8\n#define\tR_ARM_SBREL32\t\t9\n#define\tR_ARM_THM_PC22\t\t10\n#define\tR_ARM_THM_PC8\t\t11\n#define\tR_ARM_AMP_VCALL9\t12\n#define\tR_ARM_SWI24\t\t13\n#define\tR_ARM_THM_SWI8\t\t14\n#define\tR_ARM_XPC25\t\t15\n#define\tR_ARM_THM_XPC22\t\t16\n#define\tR_ARM_COPY\t\t20\t/* Copy data from shared object. */\n#define\tR_ARM_GLOB_DAT\t\t21\t/* Set GOT entry to data address. */\n#define\tR_ARM_JUMP_SLOT\t\t22\t/* Set GOT entry to code address. */\n#define\tR_ARM_RELATIVE\t\t23\t/* Add load address of shared object. */\n#define\tR_ARM_GOTOFF\t\t24\t/* Add GOT-relative symbol address. */\n#define\tR_ARM_GOTPC\t\t25\t/* Add PC-relative GOT table address. */\n#define\tR_ARM_GOT32\t\t26\t/* Add PC-relative GOT offset. */\n#define\tR_ARM_PLT32\t\t27\t/* Add PC-relative PLT offset. */\n#define\tR_ARM_GNU_VTENTRY\t100\n#define\tR_ARM_GNU_VTINHERIT\t101\n#define\tR_ARM_RSBREL32\t\t250\n#define\tR_ARM_THM_RPC22\t\t251\n#define\tR_ARM_RREL32\t\t252\n#define\tR_ARM_RABS32\t\t253\n#define\tR_ARM_RPC24\t\t254\n#define\tR_ARM_RBASE\t\t255\n\n/*\tName\t\t\tValue\t   Field\tCalculation */\n#define\tR_IA_64_NONE\t\t0\t/* None */\n#define\tR_IA_64_IMM14\t\t0x21\t/* immediate14\tS + A */\n#define\tR_IA_64_IMM22\t\t0x22\t/* immediate22\tS + A */\n#define\tR_IA_64_IMM64\t\t0x23\t/* immediate64\tS + A */\n#define\tR_IA_64_DIR32MSB\t0x24\t/* word32 MSB\tS + A */\n#define\tR_IA_64_DIR32LSB\t0x25\t/* word32 LSB\tS + A */\n#define\tR_IA_64_DIR64MSB\t0x26\t/* word64 MSB\tS + A */\n#define\tR_IA_64_DIR64LSB\t0x27\t/* word64 LSB\tS + A */\n#define\tR_IA_64_GPREL22\t\t0x2a\t/* immediate22\t@gprel(S + A) */\n#define\tR_IA_64_GPREL64I\t0x2b\t/* immediate64\t@gprel(S + A) */\n#define\tR_IA_64_GPREL32MSB\t0x2c\t/* word32 MSB\t@gprel(S + A) */\n#define\tR_IA_64_GPREL32LSB\t0x2d\t/* word32 LSB\t@gprel(S + A) */\n#define\tR_IA_64_GPREL64MSB\t0x2e\t/* word64 MSB\t@gprel(S + A) */\n#define\tR_IA_64_GPREL64LSB\t0x2f\t/* word64 LSB\t@gprel(S + A) */\n#define\tR_IA_64_LTOFF22\t\t0x32\t/* immediate22\t@ltoff(S + A) */\n#define\tR_IA_64_LTOFF64I\t0x33\t/* immediate64\t@ltoff(S + A) */\n#define\tR_IA_64_PLTOFF22\t0x3a\t/* immediate22\t@pltoff(S + A) */\n#define\tR_IA_64_PLTOFF64I\t0x3b\t/* immediate64\t@pltoff(S + A) */\n#define\tR_IA_64_PLTOFF64MSB\t0x3e\t/* word64 MSB\t@pltoff(S + A) */\n#define\tR_IA_64_PLTOFF64LSB\t0x3f\t/* word64 LSB\t@pltoff(S + A) */\n#define\tR_IA_64_FPTR64I\t\t0x43\t/* immediate64\t@fptr(S + A) */\n#define\tR_IA_64_FPTR32MSB\t0x44\t/* word32 MSB\t@fptr(S + A) */\n#define\tR_IA_64_FPTR32LSB\t0x45\t/* word32 LSB\t@fptr(S + A) */\n#define\tR_IA_64_FPTR64MSB\t0x46\t/* word64 MSB\t@fptr(S + A) */\n#define\tR_IA_64_FPTR64LSB\t0x47\t/* word64 LSB\t@fptr(S + A) */\n#define\tR_IA_64_PCREL60B\t0x48\t/* immediate60 form1 S + A - P */\n#define\tR_IA_64_PCREL21B\t0x49\t/* immediate21 form1 S + A - P */\n#define\tR_IA_64_PCREL21M\t0x4a\t/* immediate21 form2 S + A - P */\n#define\tR_IA_64_PCREL21F\t0x4b\t/* immediate21 form3 S + A - P */\n#define\tR_IA_64_PCREL32MSB\t0x4c\t/* word32 MSB\tS + A - P */\n#define\tR_IA_64_PCREL32LSB\t0x4d\t/* word32 LSB\tS + A - P */\n#define\tR_IA_64_PCREL64MSB\t0x4e\t/* word64 MSB\tS + A - P */\n#define\tR_IA_64_PCREL64LSB\t0x4f\t/* word64 LSB\tS + A - P */\n#define\tR_IA_64_LTOFF_FPTR22\t0x52\t/* immediate22\t@ltoff(@fptr(S + A)) */\n#define\tR_IA_64_LTOFF_FPTR64I\t0x53\t/* immediate64\t@ltoff(@fptr(S + A)) */\n#define\tR_IA_64_LTOFF_FPTR32MSB\t0x54\t/* word32 MSB\t@ltoff(@fptr(S + A)) */\n#define\tR_IA_64_LTOFF_FPTR32LSB\t0x55\t/* word32 LSB\t@ltoff(@fptr(S + A)) */\n#define\tR_IA_64_LTOFF_FPTR64MSB\t0x56\t/* word64 MSB\t@ltoff(@fptr(S + A)) */\n#define\tR_IA_64_LTOFF_FPTR64LSB\t0x57\t/* word64 LSB\t@ltoff(@fptr(S + A)) */\n#define\tR_IA_64_SEGREL32MSB\t0x5c\t/* word32 MSB\t@segrel(S + A) */\n#define\tR_IA_64_SEGREL32LSB\t0x5d\t/* word32 LSB\t@segrel(S + A) */\n#define\tR_IA_64_SEGREL64MSB\t0x5e\t/* word64 MSB\t@segrel(S + A) */\n#define\tR_IA_64_SEGREL64LSB\t0x5f\t/* word64 LSB\t@segrel(S + A) */\n#define\tR_IA_64_SECREL32MSB\t0x64\t/* word32 MSB\t@secrel(S + A) */\n#define\tR_IA_64_SECREL32LSB\t0x65\t/* word32 LSB\t@secrel(S + A) */\n#define\tR_IA_64_SECREL64MSB\t0x66\t/* word64 MSB\t@secrel(S + A) */\n#define\tR_IA_64_SECREL64LSB\t0x67\t/* word64 LSB\t@secrel(S + A) */\n#define\tR_IA_64_REL32MSB\t0x6c\t/* word32 MSB\tBD + A */\n#define\tR_IA_64_REL32LSB\t0x6d\t/* word32 LSB\tBD + A */\n#define\tR_IA_64_REL64MSB\t0x6e\t/* word64 MSB\tBD + A */\n#define\tR_IA_64_REL64LSB\t0x6f\t/* word64 LSB\tBD + A */\n#define\tR_IA_64_LTV32MSB\t0x74\t/* word32 MSB\tS + A */\n#define\tR_IA_64_LTV32LSB\t0x75\t/* word32 LSB\tS + A */\n#define\tR_IA_64_LTV64MSB\t0x76\t/* word64 MSB\tS + A */\n#define\tR_IA_64_LTV64LSB\t0x77\t/* word64 LSB\tS + A */\n#define\tR_IA_64_PCREL21BI\t0x79\t/* immediate21 form1 S + A - P */\n#define\tR_IA_64_PCREL22\t\t0x7a\t/* immediate22\tS + A - P */\n#define\tR_IA_64_PCREL64I\t0x7b\t/* immediate64\tS + A - P */\n#define\tR_IA_64_IPLTMSB\t\t0x80\t/* function descriptor MSB special */\n#define\tR_IA_64_IPLTLSB\t\t0x81\t/* function descriptor LSB speciaal */\n#define\tR_IA_64_SUB\t\t0x85\t/* immediate64\tA - S */\n#define\tR_IA_64_LTOFF22X\t0x86\t/* immediate22\tspecial */\n#define\tR_IA_64_LDXMOV\t\t0x87\t/* immediate22\tspecial */\n#define\tR_IA_64_TPREL14\t\t0x91\t/* imm14\t@tprel(S + A) */\n#define\tR_IA_64_TPREL22\t\t0x92\t/* imm22\t@tprel(S + A) */\n#define\tR_IA_64_TPREL64I\t0x93\t/* imm64\t@tprel(S + A) */\n#define\tR_IA_64_TPREL64MSB\t0x96\t/* word64 MSB\t@tprel(S + A) */\n#define\tR_IA_64_TPREL64LSB\t0x97\t/* word64 LSB\t@tprel(S + A) */\n#define\tR_IA_64_LTOFF_TPREL22\t0x9a\t/* imm22\t@ltoff(@tprel(S+A)) */\n#define\tR_IA_64_DTPMOD64MSB\t0xa6\t/* word64 MSB\t@dtpmod(S + A) */\n#define\tR_IA_64_DTPMOD64LSB\t0xa7\t/* word64 LSB\t@dtpmod(S + A) */\n#define\tR_IA_64_LTOFF_DTPMOD22\t0xaa\t/* imm22\t@ltoff(@dtpmod(S+A)) */\n#define\tR_IA_64_DTPREL14\t0xb1\t/* imm14\t@dtprel(S + A) */\n#define\tR_IA_64_DTPREL22\t0xb2\t/* imm22\t@dtprel(S + A) */\n#define\tR_IA_64_DTPREL64I\t0xb3\t/* imm64\t@dtprel(S + A) */\n#define\tR_IA_64_DTPREL32MSB\t0xb4\t/* word32 MSB\t@dtprel(S + A) */\n#define\tR_IA_64_DTPREL32LSB\t0xb5\t/* word32 LSB\t@dtprel(S + A) */\n#define\tR_IA_64_DTPREL64MSB\t0xb6\t/* word64 MSB\t@dtprel(S + A) */\n#define\tR_IA_64_DTPREL64LSB\t0xb7\t/* word64 LSB\t@dtprel(S + A) */\n#define\tR_IA_64_LTOFF_DTPREL22\t0xba\t/* imm22\t@ltoff(@dtprel(S+A)) */\n\n#define\tR_MIPS_NONE\t0\t/* No reloc */\n#define\tR_MIPS_16\t1\t/* Direct 16 bit */\n#define\tR_MIPS_32\t2\t/* Direct 32 bit */\n#define\tR_MIPS_REL32\t3\t/* PC relative 32 bit */\n#define\tR_MIPS_26\t4\t/* Direct 26 bit shifted */\n#define\tR_MIPS_HI16\t5\t/* High 16 bit */\n#define\tR_MIPS_LO16\t6\t/* Low 16 bit */\n#define\tR_MIPS_GPREL16\t7\t/* GP relative 16 bit */\n#define\tR_MIPS_LITERAL\t8\t/* 16 bit literal entry */\n#define\tR_MIPS_GOT16\t9\t/* 16 bit GOT entry */\n#define\tR_MIPS_PC16\t10\t/* PC relative 16 bit */\n#define\tR_MIPS_CALL16\t11\t/* 16 bit GOT entry for function */\n#define\tR_MIPS_GPREL32\t12\t/* GP relative 32 bit */\n#define\tR_MIPS_GOTHI16\t21\t/* GOT HI 16 bit */\n#define\tR_MIPS_GOTLO16\t22\t/* GOT LO 16 bit */\n#define\tR_MIPS_CALLHI16 30\t/* upper 16 bit GOT entry for function */\n#define\tR_MIPS_CALLLO16 31\t/* lower 16 bit GOT entry for function */\n\n#define\tR_PPC_NONE\t\t0\t/* No relocation. */\n#define\tR_PPC_ADDR32\t\t1\n#define\tR_PPC_ADDR24\t\t2\n#define\tR_PPC_ADDR16\t\t3\n#define\tR_PPC_ADDR16_LO\t\t4\n#define\tR_PPC_ADDR16_HI\t\t5\n#define\tR_PPC_ADDR16_HA\t\t6\n#define\tR_PPC_ADDR14\t\t7\n#define\tR_PPC_ADDR14_BRTAKEN\t8\n#define\tR_PPC_ADDR14_BRNTAKEN\t9\n#define\tR_PPC_REL24\t\t10\n#define\tR_PPC_REL14\t\t11\n#define\tR_PPC_REL14_BRTAKEN\t12\n#define\tR_PPC_REL14_BRNTAKEN\t13\n#define\tR_PPC_GOT16\t\t14\n#define\tR_PPC_GOT16_LO\t\t15\n#define\tR_PPC_GOT16_HI\t\t16\n#define\tR_PPC_GOT16_HA\t\t17\n#define\tR_PPC_PLTREL24\t\t18\n#define\tR_PPC_COPY\t\t19\n#define\tR_PPC_GLOB_DAT\t\t20\n#define\tR_PPC_JMP_SLOT\t\t21\n#define\tR_PPC_RELATIVE\t\t22\n#define\tR_PPC_LOCAL24PC\t\t23\n#define\tR_PPC_UADDR32\t\t24\n#define\tR_PPC_UADDR16\t\t25\n#define\tR_PPC_REL32\t\t26\n#define\tR_PPC_PLT32\t\t27\n#define\tR_PPC_PLTREL32\t\t28\n#define\tR_PPC_PLT16_LO\t\t29\n#define\tR_PPC_PLT16_HI\t\t30\n#define\tR_PPC_PLT16_HA\t\t31\n#define\tR_PPC_SDAREL16\t\t32\n#define\tR_PPC_SECTOFF\t\t33\n#define\tR_PPC_SECTOFF_LO\t34\n#define\tR_PPC_SECTOFF_HI\t35\n#define\tR_PPC_SECTOFF_HA\t36\n\n/*\n * 64-bit relocations\n */\n#define\tR_PPC64_ADDR64\t\t38\n#define\tR_PPC64_ADDR16_HIGHER\t39\n#define\tR_PPC64_ADDR16_HIGHERA\t40\n#define\tR_PPC64_ADDR16_HIGHEST\t41\n#define\tR_PPC64_ADDR16_HIGHESTA\t42\n#define\tR_PPC64_UADDR64\t\t43\n#define\tR_PPC64_REL64\t\t44\n#define\tR_PPC64_PLT64\t\t45\n#define\tR_PPC64_PLTREL64\t46\n#define\tR_PPC64_TOC16\t\t47\n#define\tR_PPC64_TOC16_LO\t48\n#define\tR_PPC64_TOC16_HI\t49\n#define\tR_PPC64_TOC16_HA\t50\n#define\tR_PPC64_TOC\t\t51\n#define\tR_PPC64_DTPMOD64\t68\n#define\tR_PPC64_TPREL64\t\t73\n#define\tR_PPC64_DTPREL64\t78\n\n/*\n * TLS relocations\n */\n#define\tR_PPC_TLS\t\t67\n#define\tR_PPC_DTPMOD32\t\t68\n#define\tR_PPC_TPREL16\t\t69\n#define\tR_PPC_TPREL16_LO\t70\n#define\tR_PPC_TPREL16_HI\t71\n#define\tR_PPC_TPREL16_HA\t72\n#define\tR_PPC_TPREL32\t\t73\n#define\tR_PPC_DTPREL16\t\t74\n#define\tR_PPC_DTPREL16_LO\t75\n#define\tR_PPC_DTPREL16_HI\t76\n#define\tR_PPC_DTPREL16_HA\t77\n#define\tR_PPC_DTPREL32\t\t78\n#define\tR_PPC_GOT_TLSGD16\t79\n#define\tR_PPC_GOT_TLSGD16_LO\t80\n#define\tR_PPC_GOT_TLSGD16_HI\t81\n#define\tR_PPC_GOT_TLSGD16_HA\t82\n#define\tR_PPC_GOT_TLSLD16\t83\n#define\tR_PPC_GOT_TLSLD16_LO\t84\n#define\tR_PPC_GOT_TLSLD16_HI\t85\n#define\tR_PPC_GOT_TLSLD16_HA\t86\n#define\tR_PPC_GOT_TPREL16\t87\n#define\tR_PPC_GOT_TPREL16_LO\t88\n#define\tR_PPC_GOT_TPREL16_HI\t89\n#define\tR_PPC_GOT_TPREL16_HA\t90\n\n/*\n * The remaining relocs are from the Embedded ELF ABI, and are not in the\n *  SVR4 ELF ABI.\n */\n\n#define\tR_PPC_EMB_NADDR32\t101\n#define\tR_PPC_EMB_NADDR16\t102\n#define\tR_PPC_EMB_NADDR16_LO\t103\n#define\tR_PPC_EMB_NADDR16_HI\t104\n#define\tR_PPC_EMB_NADDR16_HA\t105\n#define\tR_PPC_EMB_SDAI16\t106\n#define\tR_PPC_EMB_SDA2I16\t107\n#define\tR_PPC_EMB_SDA2REL\t108\n#define\tR_PPC_EMB_SDA21\t\t109\n#define\tR_PPC_EMB_MRKREF\t110\n#define\tR_PPC_EMB_RELSEC16\t111\n#define\tR_PPC_EMB_RELST_LO\t112\n#define\tR_PPC_EMB_RELST_HI\t113\n#define\tR_PPC_EMB_RELST_HA\t114\n#define\tR_PPC_EMB_BIT_FLD\t115\n#define\tR_PPC_EMB_RELSDA\t116\n\n#define\tR_SPARC_NONE\t\t0\n#define\tR_SPARC_8\t\t1\n#define\tR_SPARC_16\t\t2\n#define\tR_SPARC_32\t\t3\n#define\tR_SPARC_DISP8\t\t4\n#define\tR_SPARC_DISP16\t\t5\n#define\tR_SPARC_DISP32\t\t6\n#define\tR_SPARC_WDISP30\t\t7\n#define\tR_SPARC_WDISP22\t\t8\n#define\tR_SPARC_HI22\t\t9\n#define\tR_SPARC_22\t\t10\n#define\tR_SPARC_13\t\t11\n#define\tR_SPARC_LO10\t\t12\n#define\tR_SPARC_GOT10\t\t13\n#define\tR_SPARC_GOT13\t\t14\n#define\tR_SPARC_GOT22\t\t15\n#define\tR_SPARC_PC10\t\t16\n#define\tR_SPARC_PC22\t\t17\n#define\tR_SPARC_WPLT30\t\t18\n#define\tR_SPARC_COPY\t\t19\n#define\tR_SPARC_GLOB_DAT\t20\n#define\tR_SPARC_JMP_SLOT\t21\n#define\tR_SPARC_RELATIVE\t22\n#define\tR_SPARC_UA32\t\t23\n#define\tR_SPARC_PLT32\t\t24\n#define\tR_SPARC_HIPLT22\t\t25\n#define\tR_SPARC_LOPLT10\t\t26\n#define\tR_SPARC_PCPLT32\t\t27\n#define\tR_SPARC_PCPLT22\t\t28\n#define\tR_SPARC_PCPLT10\t\t29\n#define\tR_SPARC_10\t\t30\n#define\tR_SPARC_11\t\t31\n#define\tR_SPARC_64\t\t32\n#define\tR_SPARC_OLO10\t\t33\n#define\tR_SPARC_HH22\t\t34\n#define\tR_SPARC_HM10\t\t35\n#define\tR_SPARC_LM22\t\t36\n#define\tR_SPARC_PC_HH22\t\t37\n#define\tR_SPARC_PC_HM10\t\t38\n#define\tR_SPARC_PC_LM22\t\t39\n#define\tR_SPARC_WDISP16\t\t40\n#define\tR_SPARC_WDISP19\t\t41\n#define\tR_SPARC_GLOB_JMP\t42\n#define\tR_SPARC_7\t\t43\n#define\tR_SPARC_5\t\t44\n#define\tR_SPARC_6\t\t45\n#define\tR_SPARC_DISP64\t\t46\n#define\tR_SPARC_PLT64\t\t47\n#define\tR_SPARC_HIX22\t\t48\n#define\tR_SPARC_LOX10\t\t49\n#define\tR_SPARC_H44\t\t50\n#define\tR_SPARC_M44\t\t51\n#define\tR_SPARC_L44\t\t52\n#define\tR_SPARC_REGISTER\t53\n#define\tR_SPARC_UA64\t\t54\n#define\tR_SPARC_UA16\t\t55\n#define\tR_SPARC_TLS_GD_HI22\t56\n#define\tR_SPARC_TLS_GD_LO10\t57\n#define\tR_SPARC_TLS_GD_ADD\t58\n#define\tR_SPARC_TLS_GD_CALL\t59\n#define\tR_SPARC_TLS_LDM_HI22\t60\n#define\tR_SPARC_TLS_LDM_LO10\t61\n#define\tR_SPARC_TLS_LDM_ADD\t62\n#define\tR_SPARC_TLS_LDM_CALL\t63\n#define\tR_SPARC_TLS_LDO_HIX22\t64\n#define\tR_SPARC_TLS_LDO_LOX10\t65\n#define\tR_SPARC_TLS_LDO_ADD\t66\n#define\tR_SPARC_TLS_IE_HI22\t67\n#define\tR_SPARC_TLS_IE_LO10\t68\n#define\tR_SPARC_TLS_IE_LD\t69\n#define\tR_SPARC_TLS_IE_LDX\t70\n#define\tR_SPARC_TLS_IE_ADD\t71\n#define\tR_SPARC_TLS_LE_HIX22\t72\n#define\tR_SPARC_TLS_LE_LOX10\t73\n#define\tR_SPARC_TLS_DTPMOD32\t74\n#define\tR_SPARC_TLS_DTPMOD64\t75\n#define\tR_SPARC_TLS_DTPOFF32\t76\n#define\tR_SPARC_TLS_DTPOFF64\t77\n#define\tR_SPARC_TLS_TPOFF32\t78\n#define\tR_SPARC_TLS_TPOFF64\t79\n\n#define\tR_X86_64_NONE\t\t0\t/* No relocation. */\n#define\tR_X86_64_64\t\t1\t/* Add 64 bit symbol value. */\n#define\tR_X86_64_PC32\t\t2\t/* PC-relative 32 bit signed sym value. */\n#define\tR_X86_64_GOT32\t\t3\t/* PC-relative 32 bit GOT offset. */\n#define\tR_X86_64_PLT32\t\t4\t/* PC-relative 32 bit PLT offset. */\n#define\tR_X86_64_COPY\t\t5\t/* Copy data from shared object. */\n#define\tR_X86_64_GLOB_DAT\t6\t/* Set GOT entry to data address. */\n#define\tR_X86_64_JMP_SLOT\t7\t/* Set GOT entry to code address. */\n#define\tR_X86_64_RELATIVE\t8\t/* Add load address of shared object. */\n#define\tR_X86_64_GOTPCREL\t9\t/* Add 32 bit signed pcrel offset to GOT. */\n#define\tR_X86_64_32\t\t10\t/* Add 32 bit zero extended symbol value */\n#define\tR_X86_64_32S\t\t11\t/* Add 32 bit sign extended symbol value */\n#define\tR_X86_64_16\t\t12\t/* Add 16 bit zero extended symbol value */\n#define\tR_X86_64_PC16\t\t13\t/* Add 16 bit signed extended pc relative symbol value */\n#define\tR_X86_64_8\t\t14\t/* Add 8 bit zero extended symbol value */\n#define\tR_X86_64_PC8\t\t15\t/* Add 8 bit signed extended pc relative symbol value */\n#define\tR_X86_64_DTPMOD64\t16\t/* ID of module containing symbol */\n#define\tR_X86_64_DTPOFF64\t17\t/* Offset in TLS block */\n#define\tR_X86_64_TPOFF64\t18\t/* Offset in static TLS block */\n#define\tR_X86_64_TLSGD\t\t19\t/* PC relative offset to GD GOT entry */\n#define\tR_X86_64_TLSLD\t\t20\t/* PC relative offset to LD GOT entry */\n#define\tR_X86_64_DTPOFF32\t21\t/* Offset in TLS block */\n#define\tR_X86_64_GOTTPOFF\t22\t/* PC relative offset to IE GOT entry */\n#define\tR_X86_64_TPOFF32\t23\t/* Offset in static TLS block */\n\n\n#endif /* !_SYS_ELF_COMMON_H_ */\n"
  },
  {
    "path": "freebsd-headers/sys/elf_generic.h",
    "content": "/*-\n * Copyright (c) 1998 John D. Polstra.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/sys/elf_generic.h 186667 2009-01-01 02:08:56Z obrien $\n */\n\n#ifndef _SYS_ELF_GENERIC_H_\n#define\t_SYS_ELF_GENERIC_H_ 1\n\n#include <sys/cdefs.h>\n\n/*\n * Definitions of generic ELF names which relieve applications from\n * needing to know the word size.\n */\n\n#if __ELF_WORD_SIZE != 32 && __ELF_WORD_SIZE != 64\n#error \"__ELF_WORD_SIZE must be defined as 32 or 64\"\n#endif\n\n#define\tELF_CLASS\t__CONCAT(ELFCLASS,__ELF_WORD_SIZE)\n\n#if BYTE_ORDER == LITTLE_ENDIAN\n#define\tELF_DATA\tELFDATA2LSB\n#elif BYTE_ORDER == BIG_ENDIAN\n#define\tELF_DATA\tELFDATA2MSB\n#else\n#error \"Unknown byte order\"\n#endif\n\n#define\t__elfN(x)\t__CONCAT(__CONCAT(__CONCAT(elf,__ELF_WORD_SIZE),_),x)\n#define\t__ElfN(x)\t__CONCAT(__CONCAT(__CONCAT(Elf,__ELF_WORD_SIZE),_),x)\n#define\t__ELFN(x)\t__CONCAT(__CONCAT(__CONCAT(ELF,__ELF_WORD_SIZE),_),x)\n#define\t__ElfType(x)\ttypedef __ElfN(x) __CONCAT(Elf_,x)\n\n__ElfType(Addr);\n__ElfType(Half);\n__ElfType(Off);\n__ElfType(Sword);\n__ElfType(Word);\n__ElfType(Ehdr);\n__ElfType(Shdr);\n__ElfType(Phdr);\n__ElfType(Dyn);\n__ElfType(Rel);\n__ElfType(Rela);\n__ElfType(Sym);\n__ElfType(Verdef);\n__ElfType(Verdaux);\n__ElfType(Verneed);\n__ElfType(Vernaux);\n__ElfType(Versym);\n\n/* Non-standard ELF types. */\n__ElfType(Hashelt);\n__ElfType(Size);\n__ElfType(Ssize);\n\n#define\tELF_R_SYM\t__ELFN(R_SYM)\n#define\tELF_R_TYPE\t__ELFN(R_TYPE)\n#define\tELF_R_INFO\t__ELFN(R_INFO)\n#define\tELF_ST_BIND\t__ELFN(ST_BIND)\n#define\tELF_ST_TYPE\t__ELFN(ST_TYPE)\n#define\tELF_ST_INFO\t__ELFN(ST_INFO)\n\n#endif /* !_SYS_ELF_GENERIC_H_ */\n"
  },
  {
    "path": "freebsd-headers/sys/endian.h",
    "content": "/*-\n * Copyright (c) 2002 Thomas Moestl <tmm@FreeBSD.org>\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/sys/endian.h 208331 2010-05-20 06:16:13Z phk $\n */\n\n#ifndef _SYS_ENDIAN_H_\n#define _SYS_ENDIAN_H_\n\n#include <sys/cdefs.h>\n#include <sys/_types.h>\n#include <machine/endian.h>\n\n#ifndef _UINT8_T_DECLARED\ntypedef\t__uint8_t\tuint8_t;\n#define\t_UINT8_T_DECLARED\n#endif\n \n#ifndef _UINT16_T_DECLARED\ntypedef\t__uint16_t\tuint16_t;\n#define\t_UINT16_T_DECLARED\n#endif\n \n#ifndef _UINT32_T_DECLARED\ntypedef\t__uint32_t\tuint32_t;\n#define\t_UINT32_T_DECLARED\n#endif\n \n#ifndef _UINT64_T_DECLARED\ntypedef\t__uint64_t\tuint64_t;\n#define\t_UINT64_T_DECLARED\n#endif\n \n/*\n * General byte order swapping functions.\n */\n#define\tbswap16(x)\t__bswap16(x)\n#define\tbswap32(x)\t__bswap32(x)\n#define\tbswap64(x)\t__bswap64(x)\n\n/*\n * Host to big endian, host to little endian, big endian to host, and little\n * endian to host byte order functions as detailed in byteorder(9).\n */\n#if _BYTE_ORDER == _LITTLE_ENDIAN\n#define\thtobe16(x)\tbswap16((x))\n#define\thtobe32(x)\tbswap32((x))\n#define\thtobe64(x)\tbswap64((x))\n#define\thtole16(x)\t((uint16_t)(x))\n#define\thtole32(x)\t((uint32_t)(x))\n#define\thtole64(x)\t((uint64_t)(x))\n\n#define\tbe16toh(x)\tbswap16((x))\n#define\tbe32toh(x)\tbswap32((x))\n#define\tbe64toh(x)\tbswap64((x))\n#define\tle16toh(x)\t((uint16_t)(x))\n#define\tle32toh(x)\t((uint32_t)(x))\n#define\tle64toh(x)\t((uint64_t)(x))\n#else /* _BYTE_ORDER != _LITTLE_ENDIAN */\n#define\thtobe16(x)\t((uint16_t)(x))\n#define\thtobe32(x)\t((uint32_t)(x))\n#define\thtobe64(x)\t((uint64_t)(x))\n#define\thtole16(x)\tbswap16((x))\n#define\thtole32(x)\tbswap32((x))\n#define\thtole64(x)\tbswap64((x))\n\n#define\tbe16toh(x)\t((uint16_t)(x))\n#define\tbe32toh(x)\t((uint32_t)(x))\n#define\tbe64toh(x)\t((uint64_t)(x))\n#define\tle16toh(x)\tbswap16((x))\n#define\tle32toh(x)\tbswap32((x))\n#define\tle64toh(x)\tbswap64((x))\n#endif /* _BYTE_ORDER == _LITTLE_ENDIAN */\n\n/* Alignment-agnostic encode/decode bytestream to/from little/big endian. */\n\nstatic __inline uint16_t\nbe16dec(const void *pp)\n{\n\tuint8_t const *p = (uint8_t const *)pp;\n\n\treturn ((p[0] << 8) | p[1]);\n}\n\nstatic __inline uint32_t\nbe32dec(const void *pp)\n{\n\tuint8_t const *p = (uint8_t const *)pp;\n\n\treturn (((unsigned)p[0] << 24) | (p[1] << 16) | (p[2] << 8) | p[3]);\n}\n\nstatic __inline uint64_t\nbe64dec(const void *pp)\n{\n\tuint8_t const *p = (uint8_t const *)pp;\n\n\treturn (((uint64_t)be32dec(p) << 32) | be32dec(p + 4));\n}\n\nstatic __inline uint16_t\nle16dec(const void *pp)\n{\n\tuint8_t const *p = (uint8_t const *)pp;\n\n\treturn ((p[1] << 8) | p[0]);\n}\n\nstatic __inline uint32_t\nle32dec(const void *pp)\n{\n\tuint8_t const *p = (uint8_t const *)pp;\n\n\treturn (((unsigned)p[3] << 24) | (p[2] << 16) | (p[1] << 8) | p[0]);\n}\n\nstatic __inline uint64_t\nle64dec(const void *pp)\n{\n\tuint8_t const *p = (uint8_t const *)pp;\n\n\treturn (((uint64_t)le32dec(p + 4) << 32) | le32dec(p));\n}\n\nstatic __inline void\nbe16enc(void *pp, uint16_t u)\n{\n\tuint8_t *p = (uint8_t *)pp;\n\n\tp[0] = (u >> 8) & 0xff;\n\tp[1] = u & 0xff;\n}\n\nstatic __inline void\nbe32enc(void *pp, uint32_t u)\n{\n\tuint8_t *p = (uint8_t *)pp;\n\n\tp[0] = (u >> 24) & 0xff;\n\tp[1] = (u >> 16) & 0xff;\n\tp[2] = (u >> 8) & 0xff;\n\tp[3] = u & 0xff;\n}\n\nstatic __inline void\nbe64enc(void *pp, uint64_t u)\n{\n\tuint8_t *p = (uint8_t *)pp;\n\n\tbe32enc(p, (uint32_t)(u >> 32));\n\tbe32enc(p + 4, (uint32_t)(u & 0xffffffffU));\n}\n\nstatic __inline void\nle16enc(void *pp, uint16_t u)\n{\n\tuint8_t *p = (uint8_t *)pp;\n\n\tp[0] = u & 0xff;\n\tp[1] = (u >> 8) & 0xff;\n}\n\nstatic __inline void\nle32enc(void *pp, uint32_t u)\n{\n\tuint8_t *p = (uint8_t *)pp;\n\n\tp[0] = u & 0xff;\n\tp[1] = (u >> 8) & 0xff;\n\tp[2] = (u >> 16) & 0xff;\n\tp[3] = (u >> 24) & 0xff;\n}\n\nstatic __inline void\nle64enc(void *pp, uint64_t u)\n{\n\tuint8_t *p = (uint8_t *)pp;\n\n\tle32enc(p, (uint32_t)(u & 0xffffffffU));\n\tle32enc(p + 4, (uint32_t)(u >> 32));\n}\n\n#endif\t/* _SYS_ENDIAN_H_ */\n"
  },
  {
    "path": "freebsd-headers/sys/errno.h",
    "content": "/*-\n * Copyright (c) 1982, 1986, 1989, 1993\n *\tThe Regents of the University of California.  All rights reserved.\n * (c) UNIX System Laboratories, Inc.\n * All or some portions of this file are derived from material licensed\n * to the University of California by American Telephone and Telegraph\n * Co. or Unix System Laboratories, Inc. and are reproduced herein with\n * the permission of UNIX System Laboratories, Inc.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 4. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t@(#)errno.h\t8.5 (Berkeley) 1/21/94\n * $FreeBSD: release/9.0.0/sys/sys/errno.h 220335 2011-04-04 17:39:30Z avg $\n */\n\n#ifndef _SYS_ERRNO_H_\n#define _SYS_ERRNO_H_\n\n#ifndef _KERNEL\n#include <sys/cdefs.h>\n__BEGIN_DECLS\nint *\t__error(void);\n__END_DECLS\n#define\terrno\t\t(* __error())\n#endif\n\n#define\tEPERM\t\t1\t\t/* Operation not permitted */\n#define\tENOENT\t\t2\t\t/* No such file or directory */\n#define\tESRCH\t\t3\t\t/* No such process */\n#define\tEINTR\t\t4\t\t/* Interrupted system call */\n#define\tEIO\t\t5\t\t/* Input/output error */\n#define\tENXIO\t\t6\t\t/* Device not configured */\n#define\tE2BIG\t\t7\t\t/* Argument list too long */\n#define\tENOEXEC\t\t8\t\t/* Exec format error */\n#define\tEBADF\t\t9\t\t/* Bad file descriptor */\n#define\tECHILD\t\t10\t\t/* No child processes */\n#define\tEDEADLK\t\t11\t\t/* Resource deadlock avoided */\n\t\t\t\t\t/* 11 was EAGAIN */\n#define\tENOMEM\t\t12\t\t/* Cannot allocate memory */\n#define\tEACCES\t\t13\t\t/* Permission denied */\n#define\tEFAULT\t\t14\t\t/* Bad address */\n#ifndef _POSIX_SOURCE\n#define\tENOTBLK\t\t15\t\t/* Block device required */\n#endif\n#define\tEBUSY\t\t16\t\t/* Device busy */\n#define\tEEXIST\t\t17\t\t/* File exists */\n#define\tEXDEV\t\t18\t\t/* Cross-device link */\n#define\tENODEV\t\t19\t\t/* Operation not supported by device */\n#define\tENOTDIR\t\t20\t\t/* Not a directory */\n#define\tEISDIR\t\t21\t\t/* Is a directory */\n#define\tEINVAL\t\t22\t\t/* Invalid argument */\n#define\tENFILE\t\t23\t\t/* Too many open files in system */\n#define\tEMFILE\t\t24\t\t/* Too many open files */\n#define\tENOTTY\t\t25\t\t/* Inappropriate ioctl for device */\n#ifndef _POSIX_SOURCE\n#define\tETXTBSY\t\t26\t\t/* Text file busy */\n#endif\n#define\tEFBIG\t\t27\t\t/* File too large */\n#define\tENOSPC\t\t28\t\t/* No space left on device */\n#define\tESPIPE\t\t29\t\t/* Illegal seek */\n#define\tEROFS\t\t30\t\t/* Read-only filesystem */\n#define\tEMLINK\t\t31\t\t/* Too many links */\n#define\tEPIPE\t\t32\t\t/* Broken pipe */\n\n/* math software */\n#define\tEDOM\t\t33\t\t/* Numerical argument out of domain */\n#define\tERANGE\t\t34\t\t/* Result too large */\n\n/* non-blocking and interrupt i/o */\n#define\tEAGAIN\t\t35\t\t/* Resource temporarily unavailable */\n#ifndef _POSIX_SOURCE\n#define\tEWOULDBLOCK\tEAGAIN\t\t/* Operation would block */\n#define\tEINPROGRESS\t36\t\t/* Operation now in progress */\n#define\tEALREADY\t37\t\t/* Operation already in progress */\n\n/* ipc/network software -- argument errors */\n#define\tENOTSOCK\t38\t\t/* Socket operation on non-socket */\n#define\tEDESTADDRREQ\t39\t\t/* Destination address required */\n#define\tEMSGSIZE\t40\t\t/* Message too long */\n#define\tEPROTOTYPE\t41\t\t/* Protocol wrong type for socket */\n#define\tENOPROTOOPT\t42\t\t/* Protocol not available */\n#define\tEPROTONOSUPPORT\t43\t\t/* Protocol not supported */\n#define\tESOCKTNOSUPPORT\t44\t\t/* Socket type not supported */\n#define\tEOPNOTSUPP\t45\t\t/* Operation not supported */\n#define\tENOTSUP\t\tEOPNOTSUPP\t/* Operation not supported */\n#define\tEPFNOSUPPORT\t46\t\t/* Protocol family not supported */\n#define\tEAFNOSUPPORT\t47\t\t/* Address family not supported by protocol family */\n#define\tEADDRINUSE\t48\t\t/* Address already in use */\n#define\tEADDRNOTAVAIL\t49\t\t/* Can't assign requested address */\n\n/* ipc/network software -- operational errors */\n#define\tENETDOWN\t50\t\t/* Network is down */\n#define\tENETUNREACH\t51\t\t/* Network is unreachable */\n#define\tENETRESET\t52\t\t/* Network dropped connection on reset */\n#define\tECONNABORTED\t53\t\t/* Software caused connection abort */\n#define\tECONNRESET\t54\t\t/* Connection reset by peer */\n#define\tENOBUFS\t\t55\t\t/* No buffer space available */\n#define\tEISCONN\t\t56\t\t/* Socket is already connected */\n#define\tENOTCONN\t57\t\t/* Socket is not connected */\n#define\tESHUTDOWN\t58\t\t/* Can't send after socket shutdown */\n#define\tETOOMANYREFS\t59\t\t/* Too many references: can't splice */\n#define\tETIMEDOUT\t60\t\t/* Operation timed out */\n#define\tECONNREFUSED\t61\t\t/* Connection refused */\n\n#define\tELOOP\t\t62\t\t/* Too many levels of symbolic links */\n#endif /* _POSIX_SOURCE */\n#define\tENAMETOOLONG\t63\t\t/* File name too long */\n\n/* should be rearranged */\n#ifndef _POSIX_SOURCE\n#define\tEHOSTDOWN\t64\t\t/* Host is down */\n#define\tEHOSTUNREACH\t65\t\t/* No route to host */\n#endif /* _POSIX_SOURCE */\n#define\tENOTEMPTY\t66\t\t/* Directory not empty */\n\n/* quotas & mush */\n#ifndef _POSIX_SOURCE\n#define\tEPROCLIM\t67\t\t/* Too many processes */\n#define\tEUSERS\t\t68\t\t/* Too many users */\n#define\tEDQUOT\t\t69\t\t/* Disc quota exceeded */\n\n/* Network File System */\n#define\tESTALE\t\t70\t\t/* Stale NFS file handle */\n#define\tEREMOTE\t\t71\t\t/* Too many levels of remote in path */\n#define\tEBADRPC\t\t72\t\t/* RPC struct is bad */\n#define\tERPCMISMATCH\t73\t\t/* RPC version wrong */\n#define\tEPROGUNAVAIL\t74\t\t/* RPC prog. not avail */\n#define\tEPROGMISMATCH\t75\t\t/* Program version wrong */\n#define\tEPROCUNAVAIL\t76\t\t/* Bad procedure for program */\n#endif /* _POSIX_SOURCE */\n\n#define\tENOLCK\t\t77\t\t/* No locks available */\n#define\tENOSYS\t\t78\t\t/* Function not implemented */\n\n#ifndef _POSIX_SOURCE\n#define\tEFTYPE\t\t79\t\t/* Inappropriate file type or format */\n#define\tEAUTH\t\t80\t\t/* Authentication error */\n#define\tENEEDAUTH\t81\t\t/* Need authenticator */\n#define\tEIDRM\t\t82\t\t/* Identifier removed */\n#define\tENOMSG\t\t83\t\t/* No message of desired type */\n#define\tEOVERFLOW\t84\t\t/* Value too large to be stored in data type */\n#define\tECANCELED\t85\t\t/* Operation canceled */\n#define\tEILSEQ\t\t86\t\t/* Illegal byte sequence */\n#define\tENOATTR\t\t87\t\t/* Attribute not found */\n\n#define\tEDOOFUS\t\t88\t\t/* Programming error */\n#endif /* _POSIX_SOURCE */\n\n#define\tEBADMSG\t\t89\t\t/* Bad message */\n#define\tEMULTIHOP\t90\t\t/* Multihop attempted */\n#define\tENOLINK\t\t91\t\t/* Link has been severed */\n#define\tEPROTO\t\t92\t\t/* Protocol error */\n\n#ifndef _POSIX_SOURCE\n#define\tENOTCAPABLE\t93\t\t/* Capabilities insufficient */\n#define\tECAPMODE\t94\t\t/* Not permitted in capability mode */\n#endif /* _POSIX_SOURCE */\n\n#ifndef _POSIX_SOURCE\n#define\tELAST\t\t94\t\t/* Must be equal largest errno */\n#endif /* _POSIX_SOURCE */\n\n#ifdef _KERNEL\n/* pseudo-errors returned inside kernel to modify return to process */\n#define\tERESTART\t(-1)\t\t/* restart syscall */\n#define\tEJUSTRETURN\t(-2)\t\t/* don't modify regs, just return */\n#define\tENOIOCTL\t(-3)\t\t/* ioctl not handled by this layer */\n#define\tEDIRIOCTL\t(-4)\t\t/* do direct ioctl in GEOM */\n#endif\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/sys/eui64.h",
    "content": "/*-\n * Copyright 2004 The Aerospace Corporation.  All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n *\n * 1.  Redistributions of source code must retain the above copyright\n *     notice, this list of conditions, and the following disclaimer.\n * 2.  Redistributions in binary form must reproduce the above copyright\n *     notice, this list of conditions, and the following disclaimer in the\n *     documentation and/or other materials provided with the distribution.\n * 3.  The name of The Aerospace Corporation may not be used to endorse or\n *     promote products derived from this software.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AEROSPACE CORPORATION \"AS IS\" AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AEROSPACE CORPORATION BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/sys/eui64.h 139825 2005-01-07 02:29:27Z imp $\n */\n#ifndef _SYS_EUI64_H\n#define _SYS_EUI64_H\n\n/*\n * Size of the ASCII representation of an EUI-64.\n */\n#define EUI64_SIZ\t24\n\n/*\n * The number of bytes in an EUI-64.\n */\n#define EUI64_LEN\t8\n\n/*\n * Structure of an IEEE EUI-64.\n */\nstruct\teui64 {\n\tu_char octet[EUI64_LEN];\n};\n\n#ifndef _KERNEL\nint\teui64_aton(const char *, struct eui64 *);\nint\teui64_ntoa(const struct eui64 *, char *, size_t);\nint\teui64_ntohost(char *, size_t, const struct eui64 *);\nint\teui64_hostton(const char *, struct eui64 *);\n#endif /* !_KERNEL */\n\n#endif /* !_SYS_EUI64_H */\n"
  },
  {
    "path": "freebsd-headers/sys/event.h",
    "content": "/*-\n * Copyright (c) 1999,2000,2001 Jonathan Lemon <jlemon@FreeBSD.org>\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/sys/event.h 201350 2009-12-31 20:29:58Z brooks $\n */\n\n#ifndef _SYS_EVENT_H_\n#define _SYS_EVENT_H_\n\n#include <sys/queue.h> \n\n#define EVFILT_READ\t\t(-1)\n#define EVFILT_WRITE\t\t(-2)\n#define EVFILT_AIO\t\t(-3)\t/* attached to aio requests */\n#define EVFILT_VNODE\t\t(-4)\t/* attached to vnodes */\n#define EVFILT_PROC\t\t(-5)\t/* attached to struct proc */\n#define EVFILT_SIGNAL\t\t(-6)\t/* attached to struct proc */\n#define EVFILT_TIMER\t\t(-7)\t/* timers */\n/*\tEVFILT_NETDEV\t\t(-8)\t   no longer supported */\n#define EVFILT_FS\t\t(-9)\t/* filesystem events */\n#define EVFILT_LIO\t\t(-10)\t/* attached to lio requests */\n#define EVFILT_USER\t\t(-11)\t/* User events */\n#define EVFILT_SYSCOUNT\t\t11\n\n#define EV_SET(kevp_, a, b, c, d, e, f) do {\t\\\n\tstruct kevent *kevp = (kevp_);\t\t\\\n\t(kevp)->ident = (a);\t\t\t\\\n\t(kevp)->filter = (b);\t\t\t\\\n\t(kevp)->flags = (c);\t\t\t\\\n\t(kevp)->fflags = (d);\t\t\t\\\n\t(kevp)->data = (e);\t\t\t\\\n\t(kevp)->udata = (f);\t\t\t\\\n} while(0)\n\nstruct kevent {\n\tuintptr_t\tident;\t\t/* identifier for this event */\n\tshort\t\tfilter;\t\t/* filter for event */\n\tu_short\t\tflags;\n\tu_int\t\tfflags;\n\tintptr_t\tdata;\n\tvoid\t\t*udata;\t\t/* opaque user data identifier */\n};\n\n/* actions */\n#define EV_ADD\t\t0x0001\t\t/* add event to kq (implies enable) */\n#define EV_DELETE\t0x0002\t\t/* delete event from kq */\n#define EV_ENABLE\t0x0004\t\t/* enable event */\n#define EV_DISABLE\t0x0008\t\t/* disable event (not reported) */\n\n/* flags */\n#define EV_ONESHOT\t0x0010\t\t/* only report one occurrence */\n#define EV_CLEAR\t0x0020\t\t/* clear event state after reporting */\n#define EV_RECEIPT\t0x0040\t\t/* force EV_ERROR on success, data=0 */\n#define EV_DISPATCH\t0x0080\t\t/* disable event after reporting */\n\n#define EV_SYSFLAGS\t0xF000\t\t/* reserved by system */\n#define EV_FLAG1\t0x2000\t\t/* filter-specific flag */\n\n/* returned values */\n#define EV_EOF\t\t0x8000\t\t/* EOF detected */\n#define EV_ERROR\t0x4000\t\t/* error, data contains errno */\n\n /*\n  * data/hint flags/masks for EVFILT_USER, shared with userspace\n  *\n  * On input, the top two bits of fflags specifies how the lower twenty four\n  * bits should be applied to the stored value of fflags.\n  *\n  * On output, the top two bits will always be set to NOTE_FFNOP and the\n  * remaining twenty four bits will contain the stored fflags value.\n  */\n#define NOTE_FFNOP\t0x00000000\t\t/* ignore input fflags */\n#define NOTE_FFAND\t0x40000000\t\t/* AND fflags */\n#define NOTE_FFOR\t0x80000000\t\t/* OR fflags */\n#define NOTE_FFCOPY\t0xc0000000\t\t/* copy fflags */\n#define NOTE_FFCTRLMASK\t0xc0000000\t\t/* masks for operations */\n#define NOTE_FFLAGSMASK\t0x00ffffff\n\n#define NOTE_TRIGGER\t0x01000000\t\t/* Cause the event to be\n\t\t\t\t\t\t   triggered for output. */\n\n/*\n * data/hint flags for EVFILT_{READ|WRITE}, shared with userspace\n */\n#define NOTE_LOWAT\t0x0001\t\t\t/* low water mark */\n\n/*\n * data/hint flags for EVFILT_VNODE, shared with userspace\n */\n#define\tNOTE_DELETE\t0x0001\t\t\t/* vnode was removed */\n#define\tNOTE_WRITE\t0x0002\t\t\t/* data contents changed */\n#define\tNOTE_EXTEND\t0x0004\t\t\t/* size increased */\n#define\tNOTE_ATTRIB\t0x0008\t\t\t/* attributes changed */\n#define\tNOTE_LINK\t0x0010\t\t\t/* link count changed */\n#define\tNOTE_RENAME\t0x0020\t\t\t/* vnode was renamed */\n#define\tNOTE_REVOKE\t0x0040\t\t\t/* vnode access was revoked */\n\n/*\n * data/hint flags for EVFILT_PROC, shared with userspace\n */\n#define\tNOTE_EXIT\t0x80000000\t\t/* process exited */\n#define\tNOTE_FORK\t0x40000000\t\t/* process forked */\n#define\tNOTE_EXEC\t0x20000000\t\t/* process exec'd */\n#define\tNOTE_PCTRLMASK\t0xf0000000\t\t/* mask for hint bits */\n#define\tNOTE_PDATAMASK\t0x000fffff\t\t/* mask for pid */\n\n/* additional flags for EVFILT_PROC */\n#define\tNOTE_TRACK\t0x00000001\t\t/* follow across forks */\n#define\tNOTE_TRACKERR\t0x00000002\t\t/* could not track child */\n#define\tNOTE_CHILD\t0x00000004\t\t/* am a child process */\n\nstruct knote;\nSLIST_HEAD(klist, knote);\nstruct kqueue;\nSLIST_HEAD(kqlist, kqueue);\nstruct knlist {\n\tstruct\tklist\tkl_list;\n\tvoid    (*kl_lock)(void *);\t/* lock function */\n\tvoid    (*kl_unlock)(void *);\n\tvoid\t(*kl_assert_locked)(void *);\n\tvoid\t(*kl_assert_unlocked)(void *);\n\tvoid *kl_lockarg;\t\t/* argument passed to kl_lockf() */\n};\n\n\n#ifdef _KERNEL\n\n#ifdef MALLOC_DECLARE\nMALLOC_DECLARE(M_KQUEUE);\n#endif\n\n/*\n * Flags for knote call\n */\n#define\tKNF_LISTLOCKED\t0x0001\t\t\t/* knlist is locked */\n#define\tKNF_NOKQLOCK\t0x0002\t\t\t/* do not keep KQ_LOCK */\n\n#define KNOTE(list, hist, flags)\tknote(list, hist, flags)\n#define KNOTE_LOCKED(list, hint)\tknote(list, hint, KNF_LISTLOCKED)\n#define KNOTE_UNLOCKED(list, hint)\tknote(list, hint, 0)\n\n#define\tKNLIST_EMPTY(list)\t\tSLIST_EMPTY(&(list)->kl_list)\n\n/*\n * Flag indicating hint is a signal.  Used by EVFILT_SIGNAL, and also\n * shared by EVFILT_PROC  (all knotes attached to p->p_klist)\n */\n#define NOTE_SIGNAL\t0x08000000\n\n/*\n * Hint values for the optional f_touch event filter.  If f_touch is not set \n * to NULL and f_isfd is zero the f_touch filter will be called with the type\n * argument set to EVENT_REGISTER during a kevent() system call.  It is also\n * called under the same conditions with the type argument set to EVENT_PROCESS\n * when the event has been triggered.\n */\n#define EVENT_REGISTER\t1\n#define EVENT_PROCESS\t2\n\nstruct filterops {\n\tint\tf_isfd;\t\t/* true if ident == filedescriptor */\n\tint\t(*f_attach)(struct knote *kn);\n\tvoid\t(*f_detach)(struct knote *kn);\n\tint\t(*f_event)(struct knote *kn, long hint);\n\tvoid\t(*f_touch)(struct knote *kn, struct kevent *kev, u_long type);\n};\n\n/*\n * Setting the KN_INFLUX flag enables you to unlock the kq that this knote\n * is on, and modify kn_status as if you had the KQ lock.\n *\n * kn_sfflags, kn_sdata, and kn_kevent are protected by the knlist lock.\n */\nstruct knote {\n\tSLIST_ENTRY(knote)\tkn_link;\t/* for kq */\n\tSLIST_ENTRY(knote)\tkn_selnext;\t/* for struct selinfo */\n\tstruct\t\t\tknlist *kn_knlist;\t/* f_attach populated */\n\tTAILQ_ENTRY(knote)\tkn_tqe;\n\tstruct\t\t\tkqueue *kn_kq;\t/* which queue we are on */\n\tstruct \t\t\tkevent kn_kevent;\n\tint\t\t\tkn_status;\t/* protected by kq lock */\n#define KN_ACTIVE\t0x01\t\t\t/* event has been triggered */\n#define KN_QUEUED\t0x02\t\t\t/* event is on queue */\n#define KN_DISABLED\t0x04\t\t\t/* event is disabled */\n#define KN_DETACHED\t0x08\t\t\t/* knote is detached */\n#define KN_INFLUX\t0x10\t\t\t/* knote is in flux */\n#define KN_MARKER\t0x20\t\t\t/* ignore this knote */\n#define KN_KQUEUE\t0x40\t\t\t/* this knote belongs to a kq */\n#define KN_HASKQLOCK\t0x80\t\t\t/* for _inevent */\n\tint\t\t\tkn_sfflags;\t/* saved filter flags */\n\tintptr_t\t\tkn_sdata;\t/* saved data field */\n\tunion {\n\t\tstruct\t\tfile *p_fp;\t/* file data pointer */\n\t\tstruct\t\tproc *p_proc;\t/* proc pointer */\n\t\tstruct\t\taiocblist *p_aio;\t/* AIO job pointer */\n\t\tstruct\t\taioliojob *p_lio;\t/* LIO job pointer */ \n\t} kn_ptr;\n\tstruct\t\t\tfilterops *kn_fop;\n\tvoid\t\t\t*kn_hook;\n\tint\t\t\tkn_hookid;\n\n#define kn_id\t\tkn_kevent.ident\n#define kn_filter\tkn_kevent.filter\n#define kn_flags\tkn_kevent.flags\n#define kn_fflags\tkn_kevent.fflags\n#define kn_data\t\tkn_kevent.data\n#define kn_fp\t\tkn_ptr.p_fp\n};\nstruct kevent_copyops {\n\tvoid\t*arg;\n\tint\t(*k_copyout)(void *arg, struct kevent *kevp, int count);\n\tint\t(*k_copyin)(void *arg, struct kevent *kevp, int count);\n};\n\nstruct thread;\nstruct proc;\nstruct knlist;\nstruct mtx;\n\nextern void\tknote(struct knlist *list, long hint, int lockflags);\nextern void\tknote_fork(struct knlist *list, int pid);\nextern void\tknlist_add(struct knlist *knl, struct knote *kn, int islocked);\nextern void\tknlist_remove(struct knlist *knl, struct knote *kn, int islocked);\nextern void\tknlist_remove_inevent(struct knlist *knl, struct knote *kn);\nextern int\tknlist_empty(struct knlist *knl);\nextern void\tknlist_init(struct knlist *knl, void *lock,\n    void (*kl_lock)(void *), void (*kl_unlock)(void *),\n    void (*kl_assert_locked)(void *), void (*kl_assert_unlocked)(void *));\nextern void\tknlist_init_mtx(struct knlist *knl, struct mtx *lock);\nextern void\tknlist_destroy(struct knlist *knl);\nextern void\tknlist_cleardel(struct knlist *knl, struct thread *td,\n\tint islocked, int killkn);\n#define knlist_clear(knl, islocked)\t\t\t\t\\\n\t\tknlist_cleardel((knl), NULL, (islocked), 0)\n#define knlist_delete(knl, td, islocked)\t\t\t\\\n\t\tknlist_cleardel((knl), (td), (islocked), 1)\nextern void\tknote_fdclose(struct thread *p, int fd);\nextern int \tkqfd_register(int fd, struct kevent *kev, struct thread *p,\n\t\t    int waitok);\nextern int\tkqueue_add_filteropts(int filt, struct filterops *filtops);\nextern int\tkqueue_del_filteropts(int filt);\n\n#else \t/* !_KERNEL */\n\n#include <sys/cdefs.h>\nstruct timespec;\n\n__BEGIN_DECLS\nint     kqueue(void);\nint     kevent(int kq, const struct kevent *changelist, int nchanges,\n\t    struct kevent *eventlist, int nevents,\n\t    const struct timespec *timeout);\n__END_DECLS\n\n#endif /* !_KERNEL */\n\n#endif /* !_SYS_EVENT_H_ */\n"
  },
  {
    "path": "freebsd-headers/sys/eventhandler.h",
    "content": "/*-\n * Copyright (c) 1999 Michael Smith <msmith@freebsd.org>\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/sys/eventhandler.h 220647 2011-04-14 22:17:39Z jkim $\n */\n\n#ifndef SYS_EVENTHANDLER_H\n#define SYS_EVENTHANDLER_H\n\n#include <sys/lock.h>\n#include <sys/ktr.h>\n#include <sys/mutex.h>\n#include <sys/queue.h>\n\nstruct eventhandler_entry {\n\tTAILQ_ENTRY(eventhandler_entry)\tee_link;\n\tint\t\t\t\tee_priority;\n#define\tEHE_DEAD_PRIORITY\t(-1)\n\tvoid\t\t\t\t*ee_arg;\n};\n\n#ifdef VIMAGE\nstruct eventhandler_entry_vimage {\n\tvoid\t(* func)(void);\t\t/* Original function registered. */\n\tvoid\t*ee_arg;\t\t/* Original argument registered. */\n\tvoid\t*sparep[2];\n};\n#endif\n\nstruct eventhandler_list {\n\tchar\t\t\t\t*el_name;\n\tint\t\t\t\tel_flags;\n#define EHL_INITTED\t(1<<0)\n\tu_int\t\t\t\tel_runcount;\n\tstruct mtx\t\t\tel_lock;\n\tTAILQ_ENTRY(eventhandler_list)\tel_link;\n\tTAILQ_HEAD(,eventhandler_entry)\tel_entries;\n};\n\ntypedef struct eventhandler_entry\t*eventhandler_tag;\n\n#define\tEHL_LOCK(p)\t\tmtx_lock(&(p)->el_lock)\n#define\tEHL_UNLOCK(p)\t\tmtx_unlock(&(p)->el_lock)\n#define\tEHL_LOCK_ASSERT(p, x)\tmtx_assert(&(p)->el_lock, x)\n\n/*\n * Macro to invoke the handlers for a given event.\n */\n#define _EVENTHANDLER_INVOKE(name, list, ...) do {\t\t\t\\\n\tstruct eventhandler_entry *_ep;\t\t\t\t\t\\\n\tstruct eventhandler_entry_ ## name *_t;\t\t\t\t\\\n\t\t\t\t\t\t\t\t\t\\\n\tKASSERT((list)->el_flags & EHL_INITTED,\t\t\t\t\\\n \t   (\"eventhandler_invoke: running non-inited list\"));\t\t\\\n\tEHL_LOCK_ASSERT((list), MA_OWNED);\t\t\t\t\\\n\t(list)->el_runcount++;\t\t\t\t\t\t\\\n\tKASSERT((list)->el_runcount > 0,\t\t\t\t\\\n\t    (\"eventhandler_invoke: runcount overflow\"));\t\t\\\n\tCTR0(KTR_EVH, \"eventhandler_invoke(\\\"\" __STRING(name) \"\\\")\");\t\\\n\tTAILQ_FOREACH(_ep, &((list)->el_entries), ee_link) {\t\t\\\n\t\tif (_ep->ee_priority != EHE_DEAD_PRIORITY) {\t\t\\\n\t\t\tEHL_UNLOCK((list));\t\t\t\t\\\n\t\t\t_t = (struct eventhandler_entry_ ## name *)_ep;\t\\\n\t\t\tCTR1(KTR_EVH, \"eventhandler_invoke: executing %p\", \\\n \t\t\t    (void *)_t->eh_func);\t\t\t\\\n\t\t\t_t->eh_func(_ep->ee_arg , ## __VA_ARGS__);\t\\\n\t\t\tEHL_LOCK((list));\t\t\t\t\\\n\t\t}\t\t\t\t\t\t\t\\\n\t}\t\t\t\t\t\t\t\t\\\n\tKASSERT((list)->el_runcount > 0,\t\t\t\t\\\n\t    (\"eventhandler_invoke: runcount underflow\"));\t\t\\\n\t(list)->el_runcount--;\t\t\t\t\t\t\\\n\tif ((list)->el_runcount == 0)\t\t\t\t\t\\\n\t\teventhandler_prune_list(list);\t\t\t\t\\\n\tEHL_UNLOCK((list));\t\t\t\t\t\t\\\n} while (0)\n\n/*\n * Slow handlers are entirely dynamic; lists are created\n * when entries are added to them, and thus have no concept of \"owner\",\n *\n * Slow handlers need to be declared, but do not need to be defined. The\n * declaration must be in scope wherever the handler is to be invoked.\n */\n#define EVENTHANDLER_DECLARE(name, type)\t\t\t\t\\\nstruct eventhandler_entry_ ## name \t\t\t\t\t\\\n{\t\t\t\t\t\t\t\t\t\\\n\tstruct eventhandler_entry\tee;\t\t\t\t\\\n\ttype\t\t\t\teh_func;\t\t\t\\\n};\t\t\t\t\t\t\t\t\t\\\nstruct __hack\n\n#define EVENTHANDLER_DEFINE(name, func, arg, priority)\t\t\t\\\n\tstatic eventhandler_tag name ## _tag;\t\t\t\t\\\n\tstatic void name ## _evh_init(void *ctx)\t\t\t\\\n\t{\t\t\t\t\t\t\t\t\\\n\t\tname ## _tag = EVENTHANDLER_REGISTER(name, func, ctx,\t\\\n\t\t    priority);\t\t\t\t\t\t\\\n\t}\t\t\t\t\t\t\t\t\\\n\tSYSINIT(name ## _evh_init, SI_SUB_CONFIGURE, SI_ORDER_ANY,\t\\\n\t    name ## _evh_init, arg);\t\t\t\t\t\\\n\tstruct __hack\n\n#define EVENTHANDLER_INVOKE(name, ...)\t\t\t\t\t\\\ndo {\t\t\t\t\t\t\t\t\t\\\n\tstruct eventhandler_list *_el;\t\t\t\t\t\\\n\t\t\t\t\t\t\t\t\t\\\n\tif ((_el = eventhandler_find_list(#name)) != NULL) \t\t\\\n\t\t_EVENTHANDLER_INVOKE(name, _el , ## __VA_ARGS__);\t\\\n} while (0)\n\n#define EVENTHANDLER_REGISTER(name, func, arg, priority)\t\t\\\n\teventhandler_register(NULL, #name, func, arg, priority)\n\n#define EVENTHANDLER_DEREGISTER(name, tag) \t\t\t\t\\\ndo {\t\t\t\t\t\t\t\t\t\\\n\tstruct eventhandler_list *_el;\t\t\t\t\t\\\n\t\t\t\t\t\t\t\t\t\\\n\tif ((_el = eventhandler_find_list(#name)) != NULL)\t\t\\\n\t\teventhandler_deregister(_el, tag);\t\t\t\\\n} while(0)\n\t\n\neventhandler_tag eventhandler_register(struct eventhandler_list *list, \n\t    const char *name, void *func, void *arg, int priority);\nvoid\teventhandler_deregister(struct eventhandler_list *list,\n\t    eventhandler_tag tag);\nstruct eventhandler_list *eventhandler_find_list(const char *name);\nvoid\teventhandler_prune_list(struct eventhandler_list *list);\n\n#ifdef VIMAGE\ntypedef\tvoid (*vimage_iterator_func_t)(void *, ...);\n\neventhandler_tag vimage_eventhandler_register(struct eventhandler_list *list,\n\t    const char *name, void *func, void *arg, int priority,\n\t    vimage_iterator_func_t);\n#endif\n\n/*\n * Standard system event queues.\n */\n\n/* Generic priority levels */\n#define\tEVENTHANDLER_PRI_FIRST\t0\n#define\tEVENTHANDLER_PRI_ANY\t10000\n#define\tEVENTHANDLER_PRI_LAST\t20000\n\n/* Shutdown events */\ntypedef void (*shutdown_fn)(void *, int);\n\n#define\tSHUTDOWN_PRI_FIRST\tEVENTHANDLER_PRI_FIRST\n#define\tSHUTDOWN_PRI_DEFAULT\tEVENTHANDLER_PRI_ANY\n#define\tSHUTDOWN_PRI_LAST\tEVENTHANDLER_PRI_LAST\n\nEVENTHANDLER_DECLARE(shutdown_pre_sync, shutdown_fn);\t/* before fs sync */\nEVENTHANDLER_DECLARE(shutdown_post_sync, shutdown_fn);\t/* after fs sync */\nEVENTHANDLER_DECLARE(shutdown_final, shutdown_fn);\n\n/* Power state change events */\ntypedef void (*power_change_fn)(void *);\nEVENTHANDLER_DECLARE(power_resume, power_change_fn);\nEVENTHANDLER_DECLARE(power_suspend, power_change_fn);\n\n/* Low memory event */\ntypedef void (*vm_lowmem_handler_t)(void *, int);\n#define\tLOWMEM_PRI_DEFAULT\tEVENTHANDLER_PRI_FIRST\nEVENTHANDLER_DECLARE(vm_lowmem, vm_lowmem_handler_t);\n\n/* Root mounted event */\ntypedef void (*mountroot_handler_t)(void *);\nEVENTHANDLER_DECLARE(mountroot, mountroot_handler_t);\n\n/* VLAN state change events */\nstruct ifnet;\ntypedef void (*vlan_config_fn)(void *, struct ifnet *, uint16_t);\ntypedef void (*vlan_unconfig_fn)(void *, struct ifnet *, uint16_t);\nEVENTHANDLER_DECLARE(vlan_config, vlan_config_fn);\nEVENTHANDLER_DECLARE(vlan_unconfig, vlan_unconfig_fn);\n\n/* BPF attach/detach events */\nstruct ifnet;\ntypedef void (*bpf_track_fn)(void *, struct ifnet *, int /* dlt */,\n    int /* 1 =>'s attach */);\nEVENTHANDLER_DECLARE(bpf_track, bpf_track_fn);\n\n/*\n * Process events\n * process_fork and exit handlers are called without Giant.\n * exec handlers are called with Giant, but that is by accident.\n */\nstruct proc;\nstruct image_params;\n\ntypedef void (*exitlist_fn)(void *, struct proc *);\ntypedef void (*forklist_fn)(void *, struct proc *, struct proc *, int);\ntypedef void (*execlist_fn)(void *, struct proc *, struct image_params *);\ntypedef void (*proc_ctor_fn)(void *, struct proc *);\ntypedef void (*proc_dtor_fn)(void *, struct proc *);\ntypedef void (*proc_init_fn)(void *, struct proc *);\ntypedef void (*proc_fini_fn)(void *, struct proc *);\nEVENTHANDLER_DECLARE(process_ctor, proc_ctor_fn);\nEVENTHANDLER_DECLARE(process_dtor, proc_dtor_fn);\nEVENTHANDLER_DECLARE(process_init, proc_init_fn);\nEVENTHANDLER_DECLARE(process_fini, proc_fini_fn);\nEVENTHANDLER_DECLARE(process_exit, exitlist_fn);\nEVENTHANDLER_DECLARE(process_fork, forklist_fn);\nEVENTHANDLER_DECLARE(process_exec, execlist_fn);\n\n/*\n * application dump event\n */\nstruct thread;\ntypedef void (*app_coredump_start_fn)(void *, struct thread *, char *name);\ntypedef void (*app_coredump_progress_fn)(void *, struct thread *td, int byte_count);\ntypedef void (*app_coredump_finish_fn)(void *, struct thread *td);\ntypedef void (*app_coredump_error_fn)(void *, struct thread *td, char *msg, ...);\n\nEVENTHANDLER_DECLARE(app_coredump_start, app_coredump_start_fn);\nEVENTHANDLER_DECLARE(app_coredump_progress, app_coredump_progress_fn);\nEVENTHANDLER_DECLARE(app_coredump_finish, app_coredump_finish_fn);\nEVENTHANDLER_DECLARE(app_coredump_error, app_coredump_error_fn);\n\ntypedef void (*thread_ctor_fn)(void *, struct thread *);\ntypedef void (*thread_dtor_fn)(void *, struct thread *);\ntypedef void (*thread_fini_fn)(void *, struct thread *);\ntypedef void (*thread_init_fn)(void *, struct thread *);\nEVENTHANDLER_DECLARE(thread_ctor, thread_ctor_fn);\nEVENTHANDLER_DECLARE(thread_dtor, thread_dtor_fn);\nEVENTHANDLER_DECLARE(thread_init, thread_init_fn);\nEVENTHANDLER_DECLARE(thread_fini, thread_fini_fn);\n\ntypedef void (*uma_zone_chfn)(void *);\nEVENTHANDLER_DECLARE(nmbclusters_change, uma_zone_chfn);\nEVENTHANDLER_DECLARE(maxsockets_change, uma_zone_chfn);\n\n#endif /* SYS_EVENTHANDLER_H */\n"
  },
  {
    "path": "freebsd-headers/sys/eventvar.h",
    "content": "/*-\n * Copyright (c) 1999,2000 Jonathan Lemon <jlemon@FreeBSD.org>\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t$FreeBSD: release/9.0.0/sys/sys/eventvar.h 133741 2004-08-15 06:24:42Z jmg $\n */\n\n#ifndef _SYS_EVENTVAR_H_\n#define _SYS_EVENTVAR_H_\n\n#ifndef _KERNEL\n#error \"no user-servicable parts inside\"\n#endif\n\n#include <sys/_task.h>\n\n#define KQ_NEVENTS\t8\t\t/* minimize copy{in,out} calls */\n#define KQEXTENT\t256\t\t/* linear growth by this amount */\n\nstruct kqueue {\n\tstruct\t\tmtx kq_lock;\n\tint\t\tkq_refcnt;\n\tSLIST_ENTRY(kqueue)\tkq_list;\n\tTAILQ_HEAD(, knote)\tkq_head;\t/* list of pending event */\n\tint\t\tkq_count;\t\t/* number of pending events */\n\tstruct\t\tselinfo kq_sel;\n\tstruct\t\tsigio *kq_sigio;\n\tstruct\t\tfiledesc *kq_fdp;\n\tint\t\tkq_state;\n#define KQ_SEL\t\t0x01\n#define KQ_SLEEP\t0x02\n#define KQ_FLUXWAIT\t0x04\t\t\t/* waiting for a in flux kn */\n#define KQ_ASYNC\t0x08\n#define KQ_CLOSING\t0x10\n#define\tKQ_TASKSCHED\t0x20\t\t\t/* task scheduled */\n#define\tKQ_TASKDRAIN\t0x40\t\t\t/* waiting for task to drain */\n\tint\t\tkq_knlistsize;\t\t/* size of knlist */\n\tstruct\t\tklist *kq_knlist;\t/* list of knotes */\n\tu_long\t\tkq_knhashmask;\t\t/* size of knhash */\n\tstruct\t\tklist *kq_knhash;\t/* hash table for knotes */\n\tstruct\t\ttask kq_task;\n};\n\n#endif /* !_SYS_EVENTVAR_H_ */\n"
  },
  {
    "path": "freebsd-headers/sys/exec.h",
    "content": "/*-\n * Copyright (c) 1992, 1993\n *\tThe Regents of the University of California.  All rights reserved.\n * (c) UNIX System Laboratories, Inc.\n * All or some portions of this file are derived from material licensed\n * to the University of California by American Telephone and Telegraph\n * Co. or Unix System Laboratories, Inc. and are reproduced herein with\n * the permission of UNIX System Laboratories, Inc.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 4. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t@(#)exec.h\t8.3 (Berkeley) 1/21/94\n * $FreeBSD: release/9.0.0/sys/sys/exec.h 213716 2010-10-12 09:18:17Z kib $\n */\n\n#ifndef _SYS_EXEC_H_\n#define _SYS_EXEC_H_\n\n/*\n * The following structure is found at the top of the user stack of each\n * user process. The ps program uses it to locate argv and environment\n * strings. Programs that wish ps to display other information may modify\n * it; normally ps_argvstr points to the argv vector, and ps_nargvstr\n * is the same as the program's argc. The fields ps_envstr and ps_nenvstr\n * are the equivalent for the environment.\n */\nstruct ps_strings {\n\tchar\t**ps_argvstr;\t/* first of 0 or more argument strings */\n\tunsigned int ps_nargvstr; /* the number of argument strings */\n\tchar\t**ps_envstr;\t/* first of 0 or more environment strings */\n\tunsigned int ps_nenvstr; /* the number of environment strings */\n};\n\n/*\n * Address of ps_strings structure (in user space).\n */\n#define\tPS_STRINGS\t(USRSTACK - sizeof(struct ps_strings))\n#define SPARE_USRSPACE\t4096\n\nstruct image_params;\n\nstruct execsw {\n\tint (*ex_imgact)(struct image_params *);\n\tconst char *ex_name;\n};\n\n#include <machine/exec.h>\n\n#ifdef _KERNEL\n#include <sys/cdefs.h>\n\nint exec_map_first_page(struct image_params *);        \nvoid exec_unmap_first_page(struct image_params *);       \n\nint exec_register(const struct execsw *);\nint exec_unregister(const struct execsw *);\n\n/*\n * note: name##_mod cannot be const storage because the\n * linker_file_sysinit() function modifies _file in the\n * moduledata_t.\n */\n\n#include <sys/module.h>\n\n#define EXEC_SET(name, execsw_arg) \\\n\tstatic int __CONCAT(name,_modevent)(module_t mod, int type, \\\n\t    void *data) \\\n\t{ \\\n\t\tstruct execsw *exec = (struct execsw *)data; \\\n\t\tint error = 0; \\\n\t\tswitch (type) { \\\n\t\tcase MOD_LOAD: \\\n\t\t\t/* printf(#name \" module loaded\\n\"); */ \\\n\t\t\terror = exec_register(exec); \\\n\t\t\tif (error) \\\n\t\t\t\tprintf(__XSTRING(name) \"register failed\\n\"); \\\n\t\t\tbreak; \\\n\t\tcase MOD_UNLOAD: \\\n\t\t\t/* printf(#name \" module unloaded\\n\"); */ \\\n\t\t\terror = exec_unregister(exec); \\\n\t\t\tif (error) \\\n\t\t\t\tprintf(__XSTRING(name) \" unregister failed\\n\");\\\n\t\t\tbreak; \\\n\t\tdefault: \\\n\t\t\terror = EOPNOTSUPP; \\\n\t\t\tbreak; \\\n\t\t} \\\n\t\treturn error; \\\n\t} \\\n\tstatic moduledata_t __CONCAT(name,_mod) = { \\\n\t\t__XSTRING(name), \\\n\t\t__CONCAT(name,_modevent), \\\n\t\t(void *)& execsw_arg \\\n\t}; \\\n\tDECLARE_MODULE_TIED(name, __CONCAT(name,_mod), SI_SUB_EXEC, \\\n\t    SI_ORDER_ANY)\n#endif\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/sys/extattr.h",
    "content": "/*-\n * Copyright (c) 1999-2001 Robert N. M. Watson\n * All rights reserved.\n *\n * This software was developed by Robert Watson for the TrustedBSD Project.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/sys/extattr.h 184413 2008-10-28 13:44:11Z trasz $\n */\n/*\n * Developed by the TrustedBSD Project.\n * Support for extended filesystem attributes.\n */\n\n#ifndef _SYS_EXTATTR_H_\n#define\t_SYS_EXTATTR_H_\n\n/*\n * Defined name spaces for extended attributes.  Numeric constants are passed\n * via system calls, but a user-friendly string is also defined.\n */\n#define\tEXTATTR_NAMESPACE_EMPTY\t\t0x00000000\n#define\tEXTATTR_NAMESPACE_EMPTY_STRING\t\"empty\"\n#define\tEXTATTR_NAMESPACE_USER\t\t0x00000001\n#define\tEXTATTR_NAMESPACE_USER_STRING\t\"user\"\n#define\tEXTATTR_NAMESPACE_SYSTEM\t0x00000002\n#define\tEXTATTR_NAMESPACE_SYSTEM_STRING\t\"system\"\n\n/*\n * The following macro is designed to initialize an array that maps\n * extended-attribute namespace values to their names, e.g.:\n *\n * char *extattr_namespace_names[] = EXTATTR_NAMESPACE_NAMES;\n */\n#define EXTATTR_NAMESPACE_NAMES { \\\n\tEXTATTR_NAMESPACE_EMPTY_STRING, \\\n\tEXTATTR_NAMESPACE_USER_STRING, \\\n\tEXTATTR_NAMESPACE_SYSTEM_STRING }\n\n#ifdef _KERNEL\n#include <sys/types.h>\n\n#define\tEXTATTR_MAXNAMELEN\tNAME_MAX\nstruct thread;\nstruct ucred;\nstruct vnode;\nint\textattr_check_cred(struct vnode *vp, int attrnamespace,\n\t    struct ucred *cred, struct thread *td, accmode_t accmode);\n\n#else\n#include <sys/cdefs.h>\n\nstruct iovec;\n\n__BEGIN_DECLS\nint\textattrctl(const char *_path, int _cmd, const char *_filename,\n\t    int _attrnamespace, const char *_attrname);\nint\textattr_delete_fd(int _fd, int _attrnamespace, const char *_attrname);\nint\textattr_delete_file(const char *_path, int _attrnamespace,\n\t    const char *_attrname);\nint\textattr_delete_link(const char *_path, int _attrnamespace,\n\t    const char *_attrname);\nssize_t\textattr_get_fd(int _fd, int _attrnamespace, const char *_attrname,\n\t    void *_data, size_t _nbytes);\nssize_t\textattr_get_file(const char *_path, int _attrnamespace,\n\t    const char *_attrname, void *_data, size_t _nbytes);\nssize_t\textattr_get_link(const char *_path, int _attrnamespace,\n\t    const char *_attrname, void *_data, size_t _nbytes);\nssize_t\textattr_list_fd(int _fd, int _attrnamespace, void *_data,\n\t    size_t _nbytes);\nssize_t\textattr_list_file(const char *_path, int _attrnamespace, void *_data,\n\t    size_t _nbytes);\nssize_t\textattr_list_link(const char *_path, int _attrnamespace, void *_data,\n\t    size_t _nbytes);\nint\textattr_set_fd(int _fd, int _attrnamespace, const char *_attrname,\n\t    const void *_data, size_t _nbytes);\nint\textattr_set_file(const char *_path, int _attrnamespace,\n\t    const char *_attrname, const void *_data, size_t _nbytes);\nint\textattr_set_link(const char *_path, int _attrnamespace,\n\t    const char *_attrname, const void *_data, size_t _nbytes);\n__END_DECLS\n\n#endif /* !_KERNEL */\n#endif /* !_SYS_EXTATTR_H_ */\n"
  },
  {
    "path": "freebsd-headers/sys/fail.h",
    "content": "/*-\n * Copyright (c) 2009 Isilon Inc http://www.isilon.com/\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/sys/fail.h 216620 2010-12-21 18:23:03Z mdf $\n */\n/**\n * @file\n *\n * Main header for failpoint facility.\n */\n#ifndef _SYS_FAIL_H_\n#define _SYS_FAIL_H_\n\n#include <sys/param.h>\n#include <sys/cdefs.h>\n#include <sys/linker_set.h>\n#include <sys/queue.h>\n#include <sys/sysctl.h>\n\n/**\n * Failpoint return codes, used internally.\n * @ingroup failpoint_private\n */\nenum fail_point_return_code {\n\tFAIL_POINT_RC_CONTINUE = 0,\t/**< Continue with normal execution */\n\tFAIL_POINT_RC_RETURN,\t\t/**< FP evaluated to 'return' */\n\tFAIL_POINT_RC_QUEUED,\t\t/**< sleep_fn will be called */\n};\n\nstruct fail_point_entry;\nTAILQ_HEAD(fail_point_entries, fail_point_entry);\n/**\n * Internal failpoint structure, tracking all the current details of the\n * failpoint.  This structure is the core component shared between the\n * failure-injection code and the user-interface.\n * @ingroup failpoint_private\n */\nstruct fail_point {\n\tconst char *fp_name;\t\t/**< name of fail point */\n\tconst char *fp_location;\t/**< file:line of fail point */\n\tstruct fail_point_entries fp_entries;\t/**< list of entries */\n\tint fp_flags;\n\tvoid (*fp_sleep_fn)(void *);\t/**< Function to call at end of\n\t\t\t\t\t * sleep for sleep failpoints */\n\tvoid *fp_sleep_arg;\t\t/**< Arg for sleep_fn */\n};\n\n#define\tFAIL_POINT_DYNAMIC_NAME\t0x01\t/**< Must free name on destroy */\n\n__BEGIN_DECLS\n\n/* Private failpoint eval function -- use fail_point_eval() instead. */\nenum fail_point_return_code fail_point_eval_nontrivial(struct fail_point *,\n\tint *ret);\n\n/**\n * @addtogroup failpoint\n * @{\n */\n/*\n * Initialize a fail-point.  The name is formed in printf-like fashion\n * from \"fmt\" and the subsequent arguments.\n * Pair with fail_point_destroy().\n */\nvoid fail_point_init(struct fail_point *, const char *fmt, ...)\n    __printflike(2, 3);\n\n/**\n * Set the sleep function for a fail point\n * If sleep_fn is specified, then FAIL_POINT_SLEEP will result in a\n * (*fp->sleep_fn)(fp->sleep_arg) call by the timer thread.  Otherwise,\n * if sleep_fn is NULL (default), then FAIL_POINT_SLEEP will result in the\n * fail_point_eval() call sleeping.\n */\nstatic __inline void\nfail_point_sleep_set_func(struct fail_point *fp, void (*sleep_fn)(void *))\n{\n\tfp->fp_sleep_fn = sleep_fn;\n}\n\n/**\n * Set the argument for the sleep function for a fail point\n */\nstatic __inline void\nfail_point_sleep_set_arg(struct fail_point *fp, void *sleep_arg)\n{\n\tfp->fp_sleep_arg = sleep_arg;\n}\n\n/**\n * Free the resources used by a fail-point.  Pair with fail_point_init().\n */\nvoid fail_point_destroy(struct fail_point *);\n\n/**\n * Evaluate a failpoint.\n */\nstatic __inline enum fail_point_return_code\nfail_point_eval(struct fail_point *fp, int *ret)\n{\n\tif (TAILQ_EMPTY(&fp->fp_entries)) {\n\t\treturn (FAIL_POINT_RC_CONTINUE);\n\t}\n\treturn (fail_point_eval_nontrivial(fp, ret));\n}\n\n__END_DECLS\n\n/* Declare a fail_point and its sysctl in a function. */\n#define\t_FAIL_POINT_NAME(name)\t_fail_point_##name\n#define\t_FAIL_POINT_LOCATION()\t\"(\" __FILE__ \":\" __XSTRING(__LINE__) \")\"\n\n/**\n * Instantiate a failpoint which returns \"value\" from the function when triggered.\n * @param parent  The parent sysctl under which to locate the sysctl\n * @param name    The name of the failpoint in the sysctl tree (and printouts)\n * @return        Instantly returns the return(\"value\") specified in the\n *                failpoint, if triggered.\n */\n#define KFAIL_POINT_RETURN(parent, name) \\\n\tKFAIL_POINT_CODE(parent, name, return RETURN_VALUE)\n\n/**\n * Instantiate a failpoint which returns (void) from the function when triggered.\n * @param parent  The parent sysctl under which to locate the sysctl\n * @param name    The name of the failpoint in the sysctl tree (and printouts)\n * @return        Instantly returns void, if triggered in the failpoint.\n */\n#define KFAIL_POINT_RETURN_VOID(parent, name) \\\n\tKFAIL_POINT_CODE(parent, name, return)\n\n/**\n * Instantiate a failpoint which sets an error when triggered.\n * @param parent     The parent sysctl under which to locate the sysctl\n * @param name       The name of the failpoint in the sysctl tree (and printouts)\n * @param error_var  A variable to set to the failpoint's specified\n *                   return-value when triggered\n */\n#define KFAIL_POINT_ERROR(parent, name, error_var) \\\n\tKFAIL_POINT_CODE(parent, name, (error_var) = RETURN_VALUE)\n\n/**\n * Instantiate a failpoint which sets an error and then goes to a\n * specified label in the function when triggered.\n * @param parent     The parent sysctl under which to locate the sysctl\n * @param name       The name of the failpoint in the sysctl tree (and printouts)\n * @param error_var  A variable to set to the failpoint's specified\n *                   return-value when triggered\n * @param label      The location to goto when triggered.\n */\n#define KFAIL_POINT_GOTO(parent, name, error_var, label) \\\n\tKFAIL_POINT_CODE(parent, name, (error_var) = RETURN_VALUE; goto label)\n\n/**\n * Instantiate a failpoint which runs arbitrary code when triggered.\n * @param parent     The parent sysctl under which to locate the sysctl\n * @param name       The name of the failpoint in the sysctl tree\n *\t\t     (and printouts)\n * @param code       The arbitrary code to run when triggered.  Can reference\n *                   \"RETURN_VALUE\" if desired to extract the specified\n *                   user return-value when triggered.  Note that this is\n *                   implemented with a do-while loop so be careful of\n *                   break and continue statements.\n */\n#define KFAIL_POINT_CODE(parent, name, code)\t\t\t\t\\\ndo {\t\t\t\t\t\t\t\t\t\\\n\tint RETURN_VALUE;\t\t\t\t\t\t\\\n\tstatic struct fail_point _FAIL_POINT_NAME(name) = {\t\t\\\n\t\t#name,\t\t\t\t\t\t\t\\\n\t\t_FAIL_POINT_LOCATION(),\t\t\t\t\t\\\n\t\tTAILQ_HEAD_INITIALIZER(_FAIL_POINT_NAME(name).fp_entries), \\\n\t\t0,\t\t\t\t\t\t\t\\\n\t\tNULL, NULL,\t\t\t\t\t\t\\\n\t};\t\t\t\t\t\t\t\t\\\n\tSYSCTL_OID(parent, OID_AUTO, name,\t\t\t\t\\\n\t    CTLTYPE_STRING | CTLFLAG_RW | CTLFLAG_MPSAFE,\t\t\\\n\t    &_FAIL_POINT_NAME(name), 0, fail_point_sysctl,\t\t\\\n\t    \"A\", \"\");\t\t\t\t\t\t\t\\\n\t\t\t\t\t\t\t\t\t\\\n\tif (__predict_false(\t\t\t\t\t\t\\\n\t    fail_point_eval(&_FAIL_POINT_NAME(name), &RETURN_VALUE))) {\t\\\n\t\t\t\t\t\t\t\t\t\\\n\t\tcode;\t\t\t\t\t\t\t\\\n\t\t\t\t\t\t\t\t\t\\\n\t}\t\t\t\t\t\t\t\t\\\n} while (0)\n\n\n/**\n * @}\n * (end group failpoint)\n */\n\n#ifdef _KERNEL\nint fail_point_sysctl(SYSCTL_HANDLER_ARGS);\n\n/* The fail point sysctl tree. */\nSYSCTL_DECL(_debug_fail_point);\n#define\tDEBUG_FP\t_debug_fail_point\n#endif\n\n#endif /* _SYS_FAIL_H_ */\n"
  },
  {
    "path": "freebsd-headers/sys/fbio.h",
    "content": "/*-\n * Copyright (c) 1992, 1993\n *\tThe Regents of the University of California.  All rights reserved.\n *\n * This code is derived from software developed by the Computer Systems\n * Engineering group at Lawrence Berkeley Laboratory under DARPA\n * contract BG 91-66 and contributed to Berkeley.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 4. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t@(#)fbio.h\t8.2 (Berkeley) 10/30/93\n *\n * $FreeBSD: release/9.0.0/sys/sys/fbio.h 204265 2010-02-23 21:51:14Z jkim $\n */\n\n#ifndef _SYS_FBIO_H_\n#define _SYS_FBIO_H_\n\n#ifndef _KERNEL\n#include <sys/types.h>\n#endif\n#include <sys/ioccom.h>\n\n/*\n * Frame buffer ioctls (from Sprite, trimmed to essentials for X11).\n */\n\n/*\n * Frame buffer type codes.\n */\n#define\tFBTYPE_SUN1BW\t\t0\t/* multibus mono */\n#define\tFBTYPE_SUN1COLOR\t1\t/* multibus color */\n#define\tFBTYPE_SUN2BW\t\t2\t/* memory mono */\n#define\tFBTYPE_SUN2COLOR\t3\t/* color w/rasterop chips */\n#define\tFBTYPE_SUN2GP\t\t4\t/* GP1/GP2 */\n#define\tFBTYPE_SUN5COLOR\t5\t/* RoadRunner accelerator */\n#define\tFBTYPE_SUN3COLOR\t6\t/* memory color */\n#define\tFBTYPE_MEMCOLOR\t\t7\t/* memory 24-bit */\n#define\tFBTYPE_SUN4COLOR\t8\t/* memory color w/overlay */\n\n#define\tFBTYPE_NOTSUN1\t\t9\t/* reserved for customer */\n#define\tFBTYPE_NOTSUN2\t\t10\t/* reserved for customer */\n#define\tFBTYPE_PCIMISC\t\t11\t/* (generic) PCI misc. disp. */\n\n#define\tFBTYPE_SUNFAST_COLOR\t12\t/* accelerated 8bit */\n#define\tFBTYPE_SUNROP_COLOR\t13\t/* MEMCOLOR with rop h/w */\n#define\tFBTYPE_SUNFB_VIDEO\t14\t/* Simple video mixing */\n#define\tFBTYPE_RESERVED5\t15\t/* reserved, do not use */\n#define\tFBTYPE_RESERVED4\t16\t/* reserved, do not use */\n#define\tFBTYPE_SUNGP3\t\t17\n#define\tFBTYPE_SUNGT\t\t18\n#define\tFBTYPE_SUNLEO\t\t19\t/* zx Leo */\n\n#define\tFBTYPE_MDA\t\t20\n#define\tFBTYPE_HERCULES\t\t21\n#define\tFBTYPE_CGA\t\t22\n#define\tFBTYPE_EGA\t\t23\n#define\tFBTYPE_VGA\t\t24\n#define\tFBTYPE_PC98\t\t25\n#define\tFBTYPE_TGA\t\t26\n#define\tFBTYPE_TGA2\t\t27\n\n#define\tFBTYPE_MDICOLOR\t\t28\t/* cg14 */\n#define\tFBTYPE_TCXCOLOR\t\t29\t/* SUNW,tcx */\n#define\tFBTYPE_CREATOR\t\t30\n\n#define\tFBTYPE_LASTPLUSONE\t31\t/* max number of fbs (change as add) */\n\n/*\n * Frame buffer descriptor as returned by FBIOGTYPE.\n */\nstruct fbtype {\n\tint\tfb_type;\t/* as defined above */\n\tint\tfb_height;\t/* in pixels */\n\tint\tfb_width;\t/* in pixels */\n\tint\tfb_depth;\t/* bits per pixel */\n\tint\tfb_cmsize;\t/* size of color map (entries) */\n\tint\tfb_size;\t/* total size in bytes */\n};\n#define\tFBIOGTYPE\t_IOR('F', 0, struct fbtype)\n\n#ifdef notdef\n/*\n * General purpose structure for passing info in and out of frame buffers\n * (used for gp1) -- unsupported.\n */\nstruct fbinfo {\n\tint\tfb_physaddr;\t/* physical frame buffer address */\n\tint\tfb_hwwidth;\t/* fb board width */\n\tint\tfb_hwheight;\t/* fb board height */\n\tint\tfb_addrdelta;\t/* phys addr diff between boards */\n\tu_char\t*fb_ropaddr;\t/* fb virtual addr */\n\tint\tfb_unit;\t/* minor devnum of fb */\n};\n#define\tFBIOGINFO\t_IOR('F', 2, struct fbinfo)\n#endif\n\n/*\n * Color map I/O.\n */\nstruct fbcmap {\n\tint\tindex;\t\t/* first element (0 origin) */\n\tint\tcount;\t\t/* number of elements */\n\tu_char\t*red;\t\t/* red color map elements */\n\tu_char\t*green;\t\t/* green color map elements */\n\tu_char\t*blue;\t\t/* blue color map elements */\n};\n#define\tFBIOPUTCMAP\t_IOW('F', 3, struct fbcmap)\n#define\tFBIOGETCMAP\t_IOW('F', 4, struct fbcmap)\n\n/*\n * Set/get attributes.\n */\n#define\tFB_ATTR_NDEVSPECIFIC\t8\t/* no. of device specific values */\n#define\tFB_ATTR_NEMUTYPES\t4\t/* no. of emulation types */\n\nstruct fbsattr {\n\tint\tflags;\t\t\t/* flags; see below */\n\tint\temu_type;\t\t/* emulation type (-1 if unused) */\n\tint\tdev_specific[FB_ATTR_NDEVSPECIFIC];\t/* catchall */\n};\n#define\tFB_ATTR_AUTOINIT\t1\t/* emulation auto init flag */\n#define\tFB_ATTR_DEVSPECIFIC\t2\t/* dev. specific stuff valid flag */\n\nstruct fbgattr {\n\tint\treal_type;\t\t/* real device type */\n\tint\towner;\t\t\t/* PID of owner, 0 if myself */\n\tstruct\tfbtype fbtype;\t\t/* fbtype info for real device */\n\tstruct\tfbsattr sattr;\t\t/* see above */\n\tint\temu_types[FB_ATTR_NEMUTYPES];\t/* possible emulations */\n\t\t\t\t\t\t/* (-1 if unused) */\n};\n#define\tFBIOSATTR\t_IOW('F', 5, struct fbsattr)\n#define\tFBIOGATTR\t_IOR('F', 6, struct fbgattr)\n\n/*\n * Video control.\n */\n#define\tFBVIDEO_OFF\t\t0\n#define\tFBVIDEO_ON\t\t1\n\n#define\tFBIOSVIDEO\t_IOW('F', 7, int)\n#define\tFBIOGVIDEO\t_IOR('F', 8, int)\n\n/* vertical retrace */\n#define\tFBIOVERTICAL\t_IO('F', 9)\n\n/*\n * Hardware cursor control (for, e.g., CG6).  A rather complex and icky\n * interface that smells like VMS, but there it is....\n */\nstruct fbcurpos {\n\tshort\tx;\n\tshort\ty;\n};\n\nstruct fbcursor {\n\tshort\tset;\t\t/* flags; see below */\n\tshort\tenable;\t\t/* nonzero => cursor on, 0 => cursor off */\n\tstruct\tfbcurpos pos;\t/* position on display */\n\tstruct\tfbcurpos hot;\t/* hot-spot within cursor */\n\tstruct\tfbcmap cmap;\t/* cursor color map */\n\tstruct\tfbcurpos size;\t/* number of valid bits in image & mask */\n\tcaddr_t\timage;\t\t/* cursor image bits */\n\tcaddr_t\tmask;\t\t/* cursor mask bits */\n};\n#define\tFB_CUR_SETCUR\t0x01\t/* set on/off (i.e., obey fbcursor.enable) */\n#define\tFB_CUR_SETPOS\t0x02\t/* set position */\n#define\tFB_CUR_SETHOT\t0x04\t/* set hot-spot */\n#define\tFB_CUR_SETCMAP\t0x08\t/* set cursor color map */\n#define\tFB_CUR_SETSHAPE\t0x10\t/* set size & bits */\n#define\tFB_CUR_SETALL\t(FB_CUR_SETCUR | FB_CUR_SETPOS | FB_CUR_SETHOT | \\\n\t\t\t FB_CUR_SETCMAP | FB_CUR_SETSHAPE)\n\n/* controls for cursor attributes & shape (including position) */\n#define\tFBIOSCURSOR\t_IOW('F', 24, struct fbcursor)\n#define\tFBIOGCURSOR\t_IOWR('F', 25, struct fbcursor)\n\n/* controls for cursor position only */\n#define\tFBIOSCURPOS\t_IOW('F', 26, struct fbcurpos)\n#define\tFBIOGCURPOS\t_IOW('F', 27, struct fbcurpos)\n\n/* get maximum cursor size */\n#define\tFBIOGCURMAX\t_IOR('F', 28, struct fbcurpos)\n\n/*\n * Video board information\n */\nstruct brd_info {\n\tu_short\t\taccessible_width; /* accessible bytes in scanline */\n\tu_short\t\taccessible_height; /* number of accessible scanlines */\n\tu_short\t\tline_bytes;\t/* number of bytes/scanline */\n\tu_short\t\thdb_capable;\t/* can this thing hardware db? */\n\tu_short\t\tvmsize;\t\t/* video memory size */\n\tu_char\t\tboardrev;\t/* board revision # */\n\tu_char\t\tpad0;\n\tu_long\t\tpad1;\n};\n#define\tFBIOGXINFO\t_IOR('F', 39, struct brd_info)\n\n/*\n * Monitor information\n */\nstruct mon_info {\n\tu_long\t\tmon_type;\t/* bit array */\n#define MON_TYPE_STEREO\t\t0x8\t/* stereo display */\n#define MON_TYPE_0_OFFSET\t0x4\t/* black level 0 ire instead of 7.5 */\n#define MON_TYPE_OVERSCAN\t0x2\t/* overscan */\n#define MON_TYPE_GRAY\t\t0x1\t/* greyscale monitor */\n\tu_long\t\tpixfreq;\t/* pixel frequency in Hz */\n\tu_long\t\thfreq;\t\t/* horizontal freq in Hz */\n\tu_long\t\tvfreq;\t\t/* vertical freq in Hz */\n\tu_long\t\tvsync;\t\t/* vertical sync in scanlines */\n\tu_long\t\thsync;\t\t/* horizontal sync in pixels */\n\t/* these are in pixel units */\n\tu_short\t\thfporch;\t/* horizontal front porch */\n\tu_short\t\thbporch;\t/* horizontal back porch */\n\tu_short\t\tvfporch;\t/* vertical front porch */\n\tu_short\t\tvbporch;\t/* vertical back porch */\n};\n#define\tFBIOMONINFO\t_IOR('F', 40, struct mon_info)\n\n/*\n * Color map I/O.\n */\nstruct fbcmap_i {\n\tunsigned int\tflags;\n#define\tFB_CMAP_BLOCK\t(1 << 0)\t/* wait for vertical refresh */\n#define\tFB_CMAP_KERNEL\t(1 << 1)\t/* called within kernel */\n\tint\t\tid;\t\t/* color map id */\n\tint\t\tindex;\t\t/* first element (0 origin) */\n\tint\t\tcount;\t\t/* number of elements */\n\tu_char\t\t*red;\t\t/* red color map elements */\n\tu_char\t\t*green;\t\t/* green color map elements */\n\tu_char\t\t*blue;\t\t/* blue color map elements */\n};\n#define\tFBIOPUTCMAPI\t_IOW('F', 41, struct fbcmap_i)\n#define\tFBIOGETCMAPI\t_IOW('F', 42, struct fbcmap_i)\n\n/* The new style frame buffer ioctls. */\n\n/* video mode information block */\nstruct video_info {\n    int\t\t\tvi_mode;\t/* mode number, see below */\n    int\t\t\tvi_flags;\n#define V_INFO_COLOR\t(1 << 0)\n#define V_INFO_GRAPHICS\t(1 << 1)\n#define V_INFO_LINEAR\t(1 << 2)\n#define V_INFO_VESA\t(1 << 3)\n#define\tV_INFO_NONVGA\t(1 << 4)\n    int\t\t\tvi_width;\n    int\t\t\tvi_height;\n    int\t\t\tvi_cwidth;\n    int\t\t\tvi_cheight;\n    int\t\t\tvi_depth;\n    int\t\t\tvi_planes;\n    vm_offset_t\t\tvi_window;\t/* physical address */\n    size_t\t\tvi_window_size;\n    size_t\t\tvi_window_gran;\n    vm_offset_t\t\tvi_buffer;\t/* physical address */\n    size_t\t\tvi_buffer_size;\n    int\t\t\tvi_mem_model;\n#define V_INFO_MM_OTHER  (-1)\n#define V_INFO_MM_TEXT\t 0\n#define V_INFO_MM_PLANAR 1\n#define V_INFO_MM_PACKED 2\n#define V_INFO_MM_DIRECT 3\n#define V_INFO_MM_CGA\t 100\n#define V_INFO_MM_HGC\t 101\n#define V_INFO_MM_VGAX\t 102\n    /* for MM_PACKED and MM_DIRECT only */\n    int\t\t\tvi_pixel_size;\t/* in bytes */\n    /* for MM_DIRECT only */\n    int\t\t\tvi_pixel_fields[4];\t/* RGB and reserved fields */\n    int\t\t\tvi_pixel_fsizes[4];\n    /* reserved */\n    u_char\t\tvi_reserved[64];\n    vm_offset_t\t\tvi_registers;\t/* physical address */\n    vm_offset_t\t\tvi_registers_size;\n};\ntypedef struct video_info video_info_t;\n\n/* adapter infromation block */\nstruct video_adapter {\n    int\t\t\tva_index;\n    int\t\t\tva_type;\n#define KD_OTHER\t0\t\t/* unknown */\n#define KD_MONO\t\t1\t\t/* monochrome adapter */\n#define KD_HERCULES\t2\t\t/* hercules adapter */\n#define KD_CGA\t\t3\t\t/* color graphics adapter */\n#define KD_EGA\t\t4\t\t/* enhanced graphics adapter */\n#define KD_VGA\t\t5\t\t/* video graphics adapter */\n#define KD_PC98\t\t6\t\t/* PC-98 display */\n#define KD_TGA\t\t7\t\t/* TGA */\n#define KD_TGA2\t\t8\t\t/* TGA2 */\n    char\t\t*va_name;\n    int\t\t\tva_unit;\n    int\t\t\tva_minor;\n    int\t\t\tva_flags;\n#define V_ADP_COLOR\t(1 << 0)\n#define V_ADP_MODECHANGE (1 << 1)\n#define V_ADP_STATESAVE\t(1 << 2)\n#define V_ADP_STATELOAD\t(1 << 3)\n#define V_ADP_FONT\t(1 << 4)\n#define V_ADP_PALETTE\t(1 << 5)\n#define V_ADP_BORDER\t(1 << 6)\n#define V_ADP_VESA\t(1 << 7)\n#define V_ADP_BOOTDISPLAY (1 << 8)\n#define V_ADP_PROBED\t(1 << 16)\n#define V_ADP_INITIALIZED (1 << 17)\n#define V_ADP_REGISTERED (1 << 18)\n#define V_ADP_ATTACHED\t(1 << 19)\n#define\tV_ADP_DAC8\t(1 << 20)\n    vm_offset_t\t\tva_io_base;\n    int\t\t\tva_io_size;\n    vm_offset_t\t\tva_crtc_addr;\n    vm_offset_t\t\tva_mem_base;\n    int\t\t\tva_mem_size;\n    vm_offset_t\t\tva_window;\t/* virtual address */\n    size_t\t\tva_window_size;\n    size_t\t\tva_window_gran;\n    u_int\t\tva_window_orig;\n    vm_offset_t\t\tva_buffer;\t/* virtual address */\n    size_t\t\tva_buffer_size;\n    int\t\t\tva_initial_mode;\n    int\t\t\tva_initial_bios_mode;\n    int\t\t\tva_mode;\n    struct video_info\tva_info;\n    int\t\t\tva_line_width;\n    struct {\n\tint\t\tx;\n\tint\t\ty;\n    } \t\t\tva_disp_start;\n    void\t\t*va_token;\n    int\t\t\tva_model;\n    int\t\t\tva_little_bitian;\n    int\t\t\tva_little_endian;\n    int\t\t\tva_buffer_alias;\n    vm_offset_t\t\tva_registers;\t/* virtual address */\n    vm_offset_t\t\tva_registers_size;\n};\ntypedef struct video_adapter video_adapter_t;\n\nstruct video_adapter_info {\n    int\t\t\tva_index;\n    int\t\t\tva_type;\n    char\t\tva_name[16];\n    int\t\t\tva_unit;\n    int\t\t\tva_flags;\n    vm_offset_t\t\tva_io_base;\n    int\t\t\tva_io_size;\n    vm_offset_t\t\tva_crtc_addr;\n    vm_offset_t\t\tva_mem_base;\n    int\t\t\tva_mem_size;\n    vm_offset_t\t\tva_window;\t/* virtual address */\n    size_t\t\tva_window_size;\n    size_t\t\tva_window_gran;\n    vm_offset_t\t\tva_unused0;\n    size_t\t\tva_buffer_size;\n    int\t\t\tva_initial_mode;\n    int\t\t\tva_initial_bios_mode;\n    int\t\t\tva_mode;\n    int\t\t\tva_line_width;\n    struct {\n\tint\t\tx;\n\tint\t\ty;\n    } \t\t\tva_disp_start;\n    u_int\t\tva_window_orig;\n    /* reserved */\n    u_char\t\tva_reserved[64];\n};\ntypedef struct video_adapter_info video_adapter_info_t;\n\n/* some useful video adapter index */\n#define V_ADP_PRIMARY\t0\n#define V_ADP_SECONDARY\t1\n\n/* video mode numbers */\n\n#define M_B40x25\t0\t/* black & white 40 columns */\n#define M_C40x25\t1\t/* color 40 columns */\n#define M_B80x25\t2\t/* black & white 80 columns */\n#define M_C80x25\t3\t/* color 80 columns */\n#define M_BG320\t\t4\t/* black & white graphics 320x200 */\n#define M_CG320\t\t5\t/* color graphics 320x200 */\n#define M_BG640\t\t6\t/* black & white graphics 640x200 hi-res */\n#define M_EGAMONO80x25  7       /* ega-mono 80x25 */\n#define M_CG320_D\t13\t/* ega mode D */\n#define M_CG640_E\t14\t/* ega mode E */\n#define M_EGAMONOAPA\t15\t/* ega mode F */\n#define M_CG640x350\t16\t/* ega mode 10 */\n#define M_ENHMONOAPA2\t17\t/* ega mode F with extended memory */\n#define M_ENH_CG640\t18\t/* ega mode 10* */\n#define M_ENH_B40x25    19      /* ega enhanced black & white 40 columns */\n#define M_ENH_C40x25    20      /* ega enhanced color 40 columns */\n#define M_ENH_B80x25    21      /* ega enhanced black & white 80 columns */\n#define M_ENH_C80x25    22      /* ega enhanced color 80 columns */\n#define M_VGA_C40x25\t23\t/* vga 8x16 font on color */\n#define M_VGA_C80x25\t24\t/* vga 8x16 font on color */\n#define M_VGA_M80x25\t25\t/* vga 8x16 font on mono */\n\n#define M_VGA11\t\t26\t/* vga 640x480 2 colors */\n#define M_BG640x480\t26\n#define M_VGA12\t\t27\t/* vga 640x480 16 colors */\n#define M_CG640x480\t27\n#define M_VGA13\t\t28\t/* vga 320x200 256 colors */\n#define M_VGA_CG320\t28\n\n#define M_VGA_C80x50\t30\t/* vga 8x8 font on color */\n#define M_VGA_M80x50\t31\t/* vga 8x8 font on color */\n#define M_VGA_C80x30\t32\t/* vga 8x16 font on color */\n#define M_VGA_M80x30\t33\t/* vga 8x16 font on color */\n#define M_VGA_C80x60\t34\t/* vga 8x8 font on color */\n#define M_VGA_M80x60\t35\t/* vga 8x8 font on color */\n#define M_VGA_CG640\t36\t/* vga 640x400 256 color */\n#define M_VGA_MODEX\t37\t/* vga 320x240 256 color */\n\n#define M_VGA_C90x25\t40\t/* vga 8x16 font on color */\n#define M_VGA_M90x25\t41\t/* vga 8x16 font on mono */\n#define M_VGA_C90x30\t42\t/* vga 8x16 font on color */\n#define M_VGA_M90x30\t43\t/* vga 8x16 font on mono */\n#define M_VGA_C90x43\t44\t/* vga 8x8 font on color */\n#define M_VGA_M90x43\t45\t/* vga 8x8 font on mono */\n#define M_VGA_C90x50\t46\t/* vga 8x8 font on color */\n#define M_VGA_M90x50\t47\t/* vga 8x8 font on mono */\n#define M_VGA_C90x60\t48\t/* vga 8x8 font on color */\n#define M_VGA_M90x60\t49\t/* vga 8x8 font on mono */\n\n#define M_ENH_B80x43\t0x70\t/* ega black & white 80x43 */\n#define M_ENH_C80x43\t0x71\t/* ega color 80x43 */\n\n#define M_PC98_80x25\t\t98\t/* PC98 text 80x25 */\n#define M_PC98_80x30\t\t99\t/* PC98 text 80x30 */\n#define M_PC98_EGC640x400\t100\t/* PC98 graphic 640x400 16 colors */\n#define M_PC98_PEGC640x400\t101\t/* PC98 graphic 640x400 256 colors */\n#define M_PC98_PEGC640x480\t102\t/* PC98 graphic 640x480 256 colors */\n\n#define M_HGC_P0\t0xe0\t/* hercules graphics - page 0 @ B0000 */\n#define M_HGC_P1\t0xe1\t/* hercules graphics - page 1 @ B8000 */\n#define M_MCA_MODE\t0xff\t/* monochrome adapter mode */\n\n#define M_TEXT_80x25\t200\t/* generic text modes */\n#define M_TEXT_80x30\t201\n#define M_TEXT_80x43\t202\n#define M_TEXT_80x50\t203\n#define M_TEXT_80x60\t204\n#define M_TEXT_132x25\t205\n#define M_TEXT_132x30\t206\n#define M_TEXT_132x43\t207\n#define M_TEXT_132x50\t208\n#define M_TEXT_132x60\t209\n\n#define M_VESA_BASE\t\t0x100\t/* VESA mode number base */\n#define M_VESA_CG640x400\t0x100\t/* 640x400, 256 color */\n#define M_VESA_CG640x480\t0x101\t/* 640x480, 256 color */\n#define M_VESA_800x600\t\t0x102\t/* 800x600, 16 color */\n#define M_VESA_CG800x600\t0x103\t/* 800x600, 256 color */\n#define M_VESA_1024x768\t\t0x104\t/* 1024x768, 16 color */\n#define M_VESA_CG1024x768\t0x105\t/* 1024x768, 256 color */\n#define M_VESA_1280x1024\t0x106\t/* 1280x1024, 16 color */\n#define M_VESA_CG1280x1024\t0x107\t/* 1280x1024, 256 color */\n#define M_VESA_C80x60\t\t0x108\t/* 8x8 font */\n#define M_VESA_C132x25\t\t0x109\t/* 8x16 font */\n#define M_VESA_C132x43\t\t0x10a\t/* 8x14 font */\n#define M_VESA_C132x50\t\t0x10b\t/* 8x8 font */\n#define M_VESA_C132x60\t\t0x10c\t/* 8x8 font */\n#define M_VESA_32K_320\t\t0x10d\t/* 320x200, 5:5:5 */\n#define M_VESA_64K_320\t\t0x10e\t/* 320x200, 5:6:5 */\n#define M_VESA_FULL_320\t\t0x10f\t/* 320x200, 8:8:8 */\n#define M_VESA_32K_640\t\t0x110\t/* 640x480, 5:5:5 */\n#define M_VESA_64K_640\t\t0x111\t/* 640x480, 5:6:5 */\n#define M_VESA_FULL_640\t\t0x112\t/* 640x480, 8:8:8 */\n#define M_VESA_32K_800\t\t0x113\t/* 800x600, 5:5:5 */\n#define M_VESA_64K_800\t\t0x114\t/* 800x600, 5:6:5 */\n#define M_VESA_FULL_800\t\t0x115\t/* 800x600, 8:8:8 */\n#define M_VESA_32K_1024\t\t0x116\t/* 1024x768, 5:5:5 */\n#define M_VESA_64K_1024\t\t0x117\t/* 1024x768, 5:6:5 */\n#define M_VESA_FULL_1024\t0x118\t/* 1024x768, 8:8:8 */\n#define M_VESA_32K_1280\t\t0x119\t/* 1280x1024, 5:5:5 */\n#define M_VESA_64K_1280\t\t0x11a\t/* 1280x1024, 5:6:5 */\n#define M_VESA_FULL_1280\t0x11b\t/* 1280x1024, 8:8:8 */\n#define M_VESA_MODE_MAX\t\t0x1ff\n\nstruct video_display_start {\n\tint\t\tx;\n\tint\t\ty;\n};\ntypedef struct video_display_start video_display_start_t;\n\nstruct video_color_palette {\n\tint\t\tindex;\t\t/* first element (zero-based) */\n\tint\t\tcount;\t\t/* number of elements */\n\tu_char\t\t*red;\t\t/* red */\n\tu_char\t\t*green;\t\t/* green */\n\tu_char\t\t*blue;\t\t/* blue */\n\tu_char\t\t*transparent;\t/* may be NULL */\n};\ntypedef struct video_color_palette video_color_palette_t;\n\n/* adapter info. */\n#define FBIO_ADAPTER\t_IOR('F', 100, int)\n#define FBIO_ADPTYPE\t_IOR('F', 101, int)\n#define FBIO_ADPINFO\t_IOR('F', 102, struct video_adapter_info)\n\n/* video mode control */\n#define FBIO_MODEINFO\t_IOWR('F', 103, struct video_info)\n#define FBIO_FINDMODE\t_IOWR('F', 104, struct video_info)\n#define FBIO_GETMODE\t_IOR('F', 105, int)\n#define FBIO_SETMODE\t_IOW('F', 106, int)\n\n/* get/set frame buffer window origin */\n#define FBIO_GETWINORG\t_IOR('F', 107, u_int)\n#define FBIO_SETWINORG\t_IOW('F', 108, u_int)\n\n/* get/set display start address */\n#define FBIO_GETDISPSTART\t_IOR('F', 109, video_display_start_t) \n#define FBIO_SETDISPSTART\t_IOW('F', 110, video_display_start_t)\n\n/* get/set scan line width */\n#define FBIO_GETLINEWIDTH\t_IOR('F', 111, u_int) \n#define FBIO_SETLINEWIDTH\t_IOW('F', 112, u_int)\n\n/* color palette control */\n#define FBIO_GETPALETTE\t_IOW('F', 113, video_color_palette_t)\n#define FBIO_SETPALETTE\t_IOW('F', 114, video_color_palette_t)\n\n/* blank display */\n#define V_DISPLAY_ON\t\t0\n#define V_DISPLAY_BLANK\t\t1\n#define V_DISPLAY_STAND_BY\t2\n#define V_DISPLAY_SUSPEND\t3\n\n#define FBIO_BLANK\t_IOW('F', 115, int)\n\n#endif /* !_SYS_FBIO_H_ */\n"
  },
  {
    "path": "freebsd-headers/sys/fcntl.h",
    "content": "/*-\n * Copyright (c) 1983, 1990, 1993\n *\tThe Regents of the University of California.  All rights reserved.\n * (c) UNIX System Laboratories, Inc.\n * All or some portions of this file are derived from material licensed\n * to the University of California by American Telephone and Telegraph\n * Co. or Unix System Laboratories, Inc. and are reproduced herein with\n * the permission of UNIX System Laboratories, Inc.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 4. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t@(#)fcntl.h\t8.3 (Berkeley) 1/21/94\n * $FreeBSD: release/9.0.0/sys/sys/fcntl.h 220791 2011-04-18 16:32:22Z mdf $\n */\n\n#ifndef _SYS_FCNTL_H_\n#define\t_SYS_FCNTL_H_\n\n/*\n * This file includes the definitions for open and fcntl\n * described by POSIX for <fcntl.h>; it also includes\n * related kernel definitions.\n */\n\n#include <sys/cdefs.h>\n#include <sys/_types.h>\n\n#ifndef _MODE_T_DECLARED\ntypedef\t__mode_t\tmode_t;\n#define\t_MODE_T_DECLARED\n#endif\n\n#ifndef _OFF_T_DECLARED\ntypedef\t__off_t\t\toff_t;\n#define\t_OFF_T_DECLARED\n#endif\n\n#ifndef _PID_T_DECLARED\ntypedef\t__pid_t\t\tpid_t;\n#define\t_PID_T_DECLARED\n#endif\n\n/*\n * File status flags: these are used by open(2), fcntl(2).\n * They are also used (indirectly) in the kernel file structure f_flags,\n * which is a superset of the open/fcntl flags.  Open flags and f_flags\n * are inter-convertible using OFLAGS(fflags) and FFLAGS(oflags).\n * Open/fcntl flags begin with O_; kernel-internal flags begin with F.\n */\n/* open-only flags */\n#define\tO_RDONLY\t0x0000\t\t/* open for reading only */\n#define\tO_WRONLY\t0x0001\t\t/* open for writing only */\n#define\tO_RDWR\t\t0x0002\t\t/* open for reading and writing */\n#define\tO_ACCMODE\t0x0003\t\t/* mask for above modes */\n\n/*\n * Kernel encoding of open mode; separate read and write bits that are\n * independently testable: 1 greater than the above.\n *\n * XXX\n * FREAD and FWRITE are excluded from the #ifdef _KERNEL so that TIOCFLUSH,\n * which was documented to use FREAD/FWRITE, continues to work.\n */\n#if __BSD_VISIBLE\n#define\tFREAD\t\t0x0001\n#define\tFWRITE\t\t0x0002\n#endif\n#define\tO_NONBLOCK\t0x0004\t\t/* no delay */\n#define\tO_APPEND\t0x0008\t\t/* set append mode */\n#if __BSD_VISIBLE\n#define\tO_SHLOCK\t0x0010\t\t/* open with shared file lock */\n#define\tO_EXLOCK\t0x0020\t\t/* open with exclusive file lock */\n#define\tO_ASYNC\t\t0x0040\t\t/* signal pgrp when data ready */\n#define\tO_FSYNC\t\t0x0080\t\t/* synchronous writes */\n#endif\n#define\tO_SYNC\t\t0x0080\t\t/* POSIX synonym for O_FSYNC */\n#if __BSD_VISIBLE\n#define\tO_NOFOLLOW\t0x0100\t\t/* don't follow symlinks */\n#endif\n#define\tO_CREAT\t\t0x0200\t\t/* create if nonexistent */\n#define\tO_TRUNC\t\t0x0400\t\t/* truncate to zero length */\n#define\tO_EXCL\t\t0x0800\t\t/* error if already exists */\n#ifdef _KERNEL\n#define\tFHASLOCK\t0x4000\t\t/* descriptor holds advisory lock */\n#endif\n\n/* Defined by POSIX 1003.1; BSD default, but must be distinct from O_RDONLY. */\n#define\tO_NOCTTY\t0x8000\t\t/* don't assign controlling terminal */\n\n#if __BSD_VISIBLE\n/* Attempt to bypass buffer cache */\n#define O_DIRECT\t0x00010000\n#endif\n\n/* Defined by POSIX Extended API Set Part 2 */\n#if __BSD_VISIBLE\n#define\tO_DIRECTORY\t0x00020000\t/* Fail if not directory */\n#define\tO_EXEC\t\t0x00040000\t/* Open for execute only */\n#endif\n#ifdef\t_KERNEL\n#define\tFEXEC\t\tO_EXEC\n#endif\n\n#if __POSIX_VISIBLE >= 200809\n/* Defined by POSIX 1003.1-2008; BSD default, but reserve for future use. */\n#define\tO_TTY_INIT\t0x00080000\t/* Restore default termios attributes */\n\n#define\tO_CLOEXEC\t0x00100000\n#endif\n\n/*\n * XXX missing O_DSYNC, O_RSYNC.\n */\n\n#ifdef _KERNEL\n/* convert from open() flags to/from fflags; convert O_RD/WR to FREAD/FWRITE */\n#define\tFFLAGS(oflags)\t((oflags) + 1)\n#define\tOFLAGS(fflags)\t((fflags) - 1)\n\n/* bits to save after open */\n#define\tFMASK\t(FREAD|FWRITE|FAPPEND|FASYNC|FFSYNC|FNONBLOCK|O_DIRECT|FEXEC)\n/* bits settable by fcntl(F_SETFL, ...) */\n#define\tFCNTLFLAGS\t(FAPPEND|FASYNC|FFSYNC|FNONBLOCK|FRDAHEAD|O_DIRECT)\n\n#if defined(COMPAT_FREEBSD7) || defined(COMPAT_FREEBSD6) || \\\n    defined(COMPAT_FREEBSD5) || defined(COMPAT_FREEBSD4)\n/*\n * Set by shm_open(3) in older libc's to get automatic MAP_ASYNC\n * behavior for POSIX shared memory objects (which are otherwise\n * implemented as plain files).\n */\n#define\tFPOSIXSHM\tO_NOFOLLOW\n#undef FCNTLFLAGS\n#define\tFCNTLFLAGS\t(FAPPEND|FASYNC|FFSYNC|FNONBLOCK|FPOSIXSHM|FRDAHEAD| \\\n\t\t\t O_DIRECT)\n#endif\n#endif\n\n/*\n * The O_* flags used to have only F* names, which were used in the kernel\n * and by fcntl.  We retain the F* names for the kernel f_flag field\n * and for backward compatibility for fcntl.  These flags are deprecated.\n */\n#if __BSD_VISIBLE\n#define\tFAPPEND\t\tO_APPEND\t/* kernel/compat */\n#define\tFASYNC\t\tO_ASYNC\t\t/* kernel/compat */\n#define\tFFSYNC\t\tO_FSYNC\t\t/* kernel */\n#define\tFNONBLOCK\tO_NONBLOCK\t/* kernel */\n#define\tFNDELAY\t\tO_NONBLOCK\t/* compat */\n#define\tO_NDELAY\tO_NONBLOCK\t/* compat */\n#endif\n\n/*\n * We are out of bits in f_flag (which is a short).  However,\n * the flag bits not set in FMASK are only meaningful in the\n * initial open syscall.  Those bits can thus be given a\n * different meaning for fcntl(2).\n */\n#if __BSD_VISIBLE\n/* Read ahead */\n#define\tFRDAHEAD\tO_CREAT\n#endif\n\n/* Defined by POSIX Extended API Set Part 2 */\n#if __BSD_VISIBLE\n/*\n * Magic value that specify the use of the current working directory\n * to determine the target of relative file paths in the openat() and\n * similar syscalls.\n */\n#define\tAT_FDCWD\t\t-100\n\n/*\n * Miscellaneous flags for the *at() syscalls.\n */\n#define\tAT_EACCESS\t\t0x100\t/* Check access using effective user and group ID */\n#define\tAT_SYMLINK_NOFOLLOW\t0x200   /* Do not follow symbolic links */\n#define\tAT_SYMLINK_FOLLOW\t0x400\t/* Follow symbolic link */\n#define\tAT_REMOVEDIR\t\t0x800\t/* Remove directory instead of file */\n#endif\n\n/*\n * Constants used for fcntl(2)\n */\n\n/* command values */\n#define\tF_DUPFD\t\t0\t\t/* duplicate file descriptor */\n#define\tF_GETFD\t\t1\t\t/* get file descriptor flags */\n#define\tF_SETFD\t\t2\t\t/* set file descriptor flags */\n#define\tF_GETFL\t\t3\t\t/* get file status flags */\n#define\tF_SETFL\t\t4\t\t/* set file status flags */\n#if __BSD_VISIBLE || __XSI_VISIBLE || __POSIX_VISIBLE >= 200112\n#define\tF_GETOWN\t5\t\t/* get SIGIO/SIGURG proc/pgrp */\n#define F_SETOWN\t6\t\t/* set SIGIO/SIGURG proc/pgrp */\n#endif\n#define\tF_OGETLK\t7\t\t/* get record locking information */\n#define\tF_OSETLK\t8\t\t/* set record locking information */\n#define\tF_OSETLKW\t9\t\t/* F_SETLK; wait if blocked */\n#define\tF_DUP2FD\t10\t\t/* duplicate file descriptor to arg */\n#define\tF_GETLK\t\t11\t\t/* get record locking information */\n#define\tF_SETLK\t\t12\t\t/* set record locking information */\n#define\tF_SETLKW\t13\t\t/* F_SETLK; wait if blocked */\n#define\tF_SETLK_REMOTE\t14\t\t/* debugging support for remote locks */\n#define\tF_READAHEAD\t15\t\t/* read ahead */\n#define\tF_RDAHEAD\t16\t\t/* Darwin compatible read ahead */\n\n/* file descriptor flags (F_GETFD, F_SETFD) */\n#define\tFD_CLOEXEC\t1\t\t/* close-on-exec flag */\n\n/* record locking flags (F_GETLK, F_SETLK, F_SETLKW) */\n#define\tF_RDLCK\t\t1\t\t/* shared or read lock */\n#define\tF_UNLCK\t\t2\t\t/* unlock */\n#define\tF_WRLCK\t\t3\t\t/* exclusive or write lock */\n#define\tF_UNLCKSYS\t4\t\t/* purge locks for a given system ID */ \n#define\tF_CANCEL\t5\t\t/* cancel an async lock request */\n#ifdef _KERNEL\n#define\tF_WAIT\t\t0x010\t\t/* Wait until lock is granted */\n#define\tF_FLOCK\t\t0x020\t \t/* Use flock(2) semantics for lock */\n#define\tF_POSIX\t\t0x040\t \t/* Use POSIX semantics for lock */\n#define\tF_REMOTE\t0x080\t\t/* Lock owner is remote NFS client */\n#define F_NOINTR\t0x100\t\t/* Ignore signals when waiting */\n#endif\n\n/*\n * Advisory file segment locking data type -\n * information passed to system by user\n */\nstruct flock {\n\toff_t\tl_start;\t/* starting offset */\n\toff_t\tl_len;\t\t/* len = 0 means until end of file */\n\tpid_t\tl_pid;\t\t/* lock owner */\n\tshort\tl_type;\t\t/* lock type: read/write, etc. */\n\tshort\tl_whence;\t/* type of l_start */\n\tint\tl_sysid;\t/* remote system id or zero for local */\n};\n\n/*\n * Old advisory file segment locking data type,\n * before adding l_sysid.\n */\nstruct oflock {\n\toff_t\tl_start;\t/* starting offset */\n\toff_t\tl_len;\t\t/* len = 0 means until end of file */\n\tpid_t\tl_pid;\t\t/* lock owner */\n\tshort\tl_type;\t\t/* lock type: read/write, etc. */\n\tshort\tl_whence;\t/* type of l_start */\n};\n\n\n#if __BSD_VISIBLE\n/* lock operations for flock(2) */\n#define\tLOCK_SH\t\t0x01\t\t/* shared file lock */\n#define\tLOCK_EX\t\t0x02\t\t/* exclusive file lock */\n#define\tLOCK_NB\t\t0x04\t\t/* don't block when locking */\n#define\tLOCK_UN\t\t0x08\t\t/* unlock file */\n#endif\n\n/*\n * XXX missing posix_fadvise() and POSIX_FADV_* macros.\n */\n\n#ifndef _KERNEL\n__BEGIN_DECLS\nint\topen(const char *, int, ...);\nint\tcreat(const char *, mode_t);\nint\tfcntl(int, int, ...);\n#if __BSD_VISIBLE || __POSIX_VISIBLE >= 200809\nint\topenat(int, const char *, int, ...);\n#endif\n#if __BSD_VISIBLE || __POSIX_VISIBLE >= 200112\nint\tposix_fallocate(int, off_t, off_t);\n#endif\n#if __BSD_VISIBLE\nint\tflock(int, int);\n#endif\n__END_DECLS\n#endif\n\n#endif /* !_SYS_FCNTL_H_ */\n"
  },
  {
    "path": "freebsd-headers/sys/fdcio.h",
    "content": "/*-\n * Copyright (C) 1992-1994,2001 by Joerg Wunsch, Dresden\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\n * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\n * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT\n * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR\n * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF\n * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE\n * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH\n * DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/sys/fdcio.h 139825 2005-01-07 02:29:27Z imp $\n */\n\n#ifndef\t_MACHINE_IOCTL_FD_H_\n#define\t_MACHINE_IOCTL_FD_H_\n\n#ifndef _KERNEL\n#include <sys/types.h>\n#endif\n#include <sys/ioccom.h>\n\n#define FD_FORMAT_VERSION 110\t/* used to validate before formatting */\n#define FD_MAX_NSEC 36\t\t/* highest known number of spt - allow for */\n\t\t\t\t/* 2.88 MB drives */\n\nstruct fd_formb {\n\tint format_version;\t/* == FD_FORMAT_VERSION */\n\tint cyl, head;\n\tint transfer_rate;\t/* FDC_???KBPS */\n\n\tstruct fd_form_data {\n\t\t/*\n\t\t * DO NOT CHANGE THE LAYOUT OF THIS STRUCTS\n\t\t * it is hardware-dependent since it exactly\n\t\t * matches the byte sequence to write to FDC\n\t\t * during its `format track' operation\n\t\t */\n\t\tu_char secshift; /* 0 -> 128, ...; usually 2 -> 512 */\n\t\tu_char nsecs;\t/* must be <= FD_MAX_NSEC */\n\t\tu_char gaplen;\t/* GAP 3 length; usually 84 */\n\t\tu_char fillbyte; /* usually 0xf6 */\n\t\tstruct fd_idfield_data {\n\t\t\t/*\n\t\t\t * data to write into id fields;\n\t\t\t * for obscure formats, they mustn't match\n\t\t\t * the real values (but mostly do)\n\t\t\t */\n\t\t\tu_char cylno;\t/* 0 thru 79 (or 39) */\n\t\t\tu_char headno;\t/* 0, or 1 */\n\t\t\tu_char secno;\t/* starting at 1! */\n\t\t\tu_char secsize;\t/* usually 2 */\n\t\t} idfields[FD_MAX_NSEC]; /* 0 <= idx < nsecs used */\n\t} format_info;\n};\n\n/* make life easier */\n# define fd_formb_secshift   format_info.secshift\n# define fd_formb_nsecs      format_info.nsecs\n# define fd_formb_gaplen     format_info.gaplen\n# define fd_formb_fillbyte   format_info.fillbyte\n/* these data must be filled in for(i = 0; i < fd_formb_nsecs; i++) */\n# define fd_formb_cylno(i)   format_info.idfields[i].cylno\n# define fd_formb_headno(i)  format_info.idfields[i].headno\n# define fd_formb_secno(i)   format_info.idfields[i].secno\n# define fd_formb_secsize(i) format_info.idfields[i].secsize\n\nstruct fd_type {\n\tint\tsectrac;\t\t/* sectors per track         */\n\tint\tsecsize;\t\t/* size code for sectors     */\n\tint\tdatalen;\t\t/* data len when secsize = 0 */\n\tint\tgap;\t\t\t/* gap len between sectors   */\n\tint\ttracks;\t\t\t/* total number of cylinders */\n\tint\tsize;\t\t\t/* size of disk in sectors   */\n\tint\ttrans;\t\t\t/* transfer speed code       */\n\tint\theads;\t\t\t/* number of heads\t     */\n\tint     f_gap;                  /* format gap len            */\n\tint     f_inter;                /* format interleave factor  */\n\tint\toffset_side2;\t\t/* offset of sectors on side2 */\n\tint\tflags;\t\t\t/* misc. features */\n#define FL_MFM\t\t0x0001\t\t/* MFM recording */\n#define FL_2STEP\t0x0002\t\t/* 2 steps between cylinders */\n#define FL_PERPND\t0x0004\t\t/* perpendicular recording */\n#define FL_AUTO\t\t0x0008\t\t/* autodetect format */\n};\n\nstruct fdc_status {\n\tu_int\tstatus[7];\n};\n\n/*\n * cyl and head are being passed into ioctl(FD_READID)\n * all four fields are being returned\n */\nstruct fdc_readid {\n\tu_char\tcyl;\t\t/* C - 0...79 */\n\tu_char\thead;\t\t/* H - 0...1 */\n\tu_char\tsec;\t\t/* R - 1...n */\n\tu_char\tsecshift;\t/* N - log2(secsize / 128) */\n};\n\n/*\n * Diskette drive type, basically the same as stored in RTC on ISA\n * machines (see /sys/isa/rtc.h), but right-shifted by four bits.\n */\nenum fd_drivetype {\n\tFDT_NONE, FDT_360K, FDT_12M, FDT_720K, FDT_144M, FDT_288M_1,\n\tFDT_288M\n};\n\n\n#define FD_FORM   _IOW('F', 61, struct fd_formb) /* format a track */\n#define FD_GTYPE  _IOR('F', 62, struct fd_type)  /* get drive type */\n#define FD_STYPE  _IOW('F', 63, struct fd_type)  /* set drive type */\n\n#define FD_GOPTS  _IOR('F', 64, int) /* drive options, see below */\n#define FD_SOPTS  _IOW('F', 65, int)\n \n#ifdef PC98\n#define FD_DEBUG  _IOW('F', 66, int)\n#endif\n\n#define FD_CLRERR _IO('F', 67)\t/* clear error counter */\n\n#define FD_READID _IOWR('F', 68, struct fdc_readid) /* read ID field */\n\n/*\n * Obtain NE765 status registers.  Only successful if there is\n * a valid status stored in fdc->status[].\n */\n#define FD_GSTAT  _IOR('F', 69, struct fdc_status)\n\n#define FD_GDTYPE _IOR('F', 70, enum fd_drivetype) /* obtain drive type */\n\n/* Options for FD_GOPTS/FD_SOPTS, cleared on device close */\n#define FDOPT_NORETRY 0x0001\t/* no retries on failure */\n#define FDOPT_NOERRLOG 0x002\t/* no \"hard error\" kernel log messages */\n#define FDOPT_NOERROR 0x0004\t/* do not indicate errors, caller will use\n\t\t\t\t   FD_GSTAT in order to obtain status */\n#ifdef PC98\n#define FDOPT_AUTOSEL 0x8000\t/* read/only option: device performs media\n\t\t\t\t * autoselection */\n#endif\n\n/*\n * Transfer rate definitions.  Used in the structures above.  They\n * represent the hardware encoding of bits 0 and 1 of the FDC control\n * register when writing to the register.\n * Transfer rates for FM encoding are half the values listed here\n * (but we currently don't support FM encoding).\n */\n#define\tFDC_500KBPS\t0x00\t/* 500KBPS MFM drive transfer rate */\n#define\tFDC_300KBPS\t0x01\t/* 300KBPS MFM drive transfer rate */\n#define\tFDC_250KBPS\t0x02\t/* 250KBPS MFM drive transfer rate */\n#define\tFDC_1MBPS\t0x03\t/* 1MPBS MFM drive transfer rate */\n\n/*\n * Parameters for common formats\n *\n * See struct fd_type for layout.\n * XXX: Field 'size' must be calculated.\n * XXX: Fields 'f_inter' and 'offset_side2' are unused by kernel.\n *\n * XXX: These should really go in a /etc/floppycap colon separated file\n * XXX: but the kernel needs some of them for proper defaults and it would\n * XXX: should have been done 20 years ago to make sense.\n */\n#ifdef PC98\n#define FDF_3_1722 21,2,0xFF,0x04,82,0,2,2,0x0C,2,0,FL_MFM\n#define FDF_3_1476 18,2,0xFF,0x1B,82,0,2,2,0x54,1,0,FL_MFM\n#define FDF_3_1440 18,2,0xFF,0x1B,80,0,2,2,0x54,1,0,FL_MFM\n#define FDF_3_1200 15,2,0xFF,0x1B,80,0,0,2,0x54,1,0,FL_MFM\n#define FDF_3_820  10,2,0xFF,0x10,82,0,1,2,0x30,1,0,FL_MFM\n#define FDF_3_800  10,2,0xFF,0x10,80,0,1,2,0x30,1,0,FL_MFM\n#define FDF_3_720   9,2,0xFF,0x20,80,0,1,2,0x50,1,0,FL_MFM\n#define FDF_3_360   9,2,0xFF,0x20,40,0,1,2,0x50,1,0,FL_MFM|FL_2STEP\n#define FDF_3_640   8,2,0xFF,0x2A,80,0,1,2,0x50,1,0,FL_MFM\n#define FDF_3_1230  8,3,0xFF,0x35,77,0,0,2,0x74,1,0,FL_MFM\n#define FDF_3_1280  8,3,0xFF,0x35,80,0,0,2,0x74,1,0,FL_MFM\n#define FDF_3_1480  9,3,0xFF,0x35,82,0,0,2,0x47,1,0,FL_MFM\n#define FDF_3_1640 10,3,0xFF,0x1B,82,0,2,2,0x54,1,0,FL_MFM\n#define FDF_5_1200 15,2,0xFF,0x1B,80,0,0,2,0x54,1,0,FL_MFM\n#define FDF_5_820  10,2,0xFF,0x10,82,0,1,2,0x30,1,0,FL_MFM\n#define FDF_5_800  10,2,0xFF,0x10,80,0,1,2,0x30,1,0,FL_MFM\n#define FDF_5_720   9,2,0xFF,0x20,80,0,1,2,0x50,1,0,FL_MFM\n#define FDF_5_360   9,2,0xFF,0x20,40,0,1,2,0x50,1,0,FL_MFM|FL_2STEP\n#define FDF_5_640   8,2,0xFF,0x2A,80,0,1,2,0x50,1,0,FL_MFM\n#define FDF_5_1230  8,3,0xFF,0x35,77,0,0,2,0x74,1,0,FL_MFM\n#define FDF_5_1280  8,3,0xFF,0x35,80,0,0,2,0x74,1,0,FL_MFM\n#else /* PC98 */\n#define FDF_3_2880 36,2,0xFF,0x1B,80,0,FDC_1MBPS,002,0x4C,1,1,FL_MFM|FL_PERPND\n#define FDF_3_1722 21,2,0xFF,0x04,82,0,FDC_500KBPS,2,0x0C,2,0,FL_MFM\n#define FDF_3_1476 18,2,0xFF,0x1B,82,0,FDC_500KBPS,2,0x6C,1,0,FL_MFM\n#define FDF_3_1440 18,2,0xFF,0x1B,80,0,FDC_500KBPS,2,0x6C,1,0,FL_MFM\n#define FDF_3_1200 15,2,0xFF,0x1B,80,0,FDC_500KBPS,2,0x54,1,0,FL_MFM\n#define FDF_3_820  10,2,0xFF,0x10,82,0,FDC_250KBPS,2,0x2e,1,0,FL_MFM\n#define FDF_3_800  10,2,0xFF,0x10,80,0,FDC_250KBPS,2,0x2e,1,0,FL_MFM\n#define FDF_3_720   9,2,0xFF,0x20,80,0,FDC_250KBPS,2,0x50,1,0,FL_MFM\n#define FDF_5_1480 18,2,0xFF,0x02,82,0,FDC_500KBPS,2,0x02,2,0,FL_MFM \n#define FDF_5_1440 18,2,0xFF,0x02,80,0,FDC_500KBPS,2,0x02,2,0,FL_MFM\n#define FDF_5_1230  8,3,0xFF,0x35,77,0,FDC_500KBPS,2,0x74,1,0,FL_MFM\n#define FDF_5_1200 15,2,0xFF,0x1B,80,0,FDC_500KBPS,2,0x54,1,0,FL_MFM\n#define FDF_5_820  10,2,0xFF,0x10,82,0,FDC_300KBPS,2,0x2e,1,0,FL_MFM\n#define FDF_5_800  10,2,0xFF,0x10,80,0,FDC_300KBPS,2,0x2e,1,0,FL_MFM\n#define FDF_5_720   9,2,0xFF,0x20,80,0,FDC_300KBPS,2,0x50,1,0,FL_MFM\n#define FDF_5_640   8,2,0xFF,0x2A,80,0,FDC_300KBPS,2,0x50,1,0,FL_MFM\n#define FDF_5_360   9,2,0xFF,0x23,40,0,FDC_300KBPS,2,0x50,1,0,FL_MFM\n/* XXX:                      0x2a ? */\n#endif\n\n#endif /* !_MACHINE_IOCTL_FD_H_ */\n"
  },
  {
    "path": "freebsd-headers/sys/file.h",
    "content": "/*-\n * Copyright (c) 1982, 1986, 1989, 1993\n *\tThe Regents of the University of California.  All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 4. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t@(#)file.h\t8.3 (Berkeley) 1/9/95\n * $FreeBSD: release/9.0.0/sys/sys/file.h 224987 2011-08-18 22:51:30Z jonathan $\n */\n\n#ifndef _SYS_FILE_H_\n#define\t_SYS_FILE_H_\n\n#ifndef _KERNEL\n#include <sys/types.h> /* XXX */\n#include <sys/fcntl.h>\n#include <sys/unistd.h>\n#else\n#include <sys/queue.h>\n#include <sys/refcount.h>\n#include <sys/_lock.h>\n#include <sys/_mutex.h>\n\nstruct stat;\nstruct thread;\nstruct uio;\nstruct knote;\nstruct vnode;\nstruct socket;\n\n\n#endif /* _KERNEL */\n\n#define\tDTYPE_VNODE\t1\t/* file */\n#define\tDTYPE_SOCKET\t2\t/* communications endpoint */\n#define\tDTYPE_PIPE\t3\t/* pipe */\n#define\tDTYPE_FIFO\t4\t/* fifo (named pipe) */\n#define\tDTYPE_KQUEUE\t5\t/* event queue */\n#define\tDTYPE_CRYPTO\t6\t/* crypto */\n#define\tDTYPE_MQUEUE\t7\t/* posix message queue */\n#define\tDTYPE_SHM\t8\t/* swap-backed shared memory */\n#define\tDTYPE_SEM\t9\t/* posix semaphore */\n#define\tDTYPE_PTS\t10\t/* pseudo teletype master device */\n#define\tDTYPE_DEV\t11\t/* Device specific fd type */\n#define\tDTYPE_CAPABILITY\t12\t/* capability */\n#define\tDTYPE_PROCDESC\t13\t/* process descriptor */\n\n#ifdef _KERNEL\n\nstruct file;\nstruct ucred;\n\ntypedef int fo_rdwr_t(struct file *fp, struct uio *uio,\n\t\t    struct ucred *active_cred, int flags,\n\t\t    struct thread *td);\n#define\tFOF_OFFSET\t1\t/* Use the offset in uio argument */\ntypedef\tint fo_truncate_t(struct file *fp, off_t length,\n\t\t    struct ucred *active_cred, struct thread *td);\ntypedef\tint fo_ioctl_t(struct file *fp, u_long com, void *data,\n\t\t    struct ucred *active_cred, struct thread *td);\ntypedef\tint fo_poll_t(struct file *fp, int events,\n\t\t    struct ucred *active_cred, struct thread *td);\ntypedef\tint fo_kqfilter_t(struct file *fp, struct knote *kn);\ntypedef\tint fo_stat_t(struct file *fp, struct stat *sb,\n\t\t    struct ucred *active_cred, struct thread *td);\ntypedef\tint fo_close_t(struct file *fp, struct thread *td);\ntypedef\tint fo_chmod_t(struct file *fp, mode_t mode,\n\t\t    struct ucred *active_cred, struct thread *td);\ntypedef\tint fo_chown_t(struct file *fp, uid_t uid, gid_t gid,\n\t\t    struct ucred *active_cred, struct thread *td);\ntypedef\tint fo_flags_t;\n\nstruct fileops {\n\tfo_rdwr_t\t*fo_read;\n\tfo_rdwr_t\t*fo_write;\n\tfo_truncate_t\t*fo_truncate;\n\tfo_ioctl_t\t*fo_ioctl;\n\tfo_poll_t\t*fo_poll;\n\tfo_kqfilter_t\t*fo_kqfilter;\n\tfo_stat_t\t*fo_stat;\n\tfo_close_t\t*fo_close;\n\tfo_chmod_t\t*fo_chmod;\n\tfo_chown_t\t*fo_chown;\n\tfo_flags_t\tfo_flags;\t/* DFLAG_* below */\n};\n\n#define DFLAG_PASSABLE\t0x01\t/* may be passed via unix sockets. */\n#define DFLAG_SEEKABLE\t0x02\t/* seekable / nonsequential */\n#endif /* _KERNEL */\n\n#if defined(_KERNEL) || defined(_WANT_FILE)\n/*\n * Kernel descriptor table.\n * One entry for each open kernel vnode and socket.\n *\n * Below is the list of locks that protects members in struct file.\n *\n * (f) protected with mtx_lock(mtx_pool_find(fp))\n * (d) cdevpriv_mtx\n * none\tnot locked\n */\n\nstruct file {\n\tvoid\t\t*f_data;\t/* file descriptor specific data */\n\tstruct fileops\t*f_ops;\t\t/* File operations */\n\tstruct ucred\t*f_cred;\t/* associated credentials. */\n\tstruct vnode \t*f_vnode;\t/* NULL or applicable vnode */\n\tshort\t\tf_type;\t\t/* descriptor type */\n\tshort\t\tf_vnread_flags; /* (f) Sleep lock for f_offset */\n\tvolatile u_int\tf_flag;\t\t/* see fcntl.h */\n\tvolatile u_int \tf_count;\t/* reference count */\n\t/*\n\t *  DTYPE_VNODE specific fields.\n\t */\n\tint\t\tf_seqcount;\t/* Count of sequential accesses. */\n\toff_t\t\tf_nextoff;\t/* next expected read/write offset. */\n\tstruct cdev_privdata *f_cdevpriv; /* (d) Private data for the cdev. */\n\t/*\n\t *  DFLAG_SEEKABLE specific fields\n\t */\n\toff_t\t\tf_offset;\n\t/*\n\t * Mandatory Access control information.\n\t */\n\tvoid\t\t*f_label;\t/* Place-holder for MAC label. */\n};\n\n#define\tFOFFSET_LOCKED       0x1\n#define\tFOFFSET_LOCK_WAITING 0x2\t\t \n\n#endif /* _KERNEL || _WANT_FILE */\n\n/*\n * Userland version of struct file, for sysctl\n */\nstruct xfile {\n\tsize_t\txf_size;\t/* size of struct xfile */\n\tpid_t\txf_pid;\t\t/* owning process */\n\tuid_t\txf_uid;\t\t/* effective uid of owning process */\n\tint\txf_fd;\t\t/* descriptor number */\n\tvoid\t*xf_file;\t/* address of struct file */\n\tshort\txf_type;\t/* descriptor type */\n\tint\txf_count;\t/* reference count */\n\tint\txf_msgcount;\t/* references from message queue */\n\toff_t\txf_offset;\t/* file offset */\n\tvoid\t*xf_data;\t/* file descriptor specific data */\n\tvoid\t*xf_vnode;\t/* vnode pointer */\n\tu_int\txf_flag;\t/* flags (see fcntl.h) */\n};\n\n#ifdef _KERNEL\n\n#ifdef MALLOC_DECLARE\nMALLOC_DECLARE(M_FILE);\n#endif\n\nextern struct fileops vnops;\nextern struct fileops badfileops;\nextern struct fileops socketops;\nextern int maxfiles;\t\t/* kernel limit on number of open files */\nextern int maxfilesperproc;\t/* per process limit on number of open files */\nextern volatile int openfiles;\t/* actual number of open files */\n\nint fget(struct thread *td, int fd, cap_rights_t rights, struct file **fpp);\nint fget_mmap(struct thread *td, int fd, cap_rights_t rights,\n    u_char *maxprotp, struct file **fpp);\nint fget_read(struct thread *td, int fd, cap_rights_t rights,\n    struct file **fpp);\nint fget_write(struct thread *td, int fd, cap_rights_t rights,\n    struct file **fpp);\nint fgetcap(struct thread *td, int fd, struct file **fpp);\nint _fdrop(struct file *fp, struct thread *td);\n\n/*\n * The socket operations are used a couple of places.\n * XXX: This is wrong, they should go through the operations vector for\n * XXX: sockets instead of going directly for the individual functions. /phk\n */\nfo_rdwr_t\tsoo_read;\nfo_rdwr_t\tsoo_write;\nfo_truncate_t\tsoo_truncate;\nfo_ioctl_t\tsoo_ioctl;\nfo_poll_t\tsoo_poll;\nfo_kqfilter_t\tsoo_kqfilter;\nfo_stat_t\tsoo_stat;\nfo_close_t\tsoo_close;\n\nfo_chmod_t\tinvfo_chmod;\nfo_chown_t\tinvfo_chown;\n\nvoid finit(struct file *, u_int, short, void *, struct fileops *);\nint fgetvp(struct thread *td, int fd, cap_rights_t rights, struct vnode **vpp);\nint fgetvp_rights(struct thread *td, int fd, cap_rights_t need,\n    cap_rights_t *have, struct vnode **vpp);\nint fgetvp_read(struct thread *td, int fd, cap_rights_t rights,\n    struct vnode **vpp);\nint fgetvp_write(struct thread *td, int fd, cap_rights_t rights,\n    struct vnode **vpp);\n\nint fgetsock(struct thread *td, int fd, cap_rights_t rights,\n    struct socket **spp, u_int *fflagp);\nvoid fputsock(struct socket *sp);\n\nstatic __inline int\n_fnoop(void)\n{\n\n\treturn (0);\n}\n\n#define\tfhold(fp)\t\t\t\t\t\t\t\\\n\t(refcount_acquire(&(fp)->f_count))\n#define\tfdrop(fp, td)\t\t\t\t\t\t\t\\\n\t(refcount_release(&(fp)->f_count) ? _fdrop((fp), (td)) : _fnoop())\n\nstatic __inline fo_rdwr_t\tfo_read;\nstatic __inline fo_rdwr_t\tfo_write;\nstatic __inline fo_truncate_t\tfo_truncate;\nstatic __inline fo_ioctl_t\tfo_ioctl;\nstatic __inline fo_poll_t\tfo_poll;\nstatic __inline fo_kqfilter_t\tfo_kqfilter;\nstatic __inline fo_stat_t\tfo_stat;\nstatic __inline fo_close_t\tfo_close;\nstatic __inline fo_chmod_t\tfo_chmod;\nstatic __inline fo_chown_t\tfo_chown;\n\nstatic __inline int\nfo_read(struct file *fp, struct uio *uio, struct ucred *active_cred,\n    int flags, struct thread *td)\n{\n\n\treturn ((*fp->f_ops->fo_read)(fp, uio, active_cred, flags, td));\n}\n\nstatic __inline int\nfo_write(struct file *fp, struct uio *uio, struct ucred *active_cred,\n    int flags, struct thread *td)\n{\n\n\treturn ((*fp->f_ops->fo_write)(fp, uio, active_cred, flags, td));\n}\n\nstatic __inline int\nfo_truncate(struct file *fp, off_t length, struct ucred *active_cred,\n    struct thread *td)\n{\n\n\treturn ((*fp->f_ops->fo_truncate)(fp, length, active_cred, td));\n}\n\nstatic __inline int\nfo_ioctl(struct file *fp, u_long com, void *data, struct ucred *active_cred,\n    struct thread *td)\n{\n\n\treturn ((*fp->f_ops->fo_ioctl)(fp, com, data, active_cred, td));\n}\n\nstatic __inline int\nfo_poll(struct file *fp, int events, struct ucred *active_cred,\n    struct thread *td)\n{\n\n\treturn ((*fp->f_ops->fo_poll)(fp, events, active_cred, td));\n}\n\nstatic __inline int\nfo_stat(struct file *fp, struct stat *sb, struct ucred *active_cred,\n    struct thread *td)\n{\n\n\treturn ((*fp->f_ops->fo_stat)(fp, sb, active_cred, td));\n}\n\nstatic __inline int\nfo_close(struct file *fp, struct thread *td)\n{\n\n\treturn ((*fp->f_ops->fo_close)(fp, td));\n}\n\nstatic __inline int\nfo_kqfilter(struct file *fp, struct knote *kn)\n{\n\n\treturn ((*fp->f_ops->fo_kqfilter)(fp, kn));\n}\n\nstatic __inline int\nfo_chmod(struct file *fp, mode_t mode, struct ucred *active_cred,\n    struct thread *td)\n{\n\n\treturn ((*fp->f_ops->fo_chmod)(fp, mode, active_cred, td));\n}\n\nstatic __inline int\nfo_chown(struct file *fp, uid_t uid, gid_t gid, struct ucred *active_cred,\n    struct thread *td)\n{\n\n\treturn ((*fp->f_ops->fo_chown)(fp, uid, gid, active_cred, td));\n}\n\n#endif /* _KERNEL */\n\n#endif /* !SYS_FILE_H */\n"
  },
  {
    "path": "freebsd-headers/sys/filedesc.h",
    "content": "/*-\n * Copyright (c) 1990, 1993\n *\tThe Regents of the University of California.  All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 4. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t@(#)filedesc.h\t8.1 (Berkeley) 6/2/93\n * $FreeBSD: release/9.0.0/sys/sys/filedesc.h 224778 2011-08-11 12:30:23Z rwatson $\n */\n\n#ifndef _SYS_FILEDESC_H_\n#define\t_SYS_FILEDESC_H_\n\n#include <sys/queue.h>\n#include <sys/event.h>\n#include <sys/lock.h>\n#include <sys/priority.h>\n#include <sys/sx.h>\n\n#include <machine/_limits.h>\n\n/*\n * This structure is used for the management of descriptors.  It may be\n * shared by multiple processes.\n */\n#define NDSLOTTYPE\tu_long\n\nstruct filedesc {\n\tstruct\tfile **fd_ofiles;\t/* file structures for open files */\n\tchar\t*fd_ofileflags;\t\t/* per-process open file flags */\n\tstruct\tvnode *fd_cdir;\t\t/* current directory */\n\tstruct\tvnode *fd_rdir;\t\t/* root directory */\n\tstruct\tvnode *fd_jdir;\t\t/* jail root directory */\n\tint\tfd_nfiles;\t\t/* number of open files allocated */\n\tNDSLOTTYPE *fd_map;\t\t/* bitmap of free fds */\n\tint\tfd_lastfile;\t\t/* high-water mark of fd_ofiles */\n\tint\tfd_freefile;\t\t/* approx. next free file */\n\tu_short\tfd_cmask;\t\t/* mask for file creation */\n\tu_short\tfd_refcnt;\t\t/* thread reference count */\n\tu_short\tfd_holdcnt;\t\t/* hold count on structure + mutex */\n\tstruct\tsx fd_sx;\t\t/* protects members of this struct */\n\tstruct\tkqlist fd_kqlist;\t/* list of kqueues on this filedesc */\n\tint\tfd_holdleaderscount;\t/* block fdfree() for shared close() */\n\tint\tfd_holdleaderswakeup;\t/* fdfree() needs wakeup */\n};\n\n/*\n * Structure to keep track of (process leader, struct fildedesc) tuples.\n * Each process has a pointer to such a structure when detailed tracking\n * is needed, e.g., when rfork(RFPROC | RFMEM) causes a file descriptor\n * table to be shared by processes having different \"p_leader\" pointers\n * and thus distinct POSIX style locks.\n *\n * fdl_refcount and fdl_holdcount are protected by struct filedesc mtx.\n */\nstruct filedesc_to_leader {\n\tint\t\tfdl_refcount;\t/* references from struct proc */\n\tint\t\tfdl_holdcount;\t/* temporary hold during closef */\n\tint\t\tfdl_wakeup;\t/* fdfree() waits on closef() */\n\tstruct proc\t*fdl_leader;\t/* owner of POSIX locks */\n\t/* Circular list: */\n\tstruct filedesc_to_leader *fdl_prev;\n\tstruct filedesc_to_leader *fdl_next;\n};\n\n/*\n * Per-process open flags.\n */\n#define\tUF_EXCLOSE \t0x01\t\t/* auto-close on exec */\n\n#ifdef _KERNEL\n\n/* Lock a file descriptor table. */\n#define\tFILEDESC_LOCK_INIT(fdp)\tsx_init(&(fdp)->fd_sx, \"filedesc structure\")\n#define\tFILEDESC_LOCK_DESTROY(fdp)\tsx_destroy(&(fdp)->fd_sx)\n#define\tFILEDESC_LOCK(fdp)\t(&(fdp)->fd_sx)\n#define\tFILEDESC_XLOCK(fdp)\tsx_xlock(&(fdp)->fd_sx)\n#define\tFILEDESC_XUNLOCK(fdp)\tsx_xunlock(&(fdp)->fd_sx)\n#define\tFILEDESC_SLOCK(fdp)\tsx_slock(&(fdp)->fd_sx)\n#define\tFILEDESC_SUNLOCK(fdp)\tsx_sunlock(&(fdp)->fd_sx)\n\n#define\tFILEDESC_LOCK_ASSERT(fdp)\tsx_assert(&(fdp)->fd_sx, SX_LOCKED | \\\n\t\t\t\t\t    SX_NOTRECURSED)\n#define\tFILEDESC_XLOCK_ASSERT(fdp)\tsx_assert(&(fdp)->fd_sx, SX_XLOCKED | \\\n\t\t\t\t\t    SX_NOTRECURSED)\n\nstruct thread;\n\nint\tclosef(struct file *fp, struct thread *td);\nint\tdupfdopen(struct thread *td, struct filedesc *fdp, int indx, int dfd,\n\t    int mode, int error);\nint\tfalloc(struct thread *td, struct file **resultfp, int *resultfd,\n\t    int flags);\nint\tfalloc_noinstall(struct thread *td, struct file **resultfp);\nint\tfinstall(struct thread *td, struct file *fp, int *resultfp, int flags);\nint\tfdalloc(struct thread *td, int minfd, int *result);\nint\tfdavail(struct thread *td, int n);\nint\tfdcheckstd(struct thread *td);\nvoid\tfdclose(struct filedesc *fdp, struct file *fp, int idx, struct thread *td);\nvoid\tfdcloseexec(struct thread *td);\nstruct\tfiledesc *fdcopy(struct filedesc *fdp);\nvoid\tfdunshare(struct proc *p, struct thread *td);\nvoid\tfdfree(struct thread *td);\nstruct\tfiledesc *fdinit(struct filedesc *fdp);\nstruct\tfiledesc *fdshare(struct filedesc *fdp);\nstruct filedesc_to_leader *\n\tfiledesc_to_leader_alloc(struct filedesc_to_leader *old,\n\t    struct filedesc *fdp, struct proc *leader);\nint\tgetvnode(struct filedesc *fdp, int fd, cap_rights_t rights,\n\t    struct file **fpp);\nvoid\tmountcheckdirs(struct vnode *olddp, struct vnode *newdp);\nvoid\tsetugidsafety(struct thread *td);\n\n/* Return a referenced file from an unlocked descriptor. */\nstruct file *fget_unlocked(struct filedesc *fdp, int fd);\n\n/* Requires a FILEDESC_{S,X}LOCK held and returns without a ref. */\nstatic __inline struct file *\nfget_locked(struct filedesc *fdp, int fd)\n{\n\n\treturn (fd < 0 || fd >= fdp->fd_nfiles ? NULL : fdp->fd_ofiles[fd]);\n}\n\n#endif /* _KERNEL */\n\n#endif /* !_SYS_FILEDESC_H_ */\n"
  },
  {
    "path": "freebsd-headers/sys/filio.h",
    "content": "/*-\n * Copyright (c) 1982, 1986, 1990, 1993, 1994\n *\tThe Regents of the University of California.  All rights reserved.\n * (c) UNIX System Laboratories, Inc.\n * All or some portions of this file are derived from material licensed\n * to the University of California by American Telephone and Telegraph\n * Co. or Unix System Laboratories, Inc. and are reproduced herein with\n * the permission of UNIX System Laboratories, Inc.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 4. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t@(#)filio.h\t8.1 (Berkeley) 3/28/94\n * $FreeBSD: release/9.0.0/sys/sys/filio.h 195191 2009-06-30 13:38:49Z emaste $\n */\n\n#ifndef\t_SYS_FILIO_H_\n#define\t_SYS_FILIO_H_\n\n#include <sys/ioccom.h>\n\n/* Generic file-descriptor ioctl's. */\n#define\tFIOCLEX\t\t _IO('f', 1)\t\t/* set close on exec on fd */\n#define\tFIONCLEX\t _IO('f', 2)\t\t/* remove close on exec */\n#define\tFIONREAD\t_IOR('f', 127, int)\t/* get # bytes to read */\n#define\tFIONBIO\t\t_IOW('f', 126, int)\t/* set/clear non-blocking i/o */\n#define\tFIOASYNC\t_IOW('f', 125, int)\t/* set/clear async i/o */\n#define\tFIOSETOWN\t_IOW('f', 124, int)\t/* set owner */\n#define\tFIOGETOWN\t_IOR('f', 123, int)\t/* get owner */\n#define\tFIODTYPE\t_IOR('f', 122, int)\t/* get d_flags type part */\n#define\tFIOGETLBA\t_IOR('f', 121, int)\t/* get start blk # */\nstruct fiodgname_arg {\n\tint\tlen;\n\tvoid\t*buf;\n};\n#define\tFIODGNAME\t_IOW('f', 120, struct fiodgname_arg) /* get dev. name */\n#define\tFIONWRITE\t_IOR('f', 119, int)\t/* get # bytes (yet) to write */\n#define\tFIONSPACE\t_IOR('f', 118, int)\t/* get space in send queue */\n/* Handle lseek SEEK_DATA and SEEK_HOLE for holey file knowledge. */\n#define\tFIOSEEKDATA\t_IOWR('f', 97, off_t)\t/* SEEK_DATA */\n#define\tFIOSEEKHOLE\t_IOWR('f', 98, off_t)\t/* SEEK_HOLE */\n\n#endif /* !_SYS_FILIO_H_ */\n"
  },
  {
    "path": "freebsd-headers/sys/firmware.h",
    "content": "/*-\n * Copyright (c) 2005, Sam Leffler <sam@errno.com>\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice unmodified, this list of conditions, and the following\n *    disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR\n * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES\n * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,\n * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF\n * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/sys/firmware.h 166756 2007-02-15 17:21:31Z luigi $\n */\n#ifndef _SYS_FIRMWARE_H_\n#define _SYS_FIRMWARE_H_\n/*\n * Loadable firmware support.\n *\n * The firmware abstraction provides an interface for loading firmware\n * images into the kernel and making them available to clients.\n *\n * Firmware images are usually embedded in kernel loadable modules that can\n * be loaded on-demand or pre-loaded as desired.  Modules may contain\n * one or more firmware images that are stored as opaque data arrays\n * and registered with a unique string name. Clients request\n * firmware by name, and are returned a struct firmware * below on success.\n * The kernel keeps track of references to firmware images to allow/prevent\n * module/data unload.\n *\n * When multiple images are stored in one module, the first image is\n * treated as the master with the other images holding references\n * to it.  This means that to unload the module each dependent/subimage\n * must first have its references removed.\n * In order for automatic loading to work, the master image must have\n * the same name as the module it is embedded into.\n */\nstruct firmware {\n\tconst char\t*name;\t\t/* system-wide name */\n\tconst void\t*data;\t\t/* location of image */\n\tsize_t\t\t datasize;\t/* size of image in bytes */\n\tunsigned int\t version;\t/* version of the image */\n};\n\nconst struct firmware\t*firmware_register(const char *,\n\tconst void *, size_t, unsigned int, const struct firmware *);\nint\t firmware_unregister(const char *);\nconst struct firmware *firmware_get(const char *);\n#define\tFIRMWARE_UNLOAD\t\t0x0001\t/* unload if unreferenced */\nvoid\t\t firmware_put(const struct firmware *, int);\n#endif /* _SYS_FIRMWARE_H_ */\n"
  },
  {
    "path": "freebsd-headers/sys/fnv_hash.h",
    "content": "/*-\n * Fowler / Noll / Vo Hash (FNV Hash)\n * http://www.isthe.com/chongo/tech/comp/fnv/\n *\n * This is an implementation of the algorithms posted above.\n * This file is placed in the public domain by Peter Wemm.\n *\n * $FreeBSD: release/9.0.0/sys/sys/fnv_hash.h 139825 2005-01-07 02:29:27Z imp $\n */\n\ntypedef u_int32_t Fnv32_t;\ntypedef u_int64_t Fnv64_t;\n\n#define FNV1_32_INIT ((Fnv32_t) 33554467UL)\n#define FNV1_64_INIT ((Fnv64_t) 0xcbf29ce484222325ULL)\n\n#define FNV_32_PRIME ((Fnv32_t) 0x01000193UL)\n#define FNV_64_PRIME ((Fnv64_t) 0x100000001b3ULL)\n\nstatic __inline Fnv32_t\nfnv_32_buf(const void *buf, size_t len, Fnv32_t hval)\n{\n\tconst u_int8_t *s = (const u_int8_t *)buf;\n\n\twhile (len-- != 0) {\n\t\thval *= FNV_32_PRIME;\n\t\thval ^= *s++;\n\t}\n\treturn hval;\n}\n\nstatic __inline Fnv32_t\nfnv_32_str(const char *str, Fnv32_t hval)\n{\n\tconst u_int8_t *s = (const u_int8_t *)str;\n\tFnv32_t c;\n\n\twhile ((c = *s++) != 0) {\n\t\thval *= FNV_32_PRIME;\n\t\thval ^= c;\n\t}\n\treturn hval;\n}\n\nstatic __inline Fnv64_t\nfnv_64_buf(const void *buf, size_t len, Fnv64_t hval)\n{\n\tconst u_int8_t *s = (const u_int8_t *)buf;\n\n\twhile (len-- != 0) {\n\t\thval *= FNV_64_PRIME;\n\t\thval ^= *s++;\n\t}\n\treturn hval;\n}\n\nstatic __inline Fnv64_t\nfnv_64_str(const char *str, Fnv64_t hval)\n{\n\tconst u_int8_t *s = (const u_int8_t *)str;\n\tu_register_t c;\t\t /* 32 bit on i386, 64 bit on alpha,ia64 */\n\n\twhile ((c = *s++) != 0) {\n\t\thval *= FNV_64_PRIME;\n\t\thval ^= c;\n\t}\n\treturn hval;\n}\n"
  },
  {
    "path": "freebsd-headers/sys/gmon.h",
    "content": "/*-\n * Copyright (c) 1982, 1986, 1992, 1993\n *\tThe Regents of the University of California.  All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 4. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t@(#)gmon.h\t8.2 (Berkeley) 1/4/94\n * $FreeBSD: release/9.0.0/sys/sys/gmon.h 157268 2006-03-29 18:17:03Z jhb $\n */\n\n#ifndef _SYS_GMON_H_\n#define _SYS_GMON_H_\n\n#include <machine/profile.h>\n\n/*\n * Structure prepended to gmon.out profiling data file.\n */\nstruct gmonhdr {\n\tu_long\tlpc;\t\t/* base pc address of sample buffer */\n\tu_long\thpc;\t\t/* max pc address of sampled buffer */\n\tint\tncnt;\t\t/* size of sample buffer (plus this header) */\n\tint\tversion;\t/* version number */\n\tint\tprofrate;\t/* profiling clock rate */\n\tint\thistcounter_type; /* size (in bits) and sign of HISTCOUNTER */\n\tint\tspare[2];\t/* reserved */\n};\n#define GMONVERSION\t0x00051879\n\n/*\n * Type of histogram counters used in the kernel.\n */\n#ifdef GPROF4\n#define\tHISTCOUNTER\tint64_t\n#else\n#define\tHISTCOUNTER\tunsigned short\n#endif\n\n/*\n * Fraction of text space to allocate for histogram counters.\n * We allocate counters at the same or higher density as function\n * addresses, so that each counter belongs to a unique function.\n * A lower density of counters would give less resolution but a\n * higher density would be wasted.\n */\n#define\tHISTFRACTION\t(FUNCTION_ALIGNMENT / sizeof(HISTCOUNTER) == 0 \\\n\t\t\t ? 1 : FUNCTION_ALIGNMENT / sizeof(HISTCOUNTER))\n\n/*\n * Fraction of text space to allocate for from hash buckets.\n * The value of HASHFRACTION is based on the minimum number of bytes\n * of separation between two subroutine call points in the object code.\n * Given MIN_SUBR_SEPARATION bytes of separation the value of\n * HASHFRACTION is calculated as:\n *\n *\tHASHFRACTION = MIN_SUBR_SEPARATION / (2 * sizeof(short) - 1);\n *\n * For example, on the VAX, the shortest two call sequence is:\n *\n *\tcalls\t$0,(r0)\n *\tcalls\t$0,(r0)\n *\n * which is separated by only three bytes, thus HASHFRACTION is\n * calculated as:\n *\n *\tHASHFRACTION = 3 / (2 * 2 - 1) = 1\n *\n * Note that the division above rounds down, thus if MIN_SUBR_FRACTION\n * is less than three, this algorithm will not work!\n *\n * In practice, however, call instructions are rarely at a minimal\n * distance.  Hence, we will define HASHFRACTION to be 2 across all\n * architectures.  This saves a reasonable amount of space for\n * profiling data structures without (in practice) sacrificing\n * any granularity.\n */\n/*\n * XXX I think the above analysis completely misses the point.  I think\n * the point is that addresses in different functions must hash to\n * different values.  Since the hash is essentially division by\n * sizeof(unsigned short), the correct formula is:\n *\n * \tHASHFRACTION = MIN_FUNCTION_ALIGNMENT / sizeof(unsigned short)\n *\n * Note that he unsigned short here has nothing to do with the one for\n * HISTFRACTION.\n *\n * Hash collisions from a two call sequence don't matter.  They get\n * handled like collisions for calls to different addresses from the\n * same address through a function pointer.\n */\n#define\tHASHFRACTION\t(FUNCTION_ALIGNMENT / sizeof(unsigned short) == 0 \\\n\t\t\t ? 1 : FUNCTION_ALIGNMENT / sizeof(unsigned short))\n\n/*\n * percent of text space to allocate for tostructs with a minimum.\n */\n#define ARCDENSITY\t2\n#define MINARCS\t\t50\n\n/*\n * Limit on the number of arcs to so that arc numbers can be stored in\n * `*froms' and stored and incremented without overflow in links.\n */\n#define MAXARCS\t\t(((u_long)1 << (8 * sizeof(u_short))) - 2)\n\nstruct tostruct {\n\tu_long\tselfpc;\n\tlong\tcount;\n\tu_short\tlink;\n\tu_short pad;\n};\n\n/*\n * a raw arc, with pointers to the calling site and\n * the called site and a count.\n */\nstruct rawarc {\n\tu_long\traw_frompc;\n\tu_long\traw_selfpc;\n\tlong\traw_count;\n};\n\n/*\n * general rounding functions.\n */\n#define ROUNDDOWN(x,y)\trounddown(x,y)\n#define ROUNDUP(x,y)\troundup(x,y)\n\n/*\n * The profiling data structures are housed in this structure.\n */\nstruct gmonparam {\n\tint\t\tstate;\n\tHISTCOUNTER\t*kcount;\n\tu_long\t\tkcountsize;\n\tu_short\t\t*froms;\n\tu_long\t\tfromssize;\n\tstruct tostruct\t*tos;\n\tu_long\t\ttossize;\n\tlong\t\ttolimit;\n\tuintfptr_t\tlowpc;\n\tuintfptr_t\thighpc;\n\tu_long\t\ttextsize;\n\tu_long\t\thashfraction;\n\tint\t\tprofrate;\t/* XXX wrong type to match gmonhdr */\n\tHISTCOUNTER\t*cputime_count;\n\tint\t\tcputime_overhead;\n\tHISTCOUNTER\t*mcount_count;\n\tint\t\tmcount_overhead;\n\tint\t\tmcount_post_overhead;\n\tint\t\tmcount_pre_overhead;\n\tHISTCOUNTER\t*mexitcount_count;\n\tint\t\tmexitcount_overhead;\n\tint\t\tmexitcount_post_overhead;\n\tint\t\tmexitcount_pre_overhead;\n\tint\t\thistcounter_type;\n};\nextern struct gmonparam _gmonparam;\n\n/*\n * Possible states of profiling.\n */\n#define\tGMON_PROF_ON\t0\n#define\tGMON_PROF_BUSY\t1\n#define\tGMON_PROF_ERROR\t2\n#define\tGMON_PROF_OFF\t3\n#define\tGMON_PROF_HIRES\t4\n\n/*\n * Sysctl definitions for extracting profiling information from the kernel.\n */\n#define\tGPROF_STATE\t0\t/* int: profiling enabling variable */\n#define\tGPROF_COUNT\t1\t/* struct: profile tick count buffer */\n#define\tGPROF_FROMS\t2\t/* struct: from location hash bucket */\n#define\tGPROF_TOS\t3\t/* struct: destination/count structure */\n#define\tGPROF_GMONPARAM\t4\t/* struct: profiling parameters (see above) */\n\n#ifdef _KERNEL\n\n#define\tKCOUNT(p,index) \\\n\t((p)->kcount[(index) / (HISTFRACTION * sizeof(HISTCOUNTER))])\n#define\tPC_TO_I(p, pc)\t((uintfptr_t)(pc) - (uintfptr_t)(p)->lowpc)\n\n#ifdef GUPROF\n\n#define\tCALIB_SCALE\t1000\n\nextern int\tcputime_bias;\n\nint\tcputime(void);\nvoid\tnullfunc_loop_profiled(void);\nvoid\tnullfunc_profiled(void);\nvoid\tstartguprof(struct gmonparam *p);\nvoid\tstopguprof(struct gmonparam *p);\n\n#else /* !GUPROF */\n\n#define\tstartguprof(p)\n#define\tstopguprof(p)\n\n#endif /* GUPROF */\n\nvoid\tempty_loop(void);\nvoid\tkmupetext(uintfptr_t nhighpc);\nvoid\tmexitcount(uintfptr_t selfpc);\nvoid\tnullfunc(void);\nvoid\tnullfunc_loop(void);\n\n#else /* !_KERNEL */\n\n#include <sys/cdefs.h>\n\n__BEGIN_DECLS\nvoid\tmoncontrol(int);\nvoid\tmonstartup(u_long, u_long);\n__END_DECLS\n\n#endif /* _KERNEL */\n\n#endif /* !_SYS_GMON_H_ */\n"
  },
  {
    "path": "freebsd-headers/sys/gpio.h",
    "content": "/* $NetBSD: gpio.h,v 1.7 2009/09/25 20:27:50 mbalmer Exp $ */\n/*\t$OpenBSD: gpio.h,v 1.7 2008/11/26 14:51:20 mbalmer Exp $\t*/\n/*-\n * Copyright (c) 2009, Oleksandr Tymoshenko <gonzo@FreeBSD.org>\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice unmodified, this list of conditions, and the following\n *    disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/sys/gpio.h 213237 2010-09-28 03:24:53Z gonzo $\n *\n */\n\n/*\n * Copyright (c) 2009 Marc Balmer <marc@msys.ch>\n * Copyright (c) 2004 Alexander Yurchenko <grange@openbsd.org>\n *\n * Permission to use, copy, modify, and distribute this software for any\n * purpose with or without fee is hereby granted, provided that the above\n * copyright notice and this permission notice appear in all copies.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES\n * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF\n * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR\n * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES\n * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN\n * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF\n * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.\n */\n\n#ifndef __GPIO_H__\n#define __GPIO_H__\n\n#include <sys/ioccom.h>\n\n/* GPIO pin states */\n#define GPIO_PIN_LOW\t\t0x00\t/* low level (logical 0) */\n#define GPIO_PIN_HIGH\t\t0x01\t/* high level (logical 1) */\n\n/* Max name length of a pin */\n#define GPIOMAXNAME\t\t64\n\n/* GPIO pin configuration flags */\n#define GPIO_PIN_INPUT\t\t0x0001\t/* input direction */\n#define GPIO_PIN_OUTPUT\t\t0x0002\t/* output direction */\n#define GPIO_PIN_OPENDRAIN\t0x0004\t/* open-drain output */\n#define GPIO_PIN_PUSHPULL\t0x0008\t/* push-pull output */\n#define GPIO_PIN_TRISTATE\t0x0010\t/* output disabled */\n#define GPIO_PIN_PULLUP\t\t0x0020\t/* internal pull-up enabled */\n#define GPIO_PIN_PULLDOWN\t0x0040\t/* internal pull-down enabled */\n#define GPIO_PIN_INVIN\t\t0x0080\t/* invert input */\n#define GPIO_PIN_INVOUT\t\t0x0100\t/* invert output */\n#define GPIO_PIN_PULSATE\t0x0200\t/* pulsate in hardware */\n\nstruct gpio_pin {\n\tuint32_t gp_pin;\t\t\t/* pin number */\n\tchar gp_name[GPIOMAXNAME];\t\t/* human-readable name */\n\tuint32_t gp_caps;\t\t\t/* capabilities */\n\tuint32_t gp_flags;\t\t\t/* current flags */\n};\n\n/* GPIO pin request (read/write/toggle) */\nstruct gpio_req {\n\tuint32_t gp_pin;\t\t\t/* pin number */\n\tuint32_t gp_value;\t\t\t/* value */\n};\n\n/*\n * ioctls\n */\n#define GPIOMAXPIN\t\t_IOR('G', 0, int)\n#define\tGPIOGETCONFIG\t\t_IOWR('G', 1, struct gpio_pin)\n#define\tGPIOSETCONFIG\t\t_IOW('G', 2, struct gpio_pin)\n#define\tGPIOGET\t\t\t_IOWR('G', 3, struct gpio_req)\n#define\tGPIOSET\t\t\t_IOW('G', 4, struct gpio_req)\n#define\tGPIOTOGGLE\t\t_IOWR('G', 5, struct gpio_req)\n\n#endif /* __GPIO_H__ */\n"
  },
  {
    "path": "freebsd-headers/sys/gpt.h",
    "content": "/*-\n * Copyright (c) 2002 Marcel Moolenaar\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n *\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR\n * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES\n * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,\n * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF\n * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/sys/gpt.h 218014 2011-01-28 11:13:01Z ae $\n */\n\n#ifndef _SYS_GPT_H_\n#define\t_SYS_GPT_H_\n\n#include <sys/uuid.h>\n\nstruct gpt_hdr {\n\tchar\t\thdr_sig[8];\n#define\tGPT_HDR_SIG\t\t\"EFI PART\"\n\tuint32_t\thdr_revision;\n#define\tGPT_HDR_REVISION\t0x00010000\n\tuint32_t\thdr_size;\n\tuint32_t\thdr_crc_self;\n\tuint32_t\t__reserved;\n\tuint64_t\thdr_lba_self;\n\tuint64_t\thdr_lba_alt;\n\tuint64_t\thdr_lba_start;\n\tuint64_t\thdr_lba_end;\n\tstruct uuid\thdr_uuid;\n\tuint64_t\thdr_lba_table;\n\tuint32_t\thdr_entries;\n\tuint32_t\thdr_entsz;\n\tuint32_t\thdr_crc_table;\n\t/*\n\t * The header as defined in the EFI spec is not a multiple of 8 bytes\n\t * and given that the alignment requirement is on an 8 byte boundary,\n\t * padding will happen. We make the padding explicit so that we can\n\t * correct the value returned by sizeof() when we put the size of the\n\t * header in field hdr_size, or otherwise use offsetof().\n\t */\n\tuint32_t\tpadding;\n};\n\nstruct gpt_ent {\n\tstruct uuid\tent_type;\n\tstruct uuid\tent_uuid;\n\tuint64_t\tent_lba_start;\n\tuint64_t\tent_lba_end;\n\tuint64_t\tent_attr;\n#define\tGPT_ENT_ATTR_PLATFORM\t\t(1ULL << 0)\n#define\tGPT_ENT_ATTR_BOOTME\t\t(1ULL << 59)\n#define\tGPT_ENT_ATTR_BOOTONCE\t\t(1ULL << 58)\n#define\tGPT_ENT_ATTR_BOOTFAILED\t\t(1ULL << 57)\n\tuint16_t\tent_name[36];\t\t/* UTF-16. */\n};\n\n#define\tGPT_ENT_TYPE_UNUSED\t\t\\\n\t{0x00000000,0x0000,0x0000,0x00,0x00,{0x00,0x00,0x00,0x00,0x00,0x00}}\n#define\tGPT_ENT_TYPE_EFI\t\t\\\n\t{0xc12a7328,0xf81f,0x11d2,0xba,0x4b,{0x00,0xa0,0xc9,0x3e,0xc9,0x3b}}\n#define\tGPT_ENT_TYPE_MBR\t\t\\\n\t{0x024dee41,0x33e7,0x11d3,0x9d,0x69,{0x00,0x08,0xc7,0x81,0xf3,0x9f}}\n#define\tGPT_ENT_TYPE_FREEBSD\t\t\\\n\t{0x516e7cb4,0x6ecf,0x11d6,0x8f,0xf8,{0x00,0x02,0x2d,0x09,0x71,0x2b}}\n#define\tGPT_ENT_TYPE_FREEBSD_SWAP\t\\\n\t{0x516e7cb5,0x6ecf,0x11d6,0x8f,0xf8,{0x00,0x02,0x2d,0x09,0x71,0x2b}}\n#define\tGPT_ENT_TYPE_FREEBSD_UFS\t\\\n\t{0x516e7cb6,0x6ecf,0x11d6,0x8f,0xf8,{0x00,0x02,0x2d,0x09,0x71,0x2b}}\n#define\tGPT_ENT_TYPE_FREEBSD_VINUM\t\\\n\t{0x516e7cb8,0x6ecf,0x11d6,0x8f,0xf8,{0x00,0x02,0x2d,0x09,0x71,0x2b}}\n#define\tGPT_ENT_TYPE_FREEBSD_ZFS\t\\\n\t{0x516e7cba,0x6ecf,0x11d6,0x8f,0xf8,{0x00,0x02,0x2d,0x09,0x71,0x2b}}\n#define\tGPT_ENT_TYPE_FREEBSD_BOOT\t\\\n\t{0x83bd6b9d,0x7f41,0x11dc,0xbe,0x0b,{0x00,0x15,0x60,0xb8,0x4f,0x0f}}\n\n/*\n * The following are unused but documented here to avoid reuse.\n *\n * GPT_ENT_TYPE_FREEBSD_UFS2\t\\\n *\t{0x516e7cb7,0x6ecf,0x11d6,0x8f,0xf8,{0x00,0x02,0x2d,0x09,0x71,0x2b}}\n */\n\n/*\n * Foreign partition types that we're likely to encounter. Note that Linux\n * apparently choose to share data partitions with MS. I don't what the\n * advantage might be. I can see how sharing swap partitions is advantageous\n * though.\n */\n#define\tGPT_ENT_TYPE_MS_RESERVED\t\\\n\t{0xe3c9e316,0x0b5c,0x4db8,0x81,0x7d,{0xf9,0x2d,0xf0,0x02,0x15,0xae}}\n#define\tGPT_ENT_TYPE_MS_BASIC_DATA\t\\\n\t{0xebd0a0a2,0xb9e5,0x4433,0x87,0xc0,{0x68,0xb6,0xb7,0x26,0x99,0xc7}}\n#define\tGPT_ENT_TYPE_MS_LDM_METADATA\t\\\n\t{0x5808c8aa,0x7e8f,0x42e0,0x85,0xd2,{0xe1,0xe9,0x04,0x34,0xcf,0xb3}}\n#define\tGPT_ENT_TYPE_MS_LDM_DATA\t\\\n\t{0xaf9b60a0,0x1431,0x4f62,0xbc,0x68,{0x33,0x11,0x71,0x4a,0x69,0xad}}\n\n#define\tGPT_ENT_TYPE_LINUX_DATA\t\tGPT_ENT_TYPE_MS_BASIC_DATA\n#define\tGPT_ENT_TYPE_LINUX_RAID\t\t\\\n\t{0xa19d880f,0x05fc,0x4d3b,0xa0,0x06,{0x74,0x3f,0x0f,0x84,0x91,0x1e}}\n#define\tGPT_ENT_TYPE_LINUX_SWAP\t\t\\\n\t{0x0657fd6d,0xa4ab,0x43c4,0x84,0xe5,{0x09,0x33,0xc8,0x4b,0x4f,0x4f}}\n#define\tGPT_ENT_TYPE_LINUX_LVM\t\t\\\n\t{0xe6d6d379,0xf507,0x44c2,0xa2,0x3c,{0x23,0x8f,0x2a,0x3d,0xf9,0x28}}\n\n#define\tGPT_ENT_TYPE_APPLE_BOOT\t\t\\\n\t{0x426F6F74,0x0000,0x11aa,0xaa,0x11,{0x00,0x30,0x65,0x43,0xec,0xac}}\n#define\tGPT_ENT_TYPE_APPLE_HFS\t\t\\\n\t{0x48465300,0x0000,0x11aa,0xaa,0x11,{0x00,0x30,0x65,0x43,0xec,0xac}}\n#define\tGPT_ENT_TYPE_APPLE_UFS\t\t\\\n\t{0x55465300,0x0000,0x11aa,0xaa,0x11,{0x00,0x30,0x65,0x43,0xec,0xac}}\n#define\tGPT_ENT_TYPE_APPLE_ZFS\t\t\\\n\t{0x6a898cc3,0x1dd2,0x11b2,0x99,0xa6,{0x08,0x00,0x20,0x73,0x66,0x31}}\n#define\tGPT_ENT_TYPE_APPLE_RAID\t\t\\\n\t{0x52414944,0x0000,0x11aa,0xaa,0x22,{0x00,0x30,0x65,0x43,0xec,0xac}}\n#define\tGPT_ENT_TYPE_APPLE_RAID_OFFLINE\t\\\n\t{0x52414944,0x5f4f,0x11aa,0xaa,0x22,{0x00,0x30,0x65,0x43,0xec,0xac}}\n#define GPT_ENT_TYPE_APPLE_LABEL\t\\\n    \t{0x4C616265,0x6c00,0x11aa,0xaa,0x11,{0x00,0x30,0x65,0x43,0xec,0xac}}\n#define\tGPT_ENT_TYPE_APPLE_TV_RECOVERY\t\\\n    \t{0x5265636f,0x7665,0x11AA,0xaa,0x11,{0x00,0x30,0x65,0x43,0xec,0xac}}\n\n#define\tGPT_ENT_TYPE_NETBSD_FFS\t\t\\\n\t{0x49f48d5a,0xb10e,0x11dc,0xb9,0x9b,{0x00,0x19,0xd1,0x87,0x96,0x48}}\n#define\tGPT_ENT_TYPE_NETBSD_LFS\t\t\\\n\t{0x49f48d82,0xb10e,0x11dc,0xb9,0x9b,{0x00,0x19,0xd1,0x87,0x96,0x48}}\n#define\tGPT_ENT_TYPE_NETBSD_SWAP\t\\\n\t{0x49f48d32,0xb10e,0x11dc,0xB9,0x9B,{0x00,0x19,0xd1,0x87,0x96,0x48}}\n#define\tGPT_ENT_TYPE_NETBSD_RAID\t\\\n\t{0x49f48daa,0xb10e,0x11dc,0xb9,0x9b,{0x00,0x19,0xd1,0x87,0x96,0x48}}\n#define\tGPT_ENT_TYPE_NETBSD_CCD\t\t\\\n\t{0x2db519c4,0xb10f,0x11dc,0xb9,0x9b,{0x00,0x19,0xd1,0x87,0x96,0x48}}\n#define\tGPT_ENT_TYPE_NETBSD_CGD\t\t\\\n\t{0x2db519ec,0xb10f,0x11dc,0xb9,0x9b,{0x00,0x19,0xd1,0x87,0x96,0x48}}\n\n/*\n * Boot partition used by GRUB 2.\n */\n#define\tGPT_ENT_TYPE_BIOS_BOOT\t\t\\\n\t{0x21686148,0x6449,0x6e6f,0x74,0x4e,{0x65,0x65,0x64,0x45,0x46,0x49}}\n\n#endif /* _SYS_GPT_H_ */\n"
  },
  {
    "path": "freebsd-headers/sys/hash.h",
    "content": "/*-\n * Copyright (c) 2001 Tobias Weingartner\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR\n * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES\n * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,\n * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF\n * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n *\n * $OpenBSD: hash.h,v 1.4 2004/05/25 18:37:23 jmc Exp $\n * $FreeBSD: release/9.0.0/sys/sys/hash.h 168557 2007-04-09 22:55:14Z thompsa $\n */\n\n#ifndef _SYS_HASH_H_\n#define\t_SYS_HASH_H_\n#include <sys/types.h>\n\n/* Convenience */\n#ifndef\tHASHINIT\n#define\tHASHINIT\t5381\n#define\tHASHSTEP(x,c)\t(((x << 5) + x) + (c))\n#endif\n\n/*\n * Return a 32-bit hash of the given buffer.  The init\n * value should be 0, or the previous hash value to extend\n * the previous hash.\n */\nstatic __inline uint32_t\nhash32_buf(const void *buf, size_t len, uint32_t hash)\n{\n\tconst unsigned char *p = buf;\n\n\twhile (len--)\n\t\thash = HASHSTEP(hash, *p++);\n\n\treturn hash;\n}\n\n/*\n * Return a 32-bit hash of the given string.\n */\nstatic __inline uint32_t\nhash32_str(const void *buf, uint32_t hash)\n{\n\tconst unsigned char *p = buf;\n\n\twhile (*p)\n\t\thash = HASHSTEP(hash, *p++);\n\n\treturn hash;\n}\n\n/*\n * Return a 32-bit hash of the given string, limited by N.\n */\nstatic __inline uint32_t\nhash32_strn(const void *buf, size_t len, uint32_t hash)\n{\n\tconst unsigned char *p = buf;\n\n\twhile (*p && len--)\n\t\thash = HASHSTEP(hash, *p++);\n\n\treturn hash;\n}\n\n/*\n * Return a 32-bit hash of the given string terminated by C,\n * (as well as 0).  This is mainly here as a helper for the\n * namei() hashing of path name parts.\n */\nstatic __inline uint32_t\nhash32_stre(const void *buf, int end, const char **ep, uint32_t hash)\n{\n\tconst unsigned char *p = buf;\n\n\twhile (*p && (*p != end))\n\t\thash = HASHSTEP(hash, *p++);\n\n\tif (ep)\n\t\t*ep = p;\n\n\treturn hash;\n}\n\n/*\n * Return a 32-bit hash of the given string, limited by N,\n * and terminated by C (as well as 0).  This is mainly here\n * as a helper for the namei() hashing of path name parts.\n */\nstatic __inline uint32_t\nhash32_strne(const void *buf, size_t len, int end, const char **ep,\n    uint32_t hash)\n{\n\tconst unsigned char *p = buf;\n\n\twhile (*p && (*p != end) && len--)\n\t\thash = HASHSTEP(hash, *p++);\n\n\tif (ep)\n\t\t*ep = p;\n\n\treturn hash;\n}\n#endif /* !_SYS_HASH_H_ */\n"
  },
  {
    "path": "freebsd-headers/sys/hhook.h",
    "content": "/*-\n * Copyright (c) 2010 Lawrence Stewart <lstewart@freebsd.org>\n * Copyright (c) 2010 The FreeBSD Foundation\n * All rights reserved.\n *\n * This software was developed by Lawrence Stewart while studying at the Centre\n * for Advanced Internet Architectures, Swinburne University of Technology, made\n * possible in part by grants from the FreeBSD Foundation and Cisco University\n * Research Program Fund at Community Foundation Silicon Valley.\n *\n * Portions of this software were developed at the Centre for Advanced\n * Internet Architectures, Swinburne University of Technology, Melbourne,\n * Australia by Lawrence Stewart under sponsorship from the FreeBSD Foundation.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/sys/hhook.h 220560 2011-04-12 08:13:18Z lstewart $\n */\n\n/*\n * A KPI modelled on the pfil framework for instantiating helper hook points\n * within the kernel for use by Khelp modules. Originally released as part of\n * the NewTCP research project at Swinburne University of Technology's Centre\n * for Advanced Internet Architectures, Melbourne, Australia, which was made\n * possible in part by a grant from the Cisco University Research Program Fund\n * at Community Foundation Silicon Valley. More details are available at:\n *   http://caia.swin.edu.au/urp/newtcp/\n */\n\n#ifndef _SYS_HHOOK_H_\n#define _SYS_HHOOK_H_\n\n/* XXXLAS: Is there a way around this? */\n#include <sys/lock.h>\n#include <sys/rmlock.h>\n\n/* hhook_head flags. */\n#define\tHHH_ISINVNET\t\t0x00000001 /* Is the hook point in a vnet? */\n\n/* Flags common to  all register functions. */\n#define\tHHOOK_WAITOK\t\t0x00000001 /* Sleeping allowed. */\n#define\tHHOOK_NOWAIT\t\t0x00000002 /* Sleeping disallowed. */\n/* Flags only relevant to hhook_head_register() and hhook_head_is_virtual(). */\n#define\tHHOOK_HEADISINVNET\t0x00000100 /* Public proxy for HHH_ISINVNET. */\n\n/* Helper hook types. */\n#define\tHHOOK_TYPE_TCP\t\t1\n\nstruct helper;\nstruct osd;\n\n/* Signature for helper hook functions. */\ntypedef int (*hhook_func_t)(int32_t hhook_type, int32_t hhook_id, void *udata,\n    void *ctx_data, void *hdata, struct osd *hosd);\n\n/*\n * Information required to add/remove a helper hook function to/from a helper\n * hook point.\n */\nstruct hookinfo {\n\thhook_func_t\thook_func;\n\tstruct helper\t*hook_helper;\n\tvoid\t\t*hook_udata;\n\tint32_t\t\thook_id;\n\tint32_t\t\thook_type;\n};\n\n/*\n * Ideally this would be private but we need access to the hhh_nhooks member\n * variable in order to make the HHOOKS_RUN_IF() macro low impact.\n */\nstruct hhook_head {\n\tSTAILQ_HEAD(hhook_list, hhook)\thhh_hooks;\n\tstruct rmlock\t\t\thhh_lock;\n\tint32_t\t\t\t\thhh_id;\n\tint32_t\t\t\t\thhh_nhooks;\n\tint32_t\t\t\t\thhh_type;\n\tuint32_t\t\t\thhh_flags;\n\tvolatile uint32_t\t\thhh_refcount;\n\tLIST_ENTRY(hhook_head)\t\thhh_next;\n};\n\n/* Public KPI functions. */\nvoid\thhook_run_hooks(struct hhook_head *hhh, void *ctx_data, struct osd *hosd);\n\nint\thhook_add_hook(struct hhook_head *hhh, struct hookinfo *hki,\n    uint32_t flags);\n\nint\thhook_add_hook_lookup(struct hookinfo *hki, uint32_t flags);\n\nint\thhook_remove_hook(struct hhook_head *hhh, struct hookinfo *hki);\n\nint\thhook_remove_hook_lookup(struct hookinfo *hki);\n\nint\thhook_head_register(int32_t hhook_type, int32_t hhook_id,\n    struct hhook_head **hhh, uint32_t flags);\n\nint\thhook_head_deregister(struct hhook_head *hhh);\n\nint\thhook_head_deregister_lookup(int32_t hhook_type, int32_t hhook_id);\n\nstruct hhook_head * hhook_head_get(int32_t hhook_type, int32_t hhook_id);\n\nvoid\thhook_head_release(struct hhook_head *hhh);\n\nuint32_t hhook_head_is_virtualised(struct hhook_head *hhh);\n\nuint32_t hhook_head_is_virtualised_lookup(int32_t hook_type, int32_t hook_id);\n\n/*\n * A wrapper around hhook_run_hooks() that only calls the function if at least\n * one helper hook function is registered for the specified helper hook point.\n */\n#define\tHHOOKS_RUN_IF(hhh, ctx_data, hosd) do {\t\t\t\t\\\n\tif (hhh != NULL && hhh->hhh_nhooks > 0)\t\t\t\t\\\n\t\thhook_run_hooks(hhh, ctx_data, hosd);\t\t\t\\\n} while (0)\n\n/*\n * WARNING: This macro should only be used in code paths that execute\n * infrequently, otherwise the refcounting overhead would be excessive.\n *\n * A similar wrapper to HHOOKS_RUN_IF() for situations where the caller prefers\n * not to lookup and store the appropriate hhook_head pointer themselves.\n */\n#define\tHHOOKS_RUN_LOOKUP_IF(hhook_type, hhook_id, ctx_data, hosd) do {\t\\\n\tstruct hhook_head *_hhh;\t\t\t\t\t\\\n\t\t\t\t\t\t\t\t\t\\\n\t_hhh = hhook_head_get(hhook_type, hhook_id);\t\t\t\\\n\tif (_hhh != NULL) {\t\t\t\t\t\t\\\n\t\tif (_hhh->hhh_nhooks > 0)\t\t\t\t\\\n\t\t\thhook_run_hooks(_hhh, ctx_data, hosd);\t\t\\\n\t\thhook_head_release(_hhh);\t\t\t\t\\\n\t}\t\t\t\t\t\t\t\t\\\n} while (0)\n\n#endif /* _SYS_HHOOK_H_ */\n"
  },
  {
    "path": "freebsd-headers/sys/iconv.h",
    "content": "/*-\n * Copyright (c) 2000-2001 Boris Popov\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/sys/iconv.h 206361 2010-04-07 16:50:38Z joel $\n */\n#ifndef _SYS_ICONV_H_\n#define _SYS_ICONV_H_\n\n#define\tICONV_CSNMAXLEN\t\t31\t/* maximum length of charset name */\n#define\tICONV_CNVNMAXLEN\t31\t/* maximum length of converter name */\n/* maximum size of data associated with cs pair */\n#define\tICONV_CSMAXDATALEN\t(sizeof(caddr_t) * 0x200 + sizeof(uint32_t) * 0x200 * 0x80)\n\n#define\tXLAT16_ACCEPT_NULL_OUT\t\t0x01000000\n#define\tXLAT16_ACCEPT_NULL_IN\t\t0x02000000\n#define\tXLAT16_HAS_LOWER_CASE\t\t0x04000000\n#define\tXLAT16_HAS_UPPER_CASE\t\t0x08000000\n#define\tXLAT16_HAS_FROM_LOWER_CASE\t0x10000000\n#define\tXLAT16_HAS_FROM_UPPER_CASE\t0x20000000\n#define\tXLAT16_IS_3BYTE_CHR\t\t0x40000000\n\n#define\tKICONV_LOWER\t\t1\t/* tolower converted character */\n#define\tKICONV_UPPER\t\t2\t/* toupper converted character */\n#define\tKICONV_FROM_LOWER\t4\t/* tolower source character, then convert */\n#define\tKICONV_FROM_UPPER\t8\t/* toupper source character, then convert */\n#define\tKICONV_WCTYPE\t\t16\t/* towlower/towupper characters */\n\n#define\tKICONV_WCTYPE_NAME\t\"_wctype\"\n\n/*\n * Entry for cslist sysctl\n */\n#define\tICONV_CSPAIR_INFO_VER\t1\n\nstruct iconv_cspair_info {\n\tint\tcs_version;\n\tint\tcs_id;\n\tint\tcs_base;\n\tint\tcs_refcount;\n\tchar\tcs_to[ICONV_CSNMAXLEN];\n\tchar\tcs_from[ICONV_CSNMAXLEN];\n};\n\n/*\n * Paramters for 'add' sysctl\n */\n#define\tICONV_ADD_VER\t1\n\nstruct iconv_add_in {\n\tint\tia_version;\n\tchar\tia_converter[ICONV_CNVNMAXLEN];\n\tchar\tia_to[ICONV_CSNMAXLEN];\n\tchar\tia_from[ICONV_CSNMAXLEN];\n\tint\tia_datalen;\n\tconst void *ia_data;\n};\n\nstruct iconv_add_out {\n\tint\tia_csid;\n};\n\n#ifndef _KERNEL\n\n__BEGIN_DECLS\n\n#define\tENCODING_UNICODE\t\"UTF-16BE\"\n#define\tKICONV_VENDOR_MICSFT\t1\t/* Microsoft Vendor Code for quirk */\n\nint   kiconv_add_xlat_table(const char *, const char *, const u_char *);\nint   kiconv_add_xlat16_cspair(const char *, const char *, int);\nint   kiconv_add_xlat16_cspairs(const char *, const char *);\nint   kiconv_add_xlat16_table(const char *, const char *, const void *, int);\nint   kiconv_lookupconv(const char *drvname);\nint   kiconv_lookupcs(const char *tocode, const char *fromcode);\nconst char *kiconv_quirkcs(const char *, int);\n\n__END_DECLS\n\n#else /* !_KERNEL */\n\n#include <sys/kobj.h>\n#include <sys/module.h>\t\t\t/* can't avoid that */\n#include <sys/queue.h>\t\t\t/* can't avoid that */\n#include <sys/sysctl.h>\t\t\t/* can't avoid that */\n\nstruct iconv_cspair;\nstruct iconv_cspairdata;\n\n/*\n * iconv converter class definition\n */\nstruct iconv_converter_class {\n\tKOBJ_CLASS_FIELDS;\n\tTAILQ_ENTRY(iconv_converter_class)\tcc_link;\n};\n\nstruct iconv_cspair {\n\tint\t\tcp_id;\t\t/* unique id of charset pair */\n\tint\t\tcp_refcount;\t/* number of references from other pairs */\n\tconst char *\tcp_from;\n\tconst char *\tcp_to;\n\tvoid *\t\tcp_data;\n\tstruct iconv_converter_class * cp_dcp;\n\tstruct iconv_cspair *cp_base;\n\tTAILQ_ENTRY(iconv_cspair)\tcp_link;\n};\n\n#define\tKICONV_CONVERTER(name,size)\t\t\t\\\n    static struct iconv_converter_class iconv_ ## name ## _class = { \\\n\t\"iconv_\"#name, iconv_ ## name ## _methods, size, NULL \\\n    };\t\t\t\t\t\t\t\\\n    static moduledata_t iconv_ ## name ## _mod = {\t\\\n\t\"iconv_\"#name, iconv_converter_handler,\t\t\\\n\t(void*)&iconv_ ## name ## _class\t\t\\\n    };\t\t\t\t\t\t\t\\\n    DECLARE_MODULE(iconv_ ## name, iconv_ ## name ## _mod, SI_SUB_DRIVERS, SI_ORDER_ANY);\n\n#define\tKICONV_CES(name,size)\t\t\t\t\\\n    static DEFINE_CLASS(iconv_ces_ ## name, iconv_ces_ ## name ## _methods, (size)); \\\n    static moduledata_t iconv_ces_ ## name ## _mod = {\t\\\n\t\"iconv_ces_\"#name, iconv_cesmod_handler,\t\\\n\t(void*)&iconv_ces_ ## name ## _class\t\t\\\n    };\t\t\t\t\t\t\t\\\n    DECLARE_MODULE(iconv_ces_ ## name, iconv_ces_ ## name ## _mod, SI_SUB_DRIVERS, SI_ORDER_ANY);\n\n#ifdef MALLOC_DECLARE\nMALLOC_DECLARE(M_ICONV);\n#endif\n\n/*\n * Basic conversion functions\n */\nint iconv_open(const char *to, const char *from, void **handle);\nint iconv_close(void *handle);\nint iconv_conv(void *handle, const char **inbuf,\n\tsize_t *inbytesleft, char **outbuf, size_t *outbytesleft);\nint iconv_conv_case(void *handle, const char **inbuf,\n\tsize_t *inbytesleft, char **outbuf, size_t *outbytesleft, int casetype);\nint iconv_convchr(void *handle, const char **inbuf,\n\tsize_t *inbytesleft, char **outbuf, size_t *outbytesleft);\nint iconv_convchr_case(void *handle, const char **inbuf,\n\tsize_t *inbytesleft, char **outbuf, size_t *outbytesleft, int casetype);\nchar* iconv_convstr(void *handle, char *dst, const char *src);\nvoid* iconv_convmem(void *handle, void *dst, const void *src, int size);\nint iconv_vfs_refcount(const char *fsname);\n\nint towlower(int c, void *handle);\nint towupper(int c, void *handle);\n\n/*\n * Bridge struct of iconv functions\n */\nstruct iconv_functions {\n\tint (*open)(const char *to, const char *from, void **handle);\n\tint (*close)(void *handle);\n\tint (*conv)(void *handle, const char **inbuf, size_t *inbytesleft,\n\t\tchar **outbuf, size_t *outbytesleft);\n\tint (*conv_case)(void *handle, const char **inbuf, size_t *inbytesleft,\n\t\tchar **outbuf, size_t *outbytesleft, int casetype);\n\tint (*convchr)(void *handle, const char **inbuf, size_t *inbytesleft,\n\t\tchar **outbuf, size_t *outbytesleft);\n\tint (*convchr_case)(void *handle, const char **inbuf, size_t *inbytesleft,\n\t\tchar **outbuf, size_t *outbytesleft, int casetype);\n};\n\n#define VFS_DECLARE_ICONV(fsname)\t\t\t\t\t\\\n\tstatic struct iconv_functions fsname ## _iconv_core = {\t\t\\\n\t\ticonv_open,\t\t\t\t\t\t\\\n\t\ticonv_close,\t\t\t\t\t\t\\\n\t\ticonv_conv,\t\t\t\t\t\t\\\n\t\ticonv_conv_case,\t\t\t\t\t\\\n\t\ticonv_convchr,\t\t\t\t\t\t\\\n\t\ticonv_convchr_case\t\t\t\t\t\\\n\t};\t\t\t\t\t\t\t\t\\\n\textern struct iconv_functions *fsname ## _iconv;\t\t\\\n\tstatic int fsname ## _iconv_mod_handler(module_t mod,\t\t\\\n\t\tint type, void *d);\t\t\t\t\t\\\n\tstatic int\t\t\t\t\t\t\t\\\n\tfsname ## _iconv_mod_handler(module_t mod, int type, void *d)\t\\\n\t{\t\t\t\t\t\t\t\t\\\n\t\tint error = 0;\t\t\t\t\t\t\\\n\t\tswitch(type) {\t\t\t\t\t\t\\\n\t\tcase MOD_LOAD:\t\t\t\t\t\t\\\n\t\t\tfsname ## _iconv = & fsname ## _iconv_core;\t\\\n\t\t\tbreak;\t\t\t\t\t\t\\\n\t\tcase MOD_UNLOAD:\t\t\t\t\t\\\n\t\t\terror = iconv_vfs_refcount(#fsname);\t\t\\\n\t\t\tif (error)\t\t\t\t\t\\\n\t\t\t\treturn (EBUSY);\t\t\t\t\\\n\t\t\tfsname ## _iconv = NULL;\t\t\t\\\n\t\t\tbreak;\t\t\t\t\t\t\\\n\t\tdefault:\t\t\t\t\t\t\\\n\t\t\terror = EINVAL;\t\t\t\t\t\\\n\t\t\tbreak;\t\t\t\t\t\t\\\n\t\t}\t\t\t\t\t\t\t\\\n\t\treturn (error);\t\t\t\t\t\t\\\n\t}\t\t\t\t\t\t\t\t\\\n\tstatic moduledata_t fsname ## _iconv_mod = {\t\t\t\\\n\t\t#fsname\"_iconv\",\t\t\t\t\t\\\n\t\tfsname ## _iconv_mod_handler,\t\t\t\t\\\n\t\tNULL\t\t\t\t\t\t\t\\\n\t};\t\t\t\t\t\t\t\t\\\n\tDECLARE_MODULE(fsname ## _iconv, fsname ## _iconv_mod,\t\t\\\n\t\t       SI_SUB_DRIVERS, SI_ORDER_ANY);\t\t\t\\\n\tMODULE_DEPEND(fsname ## _iconv, fsname, 1, 1, 1);\t\t\\\n\tMODULE_DEPEND(fsname ## _iconv, libiconv, 2, 2, 2);\t\t\\\n\tMODULE_VERSION(fsname ## _iconv, 1)\n\n/*\n * Internal functions\n */\nint iconv_lookupcp(char **cpp, const char *s);\n\nint iconv_converter_initstub(struct iconv_converter_class *dp);\nint iconv_converter_donestub(struct iconv_converter_class *dp);\nint iconv_converter_tolowerstub(int c, void *handle);\nint iconv_converter_handler(module_t mod, int type, void *data);\n\n#ifdef ICONV_DEBUG\n#define ICDEBUG(format, ...) printf(\"%s: \"format, __func__ , __VA_ARGS__)\n#else\n#define ICDEBUG(format, ...)\n#endif\n\n#endif /* !_KERNEL */\n\n#endif /* !_SYS_ICONV_H_ */\n"
  },
  {
    "path": "freebsd-headers/sys/imgact.h",
    "content": "/*-\n * Copyright (c) 1993, David Greenman\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 4. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/sys/imgact.h 217151 2011-01-08 16:13:44Z kib $\n */\n\n#ifndef _SYS_IMGACT_H_\n#define\t_SYS_IMGACT_H_\n\n#include <sys/uio.h>\n\n#include <vm/vm.h>\n\n#define MAXSHELLCMDLEN\tPAGE_SIZE\n\nstruct image_args {\n\tchar *buf;\t\t/* pointer to string buffer */\n\tchar *begin_argv;\t/* beginning of argv in buf */\n\tchar *begin_envv;\t/* beginning of envv in buf */\n\tchar *endp;\t\t/* current `end' pointer of arg & env strings */\n\tchar *fname;            /* pointer to filename of executable (system space) */\n\tchar *fname_buf;\t/* pointer to optional malloc(M_TEMP) buffer */\n\tint stringspace;\t/* space left in arg & env buffer */\n\tint argc;\t\t/* count of argument strings */\n\tint envc;\t\t/* count of environment strings */\n\tint fd;\t\t\t/* file descriptor of the executable */\n};\n\nstruct image_params {\n\tstruct proc *proc;\t/* our process struct */\n\tstruct label *execlabel;\t/* optional exec label */\n\tstruct vnode *vp;\t/* pointer to vnode of file to exec */\n\tstruct vm_object *object;\t/* The vm object for this vp */\n\tstruct vattr *attr;\t/* attributes of file */\n\tconst char *image_header; /* head of file to exec */\n\tunsigned long entry_addr; /* entry address of target executable */\n\tunsigned long reloc_base; /* load address of image */\n\tchar vmspace_destroyed;\t/* flag - we've blown away original vm space */\n\tchar interpreted;\t/* flag - this executable is interpreted */\n\tchar opened;\t\t/* flag - we have opened executable vnode */\n\tchar *interpreter_name;\t/* name of the interpreter */\n\tvoid *auxargs;\t\t/* ELF Auxinfo structure pointer */\n\tstruct sf_buf *firstpage;\t/* first page that we mapped */\n\tunsigned long ps_strings; /* PS_STRINGS for BSD/OS binaries */\n\tsize_t auxarg_size;\n\tstruct image_args *args;\t/* system call arguments */\n\tstruct sysentvec *sysent;\t/* system entry vector */\n\tchar *execpath;\n\tunsigned long execpathp;\n\tchar *freepath;\n\tunsigned long canary;\n\tint canarylen;\n\tunsigned long pagesizes;\n\tint pagesizeslen;\n\tvm_prot_t stack_prot;\n};\n\n#ifdef _KERNEL\nstruct sysentvec;\nstruct thread;\n\n#define IMGACT_CORE_COMPRESS\t0x01\n\nint\texec_alloc_args(struct image_args *);\nint\texec_check_permissions(struct image_params *);\nregister_t *exec_copyout_strings(struct image_params *);\nvoid\texec_free_args(struct image_args *);\nint\texec_new_vmspace(struct image_params *, struct sysentvec *);\nvoid\texec_setregs(struct thread *, struct image_params *, u_long);\nint\texec_shell_imgact(struct image_params *);\nint\texec_copyin_args(struct image_args *, char *, enum uio_seg,\n\tchar **, char **);\n#endif\n\n#endif /* !_SYS_IMGACT_H_ */\n"
  },
  {
    "path": "freebsd-headers/sys/imgact_aout.h",
    "content": "/*-\n * Copyright (c) 1992, 1993\n *\tThe Regents of the University of California.  All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 4. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\tfrom: @(#)exec.h\t8.1 (Berkeley) 6/11/93\n * $FreeBSD: release/9.0.0/sys/sys/imgact_aout.h 204552 2010-03-02 06:58:58Z alfred $\n */\n\n#ifndef\t_IMGACT_AOUT_H_\n#define\t_IMGACT_AOUT_H_\n\n#define N_GETMAGIC(ex) \\\n\t( le32toh((ex).a_midmag) & 0xffff )\n#define N_GETMID(ex) \\\n\t( (N_GETMAGIC_NET(ex) == ZMAGIC) ? N_GETMID_NET(ex) : \\\n\t((ex).a_midmag >> 16) & 0x03ff )\n#define N_GETFLAG(ex) \\\n\t( (N_GETMAGIC_NET(ex) == ZMAGIC) ? N_GETFLAG_NET(ex) : \\\n\t((ex).a_midmag >> 26) & 0x3f )\n#define N_SETMAGIC(ex,mag,mid,flag) \\\n\t( (ex).a_midmag = htole32((((flag) & 0x3f) <<26) | \\\n\t(((mid) & 0x03ff) << 16) | \\\n\t((mag) & 0xffff)) )\n\n#define N_GETMAGIC_NET(ex) \\\n\t(ntohl((ex).a_midmag) & 0xffff)\n#define N_GETMID_NET(ex) \\\n\t((ntohl((ex).a_midmag) >> 16) & 0x03ff)\n#define N_GETFLAG_NET(ex) \\\n\t((ntohl((ex).a_midmag) >> 26) & 0x3f)\n#define N_SETMAGIC_NET(ex,mag,mid,flag) \\\n\t( (ex).a_midmag = htonl( (((flag)&0x3f)<<26) | (((mid)&0x03ff)<<16) \\\n\t| (((mag)&0xffff)) ) )\n\n#define N_ALIGN(ex,x) \\\n\t(N_GETMAGIC(ex) == ZMAGIC || N_GETMAGIC(ex) == QMAGIC || \\\n\t N_GETMAGIC_NET(ex) == ZMAGIC || N_GETMAGIC_NET(ex) == QMAGIC ? \\\n\t ((x) + __LDPGSZ - 1) & ~(uint32_t)(__LDPGSZ - 1) : (x))\n\n/* Valid magic number check. */\n#define\tN_BADMAG(ex) \\\n\t(N_GETMAGIC(ex) != OMAGIC && N_GETMAGIC(ex) != NMAGIC && \\\n\t N_GETMAGIC(ex) != ZMAGIC && N_GETMAGIC(ex) != QMAGIC && \\\n\t N_GETMAGIC_NET(ex) != OMAGIC && N_GETMAGIC_NET(ex) != NMAGIC && \\\n\t N_GETMAGIC_NET(ex) != ZMAGIC && N_GETMAGIC_NET(ex) != QMAGIC)\n\n\n/* Address of the bottom of the text segment. */\n/*\n * This can not be done right.  Abuse a_entry in some cases to handle kernels.\n */\n#define N_TXTADDR(ex) \\\n\t((N_GETMAGIC(ex) == OMAGIC || N_GETMAGIC(ex) == NMAGIC || \\\n\tN_GETMAGIC(ex) == ZMAGIC) ? \\\n\t(le32toh((ex).a_entry) < le32toh((ex).a_text) ? 0 : \\\n\tle32toh((ex).a_entry) & ~__LDPGSZ) : __LDPGSZ)\n\n/* Address of the bottom of the data segment. */\n#define N_DATADDR(ex) \\\n\tN_ALIGN(ex, N_TXTADDR(ex) + le32toh((ex).a_text))\n\n/* Text segment offset. */\n#define\tN_TXTOFF(ex) \\\n\t(N_GETMAGIC(ex) == ZMAGIC ? __LDPGSZ : (N_GETMAGIC(ex) == QMAGIC || \\\n\tN_GETMAGIC_NET(ex) == ZMAGIC) ? 0 : sizeof(struct exec))\n\n/* Data segment offset. */\n#define\tN_DATOFF(ex) \\\n\tN_ALIGN(ex, N_TXTOFF(ex) + le32toh((ex).a_text))\n\n/* Relocation table offset. */\n#define N_RELOFF(ex) \\\n\tN_ALIGN(ex, N_DATOFF(ex) + le32toh((ex).a_data))\n\n/* Symbol table offset. */\n#define N_SYMOFF(ex) \\\n\t(N_RELOFF(ex) + le32toh((ex).a_trsize) + le32toh((ex).a_drsize))\n\n/* String table offset. */\n#define\tN_STROFF(ex) \t(N_SYMOFF(ex) + le32toh((ex).a_syms))\n\n/*\n * Header prepended to each a.out file.\n * Only manipulate the a_midmag field via the\n * N_SETMAGIC/N_GET{MAGIC,MID,FLAG} macros.\n */\n\nstruct exec {\n     uint32_t\ta_midmag;\t/* flags<<26 | mid<<16 | magic */\n     uint32_t\ta_text;\t\t/* text segment size */\n     uint32_t\ta_data;\t\t/* initialized data size */\n     uint32_t\ta_bss;\t\t/* uninitialized data size */\n     uint32_t\ta_syms;\t\t/* symbol table size */\n     uint32_t\ta_entry;\t/* entry point */\n     uint32_t\ta_trsize;\t/* text relocation size */\n     uint32_t\ta_drsize;\t/* data relocation size */\n};\n#define a_magic a_midmag /* XXX Hack to work with imgact_{aout,gzip}.c */\n\n/* a_magic */\n#define\tOMAGIC\t\t0407\t/* old impure format */\n#define\tNMAGIC\t\t0410\t/* read-only text */\n#define\tZMAGIC\t\t0413\t/* demand load format */\n#define QMAGIC          0314    /* \"compact\" demand load format */\n\n/* a_mid */\n#define\tMID_ZERO\t0\t/* unknown - implementation dependent */\n#define\tMID_SUN010\t1\t/* sun 68010/68020 binary */\n#define\tMID_SUN020\t2\t/* sun 68020-only binary */\n#define MID_I386\t134\t/* i386 BSD binary */\n#define MID_SPARC\t138\t/* sparc */\n#define MID_ARM6\t143\t/* ARM6 */\n#define\tMID_HP200\t200\t/* hp200 (68010) BSD binary */\n#define\tMID_HP300\t300\t/* hp300 (68020+68881) BSD binary */\n#define\tMID_HPUX\t0x20C\t/* hp200/300 HP-UX binary */\n#define\tMID_HPUX800     0x20B   /* hp800 HP-UX binary */\n\n/*\n * a_flags\n */\n#define EX_PIC\t\t0x10\t/* contains position independent code */\n#define EX_DYNAMIC\t0x20\t/* contains run-time link-edit info */\n#define EX_DPMASK\t0x30\t/* mask for the above */\n\n#ifdef _KERNEL\nstruct thread;\nstruct vnode;\n\nint\taout_coredump(struct thread *td, struct vnode *vp, off_t limit,\n    int flags);\n#endif\n\n#endif /* !_IMGACT_AOUT_H_ */\n"
  },
  {
    "path": "freebsd-headers/sys/imgact_elf.h",
    "content": "/*-\n * Copyright (c) 1995-1996 Sren Schmidt\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer\n *    in this position and unchanged.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. The name of the author may not be used to endorse or promote products\n *    derived from this software without specific prior written permission\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR\n * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES\n * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,\n * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF\n * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/sys/imgact_elf.h 210446 2010-07-24 14:23:06Z kib $\n */\n\n#ifndef _SYS_IMGACT_ELF_H_\n#define\t_SYS_IMGACT_ELF_H_\n\n#include <machine/elf.h>\n\n#ifdef _KERNEL\n\n#define\tAUXARGS_ENTRY(pos, id, val) {suword(pos++, id); suword(pos++, val);}\n\nstruct thread;\n\n/*\n * Structure used to pass infomation from the loader to the\n * stack fixup routine.\n */\ntypedef struct {\n\tElf_Ssize\texecfd;\n\tElf_Size\tphdr;\n\tElf_Size\tphent;\n\tElf_Size\tphnum;\n\tElf_Size\tpagesz;\n\tElf_Size\tbase;\n\tElf_Size\tflags;\n\tElf_Size\tentry;\n} __ElfN(Auxargs);\n\ntypedef struct {\n\tElf_Note\thdr;\n\tconst char *\tvendor;\n\tint\t\tflags;\n\tboolean_t\t(*trans_osrel)(const Elf_Note *, int32_t *);\n#define\tBN_CAN_FETCH_OSREL\t0x0001\t/* Deprecated. */\n#define\tBN_TRANSLATE_OSREL\t0x0002\t/* Use trans_osrel to fetch osrel */\n\t\t/* after checking the image ABI specification, if needed. */\n} Elf_Brandnote;\n\ntypedef struct {\n\tint brand;\n\tint machine;\n\tconst char *compat_3_brand;\t/* pre Binutils 2.10 method (FBSD 3) */\n\tconst char *emul_path;\n\tconst char *interp_path;\n\tstruct sysentvec *sysvec;\n\tconst char *interp_newpath;\n\tint flags;\n\tElf_Brandnote *brand_note;\n#define\tBI_CAN_EXEC_DYN\t\t0x0001\n#define\tBI_BRAND_NOTE\t\t0x0002\t/* May have note.ABI-tag section. */\n#define\tBI_BRAND_NOTE_MANDATORY\t0x0004\t/* Must have note.ABI-tag section. */\n} __ElfN(Brandinfo);\n\n__ElfType(Auxargs);\n__ElfType(Brandinfo);\n\n#define\tMAX_BRANDS\t8\n\nint\t__elfN(brand_inuse)(Elf_Brandinfo *entry);\nint\t__elfN(insert_brand_entry)(Elf_Brandinfo *entry);\nint\t__elfN(remove_brand_entry)(Elf_Brandinfo *entry);\nint\t__elfN(freebsd_fixup)(register_t **, struct image_params *);\nint\t__elfN(coredump)(struct thread *, struct vnode *, off_t, int);\n\n/* Machine specific function to dump per-thread information. */\nvoid\t__elfN(dump_thread)(struct thread *, void *, size_t *);\n\nextern int __elfN(fallback_brand);\nextern Elf_Brandnote __elfN(freebsd_brandnote);\nextern Elf_Brandnote __elfN(kfreebsd_brandnote);\n#endif /* _KERNEL */\n\n#endif /* !_SYS_IMGACT_ELF_H_ */\n"
  },
  {
    "path": "freebsd-headers/sys/inflate.h",
    "content": "/*-\n * ----------------------------------------------------------------------------\n * \"THE BEER-WARE LICENSE\" (Revision 42):\n * <phk@FreeBSD.org> wrote this file.  As long as you retain this notice you\n * can do whatever you want with this stuff. If we meet some day, and you think\n * this stuff is worth it, you can buy me a beer in return.   Poul-Henning Kamp\n * ----------------------------------------------------------------------------\n *\n * $FreeBSD: release/9.0.0/sys/sys/inflate.h 139825 2005-01-07 02:29:27Z imp $\n *\n */\n#ifndef\t_SYS_INFLATE_H_\n#define\t_SYS_INFLATE_H_\n\n#if defined(_KERNEL) || defined(KZIP)\n\n#define GZ_EOF -1\n\n#define GZ_WSIZE 0x8000\n\n/*\n * Global variables used by inflate and friends.\n * This structure is used in order to make inflate() reentrant.\n */\nstruct inflate {\n\t/* Public part */\n\n\t/* This pointer is passed along to the two functions below */\n\tvoid           *gz_private;\n\n\t/* Fetch next character to be uncompressed */\n\tint             (*gz_input)(void *);\n\n\t/* Dispose of uncompressed characters */\n\tint             (*gz_output)(void *, u_char *, u_long);\n\n\t/* Private part */\n\tu_long          gz_bb;\t/* bit buffer */\n\tunsigned        gz_bk;\t/* bits in bit buffer */\n\tunsigned        gz_hufts;\t/* track memory usage */\n\tstruct huft    *gz_fixed_tl;\t/* must init to NULL !! */\n\tstruct huft    *gz_fixed_td;\n\tint             gz_fixed_bl;\n\tint             gz_fixed_bd;\n\tu_char         *gz_slide;\n\tunsigned        gz_wp;\n};\n\nint inflate(struct inflate *);\n\n#endif\t/* _KERNEL || KZIP */\n\n#endif\t/* ! _SYS_INFLATE_H_ */\n"
  },
  {
    "path": "freebsd-headers/sys/interrupt.h",
    "content": "/*-\n * Copyright (c) 1997, Stefan Esser <se@freebsd.org>\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice unmodified, this list of conditions, and the following\n *    disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR\n * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES\n * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,\n * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF\n * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/sys/interrupt.h 224187 2011-07-18 15:19:40Z attilio $\n */\n\n#ifndef _SYS_INTERRUPT_H_\n#define _SYS_INTERRUPT_H_\n\n#include <sys/_lock.h>\n#include <sys/_mutex.h>\n\nstruct intr_event;\nstruct intr_thread;\nstruct trapframe;\n\n/*\n * Describe a hardware interrupt handler.\n *\n * Multiple interrupt handlers for a specific event can be chained\n * together.\n */\nstruct intr_handler {\n\tdriver_filter_t\t*ih_filter;\t/* Filter handler function. */\n\tdriver_intr_t\t*ih_handler;\t/* Threaded handler function. */\n\tvoid\t\t*ih_argument;\t/* Argument to pass to handlers. */\n\tint\t\t ih_flags;\n\tchar\t\t ih_name[MAXCOMLEN + 1]; /* Name of handler. */\n\tstruct intr_event *ih_event;\t/* Event we are connected to. */\n\tint\t\t ih_need;\t/* Needs service. */\n\tTAILQ_ENTRY(intr_handler) ih_next; /* Next handler for this event. */\n\tu_char\t\t ih_pri;\t/* Priority of this handler. */\n\tstruct intr_thread *ih_thread;\t/* Ithread for filtered handler. */\n};\n\n/* Interrupt handle flags kept in ih_flags */\n#define\tIH_EXCLUSIVE\t0x00000002\t/* Exclusive interrupt. */\n#define\tIH_ENTROPY\t0x00000004\t/* Device is a good entropy source. */\n#define\tIH_DEAD\t\t0x00000008\t/* Handler should be removed. */\n#define\tIH_MPSAFE\t0x80000000\t/* Handler does not need Giant. */\n\n/*\n * Describe an interrupt event.  An event holds a list of handlers.\n * The 'pre_ithread', 'post_ithread', 'post_filter', and 'assign_cpu'\n * hooks are used to invoke MD code for certain operations.\n *\n * The 'pre_ithread' hook is called when an interrupt thread for\n * handlers without filters is scheduled.  It is responsible for\n * ensuring that 1) the system won't be swamped with an interrupt\n * storm from the associated source while the ithread runs and 2) the\n * current CPU is able to receive interrupts from other interrupt\n * sources.  The first is usually accomplished by disabling\n * level-triggered interrupts until the ithread completes.  The second\n * is accomplished on some platforms by acknowledging the interrupt\n * via an EOI.\n *\n * The 'post_ithread' hook is invoked when an ithread finishes.  It is\n * responsible for ensuring that the associated interrupt source will\n * trigger an interrupt when it is asserted in the future.  Usually\n * this is implemented by enabling a level-triggered interrupt that\n * was previously disabled via the 'pre_ithread' hook.\n *\n * The 'post_filter' hook is invoked when a filter handles an\n * interrupt.  It is responsible for ensuring that the current CPU is\n * able to receive interrupts again.  On some platforms this is done\n * by acknowledging the interrupts via an EOI.\n *\n * The 'assign_cpu' hook is used to bind an interrupt source to a\n * specific CPU.  If the interrupt cannot be bound, this function may\n * return an error.\n *\n * Note that device drivers may also use interrupt events to manage\n * multiplexing interrupt interrupt handler into handlers for child\n * devices.  In that case, the above hooks are not used.  The device\n * can create an event for its interrupt resource and register child\n * event handlers with that event.  It can then use\n * intr_event_execute_handlers() to execute non-filter handlers.\n * Currently filter handlers are not supported by this, but that can\n * be added by splitting out the filter loop from intr_event_handle()\n * if desired.\n */\nstruct intr_event {\n\tTAILQ_ENTRY(intr_event) ie_list;\n\tTAILQ_HEAD(, intr_handler) ie_handlers; /* Interrupt handlers. */\n\tchar\t\tie_name[MAXCOMLEN + 1]; /* Individual event name. */\n\tchar\t\tie_fullname[MAXCOMLEN + 1];\n\tstruct mtx\tie_lock;\n\tvoid\t\t*ie_source;\t/* Cookie used by MD code. */\n\tstruct intr_thread *ie_thread;\t/* Thread we are connected to. */\n\tvoid\t\t(*ie_pre_ithread)(void *);\n\tvoid\t\t(*ie_post_ithread)(void *);\n\tvoid\t\t(*ie_post_filter)(void *);\n\tint\t\t(*ie_assign_cpu)(void *, u_char);\n\tint\t\tie_flags;\n\tint\t\tie_count;\t/* Loop counter. */\n\tint\t\tie_warncnt;\t/* Rate-check interrupt storm warns. */\n\tstruct timeval\tie_warntm;\n\tint\t\tie_irq;\t\t/* Physical irq number if !SOFT. */\n\tu_char\t\tie_cpu;\t\t/* CPU this event is bound to. */\n};\n\n/* Interrupt event flags kept in ie_flags. */\n#define\tIE_SOFT\t\t0x000001\t/* Software interrupt. */\n#define\tIE_ENTROPY\t0x000002\t/* Interrupt is an entropy source. */\n#define\tIE_ADDING_THREAD 0x000004\t/* Currently building an ithread. */\n\n/* Flags to pass to sched_swi. */\n#define\tSWI_DELAY\t0x2\n\n/*\n * Software interrupt numbers in priority order.  The priority determines\n * the priority of the corresponding interrupt thread.\n */\n#define\tSWI_TTY\t\t0\n#define\tSWI_NET\t\t1\n#define\tSWI_CAMBIO\t2\n#define\tSWI_VM\t\t3\n#define\tSWI_CLOCK\t4\n#define\tSWI_TQ_FAST\t5\n#define\tSWI_TQ\t\t6\n#define\tSWI_TQ_GIANT\t6\n\nstruct proc;\n\nextern struct\tintr_event *tty_intr_event;\nextern struct\tintr_event *clk_intr_event;\nextern void\t*vm_ih;\n\n/* Counts and names for statistics (defined in MD code). */\nextern u_long \tintrcnt[];\t/* counts for for each device and stray */\nextern char \tintrnames[];\t/* string table containing device names */\nextern size_t\tsintrcnt;\t/* size of intrcnt table */\nextern size_t\tsintrnames;\t/* size of intrnames table */\n\n#ifdef DDB\nvoid\tdb_dump_intr_event(struct intr_event *ie, int handlers);\n#endif\nu_char\tintr_priority(enum intr_type flags);\nint\tintr_event_add_handler(struct intr_event *ie, const char *name,\n\t    driver_filter_t filter, driver_intr_t handler, void *arg, \n\t    u_char pri, enum intr_type flags, void **cookiep);\t    \nint\tintr_event_bind(struct intr_event *ie, u_char cpu);\nint\tintr_event_create(struct intr_event **event, void *source,\n\t    int flags, int irq, void (*pre_ithread)(void *),\n\t    void (*post_ithread)(void *), void (*post_filter)(void *),\n\t    int (*assign_cpu)(void *, u_char), const char *fmt, ...)\n\t    __printflike(9, 10);\nint\tintr_event_describe_handler(struct intr_event *ie, void *cookie,\n\t    const char *descr);\nint\tintr_event_destroy(struct intr_event *ie);\nvoid\tintr_event_execute_handlers(struct proc *p, struct intr_event *ie);\nint\tintr_event_handle(struct intr_event *ie, struct trapframe *frame);\nint\tintr_event_remove_handler(void *cookie);\nint\tintr_getaffinity(int irq, void *mask);\nvoid\t*intr_handler_source(void *cookie);\nint\tintr_setaffinity(int irq, void *mask);\nvoid\t_intr_drain(int irq);  /* Linux compat only. */\nint\tswi_add(struct intr_event **eventp, const char *name,\n\t    driver_intr_t handler, void *arg, int pri, enum intr_type flags,\n\t    void **cookiep);\nvoid\tswi_sched(void *cookie, int flags);\nint\tswi_remove(void *cookie);\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/sys/ioccom.h",
    "content": "/*-\n * Copyright (c) 1982, 1986, 1990, 1993, 1994\n *\tThe Regents of the University of California.  All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 4. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t@(#)ioccom.h\t8.2 (Berkeley) 3/28/94\n * $FreeBSD: release/9.0.0/sys/sys/ioccom.h 206051 2010-04-01 16:21:35Z pjd $\n */\n\n#ifndef\t_SYS_IOCCOM_H_\n#define\t_SYS_IOCCOM_H_\n\n/*\n * Ioctl's have the command encoded in the lower word, and the size of\n * any in or out parameters in the upper word.  The high 3 bits of the\n * upper word are used to encode the in/out status of the parameter.\n */\n#define\tIOCPARM_SHIFT\t13\t\t/* number of bits for ioctl size */\n#define\tIOCPARM_MASK\t((1 << IOCPARM_SHIFT) - 1) /* parameter length mask */\n#define\tIOCPARM_LEN(x)\t(((x) >> 16) & IOCPARM_MASK)\n#define\tIOCBASECMD(x)\t((x) & ~(IOCPARM_MASK << 16))\n#define\tIOCGROUP(x)\t(((x) >> 8) & 0xff)\n\n#define\tIOCPARM_MAX\t(1 << IOCPARM_SHIFT) /* max size of ioctl */\n#define\tIOC_VOID\t0x20000000\t/* no parameters */\n#define\tIOC_OUT\t\t0x40000000\t/* copy out parameters */\n#define\tIOC_IN\t\t0x80000000\t/* copy in parameters */\n#define\tIOC_INOUT\t(IOC_IN|IOC_OUT)\n#define\tIOC_DIRMASK\t(IOC_VOID|IOC_OUT|IOC_IN)\n\n#define\t_IOC(inout,group,num,len)\t((unsigned long) \\\n\t((inout) | (((len) & IOCPARM_MASK) << 16) | ((group) << 8) | (num)))\n#define\t_IO(g,n)\t_IOC(IOC_VOID,\t(g), (n), 0)\n#define\t_IOWINT(g,n)\t_IOC(IOC_VOID,\t(g), (n), sizeof(int))\n#define\t_IOR(g,n,t)\t_IOC(IOC_OUT,\t(g), (n), sizeof(t))\n#define\t_IOW(g,n,t)\t_IOC(IOC_IN,\t(g), (n), sizeof(t))\n/* this should be _IORW, but stdio got there first */\n#define\t_IOWR(g,n,t)\t_IOC(IOC_INOUT,\t(g), (n), sizeof(t))\n\n#ifdef _KERNEL\n\n#if defined(COMPAT_FREEBSD6) || defined(COMPAT_FREEBSD5) || \\\n    defined(COMPAT_FREEBSD4) || defined(COMPAT_43)\n#define\tIOCPARM_IVAL(x)\t((int)(intptr_t)(void *)*(caddr_t *)(void *)(x))\n#endif\n\n#else\n\n#include <sys/cdefs.h>\n\n__BEGIN_DECLS\nint\tioctl(int, unsigned long, ...);\n__END_DECLS\n\n#endif\n\n#endif /* !_SYS_IOCCOM_H_ */\n"
  },
  {
    "path": "freebsd-headers/sys/ioctl.h",
    "content": "/*-\n * Copyright (c) 1982, 1986, 1990, 1993, 1994\n *\tThe Regents of the University of California.  All rights reserved.\n * (c) UNIX System Laboratories, Inc.\n * All or some portions of this file are derived from material licensed\n * to the University of California by American Telephone and Telegraph\n * Co. or Unix System Laboratories, Inc. and are reproduced herein with\n * the permission of UNIX System Laboratories, Inc.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 4. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t@(#)ioctl.h\t8.6 (Berkeley) 3/28/94\n * $FreeBSD: release/9.0.0/sys/sys/ioctl.h 191947 2009-05-09 19:01:24Z ed $\n */\n\n#ifndef\t_SYS_IOCTL_H_\n#define\t_SYS_IOCTL_H_\n\n#ifdef _KERNEL\n#error \"Don't #include ioctl.h in the kernel.  Include xxxio.h instead.\"\n#endif /* _KERNEL */\n\n#include <sys/ioccom.h>\n\n#include <sys/filio.h>\n#include <sys/sockio.h>\n#include <sys/ttycom.h>\n\n#endif /* !_SYS_IOCTL_H_ */\n"
  },
  {
    "path": "freebsd-headers/sys/ioctl_compat.h",
    "content": "/*-\n * Copyright (c) 1990, 1993\n *\tThe Regents of the University of California.  All rights reserved.\n * (c) UNIX System Laboratories, Inc.\n * All or some portions of this file are derived from material licensed\n * to the University of California by American Telephone and Telegraph\n * Co. or Unix System Laboratories, Inc. and are reproduced herein with\n * the permission of UNIX System Laboratories, Inc.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 4. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t@(#)ioctl_compat.h\t8.4 (Berkeley) 1/21/94\n * $FreeBSD: release/9.0.0/sys/sys/ioctl_compat.h 196884 2009-09-06 09:39:40Z ed $\n */\n\n#ifndef _SYS_IOCTL_COMPAT_H_\n#define\t_SYS_IOCTL_COMPAT_H_\n\n#ifndef COMPAT_43TTY\n#error \"Definitions not available without TTY ioctl compat.\"\n#endif\n\nstruct tchars {\n\tchar\tt_intrc;\t/* interrupt */\n\tchar\tt_quitc;\t/* quit */\n\tchar\tt_startc;\t/* start output */\n\tchar\tt_stopc;\t/* stop output */\n\tchar\tt_eofc;\t\t/* end-of-file */\n\tchar\tt_brkc;\t\t/* input delimiter (like nl) */\n};\n\nstruct ltchars {\n\tchar\tt_suspc;\t/* stop process signal */\n\tchar\tt_dsuspc;\t/* delayed stop process signal */\n\tchar\tt_rprntc;\t/* reprint line */\n\tchar\tt_flushc;\t/* flush output (toggles) */\n\tchar\tt_werasc;\t/* word erase */\n\tchar\tt_lnextc;\t/* literal next character */\n};\n\n/*\n * Structure for TIOCGETP and TIOCSETP ioctls.\n */\nstruct sgttyb {\n\tchar\tsg_ispeed;\t\t/* input speed */\n\tchar\tsg_ospeed;\t\t/* output speed */\n\tchar\tsg_erase;\t\t/* erase character */\n\tchar\tsg_kill;\t\t/* kill character */\n\tshort\tsg_flags;\t\t/* mode flags */\n};\n\n#define\tOTIOCGETD\t_IOR('t', 0, int)\t/* get line discipline */\n#define\tOTIOCSETD\t_IOW('t', 1, int)\t/* set line discipline */\n#define\tTIOCHPCL\t _IO('t', 2)\t\t/* hang up on last close */\n#define\tTIOCGETP\t_IOR('t', 8, struct sgttyb) /* get parameters */\n#define\tTIOCSETP\t_IOW('t', 9, struct sgttyb) /* set parameters */\n#define\tTIOCSETN\t_IOW('t',10, struct sgttyb) /* as above, but no flush */\n#define\tTIOCSETC\t_IOW('t',17, struct tchars) /* set special characters */\n#define\tTIOCGETC\t_IOR('t',18, struct tchars) /* get special characters */\n#define\t\tTANDEM\t\t0x00000001\t/* send stopc on out q full */\n#define\t\tCBREAK\t\t0x00000002\t/* half-cooked mode */\n#define\t\tLCASE\t\t0x00000004\t/* simulate lower case */\n#define\t\tECHO\t\t0x00000008\t/* echo input */\n#define\t\tCRMOD\t\t0x00000010\t/* map \\r to \\r\\n on output */\n#define\t\tRAW\t\t0x00000020\t/* no i/o processing */\n#define\t\tODDP\t\t0x00000040\t/* get/send odd parity */\n#define\t\tEVENP\t\t0x00000080\t/* get/send even parity */\n#define\t\tANYP\t\t0x000000c0\t/* get any parity/send none */\n#define\t\tNLDELAY\t\t0x00000300\t/* \\n delay */\n#define\t\t\tNL0\t0x00000000\n#define\t\t\tNL1\t0x00000100\t/* tty 37 */\n#define\t\t\tNL2\t0x00000200\t/* vt05 */\n#define\t\t\tNL3\t0x00000300\n#define\t\tTBDELAY\t\t0x00000c00\t/* horizontal tab delay */\n#define\t\t\tTAB0\t0x00000000\n#define\t\t\tTAB1\t0x00000400\t/* tty 37 */\n#define\t\t\tTAB2\t0x00000800\n#define\t\tXTABS\t\t0x00000c00\t/* expand tabs on output */\n#define\t\tCRDELAY\t\t0x00003000\t/* \\r delay */\n#define\t\t\tCR0\t0x00000000\n#define\t\t\tCR1\t0x00001000\t/* tn 300 */\n#define\t\t\tCR2\t0x00002000\t/* tty 37 */\n#define\t\t\tCR3\t0x00003000\t/* concept 100 */\n#define\t\tVTDELAY\t\t0x00004000\t/* vertical tab delay */\n#define\t\t\tFF0\t0x00000000\n#define\t\t\tFF1\t0x00004000\t/* tty 37 */\n#define\t\tBSDELAY\t\t0x00008000\t/* \\b delay */\n#define\t\t\tBS0\t0x00000000\n#define\t\t\tBS1\t0x00008000\n#define\t\tALLDELAY\t(NLDELAY|TBDELAY|CRDELAY|VTDELAY|BSDELAY)\n#define\t\tCRTBS\t\t0x00010000\t/* do backspacing for crt */\n#define\t\tPRTERA\t\t0x00020000\t/* \\ ... / erase */\n#define\t\tCRTERA\t\t0x00040000\t/* \" \\b \" to wipe out char */\n#define\t\tTILDE\t\t0x00080000\t/* hazeltine tilde kludge */\n#define\t\tMDMBUF\t\t0x00100000\t/*start/stop output on carrier*/\n#define\t\tLITOUT\t\t0x00200000\t/* literal output */\n#define\t\tTOSTOP\t\t0x00400000\t/*SIGSTOP on background output*/\n#define\t\tFLUSHO\t\t0x00800000\t/* flush output to terminal */\n#define\t\tNOHANG\t\t0x01000000\t/* (no-op) was no SIGHUP on carrier drop */\n#define\t\tL001000\t\t0x02000000\n#define\t\tCRTKIL\t\t0x04000000\t/* kill line with \" \\b \" */\n#define\t\tPASS8\t\t0x08000000\n#define\t\tCTLECH\t\t0x10000000\t/* echo control chars as ^X */\n#define\t\tPENDIN\t\t0x20000000\t/* tp->t_rawq needs reread */\n#define\t\tDECCTQ\t\t0x40000000\t/* only ^Q starts after ^S */\n#define\t\tNOFLSH\t\t0x80000000\t/* no output flush on signal */\n#define\tOTIOCCONS\t _IO('t', 98)\t/* for hp300 -- sans int arg */\n#define\tTIOCGLTC\t_IOR('t', 116,struct ltchars) /* get special chars */\n#define\tTIOCSLTC\t_IOW('t', 117,struct ltchars) /* set special chars */\n#define\tTIOCLGET\t_IOR('t', 124, int)\t/* get local modes */\n#define\t\tLCRTBS\t\t(CRTBS>>16)\n#define\t\tLPRTERA\t\t(PRTERA>>16)\n#define\t\tLCRTERA\t\t(CRTERA>>16)\n#define\t\tLTILDE\t\t(TILDE>>16)\n#define\t\tLMDMBUF\t\t(MDMBUF>>16)\n#define\t\tLLITOUT\t\t(LITOUT>>16)\n#define\t\tLTOSTOP\t\t(TOSTOP>>16)\n#define\t\tLFLUSHO\t\t(FLUSHO>>16)\n#define\t\tLNOHANG\t\t(NOHANG>>16)\n#define\t\tLCRTKIL\t\t(CRTKIL>>16)\n#define\t\tLPASS8\t\t(PASS8>>16)\n#define\t\tLCTLECH\t\t(CTLECH>>16)\n#define\t\tLPENDIN\t\t(PENDIN>>16)\n#define\t\tLDECCTQ\t\t(DECCTQ>>16)\n#define\t\tLNOFLSH\t\t(NOFLSH>>16)\n#define\tTIOCLSET\t_IOW('t', 125, int)\t/* set entire local mode word */\n#define\tTIOCLBIC\t_IOW('t', 126, int)\t/* bic local mode bits */\n#define\tTIOCLBIS\t_IOW('t', 127, int)\t/* bis local mode bits */\n\n#endif /* !_SYS_IOCTL_COMPAT_H_ */\n"
  },
  {
    "path": "freebsd-headers/sys/ipc.h",
    "content": "/*-\n * Copyright (c) 1988 University of Utah.\n * Copyright (c) 1990, 1993\n *\tThe Regents of the University of California.  All rights reserved.\n * (c) UNIX System Laboratories, Inc.\n * All or some portions of this file are derived from material licensed\n * to the University of California by American Telephone and Telegraph\n * Co. or Unix System Laboratories, Inc. and are reproduced herein with\n * the permission of UNIX System Laboratories, Inc.\n *\n * This code is derived from software contributed to Berkeley by\n * the Systems Programming Group of the University of Utah Computer\n * Science Department.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 4. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t@(#)ipc.h\t8.4 (Berkeley) 2/19/95\n * $FreeBSD: release/9.0.0/sys/sys/ipc.h 194910 2009-06-24 21:10:52Z jhb $\n */\n\n/*\n * SVID compatible ipc.h file\n */\n#ifndef _SYS_IPC_H_\n#define _SYS_IPC_H_\n\n#include <sys/cdefs.h>\n#include <sys/_types.h>\n\n#ifndef _GID_T_DECLARED\ntypedef\t__gid_t\t\tgid_t;\n#define\t_GID_T_DECLARED\n#endif\n\n#ifndef _KEY_T_DECLARED\ntypedef\t__key_t\t\tkey_t;\n#define\t_KEY_T_DECLARED\n#endif\n\n#ifndef _MODE_T_DECLARED\ntypedef\t__mode_t\tmode_t;\n#define\t_MODE_T_DECLARED\n#endif\n\n#ifndef _UID_T_DECLARED\ntypedef\t__uid_t\t\tuid_t;\n#define\t_UID_T_DECLARED\n#endif\n\n#if defined(COMPAT_FREEBSD4) || defined(COMPAT_FREEBSD5) || \\\n    defined(COMPAT_FREEBSD6) || defined(COMPAT_FREEBSD7)\nstruct ipc_perm_old {\n\tunsigned short\tcuid;\t/* creator user id */\n\tunsigned short\tcgid;\t/* creator group id */\n\tunsigned short\tuid;\t/* user id */\n\tunsigned short\tgid;\t/* group id */\n\tunsigned short\tmode;\t/* r/w permission */\n\tunsigned short\tseq;\t/* sequence # (to generate unique ipcid) */\n\tkey_t\t\tkey;\t/* user specified msg/sem/shm key */\n};\n#endif\n\nstruct ipc_perm {\n\tuid_t\t\tcuid;\t/* creator user id */\n\tgid_t\t\tcgid;\t/* creator group id */\n\tuid_t\t\tuid;\t/* user id */\n\tgid_t\t\tgid;\t/* group id */\n\tmode_t\t\tmode;\t/* r/w permission */\n\tunsigned short\tseq;\t/* sequence # (to generate unique ipcid) */\n\tkey_t\t\tkey;\t/* user specified msg/sem/shm key */\n};\n\n#if __BSD_VISIBLE\n/* common mode bits */\n#define\tIPC_R\t\t000400\t/* read permission */\n#define\tIPC_W\t\t000200\t/* write/alter permission */\n#define\tIPC_M\t\t010000\t/* permission to change control info */\n#endif\n\n/* SVID required constants (same values as system 5) */\n#define\tIPC_CREAT\t001000\t/* create entry if key does not exist */\n#define\tIPC_EXCL\t002000\t/* fail if key exists */\n#define\tIPC_NOWAIT\t004000\t/* error if request must wait */\n\n#define\tIPC_PRIVATE\t(key_t)0 /* private key */\n\n#define\tIPC_RMID\t0\t/* remove identifier */\n#define\tIPC_SET\t\t1\t/* set options */\n#define\tIPC_STAT\t2\t/* get options */\n#if __BSD_VISIBLE\n/*\n * For Linux compatability.\n */\n#define\tIPC_INFO\t3\t/* get info */\n#endif\n\n#ifdef _KERNEL\n/* Macros to convert between ipc ids and array indices or sequence ids */\n#define\tIPCID_TO_IX(id)\t\t((id) & 0xffff)\n#define\tIPCID_TO_SEQ(id)\t(((id) >> 16) & 0xffff)\n#define\tIXSEQ_TO_IPCID(ix,perm)\t(((perm.seq) << 16) | (ix & 0xffff))\n\nstruct thread;\nstruct proc;\nstruct vmspace;\n\n#if defined(COMPAT_FREEBSD4) || defined(COMPAT_FREEBSD5) || \\\n    defined(COMPAT_FREEBSD6) || defined(COMPAT_FREEBSD7)\nvoid\tipcperm_old2new(struct ipc_perm_old *, struct ipc_perm *);\nvoid\tipcperm_new2old(struct ipc_perm *, struct ipc_perm_old *);\n#endif\n\nint\tipcperm(struct thread *, struct ipc_perm *, int);\nextern void (*shmfork_hook)(struct proc *, struct proc *);\nextern void (*shmexit_hook)(struct vmspace *);\n\n#else /* ! _KERNEL */\n\n__BEGIN_DECLS\nkey_t\tftok(const char *, int);\n__END_DECLS\n\n#endif /* _KERNEL */\n\n#endif /* !_SYS_IPC_H_ */\n"
  },
  {
    "path": "freebsd-headers/sys/ipmi.h",
    "content": "/*-\n * Copyright (c) 2006 IronPort Systems Inc. <ambrisko@ironport.com>\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/sys/ipmi.h 162562 2006-09-22 22:11:29Z jhb $\n */\n\n#ifndef __SYS_IPMI_H__\n#define\t__SYS_IPMI_H__\n\n#define IPMI_MAX_ADDR_SIZE\t\t0x20\n#define IPMI_MAX_RX\t\t\t1024\n#define IPMI_BMC_SLAVE_ADDR\t\t0x20 /* Linux Default slave address */\n#define IPMI_BMC_CHANNEL\t\t0x0f /* Linux BMC channel */\n\n#define IPMI_BMC_SMS_LUN\t\t0x02\n\n#define IPMI_SYSTEM_INTERFACE_ADDR_TYPE\t0x0c\n#define IPMI_IPMB_ADDR_TYPE\t\t0x01\n#define IPMI_IPMB_BROADCAST_ADDR_TYPE\t0x41\n\n#define IPMI_IOC_MAGIC\t\t\t'i'\n#define IPMICTL_RECEIVE_MSG_TRUNC\t_IOWR(IPMI_IOC_MAGIC, 11, struct ipmi_recv)\n#define IPMICTL_RECEIVE_MSG\t\t_IOWR(IPMI_IOC_MAGIC, 12, struct ipmi_recv)\n#define IPMICTL_SEND_COMMAND\t\t_IOW(IPMI_IOC_MAGIC, 13, struct ipmi_req)\n#define IPMICTL_REGISTER_FOR_CMD\t_IOW(IPMI_IOC_MAGIC, 14, struct ipmi_cmdspec)\n#define IPMICTL_UNREGISTER_FOR_CMD\t_IOW(IPMI_IOC_MAGIC, 15, struct ipmi_cmdspec)\n#define IPMICTL_SET_GETS_EVENTS_CMD\t_IOW(IPMI_IOC_MAGIC, 16, int)\n#define IPMICTL_SET_MY_ADDRESS_CMD\t_IOW(IPMI_IOC_MAGIC, 17, unsigned int)\n#define IPMICTL_GET_MY_ADDRESS_CMD\t_IOR(IPMI_IOC_MAGIC, 18, unsigned int)\n#define IPMICTL_SET_MY_LUN_CMD\t\t_IOW(IPMI_IOC_MAGIC, 19, unsigned int)\n#define IPMICTL_GET_MY_LUN_CMD\t\t_IOR(IPMI_IOC_MAGIC, 20, unsigned int)\n\n#define IPMI_RESPONSE_RECV_TYPE         1\n#define IPMI_ASYNC_EVENT_RECV_TYPE      2\n#define IPMI_CMD_RECV_TYPE              3\n\n#define IPMI_APP_REQUEST\t\t0x06\n#define IPMI_GET_DEVICE_ID\t\t0x01\n#define IPMI_CLEAR_FLAGS\t\t0x30\n#define IPMI_GET_MSG_FLAGS\t\t0x31\n# define IPMI_MSG_AVAILABLE\t\t0x01\n# define IPMI_MSG_BUFFER_FULL\t\t0x02\n# define IPMI_WDT_PRE_TIMEOUT\t\t0x08\n#define IPMI_GET_MSG\t\t\t0x33\n#define IPMI_SEND_MSG\t\t\t0x34\n#define IPMI_GET_CHANNEL_INFO\t\t0x42\n#define IPMI_RESET_WDOG\t\t\t0x22\n#define IPMI_SET_WDOG\t\t\t0x24\n#define IPMI_GET_WDOG\t\t\t0x25\n\n#define IPMI_SET_WD_TIMER_SMS_OS\t0x04\n#define IPMI_SET_WD_TIMER_DONT_STOP\t0x40\n#define IPMI_SET_WD_ACTION_RESET\t0x01\n\nstruct ipmi_msg {\n\tunsigned char\tnetfn;\n        unsigned char\tcmd;\n        unsigned short\tdata_len;\n        unsigned char\t*data;\n};\n\nstruct ipmi_req {\n\tunsigned char\t*addr;\n\tunsigned int\taddr_len;\n\tlong\t\tmsgid;\n\tstruct ipmi_msg\tmsg;\n};\n\nstruct ipmi_recv {\n\tint\t\trecv_type;\n\tunsigned char\t*addr;\n\tunsigned int\taddr_len;\n\tlong\t\tmsgid;\n\tstruct ipmi_msg\tmsg;\n};\n\nstruct ipmi_cmdspec {\n\tunsigned char\tnetfn;\n\tunsigned char\tcmd;\n};\n\n\nstruct ipmi_addr {\n\tint\t\taddr_type;\n\tshort\t\tchannel;\n\tunsigned char\tdata[IPMI_MAX_ADDR_SIZE];\n};\n\nstruct ipmi_system_interface_addr {\n\tint\t\taddr_type;\n\tshort\t\tchannel;\n\tunsigned char\tlun;\n};\n\nstruct ipmi_ipmb_addr {\n\tint\t\taddr_type;\n\tshort\t\tchannel;\n\tunsigned char\tslave_addr;\n\tunsigned char\tlun;\n};\n\n#if defined(__amd64__)\n/* Compatiblity with 32-bit binaries. */\n\n#define IPMICTL_RECEIVE_MSG_TRUNC_32\t_IOWR(IPMI_IOC_MAGIC, 11, struct ipmi_recv32)\n#define IPMICTL_RECEIVE_MSG_32\t\t_IOWR(IPMI_IOC_MAGIC, 12, struct ipmi_recv32)\n#define IPMICTL_SEND_COMMAND_32\t\t_IOW(IPMI_IOC_MAGIC, 13, struct ipmi_req32)\n\nstruct ipmi_msg32 {\n\tunsigned char\tnetfn;\n        unsigned char\tcmd;\n        unsigned short\tdata_len;\n\tuint32_t\tdata;\n};\n\nstruct ipmi_req32 {\n\tuint32_t\taddr;\n\tunsigned int\taddr_len;\n\tint32_t\t\tmsgid;\n\tstruct ipmi_msg32 msg;\n};\n\nstruct ipmi_recv32 {\n\tint\t\trecv_type;\n\tuint32_t\taddr;\n\tunsigned int\taddr_len;\n\tint32_t\t\tmsgid;\n\tstruct ipmi_msg32 msg;\n};\n\n#endif\n\n#endif\t/* !__SYS_IPMI_H__ */\n"
  },
  {
    "path": "freebsd-headers/sys/jail.h",
    "content": "/*-\n * Copyright (c) 1999 Poul-Henning Kamp.\n * Copyright (c) 2009 James Gritton.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/sys/jail.h 221362 2011-05-03 07:32:58Z trasz $\n */\n\n#ifndef _SYS_JAIL_H_\n#define _SYS_JAIL_H_\n\n#ifdef _KERNEL\nstruct jail_v0 {\n\tu_int32_t\tversion;\n\tchar\t\t*path;\n\tchar\t\t*hostname;\n\tu_int32_t\tip_number;\n};\n#endif\n\nstruct jail {\n\tuint32_t\tversion;\n\tchar\t\t*path;\n\tchar\t\t*hostname;\n\tchar\t\t*jailname;\n\tuint32_t\tip4s;\n\tuint32_t\tip6s;\n\tstruct in_addr\t*ip4;\n\tstruct in6_addr\t*ip6;\n};\n#define\tJAIL_API_VERSION\t2\n\n/*\n * For all xprison structs, always keep the pr_version an int and\n * the first variable so userspace can easily distinguish them.\n */\n#ifndef _KERNEL\nstruct xprison_v1 {\n\tint\t\t pr_version;\n\tint\t\t pr_id;\n\tchar\t\t pr_path[MAXPATHLEN];\n\tchar\t\t pr_host[MAXHOSTNAMELEN];\n\tu_int32_t\t pr_ip;\n};\n#endif\n\nstruct xprison {\n\tint\t\t pr_version;\n\tint\t\t pr_id;\n\tint\t\t pr_state;\n\tcpusetid_t\t pr_cpusetid;\n\tchar\t\t pr_path[MAXPATHLEN];\n\tchar\t\t pr_host[MAXHOSTNAMELEN];\n\tchar\t\t pr_name[MAXHOSTNAMELEN];\n\tuint32_t\t pr_ip4s;\n\tuint32_t\t pr_ip6s;\n#if 0\n\t/*\n\t * sizeof(xprison) will be malloced + size needed for all\n\t * IPv4 and IPv6 addesses. Offsets are based numbers of addresses.\n\t */\n\tstruct in_addr\t pr_ip4[];\n\tstruct in6_addr\t pr_ip6[];\n#endif\n};\n#define\tXPRISON_VERSION\t\t3\n\n#define\tPRISON_STATE_INVALID\t0\n#define\tPRISON_STATE_ALIVE\t1\n#define\tPRISON_STATE_DYING\t2\n\n/*\n * Flags for jail_set and jail_get.\n */\n#define\tJAIL_CREATE\t0x01\t/* Create jail if it doesn't exist */\n#define\tJAIL_UPDATE\t0x02\t/* Update parameters of existing jail */\n#define\tJAIL_ATTACH\t0x04\t/* Attach to jail upon creation */\n#define\tJAIL_DYING\t0x08\t/* Allow getting a dying jail */\n#define\tJAIL_SET_MASK\t0x0f\n#define\tJAIL_GET_MASK\t0x08\n\n#define\tJAIL_SYS_DISABLE\t0\n#define\tJAIL_SYS_NEW\t\t1\n#define\tJAIL_SYS_INHERIT\t2\n\n#ifndef _KERNEL\n\nstruct iovec;\n\nint jail(struct jail *);\nint jail_set(struct iovec *, unsigned int, int);\nint jail_get(struct iovec *, unsigned int, int);\nint jail_attach(int);\nint jail_remove(int);\n\n#else /* _KERNEL */\n\n#include <sys/queue.h>\n#include <sys/sysctl.h>\n#include <sys/lock.h>\n#include <sys/mutex.h>\n#include <sys/_task.h>\n\n#define JAIL_MAX\t999999\n\n#ifdef MALLOC_DECLARE\nMALLOC_DECLARE(M_PRISON);\n#endif\n#endif /* _KERNEL */\n\n#if defined(_KERNEL) || defined(_WANT_PRISON)\n\n#include <sys/osd.h>\n\n#define\tHOSTUUIDLEN\t64\n\nstruct racct;\nstruct prison_racct;\n\n/*\n * This structure describes a prison.  It is pointed to by all struct\n * ucreds's of the inmates.  pr_ref keeps track of them and is used to\n * delete the struture when the last inmate is dead.\n *\n * Lock key:\n *   (a) allprison_lock\n *   (p) locked by pr_mtx\n *   (c) set only during creation before the structure is shared, no mutex\n *       required to read\n *   (d) set only during destruction of jail, no mutex needed\n */\nstruct prison {\n\tTAILQ_ENTRY(prison) pr_list;\t\t\t/* (a) all prisons */\n\tint\t\t pr_id;\t\t\t\t/* (c) prison id */\n\tint\t\t pr_ref;\t\t\t/* (p) refcount */\n\tint\t\t pr_uref;\t\t\t/* (p) user (alive) refcount */\n\tunsigned\t pr_flags;\t\t\t/* (p) PR_* flags */\n\tLIST_HEAD(, prison) pr_children;\t\t/* (a) list of child jails */\n\tLIST_ENTRY(prison) pr_sibling;\t\t\t/* (a) next in parent's list */\n\tstruct prison\t*pr_parent;\t\t\t/* (c) containing jail */\n\tstruct mtx\t pr_mtx;\n\tstruct task\t pr_task;\t\t\t/* (d) destroy task */\n\tstruct osd\t pr_osd;\t\t\t/* (p) additional data */\n\tstruct cpuset\t*pr_cpuset;\t\t\t/* (p) cpuset */\n\tstruct vnet\t*pr_vnet;\t\t\t/* (c) network stack */\n\tstruct vnode\t*pr_root;\t\t\t/* (c) vnode to rdir */\n\tint\t\t pr_ip4s;\t\t\t/* (p) number of v4 IPs */\n\tint\t\t pr_ip6s;\t\t\t/* (p) number of v6 IPs */\n\tstruct in_addr\t*pr_ip4;\t\t\t/* (p) v4 IPs of jail */\n\tstruct in6_addr\t*pr_ip6;\t\t\t/* (p) v6 IPs of jail */\n\tstruct prison_racct *pr_prison_racct;\t\t/* (c) racct jail proxy */\n\tvoid\t\t*pr_sparep[3];\n\tint\t\t pr_childcount;\t\t\t/* (a) number of child jails */\n\tint\t\t pr_childmax;\t\t\t/* (p) maximum child jails */\n\tunsigned\t pr_allow;\t\t\t/* (p) PR_ALLOW_* flags */\n\tint\t\t pr_securelevel;\t\t/* (p) securelevel */\n\tint\t\t pr_enforce_statfs;\t\t/* (p) statfs permission */\n\tint\t\t pr_spare[5];\n\tunsigned long\t pr_hostid;\t\t\t/* (p) jail hostid */\n\tchar\t\t pr_name[MAXHOSTNAMELEN];\t/* (p) admin jail name */\n\tchar\t\t pr_path[MAXPATHLEN];\t\t/* (c) chroot path */\n\tchar\t\t pr_hostname[MAXHOSTNAMELEN];\t/* (p) jail hostname */\n\tchar\t\t pr_domainname[MAXHOSTNAMELEN];\t/* (p) jail domainname */\n\tchar\t\t pr_hostuuid[HOSTUUIDLEN];\t/* (p) jail hostuuid */\n};\n\nstruct prison_racct {\n\tLIST_ENTRY(prison_racct) prr_next;\n\tchar\t\tprr_name[MAXHOSTNAMELEN];\n\tu_int\t\tprr_refcount;\n\tstruct racct\t*prr_racct;\n};\n#endif /* _KERNEL || _WANT_PRISON */\n\n#ifdef _KERNEL\n/* Flag bits set via options */\n#define\tPR_PERSIST\t0x00000001\t/* Can exist without processes */\n#define\tPR_HOST\t\t0x00000002\t/* Virtualize hostname et al */\n#define\tPR_IP4_USER\t0x00000004\t/* Restrict IPv4 addresses */\n#define\tPR_IP6_USER\t0x00000008\t/* Restrict IPv6 addresses */\n#define\tPR_VNET\t\t0x00000010\t/* Virtual network stack */\n#define\tPR_IP4_DISABLE\t0x00000020\t/* Disable IPv4 */\n#define\tPR_IP6_DISABLE\t0x00000040\t/* Disable IPv6 */\n#define\tPR_IP4_SADDRSEL\t0x00000080\t/* Do IPv4 src addr sel. or use the */\n\t\t\t\t\t/* primary jail address. */\n#define\tPR_IP6_SADDRSEL\t0x00000100\t/* Do IPv6 src addr sel. or use the */\n\t\t\t\t\t/* primary jail address. */\n\n/* Internal flag bits */\n#define\tPR_REMOVE\t0x01000000\t/* In process of being removed */\n#define\tPR_IP4\t\t0x02000000\t/* IPv4 restricted or disabled */\n\t\t\t\t\t/* by this jail or an ancestor */\n#define\tPR_IP6\t\t0x04000000\t/* IPv6 restricted or disabled */\n\t\t\t\t\t/* by this jail or an ancestor */\n\n/* Flags for pr_allow */\n#define\tPR_ALLOW_SET_HOSTNAME\t\t0x0001\n#define\tPR_ALLOW_SYSVIPC\t\t0x0002\n#define\tPR_ALLOW_RAW_SOCKETS\t\t0x0004\n#define\tPR_ALLOW_CHFLAGS\t\t0x0008\n#define\tPR_ALLOW_MOUNT\t\t\t0x0010\n#define\tPR_ALLOW_QUOTAS\t\t\t0x0020\n#define\tPR_ALLOW_SOCKET_AF\t\t0x0040\n#define\tPR_ALLOW_ALL\t\t\t0x007f\n\n/*\n * OSD methods\n */\n#define\tPR_METHOD_CREATE\t0\n#define\tPR_METHOD_GET\t\t1\n#define\tPR_METHOD_SET\t\t2\n#define\tPR_METHOD_CHECK\t\t3\n#define\tPR_METHOD_ATTACH\t4\n#define\tPR_MAXMETHOD\t\t5\n\n/*\n * Lock/unlock a prison.\n * XXX These exist not so much for general convenience, but to be useable in\n *     the FOREACH_PRISON_DESCENDANT_LOCKED macro which can't handle them in\n *     non-function form as currently defined.\n */\nstatic __inline void\nprison_lock(struct prison *pr)\n{\n\n\tmtx_lock(&pr->pr_mtx);\n}\n\nstatic __inline void\nprison_unlock(struct prison *pr)\n{\n\n\tmtx_unlock(&pr->pr_mtx);\n}\n\n/* Traverse a prison's immediate children. */\n#define\tFOREACH_PRISON_CHILD(ppr, cpr)\t\t\t\t\t\\\n\tLIST_FOREACH(cpr, &(ppr)->pr_children, pr_sibling)\n\n/*\n * Preorder traversal of all of a prison's descendants.\n * This ugly loop allows the macro to be followed by a single block\n * as expected in a looping primitive.\n */\n#define\tFOREACH_PRISON_DESCENDANT(ppr, cpr, descend)\t\t\t\\\n\tfor ((cpr) = (ppr), (descend) = 1;\t\t\t\t\\\n\t    ((cpr) = (((descend) && !LIST_EMPTY(&(cpr)->pr_children))\t\\\n\t      ? LIST_FIRST(&(cpr)->pr_children)\t\t\t\t\\\n\t      : ((cpr) == (ppr)\t\t\t\t\t\t\\\n\t\t ? NULL\t\t\t\t\t\t\t\\\n\t\t : (((descend) = LIST_NEXT(cpr, pr_sibling) != NULL)\t\\\n\t\t    ? LIST_NEXT(cpr, pr_sibling)\t\t\t\\\n\t\t    : (cpr)->pr_parent))));)\t\t\t\t\\\n\t\tif (!(descend))\t\t\t\t\t\t\\\n\t\t\t;\t\t\t\t\t\t\\\n\t\telse\n\n/*\n * As above, but lock descendants on the way down and unlock on the way up.\n */\n#define\tFOREACH_PRISON_DESCENDANT_LOCKED(ppr, cpr, descend)\t\t\\\n\tfor ((cpr) = (ppr), (descend) = 1;\t\t\t\t\\\n\t    ((cpr) = (((descend) && !LIST_EMPTY(&(cpr)->pr_children))\t\\\n\t      ? LIST_FIRST(&(cpr)->pr_children)\t\t\t\t\\\n\t      : ((cpr) == (ppr)\t\t\t\t\t\t\\\n\t\t ? NULL\t\t\t\t\t\t\t\\\n\t\t : ((prison_unlock(cpr),\t\t\t\t\\\n\t\t    (descend) = LIST_NEXT(cpr, pr_sibling) != NULL)\t\\\n\t\t    ? LIST_NEXT(cpr, pr_sibling)\t\t\t\\\n\t\t    : (cpr)->pr_parent))));)\t\t\t\t\\\n\t\tif ((descend) ? (prison_lock(cpr), 0) : 1)\t\t\\\n\t\t\t;\t\t\t\t\t\t\\\n\t\telse\n\n/*\n * As above, but also keep track of the level descended to.\n */\n#define\tFOREACH_PRISON_DESCENDANT_LOCKED_LEVEL(ppr, cpr, descend, level)\\\n\tfor ((cpr) = (ppr), (descend) = 1, (level) = 0;\t\t\t\\\n\t    ((cpr) = (((descend) && !LIST_EMPTY(&(cpr)->pr_children))\t\\\n\t      ? (level++, LIST_FIRST(&(cpr)->pr_children))\t\t\\\n\t      : ((cpr) == (ppr)\t\t\t\t\t\t\\\n\t\t ? NULL\t\t\t\t\t\t\t\\\n\t\t : ((prison_unlock(cpr),\t\t\t\t\\\n\t\t    (descend) = LIST_NEXT(cpr, pr_sibling) != NULL)\t\\\n\t\t    ? LIST_NEXT(cpr, pr_sibling)\t\t\t\\\n\t\t    : (level--, (cpr)->pr_parent)))));)\t\t\t\\\n\t\tif ((descend) ? (prison_lock(cpr), 0) : 1)\t\t\\\n\t\t\t;\t\t\t\t\t\t\\\n\t\telse\n\n/*\n * Attributes of the physical system, and the root of the jail tree.\n */\nextern struct\tprison prison0;\n\nTAILQ_HEAD(prisonlist, prison);\nextern struct\tprisonlist allprison;\nextern struct\tsx allprison_lock;\n\n/*\n * Sysctls to describe jail parameters.\n */\nSYSCTL_DECL(_security_jail_param);\n\n#define\tSYSCTL_JAIL_PARAM(module, param, type, fmt, descr)\t\t\\\n    SYSCTL_PROC(_security_jail_param ## module, OID_AUTO, param,\t\\\n\t(type) | CTLFLAG_MPSAFE, NULL, 0, sysctl_jail_param, fmt, descr)\n#define\tSYSCTL_JAIL_PARAM_STRING(module, param, access, len, descr)\t\\\n    SYSCTL_PROC(_security_jail_param ## module, OID_AUTO, param,\t\\\n\tCTLTYPE_STRING | CTLFLAG_MPSAFE | (access), NULL, len,\t\t\\\n\tsysctl_jail_param, \"A\", descr)\n#define\tSYSCTL_JAIL_PARAM_STRUCT(module, param, access, len, fmt, descr)\\\n    SYSCTL_PROC(_security_jail_param ## module, OID_AUTO, param,\t\\\n\tCTLTYPE_STRUCT | CTLFLAG_MPSAFE | (access), NULL, len,\t\t\\\n\tsysctl_jail_param, fmt, descr)\n#define\tSYSCTL_JAIL_PARAM_NODE(module, descr)\t\t\t\t\\\n    SYSCTL_NODE(_security_jail_param, OID_AUTO, module, 0, 0, descr)\n#define\tSYSCTL_JAIL_PARAM_SYS_NODE(module, access, descr)\t\t\\\n    SYSCTL_JAIL_PARAM_NODE(module, descr);\t\t\t\t\\\n    SYSCTL_JAIL_PARAM(_##module, , CTLTYPE_INT | (access), \"E,jailsys\",\t\\\n\tdescr)\n\n/*\n * Kernel support functions for jail().\n */\nstruct ucred;\nstruct mount;\nstruct sockaddr;\nstruct statfs;\nint jailed(struct ucred *cred);\nint jailed_without_vnet(struct ucred *);\nvoid getcredhostname(struct ucred *, char *, size_t);\nvoid getcreddomainname(struct ucred *, char *, size_t);\nvoid getcredhostuuid(struct ucred *, char *, size_t);\nvoid getcredhostid(struct ucred *, unsigned long *);\nint prison_allow(struct ucred *, unsigned);\nint prison_check(struct ucred *cred1, struct ucred *cred2);\nint prison_owns_vnet(struct ucred *);\nint prison_canseemount(struct ucred *cred, struct mount *mp);\nvoid prison_enforce_statfs(struct ucred *cred, struct mount *mp,\n    struct statfs *sp);\nstruct prison *prison_find(int prid);\nstruct prison *prison_find_child(struct prison *, int);\nstruct prison *prison_find_name(struct prison *, const char *);\nint prison_flag(struct ucred *, unsigned);\nvoid prison_free(struct prison *pr);\nvoid prison_free_locked(struct prison *pr);\nvoid prison_hold(struct prison *pr);\nvoid prison_hold_locked(struct prison *pr);\nvoid prison_proc_hold(struct prison *);\nvoid prison_proc_free(struct prison *);\nint prison_ischild(struct prison *, struct prison *);\nint prison_equal_ip4(struct prison *, struct prison *);\nint prison_get_ip4(struct ucred *cred, struct in_addr *ia);\nint prison_local_ip4(struct ucred *cred, struct in_addr *ia);\nint prison_remote_ip4(struct ucred *cred, struct in_addr *ia);\nint prison_check_ip4(struct ucred *cred, struct in_addr *ia);\nint prison_saddrsel_ip4(struct ucred *, struct in_addr *);\n#ifdef INET6\nint prison_equal_ip6(struct prison *, struct prison *);\nint prison_get_ip6(struct ucred *, struct in6_addr *);\nint prison_local_ip6(struct ucred *, struct in6_addr *, int);\nint prison_remote_ip6(struct ucred *, struct in6_addr *);\nint prison_check_ip6(struct ucred *, struct in6_addr *);\nint prison_saddrsel_ip6(struct ucred *, struct in6_addr *);\n#endif\nint prison_check_af(struct ucred *cred, int af);\nint prison_if(struct ucred *cred, struct sockaddr *sa);\nchar *prison_name(struct prison *, struct prison *);\nint prison_priv_check(struct ucred *cred, int priv);\nint sysctl_jail_param(SYSCTL_HANDLER_ARGS);\nvoid prison_racct_foreach(void (*callback)(struct racct *racct,\n    void *arg2, void *arg3), void *arg2, void *arg3);\nstruct prison_racct *prison_racct_find(const char *name);\nvoid prison_racct_hold(struct prison_racct *prr);\nvoid prison_racct_free(struct prison_racct *prr);\n\n#endif /* _KERNEL */\n#endif /* !_SYS_JAIL_H_ */\n"
  },
  {
    "path": "freebsd-headers/sys/joystick.h",
    "content": "/*-\n * Copyright (c) 1995 Jean-Marc Zucconi\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer\n *    in this position and unchanged.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. The name of the author may not be used to endorse or promote products\n *    derived from this software without specific prior written permission\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR\n * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES\n * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,\n * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF\n * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/sys/joystick.h 139866 2005-01-07 19:31:43Z keramida $\n */\n\n#ifndef\t_SYS_JOYSTICK_H_\n#define\t_SYS_JOYSTICK_H_\n\n#include <sys/ioccom.h>\n\nstruct joystick {\n    int x;\n    int y;\n    int b1;\n    int b2;\n};\n\n#define JOY_SETTIMEOUT    _IOW('J', 1, int)    /* set timeout */\n#define JOY_GETTIMEOUT    _IOR('J', 2, int)    /* get timeout */\n#define JOY_SET_X_OFFSET  _IOW('J', 3, int)    /* set offset on X-axis */\n#define JOY_SET_Y_OFFSET  _IOW('J', 4, int)    /* set offset on Y-axis */\n#define JOY_GET_X_OFFSET  _IOR('J', 5, int)    /* get offset on X-axis */\n#define JOY_GET_Y_OFFSET  _IOR('J', 6, int)    /* get offset on Y-axis */\n\n#endif /* !_SYS_JOYSTICK_H_ */\n"
  },
  {
    "path": "freebsd-headers/sys/kbio.h",
    "content": "/*-\n * $FreeBSD: release/9.0.0/sys/sys/kbio.h 224126 2011-07-17 08:19:19Z ed $\n */\n\n#ifndef\t_SYS_KBIO_H_\n#define\t_SYS_KBIO_H_\n\n#ifndef _KERNEL\n#include <sys/types.h>\n#endif\n#include <sys/ioccom.h>\n\n/* get/set keyboard I/O mode */\n#define K_RAW\t\t0\t\t/* keyboard returns scancodes\t*/\n#define K_XLATE\t\t1\t\t/* keyboard returns ascii \t*/\n#define K_CODE\t\t2\t\t/* keyboard returns keycodes \t*/\n#define KDGKBMODE \t_IOR('K', 6, int)\n#define KDSKBMODE \t_IOWINT('K', 7)\n\n/* make tone */\n#define KDMKTONE\t_IOWINT('K', 8)\n\n/* see console.h for the definitions of the following ioctls */\n#ifdef notdef\n#define KDGETMODE\t_IOR('K', 9, int)\n#define KDSETMODE\t_IOWINT('K', 10)\n#define KDSBORDER\t_IOWINT('K', 13)\n#endif\n\n/* get/set keyboard lock state */\n#define CLKED\t\t1\t\t/* Caps locked\t\t\t*/\n#define NLKED\t\t2\t\t/* Num locked\t\t\t*/\n#define SLKED\t\t4\t\t/* Scroll locked\t\t*/\n#define ALKED\t\t8\t\t/* AltGr locked\t\t\t*/\n#define LOCK_MASK\t(CLKED | NLKED | SLKED | ALKED)\n#define KDGKBSTATE\t_IOR('K', 19, int)\n#define KDSKBSTATE\t_IOWINT('K', 20)\n\n/* enable/disable I/O access */\n#define KDENABIO\t_IO('K', 60)\n#define KDDISABIO\t_IO('K', 61)\n\n/* make sound */\n#define KIOCSOUND\t_IOWINT('K', 63)\n\n/* get keyboard model */\n#define KB_OTHER\t0\t\t/* keyboard not known \t\t*/\n#define KB_84\t\t1\t\t/* 'old' 84 key AT-keyboard\t*/\n#define KB_101\t\t2\t\t/* MF-101 or MF-102 keyboard\t*/\n#define KDGKBTYPE\t_IOR('K', 64, int)\n\n/* get/set keyboard LED state */\n#define LED_CAP\t\t1\t\t/* Caps lock LED \t\t*/\n#define LED_NUM\t\t2\t\t/* Num lock LED \t\t*/\n#define LED_SCR\t\t4\t\t/* Scroll lock LED \t\t*/\n#define LED_MASK\t(LED_CAP | LED_NUM | LED_SCR)\n#define KDGETLED\t_IOR('K', 65, int)\n#define KDSETLED\t_IOWINT('K', 66)\n\n/* set keyboard repeat rate (obsolete, use KDSETREPEAT below) */\n#define KDSETRAD\t_IOWINT('K', 67)\n\nstruct keyboard_info {\n\tint\t\tkb_index;\t/* kbdio index#\t\t\t*/\n\tchar\t\tkb_name[16];\t/* driver name\t\t\t*/\n\tint\t\tkb_unit;\t/* unit#\t\t\t*/\n\tint\t\tkb_type;\t/* KB_84, KB_101, KB_OTHER,...\t*/\n\tint\t\tkb_config;\t/* device configuration flags\t*/\n\tint\t\tkb_flags;\t/* internal flags\t\t*/\n};\ntypedef struct keyboard_info keyboard_info_t;\n\n/* add/remove keyboard to/from mux */\n#define KBADDKBD\t_IOW('K', 68, keyboard_info_t)\t/* add keyboard */\n#define KBRELKBD\t_IOW('K', 69, keyboard_info_t)\t/* release keyboard */\n\n/* see console.h for the definition of the following ioctl */\n#ifdef notdef\n#define KDRASTER\t_IOW('K', 100, scr_size_t)\n#endif\n\n/* get keyboard information */\n#define KDGKBINFO\t_IOR('K', 101, keyboard_info_t)\n\n/* set/get keyboard repeat rate (new interface) */\nstruct keyboard_repeat {\n\tint\t\tkb_repeat[2];\n};\ntypedef struct keyboard_repeat keyboard_repeat_t;\n#define KDSETREPEAT\t_IOW('K', 102, keyboard_repeat_t)\n#define KDGETREPEAT\t_IOR('K', 103, keyboard_repeat_t)\n\n/* get/set key map/accent map/function key strings */\n\n#define NUM_KEYS\t256\t\t/* number of keys in table\t*/\n#define NUM_STATES\t8\t\t/* states per key\t\t*/\n#define ALTGR_OFFSET\t128\t\t/* offset for altlock keys\t*/\n\n#define NUM_DEADKEYS\t15\t\t/* number of accent keys\t*/\n#define NUM_ACCENTCHARS\t52\t\t/* max number of accent chars\t*/\n\n#define NUM_FKEYS\t96\t\t/* max number of function keys\t*/\n#define MAXFK\t\t16\t\t/* max length of a function key str */\n\n#ifndef _KEYMAP_DECLARED\n#define\t_KEYMAP_DECLARED\n\nstruct keyent_t {\n\tu_int\t\tmap[NUM_STATES];\n\tu_char\t\tspcl;\n\tu_char\t\tflgs;\n#define\tFLAG_LOCK_O\t0\n#define\tFLAG_LOCK_C\t1\n#define FLAG_LOCK_N\t2\n};\n\nstruct keymap {\n\tu_short\t\tn_keys;\n\tstruct keyent_t\tkey[NUM_KEYS];\n};\ntypedef struct keymap keymap_t;\n\n#ifdef _KERNEL\nstruct okeyent_t {\n\tu_char\t\tmap[NUM_STATES];\n\tu_char\t\tspcl;\n\tu_char\t\tflgs;\n};\n\nstruct okeymap {\n\tu_short\t\tn_keys;\n\tstruct okeyent_t key[NUM_KEYS];\n};\ntypedef struct okeymap okeymap_t;\n#endif /* _KERNEL */\n\n#endif /* !_KEYMAP_DECLARED */\n\n/* defines for \"special\" keys (spcl bit set in keymap) */\n#define NOP\t\t0x00\t\t/* nothing (dead key)\t\t*/\n#define LSH\t\t0x02\t\t/* left shift key\t\t*/\n#define RSH\t\t0x03\t\t/* right shift key\t\t*/\n#define CLK\t\t0x04\t\t/* caps lock key\t\t*/\n#define NLK\t\t0x05\t\t/* num lock key\t\t\t*/\n#define SLK\t\t0x06\t\t/* scroll lock key\t\t*/\n#define LALT\t\t0x07\t\t/* left alt key\t\t\t*/\n#define BTAB\t\t0x08\t\t/* backwards tab\t\t*/\n#define LCTR\t\t0x09\t\t/* left control key\t\t*/\n#define NEXT\t\t0x0a\t\t/* switch to next screen \t*/\n#define F_SCR\t\t0x0b\t\t/* switch to first screen \t*/\n#define L_SCR\t\t0x1a\t\t/* switch to last screen \t*/\n#define F_FN\t\t0x1b\t\t/* first function key \t\t*/\n#define L_FN\t\t0x7a\t\t/* last function key \t\t*/\n/*\t\t\t0x7b-0x7f\t   reserved do not use !\t*/\n#define RCTR\t\t0x80\t\t/* right control key\t\t*/\n#define RALT\t\t0x81\t\t/* right alt (altgr) key\t*/\n#define ALK\t\t0x82\t\t/* alt lock key\t\t\t*/\n#define ASH\t\t0x83\t\t/* alt shift key\t\t*/\n#define META\t\t0x84\t\t/* meta key\t\t\t*/\n#define RBT\t\t0x85\t\t/* boot machine\t\t\t*/\n#define DBG\t\t0x86\t\t/* call debugger\t\t*/\n#define SUSP\t\t0x87\t\t/* suspend power (APM)\t\t*/\n#define SPSC\t\t0x88\t\t/* toggle splash/text screen\t*/\n\n#define F_ACC\t\tDGRA\t\t/* first accent key\t\t*/\n#define DGRA\t\t0x89\t\t/* grave\t\t\t*/\n#define DACU\t\t0x8a\t\t/* acute\t\t\t*/\n#define DCIR\t\t0x8b\t\t/* circumflex\t\t\t*/\n#define DTIL\t\t0x8c\t\t/* tilde\t\t\t*/\n#define DMAC\t\t0x8d\t\t/* macron\t\t\t*/\n#define DBRE\t\t0x8e\t\t/* breve\t\t\t*/\n#define DDOT\t\t0x8f\t\t/* dot\t\t\t\t*/\n#define DUML\t\t0x90\t\t/* umlaut/diaresis\t\t*/\n#define DDIA\t\t0x90\t\t/* diaresis\t\t\t*/\n#define DSLA\t\t0x91\t\t/* slash\t\t\t*/\n#define DRIN\t\t0x92\t\t/* ring\t\t\t\t*/\n#define DCED\t\t0x93\t\t/* cedilla\t\t\t*/\n#define DAPO\t\t0x94\t\t/* apostrophe\t\t\t*/\n#define DDAC\t\t0x95\t\t/* double acute\t\t\t*/\n#define DOGO\t\t0x96\t\t/* ogonek\t\t\t*/\n#define DCAR\t\t0x97\t\t/* caron\t\t\t*/\n#define L_ACC\t\tDCAR\t\t/* last accent key\t\t*/\n\n#define STBY\t\t0x98\t\t/* Go into standby mode (apm)   */\n#define PREV\t\t0x99\t\t/* switch to previous screen \t*/\n#define PNC\t\t0x9a\t\t/* force system panic */\n#define LSHA\t\t0x9b\t\t/* left shift key / alt lock\t*/\n#define RSHA\t\t0x9c\t\t/* right shift key / alt lock\t*/\n#define LCTRA\t\t0x9d\t\t/* left ctrl key / alt lock\t*/\n#define RCTRA\t\t0x9e\t\t/* right ctrl key / alt lock\t*/\n#define LALTA\t\t0x9f\t\t/* left alt key / alt lock\t*/\n#define RALTA\t\t0xa0\t\t/* right alt key / alt lock\t*/\n#define HALT\t\t0xa1\t\t/* halt machine */\n#define PDWN\t\t0xa2\t\t/* halt machine and power down */\n#define PASTE\t\t0xa3\t\t/* paste from cut-paste buffer */\n\n#define F(x)\t\t((x)+F_FN-1)\n#define\tS(x)\t\t((x)+F_SCR-1)\n#define ACC(x)\t\t((x)+F_ACC)\n\nstruct acc_t {\n\tu_char\t\taccchar;\n\tu_char\t\tmap[NUM_ACCENTCHARS][2];\n};\n\nstruct accentmap {\n\tu_short\t\tn_accs;\n\tstruct acc_t\tacc[NUM_DEADKEYS];\n};\ntypedef struct accentmap accentmap_t;\n\nstruct keyarg {\n\tu_short\t\tkeynum;\n\tstruct keyent_t\tkey;\n};\ntypedef struct keyarg keyarg_t;\n\nstruct fkeytab {\n\tu_char\t\tstr[MAXFK];\n\tu_char\t\tlen;\n};\ntypedef struct fkeytab fkeytab_t;\n\nstruct fkeyarg {\n\tu_short\t\tkeynum;\n\tchar\t\tkeydef[MAXFK];\n\tchar\t\tflen;\n};\ntypedef struct fkeyarg\tfkeyarg_t;\n\n#define GETFKEY\t\t_IOWR('k', 0, fkeyarg_t)\n#define SETFKEY\t\t_IOWR('k', 1, fkeyarg_t)\n#ifdef notdef\t\t/* see console.h */\n#define GIO_SCRNMAP\t_IOR('k', 2, scrmap_t)\n#define PIO_SCRNMAP\t_IOW('k', 3, scrmap_t)\n#endif\n/* XXX: Should have keymap_t as an argument, but that's too big for ioctl()! */\n#define GIO_KEYMAP \t _IO('k', 6)\n#define PIO_KEYMAP \t _IO('k', 7)\n#ifdef _KERNEL\n#define OGIO_KEYMAP \t_IOR('k', 6, okeymap_t)\n#define OPIO_KEYMAP \t_IOW('k', 7, okeymap_t)\n#endif /* _KERNEL */\n#define GIO_DEADKEYMAP \t_IOR('k', 8, accentmap_t)\n#define PIO_DEADKEYMAP \t_IOW('k', 9, accentmap_t)\n#define GIO_KEYMAPENT \t_IOWR('k', 10, keyarg_t)\n#define PIO_KEYMAPENT \t_IOW('k', 11, keyarg_t)\n\n/* flags set to the return value in the KD_XLATE mode */\n\n#define\tNOKEY\t\t0x01000000\t/* no key pressed marker \t*/\n#define\tFKEY\t\t0x02000000\t/* function key marker \t\t*/\n#define\tMKEY\t\t0x04000000\t/* meta key marker (prepend ESC)*/\n#define\tBKEY\t\t0x08000000\t/* backtab (ESC [ Z)\t\t*/\n\n#define\tSPCLKEY\t\t0x80000000\t/* special key\t\t\t*/\n#define\tRELKEY\t\t0x40000000\t/* key released\t\t\t*/\n#define\tERRKEY\t\t0x20000000\t/* error\t\t\t*/\n\n/*\n * The top byte is used to store the flags.  This means there are 24\n * bits left to store the actual character.  Because UTF-8 can encode\n * 2^21 different characters, this is good enough to get Unicode\n * working.\n */\n#define KEYCHAR(c)\t((c) & 0x00ffffff)\n#define KEYFLAGS(c)\t((c) & ~0x00ffffff)\n\n#endif /* !_SYS_KBIO_H_ */\n"
  },
  {
    "path": "freebsd-headers/sys/kdb.h",
    "content": "/*-\n * Copyright (c) 2004 Marcel Moolenaar\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n *\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR\n * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES\n * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,\n * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF\n * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/sys/kdb.h 225203 2011-08-26 21:46:36Z rwatson $\n */\n\n#ifndef _SYS_KDB_H_\n#define\t_SYS_KDB_H_\n\n#include <machine/setjmp.h>\n\ntypedef int dbbe_init_f(void);\ntypedef void dbbe_trace_f(void);\ntypedef int dbbe_trap_f(int, int);\n\nstruct kdb_dbbe {\n\tconst char\t*dbbe_name;\n\tdbbe_init_f\t*dbbe_init;\n\tdbbe_trace_f\t*dbbe_trace;\n\tdbbe_trap_f\t*dbbe_trap;\n\tint\t\tdbbe_active;\n};\n\n#define\tKDB_BACKEND(name, init, trace, trap)\t\t\\\n\tstatic struct kdb_dbbe name##_dbbe = {\t\t\\\n\t\t.dbbe_name = #name,\t\t\t\\\n\t\t.dbbe_init = init,\t\t\t\\\n\t\t.dbbe_trace = trace,\t\t\t\\\n\t\t.dbbe_trap = trap\t\t\t\\\n\t};\t\t\t\t\t\t\\\n\tDATA_SET(kdb_dbbe_set, name##_dbbe)\n\nstruct pcb;\nstruct thread;\nstruct trapframe;\n\nextern int kdb_active;\t\t\t/* Non-zero while in debugger. */\nextern int debugger_on_panic;\t\t/* enter the debugger on panic. */\nextern struct kdb_dbbe *kdb_dbbe;\t/* Default debugger backend or NULL. */\nextern struct trapframe *kdb_frame;\t/* Frame to kdb_trap(). */\nextern struct pcb *kdb_thrctx;\t\t/* Current context. */\nextern struct thread *kdb_thread;\t/* Current thread. */\n\nint\tkdb_alt_break(int, int *);\nint\tkdb_alt_break_gdb(int, int *);\nint\tkdb_break(void);\nvoid\tkdb_backtrace(void);\nint\tkdb_dbbe_select(const char *);\nvoid\tkdb_enter(const char *, const char *);\nvoid\tkdb_init(void);\nvoid *\tkdb_jmpbuf(jmp_buf);\nvoid\tkdb_panic(const char *);\nvoid\tkdb_reboot(void);\nvoid\tkdb_reenter(void);\nstruct pcb *kdb_thr_ctx(struct thread *);\nstruct thread *kdb_thr_first(void);\nstruct thread *kdb_thr_from_pid(pid_t);\nstruct thread *kdb_thr_lookup(lwpid_t);\nstruct thread *kdb_thr_next(struct thread *);\nint\tkdb_thr_select(struct thread *);\nint\tkdb_trap(int, int, struct trapframe *);\n\n/*\n * KDB enters the debugger via breakpoint(), which leaves the debugger without\n * a lot of information about why it was entered.  This simple enumerated set\n * captures some basic information.\n *\n * It is recommended that values here be short (<16 character) alpha-numeric\n * strings, as they will be used to construct DDB(4) script names.\n */\nextern const char * volatile kdb_why;\n#define\tKDB_WHY_UNSET\t\tNULL\t\t/* No reason set. */\n#define\tKDB_WHY_PANIC\t\t\"panic\"\t\t/* panic() was called. */\n#define\tKDB_WHY_SYSCTL\t\t\"sysctl\"\t/* Sysctl entered debugger. */\n#define\tKDB_WHY_BOOTFLAGS\t\"bootflags\"\t/* Boot flags were set. */\n#define\tKDB_WHY_WITNESS\t\t\"witness\"\t/* Witness entered debugger. */\n#define\tKDB_WHY_VFSLOCK\t\t\"vfslock\"\t/* VFS detected lock problem. */\n#define\tKDB_WHY_NETGRAPH\t\"netgraph\"\t/* Netgraph entered debugger. */\n#define\tKDB_WHY_BREAK\t\t\"break\"\t\t/* Console or serial break. */\n#define\tKDB_WHY_WATCHDOG\t\"watchdog\"\t/* Watchdog entered debugger. */\n#define\tKDB_WHY_CAM\t\t\"cam\"\t\t/* CAM has entered debugger. */\n#define\tKDB_WHY_NDIS\t\t\"ndis\"\t\t/* NDIS entered debugger. */\n#define\tKDB_WHY_ACPI\t\t\"acpi\"\t\t/* ACPI entered debugger. */\n#define\tKDB_WHY_TRAPSIG\t\t\"trapsig\"\t/* Sparc fault. */\n#define\tKDB_WHY_POWERFAIL\t\"powerfail\"\t/* Powerfail NMI. */\n#define\tKDB_WHY_MAC\t\t\"mac\"\t\t/* MAC Framework. */\n#define\tKDB_WHY_POWERPC\t\t\"powerpc\"\t/* Unhandled powerpc intr. */\n#define\tKDB_WHY_UNIONFS\t\t\"unionfs\"\t/* Unionfs bug. */\n#define\tKDB_WHY_DTRACE\t\t\"dtrace\"\t/* DTrace action entered debugger. */\n\n/* Return values for kdb_alt_break */\n#define\tKDB_REQ_DEBUGGER\t1\t/* User requested Debugger */\n#define\tKDB_REQ_PANIC\t\t2\t/* User requested a panic */\n#define\tKDB_REQ_REBOOT\t\t3\t/* User requested a clean reboot */\n\n#endif /* !_SYS_KDB_H_ */\n"
  },
  {
    "path": "freebsd-headers/sys/kenv.h",
    "content": "/*-\n * Copyright (c) 2002 Maxime Henrion <mux@FreeBSD.org>\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/sys/kenv.h 94936 2002-04-17 13:06:36Z mux $\n */\n\n#ifndef _SYS_KENV_H_\n#define _SYS_KENV_H_\n\n/*\n * Constants for the kenv(2) syscall\n */\n#define KENV_GET\t0\n#define KENV_SET\t1\n#define KENV_UNSET\t2\n#define KENV_DUMP\t3\n\n#define KENV_MNAMELEN\t128\t/* Maximum name length (for the syscall) */\n#define KENV_MVALLEN\t128\t/* Maximum value length (for the syscall) */\n\n#endif /* !_SYS_KENV_H_ */\n"
  },
  {
    "path": "freebsd-headers/sys/kernel.h",
    "content": "/*-\n * Copyright (c) 1995 Terrence R. Lambert\n * All rights reserved.\n *\n * Copyright (c) 1990, 1993\n *\tThe Regents of the University of California.  All rights reserved.\n * (c) UNIX System Laboratories, Inc.\n * All or some portions of this file are derived from material licensed\n * to the University of California by American Telephone and Telegraph\n * Co. or Unix System Laboratories, Inc. and are reproduced herein with\n * the permission of UNIX System Laboratories, Inc.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. All advertising materials mentioning features or use of this software\n *    must display the following acknowledgement:\n *\tThis product includes software developed by the University of\n *\tCalifornia, Berkeley and its contributors.\n * 4. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t@(#)kernel.h\t8.3 (Berkeley) 1/21/94\n * $FreeBSD: release/9.0.0/sys/sys/kernel.h 220137 2011-03-29 17:47:25Z trasz $\n */\n\n#ifndef _SYS_KERNEL_H_\n#define\t_SYS_KERNEL_H_\n\n#include <sys/linker_set.h>\n\n#ifdef _KERNEL\n\n/* for intrhook below */\n#include <sys/queue.h>\n\n/* Global variables for the kernel. */\n\n/* 1.1 */\nextern char kernelname[MAXPATHLEN];\n\nextern int tick;\t\t\t/* usec per tick (1000000 / hz) */\nextern int hz;\t\t\t\t/* system clock's frequency */\nextern int psratio;\t\t\t/* ratio: prof / stat */\nextern int stathz;\t\t\t/* statistics clock's frequency */\nextern int profhz;\t\t\t/* profiling clock's frequency */\nextern int profprocs;\t\t\t/* number of process's profiling */\nextern int ticks;\n\n#endif /* _KERNEL */\n\n/*\n * Enumerated types for known system startup interfaces.\n *\n * Startup occurs in ascending numeric order; the list entries are\n * sorted prior to attempting startup to guarantee order.  Items\n * of the same level are arbitrated for order based on the 'order'\n * element.\n *\n * These numbers are arbitrary and are chosen ONLY for ordering; the\n * enumeration values are explicit rather than implicit to provide\n * for binary compatibility with inserted elements.\n *\n * The SI_SUB_RUN_SCHEDULER value must have the highest lexical value.\n *\n * The SI_SUB_SWAP values represent a value used by\n * the BSD 4.4Lite but not by FreeBSD; it is maintained in dependent\n * order to support porting.\n *\n * The SI_SUB_PROTO_BEGIN and SI_SUB_PROTO_END bracket a range of\n * initializations to take place at splimp().  This is a historical\n * wart that should be removed -- probably running everything at\n * splimp() until the first init that doesn't want it is the correct\n * fix.  They are currently present to ensure historical behavior.\n */\nenum sysinit_sub_id {\n\tSI_SUB_DUMMY\t\t= 0x0000000,\t/* not executed; for linker*/\n\tSI_SUB_DONE\t\t= 0x0000001,\t/* processed*/\n\tSI_SUB_TUNABLES\t\t= 0x0700000,\t/* establish tunable values */\n\tSI_SUB_COPYRIGHT\t= 0x0800001,\t/* first use of console*/\n\tSI_SUB_SETTINGS\t\t= 0x0880000,\t/* check and recheck settings */\n\tSI_SUB_MTX_POOL_STATIC\t= 0x0900000,\t/* static mutex pool */\n\tSI_SUB_LOCKMGR\t\t= 0x0980000,\t/* lockmgr locks */\n\tSI_SUB_VM\t\t= 0x1000000,\t/* virtual memory system init*/\n\tSI_SUB_KMEM\t\t= 0x1800000,\t/* kernel memory*/\n\tSI_SUB_KVM_RSRC\t\t= 0x1A00000,\t/* kvm operational limits*/\n\tSI_SUB_WITNESS\t\t= 0x1A80000,\t/* witness initialization */\n\tSI_SUB_MTX_POOL_DYNAMIC\t= 0x1AC0000,\t/* dynamic mutex pool */\n\tSI_SUB_LOCK\t\t= 0x1B00000,\t/* various locks */\n\tSI_SUB_EVENTHANDLER\t= 0x1C00000,\t/* eventhandler init */\n\tSI_SUB_VNET_PRELINK\t= 0x1E00000,\t/* vnet init before modules */\n\tSI_SUB_KLD\t\t= 0x2000000,\t/* KLD and module setup */\n\tSI_SUB_CPU\t\t= 0x2100000,\t/* CPU resource(s)*/\n\tSI_SUB_RACCT\t\t= 0x2110000,\t/* resource accounting */\n\tSI_SUB_RANDOM\t\t= 0x2120000,\t/* random number generator */\n\tSI_SUB_KDTRACE\t\t= 0x2140000,\t/* Kernel dtrace hooks */\n\tSI_SUB_MAC\t\t= 0x2180000,\t/* TrustedBSD MAC subsystem */\n\tSI_SUB_MAC_POLICY\t= 0x21C0000,\t/* TrustedBSD MAC policies */\n\tSI_SUB_MAC_LATE\t\t= 0x21D0000,\t/* TrustedBSD MAC subsystem */\n\tSI_SUB_VNET\t\t= 0x21E0000,\t/* vnet 0 */\n\tSI_SUB_INTRINSIC\t= 0x2200000,\t/* proc 0*/\n\tSI_SUB_VM_CONF\t\t= 0x2300000,\t/* config VM, set limits*/\n\tSI_SUB_DDB_SERVICES\t= 0x2380000,\t/* capture, scripting, etc. */\n\tSI_SUB_RUN_QUEUE\t= 0x2400000,\t/* set up run queue*/\n\tSI_SUB_KTRACE\t\t= 0x2480000,\t/* ktrace */\n\tSI_SUB_OPENSOLARIS\t= 0x2490000,\t/* OpenSolaris compatibility */\n\tSI_SUB_CYCLIC\t\t= 0x24A0000,\t/* Cyclic timers */\n\tSI_SUB_AUDIT\t\t= 0x24C0000,\t/* audit */\n\tSI_SUB_CREATE_INIT\t= 0x2500000,\t/* create init process*/\n\tSI_SUB_SCHED_IDLE\t= 0x2600000,\t/* required idle procs */\n\tSI_SUB_MBUF\t\t= 0x2700000,\t/* mbuf subsystem */\n\tSI_SUB_INTR\t\t= 0x2800000,\t/* interrupt threads */\n\tSI_SUB_SOFTINTR\t\t= 0x2800001,\t/* start soft interrupt thread */\n\tSI_SUB_ACL\t\t= 0x2900000,\t/* start for filesystem ACLs */\n\tSI_SUB_DEVFS\t\t= 0x2F00000,\t/* devfs ready for devices */\n\tSI_SUB_INIT_IF\t\t= 0x3000000,\t/* prep for net interfaces */\n\tSI_SUB_NETGRAPH\t\t= 0x3010000,\t/* Let Netgraph initialize */\n\tSI_SUB_DTRACE\t\t= 0x3020000,\t/* DTrace subsystem */\n\tSI_SUB_DTRACE_PROVIDER\t= 0x3048000,\t/* DTrace providers */\n\tSI_SUB_DTRACE_ANON\t= 0x308C000,\t/* DTrace anon enabling */\n\tSI_SUB_DRIVERS\t\t= 0x3100000,\t/* Let Drivers initialize */\n\tSI_SUB_CONFIGURE\t= 0x3800000,\t/* Configure devices */\n\tSI_SUB_VFS\t\t= 0x4000000,\t/* virtual filesystem*/\n\tSI_SUB_CLOCKS\t\t= 0x4800000,\t/* real time and stat clocks*/\n\tSI_SUB_CLIST\t\t= 0x5800000,\t/* clists*/\n\tSI_SUB_SYSV_SHM\t\t= 0x6400000,\t/* System V shared memory*/\n\tSI_SUB_SYSV_SEM\t\t= 0x6800000,\t/* System V semaphores*/\n\tSI_SUB_SYSV_MSG\t\t= 0x6C00000,\t/* System V message queues*/\n\tSI_SUB_P1003_1B\t\t= 0x6E00000,\t/* P1003.1B realtime */\n\tSI_SUB_PSEUDO\t\t= 0x7000000,\t/* pseudo devices*/\n\tSI_SUB_EXEC\t\t= 0x7400000,\t/* execve() handlers */\n\tSI_SUB_PROTO_BEGIN\t= 0x8000000,\t/* XXX: set splimp (kludge)*/\n\tSI_SUB_PROTO_IF\t\t= 0x8400000,\t/* interfaces*/\n\tSI_SUB_PROTO_DOMAININIT\t= 0x8600000,\t/* domain registration system */\n\tSI_SUB_PROTO_DOMAIN\t= 0x8800000,\t/* domains (address families?)*/\n\tSI_SUB_PROTO_IFATTACHDOMAIN\t= 0x8800001,\t/* domain dependent data init*/\n\tSI_SUB_PROTO_END\t= 0x8ffffff,\t/* XXX: set splx (kludge)*/\n\tSI_SUB_KPROF\t\t= 0x9000000,\t/* kernel profiling*/\n\tSI_SUB_KICK_SCHEDULER\t= 0xa000000,\t/* start the timeout events*/\n\tSI_SUB_INT_CONFIG_HOOKS\t= 0xa800000,\t/* Interrupts enabled config */\n\tSI_SUB_ROOT_CONF\t= 0xb000000,\t/* Find root devices */\n\tSI_SUB_DUMP_CONF\t= 0xb200000,\t/* Find dump devices */\n\tSI_SUB_RAID\t\t= 0xb380000,\t/* Configure GEOM classes */\n\tSI_SUB_SWAP\t\t= 0xc000000,\t/* swap */\n\tSI_SUB_INTRINSIC_POST\t= 0xd000000,\t/* proc 0 cleanup*/\n\tSI_SUB_SYSCALLS\t\t= 0xd800000,\t/* register system calls */\n\tSI_SUB_VNET_DONE\t= 0xdc00000,\t/* vnet registration complete */\n\tSI_SUB_KTHREAD_INIT\t= 0xe000000,\t/* init process*/\n\tSI_SUB_KTHREAD_PAGE\t= 0xe400000,\t/* pageout daemon*/\n\tSI_SUB_KTHREAD_VM\t= 0xe800000,\t/* vm daemon*/\n\tSI_SUB_KTHREAD_BUF\t= 0xea00000,\t/* buffer daemon*/\n\tSI_SUB_KTHREAD_UPDATE\t= 0xec00000,\t/* update daemon*/\n\tSI_SUB_KTHREAD_IDLE\t= 0xee00000,\t/* idle procs*/\n\tSI_SUB_SMP\t\t= 0xf000000,\t/* start the APs*/\n\tSI_SUB_RACCTD\t\t= 0xf100000,\t/* start raccd*/\n\tSI_SUB_RUN_SCHEDULER\t= 0xfffffff\t/* scheduler*/\n};\n\n\n/*\n * Some enumerated orders; \"ANY\" sorts last.\n */\nenum sysinit_elem_order {\n\tSI_ORDER_FIRST\t\t= 0x0000000,\t/* first*/\n\tSI_ORDER_SECOND\t\t= 0x0000001,\t/* second*/\n\tSI_ORDER_THIRD\t\t= 0x0000002,\t/* third*/\n\tSI_ORDER_FOURTH\t\t= 0x0000003,\t/* fourth*/\n\tSI_ORDER_MIDDLE\t\t= 0x1000000,\t/* somewhere in the middle */\n\tSI_ORDER_ANY\t\t= 0xfffffff\t/* last*/\n};\n\n\n/*\n * A system initialization call instance\n *\n * At the moment there is one instance of sysinit.  We probably do not\n * want two which is why this code is if'd out, but we definitely want\n * to discern SYSINIT's which take non-constant data pointers and\n * SYSINIT's which take constant data pointers,\n *\n * The C_* macros take functions expecting const void * arguments\n * while the non-C_* macros take functions expecting just void * arguments.\n *\n * With -Wcast-qual on, the compiler issues warnings:\n *\t- if we pass non-const data or functions taking non-const data\n *\t  to a C_* macro.\n *\n *\t- if we pass const data to the normal macros\n *\n * However, no warning is issued if we pass a function taking const data\n * through a normal non-const macro.  This is ok because the function is\n * saying it won't modify the data so we don't care whether the data is\n * modifiable or not.\n */\n\ntypedef void (*sysinit_nfunc_t)(void *);\ntypedef void (*sysinit_cfunc_t)(const void *);\n\nstruct sysinit {\n\tenum sysinit_sub_id\tsubsystem;\t/* subsystem identifier*/\n\tenum sysinit_elem_order\torder;\t\t/* init order within subsystem*/\n\tsysinit_cfunc_t func;\t\t\t/* function\t\t*/\n\tconst void\t*udata;\t\t\t/* multiplexer/argument */\n};\n\n/*\n * Default: no special processing\n *\n * The C_ version of SYSINIT is for data pointers to const\n * data ( and functions taking data pointers to const data ).\n * At the moment it is no different from SYSINIT and thus\n * still results in warnings.\n *\n * The casts are necessary to have the compiler produce the\n * correct warnings when -Wcast-qual is used.\n *\n */\n#define\tC_SYSINIT(uniquifier, subsystem, order, func, ident)\t\\\n\tstatic struct sysinit uniquifier ## _sys_init = {\t\\\n\t\tsubsystem,\t\t\t\t\t\\\n\t\torder,\t\t\t\t\t\t\\\n\t\tfunc,\t\t\t\t\t\t\\\n\t\t(ident)\t\t\t\t\t\t\\\n\t};\t\t\t\t\t\t\t\\\n\tDATA_SET(sysinit_set,uniquifier ## _sys_init)\n\n#define\tSYSINIT(uniquifier, subsystem, order, func, ident)\t\\\n\tC_SYSINIT(uniquifier, subsystem, order,\t\t\t\\\n\t(sysinit_cfunc_t)(sysinit_nfunc_t)func, (void *)(ident))\n\n/*\n * Called on module unload: no special processing\n */\n#define\tC_SYSUNINIT(uniquifier, subsystem, order, func, ident)\t\\\n\tstatic struct sysinit uniquifier ## _sys_uninit = {\t\\\n\t\tsubsystem,\t\t\t\t\t\\\n\t\torder,\t\t\t\t\t\t\\\n\t\tfunc,\t\t\t\t\t\t\\\n\t\t(ident)\t\t\t\t\t\t\\\n\t};\t\t\t\t\t\t\t\\\n\tDATA_SET(sysuninit_set,uniquifier ## _sys_uninit)\n\n#define\tSYSUNINIT(uniquifier, subsystem, order, func, ident)\t\\\n\tC_SYSUNINIT(uniquifier, subsystem, order,\t\t\\\n\t(sysinit_cfunc_t)(sysinit_nfunc_t)func, (void *)(ident))\n\nvoid\tsysinit_add(struct sysinit **set, struct sysinit **set_end);\n\n/*\n * Infrastructure for tunable 'constants'.  Value may be specified at compile\n * time or kernel load time.  Rules relating tunables together can be placed\n * in a SYSINIT function at SI_SUB_TUNABLES with SI_ORDER_LAST.\n *\n * WARNING: developers should never use the reserved suffixes specified in\n * loader.conf(5) for any tunables or conflicts will result.\n */\n\n/*\n * int\n * please avoid using for new tunables!\n */\nextern void tunable_int_init(void *);\nstruct tunable_int {\n\tconst char *path;\n\tint *var;\n};\n#define\tTUNABLE_INT(path, var)\t\t\t\t\t\\\n\tstatic struct tunable_int __CONCAT(__tunable_int_, __LINE__) = { \\\n\t\t(path),\t\t\t\t\t\t\\\n\t\t(var),\t\t\t\t\t\t\\\n\t};\t\t\t\t\t\t\t\\\n\tSYSINIT(__CONCAT(__Tunable_init_, __LINE__),\t\t\\\n\t    SI_SUB_TUNABLES, SI_ORDER_MIDDLE, tunable_int_init,\t\\\n\t    &__CONCAT(__tunable_int_, __LINE__))\n\n#define\tTUNABLE_INT_FETCH(path, var)\tgetenv_int((path), (var))\n\n/*\n * long\n */\nextern void tunable_long_init(void *);\nstruct tunable_long {\n\tconst char *path;\n\tlong *var;\n};\n#define\tTUNABLE_LONG(path, var)\t\t\t\t\t\\\n\tstatic struct tunable_long __CONCAT(__tunable_long_, __LINE__) = { \\\n\t\t(path),\t\t\t\t\t\t\\\n\t\t(var),\t\t\t\t\t\t\\\n\t};\t\t\t\t\t\t\t\\\n\tSYSINIT(__CONCAT(__Tunable_init_, __LINE__),\t\t\\\n\t    SI_SUB_TUNABLES, SI_ORDER_MIDDLE, tunable_long_init,\\\n\t    &__CONCAT(__tunable_long_, __LINE__))\n\n#define\tTUNABLE_LONG_FETCH(path, var)\tgetenv_long((path), (var))\n\n/*\n * unsigned long\n */\nextern void tunable_ulong_init(void *);\nstruct tunable_ulong {\n\tconst char *path;\n\tunsigned long *var;\n};\n#define\tTUNABLE_ULONG(path, var)\t\t\t\t\\\n\tstatic struct tunable_ulong __CONCAT(__tunable_ulong_, __LINE__) = { \\\n\t\t(path),\t\t\t\t\t\t\\\n\t\t(var),\t\t\t\t\t\t\\\n\t};\t\t\t\t\t\t\t\\\n\tSYSINIT(__CONCAT(__Tunable_init_, __LINE__),\t\t\\\n\t    SI_SUB_TUNABLES, SI_ORDER_MIDDLE, tunable_ulong_init, \\\n\t    &__CONCAT(__tunable_ulong_, __LINE__))\n\n#define\tTUNABLE_ULONG_FETCH(path, var)\tgetenv_ulong((path), (var))\n\n/*\n * quad\n */\nextern void tunable_quad_init(void *);\nstruct tunable_quad {\n\tconst char *path;\n\tquad_t *var;\n};\n#define\tTUNABLE_QUAD(path, var)\t\t\t\t\t\\\n\tstatic struct tunable_quad __CONCAT(__tunable_quad_, __LINE__) = { \\\n\t\t(path),\t\t\t\t\t\t\\\n\t\t(var),\t\t\t\t\t\t\\\n\t};\t\t\t\t\t\t\t\\\n\tSYSINIT(__CONCAT(__Tunable_init_, __LINE__),\t\t\\\n\t    SI_SUB_TUNABLES, SI_ORDER_MIDDLE, tunable_quad_init, \\\n\t    &__CONCAT(__tunable_quad_, __LINE__))\n\n#define\tTUNABLE_QUAD_FETCH(path, var)\tgetenv_quad((path), (var))\n\nextern void tunable_str_init(void *);\nstruct tunable_str {\n\tconst char *path;\n\tchar *var;\n\tint size;\n};\n#define\tTUNABLE_STR(path, var, size)\t\t\t\t\\\n\tstatic struct tunable_str __CONCAT(__tunable_str_, __LINE__) = { \\\n\t\t(path),\t\t\t\t\t\t\\\n\t\t(var),\t\t\t\t\t\t\\\n\t\t(size),\t\t\t\t\t\t\\\n\t};\t\t\t\t\t\t\t\\\n\tSYSINIT(__CONCAT(__Tunable_init_, __LINE__),\t\t\\\n\t    SI_SUB_TUNABLES, SI_ORDER_MIDDLE, tunable_str_init,\t\\\n\t    &__CONCAT(__tunable_str_, __LINE__))\n\n#define\tTUNABLE_STR_FETCH(path, var, size)\t\t\t\\\n\tgetenv_string((path), (var), (size))\n\nstruct intr_config_hook {\n\tTAILQ_ENTRY(intr_config_hook) ich_links;\n\tvoid\t(*ich_func)(void *arg);\n\tvoid\t*ich_arg;\n};\n\nint\tconfig_intrhook_establish(struct intr_config_hook *hook);\nvoid\tconfig_intrhook_disestablish(struct intr_config_hook *hook);\n\n#endif /* !_SYS_KERNEL_H_*/\n"
  },
  {
    "path": "freebsd-headers/sys/kerneldump.h",
    "content": "/*-\n * Copyright (c) 2002 Poul-Henning Kamp\n * Copyright (c) 2002 Networks Associates Technology, Inc.\n * All rights reserved.\n *\n * This software was developed for the FreeBSD Project by Poul-Henning Kamp\n * and NAI Labs, the Security Research Division of Network Associates, Inc.\n * under DARPA/SPAWAR contract N66001-01-C-8035 (\"CBOSS\"), as part of the\n * DARPA CHATS research program.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. The names of the authors may not be used to endorse or promote\n *    products derived from this software without specific prior written\n *    permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/sys/kerneldump.h 214903 2010-11-07 03:09:02Z gonzo $\n */\n\n#ifndef _SYS_KERNELDUMP_H\n#define _SYS_KERNELDUMP_H\n\n#include <machine/endian.h>\n\n#if BYTE_ORDER == LITTLE_ENDIAN\n#define\tdtoh32(x)\t__bswap32(x)\n#define\tdtoh64(x)\t__bswap64(x)\n#define\thtod32(x)\t__bswap32(x)\n#define\thtod64(x)\t__bswap64(x)\n#elif BYTE_ORDER == BIG_ENDIAN\n#define\tdtoh32(x)\t(x)\n#define\tdtoh64(x)\t(x)\n#define\thtod32(x)\t(x)\n#define\thtod64(x)\t(x)\n#endif\n\n/*\n * All uintX_t fields are in dump byte order, which is the same as\n * network byte order. Use the macros defined above to read or\n * write the fields.\n */\nstruct kerneldumpheader {\n\tchar\t\tmagic[20];\n#define\tKERNELDUMPMAGIC\t\t\"FreeBSD Kernel Dump\"\n#define\tTEXTDUMPMAGIC\t\t\"FreeBSD Text Dump\"\n#define\tKERNELDUMPMAGIC_CLEARED\t\"Cleared Kernel Dump\"\n\tchar\t\tarchitecture[12];\n\tuint32_t\tversion;\n#define\tKERNELDUMPVERSION\t1\n\tuint32_t\tarchitectureversion;\n#define\tKERNELDUMP_ALPHA_VERSION\t1\n#define\tKERNELDUMP_AMD64_VERSION\t2\n#define\tKERNELDUMP_ARM_VERSION\t\t1\n#define\tKERNELDUMP_I386_VERSION\t\t2\n#define\tKERNELDUMP_IA64_VERSION\t\t1\n#define\tKERNELDUMP_MIPS_VERSION\t\t1\n#define\tKERNELDUMP_POWERPC_VERSION\t1\n#define\tKERNELDUMP_SPARC64_VERSION\t1\n#define\tKERNELDUMP_TEXT_VERSION\t\t1\n\tuint64_t\tdumplength;\t\t/* excl headers */\n\tuint64_t\tdumptime;\n\tuint32_t\tblocksize;\n\tchar\t\thostname[64];\n\tchar\t\tversionstring[192];\n\tchar\t\tpanicstring[192];\n\tuint32_t\tparity;\n};\n\n/*\n * Parity calculation is endian insensitive.\n */\nstatic __inline u_int32_t\nkerneldump_parity(struct kerneldumpheader *kdhp)\n{\n\tuint32_t *up, parity;\n\tu_int i;\n\n\tup = (uint32_t *)kdhp;\n\tparity = 0;\n\tfor (i = 0; i < sizeof *kdhp; i += sizeof *up)\n\t\tparity ^= *up++;\n\treturn (parity);\n}\n\n#ifdef _KERNEL\nvoid mkdumpheader(struct kerneldumpheader *kdh, char *magic, uint32_t archver,\n    uint64_t dumplen, uint32_t blksz);\n#endif\n\n#endif /* _SYS_KERNELDUMP_H */\n"
  },
  {
    "path": "freebsd-headers/sys/khelp.h",
    "content": "/*-\n * Copyright (c) 2010 Lawrence Stewart <lstewart@freebsd.org>\n * Copyright (c) 2010 The FreeBSD Foundation\n * All rights reserved.\n *\n * This software was developed by Lawrence Stewart while studying at the Centre\n * for Advanced Internet Architectures, Swinburne University of Technology, made\n * possible in part by grants from the FreeBSD Foundation and Cisco University\n * Research Program Fund at Community Foundation Silicon Valley.\n *\n * Portions of this software were developed at the Centre for Advanced\n * Internet Architectures, Swinburne University of Technology, Melbourne,\n * Australia by Lawrence Stewart under sponsorship from the FreeBSD Foundation.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/sys/khelp.h 220560 2011-04-12 08:13:18Z lstewart $\n */\n\n/*\n * A KPI for managing kernel helper modules which perform useful functionality\n * within the kernel. Originally released as part of the NewTCP research project\n * at Swinburne University of Technology's Centre for Advanced Internet\n * Architectures, Melbourne, Australia, which was made possible in part by a\n * grant from the Cisco University Research Program Fund at Community Foundation\n * Silicon Valley. More details are available at:\n *   http://caia.swin.edu.au/urp/newtcp/\n */\n\n#ifndef\t_SYS_KHELP_H_\n#define\t_SYS_KHELP_H_\n\nstruct helper;\nstruct hookinfo;\nstruct osd;\n\n/* Helper classes. */\n#define\tHELPER_CLASS_TCP\t0x00000001\n\n/* Public KPI functions. */\nint\tkhelp_register_helper(struct helper *h);\n\nint\tkhelp_deregister_helper(struct helper *h);\n\nint\tkhelp_init_osd(uint32_t classes, struct osd *hosd);\n\nint\tkhelp_destroy_osd(struct osd *hosd);\n\nvoid *\tkhelp_get_osd(struct osd *hosd, int32_t id);\n\nint32_t\tkhelp_get_id(char *hname);\n\nint\tkhelp_add_hhook(struct hookinfo *hki, uint32_t flags);\n\nint\tkhelp_remove_hhook(struct hookinfo *hki);\n\n#endif /* _SYS_KHELP_H_ */\n"
  },
  {
    "path": "freebsd-headers/sys/kobj.h",
    "content": "/*-\n * Copyright (c) 2000,2003 Doug Rabson\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t$FreeBSD: release/9.0.0/sys/sys/kobj.h 227712 2011-11-19 12:55:34Z marius $\n */\n\n#ifndef _SYS_KOBJ_H_\n#define _SYS_KOBJ_H_\n\n/*\n * Forward declarations\n */\ntypedef struct kobj\t\t*kobj_t;\ntypedef struct kobj_class\t*kobj_class_t;\ntypedef struct kobj_method\tkobj_method_t;\ntypedef int\t\t\t(*kobjop_t)(void);\ntypedef struct kobj_ops\t\t*kobj_ops_t;\ntypedef struct kobjop_desc\t*kobjop_desc_t;\nstruct malloc_type;\n\nstruct kobj_method {\n\tkobjop_desc_t\tdesc;\n\tkobjop_t\tfunc;\n};\n\n/*\n * A class is simply a method table and a sizeof value. When the first\n * instance of the class is created, the method table will be compiled \n * into a form more suited to efficient method dispatch. This compiled \n * method table is always the first field of the object.\n */\n#define KOBJ_CLASS_FIELDS\t\t\t\t\t\t\\\n\tconst char\t*name;\t\t/* class name */\t\t\\\n\tkobj_method_t\t*methods;\t/* method table */\t\t\\\n\tsize_t\t\tsize;\t\t/* object size */\t\t\\\n\tkobj_class_t\t*baseclasses;\t/* base classes */\t\t\\\n\tu_int\t\trefs;\t\t/* reference count */\t\t\\\n\tkobj_ops_t\tops\t\t/* compiled method table */\n\nstruct kobj_class {\n\tKOBJ_CLASS_FIELDS;\n};\n\n/*\n * Implementation of kobj.\n */\n#define KOBJ_FIELDS\t\t\t\t\\\n\tkobj_ops_t\tops\n\nstruct kobj {\n\tKOBJ_FIELDS;\n};\n\n/*\n * The ops table is used as a cache of results from kobj_lookup_method().\n */\n\n#define KOBJ_CACHE_SIZE\t256\n\nstruct kobj_ops {\n\tkobj_method_t\t*cache[KOBJ_CACHE_SIZE];\n\tkobj_class_t\tcls;\n};\n\nstruct kobjop_desc {\n\tunsigned int\tid;\t\t/* unique ID */\n\tkobj_method_t\t*deflt;\t\t/* default implementation */\n};\n\n/*\n * Shorthand for constructing method tables.\n * The ternary operator is (ab)used to provoke a warning when FUNC\n * has a signature that is not compatible with kobj method signature.\n */\n#define KOBJMETHOD(NAME, FUNC) \\\n\t{ &NAME##_desc, (kobjop_t) (1 ? FUNC : (NAME##_t *)NULL) }\n\n/*\n *\n */\n#define KOBJMETHOD_END\t{ NULL, NULL }\n\n/*\n * Declare a class (which should be defined in another file.\n */\n#define DECLARE_CLASS(name) extern struct kobj_class name\n\n/*\n * Define a class with no base classes (api backward-compatible. with\n * FreeBSD-5.1 and earlier).\n */\n#define DEFINE_CLASS(name, methods, size)     \t\t\\\nDEFINE_CLASS_0(name, name ## _class, methods, size)\n\n/*\n * Define a class with no base classes. Use like this:\n *\n * DEFINE_CLASS_0(foo, foo_class, foo_methods, sizeof(foo_softc));\n */\n#define DEFINE_CLASS_0(name, classvar, methods, size)\t\\\n\t\t\t\t\t\t\t\\\nstruct kobj_class classvar = {\t\t\t\t\\\n\t#name, methods, size, NULL\t\t\t\\\n}\n\n/*\n * Define a class inheriting a single base class. Use like this:\n *\n * DEFINE_CLASS_1(foo, foo_class, foo_methods, sizeof(foo_softc),\n *\t\t\t  bar);\n */\n#define DEFINE_CLASS_1(name, classvar, methods, size,\t\\\n\t\t       base1)\t\t\t\t\\\n\t\t\t\t\t\t\t\\\nstatic kobj_class_t name ## _baseclasses[] =\t\t\\\n\t{ &base1, NULL };\t\t\t\t\\\nstruct kobj_class classvar = {\t\t\t\t\\\n\t#name, methods, size, name ## _baseclasses\t\\\n}\n\n/*\n * Define a class inheriting two base classes. Use like this:\n *\n * DEFINE_CLASS_2(foo, foo_class, foo_methods, sizeof(foo_softc),\n *\t\t\t  bar, baz);\n */\n#define DEFINE_CLASS_2(name, methods, size,\t\t\\\n\t               base1, base2)\t\t\t\\\n\t\t\t\t\t\t\t\\\nstatic kobj_class_t name ## _baseclasses[] =\t\t\\\n\t{ &base1,\t\t\t\t\t\\\n\t  &base2, NULL };\t\t\t\t\\\nstruct kobj_class name ## _class = {\t\t\t\\\n\t#name, methods, size, name ## _baseclasses\t\\\n}\n\n/*\n * Define a class inheriting three base classes. Use like this:\n *\n * DEFINE_CLASS_3(foo, foo_class, foo_methods, sizeof(foo_softc),\n *\t\t\t  bar, baz, foobar);\n */\n#define DEFINE_CLASS_3(name, methods, size,\t\t\\\n\t\t       base1, base2, base3)\t\t\\\n\t\t\t\t\t\t\t\\\nstatic kobj_class_t name ## _baseclasses[] =\t\t\\\n\t{ &base1,\t\t\t\t\t\\\n\t  &base2,\t\t\t\t\t\\\n\t  &base3, NULL };\t\t\t\t\\\nstruct kobj_class name ## _class = {\t\t\t\\\n\t#name, methods, size, name ## _baseclasses\t\\\n}\n\n\n/*\n * Compile the method table in a class.\n */\nvoid\t\tkobj_class_compile(kobj_class_t cls);\n\n/*\n * Compile the method table, with the caller providing the space for\n * the ops table.(for use before malloc is initialised).\n */\nvoid\t\tkobj_class_compile_static(kobj_class_t cls, kobj_ops_t ops);\n\n/*\n * Free the compiled method table in a class.\n */\nvoid\t\tkobj_class_free(kobj_class_t cls);\n\n/*\n * Allocate memory for and initialise a new object.\n */\nkobj_t\t\tkobj_create(kobj_class_t cls,\n\t\t\t    struct malloc_type *mtype,\n\t\t\t    int mflags);\n\n/*\n * Initialise a pre-allocated object.\n */\nvoid\t\tkobj_init(kobj_t obj, kobj_class_t cls);\nvoid\t\tkobj_init_static(kobj_t obj, kobj_class_t cls);\n\n/*\n * Delete an object. If mtype is non-zero, free the memory.\n */\nvoid\t\tkobj_delete(kobj_t obj, struct malloc_type *mtype);\n\n/*\n * Maintain stats on hits/misses in lookup caches.\n */\n#ifdef KOBJ_STATS\nextern u_int kobj_lookup_hits;\nextern u_int kobj_lookup_misses;\n#endif\n\n/*\n * Lookup the method in the cache and if it isn't there look it up the\n * slow way.\n */\n#ifdef KOBJ_STATS\n#define KOBJOPLOOKUP(OPS,OP) do {\t\t\t\t\\\n\tkobjop_desc_t _desc = &OP##_##desc;\t\t\t\\\n\tkobj_method_t **_cep =\t\t\t\t\t\\\n\t    &OPS->cache[_desc->id & (KOBJ_CACHE_SIZE-1)];\t\\\n\tkobj_method_t *_ce = *_cep;\t\t\t\t\\\n\tkobj_lookup_hits++; /* assume hit */\t\t\t\\\n\tif (_ce->desc != _desc)\t\t\t\t\t\\\n\t\t_ce = kobj_lookup_method(OPS->cls,\t\t\\\n\t\t\t\t\t _cep, _desc);\t\t\\\n\t_m = _ce->func;\t\t\t\t\t\t\\\n} while(0)\n#else\n#define KOBJOPLOOKUP(OPS,OP) do {\t\t\t\t\\\n\tkobjop_desc_t _desc = &OP##_##desc;\t\t\t\\\n\tkobj_method_t **_cep =\t\t\t\t\t\\\n\t    &OPS->cache[_desc->id & (KOBJ_CACHE_SIZE-1)];\t\\\n\tkobj_method_t *_ce = *_cep;\t\t\t\t\\\n\tif (_ce->desc != _desc)\t\t\t\t\t\\\n\t\t_ce = kobj_lookup_method(OPS->cls,\t\t\\\n\t\t\t\t\t _cep, _desc);\t\t\\\n\t_m = _ce->func;\t\t\t\t\t\t\\\n} while(0)\n#endif\n\nkobj_method_t* kobj_lookup_method(kobj_class_t cls,\n\t\t\t\t  kobj_method_t **cep,\n\t\t\t\t  kobjop_desc_t desc);\n\n\n/*\n * Default method implementation. Returns ENXIO.\n */\nint kobj_error_method(void);\n\n#endif /* !_SYS_KOBJ_H_ */\n"
  },
  {
    "path": "freebsd-headers/sys/ksem.h",
    "content": "/*-\n * Copyright (c) 2002 Alfred Perlstein <alfred@FreeBSD.org>\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/sys/ksem.h 180059 2008-06-27 05:39:04Z jhb $\n */\n\n#ifndef _POSIX4_KSEM_H_\n#define\t_POSIX4_KSEM_H_\n\n#ifndef _KERNEL\n#error \"no user-servicable parts inside\"\n#endif\n\n#include <sys/condvar.h>\n\nstruct ksem {\n\tint\t\tks_ref;\t\t/* number of references */\n\tmode_t\t\tks_mode;\t/* protection bits */\n\tuid_t\t\tks_uid;\t\t/* creator uid */\n\tgid_t\t\tks_gid;\t\t/* creator gid */\n\tunsigned int\tks_value;\t/* current value */\n\tstruct cv\tks_cv;\t\t/* waiters sleep here */\n\tint\t\tks_waiters;\t/* number of waiters */\n\tint\t\tks_flags;\n\n\t/*\n\t * Values maintained solely to make this a better-behaved file\n\t * descriptor for fstat() to run on.\n\t *\n\t * XXX: dubious\n\t */\n\tstruct timespec\tks_atime;\n\tstruct timespec\tks_mtime;\n\tstruct timespec\tks_ctime;\n\tstruct timespec\tks_birthtime;\n\n\tstruct label\t*ks_label;\t/* MAC label */\n};\n\n#define\tKS_ANONYMOUS\t0x0001\t\t/* Anonymous (unnamed) semaphore. */\n#define\tKS_DEAD\t\t0x0002\t\t/* No new waiters allowed. */\n\n#endif /* !_POSIX4_KSEM_H_ */\n"
  },
  {
    "path": "freebsd-headers/sys/ksyms.h",
    "content": "/*-\n * Copyright (c) 2008-2009, Stacey Son <sson@freebsd.org> \n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/sys/ksyms.h 192859 2009-05-26 21:39:09Z sson $\n */\n\n#ifndef _SYS_KSYMS_H_\n#define _SYS_KSYMS_H_\n\n#include <sys/ioccom.h>\n\n#define KIOCGSIZE\t_IOR('l', 1, size_t)\t\n#define KIOCGADDR\t_IOR('l', 2, void *)\t\n\n#endif /* _SYS_KSYMS_H_ */\n"
  },
  {
    "path": "freebsd-headers/sys/kthread.h",
    "content": "/*-\n * Copyright (c) 1999 Peter Wemm <peter@FreeBSD.org>\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/sys/kthread.h 210365 2010-07-22 05:42:29Z trasz $\n */\n\n#ifndef _SYS_KTHREAD_H_\n#define\t_SYS_KTHREAD_H_\n\n#include <sys/cdefs.h>\n\n/*\n * A kernel process descriptor; used to start \"internal\" daemons.\n *\n * Note: global_procpp may be NULL for no global save area.\n */\nstruct kproc_desc {\n\tchar\t\t*arg0;\t\t\t/* arg 0 (for 'ps' listing) */\n\tvoid\t\t(*func)(void);\t/* \"main\" for kernel process */\n\tstruct proc\t**global_procpp;\t/* ptr to proc ptr save area */\n};\n\n /* A kernel thread descriptor; used to start \"internal\" daemons. */\nstruct kthread_desc {\n\tchar\t\t*arg0;\t\t\t/* arg 0 (for 'ps' listing) */\n\tvoid\t\t(*func)(void);\t\t/* \"main\" for kernel thread */\n\tstruct thread\t**global_threadpp;\t/* ptr to thread ptr save area */\n};\n\nint     kproc_create(void (*)(void *), void *, struct proc **,\n\t    int flags, int pages, const char *, ...) __printflike(6, 7);\nvoid    kproc_exit(int) __dead2;\nint\tkproc_resume(struct proc *);\nvoid\tkproc_shutdown(void *, int);\nvoid\tkproc_start(const void *);\nint\tkproc_suspend(struct proc *, int);\nvoid\tkproc_suspend_check(struct proc *);\n\n/* create a thread inthe given process. create the process if needed */\nint     kproc_kthread_add(void (*)(void *), void *,\n\t    struct proc **,\n\t    struct thread **,\n\t    int flags, int pages,\n\t    const char *procname, const char *, ...) __printflike(8, 9);\n\nint     kthread_add(void (*)(void *), void *,\n\t    struct proc *, struct thread **,\n\t    int flags, int pages, const char *, ...) __printflike(7, 8);\nvoid    kthread_exit(void) __dead2;\nint\tkthread_resume(struct thread *);\nvoid\tkthread_shutdown(void *, int);\nvoid\tkthread_start(const void *);\nint\tkthread_suspend(struct thread *, int);\nvoid\tkthread_suspend_check(void);\n\n\n#endif /* !_SYS_KTHREAD_H_ */\n"
  },
  {
    "path": "freebsd-headers/sys/ktr.h",
    "content": "/*-\n * Copyright (c) 1996 Berkeley Software Design, Inc. All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. Berkeley Software Design Inc's name may not be used to endorse or\n *    promote products derived from this software without specific prior\n *    written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY BERKELEY SOFTWARE DESIGN INC ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL BERKELEY SOFTWARE DESIGN INC BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\tfrom BSDI $Id: ktr.h,v 1.10.2.7 2000/03/16 21:44:42 cp Exp $\n * $FreeBSD: release/9.0.0/sys/sys/ktr.h 222813 2011-06-07 08:46:13Z attilio $\n */\n\n/*\n *\tWraparound kernel trace buffer support.\n */\n\n#ifndef _SYS_KTR_H_\n#define _SYS_KTR_H_\n\n/*\n * Trace classes\n *\n * Two of the trace classes (KTR_DEV and KTR_SUBSYS) are special in that\n * they are really placeholders so that indvidual drivers and subsystems\n * can map their internal tracing to the general class when they wish to\n * have tracing enabled and map it to 0 when they don't.\n */\n#define\tKTR_GEN\t\t0x00000001\t\t/* General (TR) */\n#define\tKTR_NET\t\t0x00000002\t\t/* Network */\n#define\tKTR_DEV\t\t0x00000004\t\t/* Device driver */\n#define\tKTR_LOCK\t0x00000008\t\t/* MP locking */\n#define\tKTR_SMP\t\t0x00000010\t\t/* MP general */\n#define\tKTR_SUBSYS\t0x00000020\t\t/* Subsystem. */\n#define\tKTR_PMAP\t0x00000040\t\t/* Pmap tracing */\n#define\tKTR_MALLOC\t0x00000080\t\t/* Malloc tracing */\n#define\tKTR_TRAP\t0x00000100\t\t/* Trap processing */\n#define\tKTR_INTR\t0x00000200\t\t/* Interrupt tracing */\n#define\tKTR_SIG\t\t0x00000400\t\t/* Signal processing */\n#define\tKTR_SPARE2\t0x00000800\t\t/* XXX Used by cxgb */\n#define\tKTR_PROC\t0x00001000\t\t/* Process scheduling */\n#define\tKTR_SYSC\t0x00002000\t\t/* System call */\n#define\tKTR_INIT\t0x00004000\t\t/* System initialization */\n#define\tKTR_SPARE3\t0x00008000\t\t/* XXX Used by cxgb */\n#define\tKTR_SPARE4\t0x00010000\t\t/* XXX Used by cxgb */\n#define\tKTR_EVH\t\t0x00020000\t\t/* Eventhandler */\n#define\tKTR_VFS\t\t0x00040000\t\t/* VFS events */\n#define\tKTR_VOP\t\t0x00080000\t\t/* Auto-generated vop events */\n#define\tKTR_VM\t\t0x00100000\t\t/* The virtual memory system */\n#define\tKTR_INET\t0x00200000\t\t/* IPv4 stack */\n#define\tKTR_RUNQ\t0x00400000\t\t/* Run queue */\n#define\tKTR_CONTENTION\t0x00800000\t\t/* Lock contention */\n#define\tKTR_UMA\t\t0x01000000\t\t/* UMA slab allocator */\n#define\tKTR_CALLOUT\t0x02000000\t\t/* Callouts and timeouts */\n#define\tKTR_GEOM\t0x04000000\t\t/* GEOM I/O events */\n#define\tKTR_BUSDMA\t0x08000000\t\t/* busdma(9) events */\n#define\tKTR_INET6\t0x10000000\t\t/* IPv6 stack */\n#define\tKTR_SCHED\t0x20000000\t\t/* Machine parsed sched info. */\n#define\tKTR_BUF\t\t0x40000000\t\t/* Buffer cache */\n#define\tKTR_ALL\t\t0x7fffffff\n\n/* Trace classes to compile in */\n#ifdef KTR\n#ifndef KTR_COMPILE\n#define\tKTR_COMPILE\t(KTR_ALL)\n#endif\n#else\t/* !KTR */\n#undef KTR_COMPILE\n#define KTR_COMPILE 0\n#endif\t/* KTR */\n\n/*\n * Version number for ktr_entry struct.  Increment this when you break binary\n * compatibility.\n */\n#define\tKTR_VERSION\t2\n\n#define\tKTR_PARMS\t6\n\n#ifndef LOCORE\n\n#include <sys/param.h>\n#include <sys/_cpuset.h>\n\nstruct ktr_entry {\n\tu_int64_t ktr_timestamp;\n\tint\tktr_cpu;\n\tint\tktr_line;\n\tconst\tchar *ktr_file;\n\tconst\tchar *ktr_desc;\n\tstruct\tthread *ktr_thread;\n\tu_long\tktr_parms[KTR_PARMS];\n};\n\nextern cpuset_t ktr_cpumask;\nextern int ktr_mask;\nextern int ktr_entries;\nextern int ktr_verbose;\n\nextern volatile int ktr_idx;\nextern struct ktr_entry ktr_buf[];\n\n#ifdef KTR\n\nvoid\tktr_tracepoint(u_int mask, const char *file, int line,\n\t    const char *format, u_long arg1, u_long arg2, u_long arg3,\n\t    u_long arg4, u_long arg5, u_long arg6);\n\n#define CTR6(m, format, p1, p2, p3, p4, p5, p6) do {\t\t\t\\\n\tif (KTR_COMPILE & (m))\t\t\t\t\t\t\\\n\t\tktr_tracepoint((m), __FILE__, __LINE__, format,\t\t\\\n\t\t    (u_long)(p1), (u_long)(p2), (u_long)(p3),\t\t\\\n\t\t    (u_long)(p4), (u_long)(p5), (u_long)(p6));\t\t\\\n\t} while(0)\n#define CTR0(m, format)\t\t\tCTR6(m, format, 0, 0, 0, 0, 0, 0)\n#define CTR1(m, format, p1)\t\tCTR6(m, format, p1, 0, 0, 0, 0, 0)\n#define\tCTR2(m, format, p1, p2)\t\tCTR6(m, format, p1, p2, 0, 0, 0, 0)\n#define\tCTR3(m, format, p1, p2, p3)\tCTR6(m, format, p1, p2, p3, 0, 0, 0)\n#define\tCTR4(m, format, p1, p2, p3, p4)\tCTR6(m, format, p1, p2, p3, p4, 0, 0)\n#define\tCTR5(m, format, p1, p2, p3, p4, p5)\tCTR6(m, format, p1, p2, p3, p4, p5, 0)\n#else\t/* KTR */\n#define\tCTR0(m, d)\t\t\t(void)0\n#define\tCTR1(m, d, p1)\t\t\t(void)0\n#define\tCTR2(m, d, p1, p2)\t\t(void)0\n#define\tCTR3(m, d, p1, p2, p3)\t\t(void)0\n#define\tCTR4(m, d, p1, p2, p3, p4)\t(void)0\n#define\tCTR5(m, d, p1, p2, p3, p4, p5)\t(void)0\n#define\tCTR6(m, d, p1, p2, p3, p4, p5, p6)\t(void)0\n#endif\t/* KTR */\n\n#define\tTR0(d)\t\t\t\tCTR0(KTR_GEN, d)\n#define\tTR1(d, p1)\t\t\tCTR1(KTR_GEN, d, p1)\n#define\tTR2(d, p1, p2)\t\t\tCTR2(KTR_GEN, d, p1, p2)\n#define\tTR3(d, p1, p2, p3)\t\tCTR3(KTR_GEN, d, p1, p2, p3)\n#define\tTR4(d, p1, p2, p3, p4)\t\tCTR4(KTR_GEN, d, p1, p2, p3, p4)\n#define\tTR5(d, p1, p2, p3, p4, p5)\tCTR5(KTR_GEN, d, p1, p2, p3, p4, p5)\n#define\tTR6(d, p1, p2, p3, p4, p5, p6)\tCTR6(KTR_GEN, d, p1, p2, p3, p4, p5, p6)\n\n/*\n * The event macros implement KTR graphic plotting facilities provided\n * by src/tools/sched/schedgraph.py.  Three generic types of events are\n * supported: states, counters, and points.\n *\n * m is the ktr class for ktr_mask.\n * ident is the string identifier that owns the event (ie: \"thread 10001\")\n * etype is the type of event to plot (state, counter, point)\n * edat is the event specific data (state name, counter value, point name)\n * up to four attributes may be supplied as a name, value pair of arguments.\n *\n * etype and attribute names must be string constants.  This minimizes the\n * number of ktr slots required by construction the final format strings\n * at compile time.  Both must also include a colon and format specifier\n * (ie. \"prio:%d\", prio).  It is recommended that string arguments be\n * contained within escaped quotes if they may contain ',' or ':' characters.\n *\n * The special attribute (KTR_ATTR_LINKED, ident) creates a reference to another\n * id on the graph for easy traversal of related graph elements.\n */\n\n#define\tKTR_ATTR_LINKED\t\"linkedto:\\\"%s\\\"\"\n#define\tKTR_EFMT(egroup, ident, etype)\t\t\t\t\t\\\n\t    \"KTRGRAPH group:\\\"\" egroup \"\\\", id:\\\"%s\\\", \" etype \", attributes: \"\n\n#define\tKTR_EVENT0(m, egroup, ident, etype, edat)\t\t\t\\\n\tCTR2(m,\tKTR_EFMT(egroup, ident, etype) \"none\", ident, edat)\n#define\tKTR_EVENT1(m, egroup, ident, etype, edat, a0, v0)\t\t\\\n\tCTR3(m, KTR_EFMT(egroup, ident, etype) a0, ident, edat, (v0))\n#define\tKTR_EVENT2(m, egroup, ident, etype, edat, a0, v0, a1, v1)\t\\\n\tCTR4(m, KTR_EFMT(egroup, ident, etype) a0 \", \" a1,\t\t\\\n\t    ident, edat, (v0), (v1))\n#define\tKTR_EVENT3(m, egroup, ident, etype, edat, a0, v0, a1, v1, a2, v2)\\\n\tCTR5(m,KTR_EFMT(egroup, ident, etype) a0 \", \" a1 \", \" a2,\t\\\n\t    ident, edat, (v0), (v1), (v2))\n#define\tKTR_EVENT4(m, egroup, ident, etype, edat,\t\t\t\\\n\t    a0, v0, a1, v1, a2, v2, a3, v3)\t\t\t\t\\\n\tCTR6(m,KTR_EFMT(egroup, ident, etype) a0 \", \" a1 \", \" a2 \", \" a3,\\\n\t     ident, edat, (v0), (v1), (v2), (v3))\n\n/*\n * State functions graph state changes on an ident.\n */\n#define KTR_STATE0(m, egroup, ident, state)\t\t\t\t\\\n\tKTR_EVENT0(m, egroup, ident, \"state:\\\"%s\\\"\", state)\n#define KTR_STATE1(m, egroup, ident, state, a0, v0)\t\t\t\\\n\tKTR_EVENT1(m, egroup, ident, \"state:\\\"%s\\\"\", state, a0, (v0))\n#define KTR_STATE2(m, egroup, ident, state, a0, v0, a1, v1)\t\t\\\n\tKTR_EVENT2(m, egroup, ident, \"state:\\\"%s\\\"\", state, a0, (v0), a1, (v1))\n#define KTR_STATE3(m, egroup, ident, state, a0, v0, a1, v1, a2, v2)\t\\\n\tKTR_EVENT3(m, egroup, ident, \"state:\\\"%s\\\"\",\t\t\t\\\n\t    state, a0, (v0), a1, (v1), a2, (v2))\n#define KTR_STATE4(m, egroup, ident, state, a0, v0, a1, v1, a2, v2, a3, v3)\\\n\tKTR_EVENT4(m, egroup, ident, \"state:\\\"%s\\\"\",\t\t\t\\\n\t    state, a0, (v0), a1, (v1), a2, (v2), a3, (v3))\n\n/*\n * Counter functions graph counter values.  The counter id\n * must not be intermixed with a state id. \n */\n#define\tKTR_COUNTER0(m, egroup, ident, counter)\t\t\t\t\\\n\tKTR_EVENT0(m, egroup, ident, \"counter:%d\", counter)\n#define\tKTR_COUNTER1(m, egroup, ident, edat, a0, v0)\t\t\t\\\n\tKTR_EVENT1(m, egroup, ident, \"counter:%d\", counter, a0, (v0))\n#define\tKTR_COUNTER2(m, egroup, ident, counter, a0, v0, a1, v1)\t\t\\\n\tKTR_EVENT2(m, egroup, ident, \"counter:%d\", counter, a0, (v0), a1, (v1))\n#define\tKTR_COUNTER3(m, egroup, ident, counter, a0, v0, a1, v1, a2, v2)\t\\\n\tKTR_EVENT3(m, egroup, ident, \"counter:%d\",\t\t\t\\\n\t    counter, a0, (v0), a1, (v1), a2, (v2))\n#define\tKTR_COUNTER4(m, egroup, ident, counter, a0, v0, a1, v1, a2, v2, a3, v3)\\\n\tKTR_EVENT4(m, egroup, ident, \"counter:%d\",\t\t\t\\\n\t    counter, a0, (v0), a1, (v1), a2, (v2), a3, (v3))\n\n/*\n * Point functions plot points of interest on counter or state graphs.\n */\n#define\tKTR_POINT0(m, egroup, ident, point)\t\t\t\t\\\n\tKTR_EVENT0(m, egroup, ident, \"point:\\\"%s\\\"\", point)\n#define\tKTR_POINT1(m, egroup, ident, point, a0, v0)\t\t\t\\\n\tKTR_EVENT1(m, egroup, ident, \"point:\\\"%s\\\"\", point, a0, (v0))\n#define\tKTR_POINT2(m, egroup, ident, point, a0, v0, a1, v1)\t\t\\\n\tKTR_EVENT2(m, egroup, ident, \"point:\\\"%s\\\"\", point, a0, (v0), a1, (v1))\n#define\tKTR_POINT3(m, egroup, ident, point, a0, v0, a1, v1, a2, v2)\t\\\n\tKTR_EVENT3(m, egroup, ident, \"point:\\\"%s\\\"\", point,\t\t\\\n\t    a0, (v0), a1, (v1), a2, (v2))\n#define\tKTR_POINT4(m, egroup, ident, point, a0, v0, a1, v1, a2, v2, a3, v3)\\\n\tKTR_EVENT4(m, egroup, ident, \"point:\\\"%s\\\"\",\t\t\t\\\n\t    point, a0, (v0), a1, (v1), a2, (v2), a3, (v3))\n\n/*\n * Trace initialization events, similar to CTR with KTR_INIT, but\n * completely ifdef'ed out if KTR_INIT isn't in KTR_COMPILE (to\n * save string space, the compiler doesn't optimize out strings\n * for the conditional ones above).\n */\n#if (KTR_COMPILE & KTR_INIT) != 0\n#define\tITR0(d)\t\t\t\tCTR0(KTR_INIT, d)\n#define\tITR1(d, p1)\t\t\tCTR1(KTR_INIT, d, p1)\n#define\tITR2(d, p1, p2)\t\t\tCTR2(KTR_INIT, d, p1, p2)\n#define\tITR3(d, p1, p2, p3)\t\tCTR3(KTR_INIT, d, p1, p2, p3)\n#define\tITR4(d, p1, p2, p3, p4)\t\tCTR4(KTR_INIT, d, p1, p2, p3, p4)\n#define\tITR5(d, p1, p2, p3, p4, p5)\tCTR5(KTR_INIT, d, p1, p2, p3, p4, p5)\n#define\tITR6(d, p1, p2, p3, p4, p5, p6)\tCTR6(KTR_INIT, d, p1, p2, p3, p4, p5, p6)\n#else\n#define\tITR0(d)\n#define\tITR1(d, p1)\n#define\tITR2(d, p1, p2)\n#define\tITR3(d, p1, p2, p3)\n#define\tITR4(d, p1, p2, p3, p4)\n#define\tITR5(d, p1, p2, p3, p4, p5)\n#define\tITR6(d, p1, p2, p3, p4, p5, p6)\n#endif\n\n#endif /* !LOCORE */\n\n#endif /* !_SYS_KTR_H_ */\n"
  },
  {
    "path": "freebsd-headers/sys/ktrace.h",
    "content": "/*-\n * Copyright (c) 1988, 1993\n *\tThe Regents of the University of California.  All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 4. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t@(#)ktrace.h\t8.1 (Berkeley) 6/2/93\n * $FreeBSD: release/9.0.0/sys/sys/ktrace.h 219042 2011-02-25 22:05:33Z dchagin $\n */\n\n#ifndef _SYS_KTRACE_H_\n#define _SYS_KTRACE_H_\n\n/*\n * operations to ktrace system call  (KTROP(op))\n */\n#define KTROP_SET\t\t0\t/* set trace points */\n#define KTROP_CLEAR\t\t1\t/* clear trace points */\n#define KTROP_CLEARFILE\t\t2\t/* stop all tracing to file */\n#define\tKTROP(o)\t\t((o)&3)\t/* macro to extract operation */\n/*\n * flags (ORed in with operation)\n */\n#define KTRFLAG_DESCEND\t\t4\t/* perform op on all children too */\n\n/*\n * ktrace record header\n */\nstruct ktr_header {\n\tint\tktr_len;\t\t/* length of buf */\n\tshort\tktr_type;\t\t/* trace record type */\n\tpid_t\tktr_pid;\t\t/* process id */\n\tchar\tktr_comm[MAXCOMLEN + 1];/* command name */\n\tstruct\ttimeval ktr_time;\t/* timestamp */\n\tintptr_t\tktr_tid;\t/* was ktr_buffer */\n};\n\n/*\n * Test for kernel trace point (MP SAFE).\n *\n * KTRCHECK() just checks that the type is enabled and is only for\n * internal use in the ktrace subsystem.  KTRPOINT() checks against\n * ktrace recursion as well as checking that the type is enabled and\n * is the public interface.\n */\n#define\tKTRCHECK(td, type)\t((td)->td_proc->p_traceflag & (1 << type))\n#define KTRPOINT(td, type)\t\t\t\t\t\t\\\n\t(KTRCHECK((td), (type)) && !((td)->td_pflags & TDP_INKTRACE))\n#define\tKTRCHECKDRAIN(td)\t(!(STAILQ_EMPTY(&(td)->td_proc->p_ktr)))\n#define\tKTRUSERRET(td) do {\t\t\t\t\t\t\\\n\tif (KTRCHECKDRAIN(td))\t\t\t\t\t\t\\\n\t\tktruserret(td);\t\t\t\t\t\t\\\n} while (0)\n\n/*\n * ktrace record types\n */\n\n/*\n * KTR_SYSCALL - system call record\n */\n#define KTR_SYSCALL\t1\nstruct ktr_syscall {\n\tshort\tktr_code;\t\t/* syscall number */\n\tshort\tktr_narg;\t\t/* number of arguments */\n\t/*\n\t * followed by ktr_narg register_t\n\t */\n\tregister_t\tktr_args[1];\n};\n\n/*\n * KTR_SYSRET - return from system call record\n */\n#define KTR_SYSRET\t2\nstruct ktr_sysret {\n\tshort\tktr_code;\n\tshort\tktr_eosys;\n\tint\tktr_error;\n\tregister_t\tktr_retval;\n};\n\n/*\n * KTR_NAMEI - namei record\n */\n#define KTR_NAMEI\t3\n\t/* record contains pathname */\n\n/*\n * KTR_GENIO - trace generic process i/o\n */\n#define KTR_GENIO\t4\nstruct ktr_genio {\n\tint\tktr_fd;\n\tenum\tuio_rw ktr_rw;\n\t/*\n\t * followed by data successfully read/written\n\t */\n};\n\n/*\n * KTR_PSIG - trace processed signal\n */\n#define\tKTR_PSIG\t5\nstruct ktr_psig {\n\tint\tsigno;\n\tsig_t\taction;\n\tint\tcode;\n\tsigset_t mask;\n};\n\n/*\n * KTR_CSW - trace context switches\n */\n#define KTR_CSW\t\t6\nstruct ktr_csw {\n\tint\tout;\t/* 1 if switch out, 0 if switch in */\n\tint\tuser;\t/* 1 if usermode (ivcsw), 0 if kernel (vcsw) */\n};\n\n/*\n * KTR_USER - data coming from userland\n */\n#define KTR_USER_MAXLEN\t2048\t/* maximum length of passed data */\n#define KTR_USER\t7\n\n/*\n * KTR_STRUCT - misc. structs\n */\n#define KTR_STRUCT\t8\n\t/*\n\t * record contains null-terminated struct name followed by\n\t * struct contents\n\t */\nstruct sockaddr;\nstruct stat;\nstruct sysentvec;\n\n/*\n * KTR_SYSCTL - name of a sysctl MIB\n */\n#define\tKTR_SYSCTL\t9\n\t/* record contains null-terminated MIB name */\n\n/*\n * KTR_PROCCTOR - trace process creation (multiple ABI support)\n */\n#define KTR_PROCCTOR\t10\nstruct ktr_proc_ctor {\n\tu_int\tsv_flags;\t/* struct sysentvec sv_flags copy */\n};\n\n/*\n * KTR_PROCDTOR - trace process destruction (multiple ABI support)\n */\n#define KTR_PROCDTOR\t11\n\n/*\n * KTR_DROP - If this bit is set in ktr_type, then at least one event\n * between the previous record and this record was dropped.\n */\n#define\tKTR_DROP\t0x8000\n\n/*\n * kernel trace points (in p_traceflag)\n */\n#define KTRFAC_MASK\t0x00ffffff\n#define KTRFAC_SYSCALL\t(1<<KTR_SYSCALL)\n#define KTRFAC_SYSRET\t(1<<KTR_SYSRET)\n#define KTRFAC_NAMEI\t(1<<KTR_NAMEI)\n#define KTRFAC_GENIO\t(1<<KTR_GENIO)\n#define\tKTRFAC_PSIG\t(1<<KTR_PSIG)\n#define KTRFAC_CSW\t(1<<KTR_CSW)\n#define KTRFAC_USER\t(1<<KTR_USER)\n#define KTRFAC_STRUCT\t(1<<KTR_STRUCT)\n#define KTRFAC_SYSCTL\t(1<<KTR_SYSCTL)\n#define KTRFAC_PROCCTOR\t(1<<KTR_PROCCTOR)\n#define KTRFAC_PROCDTOR\t(1<<KTR_PROCDTOR)\n\n/*\n * trace flags (also in p_traceflags)\n */\n#define KTRFAC_ROOT\t0x80000000\t/* root set this trace */\n#define KTRFAC_INHERIT\t0x40000000\t/* pass trace flags to children */\n#define\tKTRFAC_DROP\t0x20000000\t/* last event was dropped */\n\n#ifdef\t_KERNEL\nvoid\tktrnamei(char *);\nvoid\tktrcsw(int, int);\nvoid\tktrpsig(int, sig_t, sigset_t *, int);\nvoid\tktrgenio(int, enum uio_rw, struct uio *, int);\nvoid\tktrsyscall(int, int narg, register_t args[]);\nvoid\tktrsysctl(int *name, u_int namelen);\nvoid\tktrsysret(int, int, register_t);\nvoid\tktrprocctor(struct proc *);\nvoid\tktrprocexec(struct proc *, struct ucred **, struct vnode **);\nvoid\tktrprocexit(struct thread *);\nvoid\tktrprocfork(struct proc *, struct proc *);\nvoid\tktruserret(struct thread *);\nvoid\tktrstruct(const char *, void *, size_t);\n#define ktrsockaddr(s) \\\n\tktrstruct(\"sockaddr\", (s), ((struct sockaddr *)(s))->sa_len)\n#define ktrstat(s) \\\n\tktrstruct(\"stat\", (s), sizeof(struct stat))\n\n#else\n\n#include <sys/cdefs.h>\n\n__BEGIN_DECLS\nint\tktrace(const char *, int, int, pid_t);\nint\tutrace(const void *, size_t);\n__END_DECLS\n\n#endif\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/sys/libkern.h",
    "content": "/*-\n * Copyright (c) 1992, 1993\n *\tThe Regents of the University of California.  All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 4. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t@(#)libkern.h\t8.1 (Berkeley) 6/10/93\n * $FreeBSD: release/9.0.0/sys/sys/libkern.h 226229 2011-10-10 19:07:55Z jkim $\n */\n\n#ifndef _SYS_LIBKERN_H_\n#define\t_SYS_LIBKERN_H_\n\n#include <sys/cdefs.h>\n#include <sys/types.h>\n#ifdef _KERNEL\n#include <sys/systm.h>\n#endif\n\n#ifndef\tLIBKERN_INLINE\n#define\tLIBKERN_INLINE  static __inline\n#define\tLIBKERN_BODY\n#endif\n\n/* BCD conversions. */\nextern u_char const\tbcd2bin_data[];\nextern u_char const\tbin2bcd_data[];\nextern char const\thex2ascii_data[];\n\n#define\tbcd2bin(bcd)\t(bcd2bin_data[bcd])\n#define\tbin2bcd(bin)\t(bin2bcd_data[bin])\n#define\thex2ascii(hex)\t(hex2ascii_data[hex])\n\nstatic __inline int imax(int a, int b) { return (a > b ? a : b); }\nstatic __inline int imin(int a, int b) { return (a < b ? a : b); }\nstatic __inline long lmax(long a, long b) { return (a > b ? a : b); }\nstatic __inline long lmin(long a, long b) { return (a < b ? a : b); }\nstatic __inline u_int max(u_int a, u_int b) { return (a > b ? a : b); }\nstatic __inline u_int min(u_int a, u_int b) { return (a < b ? a : b); }\nstatic __inline quad_t qmax(quad_t a, quad_t b) { return (a > b ? a : b); }\nstatic __inline quad_t qmin(quad_t a, quad_t b) { return (a < b ? a : b); }\nstatic __inline u_long ulmax(u_long a, u_long b) { return (a > b ? a : b); }\nstatic __inline u_long ulmin(u_long a, u_long b) { return (a < b ? a : b); }\nstatic __inline off_t omax(off_t a, off_t b) { return (a > b ? a : b); }\nstatic __inline off_t omin(off_t a, off_t b) { return (a < b ? a : b); }\n\nstatic __inline int abs(int a) { return (a < 0 ? -a : a); }\nstatic __inline long labs(long a) { return (a < 0 ? -a : a); }\nstatic __inline quad_t qabs(quad_t a) { return (a < 0 ? -a : a); }\n\n/* Prototypes for non-quad routines. */\nstruct malloc_type;\nuint32_t arc4random(void);\nvoid\t arc4rand(void *ptr, u_int len, int reseed);\nint\t bcmp(const void *, const void *, size_t);\nvoid\t*bsearch(const void *, const void *, size_t,\n\t    size_t, int (*)(const void *, const void *));\n#ifndef\tHAVE_INLINE_FFS\nint\t ffs(int);\n#endif\n#ifndef\tHAVE_INLINE_FFSL\nint\t ffsl(long);\n#endif\n#ifndef\tHAVE_INLINE_FLS\nint\t fls(int);\n#endif\n#ifndef\tHAVE_INLINE_FLSL\nint\t flsl(long);\n#endif\nint\t fnmatch(const char *, const char *, int);\nvoid\t gets(char *, size_t, int);\nint\t locc(int, char *, u_int);\nvoid\t*memchr(const void *s, int c, size_t n);\nint\t memcmp(const void *b1, const void *b2, size_t len);\nvoid\t qsort(void *base, size_t nmemb, size_t size,\n\t    int (*compar)(const void *, const void *));\nvoid\t qsort_r(void *base, size_t nmemb, size_t size, void *thunk,\n\t    int (*compar)(void *, const void *, const void *));\nu_long\t random(void);\nchar\t*index(const char *, int);\nchar\t*rindex(const char *, int);\nint\t scanc(u_int, const u_char *, const u_char *, int);\nint\t skpc(int, int, char *);\nvoid\t srandom(u_long);\nint\t strcasecmp(const char *, const char *);\nchar\t*strcat(char * __restrict, const char * __restrict);\nint\t strcmp(const char *, const char *);\nchar\t*strcpy(char * __restrict, const char * __restrict);\nsize_t\t strcspn(const char * __restrict, const char * __restrict) __pure;\nchar\t*strdup(const char *__restrict, struct malloc_type *);\nsize_t\t strlcat(char *, const char *, size_t);\nsize_t\t strlcpy(char *, const char *, size_t);\nsize_t\t strlen(const char *);\nint\t strncasecmp(const char *, const char *, size_t);\nint\t strncmp(const char *, const char *, size_t);\nchar\t*strncpy(char * __restrict, const char * __restrict, size_t);\nsize_t\t strnlen(const char *, size_t);\nchar\t*strsep(char **, const char *delim);\nsize_t\t strspn(const char *, const char *);\nchar\t*strstr(const char *, const char *);\nint\t strvalid(const char *, size_t);\n\nextern uint32_t crc32_tab[];\n\nstatic __inline uint32_t\ncrc32_raw(const void *buf, size_t size, uint32_t crc)\n{\n\tconst uint8_t *p = (const uint8_t *)buf;\n\n\twhile (size--)\n\t\tcrc = crc32_tab[(crc ^ *p++) & 0xFF] ^ (crc >> 8);\n\treturn (crc);\n}\n\nstatic __inline uint32_t\ncrc32(const void *buf, size_t size)\n{\n\tuint32_t crc;\n\n\tcrc = crc32_raw(buf, size, ~0U);\n\treturn (crc ^ ~0U);\n}\n\nuint32_t\ncalculate_crc32c(uint32_t crc32c, const unsigned char *buffer, \n        unsigned int length);\n\n\nLIBKERN_INLINE void *memset(void *, int, size_t);\n#ifdef LIBKERN_BODY\nLIBKERN_INLINE void *\nmemset(void *b, int c, size_t len)\n{\n\tchar *bb;\n\n\tif (c == 0)\n\t\tbzero(b, len);\n\telse\n\t\tfor (bb = (char *)b; len--; )\n\t\t\t*bb++ = c;\n\treturn (b);\n}\n#endif\n\nstatic __inline char *\nstrchr(const char *p, int ch)\n{\n\treturn (index(p, ch));\n}\n\nstatic __inline char *\nstrrchr(const char *p, int ch)\n{\n\treturn (rindex(p, ch));\n}\n\n/* fnmatch() return values. */\n#define\tFNM_NOMATCH\t1\t/* Match failed. */\n\n/* fnmatch() flags. */\n#define\tFNM_NOESCAPE\t0x01\t/* Disable backslash escaping. */\n#define\tFNM_PATHNAME\t0x02\t/* Slash must be matched by slash. */\n#define\tFNM_PERIOD\t0x04\t/* Period must be matched by period. */\n#define\tFNM_LEADING_DIR\t0x08\t/* Ignore /<tail> after Imatch. */\n#define\tFNM_CASEFOLD\t0x10\t/* Case insensitive search. */\n#define\tFNM_IGNORECASE\tFNM_CASEFOLD\n#define\tFNM_FILE_NAME\tFNM_PATHNAME\n\n/* Visibility of characters in gets() */\n#define\tGETS_NOECHO\t0\t/* Disable echoing of characters. */\n#define\tGETS_ECHO\t1\t/* Enable echoing of characters. */\n#define\tGETS_ECHOPASS\t2\t/* Print a * for every character. */\n\n#endif /* !_SYS_LIBKERN_H_ */\n"
  },
  {
    "path": "freebsd-headers/sys/limits.h",
    "content": "/*-\n * Copyright (c) 1988, 1993\n *\tThe Regents of the University of California.  All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 4. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/sys/limits.h 219271 2011-03-04 19:28:27Z jilles $\n */\n\n#ifndef _SYS_LIMITS_H_\n#define\t_SYS_LIMITS_H_\n\n#include <sys/cdefs.h>\n#include <machine/_limits.h>\n\n#define\tCHAR_BIT\t__CHAR_BIT\t/* number of bits in a char */\n\n#define\tSCHAR_MAX\t__SCHAR_MAX\t/* max value for a signed char */\n#define\tSCHAR_MIN\t__SCHAR_MIN\t/* min value for a signed char */\n\n#define\tUCHAR_MAX\t__UCHAR_MAX\t/* max value for an unsigned char */\n\n#ifdef __CHAR_UNSIGNED__\n#define\tCHAR_MAX\tUCHAR_MAX\t/* max value for a char */\n#define\tCHAR_MIN\t0\t\t/* min value for a char */\n#else\n#define\tCHAR_MAX\tSCHAR_MAX\n#define\tCHAR_MIN\tSCHAR_MIN\n#endif\n\n#define\tUSHRT_MAX\t__USHRT_MAX\t/* max value for an unsigned short */\n#define\tSHRT_MAX\t__SHRT_MAX\t/* max value for a short */\n#define\tSHRT_MIN\t__SHRT_MIN\t/* min value for a short */\n\n#define\tUINT_MAX\t__UINT_MAX\t/* max value for an unsigned int */\n#define\tINT_MAX\t\t__INT_MAX\t/* max value for an int */\n#define\tINT_MIN\t\t__INT_MIN\t/* min value for an int */\n\n#define\tULONG_MAX\t__ULONG_MAX\t/* max for an unsigned long */\n#define\tLONG_MAX\t__LONG_MAX\t/* max for a long */\n#define\tLONG_MIN\t__LONG_MIN\t/* min for a long */\n\n#ifdef __LONG_LONG_SUPPORTED\n#define\tULLONG_MAX\t__ULLONG_MAX\t/* max for an unsigned long long */\n#define\tLLONG_MAX\t__LLONG_MAX\t/* max for a long long */\n#define\tLLONG_MIN\t__LLONG_MIN\t/* min for a long long */\n#endif\n\n#if __POSIX_VISIBLE || __XSI_VISIBLE\n#define\tSSIZE_MAX\t__SSIZE_MAX\t/* max value for an ssize_t */\n#endif\n\n#if __POSIX_VISIBLE >= 200112 || __XSI_VISIBLE\n#define\tSIZE_T_MAX\t__SIZE_T_MAX\t/* max value for a size_t */\n\n#define\tOFF_MAX\t\t__OFF_MAX\t/* max value for an off_t */\n#define\tOFF_MIN\t\t__OFF_MIN\t/* min value for an off_t */\n#endif\n\n#if __BSD_VISIBLE\n#define\tGID_MAX\t\tUINT_MAX\t/* max value for a gid_t */\n#define\tUID_MAX\t\tUINT_MAX\t/* max value for a uid_t */\n\n#define\tUQUAD_MAX\t(__UQUAD_MAX)\t/* max value for a uquad_t */\n#define\tQUAD_MAX\t(__QUAD_MAX)\t/* max value for a quad_t */\n#define\tQUAD_MIN\t(__QUAD_MIN)\t/* min value for a quad_t */\n#endif\n\n#if __XSI_VISIBLE || __POSIX_VISIBLE >= 200809\n#define\tLONG_BIT\t__LONG_BIT\n#define\tWORD_BIT\t__WORD_BIT\n#endif\n\n#if __POSIX_VISIBLE\n#define\tMQ_PRIO_MAX\t64\n#endif\n\n#endif /* !_SYS_LIMITS_H_ */\n"
  },
  {
    "path": "freebsd-headers/sys/link_aout.h",
    "content": "/*-\n * Copyright (c) 1993 Paul Kranenburg\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. All advertising materials mentioning features or use of this software\n *    must display the following acknowledgement:\n *      This product includes software developed by Paul Kranenburg.\n * 4. The name of the author may not be used to endorse or promote products\n *    derived from this software without specific prior written permission\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR\n * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES\n * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,\n * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF\n * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/sys/link_aout.h 139825 2005-01-07 02:29:27Z imp $\n */\n\n/*\n * RRS section definitions.\n *\n * The layout of some data structures defined in this header file is\n * such that we can provide compatibility with the SunOS 4.x shared\n * library scheme.\n */\n\n#ifndef _SYS_LINK_AOUT_H_\n#define _SYS_LINK_AOUT_H_\n\nstruct dl_info;\n\n/*\n * A `Shared Object Descriptor' describes a shared object that is needed\n * to complete the link edit process of the object containing it.\n * A list of such objects (chained through `sod_next') is pointed at\n * by `sdt_sods' in the section_dispatch_table structure.\n */\n\nstruct sod {\t/* Shared Object Descriptor */\n\tlong\tsod_name;\t\t/* name (relative to load address) */\n\tu_int\tsod_library  : 1,\t/* Searched for by library rules */\n\t\tsod_reserved : 31;\n\tshort\tsod_major;\t\t/* major version number */\n\tshort\tsod_minor;\t\t/* minor version number */\n\tlong\tsod_next;\t\t/* next sod */\n};\n\n/*\n * `Shared Object Map's are used by the run-time link editor (ld.so) to\n * keep track of all shared objects loaded into a process' address space.\n * These structures are only used at run-time and do not occur within\n * the text or data segment of an executable or shared library.\n */\nstruct so_map {\t\t/* Shared Object Map */\n\tcaddr_t\t\tsom_addr;\t/* Address at which object mapped */\n\tchar \t\t*som_path;\t/* Path to mmap'ed file */\n\tstruct so_map\t*som_next;\t/* Next map in chain */\n\tstruct sod\t*som_sod;\t/* Sod responsible for this map */\n\tcaddr_t\t\tsom_sodbase;\t/* Base address of this sod */\n\tu_int\t\tsom_write : 1;\t/* Text is currently writable */\n\tstruct _dynamic\t*som_dynamic;\t/* _dynamic structure */\n\tcaddr_t\t\tsom_spd;\t/* Private data */\n};\n\n/*\n * Symbol description with size. This is simply an `nlist' with\n * one field (nz_size) added.\n * Used to convey size information on items in the data segment\n * of shared objects. An array of these live in the shared object's\n * text segment and is addressed by the `sdt_nzlist' field.\n */\nstruct nzlist {\n\tstruct nlist\tnlist;\n\tu_long\t\tnz_size;\n};\n\n#define nz_un\t\tnlist.n_un\n#define nz_strx\t\tnlist.n_un.n_strx\n#define nz_name\t\tnlist.n_un.n_name\n#define nz_type\t\tnlist.n_type\n#define nz_value\tnlist.n_value\n#define nz_desc\t\tnlist.n_desc\n#define nz_other\tnlist.n_other\n\n/*\n * The `section_dispatch_table' structure contains offsets to various data\n * structures needed to do run-time relocation.\n */\nstruct section_dispatch_table {\n\tstruct so_map *sdt_loaded;\t/* List of loaded objects */\n\tlong\tsdt_sods;\t\t/* List of shared objects descriptors */\n\tlong\tsdt_paths;\t\t/* Library search paths */\n\tlong\tsdt_got;\t\t/* Global offset table */\n\tlong\tsdt_plt;\t\t/* Procedure linkage table */\n\tlong\tsdt_rel;\t\t/* Relocation table */\n\tlong\tsdt_hash;\t\t/* Symbol hash table */\n\tlong\tsdt_nzlist;\t\t/* Symbol table itself */\n\tlong\tsdt_filler2;\t\t/* Unused (was: stab_hash) */\n\tlong\tsdt_buckets;\t\t/* Number of hash buckets */\n\tlong\tsdt_strings;\t\t/* Symbol strings */\n\tlong\tsdt_str_sz;\t\t/* Size of symbol strings */\n\tlong\tsdt_text_sz;\t\t/* Size of text area */\n\tlong\tsdt_plt_sz;\t\t/* Size of procedure linkage table */\n};\n\n/*\n * RRS symbol hash table, addressed by `sdt_hash' in section_dispatch_table.\n * Used to quickly lookup symbols of the shared object by hashing\n * on the symbol's name. `rh_symbolnum' is the index of the symbol\n * in the shared object's symbol list (`sdt_nzlist'), `rh_next' is\n * the next symbol in the hash bucket (in case of collisions).\n */\nstruct rrs_hash {\n\tint\trh_symbolnum;\t\t/* Symbol number */\n\tint\trh_next;\t\t/* Next hash entry */\n};\n\n/*\n * `rt_symbols' is used to keep track of run-time allocated commons\n * and data items copied from shared objects.\n */\nstruct rt_symbol {\n\tstruct nzlist\t\t*rt_sp;\t\t/* The symbol */\n\tstruct rt_symbol\t*rt_next;\t/* Next in linear list */\n\tstruct rt_symbol\t*rt_link;\t/* Next in bucket */\n\tcaddr_t\t\t\trt_srcaddr;\t/* Address of \"master\" copy */\n\tstruct so_map\t\t*rt_smp;\t/* Originating map */\n};\n\n/*\n * Debugger interface structure.\n */\nstruct so_debug {\n\tint\tdd_version;\t\t/* Version # of interface */\n\tint\tdd_in_debugger;\t\t/* Set when run by debugger */\n\tint\tdd_sym_loaded;\t\t/* Run-time linking brought more\n\t\t\t\t\t   symbols into scope */\n\tchar   \t *dd_bpt_addr;\t\t/* Address of rtld-generated bpt */\n\tint\tdd_bpt_shadow;\t\t/* Original contents of bpt */\n\tstruct rt_symbol *dd_cc;\t/* Allocated commons/copied data */\n};\n\n/*\n * Version returned to crt0 from ld.so\n */\n#define LDSO_VERSION_NONE\t0\t/* FreeBSD2.0, 2.0.5 */\n#define LDSO_VERSION_HAS_DLEXIT\t1\t/* includes dlexit in ld_entry */\n#define LDSO_VERSION_HAS_DLSYM3\t2\t/* includes 3-argument dlsym */\n#define LDSO_VERSION_HAS_DLADDR\t3\t/* includes dladdr in ld_entry */\n\n/*\n * Entry points into ld.so - user interface to the run-time linker.\n * Entries are valid for the given version numbers returned by ld.so\n * to crt0.\n */\nstruct ld_entry {\n\tvoid\t*(*dlopen)(const char *, int);\t/* NONE */\n\tint\t(*dlclose)(void *);\t\t/* NONE */\n\tvoid\t*(*dlsym)(void *, const char *);\t/* NONE */\n\tconst char *(*dlerror)(void);\t\t/* NONE */\n\tvoid\t(*dlexit)(void);\t\t\t/* HAS_DLEXIT */\n\tvoid\t*(*dlsym3)(void *, const char *, void *); /* HAS_DLSYM3 */\n\tint\t (*dladdr)(const void *, struct dl_info *); /* HAS_DLADDR */\n};\n\n/*\n * This is the structure pointed at by the __DYNAMIC symbol if an\n * executable requires the attention of the run-time link editor.\n * __DYNAMIC is given the value zero if no run-time linking needs to\n * be done (it is always present in shared objects).\n * The union `d_un' provides for different versions of the dynamic\n * linking mechanism (switched on by `d_version'). The last version\n * used by Sun is 3. We leave some room here and go to version number\n * 8 for NetBSD, the main difference lying in the support for the\n * `nz_list' type of symbols.\n */\n\nstruct _dynamic {\n\tint\t\td_version;\t/* version # of this interface */\n\tstruct so_debug\t*d_debug;\n\tunion {\n\t\tstruct section_dispatch_table *d_sdt;\n\t} d_un;\n\tstruct ld_entry *d_entry;\t/* XXX */\n};\n\n#define LD_VERSION_SUN\t\t(3)\n#define LD_VERSION_BSD\t\t(8)\n#define LD_VERSION_NZLIST_P(v)\t((v) >= 8)\n\n#define LD_GOT(x)\t((x)->d_un.d_sdt->sdt_got)\n#define LD_PLT(x)\t((x)->d_un.d_sdt->sdt_plt)\n#define LD_REL(x)\t((x)->d_un.d_sdt->sdt_rel)\n#define LD_SYMBOL(x)\t((x)->d_un.d_sdt->sdt_nzlist)\n#define LD_HASH(x)\t((x)->d_un.d_sdt->sdt_hash)\n#define LD_STRINGS(x)\t((x)->d_un.d_sdt->sdt_strings)\n#define LD_NEED(x)\t((x)->d_un.d_sdt->sdt_sods)\n#define LD_BUCKETS(x)\t((x)->d_un.d_sdt->sdt_buckets)\n#define LD_PATHS(x)\t((x)->d_un.d_sdt->sdt_paths)\n\n#define LD_GOTSZ(x)\t((x)->d_un.d_sdt->sdt_plt - (x)->d_un.d_sdt->sdt_got)\n#define LD_RELSZ(x)\t((x)->d_un.d_sdt->sdt_hash - (x)->d_un.d_sdt->sdt_rel)\n#define LD_HASHSZ(x)\t((x)->d_un.d_sdt->sdt_nzlist - (x)->d_un.d_sdt->sdt_hash)\n#define LD_STABSZ(x)\t((x)->d_un.d_sdt->sdt_strings - (x)->d_un.d_sdt->sdt_nzlist)\n#define LD_PLTSZ(x)\t((x)->d_un.d_sdt->sdt_plt_sz)\n#define LD_STRSZ(x)\t((x)->d_un.d_sdt->sdt_str_sz)\n#define LD_TEXTSZ(x)\t((x)->d_un.d_sdt->sdt_text_sz)\n\n/*\n * Interface to ld.so\n */\nstruct crt_ldso {\n\tint\t\tcrt_ba;\t\t/* Base address of ld.so */\n\tint\t\tcrt_dzfd;\t/* \"/dev/zero\" file descriptor (SunOS) */\n\tint\t\tcrt_ldfd;\t/* ld.so file descriptor */\n\tstruct _dynamic\t*crt_dp;\t/* Main's __DYNAMIC */\n\tchar\t\t**crt_ep;\t/* environment strings */\n\tcaddr_t\t\tcrt_bp;\t\t/* Breakpoint if run from debugger */\n\tchar\t\t*crt_prog;\t/* Program name (v3) */\n\tchar\t\t*crt_ldso;\t/* Link editor name (v4) */\n\tstruct ld_entry\t*crt_ldentry;\t/* dl*() access (v4) */\n\tchar\t\t**crt_argv;\t/* argument strings (v5) */\n};\n\n/*\n * Version passed from crt0 to ld.so (1st argument to _rtld()).\n */\n#define CRT_VERSION_SUN\t\t1\n#define CRT_VERSION_BSD_2\t2\n#define CRT_VERSION_BSD_3\t3\n#define CRT_VERSION_BSD_4\t4\n#define CRT_VERSION_BSD_5\t5\n\n/*\n * Maximum number of recognized shared object version numbers.\n */\n#define MAXDEWEY\t8\n\n/*\n * Header of the hints file.\n */\nstruct hints_header {\n\tlong\t\thh_magic;\n#define HH_MAGIC\t011421044151\n\tlong\t\thh_version;\t/* Interface version number */\n#define LD_HINTS_VERSION_1\t1\n#define LD_HINTS_VERSION_2\t2\n\tlong\t\thh_hashtab;\t/* Location of hash table */\n\tlong\t\thh_nbucket;\t/* Number of buckets in hashtab */\n\tlong\t\thh_strtab;\t/* Location of strings */\n\tlong\t\thh_strtab_sz;\t/* Size of strings */\n\tlong\t\thh_ehints;\t/* End of hints (max offset in file) */\n\tlong\t\thh_dirlist;\t/* Colon-separated list of srch dirs */\n};\n\n#define HH_BADMAG(hdr)\t((hdr).hh_magic != HH_MAGIC)\n\n/*\n * Hash table element in hints file.\n */\nstruct hints_bucket {\n\t/* namex and pathx are indices into the string table */\n\tint\t\thi_namex;\t\t/* Library name */\n\tint\t\thi_pathx;\t\t/* Full path */\n\tint\t\thi_dewey[MAXDEWEY];\t/* The versions */\n\tint\t\thi_ndewey;\t\t/* Number of version numbers */\n#define hi_major hi_dewey[0]\n#define hi_minor hi_dewey[1]\n\tint\t\thi_next;\t\t/* Next in this bucket */\n};\n\n#define _PATH_LD_HINTS\t\t\"/var/run/ld.so.hints\"\n\n#endif /* _SYS_LINK_AOUT_H_ */\n"
  },
  {
    "path": "freebsd-headers/sys/link_elf.h",
    "content": "/*-\n * Copyright (c) 1993 Paul Kranenburg\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. All advertising materials mentioning features or use of this software\n *    must display the following acknowledgement:\n *      This product includes software developed by Paul Kranenburg.\n * 4. The name of the author may not be used to endorse or promote products\n *    derived from this software without specific prior written permission\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR\n * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES\n * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,\n * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF\n * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/sys/link_elf.h 217153 2011-01-08 17:11:49Z kib $\n */\n\n/*\n * RRS section definitions.\n *\n * The layout of some data structures defined in this header file is\n * such that we can provide compatibility with the SunOS 4.x shared\n * library scheme.\n */\n\n#ifndef _SYS_LINK_ELF_H_\n#define\t_SYS_LINK_ELF_H_\n\n#include <sys/elf.h>\n\n/*\n * Flags that describe the origin of the entries in Dl_serinfo.\n * SunOS has these in <sys/link.h>, we follow the suit.\n */\n#define\tLA_SER_ORIG\t0x01\t/* original (needed) name */\n#define\tLA_SER_LIBPATH\t0x02\t/* LD_LIBRARY_PATH entry prepended */\n#define\tLA_SER_RUNPATH\t0x04\t/* runpath entry prepended */\n#define\tLA_SER_CONFIG\t0x08\t/* configuration entry prepended */\n#define\tLA_SER_DEFAULT\t0x40\t/* default path prepended */\n#define\tLA_SER_SECURE\t0x80\t/* default (secure) path prepended */\n\ntypedef struct link_map {\n\tcaddr_t\t\tl_addr;\t\t\t/* Base Address of library */\n#ifdef __mips__\n\tcaddr_t\t\tl_offs;\t\t\t/* Load Offset of library */\n#endif\n\tconst char\t*l_name;\t\t/* Absolute Path to Library */\n\tconst void\t*l_ld;\t\t\t/* Pointer to .dynamic in memory */\n\tstruct link_map\t*l_next, *l_prev;\t/* linked list of of mapped libs */\n} Link_map;\n\nstruct r_debug {\n\tint\t\tr_version;\t\t/* not used */\n\tstruct link_map *r_map;\t\t\t/* list of loaded images */\n\tvoid\t\t(*r_brk)(struct r_debug *, struct link_map *);\n\t\t\t\t\t\t/* pointer to break point */\n\tenum {\n\t\tRT_CONSISTENT,\t\t\t/* things are stable */\n\t\tRT_ADD,\t\t\t\t/* adding a shared library */\n\t\tRT_DELETE\t\t\t/* removing a shared library */\n\t}\t\tr_state;\n};\n\nstruct dl_phdr_info\n{\n\tElf_Addr dlpi_addr;\t\t\t/* module relocation base */\n\tconst char *dlpi_name;\t\t\t/* module name */\n\tconst Elf_Phdr *dlpi_phdr;\t\t/* pointer to module's phdr */\n\tElf_Half dlpi_phnum;\t\t\t/* number of entries in phdr */\n\tunsigned long long int dlpi_adds;\t/* total # of loads */\n\tunsigned long long int dlpi_subs;\t/* total # of unloads */\n\tsize_t dlpi_tls_modid;\n\tvoid *dlpi_tls_data;\n};\n\n__BEGIN_DECLS\n\ntypedef int (*__dl_iterate_hdr_callback)(struct dl_phdr_info *, size_t, void *);\nextern int dl_iterate_phdr(__dl_iterate_hdr_callback, void *);\nint _rtld_addr_phdr(const void *, struct dl_phdr_info *);\nint _rtld_get_stack_prot(void);\n\n__END_DECLS\n\n#endif /* _SYS_LINK_ELF_H_ */\n"
  },
  {
    "path": "freebsd-headers/sys/linker.h",
    "content": "/*-\n * Copyright (c) 1997-2000 Doug Rabson\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/sys/linker.h 218494 2011-02-09 19:08:21Z marcel $\n */\n\n#ifndef _SYS_LINKER_H_\n#define _SYS_LINKER_H_\n\n#ifdef _KERNEL\n\n#include <machine/elf.h>\n#include <sys/kobj.h>\n\n#ifdef MALLOC_DECLARE\nMALLOC_DECLARE(M_LINKER);\n#endif\n\nstruct mod_depend;\n\n/*\n * Object representing a file which has been loaded by the linker.\n */\ntypedef struct linker_file* linker_file_t;\ntypedef TAILQ_HEAD(, linker_file) linker_file_list_t;\n\ntypedef caddr_t linker_sym_t;\t\t/* opaque symbol */\ntypedef c_caddr_t c_linker_sym_t;\t/* const opaque symbol */\ntypedef int (*linker_function_name_callback_t)(const char *, void *);\n\n/*\n * expanded out linker_sym_t\n */\ntypedef struct linker_symval {\n    const char*\t\tname;\n    caddr_t\t\tvalue;\n    size_t\t\tsize;\n} linker_symval_t;\n\ntypedef int (*linker_function_nameval_callback_t)(linker_file_t, int, linker_symval_t *, void *);\n\nstruct common_symbol {\n    STAILQ_ENTRY(common_symbol) link;\n    char*\t\tname;\n    caddr_t\t\taddress;\n};\n\nstruct linker_file {\n    KOBJ_FIELDS;\n    int\t\t\trefs;\t\t/* reference count */\n    int\t\t\tuserrefs;\t/* kldload(2) count */\n    int\t\t\tflags;\n#define LINKER_FILE_LINKED\t0x1\t/* file has been fully linked */\n    TAILQ_ENTRY(linker_file) link;\t/* list of all loaded files */\n    char*\t\tfilename;\t/* file which was loaded */\n    char*\t\tpathname;\t/* file name with full path */\n    int\t\t\tid;\t\t/* unique id */\n    caddr_t\t\taddress;\t/* load address */\n    size_t\t\tsize;\t\t/* size of file */\n    int\t\t\tndeps;\t\t/* number of dependencies */\n    linker_file_t*\tdeps;\t\t/* list of dependencies */\n    STAILQ_HEAD(, common_symbol) common; /* list of common symbols */\n    TAILQ_HEAD(, module) modules;\t/* modules in this file */\n    TAILQ_ENTRY(linker_file) loaded;\t/* preload dependency support */\n    int\t\t\tloadcnt;\t/* load counter value */\n\n    /*\n     * Function Boundary Tracing (FBT) or Statically Defined Tracing (SDT)\n     * fields.\n     */\n    int\t\t\tnenabled;\t/* number of enabled probes. */\n    int\t\t\tfbt_nentries;\t/* number of fbt entries created. */\n    void\t\t*sdt_probes;\n    int\t\t\tsdt_nentries;\n    size_t\t\tsdt_nprobes;\n    size_t\t\tsdt_size;\n};\n\n/*\n * Object implementing a class of file (a.out, elf, etc.)\n */\ntypedef struct linker_class *linker_class_t;\ntypedef TAILQ_HEAD(, linker_class) linker_class_list_t;\n\nstruct linker_class {\n    KOBJ_CLASS_FIELDS;\n    TAILQ_ENTRY(linker_class) link;\t/* list of all file classes */\n};\n\n/*\n * Function type used when iterating over the list of linker files.\n */\ntypedef int linker_predicate_t(linker_file_t, void *);\n\n/*\n * The \"file\" for the kernel.\n */\nextern linker_file_t\tlinker_kernel_file;\n\n/*\n * Obtain a reference to a module, loading it if required.\n */\nint linker_reference_module(const char* _modname, struct mod_depend *_verinfo,\n\t\t\t    linker_file_t* _result);\n\n/*\n * Release a reference to a module, unloading it if there are no more\n * references.  Note that one should either provide a module name and\n * optional version info or a linker file, but not both.\n */\nint linker_release_module(const char *_modname, struct mod_depend *_verinfo,\n\t\t\t  linker_file_t _file);\n\n/*\n * Iterate over all of the currently loaded linker files calling the\n * predicate function while the function returns 0.  Returns the value\n * returned by the last predicate function.\n */\nint linker_file_foreach(linker_predicate_t *_predicate, void *_context);\n\n/*\n * Lookup a symbol in a file.  If deps is TRUE, look in dependencies\n * if not found in file.\n */\ncaddr_t linker_file_lookup_symbol(linker_file_t _file, const char* _name, \n\t\t\t\t  int _deps);\n\n/*\n * Lookup a linker set in a file.  Return pointers to the first entry,\n * last + 1, and count of entries.  Use: for (p = start; p < stop; p++) {}\n * void *start is really: \"struct yoursetmember ***start;\"\n */\nint linker_file_lookup_set(linker_file_t _file, const char *_name,\n\t\t\t   void *_start, void *_stop, int *_count);\n\n/*\n * List all functions in a file.\n */\nint linker_file_function_listall(linker_file_t, \n\t\t\t\t linker_function_nameval_callback_t, void *);\n\n/*\n * Functions soley for use by the linker class handlers.\n */\nint linker_add_class(linker_class_t _cls);\nint linker_file_unload(linker_file_t _file, int flags);\nint linker_load_dependencies(linker_file_t _lf);\nlinker_file_t linker_make_file(const char* _filename, linker_class_t _cls);\n\n/*\n * DDB Helpers, tuned specifically for ddb/db_kld.c\n */\nint linker_ddb_lookup(const char *_symstr, c_linker_sym_t *_sym);\nint linker_ddb_search_symbol(caddr_t _value, c_linker_sym_t *_sym,\n\t\t\t     long *_diffp);\nint linker_ddb_symbol_values(c_linker_sym_t _sym, linker_symval_t *_symval);\nint linker_ddb_search_symbol_name(caddr_t value, char *buf, u_int buflen,\n\t\t\t\t  long *offset);\n\n/*\n * stack(9) helper for situations where kernel locking is required.\n */\nint linker_search_symbol_name(caddr_t value, char *buf, u_int buflen,\n    long *offset);\n\n\n/* HWPMC helper */\nvoid *linker_hwpmc_list_objects(void);\n\n#endif\t/* _KERNEL */\n\n/*\n * Module information subtypes\n */\n#define MODINFO_END\t\t0x0000\t\t/* End of list */\n#define MODINFO_NAME\t\t0x0001\t\t/* Name of module (string) */\n#define MODINFO_TYPE\t\t0x0002\t\t/* Type of module (string) */\n#define MODINFO_ADDR\t\t0x0003\t\t/* Loaded address */\n#define MODINFO_SIZE\t\t0x0004\t\t/* Size of module */\n#define MODINFO_EMPTY\t\t0x0005\t\t/* Has been deleted */\n#define MODINFO_ARGS\t\t0x0006\t\t/* Parameters string */\n#define MODINFO_METADATA\t0x8000\t\t/* Module-specfic */\n\n#define MODINFOMD_AOUTEXEC\t0x0001\t\t/* a.out exec header */\n#define MODINFOMD_ELFHDR\t0x0002\t\t/* ELF header */\n#define MODINFOMD_SSYM\t\t0x0003\t\t/* start of symbols */\n#define MODINFOMD_ESYM\t\t0x0004\t\t/* end of symbols */\n#define MODINFOMD_DYNAMIC\t0x0005\t\t/* _DYNAMIC pointer */\n/* These values are MD on these two platforms */\n#if !defined(__sparc64__) && !defined(__powerpc__)\n#define MODINFOMD_ENVP\t\t0x0006\t\t/* envp[] */\n#define MODINFOMD_HOWTO\t\t0x0007\t\t/* boothowto */\n#define MODINFOMD_KERNEND\t0x0008\t\t/* kernend */\n#endif\n#define MODINFOMD_SHDR\t\t0x0009\t\t/* section header table */\n#define MODINFOMD_NOCOPY\t0x8000\t\t/* don't copy this metadata to the kernel */\n\n#define MODINFOMD_DEPLIST\t(0x4001 | MODINFOMD_NOCOPY)\t/* depends on */\n\n#ifdef _KERNEL\n#define MD_FETCH(mdp, info, type) ({ \\\n\ttype *__p; \\\n\t__p = (type *)preload_search_info((mdp), MODINFO_METADATA | (info)); \\\n\t__p ? *__p : 0; \\\n})\n#endif\n\n#define\tLINKER_HINTS_VERSION\t1\t\t/* linker.hints file version */\n\n#ifdef _KERNEL\n\n/*\n * Module lookup\n */\nextern vm_offset_t\tpreload_addr_relocate;\nextern caddr_t\t\tpreload_metadata;\n\nextern void *\t\tpreload_fetch_addr(caddr_t _mod);\nextern size_t\t\tpreload_fetch_size(caddr_t _mod);\nextern caddr_t\t\tpreload_search_by_name(const char *_name);\nextern caddr_t\t\tpreload_search_by_type(const char *_type);\nextern caddr_t\t\tpreload_search_next_name(caddr_t _base);\nextern caddr_t\t\tpreload_search_info(caddr_t _mod, int _inf);\nextern void\t\tpreload_delete_name(const char *_name);\nextern void\t\tpreload_bootstrap_relocate(vm_offset_t _offset);\n\n#ifdef KLD_DEBUG\n\nextern int kld_debug;\n#define KLD_DEBUG_FILE\t1\t/* file load/unload */\n#define KLD_DEBUG_SYM\t2\t/* symbol lookup */\n\n#define KLD_DPF(cat, args)\t\t\t\t\t\\\n\tdo {\t\t\t\t\t\t\t\\\n\t\tif (kld_debug & KLD_DEBUG_##cat) printf args;\t\\\n\t} while (0)\n\n#else\n\n#define KLD_DPF(cat, args)\n\n#endif\n\ntypedef Elf_Addr elf_lookup_fn(linker_file_t, Elf_Size, int);\n\n/* Support functions */\nint\telf_reloc(linker_file_t _lf, Elf_Addr base, const void *_rel, int _type, elf_lookup_fn _lu);\nint\telf_reloc_local(linker_file_t _lf, Elf_Addr base, const void *_rel, int _type, elf_lookup_fn _lu);\nElf_Addr elf_relocaddr(linker_file_t _lf, Elf_Addr addr);\nconst Elf_Sym *elf_get_sym(linker_file_t _lf, Elf_Size _symidx);\nconst char *elf_get_symname(linker_file_t _lf, Elf_Size _symidx);\n\ntypedef struct linker_ctf {\n\tconst uint8_t \t*ctftab;\t/* Decompressed CTF data. */\n\tint \t\tctfcnt;\t\t/* Number of CTF data bytes. */\n\tconst Elf_Sym\t*symtab;\t/* Ptr to the symbol table. */\n\tint\t\tnsym;\t\t/* Number of symbols. */\n\tconst char\t*strtab;\t/* Ptr to the string table. */\n\tint \t\tstrcnt;\t\t/* Number of string bytes. */\n\tuint32_t\t**ctfoffp;\t/* Ptr to array of obj/fnc offsets. */\n\tuint32_t\t**typoffp;\t/* Ptr to array of type offsets. */\n\tlong\t\t*typlenp;\t/* Ptr to number of type data entries. */\n} linker_ctf_t;\n\nint\tlinker_ctf_get(linker_file_t, linker_ctf_t *);\n\nint elf_cpu_load_file(linker_file_t);\nint elf_cpu_unload_file(linker_file_t);\n\n/* values for type */\n#define ELF_RELOC_REL\t1\n#define ELF_RELOC_RELA\t2\n\n/*\n * This is version 1 of the KLD file status structure. It is identified\n * by its _size_ in the version field.\n */\nstruct kld_file_stat_1 {\n    int\t\tversion;\t/* set to sizeof(struct kld_file_stat_1) */\n    char        name[MAXPATHLEN];\n    int\t\trefs;\n    int\t\tid;\n    caddr_t\taddress;\t/* load address */\n    size_t\tsize;\t\t/* size in bytes */\n};\n#endif /* _KERNEL */\n\nstruct kld_file_stat {\n    int\t\tversion;\t/* set to sizeof(struct kld_file_stat) */\n    char        name[MAXPATHLEN];\n    int\t\trefs;\n    int\t\tid;\n    caddr_t\taddress;\t/* load address */\n    size_t\tsize;\t\t/* size in bytes */\n    char        pathname[MAXPATHLEN];\n};\n\nstruct kld_sym_lookup {\n    int\t\tversion;\t/* set to sizeof(struct kld_sym_lookup) */\n    char\t*symname;\t/* Symbol name we are looking up */\n    u_long\tsymvalue;\n    size_t\tsymsize;\n};\n#define KLDSYM_LOOKUP\t1\n\n/*\n * Flags for kldunloadf() and linker_file_unload()\n */\n#define LINKER_UNLOAD_NORMAL\t0\n#define LINKER_UNLOAD_FORCE\t1\n\n#ifndef _KERNEL\n\n#include <sys/cdefs.h>\n\n__BEGIN_DECLS\nint\tkldload(const char* _file);\nint\tkldunload(int _fileid);\nint\tkldunloadf(int _fileid, int flags);\nint\tkldfind(const char* _file);\nint\tkldnext(int _fileid);\nint\tkldstat(int _fileid, struct kld_file_stat* _stat);\nint\tkldfirstmod(int _fileid);\nint\tkldsym(int _fileid, int _cmd, void *_data);\n__END_DECLS\n\n#endif\n\n#endif /* !_SYS_LINKER_H_ */\n"
  },
  {
    "path": "freebsd-headers/sys/linker_set.h",
    "content": "/*-\n * Copyright (c) 1999 John D. Polstra\n * Copyright (c) 1999,2001 Peter Wemm <peter@FreeBSD.org>\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/sys/linker_set.h 215701 2010-11-22 19:32:54Z dim $\n */\n\n#ifndef _SYS_LINKER_SET_H_\n#define _SYS_LINKER_SET_H_\n\n#ifndef _SYS_CDEFS_H_\n#error this file needs sys/cdefs.h as a prerequisite\n#endif\n\n/*\n * The following macros are used to declare global sets of objects, which\n * are collected by the linker into a `linker_set' as defined below.\n * For ELF, this is done by constructing a separate segment for each set.\n */\n\n/*\n * Private macros, not to be used outside this header file.\n */\n#ifdef __GNUCLIKE___SECTION\n#define __MAKE_SET(set, sym)\t\t\t\t\t\t\\\n\t__GLOBL(__CONCAT(__start_set_,set));\t\t\t\t\\\n\t__GLOBL(__CONCAT(__stop_set_,set));\t\t\t\t\\\n\tstatic void const * const __set_##set##_sym_##sym \t\t\\\n\t__section(\"set_\" #set) __used = &sym\n#else /* !__GNUCLIKE___SECTION */\n#ifndef lint\n#error this file needs to be ported to your compiler\n#endif /* lint */\n#define __MAKE_SET(set, sym)\textern void const * const (__set_##set##_sym_##sym)\n#endif /* __GNUCLIKE___SECTION */\n\n/*\n * Public macros.\n */\n#define TEXT_SET(set, sym)\t__MAKE_SET(set, sym)\n#define DATA_SET(set, sym)\t__MAKE_SET(set, sym)\n#define BSS_SET(set, sym)\t__MAKE_SET(set, sym)\n#define ABS_SET(set, sym)\t__MAKE_SET(set, sym)\n#define SET_ENTRY(set, sym)\t__MAKE_SET(set, sym)\n\n/*\n * Initialize before referring to a given linker set.\n */\n#define SET_DECLARE(set, ptype)\t\t\t\t\t\t\\\n\textern ptype *__CONCAT(__start_set_,set);\t\t\t\\\n\textern ptype *__CONCAT(__stop_set_,set)\n\n#define SET_BEGIN(set)\t\t\t\t\t\t\t\\\n\t(&__CONCAT(__start_set_,set))\n#define SET_LIMIT(set)\t\t\t\t\t\t\t\\\n\t(&__CONCAT(__stop_set_,set))\n\n/*\n * Iterate over all the elements of a set.\n *\n * Sets always contain addresses of things, and \"pvar\" points to words\n * containing those addresses.  Thus is must be declared as \"type **pvar\",\n * and the address of each set item is obtained inside the loop by \"*pvar\".\n */\n#define SET_FOREACH(pvar, set)\t\t\t\t\t\t\\\n\tfor (pvar = SET_BEGIN(set); pvar < SET_LIMIT(set); pvar++)\n\n#define SET_ITEM(set, i)\t\t\t\t\t\t\\\n\t((SET_BEGIN(set))[i])\n\n/*\n * Provide a count of the items in a set.\n */\n#define SET_COUNT(set)\t\t\t\t\t\t\t\\\n\t(SET_LIMIT(set) - SET_BEGIN(set))\n\n#endif\t/* _SYS_LINKER_SET_H_ */\n"
  },
  {
    "path": "freebsd-headers/sys/lock.h",
    "content": "/*-\n * Copyright (c) 1997 Berkeley Software Design, Inc. All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. Berkeley Software Design Inc's name may not be used to endorse or\n *    promote products derived from this software without specific prior\n *    written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY BERKELEY SOFTWARE DESIGN INC ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL BERKELEY SOFTWARE DESIGN INC BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\tfrom BSDI Id: mutex.h,v 2.7.2.35 2000/04/27 03:10:26 cp\n * $FreeBSD: release/9.0.0/sys/sys/lock.h 212408 2010-09-10 06:26:28Z obrien $\n */\n\n#ifndef _SYS_LOCK_H_\n#define _SYS_LOCK_H_\n\n#include <sys/queue.h>\n#include <sys/_lock.h>\n\nstruct lock_list_entry;\nstruct thread;\n\n/*\n * Lock classes.  Each lock has a class which describes characteristics\n * common to all types of locks of a given class.\n *\n * Spin locks in general must always protect against preemption, as it is\n * an error to perform any type of context switch while holding a spin lock.\n * Also, for an individual lock to be recursable, its class must allow\n * recursion and the lock itself must explicitly allow recursion.\n *\n * The 'lc_ddb_show' function pointer is used to dump class-specific\n * data for the 'show lock' DDB command.  The 'lc_lock' and\n * 'lc_unlock' function pointers are used in sleep(9) and cv_wait(9)\n * to lock and unlock locks while blocking on a sleep queue.  The\n * return value of 'lc_unlock' will be passed to 'lc_lock' on resume\n * to allow communication of state between the two routines.\n */\n\nstruct lock_class {\n\tconst\tchar *lc_name;\n\tu_int\tlc_flags;\n\tvoid\t(*lc_assert)(struct lock_object *lock, int what);\n\tvoid\t(*lc_ddb_show)(struct lock_object *lock);\n\tvoid\t(*lc_lock)(struct lock_object *lock, int how);\n\tint\t(*lc_owner)(struct lock_object *lock, struct thread **owner);\n\tint\t(*lc_unlock)(struct lock_object *lock);\n};\n\n#define\tLC_SLEEPLOCK\t0x00000001\t/* Sleep lock. */\n#define\tLC_SPINLOCK\t0x00000002\t/* Spin lock. */\n#define\tLC_SLEEPABLE\t0x00000004\t/* Sleeping allowed with this lock. */\n#define\tLC_RECURSABLE\t0x00000008\t/* Locks of this type may recurse. */\n#define\tLC_UPGRADABLE\t0x00000010\t/* Upgrades and downgrades permitted. */\n\n#define\tLO_CLASSFLAGS\t0x0000ffff\t/* Class specific flags. */\n#define\tLO_INITIALIZED\t0x00010000\t/* Lock has been initialized. */\n#define\tLO_WITNESS\t0x00020000\t/* Should witness monitor this lock. */\n#define\tLO_QUIET\t0x00040000\t/* Don't log locking operations. */\n#define\tLO_RECURSABLE\t0x00080000\t/* Lock may recurse. */\n#define\tLO_SLEEPABLE\t0x00100000\t/* Lock may be held while sleeping. */\n#define\tLO_UPGRADABLE\t0x00200000\t/* Lock may be upgraded/downgraded. */\n#define\tLO_DUPOK\t0x00400000\t/* Don't check for duplicate acquires */\n#define\tLO_CLASSMASK\t0x0f000000\t/* Class index bitmask. */\n#define LO_NOPROFILE    0x10000000      /* Don't profile this lock */\n\n/*\n * Lock classes are statically assigned an index into the gobal lock_classes\n * array.  Debugging code looks up the lock class for a given lock object\n * by indexing the array.\n */\n#define\tLO_CLASSSHIFT\t\t24\n#define\tLO_CLASSINDEX(lock)\t((((lock)->lo_flags) & LO_CLASSMASK) >> LO_CLASSSHIFT)\n#define\tLOCK_CLASS(lock)\t(lock_classes[LO_CLASSINDEX((lock))])\n#define\tLOCK_CLASS_MAX\t\t(LO_CLASSMASK >> LO_CLASSSHIFT)\n\n/*\n * Option flags passed to lock operations that witness also needs to know\n * about or that are generic across all locks.\n */\n#define\tLOP_NEWORDER\t0x00000001\t/* Define a new lock order. */\n#define\tLOP_QUIET\t0x00000002\t/* Don't log locking operations. */\n#define\tLOP_TRYLOCK\t0x00000004\t/* Don't check lock order. */\n#define\tLOP_EXCLUSIVE\t0x00000008\t/* Exclusive lock. */\n#define\tLOP_DUPOK\t0x00000010\t/* Don't check for duplicate acquires */\n\n/* Flags passed to witness_assert. */\n#define\tLA_MASKASSERT\t0x000000ff\t/* Mask for witness defined asserts. */\n#define\tLA_UNLOCKED\t0x00000000\t/* Lock is unlocked. */\n#define\tLA_LOCKED\t0x00000001\t/* Lock is at least share locked. */\n#define\tLA_SLOCKED\t0x00000002\t/* Lock is exactly share locked. */\n#define\tLA_XLOCKED\t0x00000004\t/* Lock is exclusively locked. */\n#define\tLA_RECURSED\t0x00000008\t/* Lock is recursed. */\n#define\tLA_NOTRECURSED\t0x00000010\t/* Lock is not recursed. */\n\n#ifdef _KERNEL\n/*\n * If any of WITNESS, INVARIANTS, or KTR_LOCK KTR tracing has been enabled,\n * then turn on LOCK_DEBUG.  When this option is on, extra debugging\n * facilities such as tracking the file and line number of lock operations\n * are enabled.  Also, mutex locking operations are not inlined to avoid\n * bloat from all the extra debugging code.  We also have to turn on all the\n * calling conventions for this debugging code in modules so that modules can\n * work with both debug and non-debug kernels.\n */\n#if defined(KLD_MODULE) || defined(WITNESS) || defined(INVARIANTS) || defined(INVARIANT_SUPPORT) || defined(KTR) || defined(LOCK_PROFILING)\n#define\tLOCK_DEBUG\t1\n#else\n#define\tLOCK_DEBUG\t0\n#endif\n\n/*\n * In the LOCK_DEBUG case, use the filename and line numbers for debugging\n * operations.  Otherwise, use default values to avoid the unneeded bloat.\n */\n#if LOCK_DEBUG > 0\n#define\tLOCK_FILE\t__FILE__\n#define\tLOCK_LINE\t__LINE__\n#else\n#define\tLOCK_FILE\tNULL\n#define\tLOCK_LINE\t0\n#endif\n\n/*\n * Macros for KTR_LOCK tracing.\n *\n * opname  - name of this operation (LOCK/UNLOCK/SLOCK, etc.)\n * lo      - struct lock_object * for this lock\n * flags   - flags passed to the lock operation\n * recurse - this locks recursion level (or 0 if class is not recursable)\n * result  - result of a try lock operation\n * file    - file name\n * line    - line number\n */\n#define\tLOCK_LOG_TEST(lo, flags)\t\t\t\t\t\\\n\t(((flags) & LOP_QUIET) == 0 && ((lo)->lo_flags & LO_QUIET) == 0)\n\n#define\tLOCK_LOG_LOCK(opname, lo, flags, recurse, file, line) do {\t\\\n\tif (LOCK_LOG_TEST((lo), (flags)))\t\t\t\t\\\n\t\tCTR6(KTR_LOCK, opname \" (%s) %s %p r = %d at %s:%d\",\t\\\n\t\t    LOCK_CLASS(lo)->lc_name, (lo)->lo_name,\t\t\\\n\t\t    (lo), (u_int)(recurse), (file), (line));\t\t\\\n} while (0)\n\n#define\tLOCK_LOG_TRY(opname, lo, flags, result, file, line) do {\t\\\n\tif (LOCK_LOG_TEST((lo), (flags)))\t\t\t\t\\\n\t\tCTR6(KTR_LOCK, \"TRY_\" opname \" (%s) %s %p result=%d at %s:%d\",\\\n\t\t    LOCK_CLASS(lo)->lc_name, (lo)->lo_name,\t\t\\\n\t\t    (lo), (u_int)(result), (file), (line));\t\t\\\n} while (0)\n\n#define\tLOCK_LOG_INIT(lo, flags) do {\t\t\t\t\t\\\n\tif (LOCK_LOG_TEST((lo), (flags)))\t\t\t\t\\\n\t\tCTR4(KTR_LOCK, \"%s: %p (%s) %s\", __func__, (lo),\t\\\n \t\t    LOCK_CLASS(lo)->lc_name, (lo)->lo_name);\t\t\\\n} while (0)\n\n#define\tLOCK_LOG_DESTROY(lo, flags)\tLOCK_LOG_INIT(lo, flags)\n\n#define\tlock_initalized(lo)\t((lo)->lo_flags & LO_INITIALIZED)\n\n/*\n * Helpful macros for quickly coming up with assertions with informative\n * panic messages.\n */\n#define MPASS(ex)\t\tMPASS4(ex, #ex, __FILE__, __LINE__)\n#define MPASS2(ex, what)\tMPASS4(ex, what, __FILE__, __LINE__)\n#define MPASS3(ex, file, line)\tMPASS4(ex, #ex, file, line)\n#define MPASS4(ex, what, file, line)\t\t\t\t\t\\\n\tKASSERT((ex), (\"Assertion %s failed at %s:%d\", what, file, line))\n\nextern struct lock_class lock_class_mtx_sleep;\nextern struct lock_class lock_class_mtx_spin;\nextern struct lock_class lock_class_sx;\nextern struct lock_class lock_class_rw;\nextern struct lock_class lock_class_rm;\nextern struct lock_class lock_class_lockmgr;\n\nextern struct lock_class *lock_classes[];\n\nvoid\tlock_init(struct lock_object *, struct lock_class *,\n\t    const char *, const char *, int);\nvoid\tlock_destroy(struct lock_object *);\nvoid\tspinlock_enter(void);\nvoid\tspinlock_exit(void);\nvoid\twitness_init(struct lock_object *, const char *);\nvoid\twitness_destroy(struct lock_object *);\nint\twitness_defineorder(struct lock_object *, struct lock_object *);\nvoid\twitness_checkorder(struct lock_object *, int, const char *, int,\n\t    struct lock_object *);\nvoid\twitness_lock(struct lock_object *, int, const char *, int);\nvoid\twitness_upgrade(struct lock_object *, int, const char *, int);\nvoid\twitness_downgrade(struct lock_object *, int, const char *, int);\nvoid\twitness_unlock(struct lock_object *, int, const char *, int);\nvoid\twitness_save(struct lock_object *, const char **, int *);\nvoid\twitness_restore(struct lock_object *, const char *, int);\nint\twitness_list_locks(struct lock_list_entry **,\n\t    int (*)(const char *, ...));\nint\twitness_warn(int, struct lock_object *, const char *, ...);\nvoid\twitness_assert(struct lock_object *, int, const char *, int);\nvoid\twitness_display_spinlock(struct lock_object *, struct thread *,\n\t    int (*)(const char *, ...));\nint\twitness_line(struct lock_object *);\nvoid\twitness_norelease(struct lock_object *);\nvoid\twitness_releaseok(struct lock_object *);\nconst char *witness_file(struct lock_object *);\nvoid\twitness_thread_exit(struct thread *);\n\n#ifdef\tWITNESS\n\n/* Flags for witness_warn(). */\n#define\tWARN_GIANTOK\t0x01\t/* Giant is exempt from this check. */\n#define\tWARN_PANIC\t0x02\t/* Panic if check fails. */\n#define\tWARN_SLEEPOK\t0x04\t/* Sleepable locks are exempt from check. */\n\n#define\tWITNESS_INIT(lock, type)\t\t\t\t\t\\\n\twitness_init((lock), (type))\n\n#define WITNESS_DESTROY(lock)\t\t\t\t\t\t\\\n\twitness_destroy(lock)\n\n#define\tWITNESS_CHECKORDER(lock, flags, file, line, interlock)\t\t\\\n\twitness_checkorder((lock), (flags), (file), (line), (interlock))\n\n#define\tWITNESS_DEFINEORDER(lock1, lock2)\t\t\t\t\\\n\twitness_defineorder((struct lock_object *)(lock1),\t\t\\\n\t    (struct lock_object *)(lock2))\n\n#define\tWITNESS_LOCK(lock, flags, file, line)\t\t\t\t\\\n\twitness_lock((lock), (flags), (file), (line))\n\n#define\tWITNESS_UPGRADE(lock, flags, file, line)\t\t\t\\\n\twitness_upgrade((lock), (flags), (file), (line))\n\n#define\tWITNESS_DOWNGRADE(lock, flags, file, line)\t\t\t\\\n\twitness_downgrade((lock), (flags), (file), (line))\n\n#define\tWITNESS_UNLOCK(lock, flags, file, line)\t\t\t\t\\\n\twitness_unlock((lock), (flags), (file), (line))\n\n#define\tWITNESS_CHECK(flags, lock, fmt, ...)\t\t\t\t\\\n\twitness_warn((flags), (lock), (fmt), ## __VA_ARGS__)\n\n#define\tWITNESS_WARN(flags, lock, fmt, ...)\t\t\t\t\\\n\twitness_warn((flags), (lock), (fmt), ## __VA_ARGS__)\n\n#define\tWITNESS_SAVE_DECL(n)\t\t\t\t\t\t\\\n\tconst char * __CONCAT(n, __wf);\t\t\t\t\t\\\n\tint __CONCAT(n, __wl)\n\n#define\tWITNESS_SAVE(lock, n) \t\t\t\t\t\t\\\n\twitness_save((lock), &__CONCAT(n, __wf), &__CONCAT(n, __wl))\n\n#define\tWITNESS_RESTORE(lock, n) \t\t\t\t\t\\\n\twitness_restore((lock), __CONCAT(n, __wf), __CONCAT(n, __wl))\n\n#define\tWITNESS_NORELEASE(lock)\t\t\t\t\t\t\\\n\twitness_norelease(&(lock)->lock_object)\n\n#define\tWITNESS_RELEASEOK(lock)\t\t\t\t\t\t\\\n\twitness_releaseok(&(lock)->lock_object)\n\n#define\tWITNESS_FILE(lock) \t\t\t\t\t\t\\\n\twitness_file(lock)\n\n#define\tWITNESS_LINE(lock) \t\t\t\t\t\t\\\n\twitness_line(lock)\n\n#else\t/* WITNESS */\n#define\tWITNESS_INIT(lock, type)\t\t\t\t(void)0\n#define\tWITNESS_DESTROY(lock)\t\t\t\t\t(void)0\n#define\tWITNESS_DEFINEORDER(lock1, lock2)\t0\n#define\tWITNESS_CHECKORDER(lock, flags, file, line, interlock)\t(void)0\n#define\tWITNESS_LOCK(lock, flags, file, line)\t\t\t(void)0\n#define\tWITNESS_UPGRADE(lock, flags, file, line)\t\t(void)0\n#define\tWITNESS_DOWNGRADE(lock, flags, file, line)\t\t(void)0\n#define\tWITNESS_UNLOCK(lock, flags, file, line)\t\t\t(void)0\n#define\tWITNESS_CHECK(flags, lock, fmt, ...)\t0\n#define\tWITNESS_WARN(flags, lock, fmt, ...)\t\t\t(void)0\n#define\tWITNESS_SAVE_DECL(n)\t\t\t\t\t(void)0\n#define\tWITNESS_SAVE(lock, n)\t\t\t\t\t(void)0\n#define\tWITNESS_RESTORE(lock, n)\t\t\t\t(void)0\n#define\tWITNESS_NORELEASE(lock)\t\t\t\t\t(void)0\n#define\tWITNESS_RELEASEOK(lock)\t\t\t\t\t(void)0\n#define\tWITNESS_FILE(lock) (\"?\")\n#define\tWITNESS_LINE(lock) (0)\n#endif\t/* WITNESS */\n\n/*\n * Helper macros to allow developers to add explicit lock order checks\n * wherever they please without having to actually grab a lock to do so.\n */\n#define\twitness_check(l)\t\t\t\t\t\t\\\n\tWITNESS_CHECKORDER(&(l)->lock_object, LOP_EXCLUSIVE, LOCK_FILE,\t\\\n\t    LOCK_LINE, NULL)\n\n#define\twitness_check_shared(l)\t\t\t\t\t\t\\\n\tWITNESS_CHECKORDER(&(l)->lock_object, 0, LOCK_FILE, LOCK_LINE, NULL)\n\t\n#endif\t/* _KERNEL */\n#endif\t/* _SYS_LOCK_H_ */\n"
  },
  {
    "path": "freebsd-headers/sys/lock_profile.h",
    "content": "/*-\n * Copyright (c) 2006 Kip Macy kmacy@FreeBSD.org\n * Copyright (c) 2006 Kris Kennaway kris@FreeBSD.org\n * Copyright (c) 2006 Dag-Erling Smorgrav des@des.no\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR \n * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHAL THE AUTHORS BE LIABLE FOR ANY\n * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/sys/lock_profile.h 194578 2009-06-21 09:01:12Z rdivacky $\n */\n\n\n#ifndef _SYS_LOCK_PROFILE_H_\n#define _SYS_LOCK_PROFILE_H_\n\nstruct lock_profile_object;\nLIST_HEAD(lpohead, lock_profile_object);\n\n#ifdef _KERNEL\n#ifdef LOCK_PROFILING\n#include <machine/cpufunc.h>\n#include <sys/lock.h>\n\n#ifndef USE_CPU_NANOSECONDS\nu_int64_t nanoseconds(void);\n#endif\n\nextern volatile int lock_prof_enable;\n\nvoid lock_profile_obtain_lock_success(struct lock_object *lo, int contested,\n    uint64_t waittime, const char *file, int line);\nvoid lock_profile_release_lock(struct lock_object *lo);\nvoid lock_profile_thread_exit(struct thread *td);\n\n\nstatic inline void\nlock_profile_obtain_lock_failed(struct lock_object *lo, int *contested,\n    uint64_t *waittime)\n{\n\tif (!lock_prof_enable || (lo->lo_flags & LO_NOPROFILE) || *contested)\n\t\treturn;\n\t*waittime = nanoseconds();\n\t*contested = 1;\n}\n\n#else /* !LOCK_PROFILING */\n\n#define\tlock_profile_release_lock(lo)\t\t\t\t\t(void)0\n#define lock_profile_obtain_lock_failed(lo, contested, waittime)\t(void)0\n#define lock_profile_obtain_lock_success(lo, contested, waittime, file, line)\t(void)0\n#define\tlock_profile_thread_exit(td)\t\t\t\t\t(void)0\n\n#endif  /* !LOCK_PROFILING */\n\n#endif /* _KERNEL */\n\n#endif /* _SYS_LOCK_PROFILE_H_ */\n"
  },
  {
    "path": "freebsd-headers/sys/lockf.h",
    "content": "/*-\n * Copyright (c) 1991, 1993\n *\tThe Regents of the University of California.  All rights reserved.\n *\n * This code is derived from software contributed to Berkeley by\n * Scooter Morris at Genentech Inc.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 4. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t@(#)lockf.h\t8.1 (Berkeley) 6/11/93\n * $FreeBSD: release/9.0.0/sys/sys/lockf.h 192685 2009-05-24 12:39:38Z kib $\n */\n\n#ifndef _SYS_LOCKF_H_\n#define\t_SYS_LOCKF_H_\n\n#include <sys/queue.h>\n#include <sys/_lock.h>\n#include <sys/_sx.h>\n\nstruct flock;\nstruct vop_advlock_args;\nstruct vop_advlockasync_args;\n\n/*\n * The lockf_entry structure is a kernel structure which contains the\n * information associated with a byte range lock.  The lockf_entry\n * structures are linked into the inode structure. Locks are sorted by\n * the starting byte of the lock for efficiency.\n *\n * Active and pending locks on a vnode are organised into a\n * graph. Each pending lock has an out-going edge to each active lock\n * that blocks it.\n *\n * Locks:\n * (i)\t\tlocked by the vnode interlock\n * (s)\t\tlocked by state->ls_lock\n * (S)\t\tlocked by lf_lock_states_lock\n * (c)\t\tconst until freeing\n */\nstruct lockf_edge {\n\tLIST_ENTRY(lockf_edge) le_outlink; /* (s) link from's out-edge list */\n\tLIST_ENTRY(lockf_edge) le_inlink; /* (s) link to's in-edge list */\n\tstruct lockf_entry *le_from;\t/* (c) out-going from here */\n\tstruct lockf_entry *le_to;\t/* (s) in-coming to here */\n};\nLIST_HEAD(lockf_edge_list, lockf_edge);\n\nstruct lockf_entry {\n\tshort\tlf_flags;\t    /* (c) Semantics: F_POSIX, F_FLOCK, F_WAIT */\n\tshort\tlf_type;\t    /* (s) Lock type: F_RDLCK, F_WRLCK */\n\toff_t\tlf_start;\t    /* (s) Byte # of the start of the lock */\n\toff_t\tlf_end;\t\t    /* (s) Byte # of the end of the lock (OFF_MAX=EOF) */\n\tstruct\tlock_owner *lf_owner; /* (c) Owner of the lock */\n\tstruct\tvnode *lf_vnode;    /* (c) File being locked (only valid for active lock) */\n\tstruct\tinode *lf_inode;    /* (c) Back pointer to the inode */\n\tstruct\ttask *lf_async_task;/* (c) Async lock callback */\n\tLIST_ENTRY(lockf_entry) lf_link;  /* (s) Linkage for lock lists */\n\tstruct lockf_edge_list lf_outedges; /* (s) list of out-edges */\n\tstruct lockf_edge_list lf_inedges; /* (s) list of out-edges */\n\tint\tlf_refs;\t    /* (s) ref count */\n};\nLIST_HEAD(lockf_entry_list, lockf_entry);\n\n/*\n * Extra lf_flags bits used by the implementation\n */\n#define\tF_INTR\t\t0x8000\t/* lock was interrupted by lf_purgelocks */\n\n/*\n * Filesystem private node structures should include space for a\n * pointer to a struct lockf_state. This pointer is used by the lock\n * manager to track the locking state for a file.\n *\n * The ls_active list contains the set of active locks on the file. It\n * is strictly ordered by the lock's lf_start value. Each active lock\n * will have in-coming edges to any pending lock which it blocks.\n *\n * Lock requests which are blocked by some other active lock are\n * listed in ls_pending with newer requests first in the list. Lock\n * requests in this list will have out-going edges to each active lock\n * that blocks then. They will also have out-going edges to each\n * pending lock that is older in the queue - this helps to ensure\n * fairness when several processes are contenting to lock the same\n * record.\n\n * The value of ls_threads is the number of threads currently using\n * the state structure (typically either setting/clearing locks or\n * sleeping waiting to do so). This is used to defer freeing the\n * structure while some thread is still using it.\n */\nstruct lockf {\n\tLIST_ENTRY(lockf) ls_link;\t/* (S) all active lockf states */\n\tstruct\tsx\tls_lock;\n\tstruct\tlockf_entry_list ls_active; /* (s) Active locks */\n\tstruct\tlockf_entry_list ls_pending; /* (s) Pending locks */\n\tint\t\tls_threads;\t/* (i) Thread count */\n};\nLIST_HEAD(lockf_list, lockf);\n\ntypedef int lf_iterator(struct vnode *, struct flock *, void *);\n\nint\t lf_advlock(struct vop_advlock_args *, struct lockf **, u_quad_t);\nint\t lf_advlockasync(struct vop_advlockasync_args *, struct lockf **, u_quad_t);\nvoid\t lf_purgelocks(struct vnode *vp, struct lockf **statep);\nint\t lf_iteratelocks_sysid(int sysid, lf_iterator *, void *);\nint\t lf_iteratelocks_vnode(struct vnode *vp, lf_iterator *, void *);\nint\t lf_countlocks(int sysid);\nvoid\t lf_clearremotesys(int sysid);\n\n#endif /* !_SYS_LOCKF_H_ */\n"
  },
  {
    "path": "freebsd-headers/sys/lockmgr.h",
    "content": "/*-\n * Copyright (c) 2008 Attilio Rao <attilio@FreeBSD.org>\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice(s), this list of conditions and the following disclaimer as\n *    the first lines of this file unmodified other than the possible \n *    addition of one or more copyright notices.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice(s), this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\n * DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE LIABLE FOR ANY\n * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR\n * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH\n * DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/sys/lockmgr.h 211531 2010-08-20 19:46:50Z jhb $\n */\n\n#ifndef\t_SYS_LOCKMGR_H_\n#define\t_SYS_LOCKMGR_H_\n\n#include <sys/_lock.h>\n#include <sys/_lockmgr.h>\n#include <sys/_mutex.h>\n#include <sys/_rwlock.h>\n\n#define\tLK_SHARE\t\t\t0x01\n#define\tLK_SHARED_WAITERS\t\t0x02\n#define\tLK_EXCLUSIVE_WAITERS\t\t0x04\n#define\tLK_EXCLUSIVE_SPINNERS\t\t0x08\n#define\tLK_ALL_WAITERS\t\t\t\t\t\t\t\\\n\t(LK_SHARED_WAITERS | LK_EXCLUSIVE_WAITERS)\n#define\tLK_FLAGMASK\t\t\t\t\t\t\t\\\n\t(LK_SHARE | LK_ALL_WAITERS | LK_EXCLUSIVE_SPINNERS)\n\n#define\tLK_HOLDER(x)\t\t\t((x) & ~LK_FLAGMASK)\n#define\tLK_SHARERS_SHIFT\t\t4\n#define\tLK_SHARERS(x)\t\t\t(LK_HOLDER(x) >> LK_SHARERS_SHIFT)\n#define\tLK_SHARERS_LOCK(x)\t\t((x) << LK_SHARERS_SHIFT | LK_SHARE)\n#define\tLK_ONE_SHARER\t\t\t(1 << LK_SHARERS_SHIFT)\n#define\tLK_UNLOCKED\t\t\tLK_SHARERS_LOCK(0)\n#define\tLK_KERNPROC\t\t\t((uintptr_t)(-1) & ~LK_FLAGMASK)\n\n#ifdef _KERNEL\n\n#if !defined(LOCK_FILE) || !defined(LOCK_LINE)\n#error\t\"LOCK_FILE and LOCK_LINE not defined, include <sys/lock.h> before\"\n#endif\n\nstruct thread;\n#define\tlk_recurse\tlock_object.lo_data\n\n/*\n * Function prototipes.  Routines that start with an underscore are not part\n * of the public interface and might be wrappered with a macro.\n */\nint\t __lockmgr_args(struct lock *lk, u_int flags, struct lock_object *ilk,\n\t    const char *wmesg, int prio, int timo, const char *file, int line);\n#if defined(INVARIANTS) || defined(INVARIANT_SUPPORT)\nvoid\t _lockmgr_assert(struct lock *lk, int what, const char *file, int line);\n#endif\nvoid\t _lockmgr_disown(struct lock *lk, const char *file, int line);\n\nvoid\t lockallowrecurse(struct lock *lk);\nvoid\t lockallowshare(struct lock *lk);\nvoid\t lockdestroy(struct lock *lk);\nvoid\t lockdisablerecurse(struct lock *lk);\nvoid\t lockinit(struct lock *lk, int prio, const char *wmesg, int timo,\n\t    int flags);\n#ifdef DDB\nint\t lockmgr_chain(struct thread *td, struct thread **ownerp);\n#endif\nvoid\t lockmgr_printinfo(struct lock *lk);\nint\t lockstatus(struct lock *lk);\n\n/*\n * As far as the ilk can be a static NULL pointer these functions need a\n * strict prototype in order to safely use the lock_object member.\n */\nstatic __inline int\n_lockmgr_args(struct lock *lk, u_int flags, struct mtx *ilk, const char *wmesg,\n    int prio, int timo, const char *file, int line)\n{\n\n\treturn (__lockmgr_args(lk, flags, (ilk != NULL) ? &ilk->lock_object :\n\t    NULL, wmesg, prio, timo, file, line));\n}\n\nstatic __inline int\n_lockmgr_args_rw(struct lock *lk, u_int flags, struct rwlock *ilk,\n    const char *wmesg, int prio, int timo, const char *file, int line)\n{\n\n\treturn (__lockmgr_args(lk, flags, (ilk != NULL) ? &ilk->lock_object :\n\t    NULL, wmesg, prio, timo, file, line));\n}\n\n/*\n * Define aliases in order to complete lockmgr KPI.\n */\n#define\tlockmgr(lk, flags, ilk)\t\t\t\t\t\t\\\n\t_lockmgr_args((lk), (flags), (ilk), LK_WMESG_DEFAULT,\t\t\\\n\t    LK_PRIO_DEFAULT, LK_TIMO_DEFAULT, LOCK_FILE, LOCK_LINE)\n#define\tlockmgr_args(lk, flags, ilk, wmesg, prio, timo)\t\t\t\\\n\t_lockmgr_args((lk), (flags), (ilk), (wmesg), (prio), (timo),\t\\\n\t    LOCK_FILE, LOCK_LINE)\n#define\tlockmgr_args_rw(lk, flags, ilk, wmesg, prio, timo)\t\t\\\n\t_lockmgr_args_rw((lk), (flags), (ilk), (wmesg), (prio), (timo),\t\\\n\t    LOCK_FILE, LOCK_LINE)\n#define\tlockmgr_disown(lk)\t\t\t\t\t\t\\\n\t_lockmgr_disown((lk), LOCK_FILE, LOCK_LINE)\n#define\tlockmgr_recursed(lk)\t\t\t\t\t\t\\\n\t((lk)->lk_recurse != 0)\n#define\tlockmgr_rw(lk, flags, ilk)\t\t\t\t\t\\\n\t_lockmgr_args_rw((lk), (flags), (ilk), LK_WMESG_DEFAULT,\t\\\n\t    LK_PRIO_DEFAULT, LK_TIMO_DEFAULT, LOCK_FILE, LOCK_LINE)\n#define\tlockmgr_waiters(lk)\t\t\t\t\t\t\\\n\t((lk)->lk_lock & LK_ALL_WAITERS)\n#ifdef INVARIANTS\n#define\tlockmgr_assert(lk, what)\t\t\t\t\t\\\n\t_lockmgr_assert((lk), (what), LOCK_FILE, LOCK_LINE)\n#else\n#define\tlockmgr_assert(lk, what)\n#endif\n\n/*\n * Flags for lockinit().\n */\n#define\tLK_INIT_MASK\t0x0000FF\n#define\tLK_CANRECURSE\t0x000001\n#define\tLK_NODUP\t0x000002\n#define\tLK_NOPROFILE\t0x000004\n#define\tLK_NOSHARE\t0x000008\n#define\tLK_NOWITNESS\t0x000010\n#define\tLK_QUIET\t0x000020\n#define\tLK_ADAPTIVE\t0x000040\n\n/*\n * Additional attributes to be used in lockmgr().\n */\n#define\tLK_EATTR_MASK\t0x00FF00\n#define\tLK_INTERLOCK\t0x000100\n#define\tLK_NOWAIT\t0x000200\n#define\tLK_RETRY\t0x000400\n#define\tLK_SLEEPFAIL\t0x000800\n#define\tLK_TIMELOCK\t0x001000\n\n/*\n * Operations for lockmgr().\n */\n#define\tLK_TYPE_MASK\t0xFF0000\n#define\tLK_DOWNGRADE\t0x010000\n#define\tLK_DRAIN\t0x020000\n#define\tLK_EXCLOTHER\t0x040000\n#define\tLK_EXCLUSIVE\t0x080000\n#define\tLK_RELEASE\t0x100000\n#define\tLK_SHARED\t0x200000\n#define\tLK_UPGRADE\t0x400000\n\n#define\tLK_TOTAL_MASK\t(LK_INIT_MASK | LK_EATTR_MASK | LK_TYPE_MASK)\n\n/*\n * Default values for lockmgr_args().\n */\n#define\tLK_WMESG_DEFAULT\t(NULL)\n#define\tLK_PRIO_DEFAULT\t\t(0)\n#define\tLK_TIMO_DEFAULT\t\t(0)\n\n/*\n * Assertion flags.\n */\n#if defined(INVARIANTS) || defined(INVARIANT_SUPPORT)\n#define\tKA_LOCKED\tLA_LOCKED\n#define\tKA_SLOCKED\tLA_SLOCKED\n#define\tKA_XLOCKED\tLA_XLOCKED\n#define\tKA_UNLOCKED\tLA_UNLOCKED\n#define\tKA_RECURSED\tLA_RECURSED\n#define\tKA_NOTRECURSED\tLA_NOTRECURSED\n#endif\n\n#endif /* _KERNEL */\n\n#endif /* !_SYS_LOCKMGR_H_ */\n"
  },
  {
    "path": "freebsd-headers/sys/lockstat.h",
    "content": "/*-\n * Copyright (c) 2008-2009 Stacey Son <sson@FreeBSD.org> \n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/sys/lockstat.h 192853 2009-05-26 20:28:22Z sson $\n */\n \n/*\n * DTrace lockstat provider definitions\n *\n */\n\n#ifndef\t_SYS_LOCKSTAT_H\n#define\t_SYS_LOCKSTAT_H\n\n#ifdef\t_KERNEL\n\n/*\n * Spin Locks\n */\n#define\tLS_MTX_SPIN_LOCK_ACQUIRE\t0\n#define\tLS_MTX_SPIN_UNLOCK_RELEASE\t1\n#define\tLS_MTX_SPIN_LOCK_SPIN\t\t2\n\n/*\n * Adaptive Locks\n */\n#define\tLS_MTX_LOCK_ACQUIRE\t\t3\n#define\tLS_MTX_UNLOCK_RELEASE\t\t4\n#define\tLS_MTX_LOCK_SPIN\t\t5\n#define\tLS_MTX_LOCK_BLOCK\t\t6\n#define\tLS_MTX_TRYLOCK_ACQUIRE\t\t7\n\n/*\n * Reader/Writer Locks\n */\n#define\tLS_RW_RLOCK_ACQUIRE\t\t8\n#define\tLS_RW_RUNLOCK_RELEASE\t\t9\t\n#define\tLS_RW_WLOCK_ACQUIRE\t\t10\n#define\tLS_RW_WUNLOCK_RELEASE\t\t11\n#define\tLS_RW_RLOCK_SPIN\t\t12\n#define\tLS_RW_RLOCK_BLOCK\t\t13\n#define\tLS_RW_WLOCK_SPIN\t\t14\n#define\tLS_RW_WLOCK_BLOCK\t\t15\n#define\tLS_RW_TRYUPGRADE_UPGRADE\t16\n#define\tLS_RW_DOWNGRADE_DOWNGRADE\t17\n\n/*\n * Shared/Exclusive Locks\n */\n#define\tLS_SX_SLOCK_ACQUIRE\t\t18\n#define\tLS_SX_SUNLOCK_RELEASE\t\t19\n#define\tLS_SX_XLOCK_ACQUIRE\t\t20\n#define\tLS_SX_XUNLOCK_RELEASE\t\t21\n#define\tLS_SX_SLOCK_SPIN\t\t22\n#define\tLS_SX_SLOCK_BLOCK\t\t23\n#define\tLS_SX_XLOCK_SPIN\t\t24\n#define\tLS_SX_XLOCK_BLOCK\t\t25\n#define\tLS_SX_TRYUPGRADE_UPGRADE\t26\n#define\tLS_SX_DOWNGRADE_DOWNGRADE\t27\n\n/* \n * Thread Locks\n */\n#define\tLS_THREAD_LOCK_SPIN\t\t28\n\n/*\n * Lockmanager Locks \n *  According to locking(9) Lockmgr locks are \"Largely deprecated\"\n *  so no support for these have been added in the lockstat provider.\n */\n\n#define\tLS_NPROBES\t\t\t29\n\n#define\tLS_MTX_LOCK\t\t\t\"mtx_lock\"\n#define\tLS_MTX_UNLOCK\t\t\t\"mtx_unlock\"\n#define\tLS_MTX_SPIN_LOCK\t\t\"mtx_lock_spin\"\n#define\tLS_MTX_SPIN_UNLOCK\t\t\"mtx_unlock_spin\"\n#define\tLS_MTX_TRYLOCK\t\t\t\"mtx_trylock\"\n#define\tLS_RW_RLOCK\t\t\t\"rw_rlock\"\n#define\tLS_RW_WLOCK\t\t\t\"rw_wlock\"\n#define\tLS_RW_RUNLOCK\t\t\t\"rw_runlock\"\n#define\tLS_RW_WUNLOCK\t\t\t\"rw_wunlock\"\n#define\tLS_RW_TRYUPGRADE\t\t\"rw_try_upgrade\"\n#define\tLS_RW_DOWNGRADE\t\t\t\"rw_downgrade\"\n#define\tLS_SX_SLOCK\t\t\t\"sx_slock\"\n#define\tLS_SX_XLOCK\t\t\t\"sx_xlock\"\n#define\tLS_SX_SUNLOCK\t\t\t\"sx_sunlock\"\n#define\tLS_SX_XUNLOCK\t\t\t\"sx_xunlock\"\n#define\tLS_SX_TRYUPGRADE\t\t\"sx_try_upgrade\"\n#define\tLS_SX_DOWNGRADE\t\t\t\"sx_downgrade\"\n#define\tLS_THREAD_LOCK\t\t\t\"thread_lock\"\n\n#define\tLS_ACQUIRE\t\t\t\"acquire\"\n#define\tLS_RELEASE\t\t\t\"release\"\n#define\tLS_SPIN\t\t\t\t\"spin\"\n#define\tLS_BLOCK\t\t\t\"block\"\n#define\tLS_UPGRADE\t\t\t\"upgrade\"\n#define\tLS_DOWNGRADE\t\t\t\"downgrade\"\n\n#define\tLS_TYPE_ADAPTIVE\t\t\"adaptive\"\n#define\tLS_TYPE_SPIN\t\t\t\"spin\"\n#define\tLS_TYPE_THREAD\t\t\t\"thread\"\n#define\tLS_TYPE_RW\t\t\t\"rw\"\n#define\tLS_TYPE_SX\t\t\t\"sx\"\n\n#define\tLSA_ACQUIRE\t\t\t(LS_TYPE_ADAPTIVE \"-\" LS_ACQUIRE)\n#define\tLSA_RELEASE\t\t\t(LS_TYPE_ADAPTIVE \"-\" LS_RELEASE)\n#define\tLSA_SPIN\t\t\t(LS_TYPE_ADAPTIVE \"-\" LS_SPIN)\n#define\tLSA_BLOCK\t\t\t(LS_TYPE_ADAPTIVE \"-\" LS_BLOCK)\n#define\tLSS_ACQUIRE\t\t\t(LS_TYPE_SPIN \"-\" LS_ACQUIRE)\n#define\tLSS_RELEASE\t\t\t(LS_TYPE_SPIN \"-\" LS_RELEASE)\n#define\tLSS_SPIN\t\t\t(LS_TYPE_SPIN \"-\" LS_SPIN)\n#define\tLSR_ACQUIRE\t\t\t(LS_TYPE_RW \"-\" LS_ACQUIRE)\n#define\tLSR_RELEASE\t\t\t(LS_TYPE_RW \"-\" LS_RELEASE)\n#define\tLSR_BLOCK\t\t\t(LS_TYPE_RW \"-\" LS_BLOCK)\n#define\tLSR_SPIN\t\t\t(LS_TYPE_RW \"-\" LS_SPIN)\n#define\tLSR_UPGRADE\t\t\t(LS_TYPE_RW \"-\" LS_UPGRADE)\n#define\tLSR_DOWNGRADE\t\t\t(LS_TYPE_RW \"-\" LS_DOWNGRADE)\n#define\tLSX_ACQUIRE\t\t\t(LS_TYPE_SX \"-\" LS_ACQUIRE)\n#define\tLSX_RELEASE\t\t\t(LS_TYPE_SX \"-\" LS_RELEASE)\n#define\tLSX_BLOCK\t\t\t(LS_TYPE_SX \"-\" LS_BLOCK)\n#define\tLSX_SPIN\t\t\t(LS_TYPE_SX \"-\" LS_SPIN)\n#define\tLSX_UPGRADE\t\t\t(LS_TYPE_SX \"-\" LS_UPGRADE)\n#define\tLSX_DOWNGRADE\t\t\t(LS_TYPE_SX \"-\" LS_DOWNGRADE)\n#define\tLST_SPIN\t\t\t(LS_TYPE_THREAD \"-\" LS_SPIN)\n\n/*\n * The following must match the type definition of dtrace_probe.  It is\n * defined this way to avoid having to rely on CDDL code.\n */\nextern uint32_t lockstat_probemap[LS_NPROBES];\ntypedef void (*lockstat_probe_func_t)(uint32_t, uintptr_t arg0, uintptr_t arg1,\n    uintptr_t arg2, uintptr_t arg3, uintptr_t arg4);\nextern lockstat_probe_func_t lockstat_probe_func;\nextern uint64_t lockstat_nsecs(void);\n\n#ifdef\tKDTRACE_HOOKS\n/*\n * Macros to record lockstat probes.\n */\n#define\tLOCKSTAT_RECORD4(probe, lp, arg1, arg2, arg3, arg4)  do {\t\\\n\tuint32_t id;\t\t\t\t\t\t\t\\\n\t\t\t\t\t\t\t\t\t\\\n\tif ((id = lockstat_probemap[(probe)])) \t\t\t\t\\\n\t    (*lockstat_probe_func)(id, (uintptr_t)(lp), (arg1),\t(arg2),\t\\\n\t\t(arg3), (arg4));\t\t\t\t\t\\\n} while (0)\n\n#define\tLOCKSTAT_RECORD(probe, lp, arg1) \\\n\tLOCKSTAT_RECORD4(probe, lp, arg1, 0, 0, 0)\n\n#define\tLOCKSTAT_RECORD0(probe, lp)     \\\n\tLOCKSTAT_RECORD4(probe, lp, 0, 0, 0, 0)\n\n#define\tLOCKSTAT_RECORD1(probe, lp, arg1) \\\n\tLOCKSTAT_RECORD4(probe, lp, arg1, 0, 0, 0)\n\n#define\tLOCKSTAT_RECORD2(probe, lp, arg1, arg2) \\\n\tLOCKSTAT_RECORD4(probe, lp, arg1, arg2, 0, 0)\n\n#define\tLOCKSTAT_RECORD3(probe, lp, arg1, arg2, arg3) \\\n\tLOCKSTAT_RECORD4(probe, lp, arg1, arg2, arg3, 0)\n\n#define\tLOCKSTAT_PROFILE_OBTAIN_LOCK_SUCCESS(probe, lp, c, wt, f, l)  do {   \\\n\tuint32_t id;\t\t\t\t\t\t\t     \\\n\t\t\t\t\t\t\t\t\t     \\\n    \tlock_profile_obtain_lock_success(&(lp)->lock_object, c, wt, f, l);   \\\n\tif ((id = lockstat_probemap[(probe)])) \t\t\t     \t     \\\n\t\t(*lockstat_probe_func)(id, (uintptr_t)(lp), 0, 0, 0, 0);     \\\n} while (0)\n\n#define\tLOCKSTAT_PROFILE_RELEASE_LOCK(probe, lp)  do {\t\t\t     \\\n\tuint32_t id;\t\t\t\t\t\t\t     \\\n\t\t\t\t\t\t\t\t\t     \\\n\tlock_profile_release_lock(&(lp)->lock_object);\t\t\t     \\\n\tif ((id = lockstat_probemap[(probe)])) \t\t\t     \t     \\\n\t\t(*lockstat_probe_func)(id, (uintptr_t)(lp), 0, 0, 0, 0);     \\\n} while (0)\n\n#else\t/* !KDTRACE_HOOKS */\n\n#define\tLOCKSTAT_RECORD(probe, lp, arg1)\n#define\tLOCKSTAT_RECORD0(probe, lp)\n#define\tLOCKSTAT_RECORD1(probe, lp, arg1)\n#define\tLOCKSTAT_RECORD2(probe, lp, arg1, arg2)\n#define\tLOCKSTAT_RECORD3(probe, lp, arg1, arg2, arg3)\n#define\tLOCKSTAT_RECORD4(probe, lp, arg1, arg2, arg3, arg4)\n\n#define\tLOCKSTAT_PROFILE_OBTAIN_LOCK_SUCCESS(probe, lp, c, wt, f, l)\t\\\n\tlock_profile_obtain_lock_success(&(lp)->lock_object, c, wt, f, l)\n\n#define\tLOCKSTAT_PROFILE_RELEASE_LOCK(probe, lp)  \t\t\t\\\n\tlock_profile_release_lock(&(lp)->lock_object)\n\n#endif\t/* !KDTRACE_HOOKS */\n\n#endif\t/* _KERNEL */\n\n#endif\t/* _SYS_LOCKSTAT_H */\n"
  },
  {
    "path": "freebsd-headers/sys/loginclass.h",
    "content": "/*-\n * Copyright (c) 2011 The FreeBSD Foundation\n * All rights reserved.\n *\n * This software was developed by Edward Tomasz Napierala under sponsorship\n * from the FreeBSD Foundation.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/sys/loginclass.h 220137 2011-03-29 17:47:25Z trasz $\n */\n\n#ifndef _SYS_LOGINCLASS_H_\n#define\t_SYS_LOGINCLASS_H_\n\nstruct racct;\n\n/*\n * Exactly one of these structures exists per login class.\n */\nstruct loginclass {\n\tLIST_ENTRY(loginclass)\tlc_next;\n\tchar\t\t\tlc_name[MAXLOGNAME];\n\tu_int\t\t\tlc_refcount;\n\tstruct racct\t\t*lc_racct;\n};\n\nvoid\tloginclass_hold(struct loginclass *lc);\nvoid\tloginclass_free(struct loginclass *lc);\nstruct loginclass\t*loginclass_find(const char *name);\nvoid\tloginclass_racct_foreach(void (*callback)(struct racct *racct,\n\t    void *arg2, void *arg3), void *arg2, void *arg3);\n\n#endif /* !_SYS_LOGINCLASS_H_ */\n"
  },
  {
    "path": "freebsd-headers/sys/mac.h",
    "content": "/*-\n * Copyright (c) 1999-2002 Robert N. M. Watson\n * Copyright (c) 2001-2005 Networks Associates Technology, Inc.\n * Copyright (c) 2005-2006 SPARTA, Inc.\n * All rights reserved.\n *\n * This software was developed by Robert Watson for the TrustedBSD Project.\n *\n * This software was developed for the FreeBSD Project in part by Network\n * Associates Laboratories, the Security Research Division of Network\n * Associates, Inc. under DARPA/SPAWAR contract N66001-01-C-8035 (\"CBOSS\"),\n * as part of the DARPA CHATS research program.\n *\n * This software was enhanced by SPARTA ISSO under SPAWAR contract\n * N66001-04-C-6019 (\"SEFOS\").\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/sys/mac.h 166537 2007-02-06 16:24:57Z rwatson $\n */\n/*\n * Userland interface for Mandatory Access Control.  Loosely based on the\n * POSIX.1e API.  More information may be found at:\n *\n * http://www.TrustedBSD.org/\n */\n\n#ifndef _SYS_MAC_H_\n#define\t_SYS_MAC_H_\n\n#ifndef _POSIX_MAC\n#define\t_POSIX_MAC\n#endif\n\n/*\n * MAC framework-related constants and limits.\n */\n#define\tMAC_MAX_POLICY_NAME\t\t32\n#define\tMAC_MAX_LABEL_ELEMENT_NAME\t32\n#define\tMAC_MAX_LABEL_ELEMENT_DATA\t4096\n#define\tMAC_MAX_LABEL_BUF_LEN\t\t8192\n\n/*\n * struct mac is the data structure used to carry MAC labels in system calls\n * and ioctls between userspace and the kernel.\n */\nstruct mac {\n\tsize_t\t\t m_buflen;\n\tchar\t\t*m_string;\n};\n\ntypedef struct mac\t*mac_t;\n\n#ifndef _KERNEL\n\n/*\n * Location of the userland MAC framework configuration file.  mac.conf\n * set defaults for MAC-aware applications.\n */\n#define\tMAC_CONFFILE\t\"/etc/mac.conf\"\n\n/*\n * Extended non-POSIX.1e interfaces that offer additional services available\n * from the userland and kernel MAC frameworks.\n */\n__BEGIN_DECLS\nint\t mac_execve(char *fname, char **argv, char **envv, mac_t _label);\nint\t mac_free(mac_t _label);\nint\t mac_from_text(mac_t *_label, const char *_text);\nint\t mac_get_fd(int _fd, mac_t _label);\nint\t mac_get_file(const char *_path, mac_t _label);\nint\t mac_get_link(const char *_path, mac_t _label);\nint\t mac_get_peer(int _fd, mac_t _label);\nint\t mac_get_pid(pid_t _pid, mac_t _label);\nint\t mac_get_proc(mac_t _label);\nint\t mac_is_present(const char *_policyname);\nint\t mac_prepare(mac_t *_label, const char *_elements);\nint\t mac_prepare_file_label(mac_t *_label);\nint\t mac_prepare_ifnet_label(mac_t *_label);\nint\t mac_prepare_process_label(mac_t *_label);\nint\t mac_prepare_type(mac_t *_label, const char *_type);\nint\t mac_set_fd(int _fildes, const mac_t _label);\nint\t mac_set_file(const char *_path, mac_t _label);\nint\t mac_set_link(const char *_path, mac_t _label);\nint\t mac_set_proc(const mac_t _label);\nint\t mac_syscall(const char *_policyname, int _call, void *_arg);\nint\t mac_to_text(mac_t mac, char **_text);\n__END_DECLS\n\n#endif /* !_KERNEL */\n\n#endif /* !_SYS_MAC_H_ */\n"
  },
  {
    "path": "freebsd-headers/sys/malloc.h",
    "content": "/*-\n * Copyright (c) 1987, 1993\n *\tThe Regents of the University of California.\n * Copyright (c) 2005, 2009 Robert N. M. Watson\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 4. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t@(#)malloc.h\t8.5 (Berkeley) 5/3/95\n * $FreeBSD: release/9.0.0/sys/sys/malloc.h 210564 2010-07-28 15:36:12Z mdf $\n */\n\n#ifndef _SYS_MALLOC_H_\n#define\t_SYS_MALLOC_H_\n\n#include <sys/param.h>\n#include <sys/queue.h>\n#include <sys/_lock.h>\n#include <sys/_mutex.h>\n\n#define\tMINALLOCSIZE\tUMA_SMALLEST_UNIT\n\n/*\n * flags to malloc.\n */\n#define\tM_NOWAIT\t0x0001\t\t/* do not block */\n#define\tM_WAITOK\t0x0002\t\t/* ok to block */\n#define\tM_ZERO\t\t0x0100\t\t/* bzero the allocation */\n#define\tM_NOVM\t\t0x0200\t\t/* don't ask VM for pages */\n#define\tM_USE_RESERVE\t0x0400\t\t/* can alloc out of reserve memory */\n\n#define\tM_MAGIC\t\t877983977\t/* time when first defined :-) */\n\n/*\n * Two malloc type structures are present: malloc_type, which is used by a\n * type owner to declare the type, and malloc_type_internal, which holds\n * malloc-owned statistics and other ABI-sensitive fields, such as the set of\n * malloc statistics indexed by the compile-time MAXCPU constant.\n * Applications should avoid introducing dependence on the allocator private\n * data layout and size.\n *\n * The malloc_type ks_next field is protected by malloc_mtx.  Other fields in\n * malloc_type are static after initialization so unsynchronized.\n *\n * Statistics in malloc_type_stats are written only when holding a critical\n * section and running on the CPU associated with the index into the stat\n * array, but read lock-free resulting in possible (minor) races, which the\n * monitoring app should take into account.\n */\nstruct malloc_type_stats {\n\tuint64_t\tmts_memalloced;\t/* Bytes allocated on CPU. */\n\tuint64_t\tmts_memfreed;\t/* Bytes freed on CPU. */\n\tuint64_t\tmts_numallocs;\t/* Number of allocates on CPU. */\n\tuint64_t\tmts_numfrees;\t/* number of frees on CPU. */\n\tuint64_t\tmts_size;\t/* Bitmask of sizes allocated on CPU. */\n\tuint64_t\t_mts_reserved1;\t/* Reserved field. */\n\tuint64_t\t_mts_reserved2;\t/* Reserved field. */\n\tuint64_t\t_mts_reserved3;\t/* Reserved field. */\n};\n\n/*\n * Index definitions for the mti_probes[] array.\n */\n#define DTMALLOC_PROBE_MALLOC\t\t0\n#define DTMALLOC_PROBE_FREE\t\t1\n#define DTMALLOC_PROBE_MAX\t\t2\n\nstruct malloc_type_internal {\n\tuint32_t\tmti_probes[DTMALLOC_PROBE_MAX];\n\t\t\t\t\t/* DTrace probe ID array. */\n\tu_char\t\tmti_zone;\n\tstruct malloc_type_stats\tmti_stats[MAXCPU];\n};\n\n/*\n * Public data structure describing a malloc type.  Private data is hung off\n * of ks_handle to avoid encoding internal malloc(9) data structures in\n * modules, which will statically allocate struct malloc_type.\n */\nstruct malloc_type {\n\tstruct malloc_type *ks_next;\t/* Next in global chain. */\n\tu_long\t\t ks_magic;\t/* Detect programmer error. */\n\tconst char\t*ks_shortdesc;\t/* Printable type name. */\n\tvoid\t\t*ks_handle;\t/* Priv. data, was lo_class. */\n};\n\n/*\n * Statistics structure headers for user space.  The kern.malloc sysctl\n * exposes a structure stream consisting of a stream header, then a series of\n * malloc type headers and statistics structures (quantity maxcpus).  For\n * convenience, the kernel will provide the current value of maxcpus at the\n * head of the stream.\n */\n#define\tMALLOC_TYPE_STREAM_VERSION\t0x00000001\nstruct malloc_type_stream_header {\n\tuint32_t\tmtsh_version;\t/* Stream format version. */\n\tuint32_t\tmtsh_maxcpus;\t/* Value of MAXCPU for stream. */\n\tuint32_t\tmtsh_count;\t/* Number of records. */\n\tuint32_t\t_mtsh_pad;\t/* Pad/reserved field. */\n};\n\n#define\tMALLOC_MAX_NAME\t32\nstruct malloc_type_header {\n\tchar\t\t\t\tmth_name[MALLOC_MAX_NAME];\n};\n\n#ifdef _KERNEL\n#define\tMALLOC_DEFINE(type, shortdesc, longdesc)\t\t\t\\\n\tstruct malloc_type type[1] = {\t\t\t\t\t\\\n\t\t{ NULL, M_MAGIC, shortdesc, NULL }\t\t\t\\\n\t};\t\t\t\t\t\t\t\t\\\n\tSYSINIT(type##_init, SI_SUB_KMEM, SI_ORDER_SECOND, malloc_init,\t\\\n\t    type);\t\t\t\t\t\t\t\\\n\tSYSUNINIT(type##_uninit, SI_SUB_KMEM, SI_ORDER_ANY,\t\t\\\n\t    malloc_uninit, type)\n\n#define\tMALLOC_DECLARE(type) \\\n\textern struct malloc_type type[1]\n\nMALLOC_DECLARE(M_CACHE);\nMALLOC_DECLARE(M_DEVBUF);\nMALLOC_DECLARE(M_TEMP);\n\nMALLOC_DECLARE(M_IP6OPT); /* for INET6 */\nMALLOC_DECLARE(M_IP6NDP); /* for INET6 */\n\n/*\n * Deprecated macro versions of not-quite-malloc() and free().\n */\n#define\tMALLOC(space, cast, size, type, flags) \\\n\t((space) = (cast)malloc((u_long)(size), (type), (flags)))\n#define\tFREE(addr, type) free((addr), (type))\n\n/*\n * XXX this should be declared in <sys/uio.h>, but that tends to fail\n * because <sys/uio.h> is included in a header before the source file\n * has a chance to include <sys/malloc.h> to get MALLOC_DECLARE() defined.\n */\nMALLOC_DECLARE(M_IOV);\n\nextern struct mtx malloc_mtx;\n\n/*\n * Function type used when iterating over the list of malloc types.\n */\ntypedef void malloc_type_list_func_t(struct malloc_type *, void *);\n\nvoid\tcontigfree(void *addr, unsigned long size, struct malloc_type *type);\nvoid\t*contigmalloc(unsigned long size, struct malloc_type *type, int flags,\n\t    vm_paddr_t low, vm_paddr_t high, unsigned long alignment,\n\t    unsigned long boundary) __malloc_like;\nvoid\tfree(void *addr, struct malloc_type *type);\nvoid\t*malloc(unsigned long size, struct malloc_type *type, int flags) __malloc_like;\nvoid\tmalloc_init(void *);\nint\tmalloc_last_fail(void);\nvoid\tmalloc_type_allocated(struct malloc_type *type, unsigned long size);\nvoid\tmalloc_type_freed(struct malloc_type *type, unsigned long size);\nvoid\tmalloc_type_list(malloc_type_list_func_t *, void *);\nvoid\tmalloc_uninit(void *);\nvoid\t*realloc(void *addr, unsigned long size, struct malloc_type *type,\n\t    int flags);\nvoid\t*reallocf(void *addr, unsigned long size, struct malloc_type *type,\n\t    int flags);\n\nstruct malloc_type *malloc_desc2type(const char *desc);\n#endif /* _KERNEL */\n\n#endif /* !_SYS_MALLOC_H_ */\n"
  },
  {
    "path": "freebsd-headers/sys/mbpool.h",
    "content": "/*-\n * Copyright (c) 2003\n *\tFraunhofer Institute for Open Communication Systems (FhG Fokus).\n * \tAll rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * Author: Hartmut Brandt <harti@freebsd.org>\n */\n\n/*\n * This implements pools of DMA-able buffers that conserve DMA address space\n * by putting several buffers into one page and that allow to map between\n * 32-bit handles for the buffer and buffer addresses (to use 32-bit network\n * interfaces on 64bit machines). This assists network interfaces that may need\n * huge numbers of mbufs.\n *\n * $FreeBSD: release/9.0.0/sys/sys/mbpool.h 139825 2005-01-07 02:29:27Z imp $\n */\n#ifndef _SYS_MBPOOL_H_\n#define\t_SYS_MBPOOL_H_\n\n#ifdef _KERNEL\n\n#include <sys/queue.h>\n\n/* opaque */\nstruct mbpool;\n\n/* size of reserved area at end of each chunk */\n#define\tMBPOOL_TRAILER_SIZE\t4\n\n/* maximum value of max_pages */\n#define\tMBPOOL_MAX_MAXPAGES\t((1 << 14) - 1)\n\n/* maximum number of chunks per page */\n#define\tMBPOOL_MAX_CHUNKS\t(1 << 9)\n\n/* initialize a pool */\nint mbp_create(struct mbpool **, const char *, bus_dma_tag_t, u_int,\n\tsize_t, size_t);\n\n/* destroy a pool */\nvoid mbp_destroy(struct mbpool *);\n\n/* allocate a chunk and set used and on card */\nvoid *mbp_alloc(struct mbpool *, bus_addr_t *, uint32_t *);\n\n/* free a chunk */\nvoid mbp_free(struct mbpool *, void *);\n\n/* free a chunk that is an external mbuf */\nvoid mbp_ext_free(void *, void *);\n\n/* free all buffers that are marked to be on the card */\nvoid mbp_card_free(struct mbpool *);\n\n/* count used buffers and buffers on card */\nvoid mbp_count(struct mbpool *, u_int *, u_int *, u_int *);\n\n/* get the buffer from a handle and clear card bit */\nvoid *mbp_get(struct mbpool *, uint32_t);\n\n/* get the buffer from a handle and don't clear card bit */\nvoid *mbp_get_keep(struct mbpool *, uint32_t);\n\n/* sync the chunk */\nvoid mbp_sync(struct mbpool *, uint32_t, bus_addr_t, bus_size_t, u_int);\n\n#endif\t/* _KERNEL */\n#endif\t/* _SYS_MBPOOL_H_ */\n"
  },
  {
    "path": "freebsd-headers/sys/mbuf.h",
    "content": "/*-\n * Copyright (c) 1982, 1986, 1988, 1993\n *\tThe Regents of the University of California.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t@(#)mbuf.h\t8.5 (Berkeley) 2/19/95\n * $FreeBSD: release/9.0.0/sys/sys/mbuf.h 223637 2011-06-28 11:57:25Z bz $\n */\n\n#ifndef _SYS_MBUF_H_\n#define\t_SYS_MBUF_H_\n\n/* XXX: These includes suck. Sorry! */\n#include <sys/queue.h>\n#ifdef _KERNEL\n#include <sys/systm.h>\n#include <vm/uma.h>\n#ifdef WITNESS\n#include <sys/lock.h>\n#endif\n#endif\n\n/*\n * Mbufs are of a single size, MSIZE (sys/param.h), which includes overhead.\n * An mbuf may add a single \"mbuf cluster\" of size MCLBYTES (also in\n * sys/param.h), which has no additional overhead and is used instead of the\n * internal data area; this is done when at least MINCLSIZE of data must be\n * stored.  Additionally, it is possible to allocate a separate buffer\n * externally and attach it to the mbuf in a way similar to that of mbuf\n * clusters.\n */\n#define\tMLEN\t\t(MSIZE - sizeof(struct m_hdr))\t/* normal data len */\n#define\tMHLEN\t\t(MLEN - sizeof(struct pkthdr))\t/* data len w/pkthdr */\n#define\tMINCLSIZE\t(MHLEN + 1)\t/* smallest amount to put in cluster */\n#define\tM_MAXCOMPRESS\t(MHLEN / 2)\t/* max amount to copy for compression */\n\n#ifdef _KERNEL\n/*-\n * Macro for type conversion: convert mbuf pointer to data pointer of correct\n * type:\n *\n * mtod(m, t)\t-- Convert mbuf pointer to data pointer of correct type.\n */\n#define\tmtod(m, t)\t((t)((m)->m_data))\n\n/*\n * Argument structure passed to UMA routines during mbuf and packet\n * allocations.\n */\nstruct mb_args {\n\tint\tflags;\t/* Flags for mbuf being allocated */\n\tshort\ttype;\t/* Type of mbuf being allocated */\n};\n#endif /* _KERNEL */\n\n#if defined(__LP64__)\n#define M_HDR_PAD    6\n#else\n#define M_HDR_PAD    2\n#endif\n\n/*\n * Header present at the beginning of every mbuf.\n */\nstruct m_hdr {\n\tstruct mbuf\t*mh_next;\t/* next buffer in chain */\n\tstruct mbuf\t*mh_nextpkt;\t/* next chain in queue/record */\n\tcaddr_t\t\t mh_data;\t/* location of data */\n\tint\t\t mh_len;\t/* amount of data in this mbuf */\n\tint\t\t mh_flags;\t/* flags; see below */\n\tshort\t\t mh_type;\t/* type of data in this mbuf */\n\tuint8_t          pad[M_HDR_PAD];/* word align                  */\n};\n\n/*\n * Packet tag structure (see below for details).\n */\nstruct m_tag {\n\tSLIST_ENTRY(m_tag)\tm_tag_link;\t/* List of packet tags */\n\tu_int16_t\t\tm_tag_id;\t/* Tag ID */\n\tu_int16_t\t\tm_tag_len;\t/* Length of data */\n\tu_int32_t\t\tm_tag_cookie;\t/* ABI/Module ID */\n\tvoid\t\t\t(*m_tag_free)(struct m_tag *);\n};\n\n/*\n * Record/packet header in first mbuf of chain; valid only if M_PKTHDR is set.\n */\nstruct pkthdr {\n\tstruct ifnet\t*rcvif;\t\t/* rcv interface */\n\t/* variables for ip and tcp reassembly */\n\tvoid\t\t*header;\t/* pointer to packet header */\n\tint\t\t len;\t\t/* total packet length */\n\tuint32_t\t flowid;\t/* packet's 4-tuple system \n\t\t\t\t\t * flow identifier\n\t\t\t\t\t */\n\t/* variables for hardware checksum */\n\tint\t\t csum_flags;\t/* flags regarding checksum */\n\tint\t\t csum_data;\t/* data field used by csum routines */\n\tu_int16_t\t tso_segsz;\t/* TSO segment size */\n\tunion {\n\t\tu_int16_t vt_vtag;\t/* Ethernet 802.1p+q vlan tag */\n\t\tu_int16_t vt_nrecs;\t/* # of IGMPv3 records in this chain */\n\t} PH_vt;\n\tSLIST_HEAD(packet_tags, m_tag) tags; /* list of packet tags */\n};\n#define ether_vtag\tPH_vt.vt_vtag\n\n/*\n * Description of external storage mapped into mbuf; valid only if M_EXT is\n * set.\n */\nstruct m_ext {\n\tcaddr_t\t\t ext_buf;\t/* start of buffer */\n\tvoid\t\t(*ext_free)\t/* free routine if not the usual */\n\t\t\t    (void *, void *);\n\tvoid\t\t*ext_arg1;\t/* optional argument pointer */\n\tvoid\t\t*ext_arg2;\t/* optional argument pointer */\n\tu_int\t\t ext_size;\t/* size of buffer, for ext_free */\n\tvolatile u_int\t*ref_cnt;\t/* pointer to ref count info */\n\tint\t\t ext_type;\t/* type of external storage */\n};\n\n/*\n * The core of the mbuf object along with some shortcut defines for practical\n * purposes.\n */\nstruct mbuf {\n\tstruct m_hdr\tm_hdr;\n\tunion {\n\t\tstruct {\n\t\t\tstruct pkthdr\tMH_pkthdr;\t/* M_PKTHDR set */\n\t\t\tunion {\n\t\t\t\tstruct m_ext\tMH_ext;\t/* M_EXT set */\n\t\t\t\tchar\t\tMH_databuf[MHLEN];\n\t\t\t} MH_dat;\n\t\t} MH;\n\t\tchar\tM_databuf[MLEN];\t\t/* !M_PKTHDR, !M_EXT */\n\t} M_dat;\n};\n#define\tm_next\t\tm_hdr.mh_next\n#define\tm_len\t\tm_hdr.mh_len\n#define\tm_data\t\tm_hdr.mh_data\n#define\tm_type\t\tm_hdr.mh_type\n#define\tm_flags\t\tm_hdr.mh_flags\n#define\tm_nextpkt\tm_hdr.mh_nextpkt\n#define\tm_act\t\tm_nextpkt\n#define\tm_pkthdr\tM_dat.MH.MH_pkthdr\n#define\tm_ext\t\tM_dat.MH.MH_dat.MH_ext\n#define\tm_pktdat\tM_dat.MH.MH_dat.MH_databuf\n#define\tm_dat\t\tM_dat.M_databuf\n\n/*\n * mbuf flags.\n */\n#define\tM_EXT\t\t0x00000001 /* has associated external storage */\n#define\tM_PKTHDR\t0x00000002 /* start of record */\n#define\tM_EOR\t\t0x00000004 /* end of record */\n#define\tM_RDONLY\t0x00000008 /* associated data is marked read-only */\n#define\tM_PROTO1\t0x00000010 /* protocol-specific */\n#define\tM_PROTO2\t0x00000020 /* protocol-specific */\n#define\tM_PROTO3\t0x00000040 /* protocol-specific */\n#define\tM_PROTO4\t0x00000080 /* protocol-specific */\n#define\tM_PROTO5\t0x00000100 /* protocol-specific */\n#define\tM_BCAST\t\t0x00000200 /* send/received as link-level broadcast */\n#define\tM_MCAST\t\t0x00000400 /* send/received as link-level multicast */\n#define\tM_FRAG\t\t0x00000800 /* packet is a fragment of a larger packet */\n#define\tM_FIRSTFRAG\t0x00001000 /* packet is first fragment */\n#define\tM_LASTFRAG\t0x00002000 /* packet is last fragment */\n#define\tM_SKIP_FIREWALL\t0x00004000 /* skip firewall processing */\n#define\tM_FREELIST\t0x00008000 /* mbuf is on the free list */\n#define\tM_VLANTAG\t0x00010000 /* ether_vtag is valid */\n#define\tM_PROMISC\t0x00020000 /* packet was not for us */\n#define\tM_NOFREE\t0x00040000 /* do not free mbuf, embedded in cluster */\n#define\tM_PROTO6\t0x00080000 /* protocol-specific */\n#define\tM_PROTO7\t0x00100000 /* protocol-specific */\n#define\tM_PROTO8\t0x00200000 /* protocol-specific */\n#define\tM_FLOWID\t0x00400000 /* deprecated: flowid is valid */\n#define\tM_HASHTYPEBITS\t0x0F000000 /* mask of bits holding flowid hash type */\n\n/*\n * For RELENG_{6,7} steal these flags for limited multiple routing table\n * support. In RELENG_8 and beyond, use just one flag and a tag.\n */\n#define\tM_FIB\t\t0xF0000000 /* steal some bits to store fib number. */\n\n#define\tM_NOTIFICATION\tM_PROTO5    /* SCTP notification */\n\n/*\n * Flags to purge when crossing layers.\n */\n#define\tM_PROTOFLAGS \\\n    (M_PROTO1|M_PROTO2|M_PROTO3|M_PROTO4|M_PROTO5|M_PROTO6|M_PROTO7|M_PROTO8)\n\n/*\n * Network interface cards are able to hash protocol fields (such as IPv4\n * addresses and TCP port numbers) classify packets into flows.  These flows\n * can then be used to maintain ordering while delivering packets to the OS\n * via parallel input queues, as well as to provide a stateless affinity\n * model.  NIC drivers can pass up the hash via m->m_pkthdr.flowid, and set\n * m_flag fields to indicate how the hash should be interpreted by the\n * network stack.\n *\n * Most NICs support RSS, which provides ordering and explicit affinity, and\n * use the hash m_flag bits to indicate what header fields were covered by\n * the hash.  M_HASHTYPE_OPAQUE can be set by non-RSS cards or configurations\n * that provide an opaque flow identifier, allowing for ordering and\n * distribution without explicit affinity.\n */\n#define\tM_HASHTYPE_SHIFT\t\t24\n#define\tM_HASHTYPE_NONE\t\t\t0x0\n#define\tM_HASHTYPE_RSS_IPV4\t\t0x1\t/* IPv4 2-tuple */\n#define\tM_HASHTYPE_RSS_TCP_IPV4\t\t0x2\t/* TCPv4 4-tuple */\n#define\tM_HASHTYPE_RSS_IPV6\t\t0x3\t/* IPv6 2-tuple */\n#define\tM_HASHTYPE_RSS_TCP_IPV6\t\t0x4\t/* TCPv6 4-tuple */\n#define\tM_HASHTYPE_RSS_IPV6_EX\t\t0x5\t/* IPv6 2-tuple + ext hdrs */\n#define\tM_HASHTYPE_RSS_TCP_IPV6_EX\t0x6\t/* TCPv6 4-tiple + ext hdrs */\n#define\tM_HASHTYPE_OPAQUE\t\t0xf\t/* ordering, not affinity */\n\n#define\tM_HASHTYPE_CLEAR(m)\t(m)->m_flags &= ~(M_HASHTYPEBITS)\n#define\tM_HASHTYPE_GET(m)\t(((m)->m_flags & M_HASHTYPEBITS) >> \\\n\t\t\t\t    M_HASHTYPE_SHIFT)\n#define\tM_HASHTYPE_SET(m, v)\tdo {\t\t\t\t\t\\\n\t(m)->m_flags &= ~M_HASHTYPEBITS;\t\t\t\t\\\n\t(m)->m_flags |= ((v) << M_HASHTYPE_SHIFT);\t\t\t\\\n} while (0)\n#define\tM_HASHTYPE_TEST(m, v)\t(M_HASHTYPE_GET(m) == (v))\n\n/*\n * Flags preserved when copying m_pkthdr.\n */\n#define\tM_COPYFLAGS \\\n    (M_PKTHDR|M_EOR|M_RDONLY|M_PROTOFLAGS|M_SKIP_FIREWALL|M_BCAST|M_MCAST|\\\n     M_FRAG|M_FIRSTFRAG|M_LASTFRAG|M_VLANTAG|M_PROMISC|M_FIB|M_HASHTYPEBITS)\n\n/*\n * External buffer types: identify ext_buf type.\n */\n#define\tEXT_CLUSTER\t1\t/* mbuf cluster */\n#define\tEXT_SFBUF\t2\t/* sendfile(2)'s sf_bufs */\n#define\tEXT_JUMBOP\t3\t/* jumbo cluster 4096 bytes */\n#define\tEXT_JUMBO9\t4\t/* jumbo cluster 9216 bytes */\n#define\tEXT_JUMBO16\t5\t/* jumbo cluster 16184 bytes */\n#define\tEXT_PACKET\t6\t/* mbuf+cluster from packet zone */\n#define\tEXT_MBUF\t7\t/* external mbuf reference (M_IOVEC) */\n#define\tEXT_NET_DRV\t100\t/* custom ext_buf provided by net driver(s) */\n#define\tEXT_MOD_TYPE\t200\t/* custom module's ext_buf type */\n#define\tEXT_DISPOSABLE\t300\t/* can throw this buffer away w/page flipping */\n#define\tEXT_EXTREF\t400\t/* has externally maintained ref_cnt ptr */\n\n/*\n * Flags indicating hw checksum support and sw checksum requirements.  This\n * field can be directly tested against if_data.ifi_hwassist.\n */\n#define\tCSUM_IP\t\t\t0x0001\t\t/* will csum IP */\n#define\tCSUM_TCP\t\t0x0002\t\t/* will csum TCP */\n#define\tCSUM_UDP\t\t0x0004\t\t/* will csum UDP */\n#define\tCSUM_IP_FRAGS\t\t0x0008\t\t/* will csum IP fragments */\n#define\tCSUM_FRAGMENT\t\t0x0010\t\t/* will do IP fragmentation */\n#define\tCSUM_TSO\t\t0x0020\t\t/* will do TSO */\n#define\tCSUM_SCTP\t\t0x0040\t\t/* will csum SCTP */\n\n#define\tCSUM_IP_CHECKED\t\t0x0100\t\t/* did csum IP */\n#define\tCSUM_IP_VALID\t\t0x0200\t\t/*   ... the csum is valid */\n#define\tCSUM_DATA_VALID\t\t0x0400\t\t/* csum_data field is valid */\n#define\tCSUM_PSEUDO_HDR\t\t0x0800\t\t/* csum_data has pseudo hdr */\n#define\tCSUM_SCTP_VALID\t\t0x1000\t\t/* SCTP checksum is valid */\n\n#define\tCSUM_DELAY_DATA\t\t(CSUM_TCP | CSUM_UDP)\n#define\tCSUM_DELAY_IP\t\t(CSUM_IP)\t/* XXX add ipv6 here too? */\n\n/*\n * mbuf types.\n */\n#define\tMT_NOTMBUF\t0\t/* USED INTERNALLY ONLY! Object is not mbuf */\n#define\tMT_DATA\t\t1\t/* dynamic (data) allocation */\n#define\tMT_HEADER\tMT_DATA\t/* packet header, use M_PKTHDR instead */\n#define\tMT_SONAME\t8\t/* socket name */\n#define\tMT_CONTROL\t14\t/* extra-data protocol message */\n#define\tMT_OOBDATA\t15\t/* expedited data  */\n#define\tMT_NTYPES\t16\t/* number of mbuf types for mbtypes[] */\n\n#define\tMT_NOINIT\t255\t/* Not a type but a flag to allocate\n\t\t\t\t   a non-initialized mbuf */\n\n#define MB_NOTAGS\t0x1UL\t/* no tags attached to mbuf */\n\n/*\n * General mbuf allocator statistics structure.\n *\n * Many of these statistics are no longer used; we instead track many\n * allocator statistics through UMA's built in statistics mechanism.\n */\nstruct mbstat {\n\tu_long\tm_mbufs;\t/* XXX */\n\tu_long\tm_mclusts;\t/* XXX */\n\n\tu_long\tm_drain;\t/* times drained protocols for space */\n\tu_long\tm_mcfail;\t/* XXX: times m_copym failed */\n\tu_long\tm_mpfail;\t/* XXX: times m_pullup failed */\n\tu_long\tm_msize;\t/* length of an mbuf */\n\tu_long\tm_mclbytes;\t/* length of an mbuf cluster */\n\tu_long\tm_minclsize;\t/* min length of data to allocate a cluster */\n\tu_long\tm_mlen;\t\t/* length of data in an mbuf */\n\tu_long\tm_mhlen;\t/* length of data in a header mbuf */\n\n\t/* Number of mbtypes (gives # elems in mbtypes[] array) */\n\tshort\tm_numtypes;\n\n\t/* XXX: Sendfile stats should eventually move to their own struct */\n\tu_long\tsf_iocnt;\t/* times sendfile had to do disk I/O */\n\tu_long\tsf_allocfail;\t/* times sfbuf allocation failed */\n\tu_long\tsf_allocwait;\t/* times sfbuf allocation had to wait */\n};\n\n/*\n * Flags specifying how an allocation should be made.\n *\n * The flag to use is as follows:\n * - M_DONTWAIT or M_NOWAIT from an interrupt handler to not block allocation.\n * - M_WAIT or M_WAITOK from wherever it is safe to block.\n *\n * M_DONTWAIT/M_NOWAIT means that we will not block the thread explicitly and\n * if we cannot allocate immediately we may return NULL, whereas\n * M_WAIT/M_WAITOK means that if we cannot allocate resources we\n * will block until they are available, and thus never return NULL.\n *\n * XXX Eventually just phase this out to use M_WAITOK/M_NOWAIT.\n */\n#define\tMBTOM(how)\t(how)\n#define\tM_DONTWAIT\tM_NOWAIT\n#define\tM_TRYWAIT\tM_WAITOK\n#define\tM_WAIT\t\tM_WAITOK\n\n/*\n * String names of mbuf-related UMA(9) and malloc(9) types.  Exposed to\n * !_KERNEL so that monitoring tools can look up the zones with\n * libmemstat(3).\n */\n#define\tMBUF_MEM_NAME\t\t\"mbuf\"\n#define\tMBUF_CLUSTER_MEM_NAME\t\"mbuf_cluster\"\n#define\tMBUF_PACKET_MEM_NAME\t\"mbuf_packet\"\n#define\tMBUF_JUMBOP_MEM_NAME\t\"mbuf_jumbo_page\"\n#define\tMBUF_JUMBO9_MEM_NAME\t\"mbuf_jumbo_9k\"\n#define\tMBUF_JUMBO16_MEM_NAME\t\"mbuf_jumbo_16k\"\n#define\tMBUF_TAG_MEM_NAME\t\"mbuf_tag\"\n#define\tMBUF_EXTREFCNT_MEM_NAME\t\"mbuf_ext_refcnt\"\n\n#ifdef _KERNEL\n\n#ifdef WITNESS\n#define\tMBUF_CHECKSLEEP(how) do {\t\t\t\t\t\\\n\tif (how == M_WAITOK)\t\t\t\t\t\t\\\n\t\tWITNESS_WARN(WARN_GIANTOK | WARN_SLEEPOK, NULL,\t\t\\\n\t\t    \"Sleeping in \\\"%s\\\"\", __func__);\t\t\t\\\n} while (0)\n#else\n#define\tMBUF_CHECKSLEEP(how)\n#endif\n\n/*\n * Network buffer allocation API\n *\n * The rest of it is defined in kern/kern_mbuf.c\n */\n\nextern uma_zone_t\tzone_mbuf;\nextern uma_zone_t\tzone_clust;\nextern uma_zone_t\tzone_pack;\nextern uma_zone_t\tzone_jumbop;\nextern uma_zone_t\tzone_jumbo9;\nextern uma_zone_t\tzone_jumbo16;\nextern uma_zone_t\tzone_ext_refcnt;\n\nstatic __inline struct mbuf\t*m_getcl(int how, short type, int flags);\nstatic __inline struct mbuf\t*m_get(int how, short type);\nstatic __inline struct mbuf\t*m_gethdr(int how, short type);\nstatic __inline struct mbuf\t*m_getjcl(int how, short type, int flags,\n\t\t\t\t    int size);\nstatic __inline struct mbuf\t*m_getclr(int how, short type);\t/* XXX */\nstatic __inline int\t\t m_init(struct mbuf *m, uma_zone_t zone,\n\t\t\t\t    int size, int how, short type, int flags);\nstatic __inline struct mbuf\t*m_free(struct mbuf *m);\nstatic __inline void\t\t m_clget(struct mbuf *m, int how);\nstatic __inline void\t\t*m_cljget(struct mbuf *m, int how, int size);\nstatic __inline void\t\t m_chtype(struct mbuf *m, short new_type);\nvoid\t\t\t\t mb_free_ext(struct mbuf *);\nstatic __inline struct mbuf\t*m_last(struct mbuf *m);\nint\t\t\t\t m_pkthdr_init(struct mbuf *m, int how);\n\nstatic __inline int\nm_gettype(int size)\n{\n\tint type;\n\t\n\tswitch (size) {\n\tcase MSIZE:\n\t\ttype = EXT_MBUF;\n\t\tbreak;\n\tcase MCLBYTES:\n\t\ttype = EXT_CLUSTER;\n\t\tbreak;\n#if MJUMPAGESIZE != MCLBYTES\n\tcase MJUMPAGESIZE:\n\t\ttype = EXT_JUMBOP;\n\t\tbreak;\n#endif\n\tcase MJUM9BYTES:\n\t\ttype = EXT_JUMBO9;\n\t\tbreak;\n\tcase MJUM16BYTES:\n\t\ttype = EXT_JUMBO16;\n\t\tbreak;\n\tdefault:\n\t\tpanic(\"%s: m_getjcl: invalid cluster size\", __func__);\n\t}\n\n\treturn (type);\n}\n\nstatic __inline uma_zone_t\nm_getzone(int size)\n{\n\tuma_zone_t zone;\n\t\n\tswitch (size) {\n\tcase MSIZE:\n\t\tzone = zone_mbuf;\n\t\tbreak;\n\tcase MCLBYTES:\n\t\tzone = zone_clust;\n\t\tbreak;\n#if MJUMPAGESIZE != MCLBYTES\n\tcase MJUMPAGESIZE:\n\t\tzone = zone_jumbop;\n\t\tbreak;\n#endif\n\tcase MJUM9BYTES:\n\t\tzone = zone_jumbo9;\n\t\tbreak;\n\tcase MJUM16BYTES:\n\t\tzone = zone_jumbo16;\n\t\tbreak;\n\tdefault:\n\t\tpanic(\"%s: m_getjcl: invalid cluster type\", __func__);\n\t}\n\n\treturn (zone);\n}\n\n/*\n * Initialize an mbuf with linear storage.\n *\n * Inline because the consumer text overhead will be roughly the same to\n * initialize or call a function with this many parameters and M_PKTHDR\n * should go away with constant propagation for !MGETHDR.\n */\nstatic __inline int\nm_init(struct mbuf *m, uma_zone_t zone, int size, int how, short type,\n    int flags)\n{\n\tint error;\n\n\tm->m_next = NULL;\n\tm->m_nextpkt = NULL;\n\tm->m_data = m->m_dat;\n\tm->m_len = 0;\n\tm->m_flags = flags;\n\tm->m_type = type;\n\tif (flags & M_PKTHDR) {\n\t\tif ((error = m_pkthdr_init(m, how)) != 0)\n\t\t\treturn (error);\n\t}\n\n\treturn (0);\n}\n\nstatic __inline struct mbuf *\nm_get(int how, short type)\n{\n\tstruct mb_args args;\n\n\targs.flags = 0;\n\targs.type = type;\n\treturn ((struct mbuf *)(uma_zalloc_arg(zone_mbuf, &args, how)));\n}\n\n/*\n * XXX This should be deprecated, very little use.\n */\nstatic __inline struct mbuf *\nm_getclr(int how, short type)\n{\n\tstruct mbuf *m;\n\tstruct mb_args args;\n\n\targs.flags = 0;\n\targs.type = type;\n\tm = uma_zalloc_arg(zone_mbuf, &args, how);\n\tif (m != NULL)\n\t\tbzero(m->m_data, MLEN);\n\treturn (m);\n}\n\nstatic __inline struct mbuf *\nm_gethdr(int how, short type)\n{\n\tstruct mb_args args;\n\n\targs.flags = M_PKTHDR;\n\targs.type = type;\n\treturn ((struct mbuf *)(uma_zalloc_arg(zone_mbuf, &args, how)));\n}\n\nstatic __inline struct mbuf *\nm_getcl(int how, short type, int flags)\n{\n\tstruct mb_args args;\n\n\targs.flags = flags;\n\targs.type = type;\n\treturn ((struct mbuf *)(uma_zalloc_arg(zone_pack, &args, how)));\n}\n\n/*\n * m_getjcl() returns an mbuf with a cluster of the specified size attached.\n * For size it takes MCLBYTES, MJUMPAGESIZE, MJUM9BYTES, MJUM16BYTES.\n *\n * XXX: This is rather large, should be real function maybe.\n */\nstatic __inline struct mbuf *\nm_getjcl(int how, short type, int flags, int size)\n{\n\tstruct mb_args args;\n\tstruct mbuf *m, *n;\n\tuma_zone_t zone;\n\n\tif (size == MCLBYTES)\n\t\treturn m_getcl(how, type, flags);\n\n\targs.flags = flags;\n\targs.type = type;\n\n\tm = uma_zalloc_arg(zone_mbuf, &args, how);\n\tif (m == NULL)\n\t\treturn (NULL);\n\n\tzone = m_getzone(size);\n\tn = uma_zalloc_arg(zone, m, how);\n\tif (n == NULL) {\n\t\tuma_zfree(zone_mbuf, m);\n\t\treturn (NULL);\n\t}\n\treturn (m);\n}\n\nstatic __inline void\nm_free_fast(struct mbuf *m)\n{\n#ifdef INVARIANTS\n\tif (m->m_flags & M_PKTHDR)\n\t\tKASSERT(SLIST_EMPTY(&m->m_pkthdr.tags), (\"doing fast free of mbuf with tags\"));\n#endif\n\t\n\tuma_zfree_arg(zone_mbuf, m, (void *)MB_NOTAGS);\n}\n\nstatic __inline struct mbuf *\nm_free(struct mbuf *m)\n{\n\tstruct mbuf *n = m->m_next;\n\n\tif (m->m_flags & M_EXT)\n\t\tmb_free_ext(m);\n\telse if ((m->m_flags & M_NOFREE) == 0)\n\t\tuma_zfree(zone_mbuf, m);\n\treturn (n);\n}\n\nstatic __inline void\nm_clget(struct mbuf *m, int how)\n{\n\n\tif (m->m_flags & M_EXT)\n\t\tprintf(\"%s: %p mbuf already has cluster\\n\", __func__, m);\n\tm->m_ext.ext_buf = (char *)NULL;\n\tuma_zalloc_arg(zone_clust, m, how);\n\t/*\n\t * On a cluster allocation failure, drain the packet zone and retry,\n\t * we might be able to loosen a few clusters up on the drain.\n\t */\n\tif ((how & M_NOWAIT) && (m->m_ext.ext_buf == NULL)) {\n\t\tzone_drain(zone_pack);\n\t\tuma_zalloc_arg(zone_clust, m, how);\n\t}\n}\n\n/*\n * m_cljget() is different from m_clget() as it can allocate clusters without\n * attaching them to an mbuf.  In that case the return value is the pointer\n * to the cluster of the requested size.  If an mbuf was specified, it gets\n * the cluster attached to it and the return value can be safely ignored.\n * For size it takes MCLBYTES, MJUMPAGESIZE, MJUM9BYTES, MJUM16BYTES.\n */\nstatic __inline void *\nm_cljget(struct mbuf *m, int how, int size)\n{\n\tuma_zone_t zone;\n\n\tif (m && m->m_flags & M_EXT)\n\t\tprintf(\"%s: %p mbuf already has cluster\\n\", __func__, m);\n\tif (m != NULL)\n\t\tm->m_ext.ext_buf = NULL;\n\n\tzone = m_getzone(size);\n\treturn (uma_zalloc_arg(zone, m, how));\n}\n\nstatic __inline void\nm_cljset(struct mbuf *m, void *cl, int type)\n{\n\tuma_zone_t zone;\n\tint size;\n\t\n\tswitch (type) {\n\tcase EXT_CLUSTER:\n\t\tsize = MCLBYTES;\n\t\tzone = zone_clust;\n\t\tbreak;\n#if MJUMPAGESIZE != MCLBYTES\n\tcase EXT_JUMBOP:\n\t\tsize = MJUMPAGESIZE;\n\t\tzone = zone_jumbop;\n\t\tbreak;\n#endif\n\tcase EXT_JUMBO9:\n\t\tsize = MJUM9BYTES;\n\t\tzone = zone_jumbo9;\n\t\tbreak;\n\tcase EXT_JUMBO16:\n\t\tsize = MJUM16BYTES;\n\t\tzone = zone_jumbo16;\n\t\tbreak;\n\tdefault:\n\t\tpanic(\"unknown cluster type\");\n\t\tbreak;\n\t}\n\n\tm->m_data = m->m_ext.ext_buf = cl;\n\tm->m_ext.ext_free = m->m_ext.ext_arg1 = m->m_ext.ext_arg2 = NULL;\n\tm->m_ext.ext_size = size;\n\tm->m_ext.ext_type = type;\n\tm->m_ext.ref_cnt = uma_find_refcnt(zone, cl);\n\tm->m_flags |= M_EXT;\n\n}\n\nstatic __inline void\nm_chtype(struct mbuf *m, short new_type)\n{\n\n\tm->m_type = new_type;\n}\n\nstatic __inline struct mbuf *\nm_last(struct mbuf *m)\n{\n\n\twhile (m->m_next)\n\t\tm = m->m_next;\n\treturn (m);\n}\n\nextern void (*m_addr_chg_pf_p)(struct mbuf *m);\n\nstatic __inline void \nm_addr_changed(struct mbuf *m)\n{\n\n\tif (m_addr_chg_pf_p)\n\t\tm_addr_chg_pf_p(m);\n}\n\n/*\n * mbuf, cluster, and external object allocation macros (for compatibility\n * purposes).\n */\n#define\tM_MOVE_PKTHDR(to, from)\tm_move_pkthdr((to), (from))\n#define\tMGET(m, how, type)\t((m) = m_get((how), (type)))\n#define\tMGETHDR(m, how, type)\t((m) = m_gethdr((how), (type)))\n#define\tMCLGET(m, how)\t\tm_clget((m), (how))\n#define\tMEXTADD(m, buf, size, free, arg1, arg2, flags, type)\t\t\\\n    m_extadd((m), (caddr_t)(buf), (size), (free),(arg1),(arg2),(flags), (type))\n#define\tm_getm(m, len, how, type)\t\t\t\t\t\\\n    m_getm2((m), (len), (how), (type), M_PKTHDR)\n\n/*\n * Evaluate TRUE if it's safe to write to the mbuf m's data region (this can\n * be both the local data payload, or an external buffer area, depending on\n * whether M_EXT is set).\n */\n#define\tM_WRITABLE(m)\t(!((m)->m_flags & M_RDONLY) &&\t\t\t\\\n\t\t\t (!(((m)->m_flags & M_EXT)) ||\t\t\t\\\n\t\t\t (*((m)->m_ext.ref_cnt) == 1)) )\t\t\\\n\n/* Check if the supplied mbuf has a packet header, or else panic. */\n#define\tM_ASSERTPKTHDR(m)\t\t\t\t\t\t\\\n\tKASSERT((m) != NULL && (m)->m_flags & M_PKTHDR,\t\t\t\\\n\t    (\"%s: no mbuf packet header!\", __func__))\n\n/*\n * Ensure that the supplied mbuf is a valid, non-free mbuf.\n *\n * XXX: Broken at the moment.  Need some UMA magic to make it work again.\n */\n#define\tM_ASSERTVALID(m)\t\t\t\t\t\t\\\n\tKASSERT((((struct mbuf *)m)->m_flags & 0) == 0,\t\t\t\\\n\t    (\"%s: attempted use of a free mbuf!\", __func__))\n\n/*\n * Set the m_data pointer of a newly-allocated mbuf (m_get/MGET) to place an\n * object of the specified size at the end of the mbuf, longword aligned.\n */\n#define\tM_ALIGN(m, len) do {\t\t\t\t\t\t\\\n\tKASSERT(!((m)->m_flags & (M_PKTHDR|M_EXT)),\t\t\t\\\n\t\t(\"%s: M_ALIGN not normal mbuf\", __func__));\t\t\\\n\tKASSERT((m)->m_data == (m)->m_dat,\t\t\t\t\\\n\t\t(\"%s: M_ALIGN not a virgin mbuf\", __func__));\t\t\\\n\t(m)->m_data += (MLEN - (len)) & ~(sizeof(long) - 1);\t\t\\\n} while (0)\n\n/*\n * As above, for mbufs allocated with m_gethdr/MGETHDR or initialized by\n * M_DUP/MOVE_PKTHDR.\n */\n#define\tMH_ALIGN(m, len) do {\t\t\t\t\t\t\\\n\tKASSERT((m)->m_flags & M_PKTHDR && !((m)->m_flags & M_EXT),\t\\\n\t\t(\"%s: MH_ALIGN not PKTHDR mbuf\", __func__));\t\t\\\n\tKASSERT((m)->m_data == (m)->m_pktdat,\t\t\t\t\\\n\t\t(\"%s: MH_ALIGN not a virgin mbuf\", __func__));\t\t\\\n\t(m)->m_data += (MHLEN - (len)) & ~(sizeof(long) - 1);\t\t\\\n} while (0)\n\n/*\n * Compute the amount of space available before the current start of data in\n * an mbuf.\n *\n * The M_WRITABLE() is a temporary, conservative safety measure: the burden\n * of checking writability of the mbuf data area rests solely with the caller.\n */\n#define\tM_LEADINGSPACE(m)\t\t\t\t\t\t\\\n\t((m)->m_flags & M_EXT ?\t\t\t\t\t\t\\\n\t    (M_WRITABLE(m) ? (m)->m_data - (m)->m_ext.ext_buf : 0):\t\\\n\t    (m)->m_flags & M_PKTHDR ? (m)->m_data - (m)->m_pktdat :\t\\\n\t    (m)->m_data - (m)->m_dat)\n\n/*\n * Compute the amount of space available after the end of data in an mbuf.\n *\n * The M_WRITABLE() is a temporary, conservative safety measure: the burden\n * of checking writability of the mbuf data area rests solely with the caller.\n */\n#define\tM_TRAILINGSPACE(m)\t\t\t\t\t\t\\\n\t((m)->m_flags & M_EXT ?\t\t\t\t\t\t\\\n\t    (M_WRITABLE(m) ? (m)->m_ext.ext_buf + (m)->m_ext.ext_size\t\\\n\t\t- ((m)->m_data + (m)->m_len) : 0) :\t\t\t\\\n\t    &(m)->m_dat[MLEN] - ((m)->m_data + (m)->m_len))\n\n/*\n * Arrange to prepend space of size plen to mbuf m.  If a new mbuf must be\n * allocated, how specifies whether to wait.  If the allocation fails, the\n * original mbuf chain is freed and m is set to NULL.\n */\n#define\tM_PREPEND(m, plen, how) do {\t\t\t\t\t\\\n\tstruct mbuf **_mmp = &(m);\t\t\t\t\t\\\n\tstruct mbuf *_mm = *_mmp;\t\t\t\t\t\\\n\tint _mplen = (plen);\t\t\t\t\t\t\\\n\tint __mhow = (how);\t\t\t\t\t\t\\\n\t\t\t\t\t\t\t\t\t\\\n\tMBUF_CHECKSLEEP(how);\t\t\t\t\t\t\\\n\tif (M_LEADINGSPACE(_mm) >= _mplen) {\t\t\t\t\\\n\t\t_mm->m_data -= _mplen;\t\t\t\t\t\\\n\t\t_mm->m_len += _mplen;\t\t\t\t\t\\\n\t} else\t\t\t\t\t\t\t\t\\\n\t\t_mm = m_prepend(_mm, _mplen, __mhow);\t\t\t\\\n\tif (_mm != NULL && _mm->m_flags & M_PKTHDR)\t\t\t\\\n\t\t_mm->m_pkthdr.len += _mplen;\t\t\t\t\\\n\t*_mmp = _mm;\t\t\t\t\t\t\t\\\n} while (0)\n\n/*\n * Change mbuf to new type.  This is a relatively expensive operation and\n * should be avoided.\n */\n#define\tMCHTYPE(m, t)\tm_chtype((m), (t))\n\n/* Length to m_copy to copy all. */\n#define\tM_COPYALL\t1000000000\n\n/* Compatibility with 4.3. */\n#define\tm_copy(m, o, l)\tm_copym((m), (o), (l), M_DONTWAIT)\n\nextern int\t\tmax_datalen;\t/* MHLEN - max_hdr */\nextern int\t\tmax_hdr;\t/* Largest link + protocol header */\nextern int\t\tmax_linkhdr;\t/* Largest link-level header */\nextern int\t\tmax_protohdr;\t/* Largest protocol header */\nextern struct mbstat\tmbstat;\t\t/* General mbuf stats/infos */\nextern int\t\tnmbclusters;\t/* Maximum number of clusters */\n\nstruct uio;\n\nvoid\t\t m_adj(struct mbuf *, int);\nvoid\t\t m_align(struct mbuf *, int);\nint\t\t m_apply(struct mbuf *, int, int,\n\t\t    int (*)(void *, void *, u_int), void *);\nint\t\t m_append(struct mbuf *, int, c_caddr_t);\nvoid\t\t m_cat(struct mbuf *, struct mbuf *);\nvoid\t\t m_extadd(struct mbuf *, caddr_t, u_int,\n\t\t    void (*)(void *, void *), void *, void *, int, int);\nstruct mbuf\t*m_collapse(struct mbuf *, int, int);\nvoid\t\t m_copyback(struct mbuf *, int, int, c_caddr_t);\nvoid\t\t m_copydata(const struct mbuf *, int, int, caddr_t);\nstruct mbuf\t*m_copym(struct mbuf *, int, int, int);\nstruct mbuf\t*m_copymdata(struct mbuf *, struct mbuf *,\n\t\t    int, int, int, int);\nstruct mbuf\t*m_copypacket(struct mbuf *, int);\nvoid\t\t m_copy_pkthdr(struct mbuf *, struct mbuf *);\nstruct mbuf\t*m_copyup(struct mbuf *n, int len, int dstoff);\nstruct mbuf\t*m_defrag(struct mbuf *, int);\nvoid\t\t m_demote(struct mbuf *, int);\nstruct mbuf\t*m_devget(char *, int, int, struct ifnet *,\n\t\t    void (*)(char *, caddr_t, u_int));\nstruct mbuf\t*m_dup(struct mbuf *, int);\nint\t\t m_dup_pkthdr(struct mbuf *, struct mbuf *, int);\nu_int\t\t m_fixhdr(struct mbuf *);\nstruct mbuf\t*m_fragment(struct mbuf *, int, int);\nvoid\t\t m_freem(struct mbuf *);\nstruct mbuf\t*m_getm2(struct mbuf *, int, int, short, int);\nstruct mbuf\t*m_getptr(struct mbuf *, int, int *);\nu_int\t\t m_length(struct mbuf *, struct mbuf **);\nint\t\t m_mbuftouio(struct uio *, struct mbuf *, int);\nvoid\t\t m_move_pkthdr(struct mbuf *, struct mbuf *);\nstruct mbuf\t*m_prepend(struct mbuf *, int, int);\nvoid\t\t m_print(const struct mbuf *, int);\nstruct mbuf\t*m_pulldown(struct mbuf *, int, int, int *);\nstruct mbuf\t*m_pullup(struct mbuf *, int);\nint\t\tm_sanity(struct mbuf *, int);\nstruct mbuf\t*m_split(struct mbuf *, int, int);\nstruct mbuf\t*m_uiotombuf(struct uio *, int, int, int, int);\nstruct mbuf\t*m_unshare(struct mbuf *, int how);\n\n/*-\n * Network packets may have annotations attached by affixing a list of\n * \"packet tags\" to the pkthdr structure.  Packet tags are dynamically\n * allocated semi-opaque data structures that have a fixed header\n * (struct m_tag) that specifies the size of the memory block and a\n * <cookie,type> pair that identifies it.  The cookie is a 32-bit unique\n * unsigned value used to identify a module or ABI.  By convention this value\n * is chosen as the date+time that the module is created, expressed as the\n * number of seconds since the epoch (e.g., using date -u +'%s').  The type\n * value is an ABI/module-specific value that identifies a particular\n * annotation and is private to the module.  For compatibility with systems\n * like OpenBSD that define packet tags w/o an ABI/module cookie, the value\n * PACKET_ABI_COMPAT is used to implement m_tag_get and m_tag_find\n * compatibility shim functions and several tag types are defined below.\n * Users that do not require compatibility should use a private cookie value\n * so that packet tag-related definitions can be maintained privately.\n *\n * Note that the packet tag returned by m_tag_alloc has the default memory\n * alignment implemented by malloc.  To reference private data one can use a\n * construct like:\n *\n *\tstruct m_tag *mtag = m_tag_alloc(...);\n *\tstruct foo *p = (struct foo *)(mtag+1);\n *\n * if the alignment of struct m_tag is sufficient for referencing members of\n * struct foo.  Otherwise it is necessary to embed struct m_tag within the\n * private data structure to insure proper alignment; e.g.,\n *\n *\tstruct foo {\n *\t\tstruct m_tag\ttag;\n *\t\t...\n *\t};\n *\tstruct foo *p = (struct foo *) m_tag_alloc(...);\n *\tstruct m_tag *mtag = &p->tag;\n */\n\n/*\n * Persistent tags stay with an mbuf until the mbuf is reclaimed.  Otherwise\n * tags are expected to ``vanish'' when they pass through a network\n * interface.  For most interfaces this happens normally as the tags are\n * reclaimed when the mbuf is free'd.  However in some special cases\n * reclaiming must be done manually.  An example is packets that pass through\n * the loopback interface.  Also, one must be careful to do this when\n * ``turning around'' packets (e.g., icmp_reflect).\n *\n * To mark a tag persistent bit-or this flag in when defining the tag id.\n * The tag will then be treated as described above.\n */\n#define\tMTAG_PERSISTENT\t\t\t\t0x800\n\n#define\tPACKET_TAG_NONE\t\t\t\t0  /* Nadda */\n\n/* Packet tags for use with PACKET_ABI_COMPAT. */\n#define\tPACKET_TAG_IPSEC_IN_DONE\t\t1  /* IPsec applied, in */\n#define\tPACKET_TAG_IPSEC_OUT_DONE\t\t2  /* IPsec applied, out */\n#define\tPACKET_TAG_IPSEC_IN_CRYPTO_DONE\t\t3  /* NIC IPsec crypto done */\n#define\tPACKET_TAG_IPSEC_OUT_CRYPTO_NEEDED\t4  /* NIC IPsec crypto req'ed */\n#define\tPACKET_TAG_IPSEC_IN_COULD_DO_CRYPTO\t5  /* NIC notifies IPsec */\n#define\tPACKET_TAG_IPSEC_PENDING_TDB\t\t6  /* Reminder to do IPsec */\n#define\tPACKET_TAG_BRIDGE\t\t\t7  /* Bridge processing done */\n#define\tPACKET_TAG_GIF\t\t\t\t8  /* GIF processing done */\n#define\tPACKET_TAG_GRE\t\t\t\t9  /* GRE processing done */\n#define\tPACKET_TAG_IN_PACKET_CHECKSUM\t\t10 /* NIC checksumming done */\n#define\tPACKET_TAG_ENCAP\t\t\t11 /* Encap.  processing */\n#define\tPACKET_TAG_IPSEC_SOCKET\t\t\t12 /* IPSEC socket ref */\n#define\tPACKET_TAG_IPSEC_HISTORY\t\t13 /* IPSEC history */\n#define\tPACKET_TAG_IPV6_INPUT\t\t\t14 /* IPV6 input processing */\n#define\tPACKET_TAG_DUMMYNET\t\t\t15 /* dummynet info */\n#define\tPACKET_TAG_DIVERT\t\t\t17 /* divert info */\n#define\tPACKET_TAG_IPFORWARD\t\t\t18 /* ipforward info */\n#define\tPACKET_TAG_MACLABEL\t(19 | MTAG_PERSISTENT) /* MAC label */\n#define\tPACKET_TAG_PF\t\t\t\t21 /* PF + ALTQ information */\n#define\tPACKET_TAG_RTSOCKFAM\t\t\t25 /* rtsock sa family */\n#define\tPACKET_TAG_IPOPTIONS\t\t\t27 /* Saved IP options */\n#define\tPACKET_TAG_CARP\t\t\t\t28 /* CARP info */\n#define\tPACKET_TAG_IPSEC_NAT_T_PORTS\t\t29 /* two uint16_t */\n#define\tPACKET_TAG_ND_OUTGOING\t\t\t30 /* ND outgoing */\n\n/* Specific cookies and tags. */\n\n/* Packet tag routines. */\nstruct m_tag\t*m_tag_alloc(u_int32_t, int, int, int);\nvoid\t\t m_tag_delete(struct mbuf *, struct m_tag *);\nvoid\t\t m_tag_delete_chain(struct mbuf *, struct m_tag *);\nvoid\t\t m_tag_free_default(struct m_tag *);\nstruct m_tag\t*m_tag_locate(struct mbuf *, u_int32_t, int, struct m_tag *);\nstruct m_tag\t*m_tag_copy(struct m_tag *, int);\nint\t\t m_tag_copy_chain(struct mbuf *, struct mbuf *, int);\nvoid\t\t m_tag_delete_nonpersistent(struct mbuf *);\n\n/*\n * Initialize the list of tags associated with an mbuf.\n */\nstatic __inline void\nm_tag_init(struct mbuf *m)\n{\n\n\tSLIST_INIT(&m->m_pkthdr.tags);\n}\n\n/*\n * Set up the contents of a tag.  Note that this does not fill in the free\n * method; the caller is expected to do that.\n *\n * XXX probably should be called m_tag_init, but that was already taken.\n */\nstatic __inline void\nm_tag_setup(struct m_tag *t, u_int32_t cookie, int type, int len)\n{\n\n\tt->m_tag_id = type;\n\tt->m_tag_len = len;\n\tt->m_tag_cookie = cookie;\n}\n\n/*\n * Reclaim resources associated with a tag.\n */\nstatic __inline void\nm_tag_free(struct m_tag *t)\n{\n\n\t(*t->m_tag_free)(t);\n}\n\n/*\n * Return the first tag associated with an mbuf.\n */\nstatic __inline struct m_tag *\nm_tag_first(struct mbuf *m)\n{\n\n\treturn (SLIST_FIRST(&m->m_pkthdr.tags));\n}\n\n/*\n * Return the next tag in the list of tags associated with an mbuf.\n */\nstatic __inline struct m_tag *\nm_tag_next(struct mbuf *m, struct m_tag *t)\n{\n\n\treturn (SLIST_NEXT(t, m_tag_link));\n}\n\n/*\n * Prepend a tag to the list of tags associated with an mbuf.\n */\nstatic __inline void\nm_tag_prepend(struct mbuf *m, struct m_tag *t)\n{\n\n\tSLIST_INSERT_HEAD(&m->m_pkthdr.tags, t, m_tag_link);\n}\n\n/*\n * Unlink a tag from the list of tags associated with an mbuf.\n */\nstatic __inline void\nm_tag_unlink(struct mbuf *m, struct m_tag *t)\n{\n\n\tSLIST_REMOVE(&m->m_pkthdr.tags, t, m_tag, m_tag_link);\n}\n\n/* These are for OpenBSD compatibility. */\n#define\tMTAG_ABI_COMPAT\t\t0\t\t/* compatibility ABI */\n\nstatic __inline struct m_tag *\nm_tag_get(int type, int length, int wait)\n{\n\treturn (m_tag_alloc(MTAG_ABI_COMPAT, type, length, wait));\n}\n\nstatic __inline struct m_tag *\nm_tag_find(struct mbuf *m, int type, struct m_tag *start)\n{\n\treturn (SLIST_EMPTY(&m->m_pkthdr.tags) ? (struct m_tag *)NULL :\n\t    m_tag_locate(m, MTAG_ABI_COMPAT, type, start));\n}\n\n/* XXX temporary FIB methods probably eventually use tags.*/\n#define M_FIBSHIFT    28\n#define M_FIBMASK\t0x0F\n\n/* get the fib from an mbuf and if it is not set, return the default */\n#define M_GETFIB(_m) \\\n    ((((_m)->m_flags & M_FIB) >> M_FIBSHIFT) & M_FIBMASK)\n\n#define M_SETFIB(_m, _fib) do {\t\t\t\t\t\t\\\n\t_m->m_flags &= ~M_FIB;\t\t\t\t\t   \t\\\n\t_m->m_flags |= (((_fib) << M_FIBSHIFT) & M_FIB);  \\\n} while (0) \n\n#endif /* _KERNEL */\n\n#ifdef MBUF_PROFILING\n void m_profile(struct mbuf *m);\n #define M_PROFILE(m) m_profile(m)\n#else\n #define M_PROFILE(m)\n#endif\n\n\n#endif /* !_SYS_MBUF_H_ */\n"
  },
  {
    "path": "freebsd-headers/sys/mchain.h",
    "content": "/*-\n * Copyright (c) 2000, 2001 Boris Popov\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/sys/mchain.h 206361 2010-04-07 16:50:38Z joel $\n */\n#ifndef _SYS_MCHAIN_H_\n#define _SYS_MCHAIN_H_\n\n#ifdef _KERNEL\n\n/*\n * Type of copy for mb_{put|get}_mem()\n */\n#define\tMB_MSYSTEM\t0\t\t/* use bcopy() */\n#define\tMB_MUSER\t1\t\t/* use copyin()/copyout() */\n#define\tMB_MINLINE\t2\t\t/* use an inline copy loop */\n#define\tMB_MZERO\t3\t\t/* bzero(), mb_put_mem only */\n#define\tMB_MCUSTOM\t4\t\t/* use an user defined function */\n\nstruct mbuf;\nstruct mbchain;\n\ntypedef int mb_copy_t(struct mbchain *mbp, c_caddr_t src, caddr_t dst,\n    size_t *srclen, size_t *dstlen);\n\nstruct mbchain {\n\tstruct mbuf *\tmb_top;\t\t/* head of mbufs chain */\n\tstruct mbuf * \tmb_cur;\t\t/* current mbuf */\n\tint\t\tmb_mleft;\t/* free space in the current mbuf */\n\tint\t\tmb_count;\t/* total number of bytes */\n\tmb_copy_t *\tmb_copy;\t/* user defined copy function */\n\tvoid *\t\tmb_udata;\t/* user data */\n};\n\nstruct mdchain {\n\tstruct mbuf *\tmd_top;\t\t/* head of mbufs chain */\n\tstruct mbuf * \tmd_cur;\t\t/* current mbuf */\n\tu_char *\tmd_pos;\t\t/* offset in the current mbuf */\n};\n\nint  mb_init(struct mbchain *mbp);\nvoid mb_initm(struct mbchain *mbp, struct mbuf *m);\nvoid mb_done(struct mbchain *mbp);\nstruct mbuf *mb_detach(struct mbchain *mbp);\nint  mb_fixhdr(struct mbchain *mbp);\ncaddr_t mb_reserve(struct mbchain *mbp, int size);\n\nint  mb_put_uint8(struct mbchain *mbp, u_int8_t x);\nint  mb_put_uint16be(struct mbchain *mbp, u_int16_t x);\nint  mb_put_uint16le(struct mbchain *mbp, u_int16_t x);\nint  mb_put_uint32be(struct mbchain *mbp, u_int32_t x);\nint  mb_put_uint32le(struct mbchain *mbp, u_int32_t x);\nint  mb_put_int64be(struct mbchain *mbp, int64_t x);\nint  mb_put_int64le(struct mbchain *mbp, int64_t x);\nint  mb_put_mem(struct mbchain *mbp, c_caddr_t source, int size, int type);\nint  mb_put_mbuf(struct mbchain *mbp, struct mbuf *m);\nint  mb_put_uio(struct mbchain *mbp, struct uio *uiop, int size);\n\nint  md_init(struct mdchain *mdp);\nvoid md_initm(struct mdchain *mbp, struct mbuf *m);\nvoid md_done(struct mdchain *mdp);\nvoid md_append_record(struct mdchain *mdp, struct mbuf *top);\nint  md_next_record(struct mdchain *mdp);\nint  md_get_uint8(struct mdchain *mdp, u_int8_t *x);\nint  md_get_uint16(struct mdchain *mdp, u_int16_t *x);\nint  md_get_uint16le(struct mdchain *mdp, u_int16_t *x);\nint  md_get_uint16be(struct mdchain *mdp, u_int16_t *x);\nint  md_get_uint32(struct mdchain *mdp, u_int32_t *x);\nint  md_get_uint32be(struct mdchain *mdp, u_int32_t *x);\nint  md_get_uint32le(struct mdchain *mdp, u_int32_t *x);\nint  md_get_int64(struct mdchain *mdp, int64_t *x);\nint  md_get_int64be(struct mdchain *mdp, int64_t *x);\nint  md_get_int64le(struct mdchain *mdp, int64_t *x);\nint  md_get_mem(struct mdchain *mdp, caddr_t target, int size, int type);\nint  md_get_mbuf(struct mdchain *mdp, int size, struct mbuf **m);\nint  md_get_uio(struct mdchain *mdp, struct uio *uiop, int size);\n\n#endif\t/* ifdef _KERNEL */\n\n#endif\t/* !_SYS_MCHAIN_H_ */\n"
  },
  {
    "path": "freebsd-headers/sys/md4.h",
    "content": "/* MD4.H - header file for MD4C.C\n * $FreeBSD: release/9.0.0/sys/sys/md4.h 139825 2005-01-07 02:29:27Z imp $\n */\n\n/*-\n   Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All\n   rights reserved.\n\n   License to copy and use this software is granted provided that it\n   is identified as the \"RSA Data Security, Inc. MD4 Message-Digest\n   Algorithm\" in all material mentioning or referencing this software\n   or this function.\n   License is also granted to make and use derivative works provided\n   that such works are identified as \"derived from the RSA Data\n   Security, Inc. MD4 Message-Digest Algorithm\" in all material\n   mentioning or referencing the derived work.\n\n   RSA Data Security, Inc. makes no representations concerning either\n   the merchantability of this software or the suitability of this\n   software for any particular purpose. It is provided \"as is\"\n   without express or implied warranty of any kind.\n\n   These notices must be retained in any copies of any part of this\n   documentation and/or software.\n */\n\n#ifndef _MD4_H_\n#define _MD4_H_\n/* MD4 context. */\ntypedef struct MD4Context {\n  u_int32_t state[4];\t/* state (ABCD) */\n  u_int32_t count[2];\t/* number of bits, modulo 2^64 (lsb first) */\n  unsigned char buffer[64];\t/* input buffer */\n} MD4_CTX;\n\n#include <sys/cdefs.h>\n\n__BEGIN_DECLS\nvoid   MD4Init(MD4_CTX *);\nvoid   MD4Update(MD4_CTX *, const unsigned char *, unsigned int);\nvoid   MD4Pad(MD4_CTX *);\nvoid   MD4Final(unsigned char [16], MD4_CTX *);\nchar * MD4End(MD4_CTX *, char *);\nchar * MD4File(const char *, char *);\nchar * MD4Data(const unsigned char *, unsigned int, char *);\n__END_DECLS\n\n#endif /* _MD4_H_ */\n"
  },
  {
    "path": "freebsd-headers/sys/md5.h",
    "content": "/* MD5.H - header file for MD5C.C\n * $FreeBSD: release/9.0.0/sys/sys/md5.h 156752 2006-03-15 19:47:12Z andre $\n */\n\n/*-\n Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All\nrights reserved.\n\nLicense to copy and use this software is granted provided that it\nis identified as the \"RSA Data Security, Inc. MD5 Message-Digest\nAlgorithm\" in all material mentioning or referencing this software\nor this function.\n\nLicense is also granted to make and use derivative works provided\nthat such works are identified as \"derived from the RSA Data\nSecurity, Inc. MD5 Message-Digest Algorithm\" in all material\nmentioning or referencing the derived work.\n\nRSA Data Security, Inc. makes no representations concerning either\nthe merchantability of this software or the suitability of this\nsoftware for any particular purpose. It is provided \"as is\"\nwithout express or implied warranty of any kind.\n\nThese notices must be retained in any copies of any part of this\ndocumentation and/or software.\n */\n\n#ifndef _SYS_MD5_H_\n#define _SYS_MD5_H_\n\n#define MD5_BLOCK_LENGTH\t\t64\n#define MD5_DIGEST_LENGTH\t\t16\n#define MD5_DIGEST_STRING_LENGTH\t(MD5_DIGEST_LENGTH * 2 + 1)\n\n/* MD5 context. */\ntypedef struct MD5Context {\n  u_int32_t state[4];\t/* state (ABCD) */\n  u_int32_t count[2];\t/* number of bits, modulo 2^64 (lsb first) */\n  unsigned char buffer[64];\t/* input buffer */\n} MD5_CTX;\n\n#include <sys/cdefs.h>\n\n__BEGIN_DECLS\nvoid   MD5Init (MD5_CTX *);\nvoid   MD5Update (MD5_CTX *, const void *, unsigned int);\nvoid   MD5Final (unsigned char [16], MD5_CTX *);\nchar * MD5End(MD5_CTX *, char *);\nchar * MD5File(const char *, char *);\nchar * MD5FileChunk(const char *, char *, off_t, off_t);\nchar * MD5Data(const void *, unsigned int, char *);\n__END_DECLS\n#endif /* _SYS_MD5_H_ */\n"
  },
  {
    "path": "freebsd-headers/sys/mdioctl.h",
    "content": "/*-\n * Copyright (c) 1988 University of Utah.\n * Copyright (c) 1990, 1993\n *\tThe Regents of the University of California.  All rights reserved.\n *\n * This code is derived from software contributed to Berkeley by\n * the Systems Programming Group of the University of Utah Computer\n * Science Department.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 4. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * from: Utah $Hdr: fdioctl.h 1.1 90/07/09$\n *\n *\t@(#)vnioctl.h\t8.1 (Berkeley) 6/10/93\n *\n * From: src/sys/sys/vnioctl.h,v 1.4\n *\n * $FreeBSD: release/9.0.0/sys/sys/mdioctl.h 152309 2005-11-11 11:31:23Z pjd $\n */\n\n#ifndef _SYS_MDIOCTL_H_\n#define _SYS_MDIOCTL_H_\n\nenum md_types {MD_MALLOC, MD_PRELOAD, MD_VNODE, MD_SWAP};\n\n/*\n * Ioctl definitions for memory disk pseudo-device.\n */\n\n#define MDNPAD\t\t97\nstruct md_ioctl {\n\tunsigned\tmd_version;\t/* Structure layout version */\n\tunsigned\tmd_unit;\t/* unit number */\n\tenum md_types\tmd_type ;\t/* type of disk */\n\tchar\t\t*md_file;\t/* pathname of file to mount */\n\toff_t\t\tmd_mediasize;\t/* size of disk in bytes */\n\tunsigned\tmd_sectorsize;\t/* sectorsize */\n\tunsigned\tmd_options;\t/* options */\n\tu_int64_t\tmd_base;\t/* base address */\n\tint\t\tmd_fwheads;\t/* firmware heads */\n\tint\t\tmd_fwsectors;\t/* firmware sectors */\n\tint\t\tmd_pad[MDNPAD];\t/* padding for future ideas */\n};\n\n#define MD_NAME\t\t\"md\"\n#define MDCTL_NAME\t\"mdctl\"\n#define MDIOVERSION\t0\n\n/*\n * Before you can use a unit, it must be configured with MDIOCSET.\n * The configuration persists across opens and closes of the device;\n * an MDIOCCLR must be used to reset a configuration.  An attempt to\n * MDIOCSET an already active unit will return EBUSY.\n */\n\n#define MDIOCATTACH\t_IOWR('m', 0, struct md_ioctl)\t/* attach disk */\n#define MDIOCDETACH\t_IOWR('m', 1, struct md_ioctl)\t/* detach disk */\n#define MDIOCQUERY\t_IOWR('m', 2, struct md_ioctl)\t/* query status */\n#define MDIOCLIST\t_IOWR('m', 3, struct md_ioctl)\t/* query status */\n\n#define MD_CLUSTER\t0x01\t/* Don't cluster */\n#define MD_RESERVE\t0x02\t/* Pre-reserve swap */\n#define MD_AUTOUNIT\t0x04\t/* Assign next free unit */\n#define MD_READONLY\t0x08\t/* Readonly mode */\n#define MD_COMPRESS\t0x10\t/* Compression mode */\n#define MD_FORCE\t0x20\t/* Don't try to prevent foot-shooting */\n#define MD_ASYNC\t0x40\t/* Don't try to prevent foot-shooting */\n\n#endif\t/* _SYS_MDIOCTL_H_*/\n"
  },
  {
    "path": "freebsd-headers/sys/memrange.h",
    "content": "/*\n * Memory range attribute operations, peformed on /dev/mem\n *\n * $FreeBSD: release/9.0.0/sys/sys/memrange.h 217515 2011-01-17 22:58:28Z jkim $\n */\n\n#ifndef _SYS_MEMRANGE_H_\n#define\t_SYS_MEMRANGE_H_\n\n/* Memory range attributes */\n#define MDF_UNCACHEABLE\t\t(1<<0)\t/* region not cached */\n#define MDF_WRITECOMBINE\t(1<<1)\t/* region supports \"write combine\" action */\n#define MDF_WRITETHROUGH\t(1<<2)\t/* write-through cached */\n#define MDF_WRITEBACK\t\t(1<<3)\t/* write-back cached */\n#define MDF_WRITEPROTECT\t(1<<4)\t/* read-only region */\n#define MDF_UNKNOWN\t\t(1<<5)\t/* any state we don't understand */\n#define MDF_ATTRMASK\t\t(0x00ffffff)\n\n#define MDF_FIXBASE\t\t(1<<24)\t/* fixed base */\n#define MDF_FIXLEN\t\t(1<<25)\t/* fixed length */\n#define MDF_FIRMWARE\t\t(1<<26)\t/* set by firmware (XXX not useful?) */\n#define MDF_ACTIVE\t\t(1<<27)\t/* currently active */\n#define MDF_BOGUS\t\t(1<<28)\t/* we don't like it */\n#define MDF_FIXACTIVE\t\t(1<<29)\t/* can't be turned off */\n#define MDF_BUSY\t\t(1<<30)\t/* range is in use */\n#define MDF_FORCE\t\t(1<<31)\t/* force risky changes */\n\nstruct mem_range_desc\n{\n\tu_int64_t\tmr_base;\n\tu_int64_t\tmr_len;\n\tint\t\tmr_flags;\n\tchar\t\tmr_owner[8];\n};\n\nstruct mem_range_op\n{\n\tstruct mem_range_desc\t*mo_desc;\n\tint\t\t\tmo_arg[2];\n#define MEMRANGE_SET_UPDATE\t0\n#define MEMRANGE_SET_REMOVE\t1\n\t/* XXX want a flag that says \"set and undo when I exit\" */\n};\n\n#define MEMRANGE_GET\t_IOWR('m', 50, struct mem_range_op)\n#define MEMRANGE_SET\t_IOW('m', 51, struct mem_range_op)\n\n#ifdef _KERNEL\n\nMALLOC_DECLARE(M_MEMDESC);\n\nstruct mem_range_softc;\nstruct mem_range_ops\n{\n\tvoid\t(*init)(struct mem_range_softc *sc);\n\tint\t(*set)(struct mem_range_softc *sc, struct mem_range_desc *mrd, int *arg);\n    \tvoid\t(*initAP)(struct mem_range_softc *sc);\n    \tvoid\t(*reinit)(struct mem_range_softc *sc);\n};\n\nstruct mem_range_softc \n{\n\tstruct mem_range_ops\t*mr_op;\n\tint\t\t\tmr_cap;\n\tint\t\t\tmr_ndesc;\n\tstruct mem_range_desc \t*mr_desc;\n};\n\nextern struct mem_range_softc mem_range_softc;\n\nextern void\tmem_range_init(void);\nextern void\tmem_range_destroy(void);\n\nextern int\tmem_range_attr_get(struct mem_range_desc *mrd, int *arg);\nextern int\tmem_range_attr_set(struct mem_range_desc *mrd, int *arg);\n\n#endif /* _KERNEL */\n\n#endif /* _SYS_MEMRANGE_H_ */\n"
  },
  {
    "path": "freebsd-headers/sys/mman.h",
    "content": "/*-\n * Copyright (c) 1982, 1986, 1993\n *\tThe Regents of the University of California.  All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 4. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t@(#)mman.h\t8.2 (Berkeley) 1/9/95\n * $FreeBSD: release/9.0.0/sys/sys/mman.h 211937 2010-08-28 16:57:07Z alc $\n */\n\n#ifndef _SYS_MMAN_H_\n#define _SYS_MMAN_H_\n\n#include <sys/cdefs.h>\n#include <sys/_types.h>\n\n#if __BSD_VISIBLE\n/*\n * Inheritance for minherit()\n */\n#define INHERIT_SHARE\t0\n#define INHERIT_COPY\t1\n#define INHERIT_NONE\t2\n#endif\n\n/*\n * Protections are chosen from these bits, or-ed together\n */\n#define\tPROT_NONE\t0x00\t/* no permissions */\n#define\tPROT_READ\t0x01\t/* pages can be read */\n#define\tPROT_WRITE\t0x02\t/* pages can be written */\n#define\tPROT_EXEC\t0x04\t/* pages can be executed */\n\n/*\n * Flags contain sharing type and options.\n * Sharing types; choose one.\n */\n#define\tMAP_SHARED\t0x0001\t\t/* share changes */\n#define\tMAP_PRIVATE\t0x0002\t\t/* changes are private */\n#if __BSD_VISIBLE\n#define\tMAP_COPY\tMAP_PRIVATE\t/* Obsolete */\n#endif\n\n/*\n * Other flags\n */\n#define\tMAP_FIXED\t 0x0010\t/* map addr must be exactly as requested */\n\n#if __BSD_VISIBLE\n#define\tMAP_RENAME\t 0x0020\t/* Sun: rename private pages to file */\n#define\tMAP_NORESERVE\t 0x0040\t/* Sun: don't reserve needed swap area */\n#define\tMAP_RESERVED0080 0x0080\t/* previously misimplemented MAP_INHERIT */\n#define\tMAP_RESERVED0100 0x0100\t/* previously unimplemented MAP_NOEXTEND */\n#define\tMAP_HASSEMAPHORE 0x0200\t/* region may contain semaphores */\n#define\tMAP_STACK\t 0x0400\t/* region grows down, like a stack */\n#define\tMAP_NOSYNC\t 0x0800 /* page to but do not sync underlying file */\n\n/*\n * Mapping type\n */\n#define\tMAP_FILE\t 0x0000\t/* map from file (default) */\n#define\tMAP_ANON\t 0x1000\t/* allocated from memory, swap space */\n#ifndef _KERNEL\n#define\tMAP_ANONYMOUS\t MAP_ANON /* For compatibility. */\n#endif /* !_KERNEL */\n\n/*\n * Extended flags\n */\n#define\tMAP_NOCORE\t 0x00020000 /* dont include these pages in a coredump */\n#define\tMAP_PREFAULT_READ 0x00040000 /* prefault mapping for reading */\n#endif /* __BSD_VISIBLE */\n\n#if __POSIX_VISIBLE >= 199309\n/*\n * Process memory locking\n */\n#define MCL_CURRENT\t0x0001\t/* Lock only current memory */\n#define MCL_FUTURE\t0x0002\t/* Lock all future memory as well */\n#endif\n\n/*\n * Error return from mmap()\n */\n#define MAP_FAILED\t((void *)-1)\n\n/*\n * msync() flags\n */\n#define\tMS_SYNC\t\t0x0000\t/* msync synchronously */\n#define MS_ASYNC\t0x0001\t/* return immediately */\n#define MS_INVALIDATE\t0x0002\t/* invalidate all cached data */\n\n/*\n * Advice to madvise\n */\n#define\t_MADV_NORMAL\t0\t/* no further special treatment */\n#define\t_MADV_RANDOM\t1\t/* expect random page references */\n#define\t_MADV_SEQUENTIAL 2\t/* expect sequential page references */\n#define\t_MADV_WILLNEED\t3\t/* will need these pages */\n#define\t_MADV_DONTNEED\t4\t/* dont need these pages */\n\n#if __BSD_VISIBLE\n#define\tMADV_NORMAL\t_MADV_NORMAL\n#define\tMADV_RANDOM\t_MADV_RANDOM\n#define\tMADV_SEQUENTIAL _MADV_SEQUENTIAL\n#define\tMADV_WILLNEED\t_MADV_WILLNEED\n#define\tMADV_DONTNEED\t_MADV_DONTNEED\n#define\tMADV_FREE\t5\t/* dont need these pages, and junk contents */\n#define\tMADV_NOSYNC\t6\t/* try to avoid flushes to physical media */\n#define\tMADV_AUTOSYNC\t7\t/* revert to default flushing strategy */\n#define\tMADV_NOCORE\t8\t/* do not include these pages in a core file */\n#define\tMADV_CORE\t9\t/* revert to including pages in a core file */\n#define\tMADV_PROTECT\t10\t/* protect process from pageout kill */\n\n/*\n * Return bits from mincore\n */\n#define\tMINCORE_INCORE\t \t 0x1 /* Page is incore */\n#define\tMINCORE_REFERENCED\t 0x2 /* Page has been referenced by us */\n#define\tMINCORE_MODIFIED\t 0x4 /* Page has been modified by us */\n#define\tMINCORE_REFERENCED_OTHER 0x8 /* Page has been referenced */\n#define\tMINCORE_MODIFIED_OTHER\t0x10 /* Page has been modified */\n#define\tMINCORE_SUPER\t\t0x20 /* Page is a \"super\" page */\n\n/*\n * Anonymous object constant for shm_open().\n */\n#define\tSHM_ANON\t\t((char *)1)\n#endif /* __BSD_VISIBLE */\n\n/*\n * XXX missing POSIX_TYPED_MEM_* macros and\n * posix_typed_mem_info structure.\n */\n#if __POSIX_VISIBLE >= 200112\n#define\tPOSIX_MADV_NORMAL\t_MADV_NORMAL\n#define\tPOSIX_MADV_RANDOM\t_MADV_RANDOM\n#define\tPOSIX_MADV_SEQUENTIAL\t_MADV_SEQUENTIAL\n#define\tPOSIX_MADV_WILLNEED\t_MADV_WILLNEED\n#define\tPOSIX_MADV_DONTNEED\t_MADV_DONTNEED\n#endif\n\n#ifndef _MODE_T_DECLARED\ntypedef\t__mode_t\tmode_t;\n#define\t_MODE_T_DECLARED\n#endif\n\n#ifndef _OFF_T_DECLARED\ntypedef\t__off_t\t\toff_t;\n#define\t_OFF_T_DECLARED\n#endif\n\n#ifndef _SIZE_T_DECLARED\ntypedef\t__size_t\tsize_t;\n#define\t_SIZE_T_DECLARED\n#endif\n\n#ifdef _KERNEL\n#include <vm/vm.h>\n\nstruct shmfd {\n\tsize_t\t\tshm_size;\n\tvm_object_t\tshm_object;\n\tint\t\tshm_refs;\n\tuid_t\t\tshm_uid;\n\tgid_t\t\tshm_gid;\n\tmode_t\t\tshm_mode;\n\n\t/*\n\t * Values maintained solely to make this a better-behaved file\n\t * descriptor for fstat() to run on.\n\t */\n\tstruct timespec\tshm_atime;\n\tstruct timespec\tshm_mtime;\n\tstruct timespec\tshm_ctime;\n\tstruct timespec\tshm_birthtime;\n\n\tstruct label\t*shm_label;\t\t/* MAC label */\n};\n\nint\tshm_mmap(struct shmfd *shmfd, vm_size_t objsize, vm_ooffset_t foff,\n\t    vm_object_t *obj);\n\n#else /* !_KERNEL */\n\n__BEGIN_DECLS\n/*\n * XXX not yet implemented: posix_mem_offset(), posix_typed_mem_get_info(),\n * posix_typed_mem_open().\n */\n#if __BSD_VISIBLE\nint\tgetpagesizes(size_t *, int);\nint\tmadvise(void *, size_t, int);\nint\tmincore(const void *, size_t, char *);\nint\tminherit(void *, size_t, int);\n#endif\nint\tmlock(const void *, size_t);\n#ifndef _MMAP_DECLARED\n#define\t_MMAP_DECLARED\nvoid *\tmmap(void *, size_t, int, int, int, off_t);\n#endif\nint\tmprotect(const void *, size_t, int);\nint\tmsync(void *, size_t, int);\nint\tmunlock(const void *, size_t);\nint\tmunmap(void *, size_t);\n#if __POSIX_VISIBLE >= 200112\nint\tposix_madvise(void *, size_t, int);\n#endif\n#if __POSIX_VISIBLE >= 199309\nint\tmlockall(int);\nint\tmunlockall(void);\nint\tshm_open(const char *, int, mode_t);\nint\tshm_unlink(const char *);\n#endif\n__END_DECLS\n\n#endif /* !_KERNEL */\n\n#endif /* !_SYS_MMAN_H_ */\n"
  },
  {
    "path": "freebsd-headers/sys/module.h",
    "content": "/*-\n * Copyright (c) 1997 Doug Rabson\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/sys/module.h 213716 2010-10-12 09:18:17Z kib $\n */\n\n#ifndef _SYS_MODULE_H_\n#define _SYS_MODULE_H_\n\n/*\n * Module metadata types\n */\n#define\tMDT_DEPEND\t1\t\t/* argument is a module name */\n#define\tMDT_MODULE\t2\t\t/* module declaration */\n#define\tMDT_VERSION\t3\t\t/* module version(s) */\n\n#define\tMDT_STRUCT_VERSION\t1\t/* version of metadata structure */\n#define\tMDT_SETNAME\t\"modmetadata_set\"\n\ntypedef enum modeventtype {\n\tMOD_LOAD,\n\tMOD_UNLOAD,\n\tMOD_SHUTDOWN,\n\tMOD_QUIESCE\n} modeventtype_t;\n\ntypedef struct module *module_t;\ntypedef int (*modeventhand_t)(module_t, int /* modeventtype_t */, void *);\n\n/*\n * Struct for registering modules statically via SYSINIT.\n */\ntypedef struct moduledata {\n\tconst char\t*name;\t\t/* module name */\n\tmodeventhand_t  evhand;\t\t/* event handler */\n\tvoid\t\t*priv;\t\t/* extra data */\n} moduledata_t;\n\n/*\n * A module can use this to report module specific data to the user via\n * kldstat(2).\n */\ntypedef union modspecific {\n\tint\tintval;\n\tu_int\tuintval;\n\tlong\tlongval;\n\tu_long\tulongval;\n} modspecific_t;\n\n/*\n * Module dependency declarartion\n */\nstruct mod_depend {\n\tint\tmd_ver_minimum;\n\tint\tmd_ver_preferred;\n\tint\tmd_ver_maximum;\n};\n\n/*\n * Module version declaration\n */\nstruct mod_version {\n\tint\tmv_version;\n};\n\nstruct mod_metadata {\n\tint\t\tmd_version;\t/* structure version MDTV_* */\n\tint\t\tmd_type;\t/* type of entry MDT_* */\n\tvoid\t\t*md_data;\t/* specific data */\n\tconst char\t*md_cval;\t/* common string label */\n};\n\n#ifdef\t_KERNEL\n\n#include <sys/linker_set.h>\n\n#define\tMODULE_METADATA(uniquifier, type, data, cval)\t\t\t\\\n\tstatic struct mod_metadata _mod_metadata##uniquifier = {\t\\\n\t\tMDT_STRUCT_VERSION,\t\t\t\t\t\\\n\t\ttype,\t\t\t\t\t\t\t\\\n\t\tdata,\t\t\t\t\t\t\t\\\n\t\tcval\t\t\t\t\t\t\t\\\n\t};\t\t\t\t\t\t\t\t\\\n\tDATA_SET(modmetadata_set, _mod_metadata##uniquifier)\n\n#define\tMODULE_DEPEND(module, mdepend, vmin, vpref, vmax)\t\t\\\n\tstatic struct mod_depend _##module##_depend_on_##mdepend = {\t\\\n\t\tvmin,\t\t\t\t\t\t\t\\\n\t\tvpref,\t\t\t\t\t\t\t\\\n\t\tvmax\t\t\t\t\t\t\t\\\n\t};\t\t\t\t\t\t\t\t\\\n\tMODULE_METADATA(_md_##module##_on_##mdepend, MDT_DEPEND,\t\\\n\t    &_##module##_depend_on_##mdepend, #mdepend)\n\n/*\n * Every kernel has a 'kernel' module with the version set to\n * __FreeBSD_version.  We embed a MODULE_DEPEND() inside every module\n * that depends on the 'kernel' module.  It uses the current value of\n * __FreeBSD_version as the minimum and preferred versions.  For the\n * maximum version it rounds the version up to the end of its branch\n * (i.e. M99999 for M.x).  This allows a module built on M.x to work\n * on M.y systems where y >= x, but fail on M.z systems where z < x.\n */\n#define\tMODULE_KERNEL_MAXVER\t(roundup(__FreeBSD_version, 100000) - 1)\n\n#define\tDECLARE_MODULE_WITH_MAXVER(name, data, sub, order, maxver)\t\\\n\tMODULE_DEPEND(name, kernel, __FreeBSD_version,\t\t\t\\\n\t    __FreeBSD_version, maxver);\t\t\t\\\n\tMODULE_METADATA(_md_##name, MDT_MODULE, &data, #name);\t\t\\\n\tSYSINIT(name##module, sub, order, module_register_init, &data);\t\\\n\tstruct __hack\n\n#define\tDECLARE_MODULE(name, data, sub, order)\t\t\t\t\\\n\tDECLARE_MODULE_WITH_MAXVER(name, data, sub, order, MODULE_KERNEL_MAXVER)\n\n/*\n * The module declared with DECLARE_MODULE_TIED can only be loaded\n * into the kernel with exactly the same __FreeBSD_version.\n *\n * Use it for modules that use kernel interfaces that are not stable\n * even on STABLE/X branches.\n */\n#define\tDECLARE_MODULE_TIED(name, data, sub, order)\t\t\t\t\\\n\tDECLARE_MODULE_WITH_MAXVER(name, data, sub, order, __FreeBSD_version)\n\n#define\tMODULE_VERSION(module, version)\t\t\t\t\t\\\n\tstatic struct mod_version _##module##_version = {\t\t\\\n\t\tversion\t\t\t\t\t\t\t\\\n\t};\t\t\t\t\t\t\t\t\\\n\tMODULE_METADATA(_##module##_version, MDT_VERSION,\t\t\\\n\t    &_##module##_version, #module)\n\nextern struct sx modules_sx;\n\n#define\tMOD_XLOCK\tsx_xlock(&modules_sx)\n#define\tMOD_SLOCK\tsx_slock(&modules_sx)\n#define\tMOD_XUNLOCK\tsx_xunlock(&modules_sx)\n#define\tMOD_SUNLOCK\tsx_sunlock(&modules_sx)\n#define\tMOD_LOCK_ASSERT\tsx_assert(&modules_sx, SX_LOCKED)\n#define\tMOD_XLOCK_ASSERT\tsx_assert(&modules_sx, SX_XLOCKED)\n\nstruct linker_file;\n\nvoid\tmodule_register_init(const void *);\nint\tmodule_register(const struct moduledata *, struct linker_file *);\nmodule_t\tmodule_lookupbyname(const char *);\nmodule_t\tmodule_lookupbyid(int);\nint\tmodule_quiesce(module_t);\nvoid\tmodule_reference(module_t);\nvoid\tmodule_release(module_t);\nint\tmodule_unload(module_t);\nint\tmodule_getid(module_t);\nmodule_t\tmodule_getfnext(module_t);\nconst char *\tmodule_getname(module_t);\nvoid\tmodule_setspecific(module_t, modspecific_t *);\nstruct linker_file *module_file(module_t);\n\n#ifdef\tMOD_DEBUG\nextern int mod_debug;\n#define\tMOD_DEBUG_REFS\t1\n\n#define\tMOD_DPF(cat, args) do {\t\t\t\t\t\t\\\n\tif (mod_debug & MOD_DEBUG_##cat)\t\t\t\t\\\n\t\tprintf(args);\t\t\t\t\t\t\\\n} while (0)\n\n#else\t/* !MOD_DEBUG */\n\n#define\tMOD_DPF(cat, args)\n#endif\n#endif\t/* _KERNEL */\n\n#define\tMAXMODNAME\t32\n\nstruct module_stat {\n\tint\t\tversion;\t/* set to sizeof(struct module_stat) */\n\tchar\t\tname[MAXMODNAME];\n\tint\t\trefs;\n\tint\t\tid;\n\tmodspecific_t\tdata;\n};\n\n#ifndef _KERNEL\n\n#include <sys/cdefs.h>\n\n__BEGIN_DECLS\nint\tmodnext(int _modid);\nint\tmodfnext(int _modid);\nint\tmodstat(int _modid, struct module_stat *_stat);\nint\tmodfind(const char *_name);\n__END_DECLS\n\n#endif\n\n#endif\t/* !_SYS_MODULE_H_ */\n"
  },
  {
    "path": "freebsd-headers/sys/module_khelp.h",
    "content": "/*-\n * Copyright (c) 2010 Lawrence Stewart <lstewart@freebsd.org>\n * Copyright (c) 2010 The FreeBSD Foundation\n * All rights reserved.\n *\n * This software was developed by Lawrence Stewart while studying at the Centre\n * for Advanced Internet Architectures, Swinburne University of Technology, made\n * possible in part by grants from the FreeBSD Foundation and Cisco University\n * Research Program Fund at Community Foundation Silicon Valley.\n *\n * Portions of this software were developed at the Centre for Advanced\n * Internet Architectures, Swinburne University of Technology, Melbourne,\n * Australia by Lawrence Stewart under sponsorship from the FreeBSD Foundation.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/sys/module_khelp.h 220560 2011-04-12 08:13:18Z lstewart $\n */\n\n#ifndef _SYS_MODULE_KHELP_H_\n#define _SYS_MODULE_KHELP_H_\n\n/* XXXLAS: Needed for uma related typedefs. */\n#include <vm/uma.h>\n\n/* Helper flags. */\n#define\tHELPER_NEEDS_OSD\t0x0001\n\nstruct helper {\n\tint (*mod_init) (void);\n\tint (*mod_destroy) (void);\n#define\tHELPER_NAME_MAXLEN 16\n\tchar\t\t\th_name[HELPER_NAME_MAXLEN];\n\tuma_zone_t\t\th_zone;\n\tstruct hookinfo\t\t*h_hooks;\n\tuint32_t\t\th_nhooks;\n\tuint32_t\t\th_classes;\n\tint32_t\t\t\th_id;\n\tvolatile uint32_t\th_refcount;\n\tuint16_t\t\th_flags;\n\tTAILQ_ENTRY(helper)\th_next;\n};\n\nstruct khelp_modevent_data {\n\tchar\t\t\tname[HELPER_NAME_MAXLEN];\n\tstruct helper\t\t*helper;\n\tstruct hookinfo\t\t*hooks;\n\tint\t\t\tnhooks;\n\tint\t\t\tuma_zsize;\n\tuma_ctor\t\tumactor;\n\tuma_dtor\t\tumadtor;\n};\n\n#define\tKHELP_DECLARE_MOD(hname, hdata, hhooks, version)\t\t\\\n\tstatic struct khelp_modevent_data kmd_##hname = {\t\t\\\n\t\t.name = #hname,\t\t\t\t\t\t\\\n\t\t.helper = hdata\t\t\t\t\t\t\\\n\t\t.hooks = hhooks,\t\t\t\t\t\\\n\t\t.nhooks = sizeof(hhooks) / sizeof(hhooks[0]),\t\t\\\n\t};\t\t\t\t\t\t\t\t\\\n\tstatic moduledata_t h_##hname = {\t\t\t\t\\\n\t\t.name = #hname,\t\t\t\t\t\t\\\n\t\t.evhand = khelp_modevent,\t\t\t\t\\\n\t\t.priv = &kmd_##hname\t\t\t\t\t\\\n\t};\t\t\t\t\t\t\t\t\\\n\tDECLARE_MODULE(hname, h_##hname, SI_SUB_PROTO_IFATTACHDOMAIN,\t\\\n\t    SI_ORDER_ANY);\t\t\t\t\t\t\\\n\tMODULE_VERSION(hname, version)\n\n#define\tKHELP_DECLARE_MOD_UMA(hname, hdata, hhooks, version, size, ctor, dtor) \\\n\tstatic struct khelp_modevent_data kmd_##hname = {\t\t\\\n\t\t.name = #hname,\t\t\t\t\t\t\\\n\t\t.helper = hdata,\t\t\t\t\t\\\n\t\t.hooks = hhooks,\t\t\t\t\t\\\n\t\t.nhooks = sizeof(hhooks) / sizeof(hhooks[0]),\t\t\\\n\t\t.uma_zsize = size,\t\t\t\t\t\\\n\t\t.umactor = ctor,\t\t\t\t\t\\\n\t\t.umadtor = dtor\t\t\t\t\t\t\\\n\t};\t\t\t\t\t\t\t\t\\\n\tstatic moduledata_t h_##hname = {\t\t\t\t\\\n\t\t.name = #hname,\t\t\t\t\t\t\\\n\t\t.evhand = khelp_modevent,\t\t\t\t\\\n\t\t.priv = &kmd_##hname\t\t\t\t\t\\\n\t};\t\t\t\t\t\t\t\t\\\n\tDECLARE_MODULE(hname, h_##hname, SI_SUB_PROTO_IFATTACHDOMAIN,\t\\\n\t    SI_ORDER_ANY);\t\t\t\t\t\t\\\n\tMODULE_VERSION(hname, version)\n\nint\tkhelp_modevent(module_t mod, int type, void *data);\n\n#endif /* _SYS_MODULE_KHELP_H_ */\n"
  },
  {
    "path": "freebsd-headers/sys/mount.h",
    "content": "/*-\n * Copyright (c) 1989, 1991, 1993\n *\tThe Regents of the University of California.  All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 4. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t@(#)mount.h\t8.21 (Berkeley) 5/20/95\n * $FreeBSD: release/9.0.0/sys/sys/mount.h 224294 2011-07-24 18:27:09Z mckusick $\n */\n\n#ifndef _SYS_MOUNT_H_\n#define _SYS_MOUNT_H_\n\n#include <sys/ucred.h>\n#include <sys/queue.h>\n#ifdef _KERNEL\n#include <sys/lock.h>\n#include <sys/lockmgr.h>\n#include <sys/_mutex.h>\n#endif\n\n/*\n * NOTE: When changing statfs structure, mount structure, MNT_* flags or\n * MNTK_* flags also update DDB show mount command in vfs_subr.c.\n */\n\ntypedef struct fsid { int32_t val[2]; } fsid_t;\t/* filesystem id type */\n\n/*\n * File identifier.\n * These are unique per filesystem on a single machine.\n */\n#define\tMAXFIDSZ\t16\n\nstruct fid {\n\tu_short\t\tfid_len;\t\t/* length of data in bytes */\n\tu_short\t\tfid_data0;\t\t/* force longword alignment */\n\tchar\t\tfid_data[MAXFIDSZ];\t/* data (variable length) */\n};\n\n/*\n * filesystem statistics\n */\n#define\tMFSNAMELEN\t16\t\t/* length of type name including null */\n#define\tMNAMELEN\t88\t\t/* size of on/from name bufs */\n#define\tSTATFS_VERSION\t0x20030518\t/* current version number */\nstruct statfs {\n\tuint32_t f_version;\t\t/* structure version number */\n\tuint32_t f_type;\t\t/* type of filesystem */\n\tuint64_t f_flags;\t\t/* copy of mount exported flags */\n\tuint64_t f_bsize;\t\t/* filesystem fragment size */\n\tuint64_t f_iosize;\t\t/* optimal transfer block size */\n\tuint64_t f_blocks;\t\t/* total data blocks in filesystem */\n\tuint64_t f_bfree;\t\t/* free blocks in filesystem */\n\tint64_t\t f_bavail;\t\t/* free blocks avail to non-superuser */\n\tuint64_t f_files;\t\t/* total file nodes in filesystem */\n\tint64_t\t f_ffree;\t\t/* free nodes avail to non-superuser */\n\tuint64_t f_syncwrites;\t\t/* count of sync writes since mount */\n\tuint64_t f_asyncwrites;\t\t/* count of async writes since mount */\n\tuint64_t f_syncreads;\t\t/* count of sync reads since mount */\n\tuint64_t f_asyncreads;\t\t/* count of async reads since mount */\n\tuint64_t f_spare[10];\t\t/* unused spare */\n\tuint32_t f_namemax;\t\t/* maximum filename length */\n\tuid_t\t  f_owner;\t\t/* user that mounted the filesystem */\n\tfsid_t\t  f_fsid;\t\t/* filesystem id */\n\tchar\t  f_charspare[80];\t    /* spare string space */\n\tchar\t  f_fstypename[MFSNAMELEN]; /* filesystem type name */\n\tchar\t  f_mntfromname[MNAMELEN];  /* mounted filesystem */\n\tchar\t  f_mntonname[MNAMELEN];    /* directory on which mounted */\n};\n\n#ifdef _KERNEL\n#define\tOMFSNAMELEN\t16\t/* length of fs type name, including null */\n#define\tOMNAMELEN\t(88 - 2 * sizeof(long))\t/* size of on/from name bufs */\n\n/* XXX getfsstat.2 is out of date with write and read counter changes here. */\n/* XXX statfs.2 is out of date with read counter changes here. */\nstruct ostatfs {\n\tlong\tf_spare2;\t\t/* placeholder */\n\tlong\tf_bsize;\t\t/* fundamental filesystem block size */\n\tlong\tf_iosize;\t\t/* optimal transfer block size */\n\tlong\tf_blocks;\t\t/* total data blocks in filesystem */\n\tlong\tf_bfree;\t\t/* free blocks in fs */\n\tlong\tf_bavail;\t\t/* free blocks avail to non-superuser */\n\tlong\tf_files;\t\t/* total file nodes in filesystem */\n\tlong\tf_ffree;\t\t/* free file nodes in fs */\n\tfsid_t\tf_fsid;\t\t\t/* filesystem id */\n\tuid_t\tf_owner;\t\t/* user that mounted the filesystem */\n\tint\tf_type;\t\t\t/* type of filesystem */\n\tint\tf_flags;\t\t/* copy of mount exported flags */\n\tlong\tf_syncwrites;\t\t/* count of sync writes since mount */\n\tlong\tf_asyncwrites;\t\t/* count of async writes since mount */\n\tchar\tf_fstypename[OMFSNAMELEN]; /* fs type name */\n\tchar\tf_mntonname[OMNAMELEN];\t/* directory on which mounted */\n\tlong\tf_syncreads;\t\t/* count of sync reads since mount */\n\tlong\tf_asyncreads;\t\t/* count of async reads since mount */\n\tshort\tf_spares1;\t\t/* unused spare */\n\tchar\tf_mntfromname[OMNAMELEN];/* mounted filesystem */\n\tshort\tf_spares2;\t\t/* unused spare */\n\t/*\n\t * XXX on machines where longs are aligned to 8-byte boundaries, there\n\t * is an unnamed int32_t here.  This spare was after the apparent end\n\t * of the struct until we bit off the read counters from f_mntonname.\n\t */\n\tlong\tf_spare[2];\t\t/* unused spare */\n};\n\nTAILQ_HEAD(vnodelst, vnode);\n\n/* Mount options list */\nTAILQ_HEAD(vfsoptlist, vfsopt);\nstruct vfsopt {\n\tTAILQ_ENTRY(vfsopt) link;\n\tchar\t*name;\n\tvoid\t*value;\n\tint\tlen;\n\tint\tpos;\n\tint\tseen;\n};\n\n/*\n * Structure per mounted filesystem.  Each mounted filesystem has an\n * array of operations and an instance record.  The filesystems are\n * put on a doubly linked list.\n *\n * Lock reference:\n *\tm - mountlist_mtx\n *\ti - interlock\n *\n * Unmarked fields are considered stable as long as a ref is held.\n *\n */\nstruct mount {\n\tstruct mtx\tmnt_mtx;\t\t/* mount structure interlock */\n\tint\t\tmnt_gen;\t\t/* struct mount generation */\n#define\tmnt_startzero\tmnt_list\n\tTAILQ_ENTRY(mount) mnt_list;\t\t/* (m) mount list */\n\tstruct vfsops\t*mnt_op;\t\t/* operations on fs */\n\tstruct vfsconf\t*mnt_vfc;\t\t/* configuration info */\n\tstruct vnode\t*mnt_vnodecovered;\t/* vnode we mounted on */\n\tstruct vnode\t*mnt_syncer;\t\t/* syncer vnode */\n\tint\t\tmnt_ref;\t\t/* (i) Reference count */\n\tstruct vnodelst\tmnt_nvnodelist;\t\t/* (i) list of vnodes */\n\tint\t\tmnt_nvnodelistsize;\t/* (i) # of vnodes */\n\tint\t\tmnt_writeopcount;\t/* (i) write syscalls pending */\n\tint\t\tmnt_kern_flag;\t\t/* (i) kernel only flags */\n\tuint64_t\tmnt_flag;\t\t/* (i) flags shared with user */\n\tu_int\t\tmnt_noasync;\t\t/* (i) # noasync overrides */\n\tstruct vfsoptlist *mnt_opt;\t\t/* current mount options */\n\tstruct vfsoptlist *mnt_optnew;\t\t/* new options passed to fs */\n\tint\t\tmnt_maxsymlinklen;\t/* max size of short symlink */\n\tstruct statfs\tmnt_stat;\t\t/* cache of filesystem stats */\n\tstruct ucred\t*mnt_cred;\t\t/* credentials of mounter */\n\tvoid *\t\tmnt_data;\t\t/* private data */\n\ttime_t\t\tmnt_time;\t\t/* last time written*/\n\tint\t\tmnt_iosize_max;\t\t/* max size for clusters, etc */\n\tstruct netexport *mnt_export;\t\t/* export list */\n\tstruct label\t*mnt_label;\t\t/* MAC label for the fs */\n\tu_int\t\tmnt_hashseed;\t\t/* Random seed for vfs_hash */\n\tint\t\tmnt_lockref;\t\t/* (i) Lock reference count */\n\tint\t\tmnt_secondary_writes;   /* (i) # of secondary writes */\n\tint\t\tmnt_secondary_accwrites;/* (i) secondary wr. starts */\n\tstruct thread\t*mnt_susp_owner;\t/* (i) thread owning suspension */\n#define\tmnt_endzero\tmnt_gjprovider\n\tchar\t\t*mnt_gjprovider;\t/* gjournal provider name */\n\tstruct lock\tmnt_explock;\t\t/* vfs_export walkers lock */\n};\n\nstruct vnode *__mnt_vnode_next(struct vnode **mvp, struct mount *mp);\nstruct vnode *__mnt_vnode_first(struct vnode **mvp, struct mount *mp);\nvoid          __mnt_vnode_markerfree(struct vnode **mvp, struct mount *mp);\n\n#define MNT_VNODE_FOREACH(vp, mp, mvp) \\\n\tfor (vp = __mnt_vnode_first(&(mvp), (mp)); \\\n\t\t(vp) != NULL; vp = __mnt_vnode_next(&(mvp), (mp)))\n\n#define MNT_VNODE_FOREACH_ABORT_ILOCKED(mp, mvp)\t\t\t\\\n\t__mnt_vnode_markerfree(&(mvp), (mp))\n\n#define MNT_VNODE_FOREACH_ABORT(mp, mvp)\t\t\t\t\\\n        do {\t\t\t\t\t\t\t\t\\\n\t  MNT_ILOCK(mp);\t\t\t\t\t\t\\\n          MNT_VNODE_FOREACH_ABORT_ILOCKED(mp, mvp);\t\t\t\\\n\t  MNT_IUNLOCK(mp);\t\t\t\t\t\t\\\n\t} while (0)\n\n#define\tMNT_ILOCK(mp)\tmtx_lock(&(mp)->mnt_mtx)\n#define\tMNT_ITRYLOCK(mp) mtx_trylock(&(mp)->mnt_mtx)\n#define\tMNT_IUNLOCK(mp)\tmtx_unlock(&(mp)->mnt_mtx)\n#define\tMNT_MTX(mp)\t(&(mp)->mnt_mtx)\n#define\tMNT_REF(mp)\t(mp)->mnt_ref++\n#define\tMNT_REL(mp)\tdo {\t\t\t\t\t\t\\\n\tKASSERT((mp)->mnt_ref > 0, (\"negative mnt_ref\"));\t\t\t\\\n\t(mp)->mnt_ref--;\t\t\t\t\t\t\\\n\tif ((mp)->mnt_ref == 0)\t\t\t\t\t\t\\\n\t\twakeup((mp));\t\t\t\t\t\t\\\n} while (0)\n\n#endif /* _KERNEL */\n\n/*\n * User specifiable flags, stored in mnt_flag.\n */\n#define\tMNT_RDONLY\t0x0000000000000001ULL /* read only filesystem */\n#define\tMNT_SYNCHRONOUS\t0x0000000000000002ULL /* fs written synchronously */\n#define\tMNT_NOEXEC\t0x0000000000000004ULL /* can't exec from filesystem */\n#define\tMNT_NOSUID\t0x0000000000000008ULL /* don't honor setuid fs bits */\n#define\tMNT_NFS4ACLS\t0x0000000000000010ULL /* enable NFS version 4 ACLs */\n#define\tMNT_UNION\t0x0000000000000020ULL /* union with underlying fs */\n#define\tMNT_ASYNC\t0x0000000000000040ULL /* fs written asynchronously */\n#define\tMNT_SUIDDIR\t0x0000000000100000ULL /* special SUID dir handling */\n#define\tMNT_SOFTDEP\t0x0000000000200000ULL /* using soft updates */\n#define\tMNT_NOSYMFOLLOW\t0x0000000000400000ULL /* do not follow symlinks */\n#define\tMNT_GJOURNAL\t0x0000000002000000ULL /* GEOM journal support enabled */\n#define\tMNT_MULTILABEL\t0x0000000004000000ULL /* MAC support for objects */\n#define\tMNT_ACLS\t0x0000000008000000ULL /* ACL support enabled */\n#define\tMNT_NOATIME\t0x0000000010000000ULL /* dont update file access time */\n#define\tMNT_NOCLUSTERR\t0x0000000040000000ULL /* disable cluster read */\n#define\tMNT_NOCLUSTERW\t0x0000000080000000ULL /* disable cluster write */\n#define\tMNT_SUJ\t\t0x0000000100000000ULL /* using journaled soft updates */\n\n/*\n * NFS export related mount flags.\n */\n#define\tMNT_EXRDONLY\t0x0000000000000080ULL\t/* exported read only */\n#define\tMNT_EXPORTED\t0x0000000000000100ULL\t/* filesystem is exported */\n#define\tMNT_DEFEXPORTED\t0x0000000000000200ULL\t/* exported to the world */\n#define\tMNT_EXPORTANON\t0x0000000000000400ULL\t/* anon uid mapping for all */\n#define\tMNT_EXKERB\t0x0000000000000800ULL\t/* exported with Kerberos */\n#define\tMNT_EXPUBLIC\t0x0000000020000000ULL\t/* public export (WebNFS) */\n\n/*\n * Flags set by internal operations,\n * but visible to the user.\n * XXX some of these are not quite right.. (I've never seen the root flag set)\n */\n#define\tMNT_LOCAL\t0x0000000000001000ULL /* filesystem is stored locally */\n#define\tMNT_QUOTA\t0x0000000000002000ULL /* quotas are enabled on fs */\n#define\tMNT_ROOTFS\t0x0000000000004000ULL /* identifies the root fs */\n#define\tMNT_USER\t0x0000000000008000ULL /* mounted by a user */\n#define\tMNT_IGNORE\t0x0000000000800000ULL /* do not show entry in df */\n\n/*\n * Mask of flags that are visible to statfs().\n * XXX I think that this could now become (~(MNT_CMDFLAGS))\n * but the 'mount' program may need changing to handle this.\n */\n#define\tMNT_VISFLAGMASK\t(MNT_RDONLY\t| MNT_SYNCHRONOUS | MNT_NOEXEC\t| \\\n\t\t\tMNT_NOSUID\t| MNT_UNION\t| MNT_SUJ\t| \\\n\t\t\tMNT_ASYNC\t| MNT_EXRDONLY\t| MNT_EXPORTED\t| \\\n\t\t\tMNT_DEFEXPORTED\t| MNT_EXPORTANON| MNT_EXKERB\t| \\\n\t\t\tMNT_LOCAL\t| MNT_USER\t| MNT_QUOTA\t| \\\n\t\t\tMNT_ROOTFS\t| MNT_NOATIME\t| MNT_NOCLUSTERR| \\\n\t\t\tMNT_NOCLUSTERW\t| MNT_SUIDDIR\t| MNT_SOFTDEP\t| \\\n\t\t\tMNT_IGNORE\t| MNT_EXPUBLIC\t| MNT_NOSYMFOLLOW | \\\n\t\t\tMNT_GJOURNAL\t| MNT_MULTILABEL | MNT_ACLS\t| \\\n\t\t\tMNT_NFS4ACLS)\n\n/* Mask of flags that can be updated. */\n#define\tMNT_UPDATEMASK (MNT_NOSUID\t| MNT_NOEXEC\t| \\\n\t\t\tMNT_SYNCHRONOUS\t| MNT_UNION\t| MNT_ASYNC\t| \\\n\t\t\tMNT_NOATIME | \\\n\t\t\tMNT_NOSYMFOLLOW\t| MNT_IGNORE\t| \\\n\t\t\tMNT_NOCLUSTERR\t| MNT_NOCLUSTERW | MNT_SUIDDIR\t| \\\n\t\t\tMNT_ACLS\t| MNT_USER | MNT_NFS4ACLS)\n\n/*\n * External filesystem command modifier flags.\n * Unmount can use the MNT_FORCE flag.\n * XXX: These are not STATES and really should be somewhere else.\n * XXX: MNT_BYFSID collides with MNT_ACLS, but because MNT_ACLS is only used for\n *      mount(2) and MNT_BYFSID is only used for unmount(2) it's harmless.\n */\n#define\tMNT_UPDATE\t0x0000000000010000ULL /* not real mount, just update */\n#define\tMNT_DELEXPORT\t0x0000000000020000ULL /* delete export host lists */\n#define\tMNT_RELOAD\t0x0000000000040000ULL /* reload filesystem data */\n#define\tMNT_FORCE\t0x0000000000080000ULL /* force unmount or readonly */\n#define\tMNT_SNAPSHOT\t0x0000000001000000ULL /* snapshot the filesystem */\n#define\tMNT_BYFSID\t0x0000000008000000ULL /* specify filesystem by ID. */\n#define MNT_CMDFLAGS   (MNT_UPDATE\t| MNT_DELEXPORT\t| MNT_RELOAD\t| \\\n\t\t\tMNT_FORCE\t| MNT_SNAPSHOT\t| MNT_BYFSID)\n/*\n * Internal filesystem control flags stored in mnt_kern_flag.\n *\n * MNTK_UNMOUNT locks the mount entry so that name lookup cannot proceed\n * past the mount point.  This keeps the subtree stable during mounts\n * and unmounts.\n *\n * MNTK_UNMOUNTF permits filesystems to detect a forced unmount while\n * dounmount() is still waiting to lock the mountpoint. This allows\n * the filesystem to cancel operations that might otherwise deadlock\n * with the unmount attempt (used by NFS).\n *\n * MNTK_NOINSMNTQ is strict subset of MNTK_UNMOUNT. They are separated\n * to allow for failed unmount attempt to restore the syncer vnode for\n * the mount.\n */\n#define MNTK_UNMOUNTF\t0x00000001\t/* forced unmount in progress */\n#define MNTK_ASYNC\t0x00000002\t/* filtered async flag */\n#define MNTK_SOFTDEP\t0x00000004\t/* async disabled by softdep */\n#define MNTK_NOINSMNTQ\t0x00000008\t/* insmntque is not allowed */\n#define\tMNTK_DRAINING\t0x00000010\t/* lock draining is happening */\n#define\tMNTK_REFEXPIRE\t0x00000020\t/* refcount expiring is happening */\n#define MNTK_EXTENDED_SHARED\t0x00000040 /* Allow shared locking for more ops */\n#define\tMNTK_SHARED_WRITES\t0x00000080 /* Allow shared locking for writes */\n#define MNTK_UNMOUNT\t0x01000000\t/* unmount in progress */\n#define\tMNTK_MWAIT\t0x02000000\t/* waiting for unmount to finish */\n#define\tMNTK_SUSPEND\t0x08000000\t/* request write suspension */\n#define\tMNTK_SUSPEND2\t0x04000000\t/* block secondary writes */\n#define\tMNTK_SUSPENDED\t0x10000000\t/* write operations are suspended */\n#define\tMNTK_MPSAFE\t0x20000000\t/* Filesystem is MPSAFE. */\n#define MNTK_LOOKUP_SHARED\t0x40000000 /* FS supports shared lock lookups */\n#define\tMNTK_NOKNOTE\t0x80000000\t/* Don't send KNOTEs from VOP hooks */\n\n#define\tMNT_SHARED_WRITES(mp) (((mp) != NULL) && \t\\\n\t\t\t\t((mp)->mnt_kern_flag & MNTK_SHARED_WRITES))\n\n/*\n * Sysctl CTL_VFS definitions.\n *\n * Second level identifier specifies which filesystem. Second level\n * identifier VFS_VFSCONF returns information about all filesystems.\n * Second level identifier VFS_GENERIC is non-terminal.\n */\n#define\tVFS_VFSCONF\t\t0\t/* get configured filesystems */\n#define\tVFS_GENERIC\t\t0\t/* generic filesystem information */\n/*\n * Third level identifiers for VFS_GENERIC are given below; third\n * level identifiers for specific filesystems are given in their\n * mount specific header files.\n */\n#define VFS_MAXTYPENUM\t1\t/* int: highest defined filesystem type */\n#define VFS_CONF\t2\t/* struct: vfsconf for filesystem given\n\t\t\t\t   as next argument */\n\n/*\n * Flags for various system call interfaces.\n *\n * waitfor flags to vfs_sync() and getfsstat()\n */\n#define MNT_WAIT\t1\t/* synchronously wait for I/O to complete */\n#define MNT_NOWAIT\t2\t/* start all I/O, but do not wait for it */\n#define MNT_LAZY\t3\t/* push data not written by filesystem syncer */\n#define MNT_SUSPEND\t4\t/* Suspend file system after sync */\n\n/*\n * Generic file handle\n */\nstruct fhandle {\n\tfsid_t\tfh_fsid;\t/* Filesystem id of mount point */\n\tstruct\tfid fh_fid;\t/* Filesys specific id */\n};\ntypedef struct fhandle\tfhandle_t;\n\n/*\n * Old export arguments without security flavor list\n */\nstruct oexport_args {\n\tint\tex_flags;\t\t/* export related flags */\n\tuid_t\tex_root;\t\t/* mapping for root uid */\n\tstruct\txucred ex_anon;\t\t/* mapping for anonymous user */\n\tstruct\tsockaddr *ex_addr;\t/* net address to which exported */\n\tu_char\tex_addrlen;\t\t/* and the net address length */\n\tstruct\tsockaddr *ex_mask;\t/* mask of valid bits in saddr */\n\tu_char\tex_masklen;\t\t/* and the smask length */\n\tchar\t*ex_indexfile;\t\t/* index file for WebNFS URLs */\n};\n\n/*\n * Export arguments for local filesystem mount calls.\n */\n#define\tMAXSECFLAVORS\t5\nstruct export_args {\n\tint\tex_flags;\t\t/* export related flags */\n\tuid_t\tex_root;\t\t/* mapping for root uid */\n\tstruct\txucred ex_anon;\t\t/* mapping for anonymous user */\n\tstruct\tsockaddr *ex_addr;\t/* net address to which exported */\n\tu_char\tex_addrlen;\t\t/* and the net address length */\n\tstruct\tsockaddr *ex_mask;\t/* mask of valid bits in saddr */\n\tu_char\tex_masklen;\t\t/* and the smask length */\n\tchar\t*ex_indexfile;\t\t/* index file for WebNFS URLs */\n\tint\tex_numsecflavors;\t/* security flavor count */\n\tint\tex_secflavors[MAXSECFLAVORS]; /* list of security flavors */\n};\n\n/*\n * Structure holding information for a publicly exported filesystem\n * (WebNFS). Currently the specs allow just for one such filesystem.\n */\nstruct nfs_public {\n\tint\t\tnp_valid;\t/* Do we hold valid information */\n\tfhandle_t\tnp_handle;\t/* Filehandle for pub fs (internal) */\n\tstruct mount\t*np_mount;\t/* Mountpoint of exported fs */\n\tchar\t\t*np_index;\t/* Index file */\n};\n\n/*\n * Filesystem configuration information. One of these exists for each\n * type of filesystem supported by the kernel. These are searched at\n * mount time to identify the requested filesystem.\n *\n * XXX: Never change the first two arguments!\n */\nstruct vfsconf {\n\tu_int\tvfc_version;\t\t/* ABI version number */\n\tchar\tvfc_name[MFSNAMELEN];\t/* filesystem type name */\n\tstruct\tvfsops *vfc_vfsops;\t/* filesystem operations vector */\n\tint\tvfc_typenum;\t\t/* historic filesystem type number */\n\tint\tvfc_refcount;\t\t/* number mounted of this type */\n\tint\tvfc_flags;\t\t/* permanent flags */\n\tstruct\tvfsoptdecl *vfc_opts;\t/* mount options */\n\tTAILQ_ENTRY(vfsconf) vfc_list;\t/* list of vfscons */\n};\n\n/* Userland version of the struct vfsconf. */\nstruct xvfsconf {\n\tstruct\tvfsops *vfc_vfsops;\t/* filesystem operations vector */\n\tchar\tvfc_name[MFSNAMELEN];\t/* filesystem type name */\n\tint\tvfc_typenum;\t\t/* historic filesystem type number */\n\tint\tvfc_refcount;\t\t/* number mounted of this type */\n\tint\tvfc_flags;\t\t/* permanent flags */\n\tstruct\tvfsconf *vfc_next;\t/* next in list */\n};\n\n#ifndef BURN_BRIDGES\nstruct ovfsconf {\n\tvoid\t*vfc_vfsops;\n\tchar\tvfc_name[32];\n\tint\tvfc_index;\n\tint\tvfc_refcount;\n\tint\tvfc_flags;\n};\n#endif\n\n/*\n * NB: these flags refer to IMPLEMENTATION properties, not properties of\n * any actual mounts; i.e., it does not make sense to change the flags.\n */\n#define\tVFCF_STATIC\t0x00010000\t/* statically compiled into kernel */\n#define\tVFCF_NETWORK\t0x00020000\t/* may get data over the network */\n#define\tVFCF_READONLY\t0x00040000\t/* writes are not implemented */\n#define\tVFCF_SYNTHETIC\t0x00080000\t/* data does not represent real files */\n#define\tVFCF_LOOPBACK\t0x00100000\t/* aliases some other mounted FS */\n#define\tVFCF_UNICODE\t0x00200000\t/* stores file names as Unicode */\n#define\tVFCF_JAIL\t0x00400000\t/* can be mounted from within a jail */\n#define\tVFCF_DELEGADMIN\t0x00800000\t/* supports delegated administration */\n\ntypedef uint32_t fsctlop_t;\n\nstruct vfsidctl {\n\tint\t\tvc_vers;\t/* should be VFSIDCTL_VERS1 (below) */\n\tfsid_t\t\tvc_fsid;\t/* fsid to operate on */\n\tchar\t\tvc_fstypename[MFSNAMELEN];\n\t\t\t\t\t/* type of fs 'nfs' or '*' */\n\tfsctlop_t\tvc_op;\t\t/* operation VFS_CTL_* (below) */\n\tvoid\t\t*vc_ptr;\t/* pointer to data structure */\n\tsize_t\t\tvc_len;\t\t/* sizeof said structure */\n\tu_int32_t\tvc_spare[12];\t/* spare (must be zero) */\n};\n\n/* vfsidctl API version. */\n#define VFS_CTL_VERS1\t0x01\n\n/*\n * New style VFS sysctls, do not reuse/conflict with the namespace for\n * private sysctls.\n * All \"global\" sysctl ops have the 33rd bit set:\n * 0x...1....\n * Private sysctl ops should have the 33rd bit unset.\n */\n#define VFS_CTL_QUERY\t0x00010001\t/* anything wrong? (vfsquery) */\n#define VFS_CTL_TIMEO\t0x00010002\t/* set timeout for vfs notification */\n#define VFS_CTL_NOLOCKS\t0x00010003\t/* disable file locking */\n\nstruct vfsquery {\n\tu_int32_t\tvq_flags;\n\tu_int32_t\tvq_spare[31];\n};\n\n/* vfsquery flags */\n#define VQ_NOTRESP\t0x0001\t/* server down */\n#define VQ_NEEDAUTH\t0x0002\t/* server bad auth */\n#define VQ_LOWDISK\t0x0004\t/* we're low on space */\n#define VQ_MOUNT\t0x0008\t/* new filesystem arrived */\n#define VQ_UNMOUNT\t0x0010\t/* filesystem has left */\n#define VQ_DEAD\t\t0x0020\t/* filesystem is dead, needs force unmount */\n#define VQ_ASSIST\t0x0040\t/* filesystem needs assistance from external\n\t\t\t\t   program */\n#define VQ_NOTRESPLOCK\t0x0080\t/* server lockd down */\n#define VQ_FLAG0100\t0x0100\t/* placeholder */\n#define VQ_FLAG0200\t0x0200\t/* placeholder */\n#define VQ_FLAG0400\t0x0400\t/* placeholder */\n#define VQ_FLAG0800\t0x0800\t/* placeholder */\n#define VQ_FLAG1000\t0x1000\t/* placeholder */\n#define VQ_FLAG2000\t0x2000\t/* placeholder */\n#define VQ_FLAG4000\t0x4000\t/* placeholder */\n#define VQ_FLAG8000\t0x8000\t/* placeholder */\n\n#ifdef _KERNEL\n/* Point a sysctl request at a vfsidctl's data. */\n#define VCTLTOREQ(vc, req)\t\t\t\t\t\t\\\n\tdo {\t\t\t\t\t\t\t\t\\\n\t\t(req)->newptr = (vc)->vc_ptr;\t\t\t\t\\\n\t\t(req)->newlen = (vc)->vc_len;\t\t\t\t\\\n\t\t(req)->newidx = 0;\t\t\t\t\t\\\n\t} while (0)\n#endif\n\nstruct iovec;\nstruct uio;\n\n#ifdef _KERNEL\n\n/*\n * vfs_busy specific flags and mask.\n */\n#define\tMBF_NOWAIT\t0x01\n#define\tMBF_MNTLSTLOCK\t0x02\n#define\tMBF_MASK\t(MBF_NOWAIT | MBF_MNTLSTLOCK)\n\n#ifdef MALLOC_DECLARE\nMALLOC_DECLARE(M_MOUNT);\n#endif\nextern int maxvfsconf;\t\t/* highest defined filesystem type */\nextern int nfs_mount_type;\t/* vfc_typenum for nfs, or -1 */\n\nTAILQ_HEAD(vfsconfhead, vfsconf);\nextern struct vfsconfhead vfsconf;\n\n/*\n * Operations supported on mounted filesystem.\n */\nstruct mount_args;\nstruct nameidata;\nstruct sysctl_req;\nstruct mntarg;\n\ntypedef int vfs_cmount_t(struct mntarg *ma, void *data, int flags);\ntypedef int vfs_unmount_t(struct mount *mp, int mntflags);\ntypedef int vfs_root_t(struct mount *mp, int flags, struct vnode **vpp);\ntypedef\tint vfs_quotactl_t(struct mount *mp, int cmds, uid_t uid, void *arg);\ntypedef\tint vfs_statfs_t(struct mount *mp, struct statfs *sbp);\ntypedef\tint vfs_sync_t(struct mount *mp, int waitfor);\ntypedef\tint vfs_vget_t(struct mount *mp, ino_t ino, int flags,\n\t\t    struct vnode **vpp);\ntypedef\tint vfs_fhtovp_t(struct mount *mp, struct fid *fhp,\n\t\t    int flags, struct vnode **vpp);\ntypedef\tint vfs_checkexp_t(struct mount *mp, struct sockaddr *nam,\n\t\t    int *extflagsp, struct ucred **credanonp,\n\t\t    int *numsecflavors, int **secflavors);\ntypedef\tint vfs_init_t(struct vfsconf *);\ntypedef\tint vfs_uninit_t(struct vfsconf *);\ntypedef\tint vfs_extattrctl_t(struct mount *mp, int cmd,\n\t\t    struct vnode *filename_vp, int attrnamespace,\n\t\t    const char *attrname);\ntypedef\tint vfs_mount_t(struct mount *mp);\ntypedef int vfs_sysctl_t(struct mount *mp, fsctlop_t op,\n\t\t    struct sysctl_req *req);\ntypedef void vfs_susp_clean_t(struct mount *mp);\n\nstruct vfsops {\n\tvfs_mount_t\t\t*vfs_mount;\n\tvfs_cmount_t\t\t*vfs_cmount;\n\tvfs_unmount_t\t\t*vfs_unmount;\n\tvfs_root_t\t\t*vfs_root;\n\tvfs_quotactl_t\t\t*vfs_quotactl;\n\tvfs_statfs_t\t\t*vfs_statfs;\n\tvfs_sync_t\t\t*vfs_sync;\n\tvfs_vget_t\t\t*vfs_vget;\n\tvfs_fhtovp_t\t\t*vfs_fhtovp;\n\tvfs_checkexp_t\t\t*vfs_checkexp;\n\tvfs_init_t\t\t*vfs_init;\n\tvfs_uninit_t\t\t*vfs_uninit;\n\tvfs_extattrctl_t\t*vfs_extattrctl;\n\tvfs_sysctl_t\t\t*vfs_sysctl;\n\tvfs_susp_clean_t\t*vfs_susp_clean;\n};\n\nvfs_statfs_t\t__vfs_statfs;\n\n#define\tVFS_MOUNT(MP)\t\t(*(MP)->mnt_op->vfs_mount)(MP)\n#define\tVFS_UNMOUNT(MP, FORCE)\t(*(MP)->mnt_op->vfs_unmount)(MP, FORCE)\n#define\tVFS_ROOT(MP, FLAGS, VPP)\t\t\t\t\t\\\n\t(*(MP)->mnt_op->vfs_root)(MP, FLAGS, VPP)\n#define\tVFS_QUOTACTL(MP, C, U, A)\t\t\t\t\t\\\n\t(*(MP)->mnt_op->vfs_quotactl)(MP, C, U, A)\n#define\tVFS_STATFS(MP, SBP)\t__vfs_statfs((MP), (SBP))\n#define\tVFS_SYNC(MP, WAIT)\t(*(MP)->mnt_op->vfs_sync)(MP, WAIT)\n#define VFS_VGET(MP, INO, FLAGS, VPP) \\\n\t(*(MP)->mnt_op->vfs_vget)(MP, INO, FLAGS, VPP)\n#define VFS_FHTOVP(MP, FIDP, FLAGS, VPP) \\\n\t(*(MP)->mnt_op->vfs_fhtovp)(MP, FIDP, FLAGS, VPP)\n#define VFS_CHECKEXP(MP, NAM, EXFLG, CRED, NUMSEC, SEC)\t\\\n\t(*(MP)->mnt_op->vfs_checkexp)(MP, NAM, EXFLG, CRED, NUMSEC, SEC)\n#define\tVFS_EXTATTRCTL(MP, C, FN, NS, N)\t\t\t\t\\\n\t(*(MP)->mnt_op->vfs_extattrctl)(MP, C, FN, NS, N)\n#define VFS_SYSCTL(MP, OP, REQ) \\\n\t(*(MP)->mnt_op->vfs_sysctl)(MP, OP, REQ)\n#define\tVFS_SUSP_CLEAN(MP) \\\n\t({if (*(MP)->mnt_op->vfs_susp_clean != NULL)\t\t\\\n\t       (*(MP)->mnt_op->vfs_susp_clean)(MP); })\n\n#define\tVFS_NEEDSGIANT_(MP)\t\t\t\t\t\t\\\n    ((MP) != NULL && ((MP)->mnt_kern_flag & MNTK_MPSAFE) == 0)\n\n#define\tVFS_NEEDSGIANT(MP) __extension__\t\t\t\t\\\n({\t\t\t\t\t\t\t\t\t\\\n\tstruct mount *_mp;\t\t\t\t\t\t\\\n\t_mp = (MP);\t\t\t\t\t\t\t\\\n\tVFS_NEEDSGIANT_(_mp);\t\t\t\t\t\t\\\n})\n\n#define\tVFS_LOCK_GIANT(MP) __extension__\t\t\t\t\\\n({\t\t\t\t\t\t\t\t\t\\\n\tint _locked;\t\t\t\t\t\t\t\\\n\tstruct mount *_mp;\t\t\t\t\t\t\\\n\t_mp = (MP);\t\t\t\t\t\t\t\\\n\tif (VFS_NEEDSGIANT_(_mp)) {\t\t\t\t\t\\\n\t\tmtx_lock(&Giant);\t\t\t\t\t\\\n\t\t_locked = 1;\t\t\t\t\t\t\\\n\t} else\t\t\t\t\t\t\t\t\\\n\t\t_locked = 0;\t\t\t\t\t\t\\\n\t_locked;\t\t\t\t\t\t\t\\\n})\n#define\tVFS_UNLOCK_GIANT(locked) do\t\t\t\t\t\\\n{\t\t\t\t\t\t\t\t\t\\\n\tif ((locked))\t\t\t\t\t\t\t\\\n\t\tmtx_unlock(&Giant);\t\t\t\t\t\\\n} while (0)\n#define\tVFS_ASSERT_GIANT(MP) do\t\t\t\t\t\t\\\n{\t\t\t\t\t\t\t\t\t\\\n\tstruct mount *_mp;\t\t\t\t\t\t\\\n\t_mp = (MP);\t\t\t\t\t\t\t\\\n\tif (VFS_NEEDSGIANT_(_mp))\t\t\t\t\t\\\n\t\tmtx_assert(&Giant, MA_OWNED);\t\t\t\t\\\n} while (0)\n\n#define VFS_KNOTE_LOCKED(vp, hint) do\t\t\t\t\t\\\n{\t\t\t\t\t\t\t\t\t\\\n\tif (((vp)->v_vflag & VV_NOKNOTE) == 0)\t\t\t\t\\\n\t\tVN_KNOTE((vp), (hint), KNF_LISTLOCKED);\t\t\t\\\n} while (0)\n\n#define VFS_KNOTE_UNLOCKED(vp, hint) do\t\t\t\t\t\\\n{\t\t\t\t\t\t\t\t\t\\\n\tif (((vp)->v_vflag & VV_NOKNOTE) == 0)\t\t\t\t\\\n\t\tVN_KNOTE((vp), (hint), 0);\t\t\t\t\\\n} while (0)\n\n#include <sys/module.h>\n\n/*\n * Version numbers.\n */\n#define VFS_VERSION_00\t0x19660120\n#define VFS_VERSION\tVFS_VERSION_00\n\n#define VFS_SET(vfsops, fsname, flags) \\\n\tstatic struct vfsconf fsname ## _vfsconf = {\t\t\\\n\t\t.vfc_version = VFS_VERSION,\t\t\t\\\n\t\t.vfc_name = #fsname,\t\t\t\t\\\n\t\t.vfc_vfsops = &vfsops,\t\t\t\t\\\n\t\t.vfc_typenum = -1,\t\t\t\t\\\n\t\t.vfc_flags = flags,\t\t\t\t\\\n\t};\t\t\t\t\t\t\t\\\n\tstatic moduledata_t fsname ## _mod = {\t\t\t\\\n\t\t#fsname,\t\t\t\t\t\\\n\t\tvfs_modevent,\t\t\t\t\t\\\n\t\t& fsname ## _vfsconf\t\t\t\t\\\n\t};\t\t\t\t\t\t\t\\\n\tDECLARE_MODULE(fsname, fsname ## _mod, SI_SUB_VFS, SI_ORDER_MIDDLE)\n\nextern\tchar *mountrootfsname;\n\n/*\n * exported vnode operations\n */\n\nint\tdounmount(struct mount *, int, struct thread *);\n\nint\tkernel_mount(struct mntarg *ma, int flags);\nint\tkernel_vmount(int flags, ...);\nstruct mntarg *mount_arg(struct mntarg *ma, const char *name, const void *val, int len);\nstruct mntarg *mount_argb(struct mntarg *ma, int flag, const char *name);\nstruct mntarg *mount_argf(struct mntarg *ma, const char *name, const char *fmt, ...);\nstruct mntarg *mount_argsu(struct mntarg *ma, const char *name, const void *val, int len);\nvoid\tstatfs_scale_blocks(struct statfs *sf, long max_size);\nstruct vfsconf *vfs_byname(const char *);\nstruct vfsconf *vfs_byname_kld(const char *, struct thread *td, int *);\nvoid\tvfs_mount_destroy(struct mount *);\nvoid\tvfs_event_signal(fsid_t *, u_int32_t, intptr_t);\nvoid\tvfs_freeopts(struct vfsoptlist *opts);\nvoid\tvfs_deleteopt(struct vfsoptlist *opts, const char *name);\nint\tvfs_buildopts(struct uio *auio, struct vfsoptlist **options);\nint\tvfs_flagopt(struct vfsoptlist *opts, const char *name, uint64_t *w,\n\t    uint64_t val);\nint\tvfs_getopt(struct vfsoptlist *, const char *, void **, int *);\nint\tvfs_getopt_pos(struct vfsoptlist *opts, const char *name);\nchar\t*vfs_getopts(struct vfsoptlist *, const char *, int *error);\nint\tvfs_copyopt(struct vfsoptlist *, const char *, void *, int);\nint\tvfs_filteropt(struct vfsoptlist *, const char **legal);\nvoid\tvfs_opterror(struct vfsoptlist *opts, const char *fmt, ...);\nint\tvfs_scanopt(struct vfsoptlist *opts, const char *name, const char *fmt, ...);\nint\tvfs_setopt(struct vfsoptlist *opts, const char *name, void *value,\n\t    int len);\nint\tvfs_setopt_part(struct vfsoptlist *opts, const char *name, void *value,\n\t    int len);\nint\tvfs_setopts(struct vfsoptlist *opts, const char *name,\n\t    const char *value);\nint\tvfs_setpublicfs\t\t\t    /* set publicly exported fs */\n\t    (struct mount *, struct netexport *, struct export_args *);\nvoid\tvfs_msync(struct mount *, int);\nint\tvfs_busy(struct mount *, int);\nint\tvfs_export\t\t\t /* process mount export info */\n\t    (struct mount *, struct export_args *);\nvoid\tvfs_allocate_syncvnode(struct mount *);\nvoid\tvfs_deallocate_syncvnode(struct mount *);\nint\tvfs_donmount(struct thread *td, int fsflags, struct uio *fsoptions);\nvoid\tvfs_getnewfsid(struct mount *);\nstruct cdev *vfs_getrootfsid(struct mount *);\nstruct\tmount *vfs_getvfs(fsid_t *);      /* return vfs given fsid */\nstruct\tmount *vfs_busyfs(fsid_t *);\nint\tvfs_modevent(module_t, int, void *);\nvoid\tvfs_mount_error(struct mount *, const char *, ...);\nvoid\tvfs_mountroot(void);\t\t\t/* mount our root filesystem */\nvoid\tvfs_mountedfrom(struct mount *, const char *from);\nvoid\tvfs_oexport_conv(const struct oexport_args *oexp,\n\t    struct export_args *exp);\nvoid\tvfs_ref(struct mount *);\nvoid\tvfs_rel(struct mount *);\nstruct mount *vfs_mount_alloc(struct vnode *, struct vfsconf *, const char *,\n\t    struct ucred *);\nint\tvfs_suser(struct mount *, struct thread *);\nvoid\tvfs_unbusy(struct mount *);\nvoid\tvfs_unmountall(void);\nextern\tTAILQ_HEAD(mntlist, mount) mountlist;\t/* mounted filesystem list */\nextern\tstruct mtx mountlist_mtx;\nextern\tstruct nfs_public nfs_pub;\n\n/*\n * Declarations for these vfs default operations are located in\n * kern/vfs_default.c, they should be used instead of making \"dummy\"\n * functions or casting entries in the VFS op table to \"enopnotsupp()\".\n */\nvfs_root_t\t\tvfs_stdroot;\nvfs_quotactl_t\t\tvfs_stdquotactl;\nvfs_statfs_t\t\tvfs_stdstatfs;\nvfs_sync_t\t\tvfs_stdsync;\nvfs_sync_t\t\tvfs_stdnosync;\nvfs_vget_t\t\tvfs_stdvget;\nvfs_fhtovp_t\t\tvfs_stdfhtovp;\nvfs_checkexp_t\t\tvfs_stdcheckexp;\nvfs_init_t\t\tvfs_stdinit;\nvfs_uninit_t\t\tvfs_stduninit;\nvfs_extattrctl_t\tvfs_stdextattrctl;\nvfs_sysctl_t\t\tvfs_stdsysctl;\n\n#else /* !_KERNEL */\n\n#include <sys/cdefs.h>\n\nstruct stat;\n\n__BEGIN_DECLS\nint\tfhopen(const struct fhandle *, int);\nint\tfhstat(const struct fhandle *, struct stat *);\nint\tfhstatfs(const struct fhandle *, struct statfs *);\nint\tfstatfs(int, struct statfs *);\nint\tgetfh(const char *, fhandle_t *);\nint\tgetfsstat(struct statfs *, long, int);\nint\tgetmntinfo(struct statfs **, int);\nint\tlgetfh(const char *, fhandle_t *);\nint\tmount(const char *, const char *, int, void *);\nint\tnmount(struct iovec *, unsigned int, int);\nint\tstatfs(const char *, struct statfs *);\nint\tunmount(const char *, int);\n\n/* C library stuff */\nint\tgetvfsbyname(const char *, struct xvfsconf *);\n__END_DECLS\n\n#endif /* _KERNEL */\n\n#endif /* !_SYS_MOUNT_H_ */\n"
  },
  {
    "path": "freebsd-headers/sys/mouse.h",
    "content": "/*-\n * Copyright (c) 1992, 1993 Erik Forsberg.\n * Copyright (c) 1996, 1997 Kazutaka YOKOTA\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n *\n * THIS SOFTWARE IS PROVIDED BY ``AS IS'' AND ANY EXPRESS OR IMPLIED\n * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF\n * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN\n * NO EVENT SHALL I BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,\n * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,\n * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF\n * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING\n * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\n * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/sys/mouse.h 165335 2006-12-18 18:48:28Z keramida $\n */\n\n#ifndef _SYS_MOUSE_H_\n#define _SYS_MOUSE_H_\n\n#include <sys/types.h>\n#include <sys/ioccom.h>\n\n/* ioctls */\n#define MOUSE_GETSTATUS\t\t_IOR('M', 0, mousestatus_t)\n#define MOUSE_GETHWINFO\t\t_IOR('M', 1, mousehw_t)\n#define MOUSE_GETMODE\t\t_IOR('M', 2, mousemode_t)\n#define MOUSE_SETMODE\t\t_IOW('M', 3, mousemode_t)\n#define MOUSE_GETLEVEL\t\t_IOR('M', 4, int)\n#define MOUSE_SETLEVEL\t\t_IOW('M', 5, int)\n#define MOUSE_GETVARS\t\t_IOR('M', 6, mousevar_t)\n#define MOUSE_SETVARS\t\t_IOW('M', 7, mousevar_t)\n#define MOUSE_READSTATE\t\t_IOWR('M', 8, mousedata_t)\n#define MOUSE_READDATA\t\t_IOWR('M', 9, mousedata_t)\n\n#ifdef notyet\n#define MOUSE_SETRESOLUTION\t_IOW('M', 10, int)\n#define MOUSE_SETSCALING\t_IOW('M', 11, int)\n#define MOUSE_SETRATE\t\t_IOW('M', 12, int)\n#define MOUSE_GETHWID\t\t_IOR('M', 13, int)\n#endif\n\n#define MOUSE_SYN_GETHWINFO\t_IOR('M', 100, synapticshw_t)\n\n/* mouse status block */\ntypedef struct mousestatus {\n    int     flags;\t\t/* state change flags */\n    int     button;\t\t/* button status */\n    int     obutton;\t\t/* previous button status */\n    int     dx;\t\t\t/* x movement */\n    int     dy;\t\t\t/* y movement */\n    int     dz;\t\t\t/* z movement */\n} mousestatus_t;\n\n/* button */\n#define MOUSE_BUTTON1DOWN\t0x0001\t/* left */\n#define MOUSE_BUTTON2DOWN\t0x0002\t/* middle */\n#define MOUSE_BUTTON3DOWN\t0x0004\t/* right */\n#define MOUSE_BUTTON4DOWN\t0x0008\n#define MOUSE_BUTTON5DOWN\t0x0010\n#define MOUSE_BUTTON6DOWN\t0x0020\n#define MOUSE_BUTTON7DOWN\t0x0040\n#define MOUSE_BUTTON8DOWN\t0x0080\n#define MOUSE_MAXBUTTON\t\t31\n#define MOUSE_STDBUTTONS\t0x0007\t\t/* buttons 1-3 */\n#define MOUSE_EXTBUTTONS\t0x7ffffff8\t/* the others (28 of them!) */\n#define MOUSE_BUTTONS\t\t(MOUSE_STDBUTTONS | MOUSE_EXTBUTTONS)\n\n/* flags */\n#define MOUSE_STDBUTTONSCHANGED\tMOUSE_STDBUTTONS\n#define MOUSE_EXTBUTTONSCHANGED\tMOUSE_EXTBUTTONS\n#define MOUSE_BUTTONSCHANGED\tMOUSE_BUTTONS\n#define MOUSE_POSCHANGED\t0x80000000\n\ntypedef struct mousehw {\n\tint buttons;\t\t/* -1 if unknown */\n\tint iftype;\t\t/* MOUSE_IF_XXX */\n\tint type;\t\t/* mouse/track ball/pad... */\n\tint model;\t\t/* I/F dependent model ID: MOUSE_MODEL_XXX */\n\tint hwid;\t\t/* I/F dependent hardware ID\n\t\t\t\t * for the PS/2 mouse, it will be PSM_XXX_ID \n\t\t\t\t */\n} mousehw_t;\n\ntypedef struct synapticshw {\n\tint infoMajor;\n\tint infoMinor;\n\tint infoRot180;\n\tint infoPortrait;\n\tint infoSensor;\n\tint infoHardware;\n\tint infoNewAbs;\n\tint capPen;\n\tint infoSimplC;\n\tint infoGeometry;\n\tint capExtended;\n\tint capSleep;\n\tint capFourButtons;\n\tint capMultiFinger;\n\tint capPalmDetect;\n\tint capPassthrough;\n} synapticshw_t;\n\n/* iftype */\n#define MOUSE_IF_UNKNOWN\t(-1)\n#define MOUSE_IF_SERIAL\t\t0\n#define MOUSE_IF_BUS\t\t1\n#define MOUSE_IF_INPORT\t\t2\n#define MOUSE_IF_PS2\t\t3\n#define MOUSE_IF_SYSMOUSE\t4\n#define MOUSE_IF_USB\t\t5\n\n/* type */\n#define MOUSE_UNKNOWN\t\t(-1)\t/* should be treated as a mouse */\n#define MOUSE_MOUSE\t\t0\n#define MOUSE_TRACKBALL\t\t1\n#define MOUSE_STICK\t\t2\n#define MOUSE_PAD\t\t3\n\n/* model */\n#define MOUSE_MODEL_UNKNOWN\t\t(-1)\n#define MOUSE_MODEL_GENERIC\t\t0\n#define MOUSE_MODEL_GLIDEPOINT\t\t1\n#define MOUSE_MODEL_NETSCROLL\t\t2\n#define MOUSE_MODEL_NET\t\t\t3\n#define MOUSE_MODEL_INTELLI\t\t4\n#define MOUSE_MODEL_THINK\t\t5\n#define MOUSE_MODEL_EASYSCROLL\t\t6\n#define MOUSE_MODEL_MOUSEMANPLUS\t7\n#define MOUSE_MODEL_KIDSPAD\t\t8\n#define MOUSE_MODEL_VERSAPAD\t\t9\n#define MOUSE_MODEL_EXPLORER\t\t10\n#define MOUSE_MODEL_4D\t\t\t11\n#define MOUSE_MODEL_4DPLUS\t\t12\n#define MOUSE_MODEL_SYNAPTICS\t\t13\n\ntypedef struct mousemode {\n\tint protocol;\t\t/* MOUSE_PROTO_XXX */\n\tint rate;\t\t/* report rate (per sec), -1 if unknown */\n\tint resolution;\t\t/* MOUSE_RES_XXX, -1 if unknown */\n\tint accelfactor;\t/* accelation factor (must be 1 or greater) */\n\tint level;\t\t/* driver operation level */\n\tint packetsize;\t\t/* the length of the data packet */\n\tunsigned char syncmask[2]; /* sync. data bits in the header byte */\n} mousemode_t;\n\n/* protocol */\n/*\n * Serial protocols:\n *   Microsoft, MouseSystems, Logitech, MM series, MouseMan, Hitachi Tablet,\n *   GlidePoint, IntelliMouse, Thinking Mouse, MouseRemote, Kidspad,\n *   VersaPad\n * Bus mouse protocols:\n *   bus, InPort\n * PS/2 mouse protocol:\n *   PS/2\n */\n#define MOUSE_PROTO_UNKNOWN\t(-1)\n#define MOUSE_PROTO_MS\t\t0\t/* Microsoft Serial, 3 bytes */\n#define MOUSE_PROTO_MSC\t\t1\t/* Mouse Systems, 5 bytes */\n#define MOUSE_PROTO_LOGI\t2\t/* Logitech, 3 bytes */\n#define MOUSE_PROTO_MM\t\t3\t/* MM series, 3 bytes */\n#define MOUSE_PROTO_LOGIMOUSEMAN 4\t/* Logitech MouseMan 3/4 bytes */\n#define MOUSE_PROTO_BUS\t\t5\t/* MS/Logitech bus mouse */\n#define MOUSE_PROTO_INPORT\t6\t/* MS/ATI InPort mouse */\n#define MOUSE_PROTO_PS2\t\t7\t/* PS/2 mouse, 3 bytes */\n#define MOUSE_PROTO_HITTAB\t8\t/* Hitachi Tablet 3 bytes */\n#define MOUSE_PROTO_GLIDEPOINT\t9\t/* ALPS GlidePoint, 3/4 bytes */\n#define MOUSE_PROTO_INTELLI\t10\t/* MS IntelliMouse, 4 bytes */\n#define MOUSE_PROTO_THINK\t11\t/* Kensington Thinking Mouse, 3/4 bytes */\n#define MOUSE_PROTO_SYSMOUSE\t12\t/* /dev/sysmouse */\n#define MOUSE_PROTO_X10MOUSEREM\t13\t/* X10 MouseRemote, 3 bytes */\n#define MOUSE_PROTO_KIDSPAD\t14\t/* Genius Kidspad */\n#define MOUSE_PROTO_VERSAPAD\t15\t/* Interlink VersaPad, 6 bytes */\n#define MOUSE_PROTO_JOGDIAL\t16\t/* Vaio's JogDial */\n#define MOUSE_PROTO_GTCO_DIGIPAD\t17\n\n#define MOUSE_RES_UNKNOWN\t(-1)\n#define MOUSE_RES_DEFAULT\t0\n#define MOUSE_RES_LOW\t\t(-2)\n#define MOUSE_RES_MEDIUMLOW\t(-3)\n#define MOUSE_RES_MEDIUMHIGH\t(-4)\n#define MOUSE_RES_HIGH\t\t(-5)\n\ntypedef struct mousedata {\n\tint len;\t\t/* # of data in the buffer */\n\tint buf[16];\t\t/* data buffer */\n} mousedata_t;\n\n#if (defined(MOUSE_GETVARS))\n\ntypedef struct mousevar {\n\tint var[16];\n} mousevar_t;\n\n/* magic numbers in var[0] */\n#define MOUSE_VARS_PS2_SIG\t0x00325350\t/* 'PS2' */\n#define MOUSE_VARS_BUS_SIG\t0x00535542\t/* 'BUS' */\n#define MOUSE_VARS_INPORT_SIG\t0x00504e49\t/* 'INP' */\n\n#endif /* MOUSE_GETVARS */\n\n/* Synaptics Touchpad */\n#define MOUSE_SYNAPTICS_PACKETSIZE\t6\t/* '3' works better */\n\n/* Microsoft Serial mouse data packet */\n#define MOUSE_MSS_PACKETSIZE\t3\n#define MOUSE_MSS_SYNCMASK\t0x40\n#define MOUSE_MSS_SYNC\t\t0x40\n#define MOUSE_MSS_BUTTONS\t0x30\n#define MOUSE_MSS_BUTTON1DOWN\t0x20\t/* left */\n#define MOUSE_MSS_BUTTON2DOWN\t0x00\t/* no middle button */\n#define MOUSE_MSS_BUTTON3DOWN\t0x10\t/* right */\n\n/* Logitech MouseMan data packet (M+ protocol) */\n#define MOUSE_LMAN_BUTTON2DOWN\t0x20\t/* middle button, the 4th byte */\n\n/* ALPS GlidePoint extension (variant of M+ protocol) */\n#define MOUSE_ALPS_BUTTON2DOWN\t0x20\t/* middle button, the 4th byte */\n#define MOUSE_ALPS_TAP\t\t0x10\t/* `tapping' action, the 4th byte */\n\n/* Kinsington Thinking Mouse extension (variant of M+ protocol) */\n#define MOUSE_THINK_BUTTON2DOWN 0x20\t/* lower-left button, the 4th byte */\n#define MOUSE_THINK_BUTTON4DOWN 0x10\t/* lower-right button, the 4th byte */\n\n/* MS IntelliMouse (variant of MS Serial) */\n#define MOUSE_INTELLI_PACKETSIZE 4\n#define MOUSE_INTELLI_BUTTON2DOWN 0x10\t/* middle button in the 4th byte */\n\n/* Mouse Systems Corp. mouse data packet */\n#define MOUSE_MSC_PACKETSIZE\t5\n#define MOUSE_MSC_SYNCMASK\t0xf8\n#define MOUSE_MSC_SYNC\t\t0x80\n#define MOUSE_MSC_BUTTONS\t0x07\n#define MOUSE_MSC_BUTTON1UP\t0x04\t/* left */\n#define MOUSE_MSC_BUTTON2UP\t0x02\t/* middle */\n#define MOUSE_MSC_BUTTON3UP\t0x01\t/* right */\n#define MOUSE_MSC_MAXBUTTON\t3\n\n/* MM series mouse data packet */\n#define MOUSE_MM_PACKETSIZE\t3\n#define MOUSE_MM_SYNCMASK\t0xe0\n#define MOUSE_MM_SYNC\t\t0x80\n#define MOUSE_MM_BUTTONS\t0x07\n#define MOUSE_MM_BUTTON1DOWN\t0x04\t/* left */\n#define MOUSE_MM_BUTTON2DOWN\t0x02\t/* middle */\n#define MOUSE_MM_BUTTON3DOWN\t0x01\t/* right */\n#define MOUSE_MM_XPOSITIVE\t0x10\n#define MOUSE_MM_YPOSITIVE\t0x08\n\n/* PS/2 mouse data packet */\n#define MOUSE_PS2_PACKETSIZE\t3\n#define MOUSE_PS2_SYNCMASK\t0xc8\n#define MOUSE_PS2_SYNC\t\t0x08\n#define MOUSE_PS2_BUTTONS\t0x07\t/* 0x03 for 2 button mouse */\n#define MOUSE_PS2_BUTTON1DOWN\t0x01\t/* left */\n#define MOUSE_PS2_BUTTON2DOWN\t0x04\t/* middle */\n#define MOUSE_PS2_BUTTON3DOWN\t0x02\t/* right */\n#define MOUSE_PS2_TAP\t\tMOUSE_PS2_SYNC /* GlidePoint (PS/2) `tapping'\n\t\t\t\t\t        * Yes! this is the same bit \n\t\t\t\t\t\t* as SYNC!\n\t\t\t\t\t \t*/\n\n#define MOUSE_PS2_XNEG\t\t0x10\n#define MOUSE_PS2_YNEG\t\t0x20\n#define MOUSE_PS2_XOVERFLOW\t0x40\n#define MOUSE_PS2_YOVERFLOW\t0x80\n\n/* Logitech MouseMan+ (PS/2) data packet (PS/2++ protocol) */\n#define MOUSE_PS2PLUS_SYNCMASK\t0x48\n#define MOUSE_PS2PLUS_SYNC\t0x48\n#define MOUSE_PS2PLUS_ZNEG\t0x08\t/* sign bit */\n#define MOUSE_PS2PLUS_BUTTON4DOWN 0x10\t/* 4th button on MouseMan+ */\n#define MOUSE_PS2PLUS_BUTTON5DOWN 0x20\n\n/* IBM ScrollPoint (PS/2) also uses PS/2++ protocol */\n#define MOUSE_SPOINT_ZNEG\t0x80\t/* sign bits */\n#define MOUSE_SPOINT_WNEG\t0x08\n\n/* MS IntelliMouse (PS/2) data packet */\n#define MOUSE_PS2INTELLI_PACKETSIZE 4\n/* some compatible mice have additional buttons */\n#define MOUSE_PS2INTELLI_BUTTON4DOWN 0x40\n#define MOUSE_PS2INTELLI_BUTTON5DOWN 0x80\n\n/* MS IntelliMouse Explorer (PS/2) data packet (variation of IntelliMouse) */\n#define MOUSE_EXPLORER_ZNEG\t0x08\t/* sign bit */\n/* IntelliMouse Explorer has additional button data in the fourth byte */\n#define MOUSE_EXPLORER_BUTTON4DOWN 0x10\n#define MOUSE_EXPLORER_BUTTON5DOWN 0x20\n\n/* Interlink VersaPad (serial I/F) data packet */\n#define MOUSE_VERSA_PACKETSIZE\t6\n#define MOUSE_VERSA_IN_USE\t0x04\n#define MOUSE_VERSA_SYNCMASK\t0xc3\n#define MOUSE_VERSA_SYNC\t0xc0\n#define MOUSE_VERSA_BUTTONS\t0x30\n#define MOUSE_VERSA_BUTTON1DOWN\t0x20\t/* left */\n#define MOUSE_VERSA_BUTTON2DOWN\t0x00\t/* middle */\n#define MOUSE_VERSA_BUTTON3DOWN\t0x10\t/* right */\n#define MOUSE_VERSA_TAP\t\t0x08\n\n/* Interlink VersaPad (PS/2 I/F) data packet */\n#define MOUSE_PS2VERSA_PACKETSIZE\t6\n#define MOUSE_PS2VERSA_IN_USE\t\t0x10\n#define MOUSE_PS2VERSA_SYNCMASK\t\t0xe8\n#define MOUSE_PS2VERSA_SYNC\t\t0xc8\n#define MOUSE_PS2VERSA_BUTTONS\t\t0x05\n#define MOUSE_PS2VERSA_BUTTON1DOWN\t0x04\t/* left */\n#define MOUSE_PS2VERSA_BUTTON2DOWN\t0x00\t/* middle */\n#define MOUSE_PS2VERSA_BUTTON3DOWN\t0x01\t/* right */\n#define MOUSE_PS2VERSA_TAP\t\t0x02\n\n/* A4 Tech 4D Mouse (PS/2) data packet */\n#define MOUSE_4D_PACKETSIZE\t\t3\t\n#define MOUSE_4D_WHEELBITS\t\t0xf0\n\n/* A4 Tech 4D+ Mouse (PS/2) data packet */\n#define MOUSE_4DPLUS_PACKETSIZE\t\t3\t\n#define MOUSE_4DPLUS_ZNEG\t\t0x04\t/* sign bit */\n#define MOUSE_4DPLUS_BUTTON4DOWN\t0x08\n\n/* sysmouse extended data packet */\n/*\n * /dev/sysmouse sends data in two formats, depending on the protocol\n * level.  At the level 0, format is exactly the same as MousSystems'\n * five byte packet.  At the level 1, the first five bytes are the same\n * as at the level 0.  There are additional three bytes which shows\n * `dz' and the states of additional buttons.  `dz' is expressed as the\n * sum of the byte 5 and 6 which contain signed seven bit values.\n * The states of the button 4 though 10 are in the bit 0 though 6 in \n * the byte 7 respectively: 1 indicates the button is up.\n */\n#define MOUSE_SYS_PACKETSIZE\t8\n#define MOUSE_SYS_SYNCMASK\t0xf8\n#define MOUSE_SYS_SYNC\t\t0x80\n#define MOUSE_SYS_BUTTON1UP\t0x04\t/* left, 1st byte */\n#define MOUSE_SYS_BUTTON2UP\t0x02\t/* middle, 1st byte */\n#define MOUSE_SYS_BUTTON3UP\t0x01\t/* right, 1st byte */\n#define MOUSE_SYS_BUTTON4UP\t0x0001\t/* 7th byte */\n#define MOUSE_SYS_BUTTON5UP\t0x0002\n#define MOUSE_SYS_BUTTON6UP\t0x0004\n#define MOUSE_SYS_BUTTON7UP\t0x0008\n#define MOUSE_SYS_BUTTON8UP\t0x0010\n#define MOUSE_SYS_BUTTON9UP\t0x0020\n#define MOUSE_SYS_BUTTON10UP\t0x0040\n#define MOUSE_SYS_MAXBUTTON\t10\n#define MOUSE_SYS_STDBUTTONS\t0x07\n#define MOUSE_SYS_EXTBUTTONS\t0x7f\t/* the others */\n\n/* Mouse remote socket */\n#define _PATH_MOUSEREMOTE\t\"/var/run/MouseRemote\"\n\n#endif /* _SYS_MOUSE_H_ */\n"
  },
  {
    "path": "freebsd-headers/sys/mpt_ioctl.h",
    "content": "/*-\n * Copyright (c) 2008 Yahoo!, Inc.\n * All rights reserved.\n * Written by: John Baldwin <jhb@FreeBSD.org>\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. Neither the name of the author nor the names of any co-contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * LSI MPT-Fusion Host Adapter FreeBSD userland interface\n *\n * $FreeBSD: release/9.0.0/sys/sys/mpt_ioctl.h 178814 2008-05-06 20:49:53Z jhb $\n */\n\n#ifndef _MPT_IOCTL_H_\n#define\t_MPT_IOCTL_H_\n\n#include <dev/mpt/mpilib/mpi_type.h>\n#include <dev/mpt/mpilib/mpi.h>\n#include <dev/mpt/mpilib/mpi_cnfg.h>\n\n/*\n * For the read header requests, the header should include the page\n * type or extended page type, page number, and page version.  The\n * buffer and length are unused.  The completed header is returned in\n * the 'header' member.\n *\n * For the read page and write page requests, 'buf' should point to a\n * buffer of 'len' bytes which holds the entire page (including the\n * header).\n *\n * All requests specify the page address in 'page_address'.\n */\nstruct mpt_cfg_page_req {\t\n\tCONFIG_PAGE_HEADER header;\n\tuint32_t page_address;\n\tvoid\t*buf;\n\tint\tlen;\n\tuint16_t ioc_status;\n};\n\nstruct mpt_ext_cfg_page_req {\n\tCONFIG_EXTENDED_PAGE_HEADER header;\n\tuint32_t page_address;\n\tvoid\t*buf;\n\tint\tlen;\n\tuint16_t ioc_status;\n};\n\nstruct mpt_raid_action {\n\tuint8_t action;\n\tuint8_t volume_bus;\n\tuint8_t volume_id;\n\tuint8_t phys_disk_num;\n\tuint32_t action_data_word;\n\tvoid *buf;\n\tint len;\n\tuint32_t volume_status;\n\tuint32_t action_data[4];\n\tuint16_t action_status;\n\tuint16_t ioc_status;\n\tuint8_t write;\n};\n\n#define\tMPTIO_READ_CFG_HEADER\t_IOWR('M', 100, struct mpt_cfg_page_req)\n#define\tMPTIO_READ_CFG_PAGE\t_IOWR('M', 101, struct mpt_cfg_page_req)\n#define\tMPTIO_READ_EXT_CFG_HEADER _IOWR('M', 102, struct mpt_ext_cfg_page_req)\n#define\tMPTIO_READ_EXT_CFG_PAGE\t_IOWR('M', 103, struct mpt_ext_cfg_page_req)\n#define\tMPTIO_WRITE_CFG_PAGE\t_IOWR('M', 104, struct mpt_cfg_page_req)\n#define\tMPTIO_RAID_ACTION\t_IOWR('M', 105, struct mpt_raid_action)\n\n#if defined(__amd64__)\nstruct mpt_cfg_page_req32 {\n\tCONFIG_PAGE_HEADER header;\n\tuint32_t page_address;\n\tuint32_t buf;\n\tint\tlen;\t\n\tuint16_t ioc_status;\n};\n\nstruct mpt_ext_cfg_page_req32 {\n\tCONFIG_EXTENDED_PAGE_HEADER header;\n\tuint32_t page_address;\n\tuint32_t buf;\n\tint\tlen;\n\tuint16_t ioc_status;\n};\n\nstruct mpt_raid_action32 {\n\tuint8_t action;\n\tuint8_t volume_bus;\n\tuint8_t volume_id;\n\tuint8_t phys_disk_num;\n\tuint32_t action_data_word;\n\tuint32_t buf;\n\tint len;\n\tuint32_t volume_status;\n\tuint32_t action_data[4];\n\tuint16_t action_status;\n\tuint16_t ioc_status;\n\tuint8_t write;\n};\n\n#define\tMPTIO_READ_CFG_HEADER32\t_IOWR('M', 100, struct mpt_cfg_page_req32)\n#define\tMPTIO_READ_CFG_PAGE32\t_IOWR('M', 101, struct mpt_cfg_page_req32)\n#define\tMPTIO_READ_EXT_CFG_HEADER32 _IOWR('M', 102, struct mpt_ext_cfg_page_req32)\n#define\tMPTIO_READ_EXT_CFG_PAGE32 _IOWR('M', 103, struct mpt_ext_cfg_page_req32)\n#define\tMPTIO_WRITE_CFG_PAGE32\t_IOWR('M', 104, struct mpt_cfg_page_req32)\n#define\tMPTIO_RAID_ACTION32\t_IOWR('M', 105, struct mpt_raid_action32)\n#endif\n\n#endif /* !_MPT_IOCTL_H_ */\n"
  },
  {
    "path": "freebsd-headers/sys/mqueue.h",
    "content": "/*-\n * Copyright (c) 2005 David Xu <davidxu@freebsd.org>\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/sys/mqueue.h 152948 2005-11-30 05:12:03Z davidxu $\n */\n\n#ifndef _SYS_MQUEUE_H_\n#define _SYS_MQUEUE_H_\n\nstruct mq_attr {\n\tlong\tmq_flags;\t/* Message queue flags. */\n\tlong\tmq_maxmsg;\t/* Maximum number of messages. */\n\tlong\tmq_msgsize;\t/* Maximum message size. */\n\tlong\tmq_curmsgs;\t/* Number of messages currently queued. */\n\tlong    __reserved[4];  /* Ignored for input, zeroed for output */\n};\n\n#ifdef _KERNEL\nstruct thread;\nstruct file;\nextern void\t(*mq_fdclose)(struct thread *td, int fd, struct file *fp);\n#endif\n#endif\n"
  },
  {
    "path": "freebsd-headers/sys/msg.h",
    "content": "/* $FreeBSD: release/9.0.0/sys/sys/msg.h 220388 2011-04-06 16:59:54Z trasz $ */\n/*\t$NetBSD: msg.h,v 1.4 1994/06/29 06:44:43 cgd Exp $\t*/\n\n/*-\n * SVID compatible msg.h file\n *\n * Author:  Daniel Boulet\n *\n * Copyright 1993 Daniel Boulet and RTMX Inc.\n *\n * This system call was implemented by Daniel Boulet under contract from RTMX.\n *\n * Redistribution and use in source forms, with and without modification,\n * are permitted provided that this entire comment appears intact.\n *\n * Redistribution in binary form may occur without any restrictions.\n * Obviously, it would be nice if you gave credit where credit is due\n * but requiring it would be too onerous.\n *\n * This software is provided ``AS IS'' without any warranties of any kind.\n */\n\n#ifndef _SYS_MSG_H_\n#define _SYS_MSG_H_\n\n#include <sys/cdefs.h>\n#include <sys/_types.h>\n#include <sys/ipc.h>\n\n/*\n * The MSG_NOERROR identifier value, the msqid_ds struct and the msg struct\n * are as defined by the SV API Intel 386 Processor Supplement.\n */\n\n#define MSG_NOERROR\t010000\t\t/* don't complain about too long msgs */\n\ntypedef\tunsigned long\tmsglen_t;\ntypedef\tunsigned long\tmsgqnum_t;\n\n#ifndef _PID_T_DECLARED\ntypedef\t__pid_t\t\tpid_t;\n#define\t_PID_T_DECLARED\n#endif\n\n#ifndef _SIZE_T_DECLARED\ntypedef\t__size_t\tsize_t;\n#define\t_SIZE_T_DECLARED\n#endif\n\n#ifndef _SSIZE_T_DECLARED\ntypedef\t__ssize_t\tssize_t;\n#define\t_SSIZE_T_DECLARED\n#endif\n\n#ifndef _TIME_T_DECLARED\ntypedef\t__time_t\ttime_t;\n#define\t_TIME_T_DECLARED\n#endif\n\n#if defined(COMPAT_FREEBSD4) || defined(COMPAT_FREEBSD5) || \\\n    defined(COMPAT_FREEBSD6) || defined(COMPAT_FREEBSD7)\nstruct msqid_ds_old {\n\tstruct\tipc_perm_old msg_perm;\t/* msg queue permission bits */\n\tstruct\tmsg *msg_first;\t/* first message in the queue */\n\tstruct\tmsg *msg_last;\t/* last message in the queue */\n\tmsglen_t msg_cbytes;\t/* number of bytes in use on the queue */\n\tmsgqnum_t msg_qnum;\t/* number of msgs in the queue */\n\tmsglen_t msg_qbytes;\t/* max # of bytes on the queue */\n\tpid_t\tmsg_lspid;\t/* pid of last msgsnd() */\n\tpid_t\tmsg_lrpid;\t/* pid of last msgrcv() */\n\ttime_t\tmsg_stime;\t/* time of last msgsnd() */\n\tlong\tmsg_pad1;\n\ttime_t\tmsg_rtime;\t/* time of last msgrcv() */\n\tlong\tmsg_pad2;\n\ttime_t\tmsg_ctime;\t/* time of last msgctl() */\n\tlong\tmsg_pad3;\n\tlong\tmsg_pad4[4];\n};\n#endif\n\n/*\n * XXX there seems to be no prefix reserved for this header, so the name\n * \"msg\" in \"struct msg\" and the names of all of the nonstandard members\n * (mainly \"msg_pad*) are namespace pollution.\n */\n\nstruct msqid_ds {\n\tstruct\tipc_perm msg_perm;\t/* msg queue permission bits */\n\tstruct\tmsg *msg_first;\t/* first message in the queue */\n\tstruct\tmsg *msg_last;\t/* last message in the queue */\n\tmsglen_t msg_cbytes;\t/* number of bytes in use on the queue */\n\tmsgqnum_t msg_qnum;\t/* number of msgs in the queue */\n\tmsglen_t msg_qbytes;\t/* max # of bytes on the queue */\n\tpid_t\tmsg_lspid;\t/* pid of last msgsnd() */\n\tpid_t\tmsg_lrpid;\t/* pid of last msgrcv() */\n\ttime_t\tmsg_stime;\t/* time of last msgsnd() */\n\ttime_t\tmsg_rtime;\t/* time of last msgrcv() */\n\ttime_t\tmsg_ctime;\t/* time of last msgctl() */\n};\n\n#if __BSD_VISIBLE\n/*\n * Structure describing a message.  The SVID doesn't suggest any\n * particular name for this structure.  There is a reference in the\n * msgop man page that reads \"The structure mymsg is an example of what\n * this user defined buffer might look like, and includes the following\n * members:\".  This sentence is followed by two lines equivalent\n * to the mtype and mtext field declarations below.  It isn't clear\n * if \"mymsg\" refers to the name of the structure type or the name of an\n * instance of the structure...\n */\nstruct mymsg {\n\tlong\tmtype;\t\t/* message type (+ve integer) */\n\tchar\tmtext[1];\t/* message body */\n};\n#endif\n\n#ifdef _KERNEL\n\nstruct msg {\n\tstruct\tmsg *msg_next;  /* next msg in the chain */\n\tlong\tmsg_type; \t/* type of this message */\n\t\t\t\t/* >0 -> type of this message */\n\t\t\t\t/* 0 -> free header */\n\tu_short\tmsg_ts;\t\t/* size of this message */\n\tshort\tmsg_spot;\t/* location of start of msg in buffer */\n\tstruct\tlabel *label;\t/* MAC Framework label */\n};\n\n/*\n * Based on the configuration parameters described in an SVR2 (yes, two)\n * config(1m) man page.\n *\n * Each message is broken up and stored in segments that are msgssz bytes\n * long.  For efficiency reasons, this should be a power of two.  Also,\n * it doesn't make sense if it is less than 8 or greater than about 256.\n * Consequently, msginit in kern/sysv_msg.c checks that msgssz is a power of\n * two between 8 and 1024 inclusive (and panic's if it isn't).\n */\nstruct msginfo {\n\tint\tmsgmax,\t\t/* max chars in a message */\n\t\tmsgmni,\t\t/* max message queue identifiers */\n\t\tmsgmnb,\t\t/* max chars in a queue */\n\t\tmsgtql,\t\t/* max messages in system */\n\t\tmsgssz,\t\t/* size of a message segment (see notes above) */\n\t\tmsgseg;\t\t/* number of message segments */\n};\nextern struct msginfo\tmsginfo;\n\n/*\n * Kernel wrapper for the user-level structure.\n */\nstruct msqid_kernel {\n\t/*\n\t * Data structure exposed to user space.\n\t */\n\tstruct\tmsqid_ds u;\n\n\t/*\n\t * Kernel-private components of the message queue.\n\t */\n\tstruct\tlabel *label;\t/* MAC label */\n\tstruct\tucred *cred;\t/* creator's credentials */\n};\n\n#else /* !_KERNEL */\n\n__BEGIN_DECLS\nint msgctl(int, int, struct msqid_ds *);\nint msgget(key_t, int);\n/* XXX return value should be ssize_t. */\nint msgrcv(int, void *, size_t, long, int);\nint msgsnd(int, const void *, size_t, int);\n#if __BSD_VISIBLE\nint msgsys(int, ...);\n#endif\n__END_DECLS\n\n#endif /* _KERNEL */\n\n#endif /* !_SYS_MSG_H_ */\n"
  },
  {
    "path": "freebsd-headers/sys/msgbuf.h",
    "content": "/*-\n * Copyright (c) 1981, 1984, 1993\n *\tThe Regents of the University of California.  All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 4. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t@(#)msgbuf.h\t8.1 (Berkeley) 6/2/93\n * $FreeBSD: release/9.0.0/sys/sys/msgbuf.h 222537 2011-05-31 17:29:58Z ken $\n */\n\n#ifndef _SYS_MSGBUF_H_\n#define\t_SYS_MSGBUF_H_\n\n#include <sys/lock.h>\n#include <sys/mutex.h>\n\nstruct msgbuf {\n\tchar\t   *msg_ptr;\t\t/* pointer to buffer */\n#define\tMSG_MAGIC\t0x063062\n\tu_int\t   msg_magic;\n\tu_int\t   msg_size;\t\t/* size of buffer area */\n\tu_int\t   msg_wseq;\t\t/* write sequence number */\n\tu_int\t   msg_rseq;\t\t/* read sequence number */\n\tu_int\t   msg_cksum;\t\t/* checksum of contents */\n\tu_int\t   msg_seqmod;\t\t/* range for sequence numbers */\n\tint\t   msg_lastpri;\t\t/* saved priority value */\n\tint\t   msg_needsnl;\t\t/* set when newline needed */\n\tstruct mtx msg_lock;\t\t/* mutex to protect the buffer */\n};\n\n/* Normalise a sequence number or a difference between sequence numbers. */\n#define\tMSGBUF_SEQNORM(mbp, seq)\t(((seq) + (mbp)->msg_seqmod) % \\\n    (mbp)->msg_seqmod)\n#define\tMSGBUF_SEQ_TO_POS(mbp, seq)\t((seq) % (mbp)->msg_size)\n/* Subtract sequence numbers.  Note that only positive values result. */\n#define\tMSGBUF_SEQSUB(mbp, seq1, seq2)\t(MSGBUF_SEQNORM((mbp), (seq1) - (seq2)))\n\n#ifdef _KERNEL\nextern int\tmsgbufsize;\nextern int\tmsgbuftrigger;\nextern struct\tmsgbuf *msgbufp;\nextern struct\tmtx msgbuf_lock;\n\nvoid\tmsgbufinit(void *ptr, int size);\nvoid\tmsgbuf_addchar(struct msgbuf *mbp, int c);\nvoid\tmsgbuf_addstr(struct msgbuf *mbp, int pri, char *str, int filter_cr);\nvoid\tmsgbuf_clear(struct msgbuf *mbp);\nvoid\tmsgbuf_copy(struct msgbuf *src, struct msgbuf *dst);\nint\tmsgbuf_getbytes(struct msgbuf *mbp, char *buf, int buflen);\nint\tmsgbuf_getchar(struct msgbuf *mbp);\nint\tmsgbuf_getcount(struct msgbuf *mbp);\nvoid\tmsgbuf_init(struct msgbuf *mbp, void *ptr, int size);\nint\tmsgbuf_peekbytes(struct msgbuf *mbp, char *buf, int buflen,\n\t    u_int *seqp);\nvoid\tmsgbuf_reinit(struct msgbuf *mbp, void *ptr, int size);\n\n#ifndef MSGBUF_SIZE\n#define\tMSGBUF_SIZE\t(32768 * 2)\n#endif\n#endif /* KERNEL */\n\n#endif /* !_SYS_MSGBUF_H_ */\n"
  },
  {
    "path": "freebsd-headers/sys/mtio.h",
    "content": "/*-\n * Copyright (c) 1982, 1986, 1993\n *\tThe Regents of the University of California.  All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 4. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t@(#)mtio.h\t8.1 (Berkeley) 6/2/93\n * $FreeBSD: release/9.0.0/sys/sys/mtio.h 139825 2005-01-07 02:29:27Z imp $\n */\n\n#ifndef\t_SYS_MTIO_H_\n#define\t_SYS_MTIO_H_\n\n#ifndef _KERNEL\n#include <sys/types.h>\n#endif\n#include <sys/ioccom.h>\n\n/*\n * Structures and definitions for mag tape io control commands\n */\n\n/* structure for MTIOCTOP - mag tape op command */\nstruct mtop {\n\tshort\tmt_op;\t\t/* operations defined below */\n\tint32_t\tmt_count;\t/* how many of them */\n};\n\n/* operations */\n#define MTWEOF\t\t0\t/* write an end-of-file record */\n#define MTFSF\t\t1\t/* forward space file */\n#define MTBSF\t\t2\t/* backward space file */\n#define MTFSR\t\t3\t/* forward space record */\n#define MTBSR\t\t4\t/* backward space record */\n#define MTREW\t\t5\t/* rewind */\n#define MTOFFL\t\t6\t/* rewind and put the drive offline */\n#define MTNOP\t\t7\t/* no operation, sets status only */\n#define MTCACHE\t\t8\t/* enable controller cache */\n#define MTNOCACHE\t9\t/* disable controller cache */\n\n#if defined(__FreeBSD__)\n/* Set block size for device. If device is a variable size dev\t\t*/\n/* a non zero parameter will change the device to a fixed block size\t*/\n/* device with block size set to that of the parameter passed in.\t*/\n/* Resetting the block size to 0 will restore the device to a variable\t*/\n/* block size device. */\n\n#define MTSETBSIZ\t10\n\n/* Set density values for device. Sets the value for the opened mode only. */\n\n#define MTSETDNSTY\t11\n\n#define MTERASE\t\t12\t/* erase to EOM */\n#define MTEOD\t\t13\t/* Space to EOM */\n#define MTCOMP\t\t14\t/* select compression mode 0=off, 1=def */\n#define MTRETENS\t15\t/* re-tension tape */\n#define MTWSS\t\t16\t/* write setmark(s) */\n#define MTFSS\t\t17\t/* forward space setmark */\n#define MTBSS\t\t18\t/* backward space setmark */\n\n#define MT_COMP_ENABLE\t\t0xffffffff\n#define MT_COMP_DISABLED\t0xfffffffe\n#define MT_COMP_UNSUPP\t\t0xfffffffd\n\n/*\n * Values in mt_dsreg that say what the device is doing\n */\n#define\tMTIO_DSREG_NIL\t0\t/* Unknown */\n#define\tMTIO_DSREG_REST\t1\t/* Doing Nothing */\n#define\tMTIO_DSREG_RBSY\t2\t/* Communicating with tape (but no motion) */\n#define\tMTIO_DSREG_WR\t20\t/* Writing */\n#define\tMTIO_DSREG_FMK\t21\t/* Writing Filemarks */\n#define\tMTIO_DSREG_ZER\t22\t/* Erasing */\n#define\tMTIO_DSREG_RD\t30\t/* Reading */\n#define\tMTIO_DSREG_FWD\t40\t/* Spacing Forward */\n#define\tMTIO_DSREG_REV\t41\t/* Spacing Reverse */\n#define\tMTIO_DSREG_POS\t42\t/* Hardware Positioning (direction unknown) */\n#define\tMTIO_DSREG_REW\t43\t/* Rewinding */\n#define\tMTIO_DSREG_TEN\t44\t/* Retensioning */\n#define\tMTIO_DSREG_UNL\t45\t/* Unloading */\n#define\tMTIO_DSREG_LD\t46\t/* Loading */\n\n#endif\t/* __FreeBSD__ */\n\n/* structure for MTIOCGET - mag tape get status command */\n\nstruct mtget {\n\tshort\tmt_type;\t/* type of magtape device */\n/* the following two registers are grossly device dependent */\n\tshort\tmt_dsreg;\t/* ``drive status'' register */\n\tshort\tmt_erreg;\t/* ``error'' register */\n/* end device-dependent registers */\n\t/*\n\t * Note that the residual count, while maintained, may be\n\t * be nonsense because the size of the residual may (greatly)\n\t * exceed 32 K-bytes. Use the MTIOCERRSTAT ioctl to get a\n\t * more accurate count.\n\t */\n\tshort\tmt_resid;\t/* residual count */\n#if defined (__FreeBSD__)\n\tint32_t mt_blksiz;\t/* presently operating blocksize */\n\tint32_t mt_density;\t/* presently operating density */\n\tu_int32_t mt_comp;\t/* presently operating compression */\n\tint32_t mt_blksiz0;\t/* blocksize for mode 0 */\n\tint32_t mt_blksiz1;\t/* blocksize for mode 1 */\n\tint32_t mt_blksiz2;\t/* blocksize for mode 2 */\n\tint32_t mt_blksiz3;\t/* blocksize for mode 3 */\n\tint32_t mt_density0;\t/* density for mode 0 */\n\tint32_t mt_density1;\t/* density for mode 1 */\n\tint32_t mt_density2;\t/* density for mode 2 */\n\tint32_t mt_density3;\t/* density for mode 3 */\n/* the following are not yet implemented */\n\tu_int32_t mt_comp0;\t/* compression type for mode 0 */\n\tu_int32_t mt_comp1;\t/* compression type for mode 1 */\n\tu_int32_t mt_comp2;\t/* compression type for mode 2 */\n\tu_int32_t mt_comp3;\t/* compression type for mode 3 */\n/* end not yet implemented */\n#endif\n\tint32_t\tmt_fileno;\t/* relative file number of current position */\n\tint32_t\tmt_blkno;\t/* relative block number of current position */\n};\n\n/* structure for MTIOCERRSTAT - tape get error status command */\n/* really only supported for SCSI tapes right now */\nstruct scsi_tape_errors {\n\t/*\n\t * These are latched from the last command that had a SCSI\n\t * Check Condition noted for these operations. The act\n\t * of issuing an MTIOCERRSTAT unlatches and clears them.\n\t */\n\tu_int8_t io_sense[32];\t/* Last Sense Data For Data I/O */\n\tint32_t io_resid;\t/* residual count from last Data I/O */\n\tu_int8_t io_cdb[16];\t/* Command that Caused the Last Data Sense */\n\tu_int8_t ctl_sense[32];\t/* Last Sense Data For Control I/O */\n\tint32_t ctl_resid;\t/* residual count from last Control I/O */\n\tu_int8_t ctl_cdb[16];\t/* Command that Caused the Last Control Sense */\n\t/*\n\t * These are the read and write cumulative error counters.\n\t * (how to reset cumulative error counters is not yet defined).\n\t * (not implemented as yet but space is being reserved for them)\n\t */\n\tstruct {\n\t\tu_int32_t retries;\t/* total # retries performed */\n\t\tu_int32_t corrected;\t/* total # corrections performed */\n\t\tu_int32_t processed;\t/* total # corrections successful */\n\t\tu_int32_t failures;\t/* total # corrections/retries failed */\n\t\tu_int64_t nbytes;\t/* total # bytes processed */\n\t} wterr, rderr;\n};\n\t\nunion mterrstat {\n\tstruct scsi_tape_errors scsi_errstat;\n\tchar _reserved_padding[256];\n};\n\n/*\n * Constants for mt_type byte.  These are the same\n * for controllers compatible with the types listed.\n */\n#define\tMT_ISTS\t\t0x01\t\t/* TS-11 */\n#define\tMT_ISHT\t\t0x02\t\t/* TM03 Massbus: TE16, TU45, TU77 */\n#define\tMT_ISTM\t\t0x03\t\t/* TM11/TE10 Unibus */\n#define\tMT_ISMT\t\t0x04\t\t/* TM78/TU78 Massbus */\n#define\tMT_ISUT\t\t0x05\t\t/* SI TU-45 emulation on Unibus */\n#define\tMT_ISCPC\t0x06\t\t/* SUN */\n#define\tMT_ISAR\t\t0x07\t\t/* SUN */\n#define\tMT_ISTMSCP\t0x08\t\t/* DEC TMSCP protocol (TU81, TK50) */\n#define MT_ISCY\t\t0x09\t\t/* CCI Cipher */\n#define MT_ISCT\t\t0x0a\t\t/* HP 1/4 tape */\n#define MT_ISFHP\t0x0b\t\t/* HP 7980 1/2 tape */\n#define MT_ISEXABYTE\t0x0c\t\t/* Exabyte */\n#define MT_ISEXA8200\t0x0c\t\t/* Exabyte EXB-8200 */\n#define MT_ISEXA8500\t0x0d\t\t/* Exabyte EXB-8500 */\n#define MT_ISVIPER1\t0x0e\t\t/* Archive Viper-150 */\n#define MT_ISPYTHON\t0x0f\t\t/* Archive Python (DAT) */\n#define MT_ISHPDAT\t0x10\t\t/* HP 35450A DAT drive */\n#define MT_ISMFOUR\t0x11\t\t/* M4 Data 1/2 9track drive */\n#define MT_ISTK50\t0x12\t\t/* DEC SCSI TK50 */\n#define MT_ISMT02\t0x13\t\t/* Emulex MT02 SCSI tape controller */\n\n/* mag tape io control commands */\n#define\tMTIOCTOP\t_IOW('m', 1, struct mtop)\t/* do a mag tape op */\n#define\tMTIOCGET\t_IOR('m', 2, struct mtget)\t/* get tape status */\n/* these two do not appear to be used anywhere */\n#define MTIOCIEOT\t_IO('m', 3)\t\t\t/* ignore EOT error */\n#define MTIOCEEOT\t_IO('m', 4)\t\t\t/* enable EOT error */\n/*\n * When more SCSI-3 SSC (streaming device) devices are out there\n * that support the full 32 byte type 2 structure, we'll have to\n * rethink these ioctls to support all the entities they haul into\n * the picture (64 bit blocks, logical file record numbers, etc..).\n */\n#define\tMTIOCRDSPOS\t_IOR('m', 5, u_int32_t)\t/* get logical blk addr */\n#define\tMTIOCRDHPOS\t_IOR('m', 6, u_int32_t)\t/* get hardware blk addr */\n#define\tMTIOCSLOCATE\t_IOW('m', 5, u_int32_t)\t/* seek to logical blk addr */\n#define\tMTIOCHLOCATE\t_IOW('m', 6, u_int32_t)\t/* seek to hardware blk addr */\n#define\tMTIOCERRSTAT\t_IOR('m', 7, union mterrstat)\t/* get tape errors */\n/*\n * Set EOT model- argument is number of filemarks to end a tape with.\n * Note that not all possible values will be accepted.\n */\n#define\tMTIOCSETEOTMODEL\t_IOW('m', 8, u_int32_t)\n/* Get current EOT model */\n#define\tMTIOCGETEOTMODEL\t_IOR('m', 8, u_int32_t)\n\n#ifndef _KERNEL\n#define\tDEFTAPE\t\"/dev/nsa0\"\n#endif\n\n#endif /* !_SYS_MTIO_H_ */\n"
  },
  {
    "path": "freebsd-headers/sys/mutex.h",
    "content": "/*-\n * Copyright (c) 1997 Berkeley Software Design, Inc. All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. Berkeley Software Design Inc's name may not be used to endorse or\n *    promote products derived from this software without specific prior\n *    written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY BERKELEY SOFTWARE DESIGN INC ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL BERKELEY SOFTWARE DESIGN INC BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\tfrom BSDI $Id: mutex.h,v 2.7.2.35 2000/04/27 03:10:26 cp Exp $\n * $FreeBSD: release/9.0.0/sys/sys/mutex.h 218673 2011-02-14 02:37:27Z alc $\n */\n\n#ifndef _SYS_MUTEX_H_\n#define _SYS_MUTEX_H_\n\n#include <sys/queue.h>\n#include <sys/_lock.h>\n#include <sys/_mutex.h>\n\n#ifdef _KERNEL\n#include <sys/pcpu.h>\n#include <sys/lock_profile.h>\n#include <sys/lockstat.h>\n#include <machine/atomic.h>\n#include <machine/cpufunc.h>\n\n/*\n * Mutex types and options passed to mtx_init().  MTX_QUIET and MTX_DUPOK\n * can also be passed in.\n */\n#define\tMTX_DEF\t\t0x00000000\t/* DEFAULT (sleep) lock */ \n#define MTX_SPIN\t0x00000001\t/* Spin lock (disables interrupts) */\n#define MTX_RECURSE\t0x00000004\t/* Option: lock allowed to recurse */\n#define\tMTX_NOWITNESS\t0x00000008\t/* Don't do any witness checking. */\n#define MTX_NOPROFILE   0x00000020\t/* Don't profile this lock */\n\n/*\n * Option flags passed to certain lock/unlock routines, through the use\n * of corresponding mtx_{lock,unlock}_flags() interface macros.\n */\n#define\tMTX_QUIET\tLOP_QUIET\t/* Don't log a mutex event */\n#define\tMTX_DUPOK\tLOP_DUPOK\t/* Don't log a duplicate acquire */\n\n/*\n * State bits kept in mutex->mtx_lock, for the DEFAULT lock type. None of this,\n * with the exception of MTX_UNOWNED, applies to spin locks.\n */\n#define\tMTX_RECURSED\t0x00000001\t/* lock recursed (for MTX_DEF only) */\n#define\tMTX_CONTESTED\t0x00000002\t/* lock contested (for MTX_DEF only) */\n#define MTX_UNOWNED\t0x00000004\t/* Cookie for free mutex */\n#define\tMTX_FLAGMASK\t(MTX_RECURSED | MTX_CONTESTED | MTX_UNOWNED)\n\n/*\n * Value stored in mutex->mtx_lock to denote a destroyed mutex.\n */\n#define\tMTX_DESTROYED\t(MTX_CONTESTED | MTX_UNOWNED)\n\n/*\n * Prototypes\n *\n * NOTE: Functions prepended with `_' (underscore) are exported to other parts\n *\t of the kernel via macros, thus allowing us to use the cpp LOCK_FILE\n *\t and LOCK_LINE. These functions should not be called directly by any\n *\t code using the API. Their macros cover their functionality.\n *\n * [See below for descriptions]\n *\n */\nvoid\tmtx_init(struct mtx *m, const char *name, const char *type, int opts);\nvoid\tmtx_destroy(struct mtx *m);\nvoid\tmtx_sysinit(void *arg);\nvoid\tmutex_init(void);\nvoid\t_mtx_lock_sleep(struct mtx *m, uintptr_t tid, int opts,\n\t    const char *file, int line);\nvoid\t_mtx_unlock_sleep(struct mtx *m, int opts, const char *file, int line);\n#ifdef SMP\nvoid\t_mtx_lock_spin(struct mtx *m, uintptr_t tid, int opts,\n\t    const char *file, int line);\n#endif\nvoid\t_mtx_unlock_spin(struct mtx *m, int opts, const char *file, int line);\nint\t_mtx_trylock(struct mtx *m, int opts, const char *file, int line);\nvoid\t_mtx_lock_flags(struct mtx *m, int opts, const char *file, int line);\nvoid\t_mtx_unlock_flags(struct mtx *m, int opts, const char *file, int line);\nvoid\t_mtx_lock_spin_flags(struct mtx *m, int opts, const char *file,\n\t     int line);\nvoid\t_mtx_unlock_spin_flags(struct mtx *m, int opts, const char *file,\n\t     int line);\n#if defined(INVARIANTS) || defined(INVARIANT_SUPPORT)\nvoid\t_mtx_assert(struct mtx *m, int what, const char *file, int line);\n#endif\nvoid\t_thread_lock_flags(struct thread *, int, const char *, int);\n\n#define\tthread_lock(tdp)\t\t\t\t\t\t\\\n    _thread_lock_flags((tdp), 0, __FILE__, __LINE__)\n#define\tthread_lock_flags(tdp, opt)\t\t\t\t\t\\\n    _thread_lock_flags((tdp), (opt), __FILE__, __LINE__)\n#define\tthread_unlock(tdp)\t\t\t\t\t\t\\\n       mtx_unlock_spin((tdp)->td_lock)\n\n#define\tmtx_recurse\tlock_object.lo_data\n\n/* Very simple operations on mtx_lock. */\n\n/* Try to obtain mtx_lock once. */\n#define _mtx_obtain_lock(mp, tid)\t\t\t\t\t\\\n\tatomic_cmpset_acq_ptr(&(mp)->mtx_lock, MTX_UNOWNED, (tid))\n\n/* Try to release mtx_lock if it is unrecursed and uncontested. */\n#define _mtx_release_lock(mp, tid)\t\t\t\t\t\\\n\tatomic_cmpset_rel_ptr(&(mp)->mtx_lock, (tid), MTX_UNOWNED)\n\n/* Release mtx_lock quickly, assuming we own it. */\n#define _mtx_release_lock_quick(mp)\t\t\t\t\t\\\n\tatomic_store_rel_ptr(&(mp)->mtx_lock, MTX_UNOWNED)\n\n/*\n * Full lock operations that are suitable to be inlined in non-debug\n * kernels.  If the lock cannot be acquired or released trivially then\n * the work is deferred to another function.\n */\n\n/* Lock a normal mutex. */\n#define __mtx_lock(mp, tid, opts, file, line) do {\t\t\t\\\n\tuintptr_t _tid = (uintptr_t)(tid);\t\t\t\t\\\n\t\t\t\t\t\t\t\t\t\\\n\tif (!_mtx_obtain_lock((mp), _tid))\t\t\t\t\\\n\t\t_mtx_lock_sleep((mp), _tid, (opts), (file), (line));\t\\\n\telse\t\t\t\t\t\t\t\t\\\n              \tLOCKSTAT_PROFILE_OBTAIN_LOCK_SUCCESS(LS_MTX_LOCK_ACQUIRE, \\\n\t\t    mp, 0, 0, (file), (line));\t\t\t\t\\\n} while (0)\n\n/*\n * Lock a spin mutex.  For spinlocks, we handle recursion inline (it\n * turns out that function calls can be significantly expensive on\n * some architectures).  Since spin locks are not _too_ common,\n * inlining this code is not too big a deal.\n */\n#ifdef SMP\n#define __mtx_lock_spin(mp, tid, opts, file, line) do {\t\t\t\\\n\tuintptr_t _tid = (uintptr_t)(tid);\t\t\t\t\\\n\t\t\t\t\t\t\t\t\t\\\n\tspinlock_enter();\t\t\t\t\t\t\\\n\tif (!_mtx_obtain_lock((mp), _tid)) {\t\t\t\t\\\n\t\tif ((mp)->mtx_lock == _tid)\t\t\t\t\\\n\t\t\t(mp)->mtx_recurse++;\t\t\t\t\\\n\t\telse\t\t\t\t\t\t\t\\\n\t\t\t_mtx_lock_spin((mp), _tid, (opts), (file), (line)); \\\n\t} else \t\t\t\t\t\t\t\t\\\n              \tLOCKSTAT_PROFILE_OBTAIN_LOCK_SUCCESS(LS_MTX_SPIN_LOCK_ACQUIRE, \\\n\t\t    mp, 0, 0, (file), (line));\t\t\t\t\\\n} while (0)\n#else /* SMP */\n#define __mtx_lock_spin(mp, tid, opts, file, line) do {\t\t\t\\\n\tuintptr_t _tid = (uintptr_t)(tid);\t\t\t\t\\\n\t\t\t\t\t\t\t\t\t\\\n\tspinlock_enter();\t\t\t\t\t\t\\\n\tif ((mp)->mtx_lock == _tid)\t\t\t\t\t\\\n\t\t(mp)->mtx_recurse++;\t\t\t\t\t\\\n\telse {\t\t\t\t\t\t\t\t\\\n\t\tKASSERT((mp)->mtx_lock == MTX_UNOWNED, (\"corrupt spinlock\")); \\\n\t\t(mp)->mtx_lock = _tid;\t\t\t\t\t\\\n\t}\t\t\t\t\t\t\t\t\\\n} while (0)\n#endif /* SMP */\n\n/* Unlock a normal mutex. */\n#define __mtx_unlock(mp, tid, opts, file, line) do {\t\t\t\\\n\tuintptr_t _tid = (uintptr_t)(tid);\t\t\t\t\\\n\t\t\t\t\t\t\t\t\t\\\n\tif (!_mtx_release_lock((mp), _tid))\t\t\t\t\\\n\t\t_mtx_unlock_sleep((mp), (opts), (file), (line));\t\\\n} while (0)\n\n/*\n * Unlock a spin mutex.  For spinlocks, we can handle everything\n * inline, as it's pretty simple and a function call would be too\n * expensive (at least on some architectures).  Since spin locks are\n * not _too_ common, inlining this code is not too big a deal.\n *\n * Since we always perform a spinlock_enter() when attempting to acquire a\n * spin lock, we need to always perform a matching spinlock_exit() when\n * releasing a spin lock.  This includes the recursion cases.\n */\n#ifdef SMP\n#define __mtx_unlock_spin(mp) do {\t\t\t\t\t\\\n\tif (mtx_recursed((mp)))\t\t\t\t\t\t\\\n\t\t(mp)->mtx_recurse--;\t\t\t\t\t\\\n\telse {\t\t\t\t\t\t\t\t\\\n\t\tLOCKSTAT_PROFILE_RELEASE_LOCK(LS_MTX_SPIN_UNLOCK_RELEASE, \\\n\t\t\tmp);\t\t\t\t\t\t\\\n\t\t_mtx_release_lock_quick((mp));\t\t\t\t\\\n\t}                                                               \\\n\tspinlock_exit();\t\t\t\t                \\\n} while (0)\n#else /* SMP */\n#define __mtx_unlock_spin(mp) do {\t\t\t\t\t\\\n\tif (mtx_recursed((mp)))\t\t\t\t\t\t\\\n\t\t(mp)->mtx_recurse--;\t\t\t\t\t\\\n\telse {\t\t\t\t\t\t\t\t\\\n\t\tLOCKSTAT_PROFILE_RELEASE_LOCK(LS_MTX_SPIN_UNLOCK_RELEASE, \\\n\t\t\tmp);\t\t\t\t\t\t\\\n\t\t(mp)->mtx_lock = MTX_UNOWNED;\t\t\t\t\\\n\t}                                                               \\\n\tspinlock_exit();\t\t\t\t\t\t\\\n} while (0)\n#endif /* SMP */\n\n/*\n * Exported lock manipulation interface.\n *\n * mtx_lock(m) locks MTX_DEF mutex `m'\n *\n * mtx_lock_spin(m) locks MTX_SPIN mutex `m'\n *\n * mtx_unlock(m) unlocks MTX_DEF mutex `m'\n *\n * mtx_unlock_spin(m) unlocks MTX_SPIN mutex `m'\n *\n * mtx_lock_spin_flags(m, opts) and mtx_lock_flags(m, opts) locks mutex `m'\n *     and passes option flags `opts' to the \"hard\" function, if required.\n *     With these routines, it is possible to pass flags such as MTX_QUIET\n *     to the appropriate lock manipulation routines.\n *\n * mtx_trylock(m) attempts to acquire MTX_DEF mutex `m' but doesn't sleep if\n *     it cannot. Rather, it returns 0 on failure and non-zero on success.\n *     It does NOT handle recursion as we assume that if a caller is properly\n *     using this part of the interface, he will know that the lock in question\n *     is _not_ recursed.\n *\n * mtx_trylock_flags(m, opts) is used the same way as mtx_trylock() but accepts\n *     relevant option flags `opts.'\n *\n * mtx_initialized(m) returns non-zero if the lock `m' has been initialized.\n *\n * mtx_owned(m) returns non-zero if the current thread owns the lock `m'\n *\n * mtx_recursed(m) returns non-zero if the lock `m' is presently recursed.\n */ \n#define mtx_lock(m)\t\tmtx_lock_flags((m), 0)\n#define mtx_lock_spin(m)\tmtx_lock_spin_flags((m), 0)\n#define mtx_trylock(m)\t\tmtx_trylock_flags((m), 0)\n#define mtx_unlock(m)\t\tmtx_unlock_flags((m), 0)\n#define mtx_unlock_spin(m)\tmtx_unlock_spin_flags((m), 0)\n\nstruct mtx_pool;\n\nstruct mtx_pool *mtx_pool_create(const char *mtx_name, int pool_size, int opts);\nvoid mtx_pool_destroy(struct mtx_pool **poolp);\nstruct mtx *mtx_pool_find(struct mtx_pool *pool, void *ptr);\nstruct mtx *mtx_pool_alloc(struct mtx_pool *pool);\n#define mtx_pool_lock(pool, ptr)\t\t\t\t\t\\\n\tmtx_lock(mtx_pool_find((pool), (ptr)))\n#define mtx_pool_lock_spin(pool, ptr)\t\t\t\t\t\\\n\tmtx_lock_spin(mtx_pool_find((pool), (ptr)))\n#define mtx_pool_unlock(pool, ptr)\t\t\t\t\t\\\n\tmtx_unlock(mtx_pool_find((pool), (ptr)))\n#define mtx_pool_unlock_spin(pool, ptr)\t\t\t\t\t\\\n\tmtx_unlock_spin(mtx_pool_find((pool), (ptr)))\n\n/*\n * mtxpool_lockbuilder is a pool of sleep locks that is not witness\n * checked and should only be used for building higher level locks.\n *\n * mtxpool_sleep is a general purpose pool of sleep mutexes.\n */\nextern struct mtx_pool *mtxpool_lockbuilder;\nextern struct mtx_pool *mtxpool_sleep;\n\n#ifndef LOCK_DEBUG\n#error LOCK_DEBUG not defined, include <sys/lock.h> before <sys/mutex.h>\n#endif\n#if LOCK_DEBUG > 0 || defined(MUTEX_NOINLINE)\n#define\tmtx_lock_flags(m, opts)\t\t\t\t\t\t\\\n\t_mtx_lock_flags((m), (opts), LOCK_FILE, LOCK_LINE)\n#define\tmtx_unlock_flags(m, opts)\t\t\t\t\t\\\n\t_mtx_unlock_flags((m), (opts), LOCK_FILE, LOCK_LINE)\n#define\tmtx_lock_spin_flags(m, opts)\t\t\t\t\t\\\n\t_mtx_lock_spin_flags((m), (opts), LOCK_FILE, LOCK_LINE)\n#define\tmtx_unlock_spin_flags(m, opts)\t\t\t\t\t\\\n\t_mtx_unlock_spin_flags((m), (opts), LOCK_FILE, LOCK_LINE)\n#else\t/* LOCK_DEBUG == 0 && !MUTEX_NOINLINE */\n#define\tmtx_lock_flags(m, opts)\t\t\t\t\t\t\\\n\t__mtx_lock((m), curthread, (opts), LOCK_FILE, LOCK_LINE)\n#define\tmtx_unlock_flags(m, opts)\t\t\t\t\t\\\n\t__mtx_unlock((m), curthread, (opts), LOCK_FILE, LOCK_LINE)\n#define\tmtx_lock_spin_flags(m, opts)\t\t\t\t\t\\\n\t__mtx_lock_spin((m), curthread, (opts), LOCK_FILE, LOCK_LINE)\n#define\tmtx_unlock_spin_flags(m, opts)\t\t\t\t\t\\\n\t__mtx_unlock_spin((m))\n#endif\t/* LOCK_DEBUG > 0 || MUTEX_NOINLINE */\n\n#define mtx_trylock_flags(m, opts)\t\t\t\t\t\\\n\t_mtx_trylock((m), (opts), LOCK_FILE, LOCK_LINE)\n\n#define\tmtx_sleep(chan, mtx, pri, wmesg, timo)\t\t\t\t\\\n\t_sleep((chan), &(mtx)->lock_object, (pri), (wmesg), (timo))\n\n#define\tmtx_initialized(m)\tlock_initalized(&(m)->lock_object)\n\n#define mtx_owned(m)\t(((m)->mtx_lock & ~MTX_FLAGMASK) == (uintptr_t)curthread)\n\n#define mtx_recursed(m)\t((m)->mtx_recurse != 0)\n\n#define mtx_name(m)\t((m)->lock_object.lo_name)\n\n/*\n * Global locks.\n */\nextern struct mtx Giant;\nextern struct mtx blocked_lock;\n\n/*\n * Giant lock manipulation and clean exit macros.\n * Used to replace return with an exit Giant and return.\n *\n * Note that DROP_GIANT*() needs to be paired with PICKUP_GIANT() \n * The #ifndef is to allow lint-like tools to redefine DROP_GIANT.\n */\n#ifndef DROP_GIANT\n#define DROP_GIANT()\t\t\t\t\t\t\t\\\ndo {\t\t\t\t\t\t\t\t\t\\\n\tint _giantcnt = 0;\t\t\t\t\t\t\\\n\tWITNESS_SAVE_DECL(Giant);\t\t\t\t\t\\\n\t\t\t\t\t\t\t\t\t\\\n\tif (mtx_owned(&Giant)) {\t\t\t\t\t\\\n\t\tWITNESS_SAVE(&Giant.lock_object, Giant);\t\t\\\n\t\tfor (_giantcnt = 0; mtx_owned(&Giant); _giantcnt++)\t\\\n\t\t\tmtx_unlock(&Giant);\t\t\t\t\\\n\t}\n\n#define PICKUP_GIANT()\t\t\t\t\t\t\t\\\n\tPARTIAL_PICKUP_GIANT();\t\t\t\t\t\t\\\n} while (0)\n\n#define PARTIAL_PICKUP_GIANT()\t\t\t\t\t\t\\\n\tmtx_assert(&Giant, MA_NOTOWNED);\t\t\t\t\\\n\tif (_giantcnt > 0) {\t\t\t\t\t\t\\\n\t\twhile (_giantcnt--)\t\t\t\t\t\\\n\t\t\tmtx_lock(&Giant);\t\t\t\t\\\n\t\tWITNESS_RESTORE(&Giant.lock_object, Giant);\t\t\\\n\t}\n#endif\n\n#define\tUGAR(rval) do {\t\t\t\t\t\t\t\\\n\tint _val = (rval);\t\t\t\t\t\t\\\n\tmtx_unlock(&Giant);\t\t\t\t\t\t\\\n\treturn (_val);\t\t\t\t\t\t\t\\\n} while (0)\n\nstruct mtx_args {\n\tstruct mtx\t*ma_mtx;\n\tconst char \t*ma_desc;\n\tint\t\t ma_opts;\n};\n\n#define\tMTX_SYSINIT(name, mtx, desc, opts)\t\t\t\t\\\n\tstatic struct mtx_args name##_args = {\t\t\t\t\\\n\t\t(mtx),\t\t\t\t\t\t\t\\\n\t\t(desc),\t\t\t\t\t\t\t\\\n\t\t(opts)\t\t\t\t\t\t\t\\\n\t};\t\t\t\t\t\t\t\t\\\n\tSYSINIT(name##_mtx_sysinit, SI_SUB_LOCK, SI_ORDER_MIDDLE,\t\\\n\t    mtx_sysinit, &name##_args);\t\t\t\t\t\\\n\tSYSUNINIT(name##_mtx_sysuninit, SI_SUB_LOCK, SI_ORDER_MIDDLE,\t\\\n\t    mtx_destroy, (mtx))\n\n/*\n * The INVARIANTS-enabled mtx_assert() functionality.\n *\n * The constants need to be defined for INVARIANT_SUPPORT infrastructure\n * support as _mtx_assert() itself uses them and the latter implies that\n * _mtx_assert() must build.\n */\n#if defined(INVARIANTS) || defined(INVARIANT_SUPPORT)\n#define MA_OWNED\tLA_XLOCKED\n#define MA_NOTOWNED\tLA_UNLOCKED\n#define MA_RECURSED\tLA_RECURSED\n#define MA_NOTRECURSED\tLA_NOTRECURSED\n#endif\n\n#ifdef INVARIANTS\n#define\tmtx_assert(m, what)\t\t\t\t\t\t\\\n\t_mtx_assert((m), (what), __FILE__, __LINE__)\n\n#define GIANT_REQUIRED\tmtx_assert(&Giant, MA_OWNED)\n\n#else\t/* INVARIANTS */\n#define mtx_assert(m, what)\t(void)0\n#define GIANT_REQUIRED\n#endif\t/* INVARIANTS */\n\n/*\n * Common lock type names.\n */\n#define\tMTX_NETWORK_LOCK\t\"network driver\"\n\n#endif\t/* _KERNEL */\n#endif\t/* _SYS_MUTEX_H_ */\n"
  },
  {
    "path": "freebsd-headers/sys/namei.h",
    "content": "/*-\n * Copyright (c) 1985, 1989, 1991, 1993\n *\tThe Regents of the University of California.  All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 4. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t@(#)namei.h\t8.5 (Berkeley) 1/9/95\n * $FreeBSD: release/9.0.0/sys/sys/namei.h 224810 2011-08-13 09:21:16Z jonathan $\n */\n\n#ifndef _SYS_NAMEI_H_\n#define\t_SYS_NAMEI_H_\n\n#include <sys/queue.h>\n#include <sys/uio.h>\n\nstruct componentname {\n\t/*\n\t * Arguments to lookup.\n\t */\n\tu_long\tcn_nameiop;\t/* namei operation */\n\tu_int64_t cn_flags;\t/* flags to namei */\n\tstruct\tthread *cn_thread;/* thread requesting lookup */\n\tstruct\tucred *cn_cred;\t/* credentials */\n\tint\tcn_lkflags;\t/* Lock flags LK_EXCLUSIVE or LK_SHARED */\n\t/*\n\t * Shared between lookup and commit routines.\n\t */\n\tchar\t*cn_pnbuf;\t/* pathname buffer */\n\tchar\t*cn_nameptr;\t/* pointer to looked up name */\n\tlong\tcn_namelen;\t/* length of looked up component */\n\tlong\tcn_consume;\t/* chars to consume in lookup() */\n};\n\n/*\n * Encapsulation of namei parameters.\n */\nstruct nameidata {\n\t/*\n\t * Arguments to namei/lookup.\n\t */\n\tconst\tchar *ni_dirp;\t\t/* pathname pointer */\n\tenum\tuio_seg ni_segflg;\t/* location of pathname */\n\tcap_rights_t ni_rightsneeded;\t/* rights required to look up vnode */\n\t/*\n\t * Arguments to lookup.\n\t */\n\tstruct  vnode *ni_startdir;\t/* starting directory */\n\tstruct\tvnode *ni_rootdir;\t/* logical root directory */\n\tstruct\tvnode *ni_topdir;\t/* logical top directory */\n\tint\tni_dirfd;\t\t/* starting directory for *at functions */\n\tint\tni_strictrelative;\t/* relative lookup only; no '..' */\n\t/*\n\t * Results: returned from namei\n\t */\n\tcap_rights_t ni_baserights;\t/* rights the *at base has (or -1) */\n\t/*\n\t * Results: returned from/manipulated by lookup\n\t */\n\tstruct\tvnode *ni_vp;\t\t/* vnode of result */\n\tstruct\tvnode *ni_dvp;\t\t/* vnode of intermediate directory */\n\t/*\n\t * Shared between namei and lookup/commit routines.\n\t */\n\tsize_t\tni_pathlen;\t\t/* remaining chars in path */\n\tchar\t*ni_next;\t\t/* next location in pathname */\n\tu_int\tni_loopcnt;\t\t/* count of symlinks encountered */\n\t/*\n\t * Lookup parameters: this structure describes the subset of\n\t * information from the nameidata structure that is passed\n\t * through the VOP interface.\n\t */\n\tstruct componentname ni_cnd;\n};\n\n#ifdef _KERNEL\n/*\n * namei operations\n */\n#define\tLOOKUP\t\t0\t/* perform name lookup only */\n#define\tCREATE\t\t1\t/* setup for file creation */\n#define\tDELETE\t\t2\t/* setup for file deletion */\n#define\tRENAME\t\t3\t/* setup for file renaming */\n#define\tOPMASK\t\t3\t/* mask for operation */\n/*\n * namei operational modifier flags, stored in ni_cnd.flags\n */\n#define\tLOCKLEAF\t0x0004\t/* lock inode on return */\n#define\tLOCKPARENT\t0x0008\t/* want parent vnode returned locked */\n#define\tWANTPARENT\t0x0010\t/* want parent vnode returned unlocked */\n#define\tNOCACHE\t\t0x0020\t/* name must not be left in cache */\n#define\tFOLLOW\t\t0x0040\t/* follow symbolic links */\n#define\tLOCKSHARED\t0x0100\t/* Shared lock leaf */\n#define\tNOFOLLOW\t0x0000\t/* do not follow symbolic links (pseudo) */\n#define\tMODMASK\t\t0x01fc\t/* mask of operational modifiers */\n/*\n * Namei parameter descriptors.\n *\n * SAVENAME may be set by either the callers of namei or by VOP_LOOKUP.\n * If the caller of namei sets the flag (for example execve wants to\n * know the name of the program that is being executed), then it must\n * free the buffer. If VOP_LOOKUP sets the flag, then the buffer must\n * be freed by either the commit routine or the VOP_ABORT routine.\n * SAVESTART is set only by the callers of namei. It implies SAVENAME\n * plus the addition of saving the parent directory that contains the\n * name in ni_startdir. It allows repeated calls to lookup for the\n * name being sought. The caller is responsible for releasing the\n * buffer and for vrele'ing ni_startdir.\n */\n#define\tRDONLY\t\t0x00000200 /* lookup with read-only semantics */\n#define\tHASBUF\t\t0x00000400 /* has allocated pathname buffer */\n#define\tSAVENAME\t0x00000800 /* save pathname buffer */\n#define\tSAVESTART\t0x00001000 /* save starting directory */\n#define\tISDOTDOT\t0x00002000 /* current component name is .. */\n#define\tMAKEENTRY\t0x00004000 /* entry is to be added to name cache */\n#define\tISLASTCN\t0x00008000 /* this is last component of pathname */\n#define\tISSYMLINK\t0x00010000 /* symlink needs interpretation */\n#define\tISWHITEOUT\t0x00020000 /* found whiteout */\n#define\tDOWHITEOUT\t0x00040000 /* do whiteouts */\n#define\tWILLBEDIR\t0x00080000 /* new files will be dirs; allow trailing / */\n#define\tISUNICODE\t0x00100000 /* current component name is unicode*/\n#define\tISOPEN\t\t0x00200000 /* caller is opening; return a real vnode. */\n#define\tNOCROSSMOUNT\t0x00400000 /* do not cross mount points */\n#define\tNOMACCHECK\t0x00800000 /* do not perform MAC checks */\n#define\tMPSAFE\t\t0x01000000 /* namei() must acquire Giant if needed. */\n#define\tGIANTHELD\t0x02000000 /* namei() is holding giant. */\n#define\tAUDITVNODE1\t0x04000000 /* audit the looked up vnode information */\n#define\tAUDITVNODE2 \t0x08000000 /* audit the looked up vnode information */\n#define\tTRAILINGSLASH\t0x10000000 /* path ended in a slash */\n#define\tPARAMASK\t0x1ffffe00 /* mask of parameter descriptors */\n\n#define\tNDHASGIANT(NDP)\t(((NDP)->ni_cnd.cn_flags & GIANTHELD) != 0)\n\n/*\n * Initialization of a nameidata structure.\n */\n#define\tNDINIT(ndp, op, flags, segflg, namep, td)\t\t\t\\\n\tNDINIT_ALL(ndp, op, flags, segflg, namep, AT_FDCWD, NULL, 0, td)\n#define\tNDINIT_AT(ndp, op, flags, segflg, namep, dirfd, td)\t\t\\\n\tNDINIT_ALL(ndp, op, flags, segflg, namep, dirfd, NULL, 0, td)\n#define\tNDINIT_ATRIGHTS(ndp, op, flags, segflg, namep, dirfd, rights, td) \\\n\tNDINIT_ALL(ndp, op, flags, segflg, namep, dirfd, NULL, rights, td)\n#define\tNDINIT_ATVP(ndp, op, flags, segflg, namep, vp, td)\t\t\\\n\tNDINIT_ALL(ndp, op, flags, segflg, namep, AT_FDCWD, vp, 0, td)\n\nstatic __inline void\nNDINIT_ALL(struct nameidata *ndp,\n\tu_long op, u_long flags,\n\tenum uio_seg segflg,\n\tconst char *namep,\n\tint dirfd,\n\tstruct vnode *startdir,\n\tcap_rights_t rights,\n\tstruct thread *td)\n{\n\tndp->ni_cnd.cn_nameiop = op;\n\tndp->ni_cnd.cn_flags = flags;\n\tndp->ni_segflg = segflg;\n\tndp->ni_dirp = namep;\n\tndp->ni_dirfd = dirfd;\n\tndp->ni_startdir = startdir;\n\tndp->ni_strictrelative = 0;\n\tndp->ni_rightsneeded = rights;\n\tndp->ni_baserights = 0;\n\tndp->ni_cnd.cn_thread = td;\n}\n\n#define NDF_NO_DVP_RELE\t\t0x00000001\n#define NDF_NO_DVP_UNLOCK\t0x00000002\n#define NDF_NO_DVP_PUT\t\t0x00000003\n#define NDF_NO_VP_RELE\t\t0x00000004\n#define NDF_NO_VP_UNLOCK\t0x00000008\n#define NDF_NO_VP_PUT\t\t0x0000000c\n#define NDF_NO_STARTDIR_RELE\t0x00000010\n#define NDF_NO_FREE_PNBUF\t0x00000020\n#define NDF_ONLY_PNBUF\t\t(~NDF_NO_FREE_PNBUF)\n\nvoid NDFREE(struct nameidata *, const u_int);\n\nint\tnamei(struct nameidata *ndp);\nint\tlookup(struct nameidata *ndp);\nint\trelookup(struct vnode *dvp, struct vnode **vpp,\n\t    struct componentname *cnp);\n#endif\n\n/*\n * Stats on usefulness of namei caches.\n */\nstruct nchstats {\n\tlong\tncs_goodhits;\t\t/* hits that we can really use */\n\tlong\tncs_neghits;\t\t/* negative hits that we can use */\n\tlong\tncs_badhits;\t\t/* hits we must drop */\n\tlong\tncs_falsehits;\t\t/* hits with id mismatch */\n\tlong\tncs_miss;\t\t/* misses */\n\tlong\tncs_long;\t\t/* long names that ignore cache */\n\tlong\tncs_pass2;\t\t/* names found with passes == 2 */\n\tlong\tncs_2passes;\t\t/* number of times we attempt it */\n};\n\nextern struct nchstats nchstats;\n\n#endif /* !_SYS_NAMEI_H_ */\n"
  },
  {
    "path": "freebsd-headers/sys/nlist_aout.h",
    "content": "/*-\n * Copyright (c) 1991, 1993\n *\tThe Regents of the University of California.  All rights reserved.\n * (c) UNIX System Laboratories, Inc.\n * All or some portions of this file are derived from material licensed\n * to the University of California by American Telephone and Telegraph\n * Co. or Unix System Laboratories, Inc. and are reproduced herein with\n * the permission of UNIX System Laboratories, Inc.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 4. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t@(#)nlist.h\t8.2 (Berkeley) 1/21/94\n *\n * $FreeBSD: release/9.0.0/sys/sys/nlist_aout.h 208986 2010-06-10 14:19:51Z bz $\n */\n\n#ifndef _SYS_NLIST_AOUT_H_\n#define\t_SYS_NLIST_AOUT_H_\n\n/*\n * Symbol table entries in a.out files.\n */\n\n/*\n * Layout of each symbol.  The \"#ifdef _AOUT_INCLUDE_\" is so that\n * programs including nlist.h can initialize nlist structures\n * statically.\n */\nstruct nlist {\n#ifdef _AOUT_INCLUDE_\n\tunion {\n\t\tconst char *n_name; /* symbol name (in memory) */\n\t\tlong n_strx;\t/* file string table offset (on disk) */\n\t} n_un;\n#else\n\tconst char *n_name;\t/* symbol name (in memory) */\n\tint : 8 * (sizeof(long) > sizeof(char *) ?\n\t    sizeof(long) - sizeof(char *) : sizeof(char *) - sizeof(long));\n#endif\n\tunsigned char n_type;\t/* type defines */\n\tchar n_other;\t\t/* \".type\" and binding information */\n\tshort n_desc;\t\t/* used by stab entries */\n\tunsigned long n_value;\t/* address/value of the symbol */\n};\n\n#define\tn_hash\tn_desc\t\t/* used internally by ld(1); XXX */\n\n/*\n * Defines for n_type.\n */\n#define\tN_UNDF\t0x00\t\t/* undefined */\n#define\tN_ABS\t0x02\t\t/* absolute address */\n#define\tN_TEXT\t0x04\t\t/* text segment */\n#define\tN_DATA\t0x06\t\t/* data segment */\n#define\tN_BSS\t0x08\t\t/* bss segment */\n#define\tN_INDR\t0x0a\t\t/* alias definition */\n#define\tN_SIZE\t0x0c\t\t/* pseudo type, defines a symbol's size */\n#define\tN_COMM\t0x12\t\t/* common reference */\n/* GNU extensions */\n#define N_SETA\t0x14\t\t/* Absolute set element symbol */\n#define N_SETT  0x16\t\t/* Text set element symbol */\n#define N_SETD  0x18\t\t/* Data set element symbol */\n#define N_SETB  0x1a\t\t/* Bss set element symbol */\n#define N_SETV  0x1c\t\t/* Pointer to set vector in data area. */\n/* end GNU extensions */\n#define\tN_FN\t0x1e\t\t/* file name (N_EXT on) */\n#define\tN_WARN\t0x1e\t\t/* warning message (N_EXT off) */\n\n#define\tN_EXT\t0x01\t\t/* external (global) bit, OR'ed in */\n#define\tN_TYPE\t0x1e\t\t/* mask for all the type bits */\n#define\tN_STAB\t0xe0\t\t/* mask for debugger symbols -- stab(5) */\n\n/*\n * Defines for n_other.  It contains the \".type\" (AUX) field in the least\n * significant 4 bits, and the binding (for weak symbols) in the most\n * significant 4 bits.\n */\n#define N_AUX(p)\t((p)->n_other & 0xf)\n#define N_BIND(p)\t(((unsigned int)(p)->n_other >> 4) & 0xf)\n#define N_OTHER(r, v)\t(((unsigned int)(r) << 4) | ((v) & 0xf))\n\n#define AUX_OBJECT\t1\t/* data object */\n#define AUX_FUNC\t2\t/* function */\n\n/*#define BIND_LOCAL\t0\tnot used */\n/*#define BIND_GLOBAL\t1\tnot used */\n#define BIND_WEAK\t2\t/* weak binding */\n\n#define\tN_FORMAT\t\"%08x\"\t/* namelist value format; XXX */\n\n#endif /* !_SYS_NLIST_AOUT_H_ */\n"
  },
  {
    "path": "freebsd-headers/sys/osd.h",
    "content": "/*-\n * Copyright (c) 2007 Pawel Jakub Dawidek <pjd@FreeBSD.org>\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/sys/osd.h 216615 2010-12-21 13:45:29Z lstewart $\n */\n\n#ifndef _SYS_OSD_H_\n#define _SYS_OSD_H_\n\n#include <sys/queue.h>\n\n/*\n * Lock key:\n *   (c) container lock (e.g. jail's pr_mtx) and/or osd_object_lock\n *   (l) osd_list_lock\n */\nstruct osd {\n\tu_int\t\t  osd_nslots;\t/* (c) */\n\tvoid\t\t**osd_slots;\t/* (c) */\n\tLIST_ENTRY(osd)\t  osd_next;\t/* (l) */\n};\n\n#ifdef _KERNEL\n\n#define\tOSD_THREAD\t0\n#define\tOSD_JAIL\t1\n#define\tOSD_KHELP\t2\n\n#define\tOSD_FIRST\tOSD_THREAD\n#define\tOSD_LAST\tOSD_KHELP\n\ntypedef void (*osd_destructor_t)(void *value);\ntypedef int (*osd_method_t)(void *obj, void *data);\n\nint osd_register(u_int type, osd_destructor_t destructor,\n    osd_method_t *methods);\nvoid osd_deregister(u_int type, u_int slot);\n\nint osd_set(u_int type, struct osd *osd, u_int slot, void *value);\nvoid *osd_get(u_int type, struct osd *osd, u_int slot);\nvoid osd_del(u_int type, struct osd *osd, u_int slot);\nint osd_call(u_int type, u_int method, void *obj, void *data);\n\nvoid osd_exit(u_int type, struct osd *osd);\n\n#define\tosd_thread_register(destructor)\t\t\t\t\t\\\n\tosd_register(OSD_THREAD, (destructor), NULL)\n#define\tosd_thread_deregister(slot)\t\t\t\t\t\\\n\tosd_deregister(OSD_THREAD, (slot))\n#define\tosd_thread_set(td, slot, value)\t\t\t\t\t\\\n\tosd_set(OSD_THREAD, &(td)->td_osd, (slot), (value))\n#define\tosd_thread_get(td, slot)\t\t\t\t\t\\\n\tosd_get(OSD_THREAD, &(td)->td_osd, (slot))\n#define\tosd_thread_del(td, slot)\tdo {\t\t\t\t\\\n\tKASSERT((td) == curthread, (\"Not curthread.\"));\t\t\t\\\n\tosd_del(OSD_THREAD, &(td)->td_osd, (slot));\t\t\t\\\n} while (0)\n#define\tosd_thread_call(td, method, data)\t\t\t\t\\\n\tosd_call(OSD_THREAD, (method), (td), (data))\n#define\tosd_thread_exit(td)\t\t\t\t\t\t\\\n\tosd_exit(OSD_THREAD, &(td)->td_osd)\n\n#define\tosd_jail_register(destructor, methods)\t\t\t\t\\\n\tosd_register(OSD_JAIL, (destructor), (methods))\n#define\tosd_jail_deregister(slot)\t\t\t\t\t\\\n\tosd_deregister(OSD_JAIL, (slot))\n#define\tosd_jail_set(pr, slot, value)\t\t\t\t\t\\\n\tosd_set(OSD_JAIL, &(pr)->pr_osd, (slot), (value))\n#define\tosd_jail_get(pr, slot)\t\t\t\t\t\t\\\n\tosd_get(OSD_JAIL, &(pr)->pr_osd, (slot))\n#define\tosd_jail_del(pr, slot)\t\t\t\t\t\t\\\n\tosd_del(OSD_JAIL, &(pr)->pr_osd, (slot))\n#define\tosd_jail_call(pr, method, data)\t\t\t\t\t\\\n\tosd_call(OSD_JAIL, (method), (pr), (data))\n#define\tosd_jail_exit(pr)\t\t\t\t\t\t\\\n\tosd_exit(OSD_JAIL, &(pr)->pr_osd)\n\n#endif\t/* _KERNEL */\n\n#endif\t/* !_SYS_OSD_H_ */\n"
  },
  {
    "path": "freebsd-headers/sys/param.h",
    "content": "/*-\n * Copyright (c) 1982, 1986, 1989, 1993\n *\tThe Regents of the University of California.  All rights reserved.\n * (c) UNIX System Laboratories, Inc.\n * All or some portions of this file are derived from material licensed\n * to the University of California by American Telephone and Telegraph\n * Co. or Unix System Laboratories, Inc. and are reproduced herein with\n * the permission of UNIX System Laboratories, Inc.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 4. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t@(#)param.h\t8.3 (Berkeley) 4/4/95\n * $FreeBSD: release/9.0.0/sys/sys/param.h 226199 2011-10-10 12:07:04Z kib $\n */\n\n#ifndef _SYS_PARAM_H_\n#define _SYS_PARAM_H_\n\n#include <sys/_null.h>\n\n#define\tBSD\t199506\t\t/* System version (year & month). */\n#define BSD4_3\t1\n#define BSD4_4\t1\n\n/* \n * __FreeBSD_version numbers are documented in the Porter's Handbook.\n * If you bump the version for any reason, you should update the documentation\n * there.\n * Currently this lives here:\n *\n *\tdoc/en_US.ISO8859-1/books/porters-handbook/book.sgml\n *\n * scheme is:  <major><two digit minor>Rxx\n *\t\t'R' is in the range 0 to 4 if this is a release branch or\n *\t\tx.0-CURRENT before RELENG_*_0 is created, otherwise 'R' is\n *\t\tin the range 5 to 9.\n */\n#undef __FreeBSD_version\n#define __FreeBSD_version 900044\t/* Master, propagated to newvers */\n\n#ifdef _KERNEL\n#define\tP_OSREL_SIGWAIT\t\t700000\n#define\tP_OSREL_SIGSEGV\t\t700004\n#define\tP_OSREL_MAP_ANON\t800104\n#endif\n\n#ifndef LOCORE\n#include <sys/types.h>\n#endif\n\n/*\n * Machine-independent constants (some used in following include files).\n * Redefined constants are from POSIX 1003.1 limits file.\n *\n * MAXCOMLEN should be >= sizeof(ac_comm) (see <acct.h>)\n */\n#include <sys/syslimits.h>\n\n#define\tMAXCOMLEN\t19\t\t/* max command name remembered */\n#define\tMAXINTERP\tPATH_MAX\t/* max interpreter file name length */\n#define\tMAXLOGNAME\t17\t\t/* max login name length (incl. NUL) */\n#define\tMAXUPRC\t\tCHILD_MAX\t/* max simultaneous processes */\n#define\tNCARGS\t\tARG_MAX\t\t/* max bytes for an exec function */\n#define\tNGROUPS\t\t(NGROUPS_MAX+1)\t/* max number groups */\n#define\tNOFILE\t\tOPEN_MAX\t/* max open files per process */\n#define\tNOGROUP\t\t65535\t\t/* marker for empty group set member */\n#define MAXHOSTNAMELEN\t256\t\t/* max hostname size */\n#define SPECNAMELEN\t63\t\t/* max length of devicename */\n\n/* More types and definitions used throughout the kernel. */\n#ifdef _KERNEL\n#include <sys/cdefs.h>\n#include <sys/errno.h>\n#ifndef LOCORE\n#include <sys/time.h>\n#include <sys/priority.h>\n#endif\n\n#ifndef FALSE\n#define\tFALSE\t0\n#endif\n#ifndef TRUE\n#define\tTRUE\t1\n#endif\n#endif\n\n#ifndef _KERNEL\n/* Signals. */\n#include <sys/signal.h>\n#endif\n\n/* Machine type dependent parameters. */\n#include <machine/param.h>\n#ifndef _KERNEL\n#include <sys/limits.h>\n#endif\n\n#ifndef DEV_BSHIFT\n#define\tDEV_BSHIFT\t9\t\t/* log2(DEV_BSIZE) */\n#endif\n#define\tDEV_BSIZE\t(1<<DEV_BSHIFT)\n\n#ifndef BLKDEV_IOSIZE\n#define BLKDEV_IOSIZE  PAGE_SIZE\t/* default block device I/O size */\n#endif\n#ifndef DFLTPHYS\n#define DFLTPHYS\t(64 * 1024)\t/* default max raw I/O transfer size */\n#endif\n#ifndef MAXPHYS\n#define MAXPHYS\t\t(128 * 1024)\t/* max raw I/O transfer size */\n#endif\n#ifndef MAXDUMPPGS\n#define MAXDUMPPGS\t(DFLTPHYS/PAGE_SIZE)\n#endif\n\n/*\n * Constants related to network buffer management.\n * MCLBYTES must be no larger than PAGE_SIZE.\n */\n#ifndef\tMSIZE\n#define MSIZE\t\t256\t\t/* size of an mbuf */\n#endif\t/* MSIZE */\n\n#ifndef\tMCLSHIFT\n#define MCLSHIFT\t11\t\t/* convert bytes to mbuf clusters */\n#endif\t/* MCLSHIFT */\n\n#define MCLBYTES\t(1 << MCLSHIFT)\t/* size of an mbuf cluster */\n\n#if PAGE_SIZE < 2048\n#define\tMJUMPAGESIZE\tMCLBYTES\n#elif PAGE_SIZE <= 8192\n#define\tMJUMPAGESIZE\tPAGE_SIZE\n#else\n#define\tMJUMPAGESIZE\t(8 * 1024)\n#endif\n\n#define\tMJUM9BYTES\t(9 * 1024)\t/* jumbo cluster 9k */\n#define\tMJUM16BYTES\t(16 * 1024)\t/* jumbo cluster 16k */\n\n/*\n * Some macros for units conversion\n */\n\n/* clicks to bytes */\n#ifndef ctob\n#define ctob(x)\t((x)<<PAGE_SHIFT)\n#endif\n\n/* bytes to clicks */\n#ifndef btoc\n#define btoc(x)\t(((vm_offset_t)(x)+PAGE_MASK)>>PAGE_SHIFT)\n#endif\n\n/*\n * btodb() is messy and perhaps slow because `bytes' may be an off_t.  We\n * want to shift an unsigned type to avoid sign extension and we don't\n * want to widen `bytes' unnecessarily.  Assume that the result fits in\n * a daddr_t.\n */\n#ifndef btodb\n#define btodb(bytes)\t \t\t/* calculates (bytes / DEV_BSIZE) */ \\\n\t(sizeof (bytes) > sizeof(long) \\\n\t ? (daddr_t)((unsigned long long)(bytes) >> DEV_BSHIFT) \\\n\t : (daddr_t)((unsigned long)(bytes) >> DEV_BSHIFT))\n#endif\n\n#ifndef dbtob\n#define dbtob(db)\t\t\t/* calculates (db * DEV_BSIZE) */ \\\n\t((off_t)(db) << DEV_BSHIFT)\n#endif\n\n#define\tPRIMASK\t0x0ff\n#define\tPCATCH\t0x100\t\t/* OR'd with pri for tsleep to check signals */\n#define\tPDROP\t0x200\t/* OR'd with pri to stop re-entry of interlock mutex */\n#define\tPBDRY\t0x400\t/* for PCATCH stop is done on the user boundary */\n\n#define\tNZERO\t0\t\t/* default \"nice\" */\n\n#define\tNBBY\t8\t\t/* number of bits in a byte */\n#define\tNBPW\tsizeof(int)\t/* number of bytes per word (integer) */\n\n#define\tCMASK\t022\t\t/* default file mask: S_IWGRP|S_IWOTH */\n\n#define\tNODEV\t(dev_t)(-1)\t/* non-existent device */\n\n/*\n * File system parameters and macros.\n *\n * MAXBSIZE -\tFilesystems are made out of blocks of at most MAXBSIZE bytes\n *\t\tper block.  MAXBSIZE may be made larger without effecting\n *\t\tany existing filesystems as long as it does not exceed MAXPHYS,\n *\t\tand may be made smaller at the risk of not being able to use\n *\t\tfilesystems which require a block size exceeding MAXBSIZE.\n *\n * BKVASIZE -\tNominal buffer space per buffer, in bytes.  BKVASIZE is the\n *\t\tminimum KVM memory reservation the kernel is willing to make.\n *\t\tFilesystems can of course request smaller chunks.  Actual \n *\t\tbacking memory uses a chunk size of a page (PAGE_SIZE).\n *\n *\t\tIf you make BKVASIZE too small you risk seriously fragmenting\n *\t\tthe buffer KVM map which may slow things down a bit.  If you\n *\t\tmake it too big the kernel will not be able to optimally use \n *\t\tthe KVM memory reserved for the buffer cache and will wind \n *\t\tup with too-few buffers.\n *\n *\t\tThe default is 16384, roughly 2x the block size used by a\n *\t\tnormal UFS filesystem.\n */\n#define MAXBSIZE\t65536\t/* must be power of 2 */\n#define BKVASIZE\t16384\t/* must be power of 2 */\n#define BKVAMASK\t(BKVASIZE-1)\n\n/*\n * MAXPATHLEN defines the longest permissible path length after expanding\n * symbolic links. It is used to allocate a temporary buffer from the buffer\n * pool in which to do the name expansion, hence should be a power of two,\n * and must be less than or equal to MAXBSIZE.  MAXSYMLINKS defines the\n * maximum number of symbolic links that may be expanded in a path name.\n * It should be set high enough to allow all legitimate uses, but halt\n * infinite loops reasonably quickly.\n */\n#define\tMAXPATHLEN\tPATH_MAX\n#define MAXSYMLINKS\t32\n\n/* Bit map related macros. */\n#define\tsetbit(a,i)\t(((unsigned char *)(a))[(i)/NBBY] |= 1<<((i)%NBBY))\n#define\tclrbit(a,i)\t(((unsigned char *)(a))[(i)/NBBY] &= ~(1<<((i)%NBBY)))\n#define\tisset(a,i)\t\t\t\t\t\t\t\\\n\t(((const unsigned char *)(a))[(i)/NBBY] & (1<<((i)%NBBY)))\n#define\tisclr(a,i)\t\t\t\t\t\t\t\\\n\t((((const unsigned char *)(a))[(i)/NBBY] & (1<<((i)%NBBY))) == 0)\n\n/* Macros for counting and rounding. */\n#ifndef howmany\n#define\thowmany(x, y)\t(((x)+((y)-1))/(y))\n#endif\n#define\trounddown(x, y)\t(((x)/(y))*(y))\n#define\troundup(x, y)\t((((x)+((y)-1))/(y))*(y))  /* to any y */\n#define\troundup2(x, y)\t(((x)+((y)-1))&(~((y)-1))) /* if y is powers of two */\n#define powerof2(x)\t((((x)-1)&(x))==0)\n\n/* Macros for min/max. */\n#define\tMIN(a,b) (((a)<(b))?(a):(b))\n#define\tMAX(a,b) (((a)>(b))?(a):(b))\n\n#ifdef _KERNEL\n/*\n * Basic byte order function prototypes for non-inline functions.\n */\n#ifndef LOCORE\n#ifndef _BYTEORDER_PROTOTYPED\n#define\t_BYTEORDER_PROTOTYPED\n__BEGIN_DECLS\n__uint32_t\t htonl(__uint32_t);\n__uint16_t\t htons(__uint16_t);\n__uint32_t\t ntohl(__uint32_t);\n__uint16_t\t ntohs(__uint16_t);\n__END_DECLS\n#endif\n#endif\n\n#ifndef lint\n#ifndef _BYTEORDER_FUNC_DEFINED\n#define\t_BYTEORDER_FUNC_DEFINED\n#define\thtonl(x)\t__htonl(x)\n#define\thtons(x)\t__htons(x)\n#define\tntohl(x)\t__ntohl(x)\n#define\tntohs(x)\t__ntohs(x)\n#endif /* !_BYTEORDER_FUNC_DEFINED */\n#endif /* lint */\n#endif /* _KERNEL */\n\n/*\n * Scale factor for scaled integers used to count %cpu time and load avgs.\n *\n * The number of CPU `tick's that map to a unique `%age' can be expressed\n * by the formula (1 / (2 ^ (FSHIFT - 11))).  The maximum load average that\n * can be calculated (assuming 32 bits) can be closely approximated using\n * the formula (2 ^ (2 * (16 - FSHIFT))) for (FSHIFT < 15).\n *\n * For the scheduler to maintain a 1:1 mapping of CPU `tick' to `%age',\n * FSHIFT must be at least 11; this gives us a maximum load avg of ~1024.\n */\n#define\tFSHIFT\t11\t\t/* bits to right of fixed binary point */\n#define FSCALE\t(1<<FSHIFT)\n\n#define dbtoc(db)\t\t\t/* calculates devblks to pages */ \\\n\t((db + (ctodb(1) - 1)) >> (PAGE_SHIFT - DEV_BSHIFT))\n \n#define ctodb(db)\t\t\t/* calculates pages to devblks */ \\\n\t((db) << (PAGE_SHIFT - DEV_BSHIFT))\n\n/*\n * Given the pointer x to the member m of the struct s, return\n * a pointer to the containing structure.\n */\n#define\tmember2struct(s, m, x)\t\t\t\t\t\t\\\n\t((struct s *)(void *)((char *)(x) - offsetof(struct s, m)))\n\n/*\n * Access a variable length array that has been declared as a fixed\n * length array.\n */\n#define __PAST_END(array, offset) (((typeof(*(array)) *)(array))[offset])\n\n#endif\t/* _SYS_PARAM_H_ */\n"
  },
  {
    "path": "freebsd-headers/sys/pciio.h",
    "content": "/*-\n * Copyright (c) 1997, Stefan Esser <se@FreeBSD.ORG>\n * Copyright (c) 1997, 1998, 1999, Kenneth D. Merry <ken@FreeBSD.ORG>\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice unmodified, this list of conditions, and the following\n *    disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR\n * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES\n * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,\n * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF\n * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n *\n *\t$FreeBSD: release/9.0.0/sys/sys/pciio.h 188032 2009-02-02 22:04:40Z jhb $\n *\n */\n\n#ifndef _SYS_PCIIO_H_\n#define\t_SYS_PCIIO_H_\n\n#include <sys/ioccom.h>\n\n#define PCI_MAXNAMELEN\t16\n\ntypedef enum {\n\tPCI_GETCONF_LAST_DEVICE,\n\tPCI_GETCONF_LIST_CHANGED,\n\tPCI_GETCONF_MORE_DEVS,\n\tPCI_GETCONF_ERROR\n} pci_getconf_status;\n\ntypedef enum {\n\tPCI_GETCONF_NO_MATCH\t\t= 0x0000,\n\tPCI_GETCONF_MATCH_DOMAIN\t= 0x0001,\n\tPCI_GETCONF_MATCH_BUS\t\t= 0x0002,\n\tPCI_GETCONF_MATCH_DEV\t\t= 0x0004,\n\tPCI_GETCONF_MATCH_FUNC\t\t= 0x0008,\n\tPCI_GETCONF_MATCH_NAME\t\t= 0x0010,\n\tPCI_GETCONF_MATCH_UNIT\t\t= 0x0020,\n\tPCI_GETCONF_MATCH_VENDOR\t= 0x0040,\n\tPCI_GETCONF_MATCH_DEVICE\t= 0x0080,\n\tPCI_GETCONF_MATCH_CLASS\t\t= 0x0100\n} pci_getconf_flags;\n\nstruct pcisel {\n\tu_int32_t\tpc_domain;\t/* domain number */\n\tu_int8_t\tpc_bus;\t\t/* bus number */\n\tu_int8_t\tpc_dev;\t\t/* device on this bus */\n\tu_int8_t\tpc_func;\t/* function on this device */\n};\n\nstruct pci_conf {\n\tstruct pcisel\tpc_sel;\t\t/* domain+bus+slot+function */\n\tu_int8_t\tpc_hdr;\t\t/* PCI header type */\n\tu_int16_t\tpc_subvendor;\t/* card vendor ID */\n\tu_int16_t\tpc_subdevice;\t/* card device ID, assigned by \n\t\t\t\t\t   card vendor */\n\tu_int16_t\tpc_vendor;\t/* chip vendor ID */\n\tu_int16_t\tpc_device;\t/* chip device ID, assigned by \n\t\t\t\t\t   chip vendor */\n\tu_int8_t\tpc_class;\t/* chip PCI class */\n\tu_int8_t\tpc_subclass;\t/* chip PCI subclass */\n\tu_int8_t\tpc_progif;\t/* chip PCI programming interface */\n\tu_int8_t\tpc_revid;\t/* chip revision ID */\n\tchar\t\tpd_name[PCI_MAXNAMELEN + 1];  /* device name */\n\tu_long\t\tpd_unit;\t/* device unit number */\n};\n\nstruct pci_match_conf {\n\tstruct pcisel\t\tpc_sel;\t\t/* domain+bus+slot+function */\n\tchar\t\t\tpd_name[PCI_MAXNAMELEN + 1];  /* device name */\n\tu_long\t\t\tpd_unit;\t/* Unit number */\n\tu_int16_t\t\tpc_vendor;\t/* PCI Vendor ID */\n\tu_int16_t\t\tpc_device;\t/* PCI Device ID */\n\tu_int8_t\t\tpc_class;\t/* PCI class */\n\tpci_getconf_flags\tflags;\t\t/* Matching expression */\n};\n\nstruct pci_conf_io {\n\tu_int32_t\t\tpat_buf_len;\t/* pattern buffer length */\n\tu_int32_t\t\tnum_patterns;\t/* number of patterns */\n\tstruct pci_match_conf\t*patterns;\t/* pattern buffer */\n\tu_int32_t\t\tmatch_buf_len;\t/* match buffer length */\n\tu_int32_t\t\tnum_matches;\t/* number of matches returned */\n\tstruct pci_conf\t\t*matches;\t/* match buffer */\n\tu_int32_t\t\toffset;\t\t/* offset into device list */\n\tu_int32_t\t\tgeneration;\t/* device list generation */\n\tpci_getconf_status\tstatus;\t\t/* request status */\n};\n\nstruct pci_io {\n\tstruct pcisel\tpi_sel;\t\t/* device to operate on */\n\tint\t\tpi_reg;\t\t/* configuration register to examine */\n\tint\t\tpi_width;\t/* width (in bytes) of read or write */\n\tu_int32_t\tpi_data;\t/* data to write or result of read */\n};\n\nstruct pci_bar_io {\n\tstruct pcisel\tpbi_sel;\t/* device to operate on */\n\tint\t\tpbi_reg;\t/* starting address of BAR */\n\tint\t\tpbi_enabled;\t/* decoding enabled */\n\tuint64_t\tpbi_base;\t/* current value of BAR */\n\tuint64_t\tpbi_length;\t/* length of BAR */\n};\n\n#define\tPCIOCGETCONF\t_IOWR('p', 5, struct pci_conf_io)\n#define\tPCIOCREAD\t_IOWR('p', 2, struct pci_io)\n#define\tPCIOCWRITE\t_IOWR('p', 3, struct pci_io)\n#define\tPCIOCATTACHED\t_IOWR('p', 4, struct pci_io)\n#define\tPCIOCGETBAR\t_IOWR('p', 6, struct pci_bar_io)\n\n#endif /* !_SYS_PCIIO_H_ */\n"
  },
  {
    "path": "freebsd-headers/sys/pcpu.h",
    "content": "/*-\n * Copyright (c) 2001 Wind River Systems, Inc.\n * All rights reserved.\n * Written by: John Baldwin <jhb@FreeBSD.org>\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 4. Neither the name of the author nor the names of any co-contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/sys/pcpu.h 224221 2011-07-19 16:50:55Z attilio $\n */\n\n#ifndef _SYS_PCPU_H_\n#define\t_SYS_PCPU_H_\n\n#ifdef LOCORE\n#error \"no assembler-serviceable parts inside\"\n#endif\n\n#include <sys/_cpuset.h>\n#include <sys/queue.h>\n#include <sys/vmmeter.h>\n#include <sys/resource.h>\n#include <machine/pcpu.h>\n\n#define\tDPCPU_SETNAME\t\t\"set_pcpu\"\n#define\tDPCPU_SYMPREFIX\t\t\"pcpu_entry_\"\n\n#ifdef _KERNEL\n\n/*\n * Define a set for pcpu data.\n */\nextern uintptr_t *__start_set_pcpu;\n__GLOBL(__start_set_pcpu);\nextern uintptr_t *__stop_set_pcpu;\n__GLOBL(__stop_set_pcpu);\n\n/*\n * Array of dynamic pcpu base offsets.  Indexed by id.\n */\nextern uintptr_t dpcpu_off[];\n\n/*\n * Convenience defines.\n */\n#define\tDPCPU_START\t\t((uintptr_t)&__start_set_pcpu)\n#define\tDPCPU_STOP\t\t((uintptr_t)&__stop_set_pcpu)\n#define\tDPCPU_BYTES\t\t(DPCPU_STOP - DPCPU_START)\n#define\tDPCPU_MODMIN\t\t2048\n#define\tDPCPU_SIZE\t\troundup2(DPCPU_BYTES, PAGE_SIZE)\n#define\tDPCPU_MODSIZE\t\t(DPCPU_SIZE - (DPCPU_BYTES - DPCPU_MODMIN))\n\n/*\n * Declaration and definition.\n */\n#define\tDPCPU_NAME(n)\t\tpcpu_entry_##n\n#define\tDPCPU_DECLARE(t, n)\textern t DPCPU_NAME(n)\n#define\tDPCPU_DEFINE(t, n)\tt DPCPU_NAME(n) __section(DPCPU_SETNAME) __used\n\n/*\n * Accessors with a given base.\n */\n#define\t_DPCPU_PTR(b, n)\t\t\t\t\t\t\\\n    (__typeof(DPCPU_NAME(n))*)((b) + (uintptr_t)&DPCPU_NAME(n))\n#define\t_DPCPU_GET(b, n)\t(*_DPCPU_PTR(b, n))\n#define\t_DPCPU_SET(b, n, v)\t(*_DPCPU_PTR(b, n) = v)\n\n/*\n * Accessors for the current cpu.\n */\n#define\tDPCPU_PTR(n)\t\t_DPCPU_PTR(PCPU_GET(dynamic), n)\n#define\tDPCPU_GET(n)\t\t(*DPCPU_PTR(n))\n#define\tDPCPU_SET(n, v)\t\t(*DPCPU_PTR(n) = v)\n\n/*\n * Accessors for remote cpus.\n */\n#define\tDPCPU_ID_PTR(i, n)\t_DPCPU_PTR(dpcpu_off[(i)], n)\n#define\tDPCPU_ID_GET(i, n)\t(*DPCPU_ID_PTR(i, n))\n#define\tDPCPU_ID_SET(i, n, v)\t(*DPCPU_ID_PTR(i, n) = v)\n\n/*\n * Utility macros.\n */\n#define\tDPCPU_SUM(n) __extension__\t\t\t\t\t\\\n({\t\t\t\t\t\t\t\t\t\\\n\tu_int _i;\t\t\t\t\t\t\t\\\n\t__typeof(*DPCPU_PTR(n)) sum;\t\t\t\t\t\\\n\t\t\t\t\t\t\t\t\t\\\n\tsum = 0;\t\t\t\t\t\t\t\\\n\tCPU_FOREACH(_i) {\t\t\t\t\t\t\\\n\t\tsum += *DPCPU_ID_PTR(_i, n);\t\t\t\t\\\n\t}\t\t\t\t\t\t\t\t\\\n\tsum;\t\t\t\t\t\t\t\t\\\n})\n\n#define\tDPCPU_VARSUM(n, var) __extension__\t\t\t\t\\\n({\t\t\t\t\t\t\t\t\t\\\n\tu_int _i;\t\t\t\t\t\t\t\\\n\t__typeof((DPCPU_PTR(n))->var) sum;\t\t\t\t\\\n\t\t\t\t\t\t\t\t\t\\\n\tsum = 0;\t\t\t\t\t\t\t\\\n\tCPU_FOREACH(_i) {\t\t\t\t\t\t\\\n\t\tsum += (DPCPU_ID_PTR(_i, n))->var;\t\t\t\\\n\t}\t\t\t\t\t\t\t\t\\\n\tsum;\t\t\t\t\t\t\t\t\\\n})\n\n#define\tDPCPU_ZERO(n) do {\t\t\t\t\t\t\\\n\tu_int _i;\t\t\t\t\t\t\t\\\n\t\t\t\t\t\t\t\t\t\\\n\tCPU_FOREACH(_i) {\t\t\t\t\t\t\\\n\t\tbzero(DPCPU_ID_PTR(_i, n), sizeof(*DPCPU_PTR(n)));\t\\\n\t}\t\t\t\t\t\t\t\t\\\n} while(0)\n\n#endif /* _KERNEL */\n\n/* \n * XXXUPS remove as soon as we have per cpu variable\n * linker sets and can define rm_queue in _rm_lock.h\n */\nstruct rm_queue {\n\tstruct rm_queue* volatile rmq_next;\n\tstruct rm_queue* volatile rmq_prev;\n};\n\n/*\n * This structure maps out the global data that needs to be kept on a\n * per-cpu basis.  The members are accessed via the PCPU_GET/SET/PTR\n * macros defined in <machine/pcpu.h>.  Machine dependent fields are\n * defined in the PCPU_MD_FIELDS macro defined in <machine/pcpu.h>.\n */\nstruct pcpu {\n\tstruct thread\t*pc_curthread;\t\t/* Current thread */\n\tstruct thread\t*pc_idlethread;\t\t/* Idle thread */\n\tstruct thread\t*pc_fpcurthread;\t/* Fp state owner */\n\tstruct thread\t*pc_deadthread;\t\t/* Zombie thread or NULL */\n\tstruct pcb\t*pc_curpcb;\t\t/* Current pcb */\n\tuint64_t\tpc_switchtime;\t\t/* cpu_ticks() at last csw */\n\tint\t\tpc_switchticks;\t\t/* `ticks' at last csw */\n\tu_int\t\tpc_cpuid;\t\t/* This cpu number */\n\tSTAILQ_ENTRY(pcpu) pc_allcpu;\n\tstruct lock_list_entry *pc_spinlocks;\n\tstruct vmmeter\tpc_cnt;\t\t\t/* VM stats counters */\n\tlong\t\tpc_cp_time[CPUSTATES];\t/* statclock ticks */\n\tstruct device\t*pc_device;\n\tvoid\t\t*pc_netisr;\t\t/* netisr SWI cookie */\n\tint\t\tpc_dnweight;\t\t/* vm_page_dontneed() */\n\tint\t\tpc_domain;\t\t/* Memory domain. */\n\n\t/*\n\t * Stuff for read mostly lock\n\t *\n\t * XXXUPS remove as soon as we have per cpu variable\n\t * linker sets.\n\t */\n\tstruct rm_queue\tpc_rm_queue;\n\n\tuintptr_t\tpc_dynamic;\t\t/* Dynamic per-cpu data area */\n\n\t/*\n\t * Keep MD fields last, so that CPU-specific variations on a\n\t * single architecture don't result in offset variations of\n\t * the machine-independent fields of the pcpu.  Even though\n\t * the pcpu structure is private to the kernel, some ports\n\t * (e.g., lsof, part of gtop) define _KERNEL and include this\n\t * header.  While strictly speaking this is wrong, there's no\n\t * reason not to keep the offsets of the MI fields constant\n\t * if only to make kernel debugging easier.\n\t */\n\tPCPU_MD_FIELDS;\n} __aligned(CACHE_LINE_SIZE);\n\n#ifdef _KERNEL\n\nSTAILQ_HEAD(cpuhead, pcpu);\n\nextern struct cpuhead cpuhead;\nextern struct pcpu *cpuid_to_pcpu[];\n\n#define\tcurcpu\t\tPCPU_GET(cpuid)\n#define\tcurproc\t\t(curthread->td_proc)\n#ifndef curthread\n#define\tcurthread\tPCPU_GET(curthread)\n#endif\n#define\tcurvidata\tPCPU_GET(vidata)\n\n/*\n * Machine dependent callouts.  cpu_pcpu_init() is responsible for\n * initializing machine dependent fields of struct pcpu, and\n * db_show_mdpcpu() is responsible for handling machine dependent\n * fields for the DDB 'show pcpu' command.\n */\nvoid\tcpu_pcpu_init(struct pcpu *pcpu, int cpuid, size_t size);\nvoid\tdb_show_mdpcpu(struct pcpu *pcpu);\n\nvoid\t*dpcpu_alloc(int size);\nvoid\tdpcpu_copy(void *s, int size);\nvoid\tdpcpu_free(void *s, int size);\nvoid\tdpcpu_init(void *dpcpu, int cpuid);\nvoid\tpcpu_destroy(struct pcpu *pcpu);\nstruct\tpcpu *pcpu_find(u_int cpuid);\nvoid\tpcpu_init(struct pcpu *pcpu, int cpuid, size_t size);\n\n#endif /* _KERNEL */\n\n#endif /* !_SYS_PCPU_H_ */\n"
  },
  {
    "path": "freebsd-headers/sys/pioctl.h",
    "content": "/*-\n * Copyright 1997 Sean Eric Fagan\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. All advertising materials mentioning features or use of this software\n *    must display the following acknowledgement:\n *\tThis product includes software developed by Sean Eric Fagan\n * 4. Neither the name of the author may be used to endorse or promote\n *    products derived from this software without specific prior written\n *    permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n */\n\n/*\n * procfs ioctl definitions.\n *\n * $FreeBSD: release/9.0.0/sys/sys/pioctl.h 217747 2011-01-23 12:44:17Z kib $\n */\n\n#ifndef _SYS_PIOCTL_H\n# define _SYS_PIOCTL_H\n\n# include <sys/ioccom.h>\n\nstruct procfs_status {\n\tint\tstate;\t/* Running, stopped, something else? */\n\tint\tflags;\t/* Any flags */\n\tunsigned long\tevents;\t/* Events to stop on */\n\tint\twhy;\t/* What event, if any, proc stopped on */\n\tunsigned long\tval;\t/* Any extra data */\n};\n\n# define\tPIOCBIS\t_IOWINT('p', 1)\t/* Set event flag */\n# define\tPIOCBIC\t_IOWINT('p', 2)\t/* Clear event flag */\n# define\tPIOCSFL\t_IOWINT('p', 3)\t/* Set flags */\n\t\t\t/* wait for proc to stop */\n# define\tPIOCWAIT\t_IOR('p', 4, struct procfs_status)\n# define\tPIOCCONT\t_IOWINT('p', 5)\t/* Continue a process */\n\t\t\t/* Get proc status */\n# define\tPIOCSTATUS\t_IOR('p', 6, struct procfs_status)\n# define\tPIOCGFL\t_IOR('p', 7, unsigned int)\t/* Get flags */\n\n# define\tS_EXEC\t0x00000001\t/* stop-on-exec */\n# define\tS_SIG\t0x00000002\t/* stop-on-signal */\n# define\tS_SCE\t0x00000004\t/* stop on syscall entry */\n# define\tS_SCX\t0x00000008\t/* stop on syscall exit */\n# define\tS_CORE\t0x00000010\t/* stop on coredump */\n# define\tS_EXIT\t0x00000020\t/* stop on exit */\n# define\tS_ALLSTOPS  0x003f\t/* stop on all events */\n\n/*\n * If PF_LINGER is set in procp->p_pfsflags, then the last close\n * of a /proc/<pid>/mem file will not clear out the stops and continue\n * the process.\n */\n\n# define PF_LINGER\t0x01\t/* Keep stops around after last close */\n# define PF_ISUGID\t0x02\t/* Ignore UID/GID changes */\n# define PF_FORK\t0x04\t/* Retain settings on fork() */\n#endif \n"
  },
  {
    "path": "freebsd-headers/sys/pipe.h",
    "content": "/*-\n * Copyright (c) 1996 John S. Dyson\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice immediately at the beginning of the file, without modification,\n *    this list of conditions, and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. Absolutely no warranty of function or purpose is made by the author\n *    John S. Dyson.\n * 4. This work was done expressly for inclusion into FreeBSD.  Other use\n *    is allowed if this notation is included.\n * 5. Modifications may be freely made to this file if the above conditions\n *    are met.\n *\n * $FreeBSD: release/9.0.0/sys/sys/pipe.h 226578 2011-10-20 18:54:05Z kib $\n */\n\n#ifndef _SYS_PIPE_H_\n#define _SYS_PIPE_H_\n\n#ifndef _KERNEL\n#error \"no user-servicable parts inside\"\n#endif\n\n/*\n * Pipe buffer size, keep moderate in value, pipes take kva space.\n */\n#ifndef PIPE_SIZE\n#define PIPE_SIZE\t16384\n#endif\n\n#ifndef BIG_PIPE_SIZE\n#define BIG_PIPE_SIZE\t(64*1024)\n#endif\n\n#ifndef SMALL_PIPE_SIZE\n#define SMALL_PIPE_SIZE\tPAGE_SIZE\n#endif\n\n/*\n * PIPE_MINDIRECT MUST be smaller than PIPE_SIZE and MUST be bigger\n * than PIPE_BUF.\n */\n#ifndef PIPE_MINDIRECT\n#define PIPE_MINDIRECT\t8192\n#endif\n\n#define PIPENPAGES\t(BIG_PIPE_SIZE / PAGE_SIZE + 1)\n\n/*\n * See sys_pipe.c for info on what these limits mean. \n */\nextern long\tmaxpipekva;\n\n/*\n * Pipe buffer information.\n * Separate in, out, cnt are used to simplify calculations.\n * Buffered write is active when the buffer.cnt field is set.\n */\nstruct pipebuf {\n\tu_int\tcnt;\t\t/* number of chars currently in buffer */\n\tu_int\tin;\t\t/* in pointer */\n\tu_int\tout;\t\t/* out pointer */\n\tu_int\tsize;\t\t/* size of buffer */\n\tcaddr_t\tbuffer;\t\t/* kva of buffer */\n};\n\n/*\n * Information to support direct transfers between processes for pipes.\n */\nstruct pipemapping {\n\tvm_size_t\tcnt;\t\t/* number of chars in buffer */\n\tvm_size_t\tpos;\t\t/* current position of transfer */\n\tint\t\tnpages;\t\t/* number of pages */\n\tvm_page_t\tms[PIPENPAGES];\t/* pages in source process */\n};\n\n/*\n * Bits in pipe_state.\n */\n#define PIPE_ASYNC\t0x004\t/* Async? I/O. */\n#define PIPE_WANTR\t0x008\t/* Reader wants some characters. */\n#define PIPE_WANTW\t0x010\t/* Writer wants space to put characters. */\n#define PIPE_WANT\t0x020\t/* Pipe is wanted to be run-down. */\n#define PIPE_SEL\t0x040\t/* Pipe has a select active. */\n#define PIPE_EOF\t0x080\t/* Pipe is in EOF condition. */\n#define PIPE_LOCKFL\t0x100\t/* Process has exclusive access to pointers/data. */\n#define PIPE_LWANT\t0x200\t/* Process wants exclusive access to pointers/data. */\n#define PIPE_DIRECTW\t0x400\t/* Pipe direct write active. */\n#define PIPE_DIRECTOK\t0x800\t/* Direct mode ok. */\n\n/*\n * Per-pipe data structure.\n * Two of these are linked together to produce bi-directional pipes.\n */\nstruct pipe {\n\tstruct\tpipebuf pipe_buffer;\t/* data storage */\n\tstruct\tpipemapping pipe_map;\t/* pipe mapping for direct I/O */\n\tstruct\tselinfo pipe_sel;\t/* for compat with select */\n\tstruct\ttimespec pipe_atime;\t/* time of last access */\n\tstruct\ttimespec pipe_mtime;\t/* time of last modify */\n\tstruct\ttimespec pipe_ctime;\t/* time of status change */\n\tstruct\tsigio *pipe_sigio;\t/* information for async I/O */\n\tstruct\tpipe *pipe_peer;\t/* link with other direction */\n\tstruct\tpipepair *pipe_pair;\t/* container structure pointer */\n\tu_int\tpipe_state;\t\t/* pipe status info */\n\tint\tpipe_busy;\t\t/* busy flag, mostly to handle rundown sanely */\n\tint\tpipe_present;\t\t/* still present? */\n\tino_t\tpipe_ino;\t\t/* fake inode for stat(2) */\n};\n\n/*\n * Values for the pipe_present.\n */\n#define PIPE_ACTIVE\t\t1\n#define\tPIPE_CLOSING\t\t2\n#define\tPIPE_FINALIZED\t\t3\n\n/*\n * Container structure to hold the two pipe endpoints, mutex, and label\n * pointer.\n */\nstruct pipepair {\n\tstruct pipe\tpp_rpipe;\n\tstruct pipe\tpp_wpipe;\n\tstruct mtx\tpp_mtx;\n\tstruct label\t*pp_label;\n};\n\n#define PIPE_MTX(pipe)\t\t(&(pipe)->pipe_pair->pp_mtx)\n#define PIPE_LOCK(pipe)\t\tmtx_lock(PIPE_MTX(pipe))\n#define PIPE_UNLOCK(pipe)\tmtx_unlock(PIPE_MTX(pipe))\n#define PIPE_LOCK_ASSERT(pipe, type)  mtx_assert(PIPE_MTX(pipe), (type))\n\n\n#endif /* !_SYS_PIPE_H_ */\n"
  },
  {
    "path": "freebsd-headers/sys/pmc.h",
    "content": "/*-\n * Copyright (c) 2003-2008, Joseph Koshy\n * Copyright (c) 2007 The FreeBSD Foundation\n * All rights reserved.\n *\n * Portions of this software were developed by A. Joseph Koshy under\n * sponsorship from the FreeBSD Foundation and Google, Inc.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/sys/pmc.h 209196 2010-06-15 09:12:31Z fabient $\n */\n\n#ifndef _SYS_PMC_H_\n#define\t_SYS_PMC_H_\n\n#include <dev/hwpmc/pmc_events.h>\n\n#include <machine/pmc_mdep.h>\n#include <machine/profile.h>\n\n#define\tPMC_MODULE_NAME\t\t\"hwpmc\"\n#define\tPMC_NAME_MAX\t\t16 /* HW counter name size */\n#define\tPMC_CLASS_MAX\t\t6  /* max #classes of PMCs per-system */\n\n/*\n * Kernel<->userland API version number [MMmmpppp]\n *\n * Major numbers are to be incremented when an incompatible change to\n * the ABI occurs that older clients will not be able to handle.\n *\n * Minor numbers are incremented when a backwards compatible change\n * occurs that allows older correct programs to run unchanged.  For\n * example, when support for a new PMC type is added.\n *\n * The patch version is incremented for every bug fix.\n */\n#define\tPMC_VERSION_MAJOR\t0x03\n#define\tPMC_VERSION_MINOR\t0x01\n#define\tPMC_VERSION_PATCH\t0x0000\n\n#define\tPMC_VERSION\t\t(PMC_VERSION_MAJOR << 24 |\t\t\\\n\tPMC_VERSION_MINOR << 16 | PMC_VERSION_PATCH)\n\n/*\n * Kinds of CPUs known.\n *\n * We keep track of CPU variants that need to be distinguished in\n * some way for PMC operations.  CPU names are grouped by manufacturer\n * and numbered sparsely in order to minimize changes to the ABI involved\n * when new CPUs are added.\n */\n\n#define\t__PMC_CPUS()\t\t\t\t\t\t\\\n\t__PMC_CPU(AMD_K7,\t0x00,\t\"AMD K7\")\t\t\\\n\t__PMC_CPU(AMD_K8,\t0x01,\t\"AMD K8\")\t\t\\\n\t__PMC_CPU(INTEL_P5,\t0x80,\t\"Intel Pentium\")\t\\\n\t__PMC_CPU(INTEL_P6,\t0x81,\t\"Intel Pentium Pro\")\t\\\n\t__PMC_CPU(INTEL_CL,\t0x82,\t\"Intel Celeron\")\t\\\n\t__PMC_CPU(INTEL_PII,\t0x83,\t\"Intel Pentium II\")\t\\\n\t__PMC_CPU(INTEL_PIII,\t0x84,\t\"Intel Pentium III\")\t\\\n\t__PMC_CPU(INTEL_PM,\t0x85,\t\"Intel Pentium M\")\t\\\n\t__PMC_CPU(INTEL_PIV,\t0x86,\t\"Intel Pentium IV\")\t\\\n\t__PMC_CPU(INTEL_CORE,\t0x87,\t\"Intel Core Solo/Duo\")\t\\\n\t__PMC_CPU(INTEL_CORE2,\t0x88,\t\"Intel Core2\")\t\t\\\n\t__PMC_CPU(INTEL_CORE2EXTREME,\t0x89,\t\"Intel Core2 Extreme\")\t\\\n\t__PMC_CPU(INTEL_ATOM,\t0x8A,\t\"Intel Atom\") \\\n\t__PMC_CPU(INTEL_COREI7, 0x8B,   \"Intel Core i7\") \\\n\t__PMC_CPU(INTEL_WESTMERE, 0x8C,   \"Intel Westmere\") \\\n\t__PMC_CPU(INTEL_XSCALE,\t0x100,\t\"Intel XScale\") \\\n\t__PMC_CPU(MIPS_24K,     0x200,  \"MIPS 24K\") \n\nenum pmc_cputype {\n#undef\t__PMC_CPU\n#define\t__PMC_CPU(S,V,D)\tPMC_CPU_##S = V,\n\t__PMC_CPUS()\n};\n\n#define\tPMC_CPU_FIRST\tPMC_CPU_AMD_K7\n#define\tPMC_CPU_LAST\tPMC_CPU_MIPS_24K\n\n/*\n * Classes of PMCs\n */\n\n#define\t__PMC_CLASSES()\t\t\t\t\t\t\t\\\n\t__PMC_CLASS(TSC)\t/* CPU Timestamp counter */\t\t\\\n\t__PMC_CLASS(K7)\t\t/* AMD K7 performance counters */\t\\\n\t__PMC_CLASS(K8)\t\t/* AMD K8 performance counters */\t\\\n\t__PMC_CLASS(P5)\t\t/* Intel Pentium counters */\t\t\\\n\t__PMC_CLASS(P6)\t\t/* Intel Pentium Pro counters */\t\\\n\t__PMC_CLASS(P4)\t\t/* Intel Pentium-IV counters */\t\t\\\n\t__PMC_CLASS(IAF)\t/* Intel Core2/Atom, fixed function */\t\\\n\t__PMC_CLASS(IAP)\t/* Intel Core...Atom, programmable */\t\\\n\t__PMC_CLASS(UCF)\t/* Intel Uncore fixed function */\t\\\n\t__PMC_CLASS(UCP)\t/* Intel Uncore programmable */\t\t\\\n\t__PMC_CLASS(XSCALE)\t/* Intel XScale counters */\t\t\\\n\t__PMC_CLASS(MIPS24K)    /* MIPS 24K */\n\nenum pmc_class {\n#undef  __PMC_CLASS\n#define\t__PMC_CLASS(N)\tPMC_CLASS_##N ,\n\t__PMC_CLASSES()\n};\n\n#define\tPMC_CLASS_FIRST\tPMC_CLASS_TSC\n#define\tPMC_CLASS_LAST\tPMC_CLASS_MIPS24K\n\n/*\n * A PMC can be in the following states:\n *\n * Hardware states:\n *   DISABLED   -- administratively prohibited from being used.\n *   FREE       -- HW available for use\n * Software states:\n *   ALLOCATED  -- allocated\n *   STOPPED    -- allocated, but not counting events\n *   RUNNING    -- allocated, and in operation; 'pm_runcount'\n *                 holds the number of CPUs using this PMC at\n *                 a given instant\n *   DELETED    -- being destroyed\n */\n\n#define\t__PMC_HWSTATES()\t\t\t\\\n\t__PMC_STATE(DISABLED)\t\t\t\\\n\t__PMC_STATE(FREE)\n\n#define\t__PMC_SWSTATES()\t\t\t\\\n\t__PMC_STATE(ALLOCATED)\t\t\t\\\n\t__PMC_STATE(STOPPED)\t\t\t\\\n\t__PMC_STATE(RUNNING)\t\t\t\\\n\t__PMC_STATE(DELETED)\n\n#define\t__PMC_STATES()\t\t\t\t\\\n\t__PMC_HWSTATES()\t\t\t\\\n\t__PMC_SWSTATES()\n\nenum pmc_state {\n#undef\t__PMC_STATE\n#define\t__PMC_STATE(S)\tPMC_STATE_##S,\n\t__PMC_STATES()\n\t__PMC_STATE(MAX)\n};\n\n#define\tPMC_STATE_FIRST\tPMC_STATE_DISABLED\n#define\tPMC_STATE_LAST\tPMC_STATE_DELETED\n\n/*\n * An allocated PMC may used as a 'global' counter or as a\n * 'thread-private' one.  Each such mode of use can be in either\n * statistical sampling mode or in counting mode.  Thus a PMC in use\n *\n * SS i.e., SYSTEM STATISTICAL  -- system-wide statistical profiling\n * SC i.e., SYSTEM COUNTER      -- system-wide counting mode\n * TS i.e., THREAD STATISTICAL  -- thread virtual, statistical profiling\n * TC i.e., THREAD COUNTER      -- thread virtual, counting mode\n *\n * Statistical profiling modes rely on the PMC periodically delivering\n * a interrupt to the CPU (when the configured number of events have\n * been measured), so the PMC must have the ability to generate\n * interrupts.\n *\n * In counting modes, the PMC counts its configured events, with the\n * value of the PMC being read whenever needed by its owner process.\n *\n * The thread specific modes \"virtualize\" the PMCs -- the PMCs appear\n * to be thread private and count events only when the profiled thread\n * actually executes on the CPU.\n *\n * The system-wide \"global\" modes keep the PMCs running all the time\n * and are used to measure the behaviour of the whole system.\n */\n\n#define\t__PMC_MODES()\t\t\t\t\\\n\t__PMC_MODE(SS,\t0)\t\t\t\\\n\t__PMC_MODE(SC,\t1)\t\t\t\\\n\t__PMC_MODE(TS,\t2)\t\t\t\\\n\t__PMC_MODE(TC,\t3)\n\nenum pmc_mode {\n#undef\t__PMC_MODE\n#define\t__PMC_MODE(M,N)\tPMC_MODE_##M = N,\n\t__PMC_MODES()\n};\n\n#define\tPMC_MODE_FIRST\tPMC_MODE_SS\n#define\tPMC_MODE_LAST\tPMC_MODE_TC\n\n#define\tPMC_IS_COUNTING_MODE(mode)\t\t\t\t\\\n\t((mode) == PMC_MODE_SC || (mode) == PMC_MODE_TC)\n#define\tPMC_IS_SYSTEM_MODE(mode)\t\t\t\t\\\n\t((mode) == PMC_MODE_SS || (mode) == PMC_MODE_SC)\n#define\tPMC_IS_SAMPLING_MODE(mode)\t\t\t\t\\\n\t((mode) == PMC_MODE_SS || (mode) == PMC_MODE_TS)\n#define\tPMC_IS_VIRTUAL_MODE(mode)\t\t\t\t\\\n\t((mode) == PMC_MODE_TS || (mode) == PMC_MODE_TC)\n\n/*\n * PMC row disposition\n */\n\n#define\t__PMC_DISPOSITIONS(N)\t\t\t\t\t\\\n\t__PMC_DISP(STANDALONE)\t/* global/disabled counters */\t\\\n\t__PMC_DISP(FREE)\t/* free/available */\t\t\\\n\t__PMC_DISP(THREAD)\t/* thread-virtual PMCs */\t\\\n\t__PMC_DISP(UNKNOWN)\t/* sentinel */\n\nenum pmc_disp {\n#undef\t__PMC_DISP\n#define\t__PMC_DISP(D)\tPMC_DISP_##D ,\n\t__PMC_DISPOSITIONS()\n};\n\n#define\tPMC_DISP_FIRST\tPMC_DISP_STANDALONE\n#define\tPMC_DISP_LAST\tPMC_DISP_THREAD\n\n/*\n * Counter capabilities\n *\n * __PMC_CAPS(NAME, VALUE, DESCRIPTION)\n */\n\n#define\t__PMC_CAPS()\t\t\t\t\t\t\t\\\n\t__PMC_CAP(INTERRUPT,\t0, \"generate interrupts\")\t\t\\\n\t__PMC_CAP(USER,\t\t1, \"count user-mode events\")\t\t\\\n\t__PMC_CAP(SYSTEM,\t2, \"count system-mode events\")\t\t\\\n\t__PMC_CAP(EDGE,\t\t3, \"do edge detection of events\")\t\\\n\t__PMC_CAP(THRESHOLD,\t4, \"ignore events below a threshold\")\t\\\n\t__PMC_CAP(READ,\t\t5, \"read PMC counter\")\t\t\t\\\n\t__PMC_CAP(WRITE,\t6, \"reprogram PMC counter\")\t\t\\\n\t__PMC_CAP(INVERT,\t7, \"invert comparision sense\")\t\t\\\n\t__PMC_CAP(QUALIFIER,\t8, \"further qualify monitored events\")\t\\\n\t__PMC_CAP(PRECISE,\t9, \"perform precise sampling\")\t\t\\\n\t__PMC_CAP(TAGGING,\t10, \"tag upstream events\")\t\t\\\n\t__PMC_CAP(CASCADE,\t11, \"cascade counters\")\n\nenum pmc_caps\n{\n#undef\t__PMC_CAP\n#define\t__PMC_CAP(NAME, VALUE, DESCR)\tPMC_CAP_##NAME = (1 << VALUE) ,\n\t__PMC_CAPS()\n};\n\n#define\tPMC_CAP_FIRST\t\tPMC_CAP_INTERRUPT\n#define\tPMC_CAP_LAST\t\tPMC_CAP_CASCADE\n\n/*\n * PMC Event Numbers\n *\n * These are generated from the definitions in \"dev/hwpmc/pmc_events.h\".\n */\n\nenum pmc_event {\n#undef\t__PMC_EV\n#undef\t__PMC_EV_BLOCK\n#define\t__PMC_EV_BLOCK(C,V)\tPMC_EV_ ## C ## __BLOCK_START = (V) - 1 ,\n#define\t__PMC_EV(C,N)\t\tPMC_EV_ ## C ## _ ## N ,\n\t__PMC_EVENTS()\n};\n\n/*\n * PMC SYSCALL INTERFACE\n */\n\n/*\n * \"PMC_OPS\" -- these are the commands recognized by the kernel\n * module, and are used when performing a system call from userland.\n */\n#define\t__PMC_OPS()\t\t\t\t\t\t\t\\\n\t__PMC_OP(CONFIGURELOG, \"Set log file\")\t\t\t\t\\\n\t__PMC_OP(FLUSHLOG, \"Flush log file\")\t\t\t\t\\\n\t__PMC_OP(GETCPUINFO, \"Get system CPU information\")\t\t\\\n\t__PMC_OP(GETDRIVERSTATS, \"Get driver statistics\")\t\t\\\n\t__PMC_OP(GETMODULEVERSION, \"Get module version\")\t\t\\\n\t__PMC_OP(GETPMCINFO, \"Get per-cpu PMC information\")\t\t\\\n\t__PMC_OP(PMCADMIN, \"Set PMC state\")\t\t\t\t\\\n\t__PMC_OP(PMCALLOCATE, \"Allocate and configure a PMC\")\t\t\\\n\t__PMC_OP(PMCATTACH, \"Attach a PMC to a process\")\t\t\\\n\t__PMC_OP(PMCDETACH, \"Detach a PMC from a process\")\t\t\\\n\t__PMC_OP(PMCGETMSR, \"Get a PMC's hardware address\")\t\t\\\n\t__PMC_OP(PMCRELEASE, \"Release a PMC\")\t\t\t\t\\\n\t__PMC_OP(PMCRW, \"Read/Set a PMC\")\t\t\t\t\\\n\t__PMC_OP(PMCSETCOUNT, \"Set initial count/sampling rate\")\t\\\n\t__PMC_OP(PMCSTART, \"Start a PMC\")\t\t\t\t\\\n\t__PMC_OP(PMCSTOP, \"Stop a PMC\")\t\t\t\t\t\\\n\t__PMC_OP(WRITELOG, \"Write a cookie to the log file\")\n\n\nenum pmc_ops {\n#undef\t__PMC_OP\n#define\t__PMC_OP(N, D)\tPMC_OP_##N,\n\t__PMC_OPS()\n};\n\n\n/*\n * Flags used in operations on PMCs.\n */\n\n#define\tPMC_F_FORCE\t\t0x00000001 /*OP ADMIN force operation */\n#define\tPMC_F_DESCENDANTS\t0x00000002 /*OP ALLOCATE track descendants */\n#define\tPMC_F_LOG_PROCCSW\t0x00000004 /*OP ALLOCATE track ctx switches */\n#define\tPMC_F_LOG_PROCEXIT\t0x00000008 /*OP ALLOCATE log proc exits */\n#define\tPMC_F_NEWVALUE\t\t0x00000010 /*OP RW write new value */\n#define\tPMC_F_OLDVALUE\t\t0x00000020 /*OP RW get old value */\n#define\tPMC_F_KGMON\t\t0x00000040 /*OP ALLOCATE kgmon(8) profiling */\n/* V2 API */\n#define\tPMC_F_CALLCHAIN\t\t0x00000080 /*OP ALLOCATE capture callchains */\n\n/* internal flags */\n#define\tPMC_F_ATTACHED_TO_OWNER\t0x00010000 /*attached to owner*/\n#define\tPMC_F_NEEDS_LOGFILE\t0x00020000 /*needs log file */\n#define\tPMC_F_ATTACH_DONE\t0x00040000 /*attached at least once */\n\n#define\tPMC_CALLCHAIN_DEPTH_MAX\t32\n#define\tPMC_CC_F_USERSPACE\t0x01\t   /*userspace callchain*/\n\n/*\n * Cookies used to denote allocated PMCs, and the values of PMCs.\n */\n\ntypedef uint32_t\tpmc_id_t;\ntypedef uint64_t\tpmc_value_t;\n\n#define\tPMC_ID_INVALID\t\t(~ (pmc_id_t) 0)\n\n/*\n * PMC IDs have the following format:\n *\n * +--------+----------+-----------+-----------+\n * |   CPU  | PMC MODE | PMC CLASS | ROW INDEX |\n * +--------+----------+-----------+-----------+\n *\n * where each field is 8 bits wide.  Field 'CPU' is set to the\n * requested CPU for system-wide PMCs or PMC_CPU_ANY for process-mode\n * PMCs.  Field 'PMC MODE' is the allocated PMC mode.  Field 'PMC\n * CLASS' is the class of the PMC.  Field 'ROW INDEX' is the row index\n * for the PMC.\n *\n * The 'ROW INDEX' ranges over 0..NWPMCS where NHWPMCS is the total\n * number of hardware PMCs on this cpu.\n */\n\n\n#define\tPMC_ID_TO_ROWINDEX(ID)\t((ID) & 0xFF)\n#define\tPMC_ID_TO_CLASS(ID)\t(((ID) & 0xFF00) >> 8)\n#define\tPMC_ID_TO_MODE(ID)\t(((ID) & 0xFF0000) >> 16)\n#define\tPMC_ID_TO_CPU(ID)\t(((ID) & 0xFF000000) >> 24)\n#define\tPMC_ID_MAKE_ID(CPU,MODE,CLASS,ROWINDEX)\t\t\t\\\n\t((((CPU) & 0xFF) << 24) | (((MODE) & 0xFF) << 16) |\t\\\n\t(((CLASS) & 0xFF) << 8) | ((ROWINDEX) & 0xFF))\n\n/*\n * Data structures for system calls supported by the pmc driver.\n */\n\n/*\n * OP PMCALLOCATE\n *\n * Allocate a PMC on the named CPU.\n */\n\n#define\tPMC_CPU_ANY\t~0\n\nstruct pmc_op_pmcallocate {\n\tuint32_t\tpm_caps;\t/* PMC_CAP_* */\n\tuint32_t\tpm_cpu;\t\t/* CPU number or PMC_CPU_ANY */\n\tenum pmc_class\tpm_class;\t/* class of PMC desired */\n\tenum pmc_event\tpm_ev;\t\t/* [enum pmc_event] desired */\n\tuint32_t\tpm_flags;\t/* additional modifiers PMC_F_* */\n\tenum pmc_mode\tpm_mode;\t/* desired mode */\n\tpmc_id_t\tpm_pmcid;\t/* [return] process pmc id */\n\n\tunion pmc_md_op_pmcallocate pm_md; /* MD layer extensions */\n};\n\n/*\n * OP PMCADMIN\n *\n * Set the administrative state (i.e., whether enabled or disabled) of\n * a PMC 'pm_pmc' on CPU 'pm_cpu'.  Note that 'pm_pmc' specifies an\n * absolute PMC number and need not have been first allocated by the\n * calling process.\n */\n\nstruct pmc_op_pmcadmin {\n\tint\t\tpm_cpu;\t\t/* CPU# */\n\tuint32_t\tpm_flags;\t/* flags */\n\tint\t\tpm_pmc;         /* PMC# */\n\tenum pmc_state  pm_state;\t/* desired state */\n};\n\n/*\n * OP PMCATTACH / OP PMCDETACH\n *\n * Attach/detach a PMC and a process.\n */\n\nstruct pmc_op_pmcattach {\n\tpmc_id_t\tpm_pmc;\t\t/* PMC to attach to */\n\tpid_t\t\tpm_pid;\t\t/* target process */\n};\n\n/*\n * OP PMCSETCOUNT\n *\n * Set the sampling rate (i.e., the reload count) for statistical counters.\n * 'pm_pmcid' need to have been previously allocated using PMCALLOCATE.\n */\n\nstruct pmc_op_pmcsetcount {\n\tpmc_value_t\tpm_count;\t/* initial/sample count */\n\tpmc_id_t\tpm_pmcid;\t/* PMC id to set */\n};\n\n\n/*\n * OP PMCRW\n *\n * Read the value of a PMC named by 'pm_pmcid'.  'pm_pmcid' needs\n * to have been previously allocated using PMCALLOCATE.\n */\n\n\nstruct pmc_op_pmcrw {\n\tuint32_t\tpm_flags;\t/* PMC_F_{OLD,NEW}VALUE*/\n\tpmc_id_t\tpm_pmcid;\t/* pmc id */\n\tpmc_value_t\tpm_value;\t/* new&returned value */\n};\n\n\n/*\n * OP GETPMCINFO\n *\n * retrieve PMC state for a named CPU.  The caller is expected to\n * allocate 'npmc' * 'struct pmc_info' bytes of space for the return\n * values.\n */\n\nstruct pmc_info {\n\tchar\t\tpm_name[PMC_NAME_MAX]; /* pmc name */\n\tenum pmc_class\tpm_class;\t/* enum pmc_class */\n\tint\t\tpm_enabled;\t/* whether enabled */\n\tenum pmc_disp\tpm_rowdisp;\t/* FREE, THREAD or STANDLONE */\n\tpid_t\t\tpm_ownerpid;\t/* owner, or -1 */\n\tenum pmc_mode\tpm_mode;\t/* current mode [enum pmc_mode] */\n\tenum pmc_event\tpm_event;\t/* current event */\n\tuint32_t\tpm_flags;\t/* current flags */\n\tpmc_value_t\tpm_reloadcount;\t/* sampling counters only */\n};\n\nstruct pmc_op_getpmcinfo {\n\tint32_t\t\tpm_cpu;\t\t/* 0 <= cpu < mp_maxid */\n\tstruct pmc_info\tpm_pmcs[];\t/* space for 'npmc' structures */\n};\n\n\n/*\n * OP GETCPUINFO\n *\n * Retrieve system CPU information.\n */\n\nstruct pmc_classinfo {\n\tenum pmc_class\tpm_class;\t/* class id */\n\tuint32_t\tpm_caps;\t/* counter capabilities */\n\tuint32_t\tpm_width;\t/* width of the PMC */\n\tuint32_t\tpm_num;\t\t/* number of PMCs in class */\n};\n\nstruct pmc_op_getcpuinfo {\n\tenum pmc_cputype pm_cputype; /* what kind of CPU */\n\tuint32_t\tpm_ncpu;    /* max CPU number */\n\tuint32_t\tpm_npmc;    /* #PMCs per CPU */\n\tuint32_t\tpm_nclass;  /* #classes of PMCs */\n\tstruct pmc_classinfo  pm_classes[PMC_CLASS_MAX];\n};\n\n/*\n * OP CONFIGURELOG\n *\n * Configure a log file for writing system-wide statistics to.\n */\n\nstruct pmc_op_configurelog {\n\tint\t\tpm_flags;\n\tint\t\tpm_logfd;   /* logfile fd (or -1) */\n};\n\n/*\n * OP GETDRIVERSTATS\n *\n * Retrieve pmc(4) driver-wide statistics.\n */\n\nstruct pmc_op_getdriverstats {\n\tint\tpm_intr_ignored;\t/* #interrupts ignored */\n\tint\tpm_intr_processed;\t/* #interrupts processed */\n\tint\tpm_intr_bufferfull;\t/* #interrupts with ENOSPC */\n\tint\tpm_syscalls;\t\t/* #syscalls */\n\tint\tpm_syscall_errors;\t/* #syscalls with errors */\n\tint\tpm_buffer_requests;\t/* #buffer requests */\n\tint\tpm_buffer_requests_failed; /* #failed buffer requests */\n\tint\tpm_log_sweeps;\t\t/* #sample buffer processing passes */\n};\n\n/*\n * OP RELEASE / OP START / OP STOP\n *\n * Simple operations on a PMC id.\n */\n\nstruct pmc_op_simple {\n\tpmc_id_t\tpm_pmcid;\n};\n\n/*\n * OP WRITELOG\n *\n * Flush the current log buffer and write 4 bytes of user data to it.\n */\n\nstruct pmc_op_writelog {\n\tuint32_t\tpm_userdata;\n};\n\n/*\n * OP GETMSR\n *\n * Retrieve the machine specific address assoicated with the allocated\n * PMC.  This number can be used subsequently with a read-performance-counter\n * instruction.\n */\n\nstruct pmc_op_getmsr {\n\tuint32_t\tpm_msr;\t\t/* machine specific address */\n\tpmc_id_t\tpm_pmcid;\t/* allocated pmc id */\n};\n\n#ifdef _KERNEL\n\n#include <sys/malloc.h>\n#include <sys/sysctl.h>\n\n#include <machine/frame.h>\n\n#define\tPMC_HASH_SIZE\t\t\t\t16\n#define\tPMC_MTXPOOL_SIZE\t\t\t32\n#define\tPMC_LOG_BUFFER_SIZE\t\t\t4\n#define\tPMC_NLOGBUFFERS\t\t\t\t16\n#define\tPMC_NSAMPLES\t\t\t\t32\n#define\tPMC_CALLCHAIN_DEPTH\t\t\t8\n\n#define PMC_SYSCTL_NAME_PREFIX \"kern.\" PMC_MODULE_NAME \".\"\n\n/*\n * Locking keys\n *\n * (b) - pmc_bufferlist_mtx (spin lock)\n * (k) - pmc_kthread_mtx (sleep lock)\n * (o) - po->po_mtx (spin lock)\n */\n\n/*\n * PMC commands\n */\n\nstruct pmc_syscall_args {\n\tuint32_t\tpmop_code;\t/* one of PMC_OP_* */\n\tvoid\t\t*pmop_data;\t/* syscall parameter */\n};\n\n/*\n * Interface to processor specific s1tuff\n */\n\n/*\n * struct pmc_descr\n *\n * Machine independent (i.e., the common parts) of a human readable\n * PMC description.\n */\n\nstruct pmc_descr {\n\tchar\t\tpd_name[PMC_NAME_MAX]; /* name */\n\tuint32_t\tpd_caps;\t/* capabilities */\n\tenum pmc_class\tpd_class;\t/* class of the PMC */\n\tuint32_t\tpd_width;\t/* width in bits */\n};\n\n/*\n * struct pmc_target\n *\n * This structure records all the target processes associated with a\n * PMC.\n */\n\nstruct pmc_target {\n\tLIST_ENTRY(pmc_target)\tpt_next;\n\tstruct pmc_process\t*pt_process; /* target descriptor */\n};\n\n/*\n * struct pmc\n *\n * Describes each allocated PMC.\n *\n * Each PMC has precisely one owner, namely the process that allocated\n * the PMC.\n *\n * A PMC may be attached to multiple target processes.  The\n * 'pm_targets' field links all the target processes being monitored\n * by this PMC.\n *\n * The 'pm_savedvalue' field is protected by a mutex.\n *\n * On a multi-cpu machine, multiple target threads associated with a\n * process-virtual PMC could be concurrently executing on different\n * CPUs.  The 'pm_runcount' field is atomically incremented every time\n * the PMC gets scheduled on a CPU and atomically decremented when it\n * get descheduled.  Deletion of a PMC is only permitted when this\n * field is '0'.\n *\n */\n\nstruct pmc {\n\tLIST_HEAD(,pmc_target)\tpm_targets;\t/* list of target processes */\n\tLIST_ENTRY(pmc)\t\tpm_next;\t/* owner's list */\n\n\t/*\n\t * System-wide PMCs are allocated on a CPU and are not moved\n\t * around.  For system-wide PMCs we record the CPU the PMC was\n\t * allocated on in the 'CPU' field of the pmc ID.\n\t *\n\t * Virtual PMCs run on whichever CPU is currently executing\n\t * their targets' threads.  For these PMCs we need to save\n\t * their current PMC counter values when they are taken off\n\t * CPU.\n\t */\n\n\tunion {\n\t\tpmc_value_t\tpm_savedvalue;\t/* Virtual PMCS */\n\t} pm_gv;\n\n\t/*\n\t * For sampling mode PMCs, we keep track of the PMC's \"reload\n\t * count\", which is the counter value to be loaded in when\n\t * arming the PMC for the next counting session.  For counting\n\t * modes on PMCs that are read-only (e.g., the x86 TSC), we\n\t * keep track of the initial value at the start of\n\t * counting-mode operation.\n\t */\n\n\tunion {\n\t\tpmc_value_t\tpm_reloadcount;\t/* sampling PMC modes */\n\t\tpmc_value_t\tpm_initial;\t/* counting PMC modes */\n\t} pm_sc;\n\n\tuint32_t\tpm_stalled;\t/* marks stalled sampling PMCs */\n\tuint32_t\tpm_caps;\t/* PMC capabilities */\n\tenum pmc_event\tpm_event;\t/* event being measured */\n\tuint32_t\tpm_flags;\t/* additional flags PMC_F_... */\n\tstruct pmc_owner *pm_owner;\t/* owner thread state */\n\tint\t\tpm_runcount;\t/* #cpus currently on */\n\tenum pmc_state\tpm_state;\t/* current PMC state */\n\n\t/*\n\t * The PMC ID field encodes the row-index for the PMC, its\n\t * mode, class and the CPU# associated with the PMC.\n\t */\n\n\tpmc_id_t\tpm_id;\t\t/* allocated PMC id */\n\n\t/* md extensions */\n\tunion pmc_md_pmc\tpm_md;\n};\n\n/*\n * Accessor macros for 'struct pmc'\n */\n\n#define\tPMC_TO_MODE(P)\t\tPMC_ID_TO_MODE((P)->pm_id)\n#define\tPMC_TO_CLASS(P)\t\tPMC_ID_TO_CLASS((P)->pm_id)\n#define\tPMC_TO_ROWINDEX(P)\tPMC_ID_TO_ROWINDEX((P)->pm_id)\n#define\tPMC_TO_CPU(P)\t\tPMC_ID_TO_CPU((P)->pm_id)\n\n\n/*\n * struct pmc_process\n *\n * Record a 'target' process being profiled.\n *\n * The target process being profiled could be different from the owner\n * process which allocated the PMCs.  Each target process descriptor\n * is associated with NHWPMC 'struct pmc *' pointers.  Each PMC at a\n * given hardware row-index 'n' will use slot 'n' of the 'pp_pmcs[]'\n * array.  The size of this structure is thus PMC architecture\n * dependent.\n *\n */\n\nstruct pmc_targetstate {\n\tstruct pmc\t*pp_pmc;   /* target PMC */\n\tpmc_value_t\tpp_pmcval; /* per-process value */\n};\n\nstruct pmc_process {\n\tLIST_ENTRY(pmc_process) pp_next;\t/* hash chain */\n\tint\t\tpp_refcnt;\t\t/* reference count */\n\tuint32_t\tpp_flags;\t\t/* flags PMC_PP_* */\n\tstruct proc\t*pp_proc;\t\t/* target thread */\n\tstruct pmc_targetstate pp_pmcs[];       /* NHWPMCs */\n};\n\n#define\tPMC_PP_ENABLE_MSR_ACCESS\t0x00000001\n\n/*\n * struct pmc_owner\n *\n * We associate a PMC with an 'owner' process.\n *\n * A process can be associated with 0..NCPUS*NHWPMC PMCs during its\n * lifetime, where NCPUS is the numbers of CPUS in the system and\n * NHWPMC is the number of hardware PMCs per CPU.  These are\n * maintained in the list headed by the 'po_pmcs' to save on space.\n *\n */\n\nstruct pmc_owner  {\n\tLIST_ENTRY(pmc_owner)\tpo_next;\t/* hash chain */\n\tLIST_ENTRY(pmc_owner)\tpo_ssnext;\t/* list of SS PMC owners */\n\tLIST_HEAD(, pmc)\tpo_pmcs;\t/* owned PMC list */\n\tTAILQ_HEAD(, pmclog_buffer) po_logbuffers; /* (o) logbuffer list */\n\tstruct mtx\t\tpo_mtx;\t\t/* spin lock for (o) */\n\tstruct proc\t\t*po_owner;\t/* owner proc */\n\tuint32_t\t\tpo_flags;\t/* (k) flags PMC_PO_* */\n\tstruct proc\t\t*po_kthread;\t/* (k) helper kthread */\n\tstruct pmclog_buffer\t*po_curbuf;\t/* current log buffer */\n\tstruct file\t\t*po_file;\t/* file reference */\n\tint\t\t\tpo_error;\t/* recorded error */\n\tshort\t\t\tpo_sscount;\t/* # SS PMCs owned */\n\tshort\t\t\tpo_logprocmaps;\t/* global mappings done */\n};\n\n#define\tPMC_PO_OWNS_LOGFILE\t\t0x00000001 /* has a log file */\n#define\tPMC_PO_SHUTDOWN\t\t\t0x00000010 /* in the process of shutdown */\n#define\tPMC_PO_INITIAL_MAPPINGS_DONE\t0x00000020\n\n/*\n * struct pmc_hw -- describe the state of the PMC hardware\n *\n * When in use, a HW PMC is associated with one allocated 'struct pmc'\n * pointed to by field 'phw_pmc'.  When inactive, this field is NULL.\n *\n * On an SMP box, one or more HW PMC's in process virtual mode with\n * the same 'phw_pmc' could be executing on different CPUs.  In order\n * to handle this case correctly, we need to ensure that only\n * incremental counts get added to the saved value in the associated\n * 'struct pmc'.  The 'phw_save' field is used to keep the saved PMC\n * value at the time the hardware is started during this context\n * switch (i.e., the difference between the new (hardware) count and\n * the saved count is atomically added to the count field in 'struct\n * pmc' at context switch time).\n *\n */\n\nstruct pmc_hw {\n\tuint32_t\tphw_state;\t/* see PHW_* macros below */\n\tstruct pmc\t*phw_pmc;\t/* current thread PMC */\n};\n\n#define\tPMC_PHW_RI_MASK\t\t0x000000FF\n#define\tPMC_PHW_CPU_SHIFT\t8\n#define\tPMC_PHW_CPU_MASK\t0x0000FF00\n#define\tPMC_PHW_FLAGS_SHIFT\t16\n#define\tPMC_PHW_FLAGS_MASK\t0xFFFF0000\n\n#define\tPMC_PHW_INDEX_TO_STATE(ri)\t((ri) & PMC_PHW_RI_MASK)\n#define\tPMC_PHW_STATE_TO_INDEX(state)\t((state) & PMC_PHW_RI_MASK)\n#define\tPMC_PHW_CPU_TO_STATE(cpu)\t(((cpu) << PMC_PHW_CPU_SHIFT) & \\\n\tPMC_PHW_CPU_MASK)\n#define\tPMC_PHW_STATE_TO_CPU(state)\t(((state) & PMC_PHW_CPU_MASK) >> \\\n\tPMC_PHW_CPU_SHIFT)\n#define\tPMC_PHW_FLAGS_TO_STATE(flags)\t(((flags) << PMC_PHW_FLAGS_SHIFT) & \\\n\tPMC_PHW_FLAGS_MASK)\n#define\tPMC_PHW_STATE_TO_FLAGS(state)\t(((state) & PMC_PHW_FLAGS_MASK) >> \\\n\tPMC_PHW_FLAGS_SHIFT)\n#define\tPMC_PHW_FLAG_IS_ENABLED\t\t(PMC_PHW_FLAGS_TO_STATE(0x01))\n#define\tPMC_PHW_FLAG_IS_SHAREABLE\t(PMC_PHW_FLAGS_TO_STATE(0x02))\n\n/*\n * struct pmc_sample\n *\n * Space for N (tunable) PC samples and associated control data.\n */\n\nstruct pmc_sample {\n\tuint16_t\t\tps_nsamples;\t/* callchain depth */\n\tuint8_t\t\t\tps_cpu;\t\t/* cpu number */\n\tuint8_t\t\t\tps_flags;\t/* other flags */\n\tpid_t\t\t\tps_pid;\t\t/* process PID or -1 */\n\tstruct thread\t\t*ps_td;\t\t/* which thread */\n\tstruct pmc\t\t*ps_pmc;\t/* interrupting PMC */\n\tuintptr_t\t\t*ps_pc;\t\t/* (const) callchain start */\n};\n\n#define\tPMC_SAMPLE_FREE\t\t((uint16_t) 0)\n#define\tPMC_SAMPLE_INUSE\t((uint16_t) 0xFFFF)\n\nstruct pmc_samplebuffer {\n\tstruct pmc_sample * volatile ps_read;\t/* read pointer */\n\tstruct pmc_sample * volatile ps_write;\t/* write pointer */\n\tuintptr_t\t\t*ps_callchains;\t/* all saved call chains */\n\tstruct pmc_sample\t*ps_fence;\t/* one beyond ps_samples[] */\n\tstruct pmc_sample\tps_samples[];\t/* array of sample entries */\n};\n\n\n/*\n * struct pmc_cpustate\n *\n * A CPU is modelled as a collection of HW PMCs with space for additional\n * flags.\n */\n\nstruct pmc_cpu {\n\tuint32_t\tpc_state;\t/* physical cpu number + flags */\n\tstruct pmc_samplebuffer *pc_sb; /* space for samples */\n\tstruct pmc_hw\t*pc_hwpmcs[];\t/* 'npmc' pointers */\n};\n\n#define\tPMC_PCPU_CPU_MASK\t\t0x000000FF\n#define\tPMC_PCPU_FLAGS_MASK\t\t0xFFFFFF00\n#define\tPMC_PCPU_FLAGS_SHIFT\t\t8\n#define\tPMC_PCPU_STATE_TO_CPU(S)\t((S) & PMC_PCPU_CPU_MASK)\n#define\tPMC_PCPU_STATE_TO_FLAGS(S)\t(((S) & PMC_PCPU_FLAGS_MASK) >> PMC_PCPU_FLAGS_SHIFT)\n#define\tPMC_PCPU_FLAGS_TO_STATE(F)\t(((F) << PMC_PCPU_FLAGS_SHIFT) & PMC_PCPU_FLAGS_MASK)\n#define\tPMC_PCPU_CPU_TO_STATE(C)\t((C) & PMC_PCPU_CPU_MASK)\n#define\tPMC_PCPU_FLAG_HTT\t\t(PMC_PCPU_FLAGS_TO_STATE(0x1))\n\n/*\n * struct pmc_binding\n *\n * CPU binding information.\n */\n\nstruct pmc_binding {\n\tint\tpb_bound;\t/* is bound? */\n\tint\tpb_cpu;\t\t/* if so, to which CPU */\n};\n\n\nstruct pmc_mdep;\n\n/*\n * struct pmc_classdep\n *\n * PMC class-dependent operations.\n */\nstruct pmc_classdep {\n\tuint32_t\tpcd_caps;\t/* class capabilities */\n\tenum pmc_class\tpcd_class;\t/* class id */\n\tint\t\tpcd_num;\t/* number of PMCs */\n\tint\t\tpcd_ri;\t\t/* row index of the first PMC in class */\n\tint\t\tpcd_width;\t/* width of the PMC */\n\n\t/* configuring/reading/writing the hardware PMCs */\n\tint (*pcd_config_pmc)(int _cpu, int _ri, struct pmc *_pm);\n\tint (*pcd_get_config)(int _cpu, int _ri, struct pmc **_ppm);\n\tint (*pcd_read_pmc)(int _cpu, int _ri, pmc_value_t *_value);\n\tint (*pcd_write_pmc)(int _cpu, int _ri, pmc_value_t _value);\n\n\t/* pmc allocation/release */\n\tint (*pcd_allocate_pmc)(int _cpu, int _ri, struct pmc *_t,\n\t\tconst struct pmc_op_pmcallocate *_a);\n\tint (*pcd_release_pmc)(int _cpu, int _ri, struct pmc *_pm);\n\n\t/* starting and stopping PMCs */\n\tint (*pcd_start_pmc)(int _cpu, int _ri);\n\tint (*pcd_stop_pmc)(int _cpu, int _ri);\n\n\t/* description */\n\tint (*pcd_describe)(int _cpu, int _ri, struct pmc_info *_pi,\n\t\tstruct pmc **_ppmc);\n\n\t/* class-dependent initialization & finalization */\n\tint (*pcd_pcpu_init)(struct pmc_mdep *_md, int _cpu);\n\tint (*pcd_pcpu_fini)(struct pmc_mdep *_md, int _cpu);\n\n\t/* machine-specific interface */\n\tint (*pcd_get_msr)(int _ri, uint32_t *_msr);\n};\n\n/*\n * struct pmc_mdep\n *\n * Machine dependent bits needed per CPU type.\n */\n\nstruct pmc_mdep  {\n\tuint32_t\tpmd_cputype;    /* from enum pmc_cputype */\n\tuint32_t\tpmd_npmc;\t/* number of PMCs per CPU */\n\tuint32_t\tpmd_nclass;\t/* number of PMC classes present */\n\n\t/*\n\t * Machine dependent methods.\n\t */\n\n\t/* per-cpu initialization and finalization */\n\tint (*pmd_pcpu_init)(struct pmc_mdep *_md, int _cpu);\n\tint (*pmd_pcpu_fini)(struct pmc_mdep *_md, int _cpu);\n\n\t/* thread context switch in/out */\n\tint (*pmd_switch_in)(struct pmc_cpu *_p, struct pmc_process *_pp);\n\tint (*pmd_switch_out)(struct pmc_cpu *_p, struct pmc_process *_pp);\n\n\t/* handle a PMC interrupt */\n\tint (*pmd_intr)(int _cpu, struct trapframe *_tf);\n\n\t/*\n\t * PMC class dependent information.\n\t */\n\tstruct pmc_classdep pmd_classdep[];\n};\n\n/*\n * Per-CPU state.  This is an array of 'mp_ncpu' pointers\n * to struct pmc_cpu descriptors.\n */\n\nextern struct pmc_cpu **pmc_pcpu;\n\n/* driver statistics */\nextern struct pmc_op_getdriverstats pmc_stats;\n\n#if\tdefined(DEBUG) && DEBUG\n\n/* debug flags, major flag groups */\nstruct pmc_debugflags {\n\tint\tpdb_CPU;\n\tint\tpdb_CSW;\n\tint\tpdb_LOG;\n\tint\tpdb_MDP;\n\tint\tpdb_MOD;\n\tint\tpdb_OWN;\n\tint\tpdb_PMC;\n\tint\tpdb_PRC;\n\tint\tpdb_SAM;\n};\n\nextern struct pmc_debugflags pmc_debugflags;\n\n#define\tPMC_DEBUG_STRSIZE\t\t128\n#define\tPMC_DEBUG_DEFAULT_FLAGS\t\t{ 0, 0, 0, 0, 0, 0, 0, 0 }\n\n#define\tPMCDBG(M,N,L,F,...) do {\t\t\t\t\t\\\n\tif (pmc_debugflags.pdb_ ## M & (1 << PMC_DEBUG_MIN_ ## N))\t\\\n\t\tprintf(#M \":\" #N \":\" #L  \": \" F \"\\n\", __VA_ARGS__);\t\\\n} while (0)\n\n/* Major numbers */\n#define\tPMC_DEBUG_MAJ_CPU\t\t0 /* cpu switches */\n#define\tPMC_DEBUG_MAJ_CSW\t\t1 /* context switches */\n#define\tPMC_DEBUG_MAJ_LOG\t\t2 /* logging */\n#define\tPMC_DEBUG_MAJ_MDP\t\t3 /* machine dependent */\n#define\tPMC_DEBUG_MAJ_MOD\t\t4 /* misc module infrastructure */\n#define\tPMC_DEBUG_MAJ_OWN\t\t5 /* owner */\n#define\tPMC_DEBUG_MAJ_PMC\t\t6 /* pmc management */\n#define\tPMC_DEBUG_MAJ_PRC\t\t7 /* processes */\n#define\tPMC_DEBUG_MAJ_SAM\t\t8 /* sampling */\n\n/* Minor numbers */\n\n/* Common (8 bits) */\n#define\tPMC_DEBUG_MIN_ALL\t\t0 /* allocation */\n#define\tPMC_DEBUG_MIN_REL\t\t1 /* release */\n#define\tPMC_DEBUG_MIN_OPS\t\t2 /* ops: start, stop, ... */\n#define\tPMC_DEBUG_MIN_INI\t\t3 /* init */\n#define\tPMC_DEBUG_MIN_FND\t\t4 /* find */\n\n/* MODULE */\n#define\tPMC_DEBUG_MIN_PMH\t       14 /* pmc_hook */\n#define\tPMC_DEBUG_MIN_PMS\t       15 /* pmc_syscall */\n\n/* OWN */\n#define\tPMC_DEBUG_MIN_ORM\t\t8 /* owner remove */\n#define\tPMC_DEBUG_MIN_OMR\t\t9 /* owner maybe remove */\n\n/* PROCESSES */\n#define\tPMC_DEBUG_MIN_TLK\t\t8 /* link target */\n#define\tPMC_DEBUG_MIN_TUL\t\t9 /* unlink target */\n#define\tPMC_DEBUG_MIN_EXT\t       10 /* process exit */\n#define\tPMC_DEBUG_MIN_EXC\t       11 /* process exec */\n#define\tPMC_DEBUG_MIN_FRK\t       12 /* process fork */\n#define\tPMC_DEBUG_MIN_ATT\t       13 /* attach/detach */\n#define\tPMC_DEBUG_MIN_SIG\t       14 /* signalling */\n\n/* CONTEXT SWITCHES */\n#define\tPMC_DEBUG_MIN_SWI\t\t8 /* switch in */\n#define\tPMC_DEBUG_MIN_SWO\t\t9 /* switch out */\n\n/* PMC */\n#define\tPMC_DEBUG_MIN_REG\t\t8 /* pmc register */\n#define\tPMC_DEBUG_MIN_ALR\t\t9 /* allocate row */\n\n/* MACHINE DEPENDENT LAYER */\n#define\tPMC_DEBUG_MIN_REA\t\t8 /* read */\n#define\tPMC_DEBUG_MIN_WRI\t\t9 /* write */\n#define\tPMC_DEBUG_MIN_CFG\t       10 /* config */\n#define\tPMC_DEBUG_MIN_STA\t       11 /* start */\n#define\tPMC_DEBUG_MIN_STO\t       12 /* stop */\n#define\tPMC_DEBUG_MIN_INT\t       13 /* interrupts */\n\n/* CPU */\n#define\tPMC_DEBUG_MIN_BND\t\t8 /* bind */\n#define\tPMC_DEBUG_MIN_SEL\t\t9 /* select */\n\n/* LOG */\n#define\tPMC_DEBUG_MIN_GTB\t\t8 /* get buf */\n#define\tPMC_DEBUG_MIN_SIO\t\t9 /* schedule i/o */\n#define\tPMC_DEBUG_MIN_FLS\t       10 /* flush */\n#define\tPMC_DEBUG_MIN_SAM\t       11 /* sample */\n\n#else\n#define\tPMCDBG(M,N,L,F,...)\t\t/* nothing */\n#endif\n\n/* declare a dedicated memory pool */\nMALLOC_DECLARE(M_PMC);\n\n/*\n * Functions\n */\n\nstruct pmc_mdep *pmc_md_initialize(void);\t/* MD init function */\nvoid\tpmc_md_finalize(struct pmc_mdep *_md);\t/* MD fini function */\nint\tpmc_getrowdisp(int _ri);\nint\tpmc_process_interrupt(int _cpu, struct pmc *_pm,\n    struct trapframe *_tf, int _inuserspace);\nint\tpmc_save_kernel_callchain(uintptr_t *_cc, int _maxsamples,\n    struct trapframe *_tf);\nint\tpmc_save_user_callchain(uintptr_t *_cc, int _maxsamples,\n    struct trapframe *_tf);\n#endif /* _KERNEL */\n#endif /* _SYS_PMC_H_ */\n"
  },
  {
    "path": "freebsd-headers/sys/pmckern.h",
    "content": "/*-\n * Copyright (c) 2003-2007, Joseph Koshy\n * Copyright (c) 2007 The FreeBSD Foundation\n * All rights reserved.\n *\n * Portions of this software were developed by A. Joseph Koshy under\n * sponsorship from the FreeBSD Foundation and Google, Inc.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/sys/pmckern.h 222813 2011-06-07 08:46:13Z attilio $\n */\n\n/*\n * PMC interface used by the base kernel.\n */\n\n#ifndef _SYS_PMCKERN_H_\n#define _SYS_PMCKERN_H_\n\n#include <sys/param.h>\n#include <sys/kernel.h>\n#include <sys/lock.h>\n#include <sys/proc.h>\n#include <sys/sx.h>\n\n#define\tPMC_FN_PROCESS_EXEC\t\t1\n#define\tPMC_FN_CSW_IN\t\t\t2\n#define\tPMC_FN_CSW_OUT\t\t\t3\n#define\tPMC_FN_DO_SAMPLES\t\t4\n#define\tPMC_FN_KLD_LOAD\t\t\t5\n#define\tPMC_FN_KLD_UNLOAD\t\t6\n#define\tPMC_FN_MMAP\t\t\t7\n#define\tPMC_FN_MUNMAP\t\t\t8\n#define\tPMC_FN_USER_CALLCHAIN\t\t9\n\nstruct pmckern_procexec {\n\tint\t\tpm_credentialschanged;\n\tuintfptr_t\tpm_entryaddr;\n};\n\nstruct pmckern_map_in {\n\tvoid\t\t*pm_file;\t/* filename or vnode pointer */\n\tuintfptr_t\tpm_address;\t/* address object is loaded at */\n};\n\nstruct pmckern_map_out {\n\tuintfptr_t\tpm_address;\t/* start address of region */\n\tsize_t\t\tpm_size;\t/* size of unmapped region */\n};\n\n/* hook */\nextern int (*pmc_hook)(struct thread *_td, int _function, void *_arg);\nextern int (*pmc_intr)(int _cpu, struct trapframe *_frame);\n\n/* SX lock protecting the hook */\nextern struct sx pmc_sx;\n\n/* Per-cpu flags indicating availability of sampling data */\nextern volatile cpuset_t pmc_cpumask;\n\n/* Count of system-wide sampling PMCs in existence */\nextern volatile int pmc_ss_count;\n\n/* kernel version number */\nextern const int pmc_kernel_version;\n\n/* Hook invocation; for use within the kernel */\n#define\tPMC_CALL_HOOK(t, cmd, arg)\t\t\\\ndo {\t\t\t\t\t\t\\\n\tsx_slock(&pmc_sx);\t\t\t\\\n\tif (pmc_hook != NULL)\t\t\t\\\n\t\t(pmc_hook)((t), (cmd), (arg));\t\\\n\tsx_sunlock(&pmc_sx);\t\t\t\\\n} while (0)\n\n/* Hook invocation that needs an exclusive lock */\n#define\tPMC_CALL_HOOK_X(t, cmd, arg)\t\t\\\ndo {\t\t\t\t\t\t\\\n\tsx_xlock(&pmc_sx);\t\t\t\\\n\tif (pmc_hook != NULL)\t\t\t\\\n\t\t(pmc_hook)((t), (cmd), (arg));\t\\\n\tsx_xunlock(&pmc_sx);\t\t\t\\\n} while (0)\n\n/*\n * Some hook invocations (e.g., from context switch and clock handling\n * code) need to be lock-free.\n */\n#define\tPMC_CALL_HOOK_UNLOCKED(t, cmd, arg)\t\\\ndo {\t\t\t\t\t\t\\\n\tif (pmc_hook != NULL)\t\t\t\\\n\t\t(pmc_hook)((t), (cmd), (arg));\t\\\n} while (0)\n\n#define\tPMC_SWITCH_CONTEXT(t,cmd)\tPMC_CALL_HOOK_UNLOCKED(t,cmd,NULL)\n\n/* Check if a process is using HWPMCs.*/\n#define PMC_PROC_IS_USING_PMCS(p)\t\t\t\t\\\n\t(__predict_false(atomic_load_acq_int(&(p)->p_flag) &\t\\\n\t    P_HWPMC))\n\n#define\tPMC_SYSTEM_SAMPLING_ACTIVE()\t\t(pmc_ss_count > 0)\n\n/* Check if a CPU has recorded samples. */\n#define\tPMC_CPU_HAS_SAMPLES(C)\t(__predict_false(CPU_ISSET(C, &pmc_cpumask)))\n\n/*\n * Helper functions.\n */\nint\t\tpmc_cpu_is_disabled(int _cpu);  /* deprecated */\nint\t\tpmc_cpu_is_active(int _cpu);\nint\t\tpmc_cpu_is_present(int _cpu);\nint\t\tpmc_cpu_is_primary(int _cpu);\nunsigned int\tpmc_cpu_max(void);\n\n#ifdef\tINVARIANTS\nint\t\tpmc_cpu_max_active(void);\n#endif\n\n#endif /* _SYS_PMCKERN_H_ */\n"
  },
  {
    "path": "freebsd-headers/sys/pmclog.h",
    "content": "/*-\n * Copyright (c) 2005-2007, Joseph Koshy\n * Copyright (c) 2007 The FreeBSD Foundation\n * All rights reserved.\n *\n * Portions of this software were developed by A. Joseph Koshy under\n * sponsorship from the FreeBSD Foundation and Google, Inc.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/sys/pmclog.h 185363 2008-11-27 09:00:47Z jkoshy $\n */\n\n#ifndef\t_SYS_PMCLOG_H_\n#define\t_SYS_PMCLOG_H_\n\n#include <sys/pmc.h>\n\nenum pmclog_type {\n\t/* V1 ABI */\n\tPMCLOG_TYPE_CLOSELOG,\n\tPMCLOG_TYPE_DROPNOTIFY,\n\tPMCLOG_TYPE_INITIALIZE,\n\tPMCLOG_TYPE_MAPPINGCHANGE, /* unused in v1 */\n\tPMCLOG_TYPE_PCSAMPLE,\n\tPMCLOG_TYPE_PMCALLOCATE,\n\tPMCLOG_TYPE_PMCATTACH,\n\tPMCLOG_TYPE_PMCDETACH,\n\tPMCLOG_TYPE_PROCCSW,\n\tPMCLOG_TYPE_PROCEXEC,\n\tPMCLOG_TYPE_PROCEXIT,\n\tPMCLOG_TYPE_PROCFORK,\n\tPMCLOG_TYPE_SYSEXIT,\n\tPMCLOG_TYPE_USERDATA,\n\t/*\n\t * V2 ABI\n\t *\n\t * The MAP_{IN,OUT} event types obsolete the MAPPING_CHANGE\n\t * event type.  The CALLCHAIN event type obsoletes the\n\t * PCSAMPLE event type.\n\t */\n\tPMCLOG_TYPE_MAP_IN,\n\tPMCLOG_TYPE_MAP_OUT,\n\tPMCLOG_TYPE_CALLCHAIN\n};\n\n/*\n * A log entry descriptor comprises of a 32 bit header and a 64 bit\n * time stamp followed by as many 32 bit words are required to record\n * the event.\n *\n * Header field format:\n *\n *  31           24           16                                   0\n *   +------------+------------+-----------------------------------+\n *   |    MAGIC   |    TYPE    |               LENGTH              |\n *   +------------+------------+-----------------------------------+\n *\n * MAGIC \tis the constant PMCLOG_HEADER_MAGIC.\n * TYPE  \tcontains a value of type enum pmclog_type.\n * LENGTH\tcontains the length of the event record, in bytes.\n */\n\n#define\tPMCLOG_ENTRY_HEADER\t\t\t\t\\\n\tuint32_t\t\tpl_header;\t\t\\\n\tuint32_t\t\tpl_ts_sec;\t\t\\\n\tuint32_t\t\tpl_ts_nsec;\n\n\n/*\n * The following structures are used to describe the size of each kind\n * of log entry to sizeof().  To keep the compiler from adding\n * padding, the fields of each structure are aligned to their natural\n * boundaries, and the structures are marked as 'packed'.\n *\n * The actual reading and writing of the log file is always in terms\n * of 4 byte quantities.\n */\n\nstruct pmclog_callchain {\n\tPMCLOG_ENTRY_HEADER\n\tuint32_t\t\tpl_pid;\n\tuint32_t\t\tpl_pmcid;\n\tuint32_t\t\tpl_cpuflags;\n\t/* 8 byte aligned */\n\tuintptr_t\t\tpl_pc[PMC_CALLCHAIN_DEPTH_MAX];\n} __packed;\n\n#define\tPMC_CALLCHAIN_CPUFLAGS_TO_CPU(CF)\t(((CF) >> 16) & 0xFFFF)\n#define\tPMC_CALLCHAIN_CPUFLAGS_TO_USERMODE(CF)\t((CF) & PMC_CC_F_USERSPACE)\n#define\tPMC_CALLCHAIN_TO_CPUFLAGS(CPU,FLAGS)\t\\\n\t(((CPU) << 16) | ((FLAGS) & 0xFFFF))\n\nstruct pmclog_closelog {\n\tPMCLOG_ENTRY_HEADER\n};\n\nstruct pmclog_dropnotify {\n\tPMCLOG_ENTRY_HEADER\n};\n\nstruct pmclog_initialize {\n\tPMCLOG_ENTRY_HEADER\n\tuint32_t\t\tpl_version;\t/* driver version */\n\tuint32_t\t\tpl_cpu;\t\t/* enum pmc_cputype */\n} __packed;\n\nstruct pmclog_map_in {\n\tPMCLOG_ENTRY_HEADER\n\tuint32_t\t\tpl_pid;\n\tuintfptr_t\t\tpl_start;\t/* 8 byte aligned */\n\tchar\t\t\tpl_pathname[PATH_MAX];\n} __packed;\n\nstruct pmclog_map_out {\n\tPMCLOG_ENTRY_HEADER\n\tuint32_t\t\tpl_pid;\n\tuintfptr_t\t\tpl_start;\t/* 8 byte aligned */\n\tuintfptr_t\t\tpl_end;\n} __packed;\n\nstruct pmclog_pcsample {\n\tPMCLOG_ENTRY_HEADER\n\tuint32_t\t\tpl_pid;\n\tuintfptr_t\t\tpl_pc;\t\t/* 8 byte aligned */\n\tuint32_t\t\tpl_pmcid;\n\tuint32_t\t\tpl_usermode;\n} __packed;\n\nstruct pmclog_pmcallocate {\n\tPMCLOG_ENTRY_HEADER\n\tuint32_t\t\tpl_pmcid;\n\tuint32_t\t\tpl_event;\n\tuint32_t\t\tpl_flags;\n} __packed;\n\nstruct pmclog_pmcattach {\n\tPMCLOG_ENTRY_HEADER\n\tuint32_t\t\tpl_pmcid;\n\tuint32_t\t\tpl_pid;\n\tchar\t\t\tpl_pathname[PATH_MAX];\n} __packed;\n\nstruct pmclog_pmcdetach {\n\tPMCLOG_ENTRY_HEADER\n\tuint32_t\t\tpl_pmcid;\n\tuint32_t\t\tpl_pid;\n} __packed;\n\nstruct pmclog_proccsw {\n\tPMCLOG_ENTRY_HEADER\n\tuint32_t\t\tpl_pmcid;\n\tuint64_t\t\tpl_value;\t/* keep 8 byte aligned */\n\tuint32_t\t\tpl_pid;\n} __packed;\n\nstruct pmclog_procexec {\n\tPMCLOG_ENTRY_HEADER\n\tuint32_t\t\tpl_pid;\n\tuintfptr_t\t\tpl_start;\t/* keep 8 byte aligned */\n\tuint32_t\t\tpl_pmcid;\n\tchar\t\t\tpl_pathname[PATH_MAX];\n} __packed;\n\nstruct pmclog_procexit {\n\tPMCLOG_ENTRY_HEADER\n\tuint32_t\t\tpl_pmcid;\n\tuint64_t\t\tpl_value;\t/* keep 8 byte aligned */\n\tuint32_t\t\tpl_pid;\n} __packed;\n\nstruct pmclog_procfork {\n\tPMCLOG_ENTRY_HEADER\n\tuint32_t\t\tpl_oldpid;\n\tuint32_t\t\tpl_newpid;\n} __packed;\n\nstruct pmclog_sysexit {\n\tPMCLOG_ENTRY_HEADER\n\tuint32_t\t\tpl_pid;\n} __packed;\n\nstruct pmclog_userdata {\n\tPMCLOG_ENTRY_HEADER\n\tuint32_t\t\tpl_userdata;\n} __packed;\n\nunion pmclog_entry {\t\t/* only used to size scratch areas */\n\tstruct pmclog_callchain\t\tpl_cc;\n\tstruct pmclog_closelog\t\tpl_cl;\n\tstruct pmclog_dropnotify\tpl_dn;\n\tstruct pmclog_initialize\tpl_i;\n\tstruct pmclog_map_in\t\tpl_mi;\n\tstruct pmclog_map_out\t\tpl_mo;\n\tstruct pmclog_pcsample\t\tpl_s;\n\tstruct pmclog_pmcallocate\tpl_a;\n\tstruct pmclog_pmcattach\t\tpl_t;\n\tstruct pmclog_pmcdetach\t\tpl_d;\n\tstruct pmclog_proccsw\t\tpl_c;\n\tstruct pmclog_procexec\t\tpl_x;\n\tstruct pmclog_procexit\t\tpl_e;\n\tstruct pmclog_procfork\t\tpl_f;\n\tstruct pmclog_sysexit\t\tpl_se;\n\tstruct pmclog_userdata\t\tpl_u;\n};\n\n#define\tPMCLOG_HEADER_MAGIC\t\t\t\t\t0xEEU\n\n#define\tPMCLOG_HEADER_TO_LENGTH(H)\t\t\t\t\\\n\t((H) & 0x0000FFFF)\n#define\tPMCLOG_HEADER_TO_TYPE(H)\t\t\t\t\\\n\t(((H) & 0x00FF0000) >> 16)\n#define\tPMCLOG_HEADER_TO_MAGIC(H)\t\t\t\t\\\n\t(((H) & 0xFF000000) >> 24)\n#define\tPMCLOG_HEADER_CHECK_MAGIC(H)\t\t\t\t\\\n\t(PMCLOG_HEADER_TO_MAGIC(H) == PMCLOG_HEADER_MAGIC)\n\n#ifdef\t_KERNEL\n\n/*\n * Prototypes\n */\nint\tpmclog_configure_log(struct pmc_mdep *_md, struct pmc_owner *_po,\n    int _logfd);\nint\tpmclog_deconfigure_log(struct pmc_owner *_po);\nint\tpmclog_flush(struct pmc_owner *_po);\nvoid\tpmclog_initialize(void);\nvoid\tpmclog_process_callchain(struct pmc *_pm, struct pmc_sample *_ps);\nvoid\tpmclog_process_closelog(struct pmc_owner *po);\nvoid\tpmclog_process_dropnotify(struct pmc_owner *po);\nvoid\tpmclog_process_map_in(struct pmc_owner *po, pid_t pid,\n    uintfptr_t start, const char *path);\nvoid\tpmclog_process_map_out(struct pmc_owner *po, pid_t pid,\n    uintfptr_t start, uintfptr_t end);\nvoid\tpmclog_process_pmcallocate(struct pmc *_pm);\nvoid\tpmclog_process_pmcattach(struct pmc *_pm, pid_t _pid, char *_path);\nvoid\tpmclog_process_pmcdetach(struct pmc *_pm, pid_t _pid);\nvoid\tpmclog_process_proccsw(struct pmc *_pm, struct pmc_process *_pp,\n    pmc_value_t _v);\nvoid\tpmclog_process_procexec(struct pmc_owner *_po, pmc_id_t _pmid, pid_t _pid,\n    uintfptr_t _startaddr, char *_path);\nvoid\tpmclog_process_procexit(struct pmc *_pm, struct pmc_process *_pp);\nvoid\tpmclog_process_procfork(struct pmc_owner *_po, pid_t _oldpid, pid_t _newpid);\nvoid\tpmclog_process_sysexit(struct pmc_owner *_po, pid_t _pid);\nint\tpmclog_process_userlog(struct pmc_owner *_po,\n    struct pmc_op_writelog *_wl);\nvoid\tpmclog_shutdown(void);\n#endif\t/* _KERNEL */\n\n#endif\t/* _SYS_PMCLOG_H_ */\n"
  },
  {
    "path": "freebsd-headers/sys/poll.h",
    "content": "/*-\n * Copyright (c) 1997 Peter Wemm <peter@freebsd.org>\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. The name of the author may not be used to endorse or promote products\n *    derived from this software without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/sys/poll.h 99710 2002-07-10 04:47:25Z mike $\n */\n\n#ifndef _SYS_POLL_H_\n#define\t_SYS_POLL_H_\n\n#include <sys/cdefs.h>\n\n/*\n * This file is intended to be compatible with the traditional poll.h.\n */\n\ntypedef\tunsigned int\tnfds_t;\n\n/*\n * This structure is passed as an array to poll(2).\n */\nstruct pollfd {\n\tint\tfd;\t\t/* which file descriptor to poll */\n\tshort\tevents;\t\t/* events we are interested in */\n\tshort\trevents;\t/* events found on return */\n};\n\n/*\n * Requestable events.  If poll(2) finds any of these set, they are\n * copied to revents on return.\n * XXX Note that FreeBSD doesn't make much distinction between POLLPRI\n * and POLLRDBAND since none of the file types have distinct priority\n * bands - and only some have an urgent \"mode\".\n * XXX Note POLLIN isn't really supported in true SVSV terms.  Under SYSV\n * POLLIN includes all of normal, band and urgent data.  Most poll handlers\n * on FreeBSD only treat it as \"normal\" data.\n */\n#define\tPOLLIN\t\t0x0001\t\t/* any readable data available */\n#define\tPOLLPRI\t\t0x0002\t\t/* OOB/Urgent readable data */\n#define\tPOLLOUT\t\t0x0004\t\t/* file descriptor is writeable */\n#define\tPOLLRDNORM\t0x0040\t\t/* non-OOB/URG data available */\n#define\tPOLLWRNORM\tPOLLOUT\t\t/* no write type differentiation */\n#define\tPOLLRDBAND\t0x0080\t\t/* OOB/Urgent readable data */\n#define\tPOLLWRBAND\t0x0100\t\t/* OOB/Urgent data can be written */\n\n#if __BSD_VISIBLE\n/* General FreeBSD extension (currently only supported for sockets): */\n#define\tPOLLINIGNEOF\t0x2000\t\t/* like POLLIN, except ignore EOF */\n#endif\n\n/*\n * These events are set if they occur regardless of whether they were\n * requested.\n */\n#define\tPOLLERR\t\t0x0008\t\t/* some poll error occurred */\n#define\tPOLLHUP\t\t0x0010\t\t/* file descriptor was \"hung up\" */\n#define\tPOLLNVAL\t0x0020\t\t/* requested events \"invalid\" */\n\n#if __BSD_VISIBLE\n\n#define\tPOLLSTANDARD\t(POLLIN|POLLPRI|POLLOUT|POLLRDNORM|POLLRDBAND|\\\n\t\t\t POLLWRBAND|POLLERR|POLLHUP|POLLNVAL)\n\n/*\n * Request that poll() wait forever.\n * XXX in SYSV, this is defined in stropts.h, which is not included\n * by poll.h.\n */\n#define\tINFTIM\t\t(-1)\n\n#endif\n\n#ifndef _KERNEL\n\n__BEGIN_DECLS\nint\tpoll(struct pollfd _pfd[], nfds_t _nfds, int _timeout);\n__END_DECLS\n\n#endif /* !_KERNEL */\n\n#endif /* !_SYS_POLL_H_ */\n"
  },
  {
    "path": "freebsd-headers/sys/posix4.h",
    "content": "#ifndef _P1003_1B_P1003_1B_H_\n#define _P1003_1B_P1003_1B_H_\n/*-\n * Copyright (c) 1996, 1997, 1998\n *\tHD Associates, Inc.  All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. All advertising materials mentioning features or use of this software\n *    must display the following acknowledgement:\n *\tThis product includes software developed by HD Associates, Inc\n * 4. Neither the name of the author nor the names of any co-contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY HD ASSOCIATES AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL HD ASSOCIATES OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/sys/posix4.h 225617 2011-09-16 13:58:51Z kmacy $\n */\n\n#include <sys/param.h>\n#include <sys/ioccom.h>\n#include <sys/malloc.h>\n#include <sys/sched.h>\n\n/* Generate syscall stubs for when something is optionally\n * loadable as a module.  References \"syscall_not_present\". \n * XXX Good candidate for sys/syscall.h\n */\nstruct proc;\nstruct nosys_args;\nextern int syscall_not_present(struct thread *, const char *, struct nosys_args *);\n\n#define SYSCALL_NOT_PRESENT_GEN(SC) \\\nint sys_ ## SC (struct thread *td, struct SC##_args *uap) \\\n{ \\\n\treturn syscall_not_present(td, #SC , (struct nosys_args *)uap); \\\n}\n\n\nMALLOC_DECLARE(M_P31B);\n\n#define p31b_malloc(SIZE) malloc((SIZE), M_P31B, M_WAITOK)\n#define p31b_free(P) free((P), M_P31B)\n\nint p31b_proc(struct proc *, pid_t, struct proc **);\n\nvoid p31b_setcfg(int, int);\nint p31b_getcfg(int);\nint p31b_iscfg(int);\nvoid p31b_unsetcfg(int);\n\n#ifdef _KPOSIX_PRIORITY_SCHEDULING\n\n/* \n * KSCHED_OP_RW is a vector of read/write flags for each entry indexed\n * by the enum ksched_op.\n *\n * 1 means you need write access, 0 means read is sufficient.\n */\n\nenum ksched_op {\n\n#define KSCHED_OP_RW { 1, 0, 1, 0, 0, 0, 0, 0 }\n\n\tSCHED_SETPARAM,\n\tSCHED_GETPARAM,\n\tSCHED_SETSCHEDULER,\n\tSCHED_GETSCHEDULER,\n\tSCHED_YIELD,\n\tSCHED_GET_PRIORITY_MAX,\n\tSCHED_GET_PRIORITY_MIN,\n\tSCHED_RR_GET_INTERVAL,\n\tSCHED_OP_MAX\n};\n\nstruct ksched;\n\nint ksched_attach(struct ksched **);\nint ksched_detach(struct ksched *);\n\nint ksched_setparam(struct ksched *,\n\tstruct thread *, const struct sched_param *);\nint ksched_getparam(struct ksched *,\n\tstruct thread *, struct sched_param *);\n\nint ksched_setscheduler(struct ksched *,\n\tstruct thread *, int, const struct sched_param *);\nint ksched_getscheduler(struct ksched *, struct thread *, int *);\n\nint ksched_yield(struct ksched *);\n\nint ksched_get_priority_max(struct ksched *, int, int *);\nint ksched_get_priority_min(struct ksched *, int, int *);\n\nint ksched_rr_get_interval(struct ksched *,\n\tstruct thread *, struct timespec *);\n\n#endif /* _KPOSIX_PRIORITY_SCHEDULING */\n\n#endif /* _P1003_1B_P1003_1B_H_ */\n"
  },
  {
    "path": "freebsd-headers/sys/power.h",
    "content": "/*-\n * Copyright (c) 2001 Mitsuru IWASAKI\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t$FreeBSD: release/9.0.0/sys/sys/power.h 100084 2002-07-15 14:06:03Z markm $\n */\n\n#ifndef _SYS_POWER_H_\n#define _SYS_POWER_H_\n\n#include <sys/eventhandler.h>\n\n/* Power management system type */\n#define POWER_PM_TYPE_APM\t\t0x00\n#define POWER_PM_TYPE_ACPI\t\t0x01\n#define POWER_PM_TYPE_NONE\t\t0xff\n\n/* Commands for Power management function */\n#define POWER_CMD_SUSPEND\t\t0x00\n\n/* Sleep state */\n#define POWER_SLEEP_STATE_STANDBY\t0x00\n#define POWER_SLEEP_STATE_SUSPEND\t0x01\n#define POWER_SLEEP_STATE_HIBERNATE\t0x02\n\ntypedef int (*power_pm_fn_t)(u_long, void*, ...);\nextern int\t power_pm_register(u_int, power_pm_fn_t, void *);\nextern u_int\t power_pm_get_type(void);\nextern void\t power_pm_suspend(int);\n\n/*\n * System power API.\n */\n#define POWER_PROFILE_PERFORMANCE        0\n#define POWER_PROFILE_ECONOMY            1\n\nextern int\tpower_profile_get_state(void);\nextern void\tpower_profile_set_state(int);\n\ntypedef void (*power_profile_change_hook)(void *, int);\nEVENTHANDLER_DECLARE(power_profile_change, power_profile_change_hook);\n\n#endif\t/* !_SYS_POWER_H_ */\n\n"
  },
  {
    "path": "freebsd-headers/sys/priority.h",
    "content": "/*-\n * Copyright (c) 1994, Henrik Vestergaard Draboel\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. All advertising materials mentioning features or use of this software\n *    must display the following acknowledgement:\n *\tThis product includes software developed by Henrik Vestergaard Draboel.\n * 4. The name of the author may not be used to endorse or promote products\n *    derived from this software without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/sys/priority.h 221829 2011-05-13 05:27:58Z mdf $\n */\n\n#ifndef _SYS_PRIORITY_H_\n#define _SYS_PRIORITY_H_\n\n/*\n * Process priority specifications.\n */\n\n/*\n * Priority classes.\n */\n\n#define\tPRI_ITHD\t\t1\t/* Interrupt thread. */\n#define\tPRI_REALTIME\t\t2\t/* Real time process. */\n#define\tPRI_TIMESHARE\t\t3\t/* Time sharing process. */\n#define\tPRI_IDLE\t\t4\t/* Idle process. */\n\n/*\n * PRI_FIFO is POSIX.1B SCHED_FIFO.\n */\n\n#define\tPRI_FIFO_BIT\t\t8\n#define\tPRI_FIFO\t\t(PRI_FIFO_BIT | PRI_REALTIME)\n\n#define\tPRI_BASE(P)\t\t((P) & ~PRI_FIFO_BIT)\n#define\tPRI_IS_REALTIME(P)\t(PRI_BASE(P) == PRI_REALTIME)\n#define\tPRI_NEED_RR(P)\t\t((P) != PRI_FIFO)\n\n/*\n * Priorities.  Note that with 64 run queues, differences less than 4 are\n * insignificant.\n */\n\n/*\n * Priorities range from 0 to 255, but differences of less then 4 (RQ_PPQ)\n * are insignificant.  Ranges are as follows:\n *\n * Interrupt threads:\t\t0 - 47\n * Realtime user threads:\t48 - 79\n * Top half kernel threads:\t80 - 119\n * Time sharing user threads:\t120 - 223\n * Idle user threads:\t\t224 - 255\n *\n * XXX If/When the specific interrupt thread and top half thread ranges\n * disappear, a larger range can be used for user processes.\n */\n\n#define\tPRI_MIN\t\t\t(0)\t\t/* Highest priority. */\n#define\tPRI_MAX\t\t\t(255)\t\t/* Lowest priority. */\n\n#define\tPRI_MIN_ITHD\t\t(PRI_MIN)\n#define\tPRI_MAX_ITHD\t\t(PRI_MIN_REALTIME - 1)\n\n#define\tPI_REALTIME\t\t(PRI_MIN_ITHD + 0)\n#define\tPI_AV\t\t\t(PRI_MIN_ITHD + 4)\n#define\tPI_NET\t\t\t(PRI_MIN_ITHD + 8)\n#define\tPI_DISK\t\t\t(PRI_MIN_ITHD + 12)\n#define\tPI_TTY\t\t\t(PRI_MIN_ITHD + 16)\n#define\tPI_DULL\t\t\t(PRI_MIN_ITHD + 20)\n#define\tPI_SOFT\t\t\t(PRI_MIN_ITHD + 24)\n#define\tPI_SWI(x)\t\t(PI_SOFT + (x) * RQ_PPQ)\n\n#define\tPRI_MIN_REALTIME\t(48)\n#define\tPRI_MAX_REALTIME\t(PRI_MIN_KERN - 1)\n\n#define\tPRI_MIN_KERN\t\t(80)\n#define\tPRI_MAX_KERN\t\t(PRI_MIN_TIMESHARE - 1)\n\n#define\tPSWP\t\t\t(PRI_MIN_KERN + 0)\n#define\tPVM\t\t\t(PRI_MIN_KERN + 4)\n#define\tPINOD\t\t\t(PRI_MIN_KERN + 8)\n#define\tPRIBIO\t\t\t(PRI_MIN_KERN + 12)\n#define\tPVFS\t\t\t(PRI_MIN_KERN + 16)\n#define\tPZERO\t\t\t(PRI_MIN_KERN + 20)\n#define\tPSOCK\t\t\t(PRI_MIN_KERN + 24)\n#define\tPWAIT\t\t\t(PRI_MIN_KERN + 28)\n#define\tPLOCK\t\t\t(PRI_MIN_KERN + 32)\n#define\tPPAUSE\t\t\t(PRI_MIN_KERN + 36)\n\n#define\tPRI_MIN_TIMESHARE\t(120)\n#define\tPRI_MAX_TIMESHARE\t(PRI_MIN_IDLE - 1)\n\n#define\tPUSER\t\t\t(PRI_MIN_TIMESHARE)\n\n#define\tPRI_MIN_IDLE\t\t(224)\n#define\tPRI_MAX_IDLE\t\t(PRI_MAX)\n\n#ifdef _KERNEL\n/* Other arguments for kern_yield(9). */\n#define\tPRI_USER\t-2\t/* Change to current user priority. */\n#define\tPRI_UNCHANGED\t-1\t/* Do not change priority. */\n#endif\n\nstruct priority {\n\tu_char\tpri_class;\t/* Scheduling class. */\n\tu_char\tpri_level;\t/* Normal priority level. */\n\tu_char\tpri_native;\t/* Priority before propogation. */\n\tu_char\tpri_user;\t/* User priority based on p_cpu and p_nice. */\n};\n\n#endif\t/* !_SYS_PRIORITY_H_ */\n"
  },
  {
    "path": "freebsd-headers/sys/priv.h",
    "content": "/*-\n * Copyright (c) 2006 nCircle Network Security, Inc.\n * All rights reserved.\n *\n * This software was developed by Robert N. M. Watson for the TrustedBSD\n * Project under contract to nCircle Network Security, Inc.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR, NCIRCLE NETWORK SECURITY,\n * INC., OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED\n * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF\n * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING\n * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\n * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/sys/priv.h 223735 2011-07-03 12:22:02Z bz $\n */\n\n/*\n * Privilege checking interface for BSD kernel.\n */\n#ifndef _SYS_PRIV_H_\n#define\t_SYS_PRIV_H_\n\n/*\n * Privilege list, sorted loosely by kernel subsystem.\n *\n * Think carefully before adding or reusing one of these privileges -- are\n * there existing instances referring to the same privilege?  Third party\n * vendors may request the assignment of privileges to be used in loadable\n * modules.  Particular numeric privilege assignments are part of the\n * loadable kernel module ABI, and should not be changed across minor\n * releases.\n *\n * When adding a new privilege, remember to determine if it's appropriate for\n * use in jail, and update the privilege switch in kern_jail.c as necessary.\n */\n\n/*\n * Track beginning of privilege list.\n */\n#define\t_PRIV_LOWEST\t1\n\n/*\n * The remaining privileges typically correspond to one or a small\n * number of specific privilege checks, and have (relatively) precise\n * meanings.  They are loosely sorted into a set of base system\n * privileges, such as the ability to reboot, and then loosely by\n * subsystem, indicated by a subsystem name.\n */\n#define\t_PRIV_ROOT\t\t1\t/* Removed. */\n#define\tPRIV_ACCT\t\t2\t/* Manage process accounting. */\n#define\tPRIV_MAXFILES\t\t3\t/* Exceed system open files limit. */\n#define\tPRIV_MAXPROC\t\t4\t/* Exceed system processes limit. */\n#define\tPRIV_KTRACE\t\t5\t/* Set/clear KTRFAC_ROOT on ktrace. */\n#define\tPRIV_SETDUMPER\t\t6\t/* Configure dump device. */\n#define\tPRIV_REBOOT\t\t8\t/* Can reboot system. */\n#define\tPRIV_SWAPON\t\t9\t/* Can swapon(). */\n#define\tPRIV_SWAPOFF\t\t10\t/* Can swapoff(). */\n#define\tPRIV_MSGBUF\t\t11\t/* Can read kernel message buffer. */\n#define\tPRIV_IO\t\t\t12\t/* Can perform low-level I/O. */\n#define\tPRIV_KEYBOARD\t\t13\t/* Reprogram keyboard. */\n#define\tPRIV_DRIVER\t\t14\t/* Low-level driver privilege. */\n#define\tPRIV_ADJTIME\t\t15\t/* Set time adjustment. */\n#define\tPRIV_NTP_ADJTIME\t16\t/* Set NTP time adjustment. */\n#define\tPRIV_CLOCK_SETTIME\t17\t/* Can call clock_settime. */\n#define\tPRIV_SETTIMEOFDAY\t18\t/* Can call settimeofday. */\n#define\t_PRIV_SETHOSTID\t\t19\t/* Removed. */\n#define\t_PRIV_SETDOMAINNAME\t20\t/* Removed. */\n\n/*\n * Audit subsystem privileges.\n */\n#define\tPRIV_AUDIT_CONTROL\t40\t/* Can configure audit. */\n#define\tPRIV_AUDIT_FAILSTOP\t41\t/* Can run during audit fail stop. */\n#define\tPRIV_AUDIT_GETAUDIT\t42\t/* Can get proc audit properties. */\n#define\tPRIV_AUDIT_SETAUDIT\t43\t/* Can set proc audit properties. */\n#define\tPRIV_AUDIT_SUBMIT\t44\t/* Can submit an audit record. */\n\n/*\n * Credential management privileges.\n */\n#define\tPRIV_CRED_SETUID\t50\t/* setuid. */\n#define\tPRIV_CRED_SETEUID\t51\t/* seteuid to !ruid and !svuid. */\n#define\tPRIV_CRED_SETGID\t52\t/* setgid. */\n#define\tPRIV_CRED_SETEGID\t53\t/* setgid to !rgid and !svgid. */\n#define\tPRIV_CRED_SETGROUPS\t54\t/* Set process additional groups. */\n#define\tPRIV_CRED_SETREUID\t55\t/* setreuid. */\n#define\tPRIV_CRED_SETREGID\t56\t/* setregid. */\n#define\tPRIV_CRED_SETRESUID\t57\t/* setresuid. */\n#define\tPRIV_CRED_SETRESGID\t58\t/* setresgid. */\n#define\tPRIV_SEEOTHERGIDS\t59\t/* Exempt bsd.seeothergids. */\n#define\tPRIV_SEEOTHERUIDS\t60\t/* Exempt bsd.seeotheruids. */\n\n/*\n * Debugging privileges.\n */\n#define\tPRIV_DEBUG_DIFFCRED\t80\t/* Exempt debugging other users. */\n#define\tPRIV_DEBUG_SUGID\t81\t/* Exempt debugging setuid proc. */\n#define\tPRIV_DEBUG_UNPRIV\t82\t/* Exempt unprivileged debug limit. */\n\n/*\n * Dtrace privileges.\n */\n#define\tPRIV_DTRACE_KERNEL\t90\t/* Allow use of DTrace on the kernel. */\n#define\tPRIV_DTRACE_PROC\t91\t/* Allow attaching DTrace to process. */\n#define\tPRIV_DTRACE_USER\t92\t/* Process may submit DTrace events. */\n\n/*\n * Firmware privilegs.\n */\n#define\tPRIV_FIRMWARE_LOAD\t100\t/* Can load firmware. */\n\n/*\n * Jail privileges.\n */\n#define\tPRIV_JAIL_ATTACH\t110\t/* Attach to a jail. */\n#define\tPRIV_JAIL_SET\t\t111\t/* Set jail parameters. */\n#define\tPRIV_JAIL_REMOVE\t112\t/* Remove a jail. */\n\n/*\n * Kernel environment priveleges.\n */\n#define\tPRIV_KENV_SET\t\t120\t/* Set kernel env. variables. */\n#define\tPRIV_KENV_UNSET\t\t121\t/* Unset kernel env. variables. */\n\n/*\n * Loadable kernel module privileges.\n */\n#define\tPRIV_KLD_LOAD\t\t130\t/* Load a kernel module. */\n#define\tPRIV_KLD_UNLOAD\t\t131\t/* Unload a kernel module. */\n\n/*\n * Privileges associated with the MAC Framework and specific MAC policy\n * modules.\n */\n#define\tPRIV_MAC_PARTITION\t140\t/* Privilege in mac_partition policy. */\n#define\tPRIV_MAC_PRIVS\t\t141\t/* Privilege in the mac_privs policy. */\n\n/*\n * Process-related privileges.\n */\n#define\tPRIV_PROC_LIMIT\t\t160\t/* Exceed user process limit. */\n#define\tPRIV_PROC_SETLOGIN\t161\t/* Can call setlogin. */\n#define\tPRIV_PROC_SETRLIMIT\t162\t/* Can raise resources limits. */\n#define\tPRIV_PROC_SETLOGINCLASS\t163\t/* Can call setloginclass(2). */\n\n/* System V IPC privileges.\n */\n#define\tPRIV_IPC_READ\t\t170\t/* Can override IPC read perm. */\n#define\tPRIV_IPC_WRITE\t\t171\t/* Can override IPC write perm. */\n#define\tPRIV_IPC_ADMIN\t\t172\t/* Can override IPC owner-only perm. */\n#define\tPRIV_IPC_MSGSIZE\t173\t/* Exempt IPC message queue limit. */\n\n/*\n * POSIX message queue privileges.\n */\n#define\tPRIV_MQ_ADMIN\t\t180\t/* Can override msgq owner-only perm. */\n\n/*\n * Performance monitoring counter privileges.\n */\n#define\tPRIV_PMC_MANAGE\t\t190\t/* Can administer PMC. */\n#define\tPRIV_PMC_SYSTEM\t\t191\t/* Can allocate a system-wide PMC. */\n\n/*\n * Scheduling privileges.\n */\n#define\tPRIV_SCHED_DIFFCRED\t200\t/* Exempt scheduling other users. */\n#define\tPRIV_SCHED_SETPRIORITY\t201\t/* Can set lower nice value for proc. */\n#define\tPRIV_SCHED_RTPRIO\t202\t/* Can set real time scheduling. */\n#define\tPRIV_SCHED_SETPOLICY\t203\t/* Can set scheduler policy. */\n#define\tPRIV_SCHED_SET\t\t204\t/* Can set thread scheduler. */\n#define\tPRIV_SCHED_SETPARAM\t205\t/* Can set thread scheduler params. */\n#define\tPRIV_SCHED_CPUSET\t206\t/* Can manipulate cpusets. */\n#define\tPRIV_SCHED_CPUSET_INTR\t207\t/* Can adjust IRQ to CPU binding. */\n\n/*\n * POSIX semaphore privileges.\n */\n#define\tPRIV_SEM_WRITE\t\t220\t/* Can override sem write perm. */\n\n/*\n * Signal privileges.\n */\n#define\tPRIV_SIGNAL_DIFFCRED\t230\t/* Exempt signalling other users. */\n#define\tPRIV_SIGNAL_SUGID\t231\t/* Non-conserv signal setuid proc. */\n\n/*\n * Sysctl privileges.\n */\n#define\tPRIV_SYSCTL_DEBUG\t240\t/* Can invoke sysctl.debug. */\n#define\tPRIV_SYSCTL_WRITE\t241\t/* Can write sysctls. */\n#define\tPRIV_SYSCTL_WRITEJAIL\t242\t/* Can write sysctls, jail permitted. */\n\n/*\n * TTY privileges.\n */\n#define\tPRIV_TTY_CONSOLE\t250\t/* Set console to tty. */\n#define\tPRIV_TTY_DRAINWAIT\t251\t/* Set tty drain wait time. */\n#define\tPRIV_TTY_DTRWAIT\t252\t/* Set DTR wait on tty. */\n#define\tPRIV_TTY_EXCLUSIVE\t253\t/* Override tty exclusive flag. */\n#define\t_PRIV_TTY_PRISON\t254\t/* Removed. */\n#define\tPRIV_TTY_STI\t\t255\t/* Simulate input on another tty. */\n#define\tPRIV_TTY_SETA\t\t256\t/* Set tty termios structure. */\n\n/*\n * UFS-specific privileges.\n */\n#define\tPRIV_UFS_EXTATTRCTL\t270\t/* Can configure EAs on UFS1. */\n#define\tPRIV_UFS_QUOTAOFF\t271\t/* quotaoff(). */\n#define\tPRIV_UFS_QUOTAON\t272\t/* quotaon(). */\n#define\tPRIV_UFS_SETUSE\t\t273\t/* setuse(). */\n\n/*\n * ZFS-specific privileges.\n */\n#define\tPRIV_ZFS_POOL_CONFIG\t280\t/* Can configure ZFS pools. */\n#define\tPRIV_ZFS_INJECT\t\t281\t/* Can inject faults in the ZFS fault\n\t\t\t\t\t   injection framework. */\n#define\tPRIV_ZFS_JAIL\t\t282\t/* Can attach/detach ZFS file systems\n\t\t\t\t\t   to/from jails. */\n\n/*\n * NFS-specific privileges.\n */\n#define\tPRIV_NFS_DAEMON\t\t290\t/* Can become the NFS daemon. */\n#define\tPRIV_NFS_LOCKD\t\t291\t/* Can become NFS lock daemon. */\n\n/*\n * VFS privileges.\n */\n#define\tPRIV_VFS_READ\t\t310\t/* Override vnode DAC read perm. */\n#define\tPRIV_VFS_WRITE\t\t311\t/* Override vnode DAC write perm. */\n#define\tPRIV_VFS_ADMIN\t\t312\t/* Override vnode DAC admin perm. */\n#define\tPRIV_VFS_EXEC\t\t313\t/* Override vnode DAC exec perm. */\n#define\tPRIV_VFS_LOOKUP\t\t314\t/* Override vnode DAC lookup perm. */\n#define\tPRIV_VFS_BLOCKRESERVE\t315\t/* Can use free block reserve. */\n#define\tPRIV_VFS_CHFLAGS_DEV\t316\t/* Can chflags() a device node. */\n#define\tPRIV_VFS_CHOWN\t\t317\t/* Can set user; group to non-member. */\n#define\tPRIV_VFS_CHROOT\t\t318\t/* chroot(). */\n#define\tPRIV_VFS_RETAINSUGID\t319\t/* Can retain sugid bits on change. */\n#define\tPRIV_VFS_EXCEEDQUOTA\t320\t/* Exempt from quota restrictions. */\n#define\tPRIV_VFS_EXTATTR_SYSTEM\t321\t/* Operate on system EA namespace. */\n#define\tPRIV_VFS_FCHROOT\t322\t/* fchroot(). */\n#define\tPRIV_VFS_FHOPEN\t\t323\t/* Can fhopen(). */\n#define\tPRIV_VFS_FHSTAT\t\t324\t/* Can fhstat(). */\n#define\tPRIV_VFS_FHSTATFS\t325\t/* Can fhstatfs(). */\n#define\tPRIV_VFS_GENERATION\t326\t/* stat() returns generation number. */\n#define\tPRIV_VFS_GETFH\t\t327\t/* Can retrieve file handles. */\n#define\tPRIV_VFS_GETQUOTA\t328\t/* getquota(). */\n#define\tPRIV_VFS_LINK\t\t329\t/* bsd.hardlink_check_uid */\n#define\tPRIV_VFS_MKNOD_BAD\t330\t/* Can mknod() to mark bad inodes. */\n#define\tPRIV_VFS_MKNOD_DEV\t331\t/* Can mknod() to create dev nodes. */\n#define\tPRIV_VFS_MKNOD_WHT\t332\t/* Can mknod() to create whiteout. */\n#define\tPRIV_VFS_MOUNT\t\t333\t/* Can mount(). */\n#define\tPRIV_VFS_MOUNT_OWNER\t334\t/* Can manage other users' file systems. */\n#define\tPRIV_VFS_MOUNT_EXPORTED\t335\t/* Can set MNT_EXPORTED on mount. */\n#define\tPRIV_VFS_MOUNT_PERM\t336\t/* Override dev node perms at mount. */\n#define\tPRIV_VFS_MOUNT_SUIDDIR\t337\t/* Can set MNT_SUIDDIR on mount. */\n#define\tPRIV_VFS_MOUNT_NONUSER\t338\t/* Can perform a non-user mount. */\n#define\tPRIV_VFS_SETGID\t\t339\t/* Can setgid if not in group. */\n#define\tPRIV_VFS_SETQUOTA\t340\t/* setquota(). */\n#define\tPRIV_VFS_STICKYFILE\t341\t/* Can set sticky bit on file. */\n#define\tPRIV_VFS_SYSFLAGS\t342\t/* Can modify system flags. */\n#define\tPRIV_VFS_UNMOUNT\t343\t/* Can unmount(). */\n#define\tPRIV_VFS_STAT\t\t344\t/* Override vnode MAC stat perm. */\n\n/*\n * Virtual memory privileges.\n */\n#define\tPRIV_VM_MADV_PROTECT\t360\t/* Can set MADV_PROTECT. */\n#define\tPRIV_VM_MLOCK\t\t361\t/* Can mlock(), mlockall(). */\n#define\tPRIV_VM_MUNLOCK\t\t362\t/* Can munlock(), munlockall(). */\n#define\tPRIV_VM_SWAP_NOQUOTA\t363\t/*\n\t\t\t\t\t * Can override the global\n\t\t\t\t\t * swap reservation limits.\n\t\t\t\t\t */\n#define\tPRIV_VM_SWAP_NORLIMIT\t364\t/*\n\t\t\t\t\t * Can override the per-uid\n\t\t\t\t\t * swap reservation limits.\n\t\t\t\t\t */\n\n/*\n * Device file system privileges.\n */\n#define\tPRIV_DEVFS_RULE\t\t370\t/* Can manage devfs rules. */\n#define\tPRIV_DEVFS_SYMLINK\t371\t/* Can create symlinks in devfs. */\n\n/*\n * Random number generator privileges.\n */\n#define\tPRIV_RANDOM_RESEED\t380\t/* Closing /dev/random reseeds. */\n\n/*\n * Network stack privileges.\n */\n#define\tPRIV_NET_BRIDGE\t\t390\t/* Administer bridge. */\n#define\tPRIV_NET_GRE\t\t391\t/* Administer GRE. */\n#define\t_PRIV_NET_PPP\t\t392\t/* Removed. */\n#define\t_PRIV_NET_SLIP\t\t393\t/* Removed. */\n#define\tPRIV_NET_BPF\t\t394\t/* Monitor BPF. */\n#define\tPRIV_NET_RAW\t\t395\t/* Open raw socket. */\n#define\tPRIV_NET_ROUTE\t\t396\t/* Administer routing. */\n#define\tPRIV_NET_TAP\t\t397\t/* Can open tap device. */\n#define\tPRIV_NET_SETIFMTU\t398\t/* Set interface MTU. */\n#define\tPRIV_NET_SETIFFLAGS\t399\t/* Set interface flags. */\n#define\tPRIV_NET_SETIFCAP\t400\t/* Set interface capabilities. */\n#define\tPRIV_NET_SETIFNAME\t401\t/* Set interface name. */\n#define\tPRIV_NET_SETIFMETRIC\t402\t/* Set interface metrics. */\n#define\tPRIV_NET_SETIFPHYS\t403\t/* Set interface physical layer prop. */\n#define\tPRIV_NET_SETIFMAC\t404\t/* Set interface MAC label. */\n#define\tPRIV_NET_ADDMULTI\t405\t/* Add multicast addr. to ifnet. */\n#define\tPRIV_NET_DELMULTI\t406\t/* Delete multicast addr. from ifnet. */\n#define\tPRIV_NET_HWIOCTL\t407\t/* Issue hardware ioctl on ifnet. */\n#define\tPRIV_NET_SETLLADDR\t408\t/* Set interface link-level address. */\n#define\tPRIV_NET_ADDIFGROUP\t409\t/* Add new interface group. */\n#define\tPRIV_NET_DELIFGROUP\t410\t/* Delete interface group. */\n#define\tPRIV_NET_IFCREATE\t411\t/* Create cloned interface. */\n#define\tPRIV_NET_IFDESTROY\t412\t/* Destroy cloned interface. */\n#define\tPRIV_NET_ADDIFADDR\t413\t/* Add protocol addr to interface. */\n#define\tPRIV_NET_DELIFADDR\t414\t/* Delete protocol addr on interface. */\n#define\tPRIV_NET_LAGG\t\t415\t/* Administer lagg interface. */\n#define\tPRIV_NET_GIF\t\t416\t/* Administer gif interface. */\n#define\tPRIV_NET_SETIFVNET\t417\t/* Move interface to vnet. */\n#define\tPRIV_NET_SETIFDESCR\t418\t/* Set interface description. */\n#define\tPRIV_NET_SETIFFIB\t419\t/* Set interface fib. */\n\n/*\n * 802.11-related privileges.\n */\n#define\tPRIV_NET80211_GETKEY\t440\t/* Query 802.11 keys. */\n#define\tPRIV_NET80211_MANAGE\t441\t/* Administer 802.11. */\n\n/*\n * AppleTalk privileges.\n */\n#define\tPRIV_NETATALK_RESERVEDPORT\t450\t/* Bind low port number. */\n\n/*\n * ATM privileges.\n */\n#define\tPRIV_NETATM_CFG\t\t460\n#define\tPRIV_NETATM_ADD\t\t461\n#define\tPRIV_NETATM_DEL\t\t462\n#define\tPRIV_NETATM_SET\t\t463\n\n/*\n * Bluetooth privileges.\n */\n#define\tPRIV_NETBLUETOOTH_RAW\t470\t/* Open raw bluetooth socket. */\n\n/*\n * Netgraph and netgraph module privileges.\n */\n#define\tPRIV_NETGRAPH_CONTROL\t480\t/* Open netgraph control socket. */\n#define\tPRIV_NETGRAPH_TTY\t481\t/* Configure tty for netgraph. */\n\n/*\n * IPv4 and IPv6 privileges.\n */\n#define\tPRIV_NETINET_RESERVEDPORT\t490\t/* Bind low port number. */\n#define\tPRIV_NETINET_IPFW\t491\t/* Administer IPFW firewall. */\n#define\tPRIV_NETINET_DIVERT\t492\t/* Open IP divert socket. */\n#define\tPRIV_NETINET_PF\t\t493\t/* Administer pf firewall. */\n#define\tPRIV_NETINET_DUMMYNET\t494\t/* Administer DUMMYNET. */\n#define\tPRIV_NETINET_CARP\t495\t/* Administer CARP. */\n#define\tPRIV_NETINET_MROUTE\t496\t/* Administer multicast routing. */\n#define\tPRIV_NETINET_RAW\t497\t/* Open netinet raw socket. */\n#define\tPRIV_NETINET_GETCRED\t498\t/* Query netinet pcb credentials. */\n#define\tPRIV_NETINET_ADDRCTRL6\t499\t/* Administer IPv6 address scopes. */\n#define\tPRIV_NETINET_ND6\t500\t/* Administer IPv6 neighbor disc. */\n#define\tPRIV_NETINET_SCOPE6\t501\t/* Administer IPv6 address scopes. */\n#define\tPRIV_NETINET_ALIFETIME6\t502\t/* Administer IPv6 address lifetimes. */\n#define\tPRIV_NETINET_IPSEC\t503\t/* Administer IPSEC. */\n#define\tPRIV_NETINET_REUSEPORT\t504\t/* Allow [rapid] port/address reuse. */\n#define\tPRIV_NETINET_SETHDROPTS\t505\t/* Set certain IPv4/6 header options. */\n#define\tPRIV_NETINET_BINDANY\t506\t/* Allow bind to any address. */\n\n/*\n * IPX/SPX privileges.\n */\n#define\tPRIV_NETIPX_RESERVEDPORT\t520\t/* Bind low port number. */\n#define\tPRIV_NETIPX_RAW\t\t521\t/* Open netipx raw socket. */\n\n/*\n * NCP privileges.\n */\n#define\tPRIV_NETNCP\t\t530\t/* Use another user's connection. */\n\n/*\n * SMB privileges.\n */\n#define\tPRIV_NETSMB\t\t540\t/* Use another user's connection. */\n\n/*\n * VM86 privileges.\n */\n#define\tPRIV_VM86_INTCALL\t550\t/* Allow invoking vm86 int handlers. */\n\n/*\n * Set of reserved privilege values, which will be allocated to code as\n * needed, in order to avoid renumbering later privileges due to insertion.\n */\n#define\t_PRIV_RESERVED0\t\t560\n#define\t_PRIV_RESERVED1\t\t561\n#define\t_PRIV_RESERVED2\t\t562\n#define\t_PRIV_RESERVED3\t\t563\n#define\t_PRIV_RESERVED4\t\t564\n#define\t_PRIV_RESERVED5\t\t565\n#define\t_PRIV_RESERVED6\t\t566\n#define\t_PRIV_RESERVED7\t\t567\n#define\t_PRIV_RESERVED8\t\t568\n#define\t_PRIV_RESERVED9\t\t569\n#define\t_PRIV_RESERVED10\t570\n#define\t_PRIV_RESERVED11\t571\n#define\t_PRIV_RESERVED12\t572\n#define\t_PRIV_RESERVED13\t573\n#define\t_PRIV_RESERVED14\t574\n#define\t_PRIV_RESERVED15\t575\n\n/*\n * Define a set of valid privilege numbers that can be used by loadable\n * modules that don't yet have privilege reservations.  Ideally, these should\n * not be used, since their meaning is opaque to any policies that are aware\n * of specific privileges, such as jail, and as such may be arbitrarily\n * denied.\n */\n#define\tPRIV_MODULE0\t\t600\n#define\tPRIV_MODULE1\t\t601\n#define\tPRIV_MODULE2\t\t602\n#define\tPRIV_MODULE3\t\t603\n#define\tPRIV_MODULE4\t\t604\n#define\tPRIV_MODULE5\t\t605\n#define\tPRIV_MODULE6\t\t606\n#define\tPRIV_MODULE7\t\t607\n#define\tPRIV_MODULE8\t\t608\n#define\tPRIV_MODULE9\t\t609\n#define\tPRIV_MODULE10\t\t610\n#define\tPRIV_MODULE11\t\t611\n#define\tPRIV_MODULE12\t\t612\n#define\tPRIV_MODULE13\t\t613\n#define\tPRIV_MODULE14\t\t614\n#define\tPRIV_MODULE15\t\t615\n\n/*\n * DDB(4) privileges.\n */\n#define\tPRIV_DDB_CAPTURE\t620\t/* Allow reading of DDB capture log. */\n\n/*\n * Arla/nnpfs privileges.\n */\n#define\tPRIV_NNPFS_DEBUG\t630\t/* Perforn ARLA_VIOC_NNPFSDEBUG. */\n\n/*\n * cpuctl(4) privileges.\n */\n#define PRIV_CPUCTL_WRMSR\t640\t/* Write model-specific register. */\n#define PRIV_CPUCTL_UPDATE\t641\t/* Update cpu microcode. */\n\n/*\n * Capi4BSD privileges.\n */\n#define\tPRIV_C4B_RESET_CTLR\t650\t/* Load firmware, reset controller. */\n#define\tPRIV_C4B_TRACE\t\t651\t/* Unrestricted CAPI message tracing. */\n\n/*\n * OpenAFS privileges.\n */\n#define\tPRIV_AFS_ADMIN\t\t660\t/* Can change AFS client settings. */\n#define\tPRIV_AFS_DAEMON\t\t661\t/* Can become the AFS daemon. */\n\n/*\n * Resource Limits privileges.\n */\n#define\tPRIV_RCTL_GET_RACCT\t670\n#define\tPRIV_RCTL_GET_RULES\t671\n#define\tPRIV_RCTL_GET_LIMITS\t672\n#define\tPRIV_RCTL_ADD_RULE\t673\n#define\tPRIV_RCTL_REMOVE_RULE\t674\n\n/*\n * Track end of privilege list.\n */\n#define\t_PRIV_HIGHEST\t\t675\n\n/*\n * Validate that a named privilege is known by the privilege system.  Invalid\n * privileges presented to the privilege system by a priv_check interface\n * will result in a panic.  This is only approximate due to sparse allocation\n * of the privilege space.\n */\n#define\tPRIV_VALID(x)\t((x) > _PRIV_LOWEST && (x) < _PRIV_HIGHEST)\n\n#ifdef _KERNEL\n/*\n * Privilege check interfaces, modeled after historic suser() interfaces, but\n * with the addition of a specific privilege name.  No flags are currently\n * defined for the API.  Historically, flags specified using the real uid\n * instead of the effective uid, and whether or not the check should be\n * allowed in jail.\n */\nstruct thread;\nstruct ucred;\nint\tpriv_check(struct thread *td, int priv);\nint\tpriv_check_cred(struct ucred *cred, int priv, int flags);\n#endif\n\n#endif /* !_SYS_PRIV_H_ */\n"
  },
  {
    "path": "freebsd-headers/sys/proc.h",
    "content": "/*-\n * Copyright (c) 1986, 1989, 1991, 1993\n *\tThe Regents of the University of California.  All rights reserved.\n * (c) UNIX System Laboratories, Inc.\n * All or some portions of this file are derived from material licensed\n * to the University of California by American Telephone and Telegraph\n * Co. or Unix System Laboratories, Inc. and are reproduced herein with\n * the permission of UNIX System Laboratories, Inc.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 4. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t@(#)proc.h\t8.15 (Berkeley) 5/19/95\n * $FreeBSD: release/9.0.0/sys/sys/proc.h 227886 2011-11-23 15:16:05Z kib $\n */\n\n#ifndef _SYS_PROC_H_\n#define\t_SYS_PROC_H_\n\n#include <sys/callout.h>\t\t/* For struct callout. */\n#include <sys/event.h>\t\t\t/* For struct klist. */\n#include <sys/condvar.h>\n#ifndef _KERNEL\n#include <sys/filedesc.h>\n#endif\n#include <sys/queue.h>\n#include <sys/_lock.h>\n#include <sys/lock_profile.h>\n#include <sys/_mutex.h>\n#include <sys/osd.h>\n#include <sys/priority.h>\n#include <sys/rtprio.h>\t\t\t/* XXX. */\n#include <sys/runq.h>\n#include <sys/resource.h>\n#include <sys/sigio.h>\n#include <sys/signal.h>\n#include <sys/signalvar.h>\n#ifndef _KERNEL\n#include <sys/time.h>\t\t\t/* For structs itimerval, timeval. */\n#else\n#include <sys/pcpu.h>\n#endif\n#include <sys/ucontext.h>\n#include <sys/ucred.h>\n#include <machine/proc.h>\t\t/* Machine-dependent proc substruct. */\n\n/*\n * One structure allocated per session.\n *\n * List of locks\n * (m)\t\tlocked by s_mtx mtx\n * (e)\t\tlocked by proctree_lock sx\n * (c)\t\tconst until freeing\n */\nstruct session {\n\tu_int\t\ts_count;\t/* Ref cnt; pgrps in session - atomic. */\n\tstruct proc\t*s_leader;\t/* (m + e) Session leader. */\n\tstruct vnode\t*s_ttyvp;\t/* (m) Vnode of controlling tty. */\n\tstruct cdev_priv *s_ttydp;\t/* (m) Device of controlling tty.  */\n\tstruct tty\t*s_ttyp;\t/* (e) Controlling tty. */\n\tpid_t\t\ts_sid;\t\t/* (c) Session ID. */\n\t\t\t\t\t/* (m) Setlogin() name: */\n\tchar\t\ts_login[roundup(MAXLOGNAME, sizeof(long))];\n\tstruct mtx\ts_mtx;\t\t/* Mutex to protect members. */\n};\n\n/*\n * One structure allocated per process group.\n *\n * List of locks\n * (m)\t\tlocked by pg_mtx mtx\n * (e)\t\tlocked by proctree_lock sx\n * (c)\t\tconst until freeing\n */\nstruct pgrp {\n\tLIST_ENTRY(pgrp) pg_hash;\t/* (e) Hash chain. */\n\tLIST_HEAD(, proc) pg_members;\t/* (m + e) Pointer to pgrp members. */\n\tstruct session\t*pg_session;\t/* (c) Pointer to session. */\n\tstruct sigiolst\tpg_sigiolst;\t/* (m) List of sigio sources. */\n\tpid_t\t\tpg_id;\t\t/* (c) Process group id. */\n\tint\t\tpg_jobc;\t/* (m) Job control process count. */\n\tstruct mtx\tpg_mtx;\t\t/* Mutex to protect members */\n};\n\n/*\n * pargs, used to hold a copy of the command line, if it had a sane length.\n */\nstruct pargs {\n\tu_int\tar_ref;\t\t/* Reference count. */\n\tu_int\tar_length;\t/* Length. */\n\tu_char\tar_args[1];\t/* Arguments. */\n};\n\n/*-\n * Description of a process.\n *\n * This structure contains the information needed to manage a thread of\n * control, known in UN*X as a process; it has references to substructures\n * containing descriptions of things that the process uses, but may share\n * with related processes.  The process structure and the substructures\n * are always addressable except for those marked \"(CPU)\" below,\n * which might be addressable only on a processor on which the process\n * is running.\n *\n * Below is a key of locks used to protect each member of struct proc.  The\n * lock is indicated by a reference to a specific character in parens in the\n * associated comment.\n *      * - not yet protected\n *      a - only touched by curproc or parent during fork/wait\n *      b - created at fork, never changes\n *\t\t(exception aiods switch vmspaces, but they are also\n *\t\tmarked 'P_SYSTEM' so hopefully it will be left alone)\n *      c - locked by proc mtx\n *      d - locked by allproc_lock lock\n *      e - locked by proctree_lock lock\n *      f - session mtx\n *      g - process group mtx\n *      h - callout_lock mtx\n *      i - by curproc or the master session mtx\n *      j - locked by proc slock\n *      k - only accessed by curthread\n *\tk*- only accessed by curthread and from an interrupt\n *      l - the attaching proc or attaching proc parent\n *      m - Giant\n *      n - not locked, lazy\n *      o - ktrace lock\n *      q - td_contested lock\n *      r - p_peers lock\n *      t - thread lock\n *      x - created at fork, only changes during single threading in exec\n *      y - created at first aio, doesn't change until exit or exec at which\n *          point we are single-threaded and only curthread changes it\n *      z - zombie threads lock\n *\n * If the locking key specifies two identifiers (for example, p_pptr) then\n * either lock is sufficient for read access, but both locks must be held\n * for write access.\n */\nstruct cpuset;\nstruct kaioinfo;\nstruct kaudit_record;\nstruct kdtrace_proc;\nstruct kdtrace_thread;\nstruct mqueue_notifier;\nstruct nlminfo;\nstruct p_sched;\nstruct proc;\nstruct procdesc;\nstruct racct;\nstruct sleepqueue;\nstruct td_sched;\nstruct thread;\nstruct trapframe;\nstruct turnstile;\n\n/*\n * XXX: Does this belong in resource.h or resourcevar.h instead?\n * Resource usage extension.  The times in rusage structs in the kernel are\n * never up to date.  The actual times are kept as runtimes and tick counts\n * (with control info in the \"previous\" times), and are converted when\n * userland asks for rusage info.  Backwards compatibility prevents putting\n * this directly in the user-visible rusage struct.\n *\n * Locking for p_rux: (cj) means (j) for p_rux and (c) for p_crux.\n * Locking for td_rux: (t) for all fields.\n */\nstruct rusage_ext {\n\tuint64_t\trux_runtime;    /* (cj) Real time. */\n\tuint64_t\trux_uticks;     /* (cj) Statclock hits in user mode. */\n\tuint64_t\trux_sticks;     /* (cj) Statclock hits in sys mode. */\n\tuint64_t\trux_iticks;     /* (cj) Statclock hits in intr mode. */\n\tuint64_t\trux_uu;         /* (c) Previous user time in usec. */\n\tuint64_t\trux_su;         /* (c) Previous sys time in usec. */\n\tuint64_t\trux_tu;         /* (c) Previous total time in usec. */\n};\n\n/*\n * Kernel runnable context (thread).\n * This is what is put to sleep and reactivated.\n * Thread context.  Processes may have multiple threads.\n */\nstruct thread {\n\tstruct mtx\t*volatile td_lock; /* replaces sched lock */\n\tstruct proc\t*td_proc;\t/* (*) Associated process. */\n\tTAILQ_ENTRY(thread) td_plist;\t/* (*) All threads in this proc. */\n\tTAILQ_ENTRY(thread) td_runq;\t/* (t) Run queue. */\n\tTAILQ_ENTRY(thread) td_slpq;\t/* (t) Sleep queue. */\n\tTAILQ_ENTRY(thread) td_lockq;\t/* (t) Lock queue. */\n\tLIST_ENTRY(thread) td_hash;\t/* (d) Hash chain. */\n\tstruct cpuset\t*td_cpuset;\t/* (t) CPU affinity mask. */\n\tstruct seltd\t*td_sel;\t/* Select queue/channel. */\n\tstruct sleepqueue *td_sleepqueue; /* (k) Associated sleep queue. */\n\tstruct turnstile *td_turnstile;\t/* (k) Associated turnstile. */\n\tstruct umtx_q   *td_umtxq;\t/* (c?) Link for when we're blocked. */\n\tlwpid_t\t\ttd_tid;\t\t/* (b) Thread ID. */\n\tsigqueue_t\ttd_sigqueue;\t/* (c) Sigs arrived, not delivered. */\n#define\ttd_siglist\ttd_sigqueue.sq_signals\n\tu_char\t\ttd_lend_user_pri; /* (t) Lend user pri. */\n\n/* Cleared during fork1() */\n#define\ttd_startzero td_flags\n\tint\t\ttd_flags;\t/* (t) TDF_* flags. */\n\tint\t\ttd_inhibitors;\t/* (t) Why can not run. */\n\tint\t\ttd_pflags;\t/* (k) Private thread (TDP_*) flags. */\n\tint\t\ttd_dupfd;\t/* (k) Ret value from fdopen. XXX */\n\tint\t\ttd_sqqueue;\t/* (t) Sleepqueue queue blocked on. */\n\tvoid\t\t*td_wchan;\t/* (t) Sleep address. */\n\tconst char\t*td_wmesg;\t/* (t) Reason for sleep. */\n\tu_char\t\ttd_lastcpu;\t/* (t) Last cpu we were on. */\n\tu_char\t\ttd_oncpu;\t/* (t) Which cpu we are on. */\n\tvolatile u_char td_owepreempt;  /* (k*) Preempt on last critical_exit */\n\tu_char\t\ttd_tsqueue;\t/* (t) Turnstile queue blocked on. */\n\tshort\t\ttd_locks;\t/* (k) Count of non-spin locks. */\n\tshort\t\ttd_rw_rlocks;\t/* (k) Count of rwlock read locks. */\n\tshort\t\ttd_lk_slocks;\t/* (k) Count of lockmgr shared locks. */\n\tstruct turnstile *td_blocked;\t/* (t) Lock thread is blocked on. */\n\tconst char\t*td_lockname;\t/* (t) Name of lock blocked on. */\n\tLIST_HEAD(, turnstile) td_contested;\t/* (q) Contested locks. */\n\tstruct lock_list_entry *td_sleeplocks; /* (k) Held sleep locks. */\n\tint\t\ttd_intr_nesting_level; /* (k) Interrupt recursion. */\n\tint\t\ttd_pinned;\t/* (k) Temporary cpu pin count. */\n\tstruct ucred\t*td_ucred;\t/* (k) Reference to credentials. */\n\tu_int\t\ttd_estcpu;\t/* (t) estimated cpu utilization */\n\tint\t\ttd_slptick;\t/* (t) Time at sleep. */\n\tint\t\ttd_blktick;\t/* (t) Time spent blocked. */\n\tint\t\ttd_swvoltick;\t/* (t) Time at last SW_VOL switch. */\n\tstruct rusage\ttd_ru;\t\t/* (t) rusage information. */\n\tstruct rusage_ext td_rux;\t/* (t) Internal rusage information. */\n\tuint64_t\ttd_incruntime;\t/* (t) Cpu ticks to transfer to proc. */\n\tuint64_t\ttd_runtime;\t/* (t) How many cpu ticks we've run. */\n\tu_int \t\ttd_pticks;\t/* (t) Statclock hits for profiling */\n\tu_int\t\ttd_sticks;\t/* (t) Statclock hits in system mode. */\n\tu_int\t\ttd_iticks;\t/* (t) Statclock hits in intr mode. */\n\tu_int\t\ttd_uticks;\t/* (t) Statclock hits in user mode. */\n\tint\t\ttd_intrval;\t/* (t) Return value for sleepq. */\n\tsigset_t\ttd_oldsigmask;\t/* (k) Saved mask from pre sigpause. */\n\tsigset_t\ttd_sigmask;\t/* (c) Current signal mask. */\n\tvolatile u_int\ttd_generation;\t/* (k) For detection of preemption */\n\tstack_t\t\ttd_sigstk;\t/* (k) Stack ptr and on-stack flag. */\n\tint\t\ttd_xsig;\t/* (c) Signal for ptrace */\n\tu_long\t\ttd_profil_addr;\t/* (k) Temporary addr until AST. */\n\tu_int\t\ttd_profil_ticks; /* (k) Temporary ticks until AST. */\n\tchar\t\ttd_name[MAXCOMLEN + 1];\t/* (*) Thread name. */\n\tstruct file\t*td_fpop;\t/* (k) file referencing cdev under op */\n\tint\t\ttd_dbgflags;\t/* (c) Userland debugger flags */\n\tstruct ksiginfo td_dbgksi;\t/* (c) ksi reflected to debugger. */\n\tint\t\ttd_ng_outbound;\t/* (k) Thread entered ng from above. */\n\tstruct osd\ttd_osd;\t\t/* (k) Object specific data. */\n\tstruct vm_map_entry *td_map_def_user; /* (k) Deferred entries. */\n\tpid_t\t\ttd_dbg_forked;\t/* (c) Child pid for debugger. */\n#define\ttd_endzero td_rqindex\n\n/* Copied during fork1() or thread_sched_upcall(). */\n#define\ttd_startcopy td_endzero\n\tu_char\t\ttd_rqindex;\t/* (t) Run queue index. */\n\tu_char\t\ttd_base_pri;\t/* (t) Thread base kernel priority. */\n\tu_char\t\ttd_priority;\t/* (t) Thread active priority. */\n\tu_char\t\ttd_pri_class;\t/* (t) Scheduling class. */\n\tu_char\t\ttd_user_pri;\t/* (t) User pri from estcpu and nice. */\n\tu_char\t\ttd_base_user_pri; /* (t) Base user pri */\n#define\ttd_endcopy td_pcb\n\n/*\n * Fields that must be manually set in fork1() or thread_sched_upcall()\n * or already have been set in the allocator, constructor, etc.\n */\n\tstruct pcb\t*td_pcb;\t/* (k) Kernel VA of pcb and kstack. */\n\tenum {\n\t\tTDS_INACTIVE = 0x0,\n\t\tTDS_INHIBITED,\n\t\tTDS_CAN_RUN,\n\t\tTDS_RUNQ,\n\t\tTDS_RUNNING\n\t} td_state;\t\t\t/* (t) thread state */\n\tregister_t\ttd_retval[2];\t/* (k) Syscall aux returns. */\n\tstruct callout\ttd_slpcallout;\t/* (h) Callout for sleep. */\n\tstruct trapframe *td_frame;\t/* (k) */\n\tstruct vm_object *td_kstack_obj;/* (a) Kstack object. */\n\tvm_offset_t\ttd_kstack;\t/* (a) Kernel VA of kstack. */\n\tint\t\ttd_kstack_pages; /* (a) Size of the kstack. */\n\tvolatile u_int\ttd_critnest;\t/* (k*) Critical section nest level. */\n\tstruct mdthread td_md;\t\t/* (k) Any machine-dependent fields. */\n\tstruct td_sched\t*td_sched;\t/* (*) Scheduler-specific data. */\n\tstruct kaudit_record\t*td_ar;\t/* (k) Active audit record, if any. */\n\tstruct lpohead\ttd_lprof[2];\t/* (a) lock profiling objects. */\n\tstruct kdtrace_thread\t*td_dtrace; /* (*) DTrace-specific data. */\n\tint\t\ttd_errno;\t/* Error returned by last syscall. */\n\tstruct vnet\t*td_vnet;\t/* (k) Effective vnet. */\n\tconst char\t*td_vnet_lpush;\t/* (k) Debugging vnet push / pop. */\n\tstruct trapframe *td_intr_frame;/* (k) Frame of the current irq */\n};\n\nstruct mtx *thread_lock_block(struct thread *);\nvoid thread_lock_unblock(struct thread *, struct mtx *);\nvoid thread_lock_set(struct thread *, struct mtx *);\n#define\tTHREAD_LOCK_ASSERT(td, type)\t\t\t\t\t\\\ndo {\t\t\t\t\t\t\t\t\t\\\n\tstruct mtx *__m = (td)->td_lock;\t\t\t\t\\\n\tif (__m != &blocked_lock)\t\t\t\t\t\\\n\t\tmtx_assert(__m, (type));\t\t\t\t\\\n} while (0)\n\n#ifdef INVARIANTS\n#define\tTHREAD_LOCKPTR_ASSERT(td, lock)\t\t\t\t\t\\\ndo {\t\t\t\t\t\t\t\t\t\\\n\tstruct mtx *__m = (td)->td_lock;\t\t\t\t\\\n\tKASSERT((__m == &blocked_lock || __m == (lock)),\t\t\\\n\t    (\"Thread %p lock %p does not match %p\", td, __m, (lock)));\t\\\n} while (0)\n#else\n#define\tTHREAD_LOCKPTR_ASSERT(td, lock)\n#endif\n\n#define\tCRITICAL_ASSERT(td)\t\t\t\t\t\t\\\n    KASSERT((td)->td_critnest >= 1, (\"Not in critical section\"));\n\n/*\n * Flags kept in td_flags:\n * To change these you MUST have the scheduler lock.\n */\n#define\tTDF_BORROWING\t0x00000001 /* Thread is borrowing pri from another. */\n#define\tTDF_INPANIC\t0x00000002 /* Caused a panic, let it drive crashdump. */\n#define\tTDF_INMEM\t0x00000004 /* Thread's stack is in memory. */\n#define\tTDF_SINTR\t0x00000008 /* Sleep is interruptible. */\n#define\tTDF_TIMEOUT\t0x00000010 /* Timing out during sleep. */\n#define\tTDF_IDLETD\t0x00000020 /* This is a per-CPU idle thread. */\n#define\tTDF_CANSWAP\t0x00000040 /* Thread can be swapped. */\n#define\tTDF_SLEEPABORT\t0x00000080 /* sleepq_abort was called. */\n#define\tTDF_KTH_SUSP\t0x00000100 /* kthread is suspended */\n#define\tTDF_UNUSED09\t0x00000200 /* --available-- */\n#define\tTDF_BOUNDARY\t0x00000400 /* Thread suspended at user boundary */\n#define\tTDF_ASTPENDING\t0x00000800 /* Thread has some asynchronous events. */\n#define\tTDF_TIMOFAIL\t0x00001000 /* Timeout from sleep after we were awake. */\n#define\tTDF_SBDRY\t0x00002000 /* Stop only on usermode boundary. */\n#define\tTDF_UPIBLOCKED\t0x00004000 /* Thread blocked on user PI mutex. */\n#define\tTDF_NEEDSUSPCHK\t0x00008000 /* Thread may need to suspend. */\n#define\tTDF_NEEDRESCHED\t0x00010000 /* Thread needs to yield. */\n#define\tTDF_NEEDSIGCHK\t0x00020000 /* Thread may need signal delivery. */\n#define\tTDF_NOLOAD\t0x00040000 /* Ignore during load avg calculations. */\n#define\tTDF_UNUSED19\t0x00080000 /* --available-- */\n#define\tTDF_THRWAKEUP\t0x00100000 /* Libthr thread must not suspend itself. */\n#define\tTDF_UNUSED21\t0x00200000 /* --available-- */\n#define\tTDF_SWAPINREQ\t0x00400000 /* Swapin request due to wakeup. */\n#define\tTDF_UNUSED23\t0x00800000 /* --available-- */\n#define\tTDF_SCHED0\t0x01000000 /* Reserved for scheduler private use */\n#define\tTDF_SCHED1\t0x02000000 /* Reserved for scheduler private use */\n#define\tTDF_SCHED2\t0x04000000 /* Reserved for scheduler private use */\n#define\tTDF_SCHED3\t0x08000000 /* Reserved for scheduler private use */\n#define\tTDF_ALRMPEND\t0x10000000 /* Pending SIGVTALRM needs to be posted. */\n#define\tTDF_PROFPEND\t0x20000000 /* Pending SIGPROF needs to be posted. */\n#define\tTDF_MACPEND\t0x40000000 /* AST-based MAC event pending. */\n\n/* Userland debug flags */\n#define\tTDB_SUSPEND\t0x00000001 /* Thread is suspended by debugger */\n#define\tTDB_XSIG\t0x00000002 /* Thread is exchanging signal under trace */\n#define\tTDB_USERWR\t0x00000004 /* Debugger modified memory or registers */\n#define\tTDB_SCE\t\t0x00000008 /* Thread performs syscall enter */\n#define\tTDB_SCX\t\t0x00000010 /* Thread performs syscall exit */\n#define\tTDB_EXEC\t0x00000020 /* TDB_SCX from exec(2) family */\n#define\tTDB_FORK\t0x00000040 /* TDB_SCX from fork(2) that created new\n\t\t\t\t      process */\n#define\tTDB_STOPATFORK\t0x00000080 /* Stop at the return from fork (child\n\t\t\t\t      only) */\n\n/*\n * \"Private\" flags kept in td_pflags:\n * These are only written by curthread and thus need no locking.\n */\n#define\tTDP_OLDMASK\t0x00000001 /* Need to restore mask after suspend. */\n#define\tTDP_INKTR\t0x00000002 /* Thread is currently in KTR code. */\n#define\tTDP_INKTRACE\t0x00000004 /* Thread is currently in KTRACE code. */\n#define\tTDP_BUFNEED\t0x00000008 /* Do not recurse into the buf flush */\n#define\tTDP_COWINPROGRESS 0x00000010 /* Snapshot copy-on-write in progress. */\n#define\tTDP_ALTSTACK\t0x00000020 /* Have alternate signal stack. */\n#define\tTDP_DEADLKTREAT\t0x00000040 /* Lock aquisition - deadlock treatment. */\n#define\tTDP_NOFAULTING\t0x00000080 /* Do not handle page faults. */\n#define\tTDP_NOSLEEPING\t0x00000100 /* Thread is not allowed to sleep on a sq. */\n#define\tTDP_OWEUPC\t0x00000200 /* Call addupc() at next AST. */\n#define\tTDP_ITHREAD\t0x00000400 /* Thread is an interrupt thread. */\n#define\tTDP_UNUSED800\t0x00000800 /* available. */\n#define\tTDP_SCHED1\t0x00001000 /* Reserved for scheduler private use */\n#define\tTDP_SCHED2\t0x00002000 /* Reserved for scheduler private use */\n#define\tTDP_SCHED3\t0x00004000 /* Reserved for scheduler private use */\n#define\tTDP_SCHED4\t0x00008000 /* Reserved for scheduler private use */\n#define\tTDP_GEOM\t0x00010000 /* Settle GEOM before finishing syscall */\n#define\tTDP_SOFTDEP\t0x00020000 /* Stuck processing softdep worklist */\n#define\tTDP_NORUNNINGBUF 0x00040000 /* Ignore runningbufspace check */\n#define\tTDP_WAKEUP\t0x00080000 /* Don't sleep in umtx cond_wait */\n#define\tTDP_INBDFLUSH\t0x00100000 /* Already in BO_BDFLUSH, do not recurse */\n#define\tTDP_KTHREAD\t0x00200000 /* This is an official kernel thread */\n#define\tTDP_CALLCHAIN\t0x00400000 /* Capture thread's callchain */\n#define\tTDP_IGNSUSP\t0x00800000 /* Permission to ignore the MNTK_SUSPEND* */\n#define\tTDP_AUDITREC\t0x01000000 /* Audit record pending on thread */\n\n/*\n * Reasons that the current thread can not be run yet.\n * More than one may apply.\n */\n#define\tTDI_SUSPENDED\t0x0001\t/* On suspension queue. */\n#define\tTDI_SLEEPING\t0x0002\t/* Actually asleep! (tricky). */\n#define\tTDI_SWAPPED\t0x0004\t/* Stack not in mem.  Bad juju if run. */\n#define\tTDI_LOCK\t0x0008\t/* Stopped on a lock. */\n#define\tTDI_IWAIT\t0x0010\t/* Awaiting interrupt. */\n\n#define\tTD_IS_SLEEPING(td)\t((td)->td_inhibitors & TDI_SLEEPING)\n#define\tTD_ON_SLEEPQ(td)\t((td)->td_wchan != NULL)\n#define\tTD_IS_SUSPENDED(td)\t((td)->td_inhibitors & TDI_SUSPENDED)\n#define\tTD_IS_SWAPPED(td)\t((td)->td_inhibitors & TDI_SWAPPED)\n#define\tTD_ON_LOCK(td)\t\t((td)->td_inhibitors & TDI_LOCK)\n#define\tTD_AWAITING_INTR(td)\t((td)->td_inhibitors & TDI_IWAIT)\n#define\tTD_IS_RUNNING(td)\t((td)->td_state == TDS_RUNNING)\n#define\tTD_ON_RUNQ(td)\t\t((td)->td_state == TDS_RUNQ)\n#define\tTD_CAN_RUN(td)\t\t((td)->td_state == TDS_CAN_RUN)\n#define\tTD_IS_INHIBITED(td)\t((td)->td_state == TDS_INHIBITED)\n#define\tTD_ON_UPILOCK(td)\t((td)->td_flags & TDF_UPIBLOCKED)\n#define TD_IS_IDLETHREAD(td)\t((td)->td_flags & TDF_IDLETD)\n\n\n#define\tTD_SET_INHIB(td, inhib) do {\t\t\t\\\n\t(td)->td_state = TDS_INHIBITED;\t\t\t\\\n\t(td)->td_inhibitors |= (inhib);\t\t\t\\\n} while (0)\n\n#define\tTD_CLR_INHIB(td, inhib) do {\t\t\t\\\n\tif (((td)->td_inhibitors & (inhib)) &&\t\t\\\n\t    (((td)->td_inhibitors &= ~(inhib)) == 0))\t\\\n\t\t(td)->td_state = TDS_CAN_RUN;\t\t\\\n} while (0)\n\n#define\tTD_SET_SLEEPING(td)\tTD_SET_INHIB((td), TDI_SLEEPING)\n#define\tTD_SET_SWAPPED(td)\tTD_SET_INHIB((td), TDI_SWAPPED)\n#define\tTD_SET_LOCK(td)\t\tTD_SET_INHIB((td), TDI_LOCK)\n#define\tTD_SET_SUSPENDED(td)\tTD_SET_INHIB((td), TDI_SUSPENDED)\n#define\tTD_SET_IWAIT(td)\tTD_SET_INHIB((td), TDI_IWAIT)\n#define\tTD_SET_EXITING(td)\tTD_SET_INHIB((td), TDI_EXITING)\n\n#define\tTD_CLR_SLEEPING(td)\tTD_CLR_INHIB((td), TDI_SLEEPING)\n#define\tTD_CLR_SWAPPED(td)\tTD_CLR_INHIB((td), TDI_SWAPPED)\n#define\tTD_CLR_LOCK(td)\t\tTD_CLR_INHIB((td), TDI_LOCK)\n#define\tTD_CLR_SUSPENDED(td)\tTD_CLR_INHIB((td), TDI_SUSPENDED)\n#define\tTD_CLR_IWAIT(td)\tTD_CLR_INHIB((td), TDI_IWAIT)\n\n#define\tTD_SET_RUNNING(td)\t(td)->td_state = TDS_RUNNING\n#define\tTD_SET_RUNQ(td)\t\t(td)->td_state = TDS_RUNQ\n#define\tTD_SET_CAN_RUN(td)\t(td)->td_state = TDS_CAN_RUN\n\n/*\n * Process structure.\n */\nstruct proc {\n\tLIST_ENTRY(proc) p_list;\t/* (d) List of all processes. */\n\tTAILQ_HEAD(, thread) p_threads;\t/* (c) all threads. */\n\tstruct mtx\tp_slock;\t/* process spin lock */\n\tstruct ucred\t*p_ucred;\t/* (c) Process owner's identity. */\n\tstruct filedesc\t*p_fd;\t\t/* (b) Open files. */\n\tstruct filedesc_to_leader *p_fdtol; /* (b) Tracking node */\n\tstruct pstats\t*p_stats;\t/* (b) Accounting/statistics (CPU). */\n\tstruct plimit\t*p_limit;\t/* (c) Process limits. */\n\tstruct callout\tp_limco;\t/* (c) Limit callout handle */\n\tstruct sigacts\t*p_sigacts;\t/* (x) Signal actions, state (CPU). */\n\n\t/*\n\t * The following don't make too much sense.\n\t * See the td_ or ke_ versions of the same flags.\n\t */\n\tint\t\tp_flag;\t\t/* (c) P_* flags. */\n\tenum {\n\t\tPRS_NEW = 0,\t\t/* In creation */\n\t\tPRS_NORMAL,\t\t/* threads can be run. */\n\t\tPRS_ZOMBIE\n\t} p_state;\t\t\t/* (j/c) Process status. */\n\tpid_t\t\tp_pid;\t\t/* (b) Process identifier. */\n\tLIST_ENTRY(proc) p_hash;\t/* (d) Hash chain. */\n\tLIST_ENTRY(proc) p_pglist;\t/* (g + e) List of processes in pgrp. */\n\tstruct proc\t*p_pptr;\t/* (c + e) Pointer to parent process. */\n\tLIST_ENTRY(proc) p_sibling;\t/* (e) List of sibling processes. */\n\tLIST_HEAD(, proc) p_children;\t/* (e) Pointer to list of children. */\n\tstruct mtx\tp_mtx;\t\t/* (n) Lock for this struct. */\n\tstruct ksiginfo *p_ksi;\t/* Locked by parent proc lock */\n\tsigqueue_t\tp_sigqueue;\t/* (c) Sigs not delivered to a td. */\n#define p_siglist\tp_sigqueue.sq_signals\n\n/* The following fields are all zeroed upon creation in fork. */\n#define\tp_startzero\tp_oppid\n\tpid_t\t\tp_oppid;\t/* (c + e) Save ppid in ptrace. XXX */\n\tint\t\tp_dbg_child;\t/* (c + e) # of debugged children in\n\t\t\t\t\t\t\tptrace. */\n\tstruct vmspace\t*p_vmspace;\t/* (b) Address space. */\n\tu_int\t\tp_swtick;\t/* (c) Tick when swapped in or out. */\n\tstruct itimerval p_realtimer;\t/* (c) Alarm timer. */\n\tstruct rusage\tp_ru;\t\t/* (a) Exit information. */\n\tstruct rusage_ext p_rux;\t/* (cj) Internal resource usage. */\n\tstruct rusage_ext p_crux;\t/* (c) Internal child resource usage. */\n\tint\t\tp_profthreads;\t/* (c) Num threads in addupc_task. */\n\tvolatile int\tp_exitthreads;\t/* (j) Number of threads exiting */\n\tint\t\tp_traceflag;\t/* (o) Kernel trace points. */\n\tstruct vnode\t*p_tracevp;\t/* (c + o) Trace to vnode. */\n\tstruct ucred\t*p_tracecred;\t/* (o) Credentials to trace with. */\n\tstruct vnode\t*p_textvp;\t/* (b) Vnode of executable. */\n\tu_int\t\tp_lock;\t\t/* (c) Proclock (prevent swap) count. */\n\tstruct sigiolst\tp_sigiolst;\t/* (c) List of sigio sources. */\n\tint\t\tp_sigparent;\t/* (c) Signal to parent on exit. */\n\tint\t\tp_sig;\t\t/* (n) For core dump/debugger XXX. */\n\tu_long\t\tp_code;\t\t/* (n) For core dump/debugger XXX. */\n\tu_int\t\tp_stops;\t/* (c) Stop event bitmask. */\n\tu_int\t\tp_stype;\t/* (c) Stop event type. */\n\tchar\t\tp_step;\t\t/* (c) Process is stopped. */\n\tu_char\t\tp_pfsflags;\t/* (c) Procfs flags. */\n\tstruct nlminfo\t*p_nlminfo;\t/* (?) Only used by/for lockd. */\n\tstruct kaioinfo\t*p_aioinfo;\t/* (y) ASYNC I/O info. */\n\tstruct thread\t*p_singlethread;/* (c + j) If single threading this is it */\n\tint\t\tp_suspcount;\t/* (j) Num threads in suspended mode. */\n\tstruct thread\t*p_xthread;\t/* (c) Trap thread */\n\tint\t\tp_boundary_count;/* (j) Num threads at user boundary */\n\tint\t\tp_pendingcnt;\t/* how many signals are pending */\n\tstruct itimers\t*p_itimers;\t/* (c) POSIX interval timers. */\n\tstruct procdesc\t*p_procdesc;\t/* (e) Process descriptor, if any. */\n/* End area that is zeroed on creation. */\n#define\tp_endzero\tp_magic\n\n/* The following fields are all copied upon creation in fork. */\n#define\tp_startcopy\tp_endzero\n\tu_int\t\tp_magic;\t/* (b) Magic number. */\n\tint\t\tp_osrel;\t/* (x) osreldate for the\n\t\t\t\t\t       binary (from ELF note, if any) */\n\tchar\t\tp_comm[MAXCOMLEN + 1];\t/* (b) Process name. */\n\tstruct pgrp\t*p_pgrp;\t/* (c + e) Pointer to process group. */\n\tstruct sysentvec *p_sysent;\t/* (b) Syscall dispatch info. */\n\tstruct pargs\t*p_args;\t/* (c) Process arguments. */\n\trlim_t\t\tp_cpulimit;\t/* (c) Current CPU limit in seconds. */\n\tsigned char\tp_nice;\t\t/* (c) Process \"nice\" value. */\n\tint\t\tp_fibnum;\t/* in this routing domain XXX MRT */\n/* End area that is copied on creation. */\n#define\tp_endcopy\tp_xstat\n\n\tu_short\t\tp_xstat;\t/* (c) Exit status; also stop sig. */\n\tstruct knlist\tp_klist;\t/* (c) Knotes attached to this proc. */\n\tint\t\tp_numthreads;\t/* (c) Number of threads. */\n\tstruct mdproc\tp_md;\t\t/* Any machine-dependent fields. */\n\tstruct callout\tp_itcallout;\t/* (h + c) Interval timer callout. */\n\tu_short\t\tp_acflag;\t/* (c) Accounting flags. */\n\tstruct proc\t*p_peers;\t/* (r) */\n\tstruct proc\t*p_leader;\t/* (b) */\n\tvoid\t\t*p_emuldata;\t/* (c) Emulator state data. */\n\tstruct label\t*p_label;\t/* (*) Proc (not subject) MAC label. */\n\tstruct p_sched\t*p_sched;\t/* (*) Scheduler-specific data. */\n\tSTAILQ_HEAD(, ktr_request)\tp_ktr;\t/* (o) KTR event queue. */\n\tLIST_HEAD(, mqueue_notifier)\tp_mqnotifier; /* (c) mqueue notifiers.*/\n\tstruct kdtrace_proc\t*p_dtrace; /* (*) DTrace-specific data. */\n\tstruct cv\tp_pwait;\t/* (*) wait cv for exit/exec. */\n\tstruct cv\tp_dbgwait;\t/* (*) wait cv for debugger attach\n\t\t\t\t\t   after fork. */\n\tuint64_t\tp_prev_runtime;\t/* (c) Resource usage accounting. */\n\tstruct racct\t*p_racct;\t/* (b) Resource accounting. */\n};\n\n#define\tp_session\tp_pgrp->pg_session\n#define\tp_pgid\t\tp_pgrp->pg_id\n\n#define\tNOCPU\t0xff\t\t/* For when we aren't on a CPU. */\n\n#define\tPROC_SLOCK(p)\tmtx_lock_spin(&(p)->p_slock)\n#define\tPROC_SUNLOCK(p)\tmtx_unlock_spin(&(p)->p_slock)\n#define\tPROC_SLOCK_ASSERT(p, type)\tmtx_assert(&(p)->p_slock, (type))\n\n/* These flags are kept in p_flag. */\n#define\tP_ADVLOCK\t0x00001\t/* Process may hold a POSIX advisory lock. */\n#define\tP_CONTROLT\t0x00002\t/* Has a controlling terminal. */\n#define\tP_KTHREAD\t0x00004\t/* Kernel thread (*). */\n#define\tP_FOLLOWFORK\t0x00008\t/* Attach parent debugger to children. */\n#define\tP_PPWAIT\t0x00010\t/* Parent is waiting for child to exec/exit. */\n#define\tP_PROFIL\t0x00020\t/* Has started profiling. */\n#define\tP_STOPPROF\t0x00040\t/* Has thread requesting to stop profiling. */\n#define\tP_HADTHREADS\t0x00080\t/* Has had threads (no cleanup shortcuts) */\n#define\tP_SUGID\t\t0x00100\t/* Had set id privileges since last exec. */\n#define\tP_SYSTEM\t0x00200\t/* System proc: no sigs, stats or swapping. */\n#define\tP_SINGLE_EXIT\t0x00400\t/* Threads suspending should exit, not wait. */\n#define\tP_TRACED\t0x00800\t/* Debugged process being traced. */\n#define\tP_WAITED\t0x01000\t/* Someone is waiting for us. */\n#define\tP_WEXIT\t\t0x02000\t/* Working on exiting. */\n#define\tP_EXEC\t\t0x04000\t/* Process called exec. */\n#define\tP_WKILLED\t0x08000\t/* Killed, go to kernel/user boundary ASAP. */\n#define\tP_CONTINUED\t0x10000\t/* Proc has continued from a stopped state. */\n#define\tP_STOPPED_SIG\t0x20000\t/* Stopped due to SIGSTOP/SIGTSTP. */\n#define\tP_STOPPED_TRACE\t0x40000\t/* Stopped because of tracing. */\n#define\tP_STOPPED_SINGLE 0x80000 /* Only 1 thread can continue (not to user). */\n#define\tP_PROTECTED\t0x100000 /* Do not kill on memory overcommit. */\n#define\tP_SIGEVENT\t0x200000 /* Process pending signals changed. */\n#define\tP_SINGLE_BOUNDARY 0x400000 /* Threads should suspend at user boundary. */\n#define\tP_HWPMC\t\t0x800000 /* Process is using HWPMCs */\n\n#define\tP_JAILED\t0x1000000 /* Process is in jail. */\n#define\tP_INEXEC\t0x4000000 /* Process is in execve(). */\n#define\tP_STATCHILD\t0x8000000 /* Child process stopped or exited. */\n#define\tP_INMEM\t\t0x10000000 /* Loaded into memory. */\n#define\tP_SWAPPINGOUT\t0x20000000 /* Process is being swapped out. */\n#define\tP_SWAPPINGIN\t0x40000000 /* Process is being swapped in. */\n\n#define\tP_STOPPED\t(P_STOPPED_SIG|P_STOPPED_SINGLE|P_STOPPED_TRACE)\n#define\tP_SHOULDSTOP(p)\t((p)->p_flag & P_STOPPED)\n#define\tP_KILLED(p)\t((p)->p_flag & P_WKILLED)\n\n/*\n * These were process status values (p_stat), now they are only used in\n * legacy conversion code.\n */\n#define\tSIDL\t1\t\t/* Process being created by fork. */\n#define\tSRUN\t2\t\t/* Currently runnable. */\n#define\tSSLEEP\t3\t\t/* Sleeping on an address. */\n#define\tSSTOP\t4\t\t/* Process debugging or suspension. */\n#define\tSZOMB\t5\t\t/* Awaiting collection by parent. */\n#define\tSWAIT\t6\t\t/* Waiting for interrupt. */\n#define\tSLOCK\t7\t\t/* Blocked on a lock. */\n\n#define\tP_MAGIC\t\t0xbeefface\n\n#ifdef _KERNEL\n\n/* Types and flags for mi_switch(). */\n#define\tSW_TYPE_MASK\t\t0xff\t/* First 8 bits are switch type */\n#define\tSWT_NONE\t\t0\t/* Unspecified switch. */\n#define\tSWT_PREEMPT\t\t1\t/* Switching due to preemption. */\n#define\tSWT_OWEPREEMPT\t\t2\t/* Switching due to opepreempt. */\n#define\tSWT_TURNSTILE\t\t3\t/* Turnstile contention. */\n#define\tSWT_SLEEPQ\t\t4\t/* Sleepq wait. */\n#define\tSWT_SLEEPQTIMO\t\t5\t/* Sleepq timeout wait. */\n#define\tSWT_RELINQUISH\t\t6\t/* yield call. */\n#define\tSWT_NEEDRESCHED\t\t7\t/* NEEDRESCHED was set. */\n#define\tSWT_IDLE\t\t8\t/* Switching from the idle thread. */\n#define\tSWT_IWAIT\t\t9\t/* Waiting for interrupts. */\n#define\tSWT_SUSPEND\t\t10\t/* Thread suspended. */\n#define\tSWT_REMOTEPREEMPT\t11\t/* Remote processor preempted. */\n#define\tSWT_REMOTEWAKEIDLE\t12\t/* Remote processor preempted idle. */\n#define\tSWT_COUNT\t\t13\t/* Number of switch types. */\n/* Flags */\n#define\tSW_VOL\t\t0x0100\t\t/* Voluntary switch. */\n#define\tSW_INVOL\t0x0200\t\t/* Involuntary switch. */\n#define SW_PREEMPT\t0x0400\t\t/* The invol switch is a preemption */\n\n/* How values for thread_single(). */\n#define\tSINGLE_NO_EXIT\t0\n#define\tSINGLE_EXIT\t1\n#define\tSINGLE_BOUNDARY\t2\n\n#ifdef MALLOC_DECLARE\nMALLOC_DECLARE(M_PARGS);\nMALLOC_DECLARE(M_PGRP);\nMALLOC_DECLARE(M_SESSION);\nMALLOC_DECLARE(M_SUBPROC);\n#endif\n\n#define\tFOREACH_PROC_IN_SYSTEM(p)\t\t\t\t\t\\\n\tLIST_FOREACH((p), &allproc, p_list)\n#define\tFOREACH_THREAD_IN_PROC(p, td)\t\t\t\t\t\\\n\tTAILQ_FOREACH((td), &(p)->p_threads, td_plist)\n\n#define\tFIRST_THREAD_IN_PROC(p)\tTAILQ_FIRST(&(p)->p_threads)\n\n/*\n * We use process IDs <= PID_MAX; PID_MAX + 1 must also fit in a pid_t,\n * as it is used to represent \"no process group\".\n */\n#define\tPID_MAX\t\t99999\n#define\tNO_PID\t\t100000\n\n#define\tSESS_LEADER(p)\t((p)->p_session->s_leader == (p))\n\n\n#define\tSTOPEVENT(p, e, v) do {\t\t\t\t\t\t\\\n\tif ((p)->p_stops & (e))\t{\t\t\t\t\t\\\n\t\tPROC_LOCK(p);\t\t\t\t\t\t\\\n\t\tstopevent((p), (e), (v));\t\t\t\t\\\n\t\tPROC_UNLOCK(p);\t\t\t\t\t\t\\\n\t}\t\t\t\t\t\t\t\t\\\n} while (0)\n#define\t_STOPEVENT(p, e, v) do {\t\t\t\t\t\\\n\tPROC_LOCK_ASSERT(p, MA_OWNED);\t\t\t\t\t\\\n\tWITNESS_WARN(WARN_GIANTOK | WARN_SLEEPOK, &p->p_mtx.lock_object, \\\n \t    \"checking stopevent %d\", (e));\t\t\t\t\\\n\tif ((p)->p_stops & (e))\t\t\t\t\t\t\\\n\t\tstopevent((p), (e), (v));\t\t\t\t\\\n} while (0)\n\n/* Lock and unlock a process. */\n#define\tPROC_LOCK(p)\tmtx_lock(&(p)->p_mtx)\n#define\tPROC_TRYLOCK(p)\tmtx_trylock(&(p)->p_mtx)\n#define\tPROC_UNLOCK(p)\tmtx_unlock(&(p)->p_mtx)\n#define\tPROC_LOCKED(p)\tmtx_owned(&(p)->p_mtx)\n#define\tPROC_LOCK_ASSERT(p, type)\tmtx_assert(&(p)->p_mtx, (type))\n\n/* Lock and unlock a process group. */\n#define\tPGRP_LOCK(pg)\tmtx_lock(&(pg)->pg_mtx)\n#define\tPGRP_UNLOCK(pg)\tmtx_unlock(&(pg)->pg_mtx)\n#define\tPGRP_LOCKED(pg)\tmtx_owned(&(pg)->pg_mtx)\n#define\tPGRP_LOCK_ASSERT(pg, type)\tmtx_assert(&(pg)->pg_mtx, (type))\n\n#define\tPGRP_LOCK_PGSIGNAL(pg) do {\t\t\t\t\t\\\n\tif ((pg) != NULL)\t\t\t\t\t\t\\\n\t\tPGRP_LOCK(pg);\t\t\t\t\t\t\\\n} while (0)\n#define\tPGRP_UNLOCK_PGSIGNAL(pg) do {\t\t\t\t\t\\\n\tif ((pg) != NULL)\t\t\t\t\t\t\\\n\t\tPGRP_UNLOCK(pg);\t\t\t\t\t\\\n} while (0)\n\n/* Lock and unlock a session. */\n#define\tSESS_LOCK(s)\tmtx_lock(&(s)->s_mtx)\n#define\tSESS_UNLOCK(s)\tmtx_unlock(&(s)->s_mtx)\n#define\tSESS_LOCKED(s)\tmtx_owned(&(s)->s_mtx)\n#define\tSESS_LOCK_ASSERT(s, type)\tmtx_assert(&(s)->s_mtx, (type))\n\n/* Hold process U-area in memory, normally for ptrace/procfs work. */\n#define\tPHOLD(p) do {\t\t\t\t\t\t\t\\\n\tPROC_LOCK(p);\t\t\t\t\t\t\t\\\n\t_PHOLD(p);\t\t\t\t\t\t\t\\\n\tPROC_UNLOCK(p);\t\t\t\t\t\t\t\\\n} while (0)\n#define\t_PHOLD(p) do {\t\t\t\t\t\t\t\\\n\tPROC_LOCK_ASSERT((p), MA_OWNED);\t\t\t\t\\\n\tKASSERT(!((p)->p_flag & P_WEXIT) || (p) == curproc,\t\t\\\n\t    (\"PHOLD of exiting process\"));\t\t\t\t\\\n\t(p)->p_lock++;\t\t\t\t\t\t\t\\\n\tif (((p)->p_flag & P_INMEM) == 0)\t\t\t\t\\\n\t\tfaultin((p));\t\t\t\t\t\t\\\n} while (0)\n#define PROC_ASSERT_HELD(p) do {\t\t\t\t\t\\\n\tKASSERT((p)->p_lock > 0, (\"process not held\"));\t\t\t\\\n} while (0)\n\n#define\tPRELE(p) do {\t\t\t\t\t\t\t\\\n\tPROC_LOCK((p));\t\t\t\t\t\t\t\\\n\t_PRELE((p));\t\t\t\t\t\t\t\\\n\tPROC_UNLOCK((p));\t\t\t\t\t\t\\\n} while (0)\n#define\t_PRELE(p) do {\t\t\t\t\t\t\t\\\n\tPROC_LOCK_ASSERT((p), MA_OWNED);\t\t\t\t\\\n\t(--(p)->p_lock);\t\t\t\t\t\t\\\n\tif (((p)->p_flag & P_WEXIT) && (p)->p_lock == 0)\t\t\\\n\t\twakeup(&(p)->p_lock);\t\t\t\t\t\\\n} while (0)\n#define PROC_ASSERT_NOT_HELD(p) do {\t\t\t\t\t\\\n\tKASSERT((p)->p_lock == 0, (\"process held\"));\t\t\t\\\n} while (0)\n\n/* Check whether a thread is safe to be swapped out. */\n#define\tthread_safetoswapout(td)\t((td)->td_flags & TDF_CANSWAP)\n\n/* Control whether or not it is safe for curthread to sleep. */\n#define\tTHREAD_NO_SLEEPING() do {\t\t\t\t\t\\\n\tKASSERT(!(curthread->td_pflags & TDP_NOSLEEPING),\t\t\\\n\t    (\"nested no sleeping\"));\t\t\t\t\t\\\n\tcurthread->td_pflags |= TDP_NOSLEEPING;\t\t\t\t\\\n} while (0)\n\n#define\tTHREAD_SLEEPING_OK() do {\t\t\t\t\t\\\n\tKASSERT((curthread->td_pflags & TDP_NOSLEEPING),\t\t\\\n\t    (\"nested sleeping ok\"));\t\t\t\t\t\\\n\tcurthread->td_pflags &= ~TDP_NOSLEEPING;\t\t\t\\\n} while (0)\n\n#define\tPIDHASH(pid)\t(&pidhashtbl[(pid) & pidhash])\nextern LIST_HEAD(pidhashhead, proc) *pidhashtbl;\nextern u_long pidhash;\n#define\tTIDHASH(tid)\t(&tidhashtbl[(tid) & tidhash])\nextern LIST_HEAD(tidhashhead, thread) *tidhashtbl;\nextern u_long tidhash;\nextern struct rwlock tidhash_lock;\n\n#define\tPGRPHASH(pgid)\t(&pgrphashtbl[(pgid) & pgrphash])\nextern LIST_HEAD(pgrphashhead, pgrp) *pgrphashtbl;\nextern u_long pgrphash;\n\nextern struct sx allproc_lock;\nextern struct sx proctree_lock;\nextern struct mtx ppeers_lock;\nextern struct proc proc0;\t\t/* Process slot for swapper. */\nextern struct thread thread0;\t\t/* Primary thread in proc0. */\nextern struct vmspace vmspace0;\t\t/* VM space for proc0. */\nextern int hogticks;\t\t\t/* Limit on kernel cpu hogs. */\nextern int lastpid;\nextern int nprocs, maxproc;\t\t/* Current and max number of procs. */\nextern int maxprocperuid;\t\t/* Max procs per uid. */\nextern u_long ps_arg_cache_limit;\n\nLIST_HEAD(proclist, proc);\nTAILQ_HEAD(procqueue, proc);\nTAILQ_HEAD(threadqueue, thread);\nextern struct proclist allproc;\t\t/* List of all processes. */\nextern struct proclist zombproc;\t/* List of zombie processes. */\nextern struct proc *initproc, *pageproc; /* Process slots for init, pager. */\n\nextern struct uma_zone *proc_zone;\n\nstruct\tproc *pfind(pid_t);\t\t/* Find process by id. */\nstruct\tpgrp *pgfind(pid_t);\t\t/* Find process group by id. */\nstruct\tproc *zpfind(pid_t);\t\t/* Find zombie process by id. */\n\nvoid\tast(struct trapframe *framep);\nstruct\tthread *choosethread(void);\nint\tcr_cansignal(struct ucred *cred, struct proc *proc, int signum);\nint\tenterpgrp(struct proc *p, pid_t pgid, struct pgrp *pgrp,\n\t    struct session *sess);\nint\tenterthispgrp(struct proc *p, struct pgrp *pgrp);\nvoid\tfaultin(struct proc *p);\nvoid\tfixjobc(struct proc *p, struct pgrp *pgrp, int entering);\nint\tfork1(struct thread *, int, int, struct proc **, int *, int);\nvoid\tfork_exit(void (*)(void *, struct trapframe *), void *,\n\t    struct trapframe *);\nvoid\tfork_return(struct thread *, struct trapframe *);\nint\tinferior(struct proc *p);\nvoid\tkern_yield(int);\nvoid \tkick_proc0(void);\nint\tleavepgrp(struct proc *p);\nint\tmaybe_preempt(struct thread *td);\nvoid\tmaybe_yield(void);\nvoid\tmi_switch(int flags, struct thread *newtd);\nint\tp_candebug(struct thread *td, struct proc *p);\nint\tp_cansee(struct thread *td, struct proc *p);\nint\tp_cansched(struct thread *td, struct proc *p);\nint\tp_cansignal(struct thread *td, struct proc *p, int signum);\nint\tp_canwait(struct thread *td, struct proc *p);\nstruct\tpargs *pargs_alloc(int len);\nvoid\tpargs_drop(struct pargs *pa);\nvoid\tpargs_hold(struct pargs *pa);\nvoid\tprocinit(void);\nvoid\tproc_linkup0(struct proc *p, struct thread *td);\nvoid\tproc_linkup(struct proc *p, struct thread *td);\nvoid\tproc_reap(struct thread *td, struct proc *p, int *status, int options,\n\t    struct rusage *rusage);\nvoid\tproc_reparent(struct proc *child, struct proc *newparent);\nstruct\tpstats *pstats_alloc(void);\nvoid\tpstats_fork(struct pstats *src, struct pstats *dst);\nvoid\tpstats_free(struct pstats *ps);\nint\tsecurelevel_ge(struct ucred *cr, int level);\nint\tsecurelevel_gt(struct ucred *cr, int level);\nvoid\tsess_hold(struct session *);\nvoid\tsess_release(struct session *);\nint\tsetrunnable(struct thread *);\nvoid\tsetsugid(struct proc *p);\nint\tshould_yield(void);\nint\tsigonstack(size_t sp);\nvoid\tsleepinit(void);\nvoid\tstopevent(struct proc *, u_int, u_int);\nstruct\tthread *tdfind(lwpid_t, pid_t);\nvoid\tthreadinit(void);\nvoid\ttidhash_add(struct thread *);\nvoid\ttidhash_remove(struct thread *);\nvoid\tcpu_idle(int);\nint\tcpu_idle_wakeup(int);\nextern\tvoid (*cpu_idle_hook)(void);\t/* Hook to machdep CPU idler. */\nvoid\tcpu_switch(struct thread *, struct thread *, struct mtx *);\nvoid\tcpu_throw(struct thread *, struct thread *) __dead2;\nvoid\tunsleep(struct thread *);\nvoid\tuserret(struct thread *, struct trapframe *);\n\nvoid\tcpu_exit(struct thread *);\nvoid\texit1(struct thread *, int) __dead2;\nstruct syscall_args;\nint\tcpu_fetch_syscall_args(struct thread *td, struct syscall_args *sa);\nvoid\tcpu_fork(struct thread *, struct proc *, struct thread *, int);\nvoid\tcpu_set_fork_handler(struct thread *, void (*)(void *), void *);\nvoid\tcpu_set_syscall_retval(struct thread *, int);\nvoid\tcpu_set_upcall(struct thread *td, struct thread *td0);\nvoid\tcpu_set_upcall_kse(struct thread *, void (*)(void *), void *,\n\t    stack_t *);\nint\tcpu_set_user_tls(struct thread *, void *tls_base);\nvoid\tcpu_thread_alloc(struct thread *);\nvoid\tcpu_thread_clean(struct thread *);\nvoid\tcpu_thread_exit(struct thread *);\nvoid\tcpu_thread_free(struct thread *);\nvoid\tcpu_thread_swapin(struct thread *);\nvoid\tcpu_thread_swapout(struct thread *);\nstruct\tthread *thread_alloc(int pages);\nint\tthread_alloc_stack(struct thread *, int pages);\nvoid\tthread_exit(void) __dead2;\nvoid\tthread_free(struct thread *td);\nvoid\tthread_link(struct thread *td, struct proc *p);\nvoid\tthread_reap(void);\nint\tthread_single(int how);\nvoid\tthread_single_end(void);\nvoid\tthread_stash(struct thread *td);\nvoid\tthread_stopped(struct proc *p);\nvoid\tchildproc_stopped(struct proc *child, int reason);\nvoid\tchildproc_continued(struct proc *child);\nvoid\tchildproc_exited(struct proc *child);\nint\tthread_suspend_check(int how);\nvoid\tthread_suspend_switch(struct thread *);\nvoid\tthread_suspend_one(struct thread *td);\nvoid\tthread_unlink(struct thread *td);\nvoid\tthread_unsuspend(struct proc *p);\nint\tthread_unsuspend_one(struct thread *td);\nvoid\tthread_unthread(struct thread *td);\nvoid\tthread_wait(struct proc *p);\nstruct thread\t*thread_find(struct proc *p, lwpid_t tid);\n\nstatic __inline int\ncurthread_pflags_set(int flags)\n{\n\tstruct thread *td;\n\tint save;\n\n\ttd = curthread;\n\tsave = ~flags | (td->td_pflags & flags);\n\ttd->td_pflags |= flags;\n\treturn (save);\n}\n\nstatic __inline void\ncurthread_pflags_restore(int save)\n{\n\n\tcurthread->td_pflags &= save;\n}\n\n#endif\t/* _KERNEL */\n\n#endif\t/* !_SYS_PROC_H_ */\n"
  },
  {
    "path": "freebsd-headers/sys/procdesc.h",
    "content": "/*-\n * Copyright (c) 2009 Robert N. M. Watson\n * All rights reserved.\n *\n * This software was developed at the University of Cambridge Computer\n * Laboratory with support from a grant from Google, Inc.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/sys/procdesc.h 224987 2011-08-18 22:51:30Z jonathan $\n */\n\n#ifndef _SYS_PROCDESC_H_\n#define\t_SYS_PROCDESC_H_\n\n#ifdef _KERNEL\n#include <sys/selinfo.h>\t/* struct selinfo */\n#include <sys/_lock.h>\n#include <sys/_mutex.h>\n\n/*-\n * struct procdesc describes a process descriptor, and essentially consists\n * of two pointers -- one to the file descriptor, and one to the process.\n * When both become NULL, the process descriptor will be freed.  An important\n * invariant is that there is only ever one process descriptor for a process,\n * so a single file pointer will suffice.\n *\n * Locking key:\n * (c) - Constant after initial setup.\n * (p) - Protected by the process descriptor mutex.\n * (r) - Atomic eference count.\n * (s) - Protected by selinfo.\n * (t) - Protected by the proctree_lock\n */\nstruct proc;\nstruct sigio;\nstruct procdesc {\n\t/*\n\t * Basic process descriptor state: the process, a cache of its pid to\n\t * satisfy queries after the process exits, and process descriptor\n\t * refcount.\n\t */\n\tstruct proc\t*pd_proc;\t\t/* (t) Process. */\n\tpid_t\t\t pd_pid;\t\t/* (c) Cached pid. */\n\tu_int\t\t pd_refcount;\t\t/* (r) Reference count. */\n\n\t/*\n\t * In-flight data and notification of events.\n\t */\n\tint\t\t pd_flags;\t\t/* (p) PD_ flags. */\n\tstruct selinfo\t pd_selinfo;\t\t/* (p) Event notification. */\n\tstruct mtx\t pd_lock;\t\t/* Protect data + events. */\n};\n\n/*\n * Locking macros for the procdesc itself.\n */\n#define\tPROCDESC_LOCK_DESTROY(pd)\tmtx_destroy(&(pd)->pd_lock)\n#define\tPROCDESC_LOCK_INIT(pd)\tmtx_init(&(pd)->pd_lock, \"procdesc\", NULL, \\\n\t\t\t\t    MTX_DEF)\n#define\tPROCDESC_LOCK(pd)\tmtx_lock(&(pd)->pd_lock)\n#define\tPROCDESC_UNLOCK(pd)\tmtx_unlock(&(pd)->pd_lock)\n\n/*\n * Flags for the pd_flags field.\n */\n#define\tPDF_CLOSED\t0x00000001\t/* Descriptor has closed. */\n#define\tPDF_SELECTED\t0x00000002\t/* Issue selwakeup(). */\n#define\tPDF_EXITED\t0x00000004\t/* Process exited. */\n#define\tPDF_DAEMON\t0x00000008\t/* Don't exit when procdesc closes. */\n\n/*\n * In-kernel interfaces to process descriptors.\n */\nint\t procdesc_exit(struct proc *);\nint\t procdesc_find(struct thread *, int fd, cap_rights_t, struct proc **);\nint\t kern_pdgetpid(struct thread *, int fd, cap_rights_t, pid_t *pidp);\nvoid\t procdesc_new(struct proc *, int);\nvoid\t procdesc_finit(struct procdesc *, struct file *);\npid_t\t procdesc_pid(struct file *);\nvoid\t procdesc_reap(struct proc *);\n\n#else /* !_KERNEL */\n\n/*\n * Process descriptor system calls.\n */\nstruct rusage;\nint\t pdfork(int *, int);\nint\t pdkill(int, int);\nint\t pdgetpid(int, pid_t *);\n\n#endif /* _KERNEL */\n\n/*\n * Flags which can be passed to pdfork(2).\n */\n#define\tPD_DAEMON\t0x00000001\t/* Don't exit when procdesc closes. */\n\n#endif /* !_SYS_PROCDESC_H_ */\n"
  },
  {
    "path": "freebsd-headers/sys/procfs.h",
    "content": "/*-\n * Copyright (c) 1998 John D. Polstra.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/sys/procfs.h 215679 2010-11-22 14:42:13Z attilio $\n */\n\n#ifndef _SYS_PROCFS_H_\n#define _SYS_PROCFS_H_\n\n#include <sys/param.h>\n#include <machine/reg.h>\n\ntypedef struct reg gregset_t;\ntypedef struct fpreg fpregset_t;\n\n/*\n * These structures define an interface between core files and the debugger.\n * Never change or delete any elements.  If you add elements, add them to\n * the end of the structure, and increment the value of its version field.\n * This will help to ensure that today's core dump will still be usable\n * with next year's debugger.\n *\n * A lot more things should be added to these structures.  At present,\n * they contain the absolute bare minimum required to allow GDB to work\n * with ELF core dumps.\n */\n\n/*\n * The parenthsized numbers like (1) indicate the minimum version number\n * for which each element exists in the structure.\n */\n\n#define PRSTATUS_VERSION\t1\t/* Current version of prstatus_t */\n\ntypedef struct prstatus {\n    int\t\tpr_version;\t/* Version number of struct (1) */\n    size_t\tpr_statussz;\t/* sizeof(prstatus_t) (1) */\n    size_t\tpr_gregsetsz;\t/* sizeof(gregset_t) (1) */\n    size_t\tpr_fpregsetsz;\t/* sizeof(fpregset_t) (1) */\n    int\t\tpr_osreldate;\t/* Kernel version (1) */\n    int\t\tpr_cursig;\t/* Current signal (1) */\n    pid_t\tpr_pid;\t\t/* Process ID (1) */\n    gregset_t\tpr_reg;\t\t/* General purpose registers (1) */\n} prstatus_t;\n\ntypedef gregset_t prgregset_t[1];\ntypedef fpregset_t prfpregset_t;\n\n#define PRFNAMESZ\t16\t/* Maximum command length saved */\n#define PRARGSZ\t\t80\t/* Maximum argument bytes saved */\n\n#define PRPSINFO_VERSION\t1\t/* Current version of prpsinfo_t */\n\ntypedef struct prpsinfo {\n    int\t\tpr_version;\t/* Version number of struct (1) */\n    size_t\tpr_psinfosz;\t/* sizeof(prpsinfo_t) (1) */\n    char\tpr_fname[PRFNAMESZ+1];\t/* Command name, null terminated (1) */\n    char\tpr_psargs[PRARGSZ+1];\t/* Arguments, null terminated (1) */\n} prpsinfo_t;\n\n#define THRMISC_VERSION\t\t1\t/* Current version of thrmisc_t */\n\ntypedef struct thrmisc {\n    char\tpr_tname[MAXCOMLEN+1];\t/* Thread name, null terminated (1) */\n    u_int\t_pad;\t\t\t/* Convenience pad, 0-filled (1) */\n} thrmisc_t;\n\ntypedef uint64_t psaddr_t;\t/* An address in the target process. */\n\n#endif /* _SYS_PROCFS_H_ */\n"
  },
  {
    "path": "freebsd-headers/sys/protosw.h",
    "content": "/*-\n * Copyright (c) 1982, 1986, 1993\n *\tThe Regents of the University of California.  All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 4. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t@(#)protosw.h\t8.1 (Berkeley) 6/2/93\n * $FreeBSD: release/9.0.0/sys/sys/protosw.h 193731 2009-06-08 17:15:40Z zec $\n */\n\n#ifndef _SYS_PROTOSW_H_\n#define _SYS_PROTOSW_H_\n\n/* Forward declare these structures referenced from prototypes below. */\nstruct mbuf;\nstruct thread;\nstruct sockaddr;\nstruct socket;\nstruct sockopt;\n\n/*#ifdef _KERNEL*/\n/*\n * Protocol switch table.\n *\n * Each protocol has a handle initializing one of these structures,\n * which is used for protocol-protocol and system-protocol communication.\n *\n * A protocol is called through the pr_init entry before any other.\n * Thereafter it is called every 200ms through the pr_fasttimo entry and\n * every 500ms through the pr_slowtimo for timer based actions.\n * The system will call the pr_drain entry if it is low on space and\n * this should throw away any non-critical data.\n *\n * Protocols pass data between themselves as chains of mbufs using\n * the pr_input and pr_output hooks.  Pr_input passes data up (towards\n * the users) and pr_output passes it down (towards the interfaces); control\n * information passes up and down on pr_ctlinput and pr_ctloutput.\n * The protocol is responsible for the space occupied by any the\n * arguments to these entries and must dispose it.\n *\n * In retrospect, it would be a lot nicer to use an interface\n * similar to the vnode VOP interface.\n */\n/* USE THESE FOR YOUR PROTOTYPES ! */\ntypedef void\tpr_input_t (struct mbuf *, int);\ntypedef int\tpr_input6_t (struct mbuf **, int*, int);  /* XXX FIX THIS */\ntypedef int\tpr_output_t (struct mbuf *, struct socket *);\ntypedef void\tpr_ctlinput_t (int, struct sockaddr *, void *);\ntypedef int\tpr_ctloutput_t (struct socket *, struct sockopt *);\ntypedef\tvoid\tpr_init_t (void);\ntypedef\tvoid\tpr_destroy_t (void);\ntypedef\tvoid\tpr_fasttimo_t (void);\ntypedef\tvoid\tpr_slowtimo_t (void);\ntypedef\tvoid\tpr_drain_t (void);\n\nstruct protosw {\n\tshort\tpr_type;\t\t/* socket type used for */\n\tstruct\tdomain *pr_domain;\t/* domain protocol a member of */\n\tshort\tpr_protocol;\t\t/* protocol number */\n\tshort\tpr_flags;\t\t/* see below */\n/* protocol-protocol hooks */\n\tpr_input_t *pr_input;\t\t/* input to protocol (from below) */\n\tpr_output_t *pr_output;\t\t/* output to protocol (from above) */\n\tpr_ctlinput_t *pr_ctlinput;\t/* control input (from below) */\n\tpr_ctloutput_t *pr_ctloutput;\t/* control output (from above) */\n/* utility hooks */\n\tpr_init_t *pr_init;\n\tpr_destroy_t *pr_destroy;\n\tpr_fasttimo_t *pr_fasttimo;\t/* fast timeout (200ms) */\n\tpr_slowtimo_t *pr_slowtimo;\t/* slow timeout (500ms) */\n\tpr_drain_t *pr_drain;\t\t/* flush any excess space possible */\n\n\tstruct\tpr_usrreqs *pr_usrreqs;\t/* user-protocol hook */\n};\n/*#endif*/\n\n#define\tPR_SLOWHZ\t2\t\t/* 2 slow timeouts per second */\n#define\tPR_FASTHZ\t5\t\t/* 5 fast timeouts per second */\n\n/*\n * This number should be defined again within each protocol family to avoid\n * confusion.\n */\n#define\tPROTO_SPACER\t32767\t\t/* spacer for loadable protocols */\n\n/*\n * Values for pr_flags.\n * PR_ADDR requires PR_ATOMIC;\n * PR_ADDR and PR_CONNREQUIRED are mutually exclusive.\n * PR_IMPLOPCL means that the protocol allows sendto without prior connect,\n *\tand the protocol understands the MSG_EOF flag.  The first property is\n *\tis only relevant if PR_CONNREQUIRED is set (otherwise sendto is allowed\n *\tanyhow).\n */\n#define\tPR_ATOMIC\t0x01\t\t/* exchange atomic messages only */\n#define\tPR_ADDR\t\t0x02\t\t/* addresses given with messages */\n#define\tPR_CONNREQUIRED\t0x04\t\t/* connection required by protocol */\n#define\tPR_WANTRCVD\t0x08\t\t/* want PRU_RCVD calls */\n#define\tPR_RIGHTS\t0x10\t\t/* passes capabilities */\n#define PR_IMPLOPCL\t0x20\t\t/* implied open/close */\n#define\tPR_LASTHDR\t0x40\t\t/* enforce ipsec policy; last header */\n\n/*\n * In earlier BSD network stacks, a single pr_usrreq() function pointer was\n * invoked with an operation number indicating what operation was desired.\n * We now provide individual function pointers which protocols can implement,\n * which offers a number of benefits (such as type checking for arguments).\n * These older constants are still present in order to support TCP debugging.\n */\n#define\tPRU_ATTACH\t\t0\t/* attach protocol to up */\n#define\tPRU_DETACH\t\t1\t/* detach protocol from up */\n#define\tPRU_BIND\t\t2\t/* bind socket to address */\n#define\tPRU_LISTEN\t\t3\t/* listen for connection */\n#define\tPRU_CONNECT\t\t4\t/* establish connection to peer */\n#define\tPRU_ACCEPT\t\t5\t/* accept connection from peer */\n#define\tPRU_DISCONNECT\t\t6\t/* disconnect from peer */\n#define\tPRU_SHUTDOWN\t\t7\t/* won't send any more data */\n#define\tPRU_RCVD\t\t8\t/* have taken data; more room now */\n#define\tPRU_SEND\t\t9\t/* send this data */\n#define\tPRU_ABORT\t\t10\t/* abort (fast DISCONNECT, DETATCH) */\n#define\tPRU_CONTROL\t\t11\t/* control operations on protocol */\n#define\tPRU_SENSE\t\t12\t/* return status into m */\n#define\tPRU_RCVOOB\t\t13\t/* retrieve out of band data */\n#define\tPRU_SENDOOB\t\t14\t/* send out of band data */\n#define\tPRU_SOCKADDR\t\t15\t/* fetch socket's address */\n#define\tPRU_PEERADDR\t\t16\t/* fetch peer's address */\n#define\tPRU_CONNECT2\t\t17\t/* connect two sockets */\n/* begin for protocols internal use */\n#define\tPRU_FASTTIMO\t\t18\t/* 200ms timeout */\n#define\tPRU_SLOWTIMO\t\t19\t/* 500ms timeout */\n#define\tPRU_PROTORCV\t\t20\t/* receive from below */\n#define\tPRU_PROTOSEND\t\t21\t/* send to below */\n/* end for protocol's internal use */\n#define PRU_SEND_EOF\t\t22\t/* send and close */\n#define\tPRU_SOSETLABEL\t\t23\t/* MAC label change */\n#define\tPRU_CLOSE\t\t24\t/* socket close */\n#define\tPRU_FLUSH\t\t25\t/* flush the socket */\n#define\tPRU_NREQ\t\t25\n\n#ifdef PRUREQUESTS\nconst char *prurequests[] = {\n\t\"ATTACH\",\t\"DETACH\",\t\"BIND\",\t\t\"LISTEN\",\n\t\"CONNECT\",\t\"ACCEPT\",\t\"DISCONNECT\",\t\"SHUTDOWN\",\n\t\"RCVD\",\t\t\"SEND\",\t\t\"ABORT\",\t\"CONTROL\",\n\t\"SENSE\",\t\"RCVOOB\",\t\"SENDOOB\",\t\"SOCKADDR\",\n\t\"PEERADDR\",\t\"CONNECT2\",\t\"FASTTIMO\",\t\"SLOWTIMO\",\n\t\"PROTORCV\",\t\"PROTOSEND\",\t\"SEND_EOF\",\t\"SOSETLABEL\",\n\t\"CLOSE\",\t\"FLUSH\",\n};\n#endif\n\n#ifdef\t_KERNEL\t\t\t/* users shouldn't see this decl */\n\nstruct ifnet;\nstruct stat;\nstruct ucred;\nstruct uio;\n\n/*\n * If the ordering here looks odd, that's because it's alphabetical.  These\n * should eventually be merged back into struct protosw.\n *\n * Some fields initialized to defaults if they are NULL.\n * See uipc_domain.c:net_init_domain()\n */\nstruct pr_usrreqs {\n\tvoid\t(*pru_abort)(struct socket *so);\n\tint\t(*pru_accept)(struct socket *so, struct sockaddr **nam);\n\tint\t(*pru_attach)(struct socket *so, int proto, struct thread *td);\n\tint\t(*pru_bind)(struct socket *so, struct sockaddr *nam,\n\t\t    struct thread *td);\n\tint\t(*pru_connect)(struct socket *so, struct sockaddr *nam,\n\t\t    struct thread *td);\n\tint\t(*pru_connect2)(struct socket *so1, struct socket *so2);\n\tint\t(*pru_control)(struct socket *so, u_long cmd, caddr_t data,\n\t\t    struct ifnet *ifp, struct thread *td);\n\tvoid\t(*pru_detach)(struct socket *so);\n\tint\t(*pru_disconnect)(struct socket *so);\n\tint\t(*pru_listen)(struct socket *so, int backlog,\n\t\t    struct thread *td);\n\tint\t(*pru_peeraddr)(struct socket *so, struct sockaddr **nam);\n\tint\t(*pru_rcvd)(struct socket *so, int flags);\n\tint\t(*pru_rcvoob)(struct socket *so, struct mbuf *m, int flags);\n\tint\t(*pru_send)(struct socket *so, int flags, struct mbuf *m, \n\t\t    struct sockaddr *addr, struct mbuf *control,\n\t\t    struct thread *td);\n#define\tPRUS_OOB\t0x1\n#define\tPRUS_EOF\t0x2\n#define\tPRUS_MORETOCOME\t0x4\n\tint\t(*pru_sense)(struct socket *so, struct stat *sb);\n        int\t(*pru_shutdown)(struct socket *so);\n\tint\t(*pru_flush)(struct socket *so, int direction);  \n\tint\t(*pru_sockaddr)(struct socket *so, struct sockaddr **nam);\n\tint\t(*pru_sosend)(struct socket *so, struct sockaddr *addr,\n\t\t    struct uio *uio, struct mbuf *top, struct mbuf *control,\n\t\t    int flags, struct thread *td);\n\tint\t(*pru_soreceive)(struct socket *so, struct sockaddr **paddr,\n\t\t    struct uio *uio, struct mbuf **mp0, struct mbuf **controlp,\n\t\t    int *flagsp);\n\tint\t(*pru_sopoll)(struct socket *so, int events,\n\t\t    struct ucred *cred, struct thread *td);\n\tvoid\t(*pru_sosetlabel)(struct socket *so);\n\tvoid\t(*pru_close)(struct socket *so);\n};\n\n/*\n * All nonvoid pru_*() functions below return EOPNOTSUPP.\n */\nint\tpru_accept_notsupp(struct socket *so, struct sockaddr **nam);\nint\tpru_attach_notsupp(struct socket *so, int proto, struct thread *td);\nint\tpru_bind_notsupp(struct socket *so, struct sockaddr *nam,\n\t    struct thread *td);\nint\tpru_connect_notsupp(struct socket *so, struct sockaddr *nam,\n\t    struct thread *td);\nint\tpru_connect2_notsupp(struct socket *so1, struct socket *so2);\nint\tpru_control_notsupp(struct socket *so, u_long cmd, caddr_t data,\n\t    struct ifnet *ifp, struct thread *td);\nint\tpru_disconnect_notsupp(struct socket *so);\nint\tpru_listen_notsupp(struct socket *so, int backlog, struct thread *td);\nint\tpru_peeraddr_notsupp(struct socket *so, struct sockaddr **nam);\nint\tpru_rcvd_notsupp(struct socket *so, int flags);\nint\tpru_rcvoob_notsupp(struct socket *so, struct mbuf *m, int flags);\nint\tpru_send_notsupp(struct socket *so, int flags, struct mbuf *m,\n\t    struct sockaddr *addr, struct mbuf *control, struct thread *td);\nint\tpru_sense_null(struct socket *so, struct stat *sb);\nint\tpru_shutdown_notsupp(struct socket *so);\nint\tpru_sockaddr_notsupp(struct socket *so, struct sockaddr **nam);\nint\tpru_sosend_notsupp(struct socket *so, struct sockaddr *addr,\n\t    struct uio *uio, struct mbuf *top, struct mbuf *control, int flags,\n\t    struct thread *td);\nint\tpru_soreceive_notsupp(struct socket *so, struct sockaddr **paddr,\n\t    struct uio *uio, struct mbuf **mp0, struct mbuf **controlp,\n\t    int *flagsp);\nint\tpru_sopoll_notsupp(struct socket *so, int events, struct ucred *cred,\n\t    struct thread *td);\n\n#endif /* _KERNEL */\n\n/*\n * The arguments to the ctlinput routine are\n *\t(*protosw[].pr_ctlinput)(cmd, sa, arg);\n * where cmd is one of the commands below, sa is a pointer to a sockaddr,\n * and arg is a `void *' argument used within a protocol family.\n */\n#define\tPRC_IFDOWN\t\t0\t/* interface transition */\n#define\tPRC_ROUTEDEAD\t\t1\t/* select new route if possible ??? */\n#define\tPRC_IFUP\t\t2 \t/* interface has come back up */\n#define\tPRC_QUENCH2\t\t3\t/* DEC congestion bit says slow down */\n#define\tPRC_QUENCH\t\t4\t/* some one said to slow down */\n#define\tPRC_MSGSIZE\t\t5\t/* message size forced drop */\n#define\tPRC_HOSTDEAD\t\t6\t/* host appears to be down */\n#define\tPRC_HOSTUNREACH\t\t7\t/* deprecated (use PRC_UNREACH_HOST) */\n#define\tPRC_UNREACH_NET\t\t8\t/* no route to network */\n#define\tPRC_UNREACH_HOST\t9\t/* no route to host */\n#define\tPRC_UNREACH_PROTOCOL\t10\t/* dst says bad protocol */\n#define\tPRC_UNREACH_PORT\t11\t/* bad port # */\n/* was\tPRC_UNREACH_NEEDFRAG\t12\t   (use PRC_MSGSIZE) */\n#define\tPRC_UNREACH_SRCFAIL\t13\t/* source route failed */\n#define\tPRC_REDIRECT_NET\t14\t/* net routing redirect */\n#define\tPRC_REDIRECT_HOST\t15\t/* host routing redirect */\n#define\tPRC_REDIRECT_TOSNET\t16\t/* redirect for type of service & net */\n#define\tPRC_REDIRECT_TOSHOST\t17\t/* redirect for tos & host */\n#define\tPRC_TIMXCEED_INTRANS\t18\t/* packet lifetime expired in transit */\n#define\tPRC_TIMXCEED_REASS\t19\t/* lifetime expired on reass q */\n#define\tPRC_PARAMPROB\t\t20\t/* header incorrect */\n#define\tPRC_UNREACH_ADMIN_PROHIB\t21\t/* packet administrativly prohibited */\n\n#define\tPRC_NCMDS\t\t22\n\n#define\tPRC_IS_REDIRECT(cmd)\t\\\n\t((cmd) >= PRC_REDIRECT_NET && (cmd) <= PRC_REDIRECT_TOSHOST)\n\n#ifdef PRCREQUESTS\nchar\t*prcrequests[] = {\n\t\"IFDOWN\", \"ROUTEDEAD\", \"IFUP\", \"DEC-BIT-QUENCH2\",\n\t\"QUENCH\", \"MSGSIZE\", \"HOSTDEAD\", \"#7\",\n\t\"NET-UNREACH\", \"HOST-UNREACH\", \"PROTO-UNREACH\", \"PORT-UNREACH\",\n\t\"#12\", \"SRCFAIL-UNREACH\", \"NET-REDIRECT\", \"HOST-REDIRECT\",\n\t\"TOSNET-REDIRECT\", \"TOSHOST-REDIRECT\", \"TX-INTRANS\", \"TX-REASS\",\n\t\"PARAMPROB\", \"ADMIN-UNREACH\"\n};\n#endif\n\n/*\n * The arguments to ctloutput are:\n *\t(*protosw[].pr_ctloutput)(req, so, level, optname, optval, p);\n * req is one of the actions listed below, so is a (struct socket *),\n * level is an indication of which protocol layer the option is intended.\n * optname is a protocol dependent socket option request,\n * optval is a pointer to a mbuf-chain pointer, for value-return results.\n * The protocol is responsible for disposal of the mbuf chain *optval\n * if supplied,\n * the caller is responsible for any space held by *optval, when returned.\n * A non-zero return from ctloutput gives an\n * UNIX error number which should be passed to higher level software.\n */\n#define\tPRCO_GETOPT\t0\n#define\tPRCO_SETOPT\t1\n\n#define\tPRCO_NCMDS\t2\n\n#ifdef PRCOREQUESTS\nchar\t*prcorequests[] = {\n\t\"GETOPT\", \"SETOPT\",\n};\n#endif\n\n#ifdef _KERNEL\nvoid\tpfctlinput(int, struct sockaddr *);\nvoid\tpfctlinput2(int, struct sockaddr *, void *);\nstruct protosw *pffindproto(int family, int protocol, int type);\nstruct protosw *pffindtype(int family, int type);\nint\tpf_proto_register(int family, struct protosw *npr);\nint\tpf_proto_unregister(int family, int protocol, int type);\n#endif\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/sys/ptio.h",
    "content": "/*-\n * Copyright (c) 1999 Kenneth D. Merry.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions, and the following disclaimer,\n *    without modification, immediately at the beginning of the file.\n * 2. The name of the author may not be used to endorse or promote products\n *    derived from this software without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/sys/ptio.h 50477 1999-08-28 01:08:13Z peter $\n */\n\n#ifndef _SYS_PTIO_H_\n#define\t_SYS_PTIO_H_\n\n#include <sys/ioccom.h>\n\n#define\tPTIOCGETTIMEOUT\t_IOR('T', 1, int)\n#define\tPTIOCSETTIMEOUT\t_IOW('T', 2, int)\n\n#endif /* !_SYS_PTIO_H_ */\n"
  },
  {
    "path": "freebsd-headers/sys/ptrace.h",
    "content": "/*-\n * Copyright (c) 1984, 1993\n *\tThe Regents of the University of California.  All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 4. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t@(#)ptrace.h\t8.2 (Berkeley) 1/4/94\n * $FreeBSD: release/9.0.0/sys/sys/ptrace.h 217819 2011-01-25 10:59:21Z kib $\n */\n\n#ifndef\t_SYS_PTRACE_H_\n#define\t_SYS_PTRACE_H_\n\n#include <sys/signal.h>\n#include <sys/param.h>\n#include <machine/reg.h>\n\n#define\tPT_TRACE_ME\t0\t/* child declares it's being traced */\n#define\tPT_READ_I\t1\t/* read word in child's I space */\n#define\tPT_READ_D\t2\t/* read word in child's D space */\n/* was\tPT_READ_U\t3\t * read word in child's user structure */\n#define\tPT_WRITE_I\t4\t/* write word in child's I space */\n#define\tPT_WRITE_D\t5\t/* write word in child's D space */\n/* was\tPT_WRITE_U\t6\t * write word in child's user structure */\n#define\tPT_CONTINUE\t7\t/* continue the child */\n#define\tPT_KILL\t\t8\t/* kill the child process */\n#define\tPT_STEP\t\t9\t/* single step the child */\n\n#define\tPT_ATTACH\t10\t/* trace some running process */\n#define\tPT_DETACH\t11\t/* stop tracing a process */\n#define PT_IO\t\t12\t/* do I/O to/from stopped process. */\n#define\tPT_LWPINFO\t13\t/* Info about the LWP that stopped. */\n#define PT_GETNUMLWPS\t14\t/* get total number of threads */\n#define PT_GETLWPLIST\t15\t/* get thread list */\n#define PT_CLEARSTEP\t16\t/* turn off single step */\n#define PT_SETSTEP\t17\t/* turn on single step */\n#define PT_SUSPEND\t18\t/* suspend a thread */\n#define PT_RESUME\t19\t/* resume a thread */\n\n#define\tPT_TO_SCE\t20\n#define\tPT_TO_SCX\t21\n#define\tPT_SYSCALL\t22\n\n#define\tPT_FOLLOW_FORK\t23\n\n#define PT_GETREGS      33\t/* get general-purpose registers */\n#define PT_SETREGS      34\t/* set general-purpose registers */\n#define PT_GETFPREGS    35\t/* get floating-point registers */\n#define PT_SETFPREGS    36\t/* set floating-point registers */\n#define PT_GETDBREGS    37\t/* get debugging registers */\n#define PT_SETDBREGS    38\t/* set debugging registers */\n\n#define\tPT_VM_TIMESTAMP\t40\t/* Get VM version (timestamp) */\n#define\tPT_VM_ENTRY\t41\t/* Get VM map (entry) */\n\n#define PT_FIRSTMACH    64\t/* for machine-specific requests */\n#include <machine/ptrace.h>\t/* machine-specific requests, if any */\n\nstruct ptrace_io_desc {\n\tint\tpiod_op;\t/* I/O operation */\n\tvoid\t*piod_offs;\t/* child offset */\n\tvoid\t*piod_addr;\t/* parent offset */\n\tsize_t\tpiod_len;\t/* request length */\n};\n\n/*\n * Operations in piod_op.\n */\n#define PIOD_READ_D\t1\t/* Read from D space */\n#define PIOD_WRITE_D\t2\t/* Write to D space */\n#define PIOD_READ_I\t3\t/* Read from I space */\n#define PIOD_WRITE_I\t4\t/* Write to I space */\n\n/* Argument structure for PT_LWPINFO. */\nstruct ptrace_lwpinfo {\n\tlwpid_t\tpl_lwpid;\t/* LWP described. */\n\tint\tpl_event;\t/* Event that stopped the LWP. */\n#define\tPL_EVENT_NONE\t0\n#define\tPL_EVENT_SIGNAL\t1\n\tint\tpl_flags;\t/* LWP flags. */\n#define\tPL_FLAG_SA\t0x01\t/* M:N thread */\n#define\tPL_FLAG_BOUND\t0x02\t/* M:N bound thread */\n#define\tPL_FLAG_SCE\t0x04\t/* syscall enter point */\n#define\tPL_FLAG_SCX\t0x08\t/* syscall leave point */\n#define\tPL_FLAG_EXEC\t0x10\t/* exec(2) succeeded */\n#define\tPL_FLAG_SI\t0x20\t/* siginfo is valid */\n#define\tPL_FLAG_FORKED\t0x40\t/* new child */\n\tsigset_t\tpl_sigmask;\t/* LWP signal mask */\n\tsigset_t\tpl_siglist;\t/* LWP pending signal */\n\tstruct __siginfo pl_siginfo;\t/* siginfo for signal */\n\tchar\t\tpl_tdname[MAXCOMLEN + 1]; /* LWP name */\n\tint\t\tpl_child_pid;\t/* New child pid */\n};\n\n/* Argument structure for PT_VM_ENTRY. */\nstruct ptrace_vm_entry {\n\tint\t\tpve_entry;\t/* Entry number used for iteration. */\n\tint\t\tpve_timestamp;\t/* Generation number of VM map. */\n\tu_long\t\tpve_start;\t/* Start VA of range. */\n\tu_long\t\tpve_end;\t/* End VA of range (incl). */\n\tu_long\t\tpve_offset;\t/* Offset in backing object. */\n\tu_int\t\tpve_prot;\t/* Protection of memory range. */\n\tu_int\t\tpve_pathlen;\t/* Size of path. */\n\tlong\t\tpve_fileid;\t/* File ID. */\n\tuint32_t\tpve_fsid;\t/* File system ID. */\n\tchar\t\t*pve_path;\t/* Path name of object. */\n};\n\n#ifdef _KERNEL\n\n#define\tPTRACESTOP_SC(p, td, flag)\t\t\t\t\\\n\tif ((p)->p_flag & P_TRACED && (p)->p_stops & (flag)) {\t\\\n\t\tPROC_LOCK(p);\t\t\t\t\t\\\n\t\tptracestop((td), SIGTRAP);\t\t\t\\\n\t\tPROC_UNLOCK(p);\t\t\t\t\t\\\n\t}\n/*\n * The flags below are used for ptrace(2) tracing and have no relation\n * to procfs.  They are stored in struct proc's p_stops member.\n */\n#define\tS_PT_SCE\t0x000010000\n#define\tS_PT_SCX\t0x000020000\n\nint\tptrace_set_pc(struct thread *_td, unsigned long _addr);\nint\tptrace_single_step(struct thread *_td);\nint\tptrace_clear_single_step(struct thread *_td);\n\n#ifdef __HAVE_PTRACE_MACHDEP\nint\tcpu_ptrace(struct thread *_td, int _req, void *_addr, int _data);\n#endif\n\n/*\n * These are prototypes for functions that implement some of the\n * debugging functionality exported by procfs / linprocfs and by the\n * ptrace(2) syscall.  They used to be part of procfs, but they don't\n * really belong there.\n */\nstruct reg;\nstruct fpreg;\nstruct dbreg;\nstruct uio;\nint\tproc_read_regs(struct thread *_td, struct reg *_reg);\nint\tproc_write_regs(struct thread *_td, struct reg *_reg);\nint\tproc_read_fpregs(struct thread *_td, struct fpreg *_fpreg);\nint\tproc_write_fpregs(struct thread *_td, struct fpreg *_fpreg);\nint\tproc_read_dbregs(struct thread *_td, struct dbreg *_dbreg);\nint\tproc_write_dbregs(struct thread *_td, struct dbreg *_dbreg);\nint\tproc_sstep(struct thread *_td);\nint\tproc_rwmem(struct proc *_p, struct uio *_uio);\n#ifdef COMPAT_FREEBSD32\nstruct reg32;\nstruct fpreg32;\nstruct dbreg32;\nint\tproc_read_regs32(struct thread *_td, struct reg32 *_reg32);\nint\tproc_write_regs32(struct thread *_td, struct reg32 *_reg32);\nint\tproc_read_fpregs32(struct thread *_td, struct fpreg32 *_fpreg32);\nint\tproc_write_fpregs32(struct thread *_td, struct fpreg32 *_fpreg32);\nint\tproc_read_dbregs32(struct thread *_td, struct dbreg32 *_dbreg32);\nint\tproc_write_dbregs32(struct thread *_td, struct dbreg32 *_dbreg32);\n#endif\n#else /* !_KERNEL */\n\n#include <sys/cdefs.h>\n\n__BEGIN_DECLS\nint\tptrace(int _request, pid_t _pid, caddr_t _addr, int _data);\n__END_DECLS\n\n#endif /* !_KERNEL */\n\n#endif\t/* !_SYS_PTRACE_H_ */\n"
  },
  {
    "path": "freebsd-headers/sys/queue.h",
    "content": "/*-\n * Copyright (c) 1991, 1993\n *\tThe Regents of the University of California.  All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 4. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t@(#)queue.h\t8.5 (Berkeley) 8/20/94\n * $FreeBSD: release/9.0.0/sys/sys/queue.h 221843 2011-05-13 15:49:23Z mdf $\n */\n\n#ifndef _SYS_QUEUE_H_\n#define\t_SYS_QUEUE_H_\n\n#include <sys/cdefs.h>\n\n/*\n * This file defines four types of data structures: singly-linked lists,\n * singly-linked tail queues, lists and tail queues.\n *\n * A singly-linked list is headed by a single forward pointer. The elements\n * are singly linked for minimum space and pointer manipulation overhead at\n * the expense of O(n) removal for arbitrary elements. New elements can be\n * added to the list after an existing element or at the head of the list.\n * Elements being removed from the head of the list should use the explicit\n * macro for this purpose for optimum efficiency. A singly-linked list may\n * only be traversed in the forward direction.  Singly-linked lists are ideal\n * for applications with large datasets and few or no removals or for\n * implementing a LIFO queue.\n *\n * A singly-linked tail queue is headed by a pair of pointers, one to the\n * head of the list and the other to the tail of the list. The elements are\n * singly linked for minimum space and pointer manipulation overhead at the\n * expense of O(n) removal for arbitrary elements. New elements can be added\n * to the list after an existing element, at the head of the list, or at the\n * end of the list. Elements being removed from the head of the tail queue\n * should use the explicit macro for this purpose for optimum efficiency.\n * A singly-linked tail queue may only be traversed in the forward direction.\n * Singly-linked tail queues are ideal for applications with large datasets\n * and few or no removals or for implementing a FIFO queue.\n *\n * A list is headed by a single forward pointer (or an array of forward\n * pointers for a hash table header). The elements are doubly linked\n * so that an arbitrary element can be removed without a need to\n * traverse the list. New elements can be added to the list before\n * or after an existing element or at the head of the list. A list\n * may only be traversed in the forward direction.\n *\n * A tail queue is headed by a pair of pointers, one to the head of the\n * list and the other to the tail of the list. The elements are doubly\n * linked so that an arbitrary element can be removed without a need to\n * traverse the list. New elements can be added to the list before or\n * after an existing element, at the head of the list, or at the end of\n * the list. A tail queue may be traversed in either direction.\n *\n * For details on the use of these macros, see the queue(3) manual page.\n *\n *\n *\t\t\t\tSLIST\tLIST\tSTAILQ\tTAILQ\n * _HEAD\t\t\t+\t+\t+\t+\n * _HEAD_INITIALIZER\t\t+\t+\t+\t+\n * _ENTRY\t\t\t+\t+\t+\t+\n * _INIT\t\t\t+\t+\t+\t+\n * _EMPTY\t\t\t+\t+\t+\t+\n * _FIRST\t\t\t+\t+\t+\t+\n * _NEXT\t\t\t+\t+\t+\t+\n * _PREV\t\t\t-\t-\t-\t+\n * _LAST\t\t\t-\t-\t+\t+\n * _FOREACH\t\t\t+\t+\t+\t+\n * _FOREACH_SAFE\t\t+\t+\t+\t+\n * _FOREACH_REVERSE\t\t-\t-\t-\t+\n * _FOREACH_REVERSE_SAFE\t-\t-\t-\t+\n * _INSERT_HEAD\t\t\t+\t+\t+\t+\n * _INSERT_BEFORE\t\t-\t+\t-\t+\n * _INSERT_AFTER\t\t+\t+\t+\t+\n * _INSERT_TAIL\t\t\t-\t-\t+\t+\n * _CONCAT\t\t\t-\t-\t+\t+\n * _REMOVE_AFTER\t\t+\t-\t+\t-\n * _REMOVE_HEAD\t\t\t+\t-\t+\t-\n * _REMOVE\t\t\t+\t+\t+\t+\n * _SWAP\t\t\t+\t+\t+\t+\n *\n */\n#ifdef QUEUE_MACRO_DEBUG\n/* Store the last 2 places the queue element or head was altered */\nstruct qm_trace {\n\tchar * lastfile;\n\tint lastline;\n\tchar * prevfile;\n\tint prevline;\n};\n\n#define\tTRACEBUF\tstruct qm_trace trace;\n#define\tTRASHIT(x)\tdo {(x) = (void *)-1;} while (0)\n#define\tQMD_SAVELINK(name, link)\tvoid **name = (void *)&(link)\n\n#define\tQMD_TRACE_HEAD(head) do {\t\t\t\t\t\\\n\t(head)->trace.prevline = (head)->trace.lastline;\t\t\\\n\t(head)->trace.prevfile = (head)->trace.lastfile;\t\t\\\n\t(head)->trace.lastline = __LINE__;\t\t\t\t\\\n\t(head)->trace.lastfile = __FILE__;\t\t\t\t\\\n} while (0)\n\n#define\tQMD_TRACE_ELEM(elem) do {\t\t\t\t\t\\\n\t(elem)->trace.prevline = (elem)->trace.lastline;\t\t\\\n\t(elem)->trace.prevfile = (elem)->trace.lastfile;\t\t\\\n\t(elem)->trace.lastline = __LINE__;\t\t\t\t\\\n\t(elem)->trace.lastfile = __FILE__;\t\t\t\t\\\n} while (0)\n\n#else\n#define\tQMD_TRACE_ELEM(elem)\n#define\tQMD_TRACE_HEAD(head)\n#define\tQMD_SAVELINK(name, link)\n#define\tTRACEBUF\n#define\tTRASHIT(x)\n#endif\t/* QUEUE_MACRO_DEBUG */\n\n/*\n * Singly-linked List declarations.\n */\n#define\tSLIST_HEAD(name, type)\t\t\t\t\t\t\\\nstruct name {\t\t\t\t\t\t\t\t\\\n\tstruct type *slh_first;\t/* first element */\t\t\t\\\n}\n\n#define\tSLIST_HEAD_INITIALIZER(head)\t\t\t\t\t\\\n\t{ NULL }\n\n#define\tSLIST_ENTRY(type)\t\t\t\t\t\t\\\nstruct {\t\t\t\t\t\t\t\t\\\n\tstruct type *sle_next;\t/* next element */\t\t\t\\\n}\n\n/*\n * Singly-linked List functions.\n */\n#define\tSLIST_EMPTY(head)\t((head)->slh_first == NULL)\n\n#define\tSLIST_FIRST(head)\t((head)->slh_first)\n\n#define\tSLIST_FOREACH(var, head, field)\t\t\t\t\t\\\n\tfor ((var) = SLIST_FIRST((head));\t\t\t\t\\\n\t    (var);\t\t\t\t\t\t\t\\\n\t    (var) = SLIST_NEXT((var), field))\n\n#define\tSLIST_FOREACH_SAFE(var, head, field, tvar)\t\t\t\\\n\tfor ((var) = SLIST_FIRST((head));\t\t\t\t\\\n\t    (var) && ((tvar) = SLIST_NEXT((var), field), 1);\t\t\\\n\t    (var) = (tvar))\n\n#define\tSLIST_FOREACH_PREVPTR(var, varp, head, field)\t\t\t\\\n\tfor ((varp) = &SLIST_FIRST((head));\t\t\t\t\\\n\t    ((var) = *(varp)) != NULL;\t\t\t\t\t\\\n\t    (varp) = &SLIST_NEXT((var), field))\n\n#define\tSLIST_INIT(head) do {\t\t\t\t\t\t\\\n\tSLIST_FIRST((head)) = NULL;\t\t\t\t\t\\\n} while (0)\n\n#define\tSLIST_INSERT_AFTER(slistelm, elm, field) do {\t\t\t\\\n\tSLIST_NEXT((elm), field) = SLIST_NEXT((slistelm), field);\t\\\n\tSLIST_NEXT((slistelm), field) = (elm);\t\t\t\t\\\n} while (0)\n\n#define\tSLIST_INSERT_HEAD(head, elm, field) do {\t\t\t\\\n\tSLIST_NEXT((elm), field) = SLIST_FIRST((head));\t\t\t\\\n\tSLIST_FIRST((head)) = (elm);\t\t\t\t\t\\\n} while (0)\n\n#define\tSLIST_NEXT(elm, field)\t((elm)->field.sle_next)\n\n#define\tSLIST_REMOVE(head, elm, type, field) do {\t\t\t\\\n\tQMD_SAVELINK(oldnext, (elm)->field.sle_next);\t\t\t\\\n\tif (SLIST_FIRST((head)) == (elm)) {\t\t\t\t\\\n\t\tSLIST_REMOVE_HEAD((head), field);\t\t\t\\\n\t}\t\t\t\t\t\t\t\t\\\n\telse {\t\t\t\t\t\t\t\t\\\n\t\tstruct type *curelm = SLIST_FIRST((head));\t\t\\\n\t\twhile (SLIST_NEXT(curelm, field) != (elm))\t\t\\\n\t\t\tcurelm = SLIST_NEXT(curelm, field);\t\t\\\n\t\tSLIST_REMOVE_AFTER(curelm, field);\t\t\t\\\n\t}\t\t\t\t\t\t\t\t\\\n\tTRASHIT(*oldnext);\t\t\t\t\t\t\\\n} while (0)\n\n#define SLIST_REMOVE_AFTER(elm, field) do {\t\t\t\t\\\n\tSLIST_NEXT(elm, field) =\t\t\t\t\t\\\n\t    SLIST_NEXT(SLIST_NEXT(elm, field), field);\t\t\t\\\n} while (0)\n\n#define\tSLIST_REMOVE_HEAD(head, field) do {\t\t\t\t\\\n\tSLIST_FIRST((head)) = SLIST_NEXT(SLIST_FIRST((head)), field);\t\\\n} while (0)\n\n#define SLIST_SWAP(head1, head2, type) do {\t\t\t\t\\\n\tstruct type *swap_first = SLIST_FIRST(head1);\t\t\t\\\n\tSLIST_FIRST(head1) = SLIST_FIRST(head2);\t\t\t\\\n\tSLIST_FIRST(head2) = swap_first;\t\t\t\t\\\n} while (0)\n\n/*\n * Singly-linked Tail queue declarations.\n */\n#define\tSTAILQ_HEAD(name, type)\t\t\t\t\t\t\\\nstruct name {\t\t\t\t\t\t\t\t\\\n\tstruct type *stqh_first;/* first element */\t\t\t\\\n\tstruct type **stqh_last;/* addr of last next element */\t\t\\\n}\n\n#define\tSTAILQ_HEAD_INITIALIZER(head)\t\t\t\t\t\\\n\t{ NULL, &(head).stqh_first }\n\n#define\tSTAILQ_ENTRY(type)\t\t\t\t\t\t\\\nstruct {\t\t\t\t\t\t\t\t\\\n\tstruct type *stqe_next;\t/* next element */\t\t\t\\\n}\n\n/*\n * Singly-linked Tail queue functions.\n */\n#define\tSTAILQ_CONCAT(head1, head2) do {\t\t\t\t\\\n\tif (!STAILQ_EMPTY((head2))) {\t\t\t\t\t\\\n\t\t*(head1)->stqh_last = (head2)->stqh_first;\t\t\\\n\t\t(head1)->stqh_last = (head2)->stqh_last;\t\t\\\n\t\tSTAILQ_INIT((head2));\t\t\t\t\t\\\n\t}\t\t\t\t\t\t\t\t\\\n} while (0)\n\n#define\tSTAILQ_EMPTY(head)\t((head)->stqh_first == NULL)\n\n#define\tSTAILQ_FIRST(head)\t((head)->stqh_first)\n\n#define\tSTAILQ_FOREACH(var, head, field)\t\t\t\t\\\n\tfor((var) = STAILQ_FIRST((head));\t\t\t\t\\\n\t   (var);\t\t\t\t\t\t\t\\\n\t   (var) = STAILQ_NEXT((var), field))\n\n\n#define\tSTAILQ_FOREACH_SAFE(var, head, field, tvar)\t\t\t\\\n\tfor ((var) = STAILQ_FIRST((head));\t\t\t\t\\\n\t    (var) && ((tvar) = STAILQ_NEXT((var), field), 1);\t\t\\\n\t    (var) = (tvar))\n\n#define\tSTAILQ_INIT(head) do {\t\t\t\t\t\t\\\n\tSTAILQ_FIRST((head)) = NULL;\t\t\t\t\t\\\n\t(head)->stqh_last = &STAILQ_FIRST((head));\t\t\t\\\n} while (0)\n\n#define\tSTAILQ_INSERT_AFTER(head, tqelm, elm, field) do {\t\t\\\n\tif ((STAILQ_NEXT((elm), field) = STAILQ_NEXT((tqelm), field)) == NULL)\\\n\t\t(head)->stqh_last = &STAILQ_NEXT((elm), field);\t\t\\\n\tSTAILQ_NEXT((tqelm), field) = (elm);\t\t\t\t\\\n} while (0)\n\n#define\tSTAILQ_INSERT_HEAD(head, elm, field) do {\t\t\t\\\n\tif ((STAILQ_NEXT((elm), field) = STAILQ_FIRST((head))) == NULL)\t\\\n\t\t(head)->stqh_last = &STAILQ_NEXT((elm), field);\t\t\\\n\tSTAILQ_FIRST((head)) = (elm);\t\t\t\t\t\\\n} while (0)\n\n#define\tSTAILQ_INSERT_TAIL(head, elm, field) do {\t\t\t\\\n\tSTAILQ_NEXT((elm), field) = NULL;\t\t\t\t\\\n\t*(head)->stqh_last = (elm);\t\t\t\t\t\\\n\t(head)->stqh_last = &STAILQ_NEXT((elm), field);\t\t\t\\\n} while (0)\n\n#define\tSTAILQ_LAST(head, type, field)\t\t\t\t\t\\\n\t(STAILQ_EMPTY((head)) ?\t\t\t\t\t\t\\\n\t\tNULL :\t\t\t\t\t\t\t\\\n\t        ((struct type *)(void *)\t\t\t\t\\\n\t\t((char *)((head)->stqh_last) - __offsetof(struct type, field))))\n\n#define\tSTAILQ_NEXT(elm, field)\t((elm)->field.stqe_next)\n\n#define\tSTAILQ_REMOVE(head, elm, type, field) do {\t\t\t\\\n\tQMD_SAVELINK(oldnext, (elm)->field.stqe_next);\t\t\t\\\n\tif (STAILQ_FIRST((head)) == (elm)) {\t\t\t\t\\\n\t\tSTAILQ_REMOVE_HEAD((head), field);\t\t\t\\\n\t}\t\t\t\t\t\t\t\t\\\n\telse {\t\t\t\t\t\t\t\t\\\n\t\tstruct type *curelm = STAILQ_FIRST((head));\t\t\\\n\t\twhile (STAILQ_NEXT(curelm, field) != (elm))\t\t\\\n\t\t\tcurelm = STAILQ_NEXT(curelm, field);\t\t\\\n\t\tSTAILQ_REMOVE_AFTER(head, curelm, field);\t\t\\\n\t}\t\t\t\t\t\t\t\t\\\n\tTRASHIT(*oldnext);\t\t\t\t\t\t\\\n} while (0)\n\n#define STAILQ_REMOVE_AFTER(head, elm, field) do {\t\t\t\\\n\tif ((STAILQ_NEXT(elm, field) =\t\t\t\t\t\\\n\t     STAILQ_NEXT(STAILQ_NEXT(elm, field), field)) == NULL)\t\\\n\t\t(head)->stqh_last = &STAILQ_NEXT((elm), field);\t\t\\\n} while (0)\n\n#define\tSTAILQ_REMOVE_HEAD(head, field) do {\t\t\t\t\\\n\tif ((STAILQ_FIRST((head)) =\t\t\t\t\t\\\n\t     STAILQ_NEXT(STAILQ_FIRST((head)), field)) == NULL)\t\t\\\n\t\t(head)->stqh_last = &STAILQ_FIRST((head));\t\t\\\n} while (0)\n\n#define STAILQ_SWAP(head1, head2, type) do {\t\t\t\t\\\n\tstruct type *swap_first = STAILQ_FIRST(head1);\t\t\t\\\n\tstruct type **swap_last = (head1)->stqh_last;\t\t\t\\\n\tSTAILQ_FIRST(head1) = STAILQ_FIRST(head2);\t\t\t\\\n\t(head1)->stqh_last = (head2)->stqh_last;\t\t\t\\\n\tSTAILQ_FIRST(head2) = swap_first;\t\t\t\t\\\n\t(head2)->stqh_last = swap_last;\t\t\t\t\t\\\n\tif (STAILQ_EMPTY(head1))\t\t\t\t\t\\\n\t\t(head1)->stqh_last = &STAILQ_FIRST(head1);\t\t\\\n\tif (STAILQ_EMPTY(head2))\t\t\t\t\t\\\n\t\t(head2)->stqh_last = &STAILQ_FIRST(head2);\t\t\\\n} while (0)\n\n\n/*\n * List declarations.\n */\n#define\tLIST_HEAD(name, type)\t\t\t\t\t\t\\\nstruct name {\t\t\t\t\t\t\t\t\\\n\tstruct type *lh_first;\t/* first element */\t\t\t\\\n}\n\n#define\tLIST_HEAD_INITIALIZER(head)\t\t\t\t\t\\\n\t{ NULL }\n\n#define\tLIST_ENTRY(type)\t\t\t\t\t\t\\\nstruct {\t\t\t\t\t\t\t\t\\\n\tstruct type *le_next;\t/* next element */\t\t\t\\\n\tstruct type **le_prev;\t/* address of previous next element */\t\\\n}\n\n/*\n * List functions.\n */\n\n#if (defined(_KERNEL) && defined(INVARIANTS))\n#define\tQMD_LIST_CHECK_HEAD(head, field) do {\t\t\t\t\\\n\tif (LIST_FIRST((head)) != NULL &&\t\t\t\t\\\n\t    LIST_FIRST((head))->field.le_prev !=\t\t\t\\\n\t     &LIST_FIRST((head)))\t\t\t\t\t\\\n\t\tpanic(\"Bad list head %p first->prev != head\", (head));\t\\\n} while (0)\n\n#define\tQMD_LIST_CHECK_NEXT(elm, field) do {\t\t\t\t\\\n\tif (LIST_NEXT((elm), field) != NULL &&\t\t\t\t\\\n\t    LIST_NEXT((elm), field)->field.le_prev !=\t\t\t\\\n\t     &((elm)->field.le_next))\t\t\t\t\t\\\n\t     \tpanic(\"Bad link elm %p next->prev != elm\", (elm));\t\\\n} while (0)\n\n#define\tQMD_LIST_CHECK_PREV(elm, field) do {\t\t\t\t\\\n\tif (*(elm)->field.le_prev != (elm))\t\t\t\t\\\n\t\tpanic(\"Bad link elm %p prev->next != elm\", (elm));\t\\\n} while (0)\n#else\n#define\tQMD_LIST_CHECK_HEAD(head, field)\n#define\tQMD_LIST_CHECK_NEXT(elm, field)\n#define\tQMD_LIST_CHECK_PREV(elm, field)\n#endif /* (_KERNEL && INVARIANTS) */\n\n#define\tLIST_EMPTY(head)\t((head)->lh_first == NULL)\n\n#define\tLIST_FIRST(head)\t((head)->lh_first)\n\n#define\tLIST_FOREACH(var, head, field)\t\t\t\t\t\\\n\tfor ((var) = LIST_FIRST((head));\t\t\t\t\\\n\t    (var);\t\t\t\t\t\t\t\\\n\t    (var) = LIST_NEXT((var), field))\n\n#define\tLIST_FOREACH_SAFE(var, head, field, tvar)\t\t\t\\\n\tfor ((var) = LIST_FIRST((head));\t\t\t\t\\\n\t    (var) && ((tvar) = LIST_NEXT((var), field), 1);\t\t\\\n\t    (var) = (tvar))\n\n#define\tLIST_INIT(head) do {\t\t\t\t\t\t\\\n\tLIST_FIRST((head)) = NULL;\t\t\t\t\t\\\n} while (0)\n\n#define\tLIST_INSERT_AFTER(listelm, elm, field) do {\t\t\t\\\n\tQMD_LIST_CHECK_NEXT(listelm, field);\t\t\t\t\\\n\tif ((LIST_NEXT((elm), field) = LIST_NEXT((listelm), field)) != NULL)\\\n\t\tLIST_NEXT((listelm), field)->field.le_prev =\t\t\\\n\t\t    &LIST_NEXT((elm), field);\t\t\t\t\\\n\tLIST_NEXT((listelm), field) = (elm);\t\t\t\t\\\n\t(elm)->field.le_prev = &LIST_NEXT((listelm), field);\t\t\\\n} while (0)\n\n#define\tLIST_INSERT_BEFORE(listelm, elm, field) do {\t\t\t\\\n\tQMD_LIST_CHECK_PREV(listelm, field);\t\t\t\t\\\n\t(elm)->field.le_prev = (listelm)->field.le_prev;\t\t\\\n\tLIST_NEXT((elm), field) = (listelm);\t\t\t\t\\\n\t*(listelm)->field.le_prev = (elm);\t\t\t\t\\\n\t(listelm)->field.le_prev = &LIST_NEXT((elm), field);\t\t\\\n} while (0)\n\n#define\tLIST_INSERT_HEAD(head, elm, field) do {\t\t\t\t\\\n\tQMD_LIST_CHECK_HEAD((head), field);\t\t\t\t\\\n\tif ((LIST_NEXT((elm), field) = LIST_FIRST((head))) != NULL)\t\\\n\t\tLIST_FIRST((head))->field.le_prev = &LIST_NEXT((elm), field);\\\n\tLIST_FIRST((head)) = (elm);\t\t\t\t\t\\\n\t(elm)->field.le_prev = &LIST_FIRST((head));\t\t\t\\\n} while (0)\n\n#define\tLIST_NEXT(elm, field)\t((elm)->field.le_next)\n\n#define\tLIST_REMOVE(elm, field) do {\t\t\t\t\t\\\n\tQMD_SAVELINK(oldnext, (elm)->field.le_next);\t\t\t\\\n\tQMD_SAVELINK(oldprev, (elm)->field.le_prev);\t\t\t\\\n\tQMD_LIST_CHECK_NEXT(elm, field);\t\t\t\t\\\n\tQMD_LIST_CHECK_PREV(elm, field);\t\t\t\t\\\n\tif (LIST_NEXT((elm), field) != NULL)\t\t\t\t\\\n\t\tLIST_NEXT((elm), field)->field.le_prev = \t\t\\\n\t\t    (elm)->field.le_prev;\t\t\t\t\\\n\t*(elm)->field.le_prev = LIST_NEXT((elm), field);\t\t\\\n\tTRASHIT(*oldnext);\t\t\t\t\t\t\\\n\tTRASHIT(*oldprev);\t\t\t\t\t\t\\\n} while (0)\n\n#define LIST_SWAP(head1, head2, type, field) do {\t\t\t\\\n\tstruct type *swap_tmp = LIST_FIRST((head1));\t\t\t\\\n\tLIST_FIRST((head1)) = LIST_FIRST((head2));\t\t\t\\\n\tLIST_FIRST((head2)) = swap_tmp;\t\t\t\t\t\\\n\tif ((swap_tmp = LIST_FIRST((head1))) != NULL)\t\t\t\\\n\t\tswap_tmp->field.le_prev = &LIST_FIRST((head1));\t\t\\\n\tif ((swap_tmp = LIST_FIRST((head2))) != NULL)\t\t\t\\\n\t\tswap_tmp->field.le_prev = &LIST_FIRST((head2));\t\t\\\n} while (0)\n\n/*\n * Tail queue declarations.\n */\n#define\tTAILQ_HEAD(name, type)\t\t\t\t\t\t\\\nstruct name {\t\t\t\t\t\t\t\t\\\n\tstruct type *tqh_first;\t/* first element */\t\t\t\\\n\tstruct type **tqh_last;\t/* addr of last next element */\t\t\\\n\tTRACEBUF\t\t\t\t\t\t\t\\\n}\n\n#define\tTAILQ_HEAD_INITIALIZER(head)\t\t\t\t\t\\\n\t{ NULL, &(head).tqh_first }\n\n#define\tTAILQ_ENTRY(type)\t\t\t\t\t\t\\\nstruct {\t\t\t\t\t\t\t\t\\\n\tstruct type *tqe_next;\t/* next element */\t\t\t\\\n\tstruct type **tqe_prev;\t/* address of previous next element */\t\\\n\tTRACEBUF\t\t\t\t\t\t\t\\\n}\n\n/*\n * Tail queue functions.\n */\n#if (defined(_KERNEL) && defined(INVARIANTS))\n#define\tQMD_TAILQ_CHECK_HEAD(head, field) do {\t\t\t\t\\\n\tif (!TAILQ_EMPTY(head) &&\t\t\t\t\t\\\n\t    TAILQ_FIRST((head))->field.tqe_prev !=\t\t\t\\\n\t     &TAILQ_FIRST((head)))\t\t\t\t\t\\\n\t\tpanic(\"Bad tailq head %p first->prev != head\", (head));\t\\\n} while (0)\n\n#define\tQMD_TAILQ_CHECK_TAIL(head, field) do {\t\t\t\t\\\n\tif (*(head)->tqh_last != NULL)\t\t\t\t\t\\\n\t    \tpanic(\"Bad tailq NEXT(%p->tqh_last) != NULL\", (head)); \t\\\n} while (0)\n\n#define\tQMD_TAILQ_CHECK_NEXT(elm, field) do {\t\t\t\t\\\n\tif (TAILQ_NEXT((elm), field) != NULL &&\t\t\t\t\\\n\t    TAILQ_NEXT((elm), field)->field.tqe_prev !=\t\t\t\\\n\t     &((elm)->field.tqe_next))\t\t\t\t\t\\\n\t\tpanic(\"Bad link elm %p next->prev != elm\", (elm));\t\\\n} while (0)\n\n#define\tQMD_TAILQ_CHECK_PREV(elm, field) do {\t\t\t\t\\\n\tif (*(elm)->field.tqe_prev != (elm))\t\t\t\t\\\n\t\tpanic(\"Bad link elm %p prev->next != elm\", (elm));\t\\\n} while (0)\n#else\n#define\tQMD_TAILQ_CHECK_HEAD(head, field)\n#define\tQMD_TAILQ_CHECK_TAIL(head, headname)\n#define\tQMD_TAILQ_CHECK_NEXT(elm, field)\n#define\tQMD_TAILQ_CHECK_PREV(elm, field)\n#endif /* (_KERNEL && INVARIANTS) */\n\n#define\tTAILQ_CONCAT(head1, head2, field) do {\t\t\t\t\\\n\tif (!TAILQ_EMPTY(head2)) {\t\t\t\t\t\\\n\t\t*(head1)->tqh_last = (head2)->tqh_first;\t\t\\\n\t\t(head2)->tqh_first->field.tqe_prev = (head1)->tqh_last;\t\\\n\t\t(head1)->tqh_last = (head2)->tqh_last;\t\t\t\\\n\t\tTAILQ_INIT((head2));\t\t\t\t\t\\\n\t\tQMD_TRACE_HEAD(head1);\t\t\t\t\t\\\n\t\tQMD_TRACE_HEAD(head2);\t\t\t\t\t\\\n\t}\t\t\t\t\t\t\t\t\\\n} while (0)\n\n#define\tTAILQ_EMPTY(head)\t((head)->tqh_first == NULL)\n\n#define\tTAILQ_FIRST(head)\t((head)->tqh_first)\n\n#define\tTAILQ_FOREACH(var, head, field)\t\t\t\t\t\\\n\tfor ((var) = TAILQ_FIRST((head));\t\t\t\t\\\n\t    (var);\t\t\t\t\t\t\t\\\n\t    (var) = TAILQ_NEXT((var), field))\n\n#define\tTAILQ_FOREACH_SAFE(var, head, field, tvar)\t\t\t\\\n\tfor ((var) = TAILQ_FIRST((head));\t\t\t\t\\\n\t    (var) && ((tvar) = TAILQ_NEXT((var), field), 1);\t\t\\\n\t    (var) = (tvar))\n\n#define\tTAILQ_FOREACH_REVERSE(var, head, headname, field)\t\t\\\n\tfor ((var) = TAILQ_LAST((head), headname);\t\t\t\\\n\t    (var);\t\t\t\t\t\t\t\\\n\t    (var) = TAILQ_PREV((var), headname, field))\n\n#define\tTAILQ_FOREACH_REVERSE_SAFE(var, head, headname, field, tvar)\t\\\n\tfor ((var) = TAILQ_LAST((head), headname);\t\t\t\\\n\t    (var) && ((tvar) = TAILQ_PREV((var), headname, field), 1);\t\\\n\t    (var) = (tvar))\n\n#define\tTAILQ_INIT(head) do {\t\t\t\t\t\t\\\n\tTAILQ_FIRST((head)) = NULL;\t\t\t\t\t\\\n\t(head)->tqh_last = &TAILQ_FIRST((head));\t\t\t\\\n\tQMD_TRACE_HEAD(head);\t\t\t\t\t\t\\\n} while (0)\n\n#define\tTAILQ_INSERT_AFTER(head, listelm, elm, field) do {\t\t\\\n\tQMD_TAILQ_CHECK_NEXT(listelm, field);\t\t\t\t\\\n\tif ((TAILQ_NEXT((elm), field) = TAILQ_NEXT((listelm), field)) != NULL)\\\n\t\tTAILQ_NEXT((elm), field)->field.tqe_prev = \t\t\\\n\t\t    &TAILQ_NEXT((elm), field);\t\t\t\t\\\n\telse {\t\t\t\t\t\t\t\t\\\n\t\t(head)->tqh_last = &TAILQ_NEXT((elm), field);\t\t\\\n\t\tQMD_TRACE_HEAD(head);\t\t\t\t\t\\\n\t}\t\t\t\t\t\t\t\t\\\n\tTAILQ_NEXT((listelm), field) = (elm);\t\t\t\t\\\n\t(elm)->field.tqe_prev = &TAILQ_NEXT((listelm), field);\t\t\\\n\tQMD_TRACE_ELEM(&(elm)->field);\t\t\t\t\t\\\n\tQMD_TRACE_ELEM(&listelm->field);\t\t\t\t\\\n} while (0)\n\n#define\tTAILQ_INSERT_BEFORE(listelm, elm, field) do {\t\t\t\\\n\tQMD_TAILQ_CHECK_PREV(listelm, field);\t\t\t\t\\\n\t(elm)->field.tqe_prev = (listelm)->field.tqe_prev;\t\t\\\n\tTAILQ_NEXT((elm), field) = (listelm);\t\t\t\t\\\n\t*(listelm)->field.tqe_prev = (elm);\t\t\t\t\\\n\t(listelm)->field.tqe_prev = &TAILQ_NEXT((elm), field);\t\t\\\n\tQMD_TRACE_ELEM(&(elm)->field);\t\t\t\t\t\\\n\tQMD_TRACE_ELEM(&listelm->field);\t\t\t\t\\\n} while (0)\n\n#define\tTAILQ_INSERT_HEAD(head, elm, field) do {\t\t\t\\\n\tQMD_TAILQ_CHECK_HEAD(head, field);\t\t\t\t\\\n\tif ((TAILQ_NEXT((elm), field) = TAILQ_FIRST((head))) != NULL)\t\\\n\t\tTAILQ_FIRST((head))->field.tqe_prev =\t\t\t\\\n\t\t    &TAILQ_NEXT((elm), field);\t\t\t\t\\\n\telse\t\t\t\t\t\t\t\t\\\n\t\t(head)->tqh_last = &TAILQ_NEXT((elm), field);\t\t\\\n\tTAILQ_FIRST((head)) = (elm);\t\t\t\t\t\\\n\t(elm)->field.tqe_prev = &TAILQ_FIRST((head));\t\t\t\\\n\tQMD_TRACE_HEAD(head);\t\t\t\t\t\t\\\n\tQMD_TRACE_ELEM(&(elm)->field);\t\t\t\t\t\\\n} while (0)\n\n#define\tTAILQ_INSERT_TAIL(head, elm, field) do {\t\t\t\\\n\tQMD_TAILQ_CHECK_TAIL(head, field);\t\t\t\t\\\n\tTAILQ_NEXT((elm), field) = NULL;\t\t\t\t\\\n\t(elm)->field.tqe_prev = (head)->tqh_last;\t\t\t\\\n\t*(head)->tqh_last = (elm);\t\t\t\t\t\\\n\t(head)->tqh_last = &TAILQ_NEXT((elm), field);\t\t\t\\\n\tQMD_TRACE_HEAD(head);\t\t\t\t\t\t\\\n\tQMD_TRACE_ELEM(&(elm)->field);\t\t\t\t\t\\\n} while (0)\n\n#define\tTAILQ_LAST(head, headname)\t\t\t\t\t\\\n\t(*(((struct headname *)((head)->tqh_last))->tqh_last))\n\n#define\tTAILQ_NEXT(elm, field) ((elm)->field.tqe_next)\n\n#define\tTAILQ_PREV(elm, headname, field)\t\t\t\t\\\n\t(*(((struct headname *)((elm)->field.tqe_prev))->tqh_last))\n\n#define\tTAILQ_REMOVE(head, elm, field) do {\t\t\t\t\\\n\tQMD_SAVELINK(oldnext, (elm)->field.tqe_next);\t\t\t\\\n\tQMD_SAVELINK(oldprev, (elm)->field.tqe_prev);\t\t\t\\\n\tQMD_TAILQ_CHECK_NEXT(elm, field);\t\t\t\t\\\n\tQMD_TAILQ_CHECK_PREV(elm, field);\t\t\t\t\\\n\tif ((TAILQ_NEXT((elm), field)) != NULL)\t\t\t\t\\\n\t\tTAILQ_NEXT((elm), field)->field.tqe_prev = \t\t\\\n\t\t    (elm)->field.tqe_prev;\t\t\t\t\\\n\telse {\t\t\t\t\t\t\t\t\\\n\t\t(head)->tqh_last = (elm)->field.tqe_prev;\t\t\\\n\t\tQMD_TRACE_HEAD(head);\t\t\t\t\t\\\n\t}\t\t\t\t\t\t\t\t\\\n\t*(elm)->field.tqe_prev = TAILQ_NEXT((elm), field);\t\t\\\n\tTRASHIT(*oldnext);\t\t\t\t\t\t\\\n\tTRASHIT(*oldprev);\t\t\t\t\t\t\\\n\tQMD_TRACE_ELEM(&(elm)->field);\t\t\t\t\t\\\n} while (0)\n\n#define TAILQ_SWAP(head1, head2, type, field) do {\t\t\t\\\n\tstruct type *swap_first = (head1)->tqh_first;\t\t\t\\\n\tstruct type **swap_last = (head1)->tqh_last;\t\t\t\\\n\t(head1)->tqh_first = (head2)->tqh_first;\t\t\t\\\n\t(head1)->tqh_last = (head2)->tqh_last;\t\t\t\t\\\n\t(head2)->tqh_first = swap_first;\t\t\t\t\\\n\t(head2)->tqh_last = swap_last;\t\t\t\t\t\\\n\tif ((swap_first = (head1)->tqh_first) != NULL)\t\t\t\\\n\t\tswap_first->field.tqe_prev = &(head1)->tqh_first;\t\\\n\telse\t\t\t\t\t\t\t\t\\\n\t\t(head1)->tqh_last = &(head1)->tqh_first;\t\t\\\n\tif ((swap_first = (head2)->tqh_first) != NULL)\t\t\t\\\n\t\tswap_first->field.tqe_prev = &(head2)->tqh_first;\t\\\n\telse\t\t\t\t\t\t\t\t\\\n\t\t(head2)->tqh_last = &(head2)->tqh_first;\t\t\\\n} while (0)\n\n#endif /* !_SYS_QUEUE_H_ */\n"
  },
  {
    "path": "freebsd-headers/sys/racct.h",
    "content": "/*-\n * Copyright (c) 2010 The FreeBSD Foundation\n * All rights reserved.\n *\n * This software was developed by Edward Tomasz Napierala under sponsorship\n * from the FreeBSD Foundation.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/sys/racct.h 226092 2011-10-07 06:46:46Z trasz $\n */\n\n/*\n * Resource accounting.\n */\n\n#ifndef _RACCT_H_\n#define\t_RACCT_H_\n\n#include <sys/cdefs.h>\n#include <sys/queue.h>\n#include <sys/types.h>\n\nstruct proc;\nstruct rctl_rule_link;\nstruct ucred;\n\n/*\n * Resources.\n */\n#define\tRACCT_UNDEFINED\t\t-1\n#define\tRACCT_CPU\t\t0\n#define\tRACCT_DATA\t\t1\n#define\tRACCT_STACK\t\t2\n#define\tRACCT_CORE\t\t3\n#define\tRACCT_RSS\t\t4\n#define\tRACCT_MEMLOCK\t\t5\n#define\tRACCT_NPROC\t\t6\n#define\tRACCT_NOFILE\t\t7\n#define\tRACCT_VMEM\t\t8\n#define\tRACCT_NPTS\t\t9\n#define\tRACCT_SWAP\t\t10\n#define\tRACCT_NTHR\t\t11\n#define\tRACCT_MSGQQUEUED\t12\n#define\tRACCT_MSGQSIZE\t\t13\n#define\tRACCT_NMSGQ\t\t14\n#define\tRACCT_NSEM\t\t15\n#define\tRACCT_NSEMOP\t\t16\n#define\tRACCT_NSHM\t\t17\n#define\tRACCT_SHMSIZE\t\t18\n#define\tRACCT_WALLCLOCK\t\t19\n#define\tRACCT_MAX\t\tRACCT_WALLCLOCK\n\n/*\n * Resource properties.\n */\n#define\tRACCT_IN_MILLIONS\t0x01\n#define\tRACCT_RECLAIMABLE\t0x02\n#define\tRACCT_INHERITABLE\t0x04\n#define\tRACCT_DENIABLE\t\t0x08\n#define\tRACCT_SLOPPY\t\t0x10\n\nextern int racct_types[];\n\n/*\n * Amount stored in c_resources[] is 10**6 times bigger than what's\n * visible to the userland.  It gets fixed up when retrieving resource\n * usage or adding rules.\n */\n#define\tRACCT_IS_IN_MILLIONS(X)\t(racct_types[X] & RACCT_IN_MILLIONS)\n\n/*\n * Resource usage can drop, as opposed to only grow.\n */\n#define\tRACCT_IS_RECLAIMABLE(X)\t(racct_types[X] & RACCT_RECLAIMABLE)\n\n/*\n * Children inherit resource usage.\n */\n#define\tRACCT_IS_INHERITABLE(X)\t(racct_types[X] & RACCT_INHERITABLE)\n\n/*\n * racct_{add,set}(9) can actually return an error and not update resource\n * usage counters.  Note that even when resource is not deniable, allocating\n * resource might cause signals to be sent by RCTL code.\n */\n#define\tRACCT_IS_DENIABLE(X)\t\t(racct_types[X] & RACCT_DENIABLE)\n\n/*\n * Per-process resource usage information makes no sense, but per-credential\n * one does.  This kind of resources are usually allocated for process, but\n * freed using credentials.\n */\n#define\tRACCT_IS_SLOPPY(X)\t\t(racct_types[X] & RACCT_SLOPPY)\n\n/*\n * The 'racct' structure defines resource consumption for a particular\n * subject, such as process or jail.\n *\n * This structure must be filled with zeroes initially.\n */\nstruct racct {\n\tint64_t\t\t\t\tr_resources[RACCT_MAX + 1];\n\tLIST_HEAD(, rctl_rule_link)\tr_rule_links;\n};\n\nint\tracct_add(struct proc *p, int resource, uint64_t amount);\nvoid\tracct_add_cred(struct ucred *cred, int resource, uint64_t amount);\nvoid\tracct_add_force(struct proc *p, int resource, uint64_t amount);\nint\tracct_set(struct proc *p, int resource, uint64_t amount);\nvoid\tracct_set_force(struct proc *p, int resource, uint64_t amount);\nvoid\tracct_sub(struct proc *p, int resource, uint64_t amount);\nvoid\tracct_sub_cred(struct ucred *cred, int resource, uint64_t amount);\nuint64_t\tracct_get_limit(struct proc *p, int resource);\nuint64_t\tracct_get_available(struct proc *p, int resource);\n\nvoid\tracct_create(struct racct **racctp);\nvoid\tracct_destroy(struct racct **racctp);\n\nint\tracct_proc_fork(struct proc *parent, struct proc *child);\nvoid\tracct_proc_fork_done(struct proc *child);\nvoid\tracct_proc_exit(struct proc *p);\n\nvoid\tracct_proc_ucred_changed(struct proc *p, struct ucred *oldcred,\n\t    struct ucred *newcred);\n\n#endif /* !_RACCT_H_ */\n"
  },
  {
    "path": "freebsd-headers/sys/random.h",
    "content": "/*-\n * Copyright (c) 2000 Mark R. V. Murray\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer\n *    in this position and unchanged.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR\n * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES\n * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,\n * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF\n * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/sys/random.h 136433 2004-10-12 14:55:59Z rwatson $\n */\n\n#ifndef\t_SYS_RANDOM_H_\n#define\t_SYS_RANDOM_H_\n\n#ifdef _KERNEL\n\nint read_random(void *, int);\n\n/*\n * Note: if you add or remove members of esource, remember to also update the\n * KASSERT regarding what valid members are in random_harvest_internal().\n */\nenum esource {\n\tRANDOM_START = 0,\n\tRANDOM_WRITE = 0,\n\tRANDOM_KEYBOARD,\n\tRANDOM_MOUSE,\n\tRANDOM_NET,\n\tRANDOM_INTERRUPT,\n\tRANDOM_PURE,\n\tENTROPYSOURCE\n};\nvoid random_harvest(void *, u_int, u_int, u_int, enum esource);\n\n/* Allow the sysadmin to select the broad category of\n * entropy types to harvest\n */\nstruct harvest_select {\n\tint ethernet;\n\tint point_to_point;\n\tint interrupt;\n\tint swi;\n};\n\nextern struct harvest_select harvest;\n\n#endif /* _KERNEL */\n\n#endif /* _SYS_RANDOM_H_ */\n"
  },
  {
    "path": "freebsd-headers/sys/rctl.h",
    "content": "/*-\n * Copyright (c) 2010 The FreeBSD Foundation\n * All rights reserved.\n *\n * This software was developed by Edward Tomasz Napierala under sponsorship\n * from the FreeBSD Foundation.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/sys/rctl.h 221362 2011-05-03 07:32:58Z trasz $\n */\n\n/*\n * Resource Limits.\n */\n\n#ifndef _RCTL_H_\n#define\t_RCTL_H_\n\n#include <sys/cdefs.h>\n#include <sys/queue.h>\n#include <sys/types.h>\n#include <sys/_task.h>\n\nstruct proc;\nstruct uidinfo;\nstruct loginclass;\nstruct prison_racct;\nstruct ucred;\nstruct rctl_rule_link;\n\n#ifdef _KERNEL\n\n/*\n * Rules describe an action to be taken when conditions defined\n * in the rule are met.  There is no global list of rules; instead,\n * rules are linked to by the racct structures for all the subjects\n * they apply to - for example, a rule of type \"user\" is linked to the\n * appropriate struct uidinfo, and to all the processes of that user.\n *\n * 'rr_refcount' is equal to the number of rctl_rule_link structures\n * pointing to the rule.\n *\n * This structure must never change after being added, via rctl_rule_link\n * structures, to subjects.  In order to change a rule, add a new rule\n * and remove the previous one.\n */\nstruct rctl_rule {\n\tint\t\trr_subject_type;\n\tunion {\n\t\tstruct proc\t\t*rs_proc;\n\t\tstruct uidinfo\t\t*rs_uip;\n\t\tstruct loginclass\t*rs_loginclass;\n\t\tstruct prison_racct\t*rs_prison_racct;\n\t} rr_subject;\n\tint\t\trr_per;\n\tint\t\trr_resource;\n\tint\t\trr_action;\n\tint64_t\t\trr_amount;\n\tu_int\t\trr_refcount;\n\tstruct task\trr_task;\n};\n\n/*\n * Allowed values for rr_subject_type and rr_per fields.\n */\n#define\tRCTL_SUBJECT_TYPE_UNDEFINED\t-1\n#define\tRCTL_SUBJECT_TYPE_PROCESS\t0x0000\n#define\tRCTL_SUBJECT_TYPE_USER\t\t0x0001\n#define\tRCTL_SUBJECT_TYPE_LOGINCLASS\t0x0003\n#define\tRCTL_SUBJECT_TYPE_JAIL\t\t0x0004\n#define\tRCTL_SUBJECT_TYPE_MAX\t\tRCTL_SUBJECT_TYPE_JAIL\n\n/*\n * Allowed values for rr_action field.\n */\n#define\tRCTL_ACTION_UNDEFINED\t\t-1\n#define\tRCTL_ACTION_SIGHUP\t\tSIGHUP\n#define\tRCTL_ACTION_SIGINT\t\tSIGINT\n#define\tRCTL_ACTION_SIGQUIT\t\tSIGQUIT\n#define\tRCTL_ACTION_SIGILL\t\tSIGILL\n#define\tRCTL_ACTION_SIGTRAP\t\tSIGTRAP\n#define\tRCTL_ACTION_SIGABRT\t\tSIGABRT\n#define\tRCTL_ACTION_SIGEMT\t\tSIGEMT\n#define\tRCTL_ACTION_SIGFPE\t\tSIGFPE\n#define\tRCTL_ACTION_SIGKILL\t\tSIGKILL\n#define\tRCTL_ACTION_SIGBUS\t\tSIGBUS\n#define\tRCTL_ACTION_SIGSEGV\t\tSIGSEGV\n#define\tRCTL_ACTION_SIGSYS\t\tSIGSYS\n#define\tRCTL_ACTION_SIGPIPE\t\tSIGPIPE\n#define\tRCTL_ACTION_SIGALRM\t\tSIGALRM\n#define\tRCTL_ACTION_SIGTERM\t\tSIGTERM\n#define\tRCTL_ACTION_SIGURG\t\tSIGURG\n#define\tRCTL_ACTION_SIGSTOP\t\tSIGSTOP\n#define\tRCTL_ACTION_SIGTSTP\t\tSIGTSTP\n#define\tRCTL_ACTION_SIGCHLD\t\tSIGCHLD\n#define\tRCTL_ACTION_SIGTTIN\t\tSIGTTIN\n#define\tRCTL_ACTION_SIGTTOU\t\tSIGTTOU\n#define\tRCTL_ACTION_SIGIO\t\tSIGIO\n#define\tRCTL_ACTION_SIGXCPU\t\tSIGXCPU\n#define\tRCTL_ACTION_SIGXFSZ\t\tSIGXFSZ\n#define\tRCTL_ACTION_SIGVTALRM\t\tSIGVTALRM\n#define\tRCTL_ACTION_SIGPROF\t\tSIGPROF\n#define\tRCTL_ACTION_SIGWINCH\t\tSIGWINCH\n#define\tRCTL_ACTION_SIGINFO\t\tSIGINFO\n#define\tRCTL_ACTION_SIGUSR1\t\tSIGUSR1\n#define\tRCTL_ACTION_SIGUSR2\t\tSIGUSR2\n#define\tRCTL_ACTION_SIGTHR\t\tSIGTHR\n#define\tRCTL_ACTION_SIGNAL_MAX\t\tRCTL_ACTION_SIGTHR\n#define\tRCTL_ACTION_DENY\t\t(RCTL_ACTION_SIGNAL_MAX + 1)\n#define\tRCTL_ACTION_LOG\t\t\t(RCTL_ACTION_SIGNAL_MAX + 2)\n#define\tRCTL_ACTION_DEVCTL\t\t(RCTL_ACTION_SIGNAL_MAX + 3)\n#define\tRCTL_ACTION_MAX\t\t\tRCTL_ACTION_DEVCTL\n\n#define\tRCTL_AMOUNT_UNDEFINED\t\t-1\n\nstruct rctl_rule *rctl_rule_alloc(int flags);\nstruct rctl_rule *rctl_rule_duplicate(const struct rctl_rule *rule, int flags);\nvoid\trctl_rule_acquire(struct rctl_rule *rule);\nvoid\trctl_rule_release(struct rctl_rule *rule);\nint\trctl_rule_add(struct rctl_rule *rule);\nint\trctl_rule_remove(struct rctl_rule *filter);\nint\trctl_enforce(struct proc *p, int resource, uint64_t amount);\nuint64_t rctl_get_limit(struct proc *p, int resource);\nuint64_t rctl_get_available(struct proc *p, int resource);\nconst char *rctl_resource_name(int resource);\nvoid\trctl_proc_ucred_changed(struct proc *p, struct ucred *newcred);\nint\trctl_proc_fork(struct proc *parent, struct proc *child);\nvoid\trctl_racct_release(struct racct *racct);\n#else /* !_KERNEL */\n\n/*\n * Syscall interface.\n */\n__BEGIN_DECLS\nint\trctl_get_racct(const char *inbufp, size_t inbuflen, char *outbufp,\n\t    size_t outbuflen);\nint\trctl_get_rules(const char *inbufp, size_t inbuflen, char *outbufp,\n\t    size_t outbuflen);\nint\trctl_get_limits(const char *inbufp, size_t inbuflen, char *outbufp,\n\t    size_t outbuflen);\nint\trctl_add_rule(const char *inbufp, size_t inbuflen, char *outbufp,\n\t    size_t outbuflen);\nint\trctl_remove_rule(const char *inbufp, size_t inbuflen, char *outbufp,\n\t    size_t outbuflen);\n__END_DECLS\n\n#endif /* !_KERNEL */\n\n#endif /* !_RCTL_H_ */\n"
  },
  {
    "path": "freebsd-headers/sys/reboot.h",
    "content": "/*-\n * Copyright (c) 1982, 1986, 1988, 1993, 1994\n *\tThe Regents of the University of California.  All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 4. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t@(#)reboot.h\t8.3 (Berkeley) 12/13/94\n * $FreeBSD: release/9.0.0/sys/sys/reboot.h 139825 2005-01-07 02:29:27Z imp $\n */\n\n#ifndef _SYS_REBOOT_H_\n#define\t_SYS_REBOOT_H_\n\n/*\n * Arguments to reboot system call.  These are passed to\n * the boot program and on to init.\n */\n#define\tRB_AUTOBOOT\t0\t/* flags for system auto-booting itself */\n\n#define\tRB_ASKNAME\t0x001\t/* ask for file name to reboot from */\n#define\tRB_SINGLE\t0x002\t/* reboot to single user only */\n#define\tRB_NOSYNC\t0x004\t/* dont sync before reboot */\n#define\tRB_HALT\t\t0x008\t/* don't reboot, just halt */\n#define\tRB_INITNAME\t0x010\t/* name given for /etc/init (unused) */\n#define\tRB_DFLTROOT\t0x020\t/* use compiled-in rootdev */\n#define\tRB_KDB\t\t0x040\t/* give control to kernel debugger */\n#define\tRB_RDONLY\t0x080\t/* mount root fs read-only */\n#define\tRB_DUMP\t\t0x100\t/* dump kernel memory before reboot */\n#define\tRB_MINIROOT\t0x200\t/* mini-root present in memory at boot time */\n#define\tRB_VERBOSE\t0x800\t/* print all potentially useful info */\n#define\tRB_SERIAL\t0x1000\t/* use serial port as console */\n#define\tRB_CDROM\t0x2000\t/* use cdrom as root */\n#define\tRB_POWEROFF\t0x4000\t/* turn the power off if possible */\n#define\tRB_GDB\t\t0x8000\t/* use GDB remote debugger instead of DDB */\n#define\tRB_MUTE\t\t0x10000\t/* start up with the console muted */\n#define\tRB_SELFTEST\t0x20000\t/* don't complete the boot; do selftest */\n#define\tRB_RESERVED1\t0x40000\t/* reserved for internal use of boot blocks */\n#define\tRB_RESERVED2\t0x80000\t/* reserved for internal use of boot blocks */\n#define\tRB_PAUSE\t0x100000 /* pause after each output line during probe */\n#define\tRB_MULTIPLE\t0x20000000\t/* use multiple consoles */\n\n#define\tRB_BOOTINFO\t0x80000000\t/* have `struct bootinfo *' arg */\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/sys/refcount.h",
    "content": "/*-\n * Copyright (c) 2005 John Baldwin <jhb@FreeBSD.org>\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. Neither the name of the author nor the names of any co-contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/sys/refcount.h 180763 2008-07-23 16:44:20Z des $\n */\n\n#ifndef __SYS_REFCOUNT_H__\n#define __SYS_REFCOUNT_H__\n\n#include <machine/atomic.h>\n\n#ifdef _KERNEL\n#include <sys/systm.h>\n#else\n#define\tKASSERT(exp, msg)\t/* */\n#endif\n\nstatic __inline void\nrefcount_init(volatile u_int *count, u_int value)\n{\n\n\t*count = value;\n}\n\nstatic __inline void\nrefcount_acquire(volatile u_int *count)\n{\n\n\tatomic_add_acq_int(count, 1);\t\n}\n\nstatic __inline int\nrefcount_release(volatile u_int *count)\n{\n\tu_int old;\n\n\t/* XXX: Should this have a rel membar? */\n\told = atomic_fetchadd_int(count, -1);\n\tKASSERT(old > 0, (\"negative refcount %p\", count));\n\treturn (old == 1);\n}\n\n#endif\t/* ! __SYS_REFCOUNT_H__ */\n"
  },
  {
    "path": "freebsd-headers/sys/regression.h",
    "content": "/*-\n * Copyright (c) 2001 Robert N. M. Watson\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/sys/regression.h 129096 2004-05-10 18:38:07Z rwatson $\n */\n#ifndef _SYS_REGRESSION_H_\n#define\t_SYS_REGRESSION_H_\n\n#ifndef _KERNEL\n/*\n * System calls associated with regression testing functions in kernel.\n */\nint\t__setugid(int _flag);\n#endif /* !_KERNEL */\n\n#endif /* !_SYS_REGRESSION_H_ */\n"
  },
  {
    "path": "freebsd-headers/sys/resource.h",
    "content": "/*-\n * Copyright (c) 1982, 1986, 1993\n *\tThe Regents of the University of California.  All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 4. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t@(#)resource.h\t8.4 (Berkeley) 1/9/95\n * $FreeBSD: release/9.0.0/sys/sys/resource.h 210220 2010-07-18 11:13:36Z trasz $\n */\n\n#ifndef _SYS_RESOURCE_H_\n#define\t_SYS_RESOURCE_H_\n\n#include <sys/cdefs.h>\n#include <sys/_timeval.h>\n#include <sys/_types.h>\n\n/*\n * Process priority specifications to get/setpriority.\n */\n#define\tPRIO_MIN\t-20\n#define\tPRIO_MAX\t20\n\n#define\tPRIO_PROCESS\t0\n#define\tPRIO_PGRP\t1\n#define\tPRIO_USER\t2\n\n/*\n * Resource utilization information.\n *\n * All fields are only modified by curthread and\n * no locks are required to read.\n */\n\n#define\tRUSAGE_SELF\t0\n#define\tRUSAGE_CHILDREN\t-1\n#define\tRUSAGE_THREAD\t1\n\nstruct rusage {\n\tstruct timeval ru_utime;\t/* user time used */\n\tstruct timeval ru_stime;\t/* system time used */\n\tlong\tru_maxrss;\t\t/* max resident set size */\n#define\tru_first\tru_ixrss\n\tlong\tru_ixrss;\t\t/* integral shared memory size */\n\tlong\tru_idrss;\t\t/* integral unshared data \" */\n\tlong\tru_isrss;\t\t/* integral unshared stack \" */\n\tlong\tru_minflt;\t\t/* page reclaims */\n\tlong\tru_majflt;\t\t/* page faults */\n\tlong\tru_nswap;\t\t/* swaps */\n\tlong\tru_inblock;\t\t/* block input operations */\n\tlong\tru_oublock;\t\t/* block output operations */\n\tlong\tru_msgsnd;\t\t/* messages sent */\n\tlong\tru_msgrcv;\t\t/* messages received */\n\tlong\tru_nsignals;\t\t/* signals received */\n\tlong\tru_nvcsw;\t\t/* voluntary context switches */\n\tlong\tru_nivcsw;\t\t/* involuntary \" */\n#define\tru_last\t\tru_nivcsw\n};\n\n/*\n * Resource limits\n */\n#define\tRLIMIT_CPU\t0\t\t/* maximum cpu time in seconds */\n#define\tRLIMIT_FSIZE\t1\t\t/* maximum file size */\n#define\tRLIMIT_DATA\t2\t\t/* data size */\n#define\tRLIMIT_STACK\t3\t\t/* stack size */\n#define\tRLIMIT_CORE\t4\t\t/* core file size */\n#define\tRLIMIT_RSS\t5\t\t/* resident set size */\n#define\tRLIMIT_MEMLOCK\t6\t\t/* locked-in-memory address space */\n#define\tRLIMIT_NPROC\t7\t\t/* number of processes */\n#define\tRLIMIT_NOFILE\t8\t\t/* number of open files */\n#define\tRLIMIT_SBSIZE\t9\t\t/* maximum size of all socket buffers */\n#define\tRLIMIT_VMEM\t10\t\t/* virtual process size (incl. mmap) */\n#define\tRLIMIT_AS\tRLIMIT_VMEM\t/* standard name for RLIMIT_VMEM */\n#define\tRLIMIT_NPTS\t11\t\t/* pseudo-terminals */\n#define\tRLIMIT_SWAP\t12\t\t/* swap used */\n\n#define\tRLIM_NLIMITS\t13\t\t/* number of resource limits */\n\n#define\tRLIM_INFINITY\t((rlim_t)(((uint64_t)1 << 63) - 1))\n/* XXX Missing: RLIM_SAVED_MAX, RLIM_SAVED_CUR */\n\n\n/*\n * Resource limit string identifiers\n */\n\n#ifdef _RLIMIT_IDENT\nstatic char *rlimit_ident[RLIM_NLIMITS] = {\n\t\"cpu\",\n\t\"fsize\",\n\t\"data\",\n\t\"stack\",\n\t\"core\",\n\t\"rss\",\n\t\"memlock\",\n\t\"nproc\",\n\t\"nofile\",\n\t\"sbsize\",\n\t\"vmem\",\n\t\"npts\",\n\t\"swap\",\n};\n#endif\n\n#ifndef _RLIM_T_DECLARED\ntypedef\t__rlim_t\trlim_t;\n#define\t_RLIM_T_DECLARED\n#endif\n\nstruct rlimit {\n\trlim_t\trlim_cur;\t\t/* current (soft) limit */\n\trlim_t\trlim_max;\t\t/* maximum value for rlim_cur */\n};\n\n#if __BSD_VISIBLE\n\nstruct orlimit {\n\t__int32_t\trlim_cur;\t/* current (soft) limit */\n\t__int32_t\trlim_max;\t/* maximum value for rlim_cur */\n};\n\nstruct loadavg {\n\t__fixpt_t\tldavg[3];\n\tlong\t\tfscale;\n};\n\n#define\tCP_USER\t\t0\n#define\tCP_NICE\t\t1\n#define\tCP_SYS\t\t2\n#define\tCP_INTR\t\t3\n#define\tCP_IDLE\t\t4\n#define\tCPUSTATES\t5\n\n#endif\t/* __BSD_VISIBLE */\n\n#ifdef _KERNEL\n\nextern struct loadavg averunnable;\nvoid\tread_cpu_time(long *cp_time);\t/* Writes array of CPUSTATES */\n\n#else\n\n__BEGIN_DECLS\n/* XXX 2nd arg to [gs]etpriority() should be an id_t */\nint\tgetpriority(int, int);\nint\tgetrlimit(int, struct rlimit *);\nint\tgetrusage(int, struct rusage *);\nint\tsetpriority(int, int, int);\nint\tsetrlimit(int, const struct rlimit *);\n__END_DECLS\n\n#endif\t/* _KERNEL */\n#endif\t/* !_SYS_RESOURCE_H_ */\n"
  },
  {
    "path": "freebsd-headers/sys/resourcevar.h",
    "content": "/*-\n * Copyright (c) 1991, 1993\n *\tThe Regents of the University of California.  All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 4. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t@(#)resourcevar.h\t8.4 (Berkeley) 1/9/95\n * $FreeBSD: release/9.0.0/sys/sys/resourcevar.h 224188 2011-07-18 17:33:08Z jhb $\n */\n\n#ifndef\t_SYS_RESOURCEVAR_H_\n#define\t_SYS_RESOURCEVAR_H_\n\n#include <sys/resource.h>\n#include <sys/queue.h>\n#ifdef _KERNEL\n#include <sys/_lock.h>\n#include <sys/_mutex.h>\n#endif\n\n/*\n * Kernel per-process accounting / statistics\n * (not necessarily resident except when running).\n *\n * Locking key:\n *      b - created at fork, never changes\n *      c - locked by proc mtx\n *      j - locked by proc slock\n *      k - only accessed by curthread\n */\nstruct pstats {\n#define\tpstat_startzero\tp_cru\n\tstruct\trusage p_cru;\t\t/* Stats for reaped children. */\n\tstruct\titimerval p_timer[3];\t/* (j) Virtual-time timers. */\n#define\tpstat_endzero\tpstat_startcopy\n\n#define\tpstat_startcopy\tp_prof\n\tstruct uprof {\t\t\t/* Profile arguments. */\n\t\tcaddr_t\tpr_base;\t/* (c + j) Buffer base. */\n\t\tu_long\tpr_size;\t/* (c + j) Buffer size. */\n\t\tu_long\tpr_off;\t\t/* (c + j) PC offset. */\n\t\tu_long\tpr_scale;\t/* (c + j) PC scaling. */\n\t} p_prof;\n#define\tpstat_endcopy\tp_start\n\tstruct\ttimeval p_start;\t/* (b) Starting time. */\n};\n\n#ifdef _KERNEL\n\n/*\n * Kernel shareable process resource limits.  Because this structure\n * is moderately large but changes infrequently, it is normally\n * shared copy-on-write after forks.\n */\nstruct plimit {\n\tstruct\trlimit pl_rlimit[RLIM_NLIMITS];\n\tint\tpl_refcnt;\t\t/* number of references */\n};\n\nstruct racct;\n\n/*-\n * Per uid resource consumption.  This structure is used to track\n * the total resource consumption (process count, socket buffer size,\n * etc) for the uid and impose limits.\n *\n * Locking guide:\n * (a) Constant from inception\n * (b) Lockless, updated using atomics\n * (c) Locked by global uihashtbl_mtx\n * (d) Locked by the ui_vmsize_mtx\n */\nstruct uidinfo {\n\tLIST_ENTRY(uidinfo) ui_hash;\t/* (c) hash chain of uidinfos */\n\tstruct mtx ui_vmsize_mtx;\n\tvm_ooffset_t ui_vmsize;\t\t/* (d) swap reservation by uid */\n\tlong\tui_sbsize;\t\t/* (b) socket buffer space consumed */\n\tlong\tui_proccnt;\t\t/* (b) number of processes */\n\tlong\tui_ptscnt;\t\t/* (b) number of pseudo-terminals */\n\tuid_t\tui_uid;\t\t\t/* (a) uid */\n\tu_int\tui_ref;\t\t\t/* (b) reference count */\n\tstruct racct *ui_racct;\t\t/* (a) resource accounting */\n};\n\n#define\tUIDINFO_VMSIZE_LOCK(ui)\t\tmtx_lock(&((ui)->ui_vmsize_mtx))\n#define\tUIDINFO_VMSIZE_UNLOCK(ui)\tmtx_unlock(&((ui)->ui_vmsize_mtx))\n\nstruct proc;\nstruct rusage_ext;\nstruct thread;\n\nvoid\t addupc_intr(struct thread *td, uintfptr_t pc, u_int ticks);\nvoid\t addupc_task(struct thread *td, uintfptr_t pc, u_int ticks);\nvoid\t calccru(struct proc *p, struct timeval *up, struct timeval *sp);\nvoid\t calcru(struct proc *p, struct timeval *up, struct timeval *sp);\nint\t chgproccnt(struct uidinfo *uip, int diff, rlim_t maxval);\nint\t chgsbsize(struct uidinfo *uip, u_int *hiwat, u_int to,\n\t    rlim_t maxval);\nint\t chgptscnt(struct uidinfo *uip, int diff, rlim_t maxval);\nint\t fuswintr(void *base);\nstruct plimit\n\t*lim_alloc(void);\nvoid\t lim_copy(struct plimit *dst, struct plimit *src);\nrlim_t\t lim_cur(struct proc *p, int which);\nvoid\t lim_fork(struct proc *p1, struct proc *p2);\nvoid\t lim_free(struct plimit *limp);\nstruct plimit\n\t*lim_hold(struct plimit *limp);\nrlim_t\t lim_max(struct proc *p, int which);\nvoid\t lim_rlimit(struct proc *p, int which, struct rlimit *rlp);\nvoid\t ruadd(struct rusage *ru, struct rusage_ext *rux, struct rusage *ru2,\n\t    struct rusage_ext *rux2);\nvoid\t rucollect(struct rusage *ru, struct rusage *ru2);\nvoid\t rufetch(struct proc *p, struct rusage *ru);\nvoid\t rufetchcalc(struct proc *p, struct rusage *ru, struct timeval *up,\n\t    struct timeval *sp);\nvoid\t rufetchtd(struct thread *td, struct rusage *ru);\nvoid\t ruxagg(struct proc *p, struct thread *td);\nint\t suswintr(void *base, int word);\nstruct uidinfo\n\t*uifind(uid_t uid);\nvoid\t uifree(struct uidinfo *uip);\nvoid\t uihashinit(void);\nvoid\t uihold(struct uidinfo *uip);\nvoid\t ui_racct_foreach(void (*callback)(struct racct *racct,\n\t    void *arg2, void *arg3), void *arg2, void *arg3);\n\n#endif /* _KERNEL */\n#endif /* !_SYS_RESOURCEVAR_H_ */\n"
  },
  {
    "path": "freebsd-headers/sys/rman.h",
    "content": "/*-\n * Copyright 1998 Massachusetts Institute of Technology\n *\n * Permission to use, copy, modify, and distribute this software and\n * its documentation for any purpose and without fee is hereby\n * granted, provided that both the above copyright notice and this\n * permission notice appear in all copies, that both the above\n * copyright notice and this permission notice appear in all\n * supporting documentation, and that the name of M.I.T. not be used\n * in advertising or publicity pertaining to distribution of the\n * software without specific, written prior permission.  M.I.T. makes\n * no representations about the suitability of this software for any\n * purpose.  It is provided \"as is\" without express or implied\n * warranty.\n * \n * THIS SOFTWARE IS PROVIDED BY M.I.T. ``AS IS''.  M.I.T. DISCLAIMS\n * ALL EXPRESS OR IMPLIED WARRANTIES WITH REGARD TO THIS SOFTWARE,\n * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF\n * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT\n * SHALL M.I.T. BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF\n * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\n * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,\n * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT\n * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/sys/rman.h 221220 2011-04-29 20:05:19Z jhb $\n */\n\n#ifndef _SYS_RMAN_H_\n#define\t_SYS_RMAN_H_\t1\n\n#ifndef\t_KERNEL\n#include <sys/queue.h>\n#else\n#include <machine/_bus.h>\n#include <machine/resource.h>\n#endif\n\n#define\tRF_ALLOCATED\t0x0001\t/* resource has been reserved */\n#define\tRF_ACTIVE\t0x0002\t/* resource allocation has been activated */\n#define\tRF_SHAREABLE\t0x0004\t/* resource permits contemporaneous sharing */\n#define\tRF_TIMESHARE\t0x0008\t/* resource permits time-division sharing */\n#define\tRF_WANTED\t0x0010\t/* somebody is waiting for this resource */\n#define\tRF_FIRSTSHARE\t0x0020\t/* first in sharing list */\n#define\tRF_PREFETCHABLE\t0x0040\t/* resource is prefetchable */\n#define\tRF_OPTIONAL\t0x0080\t/* for bus_alloc_resources() */\n\n#define\tRF_ALIGNMENT_SHIFT\t10 /* alignment size bit starts bit 10 */\n#define\tRF_ALIGNMENT_MASK\t(0x003F << RF_ALIGNMENT_SHIFT)\n\t\t\t\t/* resource address alignemnt size bit mask */\n#define\tRF_ALIGNMENT_LOG2(x)\t((x) << RF_ALIGNMENT_SHIFT)\n#define\tRF_ALIGNMENT(x)\t\t(((x) & RF_ALIGNMENT_MASK) >> RF_ALIGNMENT_SHIFT)\n\nenum\trman_type { RMAN_UNINIT = 0, RMAN_GAUGE, RMAN_ARRAY };\n\n/*\n * String length exported to userspace for resource names, etc.\n */\n#define RM_TEXTLEN\t32\n\n/*\n * Userspace-exported structures.\n */\nstruct u_resource {\n\tuintptr_t\tr_handle;\t\t/* resource uniquifier */\n\tuintptr_t\tr_parent;\t\t/* parent rman */\n\tuintptr_t\tr_device;\t\t/* device owning this resource */\n\tchar\t\tr_devname[RM_TEXTLEN];\t/* device name XXX obsolete */\n\n\tu_long\t\tr_start;\t\t/* offset in resource space */\n\tu_long\t\tr_size;\t\t\t/* size in resource space */\n\tu_int\t\tr_flags;\t\t/* RF_* flags */\n};\n\nstruct u_rman {\n\tuintptr_t\trm_handle;\t\t/* rman uniquifier */\n\tchar\t\trm_descr[RM_TEXTLEN];\t/* rman description */\n\n\tu_long\t\trm_start;\t\t/* base of managed region */\n\tu_long\t\trm_size;\t\t/* size of managed region */\n\tenum rman_type\trm_type;\t\t/* region type */\n};\n\n#ifdef _KERNEL\n\n/*\n * The public (kernel) view of struct resource\n *\n * NB: Changing the offset/size/type of existing fields in struct resource\n * NB: breaks the device driver ABI and is strongly FORBIDDEN.\n * NB: Appending new fields is probably just misguided.\n */\n\nstruct resource {\n\tstruct resource_i\t*__r_i;\n\tbus_space_tag_t\t\tr_bustag; /* bus_space tag */\n\tbus_space_handle_t\tr_bushandle;\t/* bus_space handle */\n};\n\nstruct resource_i;\n\nTAILQ_HEAD(resource_head, resource_i);\n\nstruct rman {\n\tstruct\tresource_head \trm_list;\n\tstruct\tmtx *rm_mtx;\t/* mutex used to protect rm_list */\n\tTAILQ_ENTRY(rman)\trm_link; /* link in list of all rmans */\n\tu_long\trm_start;\t/* index of globally first entry */\n\tu_long\trm_end;\t\t/* index of globally last entry */\n\tenum\trman_type rm_type; /* what type of resource this is */\n\tconst\tchar *rm_descr;\t/* text descripion of this resource */\n};\nTAILQ_HEAD(rman_head, rman);\n\nint\trman_activate_resource(struct resource *r);\nint\trman_adjust_resource(struct resource *r, u_long start, u_long end);\nint\trman_await_resource(struct resource *r, int pri, int timo);\nint\trman_first_free_region(struct rman *rm, u_long *start, u_long *end);\nbus_space_handle_t rman_get_bushandle(struct resource *);\nbus_space_tag_t rman_get_bustag(struct resource *);\nu_long\trman_get_end(struct resource *);\nstruct device *rman_get_device(struct resource *);\nu_int\trman_get_flags(struct resource *);\nint\trman_get_rid(struct resource *);\nu_long\trman_get_size(struct resource *);\nu_long\trman_get_start(struct resource *);\nvoid   *rman_get_virtual(struct resource *);\nint\trman_deactivate_resource(struct resource *r);\nint\trman_fini(struct rman *rm);\nint\trman_init(struct rman *rm);\nint\trman_init_from_resource(struct rman *rm, struct resource *r);\nint\trman_last_free_region(struct rman *rm, u_long *start, u_long *end);\nuint32_t rman_make_alignment_flags(uint32_t size);\nint\trman_manage_region(struct rman *rm, u_long start, u_long end);\nint\trman_is_region_manager(struct resource *r, struct rman *rm);\nint\trman_release_resource(struct resource *r);\nstruct resource *rman_reserve_resource(struct rman *rm, u_long start,\n\t\t\t\t\tu_long end, u_long count,\n\t\t\t\t\tu_int flags, struct device *dev);\nstruct resource *rman_reserve_resource_bound(struct rman *rm, u_long start,\n\t\t\t\t\tu_long end, u_long count, u_long bound,\n\t\t\t\t\tu_int flags, struct device *dev);\nvoid\trman_set_bushandle(struct resource *_r, bus_space_handle_t _h);\nvoid\trman_set_bustag(struct resource *_r, bus_space_tag_t _t);\nvoid\trman_set_device(struct resource *_r, struct device *_dev);\nvoid\trman_set_end(struct resource *_r, u_long _end);\nvoid\trman_set_rid(struct resource *_r, int _rid);\nvoid\trman_set_start(struct resource *_r, u_long _start);\nvoid\trman_set_virtual(struct resource *_r, void *_v);\n\nextern\tstruct rman_head rman_head;\n\n#endif /* _KERNEL */\n\n#endif /* !_SYS_RMAN_H_ */\n"
  },
  {
    "path": "freebsd-headers/sys/rmlock.h",
    "content": "/*-\n * Copyright (c) 2007 Stephan Uphoff <ups@FreeBSD.org>\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. Neither the name of the author nor the names of any co-contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/sys/rmlock.h 212112 2010-09-01 19:50:03Z mlaier $\n */\n\n#ifndef _SYS_RMLOCK_H_\n#define _SYS_RMLOCK_H_\n\n#include <sys/mutex.h>\n#include <sys/sx.h>\n#include <sys/_lock.h>\n#include <sys/_rmlock.h>\n\n#ifdef _KERNEL\n\n/*\n * Flags passed to rm_init(9).\n */\n#define\tRM_NOWITNESS\t0x00000001\n#define\tRM_RECURSE\t0x00000002\n#define\tRM_SLEEPABLE\t0x00000004\n\nvoid\trm_init(struct rmlock *rm, const char *name);\nvoid\trm_init_flags(struct rmlock *rm, const char *name, int opts);\nvoid\trm_destroy(struct rmlock *rm);\nint\trm_wowned(struct rmlock *rm);\nvoid\trm_sysinit(void *arg);\nvoid\trm_sysinit_flags(void *arg);\n\nvoid\t_rm_wlock_debug(struct rmlock *rm, const char *file, int line);\nvoid\t_rm_wunlock_debug(struct rmlock *rm, const char *file, int line);\nint\t_rm_rlock_debug(struct rmlock *rm, struct rm_priotracker *tracker,\n\t    int trylock, const char *file, int line);\nvoid\t_rm_runlock_debug(struct rmlock *rm,  struct rm_priotracker *tracker,\n\t    const char *file, int line);\n\nvoid\t_rm_wlock(struct rmlock *rm);\nvoid\t_rm_wunlock(struct rmlock *rm);\nint\t_rm_rlock(struct rmlock *rm, struct rm_priotracker *tracker,\n\t    int trylock);\nvoid\t_rm_runlock(struct rmlock *rm,  struct rm_priotracker *tracker);\n\n/*\n * Public interface for lock operations.\n */\n#ifndef LOCK_DEBUG\n#error LOCK_DEBUG not defined, include <sys/lock.h> before <sys/rmlock.h>\n#endif\n\n#if LOCK_DEBUG > 0\n#define\trm_wlock(rm)\t_rm_wlock_debug((rm), LOCK_FILE, LOCK_LINE)\n#define\trm_wunlock(rm)\t_rm_wunlock_debug((rm), LOCK_FILE, LOCK_LINE)\n#define\trm_rlock(rm,tracker)  \\\n    ((void)_rm_rlock_debug((rm),(tracker), 0, LOCK_FILE, LOCK_LINE ))\n#define\trm_try_rlock(rm,tracker)  \\\n    _rm_rlock_debug((rm),(tracker), 1, LOCK_FILE, LOCK_LINE )\n#define\trm_runlock(rm,tracker)\t\\\n    _rm_runlock_debug((rm), (tracker), LOCK_FILE, LOCK_LINE )\n#else\n#define\trm_wlock(rm)\t\t\t_rm_wlock((rm))\n#define\trm_wunlock(rm)\t\t\t_rm_wunlock((rm))\n#define\trm_rlock(rm,tracker)\t\t((void)_rm_rlock((rm),(tracker), 0))\n#define\trm_try_rlock(rm,tracker)\t_rm_rlock((rm),(tracker), 1)\n#define\trm_runlock(rm,tracker)\t\t_rm_runlock((rm), (tracker))\n#endif\n\nstruct rm_args {\n\tstruct rmlock\t*ra_rm;\n\tconst char \t*ra_desc;\n};\n\nstruct rm_args_flags {\n\tstruct rmlock\t*ra_rm;\n\tconst char \t*ra_desc;\n\tint\t\tra_opts;\n};\n\n#define\tRM_SYSINIT(name, rm, desc)       \t\t\t\t\\\n\tstatic struct rm_args name##_args = {\t\t\t\t\\\n\t\t(rm),\t\t\t\t\t\t\t\\\n\t\t(desc),\t\t\t\t\t\t\t\\\n\t};\t\t\t\t\t\t\t\t\\\n\tSYSINIT(name##_rm_sysinit, SI_SUB_LOCK, SI_ORDER_MIDDLE,\t\\\n\t    rm_sysinit, &name##_args);\t\t\t\t\t\\\n\tSYSUNINIT(name##_rm_sysuninit, SI_SUB_LOCK, SI_ORDER_MIDDLE,\t\\\n\t    rm_destroy, (rm))\n\n\n#define\tRM_SYSINIT_FLAGS(name, rm, desc, opts)       \t\t\t\\\n\tstatic struct rm_args name##_args = {\t\t\t\t\\\n\t\t(rm),\t\t\t\t\t\t\t\\\n\t\t(desc),\t\t\t\t\t\t\t\\\n                (opts),\t\t\t\t\t\t\t\\\n\t};\t\t\t\t\t\t\t\t\\\n\tSYSINIT(name##_rm_sysinit, SI_SUB_LOCK, SI_ORDER_MIDDLE,\t\\\n\t    rm_sysinit_flags, &name##_args);\t\t\t\t\\\n\tSYSUNINIT(name##_rm_sysuninit, SI_SUB_LOCK, SI_ORDER_MIDDLE,\t\\\n\t    rm_destroy, (rm))\n\n#endif /* _KERNEL */\n#endif /* !_SYS_RMLOCK_H_ */\n"
  },
  {
    "path": "freebsd-headers/sys/rtprio.h",
    "content": "/*-\n * Copyright (c) 1994, Henrik Vestergaard Draboel\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. All advertising materials mentioning features or use of this software\n *    must display the following acknowledgement:\n *\tThis product includes software developed by Henrik Vestergaard Draboel.\n * 4. The name of the author may not be used to endorse or promote products\n *    derived from this software without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/sys/rtprio.h 165898 2007-01-08 21:21:45Z imp $\n */\n\n#ifndef _SYS_RTPRIO_H_\n#define _SYS_RTPRIO_H_\n\n#include <sys/priority.h>\n\n/*\n * Process realtime-priority specifications to rtprio.\n */\n\n/* priority types.  Start at 1 to catch uninitialized fields. */\n\n#define RTP_PRIO_REALTIME\tPRI_REALTIME\t/* real time process */\n#define RTP_PRIO_NORMAL\t\tPRI_TIMESHARE\t/* time sharing process */\n#define RTP_PRIO_IDLE\t\tPRI_IDLE\t/* idle process */\n\n/* RTP_PRIO_FIFO is POSIX.1B SCHED_FIFO.\n */\n\n#define RTP_PRIO_FIFO_BIT\tPRI_FIFO_BIT\n#define RTP_PRIO_FIFO\t\tPRI_FIFO\n#define RTP_PRIO_BASE(P)\tPRI_BASE(P)\n#define RTP_PRIO_IS_REALTIME(P) PRI_IS_REALTIME(P)\n#define RTP_PRIO_NEED_RR(P)\tPRI_NEED_RR(P)\n\n/* priority range */\n#define RTP_PRIO_MIN\t\t0\t/* Highest priority */\n#define RTP_PRIO_MAX\t\t31\t/* Lowest priority */\n\n/*\n * rtprio() syscall functions\n */\n#define RTP_LOOKUP\t\t0\n#define RTP_SET\t\t\t1\n\n#ifndef LOCORE\n/*\n * Scheduling class information.\n */\nstruct rtprio {\n\tu_short type;\t\t\t/* scheduling class */\n\tu_short prio;\n};\n\n#ifdef _KERNEL\nstruct thread;\nint\trtp_to_pri(struct rtprio *, struct thread *);\nvoid\tpri_to_rtp(struct thread *, struct rtprio *);\n#endif\n#endif\n\n#ifndef _KERNEL\n#include <sys/cdefs.h>\n\n__BEGIN_DECLS\nint\trtprio(int, pid_t, struct rtprio *);\nint\trtprio_thread(int, lwpid_t, struct rtprio *);\n__END_DECLS\n#endif\t/* !_KERNEL */\n#endif\t/* !_SYS_RTPRIO_H_ */\n"
  },
  {
    "path": "freebsd-headers/sys/runq.h",
    "content": "/*-\n * Copyright (c) 2001 Jake Burkholder <jake@FreeBSD.org>\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/sys/runq.h 177435 2008-03-20 05:51:16Z jeff $\n */\n\n#ifndef\t_RUNQ_H_\n#define\t_RUNQ_H_\n\n#include <machine/runq.h>\n\nstruct thread;\n\n/*\n * Run queue parameters.\n */\n\n#define\tRQ_NQS\t\t(64)\t\t/* Number of run queues. */\n#define\tRQ_PPQ\t\t(4)\t\t/* Priorities per queue. */\n\n/*\n * Head of run queues.\n */\nTAILQ_HEAD(rqhead, thread);\n\n/*\n * Bit array which maintains the status of a run queue.  When a queue is\n * non-empty the bit corresponding to the queue number will be set.\n */\nstruct rqbits {\n\trqb_word_t rqb_bits[RQB_LEN];\n};\n\n/*\n * Run queue structure.  Contains an array of run queues on which processes\n * are placed, and a structure to maintain the status of each queue.\n */\nstruct runq {\n\tstruct\trqbits rq_status;\n\tstruct\trqhead rq_queues[RQ_NQS];\n};\n\nvoid\trunq_add(struct runq *, struct thread *, int);\nvoid\trunq_add_pri(struct runq *, struct thread *, u_char, int);\nint\trunq_check(struct runq *);\nstruct\tthread *runq_choose(struct runq *);\nstruct\tthread *runq_choose_from(struct runq *, u_char);\nstruct\tthread *runq_choose_fuzz(struct runq *, int);\nvoid\trunq_init(struct runq *);\nvoid\trunq_remove(struct runq *, struct thread *);\nvoid\trunq_remove_idx(struct runq *, struct thread *, u_char *);\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/sys/rwlock.h",
    "content": "/*-\n * Copyright (c) 2006 John Baldwin <jhb@FreeBSD.org>\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. Neither the name of the author nor the names of any co-contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/sys/rwlock.h 197643 2009-09-30 13:26:31Z attilio $\n */\n\n#ifndef _SYS_RWLOCK_H_\n#define _SYS_RWLOCK_H_\n\n#include <sys/_lock.h>\n#include <sys/_rwlock.h>\n#include <sys/lock_profile.h>\n#include <sys/lockstat.h>\n\n#ifdef _KERNEL\n#include <sys/pcpu.h>\n#include <machine/atomic.h>\n#endif\n\n/*\n * The rw_lock field consists of several fields.  The low bit indicates\n * if the lock is locked with a read (shared) or write (exclusive) lock.\n * A value of 0 indicates a write lock, and a value of 1 indicates a read\n * lock.  Bit 1 is a boolean indicating if there are any threads waiting\n * for a read lock.  Bit 2 is a boolean indicating if there are any threads\n * waiting for a write lock.  The rest of the variable's definition is\n * dependent on the value of the first bit.  For a write lock, it is a\n * pointer to the thread holding the lock, similar to the mtx_lock field of\n * mutexes.  For read locks, it is a count of read locks that are held.\n *\n * When the lock is not locked by any thread, it is encoded as a read lock\n * with zero waiters.\n */\n\n#define\tRW_LOCK_READ\t\t0x01\n#define\tRW_LOCK_READ_WAITERS\t0x02\n#define\tRW_LOCK_WRITE_WAITERS\t0x04\n#define\tRW_LOCK_WRITE_SPINNER\t0x08\n#define\tRW_LOCK_FLAGMASK\t\t\t\t\t\t\\\n\t(RW_LOCK_READ | RW_LOCK_READ_WAITERS | RW_LOCK_WRITE_WAITERS |\t\\\n\tRW_LOCK_WRITE_SPINNER)\n#define\tRW_LOCK_WAITERS\t\t(RW_LOCK_READ_WAITERS | RW_LOCK_WRITE_WAITERS)\n\n#define\tRW_OWNER(x)\t\t((x) & ~RW_LOCK_FLAGMASK)\n#define\tRW_READERS_SHIFT\t4\n#define\tRW_READERS(x)\t\t(RW_OWNER((x)) >> RW_READERS_SHIFT)\n#define\tRW_READERS_LOCK(x)\t((x) << RW_READERS_SHIFT | RW_LOCK_READ)\n#define\tRW_ONE_READER\t\t(1 << RW_READERS_SHIFT)\n\n#define\tRW_UNLOCKED\t\tRW_READERS_LOCK(0)\n#define\tRW_DESTROYED\t\t(RW_LOCK_READ_WAITERS | RW_LOCK_WRITE_WAITERS)\n\n#ifdef _KERNEL\n\n#define\trw_recurse\tlock_object.lo_data\n\n/* Very simple operations on rw_lock. */\n\n/* Try to obtain a write lock once. */\n#define\t_rw_write_lock(rw, tid)\t\t\t\t\t\t\\\n\tatomic_cmpset_acq_ptr(&(rw)->rw_lock, RW_UNLOCKED, (tid))\n\n/* Release a write lock quickly if there are no waiters. */\n#define\t_rw_write_unlock(rw, tid)\t\t\t\t\t\\\n\tatomic_cmpset_rel_ptr(&(rw)->rw_lock, (tid), RW_UNLOCKED)\n\n/*\n * Full lock operations that are suitable to be inlined in non-debug\n * kernels.  If the lock cannot be acquired or released trivially then\n * the work is deferred to another function.\n */\n\n/* Acquire a write lock. */\n#define\t__rw_wlock(rw, tid, file, line) do {\t\t\t\t\\\n\tuintptr_t _tid = (uintptr_t)(tid);\t\t\t\t\\\n\t\t\t\t\t\t                        \\\n\tif (!_rw_write_lock((rw), _tid))\t\t\t\t\\\n\t\t_rw_wlock_hard((rw), _tid, (file), (line));\t\t\\\n\telse \t\t\t\t\t\t\t\t\\\n\t\tLOCKSTAT_PROFILE_OBTAIN_LOCK_SUCCESS(LS_RW_WLOCK_ACQUIRE, \\\n\t\t    rw, 0, 0, (file), (line));\t\t\t\t\\\n} while (0)\n\n/* Release a write lock. */\n#define\t__rw_wunlock(rw, tid, file, line) do {\t\t\t\t\\\n\tuintptr_t _tid = (uintptr_t)(tid);\t\t\t\t\\\n\t\t\t\t\t\t\t\t\t\\\n\tif ((rw)->rw_recurse)\t\t\t\t\t\t\\\n\t\t(rw)->rw_recurse--;\t\t\t\t\t\\\n\telse if (!_rw_write_unlock((rw), _tid))\t\t\t\t\\\n\t\t_rw_wunlock_hard((rw), _tid, (file), (line));\t\t\\\n} while (0)\n\n/*\n * Function prototypes.  Routines that start with _ are not part of the\n * external API and should not be called directly.  Wrapper macros should\n * be used instead.\n */\n\n#define\trw_init(rw, name)\trw_init_flags((rw), (name), 0)\nvoid\trw_init_flags(struct rwlock *rw, const char *name, int opts);\nvoid\trw_destroy(struct rwlock *rw);\nvoid\trw_sysinit(void *arg);\nvoid\trw_sysinit_flags(void *arg);\nint\trw_wowned(struct rwlock *rw);\nvoid\t_rw_wlock(struct rwlock *rw, const char *file, int line);\nint\t_rw_try_wlock(struct rwlock *rw, const char *file, int line);\nvoid\t_rw_wunlock(struct rwlock *rw, const char *file, int line);\nvoid\t_rw_rlock(struct rwlock *rw, const char *file, int line);\nint\t_rw_try_rlock(struct rwlock *rw, const char *file, int line);\nvoid\t_rw_runlock(struct rwlock *rw, const char *file, int line);\nvoid\t_rw_wlock_hard(struct rwlock *rw, uintptr_t tid, const char *file,\n\t    int line);\nvoid\t_rw_wunlock_hard(struct rwlock *rw, uintptr_t tid, const char *file,\n\t    int line);\nint\t_rw_try_upgrade(struct rwlock *rw, const char *file, int line);\nvoid\t_rw_downgrade(struct rwlock *rw, const char *file, int line);\n#if defined(INVARIANTS) || defined(INVARIANT_SUPPORT)\nvoid\t_rw_assert(struct rwlock *rw, int what, const char *file, int line);\n#endif\n\n/*\n * Public interface for lock operations.\n */\n\n#ifndef LOCK_DEBUG\n#error LOCK_DEBUG not defined, include <sys/lock.h> before <sys/rwlock.h>\n#endif\n#if LOCK_DEBUG > 0 || defined(RWLOCK_NOINLINE)\n#define\trw_wlock(rw)\t\t_rw_wlock((rw), LOCK_FILE, LOCK_LINE)\n#define\trw_wunlock(rw)\t\t_rw_wunlock((rw), LOCK_FILE, LOCK_LINE)\n#else\n#define\trw_wlock(rw)\t\t\t\t\t\t\t\\\n\t__rw_wlock((rw), curthread, LOCK_FILE, LOCK_LINE)\n#define\trw_wunlock(rw)\t\t\t\t\t\t\t\\\n\t__rw_wunlock((rw), curthread, LOCK_FILE, LOCK_LINE)\n#endif\n#define\trw_rlock(rw)\t\t_rw_rlock((rw), LOCK_FILE, LOCK_LINE)\n#define\trw_runlock(rw)\t\t_rw_runlock((rw), LOCK_FILE, LOCK_LINE)\n#define\trw_try_rlock(rw)\t_rw_try_rlock((rw), LOCK_FILE, LOCK_LINE)\n#define\trw_try_upgrade(rw)\t_rw_try_upgrade((rw), LOCK_FILE, LOCK_LINE)\n#define\trw_try_wlock(rw)\t_rw_try_wlock((rw), LOCK_FILE, LOCK_LINE)\n#define\trw_downgrade(rw)\t_rw_downgrade((rw), LOCK_FILE, LOCK_LINE)\n#define\trw_unlock(rw)\tdo {\t\t\t\t\t\t\\\n\tif (rw_wowned(rw))\t\t\t\t\t\t\\\n\t\trw_wunlock(rw);\t\t\t\t\t\t\\\n\telse\t\t\t\t\t\t\t\t\\\n\t\trw_runlock(rw);\t\t\t\t\t\t\\\n} while (0)\n#define\trw_sleep(chan, rw, pri, wmesg, timo)\t\t\t\t\\\n\t_sleep((chan), &(rw)->lock_object, (pri), (wmesg), (timo))\n\n#define\trw_initialized(rw)\tlock_initalized(&(rw)->lock_object)\n\nstruct rw_args {\n\tstruct rwlock\t*ra_rw;\n\tconst char \t*ra_desc;\n};\n\nstruct rw_args_flags {\n\tstruct rwlock\t*ra_rw;\n\tconst char \t*ra_desc;\n\tint\t\tra_flags;\n};\n\n#define\tRW_SYSINIT(name, rw, desc)\t\t\t\t\t\\\n\tstatic struct rw_args name##_args = {\t\t\t\t\\\n\t\t(rw),\t\t\t\t\t\t\t\\\n\t\t(desc),\t\t\t\t\t\t\t\\\n\t};\t\t\t\t\t\t\t\t\\\n\tSYSINIT(name##_rw_sysinit, SI_SUB_LOCK, SI_ORDER_MIDDLE,\t\\\n\t    rw_sysinit, &name##_args);\t\t\t\t\t\\\n\tSYSUNINIT(name##_rw_sysuninit, SI_SUB_LOCK, SI_ORDER_MIDDLE,\t\\\n\t    rw_destroy, (rw))\n\n\n#define\tRW_SYSINIT_FLAGS(name, rw, desc, flags)\t\t\t\t\\\n\tstatic struct rw_args_flags name##_args = {\t\t\t\\\n\t\t(rw),\t\t\t\t\t\t\t\\\n\t\t(desc),\t\t\t\t\t\t\t\\\n\t\t(flags),\t\t\t\t\t\t\\\n\t};\t\t\t\t\t\t\t\t\\\n\tSYSINIT(name##_rw_sysinit, SI_SUB_LOCK, SI_ORDER_MIDDLE,\t\\\n\t    rw_sysinit_flags, &name##_args);\t\t\t\t\\\n\tSYSUNINIT(name##_rw_sysuninit, SI_SUB_LOCK, SI_ORDER_MIDDLE,\t\\\n\t    rw_destroy, (rw))\n\n/*\n * Options passed to rw_init_flags().\n */\n#define\tRW_DUPOK\t0x01\n#define\tRW_NOPROFILE\t0x02\n#define\tRW_NOWITNESS\t0x04\n#define\tRW_QUIET\t0x08\n#define\tRW_RECURSE\t0x10\n\n/*\n * The INVARIANTS-enabled rw_assert() functionality.\n *\n * The constants need to be defined for INVARIANT_SUPPORT infrastructure\n * support as _rw_assert() itself uses them and the latter implies that\n * _rw_assert() must build.\n */\n#if defined(INVARIANTS) || defined(INVARIANT_SUPPORT)\n#define\tRA_LOCKED\t\tLA_LOCKED\n#define\tRA_RLOCKED\t\tLA_SLOCKED\n#define\tRA_WLOCKED\t\tLA_XLOCKED\n#define\tRA_UNLOCKED\t\tLA_UNLOCKED\n#define\tRA_RECURSED\t\tLA_RECURSED\n#define\tRA_NOTRECURSED\t\tLA_NOTRECURSED\n#endif\n\n#ifdef INVARIANTS\n#define\trw_assert(rw, what)\t_rw_assert((rw), (what), LOCK_FILE, LOCK_LINE)\n#else\n#define\trw_assert(rw, what)\n#endif\n\n#endif /* _KERNEL */\n#endif /* !_SYS_RWLOCK_H_ */\n"
  },
  {
    "path": "freebsd-headers/sys/sbuf.h",
    "content": "/*-\n * Copyright (c) 2000-2008 Poul-Henning Kamp\n * Copyright (c) 2000-2008 Dag-Erling Coïdan Smørgrav\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer\n *    in this position and unchanged.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *      $FreeBSD: release/9.0.0/sys/sys/sbuf.h 221993 2011-05-16 16:18:40Z phk $\n */\n\n#ifndef _SYS_SBUF_H_\n#define\t_SYS_SBUF_H_\n\n#include <sys/_types.h>\n\nstruct sbuf;\ntypedef int (sbuf_drain_func)(void *, const char *, int);\n\n/*\n * Structure definition\n */\nstruct sbuf {\n\tchar\t\t*s_buf;\t\t/* storage buffer */\n\tsbuf_drain_func\t*s_drain_func;\t/* drain function */\n\tvoid\t\t*s_drain_arg;\t/* user-supplied drain argument */\n\tint\t\t s_error;\t/* current error code */\n\tssize_t\t\t s_size;\t/* size of storage buffer */\n\tssize_t\t\t s_len;\t\t/* current length of string */\n#define\tSBUF_FIXEDLEN\t0x00000000\t/* fixed length buffer (default) */\n#define\tSBUF_AUTOEXTEND\t0x00000001\t/* automatically extend buffer */\n#define\tSBUF_USRFLAGMSK\t0x0000ffff\t/* mask of flags the user may specify */\n#define\tSBUF_DYNAMIC\t0x00010000\t/* s_buf must be freed */\n#define\tSBUF_FINISHED\t0x00020000\t/* set by sbuf_finish() */\n#define\tSBUF_DYNSTRUCT\t0x00080000\t/* sbuf must be freed */\n\tint\t\t s_flags;\t/* flags */\n};\n\n__BEGIN_DECLS\n/*\n * API functions\n */\nstruct sbuf\t*sbuf_new(struct sbuf *, char *, int, int);\n#define\t\t sbuf_new_auto()\t\t\t\t\\\n\tsbuf_new(NULL, NULL, 0, SBUF_AUTOEXTEND)\nvoid\t\t sbuf_clear(struct sbuf *);\nint\t\t sbuf_setpos(struct sbuf *, ssize_t);\nint\t\t sbuf_bcat(struct sbuf *, const void *, size_t);\nint\t\t sbuf_bcpy(struct sbuf *, const void *, size_t);\nint\t\t sbuf_cat(struct sbuf *, const char *);\nint\t\t sbuf_cpy(struct sbuf *, const char *);\nint\t\t sbuf_printf(struct sbuf *, const char *, ...)\n\t__printflike(2, 3);\nint\t\t sbuf_vprintf(struct sbuf *, const char *, __va_list)\n\t__printflike(2, 0);\nint\t\t sbuf_putc(struct sbuf *, int);\nvoid\t\t sbuf_set_drain(struct sbuf *, sbuf_drain_func *, void *);\nint\t\t sbuf_trim(struct sbuf *);\nint\t\t sbuf_error(const struct sbuf *);\nint\t\t sbuf_finish(struct sbuf *);\nchar\t\t*sbuf_data(struct sbuf *);\nssize_t\t\t sbuf_len(struct sbuf *);\nint\t\t sbuf_done(const struct sbuf *);\nvoid\t\t sbuf_delete(struct sbuf *);\n\n#ifdef _KERNEL\nstruct uio;\nstruct sbuf\t*sbuf_uionew(struct sbuf *, struct uio *, int *);\nint\t\t sbuf_bcopyin(struct sbuf *, const void *, size_t);\nint\t\t sbuf_copyin(struct sbuf *, const void *, size_t);\n#endif\n__END_DECLS\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/sys/sched.h",
    "content": "/*-\n * Copyright (c) 1996, 1997\n *      HD Associates, Inc.  All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. All advertising materials mentioning features or use of this software\n *    must display the following acknowledgement:\n *      This product includes software developed by HD Associates, Inc\n *      and Jukka Antero Ukkonen.\n * 4. Neither the name of the author nor the names of any co-contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY HD ASSOCIATES AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL HD ASSOCIATES OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n */\n\n/*-\n * Copyright (c) 2002-2008, Jeffrey Roberson <jeff@freebsd.org>\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice unmodified, this list of conditions, and the following\n *    disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR\n * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES\n * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,\n * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF\n * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/sys/sched.h 216791 2010-12-29 09:26:46Z davidxu $\n */\n\n#ifndef _SCHED_H_\n#define\t_SCHED_H_\n\n#ifdef _KERNEL\n/*\n * General scheduling info.\n *\n * sched_load:\n *\tTotal runnable non-ithread threads in the system.\n *\n * sched_runnable:\n *\tRunnable threads for this processor.\n */\nint\tsched_load(void);\nint\tsched_rr_interval(void);\nint\tsched_runnable(void);\n\n/* \n * Proc related scheduling hooks.\n */\nvoid\tsched_exit(struct proc *p, struct thread *childtd);\nvoid\tsched_fork(struct thread *td, struct thread *childtd);\nvoid\tsched_fork_exit(struct thread *td);\nvoid\tsched_class(struct thread *td, int class);\nvoid\tsched_nice(struct proc *p, int nice);\n\n/*\n * Threads are switched in and out, block on resources, have temporary\n * priorities inherited from their procs, and use up cpu time.\n */\nvoid\tsched_exit_thread(struct thread *td, struct thread *child);\nvoid\tsched_fork_thread(struct thread *td, struct thread *child);\nvoid\tsched_lend_prio(struct thread *td, u_char prio);\nvoid\tsched_lend_user_prio(struct thread *td, u_char pri);\nfixpt_t\tsched_pctcpu(struct thread *td);\nvoid\tsched_prio(struct thread *td, u_char prio);\nvoid\tsched_sleep(struct thread *td, int prio);\nvoid\tsched_switch(struct thread *td, struct thread *newtd, int flags);\nvoid\tsched_throw(struct thread *td);\nvoid\tsched_unlend_prio(struct thread *td, u_char prio);\nvoid\tsched_user_prio(struct thread *td, u_char prio);\nvoid\tsched_userret(struct thread *td);\nvoid\tsched_wakeup(struct thread *td);\nvoid\tsched_preempt(struct thread *td);\n\n/*\n * Threads are moved on and off of run queues\n */\nvoid\tsched_add(struct thread *td, int flags);\nvoid\tsched_clock(struct thread *td);\nvoid\tsched_rem(struct thread *td);\nvoid\tsched_tick(int cnt);\nvoid\tsched_relinquish(struct thread *td);\nstruct thread *sched_choose(void);\nvoid\tsched_idletd(void *);\n\n/*\n * Binding makes cpu affinity permanent while pinning is used to temporarily\n * hold a thread on a particular CPU.\n */\nvoid\tsched_bind(struct thread *td, int cpu);\nstatic __inline void sched_pin(void);\nvoid\tsched_unbind(struct thread *td);\nstatic __inline void sched_unpin(void);\nint\tsched_is_bound(struct thread *td);\nvoid\tsched_affinity(struct thread *td);\n\n/*\n * These procedures tell the process data structure allocation code how\n * many bytes to actually allocate.\n */\nint\tsched_sizeof_proc(void);\nint\tsched_sizeof_thread(void);\n\n/*\n * This routine provides a consistent thread name for use with KTR graphing\n * functions.\n */\nchar\t*sched_tdname(struct thread *td);\n\nstatic __inline void\nsched_pin(void)\n{\n\tcurthread->td_pinned++;\n}\n\nstatic __inline void\nsched_unpin(void)\n{\n\tcurthread->td_pinned--;\n}\n\n/* sched_add arguments (formerly setrunqueue) */\n#define\tSRQ_BORING\t0x0000\t\t/* No special circumstances. */\n#define\tSRQ_YIELDING\t0x0001\t\t/* We are yielding (from mi_switch). */\n#define\tSRQ_OURSELF\t0x0002\t\t/* It is ourself (from mi_switch). */\n#define\tSRQ_INTR\t0x0004\t\t/* It is probably urgent. */\n#define\tSRQ_PREEMPTED\t0x0008\t\t/* has been preempted.. be kind */\n#define\tSRQ_BORROWING\t0x0010\t\t/* Priority updated due to prio_lend */\n\n/* Scheduler stats. */\n#ifdef SCHED_STATS\nDPCPU_DECLARE(long, sched_switch_stats[SWT_COUNT]);\n\n#define\tSCHED_STAT_DEFINE_VAR(name, ptr, descr)\t\t\t\t\\\nstatic void name ## _add_proc(void *dummy __unused)\t\t\t\\\n{\t\t\t\t\t\t\t\t\t\\\n\t\t\t\t\t\t\t\t\t\\\n\tSYSCTL_ADD_PROC(NULL,\t\t\t\t\t\t\\\n\t    SYSCTL_STATIC_CHILDREN(_kern_sched_stats), OID_AUTO,\t\\\n\t    #name, CTLTYPE_LONG|CTLFLAG_RD|CTLFLAG_MPSAFE,\t\t\\\n\t    ptr, 0, sysctl_dpcpu_long, \"LU\", descr);\t\t\t\\\n}\t\t\t\t\t\t\t\t\t\\\nSYSINIT(name, SI_SUB_RUN_SCHEDULER, SI_ORDER_MIDDLE, name ## _add_proc, NULL);\n\n#define\tSCHED_STAT_DEFINE(name, descr)\t\t\t\t\t\\\n    DPCPU_DEFINE(unsigned long, name);\t\t\t\t\t\\\n    SCHED_STAT_DEFINE_VAR(name, &DPCPU_NAME(name), descr)\n/*\n * Sched stats are always incremented in critical sections so no atomic\n * is necesssary to increment them.\n */\n#define SCHED_STAT_INC(var)     DPCPU_GET(var)++;\n#else\n#define\tSCHED_STAT_DEFINE_VAR(name, descr, ptr)\n#define\tSCHED_STAT_DEFINE(name, descr)\n#define SCHED_STAT_INC(var)\t\t\t(void)0\n#endif\n\n/*\n * Fixup scheduler state for proc0 and thread0\n */\nvoid schedinit(void);\n#endif /* _KERNEL */\n\n/* POSIX 1003.1b Process Scheduling */\n\n/*\n * POSIX scheduling policies\n */\n#define SCHED_FIFO      1\n#define SCHED_OTHER     2\n#define SCHED_RR        3\n\nstruct sched_param {\n        int     sched_priority;\n};\n\n/*\n * POSIX scheduling declarations for userland.\n */\n#ifndef _KERNEL\n#include <sys/cdefs.h>\n#include <sys/_types.h>\n\n#ifndef _PID_T_DECLARED\ntypedef __pid_t         pid_t;\n#define _PID_T_DECLARED\n#endif\n\nstruct timespec;\n\n__BEGIN_DECLS\nint     sched_get_priority_max(int);\nint     sched_get_priority_min(int);\nint     sched_getparam(pid_t, struct sched_param *);\nint     sched_getscheduler(pid_t);\nint     sched_rr_get_interval(pid_t, struct timespec *);\nint     sched_setparam(pid_t, const struct sched_param *);\nint     sched_setscheduler(pid_t, int, const struct sched_param *);\nint     sched_yield(void);\n__END_DECLS\n\n#endif\n#endif /* !_SCHED_H_ */\n"
  },
  {
    "path": "freebsd-headers/sys/sdt.h",
    "content": "/*-\n * Copyright 2006-2008 John Birrell <jb@FreeBSD.org>\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * \n * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/sys/sdt.h 211616 2010-08-22 11:18:57Z rpaulo $\n *\n * Statically Defined Tracing (SDT) definitions.\n *\n */\n\n#ifndef _SYS_SDT_H\n#define\t_SYS_SDT_H\n\n#ifndef _KERNEL\n\n#define\t_DTRACE_VERSION\t1\n\n#define\tDTRACE_PROBE(prov, name) {\t\t\t\t\\\n\textern void __dtrace_##prov##___##name(void);\t\t\\\n\t__dtrace_##prov##___##name();\t\t\t\t\\\n}\n\n#define\tDTRACE_PROBE1(prov, name, arg1) {\t\t\t\\\n\textern void __dtrace_##prov##___##name(unsigned long);\t\\\n\t__dtrace_##prov##___##name((unsigned long)arg1);\t\\\n}\n\n#define\tDTRACE_PROBE2(prov, name, arg1, arg2) {\t\t\t\\\n\textern void __dtrace_##prov##___##name(unsigned long,\t\\\n\t    unsigned long);\t\t\t\t\t\\\n\t__dtrace_##prov##___##name((unsigned long)arg1,\t\t\\\n\t    (unsigned long)arg2);\t\t\t\t\\\n}\n\n#define\tDTRACE_PROBE3(prov, name, arg1, arg2, arg3) {\t\t\\\n\textern void __dtrace_##prov##___##name(unsigned long,\t\\\n\t    unsigned long, unsigned long);\t\t\t\\\n\t__dtrace_##prov##___##name((unsigned long)arg1,\t\t\\\n\t    (unsigned long)arg2, (unsigned long)arg3);\t\t\\\n}\n\n#define\tDTRACE_PROBE4(prov, name, arg1, arg2, arg3, arg4) {\t\\\n\textern void __dtrace_##prov##___##name(unsigned long,\t\\\n\t    unsigned long, unsigned long, unsigned long);\t\\\n\t__dtrace_##prov##___##name((unsigned long)arg1,\t\t\\\n\t    (unsigned long)arg2, (unsigned long)arg3,\t\t\\\n\t    (unsigned long)arg4);\t\t\t\t\\\n}\n\n#define\tDTRACE_PROBE5(prov, name, arg1, arg2, arg3, arg4, arg5) {\t\\\n\textern void __dtrace_##prov##___##name(unsigned long,\t\t\\\n\t    unsigned long, unsigned long, unsigned long, unsigned long);\\\n\t__dtrace_##prov##___##name((unsigned long)arg1,\t\t\t\\\n\t    (unsigned long)arg2, (unsigned long)arg3,\t\t\t\\\n\t    (unsigned long)arg4, (unsigned long)arg5);\t\t\t\\\n}\n\n#else /* _KERNEL */\n\n#ifndef KDTRACE_HOOKS\n\n#define SDT_PROVIDER_DEFINE(prov)\n#define SDT_PROVIDER_DECLARE(prov)\n#define SDT_PROBE_DEFINE(prov, mod, func, name, sname)\n#define SDT_PROBE_DECLARE(prov, mod, func, name)\n#define SDT_PROBE(prov, mod, func, name, arg0, arg1, arg2, arg3, arg4)\n#define SDT_PROBE_ARGTYPE(prov, mod, func, name, num, type)\n\n#define\tSDT_PROBE_DEFINE1(prov, mod, func, name, sname, arg0)\n#define\tSDT_PROBE_DEFINE2(prov, mod, func, name, sname, arg0, arg1)\n#define\tSDT_PROBE_DEFINE3(prov, mod, func, name, sname, arg0, arg1, arg2)\n#define\tSDT_PROBE_DEFINE4(prov, mod, func, name, sname, arg0, arg1, arg2, arg3)\n#define\tSDT_PROBE_DEFINE5(prov, mod, func, name, sname, arg0, arg1, arg2, arg3, arg4)\n\n#define\tSDT_PROBE1(prov, mod, func, name, arg0)\n#define\tSDT_PROBE2(prov, mod, func, name, arg0, arg1)\n#define\tSDT_PROBE3(prov, mod, func, name, arg0, arg1, arg2)\n#define\tSDT_PROBE4(prov, mod, func, name, arg0, arg1, arg2, arg3)\n#define\tSDT_PROBE5(prov, mod, func, name, arg0, arg1, arg2, arg3, arg4)\n\n#else\n\n/*\n * This type definition must match that of dtrace_probe. It is defined this\n * way to avoid having to rely on CDDL code.\n */\ntypedef\tvoid (*sdt_probe_func_t)(u_int32_t, uintptr_t arg0, uintptr_t arg1,\n    uintptr_t arg2, uintptr_t arg3, uintptr_t arg4);\n\n/*\n * The hook for the probe function. See kern_sdt.c which defaults this to\n * it's own stub. The 'sdt' provider will set it to dtrace_probe when it\n * loads.\n */\nextern sdt_probe_func_t\tsdt_probe_func;\n\ntypedef enum {\n\tSDT_UNINIT = 1,\n\tSDT_INIT,\n} sdt_state_t;\n\nstruct sdt_probe;\nstruct sdt_provider;\n\nstruct sdt_argtype {\n\tint\tndx;\t\t\t/* Argument index. */\n\tconst char *type;\t\t/* Argument type string. */\n\tTAILQ_ENTRY(sdt_argtype)\n\t\t\targtype_entry;\t/* Argument type list entry. */\n\tstruct sdt_probe\n\t\t\t*probe;\t\t/* Ptr to the probe structure. */\n};\n\nstruct sdt_probe {\n\tint\t\tversion;\t/* Set to sizeof(struct sdt_ref). */\n\tsdt_state_t\tstate;\n\tstruct sdt_provider\n\t\t\t*prov;\t\t/* Ptr to the provider structure. */\n\tTAILQ_ENTRY(sdt_probe)\n\t\t\tprobe_entry;\t/* SDT probe list entry. */\n\tTAILQ_HEAD(argtype_list_head, sdt_argtype) argtype_list;\n\tconst char\t*mod;\n\tconst char\t*func;\n\tconst char\t*name;\n\tid_t\t\tid;\t\t/* DTrace probe ID. */\n\tint\t\tn_args;\t\t/* Number of arguments. */\n};\n\nstruct sdt_provider {\n\tconst char *name;\t\t/* Provider name. */\n\tTAILQ_ENTRY(sdt_provider)\n\t\t\tprov_entry;\t/* SDT provider list entry. */\n\tTAILQ_HEAD(probe_list_head, sdt_probe) probe_list;\n\tuintptr_t\tid;\t\t/* DTrace provider ID. */\n};\n\n#define SDT_PROVIDER_DEFINE(prov)\t\t\t\t\t\t\\\n\tstruct sdt_provider sdt_provider_##prov[1] = {\t\t\t\t\\\n\t\t{ #prov, { NULL, NULL }, { NULL, NULL } }\t\t\t\\\n\t};\t\t\t\t\t\t\t\t\t\\\n\tSYSINIT(sdt_provider_##prov##_init, SI_SUB_KDTRACE, \t\t\t\\\n\t    SI_ORDER_SECOND, sdt_provider_register, \t\t\t\t\\\n\t    sdt_provider_##prov );\t\t\t\t\t\t\\\n\tSYSUNINIT(sdt_provider_##prov##_uninit, SI_SUB_KDTRACE,\t\t\t\\\n\t    SI_ORDER_SECOND, sdt_provider_deregister, \t\t\t\t\\\n\t    sdt_provider_##prov )\n\n#define SDT_PROVIDER_DECLARE(prov)\t\t\t\t\t\t\\\n\textern struct sdt_provider sdt_provider_##prov[1]\n\n#define SDT_PROBE_DEFINE(prov, mod, func, name, sname)\t\t\t\t\\\n\tstruct sdt_probe sdt_##prov##_##mod##_##func##_##name[1] = {\t\t\\\n\t\t{ sizeof(struct sdt_probe), 0, sdt_provider_##prov,\t\t\\\n\t\t    { NULL, NULL }, { NULL, NULL }, #mod, #func, #sname, 0, 0 }\t\\\n\t};\t\t\t\t\t\t\t\t\t\\\n\tSYSINIT(sdt_##prov##_##mod##_##func##_##name##_init, SI_SUB_KDTRACE, \t\\\n\t    SI_ORDER_SECOND + 1, sdt_probe_register, \t\t\t\t\\\n\t    sdt_##prov##_##mod##_##func##_##name );\t\t\t\t\\\n\tSYSUNINIT(sdt_##prov##_##mod##_##func##_##name##_uninit, \t\t\\\n\t    SI_SUB_KDTRACE, SI_ORDER_SECOND + 1, sdt_probe_deregister, \t\t\\\n\t    sdt_##prov##_##mod##_##func##_##name )\n\n#define SDT_PROBE_DECLARE(prov, mod, func, name)\t\t\t\t\\\n\textern struct sdt_probe sdt_##prov##_##mod##_##func##_##name[1]\n\n#define SDT_PROBE(prov, mod, func, name, arg0, arg1, arg2, arg3, arg4)\t\t\\\n\tif (sdt_##prov##_##mod##_##func##_##name->id)\t\t\t\t\\\n\t\t(*sdt_probe_func)(sdt_##prov##_##mod##_##func##_##name->id,\t\\\n\t\t    (uintptr_t) arg0, (uintptr_t) arg1, (uintptr_t) arg2,\t\\\n\t\t    (uintptr_t) arg3, (uintptr_t) arg4)\n\n#define SDT_PROBE_ARGTYPE(prov, mod, func, name, num, type)\t\t\t\\\n\tstruct sdt_argtype sdt_##prov##_##mod##_##func##_##name##num[1]\t\t\\\n\t    = { { num, type, { NULL, NULL },\t\t\t\t\t\\\n\t    sdt_##prov##_##mod##_##func##_##name }\t\t\t\t\\\n\t};\t\t\t\t\t\t\t\t\t\\\n\tSYSINIT(sdt_##prov##_##mod##_##func##_##name##num##_init,\t\t\\\n\t    SI_SUB_KDTRACE, SI_ORDER_SECOND + 2, sdt_argtype_register, \t\t\\\n\t    sdt_##prov##_##mod##_##func##_##name##num );\t\t\t\\\n\tSYSUNINIT(sdt_##prov##_##mod##_##func##_##name##num##_uninit, \t\t\\\n\t    SI_SUB_KDTRACE, SI_ORDER_SECOND + 2, sdt_argtype_deregister,\t\\\n\t    sdt_##prov##_##mod##_##func##_##name##num )\n\n#define\tSDT_PROBE_DEFINE1(prov, mod, func, name, sname, arg0)\t\t\\\n\tSDT_PROBE_DEFINE(prov, mod, func, name, sname);\t\t\t\\\n\tSDT_PROBE_ARGTYPE(prov, mod, func, name, 0, arg0)\n\n#define\tSDT_PROBE_DEFINE2(prov, mod, func, name, sname, arg0, arg1)\t\\\n\tSDT_PROBE_DEFINE(prov, mod, func, name, sname);\t\t\t\\\n\tSDT_PROBE_ARGTYPE(prov, mod, func, name, 0, arg0);\t\t\\\n\tSDT_PROBE_ARGTYPE(prov, mod, func, name, 1, arg1)\n\n#define\tSDT_PROBE_DEFINE3(prov, mod, func, name, sname, arg0, arg1, arg2)\\\n\tSDT_PROBE_DEFINE(prov, mod, func, name, sname);\t\t\t\\\n\tSDT_PROBE_ARGTYPE(prov, mod, func, name, 0, arg0);\t\t\\\n\tSDT_PROBE_ARGTYPE(prov, mod, func, name, 1, arg1);\t\t\\\n\tSDT_PROBE_ARGTYPE(prov, mod, func, name, 2, arg2)\n\n#define\tSDT_PROBE_DEFINE4(prov, mod, func, name, sname, arg0, arg1, arg2, arg3) \\\n\tSDT_PROBE_DEFINE(prov, mod, func, name, sname);\t\t\t\\\n\tSDT_PROBE_ARGTYPE(prov, mod, func, name, 0, arg0);\t\t\\\n\tSDT_PROBE_ARGTYPE(prov, mod, func, name, 1, arg1);\t\t\\\n\tSDT_PROBE_ARGTYPE(prov, mod, func, name, 2, arg2);\t\t\\\n\tSDT_PROBE_ARGTYPE(prov, mod, func, name, 3, arg3)\n\n#define\tSDT_PROBE_DEFINE5(prov, mod, func, name, sname, arg0, arg1, arg2, arg3, arg4) \\\n\tSDT_PROBE_DEFINE(prov, mod, func, name, sname);\t\t\t\\\n\tSDT_PROBE_ARGTYPE(prov, mod, func, name, 0, arg0);\t\t\\\n\tSDT_PROBE_ARGTYPE(prov, mod, func, name, 1, arg1);\t\t\\\n\tSDT_PROBE_ARGTYPE(prov, mod, func, name, 2, arg2);\t\t\\\n\tSDT_PROBE_ARGTYPE(prov, mod, func, name, 3, arg3);\t\t\\\n\tSDT_PROBE_ARGTYPE(prov, mod, func, name, 4, arg4)\n\n#define\tSDT_PROBE1(prov, mod, func, name, arg0)\t\t\t\t\\\n\tSDT_PROBE(prov, mod, func, name, arg0, 0, 0, 0, 0)\n#define\tSDT_PROBE2(prov, mod, func, name, arg0, arg1)\t\t\t\\\n\tSDT_PROBE(prov, mod, func, name, arg0, arg1, 0, 0, 0)\n#define\tSDT_PROBE3(prov, mod, func, name, arg0, arg1, arg2)\t\t\\\n\tSDT_PROBE(prov, mod, func, name, arg0, arg1, arg2,  0, 0)\n#define\tSDT_PROBE4(prov, mod, func, name, arg0, arg1, arg2, arg3)\t\\\n\tSDT_PROBE(prov, mod, func, name, arg0, arg1, arg2, arg3, 0)\n#define\tSDT_PROBE5(prov, mod, func, name, arg0, arg1, arg2, arg3, arg4) \\\n\tSDT_PROBE(prov, mod, func, name, arg0, arg1, arg2, arg3, arg4)\n\ntypedef int (*sdt_argtype_listall_func_t)(struct sdt_argtype *, void *);\ntypedef int (*sdt_probe_listall_func_t)(struct sdt_probe *, void *);\ntypedef int (*sdt_provider_listall_func_t)(struct sdt_provider *, void *);\n\nvoid sdt_argtype_deregister(void *);\nvoid sdt_argtype_register(void *);\nvoid sdt_probe_deregister(void *);\nvoid sdt_probe_register(void *);\nvoid sdt_provider_deregister(void *);\nvoid sdt_provider_register(void *);\nvoid sdt_probe_stub(u_int32_t, uintptr_t arg0, uintptr_t arg1, uintptr_t arg2,\n    uintptr_t arg3, uintptr_t arg4);\nint sdt_argtype_listall(struct sdt_probe *, sdt_argtype_listall_func_t, void *);\nint sdt_probe_listall(struct sdt_provider *, sdt_probe_listall_func_t, void *);\nint sdt_provider_listall(sdt_provider_listall_func_t,void *);\n\n#endif /* KDTRACE_HOOKS */\n\n#endif /* _KERNEL */\n\n#endif /* _SYS_SDT_H */\n"
  },
  {
    "path": "freebsd-headers/sys/select.h",
    "content": "/*-\n * Copyright (c) 1992, 1993\n *\tThe Regents of the University of California.  All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 4. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/sys/select.h 154090 2006-01-06 22:12:46Z marcel $\n */\n\n#ifndef _SYS_SELECT_H_\n#define\t_SYS_SELECT_H_\n\n#include <sys/cdefs.h>\n#include <sys/_types.h>\n\n#include <sys/_sigset.h>\n#include <sys/_timeval.h>\n#include <sys/timespec.h>\n\ntypedef\tunsigned long\t__fd_mask;\n#if __BSD_VISIBLE\ntypedef\t__fd_mask\tfd_mask;\n#endif\n\n#ifndef _SIGSET_T_DECLARED\n#define\t_SIGSET_T_DECLARED\ntypedef\t__sigset_t\tsigset_t;\n#endif\n\n/*\n * Select uses bit masks of file descriptors in longs.  These macros\n * manipulate such bit fields (the filesystem macros use chars).\n * FD_SETSIZE may be defined by the user, but the default here should\n * be enough for most uses.\n */\n#ifndef\tFD_SETSIZE\n#define\tFD_SETSIZE\t1024U\n#endif\n\n#define\t_NFDBITS\t(sizeof(__fd_mask) * 8)\t/* bits per mask */\n#if __BSD_VISIBLE\n#define\tNFDBITS\t\t_NFDBITS\n#endif\n\n#ifndef _howmany\n#define\t_howmany(x, y)\t(((x) + ((y) - 1)) / (y))\n#endif\n\ntypedef\tstruct fd_set {\n\t__fd_mask\t__fds_bits[_howmany(FD_SETSIZE, _NFDBITS)];\n} fd_set;\n#if __BSD_VISIBLE\n#define\tfds_bits\t__fds_bits\n#endif\n\n#define\t__fdset_mask(n)\t((__fd_mask)1 << ((n) % _NFDBITS))\n#define\tFD_CLR(n, p)\t((p)->__fds_bits[(n)/_NFDBITS] &= ~__fdset_mask(n))\n#if __BSD_VISIBLE\n#define\tFD_COPY(f, t)\t(void)(*(t) = *(f))\n#endif\n#define\tFD_ISSET(n, p)\t(((p)->__fds_bits[(n)/_NFDBITS] & __fdset_mask(n)) != 0)\n#define\tFD_SET(n, p)\t((p)->__fds_bits[(n)/_NFDBITS] |= __fdset_mask(n))\n#define\tFD_ZERO(p) do {\t\t\t\t\t\\\n\tfd_set *_p;\t\t\t\t\t\\\n\t__size_t _n;\t\t\t\t\t\\\n\t\t\t\t\t\t\t\\\n\t_p = (p);\t\t\t\t\t\\\n\t_n = _howmany(FD_SETSIZE, _NFDBITS);\t\t\\\n\twhile (_n > 0)\t\t\t\t\t\\\n\t\t_p->__fds_bits[--_n] = 0;\t\t\\\n} while (0)\n\n#ifndef _KERNEL\n\n__BEGIN_DECLS\nint pselect(int, fd_set *__restrict, fd_set *__restrict, fd_set *__restrict,\n\tconst struct timespec *__restrict, const sigset_t *__restrict);\n#ifndef _SELECT_DECLARED\n#define\t_SELECT_DECLARED\n/* XXX missing restrict type-qualifier */\nint\tselect(int, fd_set *, fd_set *, fd_set *, struct timeval *);\n#endif\n__END_DECLS\n#endif /* !_KERNEL */\n\n#endif /* _SYS_SELECT_H_ */\n"
  },
  {
    "path": "freebsd-headers/sys/selinfo.h",
    "content": "/*-\n * Copyright (c) 1992, 1993\n *\tThe Regents of the University of California.  All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 4. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t@(#)select.h\t8.2 (Berkeley) 1/4/94\n * $FreeBSD: release/9.0.0/sys/sys/selinfo.h 225177 2011-08-25 15:51:54Z attilio $\n */\n\n#ifndef _SYS_SELINFO_H_\n#define\t_SYS_SELINFO_H_\n\n#include <sys/event.h>\t\t/* for struct klist */\n\nstruct selfd;\nTAILQ_HEAD(selfdlist, selfd);\n\n/*\n * Used to maintain information about processes that wish to be\n * notified when I/O becomes possible.\n */\nstruct selinfo {\n\tstruct selfdlist\tsi_tdlist;\t/* List of sleeping threads. */\n\tstruct knlist\t\tsi_note;\t/* kernel note list */\n\tstruct mtx\t\t*si_mtx;\t/* Lock for tdlist. */\n};\n\n#define\tSEL_WAITING(si)\t\t(!TAILQ_EMPTY(&(si)->si_tdlist))\n\n#ifdef _KERNEL\nvoid\tseldrain(struct selinfo *sip);\nvoid\tselrecord(struct thread *selector, struct selinfo *sip);\nvoid\tselwakeup(struct selinfo *sip);\nvoid\tselwakeuppri(struct selinfo *sip, int pri);\nvoid\tseltdfini(struct thread *td);\n#endif\n\n#endif /* !_SYS_SELINFO_H_ */\n"
  },
  {
    "path": "freebsd-headers/sys/sem.h",
    "content": "/* $FreeBSD: release/9.0.0/sys/sys/sem.h 224016 2011-07-14 14:18:14Z bz $ */\n/*\t$NetBSD: sem.h,v 1.5 1994/06/29 06:45:15 cgd Exp $\t*/\n\n/*\n * SVID compatible sem.h file\n *\n * Author:  Daniel Boulet\n */\n\n#ifndef _SYS_SEM_H_\n#define _SYS_SEM_H_\n\n#include <sys/ipc.h>\n\n#ifndef _PID_T_DECLARED\ntypedef\t__pid_t\t\tpid_t;\n#define\t_PID_T_DECLARED\n#endif\n\n#ifndef _SIZE_T_DECLARED\ntypedef\t__size_t\tsize_t;\n#define\t_SIZE_T_DECLARED\n#endif\n\n#ifndef _TIME_T_DECLARED\ntypedef\t__time_t\ttime_t;\n#define\t_TIME_T_DECLARED\n#endif\n\n#if defined(COMPAT_FREEBSD4) || defined(COMPAT_FREEBSD5) || \\\n    defined(COMPAT_FREEBSD6) || defined(COMPAT_FREEBSD7)\nstruct semid_ds_old {\n\tstruct ipc_perm_old sem_perm;\t/* operation permission struct */\n\tstruct sem\t*sem_base;\t/* pointer to first semaphore in set */\n\tunsigned short\tsem_nsems;\t/* number of sems in set */\n\ttime_t\t\tsem_otime;\t/* last operation time */\n\tlong\t\tsem_pad1;\t/* SVABI/386 says I need this here */\n\ttime_t\t\tsem_ctime;\t/* last change time */\n    \t\t\t\t\t/* Times measured in secs since */\n    \t\t\t\t\t/* 00:00:00 GMT, Jan. 1, 1970 */\n\tlong\t\tsem_pad2;\t/* SVABI/386 says I need this here */\n\tlong\t\tsem_pad3[4];\t/* SVABI/386 says I need this here */\n};\n#endif\n\nstruct semid_ds {\n\tstruct ipc_perm\tsem_perm;\t/* operation permission struct */\n\tstruct sem\t*sem_base;\t/* pointer to first semaphore in set */\n\tunsigned short\tsem_nsems;\t/* number of sems in set */\n\ttime_t\t\tsem_otime;\t/* last operation time */\n\ttime_t\t\tsem_ctime;\t/* last change time */\n    \t\t\t\t\t/* Times measured in secs since */\n    \t\t\t\t\t/* 00:00:00 GMT, Jan. 1, 1970 */\n};\n\n/*\n * semop's sops parameter structure\n */\nstruct sembuf {\n\tunsigned short\tsem_num;\t/* semaphore # */\n\tshort\t\tsem_op;\t\t/* semaphore operation */\n\tshort\t\tsem_flg;\t/* operation flags */\n};\n#define SEM_UNDO\t010000\n\n#if defined(COMPAT_FREEBSD4) || defined(COMPAT_FREEBSD5) || \\\n    defined(COMPAT_FREEBSD6) || defined(COMPAT_FREEBSD7) || \\\n    defined(_WANT_SEMUN_OLD)\nunion semun_old {\n\tint\t\tval;\t\t/* value for SETVAL */\n\tstruct\t\tsemid_ds_old *buf; /* buffer for IPC_STAT & IPC_SET */\n\tunsigned short\t*array;\t\t/* array for GETALL & SETALL */\n};\n#endif\n\n/*\n * semctl's arg parameter structure\n */\nunion semun {\n\tint\t\tval;\t\t/* value for SETVAL */\n\tstruct\t\tsemid_ds *buf;\t/* buffer for IPC_STAT & IPC_SET */\n\tunsigned short\t*array;\t\t/* array for GETALL & SETALL */\n};\n\n/*\n * commands for semctl\n */\n#define GETNCNT\t3\t/* Return the value of semncnt {READ} */\n#define GETPID\t4\t/* Return the value of sempid {READ} */\n#define GETVAL\t5\t/* Return the value of semval {READ} */\n#define GETALL\t6\t/* Return semvals into arg.array {READ} */\n#define GETZCNT\t7\t/* Return the value of semzcnt {READ} */\n#define SETVAL\t8\t/* Set the value of semval to arg.val {ALTER} */\n#define SETALL\t9\t/* Set semvals from arg.array {ALTER} */\n#define SEM_STAT 10\t/* Like IPC_STAT but treats semid as sema-index */\n#define SEM_INFO 11\t/* Like IPC_INFO but treats semid as sema-index */\n\n/*\n * Permissions\n */\n#define SEM_A\t\tIPC_W\t/* alter permission */\n#define SEM_R\t\tIPC_R\t/* read permission */\n\n#ifdef _KERNEL\n\n/*\n * semaphore info struct\n */\nstruct seminfo {\n\tint\tsemmni,\t\t/* # of semaphore identifiers */\n\t\tsemmns,\t\t/* # of semaphores in system */\n\t\tsemmnu,\t\t/* # of undo structures in system */\n\t\tsemmsl,\t\t/* max # of semaphores per id */\n\t\tsemopm,\t\t/* max # of operations per semop call */\n\t\tsemume,\t\t/* max # of undo entries per process */\n\t\tsemusz,\t\t/* size in bytes of undo structure */\n\t\tsemvmx,\t\t/* semaphore maximum value */\n\t\tsemaem;\t\t/* adjust on exit max value */\n};\nextern struct seminfo\tseminfo;\n\n/*\n * Kernel wrapper for the user-level structure\n */\nstruct semid_kernel {\n\tstruct\tsemid_ds u;\n\tstruct\tlabel *label;\t/* MAC framework label */\n\tstruct\tucred *cred;\t/* creator's credentials */\n};\n\n/* internal \"mode\" bits */\n#define\tSEM_ALLOC\t01000\t/* semaphore is allocated */\n#define\tSEM_DEST\t02000\t/* semaphore will be destroyed on last detach */\n\n/*\n * Process sem_undo vectors at proc exit.\n */\nvoid\tsemexit(struct proc *p);\n\n#else /* ! _KERNEL */\n\n__BEGIN_DECLS\n#if __BSD_VISIBLE\nint semsys(int, ...);\n#endif\nint semctl(int, int, int, ...);\nint semget(key_t, int, int);\nint semop(int, struct sembuf *, size_t);\n__END_DECLS\n\n#endif /* !_KERNEL */\n\n#endif /* !_SYS_SEM_H_ */\n"
  },
  {
    "path": "freebsd-headers/sys/sema.h",
    "content": "/*-\n * Copyright (C) 2001 Jason Evans <jasone@freebsd.org>.  All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice(s), this list of conditions and the following disclaimer as\n *    the first lines of this file unmodified other than the possible\n *    addition of one or more copyright notices.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice(s), this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\n * DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE LIABLE FOR ANY\n * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR\n * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH\n * DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/sys/sema.h 139825 2005-01-07 02:29:27Z imp $\n */\n\n#ifndef\t_SYS_SEMA_H_\n#define\t_SYS_SEMA_H_\n\n#include <sys/queue.h>\n#include <sys/_lock.h>\n#include <sys/_mutex.h>\n#include <sys/condvar.h>\n\nstruct sema {\n\tstruct mtx\tsema_mtx;\t/* General protection lock. */\n\tstruct cv\tsema_cv;\t/* Waiters. */\n\tint\t\tsema_waiters;\t/* Number of waiters. */\n\tint\t\tsema_value;\t/* Semaphore value. */\n};\n\n#ifdef _KERNEL\nvoid\tsema_init(struct sema *sema, int value, const char *description);\nvoid\tsema_destroy(struct sema *sema);\nvoid\t_sema_post(struct sema *sema, const char *file, int line);\nvoid\t_sema_wait(struct sema *sema, const char *file, int line);\nint\t_sema_timedwait(struct sema *sema, int timo, const char *file, int\n    line);\nint\t_sema_trywait(struct sema *sema, const char *file, int line);\nint\tsema_value(struct sema *sema);\n\n#define\tsema_post(sema)\t\t_sema_post((sema), LOCK_FILE, LOCK_LINE)\n#define\tsema_wait(sema)\t\t_sema_wait((sema), LOCK_FILE, LOCK_LINE)\n#define\tsema_timedwait(sema, timo)\t\t\t\t\t\\\n\t_sema_timedwait((sema), (timo), LOCK_FILE, LOCK_LINE)\n#define\tsema_trywait(sema)\t_sema_trywait((sema), LOCK_FILE, LOCK_LINE)\n\n#endif\t/* _KERNEL */\n#endif\t/* _SYS_SEMA_H_ */\n"
  },
  {
    "path": "freebsd-headers/sys/serial.h",
    "content": "/*-\n * Copyright (c) 2004 Poul-Henning Kamp\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * This file contains definitions which pertain to serial ports as such,\n * (both async and sync), but which do not necessarily have anything to\n * do with tty processing.\n *\n * $FreeBSD: release/9.0.0/sys/sys/serial.h 157298 2006-03-30 17:24:42Z marcel $\n */\n\n#ifndef _SYS_SERIAL_H_\n#define\t_SYS_SERIAL_H_\n\n\n/*\n * Indentification of modem control signals.  These definitions match\n * the TIOCMGET definitions in <sys/ttycom.h> shifted a bit down, and\n * that identity is enforced with CTASSERT at the bottom of kern/tty.c\n * Both the modem bits and delta bits must fit in 16 bit.\n */\n#define\tSER_DTR\t\t0x0001\t\t/* data terminal ready */\n#define\tSER_RTS\t\t0x0002\t\t/* request to send */\n#define\tSER_STX\t\t0x0004\t\t/* secondary transmit */\n#define\tSER_SRX\t\t0x0008\t\t/* secondary receive */\n#define\tSER_CTS\t\t0x0010\t\t/* clear to send */\n#define\tSER_DCD\t\t0x0020\t\t/* data carrier detect */\n#define\tSER_RI\t \t0x0040\t\t/* ring indicate */\n#define\tSER_DSR\t\t0x0080\t\t/* data set ready */\n\n#define\tSER_MASK_STATE\t0x00ff\n\n/* Delta bits, used to indicate which signals should/was affected */\n#define\tSER_DELTA(x)\t((x) << 8)\n\n#define\tSER_DDTR\tSER_DELTA(SER_DTR)\n#define\tSER_DRTS\tSER_DELTA(SER_RTS)\n#define\tSER_DSTX\tSER_DELTA(SER_STX)\n#define\tSER_DSRX\tSER_DELTA(SER_SRX)\n#define\tSER_DCTS\tSER_DELTA(SER_CTS)\n#define\tSER_DDCD\tSER_DELTA(SER_DCD)\n#define\tSER_DRI\t\tSER_DELTA(SER_RI)\n#define\tSER_DDSR\tSER_DELTA(SER_DSR)\n\n#define\tSER_MASK_DELTA\tSER_DELTA(SER_MASK_STATE)\n\n#ifdef _KERNEL\n/*\n * Specification of interrupt sources typical for serial ports. These are\n * useful when some umbrella driver like scc(4) has enough knowledge of\n * the hardware to obtain the set of pending interrupts but does not itself\n * handle the interrupt. Each interrupt source can be given an interrupt\n * resource for which inferior drivers can install handlers. The lower 16\n * bits are kept free for the signals above.\n */\n#define\tSER_INT_OVERRUN\t0x010000\n#define\tSER_INT_BREAK\t0x020000\n#define\tSER_INT_RXREADY\t0x040000\n#define\tSER_INT_SIGCHG\t0x080000\n#define\tSER_INT_TXIDLE\t0x100000\n\n#define\tSER_INT_MASK\t0xff0000\n#define\tSER_INT_SIGMASK\t(SER_MASK_DELTA | SER_MASK_STATE)\n\n#ifndef LOCORE\ntypedef int serdev_intr_t(void*);\n#endif\n\n#endif\t/* _KERNEL */\n\n#endif /* !_SYS_SERIAL_H_ */\n"
  },
  {
    "path": "freebsd-headers/sys/sf_buf.h",
    "content": "/*-\n * Copyright (c) 2003-2004 Alan L. Cox <alc@cs.rice.edu>\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/sys/sf_buf.h 137372 2004-11-08 00:43:46Z alc $\n */\n\n#ifndef _SYS_SF_BUF_H_\n#define _SYS_SF_BUF_H_\n\n#include <machine/sf_buf.h>\n\n/*\n * Options to sf_buf_alloc() are specified through its flags argument.  This\n * argument's value should be the result of a bitwise or'ing of one or more\n * of the following values.\n */\n#define\tSFB_CATCH\t1\t\t/* Check signals if the allocation\n\t\t\t\t\t   sleeps. */\n#define\tSFB_CPUPRIVATE\t2\t\t/* Create a CPU private mapping. */\n#define\tSFB_DEFAULT\t0\n#define\tSFB_NOWAIT\t4\t\t/* Return NULL if all bufs are used. */\n\nstruct vm_page;\n\nextern  int nsfbufs;                    /* Number of sendfile(2) bufs alloced */\nextern  int nsfbufspeak;                /* Peak of nsfbufsused */\nextern  int nsfbufsused;                /* Number of sendfile(2) bufs in use */\n\nstruct sf_buf *\n\tsf_buf_alloc(struct vm_page *m, int flags);\nvoid\tsf_buf_free(struct sf_buf *sf);\nvoid\tsf_buf_mext(void *addr, void *args);\n\n#endif /* !_SYS_SF_BUF_H_ */\n"
  },
  {
    "path": "freebsd-headers/sys/sglist.h",
    "content": "/*-\n * Copyright (c) 2008 Yahoo!, Inc.\n * All rights reserved.\n * Written by: John Baldwin <jhb@FreeBSD.org>\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. Neither the name of the author nor the names of any co-contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/sys/sglist.h 196404 2009-08-20 19:23:58Z jhb $\n */\n\n/*\n * A scatter/gather list describes a group of physical address ranges.\n * Each physical address range consists of a starting address and a\n * length.\n */\n\n#ifndef __SGLIST_H__\n#define\t__SGLIST_H__\n\n#include <sys/refcount.h>\n\nstruct sglist_seg {\n\tvm_paddr_t\tss_paddr;\n\tsize_t\t\tss_len;\n};\n\nstruct sglist {\n\tstruct sglist_seg *sg_segs;\n\tint\t\tsg_refs;\n\tu_short\t\tsg_nseg;\n\tu_short\t\tsg_maxseg;\n};\n\nstruct mbuf;\nstruct uio;\n\nstatic __inline void\nsglist_init(struct sglist *sg, u_short maxsegs, struct sglist_seg *segs)\n{\n\n\tsg->sg_segs = segs;\n\tsg->sg_nseg = 0;\n\tsg->sg_maxseg = maxsegs;\n\trefcount_init(&sg->sg_refs, 1);\n}\n\nstatic __inline void\nsglist_reset(struct sglist *sg)\n{\n\n\tsg->sg_nseg = 0;\n}\n\nstatic __inline struct sglist *\nsglist_hold(struct sglist *sg)\n{\n\n\trefcount_acquire(&sg->sg_refs);\n\treturn (sg);\n}\n\nstruct sglist *sglist_alloc(int nsegs, int mflags);\nint\tsglist_append(struct sglist *sg, void *buf, size_t len);\nint\tsglist_append_mbuf(struct sglist *sg, struct mbuf *m0);\nint\tsglist_append_phys(struct sglist *sg, vm_paddr_t paddr,\n\t    size_t len);\nint\tsglist_append_uio(struct sglist *sg, struct uio *uio);\nint\tsglist_append_user(struct sglist *sg, void *buf, size_t len,\n\t    struct thread *td);\nstruct sglist *sglist_build(void *buf, size_t len, int mflags);\nstruct sglist *sglist_clone(struct sglist *sg, int mflags);\nint\tsglist_consume_uio(struct sglist *sg, struct uio *uio, size_t resid);\nint\tsglist_count(void *buf, size_t len);\nvoid\tsglist_free(struct sglist *sg);\nint\tsglist_join(struct sglist *first, struct sglist *second);\nsize_t\tsglist_length(struct sglist *sg);\nint\tsglist_slice(struct sglist *original, struct sglist **slice,\n\t    size_t offset, size_t length, int mflags);\nint\tsglist_split(struct sglist *original, struct sglist **head,\n\t    size_t length, int mflags);\n\n#endif\t/* !__SGLIST_H__ */\n"
  },
  {
    "path": "freebsd-headers/sys/shm.h",
    "content": "/* $FreeBSD: release/9.0.0/sys/sys/shm.h 220388 2011-04-06 16:59:54Z trasz $ */\n/*\t$NetBSD: shm.h,v 1.15 1994/06/29 06:45:17 cgd Exp $\t*/\n\n/*-\n * Copyright (c) 1994 Adam Glass\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. All advertising materials mentioning features or use of this software\n *    must display the following acknowledgement:\n *      This product includes software developed by Adam Glass.\n * 4. The name of the author may not be used to endorse or promote products\n *    derived from this software without specific prior written permission\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR\n * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES\n * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,\n * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF\n * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n */\n\n/*\n * As defined+described in \"X/Open System Interfaces and Headers\"\n *                         Issue 4, p. XXX\n */\n\n#ifndef _SYS_SHM_H_\n#define _SYS_SHM_H_\n\n#include <sys/cdefs.h>\n#include <sys/ipc.h>\n#include <sys/_types.h>\n\n#define SHM_RDONLY  010000  /* Attach read-only (else read-write) */\n#define SHM_RND     020000  /* Round attach address to SHMLBA */\n#define SHMLBA      PAGE_SIZE /* Segment low boundary address multiple */\n\n/* \"official\" access mode definitions; somewhat braindead since you have\n   to specify (SHM_* >> 3) for group and (SHM_* >> 6) for world permissions */\n#define SHM_R       (IPC_R)\n#define SHM_W       (IPC_W)\n\n/* predefine tbd *LOCK shmctl commands */\n#define\tSHM_LOCK\t11\n#define\tSHM_UNLOCK\t12\n\n/* ipcs shmctl commands for Linux compatability */\n#define\tSHM_STAT\t13\n#define\tSHM_INFO\t14\n\n#ifndef _PID_T_DECLARED\ntypedef\t__pid_t\t\tpid_t;\n#define\t_PID_T_DECLARED\n#endif\n\n#ifndef _TIME_T_DECLARED\ntypedef\t__time_t\ttime_t;\n#define\t_TIME_T_DECLARED\n#endif\n\n#ifndef _SIZE_T_DECLARED\ntypedef\t__size_t\tsize_t;\n#define\t_SIZE_T_DECLARED\n#endif\n\n#if defined(COMPAT_FREEBSD4) || defined(COMPAT_FREEBSD5) || \\\n    defined(COMPAT_FREEBSD6) || defined(COMPAT_FREEBSD7)\nstruct shmid_ds_old {\n\tstruct ipc_perm_old shm_perm;\t/* operation permission structure */\n\tint             shm_segsz;\t/* size of segment in bytes */\n\tpid_t           shm_lpid;   /* process ID of last shared memory op */\n\tpid_t           shm_cpid;\t/* process ID of creator */\n\tshort\t\tshm_nattch;\t/* number of current attaches */\n\ttime_t          shm_atime;\t/* time of last shmat() */\n\ttime_t          shm_dtime;\t/* time of last shmdt() */\n\ttime_t          shm_ctime;\t/* time of last change by shmctl() */\n\tvoid           *shm_internal;   /* sysv stupidity */\n};\n#endif\n\nstruct shmid_ds {\n\tstruct ipc_perm shm_perm;\t/* operation permission structure */\n\tsize_t          shm_segsz;\t/* size of segment in bytes */\n\tpid_t           shm_lpid;   /* process ID of last shared memory op */\n\tpid_t           shm_cpid;\t/* process ID of creator */\n\tint\t\tshm_nattch;\t/* number of current attaches */\n\ttime_t          shm_atime;\t/* time of last shmat() */\n\ttime_t          shm_dtime;\t/* time of last shmdt() */\n\ttime_t          shm_ctime;\t/* time of last change by shmctl() */\n};\n\n#ifdef _KERNEL\n#include <vm/vm.h>\n\n/*\n * System 5 style catch-all structure for shared memory constants that\n * might be of interest to user programs.  Do we really want/need this?\n */\nstruct shminfo {\n\tu_long\tshmmax;\t\t/* max shared memory segment size (bytes) */\n\tu_long\tshmmin;\t\t/* max shared memory segment size (bytes) */\n\tu_long\tshmmni;\t\t/* max number of shared memory identifiers */\n\tu_long\tshmseg;\t\t/* max shared memory segments per process */\n\tu_long\tshmall;\t\t/* max amount of shared memory (pages) */\n};\n\n/* \n * Add a kernel wrapper to the shmid_ds struct so that private info (like the\n * MAC label) can be added to it, without changing the user interface.\n */\nstruct shmid_kernel {\n\tstruct shmid_ds u;\n\tvm_object_t object;\n\tstruct label *label;\t/* MAC label */\n\tstruct ucred *cred;\t/* creator's credendials */\n};\n\nextern struct shminfo\tshminfo;\n\nstruct shm_info {\n\tint used_ids;\n\tunsigned long shm_tot;\n\tunsigned long shm_rss;\n\tunsigned long shm_swp;\n\tunsigned long swap_attempts;\n\tunsigned long swap_successes;\n};\n\nstruct thread;\nstruct proc;\nstruct vmspace;\n\nvoid\tshmexit(struct vmspace *);\nvoid\tshmfork(struct proc *, struct proc *);\n#else /* !_KERNEL */\n\n#include <sys/cdefs.h>\n\n#ifndef _SIZE_T_DECLARED\ntypedef __size_t        size_t;\n#define _SIZE_T_DECLARED\n#endif\n\n__BEGIN_DECLS\n#ifdef __BSD_VISIBLE\nint shmsys(int, ...);\n#endif\nvoid *shmat(int, const void *, int);\nint shmget(key_t, size_t, int);\nint shmctl(int, int, struct shmid_ds *);\nint shmdt(const void *);\n__END_DECLS\n\n#endif /* !_KERNEL */\n\n#endif /* !_SYS_SHM_H_ */\n"
  },
  {
    "path": "freebsd-headers/sys/sigio.h",
    "content": "/*-\n * Copyright (c) 1990, 1993\n *\tThe Regents of the University of California.  All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 4. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t@(#)filedesc.h\t8.1 (Berkeley) 6/2/93\n * $FreeBSD: release/9.0.0/sys/sys/sigio.h 139825 2005-01-07 02:29:27Z imp $\n */\n\n#ifndef _SYS_SIGIO_H_\n#define _SYS_SIGIO_H_\n\n/*\n * This structure holds the information needed to send a SIGIO or\n * a SIGURG signal to a process or process group when new data arrives\n * on a device or socket.  The structure is placed on an SLIST belonging\n * to the proc or pgrp so that the entire list may be revoked when the\n * process exits or the process group disappears.\n *\n * (c)\tconst\n * (pg)\tlocked by either the process or process group lock\n */\nstruct sigio {\n\tunion {\n\t\tstruct\tproc *siu_proc; /* (c)\tprocess to receive SIGIO/SIGURG */\n\t\tstruct\tpgrp *siu_pgrp; /* (c)\tprocess group to receive ... */\n\t} sio_u;\n\tSLIST_ENTRY(sigio) sio_pgsigio;\t/* (pg)\tsigio's for process or group */\n\tstruct\tsigio **sio_myref;\t/* (c)\tlocation of the pointer that holds\n\t\t\t\t\t * \tthe reference to this structure */\n\tstruct\tucred *sio_ucred;\t/* (c)\tcurrent credentials */\n\tpid_t\tsio_pgid;\t\t/* (c)\tpgid for signals */\n};\n#define\tsio_proc\tsio_u.siu_proc\n#define\tsio_pgrp\tsio_u.siu_pgrp\n\nSLIST_HEAD(sigiolst, sigio);\n\npid_t\tfgetown(struct sigio **sigiop);\nint\tfsetown(pid_t pgid, struct sigio **sigiop);\nvoid\tfunsetown(struct sigio **sigiop);\nvoid\tfunsetownlst(struct sigiolst *sigiolst);\n\n#endif /* _SYS_SIGIO_H_ */\n"
  },
  {
    "path": "freebsd-headers/sys/signal.h",
    "content": "/*-\n * Copyright (c) 1982, 1986, 1989, 1991, 1993\n *\tThe Regents of the University of California.  All rights reserved.\n * (c) UNIX System Laboratories, Inc.\n * All or some portions of this file are derived from material licensed\n * to the University of California by American Telephone and Telegraph\n * Co. or Unix System Laboratories, Inc. and are reproduced herein with\n * the permission of UNIX System Laboratories, Inc.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 4. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t@(#)signal.h\t8.4 (Berkeley) 5/4/95\n * $FreeBSD: release/9.0.0/sys/sys/signal.h 215183 2010-11-12 15:30:49Z jilles $\n */\n\n#ifndef _SYS_SIGNAL_H_\n#define\t_SYS_SIGNAL_H_\n\n#include <sys/cdefs.h>\n#include <sys/_types.h>\n#include <sys/_sigset.h>\n\n#include <machine/_limits.h>\t/* __MINSIGSTKSZ */\n#include <machine/signal.h>\t/* sig_atomic_t; trap codes; sigcontext */\n\n/*\n * System defined signals.\n */\n#if __POSIX_VISIBLE || __XSI_VISIBLE\n#define\tSIGHUP\t\t1\t/* hangup */\n#endif\n#define\tSIGINT\t\t2\t/* interrupt */\n#if __POSIX_VISIBLE || __XSI_VISIBLE\n#define\tSIGQUIT\t\t3\t/* quit */\n#endif\n#define\tSIGILL\t\t4\t/* illegal instr. (not reset when caught) */\n#if __XSI_VISIBLE\n#define\tSIGTRAP\t\t5\t/* trace trap (not reset when caught) */\n#endif\n#define\tSIGABRT\t\t6\t/* abort() */\n#if __BSD_VISIBLE\n#define\tSIGIOT\t\tSIGABRT\t/* compatibility */\n#define\tSIGEMT\t\t7\t/* EMT instruction */\n#endif\n#define\tSIGFPE\t\t8\t/* floating point exception */\n#if __POSIX_VISIBLE || __XSI_VISIBLE\n#define\tSIGKILL\t\t9\t/* kill (cannot be caught or ignored) */\n#endif\n#if __POSIX_VISIBLE >= 200112 || __XSI_VISIBLE\n#define\tSIGBUS\t\t10\t/* bus error */\n#endif\n#define\tSIGSEGV\t\t11\t/* segmentation violation */\n#if __POSIX_VISIBLE >= 200112 || __XSI_VISIBLE\n#define\tSIGSYS\t\t12\t/* non-existent system call invoked */\n#endif\n#if __POSIX_VISIBLE || __XSI_VISIBLE\n#define\tSIGPIPE\t\t13\t/* write on a pipe with no one to read it */\n#define\tSIGALRM\t\t14\t/* alarm clock */\n#endif\n#define\tSIGTERM\t\t15\t/* software termination signal from kill */\n#if __POSIX_VISIBLE >= 200112 || __XSI_VISIBLE\n#define\tSIGURG\t\t16\t/* urgent condition on IO channel */\n#endif\n#if __POSIX_VISIBLE || __XSI_VISIBLE\n#define\tSIGSTOP\t\t17\t/* sendable stop signal not from tty */\n#define\tSIGTSTP\t\t18\t/* stop signal from tty */\n#define\tSIGCONT\t\t19\t/* continue a stopped process */\n#define\tSIGCHLD\t\t20\t/* to parent on child stop or exit */\n#define\tSIGTTIN\t\t21\t/* to readers pgrp upon background tty read */\n#define\tSIGTTOU\t\t22\t/* like TTIN if (tp->t_local&LTOSTOP) */\n#endif\n#if __BSD_VISIBLE\n#define\tSIGIO\t\t23\t/* input/output possible signal */\n#endif\n#if __XSI_VISIBLE\n#define\tSIGXCPU\t\t24\t/* exceeded CPU time limit */\n#define\tSIGXFSZ\t\t25\t/* exceeded file size limit */\n#define\tSIGVTALRM\t26\t/* virtual time alarm */\n#define\tSIGPROF\t\t27\t/* profiling time alarm */\n#endif\n#if __BSD_VISIBLE\n#define\tSIGWINCH\t28\t/* window size changes */\n#define\tSIGINFO\t\t29\t/* information request */\n#endif\n#if __POSIX_VISIBLE || __XSI_VISIBLE\n#define\tSIGUSR1\t\t30\t/* user defined signal 1 */\n#define\tSIGUSR2\t\t31\t/* user defined signal 2 */\n#endif\n#if __BSD_VISIBLE\n#define\tSIGTHR\t\t32\t/* reserved by thread library. */\n#define\tSIGLWP\t\tSIGTHR\n#endif\n\n#define\tSIGRTMIN\t65\n#define\tSIGRTMAX\t126\n\n#define\tSIG_DFL\t\t((__sighandler_t *)0)\n#define\tSIG_IGN\t\t((__sighandler_t *)1)\n#define\tSIG_ERR\t\t((__sighandler_t *)-1)\n/* #define\tSIG_CATCH\t((__sighandler_t *)2) See signalvar.h */\n#define SIG_HOLD        ((__sighandler_t *)3)\n\n/*\n * Type of a signal handling function.\n *\n * Language spec sez signal handlers take exactly one arg, even though we\n * actually supply three.  Ugh!\n *\n * We don't try to hide the difference by leaving out the args because\n * that would cause warnings about conformant programs.  Nonconformant\n * programs can avoid the warnings by casting to (__sighandler_t *) or\n * sig_t before calling signal() or assigning to sa_handler or sv_handler.\n *\n * The kernel should reverse the cast before calling the function.  It\n * has no way to do this, but on most machines 1-arg and 3-arg functions\n * have the same calling protocol so there is no problem in practice.\n * A bit in sa_flags could be used to specify the number of args.\n */\ntypedef\tvoid __sighandler_t(int);\n\n#if __POSIX_VISIBLE || __XSI_VISIBLE\n#ifndef _SIGSET_T_DECLARED\n#define\t_SIGSET_T_DECLARED\ntypedef\t__sigset_t\tsigset_t;\n#endif\n#endif\n\n#if __POSIX_VISIBLE >= 199309 || __XSI_VISIBLE >= 500\nunion sigval {\n\t/* Members as suggested by Annex C of POSIX 1003.1b. */\n\tint\tsival_int;\n\tvoid\t*sival_ptr;\n\t/* 6.0 compatibility */\n\tint     sigval_int;\n\tvoid    *sigval_ptr;\n};\n#endif\n\n#if __POSIX_VISIBLE >= 199309\nstruct sigevent {\n\tint\tsigev_notify;\t\t/* Notification type */\n\tint\tsigev_signo;\t\t/* Signal number */\n\tunion sigval sigev_value;\t/* Signal value */\n\tunion {\n\t\t__lwpid_t\t_threadid;\n\t\tstruct {\n\t\t\tvoid (*_function)(union sigval);\n\t\t\tvoid *_attribute; /* pthread_attr_t * */\n\t\t} _sigev_thread;\n\t\tlong __spare__[8];\n\t} _sigev_un;\n};\n\n#if __BSD_VISIBLE\n#define\tsigev_notify_kqueue\t\tsigev_signo\n#define\tsigev_notify_thread_id\t\t_sigev_un._threadid\n#endif\n#define\tsigev_notify_function\t\t_sigev_un._sigev_thread._function\n#define\tsigev_notify_attributes\t\t_sigev_un._sigev_thread._attribute\n\n#define\tSIGEV_NONE\t0\t\t/* No async notification. */\n#define\tSIGEV_SIGNAL\t1\t\t/* Generate a queued signal. */\n#define\tSIGEV_THREAD\t2\t\t/* Call back from another pthread. */\n#if __BSD_VISIBLE\n#define\tSIGEV_KEVENT\t3\t\t/* Generate a kevent. */\n#define\tSIGEV_THREAD_ID\t4\t\t/* Send signal to a kernel thread. */\n#endif\n#endif /* __POSIX_VISIBLE >= 199309 */\n\n#if __POSIX_VISIBLE >= 199309 || __XSI_VISIBLE\ntypedef\tstruct __siginfo {\n\tint\tsi_signo;\t\t/* signal number */\n\tint\tsi_errno;\t\t/* errno association */\n\t/*\n\t * Cause of signal, one of the SI_ macros or signal-specific\n\t * values, i.e. one of the FPE_... values for SIGFPE.  This\n\t * value is equivalent to the second argument to an old-style\n\t * FreeBSD signal handler.\n\t */\n\tint\tsi_code;\t\t/* signal code */\n\t__pid_t\tsi_pid;\t\t\t/* sending process */\n\t__uid_t\tsi_uid;\t\t\t/* sender's ruid */\n\tint\tsi_status;\t\t/* exit value */\n\tvoid\t*si_addr;\t\t/* faulting instruction */\n\tunion sigval si_value;\t\t/* signal value */\n\tunion\t{\n\t\tstruct {\n\t\t\tint\t_trapno;/* machine specific trap code */\n\t\t} _fault;\n\t\tstruct {\n\t\t\tint\t_timerid;\n\t\t\tint\t_overrun;\n\t\t} _timer;\n\t\tstruct {\n\t\t\tint\t_mqd;\n\t\t} _mesgq;\n\t\tstruct {\n\t\t\tlong\t_band;\t\t/* band event for SIGPOLL */\n\t\t} _poll;\t\t\t/* was this ever used ? */\n\t\tstruct {\n\t\t\tlong\t__spare1__;\n\t\t\tint\t__spare2__[7];\n\t\t} __spare__;\n\t} _reason;\n} siginfo_t;\n\n#define si_trapno\t_reason._fault._trapno\n#define si_timerid\t_reason._timer._timerid\n#define si_overrun\t_reason._timer._overrun\n#define si_mqd\t\t_reason._mesgq._mqd\n#define si_band\t\t_reason._poll._band\n\n/** si_code **/\n/* codes for SIGILL */\n#define ILL_ILLOPC \t1\t/* Illegal opcode.\t\t\t*/\n#define ILL_ILLOPN \t2\t/* Illegal operand.\t\t\t*/\n#define ILL_ILLADR \t3\t/* Illegal addressing mode.\t\t*/\n#define ILL_ILLTRP \t4\t/* Illegal trap.\t\t\t*/\n#define ILL_PRVOPC \t5\t/* Privileged opcode.\t\t\t*/\n#define ILL_PRVREG \t6\t/* Privileged register.\t\t\t*/\n#define ILL_COPROC \t7\t/* Coprocessor error.\t\t\t*/\n#define ILL_BADSTK \t8\t/* Internal stack error.\t\t*/\n\n/* codes for SIGBUS */\n#define BUS_ADRALN\t1\t/* Invalid address alignment.\t\t*/\n#define BUS_ADRERR\t2\t/* Nonexistent physical address.\t*/\n#define BUS_OBJERR\t3\t/* Object-specific hardware error.\t*/\n\n/* codes for SIGSEGV */\n#define SEGV_MAPERR\t1\t/* Address not mapped to object.\t*/\n#define SEGV_ACCERR\t2\t/* Invalid permissions for mapped\t*/\n\t\t\t\t/* object.\t\t\t\t*/\n\n/* codes for SIGFPE */\n#define FPE_INTOVF\t1\t/* Integer overflow.\t\t\t*/\n#define FPE_INTDIV\t2\t/* Integer divide by zero.\t\t*/\n#define FPE_FLTDIV\t3\t/* Floating point divide by zero.\t*/\n#define FPE_FLTOVF\t4\t/* Floating point overflow.\t\t*/\n#define FPE_FLTUND\t5\t/* Floating point underflow.\t\t*/\n#define FPE_FLTRES\t6\t/* Floating point inexact result.\t*/\n#define FPE_FLTINV\t7\t/* Invalid floating point operation.\t*/\n#define FPE_FLTSUB\t8\t/* Subscript out of range.\t\t*/\n\n/* codes for SIGTRAP */\n#define TRAP_BRKPT\t1\t/* Process breakpoint.\t\t\t*/\n#define TRAP_TRACE\t2\t/* Process trace trap.\t\t\t*/\n#define\tTRAP_DTRACE\t3\t/* DTrace induced trap.\t\t\t*/\n\n/* codes for SIGCHLD */\n#define CLD_EXITED\t1\t/* Child has exited\t\t\t*/\n#define CLD_KILLED\t2\t/* Child has terminated abnormally but\t*/\n\t\t\t\t/* did not create a core file\t\t*/\n#define CLD_DUMPED\t3\t/* Child has terminated abnormally and\t*/\n\t\t\t\t/* created a core file\t\t\t*/\n#define CLD_TRAPPED\t4\t/* Traced child has trapped\t\t*/\n#define CLD_STOPPED\t5\t/* Child has stopped\t\t\t*/\n#define CLD_CONTINUED\t6\t/* Stopped child has continued\t\t*/\n\n/* codes for SIGPOLL */\n#define POLL_IN\t\t1\t/* Data input available\t\t\t*/\n#define POLL_OUT\t2\t/* Output buffers available\t\t*/\n#define POLL_MSG\t3\t/* Input message available\t\t*/\n#define POLL_ERR\t4\t/* I/O Error\t\t\t\t*/\n#define POLL_PRI\t5\t/* High priority input available\t*/\n#define POLL_HUP\t6\t/* Device disconnected\t\t\t*/\n\n#endif\n\n#if __POSIX_VISIBLE || __XSI_VISIBLE\nstruct __siginfo;\n\n/*\n * Signal vector \"template\" used in sigaction call.\n */\nstruct sigaction {\n\tunion {\n\t\tvoid    (*__sa_handler)(int);\n\t\tvoid    (*__sa_sigaction)(int, struct __siginfo *, void *);\n\t} __sigaction_u;\t\t/* signal handler */\n\tint\tsa_flags;\t\t/* see signal options below */\n\tsigset_t sa_mask;\t\t/* signal mask to apply */\n};\n\n#define\tsa_handler\t__sigaction_u.__sa_handler\n#endif\n\n#if __XSI_VISIBLE\n/* If SA_SIGINFO is set, sa_sigaction must be used instead of sa_handler. */\n#define\tsa_sigaction\t__sigaction_u.__sa_sigaction\n#endif\n\n#if __POSIX_VISIBLE || __XSI_VISIBLE\n#define\tSA_NOCLDSTOP\t0x0008\t/* do not generate SIGCHLD on child stop */\n#endif /* __POSIX_VISIBLE || __XSI_VISIBLE */\n\n#if __XSI_VISIBLE\n#define\tSA_ONSTACK\t0x0001\t/* take signal on signal stack */\n#define\tSA_RESTART\t0x0002\t/* restart system call on signal return */\n#define\tSA_RESETHAND\t0x0004\t/* reset to SIG_DFL when taking signal */\n#define\tSA_NODEFER\t0x0010\t/* don't mask the signal we're delivering */\n#define\tSA_NOCLDWAIT\t0x0020\t/* don't keep zombies around */\n#define\tSA_SIGINFO\t0x0040\t/* signal handler with SA_SIGINFO args */\n#endif\n\n#if __BSD_VISIBLE\n#define\tNSIG\t\t32\t/* number of old signals (counting 0) */\n#endif\n\n#if __POSIX_VISIBLE || __XSI_VISIBLE\n#define\tSI_NOINFO\t0\t\t/* No signal info besides si_signo. */\n#define\tSI_USER\t\t0x10001\t\t/* Signal sent by kill(). */\n#define\tSI_QUEUE\t0x10002\t\t/* Signal sent by the sigqueue(). */\n#define\tSI_TIMER\t0x10003\t\t/* Signal generated by expiration of */\n\t\t\t\t\t/* a timer set by timer_settime(). */\n#define\tSI_ASYNCIO\t0x10004\t\t/* Signal generated by completion of */\n\t\t\t\t\t/* an asynchronous I/O request.*/\n#define\tSI_MESGQ\t0x10005\t\t/* Signal generated by arrival of a */\n\t\t\t\t\t/* message on an empty message queue. */\n#define\tSI_KERNEL\t0x10006\n#define\tSI_LWP\t\t0x10007\t\t/* Signal sent by thr_kill */\n#endif\n#if __BSD_VISIBLE\n#define\tSI_UNDEFINED\t0\n#endif\n\n#if __BSD_VISIBLE\ntypedef\t__sighandler_t\t*sig_t;\t/* type of pointer to a signal function */\ntypedef\tvoid __siginfohandler_t(int, struct __siginfo *, void *);\n#endif\n\n#if __XSI_VISIBLE\n/*\n * Structure used in sigaltstack call.\n */\n#if __BSD_VISIBLE\ntypedef\tstruct sigaltstack {\n#else\ntypedef\tstruct {\n#endif\n\tchar\t*ss_sp;\t\t\t/* signal stack base */\n\t__size_t ss_size;\t\t/* signal stack length */\n\tint\tss_flags;\t\t/* SS_DISABLE and/or SS_ONSTACK */\n} stack_t;\n\n#define\tSS_ONSTACK\t0x0001\t/* take signal on alternate stack */\n#define\tSS_DISABLE\t0x0004\t/* disable taking signals on alternate stack */\n#define\tMINSIGSTKSZ\t__MINSIGSTKSZ\t\t/* minimum stack size */\n#define\tSIGSTKSZ\t(MINSIGSTKSZ + 32768)\t/* recommended stack size */\n#endif\n\n#if __BSD_VISIBLE\n/*\n * 4.3 compatibility:\n * Signal vector \"template\" used in sigvec call.\n */\nstruct sigvec {\n\t__sighandler_t *sv_handler;\t/* signal handler */\n\tint\tsv_mask;\t\t/* signal mask to apply */\n\tint\tsv_flags;\t\t/* see signal options below */\n};\n\n#define\tSV_ONSTACK\tSA_ONSTACK\n#define\tSV_INTERRUPT\tSA_RESTART\t/* same bit, opposite sense */\n#define\tSV_RESETHAND\tSA_RESETHAND\n#define\tSV_NODEFER\tSA_NODEFER\n#define\tSV_NOCLDSTOP\tSA_NOCLDSTOP\n#define\tSV_SIGINFO\tSA_SIGINFO\n#define\tsv_onstack\tsv_flags\t/* isn't compatibility wonderful! */\n#endif\n\n/* Keep this in one place only */\n#if defined(_KERNEL) && defined(COMPAT_43) && \\\n    !defined(__i386__)\nstruct osigcontext {\n\tint _not_used;\n};\n#endif\n\n#if __XSI_VISIBLE\n/*\n * Structure used in sigstack call.\n */\nstruct sigstack {\n\t/* XXX ss_sp's type should be `void *'. */\n\tchar\t*ss_sp;\t\t\t/* signal stack pointer */\n\tint\tss_onstack;\t\t/* current status */\n};\n#endif\n\n#if __BSD_VISIBLE || __POSIX_VISIBLE > 0 && __POSIX_VISIBLE <= 200112\n/*\n * Macro for converting signal number to a mask suitable for\n * sigblock().\n */\n#define\tsigmask(m)\t(1 << ((m)-1))\n#endif\n\n#if __BSD_VISIBLE\n#define\tBADSIG\t\tSIG_ERR\n#endif\n\n#if __POSIX_VISIBLE || __XSI_VISIBLE\n/*\n * Flags for sigprocmask:\n */\n#define\tSIG_BLOCK\t1\t/* block specified signal set */\n#define\tSIG_UNBLOCK\t2\t/* unblock specified signal set */\n#define\tSIG_SETMASK\t3\t/* set specified signal set */\n#endif\n\n/*\n * For historical reasons; programs expect signal's return value to be\n * defined by <sys/signal.h>.\n */\n__BEGIN_DECLS\n__sighandler_t *signal(int, __sighandler_t *);\n__END_DECLS\n\n#endif /* !_SYS_SIGNAL_H_ */\n"
  },
  {
    "path": "freebsd-headers/sys/signalvar.h",
    "content": "/*-\n * Copyright (c) 1991, 1993\n *\tThe Regents of the University of California.  All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 4. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t@(#)signalvar.h\t8.6 (Berkeley) 2/19/95\n * $FreeBSD: release/9.0.0/sys/sys/signalvar.h 225617 2011-09-16 13:58:51Z kmacy $\n */\n\n#ifndef _SYS_SIGNALVAR_H_\n#define\t_SYS_SIGNALVAR_H_\n\n#include <sys/queue.h>\n#include <sys/_lock.h>\n#include <sys/_mutex.h>\n#include <sys/signal.h>\n\n/*\n * Kernel signal definitions and data structures.\n */\n\n/*\n * Logical process signal actions and state, needed only within the process\n * The mapping between sigacts and proc structures is 1:1 except for rfork()\n * processes masquerading as threads which use one structure for the whole\n * group.  All members are locked by the included mutex.  The reference count\n * and mutex must be last for the bcopy in sigacts_copy() to work.\n */\nstruct sigacts {\n\tsig_t\tps_sigact[_SIG_MAXSIG];\t/* Disposition of signals. */\n\tsigset_t ps_catchmask[_SIG_MAXSIG];\t/* Signals to be blocked. */\n\tsigset_t ps_sigonstack;\t\t/* Signals to take on sigstack. */\n\tsigset_t ps_sigintr;\t\t/* Signals that interrupt syscalls. */\n\tsigset_t ps_sigreset;\t\t/* Signals that reset when caught. */\n\tsigset_t ps_signodefer;\t\t/* Signals not masked while handled. */\n\tsigset_t ps_siginfo;\t\t/* Signals that want SA_SIGINFO args. */\n\tsigset_t ps_sigignore;\t\t/* Signals being ignored. */\n\tsigset_t ps_sigcatch;\t\t/* Signals being caught by user. */\n\tsigset_t ps_freebsd4;\t\t/* Signals using freebsd4 ucontext. */\n\tsigset_t ps_osigset;\t\t/* Signals using <= 3.x osigset_t. */\n\tsigset_t ps_usertramp;\t\t/* SunOS compat; libc sigtramp. XXX */\n\tint\tps_flag;\n\tint\tps_refcnt;\n\tstruct mtx ps_mtx;\n};\n\n#define\tPS_NOCLDWAIT\t0x0001\t/* No zombies if child dies */\n#define\tPS_NOCLDSTOP\t0x0002\t/* No SIGCHLD when children stop. */\n#define\tPS_CLDSIGIGN\t0x0004\t/* The SIGCHLD handler is SIG_IGN. */\n\n#ifdef _KERNEL\n\n#ifdef COMPAT_43\ntypedef struct {\n\tstruct osigcontext si_sc;\n\tint\t\tsi_signo;\n\tint\t\tsi_code;\n\tunion sigval\tsi_value;\n} osiginfo_t;\n\nstruct osigaction {\n\tunion {\n\t\tvoid    (*__sa_handler)(int);\n\t\tvoid    (*__sa_sigaction)(int, osiginfo_t *, void *);\n\t} __sigaction_u;\t\t/* signal handler */\n\tosigset_t\tsa_mask;\t/* signal mask to apply */\n\tint\t\tsa_flags;\t/* see signal options below */\n};\n\ntypedef void __osiginfohandler_t(int, osiginfo_t *, void *);\n#endif /* COMPAT_43 */\n\n/* additional signal action values, used only temporarily/internally */\n#define\tSIG_CATCH\t((__sighandler_t *)2)\n/* #define SIG_HOLD        ((__sighandler_t *)3) See signal.h */\n\n/*\n * get signal action for process and signal; currently only for current process\n */\n#define\tSIGACTION(p, sig)\t(p->p_sigacts->ps_sigact[_SIG_IDX(sig)])\n\n#endif /* _KERNEL */\n\n/*\n * sigset_t manipulation macros.\n */\n#define\tSIGADDSET(set, signo)\t\t\t\t\t\t\\\n\t((set).__bits[_SIG_WORD(signo)] |= _SIG_BIT(signo))\n\n#define\tSIGDELSET(set, signo)\t\t\t\t\t\t\\\n\t((set).__bits[_SIG_WORD(signo)] &= ~_SIG_BIT(signo))\n\n#define\tSIGEMPTYSET(set)\t\t\t\t\t\t\\\n\tdo {\t\t\t\t\t\t\t\t\\\n\t\tint __i;\t\t\t\t\t\t\\\n\t\tfor (__i = 0; __i < _SIG_WORDS; __i++)\t\t\t\\\n\t\t\t(set).__bits[__i] = 0;\t\t\t\t\\\n\t} while (0)\n\n#define\tSIGFILLSET(set)\t\t\t\t\t\t\t\\\n\tdo {\t\t\t\t\t\t\t\t\\\n\t\tint __i;\t\t\t\t\t\t\\\n\t\tfor (__i = 0; __i < _SIG_WORDS; __i++)\t\t\t\\\n\t\t\t(set).__bits[__i] = ~0U;\t\t\t\\\n\t} while (0)\n\n#define\tSIGISMEMBER(set, signo)\t\t\t\t\t\t\\\n\t((set).__bits[_SIG_WORD(signo)] & _SIG_BIT(signo))\n\n#define\tSIGISEMPTY(set)\t\t(__sigisempty(&(set)))\n#define\tSIGNOTEMPTY(set)\t(!__sigisempty(&(set)))\n\n#define\tSIGSETEQ(set1, set2)\t(__sigseteq(&(set1), &(set2)))\n#define\tSIGSETNEQ(set1, set2)\t(!__sigseteq(&(set1), &(set2)))\n\n#define\tSIGSETOR(set1, set2)\t\t\t\t\t\t\\\n\tdo {\t\t\t\t\t\t\t\t\\\n\t\tint __i;\t\t\t\t\t\t\\\n\t\tfor (__i = 0; __i < _SIG_WORDS; __i++)\t\t\t\\\n\t\t\t(set1).__bits[__i] |= (set2).__bits[__i];\t\\\n\t} while (0)\n\n#define\tSIGSETAND(set1, set2)\t\t\t\t\t\t\\\n\tdo {\t\t\t\t\t\t\t\t\\\n\t\tint __i;\t\t\t\t\t\t\\\n\t\tfor (__i = 0; __i < _SIG_WORDS; __i++)\t\t\t\\\n\t\t\t(set1).__bits[__i] &= (set2).__bits[__i];\t\\\n\t} while (0)\n\n#define\tSIGSETNAND(set1, set2)\t\t\t\t\t\t\\\n\tdo {\t\t\t\t\t\t\t\t\\\n\t\tint __i;\t\t\t\t\t\t\\\n\t\tfor (__i = 0; __i < _SIG_WORDS; __i++)\t\t\t\\\n\t\t\t(set1).__bits[__i] &= ~(set2).__bits[__i];\t\\\n\t} while (0)\n\n#define\tSIGSETLO(set1, set2)\t((set1).__bits[0] = (set2).__bits[0])\n#define\tSIGSETOLD(set, oset)\t((set).__bits[0] = (oset))\n\n#define\tSIG_CANTMASK(set)\t\t\t\t\t\t\\\n\tSIGDELSET(set, SIGKILL), SIGDELSET(set, SIGSTOP)\n\n#define\tSIG_STOPSIGMASK(set)\t\t\t\t\t\t\\\n\tSIGDELSET(set, SIGSTOP), SIGDELSET(set, SIGTSTP),\t\t\\\n\tSIGDELSET(set, SIGTTIN), SIGDELSET(set, SIGTTOU)\n\n#define\tSIG_CONTSIGMASK(set)\t\t\t\t\t\t\\\n\tSIGDELSET(set, SIGCONT)\n\n#define\tsigcantmask\t(sigmask(SIGKILL) | sigmask(SIGSTOP))\n\n#define\tSIG2OSIG(sig, osig)\t(osig = (sig).__bits[0])\n#define\tOSIG2SIG(osig, sig)\tSIGEMPTYSET(sig); (sig).__bits[0] = osig\n\nstatic __inline int\n__sigisempty(sigset_t *set)\n{\n\tint i;\n\n\tfor (i = 0; i < _SIG_WORDS; i++) {\n\t\tif (set->__bits[i])\n\t\t\treturn (0);\n\t}\n\treturn (1);\n}\n\nstatic __inline int\n__sigseteq(sigset_t *set1, sigset_t *set2)\n{\n\tint i;\n\n\tfor (i = 0; i < _SIG_WORDS; i++) {\n\t\tif (set1->__bits[i] != set2->__bits[i])\n\t\t\treturn (0);\n\t}\n\treturn (1);\n}\n\nstruct osigevent {\n\tint\tsigev_notify;\t\t/* Notification type */\n\tunion {\n\t\tint\t__sigev_signo;\t/* Signal number */\n\t\tint\t__sigev_notify_kqueue;\n\t} __sigev_u;\n\tunion sigval sigev_value;\t/* Signal value */\n};\n\ntypedef struct ksiginfo {\n\tTAILQ_ENTRY(ksiginfo)\tksi_link;\n\tsiginfo_t\t\tksi_info;\n\tint\t\t\tksi_flags;\n\tstruct sigqueue\t\t*ksi_sigq;\n} ksiginfo_t;\n\n#define\tksi_signo\tksi_info.si_signo\n#define\tksi_errno\tksi_info.si_errno\n#define\tksi_code\tksi_info.si_code\n#define\tksi_pid\t\tksi_info.si_pid\n#define\tksi_uid\t\tksi_info.si_uid\n#define\tksi_status      ksi_info.si_status\n#define\tksi_addr        ksi_info.si_addr\n#define\tksi_value\tksi_info.si_value\n#define\tksi_band\tksi_info.si_band\n#define\tksi_trapno\tksi_info.si_trapno\n#define\tksi_overrun\tksi_info.si_overrun\n#define\tksi_timerid\tksi_info.si_timerid\n#define\tksi_mqd\t\tksi_info.si_mqd\n\n/* bits for ksi_flags */\n#define\tKSI_TRAP\t0x01\t/* Generated by trap. */\n#define\tKSI_EXT\t\t0x02\t/* Externally managed ksi. */\n#define\tKSI_INS\t\t0x04\t/* Directly insert ksi, not the copy */\n#define\tKSI_SIGQ\t0x08\t/* Generated by sigqueue, might ret EGAIN. */\n#define\tKSI_HEAD\t0x10\t/* Insert into head, not tail. */\n#define\tKSI_COPYMASK\t(KSI_TRAP|KSI_SIGQ)\n\n#define\tKSI_ONQ(ksi)\t((ksi)->ksi_sigq != NULL)\n\ntypedef struct sigqueue {\n\tsigset_t\tsq_signals;\t/* All pending signals. */\n\tsigset_t\tsq_kill;\t/* Legacy depth 1 queue. */\n\tTAILQ_HEAD(, ksiginfo)\tsq_list;/* Queued signal info. */\n\tstruct proc\t*sq_proc;\n\tint\t\tsq_flags;\n} sigqueue_t;\n\n/* Flags for ksi_flags */\n#define\tSQ_INIT\t0x01\n\n#ifdef _KERNEL\n\n/* Return nonzero if process p has an unmasked pending signal. */\n#define\tSIGPENDING(td)\t\t\t\t\t\t\t\\\n\t((!SIGISEMPTY((td)->td_siglist) &&\t\t\t\t\\\n\t    !sigsetmasked(&(td)->td_siglist, &(td)->td_sigmask)) ||\t\\\n\t (!SIGISEMPTY((td)->td_proc->p_siglist) &&\t\t\t\\\n\t    !sigsetmasked(&(td)->td_proc->p_siglist, &(td)->td_sigmask)))\n/*\n * Return the value of the pseudo-expression ((*set & ~*mask) != 0).  This\n * is an optimized version of SIGISEMPTY() on a temporary variable\n * containing SIGSETNAND(*set, *mask).\n */\nstatic __inline int\nsigsetmasked(sigset_t *set, sigset_t *mask)\n{\n\tint i;\n\n\tfor (i = 0; i < _SIG_WORDS; i++) {\n\t\tif (set->__bits[i] & ~mask->__bits[i])\n\t\t\treturn (0);\n\t}\n\treturn (1);\n}\n\n#define\tksiginfo_init(ksi)\t\t\t\\\ndo {\t\t\t\t\t\t\\\n\tbzero(ksi, sizeof(ksiginfo_t));\t\t\\\n} while(0)\n\n#define\tksiginfo_init_trap(ksi)\t\t\t\\\ndo {\t\t\t\t\t\t\\\n\tksiginfo_t *kp = ksi;\t\t\t\\\n\tbzero(kp, sizeof(ksiginfo_t));\t\t\\\n\tkp->ksi_flags |= KSI_TRAP;\t\t\\\n} while(0)\n\nstatic __inline void\nksiginfo_copy(ksiginfo_t *src, ksiginfo_t *dst)\n{\n\t(dst)->ksi_info = src->ksi_info;\n\t(dst)->ksi_flags = (src->ksi_flags & KSI_COPYMASK);\n}\n\nstatic __inline void\nksiginfo_set_sigev(ksiginfo_t *dst, struct sigevent *sigev)\n{\n\tdst->ksi_signo = sigev->sigev_signo;\n\tdst->ksi_value = sigev->sigev_value;\n}\n\nstruct pgrp;\nstruct proc;\nstruct sigio;\nstruct thread;\n\n/*\n * Lock the pointers for a sigio object in the underlying objects of\n * a file descriptor.\n */\n#define\tSIGIO_LOCK()\tmtx_lock(&sigio_lock)\n#define\tSIGIO_TRYLOCK()\tmtx_trylock(&sigio_lock)\n#define\tSIGIO_UNLOCK()\tmtx_unlock(&sigio_lock)\n#define\tSIGIO_LOCKED()\tmtx_owned(&sigio_lock)\n#define\tSIGIO_ASSERT(type)\tmtx_assert(&sigio_lock, type)\n\nextern struct mtx\tsigio_lock;\n\n/* Values for stop_allowed parameter for cursig(). */\n#define\tSIG_STOP_ALLOWED\t100\n#define\tSIG_STOP_NOT_ALLOWED\t101\n\n/* Flags for kern_sigprocmask(). */\n#define\tSIGPROCMASK_OLD\t\t0x0001\n#define\tSIGPROCMASK_PROC_LOCKED\t0x0002\n#define\tSIGPROCMASK_PS_LOCKED\t0x0004\n\nint\tcursig(struct thread *td, int stop_allowed);\nvoid\texecsigs(struct proc *p);\nvoid\tgsignal(int pgid, int sig, ksiginfo_t *ksi);\nvoid\tkillproc(struct proc *p, char *why);\nksiginfo_t * ksiginfo_alloc(int wait);\nvoid\tksiginfo_free(ksiginfo_t *ksi);\nint\tpksignal(struct proc *p, int sig, ksiginfo_t *ksi);\nvoid\tpgsigio(struct sigio **sigiop, int sig, int checkctty);\nvoid\tpgsignal(struct pgrp *pgrp, int sig, int checkctty, ksiginfo_t *ksi);\nint\tpostsig(int sig);\nvoid\tkern_psignal(struct proc *p, int sig);\nint\tptracestop(struct thread *td, int sig);\nvoid\tsendsig(sig_t catcher, ksiginfo_t *ksi, sigset_t *retmask);\nstruct sigacts *sigacts_alloc(void);\nvoid\tsigacts_copy(struct sigacts *dest, struct sigacts *src);\nvoid\tsigacts_free(struct sigacts *ps);\nstruct sigacts *sigacts_hold(struct sigacts *ps);\nint\tsigacts_shared(struct sigacts *ps);\nvoid\tsigexit(struct thread *td, int sig) __dead2;\nint\tsigev_findtd(struct proc *p, struct sigevent *sigev, struct thread **);\nint\tsig_ffs(sigset_t *set);\nvoid\tsiginit(struct proc *p);\nvoid\tsignotify(struct thread *td);\nvoid\tsigqueue_delete(struct sigqueue *queue, int sig);\nvoid\tsigqueue_delete_proc(struct proc *p, int sig);\nvoid\tsigqueue_flush(struct sigqueue *queue);\nvoid\tsigqueue_init(struct sigqueue *queue, struct proc *p);\nvoid\tsigqueue_take(ksiginfo_t *ksi);\nvoid\ttdksignal(struct thread *td, int sig, ksiginfo_t *ksi);\nint\ttdsendsignal(struct proc *p, struct thread *td, int sig,\n\t   ksiginfo_t *ksi);\nvoid\ttdsigcleanup(struct thread *td);\nvoid\ttdsignal(struct thread *td, int sig);\nvoid\ttrapsignal(struct thread *td, ksiginfo_t *ksi);\n\n#endif /* _KERNEL */\n\n#endif /* !_SYS_SIGNALVAR_H_ */\n"
  },
  {
    "path": "freebsd-headers/sys/sleepqueue.h",
    "content": "/*-\n * Copyright (c) 2004 John Baldwin <jhb@FreeBSD.org>\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. Neither the name of the author nor the names of any co-contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/sys/sleepqueue.h 216421 2010-12-13 23:53:55Z mckusick $\n */\n\n#ifndef _SYS_SLEEPQUEUE_H_\n#define _SYS_SLEEPQUEUE_H_\n\n/*\n * Sleep queue interface.  Sleep/wakeup, condition variables, and sx\n * locks use a sleep queue for the queue of threads blocked on a sleep\n * channel.\n *\n * A thread calls sleepq_lock() to lock the sleep queue chain associated\n * with a given wait channel.  A thread can then call call sleepq_add() to\n * add themself onto a sleep queue and call one of the sleepq_wait()\n * functions to actually go to sleep.  If a thread needs to abort a sleep\n * operation it should call sleepq_release() to unlock the associated sleep\n * queue chain lock.  If the thread also needs to remove itself from a queue\n * it just enqueued itself on, it can use sleepq_remove() instead.\n *\n * If the thread only wishes to sleep for a limited amount of time, it can\n * call sleepq_set_timeout() after sleepq_add() to setup a timeout.  It\n * should then use one of the sleepq_timedwait() functions to block.\n *\n * If the thread wants the sleep to be interruptible by signals, it can\n * call sleepq_catch_signals() after sleepq_add().  It should then use\n * one of the sleepq_wait_sig() functions to block.  After the thread has\n * been resumed, it should call sleepq_calc_signal_retval() to determine\n * if it should return EINTR or ERESTART passing in the value returned from\n * the earlier call to sleepq_catch_signals().\n *\n * A thread is normally resumed from a sleep queue by either the\n * sleepq_signal() or sleepq_broadcast() functions.  Sleepq_signal() wakes\n * the thread with the highest priority that is sleeping on the specified\n * wait channel.  Sleepq_broadcast() wakes all threads that are sleeping\n * on the specified wait channel.  A thread sleeping in an interruptible\n * sleep can be interrupted by calling sleepq_abort().  A thread can also\n * be removed from a specified sleep queue using the sleepq_remove()\n * function.  Note that the sleep queue chain must first be locked via\n * sleepq_lock() before calling sleepq_abort(), sleepq_broadcast(), or\n * sleepq_signal().  These routines each return a boolean that will be true\n * if at least one swapped-out thread was resumed.  In that case, the caller\n * is responsible for waking up the swapper by calling kick_proc0() after\n * releasing the sleep queue chain lock.\n *\n * Each thread allocates a sleep queue at thread creation via sleepq_alloc()\n * and releases it at thread destruction via sleepq_free().  Note that\n * a sleep queue is not tied to a specific thread and that the sleep queue\n * released at thread destruction may not be the same sleep queue that the\n * thread allocated when it was created.\n *\n * XXX: Some other parts of the kernel such as ithread sleeping may end up\n * using this interface as well (death to TDI_IWAIT!)\n */\n\nstruct lock_object;\nstruct sleepqueue;\nstruct thread;\n\n#ifdef _KERNEL\n\n#define\tSLEEPQ_TYPE\t\t0x0ff\t\t/* Mask of sleep queue types. */\n#define\tSLEEPQ_SLEEP\t\t0x00\t\t/* Used by sleep/wakeup. */\n#define\tSLEEPQ_CONDVAR\t\t0x01\t\t/* Used for a cv. */\n#define\tSLEEPQ_PAUSE\t\t0x02\t\t/* Used by pause. */\n#define\tSLEEPQ_SX\t\t0x03\t\t/* Used by an sx lock. */\n#define\tSLEEPQ_LK\t\t0x04\t\t/* Used by a lockmgr. */\n#define\tSLEEPQ_INTERRUPTIBLE\t0x100\t\t/* Sleep is interruptible. */\n#define\tSLEEPQ_STOP_ON_BDRY\t0x200\t\t/* Stop sleeping thread on\n\t\t\t\t\t\t   user mode boundary */\n\nvoid\tinit_sleepqueues(void);\nint\tsleepq_abort(struct thread *td, int intrval);\nvoid\tsleepq_add(void *wchan, struct lock_object *lock, const char *wmesg,\n\t    int flags, int queue);\nstruct sleepqueue *sleepq_alloc(void);\nint\tsleepq_broadcast(void *wchan, int flags, int pri, int queue);\nvoid\tsleepq_free(struct sleepqueue *sq);\nvoid\tsleepq_lock(void *wchan);\nstruct sleepqueue *sleepq_lookup(void *wchan);\nvoid\tsleepq_release(void *wchan);\nvoid\tsleepq_remove(struct thread *td, void *wchan);\nint\tsleepq_signal(void *wchan, int flags, int pri, int queue);\nvoid\tsleepq_set_timeout(void *wchan, int timo);\nu_int\tsleepq_sleepcnt(void *wchan, int queue);\nint\tsleepq_timedwait(void *wchan, int pri);\nint\tsleepq_timedwait_sig(void *wchan, int pri);\nint\tsleepq_type(void *wchan);\nvoid\tsleepq_wait(void *wchan, int pri);\nint\tsleepq_wait_sig(void *wchan, int pri);\n\n#endif\t/* _KERNEL */\n#endif\t/* !_SYS_SLEEPQUEUE_H_ */\n"
  },
  {
    "path": "freebsd-headers/sys/smp.h",
    "content": "/*-\n * ----------------------------------------------------------------------------\n * \"THE BEER-WARE LICENSE\" (Revision 42):\n * <phk@FreeBSD.org> wrote this file.  As long as you retain this notice you\n * can do whatever you want with this stuff. If we meet some day, and you think\n * this stuff is worth it, you can buy me a beer in return.   Poul-Henning Kamp\n * ----------------------------------------------------------------------------\n *\n * $FreeBSD: release/9.0.0/sys/sys/smp.h 222813 2011-06-07 08:46:13Z attilio $\n */\n\n#ifndef _SYS_SMP_H_\n#define _SYS_SMP_H_\n\n#ifdef _KERNEL\n\n#ifndef LOCORE\n\n#include <sys/cpuset.h>\n\n/*\n * Topology of a NUMA or HTT system.\n *\n * The top level topology is an array of pointers to groups.  Each group\n * contains a bitmask of cpus in its group or subgroups.  It may also\n * contain a pointer to an array of child groups.\n *\n * The bitmasks at non leaf groups may be used by consumers who support\n * a smaller depth than the hardware provides.\n *\n * The topology may be omitted by systems where all CPUs are equal.\n */\n\nstruct cpu_group {\n\tstruct cpu_group *cg_parent;\t/* Our parent group. */\n\tstruct cpu_group *cg_child;\t/* Optional children groups. */\n\tcpuset_t\tcg_mask;\t/* Mask of cpus in this group. */\n\tint32_t\t\tcg_count;\t/* Count of cpus in this group. */\n\tint16_t\t\tcg_children;\t/* Number of children groups. */\n\tint8_t\t\tcg_level;\t/* Shared cache level. */\n\tint8_t\t\tcg_flags;\t/* Traversal modifiers. */\n};\n\ntypedef struct cpu_group *cpu_group_t;\n\n/*\n * Defines common resources for CPUs in the group.  The highest level\n * resource should be used when multiple are shared.\n */\n#define\tCG_SHARE_NONE\t0\n#define\tCG_SHARE_L1\t1\n#define\tCG_SHARE_L2\t2\n#define\tCG_SHARE_L3\t3\n\n/*\n * Behavior modifiers for load balancing and affinity.\n */\n#define\tCG_FLAG_HTT\t0x01\t\t/* Schedule the alternate core last. */\n#define\tCG_FLAG_SMT\t0x02\t\t/* New age htt, less crippled. */\n#define\tCG_FLAG_THREAD\t(CG_FLAG_HTT | CG_FLAG_SMT)\t/* Any threading. */\n\n/*\n * Convenience routines for building topologies.\n */\n#ifdef SMP\nstruct cpu_group *smp_topo(void);\nstruct cpu_group *smp_topo_none(void);\nstruct cpu_group *smp_topo_1level(int l1share, int l1count, int l1flags);\nstruct cpu_group *smp_topo_2level(int l2share, int l2count, int l1share,\n    int l1count, int l1flags);\nstruct cpu_group *smp_topo_find(struct cpu_group *top, int cpu);\n\nextern void (*cpustop_restartfunc)(void);\nextern int smp_active;\nextern int smp_cpus;\nextern volatile cpuset_t started_cpus;\nextern volatile cpuset_t stopped_cpus;\nextern cpuset_t hlt_cpus_mask;\nextern cpuset_t logical_cpus_mask;\n#endif /* SMP */\n\nextern u_int mp_maxid;\nextern int mp_maxcpus;\nextern int mp_ncpus;\nextern volatile int smp_started;\n\nextern cpuset_t all_cpus;\n\n/*\n * Macro allowing us to determine whether a CPU is absent at any given\n * time, thus permitting us to configure sparse maps of cpuid-dependent\n * (per-CPU) structures.\n */\n#define\tCPU_ABSENT(x_cpu)\t(!CPU_ISSET(x_cpu, &all_cpus))\n\n/*\n * Macros to iterate over non-absent CPUs.  CPU_FOREACH() takes an\n * integer iterator and iterates over the available set of CPUs.\n * CPU_FIRST() returns the id of the first non-absent CPU.  CPU_NEXT()\n * returns the id of the next non-absent CPU.  It will wrap back to\n * CPU_FIRST() once the end of the list is reached.  The iterators are\n * currently implemented via inline functions.\n */\n#define\tCPU_FOREACH(i)\t\t\t\t\t\t\t\\\n\tfor ((i) = 0; (i) <= mp_maxid; (i)++)\t\t\t\t\\\n\t\tif (!CPU_ABSENT((i)))\n\nstatic __inline int\ncpu_first(void)\n{\n\tint i;\n\n\tfor (i = 0;; i++)\n\t\tif (!CPU_ABSENT(i))\n\t\t\treturn (i);\n}\n\nstatic __inline int\ncpu_next(int i)\n{\n\n\tfor (;;) {\n\t\ti++;\n\t\tif (i > mp_maxid)\n\t\t\ti = 0;\n\t\tif (!CPU_ABSENT(i))\n\t\t\treturn (i);\n\t}\n}\n\n#define\tCPU_FIRST()\tcpu_first()\n#define\tCPU_NEXT(i)\tcpu_next((i))\n\n#ifdef SMP\n/*\n * Machine dependent functions used to initialize MP support.\n *\n * The cpu_mp_probe() should check to see if MP support is present and return\n * zero if it is not or non-zero if it is.  If MP support is present, then\n * cpu_mp_start() will be called so that MP can be enabled.  This function\n * should do things such as startup secondary processors.  It should also\n * setup mp_ncpus, all_cpus, and smp_cpus.  It should also ensure that\n * smp_active and smp_started are initialized at the appropriate time.\n * Once cpu_mp_start() returns, machine independent MP startup code will be\n * executed and a simple message will be output to the console.  Finally,\n * cpu_mp_announce() will be called so that machine dependent messages about\n * the MP support may be output to the console if desired.\n *\n * The cpu_setmaxid() function is called very early during the boot process\n * so that the MD code may set mp_maxid to provide an upper bound on CPU IDs\n * that other subsystems may use.  If a platform is not able to determine\n * the exact maximum ID that early, then it may set mp_maxid to MAXCPU - 1.\n */\nstruct thread;\n\nstruct cpu_group *cpu_topo(void);\nvoid\tcpu_mp_announce(void);\nint\tcpu_mp_probe(void);\nvoid\tcpu_mp_setmaxid(void);\nvoid\tcpu_mp_start(void);\n\nvoid\tforward_signal(struct thread *);\nint\trestart_cpus(cpuset_t);\nint\tstop_cpus(cpuset_t);\nint\tstop_cpus_hard(cpuset_t);\n#if defined(__amd64__)\nint\tsuspend_cpus(cpuset_t);\n#endif\nvoid\tsmp_rendezvous_action(void);\nextern\tstruct mtx smp_ipi_mtx;\n\n#endif /* SMP */\nvoid\tsmp_no_rendevous_barrier(void *);\nvoid\tsmp_rendezvous(void (*)(void *), \n\t\t       void (*)(void *),\n\t\t       void (*)(void *),\n\t\t       void *arg);\nvoid\tsmp_rendezvous_cpus(cpuset_t,\n\t\t       void (*)(void *), \n\t\t       void (*)(void *),\n\t\t       void (*)(void *),\n\t\t       void *arg);\n#endif /* !LOCORE */\n#endif /* _KERNEL */\n#endif /* _SYS_SMP_H_ */\n"
  },
  {
    "path": "freebsd-headers/sys/snoop.h",
    "content": "/*-\n * Copyright (c) 1995 Ugen J.S.Antsilevich\n *\n * Redistribution and use in source forms, with and without modification,\n * are permitted provided that this entire comment appears intact.\n *\n * Redistribution in binary form may occur without any restrictions.\n * Obviously, it would be nice if you gave credit where credit is due\n * but requiring it would be too onerous.\n *\n * This software is provided ``AS IS'' without any warranties of any kind.\n *\n * Snoop stuff.\n *\n * $FreeBSD: release/9.0.0/sys/sys/snoop.h 150298 2005-09-18 19:23:35Z cognet $\n */\n\n#ifndef _SYS_SNOOP_H_\n#define\t_SYS_SNOOP_H_\n\n#ifndef _KERNEL\n#include <sys/types.h>\n#endif\n#include <sys/ioccom.h>\n\n/*\n * These are snoop io controls\n * SNPSTTY accepts a file descriptor as input.\n */\n\n#define SNPSTTY       _IOW('T', 90, int)\n#define SNPGTTY       _IOR('T', 89, dev_t)\n\n/*\n * These values would be returned by FIONREAD ioctl\n * instead of number of characters in buffer in case\n * of specific errors.\n */\n#define SNP_OFLOW\t\t-1\n#define SNP_TTYCLOSE\t\t-2\n#define SNP_DETACH\t\t-3\n\n#endif /* !_SYS_SNOOP_H_ */\n"
  },
  {
    "path": "freebsd-headers/sys/sockbuf.h",
    "content": "/*-\n * Copyright (c) 1982, 1986, 1990, 1993\n *\tThe Regents of the University of California.  All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 4. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t@(#)socketvar.h\t8.3 (Berkeley) 2/19/95\n *\n * $FreeBSD: release/9.0.0/sys/sys/sockbuf.h 225169 2011-08-25 09:20:13Z bz $\n */\n#ifndef _SYS_SOCKBUF_H_\n#define _SYS_SOCKBUF_H_\n#include <sys/selinfo.h>\t\t/* for struct selinfo */\n#include <sys/_lock.h>\n#include <sys/_mutex.h>\n#include <sys/_sx.h>\n\n#define\tSB_MAX\t\t(2*1024*1024)\t/* default for max chars in sockbuf */\n\n/*\n * Constants for sb_flags field of struct sockbuf.\n */\n#define\tSB_WAIT\t\t0x04\t\t/* someone is waiting for data/space */\n#define\tSB_SEL\t\t0x08\t\t/* someone is selecting */\n#define\tSB_ASYNC\t0x10\t\t/* ASYNC I/O, need signals */\n#define\tSB_UPCALL\t0x20\t\t/* someone wants an upcall */\n#define\tSB_NOINTR\t0x40\t\t/* operations not interruptible */\n#define\tSB_AIO\t\t0x80\t\t/* AIO operations queued */\n#define\tSB_KNOTE\t0x100\t\t/* kernel note attached */\n#define\tSB_NOCOALESCE\t0x200\t\t/* don't coalesce new data into existing mbufs */\n#define\tSB_IN_TOE\t0x400\t\t/* socket buffer is in the middle of an operation */\n#define\tSB_AUTOSIZE\t0x800\t\t/* automatically size socket buffer */\n\n#define\tSBS_CANTSENDMORE\t0x0010\t/* can't send more data to peer */\n#define\tSBS_CANTRCVMORE\t\t0x0020\t/* can't receive more data from peer */\n#define\tSBS_RCVATMARK\t\t0x0040\t/* at mark on input */\n\nstruct mbuf;\nstruct sockaddr;\nstruct socket;\nstruct thread;\n\nstruct\txsockbuf {\n\tu_int\tsb_cc;\n\tu_int\tsb_hiwat;\n\tu_int\tsb_mbcnt;\n\tu_int   sb_mcnt;\n\tu_int   sb_ccnt;\n\tu_int\tsb_mbmax;\n\tint\tsb_lowat;\n\tint\tsb_timeo;\n\tshort\tsb_flags;\n};\n\n/*\n * Variables for socket buffering.\n */\nstruct\tsockbuf {\n\tstruct\tselinfo sb_sel;\t/* process selecting read/write */\n\tstruct\tmtx sb_mtx;\t/* sockbuf lock */\n\tstruct\tsx sb_sx;\t/* prevent I/O interlacing */\n\tshort\tsb_state;\t/* (c/d) socket state on sockbuf */\n#define\tsb_startzero\tsb_mb\n\tstruct\tmbuf *sb_mb;\t/* (c/d) the mbuf chain */\n\tstruct\tmbuf *sb_mbtail; /* (c/d) the last mbuf in the chain */\n\tstruct\tmbuf *sb_lastrecord;\t/* (c/d) first mbuf of last\n\t\t\t\t\t * record in socket buffer */\n\tstruct\tmbuf *sb_sndptr; /* (c/d) pointer into mbuf chain */\n\tu_int\tsb_sndptroff;\t/* (c/d) byte offset of ptr into chain */\n\tu_int\tsb_cc;\t\t/* (c/d) actual chars in buffer */\n\tu_int\tsb_hiwat;\t/* (c/d) max actual char count */\n\tu_int\tsb_mbcnt;\t/* (c/d) chars of mbufs used */\n\tu_int   sb_mcnt;        /* (c/d) number of mbufs in buffer */\n\tu_int   sb_ccnt;        /* (c/d) number of clusters in buffer */\n\tu_int\tsb_mbmax;\t/* (c/d) max chars of mbufs to use */\n\tu_int\tsb_ctl;\t\t/* (c/d) non-data chars in buffer */\n\tint\tsb_lowat;\t/* (c/d) low water mark */\n\tint\tsb_timeo;\t/* (c/d) timeout for read/write */\n\tshort\tsb_flags;\t/* (c/d) flags, see below */\n\tint\t(*sb_upcall)(struct socket *, void *, int); /* (c/d) */\n\tvoid\t*sb_upcallarg;\t/* (c/d) */\n};\n\n#ifdef _KERNEL\n\n/*\n * Per-socket buffer mutex used to protect most fields in the socket\n * buffer.\n */\n#define\tSOCKBUF_MTX(_sb)\t\t(&(_sb)->sb_mtx)\n#define\tSOCKBUF_LOCK_INIT(_sb, _name) \\\n\tmtx_init(SOCKBUF_MTX(_sb), _name, NULL, MTX_DEF)\n#define\tSOCKBUF_LOCK_DESTROY(_sb)\tmtx_destroy(SOCKBUF_MTX(_sb))\n#define\tSOCKBUF_LOCK(_sb)\t\tmtx_lock(SOCKBUF_MTX(_sb))\n#define\tSOCKBUF_OWNED(_sb)\t\tmtx_owned(SOCKBUF_MTX(_sb))\n#define\tSOCKBUF_UNLOCK(_sb)\t\tmtx_unlock(SOCKBUF_MTX(_sb))\n#define\tSOCKBUF_LOCK_ASSERT(_sb)\tmtx_assert(SOCKBUF_MTX(_sb), MA_OWNED)\n#define\tSOCKBUF_UNLOCK_ASSERT(_sb)\tmtx_assert(SOCKBUF_MTX(_sb), MA_NOTOWNED)\n\nvoid\tsbappend(struct sockbuf *sb, struct mbuf *m);\nvoid\tsbappend_locked(struct sockbuf *sb, struct mbuf *m);\nvoid\tsbappendstream(struct sockbuf *sb, struct mbuf *m);\nvoid\tsbappendstream_locked(struct sockbuf *sb, struct mbuf *m);\nint\tsbappendaddr(struct sockbuf *sb, const struct sockaddr *asa,\n\t    struct mbuf *m0, struct mbuf *control);\nint\tsbappendaddr_locked(struct sockbuf *sb, const struct sockaddr *asa,\n\t    struct mbuf *m0, struct mbuf *control);\nint\tsbappendcontrol(struct sockbuf *sb, struct mbuf *m0,\n\t    struct mbuf *control);\nint\tsbappendcontrol_locked(struct sockbuf *sb, struct mbuf *m0,\n\t    struct mbuf *control);\nvoid\tsbappendrecord(struct sockbuf *sb, struct mbuf *m0);\nvoid\tsbappendrecord_locked(struct sockbuf *sb, struct mbuf *m0);\nvoid\tsbcheck(struct sockbuf *sb);\nvoid\tsbcompress(struct sockbuf *sb, struct mbuf *m, struct mbuf *n);\nstruct mbuf *\n\tsbcreatecontrol(caddr_t p, int size, int type, int level);\nvoid\tsbdestroy(struct sockbuf *sb, struct socket *so);\nvoid\tsbdrop(struct sockbuf *sb, int len);\nvoid\tsbdrop_locked(struct sockbuf *sb, int len);\nvoid\tsbdroprecord(struct sockbuf *sb);\nvoid\tsbdroprecord_locked(struct sockbuf *sb);\nvoid\tsbflush(struct sockbuf *sb);\nvoid\tsbflush_locked(struct sockbuf *sb);\nvoid\tsbrelease(struct sockbuf *sb, struct socket *so);\nvoid\tsbrelease_internal(struct sockbuf *sb, struct socket *so);\nvoid\tsbrelease_locked(struct sockbuf *sb, struct socket *so);\nint\tsbreserve(struct sockbuf *sb, u_long cc, struct socket *so,\n\t    struct thread *td);\nint\tsbreserve_locked(struct sockbuf *sb, u_long cc, struct socket *so,\n\t    struct thread *td);\nstruct mbuf *\n\tsbsndptr(struct sockbuf *sb, u_int off, u_int len, u_int *moff);\nvoid\tsbtoxsockbuf(struct sockbuf *sb, struct xsockbuf *xsb);\nint\tsbwait(struct sockbuf *sb);\nint\tsblock(struct sockbuf *sb, int flags);\nvoid\tsbunlock(struct sockbuf *sb);\n\n/*\n * How much space is there in a socket buffer (so->so_snd or so->so_rcv)?\n * This is problematical if the fields are unsigned, as the space might\n * still be negative (cc > hiwat or mbcnt > mbmax).  Should detect\n * overflow and return 0.  Should use \"lmin\" but it doesn't exist now.\n */\n#define\tsbspace(sb) \\\n    ((long) imin((int)((sb)->sb_hiwat - (sb)->sb_cc), \\\n\t (int)((sb)->sb_mbmax - (sb)->sb_mbcnt)))\n\n/* adjust counters in sb reflecting allocation of m */\n#define\tsballoc(sb, m) { \\\n\t(sb)->sb_cc += (m)->m_len; \\\n\tif ((m)->m_type != MT_DATA && (m)->m_type != MT_OOBDATA) \\\n\t\t(sb)->sb_ctl += (m)->m_len; \\\n\t(sb)->sb_mbcnt += MSIZE; \\\n\t(sb)->sb_mcnt += 1; \\\n\tif ((m)->m_flags & M_EXT) { \\\n\t\t(sb)->sb_mbcnt += (m)->m_ext.ext_size; \\\n\t\t(sb)->sb_ccnt += 1; \\\n\t} \\\n}\n\n/* adjust counters in sb reflecting freeing of m */\n#define\tsbfree(sb, m) { \\\n\t(sb)->sb_cc -= (m)->m_len; \\\n\tif ((m)->m_type != MT_DATA && (m)->m_type != MT_OOBDATA) \\\n\t\t(sb)->sb_ctl -= (m)->m_len; \\\n\t(sb)->sb_mbcnt -= MSIZE; \\\n\t(sb)->sb_mcnt -= 1; \\\n\tif ((m)->m_flags & M_EXT) { \\\n\t\t(sb)->sb_mbcnt -= (m)->m_ext.ext_size; \\\n\t\t(sb)->sb_ccnt -= 1; \\\n\t} \\\n\tif ((sb)->sb_sndptr == (m)) { \\\n\t\t(sb)->sb_sndptr = NULL; \\\n\t\t(sb)->sb_sndptroff = 0; \\\n\t} \\\n\tif ((sb)->sb_sndptroff != 0) \\\n\t\t(sb)->sb_sndptroff -= (m)->m_len; \\\n}\n\n#define SB_EMPTY_FIXUP(sb) do {\t\t\t\t\t\t\\\n\tif ((sb)->sb_mb == NULL) {\t\t\t\t\t\\\n\t\t(sb)->sb_mbtail = NULL;\t\t\t\t\t\\\n\t\t(sb)->sb_lastrecord = NULL;\t\t\t\t\\\n\t}\t\t\t\t\t\t\t\t\\\n} while (/*CONSTCOND*/0)\n\n#ifdef SOCKBUF_DEBUG\nvoid\tsblastrecordchk(struct sockbuf *, const char *, int);\n#define\tSBLASTRECORDCHK(sb)\tsblastrecordchk((sb), __FILE__, __LINE__)\n\nvoid\tsblastmbufchk(struct sockbuf *, const char *, int);\n#define\tSBLASTMBUFCHK(sb)\tsblastmbufchk((sb), __FILE__, __LINE__)\n#else\n#define\tSBLASTRECORDCHK(sb)      /* nothing */\n#define\tSBLASTMBUFCHK(sb)        /* nothing */\n#endif /* SOCKBUF_DEBUG */\n\n#endif /* _KERNEL */\n\n#endif /* _SYS_SOCKBUF_H_ */\n"
  },
  {
    "path": "freebsd-headers/sys/socket.h",
    "content": "/*-\n * Copyright (c) 1982, 1985, 1986, 1988, 1993, 1994\n *\tThe Regents of the University of California.  All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 4. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t@(#)socket.h\t8.4 (Berkeley) 2/21/94\n * $FreeBSD: release/9.0.0/sys/sys/socket.h 220742 2011-04-17 16:04:39Z jilles $\n */\n\n#ifndef _SYS_SOCKET_H_\n#define\t_SYS_SOCKET_H_\n\n#include <sys/cdefs.h>\n#include <sys/_types.h>\n#include <sys/_iovec.h>\n#include <machine/_align.h>\n\n/*\n * Definitions related to sockets: types, address families, options.\n */\n\n/*\n * Data types.\n */\n#if __BSD_VISIBLE\n#ifndef _GID_T_DECLARED\ntypedef\t__gid_t\t\tgid_t;\n#define\t_GID_T_DECLARED\n#endif\n\n#ifndef _OFF_T_DECLARED\ntypedef\t__off_t\t\toff_t;\n#define\t_OFF_T_DECLARED\n#endif\n\n#ifndef _PID_T_DECLARED\ntypedef\t__pid_t\t\tpid_t;\n#define\t_PID_T_DECLARED\n#endif\n#endif\n\n#ifndef _SA_FAMILY_T_DECLARED\ntypedef\t__sa_family_t\tsa_family_t;\n#define\t_SA_FAMILY_T_DECLARED\n#endif\n\n#ifndef _SOCKLEN_T_DECLARED\ntypedef\t__socklen_t\tsocklen_t;\n#define\t_SOCKLEN_T_DECLARED\n#endif\n \n#ifndef _SSIZE_T_DECLARED\ntypedef\t__ssize_t\tssize_t;\n#define\t_SSIZE_T_DECLARED\n#endif\n\n#if __BSD_VISIBLE \n#ifndef _UID_T_DECLARED\ntypedef\t__uid_t\t\tuid_t;\n#define\t_UID_T_DECLARED\n#endif\n#endif\n\n/*\n * Types\n */\n#define\tSOCK_STREAM\t1\t\t/* stream socket */\n#define\tSOCK_DGRAM\t2\t\t/* datagram socket */\n#define\tSOCK_RAW\t3\t\t/* raw-protocol interface */\n#if __BSD_VISIBLE\n#define\tSOCK_RDM\t4\t\t/* reliably-delivered message */\n#endif\n#define\tSOCK_SEQPACKET\t5\t\t/* sequenced packet stream */\n\n/*\n * Option flags per-socket.\n */\n#define\tSO_DEBUG\t0x0001\t\t/* turn on debugging info recording */\n#define\tSO_ACCEPTCONN\t0x0002\t\t/* socket has had listen() */\n#define\tSO_REUSEADDR\t0x0004\t\t/* allow local address reuse */\n#define\tSO_KEEPALIVE\t0x0008\t\t/* keep connections alive */\n#define\tSO_DONTROUTE\t0x0010\t\t/* just use interface addresses */\n#define\tSO_BROADCAST\t0x0020\t\t/* permit sending of broadcast msgs */\n#if __BSD_VISIBLE\n#define\tSO_USELOOPBACK\t0x0040\t\t/* bypass hardware when possible */\n#endif\n#define\tSO_LINGER\t0x0080\t\t/* linger on close if data present */\n#define\tSO_OOBINLINE\t0x0100\t\t/* leave received OOB data in line */\n#if __BSD_VISIBLE\n#define\tSO_REUSEPORT\t0x0200\t\t/* allow local address & port reuse */\n#define\tSO_TIMESTAMP\t0x0400\t\t/* timestamp received dgram traffic */\n#define\tSO_NOSIGPIPE\t0x0800\t\t/* no SIGPIPE from EPIPE */\n#define\tSO_ACCEPTFILTER\t0x1000\t\t/* there is an accept filter */\n#define\tSO_BINTIME\t0x2000\t\t/* timestamp received dgram traffic */\n#endif\n#define\tSO_NO_OFFLOAD\t0x4000\t\t/* socket cannot be offloaded */\n#define\tSO_NO_DDP\t0x8000\t\t/* disable direct data placement */\n\n/*\n * Additional options, not kept in so_options.\n */\n#define\tSO_SNDBUF\t0x1001\t\t/* send buffer size */\n#define\tSO_RCVBUF\t0x1002\t\t/* receive buffer size */\n#define\tSO_SNDLOWAT\t0x1003\t\t/* send low-water mark */\n#define\tSO_RCVLOWAT\t0x1004\t\t/* receive low-water mark */\n#define\tSO_SNDTIMEO\t0x1005\t\t/* send timeout */\n#define\tSO_RCVTIMEO\t0x1006\t\t/* receive timeout */\n#define\tSO_ERROR\t0x1007\t\t/* get error status and clear */\n#define\tSO_TYPE\t\t0x1008\t\t/* get socket type */\n#if __BSD_VISIBLE\n#define\tSO_LABEL\t0x1009\t\t/* socket's MAC label */\n#define\tSO_PEERLABEL\t0x1010\t\t/* socket's peer's MAC label */\n#define\tSO_LISTENQLIMIT\t0x1011\t\t/* socket's backlog limit */\n#define\tSO_LISTENQLEN\t0x1012\t\t/* socket's complete queue length */\n#define\tSO_LISTENINCQLEN\t0x1013\t/* socket's incomplete queue length */\n#define\tSO_SETFIB\t0x1014\t\t/* use this FIB to route */\n#define\tSO_USER_COOKIE\t0x1015\t\t/* user cookie (dummynet etc.) */\n#endif\n\n/*\n * Structure used for manipulating linger option.\n */\nstruct linger {\n\tint\tl_onoff;\t\t/* option on/off */\n\tint\tl_linger;\t\t/* linger time */\n};\n\n#if __BSD_VISIBLE\nstruct accept_filter_arg {\n\tchar\taf_name[16];\n\tchar\taf_arg[256-16];\n};\n#endif\n\n/*\n * Level number for (get/set)sockopt() to apply to socket itself.\n */\n#define\tSOL_SOCKET\t0xffff\t\t/* options for socket level */\n\n/*\n * Address families.\n */\n#define\tAF_UNSPEC\t0\t\t/* unspecified */\n#if __BSD_VISIBLE\n#define\tAF_LOCAL\tAF_UNIX\t\t/* local to host (pipes, portals) */\n#endif\n#define\tAF_UNIX\t\t1\t\t/* standardized name for AF_LOCAL */\n#define\tAF_INET\t\t2\t\t/* internetwork: UDP, TCP, etc. */\n#if __BSD_VISIBLE\n#define\tAF_IMPLINK\t3\t\t/* arpanet imp addresses */\n#define\tAF_PUP\t\t4\t\t/* pup protocols: e.g. BSP */\n#define\tAF_CHAOS\t5\t\t/* mit CHAOS protocols */\n#define\tAF_NETBIOS\t6\t\t/* SMB protocols */\n#define\tAF_ISO\t\t7\t\t/* ISO protocols */\n#define\tAF_OSI\t\tAF_ISO\n#define\tAF_ECMA\t\t8\t\t/* European computer manufacturers */\n#define\tAF_DATAKIT\t9\t\t/* datakit protocols */\n#define\tAF_CCITT\t10\t\t/* CCITT protocols, X.25 etc */\n#define\tAF_SNA\t\t11\t\t/* IBM SNA */\n#define AF_DECnet\t12\t\t/* DECnet */\n#define AF_DLI\t\t13\t\t/* DEC Direct data link interface */\n#define AF_LAT\t\t14\t\t/* LAT */\n#define\tAF_HYLINK\t15\t\t/* NSC Hyperchannel */\n#define\tAF_APPLETALK\t16\t\t/* Apple Talk */\n#define\tAF_ROUTE\t17\t\t/* Internal Routing Protocol */\n#define\tAF_LINK\t\t18\t\t/* Link layer interface */\n#define\tpseudo_AF_XTP\t19\t\t/* eXpress Transfer Protocol (no AF) */\n#define\tAF_COIP\t\t20\t\t/* connection-oriented IP, aka ST II */\n#define\tAF_CNT\t\t21\t\t/* Computer Network Technology */\n#define pseudo_AF_RTIP\t22\t\t/* Help Identify RTIP packets */\n#define\tAF_IPX\t\t23\t\t/* Novell Internet Protocol */\n#define\tAF_SIP\t\t24\t\t/* Simple Internet Protocol */\n#define\tpseudo_AF_PIP\t25\t\t/* Help Identify PIP packets */\n#define\tAF_ISDN\t\t26\t\t/* Integrated Services Digital Network*/\n#define\tAF_E164\t\tAF_ISDN\t\t/* CCITT E.164 recommendation */\n#define\tpseudo_AF_KEY\t27\t\t/* Internal key-management function */\n#endif\n#define\tAF_INET6\t28\t\t/* IPv6 */\n#if __BSD_VISIBLE\n#define\tAF_NATM\t\t29\t\t/* native ATM access */\n#define\tAF_ATM\t\t30\t\t/* ATM */\n#define pseudo_AF_HDRCMPLT 31\t\t/* Used by BPF to not rewrite headers\n\t\t\t\t\t * in interface output routine\n\t\t\t\t\t */\n#define\tAF_NETGRAPH\t32\t\t/* Netgraph sockets */\n#define\tAF_SLOW\t\t33\t\t/* 802.3ad slow protocol */\n#define\tAF_SCLUSTER\t34\t\t/* Sitara cluster protocol */\n#define\tAF_ARP\t\t35\n#define\tAF_BLUETOOTH\t36\t\t/* Bluetooth sockets */\n#define\tAF_IEEE80211\t37\t\t/* IEEE 802.11 protocol */\n#define\tAF_MAX\t\t38\n/*\n * When allocating a new AF_ constant, please only allocate\n * even numbered constants for FreeBSD until 134 as odd numbered AF_\n * constants 39-133 are now reserved for vendors.\n */\n#define AF_VENDOR00 39\n#define AF_VENDOR01 41\n#define AF_VENDOR02 43\n#define AF_VENDOR03 45\n#define AF_VENDOR04 47\n#define AF_VENDOR05 49\n#define AF_VENDOR06 51\n#define AF_VENDOR07 53\n#define AF_VENDOR08 55\n#define AF_VENDOR09 57\n#define AF_VENDOR10 59\n#define AF_VENDOR11 61\n#define AF_VENDOR12 63\n#define AF_VENDOR13 65\n#define AF_VENDOR14 67\n#define AF_VENDOR15 69\n#define AF_VENDOR16 71\n#define AF_VENDOR17 73\n#define AF_VENDOR18 75\n#define AF_VENDOR19 77\n#define AF_VENDOR20 79\n#define AF_VENDOR21 81\n#define AF_VENDOR22 83\n#define AF_VENDOR23 85\n#define AF_VENDOR24 87\n#define AF_VENDOR25 89\n#define AF_VENDOR26 91\n#define AF_VENDOR27 93\n#define AF_VENDOR28 95\n#define AF_VENDOR29 97\n#define AF_VENDOR30 99\n#define AF_VENDOR31 101\n#define AF_VENDOR32 103\n#define AF_VENDOR33 105\n#define AF_VENDOR34 107\n#define AF_VENDOR35 109\n#define AF_VENDOR36 111\n#define AF_VENDOR37 113\n#define AF_VENDOR38 115\n#define AF_VENDOR39 117\n#define AF_VENDOR40 119\n#define AF_VENDOR41 121\n#define AF_VENDOR42 123\n#define AF_VENDOR43 125\n#define AF_VENDOR44 127\n#define AF_VENDOR45 129\n#define AF_VENDOR46 131\n#define AF_VENDOR47 133\n#endif\n\n/*\n * Structure used by kernel to store most\n * addresses.\n */\nstruct sockaddr {\n\tunsigned char\tsa_len;\t\t/* total length */\n\tsa_family_t\tsa_family;\t/* address family */\n\tchar\t\tsa_data[14];\t/* actually longer; address value */\n};\n#if __BSD_VISIBLE\n#define\tSOCK_MAXADDRLEN\t255\t\t/* longest possible addresses */\n\n/*\n * Structure used by kernel to pass protocol\n * information in raw sockets.\n */\nstruct sockproto {\n\tunsigned short\tsp_family;\t\t/* address family */\n\tunsigned short\tsp_protocol;\t\t/* protocol */\n};\n#endif\n\n#include <sys/_sockaddr_storage.h>\n\n#if __BSD_VISIBLE\n/*\n * Protocol families, same as address families for now.\n */\n#define\tPF_UNSPEC\tAF_UNSPEC\n#define\tPF_LOCAL\tAF_LOCAL\n#define\tPF_UNIX\t\tPF_LOCAL\t/* backward compatibility */\n#define\tPF_INET\t\tAF_INET\n#define\tPF_IMPLINK\tAF_IMPLINK\n#define\tPF_PUP\t\tAF_PUP\n#define\tPF_CHAOS\tAF_CHAOS\n#define\tPF_NETBIOS\tAF_NETBIOS\n#define\tPF_ISO\t\tAF_ISO\n#define\tPF_OSI\t\tAF_ISO\n#define\tPF_ECMA\t\tAF_ECMA\n#define\tPF_DATAKIT\tAF_DATAKIT\n#define\tPF_CCITT\tAF_CCITT\n#define\tPF_SNA\t\tAF_SNA\n#define PF_DECnet\tAF_DECnet\n#define PF_DLI\t\tAF_DLI\n#define PF_LAT\t\tAF_LAT\n#define\tPF_HYLINK\tAF_HYLINK\n#define\tPF_APPLETALK\tAF_APPLETALK\n#define\tPF_ROUTE\tAF_ROUTE\n#define\tPF_LINK\t\tAF_LINK\n#define\tPF_XTP\t\tpseudo_AF_XTP\t/* really just proto family, no AF */\n#define\tPF_COIP\t\tAF_COIP\n#define\tPF_CNT\t\tAF_CNT\n#define\tPF_SIP\t\tAF_SIP\n#define\tPF_IPX\t\tAF_IPX\n#define PF_RTIP\t\tpseudo_AF_RTIP\t/* same format as AF_INET */\n#define PF_PIP\t\tpseudo_AF_PIP\n#define\tPF_ISDN\t\tAF_ISDN\n#define\tPF_KEY\t\tpseudo_AF_KEY\n#define\tPF_INET6\tAF_INET6\n#define\tPF_NATM\t\tAF_NATM\n#define\tPF_ATM\t\tAF_ATM\n#define\tPF_NETGRAPH\tAF_NETGRAPH\n#define\tPF_SLOW\t\tAF_SLOW\n#define PF_SCLUSTER\tAF_SCLUSTER\n#define\tPF_ARP\t\tAF_ARP\n#define\tPF_BLUETOOTH\tAF_BLUETOOTH\n\n#define\tPF_MAX\t\tAF_MAX\n\n/*\n * Definitions for network related sysctl, CTL_NET.\n *\n * Second level is protocol family.\n * Third level is protocol number.\n *\n * Further levels are defined by the individual families below.\n */\n#define NET_MAXID\tAF_MAX\n\n#define CTL_NET_NAMES { \\\n\t{ 0, 0 }, \\\n\t{ \"unix\", CTLTYPE_NODE }, \\\n\t{ \"inet\", CTLTYPE_NODE }, \\\n\t{ \"implink\", CTLTYPE_NODE }, \\\n\t{ \"pup\", CTLTYPE_NODE }, \\\n\t{ \"chaos\", CTLTYPE_NODE }, \\\n\t{ \"xerox_ns\", CTLTYPE_NODE }, \\\n\t{ \"iso\", CTLTYPE_NODE }, \\\n\t{ \"emca\", CTLTYPE_NODE }, \\\n\t{ \"datakit\", CTLTYPE_NODE }, \\\n\t{ \"ccitt\", CTLTYPE_NODE }, \\\n\t{ \"ibm_sna\", CTLTYPE_NODE }, \\\n\t{ \"decnet\", CTLTYPE_NODE }, \\\n\t{ \"dec_dli\", CTLTYPE_NODE }, \\\n\t{ \"lat\", CTLTYPE_NODE }, \\\n\t{ \"hylink\", CTLTYPE_NODE }, \\\n\t{ \"appletalk\", CTLTYPE_NODE }, \\\n\t{ \"route\", CTLTYPE_NODE }, \\\n\t{ \"link_layer\", CTLTYPE_NODE }, \\\n\t{ \"xtp\", CTLTYPE_NODE }, \\\n\t{ \"coip\", CTLTYPE_NODE }, \\\n\t{ \"cnt\", CTLTYPE_NODE }, \\\n\t{ \"rtip\", CTLTYPE_NODE }, \\\n\t{ \"ipx\", CTLTYPE_NODE }, \\\n\t{ \"sip\", CTLTYPE_NODE }, \\\n\t{ \"pip\", CTLTYPE_NODE }, \\\n\t{ \"isdn\", CTLTYPE_NODE }, \\\n\t{ \"key\", CTLTYPE_NODE }, \\\n\t{ \"inet6\", CTLTYPE_NODE }, \\\n\t{ \"natm\", CTLTYPE_NODE }, \\\n\t{ \"atm\", CTLTYPE_NODE }, \\\n\t{ \"hdrcomplete\", CTLTYPE_NODE }, \\\n\t{ \"netgraph\", CTLTYPE_NODE }, \\\n\t{ \"snp\", CTLTYPE_NODE }, \\\n\t{ \"scp\", CTLTYPE_NODE }, \\\n}\n\n/*\n * PF_ROUTE - Routing table\n *\n * Three additional levels are defined:\n *\tFourth: address family, 0 is wildcard\n *\tFifth: type of info, defined below\n *\tSixth: flag(s) to mask with for NET_RT_FLAGS\n */\n#define NET_RT_DUMP\t1\t\t/* dump; may limit to a.f. */\n#define NET_RT_FLAGS\t2\t\t/* by flags, e.g. RESOLVING */\n#define NET_RT_IFLIST\t3\t\t/* survey interface list */\n#define\tNET_RT_IFMALIST\t4\t\t/* return multicast address list */\n#define\tNET_RT_MAXID\t5\n\n#define CTL_NET_RT_NAMES { \\\n\t{ 0, 0 }, \\\n\t{ \"dump\", CTLTYPE_STRUCT }, \\\n\t{ \"flags\", CTLTYPE_STRUCT }, \\\n\t{ \"iflist\", CTLTYPE_STRUCT }, \\\n\t{ \"ifmalist\", CTLTYPE_STRUCT }, \\\n}\n#endif /* __BSD_VISIBLE */\n\n/*\n * Maximum queue length specifiable by listen.\n */\n#define\tSOMAXCONN\t128\n\n/*\n * Message header for recvmsg and sendmsg calls.\n * Used value-result for recvmsg, value only for sendmsg.\n */\nstruct msghdr {\n\tvoid\t\t*msg_name;\t\t/* optional address */\n\tsocklen_t\t msg_namelen;\t\t/* size of address */\n\tstruct iovec\t*msg_iov;\t\t/* scatter/gather array */\n\tint\t\t msg_iovlen;\t\t/* # elements in msg_iov */\n\tvoid\t\t*msg_control;\t\t/* ancillary data, see below */\n\tsocklen_t\t msg_controllen;\t/* ancillary data buffer len */\n\tint\t\t msg_flags;\t\t/* flags on received message */\n};\n\n#define\tMSG_OOB\t\t0x1\t\t/* process out-of-band data */\n#define\tMSG_PEEK\t0x2\t\t/* peek at incoming message */\n#define\tMSG_DONTROUTE\t0x4\t\t/* send without using routing tables */\n#define\tMSG_EOR\t\t0x8\t\t/* data completes record */\n#define\tMSG_TRUNC\t0x10\t\t/* data discarded before delivery */\n#define\tMSG_CTRUNC\t0x20\t\t/* control data lost before delivery */\n#define\tMSG_WAITALL\t0x40\t\t/* wait for full request or error */\n#define MSG_NOTIFICATION 0x2000         /* SCTP notification */\n#if __BSD_VISIBLE\n#define\tMSG_DONTWAIT\t0x80\t\t/* this message should be nonblocking */\n#define\tMSG_EOF\t\t0x100\t\t/* data completes connection */\n#define\tMSG_NBIO\t0x4000\t\t/* FIONBIO mode, used by fifofs */\n#define\tMSG_COMPAT      0x8000\t\t/* used in sendit() */\n#endif\n#ifdef _KERNEL\n#define\tMSG_SOCALLBCK   0x10000\t\t/* for use by socket callbacks - soreceive (TCP) */\n#endif\n#if __BSD_VISIBLE\n#define\tMSG_NOSIGNAL\t0x20000\t\t/* do not generate SIGPIPE on EOF */\n#endif\n\n/*\n * Header for ancillary data objects in msg_control buffer.\n * Used for additional information with/about a datagram\n * not expressible by flags.  The format is a sequence\n * of message elements headed by cmsghdr structures.\n */\nstruct cmsghdr {\n\tsocklen_t\tcmsg_len;\t\t/* data byte count, including hdr */\n\tint\t\tcmsg_level;\t\t/* originating protocol */\n\tint\t\tcmsg_type;\t\t/* protocol-specific type */\n/* followed by\tu_char  cmsg_data[]; */\n};\n\n#if __BSD_VISIBLE\n/*\n * While we may have more groups than this, the cmsgcred struct must\n * be able to fit in an mbuf and we have historically supported a\n * maximum of 16 groups.\n*/\n#define CMGROUP_MAX 16\n\n/*\n * Credentials structure, used to verify the identity of a peer\n * process that has sent us a message. This is allocated by the\n * peer process but filled in by the kernel. This prevents the\n * peer from lying about its identity. (Note that cmcred_groups[0]\n * is the effective GID.)\n */\nstruct cmsgcred {\n\tpid_t\tcmcred_pid;\t\t/* PID of sending process */\n\tuid_t\tcmcred_uid;\t\t/* real UID of sending process */\n\tuid_t\tcmcred_euid;\t\t/* effective UID of sending process */\n\tgid_t\tcmcred_gid;\t\t/* real GID of sending process */\n\tshort\tcmcred_ngroups;\t\t/* number or groups */\n\tgid_t\tcmcred_groups[CMGROUP_MAX];\t/* groups */\n};\n\n/*\n * Socket credentials.\n */\nstruct sockcred {\n\tuid_t\tsc_uid;\t\t\t/* real user id */\n\tuid_t\tsc_euid;\t\t/* effective user id */\n\tgid_t\tsc_gid;\t\t\t/* real group id */\n\tgid_t\tsc_egid;\t\t/* effective group id */\n\tint\tsc_ngroups;\t\t/* number of supplemental groups */\n\tgid_t\tsc_groups[1];\t\t/* variable length */\n};\n\n/*\n * Compute size of a sockcred structure with groups.\n */\n#define\tSOCKCREDSIZE(ngrps) \\\n\t(sizeof(struct sockcred) + (sizeof(gid_t) * ((ngrps) - 1)))\n\n#endif /* __BSD_VISIBLE */\n\n/* given pointer to struct cmsghdr, return pointer to data */\n#define\tCMSG_DATA(cmsg)\t\t((unsigned char *)(cmsg) + \\\n\t\t\t\t _ALIGN(sizeof(struct cmsghdr)))\n\n/* given pointer to struct cmsghdr, return pointer to next cmsghdr */\n#define\tCMSG_NXTHDR(mhdr, cmsg)\t\\\n\t((char *)(cmsg) == NULL ? CMSG_FIRSTHDR(mhdr) : \\\n\t    ((char *)(cmsg) + _ALIGN(((struct cmsghdr *)(cmsg))->cmsg_len) + \\\n\t  _ALIGN(sizeof(struct cmsghdr)) > \\\n\t    (char *)(mhdr)->msg_control + (mhdr)->msg_controllen) ? \\\n\t    (struct cmsghdr *)0 : \\\n\t    (struct cmsghdr *)(void *)((char *)(cmsg) + \\\n\t    _ALIGN(((struct cmsghdr *)(cmsg))->cmsg_len)))\n\n/*\n * RFC 2292 requires to check msg_controllen, in case that the kernel returns\n * an empty list for some reasons.\n */\n#define\tCMSG_FIRSTHDR(mhdr) \\\n\t((mhdr)->msg_controllen >= sizeof(struct cmsghdr) ? \\\n\t (struct cmsghdr *)(mhdr)->msg_control : \\\n\t (struct cmsghdr *)NULL)\n\n#if __BSD_VISIBLE\n/* RFC 2292 additions */\n#define\tCMSG_SPACE(l)\t\t(_ALIGN(sizeof(struct cmsghdr)) + _ALIGN(l))\n#define\tCMSG_LEN(l)\t\t(_ALIGN(sizeof(struct cmsghdr)) + (l))\n#endif\n\n#ifdef _KERNEL\n#define\tCMSG_ALIGN(n)\t_ALIGN(n)\n#endif\n\n/* \"Socket\"-level control message types: */\n#define\tSCM_RIGHTS\t0x01\t\t/* access rights (array of int) */\n#if __BSD_VISIBLE\n#define\tSCM_TIMESTAMP\t0x02\t\t/* timestamp (struct timeval) */\n#define\tSCM_CREDS\t0x03\t\t/* process creds (struct cmsgcred) */\n#define\tSCM_BINTIME\t0x04\t\t/* timestamp (struct bintime) */\n#endif\n\n#if __BSD_VISIBLE\n/*\n * 4.3 compat sockaddr, move to compat file later\n */\nstruct osockaddr {\n\tunsigned short sa_family;\t/* address family */\n\tchar\tsa_data[14];\t\t/* up to 14 bytes of direct address */\n};\n\n/*\n * 4.3-compat message header (move to compat file later).\n */\nstruct omsghdr {\n\tchar\t*msg_name;\t\t/* optional address */\n\tint\tmsg_namelen;\t\t/* size of address */\n\tstruct\tiovec *msg_iov;\t\t/* scatter/gather array */\n\tint\tmsg_iovlen;\t\t/* # elements in msg_iov */\n\tchar\t*msg_accrights;\t\t/* access rights sent/received */\n\tint\tmsg_accrightslen;\n};\n#endif\n\n/*\n * howto arguments for shutdown(2), specified by Posix.1g.\n */\n#define\tSHUT_RD\t\t0\t\t/* shut down the reading side */\n#define\tSHUT_WR\t\t1\t\t/* shut down the writing side */\n#define\tSHUT_RDWR\t2\t\t/* shut down both sides */\n\n/* we cheat and use the SHUT_XX defines for these */\n#define PRU_FLUSH_RD     SHUT_RD\n#define PRU_FLUSH_WR     SHUT_WR\n#define PRU_FLUSH_RDWR   SHUT_RDWR\n\n\n#if __BSD_VISIBLE\n/*\n * sendfile(2) header/trailer struct\n */\nstruct sf_hdtr {\n\tstruct iovec *headers;\t/* pointer to an array of header struct iovec's */\n\tint hdr_cnt;\t\t/* number of header iovec's */\n\tstruct iovec *trailers;\t/* pointer to an array of trailer struct iovec's */\n\tint trl_cnt;\t\t/* number of trailer iovec's */\n};\n\n/*\n * Sendfile-specific flag(s)\n */\n#define\tSF_NODISKIO     0x00000001\n#define\tSF_MNOWAIT\t0x00000002\n#define\tSF_SYNC\t\t0x00000004\n#endif\n\n#ifndef\t_KERNEL\n\n#include <sys/cdefs.h>\n\n__BEGIN_DECLS\nint\taccept(int, struct sockaddr * __restrict, socklen_t * __restrict);\nint\tbind(int, const struct sockaddr *, socklen_t);\nint\tconnect(int, const struct sockaddr *, socklen_t);\nint\tgetpeername(int, struct sockaddr * __restrict, socklen_t * __restrict);\nint\tgetsockname(int, struct sockaddr * __restrict, socklen_t * __restrict);\nint\tgetsockopt(int, int, int, void * __restrict, socklen_t * __restrict);\nint\tlisten(int, int);\nssize_t\trecv(int, void *, size_t, int);\nssize_t\trecvfrom(int, void *, size_t, int, struct sockaddr * __restrict, socklen_t * __restrict);\nssize_t\trecvmsg(int, struct msghdr *, int);\nssize_t\tsend(int, const void *, size_t, int);\nssize_t\tsendto(int, const void *,\n\t    size_t, int, const struct sockaddr *, socklen_t);\nssize_t\tsendmsg(int, const struct msghdr *, int);\n#if __BSD_VISIBLE\nint\tsendfile(int, int, off_t, size_t, struct sf_hdtr *, off_t *, int);\nint\tsetfib(int);\n#endif\nint\tsetsockopt(int, int, int, const void *, socklen_t);\nint\tshutdown(int, int);\nint\tsockatmark(int);\nint\tsocket(int, int, int);\nint\tsocketpair(int, int, int, int *);\n__END_DECLS\n\n#endif /* !_KERNEL */\n\n#ifdef _KERNEL\nstruct socket;\n\nstruct tcpcb *so_sototcpcb(struct socket *so);\nstruct inpcb *so_sotoinpcb(struct socket *so);\nstruct sockbuf *so_sockbuf_snd(struct socket *);\nstruct sockbuf *so_sockbuf_rcv(struct socket *);\n\nint so_state_get(const struct socket *);\nvoid so_state_set(struct socket *, int);\n\nint so_options_get(const struct socket *);\nvoid so_options_set(struct socket *, int);\n\nint so_error_get(const struct socket *);\nvoid so_error_set(struct socket *, int);\n\nint so_linger_get(const struct socket *);\nvoid so_linger_set(struct socket *, int);\n\nstruct protosw *so_protosw_get(const struct socket *);\nvoid so_protosw_set(struct socket *, struct protosw *);\n\nvoid so_sorwakeup_locked(struct socket *so);\nvoid so_sowwakeup_locked(struct socket *so);\n\nvoid so_sorwakeup(struct socket *so);\nvoid so_sowwakeup(struct socket *so);\n\nvoid so_lock(struct socket *so);\nvoid so_unlock(struct socket *so);\n\nvoid so_listeners_apply_all(struct socket *so, void (*func)(struct socket *, void *), void *arg);\n\n#endif\n\n\n#endif /* !_SYS_SOCKET_H_ */\n"
  },
  {
    "path": "freebsd-headers/sys/socketvar.h",
    "content": "/*-\n * Copyright (c) 1982, 1986, 1990, 1993\n *\tThe Regents of the University of California.  All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 4. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t@(#)socketvar.h\t8.3 (Berkeley) 2/19/95\n *\n * $FreeBSD: release/9.0.0/sys/sys/socketvar.h 215178 2010-11-12 13:02:26Z luigi $\n */\n\n#ifndef _SYS_SOCKETVAR_H_\n#define _SYS_SOCKETVAR_H_\n\n#include <sys/queue.h>\t\t\t/* for TAILQ macros */\n#include <sys/selinfo.h>\t\t/* for struct selinfo */\n#include <sys/_lock.h>\n#include <sys/_mutex.h>\n#include <sys/_sx.h>\n#include <sys/sockbuf.h>\n#include <sys/sockstate.h>\n#ifdef _KERNEL\n#include <sys/sockopt.h>\n#endif\n\nstruct vnet;\n\n/*\n * Kernel structure per socket.\n * Contains send and receive buffer queues,\n * handle on protocol and pointer to protocol\n * private data and error information.\n */\ntypedef\tu_quad_t so_gen_t;\n\nstruct socket;\n\n/*-\n * Locking key to struct socket:\n * (a) constant after allocation, no locking required.\n * (b) locked by SOCK_LOCK(so).\n * (c) locked by SOCKBUF_LOCK(&so->so_rcv).\n * (d) locked by SOCKBUF_LOCK(&so->so_snd).\n * (e) locked by ACCEPT_LOCK().\n * (f) not locked since integer reads/writes are atomic.\n * (g) used only as a sleep/wakeup address, no value.\n * (h) locked by global mutex so_global_mtx.\n */\nstruct socket {\n\tint\tso_count;\t\t/* (b) reference count */\n\tshort\tso_type;\t\t/* (a) generic type, see socket.h */\n\tshort\tso_options;\t\t/* from socket call, see socket.h */\n\tshort\tso_linger;\t\t/* time to linger while closing */\n\tshort\tso_state;\t\t/* (b) internal state flags SS_* */\n\tint\tso_qstate;\t\t/* (e) internal state flags SQ_* */\n\tvoid\t*so_pcb;\t\t/* protocol control block */\n\tstruct\tvnet *so_vnet;\t\t/* network stack instance */\n\tstruct\tprotosw *so_proto;\t/* (a) protocol handle */\n/*\n * Variables for connection queuing.\n * Socket where accepts occur is so_head in all subsidiary sockets.\n * If so_head is 0, socket is not related to an accept.\n * For head socket so_incomp queues partially completed connections,\n * while so_comp is a queue of connections ready to be accepted.\n * If a connection is aborted and it has so_head set, then\n * it has to be pulled out of either so_incomp or so_comp.\n * We allow connections to queue up based on current queue lengths\n * and limit on number of queued connections for this socket.\n */\n\tstruct\tsocket *so_head;\t/* (e) back pointer to listen socket */\n\tTAILQ_HEAD(, socket) so_incomp;\t/* (e) queue of partial unaccepted connections */\n\tTAILQ_HEAD(, socket) so_comp;\t/* (e) queue of complete unaccepted connections */\n\tTAILQ_ENTRY(socket) so_list;\t/* (e) list of unaccepted connections */\n\tu_short\tso_qlen;\t\t/* (e) number of unaccepted connections */\n\tu_short\tso_incqlen;\t\t/* (e) number of unaccepted incomplete\n\t\t\t\t\t   connections */\n\tu_short\tso_qlimit;\t\t/* (e) max number queued connections */\n\tshort\tso_timeo;\t\t/* (g) connection timeout */\n\tu_short\tso_error;\t\t/* (f) error affecting connection */\n\tstruct\tsigio *so_sigio;\t/* [sg] information for async I/O or\n\t\t\t\t\t   out of band data (SIGURG) */\n\tu_long\tso_oobmark;\t\t/* (c) chars to oob mark */\n\tTAILQ_HEAD(, aiocblist) so_aiojobq; /* AIO ops waiting on socket */\n\n\tstruct sockbuf so_rcv, so_snd;\n\n\tstruct\tucred *so_cred;\t\t/* (a) user credentials */\n\tstruct\tlabel *so_label;\t/* (b) MAC label for socket */\n\tstruct\tlabel *so_peerlabel;\t/* (b) cached MAC label for peer */\n\t/* NB: generation count must not be first. */\n\tso_gen_t so_gencnt;\t\t/* (h) generation count */\n\tvoid\t*so_emuldata;\t\t/* (b) private data for emulators */\n \tstruct so_accf {\n\t\tstruct\taccept_filter *so_accept_filter;\n\t\tvoid\t*so_accept_filter_arg;\t/* saved filter args */\n\t\tchar\t*so_accept_filter_str;\t/* saved user args */\n\t} *so_accf;\n\t/*\n\t * so_fibnum, so_user_cookie and friends can be used to attach\n\t * some user-specified metadata to a socket, which then can be\n\t * used by the kernel for various actions.\n\t * so_user_cookie is used by ipfw/dummynet.\n\t */\n\tint so_fibnum;\t\t/* routing domain for this socket */\n\tuint32_t so_user_cookie;\n};\n\n/*\n * Global accept mutex to serialize access to accept queues and\n * fields associated with multiple sockets.  This allows us to\n * avoid defining a lock order between listen and accept sockets\n * until such time as it proves to be a good idea.\n */\nextern struct mtx accept_mtx;\n#define\tACCEPT_LOCK_ASSERT()\t\tmtx_assert(&accept_mtx, MA_OWNED)\n#define\tACCEPT_UNLOCK_ASSERT()\t\tmtx_assert(&accept_mtx, MA_NOTOWNED)\n#define\tACCEPT_LOCK()\t\t\tmtx_lock(&accept_mtx)\n#define\tACCEPT_UNLOCK()\t\t\tmtx_unlock(&accept_mtx)\n\n/*\n * Per-socket mutex: we reuse the receive socket buffer mutex for space\n * efficiency.  This decision should probably be revisited as we optimize\n * locking for the socket code.\n */\n#define\tSOCK_MTX(_so)\t\t\tSOCKBUF_MTX(&(_so)->so_rcv)\n#define\tSOCK_LOCK(_so)\t\t\tSOCKBUF_LOCK(&(_so)->so_rcv)\n#define\tSOCK_OWNED(_so)\t\t\tSOCKBUF_OWNED(&(_so)->so_rcv)\n#define\tSOCK_UNLOCK(_so)\t\tSOCKBUF_UNLOCK(&(_so)->so_rcv)\n#define\tSOCK_LOCK_ASSERT(_so)\t\tSOCKBUF_LOCK_ASSERT(&(_so)->so_rcv)\n\n/*\n * Socket state bits stored in so_qstate.\n */\n#define\tSQ_INCOMP\t\t0x0800\t/* unaccepted, incomplete connection */\n#define\tSQ_COMP\t\t\t0x1000\t/* unaccepted, complete connection */\n\n/*\n * Externalized form of struct socket used by the sysctl(3) interface.\n */\nstruct xsocket {\n\tsize_t\txso_len;\t/* length of this structure */\n\tstruct\tsocket *xso_so;\t/* makes a convenient handle sometimes */\n\tshort\tso_type;\n\tshort\tso_options;\n\tshort\tso_linger;\n\tshort\tso_state;\n\tcaddr_t\tso_pcb;\t\t/* another convenient handle */\n\tint\txso_protocol;\n\tint\txso_family;\n\tu_short\tso_qlen;\n\tu_short\tso_incqlen;\n\tu_short\tso_qlimit;\n\tshort\tso_timeo;\n\tu_short\tso_error;\n\tpid_t\tso_pgid;\n\tu_long\tso_oobmark;\n\tstruct xsockbuf so_rcv, so_snd;\n\tuid_t\tso_uid;\t\t/* XXX */\n};\n\n#ifdef _KERNEL\n\n/*\n * Macros for sockets and socket buffering.\n */\n\n/*\n * Flags to sblock().\n */\n#define\tSBL_WAIT\t0x00000001\t/* Wait if not immediately available. */\n#define\tSBL_NOINTR\t0x00000002\t/* Force non-interruptible sleep. */\n#define\tSBL_VALID\t(SBL_WAIT | SBL_NOINTR)\n\n/*\n * Do we need to notify the other side when I/O is possible?\n */\n#define\tsb_notify(sb)\t(((sb)->sb_flags & (SB_WAIT | SB_SEL | SB_ASYNC | \\\n    SB_UPCALL | SB_AIO | SB_KNOTE)) != 0)\n\n/* do we have to send all at once on a socket? */\n#define\tsosendallatonce(so) \\\n    ((so)->so_proto->pr_flags & PR_ATOMIC)\n\n/* can we read something from so? */\n#define\tsoreadabledata(so) \\\n    ((so)->so_rcv.sb_cc >= (so)->so_rcv.sb_lowat || \\\n\t!TAILQ_EMPTY(&(so)->so_comp) || (so)->so_error)\n#define\tsoreadable(so) \\\n\t(soreadabledata(so) || ((so)->so_rcv.sb_state & SBS_CANTRCVMORE))\n\n/* can we write something to so? */\n#define\tsowriteable(so) \\\n    ((sbspace(&(so)->so_snd) >= (so)->so_snd.sb_lowat && \\\n\t(((so)->so_state&SS_ISCONNECTED) || \\\n\t  ((so)->so_proto->pr_flags&PR_CONNREQUIRED)==0)) || \\\n     ((so)->so_snd.sb_state & SBS_CANTSENDMORE) || \\\n     (so)->so_error)\n\n/*\n * soref()/sorele() ref-count the socket structure.  Note that you must\n * still explicitly close the socket, but the last ref count will free\n * the structure.\n */\n#define\tsoref(so) do {\t\t\t\t\t\t\t\\\n\tSOCK_LOCK_ASSERT(so);\t\t\t\t\t\t\\\n\t++(so)->so_count;\t\t\t\t\t\t\\\n} while (0)\n\n#define\tsorele(so) do {\t\t\t\t\t\t\t\\\n\tACCEPT_LOCK_ASSERT();\t\t\t\t\t\t\\\n\tSOCK_LOCK_ASSERT(so);\t\t\t\t\t\t\\\n\tif ((so)->so_count <= 0)\t\t\t\t\t\\\n\t\tpanic(\"sorele\");\t\t\t\t\t\\\n\tif (--(so)->so_count == 0)\t\t\t\t\t\\\n\t\tsofree(so);\t\t\t\t\t\t\\\n\telse {\t\t\t\t\t\t\t\t\\\n\t\tSOCK_UNLOCK(so);\t\t\t\t\t\\\n\t\tACCEPT_UNLOCK();\t\t\t\t\t\\\n\t}\t\t\t\t\t\t\t\t\\\n} while (0)\n\n/*\n * In sorwakeup() and sowwakeup(), acquire the socket buffer lock to\n * avoid a non-atomic test-and-wakeup.  However, sowakeup is\n * responsible for releasing the lock if it is called.  We unlock only\n * if we don't call into sowakeup.  If any code is introduced that\n * directly invokes the underlying sowakeup() primitives, it must\n * maintain the same semantics.\n */\n#define\tsorwakeup_locked(so) do {\t\t\t\t\t\\\n\tSOCKBUF_LOCK_ASSERT(&(so)->so_rcv);\t\t\t\t\\\n\tif (sb_notify(&(so)->so_rcv))\t\t\t\t\t\\\n\t\tsowakeup((so), &(so)->so_rcv);\t \t\t\t\\\n\telse\t\t\t\t\t\t\t\t\\\n\t\tSOCKBUF_UNLOCK(&(so)->so_rcv);\t\t\t\t\\\n} while (0)\n\n#define\tsorwakeup(so) do {\t\t\t\t\t\t\\\n\tSOCKBUF_LOCK(&(so)->so_rcv);\t\t\t\t\t\\\n\tsorwakeup_locked(so);\t\t\t\t\t\t\\\n} while (0)\n\n#define\tsowwakeup_locked(so) do {\t\t\t\t\t\\\n\tSOCKBUF_LOCK_ASSERT(&(so)->so_snd);\t\t\t\t\\\n\tif (sb_notify(&(so)->so_snd))\t\t\t\t\t\\\n\t\tsowakeup((so), &(so)->so_snd); \t\t\t\t\\\n\telse\t\t\t\t\t\t\t\t\\\n\t\tSOCKBUF_UNLOCK(&(so)->so_snd);\t\t\t\t\\\n} while (0)\n\n#define\tsowwakeup(so) do {\t\t\t\t\t\t\\\n\tSOCKBUF_LOCK(&(so)->so_snd);\t\t\t\t\t\\\n\tsowwakeup_locked(so);\t\t\t\t\t\t\\\n} while (0)\n\nstruct accept_filter {\n\tchar\taccf_name[16];\n\tint\t(*accf_callback)\n\t\t(struct socket *so, void *arg, int waitflag);\n\tvoid *\t(*accf_create)\n\t\t(struct socket *so, char *arg);\n\tvoid\t(*accf_destroy)\n\t\t(struct socket *so);\n\tSLIST_ENTRY(accept_filter) accf_next;\n};\n\n#ifdef MALLOC_DECLARE\nMALLOC_DECLARE(M_ACCF);\nMALLOC_DECLARE(M_PCB);\nMALLOC_DECLARE(M_SONAME);\n#endif\n\nextern int\tmaxsockets;\nextern u_long\tsb_max;\nextern struct uma_zone *socket_zone;\nextern so_gen_t so_gencnt;\n\nstruct mbuf;\nstruct sockaddr;\nstruct ucred;\nstruct uio;\n\n/* 'which' values for socket upcalls. */\n#define\tSO_RCV\t\t1\n#define\tSO_SND\t\t2\n\n/* Return values for socket upcalls. */\n#define\tSU_OK\t\t0\n#define\tSU_ISCONNECTED\t1\n\n/*\n * From uipc_socket and friends\n */\nint\tsockargs(struct mbuf **mp, caddr_t buf, int buflen, int type);\nint\tgetsockaddr(struct sockaddr **namp, caddr_t uaddr, size_t len);\nvoid\tsoabort(struct socket *so);\nint\tsoaccept(struct socket *so, struct sockaddr **nam);\nint\tsocheckuid(struct socket *so, uid_t uid);\nint\tsobind(struct socket *so, struct sockaddr *nam, struct thread *td);\nint\tsoclose(struct socket *so);\nint\tsoconnect(struct socket *so, struct sockaddr *nam, struct thread *td);\nint\tsoconnect2(struct socket *so1, struct socket *so2);\nint\tsocow_setup(struct mbuf *m0, struct uio *uio);\nint\tsocreate(int dom, struct socket **aso, int type, int proto,\n\t    struct ucred *cred, struct thread *td);\nint\tsodisconnect(struct socket *so);\nstruct\tsockaddr *sodupsockaddr(const struct sockaddr *sa, int mflags);\nvoid\tsofree(struct socket *so);\nvoid\tsohasoutofband(struct socket *so);\nint\tsolisten(struct socket *so, int backlog, struct thread *td);\nvoid\tsolisten_proto(struct socket *so, int backlog);\nint\tsolisten_proto_check(struct socket *so);\nstruct socket *\n\tsonewconn(struct socket *head, int connstatus);\n\n\nint\tsopoll(struct socket *so, int events, struct ucred *active_cred,\n\t    struct thread *td);\nint\tsopoll_generic(struct socket *so, int events,\n\t    struct ucred *active_cred, struct thread *td);\nint\tsoreceive(struct socket *so, struct sockaddr **paddr, struct uio *uio,\n\t    struct mbuf **mp0, struct mbuf **controlp, int *flagsp);\nint\tsoreceive_stream(struct socket *so, struct sockaddr **paddr,\n\t    struct uio *uio, struct mbuf **mp0, struct mbuf **controlp,\n\t    int *flagsp);\nint\tsoreceive_dgram(struct socket *so, struct sockaddr **paddr,\n\t    struct uio *uio, struct mbuf **mp0, struct mbuf **controlp,\n\t    int *flagsp);\nint\tsoreceive_generic(struct socket *so, struct sockaddr **paddr,\n\t    struct uio *uio, struct mbuf **mp0, struct mbuf **controlp,\n\t    int *flagsp);\nint\tsoreserve(struct socket *so, u_long sndcc, u_long rcvcc);\nvoid\tsorflush(struct socket *so);\nint\tsosend(struct socket *so, struct sockaddr *addr, struct uio *uio,\n\t    struct mbuf *top, struct mbuf *control, int flags,\n\t    struct thread *td);\nint\tsosend_dgram(struct socket *so, struct sockaddr *addr,\n\t    struct uio *uio, struct mbuf *top, struct mbuf *control,\n\t    int flags, struct thread *td);\nint\tsosend_generic(struct socket *so, struct sockaddr *addr,\n\t    struct uio *uio, struct mbuf *top, struct mbuf *control,\n\t    int flags, struct thread *td);\nint\tsoshutdown(struct socket *so, int how);\nvoid\tsotoxsocket(struct socket *so, struct xsocket *xso);\nvoid\tsoupcall_clear(struct socket *so, int which);\nvoid\tsoupcall_set(struct socket *so, int which,\n\t    int (*func)(struct socket *, void *, int), void *arg);\nvoid\tsowakeup(struct socket *so, struct sockbuf *sb);\nint\tselsocket(struct socket *so, int events, struct timeval *tv,\n\t    struct thread *td);\n\n/*\n * Accept filter functions (duh).\n */\nint\taccept_filt_add(struct accept_filter *filt);\nint\taccept_filt_del(char *name);\nstruct\taccept_filter *accept_filt_get(char *name);\n#ifdef ACCEPT_FILTER_MOD\n#ifdef SYSCTL_DECL\nSYSCTL_DECL(_net_inet_accf);\n#endif\nint\taccept_filt_generic_mod_event(module_t mod, int event, void *data);\n#endif\n\n#endif /* _KERNEL */\n\n#endif /* !_SYS_SOCKETVAR_H_ */\n"
  },
  {
    "path": "freebsd-headers/sys/sockio.h",
    "content": "/*-\n * Copyright (c) 1982, 1986, 1990, 1993, 1994\n *\tThe Regents of the University of California.  All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 4. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t@(#)sockio.h\t8.1 (Berkeley) 3/28/94\n * $FreeBSD: release/9.0.0/sys/sys/sockio.h 223735 2011-07-03 12:22:02Z bz $\n */\n\n#ifndef _SYS_SOCKIO_H_\n#define\t_SYS_SOCKIO_H_\n\n#include <sys/ioccom.h>\n\n/* Socket ioctl's. */\n#define\tSIOCSHIWAT\t _IOW('s',  0, int)\t\t/* set high watermark */\n#define\tSIOCGHIWAT\t _IOR('s',  1, int)\t\t/* get high watermark */\n#define\tSIOCSLOWAT\t _IOW('s',  2, int)\t\t/* set low watermark */\n#define\tSIOCGLOWAT\t _IOR('s',  3, int)\t\t/* get low watermark */\n#define\tSIOCATMARK\t _IOR('s',  7, int)\t\t/* at oob mark? */\n#define\tSIOCSPGRP\t _IOW('s',  8, int)\t\t/* set process group */\n#define\tSIOCGPGRP\t _IOR('s',  9, int)\t\t/* get process group */\n\n#define\tSIOCADDRT\t _IOW('r', 10, struct ortentry)\t/* add route */\n#define\tSIOCDELRT\t _IOW('r', 11, struct ortentry)\t/* delete route */\n#define\tSIOCGETVIFCNT\t_IOWR('r', 15, struct sioc_vif_req)/* get vif pkt cnt */\n#define\tSIOCGETSGCNT\t_IOWR('r', 16, struct sioc_sg_req) /* get s,g pkt cnt */\n\n#define\tSIOCSIFADDR\t _IOW('i', 12, struct ifreq)\t/* set ifnet address */\n#define\tOSIOCGIFADDR\t_IOWR('i', 13, struct ifreq)\t/* get ifnet address */\n#define\tSIOCGIFADDR\t_IOWR('i', 33, struct ifreq)\t/* get ifnet address */\n#define\tSIOCSIFDSTADDR\t _IOW('i', 14, struct ifreq)\t/* set p-p address */\n#define\tOSIOCGIFDSTADDR\t_IOWR('i', 15, struct ifreq)\t/* get p-p address */\n#define\tSIOCGIFDSTADDR\t_IOWR('i', 34, struct ifreq)\t/* get p-p address */\n#define\tSIOCSIFFLAGS\t _IOW('i', 16, struct ifreq)\t/* set ifnet flags */\n#define\tSIOCGIFFLAGS\t_IOWR('i', 17, struct ifreq)\t/* get ifnet flags */\n#define\tOSIOCGIFBRDADDR\t_IOWR('i', 18, struct ifreq)\t/* get broadcast addr */\n#define\tSIOCGIFBRDADDR\t_IOWR('i', 35, struct ifreq)\t/* get broadcast addr */\n#define\tSIOCSIFBRDADDR\t _IOW('i', 19, struct ifreq)\t/* set broadcast addr */\n#define\tOSIOCGIFCONF\t_IOWR('i', 20, struct ifconf)\t/* get ifnet list */\n#define\tSIOCGIFCONF\t_IOWR('i', 36, struct ifconf)\t/* get ifnet list */\n#define\tOSIOCGIFNETMASK\t_IOWR('i', 21, struct ifreq)\t/* get net addr mask */\n#define\tSIOCGIFNETMASK\t_IOWR('i', 37, struct ifreq)\t/* get net addr mask */\n#define\tSIOCSIFNETMASK\t _IOW('i', 22, struct ifreq)\t/* set net addr mask */\n#define\tSIOCGIFMETRIC\t_IOWR('i', 23, struct ifreq)\t/* get IF metric */\n#define\tSIOCSIFMETRIC\t _IOW('i', 24, struct ifreq)\t/* set IF metric */\n#define\tSIOCDIFADDR\t _IOW('i', 25, struct ifreq)\t/* delete IF addr */\n#define\tSIOCAIFADDR\t _IOW('i', 26, struct ifaliasreq)/* add/chg IF alias */\n\n#define\tSIOCALIFADDR\t _IOW('i', 27, struct if_laddrreq) /* add IF addr */\n#define\tSIOCGLIFADDR\t_IOWR('i', 28, struct if_laddrreq) /* get IF addr */\n#define\tSIOCDLIFADDR\t _IOW('i', 29, struct if_laddrreq) /* delete IF addr */\n#define\tSIOCSIFCAP\t _IOW('i', 30, struct ifreq)\t/* set IF features */\n#define\tSIOCGIFCAP\t_IOWR('i', 31, struct ifreq)\t/* get IF features */\n#define\tSIOCGIFINDEX\t_IOWR('i', 32, struct ifreq)\t/* get IF index */\n#define\tSIOCGIFMAC\t_IOWR('i', 38, struct ifreq)\t/* get IF MAC label */\n#define\tSIOCSIFMAC\t _IOW('i', 39, struct ifreq)\t/* set IF MAC label */\n#define\tSIOCSIFNAME\t _IOW('i', 40, struct ifreq)\t/* set IF name */\n#define\tSIOCSIFDESCR\t _IOW('i', 41, struct ifreq)\t/* set ifnet descr */ \n#define\tSIOCGIFDESCR\t_IOWR('i', 42, struct ifreq)\t/* get ifnet descr */ \n\n#define\tSIOCADDMULTI\t _IOW('i', 49, struct ifreq)\t/* add m'cast addr */\n#define\tSIOCDELMULTI\t _IOW('i', 50, struct ifreq)\t/* del m'cast addr */\n#define\tSIOCGIFMTU\t_IOWR('i', 51, struct ifreq)\t/* get IF mtu */\n#define\tSIOCSIFMTU\t _IOW('i', 52, struct ifreq)\t/* set IF mtu */\n#define\tSIOCGIFPHYS\t_IOWR('i', 53, struct ifreq)\t/* get IF wire */\n#define\tSIOCSIFPHYS\t _IOW('i', 54, struct ifreq)\t/* set IF wire */\n#define\tSIOCSIFMEDIA\t_IOWR('i', 55, struct ifreq)\t/* set net media */\n#define\tSIOCGIFMEDIA\t_IOWR('i', 56, struct ifmediareq) /* get net media */\n\n#define\tSIOCSIFGENERIC\t _IOW('i', 57, struct ifreq)\t/* generic IF set op */\n#define\tSIOCGIFGENERIC\t_IOWR('i', 58, struct ifreq)\t/* generic IF get op */\n\n#define\tSIOCGIFSTATUS\t_IOWR('i', 59, struct ifstat)\t/* get IF status */\n#define\tSIOCSIFLLADDR\t _IOW('i', 60, struct ifreq)\t/* set linklevel addr */\n\n#define\tSIOCSIFPHYADDR\t _IOW('i', 70, struct ifaliasreq) /* set gif addres */\n#define\tSIOCGIFPSRCADDR\t_IOWR('i', 71, struct ifreq)\t/* get gif psrc addr */\n#define\tSIOCGIFPDSTADDR\t_IOWR('i', 72, struct ifreq)\t/* get gif pdst addr */\n#define\tSIOCDIFPHYADDR\t _IOW('i', 73, struct ifreq)\t/* delete gif addrs */\n#define\tSIOCSLIFPHYADDR\t _IOW('i', 74, struct if_laddrreq) /* set gif addrs */\n#define\tSIOCGLIFPHYADDR\t_IOWR('i', 75, struct if_laddrreq) /* get gif addrs */\n\n#define\tSIOCGPRIVATE_0\t_IOWR('i', 80, struct ifreq)\t/* device private 0 */\n#define\tSIOCGPRIVATE_1\t_IOWR('i', 81, struct ifreq)\t/* device private 1 */\n\n#define\tSIOCSIFVNET\t_IOWR('i', 90, struct ifreq)\t/* move IF jail/vnet */\n#define\tSIOCSIFRVNET\t_IOWR('i', 91, struct ifreq)\t/* reclaim vnet IF */\n\n#define\tSIOCGIFFIB\t_IOWR('i', 92, struct ifreq)\t/* get IF fib */\n#define\tSIOCSIFFIB\t _IOW('i', 93, struct ifreq)\t/* set IF fib */\n\n#define\tSIOCSDRVSPEC\t_IOW('i', 123, struct ifdrv)\t/* set driver-specific\n\t\t\t\t\t\t\t\t  parameters */\n#define\tSIOCGDRVSPEC\t_IOWR('i', 123, struct ifdrv)\t/* get driver-specific\n\t\t\t\t\t\t\t\t  parameters */\n\n#define\tSIOCIFCREATE\t_IOWR('i', 122, struct ifreq)\t/* create clone if */\n#define\tSIOCIFCREATE2\t_IOWR('i', 124, struct ifreq)\t/* create clone if */\n#define\tSIOCIFDESTROY\t _IOW('i', 121, struct ifreq)\t/* destroy clone if */\n#define\tSIOCIFGCLONERS\t_IOWR('i', 120, struct if_clonereq) /* get cloners */\n\n#define\tSIOCAIFGROUP\t _IOW('i', 135, struct ifgroupreq) /* add an ifgroup */\n#define\tSIOCGIFGROUP\t_IOWR('i', 136, struct ifgroupreq) /* get ifgroups */\n#define\tSIOCDIFGROUP\t _IOW('i', 137, struct ifgroupreq) /* delete ifgroup */\n#define\tSIOCGIFGMEMB\t_IOWR('i', 138, struct ifgroupreq) /* get members */\n\n#endif /* !_SYS_SOCKIO_H_ */\n"
  },
  {
    "path": "freebsd-headers/sys/sockopt.h",
    "content": "/*-\n * Copyright (c) 1982, 1986, 1990, 1993\n *\tThe Regents of the University of California.  All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 4. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t@(#)socketvar.h\t8.3 (Berkeley) 2/19/95\n *\n * $FreeBSD: release/9.0.0/sys/sys/sockopt.h 180948 2008-07-29 07:45:05Z kmacy $\n */\n#ifndef _SYS_SOCKOPT_H_\n#define _SYS_SOCKOPT_H_\n\n#ifndef _KERNEL\n#error \"no user-servicable parts inside\"\n#endif\n\n\nstruct thread;\nstruct socket;\n\n/*\n * Argument structure for sosetopt et seq.  This is in the KERNEL\n * section because it will never be visible to user code.\n */\nenum sopt_dir { SOPT_GET, SOPT_SET };\n\nstruct\tsockopt {\n\tenum\tsopt_dir sopt_dir; /* is this a get or a set? */\n\tint\tsopt_level;\t/* second arg of [gs]etsockopt */\n\tint\tsopt_name;\t/* third arg of [gs]etsockopt */\n\tvoid   *sopt_val;\t/* fourth arg of [gs]etsockopt */\n\tsize_t\tsopt_valsize;\t/* (almost) fifth arg of [gs]etsockopt */\n\tstruct\tthread *sopt_td; /* calling thread or null if kernel */\n};\n\nint\tsosetopt(struct socket *so, struct sockopt *sopt);\nint\tsogetopt(struct socket *so, struct sockopt *sopt);\nint\tsooptcopyin(struct sockopt *sopt, void *buf, size_t len, size_t minlen);\nint\tsooptcopyout(struct sockopt *sopt, const void *buf, size_t len);\n/* XXX; prepare mbuf for (__FreeBSD__ < 3) routines. */\nint\tsoopt_getm(struct sockopt *sopt, struct mbuf **mp);\nint\tsoopt_mcopyin(struct sockopt *sopt, struct mbuf *m);\nint\tsoopt_mcopyout(struct sockopt *sopt, struct mbuf *m);\nint\tdo_getopt_accept_filter(struct socket *so, struct sockopt *sopt);\nint\tdo_setopt_accept_filter(struct socket *so, struct sockopt *sopt);\nint\tso_setsockopt(struct socket *so, int level, int optname,\n\t    void *optval, size_t optlen);\n\n#endif /* _SYS_SOCKOPT_H_ */\n"
  },
  {
    "path": "freebsd-headers/sys/sockstate.h",
    "content": "/*-\n * Copyright (c) 1982, 1986, 1990, 1993\n *\tThe Regents of the University of California.  All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 4. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t@(#)socketvar.h\t8.3 (Berkeley) 2/19/95\n *\n * $FreeBSD: release/9.0.0/sys/sys/sockstate.h 180948 2008-07-29 07:45:05Z kmacy $\n */\n#ifndef _SYS_SOCKTATE_H_\n#define _SYS_SOCKTATE_H_\n\n/*\n * Socket state bits.\n *\n * Historically, this bits were all kept in the so_state field.  For\n * locking reasons, they are now in multiple fields, as they are\n * locked differently.  so_state maintains basic socket state protected\n * by the socket lock.  so_qstate holds information about the socket\n * accept queues.  Each socket buffer also has a state field holding\n * information relevant to that socket buffer (can't send, rcv).  Many\n * fields will be read without locks to improve performance and avoid\n * lock order issues.  However, this approach must be used with caution.\n */\n#define\tSS_NOFDREF\t\t0x0001\t/* no file table ref any more */\n#define\tSS_ISCONNECTED\t\t0x0002\t/* socket connected to a peer */\n#define\tSS_ISCONNECTING\t\t0x0004\t/* in process of connecting to peer */\n#define\tSS_ISDISCONNECTING\t0x0008\t/* in process of disconnecting */\n#define\tSS_NBIO\t\t\t0x0100\t/* non-blocking ops */\n#define\tSS_ASYNC\t\t0x0200\t/* async i/o notify */\n#define\tSS_ISCONFIRMING\t\t0x0400\t/* deciding to accept connection req */\n#define\tSS_ISDISCONNECTED\t0x2000\t/* socket disconnected from peer */\n\n/*\n * Protocols can mark a socket as SS_PROTOREF to indicate that, following\n * pru_detach, they still want the socket to persist, and will free it\n * themselves when they are done.  Protocols should only ever call sofree()\n * following setting this flag in pru_detach(), and never otherwise, as\n * sofree() bypasses socket reference counting.\n */\n#define\tSS_PROTOREF\t\t0x4000\t/* strong protocol reference */\n\n/*\n * Socket state bits now stored in the socket buffer state field.\n */\n#define\tSBS_CANTSENDMORE\t0x0010\t/* can't send more data to peer */\n#define\tSBS_CANTRCVMORE\t\t0x0020\t/* can't receive more data from peer */\n#define\tSBS_RCVATMARK\t\t0x0040\t/* at mark on input */\n\nstruct socket;\n\nvoid\tsoisconnected(struct socket *so);\nvoid\tsoisconnecting(struct socket *so);\nvoid\tsoisdisconnected(struct socket *so);\nvoid\tsoisdisconnecting(struct socket *so);\nvoid\tsocantrcvmore(struct socket *so);\nvoid\tsocantrcvmore_locked(struct socket *so);\nvoid\tsocantsendmore(struct socket *so);\nvoid\tsocantsendmore_locked(struct socket *so);\n#endif /* _SYS_SOCKTATE_H_ */\n"
  },
  {
    "path": "freebsd-headers/sys/soundcard.h",
    "content": "/*\n * soundcard.h\n */\n\n/*-\n * Copyright by Hannu Savolainen 1993 / 4Front Technologies 1993-2006\n * Modified for the new FreeBSD sound driver by Luigi Rizzo, 1997\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above\n *    copyright notice, this list of conditions and the following\n *    disclaimer in the documentation and/or other materials provided\n *    with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS''\n * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED\n * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A\n * PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR\n * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF\n * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED\n * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/sys/soundcard.h 223663 2011-06-29 08:32:37Z avg $\n */\n\n/*\n * Unless coordinating changes with 4Front Technologies, do NOT make any\n * modifications to ioctl commands, types, etc. that would break\n * compatibility with the OSS API.\n */\n\n#ifndef _SYS_SOUNDCARD_H_\n#define _SYS_SOUNDCARD_H_\n /*\n  * If you make modifications to this file, please contact me before\n  * distributing the modified version. There is already enough\n  * diversity in the world.\n  *\n  * Regards,\n  * Hannu Savolainen\n  * hannu@voxware.pp.fi\n  *\n  **********************************************************************\n  * PS.\tThe Hacker's Guide to VoxWare available from\n  *     nic.funet.fi:pub/Linux/ALPHA/sound. The file is\n  *\tsnd-sdk-doc-0.1.ps.gz (gzipped postscript). It contains\n  *\tsome useful information about programming with VoxWare.\n  *\t(NOTE! The pub/Linux/ALPHA/ directories are hidden. You have\n  *\tto cd inside them before the files are accessible.)\n  **********************************************************************\n  */\n\n/*\n * SOUND_VERSION is only used by the voxware driver. Hopefully apps\n * should not depend on it, but rather look at the capabilities\n * of the driver in the kernel!\n */\n#define SOUND_VERSION  301\n#define VOXWARE\t\t/* does this have any use ? */\n\n/*\n * Supported card ID numbers (Should be somewhere else? We keep\n * them here just for compativility with the old driver, but these\n * constants are of little or no use).\n */\n\n#define SNDCARD_ADLIB          1\n#define SNDCARD_SB             2\n#define SNDCARD_PAS            3\n#define SNDCARD_GUS            4\n#define SNDCARD_MPU401         5\n#define SNDCARD_SB16           6\n#define SNDCARD_SB16MIDI       7\n#define SNDCARD_UART6850       8\n#define SNDCARD_GUS16          9\n#define SNDCARD_MSS            10\n#define SNDCARD_PSS            11\n#define SNDCARD_SSCAPE         12\n#define SNDCARD_PSS_MPU        13\n#define SNDCARD_PSS_MSS        14\n#define SNDCARD_SSCAPE_MSS     15\n#define SNDCARD_TRXPRO         16\n#define SNDCARD_TRXPRO_SB      17\n#define SNDCARD_TRXPRO_MPU     18\n#define SNDCARD_MAD16          19\n#define SNDCARD_MAD16_MPU      20\n#define SNDCARD_CS4232         21\n#define SNDCARD_CS4232_MPU     22\n#define SNDCARD_MAUI           23\n#define SNDCARD_PSEUDO_MSS     24\n#define SNDCARD_AWE32          25\n#define SNDCARD_NSS            26\n#define SNDCARD_UART16550      27\n#define SNDCARD_OPL            28\n\n#include <sys/types.h>\n#include <machine/endian.h>\n#ifndef _IOWR\n#include <sys/ioccom.h>\n#endif  /* !_IOWR */\n\n/*\n * The first part of this file contains the new FreeBSD sound ioctl\n * interface. Tries to minimize the number of different ioctls, and\n * to be reasonably general.\n *\n * 970821: some of the new calls have not been implemented yet.\n */\n\n/*\n * the following three calls extend the generic file descriptor\n * interface. AIONWRITE is the dual of FIONREAD, i.e. returns the max\n * number of bytes for a write operation to be non-blocking.\n *\n * AIOGSIZE/AIOSSIZE are used to change the behaviour of the device,\n * from a character device (default) to a block device. In block mode,\n * (not to be confused with blocking mode) the main difference for the\n * application is that select() will return only when a complete\n * block can be read/written to the device, whereas in character mode\n * select will return true when one byte can be exchanged. For audio\n * devices, character mode makes select almost useless since one byte\n * will always be ready by the next sample time (which is often only a\n * handful of microseconds away).\n * Use a size of 0 or 1 to return to character mode.\n */\n#define\tAIONWRITE   _IOR('A', 10, int)   /* get # bytes to write */\nstruct snd_size {\n    int play_size;\n    int rec_size;\n};\n#define\tAIOGSIZE    _IOR('A', 11, struct snd_size)/* read current blocksize */\n#define\tAIOSSIZE    _IOWR('A', 11, struct snd_size)  /* sets blocksize */\n\n/*\n * The following constants define supported audio formats. The\n * encoding follows voxware conventions, i.e. 1 bit for each supported\n * format. We extend it by using bit 31 (RO) to indicate full-duplex\n * capability, and bit 29 (RO) to indicate that the card supports/\n * needs different formats on capture & playback channels.\n * Bit 29 (RW) is used to indicate/ask stereo.\n *\n * The number of bits required to store the sample is:\n *  o  4 bits for the IDA ADPCM format,\n *  o  8 bits for 8-bit formats, mu-law and A-law,\n *  o  16 bits for the 16-bit formats, and\n *  o  32 bits for the 24/32-bit formats.\n *  o  undefined for the MPEG audio format.\n */\n\n#define AFMT_QUERY\t0x00000000\t/* Return current format */\n#define AFMT_MU_LAW\t0x00000001\t/* Logarithmic mu-law */\n#define AFMT_A_LAW\t0x00000002\t/* Logarithmic A-law */\n#define AFMT_IMA_ADPCM\t0x00000004\t/* A 4:1 compressed format where 16-bit\n\t\t\t\t\t * squence represented using the\n\t\t\t\t\t * the average 4 bits per sample */\n#define AFMT_U8\t\t0x00000008\t/* Unsigned 8-bit */\n#define AFMT_S16_LE\t0x00000010\t/* Little endian signed 16-bit */\n#define AFMT_S16_BE\t0x00000020\t/* Big endian signed 16-bit */\n#define AFMT_S8\t\t0x00000040\t/* Signed 8-bit */\n#define AFMT_U16_LE\t0x00000080\t/* Little endian unsigned 16-bit */\n#define AFMT_U16_BE\t0x00000100\t/* Big endian unsigned 16-bit */\n#define AFMT_MPEG\t0x00000200\t/* MPEG MP2/MP3 audio */\n#define AFMT_AC3\t0x00000400\t/* Dolby Digital AC3 */\n\n/*\n * 32-bit formats below used for 24-bit audio data where the data is stored\n * in the 24 most significant bits and the least significant bits are not used\n * (should be set to 0).\n */\n#define AFMT_S32_LE\t0x00001000\t/* Little endian signed 32-bit */\n#define AFMT_S32_BE\t0x00002000\t/* Big endian signed 32-bit */\n#define AFMT_U32_LE\t0x00004000\t/* Little endian unsigned 32-bit */\n#define AFMT_U32_BE\t0x00008000\t/* Big endian unsigned 32-bit */\n#define AFMT_S24_LE\t0x00010000\t/* Little endian signed 24-bit */\n#define AFMT_S24_BE\t0x00020000\t/* Big endian signed 24-bit */\n#define AFMT_U24_LE\t0x00040000\t/* Little endian unsigned 24-bit */\n#define AFMT_U24_BE\t0x00080000\t/* Big endian unsigned 24-bit */\n\n/* Machine dependant AFMT_* definitions. */\n#if BYTE_ORDER == LITTLE_ENDIAN\n#define AFMT_S16_NE\tAFMT_S16_LE\n#define AFMT_S24_NE\tAFMT_S24_LE\n#define AFMT_S32_NE\tAFMT_S32_LE\n#define AFMT_U16_NE\tAFMT_U16_LE\n#define AFMT_U24_NE\tAFMT_U24_LE\n#define AFMT_U32_NE\tAFMT_U32_LE\n#define AFMT_S16_OE\tAFMT_S16_BE\n#define AFMT_S24_OE\tAFMT_S24_BE\n#define AFMT_S32_OE\tAFMT_S32_BE\n#define AFMT_U16_OE\tAFMT_U16_BE\n#define AFMT_U24_OE\tAFMT_U24_BE\n#define AFMT_U32_OE\tAFMT_U32_BE\n#else\n#define AFMT_S16_OE\tAFMT_S16_LE\n#define AFMT_S24_OE\tAFMT_S24_LE\n#define AFMT_S32_OE\tAFMT_S32_LE\n#define AFMT_U16_OE\tAFMT_U16_LE\n#define AFMT_U24_OE\tAFMT_U24_LE\n#define AFMT_U32_OE\tAFMT_U32_LE\n#define AFMT_S16_NE\tAFMT_S16_BE\n#define AFMT_S24_NE\tAFMT_S24_BE\n#define AFMT_S32_NE\tAFMT_S32_BE\n#define AFMT_U16_NE\tAFMT_U16_BE\n#define AFMT_U24_NE\tAFMT_U24_BE\n#define AFMT_U32_NE\tAFMT_U32_BE\n#endif\n\n#define AFMT_STEREO\t0x10000000\t/* can do/want stereo\t*/\n\n/*\n * the following are really capabilities\n */\n#define AFMT_WEIRD\t0x20000000\t/* weird hardware...\t*/\n    /*\n     * AFMT_WEIRD reports that the hardware might need to operate\n     * with different formats in the playback and capture\n     * channels when operating in full duplex.\n     * As an example, SoundBlaster16 cards only support U8 in one\n     * direction and S16 in the other one, and applications should\n     * be aware of this limitation.\n     */\n#define AFMT_FULLDUPLEX\t0x80000000\t/* can do full duplex\t*/\n\n/*\n * The following structure is used to get/set format and sampling rate.\n * While it would be better to have things such as stereo, bits per\n * sample, endiannes, etc split in different variables, it turns out\n * that formats are not that many, and not all combinations are possible.\n * So we followed the Voxware approach of associating one bit to each\n * format.\n */\n\ntypedef struct _snd_chan_param {\n    u_long\tplay_rate;\t/* sampling rate\t\t\t*/\n    u_long\trec_rate;\t/* sampling rate\t\t\t*/\n    u_long\tplay_format;\t/* everything describing the format\t*/\n    u_long\trec_format;\t/* everything describing the format\t*/\n} snd_chan_param;\n#define\tAIOGFMT    _IOR('f', 12, snd_chan_param)   /* get format */\n#define\tAIOSFMT    _IOWR('f', 12, snd_chan_param)  /* sets format */\n\n/*\n * The following structure is used to get/set the mixer setting.\n * Up to 32 mixers are supported, each one with up to 32 channels.\n */\ntypedef struct _snd_mix_param {\n    u_char\tsubdev;\t/* which output\t\t\t\t*/\n    u_char\tline;\t/* which input\t\t\t\t*/\n    u_char\tleft,right; /* volumes, 0..255, 0 = mute\t*/\n} snd_mix_param ;\n\n/* XXX AIOGMIX, AIOSMIX not implemented yet */\n#define AIOGMIX\t_IOWR('A', 13, snd_mix_param)\t/* return mixer status */\n#define AIOSMIX\t_IOWR('A', 14, snd_mix_param)\t/* sets mixer status   */\n\n/*\n * channel specifiers used in AIOSTOP and AIOSYNC\n */\n#define\tAIOSYNC_PLAY\t0x1\t/* play chan */\n#define\tAIOSYNC_CAPTURE\t0x2\t/* capture chan */\n/* AIOSTOP stop & flush a channel, returns the residual count */\n#define\tAIOSTOP\t_IOWR ('A', 15, int)\n\n/* alternate method used to notify the sync condition */\n#define\tAIOSYNC_SIGNAL\t0x100\n#define\tAIOSYNC_SELECT\t0x200\n\n/* what the 'pos' field refers to */\n#define AIOSYNC_READY\t0x400\n#define AIOSYNC_FREE\t0x800\n\ntypedef struct _snd_sync_parm {\n    long chan ; /* play or capture channel, plus modifier */\n    long pos;\n} snd_sync_parm;\n#define\tAIOSYNC\t_IOWR ('A', 15, snd_sync_parm)\t/* misc. synchronization */\n\n/*\n * The following is used to return device capabilities. If the structure\n * passed to the ioctl is zeroed, default values are returned for rate\n * and formats, a bitmap of available mixers is returned, and values\n * (inputs, different levels) for the first one are returned.\n *\n * If  formats, mixers, inputs are instantiated, then detailed info\n * are returned depending on the call.\n */\ntypedef struct _snd_capabilities {\n    u_long\trate_min, rate_max;\t/* min-max sampling rate */\n    u_long\tformats;\n    u_long\tbufsize; /* DMA buffer size */\n    u_long\tmixers; /* bitmap of available mixers */\n    u_long\tinputs; /* bitmap of available inputs (per mixer) */\n    u_short\tleft, right;\t/* how many levels are supported */\n} snd_capabilities;\n#define AIOGCAP\t_IOWR('A', 15, snd_capabilities)\t/* get capabilities */\n\n/*\n * here is the old (Voxware) ioctl interface\n */\n\n/*\n * IOCTL Commands for /dev/sequencer\n */\n\n#define SNDCTL_SEQ_RESET\t_IO  ('Q', 0)\n#define SNDCTL_SEQ_SYNC\t\t_IO  ('Q', 1)\n#define SNDCTL_SYNTH_INFO\t_IOWR('Q', 2, struct synth_info)\n#define SNDCTL_SEQ_CTRLRATE\t_IOWR('Q', 3, int) /* Set/get timer res.(hz) */\n#define SNDCTL_SEQ_GETOUTCOUNT\t_IOR ('Q', 4, int)\n#define SNDCTL_SEQ_GETINCOUNT\t_IOR ('Q', 5, int)\n#define SNDCTL_SEQ_PERCMODE\t_IOW ('Q', 6, int)\n#define SNDCTL_FM_LOAD_INSTR\t_IOW ('Q', 7, struct sbi_instrument)\t/* Valid for FM only */\n#define SNDCTL_SEQ_TESTMIDI\t_IOW ('Q', 8, int)\n#define SNDCTL_SEQ_RESETSAMPLES\t_IOW ('Q', 9, int)\n#define SNDCTL_SEQ_NRSYNTHS\t_IOR ('Q',10, int)\n#define SNDCTL_SEQ_NRMIDIS\t_IOR ('Q',11, int)\n#define SNDCTL_MIDI_INFO\t_IOWR('Q',12, struct midi_info)\n#define SNDCTL_SEQ_THRESHOLD\t_IOW ('Q',13, int)\n#define SNDCTL_SEQ_TRESHOLD\tSNDCTL_SEQ_THRESHOLD\t/* there was once a typo */\n#define SNDCTL_SYNTH_MEMAVL\t_IOWR('Q',14, int) /* in=dev#, out=memsize */\n#define SNDCTL_FM_4OP_ENABLE\t_IOW ('Q',15, int) /* in=dev# */\n#define SNDCTL_PMGR_ACCESS\t_IOWR('Q',16, struct patmgr_info)\n#define SNDCTL_SEQ_PANIC\t_IO  ('Q',17)\n#define SNDCTL_SEQ_OUTOFBAND\t_IOW ('Q',18, struct seq_event_rec)\n#define SNDCTL_SEQ_GETTIME\t_IOR ('Q',19, int)\n\nstruct seq_event_rec {\n\tu_char arr[8];\n};\n\n#define SNDCTL_TMR_TIMEBASE\t_IOWR('T', 1, int)\n#define SNDCTL_TMR_START\t_IO  ('T', 2)\n#define SNDCTL_TMR_STOP\t\t_IO  ('T', 3)\n#define SNDCTL_TMR_CONTINUE\t_IO  ('T', 4)\n#define SNDCTL_TMR_TEMPO\t_IOWR('T', 5, int)\n#define SNDCTL_TMR_SOURCE\t_IOWR('T', 6, int)\n#   define TMR_INTERNAL\t\t0x00000001\n#   define TMR_EXTERNAL\t\t0x00000002\n#\tdefine TMR_MODE_MIDI\t0x00000010\n#\tdefine TMR_MODE_FSK\t0x00000020\n#\tdefine TMR_MODE_CLS\t0x00000040\n#\tdefine TMR_MODE_SMPTE\t0x00000080\n#define SNDCTL_TMR_METRONOME\t_IOW ('T', 7, int)\n#define SNDCTL_TMR_SELECT\t_IOW ('T', 8, int)\n\n/*\n *\tEndian aware patch key generation algorithm.\n */\n\n#if defined(_AIX) || defined(AIX)\n#  define _PATCHKEY(id) (0xfd00|id)\n#else\n#  define _PATCHKEY(id) ((id<<8)|0xfd)\n#endif\n\n/*\n *\tSample loading mechanism for internal synthesizers (/dev/sequencer)\n *\tThe following patch_info structure has been designed to support\n *\tGravis UltraSound. It tries to be universal format for uploading\n *\tsample based patches but is probably too limited.\n */\n\nstruct patch_info {\n/*\t\tu_short key;\t\t Use GUS_PATCH here */\n\tshort key;\t\t /* Use GUS_PATCH here */\n#define GUS_PATCH\t_PATCHKEY(0x04)\n#define OBSOLETE_GUS_PATCH\t_PATCHKEY(0x02)\n\n\tshort device_no;\t/* Synthesizer number */\n\tshort instr_no;\t\t/* Midi pgm# */\n\n\tu_long mode;\n/*\n * The least significant byte has the same format than the GUS .PAT\n * files\n */\n#define WAVE_16_BITS\t0x01\t/* bit 0 = 8 or 16 bit wave data. */\n#define WAVE_UNSIGNED\t0x02\t/* bit 1 = Signed - Unsigned data. */\n#define WAVE_LOOPING\t0x04\t/* bit 2 = looping enabled-1. */\n#define WAVE_BIDIR_LOOP\t0x08\t/* bit 3 = Set is bidirectional looping. */\n#define WAVE_LOOP_BACK\t0x10\t/* bit 4 = Set is looping backward. */\n#define WAVE_SUSTAIN_ON\t0x20\t/* bit 5 = Turn sustaining on. (Env. pts. 3)*/\n#define WAVE_ENVELOPES\t0x40\t/* bit 6 = Enable envelopes - 1 */\n\t\t\t\t/* \t(use the env_rate/env_offs fields). */\n/* Linux specific bits */\n#define WAVE_VIBRATO\t0x00010000\t/* The vibrato info is valid */\n#define WAVE_TREMOLO\t0x00020000\t/* The tremolo info is valid */\n#define WAVE_SCALE\t0x00040000\t/* The scaling info is valid */\n/* Other bits must be zeroed */\n\n\tlong len;\t/* Size of the wave data in bytes */\n\tlong loop_start, loop_end; /* Byte offsets from the beginning */\n\n/*\n * The base_freq and base_note fields are used when computing the\n * playback speed for a note. The base_note defines the tone frequency\n * which is heard if the sample is played using the base_freq as the\n * playback speed.\n *\n * The low_note and high_note fields define the minimum and maximum note\n * frequencies for which this sample is valid. It is possible to define\n * more than one samples for an instrument number at the same time. The\n * low_note and high_note fields are used to select the most suitable one.\n *\n * The fields base_note, high_note and low_note should contain\n * the note frequency multiplied by 1000. For example value for the\n * middle A is 440*1000.\n */\n\n\tu_int base_freq;\n\tu_long base_note;\n\tu_long high_note;\n\tu_long low_note;\n\tint panning;\t/* -128=left, 127=right */\n\tint detuning;\n\n/*\tNew fields introduced in version 1.99.5\t*/\n\n       /* Envelope. Enabled by mode bit WAVE_ENVELOPES\t*/\n\tu_char\tenv_rate[ 6 ];\t /* GUS HW ramping rate */\n\tu_char\tenv_offset[ 6 ]; /* 255 == 100% */\n\n\t/*\n\t * The tremolo, vibrato and scale info are not supported yet.\n\t * Enable by setting the mode bits WAVE_TREMOLO, WAVE_VIBRATO or\n\t * WAVE_SCALE\n\t */\n\n\tu_char\ttremolo_sweep;\n\tu_char\ttremolo_rate;\n\tu_char\ttremolo_depth;\n\n\tu_char\tvibrato_sweep;\n\tu_char\tvibrato_rate;\n\tu_char\tvibrato_depth;\n\n\tint\t\tscale_frequency;\n\tu_int\tscale_factor;\t\t/* from 0 to 2048 or 0 to 2 */\n\n\tint\t\tvolume;\n\tint\t\tspare[4];\n\tchar data[1];\t/* The waveform data starts here */\n};\n\nstruct sysex_info {\n\tshort key;\t\t/* Use GUS_PATCH here */\n#define SYSEX_PATCH\t_PATCHKEY(0x05)\n#define MAUI_PATCH\t_PATCHKEY(0x06)\n\tshort device_no;\t/* Synthesizer number */\n\tlong len;\t/* Size of the sysex data in bytes */\n\tu_char data[1];\t/* Sysex data starts here */\n};\n\n/*\n * Patch management interface (/dev/sequencer, /dev/patmgr#)\n * Don't use these calls if you want to maintain compatibility with\n * the future versions of the driver.\n */\n\n#define PS_NO_PATCHES\t\t0\t/* No patch support on device */\n#define\tPS_MGR_NOT_OK\t\t1\t/* Plain patch support (no mgr) */\n#define\tPS_MGR_OK\t\t2\t/* Patch manager supported */\n#define\tPS_MANAGED\t\t3\t/* Patch manager running */\n\n#define SNDCTL_PMGR_IFACE\t\t_IOWR('P', 1, struct patmgr_info)\n\n/*\n * The patmgr_info is a fixed size structure which is used for two\n * different purposes. The intended use is for communication between\n * the application using /dev/sequencer and the patch manager daemon\n * associated with a synthesizer device (ioctl(SNDCTL_PMGR_ACCESS)).\n *\n * This structure is also used with ioctl(SNDCTL_PGMR_IFACE) which allows\n * a patch manager daemon to read and write device parameters. This\n * ioctl available through /dev/sequencer also. Avoid using it since it's\n * extremely hardware dependent. In addition access trough /dev/sequencer\n * may confuse the patch manager daemon.\n */\n\nstruct patmgr_info {\t/* Note! size must be < 4k since kmalloc() is used */\n\t  u_long key;\t/* Don't worry. Reserved for communication\n\t  \t\t\t   between the patch manager and the driver. */\n#define PM_K_EVENT\t\t1 /* Event from the /dev/sequencer driver */\n#define PM_K_COMMAND\t\t2 /* Request from an application */\n#define PM_K_RESPONSE\t\t3 /* From patmgr to application */\n#define PM_ERROR\t\t4 /* Error returned by the patmgr */\n\t  int device;\n\t  int command;\n\n/*\n * Commands 0x000 to 0xfff reserved for patch manager programs\n */\n#define PM_GET_DEVTYPE\t1\t/* Returns type of the patch mgr interface of dev */\n#define\t\tPMTYPE_FM2\t1\t/* 2 OP fm */\n#define\t\tPMTYPE_FM4\t2\t/* Mixed 4 or 2 op FM (OPL-3) */\n#define\t\tPMTYPE_WAVE\t3\t/* Wave table synthesizer (GUS) */\n#define PM_GET_NRPGM\t2\t/* Returns max # of midi programs in parm1 */\n#define PM_GET_PGMMAP\t3\t/* Returns map of loaded midi programs in data8 */\n#define PM_GET_PGM_PATCHES 4\t/* Return list of patches of a program (parm1) */\n#define PM_GET_PATCH\t5\t/* Return patch header of patch parm1 */\n#define PM_SET_PATCH\t6\t/* Set patch header of patch parm1 */\n#define PM_READ_PATCH\t7\t/* Read patch (wave) data */\n#define PM_WRITE_PATCH\t8\t/* Write patch (wave) data */\n\n/*\n * Commands 0x1000 to 0xffff are for communication between the patch manager\n * and the client\n */\n#define _PM_LOAD_PATCH\t0x100\n\n/*\n * Commands above 0xffff reserved for device specific use\n */\n\n\tlong parm1;\n\tlong parm2;\n\tlong parm3;\n\n\tunion {\n\t\tu_char data8[4000];\n\t\tu_short data16[2000];\n\t\tu_long data32[1000];\n\t\tstruct patch_info patch;\n\t} data;\n};\n\n/*\n * When a patch manager daemon is present, it will be informed by the\n * driver when something important happens. For example when the\n * /dev/sequencer is opened or closed. A record with key == PM_K_EVENT is\n * returned. The command field contains the event type:\n */\n#define PM_E_OPENED\t\t1\t/* /dev/sequencer opened */\n#define PM_E_CLOSED\t\t2\t/* /dev/sequencer closed */\n#define PM_E_PATCH_RESET\t3\t/* SNDCTL_RESETSAMPLES called */\n#define PM_E_PATCH_LOADED\t4\t/* A patch has been loaded by appl */\n\n/*\n * /dev/sequencer input events.\n *\n * The data written to the /dev/sequencer is a stream of events. Events\n * are records of 4 or 8 bytes. The first byte defines the size.\n * Any number of events can be written with a write call. There\n * is a set of macros for sending these events. Use these macros if you\n * want to maximize portability of your program.\n *\n * Events SEQ_WAIT, SEQ_MIDIPUTC and SEQ_ECHO. Are also input events.\n * (All input events are currently 4 bytes long. Be prepared to support\n * 8 byte events also. If you receive any event having first byte >= 128,\n * it's a 8 byte event.\n *\n * The events are documented at the end of this file.\n *\n * Normal events (4 bytes)\n * There is also a 8 byte version of most of the 4 byte events. The\n * 8 byte one is recommended.\n */\n#define SEQ_NOTEOFF\t\t0\n#define SEQ_FMNOTEOFF\t\tSEQ_NOTEOFF\t/* Just old name */\n#define SEQ_NOTEON\t\t1\n#define\tSEQ_FMNOTEON\t\tSEQ_NOTEON\n#define SEQ_WAIT\t\tTMR_WAIT_ABS\n#define SEQ_PGMCHANGE\t\t3\n#define SEQ_FMPGMCHANGE\t\tSEQ_PGMCHANGE\n#define SEQ_SYNCTIMER\t\tTMR_START\n#define SEQ_MIDIPUTC\t\t5\n#define SEQ_DRUMON\t\t6\t/*** OBSOLETE ***/\n#define SEQ_DRUMOFF\t\t7\t/*** OBSOLETE ***/\n#define SEQ_ECHO\t\tTMR_ECHO\t/* For synching programs with output */\n#define SEQ_AFTERTOUCH\t\t9\n#define SEQ_CONTROLLER\t\t10\n\n/*\n *\tMidi controller numbers\n *\n * Controllers 0 to 31 (0x00 to 0x1f) and 32 to 63 (0x20 to 0x3f)\n * are continuous controllers.\n * In the MIDI 1.0 these controllers are sent using two messages.\n * Controller numbers 0 to 31 are used to send the MSB and the\n * controller numbers 32 to 63 are for the LSB. Note that just 7 bits\n * are used in MIDI bytes.\n */\n\n#define\tCTL_BANK_SELECT\t\t0x00\n#define\tCTL_MODWHEEL\t\t0x01\n#define CTL_BREATH\t\t0x02\n/*\tundefined\t\t0x03 */\n#define CTL_FOOT\t\t0x04\n#define CTL_PORTAMENTO_TIME\t0x05\n#define CTL_DATA_ENTRY\t\t0x06\n#define CTL_MAIN_VOLUME\t\t0x07\n#define CTL_BALANCE\t\t0x08\n/*\tundefined\t\t0x09 */\n#define CTL_PAN\t\t\t0x0a\n#define CTL_EXPRESSION\t\t0x0b\n/*\tundefined\t\t0x0c - 0x0f */\n#define CTL_GENERAL_PURPOSE1\t0x10\n#define CTL_GENERAL_PURPOSE2\t0x11\n#define CTL_GENERAL_PURPOSE3\t0x12\n#define CTL_GENERAL_PURPOSE4\t0x13\n/*\tundefined\t\t0x14 - 0x1f */\n\n/*\tundefined\t\t0x20 */\n\n/*\n * The controller numbers 0x21 to 0x3f are reserved for the\n * least significant bytes of the controllers 0x00 to 0x1f.\n * These controllers are not recognised by the driver.\n *\n * Controllers 64 to 69 (0x40 to 0x45) are on/off switches.\n * 0=OFF and 127=ON (intermediate values are possible)\n */\n#define CTL_DAMPER_PEDAL\t0x40\n#define CTL_SUSTAIN\t\tCTL_DAMPER_PEDAL\t/* Alias */\n#define CTL_HOLD\t\tCTL_DAMPER_PEDAL\t/* Alias */\n#define CTL_PORTAMENTO\t\t0x41\n#define CTL_SOSTENUTO\t\t0x42\n#define CTL_SOFT_PEDAL\t\t0x43\n/*\tundefined\t\t0x44 */\n#define CTL_HOLD2\t\t0x45\n/*\tundefined\t\t0x46 - 0x4f */\n\n#define CTL_GENERAL_PURPOSE5\t0x50\n#define CTL_GENERAL_PURPOSE6\t0x51\n#define CTL_GENERAL_PURPOSE7\t0x52\n#define CTL_GENERAL_PURPOSE8\t0x53\n/*\tundefined\t\t0x54 - 0x5a */\n#define CTL_EXT_EFF_DEPTH\t0x5b\n#define CTL_TREMOLO_DEPTH\t0x5c\n#define CTL_CHORUS_DEPTH\t0x5d\n#define CTL_DETUNE_DEPTH\t0x5e\n#define CTL_CELESTE_DEPTH\tCTL_DETUNE_DEPTH /* Alias for the above one */\n#define CTL_PHASER_DEPTH\t0x5f\n#define CTL_DATA_INCREMENT\t0x60\n#define CTL_DATA_DECREMENT\t0x61\n#define CTL_NONREG_PARM_NUM_LSB\t0x62\n#define CTL_NONREG_PARM_NUM_MSB\t0x63\n#define CTL_REGIST_PARM_NUM_LSB\t0x64\n#define CTL_REGIST_PARM_NUM_MSB\t0x65\n/*\tundefined\t\t0x66 - 0x78 */\n/*\treserved\t\t0x79 - 0x7f */\n\n/* Pseudo controllers (not midi compatible) */\n#define CTRL_PITCH_BENDER\t255\n#define CTRL_PITCH_BENDER_RANGE\t254\n#define CTRL_EXPRESSION\t\t253\t/* Obsolete */\n#define CTRL_MAIN_VOLUME\t252\t/* Obsolete */\n\n#define SEQ_BALANCE\t\t11\n#define SEQ_VOLMODE             12\n\n/*\n * Volume mode decides how volumes are used\n */\n\n#define VOL_METHOD_ADAGIO\t1\n#define VOL_METHOD_LINEAR\t2\n\n/*\n * Note! SEQ_WAIT, SEQ_MIDIPUTC and SEQ_ECHO are used also as\n *\t input events.\n */\n\n/*\n * Event codes 0xf0 to 0xfc are reserved for future extensions.\n */\n\n#define SEQ_FULLSIZE\t\t0xfd\t/* Long events */\n/*\n * SEQ_FULLSIZE events are used for loading patches/samples to the\n * synthesizer devices. These events are passed directly to the driver\n * of the associated synthesizer device. There is no limit to the size\n * of the extended events. These events are not queued but executed\n * immediately when the write() is called (execution can take several\n * seconds of time).\n *\n * When a SEQ_FULLSIZE message is written to the device, it must\n * be written using exactly one write() call. Other events cannot\n * be mixed to the same write.\n *\n * For FM synths (YM3812/OPL3) use struct sbi_instrument and write\n * it to the /dev/sequencer. Don't write other data together with\n * the instrument structure Set the key field of the structure to\n * FM_PATCH. The device field is used to route the patch to the\n * corresponding device.\n *\n * For Gravis UltraSound use struct patch_info. Initialize the key field\n * to GUS_PATCH.\n */\n#define SEQ_PRIVATE\t0xfe\t/* Low level HW dependent events (8 bytes) */\n#define SEQ_EXTENDED\t0xff\t/* Extended events (8 bytes) OBSOLETE */\n\n/*\n * Record for FM patches\n */\n\ntypedef u_char sbi_instr_data[32];\n\nstruct sbi_instrument {\n\tu_short\tkey;\t/* FM_PATCH or OPL3_PATCH */\n#define FM_PATCH\t_PATCHKEY(0x01)\n#define OPL3_PATCH\t_PATCHKEY(0x03)\n\tshort\t\tdevice;\t\t/* Synth# (0-4)\t*/\n\tint \t\tchannel;\t/* Program# to be initialized  */\n\tsbi_instr_data\toperators;\t/* Reg. settings for operator cells\n\t\t\t\t\t * (.SBI format)\t*/\n};\n\nstruct synth_info {\t/* Read only */\n\tchar\tname[30];\n\tint\tdevice;\t\t/* 0-N. INITIALIZE BEFORE CALLING */\n\tint\tsynth_type;\n#define SYNTH_TYPE_FM\t\t\t0\n#define SYNTH_TYPE_SAMPLE\t\t1\n#define SYNTH_TYPE_MIDI\t\t\t2\t/* Midi interface */\n\n\tint\tsynth_subtype;\n#define FM_TYPE_ADLIB\t\t\t0x00\n#define FM_TYPE_OPL3\t\t\t0x01\n#define MIDI_TYPE_MPU401\t\t0x401\n\n#define SAMPLE_TYPE_BASIC\t\t0x10\n#define SAMPLE_TYPE_GUS\t\t\tSAMPLE_TYPE_BASIC\n#define SAMPLE_TYPE_AWE32\t\t0x20\n\n\tint\tperc_mode;\t/* No longer supported */\n\tint\tnr_voices;\n\tint\tnr_drums;\t/* Obsolete field */\n\tint\tinstr_bank_size;\n\tu_long\tcapabilities;\n#define SYNTH_CAP_PERCMODE\t0x00000001 /* No longer used */\n#define SYNTH_CAP_OPL3\t\t0x00000002 /* Set if OPL3 supported */\n#define SYNTH_CAP_INPUT\t\t0x00000004 /* Input (MIDI) device */\n\tint\tdummies[19];\t/* Reserve space */\n};\n\nstruct sound_timer_info {\n\tchar name[32];\n\tint caps;\n};\n\nstruct midi_info {\n\tchar\t\tname[30];\n\tint\t\tdevice;\t\t/* 0-N. INITIALIZE BEFORE CALLING */\n\tu_long\tcapabilities;\t/* To be defined later */\n\tint\t\tdev_type;\n\tint\t\tdummies[18];\t/* Reserve space */\n};\n\n/*\n * ioctl commands for the /dev/midi##\n */\ntypedef struct {\n\tu_char cmd;\n\tchar nr_args, nr_returns;\n\tu_char data[30];\n} mpu_command_rec;\n\n#define SNDCTL_MIDI_PRETIME\t_IOWR('m', 0, int)\n#define SNDCTL_MIDI_MPUMODE\t_IOWR('m', 1, int)\n#define SNDCTL_MIDI_MPUCMD\t_IOWR('m', 2, mpu_command_rec)\n#define MIOSPASSTHRU\t\t_IOWR('m', 3, int)\n#define MIOGPASSTHRU\t\t_IOWR('m', 4, int)\n\n/*\n * IOCTL commands for /dev/dsp and /dev/audio\n */\n\n#define SNDCTL_DSP_HALT\t\t_IO  ('P', 0)\n#define SNDCTL_DSP_RESET\tSNDCTL_DSP_HALT\n#define SNDCTL_DSP_SYNC\t\t_IO  ('P', 1)\n#define SNDCTL_DSP_SPEED\t_IOWR('P', 2, int)\n#define SNDCTL_DSP_STEREO\t_IOWR('P', 3, int)\n#define SNDCTL_DSP_GETBLKSIZE\t_IOR('P', 4, int)\n#define SNDCTL_DSP_SETBLKSIZE   _IOW('P', 4, int)\n#define SNDCTL_DSP_SETFMT\t_IOWR('P',5, int) /* Selects ONE fmt*/\n\n/*\n * SOUND_PCM_WRITE_CHANNELS is not that different\n * from SNDCTL_DSP_STEREO\n */\n#define SOUND_PCM_WRITE_CHANNELS\t_IOWR('P', 6, int)\n#define SNDCTL_DSP_CHANNELS\tSOUND_PCM_WRITE_CHANNELS\n#define SOUND_PCM_WRITE_FILTER\t_IOWR('P', 7, int)\n#define SNDCTL_DSP_POST\t\t_IO  ('P', 8)\n\n/*\n * SNDCTL_DSP_SETBLKSIZE and the following two calls mostly do\n * the same thing, i.e. set the block size used in DMA transfers.\n */\n#define SNDCTL_DSP_SUBDIVIDE\t_IOWR('P', 9, int)\n#define SNDCTL_DSP_SETFRAGMENT\t_IOWR('P',10, int)\n\n\n#define SNDCTL_DSP_GETFMTS\t_IOR ('P',11, int) /* Returns a mask */\n/*\n * Buffer status queries.\n */\ntypedef struct audio_buf_info {\n    int fragments;\t/* # of avail. frags (partly used ones not counted) */\n    int fragstotal;\t/* Total # of fragments allocated */\n    int fragsize;\t/* Size of a fragment in bytes */\n\n    int bytes;\t/* Avail. space in bytes (includes partly used fragments) */\n\t\t/* Note! 'bytes' could be more than fragments*fragsize */\n} audio_buf_info;\n\n#define SNDCTL_DSP_GETOSPACE\t_IOR ('P',12, audio_buf_info)\n#define SNDCTL_DSP_GETISPACE\t_IOR ('P',13, audio_buf_info)\n\n/*\n * SNDCTL_DSP_NONBLOCK is the same (but less powerful, since the\n * action cannot be undone) of FIONBIO. The same can be achieved\n * by opening the device with O_NDELAY\n */\n#define SNDCTL_DSP_NONBLOCK\t_IO  ('P',14)\n\n#define SNDCTL_DSP_GETCAPS\t_IOR ('P',15, int)\n#\tdefine PCM_CAP_REVISION\t\t0x000000ff\t/* Bits for revision level (0 to 255) */\n#\tdefine PCM_CAP_DUPLEX\t\t0x00000100\t/* Full duplex record/playback */\n#\tdefine PCM_CAP_REALTIME\t\t0x00000200\t/* Not in use */\n#\tdefine PCM_CAP_BATCH\t\t0x00000400\t/* Device has some kind of */\n\t\t\t\t\t\t\t/* internal buffers which may */\n\t\t\t\t\t\t\t/* cause some delays and */\n\t\t\t\t\t\t\t/* decrease precision of timing */\n#\tdefine PCM_CAP_COPROC\t\t0x00000800\t/* Has a coprocessor */\n\t\t\t\t\t\t\t/* Sometimes it's a DSP */\n\t\t\t\t\t\t\t/* but usually not */\n#\tdefine PCM_CAP_TRIGGER\t\t0x00001000\t/* Supports SETTRIGGER */\n#\tdefine PCM_CAP_MMAP\t\t0x00002000\t/* Supports mmap() */\n#\tdefine PCM_CAP_MULTI\t\t0x00004000\t/* Supports multiple open */\n#\tdefine PCM_CAP_BIND\t\t0x00008000\t/* Supports binding to front/rear/center/lfe */\n#   \tdefine PCM_CAP_INPUT\t\t0x00010000\t/* Supports recording */\n#   \tdefine PCM_CAP_OUTPUT\t\t0x00020000\t/* Supports playback */\n#\tdefine PCM_CAP_VIRTUAL\t\t0x00040000\t/* Virtual device */\n/* 0x00040000 and 0x00080000 reserved for future use */\n\n/* Analog/digital control capabilities */\n#\tdefine PCM_CAP_ANALOGOUT\t0x00100000\n#\tdefine PCM_CAP_ANALOGIN\t\t0x00200000\n#\tdefine PCM_CAP_DIGITALOUT\t0x00400000\n#\tdefine PCM_CAP_DIGITALIN\t0x00800000\n#\tdefine PCM_CAP_ADMASK\t\t0x00f00000\n/*\n * NOTE! (capabilities & PCM_CAP_ADMASK)==0 means just that the\n * digital/analog interface control features are not supported by the \n * device/driver. However the device still supports analog, digital or\n * both inputs/outputs (depending on the device). See the OSS Programmer's\n * Guide for full details.\n */\n#\tdefine PCM_CAP_SPECIAL\t\t0x01000000\t/* Not for ordinary \"multimedia\" use */\n#\tdefine PCM_CAP_SHADOW\t\t0x00000000\t/* OBSOLETE */\n\n/*\n * Preferred channel usage. These bits can be used to\n * give recommendations to the application. Used by few drivers.\n * For example if ((caps & DSP_CH_MASK) == DSP_CH_MONO) means that\n * the device works best in mono mode. However it doesn't necessarily mean\n * that the device cannot be used in stereo. These bits should only be used\n * by special applications such as multi track hard disk recorders to find\n * out the initial setup. However the user should be able to override this\n * selection.\n *\n * To find out which modes are actually supported the application should \n * try to select them using SNDCTL_DSP_CHANNELS.\n */\n#\tdefine DSP_CH_MASK\t\t0x06000000\t/* Mask */\n#\tdefine DSP_CH_ANY\t\t0x00000000\t/* No preferred mode */\n#\tdefine DSP_CH_MONO\t\t0x02000000\n#\tdefine DSP_CH_STEREO\t\t0x04000000\n#\tdefine DSP_CH_MULTI\t\t0x06000000\t/* More than two channels */\n\n#\tdefine PCM_CAP_HIDDEN\t\t0x08000000\t/* Hidden device */\n#\tdefine PCM_CAP_FREERATE\t\t0x10000000\n#\tdefine PCM_CAP_MODEM\t\t0x20000000\t/* Modem device */\n#\tdefine PCM_CAP_DEFAULT\t\t0x40000000\t/* \"Default\" device */\n\n/*\n * The PCM_CAP_* capability names were known as DSP_CAP_* prior OSS 4.0\n * so it's necessary to define the older names too.\n */\n#define DSP_CAP_ADMASK\t\tPCM_CAP_ADMASK\n#define DSP_CAP_ANALOGIN\tPCM_CAP_ANALOGIN\n#define DSP_CAP_ANALOGOUT\tPCM_CAP_ANALOGOUT\n#define DSP_CAP_BATCH\t\tPCM_CAP_BATCH\n#define DSP_CAP_BIND\t\tPCM_CAP_BIND\n#define DSP_CAP_COPROC\t\tPCM_CAP_COPROC\n#define DSP_CAP_DEFAULT\t\tPCM_CAP_DEFAULT\n#define DSP_CAP_DIGITALIN\tPCM_CAP_DIGITALIN\n#define DSP_CAP_DIGITALOUT\tPCM_CAP_DIGITALOUT\n#define DSP_CAP_DUPLEX\t\tPCM_CAP_DUPLEX\n#define DSP_CAP_FREERATE\tPCM_CAP_FREERATE\n#define DSP_CAP_HIDDEN\t\tPCM_CAP_HIDDEN\n#define DSP_CAP_INPUT\t\tPCM_CAP_INPUT\n#define DSP_CAP_MMAP\t\tPCM_CAP_MMAP\n#define DSP_CAP_MODEM\t\tPCM_CAP_MODEM\n#define DSP_CAP_MULTI\t\tPCM_CAP_MULTI\n#define DSP_CAP_OUTPUT\t\tPCM_CAP_OUTPUT\n#define DSP_CAP_REALTIME\tPCM_CAP_REALTIME\n#define DSP_CAP_REVISION\tPCM_CAP_REVISION\n#define DSP_CAP_SHADOW\t\tPCM_CAP_SHADOW\n#define DSP_CAP_TRIGGER\t\tPCM_CAP_TRIGGER\n#define DSP_CAP_VIRTUAL\t\tPCM_CAP_VIRTUAL\n\n/*\n * What do these function do ?\n */\n#define SNDCTL_DSP_GETTRIGGER\t_IOR ('P',16, int)\n#define SNDCTL_DSP_SETTRIGGER\t_IOW ('P',16, int)\n#define PCM_ENABLE_INPUT\t0x00000001\n#define PCM_ENABLE_OUTPUT\t0x00000002\n\ntypedef struct count_info {\n\tint bytes;\t/* Total # of bytes processed */\n\tint blocks;\t/* # of fragment transitions since last time */\n\tint ptr;\t/* Current DMA pointer value */\n} count_info;\n\n/*\n * GETIPTR and GETISPACE are not that different... same for out.\n */\n#define SNDCTL_DSP_GETIPTR\t_IOR ('P',17, count_info)\n#define SNDCTL_DSP_GETOPTR\t_IOR ('P',18, count_info)\n\ntypedef struct buffmem_desc {\n\tcaddr_t buffer;\n\tint size;\n} buffmem_desc;\n\n#define SNDCTL_DSP_MAPINBUF\t_IOR ('P', 19, buffmem_desc)\n#define SNDCTL_DSP_MAPOUTBUF\t_IOR ('P', 20, buffmem_desc)\n#define SNDCTL_DSP_SETSYNCRO\t_IO  ('P', 21)\n#define SNDCTL_DSP_SETDUPLEX\t_IO  ('P', 22)\n#define SNDCTL_DSP_GETODELAY\t_IOR ('P', 23, int)\n\n/*\n * I guess these are the readonly version of the same\n * functions that exist above as SNDCTL_DSP_...\n */\n#define SOUND_PCM_READ_RATE\t_IOR ('P', 2, int)\n#define SOUND_PCM_READ_CHANNELS\t_IOR ('P', 6, int)\n#define SOUND_PCM_READ_BITS\t_IOR ('P', 5, int)\n#define SOUND_PCM_READ_FILTER\t_IOR ('P', 7, int)\n\n/*\n * ioctl calls to be used in communication with coprocessors and\n * DSP chips.\n */\n\ntypedef struct copr_buffer {\n\tint command;\t/* Set to 0 if not used */\n\tint flags;\n#define CPF_NONE\t\t0x0000\n#define CPF_FIRST\t\t0x0001\t/* First block */\n#define CPF_LAST\t\t0x0002\t/* Last block */\n\tint len;\n\tint offs;\t/* If required by the device (0 if not used) */\n\n\tu_char data[4000]; /* NOTE! 4000 is not 4k */\n} copr_buffer;\n\ntypedef struct copr_debug_buf {\n\tint command;\t/* Used internally. Set to 0 */\n\tint parm1;\n\tint parm2;\n\tint flags;\n\tint len;\t/* Length of data in bytes */\n} copr_debug_buf;\n\ntypedef struct copr_msg {\n\tint len;\n\tu_char data[4000];\n} copr_msg;\n\n#define SNDCTL_COPR_RESET       _IO  ('C',  0)\n#define SNDCTL_COPR_LOAD\t_IOWR('C',  1, copr_buffer)\n#define SNDCTL_COPR_RDATA\t_IOWR('C',  2, copr_debug_buf)\n#define SNDCTL_COPR_RCODE\t_IOWR('C',  3, copr_debug_buf)\n#define SNDCTL_COPR_WDATA\t_IOW ('C',  4, copr_debug_buf)\n#define SNDCTL_COPR_WCODE\t_IOW ('C',  5, copr_debug_buf)\n#define SNDCTL_COPR_RUN\t\t_IOWR('C',  6, copr_debug_buf)\n#define SNDCTL_COPR_HALT\t_IOWR('C',  7, copr_debug_buf)\n#define SNDCTL_COPR_SENDMSG\t_IOW ('C',  8, copr_msg)\n#define SNDCTL_COPR_RCVMSG\t_IOR ('C',  9, copr_msg)\n\n/*\n * IOCTL commands for /dev/mixer\n */\n\n/*\n * Mixer devices\n *\n * There can be up to 20 different analog mixer channels. The\n * SOUND_MIXER_NRDEVICES gives the currently supported maximum.\n * The SOUND_MIXER_READ_DEVMASK returns a bitmask which tells\n * the devices supported by the particular mixer.\n */\n\n#define SOUND_MIXER_NRDEVICES\t25\n#define SOUND_MIXER_VOLUME\t0\t/* Master output level */\n#define SOUND_MIXER_BASS\t1\t/* Treble level of all output channels */\n#define SOUND_MIXER_TREBLE\t2\t/* Bass level of all output channels */\n#define SOUND_MIXER_SYNTH\t3\t/* Volume of synthesier input */\n#define SOUND_MIXER_PCM\t\t4\t/* Output level for the audio device */\n#define SOUND_MIXER_SPEAKER\t5\t/* Output level for the PC speaker\n\t\t\t\t\t * signals */\n#define SOUND_MIXER_LINE\t6\t/* Volume level for the line in jack */\n#define SOUND_MIXER_MIC\t\t7\t/* Volume for the signal coming from\n\t\t\t\t\t * the microphone jack */\n#define SOUND_MIXER_CD\t\t8\t/* Volume level for the input signal\n\t\t\t\t\t * connected to the CD audio input */\n#define SOUND_MIXER_IMIX\t9\t/* Recording monitor. It controls the\n\t\t\t\t\t * output volume of the selected\n\t\t\t\t\t * recording sources while recording */\n#define SOUND_MIXER_ALTPCM\t10\t/* Volume of the alternative codec\n\t\t\t\t\t * device */\n#define SOUND_MIXER_RECLEV\t11\t/* Global recording level */\n#define SOUND_MIXER_IGAIN\t12\t/* Input gain */\n#define SOUND_MIXER_OGAIN\t13\t/* Output gain */\n/*\n * The AD1848 codec and compatibles have three line level inputs\n * (line, aux1 and aux2). Since each card manufacturer have assigned\n * different meanings to these inputs, it's inpractical to assign\n * specific meanings (line, cd, synth etc.) to them.\n */\n#define SOUND_MIXER_LINE1\t14\t/* Input source 1  (aux1) */\n#define SOUND_MIXER_LINE2\t15\t/* Input source 2  (aux2) */\n#define SOUND_MIXER_LINE3\t16\t/* Input source 3  (line) */\n#define SOUND_MIXER_DIGITAL1    17      /* Digital (input) 1 */\n#define SOUND_MIXER_DIGITAL2    18      /* Digital (input) 2 */\n#define SOUND_MIXER_DIGITAL3    19      /* Digital (input) 3 */\n#define SOUND_MIXER_PHONEIN     20      /* Phone input */\n#define SOUND_MIXER_PHONEOUT    21      /* Phone output */\n#define SOUND_MIXER_VIDEO       22      /* Video/TV (audio) in */\n#define SOUND_MIXER_RADIO       23      /* Radio in */\n#define SOUND_MIXER_MONITOR     24      /* Monitor (usually mic) volume */\n\n\n/*\n * Some on/off settings (SOUND_SPECIAL_MIN - SOUND_SPECIAL_MAX)\n * Not counted to SOUND_MIXER_NRDEVICES, but use the same number space\n */\n#define SOUND_ONOFF_MIN\t\t28\n#define SOUND_ONOFF_MAX\t\t30\n#define SOUND_MIXER_MUTE\t28\t/* 0 or 1 */\n#define SOUND_MIXER_ENHANCE\t29\t/* Enhanced stereo (0, 40, 60 or 80) */\n#define SOUND_MIXER_LOUD\t30\t/* 0 or 1 */\n\n/* Note!\tNumber 31 cannot be used since the sign bit is reserved */\n#define SOUND_MIXER_NONE        31\n\n#define SOUND_DEVICE_LABELS\t{ \\\n\t\"Vol  \", \"Bass \", \"Trebl\", \"Synth\", \"Pcm  \", \"Spkr \", \"Line \", \\\n\t\"Mic  \", \"CD   \", \"Mix  \", \"Pcm2 \", \"Rec  \", \"IGain\", \"OGain\", \\\n\t\"Line1\", \"Line2\", \"Line3\", \"Digital1\", \"Digital2\", \"Digital3\", \\\n\t\"PhoneIn\", \"PhoneOut\", \"Video\", \"Radio\", \"Monitor\"}\n\n#define SOUND_DEVICE_NAMES\t{ \\\n\t\"vol\", \"bass\", \"treble\", \"synth\", \"pcm\", \"speaker\", \"line\", \\\n\t\"mic\", \"cd\", \"mix\", \"pcm2\", \"rec\", \"igain\", \"ogain\", \\\n\t\"line1\", \"line2\", \"line3\", \"dig1\", \"dig2\", \"dig3\", \\\n\t\"phin\", \"phout\", \"video\", \"radio\", \"monitor\"}\n\n/*\tDevice bitmask identifiers\t*/\n\n#define SOUND_MIXER_RECSRC\t0xff\t/* 1 bit per recording source */\n#define SOUND_MIXER_DEVMASK\t0xfe\t/* 1 bit per supported device */\n#define SOUND_MIXER_RECMASK\t0xfd\t/* 1 bit per supp. recording source */\n#define SOUND_MIXER_CAPS\t0xfc\n#define SOUND_CAP_EXCL_INPUT\t0x00000001\t/* Only 1 rec. src at a time */\n#define SOUND_MIXER_STEREODEVS\t0xfb\t/* Mixer channels supporting stereo */\n\n/*\tDevice mask bits\t*/\n\n#define SOUND_MASK_VOLUME\t(1 << SOUND_MIXER_VOLUME)\n#define SOUND_MASK_BASS\t\t(1 << SOUND_MIXER_BASS)\n#define SOUND_MASK_TREBLE\t(1 << SOUND_MIXER_TREBLE)\n#define SOUND_MASK_SYNTH\t(1 << SOUND_MIXER_SYNTH)\n#define SOUND_MASK_PCM\t\t(1 << SOUND_MIXER_PCM)\n#define SOUND_MASK_SPEAKER\t(1 << SOUND_MIXER_SPEAKER)\n#define SOUND_MASK_LINE\t\t(1 << SOUND_MIXER_LINE)\n#define SOUND_MASK_MIC\t\t(1 << SOUND_MIXER_MIC)\n#define SOUND_MASK_CD\t\t(1 << SOUND_MIXER_CD)\n#define SOUND_MASK_IMIX\t\t(1 << SOUND_MIXER_IMIX)\n#define SOUND_MASK_ALTPCM\t(1 << SOUND_MIXER_ALTPCM)\n#define SOUND_MASK_RECLEV\t(1 << SOUND_MIXER_RECLEV)\n#define SOUND_MASK_IGAIN\t(1 << SOUND_MIXER_IGAIN)\n#define SOUND_MASK_OGAIN\t(1 << SOUND_MIXER_OGAIN)\n#define SOUND_MASK_LINE1\t(1 << SOUND_MIXER_LINE1)\n#define SOUND_MASK_LINE2\t(1 << SOUND_MIXER_LINE2)\n#define SOUND_MASK_LINE3\t(1 << SOUND_MIXER_LINE3)\n#define SOUND_MASK_DIGITAL1     (1 << SOUND_MIXER_DIGITAL1)\n#define SOUND_MASK_DIGITAL2     (1 << SOUND_MIXER_DIGITAL2)\n#define SOUND_MASK_DIGITAL3     (1 << SOUND_MIXER_DIGITAL3)\n#define SOUND_MASK_PHONEIN      (1 << SOUND_MIXER_PHONEIN)\n#define SOUND_MASK_PHONEOUT     (1 << SOUND_MIXER_PHONEOUT)\n#define SOUND_MASK_RADIO        (1 << SOUND_MIXER_RADIO)\n#define SOUND_MASK_VIDEO        (1 << SOUND_MIXER_VIDEO)\n#define SOUND_MASK_MONITOR      (1 << SOUND_MIXER_MONITOR)\n\n/* Obsolete macros */\n#define SOUND_MASK_MUTE\t\t(1 << SOUND_MIXER_MUTE)\n#define SOUND_MASK_ENHANCE\t(1 << SOUND_MIXER_ENHANCE)\n#define SOUND_MASK_LOUD\t\t(1 << SOUND_MIXER_LOUD)\n\n#define MIXER_READ(dev)\t\t_IOR('M', dev, int)\n#define SOUND_MIXER_READ_VOLUME\t\tMIXER_READ(SOUND_MIXER_VOLUME)\n#define SOUND_MIXER_READ_BASS\t\tMIXER_READ(SOUND_MIXER_BASS)\n#define SOUND_MIXER_READ_TREBLE\t\tMIXER_READ(SOUND_MIXER_TREBLE)\n#define SOUND_MIXER_READ_SYNTH\t\tMIXER_READ(SOUND_MIXER_SYNTH)\n#define SOUND_MIXER_READ_PCM\t\tMIXER_READ(SOUND_MIXER_PCM)\n#define SOUND_MIXER_READ_SPEAKER\tMIXER_READ(SOUND_MIXER_SPEAKER)\n#define SOUND_MIXER_READ_LINE\t\tMIXER_READ(SOUND_MIXER_LINE)\n#define SOUND_MIXER_READ_MIC\t\tMIXER_READ(SOUND_MIXER_MIC)\n#define SOUND_MIXER_READ_CD\t\tMIXER_READ(SOUND_MIXER_CD)\n#define SOUND_MIXER_READ_IMIX\t\tMIXER_READ(SOUND_MIXER_IMIX)\n#define SOUND_MIXER_READ_ALTPCM\t\tMIXER_READ(SOUND_MIXER_ALTPCM)\n#define SOUND_MIXER_READ_RECLEV\t\tMIXER_READ(SOUND_MIXER_RECLEV)\n#define SOUND_MIXER_READ_IGAIN\t\tMIXER_READ(SOUND_MIXER_IGAIN)\n#define SOUND_MIXER_READ_OGAIN\t\tMIXER_READ(SOUND_MIXER_OGAIN)\n#define SOUND_MIXER_READ_LINE1\t\tMIXER_READ(SOUND_MIXER_LINE1)\n#define SOUND_MIXER_READ_LINE2\t\tMIXER_READ(SOUND_MIXER_LINE2)\n#define SOUND_MIXER_READ_LINE3\t\tMIXER_READ(SOUND_MIXER_LINE3)\n#define SOUND_MIXER_READ_DIGITAL1\tMIXER_READ(SOUND_MIXER_DIGITAL1)\n#define SOUND_MIXER_READ_DIGITAL2\tMIXER_READ(SOUND_MIXER_DIGITAL2)\n#define SOUND_MIXER_READ_DIGITAL3\tMIXER_READ(SOUND_MIXER_DIGITAL3)\n#define SOUND_MIXER_READ_PHONEIN      \tMIXER_READ(SOUND_MIXER_PHONEIN)\n#define SOUND_MIXER_READ_PHONEOUT\tMIXER_READ(SOUND_MIXER_PHONEOUT)\n#define SOUND_MIXER_READ_RADIO\t\tMIXER_READ(SOUND_MIXER_RADIO)\n#define SOUND_MIXER_READ_VIDEO\t\tMIXER_READ(SOUND_MIXER_VIDEO)\n#define SOUND_MIXER_READ_MONITOR\tMIXER_READ(SOUND_MIXER_MONITOR)\n\n/* Obsolete macros */\n#define SOUND_MIXER_READ_MUTE\t\tMIXER_READ(SOUND_MIXER_MUTE)\n#define SOUND_MIXER_READ_ENHANCE\tMIXER_READ(SOUND_MIXER_ENHANCE)\n#define SOUND_MIXER_READ_LOUD\t\tMIXER_READ(SOUND_MIXER_LOUD)\n\n#define SOUND_MIXER_READ_RECSRC\t\tMIXER_READ(SOUND_MIXER_RECSRC)\n#define SOUND_MIXER_READ_DEVMASK\tMIXER_READ(SOUND_MIXER_DEVMASK)\n#define SOUND_MIXER_READ_RECMASK\tMIXER_READ(SOUND_MIXER_RECMASK)\n#define SOUND_MIXER_READ_STEREODEVS\tMIXER_READ(SOUND_MIXER_STEREODEVS)\n#define SOUND_MIXER_READ_CAPS\t\tMIXER_READ(SOUND_MIXER_CAPS)\n\n#define MIXER_WRITE(dev)\t\t_IOWR('M', dev, int)\n#define SOUND_MIXER_WRITE_VOLUME\tMIXER_WRITE(SOUND_MIXER_VOLUME)\n#define SOUND_MIXER_WRITE_BASS\t\tMIXER_WRITE(SOUND_MIXER_BASS)\n#define SOUND_MIXER_WRITE_TREBLE\tMIXER_WRITE(SOUND_MIXER_TREBLE)\n#define SOUND_MIXER_WRITE_SYNTH\t\tMIXER_WRITE(SOUND_MIXER_SYNTH)\n#define SOUND_MIXER_WRITE_PCM\t\tMIXER_WRITE(SOUND_MIXER_PCM)\n#define SOUND_MIXER_WRITE_SPEAKER\tMIXER_WRITE(SOUND_MIXER_SPEAKER)\n#define SOUND_MIXER_WRITE_LINE\t\tMIXER_WRITE(SOUND_MIXER_LINE)\n#define SOUND_MIXER_WRITE_MIC\t\tMIXER_WRITE(SOUND_MIXER_MIC)\n#define SOUND_MIXER_WRITE_CD\t\tMIXER_WRITE(SOUND_MIXER_CD)\n#define SOUND_MIXER_WRITE_IMIX\t\tMIXER_WRITE(SOUND_MIXER_IMIX)\n#define SOUND_MIXER_WRITE_ALTPCM\tMIXER_WRITE(SOUND_MIXER_ALTPCM)\n#define SOUND_MIXER_WRITE_RECLEV\tMIXER_WRITE(SOUND_MIXER_RECLEV)\n#define SOUND_MIXER_WRITE_IGAIN\t\tMIXER_WRITE(SOUND_MIXER_IGAIN)\n#define SOUND_MIXER_WRITE_OGAIN\t\tMIXER_WRITE(SOUND_MIXER_OGAIN)\n#define SOUND_MIXER_WRITE_LINE1\t\tMIXER_WRITE(SOUND_MIXER_LINE1)\n#define SOUND_MIXER_WRITE_LINE2\t\tMIXER_WRITE(SOUND_MIXER_LINE2)\n#define SOUND_MIXER_WRITE_LINE3\t\tMIXER_WRITE(SOUND_MIXER_LINE3)\n#define SOUND_MIXER_WRITE_DIGITAL1\tMIXER_WRITE(SOUND_MIXER_DIGITAL1)\n#define SOUND_MIXER_WRITE_DIGITAL2\tMIXER_WRITE(SOUND_MIXER_DIGITAL2)\n#define SOUND_MIXER_WRITE_DIGITAL3\tMIXER_WRITE(SOUND_MIXER_DIGITAL3)\n#define SOUND_MIXER_WRITE_PHONEIN      \tMIXER_WRITE(SOUND_MIXER_PHONEIN)\n#define SOUND_MIXER_WRITE_PHONEOUT\tMIXER_WRITE(SOUND_MIXER_PHONEOUT)\n#define SOUND_MIXER_WRITE_RADIO\t\tMIXER_WRITE(SOUND_MIXER_RADIO)\n#define SOUND_MIXER_WRITE_VIDEO\t\tMIXER_WRITE(SOUND_MIXER_VIDEO)\n#define SOUND_MIXER_WRITE_MONITOR\tMIXER_WRITE(SOUND_MIXER_MONITOR)\n\n#define SOUND_MIXER_WRITE_MUTE\t\tMIXER_WRITE(SOUND_MIXER_MUTE)\n#define SOUND_MIXER_WRITE_ENHANCE\tMIXER_WRITE(SOUND_MIXER_ENHANCE)\n#define SOUND_MIXER_WRITE_LOUD\t\tMIXER_WRITE(SOUND_MIXER_LOUD)\n\n#define SOUND_MIXER_WRITE_RECSRC\tMIXER_WRITE(SOUND_MIXER_RECSRC)\n\ntypedef struct mixer_info {\n  char id[16];\n  char name[32];\n  int  modify_counter;\n  int fillers[10];\n} mixer_info;\n\n#define SOUND_MIXER_INFO\t\t_IOR('M', 101, mixer_info)\n\n#define LEFT_CHN\t0\n#define RIGHT_CHN\t1\n\n/*\n * Level 2 event types for /dev/sequencer\n */\n\n/*\n * The 4 most significant bits of byte 0 specify the class of\n * the event:\n *\n *\t0x8X = system level events,\n *\t0x9X = device/port specific events, event[1] = device/port,\n *\t\tThe last 4 bits give the subtype:\n *\t\t\t0x02\t= Channel event (event[3] = chn).\n *\t\t\t0x01\t= note event (event[4] = note).\n *\t\t\t(0x01 is not used alone but always with bit 0x02).\n *\t       event[2] = MIDI message code (0x80=note off etc.)\n *\n */\n\n#define EV_SEQ_LOCAL\t\t0x80\n#define EV_TIMING\t\t0x81\n#define EV_CHN_COMMON\t\t0x92\n#define EV_CHN_VOICE\t\t0x93\n#define EV_SYSEX\t\t0x94\n/*\n * Event types 200 to 220 are reserved for application use.\n * These numbers will not be used by the driver.\n */\n\n/*\n * Events for event type EV_CHN_VOICE\n */\n\n#define MIDI_NOTEOFF\t\t0x80\n#define MIDI_NOTEON\t\t0x90\n#define MIDI_KEY_PRESSURE\t0xA0\n\n/*\n * Events for event type EV_CHN_COMMON\n */\n\n#define MIDI_CTL_CHANGE\t\t0xB0\n#define MIDI_PGM_CHANGE\t\t0xC0\n#define MIDI_CHN_PRESSURE\t0xD0\n#define MIDI_PITCH_BEND\t\t0xE0\n\n#define MIDI_SYSTEM_PREFIX\t0xF0\n\n/*\n * Timer event types\n */\n#define TMR_WAIT_REL\t\t1\t/* Time relative to the prev time */\n#define TMR_WAIT_ABS\t\t2\t/* Absolute time since TMR_START */\n#define TMR_STOP\t\t3\n#define TMR_START\t\t4\n#define TMR_CONTINUE\t\t5\n#define TMR_TEMPO\t\t6\n#define TMR_ECHO\t\t8\n#define TMR_CLOCK\t\t9\t/* MIDI clock */\n#define TMR_SPP\t\t\t10\t/* Song position pointer */\n#define TMR_TIMESIG\t\t11\t/* Time signature */\n\n/*\n *\tLocal event types\n */\n#define LOCL_STARTAUDIO\t\t1\n\n#if (!defined(_KERNEL) && !defined(INKERNEL)) || defined(USE_SEQ_MACROS)\n/*\n *\tSome convenience macros to simplify programming of the\n *\t/dev/sequencer interface\n *\n *\tThese macros define the API which should be used when possible.\n */\n\n#ifndef USE_SIMPLE_MACROS\nvoid seqbuf_dump(void);\t/* This function must be provided by programs */\n\n/* Sample seqbuf_dump() implementation:\n *\n *\tSEQ_DEFINEBUF (2048);\t-- Defines a buffer for 2048 bytes\n *\n *\tint seqfd;\t\t-- The file descriptor for /dev/sequencer.\n *\n *\tvoid\n *\tseqbuf_dump ()\n *\t{\n *\t  if (_seqbufptr)\n *\t    if (write (seqfd, _seqbuf, _seqbufptr) == -1)\n *\t      {\n *\t\tperror (\"write /dev/sequencer\");\n *\t\texit (-1);\n *\t      }\n *\t  _seqbufptr = 0;\n *\t}\n */\n\n#define SEQ_DEFINEBUF(len)\t\t\\\n\tu_char _seqbuf[len]; int _seqbuflen = len;int _seqbufptr = 0\n#define SEQ_USE_EXTBUF()\t\t\\\n\textern u_char _seqbuf[]; \\\n\textern int _seqbuflen;extern int _seqbufptr\n#define SEQ_DECLAREBUF()\t\tSEQ_USE_EXTBUF()\n#define SEQ_PM_DEFINES\t\t\tstruct patmgr_info _pm_info\n#define _SEQ_NEEDBUF(len)\t\t\\\n\tif ((_seqbufptr+(len)) > _seqbuflen) \\\n\t\tseqbuf_dump()\n#define _SEQ_ADVBUF(len)\t\t_seqbufptr += len\n#define SEQ_DUMPBUF\t\t\tseqbuf_dump\n#else\n/*\n * This variation of the sequencer macros is used just to format one event\n * using fixed buffer.\n *\n * The program using the macro library must define the following macros before\n * using this library.\n *\n * #define _seqbuf \t\t name of the buffer (u_char[])\n * #define _SEQ_ADVBUF(len)\t If the applic needs to know the exact\n *\t\t\t\t size of the event, this macro can be used.\n *\t\t\t\t Otherwise this must be defined as empty.\n * #define _seqbufptr\t\t Define the name of index variable or 0 if\n *\t\t\t\t not required.\n */\n#define _SEQ_NEEDBUF(len)\t/* empty */\n#endif\n\n#define PM_LOAD_PATCH(dev, bank, pgm)\t\\\n\t(SEQ_DUMPBUF(), _pm_info.command = _PM_LOAD_PATCH, \\\n\t_pm_info.device=dev, _pm_info.data.data8[0]=pgm, \\\n\t_pm_info.parm1 = bank, _pm_info.parm2 = 1, \\\n\tioctl(seqfd, SNDCTL_PMGR_ACCESS, &_pm_info))\n#define PM_LOAD_PATCHES(dev, bank, pgm) \\\n\t(SEQ_DUMPBUF(), _pm_info.command = _PM_LOAD_PATCH, \\\n\t_pm_info.device=dev, bcopy( pgm, _pm_info.data.data8,  128), \\\n\t_pm_info.parm1 = bank, _pm_info.parm2 = 128, \\\n\tioctl(seqfd, SNDCTL_PMGR_ACCESS, &_pm_info))\n\n#define SEQ_VOLUME_MODE(dev, mode)\t{ \\\n\t_SEQ_NEEDBUF(8);\\\n\t_seqbuf[_seqbufptr] = SEQ_EXTENDED;\\\n\t_seqbuf[_seqbufptr+1] = SEQ_VOLMODE;\\\n\t_seqbuf[_seqbufptr+2] = (dev);\\\n\t_seqbuf[_seqbufptr+3] = (mode);\\\n\t_seqbuf[_seqbufptr+4] = 0;\\\n\t_seqbuf[_seqbufptr+5] = 0;\\\n\t_seqbuf[_seqbufptr+6] = 0;\\\n\t_seqbuf[_seqbufptr+7] = 0;\\\n\t_SEQ_ADVBUF(8);}\n\n/*\n * Midi voice messages\n */\n\n#define _CHN_VOICE(dev, event, chn, note, parm)  { \\\n\t_SEQ_NEEDBUF(8);\\\n\t_seqbuf[_seqbufptr] = EV_CHN_VOICE;\\\n\t_seqbuf[_seqbufptr+1] = (dev);\\\n\t_seqbuf[_seqbufptr+2] = (event);\\\n\t_seqbuf[_seqbufptr+3] = (chn);\\\n\t_seqbuf[_seqbufptr+4] = (note);\\\n\t_seqbuf[_seqbufptr+5] = (parm);\\\n\t_seqbuf[_seqbufptr+6] = (0);\\\n\t_seqbuf[_seqbufptr+7] = 0;\\\n\t_SEQ_ADVBUF(8);}\n\n#define SEQ_START_NOTE(dev, chn, note, vol) \\\n\t\t_CHN_VOICE(dev, MIDI_NOTEON, chn, note, vol)\n\n#define SEQ_STOP_NOTE(dev, chn, note, vol) \\\n\t\t_CHN_VOICE(dev, MIDI_NOTEOFF, chn, note, vol)\n\n#define SEQ_KEY_PRESSURE(dev, chn, note, pressure) \\\n\t\t_CHN_VOICE(dev, MIDI_KEY_PRESSURE, chn, note, pressure)\n\n/*\n * Midi channel messages\n */\n\n#define _CHN_COMMON(dev, event, chn, p1, p2, w14) { \\\n\t_SEQ_NEEDBUF(8);\\\n\t_seqbuf[_seqbufptr] = EV_CHN_COMMON;\\\n\t_seqbuf[_seqbufptr+1] = (dev);\\\n\t_seqbuf[_seqbufptr+2] = (event);\\\n\t_seqbuf[_seqbufptr+3] = (chn);\\\n\t_seqbuf[_seqbufptr+4] = (p1);\\\n\t_seqbuf[_seqbufptr+5] = (p2);\\\n\t*(short *)&_seqbuf[_seqbufptr+6] = (w14);\\\n\t_SEQ_ADVBUF(8);}\n/*\n * SEQ_SYSEX permits sending of sysex messages. (It may look that it permits\n * sending any MIDI bytes but it's absolutely not possible. Trying to do\n * so _will_ cause problems with MPU401 intelligent mode).\n *\n * Sysex messages are sent in blocks of 1 to 6 bytes. Longer messages must be\n * sent by calling SEQ_SYSEX() several times (there must be no other events\n * between them). First sysex fragment must have 0xf0 in the first byte\n * and the last byte (buf[len-1] of the last fragment must be 0xf7. No byte\n * between these sysex start and end markers cannot be larger than 0x7f. Also\n * lengths of each fragments (except the last one) must be 6.\n *\n * Breaking the above rules may work with some MIDI ports but is likely to\n * cause fatal problems with some other devices (such as MPU401).\n */\n#define SEQ_SYSEX(dev, buf, len) { \\\n\tint i, l=(len); if (l>6)l=6;\\\n\t_SEQ_NEEDBUF(8);\\\n\t_seqbuf[_seqbufptr] = EV_SYSEX;\\\n\tfor(i=0;i<l;i++)_seqbuf[_seqbufptr+i+1] = (buf)[i];\\\n\tfor(i=l;i<6;i++)_seqbuf[_seqbufptr+i+1] = 0xff;\\\n\t_SEQ_ADVBUF(8);}\n\n#define SEQ_CHN_PRESSURE(dev, chn, pressure) \\\n\t_CHN_COMMON(dev, MIDI_CHN_PRESSURE, chn, pressure, 0, 0)\n\n#define SEQ_SET_PATCH(dev, chn, patch) \\\n\t_CHN_COMMON(dev, MIDI_PGM_CHANGE, chn, patch, 0, 0)\n\n#define SEQ_CONTROL(dev, chn, controller, value) \\\n\t_CHN_COMMON(dev, MIDI_CTL_CHANGE, chn, controller, 0, value)\n\n#define SEQ_BENDER(dev, chn, value) \\\n\t_CHN_COMMON(dev, MIDI_PITCH_BEND, chn, 0, 0, value)\n\n\n#define SEQ_V2_X_CONTROL(dev, voice, controller, value)\t{ \\\n\t_SEQ_NEEDBUF(8);\\\n\t_seqbuf[_seqbufptr] = SEQ_EXTENDED;\\\n\t_seqbuf[_seqbufptr+1] = SEQ_CONTROLLER;\\\n\t_seqbuf[_seqbufptr+2] = (dev);\\\n\t_seqbuf[_seqbufptr+3] = (voice);\\\n\t_seqbuf[_seqbufptr+4] = (controller);\\\n\t*(short *)&_seqbuf[_seqbufptr+5] = (value);\\\n\t_seqbuf[_seqbufptr+7] = 0;\\\n\t_SEQ_ADVBUF(8);}\n\n/*\n * The following 5 macros are incorrectly implemented and obsolete.\n * Use SEQ_BENDER and SEQ_CONTROL (with proper controller) instead.\n */\n\n#define SEQ_PITCHBEND(dev, voice, value) \\\n\tSEQ_V2_X_CONTROL(dev, voice, CTRL_PITCH_BENDER, value)\n#define SEQ_BENDER_RANGE(dev, voice, value) \\\n\tSEQ_V2_X_CONTROL(dev, voice, CTRL_PITCH_BENDER_RANGE, value)\n#define SEQ_EXPRESSION(dev, voice, value) \\\n\tSEQ_CONTROL(dev, voice, CTL_EXPRESSION, value*128)\n#define SEQ_MAIN_VOLUME(dev, voice, value) \\\n\tSEQ_CONTROL(dev, voice, CTL_MAIN_VOLUME, (value*16383)/100)\n#define SEQ_PANNING(dev, voice, pos) \\\n\tSEQ_CONTROL(dev, voice, CTL_PAN, (pos+128) / 2)\n\n/*\n * Timing and syncronization macros\n */\n\n#define _TIMER_EVENT(ev, parm)\t\t{ \\\n\t_SEQ_NEEDBUF(8);\\\n\t_seqbuf[_seqbufptr+0] = EV_TIMING; \\\n\t_seqbuf[_seqbufptr+1] = (ev); \\\n\t_seqbuf[_seqbufptr+2] = 0;\\\n\t_seqbuf[_seqbufptr+3] = 0;\\\n\t*(u_int *)&_seqbuf[_seqbufptr+4] = (parm); \\\n\t_SEQ_ADVBUF(8); \\\n\t}\n\n#define SEQ_START_TIMER()\t\t_TIMER_EVENT(TMR_START, 0)\n#define SEQ_STOP_TIMER()\t\t_TIMER_EVENT(TMR_STOP, 0)\n#define SEQ_CONTINUE_TIMER()\t\t_TIMER_EVENT(TMR_CONTINUE, 0)\n#define SEQ_WAIT_TIME(ticks)\t\t_TIMER_EVENT(TMR_WAIT_ABS, ticks)\n#define SEQ_DELTA_TIME(ticks)\t\t_TIMER_EVENT(TMR_WAIT_REL, ticks)\n#define SEQ_ECHO_BACK(key)\t\t_TIMER_EVENT(TMR_ECHO, key)\n#define SEQ_SET_TEMPO(value)\t\t_TIMER_EVENT(TMR_TEMPO, value)\n#define SEQ_SONGPOS(pos)\t\t_TIMER_EVENT(TMR_SPP, pos)\n#define SEQ_TIME_SIGNATURE(sig)\t\t_TIMER_EVENT(TMR_TIMESIG, sig)\n\n/*\n * Local control events\n */\n\n#define _LOCAL_EVENT(ev, parm)\t\t{ \\\n\t_SEQ_NEEDBUF(8);\\\n\t_seqbuf[_seqbufptr+0] = EV_SEQ_LOCAL; \\\n\t_seqbuf[_seqbufptr+1] = (ev); \\\n\t_seqbuf[_seqbufptr+2] = 0;\\\n\t_seqbuf[_seqbufptr+3] = 0;\\\n\t*(u_int *)&_seqbuf[_seqbufptr+4] = (parm); \\\n\t_SEQ_ADVBUF(8); \\\n\t}\n\n#define SEQ_PLAYAUDIO(devmask)\t\t_LOCAL_EVENT(LOCL_STARTAUDIO, devmask)\n/*\n * Events for the level 1 interface only\n */\n\n#define SEQ_MIDIOUT(device, byte)\t{ \\\n\t_SEQ_NEEDBUF(4);\\\n\t_seqbuf[_seqbufptr] = SEQ_MIDIPUTC;\\\n\t_seqbuf[_seqbufptr+1] = (byte);\\\n\t_seqbuf[_seqbufptr+2] = (device);\\\n\t_seqbuf[_seqbufptr+3] = 0;\\\n\t_SEQ_ADVBUF(4);}\n\n/*\n * Patch loading.\n */\n#define SEQ_WRPATCH(patchx, len)\t{ \\\n\tif (_seqbufptr) seqbuf_dump(); \\\n\tif (write(seqfd, (char*)(patchx), len)==-1) \\\n\t   perror(\"Write patch: /dev/sequencer\"); \\\n\t}\n\n#define SEQ_WRPATCH2(patchx, len)\t\\\n\t( seqbuf_dump(), write(seqfd, (char*)(patchx), len) )\n\n#endif\n\n/*\n * Here I have moved all the aliases for ioctl names.\n */\n\n#define SNDCTL_DSP_SAMPLESIZE\tSNDCTL_DSP_SETFMT\n#define SOUND_PCM_WRITE_BITS\tSNDCTL_DSP_SETFMT\n#define SOUND_PCM_SETFMT\tSNDCTL_DSP_SETFMT\n\n#define SOUND_PCM_WRITE_RATE\tSNDCTL_DSP_SPEED\n#define SOUND_PCM_POST\t\tSNDCTL_DSP_POST\n#define SOUND_PCM_RESET\t\tSNDCTL_DSP_RESET\n#define SOUND_PCM_SYNC\t\tSNDCTL_DSP_SYNC\n#define SOUND_PCM_SUBDIVIDE\tSNDCTL_DSP_SUBDIVIDE\n#define SOUND_PCM_SETFRAGMENT\tSNDCTL_DSP_SETFRAGMENT\n#define SOUND_PCM_GETFMTS\tSNDCTL_DSP_GETFMTS\n#define SOUND_PCM_GETOSPACE\tSNDCTL_DSP_GETOSPACE\n#define SOUND_PCM_GETISPACE\tSNDCTL_DSP_GETISPACE\n#define SOUND_PCM_NONBLOCK\tSNDCTL_DSP_NONBLOCK\n#define SOUND_PCM_GETCAPS\tSNDCTL_DSP_GETCAPS\n#define SOUND_PCM_GETTRIGGER\tSNDCTL_DSP_GETTRIGGER\n#define SOUND_PCM_SETTRIGGER\tSNDCTL_DSP_SETTRIGGER\n#define SOUND_PCM_SETSYNCRO\tSNDCTL_DSP_SETSYNCRO\n#define SOUND_PCM_GETIPTR\tSNDCTL_DSP_GETIPTR\n#define SOUND_PCM_GETOPTR\tSNDCTL_DSP_GETOPTR\n#define SOUND_PCM_MAPINBUF\tSNDCTL_DSP_MAPINBUF\n#define SOUND_PCM_MAPOUTBUF\tSNDCTL_DSP_MAPOUTBUF\n\n/***********************************************************************/\n\n/**\n * XXX OSSv4 defines -- some bits taken straight out of the new\n * sys/soundcard.h bundled with recent OSS releases.\n *\n * NB:  These macros and structures will be reorganized and inserted\n * \tin appropriate places throughout this file once the code begins\n * \tto take shape.\n *\n * @todo reorganize layout more like the 4Front version\n * @todo ask about maintaining __SIOWR vs. _IOWR ioctl cmd defines\n */\n\n/**\n * @note The @c OSSV4_EXPERIMENT macro is meant to wrap new development code\n * in the sound system relevant to adopting 4Front's OSSv4 specification.\n * Users should not enable this!  Really!\n */\n#if 0\n# define OSSV4_EXPERIMENT 1\n#else\n# undef OSSV4_EXPERIMENT\n#endif\n\n#ifdef SOUND_VERSION\n# undef SOUND_VERSION\n# define SOUND_VERSION\t0x040000\n#endif\t/* !SOUND_VERSION */\n\n#define OSS_LONGNAME_SIZE\t64\n#define OSS_LABEL_SIZE\t\t16\n#define OSS_DEVNODE_SIZE        32\ntypedef char oss_longname_t[OSS_LONGNAME_SIZE];\ntypedef char oss_label_t[OSS_LABEL_SIZE];\ntypedef char oss_devnode_t[OSS_DEVNODE_SIZE];\n\ntypedef struct audio_errinfo\n{\n\tint\t\tplay_underruns;\n\tint\t\trec_overruns;\n\tunsigned int\tplay_ptradjust;\n\tunsigned int\trec_ptradjust;\n\tint\t\tplay_errorcount;\n\tint\t\trec_errorcount;\n\tint\t\tplay_lasterror;\n\tint\t\trec_lasterror;\n\tlong\t\tplay_errorparm;\n\tlong\t\trec_errorparm;\n\tint\t\tfiller[16];\n} audio_errinfo;\n\n#define SNDCTL_DSP_GETPLAYVOL           _IOR ('P', 24, int)\n#define SNDCTL_DSP_SETPLAYVOL           _IOWR('P', 24, int)\n#define SNDCTL_DSP_GETERROR             _IOR ('P', 25, audio_errinfo)\n\n\n/*\n ****************************************************************************\n * Sync groups for audio devices\n */\ntypedef struct oss_syncgroup\n{\n  int id;\n  int mode;\n  int filler[16];\n} oss_syncgroup;\n\n#define SNDCTL_DSP_SYNCGROUP            _IOWR('P', 28, oss_syncgroup)\n#define SNDCTL_DSP_SYNCSTART            _IOW ('P', 29, int)\n\n/*\n **************************************************************************\n * \"cooked\" mode enables software based conversions for sample rate, sample\n * format (bits) and number of channels (mono/stereo). These conversions are\n * required with some devices that support only one sample rate or just stereo\n * to let the applications to use other formats. The cooked mode is enabled by\n * default. However it's necessary to disable this mode when mmap() is used or\n * when very deterministic timing is required. SNDCTL_DSP_COOKEDMODE is an\n * optional call introduced in OSS 3.9.6f. It's _error return must be ignored_\n * since normally this call will return erno=EINVAL.\n *\n * SNDCTL_DSP_COOKEDMODE must be called immediately after open before doing\n * anything else. Otherwise the call will not have any effect.\n */\n#define SNDCTL_DSP_COOKEDMODE           _IOW ('P', 30, int)\n\n/*\n **************************************************************************\n * SNDCTL_DSP_SILENCE and SNDCTL_DSP_SKIP are new calls in OSS 3.99.0\n * that can be used to implement pause/continue during playback (no effect\n * on recording).\n */\n#define SNDCTL_DSP_SILENCE              _IO  ('P', 31)\n#define SNDCTL_DSP_SKIP                 _IO  ('P', 32)\n\n/*\n ****************************************************************************\n * Abort transfer (reset) functions for input and output\n */\n#define SNDCTL_DSP_HALT_INPUT\t\t_IO  ('P', 33)\n#define SNDCTL_DSP_RESET_INPUT\tSNDCTL_DSP_HALT_INPUT\t/* Old name */\n#define SNDCTL_DSP_HALT_OUTPUT\t\t_IO  ('P', 34)\n#define SNDCTL_DSP_RESET_OUTPUT\tSNDCTL_DSP_HALT_OUTPUT\t/* Old name */\n\n/*\n ****************************************************************************\n * Low water level control\n */\n#define SNDCTL_DSP_LOW_WATER\t\t_IOW ('P', 34, int)\n\n/** @todo Get rid of OSS_NO_LONG_LONG references? */\n\n/*\n ****************************************************************************\n * 64 bit pointer support. Only available in environments that support\n * the 64 bit (long long) integer type.\n */\n#ifndef OSS_NO_LONG_LONG\ntypedef struct\n{\n  long long samples;\n  int fifo_samples;\n  int filler[32];\t\t/* For future use */\n} oss_count_t;\n\n#define SNDCTL_DSP_CURRENT_IPTR\t\t_IOR ('P', 35, oss_count_t)\n#define SNDCTL_DSP_CURRENT_OPTR\t\t_IOR ('P', 36, oss_count_t)\n#endif\n\n/*\n ****************************************************************************\n * Interface for selecting recording sources and playback output routings.\n */\n#define SNDCTL_DSP_GET_RECSRC_NAMES     _IOR ('P', 37, oss_mixer_enuminfo)\n#define SNDCTL_DSP_GET_RECSRC           _IOR ('P', 38, int)\n#define SNDCTL_DSP_SET_RECSRC           _IOWR('P', 38, int)\n\n#define SNDCTL_DSP_GET_PLAYTGT_NAMES    _IOR ('P', 39, oss_mixer_enuminfo)\n#define SNDCTL_DSP_GET_PLAYTGT          _IOR ('P', 40, int)\n#define SNDCTL_DSP_SET_PLAYTGT          _IOWR('P', 40, int)\n#define SNDCTL_DSP_GETRECVOL            _IOR ('P', 41, int)\n#define SNDCTL_DSP_SETRECVOL            _IOWR('P', 41, int)\n\n/*\n ***************************************************************************\n * Some calls for setting the channel assignment with multi channel devices\n * (see the manual for details).                                                 */\n#define SNDCTL_DSP_GET_CHNORDER         _IOR ('P', 42, unsigned long long)\n#define SNDCTL_DSP_SET_CHNORDER         _IOWR('P', 42, unsigned long long)\n#       define CHID_UNDEF       0\n#       define CHID_L           1\n#       define CHID_R           2\n#       define CHID_C           3\n#       define CHID_LFE         4\n#       define CHID_LS          5\n#       define CHID_RS          6\n#       define CHID_LR          7\n#       define CHID_RR          8\n#define CHNORDER_UNDEF          0x0000000000000000ULL\n#define CHNORDER_NORMAL         0x0000000087654321ULL\n\n#define MAX_PEAK_CHANNELS\t128\ntypedef unsigned short oss_peaks_t[MAX_PEAK_CHANNELS];\n#define SNDCTL_DSP_GETIPEAKS\t\t_IOR('P', 43, oss_peaks_t)\n#define SNDCTL_DSP_GETOPEAKS\t\t_IOR('P', 44, oss_peaks_t)\n#define SNDCTL_DSP_POLICY               _IOW('P', 45, int)    /* See the manual */\n\n/*\n ****************************************************************************\n * Few ioctl calls that are not official parts of OSS. They have been used\n * by few freeware implementations of OSS.\n */\n#define SNDCTL_DSP_GETCHANNELMASK\t_IOWR('P', 64, int)\n#define SNDCTL_DSP_BIND_CHANNEL\t\t_IOWR('P', 65, int)\n#define DSP_BIND_QUERY\t\t\t0x00000000\n#define DSP_BIND_FRONT\t\t\t0x00000001\n#define DSP_BIND_SURR\t\t\t0x00000002\n#define DSP_BIND_CENTER_LFE\t\t0x00000004\n#define DSP_BIND_HANDSET\t\t0x00000008\n#define DSP_BIND_MIC\t\t\t0x00000010\n#define DSP_BIND_MODEM1\t\t\t0x00000020\n#define DSP_BIND_MODEM2\t\t\t0x00000040\n#define DSP_BIND_I2S\t\t\t0x00000080\n#define DSP_BIND_SPDIF\t\t\t0x00000100\n#define DSP_BIND_REAR\t\t\t0x00000200\n\n/*\n * OSS_SYSIFO is obsolete. Use SNDCTL_SYSINFO insteads.\n */\n#define OSS_GETVERSION                  _IOR ('M', 118, int)\n\n/**\n * @brief\tArgument for SNDCTL_SYSINFO ioctl.\n *\n * For use w/ the SNDCTL_SYSINFO ioctl available on audio (/dev/dsp*),\n * mixer, and MIDI devices.\n */\ntypedef struct oss_sysinfo\n{\n\tchar\tproduct[32];\t/* For example OSS/Free, OSS/Linux or\n\t\t\t\t   OSS/Solaris */\n\tchar\tversion[32];\t/* For example 4.0a */\n\tint\tversionnum;\t/* See OSS_GETVERSION */\n\tchar\toptions[128];\t/* Reserved */\n\n\tint\tnumaudios;\t/* # of audio/dsp devices */\n\tint\topenedaudio[8];\t/* Bit mask telling which audio devices\n\t\t\t\t   are busy */\n\n\tint\tnumsynths;\t/* # of availavle synth devices */\n\tint\tnummidis;\t/* # of available MIDI ports */\n\tint\tnumtimers;\t/* # of available timer devices */\n\tint\tnummixers;\t/* # of mixer devices */\n\n\tint\topenedmidi[8];\t/* Bit mask telling which midi devices\n\t\t\t\t   are busy */\n\tint\tnumcards;\t/* Number of sound cards in the system */\n\tint\tnumaudioengines;\t/* Number of audio engines in the system */\n\tchar\tlicense[16];\t/* For example \"GPL\" or \"CDDL\" */\n\tchar\trevision_info[256];\t/* For internal use */\n\tint\tfiller[172];\t/* For future expansion (set to -1) */\n} oss_sysinfo;\n\ntypedef struct oss_mixext\n{\n  int dev;\t\t\t/* Mixer device number */\n  int ctrl;\t\t\t/* Controller number */\n  int type;\t\t\t/* Entry type */\n#\tdefine MIXT_DEVROOT\t 0\t/* Device root entry */\n#\tdefine MIXT_GROUP\t 1\t/* Controller group */\n#\tdefine MIXT_ONOFF\t 2\t/* OFF (0) or ON (1) */\n#\tdefine MIXT_ENUM\t 3\t/* Enumerated (0 to maxvalue) */\n#\tdefine MIXT_MONOSLIDER\t 4\t/* Mono slider (0 to 100) */\n#\tdefine MIXT_STEREOSLIDER 5\t/* Stereo slider (dual 0 to 100) */\n#\tdefine MIXT_MESSAGE\t 6\t/* (Readable) textual message */\n#\tdefine MIXT_MONOVU\t 7\t/* VU meter value (mono) */\n#\tdefine MIXT_STEREOVU\t 8\t/* VU meter value (stereo) */\n#\tdefine MIXT_MONOPEAK\t 9\t/* VU meter peak value (mono) */\n#\tdefine MIXT_STEREOPEAK\t10\t/* VU meter peak value (stereo) */\n#\tdefine MIXT_RADIOGROUP\t11\t/* Radio button group */\n#\tdefine MIXT_MARKER\t12\t/* Separator between normal and extension entries */\n#\tdefine MIXT_VALUE\t13\t/* Decimal value entry */\n#\tdefine MIXT_HEXVALUE\t14\t/* Hexadecimal value entry */\n#\tdefine MIXT_MONODB\t15\t/* Mono atten. slider (0 to -144) */\n#\tdefine MIXT_STEREODB\t16\t/* Stereo atten. slider (dual 0 to -144) */\n#\tdefine MIXT_SLIDER\t17\t/* Slider (mono) with full integer range */\n#\tdefine MIXT_3D\t\t18\n\n  /* Possible value range (minvalue to maxvalue) */\n  /* Note that maxvalue may also be smaller than minvalue */\n  int maxvalue;\n  int minvalue;\n\n  int flags;\n#\tdefine MIXF_READABLE\t0x00000001\t/* Has readable value */\n#\tdefine MIXF_WRITEABLE\t0x00000002\t/* Has writeable value */\n#\tdefine MIXF_POLL\t0x00000004\t/* May change itself */\n#\tdefine MIXF_HZ\t\t0x00000008\t/* Herz scale */\n#\tdefine MIXF_STRING\t0x00000010\t/* Use dynamic extensions for value */\n#\tdefine MIXF_DYNAMIC\t0x00000010\t/* Supports dynamic extensions */\n#\tdefine MIXF_OKFAIL\t0x00000020\t/* Interpret value as 1=OK, 0=FAIL */\n#\tdefine MIXF_FLAT\t0x00000040\t/* Flat vertical space requirements */\n#\tdefine MIXF_LEGACY\t0x00000080\t/* Legacy mixer control group */\n  char id[16];\t\t\t/* Mnemonic ID (mainly for internal use) */\n  int parent;\t\t\t/* Entry# of parent (group) node (-1 if root) */\n\n  int dummy;\t\t\t/* Internal use */\n\n  int timestamp;\n\n  char data[64];\t\t/* Misc data (entry type dependent) */\n  unsigned char enum_present[32];\t/* Mask of allowed enum values */\n  int control_no;\t\t/* SOUND_MIXER_VOLUME..SOUND_MIXER_MIDI */\n  /* (-1 means not indicated) */\n\n/*\n * The desc field is reserved for internal purposes of OSS. It should not be \n * used by applications.\n */\n  unsigned int desc;\n#define MIXEXT_SCOPE_MASK\t\t\t0x0000003f\n#define MIXEXT_SCOPE_OTHER\t\t\t0x00000000\n#define MIXEXT_SCOPE_INPUT\t\t\t0x00000001\n#define MIXEXT_SCOPE_OUTPUT\t\t\t0x00000002\n#define MIXEXT_SCOPE_MONITOR\t\t\t0x00000003\n#define MIXEXT_SCOPE_RECSWITCH\t\t\t0x00000004\n\n  char extname[32];\n  int update_counter;\n  int filler[7];\n} oss_mixext;\n\ntypedef struct oss_mixext_root\n{\n  char id[16];\n  char name[48];\n} oss_mixext_root;\n\ntypedef struct oss_mixer_value\n{\n  int dev;\n  int ctrl;\n  int value;\n  int flags;\t\t\t/* Reserved for future use. Initialize to 0 */\n  int timestamp;\t\t/* Must be set to oss_mixext.timestamp */\n  int filler[8];\t\t/* Reserved for future use. Initialize to 0 */\n} oss_mixer_value;\n\n#define OSS_ENUM_MAXVALUE       255\ntypedef struct oss_mixer_enuminfo\n{\n\tint\tdev;\n\tint\tctrl;\n\tint\tnvalues;\n\tint\tversion;                  /* Read the manual */\n\tshort\tstrindex[OSS_ENUM_MAXVALUE];\n\tchar\tstrings[3000];\n} oss_mixer_enuminfo;\n\n#define OPEN_READ       PCM_ENABLE_INPUT\n#define OPEN_WRITE      PCM_ENABLE_OUTPUT\n#define OPEN_READWRITE  (OPEN_READ|OPEN_WRITE)\n\n/**\n * @brief\tArgument for SNDCTL_AUDIOINFO ioctl.\n *\n * For use w/ the SNDCTL_AUDIOINFO ioctl available on audio (/dev/dsp*)\n * devices.\n */\ntypedef struct oss_audioinfo\n{\n\tint\tdev;\t\t/* Audio device number */\n\tchar\tname[64];\n\tint\tbusy;\t\t/* 0, OPEN_READ, OPEN_WRITE or OPEN_READWRITE */\n\tint\tpid;\n\tint\tcaps;\t\t/* DSP_CAP_INPUT, DSP_CAP_OUTPUT */\n\tint\tiformats;\n\tint\toformats;\n\tint\tmagic;\t\t/* Reserved for internal use */\n\tchar \tcmd[64];\t/* Command using the device (if known) */\n\tint\tcard_number;\n\tint\tport_number;\n\tint\tmixer_dev;\n\tint\treal_device;\t/* Obsolete field. Replaced by devnode */\n\tint\tenabled;\t/* 1=enabled, 0=device not ready at this\n\t\t\t\t   moment */\n\tint\tflags;\t\t/* For internal use only - no practical\n\t\t\t\t   meaning */\n\tint\tmin_rate;\t/* Sample rate limits */\n\tint\tmax_rate;\n\tint\tmin_channels;\t/* Number of channels supported */\n\tint\tmax_channels;\n\tint\tbinding;\t/* DSP_BIND_FRONT, etc. 0 means undefined */\n\tint\trate_source;\n\tchar\thandle[32];\n\t#define OSS_MAX_SAMPLE_RATES\t20\t/* Cannot be changed  */\n\tunsigned int nrates;\n\tunsigned int rates[OSS_MAX_SAMPLE_RATES]; /* Please read the manual before using these */\n\toss_longname_t\tsong_name;\t/* Song name (if given) */\n\toss_label_t\tlabel;\t\t/* Device label (if given) */\n\tint\t\tlatency;\t/* In usecs, -1=unknown */\n\toss_devnode_t\tdevnode;\t/* Device special file name (inside\n\t\t\t\t\t   /dev) */\n\tint next_play_engine;\n\tint next_rec_engine;\n\tint filler[184];\n} oss_audioinfo;\n\ntypedef struct oss_mixerinfo\n{\n  int dev;\n  char id[16];\n  char name[32];\n  int modify_counter;\n  int card_number;\n  int port_number;\n  char handle[32];\n  int magic;\t\t\t/* Reserved */\n  int enabled;\t\t\t/* Reserved */\n  int caps;\n#define MIXER_CAP_VIRTUAL\t\t\t\t0x00000001\n  int flags;\t\t\t/* Reserved */\n  int nrext;\n  /*\n   * The priority field can be used to select the default (motherboard)\n   * mixer device. The mixer with the highest priority is the\n   * most preferred one. -2 or less means that this device cannot be used\n   * as the default mixer.\n   */\n  int priority;\n  int filler[254];\t\t/* Reserved */\n} oss_mixerinfo;\n\ntypedef struct oss_midi_info\n{\n  int dev;\t\t\t/* Midi device number */\n  char name[64];\n  int busy;\t\t\t/* 0, OPEN_READ, OPEN_WRITE or OPEN_READWRITE */\n  int pid;\n  char cmd[64];\t\t\t/* Command using the device (if known) */\n  int caps;\n#define MIDI_CAP_MPU401\t\t0x00000001\t/**** OBSOLETE ****/\n#define MIDI_CAP_INPUT\t\t0x00000002\n#define MIDI_CAP_OUTPUT\t\t0x00000004\n#define MIDI_CAP_INOUT\t\t(MIDI_CAP_INPUT|MIDI_CAP_OUTPUT)\n#define MIDI_CAP_VIRTUAL\t0x00000008\t/* Pseudo device */\n#define MIDI_CAP_MTCINPUT\t0x00000010\t/* Supports SNDCTL_MIDI_MTCINPUT */\n#define MIDI_CAP_CLIENT\t\t0x00000020\t/* Virtual client side device */\n#define MIDI_CAP_SERVER\t\t0x00000040\t/* Virtual server side device */\n#define MIDI_CAP_INTERNAL\t0x00000080\t/* Internal (synth) device */\n#define MIDI_CAP_EXTERNAL\t0x00000100\t/* external (MIDI port) device */\n#define MIDI_CAP_PTOP\t\t0x00000200\t/* Point to point link to one device */\n#define MIDI_CAP_MTC\t\t0x00000400\t/* MTC/SMPTE (control) device */\n  int magic;\t\t\t/* Reserved for internal use */\n  int card_number;\n  int port_number;\n  int enabled;\t\t\t/* 1=enabled, 0=device not ready at this moment */\n  int flags;\t\t\t/* For internal use only - no practical meaning */\n  char handle[32];\n  oss_longname_t song_name;\t/* Song name (if known) */\n  oss_label_t label;\t\t/* Device label (if given) */\n  int latency;\t\t\t/* In usecs, -1=unknown */\n  int filler[244];\n} oss_midi_info;\n\ntypedef struct oss_card_info\n{\n  int card;\n  char shortname[16];\n  char longname[128];\n  int flags;\n  char hw_info[400];\n  int intr_count, ack_count;\n  int filler[154];\n} oss_card_info;\n\n#define SNDCTL_SYSINFO          _IOR ('X', 1, oss_sysinfo)\n#define OSS_SYSINFO             SNDCTL_SYSINFO /* Old name */\n\n#define SNDCTL_MIX_NRMIX\t_IOR ('X', 2, int)\n#define SNDCTL_MIX_NREXT\t_IOWR('X', 3, int)\n#define SNDCTL_MIX_EXTINFO\t_IOWR('X', 4, oss_mixext)\n#define SNDCTL_MIX_READ\t\t_IOWR('X', 5, oss_mixer_value)\n#define SNDCTL_MIX_WRITE\t_IOWR('X', 6, oss_mixer_value)\n\n#define SNDCTL_AUDIOINFO\t_IOWR('X', 7, oss_audioinfo)\n#define SNDCTL_MIX_ENUMINFO\t_IOWR('X', 8, oss_mixer_enuminfo)\n#define SNDCTL_MIDIINFO\t\t_IOWR('X', 9, oss_midi_info)\n#define SNDCTL_MIXERINFO\t_IOWR('X',10, oss_mixerinfo)\n#define SNDCTL_CARDINFO\t\t_IOWR('X',11, oss_card_info)\n#define SNDCTL_ENGINEINFO\t_IOWR('X',12, oss_audioinfo)\n#define SNDCTL_AUDIOINFO_EX\t_IOWR('X',13, oss_audioinfo)\n\n/*\n * Few more \"globally\" available ioctl calls.\n */\n#define SNDCTL_SETSONG          _IOW ('Y', 2, oss_longname_t)\n#define SNDCTL_GETSONG          _IOR ('Y', 2, oss_longname_t)\n#define SNDCTL_SETNAME          _IOW ('Y', 3, oss_longname_t)\n#define SNDCTL_SETLABEL         _IOW ('Y', 4, oss_label_t)\n#define SNDCTL_GETLABEL         _IOR ('Y', 4, oss_label_t)\n\n#endif\t/* !_SYS_SOUNDCARD_H_ */\n"
  },
  {
    "path": "freebsd-headers/sys/stack.h",
    "content": "/*-\n * Copyright (c) 2005 Antoine Brodin\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/sys/stack.h 194828 2009-06-24 12:06:15Z rwatson $\n */\n\n#ifndef _SYS_STACK_H_\n#define\t_SYS_STACK_H_\n\n#include <sys/_stack.h>\n\nstruct sbuf;\n\n/* MI Routines. */\nstruct stack\t*stack_create(void);\nvoid\t\t stack_destroy(struct stack *);\nint\t\t stack_put(struct stack *, vm_offset_t);\nvoid\t\t stack_copy(struct stack *, struct stack *);\nvoid\t\t stack_zero(struct stack *);\nvoid\t\t stack_print(struct stack *);\nvoid\t\t stack_print_ddb(struct stack *);\nvoid\t\t stack_print_short(struct stack *);\nvoid\t\t stack_print_short_ddb(struct stack *);\nvoid\t\t stack_sbuf_print(struct sbuf *, struct stack *);\nvoid\t\t stack_sbuf_print_ddb(struct sbuf *, struct stack *);\n#ifdef KTR\nvoid\t\t stack_ktr(u_int, const char *, int, struct stack *, u_int, int);\n#define\tCTRSTACK(m, st, depth, cheap) do {\t\t\t\t\\\n\tif (KTR_COMPILE & (m))\t\t\t\t\t\t\\\n\t\tstack_ktr((m), __FILE__, __LINE__, st, depth, cheap);\t\\\n\t} while(0)\n#else\n#define\tCTRSTACK(m, st, depth, cheap)\n#endif\n\n/* MD Routine. */\nstruct thread;\nvoid\t\t stack_save(struct stack *);\nvoid\t\t stack_save_td(struct stack *, struct thread *);\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/sys/stat.h",
    "content": "/*-\n * Copyright (c) 1982, 1986, 1989, 1993\n *\tThe Regents of the University of California.  All rights reserved.\n * (c) UNIX System Laboratories, Inc.\n * All or some portions of this file are derived from material licensed\n * to the University of California by American Telephone and Telegraph\n * Co. or Unix System Laboratories, Inc. and are reproduced herein with\n * the permission of UNIX System Laboratories, Inc.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 4. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t@(#)stat.h\t8.12 (Berkeley) 6/16/95\n * $FreeBSD: release/9.0.0/sys/sys/stat.h 205792 2010-03-28 13:13:22Z ed $\n */\n\n#ifndef _SYS_STAT_H_\n#define\t_SYS_STAT_H_\n\n#include <sys/cdefs.h>\n#include <sys/_timespec.h>\n#include <sys/_types.h>\n\n#ifndef _BLKSIZE_T_DECLARED\ntypedef\t__blksize_t\tblksize_t;\n#define\t_BLKSIZE_T_DECLARED\n#endif\n\n#ifndef _BLKCNT_T_DECLARED\ntypedef\t__blkcnt_t\tblkcnt_t;\n#define\t_BLKCNT_T_DECLARED\n#endif\n\n#ifndef _DEV_T_DECLARED\ntypedef\t__dev_t\t\tdev_t;\n#define\t_DEV_T_DECLARED\n#endif\n\n#ifndef _FFLAGS_T_DECLARED\ntypedef\t__fflags_t\tfflags_t;\n#define\t_FFLAGS_T_DECLARED\n#endif\n\n#ifndef _GID_T_DECLARED\ntypedef\t__gid_t\t\tgid_t;\n#define\t_GID_T_DECLARED\n#endif\n\n#ifndef _INO_T_DECLARED\ntypedef\t__ino_t\t\tino_t;\n#define\t_INO_T_DECLARED\n#endif\n\n#ifndef _MODE_T_DECLARED\ntypedef\t__mode_t\tmode_t;\n#define\t_MODE_T_DECLARED\n#endif\n\n#ifndef _NLINK_T_DECLARED\ntypedef\t__nlink_t\tnlink_t;\n#define\t_NLINK_T_DECLARED\n#endif\n\n#ifndef _OFF_T_DECLARED\ntypedef\t__off_t\t\toff_t;\n#define\t_OFF_T_DECLARED\n#endif\n\n#ifndef _UID_T_DECLARED\ntypedef\t__uid_t\t\tuid_t;\n#define\t_UID_T_DECLARED\n#endif\n\n#if !defined(_KERNEL) && __BSD_VISIBLE\n/*\n * XXX We get miscellaneous namespace pollution with this.\n */\n#include <sys/time.h>\n#endif\n\n#if __BSD_VISIBLE\nstruct ostat {\n\t__uint16_t st_dev;\t\t/* inode's device */\n\tino_t\t  st_ino;\t\t/* inode's number */\n\tmode_t\t  st_mode;\t\t/* inode protection mode */\n\tnlink_t\t  st_nlink;\t\t/* number of hard links */\n\t__uint16_t st_uid;\t\t/* user ID of the file's owner */\n\t__uint16_t st_gid;\t\t/* group ID of the file's group */\n\t__uint16_t st_rdev;\t\t/* device type */\n\t__int32_t st_size;\t\t/* file size, in bytes */\n\tstruct\ttimespec st_atim;\t/* time of last access */\n\tstruct\ttimespec st_mtim;\t/* time of last data modification */\n\tstruct\ttimespec st_ctim;\t/* time of last file status change */\n\t__int32_t st_blksize;\t\t/* optimal blocksize for I/O */\n\t__int32_t st_blocks;\t\t/* blocks allocated for file */\n\tfflags_t  st_flags;\t\t/* user defined flags for file */\n\t__uint32_t st_gen;\t\t/* file generation number */\n};\n#endif /* __BSD_VISIBLE */\n\nstruct stat {\n\t__dev_t   st_dev;\t\t/* inode's device */\n\tino_t\t  st_ino;\t\t/* inode's number */\n\tmode_t\t  st_mode;\t\t/* inode protection mode */\n\tnlink_t\t  st_nlink;\t\t/* number of hard links */\n\tuid_t\t  st_uid;\t\t/* user ID of the file's owner */\n\tgid_t\t  st_gid;\t\t/* group ID of the file's group */\n\t__dev_t   st_rdev;\t\t/* device type */\n\tstruct\ttimespec st_atim;\t/* time of last access */\n\tstruct\ttimespec st_mtim;\t/* time of last data modification */\n\tstruct\ttimespec st_ctim;\t/* time of last file status change */\n\toff_t\t  st_size;\t\t/* file size, in bytes */\n\tblkcnt_t st_blocks;\t\t/* blocks allocated for file */\n\tblksize_t st_blksize;\t\t/* optimal blocksize for I/O */\n\tfflags_t  st_flags;\t\t/* user defined flags for file */\n\t__uint32_t st_gen;\t\t/* file generation number */\n\t__int32_t st_lspare;\n\tstruct timespec st_birthtim;\t/* time of file creation */\n\t/*\n\t * Explicitly pad st_birthtim to 16 bytes so that the size of\n\t * struct stat is backwards compatible.  We use bitfields instead\n\t * of an array of chars so that this doesn't require a C99 compiler\n\t * to compile if the size of the padding is 0.  We use 2 bitfields\n\t * to cover up to 64 bits on 32-bit machines.  We assume that\n\t * CHAR_BIT is 8...\n\t */\n\tunsigned int :(8 / 2) * (16 - (int)sizeof(struct timespec));\n\tunsigned int :(8 / 2) * (16 - (int)sizeof(struct timespec));\n};\n\n#if __BSD_VISIBLE\nstruct nstat {\n\t__dev_t   st_dev;\t\t/* inode's device */\n\tino_t\t  st_ino;\t\t/* inode's number */\n\t__uint32_t st_mode;\t\t/* inode protection mode */\n\t__uint32_t st_nlink;\t\t/* number of hard links */\n\tuid_t\t  st_uid;\t\t/* user ID of the file's owner */\n\tgid_t\t  st_gid;\t\t/* group ID of the file's group */\n\t__dev_t   st_rdev;\t\t/* device type */\n\tstruct\ttimespec st_atim;\t/* time of last access */\n\tstruct\ttimespec st_mtim;\t/* time of last data modification */\n\tstruct\ttimespec st_ctim;\t/* time of last file status change */\n\toff_t\t  st_size;\t\t/* file size, in bytes */\n\tblkcnt_t st_blocks;\t\t/* blocks allocated for file */\n\tblksize_t st_blksize;\t\t/* optimal blocksize for I/O */\n\tfflags_t  st_flags;\t\t/* user defined flags for file */\n\t__uint32_t st_gen;\t\t/* file generation number */\n\tstruct timespec st_birthtim;\t/* time of file creation */\n\t/*\n\t * See above about the following padding.\n\t */\n\tunsigned int :(8 / 2) * (16 - (int)sizeof(struct timespec));\n\tunsigned int :(8 / 2) * (16 - (int)sizeof(struct timespec));\n};\n#endif\n\n#ifndef _KERNEL\n#define\tst_atime\t\tst_atim.tv_sec\n#define\tst_mtime\t\tst_mtim.tv_sec\n#define\tst_ctime\t\tst_ctim.tv_sec\n#if __BSD_VISIBLE\n#define\tst_birthtime\t\tst_birthtim.tv_sec\n#endif\n\n/* For compatibility. */\n#if __BSD_VISIBLE\n#define\tst_atimespec\t\tst_atim\n#define\tst_mtimespec\t\tst_mtim\n#define\tst_ctimespec\t\tst_ctim\n#define\tst_birthtimespec\tst_birthtim\n#endif\n#endif /* !_KERNEL */\n\n#define\tS_ISUID\t0004000\t\t\t/* set user id on execution */\n#define\tS_ISGID\t0002000\t\t\t/* set group id on execution */\n#if __BSD_VISIBLE\n#define\tS_ISTXT\t0001000\t\t\t/* sticky bit */\n#endif\n\n#define\tS_IRWXU\t0000700\t\t\t/* RWX mask for owner */\n#define\tS_IRUSR\t0000400\t\t\t/* R for owner */\n#define\tS_IWUSR\t0000200\t\t\t/* W for owner */\n#define\tS_IXUSR\t0000100\t\t\t/* X for owner */\n\n#if __BSD_VISIBLE\n#define\tS_IREAD\t\tS_IRUSR\n#define\tS_IWRITE\tS_IWUSR\n#define\tS_IEXEC\t\tS_IXUSR\n#endif\n\n#define\tS_IRWXG\t0000070\t\t\t/* RWX mask for group */\n#define\tS_IRGRP\t0000040\t\t\t/* R for group */\n#define\tS_IWGRP\t0000020\t\t\t/* W for group */\n#define\tS_IXGRP\t0000010\t\t\t/* X for group */\n\n#define\tS_IRWXO\t0000007\t\t\t/* RWX mask for other */\n#define\tS_IROTH\t0000004\t\t\t/* R for other */\n#define\tS_IWOTH\t0000002\t\t\t/* W for other */\n#define\tS_IXOTH\t0000001\t\t\t/* X for other */\n\n#if __XSI_VISIBLE\n#define\tS_IFMT\t 0170000\t\t/* type of file mask */\n#define\tS_IFIFO\t 0010000\t\t/* named pipe (fifo) */\n#define\tS_IFCHR\t 0020000\t\t/* character special */\n#define\tS_IFDIR\t 0040000\t\t/* directory */\n#define\tS_IFBLK\t 0060000\t\t/* block special */\n#define\tS_IFREG\t 0100000\t\t/* regular */\n#define\tS_IFLNK\t 0120000\t\t/* symbolic link */\n#define\tS_IFSOCK 0140000\t\t/* socket */\n#define\tS_ISVTX\t 0001000\t\t/* save swapped text even after use */\n#endif\n#if __BSD_VISIBLE\n#define\tS_IFWHT  0160000\t\t/* whiteout */\n#endif\n\n#define\tS_ISDIR(m)\t(((m) & 0170000) == 0040000)\t/* directory */\n#define\tS_ISCHR(m)\t(((m) & 0170000) == 0020000)\t/* char special */\n#define\tS_ISBLK(m)\t(((m) & 0170000) == 0060000)\t/* block special */\n#define\tS_ISREG(m)\t(((m) & 0170000) == 0100000)\t/* regular file */\n#define\tS_ISFIFO(m)\t(((m) & 0170000) == 0010000)\t/* fifo or socket */\n#if __POSIX_VISIBLE >= 200112\n#define\tS_ISLNK(m)\t(((m) & 0170000) == 0120000)\t/* symbolic link */\n#define\tS_ISSOCK(m)\t(((m) & 0170000) == 0140000)\t/* socket */\n#endif\n#if __BSD_VISIBLE\n#define\tS_ISWHT(m)\t(((m) & 0170000) == 0160000)\t/* whiteout */\n#endif\n\n#if __BSD_VISIBLE\n#define\tACCESSPERMS\t(S_IRWXU|S_IRWXG|S_IRWXO)\t/* 0777 */\n\t\t\t\t\t\t\t/* 7777 */\n#define\tALLPERMS\t(S_ISUID|S_ISGID|S_ISTXT|S_IRWXU|S_IRWXG|S_IRWXO)\n\t\t\t\t\t\t\t/* 0666 */\n#define\tDEFFILEMODE\t(S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH)\n\n#define S_BLKSIZE\t512\t\t/* block size used in the stat struct */\n\n/*\n * Definitions of flags stored in file flags word.\n *\n * Super-user and owner changeable flags.\n */\n#define\tUF_SETTABLE\t0x0000ffff\t/* mask of owner changeable flags */\n#define\tUF_NODUMP\t0x00000001\t/* do not dump file */\n#define\tUF_IMMUTABLE\t0x00000002\t/* file may not be changed */\n#define\tUF_APPEND\t0x00000004\t/* writes to file may only append */\n#define UF_OPAQUE\t0x00000008\t/* directory is opaque wrt. union */\n#define UF_NOUNLINK\t0x00000010\t/* file may not be removed or renamed */\n/*\n * Super-user changeable flags.\n */\n#define\tSF_SETTABLE\t0xffff0000\t/* mask of superuser changeable flags */\n#define\tSF_ARCHIVED\t0x00010000\t/* file is archived */\n#define\tSF_IMMUTABLE\t0x00020000\t/* file may not be changed */\n#define\tSF_APPEND\t0x00040000\t/* writes to file may only append */\n#define\tSF_NOUNLINK\t0x00100000\t/* file may not be removed or renamed */\n#define\tSF_SNAPSHOT\t0x00200000\t/* snapshot inode */\n\n#ifdef _KERNEL\n/*\n * Shorthand abbreviations of above.\n */\n#define\tOPAQUE\t\t(UF_OPAQUE)\n#define\tAPPEND\t\t(UF_APPEND | SF_APPEND)\n#define\tIMMUTABLE\t(UF_IMMUTABLE | SF_IMMUTABLE)\n#define\tNOUNLINK\t(UF_NOUNLINK | SF_NOUNLINK)\n#endif\n\n#endif /* __BSD_VISIBLE */\n\n#ifndef _KERNEL\n__BEGIN_DECLS\n#if __BSD_VISIBLE\nint\tchflags(const char *, unsigned long);\n#endif\nint\tchmod(const char *, mode_t);\n#if __BSD_VISIBLE\nint\tfchflags(int, unsigned long);\n#endif\n#if __POSIX_VISIBLE >= 200112\nint\tfchmod(int, mode_t);\n#endif\n#if __POSIX_VISIBLE >= 200809\nint\tfchmodat(int, const char *, mode_t, int);\n#endif\nint\tfstat(int, struct stat *);\n#if __BSD_VISIBLE\nint\tlchflags(const char *, int);\nint\tlchmod(const char *, mode_t);\n#endif\n#if __POSIX_VISIBLE >= 200112\nint\tlstat(const char * __restrict, struct stat * __restrict);\n#endif\nint\tmkdir(const char *, mode_t);\nint\tmkfifo(const char *, mode_t);\n#if !defined(_MKNOD_DECLARED) && __XSI_VISIBLE\nint\tmknod(const char *, mode_t, dev_t);\n#define\t_MKNOD_DECLARED\n#endif\nint\tstat(const char * __restrict, struct stat * __restrict);\nmode_t\tumask(mode_t);\n#if __BSD_VISIBLE || __POSIX_VISIBLE >= 200809\nint\tfstatat(int, const char *, struct stat *, int);\nint\tmkdirat(int, const char *, mode_t);\nint\tmkfifoat(int, const char *, mode_t);\n#endif\n#if __BSD_VISIBLE || __XSI_VISIBLE >= 700\nint\tmknodat(int, const char *, mode_t, dev_t);\n#endif\n__END_DECLS\n#endif /* !_KERNEL */\n\n#endif /* !_SYS_STAT_H_ */\n"
  },
  {
    "path": "freebsd-headers/sys/statvfs.h",
    "content": "/*-\n * Copyright 2002 Massachusetts Institute of Technology\n *\n * Permission to use, copy, modify, and distribute this software and\n * its documentation for any purpose and without fee is hereby\n * granted, provided that both the above copyright notice and this\n * permission notice appear in all copies, that both the above\n * copyright notice and this permission notice appear in all\n * supporting documentation, and that the name of M.I.T. not be used\n * in advertising or publicity pertaining to distribution of the\n * software without specific, written prior permission.  M.I.T. makes\n * no representations about the suitability of this software for any\n * purpose.  It is provided \"as is\" without express or implied\n * warranty.\n * \n * THIS SOFTWARE IS PROVIDED BY M.I.T. ``AS IS''.  M.I.T. DISCLAIMS\n * ALL EXPRESS OR IMPLIED WARRANTIES WITH REGARD TO THIS SOFTWARE,\n * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF\n * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT\n * SHALL M.I.T. BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF\n * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\n * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,\n * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT\n * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/sys/statvfs.h 139825 2005-01-07 02:29:27Z imp $\n */\n\n#ifndef _SYS_STATVFS_H_\n#define\t_SYS_STATVFS_H_\n\n#include <sys/cdefs.h>\n#include <sys/_types.h>\n\n/*\n * POSIX says we must define the fsblkcnt_t and fsfilcnt_t types here.\n * Note that these must be unsigned integer types, so we have to be\n * careful in converting the signed statfs members to the unsigned\n * statvfs members.  (Well, actually, we don't -- see below -- but\n * a quality implementation should.)\n */\n#ifndef _FSBLKCNT_T_DECLARED\t\t/* always declared together */\ntypedef\t__fsblkcnt_t\tfsblkcnt_t;\ntypedef\t__fsfilcnt_t\tfsfilcnt_t;\n#define _FSBLKCNT_T_DECLARED\n#endif\n\n/*\n * The difference between `avail' and `free' is that `avail' represents\n * space available to unprivileged processes, whereas `free' includes all\n * unallocated space, including that reserved for privileged processes.\n * Or at least, that's the most useful interpretation.  (According to\n * the letter of the standard, this entire interface is completely\n * unspecified!)\n */\nstruct statvfs {\n\tfsblkcnt_t\tf_bavail;\t/* Number of blocks */\n\tfsblkcnt_t\tf_bfree;\n\tfsblkcnt_t\tf_blocks;\n\tfsfilcnt_t\tf_favail;\t/* Number of files (e.g., inodes) */\n\tfsfilcnt_t\tf_ffree;\n\tfsfilcnt_t\tf_files;\n\tunsigned long\tf_bsize;\t/* Size of blocks counted above */\n\tunsigned long\tf_flag;\n\tunsigned long\tf_frsize;\t/* Size of fragments */\n\tunsigned long\tf_fsid;\t\t/* Not meaningful */\n\tunsigned long\tf_namemax;\t/* Same as pathconf(_PC_NAME_MAX) */\n};\n\n/* flag bits for f_flag: */\n#define\tST_RDONLY\t0x1\n#define\tST_NOSUID\t0x2\n\n__BEGIN_DECLS\nint\tfstatvfs(int, struct statvfs *);\nint\tstatvfs(const char *__restrict, struct statvfs *__restrict);\n__END_DECLS\n#endif /* _SYS_STATVFS_H_ */\n"
  },
  {
    "path": "freebsd-headers/sys/stddef.h",
    "content": "/*-\n * Copyright (c) 2002 Maxime Henrion <mux@FreeBSD.org>\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/sys/stddef.h 221476 2011-05-05 02:35:25Z obrien $\n */\n\n#ifndef _SYS_STDDEF_H_\n#define _SYS_STDDEF_H_\n\n#include <sys/cdefs.h>\n#include <sys/_null.h>\n#include <machine/_types.h>\n\n#ifndef _PTRDIFF_T_DECLARED\ntypedef\t__ptrdiff_t\tptrdiff_t;\n#define\t_PTRDIFF_T_DECLARED\n#endif\n\n#define\toffsetof(type, field)\t__offsetof(type, field)\n\n#endif /* !_SYS_STDDEF_H_ */\n"
  },
  {
    "path": "freebsd-headers/sys/stdint.h",
    "content": "/*-\n * Copyright (c) 2001 Mike Barcroft <mike@FreeBSD.org>\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/sys/stdint.h 221502 2011-05-05 14:45:24Z obrien $\n */\n\n#ifndef _SYS_STDINT_H_\n#define _SYS_STDINT_H_\n\n#include <sys/cdefs.h>\n#include <sys/_types.h>\n\n#include <machine/_stdint.h>\n#include <sys/_stdint.h>\n\ntypedef\t__int_least8_t\t\tint_least8_t;\ntypedef\t__int_least16_t\t\tint_least16_t;\ntypedef\t__int_least32_t\t\tint_least32_t;\ntypedef\t__int_least64_t\t\tint_least64_t;\n\ntypedef\t__uint_least8_t\t\tuint_least8_t;\ntypedef\t__uint_least16_t\tuint_least16_t;\ntypedef\t__uint_least32_t\tuint_least32_t;\ntypedef\t__uint_least64_t\tuint_least64_t;\n\ntypedef\t__int_fast8_t\t\tint_fast8_t;\ntypedef\t__int_fast16_t\t\tint_fast16_t;\ntypedef\t__int_fast32_t\t\tint_fast32_t;\ntypedef\t__int_fast64_t\t\tint_fast64_t;\n\ntypedef\t__uint_fast8_t\t\tuint_fast8_t;\ntypedef\t__uint_fast16_t\t\tuint_fast16_t;\ntypedef\t__uint_fast32_t\t\tuint_fast32_t;\ntypedef\t__uint_fast64_t\t\tuint_fast64_t;\n\n#ifndef _INTMAX_T_DECLARED\ntypedef\t__intmax_t\t\tintmax_t;\n#define\t_INTMAX_T_DECLARED\n#endif\n#ifndef _UINTMAX_T_DECLARED\ntypedef\t__uintmax_t\t\tuintmax_t;\n#define\t_UINTMAX_T_DECLARED\n#endif\n\n#endif /* !_SYS_STDINT_H_ */\n"
  },
  {
    "path": "freebsd-headers/sys/sun_disklabel.h",
    "content": "/*-\n * Copyright (c) 1992, 1993\n *\tThe Regents of the University of California.  All rights reserved.\n * Copyright (c) 2004,2005 Joerg Wunsch\n *\n * This software was developed by the Computer Systems Engineering group\n * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and\n * contributed to Berkeley.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 4. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t@(#)sun_disklabel.h\t8.1 (Berkeley) 6/11/93\n *\t$NetBSD: disklabel.h,v 1.2 1998/08/22 14:55:28 mrg Exp $\n *\n * $FreeBSD: release/9.0.0/sys/sys/sun_disklabel.h 144328 2005-03-30 09:33:10Z joerg $ \n */\n\n#ifndef _SYS_SUN_DISKLABEL_H_\n#define\t_SYS_SUN_DISKLABEL_H_\n\n/*\n * SunOS/Solaris disk label layout (partial).\n * \n * Suns disk label format contains a lot of historical baggage which we \n * ignore entirely.  The structure below contains the relevant bits and the\n * _enc/_dec functions encode/decode only these fields.\n */\n\n#define\tSUN_DKMAGIC\t55998\n#define\tSUN_NPART\t8\n#define\tSUN_RAWPART\t2\n#define\tSUN_SIZE\t512\n#define\tSUN_VTOC_VERSION 1\n#define\tSUN_VTOC_SANE\t0x600DDEEE /* SVR4-compatible VTOC is \"sane\". */\n#define\tSUN_VOLNAME_LEN\t8\n/*\n * XXX: I am actually not sure if this should be \"16 sectors\" or \"8192 bytes\".\n * XXX: Considering that Sun went to the effort of getting 512 byte compatible\n * XXX: CDROM drives produced my guess is that Sun computers stand little or\n * XXX: even no chance of running, much less booting on !=512 byte media.\n * XXX: Define this is in terms of bytes since that is easier for us.\n */\n#define\tSUN_BOOTSIZE\t8192\n\n/* partition info */\nstruct sun_dkpart {\n\tu_int32_t\tsdkp_cyloffset;\t\t/* starting cylinder */\n\tu_int32_t\tsdkp_nsectors;\t\t/* number of sectors */\n};\n\nstruct sun_vtoc_info {\n\tu_int16_t\tsvtoc_tag;\t\t/* partition tag */\n\tu_int16_t\tsvtoc_flag;\t\t/* partition flags */\n};\n\n/* known partition tag values */\n#define\tVTOC_UNASSIGNED\t0x00\n#define\tVTOC_BOOT\t0x01\n#define\tVTOC_ROOT\t0x02\n#define\tVTOC_SWAP\t0x03\n#define\tVTOC_USR\t0x04\n#define\tVTOC_BACKUP\t0x05\t/* \"c\" partition, covers entire disk */\n#define\tVTOC_STAND\t0x06\n#define\tVTOC_VAR\t0x07\n#define\tVTOC_HOME\t0x08\n#define\tVTOC_ALTSCTR\t0x09\t/* alternate sector partition */\n#define\tVTOC_CACHE\t0x0a\t/* Solaris cachefs partition */\n#define\tVTOC_VXVM_PUB\t0x0e\t/* VxVM public region */\n#define\tVTOC_VXVM_PRIV\t0x0f\t/* VxVM private region */\n\n/* VTOC partition flags */\n#define\tVTOC_UNMNT\t0x01\t/* unmountable partition */\n#define\tVTOC_RONLY\t0x10\t/* partition is read/only */\n\nstruct sun_disklabel {\n\tchar\t\tsl_text[128];\n\n\t/* SVR4 VTOC information */\n\tu_int32_t\tsl_vtoc_vers;\t\t/* == SUN_VTOC_VERSION */\n\tchar\t\tsl_vtoc_volname[SUN_VOLNAME_LEN];\n\tu_int16_t\tsl_vtoc_nparts;\t\t/* == SUN_NPART */\n\tstruct sun_vtoc_info sl_vtoc_map[SUN_NPART]; /* partition tag/flag */\n\tu_int32_t\tsl_vtoc_sane;\t\t/* == SUN_VTOC_SANE */\n\n\t/* Sun label information */\n\tu_int16_t\tsl_rpm;\t\t\t/* rotational speed */\n\tu_int16_t\tsl_pcylinders;\t\t/* number of physical cyls */\n\tu_int16_t\tsl_sparespercyl;\t/* spare sectors per cylinder */\n\tu_int16_t\tsl_interleave;\t\t/* interleave factor */\n\tu_int16_t\tsl_ncylinders;\t\t/* data cylinders */\n\tu_int16_t\tsl_acylinders;\t\t/* alternate cylinders */\n\tu_int16_t\tsl_ntracks;\t\t/* tracks per cylinder */\n\tu_int16_t\tsl_nsectors;\t\t/* sectors per track */\n\tstruct sun_dkpart sl_part[SUN_NPART];\t/* partition layout */\n\tu_int16_t\tsl_magic;\t\t/* == SUN_DKMAGIC */\n};\n\nint sunlabel_dec(void const *pp, struct sun_disklabel *sl);\nvoid sunlabel_enc(void *pp, struct sun_disklabel *sl);\n\n#endif /* _SYS_SUN_DISKLABEL_H_ */\n"
  },
  {
    "path": "freebsd-headers/sys/sx.h",
    "content": "/*-\n * Copyright (c) 2007 Attilio Rao <attilio@freebsd.org>\n * Copyright (c) 2001 Jason Evans <jasone@freebsd.org>\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice(s), this list of conditions and the following disclaimer as\n *    the first lines of this file unmodified other than the possible \n *    addition of one or more copyright notices.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice(s), this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\n * DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE LIABLE FOR ANY\n * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR\n * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH\n * DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/sys/sx.h 219819 2011-03-21 09:40:01Z jeff $\n */\n\n#ifndef\t_SYS_SX_H_\n#define\t_SYS_SX_H_\n\n#include <sys/_lock.h>\n#include <sys/_sx.h>\n\n#ifdef\t_KERNEL\n#include <sys/pcpu.h>\n#include <sys/lock_profile.h>\n#include <sys/lockstat.h>\n#include <machine/atomic.h>\n#endif\n\n/*\n * In general, the sx locks and rwlocks use very similar algorithms.\n * The main difference in the implementations is how threads are\n * blocked when a lock is unavailable.  For this, sx locks use sleep\n * queues which do not support priority propagation, and rwlocks use\n * turnstiles which do.\n *\n * The sx_lock field consists of several fields.  The low bit\n * indicates if the lock is locked with a shared or exclusive lock.  A\n * value of 0 indicates an exclusive lock, and a value of 1 indicates\n * a shared lock.  Bit 1 is a boolean indicating if there are any\n * threads waiting for a shared lock.  Bit 2 is a boolean indicating\n * if there are any threads waiting for an exclusive lock.  Bit 3 is a\n * boolean indicating if an exclusive lock is recursively held.  The\n * rest of the variable's definition is dependent on the value of the\n * first bit.  For an exclusive lock, it is a pointer to the thread\n * holding the lock, similar to the mtx_lock field of mutexes.  For\n * shared locks, it is a count of read locks that are held.\n *\n * When the lock is not locked by any thread, it is encoded as a\n * shared lock with zero waiters.\n */\n\n#define\tSX_LOCK_SHARED\t\t\t0x01\n#define\tSX_LOCK_SHARED_WAITERS\t\t0x02\n#define\tSX_LOCK_EXCLUSIVE_WAITERS\t0x04\n#define\tSX_LOCK_RECURSED\t\t0x08\n#define\tSX_LOCK_FLAGMASK\t\t\t\t\t\t\\\n\t(SX_LOCK_SHARED | SX_LOCK_SHARED_WAITERS |\t\t\t\\\n\tSX_LOCK_EXCLUSIVE_WAITERS | SX_LOCK_RECURSED)\n\n#define\tSX_OWNER(x)\t\t\t((x) & ~SX_LOCK_FLAGMASK)\n#define\tSX_SHARERS_SHIFT\t\t4\n#define\tSX_SHARERS(x)\t\t\t(SX_OWNER(x) >> SX_SHARERS_SHIFT)\n#define\tSX_SHARERS_LOCK(x)\t\t\t\t\t\t\\\n\t((x) << SX_SHARERS_SHIFT | SX_LOCK_SHARED)\n#define\tSX_ONE_SHARER\t\t\t(1 << SX_SHARERS_SHIFT)\n\n#define\tSX_LOCK_UNLOCKED\t\tSX_SHARERS_LOCK(0)\n#define\tSX_LOCK_DESTROYED\t\t\t\t\t\t\\\n\t(SX_LOCK_SHARED_WAITERS | SX_LOCK_EXCLUSIVE_WAITERS)\n\n#ifdef _KERNEL\n\n/*\n * Function prototipes.  Routines that start with an underscore are not part\n * of the public interface and are wrappered with a macro.\n */\nvoid\tsx_sysinit(void *arg);\n#define\tsx_init(sx, desc)\tsx_init_flags((sx), (desc), 0)\nvoid\tsx_init_flags(struct sx *sx, const char *description, int opts);\nvoid\tsx_destroy(struct sx *sx);\nint\t_sx_slock(struct sx *sx, int opts, const char *file, int line);\nint\t_sx_xlock(struct sx *sx, int opts, const char *file, int line);\nint\t_sx_try_slock(struct sx *sx, const char *file, int line);\nint\t_sx_try_xlock(struct sx *sx, const char *file, int line);\nvoid\t_sx_sunlock(struct sx *sx, const char *file, int line);\nvoid\t_sx_xunlock(struct sx *sx, const char *file, int line);\nint\t_sx_try_upgrade(struct sx *sx, const char *file, int line);\nvoid\t_sx_downgrade(struct sx *sx, const char *file, int line);\nint\t_sx_xlock_hard(struct sx *sx, uintptr_t tid, int opts,\n\t    const char *file, int line);\nint\t_sx_slock_hard(struct sx *sx, int opts, const char *file, int line);\nvoid\t_sx_xunlock_hard(struct sx *sx, uintptr_t tid, const char *file, int\n\t    line);\nvoid\t_sx_sunlock_hard(struct sx *sx, const char *file, int line);\n#if defined(INVARIANTS) || defined(INVARIANT_SUPPORT)\nvoid\t_sx_assert(struct sx *sx, int what, const char *file, int line);\n#endif\n#ifdef DDB\nint\tsx_chain(struct thread *td, struct thread **ownerp);\n#endif\n\nstruct sx_args {\n\tstruct sx \t*sa_sx;\n\tconst char\t*sa_desc;\n\tint\t\tsa_flags;\n};\n\n#define\tSX_SYSINIT_FLAGS(name, sxa, desc, flags)\t\t\t\\\n\tstatic struct sx_args name##_args = {\t\t\t\t\\\n\t\t(sxa),\t\t\t\t\t\t\t\\\n\t\t(desc),\t\t\t\t\t\t\t\\\n\t\t(flags)\t\t\t\t\t\t\t\\\n\t};\t\t\t\t\t\t\t\t\\\n\tSYSINIT(name##_sx_sysinit, SI_SUB_LOCK, SI_ORDER_MIDDLE,\t\\\n\t    sx_sysinit, &name##_args);\t\t\t\t\t\\\n\tSYSUNINIT(name##_sx_sysuninit, SI_SUB_LOCK, SI_ORDER_MIDDLE,\t\\\n\t    sx_destroy, (sxa))\n\n#define\tSX_SYSINIT(name, sxa, desc)\tSX_SYSINIT_FLAGS(name, sxa, desc, 0)\n\n/*\n * Full lock operations that are suitable to be inlined in non-debug kernels.\n * If the lock can't be acquired or released trivially then the work is\n * deferred to 'tougher' functions.\n */\n\n/* Acquire an exclusive lock. */\nstatic __inline int\n__sx_xlock(struct sx *sx, struct thread *td, int opts, const char *file,\n    int line)\n{\n\tuintptr_t tid = (uintptr_t)td;\n\tint error = 0;\n\n\tif (!atomic_cmpset_acq_ptr(&sx->sx_lock, SX_LOCK_UNLOCKED, tid))\n\t\terror = _sx_xlock_hard(sx, tid, opts, file, line);\n\telse \n\t\tLOCKSTAT_PROFILE_OBTAIN_LOCK_SUCCESS(LS_SX_XLOCK_ACQUIRE,\n\t\t    sx, 0, 0, file, line);\n\n\treturn (error);\n}\n\n/* Release an exclusive lock. */\nstatic __inline void\n__sx_xunlock(struct sx *sx, struct thread *td, const char *file, int line)\n{\n\tuintptr_t tid = (uintptr_t)td;\n\n\tif (!atomic_cmpset_rel_ptr(&sx->sx_lock, tid, SX_LOCK_UNLOCKED))\n\t\t_sx_xunlock_hard(sx, tid, file, line);\n}\n\n/* Acquire a shared lock. */\nstatic __inline int\n__sx_slock(struct sx *sx, int opts, const char *file, int line)\n{\n\tuintptr_t x = sx->sx_lock;\n\tint error = 0;\n\n\tif (!(x & SX_LOCK_SHARED) ||\n\t    !atomic_cmpset_acq_ptr(&sx->sx_lock, x, x + SX_ONE_SHARER))\n\t\terror = _sx_slock_hard(sx, opts, file, line);\n\telse\n\t\tLOCKSTAT_PROFILE_OBTAIN_LOCK_SUCCESS(LS_SX_SLOCK_ACQUIRE, sx, 0,\n\t\t    0, file, line);\n\n\treturn (error);\n}\n\n/*\n * Release a shared lock.  We can just drop a single shared lock so\n * long as we aren't trying to drop the last shared lock when other\n * threads are waiting for an exclusive lock.  This takes advantage of\n * the fact that an unlocked lock is encoded as a shared lock with a\n * count of 0.\n */\nstatic __inline void\n__sx_sunlock(struct sx *sx, const char *file, int line)\n{\n\tuintptr_t x = sx->sx_lock;\n\n\tif (x == (SX_SHARERS_LOCK(1) | SX_LOCK_EXCLUSIVE_WAITERS) ||\n\t    !atomic_cmpset_rel_ptr(&sx->sx_lock, x, x - SX_ONE_SHARER))\n\t\t_sx_sunlock_hard(sx, file, line);\n}\n\n/*\n * Public interface for lock operations.\n */\n#ifndef LOCK_DEBUG\n#error\t\"LOCK_DEBUG not defined, include <sys/lock.h> before <sys/sx.h>\"\n#endif\n#if\t(LOCK_DEBUG > 0) || defined(SX_NOINLINE)\n#define\tsx_xlock(sx)\t\t(void)_sx_xlock((sx), 0, LOCK_FILE, LOCK_LINE)\n#define\tsx_xlock_sig(sx)\t\t\t\t\t\t\\\n\t_sx_xlock((sx), SX_INTERRUPTIBLE, LOCK_FILE, LOCK_LINE)\n#define\tsx_xunlock(sx)\t\t_sx_xunlock((sx), LOCK_FILE, LOCK_LINE)\n#define\tsx_slock(sx)\t\t(void)_sx_slock((sx), 0, LOCK_FILE, LOCK_LINE)\n#define\tsx_slock_sig(sx)\t\t\t\t\t\t\\\n\t_sx_slock((sx), SX_INTERRUPTIBLE, LOCK_FILE, LOCK_LINE)\n#define\tsx_sunlock(sx)\t\t_sx_sunlock((sx), LOCK_FILE, LOCK_LINE)\n#else\n#define\tsx_xlock(sx)\t\t\t\t\t\t\t\\\n\t(void)__sx_xlock((sx), curthread, 0, LOCK_FILE, LOCK_LINE)\n#define\tsx_xlock_sig(sx)\t\t\t\t\t\t\\\n\t__sx_xlock((sx), curthread, SX_INTERRUPTIBLE, LOCK_FILE, LOCK_LINE)\n#define\tsx_xunlock(sx)\t\t\t\t\t\t\t\\\n\t__sx_xunlock((sx), curthread, LOCK_FILE, LOCK_LINE)\n#define\tsx_slock(sx)\t\t(void)__sx_slock((sx), 0, LOCK_FILE, LOCK_LINE)\n#define\tsx_slock_sig(sx)\t\t\t\t\t\t\\\n\t__sx_slock((sx), SX_INTERRUPTIBLE, LOCK_FILE, LOCK_LINE)\n#define\tsx_sunlock(sx)\t\t__sx_sunlock((sx), LOCK_FILE, LOCK_LINE)\n#endif\t/* LOCK_DEBUG > 0 || SX_NOINLINE */\n#define\tsx_try_slock(sx)\t_sx_try_slock((sx), LOCK_FILE, LOCK_LINE)\n#define\tsx_try_xlock(sx)\t_sx_try_xlock((sx), LOCK_FILE, LOCK_LINE)\n#define\tsx_try_upgrade(sx)\t_sx_try_upgrade((sx), LOCK_FILE, LOCK_LINE)\n#define\tsx_downgrade(sx)\t_sx_downgrade((sx), LOCK_FILE, LOCK_LINE)\n\n/*\n * Return a pointer to the owning thread if the lock is exclusively\n * locked.\n */\n#define\tsx_xholder(sx)\t\t\t\t\t\t\t\\\n\t((sx)->sx_lock & SX_LOCK_SHARED ? NULL :\t\t\t\\\n\t(struct thread *)SX_OWNER((sx)->sx_lock))\n\n#define\tsx_xlocked(sx)\t\t\t\t\t\t\t\\\n\t(((sx)->sx_lock & ~(SX_LOCK_FLAGMASK & ~SX_LOCK_SHARED)) ==\t\\\n\t    (uintptr_t)curthread)\n\n#define\tsx_unlock(sx) do {\t\t\t\t\t\t\\\n\tif (sx_xlocked(sx))\t\t\t\t\t\t\\\n\t\tsx_xunlock(sx);\t\t\t\t\t\t\\\n\telse\t\t\t\t\t\t\t\t\\\n\t\tsx_sunlock(sx);\t\t\t\t\t\t\\\n} while (0)\n\n#define\tsx_sleep(chan, sx, pri, wmesg, timo)\t\t\t\t\\\n\t_sleep((chan), &(sx)->lock_object, (pri), (wmesg), (timo))\n\n/*\n * Options passed to sx_init_flags().\n */\n#define\tSX_DUPOK\t\t0x01\n#define\tSX_NOPROFILE\t\t0x02\n#define\tSX_NOWITNESS\t\t0x04\n#define\tSX_QUIET\t\t0x08\n#define\tSX_NOADAPTIVE\t\t0x10\n#define\tSX_RECURSE\t\t0x20\n\n/*\n * Options passed to sx_*lock_hard().\n */\n#define\tSX_INTERRUPTIBLE\t0x40\n\n#if defined(INVARIANTS) || defined(INVARIANT_SUPPORT)\n#define\tSA_LOCKED\t\tLA_LOCKED\n#define\tSA_SLOCKED\t\tLA_SLOCKED\n#define\tSA_XLOCKED\t\tLA_XLOCKED\n#define\tSA_UNLOCKED\t\tLA_UNLOCKED\n#define\tSA_RECURSED\t\tLA_RECURSED\n#define\tSA_NOTRECURSED\t\tLA_NOTRECURSED\n\n/* Backwards compatability. */\n#define\tSX_LOCKED\t\tLA_LOCKED\n#define\tSX_SLOCKED\t\tLA_SLOCKED\n#define\tSX_XLOCKED\t\tLA_XLOCKED\n#define\tSX_UNLOCKED\t\tLA_UNLOCKED\n#define\tSX_RECURSED\t\tLA_RECURSED\n#define\tSX_NOTRECURSED\t\tLA_NOTRECURSED\n#endif\n\n#ifdef INVARIANTS\n#define\tsx_assert(sx, what)\t_sx_assert((sx), (what), LOCK_FILE, LOCK_LINE)\n#else\n#define\tsx_assert(sx, what)\t(void)0\n#endif\n\n#endif /* _KERNEL */\n\n#endif /* !_SYS_SX_H_ */\n"
  },
  {
    "path": "freebsd-headers/sys/syscall.h",
    "content": "/*\n * System call numbers.\n *\n * DO NOT EDIT-- this file is automatically generated.\n * $FreeBSD: release/9.0.0/sys/sys/syscall.h 224988 2011-08-18 23:08:52Z jonathan $\n * created from FreeBSD: head/sys/kern/syscalls.master 224987 2011-08-18 22:51:30Z jonathan \n */\n\n#define\tSYS_syscall\t0\n#define\tSYS_exit\t1\n#define\tSYS_fork\t2\n#define\tSYS_read\t3\n#define\tSYS_write\t4\n#define\tSYS_open\t5\n#define\tSYS_close\t6\n#define\tSYS_wait4\t7\n\t\t\t\t/* 8 is old creat */\n#define\tSYS_link\t9\n#define\tSYS_unlink\t10\n\t\t\t\t/* 11 is obsolete execv */\n#define\tSYS_chdir\t12\n#define\tSYS_fchdir\t13\n#define\tSYS_mknod\t14\n#define\tSYS_chmod\t15\n#define\tSYS_chown\t16\n#define\tSYS_break\t17\n#define\tSYS_freebsd4_getfsstat\t18\n\t\t\t\t/* 19 is old lseek */\n#define\tSYS_getpid\t20\n#define\tSYS_mount\t21\n#define\tSYS_unmount\t22\n#define\tSYS_setuid\t23\n#define\tSYS_getuid\t24\n#define\tSYS_geteuid\t25\n#define\tSYS_ptrace\t26\n#define\tSYS_recvmsg\t27\n#define\tSYS_sendmsg\t28\n#define\tSYS_recvfrom\t29\n#define\tSYS_accept\t30\n#define\tSYS_getpeername\t31\n#define\tSYS_getsockname\t32\n#define\tSYS_access\t33\n#define\tSYS_chflags\t34\n#define\tSYS_fchflags\t35\n#define\tSYS_sync\t36\n#define\tSYS_kill\t37\n\t\t\t\t/* 38 is old stat */\n#define\tSYS_getppid\t39\n\t\t\t\t/* 40 is old lstat */\n#define\tSYS_dup\t41\n#define\tSYS_pipe\t42\n#define\tSYS_getegid\t43\n#define\tSYS_profil\t44\n#define\tSYS_ktrace\t45\n\t\t\t\t/* 46 is old sigaction */\n#define\tSYS_getgid\t47\n\t\t\t\t/* 48 is old sigprocmask */\n#define\tSYS_getlogin\t49\n#define\tSYS_setlogin\t50\n#define\tSYS_acct\t51\n\t\t\t\t/* 52 is old sigpending */\n#define\tSYS_sigaltstack\t53\n#define\tSYS_ioctl\t54\n#define\tSYS_reboot\t55\n#define\tSYS_revoke\t56\n#define\tSYS_symlink\t57\n#define\tSYS_readlink\t58\n#define\tSYS_execve\t59\n#define\tSYS_umask\t60\n#define\tSYS_chroot\t61\n\t\t\t\t/* 62 is old fstat */\n\t\t\t\t/* 63 is old getkerninfo */\n\t\t\t\t/* 64 is old getpagesize */\n#define\tSYS_msync\t65\n#define\tSYS_vfork\t66\n\t\t\t\t/* 67 is obsolete vread */\n\t\t\t\t/* 68 is obsolete vwrite */\n#define\tSYS_sbrk\t69\n#define\tSYS_sstk\t70\n\t\t\t\t/* 71 is old mmap */\n#define\tSYS_vadvise\t72\n#define\tSYS_munmap\t73\n#define\tSYS_mprotect\t74\n#define\tSYS_madvise\t75\n\t\t\t\t/* 76 is obsolete vhangup */\n\t\t\t\t/* 77 is obsolete vlimit */\n#define\tSYS_mincore\t78\n#define\tSYS_getgroups\t79\n#define\tSYS_setgroups\t80\n#define\tSYS_getpgrp\t81\n#define\tSYS_setpgid\t82\n#define\tSYS_setitimer\t83\n\t\t\t\t/* 84 is old wait */\n#define\tSYS_swapon\t85\n#define\tSYS_getitimer\t86\n\t\t\t\t/* 87 is old gethostname */\n\t\t\t\t/* 88 is old sethostname */\n#define\tSYS_getdtablesize\t89\n#define\tSYS_dup2\t90\n#define\tSYS_fcntl\t92\n#define\tSYS_select\t93\n#define\tSYS_fsync\t95\n#define\tSYS_setpriority\t96\n#define\tSYS_socket\t97\n#define\tSYS_connect\t98\n\t\t\t\t/* 99 is old accept */\n#define\tSYS_getpriority\t100\n\t\t\t\t/* 101 is old send */\n\t\t\t\t/* 102 is old recv */\n\t\t\t\t/* 103 is old sigreturn */\n#define\tSYS_bind\t104\n#define\tSYS_setsockopt\t105\n#define\tSYS_listen\t106\n\t\t\t\t/* 107 is obsolete vtimes */\n\t\t\t\t/* 108 is old sigvec */\n\t\t\t\t/* 109 is old sigblock */\n\t\t\t\t/* 110 is old sigsetmask */\n\t\t\t\t/* 111 is old sigsuspend */\n\t\t\t\t/* 112 is old sigstack */\n\t\t\t\t/* 113 is old recvmsg */\n\t\t\t\t/* 114 is old sendmsg */\n\t\t\t\t/* 115 is obsolete vtrace */\n#define\tSYS_gettimeofday\t116\n#define\tSYS_getrusage\t117\n#define\tSYS_getsockopt\t118\n#define\tSYS_readv\t120\n#define\tSYS_writev\t121\n#define\tSYS_settimeofday\t122\n#define\tSYS_fchown\t123\n#define\tSYS_fchmod\t124\n\t\t\t\t/* 125 is old recvfrom */\n#define\tSYS_setreuid\t126\n#define\tSYS_setregid\t127\n#define\tSYS_rename\t128\n\t\t\t\t/* 129 is old truncate */\n\t\t\t\t/* 130 is old ftruncate */\n#define\tSYS_flock\t131\n#define\tSYS_mkfifo\t132\n#define\tSYS_sendto\t133\n#define\tSYS_shutdown\t134\n#define\tSYS_socketpair\t135\n#define\tSYS_mkdir\t136\n#define\tSYS_rmdir\t137\n#define\tSYS_utimes\t138\n\t\t\t\t/* 139 is obsolete 4.2 sigreturn */\n#define\tSYS_adjtime\t140\n\t\t\t\t/* 141 is old getpeername */\n\t\t\t\t/* 142 is old gethostid */\n\t\t\t\t/* 143 is old sethostid */\n\t\t\t\t/* 144 is old getrlimit */\n\t\t\t\t/* 145 is old setrlimit */\n\t\t\t\t/* 146 is old killpg */\n#define\tSYS_setsid\t147\n#define\tSYS_quotactl\t148\n\t\t\t\t/* 149 is old quota */\n\t\t\t\t/* 150 is old getsockname */\n#define\tSYS_nlm_syscall\t154\n#define\tSYS_nfssvc\t155\n\t\t\t\t/* 156 is old getdirentries */\n#define\tSYS_freebsd4_statfs\t157\n#define\tSYS_freebsd4_fstatfs\t158\n#define\tSYS_lgetfh\t160\n#define\tSYS_getfh\t161\n#define\tSYS_freebsd4_getdomainname\t162\n#define\tSYS_freebsd4_setdomainname\t163\n#define\tSYS_freebsd4_uname\t164\n#define\tSYS_sysarch\t165\n#define\tSYS_rtprio\t166\n#define\tSYS_semsys\t169\n#define\tSYS_msgsys\t170\n#define\tSYS_shmsys\t171\n#define\tSYS_freebsd6_pread\t173\n#define\tSYS_freebsd6_pwrite\t174\n#define\tSYS_setfib\t175\n#define\tSYS_ntp_adjtime\t176\n#define\tSYS_setgid\t181\n#define\tSYS_setegid\t182\n#define\tSYS_seteuid\t183\n#define\tSYS_stat\t188\n#define\tSYS_fstat\t189\n#define\tSYS_lstat\t190\n#define\tSYS_pathconf\t191\n#define\tSYS_fpathconf\t192\n#define\tSYS_getrlimit\t194\n#define\tSYS_setrlimit\t195\n#define\tSYS_getdirentries\t196\n#define\tSYS_freebsd6_mmap\t197\n#define\tSYS___syscall\t198\n#define\tSYS_freebsd6_lseek\t199\n#define\tSYS_freebsd6_truncate\t200\n#define\tSYS_freebsd6_ftruncate\t201\n#define\tSYS___sysctl\t202\n#define\tSYS_mlock\t203\n#define\tSYS_munlock\t204\n#define\tSYS_undelete\t205\n#define\tSYS_futimes\t206\n#define\tSYS_getpgid\t207\n#define\tSYS_poll\t209\n#define\tSYS_freebsd7___semctl\t220\n#define\tSYS_semget\t221\n#define\tSYS_semop\t222\n#define\tSYS_freebsd7_msgctl\t224\n#define\tSYS_msgget\t225\n#define\tSYS_msgsnd\t226\n#define\tSYS_msgrcv\t227\n#define\tSYS_shmat\t228\n#define\tSYS_freebsd7_shmctl\t229\n#define\tSYS_shmdt\t230\n#define\tSYS_shmget\t231\n#define\tSYS_clock_gettime\t232\n#define\tSYS_clock_settime\t233\n#define\tSYS_clock_getres\t234\n#define\tSYS_ktimer_create\t235\n#define\tSYS_ktimer_delete\t236\n#define\tSYS_ktimer_settime\t237\n#define\tSYS_ktimer_gettime\t238\n#define\tSYS_ktimer_getoverrun\t239\n#define\tSYS_nanosleep\t240\n#define\tSYS_ntp_gettime\t248\n#define\tSYS_minherit\t250\n#define\tSYS_rfork\t251\n#define\tSYS_openbsd_poll\t252\n#define\tSYS_issetugid\t253\n#define\tSYS_lchown\t254\n#define\tSYS_aio_read\t255\n#define\tSYS_aio_write\t256\n#define\tSYS_lio_listio\t257\n#define\tSYS_getdents\t272\n#define\tSYS_lchmod\t274\n#define\tSYS_netbsd_lchown\t275\n#define\tSYS_lutimes\t276\n#define\tSYS_netbsd_msync\t277\n#define\tSYS_nstat\t278\n#define\tSYS_nfstat\t279\n#define\tSYS_nlstat\t280\n#define\tSYS_preadv\t289\n#define\tSYS_pwritev\t290\n#define\tSYS_freebsd4_fhstatfs\t297\n#define\tSYS_fhopen\t298\n#define\tSYS_fhstat\t299\n#define\tSYS_modnext\t300\n#define\tSYS_modstat\t301\n#define\tSYS_modfnext\t302\n#define\tSYS_modfind\t303\n#define\tSYS_kldload\t304\n#define\tSYS_kldunload\t305\n#define\tSYS_kldfind\t306\n#define\tSYS_kldnext\t307\n#define\tSYS_kldstat\t308\n#define\tSYS_kldfirstmod\t309\n#define\tSYS_getsid\t310\n#define\tSYS_setresuid\t311\n#define\tSYS_setresgid\t312\n\t\t\t\t/* 313 is obsolete signanosleep */\n#define\tSYS_aio_return\t314\n#define\tSYS_aio_suspend\t315\n#define\tSYS_aio_cancel\t316\n#define\tSYS_aio_error\t317\n#define\tSYS_oaio_read\t318\n#define\tSYS_oaio_write\t319\n#define\tSYS_olio_listio\t320\n#define\tSYS_yield\t321\n\t\t\t\t/* 322 is obsolete thr_sleep */\n\t\t\t\t/* 323 is obsolete thr_wakeup */\n#define\tSYS_mlockall\t324\n#define\tSYS_munlockall\t325\n#define\tSYS___getcwd\t326\n#define\tSYS_sched_setparam\t327\n#define\tSYS_sched_getparam\t328\n#define\tSYS_sched_setscheduler\t329\n#define\tSYS_sched_getscheduler\t330\n#define\tSYS_sched_yield\t331\n#define\tSYS_sched_get_priority_max\t332\n#define\tSYS_sched_get_priority_min\t333\n#define\tSYS_sched_rr_get_interval\t334\n#define\tSYS_utrace\t335\n#define\tSYS_freebsd4_sendfile\t336\n#define\tSYS_kldsym\t337\n#define\tSYS_jail\t338\n#define\tSYS_nnpfs_syscall\t339\n#define\tSYS_sigprocmask\t340\n#define\tSYS_sigsuspend\t341\n#define\tSYS_freebsd4_sigaction\t342\n#define\tSYS_sigpending\t343\n#define\tSYS_freebsd4_sigreturn\t344\n#define\tSYS_sigtimedwait\t345\n#define\tSYS_sigwaitinfo\t346\n#define\tSYS___acl_get_file\t347\n#define\tSYS___acl_set_file\t348\n#define\tSYS___acl_get_fd\t349\n#define\tSYS___acl_set_fd\t350\n#define\tSYS___acl_delete_file\t351\n#define\tSYS___acl_delete_fd\t352\n#define\tSYS___acl_aclcheck_file\t353\n#define\tSYS___acl_aclcheck_fd\t354\n#define\tSYS_extattrctl\t355\n#define\tSYS_extattr_set_file\t356\n#define\tSYS_extattr_get_file\t357\n#define\tSYS_extattr_delete_file\t358\n#define\tSYS_aio_waitcomplete\t359\n#define\tSYS_getresuid\t360\n#define\tSYS_getresgid\t361\n#define\tSYS_kqueue\t362\n#define\tSYS_kevent\t363\n#define\tSYS_extattr_set_fd\t371\n#define\tSYS_extattr_get_fd\t372\n#define\tSYS_extattr_delete_fd\t373\n#define\tSYS___setugid\t374\n#define\tSYS_eaccess\t376\n#define\tSYS_afs3_syscall\t377\n#define\tSYS_nmount\t378\n#define\tSYS___mac_get_proc\t384\n#define\tSYS___mac_set_proc\t385\n#define\tSYS___mac_get_fd\t386\n#define\tSYS___mac_get_file\t387\n#define\tSYS___mac_set_fd\t388\n#define\tSYS___mac_set_file\t389\n#define\tSYS_kenv\t390\n#define\tSYS_lchflags\t391\n#define\tSYS_uuidgen\t392\n#define\tSYS_sendfile\t393\n#define\tSYS_mac_syscall\t394\n#define\tSYS_getfsstat\t395\n#define\tSYS_statfs\t396\n#define\tSYS_fstatfs\t397\n#define\tSYS_fhstatfs\t398\n#define\tSYS_ksem_close\t400\n#define\tSYS_ksem_post\t401\n#define\tSYS_ksem_wait\t402\n#define\tSYS_ksem_trywait\t403\n#define\tSYS_ksem_init\t404\n#define\tSYS_ksem_open\t405\n#define\tSYS_ksem_unlink\t406\n#define\tSYS_ksem_getvalue\t407\n#define\tSYS_ksem_destroy\t408\n#define\tSYS___mac_get_pid\t409\n#define\tSYS___mac_get_link\t410\n#define\tSYS___mac_set_link\t411\n#define\tSYS_extattr_set_link\t412\n#define\tSYS_extattr_get_link\t413\n#define\tSYS_extattr_delete_link\t414\n#define\tSYS___mac_execve\t415\n#define\tSYS_sigaction\t416\n#define\tSYS_sigreturn\t417\n#define\tSYS_getcontext\t421\n#define\tSYS_setcontext\t422\n#define\tSYS_swapcontext\t423\n#define\tSYS_swapoff\t424\n#define\tSYS___acl_get_link\t425\n#define\tSYS___acl_set_link\t426\n#define\tSYS___acl_delete_link\t427\n#define\tSYS___acl_aclcheck_link\t428\n#define\tSYS_sigwait\t429\n#define\tSYS_thr_create\t430\n#define\tSYS_thr_exit\t431\n#define\tSYS_thr_self\t432\n#define\tSYS_thr_kill\t433\n#define\tSYS__umtx_lock\t434\n#define\tSYS__umtx_unlock\t435\n#define\tSYS_jail_attach\t436\n#define\tSYS_extattr_list_fd\t437\n#define\tSYS_extattr_list_file\t438\n#define\tSYS_extattr_list_link\t439\n#define\tSYS_ksem_timedwait\t441\n#define\tSYS_thr_suspend\t442\n#define\tSYS_thr_wake\t443\n#define\tSYS_kldunloadf\t444\n#define\tSYS_audit\t445\n#define\tSYS_auditon\t446\n#define\tSYS_getauid\t447\n#define\tSYS_setauid\t448\n#define\tSYS_getaudit\t449\n#define\tSYS_setaudit\t450\n#define\tSYS_getaudit_addr\t451\n#define\tSYS_setaudit_addr\t452\n#define\tSYS_auditctl\t453\n#define\tSYS__umtx_op\t454\n#define\tSYS_thr_new\t455\n#define\tSYS_sigqueue\t456\n#define\tSYS_kmq_open\t457\n#define\tSYS_kmq_setattr\t458\n#define\tSYS_kmq_timedreceive\t459\n#define\tSYS_kmq_timedsend\t460\n#define\tSYS_kmq_notify\t461\n#define\tSYS_kmq_unlink\t462\n#define\tSYS_abort2\t463\n#define\tSYS_thr_set_name\t464\n#define\tSYS_aio_fsync\t465\n#define\tSYS_rtprio_thread\t466\n#define\tSYS_sctp_peeloff\t471\n#define\tSYS_sctp_generic_sendmsg\t472\n#define\tSYS_sctp_generic_sendmsg_iov\t473\n#define\tSYS_sctp_generic_recvmsg\t474\n#define\tSYS_pread\t475\n#define\tSYS_pwrite\t476\n#define\tSYS_mmap\t477\n#define\tSYS_lseek\t478\n#define\tSYS_truncate\t479\n#define\tSYS_ftruncate\t480\n#define\tSYS_thr_kill2\t481\n#define\tSYS_shm_open\t482\n#define\tSYS_shm_unlink\t483\n#define\tSYS_cpuset\t484\n#define\tSYS_cpuset_setid\t485\n#define\tSYS_cpuset_getid\t486\n#define\tSYS_cpuset_getaffinity\t487\n#define\tSYS_cpuset_setaffinity\t488\n#define\tSYS_faccessat\t489\n#define\tSYS_fchmodat\t490\n#define\tSYS_fchownat\t491\n#define\tSYS_fexecve\t492\n#define\tSYS_fstatat\t493\n#define\tSYS_futimesat\t494\n#define\tSYS_linkat\t495\n#define\tSYS_mkdirat\t496\n#define\tSYS_mkfifoat\t497\n#define\tSYS_mknodat\t498\n#define\tSYS_openat\t499\n#define\tSYS_readlinkat\t500\n#define\tSYS_renameat\t501\n#define\tSYS_symlinkat\t502\n#define\tSYS_unlinkat\t503\n#define\tSYS_posix_openpt\t504\n#define\tSYS_gssd_syscall\t505\n#define\tSYS_jail_get\t506\n#define\tSYS_jail_set\t507\n#define\tSYS_jail_remove\t508\n#define\tSYS_closefrom\t509\n#define\tSYS___semctl\t510\n#define\tSYS_msgctl\t511\n#define\tSYS_shmctl\t512\n#define\tSYS_lpathconf\t513\n#define\tSYS_cap_new\t514\n#define\tSYS_cap_getrights\t515\n#define\tSYS_cap_enter\t516\n#define\tSYS_cap_getmode\t517\n#define\tSYS_pdfork\t518\n#define\tSYS_pdkill\t519\n#define\tSYS_pdgetpid\t520\n#define\tSYS_pselect\t522\n#define\tSYS_getloginclass\t523\n#define\tSYS_setloginclass\t524\n#define\tSYS_rctl_get_racct\t525\n#define\tSYS_rctl_get_rules\t526\n#define\tSYS_rctl_get_limits\t527\n#define\tSYS_rctl_add_rule\t528\n#define\tSYS_rctl_remove_rule\t529\n#define\tSYS_posix_fallocate\t530\n#define\tSYS_MAXSYSCALL\t532\n"
  },
  {
    "path": "freebsd-headers/sys/syscallsubr.h",
    "content": "/*-\n * Copyright (c) 2002 Ian Dowse.  All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/sys/syscallsubr.h 220238 2011-04-01 11:16:29Z kib $\n */\n\n#ifndef _SYS_SYSCALLSUBR_H_\n#define _SYS_SYSCALLSUBR_H_\n\n#include <sys/signal.h>\n#include <sys/uio.h>\n#include <sys/socket.h>\n#include <sys/mac.h>\n#include <sys/mount.h>\n\nstruct file;\nstruct itimerval;\nstruct image_args;\nstruct jail;\nstruct mbuf;\nstruct msghdr;\nstruct msqid_ds;\nstruct rlimit;\nstruct rusage;\nunion semun;\nstruct sockaddr;\nstruct stat;\nstruct kevent;\nstruct kevent_copyops;\nstruct kld_file_stat;\nstruct ksiginfo;\nstruct sendfile_args;\nstruct thr_param;\nstruct ogetdirentries_args;\n\nint\tkern___getcwd(struct thread *td, u_char *buf, enum uio_seg bufseg,\n\t    u_int buflen);\nint\tkern_accept(struct thread *td, int s, struct sockaddr **name,\n\t    socklen_t *namelen, struct file **fp);\nint\tkern_access(struct thread *td, char *path, enum uio_seg pathseg,\n\t    int flags);\nint\tkern_accessat(struct thread *td, int fd, char *path,\n\t    enum uio_seg pathseg, int flags, int mode);\nint\tkern_adjtime(struct thread *td, struct timeval *delta,\n\t    struct timeval *olddelta);\nint\tkern_alternate_path(struct thread *td, const char *prefix, const char *path,\n\t    enum uio_seg pathseg, char **pathbuf, int create, int dirfd);\nint\tkern_bind(struct thread *td, int fd, struct sockaddr *sa);\nint\tkern_chdir(struct thread *td, char *path, enum uio_seg pathseg);\nint\tkern_chmod(struct thread *td, char *path, enum uio_seg pathseg,\n\t    int mode);\nint\tkern_chown(struct thread *td, char *path, enum uio_seg pathseg, int uid,\n\t    int gid);\nint\tkern_clock_getres(struct thread *td, clockid_t clock_id,\n\t    struct timespec *ts);\nint\tkern_clock_gettime(struct thread *td, clockid_t clock_id,\n\t    struct timespec *ats);\nint\tkern_clock_settime(struct thread *td, clockid_t clock_id,\n\t    struct timespec *ats);\nint\tkern_close(struct thread *td, int fd);\nint\tkern_connect(struct thread *td, int fd, struct sockaddr *sa);\nint\tkern_eaccess(struct thread *td, char *path, enum uio_seg pathseg,\n\t    int flags);\nint\tkern_execve(struct thread *td, struct image_args *args,\n\t    struct mac *mac_p);\nint\tkern_fchmodat(struct thread *td, int fd, char *path,\n\t    enum uio_seg pathseg, mode_t mode, int flag);\nint\tkern_fchownat(struct thread *td, int fd, char *path,\n\t    enum uio_seg pathseg, int uid, int gid, int flag);\nint\tkern_fcntl(struct thread *td, int fd, int cmd, intptr_t arg);\nint\tkern_fhstatfs(struct thread *td, fhandle_t fh, struct statfs *buf);\nint\tkern_fstat(struct thread *td, int fd, struct stat *sbp);\nint\tkern_fstatfs(struct thread *td, int fd, struct statfs *buf);\nint\tkern_ftruncate(struct thread *td, int fd, off_t length);\nint\tkern_futimes(struct thread *td, int fd, struct timeval *tptr,\n\t    enum uio_seg tptrseg);\nint\tkern_getdirentries(struct thread *td, int fd, char *buf, u_int count,\n\t    long *basep);\nint\tkern_getfsstat(struct thread *td, struct statfs **buf, size_t bufsize,\n\t    enum uio_seg bufseg, int flags);\nint\tkern_getgroups(struct thread *td, u_int *ngrp, gid_t *groups);\nint\tkern_getitimer(struct thread *, u_int, struct itimerval *);\nint\tkern_getpeername(struct thread *td, int fd, struct sockaddr **sa,\n\t    socklen_t *alen);\nint\tkern_getrusage(struct thread *td, int who, struct rusage *rup);\nint\tkern_getsockname(struct thread *td, int fd, struct sockaddr **sa,\n\t    socklen_t *alen);\nint\tkern_getsockopt(struct thread *td, int s, int level, int name,\n\t    void *optval, enum uio_seg valseg, socklen_t *valsize);\nint\tkern_ioctl(struct thread *td, int fd, u_long com, caddr_t data);\nint\tkern_jail(struct thread *td, struct jail *j);\nint\tkern_jail_get(struct thread *td, struct uio *options, int flags);\nint\tkern_jail_set(struct thread *td, struct uio *options, int flags);\nint\tkern_kevent(struct thread *td, int fd, int nchanges, int nevents,\n\t    struct kevent_copyops *k_ops, const struct timespec *timeout);\nint\tkern_kldload(struct thread *td, const char *file, int *fileid);\nint\tkern_kldstat(struct thread *td, int fileid, struct kld_file_stat *stat);\nint\tkern_kldunload(struct thread *td, int fileid, int flags);\nint\tkern_lchown(struct thread *td, char *path, enum uio_seg pathseg,\n\t    int uid, int gid);\nint\tkern_link(struct thread *td, char *path, char *link,\n\t    enum uio_seg segflg);\nint\tkern_linkat(struct thread *td, int fd1, int fd2, char *path1,\n\t    char *path2, enum uio_seg segflg, int follow);\nint\tkern_lstat(struct thread *td, char *path, enum uio_seg pathseg,\n\t    struct stat *sbp);\nint\tkern_lutimes(struct thread *td, char *path, enum uio_seg pathseg,\n\t    struct timeval *tptr, enum uio_seg tptrseg);\nint\tkern_mkdir(struct thread *td, char *path, enum uio_seg segflg,\n\t    int mode);\nint\tkern_mkdirat(struct thread *td, int fd, char *path,\n\t    enum uio_seg segflg, int mode);\nint\tkern_mkfifo(struct thread *td, char *path, enum uio_seg pathseg,\n\t    int mode);\nint\tkern_mkfifoat(struct thread *td, int fd, char *path,\n\t    enum uio_seg pathseg, int mode);\nint\tkern_mknod(struct thread *td, char *path, enum uio_seg pathseg,\n\t    int mode, int dev);\nint\tkern_mknodat(struct thread *td, int fd, char *path,\n\t    enum uio_seg pathseg, int mode, int dev);\nint\tkern_msgctl(struct thread *, int, int, struct msqid_ds *);\nint\tkern_msgsnd(struct thread *, int, const void *, size_t, int, long);\nint\tkern_msgrcv(struct thread *, int, void *, size_t, long, int, long *);\nint     kern_nanosleep(struct thread *td, struct timespec *rqt,\n\t    struct timespec *rmt);\nint\tkern_ogetdirentries(struct thread *td, struct ogetdirentries_args *uap,\n\t    long *ploff);\nint\tkern_open(struct thread *td, char *path, enum uio_seg pathseg,\n\t    int flags, int mode);\nint\tkern_openat(struct thread *td, int fd, char *path,\n\t    enum uio_seg pathseg, int flags, int mode);\nint\tkern_pathconf(struct thread *td, char *path, enum uio_seg pathseg,\n\t    int name, u_long flags);\nint\tkern_pipe(struct thread *td, int fildes[2]);\nint\tkern_preadv(struct thread *td, int fd, struct uio *auio, off_t offset);\nint\tkern_pselect(struct thread *td, int nd, fd_set *in, fd_set *ou,\n\t    fd_set *ex, struct timeval *tvp, sigset_t *uset, int abi_nfdbits);\nint\tkern_ptrace(struct thread *td, int req, pid_t pid, void *addr,\n\t    int data);\nint\tkern_pwritev(struct thread *td, int fd, struct uio *auio, off_t offset);\nint\tkern_readlink(struct thread *td, char *path, enum uio_seg pathseg,\n\t    char *buf, enum uio_seg bufseg, size_t count);\nint\tkern_readlinkat(struct thread *td, int fd, char *path,\n\t    enum uio_seg pathseg, char *buf, enum uio_seg bufseg, size_t count);\nint\tkern_readv(struct thread *td, int fd, struct uio *auio);\nint\tkern_recvit(struct thread *td, int s, struct msghdr *mp,\n\t    enum uio_seg fromseg, struct mbuf **controlp);\nint\tkern_rename(struct thread *td, char *from, char *to,\n\t    enum uio_seg pathseg);\nint\tkern_renameat(struct thread *td, int oldfd, char *old, int newfd,\n\t    char *new, enum uio_seg pathseg);\nint\tkern_rmdir(struct thread *td, char *path, enum uio_seg pathseg);\nint\tkern_rmdirat(struct thread *td, int fd, char *path,\n\t    enum uio_seg pathseg);\nint\tkern_sched_rr_get_interval(struct thread *td, pid_t pid,\n\t    struct timespec *ts);\nint\tkern_semctl(struct thread *td, int semid, int semnum, int cmd,\n\t    union semun *arg, register_t *rval);\nint\tkern_select(struct thread *td, int nd, fd_set *fd_in, fd_set *fd_ou,\n\t    fd_set *fd_ex, struct timeval *tvp, int abi_nfdbits);\nint\tkern_sendfile(struct thread *td, struct sendfile_args *uap,\n\t    struct uio *hdr_uio, struct uio *trl_uio, int compat);\nint\tkern_sendit(struct thread *td, int s, struct msghdr *mp, int flags,\n\t    struct mbuf *control, enum uio_seg segflg);\nint\tkern_setgroups(struct thread *td, u_int ngrp, gid_t *groups);\nint\tkern_setitimer(struct thread *, u_int, struct itimerval *,\n\t    struct itimerval *);\nint\tkern_setrlimit(struct thread *, u_int, struct rlimit *);\nint\tkern_setsockopt(struct thread *td, int s, int level, int name,\n\t    void *optval, enum uio_seg valseg, socklen_t valsize);\nint\tkern_settimeofday(struct thread *td, struct timeval *tv,\n\t    struct timezone *tzp);\nint\tkern_shmat(struct thread *td, int shmid, const void *shmaddr,\n\t    int shmflg);\nint\tkern_shmctl(struct thread *td, int shmid, int cmd, void *buf,\n\t    size_t *bufsz);\nint\tkern_sigaction(struct thread *td, int sig, struct sigaction *act,\n\t    struct sigaction *oact, int flags);\nint\tkern_sigaltstack(struct thread *td, stack_t *ss, stack_t *oss);\nint\tkern_sigprocmask(struct thread *td, int how,\n\t    sigset_t *set, sigset_t *oset, int flags);\nint\tkern_sigsuspend(struct thread *td, sigset_t mask);\nint\tkern_sigtimedwait(struct thread *td, sigset_t waitset,\n\t    struct ksiginfo *ksi, struct timespec *timeout);\nint\tkern_stat(struct thread *td, char *path, enum uio_seg pathseg,\n\t    struct stat *sbp);\nint\tkern_statat(struct thread *td, int flag, int fd, char *path,\n\t    enum uio_seg pathseg, struct stat *sbp);\nint\tkern_statat_vnhook(struct thread *td, int flag, int fd, char *path,\n\t    enum uio_seg pathseg, struct stat *sbp,\n\t    void (*hook)(struct vnode *vp, struct stat *sbp));\nint\tkern_statfs(struct thread *td, char *path, enum uio_seg pathseg,\n\t    struct statfs *buf);\nint\tkern_symlink(struct thread *td, char *path, char *link,\n\t    enum uio_seg segflg);\nint\tkern_symlinkat(struct thread *td, char *path1, int fd, char *path2,\n\t    enum uio_seg segflg);\nint\tkern_thr_new(struct thread *td, struct thr_param *param);\nint\tkern_thr_suspend(struct thread *td, struct timespec *tsp);\nint\tkern_truncate(struct thread *td, char *path, enum uio_seg pathseg,\n\t    off_t length);\nint\tkern_unlink(struct thread *td, char *path, enum uio_seg pathseg);\nint\tkern_unlinkat(struct thread *td, int fd, char *path,\n\t    enum uio_seg pathseg, ino_t oldinum);\nint\tkern_utimes(struct thread *td, char *path, enum uio_seg pathseg,\n\t    struct timeval *tptr, enum uio_seg tptrseg);\nint\tkern_utimesat(struct thread *td, int fd, char *path,\n\t    enum uio_seg pathseg, struct timeval *tptr, enum uio_seg tptrseg);\nint\tkern_wait(struct thread *td, pid_t pid, int *status, int options,\n\t    struct rusage *rup);\nint\tkern_writev(struct thread *td, int fd, struct uio *auio);\nint\tkern_socketpair(struct thread *td, int domain, int type, int protocol,\n\t    int *rsv);\n\n/* flags for kern_sigaction */\n#define\tKSA_OSIGSET\t0x0001\t/* uses osigact_t */\n#define\tKSA_FREEBSD4\t0x0002\t/* uses ucontext4 */\n\n#endif /* !_SYS_SYSCALLSUBR_H_ */\n"
  },
  {
    "path": "freebsd-headers/sys/sysctl.h",
    "content": "/*-\n * Copyright (c) 1989, 1993\n *\tThe Regents of the University of California.  All rights reserved.\n *\n * This code is derived from software contributed to Berkeley by\n * Mike Karels at Berkeley Software Design, Inc.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 4. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t@(#)sysctl.h\t8.1 (Berkeley) 6/2/93\n * $FreeBSD: release/9.0.0/sys/sys/sysctl.h 224159 2011-07-17 23:05:24Z rwatson $\n */\n\n#ifndef _SYS_SYSCTL_H_\n#define\t_SYS_SYSCTL_H_\n\n#include <sys/queue.h>\n\nstruct thread;\n/*\n * Definitions for sysctl call.  The sysctl call uses a hierarchical name\n * for objects that can be examined or modified.  The name is expressed as\n * a sequence of integers.  Like a file path name, the meaning of each\n * component depends on its place in the hierarchy.  The top-level and kern\n * identifiers are defined here, and other identifiers are defined in the\n * respective subsystem header files.\n */\n\n#define CTL_MAXNAME\t24\t/* largest number of components supported */\n\n/*\n * Each subsystem defined by sysctl defines a list of variables\n * for that subsystem. Each name is either a node with further\n * levels defined below it, or it is a leaf of some particular\n * type given below. Each sysctl level defines a set of name/type\n * pairs to be used by sysctl(8) in manipulating the subsystem.\n */\nstruct ctlname {\n\tchar\t*ctl_name;\t/* subsystem name */\n\tint\tctl_type;\t/* type of name */\n};\n\n#define CTLTYPE\t\t0xf\t/* Mask for the type */\n#define\tCTLTYPE_NODE\t1\t/* name is a node */\n#define\tCTLTYPE_INT\t2\t/* name describes an integer */\n#define\tCTLTYPE_STRING\t3\t/* name describes a string */\n#define\tCTLTYPE_S64\t4\t/* name describes a signed 64-bit number */\n#define\tCTLTYPE_OPAQUE\t5\t/* name describes a structure */\n#define\tCTLTYPE_STRUCT\tCTLTYPE_OPAQUE\t/* name describes a structure */\n#define\tCTLTYPE_UINT\t6\t/* name describes an unsigned integer */\n#define\tCTLTYPE_LONG\t7\t/* name describes a long */\n#define\tCTLTYPE_ULONG\t8\t/* name describes an unsigned long */\n#define\tCTLTYPE_U64\t9\t/* name describes an unsigned 64-bit number */\n\n#define CTLFLAG_RD\t0x80000000\t/* Allow reads of variable */\n#define CTLFLAG_WR\t0x40000000\t/* Allow writes to the variable */\n#define CTLFLAG_RW\t(CTLFLAG_RD|CTLFLAG_WR)\n#define CTLFLAG_ANYBODY\t0x10000000\t/* All users can set this var */\n#define CTLFLAG_SECURE\t0x08000000\t/* Permit set only if securelevel<=0 */\n#define CTLFLAG_PRISON\t0x04000000\t/* Prisoned roots can fiddle */\n#define CTLFLAG_DYN\t0x02000000\t/* Dynamic oid - can be freed */\n#define CTLFLAG_SKIP\t0x01000000\t/* Skip this sysctl when listing */\n#define CTLMASK_SECURE\t0x00F00000\t/* Secure level */\n#define CTLFLAG_TUN\t0x00080000\t/* Tunable variable */\n#define CTLFLAG_MPSAFE\t0x00040000\t/* Handler is MP safe */\n#define CTLFLAG_VNET\t0x00020000\t/* Prisons with vnet can fiddle */\n#define CTLFLAG_RDTUN\t(CTLFLAG_RD|CTLFLAG_TUN)\n#define\tCTLFLAG_DYING\t0x00010000\t/* oid is being removed */\n#define CTLFLAG_CAPRD\t0x00008000\t/* Can be read in capability mode */\n#define CTLFLAG_CAPWR\t0x00004000\t/* Can be written in capability mode */\n#define CTLFLAG_CAPRW\t(CTLFLAG_CAPRD|CTLFLAG_CAPWR)\n\n/*\n * Secure level.   Note that CTLFLAG_SECURE == CTLFLAG_SECURE1.  \n *\n * Secure when the securelevel is raised to at least N.\n */\n#define CTLSHIFT_SECURE\t20\n#define CTLFLAG_SECURE1\t(CTLFLAG_SECURE | (0 << CTLSHIFT_SECURE))\n#define CTLFLAG_SECURE2\t(CTLFLAG_SECURE | (1 << CTLSHIFT_SECURE))\n#define CTLFLAG_SECURE3\t(CTLFLAG_SECURE | (2 << CTLSHIFT_SECURE))\n\n/*\n * USE THIS instead of a hardwired number from the categories below\n * to get dynamically assigned sysctl entries using the linker-set\n * technology. This is the way nearly all new sysctl variables should\n * be implemented.\n * e.g. SYSCTL_INT(_parent, OID_AUTO, name, CTLFLAG_RW, &variable, 0, \"\");\n */ \n#define OID_AUTO\t(-1)\n\n/*\n * The starting number for dynamically-assigned entries.  WARNING!\n * ALL static sysctl entries should have numbers LESS than this!\n */\n#define CTL_AUTO_START\t0x100\n\n#ifdef _KERNEL\n#include <sys/linker_set.h>\n\n#define SYSCTL_HANDLER_ARGS struct sysctl_oid *oidp, void *arg1,\t\\\n\tintptr_t arg2, struct sysctl_req *req\n\n/* definitions for sysctl_req 'lock' member */\n#define\tREQ_UNWIRED\t1\n#define\tREQ_WIRED\t2\n\n/* definitions for sysctl_req 'flags' member */\n#if defined(__amd64__) || defined(__ia64__) || defined(__powerpc64__)\n#define\tSCTL_MASK32\t1\t/* 32 bit emulation */\n#endif\n\n/*\n * This describes the access space for a sysctl request.  This is needed\n * so that we can use the interface from the kernel or from user-space.\n */\nstruct sysctl_req {\n\tstruct thread\t*td;\t\t/* used for access checking */\n\tint\t\tlock;\t\t/* wiring state */\n\tvoid\t\t*oldptr;\n\tsize_t\t\toldlen;\n\tsize_t\t\toldidx;\n\tint\t\t(*oldfunc)(struct sysctl_req *, const void *, size_t);\n\tvoid\t\t*newptr;\n\tsize_t\t\tnewlen;\n\tsize_t\t\tnewidx;\n\tint\t\t(*newfunc)(struct sysctl_req *, void *, size_t);\n\tsize_t\t\tvalidlen;\n\tint\t\tflags;\n};\n\nSLIST_HEAD(sysctl_oid_list, sysctl_oid);\n\n/*\n * This describes one \"oid\" in the MIB tree.  Potentially more nodes can\n * be hidden behind it, expanded by the handler.\n */\nstruct sysctl_oid {\n\tstruct sysctl_oid_list *oid_parent;\n\tSLIST_ENTRY(sysctl_oid) oid_link;\n\tint\t\toid_number;\n\tu_int\t\toid_kind;\n\tvoid\t\t*oid_arg1;\n\tintptr_t\toid_arg2;\n\tconst char\t*oid_name;\n\tint \t\t(*oid_handler)(SYSCTL_HANDLER_ARGS);\n\tconst char\t*oid_fmt;\n\tint\t\toid_refcnt;\n\tu_int\t\toid_running;\n\tconst char\t*oid_descr;\n};\n\n#define SYSCTL_IN(r, p, l) (r->newfunc)(r, p, l)\n#define SYSCTL_OUT(r, p, l) (r->oldfunc)(r, p, l)\n\nint sysctl_handle_int(SYSCTL_HANDLER_ARGS);\nint sysctl_msec_to_ticks(SYSCTL_HANDLER_ARGS);\nint sysctl_handle_long(SYSCTL_HANDLER_ARGS);\nint sysctl_handle_64(SYSCTL_HANDLER_ARGS);\nint sysctl_handle_string(SYSCTL_HANDLER_ARGS);\nint sysctl_handle_opaque(SYSCTL_HANDLER_ARGS);\n\nint sysctl_dpcpu_int(SYSCTL_HANDLER_ARGS);\nint sysctl_dpcpu_long(SYSCTL_HANDLER_ARGS);\nint sysctl_dpcpu_quad(SYSCTL_HANDLER_ARGS);\n\n/*\n * These functions are used to add/remove an oid from the mib.\n */\nvoid sysctl_register_oid(struct sysctl_oid *oidp);\nvoid sysctl_unregister_oid(struct sysctl_oid *oidp);\n\n/* Declare a static oid to allow child oids to be added to it. */\n#define SYSCTL_DECL(name)\t\t\t\t\t\\\n\textern struct sysctl_oid_list sysctl_##name##_children\n\n/* Hide these in macros */\n#define\tSYSCTL_CHILDREN(oid_ptr) (struct sysctl_oid_list *) \\\n\t(oid_ptr)->oid_arg1\n#define\tSYSCTL_CHILDREN_SET(oid_ptr, val) \\\n\t(oid_ptr)->oid_arg1 = (val);\n#define\tSYSCTL_STATIC_CHILDREN(oid_name) \\\n\t(&sysctl_##oid_name##_children)\n\n/* === Structs and macros related to context handling === */\n\n/* All dynamically created sysctls can be tracked in a context list. */\nstruct sysctl_ctx_entry {\n\tstruct sysctl_oid *entry;\n\tTAILQ_ENTRY(sysctl_ctx_entry) link;\n};\n\nTAILQ_HEAD(sysctl_ctx_list, sysctl_ctx_entry);\n\n#define SYSCTL_NODE_CHILDREN(parent, name) \\\n\tsysctl_##parent##_##name##_children\n\n/*\n * These macros provide type safety for sysctls.  SYSCTL_ALLOWED_TYPES()\n * defines a transparent union of the allowed types.  SYSCTL_ASSERT_TYPE()\n * and SYSCTL_ADD_ASSERT_TYPE() use the transparent union to assert that\n * the pointer matches the allowed types.\n *\n * The allow_0 member allows a literal 0 to be passed for ptr.\n */\n#define\tSYSCTL_ALLOWED_TYPES(type, decls)\t\t\t\\\n\tunion sysctl_##type {\t\t\t\t\t\\\n\t\tlong allow_0;\t\t\t\t\t\\\n\t\tdecls\t\t\t\t\t\t\\\n\t} __attribute__((__transparent_union__));\t\t\\\n\t\t\t\t\t\t\t\t\\\n\tstatic inline void *\t\t\t\t\t\\\n\t__sysctl_assert_##type(union sysctl_##type ptr)\t\t\\\n\t{\t\t\t\t\t\t\t\\\n\t\treturn (ptr.a);\t\t\t\t\t\\\n\t}\t\t\t\t\t\t\t\\\n\tstruct __hack\n\nSYSCTL_ALLOWED_TYPES(INT, int *a; );\nSYSCTL_ALLOWED_TYPES(UINT, unsigned int *a; );\nSYSCTL_ALLOWED_TYPES(LONG, long *a; );\nSYSCTL_ALLOWED_TYPES(ULONG, unsigned long *a; );\nSYSCTL_ALLOWED_TYPES(INT64, int64_t *a; long long *b; );\nSYSCTL_ALLOWED_TYPES(UINT64, uint64_t *a; unsigned long long *b; );\n\n#ifdef notyet\n#define\tSYSCTL_ADD_ASSERT_TYPE(type, ptr)\t\\\n\t__sysctl_assert_ ## type (ptr)\n#define\tSYSCTL_ASSERT_TYPE(type, ptr, parent, name)\t\\\n\t_SYSCTL_ASSERT_TYPE(type, ptr, __LINE__, parent##_##name)\n#else\n#define\tSYSCTL_ADD_ASSERT_TYPE(type, ptr)\tptr\n#define\tSYSCTL_ASSERT_TYPE(type, ptr, parent, name)\n#endif\n#define\t_SYSCTL_ASSERT_TYPE(t, p, l, id)\t\t\\\n\t__SYSCTL_ASSERT_TYPE(t, p, l, id)\n#define\t__SYSCTL_ASSERT_TYPE(type, ptr, line, id)\t\t\t\\\n\tstatic inline void\t\t\t\t\t\t\\\n\tsysctl_assert_##line##_##id(void)\t\t\t\t\\\n\t{\t\t\t\t\t\t\t\t\\\n\t\t(void)__sysctl_assert_##type(ptr);\t\t\t\\\n\t}\t\t\t\t\t\t\t\t\\\n\tstruct __hack\n\n#ifndef NO_SYSCTL_DESCR\n#define __DESCR(d) d\n#else\n#define __DESCR(d) \"\"\n#endif\n\n/* This constructs a \"raw\" MIB oid. */\n#define SYSCTL_OID(parent, nbr, name, kind, a1, a2, handler, fmt, descr) \\\n\tstatic struct sysctl_oid sysctl__##parent##_##name = {\t\t \\\n\t\t&sysctl_##parent##_children, { NULL }, nbr, kind,\t \\\n\t\ta1, a2, #name, handler, fmt, 0, 0, __DESCR(descr) };\t \\\n\tDATA_SET(sysctl_set, sysctl__##parent##_##name)\n\n#define SYSCTL_ADD_OID(ctx, parent, nbr, name, kind, a1, a2, handler, fmt, descr) \\\n\tsysctl_add_oid(ctx, parent, nbr, name, kind, a1, a2, handler, fmt, __DESCR(descr))\n\n/* This constructs a node from which other oids can hang. */\n#define SYSCTL_NODE(parent, nbr, name, access, handler, descr)\t\t    \\\n\tstruct sysctl_oid_list SYSCTL_NODE_CHILDREN(parent, name);\t    \\\n\tSYSCTL_OID(parent, nbr, name, CTLTYPE_NODE|(access),\t\t    \\\n\t    (void*)&SYSCTL_NODE_CHILDREN(parent, name), 0, handler, \"N\", descr)\n\n#define SYSCTL_ADD_NODE(ctx, parent, nbr, name, access, handler, descr)\t    \\\n\tsysctl_add_oid(ctx, parent, nbr, name, CTLTYPE_NODE|(access),\t    \\\n\tNULL, 0, handler, \"N\", __DESCR(descr))\n\n/* Oid for a string.  len can be 0 to indicate '\\0' termination. */\n#define SYSCTL_STRING(parent, nbr, name, access, arg, len, descr) \\\n\tSYSCTL_OID(parent, nbr, name, CTLTYPE_STRING|(access), \\\n\t\targ, len, sysctl_handle_string, \"A\", descr)\n\n#define SYSCTL_ADD_STRING(ctx, parent, nbr, name, access, arg, len, descr)  \\\n\tsysctl_add_oid(ctx, parent, nbr, name, CTLTYPE_STRING|(access),\t    \\\n\targ, len, sysctl_handle_string, \"A\", __DESCR(descr))\n\n/* Oid for an int.  If ptr is NULL, val is returned. */\n#define\tSYSCTL_INT(parent, nbr, name, access, ptr, val, descr)\t\t\\\n\tSYSCTL_ASSERT_TYPE(INT, ptr, parent, name);\t\t\t\\\n\tSYSCTL_OID(parent, nbr, name,\t\t\t\t\t\\\n\t    CTLTYPE_INT | CTLFLAG_MPSAFE | (access),\t\t\t\\\n\t    ptr, val, sysctl_handle_int, \"I\", descr)\n\n#define\tSYSCTL_ADD_INT(ctx, parent, nbr, name, access, ptr, val, descr)\t\\\n\tsysctl_add_oid(ctx, parent, nbr, name,\t\t\t\t\\\n\t    CTLTYPE_INT | CTLFLAG_MPSAFE | (access),\t\t\t\\\n\t    SYSCTL_ADD_ASSERT_TYPE(INT, ptr), val,\t\t\t\\\n\t    sysctl_handle_int, \"I\", __DESCR(descr))\n\n/* Oid for an unsigned int.  If ptr is NULL, val is returned. */\n#define\tSYSCTL_UINT(parent, nbr, name, access, ptr, val, descr)\t\t\\\n\tSYSCTL_ASSERT_TYPE(UINT, ptr, parent, name);\t\t\t\\\n\tSYSCTL_OID(parent, nbr, name,\t\t\t\t\t\\\n\t    CTLTYPE_UINT | CTLFLAG_MPSAFE | (access),\t\t\t\\\n\t    ptr, val, sysctl_handle_int, \"IU\", descr)\n\n#define\tSYSCTL_ADD_UINT(ctx, parent, nbr, name, access, ptr, val, descr) \\\n\tsysctl_add_oid(ctx, parent, nbr, name,\t\t\t\t\\\n\t    CTLTYPE_UINT | CTLFLAG_MPSAFE | (access),\t\t\t\\\n\t    SYSCTL_ADD_ASSERT_TYPE(UINT, ptr), val,\t\t\t\\\n\t    sysctl_handle_int, \"IU\", __DESCR(descr))\n\n/* Oid for a long.  The pointer must be non NULL. */\n#define\tSYSCTL_LONG(parent, nbr, name, access, ptr, val, descr)\t\t\\\n\tSYSCTL_ASSERT_TYPE(LONG, ptr, parent, name);\t\t\t\\\n\tSYSCTL_OID(parent, nbr, name,\t\t\t\t\t\\\n\t    CTLTYPE_LONG | CTLFLAG_MPSAFE | (access),\t\t\t\\\n\t    ptr, val, sysctl_handle_long, \"L\", descr)\n\n#define\tSYSCTL_ADD_LONG(ctx, parent, nbr, name, access, ptr, descr)\t\\\n\tsysctl_add_oid(ctx, parent, nbr, name,\t\t\t\t\\\n\t    CTLTYPE_LONG | CTLFLAG_MPSAFE | (access),\t\t\t\\\n\t    SYSCTL_ADD_ASSERT_TYPE(LONG, ptr), 0,\t\t\t\\\n\t    sysctl_handle_long,\t\"L\", __DESCR(descr))\n\n/* Oid for an unsigned long.  The pointer must be non NULL. */\n#define\tSYSCTL_ULONG(parent, nbr, name, access, ptr, val, descr)\t\\\n\tSYSCTL_ASSERT_TYPE(ULONG, ptr, parent, name);\t\t\t\\\n\tSYSCTL_OID(parent, nbr, name,\t\t\t\t\t\\\n\t    CTLTYPE_ULONG | CTLFLAG_MPSAFE | (access),\t\t\t\\\n\t    ptr, val, sysctl_handle_long, \"LU\", descr)\n\n#define\tSYSCTL_ADD_ULONG(ctx, parent, nbr, name, access, ptr, descr)\t\\\n\tsysctl_add_oid(ctx, parent, nbr, name,\t\t\t\t\\\n\t    CTLTYPE_ULONG | CTLFLAG_MPSAFE | (access),\t\t\t\\\n\t    SYSCTL_ADD_ASSERT_TYPE(ULONG, ptr), 0,\t\t\t\\\n\t    sysctl_handle_long, \"LU\", __DESCR(descr))\n\n/* Oid for a quad.  The pointer must be non NULL. */\n#define\tSYSCTL_QUAD(parent, nbr, name, access, ptr, val, descr)\t\t\\\n\tSYSCTL_ASSERT_TYPE(INT64, ptr, parent, name);\t\t\t\\\n\tSYSCTL_OID(parent, nbr, name,\t\t\t\t\t\\\n\t    CTLTYPE_S64 | CTLFLAG_MPSAFE | (access),\t\t\t\\\n\t    ptr, val, sysctl_handle_64, \"Q\", descr)\n\n#define\tSYSCTL_ADD_QUAD(ctx, parent, nbr, name, access, ptr, descr)\t\\\n\tsysctl_add_oid(ctx, parent, nbr, name,\t\t\t\t\\\n\t    CTLTYPE_S64 | CTLFLAG_MPSAFE | (access),\t\t\t\\\n\t    SYSCTL_ADD_ASSERT_TYPE(INT64, ptr), 0,\t\t\t\\\n\t    sysctl_handle_64, \"Q\", __DESCR(descr))\n\n#define\tSYSCTL_UQUAD(parent, nbr, name, access, ptr, val, descr)\t\\\n\tSYSCTL_ASSERT_TYPE(UINT64, ptr, parent, name);\t\t\t\\\n\tSYSCTL_OID(parent, nbr, name,\t\t\t\t\t\\\n\t    CTLTYPE_U64 | CTLFLAG_MPSAFE | (access),\t\t\t\\\n\t    ptr, val, sysctl_handle_64, \"QU\", descr)\n\n#define\tSYSCTL_ADD_UQUAD(ctx, parent, nbr, name, access, ptr, descr)\t\\\n\tsysctl_add_oid(ctx, parent, nbr, name,\t\t\t\t\\\n\t    CTLTYPE_U64 | CTLFLAG_MPSAFE | (access),\t\t\t\\\n\t    SYSCTL_ADD_ASSERT_TYPE(UINT64, ptr), 0,\t\t\t\\\n\t    sysctl_handle_64, \"QU\", __DESCR(descr))\n\n/* Oid for an opaque object.  Specified by a pointer and a length. */\n#define SYSCTL_OPAQUE(parent, nbr, name, access, ptr, len, fmt, descr) \\\n\tSYSCTL_OID(parent, nbr, name, CTLTYPE_OPAQUE|(access), \\\n\t\tptr, len, sysctl_handle_opaque, fmt, descr)\n\n#define SYSCTL_ADD_OPAQUE(ctx, parent, nbr, name, access, ptr, len, fmt, descr)\\\n\tsysctl_add_oid(ctx, parent, nbr, name, CTLTYPE_OPAQUE|(access),\t    \\\n\tptr, len, sysctl_handle_opaque, fmt, __DESCR(descr))\n\n/* Oid for a struct.  Specified by a pointer and a type. */\n#define SYSCTL_STRUCT(parent, nbr, name, access, ptr, type, descr) \\\n\tSYSCTL_OID(parent, nbr, name, CTLTYPE_OPAQUE|(access), \\\n\t\tptr, sizeof(struct type), sysctl_handle_opaque, \\\n\t\t\"S,\" #type, descr)\n\n#define SYSCTL_ADD_STRUCT(ctx, parent, nbr, name, access, ptr, type, descr) \\\n\tsysctl_add_oid(ctx, parent, nbr, name, CTLTYPE_OPAQUE|(access),\t    \\\n\tptr, sizeof(struct type), sysctl_handle_opaque, \"S,\" #type, __DESCR(descr))\n\n/* Oid for a procedure.  Specified by a pointer and an arg. */\n#define SYSCTL_PROC(parent, nbr, name, access, ptr, arg, handler, fmt, descr) \\\n\tCTASSERT(((access) & CTLTYPE) != 0);\t\t\t\t\\\n\tSYSCTL_OID(parent, nbr, name, (access), \\\n\t\tptr, arg, handler, fmt, descr)\n\n#define SYSCTL_ADD_PROC(ctx, parent, nbr, name, access, ptr, arg, handler, fmt, descr) \\\n\tsysctl_add_oid(ctx, parent, nbr, name, (access),\t\t\t    \\\n\tptr, arg, handler, fmt, __DESCR(descr))\n\n/*\n * A macro to generate a read-only sysctl to indicate the presense of optional\n * kernel features.\n */\n#define\tFEATURE(name, desc)\t\t\t\t\t\t\\\n\tSYSCTL_INT(_kern_features, OID_AUTO, name, CTLFLAG_RD | CTLFLAG_CAPRD, \\\n\t    0, 1, desc)\n\n#endif /* _KERNEL */\n\n/*\n * Top-level identifiers\n */\n#define\tCTL_UNSPEC\t0\t\t/* unused */\n#define\tCTL_KERN\t1\t\t/* \"high kernel\": proc, limits */\n#define\tCTL_VM\t\t2\t\t/* virtual memory */\n#define\tCTL_VFS\t\t3\t\t/* filesystem, mount type is next */\n#define\tCTL_NET\t\t4\t\t/* network, see socket.h */\n#define\tCTL_DEBUG\t5\t\t/* debugging parameters */\n#define\tCTL_HW\t\t6\t\t/* generic cpu/io */\n#define\tCTL_MACHDEP\t7\t\t/* machine dependent */\n#define\tCTL_USER\t8\t\t/* user-level */\n#define\tCTL_P1003_1B\t9\t\t/* POSIX 1003.1B */\n#define\tCTL_MAXID\t10\t\t/* number of valid top-level ids */\n\n#define CTL_NAMES { \\\n\t{ 0, 0 }, \\\n\t{ \"kern\", CTLTYPE_NODE }, \\\n\t{ \"vm\", CTLTYPE_NODE }, \\\n\t{ \"vfs\", CTLTYPE_NODE }, \\\n\t{ \"net\", CTLTYPE_NODE }, \\\n\t{ \"debug\", CTLTYPE_NODE }, \\\n\t{ \"hw\", CTLTYPE_NODE }, \\\n\t{ \"machdep\", CTLTYPE_NODE }, \\\n\t{ \"user\", CTLTYPE_NODE }, \\\n\t{ \"p1003_1b\", CTLTYPE_NODE }, \\\n}\n\n/*\n * CTL_KERN identifiers\n */\n#define\tKERN_OSTYPE\t \t 1\t/* string: system version */\n#define\tKERN_OSRELEASE\t \t 2\t/* string: system release */\n#define\tKERN_OSREV\t \t 3\t/* int: system revision */\n#define\tKERN_VERSION\t \t 4\t/* string: compile time info */\n#define\tKERN_MAXVNODES\t \t 5\t/* int: max vnodes */\n#define\tKERN_MAXPROC\t \t 6\t/* int: max processes */\n#define\tKERN_MAXFILES\t \t 7\t/* int: max open files */\n#define\tKERN_ARGMAX\t \t 8\t/* int: max arguments to exec */\n#define\tKERN_SECURELVL\t \t 9\t/* int: system security level */\n#define\tKERN_HOSTNAME\t\t10\t/* string: hostname */\n#define\tKERN_HOSTID\t\t11\t/* int: host identifier */\n#define\tKERN_CLOCKRATE\t\t12\t/* struct: struct clockrate */\n#define\tKERN_VNODE\t\t13\t/* struct: vnode structures */\n#define\tKERN_PROC\t\t14\t/* struct: process entries */\n#define\tKERN_FILE\t\t15\t/* struct: file entries */\n#define\tKERN_PROF\t\t16\t/* node: kernel profiling info */\n#define\tKERN_POSIX1\t\t17\t/* int: POSIX.1 version */\n#define\tKERN_NGROUPS\t\t18\t/* int: # of supplemental group ids */\n#define\tKERN_JOB_CONTROL\t19\t/* int: is job control available */\n#define\tKERN_SAVED_IDS\t\t20\t/* int: saved set-user/group-ID */\n#define\tKERN_BOOTTIME\t\t21\t/* struct: time kernel was booted */\n#define KERN_NISDOMAINNAME\t22\t/* string: YP domain name */\n#define KERN_UPDATEINTERVAL\t23\t/* int: update process sleep time */\n#define KERN_OSRELDATE\t\t24\t/* int: kernel release date */\n#define KERN_NTP_PLL\t\t25\t/* node: NTP PLL control */\n#define\tKERN_BOOTFILE\t\t26\t/* string: name of booted kernel */\n#define\tKERN_MAXFILESPERPROC\t27\t/* int: max open files per proc */\n#define\tKERN_MAXPROCPERUID \t28\t/* int: max processes per uid */\n#define KERN_DUMPDEV\t\t29\t/* struct cdev *: device to dump on */\n#define\tKERN_IPC\t\t30\t/* node: anything related to IPC */\n#define\tKERN_DUMMY\t\t31\t/* unused */\n#define\tKERN_PS_STRINGS\t\t32\t/* int: address of PS_STRINGS */\n#define\tKERN_USRSTACK\t\t33\t/* int: address of USRSTACK */\n#define\tKERN_LOGSIGEXIT\t\t34\t/* int: do we log sigexit procs? */\n#define\tKERN_IOV_MAX\t\t35\t/* int: value of UIO_MAXIOV */\n#define\tKERN_HOSTUUID\t\t36\t/* string: host UUID identifier */\n#define\tKERN_ARND\t\t37\t/* int: from arc4rand() */\n#define\tKERN_MAXID\t\t38\t/* number of valid kern ids */\n\n#define CTL_KERN_NAMES { \\\n\t{ 0, 0 }, \\\n\t{ \"ostype\", CTLTYPE_STRING }, \\\n\t{ \"osrelease\", CTLTYPE_STRING }, \\\n\t{ \"osrevision\", CTLTYPE_INT }, \\\n\t{ \"version\", CTLTYPE_STRING }, \\\n\t{ \"maxvnodes\", CTLTYPE_INT }, \\\n\t{ \"maxproc\", CTLTYPE_INT }, \\\n\t{ \"maxfiles\", CTLTYPE_INT }, \\\n\t{ \"argmax\", CTLTYPE_INT }, \\\n\t{ \"securelevel\", CTLTYPE_INT }, \\\n\t{ \"hostname\", CTLTYPE_STRING }, \\\n\t{ \"hostid\", CTLTYPE_UINT }, \\\n\t{ \"clockrate\", CTLTYPE_STRUCT }, \\\n\t{ \"vnode\", CTLTYPE_STRUCT }, \\\n\t{ \"proc\", CTLTYPE_STRUCT }, \\\n\t{ \"file\", CTLTYPE_STRUCT }, \\\n\t{ \"profiling\", CTLTYPE_NODE }, \\\n\t{ \"posix1version\", CTLTYPE_INT }, \\\n\t{ \"ngroups\", CTLTYPE_INT }, \\\n\t{ \"job_control\", CTLTYPE_INT }, \\\n\t{ \"saved_ids\", CTLTYPE_INT }, \\\n\t{ \"boottime\", CTLTYPE_STRUCT }, \\\n\t{ \"nisdomainname\", CTLTYPE_STRING }, \\\n\t{ \"update\", CTLTYPE_INT }, \\\n\t{ \"osreldate\", CTLTYPE_INT }, \\\n\t{ \"ntp_pll\", CTLTYPE_NODE }, \\\n\t{ \"bootfile\", CTLTYPE_STRING }, \\\n\t{ \"maxfilesperproc\", CTLTYPE_INT }, \\\n\t{ \"maxprocperuid\", CTLTYPE_INT }, \\\n\t{ \"ipc\", CTLTYPE_NODE }, \\\n\t{ \"dummy\", CTLTYPE_INT }, \\\n\t{ \"ps_strings\", CTLTYPE_INT }, \\\n\t{ \"usrstack\", CTLTYPE_INT }, \\\n\t{ \"logsigexit\", CTLTYPE_INT }, \\\n\t{ \"iov_max\", CTLTYPE_INT }, \\\n\t{ \"hostuuid\", CTLTYPE_STRING }, \\\n\t{ \"arc4rand\", CTLTYPE_OPAQUE }, \\\n}\n\n/*\n * CTL_VFS identifiers\n */\n#define CTL_VFS_NAMES { \\\n\t{ \"vfsconf\", CTLTYPE_STRUCT }, \\\n}\n\n/*\n * KERN_PROC subtypes\n */\n#define KERN_PROC_ALL\t\t0\t/* everything */\n#define\tKERN_PROC_PID\t\t1\t/* by process id */\n#define\tKERN_PROC_PGRP\t\t2\t/* by process group id */\n#define\tKERN_PROC_SESSION\t3\t/* by session of pid */\n#define\tKERN_PROC_TTY\t\t4\t/* by controlling tty */\n#define\tKERN_PROC_UID\t\t5\t/* by effective uid */\n#define\tKERN_PROC_RUID\t\t6\t/* by real uid */\n#define\tKERN_PROC_ARGS\t\t7\t/* get/set arguments/proctitle */\n#define\tKERN_PROC_PROC\t\t8\t/* only return procs */\n#define\tKERN_PROC_SV_NAME\t9\t/* get syscall vector name */\n#define\tKERN_PROC_RGID\t\t10\t/* by real group id */\n#define\tKERN_PROC_GID\t\t11\t/* by effective group id */\n#define\tKERN_PROC_PATHNAME\t12\t/* path to executable */\n#define\tKERN_PROC_OVMMAP\t13\t/* Old VM map entries for process */\n#define\tKERN_PROC_OFILEDESC\t14\t/* Old file descriptors for process */\n#define\tKERN_PROC_KSTACK\t15\t/* Kernel stacks for process */\n#define\tKERN_PROC_INC_THREAD\t0x10\t/*\n\t\t\t\t\t * modifier for pid, pgrp, tty,\n\t\t\t\t\t * uid, ruid, gid, rgid and proc\n\t\t\t\t\t * This effectively uses 16-31\n\t\t\t\t\t */\n#define\tKERN_PROC_VMMAP\t\t32\t/* VM map entries for process */\n#define\tKERN_PROC_FILEDESC\t33\t/* File descriptors for process */\n#define\tKERN_PROC_GROUPS\t34\t/* process groups */\n\n/*\n * KERN_IPC identifiers\n */\n#define KIPC_MAXSOCKBUF\t\t1\t/* int: max size of a socket buffer */\n#define\tKIPC_SOCKBUF_WASTE\t2\t/* int: wastage factor in sockbuf */\n#define\tKIPC_SOMAXCONN\t\t3\t/* int: max length of connection q */\n#define\tKIPC_MAX_LINKHDR\t4\t/* int: max length of link header */\n#define\tKIPC_MAX_PROTOHDR\t5\t/* int: max length of network header */\n#define\tKIPC_MAX_HDR\t\t6\t/* int: max total length of headers */\n#define\tKIPC_MAX_DATALEN\t7\t/* int: max length of data? */\n\n/*\n * CTL_HW identifiers\n */\n#define\tHW_MACHINE\t 1\t\t/* string: machine class */\n#define\tHW_MODEL\t 2\t\t/* string: specific machine model */\n#define\tHW_NCPU\t\t 3\t\t/* int: number of cpus */\n#define\tHW_BYTEORDER\t 4\t\t/* int: machine byte order */\n#define\tHW_PHYSMEM\t 5\t\t/* int: total memory */\n#define\tHW_USERMEM\t 6\t\t/* int: non-kernel memory */\n#define\tHW_PAGESIZE\t 7\t\t/* int: software page size */\n#define\tHW_DISKNAMES\t 8\t\t/* strings: disk drive names */\n#define\tHW_DISKSTATS\t 9\t\t/* struct: diskstats[] */\n#define HW_FLOATINGPT\t10\t\t/* int: has HW floating point? */\n#define HW_MACHINE_ARCH\t11\t\t/* string: machine architecture */\n#define\tHW_REALMEM\t12\t\t/* int: 'real' memory */\n#define\tHW_MAXID\t13\t\t/* number of valid hw ids */\n\n#define CTL_HW_NAMES { \\\n\t{ 0, 0 }, \\\n\t{ \"machine\", CTLTYPE_STRING }, \\\n\t{ \"model\", CTLTYPE_STRING }, \\\n\t{ \"ncpu\", CTLTYPE_INT }, \\\n\t{ \"byteorder\", CTLTYPE_INT }, \\\n\t{ \"physmem\", CTLTYPE_ULONG }, \\\n\t{ \"usermem\", CTLTYPE_ULONG }, \\\n\t{ \"pagesize\", CTLTYPE_INT }, \\\n\t{ \"disknames\", CTLTYPE_STRUCT }, \\\n\t{ \"diskstats\", CTLTYPE_STRUCT }, \\\n\t{ \"floatingpoint\", CTLTYPE_INT }, \\\n\t{ \"machine_arch\", CTLTYPE_STRING }, \\\n\t{ \"realmem\", CTLTYPE_ULONG }, \\\n}\n\n/*\n * CTL_USER definitions\n */\n#define\tUSER_CS_PATH\t\t 1\t/* string: _CS_PATH */\n#define\tUSER_BC_BASE_MAX\t 2\t/* int: BC_BASE_MAX */\n#define\tUSER_BC_DIM_MAX\t\t 3\t/* int: BC_DIM_MAX */\n#define\tUSER_BC_SCALE_MAX\t 4\t/* int: BC_SCALE_MAX */\n#define\tUSER_BC_STRING_MAX\t 5\t/* int: BC_STRING_MAX */\n#define\tUSER_COLL_WEIGHTS_MAX\t 6\t/* int: COLL_WEIGHTS_MAX */\n#define\tUSER_EXPR_NEST_MAX\t 7\t/* int: EXPR_NEST_MAX */\n#define\tUSER_LINE_MAX\t\t 8\t/* int: LINE_MAX */\n#define\tUSER_RE_DUP_MAX\t\t 9\t/* int: RE_DUP_MAX */\n#define\tUSER_POSIX2_VERSION\t10\t/* int: POSIX2_VERSION */\n#define\tUSER_POSIX2_C_BIND\t11\t/* int: POSIX2_C_BIND */\n#define\tUSER_POSIX2_C_DEV\t12\t/* int: POSIX2_C_DEV */\n#define\tUSER_POSIX2_CHAR_TERM\t13\t/* int: POSIX2_CHAR_TERM */\n#define\tUSER_POSIX2_FORT_DEV\t14\t/* int: POSIX2_FORT_DEV */\n#define\tUSER_POSIX2_FORT_RUN\t15\t/* int: POSIX2_FORT_RUN */\n#define\tUSER_POSIX2_LOCALEDEF\t16\t/* int: POSIX2_LOCALEDEF */\n#define\tUSER_POSIX2_SW_DEV\t17\t/* int: POSIX2_SW_DEV */\n#define\tUSER_POSIX2_UPE\t\t18\t/* int: POSIX2_UPE */\n#define\tUSER_STREAM_MAX\t\t19\t/* int: POSIX2_STREAM_MAX */\n#define\tUSER_TZNAME_MAX\t\t20\t/* int: POSIX2_TZNAME_MAX */\n#define\tUSER_MAXID\t\t21\t/* number of valid user ids */\n\n#define\tCTL_USER_NAMES { \\\n\t{ 0, 0 }, \\\n\t{ \"cs_path\", CTLTYPE_STRING }, \\\n\t{ \"bc_base_max\", CTLTYPE_INT }, \\\n\t{ \"bc_dim_max\", CTLTYPE_INT }, \\\n\t{ \"bc_scale_max\", CTLTYPE_INT }, \\\n\t{ \"bc_string_max\", CTLTYPE_INT }, \\\n\t{ \"coll_weights_max\", CTLTYPE_INT }, \\\n\t{ \"expr_nest_max\", CTLTYPE_INT }, \\\n\t{ \"line_max\", CTLTYPE_INT }, \\\n\t{ \"re_dup_max\", CTLTYPE_INT }, \\\n\t{ \"posix2_version\", CTLTYPE_INT }, \\\n\t{ \"posix2_c_bind\", CTLTYPE_INT }, \\\n\t{ \"posix2_c_dev\", CTLTYPE_INT }, \\\n\t{ \"posix2_char_term\", CTLTYPE_INT }, \\\n\t{ \"posix2_fort_dev\", CTLTYPE_INT }, \\\n\t{ \"posix2_fort_run\", CTLTYPE_INT }, \\\n\t{ \"posix2_localedef\", CTLTYPE_INT }, \\\n\t{ \"posix2_sw_dev\", CTLTYPE_INT }, \\\n\t{ \"posix2_upe\", CTLTYPE_INT }, \\\n\t{ \"stream_max\", CTLTYPE_INT }, \\\n\t{ \"tzname_max\", CTLTYPE_INT }, \\\n}\n\n#define CTL_P1003_1B_ASYNCHRONOUS_IO\t\t1\t/* boolean */\n#define CTL_P1003_1B_MAPPED_FILES\t\t2\t/* boolean */\n#define CTL_P1003_1B_MEMLOCK\t\t\t3\t/* boolean */\n#define CTL_P1003_1B_MEMLOCK_RANGE\t\t4\t/* boolean */\n#define CTL_P1003_1B_MEMORY_PROTECTION\t\t5\t/* boolean */\n#define CTL_P1003_1B_MESSAGE_PASSING\t\t6\t/* boolean */\n#define CTL_P1003_1B_PRIORITIZED_IO\t\t7\t/* boolean */\n#define CTL_P1003_1B_PRIORITY_SCHEDULING\t8\t/* boolean */\n#define CTL_P1003_1B_REALTIME_SIGNALS\t\t9\t/* boolean */\n#define CTL_P1003_1B_SEMAPHORES\t\t\t10\t/* boolean */\n#define CTL_P1003_1B_FSYNC\t\t\t11\t/* boolean */\n#define CTL_P1003_1B_SHARED_MEMORY_OBJECTS\t12\t/* boolean */\n#define CTL_P1003_1B_SYNCHRONIZED_IO\t\t13\t/* boolean */\n#define CTL_P1003_1B_TIMERS\t\t\t14\t/* boolean */\n#define CTL_P1003_1B_AIO_LISTIO_MAX\t\t15\t/* int */\n#define CTL_P1003_1B_AIO_MAX\t\t\t16\t/* int */\n#define CTL_P1003_1B_AIO_PRIO_DELTA_MAX\t\t17\t/* int */\n#define CTL_P1003_1B_DELAYTIMER_MAX\t\t18\t/* int */\n#define CTL_P1003_1B_MQ_OPEN_MAX\t\t19\t/* int */\n#define CTL_P1003_1B_PAGESIZE\t\t\t20\t/* int */\n#define CTL_P1003_1B_RTSIG_MAX\t\t\t21\t/* int */\n#define CTL_P1003_1B_SEM_NSEMS_MAX\t\t22\t/* int */\n#define CTL_P1003_1B_SEM_VALUE_MAX\t\t23\t/* int */\n#define CTL_P1003_1B_SIGQUEUE_MAX\t\t24\t/* int */\n#define CTL_P1003_1B_TIMER_MAX\t\t\t25\t/* int */\n\n#define CTL_P1003_1B_MAXID\t\t26\n\n#define\tCTL_P1003_1B_NAMES { \\\n\t{ 0, 0 }, \\\n\t{ \"asynchronous_io\", CTLTYPE_INT }, \\\n\t{ \"mapped_files\", CTLTYPE_INT }, \\\n\t{ \"memlock\", CTLTYPE_INT }, \\\n\t{ \"memlock_range\", CTLTYPE_INT }, \\\n\t{ \"memory_protection\", CTLTYPE_INT }, \\\n\t{ \"message_passing\", CTLTYPE_INT }, \\\n\t{ \"prioritized_io\", CTLTYPE_INT }, \\\n\t{ \"priority_scheduling\", CTLTYPE_INT }, \\\n\t{ \"realtime_signals\", CTLTYPE_INT }, \\\n\t{ \"semaphores\", CTLTYPE_INT }, \\\n\t{ \"fsync\", CTLTYPE_INT }, \\\n\t{ \"shared_memory_objects\", CTLTYPE_INT }, \\\n\t{ \"synchronized_io\", CTLTYPE_INT }, \\\n\t{ \"timers\", CTLTYPE_INT }, \\\n\t{ \"aio_listio_max\", CTLTYPE_INT }, \\\n\t{ \"aio_max\", CTLTYPE_INT }, \\\n\t{ \"aio_prio_delta_max\", CTLTYPE_INT }, \\\n\t{ \"delaytimer_max\", CTLTYPE_INT }, \\\n\t{ \"mq_open_max\", CTLTYPE_INT }, \\\n\t{ \"pagesize\", CTLTYPE_INT }, \\\n\t{ \"rtsig_max\", CTLTYPE_INT }, \\\n\t{ \"nsems_max\", CTLTYPE_INT }, \\\n\t{ \"sem_value_max\", CTLTYPE_INT }, \\\n\t{ \"sigqueue_max\", CTLTYPE_INT }, \\\n\t{ \"timer_max\", CTLTYPE_INT }, \\\n}\n\n#ifdef _KERNEL\n\n/*\n * Declare some common oids.\n */\nextern struct sysctl_oid_list sysctl__children;\nSYSCTL_DECL(_kern);\nSYSCTL_DECL(_kern_features);\nSYSCTL_DECL(_kern_ipc);\nSYSCTL_DECL(_kern_proc);\nSYSCTL_DECL(_kern_sched);\nSYSCTL_DECL(_kern_sched_stats);\nSYSCTL_DECL(_sysctl);\nSYSCTL_DECL(_vm);\nSYSCTL_DECL(_vm_stats);\nSYSCTL_DECL(_vm_stats_misc);\nSYSCTL_DECL(_vfs);\nSYSCTL_DECL(_net);\nSYSCTL_DECL(_debug);\nSYSCTL_DECL(_debug_sizeof);\nSYSCTL_DECL(_dev);\nSYSCTL_DECL(_hw);\nSYSCTL_DECL(_hw_bus);\nSYSCTL_DECL(_hw_bus_devices);\nSYSCTL_DECL(_hw_bus_info);\nSYSCTL_DECL(_machdep);\nSYSCTL_DECL(_user);\nSYSCTL_DECL(_compat);\nSYSCTL_DECL(_regression);\nSYSCTL_DECL(_security);\nSYSCTL_DECL(_security_bsd);\n\nextern char\tmachine[];\nextern char\tosrelease[];\nextern char\tostype[];\nextern char\tkern_ident[];\n\n/* Dynamic oid handling */\nstruct sysctl_oid *sysctl_add_oid(struct sysctl_ctx_list *clist,\n\t\tstruct sysctl_oid_list *parent, int nbr, const char *name,\n\t\tint kind, void *arg1, intptr_t arg2,\n\t\tint (*handler) (SYSCTL_HANDLER_ARGS),\n\t\tconst char *fmt, const char *descr);\nint\tsysctl_remove_name(struct sysctl_oid *parent, const char *name, int del,\n\t\tint recurse);\nvoid\tsysctl_rename_oid(struct sysctl_oid *oidp, const char *name);\nint\tsysctl_move_oid(struct sysctl_oid *oidp,\n\t\tstruct sysctl_oid_list *parent);\nint\tsysctl_remove_oid(struct sysctl_oid *oidp, int del, int recurse);\nint\tsysctl_ctx_init(struct sysctl_ctx_list *clist);\nint\tsysctl_ctx_free(struct sysctl_ctx_list *clist);\nstruct\tsysctl_ctx_entry *sysctl_ctx_entry_add(struct sysctl_ctx_list *clist,\n\t\tstruct sysctl_oid *oidp);\nstruct\tsysctl_ctx_entry *sysctl_ctx_entry_find(struct sysctl_ctx_list *clist,\n\t\tstruct sysctl_oid *oidp);\nint\tsysctl_ctx_entry_del(struct sysctl_ctx_list *clist,\n\t\tstruct sysctl_oid *oidp);\n\nint\tkernel_sysctl(struct thread *td, int *name, u_int namelen, void *old,\n\t\t      size_t *oldlenp, void *new, size_t newlen,\n\t\t      size_t *retval, int flags);\nint\tkernel_sysctlbyname(struct thread *td, char *name,\n\t\tvoid *old, size_t *oldlenp, void *new, size_t newlen,\n\t\tsize_t *retval, int flags);\nint\tuserland_sysctl(struct thread *td, int *name, u_int namelen, void *old,\n\t\t\tsize_t *oldlenp, int inkernel, void *new, size_t newlen,\n\t\t\tsize_t *retval, int flags);\nint\tsysctl_find_oid(int *name, u_int namelen, struct sysctl_oid **noid,\n\t\t\tint *nindx, struct sysctl_req *req);\nvoid\tsysctl_lock(void);\nvoid\tsysctl_unlock(void);\nint\tsysctl_wire_old_buffer(struct sysctl_req *req, size_t len);\n\nstruct sbuf;\nstruct sbuf\t*sbuf_new_for_sysctl(struct sbuf *, char *, int,\n\t\t    struct sysctl_req *);\n#else\t/* !_KERNEL */\n#include <sys/cdefs.h>\n\n__BEGIN_DECLS\nint\tsysctl(const int *, u_int, void *, size_t *, const void *, size_t);\nint\tsysctlbyname(const char *, void *, size_t *, const void *, size_t);\nint\tsysctlnametomib(const char *, int *, size_t *);\n__END_DECLS\n#endif\t/* _KERNEL */\n\n#endif\t/* !_SYS_SYSCTL_H_ */\n"
  },
  {
    "path": "freebsd-headers/sys/sysent.h",
    "content": "/*-\n * Copyright (c) 1982, 1988, 1991 The Regents of the University of California.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 4. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/sys/sysent.h 225617 2011-09-16 13:58:51Z kmacy $\n */\n\n#ifndef _SYS_SYSENT_H_\n#define\t_SYS_SYSENT_H_\n\n#include <bsm/audit.h>\n\nstruct rlimit;\nstruct sysent;\nstruct thread;\nstruct ksiginfo;\n\ntypedef\tint\tsy_call_t(struct thread *, void *);\n\n/* Used by the machine dependent syscall() code. */\ntypedef\tvoid (*systrace_probe_func_t)(u_int32_t, int, struct sysent *, void *,\n    int);\n\n/*\n * Used by loaded syscalls to convert arguments to a DTrace array\n * of 64-bit arguments.\n */\ntypedef\tvoid (*systrace_args_func_t)(int, void *, u_int64_t *, int *);\n\nextern systrace_probe_func_t\tsystrace_probe_func;\n\nstruct sysent {\t\t\t/* system call table */\n\tint\tsy_narg;\t/* number of arguments */\n\tsy_call_t *sy_call;\t/* implementing function */\n\tau_event_t sy_auevent;\t/* audit event associated with syscall */\n\tsystrace_args_func_t sy_systrace_args_func;\n\t\t\t\t/* optional argument conversion function. */\n\tu_int32_t sy_entry;\t/* DTrace entry ID for systrace. */\n\tu_int32_t sy_return;\t/* DTrace return ID for systrace. */\n\tu_int32_t sy_flags;\t/* General flags for system calls. */\n\tu_int32_t sy_thrcnt;\n};\n\n/*\n * A system call is permitted in capability mode.\n */\n#define\tSYF_CAPENABLED\t0x00000001\n\n#define\tSY_THR_FLAGMASK\t0x7\n#define\tSY_THR_STATIC\t0x1\n#define\tSY_THR_DRAINING\t0x2\n#define\tSY_THR_ABSENT\t0x4\n#define\tSY_THR_INCR\t0x8\n\nstruct image_params;\nstruct __sigset;\nstruct syscall_args;\nstruct trapframe;\nstruct vnode;\n\nstruct sysentvec {\n\tint\t\tsv_size;\t/* number of entries */\n\tstruct sysent\t*sv_table;\t/* pointer to sysent */\n\tu_int\t\tsv_mask;\t/* optional mask to index */\n\tint\t\tsv_sigsize;\t/* size of signal translation table */\n\tint\t\t*sv_sigtbl;\t/* signal translation table */\n\tint\t\tsv_errsize;\t/* size of errno translation table */\n\tint \t\t*sv_errtbl;\t/* errno translation table */\n\tint\t\t(*sv_transtrap)(int, int);\n\t\t\t\t\t/* translate trap-to-signal mapping */\n\tint\t\t(*sv_fixup)(register_t **, struct image_params *);\n\t\t\t\t\t/* stack fixup function */\n\tvoid\t\t(*sv_sendsig)(void (*)(int), struct ksiginfo *, struct __sigset *);\n\t\t\t    \t\t/* send signal */\n\tchar \t\t*sv_sigcode;\t/* start of sigtramp code */\n\tint \t\t*sv_szsigcode;\t/* size of sigtramp code */\n\tvoid\t\t(*sv_prepsyscall)(struct trapframe *, int *, u_int *,\n\t\t\t    caddr_t *);\n\tchar\t\t*sv_name;\t/* name of binary type */\n\tint\t\t(*sv_coredump)(struct thread *, struct vnode *, off_t, int);\n\t\t\t\t\t/* function to dump core, or NULL */\n\tint\t\t(*sv_imgact_try)(struct image_params *);\n\tint\t\tsv_minsigstksz;\t/* minimum signal stack size */\n\tint\t\tsv_pagesize;\t/* pagesize */\n\tvm_offset_t\tsv_minuser;\t/* VM_MIN_ADDRESS */\n\tvm_offset_t\tsv_maxuser;\t/* VM_MAXUSER_ADDRESS */\n\tvm_offset_t\tsv_usrstack;\t/* USRSTACK */\n\tvm_offset_t\tsv_psstrings;\t/* PS_STRINGS */\n\tint\t\tsv_stackprot;\t/* vm protection for stack */\n\tregister_t\t*(*sv_copyout_strings)(struct image_params *);\n\tvoid\t\t(*sv_setregs)(struct thread *, struct image_params *,\n\t\t\t    u_long);\n\tvoid\t\t(*sv_fixlimit)(struct rlimit *, int);\n\tu_long\t\t*sv_maxssiz;\n\tu_int\t\tsv_flags;\n\tvoid\t\t(*sv_set_syscall_retval)(struct thread *, int);\n\tint\t\t(*sv_fetch_syscall_args)(struct thread *, struct\n\t\t\t    syscall_args *);\n\tconst char\t**sv_syscallnames;\n\tvm_offset_t\tsv_shared_page_base;\n\tvm_offset_t\tsv_shared_page_len;\n\tvm_offset_t\tsv_sigcode_base;\n\tvoid\t\t*sv_shared_page_obj;\n\tvoid\t\t(*sv_schedtail)(struct thread *);\n};\n\n#define\tSV_ILP32\t0x000100\n#define\tSV_LP64\t\t0x000200\n#define\tSV_IA32\t\t0x004000\n#define\tSV_AOUT\t\t0x008000\n#define\tSV_SHP\t\t0x010000\n\n#define\tSV_ABI_MASK\t0xff\n#define\tSV_PROC_FLAG(p, x)\t((p)->p_sysent->sv_flags & (x))\n#define\tSV_PROC_ABI(p)\t\t((p)->p_sysent->sv_flags & SV_ABI_MASK)\n#define\tSV_CURPROC_FLAG(x)\tSV_PROC_FLAG(curproc, x)\n#define\tSV_CURPROC_ABI()\tSV_PROC_ABI(curproc)\n/* same as ELFOSABI_XXX, to prevent header pollution */\n#define\tSV_ABI_LINUX\t3\n#define\tSV_ABI_FREEBSD \t9\n#define\tSV_ABI_UNDEF\t255\n\n#ifdef _KERNEL\nextern struct sysentvec aout_sysvec;\nextern struct sysentvec elf_freebsd_sysvec;\nextern struct sysentvec null_sysvec;\nextern struct sysent sysent[];\nextern const char *syscallnames[];\n\n#define\tNO_SYSCALL (-1)\n\nstruct module;\n\nstruct syscall_module_data {\n\tint\t(*chainevh)(struct module *, int, void *); /* next handler */\n\tvoid\t*chainarg;\t\t/* arg for next event handler */\n\tint\t*offset;\t\t/* offset into sysent */\n\tstruct sysent *new_sysent;\t/* new sysent */\n\tstruct sysent old_sysent;\t/* old sysent */\n};\n\n#define\tMAKE_SYSENT(syscallname)\t\t\t\t\\\nstatic struct sysent syscallname##_sysent = {\t\t\t\\\n\t(sizeof(struct syscallname ## _args )\t\t\t\\\n\t    / sizeof(register_t)),\t\t\t\t\\\n\t(sy_call_t *)& sys_##syscallname,\t       \t\t\\\n\tSYS_AUE_##syscallname\t\t\t\t\t\\\n}\n\n#define\tMAKE_SYSENT_COMPAT(syscallname)\t\t\t\t\\\nstatic struct sysent syscallname##_sysent = {\t\t\t\\\n\t(sizeof(struct syscallname ## _args )\t\t\t\\\n\t    / sizeof(register_t)),\t\t\t\t\\\n\t(sy_call_t *)& syscallname,\t\t\t\t\\\n\tSYS_AUE_##syscallname\t\t\t\t\t\\\n}\n\n#define SYSCALL_MODULE(name, offset, new_sysent, evh, arg)\t\\\nstatic struct syscall_module_data name##_syscall_mod = {\t\\\n\tevh, arg, offset, new_sysent, { 0, NULL, AUE_NULL }\t\\\n};\t\t\t\t\t\t\t\t\\\n\t\t\t\t\t\t\t\t\\\nstatic moduledata_t name##_mod = {\t\t\t\t\\\n\t\"sys/\" #name,\t\t\t\t\t\t\\\n\tsyscall_module_handler,\t\t\t\t\t\\\n\t&name##_syscall_mod\t\t\t\t\t\\\n};\t\t\t\t\t\t\t\t\\\nDECLARE_MODULE(name, name##_mod, SI_SUB_SYSCALLS, SI_ORDER_MIDDLE)\n\n#define\tSYSCALL_MODULE_HELPER(syscallname)\t\t\t\\\nstatic int syscallname##_syscall = SYS_##syscallname;\t\t\\\nMAKE_SYSENT(syscallname);\t\t\t\t\t\\\nSYSCALL_MODULE(syscallname,\t\t\t\t\t\\\n    & syscallname##_syscall, & syscallname##_sysent,\t\t\\\n    NULL, NULL)\n\n#define\tSYSCALL_MODULE_PRESENT(syscallname)\t\t\t\t\\\n\t(sysent[SYS_##syscallname].sy_call != (sy_call_t *)lkmnosys &&\t\\\n\tsysent[SYS_##syscallname].sy_call != (sy_call_t *)lkmressys)\n\n/*\n * Syscall registration helpers with resource allocation handling.\n */\nstruct syscall_helper_data {\n\tstruct sysent new_sysent;\n\tstruct sysent old_sysent;\n\tint syscall_no;\n\tint registered;\n};\n#define SYSCALL_INIT_HELPER(syscallname) {\t\t\t\\\n    .new_sysent = {\t\t\t\t\t\t\\\n\t.sy_narg = (sizeof(struct syscallname ## _args )\t\\\n\t    / sizeof(register_t)),\t\t\t\t\\\n\t.sy_call = (sy_call_t *)& sys_ ## syscallname,\t\t\\\n\t.sy_auevent = SYS_AUE_##syscallname\t\t\t\\\n    },\t\t\t\t\t\t\t\t\\\n    .syscall_no = SYS_##syscallname\t\t\t\t\\\n}\n#define SYSCALL_INIT_HELPER_COMPAT(syscallname) {\t\t\\\n    .new_sysent = {\t\t\t\t\t\t\\\n\t.sy_narg = (sizeof(struct syscallname ## _args )\t\\\n\t    / sizeof(register_t)),\t\t\t\t\\\n\t.sy_call = (sy_call_t *)& syscallname,\t\t\t\\\n\t.sy_auevent = SYS_AUE_##syscallname\t\t\t\\\n    },\t\t\t\t\t\t\t\t\\\n    .syscall_no = SYS_##syscallname\t\t\t\t\\\n}\n#define SYSCALL_INIT_LAST {\t\t\t\t\t\\\n    .syscall_no = NO_SYSCALL\t\t\t\t\t\\\n}\n\nint\tsyscall_register(int *offset, struct sysent *new_sysent,\n\t    struct sysent *old_sysent);\nint\tsyscall_deregister(int *offset, struct sysent *old_sysent);\nint\tsyscall_module_handler(struct module *mod, int what, void *arg);\nint\tsyscall_helper_register(struct syscall_helper_data *sd);\nint\tsyscall_helper_unregister(struct syscall_helper_data *sd);\n\nstruct proc;\nconst char *syscallname(struct proc *p, u_int code);\n\n/* Special purpose system call functions. */\nstruct nosys_args;\n\nint\tlkmnosys(struct thread *, struct nosys_args *);\nint\tlkmressys(struct thread *, struct nosys_args *);\n\nint\tsyscall_thread_enter(struct thread *td, struct sysent *se);\nvoid\tsyscall_thread_exit(struct thread *td, struct sysent *se);\n\nint shared_page_fill(int size, int align, const char *data);\nvoid exec_sysvec_init(void *param);\n\n#define INIT_SYSENTVEC(name, sv)\t\t\t\t\t\\\n    SYSINIT(name, SI_SUB_EXEC, SI_ORDER_ANY,\t\t\t\t\\\n\t(sysinit_cfunc_t)exec_sysvec_init, sv);\n\n#endif /* _KERNEL */\n\n#endif /* !_SYS_SYSENT_H_ */\n"
  },
  {
    "path": "freebsd-headers/sys/syslimits.h",
    "content": "/*-\n * Copyright (c) 1988, 1993\n *\tThe Regents of the University of California.  All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 4. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t@(#)syslimits.h\t8.1 (Berkeley) 6/2/93\n * $FreeBSD: release/9.0.0/sys/sys/syslimits.h 194498 2009-06-19 17:10:35Z brooks $\n */\n\n#ifndef _SYS_SYSLIMITS_H_\n#define _SYS_SYSLIMITS_H_\n\n#if !defined(_KERNEL) && !defined(_LIMITS_H_) && !defined(_SYS_PARAM_H_)\n#ifndef _SYS_CDEFS_H_\n#error this file needs sys/cdefs.h as a prerequisite\n#endif\n#ifdef __CC_SUPPORTS_WARNING\n#warning \"No user-serviceable parts inside.\"\n#endif\n#endif\n\n/*\n * Do not add any new variables here.  (See the comment at the end of\n * the file for why.)\n */\n#define\tARG_MAX\t\t\t262144\t/* max bytes for an exec function */\n#ifndef CHILD_MAX\n#define\tCHILD_MAX\t\t   40\t/* max simultaneous processes */\n#endif\n#define\tLINK_MAX\t\t32767\t/* max file link count */\n#define\tMAX_CANON\t\t  255\t/* max bytes in term canon input line */\n#define\tMAX_INPUT\t\t  255\t/* max bytes in terminal input */\n#define\tNAME_MAX\t\t  255\t/* max bytes in a file name */\n#ifndef NGROUPS_MAX\n#define\tNGROUPS_MAX\t \t 1023\t/* max supplemental group id's */\n#endif\n#ifndef OPEN_MAX\n#define\tOPEN_MAX\t\t   64\t/* max open files per process */\n#endif\n#define\tPATH_MAX\t\t 1024\t/* max bytes in pathname */\n#define\tPIPE_BUF\t\t  512\t/* max bytes for atomic pipe writes */\n#define\tIOV_MAX\t\t\t 1024\t/* max elements in i/o vector */\n\n/*\n * We leave the following values undefined to force applications to either\n * assume conservative values or call sysconf() to get the current value.\n *\n * HOST_NAME_MAX\n *\n * (We should do this for most of the values currently defined here,\n * but many programs are not prepared to deal with this yet.)\n */\n#endif\n"
  },
  {
    "path": "freebsd-headers/sys/syslog.h",
    "content": "/*-\n * Copyright (c) 1982, 1986, 1988, 1993\n *\tThe Regents of the University of California.  All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 4. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t@(#)syslog.h\t8.1 (Berkeley) 6/2/93\n * $FreeBSD: release/9.0.0/sys/sys/syslog.h 189815 2009-03-14 19:07:25Z das $\n */\n\n#ifndef _SYS_SYSLOG_H_\n#define _SYS_SYSLOG_H_\n\n#define\t_PATH_LOG\t\"/var/run/log\"\n#define\t_PATH_LOG_PRIV\t\"/var/run/logpriv\"\n#define\t_PATH_OLDLOG\t\"/dev/log\"\t/* backward compatibility */\n\n/*\n * priorities/facilities are encoded into a single 32-bit quantity, where the\n * bottom 3 bits are the priority (0-7) and the top 28 bits are the facility\n * (0-big number).  Both the priorities and the facilities map roughly\n * one-to-one to strings in the syslogd(8) source code.  This mapping is\n * included in this file.\n *\n * priorities (these are ordered)\n */\n#define\tLOG_EMERG\t0\t/* system is unusable */\n#define\tLOG_ALERT\t1\t/* action must be taken immediately */\n#define\tLOG_CRIT\t2\t/* critical conditions */\n#define\tLOG_ERR\t\t3\t/* error conditions */\n#define\tLOG_WARNING\t4\t/* warning conditions */\n#define\tLOG_NOTICE\t5\t/* normal but significant condition */\n#define\tLOG_INFO\t6\t/* informational */\n#define\tLOG_DEBUG\t7\t/* debug-level messages */\n\n#define\tLOG_PRIMASK\t0x07\t/* mask to extract priority part (internal) */\n\t\t\t\t/* extract priority */\n#define\tLOG_PRI(p)\t((p) & LOG_PRIMASK)\n#define\tLOG_MAKEPRI(fac, pri)\t((fac) | (pri))\n\n#ifdef SYSLOG_NAMES\n#define\tINTERNAL_NOPRI\t0x10\t/* the \"no priority\" priority */\n\t\t\t\t/* mark \"facility\" */\n#define\tINTERNAL_MARK\tLOG_MAKEPRI((LOG_NFACILITIES<<3), 0)\ntypedef struct _code {\n\tconst char\t*c_name;\n\tint\t\tc_val;\n} CODE;\n\nCODE prioritynames[] = {\n\t{ \"alert\",\tLOG_ALERT,\t},\n\t{ \"crit\",\tLOG_CRIT,\t},\n\t{ \"debug\",\tLOG_DEBUG,\t},\n\t{ \"emerg\",\tLOG_EMERG,\t},\n\t{ \"err\",\tLOG_ERR,\t},\n\t{ \"error\",\tLOG_ERR,\t},\t/* DEPRECATED */\n\t{ \"info\",\tLOG_INFO,\t},\n\t{ \"none\",\tINTERNAL_NOPRI,\t},\t/* INTERNAL */\n\t{ \"notice\",\tLOG_NOTICE,\t},\n\t{ \"panic\", \tLOG_EMERG,\t},\t/* DEPRECATED */\n\t{ \"warn\",\tLOG_WARNING,\t},\t/* DEPRECATED */\n\t{ \"warning\",\tLOG_WARNING,\t},\n\t{ NULL,\t\t-1,\t\t}\n};\n#endif\n\n/* facility codes */\n#define\tLOG_KERN\t(0<<3)\t/* kernel messages */\n#define\tLOG_USER\t(1<<3)\t/* random user-level messages */\n#define\tLOG_MAIL\t(2<<3)\t/* mail system */\n#define\tLOG_DAEMON\t(3<<3)\t/* system daemons */\n#define\tLOG_AUTH\t(4<<3)\t/* authorization messages */\n#define\tLOG_SYSLOG\t(5<<3)\t/* messages generated internally by syslogd */\n#define\tLOG_LPR\t\t(6<<3)\t/* line printer subsystem */\n#define\tLOG_NEWS\t(7<<3)\t/* network news subsystem */\n#define\tLOG_UUCP\t(8<<3)\t/* UUCP subsystem */\n#define\tLOG_CRON\t(9<<3)\t/* clock daemon */\n#define\tLOG_AUTHPRIV\t(10<<3)\t/* authorization messages (private) */\n\t\t\t\t/* Facility #10 clashes in DEC UNIX, where */\n\t\t\t\t/* it's defined as LOG_MEGASAFE for AdvFS  */\n\t\t\t\t/* event logging.                          */\n#define\tLOG_FTP\t\t(11<<3)\t/* ftp daemon */\n#define\tLOG_NTP\t\t(12<<3)\t/* NTP subsystem */\n#define\tLOG_SECURITY\t(13<<3) /* security subsystems (firewalling, etc.) */\n#define\tLOG_CONSOLE\t(14<<3) /* /dev/console output */\n\n\t/* other codes through 15 reserved for system use */\n#define\tLOG_LOCAL0\t(16<<3)\t/* reserved for local use */\n#define\tLOG_LOCAL1\t(17<<3)\t/* reserved for local use */\n#define\tLOG_LOCAL2\t(18<<3)\t/* reserved for local use */\n#define\tLOG_LOCAL3\t(19<<3)\t/* reserved for local use */\n#define\tLOG_LOCAL4\t(20<<3)\t/* reserved for local use */\n#define\tLOG_LOCAL5\t(21<<3)\t/* reserved for local use */\n#define\tLOG_LOCAL6\t(22<<3)\t/* reserved for local use */\n#define\tLOG_LOCAL7\t(23<<3)\t/* reserved for local use */\n\n#define\tLOG_NFACILITIES\t24\t/* current number of facilities */\n#define\tLOG_FACMASK\t0x03f8\t/* mask to extract facility part */\n\t\t\t\t/* facility of pri */\n#define\tLOG_FAC(p)\t(((p) & LOG_FACMASK) >> 3)\n\n#ifdef SYSLOG_NAMES\nCODE facilitynames[] = {\n\t{ \"auth\",\tLOG_AUTH,\t},\n\t{ \"authpriv\",\tLOG_AUTHPRIV,\t},\n\t{ \"console\", \tLOG_CONSOLE,\t},\n\t{ \"cron\", \tLOG_CRON,\t},\n\t{ \"daemon\",\tLOG_DAEMON,\t},\n\t{ \"ftp\",\tLOG_FTP,\t},\n\t{ \"kern\",\tLOG_KERN,\t},\n\t{ \"lpr\",\tLOG_LPR,\t},\n\t{ \"mail\",\tLOG_MAIL,\t},\n\t{ \"mark\", \tINTERNAL_MARK,\t},\t/* INTERNAL */\n\t{ \"news\",\tLOG_NEWS,\t},\n\t{ \"ntp\",\tLOG_NTP,\t},\n\t{ \"security\",\tLOG_SECURITY,\t},\n\t{ \"syslog\",\tLOG_SYSLOG,\t},\n\t{ \"user\",\tLOG_USER,\t},\n\t{ \"uucp\",\tLOG_UUCP,\t},\n\t{ \"local0\",\tLOG_LOCAL0,\t},\n\t{ \"local1\",\tLOG_LOCAL1,\t},\n\t{ \"local2\",\tLOG_LOCAL2,\t},\n\t{ \"local3\",\tLOG_LOCAL3,\t},\n\t{ \"local4\",\tLOG_LOCAL4,\t},\n\t{ \"local5\",\tLOG_LOCAL5,\t},\n\t{ \"local6\",\tLOG_LOCAL6,\t},\n\t{ \"local7\",\tLOG_LOCAL7,\t},\n\t{ NULL,\t\t-1,\t\t}\n};\n#endif\n\n#ifdef _KERNEL\n#define\tLOG_PRINTF\t-1\t/* pseudo-priority to indicate use of printf */\n#endif\n\n/*\n * arguments to setlogmask.\n */\n#define\tLOG_MASK(pri)\t(1 << (pri))\t\t/* mask for one priority */\n#define\tLOG_UPTO(pri)\t((1 << ((pri)+1)) - 1)\t/* all priorities through pri */\n\n/*\n * Option flags for openlog.\n *\n * LOG_ODELAY no longer does anything.\n * LOG_NDELAY is the inverse of what it used to be.\n */\n#define\tLOG_PID\t\t0x01\t/* log the pid with each message */\n#define\tLOG_CONS\t0x02\t/* log on the console if errors in sending */\n#define\tLOG_ODELAY\t0x04\t/* delay open until first syslog() (default) */\n#define\tLOG_NDELAY\t0x08\t/* don't delay open */\n#define\tLOG_NOWAIT\t0x10\t/* don't wait for console forks: DEPRECATED */\n#define\tLOG_PERROR\t0x20\t/* log to stderr as well */\n\n#ifdef _KERNEL\n\n#else /* not _KERNEL */\n\n/*\n * Don't use va_list in the vsyslog() prototype.   Va_list is typedef'd in two\n * places (<machine/varargs.h> and <machine/stdarg.h>), so if we include one\n * of them here we may collide with the utility's includes.  It's unreasonable\n * for utilities to have to include one of them to include syslog.h, so we get\n * __va_list from <sys/_types.h> and use it.\n */\n#include <sys/cdefs.h>\n#include <sys/_types.h>\n\n__BEGIN_DECLS\nvoid\tcloselog(void);\nvoid\topenlog(const char *, int, int);\nint\tsetlogmask(int);\nvoid\tsyslog(int, const char *, ...) __printflike(2, 3);\n#if __BSD_VISIBLE\nvoid\tvsyslog(int, const char *, __va_list) __printflike(2, 0);\n#endif\n__END_DECLS\n\n#endif /* !_KERNEL */\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/sys/sysproto.h",
    "content": "/*\n * System call prototypes.\n *\n * DO NOT EDIT-- this file is automatically generated.\n * $FreeBSD: release/9.0.0/sys/sys/sysproto.h 225618 2011-09-16 14:04:14Z kmacy $\n * created from FreeBSD: head/sys/kern/syscalls.master 224987 2011-08-18 22:51:30Z jonathan \n */\n\n#ifndef _SYS_SYSPROTO_H_\n#define\t_SYS_SYSPROTO_H_\n\n#include <sys/signal.h>\n#include <sys/acl.h>\n#include <sys/cpuset.h>\n#include <sys/_semaphore.h>\n#include <sys/ucontext.h>\n\n#include <bsm/audit_kevents.h>\n\nstruct proc;\n\nstruct thread;\n\n#define\tPAD_(t)\t(sizeof(register_t) <= sizeof(t) ? \\\n\t\t0 : sizeof(register_t) - sizeof(t))\n\n#if BYTE_ORDER == LITTLE_ENDIAN\n#define\tPADL_(t)\t0\n#define\tPADR_(t)\tPAD_(t)\n#else\n#define\tPADL_(t)\tPAD_(t)\n#define\tPADR_(t)\t0\n#endif\n\nstruct nosys_args {\n\tregister_t dummy;\n};\nstruct sys_exit_args {\n\tchar rval_l_[PADL_(int)]; int rval; char rval_r_[PADR_(int)];\n};\nstruct fork_args {\n\tregister_t dummy;\n};\nstruct read_args {\n\tchar fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)];\n\tchar buf_l_[PADL_(void *)]; void * buf; char buf_r_[PADR_(void *)];\n\tchar nbyte_l_[PADL_(size_t)]; size_t nbyte; char nbyte_r_[PADR_(size_t)];\n};\nstruct write_args {\n\tchar fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)];\n\tchar buf_l_[PADL_(const void *)]; const void * buf; char buf_r_[PADR_(const void *)];\n\tchar nbyte_l_[PADL_(size_t)]; size_t nbyte; char nbyte_r_[PADR_(size_t)];\n};\nstruct open_args {\n\tchar path_l_[PADL_(char *)]; char * path; char path_r_[PADR_(char *)];\n\tchar flags_l_[PADL_(int)]; int flags; char flags_r_[PADR_(int)];\n\tchar mode_l_[PADL_(int)]; int mode; char mode_r_[PADR_(int)];\n};\nstruct close_args {\n\tchar fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)];\n};\nstruct wait_args {\n\tchar pid_l_[PADL_(int)]; int pid; char pid_r_[PADR_(int)];\n\tchar status_l_[PADL_(int *)]; int * status; char status_r_[PADR_(int *)];\n\tchar options_l_[PADL_(int)]; int options; char options_r_[PADR_(int)];\n\tchar rusage_l_[PADL_(struct rusage *)]; struct rusage * rusage; char rusage_r_[PADR_(struct rusage *)];\n};\nstruct link_args {\n\tchar path_l_[PADL_(char *)]; char * path; char path_r_[PADR_(char *)];\n\tchar link_l_[PADL_(char *)]; char * link; char link_r_[PADR_(char *)];\n};\nstruct unlink_args {\n\tchar path_l_[PADL_(char *)]; char * path; char path_r_[PADR_(char *)];\n};\nstruct chdir_args {\n\tchar path_l_[PADL_(char *)]; char * path; char path_r_[PADR_(char *)];\n};\nstruct fchdir_args {\n\tchar fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)];\n};\nstruct mknod_args {\n\tchar path_l_[PADL_(char *)]; char * path; char path_r_[PADR_(char *)];\n\tchar mode_l_[PADL_(int)]; int mode; char mode_r_[PADR_(int)];\n\tchar dev_l_[PADL_(int)]; int dev; char dev_r_[PADR_(int)];\n};\nstruct chmod_args {\n\tchar path_l_[PADL_(char *)]; char * path; char path_r_[PADR_(char *)];\n\tchar mode_l_[PADL_(int)]; int mode; char mode_r_[PADR_(int)];\n};\nstruct chown_args {\n\tchar path_l_[PADL_(char *)]; char * path; char path_r_[PADR_(char *)];\n\tchar uid_l_[PADL_(int)]; int uid; char uid_r_[PADR_(int)];\n\tchar gid_l_[PADL_(int)]; int gid; char gid_r_[PADR_(int)];\n};\nstruct obreak_args {\n\tchar nsize_l_[PADL_(char *)]; char * nsize; char nsize_r_[PADR_(char *)];\n};\nstruct getpid_args {\n\tregister_t dummy;\n};\nstruct mount_args {\n\tchar type_l_[PADL_(char *)]; char * type; char type_r_[PADR_(char *)];\n\tchar path_l_[PADL_(char *)]; char * path; char path_r_[PADR_(char *)];\n\tchar flags_l_[PADL_(int)]; int flags; char flags_r_[PADR_(int)];\n\tchar data_l_[PADL_(caddr_t)]; caddr_t data; char data_r_[PADR_(caddr_t)];\n};\nstruct unmount_args {\n\tchar path_l_[PADL_(char *)]; char * path; char path_r_[PADR_(char *)];\n\tchar flags_l_[PADL_(int)]; int flags; char flags_r_[PADR_(int)];\n};\nstruct setuid_args {\n\tchar uid_l_[PADL_(uid_t)]; uid_t uid; char uid_r_[PADR_(uid_t)];\n};\nstruct getuid_args {\n\tregister_t dummy;\n};\nstruct geteuid_args {\n\tregister_t dummy;\n};\nstruct ptrace_args {\n\tchar req_l_[PADL_(int)]; int req; char req_r_[PADR_(int)];\n\tchar pid_l_[PADL_(pid_t)]; pid_t pid; char pid_r_[PADR_(pid_t)];\n\tchar addr_l_[PADL_(caddr_t)]; caddr_t addr; char addr_r_[PADR_(caddr_t)];\n\tchar data_l_[PADL_(int)]; int data; char data_r_[PADR_(int)];\n};\nstruct recvmsg_args {\n\tchar s_l_[PADL_(int)]; int s; char s_r_[PADR_(int)];\n\tchar msg_l_[PADL_(struct msghdr *)]; struct msghdr * msg; char msg_r_[PADR_(struct msghdr *)];\n\tchar flags_l_[PADL_(int)]; int flags; char flags_r_[PADR_(int)];\n};\nstruct sendmsg_args {\n\tchar s_l_[PADL_(int)]; int s; char s_r_[PADR_(int)];\n\tchar msg_l_[PADL_(struct msghdr *)]; struct msghdr * msg; char msg_r_[PADR_(struct msghdr *)];\n\tchar flags_l_[PADL_(int)]; int flags; char flags_r_[PADR_(int)];\n};\nstruct recvfrom_args {\n\tchar s_l_[PADL_(int)]; int s; char s_r_[PADR_(int)];\n\tchar buf_l_[PADL_(caddr_t)]; caddr_t buf; char buf_r_[PADR_(caddr_t)];\n\tchar len_l_[PADL_(size_t)]; size_t len; char len_r_[PADR_(size_t)];\n\tchar flags_l_[PADL_(int)]; int flags; char flags_r_[PADR_(int)];\n\tchar from_l_[PADL_(struct sockaddr *__restrict)]; struct sockaddr *__restrict from; char from_r_[PADR_(struct sockaddr *__restrict)];\n\tchar fromlenaddr_l_[PADL_(__socklen_t *__restrict)]; __socklen_t *__restrict fromlenaddr; char fromlenaddr_r_[PADR_(__socklen_t *__restrict)];\n};\nstruct accept_args {\n\tchar s_l_[PADL_(int)]; int s; char s_r_[PADR_(int)];\n\tchar name_l_[PADL_(struct sockaddr *__restrict)]; struct sockaddr *__restrict name; char name_r_[PADR_(struct sockaddr *__restrict)];\n\tchar anamelen_l_[PADL_(__socklen_t *__restrict)]; __socklen_t *__restrict anamelen; char anamelen_r_[PADR_(__socklen_t *__restrict)];\n};\nstruct getpeername_args {\n\tchar fdes_l_[PADL_(int)]; int fdes; char fdes_r_[PADR_(int)];\n\tchar asa_l_[PADL_(struct sockaddr *__restrict)]; struct sockaddr *__restrict asa; char asa_r_[PADR_(struct sockaddr *__restrict)];\n\tchar alen_l_[PADL_(__socklen_t *__restrict)]; __socklen_t *__restrict alen; char alen_r_[PADR_(__socklen_t *__restrict)];\n};\nstruct getsockname_args {\n\tchar fdes_l_[PADL_(int)]; int fdes; char fdes_r_[PADR_(int)];\n\tchar asa_l_[PADL_(struct sockaddr *__restrict)]; struct sockaddr *__restrict asa; char asa_r_[PADR_(struct sockaddr *__restrict)];\n\tchar alen_l_[PADL_(__socklen_t *__restrict)]; __socklen_t *__restrict alen; char alen_r_[PADR_(__socklen_t *__restrict)];\n};\nstruct access_args {\n\tchar path_l_[PADL_(char *)]; char * path; char path_r_[PADR_(char *)];\n\tchar flags_l_[PADL_(int)]; int flags; char flags_r_[PADR_(int)];\n};\nstruct chflags_args {\n\tchar path_l_[PADL_(char *)]; char * path; char path_r_[PADR_(char *)];\n\tchar flags_l_[PADL_(int)]; int flags; char flags_r_[PADR_(int)];\n};\nstruct fchflags_args {\n\tchar fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)];\n\tchar flags_l_[PADL_(int)]; int flags; char flags_r_[PADR_(int)];\n};\nstruct sync_args {\n\tregister_t dummy;\n};\nstruct kill_args {\n\tchar pid_l_[PADL_(int)]; int pid; char pid_r_[PADR_(int)];\n\tchar signum_l_[PADL_(int)]; int signum; char signum_r_[PADR_(int)];\n};\nstruct getppid_args {\n\tregister_t dummy;\n};\nstruct dup_args {\n\tchar fd_l_[PADL_(u_int)]; u_int fd; char fd_r_[PADR_(u_int)];\n};\nstruct pipe_args {\n\tregister_t dummy;\n};\nstruct getegid_args {\n\tregister_t dummy;\n};\nstruct profil_args {\n\tchar samples_l_[PADL_(caddr_t)]; caddr_t samples; char samples_r_[PADR_(caddr_t)];\n\tchar size_l_[PADL_(size_t)]; size_t size; char size_r_[PADR_(size_t)];\n\tchar offset_l_[PADL_(size_t)]; size_t offset; char offset_r_[PADR_(size_t)];\n\tchar scale_l_[PADL_(u_int)]; u_int scale; char scale_r_[PADR_(u_int)];\n};\nstruct ktrace_args {\n\tchar fname_l_[PADL_(const char *)]; const char * fname; char fname_r_[PADR_(const char *)];\n\tchar ops_l_[PADL_(int)]; int ops; char ops_r_[PADR_(int)];\n\tchar facs_l_[PADL_(int)]; int facs; char facs_r_[PADR_(int)];\n\tchar pid_l_[PADL_(int)]; int pid; char pid_r_[PADR_(int)];\n};\nstruct getgid_args {\n\tregister_t dummy;\n};\nstruct getlogin_args {\n\tchar namebuf_l_[PADL_(char *)]; char * namebuf; char namebuf_r_[PADR_(char *)];\n\tchar namelen_l_[PADL_(u_int)]; u_int namelen; char namelen_r_[PADR_(u_int)];\n};\nstruct setlogin_args {\n\tchar namebuf_l_[PADL_(char *)]; char * namebuf; char namebuf_r_[PADR_(char *)];\n};\nstruct acct_args {\n\tchar path_l_[PADL_(char *)]; char * path; char path_r_[PADR_(char *)];\n};\nstruct osigpending_args {\n\tregister_t dummy;\n};\nstruct sigaltstack_args {\n\tchar ss_l_[PADL_(stack_t *)]; stack_t * ss; char ss_r_[PADR_(stack_t *)];\n\tchar oss_l_[PADL_(stack_t *)]; stack_t * oss; char oss_r_[PADR_(stack_t *)];\n};\nstruct ioctl_args {\n\tchar fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)];\n\tchar com_l_[PADL_(u_long)]; u_long com; char com_r_[PADR_(u_long)];\n\tchar data_l_[PADL_(caddr_t)]; caddr_t data; char data_r_[PADR_(caddr_t)];\n};\nstruct reboot_args {\n\tchar opt_l_[PADL_(int)]; int opt; char opt_r_[PADR_(int)];\n};\nstruct revoke_args {\n\tchar path_l_[PADL_(char *)]; char * path; char path_r_[PADR_(char *)];\n};\nstruct symlink_args {\n\tchar path_l_[PADL_(char *)]; char * path; char path_r_[PADR_(char *)];\n\tchar link_l_[PADL_(char *)]; char * link; char link_r_[PADR_(char *)];\n};\nstruct readlink_args {\n\tchar path_l_[PADL_(char *)]; char * path; char path_r_[PADR_(char *)];\n\tchar buf_l_[PADL_(char *)]; char * buf; char buf_r_[PADR_(char *)];\n\tchar count_l_[PADL_(size_t)]; size_t count; char count_r_[PADR_(size_t)];\n};\nstruct execve_args {\n\tchar fname_l_[PADL_(char *)]; char * fname; char fname_r_[PADR_(char *)];\n\tchar argv_l_[PADL_(char **)]; char ** argv; char argv_r_[PADR_(char **)];\n\tchar envv_l_[PADL_(char **)]; char ** envv; char envv_r_[PADR_(char **)];\n};\nstruct umask_args {\n\tchar newmask_l_[PADL_(int)]; int newmask; char newmask_r_[PADR_(int)];\n};\nstruct chroot_args {\n\tchar path_l_[PADL_(char *)]; char * path; char path_r_[PADR_(char *)];\n};\nstruct getpagesize_args {\n\tregister_t dummy;\n};\nstruct msync_args {\n\tchar addr_l_[PADL_(void *)]; void * addr; char addr_r_[PADR_(void *)];\n\tchar len_l_[PADL_(size_t)]; size_t len; char len_r_[PADR_(size_t)];\n\tchar flags_l_[PADL_(int)]; int flags; char flags_r_[PADR_(int)];\n};\nstruct vfork_args {\n\tregister_t dummy;\n};\nstruct sbrk_args {\n\tchar incr_l_[PADL_(int)]; int incr; char incr_r_[PADR_(int)];\n};\nstruct sstk_args {\n\tchar incr_l_[PADL_(int)]; int incr; char incr_r_[PADR_(int)];\n};\nstruct ovadvise_args {\n\tchar anom_l_[PADL_(int)]; int anom; char anom_r_[PADR_(int)];\n};\nstruct munmap_args {\n\tchar addr_l_[PADL_(void *)]; void * addr; char addr_r_[PADR_(void *)];\n\tchar len_l_[PADL_(size_t)]; size_t len; char len_r_[PADR_(size_t)];\n};\nstruct mprotect_args {\n\tchar addr_l_[PADL_(const void *)]; const void * addr; char addr_r_[PADR_(const void *)];\n\tchar len_l_[PADL_(size_t)]; size_t len; char len_r_[PADR_(size_t)];\n\tchar prot_l_[PADL_(int)]; int prot; char prot_r_[PADR_(int)];\n};\nstruct madvise_args {\n\tchar addr_l_[PADL_(void *)]; void * addr; char addr_r_[PADR_(void *)];\n\tchar len_l_[PADL_(size_t)]; size_t len; char len_r_[PADR_(size_t)];\n\tchar behav_l_[PADL_(int)]; int behav; char behav_r_[PADR_(int)];\n};\nstruct mincore_args {\n\tchar addr_l_[PADL_(const void *)]; const void * addr; char addr_r_[PADR_(const void *)];\n\tchar len_l_[PADL_(size_t)]; size_t len; char len_r_[PADR_(size_t)];\n\tchar vec_l_[PADL_(char *)]; char * vec; char vec_r_[PADR_(char *)];\n};\nstruct getgroups_args {\n\tchar gidsetsize_l_[PADL_(u_int)]; u_int gidsetsize; char gidsetsize_r_[PADR_(u_int)];\n\tchar gidset_l_[PADL_(gid_t *)]; gid_t * gidset; char gidset_r_[PADR_(gid_t *)];\n};\nstruct setgroups_args {\n\tchar gidsetsize_l_[PADL_(u_int)]; u_int gidsetsize; char gidsetsize_r_[PADR_(u_int)];\n\tchar gidset_l_[PADL_(gid_t *)]; gid_t * gidset; char gidset_r_[PADR_(gid_t *)];\n};\nstruct getpgrp_args {\n\tregister_t dummy;\n};\nstruct setpgid_args {\n\tchar pid_l_[PADL_(int)]; int pid; char pid_r_[PADR_(int)];\n\tchar pgid_l_[PADL_(int)]; int pgid; char pgid_r_[PADR_(int)];\n};\nstruct setitimer_args {\n\tchar which_l_[PADL_(u_int)]; u_int which; char which_r_[PADR_(u_int)];\n\tchar itv_l_[PADL_(struct itimerval *)]; struct itimerval * itv; char itv_r_[PADR_(struct itimerval *)];\n\tchar oitv_l_[PADL_(struct itimerval *)]; struct itimerval * oitv; char oitv_r_[PADR_(struct itimerval *)];\n};\nstruct owait_args {\n\tregister_t dummy;\n};\nstruct swapon_args {\n\tchar name_l_[PADL_(char *)]; char * name; char name_r_[PADR_(char *)];\n};\nstruct getitimer_args {\n\tchar which_l_[PADL_(u_int)]; u_int which; char which_r_[PADR_(u_int)];\n\tchar itv_l_[PADL_(struct itimerval *)]; struct itimerval * itv; char itv_r_[PADR_(struct itimerval *)];\n};\nstruct getdtablesize_args {\n\tregister_t dummy;\n};\nstruct dup2_args {\n\tchar from_l_[PADL_(u_int)]; u_int from; char from_r_[PADR_(u_int)];\n\tchar to_l_[PADL_(u_int)]; u_int to; char to_r_[PADR_(u_int)];\n};\nstruct fcntl_args {\n\tchar fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)];\n\tchar cmd_l_[PADL_(int)]; int cmd; char cmd_r_[PADR_(int)];\n\tchar arg_l_[PADL_(long)]; long arg; char arg_r_[PADR_(long)];\n};\nstruct select_args {\n\tchar nd_l_[PADL_(int)]; int nd; char nd_r_[PADR_(int)];\n\tchar in_l_[PADL_(fd_set *)]; fd_set * in; char in_r_[PADR_(fd_set *)];\n\tchar ou_l_[PADL_(fd_set *)]; fd_set * ou; char ou_r_[PADR_(fd_set *)];\n\tchar ex_l_[PADL_(fd_set *)]; fd_set * ex; char ex_r_[PADR_(fd_set *)];\n\tchar tv_l_[PADL_(struct timeval *)]; struct timeval * tv; char tv_r_[PADR_(struct timeval *)];\n};\nstruct fsync_args {\n\tchar fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)];\n};\nstruct setpriority_args {\n\tchar which_l_[PADL_(int)]; int which; char which_r_[PADR_(int)];\n\tchar who_l_[PADL_(int)]; int who; char who_r_[PADR_(int)];\n\tchar prio_l_[PADL_(int)]; int prio; char prio_r_[PADR_(int)];\n};\nstruct socket_args {\n\tchar domain_l_[PADL_(int)]; int domain; char domain_r_[PADR_(int)];\n\tchar type_l_[PADL_(int)]; int type; char type_r_[PADR_(int)];\n\tchar protocol_l_[PADL_(int)]; int protocol; char protocol_r_[PADR_(int)];\n};\nstruct connect_args {\n\tchar s_l_[PADL_(int)]; int s; char s_r_[PADR_(int)];\n\tchar name_l_[PADL_(caddr_t)]; caddr_t name; char name_r_[PADR_(caddr_t)];\n\tchar namelen_l_[PADL_(int)]; int namelen; char namelen_r_[PADR_(int)];\n};\nstruct getpriority_args {\n\tchar which_l_[PADL_(int)]; int which; char which_r_[PADR_(int)];\n\tchar who_l_[PADL_(int)]; int who; char who_r_[PADR_(int)];\n};\nstruct bind_args {\n\tchar s_l_[PADL_(int)]; int s; char s_r_[PADR_(int)];\n\tchar name_l_[PADL_(caddr_t)]; caddr_t name; char name_r_[PADR_(caddr_t)];\n\tchar namelen_l_[PADL_(int)]; int namelen; char namelen_r_[PADR_(int)];\n};\nstruct setsockopt_args {\n\tchar s_l_[PADL_(int)]; int s; char s_r_[PADR_(int)];\n\tchar level_l_[PADL_(int)]; int level; char level_r_[PADR_(int)];\n\tchar name_l_[PADL_(int)]; int name; char name_r_[PADR_(int)];\n\tchar val_l_[PADL_(caddr_t)]; caddr_t val; char val_r_[PADR_(caddr_t)];\n\tchar valsize_l_[PADL_(int)]; int valsize; char valsize_r_[PADR_(int)];\n};\nstruct listen_args {\n\tchar s_l_[PADL_(int)]; int s; char s_r_[PADR_(int)];\n\tchar backlog_l_[PADL_(int)]; int backlog; char backlog_r_[PADR_(int)];\n};\nstruct gettimeofday_args {\n\tchar tp_l_[PADL_(struct timeval *)]; struct timeval * tp; char tp_r_[PADR_(struct timeval *)];\n\tchar tzp_l_[PADL_(struct timezone *)]; struct timezone * tzp; char tzp_r_[PADR_(struct timezone *)];\n};\nstruct getrusage_args {\n\tchar who_l_[PADL_(int)]; int who; char who_r_[PADR_(int)];\n\tchar rusage_l_[PADL_(struct rusage *)]; struct rusage * rusage; char rusage_r_[PADR_(struct rusage *)];\n};\nstruct getsockopt_args {\n\tchar s_l_[PADL_(int)]; int s; char s_r_[PADR_(int)];\n\tchar level_l_[PADL_(int)]; int level; char level_r_[PADR_(int)];\n\tchar name_l_[PADL_(int)]; int name; char name_r_[PADR_(int)];\n\tchar val_l_[PADL_(caddr_t)]; caddr_t val; char val_r_[PADR_(caddr_t)];\n\tchar avalsize_l_[PADL_(int *)]; int * avalsize; char avalsize_r_[PADR_(int *)];\n};\nstruct readv_args {\n\tchar fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)];\n\tchar iovp_l_[PADL_(struct iovec *)]; struct iovec * iovp; char iovp_r_[PADR_(struct iovec *)];\n\tchar iovcnt_l_[PADL_(u_int)]; u_int iovcnt; char iovcnt_r_[PADR_(u_int)];\n};\nstruct writev_args {\n\tchar fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)];\n\tchar iovp_l_[PADL_(struct iovec *)]; struct iovec * iovp; char iovp_r_[PADR_(struct iovec *)];\n\tchar iovcnt_l_[PADL_(u_int)]; u_int iovcnt; char iovcnt_r_[PADR_(u_int)];\n};\nstruct settimeofday_args {\n\tchar tv_l_[PADL_(struct timeval *)]; struct timeval * tv; char tv_r_[PADR_(struct timeval *)];\n\tchar tzp_l_[PADL_(struct timezone *)]; struct timezone * tzp; char tzp_r_[PADR_(struct timezone *)];\n};\nstruct fchown_args {\n\tchar fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)];\n\tchar uid_l_[PADL_(int)]; int uid; char uid_r_[PADR_(int)];\n\tchar gid_l_[PADL_(int)]; int gid; char gid_r_[PADR_(int)];\n};\nstruct fchmod_args {\n\tchar fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)];\n\tchar mode_l_[PADL_(int)]; int mode; char mode_r_[PADR_(int)];\n};\nstruct setreuid_args {\n\tchar ruid_l_[PADL_(int)]; int ruid; char ruid_r_[PADR_(int)];\n\tchar euid_l_[PADL_(int)]; int euid; char euid_r_[PADR_(int)];\n};\nstruct setregid_args {\n\tchar rgid_l_[PADL_(int)]; int rgid; char rgid_r_[PADR_(int)];\n\tchar egid_l_[PADL_(int)]; int egid; char egid_r_[PADR_(int)];\n};\nstruct rename_args {\n\tchar from_l_[PADL_(char *)]; char * from; char from_r_[PADR_(char *)];\n\tchar to_l_[PADL_(char *)]; char * to; char to_r_[PADR_(char *)];\n};\nstruct flock_args {\n\tchar fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)];\n\tchar how_l_[PADL_(int)]; int how; char how_r_[PADR_(int)];\n};\nstruct mkfifo_args {\n\tchar path_l_[PADL_(char *)]; char * path; char path_r_[PADR_(char *)];\n\tchar mode_l_[PADL_(int)]; int mode; char mode_r_[PADR_(int)];\n};\nstruct sendto_args {\n\tchar s_l_[PADL_(int)]; int s; char s_r_[PADR_(int)];\n\tchar buf_l_[PADL_(caddr_t)]; caddr_t buf; char buf_r_[PADR_(caddr_t)];\n\tchar len_l_[PADL_(size_t)]; size_t len; char len_r_[PADR_(size_t)];\n\tchar flags_l_[PADL_(int)]; int flags; char flags_r_[PADR_(int)];\n\tchar to_l_[PADL_(caddr_t)]; caddr_t to; char to_r_[PADR_(caddr_t)];\n\tchar tolen_l_[PADL_(int)]; int tolen; char tolen_r_[PADR_(int)];\n};\nstruct shutdown_args {\n\tchar s_l_[PADL_(int)]; int s; char s_r_[PADR_(int)];\n\tchar how_l_[PADL_(int)]; int how; char how_r_[PADR_(int)];\n};\nstruct socketpair_args {\n\tchar domain_l_[PADL_(int)]; int domain; char domain_r_[PADR_(int)];\n\tchar type_l_[PADL_(int)]; int type; char type_r_[PADR_(int)];\n\tchar protocol_l_[PADL_(int)]; int protocol; char protocol_r_[PADR_(int)];\n\tchar rsv_l_[PADL_(int *)]; int * rsv; char rsv_r_[PADR_(int *)];\n};\nstruct mkdir_args {\n\tchar path_l_[PADL_(char *)]; char * path; char path_r_[PADR_(char *)];\n\tchar mode_l_[PADL_(int)]; int mode; char mode_r_[PADR_(int)];\n};\nstruct rmdir_args {\n\tchar path_l_[PADL_(char *)]; char * path; char path_r_[PADR_(char *)];\n};\nstruct utimes_args {\n\tchar path_l_[PADL_(char *)]; char * path; char path_r_[PADR_(char *)];\n\tchar tptr_l_[PADL_(struct timeval *)]; struct timeval * tptr; char tptr_r_[PADR_(struct timeval *)];\n};\nstruct adjtime_args {\n\tchar delta_l_[PADL_(struct timeval *)]; struct timeval * delta; char delta_r_[PADR_(struct timeval *)];\n\tchar olddelta_l_[PADL_(struct timeval *)]; struct timeval * olddelta; char olddelta_r_[PADR_(struct timeval *)];\n};\nstruct ogethostid_args {\n\tregister_t dummy;\n};\nstruct setsid_args {\n\tregister_t dummy;\n};\nstruct quotactl_args {\n\tchar path_l_[PADL_(char *)]; char * path; char path_r_[PADR_(char *)];\n\tchar cmd_l_[PADL_(int)]; int cmd; char cmd_r_[PADR_(int)];\n\tchar uid_l_[PADL_(int)]; int uid; char uid_r_[PADR_(int)];\n\tchar arg_l_[PADL_(caddr_t)]; caddr_t arg; char arg_r_[PADR_(caddr_t)];\n};\nstruct oquota_args {\n\tregister_t dummy;\n};\nstruct nlm_syscall_args {\n\tchar debug_level_l_[PADL_(int)]; int debug_level; char debug_level_r_[PADR_(int)];\n\tchar grace_period_l_[PADL_(int)]; int grace_period; char grace_period_r_[PADR_(int)];\n\tchar addr_count_l_[PADL_(int)]; int addr_count; char addr_count_r_[PADR_(int)];\n\tchar addrs_l_[PADL_(char **)]; char ** addrs; char addrs_r_[PADR_(char **)];\n};\nstruct nfssvc_args {\n\tchar flag_l_[PADL_(int)]; int flag; char flag_r_[PADR_(int)];\n\tchar argp_l_[PADL_(caddr_t)]; caddr_t argp; char argp_r_[PADR_(caddr_t)];\n};\nstruct lgetfh_args {\n\tchar fname_l_[PADL_(char *)]; char * fname; char fname_r_[PADR_(char *)];\n\tchar fhp_l_[PADL_(struct fhandle *)]; struct fhandle * fhp; char fhp_r_[PADR_(struct fhandle *)];\n};\nstruct getfh_args {\n\tchar fname_l_[PADL_(char *)]; char * fname; char fname_r_[PADR_(char *)];\n\tchar fhp_l_[PADL_(struct fhandle *)]; struct fhandle * fhp; char fhp_r_[PADR_(struct fhandle *)];\n};\nstruct sysarch_args {\n\tchar op_l_[PADL_(int)]; int op; char op_r_[PADR_(int)];\n\tchar parms_l_[PADL_(char *)]; char * parms; char parms_r_[PADR_(char *)];\n};\nstruct rtprio_args {\n\tchar function_l_[PADL_(int)]; int function; char function_r_[PADR_(int)];\n\tchar pid_l_[PADL_(pid_t)]; pid_t pid; char pid_r_[PADR_(pid_t)];\n\tchar rtp_l_[PADL_(struct rtprio *)]; struct rtprio * rtp; char rtp_r_[PADR_(struct rtprio *)];\n};\nstruct semsys_args {\n\tchar which_l_[PADL_(int)]; int which; char which_r_[PADR_(int)];\n\tchar a2_l_[PADL_(int)]; int a2; char a2_r_[PADR_(int)];\n\tchar a3_l_[PADL_(int)]; int a3; char a3_r_[PADR_(int)];\n\tchar a4_l_[PADL_(int)]; int a4; char a4_r_[PADR_(int)];\n\tchar a5_l_[PADL_(int)]; int a5; char a5_r_[PADR_(int)];\n};\nstruct msgsys_args {\n\tchar which_l_[PADL_(int)]; int which; char which_r_[PADR_(int)];\n\tchar a2_l_[PADL_(int)]; int a2; char a2_r_[PADR_(int)];\n\tchar a3_l_[PADL_(int)]; int a3; char a3_r_[PADR_(int)];\n\tchar a4_l_[PADL_(int)]; int a4; char a4_r_[PADR_(int)];\n\tchar a5_l_[PADL_(int)]; int a5; char a5_r_[PADR_(int)];\n\tchar a6_l_[PADL_(int)]; int a6; char a6_r_[PADR_(int)];\n};\nstruct shmsys_args {\n\tchar which_l_[PADL_(int)]; int which; char which_r_[PADR_(int)];\n\tchar a2_l_[PADL_(int)]; int a2; char a2_r_[PADR_(int)];\n\tchar a3_l_[PADL_(int)]; int a3; char a3_r_[PADR_(int)];\n\tchar a4_l_[PADL_(int)]; int a4; char a4_r_[PADR_(int)];\n};\nstruct freebsd6_pread_args {\n\tchar fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)];\n\tchar buf_l_[PADL_(void *)]; void * buf; char buf_r_[PADR_(void *)];\n\tchar nbyte_l_[PADL_(size_t)]; size_t nbyte; char nbyte_r_[PADR_(size_t)];\n\tchar pad_l_[PADL_(int)]; int pad; char pad_r_[PADR_(int)];\n\tchar offset_l_[PADL_(off_t)]; off_t offset; char offset_r_[PADR_(off_t)];\n};\nstruct freebsd6_pwrite_args {\n\tchar fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)];\n\tchar buf_l_[PADL_(const void *)]; const void * buf; char buf_r_[PADR_(const void *)];\n\tchar nbyte_l_[PADL_(size_t)]; size_t nbyte; char nbyte_r_[PADR_(size_t)];\n\tchar pad_l_[PADL_(int)]; int pad; char pad_r_[PADR_(int)];\n\tchar offset_l_[PADL_(off_t)]; off_t offset; char offset_r_[PADR_(off_t)];\n};\nstruct setfib_args {\n\tchar fibnum_l_[PADL_(int)]; int fibnum; char fibnum_r_[PADR_(int)];\n};\nstruct ntp_adjtime_args {\n\tchar tp_l_[PADL_(struct timex *)]; struct timex * tp; char tp_r_[PADR_(struct timex *)];\n};\nstruct setgid_args {\n\tchar gid_l_[PADL_(gid_t)]; gid_t gid; char gid_r_[PADR_(gid_t)];\n};\nstruct setegid_args {\n\tchar egid_l_[PADL_(gid_t)]; gid_t egid; char egid_r_[PADR_(gid_t)];\n};\nstruct seteuid_args {\n\tchar euid_l_[PADL_(uid_t)]; uid_t euid; char euid_r_[PADR_(uid_t)];\n};\nstruct stat_args {\n\tchar path_l_[PADL_(char *)]; char * path; char path_r_[PADR_(char *)];\n\tchar ub_l_[PADL_(struct stat *)]; struct stat * ub; char ub_r_[PADR_(struct stat *)];\n};\nstruct fstat_args {\n\tchar fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)];\n\tchar sb_l_[PADL_(struct stat *)]; struct stat * sb; char sb_r_[PADR_(struct stat *)];\n};\nstruct lstat_args {\n\tchar path_l_[PADL_(char *)]; char * path; char path_r_[PADR_(char *)];\n\tchar ub_l_[PADL_(struct stat *)]; struct stat * ub; char ub_r_[PADR_(struct stat *)];\n};\nstruct pathconf_args {\n\tchar path_l_[PADL_(char *)]; char * path; char path_r_[PADR_(char *)];\n\tchar name_l_[PADL_(int)]; int name; char name_r_[PADR_(int)];\n};\nstruct fpathconf_args {\n\tchar fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)];\n\tchar name_l_[PADL_(int)]; int name; char name_r_[PADR_(int)];\n};\nstruct __getrlimit_args {\n\tchar which_l_[PADL_(u_int)]; u_int which; char which_r_[PADR_(u_int)];\n\tchar rlp_l_[PADL_(struct rlimit *)]; struct rlimit * rlp; char rlp_r_[PADR_(struct rlimit *)];\n};\nstruct __setrlimit_args {\n\tchar which_l_[PADL_(u_int)]; u_int which; char which_r_[PADR_(u_int)];\n\tchar rlp_l_[PADL_(struct rlimit *)]; struct rlimit * rlp; char rlp_r_[PADR_(struct rlimit *)];\n};\nstruct getdirentries_args {\n\tchar fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)];\n\tchar buf_l_[PADL_(char *)]; char * buf; char buf_r_[PADR_(char *)];\n\tchar count_l_[PADL_(u_int)]; u_int count; char count_r_[PADR_(u_int)];\n\tchar basep_l_[PADL_(long *)]; long * basep; char basep_r_[PADR_(long *)];\n};\nstruct freebsd6_mmap_args {\n\tchar addr_l_[PADL_(caddr_t)]; caddr_t addr; char addr_r_[PADR_(caddr_t)];\n\tchar len_l_[PADL_(size_t)]; size_t len; char len_r_[PADR_(size_t)];\n\tchar prot_l_[PADL_(int)]; int prot; char prot_r_[PADR_(int)];\n\tchar flags_l_[PADL_(int)]; int flags; char flags_r_[PADR_(int)];\n\tchar fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)];\n\tchar pad_l_[PADL_(int)]; int pad; char pad_r_[PADR_(int)];\n\tchar pos_l_[PADL_(off_t)]; off_t pos; char pos_r_[PADR_(off_t)];\n};\nstruct freebsd6_lseek_args {\n\tchar fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)];\n\tchar pad_l_[PADL_(int)]; int pad; char pad_r_[PADR_(int)];\n\tchar offset_l_[PADL_(off_t)]; off_t offset; char offset_r_[PADR_(off_t)];\n\tchar whence_l_[PADL_(int)]; int whence; char whence_r_[PADR_(int)];\n};\nstruct freebsd6_truncate_args {\n\tchar path_l_[PADL_(char *)]; char * path; char path_r_[PADR_(char *)];\n\tchar pad_l_[PADL_(int)]; int pad; char pad_r_[PADR_(int)];\n\tchar length_l_[PADL_(off_t)]; off_t length; char length_r_[PADR_(off_t)];\n};\nstruct freebsd6_ftruncate_args {\n\tchar fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)];\n\tchar pad_l_[PADL_(int)]; int pad; char pad_r_[PADR_(int)];\n\tchar length_l_[PADL_(off_t)]; off_t length; char length_r_[PADR_(off_t)];\n};\nstruct sysctl_args {\n\tchar name_l_[PADL_(int *)]; int * name; char name_r_[PADR_(int *)];\n\tchar namelen_l_[PADL_(u_int)]; u_int namelen; char namelen_r_[PADR_(u_int)];\n\tchar old_l_[PADL_(void *)]; void * old; char old_r_[PADR_(void *)];\n\tchar oldlenp_l_[PADL_(size_t *)]; size_t * oldlenp; char oldlenp_r_[PADR_(size_t *)];\n\tchar new_l_[PADL_(void *)]; void * new; char new_r_[PADR_(void *)];\n\tchar newlen_l_[PADL_(size_t)]; size_t newlen; char newlen_r_[PADR_(size_t)];\n};\nstruct mlock_args {\n\tchar addr_l_[PADL_(const void *)]; const void * addr; char addr_r_[PADR_(const void *)];\n\tchar len_l_[PADL_(size_t)]; size_t len; char len_r_[PADR_(size_t)];\n};\nstruct munlock_args {\n\tchar addr_l_[PADL_(const void *)]; const void * addr; char addr_r_[PADR_(const void *)];\n\tchar len_l_[PADL_(size_t)]; size_t len; char len_r_[PADR_(size_t)];\n};\nstruct undelete_args {\n\tchar path_l_[PADL_(char *)]; char * path; char path_r_[PADR_(char *)];\n};\nstruct futimes_args {\n\tchar fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)];\n\tchar tptr_l_[PADL_(struct timeval *)]; struct timeval * tptr; char tptr_r_[PADR_(struct timeval *)];\n};\nstruct getpgid_args {\n\tchar pid_l_[PADL_(pid_t)]; pid_t pid; char pid_r_[PADR_(pid_t)];\n};\nstruct poll_args {\n\tchar fds_l_[PADL_(struct pollfd *)]; struct pollfd * fds; char fds_r_[PADR_(struct pollfd *)];\n\tchar nfds_l_[PADL_(u_int)]; u_int nfds; char nfds_r_[PADR_(u_int)];\n\tchar timeout_l_[PADL_(int)]; int timeout; char timeout_r_[PADR_(int)];\n};\nstruct semget_args {\n\tchar key_l_[PADL_(key_t)]; key_t key; char key_r_[PADR_(key_t)];\n\tchar nsems_l_[PADL_(int)]; int nsems; char nsems_r_[PADR_(int)];\n\tchar semflg_l_[PADL_(int)]; int semflg; char semflg_r_[PADR_(int)];\n};\nstruct semop_args {\n\tchar semid_l_[PADL_(int)]; int semid; char semid_r_[PADR_(int)];\n\tchar sops_l_[PADL_(struct sembuf *)]; struct sembuf * sops; char sops_r_[PADR_(struct sembuf *)];\n\tchar nsops_l_[PADL_(size_t)]; size_t nsops; char nsops_r_[PADR_(size_t)];\n};\nstruct msgget_args {\n\tchar key_l_[PADL_(key_t)]; key_t key; char key_r_[PADR_(key_t)];\n\tchar msgflg_l_[PADL_(int)]; int msgflg; char msgflg_r_[PADR_(int)];\n};\nstruct msgsnd_args {\n\tchar msqid_l_[PADL_(int)]; int msqid; char msqid_r_[PADR_(int)];\n\tchar msgp_l_[PADL_(const void *)]; const void * msgp; char msgp_r_[PADR_(const void *)];\n\tchar msgsz_l_[PADL_(size_t)]; size_t msgsz; char msgsz_r_[PADR_(size_t)];\n\tchar msgflg_l_[PADL_(int)]; int msgflg; char msgflg_r_[PADR_(int)];\n};\nstruct msgrcv_args {\n\tchar msqid_l_[PADL_(int)]; int msqid; char msqid_r_[PADR_(int)];\n\tchar msgp_l_[PADL_(void *)]; void * msgp; char msgp_r_[PADR_(void *)];\n\tchar msgsz_l_[PADL_(size_t)]; size_t msgsz; char msgsz_r_[PADR_(size_t)];\n\tchar msgtyp_l_[PADL_(long)]; long msgtyp; char msgtyp_r_[PADR_(long)];\n\tchar msgflg_l_[PADL_(int)]; int msgflg; char msgflg_r_[PADR_(int)];\n};\nstruct shmat_args {\n\tchar shmid_l_[PADL_(int)]; int shmid; char shmid_r_[PADR_(int)];\n\tchar shmaddr_l_[PADL_(const void *)]; const void * shmaddr; char shmaddr_r_[PADR_(const void *)];\n\tchar shmflg_l_[PADL_(int)]; int shmflg; char shmflg_r_[PADR_(int)];\n};\nstruct shmdt_args {\n\tchar shmaddr_l_[PADL_(const void *)]; const void * shmaddr; char shmaddr_r_[PADR_(const void *)];\n};\nstruct shmget_args {\n\tchar key_l_[PADL_(key_t)]; key_t key; char key_r_[PADR_(key_t)];\n\tchar size_l_[PADL_(size_t)]; size_t size; char size_r_[PADR_(size_t)];\n\tchar shmflg_l_[PADL_(int)]; int shmflg; char shmflg_r_[PADR_(int)];\n};\nstruct clock_gettime_args {\n\tchar clock_id_l_[PADL_(clockid_t)]; clockid_t clock_id; char clock_id_r_[PADR_(clockid_t)];\n\tchar tp_l_[PADL_(struct timespec *)]; struct timespec * tp; char tp_r_[PADR_(struct timespec *)];\n};\nstruct clock_settime_args {\n\tchar clock_id_l_[PADL_(clockid_t)]; clockid_t clock_id; char clock_id_r_[PADR_(clockid_t)];\n\tchar tp_l_[PADL_(const struct timespec *)]; const struct timespec * tp; char tp_r_[PADR_(const struct timespec *)];\n};\nstruct clock_getres_args {\n\tchar clock_id_l_[PADL_(clockid_t)]; clockid_t clock_id; char clock_id_r_[PADR_(clockid_t)];\n\tchar tp_l_[PADL_(struct timespec *)]; struct timespec * tp; char tp_r_[PADR_(struct timespec *)];\n};\nstruct ktimer_create_args {\n\tchar clock_id_l_[PADL_(clockid_t)]; clockid_t clock_id; char clock_id_r_[PADR_(clockid_t)];\n\tchar evp_l_[PADL_(struct sigevent *)]; struct sigevent * evp; char evp_r_[PADR_(struct sigevent *)];\n\tchar timerid_l_[PADL_(int *)]; int * timerid; char timerid_r_[PADR_(int *)];\n};\nstruct ktimer_delete_args {\n\tchar timerid_l_[PADL_(int)]; int timerid; char timerid_r_[PADR_(int)];\n};\nstruct ktimer_settime_args {\n\tchar timerid_l_[PADL_(int)]; int timerid; char timerid_r_[PADR_(int)];\n\tchar flags_l_[PADL_(int)]; int flags; char flags_r_[PADR_(int)];\n\tchar value_l_[PADL_(const struct itimerspec *)]; const struct itimerspec * value; char value_r_[PADR_(const struct itimerspec *)];\n\tchar ovalue_l_[PADL_(struct itimerspec *)]; struct itimerspec * ovalue; char ovalue_r_[PADR_(struct itimerspec *)];\n};\nstruct ktimer_gettime_args {\n\tchar timerid_l_[PADL_(int)]; int timerid; char timerid_r_[PADR_(int)];\n\tchar value_l_[PADL_(struct itimerspec *)]; struct itimerspec * value; char value_r_[PADR_(struct itimerspec *)];\n};\nstruct ktimer_getoverrun_args {\n\tchar timerid_l_[PADL_(int)]; int timerid; char timerid_r_[PADR_(int)];\n};\nstruct nanosleep_args {\n\tchar rqtp_l_[PADL_(const struct timespec *)]; const struct timespec * rqtp; char rqtp_r_[PADR_(const struct timespec *)];\n\tchar rmtp_l_[PADL_(struct timespec *)]; struct timespec * rmtp; char rmtp_r_[PADR_(struct timespec *)];\n};\nstruct ntp_gettime_args {\n\tchar ntvp_l_[PADL_(struct ntptimeval *)]; struct ntptimeval * ntvp; char ntvp_r_[PADR_(struct ntptimeval *)];\n};\nstruct minherit_args {\n\tchar addr_l_[PADL_(void *)]; void * addr; char addr_r_[PADR_(void *)];\n\tchar len_l_[PADL_(size_t)]; size_t len; char len_r_[PADR_(size_t)];\n\tchar inherit_l_[PADL_(int)]; int inherit; char inherit_r_[PADR_(int)];\n};\nstruct rfork_args {\n\tchar flags_l_[PADL_(int)]; int flags; char flags_r_[PADR_(int)];\n};\nstruct openbsd_poll_args {\n\tchar fds_l_[PADL_(struct pollfd *)]; struct pollfd * fds; char fds_r_[PADR_(struct pollfd *)];\n\tchar nfds_l_[PADL_(u_int)]; u_int nfds; char nfds_r_[PADR_(u_int)];\n\tchar timeout_l_[PADL_(int)]; int timeout; char timeout_r_[PADR_(int)];\n};\nstruct issetugid_args {\n\tregister_t dummy;\n};\nstruct lchown_args {\n\tchar path_l_[PADL_(char *)]; char * path; char path_r_[PADR_(char *)];\n\tchar uid_l_[PADL_(int)]; int uid; char uid_r_[PADR_(int)];\n\tchar gid_l_[PADL_(int)]; int gid; char gid_r_[PADR_(int)];\n};\nstruct aio_read_args {\n\tchar aiocbp_l_[PADL_(struct aiocb *)]; struct aiocb * aiocbp; char aiocbp_r_[PADR_(struct aiocb *)];\n};\nstruct aio_write_args {\n\tchar aiocbp_l_[PADL_(struct aiocb *)]; struct aiocb * aiocbp; char aiocbp_r_[PADR_(struct aiocb *)];\n};\nstruct lio_listio_args {\n\tchar mode_l_[PADL_(int)]; int mode; char mode_r_[PADR_(int)];\n\tchar acb_list_l_[PADL_(struct aiocb *const *)]; struct aiocb *const * acb_list; char acb_list_r_[PADR_(struct aiocb *const *)];\n\tchar nent_l_[PADL_(int)]; int nent; char nent_r_[PADR_(int)];\n\tchar sig_l_[PADL_(struct sigevent *)]; struct sigevent * sig; char sig_r_[PADR_(struct sigevent *)];\n};\nstruct getdents_args {\n\tchar fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)];\n\tchar buf_l_[PADL_(char *)]; char * buf; char buf_r_[PADR_(char *)];\n\tchar count_l_[PADL_(size_t)]; size_t count; char count_r_[PADR_(size_t)];\n};\nstruct lchmod_args {\n\tchar path_l_[PADL_(char *)]; char * path; char path_r_[PADR_(char *)];\n\tchar mode_l_[PADL_(mode_t)]; mode_t mode; char mode_r_[PADR_(mode_t)];\n};\nstruct lutimes_args {\n\tchar path_l_[PADL_(char *)]; char * path; char path_r_[PADR_(char *)];\n\tchar tptr_l_[PADL_(struct timeval *)]; struct timeval * tptr; char tptr_r_[PADR_(struct timeval *)];\n};\nstruct nstat_args {\n\tchar path_l_[PADL_(char *)]; char * path; char path_r_[PADR_(char *)];\n\tchar ub_l_[PADL_(struct nstat *)]; struct nstat * ub; char ub_r_[PADR_(struct nstat *)];\n};\nstruct nfstat_args {\n\tchar fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)];\n\tchar sb_l_[PADL_(struct nstat *)]; struct nstat * sb; char sb_r_[PADR_(struct nstat *)];\n};\nstruct nlstat_args {\n\tchar path_l_[PADL_(char *)]; char * path; char path_r_[PADR_(char *)];\n\tchar ub_l_[PADL_(struct nstat *)]; struct nstat * ub; char ub_r_[PADR_(struct nstat *)];\n};\nstruct preadv_args {\n\tchar fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)];\n\tchar iovp_l_[PADL_(struct iovec *)]; struct iovec * iovp; char iovp_r_[PADR_(struct iovec *)];\n\tchar iovcnt_l_[PADL_(u_int)]; u_int iovcnt; char iovcnt_r_[PADR_(u_int)];\n\tchar offset_l_[PADL_(off_t)]; off_t offset; char offset_r_[PADR_(off_t)];\n};\nstruct pwritev_args {\n\tchar fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)];\n\tchar iovp_l_[PADL_(struct iovec *)]; struct iovec * iovp; char iovp_r_[PADR_(struct iovec *)];\n\tchar iovcnt_l_[PADL_(u_int)]; u_int iovcnt; char iovcnt_r_[PADR_(u_int)];\n\tchar offset_l_[PADL_(off_t)]; off_t offset; char offset_r_[PADR_(off_t)];\n};\nstruct fhopen_args {\n\tchar u_fhp_l_[PADL_(const struct fhandle *)]; const struct fhandle * u_fhp; char u_fhp_r_[PADR_(const struct fhandle *)];\n\tchar flags_l_[PADL_(int)]; int flags; char flags_r_[PADR_(int)];\n};\nstruct fhstat_args {\n\tchar u_fhp_l_[PADL_(const struct fhandle *)]; const struct fhandle * u_fhp; char u_fhp_r_[PADR_(const struct fhandle *)];\n\tchar sb_l_[PADL_(struct stat *)]; struct stat * sb; char sb_r_[PADR_(struct stat *)];\n};\nstruct modnext_args {\n\tchar modid_l_[PADL_(int)]; int modid; char modid_r_[PADR_(int)];\n};\nstruct modstat_args {\n\tchar modid_l_[PADL_(int)]; int modid; char modid_r_[PADR_(int)];\n\tchar stat_l_[PADL_(struct module_stat *)]; struct module_stat * stat; char stat_r_[PADR_(struct module_stat *)];\n};\nstruct modfnext_args {\n\tchar modid_l_[PADL_(int)]; int modid; char modid_r_[PADR_(int)];\n};\nstruct modfind_args {\n\tchar name_l_[PADL_(const char *)]; const char * name; char name_r_[PADR_(const char *)];\n};\nstruct kldload_args {\n\tchar file_l_[PADL_(const char *)]; const char * file; char file_r_[PADR_(const char *)];\n};\nstruct kldunload_args {\n\tchar fileid_l_[PADL_(int)]; int fileid; char fileid_r_[PADR_(int)];\n};\nstruct kldfind_args {\n\tchar file_l_[PADL_(const char *)]; const char * file; char file_r_[PADR_(const char *)];\n};\nstruct kldnext_args {\n\tchar fileid_l_[PADL_(int)]; int fileid; char fileid_r_[PADR_(int)];\n};\nstruct kldstat_args {\n\tchar fileid_l_[PADL_(int)]; int fileid; char fileid_r_[PADR_(int)];\n\tchar stat_l_[PADL_(struct kld_file_stat *)]; struct kld_file_stat * stat; char stat_r_[PADR_(struct kld_file_stat *)];\n};\nstruct kldfirstmod_args {\n\tchar fileid_l_[PADL_(int)]; int fileid; char fileid_r_[PADR_(int)];\n};\nstruct getsid_args {\n\tchar pid_l_[PADL_(pid_t)]; pid_t pid; char pid_r_[PADR_(pid_t)];\n};\nstruct setresuid_args {\n\tchar ruid_l_[PADL_(uid_t)]; uid_t ruid; char ruid_r_[PADR_(uid_t)];\n\tchar euid_l_[PADL_(uid_t)]; uid_t euid; char euid_r_[PADR_(uid_t)];\n\tchar suid_l_[PADL_(uid_t)]; uid_t suid; char suid_r_[PADR_(uid_t)];\n};\nstruct setresgid_args {\n\tchar rgid_l_[PADL_(gid_t)]; gid_t rgid; char rgid_r_[PADR_(gid_t)];\n\tchar egid_l_[PADL_(gid_t)]; gid_t egid; char egid_r_[PADR_(gid_t)];\n\tchar sgid_l_[PADL_(gid_t)]; gid_t sgid; char sgid_r_[PADR_(gid_t)];\n};\nstruct aio_return_args {\n\tchar aiocbp_l_[PADL_(struct aiocb *)]; struct aiocb * aiocbp; char aiocbp_r_[PADR_(struct aiocb *)];\n};\nstruct aio_suspend_args {\n\tchar aiocbp_l_[PADL_(struct aiocb *const *)]; struct aiocb *const * aiocbp; char aiocbp_r_[PADR_(struct aiocb *const *)];\n\tchar nent_l_[PADL_(int)]; int nent; char nent_r_[PADR_(int)];\n\tchar timeout_l_[PADL_(const struct timespec *)]; const struct timespec * timeout; char timeout_r_[PADR_(const struct timespec *)];\n};\nstruct aio_cancel_args {\n\tchar fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)];\n\tchar aiocbp_l_[PADL_(struct aiocb *)]; struct aiocb * aiocbp; char aiocbp_r_[PADR_(struct aiocb *)];\n};\nstruct aio_error_args {\n\tchar aiocbp_l_[PADL_(struct aiocb *)]; struct aiocb * aiocbp; char aiocbp_r_[PADR_(struct aiocb *)];\n};\nstruct oaio_read_args {\n\tchar aiocbp_l_[PADL_(struct oaiocb *)]; struct oaiocb * aiocbp; char aiocbp_r_[PADR_(struct oaiocb *)];\n};\nstruct oaio_write_args {\n\tchar aiocbp_l_[PADL_(struct oaiocb *)]; struct oaiocb * aiocbp; char aiocbp_r_[PADR_(struct oaiocb *)];\n};\nstruct olio_listio_args {\n\tchar mode_l_[PADL_(int)]; int mode; char mode_r_[PADR_(int)];\n\tchar acb_list_l_[PADL_(struct oaiocb *const *)]; struct oaiocb *const * acb_list; char acb_list_r_[PADR_(struct oaiocb *const *)];\n\tchar nent_l_[PADL_(int)]; int nent; char nent_r_[PADR_(int)];\n\tchar sig_l_[PADL_(struct osigevent *)]; struct osigevent * sig; char sig_r_[PADR_(struct osigevent *)];\n};\nstruct yield_args {\n\tregister_t dummy;\n};\nstruct mlockall_args {\n\tchar how_l_[PADL_(int)]; int how; char how_r_[PADR_(int)];\n};\nstruct munlockall_args {\n\tregister_t dummy;\n};\nstruct __getcwd_args {\n\tchar buf_l_[PADL_(u_char *)]; u_char * buf; char buf_r_[PADR_(u_char *)];\n\tchar buflen_l_[PADL_(u_int)]; u_int buflen; char buflen_r_[PADR_(u_int)];\n};\nstruct sched_setparam_args {\n\tchar pid_l_[PADL_(pid_t)]; pid_t pid; char pid_r_[PADR_(pid_t)];\n\tchar param_l_[PADL_(const struct sched_param *)]; const struct sched_param * param; char param_r_[PADR_(const struct sched_param *)];\n};\nstruct sched_getparam_args {\n\tchar pid_l_[PADL_(pid_t)]; pid_t pid; char pid_r_[PADR_(pid_t)];\n\tchar param_l_[PADL_(struct sched_param *)]; struct sched_param * param; char param_r_[PADR_(struct sched_param *)];\n};\nstruct sched_setscheduler_args {\n\tchar pid_l_[PADL_(pid_t)]; pid_t pid; char pid_r_[PADR_(pid_t)];\n\tchar policy_l_[PADL_(int)]; int policy; char policy_r_[PADR_(int)];\n\tchar param_l_[PADL_(const struct sched_param *)]; const struct sched_param * param; char param_r_[PADR_(const struct sched_param *)];\n};\nstruct sched_getscheduler_args {\n\tchar pid_l_[PADL_(pid_t)]; pid_t pid; char pid_r_[PADR_(pid_t)];\n};\nstruct sched_yield_args {\n\tregister_t dummy;\n};\nstruct sched_get_priority_max_args {\n\tchar policy_l_[PADL_(int)]; int policy; char policy_r_[PADR_(int)];\n};\nstruct sched_get_priority_min_args {\n\tchar policy_l_[PADL_(int)]; int policy; char policy_r_[PADR_(int)];\n};\nstruct sched_rr_get_interval_args {\n\tchar pid_l_[PADL_(pid_t)]; pid_t pid; char pid_r_[PADR_(pid_t)];\n\tchar interval_l_[PADL_(struct timespec *)]; struct timespec * interval; char interval_r_[PADR_(struct timespec *)];\n};\nstruct utrace_args {\n\tchar addr_l_[PADL_(const void *)]; const void * addr; char addr_r_[PADR_(const void *)];\n\tchar len_l_[PADL_(size_t)]; size_t len; char len_r_[PADR_(size_t)];\n};\nstruct kldsym_args {\n\tchar fileid_l_[PADL_(int)]; int fileid; char fileid_r_[PADR_(int)];\n\tchar cmd_l_[PADL_(int)]; int cmd; char cmd_r_[PADR_(int)];\n\tchar data_l_[PADL_(void *)]; void * data; char data_r_[PADR_(void *)];\n};\nstruct jail_args {\n\tchar jail_l_[PADL_(struct jail *)]; struct jail * jail; char jail_r_[PADR_(struct jail *)];\n};\nstruct nnpfs_syscall_args {\n\tchar operation_l_[PADL_(int)]; int operation; char operation_r_[PADR_(int)];\n\tchar a_pathP_l_[PADL_(char *)]; char * a_pathP; char a_pathP_r_[PADR_(char *)];\n\tchar a_opcode_l_[PADL_(int)]; int a_opcode; char a_opcode_r_[PADR_(int)];\n\tchar a_paramsP_l_[PADL_(void *)]; void * a_paramsP; char a_paramsP_r_[PADR_(void *)];\n\tchar a_followSymlinks_l_[PADL_(int)]; int a_followSymlinks; char a_followSymlinks_r_[PADR_(int)];\n};\nstruct sigprocmask_args {\n\tchar how_l_[PADL_(int)]; int how; char how_r_[PADR_(int)];\n\tchar set_l_[PADL_(const sigset_t *)]; const sigset_t * set; char set_r_[PADR_(const sigset_t *)];\n\tchar oset_l_[PADL_(sigset_t *)]; sigset_t * oset; char oset_r_[PADR_(sigset_t *)];\n};\nstruct sigsuspend_args {\n\tchar sigmask_l_[PADL_(const sigset_t *)]; const sigset_t * sigmask; char sigmask_r_[PADR_(const sigset_t *)];\n};\nstruct sigpending_args {\n\tchar set_l_[PADL_(sigset_t *)]; sigset_t * set; char set_r_[PADR_(sigset_t *)];\n};\nstruct sigtimedwait_args {\n\tchar set_l_[PADL_(const sigset_t *)]; const sigset_t * set; char set_r_[PADR_(const sigset_t *)];\n\tchar info_l_[PADL_(siginfo_t *)]; siginfo_t * info; char info_r_[PADR_(siginfo_t *)];\n\tchar timeout_l_[PADL_(const struct timespec *)]; const struct timespec * timeout; char timeout_r_[PADR_(const struct timespec *)];\n};\nstruct sigwaitinfo_args {\n\tchar set_l_[PADL_(const sigset_t *)]; const sigset_t * set; char set_r_[PADR_(const sigset_t *)];\n\tchar info_l_[PADL_(siginfo_t *)]; siginfo_t * info; char info_r_[PADR_(siginfo_t *)];\n};\nstruct __acl_get_file_args {\n\tchar path_l_[PADL_(const char *)]; const char * path; char path_r_[PADR_(const char *)];\n\tchar type_l_[PADL_(acl_type_t)]; acl_type_t type; char type_r_[PADR_(acl_type_t)];\n\tchar aclp_l_[PADL_(struct acl *)]; struct acl * aclp; char aclp_r_[PADR_(struct acl *)];\n};\nstruct __acl_set_file_args {\n\tchar path_l_[PADL_(const char *)]; const char * path; char path_r_[PADR_(const char *)];\n\tchar type_l_[PADL_(acl_type_t)]; acl_type_t type; char type_r_[PADR_(acl_type_t)];\n\tchar aclp_l_[PADL_(struct acl *)]; struct acl * aclp; char aclp_r_[PADR_(struct acl *)];\n};\nstruct __acl_get_fd_args {\n\tchar filedes_l_[PADL_(int)]; int filedes; char filedes_r_[PADR_(int)];\n\tchar type_l_[PADL_(acl_type_t)]; acl_type_t type; char type_r_[PADR_(acl_type_t)];\n\tchar aclp_l_[PADL_(struct acl *)]; struct acl * aclp; char aclp_r_[PADR_(struct acl *)];\n};\nstruct __acl_set_fd_args {\n\tchar filedes_l_[PADL_(int)]; int filedes; char filedes_r_[PADR_(int)];\n\tchar type_l_[PADL_(acl_type_t)]; acl_type_t type; char type_r_[PADR_(acl_type_t)];\n\tchar aclp_l_[PADL_(struct acl *)]; struct acl * aclp; char aclp_r_[PADR_(struct acl *)];\n};\nstruct __acl_delete_file_args {\n\tchar path_l_[PADL_(const char *)]; const char * path; char path_r_[PADR_(const char *)];\n\tchar type_l_[PADL_(acl_type_t)]; acl_type_t type; char type_r_[PADR_(acl_type_t)];\n};\nstruct __acl_delete_fd_args {\n\tchar filedes_l_[PADL_(int)]; int filedes; char filedes_r_[PADR_(int)];\n\tchar type_l_[PADL_(acl_type_t)]; acl_type_t type; char type_r_[PADR_(acl_type_t)];\n};\nstruct __acl_aclcheck_file_args {\n\tchar path_l_[PADL_(const char *)]; const char * path; char path_r_[PADR_(const char *)];\n\tchar type_l_[PADL_(acl_type_t)]; acl_type_t type; char type_r_[PADR_(acl_type_t)];\n\tchar aclp_l_[PADL_(struct acl *)]; struct acl * aclp; char aclp_r_[PADR_(struct acl *)];\n};\nstruct __acl_aclcheck_fd_args {\n\tchar filedes_l_[PADL_(int)]; int filedes; char filedes_r_[PADR_(int)];\n\tchar type_l_[PADL_(acl_type_t)]; acl_type_t type; char type_r_[PADR_(acl_type_t)];\n\tchar aclp_l_[PADL_(struct acl *)]; struct acl * aclp; char aclp_r_[PADR_(struct acl *)];\n};\nstruct extattrctl_args {\n\tchar path_l_[PADL_(const char *)]; const char * path; char path_r_[PADR_(const char *)];\n\tchar cmd_l_[PADL_(int)]; int cmd; char cmd_r_[PADR_(int)];\n\tchar filename_l_[PADL_(const char *)]; const char * filename; char filename_r_[PADR_(const char *)];\n\tchar attrnamespace_l_[PADL_(int)]; int attrnamespace; char attrnamespace_r_[PADR_(int)];\n\tchar attrname_l_[PADL_(const char *)]; const char * attrname; char attrname_r_[PADR_(const char *)];\n};\nstruct extattr_set_file_args {\n\tchar path_l_[PADL_(const char *)]; const char * path; char path_r_[PADR_(const char *)];\n\tchar attrnamespace_l_[PADL_(int)]; int attrnamespace; char attrnamespace_r_[PADR_(int)];\n\tchar attrname_l_[PADL_(const char *)]; const char * attrname; char attrname_r_[PADR_(const char *)];\n\tchar data_l_[PADL_(void *)]; void * data; char data_r_[PADR_(void *)];\n\tchar nbytes_l_[PADL_(size_t)]; size_t nbytes; char nbytes_r_[PADR_(size_t)];\n};\nstruct extattr_get_file_args {\n\tchar path_l_[PADL_(const char *)]; const char * path; char path_r_[PADR_(const char *)];\n\tchar attrnamespace_l_[PADL_(int)]; int attrnamespace; char attrnamespace_r_[PADR_(int)];\n\tchar attrname_l_[PADL_(const char *)]; const char * attrname; char attrname_r_[PADR_(const char *)];\n\tchar data_l_[PADL_(void *)]; void * data; char data_r_[PADR_(void *)];\n\tchar nbytes_l_[PADL_(size_t)]; size_t nbytes; char nbytes_r_[PADR_(size_t)];\n};\nstruct extattr_delete_file_args {\n\tchar path_l_[PADL_(const char *)]; const char * path; char path_r_[PADR_(const char *)];\n\tchar attrnamespace_l_[PADL_(int)]; int attrnamespace; char attrnamespace_r_[PADR_(int)];\n\tchar attrname_l_[PADL_(const char *)]; const char * attrname; char attrname_r_[PADR_(const char *)];\n};\nstruct aio_waitcomplete_args {\n\tchar aiocbp_l_[PADL_(struct aiocb **)]; struct aiocb ** aiocbp; char aiocbp_r_[PADR_(struct aiocb **)];\n\tchar timeout_l_[PADL_(struct timespec *)]; struct timespec * timeout; char timeout_r_[PADR_(struct timespec *)];\n};\nstruct getresuid_args {\n\tchar ruid_l_[PADL_(uid_t *)]; uid_t * ruid; char ruid_r_[PADR_(uid_t *)];\n\tchar euid_l_[PADL_(uid_t *)]; uid_t * euid; char euid_r_[PADR_(uid_t *)];\n\tchar suid_l_[PADL_(uid_t *)]; uid_t * suid; char suid_r_[PADR_(uid_t *)];\n};\nstruct getresgid_args {\n\tchar rgid_l_[PADL_(gid_t *)]; gid_t * rgid; char rgid_r_[PADR_(gid_t *)];\n\tchar egid_l_[PADL_(gid_t *)]; gid_t * egid; char egid_r_[PADR_(gid_t *)];\n\tchar sgid_l_[PADL_(gid_t *)]; gid_t * sgid; char sgid_r_[PADR_(gid_t *)];\n};\nstruct kqueue_args {\n\tregister_t dummy;\n};\nstruct kevent_args {\n\tchar fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)];\n\tchar changelist_l_[PADL_(struct kevent *)]; struct kevent * changelist; char changelist_r_[PADR_(struct kevent *)];\n\tchar nchanges_l_[PADL_(int)]; int nchanges; char nchanges_r_[PADR_(int)];\n\tchar eventlist_l_[PADL_(struct kevent *)]; struct kevent * eventlist; char eventlist_r_[PADR_(struct kevent *)];\n\tchar nevents_l_[PADL_(int)]; int nevents; char nevents_r_[PADR_(int)];\n\tchar timeout_l_[PADL_(const struct timespec *)]; const struct timespec * timeout; char timeout_r_[PADR_(const struct timespec *)];\n};\nstruct extattr_set_fd_args {\n\tchar fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)];\n\tchar attrnamespace_l_[PADL_(int)]; int attrnamespace; char attrnamespace_r_[PADR_(int)];\n\tchar attrname_l_[PADL_(const char *)]; const char * attrname; char attrname_r_[PADR_(const char *)];\n\tchar data_l_[PADL_(void *)]; void * data; char data_r_[PADR_(void *)];\n\tchar nbytes_l_[PADL_(size_t)]; size_t nbytes; char nbytes_r_[PADR_(size_t)];\n};\nstruct extattr_get_fd_args {\n\tchar fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)];\n\tchar attrnamespace_l_[PADL_(int)]; int attrnamespace; char attrnamespace_r_[PADR_(int)];\n\tchar attrname_l_[PADL_(const char *)]; const char * attrname; char attrname_r_[PADR_(const char *)];\n\tchar data_l_[PADL_(void *)]; void * data; char data_r_[PADR_(void *)];\n\tchar nbytes_l_[PADL_(size_t)]; size_t nbytes; char nbytes_r_[PADR_(size_t)];\n};\nstruct extattr_delete_fd_args {\n\tchar fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)];\n\tchar attrnamespace_l_[PADL_(int)]; int attrnamespace; char attrnamespace_r_[PADR_(int)];\n\tchar attrname_l_[PADL_(const char *)]; const char * attrname; char attrname_r_[PADR_(const char *)];\n};\nstruct __setugid_args {\n\tchar flag_l_[PADL_(int)]; int flag; char flag_r_[PADR_(int)];\n};\nstruct eaccess_args {\n\tchar path_l_[PADL_(char *)]; char * path; char path_r_[PADR_(char *)];\n\tchar flags_l_[PADL_(int)]; int flags; char flags_r_[PADR_(int)];\n};\nstruct afs3_syscall_args {\n\tchar syscall_l_[PADL_(long)]; long syscall; char syscall_r_[PADR_(long)];\n\tchar parm1_l_[PADL_(long)]; long parm1; char parm1_r_[PADR_(long)];\n\tchar parm2_l_[PADL_(long)]; long parm2; char parm2_r_[PADR_(long)];\n\tchar parm3_l_[PADL_(long)]; long parm3; char parm3_r_[PADR_(long)];\n\tchar parm4_l_[PADL_(long)]; long parm4; char parm4_r_[PADR_(long)];\n\tchar parm5_l_[PADL_(long)]; long parm5; char parm5_r_[PADR_(long)];\n\tchar parm6_l_[PADL_(long)]; long parm6; char parm6_r_[PADR_(long)];\n};\nstruct nmount_args {\n\tchar iovp_l_[PADL_(struct iovec *)]; struct iovec * iovp; char iovp_r_[PADR_(struct iovec *)];\n\tchar iovcnt_l_[PADL_(unsigned int)]; unsigned int iovcnt; char iovcnt_r_[PADR_(unsigned int)];\n\tchar flags_l_[PADL_(int)]; int flags; char flags_r_[PADR_(int)];\n};\nstruct __mac_get_proc_args {\n\tchar mac_p_l_[PADL_(struct mac *)]; struct mac * mac_p; char mac_p_r_[PADR_(struct mac *)];\n};\nstruct __mac_set_proc_args {\n\tchar mac_p_l_[PADL_(struct mac *)]; struct mac * mac_p; char mac_p_r_[PADR_(struct mac *)];\n};\nstruct __mac_get_fd_args {\n\tchar fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)];\n\tchar mac_p_l_[PADL_(struct mac *)]; struct mac * mac_p; char mac_p_r_[PADR_(struct mac *)];\n};\nstruct __mac_get_file_args {\n\tchar path_p_l_[PADL_(const char *)]; const char * path_p; char path_p_r_[PADR_(const char *)];\n\tchar mac_p_l_[PADL_(struct mac *)]; struct mac * mac_p; char mac_p_r_[PADR_(struct mac *)];\n};\nstruct __mac_set_fd_args {\n\tchar fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)];\n\tchar mac_p_l_[PADL_(struct mac *)]; struct mac * mac_p; char mac_p_r_[PADR_(struct mac *)];\n};\nstruct __mac_set_file_args {\n\tchar path_p_l_[PADL_(const char *)]; const char * path_p; char path_p_r_[PADR_(const char *)];\n\tchar mac_p_l_[PADL_(struct mac *)]; struct mac * mac_p; char mac_p_r_[PADR_(struct mac *)];\n};\nstruct kenv_args {\n\tchar what_l_[PADL_(int)]; int what; char what_r_[PADR_(int)];\n\tchar name_l_[PADL_(const char *)]; const char * name; char name_r_[PADR_(const char *)];\n\tchar value_l_[PADL_(char *)]; char * value; char value_r_[PADR_(char *)];\n\tchar len_l_[PADL_(int)]; int len; char len_r_[PADR_(int)];\n};\nstruct lchflags_args {\n\tchar path_l_[PADL_(const char *)]; const char * path; char path_r_[PADR_(const char *)];\n\tchar flags_l_[PADL_(int)]; int flags; char flags_r_[PADR_(int)];\n};\nstruct uuidgen_args {\n\tchar store_l_[PADL_(struct uuid *)]; struct uuid * store; char store_r_[PADR_(struct uuid *)];\n\tchar count_l_[PADL_(int)]; int count; char count_r_[PADR_(int)];\n};\nstruct sendfile_args {\n\tchar fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)];\n\tchar s_l_[PADL_(int)]; int s; char s_r_[PADR_(int)];\n\tchar offset_l_[PADL_(off_t)]; off_t offset; char offset_r_[PADR_(off_t)];\n\tchar nbytes_l_[PADL_(size_t)]; size_t nbytes; char nbytes_r_[PADR_(size_t)];\n\tchar hdtr_l_[PADL_(struct sf_hdtr *)]; struct sf_hdtr * hdtr; char hdtr_r_[PADR_(struct sf_hdtr *)];\n\tchar sbytes_l_[PADL_(off_t *)]; off_t * sbytes; char sbytes_r_[PADR_(off_t *)];\n\tchar flags_l_[PADL_(int)]; int flags; char flags_r_[PADR_(int)];\n};\nstruct mac_syscall_args {\n\tchar policy_l_[PADL_(const char *)]; const char * policy; char policy_r_[PADR_(const char *)];\n\tchar call_l_[PADL_(int)]; int call; char call_r_[PADR_(int)];\n\tchar arg_l_[PADL_(void *)]; void * arg; char arg_r_[PADR_(void *)];\n};\nstruct getfsstat_args {\n\tchar buf_l_[PADL_(struct statfs *)]; struct statfs * buf; char buf_r_[PADR_(struct statfs *)];\n\tchar bufsize_l_[PADL_(long)]; long bufsize; char bufsize_r_[PADR_(long)];\n\tchar flags_l_[PADL_(int)]; int flags; char flags_r_[PADR_(int)];\n};\nstruct statfs_args {\n\tchar path_l_[PADL_(char *)]; char * path; char path_r_[PADR_(char *)];\n\tchar buf_l_[PADL_(struct statfs *)]; struct statfs * buf; char buf_r_[PADR_(struct statfs *)];\n};\nstruct fstatfs_args {\n\tchar fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)];\n\tchar buf_l_[PADL_(struct statfs *)]; struct statfs * buf; char buf_r_[PADR_(struct statfs *)];\n};\nstruct fhstatfs_args {\n\tchar u_fhp_l_[PADL_(const struct fhandle *)]; const struct fhandle * u_fhp; char u_fhp_r_[PADR_(const struct fhandle *)];\n\tchar buf_l_[PADL_(struct statfs *)]; struct statfs * buf; char buf_r_[PADR_(struct statfs *)];\n};\nstruct ksem_close_args {\n\tchar id_l_[PADL_(semid_t)]; semid_t id; char id_r_[PADR_(semid_t)];\n};\nstruct ksem_post_args {\n\tchar id_l_[PADL_(semid_t)]; semid_t id; char id_r_[PADR_(semid_t)];\n};\nstruct ksem_wait_args {\n\tchar id_l_[PADL_(semid_t)]; semid_t id; char id_r_[PADR_(semid_t)];\n};\nstruct ksem_trywait_args {\n\tchar id_l_[PADL_(semid_t)]; semid_t id; char id_r_[PADR_(semid_t)];\n};\nstruct ksem_init_args {\n\tchar idp_l_[PADL_(semid_t *)]; semid_t * idp; char idp_r_[PADR_(semid_t *)];\n\tchar value_l_[PADL_(unsigned int)]; unsigned int value; char value_r_[PADR_(unsigned int)];\n};\nstruct ksem_open_args {\n\tchar idp_l_[PADL_(semid_t *)]; semid_t * idp; char idp_r_[PADR_(semid_t *)];\n\tchar name_l_[PADL_(const char *)]; const char * name; char name_r_[PADR_(const char *)];\n\tchar oflag_l_[PADL_(int)]; int oflag; char oflag_r_[PADR_(int)];\n\tchar mode_l_[PADL_(mode_t)]; mode_t mode; char mode_r_[PADR_(mode_t)];\n\tchar value_l_[PADL_(unsigned int)]; unsigned int value; char value_r_[PADR_(unsigned int)];\n};\nstruct ksem_unlink_args {\n\tchar name_l_[PADL_(const char *)]; const char * name; char name_r_[PADR_(const char *)];\n};\nstruct ksem_getvalue_args {\n\tchar id_l_[PADL_(semid_t)]; semid_t id; char id_r_[PADR_(semid_t)];\n\tchar val_l_[PADL_(int *)]; int * val; char val_r_[PADR_(int *)];\n};\nstruct ksem_destroy_args {\n\tchar id_l_[PADL_(semid_t)]; semid_t id; char id_r_[PADR_(semid_t)];\n};\nstruct __mac_get_pid_args {\n\tchar pid_l_[PADL_(pid_t)]; pid_t pid; char pid_r_[PADR_(pid_t)];\n\tchar mac_p_l_[PADL_(struct mac *)]; struct mac * mac_p; char mac_p_r_[PADR_(struct mac *)];\n};\nstruct __mac_get_link_args {\n\tchar path_p_l_[PADL_(const char *)]; const char * path_p; char path_p_r_[PADR_(const char *)];\n\tchar mac_p_l_[PADL_(struct mac *)]; struct mac * mac_p; char mac_p_r_[PADR_(struct mac *)];\n};\nstruct __mac_set_link_args {\n\tchar path_p_l_[PADL_(const char *)]; const char * path_p; char path_p_r_[PADR_(const char *)];\n\tchar mac_p_l_[PADL_(struct mac *)]; struct mac * mac_p; char mac_p_r_[PADR_(struct mac *)];\n};\nstruct extattr_set_link_args {\n\tchar path_l_[PADL_(const char *)]; const char * path; char path_r_[PADR_(const char *)];\n\tchar attrnamespace_l_[PADL_(int)]; int attrnamespace; char attrnamespace_r_[PADR_(int)];\n\tchar attrname_l_[PADL_(const char *)]; const char * attrname; char attrname_r_[PADR_(const char *)];\n\tchar data_l_[PADL_(void *)]; void * data; char data_r_[PADR_(void *)];\n\tchar nbytes_l_[PADL_(size_t)]; size_t nbytes; char nbytes_r_[PADR_(size_t)];\n};\nstruct extattr_get_link_args {\n\tchar path_l_[PADL_(const char *)]; const char * path; char path_r_[PADR_(const char *)];\n\tchar attrnamespace_l_[PADL_(int)]; int attrnamespace; char attrnamespace_r_[PADR_(int)];\n\tchar attrname_l_[PADL_(const char *)]; const char * attrname; char attrname_r_[PADR_(const char *)];\n\tchar data_l_[PADL_(void *)]; void * data; char data_r_[PADR_(void *)];\n\tchar nbytes_l_[PADL_(size_t)]; size_t nbytes; char nbytes_r_[PADR_(size_t)];\n};\nstruct extattr_delete_link_args {\n\tchar path_l_[PADL_(const char *)]; const char * path; char path_r_[PADR_(const char *)];\n\tchar attrnamespace_l_[PADL_(int)]; int attrnamespace; char attrnamespace_r_[PADR_(int)];\n\tchar attrname_l_[PADL_(const char *)]; const char * attrname; char attrname_r_[PADR_(const char *)];\n};\nstruct __mac_execve_args {\n\tchar fname_l_[PADL_(char *)]; char * fname; char fname_r_[PADR_(char *)];\n\tchar argv_l_[PADL_(char **)]; char ** argv; char argv_r_[PADR_(char **)];\n\tchar envv_l_[PADL_(char **)]; char ** envv; char envv_r_[PADR_(char **)];\n\tchar mac_p_l_[PADL_(struct mac *)]; struct mac * mac_p; char mac_p_r_[PADR_(struct mac *)];\n};\nstruct sigaction_args {\n\tchar sig_l_[PADL_(int)]; int sig; char sig_r_[PADR_(int)];\n\tchar act_l_[PADL_(const struct sigaction *)]; const struct sigaction * act; char act_r_[PADR_(const struct sigaction *)];\n\tchar oact_l_[PADL_(struct sigaction *)]; struct sigaction * oact; char oact_r_[PADR_(struct sigaction *)];\n};\nstruct sigreturn_args {\n\tchar sigcntxp_l_[PADL_(const struct __ucontext *)]; const struct __ucontext * sigcntxp; char sigcntxp_r_[PADR_(const struct __ucontext *)];\n};\nstruct getcontext_args {\n\tchar ucp_l_[PADL_(struct __ucontext *)]; struct __ucontext * ucp; char ucp_r_[PADR_(struct __ucontext *)];\n};\nstruct setcontext_args {\n\tchar ucp_l_[PADL_(const struct __ucontext *)]; const struct __ucontext * ucp; char ucp_r_[PADR_(const struct __ucontext *)];\n};\nstruct swapcontext_args {\n\tchar oucp_l_[PADL_(struct __ucontext *)]; struct __ucontext * oucp; char oucp_r_[PADR_(struct __ucontext *)];\n\tchar ucp_l_[PADL_(const struct __ucontext *)]; const struct __ucontext * ucp; char ucp_r_[PADR_(const struct __ucontext *)];\n};\nstruct swapoff_args {\n\tchar name_l_[PADL_(const char *)]; const char * name; char name_r_[PADR_(const char *)];\n};\nstruct __acl_get_link_args {\n\tchar path_l_[PADL_(const char *)]; const char * path; char path_r_[PADR_(const char *)];\n\tchar type_l_[PADL_(acl_type_t)]; acl_type_t type; char type_r_[PADR_(acl_type_t)];\n\tchar aclp_l_[PADL_(struct acl *)]; struct acl * aclp; char aclp_r_[PADR_(struct acl *)];\n};\nstruct __acl_set_link_args {\n\tchar path_l_[PADL_(const char *)]; const char * path; char path_r_[PADR_(const char *)];\n\tchar type_l_[PADL_(acl_type_t)]; acl_type_t type; char type_r_[PADR_(acl_type_t)];\n\tchar aclp_l_[PADL_(struct acl *)]; struct acl * aclp; char aclp_r_[PADR_(struct acl *)];\n};\nstruct __acl_delete_link_args {\n\tchar path_l_[PADL_(const char *)]; const char * path; char path_r_[PADR_(const char *)];\n\tchar type_l_[PADL_(acl_type_t)]; acl_type_t type; char type_r_[PADR_(acl_type_t)];\n};\nstruct __acl_aclcheck_link_args {\n\tchar path_l_[PADL_(const char *)]; const char * path; char path_r_[PADR_(const char *)];\n\tchar type_l_[PADL_(acl_type_t)]; acl_type_t type; char type_r_[PADR_(acl_type_t)];\n\tchar aclp_l_[PADL_(struct acl *)]; struct acl * aclp; char aclp_r_[PADR_(struct acl *)];\n};\nstruct sigwait_args {\n\tchar set_l_[PADL_(const sigset_t *)]; const sigset_t * set; char set_r_[PADR_(const sigset_t *)];\n\tchar sig_l_[PADL_(int *)]; int * sig; char sig_r_[PADR_(int *)];\n};\nstruct thr_create_args {\n\tchar ctx_l_[PADL_(ucontext_t *)]; ucontext_t * ctx; char ctx_r_[PADR_(ucontext_t *)];\n\tchar id_l_[PADL_(long *)]; long * id; char id_r_[PADR_(long *)];\n\tchar flags_l_[PADL_(int)]; int flags; char flags_r_[PADR_(int)];\n};\nstruct thr_exit_args {\n\tchar state_l_[PADL_(long *)]; long * state; char state_r_[PADR_(long *)];\n};\nstruct thr_self_args {\n\tchar id_l_[PADL_(long *)]; long * id; char id_r_[PADR_(long *)];\n};\nstruct thr_kill_args {\n\tchar id_l_[PADL_(long)]; long id; char id_r_[PADR_(long)];\n\tchar sig_l_[PADL_(int)]; int sig; char sig_r_[PADR_(int)];\n};\nstruct _umtx_lock_args {\n\tchar umtx_l_[PADL_(struct umtx *)]; struct umtx * umtx; char umtx_r_[PADR_(struct umtx *)];\n};\nstruct _umtx_unlock_args {\n\tchar umtx_l_[PADL_(struct umtx *)]; struct umtx * umtx; char umtx_r_[PADR_(struct umtx *)];\n};\nstruct jail_attach_args {\n\tchar jid_l_[PADL_(int)]; int jid; char jid_r_[PADR_(int)];\n};\nstruct extattr_list_fd_args {\n\tchar fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)];\n\tchar attrnamespace_l_[PADL_(int)]; int attrnamespace; char attrnamespace_r_[PADR_(int)];\n\tchar data_l_[PADL_(void *)]; void * data; char data_r_[PADR_(void *)];\n\tchar nbytes_l_[PADL_(size_t)]; size_t nbytes; char nbytes_r_[PADR_(size_t)];\n};\nstruct extattr_list_file_args {\n\tchar path_l_[PADL_(const char *)]; const char * path; char path_r_[PADR_(const char *)];\n\tchar attrnamespace_l_[PADL_(int)]; int attrnamespace; char attrnamespace_r_[PADR_(int)];\n\tchar data_l_[PADL_(void *)]; void * data; char data_r_[PADR_(void *)];\n\tchar nbytes_l_[PADL_(size_t)]; size_t nbytes; char nbytes_r_[PADR_(size_t)];\n};\nstruct extattr_list_link_args {\n\tchar path_l_[PADL_(const char *)]; const char * path; char path_r_[PADR_(const char *)];\n\tchar attrnamespace_l_[PADL_(int)]; int attrnamespace; char attrnamespace_r_[PADR_(int)];\n\tchar data_l_[PADL_(void *)]; void * data; char data_r_[PADR_(void *)];\n\tchar nbytes_l_[PADL_(size_t)]; size_t nbytes; char nbytes_r_[PADR_(size_t)];\n};\nstruct ksem_timedwait_args {\n\tchar id_l_[PADL_(semid_t)]; semid_t id; char id_r_[PADR_(semid_t)];\n\tchar abstime_l_[PADL_(const struct timespec *)]; const struct timespec * abstime; char abstime_r_[PADR_(const struct timespec *)];\n};\nstruct thr_suspend_args {\n\tchar timeout_l_[PADL_(const struct timespec *)]; const struct timespec * timeout; char timeout_r_[PADR_(const struct timespec *)];\n};\nstruct thr_wake_args {\n\tchar id_l_[PADL_(long)]; long id; char id_r_[PADR_(long)];\n};\nstruct kldunloadf_args {\n\tchar fileid_l_[PADL_(int)]; int fileid; char fileid_r_[PADR_(int)];\n\tchar flags_l_[PADL_(int)]; int flags; char flags_r_[PADR_(int)];\n};\nstruct audit_args {\n\tchar record_l_[PADL_(const void *)]; const void * record; char record_r_[PADR_(const void *)];\n\tchar length_l_[PADL_(u_int)]; u_int length; char length_r_[PADR_(u_int)];\n};\nstruct auditon_args {\n\tchar cmd_l_[PADL_(int)]; int cmd; char cmd_r_[PADR_(int)];\n\tchar data_l_[PADL_(void *)]; void * data; char data_r_[PADR_(void *)];\n\tchar length_l_[PADL_(u_int)]; u_int length; char length_r_[PADR_(u_int)];\n};\nstruct getauid_args {\n\tchar auid_l_[PADL_(uid_t *)]; uid_t * auid; char auid_r_[PADR_(uid_t *)];\n};\nstruct setauid_args {\n\tchar auid_l_[PADL_(uid_t *)]; uid_t * auid; char auid_r_[PADR_(uid_t *)];\n};\nstruct getaudit_args {\n\tchar auditinfo_l_[PADL_(struct auditinfo *)]; struct auditinfo * auditinfo; char auditinfo_r_[PADR_(struct auditinfo *)];\n};\nstruct setaudit_args {\n\tchar auditinfo_l_[PADL_(struct auditinfo *)]; struct auditinfo * auditinfo; char auditinfo_r_[PADR_(struct auditinfo *)];\n};\nstruct getaudit_addr_args {\n\tchar auditinfo_addr_l_[PADL_(struct auditinfo_addr *)]; struct auditinfo_addr * auditinfo_addr; char auditinfo_addr_r_[PADR_(struct auditinfo_addr *)];\n\tchar length_l_[PADL_(u_int)]; u_int length; char length_r_[PADR_(u_int)];\n};\nstruct setaudit_addr_args {\n\tchar auditinfo_addr_l_[PADL_(struct auditinfo_addr *)]; struct auditinfo_addr * auditinfo_addr; char auditinfo_addr_r_[PADR_(struct auditinfo_addr *)];\n\tchar length_l_[PADL_(u_int)]; u_int length; char length_r_[PADR_(u_int)];\n};\nstruct auditctl_args {\n\tchar path_l_[PADL_(char *)]; char * path; char path_r_[PADR_(char *)];\n};\nstruct _umtx_op_args {\n\tchar obj_l_[PADL_(void *)]; void * obj; char obj_r_[PADR_(void *)];\n\tchar op_l_[PADL_(int)]; int op; char op_r_[PADR_(int)];\n\tchar val_l_[PADL_(u_long)]; u_long val; char val_r_[PADR_(u_long)];\n\tchar uaddr1_l_[PADL_(void *)]; void * uaddr1; char uaddr1_r_[PADR_(void *)];\n\tchar uaddr2_l_[PADL_(void *)]; void * uaddr2; char uaddr2_r_[PADR_(void *)];\n};\nstruct thr_new_args {\n\tchar param_l_[PADL_(struct thr_param *)]; struct thr_param * param; char param_r_[PADR_(struct thr_param *)];\n\tchar param_size_l_[PADL_(int)]; int param_size; char param_size_r_[PADR_(int)];\n};\nstruct sigqueue_args {\n\tchar pid_l_[PADL_(pid_t)]; pid_t pid; char pid_r_[PADR_(pid_t)];\n\tchar signum_l_[PADL_(int)]; int signum; char signum_r_[PADR_(int)];\n\tchar value_l_[PADL_(void *)]; void * value; char value_r_[PADR_(void *)];\n};\nstruct kmq_open_args {\n\tchar path_l_[PADL_(const char *)]; const char * path; char path_r_[PADR_(const char *)];\n\tchar flags_l_[PADL_(int)]; int flags; char flags_r_[PADR_(int)];\n\tchar mode_l_[PADL_(mode_t)]; mode_t mode; char mode_r_[PADR_(mode_t)];\n\tchar attr_l_[PADL_(const struct mq_attr *)]; const struct mq_attr * attr; char attr_r_[PADR_(const struct mq_attr *)];\n};\nstruct kmq_setattr_args {\n\tchar mqd_l_[PADL_(int)]; int mqd; char mqd_r_[PADR_(int)];\n\tchar attr_l_[PADL_(const struct mq_attr *)]; const struct mq_attr * attr; char attr_r_[PADR_(const struct mq_attr *)];\n\tchar oattr_l_[PADL_(struct mq_attr *)]; struct mq_attr * oattr; char oattr_r_[PADR_(struct mq_attr *)];\n};\nstruct kmq_timedreceive_args {\n\tchar mqd_l_[PADL_(int)]; int mqd; char mqd_r_[PADR_(int)];\n\tchar msg_ptr_l_[PADL_(char *)]; char * msg_ptr; char msg_ptr_r_[PADR_(char *)];\n\tchar msg_len_l_[PADL_(size_t)]; size_t msg_len; char msg_len_r_[PADR_(size_t)];\n\tchar msg_prio_l_[PADL_(unsigned *)]; unsigned * msg_prio; char msg_prio_r_[PADR_(unsigned *)];\n\tchar abs_timeout_l_[PADL_(const struct timespec *)]; const struct timespec * abs_timeout; char abs_timeout_r_[PADR_(const struct timespec *)];\n};\nstruct kmq_timedsend_args {\n\tchar mqd_l_[PADL_(int)]; int mqd; char mqd_r_[PADR_(int)];\n\tchar msg_ptr_l_[PADL_(const char *)]; const char * msg_ptr; char msg_ptr_r_[PADR_(const char *)];\n\tchar msg_len_l_[PADL_(size_t)]; size_t msg_len; char msg_len_r_[PADR_(size_t)];\n\tchar msg_prio_l_[PADL_(unsigned)]; unsigned msg_prio; char msg_prio_r_[PADR_(unsigned)];\n\tchar abs_timeout_l_[PADL_(const struct timespec *)]; const struct timespec * abs_timeout; char abs_timeout_r_[PADR_(const struct timespec *)];\n};\nstruct kmq_notify_args {\n\tchar mqd_l_[PADL_(int)]; int mqd; char mqd_r_[PADR_(int)];\n\tchar sigev_l_[PADL_(const struct sigevent *)]; const struct sigevent * sigev; char sigev_r_[PADR_(const struct sigevent *)];\n};\nstruct kmq_unlink_args {\n\tchar path_l_[PADL_(const char *)]; const char * path; char path_r_[PADR_(const char *)];\n};\nstruct abort2_args {\n\tchar why_l_[PADL_(const char *)]; const char * why; char why_r_[PADR_(const char *)];\n\tchar nargs_l_[PADL_(int)]; int nargs; char nargs_r_[PADR_(int)];\n\tchar args_l_[PADL_(void **)]; void ** args; char args_r_[PADR_(void **)];\n};\nstruct thr_set_name_args {\n\tchar id_l_[PADL_(long)]; long id; char id_r_[PADR_(long)];\n\tchar name_l_[PADL_(const char *)]; const char * name; char name_r_[PADR_(const char *)];\n};\nstruct aio_fsync_args {\n\tchar op_l_[PADL_(int)]; int op; char op_r_[PADR_(int)];\n\tchar aiocbp_l_[PADL_(struct aiocb *)]; struct aiocb * aiocbp; char aiocbp_r_[PADR_(struct aiocb *)];\n};\nstruct rtprio_thread_args {\n\tchar function_l_[PADL_(int)]; int function; char function_r_[PADR_(int)];\n\tchar lwpid_l_[PADL_(lwpid_t)]; lwpid_t lwpid; char lwpid_r_[PADR_(lwpid_t)];\n\tchar rtp_l_[PADL_(struct rtprio *)]; struct rtprio * rtp; char rtp_r_[PADR_(struct rtprio *)];\n};\nstruct sctp_peeloff_args {\n\tchar sd_l_[PADL_(int)]; int sd; char sd_r_[PADR_(int)];\n\tchar name_l_[PADL_(uint32_t)]; uint32_t name; char name_r_[PADR_(uint32_t)];\n};\nstruct sctp_generic_sendmsg_args {\n\tchar sd_l_[PADL_(int)]; int sd; char sd_r_[PADR_(int)];\n\tchar msg_l_[PADL_(caddr_t)]; caddr_t msg; char msg_r_[PADR_(caddr_t)];\n\tchar mlen_l_[PADL_(int)]; int mlen; char mlen_r_[PADR_(int)];\n\tchar to_l_[PADL_(caddr_t)]; caddr_t to; char to_r_[PADR_(caddr_t)];\n\tchar tolen_l_[PADL_(__socklen_t)]; __socklen_t tolen; char tolen_r_[PADR_(__socklen_t)];\n\tchar sinfo_l_[PADL_(struct sctp_sndrcvinfo *)]; struct sctp_sndrcvinfo * sinfo; char sinfo_r_[PADR_(struct sctp_sndrcvinfo *)];\n\tchar flags_l_[PADL_(int)]; int flags; char flags_r_[PADR_(int)];\n};\nstruct sctp_generic_sendmsg_iov_args {\n\tchar sd_l_[PADL_(int)]; int sd; char sd_r_[PADR_(int)];\n\tchar iov_l_[PADL_(struct iovec *)]; struct iovec * iov; char iov_r_[PADR_(struct iovec *)];\n\tchar iovlen_l_[PADL_(int)]; int iovlen; char iovlen_r_[PADR_(int)];\n\tchar to_l_[PADL_(caddr_t)]; caddr_t to; char to_r_[PADR_(caddr_t)];\n\tchar tolen_l_[PADL_(__socklen_t)]; __socklen_t tolen; char tolen_r_[PADR_(__socklen_t)];\n\tchar sinfo_l_[PADL_(struct sctp_sndrcvinfo *)]; struct sctp_sndrcvinfo * sinfo; char sinfo_r_[PADR_(struct sctp_sndrcvinfo *)];\n\tchar flags_l_[PADL_(int)]; int flags; char flags_r_[PADR_(int)];\n};\nstruct sctp_generic_recvmsg_args {\n\tchar sd_l_[PADL_(int)]; int sd; char sd_r_[PADR_(int)];\n\tchar iov_l_[PADL_(struct iovec *)]; struct iovec * iov; char iov_r_[PADR_(struct iovec *)];\n\tchar iovlen_l_[PADL_(int)]; int iovlen; char iovlen_r_[PADR_(int)];\n\tchar from_l_[PADL_(struct sockaddr *)]; struct sockaddr * from; char from_r_[PADR_(struct sockaddr *)];\n\tchar fromlenaddr_l_[PADL_(__socklen_t *)]; __socklen_t * fromlenaddr; char fromlenaddr_r_[PADR_(__socklen_t *)];\n\tchar sinfo_l_[PADL_(struct sctp_sndrcvinfo *)]; struct sctp_sndrcvinfo * sinfo; char sinfo_r_[PADR_(struct sctp_sndrcvinfo *)];\n\tchar msg_flags_l_[PADL_(int *)]; int * msg_flags; char msg_flags_r_[PADR_(int *)];\n};\nstruct pread_args {\n\tchar fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)];\n\tchar buf_l_[PADL_(void *)]; void * buf; char buf_r_[PADR_(void *)];\n\tchar nbyte_l_[PADL_(size_t)]; size_t nbyte; char nbyte_r_[PADR_(size_t)];\n\tchar offset_l_[PADL_(off_t)]; off_t offset; char offset_r_[PADR_(off_t)];\n};\nstruct pwrite_args {\n\tchar fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)];\n\tchar buf_l_[PADL_(const void *)]; const void * buf; char buf_r_[PADR_(const void *)];\n\tchar nbyte_l_[PADL_(size_t)]; size_t nbyte; char nbyte_r_[PADR_(size_t)];\n\tchar offset_l_[PADL_(off_t)]; off_t offset; char offset_r_[PADR_(off_t)];\n};\nstruct mmap_args {\n\tchar addr_l_[PADL_(caddr_t)]; caddr_t addr; char addr_r_[PADR_(caddr_t)];\n\tchar len_l_[PADL_(size_t)]; size_t len; char len_r_[PADR_(size_t)];\n\tchar prot_l_[PADL_(int)]; int prot; char prot_r_[PADR_(int)];\n\tchar flags_l_[PADL_(int)]; int flags; char flags_r_[PADR_(int)];\n\tchar fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)];\n\tchar pos_l_[PADL_(off_t)]; off_t pos; char pos_r_[PADR_(off_t)];\n};\nstruct lseek_args {\n\tchar fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)];\n\tchar offset_l_[PADL_(off_t)]; off_t offset; char offset_r_[PADR_(off_t)];\n\tchar whence_l_[PADL_(int)]; int whence; char whence_r_[PADR_(int)];\n};\nstruct truncate_args {\n\tchar path_l_[PADL_(char *)]; char * path; char path_r_[PADR_(char *)];\n\tchar length_l_[PADL_(off_t)]; off_t length; char length_r_[PADR_(off_t)];\n};\nstruct ftruncate_args {\n\tchar fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)];\n\tchar length_l_[PADL_(off_t)]; off_t length; char length_r_[PADR_(off_t)];\n};\nstruct thr_kill2_args {\n\tchar pid_l_[PADL_(pid_t)]; pid_t pid; char pid_r_[PADR_(pid_t)];\n\tchar id_l_[PADL_(long)]; long id; char id_r_[PADR_(long)];\n\tchar sig_l_[PADL_(int)]; int sig; char sig_r_[PADR_(int)];\n};\nstruct shm_open_args {\n\tchar path_l_[PADL_(const char *)]; const char * path; char path_r_[PADR_(const char *)];\n\tchar flags_l_[PADL_(int)]; int flags; char flags_r_[PADR_(int)];\n\tchar mode_l_[PADL_(mode_t)]; mode_t mode; char mode_r_[PADR_(mode_t)];\n};\nstruct shm_unlink_args {\n\tchar path_l_[PADL_(const char *)]; const char * path; char path_r_[PADR_(const char *)];\n};\nstruct cpuset_args {\n\tchar setid_l_[PADL_(cpusetid_t *)]; cpusetid_t * setid; char setid_r_[PADR_(cpusetid_t *)];\n};\nstruct cpuset_setid_args {\n\tchar which_l_[PADL_(cpuwhich_t)]; cpuwhich_t which; char which_r_[PADR_(cpuwhich_t)];\n\tchar id_l_[PADL_(id_t)]; id_t id; char id_r_[PADR_(id_t)];\n\tchar setid_l_[PADL_(cpusetid_t)]; cpusetid_t setid; char setid_r_[PADR_(cpusetid_t)];\n};\nstruct cpuset_getid_args {\n\tchar level_l_[PADL_(cpulevel_t)]; cpulevel_t level; char level_r_[PADR_(cpulevel_t)];\n\tchar which_l_[PADL_(cpuwhich_t)]; cpuwhich_t which; char which_r_[PADR_(cpuwhich_t)];\n\tchar id_l_[PADL_(id_t)]; id_t id; char id_r_[PADR_(id_t)];\n\tchar setid_l_[PADL_(cpusetid_t *)]; cpusetid_t * setid; char setid_r_[PADR_(cpusetid_t *)];\n};\nstruct cpuset_getaffinity_args {\n\tchar level_l_[PADL_(cpulevel_t)]; cpulevel_t level; char level_r_[PADR_(cpulevel_t)];\n\tchar which_l_[PADL_(cpuwhich_t)]; cpuwhich_t which; char which_r_[PADR_(cpuwhich_t)];\n\tchar id_l_[PADL_(id_t)]; id_t id; char id_r_[PADR_(id_t)];\n\tchar cpusetsize_l_[PADL_(size_t)]; size_t cpusetsize; char cpusetsize_r_[PADR_(size_t)];\n\tchar mask_l_[PADL_(cpuset_t *)]; cpuset_t * mask; char mask_r_[PADR_(cpuset_t *)];\n};\nstruct cpuset_setaffinity_args {\n\tchar level_l_[PADL_(cpulevel_t)]; cpulevel_t level; char level_r_[PADR_(cpulevel_t)];\n\tchar which_l_[PADL_(cpuwhich_t)]; cpuwhich_t which; char which_r_[PADR_(cpuwhich_t)];\n\tchar id_l_[PADL_(id_t)]; id_t id; char id_r_[PADR_(id_t)];\n\tchar cpusetsize_l_[PADL_(size_t)]; size_t cpusetsize; char cpusetsize_r_[PADR_(size_t)];\n\tchar mask_l_[PADL_(const cpuset_t *)]; const cpuset_t * mask; char mask_r_[PADR_(const cpuset_t *)];\n};\nstruct faccessat_args {\n\tchar fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)];\n\tchar path_l_[PADL_(char *)]; char * path; char path_r_[PADR_(char *)];\n\tchar mode_l_[PADL_(int)]; int mode; char mode_r_[PADR_(int)];\n\tchar flag_l_[PADL_(int)]; int flag; char flag_r_[PADR_(int)];\n};\nstruct fchmodat_args {\n\tchar fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)];\n\tchar path_l_[PADL_(char *)]; char * path; char path_r_[PADR_(char *)];\n\tchar mode_l_[PADL_(mode_t)]; mode_t mode; char mode_r_[PADR_(mode_t)];\n\tchar flag_l_[PADL_(int)]; int flag; char flag_r_[PADR_(int)];\n};\nstruct fchownat_args {\n\tchar fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)];\n\tchar path_l_[PADL_(char *)]; char * path; char path_r_[PADR_(char *)];\n\tchar uid_l_[PADL_(uid_t)]; uid_t uid; char uid_r_[PADR_(uid_t)];\n\tchar gid_l_[PADL_(gid_t)]; gid_t gid; char gid_r_[PADR_(gid_t)];\n\tchar flag_l_[PADL_(int)]; int flag; char flag_r_[PADR_(int)];\n};\nstruct fexecve_args {\n\tchar fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)];\n\tchar argv_l_[PADL_(char **)]; char ** argv; char argv_r_[PADR_(char **)];\n\tchar envv_l_[PADL_(char **)]; char ** envv; char envv_r_[PADR_(char **)];\n};\nstruct fstatat_args {\n\tchar fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)];\n\tchar path_l_[PADL_(char *)]; char * path; char path_r_[PADR_(char *)];\n\tchar buf_l_[PADL_(struct stat *)]; struct stat * buf; char buf_r_[PADR_(struct stat *)];\n\tchar flag_l_[PADL_(int)]; int flag; char flag_r_[PADR_(int)];\n};\nstruct futimesat_args {\n\tchar fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)];\n\tchar path_l_[PADL_(char *)]; char * path; char path_r_[PADR_(char *)];\n\tchar times_l_[PADL_(struct timeval *)]; struct timeval * times; char times_r_[PADR_(struct timeval *)];\n};\nstruct linkat_args {\n\tchar fd1_l_[PADL_(int)]; int fd1; char fd1_r_[PADR_(int)];\n\tchar path1_l_[PADL_(char *)]; char * path1; char path1_r_[PADR_(char *)];\n\tchar fd2_l_[PADL_(int)]; int fd2; char fd2_r_[PADR_(int)];\n\tchar path2_l_[PADL_(char *)]; char * path2; char path2_r_[PADR_(char *)];\n\tchar flag_l_[PADL_(int)]; int flag; char flag_r_[PADR_(int)];\n};\nstruct mkdirat_args {\n\tchar fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)];\n\tchar path_l_[PADL_(char *)]; char * path; char path_r_[PADR_(char *)];\n\tchar mode_l_[PADL_(mode_t)]; mode_t mode; char mode_r_[PADR_(mode_t)];\n};\nstruct mkfifoat_args {\n\tchar fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)];\n\tchar path_l_[PADL_(char *)]; char * path; char path_r_[PADR_(char *)];\n\tchar mode_l_[PADL_(mode_t)]; mode_t mode; char mode_r_[PADR_(mode_t)];\n};\nstruct mknodat_args {\n\tchar fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)];\n\tchar path_l_[PADL_(char *)]; char * path; char path_r_[PADR_(char *)];\n\tchar mode_l_[PADL_(mode_t)]; mode_t mode; char mode_r_[PADR_(mode_t)];\n\tchar dev_l_[PADL_(dev_t)]; dev_t dev; char dev_r_[PADR_(dev_t)];\n};\nstruct openat_args {\n\tchar fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)];\n\tchar path_l_[PADL_(char *)]; char * path; char path_r_[PADR_(char *)];\n\tchar flag_l_[PADL_(int)]; int flag; char flag_r_[PADR_(int)];\n\tchar mode_l_[PADL_(mode_t)]; mode_t mode; char mode_r_[PADR_(mode_t)];\n};\nstruct readlinkat_args {\n\tchar fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)];\n\tchar path_l_[PADL_(char *)]; char * path; char path_r_[PADR_(char *)];\n\tchar buf_l_[PADL_(char *)]; char * buf; char buf_r_[PADR_(char *)];\n\tchar bufsize_l_[PADL_(size_t)]; size_t bufsize; char bufsize_r_[PADR_(size_t)];\n};\nstruct renameat_args {\n\tchar oldfd_l_[PADL_(int)]; int oldfd; char oldfd_r_[PADR_(int)];\n\tchar old_l_[PADL_(char *)]; char * old; char old_r_[PADR_(char *)];\n\tchar newfd_l_[PADL_(int)]; int newfd; char newfd_r_[PADR_(int)];\n\tchar new_l_[PADL_(char *)]; char * new; char new_r_[PADR_(char *)];\n};\nstruct symlinkat_args {\n\tchar path1_l_[PADL_(char *)]; char * path1; char path1_r_[PADR_(char *)];\n\tchar fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)];\n\tchar path2_l_[PADL_(char *)]; char * path2; char path2_r_[PADR_(char *)];\n};\nstruct unlinkat_args {\n\tchar fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)];\n\tchar path_l_[PADL_(char *)]; char * path; char path_r_[PADR_(char *)];\n\tchar flag_l_[PADL_(int)]; int flag; char flag_r_[PADR_(int)];\n};\nstruct posix_openpt_args {\n\tchar flags_l_[PADL_(int)]; int flags; char flags_r_[PADR_(int)];\n};\nstruct gssd_syscall_args {\n\tchar path_l_[PADL_(char *)]; char * path; char path_r_[PADR_(char *)];\n};\nstruct jail_get_args {\n\tchar iovp_l_[PADL_(struct iovec *)]; struct iovec * iovp; char iovp_r_[PADR_(struct iovec *)];\n\tchar iovcnt_l_[PADL_(unsigned int)]; unsigned int iovcnt; char iovcnt_r_[PADR_(unsigned int)];\n\tchar flags_l_[PADL_(int)]; int flags; char flags_r_[PADR_(int)];\n};\nstruct jail_set_args {\n\tchar iovp_l_[PADL_(struct iovec *)]; struct iovec * iovp; char iovp_r_[PADR_(struct iovec *)];\n\tchar iovcnt_l_[PADL_(unsigned int)]; unsigned int iovcnt; char iovcnt_r_[PADR_(unsigned int)];\n\tchar flags_l_[PADL_(int)]; int flags; char flags_r_[PADR_(int)];\n};\nstruct jail_remove_args {\n\tchar jid_l_[PADL_(int)]; int jid; char jid_r_[PADR_(int)];\n};\nstruct closefrom_args {\n\tchar lowfd_l_[PADL_(int)]; int lowfd; char lowfd_r_[PADR_(int)];\n};\nstruct __semctl_args {\n\tchar semid_l_[PADL_(int)]; int semid; char semid_r_[PADR_(int)];\n\tchar semnum_l_[PADL_(int)]; int semnum; char semnum_r_[PADR_(int)];\n\tchar cmd_l_[PADL_(int)]; int cmd; char cmd_r_[PADR_(int)];\n\tchar arg_l_[PADL_(union semun *)]; union semun * arg; char arg_r_[PADR_(union semun *)];\n};\nstruct msgctl_args {\n\tchar msqid_l_[PADL_(int)]; int msqid; char msqid_r_[PADR_(int)];\n\tchar cmd_l_[PADL_(int)]; int cmd; char cmd_r_[PADR_(int)];\n\tchar buf_l_[PADL_(struct msqid_ds *)]; struct msqid_ds * buf; char buf_r_[PADR_(struct msqid_ds *)];\n};\nstruct shmctl_args {\n\tchar shmid_l_[PADL_(int)]; int shmid; char shmid_r_[PADR_(int)];\n\tchar cmd_l_[PADL_(int)]; int cmd; char cmd_r_[PADR_(int)];\n\tchar buf_l_[PADL_(struct shmid_ds *)]; struct shmid_ds * buf; char buf_r_[PADR_(struct shmid_ds *)];\n};\nstruct lpathconf_args {\n\tchar path_l_[PADL_(char *)]; char * path; char path_r_[PADR_(char *)];\n\tchar name_l_[PADL_(int)]; int name; char name_r_[PADR_(int)];\n};\nstruct cap_new_args {\n\tchar fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)];\n\tchar rights_l_[PADL_(u_int64_t)]; u_int64_t rights; char rights_r_[PADR_(u_int64_t)];\n};\nstruct cap_getrights_args {\n\tchar fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)];\n\tchar rightsp_l_[PADL_(u_int64_t *)]; u_int64_t * rightsp; char rightsp_r_[PADR_(u_int64_t *)];\n};\nstruct cap_enter_args {\n\tregister_t dummy;\n};\nstruct cap_getmode_args {\n\tchar modep_l_[PADL_(u_int *)]; u_int * modep; char modep_r_[PADR_(u_int *)];\n};\nstruct pdfork_args {\n\tchar fdp_l_[PADL_(int *)]; int * fdp; char fdp_r_[PADR_(int *)];\n\tchar flags_l_[PADL_(int)]; int flags; char flags_r_[PADR_(int)];\n};\nstruct pdkill_args {\n\tchar fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)];\n\tchar signum_l_[PADL_(int)]; int signum; char signum_r_[PADR_(int)];\n};\nstruct pdgetpid_args {\n\tchar fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)];\n\tchar pidp_l_[PADL_(pid_t *)]; pid_t * pidp; char pidp_r_[PADR_(pid_t *)];\n};\nstruct pselect_args {\n\tchar nd_l_[PADL_(int)]; int nd; char nd_r_[PADR_(int)];\n\tchar in_l_[PADL_(fd_set *)]; fd_set * in; char in_r_[PADR_(fd_set *)];\n\tchar ou_l_[PADL_(fd_set *)]; fd_set * ou; char ou_r_[PADR_(fd_set *)];\n\tchar ex_l_[PADL_(fd_set *)]; fd_set * ex; char ex_r_[PADR_(fd_set *)];\n\tchar ts_l_[PADL_(const struct timespec *)]; const struct timespec * ts; char ts_r_[PADR_(const struct timespec *)];\n\tchar sm_l_[PADL_(const sigset_t *)]; const sigset_t * sm; char sm_r_[PADR_(const sigset_t *)];\n};\nstruct getloginclass_args {\n\tchar namebuf_l_[PADL_(char *)]; char * namebuf; char namebuf_r_[PADR_(char *)];\n\tchar namelen_l_[PADL_(size_t)]; size_t namelen; char namelen_r_[PADR_(size_t)];\n};\nstruct setloginclass_args {\n\tchar namebuf_l_[PADL_(const char *)]; const char * namebuf; char namebuf_r_[PADR_(const char *)];\n};\nstruct rctl_get_racct_args {\n\tchar inbufp_l_[PADL_(const void *)]; const void * inbufp; char inbufp_r_[PADR_(const void *)];\n\tchar inbuflen_l_[PADL_(size_t)]; size_t inbuflen; char inbuflen_r_[PADR_(size_t)];\n\tchar outbufp_l_[PADL_(void *)]; void * outbufp; char outbufp_r_[PADR_(void *)];\n\tchar outbuflen_l_[PADL_(size_t)]; size_t outbuflen; char outbuflen_r_[PADR_(size_t)];\n};\nstruct rctl_get_rules_args {\n\tchar inbufp_l_[PADL_(const void *)]; const void * inbufp; char inbufp_r_[PADR_(const void *)];\n\tchar inbuflen_l_[PADL_(size_t)]; size_t inbuflen; char inbuflen_r_[PADR_(size_t)];\n\tchar outbufp_l_[PADL_(void *)]; void * outbufp; char outbufp_r_[PADR_(void *)];\n\tchar outbuflen_l_[PADL_(size_t)]; size_t outbuflen; char outbuflen_r_[PADR_(size_t)];\n};\nstruct rctl_get_limits_args {\n\tchar inbufp_l_[PADL_(const void *)]; const void * inbufp; char inbufp_r_[PADR_(const void *)];\n\tchar inbuflen_l_[PADL_(size_t)]; size_t inbuflen; char inbuflen_r_[PADR_(size_t)];\n\tchar outbufp_l_[PADL_(void *)]; void * outbufp; char outbufp_r_[PADR_(void *)];\n\tchar outbuflen_l_[PADL_(size_t)]; size_t outbuflen; char outbuflen_r_[PADR_(size_t)];\n};\nstruct rctl_add_rule_args {\n\tchar inbufp_l_[PADL_(const void *)]; const void * inbufp; char inbufp_r_[PADR_(const void *)];\n\tchar inbuflen_l_[PADL_(size_t)]; size_t inbuflen; char inbuflen_r_[PADR_(size_t)];\n\tchar outbufp_l_[PADL_(void *)]; void * outbufp; char outbufp_r_[PADR_(void *)];\n\tchar outbuflen_l_[PADL_(size_t)]; size_t outbuflen; char outbuflen_r_[PADR_(size_t)];\n};\nstruct rctl_remove_rule_args {\n\tchar inbufp_l_[PADL_(const void *)]; const void * inbufp; char inbufp_r_[PADR_(const void *)];\n\tchar inbuflen_l_[PADL_(size_t)]; size_t inbuflen; char inbuflen_r_[PADR_(size_t)];\n\tchar outbufp_l_[PADL_(void *)]; void * outbufp; char outbufp_r_[PADR_(void *)];\n\tchar outbuflen_l_[PADL_(size_t)]; size_t outbuflen; char outbuflen_r_[PADR_(size_t)];\n};\nstruct posix_fallocate_args {\n\tchar fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)];\n\tchar offset_l_[PADL_(off_t)]; off_t offset; char offset_r_[PADR_(off_t)];\n\tchar len_l_[PADL_(off_t)]; off_t len; char len_r_[PADR_(off_t)];\n};\nint\tnosys(struct thread *, struct nosys_args *);\nvoid\tsys_sys_exit(struct thread *, struct sys_exit_args *);\nint\tsys_fork(struct thread *, struct fork_args *);\nint\tsys_read(struct thread *, struct read_args *);\nint\tsys_write(struct thread *, struct write_args *);\nint\tsys_open(struct thread *, struct open_args *);\nint\tsys_close(struct thread *, struct close_args *);\nint\tsys_wait4(struct thread *, struct wait_args *);\nint\tsys_link(struct thread *, struct link_args *);\nint\tsys_unlink(struct thread *, struct unlink_args *);\nint\tsys_chdir(struct thread *, struct chdir_args *);\nint\tsys_fchdir(struct thread *, struct fchdir_args *);\nint\tsys_mknod(struct thread *, struct mknod_args *);\nint\tsys_chmod(struct thread *, struct chmod_args *);\nint\tsys_chown(struct thread *, struct chown_args *);\nint\tsys_obreak(struct thread *, struct obreak_args *);\nint\tsys_getpid(struct thread *, struct getpid_args *);\nint\tsys_mount(struct thread *, struct mount_args *);\nint\tsys_unmount(struct thread *, struct unmount_args *);\nint\tsys_setuid(struct thread *, struct setuid_args *);\nint\tsys_getuid(struct thread *, struct getuid_args *);\nint\tsys_geteuid(struct thread *, struct geteuid_args *);\nint\tsys_ptrace(struct thread *, struct ptrace_args *);\nint\tsys_recvmsg(struct thread *, struct recvmsg_args *);\nint\tsys_sendmsg(struct thread *, struct sendmsg_args *);\nint\tsys_recvfrom(struct thread *, struct recvfrom_args *);\nint\tsys_accept(struct thread *, struct accept_args *);\nint\tsys_getpeername(struct thread *, struct getpeername_args *);\nint\tsys_getsockname(struct thread *, struct getsockname_args *);\nint\tsys_access(struct thread *, struct access_args *);\nint\tsys_chflags(struct thread *, struct chflags_args *);\nint\tsys_fchflags(struct thread *, struct fchflags_args *);\nint\tsys_sync(struct thread *, struct sync_args *);\nint\tsys_kill(struct thread *, struct kill_args *);\nint\tsys_getppid(struct thread *, struct getppid_args *);\nint\tsys_dup(struct thread *, struct dup_args *);\nint\tsys_pipe(struct thread *, struct pipe_args *);\nint\tsys_getegid(struct thread *, struct getegid_args *);\nint\tsys_profil(struct thread *, struct profil_args *);\nint\tsys_ktrace(struct thread *, struct ktrace_args *);\nint\tsys_getgid(struct thread *, struct getgid_args *);\nint\tsys_getlogin(struct thread *, struct getlogin_args *);\nint\tsys_setlogin(struct thread *, struct setlogin_args *);\nint\tsys_acct(struct thread *, struct acct_args *);\nint\tsys_sigaltstack(struct thread *, struct sigaltstack_args *);\nint\tsys_ioctl(struct thread *, struct ioctl_args *);\nint\tsys_reboot(struct thread *, struct reboot_args *);\nint\tsys_revoke(struct thread *, struct revoke_args *);\nint\tsys_symlink(struct thread *, struct symlink_args *);\nint\tsys_readlink(struct thread *, struct readlink_args *);\nint\tsys_execve(struct thread *, struct execve_args *);\nint\tsys_umask(struct thread *, struct umask_args *);\nint\tsys_chroot(struct thread *, struct chroot_args *);\nint\tsys_msync(struct thread *, struct msync_args *);\nint\tsys_vfork(struct thread *, struct vfork_args *);\nint\tsys_sbrk(struct thread *, struct sbrk_args *);\nint\tsys_sstk(struct thread *, struct sstk_args *);\nint\tsys_ovadvise(struct thread *, struct ovadvise_args *);\nint\tsys_munmap(struct thread *, struct munmap_args *);\nint\tsys_mprotect(struct thread *, struct mprotect_args *);\nint\tsys_madvise(struct thread *, struct madvise_args *);\nint\tsys_mincore(struct thread *, struct mincore_args *);\nint\tsys_getgroups(struct thread *, struct getgroups_args *);\nint\tsys_setgroups(struct thread *, struct setgroups_args *);\nint\tsys_getpgrp(struct thread *, struct getpgrp_args *);\nint\tsys_setpgid(struct thread *, struct setpgid_args *);\nint\tsys_setitimer(struct thread *, struct setitimer_args *);\nint\tsys_swapon(struct thread *, struct swapon_args *);\nint\tsys_getitimer(struct thread *, struct getitimer_args *);\nint\tsys_getdtablesize(struct thread *, struct getdtablesize_args *);\nint\tsys_dup2(struct thread *, struct dup2_args *);\nint\tsys_fcntl(struct thread *, struct fcntl_args *);\nint\tsys_select(struct thread *, struct select_args *);\nint\tsys_fsync(struct thread *, struct fsync_args *);\nint\tsys_setpriority(struct thread *, struct setpriority_args *);\nint\tsys_socket(struct thread *, struct socket_args *);\nint\tsys_connect(struct thread *, struct connect_args *);\nint\tsys_getpriority(struct thread *, struct getpriority_args *);\nint\tsys_bind(struct thread *, struct bind_args *);\nint\tsys_setsockopt(struct thread *, struct setsockopt_args *);\nint\tsys_listen(struct thread *, struct listen_args *);\nint\tsys_gettimeofday(struct thread *, struct gettimeofday_args *);\nint\tsys_getrusage(struct thread *, struct getrusage_args *);\nint\tsys_getsockopt(struct thread *, struct getsockopt_args *);\nint\tsys_readv(struct thread *, struct readv_args *);\nint\tsys_writev(struct thread *, struct writev_args *);\nint\tsys_settimeofday(struct thread *, struct settimeofday_args *);\nint\tsys_fchown(struct thread *, struct fchown_args *);\nint\tsys_fchmod(struct thread *, struct fchmod_args *);\nint\tsys_setreuid(struct thread *, struct setreuid_args *);\nint\tsys_setregid(struct thread *, struct setregid_args *);\nint\tsys_rename(struct thread *, struct rename_args *);\nint\tsys_flock(struct thread *, struct flock_args *);\nint\tsys_mkfifo(struct thread *, struct mkfifo_args *);\nint\tsys_sendto(struct thread *, struct sendto_args *);\nint\tsys_shutdown(struct thread *, struct shutdown_args *);\nint\tsys_socketpair(struct thread *, struct socketpair_args *);\nint\tsys_mkdir(struct thread *, struct mkdir_args *);\nint\tsys_rmdir(struct thread *, struct rmdir_args *);\nint\tsys_utimes(struct thread *, struct utimes_args *);\nint\tsys_adjtime(struct thread *, struct adjtime_args *);\nint\tsys_setsid(struct thread *, struct setsid_args *);\nint\tsys_quotactl(struct thread *, struct quotactl_args *);\nint\tsys_nlm_syscall(struct thread *, struct nlm_syscall_args *);\nint\tsys_nfssvc(struct thread *, struct nfssvc_args *);\nint\tsys_lgetfh(struct thread *, struct lgetfh_args *);\nint\tsys_getfh(struct thread *, struct getfh_args *);\nint\tsysarch(struct thread *, struct sysarch_args *);\nint\tsys_rtprio(struct thread *, struct rtprio_args *);\nint\tsys_semsys(struct thread *, struct semsys_args *);\nint\tsys_msgsys(struct thread *, struct msgsys_args *);\nint\tsys_shmsys(struct thread *, struct shmsys_args *);\nint\tfreebsd6_pread(struct thread *, struct freebsd6_pread_args *);\nint\tfreebsd6_pwrite(struct thread *, struct freebsd6_pwrite_args *);\nint\tsys_setfib(struct thread *, struct setfib_args *);\nint\tsys_ntp_adjtime(struct thread *, struct ntp_adjtime_args *);\nint\tsys_setgid(struct thread *, struct setgid_args *);\nint\tsys_setegid(struct thread *, struct setegid_args *);\nint\tsys_seteuid(struct thread *, struct seteuid_args *);\nint\tsys_stat(struct thread *, struct stat_args *);\nint\tsys_fstat(struct thread *, struct fstat_args *);\nint\tsys_lstat(struct thread *, struct lstat_args *);\nint\tsys_pathconf(struct thread *, struct pathconf_args *);\nint\tsys_fpathconf(struct thread *, struct fpathconf_args *);\nint\tsys_getrlimit(struct thread *, struct __getrlimit_args *);\nint\tsys_setrlimit(struct thread *, struct __setrlimit_args *);\nint\tsys_getdirentries(struct thread *, struct getdirentries_args *);\nint\tfreebsd6_mmap(struct thread *, struct freebsd6_mmap_args *);\nint\tfreebsd6_lseek(struct thread *, struct freebsd6_lseek_args *);\nint\tfreebsd6_truncate(struct thread *, struct freebsd6_truncate_args *);\nint\tfreebsd6_ftruncate(struct thread *, struct freebsd6_ftruncate_args *);\nint\tsys___sysctl(struct thread *, struct sysctl_args *);\nint\tsys_mlock(struct thread *, struct mlock_args *);\nint\tsys_munlock(struct thread *, struct munlock_args *);\nint\tsys_undelete(struct thread *, struct undelete_args *);\nint\tsys_futimes(struct thread *, struct futimes_args *);\nint\tsys_getpgid(struct thread *, struct getpgid_args *);\nint\tsys_poll(struct thread *, struct poll_args *);\nint\tsys_semget(struct thread *, struct semget_args *);\nint\tsys_semop(struct thread *, struct semop_args *);\nint\tsys_msgget(struct thread *, struct msgget_args *);\nint\tsys_msgsnd(struct thread *, struct msgsnd_args *);\nint\tsys_msgrcv(struct thread *, struct msgrcv_args *);\nint\tsys_shmat(struct thread *, struct shmat_args *);\nint\tsys_shmdt(struct thread *, struct shmdt_args *);\nint\tsys_shmget(struct thread *, struct shmget_args *);\nint\tsys_clock_gettime(struct thread *, struct clock_gettime_args *);\nint\tsys_clock_settime(struct thread *, struct clock_settime_args *);\nint\tsys_clock_getres(struct thread *, struct clock_getres_args *);\nint\tsys_ktimer_create(struct thread *, struct ktimer_create_args *);\nint\tsys_ktimer_delete(struct thread *, struct ktimer_delete_args *);\nint\tsys_ktimer_settime(struct thread *, struct ktimer_settime_args *);\nint\tsys_ktimer_gettime(struct thread *, struct ktimer_gettime_args *);\nint\tsys_ktimer_getoverrun(struct thread *, struct ktimer_getoverrun_args *);\nint\tsys_nanosleep(struct thread *, struct nanosleep_args *);\nint\tsys_ntp_gettime(struct thread *, struct ntp_gettime_args *);\nint\tsys_minherit(struct thread *, struct minherit_args *);\nint\tsys_rfork(struct thread *, struct rfork_args *);\nint\tsys_openbsd_poll(struct thread *, struct openbsd_poll_args *);\nint\tsys_issetugid(struct thread *, struct issetugid_args *);\nint\tsys_lchown(struct thread *, struct lchown_args *);\nint\tsys_aio_read(struct thread *, struct aio_read_args *);\nint\tsys_aio_write(struct thread *, struct aio_write_args *);\nint\tsys_lio_listio(struct thread *, struct lio_listio_args *);\nint\tsys_getdents(struct thread *, struct getdents_args *);\nint\tsys_lchmod(struct thread *, struct lchmod_args *);\nint\tsys_lutimes(struct thread *, struct lutimes_args *);\nint\tsys_nstat(struct thread *, struct nstat_args *);\nint\tsys_nfstat(struct thread *, struct nfstat_args *);\nint\tsys_nlstat(struct thread *, struct nlstat_args *);\nint\tsys_preadv(struct thread *, struct preadv_args *);\nint\tsys_pwritev(struct thread *, struct pwritev_args *);\nint\tsys_fhopen(struct thread *, struct fhopen_args *);\nint\tsys_fhstat(struct thread *, struct fhstat_args *);\nint\tsys_modnext(struct thread *, struct modnext_args *);\nint\tsys_modstat(struct thread *, struct modstat_args *);\nint\tsys_modfnext(struct thread *, struct modfnext_args *);\nint\tsys_modfind(struct thread *, struct modfind_args *);\nint\tsys_kldload(struct thread *, struct kldload_args *);\nint\tsys_kldunload(struct thread *, struct kldunload_args *);\nint\tsys_kldfind(struct thread *, struct kldfind_args *);\nint\tsys_kldnext(struct thread *, struct kldnext_args *);\nint\tsys_kldstat(struct thread *, struct kldstat_args *);\nint\tsys_kldfirstmod(struct thread *, struct kldfirstmod_args *);\nint\tsys_getsid(struct thread *, struct getsid_args *);\nint\tsys_setresuid(struct thread *, struct setresuid_args *);\nint\tsys_setresgid(struct thread *, struct setresgid_args *);\nint\tsys_aio_return(struct thread *, struct aio_return_args *);\nint\tsys_aio_suspend(struct thread *, struct aio_suspend_args *);\nint\tsys_aio_cancel(struct thread *, struct aio_cancel_args *);\nint\tsys_aio_error(struct thread *, struct aio_error_args *);\nint\tsys_oaio_read(struct thread *, struct oaio_read_args *);\nint\tsys_oaio_write(struct thread *, struct oaio_write_args *);\nint\tsys_olio_listio(struct thread *, struct olio_listio_args *);\nint\tsys_yield(struct thread *, struct yield_args *);\nint\tsys_mlockall(struct thread *, struct mlockall_args *);\nint\tsys_munlockall(struct thread *, struct munlockall_args *);\nint\tsys___getcwd(struct thread *, struct __getcwd_args *);\nint\tsys_sched_setparam(struct thread *, struct sched_setparam_args *);\nint\tsys_sched_getparam(struct thread *, struct sched_getparam_args *);\nint\tsys_sched_setscheduler(struct thread *, struct sched_setscheduler_args *);\nint\tsys_sched_getscheduler(struct thread *, struct sched_getscheduler_args *);\nint\tsys_sched_yield(struct thread *, struct sched_yield_args *);\nint\tsys_sched_get_priority_max(struct thread *, struct sched_get_priority_max_args *);\nint\tsys_sched_get_priority_min(struct thread *, struct sched_get_priority_min_args *);\nint\tsys_sched_rr_get_interval(struct thread *, struct sched_rr_get_interval_args *);\nint\tsys_utrace(struct thread *, struct utrace_args *);\nint\tsys_kldsym(struct thread *, struct kldsym_args *);\nint\tsys_jail(struct thread *, struct jail_args *);\nint\tsys_nnpfs_syscall(struct thread *, struct nnpfs_syscall_args *);\nint\tsys_sigprocmask(struct thread *, struct sigprocmask_args *);\nint\tsys_sigsuspend(struct thread *, struct sigsuspend_args *);\nint\tsys_sigpending(struct thread *, struct sigpending_args *);\nint\tsys_sigtimedwait(struct thread *, struct sigtimedwait_args *);\nint\tsys_sigwaitinfo(struct thread *, struct sigwaitinfo_args *);\nint\tsys___acl_get_file(struct thread *, struct __acl_get_file_args *);\nint\tsys___acl_set_file(struct thread *, struct __acl_set_file_args *);\nint\tsys___acl_get_fd(struct thread *, struct __acl_get_fd_args *);\nint\tsys___acl_set_fd(struct thread *, struct __acl_set_fd_args *);\nint\tsys___acl_delete_file(struct thread *, struct __acl_delete_file_args *);\nint\tsys___acl_delete_fd(struct thread *, struct __acl_delete_fd_args *);\nint\tsys___acl_aclcheck_file(struct thread *, struct __acl_aclcheck_file_args *);\nint\tsys___acl_aclcheck_fd(struct thread *, struct __acl_aclcheck_fd_args *);\nint\tsys_extattrctl(struct thread *, struct extattrctl_args *);\nint\tsys_extattr_set_file(struct thread *, struct extattr_set_file_args *);\nint\tsys_extattr_get_file(struct thread *, struct extattr_get_file_args *);\nint\tsys_extattr_delete_file(struct thread *, struct extattr_delete_file_args *);\nint\tsys_aio_waitcomplete(struct thread *, struct aio_waitcomplete_args *);\nint\tsys_getresuid(struct thread *, struct getresuid_args *);\nint\tsys_getresgid(struct thread *, struct getresgid_args *);\nint\tsys_kqueue(struct thread *, struct kqueue_args *);\nint\tsys_kevent(struct thread *, struct kevent_args *);\nint\tsys_extattr_set_fd(struct thread *, struct extattr_set_fd_args *);\nint\tsys_extattr_get_fd(struct thread *, struct extattr_get_fd_args *);\nint\tsys_extattr_delete_fd(struct thread *, struct extattr_delete_fd_args *);\nint\tsys___setugid(struct thread *, struct __setugid_args *);\nint\tsys_eaccess(struct thread *, struct eaccess_args *);\nint\tsys_afs3_syscall(struct thread *, struct afs3_syscall_args *);\nint\tsys_nmount(struct thread *, struct nmount_args *);\nint\tsys___mac_get_proc(struct thread *, struct __mac_get_proc_args *);\nint\tsys___mac_set_proc(struct thread *, struct __mac_set_proc_args *);\nint\tsys___mac_get_fd(struct thread *, struct __mac_get_fd_args *);\nint\tsys___mac_get_file(struct thread *, struct __mac_get_file_args *);\nint\tsys___mac_set_fd(struct thread *, struct __mac_set_fd_args *);\nint\tsys___mac_set_file(struct thread *, struct __mac_set_file_args *);\nint\tsys_kenv(struct thread *, struct kenv_args *);\nint\tsys_lchflags(struct thread *, struct lchflags_args *);\nint\tsys_uuidgen(struct thread *, struct uuidgen_args *);\nint\tsys_sendfile(struct thread *, struct sendfile_args *);\nint\tsys_mac_syscall(struct thread *, struct mac_syscall_args *);\nint\tsys_getfsstat(struct thread *, struct getfsstat_args *);\nint\tsys_statfs(struct thread *, struct statfs_args *);\nint\tsys_fstatfs(struct thread *, struct fstatfs_args *);\nint\tsys_fhstatfs(struct thread *, struct fhstatfs_args *);\nint\tsys_ksem_close(struct thread *, struct ksem_close_args *);\nint\tsys_ksem_post(struct thread *, struct ksem_post_args *);\nint\tsys_ksem_wait(struct thread *, struct ksem_wait_args *);\nint\tsys_ksem_trywait(struct thread *, struct ksem_trywait_args *);\nint\tsys_ksem_init(struct thread *, struct ksem_init_args *);\nint\tsys_ksem_open(struct thread *, struct ksem_open_args *);\nint\tsys_ksem_unlink(struct thread *, struct ksem_unlink_args *);\nint\tsys_ksem_getvalue(struct thread *, struct ksem_getvalue_args *);\nint\tsys_ksem_destroy(struct thread *, struct ksem_destroy_args *);\nint\tsys___mac_get_pid(struct thread *, struct __mac_get_pid_args *);\nint\tsys___mac_get_link(struct thread *, struct __mac_get_link_args *);\nint\tsys___mac_set_link(struct thread *, struct __mac_set_link_args *);\nint\tsys_extattr_set_link(struct thread *, struct extattr_set_link_args *);\nint\tsys_extattr_get_link(struct thread *, struct extattr_get_link_args *);\nint\tsys_extattr_delete_link(struct thread *, struct extattr_delete_link_args *);\nint\tsys___mac_execve(struct thread *, struct __mac_execve_args *);\nint\tsys_sigaction(struct thread *, struct sigaction_args *);\nint\tsys_sigreturn(struct thread *, struct sigreturn_args *);\nint\tsys_getcontext(struct thread *, struct getcontext_args *);\nint\tsys_setcontext(struct thread *, struct setcontext_args *);\nint\tsys_swapcontext(struct thread *, struct swapcontext_args *);\nint\tsys_swapoff(struct thread *, struct swapoff_args *);\nint\tsys___acl_get_link(struct thread *, struct __acl_get_link_args *);\nint\tsys___acl_set_link(struct thread *, struct __acl_set_link_args *);\nint\tsys___acl_delete_link(struct thread *, struct __acl_delete_link_args *);\nint\tsys___acl_aclcheck_link(struct thread *, struct __acl_aclcheck_link_args *);\nint\tsys_sigwait(struct thread *, struct sigwait_args *);\nint\tsys_thr_create(struct thread *, struct thr_create_args *);\nint\tsys_thr_exit(struct thread *, struct thr_exit_args *);\nint\tsys_thr_self(struct thread *, struct thr_self_args *);\nint\tsys_thr_kill(struct thread *, struct thr_kill_args *);\nint\tsys__umtx_lock(struct thread *, struct _umtx_lock_args *);\nint\tsys__umtx_unlock(struct thread *, struct _umtx_unlock_args *);\nint\tsys_jail_attach(struct thread *, struct jail_attach_args *);\nint\tsys_extattr_list_fd(struct thread *, struct extattr_list_fd_args *);\nint\tsys_extattr_list_file(struct thread *, struct extattr_list_file_args *);\nint\tsys_extattr_list_link(struct thread *, struct extattr_list_link_args *);\nint\tsys_ksem_timedwait(struct thread *, struct ksem_timedwait_args *);\nint\tsys_thr_suspend(struct thread *, struct thr_suspend_args *);\nint\tsys_thr_wake(struct thread *, struct thr_wake_args *);\nint\tsys_kldunloadf(struct thread *, struct kldunloadf_args *);\nint\tsys_audit(struct thread *, struct audit_args *);\nint\tsys_auditon(struct thread *, struct auditon_args *);\nint\tsys_getauid(struct thread *, struct getauid_args *);\nint\tsys_setauid(struct thread *, struct setauid_args *);\nint\tsys_getaudit(struct thread *, struct getaudit_args *);\nint\tsys_setaudit(struct thread *, struct setaudit_args *);\nint\tsys_getaudit_addr(struct thread *, struct getaudit_addr_args *);\nint\tsys_setaudit_addr(struct thread *, struct setaudit_addr_args *);\nint\tsys_auditctl(struct thread *, struct auditctl_args *);\nint\tsys__umtx_op(struct thread *, struct _umtx_op_args *);\nint\tsys_thr_new(struct thread *, struct thr_new_args *);\nint\tsys_sigqueue(struct thread *, struct sigqueue_args *);\nint\tsys_kmq_open(struct thread *, struct kmq_open_args *);\nint\tsys_kmq_setattr(struct thread *, struct kmq_setattr_args *);\nint\tsys_kmq_timedreceive(struct thread *, struct kmq_timedreceive_args *);\nint\tsys_kmq_timedsend(struct thread *, struct kmq_timedsend_args *);\nint\tsys_kmq_notify(struct thread *, struct kmq_notify_args *);\nint\tsys_kmq_unlink(struct thread *, struct kmq_unlink_args *);\nint\tsys_abort2(struct thread *, struct abort2_args *);\nint\tsys_thr_set_name(struct thread *, struct thr_set_name_args *);\nint\tsys_aio_fsync(struct thread *, struct aio_fsync_args *);\nint\tsys_rtprio_thread(struct thread *, struct rtprio_thread_args *);\nint\tsys_sctp_peeloff(struct thread *, struct sctp_peeloff_args *);\nint\tsys_sctp_generic_sendmsg(struct thread *, struct sctp_generic_sendmsg_args *);\nint\tsys_sctp_generic_sendmsg_iov(struct thread *, struct sctp_generic_sendmsg_iov_args *);\nint\tsys_sctp_generic_recvmsg(struct thread *, struct sctp_generic_recvmsg_args *);\nint\tsys_pread(struct thread *, struct pread_args *);\nint\tsys_pwrite(struct thread *, struct pwrite_args *);\nint\tsys_mmap(struct thread *, struct mmap_args *);\nint\tsys_lseek(struct thread *, struct lseek_args *);\nint\tsys_truncate(struct thread *, struct truncate_args *);\nint\tsys_ftruncate(struct thread *, struct ftruncate_args *);\nint\tsys_thr_kill2(struct thread *, struct thr_kill2_args *);\nint\tsys_shm_open(struct thread *, struct shm_open_args *);\nint\tsys_shm_unlink(struct thread *, struct shm_unlink_args *);\nint\tsys_cpuset(struct thread *, struct cpuset_args *);\nint\tsys_cpuset_setid(struct thread *, struct cpuset_setid_args *);\nint\tsys_cpuset_getid(struct thread *, struct cpuset_getid_args *);\nint\tsys_cpuset_getaffinity(struct thread *, struct cpuset_getaffinity_args *);\nint\tsys_cpuset_setaffinity(struct thread *, struct cpuset_setaffinity_args *);\nint\tsys_faccessat(struct thread *, struct faccessat_args *);\nint\tsys_fchmodat(struct thread *, struct fchmodat_args *);\nint\tsys_fchownat(struct thread *, struct fchownat_args *);\nint\tsys_fexecve(struct thread *, struct fexecve_args *);\nint\tsys_fstatat(struct thread *, struct fstatat_args *);\nint\tsys_futimesat(struct thread *, struct futimesat_args *);\nint\tsys_linkat(struct thread *, struct linkat_args *);\nint\tsys_mkdirat(struct thread *, struct mkdirat_args *);\nint\tsys_mkfifoat(struct thread *, struct mkfifoat_args *);\nint\tsys_mknodat(struct thread *, struct mknodat_args *);\nint\tsys_openat(struct thread *, struct openat_args *);\nint\tsys_readlinkat(struct thread *, struct readlinkat_args *);\nint\tsys_renameat(struct thread *, struct renameat_args *);\nint\tsys_symlinkat(struct thread *, struct symlinkat_args *);\nint\tsys_unlinkat(struct thread *, struct unlinkat_args *);\nint\tsys_posix_openpt(struct thread *, struct posix_openpt_args *);\nint\tsys_gssd_syscall(struct thread *, struct gssd_syscall_args *);\nint\tsys_jail_get(struct thread *, struct jail_get_args *);\nint\tsys_jail_set(struct thread *, struct jail_set_args *);\nint\tsys_jail_remove(struct thread *, struct jail_remove_args *);\nint\tsys_closefrom(struct thread *, struct closefrom_args *);\nint\tsys___semctl(struct thread *, struct __semctl_args *);\nint\tsys_msgctl(struct thread *, struct msgctl_args *);\nint\tsys_shmctl(struct thread *, struct shmctl_args *);\nint\tsys_lpathconf(struct thread *, struct lpathconf_args *);\nint\tsys_cap_new(struct thread *, struct cap_new_args *);\nint\tsys_cap_getrights(struct thread *, struct cap_getrights_args *);\nint\tsys_cap_enter(struct thread *, struct cap_enter_args *);\nint\tsys_cap_getmode(struct thread *, struct cap_getmode_args *);\nint\tsys_pdfork(struct thread *, struct pdfork_args *);\nint\tsys_pdkill(struct thread *, struct pdkill_args *);\nint\tsys_pdgetpid(struct thread *, struct pdgetpid_args *);\nint\tsys_pselect(struct thread *, struct pselect_args *);\nint\tsys_getloginclass(struct thread *, struct getloginclass_args *);\nint\tsys_setloginclass(struct thread *, struct setloginclass_args *);\nint\tsys_rctl_get_racct(struct thread *, struct rctl_get_racct_args *);\nint\tsys_rctl_get_rules(struct thread *, struct rctl_get_rules_args *);\nint\tsys_rctl_get_limits(struct thread *, struct rctl_get_limits_args *);\nint\tsys_rctl_add_rule(struct thread *, struct rctl_add_rule_args *);\nint\tsys_rctl_remove_rule(struct thread *, struct rctl_remove_rule_args *);\nint\tsys_posix_fallocate(struct thread *, struct posix_fallocate_args *);\n\n#ifdef COMPAT_43\n\nstruct ocreat_args {\n\tchar path_l_[PADL_(char *)]; char * path; char path_r_[PADR_(char *)];\n\tchar mode_l_[PADL_(int)]; int mode; char mode_r_[PADR_(int)];\n};\nstruct olseek_args {\n\tchar fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)];\n\tchar offset_l_[PADL_(long)]; long offset; char offset_r_[PADR_(long)];\n\tchar whence_l_[PADL_(int)]; int whence; char whence_r_[PADR_(int)];\n};\nstruct ostat_args {\n\tchar path_l_[PADL_(char *)]; char * path; char path_r_[PADR_(char *)];\n\tchar ub_l_[PADL_(struct ostat *)]; struct ostat * ub; char ub_r_[PADR_(struct ostat *)];\n};\nstruct olstat_args {\n\tchar path_l_[PADL_(char *)]; char * path; char path_r_[PADR_(char *)];\n\tchar ub_l_[PADL_(struct ostat *)]; struct ostat * ub; char ub_r_[PADR_(struct ostat *)];\n};\nstruct osigaction_args {\n\tchar signum_l_[PADL_(int)]; int signum; char signum_r_[PADR_(int)];\n\tchar nsa_l_[PADL_(struct osigaction *)]; struct osigaction * nsa; char nsa_r_[PADR_(struct osigaction *)];\n\tchar osa_l_[PADL_(struct osigaction *)]; struct osigaction * osa; char osa_r_[PADR_(struct osigaction *)];\n};\nstruct osigprocmask_args {\n\tchar how_l_[PADL_(int)]; int how; char how_r_[PADR_(int)];\n\tchar mask_l_[PADL_(osigset_t)]; osigset_t mask; char mask_r_[PADR_(osigset_t)];\n};\nstruct ofstat_args {\n\tchar fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)];\n\tchar sb_l_[PADL_(struct ostat *)]; struct ostat * sb; char sb_r_[PADR_(struct ostat *)];\n};\nstruct getkerninfo_args {\n\tchar op_l_[PADL_(int)]; int op; char op_r_[PADR_(int)];\n\tchar where_l_[PADL_(char *)]; char * where; char where_r_[PADR_(char *)];\n\tchar size_l_[PADL_(size_t *)]; size_t * size; char size_r_[PADR_(size_t *)];\n\tchar arg_l_[PADL_(int)]; int arg; char arg_r_[PADR_(int)];\n};\nstruct ommap_args {\n\tchar addr_l_[PADL_(void *)]; void * addr; char addr_r_[PADR_(void *)];\n\tchar len_l_[PADL_(int)]; int len; char len_r_[PADR_(int)];\n\tchar prot_l_[PADL_(int)]; int prot; char prot_r_[PADR_(int)];\n\tchar flags_l_[PADL_(int)]; int flags; char flags_r_[PADR_(int)];\n\tchar fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)];\n\tchar pos_l_[PADL_(long)]; long pos; char pos_r_[PADR_(long)];\n};\nstruct gethostname_args {\n\tchar hostname_l_[PADL_(char *)]; char * hostname; char hostname_r_[PADR_(char *)];\n\tchar len_l_[PADL_(u_int)]; u_int len; char len_r_[PADR_(u_int)];\n};\nstruct sethostname_args {\n\tchar hostname_l_[PADL_(char *)]; char * hostname; char hostname_r_[PADR_(char *)];\n\tchar len_l_[PADL_(u_int)]; u_int len; char len_r_[PADR_(u_int)];\n};\nstruct osend_args {\n\tchar s_l_[PADL_(int)]; int s; char s_r_[PADR_(int)];\n\tchar buf_l_[PADL_(caddr_t)]; caddr_t buf; char buf_r_[PADR_(caddr_t)];\n\tchar len_l_[PADL_(int)]; int len; char len_r_[PADR_(int)];\n\tchar flags_l_[PADL_(int)]; int flags; char flags_r_[PADR_(int)];\n};\nstruct orecv_args {\n\tchar s_l_[PADL_(int)]; int s; char s_r_[PADR_(int)];\n\tchar buf_l_[PADL_(caddr_t)]; caddr_t buf; char buf_r_[PADR_(caddr_t)];\n\tchar len_l_[PADL_(int)]; int len; char len_r_[PADR_(int)];\n\tchar flags_l_[PADL_(int)]; int flags; char flags_r_[PADR_(int)];\n};\nstruct osigreturn_args {\n\tchar sigcntxp_l_[PADL_(struct osigcontext *)]; struct osigcontext * sigcntxp; char sigcntxp_r_[PADR_(struct osigcontext *)];\n};\nstruct osigvec_args {\n\tchar signum_l_[PADL_(int)]; int signum; char signum_r_[PADR_(int)];\n\tchar nsv_l_[PADL_(struct sigvec *)]; struct sigvec * nsv; char nsv_r_[PADR_(struct sigvec *)];\n\tchar osv_l_[PADL_(struct sigvec *)]; struct sigvec * osv; char osv_r_[PADR_(struct sigvec *)];\n};\nstruct osigblock_args {\n\tchar mask_l_[PADL_(int)]; int mask; char mask_r_[PADR_(int)];\n};\nstruct osigsetmask_args {\n\tchar mask_l_[PADL_(int)]; int mask; char mask_r_[PADR_(int)];\n};\nstruct osigsuspend_args {\n\tchar mask_l_[PADL_(osigset_t)]; osigset_t mask; char mask_r_[PADR_(osigset_t)];\n};\nstruct osigstack_args {\n\tchar nss_l_[PADL_(struct sigstack *)]; struct sigstack * nss; char nss_r_[PADR_(struct sigstack *)];\n\tchar oss_l_[PADL_(struct sigstack *)]; struct sigstack * oss; char oss_r_[PADR_(struct sigstack *)];\n};\nstruct orecvmsg_args {\n\tchar s_l_[PADL_(int)]; int s; char s_r_[PADR_(int)];\n\tchar msg_l_[PADL_(struct omsghdr *)]; struct omsghdr * msg; char msg_r_[PADR_(struct omsghdr *)];\n\tchar flags_l_[PADL_(int)]; int flags; char flags_r_[PADR_(int)];\n};\nstruct osendmsg_args {\n\tchar s_l_[PADL_(int)]; int s; char s_r_[PADR_(int)];\n\tchar msg_l_[PADL_(caddr_t)]; caddr_t msg; char msg_r_[PADR_(caddr_t)];\n\tchar flags_l_[PADL_(int)]; int flags; char flags_r_[PADR_(int)];\n};\nstruct otruncate_args {\n\tchar path_l_[PADL_(char *)]; char * path; char path_r_[PADR_(char *)];\n\tchar length_l_[PADL_(long)]; long length; char length_r_[PADR_(long)];\n};\nstruct oftruncate_args {\n\tchar fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)];\n\tchar length_l_[PADL_(long)]; long length; char length_r_[PADR_(long)];\n};\nstruct ogetpeername_args {\n\tchar fdes_l_[PADL_(int)]; int fdes; char fdes_r_[PADR_(int)];\n\tchar asa_l_[PADL_(caddr_t)]; caddr_t asa; char asa_r_[PADR_(caddr_t)];\n\tchar alen_l_[PADL_(int *)]; int * alen; char alen_r_[PADR_(int *)];\n};\nstruct osethostid_args {\n\tchar hostid_l_[PADL_(long)]; long hostid; char hostid_r_[PADR_(long)];\n};\nstruct ogetrlimit_args {\n\tchar which_l_[PADL_(u_int)]; u_int which; char which_r_[PADR_(u_int)];\n\tchar rlp_l_[PADL_(struct orlimit *)]; struct orlimit * rlp; char rlp_r_[PADR_(struct orlimit *)];\n};\nstruct osetrlimit_args {\n\tchar which_l_[PADL_(u_int)]; u_int which; char which_r_[PADR_(u_int)];\n\tchar rlp_l_[PADL_(struct orlimit *)]; struct orlimit * rlp; char rlp_r_[PADR_(struct orlimit *)];\n};\nstruct okillpg_args {\n\tchar pgid_l_[PADL_(int)]; int pgid; char pgid_r_[PADR_(int)];\n\tchar signum_l_[PADL_(int)]; int signum; char signum_r_[PADR_(int)];\n};\nstruct ogetdirentries_args {\n\tchar fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)];\n\tchar buf_l_[PADL_(char *)]; char * buf; char buf_r_[PADR_(char *)];\n\tchar count_l_[PADL_(u_int)]; u_int count; char count_r_[PADR_(u_int)];\n\tchar basep_l_[PADL_(long *)]; long * basep; char basep_r_[PADR_(long *)];\n};\nint\tocreat(struct thread *, struct ocreat_args *);\nint\tolseek(struct thread *, struct olseek_args *);\nint\tostat(struct thread *, struct ostat_args *);\nint\tolstat(struct thread *, struct olstat_args *);\nint\tosigaction(struct thread *, struct osigaction_args *);\nint\tosigprocmask(struct thread *, struct osigprocmask_args *);\nint\tosigpending(struct thread *, struct osigpending_args *);\nint\tofstat(struct thread *, struct ofstat_args *);\nint\togetkerninfo(struct thread *, struct getkerninfo_args *);\nint\togetpagesize(struct thread *, struct getpagesize_args *);\nint\tommap(struct thread *, struct ommap_args *);\nint\towait(struct thread *, struct owait_args *);\nint\togethostname(struct thread *, struct gethostname_args *);\nint\tosethostname(struct thread *, struct sethostname_args *);\nint\toaccept(struct thread *, struct accept_args *);\nint\tosend(struct thread *, struct osend_args *);\nint\torecv(struct thread *, struct orecv_args *);\nint\tosigreturn(struct thread *, struct osigreturn_args *);\nint\tosigvec(struct thread *, struct osigvec_args *);\nint\tosigblock(struct thread *, struct osigblock_args *);\nint\tosigsetmask(struct thread *, struct osigsetmask_args *);\nint\tosigsuspend(struct thread *, struct osigsuspend_args *);\nint\tosigstack(struct thread *, struct osigstack_args *);\nint\torecvmsg(struct thread *, struct orecvmsg_args *);\nint\tosendmsg(struct thread *, struct osendmsg_args *);\nint\torecvfrom(struct thread *, struct recvfrom_args *);\nint\totruncate(struct thread *, struct otruncate_args *);\nint\toftruncate(struct thread *, struct oftruncate_args *);\nint\togetpeername(struct thread *, struct ogetpeername_args *);\nint\togethostid(struct thread *, struct ogethostid_args *);\nint\tosethostid(struct thread *, struct osethostid_args *);\nint\togetrlimit(struct thread *, struct ogetrlimit_args *);\nint\tosetrlimit(struct thread *, struct osetrlimit_args *);\nint\tokillpg(struct thread *, struct okillpg_args *);\nint\toquota(struct thread *, struct oquota_args *);\nint\togetsockname(struct thread *, struct getsockname_args *);\nint\togetdirentries(struct thread *, struct ogetdirentries_args *);\n\n#endif /* COMPAT_43 */\n\n\n#ifdef COMPAT_FREEBSD4\n\nstruct freebsd4_getfsstat_args {\n\tchar buf_l_[PADL_(struct ostatfs *)]; struct ostatfs * buf; char buf_r_[PADR_(struct ostatfs *)];\n\tchar bufsize_l_[PADL_(long)]; long bufsize; char bufsize_r_[PADR_(long)];\n\tchar flags_l_[PADL_(int)]; int flags; char flags_r_[PADR_(int)];\n};\nstruct freebsd4_statfs_args {\n\tchar path_l_[PADL_(char *)]; char * path; char path_r_[PADR_(char *)];\n\tchar buf_l_[PADL_(struct ostatfs *)]; struct ostatfs * buf; char buf_r_[PADR_(struct ostatfs *)];\n};\nstruct freebsd4_fstatfs_args {\n\tchar fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)];\n\tchar buf_l_[PADL_(struct ostatfs *)]; struct ostatfs * buf; char buf_r_[PADR_(struct ostatfs *)];\n};\nstruct freebsd4_getdomainname_args {\n\tchar domainname_l_[PADL_(char *)]; char * domainname; char domainname_r_[PADR_(char *)];\n\tchar len_l_[PADL_(int)]; int len; char len_r_[PADR_(int)];\n};\nstruct freebsd4_setdomainname_args {\n\tchar domainname_l_[PADL_(char *)]; char * domainname; char domainname_r_[PADR_(char *)];\n\tchar len_l_[PADL_(int)]; int len; char len_r_[PADR_(int)];\n};\nstruct freebsd4_uname_args {\n\tchar name_l_[PADL_(struct utsname *)]; struct utsname * name; char name_r_[PADR_(struct utsname *)];\n};\nstruct freebsd4_fhstatfs_args {\n\tchar u_fhp_l_[PADL_(const struct fhandle *)]; const struct fhandle * u_fhp; char u_fhp_r_[PADR_(const struct fhandle *)];\n\tchar buf_l_[PADL_(struct ostatfs *)]; struct ostatfs * buf; char buf_r_[PADR_(struct ostatfs *)];\n};\nstruct freebsd4_sendfile_args {\n\tchar fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)];\n\tchar s_l_[PADL_(int)]; int s; char s_r_[PADR_(int)];\n\tchar offset_l_[PADL_(off_t)]; off_t offset; char offset_r_[PADR_(off_t)];\n\tchar nbytes_l_[PADL_(size_t)]; size_t nbytes; char nbytes_r_[PADR_(size_t)];\n\tchar hdtr_l_[PADL_(struct sf_hdtr *)]; struct sf_hdtr * hdtr; char hdtr_r_[PADR_(struct sf_hdtr *)];\n\tchar sbytes_l_[PADL_(off_t *)]; off_t * sbytes; char sbytes_r_[PADR_(off_t *)];\n\tchar flags_l_[PADL_(int)]; int flags; char flags_r_[PADR_(int)];\n};\nstruct freebsd4_sigaction_args {\n\tchar sig_l_[PADL_(int)]; int sig; char sig_r_[PADR_(int)];\n\tchar act_l_[PADL_(const struct sigaction *)]; const struct sigaction * act; char act_r_[PADR_(const struct sigaction *)];\n\tchar oact_l_[PADL_(struct sigaction *)]; struct sigaction * oact; char oact_r_[PADR_(struct sigaction *)];\n};\nstruct freebsd4_sigreturn_args {\n\tchar sigcntxp_l_[PADL_(const struct ucontext4 *)]; const struct ucontext4 * sigcntxp; char sigcntxp_r_[PADR_(const struct ucontext4 *)];\n};\nint\tfreebsd4_getfsstat(struct thread *, struct freebsd4_getfsstat_args *);\nint\tfreebsd4_statfs(struct thread *, struct freebsd4_statfs_args *);\nint\tfreebsd4_fstatfs(struct thread *, struct freebsd4_fstatfs_args *);\nint\tfreebsd4_getdomainname(struct thread *, struct freebsd4_getdomainname_args *);\nint\tfreebsd4_setdomainname(struct thread *, struct freebsd4_setdomainname_args *);\nint\tfreebsd4_uname(struct thread *, struct freebsd4_uname_args *);\nint\tfreebsd4_fhstatfs(struct thread *, struct freebsd4_fhstatfs_args *);\nint\tfreebsd4_sendfile(struct thread *, struct freebsd4_sendfile_args *);\nint\tfreebsd4_sigaction(struct thread *, struct freebsd4_sigaction_args *);\nint\tfreebsd4_sigreturn(struct thread *, struct freebsd4_sigreturn_args *);\n\n#endif /* COMPAT_FREEBSD4 */\n\n\n#ifdef COMPAT_FREEBSD6\n\n\n#endif /* COMPAT_FREEBSD6 */\n\n\n#ifdef COMPAT_FREEBSD7\n\nstruct freebsd7___semctl_args {\n\tchar semid_l_[PADL_(int)]; int semid; char semid_r_[PADR_(int)];\n\tchar semnum_l_[PADL_(int)]; int semnum; char semnum_r_[PADR_(int)];\n\tchar cmd_l_[PADL_(int)]; int cmd; char cmd_r_[PADR_(int)];\n\tchar arg_l_[PADL_(union semun_old *)]; union semun_old * arg; char arg_r_[PADR_(union semun_old *)];\n};\nstruct freebsd7_msgctl_args {\n\tchar msqid_l_[PADL_(int)]; int msqid; char msqid_r_[PADR_(int)];\n\tchar cmd_l_[PADL_(int)]; int cmd; char cmd_r_[PADR_(int)];\n\tchar buf_l_[PADL_(struct msqid_ds_old *)]; struct msqid_ds_old * buf; char buf_r_[PADR_(struct msqid_ds_old *)];\n};\nstruct freebsd7_shmctl_args {\n\tchar shmid_l_[PADL_(int)]; int shmid; char shmid_r_[PADR_(int)];\n\tchar cmd_l_[PADL_(int)]; int cmd; char cmd_r_[PADR_(int)];\n\tchar buf_l_[PADL_(struct shmid_ds_old *)]; struct shmid_ds_old * buf; char buf_r_[PADR_(struct shmid_ds_old *)];\n};\nint\tfreebsd7___semctl(struct thread *, struct freebsd7___semctl_args *);\nint\tfreebsd7_msgctl(struct thread *, struct freebsd7_msgctl_args *);\nint\tfreebsd7_shmctl(struct thread *, struct freebsd7_shmctl_args *);\n\n#endif /* COMPAT_FREEBSD7 */\n\n#define\tSYS_AUE_syscall\tAUE_NULL\n#define\tSYS_AUE_exit\tAUE_EXIT\n#define\tSYS_AUE_fork\tAUE_FORK\n#define\tSYS_AUE_read\tAUE_NULL\n#define\tSYS_AUE_write\tAUE_NULL\n#define\tSYS_AUE_open\tAUE_OPEN_RWTC\n#define\tSYS_AUE_close\tAUE_CLOSE\n#define\tSYS_AUE_wait4\tAUE_WAIT4\n#define\tSYS_AUE_ocreat\tAUE_CREAT\n#define\tSYS_AUE_link\tAUE_LINK\n#define\tSYS_AUE_unlink\tAUE_UNLINK\n#define\tSYS_AUE_chdir\tAUE_CHDIR\n#define\tSYS_AUE_fchdir\tAUE_FCHDIR\n#define\tSYS_AUE_mknod\tAUE_MKNOD\n#define\tSYS_AUE_chmod\tAUE_CHMOD\n#define\tSYS_AUE_chown\tAUE_CHOWN\n#define\tSYS_AUE_break\tAUE_NULL\n#define\tSYS_AUE_freebsd4_getfsstat\tAUE_GETFSSTAT\n#define\tSYS_AUE_olseek\tAUE_LSEEK\n#define\tSYS_AUE_getpid\tAUE_GETPID\n#define\tSYS_AUE_mount\tAUE_MOUNT\n#define\tSYS_AUE_unmount\tAUE_UMOUNT\n#define\tSYS_AUE_setuid\tAUE_SETUID\n#define\tSYS_AUE_getuid\tAUE_GETUID\n#define\tSYS_AUE_geteuid\tAUE_GETEUID\n#define\tSYS_AUE_ptrace\tAUE_PTRACE\n#define\tSYS_AUE_recvmsg\tAUE_RECVMSG\n#define\tSYS_AUE_sendmsg\tAUE_SENDMSG\n#define\tSYS_AUE_recvfrom\tAUE_RECVFROM\n#define\tSYS_AUE_accept\tAUE_ACCEPT\n#define\tSYS_AUE_getpeername\tAUE_GETPEERNAME\n#define\tSYS_AUE_getsockname\tAUE_GETSOCKNAME\n#define\tSYS_AUE_access\tAUE_ACCESS\n#define\tSYS_AUE_chflags\tAUE_CHFLAGS\n#define\tSYS_AUE_fchflags\tAUE_FCHFLAGS\n#define\tSYS_AUE_sync\tAUE_SYNC\n#define\tSYS_AUE_kill\tAUE_KILL\n#define\tSYS_AUE_ostat\tAUE_STAT\n#define\tSYS_AUE_getppid\tAUE_GETPPID\n#define\tSYS_AUE_olstat\tAUE_LSTAT\n#define\tSYS_AUE_dup\tAUE_DUP\n#define\tSYS_AUE_pipe\tAUE_PIPE\n#define\tSYS_AUE_getegid\tAUE_GETEGID\n#define\tSYS_AUE_profil\tAUE_PROFILE\n#define\tSYS_AUE_ktrace\tAUE_KTRACE\n#define\tSYS_AUE_osigaction\tAUE_SIGACTION\n#define\tSYS_AUE_getgid\tAUE_GETGID\n#define\tSYS_AUE_osigprocmask\tAUE_SIGPROCMASK\n#define\tSYS_AUE_getlogin\tAUE_GETLOGIN\n#define\tSYS_AUE_setlogin\tAUE_SETLOGIN\n#define\tSYS_AUE_acct\tAUE_ACCT\n#define\tSYS_AUE_osigpending\tAUE_SIGPENDING\n#define\tSYS_AUE_sigaltstack\tAUE_SIGALTSTACK\n#define\tSYS_AUE_ioctl\tAUE_IOCTL\n#define\tSYS_AUE_reboot\tAUE_REBOOT\n#define\tSYS_AUE_revoke\tAUE_REVOKE\n#define\tSYS_AUE_symlink\tAUE_SYMLINK\n#define\tSYS_AUE_readlink\tAUE_READLINK\n#define\tSYS_AUE_execve\tAUE_EXECVE\n#define\tSYS_AUE_umask\tAUE_UMASK\n#define\tSYS_AUE_chroot\tAUE_CHROOT\n#define\tSYS_AUE_ofstat\tAUE_FSTAT\n#define\tSYS_AUE_ogetkerninfo\tAUE_NULL\n#define\tSYS_AUE_ogetpagesize\tAUE_NULL\n#define\tSYS_AUE_msync\tAUE_MSYNC\n#define\tSYS_AUE_vfork\tAUE_VFORK\n#define\tSYS_AUE_sbrk\tAUE_SBRK\n#define\tSYS_AUE_sstk\tAUE_SSTK\n#define\tSYS_AUE_ommap\tAUE_MMAP\n#define\tSYS_AUE_vadvise\tAUE_O_VADVISE\n#define\tSYS_AUE_munmap\tAUE_MUNMAP\n#define\tSYS_AUE_mprotect\tAUE_MPROTECT\n#define\tSYS_AUE_madvise\tAUE_MADVISE\n#define\tSYS_AUE_mincore\tAUE_MINCORE\n#define\tSYS_AUE_getgroups\tAUE_GETGROUPS\n#define\tSYS_AUE_setgroups\tAUE_SETGROUPS\n#define\tSYS_AUE_getpgrp\tAUE_GETPGRP\n#define\tSYS_AUE_setpgid\tAUE_SETPGRP\n#define\tSYS_AUE_setitimer\tAUE_SETITIMER\n#define\tSYS_AUE_owait\tAUE_WAIT4\n#define\tSYS_AUE_swapon\tAUE_SWAPON\n#define\tSYS_AUE_getitimer\tAUE_GETITIMER\n#define\tSYS_AUE_ogethostname\tAUE_SYSCTL\n#define\tSYS_AUE_osethostname\tAUE_SYSCTL\n#define\tSYS_AUE_getdtablesize\tAUE_GETDTABLESIZE\n#define\tSYS_AUE_dup2\tAUE_DUP2\n#define\tSYS_AUE_fcntl\tAUE_FCNTL\n#define\tSYS_AUE_select\tAUE_SELECT\n#define\tSYS_AUE_fsync\tAUE_FSYNC\n#define\tSYS_AUE_setpriority\tAUE_SETPRIORITY\n#define\tSYS_AUE_socket\tAUE_SOCKET\n#define\tSYS_AUE_connect\tAUE_CONNECT\n#define\tSYS_AUE_oaccept\tAUE_ACCEPT\n#define\tSYS_AUE_getpriority\tAUE_GETPRIORITY\n#define\tSYS_AUE_osend\tAUE_SEND\n#define\tSYS_AUE_orecv\tAUE_RECV\n#define\tSYS_AUE_osigreturn\tAUE_SIGRETURN\n#define\tSYS_AUE_bind\tAUE_BIND\n#define\tSYS_AUE_setsockopt\tAUE_SETSOCKOPT\n#define\tSYS_AUE_listen\tAUE_LISTEN\n#define\tSYS_AUE_osigvec\tAUE_NULL\n#define\tSYS_AUE_osigblock\tAUE_NULL\n#define\tSYS_AUE_osigsetmask\tAUE_NULL\n#define\tSYS_AUE_osigsuspend\tAUE_NULL\n#define\tSYS_AUE_osigstack\tAUE_NULL\n#define\tSYS_AUE_orecvmsg\tAUE_RECVMSG\n#define\tSYS_AUE_osendmsg\tAUE_SENDMSG\n#define\tSYS_AUE_gettimeofday\tAUE_GETTIMEOFDAY\n#define\tSYS_AUE_getrusage\tAUE_GETRUSAGE\n#define\tSYS_AUE_getsockopt\tAUE_GETSOCKOPT\n#define\tSYS_AUE_readv\tAUE_READV\n#define\tSYS_AUE_writev\tAUE_WRITEV\n#define\tSYS_AUE_settimeofday\tAUE_SETTIMEOFDAY\n#define\tSYS_AUE_fchown\tAUE_FCHOWN\n#define\tSYS_AUE_fchmod\tAUE_FCHMOD\n#define\tSYS_AUE_orecvfrom\tAUE_RECVFROM\n#define\tSYS_AUE_setreuid\tAUE_SETREUID\n#define\tSYS_AUE_setregid\tAUE_SETREGID\n#define\tSYS_AUE_rename\tAUE_RENAME\n#define\tSYS_AUE_otruncate\tAUE_TRUNCATE\n#define\tSYS_AUE_oftruncate\tAUE_FTRUNCATE\n#define\tSYS_AUE_flock\tAUE_FLOCK\n#define\tSYS_AUE_mkfifo\tAUE_MKFIFO\n#define\tSYS_AUE_sendto\tAUE_SENDTO\n#define\tSYS_AUE_shutdown\tAUE_SHUTDOWN\n#define\tSYS_AUE_socketpair\tAUE_SOCKETPAIR\n#define\tSYS_AUE_mkdir\tAUE_MKDIR\n#define\tSYS_AUE_rmdir\tAUE_RMDIR\n#define\tSYS_AUE_utimes\tAUE_UTIMES\n#define\tSYS_AUE_adjtime\tAUE_ADJTIME\n#define\tSYS_AUE_ogetpeername\tAUE_GETPEERNAME\n#define\tSYS_AUE_ogethostid\tAUE_SYSCTL\n#define\tSYS_AUE_osethostid\tAUE_SYSCTL\n#define\tSYS_AUE_ogetrlimit\tAUE_GETRLIMIT\n#define\tSYS_AUE_osetrlimit\tAUE_SETRLIMIT\n#define\tSYS_AUE_okillpg\tAUE_KILLPG\n#define\tSYS_AUE_setsid\tAUE_SETSID\n#define\tSYS_AUE_quotactl\tAUE_QUOTACTL\n#define\tSYS_AUE_oquota\tAUE_O_QUOTA\n#define\tSYS_AUE_ogetsockname\tAUE_GETSOCKNAME\n#define\tSYS_AUE_nlm_syscall\tAUE_NULL\n#define\tSYS_AUE_nfssvc\tAUE_NFS_SVC\n#define\tSYS_AUE_ogetdirentries\tAUE_GETDIRENTRIES\n#define\tSYS_AUE_freebsd4_statfs\tAUE_STATFS\n#define\tSYS_AUE_freebsd4_fstatfs\tAUE_FSTATFS\n#define\tSYS_AUE_lgetfh\tAUE_LGETFH\n#define\tSYS_AUE_getfh\tAUE_NFS_GETFH\n#define\tSYS_AUE_freebsd4_getdomainname\tAUE_SYSCTL\n#define\tSYS_AUE_freebsd4_setdomainname\tAUE_SYSCTL\n#define\tSYS_AUE_freebsd4_uname\tAUE_NULL\n#define\tSYS_AUE_sysarch\tAUE_SYSARCH\n#define\tSYS_AUE_rtprio\tAUE_RTPRIO\n#define\tSYS_AUE_semsys\tAUE_SEMSYS\n#define\tSYS_AUE_msgsys\tAUE_MSGSYS\n#define\tSYS_AUE_shmsys\tAUE_SHMSYS\n#define\tSYS_AUE_freebsd6_pread\tAUE_PREAD\n#define\tSYS_AUE_freebsd6_pwrite\tAUE_PWRITE\n#define\tSYS_AUE_setfib\tAUE_NULL\n#define\tSYS_AUE_ntp_adjtime\tAUE_NTP_ADJTIME\n#define\tSYS_AUE_setgid\tAUE_SETGID\n#define\tSYS_AUE_setegid\tAUE_SETEGID\n#define\tSYS_AUE_seteuid\tAUE_SETEUID\n#define\tSYS_AUE_stat\tAUE_STAT\n#define\tSYS_AUE_fstat\tAUE_FSTAT\n#define\tSYS_AUE_lstat\tAUE_LSTAT\n#define\tSYS_AUE_pathconf\tAUE_PATHCONF\n#define\tSYS_AUE_fpathconf\tAUE_FPATHCONF\n#define\tSYS_AUE_getrlimit\tAUE_GETRLIMIT\n#define\tSYS_AUE_setrlimit\tAUE_SETRLIMIT\n#define\tSYS_AUE_getdirentries\tAUE_GETDIRENTRIES\n#define\tSYS_AUE_freebsd6_mmap\tAUE_MMAP\n#define\tSYS_AUE_freebsd6_lseek\tAUE_LSEEK\n#define\tSYS_AUE_freebsd6_truncate\tAUE_TRUNCATE\n#define\tSYS_AUE_freebsd6_ftruncate\tAUE_FTRUNCATE\n#define\tSYS_AUE___sysctl\tAUE_SYSCTL\n#define\tSYS_AUE_mlock\tAUE_MLOCK\n#define\tSYS_AUE_munlock\tAUE_MUNLOCK\n#define\tSYS_AUE_undelete\tAUE_UNDELETE\n#define\tSYS_AUE_futimes\tAUE_FUTIMES\n#define\tSYS_AUE_getpgid\tAUE_GETPGID\n#define\tSYS_AUE_poll\tAUE_POLL\n#define\tSYS_AUE_freebsd7___semctl\tAUE_SEMCTL\n#define\tSYS_AUE_semget\tAUE_SEMGET\n#define\tSYS_AUE_semop\tAUE_SEMOP\n#define\tSYS_AUE_freebsd7_msgctl\tAUE_MSGCTL\n#define\tSYS_AUE_msgget\tAUE_MSGGET\n#define\tSYS_AUE_msgsnd\tAUE_MSGSND\n#define\tSYS_AUE_msgrcv\tAUE_MSGRCV\n#define\tSYS_AUE_shmat\tAUE_SHMAT\n#define\tSYS_AUE_freebsd7_shmctl\tAUE_SHMCTL\n#define\tSYS_AUE_shmdt\tAUE_SHMDT\n#define\tSYS_AUE_shmget\tAUE_SHMGET\n#define\tSYS_AUE_clock_gettime\tAUE_NULL\n#define\tSYS_AUE_clock_settime\tAUE_CLOCK_SETTIME\n#define\tSYS_AUE_clock_getres\tAUE_NULL\n#define\tSYS_AUE_ktimer_create\tAUE_NULL\n#define\tSYS_AUE_ktimer_delete\tAUE_NULL\n#define\tSYS_AUE_ktimer_settime\tAUE_NULL\n#define\tSYS_AUE_ktimer_gettime\tAUE_NULL\n#define\tSYS_AUE_ktimer_getoverrun\tAUE_NULL\n#define\tSYS_AUE_nanosleep\tAUE_NULL\n#define\tSYS_AUE_ntp_gettime\tAUE_NULL\n#define\tSYS_AUE_minherit\tAUE_MINHERIT\n#define\tSYS_AUE_rfork\tAUE_RFORK\n#define\tSYS_AUE_openbsd_poll\tAUE_POLL\n#define\tSYS_AUE_issetugid\tAUE_ISSETUGID\n#define\tSYS_AUE_lchown\tAUE_LCHOWN\n#define\tSYS_AUE_aio_read\tAUE_NULL\n#define\tSYS_AUE_aio_write\tAUE_NULL\n#define\tSYS_AUE_lio_listio\tAUE_NULL\n#define\tSYS_AUE_getdents\tAUE_O_GETDENTS\n#define\tSYS_AUE_lchmod\tAUE_LCHMOD\n#define\tSYS_AUE_lutimes\tAUE_LUTIMES\n#define\tSYS_AUE_nstat\tAUE_STAT\n#define\tSYS_AUE_nfstat\tAUE_FSTAT\n#define\tSYS_AUE_nlstat\tAUE_LSTAT\n#define\tSYS_AUE_preadv\tAUE_PREADV\n#define\tSYS_AUE_pwritev\tAUE_PWRITEV\n#define\tSYS_AUE_freebsd4_fhstatfs\tAUE_FHSTATFS\n#define\tSYS_AUE_fhopen\tAUE_FHOPEN\n#define\tSYS_AUE_fhstat\tAUE_FHSTAT\n#define\tSYS_AUE_modnext\tAUE_NULL\n#define\tSYS_AUE_modstat\tAUE_NULL\n#define\tSYS_AUE_modfnext\tAUE_NULL\n#define\tSYS_AUE_modfind\tAUE_NULL\n#define\tSYS_AUE_kldload\tAUE_MODLOAD\n#define\tSYS_AUE_kldunload\tAUE_MODUNLOAD\n#define\tSYS_AUE_kldfind\tAUE_NULL\n#define\tSYS_AUE_kldnext\tAUE_NULL\n#define\tSYS_AUE_kldstat\tAUE_NULL\n#define\tSYS_AUE_kldfirstmod\tAUE_NULL\n#define\tSYS_AUE_getsid\tAUE_GETSID\n#define\tSYS_AUE_setresuid\tAUE_SETRESUID\n#define\tSYS_AUE_setresgid\tAUE_SETRESGID\n#define\tSYS_AUE_aio_return\tAUE_NULL\n#define\tSYS_AUE_aio_suspend\tAUE_NULL\n#define\tSYS_AUE_aio_cancel\tAUE_NULL\n#define\tSYS_AUE_aio_error\tAUE_NULL\n#define\tSYS_AUE_oaio_read\tAUE_NULL\n#define\tSYS_AUE_oaio_write\tAUE_NULL\n#define\tSYS_AUE_olio_listio\tAUE_NULL\n#define\tSYS_AUE_yield\tAUE_NULL\n#define\tSYS_AUE_mlockall\tAUE_MLOCKALL\n#define\tSYS_AUE_munlockall\tAUE_MUNLOCKALL\n#define\tSYS_AUE___getcwd\tAUE_GETCWD\n#define\tSYS_AUE_sched_setparam\tAUE_NULL\n#define\tSYS_AUE_sched_getparam\tAUE_NULL\n#define\tSYS_AUE_sched_setscheduler\tAUE_NULL\n#define\tSYS_AUE_sched_getscheduler\tAUE_NULL\n#define\tSYS_AUE_sched_yield\tAUE_NULL\n#define\tSYS_AUE_sched_get_priority_max\tAUE_NULL\n#define\tSYS_AUE_sched_get_priority_min\tAUE_NULL\n#define\tSYS_AUE_sched_rr_get_interval\tAUE_NULL\n#define\tSYS_AUE_utrace\tAUE_NULL\n#define\tSYS_AUE_freebsd4_sendfile\tAUE_SENDFILE\n#define\tSYS_AUE_kldsym\tAUE_NULL\n#define\tSYS_AUE_jail\tAUE_JAIL\n#define\tSYS_AUE_nnpfs_syscall\tAUE_NULL\n#define\tSYS_AUE_sigprocmask\tAUE_SIGPROCMASK\n#define\tSYS_AUE_sigsuspend\tAUE_SIGSUSPEND\n#define\tSYS_AUE_freebsd4_sigaction\tAUE_SIGACTION\n#define\tSYS_AUE_sigpending\tAUE_SIGPENDING\n#define\tSYS_AUE_freebsd4_sigreturn\tAUE_SIGRETURN\n#define\tSYS_AUE_sigtimedwait\tAUE_SIGWAIT\n#define\tSYS_AUE_sigwaitinfo\tAUE_NULL\n#define\tSYS_AUE___acl_get_file\tAUE_NULL\n#define\tSYS_AUE___acl_set_file\tAUE_NULL\n#define\tSYS_AUE___acl_get_fd\tAUE_NULL\n#define\tSYS_AUE___acl_set_fd\tAUE_NULL\n#define\tSYS_AUE___acl_delete_file\tAUE_NULL\n#define\tSYS_AUE___acl_delete_fd\tAUE_NULL\n#define\tSYS_AUE___acl_aclcheck_file\tAUE_NULL\n#define\tSYS_AUE___acl_aclcheck_fd\tAUE_NULL\n#define\tSYS_AUE_extattrctl\tAUE_EXTATTRCTL\n#define\tSYS_AUE_extattr_set_file\tAUE_EXTATTR_SET_FILE\n#define\tSYS_AUE_extattr_get_file\tAUE_EXTATTR_GET_FILE\n#define\tSYS_AUE_extattr_delete_file\tAUE_EXTATTR_DELETE_FILE\n#define\tSYS_AUE_aio_waitcomplete\tAUE_NULL\n#define\tSYS_AUE_getresuid\tAUE_GETRESUID\n#define\tSYS_AUE_getresgid\tAUE_GETRESGID\n#define\tSYS_AUE_kqueue\tAUE_KQUEUE\n#define\tSYS_AUE_kevent\tAUE_NULL\n#define\tSYS_AUE_extattr_set_fd\tAUE_EXTATTR_SET_FD\n#define\tSYS_AUE_extattr_get_fd\tAUE_EXTATTR_GET_FD\n#define\tSYS_AUE_extattr_delete_fd\tAUE_EXTATTR_DELETE_FD\n#define\tSYS_AUE___setugid\tAUE_NULL\n#define\tSYS_AUE_eaccess\tAUE_EACCESS\n#define\tSYS_AUE_afs3_syscall\tAUE_NULL\n#define\tSYS_AUE_nmount\tAUE_NMOUNT\n#define\tSYS_AUE___mac_get_proc\tAUE_NULL\n#define\tSYS_AUE___mac_set_proc\tAUE_NULL\n#define\tSYS_AUE___mac_get_fd\tAUE_NULL\n#define\tSYS_AUE___mac_get_file\tAUE_NULL\n#define\tSYS_AUE___mac_set_fd\tAUE_NULL\n#define\tSYS_AUE___mac_set_file\tAUE_NULL\n#define\tSYS_AUE_kenv\tAUE_NULL\n#define\tSYS_AUE_lchflags\tAUE_LCHFLAGS\n#define\tSYS_AUE_uuidgen\tAUE_NULL\n#define\tSYS_AUE_sendfile\tAUE_SENDFILE\n#define\tSYS_AUE_mac_syscall\tAUE_NULL\n#define\tSYS_AUE_getfsstat\tAUE_GETFSSTAT\n#define\tSYS_AUE_statfs\tAUE_STATFS\n#define\tSYS_AUE_fstatfs\tAUE_FSTATFS\n#define\tSYS_AUE_fhstatfs\tAUE_FHSTATFS\n#define\tSYS_AUE_ksem_close\tAUE_NULL\n#define\tSYS_AUE_ksem_post\tAUE_NULL\n#define\tSYS_AUE_ksem_wait\tAUE_NULL\n#define\tSYS_AUE_ksem_trywait\tAUE_NULL\n#define\tSYS_AUE_ksem_init\tAUE_NULL\n#define\tSYS_AUE_ksem_open\tAUE_NULL\n#define\tSYS_AUE_ksem_unlink\tAUE_NULL\n#define\tSYS_AUE_ksem_getvalue\tAUE_NULL\n#define\tSYS_AUE_ksem_destroy\tAUE_NULL\n#define\tSYS_AUE___mac_get_pid\tAUE_NULL\n#define\tSYS_AUE___mac_get_link\tAUE_NULL\n#define\tSYS_AUE___mac_set_link\tAUE_NULL\n#define\tSYS_AUE_extattr_set_link\tAUE_EXTATTR_SET_LINK\n#define\tSYS_AUE_extattr_get_link\tAUE_EXTATTR_GET_LINK\n#define\tSYS_AUE_extattr_delete_link\tAUE_EXTATTR_DELETE_LINK\n#define\tSYS_AUE___mac_execve\tAUE_NULL\n#define\tSYS_AUE_sigaction\tAUE_SIGACTION\n#define\tSYS_AUE_sigreturn\tAUE_SIGRETURN\n#define\tSYS_AUE_getcontext\tAUE_NULL\n#define\tSYS_AUE_setcontext\tAUE_NULL\n#define\tSYS_AUE_swapcontext\tAUE_NULL\n#define\tSYS_AUE_swapoff\tAUE_SWAPOFF\n#define\tSYS_AUE___acl_get_link\tAUE_NULL\n#define\tSYS_AUE___acl_set_link\tAUE_NULL\n#define\tSYS_AUE___acl_delete_link\tAUE_NULL\n#define\tSYS_AUE___acl_aclcheck_link\tAUE_NULL\n#define\tSYS_AUE_sigwait\tAUE_SIGWAIT\n#define\tSYS_AUE_thr_create\tAUE_NULL\n#define\tSYS_AUE_thr_exit\tAUE_NULL\n#define\tSYS_AUE_thr_self\tAUE_NULL\n#define\tSYS_AUE_thr_kill\tAUE_NULL\n#define\tSYS_AUE__umtx_lock\tAUE_NULL\n#define\tSYS_AUE__umtx_unlock\tAUE_NULL\n#define\tSYS_AUE_jail_attach\tAUE_NULL\n#define\tSYS_AUE_extattr_list_fd\tAUE_EXTATTR_LIST_FD\n#define\tSYS_AUE_extattr_list_file\tAUE_EXTATTR_LIST_FILE\n#define\tSYS_AUE_extattr_list_link\tAUE_EXTATTR_LIST_LINK\n#define\tSYS_AUE_ksem_timedwait\tAUE_NULL\n#define\tSYS_AUE_thr_suspend\tAUE_NULL\n#define\tSYS_AUE_thr_wake\tAUE_NULL\n#define\tSYS_AUE_kldunloadf\tAUE_MODUNLOAD\n#define\tSYS_AUE_audit\tAUE_AUDIT\n#define\tSYS_AUE_auditon\tAUE_AUDITON\n#define\tSYS_AUE_getauid\tAUE_GETAUID\n#define\tSYS_AUE_setauid\tAUE_SETAUID\n#define\tSYS_AUE_getaudit\tAUE_GETAUDIT\n#define\tSYS_AUE_setaudit\tAUE_SETAUDIT\n#define\tSYS_AUE_getaudit_addr\tAUE_GETAUDIT_ADDR\n#define\tSYS_AUE_setaudit_addr\tAUE_SETAUDIT_ADDR\n#define\tSYS_AUE_auditctl\tAUE_AUDITCTL\n#define\tSYS_AUE__umtx_op\tAUE_NULL\n#define\tSYS_AUE_thr_new\tAUE_NULL\n#define\tSYS_AUE_sigqueue\tAUE_NULL\n#define\tSYS_AUE_kmq_open\tAUE_NULL\n#define\tSYS_AUE_kmq_setattr\tAUE_NULL\n#define\tSYS_AUE_kmq_timedreceive\tAUE_NULL\n#define\tSYS_AUE_kmq_timedsend\tAUE_NULL\n#define\tSYS_AUE_kmq_notify\tAUE_NULL\n#define\tSYS_AUE_kmq_unlink\tAUE_NULL\n#define\tSYS_AUE_abort2\tAUE_NULL\n#define\tSYS_AUE_thr_set_name\tAUE_NULL\n#define\tSYS_AUE_aio_fsync\tAUE_NULL\n#define\tSYS_AUE_rtprio_thread\tAUE_RTPRIO\n#define\tSYS_AUE_sctp_peeloff\tAUE_NULL\n#define\tSYS_AUE_sctp_generic_sendmsg\tAUE_NULL\n#define\tSYS_AUE_sctp_generic_sendmsg_iov\tAUE_NULL\n#define\tSYS_AUE_sctp_generic_recvmsg\tAUE_NULL\n#define\tSYS_AUE_pread\tAUE_PREAD\n#define\tSYS_AUE_pwrite\tAUE_PWRITE\n#define\tSYS_AUE_mmap\tAUE_MMAP\n#define\tSYS_AUE_lseek\tAUE_LSEEK\n#define\tSYS_AUE_truncate\tAUE_TRUNCATE\n#define\tSYS_AUE_ftruncate\tAUE_FTRUNCATE\n#define\tSYS_AUE_thr_kill2\tAUE_KILL\n#define\tSYS_AUE_shm_open\tAUE_SHMOPEN\n#define\tSYS_AUE_shm_unlink\tAUE_SHMUNLINK\n#define\tSYS_AUE_cpuset\tAUE_NULL\n#define\tSYS_AUE_cpuset_setid\tAUE_NULL\n#define\tSYS_AUE_cpuset_getid\tAUE_NULL\n#define\tSYS_AUE_cpuset_getaffinity\tAUE_NULL\n#define\tSYS_AUE_cpuset_setaffinity\tAUE_NULL\n#define\tSYS_AUE_faccessat\tAUE_FACCESSAT\n#define\tSYS_AUE_fchmodat\tAUE_FCHMODAT\n#define\tSYS_AUE_fchownat\tAUE_FCHOWNAT\n#define\tSYS_AUE_fexecve\tAUE_FEXECVE\n#define\tSYS_AUE_fstatat\tAUE_FSTATAT\n#define\tSYS_AUE_futimesat\tAUE_FUTIMESAT\n#define\tSYS_AUE_linkat\tAUE_LINKAT\n#define\tSYS_AUE_mkdirat\tAUE_MKDIRAT\n#define\tSYS_AUE_mkfifoat\tAUE_MKFIFOAT\n#define\tSYS_AUE_mknodat\tAUE_MKNODAT\n#define\tSYS_AUE_openat\tAUE_OPENAT_RWTC\n#define\tSYS_AUE_readlinkat\tAUE_READLINKAT\n#define\tSYS_AUE_renameat\tAUE_RENAMEAT\n#define\tSYS_AUE_symlinkat\tAUE_SYMLINKAT\n#define\tSYS_AUE_unlinkat\tAUE_UNLINKAT\n#define\tSYS_AUE_posix_openpt\tAUE_POSIX_OPENPT\n#define\tSYS_AUE_gssd_syscall\tAUE_NULL\n#define\tSYS_AUE_jail_get\tAUE_NULL\n#define\tSYS_AUE_jail_set\tAUE_NULL\n#define\tSYS_AUE_jail_remove\tAUE_NULL\n#define\tSYS_AUE_closefrom\tAUE_CLOSEFROM\n#define\tSYS_AUE___semctl\tAUE_SEMCTL\n#define\tSYS_AUE_msgctl\tAUE_MSGCTL\n#define\tSYS_AUE_shmctl\tAUE_SHMCTL\n#define\tSYS_AUE_lpathconf\tAUE_LPATHCONF\n#define\tSYS_AUE_cap_new\tAUE_CAP_NEW\n#define\tSYS_AUE_cap_getrights\tAUE_CAP_GETRIGHTS\n#define\tSYS_AUE_cap_enter\tAUE_CAP_ENTER\n#define\tSYS_AUE_cap_getmode\tAUE_CAP_GETMODE\n#define\tSYS_AUE_pdfork\tAUE_PDFORK\n#define\tSYS_AUE_pdkill\tAUE_PDKILL\n#define\tSYS_AUE_pdgetpid\tAUE_PDGETPID\n#define\tSYS_AUE_pselect\tAUE_SELECT\n#define\tSYS_AUE_getloginclass\tAUE_NULL\n#define\tSYS_AUE_setloginclass\tAUE_NULL\n#define\tSYS_AUE_rctl_get_racct\tAUE_NULL\n#define\tSYS_AUE_rctl_get_rules\tAUE_NULL\n#define\tSYS_AUE_rctl_get_limits\tAUE_NULL\n#define\tSYS_AUE_rctl_add_rule\tAUE_NULL\n#define\tSYS_AUE_rctl_remove_rule\tAUE_NULL\n#define\tSYS_AUE_posix_fallocate\tAUE_NULL\n\n#undef PAD_\n#undef PADL_\n#undef PADR_\n\n#endif /* !_SYS_SYSPROTO_H_ */\n"
  },
  {
    "path": "freebsd-headers/sys/systm.h",
    "content": "/*-\n * Copyright (c) 1982, 1988, 1991, 1993\n *\tThe Regents of the University of California.  All rights reserved.\n * (c) UNIX System Laboratories, Inc.\n * All or some portions of this file are derived from material licensed\n * to the University of California by American Telephone and Telegraph\n * Co. or Unix System Laboratories, Inc. and are reproduced herein with\n * the permission of UNIX System Laboratories, Inc.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 4. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t@(#)systm.h\t8.7 (Berkeley) 3/29/95\n * $FreeBSD: release/9.0.0/sys/sys/systm.h 224307 2011-07-25 09:12:48Z avg $\n */\n\n#ifndef _SYS_SYSTM_H_\n#define\t_SYS_SYSTM_H_\n\n#include <machine/atomic.h>\n#include <machine/cpufunc.h>\n#include <sys/callout.h>\n#include <sys/cdefs.h>\n#include <sys/queue.h>\n#include <sys/stdint.h>\t\t/* for people using printf mainly */\n\nextern int cold;\t\t/* nonzero if we are doing a cold boot */\nextern int rebooting;\t\t/* kern_reboot() has been called. */\nextern const char *panicstr;\t/* panic message */\nextern char version[];\t\t/* system version */\nextern char copyright[];\t/* system copyright */\nextern int kstack_pages;\t/* number of kernel stack pages */\n\nextern u_long pagesizes[];\t/* supported page sizes */\nextern long physmem;\t\t/* physical memory */\nextern long realmem;\t\t/* 'real' memory */\n\nextern char *rootdevnames[2];\t/* names of possible root devices */\n\nextern int boothowto;\t\t/* reboot flags, from console subsystem */\nextern int bootverbose;\t\t/* nonzero to print verbose messages */\n\nextern int maxusers;\t\t/* system tune hint */\nextern int ngroups_max;\t\t/* max # of supplemental groups */\nextern int vm_guest;\t\t/* Running as virtual machine guest? */\n\n/*\n * Detected virtual machine guest types. The intention is to expand\n * and/or add to the VM_GUEST_VM type if specific VM functionality is\n * ever implemented (e.g. vendor-specific paravirtualization features).\n */\nenum VM_GUEST { VM_GUEST_NO = 0, VM_GUEST_VM, VM_GUEST_XEN };\n\n#ifdef\tINVARIANTS\t\t/* The option is always available */\n#define\tKASSERT(exp,msg) do {\t\t\t\t\t\t\\\n\tif (__predict_false(!(exp)))\t\t\t\t\t\\\n\t\tpanic msg;\t\t\t\t\t\t\\\n} while (0)\n#define\tVNASSERT(exp, vp, msg) do {\t\t\t\t\t\\\n\tif (__predict_false(!(exp))) {\t\t\t\t\t\\\n\t\tvn_printf(vp, \"VNASSERT failed\\n\");\t\t\t\\\n\t\tpanic msg;\t\t\t\t\t\t\\\n\t}\t\t\t\t\t\t\t\t\\\n} while (0)\n#else\n#define\tKASSERT(exp,msg) do { \\\n} while (0)\n\n#define\tVNASSERT(exp, vp, msg) do { \\\n} while (0)\n#endif\n\n#ifndef CTASSERT\t\t/* Allow lint to override */\n#define\tCTASSERT(x)\t\t_CTASSERT(x, __LINE__)\n#define\t_CTASSERT(x, y)\t\t__CTASSERT(x, y)\n#define\t__CTASSERT(x, y)\ttypedef char __assert ## y[(x) ? 1 : -1]\n#endif\n\n/*\n * Assert that a pointer can be loaded from memory atomically.\n *\n * This assertion enforces stronger alignment than necessary.  For example,\n * on some architectures, atomicity for unaligned loads will depend on\n * whether or not the load spans multiple cache lines.\n */\n#define\tASSERT_ATOMIC_LOAD_PTR(var, msg)\t\t\t\t\\\n\tKASSERT(sizeof(var) == sizeof(void *) &&\t\t\t\\\n\t    ((uintptr_t)&(var) & (sizeof(void *) - 1)) == 0, msg)\n\n/*\n * XXX the hints declarations are even more misplaced than most declarations\n * in this file, since they are needed in one file (per arch) and only used\n * in two files.\n * XXX most of these variables should be const.\n */\nextern int osreldate;\nextern int envmode;\nextern int hintmode;\t\t/* 0 = off. 1 = config, 2 = fallback */\nextern int dynamic_kenv;\nextern struct mtx kenv_lock;\nextern char *kern_envp;\nextern char static_env[];\nextern char static_hints[];\t/* by config for now */\n\nextern char **kenvp;\n\nextern const void *zero_region;\t/* address space maps to a zeroed page\t*/\n\n/*\n * General function declarations.\n */\n\nstruct inpcb;\nstruct lock_object;\nstruct malloc_type;\nstruct mtx;\nstruct proc;\nstruct socket;\nstruct thread;\nstruct tty;\nstruct ucred;\nstruct uio;\nstruct _jmp_buf;\nstruct trapframe;\n\nint\tsetjmp(struct _jmp_buf *);\nvoid\tlongjmp(struct _jmp_buf *, int) __dead2;\nint\tdumpstatus(vm_offset_t addr, off_t count);\nint\tnullop(void);\nint\teopnotsupp(void);\nint\tureadc(int, struct uio *);\nvoid\thashdestroy(void *, struct malloc_type *, u_long);\nvoid\t*hashinit(int count, struct malloc_type *type, u_long *hashmask);\nvoid\t*hashinit_flags(int count, struct malloc_type *type,\n    u_long *hashmask, int flags);\n#define\tHASH_NOWAIT\t0x00000001\n#define\tHASH_WAITOK\t0x00000002\n\nvoid\t*phashinit(int count, struct malloc_type *type, u_long *nentries);\nvoid\tg_waitidle(void);\n\nvoid\tpanic(const char *, ...) __dead2 __printflike(1, 2);\n\nvoid\tcpu_boot(int);\nvoid\tcpu_flush_dcache(void *, size_t);\nvoid\tcpu_rootconf(void);\nvoid\tcritical_enter(void);\nvoid\tcritical_exit(void);\nvoid\tinit_param1(void);\nvoid\tinit_param2(long physpages);\nvoid\tinit_static_kenv(char *, size_t);\nvoid\ttablefull(const char *);\nint\tkvprintf(char const *, void (*)(int, void*), void *, int,\n\t    __va_list) __printflike(1, 0);\nvoid\tlog(int, const char *, ...) __printflike(2, 3);\nvoid\tlog_console(struct uio *);\nint\tprintf(const char *, ...) __printflike(1, 2);\nint\tsnprintf(char *, size_t, const char *, ...) __printflike(3, 4);\nint\tsprintf(char *buf, const char *, ...) __printflike(2, 3);\nint\tuprintf(const char *, ...) __printflike(1, 2);\nint\tvprintf(const char *, __va_list) __printflike(1, 0);\nint\tvsnprintf(char *, size_t, const char *, __va_list) __printflike(3, 0);\nint\tvsnrprintf(char *, size_t, int, const char *, __va_list) __printflike(4, 0);\nint\tvsprintf(char *buf, const char *, __va_list) __printflike(2, 0);\nint\tttyprintf(struct tty *, const char *, ...) __printflike(2, 3);\nint\tsscanf(const char *, char const *, ...) __nonnull(1) __nonnull(2);\nint\tvsscanf(const char *, char const *, __va_list) __nonnull(1) __nonnull(2);\nlong\tstrtol(const char *, char **, int) __nonnull(1);\nu_long\tstrtoul(const char *, char **, int) __nonnull(1);\nquad_t\tstrtoq(const char *, char **, int) __nonnull(1);\nu_quad_t strtouq(const char *, char **, int) __nonnull(1);\nvoid\ttprintf(struct proc *p, int pri, const char *, ...) __printflike(3, 4);\nvoid\thexdump(const void *ptr, int length, const char *hdr, int flags);\n#define\tHD_COLUMN_MASK\t0xff\n#define\tHD_DELIM_MASK\t0xff00\n#define\tHD_OMIT_COUNT\t(1 << 16)\n#define\tHD_OMIT_HEX\t(1 << 17)\n#define\tHD_OMIT_CHARS\t(1 << 18)\n\n#define ovbcopy(f, t, l) bcopy((f), (t), (l))\nvoid\tbcopy(const void *from, void *to, size_t len) __nonnull(1) __nonnull(2);\nvoid\tbzero(void *buf, size_t len) __nonnull(1);\n\nvoid\t*memcpy(void *to, const void *from, size_t len) __nonnull(1) __nonnull(2);\nvoid\t*memmove(void *dest, const void *src, size_t n) __nonnull(1) __nonnull(2);\n\nint\tcopystr(const void * __restrict kfaddr, void * __restrict kdaddr,\n\t    size_t len, size_t * __restrict lencopied)\n\t    __nonnull(1) __nonnull(2);\nint\tcopyinstr(const void * __restrict udaddr, void * __restrict kaddr,\n\t    size_t len, size_t * __restrict lencopied)\n\t    __nonnull(1) __nonnull(2);\nint\tcopyin(const void * __restrict udaddr, void * __restrict kaddr,\n\t    size_t len) __nonnull(1) __nonnull(2);\nint\tcopyin_nofault(const void * __restrict udaddr, void * __restrict kaddr,\n\t    size_t len) __nonnull(1) __nonnull(2);\nint\tcopyout(const void * __restrict kaddr, void * __restrict udaddr,\n\t    size_t len) __nonnull(1) __nonnull(2);\nint\tcopyout_nofault(const void * __restrict kaddr, void * __restrict udaddr,\n\t    size_t len) __nonnull(1) __nonnull(2);\n\nint\tfubyte(const void *base);\nlong\tfuword(const void *base);\nint\tfuword16(void *base);\nint32_t\tfuword32(const void *base);\nint64_t\tfuword64(const void *base);\nint\tsubyte(void *base, int byte);\nint\tsuword(void *base, long word);\nint\tsuword16(void *base, int word);\nint\tsuword32(void *base, int32_t word);\nint\tsuword64(void *base, int64_t word);\nuint32_t casuword32(volatile uint32_t *base, uint32_t oldval, uint32_t newval);\nu_long\t casuword(volatile u_long *p, u_long oldval, u_long newval);\n\nvoid\trealitexpire(void *);\n\nint\tsysbeep(int hertz, int period);\n\nvoid\thardclock(int usermode, uintfptr_t pc);\nvoid\thardclock_anycpu(int cnt, int usermode);\nvoid\thardclock_cpu(int usermode);\nvoid\thardclock_sync(int cpu);\nvoid\tsoftclock(void *);\nvoid\tstatclock(int usermode);\nvoid\tprofclock(int usermode, uintfptr_t pc);\n\nint\thardclockintr(void);\n\nvoid\tstartprofclock(struct proc *);\nvoid\tstopprofclock(struct proc *);\nvoid\tcpu_startprofclock(void);\nvoid\tcpu_stopprofclock(void);\nvoid\tcpu_idleclock(void);\nvoid\tcpu_activeclock(void);\nextern int\tcpu_can_deep_sleep;\nextern int\tcpu_disable_deep_sleep;\n\nint\tcr_cansee(struct ucred *u1, struct ucred *u2);\nint\tcr_canseesocket(struct ucred *cred, struct socket *so);\nint\tcr_canseeinpcb(struct ucred *cred, struct inpcb *inp);\n\nchar\t*getenv(const char *name);\nvoid\tfreeenv(char *env);\nint\tgetenv_int(const char *name, int *data);\nint\tgetenv_uint(const char *name, unsigned int *data);\nint\tgetenv_long(const char *name, long *data);\nint\tgetenv_ulong(const char *name, unsigned long *data);\nint\tgetenv_string(const char *name, char *data, int size);\nint\tgetenv_quad(const char *name, quad_t *data);\nint\tsetenv(const char *name, const char *value);\nint\tunsetenv(const char *name);\nint\ttestenv(const char *name);\n\ntypedef uint64_t (cpu_tick_f)(void);\nvoid set_cputicker(cpu_tick_f *func, uint64_t freq, unsigned var);\nextern cpu_tick_f *cpu_ticks;\nuint64_t cpu_tickrate(void);\nuint64_t cputick2usec(uint64_t tick);\n\n#ifdef APM_FIXUP_CALLTODO\nstruct timeval;\nvoid\tadjust_timeout_calltodo(struct timeval *time_change);\n#endif /* APM_FIXUP_CALLTODO */\n\n#include <sys/libkern.h>\n\n/* Initialize the world */\nvoid\tconsinit(void);\nvoid\tcpu_initclocks(void);\nvoid\tcpu_initclocks_bsp(void);\nvoid\tcpu_initclocks_ap(void);\nvoid\tusrinfoinit(void);\n\n/* Finalize the world */\nvoid\tkern_reboot(int) __dead2;\nvoid\tshutdown_nice(int);\n\n/* Timeouts */\ntypedef void timeout_t(void *);\t/* timeout function type */\n#define CALLOUT_HANDLE_INITIALIZER(handle)\t\\\n\t{ NULL }\n\nvoid\tcallout_handle_init(struct callout_handle *);\nstruct\tcallout_handle timeout(timeout_t *, void *, int);\nvoid\tuntimeout(timeout_t *, void *, struct callout_handle);\ncaddr_t\tkern_timeout_callwheel_alloc(caddr_t v);\nvoid\tkern_timeout_callwheel_init(void);\n\n/* Stubs for obsolete functions that used to be for interrupt management */\nstatic __inline void\t\tspl0(void)\t\t{ return; }\nstatic __inline intrmask_t\tsplbio(void)\t\t{ return 0; }\nstatic __inline intrmask_t\tsplcam(void)\t\t{ return 0; }\nstatic __inline intrmask_t\tsplclock(void)\t\t{ return 0; }\nstatic __inline intrmask_t\tsplhigh(void)\t\t{ return 0; }\nstatic __inline intrmask_t\tsplimp(void)\t\t{ return 0; }\nstatic __inline intrmask_t\tsplnet(void)\t\t{ return 0; }\nstatic __inline intrmask_t\tsplsoftcam(void)\t{ return 0; }\nstatic __inline intrmask_t\tsplsoftclock(void)\t{ return 0; }\nstatic __inline intrmask_t\tsplsofttty(void)\t{ return 0; }\nstatic __inline intrmask_t\tsplsoftvm(void)\t\t{ return 0; }\nstatic __inline intrmask_t\tsplsofttq(void)\t\t{ return 0; }\nstatic __inline intrmask_t\tsplstatclock(void)\t{ return 0; }\nstatic __inline intrmask_t\tspltty(void)\t\t{ return 0; }\nstatic __inline intrmask_t\tsplvm(void)\t\t{ return 0; }\nstatic __inline void\t\tsplx(intrmask_t ipl __unused)\t{ return; }\n\n/*\n * Common `proc' functions are declared here so that proc.h can be included\n * less often.\n */\nint\t_sleep(void *chan, struct lock_object *lock, int pri, const char *wmesg,\n\t    int timo) __nonnull(1);\n#define\tmsleep(chan, mtx, pri, wmesg, timo)\t\t\t\t\\\n\t_sleep((chan), &(mtx)->lock_object, (pri), (wmesg), (timo))\nint\tmsleep_spin(void *chan, struct mtx *mtx, const char *wmesg, int timo)\n\t    __nonnull(1);\nint\tpause(const char *wmesg, int timo);\n#define\ttsleep(chan, pri, wmesg, timo)\t\t\t\t\t\\\n\t_sleep((chan), NULL, (pri), (wmesg), (timo))\nvoid\twakeup(void *chan) __nonnull(1);\nvoid\twakeup_one(void *chan) __nonnull(1);\n\n/*\n * Common `struct cdev *' stuff are declared here to avoid #include poisoning\n */\n\nstruct cdev;\ndev_t dev2udev(struct cdev *x);\nconst char *devtoname(struct cdev *cdev);\n\nint poll_no_poll(int events);\n\n/* XXX: Should be void nanodelay(u_int nsec); */\nvoid\tDELAY(int usec);\n\n/* Root mount holdback API */\nstruct root_hold_token;\n\nstruct root_hold_token *root_mount_hold(const char *identifier);\nvoid root_mount_rel(struct root_hold_token *h);\nvoid root_mount_wait(void);\nint root_mounted(void);\n\n\n/*\n * Unit number allocation API. (kern/subr_unit.c)\n */\nstruct unrhdr;\nstruct unrhdr *new_unrhdr(int low, int high, struct mtx *mutex);\nvoid delete_unrhdr(struct unrhdr *uh);\nvoid clean_unrhdr(struct unrhdr *uh);\nvoid clean_unrhdrl(struct unrhdr *uh);\nint alloc_unr(struct unrhdr *uh);\nint alloc_unr_specific(struct unrhdr *uh, u_int item);\nint alloc_unrl(struct unrhdr *uh);\nvoid free_unr(struct unrhdr *uh, u_int item);\n\n/*\n * Population count algorithm using SWAR approach\n * - \"SIMD Within A Register\".\n */\nstatic __inline uint32_t\nbitcount32(uint32_t x)\n{\n\n\tx = (x & 0x55555555) + ((x & 0xaaaaaaaa) >> 1);\n\tx = (x & 0x33333333) + ((x & 0xcccccccc) >> 2);\n\tx = (x + (x >> 4)) & 0x0f0f0f0f;\n\tx = (x + (x >> 8));\n\tx = (x + (x >> 16)) & 0x000000ff;\n\treturn (x);\n}\n\nstatic __inline uint16_t\nbitcount16(uint32_t x)\n{\n\n\tx = (x & 0x5555) + ((x & 0xaaaa) >> 1);\n\tx = (x & 0x3333) + ((x & 0xcccc) >> 2);\n\tx = (x + (x >> 4)) & 0x0f0f;\n\tx = (x + (x >> 8)) & 0x00ff;\n\treturn (x);\n}\n\n#endif /* !_SYS_SYSTM_H_ */\n"
  },
  {
    "path": "freebsd-headers/sys/taskqueue.h",
    "content": "/*-\n * Copyright (c) 2000 Doug Rabson\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/sys/taskqueue.h 221059 2011-04-26 11:39:56Z kib $\n */\n\n#ifndef _SYS_TASKQUEUE_H_\n#define _SYS_TASKQUEUE_H_\n\n#ifndef _KERNEL\n#error \"no user-servicable parts inside\"\n#endif\n\n#include <sys/queue.h>\n#include <sys/_task.h>\n#include <sys/_callout.h>\n\nstruct taskqueue;\nstruct thread;\n\nstruct timeout_task {\n\tstruct taskqueue *q;\n\tstruct task t;\n\tstruct callout c;\n\tint    f;\n};\n\n/*\n * A notification callback function which is called from\n * taskqueue_enqueue().  The context argument is given in the call to\n * taskqueue_create().  This function would normally be used to allow the\n * queue to arrange to run itself later (e.g., by scheduling a software\n * interrupt or waking a kernel thread).\n */\ntypedef void (*taskqueue_enqueue_fn)(void *context);\n\nstruct taskqueue *taskqueue_create(const char *name, int mflags,\n\t\t\t\t    taskqueue_enqueue_fn enqueue,\n\t\t\t\t    void *context);\nint\ttaskqueue_start_threads(struct taskqueue **tqp, int count, int pri,\n\t\t\t\tconst char *name, ...) __printflike(4, 5);\nint\ttaskqueue_enqueue(struct taskqueue *queue, struct task *task);\nint\ttaskqueue_enqueue_timeout(struct taskqueue *queue,\n\t    struct timeout_task *timeout_task, int ticks);\nint\ttaskqueue_cancel(struct taskqueue *queue, struct task *task,\n\t    u_int *pendp);\nint\ttaskqueue_cancel_timeout(struct taskqueue *queue,\n\t    struct timeout_task *timeout_task, u_int *pendp);\nvoid\ttaskqueue_drain(struct taskqueue *queue, struct task *task);\nvoid\ttaskqueue_drain_timeout(struct taskqueue *queue,\n\t    struct timeout_task *timeout_task);\nvoid\ttaskqueue_free(struct taskqueue *queue);\nvoid\ttaskqueue_run(struct taskqueue *queue);\nvoid\ttaskqueue_block(struct taskqueue *queue);\nvoid\ttaskqueue_unblock(struct taskqueue *queue);\nint\ttaskqueue_member(struct taskqueue *queue, struct thread *td);\n\n/*\n * Functions for dedicated thread taskqueues\n */\nvoid\ttaskqueue_thread_loop(void *arg);\nvoid\ttaskqueue_thread_enqueue(void *context);\n\n/*\n * Initialise a task structure.\n */\n#define TASK_INIT(task, priority, func, context) do {\t\\\n\t(task)->ta_pending = 0;\t\t\t\t\\\n\t(task)->ta_priority = (priority);\t\t\\\n\t(task)->ta_func = (func);\t\t\t\\\n\t(task)->ta_context = (context);\t\t\t\\\n} while (0)\n\nvoid _timeout_task_init(struct taskqueue *queue,\n\t    struct timeout_task *timeout_task, int priority, task_fn_t func,\n\t    void *context);\n#define\tTIMEOUT_TASK_INIT(queue, timeout_task, priority, func, context) \\\n\t_timeout_task_init(queue, timeout_task, priority, func, context);\n\n/*\n * Declare a reference to a taskqueue.\n */\n#define TASKQUEUE_DECLARE(name)\t\t\t\\\nextern struct taskqueue *taskqueue_##name\n\n/*\n * Define and initialise a global taskqueue that uses sleep mutexes.\n */\n#define TASKQUEUE_DEFINE(name, enqueue, context, init)\t\t\t\\\n\t\t\t\t\t\t\t\t\t\\\nstruct taskqueue *taskqueue_##name;\t\t\t\t\t\\\n\t\t\t\t\t\t\t\t\t\\\nstatic void\t\t\t\t\t\t\t\t\\\ntaskqueue_define_##name(void *arg)\t\t\t\t\t\\\n{\t\t\t\t\t\t\t\t\t\\\n\ttaskqueue_##name =\t\t\t\t\t\t\\\n\t    taskqueue_create(#name, M_WAITOK, (enqueue), (context));\t\\\n\tinit;\t\t\t\t\t\t\t\t\\\n}\t\t\t\t\t\t\t\t\t\\\n\t\t\t\t\t\t\t\t\t\\\nSYSINIT(taskqueue_##name, SI_SUB_CONFIGURE, SI_ORDER_SECOND,\t\t\\\n\ttaskqueue_define_##name, NULL);\t\t\t\t\t\\\n\t\t\t\t\t\t\t\t\t\\\nstruct __hack\n#define TASKQUEUE_DEFINE_THREAD(name)\t\t\t\t\t\\\nTASKQUEUE_DEFINE(name, taskqueue_thread_enqueue, &taskqueue_##name,\t\\\n\ttaskqueue_start_threads(&taskqueue_##name, 1, PWAIT,\t\t\\\n\t\"%s taskq\", #name))\n\n/*\n * Define and initialise a global taskqueue that uses spin mutexes.\n */\n#define TASKQUEUE_FAST_DEFINE(name, enqueue, context, init)\t\t\\\n\t\t\t\t\t\t\t\t\t\\\nstruct taskqueue *taskqueue_##name;\t\t\t\t\t\\\n\t\t\t\t\t\t\t\t\t\\\nstatic void\t\t\t\t\t\t\t\t\\\ntaskqueue_define_##name(void *arg)\t\t\t\t\t\\\n{\t\t\t\t\t\t\t\t\t\\\n\ttaskqueue_##name =\t\t\t\t\t\t\\\n\t    taskqueue_create_fast(#name, M_WAITOK, (enqueue),\t\t\\\n\t    (context));\t\t\t\t\t\t\t\\\n\tinit;\t\t\t\t\t\t\t\t\\\n}\t\t\t\t\t\t\t\t\t\\\n\t\t\t\t\t\t\t\t\t\\\nSYSINIT(taskqueue_##name, SI_SUB_CONFIGURE, SI_ORDER_SECOND,\t\t\\\n\ttaskqueue_define_##name, NULL);\t\t\t\t\t\\\n\t\t\t\t\t\t\t\t\t\\\nstruct __hack\n#define TASKQUEUE_FAST_DEFINE_THREAD(name)\t\t\t\t\\\nTASKQUEUE_FAST_DEFINE(name, taskqueue_thread_enqueue,\t\t\t\\\n\t&taskqueue_##name, taskqueue_start_threads(&taskqueue_##name\t\\\n\t1, PWAIT, \"%s taskq\", #name))\n\n/*\n * These queues are serviced by software interrupt handlers.  To enqueue\n * a task, call taskqueue_enqueue(taskqueue_swi, &task) or\n * taskqueue_enqueue(taskqueue_swi_giant, &task).\n */\nTASKQUEUE_DECLARE(swi_giant);\nTASKQUEUE_DECLARE(swi);\n\n/*\n * This queue is serviced by a kernel thread.  To enqueue a task, call\n * taskqueue_enqueue(taskqueue_thread, &task).\n */\nTASKQUEUE_DECLARE(thread);\n\n/*\n * Queue for swi handlers dispatched from fast interrupt handlers.\n * These are necessarily different from the above because the queue\n * must be locked with spinlocks since sleep mutex's cannot be used\n * from a fast interrupt handler context.\n */\nTASKQUEUE_DECLARE(fast);\nint\ttaskqueue_enqueue_fast(struct taskqueue *queue, struct task *task);\nstruct taskqueue *taskqueue_create_fast(const char *name, int mflags,\n\t\t\t\t    taskqueue_enqueue_fn enqueue,\n\t\t\t\t    void *context);\n\n#endif /* !_SYS_TASKQUEUE_H_ */\n"
  },
  {
    "path": "freebsd-headers/sys/termios.h",
    "content": "/* $FreeBSD: release/9.0.0/sys/sys/termios.h 199898 2009-11-28 23:50:48Z ed $ */\n#ifdef __GNUC__\n#warning \"this file includes <sys/termios.h> which is deprecated, use <termios.h> instead\"\n#endif\n#include <termios.h>\n"
  },
  {
    "path": "freebsd-headers/sys/thr.h",
    "content": "/*-\n * Copyright (c) 2003, Jeffrey Roberson <jeff@freebsd.org>\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice unmodified, this list of conditions, and the following\n *    disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR\n * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES\n * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,\n * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF\n * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/sys/thr.h 206903 2010-04-20 17:57:43Z imp $\n *\n */\n\n#ifndef _SYS_THR_H_\n#define\t_SYS_THR_H_\n\n#include <sys/cdefs.h>\n#include <sys/_types.h>\n#include <sys/sched.h>\n\n#ifndef _SIZE_T_DECLARED\ntypedef __size_t\tsize_t;\n#define _SIZE_T_DECLARED\n#endif\n\n/* Create the thread in the suspended state. */\n#define\tTHR_SUSPENDED\t\t0x0001\n/* Create the system scope thread. */\n#define\tTHR_SYSTEM_SCOPE\t0x0002\n\nstruct thr_param {\n    void\t(*start_func)(void *);\t/* thread entry function. */\n    void\t*arg;\t\t\t/* argument for entry function. */\n    char\t*stack_base;\t\t/* stack base address. */\n    size_t\tstack_size;\t\t/* stack size. */\n    char\t*tls_base;\t\t/* tls base address. */\n    size_t\ttls_size;\t\t/* tls size. */\n    long\t*child_tid;\t\t/* address to store new TID. */\n    long\t*parent_tid;\t\t/* parent accesses the new TID here. */\n    int\t\tflags;\t\t\t/* thread flags. */\n    struct rtprio\t*rtp;\t\t/* Real-time scheduling priority */\n    void\t*spare[3];\t\t/* TODO: cpu affinity mask etc. */\n};\n\n/* \n * See pthread_*\n */\n#ifndef _KERNEL\n#include <sys/ucontext.h>\n\n#ifndef _PID_T_DECLARED\ntypedef __pid_t\t\tpid_t;\n#define _PID_T_DECLARED\n#endif\n\n__BEGIN_DECLS\nint thr_create(ucontext_t *ctx, long *id, int flags);\nint thr_new(struct thr_param *param, int param_size);\nint thr_self(long *id);\nvoid thr_exit(long *state);\nint thr_kill(long id, int sig);\nint thr_kill2(pid_t pid, long id, int sig);\nint thr_suspend(const struct timespec *timeout);\nint thr_wake(long id);\nint thr_set_name(long id, const char *name);\n__END_DECLS\n#endif /* !_KERNEL */\n\n#endif /* ! _SYS_THR_H_ */\n"
  },
  {
    "path": "freebsd-headers/sys/tiio.h",
    "content": "/*-\n * Copyright (c) 1999, 2000 Kenneth D. Merry.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions, and the following disclaimer,\n *    without modification, immediately at the beginning of the file.\n * 2. The name of the author may not be used to endorse or promote products\n *    derived from this software without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t$FreeBSD: release/9.0.0/sys/sys/tiio.h 98849 2002-06-26 03:37:47Z ken $\n */\n/*\n * The ti_stats structure below is from code with the following copyright, \n * and originally comes from the Alteon firmware documentation.\n */\n/*\n * Copyright (c) 1997, 1998, 1999\n *\tBill Paul <wpaul@ctr.columbia.edu>.  All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. All advertising materials mentioning features or use of this software\n *    must display the following acknowledgement:\n *\tThis product includes software developed by Bill Paul.\n * 4. Neither the name of the author nor the names of any co-contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY Bill Paul AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL Bill Paul OR THE VOICES IN HIS HEAD\n * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\n * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\n * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\n * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\n * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF\n * THE POSSIBILITY OF SUCH DAMAGE.\n *\n *\tfrom: if_tireg.h,v 1.8 1999/07/23 18:46:24 wpaul Exp $\n */\n\n#ifndef _SYS_TIIO_H_\n#define _SYS_TIIO_H_\n\n#include <sys/ioccom.h>\n\n/*\n * Tigon statistics counters.\n */\nstruct ti_stats {\n\t/*\n\t * MAC stats, taken from RFC 1643, ethernet-like MIB\n\t */\n\tvolatile u_int32_t dot3StatsAlignmentErrors;\t\t/* 0 */\n\tvolatile u_int32_t dot3StatsFCSErrors;\t\t\t/* 1 */\n\tvolatile u_int32_t dot3StatsSingleCollisionFrames;\t/* 2 */\n\tvolatile u_int32_t dot3StatsMultipleCollisionFrames;\t/* 3 */\n\tvolatile u_int32_t dot3StatsSQETestErrors;\t\t/* 4 */\n\tvolatile u_int32_t dot3StatsDeferredTransmissions;\t/* 5 */\n\tvolatile u_int32_t dot3StatsLateCollisions;\t\t/* 6 */\n\tvolatile u_int32_t dot3StatsExcessiveCollisions;\t/* 7 */\n\tvolatile u_int32_t dot3StatsInternalMacTransmitErrors;\t/* 8 */\n\tvolatile u_int32_t dot3StatsCarrierSenseErrors;\t\t/* 9 */\n\tvolatile u_int32_t dot3StatsFrameTooLongs;\t\t/* 10 */\n\tvolatile u_int32_t dot3StatsInternalMacReceiveErrors;\t/* 11 */\n\t/*\n\t * interface stats, taken from RFC 1213, MIB-II, interfaces group\n\t */\n\tvolatile u_int32_t ifIndex;\t\t\t\t/* 12 */\n\tvolatile u_int32_t ifType;\t\t\t\t/* 13 */\n\tvolatile u_int32_t ifMtu;\t\t\t\t/* 14 */\n\tvolatile u_int32_t ifSpeed;\t\t\t\t/* 15 */\n\tvolatile u_int32_t ifAdminStatus;\t\t\t/* 16 */\n#define IF_ADMIN_STATUS_UP      1\n#define IF_ADMIN_STATUS_DOWN    2\n#define IF_ADMIN_STATUS_TESTING 3\n\tvolatile u_int32_t ifOperStatus;\t\t\t/* 17 */\n#define IF_OPER_STATUS_UP       1\n#define IF_OPER_STATUS_DOWN     2\n#define IF_OPER_STATUS_TESTING  3\n#define IF_OPER_STATUS_UNKNOWN  4\n#define IF_OPER_STATUS_DORMANT  5\n\tvolatile u_int32_t ifLastChange;\t\t\t/* 18 */\n\tvolatile u_int32_t ifInDiscards;\t\t\t/* 19 */\n\tvolatile u_int32_t ifInErrors;\t\t\t\t/* 20 */\n\tvolatile u_int32_t ifInUnknownProtos;\t\t\t/* 21 */\n\tvolatile u_int32_t ifOutDiscards;\t\t\t/* 22 */\n\tvolatile u_int32_t ifOutErrors;\t\t\t\t/* 23 */\n\tvolatile u_int32_t ifOutQLen;     /* deprecated */\t/* 24 */\n\tvolatile u_int8_t  ifPhysAddress[8]; /* 8 bytes */\t/* 25 - 26 */\n\tvolatile u_int8_t  ifDescr[32];\t\t\t\t/* 27 - 34 */\n\tu_int32_t alignIt;      /* align to 64 bit for u_int64_ts following */\n\t/*\n\t * more interface stats, taken from RFC 1573, MIB-IIupdate,\n\t * interfaces group\n\t */\n\tvolatile u_int64_t ifHCInOctets;\t\t\t/* 36 - 37 */\n\tvolatile u_int64_t ifHCInUcastPkts;\t\t\t/* 38 - 39 */\n\tvolatile u_int64_t ifHCInMulticastPkts;\t\t\t/* 40 - 41 */\n\tvolatile u_int64_t ifHCInBroadcastPkts;\t\t\t/* 42 - 43 */\n\tvolatile u_int64_t ifHCOutOctets;\t\t\t/* 44 - 45 */\n\tvolatile u_int64_t ifHCOutUcastPkts;\t\t\t/* 46 - 47 */\n\tvolatile u_int64_t ifHCOutMulticastPkts;\t\t/* 48 - 49 */\n\tvolatile u_int64_t ifHCOutBroadcastPkts;\t\t/* 50 - 51 */\n\tvolatile u_int32_t ifLinkUpDownTrapEnable;\t\t/* 52 */\n\tvolatile u_int32_t ifHighSpeed;\t\t\t\t/* 53 */\n\tvolatile u_int32_t ifPromiscuousMode; \t\t\t/* 54 */\n\tvolatile u_int32_t ifConnectorPresent; /* follow link state 55 */\n\t/*\n\t * Host Commands\n\t */\n\tvolatile u_int32_t nicCmdsHostState;\t\t\t/* 56 */\n\tvolatile u_int32_t nicCmdsFDRFiltering;\t\t\t/* 57 */\n\tvolatile u_int32_t nicCmdsSetRecvProdIndex;\t\t/* 58 */\n\tvolatile u_int32_t nicCmdsUpdateGencommStats;\t\t/* 59 */\n\tvolatile u_int32_t nicCmdsResetJumboRing;\t\t/* 60 */\n\tvolatile u_int32_t nicCmdsAddMCastAddr;\t\t\t/* 61 */\n\tvolatile u_int32_t nicCmdsDelMCastAddr;\t\t\t/* 62 */\n\tvolatile u_int32_t nicCmdsSetPromiscMode;\t\t/* 63 */\n\tvolatile u_int32_t nicCmdsLinkNegotiate;\t\t/* 64 */\n\tvolatile u_int32_t nicCmdsSetMACAddr;\t\t\t/* 65 */\n\tvolatile u_int32_t nicCmdsClearProfile;\t\t\t/* 66 */\n\tvolatile u_int32_t nicCmdsSetMulticastMode;\t\t/* 67 */\n\tvolatile u_int32_t nicCmdsClearStats;\t\t\t/* 68 */\n\tvolatile u_int32_t nicCmdsSetRecvJumboProdIndex;\t/* 69 */\n\tvolatile u_int32_t nicCmdsSetRecvMiniProdIndex;\t\t/* 70 */\n\tvolatile u_int32_t nicCmdsRefreshStats;\t\t\t/* 71 */\n\tvolatile u_int32_t nicCmdsUnknown;\t\t\t/* 72 */\n\t/*\n\t * NIC Events\n\t */\n\tvolatile u_int32_t nicEventsNICFirmwareOperational;\t/* 73 */\n\tvolatile u_int32_t nicEventsStatsUpdated;\t\t/* 74 */\n\tvolatile u_int32_t nicEventsLinkStateChanged;\t\t/* 75 */\n\tvolatile u_int32_t nicEventsError;\t\t\t/* 76 */\n\tvolatile u_int32_t nicEventsMCastListUpdated;\t\t/* 77 */\n\tvolatile u_int32_t nicEventsResetJumboRing;\t\t/* 78 */\n\t/*\n\t * Ring manipulation\n\t */\n\tvolatile u_int32_t nicRingSetSendProdIndex;\t\t/* 79 */\n\tvolatile u_int32_t nicRingSetSendConsIndex;\t\t/* 80 */\n\tvolatile u_int32_t nicRingSetRecvReturnProdIndex;\t/* 81 */\n\t/*\n\t * Interrupts\n\t */\n\tvolatile u_int32_t nicInterrupts;\t\t\t/* 82 */\n\tvolatile u_int32_t nicAvoidedInterrupts;\t\t/* 83 */\n\t/*\n\t * BD Coalessing Thresholds\n\t */\n\tvolatile u_int32_t nicEventThresholdHit;\t\t/* 84 */\n\tvolatile u_int32_t nicSendThresholdHit;\t\t\t/* 85 */\n\tvolatile u_int32_t nicRecvThresholdHit;\t\t\t/* 86 */\n\t/*\n\t * DMA Attentions\n\t */\n\tvolatile u_int32_t nicDmaRdOverrun;\t\t\t/* 87 */\n\tvolatile u_int32_t nicDmaRdUnderrun;\t\t\t/* 88 */\n\tvolatile u_int32_t nicDmaWrOverrun;\t\t\t/* 89 */\n\tvolatile u_int32_t nicDmaWrUnderrun;\t\t\t/* 90 */\n\tvolatile u_int32_t nicDmaWrMasterAborts;\t\t/* 91 */\n\tvolatile u_int32_t nicDmaRdMasterAborts;\t\t/* 92 */\n\t/*\n\t * NIC Resources\n\t */\n\tvolatile u_int32_t nicDmaWriteRingFull;\t\t\t/* 93 */\n\tvolatile u_int32_t nicDmaReadRingFull;\t\t\t/* 94 */\n\tvolatile u_int32_t nicEventRingFull;\t\t\t/* 95 */\n\tvolatile u_int32_t nicEventProducerRingFull;\t\t/* 96 */\n\tvolatile u_int32_t nicTxMacDescrRingFull;\t\t/* 97 */\n\tvolatile u_int32_t nicOutOfTxBufSpaceFrameRetry;\t/* 98 */\n\tvolatile u_int32_t nicNoMoreWrDMADescriptors;\t\t/* 99 */\n\tvolatile u_int32_t nicNoMoreRxBDs;\t\t\t/* 100 */\n\tvolatile u_int32_t nicNoSpaceInReturnRing;\t\t/* 101 */\n\tvolatile u_int32_t nicSendBDs;            /* current count 102 */\n\tvolatile u_int32_t nicRecvBDs;            /* current count 103 */\n\tvolatile u_int32_t nicJumboRecvBDs;       /* current count 104 */\n\tvolatile u_int32_t nicMiniRecvBDs;        /* current count 105 */\n\tvolatile u_int32_t nicTotalRecvBDs;       /* current count 106 */\n\tvolatile u_int32_t nicTotalSendBDs;       /* current count 107 */\n\tvolatile u_int32_t nicJumboSpillOver;\t\t\t/* 108 */\n\tvolatile u_int32_t nicSbusHangCleared;\t\t\t/* 109 */\n\tvolatile u_int32_t nicEnqEventDelayed;\t\t\t/* 110 */\n\t/*\n\t * Stats from MAC rx completion\n\t */\n\tvolatile u_int32_t nicMacRxLateColls;\t\t\t/* 111 */\n\tvolatile u_int32_t nicMacRxLinkLostDuringPkt;\t\t/* 112 */\n\tvolatile u_int32_t nicMacRxPhyDecodeErr;\t\t/* 113 */\n\tvolatile u_int32_t nicMacRxMacAbort;\t\t\t/* 114 */\n\tvolatile u_int32_t nicMacRxTruncNoResources;\t\t/* 115 */\n\t/*\n\t * Stats from the mac_stats area\n\t */\n\tvolatile u_int32_t nicMacRxDropUla;\t\t\t/* 116 */\n\tvolatile u_int32_t nicMacRxDropMcast;\t\t\t/* 117 */\n\tvolatile u_int32_t nicMacRxFlowControl;\t\t\t/* 118 */\n\tvolatile u_int32_t nicMacRxDropSpace;\t\t\t/* 119 */\n\tvolatile u_int32_t nicMacRxColls;\t\t\t/* 120 */\n\t/*\n \t * MAC RX Attentions\n\t */\n\tvolatile u_int32_t nicMacRxTotalAttns;\t\t\t/* 121 */\n\tvolatile u_int32_t nicMacRxLinkAttns;\t\t\t/* 122 */\n\tvolatile u_int32_t nicMacRxSyncAttns;\t\t\t/* 123 */\n\tvolatile u_int32_t nicMacRxConfigAttns;\t\t\t/* 124 */\n\tvolatile u_int32_t nicMacReset;\t\t\t\t/* 125 */\n\tvolatile u_int32_t nicMacRxBufDescrAttns;\t\t/* 126 */\n\tvolatile u_int32_t nicMacRxBufAttns;\t\t\t/* 127 */\n\tvolatile u_int32_t nicMacRxZeroFrameCleanup;\t\t/* 128 */\n\tvolatile u_int32_t nicMacRxOneFrameCleanup;\t\t/* 129 */\n\tvolatile u_int32_t nicMacRxMultipleFrameCleanup;\t/* 130 */\n\tvolatile u_int32_t nicMacRxTimerCleanup;\t\t/* 131 */\n\tvolatile u_int32_t nicMacRxDmaCleanup;\t\t\t/* 132 */\n\t/*\n\t * Stats from the mac_stats area\n\t */\n\tvolatile u_int32_t nicMacTxCollisionHistogram[15];\t/* 133 */\n\t/*\n\t * MAC TX Attentions\n\t */\n\tvolatile u_int32_t nicMacTxTotalAttns;\t\t\t/* 134 */\n\t/*\n\t * NIC Profile\n\t */\n\tvolatile u_int32_t nicProfile[32];\t\t\t/* 135 */\n\t/*\n\t * Pat to 1024 bytes.\n\t */\n\tu_int32_t\t\tpad[75];\n};\n\nstruct tg_reg {\n\tu_int32_t\tdata;\n\tu_int32_t\taddr;\n};      \n\nstruct tg_mem {\n\tu_int32_t\ttgAddr;\n\tcaddr_t\t\tuserAddr;\n\tint\t\tlen;\n}; \n\n\ntypedef enum {\n\tTI_PARAM_NONE\t\t= 0x00,\n\tTI_PARAM_STAT_TICKS\t= 0x01,\n\tTI_PARAM_RX_COAL_TICKS\t= 0x02,\n\tTI_PARAM_TX_COAL_TICKS\t= 0x04,\n\tTI_PARAM_RX_COAL_BDS\t= 0x08,\n\tTI_PARAM_TX_COAL_BDS\t= 0x10,\n\tTI_PARAM_TX_BUF_RATIO\t= 0x20,\n\tTI_PARAM_ALL\t\t= 0x2f\n} ti_param_mask;\n\nstruct ti_params {\n\tu_int32_t\tti_stat_ticks;\n\tu_int32_t\tti_rx_coal_ticks;\n\tu_int32_t\tti_tx_coal_ticks;\n\tu_int32_t\tti_rx_max_coal_bds;\n\tu_int32_t\tti_tx_max_coal_bds;\n\tu_int32_t\tti_tx_buf_ratio;\n\tti_param_mask\tparam_mask;\n};\n\ntypedef enum {\n\tTI_TRACE_TYPE_NONE\t= 0x00000000,\n\tTI_TRACE_TYPE_SEND\t= 0x00000001,\n\tTI_TRACE_TYPE_RECV\t= 0x00000002,\n\tTI_TRACE_TYPE_DMA\t= 0x00000004,\n\tTI_TRACE_TYPE_EVENT\t= 0x00000008,\n\tTI_TRACE_TYPE_COMMAND\t= 0x00000010,\n\tTI_TRACE_TYPE_MAC\t= 0x00000020,\n\tTI_TRACE_TYPE_STATS\t= 0x00000040,\n\tTI_TRACE_TYPE_TIMER\t= 0x00000080,\n\tTI_TRACE_TYPE_DISP\t= 0x00000100,\n\tTI_TRACE_TYPE_MAILBOX\t= 0x00000200,\n\tTI_TRACE_TYPE_RECV_BD\t= 0x00000400,\n\tTI_TRACE_TYPE_LNK_PHY\t= 0x00000800,\n\tTI_TRACE_TYPE_LNK_NEG\t= 0x00001000,\n\tTI_TRACE_LEVEL_1\t= 0x10000000,\n\tTI_TRACE_LEVEL_2\t= 0x20000000\n} ti_trace_type;\n\nstruct ti_trace_buf {\n\tu_long\t*buf;\n\tint\tbuf_len;\n\tint\tfill_len;\n\tu_long\tcur_trace_ptr;\n};\n\n#define\tTIIOCGETSTATS\t_IOR('T', 1, struct ti_stats)\n#define\tTIIOCGETPARAMS\t_IOR('T', 2, struct ti_params)\n#define\tTIIOCSETPARAMS\t_IOW('T', 3, struct ti_params)\n#define TIIOCSETTRACE\t_IOW('T', 11, ti_trace_type)\n#define TIIOCGETTRACE\t_IOWR('T', 12, struct ti_trace_buf)\n\n/*\n * Taken from Alteon's altioctl.h.  Alteon's ioctl numbers 1-6 aren't\n * used by the FreeBSD driver.\n */\n#define ALT_ATTACH\t\t_IO('a', 7)\n#define ALT_READ_TG_MEM\t\t_IOWR('a', 10, struct tg_mem)\n#define ALT_WRITE_TG_MEM\t_IOWR('a', 11, struct tg_mem)\n#define ALT_READ_TG_REG\t\t_IOWR('a', 12, struct tg_reg)\n#define ALT_WRITE_TG_REG\t_IOWR('a', 13, struct tg_reg)\n\n#endif /* _SYS_TIIO_H_  */\n"
  },
  {
    "path": "freebsd-headers/sys/time.h",
    "content": "/*-\n * Copyright (c) 1982, 1986, 1993\n *\tThe Regents of the University of California.  All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 4. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t@(#)time.h\t8.5 (Berkeley) 5/4/95\n * $FreeBSD: release/9.0.0/sys/sys/time.h 224732 2011-08-09 14:06:50Z jonathan $\n */\n\n#ifndef _SYS_TIME_H_\n#define _SYS_TIME_H_\n\n#include <sys/_timeval.h>\n#include <sys/types.h>\n#include <sys/timespec.h>\n\nstruct timezone {\n\tint\ttz_minuteswest;\t/* minutes west of Greenwich */\n\tint\ttz_dsttime;\t/* type of dst correction */\n};\n#define\tDST_NONE\t0\t/* not on dst */\n#define\tDST_USA\t\t1\t/* USA style dst */\n#define\tDST_AUST\t2\t/* Australian style dst */\n#define\tDST_WET\t\t3\t/* Western European dst */\n#define\tDST_MET\t\t4\t/* Middle European dst */\n#define\tDST_EET\t\t5\t/* Eastern European dst */\n#define\tDST_CAN\t\t6\t/* Canada */\n\n#if __BSD_VISIBLE\nstruct bintime {\n\ttime_t\tsec;\n\tuint64_t frac;\n};\n\nstatic __inline void\nbintime_addx(struct bintime *bt, uint64_t x)\n{\n\tuint64_t u;\n\n\tu = bt->frac;\n\tbt->frac += x;\n\tif (u > bt->frac)\n\t\tbt->sec++;\n}\n\nstatic __inline void\nbintime_add(struct bintime *bt, const struct bintime *bt2)\n{\n\tuint64_t u;\n\n\tu = bt->frac;\n\tbt->frac += bt2->frac;\n\tif (u > bt->frac)\n\t\tbt->sec++;\n\tbt->sec += bt2->sec;\n}\n\nstatic __inline void\nbintime_sub(struct bintime *bt, const struct bintime *bt2)\n{\n\tuint64_t u;\n\n\tu = bt->frac;\n\tbt->frac -= bt2->frac;\n\tif (u < bt->frac)\n\t\tbt->sec--;\n\tbt->sec -= bt2->sec;\n}\n\nstatic __inline void\nbintime_mul(struct bintime *bt, u_int x)\n{\n\tuint64_t p1, p2;\n\n\tp1 = (bt->frac & 0xffffffffull) * x;\n\tp2 = (bt->frac >> 32) * x + (p1 >> 32);\n\tbt->sec *= x;\n\tbt->sec += (p2 >> 32);\n\tbt->frac = (p2 << 32) | (p1 & 0xffffffffull);\n}\n\n#define\tbintime_clear(a)\t((a)->sec = (a)->frac = 0)\n#define\tbintime_isset(a)\t((a)->sec || (a)->frac)\n#define\tbintime_cmp(a, b, cmp)\t\t\t\t\t\t\\\n\t(((a)->sec == (b)->sec) ?\t\t\t\t\t\\\n\t    ((a)->frac cmp (b)->frac) :\t\t\t\t\t\\\n\t    ((a)->sec cmp (b)->sec))\n\n/*-\n * Background information:\n *\n * When converting between timestamps on parallel timescales of differing\n * resolutions it is historical and scientific practice to round down rather\n * than doing 4/5 rounding.\n *\n *   The date changes at midnight, not at noon.\n *\n *   Even at 15:59:59.999999999 it's not four'o'clock.\n *\n *   time_second ticks after N.999999999 not after N.4999999999\n */\n\nstatic __inline void\nbintime2timespec(const struct bintime *bt, struct timespec *ts)\n{\n\n\tts->tv_sec = bt->sec;\n\tts->tv_nsec = ((uint64_t)1000000000 * (uint32_t)(bt->frac >> 32)) >> 32;\n}\n\nstatic __inline void\ntimespec2bintime(const struct timespec *ts, struct bintime *bt)\n{\n\n\tbt->sec = ts->tv_sec;\n\t/* 18446744073 = int(2^64 / 1000000000) */\n\tbt->frac = ts->tv_nsec * (uint64_t)18446744073LL; \n}\n\nstatic __inline void\nbintime2timeval(const struct bintime *bt, struct timeval *tv)\n{\n\n\ttv->tv_sec = bt->sec;\n\ttv->tv_usec = ((uint64_t)1000000 * (uint32_t)(bt->frac >> 32)) >> 32;\n}\n\nstatic __inline void\ntimeval2bintime(const struct timeval *tv, struct bintime *bt)\n{\n\n\tbt->sec = tv->tv_sec;\n\t/* 18446744073709 = int(2^64 / 1000000) */\n\tbt->frac = tv->tv_usec * (uint64_t)18446744073709LL;\n}\n#endif /* __BSD_VISIBLE */\n\n#ifdef _KERNEL\n\n/* Operations on timespecs */\n#define\ttimespecclear(tvp)\t((tvp)->tv_sec = (tvp)->tv_nsec = 0)\n#define\ttimespecisset(tvp)\t((tvp)->tv_sec || (tvp)->tv_nsec)\n#define\ttimespeccmp(tvp, uvp, cmp)\t\t\t\t\t\\\n\t(((tvp)->tv_sec == (uvp)->tv_sec) ?\t\t\t\t\\\n\t    ((tvp)->tv_nsec cmp (uvp)->tv_nsec) :\t\t\t\\\n\t    ((tvp)->tv_sec cmp (uvp)->tv_sec))\n#define timespecadd(vvp, uvp)\t\t\t\t\t\t\\\n\tdo {\t\t\t\t\t\t\t\t\\\n\t\t(vvp)->tv_sec += (uvp)->tv_sec;\t\t\t\t\\\n\t\t(vvp)->tv_nsec += (uvp)->tv_nsec;\t\t\t\\\n\t\tif ((vvp)->tv_nsec >= 1000000000) {\t\t\t\\\n\t\t\t(vvp)->tv_sec++;\t\t\t\t\\\n\t\t\t(vvp)->tv_nsec -= 1000000000;\t\t\t\\\n\t\t}\t\t\t\t\t\t\t\\\n\t} while (0)\n#define timespecsub(vvp, uvp)\t\t\t\t\t\t\\\n\tdo {\t\t\t\t\t\t\t\t\\\n\t\t(vvp)->tv_sec -= (uvp)->tv_sec;\t\t\t\t\\\n\t\t(vvp)->tv_nsec -= (uvp)->tv_nsec;\t\t\t\\\n\t\tif ((vvp)->tv_nsec < 0) {\t\t\t\t\\\n\t\t\t(vvp)->tv_sec--;\t\t\t\t\\\n\t\t\t(vvp)->tv_nsec += 1000000000;\t\t\t\\\n\t\t}\t\t\t\t\t\t\t\\\n\t} while (0)\n\n/* Operations on timevals. */\n\n#define\ttimevalclear(tvp)\t\t((tvp)->tv_sec = (tvp)->tv_usec = 0)\n#define\ttimevalisset(tvp)\t\t((tvp)->tv_sec || (tvp)->tv_usec)\n#define\ttimevalcmp(tvp, uvp, cmp)\t\t\t\t\t\\\n\t(((tvp)->tv_sec == (uvp)->tv_sec) ?\t\t\t\t\\\n\t    ((tvp)->tv_usec cmp (uvp)->tv_usec) :\t\t\t\\\n\t    ((tvp)->tv_sec cmp (uvp)->tv_sec))\n\n/* timevaladd and timevalsub are not inlined */\n\n#endif /* _KERNEL */\n\n#ifndef _KERNEL\t\t\t/* NetBSD/OpenBSD compatible interfaces */\n\n#define\ttimerclear(tvp)\t\t((tvp)->tv_sec = (tvp)->tv_usec = 0)\n#define\ttimerisset(tvp)\t\t((tvp)->tv_sec || (tvp)->tv_usec)\n#define\ttimercmp(tvp, uvp, cmp)\t\t\t\t\t\\\n\t(((tvp)->tv_sec == (uvp)->tv_sec) ?\t\t\t\t\\\n\t    ((tvp)->tv_usec cmp (uvp)->tv_usec) :\t\t\t\\\n\t    ((tvp)->tv_sec cmp (uvp)->tv_sec))\n#define timeradd(tvp, uvp, vvp)\t\t\t\t\t\t\\\n\tdo {\t\t\t\t\t\t\t\t\\\n\t\t(vvp)->tv_sec = (tvp)->tv_sec + (uvp)->tv_sec;\t\t\\\n\t\t(vvp)->tv_usec = (tvp)->tv_usec + (uvp)->tv_usec;\t\\\n\t\tif ((vvp)->tv_usec >= 1000000) {\t\t\t\\\n\t\t\t(vvp)->tv_sec++;\t\t\t\t\\\n\t\t\t(vvp)->tv_usec -= 1000000;\t\t\t\\\n\t\t}\t\t\t\t\t\t\t\\\n\t} while (0)\n#define timersub(tvp, uvp, vvp)\t\t\t\t\t\t\\\n\tdo {\t\t\t\t\t\t\t\t\\\n\t\t(vvp)->tv_sec = (tvp)->tv_sec - (uvp)->tv_sec;\t\t\\\n\t\t(vvp)->tv_usec = (tvp)->tv_usec - (uvp)->tv_usec;\t\\\n\t\tif ((vvp)->tv_usec < 0) {\t\t\t\t\\\n\t\t\t(vvp)->tv_sec--;\t\t\t\t\\\n\t\t\t(vvp)->tv_usec += 1000000;\t\t\t\\\n\t\t}\t\t\t\t\t\t\t\\\n\t} while (0)\n#endif\n\n/*\n * Names of the interval timers, and structure\n * defining a timer setting.\n */\n#define\tITIMER_REAL\t0\n#define\tITIMER_VIRTUAL\t1\n#define\tITIMER_PROF\t2\n\nstruct itimerval {\n\tstruct\ttimeval it_interval;\t/* timer interval */\n\tstruct\ttimeval it_value;\t/* current value */\n};\n\n/*\n * Getkerninfo clock information structure\n */\nstruct clockinfo {\n\tint\thz;\t\t/* clock frequency */\n\tint\ttick;\t\t/* micro-seconds per hz tick */\n\tint\tspare;\n\tint\tstathz;\t\t/* statistics clock frequency */\n\tint\tprofhz;\t\t/* profiling clock frequency */\n};\n\n/* These macros are also in time.h. */\n#ifndef CLOCK_REALTIME\n#define CLOCK_REALTIME\t0\n#define CLOCK_VIRTUAL\t1\n#define CLOCK_PROF\t2\n#define CLOCK_MONOTONIC\t4\n#define CLOCK_UPTIME\t5\t\t/* FreeBSD-specific. */\n#define CLOCK_UPTIME_PRECISE\t7\t/* FreeBSD-specific. */\n#define CLOCK_UPTIME_FAST\t8\t/* FreeBSD-specific. */\n#define CLOCK_REALTIME_PRECISE\t9\t/* FreeBSD-specific. */\n#define CLOCK_REALTIME_FAST\t10\t/* FreeBSD-specific. */\n#define CLOCK_MONOTONIC_PRECISE\t11\t/* FreeBSD-specific. */\n#define CLOCK_MONOTONIC_FAST\t12\t/* FreeBSD-specific. */\n#define CLOCK_SECOND\t13\t\t/* FreeBSD-specific. */\n#define CLOCK_THREAD_CPUTIME_ID\t14\n#endif\n\n#ifndef TIMER_ABSTIME\n#define TIMER_RELTIME\t0x0\t/* relative timer */\n#define TIMER_ABSTIME\t0x1\t/* absolute timer */\n#endif\n\n#ifdef _KERNEL\n\n/*\n * Kernel to clock driver interface.\n */\nvoid\tinittodr(time_t base);\nvoid\tresettodr(void);\n\nextern time_t\ttime_second;\nextern time_t\ttime_uptime;\nextern struct bintime boottimebin;\nextern struct timeval boottime;\n\n/*\n * Functions for looking at our clock: [get]{bin,nano,micro}[up]time()\n *\n * Functions without the \"get\" prefix returns the best timestamp\n * we can produce in the given format.\n *\n * \"bin\"   == struct bintime  == seconds + 64 bit fraction of seconds.\n * \"nano\"  == struct timespec == seconds + nanoseconds.\n * \"micro\" == struct timeval  == seconds + microseconds.\n *              \n * Functions containing \"up\" returns time relative to boot and\n * should be used for calculating time intervals.\n *\n * Functions without \"up\" returns GMT time.\n *\n * Functions with the \"get\" prefix returns a less precise result\n * much faster than the functions without \"get\" prefix and should\n * be used where a precision of 1/hz seconds is acceptable or where\n * performance is priority. (NB: \"precision\", _not_ \"resolution\" !) \n * \n */\n\nvoid\tbinuptime(struct bintime *bt);\nvoid\tnanouptime(struct timespec *tsp);\nvoid\tmicrouptime(struct timeval *tvp);\n\nvoid\tbintime(struct bintime *bt);\nvoid\tnanotime(struct timespec *tsp);\nvoid\tmicrotime(struct timeval *tvp);\n\nvoid\tgetbinuptime(struct bintime *bt);\nvoid\tgetnanouptime(struct timespec *tsp);\nvoid\tgetmicrouptime(struct timeval *tvp);\n\nvoid\tgetbintime(struct bintime *bt);\nvoid\tgetnanotime(struct timespec *tsp);\nvoid\tgetmicrotime(struct timeval *tvp);\n\n/* Other functions */\nint\titimerdecr(struct itimerval *itp, int usec);\nint\titimerfix(struct timeval *tv);\nint\tppsratecheck(struct timeval *, int *, int);\nint\tratecheck(struct timeval *, const struct timeval *);\nvoid\ttimevaladd(struct timeval *t1, const struct timeval *t2);\nvoid\ttimevalsub(struct timeval *t1, const struct timeval *t2);\nint\ttvtohz(struct timeval *tv);\n#else /* !_KERNEL */\n#include <time.h>\n\n#include <sys/cdefs.h>\n#include <sys/select.h>\n\n__BEGIN_DECLS\nint\tsetitimer(int, const struct itimerval *, struct itimerval *);\nint\tutimes(const char *, const struct timeval *);\n\n#if __BSD_VISIBLE\nint\tadjtime(const struct timeval *, struct timeval *);\nint\tfutimes(int, const struct timeval *);\nint\tfutimesat(int, const char *, const struct timeval [2]);\nint\tlutimes(const char *, const struct timeval *);\nint\tsettimeofday(const struct timeval *, const struct timezone *);\n#endif\n\n#if __XSI_VISIBLE\nint\tgetitimer(int, struct itimerval *);\nint\tgettimeofday(struct timeval *, struct timezone *);\n#endif\n\n__END_DECLS\n\n#endif /* !_KERNEL */\n\n#endif /* !_SYS_TIME_H_ */\n"
  },
  {
    "path": "freebsd-headers/sys/timeb.h",
    "content": "/*-\n * Copyright (c) 1991, 1993\n *\tThe Regents of the University of California.  All rights reserved.\n * (c) UNIX System Laboratories, Inc.\n * All or some portions of this file are derived from material licensed\n * to the University of California by American Telephone and Telegraph\n * Co. or Unix System Laboratories, Inc. and are reproduced herein with\n * the permission of UNIX System Laboratories, Inc.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 4. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t@(#)timeb.h\t8.2 (Berkeley) 1/21/94\n * $FreeBSD: release/9.0.0/sys/sys/timeb.h 204926 2010-03-09 21:01:12Z ed $\n */\n\n#ifndef _SYS_TIMEB_H_\n#define _SYS_TIMEB_H_\n\n#ifdef __GNUC__\n#warning \"this file includes <sys/timeb.h> which is deprecated\"\n#endif\n\n#include <sys/_types.h>\n\n#ifndef _TIME_T_DECLARED\ntypedef\t__time_t\ttime_t;\n#define\t_TIME_T_DECLARED\n#endif\n\n/* The ftime(2) system call structure -- deprecated. */\nstruct timeb {\n\ttime_t\ttime;\t\t\t/* seconds since the Epoch */\n\tunsigned short millitm;\t\t/* + milliseconds since the Epoch */\n\tshort\ttimezone;\t\t/* minutes west of CUT */\n\tshort\tdstflag;\t\t/* DST == non-zero */\n};\n\n#ifndef _KERNEL\n#include <sys/cdefs.h>\n\n__BEGIN_DECLS\nint ftime(struct timeb *);\n__END_DECLS\n#endif /* _KERNEL */\n\n#endif /* !_SYS_TIMEB_H_ */\n"
  },
  {
    "path": "freebsd-headers/sys/timeet.h",
    "content": "/*-\n * Copyright (c) 2010 Alexander Motin <mav@FreeBSD.org>\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer,\n *    without modification, immediately at the beginning of the file.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR\n * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES\n * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,\n * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF\n * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/sys/timeet.h 212541 2010-09-13 07:25:35Z mav $\n */\n\n#ifndef _SYS_TIMEEC_H_\n#define\t_SYS_TIMEEC_H_\n\n#ifndef _KERNEL\n#error \"no user-serviceable parts inside\"\n#endif\n\n#include <sys/lock.h>\n#include <sys/mutex.h>\n#include <sys/queue.h>\n#include <sys/time.h>\n\n/*\n * `struct eventtimer' is the interface between the hardware which implements\n * a event timer and the MI code which uses this to receive time events.\n */\n\nstruct eventtimer;\ntypedef int et_start_t(struct eventtimer *et,\n    struct bintime *first, struct bintime *period);\ntypedef int et_stop_t(struct eventtimer *et);\ntypedef void et_event_cb_t(struct eventtimer *et, void *arg);\ntypedef int et_deregister_cb_t(struct eventtimer *et, void *arg);\n\nstruct eventtimer {\n\tSLIST_ENTRY(eventtimer)\tet_all;\n\t\t/* Pointer to the next event timer. */\n\tchar\t\t\t*et_name;\n\t\t/* Name of the event timer. */\n\tint\t\t\tet_flags;\n\t\t/* Set of capabilities flags: */\n#define ET_FLAGS_PERIODIC\t1\n#define ET_FLAGS_ONESHOT\t2\n#define ET_FLAGS_PERCPU\t\t4\n#define ET_FLAGS_C3STOP\t\t8\n#define ET_FLAGS_POW2DIV\t16\n\tint\t\t\tet_quality;\n\t\t/*\n\t\t * Used to determine if this timecounter is better than\n\t\t * another timecounter. Higher means better.\n\t\t */\n\tint\t\t\tet_active;\n\tu_int64_t\t\tet_frequency;\n\t\t/* Base frequency in Hz. */\n\tstruct bintime\t\tet_min_period;\n\tstruct bintime\t\tet_max_period;\n\tet_start_t\t\t*et_start;\n\tet_stop_t\t\t*et_stop;\n\tet_event_cb_t\t\t*et_event_cb;\n\tet_deregister_cb_t\t*et_deregister_cb;\n\tvoid \t\t\t*et_arg;\n\tvoid\t\t\t*et_priv;\n\tstruct sysctl_oid\t*et_sysctl;\n\t\t/* Pointer to the event timer's private parts. */\n};\n\nextern struct mtx\tet_eventtimers_mtx;\n#define\tET_LOCK()\tmtx_lock(&et_eventtimers_mtx)\n#define\tET_UNLOCK()\tmtx_unlock(&et_eventtimers_mtx)\n\n/* Driver API */\nint\tet_register(struct eventtimer *et);\nint\tet_deregister(struct eventtimer *et);\n/* Consumer API  */\nstruct eventtimer *et_find(const char *name, int check, int want);\nint\tet_init(struct eventtimer *et, et_event_cb_t *event,\n    et_deregister_cb_t *deregister, void *arg);\nint\tet_start(struct eventtimer *et,\n    struct bintime *first, struct bintime *period);\nint\tet_stop(struct eventtimer *et);\nint\tet_ban(struct eventtimer *et);\nint\tet_free(struct eventtimer *et);\n\n#ifdef SYSCTL_DECL\nSYSCTL_DECL(_kern_eventtimer);\n#endif\n#endif /* !_SYS_TIMETC_H_ */\n\n"
  },
  {
    "path": "freebsd-headers/sys/timepps.h",
    "content": "/*-\n * ----------------------------------------------------------------------------\n * \"THE BEER-WARE LICENSE\" (Revision 42):\n * <phk@FreeBSD.org> wrote this file.  As long as you retain this notice you\n * can do whatever you want with this stuff. If we meet some day, and you think\n * this stuff is worth it, you can buy me a beer in return.   Poul-Henning Kamp\n * ----------------------------------------------------------------------------\n *\n * $FreeBSD: release/9.0.0/sys/sys/timepps.h 139825 2005-01-07 02:29:27Z imp $\n *\n * The is a FreeBSD version of the RFC 2783 API for Pulse Per Second \n * timing interfaces.  \n */\n\n#ifndef _SYS_TIMEPPS_H_\n#define _SYS_TIMEPPS_H_\n\n#include <sys/ioccom.h>\n#include <sys/time.h>\n\n#define PPS_API_VERS_1\t1\n\ntypedef int pps_handle_t;\t\n\ntypedef unsigned pps_seq_t;\n\ntypedef struct ntp_fp {\n\tunsigned int\tintegral;\n\tunsigned int\tfractional;\n} ntp_fp_t;\n\ntypedef union pps_timeu {\n\tstruct timespec\ttspec;\n\tntp_fp_t\tntpfp;\n\tunsigned long\tlongpad[3];\n} pps_timeu_t;\n\ntypedef struct {\n\tpps_seq_t\tassert_sequence;\t/* assert event seq # */\n\tpps_seq_t\tclear_sequence;\t\t/* clear event seq # */\n\tpps_timeu_t\tassert_tu;\n\tpps_timeu_t\tclear_tu;\n\tint\t\tcurrent_mode;\t\t/* current mode bits */\n} pps_info_t;\n\n#define assert_timestamp        assert_tu.tspec\n#define clear_timestamp         clear_tu.tspec\n\n#define assert_timestamp_ntpfp  assert_tu.ntpfp\n#define clear_timestamp_ntpfp   clear_tu.ntpfp\n\ntypedef struct {\n\tint api_version;\t\t\t/* API version # */\n\tint mode;\t\t\t\t/* mode bits */\n\tpps_timeu_t assert_off_tu;\n\tpps_timeu_t clear_off_tu;\n} pps_params_t;\n\n#define assert_offset   assert_off_tu.tspec\n#define clear_offset    clear_off_tu.tspec\n\n#define assert_offset_ntpfp     assert_off_tu.ntpfp\n#define clear_offset_ntpfp      clear_off_tu.ntpfp\n\n\n#define PPS_CAPTUREASSERT\t0x01\n#define PPS_CAPTURECLEAR\t0x02\n#define PPS_CAPTUREBOTH\t\t0x03\n\n#define PPS_OFFSETASSERT\t0x10\n#define PPS_OFFSETCLEAR\t\t0x20\n\n#define PPS_ECHOASSERT\t\t0x40\n#define PPS_ECHOCLEAR\t\t0x80\n\n#define PPS_CANWAIT\t\t0x100\n#define PPS_CANPOLL\t\t0x200\n\n#define PPS_TSFMT_TSPEC\t\t0x1000\n#define PPS_TSFMT_NTPFP\t\t0x2000\n\n#define PPS_KC_HARDPPS\t\t0\n#define PPS_KC_HARDPPS_PLL\t1\n#define PPS_KC_HARDPPS_FLL\t2\n\nstruct pps_fetch_args {\n\tint tsformat;\n\tpps_info_t\tpps_info_buf;\n\tstruct timespec\ttimeout;\n};\n\nstruct pps_kcbind_args {\n\tint kernel_consumer;\n\tint edge;\n\tint tsformat;\n};\n\n#define PPS_IOC_CREATE\t\t_IO('1', 1)\n#define PPS_IOC_DESTROY\t\t_IO('1', 2)\n#define PPS_IOC_SETPARAMS\t_IOW('1', 3, pps_params_t)\n#define PPS_IOC_GETPARAMS\t_IOR('1', 4, pps_params_t)\n#define PPS_IOC_GETCAP\t\t_IOR('1', 5, int)\n#define PPS_IOC_FETCH\t\t_IOWR('1', 6, struct pps_fetch_args)\n#define PPS_IOC_KCBIND\t\t_IOW('1', 7, struct pps_kcbind_args)\n\n#ifdef _KERNEL\n\nstruct pps_state {\n\t/* Capture information. */\n\tstruct timehands *capth;\n\tunsigned\tcapgen;\n\tunsigned\tcapcount;\n\n\t/* State information. */\n\tpps_params_t\tppsparam;\n\tpps_info_t\tppsinfo;\n\tint\t\tkcmode;\n\tint\t\tppscap;\n\tstruct timecounter *ppstc;\n\tunsigned\tppscount[3];\n};\n\nvoid pps_capture(struct pps_state *pps);\nvoid pps_event(struct pps_state *pps, int event);\nvoid pps_init(struct pps_state *pps);\nint pps_ioctl(unsigned long cmd, caddr_t data, struct pps_state *pps);\nvoid hardpps(struct timespec *tsp, long nsec);\n\n#else /* !_KERNEL */\n\nstatic __inline int\ntime_pps_create(int filedes, pps_handle_t *handle)\n{\n\tint error;\n\n\t*handle = -1;\n\terror = ioctl(filedes, PPS_IOC_CREATE, 0);\n\tif (error < 0) \n\t\treturn (-1);\n\t*handle = filedes;\n\treturn (0);\n}\n\nstatic __inline int\ntime_pps_destroy(pps_handle_t handle)\n{\n\treturn (ioctl(handle, PPS_IOC_DESTROY, 0));\n}\n\nstatic __inline int\ntime_pps_setparams(pps_handle_t handle, const pps_params_t *ppsparams)\n{\n\treturn (ioctl(handle, PPS_IOC_SETPARAMS, ppsparams));\n}\n\nstatic __inline int\ntime_pps_getparams(pps_handle_t handle, pps_params_t *ppsparams)\n{\n\treturn (ioctl(handle, PPS_IOC_GETPARAMS, ppsparams));\n}\n\nstatic __inline int \ntime_pps_getcap(pps_handle_t handle, int *mode)\n{\n\treturn (ioctl(handle, PPS_IOC_GETCAP, mode));\n}\n\nstatic __inline int\ntime_pps_fetch(pps_handle_t handle, const int tsformat,\n\tpps_info_t *ppsinfobuf, const struct timespec *timeout)\n{\n\tint error;\n\tstruct pps_fetch_args arg;\n\n\targ.tsformat = tsformat;\n\tif (timeout == NULL) {\n\t\targ.timeout.tv_sec = -1;\n\t\targ.timeout.tv_nsec = -1;\n\t} else\n\t\targ.timeout = *timeout;\n\terror = ioctl(handle, PPS_IOC_FETCH, &arg);\n\t*ppsinfobuf = arg.pps_info_buf;\n\treturn (error);\n}\n\nstatic __inline int\ntime_pps_kcbind(pps_handle_t handle, const int kernel_consumer,\n\tconst int edge, const int tsformat)\n{\n\tstruct pps_kcbind_args arg;\n\n\targ.kernel_consumer = kernel_consumer;\n\targ.edge = edge;\n\targ.tsformat = tsformat;\n\treturn (ioctl(handle, PPS_IOC_KCBIND, &arg));\n}\n\n#endif /* KERNEL */\n\n#endif /* !_SYS_TIMEPPS_H_ */\n"
  },
  {
    "path": "freebsd-headers/sys/timers.h",
    "content": "/*-\n * Copyright (c) 2005 David Xu <davidxu@freebsd.org>\n * Copyright (c) 1994 by Chris Provenzano, proven@mit.edu\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. All advertising materials mentioning features or use of this software\n *    must display the following acknowledgement:\n *  This product includes software developed by Chris Provenzano.\n * 4. The name of Chris Provenzano may not be used to endorse or promote\n *    products derived from this software without specific prior written\n *    permission.\n *\n * THIS SOFTWARE IS PROVIDED BY CHRIS PROVENZANO ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL CHRIS PROVENZANO BE LIABLE FOR ANY\n * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR\n * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/sys/timers.h 156137 2006-03-01 06:48:31Z davidxu $\n *\n * Description : Basic timers header.\n */\n\n#ifndef _SYS_TIMERS_H_\n#define _SYS_TIMERS_H_\n\n#include <sys/time.h>\n\n#ifdef _KERNEL\n/*\n * Structures used to manage POSIX timers in a process.\n */\nstruct itimer {\n\tstruct mtx  \t\tit_mtx;\n\tstruct sigevent\t\tit_sigev;\n\tstruct itimerspec\tit_time;\n\tstruct proc \t\t*it_proc;\n\tint\tit_flags;\n\tint\tit_usecount;\n\tint\tit_overrun;\t\t/* Overruns currently accumulating */\n\tint\tit_overrun_last;\t/* Overruns associated w/ a delivery */\n\tint\tit_clockid;\n\tint\tit_timerid;\n\tksiginfo_t\tit_ksi;\n\tunion {\n\t\t/* realtime */\n\t\tstruct {\n\t\t\tstruct callout it_callout;\n\t\t} _rt;\n\n\t\t/* cpu timer */\n\t\tstruct {\n\t\t\tLIST_ENTRY(itimer)\tit_link;\n\t\t\tTAILQ_ENTRY(itimer)\tit_worklink;\n\t\t\tint\t\t\tit_active;\n\t\t\tint\t\t\tit_cflags;\n\t\t} _cpu;\n\t} _data;\n};\n\n#define it_callout\t_data._rt.it_callout\n#define it_link\t\t_data._cpu.it_link\n#define it_active\t_data._cpu.it_active\n#define\tit_worklink\t_data._cpu.it_worklink\n#define\tit_cflags\t_data._cpu.it_cflags\n\n#define\tITF_DELETING\t0x01\n#define\tITF_WANTED\t0x02\n\n#define\tITCF_ONWORKLIST\t0x01\n\n#define\tTIMER_MAX\t32\n\n#define\tITIMER_LOCK(it)\t\tmtx_lock(&(it)->it_mtx)\n#define\tITIMER_UNLOCK(it)\tmtx_unlock(&(it)->it_mtx)\n\nLIST_HEAD(itimerlist, itimer);\n\nstruct\titimers {\n\tstruct itimerlist\tits_virtual;\n\tstruct itimerlist\tits_prof;\n\tTAILQ_HEAD(, itimer)\tits_worklist;\n\tstruct itimer\t\t*its_timers[TIMER_MAX];\n};\n\nstruct\tkclock {\n\tint (*timer_create)(struct itimer *timer);\n\tint (*timer_settime)(struct itimer * timer, int flags,\n\t\tstruct itimerspec * new_value,\n\t\tstruct itimerspec * old_value);\n\tint (*timer_delete)(struct itimer * timer);\n\tint (*timer_gettime)(struct itimer * timer,\n\t\tstruct itimerspec * cur_value);\n\tvoid (*event_hook)(struct proc *p, clockid_t clock_id, int event);\n};\n\n/* Event values for event_hook() */\n#define\tITIMER_EV_EXEC\t0\n#define\tITIMER_EV_EXIT\t1\n\nint\titimer_accept(struct proc *p, int tid, ksiginfo_t *ksi);\n#endif\n#endif /* !_SYS_TIMERS_H_ */\n"
  },
  {
    "path": "freebsd-headers/sys/times.h",
    "content": "/*-\n * Copyright (c) 1990, 1993\n *\tThe Regents of the University of California.  All rights reserved.\n * (c) UNIX System Laboratories, Inc.\n * All or some portions of this file are derived from material licensed\n * to the University of California by American Telephone and Telegraph\n * Co. or Unix System Laboratories, Inc. and are reproduced herein with\n * the permission of UNIX System Laboratories, Inc.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 4. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t@(#)times.h\t8.4 (Berkeley) 1/21/94\n * $FreeBSD: release/9.0.0/sys/sys/times.h 127976 2004-04-07 04:19:52Z imp $\n */\n\n#ifndef\t_SYS_TIMES_H_\n#define\t_SYS_TIMES_H_\n\n#include <sys/_types.h>\n\n#ifndef _CLOCK_T_DECLARED\ntypedef\t__clock_t\tclock_t;\n#define\t_CLOCK_T_DECLARED\n#endif\n\nstruct tms {\n\tclock_t tms_utime;\t/* User CPU time */\n\tclock_t tms_stime;\t/* System CPU time */\n\tclock_t tms_cutime;\t/* User CPU time of terminated child procs */\n\tclock_t tms_cstime;\t/* System CPU time of terminated child procs */\n};\n\n#ifndef _KERNEL\n#include <sys/cdefs.h>\n\n__BEGIN_DECLS\nclock_t\ttimes(struct tms *);\n__END_DECLS\n#endif\n#endif /* !_SYS_TIMES_H_ */\n"
  },
  {
    "path": "freebsd-headers/sys/timespec.h",
    "content": "/*-\n * Copyright (c) 1982, 1986, 1993\n *\tThe Regents of the University of California.  All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 4. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t@(#)time.h\t8.5 (Berkeley) 5/4/95\n * from: FreeBSD: src/sys/sys/time.h,v 1.43 2000/03/20 14:09:05 phk Exp\n *\t$FreeBSD: release/9.0.0/sys/sys/timespec.h 205792 2010-03-28 13:13:22Z ed $\n */\n\n#ifndef _SYS_TIMESPEC_H_\n#define _SYS_TIMESPEC_H_\n\n#include <sys/cdefs.h>\n#include <sys/_timespec.h>\n\n#if __BSD_VISIBLE\n#define\tTIMEVAL_TO_TIMESPEC(tv, ts)\t\t\t\t\t\\\n\tdo {\t\t\t\t\t\t\t\t\\\n\t\t(ts)->tv_sec = (tv)->tv_sec;\t\t\t\t\\\n\t\t(ts)->tv_nsec = (tv)->tv_usec * 1000;\t\t\t\\\n\t} while (0)\n#define\tTIMESPEC_TO_TIMEVAL(tv, ts)\t\t\t\t\t\\\n\tdo {\t\t\t\t\t\t\t\t\\\n\t\t(tv)->tv_sec = (ts)->tv_sec;\t\t\t\t\\\n\t\t(tv)->tv_usec = (ts)->tv_nsec / 1000;\t\t\t\\\n\t} while (0)\n\n#endif /* __BSD_VISIBLE */\n\n/*\n * Structure defined by POSIX.1b to be like a itimerval, but with\n * timespecs. Used in the timer_*() system calls.\n */\nstruct itimerspec {\n\tstruct timespec  it_interval;\n\tstruct timespec  it_value;\n};\n\n#endif /* _SYS_TIMESPEC_H_ */\n"
  },
  {
    "path": "freebsd-headers/sys/timetc.h",
    "content": "/*-\n * ----------------------------------------------------------------------------\n * \"THE BEER-WARE LICENSE\" (Revision 42):\n * <phk@FreeBSD.ORG> wrote this file.  As long as you retain this notice you\n * can do whatever you want with this stuff. If we meet some day, and you think\n * this stuff is worth it, you can buy me a beer in return.   Poul-Henning Kamp\n * ----------------------------------------------------------------------------\n *\n * $FreeBSD: release/9.0.0/sys/sys/timetc.h 224043 2011-07-14 21:02:15Z jkim $\n */\n\n#ifndef _SYS_TIMETC_H_\n#define\t_SYS_TIMETC_H_\n\n#ifndef _KERNEL\n#error \"no user-serviceable parts inside\"\n#endif\n\n/*-\n * `struct timecounter' is the interface between the hardware which implements\n * a timecounter and the MI code which uses this to keep track of time.\n *\n * A timecounter is a binary counter which has two properties:\n *    * it runs at a fixed, known frequency.\n *    * it has sufficient bits to not roll over in less than approximately\n *      max(2 msec, 2/HZ seconds).  (The value 2 here is really 1 + delta,\n *      for some indeterminate value of delta.)\n */\n\nstruct timecounter;\ntypedef u_int timecounter_get_t(struct timecounter *);\ntypedef void timecounter_pps_t(struct timecounter *);\n\nstruct timecounter {\n\ttimecounter_get_t\t*tc_get_timecount;\n\t\t/*\n\t\t * This function reads the counter.  It is not required to\n\t\t * mask any unimplemented bits out, as long as they are\n\t\t * constant.\n\t\t */\n\ttimecounter_pps_t\t*tc_poll_pps;\n\t\t/*\n\t\t * This function is optional.  It will be called whenever the\n\t\t * timecounter is rewound, and is intended to check for PPS\n\t\t * events.  Normal hardware does not need it but timecounters\n\t\t * which latch PPS in hardware (like sys/pci/xrpu.c) do.\n\t\t */\n\tu_int \t\t\ttc_counter_mask;\n\t\t/* This mask should mask off any unimplemented bits. */\n\tuint64_t\t\ttc_frequency;\n\t\t/* Frequency of the counter in Hz. */\n\tchar\t\t\t*tc_name;\n\t\t/* Name of the timecounter. */\n\tint\t\t\ttc_quality;\n\t\t/*\n\t\t * Used to determine if this timecounter is better than\n\t\t * another timecounter higher means better.  Negative\n\t\t * means \"only use at explicit request\".\n\t\t */\n\tu_int\t\t\ttc_flags;\n#define\tTC_FLAGS_C3STOP\t\t1\t/* Timer dies in C3. */\n\n\tvoid\t\t\t*tc_priv;\n\t\t/* Pointer to the timecounter's private parts. */\n\tstruct timecounter\t*tc_next;\n\t\t/* Pointer to the next timecounter. */\n};\n\nextern struct timecounter *timecounter;\nextern int tc_min_ticktock_freq; /*\n\t\t\t\t  * Minimal tc_ticktock() call frequency,\n\t\t\t\t  * required to handle counter wraps.\n\t\t\t\t  */\n\nu_int64_t tc_getfrequency(void);\nvoid\ttc_init(struct timecounter *tc);\nvoid\ttc_setclock(struct timespec *ts);\nvoid\ttc_ticktock(int cnt);\nvoid\tcpu_tick_calibration(void);\n\n#ifdef SYSCTL_DECL\nSYSCTL_DECL(_kern_timecounter);\n#endif\n\n#endif /* !_SYS_TIMETC_H_ */\n"
  },
  {
    "path": "freebsd-headers/sys/timex.h",
    "content": "/*-\n ***********************************************************************\n *\t\t\t\t\t\t\t\t       *\n * Copyright (c) David L. Mills 1993-2001\t\t\t       *\n *\t\t\t\t\t\t\t\t       *\n * Permission to use, copy, modify, and distribute this software and   *\n * its documentation for any purpose and without fee is hereby\t       *\n * granted, provided that the above copyright notice appears in all    *\n * copies and that both the copyright notice and this permission       *\n * notice appear in supporting documentation, and that the name        *\n * University of Delaware not be used in advertising or publicity      *\n * pertaining to distribution of the software without specific,\t       *\n * written prior permission. The University of Delaware makes no       *\n * representations about the suitability this software for any\t       *\n * purpose. It is provided \"as is\" without express or implied\t       *\n * warranty.\t\t\t\t\t\t\t       *\n *\t\t\t\t\t\t\t\t       *\n **********************************************************************/\n\n/*\n * Modification history timex.h\n *\n * 16 Aug 00\tDavid L. Mills\n *\tAPI Version 4. Added MOD_TAI and tai member of ntptimeval\n *\tstructure.\n *\n * 17 Nov 98\tDavid L. Mills\n *\tRevised for nanosecond kernel and user interface.\n *\n * 26 Sep 94\tDavid L. Mills\n *\tAdded defines for hybrid phase/frequency-lock loop.\n *\n * 19 Mar 94\tDavid L. Mills\n *\tMoved defines from kernel routines to header file and added new\n *\tdefines for PPS phase-lock loop.\n *\n * 20 Feb 94\tDavid L. Mills\n *\tRevised status codes and structures for external clock and PPS\n *\tsignal discipline.\n *\n * 28 Nov 93\tDavid L. Mills\n *\tAdjusted parameters to improve stability and increase poll\n *\tinterval.\n *\n * 17 Sep 93    David L. Mills\n *      Created file\n *\n * $FreeBSD: release/9.0.0/sys/sys/timex.h 139825 2005-01-07 02:29:27Z imp $\n */\n/*\n * This header file defines the Network Time Protocol (NTP) interfaces\n * for user and daemon application programs. These are implemented using\n * defined syscalls and data structures and require specific kernel\n * support.\n *\n * The original precision time kernels developed from 1993 have an\n * ultimate resolution of one microsecond; however, the most recent\n * kernels have an ultimate resolution of one nanosecond. In these\n * kernels, a ntp_adjtime() syscalls can be used to determine which\n * resolution is in use and to select either one at any time. The\n * resolution selected affects the scaling of certain fields in the\n * ntp_gettime() and ntp_adjtime() syscalls, as described below.\n *\n * NAME\n *\tntp_gettime - NTP user application interface\n *\n * SYNOPSIS\n *\t#include <sys/timex.h>\n *\n *\tint ntp_gettime(struct ntptimeval *ntv);\n *\n * DESCRIPTION\n *\tThe time returned by ntp_gettime() is in a timespec structure,\n *\tbut may be in either microsecond (seconds and microseconds) or\n *\tnanosecond (seconds and nanoseconds) format. The particular\n *\tformat in use is determined by the STA_NANO bit of the status\n *\tword returned by the ntp_adjtime() syscall.\n *\n * NAME\n *\tntp_adjtime - NTP daemon application interface\n *\n * SYNOPSIS\n *\t#include <sys/timex.h>\n *\t#include <sys/syscall.h>\n *\n *\tint syscall(SYS_ntp_adjtime, tptr);\n *\tint SYS_ntp_adjtime;\n *\tstruct timex *tptr;\n *\n * DESCRIPTION\n *\tCertain fields of the timex structure are interpreted in either\n *\tmicroseconds or nanoseconds according to the state of the\n *\tSTA_NANO bit in the status word. See the description below for\n *\tfurther information.\n */\n#ifndef _SYS_TIMEX_H_\n#define _SYS_TIMEX_H_ 1\n#define NTP_API\t\t4\t/* NTP API version */\n\n#ifndef MSDOS\t\t\t/* Microsoft specific */\n#include <sys/syscall.h>\n#endif /* MSDOS */\n\n/*\n * The following defines establish the performance envelope of the\n * kernel discipline loop. Phase or frequency errors greater than\n * NAXPHASE or MAXFREQ are clamped to these maxima. For update intervals\n * less than MINSEC, the loop always operates in PLL mode; while, for\n * update intervals greater than MAXSEC, the loop always operates in FLL\n * mode. Between these two limits the operating mode is selected by the\n * STA_FLL bit in the status word.\n */\n#define MAXPHASE\t500000000L /* max phase error (ns) */\n#define MAXFREQ\t\t500000L\t/* max freq error (ns/s) */\n#define MINSEC\t\t256\t/* min FLL update interval (s) */\n#define MAXSEC\t\t2048\t/* max PLL update interval (s) */\n#define NANOSECOND\t1000000000L /* nanoseconds in one second */\n#define SCALE_PPM\t(65536 / 1000) /* crude ns/s to scaled PPM */\n#define MAXTC\t\t10\t/* max time constant */\n\n/*\n * The following defines and structures define the user interface for\n * the ntp_gettime() and ntp_adjtime() syscalls.\n *\n * Control mode codes (timex.modes)\n */\n#define MOD_OFFSET\t0x0001\t/* set time offset */\n#define MOD_FREQUENCY\t0x0002\t/* set frequency offset */\n#define MOD_MAXERROR\t0x0004\t/* set maximum time error */\n#define MOD_ESTERROR\t0x0008\t/* set estimated time error */\n#define MOD_STATUS\t0x0010\t/* set clock status bits */\n#define MOD_TIMECONST\t0x0020\t/* set PLL time constant */\n#define MOD_PPSMAX\t0x0040\t/* set PPS maximum averaging time */\n#define MOD_TAI\t\t0x0080\t/* set TAI offset */\n#define\tMOD_MICRO\t0x1000\t/* select microsecond resolution */\n#define\tMOD_NANO\t0x2000\t/* select nanosecond resolution */\n#define MOD_CLKB\t0x4000\t/* select clock B */\n#define MOD_CLKA\t0x8000\t/* select clock A */\n\n/*\n * Status codes (timex.status)\n */\n#define STA_PLL\t\t0x0001\t/* enable PLL updates (rw) */\n#define STA_PPSFREQ\t0x0002\t/* enable PPS freq discipline (rw) */\n#define STA_PPSTIME\t0x0004\t/* enable PPS time discipline (rw) */\n#define STA_FLL\t\t0x0008\t/* enable FLL mode (rw) */\n#define STA_INS\t\t0x0010\t/* insert leap (rw) */\n#define STA_DEL\t\t0x0020\t/* delete leap (rw) */\n#define STA_UNSYNC\t0x0040\t/* clock unsynchronized (rw) */\n#define STA_FREQHOLD\t0x0080\t/* hold frequency (rw) */\n#define STA_PPSSIGNAL\t0x0100\t/* PPS signal present (ro) */\n#define STA_PPSJITTER\t0x0200\t/* PPS signal jitter exceeded (ro) */\n#define STA_PPSWANDER\t0x0400\t/* PPS signal wander exceeded (ro) */\n#define STA_PPSERROR\t0x0800\t/* PPS signal calibration error (ro) */\n#define STA_CLOCKERR\t0x1000\t/* clock hardware fault (ro) */\n#define STA_NANO\t0x2000\t/* resolution (0 = us, 1 = ns) (ro) */\n#define STA_MODE\t0x4000\t/* mode (0 = PLL, 1 = FLL) (ro) */\n#define STA_CLK\t\t0x8000\t/* clock source (0 = A, 1 = B) (ro) */\n\n#define STA_RONLY (STA_PPSSIGNAL | STA_PPSJITTER | STA_PPSWANDER | \\\n    STA_PPSERROR | STA_CLOCKERR | STA_NANO | STA_MODE | STA_CLK)\n\n/*\n * Clock states (time_state)\n */\n#define TIME_OK\t\t0\t/* no leap second warning */\n#define TIME_INS\t1\t/* insert leap second warning */\n#define TIME_DEL\t2\t/* delete leap second warning */\n#define TIME_OOP\t3\t/* leap second in progress */\n#define TIME_WAIT\t4\t/* leap second has occured */\n#define TIME_ERROR\t5\t/* error (see status word) */\n\n/*\n * NTP user interface (ntp_gettime()) - used to read kernel clock values\n *\n * Note: The time member is in microseconds if STA_NANO is zero and\n * nanoseconds if not.\n */\nstruct ntptimeval {\n\tstruct timespec time;\t/* current time (ns) (ro) */\n\tlong maxerror;\t\t/* maximum error (us) (ro) */\n\tlong esterror;\t\t/* estimated error (us) (ro) */\n\tlong tai;\t\t/* TAI offset */\n\tint time_state;\t\t/* time status */\n};\n\n/*\n * NTP daemon interface (ntp_adjtime()) - used to discipline CPU clock\n * oscillator and determine status.\n *\n * Note: The offset, precision and jitter members are in microseconds if\n * STA_NANO is zero and nanoseconds if not.\n */\nstruct timex {\n\tunsigned int modes;\t/* clock mode bits (wo) */\n\tlong\toffset;\t\t/* time offset (ns/us) (rw) */\n\tlong\tfreq;\t\t/* frequency offset (scaled PPM) (rw) */\n\tlong\tmaxerror;\t/* maximum error (us) (rw) */\n\tlong\testerror;\t/* estimated error (us) (rw) */\n\tint\tstatus;\t\t/* clock status bits (rw) */\n\tlong\tconstant;\t/* poll interval (log2 s) (rw) */\n\tlong\tprecision;\t/* clock precision (ns/us) (ro) */\n\tlong\ttolerance;\t/* clock frequency tolerance (scaled\n\t\t\t\t * PPM) (ro) */\n\t/*\n\t * The following read-only structure members are implemented\n\t * only if the PPS signal discipline is configured in the\n\t * kernel. They are included in all configurations to insure\n\t * portability.\n\t */\n\tlong\tppsfreq;\t/* PPS frequency (scaled PPM) (ro) */\n\tlong\tjitter;\t\t/* PPS jitter (ns/us) (ro) */\n\tint\tshift;\t\t/* interval duration (s) (shift) (ro) */\n\tlong\tstabil;\t\t/* PPS stability (scaled PPM) (ro) */\n\tlong\tjitcnt;\t\t/* jitter limit exceeded (ro) */\n\tlong\tcalcnt;\t\t/* calibration intervals (ro) */\n\tlong\terrcnt;\t\t/* calibration errors (ro) */\n\tlong\tstbcnt;\t\t/* stability limit exceeded (ro) */\n};\n\n#ifdef __FreeBSD__\n\n#ifdef _KERNEL\nvoid\tntp_update_second(int64_t *adjustment, time_t *newsec);\n#else /* !_KERNEL */\n#include <sys/cdefs.h>\n\n__BEGIN_DECLS\nint\tntp_adjtime(struct timex *);\nint\tntp_gettime(struct ntptimeval *);\n__END_DECLS\n#endif /* _KERNEL */\n\n#endif /* __FreeBSD__ */\n\n#endif /* !_SYS_TIMEX_H_ */\n"
  },
  {
    "path": "freebsd-headers/sys/tree.h",
    "content": "/*\t$NetBSD: tree.h,v 1.8 2004/03/28 19:38:30 provos Exp $\t*/\n/*\t$OpenBSD: tree.h,v 1.7 2002/10/17 21:51:54 art Exp $\t*/\n/* $FreeBSD: release/9.0.0/sys/sys/tree.h 189204 2009-03-01 04:57:23Z bms $ */\n\n/*-\n * Copyright 2002 Niels Provos <provos@citi.umich.edu>\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR\n * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES\n * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,\n * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF\n * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n */\n\n#ifndef\t_SYS_TREE_H_\n#define\t_SYS_TREE_H_\n\n#include <sys/cdefs.h>\n\n/*\n * This file defines data structures for different types of trees:\n * splay trees and red-black trees.\n *\n * A splay tree is a self-organizing data structure.  Every operation\n * on the tree causes a splay to happen.  The splay moves the requested\n * node to the root of the tree and partly rebalances it.\n *\n * This has the benefit that request locality causes faster lookups as\n * the requested nodes move to the top of the tree.  On the other hand,\n * every lookup causes memory writes.\n *\n * The Balance Theorem bounds the total access time for m operations\n * and n inserts on an initially empty tree as O((m + n)lg n).  The\n * amortized cost for a sequence of m accesses to a splay tree is O(lg n);\n *\n * A red-black tree is a binary search tree with the node color as an\n * extra attribute.  It fulfills a set of conditions:\n *\t- every search path from the root to a leaf consists of the\n *\t  same number of black nodes,\n *\t- each red node (except for the root) has a black parent,\n *\t- each leaf node is black.\n *\n * Every operation on a red-black tree is bounded as O(lg n).\n * The maximum height of a red-black tree is 2lg (n+1).\n */\n\n#define SPLAY_HEAD(name, type)\t\t\t\t\t\t\\\nstruct name {\t\t\t\t\t\t\t\t\\\n\tstruct type *sph_root; /* root of the tree */\t\t\t\\\n}\n\n#define SPLAY_INITIALIZER(root)\t\t\t\t\t\t\\\n\t{ NULL }\n\n#define SPLAY_INIT(root) do {\t\t\t\t\t\t\\\n\t(root)->sph_root = NULL;\t\t\t\t\t\\\n} while (/*CONSTCOND*/ 0)\n\n#define SPLAY_ENTRY(type)\t\t\t\t\t\t\\\nstruct {\t\t\t\t\t\t\t\t\\\n\tstruct type *spe_left; /* left element */\t\t\t\\\n\tstruct type *spe_right; /* right element */\t\t\t\\\n}\n\n#define SPLAY_LEFT(elm, field)\t\t(elm)->field.spe_left\n#define SPLAY_RIGHT(elm, field)\t\t(elm)->field.spe_right\n#define SPLAY_ROOT(head)\t\t(head)->sph_root\n#define SPLAY_EMPTY(head)\t\t(SPLAY_ROOT(head) == NULL)\n\n/* SPLAY_ROTATE_{LEFT,RIGHT} expect that tmp hold SPLAY_{RIGHT,LEFT} */\n#define SPLAY_ROTATE_RIGHT(head, tmp, field) do {\t\t\t\\\n\tSPLAY_LEFT((head)->sph_root, field) = SPLAY_RIGHT(tmp, field);\t\\\n\tSPLAY_RIGHT(tmp, field) = (head)->sph_root;\t\t\t\\\n\t(head)->sph_root = tmp;\t\t\t\t\t\t\\\n} while (/*CONSTCOND*/ 0)\n\t\n#define SPLAY_ROTATE_LEFT(head, tmp, field) do {\t\t\t\\\n\tSPLAY_RIGHT((head)->sph_root, field) = SPLAY_LEFT(tmp, field);\t\\\n\tSPLAY_LEFT(tmp, field) = (head)->sph_root;\t\t\t\\\n\t(head)->sph_root = tmp;\t\t\t\t\t\t\\\n} while (/*CONSTCOND*/ 0)\n\n#define SPLAY_LINKLEFT(head, tmp, field) do {\t\t\t\t\\\n\tSPLAY_LEFT(tmp, field) = (head)->sph_root;\t\t\t\\\n\ttmp = (head)->sph_root;\t\t\t\t\t\t\\\n\t(head)->sph_root = SPLAY_LEFT((head)->sph_root, field);\t\t\\\n} while (/*CONSTCOND*/ 0)\n\n#define SPLAY_LINKRIGHT(head, tmp, field) do {\t\t\t\t\\\n\tSPLAY_RIGHT(tmp, field) = (head)->sph_root;\t\t\t\\\n\ttmp = (head)->sph_root;\t\t\t\t\t\t\\\n\t(head)->sph_root = SPLAY_RIGHT((head)->sph_root, field);\t\\\n} while (/*CONSTCOND*/ 0)\n\n#define SPLAY_ASSEMBLE(head, node, left, right, field) do {\t\t\\\n\tSPLAY_RIGHT(left, field) = SPLAY_LEFT((head)->sph_root, field);\t\\\n\tSPLAY_LEFT(right, field) = SPLAY_RIGHT((head)->sph_root, field);\\\n\tSPLAY_LEFT((head)->sph_root, field) = SPLAY_RIGHT(node, field);\t\\\n\tSPLAY_RIGHT((head)->sph_root, field) = SPLAY_LEFT(node, field);\t\\\n} while (/*CONSTCOND*/ 0)\n\n/* Generates prototypes and inline functions */\n\n#define SPLAY_PROTOTYPE(name, type, field, cmp)\t\t\t\t\\\nvoid name##_SPLAY(struct name *, struct type *);\t\t\t\\\nvoid name##_SPLAY_MINMAX(struct name *, int);\t\t\t\t\\\nstruct type *name##_SPLAY_INSERT(struct name *, struct type *);\t\t\\\nstruct type *name##_SPLAY_REMOVE(struct name *, struct type *);\t\t\\\n\t\t\t\t\t\t\t\t\t\\\n/* Finds the node with the same key as elm */\t\t\t\t\\\nstatic __inline struct type *\t\t\t\t\t\t\\\nname##_SPLAY_FIND(struct name *head, struct type *elm)\t\t\t\\\n{\t\t\t\t\t\t\t\t\t\\\n\tif (SPLAY_EMPTY(head))\t\t\t\t\t\t\\\n\t\treturn(NULL);\t\t\t\t\t\t\\\n\tname##_SPLAY(head, elm);\t\t\t\t\t\\\n\tif ((cmp)(elm, (head)->sph_root) == 0)\t\t\t\t\\\n\t\treturn (head->sph_root);\t\t\t\t\\\n\treturn (NULL);\t\t\t\t\t\t\t\\\n}\t\t\t\t\t\t\t\t\t\\\n\t\t\t\t\t\t\t\t\t\\\nstatic __inline struct type *\t\t\t\t\t\t\\\nname##_SPLAY_NEXT(struct name *head, struct type *elm)\t\t\t\\\n{\t\t\t\t\t\t\t\t\t\\\n\tname##_SPLAY(head, elm);\t\t\t\t\t\\\n\tif (SPLAY_RIGHT(elm, field) != NULL) {\t\t\t\t\\\n\t\telm = SPLAY_RIGHT(elm, field);\t\t\t\t\\\n\t\twhile (SPLAY_LEFT(elm, field) != NULL) {\t\t\\\n\t\t\telm = SPLAY_LEFT(elm, field);\t\t\t\\\n\t\t}\t\t\t\t\t\t\t\\\n\t} else\t\t\t\t\t\t\t\t\\\n\t\telm = NULL;\t\t\t\t\t\t\\\n\treturn (elm);\t\t\t\t\t\t\t\\\n}\t\t\t\t\t\t\t\t\t\\\n\t\t\t\t\t\t\t\t\t\\\nstatic __inline struct type *\t\t\t\t\t\t\\\nname##_SPLAY_MIN_MAX(struct name *head, int val)\t\t\t\\\n{\t\t\t\t\t\t\t\t\t\\\n\tname##_SPLAY_MINMAX(head, val);\t\t\t\t\t\\\n        return (SPLAY_ROOT(head));\t\t\t\t\t\\\n}\n\n/* Main splay operation.\n * Moves node close to the key of elm to top\n */\n#define SPLAY_GENERATE(name, type, field, cmp)\t\t\t\t\\\nstruct type *\t\t\t\t\t\t\t\t\\\nname##_SPLAY_INSERT(struct name *head, struct type *elm)\t\t\\\n{\t\t\t\t\t\t\t\t\t\\\n    if (SPLAY_EMPTY(head)) {\t\t\t\t\t\t\\\n\t    SPLAY_LEFT(elm, field) = SPLAY_RIGHT(elm, field) = NULL;\t\\\n    } else {\t\t\t\t\t\t\t\t\\\n\t    int __comp;\t\t\t\t\t\t\t\\\n\t    name##_SPLAY(head, elm);\t\t\t\t\t\\\n\t    __comp = (cmp)(elm, (head)->sph_root);\t\t\t\\\n\t    if(__comp < 0) {\t\t\t\t\t\t\\\n\t\t    SPLAY_LEFT(elm, field) = SPLAY_LEFT((head)->sph_root, field);\\\n\t\t    SPLAY_RIGHT(elm, field) = (head)->sph_root;\t\t\\\n\t\t    SPLAY_LEFT((head)->sph_root, field) = NULL;\t\t\\\n\t    } else if (__comp > 0) {\t\t\t\t\t\\\n\t\t    SPLAY_RIGHT(elm, field) = SPLAY_RIGHT((head)->sph_root, field);\\\n\t\t    SPLAY_LEFT(elm, field) = (head)->sph_root;\t\t\\\n\t\t    SPLAY_RIGHT((head)->sph_root, field) = NULL;\t\\\n\t    } else\t\t\t\t\t\t\t\\\n\t\t    return ((head)->sph_root);\t\t\t\t\\\n    }\t\t\t\t\t\t\t\t\t\\\n    (head)->sph_root = (elm);\t\t\t\t\t\t\\\n    return (NULL);\t\t\t\t\t\t\t\\\n}\t\t\t\t\t\t\t\t\t\\\n\t\t\t\t\t\t\t\t\t\\\nstruct type *\t\t\t\t\t\t\t\t\\\nname##_SPLAY_REMOVE(struct name *head, struct type *elm)\t\t\\\n{\t\t\t\t\t\t\t\t\t\\\n\tstruct type *__tmp;\t\t\t\t\t\t\\\n\tif (SPLAY_EMPTY(head))\t\t\t\t\t\t\\\n\t\treturn (NULL);\t\t\t\t\t\t\\\n\tname##_SPLAY(head, elm);\t\t\t\t\t\\\n\tif ((cmp)(elm, (head)->sph_root) == 0) {\t\t\t\\\n\t\tif (SPLAY_LEFT((head)->sph_root, field) == NULL) {\t\\\n\t\t\t(head)->sph_root = SPLAY_RIGHT((head)->sph_root, field);\\\n\t\t} else {\t\t\t\t\t\t\\\n\t\t\t__tmp = SPLAY_RIGHT((head)->sph_root, field);\t\\\n\t\t\t(head)->sph_root = SPLAY_LEFT((head)->sph_root, field);\\\n\t\t\tname##_SPLAY(head, elm);\t\t\t\\\n\t\t\tSPLAY_RIGHT((head)->sph_root, field) = __tmp;\t\\\n\t\t}\t\t\t\t\t\t\t\\\n\t\treturn (elm);\t\t\t\t\t\t\\\n\t}\t\t\t\t\t\t\t\t\\\n\treturn (NULL);\t\t\t\t\t\t\t\\\n}\t\t\t\t\t\t\t\t\t\\\n\t\t\t\t\t\t\t\t\t\\\nvoid\t\t\t\t\t\t\t\t\t\\\nname##_SPLAY(struct name *head, struct type *elm)\t\t\t\\\n{\t\t\t\t\t\t\t\t\t\\\n\tstruct type __node, *__left, *__right, *__tmp;\t\t\t\\\n\tint __comp;\t\t\t\t\t\t\t\\\n\\\n\tSPLAY_LEFT(&__node, field) = SPLAY_RIGHT(&__node, field) = NULL;\\\n\t__left = __right = &__node;\t\t\t\t\t\\\n\\\n\twhile ((__comp = (cmp)(elm, (head)->sph_root)) != 0) {\t\t\\\n\t\tif (__comp < 0) {\t\t\t\t\t\\\n\t\t\t__tmp = SPLAY_LEFT((head)->sph_root, field);\t\\\n\t\t\tif (__tmp == NULL)\t\t\t\t\\\n\t\t\t\tbreak;\t\t\t\t\t\\\n\t\t\tif ((cmp)(elm, __tmp) < 0){\t\t\t\\\n\t\t\t\tSPLAY_ROTATE_RIGHT(head, __tmp, field);\t\\\n\t\t\t\tif (SPLAY_LEFT((head)->sph_root, field) == NULL)\\\n\t\t\t\t\tbreak;\t\t\t\t\\\n\t\t\t}\t\t\t\t\t\t\\\n\t\t\tSPLAY_LINKLEFT(head, __right, field);\t\t\\\n\t\t} else if (__comp > 0) {\t\t\t\t\\\n\t\t\t__tmp = SPLAY_RIGHT((head)->sph_root, field);\t\\\n\t\t\tif (__tmp == NULL)\t\t\t\t\\\n\t\t\t\tbreak;\t\t\t\t\t\\\n\t\t\tif ((cmp)(elm, __tmp) > 0){\t\t\t\\\n\t\t\t\tSPLAY_ROTATE_LEFT(head, __tmp, field);\t\\\n\t\t\t\tif (SPLAY_RIGHT((head)->sph_root, field) == NULL)\\\n\t\t\t\t\tbreak;\t\t\t\t\\\n\t\t\t}\t\t\t\t\t\t\\\n\t\t\tSPLAY_LINKRIGHT(head, __left, field);\t\t\\\n\t\t}\t\t\t\t\t\t\t\\\n\t}\t\t\t\t\t\t\t\t\\\n\tSPLAY_ASSEMBLE(head, &__node, __left, __right, field);\t\t\\\n}\t\t\t\t\t\t\t\t\t\\\n\t\t\t\t\t\t\t\t\t\\\n/* Splay with either the minimum or the maximum element\t\t\t\\\n * Used to find minimum or maximum element in tree.\t\t\t\\\n */\t\t\t\t\t\t\t\t\t\\\nvoid name##_SPLAY_MINMAX(struct name *head, int __comp) \\\n{\t\t\t\t\t\t\t\t\t\\\n\tstruct type __node, *__left, *__right, *__tmp;\t\t\t\\\n\\\n\tSPLAY_LEFT(&__node, field) = SPLAY_RIGHT(&__node, field) = NULL;\\\n\t__left = __right = &__node;\t\t\t\t\t\\\n\\\n\twhile (1) {\t\t\t\t\t\t\t\\\n\t\tif (__comp < 0) {\t\t\t\t\t\\\n\t\t\t__tmp = SPLAY_LEFT((head)->sph_root, field);\t\\\n\t\t\tif (__tmp == NULL)\t\t\t\t\\\n\t\t\t\tbreak;\t\t\t\t\t\\\n\t\t\tif (__comp < 0){\t\t\t\t\\\n\t\t\t\tSPLAY_ROTATE_RIGHT(head, __tmp, field);\t\\\n\t\t\t\tif (SPLAY_LEFT((head)->sph_root, field) == NULL)\\\n\t\t\t\t\tbreak;\t\t\t\t\\\n\t\t\t}\t\t\t\t\t\t\\\n\t\t\tSPLAY_LINKLEFT(head, __right, field);\t\t\\\n\t\t} else if (__comp > 0) {\t\t\t\t\\\n\t\t\t__tmp = SPLAY_RIGHT((head)->sph_root, field);\t\\\n\t\t\tif (__tmp == NULL)\t\t\t\t\\\n\t\t\t\tbreak;\t\t\t\t\t\\\n\t\t\tif (__comp > 0) {\t\t\t\t\\\n\t\t\t\tSPLAY_ROTATE_LEFT(head, __tmp, field);\t\\\n\t\t\t\tif (SPLAY_RIGHT((head)->sph_root, field) == NULL)\\\n\t\t\t\t\tbreak;\t\t\t\t\\\n\t\t\t}\t\t\t\t\t\t\\\n\t\t\tSPLAY_LINKRIGHT(head, __left, field);\t\t\\\n\t\t}\t\t\t\t\t\t\t\\\n\t}\t\t\t\t\t\t\t\t\\\n\tSPLAY_ASSEMBLE(head, &__node, __left, __right, field);\t\t\\\n}\n\n#define SPLAY_NEGINF\t-1\n#define SPLAY_INF\t1\n\n#define SPLAY_INSERT(name, x, y)\tname##_SPLAY_INSERT(x, y)\n#define SPLAY_REMOVE(name, x, y)\tname##_SPLAY_REMOVE(x, y)\n#define SPLAY_FIND(name, x, y)\t\tname##_SPLAY_FIND(x, y)\n#define SPLAY_NEXT(name, x, y)\t\tname##_SPLAY_NEXT(x, y)\n#define SPLAY_MIN(name, x)\t\t(SPLAY_EMPTY(x) ? NULL\t\\\n\t\t\t\t\t: name##_SPLAY_MIN_MAX(x, SPLAY_NEGINF))\n#define SPLAY_MAX(name, x)\t\t(SPLAY_EMPTY(x) ? NULL\t\\\n\t\t\t\t\t: name##_SPLAY_MIN_MAX(x, SPLAY_INF))\n\n#define SPLAY_FOREACH(x, name, head)\t\t\t\t\t\\\n\tfor ((x) = SPLAY_MIN(name, head);\t\t\t\t\\\n\t     (x) != NULL;\t\t\t\t\t\t\\\n\t     (x) = SPLAY_NEXT(name, head, x))\n\n/* Macros that define a red-black tree */\n#define RB_HEAD(name, type)\t\t\t\t\t\t\\\nstruct name {\t\t\t\t\t\t\t\t\\\n\tstruct type *rbh_root; /* root of the tree */\t\t\t\\\n}\n\n#define RB_INITIALIZER(root)\t\t\t\t\t\t\\\n\t{ NULL }\n\n#define RB_INIT(root) do {\t\t\t\t\t\t\\\n\t(root)->rbh_root = NULL;\t\t\t\t\t\\\n} while (/*CONSTCOND*/ 0)\n\n#define RB_BLACK\t0\n#define RB_RED\t\t1\n#define RB_ENTRY(type)\t\t\t\t\t\t\t\\\nstruct {\t\t\t\t\t\t\t\t\\\n\tstruct type *rbe_left;\t\t/* left element */\t\t\\\n\tstruct type *rbe_right;\t\t/* right element */\t\t\\\n\tstruct type *rbe_parent;\t/* parent element */\t\t\\\n\tint rbe_color;\t\t\t/* node color */\t\t\\\n}\n\n#define RB_LEFT(elm, field)\t\t(elm)->field.rbe_left\n#define RB_RIGHT(elm, field)\t\t(elm)->field.rbe_right\n#define RB_PARENT(elm, field)\t\t(elm)->field.rbe_parent\n#define RB_COLOR(elm, field)\t\t(elm)->field.rbe_color\n#define RB_ROOT(head)\t\t\t(head)->rbh_root\n#define RB_EMPTY(head)\t\t\t(RB_ROOT(head) == NULL)\n\n#define RB_SET(elm, parent, field) do {\t\t\t\t\t\\\n\tRB_PARENT(elm, field) = parent;\t\t\t\t\t\\\n\tRB_LEFT(elm, field) = RB_RIGHT(elm, field) = NULL;\t\t\\\n\tRB_COLOR(elm, field) = RB_RED;\t\t\t\t\t\\\n} while (/*CONSTCOND*/ 0)\n\n#define RB_SET_BLACKRED(black, red, field) do {\t\t\t\t\\\n\tRB_COLOR(black, field) = RB_BLACK;\t\t\t\t\\\n\tRB_COLOR(red, field) = RB_RED;\t\t\t\t\t\\\n} while (/*CONSTCOND*/ 0)\n\n#ifndef RB_AUGMENT\n#define RB_AUGMENT(x)\tdo {} while (0)\n#endif\n\n#define RB_ROTATE_LEFT(head, elm, tmp, field) do {\t\t\t\\\n\t(tmp) = RB_RIGHT(elm, field);\t\t\t\t\t\\\n\tif ((RB_RIGHT(elm, field) = RB_LEFT(tmp, field)) != NULL) {\t\\\n\t\tRB_PARENT(RB_LEFT(tmp, field), field) = (elm);\t\t\\\n\t}\t\t\t\t\t\t\t\t\\\n\tRB_AUGMENT(elm);\t\t\t\t\t\t\\\n\tif ((RB_PARENT(tmp, field) = RB_PARENT(elm, field)) != NULL) {\t\\\n\t\tif ((elm) == RB_LEFT(RB_PARENT(elm, field), field))\t\\\n\t\t\tRB_LEFT(RB_PARENT(elm, field), field) = (tmp);\t\\\n\t\telse\t\t\t\t\t\t\t\\\n\t\t\tRB_RIGHT(RB_PARENT(elm, field), field) = (tmp);\t\\\n\t} else\t\t\t\t\t\t\t\t\\\n\t\t(head)->rbh_root = (tmp);\t\t\t\t\\\n\tRB_LEFT(tmp, field) = (elm);\t\t\t\t\t\\\n\tRB_PARENT(elm, field) = (tmp);\t\t\t\t\t\\\n\tRB_AUGMENT(tmp);\t\t\t\t\t\t\\\n\tif ((RB_PARENT(tmp, field)))\t\t\t\t\t\\\n\t\tRB_AUGMENT(RB_PARENT(tmp, field));\t\t\t\\\n} while (/*CONSTCOND*/ 0)\n\n#define RB_ROTATE_RIGHT(head, elm, tmp, field) do {\t\t\t\\\n\t(tmp) = RB_LEFT(elm, field);\t\t\t\t\t\\\n\tif ((RB_LEFT(elm, field) = RB_RIGHT(tmp, field)) != NULL) {\t\\\n\t\tRB_PARENT(RB_RIGHT(tmp, field), field) = (elm);\t\t\\\n\t}\t\t\t\t\t\t\t\t\\\n\tRB_AUGMENT(elm);\t\t\t\t\t\t\\\n\tif ((RB_PARENT(tmp, field) = RB_PARENT(elm, field)) != NULL) {\t\\\n\t\tif ((elm) == RB_LEFT(RB_PARENT(elm, field), field))\t\\\n\t\t\tRB_LEFT(RB_PARENT(elm, field), field) = (tmp);\t\\\n\t\telse\t\t\t\t\t\t\t\\\n\t\t\tRB_RIGHT(RB_PARENT(elm, field), field) = (tmp);\t\\\n\t} else\t\t\t\t\t\t\t\t\\\n\t\t(head)->rbh_root = (tmp);\t\t\t\t\\\n\tRB_RIGHT(tmp, field) = (elm);\t\t\t\t\t\\\n\tRB_PARENT(elm, field) = (tmp);\t\t\t\t\t\\\n\tRB_AUGMENT(tmp);\t\t\t\t\t\t\\\n\tif ((RB_PARENT(tmp, field)))\t\t\t\t\t\\\n\t\tRB_AUGMENT(RB_PARENT(tmp, field));\t\t\t\\\n} while (/*CONSTCOND*/ 0)\n\n/* Generates prototypes and inline functions */\n#define\tRB_PROTOTYPE(name, type, field, cmp)\t\t\t\t\\\n\tRB_PROTOTYPE_INTERNAL(name, type, field, cmp,)\n#define\tRB_PROTOTYPE_STATIC(name, type, field, cmp)\t\t\t\\\n\tRB_PROTOTYPE_INTERNAL(name, type, field, cmp, __unused static)\n#define RB_PROTOTYPE_INTERNAL(name, type, field, cmp, attr)\t\t\\\nattr void name##_RB_INSERT_COLOR(struct name *, struct type *);\t\t\\\nattr void name##_RB_REMOVE_COLOR(struct name *, struct type *, struct type *);\\\nattr struct type *name##_RB_REMOVE(struct name *, struct type *);\t\\\nattr struct type *name##_RB_INSERT(struct name *, struct type *);\t\\\nattr struct type *name##_RB_FIND(struct name *, struct type *);\t\t\\\nattr struct type *name##_RB_NFIND(struct name *, struct type *);\t\\\nattr struct type *name##_RB_NEXT(struct type *);\t\t\t\\\nattr struct type *name##_RB_PREV(struct type *);\t\t\t\\\nattr struct type *name##_RB_MINMAX(struct name *, int);\t\t\t\\\n\t\t\t\t\t\t\t\t\t\\\n\n/* Main rb operation.\n * Moves node close to the key of elm to top\n */\n#define\tRB_GENERATE(name, type, field, cmp)\t\t\t\t\\\n\tRB_GENERATE_INTERNAL(name, type, field, cmp,)\n#define\tRB_GENERATE_STATIC(name, type, field, cmp)\t\t\t\\\n\tRB_GENERATE_INTERNAL(name, type, field, cmp, __unused static)\n#define RB_GENERATE_INTERNAL(name, type, field, cmp, attr)\t\t\\\nattr void\t\t\t\t\t\t\t\t\\\nname##_RB_INSERT_COLOR(struct name *head, struct type *elm)\t\t\\\n{\t\t\t\t\t\t\t\t\t\\\n\tstruct type *parent, *gparent, *tmp;\t\t\t\t\\\n\twhile ((parent = RB_PARENT(elm, field)) != NULL &&\t\t\\\n\t    RB_COLOR(parent, field) == RB_RED) {\t\t\t\\\n\t\tgparent = RB_PARENT(parent, field);\t\t\t\\\n\t\tif (parent == RB_LEFT(gparent, field)) {\t\t\\\n\t\t\ttmp = RB_RIGHT(gparent, field);\t\t\t\\\n\t\t\tif (tmp && RB_COLOR(tmp, field) == RB_RED) {\t\\\n\t\t\t\tRB_COLOR(tmp, field) = RB_BLACK;\t\\\n\t\t\t\tRB_SET_BLACKRED(parent, gparent, field);\\\n\t\t\t\telm = gparent;\t\t\t\t\\\n\t\t\t\tcontinue;\t\t\t\t\\\n\t\t\t}\t\t\t\t\t\t\\\n\t\t\tif (RB_RIGHT(parent, field) == elm) {\t\t\\\n\t\t\t\tRB_ROTATE_LEFT(head, parent, tmp, field);\\\n\t\t\t\ttmp = parent;\t\t\t\t\\\n\t\t\t\tparent = elm;\t\t\t\t\\\n\t\t\t\telm = tmp;\t\t\t\t\\\n\t\t\t}\t\t\t\t\t\t\\\n\t\t\tRB_SET_BLACKRED(parent, gparent, field);\t\\\n\t\t\tRB_ROTATE_RIGHT(head, gparent, tmp, field);\t\\\n\t\t} else {\t\t\t\t\t\t\\\n\t\t\ttmp = RB_LEFT(gparent, field);\t\t\t\\\n\t\t\tif (tmp && RB_COLOR(tmp, field) == RB_RED) {\t\\\n\t\t\t\tRB_COLOR(tmp, field) = RB_BLACK;\t\\\n\t\t\t\tRB_SET_BLACKRED(parent, gparent, field);\\\n\t\t\t\telm = gparent;\t\t\t\t\\\n\t\t\t\tcontinue;\t\t\t\t\\\n\t\t\t}\t\t\t\t\t\t\\\n\t\t\tif (RB_LEFT(parent, field) == elm) {\t\t\\\n\t\t\t\tRB_ROTATE_RIGHT(head, parent, tmp, field);\\\n\t\t\t\ttmp = parent;\t\t\t\t\\\n\t\t\t\tparent = elm;\t\t\t\t\\\n\t\t\t\telm = tmp;\t\t\t\t\\\n\t\t\t}\t\t\t\t\t\t\\\n\t\t\tRB_SET_BLACKRED(parent, gparent, field);\t\\\n\t\t\tRB_ROTATE_LEFT(head, gparent, tmp, field);\t\\\n\t\t}\t\t\t\t\t\t\t\\\n\t}\t\t\t\t\t\t\t\t\\\n\tRB_COLOR(head->rbh_root, field) = RB_BLACK;\t\t\t\\\n}\t\t\t\t\t\t\t\t\t\\\n\t\t\t\t\t\t\t\t\t\\\nattr void\t\t\t\t\t\t\t\t\\\nname##_RB_REMOVE_COLOR(struct name *head, struct type *parent, struct type *elm) \\\n{\t\t\t\t\t\t\t\t\t\\\n\tstruct type *tmp;\t\t\t\t\t\t\\\n\twhile ((elm == NULL || RB_COLOR(elm, field) == RB_BLACK) &&\t\\\n\t    elm != RB_ROOT(head)) {\t\t\t\t\t\\\n\t\tif (RB_LEFT(parent, field) == elm) {\t\t\t\\\n\t\t\ttmp = RB_RIGHT(parent, field);\t\t\t\\\n\t\t\tif (RB_COLOR(tmp, field) == RB_RED) {\t\t\\\n\t\t\t\tRB_SET_BLACKRED(tmp, parent, field);\t\\\n\t\t\t\tRB_ROTATE_LEFT(head, parent, tmp, field);\\\n\t\t\t\ttmp = RB_RIGHT(parent, field);\t\t\\\n\t\t\t}\t\t\t\t\t\t\\\n\t\t\tif ((RB_LEFT(tmp, field) == NULL ||\t\t\\\n\t\t\t    RB_COLOR(RB_LEFT(tmp, field), field) == RB_BLACK) &&\\\n\t\t\t    (RB_RIGHT(tmp, field) == NULL ||\t\t\\\n\t\t\t    RB_COLOR(RB_RIGHT(tmp, field), field) == RB_BLACK)) {\\\n\t\t\t\tRB_COLOR(tmp, field) = RB_RED;\t\t\\\n\t\t\t\telm = parent;\t\t\t\t\\\n\t\t\t\tparent = RB_PARENT(elm, field);\t\t\\\n\t\t\t} else {\t\t\t\t\t\\\n\t\t\t\tif (RB_RIGHT(tmp, field) == NULL ||\t\\\n\t\t\t\t    RB_COLOR(RB_RIGHT(tmp, field), field) == RB_BLACK) {\\\n\t\t\t\t\tstruct type *oleft;\t\t\\\n\t\t\t\t\tif ((oleft = RB_LEFT(tmp, field)) \\\n\t\t\t\t\t    != NULL)\t\t\t\\\n\t\t\t\t\t\tRB_COLOR(oleft, field) = RB_BLACK;\\\n\t\t\t\t\tRB_COLOR(tmp, field) = RB_RED;\t\\\n\t\t\t\t\tRB_ROTATE_RIGHT(head, tmp, oleft, field);\\\n\t\t\t\t\ttmp = RB_RIGHT(parent, field);\t\\\n\t\t\t\t}\t\t\t\t\t\\\n\t\t\t\tRB_COLOR(tmp, field) = RB_COLOR(parent, field);\\\n\t\t\t\tRB_COLOR(parent, field) = RB_BLACK;\t\\\n\t\t\t\tif (RB_RIGHT(tmp, field))\t\t\\\n\t\t\t\t\tRB_COLOR(RB_RIGHT(tmp, field), field) = RB_BLACK;\\\n\t\t\t\tRB_ROTATE_LEFT(head, parent, tmp, field);\\\n\t\t\t\telm = RB_ROOT(head);\t\t\t\\\n\t\t\t\tbreak;\t\t\t\t\t\\\n\t\t\t}\t\t\t\t\t\t\\\n\t\t} else {\t\t\t\t\t\t\\\n\t\t\ttmp = RB_LEFT(parent, field);\t\t\t\\\n\t\t\tif (RB_COLOR(tmp, field) == RB_RED) {\t\t\\\n\t\t\t\tRB_SET_BLACKRED(tmp, parent, field);\t\\\n\t\t\t\tRB_ROTATE_RIGHT(head, parent, tmp, field);\\\n\t\t\t\ttmp = RB_LEFT(parent, field);\t\t\\\n\t\t\t}\t\t\t\t\t\t\\\n\t\t\tif ((RB_LEFT(tmp, field) == NULL ||\t\t\\\n\t\t\t    RB_COLOR(RB_LEFT(tmp, field), field) == RB_BLACK) &&\\\n\t\t\t    (RB_RIGHT(tmp, field) == NULL ||\t\t\\\n\t\t\t    RB_COLOR(RB_RIGHT(tmp, field), field) == RB_BLACK)) {\\\n\t\t\t\tRB_COLOR(tmp, field) = RB_RED;\t\t\\\n\t\t\t\telm = parent;\t\t\t\t\\\n\t\t\t\tparent = RB_PARENT(elm, field);\t\t\\\n\t\t\t} else {\t\t\t\t\t\\\n\t\t\t\tif (RB_LEFT(tmp, field) == NULL ||\t\\\n\t\t\t\t    RB_COLOR(RB_LEFT(tmp, field), field) == RB_BLACK) {\\\n\t\t\t\t\tstruct type *oright;\t\t\\\n\t\t\t\t\tif ((oright = RB_RIGHT(tmp, field)) \\\n\t\t\t\t\t    != NULL)\t\t\t\\\n\t\t\t\t\t\tRB_COLOR(oright, field) = RB_BLACK;\\\n\t\t\t\t\tRB_COLOR(tmp, field) = RB_RED;\t\\\n\t\t\t\t\tRB_ROTATE_LEFT(head, tmp, oright, field);\\\n\t\t\t\t\ttmp = RB_LEFT(parent, field);\t\\\n\t\t\t\t}\t\t\t\t\t\\\n\t\t\t\tRB_COLOR(tmp, field) = RB_COLOR(parent, field);\\\n\t\t\t\tRB_COLOR(parent, field) = RB_BLACK;\t\\\n\t\t\t\tif (RB_LEFT(tmp, field))\t\t\\\n\t\t\t\t\tRB_COLOR(RB_LEFT(tmp, field), field) = RB_BLACK;\\\n\t\t\t\tRB_ROTATE_RIGHT(head, parent, tmp, field);\\\n\t\t\t\telm = RB_ROOT(head);\t\t\t\\\n\t\t\t\tbreak;\t\t\t\t\t\\\n\t\t\t}\t\t\t\t\t\t\\\n\t\t}\t\t\t\t\t\t\t\\\n\t}\t\t\t\t\t\t\t\t\\\n\tif (elm)\t\t\t\t\t\t\t\\\n\t\tRB_COLOR(elm, field) = RB_BLACK;\t\t\t\\\n}\t\t\t\t\t\t\t\t\t\\\n\t\t\t\t\t\t\t\t\t\\\nattr struct type *\t\t\t\t\t\t\t\\\nname##_RB_REMOVE(struct name *head, struct type *elm)\t\t\t\\\n{\t\t\t\t\t\t\t\t\t\\\n\tstruct type *child, *parent, *old = elm;\t\t\t\\\n\tint color;\t\t\t\t\t\t\t\\\n\tif (RB_LEFT(elm, field) == NULL)\t\t\t\t\\\n\t\tchild = RB_RIGHT(elm, field);\t\t\t\t\\\n\telse if (RB_RIGHT(elm, field) == NULL)\t\t\t\t\\\n\t\tchild = RB_LEFT(elm, field);\t\t\t\t\\\n\telse {\t\t\t\t\t\t\t\t\\\n\t\tstruct type *left;\t\t\t\t\t\\\n\t\telm = RB_RIGHT(elm, field);\t\t\t\t\\\n\t\twhile ((left = RB_LEFT(elm, field)) != NULL)\t\t\\\n\t\t\telm = left;\t\t\t\t\t\\\n\t\tchild = RB_RIGHT(elm, field);\t\t\t\t\\\n\t\tparent = RB_PARENT(elm, field);\t\t\t\t\\\n\t\tcolor = RB_COLOR(elm, field);\t\t\t\t\\\n\t\tif (child)\t\t\t\t\t\t\\\n\t\t\tRB_PARENT(child, field) = parent;\t\t\\\n\t\tif (parent) {\t\t\t\t\t\t\\\n\t\t\tif (RB_LEFT(parent, field) == elm)\t\t\\\n\t\t\t\tRB_LEFT(parent, field) = child;\t\t\\\n\t\t\telse\t\t\t\t\t\t\\\n\t\t\t\tRB_RIGHT(parent, field) = child;\t\\\n\t\t\tRB_AUGMENT(parent);\t\t\t\t\\\n\t\t} else\t\t\t\t\t\t\t\\\n\t\t\tRB_ROOT(head) = child;\t\t\t\t\\\n\t\tif (RB_PARENT(elm, field) == old)\t\t\t\\\n\t\t\tparent = elm;\t\t\t\t\t\\\n\t\t(elm)->field = (old)->field;\t\t\t\t\\\n\t\tif (RB_PARENT(old, field)) {\t\t\t\t\\\n\t\t\tif (RB_LEFT(RB_PARENT(old, field), field) == old)\\\n\t\t\t\tRB_LEFT(RB_PARENT(old, field), field) = elm;\\\n\t\t\telse\t\t\t\t\t\t\\\n\t\t\t\tRB_RIGHT(RB_PARENT(old, field), field) = elm;\\\n\t\t\tRB_AUGMENT(RB_PARENT(old, field));\t\t\\\n\t\t} else\t\t\t\t\t\t\t\\\n\t\t\tRB_ROOT(head) = elm;\t\t\t\t\\\n\t\tRB_PARENT(RB_LEFT(old, field), field) = elm;\t\t\\\n\t\tif (RB_RIGHT(old, field))\t\t\t\t\\\n\t\t\tRB_PARENT(RB_RIGHT(old, field), field) = elm;\t\\\n\t\tif (parent) {\t\t\t\t\t\t\\\n\t\t\tleft = parent;\t\t\t\t\t\\\n\t\t\tdo {\t\t\t\t\t\t\\\n\t\t\t\tRB_AUGMENT(left);\t\t\t\\\n\t\t\t} while ((left = RB_PARENT(left, field)) != NULL); \\\n\t\t}\t\t\t\t\t\t\t\\\n\t\tgoto color;\t\t\t\t\t\t\\\n\t}\t\t\t\t\t\t\t\t\\\n\tparent = RB_PARENT(elm, field);\t\t\t\t\t\\\n\tcolor = RB_COLOR(elm, field);\t\t\t\t\t\\\n\tif (child)\t\t\t\t\t\t\t\\\n\t\tRB_PARENT(child, field) = parent;\t\t\t\\\n\tif (parent) {\t\t\t\t\t\t\t\\\n\t\tif (RB_LEFT(parent, field) == elm)\t\t\t\\\n\t\t\tRB_LEFT(parent, field) = child;\t\t\t\\\n\t\telse\t\t\t\t\t\t\t\\\n\t\t\tRB_RIGHT(parent, field) = child;\t\t\\\n\t\tRB_AUGMENT(parent);\t\t\t\t\t\\\n\t} else\t\t\t\t\t\t\t\t\\\n\t\tRB_ROOT(head) = child;\t\t\t\t\t\\\ncolor:\t\t\t\t\t\t\t\t\t\\\n\tif (color == RB_BLACK)\t\t\t\t\t\t\\\n\t\tname##_RB_REMOVE_COLOR(head, parent, child);\t\t\\\n\treturn (old);\t\t\t\t\t\t\t\\\n}\t\t\t\t\t\t\t\t\t\\\n\t\t\t\t\t\t\t\t\t\\\n/* Inserts a node into the RB tree */\t\t\t\t\t\\\nattr struct type *\t\t\t\t\t\t\t\\\nname##_RB_INSERT(struct name *head, struct type *elm)\t\t\t\\\n{\t\t\t\t\t\t\t\t\t\\\n\tstruct type *tmp;\t\t\t\t\t\t\\\n\tstruct type *parent = NULL;\t\t\t\t\t\\\n\tint comp = 0;\t\t\t\t\t\t\t\\\n\ttmp = RB_ROOT(head);\t\t\t\t\t\t\\\n\twhile (tmp) {\t\t\t\t\t\t\t\\\n\t\tparent = tmp;\t\t\t\t\t\t\\\n\t\tcomp = (cmp)(elm, parent);\t\t\t\t\\\n\t\tif (comp < 0)\t\t\t\t\t\t\\\n\t\t\ttmp = RB_LEFT(tmp, field);\t\t\t\\\n\t\telse if (comp > 0)\t\t\t\t\t\\\n\t\t\ttmp = RB_RIGHT(tmp, field);\t\t\t\\\n\t\telse\t\t\t\t\t\t\t\\\n\t\t\treturn (tmp);\t\t\t\t\t\\\n\t}\t\t\t\t\t\t\t\t\\\n\tRB_SET(elm, parent, field);\t\t\t\t\t\\\n\tif (parent != NULL) {\t\t\t\t\t\t\\\n\t\tif (comp < 0)\t\t\t\t\t\t\\\n\t\t\tRB_LEFT(parent, field) = elm;\t\t\t\\\n\t\telse\t\t\t\t\t\t\t\\\n\t\t\tRB_RIGHT(parent, field) = elm;\t\t\t\\\n\t\tRB_AUGMENT(parent);\t\t\t\t\t\\\n\t} else\t\t\t\t\t\t\t\t\\\n\t\tRB_ROOT(head) = elm;\t\t\t\t\t\\\n\tname##_RB_INSERT_COLOR(head, elm);\t\t\t\t\\\n\treturn (NULL);\t\t\t\t\t\t\t\\\n}\t\t\t\t\t\t\t\t\t\\\n\t\t\t\t\t\t\t\t\t\\\n/* Finds the node with the same key as elm */\t\t\t\t\\\nattr struct type *\t\t\t\t\t\t\t\\\nname##_RB_FIND(struct name *head, struct type *elm)\t\t\t\\\n{\t\t\t\t\t\t\t\t\t\\\n\tstruct type *tmp = RB_ROOT(head);\t\t\t\t\\\n\tint comp;\t\t\t\t\t\t\t\\\n\twhile (tmp) {\t\t\t\t\t\t\t\\\n\t\tcomp = cmp(elm, tmp);\t\t\t\t\t\\\n\t\tif (comp < 0)\t\t\t\t\t\t\\\n\t\t\ttmp = RB_LEFT(tmp, field);\t\t\t\\\n\t\telse if (comp > 0)\t\t\t\t\t\\\n\t\t\ttmp = RB_RIGHT(tmp, field);\t\t\t\\\n\t\telse\t\t\t\t\t\t\t\\\n\t\t\treturn (tmp);\t\t\t\t\t\\\n\t}\t\t\t\t\t\t\t\t\\\n\treturn (NULL);\t\t\t\t\t\t\t\\\n}\t\t\t\t\t\t\t\t\t\\\n\t\t\t\t\t\t\t\t\t\\\n/* Finds the first node greater than or equal to the search key */\t\\\nattr struct type *\t\t\t\t\t\t\t\\\nname##_RB_NFIND(struct name *head, struct type *elm)\t\t\t\\\n{\t\t\t\t\t\t\t\t\t\\\n\tstruct type *tmp = RB_ROOT(head);\t\t\t\t\\\n\tstruct type *res = NULL;\t\t\t\t\t\\\n\tint comp;\t\t\t\t\t\t\t\\\n\twhile (tmp) {\t\t\t\t\t\t\t\\\n\t\tcomp = cmp(elm, tmp);\t\t\t\t\t\\\n\t\tif (comp < 0) {\t\t\t\t\t\t\\\n\t\t\tres = tmp;\t\t\t\t\t\\\n\t\t\ttmp = RB_LEFT(tmp, field);\t\t\t\\\n\t\t}\t\t\t\t\t\t\t\\\n\t\telse if (comp > 0)\t\t\t\t\t\\\n\t\t\ttmp = RB_RIGHT(tmp, field);\t\t\t\\\n\t\telse\t\t\t\t\t\t\t\\\n\t\t\treturn (tmp);\t\t\t\t\t\\\n\t}\t\t\t\t\t\t\t\t\\\n\treturn (res);\t\t\t\t\t\t\t\\\n}\t\t\t\t\t\t\t\t\t\\\n\t\t\t\t\t\t\t\t\t\\\n/* ARGSUSED */\t\t\t\t\t\t\t\t\\\nattr struct type *\t\t\t\t\t\t\t\\\nname##_RB_NEXT(struct type *elm)\t\t\t\t\t\\\n{\t\t\t\t\t\t\t\t\t\\\n\tif (RB_RIGHT(elm, field)) {\t\t\t\t\t\\\n\t\telm = RB_RIGHT(elm, field);\t\t\t\t\\\n\t\twhile (RB_LEFT(elm, field))\t\t\t\t\\\n\t\t\telm = RB_LEFT(elm, field);\t\t\t\\\n\t} else {\t\t\t\t\t\t\t\\\n\t\tif (RB_PARENT(elm, field) &&\t\t\t\t\\\n\t\t    (elm == RB_LEFT(RB_PARENT(elm, field), field)))\t\\\n\t\t\telm = RB_PARENT(elm, field);\t\t\t\\\n\t\telse {\t\t\t\t\t\t\t\\\n\t\t\twhile (RB_PARENT(elm, field) &&\t\t\t\\\n\t\t\t    (elm == RB_RIGHT(RB_PARENT(elm, field), field)))\\\n\t\t\t\telm = RB_PARENT(elm, field);\t\t\\\n\t\t\telm = RB_PARENT(elm, field);\t\t\t\\\n\t\t}\t\t\t\t\t\t\t\\\n\t}\t\t\t\t\t\t\t\t\\\n\treturn (elm);\t\t\t\t\t\t\t\\\n}\t\t\t\t\t\t\t\t\t\\\n\t\t\t\t\t\t\t\t\t\\\n/* ARGSUSED */\t\t\t\t\t\t\t\t\\\nattr struct type *\t\t\t\t\t\t\t\\\nname##_RB_PREV(struct type *elm)\t\t\t\t\t\\\n{\t\t\t\t\t\t\t\t\t\\\n\tif (RB_LEFT(elm, field)) {\t\t\t\t\t\\\n\t\telm = RB_LEFT(elm, field);\t\t\t\t\\\n\t\twhile (RB_RIGHT(elm, field))\t\t\t\t\\\n\t\t\telm = RB_RIGHT(elm, field);\t\t\t\\\n\t} else {\t\t\t\t\t\t\t\\\n\t\tif (RB_PARENT(elm, field) &&\t\t\t\t\\\n\t\t    (elm == RB_RIGHT(RB_PARENT(elm, field), field)))\t\\\n\t\t\telm = RB_PARENT(elm, field);\t\t\t\\\n\t\telse {\t\t\t\t\t\t\t\\\n\t\t\twhile (RB_PARENT(elm, field) &&\t\t\t\\\n\t\t\t    (elm == RB_LEFT(RB_PARENT(elm, field), field)))\\\n\t\t\t\telm = RB_PARENT(elm, field);\t\t\\\n\t\t\telm = RB_PARENT(elm, field);\t\t\t\\\n\t\t}\t\t\t\t\t\t\t\\\n\t}\t\t\t\t\t\t\t\t\\\n\treturn (elm);\t\t\t\t\t\t\t\\\n}\t\t\t\t\t\t\t\t\t\\\n\t\t\t\t\t\t\t\t\t\\\nattr struct type *\t\t\t\t\t\t\t\\\nname##_RB_MINMAX(struct name *head, int val)\t\t\t\t\\\n{\t\t\t\t\t\t\t\t\t\\\n\tstruct type *tmp = RB_ROOT(head);\t\t\t\t\\\n\tstruct type *parent = NULL;\t\t\t\t\t\\\n\twhile (tmp) {\t\t\t\t\t\t\t\\\n\t\tparent = tmp;\t\t\t\t\t\t\\\n\t\tif (val < 0)\t\t\t\t\t\t\\\n\t\t\ttmp = RB_LEFT(tmp, field);\t\t\t\\\n\t\telse\t\t\t\t\t\t\t\\\n\t\t\ttmp = RB_RIGHT(tmp, field);\t\t\t\\\n\t}\t\t\t\t\t\t\t\t\\\n\treturn (parent);\t\t\t\t\t\t\\\n}\n\n#define RB_NEGINF\t-1\n#define RB_INF\t1\n\n#define RB_INSERT(name, x, y)\tname##_RB_INSERT(x, y)\n#define RB_REMOVE(name, x, y)\tname##_RB_REMOVE(x, y)\n#define RB_FIND(name, x, y)\tname##_RB_FIND(x, y)\n#define RB_NFIND(name, x, y)\tname##_RB_NFIND(x, y)\n#define RB_NEXT(name, x, y)\tname##_RB_NEXT(y)\n#define RB_PREV(name, x, y)\tname##_RB_PREV(y)\n#define RB_MIN(name, x)\t\tname##_RB_MINMAX(x, RB_NEGINF)\n#define RB_MAX(name, x)\t\tname##_RB_MINMAX(x, RB_INF)\n\n#define RB_FOREACH(x, name, head)\t\t\t\t\t\\\n\tfor ((x) = RB_MIN(name, head);\t\t\t\t\t\\\n\t     (x) != NULL;\t\t\t\t\t\t\\\n\t     (x) = name##_RB_NEXT(x))\n\n#define RB_FOREACH_FROM(x, name, y)\t\t\t\t\t\\\n\tfor ((x) = (y);\t\t\t\t\t\t\t\\\n\t    ((x) != NULL) && ((y) = name##_RB_NEXT(x), (x) != NULL);\t\\\n\t     (x) = (y))\n\n#define RB_FOREACH_SAFE(x, name, head, y)\t\t\t\t\\\n\tfor ((x) = RB_MIN(name, head);\t\t\t\t\t\\\n\t    ((x) != NULL) && ((y) = name##_RB_NEXT(x), (x) != NULL);\t\\\n\t     (x) = (y))\n\n#define RB_FOREACH_REVERSE(x, name, head)\t\t\t\t\\\n\tfor ((x) = RB_MAX(name, head);\t\t\t\t\t\\\n\t     (x) != NULL;\t\t\t\t\t\t\\\n\t     (x) = name##_RB_PREV(x))\n\n#define RB_FOREACH_REVERSE_FROM(x, name, y)\t\t\t\t\\\n\tfor ((x) = (y);\t\t\t\t\t\t\t\\\n\t    ((x) != NULL) && ((y) = name##_RB_PREV(x), (x) != NULL);\t\\\n\t     (x) = (y))\n\n#define RB_FOREACH_REVERSE_SAFE(x, name, head, y)\t\t\t\\\n\tfor ((x) = RB_MAX(name, head);\t\t\t\t\t\\\n\t    ((x) != NULL) && ((y) = name##_RB_PREV(x), (x) != NULL);\t\\\n\t     (x) = (y))\n\n#endif\t/* _SYS_TREE_H_ */\n"
  },
  {
    "path": "freebsd-headers/sys/tty.h",
    "content": "/*-\n * Copyright (c) 2008 Ed Schouten <ed@FreeBSD.org>\n * All rights reserved.\n *\n * Portions of this software were developed under sponsorship from Snow\n * B.V., the Netherlands.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/sys/tty.h 223722 2011-07-02 13:54:20Z ed $\n */\n\n#ifndef _SYS_TTY_H_\n#define\t_SYS_TTY_H_\n\n#include <sys/param.h>\n#include <sys/queue.h>\n#include <sys/lock.h>\n#include <sys/mutex.h>\n#include <sys/condvar.h>\n#include <sys/selinfo.h>\n#include <sys/_termios.h>\n#include <sys/ttycom.h>\n#include <sys/ttyqueue.h>\n\nstruct cdev;\nstruct file;\nstruct pgrp;\nstruct session;\nstruct ucred;\n\nstruct ttydevsw;\n\n/*\n * Per-TTY structure, containing buffers, etc.\n *\n * List of locks\n * (t)\tlocked by t_mtx\n * (l)\tlocked by tty_list_sx\n * (c)\tconst until freeing\n */\nstruct tty {\n\tstruct mtx\t*t_mtx;\t\t/* TTY lock. */\n\tstruct mtx\tt_mtxobj;\t/* Per-TTY lock (when not borrowing). */\n\tTAILQ_ENTRY(tty) t_list;\t/* (l) TTY list entry. */\n\tunsigned int\tt_flags;\t/* (t) Terminal option flags. */\n/* Keep flags in sync with db_show_tty and pstat(8). */\n#define\tTF_NOPREFIX\t0x00001\t/* Don't prepend \"tty\" to device name. */\n#define\tTF_INITLOCK\t0x00002\t/* Create init/lock state devices. */\n#define\tTF_CALLOUT\t0x00004\t/* Create \"cua\" devices. */\n#define\tTF_OPENED_IN\t0x00008\t/* \"tty\" node is in use. */\n#define\tTF_OPENED_OUT\t0x00010\t/* \"cua\" node is in use. */\n#define\tTF_OPENED_CONS\t0x00020 /* Device in use as console. */\n#define\tTF_OPENED\t(TF_OPENED_IN|TF_OPENED_OUT|TF_OPENED_CONS)\n#define\tTF_GONE\t\t0x00040\t/* Device node is gone. */\n#define\tTF_OPENCLOSE\t0x00080\t/* Device is in open()/close(). */\n#define\tTF_ASYNC\t0x00100\t/* Asynchronous I/O enabled. */\n#define\tTF_LITERAL\t0x00200\t/* Accept the next character literally. */\n#define\tTF_HIWAT_IN\t0x00400\t/* We've reached the input watermark. */\n#define\tTF_HIWAT_OUT\t0x00800\t/* We've reached the output watermark. */\n#define\tTF_HIWAT\t(TF_HIWAT_IN|TF_HIWAT_OUT)\n#define\tTF_STOPPED\t0x01000\t/* Output flow control - stopped. */\n#define\tTF_EXCLUDE\t0x02000\t/* Exclusive access. */\n#define\tTF_BYPASS\t0x04000\t/* Optimized input path. */\n#define\tTF_ZOMBIE\t0x08000\t/* Modem disconnect received. */\n#define\tTF_HOOK\t\t0x10000\t/* TTY has hook attached. */\n#define\tTF_BUSY_IN\t0x20000\t/* Process busy in read() -- not supported. */\n#define\tTF_BUSY_OUT\t0x40000\t/* Process busy in write(). */\n#define\tTF_BUSY\t\t(TF_BUSY_IN|TF_BUSY_OUT)\n\tunsigned int\tt_revokecnt;\t/* (t) revoke() count. */\n\n\t/* Buffering mechanisms. */\n\tstruct ttyinq\tt_inq;\t\t/* (t) Input queue. */\n\tsize_t\t\tt_inlow;\t/* (t) Input low watermark. */\n\tstruct ttyoutq\tt_outq;\t\t/* (t) Output queue. */\n\tsize_t\t\tt_outlow;\t/* (t) Output low watermark. */\n\n\t/* Sleeping mechanisms. */\n\tstruct cv\tt_inwait;\t/* (t) Input wait queue. */\n\tstruct cv\tt_outwait;\t/* (t) Output wait queue. */\n\tstruct cv\tt_outserwait;\t/* (t) Serial output wait queue. */\n\tstruct cv\tt_bgwait;\t/* (t) Background wait queue. */\n\tstruct cv\tt_dcdwait;\t/* (t) Carrier Detect wait queue. */\n\n\t/* Polling mechanisms. */\n\tstruct selinfo\tt_inpoll;\t/* (t) Input poll queue. */\n\tstruct selinfo\tt_outpoll;\t/* (t) Output poll queue. */\n\tstruct sigio\t*t_sigio;\t/* (t) Asynchronous I/O. */\n\n\tstruct termios\tt_termios;\t/* (t) I/O processing flags. */\n\tstruct winsize\tt_winsize;\t/* (t) Window size. */\n\tunsigned int\tt_column;\t/* (t) Current cursor position. */\n\tunsigned int\tt_writepos;\t/* (t) Where input was interrupted. */\n\tint\t\tt_compatflags;\t/* (t) COMPAT_43TTY flags. */\n\n\t/* Init/lock-state devices. */\n\tstruct termios\tt_termios_init_in;\t/* tty%s.init. */\n\tstruct termios\tt_termios_lock_in;\t/* tty%s.lock. */\n\tstruct termios\tt_termios_init_out;\t/* cua%s.init. */\n\tstruct termios\tt_termios_lock_out;\t/* cua%s.lock. */\n\n\tstruct ttydevsw\t*t_devsw;\t/* (c) Driver hooks. */\n\tstruct ttyhook\t*t_hook;\t/* (t) Capture/inject hook. */\n\n\t/* Process signal delivery. */\n\tstruct pgrp\t*t_pgrp;\t/* (t) Foreground process group. */\n\tstruct session\t*t_session;\t/* (t) Associated session. */\n\tunsigned int\tt_sessioncnt;\t/* (t) Backpointing sessions. */\n\n\tvoid\t\t*t_devswsoftc;\t/* (c) Soft config, for drivers. */\n\tvoid\t\t*t_hooksoftc;\t/* (t) Soft config, for hooks. */\n\tstruct cdev\t*t_dev;\t\t/* (c) Primary character device. */\n};\n\n/*\n * Userland version of struct tty, for sysctl kern.ttys\n */\nstruct xtty {\n\tsize_t\txt_size;\t/* Structure size. */\n\tsize_t\txt_insize;\t/* Input queue size. */\n\tsize_t\txt_incc;\t/* Canonicalized characters. */\n\tsize_t\txt_inlc;\t/* Input line charaters. */\n\tsize_t\txt_inlow;\t/* Input low watermark. */\n\tsize_t\txt_outsize;\t/* Output queue size. */\n\tsize_t\txt_outcc;\t/* Output queue usage. */\n\tsize_t\txt_outlow;\t/* Output low watermark. */\n\tunsigned int xt_column;\t/* Current column position. */\n\tpid_t\txt_pgid;\t/* Foreground process group. */\n\tpid_t\txt_sid;\t\t/* Session. */\n\tunsigned int xt_flags;\t/* Terminal option flags. */\n\tdev_t\txt_dev;\t\t/* Userland device. */\n};\n\n#ifdef _KERNEL\n\n/* Used to distinguish between normal, callout, lock and init devices. */\n#define\tTTYUNIT_INIT\t\t0x1\n#define\tTTYUNIT_LOCK\t\t0x2\n#define\tTTYUNIT_CALLOUT\t\t0x4\n\n/* Allocation and deallocation. */\nstruct tty *tty_alloc(struct ttydevsw *tsw, void *softc);\nstruct tty *tty_alloc_mutex(struct ttydevsw *tsw, void *softc, struct mtx *mtx);\nvoid\ttty_rel_pgrp(struct tty *tp, struct pgrp *pgrp);\nvoid\ttty_rel_sess(struct tty *tp, struct session *sess);\nvoid\ttty_rel_gone(struct tty *tp);\n\n#define\ttty_lock(tp)\t\tmtx_lock((tp)->t_mtx)\n#define\ttty_unlock(tp)\t\tmtx_unlock((tp)->t_mtx)\n#define\ttty_lock_assert(tp,ma)\tmtx_assert((tp)->t_mtx, (ma))\n#define\ttty_getlock(tp)\t\t((tp)->t_mtx)\n\n/* Device node creation. */\nvoid\ttty_makedev(struct tty *tp, struct ucred *cred, const char *fmt, ...)\n    __printflike(3, 4);\n#define\ttty_makealias(tp,fmt,...) \\\n\tmake_dev_alias((tp)->t_dev, fmt, ## __VA_ARGS__)\n\n/* Signalling processes. */\nvoid\ttty_signal_sessleader(struct tty *tp, int signal);\nvoid\ttty_signal_pgrp(struct tty *tp, int signal);\n/* Waking up readers/writers. */\nint\ttty_wait(struct tty *tp, struct cv *cv);\nint\ttty_timedwait(struct tty *tp, struct cv *cv, int timo);\nvoid\ttty_wakeup(struct tty *tp, int flags);\n\n/* System messages. */\nint\ttty_checkoutq(struct tty *tp);\nint\ttty_putchar(struct tty *tp, char c);\n\nint\ttty_ioctl(struct tty *tp, u_long cmd, void *data, int fflag,\n    struct thread *td);\nint\ttty_ioctl_compat(struct tty *tp, u_long cmd, caddr_t data,\n    int fflag, struct thread *td);\nvoid\ttty_init_console(struct tty *tp, speed_t speed);\nvoid\ttty_flush(struct tty *tp, int flags);\nvoid\ttty_hiwat_in_block(struct tty *tp);\nvoid\ttty_hiwat_in_unblock(struct tty *tp);\ndev_t\ttty_udev(struct tty *tp);\n#define\ttty_opened(tp)\t\t((tp)->t_flags & TF_OPENED)\n#define\ttty_gone(tp)\t\t((tp)->t_flags & TF_GONE)\n#define\ttty_softc(tp)\t\t((tp)->t_devswsoftc)\n#define\ttty_devname(tp)\t\tdevtoname((tp)->t_dev)\n\n/* Status line printing. */\nvoid\ttty_info(struct tty *tp);\n\n/* /dev/console selection. */\nvoid\tttyconsdev_select(const char *name);\n\n/* Pseudo-terminal hooks. */\nint\tpts_alloc(int fflags, struct thread *td, struct file *fp);\nint\tpts_alloc_external(int fd, struct thread *td, struct file *fp,\n    struct cdev *dev, const char *name);\n\n/* Drivers and line disciplines also need to call these. */\n#include <sys/ttydisc.h>\n#include <sys/ttydevsw.h>\n#include <sys/ttyhook.h>\n#endif /* _KERNEL */\n\n#endif /* !_SYS_TTY_H_ */\n"
  },
  {
    "path": "freebsd-headers/sys/ttycom.h",
    "content": "/*-\n * Copyright (c) 1982, 1986, 1990, 1993, 1994\n *\tThe Regents of the University of California.  All rights reserved.\n * (c) UNIX System Laboratories, Inc.\n * All or some portions of this file are derived from material licensed\n * to the University of California by American Telephone and Telegraph\n * Co. or Unix System Laboratories, Inc. and are reproduced herein with\n * the permission of UNIX System Laboratories, Inc.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 4. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t@(#)ttycom.h\t8.1 (Berkeley) 3/28/94\n * $FreeBSD: release/9.0.0/sys/sys/ttycom.h 196884 2009-09-06 09:39:40Z ed $\n */\n\n#ifndef\t_SYS_TTYCOM_H_\n#define\t_SYS_TTYCOM_H_\n\n#include <sys/ioccom.h>\n\n/*\n * Tty ioctl's except for those supported only for backwards compatibility\n * with the old tty driver.\n */\n\n/*\n * Window/terminal size structure.  This information is stored by the kernel\n * in order to provide a consistent interface, but is not used by the kernel.\n */\nstruct winsize {\n\tunsigned short\tws_row;\t\t/* rows, in characters */\n\tunsigned short\tws_col;\t\t/* columns, in characters */\n\tunsigned short\tws_xpixel;\t/* horizontal size, pixels */\n\tunsigned short\tws_ypixel;\t/* vertical size, pixels */\n};\n\n\t\t\t\t\t\t/* 0-2 compat */\n\t\t\t\t\t\t/* 3-7 unused */\n\t\t\t\t\t\t/* 8-10 compat */\n\t\t\t\t\t\t/* 11-12 unused */\n#define\tTIOCEXCL\t _IO('t', 13)\t\t/* set exclusive use of tty */\n#define\tTIOCNXCL\t _IO('t', 14)\t\t/* reset exclusive use of tty */\n#define\tTIOCGPTN\t_IOR('t', 15, int)\t/* Get pts number. */\n#define\tTIOCFLUSH\t_IOW('t', 16, int)\t/* flush buffers */\n\t\t\t\t\t\t/* 17-18 compat */\n#define\tTIOCGETA\t_IOR('t', 19, struct termios) /* get termios struct */\n#define\tTIOCSETA\t_IOW('t', 20, struct termios) /* set termios struct */\n#define\tTIOCSETAW\t_IOW('t', 21, struct termios) /* drain output, set */\n#define\tTIOCSETAF\t_IOW('t', 22, struct termios) /* drn out, fls in, set */\n\t\t\t\t\t\t/* 23-25 unused */\n#define\tTIOCGETD\t_IOR('t', 26, int)\t/* get line discipline */\n#define\tTIOCSETD\t_IOW('t', 27, int)\t/* set line discipline */\n#define\tTIOCPTMASTER\t _IO('t', 28)\t\t/* pts master validation */\n\t\t\t\t\t\t/* 29-85 unused */\n#define\tTIOCGDRAINWAIT\t_IOR('t', 86, int)\t/* get ttywait timeout */\n#define\tTIOCSDRAINWAIT\t_IOW('t', 87, int)\t/* set ttywait timeout */\n\t\t\t\t\t\t/* 88 unused */\n\t\t\t\t\t\t/* 89-91 conflicts: tun and tap */\n#define\tTIOCTIMESTAMP\t_IOR('t', 89, struct timeval)\t/* enable/get timestamp\n\t\t\t\t\t\t * of last input event */\n#define\tTIOCMGDTRWAIT\t_IOR('t', 90, int)\t/* modem: get wait on close */\n#define\tTIOCMSDTRWAIT\t_IOW('t', 91, int)\t/* modem: set wait on close */\n\t\t\t\t\t\t/* 92-93 tun and tap */\n\t\t\t\t\t\t/* 94-97 conflicts: tun and tap */\n#define\tTIOCDRAIN\t _IO('t', 94)\t\t/* wait till output drained */\n#define\tTIOCSIG\t\t_IOWINT('t', 95)\t/* pty: generate signal */\n#define\tTIOCEXT\t\t_IOW('t', 96, int)\t/* pty: external processing */\n#define\tTIOCSCTTY\t _IO('t', 97)\t\t/* become controlling tty */\n#define\tTIOCCONS\t_IOW('t', 98, int)\t/* become virtual console */\n#define\tTIOCGSID\t_IOR('t', 99, int)\t/* get session id */\n\t\t\t\t\t\t/* 100 unused */\n#define\tTIOCSTAT\t _IO('t', 101)\t\t/* simulate ^T status message */\n#define\tTIOCUCNTL\t_IOW('t', 102, int)\t/* pty: set/clr usr cntl mode */\n#define\t\tUIOCCMD(n)\t_IO('u', n)\t/* usr cntl op \"n\" */\n#define\tTIOCSWINSZ\t_IOW('t', 103, struct winsize)\t/* set window size */\n#define\tTIOCGWINSZ\t_IOR('t', 104, struct winsize)\t/* get window size */\n\t\t\t\t\t\t/* 105 unused */\n#define\tTIOCMGET\t_IOR('t', 106, int)\t/* get all modem bits */\n#define\t\tTIOCM_LE\t0001\t\t/* line enable */\n#define\t\tTIOCM_DTR\t0002\t\t/* data terminal ready */\n#define\t\tTIOCM_RTS\t0004\t\t/* request to send */\n#define\t\tTIOCM_ST\t0010\t\t/* secondary transmit */\n#define\t\tTIOCM_SR\t0020\t\t/* secondary receive */\n#define\t\tTIOCM_CTS\t0040\t\t/* clear to send */\n#define\t\tTIOCM_DCD\t0100\t\t/* data carrier detect */\n#define\t\tTIOCM_RI \t0200\t\t/* ring indicate */\n#define\t\tTIOCM_DSR\t0400\t\t/* data set ready */\n#define\t\tTIOCM_CD\tTIOCM_DCD\n#define\t\tTIOCM_CAR\tTIOCM_DCD\n#define\t\tTIOCM_RNG\tTIOCM_RI\n#define\tTIOCMBIC\t_IOW('t', 107, int)\t/* bic modem bits */\n#define\tTIOCMBIS\t_IOW('t', 108, int)\t/* bis modem bits */\n#define\tTIOCMSET\t_IOW('t', 109, int)\t/* set all modem bits */\n#define\tTIOCSTART\t _IO('t', 110)\t\t/* start output, like ^Q */\n#define\tTIOCSTOP\t _IO('t', 111)\t\t/* stop output, like ^S */\n#define\tTIOCPKT\t\t_IOW('t', 112, int)\t/* pty: set/clear packet mode */\n#define\t\tTIOCPKT_DATA\t\t0x00\t/* data packet */\n#define\t\tTIOCPKT_FLUSHREAD\t0x01\t/* flush packet */\n#define\t\tTIOCPKT_FLUSHWRITE\t0x02\t/* flush packet */\n#define\t\tTIOCPKT_STOP\t\t0x04\t/* stop output */\n#define\t\tTIOCPKT_START\t\t0x08\t/* start output */\n#define\t\tTIOCPKT_NOSTOP\t\t0x10\t/* no more ^S, ^Q */\n#define\t\tTIOCPKT_DOSTOP\t\t0x20\t/* now do ^S ^Q */\n#define\t\tTIOCPKT_IOCTL\t\t0x40\t/* state change of pty driver */\n#define\tTIOCNOTTY\t _IO('t', 113)\t\t/* void tty association */\n#define\tTIOCSTI\t\t_IOW('t', 114, char)\t/* simulate terminal input */\n#define\tTIOCOUTQ\t_IOR('t', 115, int)\t/* output queue size */\n\t\t\t\t\t\t/* 116-117 compat */\n#define\tTIOCSPGRP\t_IOW('t', 118, int)\t/* set pgrp of tty */\n#define\tTIOCGPGRP\t_IOR('t', 119, int)\t/* get pgrp of tty */\n#define\tTIOCCDTR\t _IO('t', 120)\t\t/* clear data terminal ready */\n#define\tTIOCSDTR\t _IO('t', 121)\t\t/* set data terminal ready */\n#define\tTIOCCBRK\t _IO('t', 122)\t\t/* clear break bit */\n#define\tTIOCSBRK\t _IO('t', 123)\t\t/* set break bit */\n\t\t\t\t\t\t/* 124-127 compat */\n\n#define\tTTYDISC\t\t0\t\t/* termios tty line discipline */\n#define\tSLIPDISC\t4\t\t/* serial IP discipline */\n#define\tPPPDISC\t\t5\t\t/* PPP discipline */\n#define\tNETGRAPHDISC\t6\t\t/* Netgraph tty node discipline */\n#define\tH4DISC\t\t7\t\t/* Netgraph Bluetooth H4 discipline */\n\n#endif /* !_SYS_TTYCOM_H_ */\n"
  },
  {
    "path": "freebsd-headers/sys/ttydefaults.h",
    "content": "/*-\n * Copyright (c) 1982, 1986, 1993\n *\tThe Regents of the University of California.  All rights reserved.\n * (c) UNIX System Laboratories, Inc.\n * All or some portions of this file are derived from material licensed\n * to the University of California by American Telephone and Telegraph\n * Co. or Unix System Laboratories, Inc. and are reproduced herein with\n * the permission of UNIX System Laboratories, Inc.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 4. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t@(#)ttydefaults.h\t8.4 (Berkeley) 1/21/94\n * $FreeBSD: release/9.0.0/sys/sys/ttydefaults.h 184771 2008-11-08 20:40:39Z ed $\n */\n\n/*\n * System wide defaults for terminal state.\n */\n#ifndef _SYS_TTYDEFAULTS_H_\n#define\t_SYS_TTYDEFAULTS_H_\n\n/*\n * Defaults on \"first\" open.\n */\n#define\tTTYDEF_IFLAG\t(BRKINT\t| ICRNL\t| IMAXBEL | IXON | IXANY)\n#define\tTTYDEF_OFLAG\t(OPOST | ONLCR)\n#define\tTTYDEF_LFLAG_NOECHO (ICANON | ISIG | IEXTEN)\n#define\tTTYDEF_LFLAG_ECHO (TTYDEF_LFLAG_NOECHO \\\n\t| ECHO | ECHOE | ECHOKE | ECHOCTL)\n#define\tTTYDEF_LFLAG TTYDEF_LFLAG_ECHO\n#define\tTTYDEF_CFLAG\t(CREAD | CS8 | HUPCL)\n#define\tTTYDEF_SPEED\t(B9600)\n\n/*\n * Control Character Defaults\n */\n/*\n * XXX: A lot of code uses lowercase characters, but control-character\n * conversion is actually only valid when applied to uppercase\n * characters. We just treat lowercase characters as if they were\n * inserted as uppercase.\n */\n#define\tCTRL(x) ((x) >= 'a' && (x) <= 'z' ? \\\n\t((x) - 'a' + 1) : (((x) - 'A' + 1) & 0x7f))\n#define\tCEOF\t\tCTRL('D')\n#define\tCEOL\t\t0xff\t\t/* XXX avoid _POSIX_VDISABLE */\n#define\tCERASE\t\tCTRL('?')\n#define\tCERASE2\t\tCTRL('H')\n#define\tCINTR\t\tCTRL('C')\n#define\tCSTATUS\t\tCTRL('T')\n#define\tCKILL\t\tCTRL('U')\n#define\tCMIN\t\t1\n#define\tCQUIT\t\tCTRL('\\\\')\n#define\tCSUSP\t\tCTRL('Z')\n#define\tCTIME\t\t0\n#define\tCDSUSP\t\tCTRL('Y')\n#define\tCSTART\t\tCTRL('Q')\n#define\tCSTOP\t\tCTRL('S')\n#define\tCLNEXT\t\tCTRL('V')\n#define\tCDISCARD \tCTRL('O')\n#define\tCWERASE \tCTRL('W')\n#define\tCREPRINT \tCTRL('R')\n#define\tCEOT\t\tCEOF\n/* compat */\n#define\tCBRK\t\tCEOL\n#define\tCRPRNT\t\tCREPRINT\n#define\tCFLUSH\t\tCDISCARD\n\n/* PROTECTED INCLUSION ENDS HERE */\n#endif /* !_SYS_TTYDEFAULTS_H_ */\n\n/*\n * #define TTYDEFCHARS to include an array of default control characters.\n */\n#ifdef TTYDEFCHARS\nstatic cc_t\tttydefchars[NCCS] = {\n\tCEOF,\tCEOL,\tCEOL,\tCERASE, CWERASE, CKILL, CREPRINT,\n\tCERASE2, CINTR,\tCQUIT,\tCSUSP,\tCDSUSP,\tCSTART,\tCSTOP,\tCLNEXT,\n\tCDISCARD, CMIN,\tCTIME,  CSTATUS, _POSIX_VDISABLE\n};\n#undef TTYDEFCHARS\n#endif\n"
  },
  {
    "path": "freebsd-headers/sys/ttydevsw.h",
    "content": "/*-\n * Copyright (c) 2008 Ed Schouten <ed@FreeBSD.org>\n * All rights reserved.\n *\n * Portions of this software were developed under sponsorship from Snow\n * B.V., the Netherlands.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/sys/ttydevsw.h 223722 2011-07-02 13:54:20Z ed $\n */\n\n#ifndef _SYS_TTYDEVSW_H_\n#define\t_SYS_TTYDEVSW_H_\n\n#ifndef _SYS_TTY_H_\n#error \"can only be included through <sys/tty.h>\"\n#endif /* !_SYS_TTY_H_ */\n\n/*\n * Driver routines that are called from the line discipline to adjust\n * hardware parameters and such.\n */\ntypedef int tsw_open_t(struct tty *tp);\ntypedef void tsw_close_t(struct tty *tp);\ntypedef void tsw_outwakeup_t(struct tty *tp);\ntypedef void tsw_inwakeup_t(struct tty *tp);\ntypedef int tsw_ioctl_t(struct tty *tp, u_long cmd, caddr_t data,\n    struct thread *td);\ntypedef int tsw_cioctl_t(struct tty *tp, int unit, u_long cmd, caddr_t data,\n    struct thread *td);\ntypedef int tsw_param_t(struct tty *tp, struct termios *t);\ntypedef int tsw_modem_t(struct tty *tp, int sigon, int sigoff);\ntypedef int tsw_mmap_t(struct tty *tp, vm_ooffset_t offset,\n    vm_paddr_t * paddr, int nprot, vm_memattr_t *memattr);\ntypedef void tsw_pktnotify_t(struct tty *tp, char event);\ntypedef void tsw_free_t(void *softc);\n\nstruct ttydevsw {\n\tunsigned int\ttsw_flags;\t/* Default TTY flags. */\n\n\ttsw_open_t\t*tsw_open;\t/* Device opening. */\n\ttsw_close_t\t*tsw_close;\t/* Device closure. */\n\n\ttsw_outwakeup_t\t*tsw_outwakeup;\t/* Output available. */\n\ttsw_inwakeup_t\t*tsw_inwakeup;\t/* Input can be stored again. */\n\n\ttsw_ioctl_t\t*tsw_ioctl;\t/* ioctl() hooks. */\n\ttsw_cioctl_t\t*tsw_cioctl;\t/* ioctl() on control devices. */\n\ttsw_param_t\t*tsw_param;\t/* TIOCSETA device parameter setting. */\n\ttsw_modem_t\t*tsw_modem;\t/* Modem sigon/sigoff. */\n\n\ttsw_mmap_t\t*tsw_mmap;\t/* mmap() hooks. */\n\ttsw_pktnotify_t\t*tsw_pktnotify;\t/* TIOCPKT events. */\n\n\ttsw_free_t\t*tsw_free;\t/* Destructor. */\n\n\tvoid\t\t*tsw_spare[4];\t/* For future use. */\n};\n\nstatic __inline int\nttydevsw_open(struct tty *tp)\n{\n\ttty_lock_assert(tp, MA_OWNED);\n\tMPASS(!tty_gone(tp));\n\n\treturn tp->t_devsw->tsw_open(tp);\n}\n\nstatic __inline void\nttydevsw_close(struct tty *tp)\n{\n\ttty_lock_assert(tp, MA_OWNED);\n\tMPASS(!tty_gone(tp));\n\n\ttp->t_devsw->tsw_close(tp);\n}\n\nstatic __inline void\nttydevsw_outwakeup(struct tty *tp)\n{\n\ttty_lock_assert(tp, MA_OWNED);\n\tMPASS(!tty_gone(tp));\n\n\t/* Prevent spurious wakeups. */\n\tif (ttydisc_getc_poll(tp) == 0)\n\t\treturn;\n\n\ttp->t_devsw->tsw_outwakeup(tp);\n}\n\nstatic __inline void\nttydevsw_inwakeup(struct tty *tp)\n{\n\ttty_lock_assert(tp, MA_OWNED);\n\tMPASS(!tty_gone(tp));\n\n\t/* Prevent spurious wakeups. */\n\tif (tp->t_flags & TF_HIWAT_IN)\n\t\treturn;\n\n\ttp->t_devsw->tsw_inwakeup(tp);\n}\n\nstatic __inline int\nttydevsw_ioctl(struct tty *tp, u_long cmd, caddr_t data, struct thread *td)\n{\n\ttty_lock_assert(tp, MA_OWNED);\n\tMPASS(!tty_gone(tp));\n\n\treturn tp->t_devsw->tsw_ioctl(tp, cmd, data, td);\n}\n\nstatic __inline int\nttydevsw_cioctl(struct tty *tp, int unit, u_long cmd, caddr_t data, struct thread *td)\n{\n\ttty_lock_assert(tp, MA_OWNED);\n\tMPASS(!tty_gone(tp));\n\n\treturn tp->t_devsw->tsw_cioctl(tp, unit, cmd, data, td);\n}\n\nstatic __inline int\nttydevsw_param(struct tty *tp, struct termios *t)\n{\n\tMPASS(!tty_gone(tp));\n\n\treturn tp->t_devsw->tsw_param(tp, t);\n}\n\nstatic __inline int\nttydevsw_modem(struct tty *tp, int sigon, int sigoff)\n{\n\tMPASS(!tty_gone(tp));\n\n\treturn tp->t_devsw->tsw_modem(tp, sigon, sigoff);\n}\n\nstatic __inline int\nttydevsw_mmap(struct tty *tp, vm_ooffset_t offset, vm_paddr_t *paddr,\n    int nprot, vm_memattr_t *memattr)\n{\n\tMPASS(!tty_gone(tp));\n\n\treturn tp->t_devsw->tsw_mmap(tp, offset, paddr, nprot, memattr);\n}\n\nstatic __inline void\nttydevsw_pktnotify(struct tty *tp, char event)\n{\n\ttty_lock_assert(tp, MA_OWNED);\n\tMPASS(!tty_gone(tp));\n\n\ttp->t_devsw->tsw_pktnotify(tp, event);\n}\n\nstatic __inline void\nttydevsw_free(struct tty *tp)\n{\n\tMPASS(tty_gone(tp));\n\n\ttp->t_devsw->tsw_free(tty_softc(tp));\n}\n\n#endif /* !_SYS_TTYDEVSW_H_ */\n"
  },
  {
    "path": "freebsd-headers/sys/ttydisc.h",
    "content": "/*-\n * Copyright (c) 2008 Ed Schouten <ed@FreeBSD.org>\n * All rights reserved.\n *\n * Portions of this software were developed under sponsorship from Snow\n * B.V., the Netherlands.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/sys/ttydisc.h 196452 2009-08-23 08:04:40Z ed $\n */\n\n#ifndef _SYS_TTYDISC_H_\n#define\t_SYS_TTYDISC_H_\n\n#ifndef _SYS_TTY_H_\n#error \"can only be included through <sys/tty.h>\"\n#endif /* !_SYS_TTY_H_ */\n\nstruct cv;\nstruct thread;\nstruct tty;\nstruct uio;\n\n/* Top half routines. */\nvoid\tttydisc_open(struct tty *tp);\nvoid\tttydisc_close(struct tty *tp);\nint\tttydisc_read(struct tty *tp, struct uio *uio, int ioflag);\nint\tttydisc_write(struct tty *tp, struct uio *uio, int ioflag);\nvoid\tttydisc_optimize(struct tty *tp);\n\n/* Bottom half routines. */\nvoid\tttydisc_modem(struct tty *tp, int open);\n#define ttydisc_can_bypass(tp) ((tp)->t_flags & TF_BYPASS)\nint\tttydisc_rint(struct tty *tp, char c, int flags);\nsize_t\tttydisc_rint_simple(struct tty *tp, const void *buf, size_t len);\nsize_t\tttydisc_rint_bypass(struct tty *tp, const void *buf, size_t len);\nvoid\tttydisc_rint_done(struct tty *tp);\nsize_t\tttydisc_rint_poll(struct tty *tp);\nsize_t\tttydisc_getc(struct tty *tp, void *buf, size_t len);\nint\tttydisc_getc_uio(struct tty *tp, struct uio *uio);\nsize_t\tttydisc_getc_poll(struct tty *tp);\n\n/* Error codes for ttydisc_rint(). */\n#define\tTRE_FRAMING\t0x01\n#define\tTRE_PARITY\t0x02\n#define\tTRE_OVERRUN\t0x04\n#define\tTRE_BREAK\t0x08\n\nstatic __inline size_t\nttydisc_read_poll(struct tty *tp)\n{\n\n\ttty_lock_assert(tp, MA_OWNED);\n\n\treturn ttyinq_bytescanonicalized(&tp->t_inq);\n}\n\nstatic __inline size_t\nttydisc_write_poll(struct tty *tp)\n{\n\n\ttty_lock_assert(tp, MA_OWNED);\n\n\treturn ttyoutq_bytesleft(&tp->t_outq);\n}\n\n#endif /* !_SYS_TTYDISC_H_ */\n"
  },
  {
    "path": "freebsd-headers/sys/ttyhook.h",
    "content": "/*-\n * Copyright (c) 2008 Ed Schouten <ed@FreeBSD.org>\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/sys/ttyhook.h 186056 2008-12-13 21:17:46Z mav $\n */\n\n#ifndef _SYS_TTYHOOK_H_\n#define\t_SYS_TTYHOOK_H_\n\n#ifndef _SYS_TTY_H_\n#error \"can only be included through <sys/tty.h>\"\n#endif /* !_SYS_TTY_H_ */\n\nstruct tty;\n\n/*\n * Hooks interface, which allows to capture and inject traffic into the\n * input and output paths of a TTY.\n */\n\ntypedef int th_rint_t(struct tty *tp, char c, int flags);\ntypedef size_t th_rint_bypass_t(struct tty *tp, const void *buf, size_t len);\ntypedef void th_rint_done_t(struct tty *tp);\ntypedef size_t th_rint_poll_t(struct tty *tp);\n\ntypedef size_t th_getc_inject_t(struct tty *tp, void *buf, size_t len);\ntypedef void th_getc_capture_t(struct tty *tp, const void *buf, size_t len);\ntypedef size_t th_getc_poll_t(struct tty *tp);\n\ntypedef void th_close_t(struct tty *tp);\n\nstruct ttyhook {\n\t/* Character input. */\n\tth_rint_t\t\t*th_rint;\n\tth_rint_bypass_t\t*th_rint_bypass;\n\tth_rint_done_t\t\t*th_rint_done;\n\tth_rint_poll_t\t\t*th_rint_poll;\n\n\t/* Character output. */\n\tth_getc_inject_t\t*th_getc_inject;\n\tth_getc_capture_t\t*th_getc_capture;\n\tth_getc_poll_t\t\t*th_getc_poll;\n\n\tth_close_t\t\t*th_close;\n};\n\nint\tttyhook_register(struct tty **, struct proc *, int,\n    struct ttyhook *, void *);\nvoid\tttyhook_unregister(struct tty *);\n#define\tttyhook_softc(tp)\t\t((tp)->t_hooksoftc)\n#define\tttyhook_hashook(tp,hook)\t((tp)->t_hook != NULL && \\\n\t\t\t\t\t(tp)->t_hook->th_ ## hook != NULL)\n\nstatic __inline int\nttyhook_rint(struct tty *tp, char c, int flags)\n{\n\ttty_lock_assert(tp, MA_OWNED);\n\tMPASS(!tty_gone(tp));\n\n\treturn tp->t_hook->th_rint(tp, c, flags);\n}\n\nstatic __inline size_t\nttyhook_rint_bypass(struct tty *tp, const void *buf, size_t len)\n{\n\ttty_lock_assert(tp, MA_OWNED);\n\tMPASS(!tty_gone(tp));\n\n\treturn tp->t_hook->th_rint_bypass(tp, buf, len);\n}\n\nstatic __inline void\nttyhook_rint_done(struct tty *tp)\n{\n\ttty_lock_assert(tp, MA_OWNED);\n\tMPASS(!tty_gone(tp));\n\n\ttp->t_hook->th_rint_done(tp);\n}\n\nstatic __inline size_t\nttyhook_rint_poll(struct tty *tp)\n{\n\ttty_lock_assert(tp, MA_OWNED);\n\tMPASS(!tty_gone(tp));\n\n\treturn tp->t_hook->th_rint_poll(tp);\n}\n\nstatic __inline size_t\nttyhook_getc_inject(struct tty *tp, void *buf, size_t len)\n{\n\ttty_lock_assert(tp, MA_OWNED);\n\tMPASS(!tty_gone(tp));\n\n\treturn tp->t_hook->th_getc_inject(tp, buf, len);\n}\n\nstatic __inline void\nttyhook_getc_capture(struct tty *tp, const void *buf, size_t len)\n{\n\ttty_lock_assert(tp, MA_OWNED);\n\tMPASS(!tty_gone(tp));\n\n\ttp->t_hook->th_getc_capture(tp, buf, len);\n}\n\nstatic __inline size_t\nttyhook_getc_poll(struct tty *tp)\n{\n\ttty_lock_assert(tp, MA_OWNED);\n\tMPASS(!tty_gone(tp));\n\n\treturn tp->t_hook->th_getc_poll(tp);\n}\n\nstatic __inline void\nttyhook_close(struct tty *tp)\n{\n\ttty_lock_assert(tp, MA_OWNED);\n\n\ttp->t_hook->th_close(tp);\n}\n\n#endif /* !_SYS_TTYHOOK_H_ */\n"
  },
  {
    "path": "freebsd-headers/sys/ttyqueue.h",
    "content": "/*-\n * Copyright (c) 2008 Ed Schouten <ed@FreeBSD.org>\n * All rights reserved.\n *\n * Portions of this software were developed under sponsorship from Snow\n * B.V., the Netherlands.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/sys/ttyqueue.h 198223 2009-10-19 07:17:37Z ed $\n */\n\n#ifndef _SYS_TTYQUEUE_H_\n#define\t_SYS_TTYQUEUE_H_\n\n#ifndef _SYS_TTY_H_\n#error \"can only be included through <sys/tty.h>\"\n#endif /* !_SYS_TTY_H_ */\n\nstruct tty;\nstruct ttyinq_block;\nstruct ttyoutq_block;\nstruct uio;\n\n/* Data input queue. */\nstruct ttyinq {\n\tstruct ttyinq_block\t*ti_firstblock;\n\tstruct ttyinq_block\t*ti_startblock;\n\tstruct ttyinq_block\t*ti_reprintblock;\n\tstruct ttyinq_block\t*ti_lastblock;\n\tunsigned int\t\tti_begin;\n\tunsigned int\t\tti_linestart;\n\tunsigned int\t\tti_reprint;\n\tunsigned int\t\tti_end;\n\tunsigned int\t\tti_nblocks;\n\tunsigned int\t\tti_quota;\n};\n#define TTYINQ_DATASIZE 128\n\n/* Data output queue. */\nstruct ttyoutq {\n\tstruct ttyoutq_block\t*to_firstblock;\n\tstruct ttyoutq_block\t*to_lastblock;\n\tunsigned int\t\tto_begin;\n\tunsigned int\t\tto_end;\n\tunsigned int\t\tto_nblocks;\n\tunsigned int\t\tto_quota;\n};\n#define TTYOUTQ_DATASIZE (256 - sizeof(struct ttyoutq_block *))\n\n#ifdef _KERNEL\n/* Input queue handling routines. */\nvoid\tttyinq_setsize(struct ttyinq *ti, struct tty *tp, size_t len);\nvoid\tttyinq_free(struct ttyinq *ti);\nint\tttyinq_read_uio(struct ttyinq *ti, struct tty *tp, struct uio *uio,\n    size_t readlen, size_t flushlen);\nsize_t\tttyinq_write(struct ttyinq *ti, const void *buf, size_t len,\n    int quote);\nint\tttyinq_write_nofrag(struct ttyinq *ti, const void *buf, size_t len,\n    int quote);\nvoid\tttyinq_canonicalize(struct ttyinq *ti);\nsize_t\tttyinq_findchar(struct ttyinq *ti, const char *breakc, size_t maxlen,\n    char *lastc);\nvoid\tttyinq_flush(struct ttyinq *ti);\nint\tttyinq_peekchar(struct ttyinq *ti, char *c, int *quote);\nvoid\tttyinq_unputchar(struct ttyinq *ti);\nvoid\tttyinq_reprintpos_set(struct ttyinq *ti);\nvoid\tttyinq_reprintpos_reset(struct ttyinq *ti);\n\nstatic __inline size_t\nttyinq_getsize(struct ttyinq *ti)\n{\n\treturn (ti->ti_nblocks * TTYINQ_DATASIZE);\n}\n\nstatic __inline size_t\nttyinq_getallocatedsize(struct ttyinq *ti)\n{\n\n\treturn (ti->ti_quota * TTYINQ_DATASIZE);\n}\n\nstatic __inline size_t\nttyinq_bytesleft(struct ttyinq *ti)\n{\n\tsize_t len;\n\n\t/* Make sure the usage never exceeds the length. */\n\tlen = ti->ti_nblocks * TTYINQ_DATASIZE;\n\tMPASS(len >= ti->ti_end);\n\n\treturn (len - ti->ti_end);\n}\n\nstatic __inline size_t\nttyinq_bytescanonicalized(struct ttyinq *ti)\n{\n\tMPASS(ti->ti_begin <= ti->ti_linestart);\n\n\treturn (ti->ti_linestart - ti->ti_begin);\n}\n\nstatic __inline size_t\nttyinq_bytesline(struct ttyinq *ti)\n{\n\tMPASS(ti->ti_linestart <= ti->ti_end);\n\n\treturn (ti->ti_end - ti->ti_linestart);\n}\n\n/* Input buffer iteration. */\ntypedef void ttyinq_line_iterator_t(void *data, char c, int flags);\nvoid\tttyinq_line_iterate_from_linestart(struct ttyinq *ti,\n    ttyinq_line_iterator_t *iterator, void *data);\nvoid\tttyinq_line_iterate_from_reprintpos(struct ttyinq *ti,\n    ttyinq_line_iterator_t *iterator, void *data);\n\n/* Output queue handling routines. */\nvoid\tttyoutq_flush(struct ttyoutq *to);\nvoid\tttyoutq_setsize(struct ttyoutq *to, struct tty *tp, size_t len);\nvoid\tttyoutq_free(struct ttyoutq *to);\nsize_t\tttyoutq_read(struct ttyoutq *to, void *buf, size_t len);\nint\tttyoutq_read_uio(struct ttyoutq *to, struct tty *tp, struct uio *uio);\nsize_t\tttyoutq_write(struct ttyoutq *to, const void *buf, size_t len);\nint\tttyoutq_write_nofrag(struct ttyoutq *to, const void *buf, size_t len);\n\nstatic __inline size_t\nttyoutq_getsize(struct ttyoutq *to)\n{\n\treturn (to->to_nblocks * TTYOUTQ_DATASIZE);\n}\n\nstatic __inline size_t\nttyoutq_getallocatedsize(struct ttyoutq *to)\n{\n\n\treturn (to->to_quota * TTYOUTQ_DATASIZE);\n}\n\nstatic __inline size_t\nttyoutq_bytesleft(struct ttyoutq *to)\n{\n\tsize_t len;\n\n\t/* Make sure the usage never exceeds the length. */\n\tlen = to->to_nblocks * TTYOUTQ_DATASIZE;\n\tMPASS(len >= to->to_end);\n\n\treturn (len - to->to_end);\n}\n\nstatic __inline size_t\nttyoutq_bytesused(struct ttyoutq *to)\n{\n\treturn (to->to_end - to->to_begin);\n}\n#endif /* _KERNEL */\n\n#endif /* !_SYS_TTYQUEUE_H_ */\n"
  },
  {
    "path": "freebsd-headers/sys/turnstile.h",
    "content": "/*-\n * Copyright (c) 2002 John Baldwin <jhb@FreeBSD.org>\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. Neither the name of the author nor the names of any co-contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/sys/turnstile.h 216421 2010-12-13 23:53:55Z mckusick $\n */\n\n#ifndef _SYS_TURNSTILE_H_\n#define _SYS_TURNSTILE_H_\n\n/*\n * Turnstile interface.  Non-sleepable locks use a turnstile for the\n * queue of threads blocked on them when they are contested.  Each\n * turnstile contains two sub-queues: one for threads waiting for a\n * shared, or eread, lock, and one for threads waiting for an\n * exclusive, or write, lock.\n *\n * A thread calls turnstile_chain_lock() to lock the turnstile chain\n * associated with a given lock.  A thread calls turnstile_wait() when\n * the lock is contested to be put on the queue and block.  If a thread\n * calls turnstile_trywait() and decides to retry a lock operation instead\n * of blocking, it should call turnstile_cancel() to unlock the associated\n * turnstile chain lock.\n *\n * When a lock is released, the thread calls turnstile_lookup() to look\n * up the turnstile associated with the given lock in the hash table.  Then\n * it calls either turnstile_signal() or turnstile_broadcast() to mark\n * blocked threads for a pending wakeup.  turnstile_signal() marks the\n * highest priority blocked thread while turnstile_broadcast() marks all\n * blocked threads.  The turnstile_signal() function returns true if the\n * turnstile became empty as a result.  After the higher level code finishes\n * releasing the lock, turnstile_unpend() must be called to wake up the\n * pending thread(s) and give up ownership of the turnstile.\n *\n * Alternatively, if a thread wishes to relinquish ownership of a lock\n * without waking up any waiters, it may call turnstile_disown().\n *\n * When a lock is acquired that already has at least one thread contested\n * on it, the new owner of the lock must claim ownership of the turnstile\n * via turnstile_claim().\n *\n * Each thread allocates a turnstile at thread creation via turnstile_alloc()\n * and releases it at thread destruction via turnstile_free().  Note that\n * a turnstile is not tied to a specific thread and that the turnstile\n * released at thread destruction may not be the same turnstile that the\n * thread allocated when it was created.\n *\n * The highest priority thread blocked on a specified queue of a\n * turnstile can be obtained via turnstile_head().  A given queue can\n * also be queried to see if it is empty via turnstile_empty().\n */\n\nstruct lock_object;\nstruct thread;\nstruct turnstile;\n\n#ifdef _KERNEL\n\n/* Which queue to block on or which queue to wakeup one or more threads from. */\n#define\tTS_EXCLUSIVE_QUEUE\t0\n#define\tTS_SHARED_QUEUE\t\t1\n\n/* The type of lock currently held. */\n#define\tTS_EXCLUSIVE_LOCK\tTS_EXCLUSIVE_QUEUE\n#define\tTS_SHARED_LOCK\t\tTS_SHARED_QUEUE\n\nvoid\tinit_turnstiles(void);\nvoid\tturnstile_adjust(struct thread *, u_char);\nstruct turnstile *turnstile_alloc(void);\nvoid\tturnstile_broadcast(struct turnstile *, int);\nvoid\tturnstile_cancel(struct turnstile *);\nvoid\tturnstile_chain_lock(struct lock_object *);\nvoid\tturnstile_chain_unlock(struct lock_object *);\nvoid\tturnstile_claim(struct turnstile *);\nvoid\tturnstile_disown(struct turnstile *);\nint\tturnstile_empty(struct turnstile *ts, int queue);\nvoid\tturnstile_free(struct turnstile *);\nstruct thread *turnstile_head(struct turnstile *, int);\nstruct turnstile *turnstile_lookup(struct lock_object *);\nint\tturnstile_signal(struct turnstile *, int);\nstruct turnstile *turnstile_trywait(struct lock_object *);\nvoid\tturnstile_unpend(struct turnstile *, int);\nvoid\tturnstile_wait(struct turnstile *, struct thread *, int);\n\n#endif\t/* _KERNEL */\n#endif\t/* _SYS_TURNSTILE_H_ */\n"
  },
  {
    "path": "freebsd-headers/sys/types.h",
    "content": "/*-\n * Copyright (c) 1982, 1986, 1991, 1993, 1994\n *\tThe Regents of the University of California.  All rights reserved.\n * (c) UNIX System Laboratories, Inc.\n * All or some portions of this file are derived from material licensed\n * to the University of California by American Telephone and Telegraph\n * Co. or Unix System Laboratories, Inc. and are reproduced herein with\n * the permission of UNIX System Laboratories, Inc.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 4. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t@(#)types.h\t8.6 (Berkeley) 2/19/95\n * $FreeBSD: release/9.0.0/sys/sys/types.h 223710 2011-07-01 12:13:48Z jonathan $\n */\n\n#ifndef _SYS_TYPES_H_\n#define\t_SYS_TYPES_H_\n\n#include <sys/cdefs.h>\n\n/* Machine type dependent parameters. */\n#include <machine/endian.h>\n#include <sys/_types.h>\n\n#include <sys/_pthreadtypes.h>\n\n#if __BSD_VISIBLE\ntypedef\tunsigned char\tu_char;\ntypedef\tunsigned short\tu_short;\ntypedef\tunsigned int\tu_int;\ntypedef\tunsigned long\tu_long;\n#ifndef _KERNEL\ntypedef\tunsigned short\tushort;\t\t/* Sys V compatibility */\ntypedef\tunsigned int\tuint;\t\t/* Sys V compatibility */\n#endif\n#endif\n\n/*\n * XXX POSIX sized integrals that should appear only in <sys/stdint.h>.\n */\n#include <sys/_stdint.h>\n\ntypedef __uint8_t\tu_int8_t;\t/* unsigned integrals (deprecated) */\ntypedef __uint16_t\tu_int16_t;\ntypedef __uint32_t\tu_int32_t;\ntypedef __uint64_t\tu_int64_t;\n\ntypedef\t__uint64_t\tu_quad_t;\t/* quads (deprecated) */\ntypedef\t__int64_t\tquad_t;\ntypedef\tquad_t *\tqaddr_t;\n\ntypedef\tchar *\t\tcaddr_t;\t/* core address */\ntypedef\t__const char *\tc_caddr_t;\t/* core address, pointer to const */\ntypedef\t__volatile char *v_caddr_t;\t/* core address, pointer to volatile */\n\n#ifndef _BLKSIZE_T_DECLARED\ntypedef\t__blksize_t\tblksize_t;\n#define\t_BLKSIZE_T_DECLARED\n#endif\n\ntypedef\t__cpuwhich_t\tcpuwhich_t;\ntypedef\t__cpulevel_t\tcpulevel_t;\ntypedef\t__cpusetid_t\tcpusetid_t;\n\n#ifndef _BLKCNT_T_DECLARED\ntypedef\t__blkcnt_t\tblkcnt_t;\n#define\t_BLKCNT_T_DECLARED\n#endif\n\ntypedef\t__cap_rights_t\tcap_rights_t;\n\n#ifndef _CLOCK_T_DECLARED\ntypedef\t__clock_t\tclock_t;\n#define\t_CLOCK_T_DECLARED\n#endif\n\n#ifndef _CLOCKID_T_DECLARED\ntypedef\t__clockid_t\tclockid_t;\n#define\t_CLOCKID_T_DECLARED\n#endif\n\ntypedef\t__critical_t\tcritical_t;\t/* Critical section value */\ntypedef\t__int64_t\tdaddr_t;\t/* disk address */\n\n#ifndef _DEV_T_DECLARED\ntypedef\t__dev_t\t\tdev_t;\t\t/* device number or struct cdev */\n#define\t_DEV_T_DECLARED\n#endif\n\n#ifndef _FFLAGS_T_DECLARED\ntypedef\t__fflags_t\tfflags_t;\t/* file flags */\n#define\t_FFLAGS_T_DECLARED\n#endif\n\ntypedef\t__fixpt_t\tfixpt_t;\t/* fixed point number */\n\n#ifndef _FSBLKCNT_T_DECLARED\t\t/* for statvfs() */\ntypedef\t__fsblkcnt_t\tfsblkcnt_t;\ntypedef\t__fsfilcnt_t\tfsfilcnt_t;\n#define\t_FSBLKCNT_T_DECLARED\n#endif\n\n#ifndef _GID_T_DECLARED\ntypedef\t__gid_t\t\tgid_t;\t\t/* group id */\n#define\t_GID_T_DECLARED\n#endif\n\n#ifndef _IN_ADDR_T_DECLARED\ntypedef\t__uint32_t\tin_addr_t;\t/* base type for internet address */\n#define\t_IN_ADDR_T_DECLARED\n#endif\n\n#ifndef _IN_PORT_T_DECLARED\ntypedef\t__uint16_t\tin_port_t;\n#define\t_IN_PORT_T_DECLARED\n#endif\n\n#ifndef _ID_T_DECLARED\ntypedef\t__id_t\t\tid_t;\t\t/* can hold a uid_t or pid_t */\n#define\t_ID_T_DECLARED\n#endif\n\n#ifndef _INO_T_DECLARED\ntypedef\t__ino_t\t\tino_t;\t\t/* inode number */\n#define\t_INO_T_DECLARED\n#endif\n\n#ifndef _KEY_T_DECLARED\ntypedef\t__key_t\t\tkey_t;\t\t/* IPC key (for Sys V IPC) */\n#define\t_KEY_T_DECLARED\n#endif\n\n#ifndef _LWPID_T_DECLARED\ntypedef\t__lwpid_t\tlwpid_t;\t/* Thread ID (a.k.a. LWP) */\n#define\t_LWPID_T_DECLARED\n#endif\n\n#ifndef _MODE_T_DECLARED\ntypedef\t__mode_t\tmode_t;\t\t/* permissions */\n#define\t_MODE_T_DECLARED\n#endif\n\n#ifndef _ACCMODE_T_DECLARED\ntypedef\t__accmode_t\taccmode_t;\t/* access permissions */\n#define\t_ACCMODE_T_DECLARED\n#endif\n\n#ifndef _NLINK_T_DECLARED\ntypedef\t__nlink_t\tnlink_t;\t/* link count */\n#define\t_NLINK_T_DECLARED\n#endif\n\n#ifndef _OFF_T_DECLARED\ntypedef\t__off_t\t\toff_t;\t\t/* file offset */\n#define\t_OFF_T_DECLARED\n#endif\n\n#ifndef _PID_T_DECLARED\ntypedef\t__pid_t\t\tpid_t;\t\t/* process id */\n#define\t_PID_T_DECLARED\n#endif\n\ntypedef\t__register_t\tregister_t;\n\n#ifndef _RLIM_T_DECLARED\ntypedef\t__rlim_t\trlim_t;\t\t/* resource limit */\n#define\t_RLIM_T_DECLARED\n#endif\n\ntypedef\t__segsz_t\tsegsz_t;\t/* segment size (in pages) */\n\n#ifndef _SIZE_T_DECLARED\ntypedef\t__size_t\tsize_t;\n#define\t_SIZE_T_DECLARED\n#endif\n\n#ifndef _SSIZE_T_DECLARED\ntypedef\t__ssize_t\tssize_t;\n#define\t_SSIZE_T_DECLARED\n#endif\n\n#ifndef _SUSECONDS_T_DECLARED\ntypedef\t__suseconds_t\tsuseconds_t;\t/* microseconds (signed) */\n#define\t_SUSECONDS_T_DECLARED\n#endif\n\n#ifndef _TIME_T_DECLARED\ntypedef\t__time_t\ttime_t;\n#define\t_TIME_T_DECLARED\n#endif\n\n#ifndef _TIMER_T_DECLARED\ntypedef\t__timer_t\ttimer_t;\n#define\t_TIMER_T_DECLARED\n#endif\n\n#ifndef _MQD_T_DECLARED\ntypedef\t__mqd_t\tmqd_t;\n#define\t_MQD_T_DECLARED\n#endif\n\ntypedef\t__u_register_t\tu_register_t;\n\n#ifndef _UID_T_DECLARED\ntypedef\t__uid_t\t\tuid_t;\t\t/* user id */\n#define\t_UID_T_DECLARED\n#endif\n\n#ifndef _USECONDS_T_DECLARED\ntypedef\t__useconds_t\tuseconds_t;\t/* microseconds (unsigned) */\n#define\t_USECONDS_T_DECLARED\n#endif\n\ntypedef\t__vm_offset_t\tvm_offset_t;\ntypedef\t__vm_ooffset_t\tvm_ooffset_t;\ntypedef\t__vm_paddr_t\tvm_paddr_t;\ntypedef\t__vm_pindex_t\tvm_pindex_t;\ntypedef\t__vm_size_t\tvm_size_t;\n\n#ifdef _KERNEL\ntypedef\tint\t\tboolean_t;\ntypedef\tstruct device\t*device_t;\ntypedef\t__intfptr_t\tintfptr_t;\n\n/*\n * XXX this is fixed width for historical reasons.  It should have had type\n * __int_fast32_t.  Fixed-width types should not be used unless binary\n * compatibility is essential.  Least-width types should be used even less\n * since they provide smaller benefits.\n *\n * XXX should be MD.\n *\n * XXX this is bogus in -current, but still used for spl*().\n */\ntypedef\t__uint32_t\tintrmask_t;\t/* Interrupt mask (spl, xxx_imask...) */\n\ntypedef\t__uintfptr_t\tuintfptr_t;\ntypedef\t__uint64_t\tuoff_t;\ntypedef\tchar\t\tvm_memattr_t;\t/* memory attribute codes */\ntypedef\tstruct vm_page\t*vm_page_t;\n\n#define offsetof(type, field) __offsetof(type, field)\n\n#endif /* !_KERNEL */\n\n/*\n * The following are all things that really shouldn't exist in this header,\n * since its purpose is to provide typedefs, not miscellaneous doodads.\n */\n#if __BSD_VISIBLE\n\n#include <sys/select.h>\n\n/*\n * minor() gives a cookie instead of an index since we don't want to\n * change the meanings of bits 0-15 or waste time and space shifting\n * bits 16-31 for devices that don't use them.\n */\n#define\tmajor(x)\t((int)(((u_int)(x) >> 8)&0xff))\t/* major number */\n#define\tminor(x)\t((int)((x)&0xffff00ff))\t\t/* minor number */\n#define\tmakedev(x,y)\t((dev_t)(((x) << 8) | (y)))\t/* create dev_t */\n\n/*\n * These declarations belong elsewhere, but are repeated here and in\n * <stdio.h> to give broken programs a better chance of working with\n * 64-bit off_t's.\n */\n#ifndef _KERNEL\n__BEGIN_DECLS\n#ifndef _FTRUNCATE_DECLARED\n#define\t_FTRUNCATE_DECLARED\nint\t ftruncate(int, off_t);\n#endif\n#ifndef _LSEEK_DECLARED\n#define\t_LSEEK_DECLARED\noff_t\t lseek(int, off_t, int);\n#endif\n#ifndef _MMAP_DECLARED\n#define\t_MMAP_DECLARED\nvoid *\t mmap(void *, size_t, int, int, int, off_t);\n#endif\n#ifndef _TRUNCATE_DECLARED\n#define\t_TRUNCATE_DECLARED\nint\t truncate(const char *, off_t);\n#endif\n__END_DECLS\n#endif /* !_KERNEL */\n\n#endif /* __BSD_VISIBLE */\n\n#endif /* !_SYS_TYPES_H_ */\n"
  },
  {
    "path": "freebsd-headers/sys/ucontext.h",
    "content": "/*-\n * Copyright (c) 1999 Marcel Moolenaar\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer \n *    in this position and unchanged.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. The name of the author may not be used to endorse or promote products\n *    derived from this software without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR\n * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES\n * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,\n * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF\n * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/sys/ucontext.h 158471 2006-05-12 05:04:46Z jhb $\n */\n\n#ifndef _SYS_UCONTEXT_H_\n#define\t_SYS_UCONTEXT_H_\n\n#include <sys/signal.h>\n#include <machine/ucontext.h>\n\ntypedef struct __ucontext {\n\t/*\n\t * Keep the order of the first two fields. Also,\n\t * keep them the first two fields in the structure.\n\t * This way we can have a union with struct\n\t * sigcontext and ucontext_t. This allows us to\n\t * support them both at the same time.\n\t * note: the union is not defined, though.\n\t */\n\tsigset_t\tuc_sigmask;\n\tmcontext_t\tuc_mcontext;\n\n\tstruct __ucontext *uc_link;\n\tstack_t\t\tuc_stack;\n\tint\t\tuc_flags;\n#define\tUCF_SWAPPED\t0x00000001\t/* Used by swapcontext(3). */\n\tint\t\t__spare__[4];\n} ucontext_t;\n\n#if defined(_KERNEL) && defined(COMPAT_FREEBSD4)\n#if defined(__i386__)\nstruct ucontext4 {\n\tsigset_t\tuc_sigmask;\n\tstruct mcontext4 uc_mcontext;\n\tstruct ucontext4 *uc_link;\n\tstack_t\t\tuc_stack;\n\tint\t\t__spare__[8];\n};\n#else\t/* __i386__ */\n#define ucontext4 ucontext\n#endif\t/* __i386__ */\n#endif\t/* _KERNEL */\n\n#ifndef _KERNEL\n\n__BEGIN_DECLS\n\nint\tgetcontext(ucontext_t *);\nint\tsetcontext(const ucontext_t *);\nvoid\tmakecontext(ucontext_t *, void (*)(void), int, ...);\nint\tsignalcontext(ucontext_t *, int, __sighandler_t *);\nint\tswapcontext(ucontext_t *, const ucontext_t *);\n\n__END_DECLS\n\n#else /* _KERNEL */\n\nstruct thread;\n\n/*\n * Flags for get_mcontext().  The low order 4 bits (i.e a mask of 0x0f) are\n * reserved for use by machine independent code.  All other bits are for use\n * by machine dependent code.\n */\n#define\tGET_MC_CLEAR_RET\t1\n\n/* Machine-dependent functions: */\nint\tget_mcontext(struct thread *, mcontext_t *, int);\nint\tset_mcontext(struct thread *, const mcontext_t *);\n\n#endif /* !_KERNEL */\n\n#endif /* !_SYS_UCONTEXT_H_ */\n"
  },
  {
    "path": "freebsd-headers/sys/ucred.h",
    "content": "/*-\n * Copyright (c) 1989, 1993\n *\tThe Regents of the University of California.  All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 4. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t@(#)ucred.h\t8.4 (Berkeley) 1/9/95\n * $FreeBSD: release/9.0.0/sys/sys/ucred.h 219304 2011-03-05 12:40:35Z trasz $\n */\n\n#ifndef _SYS_UCRED_H_\n#define\t_SYS_UCRED_H_\n\n#include <bsm/audit.h>\n\nstruct loginclass;\n\n/*\n * Credentials.\n *\n * Please do not inspect cr_uid directly to determine superuserness.  The\n * priv(9) interface should be used to check for privilege.\n */\n#if defined(_KERNEL) || defined(_WANT_UCRED)\nstruct ucred {\n\tu_int\tcr_ref;\t\t\t/* reference count */\n#define\tcr_startcopy cr_uid\n\tuid_t\tcr_uid;\t\t\t/* effective user id */\n\tuid_t\tcr_ruid;\t\t/* real user id */\n\tuid_t\tcr_svuid;\t\t/* saved user id */\n\tint\tcr_ngroups;\t\t/* number of groups */\n\tgid_t\tcr_rgid;\t\t/* real group id */\n\tgid_t\tcr_svgid;\t\t/* saved group id */\n\tstruct uidinfo\t*cr_uidinfo;\t/* per euid resource consumption */\n\tstruct uidinfo\t*cr_ruidinfo;\t/* per ruid resource consumption */\n\tstruct prison\t*cr_prison;\t/* jail(2) */\n\tstruct loginclass\t*cr_loginclass; /* login class */\n\tu_int\t\tcr_flags;\t/* credential flags */\n\tvoid \t\t*cr_pspare2[2];\t/* general use 2 */\n#define\tcr_endcopy\tcr_label\n\tstruct label\t*cr_label;\t/* MAC label */\n\tstruct auditinfo_addr\tcr_audit;\t/* Audit properties. */\n\tgid_t\t*cr_groups;\t\t/* groups */\n\tint\tcr_agroups;\t\t/* Available groups */\n};\n#define\tNOCRED\t((struct ucred *)0)\t/* no credential available */\n#define\tFSCRED\t((struct ucred *)-1)\t/* filesystem credential */\n#endif /* _KERNEL || _WANT_UCRED */\n\n#define\tXU_NGROUPS\t16\n\n/*\n * Flags for cr_flags.\n */\n#define\tCRED_FLAG_CAPMODE\t0x00000001\t/* In capability mode. */\n\n/*\n * This is the external representation of struct ucred.\n */\nstruct xucred {\n\tu_int\tcr_version;\t\t/* structure layout version */\n\tuid_t\tcr_uid;\t\t\t/* effective user id */\n\tshort\tcr_ngroups;\t\t/* number of groups */\n\tgid_t\tcr_groups[XU_NGROUPS];\t/* groups */\n\tvoid\t*_cr_unused1;\t\t/* compatibility with old ucred */\n};\n#define\tXUCRED_VERSION\t0\n\n/* This can be used for both ucred and xucred structures. */\n#define\tcr_gid cr_groups[0]\n\n#ifdef _KERNEL\nstruct proc;\nstruct thread;\n\nvoid\tchange_egid(struct ucred *newcred, gid_t egid);\nvoid\tchange_euid(struct ucred *newcred, struct uidinfo *euip);\nvoid\tchange_rgid(struct ucred *newcred, gid_t rgid);\nvoid\tchange_ruid(struct ucred *newcred, struct uidinfo *ruip);\nvoid\tchange_svgid(struct ucred *newcred, gid_t svgid);\nvoid\tchange_svuid(struct ucred *newcred, uid_t svuid);\nvoid\tcrcopy(struct ucred *dest, struct ucred *src);\nstruct ucred\t*crcopysafe(struct proc *p, struct ucred *cr);\nstruct ucred\t*crdup(struct ucred *cr);\nvoid\tcred_update_thread(struct thread *td);\nvoid\tcrfree(struct ucred *cr);\nstruct ucred\t*crget(void);\nstruct ucred\t*crhold(struct ucred *cr);\nint\tcrshared(struct ucred *cr);\nvoid\tcru2x(struct ucred *cr, struct xucred *xcr);\nvoid\tcrsetgroups(struct ucred *cr, int n, gid_t *groups);\nint\tgroupmember(gid_t gid, struct ucred *cred);\n#endif /* _KERNEL */\n\n#endif /* !_SYS_UCRED_H_ */\n"
  },
  {
    "path": "freebsd-headers/sys/uio.h",
    "content": "/*-\n * Copyright (c) 1982, 1986, 1993, 1994\n *\tThe Regents of the University of California.  All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 4. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t@(#)uio.h\t8.5 (Berkeley) 2/22/94\n * $FreeBSD: release/9.0.0/sys/sys/uio.h 223889 2011-07-09 15:21:10Z kib $\n */\n\n#ifndef _SYS_UIO_H_\n#define\t_SYS_UIO_H_\n\n#include <sys/cdefs.h>\n#include <sys/_types.h>\n#include <sys/_iovec.h>\n\n#ifndef _SSIZE_T_DECLARED\ntypedef\t__ssize_t\tssize_t;\n#define\t_SSIZE_T_DECLARED\n#endif\n\n#ifndef _OFF_T_DECLARED\ntypedef\t__off_t\toff_t;\n#define\t_OFF_T_DECLARED\n#endif\n\n#if __BSD_VISIBLE\nenum\tuio_rw { UIO_READ, UIO_WRITE };\n\n/* Segment flag values. */\nenum uio_seg {\n\tUIO_USERSPACE,\t\t/* from user data space */\n\tUIO_SYSSPACE,\t\t/* from system space */\n\tUIO_NOCOPY\t\t/* don't copy, already in object */\n};\n#endif\n\n#ifdef _KERNEL\n\nstruct uio {\n\tstruct\tiovec *uio_iov;\t\t/* scatter/gather list */\n\tint\tuio_iovcnt;\t\t/* length of scatter/gather list */\n\toff_t\tuio_offset;\t\t/* offset in target object */\n\tssize_t\tuio_resid;\t\t/* remaining bytes to process */\n\tenum\tuio_seg uio_segflg;\t/* address space */\n\tenum\tuio_rw uio_rw;\t\t/* operation */\n\tstruct\tthread *uio_td;\t\t/* owner */\n};\n\n/*\n * Limits\n *\n * N.B.: UIO_MAXIOV must be no less than IOV_MAX from <sys/syslimits.h>\n * which in turn must be no less than _XOPEN_IOV_MAX from <limits.h>.  If\n * we ever make this tunable (probably pointless), then IOV_MAX should be\n * removed from <sys/syslimits.h> and applications would be expected to use\n * sysconf(3) to find out the correct value, or else assume the worst\n * (_XOPEN_IOV_MAX).  Perhaps UIO_MAXIOV should be simply defined as\n * IOV_MAX.\n */\n#define UIO_MAXIOV\t1024\t\t/* max 1K of iov's */\n\nstruct vm_object;\nstruct vm_page;\n\nstruct uio *cloneuio(struct uio *uiop);\nint\tcopyinfrom(const void * __restrict src, void * __restrict dst,\n\t    size_t len, int seg);\nint\tcopyiniov(struct iovec *iovp, u_int iovcnt, struct iovec **iov,\n\t    int error);\nint\tcopyinstrfrom(const void * __restrict src, void * __restrict dst,\n\t    size_t len, size_t * __restrict copied, int seg);\nint\tcopyinuio(struct iovec *iovp, u_int iovcnt, struct uio **uiop);\nint\tcopyout_map(struct thread *td, vm_offset_t *addr, size_t sz);\nint\tcopyout_unmap(struct thread *td, vm_offset_t addr, size_t sz);\nint\tuiomove(void *cp, int n, struct uio *uio);\nint\tuiomove_frombuf(void *buf, int buflen, struct uio *uio);\nint\tuiomove_fromphys(struct vm_page *ma[], vm_offset_t offset, int n,\n\t    struct uio *uio);\nint\tuiomove_nofault(void *cp, int n, struct uio *uio);\nint\tuiomoveco(void *cp, int n, struct uio *uio, int disposable);\n\n#else /* !_KERNEL */\n\n__BEGIN_DECLS\nssize_t\treadv(int, const struct iovec *, int);\nssize_t\twritev(int, const struct iovec *, int);\n#if __BSD_VISIBLE\nssize_t\tpreadv(int, const struct iovec *, int, off_t);\nssize_t\tpwritev(int, const struct iovec *, int, off_t);\n#endif\n__END_DECLS\n\n#endif /* _KERNEL */\n\n#endif /* !_SYS_UIO_H_ */\n"
  },
  {
    "path": "freebsd-headers/sys/umtx.h",
    "content": "/*-\n * Copyright (c) 2002, Jeffrey Roberson <jeff@freebsd.org>\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice unmodified, this list of conditions, and the following\n *    disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR\n * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES\n * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,\n * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF\n * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/sys/umtx.h 218970 2011-02-23 13:23:28Z jhb $\n *\n */\n\n#ifndef _SYS_UMTX_H_\n#define\t_SYS_UMTX_H_\n\n#include <sys/_umtx.h>\n#include <sys/limits.h>\n\n#define\tUMTX_UNOWNED\t\t0x0\n#define\tUMTX_CONTESTED\t\tLONG_MIN\n\n#define USYNC_PROCESS_SHARED\t0x0001\t/* Process shared sync objs */\n\n#define\tUMUTEX_UNOWNED\t\t0x0\n#define\tUMUTEX_CONTESTED\t0x80000000U\n\n#define\tUMUTEX_ERROR_CHECK\t0x0002\t/* Error-checking mutex */\n#define\tUMUTEX_PRIO_INHERIT\t0x0004\t/* Priority inherited mutex */\n#define\tUMUTEX_PRIO_PROTECT\t0x0008\t/* Priority protect mutex */\n\n/* urwlock flags */\n#define URWLOCK_PREFER_READER\t0x0002\n\n#define URWLOCK_WRITE_OWNER\t0x80000000U\n#define URWLOCK_WRITE_WAITERS\t0x40000000U\n#define URWLOCK_READ_WAITERS\t0x20000000U\n#define URWLOCK_MAX_READERS\t0x1fffffffU\n#define URWLOCK_READER_COUNT(c)\t((c) & URWLOCK_MAX_READERS)\n\n/* _usem flags */\n#define SEM_NAMED\t0x0002\n\n/* op code for _umtx_op */\n#define\tUMTX_OP_LOCK\t\t0\n#define\tUMTX_OP_UNLOCK\t\t1\n#define\tUMTX_OP_WAIT\t\t2\n#define\tUMTX_OP_WAKE\t\t3\n#define\tUMTX_OP_MUTEX_TRYLOCK\t4\n#define\tUMTX_OP_MUTEX_LOCK\t5\n#define\tUMTX_OP_MUTEX_UNLOCK\t6\n#define\tUMTX_OP_SET_CEILING\t7\n#define\tUMTX_OP_CV_WAIT\t\t8\n#define\tUMTX_OP_CV_SIGNAL\t9\n#define\tUMTX_OP_CV_BROADCAST\t10\n#define\tUMTX_OP_WAIT_UINT\t11\n#define\tUMTX_OP_RW_RDLOCK\t12\n#define\tUMTX_OP_RW_WRLOCK\t13\n#define\tUMTX_OP_RW_UNLOCK\t14\n#define\tUMTX_OP_WAIT_UINT_PRIVATE\t15\n#define\tUMTX_OP_WAKE_PRIVATE\t16\n#define\tUMTX_OP_MUTEX_WAIT\t17\n#define\tUMTX_OP_MUTEX_WAKE\t18\n#define\tUMTX_OP_SEM_WAIT\t19\n#define\tUMTX_OP_SEM_WAKE\t20\n#define\tUMTX_OP_NWAKE_PRIVATE   21\n#define\tUMTX_OP_MAX\t\t22\n\n/* Flags for UMTX_OP_CV_WAIT */\n#define\tCVWAIT_CHECK_UNPARKING\t0x01\n#define\tCVWAIT_ABSTIME\t\t0x02\n#define\tCVWAIT_CLOCKID\t\t0x04\n\n#define\tUMTX_CHECK_UNPARKING\tCVWAIT_CHECK_UNPARKING\n\n#ifndef _KERNEL\n\nint _umtx_op(void *obj, int op, u_long val, void *uaddr, void *uaddr2);\n\n/*\n * Old (deprecated) userland mutex system calls.\n */\nint _umtx_lock(struct umtx *mtx);\nint _umtx_unlock(struct umtx *mtx);\n\n/*\n * Standard api.  Try uncontested acquire/release and asks the\n * kernel to resolve failures.\n */\nstatic __inline void\numtx_init(struct umtx *umtx)\n{\n\tumtx->u_owner = UMTX_UNOWNED;\n}\n\nstatic __inline u_long\numtx_owner(struct umtx *umtx)\n{\n\treturn (umtx->u_owner & ~LONG_MIN);\n}\n\nstatic __inline int\numtx_lock(struct umtx *umtx, u_long id)\n{\n\tif (atomic_cmpset_acq_long(&umtx->u_owner, UMTX_UNOWNED, id) == 0)\n\t\tif (_umtx_lock(umtx) == -1)\n\t\t\treturn (errno);\n\treturn (0);\n}\n\nstatic __inline int\numtx_trylock(struct umtx *umtx, u_long id)\n{\n\tif (atomic_cmpset_acq_long(&umtx->u_owner, UMTX_UNOWNED, id) == 0)\n\t\treturn (EBUSY);\n\treturn (0);\n}\n\nstatic __inline int\numtx_timedlock(struct umtx *umtx, u_long id, const struct timespec *timeout)\n{\n\tif (atomic_cmpset_acq_long(&umtx->u_owner, UMTX_UNOWNED, id) == 0)\n\t\tif (_umtx_op(umtx, UMTX_OP_LOCK, id, 0,\n\t\t    __DECONST(void *, timeout)) == -1)\n\t\t\treturn (errno);\n\treturn (0);\n}\n\nstatic __inline int\numtx_unlock(struct umtx *umtx, u_long id)\n{\n\tif (atomic_cmpset_rel_long(&umtx->u_owner, id, UMTX_UNOWNED) == 0)\n\t\tif (_umtx_unlock(umtx) == -1)\n\t\t\treturn (errno);\n\treturn (0);\n}\n\nstatic __inline int\numtx_wait(u_long *p, long val, const struct timespec *timeout)\n{\n\tif (_umtx_op(p, UMTX_OP_WAIT, val, 0,\n\t    __DECONST(void *, timeout)) == -1)\n\t\treturn (errno);\n\treturn (0);\n}\n\n/* Wake threads waiting on a user address. */\nstatic __inline int\numtx_wake(u_long *p, int nr_wakeup)\n{\n\tif (_umtx_op(p, UMTX_OP_WAKE, nr_wakeup, 0, 0) == -1)\n\t\treturn (errno);\n\treturn (0);\n}\n\n#else\n\n/*\n * The umtx_key structure is used by both the Linux futex code and the\n * umtx implementation to map userland addresses to unique keys.\n */\n\nenum {\n\tTYPE_SIMPLE_WAIT,\n\tTYPE_CV,\n\tTYPE_SEM,\n\tTYPE_SIMPLE_LOCK,\n\tTYPE_NORMAL_UMUTEX,\n\tTYPE_PI_UMUTEX,\n\tTYPE_PP_UMUTEX,\n\tTYPE_RWLOCK,\n\tTYPE_FUTEX\n};\n\n/* Key to represent a unique userland synchronous object */\nstruct umtx_key {\n\tint\thash;\n\tint\ttype;\n\tint\tshared;\n\tunion {\n\t\tstruct {\n\t\t\tstruct vm_object *object;\n\t\t\tuintptr_t\toffset;\n\t\t} shared;\n\t\tstruct {\n\t\t\tstruct vmspace\t*vs;\n\t\t\tuintptr_t\taddr;\n\t\t} private;\n\t\tstruct {\n\t\t\tvoid\t\t*a;\n\t\t\tuintptr_t\tb;\n\t\t} both;\n\t} info;\n};\n\n#define THREAD_SHARE\t\t0\n#define PROCESS_SHARE\t\t1\n#define AUTO_SHARE\t\t2\n\nstruct thread;\n\nstatic inline int\numtx_key_match(const struct umtx_key *k1, const struct umtx_key *k2)\n{\n\treturn (k1->type == k2->type &&\n\t\tk1->info.both.a == k2->info.both.a &&\n\t        k1->info.both.b == k2->info.both.b);\n}\n\nint umtx_key_get(void *, int, int, struct umtx_key *);\nvoid umtx_key_release(struct umtx_key *);\nstruct umtx_q *umtxq_alloc(void);\nvoid umtxq_free(struct umtx_q *);\nint kern_umtx_wake(struct thread *, void *, int, int);\nvoid umtx_pi_adjust(struct thread *, u_char);\nvoid umtx_thread_init(struct thread *);\nvoid umtx_thread_fini(struct thread *);\nvoid umtx_thread_alloc(struct thread *);\nvoid umtx_thread_exit(struct thread *);\n#endif /* !_KERNEL */\n#endif /* !_SYS_UMTX_H_ */\n"
  },
  {
    "path": "freebsd-headers/sys/un.h",
    "content": "/*-\n * Copyright (c) 1982, 1986, 1993\n *\tThe Regents of the University of California.  All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 4. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t@(#)un.h\t8.3 (Berkeley) 2/19/95\n * $FreeBSD: release/9.0.0/sys/sys/un.h 183650 2008-10-06 18:43:11Z rwatson $\n */\n\n#ifndef _SYS_UN_H_\n#define _SYS_UN_H_\n\n#include <sys/cdefs.h>\n#include <sys/_types.h>\n\n#ifndef _SA_FAMILY_T_DECLARED\ntypedef\t__sa_family_t\tsa_family_t;\n#define\t_SA_FAMILY_T_DECLARED\n#endif\n\n/*\n * Definitions for UNIX IPC domain.\n */\nstruct sockaddr_un {\n\tunsigned char\tsun_len;\t/* sockaddr len including null */\n\tsa_family_t\tsun_family;\t/* AF_UNIX */\n\tchar\tsun_path[104];\t\t/* path name (gag) */\n};\n\n#if __BSD_VISIBLE\n\n/* Socket options. */\n#define\tLOCAL_PEERCRED\t\t0x001\t/* retrieve peer credentials */\n#define\tLOCAL_CREDS\t\t0x002\t/* pass credentials to receiver */\n#define\tLOCAL_CONNWAIT\t\t0x004\t/* connects block until accepted */\n\n#ifndef _KERNEL\n\n/* actual length of an initialized sockaddr_un */\n#define SUN_LEN(su) \\\n\t(sizeof(*(su)) - sizeof((su)->sun_path) + strlen((su)->sun_path))\n\n#endif /* !_KERNEL */\n\n#endif /* __BSD_VISIBLE */\n\n#endif /* !_SYS_UN_H_ */\n"
  },
  {
    "path": "freebsd-headers/sys/unistd.h",
    "content": "/*-\n * Copyright (c) 1989, 1993\n *\tThe Regents of the University of California.  All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 4. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t@(#)unistd.h\t8.2 (Berkeley) 1/7/94\n * $FreeBSD: release/9.0.0/sys/sys/unistd.h 224987 2011-08-18 22:51:30Z jonathan $\n */\n\n#ifndef _SYS_UNISTD_H_\n#define\t_SYS_UNISTD_H_\n\n#include <sys/cdefs.h>\n\n/*\n * POSIX options and option groups we unconditionally do or don't\n * implement.  Those options which are implemented (or not) entirely\n * in user mode are defined in <unistd.h>.  Please keep this list in\n * alphabetical order.\n *\n * Anything which is defined as zero below **must** have an\n * implementation for the corresponding sysconf() which is able to\n * determine conclusively whether or not the feature is supported.\n * Anything which is defined as other than -1 below **must** have\n * complete headers, types, and function declarations as specified by\n * the POSIX standard; however, if the relevant sysconf() function\n * returns -1, the functions may be stubbed out.\n */\n#define\t_POSIX_ADVISORY_INFO\t\t-1\n#define\t_POSIX_ASYNCHRONOUS_IO\t\t0\n#define\t_POSIX_CHOWN_RESTRICTED\t\t1\n#define\t_POSIX_CLOCK_SELECTION\t\t-1\n#define\t_POSIX_CPUTIME\t\t\t-1\n#define\t_POSIX_FSYNC\t\t\t200112L\n#define\t_POSIX_IPV6\t\t\t0\n#define\t_POSIX_JOB_CONTROL\t\t1\n#define\t_POSIX_MAPPED_FILES\t\t200112L\n#define\t_POSIX_MEMLOCK\t\t\t-1\n#define\t_POSIX_MEMLOCK_RANGE\t\t200112L\n#define\t_POSIX_MEMORY_PROTECTION\t200112L\n#define\t_POSIX_MESSAGE_PASSING\t\t200112L\n#define\t_POSIX_MONOTONIC_CLOCK\t\t200112L\n#define\t_POSIX_NO_TRUNC\t\t\t1\n#define\t_POSIX_PRIORITIZED_IO\t\t-1\n#define\t_POSIX_PRIORITY_SCHEDULING\t200112L\n#define\t_POSIX_RAW_SOCKETS\t\t200112L\n#define\t_POSIX_REALTIME_SIGNALS\t\t200112L\n#define\t_POSIX_SEMAPHORES\t\t200112L\n#define\t_POSIX_SHARED_MEMORY_OBJECTS\t200112L\n#define\t_POSIX_SPORADIC_SERVER\t\t-1\n#define\t_POSIX_SYNCHRONIZED_IO\t\t-1\n#define\t_POSIX_TIMEOUTS\t\t\t200112L\n#define\t_POSIX_TIMERS\t\t\t200112L\n#define\t_POSIX_TYPED_MEMORY_OBJECTS\t-1\n#define\t_POSIX_VDISABLE\t\t\t0xff\n\n#if __XSI_VISIBLE\n#define\t_XOPEN_SHM\t\t\t1\n#define\t_XOPEN_STREAMS\t\t\t-1\n#endif\n\n/*\n * Although we have saved user/group IDs, we do not use them in setuid\n * as described in POSIX 1003.1, because the feature does not work for\n * root.  We use the saved IDs in seteuid/setegid, which are not currently\n * part of the POSIX 1003.1 specification.  XXX revisit for 1003.1-2001\n * as this is now mandatory.\n */\n#ifdef\t_NOT_AVAILABLE\n#define\t_POSIX_SAVED_IDS\t1 /* saved set-user-ID and set-group-ID */\n#endif\n\n/* Define the POSIX.1 version we target for compliance. */\n#define\t_POSIX_VERSION\t\t200112L\n\n/* access function */\n#define\tF_OK\t\t0\t/* test for existence of file */\n#define\tX_OK\t\t0x01\t/* test for execute or search permission */\n#define\tW_OK\t\t0x02\t/* test for write permission */\n#define\tR_OK\t\t0x04\t/* test for read permission */\n\n/* whence values for lseek(2) */\n#ifndef SEEK_SET\n#define\tSEEK_SET\t0\t/* set file offset to offset */\n#define\tSEEK_CUR\t1\t/* set file offset to current plus offset */\n#define\tSEEK_END\t2\t/* set file offset to EOF plus offset */\n#endif\n#if __BSD_VISIBLE\n#define\tSEEK_DATA\t3\t/* set file offset to next data past offset */\n#define\tSEEK_HOLE\t4\t/* set file offset to next hole past offset */\n#endif\n\n#ifndef _POSIX_SOURCE\n/* whence values for lseek(2); renamed by POSIX 1003.1 */\n#define\tL_SET\t\tSEEK_SET\n#define\tL_INCR\t\tSEEK_CUR\n#define\tL_XTND\t\tSEEK_END\n#endif\n\n/* configurable pathname variables */\n#define\t_PC_LINK_MAX\t\t 1\n#define\t_PC_MAX_CANON\t\t 2\n#define\t_PC_MAX_INPUT\t\t 3\n#define\t_PC_NAME_MAX\t\t 4\n#define\t_PC_PATH_MAX\t\t 5\n#define\t_PC_PIPE_BUF\t\t 6\n#define\t_PC_CHOWN_RESTRICTED\t 7\n#define\t_PC_NO_TRUNC\t\t 8\n#define\t_PC_VDISABLE\t\t 9\n\n#if __POSIX_VISIBLE >= 199309\n#define\t_PC_ASYNC_IO\t\t53\n#define\t_PC_PRIO_IO\t\t54\n#define\t_PC_SYNC_IO\t\t55\n#endif\n\n#if __POSIX_VISIBLE >= 200112\n#define\t_PC_ALLOC_SIZE_MIN\t10\n#define\t_PC_FILESIZEBITS\t12\n#define\t_PC_REC_INCR_XFER_SIZE\t14\n#define\t_PC_REC_MAX_XFER_SIZE\t15\n#define\t_PC_REC_MIN_XFER_SIZE\t16\n#define\t_PC_REC_XFER_ALIGN\t17\n#define\t_PC_SYMLINK_MAX\t\t18\n#endif\n\n#if __BSD_VISIBLE\n#define\t_PC_ACL_EXTENDED\t59\n#define\t_PC_ACL_PATH_MAX\t60\n#define\t_PC_CAP_PRESENT\t\t61\n#define\t_PC_INF_PRESENT\t\t62\n#define\t_PC_MAC_PRESENT\t\t63\n#define\t_PC_ACL_NFS4\t\t64\n#endif\n\n/* From OpenSolaris, used by SEEK_DATA/SEEK_HOLE. */\n#define\t_PC_MIN_HOLE_SIZE\t21\n\n#if __BSD_VISIBLE\n/*\n * rfork() options.\n *\n * XXX currently, some operations without RFPROC set are not supported.\n */\n#define\tRFNAMEG\t\t(1<<0)\t/* UNIMPL new plan9 `name space' */\n#define\tRFENVG\t\t(1<<1)\t/* UNIMPL copy plan9 `env space' */\n#define\tRFFDG\t\t(1<<2)\t/* copy fd table */\n#define\tRFNOTEG\t\t(1<<3)\t/* UNIMPL create new plan9 `note group' */\n#define\tRFPROC\t\t(1<<4)\t/* change child (else changes curproc) */\n#define\tRFMEM\t\t(1<<5)\t/* share `address space' */\n#define\tRFNOWAIT\t(1<<6)\t/* give child to init */\n#define\tRFCNAMEG\t(1<<10)\t/* UNIMPL zero plan9 `name space' */\n#define\tRFCENVG\t\t(1<<11)\t/* UNIMPL zero plan9 `env space' */\n#define\tRFCFDG\t\t(1<<12)\t/* close all fds, zero fd table */\n#define\tRFTHREAD\t(1<<13)\t/* enable kernel thread support */\n#define\tRFSIGSHARE\t(1<<14)\t/* share signal handlers */\n#define\tRFLINUXTHPN\t(1<<16)\t/* do linux clone exit parent notification */\n#define\tRFSTOPPED\t(1<<17)\t/* leave child in a stopped state */\n#define\tRFHIGHPID\t(1<<18)\t/* use a pid higher than 10 (idleproc) */\n#define\tRFTSIGZMB\t(1<<19)\t/* select signal for exit parent notification */\n#define\tRFTSIGSHIFT\t20\t/* selected signal number is in bits 20-27  */\n#define\tRFTSIGMASK\t0xFF\n#define\tRFTSIGNUM(flags)\t(((flags) >> RFTSIGSHIFT) & RFTSIGMASK)\n#define\tRFTSIGFLAGS(signum)\t((signum) << RFTSIGSHIFT)\n#define\tRFPROCDESC\t(1<<28)\t/* return a process descriptor */\n#define\tRFPPWAIT\t(1<<31)\t/* parent sleeps until child exits (vfork) */\n#define\tRFFLAGS\t\t(RFFDG | RFPROC | RFMEM | RFNOWAIT | RFCFDG | \\\n    RFTHREAD | RFSIGSHARE | RFLINUXTHPN | RFSTOPPED | RFHIGHPID | RFTSIGZMB | \\\n    RFPROCDESC | RFPPWAIT)\n#define\tRFKERNELONLY\t(RFSTOPPED | RFHIGHPID | RFPPWAIT | RFPROCDESC)\n\n#endif /* __BSD_VISIBLE */\n\n#endif /* !_SYS_UNISTD_H_ */\n"
  },
  {
    "path": "freebsd-headers/sys/unpcb.h",
    "content": "/*-\n * Copyright (c) 1982, 1986, 1989, 1993\n *\tThe Regents of the University of California.  All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 4. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t@(#)unpcb.h\t8.1 (Berkeley) 6/2/93\n * $FreeBSD: release/9.0.0/sys/sys/unpcb.h 174988 2007-12-30 01:42:15Z jeff $\n */\n\n#ifndef _SYS_UNPCB_H_\n#define _SYS_UNPCB_H_\n\n#include <sys/queue.h>\n#include <sys/ucred.h>\n\n/*\n * Protocol control block for an active\n * instance of a UNIX internal protocol.\n *\n * A socket may be associated with a vnode in the\n * filesystem.  If so, the unp_vnode pointer holds\n * a reference count to this vnode, which should be irele'd\n * when the socket goes away.\n *\n * A socket may be connected to another socket, in which\n * case the control block of the socket to which it is connected\n * is given by unp_conn.\n *\n * A socket may be referenced by a number of sockets (e.g. several\n * sockets may be connected to a datagram socket.)  These sockets\n * are in a linked list starting with unp_refs, linked through\n * unp_nextref and null-terminated.  Note that a socket may be referenced\n * by a number of other sockets and may also reference a socket (not\n * necessarily one which is referencing it).  This generates\n * the need for unp_refs and unp_nextref to be separate fields.\n *\n * Stream sockets keep copies of receive sockbuf sb_cc and sb_mbcnt\n * so that changes in the sockbuf may be computed to modify\n * back pressure on the sender accordingly.\n */\ntypedef\tu_quad_t\tunp_gen_t;\nLIST_HEAD(unp_head, unpcb);\n\nstruct unpcb {\n\tLIST_ENTRY(unpcb) unp_link; \t/* glue on list of all PCBs */\n\tstruct\tsocket *unp_socket;\t/* pointer back to socket */\n\tstruct\tfile *unp_file;\t\t/* back-pointer to file for gc. */\n\tstruct\tvnode *unp_vnode;\t/* if associated with file */\n\tino_t\tunp_ino;\t\t/* fake inode number */\n\tstruct\tunpcb *unp_conn;\t/* control block of connected socket */\n\tstruct\tunp_head unp_refs;\t/* referencing socket linked list */\n\tLIST_ENTRY(unpcb) unp_reflink;\t/* link in unp_refs list */\n\tstruct\tsockaddr_un *unp_addr;\t/* bound address of socket */\n\tint\tunp_cc;\t\t\t/* copy of rcv.sb_cc */\n\tint\tunp_mbcnt;\t\t/* copy of rcv.sb_mbcnt */\n\tunp_gen_t unp_gencnt;\t\t/* generation count of this instance */\n\tshort\tunp_flags;\t\t/* flags */\n\tshort\tunp_gcflag;\t\t/* Garbage collector flags. */\n\tstruct\txucred unp_peercred;\t/* peer credentials, if applicable */\n\tu_int\tunp_refcount;\n\tu_int\tunp_msgcount;\t\t/* references from message queue */\n\tstruct\tmtx unp_mtx;\t\t/* mutex */\n};\n\n/*\n * Flags in unp_flags.\n *\n * UNP_HAVEPC - indicates that the unp_peercred member is filled in\n * and is really the credentials of the connected peer.  This is used\n * to determine whether the contents should be sent to the user or\n * not.\n *\n * UNP_HAVEPCCACHED - indicates that the unp_peercred member is filled\n * in, but does *not* contain the credentials of the connected peer\n * (there may not even be a peer).  This is set in unp_listen() when\n * it fills in unp_peercred for later consumption by unp_connect().\n */\n#define UNP_HAVEPC\t\t\t0x001\n#define UNP_HAVEPCCACHED\t\t0x002\n#define\tUNP_WANTCRED\t\t\t0x004\t/* credentials wanted */\n#define\tUNP_CONNWAIT\t\t\t0x008\t/* connect blocks until accepted */\n\n#define\tUNPGC_REF\t\t\t0x1\t/* unpcb has external ref. */\n#define\tUNPGC_DEAD\t\t\t0x2\t/* unpcb might be dead. */\n#define\tUNPGC_SCANNED\t\t\t0x4\t/* Has been scanned. */\n\n/*\n * These flags are used to handle non-atomicity in connect() and bind()\n * operations on a socket: in particular, to avoid races between multiple\n * threads or processes operating simultaneously on the same socket.\n */\n#define\tUNP_CONNECTING\t\t\t0x010\t/* Currently connecting. */\n#define\tUNP_BINDING\t\t\t0x020\t/* Currently binding. */\n\n#define\tsotounpcb(so)\t((struct unpcb *)((so)->so_pcb))\n\n/* Hack alert -- this structure depends on <sys/socketvar.h>. */\n#ifdef\t_SYS_SOCKETVAR_H_\nstruct xunpcb {\n\tsize_t\txu_len;\t\t\t/* length of this structure */\n\tstruct\tunpcb *xu_unpp;\t\t/* to help netstat, fstat */\n\tstruct\tunpcb xu_unp;\t\t/* our information */\n\tunion {\n\t\tstruct\tsockaddr_un xuu_addr;\t/* our bound address */\n\t\tchar\txu_dummy1[256];\n\t} xu_au;\n#define\txu_addr\txu_au.xuu_addr\n\tunion {\n\t\tstruct\tsockaddr_un xuu_caddr; /* their bound address */\n\t\tchar\txu_dummy2[256];\n\t} xu_cau;\n#define\txu_caddr xu_cau.xuu_caddr\n\tstruct\txsocket\txu_socket;\n\tu_quad_t\txu_alignment_hack;\n};\n\nstruct xunpgen {\n\tsize_t\txug_len;\n\tu_int\txug_count;\n\tunp_gen_t xug_gen;\n\tso_gen_t xug_sogen;\n};\n#endif /* _SYS_SOCKETVAR_H_ */\n\n#endif /* _SYS_UNPCB_H_ */\n"
  },
  {
    "path": "freebsd-headers/sys/user.h",
    "content": "/*-\n * Copyright (c) 1982, 1986, 1989, 1991, 1993\n *\tThe Regents of the University of California.\n * Copyright (c) 2007 Robert N. M. Watson\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 4. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t@(#)user.h\t8.2 (Berkeley) 9/23/93\n * $FreeBSD: release/9.0.0/sys/sys/user.h 224987 2011-08-18 22:51:30Z jonathan $\n */\n\n#ifndef _SYS_USER_H_\n#define _SYS_USER_H_\n\n#include <machine/pcb.h>\n#ifndef _KERNEL\n/* stuff that *used* to be included by user.h, or is now needed */\n#include <sys/errno.h>\n#include <sys/time.h>\n#include <sys/resource.h>\n#include <sys/ucred.h>\n#include <sys/uio.h>\n#include <sys/queue.h>\n#include <sys/_lock.h>\n#include <sys/_mutex.h>\n#include <sys/proc.h>\n#include <vm/vm.h>\t\t/* XXX */\n#include <vm/vm_param.h>\t/* XXX */\n#include <vm/pmap.h>\t\t/* XXX */\n#include <vm/vm_map.h>\t\t/* XXX */\n#endif /* !_KERNEL */\n#ifndef _SYS_RESOURCEVAR_H_\n#include <sys/resourcevar.h>\n#endif\n#ifndef _SYS_SIGNALVAR_H_\n#include <sys/signalvar.h>\n#endif\n#ifndef _SYS_SOCKET_VAR_H_\n#include <sys/socket.h>\n#endif\n\n/*\n * KERN_PROC subtype ops return arrays of selected proc structure entries:\n *\n * This struct includes several arrays of spare space, with different arrays\n * for different standard C-types.  When adding new variables to this struct,\n * the space for byte-aligned data should be taken from the ki_sparestring,\n * pointers from ki_spareptrs, word-aligned data from ki_spareints, and\n * doubleword-aligned data from ki_sparelongs.  Make sure the space for new\n * variables come from the array which matches the size and alignment of\n * those variables on ALL hardware platforms, and then adjust the appropriate\n * KI_NSPARE_* value(s) to match.\n *\n * Always verify that sizeof(struct kinfo_proc) == KINFO_PROC_SIZE on all\n * platforms after you have added new variables.  Note that if you change\n * the value of KINFO_PROC_SIZE, then many userland programs will stop\n * working until they are recompiled!\n *\n * Once you have added the new field, you will need to add code to initialize\n * it in two places: function fill_kinfo_proc in sys/kern/kern_proc.c and\n * function kvm_proclist in lib/libkvm/kvm_proc.c .\n */\n#define\tKI_NSPARE_INT\t9\n#define\tKI_NSPARE_LONG\t12\n#define\tKI_NSPARE_PTR\t6\n\n#ifndef _KERNEL\n#ifndef KINFO_PROC_SIZE\n#error \"Unknown architecture\"\n#endif\n#endif /* !_KERNEL */\n\n#define\tWMESGLEN\t8\t\t/* size of returned wchan message */\n#define\tLOCKNAMELEN\t8\t\t/* size of returned lock name */\n#define\tTDNAMLEN\t16\t\t/* size of returned thread name */\n#define\tCOMMLEN\t\t19\t\t/* size of returned ki_comm name */\n#define\tKI_EMULNAMELEN\t16\t\t/* size of returned ki_emul */\n#define KI_NGROUPS\t16\t\t/* number of groups in ki_groups */\n#define\tLOGNAMELEN\t17\t\t/* size of returned ki_login */\n#define\tLOGINCLASSLEN\t17\t\t/* size of returned ki_loginclass */\n\n#ifndef BURN_BRIDGES\n#define\tOCOMMLEN\tTDNAMLEN\t\n#define\tki_ocomm\tki_tdname\n#endif\n\n/* Flags for the process credential. */\n#define\tKI_CRF_CAPABILITY_MODE\t0x00000001\n/*\n * Steal a bit from ki_cr_flags to indicate that the cred had more than\n * KI_NGROUPS groups.\n */\n#define KI_CRF_GRP_OVERFLOW\t0x80000000\n\nstruct kinfo_proc {\n\tint\tki_structsize;\t\t/* size of this structure */\n\tint\tki_layout;\t\t/* reserved: layout identifier */\n\tstruct\tpargs *ki_args;\t\t/* address of command arguments */\n\tstruct\tproc *ki_paddr;\t\t/* address of proc */\n\tstruct\tuser *ki_addr;\t\t/* kernel virtual addr of u-area */\n\tstruct\tvnode *ki_tracep;\t/* pointer to trace file */\n\tstruct\tvnode *ki_textvp;\t/* pointer to executable file */\n\tstruct\tfiledesc *ki_fd;\t/* pointer to open file info */\n\tstruct\tvmspace *ki_vmspace;\t/* pointer to kernel vmspace struct */\n\tvoid\t*ki_wchan;\t\t/* sleep address */\n\tpid_t\tki_pid;\t\t\t/* Process identifier */\n\tpid_t\tki_ppid;\t\t/* parent process id */\n\tpid_t\tki_pgid;\t\t/* process group id */\n\tpid_t\tki_tpgid;\t\t/* tty process group id */\n\tpid_t\tki_sid;\t\t\t/* Process session ID */\n\tpid_t\tki_tsid;\t\t/* Terminal session ID */\n\tshort\tki_jobc;\t\t/* job control counter */\n\tshort\tki_spare_short1;\t/* unused (just here for alignment) */\n\tdev_t\tki_tdev;\t\t/* controlling tty dev */\n\tsigset_t ki_siglist;\t\t/* Signals arrived but not delivered */\n\tsigset_t ki_sigmask;\t\t/* Current signal mask */\n\tsigset_t ki_sigignore;\t\t/* Signals being ignored */\n\tsigset_t ki_sigcatch;\t\t/* Signals being caught by user */\n\tuid_t\tki_uid;\t\t\t/* effective user id */\n\tuid_t\tki_ruid;\t\t/* Real user id */\n\tuid_t\tki_svuid;\t\t/* Saved effective user id */\n\tgid_t\tki_rgid;\t\t/* Real group id */\n\tgid_t\tki_svgid;\t\t/* Saved effective group id */\n\tshort\tki_ngroups;\t\t/* number of groups */\n\tshort\tki_spare_short2;\t/* unused (just here for alignment) */\n\tgid_t \tki_groups[KI_NGROUPS];\t/* groups */\n\tvm_size_t ki_size;\t\t/* virtual size */\n\tsegsz_t ki_rssize;\t\t/* current resident set size in pages */\n\tsegsz_t ki_swrss;\t\t/* resident set size before last swap */\n\tsegsz_t ki_tsize;\t\t/* text size (pages) XXX */\n\tsegsz_t ki_dsize;\t\t/* data size (pages) XXX */\n\tsegsz_t ki_ssize;\t\t/* stack size (pages) */\n\tu_short\tki_xstat;\t\t/* Exit status for wait & stop signal */\n\tu_short\tki_acflag;\t\t/* Accounting flags */\n\tfixpt_t\tki_pctcpu;\t \t/* %cpu for process during ki_swtime */\n\tu_int\tki_estcpu;\t \t/* Time averaged value of ki_cpticks */\n\tu_int\tki_slptime;\t \t/* Time since last blocked */\n\tu_int\tki_swtime;\t \t/* Time swapped in or out */\n\tint\tki_spareint1;\t \t/* unused (just here for alignment) */\n\tu_int64_t ki_runtime;\t\t/* Real time in microsec */\n\tstruct\ttimeval ki_start;\t/* starting time */\n\tstruct\ttimeval ki_childtime;\t/* time used by process children */\n\tlong\tki_flag;\t\t/* P_* flags */\n\tlong\tki_kiflag;\t\t/* KI_* flags (below) */\n\tint\tki_traceflag;\t\t/* Kernel trace points */\n\tchar\tki_stat;\t\t/* S* process status */\n\tsigned char ki_nice;\t\t/* Process \"nice\" value */\n\tchar\tki_lock;\t\t/* Process lock (prevent swap) count */\n\tchar\tki_rqindex;\t\t/* Run queue index */\n\tu_char\tki_oncpu;\t\t/* Which cpu we are on */\n\tu_char\tki_lastcpu;\t\t/* Last cpu we were on */\n\tchar\tki_tdname[TDNAMLEN+1];\t/* thread name */\n\tchar\tki_wmesg[WMESGLEN+1];\t/* wchan message */\n\tchar\tki_login[LOGNAMELEN+1];\t/* setlogin name */\n\tchar\tki_lockname[LOCKNAMELEN+1]; /* lock name */\n\tchar\tki_comm[COMMLEN+1];\t/* command name */\n\tchar\tki_emul[KI_EMULNAMELEN+1];  /* emulation name */\n\tchar\tki_loginclass[LOGINCLASSLEN+1]; /* login class */\n\t/*\n\t * When adding new variables, take space for char-strings from the\n\t * front of ki_sparestrings, and ints from the end of ki_spareints.\n\t * That way the spare room from both arrays will remain contiguous.\n\t */\n\tchar\tki_sparestrings[50];\t/* spare string space */\n\tint\tki_spareints[KI_NSPARE_INT];\t/* spare room for growth */\n\tu_int\tki_cr_flags;\t\t/* Credential flags */\n\tint\tki_jid;\t\t\t/* Process jail ID */\n\tint\tki_numthreads;\t\t/* XXXKSE number of threads in total */\n\tlwpid_t\tki_tid;\t\t\t/* XXXKSE thread id */\n\tstruct\tpriority ki_pri;\t/* process priority */\n\tstruct\trusage ki_rusage;\t/* process rusage statistics */\n\t/* XXX - most fields in ki_rusage_ch are not (yet) filled in */\n\tstruct\trusage ki_rusage_ch;\t/* rusage of children processes */\n\tstruct\tpcb *ki_pcb;\t\t/* kernel virtual addr of pcb */\n\tvoid\t*ki_kstack;\t\t/* kernel virtual addr of stack */\n\tvoid\t*ki_udata;\t\t/* User convenience pointer */\n\tstruct\tthread *ki_tdaddr;\t/* address of thread */\n\t/*\n\t * When adding new variables, take space for pointers from the\n\t * front of ki_spareptrs, and longs from the end of ki_sparelongs.\n\t * That way the spare room from both arrays will remain contiguous.\n\t */\n\tvoid\t*ki_spareptrs[KI_NSPARE_PTR];\t/* spare room for growth */\n\tlong\tki_sparelongs[KI_NSPARE_LONG];\t/* spare room for growth */\n\tlong\tki_sflag;\t\t/* PS_* flags */\n\tlong\tki_tdflags;\t\t/* XXXKSE kthread flag */\n};\nvoid fill_kinfo_proc(struct proc *, struct kinfo_proc *);\n/* XXX - the following two defines are temporary */\n#define\tki_childstime\tki_rusage_ch.ru_stime\n#define\tki_childutime\tki_rusage_ch.ru_utime\n\n/*\n *  Legacy PS_ flag.  This moved to p_flag but is maintained for\n *  compatibility.\n */\n#define\tPS_INMEM\t0x00001\t\t/* Loaded into memory. */\n\n/* ki_sessflag values */\n#define\tKI_CTTY\t\t0x00000001\t/* controlling tty vnode active */\n#define\tKI_SLEADER\t0x00000002\t/* session leader */\n#define\tKI_LOCKBLOCK\t0x00000004\t/* proc blocked on lock ki_lockname */\n\n/*\n * This used to be the per-process structure containing data that\n * isn't needed in core when the process is swapped out, but now it\n * remains only for the benefit of a.out core dumps.\n */\nstruct user {\n\tstruct\tpstats u_stats;\t\t/* *p_stats */\n\tstruct\tkinfo_proc u_kproc;\t/* eproc */\n};\n\n/*\n * The KERN_PROC_FILE sysctl allows a process to dump the file descriptor\n * array of another process.\n */\n#define\tKF_ATTR_VALID\t0x0001\n\n#define\tKF_TYPE_NONE\t0\n#define\tKF_TYPE_VNODE\t1\n#define\tKF_TYPE_SOCKET\t2\n#define\tKF_TYPE_PIPE\t3\n#define\tKF_TYPE_FIFO\t4\n#define\tKF_TYPE_KQUEUE\t5\n#define\tKF_TYPE_CRYPTO\t6\n#define\tKF_TYPE_MQUEUE\t7\n#define\tKF_TYPE_SHM\t8\n#define\tKF_TYPE_SEM\t9\n#define\tKF_TYPE_PTS\t10\n/* no KF_TYPE_CAPABILITY (11), since capabilities wrap other file objects */\n#define\tKF_TYPE_PROCDESC\t12\n#define\tKF_TYPE_UNKNOWN\t255\n\n#define\tKF_VTYPE_VNON\t0\n#define\tKF_VTYPE_VREG\t1\n#define\tKF_VTYPE_VDIR\t2\n#define\tKF_VTYPE_VBLK\t3\n#define\tKF_VTYPE_VCHR\t4\n#define\tKF_VTYPE_VLNK\t5\n#define\tKF_VTYPE_VSOCK\t6\n#define\tKF_VTYPE_VFIFO\t7\n#define\tKF_VTYPE_VBAD\t8\n#define\tKF_VTYPE_UNKNOWN\t255\n\n#define\tKF_FD_TYPE_CWD\t-1\t/* Current working directory */\n#define\tKF_FD_TYPE_ROOT\t-2\t/* Root directory */\n#define\tKF_FD_TYPE_JAIL\t-3\t/* Jail directory */\n#define\tKF_FD_TYPE_TRACE\t-4\t/* ptrace vnode */\n#define\tKF_FD_TYPE_TEXT\t-5\t/* Text vnode */\n#define\tKF_FD_TYPE_CTTY\t-6\t/* Controlling terminal */\n\n#define\tKF_FLAG_READ\t\t0x00000001\n#define\tKF_FLAG_WRITE\t\t0x00000002\n#define\tKF_FLAG_APPEND\t\t0x00000004\n#define\tKF_FLAG_ASYNC\t\t0x00000008\n#define\tKF_FLAG_FSYNC\t\t0x00000010\n#define\tKF_FLAG_NONBLOCK\t0x00000020\n#define\tKF_FLAG_DIRECT\t\t0x00000040\n#define\tKF_FLAG_HASLOCK\t\t0x00000080\n#define\tKF_FLAG_SHLOCK\t\t0x00000100\n#define\tKF_FLAG_EXLOCK\t\t0x00000200\n#define\tKF_FLAG_NOFOLLOW\t0x00000400\n#define\tKF_FLAG_CREAT\t\t0x00000800\n#define\tKF_FLAG_TRUNC\t\t0x00001000\n#define\tKF_FLAG_EXCL\t\t0x00002000\n#define\tKF_FLAG_EXEC\t\t0x00004000\n#define\tKF_FLAG_CAPABILITY\t0x00008000\n\n/*\n * Old format.  Has variable hidden padding due to alignment.\n * This is a compatability hack for pre-build 7.1 packages.\n */\n#if defined(__amd64__)\n#define\tKINFO_OFILE_SIZE\t1328\n#endif\n#if defined(__i386__)\n#define\tKINFO_OFILE_SIZE\t1324\n#endif\n\nstruct kinfo_ofile {\n\tint\tkf_structsize;\t\t\t/* Size of kinfo_file. */\n\tint\tkf_type;\t\t\t/* Descriptor type. */\n\tint\tkf_fd;\t\t\t\t/* Array index. */\n\tint\tkf_ref_count;\t\t\t/* Reference count. */\n\tint\tkf_flags;\t\t\t/* Flags. */\n\t/* XXX Hidden alignment padding here on amd64 */\n\toff_t\tkf_offset;\t\t\t/* Seek location. */\n\tint\tkf_vnode_type;\t\t\t/* Vnode type. */\n\tint\tkf_sock_domain;\t\t\t/* Socket domain. */\n\tint\tkf_sock_type;\t\t\t/* Socket type. */\n\tint\tkf_sock_protocol;\t\t/* Socket protocol. */\n\tchar\tkf_path[PATH_MAX];\t/* Path to file, if any. */\n\tstruct sockaddr_storage kf_sa_local;\t/* Socket address. */\n\tstruct sockaddr_storage\tkf_sa_peer;\t/* Peer address. */\n};\n\n#if defined(__amd64__) || defined(__i386__)\n#define\tKINFO_FILE_SIZE\t1392\n#endif\n\nstruct kinfo_file {\n\tint\t\tkf_structsize;\t\t/* Variable size of record. */\n\tint\t\tkf_type;\t\t/* Descriptor type. */\n\tint\t\tkf_fd;\t\t\t/* Array index. */\n\tint\t\tkf_ref_count;\t\t/* Reference count. */\n\tint\t\tkf_flags;\t\t/* Flags. */\n\tint\t\tkf_pad0;\t\t/* Round to 64 bit alignment. */\n\tint64_t\t\tkf_offset;\t\t/* Seek location. */\n\tint\t\tkf_vnode_type;\t\t/* Vnode type. */\n\tint\t\tkf_sock_domain;\t\t/* Socket domain. */\n\tint\t\tkf_sock_type;\t\t/* Socket type. */\n\tint\t\tkf_sock_protocol;\t/* Socket protocol. */\n\tstruct sockaddr_storage kf_sa_local;\t/* Socket address. */\n\tstruct sockaddr_storage\tkf_sa_peer;\t/* Peer address. */\n\tunion {\n\t\tstruct {\n\t\t\t/* Address of so_pcb. */\n\t\t\tuint64_t\tkf_sock_pcb;\n\t\t\t/* Address of inp_ppcb. */\n\t\t\tuint64_t\tkf_sock_inpcb;\n\t\t\t/* Address of unp_conn. */\n\t\t\tuint64_t\tkf_sock_unpconn;\n\t\t\t/* Send buffer state. */\n\t\t\tuint16_t\tkf_sock_snd_sb_state;\n\t\t\t/* Receive buffer state. */\n\t\t\tuint16_t\tkf_sock_rcv_sb_state;\n\t\t\t/* Round to 64 bit alignment. */\n\t\t\tuint32_t\tkf_sock_pad0;\n\t\t} kf_sock;\n\t\tstruct {\n\t\t\t/* Global file id. */\n\t\t\tuint64_t\tkf_file_fileid;\n\t\t\t/* File size. */\n\t\t\tuint64_t\tkf_file_size;\n\t\t\t/* Vnode filesystem id. */\n\t\t\tuint32_t\tkf_file_fsid;\n\t\t\t/* File device. */\n\t\t\tuint32_t\tkf_file_rdev;\n\t\t\t/* File mode. */\n\t\t\tuint16_t\tkf_file_mode;\n\t\t\t/* Round to 64 bit alignment. */\n\t\t\tuint16_t\tkf_file_pad0;\n\t\t\tuint32_t\tkf_file_pad1;\n\t\t} kf_file;\n\t\tstruct {\n\t\t\tuint64_t\tkf_pipe_addr;\n\t\t\tuint64_t\tkf_pipe_peer;\n\t\t\tuint32_t\tkf_pipe_buffer_cnt;\n\t\t\t/* Round to 64 bit alignment. */\n\t\t\tuint32_t\tkf_pipe_pad0[3];\n\t\t} kf_pipe;\n\t\tstruct {\n\t\t\tuint32_t\tkf_pts_dev;\n\t\t\t/* Round to 64 bit alignment. */\n\t\t\tuint32_t\tkf_pts_pad0[7];\n\t\t} kf_pts;\n\t\tstruct {\n\t\t\tpid_t\t\tkf_pid;\n\t\t} kf_proc;\n\t} kf_un;\n\tuint16_t\tkf_status;\t\t/* Status flags. */\n\tuint16_t\tkf_pad1;\t\t/* Round to 32 bit alignment. */\n\tint\t\t_kf_ispare0;\t\t/* Space for more stuff. */\n\tcap_rights_t\tkf_cap_rights;\t\t/* Capability rights. */\n\tint\t\t_kf_ispare[4];\t\t/* Space for more stuff. */\n\t/* Truncated before copyout in sysctl */\n\tchar\t\tkf_path[PATH_MAX];\t/* Path to file, if any. */\n};\n\n/*\n * The KERN_PROC_VMMAP sysctl allows a process to dump the VM layout of\n * another process as a series of entries.\n */\n#define\tKVME_TYPE_NONE\t\t0\n#define\tKVME_TYPE_DEFAULT\t1\n#define\tKVME_TYPE_VNODE\t\t2\n#define\tKVME_TYPE_SWAP\t\t3\n#define\tKVME_TYPE_DEVICE\t4\n#define\tKVME_TYPE_PHYS\t\t5\n#define\tKVME_TYPE_DEAD\t\t6\n#define\tKVME_TYPE_SG\t\t7\n#define\tKVME_TYPE_UNKNOWN\t255\n\n#define\tKVME_PROT_READ\t\t0x00000001\n#define\tKVME_PROT_WRITE\t\t0x00000002\n#define\tKVME_PROT_EXEC\t\t0x00000004\n\n#define\tKVME_FLAG_COW\t\t0x00000001\n#define\tKVME_FLAG_NEEDS_COPY\t0x00000002\n#define\tKVME_FLAG_NOCOREDUMP\t0x00000004\n\n#if defined(__amd64__)\n#define\tKINFO_OVMENTRY_SIZE\t1168\n#endif\n#if defined(__i386__)\n#define\tKINFO_OVMENTRY_SIZE\t1128\n#endif\n\nstruct kinfo_ovmentry {\n\tint\t kve_structsize;\t\t/* Size of kinfo_vmmapentry. */\n\tint\t kve_type;\t\t\t/* Type of map entry. */\n\tvoid\t*kve_start;\t\t\t/* Starting address. */\n\tvoid\t*kve_end;\t\t\t/* Finishing address. */\n\tint\t kve_flags;\t\t\t/* Flags on map entry. */\n\tint\t kve_resident;\t\t\t/* Number of resident pages. */\n\tint\t kve_private_resident;\t\t/* Number of private pages. */\n\tint\t kve_protection;\t\t/* Protection bitmask. */\n\tint\t kve_ref_count;\t\t\t/* VM obj ref count. */\n\tint\t kve_shadow_count;\t\t/* VM obj shadow count. */\n\tchar\t kve_path[PATH_MAX];\t\t/* Path to VM obj, if any. */\n\tvoid\t*_kve_pspare[8];\t\t/* Space for more stuff. */\n\toff_t\t kve_offset;\t\t\t/* Mapping offset in object */\n\tuint64_t kve_fileid;\t\t\t/* inode number if vnode */\n\tdev_t\t kve_fsid;\t\t\t/* dev_t of vnode location */\n\tint\t _kve_ispare[3];\t\t/* Space for more stuff. */\n};\n\n#if defined(__amd64__) || defined(__i386__)\n#define\tKINFO_VMENTRY_SIZE\t1160\n#endif\n\nstruct kinfo_vmentry {\n\tint\t kve_structsize;\t\t/* Variable size of record. */\n\tint\t kve_type;\t\t\t/* Type of map entry. */\n\tuint64_t kve_start;\t\t\t/* Starting address. */\n\tuint64_t kve_end;\t\t\t/* Finishing address. */\n\tuint64_t kve_offset;\t\t\t/* Mapping offset in object */\n\tuint64_t kve_vn_fileid;\t\t\t/* inode number if vnode */\n\tuint32_t kve_vn_fsid;\t\t\t/* dev_t of vnode location */\n\tint\t kve_flags;\t\t\t/* Flags on map entry. */\n\tint\t kve_resident;\t\t\t/* Number of resident pages. */\n\tint\t kve_private_resident;\t\t/* Number of private pages. */\n\tint\t kve_protection;\t\t/* Protection bitmask. */\n\tint\t kve_ref_count;\t\t\t/* VM obj ref count. */\n\tint\t kve_shadow_count;\t\t/* VM obj shadow count. */\n\tint\t kve_vn_type;\t\t\t/* Vnode type. */\n\tuint64_t kve_vn_size;\t\t\t/* File size. */\n\tuint32_t kve_vn_rdev;\t\t\t/* Device id if device. */\n\tuint16_t kve_vn_mode;\t\t\t/* File mode. */\n\tuint16_t kve_status;\t\t\t/* Status flags. */\n\tint\t _kve_ispare[12];\t\t/* Space for more stuff. */\n\t/* Truncated before copyout in sysctl */\n\tchar\t kve_path[PATH_MAX];\t\t/* Path to VM obj, if any. */\n};\n\n/*\n * The KERN_PROC_KSTACK sysctl allows a process to dump the kernel stacks of\n * another process as a series of entries.  Each stack is represented by a\n * series of symbol names and offsets as generated by stack_sbuf_print(9).\n */\n#define\tKKST_MAXLEN\t1024\n\n#define\tKKST_STATE_STACKOK\t0\t\t/* Stack is valid. */\n#define\tKKST_STATE_SWAPPED\t1\t\t/* Stack swapped out. */\n#define\tKKST_STATE_RUNNING\t2\t\t/* Stack ephemeral. */\n\n#if defined(__amd64__) || defined(__i386__)\n#define\tKINFO_KSTACK_SIZE\t1096\n#endif\n\nstruct kinfo_kstack {\n\tlwpid_t\t kkst_tid;\t\t\t/* ID of thread. */\n\tint\t kkst_state;\t\t\t/* Validity of stack. */\n\tchar\t kkst_trace[KKST_MAXLEN];\t/* String representing stack. */\n\tint\t _kkst_ispare[16];\t\t/* Space for more stuff. */\n};\n\n#ifdef _KERNEL\nint\tvntype_to_kinfo(int vtype);\n#endif /* !_KERNEL */\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/sys/utsname.h",
    "content": "/*-\n * Copyright (c) 1994\n *\tThe Regents of the University of California.  All rights reserved.\n *\n * This code is derived from software contributed to Berkeley by\n * Chuck Karish of Mindcraft, Inc.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 4. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t@(#)utsname.h\t8.1 (Berkeley) 1/4/94\n * $FreeBSD: release/9.0.0/sys/sys/utsname.h 127976 2004-04-07 04:19:52Z imp $\n */\n\n#ifndef\t_SYS_UTSNAME_H\n#define\t_SYS_UTSNAME_H\n\n#ifdef _KERNEL\n#define\tSYS_NMLN\t32\t\t/* uname(2) for the FreeBSD 1.1 ABI. */\n#endif\n\n#ifndef SYS_NMLN\n#define\tSYS_NMLN\t256\t\t/* User can override. */\n#endif\n\nstruct utsname {\n\tchar\tsysname[SYS_NMLN];\t/* Name of this OS. */\n\tchar\tnodename[SYS_NMLN];\t/* Name of this network node. */\n\tchar\trelease[SYS_NMLN];\t/* Release level. */\n\tchar\tversion[SYS_NMLN];\t/* Version level. */\n\tchar\tmachine[SYS_NMLN];\t/* Hardware type. */\n};\n\n#include <sys/cdefs.h>\n\n#ifndef _KERNEL\n__BEGIN_DECLS\nint\t__xuname(int, void *);\t\t/* Variable record size. */\n__END_DECLS\n\nstatic __inline int\nuname(struct utsname *name)\n{\n\treturn __xuname(SYS_NMLN, (void *)name);\n}\n#endif\t/* _KERNEL */\n\n#endif\t/* !_SYS_UTSNAME_H */\n"
  },
  {
    "path": "freebsd-headers/sys/uuid.h",
    "content": "/*-\n * Copyright (c) 2002 Marcel Moolenaar\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n *\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR\n * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES\n * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,\n * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF\n * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/sys/uuid.h 151059 2005-10-07 13:37:10Z marcel $\n */\n\n#ifndef _SYS_UUID_H_\n#define\t_SYS_UUID_H_\n\n#include <sys/cdefs.h>\n\n/* Length of a node address (an IEEE 802 address). */\n#define\t_UUID_NODE_LEN\t\t6\n\n/*\n * See also:\n *      http://www.opengroup.org/dce/info/draft-leach-uuids-guids-01.txt\n *      http://www.opengroup.org/onlinepubs/009629399/apdxa.htm\n *\n * A DCE 1.1 compatible source representation of UUIDs.\n */\nstruct uuid {\n\tuint32_t\ttime_low;\n\tuint16_t\ttime_mid;\n\tuint16_t\ttime_hi_and_version;\n\tuint8_t\t\tclock_seq_hi_and_reserved;\n\tuint8_t\t\tclock_seq_low;\n\tuint8_t\t\tnode[_UUID_NODE_LEN];\n};\n\n#ifdef _KERNEL\n\n#define\tUUID_NODE_LEN\t_UUID_NODE_LEN\n\nstruct sbuf;\n\nstruct uuid *kern_uuidgen(struct uuid *, size_t);\n\nint snprintf_uuid(char *, size_t, struct uuid *);\nint printf_uuid(struct uuid *);\nint sbuf_printf_uuid(struct sbuf *, struct uuid *);\nint parse_uuid(const char *, struct uuid *);\n\nvoid be_uuid_dec(void const *buf, struct uuid *uuid);\nvoid be_uuid_enc(void *buf, struct uuid const *uuid);\nvoid le_uuid_dec(void const *buf, struct uuid *uuid);\nvoid le_uuid_enc(void *buf, struct uuid const *uuid);\n\n#else\t/* _KERNEL */\n\n/* XXX namespace pollution? */\ntypedef struct uuid uuid_t;\n\n__BEGIN_DECLS\nint\tuuidgen(struct uuid *, int);\n__END_DECLS\n\n#endif\t/* _KERNEL */\n\n#endif /* _SYS_UUID_H_ */\n"
  },
  {
    "path": "freebsd-headers/sys/vmmeter.h",
    "content": "/*-\n * Copyright (c) 1982, 1986, 1993\n *\tThe Regents of the University of California.  All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 4. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t@(#)vmmeter.h\t8.2 (Berkeley) 7/10/94\n * $FreeBSD: release/9.0.0/sys/sys/vmmeter.h 217192 2011-01-09 12:50:44Z kib $\n */\n\n#ifndef _SYS_VMMETER_H_\n#define _SYS_VMMETER_H_\n\n/*\n * This value is used by ps(1) to change sleep state flag from 'S' to\n * 'I' and by the sched process to set the alarm clock.\n */\n#define\tMAXSLP\t\t\t20\n\n/*\n * System wide statistics counters.\n * Locking:\n *      a - locked by atomic operations\n *      c - constant after initialization\n *      f - locked by vm_page_queue_free_mtx\n *      p - locked by being in the PCPU and atomicity respect to interrupts\n *      q - locked by vm_page_queue_mtx\n */\nstruct vmmeter {\n\t/*\n\t * General system activity.\n\t */\n\tu_int v_swtch;\t\t/* (p) context switches */\n\tu_int v_trap;\t\t/* (p) calls to trap */\n\tu_int v_syscall;\t/* (p) calls to syscall() */\n\tu_int v_intr;\t\t/* (p) device interrupts */\n\tu_int v_soft;\t\t/* (p) software interrupts */\n\t/*\n\t * Virtual memory activity.\n\t */\n\tu_int v_vm_faults;\t/* (p) address memory faults */\n\tu_int v_cow_faults;\t/* (p) copy-on-writes faults */\n\tu_int v_cow_optim;\t/* (p) optimized copy-on-writes faults */\n\tu_int v_zfod;\t\t/* (p) pages zero filled on demand */\n\tu_int v_ozfod;\t\t/* (p) optimized zero fill pages */\n\tu_int v_swapin;\t\t/* (p) swap pager pageins */\n\tu_int v_swapout;\t/* (p) swap pager pageouts */\n\tu_int v_swappgsin;\t/* (p) swap pager pages paged in */\n\tu_int v_swappgsout;\t/* (p) swap pager pages paged out */\n\tu_int v_vnodein;\t/* (p) vnode pager pageins */\n\tu_int v_vnodeout;\t/* (p) vnode pager pageouts */\n\tu_int v_vnodepgsin;\t/* (p) vnode_pager pages paged in */\n\tu_int v_vnodepgsout;\t/* (p) vnode pager pages paged out */\n\tu_int v_intrans;\t/* (p) intransit blocking page faults */\n\tu_int v_reactivated;\t/* (f) pages reactivated from free list */\n\tu_int v_pdwakeups;\t/* (f) times daemon has awaken from sleep */\n\tu_int v_pdpages;\t/* (q) pages analyzed by daemon */\n\n\tu_int v_tcached;\t/* (p) total pages cached */\n\tu_int v_dfree;\t\t/* (q) pages freed by daemon */\n\tu_int v_pfree;\t\t/* (p) pages freed by exiting processes */\n\tu_int v_tfree;\t\t/* (p) total pages freed */\n\t/*\n\t * Distribution of page usages.\n\t */\n\tu_int v_page_size;\t/* (c) page size in bytes */\n\tu_int v_page_count;\t/* (c) total number of pages in system */\n\tu_int v_free_reserved;\t/* (c) pages reserved for deadlock */\n\tu_int v_free_target;\t/* (c) pages desired free */\n\tu_int v_free_min;\t/* (c) pages desired free */\n\tu_int v_free_count;\t/* (f) pages free */\n\tu_int v_wire_count;\t/* (a) pages wired down */\n\tu_int v_active_count;\t/* (q) pages active */\n\tu_int v_inactive_target; /* (c) pages desired inactive */\n\tu_int v_inactive_count;\t/* (q) pages inactive */\n\tu_int v_cache_count;\t/* (f) pages on cache queue */\n\tu_int v_cache_min;\t/* (c) min pages desired on cache queue */\n\tu_int v_cache_max;\t/* (c) max pages in cached obj */\n\tu_int v_pageout_free_min;   /* (c) min pages reserved for kernel */\n\tu_int v_interrupt_free_min; /* (c) reserved pages for int code */\n\tu_int v_free_severe;\t/* (c) severe page depletion point */\n\t/*\n\t * Fork/vfork/rfork activity.\n\t */\n\tu_int v_forks;\t\t/* (p) fork() calls */\n\tu_int v_vforks;\t\t/* (p) vfork() calls */\n\tu_int v_rforks;\t\t/* (p) rfork() calls */\n\tu_int v_kthreads;\t/* (p) fork() calls by kernel */\n\tu_int v_forkpages;\t/* (p) VM pages affected by fork() */\n\tu_int v_vforkpages;\t/* (p) VM pages affected by vfork() */\n\tu_int v_rforkpages;\t/* (p) VM pages affected by rfork() */\n\tu_int v_kthreadpages;\t/* (p) VM pages affected by fork() by kernel */\n};\n#ifdef _KERNEL\n\nextern struct vmmeter cnt;\n\n/*\n * Return TRUE if we are under our severe low-free-pages threshold\n *\n * This routine is typically used at the user<->system interface to determine\n * whether we need to block in order to avoid a low memory deadlock.\n */\n\nstatic __inline \nint\nvm_page_count_severe(void)\n{\n    return (cnt.v_free_severe > (cnt.v_free_count + cnt.v_cache_count));\n}\n\n/*\n * Return TRUE if we are under our minimum low-free-pages threshold.\n *\n * This routine is typically used within the system to determine whether\n * we can execute potentially very expensive code in terms of memory.  It\n * is also used by the pageout daemon to calculate when to sleep, when\n * to wake waiters up, and when (after making a pass) to become more\n * desparate.\n */\n\nstatic __inline \nint\nvm_page_count_min(void)\n{\n    return (cnt.v_free_min > (cnt.v_free_count + cnt.v_cache_count));\n}\n\n/*\n * Return TRUE if we have not reached our free page target during\n * free page recovery operations.\n */\n\nstatic __inline \nint\nvm_page_count_target(void)\n{\n    return (cnt.v_free_target > (cnt.v_free_count + cnt.v_cache_count));\n}\n\n/*\n * Return the number of pages we need to free-up or cache\n * A positive number indicates that we do not have enough free pages.\n */\n\nstatic __inline \nint\nvm_paging_target(void)\n{\n    return (\n\t(cnt.v_free_target + cnt.v_cache_min) -\n\t(cnt.v_free_count + cnt.v_cache_count)\n    );\n}\n\n/*\n * Returns TRUE if the pagedaemon needs to be woken up.\n */\n\nstatic __inline \nint\nvm_paging_needed(void)\n{\n    return (\n\t(cnt.v_free_reserved + cnt.v_cache_min) >\n\t(cnt.v_free_count + cnt.v_cache_count)\n    );\n}\n\n#endif\n\n/* systemwide totals computed every five seconds */\nstruct vmtotal {\n\tint16_t\tt_rq;\t\t/* length of the run queue */\n\tint16_t\tt_dw;\t\t/* jobs in ``disk wait'' (neg priority) */\n\tint16_t\tt_pw;\t\t/* jobs in page wait */\n\tint16_t\tt_sl;\t\t/* jobs sleeping in core */\n\tint16_t\tt_sw;\t\t/* swapped out runnable/short block jobs */\n\tint32_t\tt_vm;\t\t/* total virtual memory */\n\tint32_t\tt_avm;\t\t/* active virtual memory */\n\tint32_t\tt_rm;\t\t/* total real memory in use */\n\tint32_t\tt_arm;\t\t/* active real memory */\n\tint32_t\tt_vmshr;\t/* shared virtual memory */\n\tint32_t\tt_avmshr;\t/* active shared virtual memory */\n\tint32_t\tt_rmshr;\t/* shared real memory */\n\tint32_t\tt_armshr;\t/* active shared real memory */\n\tint32_t\tt_free;\t\t/* free memory pages */\n};\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/sys/vnode.h",
    "content": "/*-\n * Copyright (c) 1989, 1993\n *\tThe Regents of the University of California.  All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 4. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t@(#)vnode.h\t8.7 (Berkeley) 2/4/94\n * $FreeBSD: release/9.0.0/sys/sys/vnode.h 225166 2011-08-25 08:17:39Z mm $\n */\n\n#ifndef _SYS_VNODE_H_\n#define\t_SYS_VNODE_H_\n\n#include <sys/bufobj.h>\n#include <sys/queue.h>\n#include <sys/lock.h>\n#include <sys/lockmgr.h>\n#include <sys/mutex.h>\n#include <sys/selinfo.h>\n#include <sys/uio.h>\n#include <sys/acl.h>\n#include <sys/ktr.h>\n\n/*\n * The vnode is the focus of all file activity in UNIX.  There is a\n * unique vnode allocated for each active file, each current directory,\n * each mounted-on file, text file, and the root.\n */\n\n/*\n * Vnode types.  VNON means no type.\n */\nenum vtype\t{ VNON, VREG, VDIR, VBLK, VCHR, VLNK, VSOCK, VFIFO, VBAD,\n\t\t  VMARKER };\n\n/*\n * Each underlying filesystem allocates its own private area and hangs\n * it from v_data.  If non-null, this area is freed in getnewvnode().\n */\n\nstruct namecache;\n\nstruct vpollinfo {\n\tstruct\tmtx vpi_lock;\t\t/* lock to protect below */\n\tstruct\tselinfo vpi_selinfo;\t/* identity of poller(s) */\n\tshort\tvpi_events;\t\t/* what they are looking for */\n\tshort\tvpi_revents;\t\t/* what has happened */\n};\n\n/*\n * Reading or writing any of these items requires holding the appropriate lock.\n *\n * Lock reference:\n *\tc - namecache mutex\n *\tf - freelist mutex\n *\ti - interlock\n *\tm - mount point interlock\n *\tp - pollinfo lock\n *\tu - Only a reference to the vnode is needed to read.\n *\tv - vnode lock\n *\n * Vnodes may be found on many lists.  The general way to deal with operating\n * on a vnode that is on a list is:\n *\t1) Lock the list and find the vnode.\n *\t2) Lock interlock so that the vnode does not go away.\n *\t3) Unlock the list to avoid lock order reversals.\n *\t4) vget with LK_INTERLOCK and check for ENOENT, or\n *\t5) Check for DOOMED if the vnode lock is not required.\n *\t6) Perform your operation, then vput().\n */\n\n#if defined(_KERNEL) || defined(_KVM_VNODE)\n\nstruct vnode {\n\t/*\n\t * Fields which define the identity of the vnode.  These fields are\n\t * owned by the filesystem (XXX: and vgone() ?)\n\t */\n\tenum\tvtype v_type;\t\t\t/* u vnode type */\n\tconst char *v_tag;\t\t\t/* u type of underlying data */\n\tstruct\tvop_vector *v_op;\t\t/* u vnode operations vector */\n\tvoid\t*v_data;\t\t\t/* u private data for fs */\n\n\t/*\n\t * Filesystem instance stuff\n\t */\n\tstruct\tmount *v_mount;\t\t\t/* u ptr to vfs we are in */\n\tTAILQ_ENTRY(vnode) v_nmntvnodes;\t/* m vnodes for mount point */\n\n\t/*\n\t * Type specific fields, only one applies to any given vnode.\n\t * See #defines below for renaming to v_* namespace.\n\t */\n\tunion {\n\t\tstruct mount\t*vu_mount;\t/* v ptr to mountpoint (VDIR) */\n\t\tstruct socket\t*vu_socket;\t/* v unix domain net (VSOCK) */\n\t\tstruct cdev\t*vu_cdev; \t/* v device (VCHR, VBLK) */\n\t\tstruct fifoinfo\t*vu_fifoinfo;\t/* v fifo (VFIFO) */\n\t} v_un;\n\n\t/*\n\t * vfs_hash:  (mount + inode) -> vnode hash.\n\t */\n\tLIST_ENTRY(vnode)\tv_hashlist;\n\tu_int\t\t\tv_hash;\n\n\t/*\n\t * VFS_namecache stuff\n\t */\n\tLIST_HEAD(, namecache) v_cache_src;\t/* c Cache entries from us */\n\tTAILQ_HEAD(, namecache) v_cache_dst;\t/* c Cache entries to us */\n\tstruct namecache *v_cache_dd;\t\t/* c Cache entry for .. vnode */\n\n\t/*\n\t * clustering stuff\n\t */\n\tdaddr_t\tv_cstart;\t\t\t/* v start block of cluster */\n\tdaddr_t\tv_lasta;\t\t\t/* v last allocation  */\n\tdaddr_t\tv_lastw;\t\t\t/* v last write  */\n\tint\tv_clen;\t\t\t\t/* v length of cur. cluster */\n\n\t/*\n\t * Locking\n\t */\n\tstruct\tlock v_lock;\t\t\t/* u (if fs don't have one) */\n\tstruct\tmtx v_interlock;\t\t/* lock for \"i\" things */\n\tstruct\tlock *v_vnlock;\t\t\t/* u pointer to vnode lock */\n\tint\tv_holdcnt;\t\t\t/* i prevents recycling. */\n\tint\tv_usecount;\t\t\t/* i ref count of users */\n\tu_long\tv_iflag;\t\t\t/* i vnode flags (see below) */\n\tu_long\tv_vflag;\t\t\t/* v vnode flags */\n\tint\tv_writecount;\t\t\t/* v ref count of writers */\n\n\t/*\n\t * The machinery of being a vnode\n\t */\n\tTAILQ_ENTRY(vnode) v_freelist;\t\t/* f vnode freelist */\n\tstruct bufobj\tv_bufobj;\t\t/* * Buffer cache object */\n\n\t/*\n\t * Hooks for various subsystems and features.\n\t */\n\tstruct vpollinfo *v_pollinfo;\t\t/* i Poll events, p for *v_pi */\n\tstruct label *v_label;\t\t\t/* MAC label for vnode */\n\tstruct lockf *v_lockf;\t\t\t/* Byte-level lock list */\n};\n\n#endif /* defined(_KERNEL) || defined(_KVM_VNODE) */\n\n#define\tv_mountedhere\tv_un.vu_mount\n#define\tv_socket\tv_un.vu_socket\n#define\tv_rdev\t\tv_un.vu_cdev\n#define\tv_fifoinfo\tv_un.vu_fifoinfo\n\n/* XXX: These are temporary to avoid a source sweep at this time */\n#define v_object\tv_bufobj.bo_object\n\n/*\n * Userland version of struct vnode, for sysctl.\n */\nstruct xvnode {\n\tsize_t\txv_size;\t\t\t/* sizeof(struct xvnode) */\n\tvoid\t*xv_vnode;\t\t\t/* address of real vnode */\n\tu_long\txv_flag;\t\t\t/* vnode vflags */\n\tint\txv_usecount;\t\t\t/* reference count of users */\n\tint\txv_writecount;\t\t\t/* reference count of writers */\n\tint\txv_holdcnt;\t\t\t/* page & buffer references */\n\tu_long\txv_id;\t\t\t\t/* capability identifier */\n\tvoid\t*xv_mount;\t\t\t/* address of parent mount */\n\tlong\txv_numoutput;\t\t\t/* num of writes in progress */\n\tenum\tvtype xv_type;\t\t\t/* vnode type */\n\tunion {\n\t\tvoid\t*xvu_socket;\t\t/* socket, if VSOCK */\n\t\tvoid\t*xvu_fifo;\t\t/* fifo, if VFIFO */\n\t\tdev_t\txvu_rdev;\t\t/* maj/min, if VBLK/VCHR */\n\t\tstruct {\n\t\t\tdev_t\txvu_dev;\t/* device, if VDIR/VREG/VLNK */\n\t\t\tino_t\txvu_ino;\t/* id, if VDIR/VREG/VLNK */\n\t\t} xv_uns;\n\t} xv_un;\n};\n#define xv_socket\txv_un.xvu_socket\n#define xv_fifo\t\txv_un.xvu_fifo\n#define xv_rdev\t\txv_un.xvu_rdev\n#define xv_dev\t\txv_un.xv_uns.xvu_dev\n#define xv_ino\t\txv_un.xv_uns.xvu_ino\n\n/* We don't need to lock the knlist */\n#define\tVN_KNLIST_EMPTY(vp) ((vp)->v_pollinfo == NULL ||\t\\\n\t    KNLIST_EMPTY(&(vp)->v_pollinfo->vpi_selinfo.si_note))\n\n#define VN_KNOTE(vp, b, a)\t\t\t\t\t\\\n\tdo {\t\t\t\t\t\t\t\\\n\t\tif (!VN_KNLIST_EMPTY(vp))\t\t\t\\\n\t\t\tKNOTE(&vp->v_pollinfo->vpi_selinfo.si_note, (b), \\\n\t\t\t    (a) | KNF_NOKQLOCK);\t\t\\\n\t} while (0)\n#define\tVN_KNOTE_LOCKED(vp, b)\t\tVN_KNOTE(vp, b, KNF_LISTLOCKED)\n#define\tVN_KNOTE_UNLOCKED(vp, b)\tVN_KNOTE(vp, b, 0)\n\n/*\n * Vnode flags.\n *\tVI flags are protected by interlock and live in v_iflag\n *\tVV flags are protected by the vnode lock and live in v_vflag\n *\n *\tVI_DOOMED is doubly protected by the interlock and vnode lock.  Both\n *\tare required for writing but the status may be checked with either.\n */\n#define\tVI_MOUNT\t0x0020\t/* Mount in progress */\n#define\tVI_AGE\t\t0x0040\t/* Insert vnode at head of free list */\n#define\tVI_DOOMED\t0x0080\t/* This vnode is being recycled */\n#define\tVI_FREE\t\t0x0100\t/* This vnode is on the freelist */\n#define\tVI_DOINGINACT\t0x0800\t/* VOP_INACTIVE is in progress */\n#define\tVI_OWEINACT\t0x1000\t/* Need to call inactive */\n\n#define\tVV_ROOT\t\t0x0001\t/* root of its filesystem */\n#define\tVV_ISTTY\t0x0002\t/* vnode represents a tty */\n#define\tVV_NOSYNC\t0x0004\t/* unlinked, stop syncing */\n#define\tVV_ETERNALDEV\t0x0008\t/* device that is never destroyed */\n#define\tVV_CACHEDLABEL\t0x0010\t/* Vnode has valid cached MAC label */\n#define\tVV_TEXT\t\t0x0020\t/* vnode is a pure text prototype */\n#define\tVV_COPYONWRITE\t0x0040\t/* vnode is doing copy-on-write */\n#define\tVV_SYSTEM\t0x0080\t/* vnode being used by kernel */\n#define\tVV_PROCDEP\t0x0100\t/* vnode is process dependent */\n#define\tVV_NOKNOTE\t0x0200\t/* don't activate knotes on this vnode */\n#define\tVV_DELETED\t0x0400\t/* should be removed */\n#define\tVV_MD\t\t0x0800\t/* vnode backs the md device */\n#define\tVV_FORCEINSMQ\t0x1000\t/* force the insmntque to succeed */\n\n/*\n * Vnode attributes.  A field value of VNOVAL represents a field whose value\n * is unavailable (getattr) or which is not to be changed (setattr).\n */\nstruct vattr {\n\tenum vtype\tva_type;\t/* vnode type (for create) */\n\tu_short\t\tva_mode;\t/* files access mode and type */\n\tshort\t\tva_nlink;\t/* number of references to file */\n\tuid_t\t\tva_uid;\t\t/* owner user id */\n\tgid_t\t\tva_gid;\t\t/* owner group id */\n\tdev_t\t\tva_fsid;\t/* filesystem id */\n\tlong\t\tva_fileid;\t/* file id */\n\tu_quad_t\tva_size;\t/* file size in bytes */\n\tlong\t\tva_blocksize;\t/* blocksize preferred for i/o */\n\tstruct timespec\tva_atime;\t/* time of last access */\n\tstruct timespec\tva_mtime;\t/* time of last modification */\n\tstruct timespec\tva_ctime;\t/* time file changed */\n\tstruct timespec\tva_birthtime;\t/* time file created */\n\tu_long\t\tva_gen;\t\t/* generation number of file */\n\tu_long\t\tva_flags;\t/* flags defined for file */\n\tdev_t\t\tva_rdev;\t/* device the special file represents */\n\tu_quad_t\tva_bytes;\t/* bytes of disk space held by file */\n\tu_quad_t\tva_filerev;\t/* file modification number */\n\tu_int\t\tva_vaflags;\t/* operations flags, see below */\n\tlong\t\tva_spare;\t/* remain quad aligned */\n};\n\n/*\n * Flags for va_vaflags.\n */\n#define\tVA_UTIMES_NULL\t0x01\t\t/* utimes argument was NULL */\n#define\tVA_EXCLUSIVE\t0x02\t\t/* exclusive create request */\n\n/*\n * Flags for ioflag. (high 16 bits used to ask for read-ahead and\n * help with write clustering)\n * NB: IO_NDELAY and IO_DIRECT are linked to fcntl.h\n */\n#define\tIO_UNIT\t\t0x0001\t\t/* do I/O as atomic unit */\n#define\tIO_APPEND\t0x0002\t\t/* append write to end */\n#define\tIO_NDELAY\t0x0004\t\t/* FNDELAY flag set in file table */\n#define\tIO_NODELOCKED\t0x0008\t\t/* underlying node already locked */\n#define\tIO_ASYNC\t0x0010\t\t/* bawrite rather then bdwrite */\n#define\tIO_VMIO\t\t0x0020\t\t/* data already in VMIO space */\n#define\tIO_INVAL\t0x0040\t\t/* invalidate after I/O */\n#define\tIO_SYNC\t\t0x0080\t\t/* do I/O synchronously */\n#define\tIO_DIRECT\t0x0100\t\t/* attempt to bypass buffer cache */\n#define\tIO_EXT\t\t0x0400\t\t/* operate on external attributes */\n#define\tIO_NORMAL\t0x0800\t\t/* operate on regular data */\n#define\tIO_NOMACCHECK\t0x1000\t\t/* MAC checks unnecessary */\n#define\tIO_BUFLOCKED\t0x2000\t\t/* ffs flag; indir buf is locked */\n\n#define IO_SEQMAX\t0x7F\t\t/* seq heuristic max value */\n#define IO_SEQSHIFT\t16\t\t/* seq heuristic in upper 16 bits */\n\n/*\n * Flags for accmode_t.\n */\n#define\tVEXEC\t\t\t000000000100 /* execute/search permission */\n#define\tVWRITE\t\t\t000000000200 /* write permission */\n#define\tVREAD\t\t\t000000000400 /* read permission */\n#define\tVADMIN\t\t\t000000010000 /* being the file owner */\n#define\tVAPPEND\t\t\t000000040000 /* permission to write/append */\n/*\n * VEXPLICIT_DENY makes VOP_ACCESSX(9) return EPERM or EACCES only\n * if permission was denied explicitly, by a \"deny\" rule in NFSv4 ACL,\n * and 0 otherwise.  This never happens with ordinary unix access rights\n * or POSIX.1e ACLs.  Obviously, VEXPLICIT_DENY must be OR-ed with\n * some other V* constant.\n */\n#define\tVEXPLICIT_DENY\t\t000000100000\n#define\tVREAD_NAMED_ATTRS \t000000200000 /* not used */\n#define\tVWRITE_NAMED_ATTRS \t000000400000 /* not used */\n#define\tVDELETE_CHILD\t \t000001000000\n#define\tVREAD_ATTRIBUTES \t000002000000 /* permission to stat(2) */\n#define\tVWRITE_ATTRIBUTES \t000004000000 /* change {m,c,a}time */\n#define\tVDELETE\t\t \t000010000000\n#define\tVREAD_ACL\t \t000020000000 /* read ACL and file mode */\n#define\tVWRITE_ACL\t \t000040000000 /* change ACL and/or file mode */\n#define\tVWRITE_OWNER\t \t000100000000 /* change file owner */\n#define\tVSYNCHRONIZE\t \t000200000000 /* not used */\n\n/*\n * Permissions that were traditionally granted only to the file owner.\n */\n#define VADMIN_PERMS\t(VADMIN | VWRITE_ATTRIBUTES | VWRITE_ACL | \\\n    VWRITE_OWNER)\n\n/*\n * Permissions that were traditionally granted to everyone.\n */\n#define VSTAT_PERMS\t(VREAD_ATTRIBUTES | VREAD_ACL)\n\n/*\n * Permissions that allow to change the state of the file in any way.\n */\n#define VMODIFY_PERMS\t(VWRITE | VAPPEND | VADMIN_PERMS | VDELETE_CHILD | \\\n    VDELETE)\n\n/*\n * Token indicating no attribute value yet assigned.\n */\n#define\tVNOVAL\t(-1)\n\n/*\n * LK_TIMELOCK timeout for vnode locks (used mainly by the pageout daemon)\n */\n#define VLKTIMEOUT\t(hz / 20 + 1)\n\n#ifdef _KERNEL\n\n#ifdef MALLOC_DECLARE\nMALLOC_DECLARE(M_VNODE);\n#endif\n\n/*\n * Convert between vnode types and inode formats (since POSIX.1\n * defines mode word of stat structure in terms of inode formats).\n */\nextern enum vtype\tiftovt_tab[];\nextern int\t\tvttoif_tab[];\n#define\tIFTOVT(mode)\t(iftovt_tab[((mode) & S_IFMT) >> 12])\n#define\tVTTOIF(indx)\t(vttoif_tab[(int)(indx)])\n#define\tMAKEIMODE(indx, mode)\t(int)(VTTOIF(indx) | (mode))\n\n/*\n * Flags to various vnode functions.\n */\n#define\tSKIPSYSTEM\t0x0001\t/* vflush: skip vnodes marked VSYSTEM */\n#define\tFORCECLOSE\t0x0002\t/* vflush: force file closure */\n#define\tWRITECLOSE\t0x0004\t/* vflush: only close writable files */\n#define\tDOCLOSE\t\t0x0008\t/* vclean: close active files */\n#define\tV_SAVE\t\t0x0001\t/* vinvalbuf: sync file first */\n#define\tV_ALT\t\t0x0002\t/* vinvalbuf: invalidate only alternate bufs */\n#define\tV_NORMAL\t0x0004\t/* vinvalbuf: invalidate only regular bufs */\n#define\tREVOKEALL\t0x0001\t/* vop_revoke: revoke all aliases */\n#define\tV_WAIT\t\t0x0001\t/* vn_start_write: sleep for suspend */\n#define\tV_NOWAIT\t0x0002\t/* vn_start_write: don't sleep for suspend */\n#define\tV_XSLEEP\t0x0004\t/* vn_start_write: just return after sleep */\n\n#define\tVREF(vp)\tvref(vp)\n\n#ifdef DIAGNOSTIC\n#define\tVATTR_NULL(vap)\tvattr_null(vap)\n#else\n#define\tVATTR_NULL(vap)\t(*(vap) = va_null)\t/* initialize a vattr */\n#endif /* DIAGNOSTIC */\n\n#define\tNULLVP\t((struct vnode *)NULL)\n\n/*\n * Global vnode data.\n */\nextern\tstruct vnode *rootvnode;\t/* root (i.e. \"/\") vnode */\nextern\tint async_io_version;\t\t/* 0 or POSIX version of AIO i'face */\nextern\tint desiredvnodes;\t\t/* number of vnodes desired */\nextern\tstruct uma_zone *namei_zone;\nextern\tstruct vattr va_null;\t\t/* predefined null vattr structure */\n\n#define\tVI_LOCK(vp)\tmtx_lock(&(vp)->v_interlock)\n#define\tVI_LOCK_FLAGS(vp, flags) mtx_lock_flags(&(vp)->v_interlock, (flags))\n#define\tVI_TRYLOCK(vp)\tmtx_trylock(&(vp)->v_interlock)\n#define\tVI_UNLOCK(vp)\tmtx_unlock(&(vp)->v_interlock)\n#define\tVI_MTX(vp)\t(&(vp)->v_interlock)\n\n#define\tVN_LOCK_AREC(vp)\tlockallowrecurse((vp)->v_vnlock)\n#define\tVN_LOCK_ASHARE(vp)\tlockallowshare((vp)->v_vnlock)\n\n#endif /* _KERNEL */\n\n/*\n * Mods for extensibility.\n */\n\n/*\n * Flags for vdesc_flags:\n */\n#define\tVDESC_MAX_VPS\t\t16\n/* Low order 16 flag bits are reserved for willrele flags for vp arguments. */\n#define\tVDESC_VP0_WILLRELE\t0x0001\n#define\tVDESC_VP1_WILLRELE\t0x0002\n#define\tVDESC_VP2_WILLRELE\t0x0004\n#define\tVDESC_VP3_WILLRELE\t0x0008\n#define\tVDESC_NOMAP_VPP\t\t0x0100\n#define\tVDESC_VPP_WILLRELE\t0x0200\n\n/*\n * A generic structure.\n * This can be used by bypass routines to identify generic arguments.\n */\nstruct vop_generic_args {\n\tstruct vnodeop_desc *a_desc;\n\t/* other random data follows, presumably */\n};\n\ntypedef int vop_bypass_t(struct vop_generic_args *);\n\n/*\n * VDESC_NO_OFFSET is used to identify the end of the offset list\n * and in places where no such field exists.\n */\n#define VDESC_NO_OFFSET -1\n\n/*\n * This structure describes the vnode operation taking place.\n */\nstruct vnodeop_desc {\n\tchar\t*vdesc_name;\t\t/* a readable name for debugging */\n\tint\t vdesc_flags;\t\t/* VDESC_* flags */\n\tvop_bypass_t\t*vdesc_call;\t/* Function to call */\n\n\t/*\n\t * These ops are used by bypass routines to map and locate arguments.\n\t * Creds and procs are not needed in bypass routines, but sometimes\n\t * they are useful to (for example) transport layers.\n\t * Nameidata is useful because it has a cred in it.\n\t */\n\tint\t*vdesc_vp_offsets;\t/* list ended by VDESC_NO_OFFSET */\n\tint\tvdesc_vpp_offset;\t/* return vpp location */\n\tint\tvdesc_cred_offset;\t/* cred location, if any */\n\tint\tvdesc_thread_offset;\t/* thread location, if any */\n\tint\tvdesc_componentname_offset; /* if any */\n};\n\n#ifdef _KERNEL\n/*\n * A list of all the operation descs.\n */\nextern struct vnodeop_desc *vnodeop_descs[];\n\n#define\tVOPARG_OFFSETOF(s_type, field)\t__offsetof(s_type, field)\n#define\tVOPARG_OFFSETTO(s_type, s_offset, struct_p) \\\n    ((s_type)(((char*)(struct_p)) + (s_offset)))\n\n\n#ifdef DEBUG_VFS_LOCKS\n/*\n * Support code to aid in debugging VFS locking problems.  Not totally\n * reliable since if the thread sleeps between changing the lock\n * state and checking it with the assert, some other thread could\n * change the state.  They are good enough for debugging a single\n * filesystem using a single-threaded test.\n */\nvoid\tassert_vi_locked(struct vnode *vp, const char *str);\nvoid\tassert_vi_unlocked(struct vnode *vp, const char *str);\nvoid\tassert_vop_elocked(struct vnode *vp, const char *str);\n#if 0\nvoid\tassert_vop_elocked_other(struct vnode *vp, const char *str);\n#endif\nvoid\tassert_vop_locked(struct vnode *vp, const char *str);\n#if 0\nvoi0\tassert_vop_slocked(struct vnode *vp, const char *str);\n#endif\nvoid\tassert_vop_unlocked(struct vnode *vp, const char *str);\n\n#define\tASSERT_VI_LOCKED(vp, str)\tassert_vi_locked((vp), (str))\n#define\tASSERT_VI_UNLOCKED(vp, str)\tassert_vi_unlocked((vp), (str))\n#define\tASSERT_VOP_ELOCKED(vp, str)\tassert_vop_elocked((vp), (str))\n#if 0\n#define\tASSERT_VOP_ELOCKED_OTHER(vp, str) assert_vop_locked_other((vp), (str))\n#endif\n#define\tASSERT_VOP_LOCKED(vp, str)\tassert_vop_locked((vp), (str))\n#if 0\n#define\tASSERT_VOP_SLOCKED(vp, str)\tassert_vop_slocked((vp), (str))\n#endif\n#define\tASSERT_VOP_UNLOCKED(vp, str)\tassert_vop_unlocked((vp), (str))\n\n#else /* !DEBUG_VFS_LOCKS */\n\n#define\tASSERT_VI_LOCKED(vp, str)\t((void)0)\n#define\tASSERT_VI_UNLOCKED(vp, str)\t((void)0)\n#define\tASSERT_VOP_ELOCKED(vp, str)\t((void)0)\n#if 0\n#define\tASSERT_VOP_ELOCKED_OTHER(vp, str)\n#endif\n#define\tASSERT_VOP_LOCKED(vp, str)\t((void)0)\n#if 0\n#define\tASSERT_VOP_SLOCKED(vp, str)\n#endif\n#define\tASSERT_VOP_UNLOCKED(vp, str)\t((void)0)\n#endif /* DEBUG_VFS_LOCKS */\n\n\n/*\n * This call works for vnodes in the kernel.\n */\n#define VCALL(c) ((c)->a_desc->vdesc_call(c))\n\n/*\n * VMIO support inline\n */\n\nextern int vmiodirenable;\n\nstatic __inline int\nvn_canvmio(struct vnode *vp)\n{\n      if (vp && (vp->v_type == VREG || (vmiodirenable && vp->v_type == VDIR)))\n\t\treturn(TRUE);\n\treturn(FALSE);\n}\n\n/*\n * Finally, include the default set of vnode operations.\n */\n#include \"vnode_if.h\"\n\n/* vn_open_flags */\n#define\tVN_OPEN_NOAUDIT\t\t0x00000001\n\n/*\n * Public vnode manipulation functions.\n */\nstruct componentname;\nstruct file;\nstruct mount;\nstruct nameidata;\nstruct ostat;\nstruct thread;\nstruct proc;\nstruct stat;\nstruct nstat;\nstruct ucred;\nstruct uio;\nstruct vattr;\nstruct vnode;\n\n/* cache_* may belong in namei.h. */\nvoid\tcache_enter(struct vnode *dvp, struct vnode *vp,\n\t    struct componentname *cnp);\nint\tcache_lookup(struct vnode *dvp, struct vnode **vpp,\n\t    struct componentname *cnp);\nvoid\tcache_purge(struct vnode *vp);\nvoid\tcache_purge_negative(struct vnode *vp);\nvoid\tcache_purgevfs(struct mount *mp);\nint\tchange_dir(struct vnode *vp, struct thread *td);\nint\tchange_root(struct vnode *vp, struct thread *td);\nvoid\tcvtstat(struct stat *st, struct ostat *ost);\nvoid\tcvtnstat(struct stat *sb, struct nstat *nsb);\nint\tgetnewvnode(const char *tag, struct mount *mp, struct vop_vector *vops,\n\t    struct vnode **vpp);\nint\tinsmntque1(struct vnode *vp, struct mount *mp,\n\t    void (*dtr)(struct vnode *, void *), void *dtr_arg);\nint\tinsmntque(struct vnode *vp, struct mount *mp);\nu_quad_t init_va_filerev(void);\nint\tspeedup_syncer(void);\nint\tvn_vptocnp(struct vnode **vp, struct ucred *cred, char *buf,\n\t    u_int *buflen);\n#define textvp_fullpath(p, rb, rfb) \\\n\tvn_fullpath(FIRST_THREAD_IN_PROC(p), (p)->p_textvp, rb, rfb)\nint\tvn_fullpath(struct thread *td, struct vnode *vn,\n\t    char **retbuf, char **freebuf);\nint\tvn_fullpath_global(struct thread *td, struct vnode *vn,\n\t    char **retbuf, char **freebuf);\nint\tvn_commname(struct vnode *vn, char *buf, u_int buflen);\nint\tvaccess(enum vtype type, mode_t file_mode, uid_t file_uid,\n\t    gid_t file_gid, accmode_t accmode, struct ucred *cred,\n\t    int *privused);\nint\tvaccess_acl_nfs4(enum vtype type, uid_t file_uid, gid_t file_gid,\n\t    struct acl *aclp, accmode_t accmode, struct ucred *cred,\n\t    int *privused);\nint\tvaccess_acl_posix1e(enum vtype type, uid_t file_uid,\n\t    gid_t file_gid, struct acl *acl, accmode_t accmode,\n\t    struct ucred *cred, int *privused);\nvoid\tvattr_null(struct vattr *vap);\nint\tvcount(struct vnode *vp);\nvoid\tvdrop(struct vnode *);\nvoid\tvdropl(struct vnode *);\nvoid\tvdestroy(struct vnode *);\nint\tvflush(struct mount *mp, int rootrefs, int flags, struct thread *td);\nint\tvget(struct vnode *vp, int lockflag, struct thread *td);\nvoid\tvgone(struct vnode *vp);\nvoid\tvhold(struct vnode *);\nvoid\tvholdl(struct vnode *);\nint\tvinvalbuf(struct vnode *vp, int save, int slpflag, int slptimeo);\nint\tvtruncbuf(struct vnode *vp, struct ucred *cred, struct thread *td,\n\t    off_t length, int blksize);\nvoid\tvunref(struct vnode *);\nvoid\tvn_printf(struct vnode *vp, const char *fmt, ...) __printflike(2,3);\n#define vprint(label, vp) vn_printf((vp), \"%s\\n\", (label))\nint\tvrecycle(struct vnode *vp, struct thread *td);\nint\tvn_close(struct vnode *vp,\n\t    int flags, struct ucred *file_cred, struct thread *td);\nvoid\tvn_finished_write(struct mount *mp);\nvoid\tvn_finished_secondary_write(struct mount *mp);\nint\tvn_isdisk(struct vnode *vp, int *errp);\nint\t_vn_lock(struct vnode *vp, int flags, char *file, int line);\n#define vn_lock(vp, flags) _vn_lock(vp, flags, __FILE__, __LINE__)\nint\tvn_open(struct nameidata *ndp, int *flagp, int cmode, struct file *fp);\nint\tvn_open_cred(struct nameidata *ndp, int *flagp, int cmode,\n\t    u_int vn_open_flags, struct ucred *cred, struct file *fp);\nvoid\tvn_pages_remove(struct vnode *vp, vm_pindex_t start, vm_pindex_t end);\nint\tvn_pollrecord(struct vnode *vp, struct thread *p, int events);\nint\tvn_rdwr(enum uio_rw rw, struct vnode *vp, void *base,\n\t    int len, off_t offset, enum uio_seg segflg, int ioflg,\n\t    struct ucred *active_cred, struct ucred *file_cred, int *aresid,\n\t    struct thread *td);\nint\tvn_rdwr_inchunks(enum uio_rw rw, struct vnode *vp, void *base,\n\t    size_t len, off_t offset, enum uio_seg segflg, int ioflg,\n\t    struct ucred *active_cred, struct ucred *file_cred, size_t *aresid,\n\t    struct thread *td);\nint\tvn_rlimit_fsize(const struct vnode *vn, const struct uio *uio,\n\t    const struct thread *td);\nint\tvn_stat(struct vnode *vp, struct stat *sb, struct ucred *active_cred,\n\t    struct ucred *file_cred, struct thread *td);\nint\tvn_start_write(struct vnode *vp, struct mount **mpp, int flags);\nint\tvn_start_secondary_write(struct vnode *vp, struct mount **mpp,\n\t    int flags);\nint\tvn_writechk(struct vnode *vp);\nint\tvn_extattr_get(struct vnode *vp, int ioflg, int attrnamespace,\n\t    const char *attrname, int *buflen, char *buf, struct thread *td);\nint\tvn_extattr_set(struct vnode *vp, int ioflg, int attrnamespace,\n\t    const char *attrname, int buflen, char *buf, struct thread *td);\nint\tvn_extattr_rm(struct vnode *vp, int ioflg, int attrnamespace,\n\t    const char *attrname, struct thread *td);\nint\tvn_vget_ino(struct vnode *vp, ino_t ino, int lkflags,\n\t    struct vnode **rvp);\n\n\nint\tvfs_cache_lookup(struct vop_lookup_args *ap);\nvoid\tvfs_timestamp(struct timespec *);\nvoid\tvfs_write_resume(struct mount *mp);\nint\tvfs_write_suspend(struct mount *mp);\nint\tvop_stdbmap(struct vop_bmap_args *);\nint\tvop_stdfsync(struct vop_fsync_args *);\nint\tvop_stdgetwritemount(struct vop_getwritemount_args *);\nint\tvop_stdgetpages(struct vop_getpages_args *);\nint\tvop_stdinactive(struct vop_inactive_args *);\nint\tvop_stdislocked(struct vop_islocked_args *);\nint\tvop_stdkqfilter(struct vop_kqfilter_args *);\nint\tvop_stdlock(struct vop_lock1_args *);\nint\tvop_stdputpages(struct vop_putpages_args *);\nint\tvop_stdunlock(struct vop_unlock_args *);\nint\tvop_nopoll(struct vop_poll_args *);\nint\tvop_stdaccess(struct vop_access_args *ap);\nint\tvop_stdaccessx(struct vop_accessx_args *ap);\nint\tvop_stdadvlock(struct vop_advlock_args *ap);\nint\tvop_stdadvlockasync(struct vop_advlockasync_args *ap);\nint\tvop_stdadvlockpurge(struct vop_advlockpurge_args *ap);\nint\tvop_stdallocate(struct vop_allocate_args *ap);\nint\tvop_stdpathconf(struct vop_pathconf_args *);\nint\tvop_stdpoll(struct vop_poll_args *);\nint\tvop_stdvptocnp(struct vop_vptocnp_args *ap);\nint\tvop_stdvptofh(struct vop_vptofh_args *ap);\nint\tvop_eopnotsupp(struct vop_generic_args *ap);\nint\tvop_ebadf(struct vop_generic_args *ap);\nint\tvop_einval(struct vop_generic_args *ap);\nint\tvop_enoent(struct vop_generic_args *ap);\nint\tvop_enotty(struct vop_generic_args *ap);\nint\tvop_null(struct vop_generic_args *ap);\nint\tvop_panic(struct vop_generic_args *ap);\n\n/* These are called from within the actual VOPS. */\nvoid\tvop_create_post(void *a, int rc);\nvoid\tvop_link_post(void *a, int rc);\nvoid\tvop_lock_pre(void *a);\nvoid\tvop_lock_post(void *a, int rc);\nvoid\tvop_lookup_post(void *a, int rc);\nvoid\tvop_lookup_pre(void *a);\nvoid\tvop_mkdir_post(void *a, int rc);\nvoid\tvop_mknod_post(void *a, int rc);\nvoid\tvop_remove_post(void *a, int rc);\nvoid\tvop_rename_post(void *a, int rc);\nvoid\tvop_rename_pre(void *a);\nvoid\tvop_rmdir_post(void *a, int rc);\nvoid\tvop_setattr_post(void *a, int rc);\nvoid\tvop_strategy_pre(void *a);\nvoid\tvop_symlink_post(void *a, int rc);\nvoid\tvop_unlock_post(void *a, int rc);\nvoid\tvop_unlock_pre(void *a);\n\nvoid\tvop_rename_fail(struct vop_rename_args *ap);\n\n#define\tVOP_WRITE_PRE(ap)\t\t\t\t\t\t\\\n\tstruct vattr va;\t\t\t\t\t\t\\\n\tint error, osize, ooffset, noffset;\t\t\t\t\\\n\t\t\t\t\t\t\t\t\t\\\n\tosize = ooffset = noffset = 0;\t\t\t\t\t\\\n\tif (!VN_KNLIST_EMPTY((ap)->a_vp)) {\t\t\t\t\\\n\t\terror = VOP_GETATTR((ap)->a_vp, &va, (ap)->a_cred);\t\\\n\t\tif (error)\t\t\t\t\t\t\\\n\t\t\treturn (error);\t\t\t\t\t\\\n\t\tooffset = (ap)->a_uio->uio_offset;\t\t\t\\\n\t\tosize = va.va_size;\t\t\t\t\t\\\n\t}\n\n#define VOP_WRITE_POST(ap, ret)\t\t\t\t\t\t\\\n\tnoffset = (ap)->a_uio->uio_offset;\t\t\t\t\\\n\tif (noffset > ooffset && !VN_KNLIST_EMPTY((ap)->a_vp)) {\t\\\n\t\tVFS_KNOTE_LOCKED((ap)->a_vp, NOTE_WRITE\t\t\t\\\n\t\t    | (noffset > osize ? NOTE_EXTEND : 0));\t\t\\\n\t}\n\n#define VOP_LOCK(vp, flags) VOP_LOCK1(vp, flags, __FILE__, __LINE__)\n\n\nvoid\tvput(struct vnode *vp);\nvoid\tvrele(struct vnode *vp);\nvoid\tvref(struct vnode *vp);\nint\tvrefcnt(struct vnode *vp);\nvoid \tv_addpollinfo(struct vnode *vp);\n\nint vnode_create_vobject(struct vnode *vp, off_t size, struct thread *td);\nvoid vnode_destroy_vobject(struct vnode *vp);\n\nextern struct vop_vector fifo_specops;\nextern struct vop_vector dead_vnodeops;\nextern struct vop_vector default_vnodeops;\n\n#define VOP_PANIC\t((void*)(uintptr_t)vop_panic)\n#define VOP_NULL\t((void*)(uintptr_t)vop_null)\n#define VOP_EBADF\t((void*)(uintptr_t)vop_ebadf)\n#define VOP_ENOTTY\t((void*)(uintptr_t)vop_enotty)\n#define VOP_EINVAL\t((void*)(uintptr_t)vop_einval)\n#define VOP_ENOENT\t((void*)(uintptr_t)vop_enoent)\n#define VOP_EOPNOTSUPP\t((void*)(uintptr_t)vop_eopnotsupp)\n\n/* vfs_hash.c */\ntypedef int vfs_hash_cmp_t(struct vnode *vp, void *arg);\n\nint vfs_hash_get(const struct mount *mp, u_int hash, int flags, struct thread *td, struct vnode **vpp, vfs_hash_cmp_t *fn, void *arg);\nint vfs_hash_insert(struct vnode *vp, u_int hash, int flags, struct thread *td, struct vnode **vpp, vfs_hash_cmp_t *fn, void *arg);\nvoid vfs_hash_rehash(struct vnode *vp, u_int hash);\nvoid vfs_hash_remove(struct vnode *vp);\n\nint vfs_kqfilter(struct vop_kqfilter_args *);\nvoid vfs_mark_atime(struct vnode *vp, struct ucred *cred);\nstruct dirent;\nint vfs_read_dirent(struct vop_readdir_args *ap, struct dirent *dp, off_t off);\n\nint vfs_unixify_accmode(accmode_t *accmode);\n\nint setfmode(struct thread *td, struct ucred *cred, struct vnode *vp, int mode);\nint setfown(struct thread *td, struct ucred *cred, struct vnode *vp, uid_t uid,\n    gid_t gid);\nint vn_chmod(struct file *fp, mode_t mode, struct ucred *active_cred,\n    struct thread *td);\nint vn_chown(struct file *fp, uid_t uid, gid_t gid, struct ucred *active_cred,\n    struct thread *td);\n\n#endif /* _KERNEL */\n\n#endif /* !_SYS_VNODE_H_ */\n"
  },
  {
    "path": "freebsd-headers/sys/vtoc.h",
    "content": "/*-\n * Copyright (c) 2008 Marcel Moolenaar\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n *\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR\n * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES\n * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,\n * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF\n * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/sys/vtoc.h 208777 2010-06-03 13:01:55Z marius $\n */\n\n#ifndef _SYS_VTOC_H_\n#define\t_SYS_VTOC_H_\n\n#define\tVTOC_TAG_UNASSIGNED\t0x00\n#define\tVTOC_TAG_BOOT\t\t0x01\n#define\tVTOC_TAG_ROOT\t\t0x02\n#define\tVTOC_TAG_SWAP\t\t0x03\n#define\tVTOC_TAG_USR\t\t0x04\n#define\tVTOC_TAG_BACKUP\t\t0x05\t/* \"c\" partition */\n#define\tVTOC_TAG_STAND\t\t0x06\n#define\tVTOC_TAG_VAR\t\t0x07\n#define\tVTOC_TAG_HOME\t\t0x08\n#define\tVTOC_TAG_ALTSCTR\t0x09\t/* alternate sector partition */\n#define\tVTOC_TAG_CACHE\t\t0x0a\t/* Solaris cachefs partition */\n#define\tVTOC_TAG_VXVM_PUB\t0x0e\t/* VxVM public region */\n#define\tVTOC_TAG_VXVM_PRIV\t0x0f\t/* VxVM private region */\n\n/* NetBSD/mips defines this */\n#define\tVTOC_TAG_NETBSD_FFS\t0xff\n\n/* FreeBSD tags: the high byte equals ELFOSABI_FREEBSD */\n#define\tVTOC_TAG_FREEBSD_SWAP\t0x0901\n#define\tVTOC_TAG_FREEBSD_UFS\t0x0902\n#define\tVTOC_TAG_FREEBSD_VINUM\t0x0903\n#define\tVTOC_TAG_FREEBSD_ZFS\t0x0904\n\n#define\tVTOC_FLAG_UNMNT\t\t0x01\t/* unmountable partition */\n#define\tVTOC_FLAG_RDONLY\t0x10    /* partition is read/only */\n\n#define\tVTOC_ASCII_LEN\t128\n#define\tVTOC_BOOTSIZE\t8192\t\t/* 16 sectors */\n#define\tVTOC_MAGIC\t0xdabe\n#define\tVTOC_RAW_PART\t2\n#define\tVTOC_SANITY\t0x600ddeee\n#define\tVTOC_VERSION\t1\n#define\tVTOC_VOLUME_LEN\t8\n\n#define\tVTOC8_NPARTS\t8\n\nstruct vtoc8 {\n\tchar\t\tascii[VTOC_ASCII_LEN];\n\tuint32_t\tversion;\n\tchar\t\tvolume[VTOC_VOLUME_LEN];\n\tuint16_t\tnparts;\n\tstruct {\n\t\tuint16_t\ttag;\n\t\tuint16_t\tflag;\n\t} part[VTOC8_NPARTS] __packed;\n\tuint16_t\t__alignment;\n\tuint32_t\tbootinfo[3];\n\tuint32_t\tsanity;\n\tuint32_t\treserved[10];\n\tuint32_t\ttimestamp[VTOC8_NPARTS];\n\tuint16_t\twskip;\n\tuint16_t\trskip;\n\tchar\t\tpadding[152];\n\tuint16_t\trpm;\n\tuint16_t\tphyscyls;\n\tuint16_t\tsparesecs;\n\tuint16_t\tspare1[2];\n\tuint16_t\tinterleave;\n\tuint16_t\tncyls;\n\tuint16_t\taltcyls;\n\tuint16_t\tnheads;\n\tuint16_t\tnsecs;\n\tuint16_t\tspare2[2];\n\tstruct {\n\t\tuint32_t\tcyl;\n\t\tuint32_t\tnblks;\n\t} map[VTOC8_NPARTS];\n\tuint16_t\tmagic;\n\tuint16_t\tcksum;\n} __packed;\n\n#ifdef CTASSERT\nCTASSERT(sizeof(struct vtoc8) == 512);\n#endif\n\n#endif /* _SYS_VTOC_H_ */\n"
  },
  {
    "path": "freebsd-headers/sys/wait.h",
    "content": "/*-\n * Copyright (c) 1982, 1986, 1989, 1993, 1994\n *\tThe Regents of the University of California.  All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 4. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t@(#)wait.h\t8.2 (Berkeley) 7/10/94\n * $FreeBSD: release/9.0.0/sys/sys/wait.h 182193 2008-08-26 12:37:16Z kib $\n */\n\n#ifndef _SYS_WAIT_H_\n#define _SYS_WAIT_H_\n\n#include <sys/cdefs.h>\n\n/*\n * This file holds definitions relevant to the wait4 system call and the\n * alternate interfaces that use it (wait, wait3, waitpid).\n */\n\n/*\n * Macros to test the exit status returned by wait and extract the relevant\n * values.\n */\n#if __BSD_VISIBLE\n#define\tWCOREFLAG\t0200\n#endif\n#define\t_W_INT(i)\t(i)\n\n#define\t_WSTATUS(x)\t(_W_INT(x) & 0177)\n#define\t_WSTOPPED\t0177\t\t/* _WSTATUS if process is stopped */\n#define\tWIFSTOPPED(x)\t(_WSTATUS(x) == _WSTOPPED)\n#define\tWSTOPSIG(x)\t(_W_INT(x) >> 8)\n#define\tWIFSIGNALED(x)\t(_WSTATUS(x) != _WSTOPPED && _WSTATUS(x) != 0)\n#define\tWTERMSIG(x)\t(_WSTATUS(x))\n#define\tWIFEXITED(x)\t(_WSTATUS(x) == 0)\n#define\tWEXITSTATUS(x)\t(_W_INT(x) >> 8)\n#define\tWIFCONTINUED(x)\t(x == 0x13)\t/* 0x13 == SIGCONT */\n#if __BSD_VISIBLE\n#define\tWCOREDUMP(x)\t(_W_INT(x) & WCOREFLAG)\n\n#define\tW_EXITCODE(ret, sig)\t((ret) << 8 | (sig))\n#define\tW_STOPCODE(sig)\t\t((sig) << 8 | _WSTOPPED)\n#endif\n\n/*\n * Option bits for the third argument of wait4.  WNOHANG causes the\n * wait to not hang if there are no stopped or terminated processes, rather\n * returning an error indication in this case (pid==0).  WUNTRACED\n * indicates that the caller should receive status about untraced children\n * which stop due to signals.  If children are stopped and a wait without\n * this option is done, it is as though they were still running... nothing\n * about them is returned. WNOWAIT only request information about zombie,\n * leaving the proc around, available for later waits.\n */\n#define\tWNOHANG\t\t1\t/* Don't hang in wait. */\n#define\tWUNTRACED\t2\t/* Tell about stopped, untraced children. */\n#define\tWSTOPPED\tWUNTRACED   /* SUS compatibility */\n#define\tWCONTINUED\t4\t/* Report a job control continued process. */\n#define\tWNOWAIT\t\t8\t/* Poll only. Don't delete the proc entry. */\n\n#if __BSD_VISIBLE\n#define\tWLINUXCLONE 0x80000000\t/* Wait for kthread spawned from linux_clone. */\n#endif\n\n/*\n * Tokens for special values of the \"pid\" parameter to wait4.\n */\n#if __BSD_VISIBLE\n#define\tWAIT_ANY\t(-1)\t/* any process */\n#define\tWAIT_MYPGRP\t0\t/* any process in my process group */\n#endif /* __BSD_VISIBLE */\n\n#ifndef _KERNEL\n#include <sys/types.h>\n\n__BEGIN_DECLS\npid_t\twait(int *);\npid_t\twaitpid(pid_t, int *, int);\n#if __BSD_VISIBLE\nstruct rusage;\npid_t\twait3(int *, int, struct rusage *);\npid_t\twait4(pid_t, int *, int, struct rusage *);\n#endif\n__END_DECLS\n#endif /* !_KERNEL */\n\n#endif /* !_SYS_WAIT_H_ */\n"
  },
  {
    "path": "freebsd-headers/sys/watchdog.h",
    "content": "/*-\n * Copyright (c) 2003 Poul-Henning Kamp\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/sys/watchdog.h 221121 2011-04-27 16:43:03Z attilio $\n */\n#ifndef _SYS_WATCHDOG_H\n#define\t_SYS_WATCHDOG_H\n\n#include <sys/ioccom.h>\n\n#define\t_PATH_WATCHDOG\t\"fido\"\n\n#define WDIOCPATPAT\t_IOW('W', 42, u_int)\n\n#define WD_ACTIVE\t0x8000000\n\t/* \n\t * Watchdog reset, timeout set to value in WD_INTERVAL field.\n\t * The kernel will arm the watchdog and unless the userland\n\t * program calls WDIOCPATPAT again before the timer expires\n\t * the system will reinitialize.\n\t */\n\n#define WD_PASSIVE\t0x0400000\n\t/*\n\t * Set the watchdog in passive mode.\n\t * The kernel will chose an appropriate timeout duration and\n\t * periodically reset the timer provided everything looks all\n\t * right to the kernel.\n \t */\n\n#define WD_LASTVAL\t0x0200000\n\t/*\n\t * Use the already last used timeout value.\n\t * The kernel will use as timeout the last valid timeout provided.\n \t */\n\n#define WD_INTERVAL\t0x00000ff\n\t/*\n\t * Mask for duration bits.\n\t * The watchdog will have a nominal patience of 2^N * nanoseconds.\n\t * Example:  N == 30 gives a patience of 2^30 nanoseconds ~= 1 second.\n\t * NB: Expect variance in the +/- 10-20% range.\n\t */\n\n/* Handy macros for humans not used to power of two nanoseconds */\n#define WD_TO_NEVER\t0\n#define WD_TO_1MS\t20\n#define WD_TO_125MS\t27\n#define WD_TO_250MS\t28\n#define WD_TO_500MS\t29\n#define WD_TO_1SEC\t30\n#define WD_TO_2SEC\t31\n#define WD_TO_4SEC\t32\n#define WD_TO_8SEC\t33\n#define WD_TO_16SEC\t34\n#define WD_TO_32SEC\t35\n\n#ifdef _KERNEL\n\n#include <sys/eventhandler.h>\n\ntypedef void (*watchdog_fn)(void *, u_int, int *);\n\nEVENTHANDLER_DECLARE(watchdog_list, watchdog_fn);\n\nu_int\twdog_kern_last_timeout(void);\nint\twdog_kern_pat(u_int utim);\n#endif\n\n#endif /* _SYS_WATCHDOG_H */\n"
  },
  {
    "path": "freebsd-headers/sysexits.h",
    "content": "/*\n * Copyright (c) 1987, 1993\n *\tThe Regents of the University of California.  All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t@(#)sysexits.h\t8.1 (Berkeley) 6/2/93\n *\n * $FreeBSD: release/9.0.0/include/sysexits.h 203964 2010-02-16 19:39:50Z imp $\n */\n\n#ifndef\t_SYSEXITS_H_\n#define\t_SYSEXITS_H_\n\n/*\n *  SYSEXITS.H -- Exit status codes for system programs.\n *\n *\tThis include file attempts to categorize possible error\n *\texit statuses for system programs, notably delivermail\n *\tand the Berkeley network.\n *\n *\tError numbers begin at EX__BASE to reduce the possibility of\n *\tclashing with other exit statuses that random programs may\n *\talready return.  The meaning of the codes is approximately\n *\tas follows:\n *\n *\tEX_USAGE -- The command was used incorrectly, e.g., with\n *\t\tthe wrong number of arguments, a bad flag, a bad\n *\t\tsyntax in a parameter, or whatever.\n *\tEX_DATAERR -- The input data was incorrect in some way.\n *\t\tThis should only be used for user's data & not\n *\t\tsystem files.\n *\tEX_NOINPUT -- An input file (not a system file) did not\n *\t\texist or was not readable.  This could also include\n *\t\terrors like \"No message\" to a mailer (if it cared\n *\t\tto catch it).\n *\tEX_NOUSER -- The user specified did not exist.  This might\n *\t\tbe used for mail addresses or remote logins.\n *\tEX_NOHOST -- The host specified did not exist.  This is used\n *\t\tin mail addresses or network requests.\n *\tEX_UNAVAILABLE -- A service is unavailable.  This can occur\n *\t\tif a support program or file does not exist.  This\n *\t\tcan also be used as a catchall message when something\n *\t\tyou wanted to do doesn't work, but you don't know\n *\t\twhy.\n *\tEX_SOFTWARE -- An internal software error has been detected.\n *\t\tThis should be limited to non-operating system related\n *\t\terrors as possible.\n *\tEX_OSERR -- An operating system error has been detected.\n *\t\tThis is intended to be used for such things as \"cannot\n *\t\tfork\", \"cannot create pipe\", or the like.  It includes\n *\t\tthings like getuid returning a user that does not\n *\t\texist in the passwd file.\n *\tEX_OSFILE -- Some system file (e.g., /etc/passwd, /etc/utmp,\n *\t\tetc.) does not exist, cannot be opened, or has some\n *\t\tsort of error (e.g., syntax error).\n *\tEX_CANTCREAT -- A (user specified) output file cannot be\n *\t\tcreated.\n *\tEX_IOERR -- An error occurred while doing I/O on some file.\n *\tEX_TEMPFAIL -- temporary failure, indicating something that\n *\t\tis not really an error.  In sendmail, this means\n *\t\tthat a mailer (e.g.) could not create a connection,\n *\t\tand the request should be reattempted later.\n *\tEX_PROTOCOL -- the remote system returned something that\n *\t\twas \"not possible\" during a protocol exchange.\n *\tEX_NOPERM -- You did not have sufficient permission to\n *\t\tperform the operation.  This is not intended for\n *\t\tfile system problems, which should use NOINPUT or\n *\t\tCANTCREAT, but rather for higher level permissions.\n */\n\n#define EX_OK\t\t0\t/* successful termination */\n\n#define EX__BASE\t64\t/* base value for error messages */\n\n#define EX_USAGE\t64\t/* command line usage error */\n#define EX_DATAERR\t65\t/* data format error */\n#define EX_NOINPUT\t66\t/* cannot open input */\n#define EX_NOUSER\t67\t/* addressee unknown */\n#define EX_NOHOST\t68\t/* host name unknown */\n#define EX_UNAVAILABLE\t69\t/* service unavailable */\n#define EX_SOFTWARE\t70\t/* internal software error */\n#define EX_OSERR\t71\t/* system error (e.g., can't fork) */\n#define EX_OSFILE\t72\t/* critical OS file missing */\n#define EX_CANTCREAT\t73\t/* can't create (user) output file */\n#define EX_IOERR\t74\t/* input/output error */\n#define EX_TEMPFAIL\t75\t/* temp failure; user is invited to retry */\n#define EX_PROTOCOL\t76\t/* remote error in protocol */\n#define EX_NOPERM\t77\t/* permission denied */\n#define EX_CONFIG\t78\t/* configuration error */\n\n#define EX__MAX\t78\t/* maximum listed value */\n\n#endif /* !_SYSEXITS_H_ */\n"
  },
  {
    "path": "freebsd-headers/taclib.h",
    "content": "/*-\n * Copyright (c) 1998, 2001, Juniper Networks, Inc.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t$FreeBSD: release/9.0.0/lib/libtacplus/taclib.h 200399 2009-12-11 07:53:44Z syrinx $\n */\n\n#ifndef _TACLIB_H_\n#define _TACLIB_H_\n\n#include <sys/types.h>\n\nstruct tac_handle;\n\n/* Flags for tac_add_server(). */\n#define TAC_SRVR_SINGLE_CONNECT\t0x04\t/* Keep connection open for multiple\n\t\t\t\t\t   sessions. */\n\n/* Disassembly of tac_send_authen() return value. */\n#define\tTAC_AUTHEN_STATUS(s)\t((s) & 0xff)\n#define TAC_AUTHEN_NOECHO(s)\t((s) & (1<<8))\n\n/* Disassembly of tac_send_author() return value. */\n#define\tTAC_AUTHOR_STATUS(s)\t((s) & 0xff)\n#define TAC_AUTHEN_AV_COUNT(s)\t(((s)>>8) & 0xff)\n\n/* Privilege levels */\n#define TAC_PRIV_LVL_MIN\t0x00\n#define TAC_PRIV_LVL_USER\t0x01\n#define TAC_PRIV_LVL_ROOT\t0x0f\n#define TAC_PRIV_LVL_MAX\t0x0f\n\n/* Authentication actions */\n#define TAC_AUTHEN_LOGIN\t0x01\n#define TAC_AUTHEN_CHPASS\t0x02\n#define TAC_AUTHEN_SENDPASS\t0x03\n#define TAC_AUTHEN_SENDAUTH\t0x04\n\n/* Authentication types */\n#define TAC_AUTHEN_TYPE_ASCII\t0x01\n#define TAC_AUTHEN_TYPE_PAP\t0x02\n#define TAC_AUTHEN_TYPE_CHAP\t0x03\n#define TAC_AUTHEN_TYPE_ARAP\t0x04\n#define TAC_AUTHEN_TYPE_MSCHAP\t0x05\n\n/* Authentication services */\n#define TAC_AUTHEN_SVC_NONE\t0x00\n#define TAC_AUTHEN_SVC_LOGIN\t0x01\n#define TAC_AUTHEN_SVC_ENABLE\t0x02\n#define TAC_AUTHEN_SVC_PPP\t0x03\n#define TAC_AUTHEN_SVC_ARAP\t0x04\n#define TAC_AUTHEN_SVC_PT\t0x05\n#define TAC_AUTHEN_SVC_RCMD\t0x06\n#define TAC_AUTHEN_SVC_X25\t0x07\n#define TAC_AUTHEN_SVC_NASI\t0x08\n#define TAC_AUTHEN_SVC_FWPROXY\t0x09\n\n/* Authentication reply status codes */\n#define TAC_AUTHEN_STATUS_PASS\t\t0x01\n#define TAC_AUTHEN_STATUS_FAIL\t\t0x02\n#define TAC_AUTHEN_STATUS_GETDATA\t0x03\n#define TAC_AUTHEN_STATUS_GETUSER\t0x04\n#define TAC_AUTHEN_STATUS_GETPASS\t0x05\n#define TAC_AUTHEN_STATUS_RESTART\t0x06\n#define TAC_AUTHEN_STATUS_ERROR\t\t0x07\n#define TAC_AUTHEN_STATUS_FOLLOW\t0x21\n\n/* Authorization authenticatication methods */\n#define TAC_AUTHEN_METH_NOT_SET         0x00\n#define TAC_AUTHEN_METH_NONE            0x01\n#define TAC_AUTHEN_METH_KRB5            0x02\n#define TAC_AUTHEN_METH_LINE            0x03\n#define TAC_AUTHEN_METH_ENABLE          0x04\n#define TAC_AUTHEN_METH_LOCAL           0x05\n#define TAC_AUTHEN_METH_TACACSPLUS      0x06\n#define TAC_AUTHEN_METH_RCMD            0x20\n/* If adding more, see comments in protocol_version() in taclib.c */\n\n/* Authorization status */\n#define TAC_AUTHOR_STATUS_PASS_ADD      0x01\n#define TAC_AUTHOR_STATUS_PASS_REPL     0x02\n#define TAC_AUTHOR_STATUS_FAIL          0x10\n#define TAC_AUTHOR_STATUS_ERROR         0x11\n\n/* Accounting actions */\n#define TAC_ACCT_MORE\t\t\t0x1\n#define TAC_ACCT_START\t\t\t0x2\n#define TAC_ACCT_STOP\t\t\t0x4\n#define TAC_ACCT_WATCHDOG\t\t0x8\n\n/* Accounting status */\n#define TAC_ACCT_STATUS_SUCCESS\t\t0x1\n#define TAC_ACCT_STATUS_ERROR\t\t0x2\n#define TAC_ACCT_STATUS_FOLLOW\t\t0x21\n\n__BEGIN_DECLS\nint\t\t\t tac_add_server(struct tac_handle *,\n\t\t\t    const char *, int, const char *, int, int);\nvoid\t\t\t tac_close(struct tac_handle *);\nint\t\t\t tac_config(struct tac_handle *, const char *);\nint\t\t\t tac_create_authen(struct tac_handle *, int, int, int);\nvoid\t\t\t*tac_get_data(struct tac_handle *, size_t *);\nchar\t\t\t*tac_get_msg(struct tac_handle *);\nstruct tac_handle\t*tac_open(void);\nint\t\t\t tac_send_authen(struct tac_handle *);\nint\t\t\t tac_set_data(struct tac_handle *,\n\t\t\t    const void *, size_t);\nint\t\t\t tac_set_msg(struct tac_handle *, const char *);\nint\t\t\t tac_set_port(struct tac_handle *, const char *);\nint\t\t\t tac_set_priv(struct tac_handle *, int);\nint\t\t\t tac_set_rem_addr(struct tac_handle *, const char *);\nint\t\t\t tac_set_user(struct tac_handle *, const char *);\nconst char\t\t*tac_strerror(struct tac_handle *);\nint\t\t\t tac_send_author(struct tac_handle *);\nint\t\t\t tac_create_author(struct tac_handle *, int, int, int);\nint\t\t\t tac_set_av(struct tac_handle *, u_int, const char *);\nchar\t\t\t*tac_get_av(struct tac_handle *, u_int);\nchar\t\t\t*tac_get_av_value(struct tac_handle *, const char *);\nvoid\t\t\t tac_clear_avs(struct tac_handle *);\nint\t\t\t tac_create_acct(struct tac_handle *, int, int, int, int);\nint\t\t\t tac_send_acct(struct tac_handle *);\n__END_DECLS\n\n#endif /* _TACLIB_H_ */\n"
  },
  {
    "path": "freebsd-headers/tar.h",
    "content": "/*-\n * Copyright (c) 1994\n *\tThe Regents of the University of California.  All rights reserved.\n *\n * This code is derived from software contributed to Berkeley by\n * Chuck Karish of Mindcraft, Inc.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t@(#)tar.h\t8.2 (Berkeley) 1/4/94\n *\n * $FreeBSD: release/9.0.0/include/tar.h 203964 2010-02-16 19:39:50Z imp $\n */\n\n#ifndef _TAR_H\n#define _TAR_H\n\n#define\tTMAGIC\t\t\"ustar\"\t/* ustar and a null */\n#define\tTMAGLEN\t\t6\n#define\tTVERSION\t\"00\"\t/* 00 and no null */\n#define\tTVERSLEN\t2\n\n/* Values used in typeflag field */\n#define\tREGTYPE\t\t'0'\t/* Regular file */\n#define\tAREGTYPE\t'\\0'\t/* Regular file */\n#define\tLNKTYPE\t\t'1'\t/* Link */\n#define\tSYMTYPE\t\t'2'\t/* Reserved */\n#define\tCHRTYPE\t\t'3'\t/* Character special */\n#define\tBLKTYPE\t\t'4'\t/* Block special */\n#define\tDIRTYPE\t\t'5'\t/* Directory */\n#define\tFIFOTYPE\t'6'\t/* FIFO special */\n#define\tCONTTYPE\t'7'\t/* Reserved */\n\n/* Bits used in the mode field - values in octal */\n#define\tTSUID\t\t04000\t/* Set UID on execution */\n#define\tTSGID\t\t02000\t/* Set GID on execution */\n#define\tTSVTX\t\t01000\t/* Reserved */\n\t\t\t\t/* File permissions */\n#define\tTUREAD\t\t00400\t/* Read by owner */\n#define\tTUWRITE\t\t00200\t/* Write by owner */\n#define\tTUEXEC\t\t00100\t/* Execute/Search by owner */\n#define\tTGREAD\t\t00040\t/* Read by group */\n#define\tTGWRITE\t\t00020\t/* Write by group */\n#define\tTGEXEC\t\t00010\t/* Execute/Search by group */\n#define\tTOREAD\t\t00004\t/* Read by other */\n#define\tTOWRITE\t\t00002\t/* Write by other */\n#define\tTOEXEC\t\t00001\t/* Execute/Search by other */\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/tcpd.h",
    "content": " /*\n  * @(#) tcpd.h 1.5 96/03/19 16:22:24\n  * \n  * Author: Wietse Venema, Eindhoven University of Technology, The Netherlands.\n  *\n  * $FreeBSD: release/9.0.0/contrib/tcp_wrappers/tcpd.h 56977 2000-02-03 10:27:03Z shin $\n  */\n\n/* Structure to describe one communications endpoint. */\n\n#define STRING_LENGTH\t128\t\t/* hosts, users, processes */\n\nstruct host_info {\n    char    name[STRING_LENGTH];\t/* access via eval_hostname(host) */\n    char    addr[STRING_LENGTH];\t/* access via eval_hostaddr(host) */\n#ifdef INET6\n    struct sockaddr *sin;\t\t/* socket address or 0 */\n#else\n    struct sockaddr_in *sin;\t\t/* socket address or 0 */\n#endif\n    struct t_unitdata *unit;\t\t/* TLI transport address or 0 */\n    struct request_info *request;\t/* for shared information */\n};\n\n/* Structure to describe what we know about a service request. */\n\nstruct request_info {\n    int     fd;\t\t\t\t/* socket handle */\n    char    user[STRING_LENGTH];\t/* access via eval_user(request) */\n    char    daemon[STRING_LENGTH];\t/* access via eval_daemon(request) */\n    char    pid[10];\t\t\t/* access via eval_pid(request) */\n    struct host_info client[1];\t\t/* client endpoint info */\n    struct host_info server[1];\t\t/* server endpoint info */\n    void  (*sink) ();\t\t\t/* datagram sink function or 0 */\n    void  (*hostname) ();\t\t/* address to printable hostname */\n    void  (*hostaddr) ();\t\t/* address to printable address */\n    void  (*cleanup) ();\t\t/* cleanup function or 0 */\n    struct netconfig *config;\t\t/* netdir handle */\n};\n\n/* Common string operations. Less clutter should be more readable. */\n\n#define STRN_CPY(d,s,l)\t{ strncpy((d),(s),(l)); (d)[(l)-1] = 0; }\n\n#define STRN_EQ(x,y,l)\t(strncasecmp((x),(y),(l)) == 0)\n#define STRN_NE(x,y,l)\t(strncasecmp((x),(y),(l)) != 0)\n#define STR_EQ(x,y)\t(strcasecmp((x),(y)) == 0)\n#define STR_NE(x,y)\t(strcasecmp((x),(y)) != 0)\n\n /*\n  * Initially, all above strings have the empty value. Information that\n  * cannot be determined at runtime is set to \"unknown\", so that we can\n  * distinguish between `unavailable' and `not yet looked up'. A hostname\n  * that we do not believe in is set to \"paranoid\".\n  */\n\n#define STRING_UNKNOWN\t\"unknown\"\t/* lookup failed */\n#define STRING_PARANOID\t\"paranoid\"\t/* hostname conflict */\n\nextern char unknown[];\nextern char paranoid[];\n\n#define HOSTNAME_KNOWN(s) (STR_NE((s),unknown) && STR_NE((s),paranoid))\n\n#define NOT_INADDR(s) (s[strspn(s,\"01234567890./\")] != 0)\n\n/* Global functions. */\n\n#if defined(TLI) || defined(PTX) || defined(TLI_SEQUENT)\nextern void fromhost();\t\t\t/* get/validate client host info */\n#else\n#define fromhost sock_host\t\t/* no TLI support needed */\n#endif\n\nextern int hosts_access();\t\t/* access control */\nextern void shell_cmd();\t\t/* execute shell command */\nextern char *percent_x();\t\t/* do %<char> expansion */\nextern void rfc931();\t\t\t/* client name from RFC 931 daemon */\nextern void clean_exit();\t\t/* clean up and exit */\nextern void refuse();\t\t\t/* clean up and exit */\nextern char *xgets();\t\t\t/* fgets() on steroids */\nextern char *split_at();\t\t/* strchr() and split */\nextern unsigned long dot_quad_addr();\t/* restricted inet_addr() */\n\n/* Global variables. */\n\nextern int allow_severity;\t\t/* for connection logging */\nextern int deny_severity;\t\t/* for connection logging */\nextern char *hosts_allow_table;\t\t/* for verification mode redirection */\nextern char *hosts_deny_table;\t\t/* for verification mode redirection */\nextern int hosts_access_verbose;\t/* for verbose matching mode */\nextern int rfc931_timeout;\t\t/* user lookup timeout */\nextern int resident;\t\t\t/* > 0 if resident process */\n\n /*\n  * Routines for controlled initialization and update of request structure\n  * attributes. Each attribute has its own key.\n  */\n\n#ifdef __STDC__\nextern struct request_info *request_init(struct request_info *,...);\nextern struct request_info *request_set(struct request_info *,...);\n#else\nextern struct request_info *request_init();\t/* initialize request */\nextern struct request_info *request_set();\t/* update request structure */\n#endif\n\n#define RQ_FILE\t\t1\t\t/* file descriptor */\n#define RQ_DAEMON\t2\t\t/* server process (argv[0]) */\n#define RQ_USER\t\t3\t\t/* client user name */\n#define RQ_CLIENT_NAME\t4\t\t/* client host name */\n#define RQ_CLIENT_ADDR\t5\t\t/* client host address */\n#define RQ_CLIENT_SIN\t6\t\t/* client endpoint (internal) */\n#define RQ_SERVER_NAME\t7\t\t/* server host name */\n#define RQ_SERVER_ADDR\t8\t\t/* server host address */\n#define RQ_SERVER_SIN\t9\t\t/* server endpoint (internal) */\n\n /*\n  * Routines for delayed evaluation of request attributes. Each attribute\n  * type has its own access method. The trivial ones are implemented by\n  * macros. The other ones are wrappers around the transport-specific host\n  * name, address, and client user lookup methods. The request_info and\n  * host_info structures serve as caches for the lookup results.\n  */\n\nextern char *eval_user();\t\t/* client user */\nextern char *eval_hostname();\t\t/* printable hostname */\nextern char *eval_hostaddr();\t\t/* printable host address */\nextern char *eval_hostinfo();\t\t/* host name or address */\nextern char *eval_client();\t\t/* whatever is available */\nextern char *eval_server();\t\t/* whatever is available */\n#define eval_daemon(r)\t((r)->daemon)\t/* daemon process name */\n#define eval_pid(r)\t((r)->pid)\t/* process id */\n\n/* Socket-specific methods, including DNS hostname lookups. */\n\nextern void sock_host();\t\t/* look up endpoint addresses */\nextern void sock_hostname();\t\t/* translate address to hostname */\nextern void sock_hostaddr();\t\t/* address to printable address */\n#define sock_methods(r) \\\n\t{ (r)->hostname = sock_hostname; (r)->hostaddr = sock_hostaddr; }\n\n/* The System V Transport-Level Interface (TLI) interface. */\n\n#if defined(TLI) || defined(PTX) || defined(TLI_SEQUENT)\nextern void tli_host();\t\t\t/* look up endpoint addresses etc. */\n#endif\n\n /*\n  * Problem reporting interface. Additional file/line context is reported\n  * when available. The jump buffer (tcpd_buf) is not declared here, or\n  * everyone would have to include <setjmp.h>.\n  */\n\n#ifdef __STDC__\nextern void tcpd_warn(char *, ...);\t/* report problem and proceed */\nextern void tcpd_jump(char *, ...);\t/* report problem and jump */\n#else\nextern void tcpd_warn();\nextern void tcpd_jump();\n#endif\n\nstruct tcpd_context {\n    char   *file;\t\t\t/* current file */\n    int     line;\t\t\t/* current line */\n};\nextern struct tcpd_context tcpd_context;\n\n /*\n  * While processing access control rules, error conditions are handled by\n  * jumping back into the hosts_access() routine. This is cleaner than\n  * checking the return value of each and every silly little function. The\n  * (-1) returns are here because zero is already taken by longjmp().\n  */\n\n#define AC_PERMIT\t1\t\t/* permit access */\n#define AC_DENY\t\t(-1)\t\t/* deny_access */\n#define AC_ERROR\tAC_DENY\t\t/* XXX */\n\n /*\n  * In verification mode an option function should just say what it would do,\n  * instead of really doing it. An option function that would not return\n  * should clear the dry_run flag to inform the caller of this unusual\n  * behavior.\n  */\n\nextern void process_options();\t\t/* execute options */\nextern int dry_run;\t\t\t/* verification flag */\n\n/* Bug workarounds. */\n\n#ifdef INET_ADDR_BUG\t\t\t/* inet_addr() returns struct */\n#define inet_addr fix_inet_addr\nextern long fix_inet_addr();\n#endif\n\n#ifdef BROKEN_FGETS\t\t\t/* partial reads from sockets */\n#define fgets fix_fgets\nextern char *fix_fgets();\n#endif\n\n#ifdef RECVFROM_BUG\t\t\t/* no address family info */\n#define recvfrom fix_recvfrom\nextern int fix_recvfrom();\n#endif\n\n#ifdef GETPEERNAME_BUG\t\t\t/* claims success with UDP */\n#define getpeername fix_getpeername\nextern int fix_getpeername();\n#endif\n\n#ifdef SOLARIS_24_GETHOSTBYNAME_BUG\t/* lists addresses as aliases */\n#define gethostbyname fix_gethostbyname\nextern struct hostent *fix_gethostbyname();\n#endif\n\n#ifdef USE_STRSEP\t\t\t/* libc calls strtok() */\n#define strtok\tfix_strtok\nextern char *fix_strtok();\n#endif\n\n#ifdef LIBC_CALLS_STRTOK\t\t/* libc calls strtok() */\n#define strtok\tmy_strtok\nextern char *my_strtok();\n#endif\n"
  },
  {
    "path": "freebsd-headers/term.h",
    "content": "/****************************************************************************\n * Copyright (c) 1998-2007,2008 Free Software Foundation, Inc.              *\n *                                                                          *\n * Permission is hereby granted, free of charge, to any person obtaining a  *\n * copy of this software and associated documentation files (the            *\n * \"Software\"), to deal in the Software without restriction, including      *\n * without limitation the rights to use, copy, modify, merge, publish,      *\n * distribute, distribute with modifications, sublicense, and/or sell       *\n * copies of the Software, and to permit persons to whom the Software is    *\n * furnished to do so, subject to the following conditions:                 *\n *                                                                          *\n * The above copyright notice and this permission notice shall be included  *\n * in all copies or substantial portions of the Software.                   *\n *                                                                          *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS  *\n * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF               *\n * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.   *\n * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,   *\n * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR    *\n * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR    *\n * THE USE OR OTHER DEALINGS IN THE SOFTWARE.                               *\n *                                                                          *\n * Except as contained in this notice, the name(s) of the above copyright   *\n * holders shall not be used in advertising or otherwise to promote the     *\n * sale, use or other dealings in this Software without prior written       *\n * authorization.                                                           *\n ****************************************************************************/\n\n/****************************************************************************/\n/* Author: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995                */\n/*    and: Eric S. Raymond <esr@snark.thyrsus.com>                          */\n/*    and: Thomas E. Dickey                        1995-on                  */\n/****************************************************************************/\n\n/* $Id: MKterm.h.awk.in,v 1.50 2008/05/24 23:13:59 tom Exp $ */\n\n/*\n**\tterm.h -- Definition of struct term\n*/\n\n#ifndef NCURSES_TERM_H_incl\n#define NCURSES_TERM_H_incl 1\n\n#undef  NCURSES_VERSION\n#define NCURSES_VERSION \"5.7\"\n\n#include <ncurses_dll.h>\n\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\n/* Make this file self-contained by providing defaults for the HAVE_TERMIO[S]_H\n * definition (based on the system for which this was configured).\n */\n\n#undef  NCURSES_CONST\n#define NCURSES_CONST const\n\n#undef  NCURSES_SBOOL\n#define NCURSES_SBOOL char\n\n#undef  NCURSES_XNAMES\n#define NCURSES_XNAMES 1\n\n/* We will use these symbols to hide differences between\n * termios/termio/sgttyb interfaces.\n */\n#undef  TTY\n#undef  SET_TTY\n#undef  GET_TTY\n\n/* Assume POSIX termio if we have the header and function */\n/* #if HAVE_TERMIOS_H && HAVE_TCGETATTR */\n#if 1 && 1\n\n#undef  TERMIOS\n#define TERMIOS 1\n\n#include <termios.h>\n#define TTY struct termios\n\n#else /* !HAVE_TERMIOS_H */\n\n/* #if HAVE_TERMIO_H */\n#if 0\n\n#undef  TERMIOS\n#define TERMIOS 1\n\n#include <termio.h>\n#define TTY struct termio\n\n/* Add definitions to make termio look like termios.\n * But ifdef it, since there are some implementations\n * that try to do this for us in a fake <termio.h>.\n */\n#ifndef TCSANOW\n#define TCSANOW TCSETA\n#endif\n#ifndef TCSADRAIN\n#define TCSADRAIN TCSETAW\n#endif\n#ifndef TCSAFLUSH\n#define TCSAFLUSH TCSETAF\n#endif\n#ifndef tcsetattr\n#define tcsetattr(fd, cmd, arg) ioctl(fd, cmd, arg)\n#endif\n#ifndef tcgetattr\n#define tcgetattr(fd, arg) ioctl(fd, TCGETA, arg)\n#endif\n#ifndef cfgetospeed\n#define cfgetospeed(t) ((t)->c_cflag & CBAUD)\n#endif\n#ifndef TCIFLUSH \n#define TCIFLUSH 0\n#endif\n#ifndef TCOFLUSH \n#define TCOFLUSH 1\n#endif\n#ifndef TCIOFLUSH \n#define TCIOFLUSH 2\n#endif\n#ifndef tcflush\n#define tcflush(fd, arg) ioctl(fd, TCFLSH, arg)\n#endif\n\n#else /* !HAVE_TERMIO_H */\n\n#undef TERMIOS\n#include <sgtty.h>\n#include <sys/ioctl.h>\n#define TTY struct sgttyb\n\n#endif /* HAVE_TERMIO_H */\n\n#endif /* HAVE_TERMIOS_H */\n\n#ifdef TERMIOS\n#define GET_TTY(fd, buf) tcgetattr(fd, buf)\n#define SET_TTY(fd, buf) tcsetattr(fd, TCSADRAIN, buf)\n#else\n#define GET_TTY(fd, buf) gtty(fd, buf)\n#define SET_TTY(fd, buf) stty(fd, buf)\n#endif\n\n#define NAMESIZE 256\n\n#define CUR cur_term->type.\n\n#define auto_left_margin               CUR Booleans[0]\n#define auto_right_margin              CUR Booleans[1]\n#define no_esc_ctlc                    CUR Booleans[2]\n#define ceol_standout_glitch           CUR Booleans[3]\n#define eat_newline_glitch             CUR Booleans[4]\n#define erase_overstrike               CUR Booleans[5]\n#define generic_type                   CUR Booleans[6]\n#define hard_copy                      CUR Booleans[7]\n#define has_meta_key                   CUR Booleans[8]\n#define has_status_line                CUR Booleans[9]\n#define insert_null_glitch             CUR Booleans[10]\n#define memory_above                   CUR Booleans[11]\n#define memory_below                   CUR Booleans[12]\n#define move_insert_mode               CUR Booleans[13]\n#define move_standout_mode             CUR Booleans[14]\n#define over_strike                    CUR Booleans[15]\n#define status_line_esc_ok             CUR Booleans[16]\n#define dest_tabs_magic_smso           CUR Booleans[17]\n#define tilde_glitch                   CUR Booleans[18]\n#define transparent_underline          CUR Booleans[19]\n#define xon_xoff                       CUR Booleans[20]\n#define needs_xon_xoff                 CUR Booleans[21]\n#define prtr_silent                    CUR Booleans[22]\n#define hard_cursor                    CUR Booleans[23]\n#define non_rev_rmcup                  CUR Booleans[24]\n#define no_pad_char                    CUR Booleans[25]\n#define non_dest_scroll_region         CUR Booleans[26]\n#define can_change                     CUR Booleans[27]\n#define back_color_erase               CUR Booleans[28]\n#define hue_lightness_saturation       CUR Booleans[29]\n#define col_addr_glitch                CUR Booleans[30]\n#define cr_cancels_micro_mode          CUR Booleans[31]\n#define has_print_wheel                CUR Booleans[32]\n#define row_addr_glitch                CUR Booleans[33]\n#define semi_auto_right_margin         CUR Booleans[34]\n#define cpi_changes_res                CUR Booleans[35]\n#define lpi_changes_res                CUR Booleans[36]\n#define columns                        CUR Numbers[0]\n#define init_tabs                      CUR Numbers[1]\n#define lines                          CUR Numbers[2]\n#define lines_of_memory                CUR Numbers[3]\n#define magic_cookie_glitch            CUR Numbers[4]\n#define padding_baud_rate              CUR Numbers[5]\n#define virtual_terminal               CUR Numbers[6]\n#define width_status_line              CUR Numbers[7]\n#define num_labels                     CUR Numbers[8]\n#define label_height                   CUR Numbers[9]\n#define label_width                    CUR Numbers[10]\n#define max_attributes                 CUR Numbers[11]\n#define maximum_windows                CUR Numbers[12]\n#define max_colors                     CUR Numbers[13]\n#define max_pairs                      CUR Numbers[14]\n#define no_color_video                 CUR Numbers[15]\n#define buffer_capacity                CUR Numbers[16]\n#define dot_vert_spacing               CUR Numbers[17]\n#define dot_horz_spacing               CUR Numbers[18]\n#define max_micro_address              CUR Numbers[19]\n#define max_micro_jump                 CUR Numbers[20]\n#define micro_col_size                 CUR Numbers[21]\n#define micro_line_size                CUR Numbers[22]\n#define number_of_pins                 CUR Numbers[23]\n#define output_res_char                CUR Numbers[24]\n#define output_res_line                CUR Numbers[25]\n#define output_res_horz_inch           CUR Numbers[26]\n#define output_res_vert_inch           CUR Numbers[27]\n#define print_rate                     CUR Numbers[28]\n#define wide_char_size                 CUR Numbers[29]\n#define buttons                        CUR Numbers[30]\n#define bit_image_entwining            CUR Numbers[31]\n#define bit_image_type                 CUR Numbers[32]\n#define back_tab                       CUR Strings[0]\n#define bell                           CUR Strings[1]\n#define carriage_return                CUR Strings[2]\n#define change_scroll_region           CUR Strings[3]\n#define clear_all_tabs                 CUR Strings[4]\n#define clear_screen                   CUR Strings[5]\n#define clr_eol                        CUR Strings[6]\n#define clr_eos                        CUR Strings[7]\n#define column_address                 CUR Strings[8]\n#define command_character              CUR Strings[9]\n#define cursor_address                 CUR Strings[10]\n#define cursor_down                    CUR Strings[11]\n#define cursor_home                    CUR Strings[12]\n#define cursor_invisible               CUR Strings[13]\n#define cursor_left                    CUR Strings[14]\n#define cursor_mem_address             CUR Strings[15]\n#define cursor_normal                  CUR Strings[16]\n#define cursor_right                   CUR Strings[17]\n#define cursor_to_ll                   CUR Strings[18]\n#define cursor_up                      CUR Strings[19]\n#define cursor_visible                 CUR Strings[20]\n#define delete_character               CUR Strings[21]\n#define delete_line                    CUR Strings[22]\n#define dis_status_line                CUR Strings[23]\n#define down_half_line                 CUR Strings[24]\n#define enter_alt_charset_mode         CUR Strings[25]\n#define enter_blink_mode               CUR Strings[26]\n#define enter_bold_mode                CUR Strings[27]\n#define enter_ca_mode                  CUR Strings[28]\n#define enter_delete_mode              CUR Strings[29]\n#define enter_dim_mode                 CUR Strings[30]\n#define enter_insert_mode              CUR Strings[31]\n#define enter_secure_mode              CUR Strings[32]\n#define enter_protected_mode           CUR Strings[33]\n#define enter_reverse_mode             CUR Strings[34]\n#define enter_standout_mode            CUR Strings[35]\n#define enter_underline_mode           CUR Strings[36]\n#define erase_chars                    CUR Strings[37]\n#define exit_alt_charset_mode          CUR Strings[38]\n#define exit_attribute_mode            CUR Strings[39]\n#define exit_ca_mode                   CUR Strings[40]\n#define exit_delete_mode               CUR Strings[41]\n#define exit_insert_mode               CUR Strings[42]\n#define exit_standout_mode             CUR Strings[43]\n#define exit_underline_mode            CUR Strings[44]\n#define flash_screen                   CUR Strings[45]\n#define form_feed                      CUR Strings[46]\n#define from_status_line               CUR Strings[47]\n#define init_1string                   CUR Strings[48]\n#define init_2string                   CUR Strings[49]\n#define init_3string                   CUR Strings[50]\n#define init_file                      CUR Strings[51]\n#define insert_character               CUR Strings[52]\n#define insert_line                    CUR Strings[53]\n#define insert_padding                 CUR Strings[54]\n#define key_backspace                  CUR Strings[55]\n#define key_catab                      CUR Strings[56]\n#define key_clear                      CUR Strings[57]\n#define key_ctab                       CUR Strings[58]\n#define key_dc                         CUR Strings[59]\n#define key_dl                         CUR Strings[60]\n#define key_down                       CUR Strings[61]\n#define key_eic                        CUR Strings[62]\n#define key_eol                        CUR Strings[63]\n#define key_eos                        CUR Strings[64]\n#define key_f0                         CUR Strings[65]\n#define key_f1                         CUR Strings[66]\n#define key_f10                        CUR Strings[67]\n#define key_f2                         CUR Strings[68]\n#define key_f3                         CUR Strings[69]\n#define key_f4                         CUR Strings[70]\n#define key_f5                         CUR Strings[71]\n#define key_f6                         CUR Strings[72]\n#define key_f7                         CUR Strings[73]\n#define key_f8                         CUR Strings[74]\n#define key_f9                         CUR Strings[75]\n#define key_home                       CUR Strings[76]\n#define key_ic                         CUR Strings[77]\n#define key_il                         CUR Strings[78]\n#define key_left                       CUR Strings[79]\n#define key_ll                         CUR Strings[80]\n#define key_npage                      CUR Strings[81]\n#define key_ppage                      CUR Strings[82]\n#define key_right                      CUR Strings[83]\n#define key_sf                         CUR Strings[84]\n#define key_sr                         CUR Strings[85]\n#define key_stab                       CUR Strings[86]\n#define key_up                         CUR Strings[87]\n#define keypad_local                   CUR Strings[88]\n#define keypad_xmit                    CUR Strings[89]\n#define lab_f0                         CUR Strings[90]\n#define lab_f1                         CUR Strings[91]\n#define lab_f10                        CUR Strings[92]\n#define lab_f2                         CUR Strings[93]\n#define lab_f3                         CUR Strings[94]\n#define lab_f4                         CUR Strings[95]\n#define lab_f5                         CUR Strings[96]\n#define lab_f6                         CUR Strings[97]\n#define lab_f7                         CUR Strings[98]\n#define lab_f8                         CUR Strings[99]\n#define lab_f9                         CUR Strings[100]\n#define meta_off                       CUR Strings[101]\n#define meta_on                        CUR Strings[102]\n#define newline                        CUR Strings[103]\n#define pad_char                       CUR Strings[104]\n#define parm_dch                       CUR Strings[105]\n#define parm_delete_line               CUR Strings[106]\n#define parm_down_cursor               CUR Strings[107]\n#define parm_ich                       CUR Strings[108]\n#define parm_index                     CUR Strings[109]\n#define parm_insert_line               CUR Strings[110]\n#define parm_left_cursor               CUR Strings[111]\n#define parm_right_cursor              CUR Strings[112]\n#define parm_rindex                    CUR Strings[113]\n#define parm_up_cursor                 CUR Strings[114]\n#define pkey_key                       CUR Strings[115]\n#define pkey_local                     CUR Strings[116]\n#define pkey_xmit                      CUR Strings[117]\n#define print_screen                   CUR Strings[118]\n#define prtr_off                       CUR Strings[119]\n#define prtr_on                        CUR Strings[120]\n#define repeat_char                    CUR Strings[121]\n#define reset_1string                  CUR Strings[122]\n#define reset_2string                  CUR Strings[123]\n#define reset_3string                  CUR Strings[124]\n#define reset_file                     CUR Strings[125]\n#define restore_cursor                 CUR Strings[126]\n#define row_address                    CUR Strings[127]\n#define save_cursor                    CUR Strings[128]\n#define scroll_forward                 CUR Strings[129]\n#define scroll_reverse                 CUR Strings[130]\n#define set_attributes                 CUR Strings[131]\n#define set_tab                        CUR Strings[132]\n#define set_window                     CUR Strings[133]\n#define tab                            CUR Strings[134]\n#define to_status_line                 CUR Strings[135]\n#define underline_char                 CUR Strings[136]\n#define up_half_line                   CUR Strings[137]\n#define init_prog                      CUR Strings[138]\n#define key_a1                         CUR Strings[139]\n#define key_a3                         CUR Strings[140]\n#define key_b2                         CUR Strings[141]\n#define key_c1                         CUR Strings[142]\n#define key_c3                         CUR Strings[143]\n#define prtr_non                       CUR Strings[144]\n#define char_padding                   CUR Strings[145]\n#define acs_chars                      CUR Strings[146]\n#define plab_norm                      CUR Strings[147]\n#define key_btab                       CUR Strings[148]\n#define enter_xon_mode                 CUR Strings[149]\n#define exit_xon_mode                  CUR Strings[150]\n#define enter_am_mode                  CUR Strings[151]\n#define exit_am_mode                   CUR Strings[152]\n#define xon_character                  CUR Strings[153]\n#define xoff_character                 CUR Strings[154]\n#define ena_acs                        CUR Strings[155]\n#define label_on                       CUR Strings[156]\n#define label_off                      CUR Strings[157]\n#define key_beg                        CUR Strings[158]\n#define key_cancel                     CUR Strings[159]\n#define key_close                      CUR Strings[160]\n#define key_command                    CUR Strings[161]\n#define key_copy                       CUR Strings[162]\n#define key_create                     CUR Strings[163]\n#define key_end                        CUR Strings[164]\n#define key_enter                      CUR Strings[165]\n#define key_exit                       CUR Strings[166]\n#define key_find                       CUR Strings[167]\n#define key_help                       CUR Strings[168]\n#define key_mark                       CUR Strings[169]\n#define key_message                    CUR Strings[170]\n#define key_move                       CUR Strings[171]\n#define key_next                       CUR Strings[172]\n#define key_open                       CUR Strings[173]\n#define key_options                    CUR Strings[174]\n#define key_previous                   CUR Strings[175]\n#define key_print                      CUR Strings[176]\n#define key_redo                       CUR Strings[177]\n#define key_reference                  CUR Strings[178]\n#define key_refresh                    CUR Strings[179]\n#define key_replace                    CUR Strings[180]\n#define key_restart                    CUR Strings[181]\n#define key_resume                     CUR Strings[182]\n#define key_save                       CUR Strings[183]\n#define key_suspend                    CUR Strings[184]\n#define key_undo                       CUR Strings[185]\n#define key_sbeg                       CUR Strings[186]\n#define key_scancel                    CUR Strings[187]\n#define key_scommand                   CUR Strings[188]\n#define key_scopy                      CUR Strings[189]\n#define key_screate                    CUR Strings[190]\n#define key_sdc                        CUR Strings[191]\n#define key_sdl                        CUR Strings[192]\n#define key_select                     CUR Strings[193]\n#define key_send                       CUR Strings[194]\n#define key_seol                       CUR Strings[195]\n#define key_sexit                      CUR Strings[196]\n#define key_sfind                      CUR Strings[197]\n#define key_shelp                      CUR Strings[198]\n#define key_shome                      CUR Strings[199]\n#define key_sic                        CUR Strings[200]\n#define key_sleft                      CUR Strings[201]\n#define key_smessage                   CUR Strings[202]\n#define key_smove                      CUR Strings[203]\n#define key_snext                      CUR Strings[204]\n#define key_soptions                   CUR Strings[205]\n#define key_sprevious                  CUR Strings[206]\n#define key_sprint                     CUR Strings[207]\n#define key_sredo                      CUR Strings[208]\n#define key_sreplace                   CUR Strings[209]\n#define key_sright                     CUR Strings[210]\n#define key_srsume                     CUR Strings[211]\n#define key_ssave                      CUR Strings[212]\n#define key_ssuspend                   CUR Strings[213]\n#define key_sundo                      CUR Strings[214]\n#define req_for_input                  CUR Strings[215]\n#define key_f11                        CUR Strings[216]\n#define key_f12                        CUR Strings[217]\n#define key_f13                        CUR Strings[218]\n#define key_f14                        CUR Strings[219]\n#define key_f15                        CUR Strings[220]\n#define key_f16                        CUR Strings[221]\n#define key_f17                        CUR Strings[222]\n#define key_f18                        CUR Strings[223]\n#define key_f19                        CUR Strings[224]\n#define key_f20                        CUR Strings[225]\n#define key_f21                        CUR Strings[226]\n#define key_f22                        CUR Strings[227]\n#define key_f23                        CUR Strings[228]\n#define key_f24                        CUR Strings[229]\n#define key_f25                        CUR Strings[230]\n#define key_f26                        CUR Strings[231]\n#define key_f27                        CUR Strings[232]\n#define key_f28                        CUR Strings[233]\n#define key_f29                        CUR Strings[234]\n#define key_f30                        CUR Strings[235]\n#define key_f31                        CUR Strings[236]\n#define key_f32                        CUR Strings[237]\n#define key_f33                        CUR Strings[238]\n#define key_f34                        CUR Strings[239]\n#define key_f35                        CUR Strings[240]\n#define key_f36                        CUR Strings[241]\n#define key_f37                        CUR Strings[242]\n#define key_f38                        CUR Strings[243]\n#define key_f39                        CUR Strings[244]\n#define key_f40                        CUR Strings[245]\n#define key_f41                        CUR Strings[246]\n#define key_f42                        CUR Strings[247]\n#define key_f43                        CUR Strings[248]\n#define key_f44                        CUR Strings[249]\n#define key_f45                        CUR Strings[250]\n#define key_f46                        CUR Strings[251]\n#define key_f47                        CUR Strings[252]\n#define key_f48                        CUR Strings[253]\n#define key_f49                        CUR Strings[254]\n#define key_f50                        CUR Strings[255]\n#define key_f51                        CUR Strings[256]\n#define key_f52                        CUR Strings[257]\n#define key_f53                        CUR Strings[258]\n#define key_f54                        CUR Strings[259]\n#define key_f55                        CUR Strings[260]\n#define key_f56                        CUR Strings[261]\n#define key_f57                        CUR Strings[262]\n#define key_f58                        CUR Strings[263]\n#define key_f59                        CUR Strings[264]\n#define key_f60                        CUR Strings[265]\n#define key_f61                        CUR Strings[266]\n#define key_f62                        CUR Strings[267]\n#define key_f63                        CUR Strings[268]\n#define clr_bol                        CUR Strings[269]\n#define clear_margins                  CUR Strings[270]\n#define set_left_margin                CUR Strings[271]\n#define set_right_margin               CUR Strings[272]\n#define label_format                   CUR Strings[273]\n#define set_clock                      CUR Strings[274]\n#define display_clock                  CUR Strings[275]\n#define remove_clock                   CUR Strings[276]\n#define create_window                  CUR Strings[277]\n#define goto_window                    CUR Strings[278]\n#define hangup                         CUR Strings[279]\n#define dial_phone                     CUR Strings[280]\n#define quick_dial                     CUR Strings[281]\n#define tone                           CUR Strings[282]\n#define pulse                          CUR Strings[283]\n#define flash_hook                     CUR Strings[284]\n#define fixed_pause                    CUR Strings[285]\n#define wait_tone                      CUR Strings[286]\n#define user0                          CUR Strings[287]\n#define user1                          CUR Strings[288]\n#define user2                          CUR Strings[289]\n#define user3                          CUR Strings[290]\n#define user4                          CUR Strings[291]\n#define user5                          CUR Strings[292]\n#define user6                          CUR Strings[293]\n#define user7                          CUR Strings[294]\n#define user8                          CUR Strings[295]\n#define user9                          CUR Strings[296]\n#define orig_pair                      CUR Strings[297]\n#define orig_colors                    CUR Strings[298]\n#define initialize_color               CUR Strings[299]\n#define initialize_pair                CUR Strings[300]\n#define set_color_pair                 CUR Strings[301]\n#define set_foreground                 CUR Strings[302]\n#define set_background                 CUR Strings[303]\n#define change_char_pitch              CUR Strings[304]\n#define change_line_pitch              CUR Strings[305]\n#define change_res_horz                CUR Strings[306]\n#define change_res_vert                CUR Strings[307]\n#define define_char                    CUR Strings[308]\n#define enter_doublewide_mode          CUR Strings[309]\n#define enter_draft_quality            CUR Strings[310]\n#define enter_italics_mode             CUR Strings[311]\n#define enter_leftward_mode            CUR Strings[312]\n#define enter_micro_mode               CUR Strings[313]\n#define enter_near_letter_quality      CUR Strings[314]\n#define enter_normal_quality           CUR Strings[315]\n#define enter_shadow_mode              CUR Strings[316]\n#define enter_subscript_mode           CUR Strings[317]\n#define enter_superscript_mode         CUR Strings[318]\n#define enter_upward_mode              CUR Strings[319]\n#define exit_doublewide_mode           CUR Strings[320]\n#define exit_italics_mode              CUR Strings[321]\n#define exit_leftward_mode             CUR Strings[322]\n#define exit_micro_mode                CUR Strings[323]\n#define exit_shadow_mode               CUR Strings[324]\n#define exit_subscript_mode            CUR Strings[325]\n#define exit_superscript_mode          CUR Strings[326]\n#define exit_upward_mode               CUR Strings[327]\n#define micro_column_address           CUR Strings[328]\n#define micro_down                     CUR Strings[329]\n#define micro_left                     CUR Strings[330]\n#define micro_right                    CUR Strings[331]\n#define micro_row_address              CUR Strings[332]\n#define micro_up                       CUR Strings[333]\n#define order_of_pins                  CUR Strings[334]\n#define parm_down_micro                CUR Strings[335]\n#define parm_left_micro                CUR Strings[336]\n#define parm_right_micro               CUR Strings[337]\n#define parm_up_micro                  CUR Strings[338]\n#define select_char_set                CUR Strings[339]\n#define set_bottom_margin              CUR Strings[340]\n#define set_bottom_margin_parm         CUR Strings[341]\n#define set_left_margin_parm           CUR Strings[342]\n#define set_right_margin_parm          CUR Strings[343]\n#define set_top_margin                 CUR Strings[344]\n#define set_top_margin_parm            CUR Strings[345]\n#define start_bit_image                CUR Strings[346]\n#define start_char_set_def             CUR Strings[347]\n#define stop_bit_image                 CUR Strings[348]\n#define stop_char_set_def              CUR Strings[349]\n#define subscript_characters           CUR Strings[350]\n#define superscript_characters         CUR Strings[351]\n#define these_cause_cr                 CUR Strings[352]\n#define zero_motion                    CUR Strings[353]\n#define char_set_names                 CUR Strings[354]\n#define key_mouse                      CUR Strings[355]\n#define mouse_info                     CUR Strings[356]\n#define req_mouse_pos                  CUR Strings[357]\n#define get_mouse                      CUR Strings[358]\n#define set_a_foreground               CUR Strings[359]\n#define set_a_background               CUR Strings[360]\n#define pkey_plab                      CUR Strings[361]\n#define device_type                    CUR Strings[362]\n#define code_set_init                  CUR Strings[363]\n#define set0_des_seq                   CUR Strings[364]\n#define set1_des_seq                   CUR Strings[365]\n#define set2_des_seq                   CUR Strings[366]\n#define set3_des_seq                   CUR Strings[367]\n#define set_lr_margin                  CUR Strings[368]\n#define set_tb_margin                  CUR Strings[369]\n#define bit_image_repeat               CUR Strings[370]\n#define bit_image_newline              CUR Strings[371]\n#define bit_image_carriage_return      CUR Strings[372]\n#define color_names                    CUR Strings[373]\n#define define_bit_image_region        CUR Strings[374]\n#define end_bit_image_region           CUR Strings[375]\n#define set_color_band                 CUR Strings[376]\n#define set_page_length                CUR Strings[377]\n#define display_pc_char                CUR Strings[378]\n#define enter_pc_charset_mode          CUR Strings[379]\n#define exit_pc_charset_mode           CUR Strings[380]\n#define enter_scancode_mode            CUR Strings[381]\n#define exit_scancode_mode             CUR Strings[382]\n#define pc_term_options                CUR Strings[383]\n#define scancode_escape                CUR Strings[384]\n#define alt_scancode_esc               CUR Strings[385]\n#define enter_horizontal_hl_mode       CUR Strings[386]\n#define enter_left_hl_mode             CUR Strings[387]\n#define enter_low_hl_mode              CUR Strings[388]\n#define enter_right_hl_mode            CUR Strings[389]\n#define enter_top_hl_mode              CUR Strings[390]\n#define enter_vertical_hl_mode         CUR Strings[391]\n#define set_a_attributes               CUR Strings[392]\n#define set_pglen_inch                 CUR Strings[393]\n\n#define BOOLWRITE 37\n#define NUMWRITE  33\n#define STRWRITE  394\n\n/* older synonyms for some capabilities */\n#define beehive_glitch\tno_esc_ctlc\n#define teleray_glitch\tdest_tabs_magic_smso\n#define micro_char_size micro_col_size\n\n#ifdef __INTERNAL_CAPS_VISIBLE\n#define termcap_init2                  CUR Strings[394]\n#define termcap_reset                  CUR Strings[395]\n#define magic_cookie_glitch_ul         CUR Numbers[33]\n#define backspaces_with_bs             CUR Booleans[37]\n#define crt_no_scrolling               CUR Booleans[38]\n#define no_correctly_working_cr        CUR Booleans[39]\n#define carriage_return_delay          CUR Numbers[34]\n#define new_line_delay                 CUR Numbers[35]\n#define linefeed_if_not_lf             CUR Strings[396]\n#define backspace_if_not_bs            CUR Strings[397]\n#define gnu_has_meta_key               CUR Booleans[40]\n#define linefeed_is_newline            CUR Booleans[41]\n#define backspace_delay                CUR Numbers[36]\n#define horizontal_tab_delay           CUR Numbers[37]\n#define number_of_function_keys        CUR Numbers[38]\n#define other_non_function_keys        CUR Strings[398]\n#define arrow_key_map                  CUR Strings[399]\n#define has_hardware_tabs              CUR Booleans[42]\n#define return_does_clr_eol            CUR Booleans[43]\n#define acs_ulcorner                   CUR Strings[400]\n#define acs_llcorner                   CUR Strings[401]\n#define acs_urcorner                   CUR Strings[402]\n#define acs_lrcorner                   CUR Strings[403]\n#define acs_ltee                       CUR Strings[404]\n#define acs_rtee                       CUR Strings[405]\n#define acs_btee                       CUR Strings[406]\n#define acs_ttee                       CUR Strings[407]\n#define acs_hline                      CUR Strings[408]\n#define acs_vline                      CUR Strings[409]\n#define acs_plus                       CUR Strings[410]\n#define memory_lock                    CUR Strings[411]\n#define memory_unlock                  CUR Strings[412]\n#define box_chars_1                    CUR Strings[413]\n#endif /* __INTERNAL_CAPS_VISIBLE */\n\n\n/*\n * Predefined terminfo array sizes\n */\n#define BOOLCOUNT 44\n#define NUMCOUNT  39\n#define STRCOUNT  414\n\n/* used by code for comparing entries */\n#define acs_chars_index\t 146\n\ntypedef struct termtype {\t/* in-core form of terminfo data */\n    char  *term_names;\t\t/* str_table offset of term names */\n    char  *str_table;\t\t/* pointer to string table */\n    NCURSES_SBOOL  *Booleans;\t/* array of boolean values */\n    short *Numbers;\t\t/* array of integer values */\n    char  **Strings;\t\t/* array of string offsets */\n\n#if NCURSES_XNAMES\n    char  *ext_str_table;\t/* pointer to extended string table */\n    char  **ext_Names;\t\t/* corresponding names */\n\n    unsigned short num_Booleans;/* count total Booleans */\n    unsigned short num_Numbers;\t/* count total Numbers */\n    unsigned short num_Strings;\t/* count total Strings */\n\n    unsigned short ext_Booleans;/* count extensions to Booleans */\n    unsigned short ext_Numbers;\t/* count extensions to Numbers */\n    unsigned short ext_Strings;\t/* count extensions to Strings */\n#endif /* NCURSES_XNAMES */\n\n} TERMTYPE;\n\ntypedef struct term {\t\t/* describe an actual terminal */\n    TERMTYPE\ttype;\t\t/* terminal type description */\n    short\tFiledes;\t/* file description being written to */\n    TTY\t\tOttyb,\t\t/* original state of the terminal */\n\t\tNttyb;\t\t/* current state of the terminal */\n    int\t\t_baudrate;\t/* used to compute padding */\n    char *      _termname;      /* used for termname() */\n} TERMINAL;\n\n#if 0 || 0\nNCURSES_WRAPPED_VAR(TERMINAL *, cur_term);\nNCURSES_WRAPPED_VAR(NCURSES_CONST char * const *, boolnames);\nNCURSES_WRAPPED_VAR(NCURSES_CONST char * const *, boolcodes);\nNCURSES_WRAPPED_VAR(NCURSES_CONST char * const *, boolfnames);\nNCURSES_WRAPPED_VAR(NCURSES_CONST char * const *, numnames);\nNCURSES_WRAPPED_VAR(NCURSES_CONST char * const *, numcodes);\nNCURSES_WRAPPED_VAR(NCURSES_CONST char * const *, numfnames);\nNCURSES_WRAPPED_VAR(NCURSES_CONST char * const *, strnames);\nNCURSES_WRAPPED_VAR(NCURSES_CONST char * const *, strcodes);\nNCURSES_WRAPPED_VAR(NCURSES_CONST char * const *, strfnames);\n\n#define cur_term   NCURSES_PUBLIC_VAR(cur_term())\n#define boolnames  NCURSES_PUBLIC_VAR(boolnames())\n#define boolcodes  NCURSES_PUBLIC_VAR(boolcodes())\n#define boolfnames NCURSES_PUBLIC_VAR(boolfnames())\n#define numnames   NCURSES_PUBLIC_VAR(numnames())\n#define numcodes   NCURSES_PUBLIC_VAR(numcodes())\n#define numfnames  NCURSES_PUBLIC_VAR(numfnames())\n#define strnames   NCURSES_PUBLIC_VAR(strnames())\n#define strcodes   NCURSES_PUBLIC_VAR(strcodes())\n#define strfnames  NCURSES_PUBLIC_VAR(strfnames())\n\n#else\n\nextern NCURSES_EXPORT_VAR(TERMINAL *) cur_term;\n\nextern NCURSES_EXPORT_VAR(NCURSES_CONST char * const ) boolnames[];\nextern NCURSES_EXPORT_VAR(NCURSES_CONST char * const ) boolcodes[];\nextern NCURSES_EXPORT_VAR(NCURSES_CONST char * const ) boolfnames[];\nextern NCURSES_EXPORT_VAR(NCURSES_CONST char * const ) numnames[];\nextern NCURSES_EXPORT_VAR(NCURSES_CONST char * const ) numcodes[];\nextern NCURSES_EXPORT_VAR(NCURSES_CONST char * const ) numfnames[];\nextern NCURSES_EXPORT_VAR(NCURSES_CONST char * const ) strnames[];\nextern NCURSES_EXPORT_VAR(NCURSES_CONST char * const ) strcodes[];\nextern NCURSES_EXPORT_VAR(NCURSES_CONST char * const ) strfnames[];\n\n#endif\n\n/* internals */\nextern NCURSES_EXPORT(int) _nc_set_tty_mode (TTY *buf);\nextern NCURSES_EXPORT(int) _nc_get_tty_mode (TTY *buf);\nextern NCURSES_EXPORT(int) _nc_read_entry (const char * const, char * const, TERMTYPE *const);\nextern NCURSES_EXPORT(int) _nc_read_file_entry (const char *const, TERMTYPE *);\nextern NCURSES_EXPORT(int) _nc_read_termtype (TERMTYPE *, char *, int);\nextern NCURSES_EXPORT(char *) _nc_first_name (const char *const);\nextern NCURSES_EXPORT(int) _nc_name_match (const char *const, const char *const, const char *const);\nextern NCURSES_EXPORT(const TERMTYPE *) _nc_fallback (const char *);\n\n/* entry points */\nextern NCURSES_EXPORT(TERMINAL *) set_curterm (TERMINAL *);\nextern NCURSES_EXPORT(int) del_curterm (TERMINAL *);\n\n/* miscellaneous entry points */\nextern NCURSES_EXPORT(int) restartterm (NCURSES_CONST char *, int, int *);\nextern NCURSES_EXPORT(int) setupterm (NCURSES_CONST char *,int,int *);\n\n/* terminfo entry points, also declared in curses.h */\n#if !defined(__NCURSES_H)\nextern NCURSES_EXPORT(char *) tigetstr (NCURSES_CONST char *);\nextern NCURSES_EXPORT_VAR(char) ttytype[];\nextern NCURSES_EXPORT(int) putp (const char *);\nextern NCURSES_EXPORT(int) tigetflag (NCURSES_CONST char *);\nextern NCURSES_EXPORT(int) tigetnum (NCURSES_CONST char *);\n\n#if 1 /* NCURSES_TPARM_VARARGS */\nextern NCURSES_EXPORT(char *) tparm (NCURSES_CONST char *, ...);\t/* special */\n#else\nextern NCURSES_EXPORT(char *) tparm (NCURSES_CONST char *, long,long,long,long,long,long,long,long,long);\t/* special */\nextern NCURSES_EXPORT(char *) tparm_varargs (NCURSES_CONST char *, ...);\t/* special */\n#endif\n\n#endif /* __NCURSES_H */\n\n/* termcap database emulation (XPG4 uses const only for 2nd param of tgetent) */\n#if !defined(NCURSES_TERMCAP_H_incl)\nextern NCURSES_EXPORT(char *) tgetstr (NCURSES_CONST char *, char **);\nextern NCURSES_EXPORT(char *) tgoto (const char *, int, int);\nextern NCURSES_EXPORT(int) tgetent (char *, const char *);\nextern NCURSES_EXPORT(int) tgetflag (NCURSES_CONST char *);\nextern NCURSES_EXPORT(int) tgetnum (NCURSES_CONST char *);\nextern NCURSES_EXPORT(int) tputs (const char *, int, int (*)(int));\n#endif /* NCURSES_TERMCAP_H_incl */\n\n#ifdef __cplusplus\n}\n#endif\n\n#endif /* NCURSES_TERM_H_incl */\n"
  },
  {
    "path": "freebsd-headers/termcap.h",
    "content": "/****************************************************************************\n * Copyright (c) 1998,2000 Free Software Foundation, Inc.                   *\n *                                                                          *\n * Permission is hereby granted, free of charge, to any person obtaining a  *\n * copy of this software and associated documentation files (the            *\n * \"Software\"), to deal in the Software without restriction, including      *\n * without limitation the rights to use, copy, modify, merge, publish,      *\n * distribute, distribute with modifications, sublicense, and/or sell       *\n * copies of the Software, and to permit persons to whom the Software is    *\n * furnished to do so, subject to the following conditions:                 *\n *                                                                          *\n * The above copyright notice and this permission notice shall be included  *\n * in all copies or substantial portions of the Software.                   *\n *                                                                          *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS  *\n * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF               *\n * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.   *\n * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,   *\n * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR    *\n * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR    *\n * THE USE OR OTHER DEALINGS IN THE SOFTWARE.                               *\n *                                                                          *\n * Except as contained in this notice, the name(s) of the above copyright   *\n * holders shall not be used in advertising or otherwise to promote the     *\n * sale, use or other dealings in this Software without prior written       *\n * authorization.                                                           *\n ****************************************************************************/\n\n/****************************************************************************\n *  Author: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995               *\n *     and: Eric S. Raymond <esr@snark.thyrsus.com>                         *\n ****************************************************************************/\n\n/* $Id: termcap.h.in,v 1.16 2001/03/24 21:53:27 tom Exp $ */\n\n#ifndef NCURSES_TERMCAP_H_incl\n#define NCURSES_TERMCAP_H_incl\t1\n\n#undef  NCURSES_VERSION\n#define NCURSES_VERSION \"5.7\"\n\n#include <ncurses_dll.h>\n\n#ifdef __cplusplus\nextern \"C\"\n{\n#endif /* __cplusplus */\n\n#include <sys/types.h>\n\n#undef  NCURSES_CONST \n#define NCURSES_CONST const \n\n#undef  NCURSES_OSPEED \n#define NCURSES_OSPEED short \n\nextern NCURSES_EXPORT_VAR(char) PC;\nextern NCURSES_EXPORT_VAR(char *) UP;\nextern NCURSES_EXPORT_VAR(char *) BC;\nextern NCURSES_EXPORT_VAR(NCURSES_OSPEED) ospeed; \n\n#if !defined(NCURSES_TERM_H_incl)\nextern NCURSES_EXPORT(char *) tgetstr (NCURSES_CONST char *, char **);\nextern NCURSES_EXPORT(char *) tgoto (const char *, int, int);\nextern NCURSES_EXPORT(int) tgetent (char *, const char *);\nextern NCURSES_EXPORT(int) tgetflag (NCURSES_CONST char *);\nextern NCURSES_EXPORT(int) tgetnum (NCURSES_CONST char *);\nextern NCURSES_EXPORT(int) tputs (const char *, int, int (*)(int));\n#endif\n\n#ifdef __cplusplus\n}\n#endif\n\n#endif /* NCURSES_TERMCAP_H_incl */\n"
  },
  {
    "path": "freebsd-headers/termios.h",
    "content": "/*-\n * Copyright (c) 1988, 1989, 1993, 1994\n *\tThe Regents of the University of California.  All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t@(#)termios.h\t8.3 (Berkeley) 3/28/94\n * $FreeBSD: release/9.0.0/include/termios.h 214680 2010-11-02 17:00:56Z ed $\n */\n\n#ifndef _TERMIOS_H_\n#define\t_TERMIOS_H_\n\n#include <sys/cdefs.h>\n#include <sys/_termios.h>\n#include <sys/_types.h>\n\n#ifndef _PID_T_DECLARED\ntypedef\t__pid_t\t\tpid_t;\n#define\t_PID_T_DECLARED\n#endif\n\n#ifndef _POSIX_SOURCE\n#define\tOXTABS\t\tTAB3\n#define\tMDMBUF\t\tCCAR_OFLOW\n#endif \n\n#ifndef _POSIX_SOURCE\n#define\tCCEQ(val, c)\t((c) == (val) && (val) != _POSIX_VDISABLE)\n#endif\n\n/*\n * Commands passed to tcsetattr() for setting the termios structure.\n */\n#define\tTCSANOW\t\t0\t\t/* make change immediate */\n#define\tTCSADRAIN\t1\t\t/* drain output, then change */\n#define\tTCSAFLUSH\t2\t\t/* drain output, flush input */\n#ifndef _POSIX_SOURCE\n#define\tTCSASOFT\t0x10\t\t/* flag - don't alter h.w. state */\n#endif\n\n#define\tTCIFLUSH\t1\n#define\tTCOFLUSH\t2\n#define\tTCIOFLUSH\t3\n#define\tTCOOFF\t\t1\n#define\tTCOON\t\t2\n#define\tTCIOFF\t\t3\n#define\tTCION\t\t4\n\n__BEGIN_DECLS\nspeed_t\tcfgetispeed(const struct termios *);\nspeed_t\tcfgetospeed(const struct termios *);\nint\tcfsetispeed(struct termios *, speed_t);\nint\tcfsetospeed(struct termios *, speed_t);\nint\ttcgetattr(int, struct termios *);\nint\ttcsetattr(int, int, const struct termios *);\nint\ttcdrain(int);\nint\ttcflow(int, int);\nint\ttcflush(int, int);\nint\ttcsendbreak(int, int);\n\n#if __POSIX_VISIBLE >= 200112 || __BSD_VISIBLE\npid_t\ttcgetsid(int);\n#endif\n#if __BSD_VISIBLE\nint\ttcsetsid(int, pid_t);\n\nvoid\tcfmakeraw(struct termios *);\nvoid\tcfmakesane(struct termios *);\nint\tcfsetspeed(struct termios *, speed_t);\n#endif\n__END_DECLS\n\n#endif /* !_TERMIOS_H_ */\n\n#ifndef _POSIX_SOURCE\n#include <sys/ttycom.h>\n#include <sys/ttydefaults.h>\n#endif\n"
  },
  {
    "path": "freebsd-headers/tgmath.h",
    "content": "/*-\n * Copyright (c) 2004 Stefan Farfeleder.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/include/tgmath.h 166432 2007-02-02 18:30:23Z schweikh $\n */\n\n#ifndef _TGMATH_H_\n#define\t_TGMATH_H_\n\n#include <complex.h>\n#include <math.h>\n\n/*\n * This implementation of <tgmath.h> requires two implementation-dependent\n * macros to be defined:\n * __tg_impl_simple(x, y, z, fn, fnf, fnl, ...)\n *\tInvokes fnl() if the corresponding real type of x, y or z is long\n *\tdouble, fn() if it is double or any has an integer type, and fnf()\n *\totherwise.\n * __tg_impl_full(x, y, z, fn, fnf, fnl, cfn, cfnf, cfnl, ...)\n *\tInvokes [c]fnl() if the corresponding real type of x, y or z is long\n *\tdouble, [c]fn() if it is double or any has an integer type, and\n *\t[c]fnf() otherwise.  The function with the 'c' prefix is called if\n *\tany of x, y or z is a complex number.\n * Both macros call the chosen function with all additional arguments passed\n * to them, as given by __VA_ARGS__.\n *\n * Note that these macros cannot be implemented with C's ?: operator,\n * because the return type of the whole expression would incorrectly be long\n * double complex regardless of the argument types.\n */\n\n#if __GNUC_PREREQ__(3, 1)\n#define\t__tg_type(e, t)\t__builtin_types_compatible_p(__typeof__(e), t)\n#define\t__tg_type3(e1, e2, e3, t)\t\t\t\t\t\\\n\t(__tg_type(e1, t) || __tg_type(e2, t) || __tg_type(e3, t))\n#define\t__tg_type_corr(e1, e2, e3, t)\t\t\t\t\t\\\n\t(__tg_type3(e1, e2, e3, t) || __tg_type3(e1, e2, e3, t _Complex))\n#define\t__tg_integer(e1, e2, e3)\t\t\t\t\t\\\n\t(((__typeof__(e1))1.5 == 1) || ((__typeof__(e2))1.5 == 1) ||\t\\\n\t    ((__typeof__(e3))1.5 == 1))\n#define\t__tg_is_complex(e1, e2, e3)\t\t\t\t\t\\\n\t(__tg_type3(e1, e2, e3, float _Complex) ||\t\t\t\\\n\t    __tg_type3(e1, e2, e3, double _Complex) ||\t\t\t\\\n\t    __tg_type3(e1, e2, e3, long double _Complex) ||\t\t\\\n\t    __tg_type3(e1, e2, e3, __typeof__(_Complex_I)))\n\n#define\t__tg_impl_simple(x, y, z, fn, fnf, fnl, ...)\t\t\t\\\n\t__builtin_choose_expr(__tg_type_corr(x, y, z, long double),\t\\\n\t    fnl(__VA_ARGS__), __builtin_choose_expr(\t\t\t\\\n\t\t__tg_type_corr(x, y, z, double) || __tg_integer(x, y, z),\\\n\t\tfn(__VA_ARGS__), fnf(__VA_ARGS__)))\n\n#define\t__tg_impl_full(x, y, z, fn, fnf, fnl, cfn, cfnf, cfnl, ...)\t\\\n\t__builtin_choose_expr(__tg_is_complex(x, y, z),\t\t\t\\\n\t    __tg_impl_simple(x, y, z, cfn, cfnf, cfnl, __VA_ARGS__),\t\\\n\t    __tg_impl_simple(x, y, z, fn, fnf, fnl, __VA_ARGS__))\n\n#else\t/* __GNUC__ */\n#error \"<tgmath.h> not implemented for this compiler\"\n#endif\t/* !__GNUC__ */\n\n/* Macros to save lots of repetition below */\n#define\t__tg_simple(x, fn)\t\t\t\t\t\t\\\n\t__tg_impl_simple(x, x, x, fn, fn##f, fn##l, x)\n#define\t__tg_simple2(x, y, fn)\t\t\t\t\t\t\\\n\t__tg_impl_simple(x, x, y, fn, fn##f, fn##l, x, y)\n#define\t__tg_simplev(x, fn, ...)\t\t\t\t\t\\\n\t__tg_impl_simple(x, x, x, fn, fn##f, fn##l, __VA_ARGS__)\n#define\t__tg_full(x, fn)\t\t\t\t\t\t\\\n\t__tg_impl_full(x, x, x, fn, fn##f, fn##l, c##fn, c##fn##f, c##fn##l, x)\n\n/* 7.22#4 -- These macros expand to real or complex functions, depending on\n * the type of their arguments. */\n#define\tacos(x)\t\t__tg_full(x, acos)\n#define\tasin(x)\t\t__tg_full(x, asin)\n#define\tatan(x)\t\t__tg_full(x, atan)\n#define\tacosh(x)\t__tg_full(x, acosh)\n#define\tasinh(x)\t__tg_full(x, asinh)\n#define\tatanh(x)\t__tg_full(x, atanh)\n#define\tcos(x)\t\t__tg_full(x, cos)\n#define\tsin(x)\t\t__tg_full(x, sin)\n#define\ttan(x)\t\t__tg_full(x, tan)\n#define\tcosh(x)\t\t__tg_full(x, cosh)\n#define\tsinh(x)\t\t__tg_full(x, sinh)\n#define\ttanh(x)\t\t__tg_full(x, tanh)\n#define\texp(x)\t\t__tg_full(x, exp)\n#define\tlog(x)\t\t__tg_full(x, log)\n#define\tpow(x, y)\t__tg_impl_full(x, x, y, pow, powf, powl,\t\\\n\t\t\t    cpow, cpowf, cpowl, x, y)\n#define\tsqrt(x)\t\t__tg_full(x, sqrt)\n\n/* \"The corresponding type-generic macro for fabs and cabs is fabs.\" */\n#define\tfabs(x)\t\t__tg_impl_full(x, x, x, fabs, fabsf, fabsl,\t\\\n    \t\t\t    cabs, cabsf, cabsl, x)\n\n/* 7.22#5 -- These macros are only defined for arguments with real type. */\n#define\tatan2(x, y)\t__tg_simple2(x, y, atan2)\n#define\tcbrt(x)\t\t__tg_simple(x, cbrt)\n#define\tceil(x)\t\t__tg_simple(x, ceil)\n#define\tcopysign(x, y)\t__tg_simple2(x, y, copysign)\n#define\terf(x)\t\t__tg_simple(x, erf)\n#define\terfc(x)\t\t__tg_simple(x, erfc)\n#define\texp2(x)\t\t__tg_simple(x, exp2)\n#define\texpm1(x)\t__tg_simple(x, expm1)\n#define\tfdim(x, y)\t__tg_simple2(x, y, fdim)\n#define\tfloor(x)\t__tg_simple(x, floor)\n#define\tfma(x, y, z)\t__tg_impl_simple(x, y, z, fma, fmaf, fmal, x, y, z)\n#define\tfmax(x, y)\t__tg_simple2(x, y, fmax)\n#define\tfmin(x, y)\t__tg_simple2(x, y, fmin)\n#define\tfmod(x, y)\t__tg_simple2(x, y, fmod)\n#define\tfrexp(x, y)\t__tg_simplev(x, frexp, x, y)\n#define\thypot(x, y)\t__tg_simple2(x, y, hypot)\n#define\tilogb(x)\t__tg_simple(x, ilogb)\n#define\tldexp(x, y)\t__tg_simplev(x, ldexp, x, y)\n#define\tlgamma(x)\t__tg_simple(x, lgamma)\n#define\tllrint(x)\t__tg_simple(x, llrint)\n#define\tllround(x)\t__tg_simple(x, llround)\n#define\tlog10(x)\t__tg_simple(x, log10)\n#define\tlog1p(x)\t__tg_simple(x, log1p)\n#define\tlog2(x)\t\t__tg_simple(x, log2)\n#define\tlogb(x)\t\t__tg_simple(x, logb)\n#define\tlrint(x)\t__tg_simple(x, lrint)\n#define\tlround(x)\t__tg_simple(x, lround)\n#define\tnearbyint(x)\t__tg_simple(x, nearbyint)\n#define\tnextafter(x, y)\t__tg_simple2(x, y, nextafter)\n#define\tnexttoward(x, y) __tg_simplev(x, nexttoward, x, y)\n#define\tremainder(x, y)\t__tg_simple2(x, y, remainder)\n#define\tremquo(x, y, z)\t__tg_impl_simple(x, x, y, remquo, remquof,\t\\\n\t\t\t    remquol, x, y, z)\n#define\trint(x)\t\t__tg_simple(x, rint)\n#define\tround(x)\t__tg_simple(x, round)\n#define\tscalbn(x, y)\t__tg_simplev(x, scalbn, x, y)\n#define\tscalbln(x, y)\t__tg_simplev(x, scalbln, x, y)\n#define\ttgamma(x)\t__tg_simple(x, tgamma)\n#define\ttrunc(x)\t__tg_simple(x, trunc)\n\n/* 7.22#6 -- These macros always expand to complex functions. */\n#define\tcarg(x)\t\t__tg_simple(x, carg)\n#define\tcimag(x)\t__tg_simple(x, cimag)\n#define\tconj(x)\t\t__tg_simple(x, conj)\n#define\tcproj(x)\t__tg_simple(x, cproj)\n#define\tcreal(x)\t__tg_simple(x, creal)\n\n#endif /* !_TGMATH_H_ */\n"
  },
  {
    "path": "freebsd-headers/thread_db.h",
    "content": "/*\n * Copyright (c) 2004 David Xu <davidxu@freebsd.org>\n * Copyright (c) 2004 Marcel Moolenaar\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n *\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR\n * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES\n * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,\n * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF\n * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/lib/libthread_db/thread_db.h 209689 2010-07-04 12:08:04Z kib $\n */\n\n#ifndef _THREAD_DB_H_\n#define\t_THREAD_DB_H_\n\n#include <sys/procfs.h>\n#include <pthread.h>\n\ntypedef enum {\n\tTD_ERR = -1,\t\t/* Unspecified error. */\n\tTD_OK = 0,\t\t/* No error. */\n\tTD_BADKEY,\n\tTD_BADPH,\n\tTD_BADSH,\n\tTD_BADTA,\n\tTD_BADTH,\n\tTD_DBERR,\n\tTD_MALLOC,\n\tTD_NOAPLIC,\n\tTD_NOCAPAB,\n\tTD_NOEVENT,\n\tTD_NOFPREGS,\n\tTD_NOLIBTHREAD,\n\tTD_NOLWP,\n\tTD_NOMSG,\n\tTD_NOSV,\n\tTD_NOTHR,\n\tTD_NOTSD,\n\tTD_NOXREGS,\n\tTD_PARTIALREG\n} td_err_e;\n\nstruct ps_prochandle;\ntypedef struct td_thragent td_thragent_t;\ntypedef long thread_t;\t\t\t/* Must be an integral type. */\n\ntypedef struct {\n\tconst td_thragent_t *th_ta;\n\tpsaddr_t\tth_thread;\n\tthread_t\tth_tid;\n} td_thrhandle_t;\t\t\t/* Used non-opaguely. */\n\n/*\n * Events.\n */\n\ntypedef enum {\n\tTD_EVENT_NONE = 0,\n\tTD_CATCHSIG =\t0x0001,\n\tTD_CONCURRENCY=\t0x0002,\n\tTD_CREATE =\t0x0004,\n\tTD_DEATH =\t0x0008,\n\tTD_IDLE =\t0x0010,\n\tTD_LOCK_TRY =\t0x0020,\n\tTD_PREEMPT =\t0x0040,\n\tTD_PRI_INHERIT=\t0x0080,\n\tTD_READY =\t0x0100,\n\tTD_REAP =\t0x0200,\n\tTD_SLEEP =\t0x0400,\n\tTD_SWITCHFROM =\t0x0800,\n\tTD_SWITCHTO =\t0x1000,\n\tTD_TIMEOUT =\t0x2000,\n\tTD_ALL_EVENTS = ~0\n} td_thr_events_e;\n\n/* Compatibility with Linux. */\n#define\ttd_event_e\ttd_thr_events_e\n\ntypedef struct {\n\ttd_thr_events_e\tevent;\n\tpsaddr_t\tth_p;\n\tuintptr_t\tdata;\n} td_event_msg_t;\n\ntypedef unsigned int td_thr_events_t;\n\ntypedef enum {\n\tNOTIFY_BPT,\t\t/* User inserted breakpoint. */\n\tNOTIFY_AUTOBPT,\t\t/* Automatic breakpoint. */\n\tNOTIFY_SYSCALL\t\t/* Invocation of system call. */\n} td_notify_e;\n\ntypedef struct {\n\ttd_notify_e\ttype;\n\tunion {\n\t\tpsaddr_t bptaddr;\n\t\tint syscallno;\n\t} u;\n} td_notify_t;\n\nstatic __inline void\ntd_event_addset(td_thr_events_t *es, td_thr_events_e e)\n{\n\t*es |= e;\n}\n\nstatic __inline void\ntd_event_delset(td_thr_events_t *es, td_thr_events_e e)\n{\n\t*es &= ~e;\n}\n\nstatic __inline void\ntd_event_emptyset(td_thr_events_t *es)\n{\n\t*es = TD_EVENT_NONE;\n}\n\nstatic __inline void\ntd_event_fillset(td_thr_events_t *es)\n{\n\t*es = TD_ALL_EVENTS;\n}\n\nstatic __inline int\ntd_eventisempty(td_thr_events_t *es)\n{\n\treturn ((*es == TD_EVENT_NONE) ? 1 : 0);\n}\n\nstatic __inline int\ntd_eventismember(td_thr_events_t *es, td_thr_events_e e)\n{\n\treturn ((*es & e) ? 1 : 0);\n}\n\n/*\n * Thread info.\n */\n\ntypedef enum {\n\tTD_THR_UNKNOWN = -1,\n\tTD_THR_ANY_STATE = 0,\n\tTD_THR_ACTIVE,\n\tTD_THR_RUN,\n\tTD_THR_SLEEP,\n\tTD_THR_STOPPED,\n\tTD_THR_STOPPED_ASLEEP,\n\tTD_THR_ZOMBIE\n} td_thr_state_e;\n\ntypedef enum\n{\n\tTD_THR_SYSTEM = 1,\n\tTD_THR_USER\n} td_thr_type_e;\n\ntypedef pthread_key_t thread_key_t;\n\ntypedef struct {\n\tconst td_thragent_t *ti_ta_p;\n\tthread_t\tti_tid;\n\tpsaddr_t\tti_thread;\n\ttd_thr_state_e\tti_state;\n\ttd_thr_type_e\tti_type;\n\ttd_thr_events_t\tti_events;\n\tint\t\tti_pri;\n\tlwpid_t\t\tti_lid;\n\tchar\t\tti_db_suspended;\n\tchar\t\tti_traceme;\n\tsigset_t\tti_sigmask;\n\tsigset_t\tti_pending;\n\tpsaddr_t\tti_tls;\n\tpsaddr_t\tti_startfunc;\n\tpsaddr_t\tti_stkbase;\n\tsize_t\t\tti_stksize;\n\tsiginfo_t\tti_siginfo;\n} td_thrinfo_t;\n\n/*\n * Prototypes.\n */\n\ntypedef int td_key_iter_f(thread_key_t, void (*)(void *), void *);\ntypedef int td_thr_iter_f(const td_thrhandle_t *, void *);\n\n/* Flags for `td_ta_thr_iter'. */\n#define\tTD_THR_ANY_USER_FLAGS\t0xffffffff\n#define\tTD_THR_LOWEST_PRIORITY\t-20\n#define\tTD_SIGNO_MASK\t\tNULL\n\n__BEGIN_DECLS\ntd_err_e td_init(void);\n\ntd_err_e td_ta_clear_event(const td_thragent_t *, td_thr_events_t *);\ntd_err_e td_ta_delete(td_thragent_t *);\ntd_err_e td_ta_event_addr(const td_thragent_t *, td_thr_events_e,\n    td_notify_t *);\ntd_err_e td_ta_event_getmsg(const td_thragent_t *, td_event_msg_t *);\ntd_err_e td_ta_map_id2thr(const td_thragent_t *, thread_t, td_thrhandle_t *);\ntd_err_e td_ta_map_lwp2thr(const td_thragent_t *, lwpid_t, td_thrhandle_t *);\ntd_err_e td_ta_new(struct ps_prochandle *, td_thragent_t **);\ntd_err_e td_ta_set_event(const td_thragent_t *, td_thr_events_t *);\ntd_err_e td_ta_thr_iter(const td_thragent_t *, td_thr_iter_f *, void *,\n    td_thr_state_e, int, sigset_t *, unsigned int);\ntd_err_e td_ta_tsd_iter(const td_thragent_t *, td_key_iter_f *, void *);\n\ntd_err_e td_thr_clear_event(const td_thrhandle_t *, td_thr_events_t *);\ntd_err_e td_thr_dbresume(const td_thrhandle_t *);\ntd_err_e td_thr_dbsuspend(const td_thrhandle_t *);\ntd_err_e td_thr_event_enable(const td_thrhandle_t *, int);\ntd_err_e td_thr_event_getmsg(const td_thrhandle_t *, td_event_msg_t *);\ntd_err_e td_thr_get_info(const td_thrhandle_t *, td_thrinfo_t *);\n#ifdef __i386__\ntd_err_e td_thr_getxmmregs(const td_thrhandle_t *, char *);\n#endif\ntd_err_e td_thr_getfpregs(const td_thrhandle_t *, prfpregset_t *);\ntd_err_e td_thr_getgregs(const td_thrhandle_t *, prgregset_t);\ntd_err_e td_thr_set_event(const td_thrhandle_t *, td_thr_events_t *);\n#ifdef __i386__\ntd_err_e td_thr_setxmmregs(const td_thrhandle_t *, const char *);\n#endif\ntd_err_e td_thr_setfpregs(const td_thrhandle_t *, const prfpregset_t *);\ntd_err_e td_thr_setgregs(const td_thrhandle_t *, const prgregset_t);\ntd_err_e td_thr_validate(const td_thrhandle_t *);\ntd_err_e td_thr_tls_get_addr(const td_thrhandle_t *, psaddr_t, size_t,\n    psaddr_t *);\n\n/* FreeBSD specific extensions. */\ntd_err_e td_thr_sstep(const td_thrhandle_t *, int);\n__END_DECLS\n\n#endif /* _THREAD_DB_H_ */\n"
  },
  {
    "path": "freebsd-headers/time.h",
    "content": "/*\n * Copyright (c) 1989, 1993\n *\tThe Regents of the University of California.  All rights reserved.\n * (c) UNIX System Laboratories, Inc.\n * All or some portions of this file are derived from material licensed\n * to the University of California by American Telephone and Telegraph\n * Co. or Unix System Laboratories, Inc. and are reproduced herein with\n * the permission of UNIX System Laboratories, Inc.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t@(#)time.h\t8.3 (Berkeley) 1/21/94\n */\n\n/*\n * $FreeBSD: release/9.0.0/include/time.h 203964 2010-02-16 19:39:50Z imp $\n */\n\n#ifndef _TIME_H_\n#define\t_TIME_H_\n\n#include <sys/cdefs.h>\n#include <sys/_null.h>\n#include <sys/_types.h>\n\n#if __POSIX_VISIBLE > 0 && __POSIX_VISIBLE < 200112 || __BSD_VISIBLE\n/*\n * Frequency of the clock ticks reported by times().  Deprecated - use\n * sysconf(_SC_CLK_TCK) instead.  (Removed in 1003.1-2001.)\n */\n#define\tCLK_TCK\t\t128\n#endif\n\n/* Frequency of the clock ticks reported by clock().  */\n#define\tCLOCKS_PER_SEC\t128\n\n#ifndef _CLOCK_T_DECLARED\ntypedef\t__clock_t\tclock_t;\n#define\t_CLOCK_T_DECLARED\n#endif\n\n#ifndef _TIME_T_DECLARED\ntypedef\t__time_t\ttime_t;\n#define\t_TIME_T_DECLARED\n#endif\n\n#ifndef _SIZE_T_DECLARED\ntypedef\t__size_t\tsize_t;\n#define\t_SIZE_T_DECLARED\n#endif\n\n#if __POSIX_VISIBLE >= 199309\n/*\n * New in POSIX 1003.1b-1993.\n */\n#ifndef _CLOCKID_T_DECLARED\ntypedef\t__clockid_t\tclockid_t;\n#define\t_CLOCKID_T_DECLARED\n#endif\n\n#ifndef _TIMER_T_DECLARED\ntypedef\t__timer_t\ttimer_t;\n#define\t_TIMER_T_DECLARED\n#endif\n\n#include <sys/timespec.h>\n#endif /* __POSIX_VISIBLE >= 199309 */\n\n/* These macros are also in sys/time.h. */\n#if !defined(CLOCK_REALTIME) && __POSIX_VISIBLE >= 200112\n#define CLOCK_REALTIME\t0\n#ifdef __BSD_VISIBLE\n#define CLOCK_VIRTUAL\t1\n#define CLOCK_PROF\t2\n#endif\n#define CLOCK_MONOTONIC\t4\n#define CLOCK_UPTIME\t5\t\t/* FreeBSD-specific. */\n#define CLOCK_UPTIME_PRECISE\t7\t/* FreeBSD-specific. */\n#define CLOCK_UPTIME_FAST\t8\t/* FreeBSD-specific. */\n#define CLOCK_REALTIME_PRECISE\t9\t/* FreeBSD-specific. */\n#define CLOCK_REALTIME_FAST\t10\t/* FreeBSD-specific. */\n#define CLOCK_MONOTONIC_PRECISE\t11\t/* FreeBSD-specific. */\n#define CLOCK_MONOTONIC_FAST\t12\t/* FreeBSD-specific. */\n#define CLOCK_SECOND\t13\t\t/* FreeBSD-specific. */\n#define CLOCK_THREAD_CPUTIME_ID\t14\n#endif /* !defined(CLOCK_REALTIME) && __POSIX_VISIBLE >= 200112 */\n\n#if !defined(TIMER_ABSTIME) && __POSIX_VISIBLE >= 200112\n#if __BSD_VISIBLE\n#define TIMER_RELTIME\t0x0\t/* relative timer */\n#endif\n#define TIMER_ABSTIME\t0x1\t/* absolute timer */\n#endif /* !defined(TIMER_ABSTIME) && __POSIX_VISIBLE >= 200112 */\n\nstruct tm {\n\tint\ttm_sec;\t\t/* seconds after the minute [0-60] */\n\tint\ttm_min;\t\t/* minutes after the hour [0-59] */\n\tint\ttm_hour;\t/* hours since midnight [0-23] */\n\tint\ttm_mday;\t/* day of the month [1-31] */\n\tint\ttm_mon;\t\t/* months since January [0-11] */\n\tint\ttm_year;\t/* years since 1900 */\n\tint\ttm_wday;\t/* days since Sunday [0-6] */\n\tint\ttm_yday;\t/* days since January 1 [0-365] */\n\tint\ttm_isdst;\t/* Daylight Savings Time flag */\n\tlong\ttm_gmtoff;\t/* offset from UTC in seconds */\n\tchar\t*tm_zone;\t/* timezone abbreviation */\n};\n\n#if __POSIX_VISIBLE\nextern char *tzname[];\n#endif\n\n__BEGIN_DECLS\nchar *asctime(const struct tm *);\nclock_t clock(void);\nchar *ctime(const time_t *);\ndouble difftime(time_t, time_t);\n/* XXX missing: getdate() */\nstruct tm *gmtime(const time_t *);\nstruct tm *localtime(const time_t *);\ntime_t mktime(struct tm *);\nsize_t strftime(char * __restrict, size_t, const char * __restrict,\n    const struct tm * __restrict);\ntime_t time(time_t *);\n#if __POSIX_VISIBLE >= 200112\nstruct sigevent;\nint timer_create(clockid_t, struct sigevent *__restrict, timer_t *__restrict);\nint timer_delete(timer_t);\nint timer_gettime(timer_t, struct itimerspec *);\nint timer_getoverrun(timer_t);\nint timer_settime(timer_t, int, const struct itimerspec *__restrict,\n\tstruct itimerspec *__restrict);\n#endif\n#if __POSIX_VISIBLE\nvoid tzset(void);\n#endif\n\n#if __POSIX_VISIBLE >= 199309\nint clock_getres(clockid_t, struct timespec *);\nint clock_gettime(clockid_t, struct timespec *);\nint clock_settime(clockid_t, const struct timespec *);\n/* XXX missing: clock_nanosleep() */\nint nanosleep(const struct timespec *, struct timespec *);\n#endif /* __POSIX_VISIBLE >= 199309 */\n\n#if __POSIX_VISIBLE >= 199506\nchar *asctime_r(const struct tm *, char *);\nchar *ctime_r(const time_t *, char *);\nstruct tm *gmtime_r(const time_t *, struct tm *);\nstruct tm *localtime_r(const time_t *, struct tm *);\n#endif\n\n#if __XSI_VISIBLE\nchar *strptime(const char * __restrict, const char * __restrict,\n    struct tm * __restrict);\n#endif\n\n#if __BSD_VISIBLE\nchar *timezone(int, int);\t/* XXX XSI conflict */\nvoid tzsetwall(void);\ntime_t timelocal(struct tm * const);\ntime_t timegm(struct tm * const);\n#endif /* __BSD_VISIBLE */\n__END_DECLS\n\n#endif /* !_TIME_H_ */\n"
  },
  {
    "path": "freebsd-headers/timeconv.h",
    "content": "/*\n * Copyright (c) 1989, 1993\n *\tThe Regents of the University of California.  All rights reserved.\n * (c) UNIX System Laboratories, Inc.\n * All or some portions of this file are derived from material licensed\n * to the University of California by American Telephone and Telegraph\n * Co. or Unix System Laboratories, Inc. and are reproduced herein with\n * the permission of UNIX System Laboratories, Inc.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t@(#)time.h\t8.3 (Berkeley) 1/21/94\n */\n\n/*\n * $FreeBSD: release/9.0.0/include/timeconv.h 203964 2010-02-16 19:39:50Z imp $\n */\n\n#ifndef _TIMECONV_H_\n#define\t_TIMECONV_H_\n\n#include <sys/cdefs.h>\n#include <sys/_types.h>\n\n#ifndef _TIME_T_DECLARED\ntypedef\t__time_t\ttime_t;\n#define\t_TIME_T_DECLARED\n#endif\n\ntime_t _time32_to_time(__int32_t t32);\n__int32_t _time_to_time32(time_t t);\ntime_t _time64_to_time(__int64_t t64);\n__int64_t _time_to_time64(time_t t);\nlong _time_to_long(time_t t);\ntime_t _long_to_time(long tlong);\nint _time_to_int(time_t t);\ntime_t _int_to_time(int tint);\n\n#endif /* _TIMECONV_H_ */\n"
  },
  {
    "path": "freebsd-headers/timers.h",
    "content": "/* ==== timers.h ============================================================\n * Copyright (c) 1994 by Chris Provenzano, proven@mit.edu\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. All advertising materials mentioning features or use of this software\n *    must display the following acknowledgement:\n *  This product includes software developed by Chris Provenzano.\n * 4. The name of Chris Provenzano may not be used to endorse or promote\n *\t  products derived from this software without specific prior written\n *\t  permission.\n *\n * THIS SOFTWARE IS PROVIDED BY CHRIS PROVENZANO ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL CHRIS PROVENZANO BE LIABLE FOR ANY\n * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR\n * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/include/timers.h 50473 1999-08-27 23:45:13Z peter $\n *\n * Description : Basic timers header.\n *\n *  1.00 94/06/13 proven\n *      -Started coding this file.\n */\n\n#ifndef _TIMERS_H_\n#define\t_TIMERS_H_\n\n#include <sys/timers.h>\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/ttyent.h",
    "content": "/*\n * Copyright (c) 1989, 1993\n *\tThe Regents of the University of California.  All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t@(#)ttyent.h\t8.1 (Berkeley) 6/2/93\n * $FreeBSD: release/9.0.0/include/ttyent.h 203964 2010-02-16 19:39:50Z imp $\n */\n\n#ifndef\t_TTYENT_H_\n#define\t_TTYENT_H_\n\n#define\t_PATH_TTYS\t\"/etc/ttys\"\n\n#define\t_TTYS_OFF\t\"off\"\n#define\t_TTYS_ON\t\"on\"\n#define\t_TTYS_SECURE\t\"secure\"\n#define\t_TTYS_INSECURE\t\"insecure\"\n#define\t_TTYS_WINDOW\t\"window\"\n#define\t_TTYS_GROUP\t\"group\"\n#define\t_TTYS_NOGROUP\t\"none\"\n#define\t_TTYS_DIALUP\t\"dialup\"\n#define\t_TTYS_NETWORK\t\"network\"\n\nstruct ttyent {\n\tchar\t*ty_name;\t/* terminal device name */\n\tchar\t*ty_getty;\t/* command to execute, usually getty */\n\tchar\t*ty_type;\t/* terminal type for termcap */\n#define\tTTY_ON\t\t0x01\t/* enable logins (start ty_getty program) */\n#define\tTTY_SECURE\t0x02\t/* allow uid of 0 to login */\n#define\tTTY_DIALUP\t0x04\t/* is a dialup tty */\n#define\tTTY_NETWORK\t0x08\t/* is a network tty */\n\tint\tty_status;\t/* status flags */\n\tchar \t*ty_window;\t/* command to start up window manager */\n\tchar\t*ty_comment;\t/* comment field */\n\tchar\t*ty_group;\t/* tty group */\n};\n\n#include <sys/cdefs.h>\n\n__BEGIN_DECLS\nstruct ttyent *getttyent(void);\nstruct ttyent *getttynam(const char *);\nint setttyent(void);\nint endttyent(void);\nint isdialuptty(const char *);\nint isnettty(const char *);\n__END_DECLS\n\n#endif /* !_TTYENT_H_ */\n"
  },
  {
    "path": "freebsd-headers/ufs/ffs/ffs_extern.h",
    "content": "/*-\n * Copyright (c) 1991, 1993, 1994\n *\tThe Regents of the University of California.  All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 4. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t@(#)ffs_extern.h\t8.6 (Berkeley) 3/30/95\n * $FreeBSD: release/9.0.0/sys/ufs/ffs/ffs_extern.h 225166 2011-08-25 08:17:39Z mm $\n */\n\n#ifndef _UFS_FFS_EXTERN_H\n#define\t_UFS_FFS_EXTERN_H\n\n#ifndef _KERNEL\n#error \"No user-serving parts inside\"\n#else\n\nstruct buf;\nstruct cg;\nstruct fid;\nstruct fs;\nstruct inode;\nstruct malloc_type;\nstruct mount;\nstruct thread;\nstruct sockaddr;\nstruct statfs;\nstruct ucred;\nstruct vnode;\nstruct vop_fsync_args;\nstruct vop_reallocblks_args;\nstruct workhead;\n\nint\tffs_alloc(struct inode *, ufs2_daddr_t, ufs2_daddr_t, int, int,\n\t    struct ucred *, ufs2_daddr_t *);\nint\tffs_balloc_ufs1(struct vnode *a_vp, off_t a_startoffset, int a_size,\n            struct ucred *a_cred, int a_flags, struct buf **a_bpp);\nint\tffs_balloc_ufs2(struct vnode *a_vp, off_t a_startoffset, int a_size,\n            struct ucred *a_cred, int a_flags, struct buf **a_bpp);\nint\tffs_blkatoff(struct vnode *, off_t, char **, struct buf **);\nvoid\tffs_blkfree(struct ufsmount *, struct fs *, struct vnode *,\n\t    ufs2_daddr_t, long, ino_t, enum vtype, struct workhead *);\nufs2_daddr_t ffs_blkpref_ufs1(struct inode *, ufs_lbn_t, int, ufs1_daddr_t *);\nufs2_daddr_t ffs_blkpref_ufs2(struct inode *, ufs_lbn_t, int, ufs2_daddr_t *);\nint\tffs_checkfreefile(struct fs *, struct vnode *, ino_t);\nvoid\tffs_clrblock(struct fs *, u_char *, ufs1_daddr_t);\nvoid\tffs_clusteracct(struct fs *, struct cg *, ufs1_daddr_t, int);\nvoid\tffs_bdflush(struct bufobj *, struct buf *);\nint\tffs_copyonwrite(struct vnode *, struct buf *);\nint\tffs_flushfiles(struct mount *, int, struct thread *);\nvoid\tffs_fragacct(struct fs *, int, int32_t [], int);\nint\tffs_freefile(struct ufsmount *, struct fs *, struct vnode *, ino_t,\n\t    int, struct workhead *);\nvoid\tffs_fserr(struct fs *, ino_t, char *);\nint\tffs_isblock(struct fs *, u_char *, ufs1_daddr_t);\nint\tffs_isfreeblock(struct fs *, u_char *, ufs1_daddr_t);\nvoid\tffs_load_inode(struct buf *, struct inode *, struct fs *, ino_t);\nint\tffs_mountroot(void);\nvoid\tffs_oldfscompat_write(struct fs *, struct ufsmount *);\nint\tffs_reallocblks(struct vop_reallocblks_args *);\nint\tffs_realloccg(struct inode *, ufs2_daddr_t, ufs2_daddr_t,\n\t    ufs2_daddr_t, int, int, int, struct ucred *, struct buf **);\nint\tffs_sbupdate(struct ufsmount *, int, int);\nvoid\tffs_setblock(struct fs *, u_char *, ufs1_daddr_t);\nint\tffs_snapblkfree(struct fs *, struct vnode *, ufs2_daddr_t, long, ino_t,\n\t    enum vtype, struct workhead *);\nvoid\tffs_snapremove(struct vnode *vp);\nint\tffs_snapshot(struct mount *mp, char *snapfile);\nvoid\tffs_snapshot_mount(struct mount *mp);\nvoid\tffs_snapshot_unmount(struct mount *mp);\nvoid\tprocess_deferred_inactive(struct mount *mp);\nvoid\tffs_sync_snap(struct mount *, int);\nint\tffs_syncvnode(struct vnode *vp, int waitfor);\nint\tffs_truncate(struct vnode *, off_t, int, struct ucred *, struct thread *);\nint\tffs_update(struct vnode *, int);\nint\tffs_valloc(struct vnode *, int, struct ucred *, struct vnode **);\n\nint\tffs_vfree(struct vnode *, ino_t, int);\nvfs_vget_t ffs_vget;\nint\tffs_vgetf(struct mount *, ino_t, int, struct vnode **, int);\n\n#define\tFFSV_FORCEINSMQ\t0x0001\n\nextern struct vop_vector ffs_vnodeops1;\nextern struct vop_vector ffs_fifoops1;\nextern struct vop_vector ffs_vnodeops2;\nextern struct vop_vector ffs_fifoops2;\n\n/*\n * Soft update function prototypes.\n */\n\nint\tsoftdep_check_suspend(struct mount *, struct vnode *,\n\t  int, int, int, int);\nvoid\tsoftdep_get_depcounts(struct mount *, int *, int *);\nvoid\tsoftdep_initialize(void);\nvoid\tsoftdep_uninitialize(void);\nint\tsoftdep_mount(struct vnode *, struct mount *, struct fs *,\n\t    struct ucred *);\nvoid\tsoftdep_unmount(struct mount *);\nint\tsoftdep_move_dependencies(struct buf *, struct buf *);\nint\tsoftdep_flushworklist(struct mount *, int *, struct thread *);\nint\tsoftdep_flushfiles(struct mount *, int, struct thread *);\nvoid\tsoftdep_update_inodeblock(struct inode *, struct buf *, int);\nvoid\tsoftdep_load_inodeblock(struct inode *);\nvoid\tsoftdep_freefile(struct vnode *, ino_t, int);\nint\tsoftdep_request_cleanup(struct fs *, struct vnode *,\n\t    struct ucred *, int);\nvoid\tsoftdep_setup_freeblocks(struct inode *, off_t, int);\nvoid\tsoftdep_setup_inomapdep(struct buf *, struct inode *, ino_t, int);\nvoid\tsoftdep_setup_blkmapdep(struct buf *, struct mount *, ufs2_daddr_t,\n\t    int, int);\nvoid\tsoftdep_setup_allocdirect(struct inode *, ufs_lbn_t, ufs2_daddr_t,\n\t    ufs2_daddr_t, long, long, struct buf *);\nvoid\tsoftdep_setup_allocext(struct inode *, ufs_lbn_t, ufs2_daddr_t,\n\t    ufs2_daddr_t, long, long, struct buf *);\nvoid\tsoftdep_setup_allocindir_meta(struct buf *, struct inode *,\n\t    struct buf *, int, ufs2_daddr_t);\nvoid\tsoftdep_setup_allocindir_page(struct inode *, ufs_lbn_t,\n\t    struct buf *, int, ufs2_daddr_t, ufs2_daddr_t, struct buf *);\nvoid\tsoftdep_setup_blkfree(struct mount *, struct buf *, ufs2_daddr_t, int,\n\t    struct workhead *);\nvoid\tsoftdep_setup_inofree(struct mount *, struct buf *, ino_t,\n\t    struct workhead *);\nvoid\tsoftdep_setup_sbupdate(struct ufsmount *, struct fs *, struct buf *);\nvoid\tsoftdep_fsync_mountdev(struct vnode *);\nint\tsoftdep_sync_metadata(struct vnode *);\nint\tsoftdep_sync_buf(struct vnode *, struct buf *, int);\nint     softdep_process_worklist(struct mount *, int);\nint     softdep_fsync(struct vnode *);\nint\tsoftdep_waitidle(struct mount *);\nint\tsoftdep_prealloc(struct vnode *, int);\nint\tsoftdep_journal_lookup(struct mount *, struct vnode **);\nvoid\tsoftdep_journal_freeblocks(struct inode *, struct ucred *, off_t, int);\nvoid\tsoftdep_journal_fsync(struct inode *);\nvoid\tsoftdep_buf_append(struct buf *, struct workhead *);\nvoid\tsoftdep_inode_append(struct inode *, struct ucred *, struct workhead *);\nvoid\tsoftdep_freework(struct workhead *);\n\n\n/*\n * Things to request flushing in softdep_request_cleanup()\n */\n#define FLUSH_INODES\t\t1\n#define FLUSH_INODES_WAIT\t2\n#define FLUSH_BLOCKS\t\t3\n#define FLUSH_BLOCKS_WAIT\t4\n\nint\tffs_rdonly(struct inode *);\n\nTAILQ_HEAD(snaphead, inode);\n\nstruct snapdata {\n\tLIST_ENTRY(snapdata) sn_link;\n\tstruct snaphead sn_head;\n\tdaddr_t sn_listsize;\n\tdaddr_t *sn_blklist;\n\tstruct lock sn_lock;\n};\n\n#endif /* _KERNEL */\n\n#endif /* !_UFS_FFS_EXTERN_H */\n"
  },
  {
    "path": "freebsd-headers/ufs/ffs/fs.h",
    "content": "/*-\n * Copyright (c) 1982, 1986, 1993\n *\tThe Regents of the University of California.  All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 4. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t@(#)fs.h\t8.13 (Berkeley) 3/21/95\n * $FreeBSD: release/9.0.0/sys/ufs/ffs/fs.h 224061 2011-07-15 16:20:33Z mckusick $\n */\n\n#ifndef _UFS_FFS_FS_H_\n#define _UFS_FFS_FS_H_\n\n/*\n * Each disk drive contains some number of filesystems.\n * A filesystem consists of a number of cylinder groups.\n * Each cylinder group has inodes and data.\n *\n * A filesystem is described by its super-block, which in turn\n * describes the cylinder groups.  The super-block is critical\n * data and is replicated in each cylinder group to protect against\n * catastrophic loss.  This is done at `newfs' time and the critical\n * super-block data does not change, so the copies need not be\n * referenced further unless disaster strikes.\n *\n * For filesystem fs, the offsets of the various blocks of interest\n * are given in the super block as:\n *\t[fs->fs_sblkno]\t\tSuper-block\n *\t[fs->fs_cblkno]\t\tCylinder group block\n *\t[fs->fs_iblkno]\t\tInode blocks\n *\t[fs->fs_dblkno]\t\tData blocks\n * The beginning of cylinder group cg in fs, is given by\n * the ``cgbase(fs, cg)'' macro.\n *\n * Depending on the architecture and the media, the superblock may\n * reside in any one of four places. For tiny media where every block \n * counts, it is placed at the very front of the partition. Historically,\n * UFS1 placed it 8K from the front to leave room for the disk label and\n * a small bootstrap. For UFS2 it got moved to 64K from the front to leave\n * room for the disk label and a bigger bootstrap, and for really piggy\n * systems we check at 256K from the front if the first three fail. In\n * all cases the size of the superblock will be SBLOCKSIZE. All values are\n * given in byte-offset form, so they do not imply a sector size. The\n * SBLOCKSEARCH specifies the order in which the locations should be searched.\n */\n#define SBLOCK_FLOPPY\t     0\n#define SBLOCK_UFS1\t  8192\n#define SBLOCK_UFS2\t 65536\n#define SBLOCK_PIGGY\t262144\n#define SBLOCKSIZE\t  8192\n#define SBLOCKSEARCH \\\n\t{ SBLOCK_UFS2, SBLOCK_UFS1, SBLOCK_FLOPPY, SBLOCK_PIGGY, -1 }\n\n/*\n * Max number of fragments per block. This value is NOT tweakable.\n */\n#define MAXFRAG \t8\n\n/*\n * Addresses stored in inodes are capable of addressing fragments\n * of `blocks'. File system blocks of at most size MAXBSIZE can\n * be optionally broken into 2, 4, or 8 pieces, each of which is\n * addressable; these pieces may be DEV_BSIZE, or some multiple of\n * a DEV_BSIZE unit.\n *\n * Large files consist of exclusively large data blocks.  To avoid\n * undue wasted disk space, the last data block of a small file may be\n * allocated as only as many fragments of a large block as are\n * necessary.  The filesystem format retains only a single pointer\n * to such a fragment, which is a piece of a single large block that\n * has been divided.  The size of such a fragment is determinable from\n * information in the inode, using the ``blksize(fs, ip, lbn)'' macro.\n *\n * The filesystem records space availability at the fragment level;\n * to determine block availability, aligned fragments are examined.\n */\n\n/*\n * MINBSIZE is the smallest allowable block size.\n * In order to insure that it is possible to create files of size\n * 2^32 with only two levels of indirection, MINBSIZE is set to 4096.\n * MINBSIZE must be big enough to hold a cylinder group block,\n * thus changes to (struct cg) must keep its size within MINBSIZE.\n * Note that super blocks are always of size SBLOCKSIZE,\n * and that both SBLOCKSIZE and MAXBSIZE must be >= MINBSIZE.\n */\n#define MINBSIZE\t4096\n\n/*\n * The path name on which the filesystem is mounted is maintained\n * in fs_fsmnt. MAXMNTLEN defines the amount of space allocated in\n * the super block for this name.\n */\n#define MAXMNTLEN\t468\n\n/*\n * The volume name for this filesystem is maintained in fs_volname.\n * MAXVOLLEN defines the length of the buffer allocated.\n */\n#define MAXVOLLEN\t32\n\n/*\n * There is a 128-byte region in the superblock reserved for in-core\n * pointers to summary information. Originally this included an array\n * of pointers to blocks of struct csum; now there are just a few\n * pointers and the remaining space is padded with fs_ocsp[].\n *\n * NOCSPTRS determines the size of this padding. One pointer (fs_csp)\n * is taken away to point to a contiguous array of struct csum for\n * all cylinder groups; a second (fs_maxcluster) points to an array\n * of cluster sizes that is computed as cylinder groups are inspected,\n * and the third points to an array that tracks the creation of new\n * directories. A fourth pointer, fs_active, is used when creating\n * snapshots; it points to a bitmap of cylinder groups for which the\n * free-block bitmap has changed since the snapshot operation began.\n */\n#define\tNOCSPTRS\t((128 / sizeof(void *)) - 4)\n\n/*\n * A summary of contiguous blocks of various sizes is maintained\n * in each cylinder group. Normally this is set by the initial\n * value of fs_maxcontig. To conserve space, a maximum summary size\n * is set by FS_MAXCONTIG.\n */\n#define FS_MAXCONTIG\t16\n\n/*\n * MINFREE gives the minimum acceptable percentage of filesystem\n * blocks which may be free. If the freelist drops below this level\n * only the superuser may continue to allocate blocks. This may\n * be set to 0 if no reserve of free blocks is deemed necessary,\n * however throughput drops by fifty percent if the filesystem\n * is run at between 95% and 100% full; thus the minimum default\n * value of fs_minfree is 5%. However, to get good clustering\n * performance, 10% is a better choice. hence we use 10% as our\n * default value. With 10% free space, fragmentation is not a\n * problem, so we choose to optimize for time.\n */\n#define MINFREE\t\t8\n#define DEFAULTOPT\tFS_OPTTIME\n\n/*\n * Grigoriy Orlov <gluk@ptci.ru> has done some extensive work to fine\n * tune the layout preferences for directories within a filesystem.\n * His algorithm can be tuned by adjusting the following parameters\n * which tell the system the average file size and the average number\n * of files per directory. These defaults are well selected for typical\n * filesystems, but may need to be tuned for odd cases like filesystems\n * being used for squid caches or news spools.\n */\n#define AVFILESIZ\t16384\t/* expected average file size */\n#define AFPDIR\t\t64\t/* expected number of files per directory */\n\n/*\n * The maximum number of snapshot nodes that can be associated\n * with each filesystem. This limit affects only the number of\n * snapshot files that can be recorded within the superblock so\n * that they can be found when the filesystem is mounted. However,\n * maintaining too many will slow the filesystem performance, so\n * having this limit is a good idea.\n */\n#define FSMAXSNAP 20\n\n/*\n * Used to identify special blocks in snapshots:\n *\n * BLK_NOCOPY - A block that was unallocated at the time the snapshot\n *\twas taken, hence does not need to be copied when written.\n * BLK_SNAP - A block held by another snapshot that is not needed by this\n *\tsnapshot. When the other snapshot is freed, the BLK_SNAP entries\n *\tare converted to BLK_NOCOPY. These are needed to allow fsck to\n *\tidentify blocks that are in use by other snapshots (which are\n *\texpunged from this snapshot).\n */\n#define BLK_NOCOPY ((ufs2_daddr_t)(1))\n#define BLK_SNAP ((ufs2_daddr_t)(2))\n\n/*\n * Sysctl values for the fast filesystem.\n */\n#define\tFFS_ADJ_REFCNT\t\t 1\t/* adjust inode reference count */\n#define\tFFS_ADJ_BLKCNT\t\t 2\t/* adjust inode used block count */\n#define\tFFS_BLK_FREE\t\t 3\t/* free range of blocks in map */\n#define\tFFS_DIR_FREE\t\t 4\t/* free specified dir inodes in map */\n#define\tFFS_FILE_FREE\t\t 5\t/* free specified file inodes in map */\n#define\tFFS_SET_FLAGS\t\t 6\t/* set filesystem flags */\n#define\tFFS_ADJ_NDIR\t\t 7\t/* adjust number of directories */\n#define\tFFS_ADJ_NBFREE\t\t 8\t/* adjust number of free blocks */\n#define\tFFS_ADJ_NIFREE\t\t 9\t/* adjust number of free inodes */\n#define\tFFS_ADJ_NFFREE\t\t10 \t/* adjust number of free frags */\n#define\tFFS_ADJ_NUMCLUSTERS\t11\t/* adjust number of free clusters */\n#define FFS_SET_CWD\t\t12\t/* set current directory */\n#define\tFFS_SET_DOTDOT\t\t13\t/* set inode number for \"..\" */\n#define\tFFS_UNLINK\t\t14\t/* remove a name in the filesystem */\n#define\tFFS_SET_INODE\t\t15\t/* update an on-disk inode */\n#define\tFFS_SET_BUFOUTPUT\t16\t/* set buffered writing on descriptor */\n#define\tFFS_MAXID\t\t16\t/* number of valid ffs ids */\n\n/*\n * Command structure passed in to the filesystem to adjust filesystem values.\n */\n#define\tFFS_CMD_VERSION\t\t0x19790518\t/* version ID */\nstruct fsck_cmd {\n\tint32_t\tversion;\t/* version of command structure */\n\tint32_t\thandle;\t\t/* reference to filesystem to be changed */\n\tint64_t\tvalue;\t\t/* inode or block number to be affected */\n\tint64_t\tsize;\t\t/* amount or range to be adjusted */\n\tint64_t\tspare;\t\t/* reserved for future use */\n};\n\n/*\n * Per cylinder group information; summarized in blocks allocated\n * from first cylinder group data blocks.  These blocks have to be\n * read in from fs_csaddr (size fs_cssize) in addition to the\n * super block.\n */\nstruct csum {\n\tint32_t\tcs_ndir;\t\t/* number of directories */\n\tint32_t\tcs_nbfree;\t\t/* number of free blocks */\n\tint32_t\tcs_nifree;\t\t/* number of free inodes */\n\tint32_t\tcs_nffree;\t\t/* number of free frags */\n};\nstruct csum_total {\n\tint64_t\tcs_ndir;\t\t/* number of directories */\n\tint64_t\tcs_nbfree;\t\t/* number of free blocks */\n\tint64_t\tcs_nifree;\t\t/* number of free inodes */\n\tint64_t\tcs_nffree;\t\t/* number of free frags */\n\tint64_t\tcs_numclusters;\t\t/* number of free clusters */\n\tint64_t\tcs_spare[3];\t\t/* future expansion */\n};\n\n/*\n * Super block for an FFS filesystem.\n */\nstruct fs {\n\tint32_t\t fs_firstfield;\t\t/* historic filesystem linked list, */\n\tint32_t\t fs_unused_1;\t\t/*     used for incore super blocks */\n\tint32_t\t fs_sblkno;\t\t/* offset of super-block in filesys */\n\tint32_t\t fs_cblkno;\t\t/* offset of cyl-block in filesys */\n\tint32_t\t fs_iblkno;\t\t/* offset of inode-blocks in filesys */\n\tint32_t\t fs_dblkno;\t\t/* offset of first data after cg */\n\tint32_t\t fs_old_cgoffset;\t/* cylinder group offset in cylinder */\n\tint32_t\t fs_old_cgmask;\t\t/* used to calc mod fs_ntrak */\n\tint32_t  fs_old_time;\t\t/* last time written */\n\tint32_t\t fs_old_size;\t\t/* number of blocks in fs */\n\tint32_t\t fs_old_dsize;\t\t/* number of data blocks in fs */\n\tu_int32_t fs_ncg;\t\t/* number of cylinder groups */\n\tint32_t\t fs_bsize;\t\t/* size of basic blocks in fs */\n\tint32_t\t fs_fsize;\t\t/* size of frag blocks in fs */\n\tint32_t\t fs_frag;\t\t/* number of frags in a block in fs */\n/* these are configuration parameters */\n\tint32_t\t fs_minfree;\t\t/* minimum percentage of free blocks */\n\tint32_t\t fs_old_rotdelay;\t/* num of ms for optimal next block */\n\tint32_t\t fs_old_rps;\t\t/* disk revolutions per second */\n/* these fields can be computed from the others */\n\tint32_t\t fs_bmask;\t\t/* ``blkoff'' calc of blk offsets */\n\tint32_t\t fs_fmask;\t\t/* ``fragoff'' calc of frag offsets */\n\tint32_t\t fs_bshift;\t\t/* ``lblkno'' calc of logical blkno */\n\tint32_t\t fs_fshift;\t\t/* ``numfrags'' calc number of frags */\n/* these are configuration parameters */\n\tint32_t\t fs_maxcontig;\t\t/* max number of contiguous blks */\n\tint32_t\t fs_maxbpg;\t\t/* max number of blks per cyl group */\n/* these fields can be computed from the others */\n\tint32_t\t fs_fragshift;\t\t/* block to frag shift */\n\tint32_t\t fs_fsbtodb;\t\t/* fsbtodb and dbtofsb shift constant */\n\tint32_t\t fs_sbsize;\t\t/* actual size of super block */\n\tint32_t\t fs_spare1[2];\t\t/* old fs_csmask */\n\t\t\t\t\t/* old fs_csshift */\n\tint32_t\t fs_nindir;\t\t/* value of NINDIR */\n\tu_int32_t fs_inopb;\t\t/* value of INOPB */\n\tint32_t\t fs_old_nspf;\t\t/* value of NSPF */\n/* yet another configuration parameter */\n\tint32_t\t fs_optim;\t\t/* optimization preference, see below */\n\tint32_t\t fs_old_npsect;\t\t/* # sectors/track including spares */\n\tint32_t\t fs_old_interleave;\t/* hardware sector interleave */\n\tint32_t\t fs_old_trackskew;\t/* sector 0 skew, per track */\n\tint32_t\t fs_id[2];\t\t/* unique filesystem id */\n/* sizes determined by number of cylinder groups and their sizes */\n\tint32_t\t fs_old_csaddr;\t\t/* blk addr of cyl grp summary area */\n\tint32_t\t fs_cssize;\t\t/* size of cyl grp summary area */\n\tint32_t\t fs_cgsize;\t\t/* cylinder group size */\n\tint32_t\t fs_spare2;\t\t/* old fs_ntrak */\n\tint32_t\t fs_old_nsect;\t\t/* sectors per track */\n\tint32_t  fs_old_spc;\t\t/* sectors per cylinder */\n\tint32_t\t fs_old_ncyl;\t\t/* cylinders in filesystem */\n\tint32_t\t fs_old_cpg;\t\t/* cylinders per group */\n\tu_int32_t fs_ipg;\t\t/* inodes per group */\n\tint32_t\t fs_fpg;\t\t/* blocks per group * fs_frag */\n/* this data must be re-computed after crashes */\n\tstruct\tcsum fs_old_cstotal;\t/* cylinder summary information */\n/* these fields are cleared at mount time */\n\tint8_t   fs_fmod;\t\t/* super block modified flag */\n\tint8_t   fs_clean;\t\t/* filesystem is clean flag */\n\tint8_t \t fs_ronly;\t\t/* mounted read-only flag */\n\tint8_t   fs_old_flags;\t\t/* old FS_ flags */\n\tu_char\t fs_fsmnt[MAXMNTLEN];\t/* name mounted on */\n\tu_char\t fs_volname[MAXVOLLEN];\t/* volume name */\n\tu_int64_t fs_swuid;\t\t/* system-wide uid */\n\tint32_t  fs_pad;\t\t/* due to alignment of fs_swuid */\n/* these fields retain the current block allocation info */\n\tint32_t\t fs_cgrotor;\t\t/* last cg searched */\n\tvoid \t*fs_ocsp[NOCSPTRS];\t/* padding; was list of fs_cs buffers */\n\tu_int8_t *fs_contigdirs;\t/* (u) # of contig. allocated dirs */\n\tstruct\tcsum *fs_csp;\t\t/* (u) cg summary info buffer */\n\tint32_t\t*fs_maxcluster;\t\t/* (u) max cluster in each cyl group */\n\tu_int\t*fs_active;\t\t/* (u) used by snapshots to track fs */\n\tint32_t\t fs_old_cpc;\t\t/* cyl per cycle in postbl */\n\tint32_t\t fs_maxbsize;\t\t/* maximum blocking factor permitted */\n\tint64_t\t fs_unrefs;\t\t/* number of unreferenced inodes */\n\tint64_t\t fs_sparecon64[16];\t/* old rotation block list head */\n\tint64_t\t fs_sblockloc;\t\t/* byte offset of standard superblock */\n\tstruct\tcsum_total fs_cstotal;\t/* (u) cylinder summary information */\n\tufs_time_t fs_time;\t\t/* last time written */\n\tint64_t\t fs_size;\t\t/* number of blocks in fs */\n\tint64_t\t fs_dsize;\t\t/* number of data blocks in fs */\n\tufs2_daddr_t fs_csaddr;\t\t/* blk addr of cyl grp summary area */\n\tint64_t\t fs_pendingblocks;\t/* (u) blocks being freed */\n\tu_int32_t fs_pendinginodes;\t/* (u) inodes being freed */\n\tino_t\t fs_snapinum[FSMAXSNAP];/* list of snapshot inode numbers */\n\tu_int32_t fs_avgfilesize;\t/* expected average file size */\n\tu_int32_t fs_avgfpdir;\t\t/* expected # of files per directory */\n\tint32_t\t fs_save_cgsize;\t/* save real cg size to use fs_bsize */\n\tufs_time_t fs_mtime;\t\t/* Last mount or fsck time. */\n\tint32_t  fs_sujfree;\t\t/* SUJ free list */\n\tint32_t\t fs_sparecon32[23];\t/* reserved for future constants */\n\tint32_t  fs_flags;\t\t/* see FS_ flags below */\n\tint32_t\t fs_contigsumsize;\t/* size of cluster summary array */ \n\tint32_t\t fs_maxsymlinklen;\t/* max length of an internal symlink */\n\tint32_t\t fs_old_inodefmt;\t/* format of on-disk inodes */\n\tu_int64_t fs_maxfilesize;\t/* maximum representable file size */\n\tint64_t\t fs_qbmask;\t\t/* ~fs_bmask for use with 64-bit size */\n\tint64_t\t fs_qfmask;\t\t/* ~fs_fmask for use with 64-bit size */\n\tint32_t\t fs_state;\t\t/* validate fs_clean field */\n\tint32_t\t fs_old_postblformat;\t/* format of positional layout tables */\n\tint32_t\t fs_old_nrpos;\t\t/* number of rotational positions */\n\tint32_t\t fs_spare5[2];\t\t/* old fs_postbloff */\n\t\t\t\t\t/* old fs_rotbloff */\n\tint32_t\t fs_magic;\t\t/* magic number */\n};\n\n/* Sanity checking. */\n#ifdef CTASSERT\nCTASSERT(sizeof(struct fs) == 1376);\n#endif\n\n/*\n * Filesystem identification\n */\n#define\tFS_UFS1_MAGIC\t0x011954\t/* UFS1 fast filesystem magic number */\n#define\tFS_UFS2_MAGIC\t0x19540119\t/* UFS2 fast filesystem magic number */\n#define\tFS_BAD_MAGIC\t0x19960408\t/* UFS incomplete newfs magic number */\n#define\tFS_OKAY\t\t0x7c269d38\t/* superblock checksum */\n#define FS_42INODEFMT\t-1\t\t/* 4.2BSD inode format */\n#define FS_44INODEFMT\t2\t\t/* 4.4BSD inode format */\n\n/*\n * Preference for optimization.\n */\n#define FS_OPTTIME\t0\t/* minimize allocation time */\n#define FS_OPTSPACE\t1\t/* minimize disk fragmentation */\n\n/*\n * Filesystem flags.\n *\n * The FS_UNCLEAN flag is set by the kernel when the filesystem was\n * mounted with fs_clean set to zero. The FS_DOSOFTDEP flag indicates\n * that the filesystem should be managed by the soft updates code.\n * Note that the FS_NEEDSFSCK flag is set and cleared only by the\n * fsck utility. It is set when background fsck finds an unexpected\n * inconsistency which requires a traditional foreground fsck to be\n * run. Such inconsistencies should only be found after an uncorrectable\n * disk error. A foreground fsck will clear the FS_NEEDSFSCK flag when\n * it has successfully cleaned up the filesystem. The kernel uses this\n * flag to enforce that inconsistent filesystems be mounted read-only.\n * The FS_INDEXDIRS flag when set indicates that the kernel maintains\n * on-disk auxiliary indexes (such as B-trees) for speeding directory\n * accesses. Kernels that do not support auxiliary indicies clear the\n * flag to indicate that the indicies need to be rebuilt (by fsck) before\n * they can be used.\n *\n * FS_ACLS indicates that POSIX.1e ACLs are administratively enabled\n * for the file system, so they should be loaded from extended attributes,\n * observed for access control purposes, and be administered by object\n * owners.  FS_NFS4ACLS indicates that NFSv4 ACLs are administratively\n * enabled.  This flag is mutually exclusive with FS_ACLS.  FS_MULTILABEL\n * indicates that the TrustedBSD MAC Framework should attempt to back MAC\n * labels into extended attributes on the file system rather than maintain\n * a single mount label for all objects.\n */\n#define FS_UNCLEAN\t0x0001\t/* filesystem not clean at mount */\n#define FS_DOSOFTDEP\t0x0002\t/* filesystem using soft dependencies */\n#define FS_NEEDSFSCK\t0x0004\t/* filesystem needs sync fsck before mount */\n#define\tFS_SUJ       \t0x0008\t/* Filesystem using softupdate journal */\n#define FS_ACLS\t\t0x0010\t/* file system has POSIX.1e ACLs enabled */\n#define FS_MULTILABEL\t0x0020\t/* file system is MAC multi-label */\n#define FS_GJOURNAL\t0x0040\t/* gjournaled file system */\n#define FS_FLAGS_UPDATED 0x0080\t/* flags have been moved to new location */\n#define FS_NFS4ACLS\t0x0100\t/* file system has NFSv4 ACLs enabled */\n#define FS_INDEXDIRS\t0x0200\t/* kernel supports indexed directories */\n#define\tFS_TRIM\t\t0x0400\t/* issue BIO_DELETE for deleted blocks */\n\n/*\n * Macros to access bits in the fs_active array.\n */\n#define\tACTIVECGNUM(fs, cg)\t((fs)->fs_active[(cg) / (NBBY * sizeof(int))])\n#define\tACTIVECGOFF(cg)\t\t(1 << ((cg) % (NBBY * sizeof(int))))\n#define\tACTIVESET(fs, cg)\tdo {\t\t\t\t\t\\\n\tif ((fs)->fs_active)\t\t\t\t\t\t\\\n\t\tACTIVECGNUM((fs), (cg)) |= ACTIVECGOFF((cg));\t\t\\\n} while (0)\n#define\tACTIVECLEAR(fs, cg)\tdo {\t\t\t\t\t\\\n\tif ((fs)->fs_active)\t\t\t\t\t\t\\\n\t\tACTIVECGNUM((fs), (cg)) &= ~ACTIVECGOFF((cg));\t\t\\\n} while (0)\n\n/*\n * The size of a cylinder group is calculated by CGSIZE. The maximum size\n * is limited by the fact that cylinder groups are at most one block.\n * Its size is derived from the size of the maps maintained in the\n * cylinder group and the (struct cg) size.\n */\n#define CGSIZE(fs) \\\n    /* base cg */\t(sizeof(struct cg) + sizeof(int32_t) + \\\n    /* old btotoff */\t(fs)->fs_old_cpg * sizeof(int32_t) + \\\n    /* old boff */\t(fs)->fs_old_cpg * sizeof(u_int16_t) + \\\n    /* inode map */\thowmany((fs)->fs_ipg, NBBY) + \\\n    /* block map */\thowmany((fs)->fs_fpg, NBBY) +\\\n    /* if present */\t((fs)->fs_contigsumsize <= 0 ? 0 : \\\n    /* cluster sum */\t(fs)->fs_contigsumsize * sizeof(int32_t) + \\\n    /* cluster map */\thowmany(fragstoblks(fs, (fs)->fs_fpg), NBBY)))\n\n/*\n * The minimal number of cylinder groups that should be created.\n */\n#define MINCYLGRPS\t4\n\n/*\n * Convert cylinder group to base address of its global summary info.\n */\n#define fs_cs(fs, indx) fs_csp[indx]\n\n/*\n * Cylinder group block for a filesystem.\n */\n#define\tCG_MAGIC\t0x090255\nstruct cg {\n\tint32_t\t cg_firstfield;\t\t/* historic cyl groups linked list */\n\tint32_t\t cg_magic;\t\t/* magic number */\n\tint32_t  cg_old_time;\t\t/* time last written */\n\tu_int32_t cg_cgx;\t\t/* we are the cgx'th cylinder group */\n\tint16_t\t cg_old_ncyl;\t\t/* number of cyl's this cg */\n\tint16_t  cg_old_niblk;\t\t/* number of inode blocks this cg */\n\tu_int32_t cg_ndblk;\t\t/* number of data blocks this cg */\n\tstruct\t csum cg_cs;\t\t/* cylinder summary information */\n\tu_int32_t cg_rotor;\t\t/* position of last used block */\n\tu_int32_t cg_frotor;\t\t/* position of last used frag */\n\tu_int32_t cg_irotor;\t\t/* position of last used inode */\n\tu_int32_t cg_frsum[MAXFRAG];\t/* counts of available frags */\n\tint32_t\t cg_old_btotoff;\t/* (int32) block totals per cylinder */\n\tint32_t\t cg_old_boff;\t\t/* (u_int16) free block positions */\n\tu_int32_t cg_iusedoff;\t\t/* (u_int8) used inode map */\n\tu_int32_t cg_freeoff;\t\t/* (u_int8) free block map */\n\tu_int32_t cg_nextfreeoff;\t/* (u_int8) next available space */\n\tu_int32_t cg_clustersumoff;\t/* (u_int32) counts of avail clusters */\n\tu_int32_t cg_clusteroff;\t\t/* (u_int8) free cluster map */\n\tu_int32_t cg_nclusterblks;\t/* number of clusters this cg */\n\tu_int32_t cg_niblk;\t\t/* number of inode blocks this cg */\n\tu_int32_t cg_initediblk;\t\t/* last initialized inode */\n\tu_int32_t cg_unrefs;\t\t/* number of unreferenced inodes */\n\tint32_t\t cg_sparecon32[2];\t/* reserved for future use */\n\tufs_time_t cg_time;\t\t/* time last written */\n\tint64_t\t cg_sparecon64[3];\t/* reserved for future use */\n\tu_int8_t cg_space[1];\t\t/* space for cylinder group maps */\n/* actually longer */\n};\n\n/*\n * Macros for access to cylinder group array structures\n */\n#define cg_chkmagic(cgp) ((cgp)->cg_magic == CG_MAGIC)\n#define cg_inosused(cgp) \\\n    ((u_int8_t *)((u_int8_t *)(cgp) + (cgp)->cg_iusedoff))\n#define cg_blksfree(cgp) \\\n    ((u_int8_t *)((u_int8_t *)(cgp) + (cgp)->cg_freeoff))\n#define cg_clustersfree(cgp) \\\n    ((u_int8_t *)((u_int8_t *)(cgp) + (cgp)->cg_clusteroff))\n#define cg_clustersum(cgp) \\\n    ((int32_t *)((uintptr_t)(cgp) + (cgp)->cg_clustersumoff))\n\n/*\n * Turn filesystem block numbers into disk block addresses.\n * This maps filesystem blocks to device size blocks.\n */\n#define\tfsbtodb(fs, b)\t((daddr_t)(b) << (fs)->fs_fsbtodb)\n#define\tdbtofsb(fs, b)\t((b) >> (fs)->fs_fsbtodb)\n\n/*\n * Cylinder group macros to locate things in cylinder groups.\n * They calc filesystem addresses of cylinder group data structures.\n */\n#define\tcgbase(fs, c)\t(((ufs2_daddr_t)(fs)->fs_fpg) * (c))\n#define\tcgdmin(fs, c)\t(cgstart(fs, c) + (fs)->fs_dblkno)\t/* 1st data */\n#define\tcgimin(fs, c)\t(cgstart(fs, c) + (fs)->fs_iblkno)\t/* inode blk */\n#define\tcgsblock(fs, c)\t(cgstart(fs, c) + (fs)->fs_sblkno)\t/* super blk */\n#define\tcgtod(fs, c)\t(cgstart(fs, c) + (fs)->fs_cblkno)\t/* cg block */\n#define cgstart(fs, c)\t\t\t\t\t\t\t\\\n       ((fs)->fs_magic == FS_UFS2_MAGIC ? cgbase(fs, c) :\t\t\\\n       (cgbase(fs, c) + (fs)->fs_old_cgoffset * ((c) & ~((fs)->fs_old_cgmask))))\n\n/*\n * Macros for handling inode numbers:\n *     inode number to filesystem block offset.\n *     inode number to cylinder group number.\n *     inode number to filesystem block address.\n */\n#define\tino_to_cg(fs, x)\t(((ino_t)(x)) / (fs)->fs_ipg)\n#define\tino_to_fsba(fs, x)\t\t\t\t\t\t\\\n\t((ufs2_daddr_t)(cgimin(fs, ino_to_cg(fs, (ino_t)(x))) +\t\t\\\n\t    (blkstofrags((fs), ((((ino_t)(x)) % (fs)->fs_ipg) / INOPB(fs))))))\n#define\tino_to_fsbo(fs, x)\t(((ino_t)(x)) % INOPB(fs))\n\n/*\n * Give cylinder group number for a filesystem block.\n * Give cylinder group block number for a filesystem block.\n */\n#define\tdtog(fs, d)\t((d) / (fs)->fs_fpg)\n#define\tdtogd(fs, d)\t((d) % (fs)->fs_fpg)\n\n/*\n * Extract the bits for a block from a map.\n * Compute the cylinder and rotational position of a cyl block addr.\n */\n#define blkmap(fs, map, loc) \\\n    (((map)[(loc) / NBBY] >> ((loc) % NBBY)) & (0xff >> (NBBY - (fs)->fs_frag)))\n\n/*\n * The following macros optimize certain frequently calculated\n * quantities by using shifts and masks in place of divisions\n * modulos and multiplications.\n */\n#define blkoff(fs, loc)\t\t/* calculates (loc % fs->fs_bsize) */ \\\n\t((loc) & (fs)->fs_qbmask)\n#define fragoff(fs, loc)\t/* calculates (loc % fs->fs_fsize) */ \\\n\t((loc) & (fs)->fs_qfmask)\n#define lfragtosize(fs, frag)\t/* calculates ((off_t)frag * fs->fs_fsize) */ \\\n\t(((off_t)(frag)) << (fs)->fs_fshift)\n#define lblktosize(fs, blk)\t/* calculates ((off_t)blk * fs->fs_bsize) */ \\\n\t(((off_t)(blk)) << (fs)->fs_bshift)\n/* Use this only when `blk' is known to be small, e.g., < NDADDR. */\n#define smalllblktosize(fs, blk)    /* calculates (blk * fs->fs_bsize) */ \\\n\t((blk) << (fs)->fs_bshift)\n#define lblkno(fs, loc)\t\t/* calculates (loc / fs->fs_bsize) */ \\\n\t((loc) >> (fs)->fs_bshift)\n#define numfrags(fs, loc)\t/* calculates (loc / fs->fs_fsize) */ \\\n\t((loc) >> (fs)->fs_fshift)\n#define blkroundup(fs, size)\t/* calculates roundup(size, fs->fs_bsize) */ \\\n\t(((size) + (fs)->fs_qbmask) & (fs)->fs_bmask)\n#define fragroundup(fs, size)\t/* calculates roundup(size, fs->fs_fsize) */ \\\n\t(((size) + (fs)->fs_qfmask) & (fs)->fs_fmask)\n#define fragstoblks(fs, frags)\t/* calculates (frags / fs->fs_frag) */ \\\n\t((frags) >> (fs)->fs_fragshift)\n#define blkstofrags(fs, blks)\t/* calculates (blks * fs->fs_frag) */ \\\n\t((blks) << (fs)->fs_fragshift)\n#define fragnum(fs, fsb)\t/* calculates (fsb % fs->fs_frag) */ \\\n\t((fsb) & ((fs)->fs_frag - 1))\n#define blknum(fs, fsb)\t\t/* calculates rounddown(fsb, fs->fs_frag) */ \\\n\t((fsb) &~ ((fs)->fs_frag - 1))\n\n/*\n * Determine the number of available frags given a\n * percentage to hold in reserve.\n */\n#define freespace(fs, percentreserved) \\\n\t(blkstofrags((fs), (fs)->fs_cstotal.cs_nbfree) + \\\n\t(fs)->fs_cstotal.cs_nffree - \\\n\t(((off_t)((fs)->fs_dsize)) * (percentreserved) / 100))\n\n/*\n * Determining the size of a file block in the filesystem.\n */\n#define blksize(fs, ip, lbn) \\\n\t(((lbn) >= NDADDR || (ip)->i_size >= smalllblktosize(fs, (lbn) + 1)) \\\n\t    ? (fs)->fs_bsize \\\n\t    : (fragroundup(fs, blkoff(fs, (ip)->i_size))))\n#define sblksize(fs, size, lbn) \\\n\t(((lbn) >= NDADDR || (size) >= ((lbn) + 1) << (fs)->fs_bshift) \\\n\t  ? (fs)->fs_bsize \\\n\t  : (fragroundup(fs, blkoff(fs, (size)))))\n\n/*\n * Number of indirects in a filesystem block.\n */\n#define\tNINDIR(fs)\t((fs)->fs_nindir)\n\n/*\n * Indirect lbns are aligned on NDADDR addresses where single indirects\n * are the negated address of the lowest lbn reachable, double indirects\n * are this lbn - 1 and triple indirects are this lbn - 2.  This yields\n * an unusual bit order to determine level.\n */\nstatic inline int\nlbn_level(ufs_lbn_t lbn)\n{\n\tif (lbn >= 0)\n\t\treturn 0;\n\tswitch (lbn & 0x3) {\n\tcase 0:\n\t\treturn (0);\n\tcase 1:\n\t\tbreak;\n\tcase 2:\n\t\treturn (2);\n\tcase 3:\n\t\treturn (1);\n\tdefault:\n\t\tbreak;\n\t}\n\treturn (-1);\n}\n\nstatic inline ufs_lbn_t\nlbn_offset(struct fs *fs, int level)\n{\n\tufs_lbn_t res;\n\n\tfor (res = 1; level > 0; level--)\n\t\tres *= NINDIR(fs);\n\treturn (res);\n}\n\n/*\n * Number of inodes in a secondary storage block/fragment.\n */\n#define\tINOPB(fs)\t((fs)->fs_inopb)\n#define\tINOPF(fs)\t((fs)->fs_inopb >> (fs)->fs_fragshift)\n\n/*\n * Softdep journal record format.\n */\n\n#define\tJOP_ADDREF\t1\t/* Add a reference to an inode. */\n#define\tJOP_REMREF\t2\t/* Remove a reference from an inode. */\n#define\tJOP_NEWBLK\t3\t/* Allocate a block. */\n#define\tJOP_FREEBLK\t4\t/* Free a block or a tree of blocks. */\n#define\tJOP_MVREF\t5\t/* Move a reference from one off to another. */\n#define\tJOP_TRUNC\t6\t/* Partial truncation record. */\n#define\tJOP_SYNC\t7\t/* fsync() complete record. */\n\n#define\tJREC_SIZE\t32\t/* Record and segment header size. */\n\n#define\tSUJ_MIN\t\t(4 * 1024 * 1024)\t/* Minimum journal size */\n#define\tSUJ_MAX\t\t(32 * 1024 * 1024)\t/* Maximum journal size */\n#define\tSUJ_FILE\t\".sujournal\"\t\t/* Journal file name */\n\n/*\n * Size of the segment record header.  There is at most one for each disk\n * block in the journal.  The segment header is followed by an array of\n * records.  fsck depends on the first element in each record being 'op'\n * and the second being 'ino'.  Segments may span multiple disk blocks but\n * the header is present on each.\n */\nstruct jsegrec {\n\tuint64_t\tjsr_seq;\t/* Our sequence number */\n\tuint64_t\tjsr_oldest;\t/* Oldest valid sequence number */\n\tuint16_t\tjsr_cnt;\t/* Count of valid records */\n\tuint16_t\tjsr_blocks;\t/* Count of device bsize blocks. */\n\tuint32_t\tjsr_crc;\t/* 32bit crc of the valid space */\n\tufs_time_t\tjsr_time;\t/* timestamp for mount instance */\n};\n\n/*\n * Reference record.  Records a single link count modification.\n */\nstruct jrefrec {\n\tuint32_t\tjr_op;\n\tino_t\t\tjr_ino;\n\tino_t\t\tjr_parent;\n\tuint16_t\tjr_nlink;\n\tuint16_t\tjr_mode;\n\toff_t\t\tjr_diroff;\n\tuint64_t\tjr_unused;\n};\n\n/*\n * Move record.  Records a reference moving within a directory block.  The\n * nlink is unchanged but we must search both locations.\n */\nstruct jmvrec {\n\tuint32_t\tjm_op;\n\tino_t\t\tjm_ino;\n\tino_t\t\tjm_parent;\n\tuint16_t\tjm_unused;\n\toff_t\t\tjm_oldoff;\n\toff_t\t\tjm_newoff;\n};\n\n/*\n * Block record.  A set of frags or tree of blocks starting at an indirect are\n * freed or a set of frags are allocated.\n */\nstruct jblkrec {\n\tuint32_t\tjb_op;\n\tuint32_t\tjb_ino;\n\tufs2_daddr_t\tjb_blkno;\n\tufs_lbn_t\tjb_lbn;\n\tuint16_t\tjb_frags;\n\tuint16_t\tjb_oldfrags;\n\tuint32_t\tjb_unused;\n};\n\n/*\n * Truncation record.  Records a partial truncation so that it may be\n * completed at check time.  Also used for sync records.\n */\nstruct jtrncrec {\n\tuint32_t\tjt_op;\n\tuint32_t\tjt_ino;\n\toff_t\t\tjt_size;\n\tuint32_t\tjt_extsize;\n\tuint32_t\tjt_pad[3];\n};\n\nunion jrec {\n\tstruct jsegrec\trec_jsegrec;\n\tstruct jrefrec\trec_jrefrec;\n\tstruct jmvrec\trec_jmvrec;\n\tstruct jblkrec\trec_jblkrec;\n\tstruct jtrncrec\trec_jtrncrec;\n};\n\n#ifdef CTASSERT\nCTASSERT(sizeof(struct jsegrec) == JREC_SIZE);\nCTASSERT(sizeof(struct jrefrec) == JREC_SIZE);\nCTASSERT(sizeof(struct jmvrec) == JREC_SIZE);\nCTASSERT(sizeof(struct jblkrec) == JREC_SIZE);\nCTASSERT(sizeof(struct jtrncrec) == JREC_SIZE);\nCTASSERT(sizeof(union jrec) == JREC_SIZE);\n#endif\n\nextern int inside[], around[];\nextern u_char *fragtbl[];\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/ufs/ffs/softdep.h",
    "content": "/*-\n * Copyright 1998, 2000 Marshall Kirk McKusick. All Rights Reserved.\n *\n * The soft updates code is derived from the appendix of a University\n * of Michigan technical report (Gregory R. Ganger and Yale N. Patt,\n * \"Soft Updates: A Solution to the Metadata Update Problem in File\n * Systems\", CSE-TR-254-95, August 1995).\n *\n * Further information about soft updates can be obtained from:\n *\n *\tMarshall Kirk McKusick\t\thttp://www.mckusick.com/softdep/\n *\t1614 Oxford Street\t\tmckusick@mckusick.com\n *\tBerkeley, CA 94709-1608\t\t+1-510-843-9542\n *\tUSA\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n *\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY MARSHALL KIRK MCKUSICK ``AS IS'' AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\n * DISCLAIMED.  IN NO EVENT SHALL MARSHALL KIRK MCKUSICK BE LIABLE FOR\n * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t@(#)softdep.h\t9.7 (McKusick) 6/21/00\n * $FreeBSD: release/9.0.0/sys/ufs/ffs/softdep.h 223772 2011-07-04 22:08:04Z jeff $\n */\n\n#include <sys/queue.h>\n\n/*\n * Allocation dependencies are handled with undo/redo on the in-memory\n * copy of the data. A particular data dependency is eliminated when\n * it is ALLCOMPLETE: that is ATTACHED, DEPCOMPLETE, and COMPLETE.\n * \n * The ATTACHED flag means that the data is not currently being written\n * to disk.\n * \n * The UNDONE flag means that the data has been rolled back to a safe\n * state for writing to the disk. When the I/O completes, the data is\n * restored to its current form and the state reverts to ATTACHED.\n * The data must be locked throughout the rollback, I/O, and roll\n * forward so that the rolled back information is never visible to\n * user processes.\n *\n * The COMPLETE flag indicates that the item has been written. For example,\n * a dependency that requires that an inode be written will be marked\n * COMPLETE after the inode has been written to disk.\n * \n * The DEPCOMPLETE flag indicates the completion of any other\n * dependencies such as the writing of a cylinder group map has been\n * completed. A dependency structure may be freed only when both it\n * and its dependencies have completed and any rollbacks that are in\n * progress have finished as indicated by the set of ALLCOMPLETE flags\n * all being set.\n * \n * The two MKDIR flags indicate additional dependencies that must be done\n * when creating a new directory. MKDIR_BODY is cleared when the directory\n * data block containing the \".\" and \"..\" entries has been written.\n * MKDIR_PARENT is cleared when the parent inode with the increased link\n * count for \"..\" has been written. When both MKDIR flags have been\n * cleared, the DEPCOMPLETE flag is set to indicate that the directory\n * dependencies have been completed. The writing of the directory inode\n * itself sets the COMPLETE flag which then allows the directory entry for\n * the new directory to be written to disk. The RMDIR flag marks a dirrem\n * structure as representing the removal of a directory rather than a\n * file. When the removal dependencies are completed, additional work needs\n * to be done* (an additional decrement of the associated inode, and a\n * decrement of the parent inode).\n *\n * The DIRCHG flag marks a diradd structure as representing the changing\n * of an existing entry rather than the addition of a new one. When\n * the update is complete the dirrem associated with the inode for\n * the old name must be added to the worklist to do the necessary\n * reference count decrement.\n * \n * The GOINGAWAY flag indicates that the data structure is frozen from\n * further change until its dependencies have been completed and its\n * resources freed after which it will be discarded.\n *\n * The IOSTARTED flag prevents multiple calls to the I/O start routine from\n * doing multiple rollbacks.\n *\n * The NEWBLOCK flag marks pagedep structures that have just been allocated,\n * so must be claimed by the inode before all dependencies are complete.\n *\n * The INPROGRESS flag marks worklist structures that are still on the\n * worklist, but are being considered for action by some process.\n *\n * The UFS1FMT flag indicates that the inode being processed is a ufs1 format.\n *\n * The EXTDATA flag indicates that the allocdirect describes an\n * extended-attributes dependency.\n *\n * The ONWORKLIST flag shows whether the structure is currently linked\n * onto a worklist.\n *\n * The UNLINK* flags track the progress of updating the on-disk linked\n * list of active but unlinked inodes. When an inode is first unlinked\n * it is marked as UNLINKED. When its on-disk di_freelink has been\n * written its UNLINKNEXT flags is set. When its predecessor in the\n * list has its di_freelink pointing at us its UNLINKPREV is set.\n * When the on-disk list can reach it from the superblock, its\n * UNLINKONLIST flag is set. Once all of these flags are set, it\n * is safe to let its last name be removed.\n */\n#define\tATTACHED\t0x000001\n#define\tUNDONE\t\t0x000002\n#define\tCOMPLETE\t0x000004\n#define\tDEPCOMPLETE\t0x000008\n#define\tMKDIR_PARENT\t0x000010 /* diradd, mkdir, jaddref, jsegdep only */\n#define\tMKDIR_BODY\t0x000020 /* diradd, mkdir, jaddref only */\n#define\tRMDIR\t\t0x000040 /* dirrem only */\n#define\tDIRCHG\t\t0x000080 /* diradd, dirrem only */\n#define\tGOINGAWAY\t0x000100 /* indirdep, jremref only */\n#define\tIOSTARTED\t0x000200 /* inodedep, pagedep, bmsafemap only */\n#define\tDELAYEDFREE\t0x000400 /* allocindirect free delayed. */\n#define\tNEWBLOCK\t0x000800 /* pagedep, jaddref only */\n#define\tINPROGRESS\t0x001000 /* dirrem, freeblks, freefrag, freefile only */\n#define\tUFS1FMT\t\t0x002000 /* indirdep only */\n#define\tEXTDATA\t\t0x004000 /* allocdirect only */\n#define ONWORKLIST\t0x008000\n#define\tIOWAITING\t0x010000 /* Thread is waiting for IO to complete. */\n#define\tONDEPLIST\t0x020000 /* Structure is on a dependency list. */\n#define\tUNLINKED\t0x040000 /* inodedep has been unlinked. */\n#define\tUNLINKNEXT\t0x080000 /* inodedep has valid di_freelink */\n#define\tUNLINKPREV\t0x100000 /* inodedep is pointed at in the unlink list */\n#define\tUNLINKONLIST\t0x200000 /* inodedep is in the unlinked list on disk */\n#define\tUNLINKLINKS\t(UNLINKNEXT | UNLINKPREV)\n\n#define\tALLCOMPLETE\t(ATTACHED | COMPLETE | DEPCOMPLETE)\n\n/*\n * The workitem queue.\n * \n * It is sometimes useful and/or necessary to clean up certain dependencies\n * in the background rather than during execution of an application process\n * or interrupt service routine. To realize this, we append dependency\n * structures corresponding to such tasks to a \"workitem\" queue. In a soft\n * updates implementation, most pending workitems should not wait for more\n * than a couple of seconds, so the filesystem syncer process awakens once\n * per second to process the items on the queue.\n */\n\n/* LIST_HEAD(workhead, worklist);\t-- declared in buf.h */\n\n/*\n * Each request can be linked onto a work queue through its worklist structure.\n * To avoid the need for a pointer to the structure itself, this structure\n * MUST be declared FIRST in each type in which it appears! If more than one\n * worklist is needed in the structure, then a wk_data field must be added\n * and the macros below changed to use it.\n */\nstruct worklist {\n\tLIST_ENTRY(worklist)\twk_list;\t/* list of work requests */\n\tstruct mount\t\t*wk_mp;\t\t/* Mount we live in */\n\tunsigned int\t\twk_type:8,\t/* type of request */\n\t\t\t\twk_state:24;\t/* state flags */\n};\n#define WK_DATA(wk) ((void *)(wk))\n#define WK_PAGEDEP(wk) ((struct pagedep *)(wk))\n#define WK_INODEDEP(wk) ((struct inodedep *)(wk))\n#define WK_BMSAFEMAP(wk) ((struct bmsafemap *)(wk))\n#define\tWK_NEWBLK(wk)  ((struct newblk *)(wk))\n#define WK_ALLOCDIRECT(wk) ((struct allocdirect *)(wk))\n#define WK_INDIRDEP(wk) ((struct indirdep *)(wk))\n#define WK_ALLOCINDIR(wk) ((struct allocindir *)(wk))\n#define WK_FREEFRAG(wk) ((struct freefrag *)(wk))\n#define WK_FREEBLKS(wk) ((struct freeblks *)(wk))\n#define WK_FREEWORK(wk) ((struct freework *)(wk))\n#define WK_FREEFILE(wk) ((struct freefile *)(wk))\n#define WK_DIRADD(wk) ((struct diradd *)(wk))\n#define WK_MKDIR(wk) ((struct mkdir *)(wk))\n#define WK_DIRREM(wk) ((struct dirrem *)(wk))\n#define WK_NEWDIRBLK(wk) ((struct newdirblk *)(wk))\n#define\tWK_JADDREF(wk) ((struct jaddref *)(wk))\n#define\tWK_JREMREF(wk) ((struct jremref *)(wk))\n#define\tWK_JMVREF(wk) ((struct jmvref *)(wk))\n#define\tWK_JSEGDEP(wk) ((struct jsegdep *)(wk))\n#define\tWK_JSEG(wk) ((struct jseg *)(wk))\n#define\tWK_JNEWBLK(wk) ((struct jnewblk *)(wk))\n#define\tWK_JFREEBLK(wk) ((struct jfreeblk *)(wk))\n#define\tWK_FREEDEP(wk) ((struct freedep *)(wk))\n#define\tWK_JFREEFRAG(wk) ((struct jfreefrag *)(wk))\n#define\tWK_SBDEP(wk) ((struct sbdep *)(wk))\n#define\tWK_JTRUNC(wk) ((struct jtrunc *)(wk))\n#define\tWK_JFSYNC(wk) ((struct jfsync *)(wk))\n\n/*\n * Various types of lists\n */\nLIST_HEAD(dirremhd, dirrem);\nLIST_HEAD(diraddhd, diradd);\nLIST_HEAD(newblkhd, newblk);\nLIST_HEAD(inodedephd, inodedep);\nLIST_HEAD(allocindirhd, allocindir);\nLIST_HEAD(allocdirecthd, allocdirect);\nTAILQ_HEAD(allocdirectlst, allocdirect);\nLIST_HEAD(indirdephd, indirdep);\nLIST_HEAD(jaddrefhd, jaddref);\nLIST_HEAD(jremrefhd, jremref);\nLIST_HEAD(jmvrefhd, jmvref);\nLIST_HEAD(jnewblkhd, jnewblk);\nLIST_HEAD(jblkdephd, jblkdep);\nLIST_HEAD(freeworkhd, freework);\nTAILQ_HEAD(freeworklst, freework);\nTAILQ_HEAD(jseglst, jseg);\nTAILQ_HEAD(inoreflst, inoref);\nTAILQ_HEAD(freeblklst, freeblks);\n\n/*\n * The \"pagedep\" structure tracks the various dependencies related to\n * a particular directory page. If a directory page has any dependencies,\n * it will have a pagedep linked to its associated buffer. The\n * pd_dirremhd list holds the list of dirrem requests which decrement\n * inode reference counts. These requests are processed after the\n * directory page with the corresponding zero'ed entries has been\n * written. The pd_diraddhd list maintains the list of diradd requests\n * which cannot be committed until their corresponding inode has been\n * written to disk. Because a directory may have many new entries\n * being created, several lists are maintained hashed on bits of the\n * offset of the entry into the directory page to keep the lists from\n * getting too long. Once a new directory entry has been cleared to\n * be written, it is moved to the pd_pendinghd list. After the new\n * entry has been written to disk it is removed from the pd_pendinghd\n * list, any removed operations are done, and the dependency structure\n * is freed.\n */\n#define DAHASHSZ 5\n#define DIRADDHASH(offset) (((offset) >> 2) % DAHASHSZ)\nstruct pagedep {\n\tstruct\tworklist pd_list;\t/* page buffer */\n#\tdefine\tpd_state pd_list.wk_state /* check for multiple I/O starts */\n\tLIST_ENTRY(pagedep) pd_hash;\t/* hashed lookup */\n\tino_t\tpd_ino;\t\t\t/* associated file */\n\tufs_lbn_t pd_lbn;\t\t/* block within file */\n\tstruct\tnewdirblk *pd_newdirblk; /* associated newdirblk if NEWBLOCK */\n\tstruct\tdirremhd pd_dirremhd;\t/* dirrem's waiting for page */\n\tstruct\tdiraddhd pd_diraddhd[DAHASHSZ]; /* diradd dir entry updates */\n\tstruct\tdiraddhd pd_pendinghd;\t/* directory entries awaiting write */\n\tstruct\tjmvrefhd pd_jmvrefhd;\t/* Dependent journal writes. */\n};\n\n/*\n * The \"inodedep\" structure tracks the set of dependencies associated\n * with an inode. One task that it must manage is delayed operations\n * (i.e., work requests that must be held until the inodedep's associated\n * inode has been written to disk). Getting an inode from its incore \n * state to the disk requires two steps to be taken by the filesystem\n * in this order: first the inode must be copied to its disk buffer by\n * the VOP_UPDATE operation; second the inode's buffer must be written\n * to disk. To ensure that both operations have happened in the required\n * order, the inodedep maintains two lists. Delayed operations are\n * placed on the id_inowait list. When the VOP_UPDATE is done, all\n * operations on the id_inowait list are moved to the id_bufwait list.\n * When the buffer is written, the items on the id_bufwait list can be\n * safely moved to the work queue to be processed. A second task of the\n * inodedep structure is to track the status of block allocation within\n * the inode.  Each block that is allocated is represented by an\n * \"allocdirect\" structure (see below). It is linked onto the id_newinoupdt\n * list until both its contents and its allocation in the cylinder\n * group map have been written to disk. Once these dependencies have been\n * satisfied, it is removed from the id_newinoupdt list and any followup\n * actions such as releasing the previous block or fragment are placed\n * on the id_inowait list. When an inode is updated (a VOP_UPDATE is\n * done), the \"inodedep\" structure is linked onto the buffer through\n * its worklist. Thus, it will be notified when the buffer is about\n * to be written and when it is done. At the update time, all the\n * elements on the id_newinoupdt list are moved to the id_inoupdt list\n * since those changes are now relevant to the copy of the inode in the\n * buffer. Also at update time, the tasks on the id_inowait list are\n * moved to the id_bufwait list so that they will be executed when\n * the updated inode has been written to disk. When the buffer containing\n * the inode is written to disk, any updates listed on the id_inoupdt\n * list are rolled back as they are not yet safe. Following the write,\n * the changes are once again rolled forward and any actions on the\n * id_bufwait list are processed (since those actions are now safe).\n * The entries on the id_inoupdt and id_newinoupdt lists must be kept\n * sorted by logical block number to speed the calculation of the size\n * of the rolled back inode (see explanation in initiate_write_inodeblock).\n * When a directory entry is created, it is represented by a diradd.\n * The diradd is added to the id_inowait list as it cannot be safely\n * written to disk until the inode that it represents is on disk. After\n * the inode is written, the id_bufwait list is processed and the diradd\n * entries are moved to the id_pendinghd list where they remain until\n * the directory block containing the name has been written to disk.\n * The purpose of keeping the entries on the id_pendinghd list is so that\n * the softdep_fsync function can find and push the inode's directory\n * name(s) as part of the fsync operation for that file.\n */\nstruct inodedep {\n\tstruct\tworklist id_list;\t/* buffer holding inode block */\n#\tdefine\tid_state id_list.wk_state /* inode dependency state */\n\tLIST_ENTRY(inodedep) id_hash;\t/* hashed lookup */\n\tTAILQ_ENTRY(inodedep) id_unlinked;\t/* Unlinked but ref'd inodes */\n\tstruct\tfs *id_fs;\t\t/* associated filesystem */\n\tino_t\tid_ino;\t\t\t/* dependent inode */\n\tnlink_t\tid_nlinkdelta;\t\t/* saved effective link count */\n\tnlink_t\tid_savednlink;\t\t/* Link saved during rollback */\n\tLIST_ENTRY(inodedep) id_deps;\t/* bmsafemap's list of inodedep's */\n\tstruct\tbmsafemap *id_bmsafemap; /* related bmsafemap (if pending) */\n\tstruct\tdiradd *id_mkdiradd;\t/* diradd for a mkdir. */\n\tstruct\tinoreflst id_inoreflst;\t/* Inode reference adjustments. */\n\tlong\tid_savedextsize;\t/* ext size saved during rollback */\n\toff_t\tid_savedsize;\t\t/* file size saved during rollback */\n\tstruct\tdirremhd id_dirremhd;\t/* Removals pending. */\n\tstruct\tworkhead id_pendinghd;\t/* entries awaiting directory write */\n\tstruct\tworkhead id_bufwait;\t/* operations after inode written */\n\tstruct\tworkhead id_inowait;\t/* operations waiting inode update */\n\tstruct\tallocdirectlst id_inoupdt; /* updates before inode written */\n\tstruct\tallocdirectlst id_newinoupdt; /* updates when inode written */\n\tstruct\tallocdirectlst id_extupdt; /* extdata updates pre-inode write */\n\tstruct\tallocdirectlst id_newextupdt; /* extdata updates at ino write */\n\tstruct\tfreeblklst id_freeblklst; /* List of partial truncates. */\n\tunion {\n\tstruct\tufs1_dinode *idu_savedino1; /* saved ufs1_dinode contents */\n\tstruct\tufs2_dinode *idu_savedino2; /* saved ufs2_dinode contents */\n\t} id_un;\n};\n#define id_savedino1 id_un.idu_savedino1\n#define id_savedino2 id_un.idu_savedino2\n\n/*\n * A \"bmsafemap\" structure maintains a list of dependency structures\n * that depend on the update of a particular cylinder group map.\n * It has lists for newblks, allocdirects, allocindirs, and inodedeps.\n * It is attached to the buffer of a cylinder group block when any of\n * these things are allocated from the cylinder group. It is freed\n * after the cylinder group map is written and the state of its\n * dependencies are updated with DEPCOMPLETE to indicate that it has\n * been processed.\n */\nstruct bmsafemap {\n\tstruct\tworklist sm_list;\t/* cylgrp buffer */\n#\tdefine\tsm_state sm_list.wk_state\n\tLIST_ENTRY(bmsafemap) sm_hash;\t/* Hash links. */\n\tLIST_ENTRY(bmsafemap) sm_next;\t/* Mount list. */\n\tint\tsm_cg;\n\tstruct\tbuf *sm_buf;\t\t/* associated buffer */\n\tstruct\tallocdirecthd sm_allocdirecthd; /* allocdirect deps */\n\tstruct\tallocdirecthd sm_allocdirectwr; /* writing allocdirect deps */\n\tstruct\tallocindirhd sm_allocindirhd; /* allocindir deps */\n\tstruct\tallocindirhd sm_allocindirwr; /* writing allocindir deps */\n\tstruct\tinodedephd sm_inodedephd; /* inodedep deps */\n\tstruct\tinodedephd sm_inodedepwr; /* writing inodedep deps */\n\tstruct\tnewblkhd sm_newblkhd;\t/* newblk deps */\n\tstruct\tnewblkhd sm_newblkwr;\t/* writing newblk deps */\n\tstruct\tjaddrefhd sm_jaddrefhd;\t/* Pending inode allocations. */\n\tstruct\tjnewblkhd sm_jnewblkhd;\t/* Pending block allocations. */\n\tstruct\tworkhead sm_freehd;\t/* Freedep deps. */\n\tstruct\tworkhead sm_freewr;\t/* Written freedeps. */\n};\n\n/*\n * A \"newblk\" structure is attached to a bmsafemap structure when a block\n * or fragment is allocated from a cylinder group. Its state is set to\n * DEPCOMPLETE when its cylinder group map is written. It is converted to\n * an allocdirect or allocindir allocation once the allocator calls the\n * appropriate setup function. It will initially be linked onto a bmsafemap\n * list. Once converted it can be linked onto the lists described for\n * allocdirect or allocindir as described below.\n */ \nstruct newblk {\n\tstruct\tworklist nb_list;\t/* See comment above. */\n#\tdefine\tnb_state nb_list.wk_state\n\tLIST_ENTRY(newblk) nb_hash;\t/* Hashed lookup. */\n\tLIST_ENTRY(newblk) nb_deps;\t/* Bmsafemap's list of newblks. */\n\tstruct\tjnewblk *nb_jnewblk;\t/* New block journal entry. */\n\tstruct\tbmsafemap *nb_bmsafemap;/* Cylgrp dep (if pending). */\n\tstruct\tfreefrag *nb_freefrag;\t/* Fragment to be freed (if any). */\n\tstruct\tindirdephd nb_indirdeps; /* Children indirect blocks. */\n\tstruct\tworkhead nb_newdirblk;\t/* Dir block to notify when written. */\n\tstruct\tworkhead nb_jwork;\t/* Journal work pending. */\n\tufs2_daddr_t\tnb_newblkno;\t/* New value of block pointer. */\n};\n\n/*\n * An \"allocdirect\" structure is attached to an \"inodedep\" when a new block\n * or fragment is allocated and pointed to by the inode described by\n * \"inodedep\". The worklist is linked to the buffer that holds the block.\n * When the block is first allocated, it is linked to the bmsafemap\n * structure associated with the buffer holding the cylinder group map\n * from which it was allocated. When the cylinder group map is written\n * to disk, ad_state has the DEPCOMPLETE flag set. When the block itself\n * is written, the COMPLETE flag is set. Once both the cylinder group map\n * and the data itself have been written, it is safe to write the inode\n * that claims the block. If there was a previous fragment that had been\n * allocated before the file was increased in size, the old fragment may\n * be freed once the inode claiming the new block is written to disk.\n * This ad_fragfree request is attached to the id_inowait list of the\n * associated inodedep (pointed to by ad_inodedep) for processing after\n * the inode is written. When a block is allocated to a directory, an\n * fsync of a file whose name is within that block must ensure not only\n * that the block containing the file name has been written, but also\n * that the on-disk inode references that block. When a new directory\n * block is created, we allocate a newdirblk structure which is linked\n * to the associated allocdirect (on its ad_newdirblk list). When the\n * allocdirect has been satisfied, the newdirblk structure is moved to\n * the inodedep id_bufwait list of its directory to await the inode\n * being written. When the inode is written, the directory entries are\n * fully committed and can be deleted from their pagedep->id_pendinghd\n * and inodedep->id_pendinghd lists.\n */\nstruct allocdirect {\n\tstruct\tnewblk ad_block;\t/* Common block logic */\n#\tdefine\tad_state ad_block.nb_list.wk_state /* block pointer state */\n\tTAILQ_ENTRY(allocdirect) ad_next; /* inodedep's list of allocdirect's */\n\tstruct\tinodedep *ad_inodedep;\t/* associated inodedep */\n\tufs2_daddr_t\tad_oldblkno;\t/* old value of block pointer */\n\tint\t\tad_offset;\t/* Pointer offset in parent. */\n\tlong\t\tad_newsize;\t/* size of new block */\n\tlong\t\tad_oldsize;\t/* size of old block */\n};\n#define\tad_newblkno\tad_block.nb_newblkno\n#define\tad_freefrag\tad_block.nb_freefrag\n#define\tad_newdirblk\tad_block.nb_newdirblk\n\n/*\n * A single \"indirdep\" structure manages all allocation dependencies for\n * pointers in an indirect block. The up-to-date state of the indirect\n * block is stored in ir_savedata. The set of pointers that may be safely\n * written to the disk is stored in ir_safecopy. The state field is used\n * only to track whether the buffer is currently being written (in which\n * case it is not safe to update ir_safecopy). Ir_deplisthd contains the\n * list of allocindir structures, one for each block that needs to be\n * written to disk. Once the block and its bitmap allocation have been\n * written the safecopy can be updated to reflect the allocation and the\n * allocindir structure freed. If ir_state indicates that an I/O on the\n * indirect block is in progress when ir_safecopy is to be updated, the\n * update is deferred by placing the allocindir on the ir_donehd list.\n * When the I/O on the indirect block completes, the entries on the\n * ir_donehd list are processed by updating their corresponding ir_safecopy\n * pointers and then freeing the allocindir structure.\n */\nstruct indirdep {\n\tstruct\tworklist ir_list;\t/* buffer holding indirect block */\n#\tdefine\tir_state ir_list.wk_state /* indirect block pointer state */\n\tLIST_ENTRY(indirdep) ir_next;\t/* alloc{direct,indir} list */\n\tTAILQ_HEAD(, freework) ir_trunc;\t/* List of truncations. */\n\tcaddr_t\tir_saveddata;\t\t/* buffer cache contents */\n\tstruct\tbuf *ir_savebp;\t\t/* buffer holding safe copy */\n\tstruct\tbuf *ir_bp;\t\t/* buffer holding live copy */\n\tstruct\tallocindirhd ir_completehd; /* waiting for indirdep complete */\n\tstruct\tallocindirhd ir_writehd; /* Waiting for the pointer write. */\n\tstruct\tallocindirhd ir_donehd;\t/* done waiting to update safecopy */\n\tstruct\tallocindirhd ir_deplisthd; /* allocindir deps for this block */\n\tstruct\tfreeblks *ir_freeblks;\t/* Freeblks that frees this indir. */\n};\n\n/*\n * An \"allocindir\" structure is attached to an \"indirdep\" when a new block\n * is allocated and pointed to by the indirect block described by the\n * \"indirdep\". The worklist is linked to the buffer that holds the new block.\n * When the block is first allocated, it is linked to the bmsafemap\n * structure associated with the buffer holding the cylinder group map\n * from which it was allocated. When the cylinder group map is written\n * to disk, ai_state has the DEPCOMPLETE flag set. When the block itself\n * is written, the COMPLETE flag is set. Once both the cylinder group map\n * and the data itself have been written, it is safe to write the entry in\n * the indirect block that claims the block; the \"allocindir\" dependency \n * can then be freed as it is no longer applicable.\n */\nstruct allocindir {\n\tstruct\tnewblk ai_block;\t/* Common block area */\n#\tdefine\tai_state ai_block.nb_list.wk_state /* indirect pointer state */\n\tLIST_ENTRY(allocindir) ai_next;\t/* indirdep's list of allocindir's */\n\tstruct\tindirdep *ai_indirdep;\t/* address of associated indirdep */\n\tufs2_daddr_t\tai_oldblkno;\t/* old value of block pointer */\n\tufs_lbn_t\tai_lbn;\t\t/* Logical block number. */\n\tint\t\tai_offset;\t/* Pointer offset in parent. */\n};\n#define\tai_newblkno\tai_block.nb_newblkno\n#define\tai_freefrag\tai_block.nb_freefrag\n#define\tai_newdirblk\tai_block.nb_newdirblk\n\n/*\n * The allblk union is used to size the newblk structure on allocation so\n * that it may be any one of three types.\n */\nunion allblk {\n\tstruct\tallocindir ab_allocindir;\n\tstruct\tallocdirect ab_allocdirect;\n\tstruct\tnewblk\tab_newblk;\n};\n\n/*\n * A \"freefrag\" structure is attached to an \"inodedep\" when a previously\n * allocated fragment is replaced with a larger fragment, rather than extended.\n * The \"freefrag\" structure is constructed and attached when the replacement\n * block is first allocated. It is processed after the inode claiming the\n * bigger block that replaces it has been written to disk.\n */\nstruct freefrag {\n\tstruct\tworklist ff_list;\t/* id_inowait or delayed worklist */\n#\tdefine\tff_state ff_list.wk_state\n\tstruct\tworklist *ff_jdep;\t/* Associated journal entry. */\n\tstruct\tworkhead ff_jwork;\t/* Journal work pending. */\n\tufs2_daddr_t ff_blkno;\t\t/* fragment physical block number */\n\tlong\tff_fragsize;\t\t/* size of fragment being deleted */\n\tino_t\tff_inum;\t\t/* owning inode number */\n\tenum\tvtype ff_vtype;\t\t/* owning inode's file type */\n};\n\n/*\n * A \"freeblks\" structure is attached to an \"inodedep\" when the\n * corresponding file's length is reduced to zero. It records all\n * the information needed to free the blocks of a file after its\n * zero'ed inode has been written to disk.  The actual work is done\n * by child freework structures which are responsible for individual\n * inode pointers while freeblks is responsible for retiring the\n * entire operation when it is complete and holding common members.\n */\nstruct freeblks {\n\tstruct\tworklist fb_list;\t/* id_inowait or delayed worklist */\n#\tdefine\tfb_state fb_list.wk_state /* inode and dirty block state */\n\tTAILQ_ENTRY(freeblks) fb_next;\t/* List of inode truncates. */\n\tstruct\tjblkdephd fb_jblkdephd;\t/* Journal entries pending */\n\tstruct\tworkhead fb_freeworkhd;\t/* Work items pending */\n\tstruct\tworkhead fb_jwork;\t/* Journal work pending */\n\tstruct\tvnode *fb_devvp;\t/* filesystem device vnode */\n#ifdef QUOTA\n\tstruct\tdquot *fb_quota[MAXQUOTAS]; /* quotas to be adjusted */\n#endif\n\tuint64_t fb_modrev;\t\t/* Inode revision at start of trunc. */\n\toff_t\tfb_len;\t\t\t/* Length we're truncating to. */\n\tufs2_daddr_t fb_chkcnt;\t\t/* Blocks released. */\n\tino_t\tfb_inum;\t\t/* inode owner of blocks */\n\tenum\tvtype fb_vtype;\t\t/* inode owner's file type */\n\tuid_t\tfb_uid;\t\t\t/* uid of previous owner of blocks */\n\tint\tfb_ref;\t\t\t/* Children outstanding. */\n\tint\tfb_cgwait;\t\t/* cg writes outstanding. */\n};\n\n/*\n * A \"freework\" structure handles the release of a tree of blocks or a single\n * block.  Each indirect block in a tree is allocated its own freework\n * structure so that the indirect block may be freed only when all of its\n * children are freed.  In this way we enforce the rule that an allocated\n * block must have a valid path to a root that is journaled.  Each child\n * block acquires a reference and when the ref hits zero the parent ref\n * is decremented.  If there is no parent the freeblks ref is decremented.\n */\nstruct freework {\n\tstruct\tworklist fw_list;\t\t/* Delayed worklist. */\n#\tdefine\tfw_state fw_list.wk_state\n\tLIST_ENTRY(freework) fw_segs;\t\t/* Seg list. */\n\tTAILQ_ENTRY(freework) fw_next;\t\t/* Hash/Trunc list. */\n\tstruct\tjnewblk\t *fw_jnewblk;\t\t/* Journal entry to cancel. */\n\tstruct\tfreeblks *fw_freeblks;\t\t/* Root of operation. */\n\tstruct\tfreework *fw_parent;\t\t/* Parent indirect. */\n\tstruct\tindirdep *fw_indir;\t\t/* indirect block. */\n\tufs2_daddr_t\t fw_blkno;\t\t/* Our block #. */\n\tufs_lbn_t\t fw_lbn;\t\t/* Original lbn before free. */\n\tuint16_t\t fw_frags;\t\t/* Number of frags. */\n\tuint16_t\t fw_ref;\t\t/* Number of children out. */\n\tuint16_t\t fw_off;\t\t/* Current working position. */\n\tuint16_t\t fw_start;\t\t/* Start of partial truncate. */\n};\n\n/*\n * A \"freedep\" structure is allocated to track the completion of a bitmap\n * write for a freework.  One freedep may cover many freed blocks so long\n * as they reside in the same cylinder group.  When the cg is written\n * the freedep decrements the ref on the freework which may permit it\n * to be freed as well.\n */\nstruct freedep {\n\tstruct\tworklist fd_list;\t/* Delayed worklist. */\n\tstruct\tfreework *fd_freework;\t/* Parent freework. */\n};\n\n/*\n * A \"freefile\" structure is attached to an inode when its\n * link count is reduced to zero. It marks the inode as free in\n * the cylinder group map after the zero'ed inode has been written\n * to disk and any associated blocks and fragments have been freed.\n */\nstruct freefile {\n\tstruct\tworklist fx_list;\t/* id_inowait or delayed worklist */\n\tmode_t\tfx_mode;\t\t/* mode of inode */\n\tino_t\tfx_oldinum;\t\t/* inum of the unlinked file */\n\tstruct\tvnode *fx_devvp;\t/* filesystem device vnode */\n\tstruct\tworkhead fx_jwork;\t/* journal work pending. */\n};\n\n/*\n * A \"diradd\" structure is linked to an \"inodedep\" id_inowait list when a\n * new directory entry is allocated that references the inode described\n * by \"inodedep\". When the inode itself is written (either the initial\n * allocation for new inodes or with the increased link count for\n * existing inodes), the COMPLETE flag is set in da_state. If the entry\n * is for a newly allocated inode, the \"inodedep\" structure is associated\n * with a bmsafemap which prevents the inode from being written to disk\n * until the cylinder group has been updated. Thus the da_state COMPLETE\n * flag cannot be set until the inode bitmap dependency has been removed.\n * When creating a new file, it is safe to write the directory entry that\n * claims the inode once the referenced inode has been written. Since\n * writing the inode clears the bitmap dependencies, the DEPCOMPLETE flag\n * in the diradd can be set unconditionally when creating a file. When\n * creating a directory, there are two additional dependencies described by\n * mkdir structures (see their description below). When these dependencies\n * are resolved the DEPCOMPLETE flag is set in the diradd structure.\n * If there are multiple links created to the same inode, there will be\n * a separate diradd structure created for each link. The diradd is\n * linked onto the pg_diraddhd list of the pagedep for the directory\n * page that contains the entry. When a directory page is written,\n * the pg_diraddhd list is traversed to rollback any entries that are\n * not yet ready to be written to disk. If a directory entry is being\n * changed (by rename) rather than added, the DIRCHG flag is set and\n * the da_previous entry points to the entry that will be \"removed\"\n * once the new entry has been committed. During rollback, entries\n * with da_previous are replaced with the previous inode number rather\n * than zero.\n *\n * The overlaying of da_pagedep and da_previous is done to keep the\n * structure down. If a da_previous entry is present, the pointer to its\n * pagedep is available in the associated dirrem entry. If the DIRCHG flag\n * is set, the da_previous entry is valid; if not set the da_pagedep entry\n * is valid. The DIRCHG flag never changes; it is set when the structure\n * is created if appropriate and is never cleared.\n */\nstruct diradd {\n\tstruct\tworklist da_list;\t/* id_inowait or id_pendinghd list */\n#\tdefine\tda_state da_list.wk_state /* state of the new directory entry */\n\tLIST_ENTRY(diradd) da_pdlist;\t/* pagedep holding directory block */\n\tdoff_t\tda_offset;\t\t/* offset of new dir entry in dir blk */\n\tino_t\tda_newinum;\t\t/* inode number for the new dir entry */\n\tunion {\n\tstruct\tdirrem *dau_previous;\t/* entry being replaced in dir change */\n\tstruct\tpagedep *dau_pagedep;\t/* pagedep dependency for addition */\n\t} da_un;\n\tstruct workhead da_jwork;\t/* Journal work awaiting completion. */\n};\n#define da_previous da_un.dau_previous\n#define da_pagedep da_un.dau_pagedep\n\n/*\n * Two \"mkdir\" structures are needed to track the additional dependencies\n * associated with creating a new directory entry. Normally a directory\n * addition can be committed as soon as the newly referenced inode has been\n * written to disk with its increased link count. When a directory is\n * created there are two additional dependencies: writing the directory\n * data block containing the \".\" and \"..\" entries (MKDIR_BODY) and writing\n * the parent inode with the increased link count for \"..\" (MKDIR_PARENT).\n * These additional dependencies are tracked by two mkdir structures that\n * reference the associated \"diradd\" structure. When they have completed,\n * they set the DEPCOMPLETE flag on the diradd so that it knows that its\n * extra dependencies have been completed. The md_state field is used only\n * to identify which type of dependency the mkdir structure is tracking.\n * It is not used in the mainline code for any purpose other than consistency\n * checking. All the mkdir structures in the system are linked together on\n * a list. This list is needed so that a diradd can find its associated\n * mkdir structures and deallocate them if it is prematurely freed (as for\n * example if a mkdir is immediately followed by a rmdir of the same directory).\n * Here, the free of the diradd must traverse the list to find the associated\n * mkdir structures that reference it. The deletion would be faster if the\n * diradd structure were simply augmented to have two pointers that referenced\n * the associated mkdir's. However, this would increase the size of the diradd\n * structure to speed a very infrequent operation.\n */\nstruct mkdir {\n\tstruct\tworklist md_list;\t/* id_inowait or buffer holding dir */\n#\tdefine\tmd_state md_list.wk_state /* type: MKDIR_PARENT or MKDIR_BODY */\n\tstruct\tdiradd *md_diradd;\t/* associated diradd */\n\tstruct\tjaddref *md_jaddref;\t/* dependent jaddref. */\n\tstruct\tbuf *md_buf;\t\t/* MKDIR_BODY: buffer holding dir */\n\tLIST_ENTRY(mkdir) md_mkdirs;\t/* list of all mkdirs */\n};\n\n/*\n * A \"dirrem\" structure describes an operation to decrement the link\n * count on an inode. The dirrem structure is attached to the pg_dirremhd\n * list of the pagedep for the directory page that contains the entry.\n * It is processed after the directory page with the deleted entry has\n * been written to disk.\n */\nstruct dirrem {\n\tstruct\tworklist dm_list;\t/* delayed worklist */\n#\tdefine\tdm_state dm_list.wk_state /* state of the old directory entry */\n\tLIST_ENTRY(dirrem) dm_next;\t/* pagedep's list of dirrem's */\n\tLIST_ENTRY(dirrem) dm_inonext;\t/* inodedep's list of dirrem's */\n\tstruct\tjremrefhd dm_jremrefhd;\t/* Pending remove reference deps. */\n\tino_t\tdm_oldinum;\t\t/* inum of the removed dir entry */\n\tdoff_t\tdm_offset;\t\t/* offset of removed dir entry in blk */\n\tunion {\n\tstruct\tpagedep *dmu_pagedep;\t/* pagedep dependency for remove */\n\tino_t\tdmu_dirinum;\t\t/* parent inode number (for rmdir) */\n\t} dm_un;\n\tstruct workhead dm_jwork;\t/* Journal work awaiting completion. */\n};\n#define dm_pagedep dm_un.dmu_pagedep\n#define dm_dirinum dm_un.dmu_dirinum\n\n/*\n * A \"newdirblk\" structure tracks the progress of a newly allocated\n * directory block from its creation until it is claimed by its on-disk\n * inode. When a block is allocated to a directory, an fsync of a file\n * whose name is within that block must ensure not only that the block\n * containing the file name has been written, but also that the on-disk\n * inode references that block. When a new directory block is created,\n * we allocate a newdirblk structure which is linked to the associated\n * allocdirect (on its ad_newdirblk list). When the allocdirect has been\n * satisfied, the newdirblk structure is moved to the inodedep id_bufwait\n * list of its directory to await the inode being written. When the inode\n * is written, the directory entries are fully committed and can be\n * deleted from their pagedep->id_pendinghd and inodedep->id_pendinghd\n * lists. Note that we could track directory blocks allocated to indirect\n * blocks using a similar scheme with the allocindir structures. Rather\n * than adding this level of complexity, we simply write those newly \n * allocated indirect blocks synchronously as such allocations are rare.\n * In the case of a new directory the . and .. links are tracked with\n * a mkdir rather than a pagedep.  In this case we track the mkdir\n * so it can be released when it is written.  A workhead is used\n * to simplify canceling a mkdir that is removed by a subsequent dirrem.\n */\nstruct newdirblk {\n\tstruct\tworklist db_list;\t/* id_inowait or pg_newdirblk */\n#\tdefine\tdb_state db_list.wk_state\n\tstruct\tpagedep *db_pagedep;\t/* associated pagedep */\n\tstruct\tworkhead db_mkdir;\n};\n\n/*\n * The inoref structure holds the elements common to jaddref and jremref\n * so they may easily be queued in-order on the inodedep.\n */\nstruct inoref {\n\tstruct\tworklist if_list;\t/* Journal pending or jseg entries. */\n#\tdefine\tif_state if_list.wk_state\n\tTAILQ_ENTRY(inoref) if_deps;\t/* Links for inodedep. */\n\tstruct\tjsegdep\t*if_jsegdep;\t/* Will track our journal record. */\n\toff_t\t\tif_diroff;\t/* Directory offset. */\n\tino_t\t\tif_ino;\t\t/* Inode number. */\n\tino_t\t\tif_parent;\t/* Parent inode number. */\n\tnlink_t\t\tif_nlink;\t/* nlink before addition. */\n\tuint16_t\tif_mode;\t/* File mode, needed for IFMT. */\n};\n\n/*\n * A \"jaddref\" structure tracks a new reference (link count) on an inode\n * and prevents the link count increase and bitmap allocation until a\n * journal entry can be written.  Once the journal entry is written,\n * the inode is put on the pendinghd of the bmsafemap and a diradd or\n * mkdir entry is placed on the bufwait list of the inode.  The DEPCOMPLETE\n * flag is used to indicate that all of the required information for writing\n * the journal entry is present.  MKDIR_BODY and MKDIR_PARENT are used to\n * differentiate . and .. links from regular file names.  NEWBLOCK indicates\n * a bitmap is still pending.  If a new reference is canceled by a delete\n * prior to writing the journal the jaddref write is canceled and the\n * structure persists to prevent any disk-visible changes until it is\n * ultimately released when the file is freed or the link is dropped again.\n */\nstruct jaddref {\n\tstruct\tinoref\tja_ref;\t\t/* see inoref above. */\n#\tdefine\tja_list\tja_ref.if_list\t/* Jrnl pending, id_inowait, dm_jwork.*/\n#\tdefine\tja_state ja_ref.if_list.wk_state\n\tLIST_ENTRY(jaddref) ja_bmdeps;\t/* Links for bmsafemap. */\n\tunion {\n\t\tstruct\tdiradd\t*jau_diradd;\t/* Pending diradd. */\n\t\tstruct\tmkdir\t*jau_mkdir;\t/* MKDIR_{PARENT,BODY} */\n\t} ja_un;\n};\n#define\tja_diradd\tja_un.jau_diradd\n#define\tja_mkdir\tja_un.jau_mkdir\n#define\tja_diroff\tja_ref.if_diroff\n#define\tja_ino\t\tja_ref.if_ino\n#define\tja_parent\tja_ref.if_parent\n#define\tja_mode\t\tja_ref.if_mode\n\n/*\n * A \"jremref\" structure tracks a removed reference (unlink) on an\n * inode and prevents the directory remove from proceeding until the\n * journal entry is written.  Once the journal has been written the remove\n * may proceed as normal. \n */\nstruct jremref {\n\tstruct\tinoref\tjr_ref;\t\t/* see inoref above. */\n#\tdefine\tjr_list\tjr_ref.if_list\t/* Linked to softdep_journal_pending. */\n#\tdefine\tjr_state jr_ref.if_list.wk_state\n\tLIST_ENTRY(jremref) jr_deps;\t/* Links for dirrem. */\n\tstruct\tdirrem\t*jr_dirrem;\t/* Back pointer to dirrem. */\n};\n\n/*\n * A \"jmvref\" structure tracks a name relocations within the same\n * directory block that occur as a result of directory compaction.\n * It prevents the updated directory entry from being written to disk\n * until the journal entry is written. Once the journal has been\n * written the compacted directory may be written to disk.\n */\nstruct jmvref {\n\tstruct\tworklist jm_list;\t/* Linked to softdep_journal_pending. */\n\tLIST_ENTRY(jmvref) jm_deps;\t/* Jmvref on pagedep. */\n\tstruct pagedep\t*jm_pagedep;\t/* Back pointer to pagedep. */\n\tino_t\t\tjm_parent;\t/* Containing directory inode number. */\n\tino_t\t\tjm_ino;\t\t/* Inode number of our entry. */\n\toff_t\t\tjm_oldoff;\t/* Our old offset in directory. */\n\toff_t\t\tjm_newoff;\t/* Our new offset in directory. */\n};\n\n/*\n * A \"jnewblk\" structure tracks a newly allocated block or fragment and\n * prevents the direct or indirect block pointer as well as the cg bitmap\n * from being written until it is logged.  After it is logged the jsegdep\n * is attached to the allocdirect or allocindir until the operation is\n * completed or reverted.  If the operation is reverted prior to the journal\n * write the jnewblk structure is maintained to prevent the bitmaps from\n * reaching the disk.  Ultimately the jnewblk structure will be passed\n * to the free routine as the in memory cg is modified back to the free\n * state at which time it can be released. It may be held on any of the\n * fx_jwork, fw_jwork, fb_jwork, ff_jwork, nb_jwork, or ir_jwork lists.\n */\nstruct jnewblk {\n\tstruct\tworklist jn_list;\t/* See lists above. */\n#\tdefine\tjn_state jn_list.wk_state\n\tstruct\tjsegdep\t*jn_jsegdep;\t/* Will track our journal record. */\n\tLIST_ENTRY(jnewblk) jn_deps;\t/* Jnewblks on sm_jnewblkhd. */\n\tstruct\tworklist *jn_dep;\t/* Dependency to ref completed seg. */\n\tufs_lbn_t\tjn_lbn;\t\t/* Lbn to which allocated. */\n\tufs2_daddr_t\tjn_blkno;\t/* Blkno allocated */\n\tino_t\t\tjn_ino;\t\t/* Ino to which allocated. */\n\tint\t\tjn_oldfrags;\t/* Previous fragments when extended. */\n\tint\t\tjn_frags;\t/* Number of fragments. */\n};\n\n/*\n * A \"jblkdep\" structure tracks jfreeblk and jtrunc records attached to a\n * freeblks structure.\n */\nstruct jblkdep {\n\tstruct\tworklist jb_list;\t/* For softdep journal pending. */\n\tstruct\tjsegdep *jb_jsegdep;\t/* Reference to the jseg. */\n\tstruct\tfreeblks *jb_freeblks;\t/* Back pointer to freeblks. */\n\tLIST_ENTRY(jblkdep) jb_deps;\t/* Dep list on freeblks. */\n\n};\n\n/*\n * A \"jfreeblk\" structure tracks the journal write for freeing a block\n * or tree of blocks.  The block pointer must not be cleared in the inode\n * or indirect prior to the jfreeblk being written to the journal.\n */\nstruct jfreeblk {\n\tstruct\tjblkdep\tjf_dep;\t\t/* freeblks linkage. */\n\tufs_lbn_t\tjf_lbn;\t\t/* Lbn from which blocks freed. */\n\tufs2_daddr_t\tjf_blkno;\t/* Blkno being freed. */\n\tino_t\t\tjf_ino;\t\t/* Ino from which blocks freed. */\n\tint\t\tjf_frags;\t/* Number of frags being freed. */\n};\n\n/*\n * A \"jfreefrag\" tracks the freeing of a single block when a fragment is\n * extended or an indirect page is replaced.  It is not part of a larger\n * freeblks operation.\n */\nstruct jfreefrag {\n\tstruct\tworklist fr_list;\t/* Linked to softdep_journal_pending. */\n#\tdefine\tfr_state fr_list.wk_state\n\tstruct\tjsegdep\t*fr_jsegdep;\t/* Will track our journal record. */\n\tstruct freefrag\t*fr_freefrag;\t/* Back pointer to freefrag. */\n\tufs_lbn_t\tfr_lbn;\t\t/* Lbn from which frag freed. */\n\tufs2_daddr_t\tfr_blkno;\t/* Blkno being freed. */\n\tino_t\t\tfr_ino;\t\t/* Ino from which frag freed. */\n\tint\t\tfr_frags;\t/* Size of frag being freed. */\n};\n\n/*\n * A \"jtrunc\" journals the intent to truncate an inode's data or extent area.\n */\nstruct jtrunc {\n\tstruct\tjblkdep\tjt_dep;\t\t/* freeblks linkage. */\n\toff_t\t\tjt_size;\t/* Final file size. */\n\tint\t\tjt_extsize;\t/* Final extent size. */\n\tino_t\t\tjt_ino;\t\t/* Ino being truncated. */\n};\n\n/*\n * A \"jfsync\" journals the completion of an fsync which invalidates earlier\n * jtrunc records in the journal.\n */\nstruct jfsync {\n\tstruct worklist\tjfs_list;\t/* For softdep journal pending. */\n\toff_t\t\tjfs_size;\t/* Sync file size. */\n\tint\t\tjfs_extsize;\t/* Sync extent size. */\n\tino_t\t\tjfs_ino;\t/* ino being synced. */\n};\n\n/*\n * A \"jsegdep\" structure tracks a single reference to a written journal\n * segment so the journal space can be reclaimed when all dependencies\n * have been written. It can hang off of id_inowait, dm_jwork, da_jwork,\n * nb_jwork, ff_jwork, or fb_jwork lists.\n */\nstruct jsegdep {\n\tstruct\tworklist jd_list;\t/* See above for lists. */\n#\tdefine\tjd_state jd_list.wk_state\n\tstruct\tjseg\t*jd_seg;\t/* Our journal record. */\n};\n\n/*\n * A \"jseg\" structure contains all of the journal records written in a\n * single disk write.  The jaddref and jremref structures are linked into\n * js_entries so thay may be completed when the write completes.  The\n * js_entries also include the write dependency structures: jmvref,\n * jnewblk, jfreeblk, jfreefrag, and jtrunc.  The js_refs field counts\n * the number of entries on the js_entries list. Thus there is a single\n * jseg entry to describe each journal write.\n */\nstruct jseg {\n\tstruct\tworklist js_list;\t/* b_deps link for journal */\n#\tdefine\tjs_state js_list.wk_state\n\tstruct\tworkhead js_entries;\t/* Entries awaiting write */\n\tLIST_HEAD(, freework) js_indirs;/* List of indirects in this seg. */\n\tTAILQ_ENTRY(jseg) js_next;\t/* List of all unfinished segments. */\n\tstruct\tjblocks *js_jblocks;\t/* Back pointer to block/seg list */\n\tstruct\tbuf *js_buf;\t\t/* Buffer while unwritten */\n\tuint64_t js_seq;\t\t/* Journal record sequence number. */\n\tuint64_t js_oldseq;\t\t/* Oldest valid sequence number. */\n\tint\tjs_size;\t\t/* Size of journal record in bytes. */\n\tint\tjs_cnt;\t\t\t/* Total items allocated. */\n\tint\tjs_refs;\t\t/* Count of js_entries items. */\n};\n\n/*\n * A 'sbdep' structure tracks the head of the free inode list and\n * superblock writes.  This makes sure the superblock is always pointing at\n * the first possible unlinked inode for the suj recovery process.  If a\n * block write completes and we discover a new head is available the buf\n * is dirtied and the dep is kept. See the description of the UNLINK*\n * flags above for more details.\n */\nstruct sbdep {\n\tstruct\tworklist sb_list;\t/* b_dep linkage */\n\tstruct\tfs\t*sb_fs;\t\t/* Filesystem pointer within buf. */\n\tstruct\tufsmount *sb_ump;\t/* Our mount structure */\n};\n"
  },
  {
    "path": "freebsd-headers/ufs/ufs/acl.h",
    "content": "/*-\n * Copyright (c) 1999-2001 Robert N. M. Watson\n * All rights reserved.\n *\n * This software was developed by Robert Watson for the TrustedBSD Project.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/ufs/ufs/acl.h 200796 2009-12-21 19:39:10Z trasz $\n */\n/*\n * Developed by the TrustedBSD Project.\n * Support for POSIX.1e access control lists.\n */\n\n#ifndef _UFS_UFS_ACL_H_\n#define\t_UFS_UFS_ACL_H_\n\n#ifdef _KERNEL\n\nint\tufs_getacl_nfs4_internal(struct vnode *vp, struct acl *aclp, struct thread *td);\nint\tufs_setacl_nfs4_internal(struct vnode *vp, struct acl *aclp, struct thread *td);\nvoid\tufs_sync_acl_from_inode(struct inode *ip, struct acl *acl);\nvoid\tufs_sync_inode_from_acl(struct acl *acl, struct inode *ip);\n\nint\tufs_getacl(struct vop_getacl_args *);\nint\tufs_setacl(struct vop_setacl_args *);\nint\tufs_aclcheck(struct vop_aclcheck_args *);\n\n#endif /* !_KERNEL */\n\n#endif /* !_UFS_UFS_ACL_H_ */\n"
  },
  {
    "path": "freebsd-headers/ufs/ufs/dinode.h",
    "content": "/*-\n * Copyright (c) 2002 Networks Associates Technology, Inc.\n * All rights reserved.\n *\n * This software was developed for the FreeBSD Project by Marshall\n * Kirk McKusick and Network Associates Laboratories, the Security\n * Research Division of Network Associates, Inc. under DARPA/SPAWAR\n * contract N66001-01-C-8035 (\"CBOSS\"), as part of the DARPA CHATS\n * research program\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * Copyright (c) 1982, 1989, 1993\n *\tThe Regents of the University of California.  All rights reserved.\n * (c) UNIX System Laboratories, Inc.\n * All or some portions of this file are derived from material licensed\n * to the University of California by American Telephone and Telegraph\n * Co. or Unix System Laboratories, Inc. and are reproduced herein with\n * the permission of UNIX System Laboratories, Inc.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. The names of the authors may not be used to endorse or promote\n *    products derived from this software without specific prior written\n *    permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t@(#)dinode.h\t8.3 (Berkeley) 1/21/94\n * $FreeBSD: release/9.0.0/sys/ufs/ufs/dinode.h 207141 2010-04-24 07:05:35Z jeff $\n */\n\n#ifndef _UFS_UFS_DINODE_H_\n#define\t_UFS_UFS_DINODE_H_\n\n/*\n * The root inode is the root of the filesystem.  Inode 0 can't be used for\n * normal purposes and historically bad blocks were linked to inode 1, thus\n * the root inode is 2.  (Inode 1 is no longer used for this purpose, however\n * numerous dump tapes make this assumption, so we are stuck with it).\n */\n#define\tROOTINO\t((ino_t)2)\n\n/*\n * The Whiteout inode# is a dummy non-zero inode number which will\n * never be allocated to a real file.  It is used as a place holder\n * in the directory entry which has been tagged as a DT_WHT entry.\n * See the comments about ROOTINO above.\n */\n#define\tWINO\t((ino_t)1)\n\n/*\n * The size of physical and logical block numbers and time fields in UFS.\n */\ntypedef\tint32_t\tufs1_daddr_t;\ntypedef\tint64_t\tufs2_daddr_t;\ntypedef int64_t ufs_lbn_t;\ntypedef int64_t ufs_time_t;\n\n/* File permissions. */\n#define\tIEXEC\t\t0000100\t\t/* Executable. */\n#define\tIWRITE\t\t0000200\t\t/* Writeable. */\n#define\tIREAD\t\t0000400\t\t/* Readable. */\n#define\tISVTX\t\t0001000\t\t/* Sticky bit. */\n#define\tISGID\t\t0002000\t\t/* Set-gid. */\n#define\tISUID\t\t0004000\t\t/* Set-uid. */\n\n/* File types. */\n#define\tIFMT\t\t0170000\t\t/* Mask of file type. */\n#define\tIFIFO\t\t0010000\t\t/* Named pipe (fifo). */\n#define\tIFCHR\t\t0020000\t\t/* Character device. */\n#define\tIFDIR\t\t0040000\t\t/* Directory file. */\n#define\tIFBLK\t\t0060000\t\t/* Block device. */\n#define\tIFREG\t\t0100000\t\t/* Regular file. */\n#define\tIFLNK\t\t0120000\t\t/* Symbolic link. */\n#define\tIFSOCK\t\t0140000\t\t/* UNIX domain socket. */\n#define\tIFWHT\t\t0160000\t\t/* Whiteout. */\n\n/*\n * A dinode contains all the meta-data associated with a UFS2 file.\n * This structure defines the on-disk format of a dinode. Since\n * this structure describes an on-disk structure, all its fields\n * are defined by types with precise widths.\n */\n\n#define\tNXADDR\t2\t\t\t/* External addresses in inode. */\n#define\tNDADDR\t12\t\t\t/* Direct addresses in inode. */\n#define\tNIADDR\t3\t\t\t/* Indirect addresses in inode. */\n\nstruct ufs2_dinode {\n\tu_int16_t\tdi_mode;\t/*   0: IFMT, permissions; see below. */\n\tint16_t\t\tdi_nlink;\t/*   2: File link count. */\n\tu_int32_t\tdi_uid;\t\t/*   4: File owner. */\n\tu_int32_t\tdi_gid;\t\t/*   8: File group. */\n\tu_int32_t\tdi_blksize;\t/*  12: Inode blocksize. */\n\tu_int64_t\tdi_size;\t/*  16: File byte count. */\n\tu_int64_t\tdi_blocks;\t/*  24: Blocks actually held. */\n\tufs_time_t\tdi_atime;\t/*  32: Last access time. */\n\tufs_time_t\tdi_mtime;\t/*  40: Last modified time. */\n\tufs_time_t\tdi_ctime;\t/*  48: Last inode change time. */\n\tufs_time_t\tdi_birthtime;\t/*  56: Inode creation time. */\n\tint32_t\t\tdi_mtimensec;\t/*  64: Last modified time. */\n\tint32_t\t\tdi_atimensec;\t/*  68: Last access time. */\n\tint32_t\t\tdi_ctimensec;\t/*  72: Last inode change time. */\n\tint32_t\t\tdi_birthnsec;\t/*  76: Inode creation time. */\n\tint32_t\t\tdi_gen;\t\t/*  80: Generation number. */\n\tu_int32_t\tdi_kernflags;\t/*  84: Kernel flags. */\n\tu_int32_t\tdi_flags;\t/*  88: Status flags (chflags). */\n\tint32_t\t\tdi_extsize;\t/*  92: External attributes block. */\n\tufs2_daddr_t\tdi_extb[NXADDR];/*  96: External attributes block. */\n\tufs2_daddr_t\tdi_db[NDADDR];\t/* 112: Direct disk blocks. */\n\tufs2_daddr_t\tdi_ib[NIADDR];\t/* 208: Indirect disk blocks. */\n\tu_int64_t\tdi_modrev;\t/* 232: i_modrev for NFSv4 */\n\tino_t\t\tdi_freelink;\t/* 240: SUJ: Next unlinked inode. */\n\tuint32_t\tdi_spare[3];\t/* 244: Reserved; currently unused */\n};\n\n/*\n * The di_db fields may be overlaid with other information for\n * file types that do not have associated disk storage. Block\n * and character devices overlay the first data block with their\n * dev_t value. Short symbolic links place their path in the\n * di_db area.\n */\n#define\tdi_rdev di_db[0]\n\n/*\n * A UFS1 dinode contains all the meta-data associated with a UFS1 file.\n * This structure defines the on-disk format of a UFS1 dinode. Since\n * this structure describes an on-disk structure, all its fields\n * are defined by types with precise widths.\n */\nstruct ufs1_dinode {\n\tu_int16_t\tdi_mode;\t/*   0: IFMT, permissions; see below. */\n\tint16_t\t\tdi_nlink;\t/*   2: File link count. */\n\tino_t\t\tdi_freelink;\t/*   4: SUJ: Next unlinked inode. */\n\tu_int64_t\tdi_size;\t/*   8: File byte count. */\n\tint32_t\t\tdi_atime;\t/*  16: Last access time. */\n\tint32_t\t\tdi_atimensec;\t/*  20: Last access time. */\n\tint32_t\t\tdi_mtime;\t/*  24: Last modified time. */\n\tint32_t\t\tdi_mtimensec;\t/*  28: Last modified time. */\n\tint32_t\t\tdi_ctime;\t/*  32: Last inode change time. */\n\tint32_t\t\tdi_ctimensec;\t/*  36: Last inode change time. */\n\tufs1_daddr_t\tdi_db[NDADDR];\t/*  40: Direct disk blocks. */\n\tufs1_daddr_t\tdi_ib[NIADDR];\t/*  88: Indirect disk blocks. */\n\tu_int32_t\tdi_flags;\t/* 100: Status flags (chflags). */\n\tint32_t\t\tdi_blocks;\t/* 104: Blocks actually held. */\n\tint32_t\t\tdi_gen;\t\t/* 108: Generation number. */\n\tu_int32_t\tdi_uid;\t\t/* 112: File owner. */\n\tu_int32_t\tdi_gid;\t\t/* 116: File group. */\n\tu_int64_t\tdi_modrev;\t/* 120: i_modrev for NFSv4 */\n};\n\n#endif /* _UFS_UFS_DINODE_H_ */\n"
  },
  {
    "path": "freebsd-headers/ufs/ufs/dir.h",
    "content": "/*-\n * Copyright (c) 1982, 1986, 1989, 1993\n *\tThe Regents of the University of California.  All rights reserved.\n * (c) UNIX System Laboratories, Inc.\n * All or some portions of this file are derived from material licensed\n * to the University of California by American Telephone and Telegraph\n * Co. or Unix System Laboratories, Inc. and are reproduced herein with\n * the permission of UNIX System Laboratories, Inc.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 4. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t@(#)dir.h\t8.2 (Berkeley) 1/21/94\n * $FreeBSD: release/9.0.0/sys/ufs/ufs/dir.h 171147 2007-07-02 01:31:43Z peter $\n */\n\n#ifndef _UFS_UFS_DIR_H_\n#define\t_UFS_UFS_DIR_H_\n\n/*\n * Theoretically, directories can be more than 2Gb in length, however, in\n * practice this seems unlikely. So, we define the type doff_t as a 32-bit\n * quantity to keep down the cost of doing lookup on a 32-bit machine.\n */\n#define\tdoff_t\t\tint32_t\n#define MAXDIRSIZE\t(0x7fffffff)\n\n/*\n * A directory consists of some number of blocks of DIRBLKSIZ\n * bytes, where DIRBLKSIZ is chosen such that it can be transferred\n * to disk in a single atomic operation (e.g. 512 bytes on most machines).\n *\n * Each DIRBLKSIZ byte block contains some number of directory entry\n * structures, which are of variable length.  Each directory entry has\n * a struct direct at the front of it, containing its inode number,\n * the length of the entry, and the length of the name contained in\n * the entry.  These are followed by the name padded to a 4 byte boundary\n * with null bytes.  All names are guaranteed null terminated.\n * The maximum length of a name in a directory is MAXNAMLEN.\n *\n * The macro DIRSIZ(fmt, dp) gives the amount of space required to represent\n * a directory entry.  Free space in a directory is represented by\n * entries which have dp->d_reclen > DIRSIZ(fmt, dp).  All DIRBLKSIZ bytes\n * in a directory block are claimed by the directory entries.  This\n * usually results in the last entry in a directory having a large\n * dp->d_reclen.  When entries are deleted from a directory, the\n * space is returned to the previous entry in the same directory\n * block by increasing its dp->d_reclen.  If the first entry of\n * a directory block is free, then its dp->d_ino is set to 0.\n * Entries other than the first in a directory do not normally have\n * dp->d_ino set to 0.\n */\n#define DIRBLKSIZ\tDEV_BSIZE\n#define\tMAXNAMLEN\t255\n\nstruct\tdirect {\n\tu_int32_t d_ino;\t\t/* inode number of entry */\n\tu_int16_t d_reclen;\t\t/* length of this record */\n\tu_int8_t  d_type; \t\t/* file type, see below */\n\tu_int8_t  d_namlen;\t\t/* length of string in d_name */\n\tchar\t  d_name[MAXNAMLEN + 1];/* name with length <= MAXNAMLEN */\n};\n\n/*\n * File types\n */\n#define\tDT_UNKNOWN\t 0\n#define\tDT_FIFO\t\t 1\n#define\tDT_CHR\t\t 2\n#define\tDT_DIR\t\t 4\n#define\tDT_BLK\t\t 6\n#define\tDT_REG\t\t 8\n#define\tDT_LNK\t\t10\n#define\tDT_SOCK\t\t12\n#define\tDT_WHT\t\t14\n\n/*\n * Convert between stat structure types and directory types.\n */\n#define\tIFTODT(mode)\t(((mode) & 0170000) >> 12)\n#define\tDTTOIF(dirtype)\t((dirtype) << 12)\n\n/*\n * The DIRSIZ macro gives the minimum record length which will hold\n * the directory entry.  This requires the amount of space in struct direct\n * without the d_name field, plus enough space for the name with a terminating\n * null byte (dp->d_namlen+1), rounded up to a 4 byte boundary.\n *\n * \n */\n#define\tDIRECTSIZ(namlen)\t\t\t\t\t\t\\\n\t(((uintptr_t)&((struct direct *)0)->d_name +\t\t\t\\\n\t  ((namlen)+1)*sizeof(((struct direct *)0)->d_name[0]) + 3) & ~3)\n#if (BYTE_ORDER == LITTLE_ENDIAN)\n#define DIRSIZ(oldfmt, dp) \\\n    ((oldfmt) ? DIRECTSIZ((dp)->d_type) : DIRECTSIZ((dp)->d_namlen))\n#else\n#define DIRSIZ(oldfmt, dp) \\\n    DIRECTSIZ((dp)->d_namlen)\n#endif\n#define OLDDIRFMT\t1\n#define NEWDIRFMT\t0\n\n/*\n * Template for manipulating directories.  Should use struct direct's,\n * but the name field is MAXNAMLEN - 1, and this just won't do.\n */\nstruct dirtemplate {\n\tu_int32_t\tdot_ino;\n\tint16_t\t\tdot_reclen;\n\tu_int8_t\tdot_type;\n\tu_int8_t\tdot_namlen;\n\tchar\t\tdot_name[4];\t/* must be multiple of 4 */\n\tu_int32_t\tdotdot_ino;\n\tint16_t\t\tdotdot_reclen;\n\tu_int8_t\tdotdot_type;\n\tu_int8_t\tdotdot_namlen;\n\tchar\t\tdotdot_name[4];\t/* ditto */\n};\n\n/*\n * This is the old format of directories, sanz type element.\n */\nstruct odirtemplate {\n\tu_int32_t\tdot_ino;\n\tint16_t\t\tdot_reclen;\n\tu_int16_t\tdot_namlen;\n\tchar\t\tdot_name[4];\t/* must be multiple of 4 */\n\tu_int32_t\tdotdot_ino;\n\tint16_t\t\tdotdot_reclen;\n\tu_int16_t\tdotdot_namlen;\n\tchar\t\tdotdot_name[4];\t/* ditto */\n};\n#endif /* !_DIR_H_ */\n"
  },
  {
    "path": "freebsd-headers/ufs/ufs/dirhash.h",
    "content": "/*-\n * Copyright (c) 2001 Ian Dowse.  All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/ufs/ufs/dirhash.h 219384 2011-03-07 18:33:29Z jhb $\n */\n\n#ifndef _UFS_UFS_DIRHASH_H_\n#define _UFS_UFS_DIRHASH_H_\n\n#include <sys/_lock.h>\n#include <sys/_sx.h>\n\n/*\n * For fast operations on large directories, we maintain a hash\n * that maps the file name to the offset of the directory entry within\n * the directory file.\n *\n * The hashing uses a dumb spillover to the next free slot on\n * collisions, so we must keep the utilisation low to avoid\n * long linear searches. Deleted entries that are not the last\n * in a chain must be marked DIRHASH_DEL.\n *\n * We also maintain information about free space in each block\n * to speed up creations.\n */\n#define DIRHASH_EMPTY\t(-1)\t/* entry unused */\n#define DIRHASH_DEL\t(-2)\t/* deleted entry; may be part of chain */\n\n#define DIRALIGN\t4\n#define DH_NFSTATS\t(DIRECTSIZ(MAXNAMLEN + 1) / DIRALIGN)\n\t\t\t\t /* max DIRALIGN words in a directory entry */\n\n/*\n * Dirhash uses a score mechanism to achieve a hybrid between a\n * least-recently-used and a least-often-used algorithm for entry\n * recycling. The score is incremented when a directory is used, and\n * decremented when the directory is a candidate for recycling. When\n * the score reaches zero, the hash is recycled. Hashes are linked\n * together on a TAILQ list, and hashes with higher scores filter\n * towards the tail (most recently used) end of the list.\n *\n * New hash entries are given an inital score of DH_SCOREINIT and are\n * placed at the most-recently-used end of the list. This helps a lot\n * in the worst-case case scenario where every directory access is\n * to a directory that is not hashed (i.e. the working set of hash\n * candidates is much larger than the configured memry limit). In this\n * case it limits the number of hash builds to 1/DH_SCOREINIT of the\n * number of accesses.\n */ \n#define DH_SCOREINIT\t8\t/* initial dh_score when dirhash built */\n#define DH_SCOREMAX\t64\t/* max dh_score value */\n\n/*\n * The main hash table has 2 levels. It is an array of pointers to\n * blocks of DH_NBLKOFF offsets.\n */\n#define DH_BLKOFFSHIFT\t8\n#define DH_NBLKOFF\t(1 << DH_BLKOFFSHIFT)\n#define DH_BLKOFFMASK\t(DH_NBLKOFF - 1)\n\n#define DH_ENTRY(dh, slot) \\\n    ((dh)->dh_hash[(slot) >> DH_BLKOFFSHIFT][(slot) & DH_BLKOFFMASK])\n\nstruct dirhash {\n\tstruct sx dh_lock;\t/* protects all fields except list & score */\n\tint\tdh_refcount;\n\n\tdoff_t\t**dh_hash;\t/* the hash array (2-level) */\n\tint\tdh_narrays;\t/* number of entries in dh_hash */\n\tint\tdh_hlen;\t/* total slots in the 2-level hash array */\n\tint\tdh_hused;\t/* entries in use */\n\tint\tdh_memreq;\t/* Memory used. */\n\n\t/* Free space statistics. XXX assumes DIRBLKSIZ is 512. */\n\tu_int8_t *dh_blkfree;\t/* free DIRALIGN words in each dir block */\n\tint\tdh_nblk;\t/* size of dh_blkfree array */\n\tint\tdh_dirblks;\t/* number of DIRBLKSIZ blocks in dir */\n\tint\tdh_firstfree[DH_NFSTATS + 1]; /* first blk with N words free */\n\n\tdoff_t\tdh_seqoff;\t/* sequential access optimisation offset */\n\n\tint\tdh_score;\t/* access count for this dirhash */\n\n\tint\tdh_onlist;\t/* true if on the ufsdirhash_list chain */\n\n\ttime_t\tdh_lastused;\t/* time the dirhash was last read or written*/\n\n\t/* Protected by ufsdirhash_mtx. */\n\tTAILQ_ENTRY(dirhash) dh_list;\t/* chain of all dirhashes */\n};\n\n\n/*\n * Dirhash functions.\n */\nvoid\tufsdirhash_init(void);\nvoid\tufsdirhash_uninit(void);\nint\tufsdirhash_build(struct inode *);\ndoff_t\tufsdirhash_findfree(struct inode *, int, int *);\ndoff_t\tufsdirhash_enduseful(struct inode *);\nint\tufsdirhash_lookup(struct inode *, char *, int, doff_t *, struct buf **,\n\t    doff_t *);\nvoid\tufsdirhash_newblk(struct inode *, doff_t);\nvoid\tufsdirhash_add(struct inode *, struct direct *, doff_t);\nvoid\tufsdirhash_remove(struct inode *, struct direct *, doff_t);\nvoid\tufsdirhash_move(struct inode *, struct direct *, doff_t, doff_t);\nvoid\tufsdirhash_dirtrunc(struct inode *, doff_t);\nvoid\tufsdirhash_free(struct inode *);\n\nvoid\tufsdirhash_checkblock(struct inode *, char *, doff_t);\n\n#endif /* !_UFS_UFS_DIRHASH_H_ */\n"
  },
  {
    "path": "freebsd-headers/ufs/ufs/extattr.h",
    "content": "/*-\n * Copyright (c) 1999-2001 Robert N. M. Watson\n * All rights reserved.\n *\n * This software was developed by Robert Watson for the TrustedBSD Project.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/ufs/ufs/extattr.h 191990 2009-05-11 15:33:26Z attilio $\n */\n/*\n * Developed by the TrustedBSD Project.\n * Support for extended filesystem attributes.\n */\n\n#ifndef _UFS_UFS_EXTATTR_H_\n#define\t_UFS_UFS_EXTATTR_H_\n\n#define\tUFS_EXTATTR_MAGIC\t\t0x00b5d5ec\n#define\tUFS_EXTATTR_VERSION\t\t0x00000003\n#define\tUFS_EXTATTR_FSROOTSUBDIR\t\".attribute\"\n#define\tUFS_EXTATTR_SUBDIR_SYSTEM\t\"system\"\n#define\tUFS_EXTATTR_SUBDIR_USER\t\t\"user\"\n#define\tUFS_EXTATTR_MAXEXTATTRNAME\t65\t/* including null */\n\n#define\tUFS_EXTATTR_ATTR_FLAG_INUSE\t0x00000001\t/* attr has been set */\n#define\tUFS_EXTATTR_PERM_KERNEL\t\t0x00000000\n#define\tUFS_EXTATTR_PERM_ROOT\t\t0x00000001\n#define\tUFS_EXTATTR_PERM_OWNER\t\t0x00000002\n#define\tUFS_EXTATTR_PERM_ANYONE\t\t0x00000003\n\n#define\tUFS_EXTATTR_UEPM_INITIALIZED\t0x00000001\n#define\tUFS_EXTATTR_UEPM_STARTED\t0x00000002\n\n#define\tUFS_EXTATTR_CMD_START\t\t0x00000001\n#define\tUFS_EXTATTR_CMD_STOP\t\t0x00000002\n#define\tUFS_EXTATTR_CMD_ENABLE\t\t0x00000003\n#define\tUFS_EXTATTR_CMD_DISABLE\t\t0x00000004\n\nstruct ufs_extattr_fileheader {\n\tu_int\tuef_magic;\t/* magic number for sanity checking */\n\tu_int\tuef_version;\t/* version of attribute file */\n\tu_int\tuef_size;\t/* size of attributes, w/o header */\n};\n\nstruct ufs_extattr_header {\n\tu_int\tueh_flags;\t/* flags for attribute */\n\tu_int\tueh_len;\t/* local defined length; <= uef_size */\n\tu_int32_t\tueh_i_gen;\t/* generation number for sanity */\n\t/* data follows the header */\n};\n\n/*\n * This structure defines the required fields of an extended-attribute header.\n */\nstruct extattr {\n\tint32_t\tea_length;\t    /* length of this attribute */\n\tint8_t\tea_namespace;\t    /* name space of this attribute */\n\tint8_t\tea_contentpadlen;   /* bytes of padding at end of attribute */\n\tint8_t\tea_namelength;\t    /* length of attribute name */\n\tchar\tea_name[1];\t    /* null-terminated attribute name */\n\t/* extended attribute content follows */\n};\n\n/*\n * These macros are used to access and manipulate an extended attribute:\n *\n * EXTATTR_NEXT(eap) returns a pointer to the next extended attribute\n *\tfollowing eap.\n * EXTATTR_CONTENT(eap) returns a pointer to the extended attribute\n *\tcontent referenced by eap.\n * EXTATTR_CONTENT_SIZE(eap) returns the size of the extended attribute\n *\tcontent referenced by eap.\n * EXTATTR_SET_LENGTHS(eap, contentsize) called after initializing the\n *\tattribute name to calculate and set the ea_length, ea_namelength,\n *\tand ea_contentpadlen fields of the extended attribute structure.\n */\n#define EXTATTR_NEXT(eap) \\\n\t((struct extattr *)(((void *)(eap)) + (eap)->ea_length))\n#define EXTATTR_CONTENT(eap) (((void *)(eap)) + EXTATTR_BASE_LENGTH(eap))\n#define EXTATTR_CONTENT_SIZE(eap) \\\n\t((eap)->ea_length - EXTATTR_BASE_LENGTH(eap) - (eap)->ea_contentpadlen)\n#define EXTATTR_BASE_LENGTH(eap) \\\n\t((sizeof(struct extattr) + (eap)->ea_namelength + 7) & ~7)\n#define EXTATTR_SET_LENGTHS(eap, contentsize) do { \\\n\tKASSERT(((eap)->ea_name[0] != 0), \\\n\t\t(\"Must initialize name before setting lengths\")); \\\n\t(eap)->ea_namelength = strlen((eap)->ea_name); \\\n\t(eap)->ea_contentpadlen = ((contentsize) % 8) ? \\\n\t\t8 - ((contentsize) % 8) : 0; \\\n\t(eap)->ea_length = EXTATTR_BASE_LENGTH(eap) + \\\n\t\t(contentsize) + (eap)->ea_contentpadlen; \\\n} while (0)\n\n#ifdef _KERNEL\n\n#include <sys/_sx.h>\n\n#ifdef MALLOC_DECLARE\nMALLOC_DECLARE(M_EXTATTR);\n#endif\n\nstruct vnode;\nLIST_HEAD(ufs_extattr_list_head, ufs_extattr_list_entry);\nstruct ufs_extattr_list_entry {\n\tLIST_ENTRY(ufs_extattr_list_entry)\tuele_entries;\n\tstruct ufs_extattr_fileheader\t\tuele_fileheader;\n\tint\tuele_attrnamespace;\n\tchar\tuele_attrname[UFS_EXTATTR_MAXEXTATTRNAME];\n\tstruct vnode\t*uele_backing_vnode;\n};\n\nstruct ucred;\nstruct ufs_extattr_per_mount {\n\tstruct sx\tuepm_lock;\n\tstruct ufs_extattr_list_head\tuepm_list;\n\tstruct ucred\t*uepm_ucred;\n\tint\tuepm_flags;\n};\n\nvoid\tufs_extattr_uepm_init(struct ufs_extattr_per_mount *uepm);\nvoid\tufs_extattr_uepm_destroy(struct ufs_extattr_per_mount *uepm);\nint\tufs_extattr_start(struct mount *mp, struct thread *td);\nint\tufs_extattr_autostart(struct mount *mp, struct thread *td);\nint\tufs_extattr_stop(struct mount *mp, struct thread *td);\nint\tufs_extattrctl(struct mount *mp, int cmd, struct vnode *filename,\n\t    int attrnamespace, const char *attrname);\nint\tufs_getextattr(struct vop_getextattr_args *ap);\nint\tufs_deleteextattr(struct vop_deleteextattr_args *ap);\nint\tufs_setextattr(struct vop_setextattr_args *ap);\nvoid\tufs_extattr_vnode_inactive(struct vnode *vp, struct thread *td);\n\n#else\n\n/* User-level definition of KASSERT for macros above */\n#define KASSERT(cond, str) do { \\\n        if (!(cond)) { printf(\"panic: \"); printf(str); printf(\"\\n\"); exit(1); }\\\n} while (0)\n\n#endif /* !_KERNEL */\n\n#endif /* !_UFS_UFS_EXTATTR_H_ */\n"
  },
  {
    "path": "freebsd-headers/ufs/ufs/gjournal.h",
    "content": "/*-\n * Copyright (c) 2005-2006 Pawel Jakub Dawidek <pjd@FreeBSD.org>\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/ufs/ufs/gjournal.h 163841 2006-10-31 21:48:54Z pjd $\n */\n\n#ifndef _UFS_UFS_GJOURNAL_H_\n#define _UFS_UFS_GJOURNAL_H_\n\n/*\n * GEOM journal function prototypes.\n */\nvoid\tufs_gjournal_orphan(struct vnode *fvp);\nvoid\tufs_gjournal_close(struct vnode *vp);\n#endif /* !_UFS_UFS_GJOURNAL_H_ */\n"
  },
  {
    "path": "freebsd-headers/ufs/ufs/inode.h",
    "content": "/*-\n * Copyright (c) 1982, 1989, 1993\n *\tThe Regents of the University of California.  All rights reserved.\n * (c) UNIX System Laboratories, Inc.\n * All or some portions of this file are derived from material licensed\n * to the University of California by American Telephone and Telegraph\n * Co. or Unix System Laboratories, Inc. and are reproduced herein with\n * the permission of UNIX System Laboratories, Inc.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 4. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t@(#)inode.h\t8.9 (Berkeley) 5/14/95\n * $FreeBSD: release/9.0.0/sys/ufs/ufs/inode.h 224503 2011-07-30 00:43:18Z mckusick $\n */\n\n#ifndef _UFS_UFS_INODE_H_\n#define\t_UFS_UFS_INODE_H_\n\n#include <sys/lock.h>\n#include <sys/queue.h>\n#include <ufs/ufs/dinode.h>\n\n/*\n * This must agree with the definition in <ufs/ufs/dir.h>.\n */\n#define\tdoff_t\t\tint32_t\n\n/*\n * The inode is used to describe each active (or recently active) file in the\n * UFS filesystem. It is composed of two types of information. The first part\n * is the information that is needed only while the file is active (such as\n * the identity of the file and linkage to speed its lookup). The second part\n * is the permanent meta-data associated with the file which is read in\n * from the permanent dinode from long term storage when the file becomes\n * active, and is put back when the file is no longer being used.\n *\n * An inode may only be changed while holding either the exclusive\n * vnode lock or the shared vnode lock and the vnode interlock. We use\n * the latter only for \"read\" and \"get\" operations that require\n * changing i_flag, or a timestamp. This locking protocol allows executing\n * those operations without having to upgrade the vnode lock from shared to\n * exclusive.\n */\nstruct inode {\n\tTAILQ_ENTRY(inode) i_nextsnap; /* snapshot file list. */\n\tstruct\tvnode  *i_vnode;/* Vnode associated with this inode. */\n\tstruct\tufsmount *i_ump;/* Ufsmount point associated with this inode. */\n\tu_int32_t i_flag;\t/* flags, see below */\n\tstruct cdev *i_dev;\t/* Device associated with the inode. */\n\tino_t\t  i_number;\t/* The identity of the inode. */\n\tint\t  i_effnlink;\t/* i_nlink when I/O completes */\n\n\tstruct\t fs *i_fs;\t/* Associated filesystem superblock. */\n\tstruct\t dquot *i_dquot[MAXQUOTAS]; /* Dquot structures. */\n\t/*\n\t * Side effects; used during directory lookup.\n\t */\n\tint32_t\t  i_count;\t/* Size of free slot in directory. */\n\tdoff_t\t  i_endoff;\t/* End of useful stuff in directory. */\n\tdoff_t\t  i_diroff;\t/* Offset in dir, where we found last entry. */\n\tdoff_t\t  i_offset;\t/* Offset of free space in directory. */\n\n\tunion {\n\t\tstruct dirhash *dirhash; /* Hashing for large directories. */\n\t\tdaddr_t *snapblklist;    /* Collect expunged snapshot blocks. */\n\t} i_un;\n\n\t/*\n\t * Data for extended attribute modification.\n \t */\n\tu_char\t  *i_ea_area;\t/* Pointer to malloced copy of EA area */\n\tunsigned  i_ea_len;\t/* Length of i_ea_area */\n\tint\t  i_ea_error;\t/* First errno in transaction */\n\tint\t  i_ea_refs;\t/* Number of users of EA area */\n\n\t/*\n\t * Copies from the on-disk dinode itself.\n\t */\n\tu_int16_t i_mode;\t/* IFMT, permissions; see below. */\n\tint16_t\t  i_nlink;\t/* File link count. */\n\tu_int64_t i_size;\t/* File byte count. */\n\tu_int32_t i_flags;\t/* Status flags (chflags). */\n\tint64_t\t  i_gen;\t/* Generation number. */\n\tu_int32_t i_uid;\t/* File owner. */\n\tu_int32_t i_gid;\t/* File group. */\n\t/*\n\t * The real copy of the on-disk inode.\n\t */\n\tunion {\n\t\tstruct ufs1_dinode *din1;\t/* UFS1 on-disk dinode. */\n\t\tstruct ufs2_dinode *din2;\t/* UFS2 on-disk dinode. */\n\t} dinode_u;\n};\n/*\n * These flags are kept in i_flag.\n */\n#define\tIN_ACCESS\t0x0001\t\t/* Access time update request. */\n#define\tIN_CHANGE\t0x0002\t\t/* Inode change time update request. */\n#define\tIN_UPDATE\t0x0004\t\t/* Modification time update request. */\n#define\tIN_MODIFIED\t0x0008\t\t/* Inode has been modified. */\n#define\tIN_NEEDSYNC\t0x0010\t\t/* Inode requires fsync. */\n#define\tIN_LAZYMOD\t0x0040\t\t/* Modified, but don't write yet. */\n#define\tIN_LAZYACCESS\t0x0100\t\t/* Process IN_ACCESS after the\n\t\t\t\t\t   suspension finished */\n#define\tIN_EA_LOCKED\t0x0200\n#define\tIN_EA_LOCKWAIT\t0x0400\n\n#define\tIN_TRUNCATED\t0x0800\t\t/* Journaled truncation pending. */\n\n#define i_devvp i_ump->um_devvp\n#define i_umbufobj i_ump->um_bo\n#define i_dirhash i_un.dirhash\n#define i_snapblklist i_un.snapblklist\n#define i_din1 dinode_u.din1\n#define i_din2 dinode_u.din2\n\n#ifdef _KERNEL\n/*\n * The DIP macro is used to access fields in the dinode that are\n * not cached in the inode itself.\n */\n#define\tDIP(ip, field) \\\n\t(((ip)->i_ump->um_fstype == UFS1) ? \\\n\t(ip)->i_din1->d##field : (ip)->i_din2->d##field)\n#define\tDIP_SET(ip, field, val) do { \\\n\tif ((ip)->i_ump->um_fstype == UFS1) \\\n\t\t(ip)->i_din1->d##field = (val); \\\n\telse \\\n\t\t(ip)->i_din2->d##field = (val); \\\n\t} while (0)\n\n#define\tMAXSYMLINKLEN(ip) \\\n\t((ip)->i_ump->um_fstype == UFS1) ? \\\n\t((NDADDR + NIADDR) * sizeof(ufs1_daddr_t)) : \\\n\t((NDADDR + NIADDR) * sizeof(ufs2_daddr_t))\n#define\tSHORTLINK(ip) \\\n\t(((ip)->i_ump->um_fstype == UFS1) ? \\\n\t(caddr_t)(ip)->i_din1->di_db : (caddr_t)(ip)->i_din2->di_db)\n\n/*\n * Structure used to pass around logical block paths generated by\n * ufs_getlbns and used by truncate and bmap code.\n */\nstruct indir {\n\tufs2_daddr_t in_lbn;\t\t/* Logical block number. */\n\tint\tin_off;\t\t\t/* Offset in buffer. */\n\tint\tin_exists;\t\t/* Flag if the block exists. */\n};\n\n/* Convert between inode pointers and vnode pointers. */\n#define VTOI(vp)\t((struct inode *)(vp)->v_data)\n#define ITOV(ip)\t((ip)->i_vnode)\n\n/* Determine if soft dependencies are being done */\n#define DOINGSOFTDEP(vp)   ((vp)->v_mount->mnt_flag & (MNT_SOFTDEP | MNT_SUJ))\n#define MOUNTEDSOFTDEP(mp) ((mp)->mnt_flag & (MNT_SOFTDEP | MNT_SUJ))\n#define DOINGASYNC(vp)\t   ((vp)->v_mount->mnt_kern_flag & MNTK_ASYNC)\n#define DOINGSUJ(vp)\t   ((vp)->v_mount->mnt_flag & MNT_SUJ)\n#define MOUNTEDSUJ(mp)\t   ((mp)->mnt_flag & MNT_SUJ)\n\n/* This overlays the fid structure (see mount.h). */\nstruct ufid {\n\tu_int16_t ufid_len;\t/* Length of structure. */\n\tu_int16_t ufid_pad;\t/* Force 32-bit alignment. */\n\tino_t\t  ufid_ino;\t/* File number (ino). */\n\tint32_t\t  ufid_gen;\t/* Generation number. */\n};\n#endif /* _KERNEL */\n\n#endif /* !_UFS_UFS_INODE_H_ */\n"
  },
  {
    "path": "freebsd-headers/ufs/ufs/quota.h",
    "content": "/*-\n * Copyright (c) 1982, 1986, 1993\n *\tThe Regents of the University of California.  All rights reserved.\n *\n * This code is derived from software contributed to Berkeley by\n * Robert Elz at The University of Melbourne.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 4. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t@(#)quota.h\t8.3 (Berkeley) 8/19/94\n * $FreeBSD: release/9.0.0/sys/ufs/ufs/quota.h 222955 2011-06-10 22:19:44Z jeff $\n */\n\n#ifndef _UFS_UFS_QUOTA_H_\n#define\t_UFS_UFS_QUOTA_H_\n\n/*\n * Definitions for disk quotas imposed on the average user\n * (big brother finally hits UNIX).\n *\n * The following constants define the amount of time given a user before the\n * soft limits are treated as hard limits (usually resulting in an allocation\n * failure). The timer is started when the user crosses their soft limit, it\n * is reset when they go below their soft limit.\n */\n#define\tMAX_IQ_TIME\t(7*24*60*60)\t/* seconds in 1 week */\n#define\tMAX_DQ_TIME\t(7*24*60*60)\t/* seconds in 1 week */\n\n/*\n * The following constants define the usage of the quota file array in the\n * ufsmount structure and dquot array in the inode structure.  The semantics\n * of the elements of these arrays are defined in the routine getinoquota;\n * the remainder of the quota code treats them generically and need not be\n * inspected when changing the size of the array.\n */\n#define\tMAXQUOTAS\t2\n#define\tUSRQUOTA\t0\t/* element used for user quotas */\n#define\tGRPQUOTA\t1\t/* element used for group quotas */\n\n/*\n * Definitions for the default names of the quotas files.\n */\n#define INITQFNAMES { \\\n\t\"user\",\t\t/* USRQUOTA */ \\\n\t\"group\",\t/* GRPQUOTA */ \\\n\t\"undefined\", \\\n}\n#define\tQUOTAFILENAME\t\"quota\"\n#define\tQUOTAGROUP\t\"operator\"\n\n/*\n * Command definitions for the 'quotactl' system call.  The commands are\n * broken into a main command defined below and a subcommand that is used\n * to convey the type of quota that is being manipulated (see above).\n */\n#define SUBCMDMASK\t0x00ff\n#define SUBCMDSHIFT\t8\n#define\tQCMD(cmd, type)\t(((cmd) << SUBCMDSHIFT) | ((type) & SUBCMDMASK))\n\n#define\tQ_QUOTAON\t0x0100\t/* enable quotas */\n#define\tQ_QUOTAOFF\t0x0200\t/* disable quotas */\n#define\tQ_GETQUOTA32\t0x0300\t/* get limits and usage (32-bit version) */\n#define\tQ_SETQUOTA32\t0x0400\t/* set limits and usage (32-bit version) */\n#define\tQ_SETUSE32\t0x0500\t/* set usage (32-bit version) */\n#define\tQ_SYNC\t\t0x0600\t/* sync disk copy of a filesystems quotas */\n#define\tQ_GETQUOTA\t0x0700\t/* get limits and usage (64-bit version) */\n#define\tQ_SETQUOTA\t0x0800\t/* set limits and usage (64-bit version) */\n#define\tQ_SETUSE\t0x0900\t/* set usage (64-bit version) */\n#define\tQ_GETQUOTASIZE\t0x0A00\t/* get bit-size of quota file fields */\n\n/*\n * The following structure defines the format of the disk quota file\n * (as it appears on disk) - the file is an array of these structures\n * indexed by user or group number.  The setquota system call establishes\n * the vnode for each quota file (a pointer is retained in the ufsmount\n * structure).\n */\nstruct dqblk32 {\n\tu_int32_t dqb_bhardlimit;\t/* absolute limit on disk blks alloc */\n\tu_int32_t dqb_bsoftlimit;\t/* preferred limit on disk blks */\n\tu_int32_t dqb_curblocks;\t/* current block count */\n\tu_int32_t dqb_ihardlimit;\t/* maximum # allocated inodes + 1 */\n\tu_int32_t dqb_isoftlimit;\t/* preferred inode limit */\n\tu_int32_t dqb_curinodes;\t/* current # allocated inodes */\n\tint32_t   dqb_btime;\t\t/* time limit for excessive disk use */\n\tint32_t   dqb_itime;\t\t/* time limit for excessive files */\n};\n\nstruct dqblk64 {\n\tu_int64_t dqb_bhardlimit;\t/* absolute limit on disk blks alloc */\n\tu_int64_t dqb_bsoftlimit;\t/* preferred limit on disk blks */\n\tu_int64_t dqb_curblocks;\t/* current block count */\n\tu_int64_t dqb_ihardlimit;\t/* maximum # allocated inodes + 1 */\n\tu_int64_t dqb_isoftlimit;\t/* preferred inode limit */\n\tu_int64_t dqb_curinodes;\t/* current # allocated inodes */\n\tint64_t   dqb_btime;\t\t/* time limit for excessive disk use */\n\tint64_t   dqb_itime;\t\t/* time limit for excessive files */\n};\n\n#define dqblk dqblk64\n\n#define Q_DQHDR64_MAGIC \"QUOTA64\"\n#define Q_DQHDR64_VERSION 0x20081104\n\nstruct dqhdr64 {\n\tchar\t  dqh_magic[8];\t\t/* Q_DQHDR64_MAGIC */\n\tuint32_t  dqh_version;\t\t/* Q_DQHDR64_VERSION */\n\tuint32_t  dqh_hdrlen;\t\t/* header length */\n\tuint32_t  dqh_reclen;\t\t/* record length */\n\tchar\t  dqh_unused[44];\t/* reserved for future extension */\n};\n\n#ifdef _KERNEL\n\n#include <sys/queue.h>\n\n/*\n * The following structure records disk usage for a user or group on a\n * filesystem. There is one allocated for each quota that exists on any\n * filesystem for the current user or group. A cache is kept of recently\n * used entries.\n * (h) protected by dqhlock\n */\nstruct dquot {\n\tLIST_ENTRY(dquot) dq_hash;\t/* (h) hash list */\n\tTAILQ_ENTRY(dquot) dq_freelist;\t/* (h) free list */\n\tstruct mtx dq_lock;\t\t/* lock for concurrency */\n\tu_int16_t dq_flags;\t\t/* flags, see below */\n\tu_int16_t dq_type;\t\t/* quota type of this dquot */\n\tu_int32_t dq_cnt;\t\t/* (h) count of active references */\n\tu_int32_t dq_id;\t\t/* identifier this applies to */\n\tstruct ufsmount *dq_ump;\t/* (h) filesystem that this is\n\t\t\t\t\t   taken from */\n\tstruct dqblk64 dq_dqb;\t\t/* actual usage & quotas */\n};\n/*\n * Flag values.\n */\n#define\tDQ_LOCK\t\t0x01\t\t/* this quota locked (no MODS) */\n#define\tDQ_WANT\t\t0x02\t\t/* wakeup on unlock */\n#define\tDQ_MOD\t\t0x04\t\t/* this quota modified since read */\n#define\tDQ_FAKE\t\t0x08\t\t/* no limits here, just usage */\n#define\tDQ_BLKS\t\t0x10\t\t/* has been warned about blk limit */\n#define\tDQ_INODS\t0x20\t\t/* has been warned about inode limit */\n/*\n * Shorthand notation.\n */\n#define\tdq_bhardlimit\tdq_dqb.dqb_bhardlimit\n#define\tdq_bsoftlimit\tdq_dqb.dqb_bsoftlimit\n#define\tdq_curblocks\tdq_dqb.dqb_curblocks\n#define\tdq_ihardlimit\tdq_dqb.dqb_ihardlimit\n#define\tdq_isoftlimit\tdq_dqb.dqb_isoftlimit\n#define\tdq_curinodes\tdq_dqb.dqb_curinodes\n#define\tdq_btime\tdq_dqb.dqb_btime\n#define\tdq_itime\tdq_dqb.dqb_itime\n\n/*\n * If the system has never checked for a quota for this file, then it is\n * set to NODQUOT.  Once a write attempt is made the inode pointer is set\n * to reference a dquot structure.\n */\n#define\tNODQUOT\t\tNULL\n\n/*\n * Flags to chkdq() and chkiq()\n */\n#define\tFORCE\t0x01\t/* force usage changes independent of limits */\n#define\tCHOWN\t0x02\t/* (advisory) change initiated by chown */\n\n/*\n * Macros to avoid subroutine calls to trivial functions.\n */\n#ifdef DIAGNOSTIC\n#define\tDQREF(dq)\tdqref(dq)\n#else\n#define\tDQREF(dq)\t(dq)->dq_cnt++\n#endif\n\n#define\tDQI_LOCK(dq)\tmtx_lock(&(dq)->dq_lock)\n#define\tDQI_UNLOCK(dq)\tmtx_unlock(&(dq)->dq_lock)\n\n#define\tDQI_WAIT(dq, prio, msg) do {\t\t\\\n\twhile ((dq)->dq_flags & DQ_LOCK) {\t\\\n\t\t(dq)->dq_flags |= DQ_WANT;\t\\\n\t\t(void) msleep((dq),\t\t\\\n\t\t    &(dq)->dq_lock, (prio), (msg), 0); \\\n\t}\t\t\t\t\t\\\n} while (0)\n\n#define\tDQI_WAKEUP(dq) do {\t\t\t\\\n\tif ((dq)->dq_flags & DQ_WANT)\t\t\\\n\t\twakeup((dq));\t\t\t\\\n\t(dq)->dq_flags &= ~(DQ_WANT|DQ_LOCK);\t\\\n} while (0)\n\nstruct inode;\nstruct mount;\nstruct thread;\nstruct ucred;\nstruct vnode;\n\nint\tchkdq(struct inode *, int64_t, struct ucred *, int);\nint\tchkiq(struct inode *, int, struct ucred *, int);\nvoid\tdqinit(void);\nvoid\tdqrele(struct vnode *, struct dquot *);\nvoid\tdquninit(void);\nint\tgetinoquota(struct inode *);\nint\tqsync(struct mount *mp);\nint\tquotaoff(struct thread *td, struct mount *, int);\nint\tquotaon(struct thread *td, struct mount *, int, void *);\nint\tgetquota32(struct thread *, struct mount *, u_long, int, void *);\nint\tsetquota32(struct thread *, struct mount *, u_long, int, void *);\nint\tsetuse32(struct thread *, struct mount *, u_long, int, void *);\nint\tgetquota(struct thread *, struct mount *, u_long, int, void *);\nint\tsetquota(struct thread *, struct mount *, u_long, int, void *);\nint\tsetuse(struct thread *, struct mount *, u_long, int, void *);\nint\tgetquotasize(struct thread *, struct mount *, u_long, int, void *);\nvfs_quotactl_t ufs_quotactl;\n\n#ifdef SOFTUPDATES\nint\tquotaref(struct vnode *, struct dquot **);\nvoid\tquotarele(struct dquot **);\nvoid\tquotaadj(struct dquot **, struct ufsmount *, int64_t);\n#endif /* SOFTUPDATES */\n\n#else /* !_KERNEL */\n\n#include <sys/cdefs.h>\n\n__BEGIN_DECLS\nint\tquotactl(const char *, int, int, void *);\n__END_DECLS\n\n#endif /* _KERNEL */\n\n#endif /* !_UFS_UFS_QUOTA_H_ */\n"
  },
  {
    "path": "freebsd-headers/ufs/ufs/ufs_extern.h",
    "content": "/*-\n * Copyright (c) 1991, 1993, 1994\n *\tThe Regents of the University of California.  All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 4. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t@(#)ufs_extern.h\t8.10 (Berkeley) 5/14/95\n * $FreeBSD: release/9.0.0/sys/ufs/ufs/ufs_extern.h 222167 2011-05-22 01:07:54Z rmacklem $\n */\n\n#ifndef _UFS_UFS_EXTERN_H_\n#define\t_UFS_UFS_EXTERN_H_\n\nstruct componentname;\nstruct direct;\nstruct indir;\nstruct inode;\nstruct mount;\nstruct thread;\nstruct sockaddr;\nstruct ucred;\nstruct ufid;\nstruct vfsconf;\nstruct vnode;\nstruct vop_bmap_args;\nstruct vop_cachedlookup_args;\nstruct vop_generic_args;\nstruct vop_inactive_args;\nstruct vop_reclaim_args;\n\nextern struct vop_vector ufs_fifoops;\nextern struct vop_vector ufs_vnodeops;\n\nint\t ufs_bmap(struct vop_bmap_args *);\nint\t ufs_bmaparray(struct vnode *, ufs2_daddr_t, ufs2_daddr_t *,\n\t    struct buf *, int *, int *);\nint\t ufs_fhtovp(struct mount *, struct ufid *, int, struct vnode **);\nint\t ufs_checkpath(ino_t, ino_t, struct inode *, struct ucred *, ino_t *);\nvoid\t ufs_dirbad(struct inode *, doff_t, char *);\nint\t ufs_dirbadentry(struct vnode *, struct direct *, int);\nint\t ufs_dirempty(struct inode *, ino_t, struct ucred *);\nint\t ufs_extread(struct vop_read_args *);\nint\t ufs_extwrite(struct vop_write_args *);\nvoid\t ufs_makedirentry(struct inode *, struct componentname *,\n\t    struct direct *);\nint\t ufs_direnter(struct vnode *, struct vnode *, struct direct *,\n\t    struct componentname *, struct buf *, int);\nint\t ufs_dirremove(struct vnode *, struct inode *, int, int);\nint\t ufs_dirrewrite(struct inode *, struct inode *, ino_t, int, int);\nint\t ufs_lookup_ino(struct vnode *, struct vnode **, struct componentname *,\n\t    ino_t *);\nint\t ufs_getlbns(struct vnode *, ufs2_daddr_t, struct indir *, int *);\nint\t ufs_inactive(struct vop_inactive_args *);\nint\t ufs_init(struct vfsconf *);\nvoid\t ufs_itimes(struct vnode *vp);\nint\t ufs_lookup(struct vop_cachedlookup_args *);\nvoid\t ufs_prepare_reclaim(struct vnode *vp);\nint\t ufs_readdir(struct vop_readdir_args *);\nint\t ufs_reclaim(struct vop_reclaim_args *);\nvoid\t ffs_snapgone(struct inode *);\nvfs_root_t ufs_root;\nint\t ufs_uninit(struct vfsconf *);\nint\t ufs_vinit(struct mount *, struct vop_vector *, struct vnode **);\n\n#include <sys/sysctl.h>\nSYSCTL_DECL(_vfs_ufs);\n\n/*\n * Soft update function prototypes.\n */\nint\tsoftdep_setup_directory_add(struct buf *, struct inode *, off_t,\n\t    ino_t, struct buf *, int);\nvoid\tsoftdep_change_directoryentry_offset(struct buf *, struct inode *,\n\t    caddr_t, caddr_t, caddr_t, int);\nvoid\tsoftdep_setup_remove(struct buf *,struct inode *, struct inode *, int);\nvoid\tsoftdep_setup_directory_change(struct buf *, struct inode *,\n\t    struct inode *, ino_t, int);\nvoid\tsoftdep_change_linkcnt(struct inode *);\nvoid\tsoftdep_releasefile(struct inode *);\nint\tsoftdep_slowdown(struct vnode *);\nvoid\tsoftdep_setup_create(struct inode *, struct inode *);\nvoid\tsoftdep_setup_dotdot_link(struct inode *, struct inode *);\nvoid\tsoftdep_setup_link(struct inode *, struct inode *);\nvoid\tsoftdep_setup_mkdir(struct inode *, struct inode *);\nvoid\tsoftdep_setup_rmdir(struct inode *, struct inode *);\nvoid\tsoftdep_setup_unlink(struct inode *, struct inode *);\nvoid\tsoftdep_revert_create(struct inode *, struct inode *);\nvoid\tsoftdep_revert_dotdot_link(struct inode *, struct inode *);\nvoid\tsoftdep_revert_link(struct inode *, struct inode *);\nvoid\tsoftdep_revert_mkdir(struct inode *, struct inode *);\nvoid\tsoftdep_revert_rmdir(struct inode *, struct inode *);\n\n/*\n * Flags to low-level allocation routines.  The low 16-bits are reserved\n * for IO_ flags from vnode.h.\n *\n * Note: The general vfs code typically limits the sequential heuristic\n * count to 127.  See sequential_heuristic() in kern/vfs_vnops.c\n */\n#define BA_CLRBUF\t0x00010000\t/* Clear invalid areas of buffer. */\n#define BA_METAONLY\t0x00020000\t/* Return indirect block buffer. */\n#define BA_SEQMASK\t0x7F000000\t/* Bits holding seq heuristic. */\n#define BA_SEQSHIFT\t24\n#define BA_SEQMAX\t0x7F\n\n#endif /* !_UFS_UFS_EXTERN_H_ */\n"
  },
  {
    "path": "freebsd-headers/ufs/ufs/ufsmount.h",
    "content": "/*-\n * Copyright (c) 1982, 1986, 1989, 1993\n *\tThe Regents of the University of California.  All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 4. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t@(#)ufsmount.h\t8.6 (Berkeley) 3/30/95\n * $FreeBSD: release/9.0.0/sys/ufs/ufs/ufsmount.h 224061 2011-07-15 16:20:33Z mckusick $\n */\n\n#ifndef _UFS_UFS_UFSMOUNT_H_\n#define _UFS_UFS_UFSMOUNT_H_\n\n#include <sys/buf.h>\t/* XXX For struct workhead. */\n\n/*\n * Arguments to mount UFS-based filesystems\n */\nstruct ufs_args {\n\tchar\t*fspec;\t\t\t/* block special device to mount */\n\tstruct\toexport_args export;\t/* network export information */\n};\n\n#ifdef _KERNEL\n\n#ifdef MALLOC_DECLARE\nMALLOC_DECLARE(M_UFSMNT);\n#endif\n\nstruct buf;\nstruct inode;\nstruct nameidata;\nstruct timeval;\nstruct ucred;\nstruct uio;\nstruct vnode;\nstruct ufs_extattr_per_mount;\nstruct jblocks;\nstruct inodedep;\n\nTAILQ_HEAD(inodedeplst, inodedep);\nLIST_HEAD(bmsafemaphd, bmsafemap);\n\n/* This structure describes the UFS specific mount structure data. */\nstruct ufsmount {\n\tstruct\tmount *um_mountp;\t\t/* filesystem vfs structure */\n\tstruct\tcdev *um_dev;\t\t\t/* device mounted */\n\tstruct\tg_consumer *um_cp;\n\tstruct\tbufobj *um_bo;\t\t\t/* Buffer cache object */\n\tstruct\tvnode *um_devvp;\t\t/* block device mounted vnode */\n\tu_long\tum_fstype;\t\t\t/* type of filesystem */\n\tstruct\tfs *um_fs;\t\t\t/* pointer to superblock */\n\tstruct\tufs_extattr_per_mount um_extattr;\t/* extended attrs */\n\tu_long\tum_nindir;\t\t\t/* indirect ptrs per block */\n\tu_long\tum_bptrtodb;\t\t\t/* indir ptr to disk block */\n\tu_long\tum_seqinc;\t\t\t/* inc between seq blocks */\n\tstruct\tmtx um_lock;\t\t\t/* Protects ufsmount & fs */\n\tpid_t\tum_fsckpid;\t\t\t/* PID permitted fsck sysctls */\n\tlong\tum_numindirdeps;\t\t/* outstanding indirdeps */\n\tstruct\tworkhead softdep_workitem_pending; /* softdep work queue */\n\tstruct\tworklist *softdep_worklist_tail; /* Tail pointer for above */\n\tstruct\tworkhead softdep_journal_pending; /* journal work queue */\n\tstruct\tworklist *softdep_journal_tail;\t/* Tail pointer for above */\n\tstruct\tjblocks *softdep_jblocks;\t/* Journal block information */\n\tstruct\tinodedeplst softdep_unlinked;\t/* Unlinked inodes */\n\tstruct\tbmsafemaphd softdep_dirtycg;\t/* Dirty CGs */\n\tint\tsoftdep_on_journal;\t\t/* Items on the journal list */\n\tint\tsoftdep_on_worklist;\t\t/* Items on the worklist */\n\tint\tsoftdep_deps;\t\t\t/* Total dependency count */\n\tint\tsoftdep_accdeps;\t\t/* accumulated dep count */\n\tint\tsoftdep_req;\t\t\t/* Wakeup when deps hits 0. */\n\tstruct\tvnode *um_quotas[MAXQUOTAS];\t/* pointer to quota files */\n\tstruct\tucred *um_cred[MAXQUOTAS];\t/* quota file access cred */\n\ttime_t\tum_btime[MAXQUOTAS];\t\t/* block quota time limit */\n\ttime_t\tum_itime[MAXQUOTAS];\t\t/* inode quota time limit */\n\tchar\tum_qflags[MAXQUOTAS];\t\t/* quota specific flags */\n\tint64_t\tum_savedmaxfilesize;\t\t/* XXX - limit maxfilesize */\n\tint\tum_candelete;\t\t\t/* devvp supports TRIM */\n\tint\t(*um_balloc)(struct vnode *, off_t, int, struct ucred *, int, struct buf **);\n\tint\t(*um_blkatoff)(struct vnode *, off_t, char **, struct buf **);\n\tint\t(*um_truncate)(struct vnode *, off_t, int, struct ucred *, struct thread *);\n\tint\t(*um_update)(struct vnode *, int);\n\tint\t(*um_valloc)(struct vnode *, int, struct ucred *, struct vnode **);\n\tint\t(*um_vfree)(struct vnode *, ino_t, int);\n\tvoid\t(*um_ifree)(struct ufsmount *, struct inode *);\n\tint\t(*um_rdonly)(struct inode *);\n\tvoid\t(*um_snapgone)(struct inode *);\n};\n\n#define UFS_BALLOC(aa, bb, cc, dd, ee, ff) VFSTOUFS((aa)->v_mount)->um_balloc(aa, bb, cc, dd, ee, ff)\n#define UFS_BLKATOFF(aa, bb, cc, dd) VFSTOUFS((aa)->v_mount)->um_blkatoff(aa, bb, cc, dd)\n#define UFS_TRUNCATE(aa, bb, cc, dd, ee) VFSTOUFS((aa)->v_mount)->um_truncate(aa, bb, cc, dd, ee)\n#define UFS_UPDATE(aa, bb) VFSTOUFS((aa)->v_mount)->um_update(aa, bb)\n#define UFS_VALLOC(aa, bb, cc, dd) VFSTOUFS((aa)->v_mount)->um_valloc(aa, bb, cc, dd)\n#define UFS_VFREE(aa, bb, cc) VFSTOUFS((aa)->v_mount)->um_vfree(aa, bb, cc)\n#define UFS_IFREE(aa, bb) ((aa)->um_ifree(aa, bb))\n#define\tUFS_RDONLY(aa) ((aa)->i_ump->um_rdonly(aa))\n#define\tUFS_SNAPGONE(aa) ((aa)->i_ump->um_snapgone(aa))\n\n#define\tUFS_LOCK(aa)\tmtx_lock(&(aa)->um_lock)\n#define\tUFS_UNLOCK(aa)\tmtx_unlock(&(aa)->um_lock)\n#define\tUFS_MTX(aa)\t(&(aa)->um_lock)\n\n/*\n * Filesystem types\n */\n#define UFS1\t1\n#define UFS2\t2\n\n/*\n * Flags describing the state of quotas.\n */\n#define\tQTF_OPENING\t0x01\t\t\t/* Q_QUOTAON in progress */\n#define\tQTF_CLOSING\t0x02\t\t\t/* Q_QUOTAOFF in progress */\n#define QTF_64BIT\t0x04\t\t\t/* 64-bit quota file */\n\n/* Convert mount ptr to ufsmount ptr. */\n#define VFSTOUFS(mp)\t((struct ufsmount *)((mp)->mnt_data))\n#define\tUFSTOVFS(ump)\t(ump)->um_mountp\n\n/*\n * Macros to access filesystem parameters in the ufsmount structure.\n * Used by ufs_bmap.\n */\n#define MNINDIR(ump)\t\t\t((ump)->um_nindir)\n#define\tblkptrtodb(ump, b)\t\t((b) << (ump)->um_bptrtodb)\n#define\tis_sequential(ump, a, b)\t((b) == (a) + ump->um_seqinc)\n#endif /* _KERNEL */\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/ugidfw.h",
    "content": "/*-\n * Copyright (c) 2002, 2004 Networks Associates Technology, Inc.\n * All rights reserved.\n *\n * This software was developed for the FreeBSD Project by Network Associates\n * Laboratories, the Security Research Division of Network Associates, Inc.\n * under DARPA/SPAWAR contract N66001-01-C-8035 (\"CBOSS\"), as part of the\n * DARPA CHATS research program.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/lib/libugidfw/ugidfw.h 157986 2006-04-23 17:06:18Z dwmalone $\n */\n\n#ifndef _UGIDFW_H\n#define\t_UGIDFW_H\n\n__BEGIN_DECLS\nint\tbsde_rule_to_string(struct mac_bsdextended_rule *rule, char *buf,\n\t    size_t buflen);\nint\tbsde_parse_mode(int argc, char *argv[], mode_t *mode, size_t buflen,\n\t    char *errstr);\nint\tbsde_parse_rule(int argc, char *argv[],\n\t    struct mac_bsdextended_rule *rule, size_t buflen, char *errstr);\nint\tbsde_parse_rule_string(const char *string,\n\t    struct mac_bsdextended_rule *rule, size_t buflen, char *errstr);\nint\tbsde_get_mib(const char *string, int *name, size_t *namelen);\nint\tbsde_get_rule_count(size_t buflen, char *errstr);\nint\tbsde_get_rule_slots(size_t buflen, char *errstr);\nint\tbsde_get_rule(int rulenum, struct mac_bsdextended_rule *rule,\n\t    size_t errlen, char *errstr);\nint\tbsde_delete_rule(int rulenum, size_t buflen, char *errstr);\nint\tbsde_set_rule(int rulenum, struct mac_bsdextended_rule *rule,\n\t    size_t buflen, char *errstr);\nint\tbsde_add_rule(int *rulename, struct mac_bsdextended_rule *rule,\n\t    size_t buflen, char *errstr);\n__END_DECLS\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/ulimit.h",
    "content": "/*-\n * Copyright (c) 2002 Kyle Martin <mkm@ieee.org>\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/include/ulimit.h 108910 2003-01-08 01:18:13Z tjr $\n */\n\n#ifndef _ULIMIT_H_\n#define\t_ULIMIT_H_\n\n#include <sys/cdefs.h>\n\n#define\tUL_GETFSIZE\t1\n#define\tUL_SETFSIZE\t2\n\n__BEGIN_DECLS\nlong\tulimit(int, ...);\n__END_DECLS\n\n#endif /* !_ULIMIT_H_ */\n"
  },
  {
    "path": "freebsd-headers/ulog.h",
    "content": "/*-\n * Copyright (c) 2009 Ed Schouten <ed@FreeBSD.org>\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/lib/libulog/ulog.h 202215 2010-01-13 18:53:06Z ed $\n */\n\n#ifndef _ULOG_H_\n#define\t_ULOG_H_\n\n#include <sys/cdefs.h>\n\n__BEGIN_DECLS\nvoid\tulog_login(const char *, const char *, const char *);\nvoid\tulog_login_pseudo(int, const char *);\nvoid\tulog_logout(const char *);\nvoid\tulog_logout_pseudo(int);\n__END_DECLS\n\n#endif /* !_ULOG_H_ */\n"
  },
  {
    "path": "freebsd-headers/unctrl.h",
    "content": "/****************************************************************************\n * Copyright (c) 1998,2000 Free Software Foundation, Inc.                   *\n *                                                                          *\n * Permission is hereby granted, free of charge, to any person obtaining a  *\n * copy of this software and associated documentation files (the            *\n * \"Software\"), to deal in the Software without restriction, including      *\n * without limitation the rights to use, copy, modify, merge, publish,      *\n * distribute, distribute with modifications, sublicense, and/or sell       *\n * copies of the Software, and to permit persons to whom the Software is    *\n * furnished to do so, subject to the following conditions:                 *\n *                                                                          *\n * The above copyright notice and this permission notice shall be included  *\n * in all copies or substantial portions of the Software.                   *\n *                                                                          *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS  *\n * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF               *\n * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.   *\n * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,   *\n * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR    *\n * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR    *\n * THE USE OR OTHER DEALINGS IN THE SOFTWARE.                               *\n *                                                                          *\n * Except as contained in this notice, the name(s) of the above copyright   *\n * holders shall not be used in advertising or otherwise to promote the     *\n * sale, use or other dealings in this Software without prior written       *\n * authorization.                                                           *\n ****************************************************************************/\n\n/****************************************************************************\n *  Author: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995               *\n *     and: Eric S. Raymond <esr@snark.thyrsus.com>                         *\n ****************************************************************************/\n\n/*\n * unctrl.h\n *\n * Display a printable version of a control character.\n * Control characters are displayed in caret notation (^x), DELETE is displayed\n * as ^?. Printable characters are displayed as is.\n */\n\n/* $Id: unctrl.h.in,v 1.10 2001/03/24 21:53:25 tom Exp $ */\n\n#ifndef NCURSES_UNCTRL_H_incl\n#define NCURSES_UNCTRL_H_incl\t1\n\n#undef  NCURSES_VERSION\n#define NCURSES_VERSION \"5.7\"\n\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\n#include <curses.h>\n\n#undef unctrl\nNCURSES_EXPORT(NCURSES_CONST char *) unctrl (chtype);\n\n#ifdef __cplusplus\n}\n#endif\n\n#endif /* NCURSES_UNCTRL_H_incl */\n"
  },
  {
    "path": "freebsd-headers/unistd.h",
    "content": "/*-\n * Copyright (c) 1991, 1993, 1994\n *\tThe Regents of the University of California.  All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t@(#)unistd.h\t8.12 (Berkeley) 4/27/95\n * $FreeBSD: release/9.0.0/include/unistd.h 228843 2011-12-23 15:00:37Z cperciva $\n */\n\n#ifndef _UNISTD_H_\n#define\t_UNISTD_H_\n\n#include <sys/cdefs.h>\n#include <sys/types.h>\t\t\t/* XXX adds too much pollution. */\n#include <sys/unistd.h>\n#include <sys/_null.h>\n#include <sys/_types.h>\n\n#ifndef _GID_T_DECLARED\ntypedef\t__gid_t\t\tgid_t;\n#define\t_GID_T_DECLARED\n#endif\n\n#ifndef _OFF_T_DECLARED\ntypedef\t__off_t\t\toff_t;\n#define\t_OFF_T_DECLARED\n#endif\n\n#ifndef _PID_T_DECLARED\ntypedef\t__pid_t\t\tpid_t;\n#define\t_PID_T_DECLARED\n#endif\n\n#ifndef _SIZE_T_DECLARED\ntypedef\t__size_t\tsize_t;\n#define\t_SIZE_T_DECLARED\n#endif\n\n#ifndef _SSIZE_T_DECLARED\ntypedef\t__ssize_t\tssize_t;\n#define\t_SSIZE_T_DECLARED\n#endif\n\n#ifndef _UID_T_DECLARED\ntypedef\t__uid_t\t\tuid_t;\n#define\t_UID_T_DECLARED\n#endif\n\n#ifndef _USECONDS_T_DECLARED\ntypedef\t__useconds_t\tuseconds_t;\n#define\t_USECONDS_T_DECLARED\n#endif\n\n#define\tSTDIN_FILENO\t0\t/* standard input file descriptor */\n#define\tSTDOUT_FILENO\t1\t/* standard output file descriptor */\n#define\tSTDERR_FILENO\t2\t/* standard error file descriptor */\n\n#if __XSI_VISIBLE || __POSIX_VISIBLE >= 200112\n#define\tF_ULOCK\t\t0\t/* unlock locked section */\n#define\tF_LOCK\t\t1\t/* lock a section for exclusive use */\n#define\tF_TLOCK\t\t2\t/* test and lock a section for exclusive use */\n#define\tF_TEST\t\t3\t/* test a section for locks by other procs */\n#endif\n\n/*\n * POSIX options and option groups we unconditionally do or don't\n * implement.  This list includes those options which are exclusively\n * implemented (or not) in user mode.  Please keep this list in\n * alphabetical order.\n *\n * Anything which is defined as zero below **must** have an\n * implementation for the corresponding sysconf() which is able to\n * determine conclusively whether or not the feature is supported.\n * Anything which is defined as other than -1 below **must** have\n * complete headers, types, and function declarations as specified by\n * the POSIX standard; however, if the relevant sysconf() function\n * returns -1, the functions may be stubbed out.\n */\n#define\t_POSIX_BARRIERS\t\t\t200112L\n#define\t_POSIX_READER_WRITER_LOCKS\t200112L\n#define\t_POSIX_REGEXP\t\t\t1\n#define\t_POSIX_SHELL\t\t\t1\n#define\t_POSIX_SPAWN\t\t\t200112L\n#define\t_POSIX_SPIN_LOCKS\t\t200112L\n#define\t_POSIX_THREAD_ATTR_STACKADDR\t200112L\n#define\t_POSIX_THREAD_ATTR_STACKSIZE\t200112L\n#define\t_POSIX_THREAD_CPUTIME\t\t200112L\n#define\t_POSIX_THREAD_PRIO_INHERIT\t200112L\n#define\t_POSIX_THREAD_PRIO_PROTECT\t200112L\n#define\t_POSIX_THREAD_PRIORITY_SCHEDULING 200112L\n#define\t_POSIX_THREAD_PROCESS_SHARED\t-1\n#define\t_POSIX_THREAD_SAFE_FUNCTIONS\t-1\n#define\t_POSIX_THREAD_SPORADIC_SERVER\t-1\n#define\t_POSIX_THREADS\t\t\t200112L\n#define\t_POSIX_TRACE\t\t\t-1\n#define\t_POSIX_TRACE_EVENT_FILTER\t-1\n#define\t_POSIX_TRACE_INHERIT\t\t-1\n#define\t_POSIX_TRACE_LOG\t\t-1\n#define\t_POSIX2_C_BIND\t\t\t200112L\t/* mandatory */\n#define\t_POSIX2_C_DEV\t\t\t-1 /* need c99 utility */\n#define\t_POSIX2_CHAR_TERM\t\t1\n#define\t_POSIX2_FORT_DEV\t\t-1 /* need fort77 utility */\n#define\t_POSIX2_FORT_RUN\t\t200112L\n#define\t_POSIX2_LOCALEDEF\t\t-1\n#define\t_POSIX2_PBS\t\t\t-1\n#define\t_POSIX2_PBS_ACCOUNTING\t\t-1\n#define\t_POSIX2_PBS_CHECKPOINT\t\t-1\n#define\t_POSIX2_PBS_LOCATE\t\t-1\n#define\t_POSIX2_PBS_MESSAGE\t\t-1\n#define\t_POSIX2_PBS_TRACK\t\t-1\n#define\t_POSIX2_SW_DEV\t\t\t-1 /* XXX ??? */\n#define\t_POSIX2_UPE\t\t\t200112L\n#define\t_V6_ILP32_OFF32\t\t\t-1\n#define\t_V6_ILP32_OFFBIG\t\t0\n#define\t_V6_LP64_OFF64\t\t\t0\n#define\t_V6_LPBIG_OFFBIG\t\t-1\n\n#if __XSI_VISIBLE\n#define\t_XOPEN_CRYPT\t\t\t-1 /* XXX ??? */\n#define\t_XOPEN_ENH_I18N\t\t\t-1 /* mandatory in XSI */\n#define\t_XOPEN_LEGACY\t\t\t-1\n#define\t_XOPEN_REALTIME\t\t\t-1\n#define\t_XOPEN_REALTIME_THREADS\t\t-1\n#define\t_XOPEN_UNIX\t\t\t-1\n#endif\n\n/* Define the POSIX.2 version we target for compliance. */\n#define\t_POSIX2_VERSION\t\t199212L\n\n/*\n * POSIX-style system configuration variable accessors (for the\n * sysconf function).  The kernel does not directly implement the\n * sysconf() interface; rather, a C library stub translates references\n * to sysconf() into calls to sysctl() using a giant switch statement.\n * Those that are marked `user' are implemented entirely in the C\n * library and never query the kernel.  pathconf() is implemented\n * directly by the kernel so those are not defined here.\n */\n#define\t_SC_ARG_MAX\t\t 1\n#define\t_SC_CHILD_MAX\t\t 2\n#define\t_SC_CLK_TCK\t\t 3\n#define\t_SC_NGROUPS_MAX\t\t 4\n#define\t_SC_OPEN_MAX\t\t 5\n#define\t_SC_JOB_CONTROL\t\t 6\n#define\t_SC_SAVED_IDS\t\t 7\n#define\t_SC_VERSION\t\t 8\n#define\t_SC_BC_BASE_MAX\t\t 9 /* user */\n#define\t_SC_BC_DIM_MAX\t\t10 /* user */\n#define\t_SC_BC_SCALE_MAX\t11 /* user */\n#define\t_SC_BC_STRING_MAX\t12 /* user */\n#define\t_SC_COLL_WEIGHTS_MAX\t13 /* user */\n#define\t_SC_EXPR_NEST_MAX\t14 /* user */\n#define\t_SC_LINE_MAX\t\t15 /* user */\n#define\t_SC_RE_DUP_MAX\t\t16 /* user */\n#define\t_SC_2_VERSION\t\t17 /* user */\n#define\t_SC_2_C_BIND\t\t18 /* user */\n#define\t_SC_2_C_DEV\t\t19 /* user */\n#define\t_SC_2_CHAR_TERM\t\t20 /* user */\n#define\t_SC_2_FORT_DEV\t\t21 /* user */\n#define\t_SC_2_FORT_RUN\t\t22 /* user */\n#define\t_SC_2_LOCALEDEF\t\t23 /* user */\n#define\t_SC_2_SW_DEV\t\t24 /* user */\n#define\t_SC_2_UPE\t\t25 /* user */\n#define\t_SC_STREAM_MAX\t\t26 /* user */\n#define\t_SC_TZNAME_MAX\t\t27 /* user */\n\n#if __POSIX_VISIBLE >= 199309\n#define\t_SC_ASYNCHRONOUS_IO\t28\n#define\t_SC_MAPPED_FILES\t29\n#define\t_SC_MEMLOCK\t\t30\n#define\t_SC_MEMLOCK_RANGE\t31\n#define\t_SC_MEMORY_PROTECTION\t32\n#define\t_SC_MESSAGE_PASSING\t33\n#define\t_SC_PRIORITIZED_IO\t34\n#define\t_SC_PRIORITY_SCHEDULING\t35\n#define\t_SC_REALTIME_SIGNALS\t36\n#define\t_SC_SEMAPHORES\t\t37\n#define\t_SC_FSYNC\t\t38\n#define\t_SC_SHARED_MEMORY_OBJECTS 39\n#define\t_SC_SYNCHRONIZED_IO\t40\n#define\t_SC_TIMERS\t\t41\n#define\t_SC_AIO_LISTIO_MAX\t42\n#define\t_SC_AIO_MAX\t\t43\n#define\t_SC_AIO_PRIO_DELTA_MAX\t44\n#define\t_SC_DELAYTIMER_MAX\t45\n#define\t_SC_MQ_OPEN_MAX\t\t46\n#define\t_SC_PAGESIZE\t\t47\n#define\t_SC_RTSIG_MAX\t\t48\n#define\t_SC_SEM_NSEMS_MAX\t49\n#define\t_SC_SEM_VALUE_MAX\t50\n#define\t_SC_SIGQUEUE_MAX\t51\n#define\t_SC_TIMER_MAX\t\t52\n#endif\n\n#if __POSIX_VISIBLE >= 200112\n#define\t_SC_2_PBS\t\t59 /* user */\n#define\t_SC_2_PBS_ACCOUNTING\t60 /* user */\n#define\t_SC_2_PBS_CHECKPOINT\t61 /* user */\n#define\t_SC_2_PBS_LOCATE\t62 /* user */\n#define\t_SC_2_PBS_MESSAGE\t63 /* user */\n#define\t_SC_2_PBS_TRACK\t\t64 /* user */\n#define\t_SC_ADVISORY_INFO\t65\n#define\t_SC_BARRIERS\t\t66 /* user */\n#define\t_SC_CLOCK_SELECTION\t67\n#define\t_SC_CPUTIME\t\t68\n#define\t_SC_FILE_LOCKING\t69\n#define\t_SC_GETGR_R_SIZE_MAX\t70 /* user */\n#define\t_SC_GETPW_R_SIZE_MAX\t71 /* user */\n#define\t_SC_HOST_NAME_MAX\t72\n#define\t_SC_LOGIN_NAME_MAX\t73\n#define\t_SC_MONOTONIC_CLOCK\t74\n#define\t_SC_MQ_PRIO_MAX\t\t75\n#define\t_SC_READER_WRITER_LOCKS\t76 /* user */\n#define\t_SC_REGEXP\t\t77 /* user */\n#define\t_SC_SHELL\t\t78 /* user */\n#define\t_SC_SPAWN\t\t79 /* user */\n#define\t_SC_SPIN_LOCKS\t\t80 /* user */\n#define\t_SC_SPORADIC_SERVER\t81\n#define\t_SC_THREAD_ATTR_STACKADDR 82 /* user */\n#define\t_SC_THREAD_ATTR_STACKSIZE 83 /* user */\n#define\t_SC_THREAD_CPUTIME\t84 /* user */\n#define\t_SC_THREAD_DESTRUCTOR_ITERATIONS 85 /* user */\n#define\t_SC_THREAD_KEYS_MAX\t86 /* user */\n#define\t_SC_THREAD_PRIO_INHERIT\t87 /* user */\n#define\t_SC_THREAD_PRIO_PROTECT\t88 /* user */\n#define\t_SC_THREAD_PRIORITY_SCHEDULING 89 /* user */\n#define\t_SC_THREAD_PROCESS_SHARED 90 /* user */\n#define\t_SC_THREAD_SAFE_FUNCTIONS 91 /* user */\n#define\t_SC_THREAD_SPORADIC_SERVER 92 /* user */\n#define\t_SC_THREAD_STACK_MIN\t93 /* user */\n#define\t_SC_THREAD_THREADS_MAX\t94 /* user */\n#define\t_SC_TIMEOUTS\t\t95 /* user */\n#define\t_SC_THREADS\t\t96 /* user */\n#define\t_SC_TRACE\t\t97 /* user */\n#define\t_SC_TRACE_EVENT_FILTER\t98 /* user */\n#define\t_SC_TRACE_INHERIT\t99 /* user */\n#define\t_SC_TRACE_LOG\t\t100 /* user */\n#define\t_SC_TTY_NAME_MAX\t101 /* user */\n#define\t_SC_TYPED_MEMORY_OBJECTS 102\n#define\t_SC_V6_ILP32_OFF32\t103 /* user */\n#define\t_SC_V6_ILP32_OFFBIG\t104 /* user */\n#define\t_SC_V6_LP64_OFF64\t105 /* user */\n#define\t_SC_V6_LPBIG_OFFBIG\t106 /* user */\n#define\t_SC_IPV6\t\t118\n#define\t_SC_RAW_SOCKETS\t\t119\n#define\t_SC_SYMLOOP_MAX\t\t120\n#endif\n\n#if __XSI_VISIBLE\n#define\t_SC_ATEXIT_MAX\t\t107 /* user */\n#define\t_SC_IOV_MAX\t\t56\n#define\t_SC_PAGE_SIZE\t\t_SC_PAGESIZE\n#define\t_SC_XOPEN_CRYPT\t\t108 /* user */\n#define\t_SC_XOPEN_ENH_I18N\t109 /* user */\n#define\t_SC_XOPEN_LEGACY\t110 /* user */\n#define\t_SC_XOPEN_REALTIME\t111\n#define\t_SC_XOPEN_REALTIME_THREADS 112\n#define\t_SC_XOPEN_SHM\t\t113\n#define\t_SC_XOPEN_STREAMS\t114\n#define\t_SC_XOPEN_UNIX\t\t115\n#define\t_SC_XOPEN_VERSION\t116\n#define\t_SC_XOPEN_XCU_VERSION\t117 /* user */\n#endif\n\n#if __BSD_VISIBLE\n#define\t_SC_NPROCESSORS_CONF\t57\n#define\t_SC_NPROCESSORS_ONLN\t58\n#define\t_SC_CPUSET_SIZE\t\t122\n#endif\n\n/* Extensions found in Solaris and Linux. */\n#define\t_SC_PHYS_PAGES\t\t121\n\n/* Keys for the confstr(3) function. */\n#if __POSIX_VISIBLE >= 199209\n#define\t_CS_PATH\t\t1\t/* default value of PATH */\n#endif\n\n#if __POSIX_VISIBLE >= 200112\n#define\t_CS_POSIX_V6_ILP32_OFF32_CFLAGS\t\t2\n#define\t_CS_POSIX_V6_ILP32_OFF32_LDFLAGS\t3\n#define\t_CS_POSIX_V6_ILP32_OFF32_LIBS\t\t4\n#define\t_CS_POSIX_V6_ILP32_OFFBIG_CFLAGS\t5\n#define\t_CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS\t6\n#define\t_CS_POSIX_V6_ILP32_OFFBIG_LIBS\t\t7\n#define\t_CS_POSIX_V6_LP64_OFF64_CFLAGS\t\t8\n#define\t_CS_POSIX_V6_LP64_OFF64_LDFLAGS\t\t9\n#define\t_CS_POSIX_V6_LP64_OFF64_LIBS\t\t10\n#define\t_CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS\t11\n#define\t_CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS\t12\n#define\t_CS_POSIX_V6_LPBIG_OFFBIG_LIBS\t\t13\n#define\t_CS_POSIX_V6_WIDTH_RESTRICTED_ENVS\t14\n#endif\n\n__BEGIN_DECLS\n/* 1003.1-1990 */\nvoid\t _exit(int) __dead2;\nint\t access(const char *, int);\nunsigned int\t alarm(unsigned int);\nint\t chdir(const char *);\nint\t chown(const char *, uid_t, gid_t);\nint\t close(int);\nvoid\t closefrom(int);\nint\t dup(int);\nint\t dup2(int, int);\nint\t execl(const char *, const char *, ...);\nint\t execle(const char *, const char *, ...);\nint\t execlp(const char *, const char *, ...);\nint\t execv(const char *, char * const *);\nint\t execve(const char *, char * const *, char * const *);\nint\t execvp(const char *, char * const *);\npid_t\t fork(void);\nlong\t fpathconf(int, int);\nchar\t*getcwd(char *, size_t);\ngid_t\t getegid(void);\nuid_t\t geteuid(void);\ngid_t\t getgid(void);\nint\t getgroups(int, gid_t []);\nchar\t*getlogin(void);\npid_t\t getpgrp(void);\npid_t\t getpid(void);\npid_t\t getppid(void);\nuid_t\t getuid(void);\nint\t isatty(int);\nint\t link(const char *, const char *);\n#ifndef _LSEEK_DECLARED\n#define\t_LSEEK_DECLARED\noff_t\t lseek(int, off_t, int);\n#endif\nlong\t pathconf(const char *, int);\nint\t pause(void);\nint\t pipe(int *);\nssize_t\t read(int, void *, size_t);\nint\t rmdir(const char *);\nint\t setgid(gid_t);\nint\t setpgid(pid_t, pid_t);\npid_t\t setsid(void);\nint\t setuid(uid_t);\nunsigned int\t sleep(unsigned int);\nlong\t sysconf(int);\npid_t\t tcgetpgrp(int);\nint\t tcsetpgrp(int, pid_t);\nchar\t*ttyname(int);\nint\tttyname_r(int, char *, size_t);\nint\t unlink(const char *);\nssize_t\t write(int, const void *, size_t);\n\n/* 1003.2-1992 */\n#if __POSIX_VISIBLE >= 199209 || __XSI_VISIBLE\nsize_t\t confstr(int, char *, size_t);\n#ifndef _GETOPT_DECLARED\n#define\t_GETOPT_DECLARED\nint\t getopt(int, char * const [], const char *);\n\nextern char *optarg;\t\t\t/* getopt(3) external variables */\nextern int optind, opterr, optopt;\n#endif /* _GETOPT_DECLARED */\n#endif\n\n/* ISO/IEC 9945-1: 1996 */\n#if __POSIX_VISIBLE >= 199506 || __XSI_VISIBLE\nint\t fsync(int);\n\n/*\n * ftruncate() was in the POSIX Realtime Extension (it's used for shared\n * memory), but truncate() was not.\n */\n#ifndef _FTRUNCATE_DECLARED\n#define\t_FTRUNCATE_DECLARED\nint\t ftruncate(int, off_t);\n#endif\n#endif\n\n#if __POSIX_VISIBLE >= 199506\nint\t getlogin_r(char *, int);\n#endif\n\n/* 1003.1-2001 */\n#if __POSIX_VISIBLE >= 200112 || __XSI_VISIBLE\nint\t fchown(int, uid_t, gid_t);\nssize_t\t readlink(const char * __restrict, char * __restrict, size_t);\n#endif\n#if __POSIX_VISIBLE >= 200112\nint\t gethostname(char *, size_t);\nint\t setegid(gid_t);\nint\t seteuid(uid_t);\n#endif\n\n/* 1003.1-2008 */\n#if __POSIX_VISIBLE >= 200809 || __XSI_VISIBLE\nint\t getsid(pid_t _pid);\nint\t fchdir(int);\nint\t getpgid(pid_t _pid);\nint\t lchown(const char *, uid_t, gid_t);\nssize_t\t pread(int, void *, size_t, off_t);\nssize_t\t pwrite(int, const void *, size_t, off_t);\n\n/* See comment at ftruncate() above. */\n#ifndef _TRUNCATE_DECLARED\n#define\t_TRUNCATE_DECLARED\nint\t truncate(const char *, off_t);\n#endif\n#endif /* __POSIX_VISIBLE >= 200809 || __XSI_VISIBLE */\n\n#if __POSIX_VISIBLE >= 200809 || __BSD_VISIBLE\nint\tfaccessat(int, const char *, int, int);\nint\tfchownat(int, const char *, uid_t, gid_t, int);\nint\tfexecve(int, char *const [], char *const []);\nint\tlinkat(int, const char *, int, const char *, int);\nssize_t\treadlinkat(int, const char * __restrict, char * __restrict, size_t);\nint\tsymlinkat(const char *, int, const char *);\nint\tunlinkat(int, const char *, int);\n#endif /* __POSIX_VISIBLE >= 200809 || __BSD_VISIBLE */\n\n/*\n * symlink() was originally in POSIX.1a, which was withdrawn after\n * being overtaken by events (1003.1-2001).  It was in XPG4.2, and of\n * course has been in BSD since 4.2.\n */\n#if __POSIX_VISIBLE >= 200112 || __XSI_VISIBLE >= 402 || __BSD_VISIBLE\nint\t symlink(const char * __restrict, const char * __restrict);\n#endif\n\n/* X/Open System Interfaces */\n#if __XSI_VISIBLE\nchar\t*crypt(const char *, const char *);\n/* char\t*ctermid(char *); */\t\t/* XXX ??? */\nint\t encrypt(char *, int);\nlong\t gethostid(void);\nint\t lockf(int, int, off_t);\nint\t nice(int);\nint\t setpgrp(pid_t _pid, pid_t _pgrp); /* obsoleted by setpgid() */\nint\t setregid(gid_t, gid_t);\nint\t setreuid(uid_t, uid_t);\n\n#ifndef _SWAB_DECLARED\n#define _SWAB_DECLARED\nvoid\t swab(const void * __restrict, void * __restrict, ssize_t);\n#endif /* _SWAB_DECLARED */\n\nvoid\t sync(void);\n\n#endif /* __XSI_VISIBLE */\n\n#if (__XSI_VISIBLE && __XSI_VISIBLE <= 500) || __BSD_VISIBLE\nint\t brk(const void *);\nint\t chroot(const char *);\nint\t getdtablesize(void);\nint\t getpagesize(void) __pure2;\nchar\t*getpass(const char *);\nvoid\t*sbrk(intptr_t);\n#endif\n\n#if (__XSI_VISIBLE && __XSI_VISIBLE <= 600) || __BSD_VISIBLE\nchar\t*getwd(char *);\t\t\t/* obsoleted by getcwd() */\nuseconds_t\n\t ualarm(useconds_t, useconds_t);\nint\t usleep(useconds_t);\npid_t\t vfork(void);\n#endif\n\n#if __BSD_VISIBLE\nstruct timeval;\t\t\t\t/* select(2) */\nint\t acct(const char *);\nint\t async_daemon(void);\nint\t check_utility_compat(const char *);\nconst char *\n\t crypt_get_format(void);\nint\t crypt_set_format(const char *);\nint\t des_cipher(const char *, char *, long, int);\nint\t des_setkey(const char *key);\nint\t eaccess(const char *, int);\nvoid\t endusershell(void);\nint\t exect(const char *, char * const *, char * const *);\nint\t execvP(const char *, const char *, char * const *);\nint\t feature_present(const char *);\nchar\t*fflagstostr(u_long);\nint\t getdomainname(char *, int);\nint\t getgrouplist(const char *, gid_t, gid_t *, int *);\nint\t getloginclass(char *, size_t);\nmode_t\t getmode(const void *, mode_t);\nint\t getosreldate(void);\nint\t getpeereid(int, uid_t *, gid_t *);\nint\t getresgid(gid_t *, gid_t *, gid_t *);\nint\t getresuid(uid_t *, uid_t *, uid_t *);\nchar\t*getusershell(void);\nint\t initgroups(const char *, gid_t);\nint\t iruserok(unsigned long, int, const char *, const char *);\nint\t iruserok_sa(const void *, int, int, const char *, const char *);\nint\t issetugid(void);\nvoid\t__FreeBSD_libc_enter_restricted_mode(void);\nlong\t lpathconf(const char *, int);\n#ifndef _MKDTEMP_DECLARED\nchar\t*mkdtemp(char *);\n#define\t_MKDTEMP_DECLARED\n#endif\n#ifndef\t_MKNOD_DECLARED\nint\t mknod(const char *, mode_t, dev_t);\n#define\t_MKNOD_DECLARED\n#endif\n#ifndef _MKSTEMP_DECLARED\nint\t mkstemp(char *);\n#define\t_MKSTEMP_DECLARED\n#endif\nint\t mkstemps(char *, int);\n#ifndef _MKTEMP_DECLARED\nchar\t*mktemp(char *);\n#define\t_MKTEMP_DECLARED\n#endif\nint\t nfssvc(int, void *);\nint\t nlm_syscall(int, int, int, char **);\nint\t profil(char *, size_t, vm_offset_t, int);\nint\t rcmd(char **, int, const char *, const char *, const char *, int *);\nint\t rcmd_af(char **, int, const char *,\n\t\tconst char *, const char *, int *, int);\nint\t rcmdsh(char **, int, const char *,\n\t\tconst char *, const char *, const char *);\nchar\t*re_comp(const char *);\nint\t re_exec(const char *);\nint\t reboot(int);\nint\t revoke(const char *);\npid_t\t rfork(int);\npid_t\t rfork_thread(int, void *, int (*)(void *), void *);\nint\t rresvport(int *);\nint\t rresvport_af(int *, int);\nint\t ruserok(const char *, int, const char *, const char *);\n#if __BSD_VISIBLE\n#ifndef _SELECT_DECLARED\n#define\t_SELECT_DECLARED\nint\t select(int, fd_set *, fd_set *, fd_set *, struct timeval *);\n#endif\n#endif\nint\t setdomainname(const char *, int);\nint\t setgroups(int, const gid_t *);\nvoid\t sethostid(long);\nint\t sethostname(const char *, int);\n#ifndef _SETKEY_DECLARED\nint\t setkey(const char *);\n#define\t_SETKEY_DECLARED\n#endif\nint\t setlogin(const char *);\nint\t setloginclass(const char *);\nvoid\t*setmode(const char *);\nvoid\t setproctitle(const char *_fmt, ...) __printf0like(1, 2);\nint\t setresgid(gid_t, gid_t, gid_t);\nint\t setresuid(uid_t, uid_t, uid_t);\nint\t setrgid(gid_t);\nint\t setruid(uid_t);\nvoid\t setusershell(void);\nint\t strtofflags(char **, u_long *, u_long *);\nint\t swapon(const char *);\nint\t swapoff(const char *);\nint\t syscall(int, ...);\noff_t\t __syscall(quad_t, ...);\nint\t undelete(const char *);\nint\t unwhiteout(const char *);\nvoid\t*valloc(size_t);\t\t\t/* obsoleted by malloc() */\n\n#ifndef _OPTRESET_DECLARED\n#define\t_OPTRESET_DECLARED\nextern int optreset;\t\t\t/* getopt(3) external variable */\n#endif\n#endif /* __BSD_VISIBLE */\n__END_DECLS\n\n#endif /* !_UNISTD_H_ */\n"
  },
  {
    "path": "freebsd-headers/usb.h",
    "content": "/* $FreeBSD: release/9.0.0/lib/libusb/usb.h 224085 2011-07-16 08:29:12Z hselasky $ */\n/*-\n * Copyright (c) 2008 Hans Petter Selasky. All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n */\n\n#ifndef _LIBUSB20_COMPAT_01_H_\n#define\t_LIBUSB20_COMPAT_01_H_\n\n#include <sys/param.h>\n#include <sys/endian.h>\n\n#include <stdint.h>\n\n/* USB interface class codes */\n\n#define\tUSB_CLASS_PER_INTERFACE         0\n#define\tUSB_CLASS_AUDIO                 1\n#define\tUSB_CLASS_COMM                  2\n#define\tUSB_CLASS_HID                   3\n#define\tUSB_CLASS_PRINTER               7\n#define\tUSB_CLASS_PTP                   6\n#define\tUSB_CLASS_MASS_STORAGE          8\n#define\tUSB_CLASS_HUB                   9\n#define\tUSB_CLASS_DATA                  10\n#define\tUSB_CLASS_VENDOR_SPEC           0xff\n\n/* USB descriptor types */\n\n#define\tUSB_DT_DEVICE                   0x01\n#define\tUSB_DT_CONFIG                   0x02\n#define\tUSB_DT_STRING                   0x03\n#define\tUSB_DT_INTERFACE                0x04\n#define\tUSB_DT_ENDPOINT                 0x05\n\n#define\tUSB_DT_HID                      0x21\n#define\tUSB_DT_REPORT                   0x22\n#define\tUSB_DT_PHYSICAL                 0x23\n#define\tUSB_DT_HUB                      0x29\n\n/* USB descriptor type sizes */\n\n#define\tUSB_DT_DEVICE_SIZE              18\n#define\tUSB_DT_CONFIG_SIZE              9\n#define\tUSB_DT_INTERFACE_SIZE           9\n#define\tUSB_DT_ENDPOINT_SIZE            7\n#define\tUSB_DT_ENDPOINT_AUDIO_SIZE      9\n#define\tUSB_DT_HUB_NONVAR_SIZE          7\n\n/* USB descriptor header */\nstruct usb_descriptor_header {\n\tuint8_t\tbLength;\n\tuint8_t\tbDescriptorType;\n};\n\n/* USB string descriptor */\nstruct usb_string_descriptor {\n\tuint8_t\tbLength;\n\tuint8_t\tbDescriptorType;\n\tuint16_t wData[1];\n};\n\n/* USB HID descriptor */\nstruct usb_hid_descriptor {\n\tuint8_t\tbLength;\n\tuint8_t\tbDescriptorType;\n\tuint16_t bcdHID;\n\tuint8_t\tbCountryCode;\n\tuint8_t\tbNumDescriptors;\n\t/* uint8_t  bReportDescriptorType; */\n\t/* uint16_t wDescriptorLength; */\n\t/* ... */\n};\n\n/* USB endpoint descriptor */\n#define\tUSB_MAXENDPOINTS        32\nstruct usb_endpoint_descriptor {\n\tuint8_t\tbLength;\n\tuint8_t\tbDescriptorType;\n\tuint8_t\tbEndpointAddress;\n#define\tUSB_ENDPOINT_ADDRESS_MASK       0x0f\n#define\tUSB_ENDPOINT_DIR_MASK           0x80\n\tuint8_t\tbmAttributes;\n#define\tUSB_ENDPOINT_TYPE_MASK          0x03\n#define\tUSB_ENDPOINT_TYPE_CONTROL       0\n#define\tUSB_ENDPOINT_TYPE_ISOCHRONOUS   1\n#define\tUSB_ENDPOINT_TYPE_BULK          2\n#define\tUSB_ENDPOINT_TYPE_INTERRUPT     3\n\tuint16_t wMaxPacketSize;\n\tuint8_t\tbInterval;\n\tuint8_t\tbRefresh;\n\tuint8_t\tbSynchAddress;\n\n\tuint8_t *extra;\t\t\t/* Extra descriptors */\n\tint\textralen;\n};\n\n/* USB interface descriptor */\n#define\tUSB_MAXINTERFACES       32\nstruct usb_interface_descriptor {\n\tuint8_t\tbLength;\n\tuint8_t\tbDescriptorType;\n\tuint8_t\tbInterfaceNumber;\n\tuint8_t\tbAlternateSetting;\n\tuint8_t\tbNumEndpoints;\n\tuint8_t\tbInterfaceClass;\n\tuint8_t\tbInterfaceSubClass;\n\tuint8_t\tbInterfaceProtocol;\n\tuint8_t\tiInterface;\n\n\tstruct usb_endpoint_descriptor *endpoint;\n\n\tuint8_t *extra;\t\t\t/* Extra descriptors */\n\tint\textralen;\n};\n\n#define\tUSB_MAXALTSETTING       128\t/* Hard limit */\nstruct usb_interface {\n\tstruct usb_interface_descriptor *altsetting;\n\n\tint\tnum_altsetting;\n};\n\n/* USB configuration descriptor */\n#define\tUSB_MAXCONFIG           8\nstruct usb_config_descriptor {\n\tuint8_t\tbLength;\n\tuint8_t\tbDescriptorType;\n\tuint16_t wTotalLength;\n\tuint8_t\tbNumInterfaces;\n\tuint8_t\tbConfigurationValue;\n\tuint8_t\tiConfiguration;\n\tuint8_t\tbmAttributes;\n\tuint8_t\tMaxPower;\n\n\tstruct usb_interface *interface;\n\n\tuint8_t *extra;\t\t\t/* Extra descriptors */\n\tint\textralen;\n};\n\n/* USB device descriptor */\nstruct usb_device_descriptor {\n\tuint8_t\tbLength;\n\tuint8_t\tbDescriptorType;\n\tuint16_t bcdUSB;\n\tuint8_t\tbDeviceClass;\n\tuint8_t\tbDeviceSubClass;\n\tuint8_t\tbDeviceProtocol;\n\tuint8_t\tbMaxPacketSize0;\n\tuint16_t idVendor;\n\tuint16_t idProduct;\n\tuint16_t bcdDevice;\n\tuint8_t\tiManufacturer;\n\tuint8_t\tiProduct;\n\tuint8_t\tiSerialNumber;\n\tuint8_t\tbNumConfigurations;\n};\n\n/* USB setup packet */\nstruct usb_ctrl_setup {\n\tuint8_t\tbRequestType;\n#define\tUSB_RECIP_DEVICE                0x00\n#define\tUSB_RECIP_INTERFACE             0x01\n#define\tUSB_RECIP_ENDPOINT              0x02\n#define\tUSB_RECIP_OTHER                 0x03\n#define\tUSB_TYPE_STANDARD               (0x00 << 5)\n#define\tUSB_TYPE_CLASS                  (0x01 << 5)\n#define\tUSB_TYPE_VENDOR                 (0x02 << 5)\n#define\tUSB_TYPE_RESERVED               (0x03 << 5)\n#define\tUSB_ENDPOINT_IN                 0x80\n#define\tUSB_ENDPOINT_OUT                0x00\n\tuint8_t\tbRequest;\n#define\tUSB_REQ_GET_STATUS              0x00\n#define\tUSB_REQ_CLEAR_FEATURE           0x01\n#define\tUSB_REQ_SET_FEATURE             0x03\n#define\tUSB_REQ_SET_ADDRESS             0x05\n#define\tUSB_REQ_GET_DESCRIPTOR          0x06\n#define\tUSB_REQ_SET_DESCRIPTOR          0x07\n#define\tUSB_REQ_GET_CONFIGURATION       0x08\n#define\tUSB_REQ_SET_CONFIGURATION       0x09\n#define\tUSB_REQ_GET_INTERFACE           0x0A\n#define\tUSB_REQ_SET_INTERFACE           0x0B\n#define\tUSB_REQ_SYNCH_FRAME             0x0C\n\tuint16_t wValue;\n\tuint16_t wIndex;\n\tuint16_t wLength;\n};\n\n/* Error codes */\n#define\tUSB_ERROR_BEGIN                 500000\n\n/* Byte swapping */\n#define\tUSB_LE16_TO_CPU(x) le16toh(x)\n\n/* Data types */\nstruct usb_device;\nstruct usb_bus;\n\n/*\n * To maintain compatibility with applications already built with libusb,\n * we must only add entries to the end of this structure. NEVER delete or\n * move members and only change types if you really know what you're doing.\n */\nstruct usb_device {\n\tstruct usb_device *next;\n\tstruct usb_device *prev;\n\n\tchar\tfilename[PATH_MAX + 1];\n\n\tstruct usb_bus *bus;\n\n\tstruct usb_device_descriptor descriptor;\n\tstruct usb_config_descriptor *config;\n\n\tvoid   *dev;\n\n\tuint8_t\tdevnum;\n\n\tuint8_t\tnum_children;\n\tstruct usb_device **children;\n};\n\nstruct usb_bus {\n\tstruct usb_bus *next;\n\tstruct usb_bus *prev;\n\n\tchar\tdirname[PATH_MAX + 1];\n\n\tstruct usb_device *devices;\n\tuint32_t location;\n\n\tstruct usb_device *root_dev;\n};\n\nstruct usb_dev_handle;\ntypedef struct usb_dev_handle usb_dev_handle;\n\n/* Variables */\nextern struct usb_bus *usb_busses;\n\n#ifdef __cplusplus\nextern\t\"C\" {\n#endif\n#if 0\n}\t\t\t\t\t/* style */\n\n#endif\n\n/* Function prototypes from \"libusb20_compat01.c\" */\n\nusb_dev_handle *usb_open(struct usb_device *dev);\nint\tusb_close(usb_dev_handle * dev);\nint\tusb_get_string(usb_dev_handle * dev, int index, int langid, char *buf, size_t buflen);\nint\tusb_get_string_simple(usb_dev_handle * dev, int index, char *buf, size_t buflen);\nint\tusb_get_descriptor_by_endpoint(usb_dev_handle * udev, int ep, uint8_t type, uint8_t index, void *buf, int size);\nint\tusb_get_descriptor(usb_dev_handle * udev, uint8_t type, uint8_t index, void *buf, int size);\nint\tusb_parse_descriptor(uint8_t *source, char *description, void *dest);\nint\tusb_parse_configuration(struct usb_config_descriptor *config, uint8_t *buffer);\nvoid\tusb_destroy_configuration(struct usb_device *dev);\nvoid\tusb_fetch_and_parse_descriptors(usb_dev_handle * udev);\nint\tusb_bulk_write(usb_dev_handle * dev, int ep, char *bytes, int size, int timeout);\nint\tusb_bulk_read(usb_dev_handle * dev, int ep, char *bytes, int size, int timeout);\nint\tusb_interrupt_write(usb_dev_handle * dev, int ep, char *bytes, int size, int timeout);\nint\tusb_interrupt_read(usb_dev_handle * dev, int ep, char *bytes, int size, int timeout);\nint\tusb_control_msg(usb_dev_handle * dev, int requesttype, int request, int value, int index, char *bytes, int size, int timeout);\nint\tusb_set_configuration(usb_dev_handle * dev, int configuration);\nint\tusb_claim_interface(usb_dev_handle * dev, int interface);\nint\tusb_release_interface(usb_dev_handle * dev, int interface);\nint\tusb_set_altinterface(usb_dev_handle * dev, int alternate);\nint\tusb_resetep(usb_dev_handle * dev, unsigned int ep);\nint\tusb_clear_halt(usb_dev_handle * dev, unsigned int ep);\nint\tusb_reset(usb_dev_handle * dev);\nint\tusb_check_connected(usb_dev_handle * dev);\nconst char *usb_strerror(void);\nvoid\tusb_init(void);\nvoid\tusb_set_debug(int level);\nint\tusb_find_busses(void);\nint\tusb_find_devices(void);\nstruct usb_device *usb_device(usb_dev_handle * dev);\nstruct usb_bus *usb_get_busses(void);\nint\tusb_get_driver_np(usb_dev_handle * dev, int interface, char *name, int namelen);\nint\tusb_detach_kernel_driver_np(usb_dev_handle * dev, int interface);\n\n#if 0\n{\t\t\t\t\t/* style */\n#endif\n#ifdef __cplusplus\n}\n\n#endif\n\n#endif\t\t\t\t\t/* _LIBUSB20_COMPAT01_H_ */\n"
  },
  {
    "path": "freebsd-headers/usbhid.h",
    "content": "/*\t$NetBSD: usb.h,v 1.8 2000/08/13 22:22:02 augustss Exp $\t*/\n\n/*\n * Copyright (c) 1999 Lennart Augustsson <augustss@netbsd.org>\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/lib/libusbhid/usbhid.h 208023 2010-05-13 02:03:00Z thompsa $\n *\n */\n\n#include <stdint.h>\n\ntypedef struct report_desc *report_desc_t;\n\ntypedef struct hid_data *hid_data_t;\n\ntypedef enum hid_kind {\n\thid_input, hid_output, hid_feature, hid_collection, hid_endcollection\n} hid_kind_t;\n\ntypedef struct hid_item {\n\t/* Global */\n\tuint32_t _usage_page;\n\tint32_t logical_minimum;\n\tint32_t logical_maximum;\n\tint32_t physical_minimum;\n\tint32_t physical_maximum;\n\tint32_t unit_exponent;\n\tint32_t unit;\n\tint32_t report_size;\n\tint32_t report_ID;\n#define NO_REPORT_ID 0\n\tint32_t report_count;\n\t/* Local */\n\tuint32_t usage;\n\tint32_t usage_minimum;\n\tint32_t usage_maximum;\n\tint32_t designator_index;\n\tint32_t designator_minimum;\n\tint32_t designator_maximum;\n\tint32_t string_index;\n\tint32_t string_minimum;\n\tint32_t string_maximum;\n\tint32_t set_delimiter;\n\t/* Misc */\n\tint32_t collection;\n\tint\tcollevel;\n\tenum hid_kind kind;\n\tuint32_t flags;\n\t/* Location */\n\tuint32_t pos;\n\t/* unused */\n\tstruct hid_item *next;\n} hid_item_t;\n\n#define HID_PAGE(u) (((u) >> 16) & 0xffff)\n#define HID_USAGE(u) ((u) & 0xffff)\n\n__BEGIN_DECLS\n\n/* Obtaining a report descriptor, descr.c: */\nreport_desc_t hid_get_report_desc(int file);\nreport_desc_t hid_use_report_desc(unsigned char *data, unsigned int size);\nvoid hid_dispose_report_desc(report_desc_t);\nint hid_get_report_id(int file);\nint hid_set_immed(int fd, int enable);\n\n/* Parsing of a HID report descriptor, parse.c: */\nhid_data_t hid_start_parse(report_desc_t d, int kindset, int id);\nvoid hid_end_parse(hid_data_t s);\nint hid_get_item(hid_data_t s, hid_item_t *h);\nint hid_report_size(report_desc_t d, enum hid_kind k, int id);\nint hid_locate(report_desc_t d, unsigned int usage, enum hid_kind k,\n    hid_item_t *h, int id);\n\n/* Conversion to/from usage names, usage.c: */\nconst char *hid_usage_page(int i);\nconst char *hid_usage_in_page(unsigned int u);\nvoid hid_init(const char *file);\nint hid_parse_usage_in_page(const char *name);\nint hid_parse_usage_page(const char *name);\n\n/* Extracting/insertion of data, data.c: */\nint32_t hid_get_data(const void *p, const hid_item_t *h);\nvoid hid_set_data(void *p, const hid_item_t *h, int32_t data);\n\n__END_DECLS\n"
  },
  {
    "path": "freebsd-headers/utempter.h",
    "content": "/*-\n * Copyright (c) 2009 Ed Schouten <ed@FreeBSD.org>\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/lib/libulog/utempter.h 200185 2009-12-06 20:30:21Z ed $\n */\n\n#ifndef _UTEMPTER_H_\n#define\t_UTEMPTER_H_\n\n#include <sys/cdefs.h>\n\n__BEGIN_DECLS\nint\tutempter_add_record(int, const char *);\nint\tutempter_remove_added_record(void);\nint\tutempter_remove_record(int);\n\nvoid\taddToUtmp(const char *, const char *, int);\nvoid\tremoveFromUtmp(void);\nvoid\tremoveLineFromUtmp(const char *, int);\n__END_DECLS\n\n#endif /* !_UTEMPTER_H_ */\n"
  },
  {
    "path": "freebsd-headers/utime.h",
    "content": "/*-\n * Copyright (c) 1990, 1993\n *\tThe Regents of the University of California.  All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t@(#)utime.h\t8.1 (Berkeley) 6/2/93\n * $FreeBSD: release/9.0.0/include/utime.h 203964 2010-02-16 19:39:50Z imp $\n */\n\n#ifndef\t_UTIME_H_\n#define\t_UTIME_H_\n\n#include <sys/cdefs.h>\n#include <sys/_types.h>\n\n#ifndef _TIME_T_DECLARED\ntypedef\t__time_t\ttime_t;\n#define\t_TIME_T_DECLARED\n#endif\n\nstruct utimbuf {\n\ttime_t actime;\t\t/* Access time */\n\ttime_t modtime;\t\t/* Modification time */\n};\n\n__BEGIN_DECLS\nint utime(const char *, const struct utimbuf *);\n__END_DECLS\n\n#endif /* !_UTIME_H_ */\n"
  },
  {
    "path": "freebsd-headers/utmpx.h",
    "content": "/*-\n * Copyright (c) 2010 Ed Schouten <ed@FreeBSD.org>\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/include/utmpx.h 202188 2010-01-13 17:29:55Z ed $\n */\n\n#ifndef _UTMPX_H_\n#define\t_UTMPX_H_\n\n#include <sys/cdefs.h>\n#include <sys/_timeval.h>\n#include <sys/_types.h>\n\n#ifndef _PID_T_DECLARED\ntypedef\t__pid_t\t\tpid_t;\n#define\t_PID_T_DECLARED\n#endif\n\nstruct utmpx {\n\tshort\t\tut_type;\t/* Type of entry. */\n\tstruct timeval\tut_tv;\t\t/* Time entry was made. */\n\tchar\t\tut_id[8];\t/* Record identifier. */\n\tpid_t\t\tut_pid;\t\t/* Process ID. */\n\tchar\t\tut_user[32];\t/* User login name. */\n\tchar\t\tut_line[16];\t/* Device name. */\n#if __BSD_VISIBLE\n\tchar\t\tut_host[128];\t/* Remote hostname. */\n#else\n\tchar\t\t__ut_host[128];\n#endif\n\tchar\t\t__ut_spare[64];\n};\n\n#define\tEMPTY\t\t0\t/* No valid user accounting information. */\n#define\tBOOT_TIME\t1\t/* Time of system boot. */\n#define\tOLD_TIME\t2\t/* Time when system clock changed. */\n#define\tNEW_TIME\t3\t/* Time after system clock changed. */\n#define\tUSER_PROCESS\t4\t/* A process. */\n#define\tINIT_PROCESS\t5\t/* A process spawned by the init process. */\n#define\tLOGIN_PROCESS\t6\t/* The session leader of a logged-in user. */\n#define\tDEAD_PROCESS\t7\t/* A session leader who has exited. */\n#if __BSD_VISIBLE\n#define\tSHUTDOWN_TIME\t8\t/* Time of system shutdown. */\n#endif\n\n#if __BSD_VISIBLE\n#define\tUTXDB_ACTIVE\t0\t/* Active login sessions. */\n#define\tUTXDB_LASTLOGIN\t1\t/* Last login sessions. */\n#define\tUTXDB_LOG\t2\t/* Log indexed by time. */\n#endif\n\n__BEGIN_DECLS\nvoid\tendutxent(void);\nstruct utmpx *getutxent(void);\nstruct utmpx *getutxid(const struct utmpx *);\nstruct utmpx *getutxline(const struct utmpx *);\nstruct utmpx *pututxline(const struct utmpx *);\nvoid\tsetutxent(void);\n\n#if __BSD_VISIBLE\nstruct utmpx *getutxuser(const char *);\nint\tsetutxdb(int, const char *);\n#endif\n__END_DECLS\n\n#endif /* !_UTMPX_H_ */\n"
  },
  {
    "path": "freebsd-headers/uuid.h",
    "content": "/*-\n * Copyright (c) 2002,2005 Marcel Moolenaar\n * Copyright (c) 2002 Hiten Mahesh Pandya\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/include/uuid.h 183057 2008-09-15 23:47:19Z emax $\n */\n\n#ifndef _UUID_H_\n#define\t_UUID_H_\n\n#include <sys/types.h>\n#include <sys/uuid.h>\n\n/*\n * This implementation mostly conforms to the DCE 1.1 specification.\n * See Also:\n *\tuuidgen(1), uuidgen(2), uuid(3)\n */\n\n/* Status codes returned by the functions. */\n#define\tuuid_s_ok\t\t\t0\n#define\tuuid_s_bad_version\t\t1\n#define\tuuid_s_invalid_string_uuid\t2\n#define\tuuid_s_no_memory\t\t3\n\n__BEGIN_DECLS\nint32_t\tuuid_compare(const uuid_t *, const uuid_t *, uint32_t *);\nvoid\tuuid_create(uuid_t *, uint32_t *);\nvoid\tuuid_create_nil(uuid_t *, uint32_t *);\nint32_t\tuuid_equal(const uuid_t *, const uuid_t *, uint32_t *);\nvoid\tuuid_from_string(const char *, uuid_t *, uint32_t *);\nuint16_t uuid_hash(const uuid_t *, uint32_t *);\nint32_t\tuuid_is_nil(const uuid_t *, uint32_t *);\nvoid\tuuid_to_string(const uuid_t *, char **, uint32_t *);\nvoid\tuuid_enc_le(void *, const uuid_t *);\nvoid\tuuid_dec_le(const void *, uuid_t *);\nvoid\tuuid_enc_be(void *, const uuid_t *);\nvoid\tuuid_dec_be(const void *, uuid_t *);\n__END_DECLS\n\n#endif\t/* _UUID_H_ */\n"
  },
  {
    "path": "freebsd-headers/varargs.h",
    "content": "/*-\n * Copyright (c) 2003 Alexander Kabaev\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/include/varargs.h 119630 2003-09-01 03:28:25Z kan $\n */\n\n#ifndef _VARARGS_H_\n#define\t_VARARGS_H_\n\n#if defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ > 2 || __GNUC__ >= 4)\n\n#error \"<varargs.h> is obsolete with this version of GCC.\"\n#error \"Change your code to use <stdarg.h> instead.\"\n\n#else\t/* ! __GNUC__ post GCC 3.3 */\n\n#include <machine/varargs.h>\n\n#endif /* __GNUC__ post GCC 3.3 */\n\n#endif /* !_VARARGS_H_ */\n"
  },
  {
    "path": "freebsd-headers/vgl.h",
    "content": "/*-\n * Copyright (c) 1991-1997 Sren Schmidt\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer\n *    in this position and unchanged.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. The name of the author may not be used to endorse or promote products\n *    derived from this software without specific prior written permission\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR\n * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES\n * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,\n * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF\n * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/lib/libvgl/vgl.h 97748 2002-06-02 20:05:59Z schweikh $\n */\n\n#ifndef _VGL_H_\n#define _VGL_H_\n\n#include <stdlib.h>\n#include <unistd.h>\n#include <string.h>\n#include <machine/cpufunc.h>\n\ntypedef unsigned char byte;\ntypedef struct {\n  byte \tType;\n  int  \tXsize, Ysize;\n  int  \tVXsize, VYsize;\n  int   Xorigin, Yorigin;\n  byte \t*Bitmap;\n  int\tPixelBytes;\n} VGLBitmap;\n\n#define VGLBITMAP_INITIALIZER(t, x, y, bits)\t\\\n\t{ (t), (x), (y), (x), (y), 0, 0, (bits) }\n\n/*\n * Defined Type's\n */\n#define MEMBUF\t\t0\n#define VIDBUF4\t\t1\n#define VIDBUF8\t\t2\n#define VIDBUF8X\t3\n#define VIDBUF8S\t4\n#define VIDBUF4S\t5\n#define VIDBUF16\t6\t\t/* Direct Color linear buffer */\n#define VIDBUF24\t7\t\t/* Direct Color linear buffer */\n#define VIDBUF32\t8\t\t/* Direct Color linear buffer */\n#define VIDBUF16S\t9\t\t/* Direct Color segmented buffer */\n#define VIDBUF24S\t10\t\t/* Direct Color segmented buffer */\n#define VIDBUF32S\t11\t\t/* Direct Color segmented buffer */\n#define NOBUF\t\t255\n\ntypedef struct VGLText {\n  byte\tWidth, Height;\n  byte\t*BitmapArray;\n} VGLText;\n\ntypedef struct VGLObject {\n  int\t  \tId;\n  int\t  \tType;\n  int\t  \tStatus;\n  int\t  \tXpos, Ypos;\n  int\t  \tXhot, Yhot;\n  VGLBitmap \t*Image;\n  VGLBitmap \t*Mask;\n  int\t\t(*CallBackFunction)();\n} VGLObject;\n\n#define MOUSE_IMG_SIZE\t\t16\n#define VGL_MOUSEHIDE\t\t0\n#define VGL_MOUSESHOW\t\t1\n#define VGL_MOUSEFREEZE\t\t0\n#define VGL_MOUSEUNFREEZE\t1\n#define VGL_DIR_RIGHT\t\t0\n#define VGL_DIR_UP\t\t1\n#define VGL_DIR_LEFT\t\t2\n#define VGL_DIR_DOWN\t\t3\n#define VGL_RAWKEYS\t\t1\n#define VGL_CODEKEYS\t\t2\n#define VGL_XLATEKEYS\t\t3\n\nextern video_adapter_info_t\tVGLAdpInfo;\nextern video_info_t\t\tVGLModeInfo;\nextern VGLBitmap \t\t*VGLDisplay;\nextern byte \t\t\t*VGLBuf;\n\n/*\n * Prototypes\n */\n/* bitmap.c */\nint __VGLBitmapCopy(VGLBitmap *src, int srcx, int srcy, VGLBitmap *dst, int dstx, int dsty, int width, int hight);\nint VGLBitmapCopy(VGLBitmap *src, int srcx, int srcy, VGLBitmap *dst, int dstx, int dsty, int width, int hight);\nVGLBitmap *VGLBitmapCreate(int type, int xsize, int ysize, byte *bits);\nvoid VGLBitmapDestroy(VGLBitmap *object);\nint VGLBitmapAllocateBits(VGLBitmap *object);\n/* keyboard.c */\nint VGLKeyboardInit(int mode);\nvoid VGLKeyboardEnd(void);\nint VGLKeyboardGetCh(void);\n/* main.c */\nvoid VGLEnd(void);\nint VGLInit(int mode);\nvoid VGLCheckSwitch(void);\nint VGLSetVScreenSize(VGLBitmap *object, int VXsize, int VYsize);\nint VGLPanScreen(VGLBitmap *object, int x, int y);\nint VGLSetSegment(unsigned int offset);\n/* mouse.c */\nvoid VGLMousePointerShow(void);\nvoid VGLMousePointerHide(void);\nvoid VGLMouseMode(int mode);\nvoid VGLMouseAction(int dummy);\nvoid VGLMouseSetImage(VGLBitmap *AndMask, VGLBitmap *OrMask);\nvoid VGLMouseSetStdImage(void);\nint VGLMouseInit(int mode);\nint VGLMouseStatus(int *x, int *y, char *buttons);\nint VGLMouseFreeze(int x, int y, int width, int hight, byte color);\nvoid VGLMouseUnFreeze(void);\n/* simple.c */\nvoid VGLSetXY(VGLBitmap *object, int x, int y, u_long color);\nu_long VGLGetXY(VGLBitmap *object, int x, int y);\nvoid VGLLine(VGLBitmap *object, int x1, int y1, int x2, int y2, u_long color);\nvoid VGLBox(VGLBitmap *object, int x1, int y1, int x2, int y2, u_long color);\nvoid VGLFilledBox(VGLBitmap *object, int x1, int y1, int x2, int y2, u_long color);\nvoid VGLEllipse(VGLBitmap *object, int xc, int yc, int a, int b, u_long color);\nvoid VGLFilledEllipse(VGLBitmap *object, int xc, int yc, int a, int b, u_long color);\nvoid VGLClear(VGLBitmap *object, u_long color);\nvoid VGLRestorePalette(void);\nvoid VGLSavePalette(void);\nvoid VGLSetPalette(byte *red, byte *green, byte *blue);\nvoid VGLSetPaletteIndex(byte color, byte red, byte green, byte blue);\nvoid VGLSetBorder(byte color);\nvoid VGLBlankDisplay(int blank);\n/* text.c */\nint VGLTextSetFontFile(char *filename);\nvoid VGLBitmapPutChar(VGLBitmap *Object, int x, int y, byte ch, byte fgcol, byte bgcol, int fill, int dir);\nvoid VGLBitmapString(VGLBitmap *Object, int x, int y, char *str, byte fgcol, byte bgcol, int fill, int dir);\n\n#endif /* !_VGL_H_ */\n"
  },
  {
    "path": "freebsd-headers/vis.h",
    "content": "/*-\n * Copyright (c) 1990, 1993\n *\tThe Regents of the University of California.  All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t@(#)vis.h\t8.1 (Berkeley) 6/2/93\n * $FreeBSD: release/9.0.0/include/vis.h 203964 2010-02-16 19:39:50Z imp $\n */\n\n#ifndef _VIS_H_\n#define\t_VIS_H_\n\n#include <sys/_types.h>\n\n#ifndef _SIZE_T_DECLARED\ntypedef\t__size_t\tsize_t;\n#define\t_SIZE_T_DECLARED\n#endif\n\n/*\n * to select alternate encoding format\n */\n#define\tVIS_OCTAL\t0x01\t/* use octal \\ddd format */\n#define\tVIS_CSTYLE\t0x02\t/* use \\[nrft0..] where appropriate */\n\n/*\n * to alter set of characters encoded (default is to encode all\n * non-graphic except space, tab, and newline).\n */\n#define\tVIS_SP\t\t0x04\t/* also encode space */\n#define\tVIS_TAB\t\t0x08\t/* also encode tab */\n#define\tVIS_NL\t\t0x10\t/* also encode newline */\n#define\tVIS_WHITE\t(VIS_SP | VIS_TAB | VIS_NL)\n#define\tVIS_SAFE\t0x20\t/* only encode \"unsafe\" characters */\n\n/*\n * other\n */\n#define\tVIS_NOSLASH\t0x40\t/* inhibit printing '\\' */\n#define\tVIS_HTTPSTYLE\t0x80\t/* http-style escape % HEX HEX */\n#define\tVIS_GLOB\t0x100\t/* encode glob(3) magics */\n\n/*\n * unvis return codes\n */\n#define\tUNVIS_VALID\t 1\t/* character valid */\n#define\tUNVIS_VALIDPUSH\t 2\t/* character valid, push back passed char */\n#define\tUNVIS_NOCHAR\t 3\t/* valid sequence, no character produced */\n#define\tUNVIS_SYNBAD\t-1\t/* unrecognized escape sequence */\n#define\tUNVIS_ERROR\t-2\t/* decoder in unknown state (unrecoverable) */\n\n/*\n * unvis flags\n */\n#define\tUNVIS_END\t1\t/* no more characters */\n\n#include <sys/cdefs.h>\n\n__BEGIN_DECLS\nchar\t*vis(char *, int, int, int);\nint\tstrvis(char *, const char *, int);\nint\tstrvisx(char *, const char *, size_t, int);\nint\tstrunvis(char *, const char *);\nint\tstrunvisx(char *, const char *, int);\nint\tunvis(char *, int, int *, int);\n__END_DECLS\n\n#endif /* !_VIS_H_ */\n"
  },
  {
    "path": "freebsd-headers/vm/memguard.h",
    "content": "/*-\n * Copyright (c) 2005,\n *     Bosko Milekic <bmilekic@FreeBSD.org>.  All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice unmodified, this list of conditions, and the following\n *    disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR\n * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES\n * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,\n * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF\n * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/vm/memguard.h 212058 2010-08-31 16:57:58Z mdf $\n */\n\n#ifndef _VM_MEMGUARD_H_\n#define\t_VM_MEMGUARD_H_\n\n#include \"opt_vm.h\"\n\nstruct malloc_type;\nstruct vm_map;\n\n#ifdef DEBUG_MEMGUARD\nunsigned long\tmemguard_fudge(unsigned long, unsigned long);\nvoid\tmemguard_init(struct vm_map *);\nvoid \t*memguard_alloc(unsigned long, int);\nvoid\t*memguard_realloc(void *, unsigned long, struct malloc_type *, int);\nvoid\tmemguard_free(void *);\nint\tmemguard_cmp(struct malloc_type *, unsigned long);\nint\tis_memguard_addr(void *);\n#else\n#define\tmemguard_fudge(size, xxx)\t(size)\n#define\tmemguard_init(map)\t\tdo { } while (0)\n#define\tmemguard_alloc(size, flags)\tNULL\n#define\tmemguard_realloc(a, s, mtp, f)\tNULL\n#define\tmemguard_free(addr)\t\tdo { } while (0)\n#define\tmemguard_cmp(mtp, size)\t\t0\n#define\tis_memguard_addr(addr)\t\t0\n#endif\n\n#endif /* _VM_MEMGUARD_H_ */\n"
  },
  {
    "path": "freebsd-headers/vm/pmap.h",
    "content": "/*-\n * Copyright (c) 1991, 1993\n *\tThe Regents of the University of California.  All rights reserved.\n *\n * This code is derived from software contributed to Berkeley by\n * The Mach Operating System project at Carnegie-Mellon University.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 4. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\tfrom: @(#)pmap.h\t8.1 (Berkeley) 6/11/93\n *\n *\n * Copyright (c) 1987, 1990 Carnegie-Mellon University.\n * All rights reserved.\n *\n * Author: Avadis Tevanian, Jr.\n *\n * Permission to use, copy, modify and distribute this software and\n * its documentation is hereby granted, provided that both the copyright\n * notice and this permission notice appear in all copies of the\n * software, derivative works or modified versions, and any portions\n * thereof, and that both notices appear in supporting documentation.\n *\n * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS \"AS IS\"\n * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND\n * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.\n *\n * Carnegie Mellon requests users of this software to return to\n *\n *  Software Distribution Coordinator  or  Software.Distribution@CS.CMU.EDU\n *  School of Computer Science\n *  Carnegie Mellon University\n *  Pittsburgh PA 15213-3890\n *\n * any improvements or extensions that they make and grant Carnegie the\n * rights to redistribute these changes.\n *\n * $FreeBSD: release/9.0.0/sys/vm/pmap.h 217482 2011-01-16 20:40:50Z alc $\n */\n\n/*\n *\tMachine address mapping definitions -- machine-independent\n *\tsection.  [For machine-dependent section, see \"machine/pmap.h\".]\n */\n\n#ifndef\t_PMAP_VM_\n#define\t_PMAP_VM_\n/*\n * Each machine dependent implementation is expected to\n * keep certain statistics.  They may do this anyway they\n * so choose, but are expected to return the statistics\n * in the following structure.\n */\nstruct pmap_statistics {\n\tlong resident_count;\t/* # of pages mapped (total) */\n\tlong wired_count;\t/* # of pages wired */\n};\ntypedef struct pmap_statistics *pmap_statistics_t;\n\n/*\n * Each machine dependent implementation is expected to provide:\n *\n * vm_memattr_t\tpmap_page_get_memattr(vm_page_t);\n * boolean_t\tpmap_page_is_mapped(vm_page_t);\n * void\t\tpmap_page_set_memattr(vm_page_t, vm_memattr_t);\n */\n#include <machine/pmap.h>\n\n#ifdef _KERNEL\nstruct thread;\n\n/*\n * Updates to kernel_vm_end are synchronized by the kernel_map's system mutex.\n */\nextern vm_offset_t kernel_vm_end;\n\nvoid\t\t pmap_activate(struct thread *td);\nvoid\t\t pmap_align_superpage(vm_object_t, vm_ooffset_t, vm_offset_t *,\n\t\t    vm_size_t);\n#if defined(__mips__)\nvoid\t\t pmap_align_tlb(vm_offset_t *);\n#endif\nvoid\t\t pmap_change_wiring(pmap_t, vm_offset_t, boolean_t);\nvoid\t\t pmap_clear_modify(vm_page_t m);\nvoid\t\t pmap_clear_reference(vm_page_t m);\nvoid\t\t pmap_copy(pmap_t, pmap_t, vm_offset_t, vm_size_t, vm_offset_t);\nvoid\t\t pmap_copy_page(vm_page_t, vm_page_t);\nvoid\t\t pmap_enter(pmap_t, vm_offset_t, vm_prot_t, vm_page_t,\n\t\t    vm_prot_t, boolean_t);\nvoid\t\t pmap_enter_object(pmap_t pmap, vm_offset_t start,\n\t\t    vm_offset_t end, vm_page_t m_start, vm_prot_t prot);\nvoid\t\t pmap_enter_quick(pmap_t pmap, vm_offset_t va, vm_page_t m,\n\t\t    vm_prot_t prot);\nvm_paddr_t\t pmap_extract(pmap_t pmap, vm_offset_t va);\nvm_page_t\t pmap_extract_and_hold(pmap_t pmap, vm_offset_t va,\n\t\t    vm_prot_t prot);\nvoid\t\t pmap_growkernel(vm_offset_t);\nvoid\t\t pmap_init(void);\nboolean_t\t pmap_is_modified(vm_page_t m);\nboolean_t\t pmap_is_prefaultable(pmap_t pmap, vm_offset_t va);\nboolean_t\t pmap_is_referenced(vm_page_t m);\nvm_offset_t\t pmap_map(vm_offset_t *, vm_paddr_t, vm_paddr_t, int);\nint\t\t pmap_mincore(pmap_t pmap, vm_offset_t addr,\n\t\t    vm_paddr_t *locked_pa);\nvoid\t\t pmap_object_init_pt(pmap_t pmap, vm_offset_t addr,\n\t\t    vm_object_t object, vm_pindex_t pindex, vm_size_t size);\nboolean_t\t pmap_page_exists_quick(pmap_t pmap, vm_page_t m);\nvoid\t\t pmap_page_init(vm_page_t m);\nint\t\t pmap_page_wired_mappings(vm_page_t m);\nint\t\t pmap_pinit(pmap_t);\nvoid\t\t pmap_pinit0(pmap_t);\nvoid\t\t pmap_protect(pmap_t, vm_offset_t, vm_offset_t, vm_prot_t);\nvoid\t\t pmap_qenter(vm_offset_t, vm_page_t *, int);\nvoid\t\t pmap_qremove(vm_offset_t, int);\nvoid\t\t pmap_release(pmap_t);\nvoid\t\t pmap_remove(pmap_t, vm_offset_t, vm_offset_t);\nvoid\t\t pmap_remove_all(vm_page_t m);\nvoid\t\t pmap_remove_pages(pmap_t);\nvoid\t\t pmap_remove_write(vm_page_t m);\nvoid\t\t pmap_sync_icache(pmap_t, vm_offset_t, vm_size_t);\nboolean_t\t pmap_ts_referenced(vm_page_t m);\nvoid\t\t pmap_zero_page(vm_page_t);\nvoid\t\t pmap_zero_page_area(vm_page_t, int off, int size);\nvoid\t\t pmap_zero_page_idle(vm_page_t);\n\n#define\tpmap_resident_count(pm)\t((pm)->pm_stats.resident_count)\n#define\tpmap_wired_count(pm)\t((pm)->pm_stats.wired_count)\n\n#endif /* _KERNEL */\n#endif /* _PMAP_VM_ */\n"
  },
  {
    "path": "freebsd-headers/vm/redzone.h",
    "content": "/*-\n * Copyright (c) 2006 Pawel Jakub Dawidek <pjd@FreeBSD.org>\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * \n * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/vm/redzone.h 155086 2006-01-31 11:09:21Z pjd $\n */\n\n#ifndef\t_VM_REDZONE_H_\n#define\t_VM_REDZONE_H_\n\nu_long redzone_get_size(caddr_t naddr);\nu_long redzone_size_ntor(u_long nsize);\nvoid *redzone_addr_ntor(caddr_t naddr);\nvoid *redzone_setup(caddr_t raddr, u_long nsize);\nvoid redzone_check(caddr_t naddr);\n\n#endif\t/* _VM_REDZONE_H_ */\n"
  },
  {
    "path": "freebsd-headers/vm/swap_pager.h",
    "content": "/*-\n * Copyright (c) 1990 University of Utah.\n * Copyright (c) 1991 The Regents of the University of California.\n * All rights reserved.\n *\n * This code is derived from software contributed to Berkeley by\n * the Systems Programming Group of the University of Utah Computer\n * Science Department.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 4. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\tfrom: @(#)swap_pager.h\t7.1 (Berkeley) 12/5/90\n * $FreeBSD: release/9.0.0/sys/vm/swap_pager.h 224582 2011-08-01 19:12:15Z kib $\n */\n\n#ifndef\t_VM_SWAP_PAGER_H_\n#define\t_VM_SWAP_PAGER_H_ 1\n\ntypedef\tint32_t\tswblk_t;\t/*\n\t\t\t\t * swap offset.  This is the type used to\n\t\t\t\t * address the \"virtual swap device\" and\n\t\t\t\t * therefore the maximum swap space is\n\t\t\t\t * 2^32 pages.\n\t\t\t\t */\n\nstruct buf;\nstruct swdevt;\ntypedef void sw_strategy_t(struct buf *, struct swdevt *);\ntypedef void sw_close_t(struct thread *, struct swdevt *);\n\n/*\n * Swap device table\n */\nstruct swdevt {\n\tint\tsw_flags;\n\tint\tsw_nblks;\n\tint     sw_used;\n\tdev_t\tsw_dev;\n\tstruct vnode *sw_vp;\n\tvoid\t*sw_id;\n\tswblk_t\tsw_first;\n\tswblk_t\tsw_end;\n\tstruct blist *sw_blist;\n\tTAILQ_ENTRY(swdevt)\tsw_list;\n\tsw_strategy_t\t\t*sw_strategy;\n\tsw_close_t\t\t*sw_close;\n};\n\n#define\tSW_CLOSING\t0x04\n\n#ifdef _KERNEL\n\nextern int swap_pager_full;\nextern int swap_pager_avail;\n\nstruct xswdev;\nint swap_dev_info(int name, struct xswdev *xs, char *devname, size_t len);\nvoid swap_pager_copy(vm_object_t, vm_object_t, vm_pindex_t, int);\nvoid swap_pager_freespace(vm_object_t, vm_pindex_t, vm_size_t);\nvoid swap_pager_swap_init(void);\nint swap_pager_isswapped(vm_object_t, struct swdevt *);\nint swap_pager_reserve(vm_object_t, vm_pindex_t, vm_size_t);\nvoid swap_pager_status(int *total, int *used);\nvoid swapoff_all(void);\n\n#endif\t\t\t\t/* _KERNEL */\n#endif\t\t\t\t/* _VM_SWAP_PAGER_H_ */\n"
  },
  {
    "path": "freebsd-headers/vm/uma.h",
    "content": "/*-\n * Copyright (c) 2002, 2003, 2004, 2005 Jeffrey Roberson <jeff@FreeBSD.org>\n * Copyright (c) 2004, 2005 Bosko Milekic <bmilekic@FreeBSD.org>\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice unmodified, this list of conditions, and the following\n *    disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR\n * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES\n * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,\n * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF\n * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/vm/uma.h 213911 2010-10-16 04:41:45Z lstewart $\n *\n */\n\n/*\n * uma.h - External definitions for the Universal Memory Allocator\n *\n*/\n\n#ifndef VM_UMA_H\n#define VM_UMA_H\n\n#include <sys/param.h>\t\t/* For NULL */\n#include <sys/malloc.h>\t\t/* For M_* */\n\n/* User visible parameters */\n#define UMA_SMALLEST_UNIT       (PAGE_SIZE / 256) /* Smallest item allocated */\n\n/* Types and type defs */\n\nstruct uma_zone;\n/* Opaque type used as a handle to the zone */\ntypedef struct uma_zone * uma_zone_t;\n\nvoid zone_drain(uma_zone_t);\n\n/* \n * Item constructor\n *\n * Arguments:\n *\titem  A pointer to the memory which has been allocated.\n *\targ   The arg field passed to uma_zalloc_arg\n *\tsize  The size of the allocated item\n *\tflags See zalloc flags\n * \n * Returns:\n *\t0      on success\n *      errno  on failure\n *\n * Discussion:\n *\tThe constructor is called just before the memory is returned\n *\tto the user. It may block if necessary.\n */\ntypedef int (*uma_ctor)(void *mem, int size, void *arg, int flags);\n\n/*\n * Item destructor\n *\n * Arguments:\n *\titem  A pointer to the memory which has been allocated.\n *\tsize  The size of the item being destructed.\n *\targ   Argument passed through uma_zfree_arg\n * \n * Returns:\n *\tNothing\n *\n * Discussion:\n *\tThe destructor may perform operations that differ from those performed\n *\tby the initializer, but it must leave the object in the same state.\n *\tThis IS type stable storage.  This is called after EVERY zfree call.\n */\ntypedef void (*uma_dtor)(void *mem, int size, void *arg);\n\n/* \n * Item initializer\n *\n * Arguments:\n *\titem  A pointer to the memory which has been allocated.\n *\tsize  The size of the item being initialized.\n *\tflags See zalloc flags\n * \n * Returns:\n *\t0      on success\n *      errno  on failure\n *\n * Discussion:\n *\tThe initializer is called when the memory is cached in the uma zone. \n *\tThe initializer and the destructor should leave the object in the same\n *\tstate.\n */\ntypedef int (*uma_init)(void *mem, int size, int flags);\n\n/*\n * Item discard function\n *\n * Arguments:\n * \titem  A pointer to memory which has been 'freed' but has not left the \n *\t      zone's cache.\n *\tsize  The size of the item being discarded.\n *\n * Returns:\n *\tNothing\n *\n * Discussion:\n *\tThis routine is called when memory leaves a zone and is returned to the\n *\tsystem for other uses.  It is the counter-part to the init function.\n */\ntypedef void (*uma_fini)(void *mem, int size);\n\n/*\n * What's the difference between initializing and constructing?\n *\n * The item is initialized when it is cached, and this is the state that the \n * object should be in when returned to the allocator. The purpose of this is\n * to remove some code which would otherwise be called on each allocation by\n * utilizing a known, stable state.  This differs from the constructor which\n * will be called on EVERY allocation.\n *\n * For example, in the initializer you may want to initialize embedded locks,\n * NULL list pointers, set up initial states, magic numbers, etc.  This way if\n * the object is held in the allocator and re-used it won't be necessary to\n * re-initialize it.\n *\n * The constructor may be used to lock a data structure, link it on to lists,\n * bump reference counts or total counts of outstanding structures, etc.\n *\n */\n\n\n/* Function proto types */\n\n/*\n * Create a new uma zone\n *\n * Arguments:\n *\tname  The text name of the zone for debugging and stats. This memory\n *\t\tshould not be freed until the zone has been deallocated.\n *\tsize  The size of the object that is being created.\n *\tctor  The constructor that is called when the object is allocated.\n *\tdtor  The destructor that is called when the object is freed.\n *\tinit  An initializer that sets up the initial state of the memory.\n *\tfini  A discard function that undoes initialization done by init.\n *\t\tctor/dtor/init/fini may all be null, see notes above.\n *\talign A bitmask that corresponds to the requested alignment\n *\t\teg 4 would be 0x3\n *\tflags A set of parameters that control the behavior of the zone.\n *\n * Returns:\n *\tA pointer to a structure which is intended to be opaque to users of\n *\tthe interface.  The value may be null if the wait flag is not set.\n */\numa_zone_t uma_zcreate(char *name, size_t size, uma_ctor ctor, uma_dtor dtor,\n\t\t\tuma_init uminit, uma_fini fini, int align,\n\t\t\tu_int32_t flags);\n\n/*\n * Create a secondary uma zone\n *\n * Arguments:\n *\tname  The text name of the zone for debugging and stats. This memory\n *\t\tshould not be freed until the zone has been deallocated.\n *\tctor  The constructor that is called when the object is allocated.\n *\tdtor  The destructor that is called when the object is freed.\n *\tzinit  An initializer that sets up the initial state of the memory\n *\t\tas the object passes from the Keg's slab to the Zone's cache.\n *\tzfini  A discard function that undoes initialization done by init\n *\t\tas the object passes from the Zone's cache to the Keg's slab.\n *\n *\t\tctor/dtor/zinit/zfini may all be null, see notes above.\n *\t\tNote that the zinit and zfini specified here are NOT\n *\t\texactly the same as the init/fini specified to uma_zcreate()\n *\t\twhen creating a master zone.  These zinit/zfini are called\n *\t\ton the TRANSITION from keg to zone (and vice-versa). Once\n *\t\tthese are set, the primary zone may alter its init/fini\n *\t\t(which are called when the object passes from VM to keg)\n *\t\tusing uma_zone_set_init/fini()) as well as its own\n *\t\tzinit/zfini (unset by default for master zone) with\n *\t\tuma_zone_set_zinit/zfini() (note subtle 'z' prefix).\n *\n *\tmaster  A reference to this zone's Master Zone (Primary Zone),\n *\t\twhich contains the backing Keg for the Secondary Zone\n *\t\tbeing added.\n *\n * Returns:\n *\tA pointer to a structure which is intended to be opaque to users of\n *\tthe interface.  The value may be null if the wait flag is not set.\n */\numa_zone_t uma_zsecond_create(char *name, uma_ctor ctor, uma_dtor dtor,\n\t\t    uma_init zinit, uma_fini zfini, uma_zone_t master);\n\n/*\n * Add a second master to a secondary zone.  This provides multiple data\n * backends for objects with the same size.  Both masters must have\n * compatible allocation flags.  Presently, UMA_ZONE_MALLOC type zones are\n * the only supported.\n *\n * Returns:\n * \tError on failure, 0 on success.\n */\nint uma_zsecond_add(uma_zone_t zone, uma_zone_t master);\n\n/*\n * Definitions for uma_zcreate flags\n *\n * These flags share space with UMA_ZFLAGs in uma_int.h.  Be careful not to\n * overlap when adding new features.  0xf0000000 is in use by uma_int.h.\n */\n#define UMA_ZONE_PAGEABLE\t0x0001\t/* Return items not fully backed by\n\t\t\t\t\t   physical memory XXX Not yet */\n#define UMA_ZONE_ZINIT\t\t0x0002\t/* Initialize with zeros */\n#define UMA_ZONE_STATIC\t\t0x0004\t/* Statically sized zone */\n#define UMA_ZONE_OFFPAGE\t0x0008\t/* Force the slab structure allocation\n\t\t\t\t\t   off of the real memory */\n#define UMA_ZONE_MALLOC\t\t0x0010\t/* For use by malloc(9) only! */\n#define UMA_ZONE_NOFREE\t\t0x0020\t/* Do not free slabs of this type! */\n#define UMA_ZONE_MTXCLASS\t0x0040\t/* Create a new lock class */\n#define\tUMA_ZONE_VM\t\t0x0080\t/*\n\t\t\t\t\t * Used for internal vm datastructures\n\t\t\t\t\t * only.\n\t\t\t\t\t */\n#define\tUMA_ZONE_HASH\t\t0x0100\t/*\n\t\t\t\t\t * Use a hash table instead of caching\n\t\t\t\t\t * information in the vm_page.\n\t\t\t\t\t */\n#define\tUMA_ZONE_SECONDARY\t0x0200\t/* Zone is a Secondary Zone */\n#define\tUMA_ZONE_REFCNT\t\t0x0400\t/* Allocate refcnts in slabs */\n#define\tUMA_ZONE_MAXBUCKET\t0x0800\t/* Use largest buckets */\n#define\tUMA_ZONE_CACHESPREAD\t0x1000\t/*\n\t\t\t\t\t * Spread memory start locations across\n\t\t\t\t\t * all possible cache lines.  May\n\t\t\t\t\t * require many virtually contiguous\n\t\t\t\t\t * backend pages and can fail early.\n\t\t\t\t\t */\n#define\tUMA_ZONE_VTOSLAB\t0x2000\t/* Zone uses vtoslab for lookup. */\n\n/*\n * These flags are shared between the keg and zone.  In zones wishing to add\n * new kegs these flags must be compatible.  Some are determined based on\n * physical parameters of the request and may not be provided by the consumer.\n */\n#define\tUMA_ZONE_INHERIT\t\t\t\t\t\t\\\n    (UMA_ZONE_OFFPAGE | UMA_ZONE_MALLOC | UMA_ZONE_HASH |\t\t\\\n    UMA_ZONE_REFCNT | UMA_ZONE_VTOSLAB)\n\n/* Definitions for align */\n#define UMA_ALIGN_PTR\t(sizeof(void *) - 1)\t/* Alignment fit for ptr */\n#define UMA_ALIGN_LONG\t(sizeof(long) - 1)\t/* \"\" long */\n#define UMA_ALIGN_INT\t(sizeof(int) - 1)\t/* \"\" int */\n#define UMA_ALIGN_SHORT\t(sizeof(short) - 1)\t/* \"\" short */\n#define UMA_ALIGN_CHAR\t(sizeof(char) - 1)\t/* \"\" char */\n#define UMA_ALIGN_CACHE\t(0 - 1)\t\t\t/* Cache line size align */\n\n/*\n * Destroys an empty uma zone.  If the zone is not empty uma complains loudly.\n *\n * Arguments:\n *\tzone  The zone we want to destroy.\n *\n */\nvoid uma_zdestroy(uma_zone_t zone);\n\n/*\n * Allocates an item out of a zone\n *\n * Arguments:\n *\tzone  The zone we are allocating from\n *\targ   This data is passed to the ctor function\n *\tflags See sys/malloc.h for available flags.\n *\n * Returns:\n *\tA non-null pointer to an initialized element from the zone is\n *\tguaranteed if the wait flag is M_WAITOK.  Otherwise a null pointer\n *\tmay be returned if the zone is empty or the ctor failed.\n */\n\nvoid *uma_zalloc_arg(uma_zone_t zone, void *arg, int flags);\n\n/*\n * Allocates an item out of a zone without supplying an argument\n *\n * This is just a wrapper for uma_zalloc_arg for convenience.\n *\n */\nstatic __inline void *uma_zalloc(uma_zone_t zone, int flags);\n\nstatic __inline void *\numa_zalloc(uma_zone_t zone, int flags)\n{\n\treturn uma_zalloc_arg(zone, NULL, flags);\n}\n\n/*\n * Frees an item back into the specified zone.\n *\n * Arguments:\n *\tzone  The zone the item was originally allocated out of.\n *\titem  The memory to be freed.\n *\targ   Argument passed to the destructor\n *\n * Returns:\n *\tNothing.\n */\n\nvoid uma_zfree_arg(uma_zone_t zone, void *item, void *arg);\n\n/*\n * Frees an item back to a zone without supplying an argument\n *\n * This is just a wrapper for uma_zfree_arg for convenience.\n *\n */\nstatic __inline void uma_zfree(uma_zone_t zone, void *item);\n\nstatic __inline void\numa_zfree(uma_zone_t zone, void *item)\n{\n\tuma_zfree_arg(zone, item, NULL);\n}\n\n/*\n * XXX The rest of the prototypes in this header are h0h0 magic for the VM.\n * If you think you need to use it for a normal zone you're probably incorrect.\n */\n\n/*\n * Backend page supplier routines\n *\n * Arguments:\n *\tzone  The zone that is requesting pages.\n *\tsize  The number of bytes being requested.\n *\tpflag Flags for these memory pages, see below.\n *\twait  Indicates our willingness to block.\n *\n * Returns:\n *\tA pointer to the allocated memory or NULL on failure.\n */\n\ntypedef void *(*uma_alloc)(uma_zone_t zone, int size, u_int8_t *pflag, int wait);\n\n/*\n * Backend page free routines\n *\n * Arguments:\n *\titem  A pointer to the previously allocated pages.\n *\tsize  The original size of the allocation.\n *\tpflag The flags for the slab.  See UMA_SLAB_* below.\n *\n * Returns:\n *\tNone\n */\ntypedef void (*uma_free)(void *item, int size, u_int8_t pflag);\n\n\n\n/*\n * Sets up the uma allocator. (Called by vm_mem_init)\n *\n * Arguments:\n *\tbootmem  A pointer to memory used to bootstrap the system.\n *\n * Returns:\n *\tNothing\n *\n * Discussion:\n *\tThis memory is used for zones which allocate things before the\n *\tbackend page supplier can give us pages.  It should be\n *\tUMA_SLAB_SIZE * boot_pages bytes. (see uma_int.h)\n *\n */\n\nvoid uma_startup(void *bootmem, int boot_pages);\n\n/*\n * Finishes starting up the allocator.  This should\n * be called when kva is ready for normal allocs.\n *\n * Arguments:\n *\tNone\n *\n * Returns:\n *\tNothing\n *\n * Discussion:\n *\tuma_startup2 is called by kmeminit() to enable us of uma for malloc.\n */\n \nvoid uma_startup2(void);\n\n/*\n * Reclaims unused memory for all zones\n *\n * Arguments:\n *\tNone\n * Returns:\n *\tNone\n *\n * This should only be called by the page out daemon.\n */\n\nvoid uma_reclaim(void);\n\n/*\n * Sets the alignment mask to be used for all zones requesting cache\n * alignment.  Should be called by MD boot code prior to starting VM/UMA.\n *\n * Arguments:\n *\talign The alignment mask\n *\n * Returns:\n *\tNothing\n */\nvoid uma_set_align(int align);\n\n/*\n * Switches the backing object of a zone\n *\n * Arguments:\n *\tzone  The zone to update.\n *\tobj   The VM object to use for future allocations.\n *\tsize  The size of the object to allocate.\n *\n * Returns:\n *\t0  if kva space can not be allocated\n *\t1  if successful\n *\n * Discussion:\n *\tA NULL object can be used and uma will allocate one for you.  Setting\n *\tthe size will limit the amount of memory allocated to this zone.\n *\n */\nstruct vm_object;\nint uma_zone_set_obj(uma_zone_t zone, struct vm_object *obj, int size);\n\n/*\n * Sets a high limit on the number of items allowed in a zone\n *\n * Arguments:\n *\tzone  The zone to limit\n *\tnitems  The requested upper limit on the number of items allowed\n *\n * Returns:\n *\tint  The effective value of nitems after rounding up based on page size\n */\nint uma_zone_set_max(uma_zone_t zone, int nitems);\n\n/*\n * Obtains the effective limit on the number of items in a zone\n *\n * Arguments:\n *\tzone  The zone to obtain the effective limit from\n *\n * Return:\n *\t0  No limit\n *\tint  The effective limit of the zone\n */\nint uma_zone_get_max(uma_zone_t zone);\n\n/*\n * Obtains the approximate current number of items allocated from a zone\n *\n * Arguments:\n *\tzone  The zone to obtain the current allocation count from\n *\n * Return:\n *\tint  The approximate current number of items allocated from the zone\n */\nint uma_zone_get_cur(uma_zone_t zone);\n\n/*\n * The following two routines (uma_zone_set_init/fini)\n * are used to set the backend init/fini pair which acts on an\n * object as it becomes allocated and is placed in a slab within\n * the specified zone's backing keg.  These should probably not\n * be changed once allocations have already begun, but only be set\n * immediately upon zone creation.\n */\nvoid uma_zone_set_init(uma_zone_t zone, uma_init uminit);\nvoid uma_zone_set_fini(uma_zone_t zone, uma_fini fini);\n\n/*\n * The following two routines (uma_zone_set_zinit/zfini) are\n * used to set the zinit/zfini pair which acts on an object as\n * it passes from the backing Keg's slab cache to the\n * specified Zone's bucket cache.  These should probably not\n * be changed once allocations have already begun, but only be set\n * immediately upon zone creation.\n */\nvoid uma_zone_set_zinit(uma_zone_t zone, uma_init zinit);\nvoid uma_zone_set_zfini(uma_zone_t zone, uma_fini zfini);\n\n/*\n * Replaces the standard page_alloc or obj_alloc functions for this zone\n *\n * Arguments:\n *\tzone   The zone whose backend allocator is being changed.\n *\tallocf A pointer to the allocation function\n *\n * Returns:\n *\tNothing\n *\n * Discussion:\n *\tThis could be used to implement pageable allocation, or perhaps\n *\teven DMA allocators if used in conjunction with the OFFPAGE\n *\tzone flag.\n */\n\nvoid uma_zone_set_allocf(uma_zone_t zone, uma_alloc allocf);\n\n/*\n * Used for freeing memory provided by the allocf above\n *\n * Arguments:\n *\tzone  The zone that intends to use this free routine.\n *\tfreef The page freeing routine.\n *\n * Returns:\n *\tNothing\n */\n\nvoid uma_zone_set_freef(uma_zone_t zone, uma_free freef);\n\n/*\n * These flags are setable in the allocf and visible in the freef.\n */\n#define UMA_SLAB_BOOT\t0x01\t\t/* Slab alloced from boot pages */\n#define UMA_SLAB_KMEM\t0x02\t\t/* Slab alloced from kmem_map */\n#define UMA_SLAB_KERNEL\t0x04\t\t/* Slab alloced from kernel_map */\n#define UMA_SLAB_PRIV\t0x08\t\t/* Slab alloced from priv allocator */\n#define UMA_SLAB_OFFP\t0x10\t\t/* Slab is managed separately  */\n#define UMA_SLAB_MALLOC\t0x20\t\t/* Slab is a large malloc slab */\n/* 0x40 and 0x80 are available */\n\n/*\n * Used to pre-fill a zone with some number of items\n *\n * Arguments:\n *\tzone    The zone to fill\n *\titemcnt The number of items to reserve\n *\n * Returns:\n *\tNothing\n *\n * NOTE: This is blocking and should only be done at startup\n */\nvoid uma_prealloc(uma_zone_t zone, int itemcnt);\n\n/*\n * Used to lookup the reference counter allocated for an item\n * from a UMA_ZONE_REFCNT zone.  For UMA_ZONE_REFCNT zones,\n * reference counters are allocated for items and stored in\n * the underlying slab header.\n *\n * Arguments:\n * \tzone  The UMA_ZONE_REFCNT zone to which the item belongs.\n *\titem  The address of the item for which we want a refcnt.\n *\n * Returns:\n * \tA pointer to a u_int32_t reference counter.\n */\nu_int32_t *uma_find_refcnt(uma_zone_t zone, void *item);\n\n/*\n * Used to determine if a fixed-size zone is exhausted.\n *\n * Arguments:\n *\tzone    The zone to check\n *\n * Returns:\n * \tNon-zero if zone is exhausted.\n */\nint uma_zone_exhausted(uma_zone_t zone);\nint uma_zone_exhausted_nolock(uma_zone_t zone);\n\n/*\n * Exported statistics structures to be used by user space monitoring tools.\n * Statistics stream consists of a uma_stream_header, followed by a series of\n * alternative uma_type_header and uma_type_stat structures.\n */\n#define\tUMA_STREAM_VERSION\t0x00000001\nstruct uma_stream_header {\n\tu_int32_t\tush_version;\t/* Stream format version. */\n\tu_int32_t\tush_maxcpus;\t/* Value of MAXCPU for stream. */\n\tu_int32_t\tush_count;\t/* Number of records. */\n\tu_int32_t\t_ush_pad;\t/* Pad/reserved field. */\n};\n\n#define\tUTH_MAX_NAME\t32\n#define\tUTH_ZONE_SECONDARY\t0x00000001\nstruct uma_type_header {\n\t/*\n\t * Static per-zone data, some extracted from the supporting keg.\n\t */\n\tchar\t\tuth_name[UTH_MAX_NAME];\n\tu_int32_t\tuth_align;\t/* Keg: alignment. */\n\tu_int32_t\tuth_size;\t/* Keg: requested size of item. */\n\tu_int32_t\tuth_rsize;\t/* Keg: real size of item. */\n\tu_int32_t\tuth_maxpages;\t/* Keg: maximum number of pages. */\n\tu_int32_t\tuth_limit;\t/* Keg: max items to allocate. */\n\n\t/*\n\t * Current dynamic zone/keg-derived statistics.\n\t */\n\tu_int32_t\tuth_pages;\t/* Keg: pages allocated. */\n\tu_int32_t\tuth_keg_free;\t/* Keg: items free. */\n\tu_int32_t\tuth_zone_free;\t/* Zone: items free. */\n\tu_int32_t\tuth_bucketsize;\t/* Zone: desired bucket size. */\n\tu_int32_t\tuth_zone_flags;\t/* Zone: flags. */\n\tu_int64_t\tuth_allocs;\t/* Zone: number of allocations. */\n\tu_int64_t\tuth_frees;\t/* Zone: number of frees. */\n\tu_int64_t\tuth_fails;\t/* Zone: number of alloc failures. */\n\tu_int64_t\tuth_sleeps;\t/* Zone: number of alloc sleeps. */\n\tu_int64_t\t_uth_reserved1[2];\t/* Reserved. */\n};\n\nstruct uma_percpu_stat {\n\tu_int64_t\tups_allocs;\t/* Cache: number of allocations. */\n\tu_int64_t\tups_frees;\t/* Cache: number of frees. */\n\tu_int64_t\tups_cache_free;\t/* Cache: free items in cache. */\n\tu_int64_t\t_ups_reserved[5];\t/* Reserved. */\n};\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/vm/uma_dbg.h",
    "content": "/*-\n * Copyright (c) 2002, 2003, 2004, 2005 Jeffrey Roberson <jeff@FreeBSD.org>\n * Copyright (c) 2004, 2005 Bosko Milekic <bmilekic@FreeBSD.org>\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice unmodified, this list of conditions, and the following\n *    disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR\n * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES\n * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,\n * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF\n * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/vm/uma_dbg.h 148078 2005-07-16 09:51:52Z rwatson $\n *\n */\n\n/* \n *\n * This file includes definitions, structures, prototypes, and inlines used\n * when debugging users of the UMA interface.\n *\n */\n\n#ifndef VM_UMA_DBG_H\n#define VM_UMA_DBG_H\n\nint trash_ctor(void *mem, int size, void *arg, int flags);\nvoid trash_dtor(void *mem, int size, void *arg);\nint trash_init(void *mem, int size, int flags);\nvoid trash_fini(void *mem, int size);\n\n/* For use only by malloc */\nint mtrash_ctor(void *mem, int size, void *arg, int flags);\nvoid mtrash_dtor(void *mem, int size, void *arg);\nint mtrash_init(void *mem, int size, int flags);\nvoid mtrash_fini(void *mem, int size);\n\nvoid uma_dbg_free(uma_zone_t zone, uma_slab_t slab, void *item);\nvoid uma_dbg_alloc(uma_zone_t zone, uma_slab_t slab, void *item);\n\n#endif /* VM_UMA_DBG_H */\n"
  },
  {
    "path": "freebsd-headers/vm/uma_int.h",
    "content": "/*-\n * Copyright (c) 2002-2005, 2009 Jeffrey Roberson <jeff@FreeBSD.org>\n * Copyright (c) 2004, 2005 Bosko Milekic <bmilekic@FreeBSD.org>\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice unmodified, this list of conditions, and the following\n *    disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR\n * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES\n * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,\n * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF\n * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/vm/uma_int.h 222163 2011-05-21 17:43:43Z alc $\n *\n */\n\n/* \n * This file includes definitions, structures, prototypes, and inlines that\n * should not be used outside of the actual implementation of UMA.\n */\n\n/* \n * Here's a quick description of the relationship between the objects:\n *\n * Kegs contain lists of slabs which are stored in either the full bin, empty\n * bin, or partially allocated bin, to reduce fragmentation.  They also contain\n * the user supplied value for size, which is adjusted for alignment purposes\n * and rsize is the result of that.  The Keg also stores information for\n * managing a hash of page addresses that maps pages to uma_slab_t structures\n * for pages that don't have embedded uma_slab_t's.\n *  \n * The uma_slab_t may be embedded in a UMA_SLAB_SIZE chunk of memory or it may\n * be allocated off the page from a special slab zone.  The free list within a\n * slab is managed with a linked list of indices, which are 8 bit values.  If\n * UMA_SLAB_SIZE is defined to be too large I will have to switch to 16bit\n * values.  Currently on alpha you can get 250 or so 32 byte items and on x86\n * you can get 250 or so 16byte items.  For item sizes that would yield more\n * than 10% memory waste we potentially allocate a separate uma_slab_t if this\n * will improve the number of items per slab that will fit.  \n *\n * Other potential space optimizations are storing the 8bit of linkage in space\n * wasted between items due to alignment problems.  This may yield a much better\n * memory footprint for certain sizes of objects.  Another alternative is to\n * increase the UMA_SLAB_SIZE, or allow for dynamic slab sizes.  I prefer\n * dynamic slab sizes because we could stick with 8 bit indices and only use\n * large slab sizes for zones with a lot of waste per slab.  This may create\n * inefficiencies in the vm subsystem due to fragmentation in the address space.\n *\n * The only really gross cases, with regards to memory waste, are for those\n * items that are just over half the page size.   You can get nearly 50% waste,\n * so you fall back to the memory footprint of the power of two allocator. I\n * have looked at memory allocation sizes on many of the machines available to\n * me, and there does not seem to be an abundance of allocations at this range\n * so at this time it may not make sense to optimize for it.  This can, of \n * course, be solved with dynamic slab sizes.\n *\n * Kegs may serve multiple Zones but by far most of the time they only serve\n * one.  When a Zone is created, a Keg is allocated and setup for it.  While\n * the backing Keg stores slabs, the Zone caches Buckets of items allocated\n * from the slabs.  Each Zone is equipped with an init/fini and ctor/dtor\n * pair, as well as with its own set of small per-CPU caches, layered above\n * the Zone's general Bucket cache.\n *\n * The PCPU caches are protected by critical sections, and may be accessed\n * safely only from their associated CPU, while the Zones backed by the same\n * Keg all share a common Keg lock (to coalesce contention on the backing\n * slabs).  The backing Keg typically only serves one Zone but in the case of\n * multiple Zones, one of the Zones is considered the Master Zone and all\n * Zone-related stats from the Keg are done in the Master Zone.  For an\n * example of a Multi-Zone setup, refer to the Mbuf allocation code.\n */\n\n/*\n *\tThis is the representation for normal (Non OFFPAGE slab)\n *\n *\ti == item\n *\ts == slab pointer\n *\n *\t<----------------  Page (UMA_SLAB_SIZE) ------------------>\n *\t___________________________________________________________\n *     | _  _  _  _  _  _  _  _  _  _  _  _  _  _  _   ___________ |\n *     ||i||i||i||i||i||i||i||i||i||i||i||i||i||i||i| |slab header||\n *     ||_||_||_||_||_||_||_||_||_||_||_||_||_||_||_| |___________|| \n *     |___________________________________________________________|\n *\n *\n *\tThis is an OFFPAGE slab. These can be larger than UMA_SLAB_SIZE.\n *\n *\t___________________________________________________________\n *     | _  _  _  _  _  _  _  _  _  _  _  _  _  _  _  _  _  _  _   |\n *     ||i||i||i||i||i||i||i||i||i||i||i||i||i||i||i||i||i||i||i|  |\n *     ||_||_||_||_||_||_||_||_||_||_||_||_||_||_||_||_||_||_||_|  |\n *     |___________________________________________________________|\n *       ___________    ^\n *\t|slab header|   |\n *\t|___________|---*\n *\n */\n\n#ifndef VM_UMA_INT_H\n#define VM_UMA_INT_H\n\n#define UMA_SLAB_SIZE\tPAGE_SIZE\t/* How big are our slabs? */\n#define UMA_SLAB_MASK\t(PAGE_SIZE - 1)\t/* Mask to get back to the page */\n#define UMA_SLAB_SHIFT\tPAGE_SHIFT\t/* Number of bits PAGE_MASK */\n\n#define UMA_BOOT_PAGES\t\t64\t/* Pages allocated for startup */\n\n/* Max waste before going to off page slab management */\n#define UMA_MAX_WASTE\t(UMA_SLAB_SIZE / 10)\n\n/*\n * I doubt there will be many cases where this is exceeded. This is the initial\n * size of the hash table for uma_slabs that are managed off page. This hash\n * does expand by powers of two.  Currently it doesn't get smaller.\n */\n#define UMA_HASH_SIZE_INIT\t32\t\t\n\n/* \n * I should investigate other hashing algorithms.  This should yield a low\n * number of collisions if the pages are relatively contiguous.\n *\n * This is the same algorithm that most processor caches use.\n *\n * I'm shifting and masking instead of % because it should be faster.\n */\n\n#define UMA_HASH(h, s) ((((unsigned long)s) >> UMA_SLAB_SHIFT) &\t\\\n    (h)->uh_hashmask)\n\n#define UMA_HASH_INSERT(h, s, mem)\t\t\t\t\t\\\n\t\tSLIST_INSERT_HEAD(&(h)->uh_slab_hash[UMA_HASH((h),\t\\\n\t\t    (mem))], (s), us_hlink)\n#define UMA_HASH_REMOVE(h, s, mem)\t\t\t\t\t\\\n\t\tSLIST_REMOVE(&(h)->uh_slab_hash[UMA_HASH((h),\t\t\\\n\t\t    (mem))], (s), uma_slab, us_hlink)\n\n/* Hash table for freed address -> slab translation */\n\nSLIST_HEAD(slabhead, uma_slab);\n\nstruct uma_hash {\n\tstruct slabhead\t*uh_slab_hash;\t/* Hash table for slabs */\n\tint\t\tuh_hashsize;\t/* Current size of the hash table */\n\tint\t\tuh_hashmask;\t/* Mask used during hashing */\n};\n\n/*\n * align field or structure to cache line\n */\n#if defined(__amd64__)\n#define UMA_ALIGN\t__aligned(CACHE_LINE_SIZE)\n#else\n#define UMA_ALIGN\n#endif\n\n/*\n * Structures for per cpu queues.\n */\n\nstruct uma_bucket {\n\tLIST_ENTRY(uma_bucket)\tub_link;\t/* Link into the zone */\n\tint16_t\tub_cnt;\t\t\t\t/* Count of free items. */\n\tint16_t\tub_entries;\t\t\t/* Max items. */\n\tvoid\t*ub_bucket[];\t\t\t/* actual allocation storage */\n};\n\ntypedef struct uma_bucket * uma_bucket_t;\n\nstruct uma_cache {\n\tuma_bucket_t\tuc_freebucket;\t/* Bucket we're freeing to */\n\tuma_bucket_t\tuc_allocbucket;\t/* Bucket to allocate from */\n\tu_int64_t\tuc_allocs;\t/* Count of allocations */\n\tu_int64_t\tuc_frees;\t/* Count of frees */\n} UMA_ALIGN;\n\ntypedef struct uma_cache * uma_cache_t;\n\n/*\n * Keg management structure\n *\n * TODO: Optimize for cache line size\n *\n */\nstruct uma_keg {\n\tLIST_ENTRY(uma_keg)\tuk_link;\t/* List of all kegs */\n\n\tstruct mtx\tuk_lock;\t/* Lock for the keg */\n\tstruct uma_hash\tuk_hash;\n\n\tchar\t\t*uk_name;\t\t/* Name of creating zone. */\n\tLIST_HEAD(,uma_zone)\tuk_zones;\t/* Keg's zones */\n\tLIST_HEAD(,uma_slab)\tuk_part_slab;\t/* partially allocated slabs */\n\tLIST_HEAD(,uma_slab)\tuk_free_slab;\t/* empty slab list */\n\tLIST_HEAD(,uma_slab)\tuk_full_slab;\t/* full slabs */\n\n\tu_int32_t\tuk_recurse;\t/* Allocation recursion count */\n\tu_int32_t\tuk_align;\t/* Alignment mask */\n\tu_int32_t\tuk_pages;\t/* Total page count */\n\tu_int32_t\tuk_free;\t/* Count of items free in slabs */\n\tu_int32_t\tuk_size;\t/* Requested size of each item */\n\tu_int32_t\tuk_rsize;\t/* Real size of each item */\n\tu_int32_t\tuk_maxpages;\t/* Maximum number of pages to alloc */\n\n\tuma_init\tuk_init;\t/* Keg's init routine */\n\tuma_fini\tuk_fini;\t/* Keg's fini routine */\n\tuma_alloc\tuk_allocf;\t/* Allocation function */\n\tuma_free\tuk_freef;\t/* Free routine */\n\n\tstruct vm_object\t*uk_obj;\t/* Zone specific object */\n\tvm_offset_t\tuk_kva;\t\t/* Base kva for zones with objs */\n\tuma_zone_t\tuk_slabzone;\t/* Slab zone backing us, if OFFPAGE */\n\n\tu_int16_t\tuk_pgoff;\t/* Offset to uma_slab struct */\n\tu_int16_t\tuk_ppera;\t/* pages per allocation from backend */\n\tu_int16_t\tuk_ipers;\t/* Items per slab */\n\tu_int32_t\tuk_flags;\t/* Internal flags */\n};\ntypedef struct uma_keg\t* uma_keg_t;\n\n/* Page management structure */\n\n/* Sorry for the union, but space efficiency is important */\nstruct uma_slab_head {\n\tuma_keg_t\tus_keg;\t\t\t/* Keg we live in */\n\tunion {\n\t\tLIST_ENTRY(uma_slab)\t_us_link;\t/* slabs in zone */\n\t\tunsigned long\t_us_size;\t/* Size of allocation */\n\t} us_type;\n\tSLIST_ENTRY(uma_slab)\tus_hlink;\t/* Link for hash table */\n\tu_int8_t\t*us_data;\t\t/* First item */\n\tu_int8_t\tus_flags;\t\t/* Page flags see uma.h */\n\tu_int8_t\tus_freecount;\t/* How many are free? */\n\tu_int8_t\tus_firstfree;\t/* First free item index */\n};\n\n/* The standard slab structure */\nstruct uma_slab {\n\tstruct uma_slab_head\tus_head;\t/* slab header data */\n\tstruct {\n\t\tu_int8_t\tus_item;\n\t} us_freelist[1];\t\t\t/* actual number bigger */\n};\n\n/*\n * The slab structure for UMA_ZONE_REFCNT zones for whose items we\n * maintain reference counters in the slab for.\n */\nstruct uma_slab_refcnt {\n\tstruct uma_slab_head\tus_head;\t/* slab header data */\n\tstruct {\n\t\tu_int8_t\tus_item;\n\t\tu_int32_t\tus_refcnt;\n\t} us_freelist[1];\t\t\t/* actual number bigger */\n};\n\n#define\tus_keg\t\tus_head.us_keg\n#define\tus_link\t\tus_head.us_type._us_link\n#define\tus_size\t\tus_head.us_type._us_size\n#define\tus_hlink\tus_head.us_hlink\n#define\tus_data\t\tus_head.us_data\n#define\tus_flags\tus_head.us_flags\n#define\tus_freecount\tus_head.us_freecount\n#define\tus_firstfree\tus_head.us_firstfree\n\ntypedef struct uma_slab * uma_slab_t;\ntypedef struct uma_slab_refcnt * uma_slabrefcnt_t;\ntypedef uma_slab_t (*uma_slaballoc)(uma_zone_t, uma_keg_t, int);\n\n\n/*\n * These give us the size of one free item reference within our corresponding\n * uma_slab structures, so that our calculations during zone setup are correct\n * regardless of what the compiler decides to do with padding the structure\n * arrays within uma_slab.\n */\n#define\tUMA_FRITM_SZ\t(sizeof(struct uma_slab) - sizeof(struct uma_slab_head))\n#define\tUMA_FRITMREF_SZ\t(sizeof(struct uma_slab_refcnt) -\t\\\n    sizeof(struct uma_slab_head))\n\nstruct uma_klink {\n\tLIST_ENTRY(uma_klink)\tkl_link;\n\tuma_keg_t\t\tkl_keg;\n};\ntypedef struct uma_klink *uma_klink_t;\n\n/*\n * Zone management structure \n *\n * TODO: Optimize for cache line size\n *\n */\nstruct uma_zone {\n\tchar\t\t*uz_name;\t/* Text name of the zone */\n\tstruct mtx\t*uz_lock;\t/* Lock for the zone (keg's lock) */\n\n\tLIST_ENTRY(uma_zone)\tuz_link;\t/* List of all zones in keg */\n\tLIST_HEAD(,uma_bucket)\tuz_full_bucket;\t/* full buckets */\n\tLIST_HEAD(,uma_bucket)\tuz_free_bucket;\t/* Buckets for frees */\n\n\tLIST_HEAD(,uma_klink)\tuz_kegs;\t/* List of kegs. */\n\tstruct uma_klink\tuz_klink;\t/* klink for first keg. */\n\n\tuma_slaballoc\tuz_slab;\t/* Allocate a slab from the backend. */\n\tuma_ctor\tuz_ctor;\t/* Constructor for each allocation */\n\tuma_dtor\tuz_dtor;\t/* Destructor */\n\tuma_init\tuz_init;\t/* Initializer for each item */\n\tuma_fini\tuz_fini;\t/* Discards memory */\n\n\tu_int32_t\tuz_flags;\t/* Flags inherited from kegs */\n\tu_int32_t\tuz_size;\t/* Size inherited from kegs */\n\n\tu_int64_t\tuz_allocs UMA_ALIGN; /* Total number of allocations */\n\tu_int64_t\tuz_frees;\t/* Total number of frees */\n\tu_int64_t\tuz_fails;\t/* Total number of alloc failures */\n\tu_int64_t\tuz_sleeps;\t/* Total number of alloc sleeps */\n\tuint16_t\tuz_fills;\t/* Outstanding bucket fills */\n\tuint16_t\tuz_count;\t/* Highest value ub_ptr can have */\n\n\t/*\n\t * This HAS to be the last item because we adjust the zone size\n\t * based on NCPU and then allocate the space for the zones.\n\t */\n\tstruct uma_cache\tuz_cpu[1]; /* Per cpu caches */\n};\n\n/*\n * These flags must not overlap with the UMA_ZONE flags specified in uma.h.\n */\n#define\tUMA_ZFLAG_BUCKET\t0x02000000\t/* Bucket zone. */\n#define\tUMA_ZFLAG_MULTI\t\t0x04000000\t/* Multiple kegs in the zone. */\n#define\tUMA_ZFLAG_DRAINING\t0x08000000\t/* Running zone_drain. */\n#define UMA_ZFLAG_PRIVALLOC\t0x10000000\t/* Use uz_allocf. */\n#define UMA_ZFLAG_INTERNAL\t0x20000000\t/* No offpage no PCPU. */\n#define UMA_ZFLAG_FULL\t\t0x40000000\t/* Reached uz_maxpages */\n#define UMA_ZFLAG_CACHEONLY\t0x80000000\t/* Don't ask VM for buckets. */\n\n#define\tUMA_ZFLAG_INHERIT\t(UMA_ZFLAG_INTERNAL | UMA_ZFLAG_CACHEONLY | \\\n\t\t\t\t    UMA_ZFLAG_BUCKET)\n\n#undef UMA_ALIGN\n\n#ifdef _KERNEL\n/* Internal prototypes */\nstatic __inline uma_slab_t hash_sfind(struct uma_hash *hash, u_int8_t *data);\nvoid *uma_large_malloc(int size, int wait);\nvoid uma_large_free(uma_slab_t slab);\n\n/* Lock Macros */\n\n#define\tKEG_LOCK_INIT(k, lc)\t\t\t\t\t\\\n\tdo {\t\t\t\t\t\t\t\\\n\t\tif ((lc))\t\t\t\t\t\\\n\t\t\tmtx_init(&(k)->uk_lock, (k)->uk_name,\t\\\n\t\t\t    (k)->uk_name, MTX_DEF | MTX_DUPOK);\t\\\n\t\telse\t\t\t\t\t\t\\\n\t\t\tmtx_init(&(k)->uk_lock, (k)->uk_name,\t\\\n\t\t\t    \"UMA zone\", MTX_DEF | MTX_DUPOK);\t\\\n\t} while (0)\n\t    \n#define\tKEG_LOCK_FINI(k)\tmtx_destroy(&(k)->uk_lock)\n#define\tKEG_LOCK(k)\tmtx_lock(&(k)->uk_lock)\n#define\tKEG_UNLOCK(k)\tmtx_unlock(&(k)->uk_lock)\n#define\tZONE_LOCK(z)\tmtx_lock((z)->uz_lock)\n#define ZONE_UNLOCK(z)\tmtx_unlock((z)->uz_lock)\n\n/*\n * Find a slab within a hash table.  This is used for OFFPAGE zones to lookup\n * the slab structure.\n *\n * Arguments:\n *\thash  The hash table to search.\n *\tdata  The base page of the item.\n *\n * Returns:\n *\tA pointer to a slab if successful, else NULL.\n */\nstatic __inline uma_slab_t\nhash_sfind(struct uma_hash *hash, u_int8_t *data)\n{\n        uma_slab_t slab;\n        int hval;\n\n        hval = UMA_HASH(hash, data);\n\n        SLIST_FOREACH(slab, &hash->uh_slab_hash[hval], us_hlink) {\n                if ((u_int8_t *)slab->us_data == data)\n                        return (slab);\n        }\n        return (NULL);\n}\n\nstatic __inline uma_slab_t\nvtoslab(vm_offset_t va)\n{\n\tvm_page_t p;\n\tuma_slab_t slab;\n\n\tp = PHYS_TO_VM_PAGE(pmap_kextract(va));\n\tslab = (uma_slab_t )p->object;\n\n\tif (p->flags & PG_SLAB)\n\t\treturn (slab);\n\telse\n\t\treturn (NULL);\n}\n\nstatic __inline void\nvsetslab(vm_offset_t va, uma_slab_t slab)\n{\n\tvm_page_t p;\n\n\tp = PHYS_TO_VM_PAGE(pmap_kextract(va));\n\tp->object = (vm_object_t)slab;\n\tp->flags |= PG_SLAB;\n}\n\nstatic __inline void\nvsetobj(vm_offset_t va, vm_object_t obj)\n{\n\tvm_page_t p;\n\n\tp = PHYS_TO_VM_PAGE(pmap_kextract(va));\n\tp->object = obj;\n\tp->flags &= ~PG_SLAB;\n}\n\n/*\n * The following two functions may be defined by architecture specific code\n * if they can provide more effecient allocation functions.  This is useful\n * for using direct mapped addresses.\n */\nvoid *uma_small_alloc(uma_zone_t zone, int bytes, u_int8_t *pflag, int wait);\nvoid uma_small_free(void *mem, int size, u_int8_t flags);\n#endif /* _KERNEL */\n\n#endif /* VM_UMA_INT_H */\n"
  },
  {
    "path": "freebsd-headers/vm/vm.h",
    "content": "/*-\n * Copyright (c) 1991, 1993\n *\tThe Regents of the University of California.  All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 4. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t@(#)vm.h\t8.2 (Berkeley) 12/13/93\n *\t@(#)vm_prot.h\t8.1 (Berkeley) 6/11/93\n *\t@(#)vm_inherit.h\t8.1 (Berkeley) 6/11/93\n *\n * Copyright (c) 1987, 1990 Carnegie-Mellon University.\n * All rights reserved.\n *\n * Authors: Avadis Tevanian, Jr., Michael Wayne Young\n *\n * Permission to use, copy, modify and distribute this software and\n * its documentation is hereby granted, provided that both the copyright\n * notice and this permission notice appear in all copies of the\n * software, derivative works or modified versions, and any portions\n * thereof, and that both notices appear in supporting documentation.\n *\n * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS \"AS IS\"\n * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND\n * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.\n *\n * Carnegie Mellon requests users of this software to return to\n *\n *  Software Distribution Coordinator  or  Software.Distribution@CS.CMU.EDU\n *  School of Computer Science\n *  Carnegie Mellon University\n *  Pittsburgh PA 15213-3890\n *\n * any improvements or extensions that they make and grant Carnegie the\n * rights to redistribute these changes.\n *\n * $FreeBSD: release/9.0.0/sys/vm/vm.h 216128 2010-12-02 17:37:16Z trasz $\n */\n\n#ifndef VM_H\n#define VM_H\n\n#include <machine/vm.h>\n\ntypedef char vm_inherit_t;\t/* inheritance codes */\n\n#define\tVM_INHERIT_SHARE\t((vm_inherit_t) 0)\n#define\tVM_INHERIT_COPY\t\t((vm_inherit_t) 1)\n#define\tVM_INHERIT_NONE\t\t((vm_inherit_t) 2)\n#define\tVM_INHERIT_DEFAULT\tVM_INHERIT_COPY\n\ntypedef u_char vm_prot_t;\t/* protection codes */\n\n#define\tVM_PROT_NONE\t\t((vm_prot_t) 0x00)\n#define\tVM_PROT_READ\t\t((vm_prot_t) 0x01)\n#define\tVM_PROT_WRITE\t\t((vm_prot_t) 0x02)\n#define\tVM_PROT_EXECUTE\t\t((vm_prot_t) 0x04)\n#define\tVM_PROT_COPY\t\t((vm_prot_t) 0x08)\t/* copy-on-read */\n\n#define\tVM_PROT_ALL\t\t(VM_PROT_READ|VM_PROT_WRITE|VM_PROT_EXECUTE)\n#define VM_PROT_RW\t\t(VM_PROT_READ|VM_PROT_WRITE)\n#define\tVM_PROT_DEFAULT\t\tVM_PROT_ALL\n\nenum obj_type { OBJT_DEFAULT, OBJT_SWAP, OBJT_VNODE, OBJT_DEVICE, OBJT_PHYS,\n\t\tOBJT_DEAD, OBJT_SG };\ntypedef u_char objtype_t;\n\nunion vm_map_object;\ntypedef union vm_map_object vm_map_object_t;\n\nstruct vm_map_entry;\ntypedef struct vm_map_entry *vm_map_entry_t;\n\nstruct vm_map;\ntypedef struct vm_map *vm_map_t;\n\nstruct vm_object;\ntypedef struct vm_object *vm_object_t;\n\n#ifndef _KERNEL\n/*\n * This is defined in <sys/types.h> for the kernel so that non-vm kernel\n * sources (mainly Mach-derived ones such as ddb) don't have to include\n * vm stuff.  Defining it there for applications might break things.\n * Define it here for \"applications\" that include vm headers (e.g.,\n * genassym).\n */\ntypedef int boolean_t;\n\n/*\n * The exact set of memory attributes is machine dependent.  However, every\n * machine is required to define VM_MEMATTR_DEFAULT.\n */\ntypedef\tchar vm_memattr_t;\t/* memory attribute codes */\n\n/*\n * This is defined in <sys/types.h> for the kernel so that vnode_if.h\n * doesn't have to include <vm/vm.h>.\n */\nstruct vm_page;\ntypedef struct vm_page *vm_page_t;\n#endif\t\t\t\t/* _KERNEL */\n\nstruct vm_reserv;\ntypedef struct vm_reserv *vm_reserv_t;\n\n/*\n * Information passed from the machine-independant VM initialization code\n * for use by machine-dependant code (mainly for MMU support)\n */\nstruct kva_md_info {\n\tvm_offset_t\tbuffer_sva;\n\tvm_offset_t\tbuffer_eva;\n\tvm_offset_t\tclean_sva;\n\tvm_offset_t\tclean_eva;\n\tvm_offset_t\tpager_sva;\n\tvm_offset_t\tpager_eva;\n};\n\nextern struct kva_md_info\tkmi;\nextern void vm_ksubmap_init(struct kva_md_info *);\n\nstruct ucred;\nint swap_reserve(vm_ooffset_t incr);\nint swap_reserve_by_cred(vm_ooffset_t incr, struct ucred *cred);\nvoid swap_reserve_force(vm_ooffset_t incr);\nvoid swap_release(vm_ooffset_t decr);\nvoid swap_release_by_cred(vm_ooffset_t decr, struct ucred *cred);\n\n#endif\t\t\t\t/* VM_H */\n\n"
  },
  {
    "path": "freebsd-headers/vm/vm_extern.h",
    "content": "/*-\n * Copyright (c) 1992, 1993\n *\tThe Regents of the University of California.  All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 4. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t@(#)vm_extern.h\t8.2 (Berkeley) 1/12/94\n * $FreeBSD: release/9.0.0/sys/vm/vm_extern.h 223914 2011-07-10 20:49:13Z kib $\n */\n\n#ifndef _VM_EXTERN_H_\n#define\t_VM_EXTERN_H_\n\nstruct proc;\nstruct vmspace;\nstruct vnode;\n\n#ifdef _KERNEL\n\nint kernacc(void *, int, int);\nvm_offset_t kmem_alloc(vm_map_t, vm_size_t);\nvm_offset_t kmem_alloc_attr(vm_map_t map, vm_size_t size, int flags,\n    vm_paddr_t low, vm_paddr_t high, vm_memattr_t memattr);\nvm_offset_t kmem_alloc_contig(vm_map_t map, vm_size_t size, int flags,\n    vm_paddr_t low, vm_paddr_t high, unsigned long alignment,\n    unsigned long boundary, vm_memattr_t memattr);\nvm_offset_t kmem_alloc_nofault(vm_map_t, vm_size_t);\nvm_offset_t kmem_alloc_nofault_space(vm_map_t, vm_size_t, int);\nvm_offset_t kmem_alloc_wait(vm_map_t, vm_size_t);\nvoid kmem_free(vm_map_t, vm_offset_t, vm_size_t);\nvoid kmem_free_wakeup(vm_map_t, vm_offset_t, vm_size_t);\nvoid kmem_init(vm_offset_t, vm_offset_t);\nvm_offset_t kmem_malloc(vm_map_t map, vm_size_t size, int flags);\nint kmem_back(vm_map_t, vm_offset_t, vm_size_t, int);\nvm_map_t kmem_suballoc(vm_map_t, vm_offset_t *, vm_offset_t *, vm_size_t,\n    boolean_t);\nvoid swapout_procs(int);\nint useracc(void *, int, int);\nint vm_fault(vm_map_t, vm_offset_t, vm_prot_t, int);\nvoid vm_fault_copy_entry(vm_map_t, vm_map_t, vm_map_entry_t, vm_map_entry_t,\n    vm_ooffset_t *);\nint vm_fault_disable_pagefaults(void);\nvoid vm_fault_enable_pagefaults(int save);\nint vm_fault_hold(vm_map_t map, vm_offset_t vaddr, vm_prot_t fault_type,\n    int fault_flags, vm_page_t *m_hold);\nint vm_fault_quick_hold_pages(vm_map_t map, vm_offset_t addr, vm_size_t len,\n    vm_prot_t prot, vm_page_t *ma, int max_count);\nvoid vm_fault_unwire(vm_map_t, vm_offset_t, vm_offset_t, boolean_t);\nint vm_fault_wire(vm_map_t, vm_offset_t, vm_offset_t, boolean_t);\nint vm_forkproc(struct thread *, struct proc *, struct thread *, struct vmspace *, int);\nvoid vm_waitproc(struct proc *);\nint vm_mmap(vm_map_t, vm_offset_t *, vm_size_t, vm_prot_t, vm_prot_t, int, objtype_t, void *, vm_ooffset_t);\nint vm_mmap_to_errno(int rv);\nvoid vm_set_page_size(void);\nvoid vm_sync_icache(vm_map_t, vm_offset_t, vm_size_t);\nstruct vmspace *vmspace_alloc(vm_offset_t, vm_offset_t);\nstruct vmspace *vmspace_fork(struct vmspace *, vm_ooffset_t *);\nint vmspace_exec(struct proc *, vm_offset_t, vm_offset_t);\nint vmspace_unshare(struct proc *);\nvoid vmspace_exit(struct thread *);\nstruct vmspace *vmspace_acquire_ref(struct proc *);\nvoid vmspace_free(struct vmspace *);\nvoid vmspace_exitfree(struct proc *);\nvoid vnode_pager_setsize(struct vnode *, vm_ooffset_t);\nint vslock(void *, size_t);\nvoid vsunlock(void *, size_t);\nstruct sf_buf *vm_imgact_map_page(vm_object_t object, vm_ooffset_t offset);\nvoid vm_imgact_unmap_page(struct sf_buf *sf);\nvoid vm_thread_dispose(struct thread *td);\nint vm_thread_new(struct thread *td, int pages);\n#endif\t\t\t\t/* _KERNEL */\n#endif\t\t\t\t/* !_VM_EXTERN_H_ */\n"
  },
  {
    "path": "freebsd-headers/vm/vm_kern.h",
    "content": "/*-\n * Copyright (c) 1991, 1993\n *\tThe Regents of the University of California.  All rights reserved.\n *\n * This code is derived from software contributed to Berkeley by\n * The Mach Operating System project at Carnegie-Mellon University.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 4. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\tfrom: @(#)vm_kern.h\t8.1 (Berkeley) 6/11/93\n *\n *\n * Copyright (c) 1987, 1990 Carnegie-Mellon University.\n * All rights reserved.\n *\n * Authors: Avadis Tevanian, Jr., Michael Wayne Young\n *\n * Permission to use, copy, modify and distribute this software and\n * its documentation is hereby granted, provided that both the copyright\n * notice and this permission notice appear in all copies of the\n * software, derivative works or modified versions, and any portions\n * thereof, and that both notices appear in supporting documentation.\n *\n * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS \"AS IS\"\n * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND\n * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.\n *\n * Carnegie Mellon requests users of this software to return to\n *\n *  Software Distribution Coordinator  or  Software.Distribution@CS.CMU.EDU\n *  School of Computer Science\n *  Carnegie Mellon University\n *  Pittsburgh PA 15213-3890\n *\n * any improvements or extensions that they make and grant Carnegie the\n * rights to redistribute these changes.\n *\n * $FreeBSD: release/9.0.0/sys/vm/vm_kern.h 180308 2008-07-05 19:34:33Z alc $\n */\n\n#ifndef _VM_VM_KERN_H_\n#define _VM_VM_KERN_H_ 1\n\n/* Kernel memory management definitions. */\nextern vm_map_t buffer_map;\nextern vm_map_t kernel_map;\nextern vm_map_t kmem_map;\nextern vm_map_t exec_map;\nextern vm_map_t pipe_map;\nextern u_long vm_kmem_size;\n\n#endif\t\t\t\t/* _VM_VM_KERN_H_ */\n"
  },
  {
    "path": "freebsd-headers/vm/vm_map.h",
    "content": "/*-\n * Copyright (c) 1991, 1993\n *\tThe Regents of the University of California.  All rights reserved.\n *\n * This code is derived from software contributed to Berkeley by\n * The Mach Operating System project at Carnegie-Mellon University.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 4. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t@(#)vm_map.h\t8.9 (Berkeley) 5/17/95\n *\n *\n * Copyright (c) 1987, 1990 Carnegie-Mellon University.\n * All rights reserved.\n *\n * Authors: Avadis Tevanian, Jr., Michael Wayne Young\n *\n * Permission to use, copy, modify and distribute this software and\n * its documentation is hereby granted, provided that both the copyright\n * notice and this permission notice appear in all copies of the\n * software, derivative works or modified versions, and any portions\n * thereof, and that both notices appear in supporting documentation.\n *\n * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS \"AS IS\"\n * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND\n * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.\n *\n * Carnegie Mellon requests users of this software to return to\n *\n *  Software Distribution Coordinator  or  Software.Distribution@CS.CMU.EDU\n *  School of Computer Science\n *  Carnegie Mellon University\n *  Pittsburgh PA 15213-3890\n *\n * any improvements or extensions that they make and grant Carnegie the\n * rights to redistribute these changes.\n *\n * $FreeBSD: release/9.0.0/sys/vm/vm_map.h 219819 2011-03-21 09:40:01Z jeff $\n */\n\n/*\n *\tVirtual memory map module definitions.\n */\n#ifndef\t_VM_MAP_\n#define\t_VM_MAP_\n\n#include <sys/lock.h>\n#include <sys/sx.h>\n#include <sys/_mutex.h>\n\n/*\n *\tTypes defined:\n *\n *\tvm_map_t\t\tthe high-level address map data structure.\n *\tvm_map_entry_t\t\tan entry in an address map.\n */\n\ntypedef u_char vm_flags_t;\ntypedef u_int vm_eflags_t;\n\n/*\n *\tObjects which live in maps may be either VM objects, or\n *\tanother map (called a \"sharing map\") which denotes read-write\n *\tsharing with other maps.\n */\nunion vm_map_object {\n\tstruct vm_object *vm_object;\t/* object object */\n\tstruct vm_map *sub_map;\t\t/* belongs to another map */\n};\n\n/*\n *\tAddress map entries consist of start and end addresses,\n *\ta VM object (or sharing map) and offset into that object,\n *\tand user-exported inheritance and protection information.\n *\tAlso included is control information for virtual copy operations.\n */\nstruct vm_map_entry {\n\tstruct vm_map_entry *prev;\t/* previous entry */\n\tstruct vm_map_entry *next;\t/* next entry */\n\tstruct vm_map_entry *left;\t/* left child in binary search tree */\n\tstruct vm_map_entry *right;\t/* right child in binary search tree */\n\tvm_offset_t start;\t\t/* start address */\n\tvm_offset_t end;\t\t/* end address */\n\tvm_offset_t avail_ssize;\t/* amt can grow if this is a stack */\n\tvm_size_t adj_free;\t\t/* amount of adjacent free space */\n\tvm_size_t max_free;\t\t/* max free space in subtree */\n\tunion vm_map_object object;\t/* object I point to */\n\tvm_ooffset_t offset;\t\t/* offset into object */\n\tvm_eflags_t eflags;\t\t/* map entry flags */\n\tvm_prot_t protection;\t\t/* protection code */\n\tvm_prot_t max_protection;\t/* maximum protection */\n\tvm_inherit_t inheritance;\t/* inheritance */\n\tint wired_count;\t\t/* can be paged if = 0 */\n\tvm_pindex_t lastr;\t\t/* last read */\n\tstruct ucred *cred;\t\t/* tmp storage for creator ref */\n};\n\n#define MAP_ENTRY_NOSYNC\t\t0x0001\n#define MAP_ENTRY_IS_SUB_MAP\t\t0x0002\n#define MAP_ENTRY_COW\t\t\t0x0004\n#define MAP_ENTRY_NEEDS_COPY\t\t0x0008\n#define MAP_ENTRY_NOFAULT\t\t0x0010\n#define MAP_ENTRY_USER_WIRED\t\t0x0020\n\n#define MAP_ENTRY_BEHAV_NORMAL\t\t0x0000\t/* default behavior */\n#define MAP_ENTRY_BEHAV_SEQUENTIAL\t0x0040\t/* expect sequential access */\n#define MAP_ENTRY_BEHAV_RANDOM\t\t0x0080\t/* expect random access */\n#define MAP_ENTRY_BEHAV_RESERVED\t0x00C0\t/* future use */\n\n#define MAP_ENTRY_BEHAV_MASK\t\t0x00C0\n\n#define MAP_ENTRY_IN_TRANSITION\t\t0x0100\t/* entry being changed */\n#define MAP_ENTRY_NEEDS_WAKEUP\t\t0x0200\t/* waiters in transition */\n#define MAP_ENTRY_NOCOREDUMP\t\t0x0400\t/* don't include in a core */\n\n#define\tMAP_ENTRY_GROWS_DOWN\t\t0x1000\t/* Top-down stacks */\n#define\tMAP_ENTRY_GROWS_UP\t\t0x2000\t/* Bottom-up stacks */\n\n#define\tMAP_ENTRY_WIRE_SKIPPED\t\t0x4000\n\n#ifdef\t_KERNEL\nstatic __inline u_char\nvm_map_entry_behavior(vm_map_entry_t entry)\n{\n\treturn (entry->eflags & MAP_ENTRY_BEHAV_MASK);\n}\n\nstatic __inline int\nvm_map_entry_user_wired_count(vm_map_entry_t entry)\n{\n\tif (entry->eflags & MAP_ENTRY_USER_WIRED)\n\t\treturn (1);\n\treturn (0);\n}\n\nstatic __inline int\nvm_map_entry_system_wired_count(vm_map_entry_t entry)\n{\n\treturn (entry->wired_count - vm_map_entry_user_wired_count(entry));\n}\n#endif\t/* _KERNEL */\n\n/*\n *\tA map is a set of map entries.  These map entries are\n *\torganized both as a binary search tree and as a doubly-linked\n *\tlist.  Both structures are ordered based upon the start and\n *\tend addresses contained within each map entry.  Sleator and\n *\tTarjan's top-down splay algorithm is employed to control\n *\theight imbalance in the binary search tree.\n *\n * List of locks\n *\t(c)\tconst until freed\n */\nstruct vm_map {\n\tstruct vm_map_entry header;\t/* List of entries */\n\tstruct sx lock;\t\t\t/* Lock for map data */\n\tstruct mtx system_mtx;\n\tint nentries;\t\t\t/* Number of entries */\n\tvm_size_t size;\t\t\t/* virtual size */\n\tu_int timestamp;\t\t/* Version number */\n\tu_char needs_wakeup;\n\tu_char system_map;\t\t/* (c) Am I a system map? */\n\tvm_flags_t flags;\t\t/* flags for this vm_map */\n\tvm_map_entry_t root;\t\t/* Root of a binary search tree */\n\tpmap_t pmap;\t\t\t/* (c) Physical map */\n#define\tmin_offset\theader.start\t/* (c) */\n#define\tmax_offset\theader.end\t/* (c) */\n\tint busy;\n};\n\n/*\n * vm_flags_t values\n */\n#define MAP_WIREFUTURE\t\t0x01\t/* wire all future pages */\n#define\tMAP_BUSY_WAKEUP\t\t0x02\n\n#ifdef\t_KERNEL\nstatic __inline vm_offset_t\nvm_map_max(vm_map_t map)\n{\n\treturn (map->max_offset);\n}\n\nstatic __inline vm_offset_t\nvm_map_min(vm_map_t map)\n{\n\treturn (map->min_offset);\n}\n\nstatic __inline pmap_t\nvm_map_pmap(vm_map_t map)\n{\n\treturn (map->pmap);\n}\n\nstatic __inline void\nvm_map_modflags(vm_map_t map, vm_flags_t set, vm_flags_t clear)\n{\n\tmap->flags = (map->flags | set) & ~clear;\n}\n#endif\t/* _KERNEL */\n\n/*\n * Shareable process virtual address space.\n *\n * List of locks\n *\t(c)\tconst until freed\n */\nstruct vmspace {\n\tstruct vm_map vm_map;\t/* VM address map */\n\tstruct shmmap_state *vm_shm;\t/* SYS5 shared memory private data XXX */\n\tsegsz_t vm_swrss;\t/* resident set size before last swap */\n\tsegsz_t vm_tsize;\t/* text size (pages) XXX */\n\tsegsz_t vm_dsize;\t/* data size (pages) XXX */\n\tsegsz_t vm_ssize;\t/* stack size (pages) */\n\tcaddr_t vm_taddr;\t/* (c) user virtual address of text */\n\tcaddr_t vm_daddr;\t/* (c) user virtual address of data */\n\tcaddr_t vm_maxsaddr;\t/* user VA at max stack growth */\n\tvolatile int vm_refcnt;\t/* number of references */\n\t/*\n\t * Keep the PMAP last, so that CPU-specific variations of that\n\t * structure on a single architecture don't result in offset\n\t * variations of the machine-independent fields in the vmspace.\n\t */\n\tstruct pmap vm_pmap;\t/* private physical map */\n};\n\n#ifdef\t_KERNEL\nstatic __inline pmap_t\nvmspace_pmap(struct vmspace *vmspace)\n{\n\treturn &vmspace->vm_pmap;\n}\n#endif\t/* _KERNEL */\n\n#ifdef\t_KERNEL\n/*\n *\tMacros:\t\tvm_map_lock, etc.\n *\tFunction:\n *\t\tPerform locking on the data portion of a map.  Note that\n *\t\tthese macros mimic procedure calls returning void.  The\n *\t\tsemicolon is supplied by the user of these macros, not\n *\t\tby the macros themselves.  The macros can safely be used\n *\t\tas unbraced elements in a higher level statement.\n */\n\nvoid _vm_map_lock(vm_map_t map, const char *file, int line);\nvoid _vm_map_unlock(vm_map_t map, const char *file, int line);\nint _vm_map_unlock_and_wait(vm_map_t map, int timo, const char *file, int line);\nvoid _vm_map_lock_read(vm_map_t map, const char *file, int line);\nvoid _vm_map_unlock_read(vm_map_t map, const char *file, int line);\nint _vm_map_trylock(vm_map_t map, const char *file, int line);\nint _vm_map_trylock_read(vm_map_t map, const char *file, int line);\nint _vm_map_lock_upgrade(vm_map_t map, const char *file, int line);\nvoid _vm_map_lock_downgrade(vm_map_t map, const char *file, int line);\nint vm_map_locked(vm_map_t map);\nvoid vm_map_wakeup(vm_map_t map);\nvoid vm_map_busy(vm_map_t map);\nvoid vm_map_unbusy(vm_map_t map);\nvoid vm_map_wait_busy(vm_map_t map);\n\n#define\tvm_map_lock(map)\t_vm_map_lock(map, LOCK_FILE, LOCK_LINE)\n#define\tvm_map_unlock(map)\t_vm_map_unlock(map, LOCK_FILE, LOCK_LINE)\n#define\tvm_map_unlock_and_wait(map, timo)\t\\\n\t\t\t_vm_map_unlock_and_wait(map, timo, LOCK_FILE, LOCK_LINE)\n#define\tvm_map_lock_read(map)\t_vm_map_lock_read(map, LOCK_FILE, LOCK_LINE)\n#define\tvm_map_unlock_read(map)\t_vm_map_unlock_read(map, LOCK_FILE, LOCK_LINE)\n#define\tvm_map_trylock(map)\t_vm_map_trylock(map, LOCK_FILE, LOCK_LINE)\n#define\tvm_map_trylock_read(map)\t\\\n\t\t\t_vm_map_trylock_read(map, LOCK_FILE, LOCK_LINE)\n#define\tvm_map_lock_upgrade(map)\t\\\n\t\t\t_vm_map_lock_upgrade(map, LOCK_FILE, LOCK_LINE)\n#define\tvm_map_lock_downgrade(map)\t\\\n\t\t\t_vm_map_lock_downgrade(map, LOCK_FILE, LOCK_LINE)\n\nlong vmspace_resident_count(struct vmspace *vmspace);\nlong vmspace_wired_count(struct vmspace *vmspace);\n#endif\t/* _KERNEL */\n\n\n/* XXX: number of kernel maps and entries to statically allocate */\n#define MAX_KMAP\t10\n#define\tMAX_KMAPENT\t128\n\n/*\n * Copy-on-write flags for vm_map operations\n */\n#define MAP_UNUSED_01\t\t0x0001\n#define MAP_COPY_ON_WRITE\t0x0002\n#define MAP_NOFAULT\t\t0x0004\n#define MAP_PREFAULT\t\t0x0008\n#define MAP_PREFAULT_PARTIAL\t0x0010\n#define MAP_DISABLE_SYNCER\t0x0020\n#define MAP_DISABLE_COREDUMP\t0x0100\n#define MAP_PREFAULT_MADVISE\t0x0200\t/* from (user) madvise request */\n#define\tMAP_STACK_GROWS_DOWN\t0x1000\n#define\tMAP_STACK_GROWS_UP\t0x2000\n#define\tMAP_ACC_CHARGED\t\t0x4000\n#define\tMAP_ACC_NO_CHARGE\t0x8000\n\n/*\n * vm_fault option flags\n */\n#define VM_FAULT_NORMAL 0\t\t/* Nothing special */\n#define VM_FAULT_CHANGE_WIRING 1\t/* Change the wiring as appropriate */\n#define\tVM_FAULT_DIRTY 2\t\t/* Dirty the page; use w/VM_PROT_COPY */\n\n/*\n * The following \"find_space\" options are supported by vm_map_find()\n */\n#define\tVMFS_NO_SPACE\t\t0\t/* don't find; use the given range */\n#define\tVMFS_ANY_SPACE\t\t1\t/* find a range with any alignment */\n#define\tVMFS_ALIGNED_SPACE\t2\t/* find a superpage-aligned range */\n#if defined(__mips__)\n#define\tVMFS_TLB_ALIGNED_SPACE\t3\t/* find a TLB entry aligned range */\n#endif\n\n/*\n * vm_map_wire and vm_map_unwire option flags\n */\n#define VM_MAP_WIRE_SYSTEM\t0\t/* wiring in a kernel map */\n#define VM_MAP_WIRE_USER\t1\t/* wiring in a user map */\n\n#define VM_MAP_WIRE_NOHOLES\t0\t/* region must not have holes */\n#define VM_MAP_WIRE_HOLESOK\t2\t/* region may have holes */\n\n#define VM_MAP_WIRE_WRITE\t4\t/* Validate writable. */\n\n#ifdef _KERNEL\nboolean_t vm_map_check_protection (vm_map_t, vm_offset_t, vm_offset_t, vm_prot_t);\nvm_map_t vm_map_create(pmap_t, vm_offset_t, vm_offset_t);\nint vm_map_delete(vm_map_t, vm_offset_t, vm_offset_t);\nint vm_map_find(vm_map_t, vm_object_t, vm_ooffset_t, vm_offset_t *, vm_size_t,\n    int, vm_prot_t, vm_prot_t, int);\nint vm_map_fixed(vm_map_t, vm_object_t, vm_ooffset_t, vm_offset_t, vm_size_t,\n    vm_prot_t, vm_prot_t, int);\nint vm_map_findspace (vm_map_t, vm_offset_t, vm_size_t, vm_offset_t *);\nint vm_map_inherit (vm_map_t, vm_offset_t, vm_offset_t, vm_inherit_t);\nvoid vm_map_init(vm_map_t, pmap_t, vm_offset_t, vm_offset_t);\nint vm_map_insert (vm_map_t, vm_object_t, vm_ooffset_t, vm_offset_t, vm_offset_t, vm_prot_t, vm_prot_t, int);\nint vm_map_lookup (vm_map_t *, vm_offset_t, vm_prot_t, vm_map_entry_t *, vm_object_t *,\n    vm_pindex_t *, vm_prot_t *, boolean_t *);\nint vm_map_lookup_locked(vm_map_t *, vm_offset_t, vm_prot_t, vm_map_entry_t *, vm_object_t *,\n    vm_pindex_t *, vm_prot_t *, boolean_t *);\nvoid vm_map_lookup_done (vm_map_t, vm_map_entry_t);\nboolean_t vm_map_lookup_entry (vm_map_t, vm_offset_t, vm_map_entry_t *);\nvoid vm_map_pmap_enter(vm_map_t map, vm_offset_t addr, vm_prot_t prot,\n    vm_object_t object, vm_pindex_t pindex, vm_size_t size, int flags);\nint vm_map_protect (vm_map_t, vm_offset_t, vm_offset_t, vm_prot_t, boolean_t);\nint vm_map_remove (vm_map_t, vm_offset_t, vm_offset_t);\nvoid vm_map_startup (void);\nint vm_map_submap (vm_map_t, vm_offset_t, vm_offset_t, vm_map_t);\nint vm_map_sync(vm_map_t, vm_offset_t, vm_offset_t, boolean_t, boolean_t);\nint vm_map_madvise (vm_map_t, vm_offset_t, vm_offset_t, int);\nvoid vm_map_simplify_entry (vm_map_t, vm_map_entry_t);\nvoid vm_init2 (void);\nint vm_map_stack (vm_map_t, vm_offset_t, vm_size_t, vm_prot_t, vm_prot_t, int);\nint vm_map_growstack (struct proc *p, vm_offset_t addr);\nint vm_map_unwire(vm_map_t map, vm_offset_t start, vm_offset_t end,\n    int flags);\nint vm_map_wire(vm_map_t map, vm_offset_t start, vm_offset_t end,\n    int flags);\nlong vmspace_swap_count(struct vmspace *vmspace);\n#endif\t\t\t\t/* _KERNEL */\n#endif\t\t\t\t/* _VM_MAP_ */\n"
  },
  {
    "path": "freebsd-headers/vm/vm_object.h",
    "content": "/*-\n * Copyright (c) 1991, 1993\n *\tThe Regents of the University of California.  All rights reserved.\n *\n * This code is derived from software contributed to Berkeley by\n * The Mach Operating System project at Carnegie-Mellon University.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 4. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\tfrom: @(#)vm_object.h\t8.3 (Berkeley) 1/12/94\n *\n *\n * Copyright (c) 1987, 1990 Carnegie-Mellon University.\n * All rights reserved.\n *\n * Authors: Avadis Tevanian, Jr., Michael Wayne Young\n *\n * Permission to use, copy, modify and distribute this software and\n * its documentation is hereby granted, provided that both the copyright\n * notice and this permission notice appear in all copies of the\n * software, derivative works or modified versions, and any portions\n * thereof, and that both notices appear in supporting documentation.\n *\n * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS \"AS IS\"\n * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND\n * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.\n *\n * Carnegie Mellon requests users of this software to return to\n *\n *  Software Distribution Coordinator  or  Software.Distribution@CS.CMU.EDU\n *  School of Computer Science\n *  Carnegie Mellon University\n *  Pittsburgh PA 15213-3890\n *\n * any improvements or extensions that they make and grant Carnegie the\n * rights to redistribute these changes.\n *\n * $FreeBSD: release/9.0.0/sys/vm/vm_object.h 223677 2011-06-29 16:40:41Z alc $\n */\n\n/*\n *\tVirtual memory object module definitions.\n */\n\n#ifndef\t_VM_OBJECT_\n#define\t_VM_OBJECT_\n\n#include <sys/queue.h>\n#include <sys/_lock.h>\n#include <sys/_mutex.h>\n\n/*\n *\tTypes defined:\n *\n *\tvm_object_t\t\tVirtual memory object.\n *\n * List of locks\n *\t(c)\tconst until freed\n *\n */\n\nstruct vm_object {\n\tstruct mtx mtx;\n\tTAILQ_ENTRY(vm_object) object_list; /* list of all objects */\n\tLIST_HEAD(, vm_object) shadow_head; /* objects that this is a shadow for */\n\tLIST_ENTRY(vm_object) shadow_list; /* chain of shadow objects */\n\tTAILQ_HEAD(, vm_page) memq;\t/* list of resident pages */\n\tvm_page_t root;\t\t\t/* root of the resident page splay tree */\n\tvm_pindex_t size;\t\t/* Object size */\n\tint generation;\t\t\t/* generation ID */\n\tint ref_count;\t\t\t/* How many refs?? */\n\tint shadow_count;\t\t/* how many objects that this is a shadow for */\n\tvm_memattr_t memattr;\t\t/* default memory attribute for pages */\n\tobjtype_t type;\t\t\t/* type of pager */\n\tu_short flags;\t\t\t/* see below */\n\tu_short pg_color;\t\t/* (c) color of first page in obj */\n\tu_short paging_in_progress;\t/* Paging (in or out) so don't collapse or destroy */\n\tint resident_page_count;\t/* number of resident pages */\n\tstruct vm_object *backing_object; /* object that I'm a shadow of */\n\tvm_ooffset_t backing_object_offset;/* Offset in backing object */\n\tTAILQ_ENTRY(vm_object) pager_object_list; /* list of all objects of this pager type */\n\tLIST_HEAD(, vm_reserv) rvq;\t/* list of reservations */\n\tvm_page_t cache;\t\t/* root of the cache page splay tree */\n\tvoid *handle;\n\tunion {\n\t\t/*\n\t\t * VNode pager\n\t\t *\n\t\t *\tvnp_size - current size of file\n\t\t */\n\t\tstruct {\n\t\t\toff_t vnp_size;\n\t\t} vnp;\n\n\t\t/*\n\t\t * Device pager\n\t\t *\n\t\t *\tdevp_pglist - list of allocated pages\n\t\t */\n\t\tstruct {\n\t\t\tTAILQ_HEAD(, vm_page) devp_pglist;\n\t\t} devp;\n\n\t\t/*\n\t\t * SG pager\n\t\t *\n\t\t *\tsgp_pglist - list of allocated pages\n\t\t */\n\t\tstruct {\n\t\t\tTAILQ_HEAD(, vm_page) sgp_pglist;\n\t\t} sgp;\n\n\t\t/*\n\t\t * Swap pager\n\t\t *\n\t\t *\tswp_bcount - number of swap 'swblock' metablocks, each\n\t\t *\t\t     contains up to 16 swapblk assignments.\n\t\t *\t\t     see vm/swap_pager.h\n\t\t */\n\t\tstruct {\n\t\t\tint swp_bcount;\n\t\t} swp;\n\t} un_pager;\n\tstruct ucred *cred;\n\tvm_ooffset_t charge;\n};\n\n/*\n * Flags\n */\n#define OBJ_ACTIVE\t0x0004\t\t/* active objects */\n#define OBJ_DEAD\t0x0008\t\t/* dead objects (during rundown) */\n#define\tOBJ_NOSPLIT\t0x0010\t\t/* dont split this object */\n#define OBJ_PIPWNT\t0x0040\t\t/* paging in progress wanted */\n#define OBJ_MIGHTBEDIRTY 0x0100\t\t/* object might be dirty, only for vnode */\n#define\tOBJ_COLORED\t0x1000\t\t/* pg_color is defined */\n#define\tOBJ_ONEMAPPING\t0x2000\t\t/* One USE (a single, non-forked) mapping flag */\n#define\tOBJ_DISCONNECTWNT 0x4000\t/* disconnect from vnode wanted */\n\n#define IDX_TO_OFF(idx) (((vm_ooffset_t)(idx)) << PAGE_SHIFT)\n#define OFF_TO_IDX(off) ((vm_pindex_t)(((vm_ooffset_t)(off)) >> PAGE_SHIFT))\n\n#ifdef\t_KERNEL\n\n#define OBJPC_SYNC\t0x1\t\t\t/* sync I/O */\n#define OBJPC_INVAL\t0x2\t\t\t/* invalidate */\n#define OBJPC_NOSYNC\t0x4\t\t\t/* skip if PG_NOSYNC */\n\n/*\n * The following options are supported by vm_object_page_remove().\n */\n#define\tOBJPR_CLEANONLY\t0x1\t\t/* Don't remove dirty pages. */\n#define\tOBJPR_NOTMAPPED\t0x2\t\t/* Don't unmap pages. */\n\nTAILQ_HEAD(object_q, vm_object);\n\nextern struct object_q vm_object_list;\t/* list of allocated objects */\nextern struct mtx vm_object_list_mtx;\t/* lock for object list and count */\n\nextern struct vm_object kernel_object_store;\nextern struct vm_object kmem_object_store;\n\n#define\tkernel_object\t(&kernel_object_store)\n#define\tkmem_object\t(&kmem_object_store)\n\n#define\tVM_OBJECT_LOCK(object)\t\tmtx_lock(&(object)->mtx)\n#define\tVM_OBJECT_LOCK_ASSERT(object, type) \\\n\t\t\t\t\tmtx_assert(&(object)->mtx, (type))\n#define\tVM_OBJECT_LOCK_INIT(object, type) \\\n\t\t\t\t\tmtx_init(&(object)->mtx, \"vm object\", \\\n\t\t\t\t\t    (type), MTX_DEF | MTX_DUPOK)\n#define\tVM_OBJECT_LOCKED(object)\tmtx_owned(&(object)->mtx)\n#define\tVM_OBJECT_MTX(object)\t\t(&(object)->mtx)\n#define\tVM_OBJECT_TRYLOCK(object)\tmtx_trylock(&(object)->mtx)\n#define\tVM_OBJECT_UNLOCK(object)\tmtx_unlock(&(object)->mtx)\n\n/*\n *\tThe object must be locked or thread private.\n */\nstatic __inline void\nvm_object_set_flag(vm_object_t object, u_short bits)\n{\n\n\tobject->flags |= bits;\n}\n\nvoid vm_object_clear_flag(vm_object_t object, u_short bits);\nvoid vm_object_pip_add(vm_object_t object, short i);\nvoid vm_object_pip_subtract(vm_object_t object, short i);\nvoid vm_object_pip_wakeup(vm_object_t object);\nvoid vm_object_pip_wakeupn(vm_object_t object, short i);\nvoid vm_object_pip_wait(vm_object_t object, char *waitid);\n\nvm_object_t vm_object_allocate (objtype_t, vm_pindex_t);\nvoid _vm_object_allocate (objtype_t, vm_pindex_t, vm_object_t);\nboolean_t vm_object_coalesce(vm_object_t, vm_ooffset_t, vm_size_t, vm_size_t,\n   boolean_t);\nvoid vm_object_collapse (vm_object_t);\nvoid vm_object_deallocate (vm_object_t);\nvoid vm_object_destroy (vm_object_t);\nvoid vm_object_terminate (vm_object_t);\nvoid vm_object_set_writeable_dirty (vm_object_t);\nvoid vm_object_init (void);\nvoid vm_object_page_clean(vm_object_t object, vm_ooffset_t start,\n    vm_ooffset_t end, int flags);\nvoid vm_object_page_remove(vm_object_t object, vm_pindex_t start,\n    vm_pindex_t end, int options);\nboolean_t vm_object_populate(vm_object_t, vm_pindex_t, vm_pindex_t);\nvoid vm_object_print(long addr, boolean_t have_addr, long count, char *modif);\nvoid vm_object_reference (vm_object_t);\nvoid vm_object_reference_locked(vm_object_t);\nint  vm_object_set_memattr(vm_object_t object, vm_memattr_t memattr);\nvoid vm_object_shadow (vm_object_t *, vm_ooffset_t *, vm_size_t);\nvoid vm_object_split(vm_map_entry_t);\nvoid vm_object_sync(vm_object_t, vm_ooffset_t, vm_size_t, boolean_t,\n    boolean_t);\nvoid vm_object_madvise (vm_object_t, vm_pindex_t, int, int);\n#endif\t\t\t\t/* _KERNEL */\n\n#endif\t\t\t\t/* _VM_OBJECT_ */\n"
  },
  {
    "path": "freebsd-headers/vm/vm_page.h",
    "content": "/*-\n * Copyright (c) 1991, 1993\n *\tThe Regents of the University of California.  All rights reserved.\n *\n * This code is derived from software contributed to Berkeley by\n * The Mach Operating System project at Carnegie-Mellon University.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 4. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\tfrom: @(#)vm_page.h\t8.2 (Berkeley) 12/13/93\n *\n *\n * Copyright (c) 1987, 1990 Carnegie-Mellon University.\n * All rights reserved.\n *\n * Authors: Avadis Tevanian, Jr., Michael Wayne Young\n *\n * Permission to use, copy, modify and distribute this software and\n * its documentation is hereby granted, provided that both the copyright\n * notice and this permission notice appear in all copies of the\n * software, derivative works or modified versions, and any portions\n * thereof, and that both notices appear in supporting documentation.\n *\n * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS \"AS IS\"\n * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND\n * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.\n *\n * Carnegie Mellon requests users of this software to return to\n *\n *  Software Distribution Coordinator  or  Software.Distribution@CS.CMU.EDU\n *  School of Computer Science\n *  Carnegie Mellon University\n *  Pittsburgh PA 15213-3890\n *\n * any improvements or extensions that they make and grant Carnegie the\n * rights to redistribute these changes.\n *\n * $FreeBSD: release/9.0.0/sys/vm/vm_page.h 226319 2011-10-12 20:08:25Z kib $\n */\n\n/*\n *\tResident memory system definitions.\n */\n\n#ifndef\t_VM_PAGE_\n#define\t_VM_PAGE_\n\n#include <vm/pmap.h>\n\n/*\n *\tManagement of resident (logical) pages.\n *\n *\tA small structure is kept for each resident\n *\tpage, indexed by page number.  Each structure\n *\tis an element of several lists:\n *\n *\t\tA hash table bucket used to quickly\n *\t\tperform object/offset lookups\n *\n *\t\tA list of all pages for a given object,\n *\t\tso they can be quickly deactivated at\n *\t\ttime of deallocation.\n *\n *\t\tAn ordered list of pages due for pageout.\n *\n *\tIn addition, the structure contains the object\n *\tand offset to which this page belongs (for pageout),\n *\tand sundry status bits.\n *\n *\tIn general, operations on this structure's mutable fields are\n *\tsynchronized using either one of or a combination of the lock on the\n *\tobject that the page belongs to (O), the pool lock for the page (P),\n *\tor the lock for either the free or paging queues (Q).  If a field is\n *\tannotated below with two of these locks, then holding either lock is\n *\tsufficient for read access, but both locks are required for write\n *\taccess.\n *\n *\tIn contrast, the synchronization of accesses to the page's\n *\tdirty field is machine dependent (M).  In the\n *\tmachine-independent layer, the lock on the object that the\n *\tpage belongs to must be held in order to operate on the field.\n *\tHowever, the pmap layer is permitted to set all bits within\n *\tthe field without holding that lock.  If the underlying\n *\tarchitecture does not support atomic read-modify-write\n *\toperations on the field's type, then the machine-independent\n *\tlayer uses a 32-bit atomic on the aligned 32-bit word that\n *\tcontains the dirty field.  In the machine-independent layer,\n *\tthe implementation of read-modify-write operations on the\n *\tfield is encapsulated in vm_page_clear_dirty_mask().\n */\n\nTAILQ_HEAD(pglist, vm_page);\n\nstruct vm_page {\n\tTAILQ_ENTRY(vm_page) pageq;\t/* queue info for FIFO queue or free list (Q) */\n\tTAILQ_ENTRY(vm_page) listq;\t/* pages in same object (O) \t*/\n\tstruct vm_page *left;\t\t/* splay tree link (O)\t\t*/\n\tstruct vm_page *right;\t\t/* splay tree link (O)\t\t*/\n\n\tvm_object_t object;\t\t/* which object am I in (O,P)*/\n\tvm_pindex_t pindex;\t\t/* offset into object (O,P) */\n\tvm_paddr_t phys_addr;\t\t/* physical address of page */\n\tstruct md_page md;\t\t/* machine dependant stuff */\n\tuint8_t\tqueue;\t\t\t/* page queue index (P,Q) */\n\tint8_t segind;\n\tshort hold_count;\t\t/* page hold count (P) */\n\tuint8_t\torder;\t\t\t/* index of the buddy queue */\n\tuint8_t pool;\n\tu_short cow;\t\t\t/* page cow mapping count (P) */\n\tu_int wire_count;\t\t/* wired down maps refs (P) */\n\tuint8_t aflags;\t\t\t/* access is atomic */\n\tuint8_t flags;\t\t\t/* see below, often immutable after alloc */\n\tu_short oflags;\t\t\t/* page flags (O) */\n\tu_char\tact_count;\t\t/* page usage count (O) */\n\tu_char\tbusy;\t\t\t/* page busy count (O) */\n\t/* NOTE that these must support one bit per DEV_BSIZE in a page!!! */\n\t/* so, on normal X86 kernels, they must be at least 8 bits wide */\n\t/* In reality, support for 32KB pages is not fully implemented. */\n#if PAGE_SIZE == 4096\n\tuint8_t\tvalid;\t\t\t/* map of valid DEV_BSIZE chunks (O) */\n\tuint8_t\tdirty;\t\t\t/* map of dirty DEV_BSIZE chunks (M) */\n#elif PAGE_SIZE == 8192\n\tuint16_t valid;\t\t\t/* map of valid DEV_BSIZE chunks (O) */\n\tuint16_t dirty;\t\t\t/* map of dirty DEV_BSIZE chunks (M) */\n#elif PAGE_SIZE == 16384\n\tuint32_t valid;\t\t\t/* map of valid DEV_BSIZE chunks (O) */\n\tuint32_t dirty;\t\t\t/* map of dirty DEV_BSIZE chunks (M) */\n#elif PAGE_SIZE == 32768\n\tuint64_t valid;\t\t\t/* map of valid DEV_BSIZE chunks (O) */\n\tuint64_t dirty;\t\t\t/* map of dirty DEV_BSIZE chunks (M) */\n#endif\n};\n\n/*\n * Page flags stored in oflags:\n *\n * Access to these page flags is synchronized by the lock on the object\n * containing the page (O).\n *\n * Note: VPO_UNMANAGED (used by OBJT_DEVICE, OBJT_PHYS and OBJT_SG)\n * \t indicates that the page is not under PV management but\n * \t otherwise should be treated as a normal page.  Pages not\n * \t under PV management cannot be paged out via the\n * \t object/vm_page_t because there is no knowledge of their pte\n * \t mappings, and such pages are also not on any PQ queue.\n *\n */\n#define\tVPO_BUSY\t0x0001\t/* page is in transit */\n#define\tVPO_WANTED\t0x0002\t/* someone is waiting for page */\n#define\tVPO_UNMANAGED\t0x0004\t\t/* No PV management for page */\n#define\tVPO_SWAPINPROG\t0x0200\t/* swap I/O in progress on page */\n#define\tVPO_NOSYNC\t0x0400\t/* do not collect for syncer */\n\n#define\tPQ_NONE\t\t255\n#define\tPQ_INACTIVE\t0\n#define\tPQ_ACTIVE\t1\n#define\tPQ_HOLD\t\t2\n#define\tPQ_COUNT\t3\n\nstruct vpgqueues {\n\tstruct pglist pl;\n\tint\t*cnt;\n};\n\nextern struct vpgqueues vm_page_queues[PQ_COUNT];\n\nstruct vpglocks {\n\tstruct mtx\tdata;\n\tchar\t\tpad[CACHE_LINE_SIZE - sizeof(struct mtx)];\n} __aligned(CACHE_LINE_SIZE);\n\nextern struct vpglocks vm_page_queue_free_lock;\nextern struct vpglocks pa_lock[];\n\n#if defined(__arm__)\n#define\tPDRSHIFT\tPDR_SHIFT\n#elif !defined(PDRSHIFT)\n#define PDRSHIFT\t21\n#endif\n\n#define\tpa_index(pa)\t((pa) >> PDRSHIFT)\n#define\tPA_LOCKPTR(pa)\t&pa_lock[pa_index((pa)) % PA_LOCK_COUNT].data\n#define\tPA_LOCKOBJPTR(pa)\t((struct lock_object *)PA_LOCKPTR((pa)))\n#define\tPA_LOCK(pa)\tmtx_lock(PA_LOCKPTR(pa))\n#define\tPA_TRYLOCK(pa)\tmtx_trylock(PA_LOCKPTR(pa))\n#define\tPA_UNLOCK(pa)\tmtx_unlock(PA_LOCKPTR(pa))\n#define\tPA_UNLOCK_COND(pa) \t\t\t\\\n\tdo {\t\t   \t\t\t\\\n\t\tif ((pa) != 0) {\t\t\\\n\t\t\tPA_UNLOCK((pa));\t\\\n\t\t\t(pa) = 0;\t\t\\\n\t\t}\t\t\t\t\\\n\t} while (0)\n\n#define\tPA_LOCK_ASSERT(pa, a)\tmtx_assert(PA_LOCKPTR(pa), (a))\n\n#define\tvm_page_lockptr(m)\t(PA_LOCKPTR(VM_PAGE_TO_PHYS((m))))\n#define\tvm_page_lock(m)\t\tmtx_lock(vm_page_lockptr((m)))\n#define\tvm_page_unlock(m)\tmtx_unlock(vm_page_lockptr((m)))\n#define\tvm_page_trylock(m)\tmtx_trylock(vm_page_lockptr((m)))\n#define\tvm_page_lock_assert(m, a)\tmtx_assert(vm_page_lockptr((m)), (a))\n\n#define\tvm_page_queue_free_mtx\tvm_page_queue_free_lock.data\n/*\n * These are the flags defined for vm_page.\n *\n * aflags are updated by atomic accesses. Use the vm_page_aflag_set()\n * and vm_page_aflag_clear() functions to set and clear the flags.\n *\n * PGA_REFERENCED may be cleared only if the object containing the page is\n * locked.\n *\n * PGA_WRITEABLE is set exclusively on managed pages by pmap_enter().  When it\n * does so, the page must be VPO_BUSY.\n */\n#define\tPGA_WRITEABLE\t0x01\t\t/* page may be mapped writeable */\n#define\tPGA_REFERENCED\t0x02\t\t/* page has been referenced */\n\n/*\n * Page flags.  If changed at any other time than page allocation or\n * freeing, the modification must be protected by the vm_page lock.\n */\n#define\tPG_CACHED\t0x01\t\t/* page is cached */\n#define\tPG_FREE\t\t0x02\t\t/* page is free */\n#define\tPG_FICTITIOUS\t0x04\t\t/* physical page doesn't exist (O) */\n#define\tPG_ZERO\t\t0x08\t\t/* page is zeroed */\n#define\tPG_MARKER\t0x10\t\t/* special queue marker page */\n#define\tPG_SLAB\t\t0x20\t\t/* object pointer is actually a slab */\n#define\tPG_WINATCFLS\t0x40\t\t/* flush dirty page on inactive q */\n\n/*\n * Misc constants.\n */\n#define ACT_DECLINE\t\t1\n#define ACT_ADVANCE\t\t3\n#define ACT_INIT\t\t5\n#define ACT_MAX\t\t\t64\n\n#ifdef _KERNEL\n\n#include <vm/vm_param.h>\n\n/*\n * Each pageable resident page falls into one of five lists:\n *\n *\tfree\n *\t\tAvailable for allocation now.\n *\n *\tcache\n *\t\tAlmost available for allocation. Still associated with\n *\t\tan object, but clean and immediately freeable.\n *\n *\thold\n *\t\tWill become free after a pending I/O operation\n *\t\tcompletes.\n *\n * The following lists are LRU sorted:\n *\n *\tinactive\n *\t\tLow activity, candidates for reclamation.\n *\t\tThis is the list of pages that should be\n *\t\tpaged out next.\n *\n *\tactive\n *\t\tPages that are \"active\" i.e. they have been\n *\t\trecently referenced.\n *\n */\n\nstruct vnode;\nextern int vm_page_zero_count;\n\nextern vm_page_t vm_page_array;\t\t/* First resident page in table */\nextern int vm_page_array_size;\t\t/* number of vm_page_t's */\nextern long first_page;\t\t\t/* first physical page number */\n\n#define\tVM_PAGE_IS_FREE(m)\t(((m)->flags & PG_FREE) != 0)\n\n#define VM_PAGE_TO_PHYS(entry)\t((entry)->phys_addr)\n\nvm_page_t vm_phys_paddr_to_vm_page(vm_paddr_t pa);\n\nstatic __inline vm_page_t PHYS_TO_VM_PAGE(vm_paddr_t pa);\n\nstatic __inline vm_page_t\nPHYS_TO_VM_PAGE(vm_paddr_t pa)\n{\n#ifdef VM_PHYSSEG_SPARSE\n\treturn (vm_phys_paddr_to_vm_page(pa));\n#elif defined(VM_PHYSSEG_DENSE)\n\treturn (&vm_page_array[atop(pa) - first_page]);\n#else\n#error \"Either VM_PHYSSEG_DENSE or VM_PHYSSEG_SPARSE must be defined.\"\n#endif\n}\n\nextern struct vpglocks vm_page_queue_lock;\n\n#define\tvm_page_queue_mtx\tvm_page_queue_lock.data\n#define vm_page_lock_queues()   mtx_lock(&vm_page_queue_mtx)\n#define vm_page_unlock_queues() mtx_unlock(&vm_page_queue_mtx)\n\n#if PAGE_SIZE == 4096\n#define VM_PAGE_BITS_ALL 0xffu\n#elif PAGE_SIZE == 8192\n#define VM_PAGE_BITS_ALL 0xffffu\n#elif PAGE_SIZE == 16384\n#define VM_PAGE_BITS_ALL 0xffffffffu\n#elif PAGE_SIZE == 32768\n#define VM_PAGE_BITS_ALL 0xfffffffffffffffflu\n#endif\n\n/* page allocation classes: */\n#define VM_ALLOC_NORMAL\t\t0\n#define VM_ALLOC_INTERRUPT\t1\n#define VM_ALLOC_SYSTEM\t\t2\n#define\tVM_ALLOC_CLASS_MASK\t3\n/* page allocation flags: */\n#define\tVM_ALLOC_WIRED\t\t0x0020\t/* non pageable */\n#define\tVM_ALLOC_ZERO\t\t0x0040\t/* Try to obtain a zeroed page */\n#define\tVM_ALLOC_RETRY\t\t0x0080\t/* Mandatory with vm_page_grab() */\n#define\tVM_ALLOC_NOOBJ\t\t0x0100\t/* No associated object */\n#define\tVM_ALLOC_NOBUSY\t\t0x0200\t/* Do not busy the page */\n#define\tVM_ALLOC_IFCACHED\t0x0400\t/* Fail if the page is not cached */\n#define\tVM_ALLOC_IFNOTCACHED\t0x0800\t/* Fail if the page is cached */\n#define\tVM_ALLOC_IGN_SBUSY\t0x1000\t/* vm_page_grab() only */\n\n#define\tVM_ALLOC_COUNT_SHIFT\t16\n#define\tVM_ALLOC_COUNT(count)\t((count) << VM_ALLOC_COUNT_SHIFT)\n\nvoid vm_page_aflag_set(vm_page_t m, uint8_t bits);\nvoid vm_page_aflag_clear(vm_page_t m, uint8_t bits);\nvoid vm_page_busy(vm_page_t m);\nvoid vm_page_flash(vm_page_t m);\nvoid vm_page_io_start(vm_page_t m);\nvoid vm_page_io_finish(vm_page_t m);\nvoid vm_page_hold(vm_page_t mem);\nvoid vm_page_unhold(vm_page_t mem);\nvoid vm_page_free(vm_page_t m);\nvoid vm_page_free_zero(vm_page_t m);\nvoid vm_page_dirty(vm_page_t m);\nvoid vm_page_wakeup(vm_page_t m);\n\nvoid vm_pageq_remove(vm_page_t m);\n\nvoid vm_page_activate (vm_page_t);\nvm_page_t vm_page_alloc (vm_object_t, vm_pindex_t, int);\nvm_page_t vm_page_alloc_freelist(int, int);\nstruct vnode *vm_page_alloc_init(vm_page_t);\nvm_page_t vm_page_grab (vm_object_t, vm_pindex_t, int);\nvoid vm_page_cache(vm_page_t);\nvoid vm_page_cache_free(vm_object_t, vm_pindex_t, vm_pindex_t);\nvoid vm_page_cache_remove(vm_page_t);\nvoid vm_page_cache_transfer(vm_object_t, vm_pindex_t, vm_object_t);\nint vm_page_try_to_cache (vm_page_t);\nint vm_page_try_to_free (vm_page_t);\nvoid vm_page_dontneed(vm_page_t);\nvoid vm_page_deactivate (vm_page_t);\nvm_page_t vm_page_find_least(vm_object_t, vm_pindex_t);\nvm_page_t vm_page_getfake(vm_paddr_t paddr, vm_memattr_t memattr);\nvoid vm_page_insert (vm_page_t, vm_object_t, vm_pindex_t);\nvm_page_t vm_page_lookup (vm_object_t, vm_pindex_t);\nvm_page_t vm_page_next(vm_page_t m);\nint vm_page_pa_tryrelock(pmap_t, vm_paddr_t, vm_paddr_t *);\nvm_page_t vm_page_prev(vm_page_t m);\nvoid vm_page_putfake(vm_page_t m);\nvoid vm_page_reference(vm_page_t m);\nvoid vm_page_remove (vm_page_t);\nvoid vm_page_rename (vm_page_t, vm_object_t, vm_pindex_t);\nvoid vm_page_requeue(vm_page_t m);\nvoid vm_page_set_valid(vm_page_t m, int base, int size);\nvoid vm_page_sleep(vm_page_t m, const char *msg);\nvm_page_t vm_page_splay(vm_pindex_t, vm_page_t);\nvm_offset_t vm_page_startup(vm_offset_t vaddr);\nvoid vm_page_unhold_pages(vm_page_t *ma, int count);\nvoid vm_page_unwire (vm_page_t, int);\nvoid vm_page_updatefake(vm_page_t m, vm_paddr_t paddr, vm_memattr_t memattr);\nvoid vm_page_wire (vm_page_t);\nvoid vm_page_set_validclean (vm_page_t, int, int);\nvoid vm_page_clear_dirty (vm_page_t, int, int);\nvoid vm_page_set_invalid (vm_page_t, int, int);\nint vm_page_is_valid (vm_page_t, int, int);\nvoid vm_page_test_dirty (vm_page_t);\nint vm_page_bits (int, int);\nvoid vm_page_zero_invalid(vm_page_t m, boolean_t setvalid);\nvoid vm_page_free_toq(vm_page_t m);\nvoid vm_page_zero_idle_wakeup(void);\nvoid vm_page_cowfault (vm_page_t);\nint vm_page_cowsetup(vm_page_t);\nvoid vm_page_cowclear (vm_page_t);\n\n#ifdef INVARIANTS\nvoid vm_page_object_lock_assert(vm_page_t m);\n#define\tVM_PAGE_OBJECT_LOCK_ASSERT(m)\tvm_page_object_lock_assert(m)\n#else\n#define\tVM_PAGE_OBJECT_LOCK_ASSERT(m)\t(void)0\n#endif\n\n/*\n *\tvm_page_sleep_if_busy:\n *\n *\tSleep and release the page queues lock if VPO_BUSY is set or,\n *\tif also_m_busy is TRUE, busy is non-zero.  Returns TRUE if the\n *\tthread slept and the page queues lock was released.\n *\tOtherwise, retains the page queues lock and returns FALSE.\n *\n *\tThe object containing the given page must be locked.\n */\nstatic __inline int\nvm_page_sleep_if_busy(vm_page_t m, int also_m_busy, const char *msg)\n{\n\n\tif ((m->oflags & VPO_BUSY) || (also_m_busy && m->busy)) {\n\t\tvm_page_sleep(m, msg);\n\t\treturn (TRUE);\n\t}\n\treturn (FALSE);\n}\n\n/*\n *\tvm_page_undirty:\n *\n *\tSet page to not be dirty.  Note: does not clear pmap modify bits\n */\nstatic __inline void\nvm_page_undirty(vm_page_t m)\n{\n\n\tVM_PAGE_OBJECT_LOCK_ASSERT(m);\n\tm->dirty = 0;\n}\n\n#endif\t\t\t\t/* _KERNEL */\n#endif\t\t\t\t/* !_VM_PAGE_ */\n"
  },
  {
    "path": "freebsd-headers/vm/vm_pageout.h",
    "content": "/*-\n * Copyright (c) 1991, 1993\n *\tThe Regents of the University of California.  All rights reserved.\n *\n * This code is derived from software contributed to Berkeley by\n * The Mach Operating System project at Carnegie-Mellon University.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 4. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\tfrom: @(#)vm_pageout.h\t8.2 (Berkeley) 1/12/94\n *\n *\n * Copyright (c) 1987, 1990 Carnegie-Mellon University.\n * All rights reserved.\n *\n * Author: Avadis Tevanian, Jr.\n *\n * Permission to use, copy, modify and distribute this software and\n * its documentation is hereby granted, provided that both the copyright\n * notice and this permission notice appear in all copies of the\n * software, derivative works or modified versions, and any portions\n * thereof, and that both notices appear in supporting documentation.\n *\n * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS \"AS IS\"\n * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND\n * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.\n *\n * Carnegie Mellon requests users of this software to return to\n *\n *  Software Distribution Coordinator  or  Software.Distribution@CS.CMU.EDU\n *  School of Computer Science\n *  Carnegie Mellon University\n *  Pittsburgh PA 15213-3890\n *\n * any improvements or extensions that they make and grant Carnegie the\n * rights to redistribute these changes.\n *\n * $FreeBSD: release/9.0.0/sys/vm/vm_pageout.h 215471 2010-11-18 21:09:02Z kib $\n */\n\n#ifndef _VM_VM_PAGEOUT_H_\n#define _VM_VM_PAGEOUT_H_\n\n/*\n *\tHeader file for pageout daemon.\n */\n\n/*\n *\tExported data structures.\n */\n\nextern int vm_page_max_wired;\nextern int vm_pages_needed;\t/* should be some \"event\" structure */\nextern int vm_pageout_pages_needed;\nextern int vm_pageout_deficit;\nextern int vm_pageout_page_count;\n\n/*\n * Swap out requests\n */\n#define VM_SWAP_NORMAL 1\n#define VM_SWAP_IDLE 2\n\n#define\tVM_OOM_MEM\t1\n#define\tVM_OOM_SWAPZ\t2\n\n/*\n *\tExported routines.\n */\n\n/*\n *\tSignal pageout-daemon and wait for it.\n */\n\nextern void pagedaemon_wakeup(void);\n#define VM_WAIT vm_wait()\n#define VM_WAITPFAULT vm_waitpfault()\nextern void vm_wait(void);\nextern void vm_waitpfault(void);\n\n#ifdef _KERNEL\nboolean_t vm_pageout_fallback_object_lock(vm_page_t, vm_page_t *);\nint vm_pageout_flush(vm_page_t *, int, int, int, int *);\nvoid vm_pageout_oom(int shortage);\nboolean_t vm_pageout_page_lock(vm_page_t, vm_page_t *);\nvoid vm_contig_grow_cache(int, vm_paddr_t, vm_paddr_t);\n#endif\n#endif\t/* _VM_VM_PAGEOUT_H_ */\n"
  },
  {
    "path": "freebsd-headers/vm/vm_pager.h",
    "content": "/*-\n * Copyright (c) 1990 University of Utah.\n * Copyright (c) 1991, 1993\n *\tThe Regents of the University of California.  All rights reserved.\n *\n * This code is derived from software contributed to Berkeley by\n * the Systems Programming Group of the University of Utah Computer\n * Science Department.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 4. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t@(#)vm_pager.h\t8.4 (Berkeley) 1/12/94\n * $FreeBSD: release/9.0.0/sys/vm/vm_pager.h 217529 2011-01-18 04:54:43Z alc $\n */\n\n/*\n * Pager routine interface definition.\n */\n\n#ifndef\t_VM_PAGER_\n#define\t_VM_PAGER_\n\n#include <sys/queue.h>\n\nTAILQ_HEAD(pagerlst, vm_object);\n\ntypedef void pgo_init_t(void);\ntypedef vm_object_t pgo_alloc_t(void *, vm_ooffset_t, vm_prot_t, vm_ooffset_t,\n    struct ucred *);\ntypedef void pgo_dealloc_t(vm_object_t);\ntypedef int pgo_getpages_t(vm_object_t, vm_page_t *, int, int);\ntypedef void pgo_putpages_t(vm_object_t, vm_page_t *, int, int, int *);\ntypedef boolean_t pgo_haspage_t(vm_object_t, vm_pindex_t, int *, int *);\ntypedef void pgo_pageunswapped_t(vm_page_t);\n\nstruct pagerops {\n\tpgo_init_t\t*pgo_init;\t\t/* Initialize pager. */\n\tpgo_alloc_t\t*pgo_alloc;\t\t/* Allocate pager. */\n\tpgo_dealloc_t\t*pgo_dealloc;\t\t/* Disassociate. */\n\tpgo_getpages_t\t*pgo_getpages;\t\t/* Get (read) page. */\n\tpgo_putpages_t\t*pgo_putpages;\t\t/* Put (write) page. */\n\tpgo_haspage_t\t*pgo_haspage;\t\t/* Does pager have page? */\n\tpgo_pageunswapped_t *pgo_pageunswapped;\n};\n\nextern struct pagerops defaultpagerops;\nextern struct pagerops swappagerops;\nextern struct pagerops vnodepagerops;\nextern struct pagerops devicepagerops;\nextern struct pagerops physpagerops;\nextern struct pagerops sgpagerops;\n\n/*\n * get/put return values\n * OK\t operation was successful\n * BAD\t specified data was out of the accepted range\n * FAIL\t specified data was in range, but doesn't exist\n * PEND\t operations was initiated but not completed\n * ERROR error while accessing data that is in range and exists\n * AGAIN temporary resource shortage prevented operation from happening\n */\n#define\tVM_PAGER_OK\t0\n#define\tVM_PAGER_BAD\t1\n#define\tVM_PAGER_FAIL\t2\n#define\tVM_PAGER_PEND\t3\n#define\tVM_PAGER_ERROR\t4\n#define VM_PAGER_AGAIN\t5\n\n#define\tVM_PAGER_PUT_SYNC\t\t0x0001\n#define\tVM_PAGER_PUT_INVAL\t\t0x0002\n#define VM_PAGER_CLUSTER_OK\t\t0x0008\n\n#ifdef _KERNEL\n\nextern vm_map_t pager_map;\nextern struct pagerops *pagertab[];\nextern struct mtx pbuf_mtx;\n\nvm_object_t vm_pager_allocate(objtype_t, void *, vm_ooffset_t, vm_prot_t,\n    vm_ooffset_t, struct ucred *);\nvoid vm_pager_bufferinit(void);\nvoid vm_pager_deallocate(vm_object_t);\nstatic __inline int vm_pager_get_pages(vm_object_t, vm_page_t *, int, int);\nstatic __inline boolean_t vm_pager_has_page(vm_object_t, vm_pindex_t, int *, int *);\nvoid vm_pager_init(void);\nvm_object_t vm_pager_object_lookup(struct pagerlst *, void *);\n\n/*\n *\tvm_page_get_pages:\n *\n *\tRetrieve pages from the VM system in order to map them into an object\n *\t( or into VM space somewhere ).  If the pagein was successful, we\n *\tmust fully validate it.\n */\nstatic __inline int\nvm_pager_get_pages(\n\tvm_object_t object,\n\tvm_page_t *m,\n\tint count,\n\tint reqpage\n) {\n\tint r;\n\n\tVM_OBJECT_LOCK_ASSERT(object, MA_OWNED);\n\tr = (*pagertab[object->type]->pgo_getpages)(object, m, count, reqpage);\n\tif (r == VM_PAGER_OK && m[reqpage]->valid != VM_PAGE_BITS_ALL) {\n\t\tvm_page_zero_invalid(m[reqpage], TRUE);\n\t}\n\treturn (r);\n}\n\nstatic __inline void\nvm_pager_put_pages(\n\tvm_object_t object,\n\tvm_page_t *m,\n\tint count,\n\tint flags,\n\tint *rtvals\n) {\n\n\tVM_OBJECT_LOCK_ASSERT(object, MA_OWNED);\n\t(*pagertab[object->type]->pgo_putpages)\n\t    (object, m, count, flags, rtvals);\n}\n\n/*\n *\tvm_pager_haspage\n *\n *\tCheck to see if an object's pager has the requested page.  The\n *\tobject's pager will also set before and after to give the caller\n *\tsome idea of the number of pages before and after the requested\n *\tpage can be I/O'd efficiently.\n *\n *\tThe object must be locked.\n */\nstatic __inline boolean_t\nvm_pager_has_page(\n\tvm_object_t object,\n\tvm_pindex_t offset, \n\tint *before,\n\tint *after\n) {\n\tboolean_t ret;\n\n\tVM_OBJECT_LOCK_ASSERT(object, MA_OWNED);\n\tret = (*pagertab[object->type]->pgo_haspage)\n\t    (object, offset, before, after);\n\treturn (ret);\n} \n\n/* \n *      vm_pager_page_unswapped\n * \n *\tDestroy swap associated with the page.\n * \n *\tThe object containing the page must be locked.\n *      This function may not block.\n *\n *\tXXX: A much better name would be \"vm_pager_page_dirtied()\"\n *\tXXX: It is not obvious if this could be profitably used by any\n *\tXXX: pagers besides the swap_pager or if it should even be a\n *\tXXX: generic pager_op in the first place.\n */\nstatic __inline void\nvm_pager_page_unswapped(vm_page_t m)\n{\n\n\tVM_OBJECT_LOCK_ASSERT(m->object, MA_OWNED);\n\tif (pagertab[m->object->type]->pgo_pageunswapped)\n\t\t(*pagertab[m->object->type]->pgo_pageunswapped)(m);\n}\n\n#endif\t\t\t\t/* _KERNEL */\n#endif\t\t\t\t/* _VM_PAGER_ */\n"
  },
  {
    "path": "freebsd-headers/vm/vm_param.h",
    "content": "/*-\n * Copyright (c) 1991, 1993\n *\tThe Regents of the University of California.  All rights reserved.\n *\n * This code is derived from software contributed to Berkeley by\n * The Mach Operating System project at Carnegie-Mellon University.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 4. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\tfrom: @(#)vm_param.h\t8.1 (Berkeley) 6/11/93\n *\n *\n * Copyright (c) 1987, 1990 Carnegie-Mellon University.\n * All rights reserved.\n *\n * Authors: Avadis Tevanian, Jr., Michael Wayne Young\n *\n * Permission to use, copy, modify and distribute this software and\n * its documentation is hereby granted, provided that both the copyright\n * notice and this permission notice appear in all copies of the\n * software, derivative works or modified versions, and any portions\n * thereof, and that both notices appear in supporting documentation.\n *\n * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS \"AS IS\"\n * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND\n * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.\n *\n * Carnegie Mellon requests users of this software to return to\n *\n *  Software Distribution Coordinator  or  Software.Distribution@CS.CMU.EDU\n *  School of Computer Science\n *  Carnegie Mellon University\n *  Pittsburgh PA 15213-3890\n *\n * any improvements or extensions that they make and grant Carnegie the\n * rights to redistribute these changes.\n *\n * $FreeBSD: release/9.0.0/sys/vm/vm_param.h 207410 2010-04-30 00:46:43Z kmacy $\n */\n\n/*\n *\tMachine independent virtual memory parameters.\n */\n\n#ifndef\t_VM_PARAM_\n#define\t_VM_PARAM_\n\n#include <machine/vmparam.h>\n\n/*\n * CTL_VM identifiers\n */\n#define\tVM_TOTAL\t\t1\t/* struct vmtotal */\n#define\tVM_METER                VM_TOTAL/* deprecated, use VM_TOTAL */\n#define\tVM_LOADAVG\t \t2\t/* struct loadavg */\n#define VM_V_FREE_MIN\t\t3\t/* cnt.v_free_min */\n#define VM_V_FREE_TARGET\t4\t/* cnt.v_free_target */\n#define VM_V_FREE_RESERVED\t5\t/* cnt.v_free_reserved */\n#define VM_V_INACTIVE_TARGET\t6\t/* cnt.v_inactive_target */\n#define\tVM_V_CACHE_MIN\t\t7\t/* cnt.v_cache_min */\n#define\tVM_V_CACHE_MAX\t\t8\t/* cnt.v_cache_max */\n#define VM_V_PAGEOUT_FREE_MIN\t9\t/* cnt.v_pageout_free_min */\n#define\tVM_PAGEOUT_ALGORITHM\t10\t/* pageout algorithm */\n#define VM_SWAPPING_ENABLED\t11\t/* swapping enabled */\n#define\tVM_MAXID\t\t12\t/* number of valid vm ids */\n\n#define CTL_VM_NAMES { \\\n\t{ 0, 0 }, \\\n\t{ \"vmtotal\", CTLTYPE_STRUCT }, \\\n\t{ \"loadavg\", CTLTYPE_STRUCT }, \\\n\t{ \"v_free_min\", CTLTYPE_UINT }, \\\n\t{ \"v_free_target\", CTLTYPE_UINT }, \\\n\t{ \"v_free_reserved\", CTLTYPE_UINT }, \\\n\t{ \"v_inactive_target\", CTLTYPE_UINT }, \\\n\t{ \"v_cache_min\", CTLTYPE_UINT }, \\\n\t{ \"v_cache_max\", CTLTYPE_UINT }, \\\n\t{ \"v_pageout_free_min\", CTLTYPE_UINT}, \\\n\t{ \"pageout_algorithm\", CTLTYPE_INT}, \\\n\t{ \"swap_enabled\", CTLTYPE_INT},\\\n}\n\n/*\n * Structure for swap device statistics\n */\n#define XSWDEV_VERSION\t1\nstruct xswdev {\n\tu_int\txsw_version;\n\tdev_t\txsw_dev;\n\tint\txsw_flags;\n\tint\txsw_nblks;\n\tint     xsw_used;\n};\n\n/*\n *\tReturn values from the VM routines.\n */\n#define\tKERN_SUCCESS\t\t0\n#define\tKERN_INVALID_ADDRESS\t1\n#define\tKERN_PROTECTION_FAILURE\t2\n#define\tKERN_NO_SPACE\t\t3\n#define\tKERN_INVALID_ARGUMENT\t4\n#define\tKERN_FAILURE\t\t5\n#define\tKERN_RESOURCE_SHORTAGE\t6\n#define\tKERN_NOT_RECEIVER\t7\n#define\tKERN_NO_ACCESS\t\t8\n\n#ifndef PA_LOCK_COUNT\n#ifdef SMP\n#define\tPA_LOCK_COUNT\t32\n#else\n#define PA_LOCK_COUNT\t1\n#endif\t/* !SMP */\n#endif\t/* !PA_LOCK_COUNT */\n\n#ifndef ASSEMBLER\n#ifdef _KERNEL\n#define num_pages(x) \\\n\t((vm_offset_t)((((vm_offset_t)(x)) + PAGE_MASK) >> PAGE_SHIFT))\nextern\tunsigned long maxtsiz;\nextern\tunsigned long dfldsiz;\nextern\tunsigned long maxdsiz;\nextern\tunsigned long dflssiz;\nextern\tunsigned long maxssiz;\nextern\tunsigned long sgrowsiz;\n#endif\t\t\t\t/* _KERNEL */\n#endif\t\t\t\t/* ASSEMBLER */\n#endif\t\t\t\t/* _VM_PARAM_ */\n"
  },
  {
    "path": "freebsd-headers/vm/vm_phys.h",
    "content": "/*-\n * Copyright (c) 2002-2006 Rice University\n * Copyright (c) 2007 Alan L. Cox <alc@cs.rice.edu>\n * All rights reserved.\n *\n * This software was developed for the FreeBSD Project by Alan L. Cox,\n * Olivier Crameri, Peter Druschel, Sitaram Iyer, and Juan Navarro.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n * A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT\n * HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,\n * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,\n * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS\n * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED\n * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY\n * WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/vm/vm_phys.h 210550 2010-07-27 20:33:50Z jhb $\n */\n\n/*\n *\tPhysical memory system definitions\n */\n\n#ifndef\t_VM_PHYS_H_\n#define\t_VM_PHYS_H_\n\n#ifdef _KERNEL\n\n/* Domains must be dense (non-sparse) and zero-based. */\nstruct mem_affinity {\n\tvm_paddr_t start;\n\tvm_paddr_t end;\n\tint domain;\n};\n\nextern struct mem_affinity *mem_affinity;\n\nvoid vm_phys_add_page(vm_paddr_t pa);\nvm_page_t vm_phys_alloc_contig(unsigned long npages,\n    vm_paddr_t low, vm_paddr_t high,\n    unsigned long alignment, unsigned long boundary);\nvm_page_t vm_phys_alloc_freelist_pages(int flind, int pool, int order);\nvm_page_t vm_phys_alloc_pages(int pool, int order);\nvm_paddr_t vm_phys_bootstrap_alloc(vm_size_t size, unsigned long alignment);\nvoid vm_phys_free_pages(vm_page_t m, int order);\nvoid vm_phys_init(void);\nvoid vm_phys_set_pool(int pool, vm_page_t m, int order);\nboolean_t vm_phys_unfree_page(vm_page_t m);\nboolean_t vm_phys_zero_pages_idle(void);\n\n#endif\t/* _KERNEL */\n#endif\t/* !_VM_PHYS_H_ */\n"
  },
  {
    "path": "freebsd-headers/vm/vm_reserv.h",
    "content": "/*-\n * Copyright (c) 2002-2006 Rice University\n * Copyright (c) 2007-2008 Alan L. Cox <alc@cs.rice.edu>\n * All rights reserved.\n *\n * This software was developed for the FreeBSD Project by Alan L. Cox,\n * Olivier Crameri, Peter Druschel, Sitaram Iyer, and Juan Navarro.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n * A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT\n * HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,\n * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,\n * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS\n * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED\n * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY\n * WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/vm/vm_reserv.h 177956 2008-04-06 18:09:28Z alc $\n */\n\n/*\n *\tSuperpage reservation management definitions\n */\n\n#ifndef\t_VM_RESERV_H_\n#define\t_VM_RESERV_H_\n\n#ifdef _KERNEL\n\n#if VM_NRESERVLEVEL > 0\n\nvm_page_t\tvm_reserv_alloc_page(vm_object_t object, vm_pindex_t pindex);\nvoid\t\tvm_reserv_break_all(vm_object_t object);\nboolean_t\tvm_reserv_free_page(vm_page_t m);\nvoid\t\tvm_reserv_init(void);\nint\t\tvm_reserv_level_iffullpop(vm_page_t m);\nboolean_t\tvm_reserv_reactivate_page(vm_page_t m);\nboolean_t\tvm_reserv_reclaim_contig(vm_paddr_t size, vm_paddr_t low,\n\t\t    vm_paddr_t high, unsigned long alignment,\n\t\t    unsigned long boundary);\nboolean_t\tvm_reserv_reclaim_inactive(void);\nvoid\t\tvm_reserv_rename(vm_page_t m, vm_object_t new_object,\n\t\t    vm_object_t old_object, vm_pindex_t old_object_offset);\nvm_paddr_t\tvm_reserv_startup(vm_offset_t *vaddr, vm_paddr_t end,\n\t\t    vm_paddr_t high_water);\n\n#endif\t/* VM_NRESERVLEVEL > 0 */\n#endif\t/* _KERNEL */\n#endif\t/* !_VM_RESERV_H_ */\n"
  },
  {
    "path": "freebsd-headers/vm/vnode_pager.h",
    "content": "/*-\n * Copyright (c) 1990 University of Utah.\n * Copyright (c) 1991, 1993\n *\tThe Regents of the University of California.  All rights reserved.\n *\n * This code is derived from software contributed to Berkeley by\n * the Systems Programming Group of the University of Utah Computer\n * Science Department.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 4. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\t@(#)vnode_pager.h\t8.1 (Berkeley) 6/11/93\n * $FreeBSD: release/9.0.0/sys/vm/vnode_pager.h 222586 2011-06-01 21:00:28Z kib $\n */\n\n#ifndef\t_VNODE_PAGER_\n#define\t_VNODE_PAGER_\t1\n\n#ifdef _KERNEL\n\n/*\n * XXX Generic routines; currently called by badly written FS code; these\n * XXX should go away soon.\n */\nint vnode_pager_generic_getpages(struct vnode *vp, vm_page_t *m,\n\t\t\t\t\t  int count, int reqpage);\nint vnode_pager_generic_putpages(struct vnode *vp, vm_page_t *m,\n\t\t\t\t\t  int count, boolean_t sync,\n\t\t\t\t\t  int *rtvals);\n\nvoid vnode_pager_undirty_pages(vm_page_t *ma, int *rtvals, int written);\n\n#endif\t\t\t\t/* _KERNEL */\n#endif\t\t\t\t/* _VNODE_PAGER_ */\n"
  },
  {
    "path": "freebsd-headers/wchar.h",
    "content": "/*-\n * Copyright (c)1999 Citrus Project,\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/include/wchar.h 203963 2010-02-16 19:28:10Z imp $\n */\n\n/*-\n * Copyright (c) 1999, 2000 The NetBSD Foundation, Inc.\n * All rights reserved.\n *\n * This code is derived from software contributed to The NetBSD Foundation\n * by Julian Coleman.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS\n * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED\n * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\n * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS\n * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\n * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\n * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\n * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\n * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n *\n *\t$NetBSD: wchar.h,v 1.8 2000/12/22 05:31:42 itojun Exp $\n */\n\n#ifndef _WCHAR_H_\n#define _WCHAR_H_\n\n#include <sys/cdefs.h>\n#include <sys/_null.h>\n#include <sys/_types.h>\n#include <machine/_limits.h>\n#include <_ctype.h>\n\n#ifndef _MBSTATE_T_DECLARED\ntypedef\t__mbstate_t\tmbstate_t;\n#define\t_MBSTATE_T_DECLARED\n#endif\n\n#ifndef _SIZE_T_DECLARED\ntypedef\t__size_t\tsize_t;\n#define\t_SIZE_T_DECLARED\n#endif\n\n#ifndef\t__cplusplus\n#ifndef _WCHAR_T_DECLARED\ntypedef\t__wchar_t\twchar_t;\n#define\t_WCHAR_T_DECLARED\n#endif\n#endif\n\n#ifndef _WINT_T_DECLARED\ntypedef\t__wint_t\twint_t;\n#define\t_WINT_T_DECLARED\n#endif\n\n#ifndef\tWCHAR_MIN \n#define\tWCHAR_MIN\t__INT_MIN\n#define\tWCHAR_MAX\t__INT_MAX\n#endif\n\n#ifndef WEOF\n#define\tWEOF \t((wint_t)-1)\n#endif\n\nstruct __sFILE;\nstruct tm;\n\n__BEGIN_DECLS\nwint_t\tbtowc(int);\nwint_t\tfgetwc(struct __sFILE *);\nwchar_t\t*\n\tfgetws(wchar_t * __restrict, int, struct __sFILE * __restrict);\nwint_t\tfputwc(wchar_t, struct __sFILE *);\nint\tfputws(const wchar_t * __restrict, struct __sFILE * __restrict);\nint\tfwide(struct __sFILE *, int);\nint\tfwprintf(struct __sFILE * __restrict, const wchar_t * __restrict, ...);\nint\tfwscanf(struct __sFILE * __restrict, const wchar_t * __restrict, ...);\nwint_t\tgetwc(struct __sFILE *);\nwint_t\tgetwchar(void);\nsize_t\tmbrlen(const char * __restrict, size_t, mbstate_t * __restrict);\nsize_t\tmbrtowc(wchar_t * __restrict, const char * __restrict, size_t,\n\t    mbstate_t * __restrict);\nint\tmbsinit(const mbstate_t *);\nsize_t\tmbsrtowcs(wchar_t * __restrict, const char ** __restrict, size_t,\n\t    mbstate_t * __restrict);\nwint_t\tputwc(wchar_t, struct __sFILE *);\nwint_t\tputwchar(wchar_t);\nint\tswprintf(wchar_t * __restrict, size_t n, const wchar_t * __restrict,\n\t    ...);\nint\tswscanf(const wchar_t * __restrict, const wchar_t * __restrict, ...);\nwint_t\tungetwc(wint_t, struct __sFILE *);\nint\tvfwprintf(struct __sFILE * __restrict, const wchar_t * __restrict,\n\t    __va_list);\nint\tvswprintf(wchar_t * __restrict, size_t n, const wchar_t * __restrict,\n\t    __va_list);\nint\tvwprintf(const wchar_t * __restrict, __va_list);\nsize_t\twcrtomb(char * __restrict, wchar_t, mbstate_t * __restrict);\nwchar_t\t*wcscat(wchar_t * __restrict, const wchar_t * __restrict);\nwchar_t\t*wcschr(const wchar_t *, wchar_t) __pure;\nint\twcscmp(const wchar_t *, const wchar_t *) __pure;\nint\twcscoll(const wchar_t *, const wchar_t *);\nwchar_t\t*wcscpy(wchar_t * __restrict, const wchar_t * __restrict);\nsize_t\twcscspn(const wchar_t *, const wchar_t *) __pure;\nsize_t\twcsftime(wchar_t * __restrict, size_t, const wchar_t * __restrict,\n\t    const struct tm * __restrict);\nsize_t\twcslen(const wchar_t *) __pure;\nwchar_t\t*wcsncat(wchar_t * __restrict, const wchar_t * __restrict,\n\t    size_t);\nint\twcsncmp(const wchar_t *, const wchar_t *, size_t) __pure;\nwchar_t\t*wcsncpy(wchar_t * __restrict , const wchar_t * __restrict, size_t);\nwchar_t\t*wcspbrk(const wchar_t *, const wchar_t *) __pure;\nwchar_t\t*wcsrchr(const wchar_t *, wchar_t) __pure;\nsize_t\twcsrtombs(char * __restrict, const wchar_t ** __restrict, size_t,\n\t    mbstate_t * __restrict);\nsize_t\twcsspn(const wchar_t *, const wchar_t *) __pure;\nwchar_t\t*wcsstr(const wchar_t * __restrict, const wchar_t * __restrict)\n\t    __pure;\nsize_t\twcsxfrm(wchar_t * __restrict, const wchar_t * __restrict, size_t);\nint\twctob(wint_t);\ndouble\twcstod(const wchar_t * __restrict, wchar_t ** __restrict);\nwchar_t\t*wcstok(wchar_t * __restrict, const wchar_t * __restrict,\n\t    wchar_t ** __restrict);\nlong\t wcstol(const wchar_t * __restrict, wchar_t ** __restrict, int);\nunsigned long\n\t wcstoul(const wchar_t * __restrict, wchar_t ** __restrict, int);\nwchar_t\t*wmemchr(const wchar_t *, wchar_t, size_t) __pure;\nint\twmemcmp(const wchar_t *, const wchar_t *, size_t) __pure;\nwchar_t\t*wmemcpy(wchar_t * __restrict, const wchar_t * __restrict, size_t);\nwchar_t\t*wmemmove(wchar_t *, const wchar_t *, size_t);\nwchar_t\t*wmemset(wchar_t *, wchar_t, size_t);\nint\twprintf(const wchar_t * __restrict, ...);\nint\twscanf(const wchar_t * __restrict, ...);\n\n#ifndef _STDSTREAM_DECLARED\nextern struct __sFILE *__stdinp;\nextern struct __sFILE *__stdoutp;\nextern struct __sFILE *__stderrp;\n#define\t_STDSTREAM_DECLARED\n#endif\n\n#define\tgetwc(fp)\tfgetwc(fp)\n#define\tgetwchar()\tfgetwc(__stdinp)\n#define\tputwc(wc, fp)\tfputwc(wc, fp)\n#define\tputwchar(wc)\tfputwc(wc, __stdoutp)\n\n#if __ISO_C_VISIBLE >= 1999\nint\tvfwscanf(struct __sFILE * __restrict, const wchar_t * __restrict,\n\t    __va_list);\nint\tvswscanf(const wchar_t * __restrict, const wchar_t * __restrict,\n\t    __va_list);\nint\tvwscanf(const wchar_t * __restrict, __va_list);\nfloat\twcstof(const wchar_t * __restrict, wchar_t ** __restrict);\nlong double\n\twcstold(const wchar_t * __restrict, wchar_t ** __restrict);\n#ifdef __LONG_LONG_SUPPORTED\n/* LONGLONG */\nlong long\n\twcstoll(const wchar_t * __restrict, wchar_t ** __restrict, int);\n/* LONGLONG */\nunsigned long long\n\t wcstoull(const wchar_t * __restrict, wchar_t ** __restrict, int);\n#endif\n#endif\t/* __ISO_C_VISIBLE >= 1999 */\n\n#if __XSI_VISIBLE\nint\twcswidth(const wchar_t *, size_t);\nint\twcwidth(wchar_t);\n#define\twcwidth(_c)\t__wcwidth(_c)\n#endif\n\n#if __POSIX_VISIBLE >= 200809 || __BSD_VISIBLE\nsize_t\tmbsnrtowcs(wchar_t * __restrict, const char ** __restrict, size_t,\n\t    size_t, mbstate_t * __restrict);\nwchar_t\t*wcpcpy(wchar_t * __restrict, const wchar_t * __restrict);\nwchar_t\t*wcpncpy(wchar_t * __restrict, const wchar_t * __restrict, size_t);\nwchar_t\t*wcsdup(const wchar_t *) __malloc_like;\nint\twcscasecmp(const wchar_t *, const wchar_t *);\nint\twcsncasecmp(const wchar_t *, const wchar_t *, size_t n);\nsize_t\twcsnlen(const wchar_t *, size_t) __pure;\nsize_t\twcsnrtombs(char * __restrict, const wchar_t ** __restrict, size_t,\n\t    size_t, mbstate_t * __restrict);\n#endif\n\n#if __BSD_VISIBLE\nwchar_t\t*fgetwln(struct __sFILE * __restrict, size_t * __restrict);\nsize_t\twcslcat(wchar_t *, const wchar_t *, size_t);\nsize_t\twcslcpy(wchar_t *, const wchar_t *, size_t);\n#endif\n__END_DECLS\n\n#endif /* !_WCHAR_H_ */\n"
  },
  {
    "path": "freebsd-headers/wctype.h",
    "content": "/*-\n * Copyright (c)1999 Citrus Project,\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\tcitrus Id: wctype.h,v 1.4 2000/12/21 01:50:21 itojun Exp\n *\t$NetBSD: wctype.h,v 1.3 2000/12/22 14:16:16 itojun Exp $\n * $FreeBSD: release/9.0.0/include/wctype.h 172630 2007-10-14 10:23:54Z ache $\n */\n\n#ifndef _WCTYPE_H_\n#define\t_WCTYPE_H_\n\n#include <sys/cdefs.h>\n#include <sys/_types.h>\n\n#include <_ctype.h>\n\n#ifndef _WCTRANS_T\ntypedef\tint\twctrans_t;\n#define\t_WCTRANS_T\n#endif\n\n#ifndef _WCTYPE_T\ntypedef\tunsigned long\twctype_t;\n#define\t_WCTYPE_T\n#endif\n\n#ifndef _WINT_T_DECLARED\ntypedef\t__wint_t\twint_t;\n#define\t_WINT_T_DECLARED\n#endif\n\n#ifndef WEOF\n#define\tWEOF\t((wint_t)-1)\n#endif\n\n__BEGIN_DECLS\nint\tiswalnum(wint_t);\nint\tiswalpha(wint_t);\nint\tiswblank(wint_t);\nint\tiswcntrl(wint_t);\nint\tiswctype(wint_t, wctype_t);\nint\tiswdigit(wint_t);\nint\tiswgraph(wint_t);\nint\tiswlower(wint_t);\nint\tiswprint(wint_t);\nint\tiswpunct(wint_t);\nint\tiswspace(wint_t);\nint\tiswupper(wint_t);\nint\tiswxdigit(wint_t);\nwint_t\ttowctrans(wint_t, wctrans_t);\nwint_t\ttowlower(wint_t);\nwint_t\ttowupper(wint_t);\nwctrans_t\n\twctrans(const char *);\nwctype_t\n\twctype(const char *);\n\n#if __BSD_VISIBLE\nwint_t\tiswascii(wint_t);\nwint_t\tiswhexnumber(wint_t);\nwint_t\tiswideogram(wint_t);\nwint_t\tiswnumber(wint_t);\nwint_t\tiswphonogram(wint_t);\nwint_t\tiswrune(wint_t);\nwint_t\tiswspecial(wint_t);\nwint_t\tnextwctype(wint_t, wctype_t);\n#endif\n__END_DECLS\n\n#define\tiswalnum(wc)\t\t__istype((wc), _CTYPE_A|_CTYPE_D)\n#define\tiswalpha(wc)\t\t__istype((wc), _CTYPE_A)\n#define\tiswblank(wc)\t\t__istype((wc), _CTYPE_B)\n#define\tiswcntrl(wc)\t\t__istype((wc), _CTYPE_C)\n#define\tiswctype(wc, charclass)\t__istype((wc), (charclass))\n#define\tiswdigit(wc)\t\t__isctype((wc), _CTYPE_D)\n#define\tiswgraph(wc)\t\t__istype((wc), _CTYPE_G)\n#define\tiswlower(wc)\t\t__istype((wc), _CTYPE_L)\n#define\tiswprint(wc)\t\t__istype((wc), _CTYPE_R)\n#define\tiswpunct(wc)\t\t__istype((wc), _CTYPE_P)\n#define\tiswspace(wc)\t\t__istype((wc), _CTYPE_S)\n#define\tiswupper(wc)\t\t__istype((wc), _CTYPE_U)\n#define\tiswxdigit(wc)\t\t__isctype((wc), _CTYPE_X)\n#define\ttowlower(wc)\t\t__tolower(wc)\n#define\ttowupper(wc)\t\t__toupper(wc)\n\n#if __BSD_VISIBLE\n#define\tiswascii(wc)\t\t(((wc) & ~0x7F) == 0)\n#define\tiswhexnumber(wc)\t__istype((wc), _CTYPE_X)\n#define\tiswideogram(wc)\t\t__istype((wc), _CTYPE_I)\n#define\tiswnumber(wc)\t\t__istype((wc), _CTYPE_D)\n#define\tiswphonogram(wc)\t__istype((wc), _CTYPE_Q)\n#define\tiswrune(wc)\t\t__istype((wc), 0xFFFFFF00L)\n#define\tiswspecial(wc)\t\t__istype((wc), _CTYPE_T)\n#endif\n\n#endif\t\t/* _WCTYPE_H_ */\n"
  },
  {
    "path": "freebsd-headers/wordexp.h",
    "content": "/*-\n * Copyright (c) 2002 Tim J. Robbins.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/include/wordexp.h 131331 2004-06-30 13:55:08Z tjr $\n */\n\n#ifndef _WORDEXP_H_\n#define\t_WORDEXP_H_\n\n#include <sys/cdefs.h>\n#include <sys/_types.h>\n\n#if __XSI_VISIBLE && !defined(_SIZE_T_DECLARED)\ntypedef\t__size_t\tsize_t;\n#define\t_SIZE_T_DECLARED\n#endif\n\ntypedef struct {\n\t__size_t\twe_wordc;\t/* count of words matched */\n\tchar\t\t**we_wordv;\t/* pointer to list of words */\n\t__size_t\twe_offs;\t/* slots to reserve in we_wordv */\n\tchar\t\t*we_strings;\t/* storage for wordv strings */\n\t__size_t\twe_nbytes;\t/* size of we_strings */\n} wordexp_t;\n\n/*\n * Flags for wordexp().\n */\n#define\tWRDE_APPEND\t0x1\t\t/* append to previously generated */\n#define\tWRDE_DOOFFS\t0x2\t\t/* we_offs member is valid */\n#define\tWRDE_NOCMD\t0x4\t\t/* disallow command substitution */\n#define\tWRDE_REUSE\t0x8\t\t/* reuse wordexp_t */\n#define\tWRDE_SHOWERR\t0x10\t\t/* don't redirect stderr to /dev/null */\n#define\tWRDE_UNDEF\t0x20\t\t/* disallow undefined shell vars */\n\n/*\n * Return values from wordexp().\n */\n#define\tWRDE_BADCHAR\t1\t\t/* unquoted special character */\n#define\tWRDE_BADVAL\t2\t\t/* undefined variable */\n#define\tWRDE_CMDSUB\t3\t\t/* command substitution not allowed */\n#define\tWRDE_NOSPACE\t4\t\t/* no memory for result */\n#if __XSI_VISIBLE\n#define\tWRDE_NOSYS\t5\t\t/* obsolete, reserved */\n#endif\n#define\tWRDE_SYNTAX\t6\t\t/* shell syntax error */\n\n__BEGIN_DECLS\nint\twordexp(const char * __restrict, wordexp_t * __restrict, int);\nvoid\twordfree(wordexp_t *);\n__END_DECLS\n\n#endif /* !_WORDEXP_H_ */\n"
  },
  {
    "path": "freebsd-headers/x86/_align.h",
    "content": "/*-\n * Copyright (c) 2001 David E. O'Brien\n * Copyright (c) 1990 The Regents of the University of California.\n * All rights reserved.\n *\n * This code is derived from software contributed to Berkeley by\n * William Jolitz.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. All advertising materials mentioning features or use of this software\n *    must display the following acknowledgement:\n *\tThis product includes software developed by the University of\n *\tCalifornia, Berkeley and its contributors.\n * 4. Neither the name of the University nor the names of its contributors\n *    may be used to endorse or promote products derived from this software\n *    without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n *\tfrom: @(#)param.h\t5.8 (Berkeley) 6/28/91\n * $FreeBSD: release/9.0.0/sys/x86/include/_align.h 215856 2010-11-26 10:59:20Z tijl $\n */\n\n#ifndef _X86_INCLUDE__ALIGN_H_\n#define\t_X86_INCLUDE__ALIGN_H_\n\n/*\n * Round p (pointer or byte index) up to a correctly-aligned value\n * for all data types (int, long, ...).   The result is unsigned int\n * and must be cast to any desired pointer type.\n */\n#define\t_ALIGNBYTES\t(sizeof(register_t) - 1)\n#define\t_ALIGN(p)\t(((uintptr_t)(p) + _ALIGNBYTES) & ~_ALIGNBYTES)\n\n#endif /* !_X86_INCLUDE__ALIGN_H_ */\n"
  },
  {
    "path": "freebsd-headers/x86/_inttypes.h",
    "content": "/*-\n * Copyright (c) 2001 The NetBSD Foundation, Inc.\n * All rights reserved.\n *\n * This code is derived from software contributed to The NetBSD Foundation\n * by Klaus Klein.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS\n * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED\n * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\n * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS\n * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\n * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\n * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\n * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\n * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n *\n *\tFrom: $NetBSD: int_fmtio.h,v 1.2 2001/04/26 16:25:21 kleink Exp $\n * $FreeBSD: release/9.0.0/sys/x86/include/_inttypes.h 217157 2011-01-08 18:09:48Z tijl $\n */\n\n#ifndef _MACHINE_INTTYPES_H_\n#define\t_MACHINE_INTTYPES_H_\n\n/*\n * Macros for format specifiers.\n */\n\n#ifdef __LP64__\n#define\t__PRI64\t\t\"l\"\n#define\t__PRIptr\t\"l\"\n#else\n#define\t__PRI64\t\t\"ll\"\n#define\t__PRIptr\n#endif\n\n/* fprintf(3) macros for signed integers. */\n\n#define\tPRId8\t\t\"d\"\t\t/* int8_t */\n#define\tPRId16\t\t\"d\"\t\t/* int16_t */\n#define\tPRId32\t\t\"d\"\t\t/* int32_t */\n#define\tPRId64\t\t__PRI64\"d\"\t/* int64_t */\n#define\tPRIdLEAST8\t\"d\"\t\t/* int_least8_t */\n#define\tPRIdLEAST16\t\"d\"\t\t/* int_least16_t */\n#define\tPRIdLEAST32\t\"d\"\t\t/* int_least32_t */\n#define\tPRIdLEAST64\t__PRI64\"d\"\t/* int_least64_t */\n#define\tPRIdFAST8\t\"d\"\t\t/* int_fast8_t */\n#define\tPRIdFAST16\t\"d\"\t\t/* int_fast16_t */\n#define\tPRIdFAST32\t\"d\"\t\t/* int_fast32_t */\n#define\tPRIdFAST64\t__PRI64\"d\"\t/* int_fast64_t */\n#define\tPRIdMAX\t\t\"jd\"\t\t/* intmax_t */\n#define\tPRIdPTR\t\t__PRIptr\"d\"\t/* intptr_t */\n\n#define\tPRIi8\t\t\"i\"\t\t/* int8_t */\n#define\tPRIi16\t\t\"i\"\t\t/* int16_t */\n#define\tPRIi32\t\t\"i\"\t\t/* int32_t */\n#define\tPRIi64\t\t__PRI64\"i\"\t/* int64_t */\n#define\tPRIiLEAST8\t\"i\"\t\t/* int_least8_t  */\n#define\tPRIiLEAST16\t\"i\"\t\t/* int_least16_t */\n#define\tPRIiLEAST32\t\"i\"\t\t/* int_least32_t */\n#define\tPRIiLEAST64\t__PRI64\"i\"\t/* int_least64_t */\n#define\tPRIiFAST8\t\"i\"\t\t/* int_fast8_t */\n#define\tPRIiFAST16\t\"i\"\t\t/* int_fast16_t */\n#define\tPRIiFAST32\t\"i\"\t\t/* int_fast32_t */\n#define\tPRIiFAST64\t__PRI64\"i\"\t/* int_fast64_t */\n#define\tPRIiMAX\t\t\"ji\"\t\t/* intmax_t */\n#define\tPRIiPTR\t\t__PRIptr\"i\"\t/* intptr_t */\n\n/* fprintf(3) macros for unsigned integers. */\n\n#define\tPRIo8\t\t\"o\"\t\t/* uint8_t */\n#define\tPRIo16\t\t\"o\"\t\t/* uint16_t */\n#define\tPRIo32\t\t\"o\"\t\t/* uint32_t */\n#define\tPRIo64\t\t__PRI64\"o\"\t/* uint64_t */\n#define\tPRIoLEAST8\t\"o\"\t\t/* uint_least8_t */\n#define\tPRIoLEAST16\t\"o\"\t\t/* uint_least16_t */\n#define\tPRIoLEAST32\t\"o\"\t\t/* uint_least32_t */\n#define\tPRIoLEAST64\t__PRI64\"o\"\t/* uint_least64_t */\n#define\tPRIoFAST8\t\"o\"\t\t/* uint_fast8_t */\n#define\tPRIoFAST16\t\"o\"\t\t/* uint_fast16_t */\n#define\tPRIoFAST32\t\"o\"\t\t/* uint_fast32_t */\n#define\tPRIoFAST64\t__PRI64\"o\"\t/* uint_fast64_t */\n#define\tPRIoMAX\t\t\"jo\"\t\t/* uintmax_t */\n#define\tPRIoPTR\t\t__PRIptr\"o\"\t/* uintptr_t */\n\n#define\tPRIu8\t\t\"u\"\t\t/* uint8_t */\n#define\tPRIu16\t\t\"u\"\t\t/* uint16_t */\n#define\tPRIu32\t\t\"u\"\t\t/* uint32_t */\n#define\tPRIu64\t\t__PRI64\"u\"\t/* uint64_t */\n#define\tPRIuLEAST8\t\"u\"\t\t/* uint_least8_t */\n#define\tPRIuLEAST16\t\"u\"\t\t/* uint_least16_t */\n#define\tPRIuLEAST32\t\"u\"\t\t/* uint_least32_t */\n#define\tPRIuLEAST64\t__PRI64\"u\"\t/* uint_least64_t */\n#define\tPRIuFAST8\t\"u\"\t\t/* uint_fast8_t */\n#define\tPRIuFAST16\t\"u\"\t\t/* uint_fast16_t */\n#define\tPRIuFAST32\t\"u\"\t\t/* uint_fast32_t */\n#define\tPRIuFAST64\t__PRI64\"u\"\t/* uint_fast64_t */\n#define\tPRIuMAX\t\t\"ju\"\t\t/* uintmax_t */\n#define\tPRIuPTR\t\t__PRIptr\"u\"\t/* uintptr_t */\n\n#define\tPRIx8\t\t\"x\"\t\t/* uint8_t */\n#define\tPRIx16\t\t\"x\"\t\t/* uint16_t */\n#define\tPRIx32\t\t\"x\"\t\t/* uint32_t */\n#define\tPRIx64\t\t__PRI64\"x\"\t/* uint64_t */\n#define\tPRIxLEAST8\t\"x\"\t\t/* uint_least8_t */\n#define\tPRIxLEAST16\t\"x\"\t\t/* uint_least16_t */\n#define\tPRIxLEAST32\t\"x\"\t\t/* uint_least32_t */\n#define\tPRIxLEAST64\t__PRI64\"x\"\t/* uint_least64_t */\n#define\tPRIxFAST8\t\"x\"\t\t/* uint_fast8_t */\n#define\tPRIxFAST16\t\"x\"\t\t/* uint_fast16_t */\n#define\tPRIxFAST32\t\"x\"\t\t/* uint_fast32_t */\n#define\tPRIxFAST64\t__PRI64\"x\"\t/* uint_fast64_t */\n#define\tPRIxMAX\t\t\"jx\"\t\t/* uintmax_t */\n#define\tPRIxPTR\t\t__PRIptr\"x\"\t/* uintptr_t */\n\n#define\tPRIX8\t\t\"X\"\t\t/* uint8_t */\n#define\tPRIX16\t\t\"X\"\t\t/* uint16_t */\n#define\tPRIX32\t\t\"X\"\t\t/* uint32_t */\n#define\tPRIX64\t\t__PRI64\"X\"\t/* uint64_t */\n#define\tPRIXLEAST8\t\"X\"\t\t/* uint_least8_t */\n#define\tPRIXLEAST16\t\"X\"\t\t/* uint_least16_t */\n#define\tPRIXLEAST32\t\"X\"\t\t/* uint_least32_t */\n#define\tPRIXLEAST64\t__PRI64\"X\"\t/* uint_least64_t */\n#define\tPRIXFAST8\t\"X\"\t\t/* uint_fast8_t */\n#define\tPRIXFAST16\t\"X\"\t\t/* uint_fast16_t */\n#define\tPRIXFAST32\t\"X\"\t\t/* uint_fast32_t */\n#define\tPRIXFAST64\t__PRI64\"X\"\t/* uint_fast64_t */\n#define\tPRIXMAX\t\t\"jX\"\t\t/* uintmax_t */\n#define\tPRIXPTR\t\t__PRIptr\"X\"\t/* uintptr_t */\n\n/* fscanf(3) macros for signed integers. */\n\n#define\tSCNd8\t\t\"hhd\"\t\t/* int8_t */\n#define\tSCNd16\t\t\"hd\"\t\t/* int16_t */\n#define\tSCNd32\t\t\"d\"\t\t/* int32_t */\n#define\tSCNd64\t\t__PRI64\"d\"\t/* int64_t */\n#define\tSCNdLEAST8\t\"hhd\"\t\t/* int_least8_t */\n#define\tSCNdLEAST16\t\"hd\"\t\t/* int_least16_t */\n#define\tSCNdLEAST32\t\"d\"\t\t/* int_least32_t */\n#define\tSCNdLEAST64\t__PRI64\"d\"\t/* int_least64_t */\n#define\tSCNdFAST8\t\"d\"\t\t/* int_fast8_t */\n#define\tSCNdFAST16\t\"d\"\t\t/* int_fast16_t */\n#define\tSCNdFAST32\t\"d\"\t\t/* int_fast32_t */\n#define\tSCNdFAST64\t__PRI64\"d\"\t/* int_fast64_t */\n#define\tSCNdMAX\t\t\"jd\"\t\t/* intmax_t */\n#define\tSCNdPTR\t\t__PRIptr\"d\"\t/* intptr_t */\n\n#define\tSCNi8\t\t\"hhi\"\t\t/* int8_t */\n#define\tSCNi16\t\t\"hi\"\t\t/* int16_t */\n#define\tSCNi32\t\t\"i\"\t\t/* int32_t */\n#define\tSCNi64\t\t__PRI64\"i\"\t/* int64_t */\n#define\tSCNiLEAST8\t\"hhi\"\t\t/* int_least8_t */\n#define\tSCNiLEAST16\t\"hi\"\t\t/* int_least16_t */\n#define\tSCNiLEAST32\t\"i\"\t\t/* int_least32_t */\n#define\tSCNiLEAST64\t__PRI64\"i\"\t/* int_least64_t */\n#define\tSCNiFAST8\t\"i\"\t\t/* int_fast8_t */\n#define\tSCNiFAST16\t\"i\"\t\t/* int_fast16_t */\n#define\tSCNiFAST32\t\"i\"\t\t/* int_fast32_t */\n#define\tSCNiFAST64\t__PRI64\"i\"\t/* int_fast64_t */\n#define\tSCNiMAX\t\t\"ji\"\t\t/* intmax_t */\n#define\tSCNiPTR\t\t__PRIptr\"i\"\t/* intptr_t */\n\n/* fscanf(3) macros for unsigned integers. */\n\n#define\tSCNo8\t\t\"hho\"\t\t/* uint8_t */\n#define\tSCNo16\t\t\"ho\"\t\t/* uint16_t */\n#define\tSCNo32\t\t\"o\"\t\t/* uint32_t */\n#define\tSCNo64\t\t__PRI64\"o\"\t/* uint64_t */\n#define\tSCNoLEAST8\t\"hho\"\t\t/* uint_least8_t */\n#define\tSCNoLEAST16\t\"ho\"\t\t/* uint_least16_t */\n#define\tSCNoLEAST32\t\"o\"\t\t/* uint_least32_t */\n#define\tSCNoLEAST64\t__PRI64\"o\"\t/* uint_least64_t */\n#define\tSCNoFAST8\t\"o\"\t\t/* uint_fast8_t */\n#define\tSCNoFAST16\t\"o\"\t\t/* uint_fast16_t */\n#define\tSCNoFAST32\t\"o\"\t\t/* uint_fast32_t */\n#define\tSCNoFAST64\t__PRI64\"o\"\t/* uint_fast64_t */\n#define\tSCNoMAX\t\t\"jo\"\t\t/* uintmax_t */\n#define\tSCNoPTR\t\t__PRIptr\"o\"\t/* uintptr_t */\n\n#define\tSCNu8\t\t\"hhu\"\t\t/* uint8_t */\n#define\tSCNu16\t\t\"hu\"\t\t/* uint16_t */\n#define\tSCNu32\t\t\"u\"\t\t/* uint32_t */\n#define\tSCNu64\t\t__PRI64\"u\"\t/* uint64_t */\n#define\tSCNuLEAST8\t\"hhu\"\t\t/* uint_least8_t */\n#define\tSCNuLEAST16\t\"hu\"\t\t/* uint_least16_t */\n#define\tSCNuLEAST32\t\"u\"\t\t/* uint_least32_t */\n#define\tSCNuLEAST64\t__PRI64\"u\"\t/* uint_least64_t */\n#define\tSCNuFAST8\t\"u\"\t\t/* uint_fast8_t */\n#define\tSCNuFAST16\t\"u\"\t\t/* uint_fast16_t */\n#define\tSCNuFAST32\t\"u\"\t\t/* uint_fast32_t */\n#define\tSCNuFAST64\t__PRI64\"u\"\t/* uint_fast64_t */\n#define\tSCNuMAX\t\t\"ju\"\t\t/* uintmax_t */\n#define\tSCNuPTR\t\t__PRIptr\"u\"\t/* uintptr_t */\n\n#define\tSCNx8\t\t\"hhx\"\t\t/* uint8_t */\n#define\tSCNx16\t\t\"hx\"\t\t/* uint16_t */\n#define\tSCNx32\t\t\"x\"\t\t/* uint32_t */\n#define\tSCNx64\t\t__PRI64\"x\"\t/* uint64_t */\n#define\tSCNxLEAST8\t\"hhx\"\t\t/* uint_least8_t */\n#define\tSCNxLEAST16\t\"hx\"\t\t/* uint_least16_t */\n#define\tSCNxLEAST32\t\"x\"\t\t/* uint_least32_t */\n#define\tSCNxLEAST64\t__PRI64\"x\"\t/* uint_least64_t */\n#define\tSCNxFAST8\t\"x\"\t\t/* uint_fast8_t */\n#define\tSCNxFAST16\t\"x\"\t\t/* uint_fast16_t */\n#define\tSCNxFAST32\t\"x\"\t\t/* uint_fast32_t */\n#define\tSCNxFAST64\t__PRI64\"x\"\t/* uint_fast64_t */\n#define\tSCNxMAX\t\t\"jx\"\t\t/* uintmax_t */\n#define\tSCNxPTR\t\t__PRIptr\"x\"\t/* uintptr_t */\n\n#endif /* !_MACHINE_INTTYPES_H_ */\n"
  },
  {
    "path": "freebsd-headers/x86/apicreg.h",
    "content": "/*-\n * Copyright (c) 1996, by Peter Wemm and Steve Passe\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. The name of the developer may NOT be used to endorse or promote products\n *    derived from this software without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/x86/include/apicreg.h 214631 2010-11-01 18:18:46Z jhb $\n */\n\n#ifndef _X86_APICREG_H_\n#define _X86_APICREG_H_\n\n/*\n * Local && I/O APIC definitions.\n */\n\n/*\n * Pentium P54C+ Built-in APIC\n * (Advanced programmable Interrupt Controller)\n * \n * Base Address of Built-in APIC in memory location\n * is 0xfee00000.\n * \n * Map of APIC Registers:\n * \n * Offset (hex)    Description                     Read/Write state\n * 000             Reserved\n * 010             Reserved\n * 020 ID          Local APIC ID                   R/W\n * 030 VER         Local APIC Version              R\n * 040             Reserved\n * 050             Reserved\n * 060             Reserved\n * 070             Reserved\n * 080             Task Priority Register          R/W\n * 090             Arbitration Priority Register   R\n * 0A0             Processor Priority Register     R\n * 0B0             EOI Register                    W\n * 0C0 RRR         Remote read                     R\n * 0D0             Logical Destination             R/W\n * 0E0             Destination Format Register     0..27 R;  28..31 R/W\n * 0F0 SVR         Spurious Interrupt Vector Reg.  0..3  R;  4..9   R/W\n * 100             ISR  000-031                    R\n * 110             ISR  032-063                    R\n * 120             ISR  064-095                    R\n * 130             ISR  095-128                    R\n * 140             ISR  128-159                    R\n * 150             ISR  160-191                    R\n * 160             ISR  192-223                    R\n * 170             ISR  224-255                    R\n * 180             TMR  000-031                    R\n * 190             TMR  032-063                    R\n * 1A0             TMR  064-095                    R\n * 1B0             TMR  095-128                    R\n * 1C0             TMR  128-159                    R\n * 1D0             TMR  160-191                    R\n * 1E0             TMR  192-223                    R\n * 1F0             TMR  224-255                    R\n * 200             IRR  000-031                    R\n * 210             IRR  032-063                    R\n * 220             IRR  064-095                    R\n * 230             IRR  095-128                    R\n * 240             IRR  128-159                    R\n * 250             IRR  160-191                    R\n * 260             IRR  192-223                    R\n * 270             IRR  224-255                    R\n * 280             Error Status Register           R\n * 290             Reserved\n * 2A0             Reserved\n * 2B0             Reserved\n * 2C0             Reserved\n * 2D0             Reserved\n * 2E0             Reserved\n * 2F0             Local Vector Table (CMCI)       R/W\n * 300 ICR_LOW     Interrupt Command Reg. (0-31)   R/W\n * 310 ICR_HI      Interrupt Command Reg. (32-63)  R/W\n * 320             Local Vector Table (Timer)      R/W\n * 330             Local Vector Table (Thermal)    R/W (PIV+)\n * 340             Local Vector Table (Performance) R/W (P6+)\n * 350 LVT1        Local Vector Table (LINT0)      R/W\n * 360 LVT2        Local Vector Table (LINT1)      R/W\n * 370 LVT3        Local Vector Table (ERROR)      R/W\n * 380             Initial Count Reg. for Timer    R/W\n * 390             Current Count of Timer          R\n * 3A0             Reserved\n * 3B0             Reserved\n * 3C0             Reserved\n * 3D0             Reserved\n * 3E0             Timer Divide Configuration Reg. R/W\n * 3F0             Reserved\n */\n\n\n/******************************************************************************\n * global defines, etc.\n */\n\n\n/******************************************************************************\n * LOCAL APIC structure\n */\n\n#ifndef LOCORE\n#include <sys/types.h>\n\n#define PAD3\tint : 32; int : 32; int : 32\n#define PAD4\tint : 32; int : 32; int : 32; int : 32\n\nstruct LAPIC {\n\t/* reserved */\t\tPAD4;\n\t/* reserved */\t\tPAD4;\n\tu_int32_t id;\t\tPAD3;\n\tu_int32_t version;\tPAD3;\n\t/* reserved */\t\tPAD4;\n\t/* reserved */\t\tPAD4;\n\t/* reserved */\t\tPAD4;\n\t/* reserved */\t\tPAD4;\n\tu_int32_t tpr;\t\tPAD3;\n\tu_int32_t apr;\t\tPAD3;\n\tu_int32_t ppr;\t\tPAD3;\n\tu_int32_t eoi;\t\tPAD3;\n\t/* reserved */\t\tPAD4;\n\tu_int32_t ldr;\t\tPAD3;\n\tu_int32_t dfr;\t\tPAD3;\n\tu_int32_t svr;\t\tPAD3;\n\tu_int32_t isr0;\t\tPAD3;\n\tu_int32_t isr1;\t\tPAD3;\n\tu_int32_t isr2;\t\tPAD3;\n\tu_int32_t isr3;\t\tPAD3;\n\tu_int32_t isr4;\t\tPAD3;\n\tu_int32_t isr5;\t\tPAD3;\n\tu_int32_t isr6;\t\tPAD3;\n\tu_int32_t isr7;\t\tPAD3;\n\tu_int32_t tmr0;\t\tPAD3;\n\tu_int32_t tmr1;\t\tPAD3;\n\tu_int32_t tmr2;\t\tPAD3;\n\tu_int32_t tmr3;\t\tPAD3;\n\tu_int32_t tmr4;\t\tPAD3;\n\tu_int32_t tmr5;\t\tPAD3;\n\tu_int32_t tmr6;\t\tPAD3;\n\tu_int32_t tmr7;\t\tPAD3;\n\tu_int32_t irr0;\t\tPAD3;\n\tu_int32_t irr1;\t\tPAD3;\n\tu_int32_t irr2;\t\tPAD3;\n\tu_int32_t irr3;\t\tPAD3;\n\tu_int32_t irr4;\t\tPAD3;\n\tu_int32_t irr5;\t\tPAD3;\n\tu_int32_t irr6;\t\tPAD3;\n\tu_int32_t irr7;\t\tPAD3;\n\tu_int32_t esr;\t\tPAD3;\n\t/* reserved */\t\tPAD4;\n\t/* reserved */\t\tPAD4;\n\t/* reserved */\t\tPAD4;\n\t/* reserved */\t\tPAD4;\n\t/* reserved */\t\tPAD4;\n\t/* reserved */\t\tPAD4;\n\tu_int32_t lvt_cmci;\tPAD3;\n\tu_int32_t icr_lo;\tPAD3;\n\tu_int32_t icr_hi;\tPAD3;\n\tu_int32_t lvt_timer;\tPAD3;\n\tu_int32_t lvt_thermal;\tPAD3;\n\tu_int32_t lvt_pcint;\tPAD3;\n\tu_int32_t lvt_lint0;\tPAD3;\n\tu_int32_t lvt_lint1;\tPAD3;\n\tu_int32_t lvt_error;\tPAD3;\n\tu_int32_t icr_timer;\tPAD3;\n\tu_int32_t ccr_timer;\tPAD3;\n\t/* reserved */\t\tPAD4;\n\t/* reserved */\t\tPAD4;\n\t/* reserved */\t\tPAD4;\n\t/* reserved */\t\tPAD4;\n\tu_int32_t dcr_timer;\tPAD3;\n\t/* reserved */\t\tPAD4;\n};\n\ntypedef struct LAPIC lapic_t;\n\n/******************************************************************************\n * I/O APIC structure\n */\n\nstruct IOAPIC {\n\tu_int32_t ioregsel;\tPAD3;\n\tu_int32_t iowin;\tPAD3;\n};\n\ntypedef struct IOAPIC ioapic_t;\n\n#undef PAD4\n#undef PAD3\n\n#endif  /* !LOCORE */\n\n\n/******************************************************************************\n * various code 'logical' values\n */\n\n/******************************************************************************\n * LOCAL APIC defines\n */\n\n/* default physical locations of LOCAL (CPU) APICs */\n#define DEFAULT_APIC_BASE\t0xfee00000\n\n/* constants relating to APIC ID registers */\n#define APIC_ID_MASK\t\t0xff000000\n#define\tAPIC_ID_SHIFT\t\t24\n#define\tAPIC_ID_CLUSTER\t\t0xf0\n#define\tAPIC_ID_CLUSTER_ID\t0x0f\n#define\tAPIC_MAX_CLUSTER\t0xe\n#define\tAPIC_MAX_INTRACLUSTER_ID 3\n#define\tAPIC_ID_CLUSTER_SHIFT\t4\n\n/* fields in VER */\n#define APIC_VER_VERSION\t0x000000ff\n#define APIC_VER_MAXLVT\t\t0x00ff0000\n#define MAXLVTSHIFT\t\t16\n#define APIC_VER_EOI_SUPPRESSION 0x01000000\n\n/* fields in LDR */\n#define\tAPIC_LDR_RESERVED\t0x00ffffff\n\n/* fields in DFR */\n#define\tAPIC_DFR_RESERVED\t0x0fffffff\n#define\tAPIC_DFR_MODEL_MASK\t0xf0000000\n#define\tAPIC_DFR_MODEL_FLAT\t0xf0000000\n#define\tAPIC_DFR_MODEL_CLUSTER\t0x00000000\n\n/* fields in SVR */\n#define APIC_SVR_VECTOR\t\t0x000000ff\n#define APIC_SVR_VEC_PROG\t0x000000f0\n#define APIC_SVR_VEC_FIX\t0x0000000f\n#define APIC_SVR_ENABLE\t\t0x00000100\n# define APIC_SVR_SWDIS\t\t0x00000000\n# define APIC_SVR_SWEN\t\t0x00000100\n#define APIC_SVR_FOCUS\t\t0x00000200\n# define APIC_SVR_FEN\t\t0x00000000\n# define APIC_SVR_FDIS\t\t0x00000200\n#define APIC_SVR_EOI_SUPPRESSION 0x00001000\n\n/* fields in TPR */\n#define APIC_TPR_PRIO\t\t0x000000ff\n# define APIC_TPR_INT\t\t0x000000f0\n# define APIC_TPR_SUB\t\t0x0000000f\n\n/* fields in ESR */\n#define\tAPIC_ESR_SEND_CS_ERROR\t\t0x00000001\n#define\tAPIC_ESR_RECEIVE_CS_ERROR\t0x00000002\n#define\tAPIC_ESR_SEND_ACCEPT\t\t0x00000004\n#define\tAPIC_ESR_RECEIVE_ACCEPT\t\t0x00000008\n#define\tAPIC_ESR_SEND_ILLEGAL_VECTOR\t0x00000020\n#define\tAPIC_ESR_RECEIVE_ILLEGAL_VECTOR\t0x00000040\n#define\tAPIC_ESR_ILLEGAL_REGISTER\t0x00000080\n\n/* fields in ICR_LOW */\n#define APIC_VECTOR_MASK\t0x000000ff\n\n#define APIC_DELMODE_MASK\t0x00000700\n# define APIC_DELMODE_FIXED\t0x00000000\n# define APIC_DELMODE_LOWPRIO\t0x00000100\n# define APIC_DELMODE_SMI\t0x00000200\n# define APIC_DELMODE_RR\t0x00000300\n# define APIC_DELMODE_NMI\t0x00000400\n# define APIC_DELMODE_INIT\t0x00000500\n# define APIC_DELMODE_STARTUP\t0x00000600\n# define APIC_DELMODE_RESV\t0x00000700\n\n#define APIC_DESTMODE_MASK\t0x00000800\n# define APIC_DESTMODE_PHY\t0x00000000\n# define APIC_DESTMODE_LOG\t0x00000800\n\n#define APIC_DELSTAT_MASK\t0x00001000\n# define APIC_DELSTAT_IDLE\t0x00000000\n# define APIC_DELSTAT_PEND\t0x00001000\n\n#define APIC_RESV1_MASK\t\t0x00002000\n\n#define APIC_LEVEL_MASK\t\t0x00004000\n# define APIC_LEVEL_DEASSERT\t0x00000000\n# define APIC_LEVEL_ASSERT\t0x00004000\n\n#define APIC_TRIGMOD_MASK\t0x00008000\n# define APIC_TRIGMOD_EDGE\t0x00000000\n# define APIC_TRIGMOD_LEVEL\t0x00008000\n\n#define APIC_RRSTAT_MASK\t0x00030000\n# define APIC_RRSTAT_INVALID\t0x00000000\n# define APIC_RRSTAT_INPROG\t0x00010000\n# define APIC_RRSTAT_VALID\t0x00020000\n# define APIC_RRSTAT_RESV\t0x00030000\n\n#define APIC_DEST_MASK\t\t0x000c0000\n# define APIC_DEST_DESTFLD\t0x00000000\n# define APIC_DEST_SELF\t\t0x00040000\n# define APIC_DEST_ALLISELF\t0x00080000\n# define APIC_DEST_ALLESELF\t0x000c0000\n\n#define APIC_RESV2_MASK\t\t0xfff00000\n\n#define\tAPIC_ICRLO_RESV_MASK\t(APIC_RESV1_MASK | APIC_RESV2_MASK)\n\n/* fields in LVT1/2 */\n#define APIC_LVT_VECTOR\t\t0x000000ff\n#define APIC_LVT_DM\t\t0x00000700\n# define APIC_LVT_DM_FIXED\t0x00000000\n# define APIC_LVT_DM_SMI\t0x00000200\n# define APIC_LVT_DM_NMI\t0x00000400\n# define APIC_LVT_DM_INIT\t0x00000500\n# define APIC_LVT_DM_EXTINT\t0x00000700\n#define APIC_LVT_DS\t\t0x00001000\n#define APIC_LVT_IIPP\t\t0x00002000\n#define APIC_LVT_IIPP_INTALO\t0x00002000\n#define APIC_LVT_IIPP_INTAHI\t0x00000000\n#define APIC_LVT_RIRR\t\t0x00004000\n#define APIC_LVT_TM\t\t0x00008000\n#define APIC_LVT_M\t\t0x00010000\n\n\n/* fields in LVT Timer */\n#define APIC_LVTT_VECTOR\t0x000000ff\n#define APIC_LVTT_DS\t\t0x00001000\n#define APIC_LVTT_M\t\t0x00010000\n#define APIC_LVTT_TM\t\t0x00020000\n# define APIC_LVTT_TM_ONE_SHOT\t0x00000000\n# define APIC_LVTT_TM_PERIODIC\t0x00020000\n\n\n/* APIC timer current count */\n#define\tAPIC_TIMER_MAX_COUNT\t0xffffffff\n\n/* fields in TDCR */\n#define APIC_TDCR_2\t\t0x00\n#define APIC_TDCR_4\t\t0x01\n#define APIC_TDCR_8\t\t0x02\n#define APIC_TDCR_16\t\t0x03\n#define APIC_TDCR_32\t\t0x08\n#define APIC_TDCR_64\t\t0x09\n#define APIC_TDCR_128\t\t0x0a\n#define APIC_TDCR_1\t\t0x0b\n\n/******************************************************************************\n * I/O APIC defines\n */\n\n/* default physical locations of an IO APIC */\n#define DEFAULT_IO_APIC_BASE\t0xfec00000\n\n/* window register offset */\n#define IOAPIC_WINDOW\t\t0x10\n#define IOAPIC_EOIR\t\t0x40\n\n/* indexes into IO APIC */\n#define IOAPIC_ID\t\t0x00\n#define IOAPIC_VER\t\t0x01\n#define IOAPIC_ARB\t\t0x02\n#define IOAPIC_REDTBL\t\t0x10\n#define IOAPIC_REDTBL0\t\tIOAPIC_REDTBL\n#define IOAPIC_REDTBL1\t\t(IOAPIC_REDTBL+0x02)\n#define IOAPIC_REDTBL2\t\t(IOAPIC_REDTBL+0x04)\n#define IOAPIC_REDTBL3\t\t(IOAPIC_REDTBL+0x06)\n#define IOAPIC_REDTBL4\t\t(IOAPIC_REDTBL+0x08)\n#define IOAPIC_REDTBL5\t\t(IOAPIC_REDTBL+0x0a)\n#define IOAPIC_REDTBL6\t\t(IOAPIC_REDTBL+0x0c)\n#define IOAPIC_REDTBL7\t\t(IOAPIC_REDTBL+0x0e)\n#define IOAPIC_REDTBL8\t\t(IOAPIC_REDTBL+0x10)\n#define IOAPIC_REDTBL9\t\t(IOAPIC_REDTBL+0x12)\n#define IOAPIC_REDTBL10\t\t(IOAPIC_REDTBL+0x14)\n#define IOAPIC_REDTBL11\t\t(IOAPIC_REDTBL+0x16)\n#define IOAPIC_REDTBL12\t\t(IOAPIC_REDTBL+0x18)\n#define IOAPIC_REDTBL13\t\t(IOAPIC_REDTBL+0x1a)\n#define IOAPIC_REDTBL14\t\t(IOAPIC_REDTBL+0x1c)\n#define IOAPIC_REDTBL15\t\t(IOAPIC_REDTBL+0x1e)\n#define IOAPIC_REDTBL16\t\t(IOAPIC_REDTBL+0x20)\n#define IOAPIC_REDTBL17\t\t(IOAPIC_REDTBL+0x22)\n#define IOAPIC_REDTBL18\t\t(IOAPIC_REDTBL+0x24)\n#define IOAPIC_REDTBL19\t\t(IOAPIC_REDTBL+0x26)\n#define IOAPIC_REDTBL20\t\t(IOAPIC_REDTBL+0x28)\n#define IOAPIC_REDTBL21\t\t(IOAPIC_REDTBL+0x2a)\n#define IOAPIC_REDTBL22\t\t(IOAPIC_REDTBL+0x2c)\n#define IOAPIC_REDTBL23\t\t(IOAPIC_REDTBL+0x2e)\n\n/* fields in VER */\n#define IOART_VER_VERSION\t0x000000ff\n#define IOART_VER_MAXREDIR\t0x00ff0000\n#define MAXREDIRSHIFT\t\t16\n\n/*\n * fields in the IO APIC's redirection table entries\n */\n#define IOART_DEST\tAPIC_ID_MASK\t/* broadcast addr: all APICs */\n\n#define IOART_RESV\t0x00fe0000\t/* reserved */\n\n#define IOART_INTMASK\t0x00010000\t/* R/W: INTerrupt mask */\n# define IOART_INTMCLR\t0x00000000\t/*       clear, allow INTs */\n# define IOART_INTMSET\t0x00010000\t/*       set, inhibit INTs */\n\n#define IOART_TRGRMOD\t0x00008000\t/* R/W: trigger mode */\n# define IOART_TRGREDG\t0x00000000\t/*       edge */\n# define IOART_TRGRLVL\t0x00008000\t/*       level */\n\n#define IOART_REM_IRR\t0x00004000\t/* RO: remote IRR */\n\n#define IOART_INTPOL\t0x00002000\t/* R/W: INT input pin polarity */\n# define IOART_INTAHI\t0x00000000\t/*      active high */\n# define IOART_INTALO\t0x00002000\t/*      active low */\n\n#define IOART_DELIVS\t0x00001000\t/* RO: delivery status */\n\n#define IOART_DESTMOD\t0x00000800\t/* R/W: destination mode */\n# define IOART_DESTPHY\t0x00000000\t/*      physical */\n# define IOART_DESTLOG\t0x00000800\t/*      logical */\n\n#define IOART_DELMOD\t0x00000700\t/* R/W: delivery mode */\n# define IOART_DELFIXED\t0x00000000\t/*       fixed */\n# define IOART_DELLOPRI\t0x00000100\t/*       lowest priority */\n# define IOART_DELSMI\t0x00000200\t/*       System Management INT */\n# define IOART_DELRSV1\t0x00000300\t/*       reserved */\n# define IOART_DELNMI\t0x00000400\t/*       NMI signal */\n# define IOART_DELINIT\t0x00000500\t/*       INIT signal */\n# define IOART_DELRSV2\t0x00000600\t/*       reserved */\n# define IOART_DELEXINT\t0x00000700\t/*       External INTerrupt */\n\n#define IOART_INTVEC\t0x000000ff\t/* R/W: INTerrupt vector field */\n\n#endif /* _X86_APICREG_H_ */\n"
  },
  {
    "path": "freebsd-headers/x86/apm_bios.h",
    "content": "/*-\n * APM (Advanced Power Management) BIOS Device Driver\n *\n * Copyright (c) 1994-1995 by HOSOKAWA, Tatsumi <hosokawa@mt.cs.keio.ac.jp>\n *\n * This software may be used, modified, copied, and distributed, in\n * both source and binary form provided that the above copyright and\n * these terms are retained. Under no circumstances is the author\n * responsible for the proper functioning of this software, nor does\n * the author assume any responsibility for damages incurred with its\n * use.\n *\n * Aug, 1994\tImplemented on FreeBSD 1.1.5.1R (Toshiba AVS001WD)\n *\n * $FreeBSD: release/9.0.0/sys/x86/include/apm_bios.h 215140 2010-11-11 19:36:21Z jkim $\n */\n\n#ifndef _X86_APM_BIOS_H_\n#define\t_X86_APM_BIOS_H_\n\n#ifndef _KERNEL\n#include <sys/types.h>\n#endif\n#include <sys/ioccom.h>\n\n/* BIOS id */\n#define APM_BIOS\t\t0x53\n#define APM_INT\t\t\t0x15\n\n/* APM flags */\n#define APM_16BIT_SUPPORT\t0x01\n#define APM_32BIT_SUPPORT\t0x02\n#define APM_CPUIDLE_SLOW\t0x04\n#define APM_DISABLED\t\t0x08\n#define APM_DISENGAGED\t\t0x10\n\n/* APM initializer physical address */\n#define APM_OURADDR\t\t0x00080000\n\n/* APM functions */\n#define APM_INSTCHECK\t\t0x00\n#define APM_REALCONNECT\t\t0x01\n#define APM_PROT16CONNECT\t0x02\n#define APM_PROT32CONNECT\t0x03\n#define APM_DISCONNECT\t\t0x04\n#define APM_CPUIDLE\t\t0x05\n#define APM_CPUBUSY\t\t0x06\n#define APM_SETPWSTATE\t\t0x07\n#define APM_ENABLEDISABLEPM\t0x08\n#define APM_RESTOREDEFAULT\t0x09\n#define\tAPM_GETPWSTATUS\t\t0x0a\n#define APM_GETPMEVENT\t\t0x0b\n#define APM_GETPWSTATE\t\t0x0c\n#define APM_ENABLEDISABLEDPM\t0x0d\n#define APM_DRVVERSION\t\t0x0e\n#define APM_ENGAGEDISENGAGEPM\t0x0f\n#define APM_GETCAPABILITIES\t0x10\n#define APM_RESUMETIMER\t\t0x11\n#define APM_RESUMEONRING\t0x12\n#define APM_TIMERREQUESTS\t0x13\n#define APM_OEMFUNC\t\t0x80\n\n/* error code */\n#define APME_OK\t\t\t0x00\n#define APME_PMDISABLED\t\t0x01\n#define APME_REALESTABLISHED\t0x02\n#define APME_NOTCONNECTED\t0x03\n#define APME_PROT16ESTABLISHED\t0x05\n#define APME_PROT16NOTSUPPORTED\t0x06\n#define APME_PROT32ESTABLISHED\t0x07\n#define APME_PROT32NOTDUPPORTED\t0x08\n#define APME_UNKNOWNDEVICEID\t0x09\n#define APME_OUTOFRANGE\t\t0x0a\n#define APME_NOTENGAGED\t\t0x0b\n#define APME_CANTENTERSTATE\t0x60\n#define APME_NOPMEVENT\t\t0x80\n#define APME_NOAPMPRESENT\t0x86\n\n\n/* device code */\n#define PMDV_APMBIOS\t\t0x0000\n#define PMDV_ALLDEV\t\t0x0001\n#define PMDV_DISP0\t\t0x0100\n#define PMDV_DISP1\t\t0x0101\n#define PMDV_DISPALL\t\t0x01ff\n#define PMDV_2NDSTORAGE0\t0x0200\n#define PMDV_2NDSTORAGE1\t0x0201\n#define PMDV_2NDSTORAGE2\t0x0202\n#define PMDV_2NDSTORAGE3\t0x0203\n#define PMDV_PARALLEL0\t\t0x0300\n#define PMDV_PARALLEL1\t\t0x0301\n#define PMDV_SERIAL0\t\t0x0400\n#define PMDV_SERIAL1\t\t0x0401\n#define PMDV_SERIAL2\t\t0x0402\n#define PMDV_SERIAL3\t\t0x0403\n#define PMDV_SERIAL4\t\t0x0404\n#define PMDV_SERIAL5\t\t0x0405\n#define PMDV_SERIAL6\t\t0x0406\n#define PMDV_SERIAL7\t\t0x0407\n#define PMDV_NET0\t\t0x0500\n#define PMDV_NET1\t\t0x0501\n#define PMDV_NET2\t\t0x0502\n#define PMDV_NET3\t\t0x0503\n#define PMDV_PCMCIA0\t\t0x0600\n#define PMDV_PCMCIA1\t\t0x0601\n#define PMDV_PCMCIA2\t\t0x0602\n#define PMDV_PCMCIA3\t\t0x0603\n/* 0x0700 - 0x7fff\tReserved\t\t\t*/\n#define PMDV_BATT_BASE\t\t0x8000\n#define PMDV_BATT0\t\t0x8001\n#define PMDV_BATT1\t\t0x8002\n#define PMDV_BATT_ALL\t\t0x80ff\n/* 0x8100 - 0xdfff\tReserved\t\t\t*/\n/* 0xe000 - 0xefff\tOEM-defined power device IDs\t*/\n/* 0xf000 - 0xffff\tReserved\t\t\t*/\n\n/* Power state */\n#define PMST_APMENABLED\t\t0x0000\n#define PMST_STANDBY\t\t0x0001\n#define PMST_SUSPEND\t\t0x0002\n#define PMST_OFF\t\t0x0003\n#define PMST_LASTREQNOTIFY\t0x0004\n#define PMST_LASTREQREJECT\t0x0005\n/* 0x0006 - 0x001f\tReserved system states\t\t*/\n/* 0x0020 - 0x003f\tOEM-defined system states\t*/\n/* 0x0040 - 0x007f\tOEM-defined device states\t*/\n/* 0x0080 - 0xffff\tReserved device states\t\t*/\n\n#if !defined(ASSEMBLER) && !defined(INITIALIZER)\n\n/* C definitions */\nstruct apmhook {\n\tstruct apmhook\t*ah_next;\n\tint\t\t(*ah_fun)(void *ah_arg);\n\tvoid\t\t*ah_arg;\n\tconst char\t*ah_name;\n\tint\t\tah_order;\n};\n#define APM_HOOK_NONE\t\t(-1)\n#define APM_HOOK_SUSPEND        0\n#define APM_HOOK_RESUME         1\n#define NAPM_HOOK               2\n\n#ifdef _KERNEL\n\nvoid apm_suspend(int state);\nstruct apmhook *apm_hook_establish (int apmh, struct apmhook *);\nvoid apm_hook_disestablish (int apmh, struct apmhook *);\nvoid apm_cpu_idle(void);\nvoid apm_cpu_busy(void);\n\n#endif\n\n#endif /* !ASSEMBLER && !INITIALIZER */\n\n#define APM_MIN_ORDER\t\t0x00\n#define APM_MID_ORDER\t\t0x80\n#define APM_MAX_ORDER\t\t0xff\n\n/* power management event code */\n#define PMEV_NOEVENT\t\t0x0000\n#define PMEV_STANDBYREQ\t\t0x0001\n#define PMEV_SUSPENDREQ\t\t0x0002\n#define PMEV_NORMRESUME\t\t0x0003\n#define PMEV_CRITRESUME\t\t0x0004\n#define PMEV_BATTERYLOW\t\t0x0005\n#define PMEV_POWERSTATECHANGE\t0x0006\n#define PMEV_UPDATETIME\t\t0x0007\n#define PMEV_CRITSUSPEND\t0x0008\n#define PMEV_USERSTANDBYREQ\t0x0009\n#define PMEV_USERSUSPENDREQ\t0x000a\n#define PMEV_STANDBYRESUME\t0x000b\n#define PMEV_CAPABILITIESCHANGE 0x000c\n/* 0x000d - 0x00ff\tReserved system events\t*/\n/* 0x0100 - 0x01ff\tReserved device events\t*/\n/* 0x0200 - 0x02ff\tOEM-defined APM events\t*/\n/* 0x0300 - 0xffff\tReserved\t\t*/\n#define PMEV_DEFAULT\t\t0xffffffff\t/* used for customization */\n\n#if !defined(ASSEMBLER) && !defined(INITIALIZER)\n\n/*\n * Old apm_info structure, returned by the APMIO_GETINFO_OLD ioctl.  This\n * is for backward compatibility with old executables.\n */\ntypedef struct apm_info_old {\n\tu_int\tai_major;\t/* APM major version */\n\tu_int\tai_minor;\t/* APM minor version */\n\tu_int\tai_acline;\t/* AC line status */\n\tu_int\tai_batt_stat;\t/* Battery status */\n\tu_int\tai_batt_life;\t/* Remaining battery life */\n\tu_int\tai_status;\t/* Status of APM support (enabled/disabled) */\n} *apm_info_old_t;\n\n/*\n * Structure returned by the APMIO_GETINFO ioctl.\n *\n * In the comments below, the parenthesized numbers indicate the minimum\n * value of ai_infoversion for which each field is valid.\n */\ntypedef struct apm_info {\n\tu_int\tai_infoversion;\t/* Indicates which fields are valid */\n\tu_int\tai_major;\t/* APM major version (0) */\n\tu_int\tai_minor;\t/* APM minor version (0) */\n\tu_int\tai_acline;\t/* AC line status (0) */\n\tu_int\tai_batt_stat;\t/* Battery status (0) */\n\tu_int\tai_batt_life;\t/* Remaining battery life in percent (0) */\n\tint\tai_batt_time;\t/* Remaining battery time in seconds (0) */\n\tu_int\tai_status;\t/* True if enabled (0) */\n\tu_int\tai_batteries;\t/* Number of batteries (1) */\n\tu_int\tai_capabilities;/* APM Capabilities (1) */\n\tu_int\tai_spare[6];\t/* For future expansion */\n} *apm_info_t;\n\n/* Battery flag */\n#define APM_BATT_HIGH\t\t0x01\n#define APM_BATT_LOW\t\t0x02\n#define APM_BATT_CRITICAL\t0x04\n#define APM_BATT_CHARGING\t0x08\n#define APM_BATT_NOT_PRESENT\t0x10\n#define APM_BATT_NO_SYSTEM\t0x80\n\ntypedef struct apm_pwstatus {\n\tu_int\tap_device;\t/* Device code of battery */\n\tu_int\tap_acline;\t/* AC line status (0) */\n\tu_int\tap_batt_stat;\t/* Battery status (0) */\n\tu_int\tap_batt_flag;\t/* Battery flag (0) */\n\tu_int\tap_batt_life;\t/* Remaining battery life in percent (0) */\n\tint\tap_batt_time;\t/* Remaining battery time in seconds (0) */\n} *apm_pwstatus_t;\n\nstruct apm_bios_arg {\n        uint32_t eax;\n        uint32_t ebx;\n        uint32_t ecx;\n        uint32_t edx;\n        uint32_t esi;\n        uint32_t edi;\n};\n\nstruct apm_event_info {\n\tu_int type;\n\tu_int index;\n\tu_int spare[8];\n};\n\n#define APMIO_SUSPEND\t\t_IO('P', 1)\n#define APMIO_GETINFO_OLD\t_IOR('P', 2, struct apm_info_old)\n#define APMIO_ENABLE\t\t_IO('P', 5)\n#define APMIO_DISABLE\t\t_IO('P', 6)\n#define APMIO_HALTCPU\t\t_IO('P', 7)\n#define APMIO_NOTHALTCPU\t_IO('P', 8)\n#define APMIO_DISPLAY\t\t_IOW('P', 9, int)\n#define APMIO_BIOS\t\t_IOWR('P', 10, struct apm_bios_arg)\n#define APMIO_GETINFO\t\t_IOR('P', 11, struct apm_info)\n#define APMIO_STANDBY\t\t_IO('P', 12)\n#define APMIO_GETPWSTATUS\t_IOWR('P', 13, struct apm_pwstatus)\n/* for /dev/apmctl */\n#define APMIO_NEXTEVENT\t\t_IOR('A', 100, struct apm_event_info)\n#define APMIO_REJECTLASTREQ\t_IO('P', 101)\n\n#endif /* !ASSEMBLER && !INITIALIZER */\n\n#endif /* !_X86_APM_BIOS_H_ */\n"
  },
  {
    "path": "freebsd-headers/x86/bus.h",
    "content": "/*-\n * Copyright (c) KATO Takenori, 1999.\n *\n * All rights reserved.  Unpublished rights reserved under the copyright\n * laws of Japan.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * \n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer as\n *    the first lines of this file unmodified.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. The name of the author may not be used to endorse or promote products\n *    derived from this software without specific prior written permission.\n * \n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR\n * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES\n * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,\n * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF\n * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/x86/include/bus.h 216592 2010-12-20 16:39:43Z tijl $\n */\n\n/*\t$NetBSD: bus.h,v 1.12 1997/10/01 08:25:15 fvdl Exp $\t*/\n\n/*-\n * Copyright (c) 1996, 1997 The NetBSD Foundation, Inc.\n * All rights reserved.\n *\n * This code is derived from software contributed to The NetBSD Foundation\n * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility,\n * NASA Ames Research Center.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. All advertising materials mentioning features or use of this software\n *    must display the following acknowledgement:\n *\tThis product includes software developed by the NetBSD\n *\tFoundation, Inc. and its contributors.\n * 4. Neither the name of The NetBSD Foundation nor the names of its\n *    contributors may be used to endorse or promote products derived\n *    from this software without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS\n * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED\n * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\n * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS\n * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\n * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\n * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\n * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\n * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\n/*-\n * Copyright (c) 1996 Charles M. Hannum.  All rights reserved.\n * Copyright (c) 1996 Christopher G. Demetriou.  All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. All advertising materials mentioning features or use of this software\n *    must display the following acknowledgement:\n *      This product includes software developed by Christopher G. Demetriou\n *\tfor the NetBSD Project.\n * 4. The name of the author may not be used to endorse or promote products\n *    derived from this software without specific prior written permission\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR\n * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES\n * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,\n * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF\n * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n */\n\n#ifndef _X86_BUS_H_\n#define _X86_BUS_H_\n\n#include <machine/_bus.h>\n#include <machine/cpufunc.h>\n\n#ifndef __GNUCLIKE_ASM\n# ifndef lint\n#  error \"no assembler code for your compiler\"\n# endif\n#endif\n\n/*\n * Values for the x86 bus space tag, not to be used directly by MI code.\n */\n#define\tX86_BUS_SPACE_IO\t0\t/* space is i/o space */\n#define\tX86_BUS_SPACE_MEM\t1\t/* space is mem space */\n\n#define BUS_SPACE_MAXSIZE_24BIT\t0xFFFFFF\n#define BUS_SPACE_MAXSIZE_32BIT 0xFFFFFFFF\n#define BUS_SPACE_MAXSIZE\t0xFFFFFFFF\n#define BUS_SPACE_MAXADDR_24BIT\t0xFFFFFF\n#define BUS_SPACE_MAXADDR_32BIT 0xFFFFFFFF\n#if defined(__amd64__) || defined(PAE)\n#define BUS_SPACE_MAXADDR\t0xFFFFFFFFFFFFFFFFULL\n#else\n#define BUS_SPACE_MAXADDR\t0xFFFFFFFF\n#endif\n\n#define BUS_SPACE_UNRESTRICTED\t(~0)\n\n/*\n * Map a region of device bus space into CPU virtual address space.\n */\n\nstatic __inline int bus_space_map(bus_space_tag_t t, bus_addr_t addr,\n\t\t\t\t  bus_size_t size, int flags,\n\t\t\t\t  bus_space_handle_t *bshp);\n\nstatic __inline int\nbus_space_map(bus_space_tag_t t __unused, bus_addr_t addr,\n\t      bus_size_t size __unused, int flags __unused,\n\t      bus_space_handle_t *bshp)\n{\n\n\t*bshp = addr;\n\treturn (0);\n}\n\n/*\n * Unmap a region of device bus space.\n */\n\nstatic __inline void bus_space_unmap(bus_space_tag_t t, bus_space_handle_t bsh,\n\t\t\t\t     bus_size_t size);\n\nstatic __inline void\nbus_space_unmap(bus_space_tag_t t __unused, bus_space_handle_t bsh __unused,\n\t\tbus_size_t size __unused)\n{\n}\n\n/*\n * Get a new handle for a subregion of an already-mapped area of bus space.\n */\n\nstatic __inline int bus_space_subregion(bus_space_tag_t t,\n\t\t\t\t\tbus_space_handle_t bsh,\n\t\t\t\t\tbus_size_t offset, bus_size_t size,\n\t\t\t\t\tbus_space_handle_t *nbshp);\n\nstatic __inline int\nbus_space_subregion(bus_space_tag_t t __unused, bus_space_handle_t bsh,\n\t\t    bus_size_t offset, bus_size_t size __unused,\n\t\t    bus_space_handle_t *nbshp)\n{\n\n\t*nbshp = bsh + offset;\n\treturn (0);\n}\n\n/*\n * Allocate a region of memory that is accessible to devices in bus space.\n */\n\nint\tbus_space_alloc(bus_space_tag_t t, bus_addr_t rstart,\n\t\t\tbus_addr_t rend, bus_size_t size, bus_size_t align,\n\t\t\tbus_size_t boundary, int flags, bus_addr_t *addrp,\n\t\t\tbus_space_handle_t *bshp);\n\n/*\n * Free a region of bus space accessible memory.\n */\n\nstatic __inline void bus_space_free(bus_space_tag_t t, bus_space_handle_t bsh,\n\t\t\t\t    bus_size_t size);\n\nstatic __inline void\nbus_space_free(bus_space_tag_t t __unused, bus_space_handle_t bsh __unused,\n\t       bus_size_t size __unused)\n{\n}\n\n\n/*\n * Read a 1, 2, 4, or 8 byte quantity from bus space\n * described by tag/handle/offset.\n */\nstatic __inline u_int8_t bus_space_read_1(bus_space_tag_t tag,\n\t\t\t\t\t  bus_space_handle_t handle,\n\t\t\t\t\t  bus_size_t offset);\n\nstatic __inline u_int16_t bus_space_read_2(bus_space_tag_t tag,\n\t\t\t\t\t   bus_space_handle_t handle,\n\t\t\t\t\t   bus_size_t offset);\n\nstatic __inline u_int32_t bus_space_read_4(bus_space_tag_t tag,\n\t\t\t\t\t   bus_space_handle_t handle,\n\t\t\t\t\t   bus_size_t offset);\n\nstatic __inline u_int8_t\nbus_space_read_1(bus_space_tag_t tag, bus_space_handle_t handle,\n\t\t bus_size_t offset)\n{\n\n\tif (tag == X86_BUS_SPACE_IO)\n\t\treturn (inb(handle + offset));\n\treturn (*(volatile u_int8_t *)(handle + offset));\n}\n\nstatic __inline u_int16_t\nbus_space_read_2(bus_space_tag_t tag, bus_space_handle_t handle,\n\t\t bus_size_t offset)\n{\n\n\tif (tag == X86_BUS_SPACE_IO)\n\t\treturn (inw(handle + offset));\n\treturn (*(volatile u_int16_t *)(handle + offset));\n}\n\nstatic __inline u_int32_t\nbus_space_read_4(bus_space_tag_t tag, bus_space_handle_t handle,\n\t\t bus_size_t offset)\n{\n\n\tif (tag == X86_BUS_SPACE_IO)\n\t\treturn (inl(handle + offset));\n\treturn (*(volatile u_int32_t *)(handle + offset));\n}\n\n#if 0\t/* Cause a link error for bus_space_read_8 */\n#define\tbus_space_read_8(t, h, o)\t!!! bus_space_read_8 unimplemented !!!\n#endif\n\n/*\n * Read `count' 1, 2, 4, or 8 byte quantities from bus space\n * described by tag/handle/offset and copy into buffer provided.\n */\nstatic __inline void bus_space_read_multi_1(bus_space_tag_t tag,\n\t\t\t\t\t    bus_space_handle_t bsh,\n\t\t\t\t\t    bus_size_t offset, u_int8_t *addr,\n\t\t\t\t\t    size_t count);\n\nstatic __inline void bus_space_read_multi_2(bus_space_tag_t tag,\n\t\t\t\t\t    bus_space_handle_t bsh,\n\t\t\t\t\t    bus_size_t offset, u_int16_t *addr,\n\t\t\t\t\t    size_t count);\n\nstatic __inline void bus_space_read_multi_4(bus_space_tag_t tag,\n\t\t\t\t\t    bus_space_handle_t bsh,\n\t\t\t\t\t    bus_size_t offset, u_int32_t *addr,\n\t\t\t\t\t    size_t count);\n\nstatic __inline void\nbus_space_read_multi_1(bus_space_tag_t tag, bus_space_handle_t bsh,\n\t\t       bus_size_t offset, u_int8_t *addr, size_t count)\n{\n\n\tif (tag == X86_BUS_SPACE_IO)\n\t\tinsb(bsh + offset, addr, count);\n\telse {\n#ifdef __GNUCLIKE_ASM\n\t\t__asm __volatile(\"\t\t\t\t\\n\\\n\t\t\tcld\t\t\t\t\t\\n\\\n\t\t1:\tmovb (%2),%%al\t\t\t\t\\n\\\n\t\t\tstosb\t\t\t\t\t\\n\\\n\t\t\tloop 1b\"\t\t\t\t:\n\t\t    \"=D\" (addr), \"=c\" (count)\t\t\t:\n\t\t    \"r\" (bsh + offset), \"0\" (addr), \"1\" (count)\t:\n\t\t    \"%eax\", \"memory\");\n#endif\n\t}\n}\n\nstatic __inline void\nbus_space_read_multi_2(bus_space_tag_t tag, bus_space_handle_t bsh,\n\t\t       bus_size_t offset, u_int16_t *addr, size_t count)\n{\n\n\tif (tag == X86_BUS_SPACE_IO)\n\t\tinsw(bsh + offset, addr, count);\n\telse {\n#ifdef __GNUCLIKE_ASM\n\t\t__asm __volatile(\"\t\t\t\t\\n\\\n\t\t\tcld\t\t\t\t\t\\n\\\n\t\t1:\tmovw (%2),%%ax\t\t\t\t\\n\\\n\t\t\tstosw\t\t\t\t\t\\n\\\n\t\t\tloop 1b\"\t\t\t\t:\n\t\t    \"=D\" (addr), \"=c\" (count)\t\t\t:\n\t\t    \"r\" (bsh + offset), \"0\" (addr), \"1\" (count)\t:\n\t\t    \"%eax\", \"memory\");\n#endif\n\t}\n}\n\nstatic __inline void\nbus_space_read_multi_4(bus_space_tag_t tag, bus_space_handle_t bsh,\n\t\t       bus_size_t offset, u_int32_t *addr, size_t count)\n{\n\n\tif (tag == X86_BUS_SPACE_IO)\n\t\tinsl(bsh + offset, addr, count);\n\telse {\n#ifdef __GNUCLIKE_ASM\n\t\t__asm __volatile(\"\t\t\t\t\\n\\\n\t\t\tcld\t\t\t\t\t\\n\\\n\t\t1:\tmovl (%2),%%eax\t\t\t\t\\n\\\n\t\t\tstosl\t\t\t\t\t\\n\\\n\t\t\tloop 1b\"\t\t\t\t:\n\t\t    \"=D\" (addr), \"=c\" (count)\t\t\t:\n\t\t    \"r\" (bsh + offset), \"0\" (addr), \"1\" (count)\t:\n\t\t    \"%eax\", \"memory\");\n#endif\n\t}\n}\n\n#if 0\t/* Cause a link error for bus_space_read_multi_8 */\n#define\tbus_space_read_multi_8\t!!! bus_space_read_multi_8 unimplemented !!!\n#endif\n\n/*\n * Read `count' 1, 2, 4, or 8 byte quantities from bus space\n * described by tag/handle and starting at `offset' and copy into\n * buffer provided.\n */\nstatic __inline void bus_space_read_region_1(bus_space_tag_t tag,\n\t\t\t\t\t     bus_space_handle_t bsh,\n\t\t\t\t\t     bus_size_t offset, u_int8_t *addr,\n\t\t\t\t\t     size_t count);\n\nstatic __inline void bus_space_read_region_2(bus_space_tag_t tag,\n\t\t\t\t\t     bus_space_handle_t bsh,\n\t\t\t\t\t     bus_size_t offset, u_int16_t *addr,\n\t\t\t\t\t     size_t count);\n\nstatic __inline void bus_space_read_region_4(bus_space_tag_t tag,\n\t\t\t\t\t     bus_space_handle_t bsh,\n\t\t\t\t\t     bus_size_t offset, u_int32_t *addr,\n\t\t\t\t\t     size_t count);\n\n\nstatic __inline void\nbus_space_read_region_1(bus_space_tag_t tag, bus_space_handle_t bsh,\n\t\t\tbus_size_t offset, u_int8_t *addr, size_t count)\n{\n\n\tif (tag == X86_BUS_SPACE_IO) {\n\t\tint _port_ = bsh + offset;\n#ifdef __GNUCLIKE_ASM\n\t\t__asm __volatile(\"\t\t\t\t\\n\\\n\t\t\tcld\t\t\t\t\t\\n\\\n\t\t1:\tinb %w2,%%al\t\t\t\t\\n\\\n\t\t\tstosb\t\t\t\t\t\\n\\\n\t\t\tincl %2\t\t\t\t\t\\n\\\n\t\t\tloop 1b\"\t\t\t\t:\n\t\t    \"=D\" (addr), \"=c\" (count), \"=d\" (_port_)\t:\n\t\t    \"0\" (addr), \"1\" (count), \"2\" (_port_)\t:\n\t\t    \"%eax\", \"memory\", \"cc\");\n#endif\n\t} else {\n\t\tbus_space_handle_t _port_ = bsh + offset;\n#ifdef __GNUCLIKE_ASM\n\t\t__asm __volatile(\"\t\t\t\t\\n\\\n\t\t\tcld\t\t\t\t\t\\n\\\n\t\t\trepne\t\t\t\t\t\\n\\\n\t\t\tmovsb\"\t\t\t\t\t:\n\t\t    \"=D\" (addr), \"=c\" (count), \"=S\" (_port_)\t:\n\t\t    \"0\" (addr), \"1\" (count), \"2\" (_port_)\t:\n\t\t    \"memory\", \"cc\");\n#endif\n\t}\n}\n\nstatic __inline void\nbus_space_read_region_2(bus_space_tag_t tag, bus_space_handle_t bsh,\n\t\t\tbus_size_t offset, u_int16_t *addr, size_t count)\n{\n\n\tif (tag == X86_BUS_SPACE_IO) {\n\t\tint _port_ = bsh + offset;\n#ifdef __GNUCLIKE_ASM\n\t\t__asm __volatile(\"\t\t\t\t\\n\\\n\t\t\tcld\t\t\t\t\t\\n\\\n\t\t1:\tinw %w2,%%ax\t\t\t\t\\n\\\n\t\t\tstosw\t\t\t\t\t\\n\\\n\t\t\taddl $2,%2\t\t\t\t\\n\\\n\t\t\tloop 1b\"\t\t\t\t:\n\t\t    \"=D\" (addr), \"=c\" (count), \"=d\" (_port_)\t:\n\t\t    \"0\" (addr), \"1\" (count), \"2\" (_port_)\t:\n\t\t    \"%eax\", \"memory\", \"cc\");\n#endif\n\t} else {\n\t\tbus_space_handle_t _port_ = bsh + offset;\n#ifdef __GNUCLIKE_ASM\n\t\t__asm __volatile(\"\t\t\t\t\\n\\\n\t\t\tcld\t\t\t\t\t\\n\\\n\t\t\trepne\t\t\t\t\t\\n\\\n\t\t\tmovsw\"\t\t\t\t\t:\n\t\t    \"=D\" (addr), \"=c\" (count), \"=S\" (_port_)\t:\n\t\t    \"0\" (addr), \"1\" (count), \"2\" (_port_)\t:\n\t\t    \"memory\", \"cc\");\n#endif\n\t}\n}\n\nstatic __inline void\nbus_space_read_region_4(bus_space_tag_t tag, bus_space_handle_t bsh,\n\t\t\tbus_size_t offset, u_int32_t *addr, size_t count)\n{\n\n\tif (tag == X86_BUS_SPACE_IO) {\n\t\tint _port_ = bsh + offset;\n#ifdef __GNUCLIKE_ASM\n\t\t__asm __volatile(\"\t\t\t\t\\n\\\n\t\t\tcld\t\t\t\t\t\\n\\\n\t\t1:\tinl %w2,%%eax\t\t\t\t\\n\\\n\t\t\tstosl\t\t\t\t\t\\n\\\n\t\t\taddl $4,%2\t\t\t\t\\n\\\n\t\t\tloop 1b\"\t\t\t\t:\n\t\t    \"=D\" (addr), \"=c\" (count), \"=d\" (_port_)\t:\n\t\t    \"0\" (addr), \"1\" (count), \"2\" (_port_)\t:\n\t\t    \"%eax\", \"memory\", \"cc\");\n#endif\n\t} else {\n\t\tbus_space_handle_t _port_ = bsh + offset;\n#ifdef __GNUCLIKE_ASM\n\t\t__asm __volatile(\"\t\t\t\t\\n\\\n\t\t\tcld\t\t\t\t\t\\n\\\n\t\t\trepne\t\t\t\t\t\\n\\\n\t\t\tmovsl\"\t\t\t\t\t:\n\t\t    \"=D\" (addr), \"=c\" (count), \"=S\" (_port_)\t:\n\t\t    \"0\" (addr), \"1\" (count), \"2\" (_port_)\t:\n\t\t    \"memory\", \"cc\");\n#endif\n\t}\n}\n\n#if 0\t/* Cause a link error for bus_space_read_region_8 */\n#define\tbus_space_read_region_8\t!!! bus_space_read_region_8 unimplemented !!!\n#endif\n\n/*\n * Write the 1, 2, 4, or 8 byte value `value' to bus space\n * described by tag/handle/offset.\n */\n\nstatic __inline void bus_space_write_1(bus_space_tag_t tag,\n\t\t\t\t       bus_space_handle_t bsh,\n\t\t\t\t       bus_size_t offset, u_int8_t value);\n\nstatic __inline void bus_space_write_2(bus_space_tag_t tag,\n\t\t\t\t       bus_space_handle_t bsh,\n\t\t\t\t       bus_size_t offset, u_int16_t value);\n\nstatic __inline void bus_space_write_4(bus_space_tag_t tag,\n\t\t\t\t       bus_space_handle_t bsh,\n\t\t\t\t       bus_size_t offset, u_int32_t value);\n\nstatic __inline void\nbus_space_write_1(bus_space_tag_t tag, bus_space_handle_t bsh,\n\t\t       bus_size_t offset, u_int8_t value)\n{\n\n\tif (tag == X86_BUS_SPACE_IO)\n\t\toutb(bsh + offset, value);\n\telse\n\t\t*(volatile u_int8_t *)(bsh + offset) = value;\n}\n\nstatic __inline void\nbus_space_write_2(bus_space_tag_t tag, bus_space_handle_t bsh,\n\t\t       bus_size_t offset, u_int16_t value)\n{\n\n\tif (tag == X86_BUS_SPACE_IO)\n\t\toutw(bsh + offset, value);\n\telse\n\t\t*(volatile u_int16_t *)(bsh + offset) = value;\n}\n\nstatic __inline void\nbus_space_write_4(bus_space_tag_t tag, bus_space_handle_t bsh,\n\t\t       bus_size_t offset, u_int32_t value)\n{\n\n\tif (tag == X86_BUS_SPACE_IO)\n\t\toutl(bsh + offset, value);\n\telse\n\t\t*(volatile u_int32_t *)(bsh + offset) = value;\n}\n\n#if 0\t/* Cause a link error for bus_space_write_8 */\n#define\tbus_space_write_8\t!!! bus_space_write_8 not implemented !!!\n#endif\n\n/*\n * Write `count' 1, 2, 4, or 8 byte quantities from the buffer\n * provided to bus space described by tag/handle/offset.\n */\n\nstatic __inline void bus_space_write_multi_1(bus_space_tag_t tag,\n\t\t\t\t\t     bus_space_handle_t bsh,\n\t\t\t\t\t     bus_size_t offset,\n\t\t\t\t\t     const u_int8_t *addr,\n\t\t\t\t\t     size_t count);\nstatic __inline void bus_space_write_multi_2(bus_space_tag_t tag,\n\t\t\t\t\t     bus_space_handle_t bsh,\n\t\t\t\t\t     bus_size_t offset,\n\t\t\t\t\t     const u_int16_t *addr,\n\t\t\t\t\t     size_t count);\n\nstatic __inline void bus_space_write_multi_4(bus_space_tag_t tag,\n\t\t\t\t\t     bus_space_handle_t bsh,\n\t\t\t\t\t     bus_size_t offset,\n\t\t\t\t\t     const u_int32_t *addr,\n\t\t\t\t\t     size_t count);\n\nstatic __inline void\nbus_space_write_multi_1(bus_space_tag_t tag, bus_space_handle_t bsh,\n\t\t\tbus_size_t offset, const u_int8_t *addr, size_t count)\n{\n\n\tif (tag == X86_BUS_SPACE_IO)\n\t\toutsb(bsh + offset, addr, count);\n\telse {\n#ifdef __GNUCLIKE_ASM\n\t\t__asm __volatile(\"\t\t\t\t\\n\\\n\t\t\tcld\t\t\t\t\t\\n\\\n\t\t1:\tlodsb\t\t\t\t\t\\n\\\n\t\t\tmovb %%al,(%2)\t\t\t\t\\n\\\n\t\t\tloop 1b\"\t\t\t\t:\n\t\t    \"=S\" (addr), \"=c\" (count)\t\t\t:\n\t\t    \"r\" (bsh + offset), \"0\" (addr), \"1\" (count)\t:\n\t\t    \"%eax\", \"memory\", \"cc\");\n#endif\n\t}\n}\n\nstatic __inline void\nbus_space_write_multi_2(bus_space_tag_t tag, bus_space_handle_t bsh,\n\t\t\tbus_size_t offset, const u_int16_t *addr, size_t count)\n{\n\n\tif (tag == X86_BUS_SPACE_IO)\n\t\toutsw(bsh + offset, addr, count);\n\telse {\n#ifdef __GNUCLIKE_ASM\n\t\t__asm __volatile(\"\t\t\t\t\\n\\\n\t\t\tcld\t\t\t\t\t\\n\\\n\t\t1:\tlodsw\t\t\t\t\t\\n\\\n\t\t\tmovw %%ax,(%2)\t\t\t\t\\n\\\n\t\t\tloop 1b\"\t\t\t\t:\n\t\t    \"=S\" (addr), \"=c\" (count)\t\t\t:\n\t\t    \"r\" (bsh + offset), \"0\" (addr), \"1\" (count)\t:\n\t\t    \"%eax\", \"memory\", \"cc\");\n#endif\n\t}\n}\n\nstatic __inline void\nbus_space_write_multi_4(bus_space_tag_t tag, bus_space_handle_t bsh,\n\t\t\tbus_size_t offset, const u_int32_t *addr, size_t count)\n{\n\n\tif (tag == X86_BUS_SPACE_IO)\n\t\toutsl(bsh + offset, addr, count);\n\telse {\n#ifdef __GNUCLIKE_ASM\n\t\t__asm __volatile(\"\t\t\t\t\\n\\\n\t\t\tcld\t\t\t\t\t\\n\\\n\t\t1:\tlodsl\t\t\t\t\t\\n\\\n\t\t\tmovl %%eax,(%2)\t\t\t\t\\n\\\n\t\t\tloop 1b\"\t\t\t\t:\n\t\t    \"=S\" (addr), \"=c\" (count)\t\t\t:\n\t\t    \"r\" (bsh + offset), \"0\" (addr), \"1\" (count)\t:\n\t\t    \"%eax\", \"memory\", \"cc\");\n#endif\n\t}\n}\n\n#if 0\t/* Cause a link error for bus_space_write_multi_8 */\n#define\tbus_space_write_multi_8(t, h, o, a, c)\t\t\t\t\\\n\t\t\t!!! bus_space_write_multi_8 unimplemented !!!\n#endif\n\n/*\n * Write `count' 1, 2, 4, or 8 byte quantities from the buffer provided\n * to bus space described by tag/handle starting at `offset'.\n */\n\nstatic __inline void bus_space_write_region_1(bus_space_tag_t tag,\n\t\t\t\t\t      bus_space_handle_t bsh,\n\t\t\t\t\t      bus_size_t offset,\n\t\t\t\t\t      const u_int8_t *addr,\n\t\t\t\t\t      size_t count);\nstatic __inline void bus_space_write_region_2(bus_space_tag_t tag,\n\t\t\t\t\t      bus_space_handle_t bsh,\n\t\t\t\t\t      bus_size_t offset,\n\t\t\t\t\t      const u_int16_t *addr,\n\t\t\t\t\t      size_t count);\nstatic __inline void bus_space_write_region_4(bus_space_tag_t tag,\n\t\t\t\t\t      bus_space_handle_t bsh,\n\t\t\t\t\t      bus_size_t offset,\n\t\t\t\t\t      const u_int32_t *addr,\n\t\t\t\t\t      size_t count);\n\nstatic __inline void\nbus_space_write_region_1(bus_space_tag_t tag, bus_space_handle_t bsh,\n\t\t\t bus_size_t offset, const u_int8_t *addr, size_t count)\n{\n\n\tif (tag == X86_BUS_SPACE_IO) {\n\t\tint _port_ = bsh + offset;\n#ifdef __GNUCLIKE_ASM\n\t\t__asm __volatile(\"\t\t\t\t\\n\\\n\t\t\tcld\t\t\t\t\t\\n\\\n\t\t1:\tlodsb\t\t\t\t\t\\n\\\n\t\t\toutb %%al,%w0\t\t\t\t\\n\\\n\t\t\tincl %0\t\t\t\t\t\\n\\\n\t\t\tloop 1b\"\t\t\t\t:\n\t\t    \"=d\" (_port_), \"=S\" (addr), \"=c\" (count)\t:\n\t\t    \"0\" (_port_), \"1\" (addr), \"2\" (count)\t:\n\t\t    \"%eax\", \"memory\", \"cc\");\n#endif\n\t} else {\n\t\tbus_space_handle_t _port_ = bsh + offset;\n#ifdef __GNUCLIKE_ASM\n\t\t__asm __volatile(\"\t\t\t\t\\n\\\n\t\t\tcld\t\t\t\t\t\\n\\\n\t\t\trepne\t\t\t\t\t\\n\\\n\t\t\tmovsb\"\t\t\t\t\t:\n\t\t    \"=D\" (_port_), \"=S\" (addr), \"=c\" (count)\t:\n\t\t    \"0\" (_port_), \"1\" (addr), \"2\" (count)\t:\n\t\t    \"memory\", \"cc\");\n#endif\n\t}\n}\n\nstatic __inline void\nbus_space_write_region_2(bus_space_tag_t tag, bus_space_handle_t bsh,\n\t\t\t bus_size_t offset, const u_int16_t *addr, size_t count)\n{\n\n\tif (tag == X86_BUS_SPACE_IO) {\n\t\tint _port_ = bsh + offset;\n#ifdef __GNUCLIKE_ASM\n\t\t__asm __volatile(\"\t\t\t\t\\n\\\n\t\t\tcld\t\t\t\t\t\\n\\\n\t\t1:\tlodsw\t\t\t\t\t\\n\\\n\t\t\toutw %%ax,%w0\t\t\t\t\\n\\\n\t\t\taddl $2,%0\t\t\t\t\\n\\\n\t\t\tloop 1b\"\t\t\t\t:\n\t\t    \"=d\" (_port_), \"=S\" (addr), \"=c\" (count)\t:\n\t\t    \"0\" (_port_), \"1\" (addr), \"2\" (count)\t:\n\t\t    \"%eax\", \"memory\", \"cc\");\n#endif\n\t} else {\n\t\tbus_space_handle_t _port_ = bsh + offset;\n#ifdef __GNUCLIKE_ASM\n\t\t__asm __volatile(\"\t\t\t\t\\n\\\n\t\t\tcld\t\t\t\t\t\\n\\\n\t\t\trepne\t\t\t\t\t\\n\\\n\t\t\tmovsw\"\t\t\t\t\t:\n\t\t    \"=D\" (_port_), \"=S\" (addr), \"=c\" (count)\t:\n\t\t    \"0\" (_port_), \"1\" (addr), \"2\" (count)\t:\n\t\t    \"memory\", \"cc\");\n#endif\n\t}\n}\n\nstatic __inline void\nbus_space_write_region_4(bus_space_tag_t tag, bus_space_handle_t bsh,\n\t\t\t bus_size_t offset, const u_int32_t *addr, size_t count)\n{\n\n\tif (tag == X86_BUS_SPACE_IO) {\n\t\tint _port_ = bsh + offset;\n#ifdef __GNUCLIKE_ASM\n\t\t__asm __volatile(\"\t\t\t\t\\n\\\n\t\t\tcld\t\t\t\t\t\\n\\\n\t\t1:\tlodsl\t\t\t\t\t\\n\\\n\t\t\toutl %%eax,%w0\t\t\t\t\\n\\\n\t\t\taddl $4,%0\t\t\t\t\\n\\\n\t\t\tloop 1b\"\t\t\t\t:\n\t\t    \"=d\" (_port_), \"=S\" (addr), \"=c\" (count)\t:\n\t\t    \"0\" (_port_), \"1\" (addr), \"2\" (count)\t:\n\t\t    \"%eax\", \"memory\", \"cc\");\n#endif\n\t} else {\n\t\tbus_space_handle_t _port_ = bsh + offset;\n#ifdef __GNUCLIKE_ASM\n\t\t__asm __volatile(\"\t\t\t\t\\n\\\n\t\t\tcld\t\t\t\t\t\\n\\\n\t\t\trepne\t\t\t\t\t\\n\\\n\t\t\tmovsl\"\t\t\t\t\t:\n\t\t    \"=D\" (_port_), \"=S\" (addr), \"=c\" (count)\t:\n\t\t    \"0\" (_port_), \"1\" (addr), \"2\" (count)\t:\n\t\t    \"memory\", \"cc\");\n#endif\n\t}\n}\n\n#if 0\t/* Cause a link error for bus_space_write_region_8 */\n#define\tbus_space_write_region_8\t\t\t\t\t\\\n\t\t\t!!! bus_space_write_region_8 unimplemented !!!\n#endif\n\n/*\n * Write the 1, 2, 4, or 8 byte value `val' to bus space described\n * by tag/handle/offset `count' times.\n */\n\nstatic __inline void bus_space_set_multi_1(bus_space_tag_t tag,\n\t\t\t\t\t   bus_space_handle_t bsh,\n\t\t\t\t\t   bus_size_t offset,\n\t\t\t\t\t   u_int8_t value, size_t count);\nstatic __inline void bus_space_set_multi_2(bus_space_tag_t tag,\n\t\t\t\t\t   bus_space_handle_t bsh,\n\t\t\t\t\t   bus_size_t offset,\n\t\t\t\t\t   u_int16_t value, size_t count);\nstatic __inline void bus_space_set_multi_4(bus_space_tag_t tag,\n\t\t\t\t\t   bus_space_handle_t bsh,\n\t\t\t\t\t   bus_size_t offset,\n\t\t\t\t\t   u_int32_t value, size_t count);\n\nstatic __inline void\nbus_space_set_multi_1(bus_space_tag_t tag, bus_space_handle_t bsh,\n\t\t      bus_size_t offset, u_int8_t value, size_t count)\n{\n\tbus_space_handle_t addr = bsh + offset;\n\n\tif (tag == X86_BUS_SPACE_IO)\n\t\twhile (count--)\n\t\t\toutb(addr, value);\n\telse\n\t\twhile (count--)\n\t\t\t*(volatile u_int8_t *)(addr) = value;\n}\n\nstatic __inline void\nbus_space_set_multi_2(bus_space_tag_t tag, bus_space_handle_t bsh,\n\t\t     bus_size_t offset, u_int16_t value, size_t count)\n{\n\tbus_space_handle_t addr = bsh + offset;\n\n\tif (tag == X86_BUS_SPACE_IO)\n\t\twhile (count--)\n\t\t\toutw(addr, value);\n\telse\n\t\twhile (count--)\n\t\t\t*(volatile u_int16_t *)(addr) = value;\n}\n\nstatic __inline void\nbus_space_set_multi_4(bus_space_tag_t tag, bus_space_handle_t bsh,\n\t\t      bus_size_t offset, u_int32_t value, size_t count)\n{\n\tbus_space_handle_t addr = bsh + offset;\n\n\tif (tag == X86_BUS_SPACE_IO)\n\t\twhile (count--)\n\t\t\toutl(addr, value);\n\telse\n\t\twhile (count--)\n\t\t\t*(volatile u_int32_t *)(addr) = value;\n}\n\n#if 0\t/* Cause a link error for bus_space_set_multi_8 */\n#define\tbus_space_set_multi_8 !!! bus_space_set_multi_8 unimplemented !!!\n#endif\n\n/*\n * Write `count' 1, 2, 4, or 8 byte value `val' to bus space described\n * by tag/handle starting at `offset'.\n */\n\nstatic __inline void bus_space_set_region_1(bus_space_tag_t tag,\n\t\t\t\t\t    bus_space_handle_t bsh,\n\t\t\t\t\t    bus_size_t offset, u_int8_t value,\n\t\t\t\t\t    size_t count);\nstatic __inline void bus_space_set_region_2(bus_space_tag_t tag,\n\t\t\t\t\t    bus_space_handle_t bsh,\n\t\t\t\t\t    bus_size_t offset, u_int16_t value,\n\t\t\t\t\t    size_t count);\nstatic __inline void bus_space_set_region_4(bus_space_tag_t tag,\n\t\t\t\t\t    bus_space_handle_t bsh,\n\t\t\t\t\t    bus_size_t offset, u_int32_t value,\n\t\t\t\t\t    size_t count);\n\nstatic __inline void\nbus_space_set_region_1(bus_space_tag_t tag, bus_space_handle_t bsh,\n\t\t       bus_size_t offset, u_int8_t value, size_t count)\n{\n\tbus_space_handle_t addr = bsh + offset;\n\n\tif (tag == X86_BUS_SPACE_IO)\n\t\tfor (; count != 0; count--, addr++)\n\t\t\toutb(addr, value);\n\telse\n\t\tfor (; count != 0; count--, addr++)\n\t\t\t*(volatile u_int8_t *)(addr) = value;\n}\n\nstatic __inline void\nbus_space_set_region_2(bus_space_tag_t tag, bus_space_handle_t bsh,\n\t\t       bus_size_t offset, u_int16_t value, size_t count)\n{\n\tbus_space_handle_t addr = bsh + offset;\n\n\tif (tag == X86_BUS_SPACE_IO)\n\t\tfor (; count != 0; count--, addr += 2)\n\t\t\toutw(addr, value);\n\telse\n\t\tfor (; count != 0; count--, addr += 2)\n\t\t\t*(volatile u_int16_t *)(addr) = value;\n}\n\nstatic __inline void\nbus_space_set_region_4(bus_space_tag_t tag, bus_space_handle_t bsh,\n\t\t       bus_size_t offset, u_int32_t value, size_t count)\n{\n\tbus_space_handle_t addr = bsh + offset;\n\n\tif (tag == X86_BUS_SPACE_IO)\n\t\tfor (; count != 0; count--, addr += 4)\n\t\t\toutl(addr, value);\n\telse\n\t\tfor (; count != 0; count--, addr += 4)\n\t\t\t*(volatile u_int32_t *)(addr) = value;\n}\n\n#if 0\t/* Cause a link error for bus_space_set_region_8 */\n#define\tbus_space_set_region_8\t!!! bus_space_set_region_8 unimplemented !!!\n#endif\n\n/*\n * Copy `count' 1, 2, 4, or 8 byte values from bus space starting\n * at tag/bsh1/off1 to bus space starting at tag/bsh2/off2.\n */\n\nstatic __inline void bus_space_copy_region_1(bus_space_tag_t tag,\n\t\t\t\t\t     bus_space_handle_t bsh1,\n\t\t\t\t\t     bus_size_t off1,\n\t\t\t\t\t     bus_space_handle_t bsh2,\n\t\t\t\t\t     bus_size_t off2, size_t count);\n\nstatic __inline void bus_space_copy_region_2(bus_space_tag_t tag,\n\t\t\t\t\t     bus_space_handle_t bsh1,\n\t\t\t\t\t     bus_size_t off1,\n\t\t\t\t\t     bus_space_handle_t bsh2,\n\t\t\t\t\t     bus_size_t off2, size_t count);\n\nstatic __inline void bus_space_copy_region_4(bus_space_tag_t tag,\n\t\t\t\t\t     bus_space_handle_t bsh1,\n\t\t\t\t\t     bus_size_t off1,\n\t\t\t\t\t     bus_space_handle_t bsh2,\n\t\t\t\t\t     bus_size_t off2, size_t count);\n\nstatic __inline void\nbus_space_copy_region_1(bus_space_tag_t tag, bus_space_handle_t bsh1,\n\t\t\tbus_size_t off1, bus_space_handle_t bsh2,\n\t\t\tbus_size_t off2, size_t count)\n{\n\tbus_space_handle_t addr1 = bsh1 + off1;\n\tbus_space_handle_t addr2 = bsh2 + off2;\n\n\tif (tag == X86_BUS_SPACE_IO) {\n\t\tif (addr1 >= addr2) {\n\t\t\t/* src after dest: copy forward */\n\t\t\tfor (; count != 0; count--, addr1++, addr2++)\n\t\t\t\toutb(addr2, inb(addr1));\n\t\t} else {\n\t\t\t/* dest after src: copy backwards */\n\t\t\tfor (addr1 += (count - 1), addr2 += (count - 1);\n\t\t\t    count != 0; count--, addr1--, addr2--)\n\t\t\t\toutb(addr2, inb(addr1));\n\t\t}\n\t} else {\n\t\tif (addr1 >= addr2) {\n\t\t\t/* src after dest: copy forward */\n\t\t\tfor (; count != 0; count--, addr1++, addr2++)\n\t\t\t\t*(volatile u_int8_t *)(addr2) =\n\t\t\t\t    *(volatile u_int8_t *)(addr1);\n\t\t} else {\n\t\t\t/* dest after src: copy backwards */\n\t\t\tfor (addr1 += (count - 1), addr2 += (count - 1);\n\t\t\t    count != 0; count--, addr1--, addr2--)\n\t\t\t\t*(volatile u_int8_t *)(addr2) =\n\t\t\t\t    *(volatile u_int8_t *)(addr1);\n\t\t}\n\t}\n}\n\nstatic __inline void\nbus_space_copy_region_2(bus_space_tag_t tag, bus_space_handle_t bsh1,\n\t\t\tbus_size_t off1, bus_space_handle_t bsh2,\n\t\t\tbus_size_t off2, size_t count)\n{\n\tbus_space_handle_t addr1 = bsh1 + off1;\n\tbus_space_handle_t addr2 = bsh2 + off2;\n\n\tif (tag == X86_BUS_SPACE_IO) {\n\t\tif (addr1 >= addr2) {\n\t\t\t/* src after dest: copy forward */\n\t\t\tfor (; count != 0; count--, addr1 += 2, addr2 += 2)\n\t\t\t\toutw(addr2, inw(addr1));\n\t\t} else {\n\t\t\t/* dest after src: copy backwards */\n\t\t\tfor (addr1 += 2 * (count - 1), addr2 += 2 * (count - 1);\n\t\t\t    count != 0; count--, addr1 -= 2, addr2 -= 2)\n\t\t\t\toutw(addr2, inw(addr1));\n\t\t}\n\t} else {\n\t\tif (addr1 >= addr2) {\n\t\t\t/* src after dest: copy forward */\n\t\t\tfor (; count != 0; count--, addr1 += 2, addr2 += 2)\n\t\t\t\t*(volatile u_int16_t *)(addr2) =\n\t\t\t\t    *(volatile u_int16_t *)(addr1);\n\t\t} else {\n\t\t\t/* dest after src: copy backwards */\n\t\t\tfor (addr1 += 2 * (count - 1), addr2 += 2 * (count - 1);\n\t\t\t    count != 0; count--, addr1 -= 2, addr2 -= 2)\n\t\t\t\t*(volatile u_int16_t *)(addr2) =\n\t\t\t\t    *(volatile u_int16_t *)(addr1);\n\t\t}\n\t}\n}\n\nstatic __inline void\nbus_space_copy_region_4(bus_space_tag_t tag, bus_space_handle_t bsh1,\n\t\t\tbus_size_t off1, bus_space_handle_t bsh2,\n\t\t\tbus_size_t off2, size_t count)\n{\n\tbus_space_handle_t addr1 = bsh1 + off1;\n\tbus_space_handle_t addr2 = bsh2 + off2;\n\n\tif (tag == X86_BUS_SPACE_IO) {\n\t\tif (addr1 >= addr2) {\n\t\t\t/* src after dest: copy forward */\n\t\t\tfor (; count != 0; count--, addr1 += 4, addr2 += 4)\n\t\t\t\toutl(addr2, inl(addr1));\n\t\t} else {\n\t\t\t/* dest after src: copy backwards */\n\t\t\tfor (addr1 += 4 * (count - 1), addr2 += 4 * (count - 1);\n\t\t\t    count != 0; count--, addr1 -= 4, addr2 -= 4)\n\t\t\t\toutl(addr2, inl(addr1));\n\t\t}\n\t} else {\n\t\tif (addr1 >= addr2) {\n\t\t\t/* src after dest: copy forward */\n\t\t\tfor (; count != 0; count--, addr1 += 4, addr2 += 4)\n\t\t\t\t*(volatile u_int32_t *)(addr2) =\n\t\t\t\t    *(volatile u_int32_t *)(addr1);\n\t\t} else {\n\t\t\t/* dest after src: copy backwards */\n\t\t\tfor (addr1 += 4 * (count - 1), addr2 += 4 * (count - 1);\n\t\t\t    count != 0; count--, addr1 -= 4, addr2 -= 4)\n\t\t\t\t*(volatile u_int32_t *)(addr2) =\n\t\t\t\t    *(volatile u_int32_t *)(addr1);\n\t\t}\n\t}\n}\n\n#if 0\t/* Cause a link error for bus_space_copy_8 */\n#define\tbus_space_copy_region_8\t!!! bus_space_copy_region_8 unimplemented !!!\n#endif\n\n/*\n * Bus read/write barrier methods.\n *\n *\tvoid bus_space_barrier(bus_space_tag_t tag, bus_space_handle_t bsh,\n *\t\t\t       bus_size_t offset, bus_size_t len, int flags);\n *\n *\n * Note that BUS_SPACE_BARRIER_WRITE doesn't do anything other than\n * prevent reordering by the compiler; all Intel x86 processors currently\n * retire operations outside the CPU in program order.\n */\n#define\tBUS_SPACE_BARRIER_READ\t0x01\t\t/* force read barrier */\n#define\tBUS_SPACE_BARRIER_WRITE\t0x02\t\t/* force write barrier */\n\nstatic __inline void\nbus_space_barrier(bus_space_tag_t tag __unused, bus_space_handle_t bsh __unused,\n\t\t  bus_size_t offset __unused, bus_size_t len __unused, int flags)\n{\n#ifdef __GNUCLIKE_ASM\n\tif (flags & BUS_SPACE_BARRIER_READ)\n#ifdef __amd64__\n\t\t__asm __volatile(\"lock; addl $0,0(%%rsp)\" : : : \"memory\");\n#else\n\t\t__asm __volatile(\"lock; addl $0,0(%%esp)\" : : : \"memory\");\n#endif\n\telse\n\t\t__asm __volatile(\"\" : : : \"memory\");\n#endif\n}\n\n#ifdef BUS_SPACE_NO_LEGACY\n#undef inb\n#undef outb\n#define inb(a) compiler_error\n#define inw(a) compiler_error\n#define inl(a) compiler_error\n#define outb(a, b) compiler_error\n#define outw(a, b) compiler_error\n#define outl(a, b) compiler_error\n#endif\n\n#include <machine/bus_dma.h>\n\n/*\n * Stream accesses are the same as normal accesses on x86; there are no\n * supported bus systems with an endianess different from the host one.\n */\n#define\tbus_space_read_stream_1(t, h, o)\tbus_space_read_1((t), (h), (o))\n#define\tbus_space_read_stream_2(t, h, o)\tbus_space_read_2((t), (h), (o))\n#define\tbus_space_read_stream_4(t, h, o)\tbus_space_read_4((t), (h), (o))\n\n#define\tbus_space_read_multi_stream_1(t, h, o, a, c) \\\n\tbus_space_read_multi_1((t), (h), (o), (a), (c))\n#define\tbus_space_read_multi_stream_2(t, h, o, a, c) \\\n\tbus_space_read_multi_2((t), (h), (o), (a), (c))\n#define\tbus_space_read_multi_stream_4(t, h, o, a, c) \\\n\tbus_space_read_multi_4((t), (h), (o), (a), (c))\n\n#define\tbus_space_write_stream_1(t, h, o, v) \\\n\tbus_space_write_1((t), (h), (o), (v))\n#define\tbus_space_write_stream_2(t, h, o, v) \\\n\tbus_space_write_2((t), (h), (o), (v))\n#define\tbus_space_write_stream_4(t, h, o, v) \\\n\tbus_space_write_4((t), (h), (o), (v))\n\n#define\tbus_space_write_multi_stream_1(t, h, o, a, c) \\\n\tbus_space_write_multi_1((t), (h), (o), (a), (c))\n#define\tbus_space_write_multi_stream_2(t, h, o, a, c) \\\n\tbus_space_write_multi_2((t), (h), (o), (a), (c))\n#define\tbus_space_write_multi_stream_4(t, h, o, a, c) \\\n\tbus_space_write_multi_4((t), (h), (o), (a), (c))\n\n#define\tbus_space_set_multi_stream_1(t, h, o, v, c) \\\n\tbus_space_set_multi_1((t), (h), (o), (v), (c))\n#define\tbus_space_set_multi_stream_2(t, h, o, v, c) \\\n\tbus_space_set_multi_2((t), (h), (o), (v), (c))\n#define\tbus_space_set_multi_stream_4(t, h, o, v, c) \\\n\tbus_space_set_multi_4((t), (h), (o), (v), (c))\n\n#define\tbus_space_read_region_stream_1(t, h, o, a, c) \\\n\tbus_space_read_region_1((t), (h), (o), (a), (c))\n#define\tbus_space_read_region_stream_2(t, h, o, a, c) \\\n\tbus_space_read_region_2((t), (h), (o), (a), (c))\n#define\tbus_space_read_region_stream_4(t, h, o, a, c) \\\n\tbus_space_read_region_4((t), (h), (o), (a), (c))\n\n#define\tbus_space_write_region_stream_1(t, h, o, a, c) \\\n\tbus_space_write_region_1((t), (h), (o), (a), (c))\n#define\tbus_space_write_region_stream_2(t, h, o, a, c) \\\n\tbus_space_write_region_2((t), (h), (o), (a), (c))\n#define\tbus_space_write_region_stream_4(t, h, o, a, c) \\\n\tbus_space_write_region_4((t), (h), (o), (a), (c))\n\n#define\tbus_space_set_region_stream_1(t, h, o, v, c) \\\n\tbus_space_set_region_1((t), (h), (o), (v), (c))\n#define\tbus_space_set_region_stream_2(t, h, o, v, c) \\\n\tbus_space_set_region_2((t), (h), (o), (v), (c))\n#define\tbus_space_set_region_stream_4(t, h, o, v, c) \\\n\tbus_space_set_region_4((t), (h), (o), (v), (c))\n\n#define\tbus_space_copy_region_stream_1(t, h1, o1, h2, o2, c) \\\n\tbus_space_copy_region_1((t), (h1), (o1), (h2), (o2), (c))\n#define\tbus_space_copy_region_stream_2(t, h1, o1, h2, o2, c) \\\n\tbus_space_copy_region_2((t), (h1), (o1), (h2), (o2), (c))\n#define\tbus_space_copy_region_stream_4(t, h1, o1, h2, o2, c) \\\n\tbus_space_copy_region_4((t), (h1), (o1), (h2), (o2), (c))\n\n#endif /* _X86_BUS_H_ */\n"
  },
  {
    "path": "freebsd-headers/x86/mca.h",
    "content": "/*-\n * Copyright (c) 2009 Advanced Computing Technologies LLC\n * Written by: John H. Baldwin <jhb@FreeBSD.org>\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/x86/include/mca.h 214630 2010-11-01 17:40:35Z jhb $\n */\n\n#ifndef __X86_MCA_H__\n#define\t__X86_MCA_H__\n\nstruct mca_record {\n\tuint64_t\tmr_status;\n\tuint64_t\tmr_addr;\n\tuint64_t\tmr_misc;\n\tuint64_t\tmr_tsc;\n\tint\t\tmr_apic_id;\n\tint\t\tmr_bank;\n\tuint64_t\tmr_mcg_cap;\n\tuint64_t\tmr_mcg_status;\n\tint\t\tmr_cpu_id;\n\tint\t\tmr_cpu_vendor_id;\n\tint\t\tmr_cpu;\n};\n\n#ifdef _KERNEL\n\nvoid\tcmc_intr(void);\nvoid\tmca_init(void);\nint\tmca_intr(void);\nvoid\tmca_resume(void);\n\n#endif\n\n#endif /* !__X86_MCA_H__ */\n"
  },
  {
    "path": "freebsd-headers/x86/mptable.h",
    "content": "/*-\n * Copyright (c) 1996, by Steve Passe\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. The name of the developer may NOT be used to endorse or promote products\n *    derived from this software without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/x86/include/mptable.h 224096 2011-07-16 14:05:34Z jhb $\n */\n\n#ifndef __MACHINE_MPTABLE_H__\n#define\t__MACHINE_MPTABLE_H__\n\nenum busTypes {\n    NOBUS = 0,\n    EISA = 3,\n    ISA = 6,\n    MCA = 9,\n    PCI = 13,\n    MAX_BUSTYPE = 18,\n    UNKNOWN_BUSTYPE = 0xff\n};\n\n/* MP Floating Pointer Structure */\ntypedef struct MPFPS {\n\tchar    signature[4];\n\tu_int32_t pap;\n\tu_char  length;\n\tu_char  spec_rev;\n\tu_char  checksum;\n\tu_char  config_type;\n\tu_char  mpfb2;\n\tu_char  mpfb3;\n\tu_char  mpfb4;\n\tu_char  mpfb5;\n}      *mpfps_t;\n\n#define\tMPFB2_IMCR_PRESENT\t0x80\n#define\tMPFB2_MUL_CLK_SRCS\t0x40\n\n/* MP Configuration Table Header */\ntypedef struct MPCTH {\n\tchar    signature[4];\n\tu_short base_table_length;\n\tu_char  spec_rev;\n\tu_char  checksum;\n\tu_char  oem_id[8];\n\tu_char  product_id[12];\n\tu_int32_t oem_table_pointer;\n\tu_short oem_table_size;\n\tu_short entry_count;\n\tu_int32_t apic_address;\n\tu_short extended_table_length;\n\tu_char  extended_table_checksum;\n\tu_char  reserved;\n}      *mpcth_t;\n\n/* Base table entries */\n\n#define\tMPCT_ENTRY_PROCESSOR\t0\n#define\tMPCT_ENTRY_BUS\t\t1\n#define\tMPCT_ENTRY_IOAPIC\t2\n#define\tMPCT_ENTRY_INT\t\t3\n#define\tMPCT_ENTRY_LOCAL_INT\t4\n\ntypedef struct PROCENTRY {\n\tu_char  type;\n\tu_char  apic_id;\n\tu_char  apic_version;\n\tu_char  cpu_flags;\n\tu_long  cpu_signature;\n\tu_long  feature_flags;\n\tu_long  reserved1;\n\tu_long  reserved2;\n}      *proc_entry_ptr;\n\n#define PROCENTRY_FLAG_EN\t0x01\n#define PROCENTRY_FLAG_BP\t0x02\n\ntypedef struct BUSENTRY {\n\tu_char  type;\n\tu_char  bus_id;\n\tchar    bus_type[6];\n}      *bus_entry_ptr;\n\ntypedef struct IOAPICENTRY {\n\tu_char  type;\n\tu_char  apic_id;\n\tu_char  apic_version;\n\tu_char  apic_flags;\n\tu_int32_t apic_address;\n}      *io_apic_entry_ptr;\n\n#define IOAPICENTRY_FLAG_EN\t0x01\n\ntypedef struct INTENTRY {\n\tu_char  type;\n\tu_char  int_type;\n\tu_short int_flags;\n\tu_char  src_bus_id;\n\tu_char  src_bus_irq;\n\tu_char  dst_apic_id;\n\tu_char  dst_apic_int;\n}      *int_entry_ptr;\n\n#define\tINTENTRY_TYPE_INT  \t0\n#define\tINTENTRY_TYPE_NMI\t1\n#define\tINTENTRY_TYPE_SMI\t2\n#define\tINTENTRY_TYPE_EXTINT\t3\n\n#define\tINTENTRY_FLAGS_POLARITY\t\t\t0x3\n#define\tINTENTRY_FLAGS_POLARITY_CONFORM\t\t0x0\n#define\tINTENTRY_FLAGS_POLARITY_ACTIVEHI\t0x1\n#define\tINTENTRY_FLAGS_POLARITY_ACTIVELO\t0x3\n#define\tINTENTRY_FLAGS_TRIGGER\t\t\t0xc\n#define\tINTENTRY_FLAGS_TRIGGER_CONFORM\t\t0x0\n#define\tINTENTRY_FLAGS_TRIGGER_EDGE\t\t0x4\n#define\tINTENTRY_FLAGS_TRIGGER_LEVEL\t\t0xc\n\n/* Extended table entries */\n\ntypedef\tstruct EXTENTRY {\n\tu_char\ttype;\n\tu_char\tlength;\n}      *ext_entry_ptr;\n\n#define\tMPCT_EXTENTRY_SAS\t0x80\n#define\tMPCT_EXTENTRY_BHD\t0x81\n#define\tMPCT_EXTENTRY_CBASM\t0x82\n\ntypedef struct SASENTRY {\n\tu_char\ttype;\n\tu_char\tlength;\n\tu_char\tbus_id;\n\tu_char\taddress_type;\n\tuint64_t address_base;\n\tuint64_t address_length;\n} __attribute__((__packed__)) *sas_entry_ptr;\n\n#define\tSASENTRY_TYPE_IO\t0\n#define\tSASENTRY_TYPE_MEMORY\t1\n#define\tSASENTRY_TYPE_PREFETCH\t2\n\ntypedef struct BHDENTRY {\n\tu_char\ttype;\n\tu_char\tlength;\n\tu_char\tbus_id;\n\tu_char\tbus_info;\n\tu_char\tparent_bus;\n\tu_char\treserved[3];\n}      *bhd_entry_ptr;\n\n#define\tBHDENTRY_INFO_SUBTRACTIVE_DECODE\t0x1\n\ntypedef struct CBASMENTRY {\n\tu_char\ttype;\n\tu_char\tlength;\n\tu_char\tbus_id;\n\tu_char\taddress_mod;\n\tu_int\tpredefined_range;\n}      *cbasm_entry_ptr;\n\n#define\tCBASMENTRY_ADDRESS_MOD_ADD\t\t0x0\n#define\tCBASMENTRY_ADDRESS_MOD_SUBTRACT\t\t0x1\n\n#define\tCBASMENTRY_RANGE_ISA_IO\t\t0\n#define\tCBASMENTRY_RANGE_VGA_IO\t\t1\n\n/* descriptions of MP table entries */\ntypedef struct BASETABLE_ENTRY {\n\tu_char  type;\n\tu_char  length;\n\tchar    name[16];\n}       basetable_entry;\n\n#ifdef _KERNEL\nstruct mptable_hostb_softc {\n#ifdef NEW_PCIB\n\tstruct pcib_host_resources sc_host_res;\n\tint\t\tsc_decodes_vga_io;\n\tint\t\tsc_decodes_isa_io;\n#endif\n};\n\n#ifdef NEW_PCIB\nvoid\tmptable_pci_host_res_init(device_t pcib);\n#endif\nint\tmptable_pci_probe_table(int bus);\nint\tmptable_pci_route_interrupt(device_t pcib, device_t dev, int pin);\n#endif\n#endif /* !__MACHINE_MPTABLE_H__ */\n"
  },
  {
    "path": "freebsd-headers/x86/pci_cfgreg.h",
    "content": "/*-\n * Copyright (c) 1997, Stefan Esser <se@freebsd.org>\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice unmodified, this list of conditions, and the following\n *    disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR\n * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES\n * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,\n * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF\n * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/sys/x86/include/pci_cfgreg.h 223440 2011-06-22 21:04:13Z jhb $\n *\n */\n\n#ifndef __X86_PCI_CFGREG_H__\n#define\t__X86_PCI_CFGREG_H__\n\n#define CONF1_ADDR_PORT    0x0cf8\n#define CONF1_DATA_PORT    0x0cfc\n\n#define CONF1_ENABLE       0x80000000ul\n#define CONF1_ENABLE_CHK   0x80000000ul\n#define CONF1_ENABLE_MSK   0x7f000000ul\n#define CONF1_ENABLE_CHK1  0xff000001ul\n#define CONF1_ENABLE_MSK1  0x80000001ul\n#define CONF1_ENABLE_RES1  0x80000000ul\n\n#define CONF2_ENABLE_PORT  0x0cf8\n#define CONF2_FORWARD_PORT 0x0cfa\n\n#define CONF2_ENABLE_CHK   0x0e\n#define CONF2_ENABLE_RES   0x0e\n\nu_long\t\thostb_alloc_start(int type, u_long start, u_long end, u_long count);\nint\t\tpcie_cfgregopen(uint64_t base, uint8_t minbus, uint8_t maxbus);\nint\t\tpci_cfgregopen(void);\nu_int32_t\tpci_cfgregread(int bus, int slot, int func, int reg, int bytes);\nvoid\t\tpci_cfgregwrite(int bus, int slot, int func, int reg, u_int32_t data, int bytes);\n#ifdef __HAVE_PIR\nvoid\t\tpci_pir_open(void);\nint\t\tpci_pir_probe(int bus, int require_parse);\nint\t\tpci_pir_route_interrupt(int bus, int device, int func, int pin);\n#endif\n\n#endif /* !__X86_PCI_CFGREG_H__ */\n"
  },
  {
    "path": "freebsd-headers/ypclnt.h",
    "content": "/*-\n * Copyright (c) 2002 Networks Associates Technology, Inc.\n * All rights reserved.\n *\n * This software was developed for the FreeBSD Project by ThinkSec AS and\n * NAI Labs, the Security Research Division of Network Associates, Inc.\n * under DARPA/SPAWAR contract N66001-01-C-8035 (\"CBOSS\"), as part of the\n * DARPA CHATS research program.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n *    notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n *    notice, this list of conditions and the following disclaimer in the\n *    documentation and/or other materials provided with the distribution.\n * 3. The name of the author may not be used to endorse or promote\n *    products derived from this software without specific prior written\n *    permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $FreeBSD: release/9.0.0/lib/libypclnt/ypclnt.h 160804 2006-07-28 21:34:37Z stefanf $\n */\n\n#ifndef _YPCLNT_H_INCLUDED\n\ntypedef struct ypclnt ypclnt_t;\nstruct ypclnt {\n\tchar\t*domain;\t/* Domain name */\n\tchar\t*map;\t\t/* Map name */\n\tchar\t*server;\t/* Server name */\n\tchar\t*error;\t\t/* Error message */\n};\n\nstruct passwd;\n\nypclnt_t\t*ypclnt_new(const char *, const char *, const char *);\nvoid\t\t ypclnt_free(ypclnt_t *);\nvoid\t\t ypclnt_error(ypclnt_t *, const char *, const char *, ...);\nint\t\t ypclnt_connect(ypclnt_t *);\nint\t\t ypclnt_havepasswdd(ypclnt_t *);\nint\t\t ypclnt_passwd(ypclnt_t *, const struct passwd *, const char *);\n\n#endif\n"
  },
  {
    "path": "freebsd-headers/zconf.h",
    "content": "/* zconf.h -- configuration of the zlib compression library\n * Copyright (C) 1995-2010 Jean-loup Gailly.\n * For conditions of distribution and use, see copyright notice in zlib.h\n */\n\n/* @(#) $FreeBSD: release/9.0.0/lib/libz/zconf.h 206924 2010-04-20 21:14:30Z delphij $ */\n\n#ifndef ZCONF_H\n#define ZCONF_H\n\n/*\n * If you *really* need a unique prefix for all types and library functions,\n * compile with -DZ_PREFIX. The \"standard\" zlib should be compiled without it.\n * Even better than compiling with -DZ_PREFIX would be to use configure to set\n * this permanently in zconf.h using \"./configure --zprefix\".\n */\n#ifdef Z_PREFIX     /* may be set to #if 1 by ./configure */\n\n/* all linked symbols */\n#  define _dist_code            z__dist_code\n#  define _length_code          z__length_code\n#  define _tr_align             z__tr_align\n#  define _tr_flush_block       z__tr_flush_block\n#  define _tr_init              z__tr_init\n#  define _tr_stored_block      z__tr_stored_block\n#  define _tr_tally             z__tr_tally\n#  define adler32               z_adler32\n#  define adler32_combine       z_adler32_combine\n#  define adler32_combine64     z_adler32_combine64\n#  define compress              z_compress\n#  define compress2             z_compress2\n#  define compressBound         z_compressBound\n#  define crc32                 z_crc32\n#  define crc32_combine         z_crc32_combine\n#  define crc32_combine64       z_crc32_combine64\n#  define deflate               z_deflate\n#  define deflateBound          z_deflateBound\n#  define deflateCopy           z_deflateCopy\n#  define deflateEnd            z_deflateEnd\n#  define deflateInit2_         z_deflateInit2_\n#  define deflateInit_          z_deflateInit_\n#  define deflateParams         z_deflateParams\n#  define deflatePrime          z_deflatePrime\n#  define deflateReset          z_deflateReset\n#  define deflateSetDictionary  z_deflateSetDictionary\n#  define deflateSetHeader      z_deflateSetHeader\n#  define deflateTune           z_deflateTune\n#  define deflate_copyright     z_deflate_copyright\n#  define get_crc_table         z_get_crc_table\n#  define gz_error              z_gz_error\n#  define gz_intmax             z_gz_intmax\n#  define gz_strwinerror        z_gz_strwinerror\n#  define gzbuffer              z_gzbuffer\n#  define gzclearerr            z_gzclearerr\n#  define gzclose               z_gzclose\n#  define gzclose_r             z_gzclose_r\n#  define gzclose_w             z_gzclose_w\n#  define gzdirect              z_gzdirect\n#  define gzdopen               z_gzdopen\n#  define gzeof                 z_gzeof\n#  define gzerror               z_gzerror\n#  define gzflush               z_gzflush\n#  define gzgetc                z_gzgetc\n#  define gzgets                z_gzgets\n#  define gzoffset              z_gzoffset\n#  define gzoffset64            z_gzoffset64\n#  define gzopen                z_gzopen\n#  define gzopen64              z_gzopen64\n#  define gzprintf              z_gzprintf\n#  define gzputc                z_gzputc\n#  define gzputs                z_gzputs\n#  define gzread                z_gzread\n#  define gzrewind              z_gzrewind\n#  define gzseek                z_gzseek\n#  define gzseek64              z_gzseek64\n#  define gzsetparams           z_gzsetparams\n#  define gztell                z_gztell\n#  define gztell64              z_gztell64\n#  define gzungetc              z_gzungetc\n#  define gzwrite               z_gzwrite\n#  define inflate               z_inflate\n#  define inflateBack           z_inflateBack\n#  define inflateBackEnd        z_inflateBackEnd\n#  define inflateBackInit_      z_inflateBackInit_\n#  define inflateCopy           z_inflateCopy\n#  define inflateEnd            z_inflateEnd\n#  define inflateGetHeader      z_inflateGetHeader\n#  define inflateInit2_         z_inflateInit2_\n#  define inflateInit_          z_inflateInit_\n#  define inflateMark           z_inflateMark\n#  define inflatePrime          z_inflatePrime\n#  define inflateReset          z_inflateReset\n#  define inflateReset2         z_inflateReset2\n#  define inflateSetDictionary  z_inflateSetDictionary\n#  define inflateSync           z_inflateSync\n#  define inflateSyncPoint      z_inflateSyncPoint\n#  define inflateUndermine      z_inflateUndermine\n#  define inflate_copyright     z_inflate_copyright\n#  define inflate_fast          z_inflate_fast\n#  define inflate_table         z_inflate_table\n#  define uncompress            z_uncompress\n#  define zError                z_zError\n#  define zcalloc               z_zcalloc\n#  define zcfree                z_zcfree\n#  define zlibCompileFlags      z_zlibCompileFlags\n#  define zlibVersion           z_zlibVersion\n\n/* all zlib typedefs in zlib.h and zconf.h */\n#  define Byte                  z_Byte\n#  define Bytef                 z_Bytef\n#  define alloc_func            z_alloc_func\n#  define charf                 z_charf\n#  define free_func             z_free_func\n#  define gzFile                z_gzFile\n#  define gz_header             z_gz_header\n#  define gz_headerp            z_gz_headerp\n#  define in_func               z_in_func\n#  define intf                  z_intf\n#  define out_func              z_out_func\n#  define uInt                  z_uInt\n#  define uIntf                 z_uIntf\n#  define uLong                 z_uLong\n#  define uLongf                z_uLongf\n#  define voidp                 z_voidp\n#  define voidpc                z_voidpc\n#  define voidpf                z_voidpf\n\n/* all zlib structs in zlib.h and zconf.h */\n#  define gz_header_s           z_gz_header_s\n#  define internal_state        z_internal_state\n\n#endif\n\n#if defined(__MSDOS__) && !defined(MSDOS)\n#  define MSDOS\n#endif\n#if (defined(OS_2) || defined(__OS2__)) && !defined(OS2)\n#  define OS2\n#endif\n#if defined(_WINDOWS) && !defined(WINDOWS)\n#  define WINDOWS\n#endif\n#if defined(_WIN32) || defined(_WIN32_WCE) || defined(__WIN32__)\n#  ifndef WIN32\n#    define WIN32\n#  endif\n#endif\n#if (defined(MSDOS) || defined(OS2) || defined(WINDOWS)) && !defined(WIN32)\n#  if !defined(__GNUC__) && !defined(__FLAT__) && !defined(__386__)\n#    ifndef SYS16BIT\n#      define SYS16BIT\n#    endif\n#  endif\n#endif\n\n/*\n * Compile with -DMAXSEG_64K if the alloc function cannot allocate more\n * than 64k bytes at a time (needed on systems with 16-bit int).\n */\n#ifdef SYS16BIT\n#  define MAXSEG_64K\n#endif\n#ifdef MSDOS\n#  define UNALIGNED_OK\n#endif\n\n#ifdef __STDC_VERSION__\n#  ifndef STDC\n#    define STDC\n#  endif\n#  if __STDC_VERSION__ >= 199901L\n#    ifndef STDC99\n#      define STDC99\n#    endif\n#  endif\n#endif\n#if !defined(STDC) && (defined(__STDC__) || defined(__cplusplus))\n#  define STDC\n#endif\n#if !defined(STDC) && (defined(__GNUC__) || defined(__BORLANDC__))\n#  define STDC\n#endif\n#if !defined(STDC) && (defined(MSDOS) || defined(WINDOWS) || defined(WIN32))\n#  define STDC\n#endif\n#if !defined(STDC) && (defined(OS2) || defined(__HOS_AIX__))\n#  define STDC\n#endif\n\n#if defined(__OS400__) && !defined(STDC)    /* iSeries (formerly AS/400). */\n#  define STDC\n#endif\n\n#ifndef STDC\n#  ifndef const /* cannot use !defined(STDC) && !defined(const) on Mac */\n#    define const       /* note: need a more gentle solution here */\n#  endif\n#endif\n\n/* Some Mac compilers merge all .h files incorrectly: */\n#if defined(__MWERKS__)||defined(applec)||defined(THINK_C)||defined(__SC__)\n#  define NO_DUMMY_DECL\n#endif\n\n/* Maximum value for memLevel in deflateInit2 */\n#ifndef MAX_MEM_LEVEL\n#  ifdef MAXSEG_64K\n#    define MAX_MEM_LEVEL 8\n#  else\n#    define MAX_MEM_LEVEL 9\n#  endif\n#endif\n\n/* Maximum value for windowBits in deflateInit2 and inflateInit2.\n * WARNING: reducing MAX_WBITS makes minigzip unable to extract .gz files\n * created by gzip. (Files created by minigzip can still be extracted by\n * gzip.)\n */\n#ifndef MAX_WBITS\n#  define MAX_WBITS   15 /* 32K LZ77 window */\n#endif\n\n/* The memory requirements for deflate are (in bytes):\n            (1 << (windowBits+2)) +  (1 << (memLevel+9))\n that is: 128K for windowBits=15  +  128K for memLevel = 8  (default values)\n plus a few kilobytes for small objects. For example, if you want to reduce\n the default memory requirements from 256K to 128K, compile with\n     make CFLAGS=\"-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7\"\n Of course this will generally degrade compression (there's no free lunch).\n\n   The memory requirements for inflate are (in bytes) 1 << windowBits\n that is, 32K for windowBits=15 (default value) plus a few kilobytes\n for small objects.\n*/\n\n                        /* Type declarations */\n\n#ifndef OF /* function prototypes */\n#  ifdef STDC\n#    define OF(args)  args\n#  else\n#    define OF(args)  ()\n#  endif\n#endif\n\n/* The following definitions for FAR are needed only for MSDOS mixed\n * model programming (small or medium model with some far allocations).\n * This was tested only with MSC; for other MSDOS compilers you may have\n * to define NO_MEMCPY in zutil.h.  If you don't need the mixed model,\n * just define FAR to be empty.\n */\n#ifdef SYS16BIT\n#  if defined(M_I86SM) || defined(M_I86MM)\n     /* MSC small or medium model */\n#    define SMALL_MEDIUM\n#    ifdef _MSC_VER\n#      define FAR _far\n#    else\n#      define FAR far\n#    endif\n#  endif\n#  if (defined(__SMALL__) || defined(__MEDIUM__))\n     /* Turbo C small or medium model */\n#    define SMALL_MEDIUM\n#    ifdef __BORLANDC__\n#      define FAR _far\n#    else\n#      define FAR far\n#    endif\n#  endif\n#endif\n\n#if defined(WINDOWS) || defined(WIN32)\n   /* If building or using zlib as a DLL, define ZLIB_DLL.\n    * This is not mandatory, but it offers a little performance increase.\n    */\n#  ifdef ZLIB_DLL\n#    if defined(WIN32) && (!defined(__BORLANDC__) || (__BORLANDC__ >= 0x500))\n#      ifdef ZLIB_INTERNAL\n#        define ZEXTERN extern __declspec(dllexport)\n#      else\n#        define ZEXTERN extern __declspec(dllimport)\n#      endif\n#    endif\n#  endif  /* ZLIB_DLL */\n   /* If building or using zlib with the WINAPI/WINAPIV calling convention,\n    * define ZLIB_WINAPI.\n    * Caution: the standard ZLIB1.DLL is NOT compiled using ZLIB_WINAPI.\n    */\n#  ifdef ZLIB_WINAPI\n#    ifdef FAR\n#      undef FAR\n#    endif\n#    include <windows.h>\n     /* No need for _export, use ZLIB.DEF instead. */\n     /* For complete Windows compatibility, use WINAPI, not __stdcall. */\n#    define ZEXPORT WINAPI\n#    ifdef WIN32\n#      define ZEXPORTVA WINAPIV\n#    else\n#      define ZEXPORTVA FAR CDECL\n#    endif\n#  endif\n#endif\n\n#if defined (__BEOS__)\n#  ifdef ZLIB_DLL\n#    ifdef ZLIB_INTERNAL\n#      define ZEXPORT   __declspec(dllexport)\n#      define ZEXPORTVA __declspec(dllexport)\n#    else\n#      define ZEXPORT   __declspec(dllimport)\n#      define ZEXPORTVA __declspec(dllimport)\n#    endif\n#  endif\n#endif\n\n#ifndef ZEXTERN\n#  define ZEXTERN extern\n#endif\n#ifndef ZEXPORT\n#  define ZEXPORT\n#endif\n#ifndef ZEXPORTVA\n#  define ZEXPORTVA\n#endif\n\n#ifndef FAR\n#  define FAR\n#endif\n\n#if !defined(__MACTYPES__)\ntypedef unsigned char  Byte;  /* 8 bits */\n#endif\ntypedef unsigned int   uInt;  /* 16 bits or more */\ntypedef unsigned long  uLong; /* 32 bits or more */\n\n#ifdef SMALL_MEDIUM\n   /* Borland C/C++ and some old MSC versions ignore FAR inside typedef */\n#  define Bytef Byte FAR\n#else\n   typedef Byte  FAR Bytef;\n#endif\ntypedef char  FAR charf;\ntypedef int   FAR intf;\ntypedef uInt  FAR uIntf;\ntypedef uLong FAR uLongf;\n\n#ifdef STDC\n   typedef void const *voidpc;\n   typedef void FAR   *voidpf;\n   typedef void       *voidp;\n#else\n   typedef Byte const *voidpc;\n   typedef Byte FAR   *voidpf;\n   typedef Byte       *voidp;\n#endif\n\n#if 0    /* was set to #if 0 by ./configure */\n#  define Z_HAVE_UNISTD_H\n#endif\n\n#ifdef STDC\n#  include <sys/types.h>    /* for off_t */\n#endif\n\n/* a little trick to accommodate both \"#define _LARGEFILE64_SOURCE\" and\n * \"#define _LARGEFILE64_SOURCE 1\" as requesting 64-bit operations, (even\n * though the former does not conform to the LFS document), but considering\n * both \"#undef _LARGEFILE64_SOURCE\" and \"#define _LARGEFILE64_SOURCE 0\" as\n * equivalently requesting no 64-bit operations\n */\n#if -_LARGEFILE64_SOURCE - -1 == 1\n#  undef _LARGEFILE64_SOURCE\n#endif\n\n#if defined(Z_HAVE_UNISTD_H) || defined(_LARGEFILE64_SOURCE)\n#  include <unistd.h>       /* for SEEK_* and off_t */\n#  ifdef VMS\n#    include <unixio.h>     /* for off_t */\n#  endif\n#  ifndef z_off_t\n#    define z_off_t off_t\n#  endif\n#endif\n\n#ifndef SEEK_SET\n#  define SEEK_SET        0       /* Seek from beginning of file.  */\n#  define SEEK_CUR        1       /* Seek from current position.  */\n#  define SEEK_END        2       /* Set file pointer to EOF plus \"offset\" */\n#endif\n\n/*\n * This is hard-configured for FreeBSD.\n */\n#define\tz_off_t\toff_t\n#ifndef _FILE_OFFSET_BITS\n#define _FILE_OFFSET_BITS 64\n#endif\n\n#ifndef z_off_t\n#  define z_off_t long\n#endif\n\n#if defined(_LARGEFILE64_SOURCE) && _LFS64_LARGEFILE-0\n#  define z_off64_t off64_t\n#else\n#  define z_off64_t z_off_t\n#endif\n\n#if defined(__OS400__)\n#  define NO_vsnprintf\n#endif\n\n#if defined(__MVS__)\n#  define NO_vsnprintf\n#endif\n\n/* MVS linker does not support external names larger than 8 bytes */\n#if defined(__MVS__)\n  #pragma map(deflateInit_,\"DEIN\")\n  #pragma map(deflateInit2_,\"DEIN2\")\n  #pragma map(deflateEnd,\"DEEND\")\n  #pragma map(deflateBound,\"DEBND\")\n  #pragma map(inflateInit_,\"ININ\")\n  #pragma map(inflateInit2_,\"ININ2\")\n  #pragma map(inflateEnd,\"INEND\")\n  #pragma map(inflateSync,\"INSY\")\n  #pragma map(inflateSetDictionary,\"INSEDI\")\n  #pragma map(compressBound,\"CMBND\")\n  #pragma map(inflate_table,\"INTABL\")\n  #pragma map(inflate_fast,\"INFA\")\n  #pragma map(inflate_copyright,\"INCOPY\")\n#endif\n\n#endif /* ZCONF_H */\n"
  },
  {
    "path": "freebsd-headers/zlib.h",
    "content": "/* zlib.h -- interface of the 'zlib' general purpose compression library\n  version 1.2.5, April 19th, 2010\n\n  Copyright (C) 1995-2010 Jean-loup Gailly and Mark Adler\n\n  This software is provided 'as-is', without any express or implied\n  warranty.  In no event will the authors be held liable for any damages\n  arising from the use of this software.\n\n  Permission is granted to anyone to use this software for any purpose,\n  including commercial applications, and to alter it and redistribute it\n  freely, subject to the following restrictions:\n\n  1. The origin of this software must not be misrepresented; you must not\n     claim that you wrote the original software. If you use this software\n     in a product, an acknowledgment in the product documentation would be\n     appreciated but is not required.\n  2. Altered source versions must be plainly marked as such, and must not be\n     misrepresented as being the original software.\n  3. This notice may not be removed or altered from any source distribution.\n\n  Jean-loup Gailly        Mark Adler\n  jloup@gzip.org          madler@alumni.caltech.edu\n\n\n  The data format used by the zlib library is described by RFCs (Request for\n  Comments) 1950 to 1952 in the files http://www.ietf.org/rfc/rfc1950.txt\n  (zlib format), rfc1951.txt (deflate format) and rfc1952.txt (gzip format).\n*/\n\n#ifndef ZLIB_H\n#define ZLIB_H\n\n#include \"zconf.h\"\n\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\n#define ZLIB_VERSION \"1.2.5\"\n#define ZLIB_VERNUM 0x1250\n#define ZLIB_VER_MAJOR 1\n#define ZLIB_VER_MINOR 2\n#define ZLIB_VER_REVISION 5\n#define ZLIB_VER_SUBREVISION 0\n\n/*\n    The 'zlib' compression library provides in-memory compression and\n  decompression functions, including integrity checks of the uncompressed data.\n  This version of the library supports only one compression method (deflation)\n  but other algorithms will be added later and will have the same stream\n  interface.\n\n    Compression can be done in a single step if the buffers are large enough,\n  or can be done by repeated calls of the compression function.  In the latter\n  case, the application must provide more input and/or consume the output\n  (providing more output space) before each call.\n\n    The compressed data format used by default by the in-memory functions is\n  the zlib format, which is a zlib wrapper documented in RFC 1950, wrapped\n  around a deflate stream, which is itself documented in RFC 1951.\n\n    The library also supports reading and writing files in gzip (.gz) format\n  with an interface similar to that of stdio using the functions that start\n  with \"gz\".  The gzip format is different from the zlib format.  gzip is a\n  gzip wrapper, documented in RFC 1952, wrapped around a deflate stream.\n\n    This library can optionally read and write gzip streams in memory as well.\n\n    The zlib format was designed to be compact and fast for use in memory\n  and on communications channels.  The gzip format was designed for single-\n  file compression on file systems, has a larger header than zlib to maintain\n  directory information, and uses a different, slower check method than zlib.\n\n    The library does not install any signal handler.  The decoder checks\n  the consistency of the compressed data, so the library should never crash\n  even in case of corrupted input.\n*/\n\ntypedef voidpf (*alloc_func) OF((voidpf opaque, uInt items, uInt size));\ntypedef void   (*free_func)  OF((voidpf opaque, voidpf address));\n\nstruct internal_state;\n\ntypedef struct z_stream_s {\n    Bytef    *next_in;  /* next input byte */\n    uInt     avail_in;  /* number of bytes available at next_in */\n    uLong    total_in;  /* total nb of input bytes read so far */\n\n    Bytef    *next_out; /* next output byte should be put there */\n    uInt     avail_out; /* remaining free space at next_out */\n    uLong    total_out; /* total nb of bytes output so far */\n\n    char     *msg;      /* last error message, NULL if no error */\n    struct internal_state FAR *state; /* not visible by applications */\n\n    alloc_func zalloc;  /* used to allocate the internal state */\n    free_func  zfree;   /* used to free the internal state */\n    voidpf     opaque;  /* private data object passed to zalloc and zfree */\n\n    int     data_type;  /* best guess about the data type: binary or text */\n    uLong   adler;      /* adler32 value of the uncompressed data */\n    uLong   reserved;   /* reserved for future use */\n} z_stream;\n\ntypedef z_stream FAR *z_streamp;\n\n/*\n     gzip header information passed to and from zlib routines.  See RFC 1952\n  for more details on the meanings of these fields.\n*/\ntypedef struct gz_header_s {\n    int     text;       /* true if compressed data believed to be text */\n    uLong   time;       /* modification time */\n    int     xflags;     /* extra flags (not used when writing a gzip file) */\n    int     os;         /* operating system */\n    Bytef   *extra;     /* pointer to extra field or Z_NULL if none */\n    uInt    extra_len;  /* extra field length (valid if extra != Z_NULL) */\n    uInt    extra_max;  /* space at extra (only when reading header) */\n    Bytef   *name;      /* pointer to zero-terminated file name or Z_NULL */\n    uInt    name_max;   /* space at name (only when reading header) */\n    Bytef   *comment;   /* pointer to zero-terminated comment or Z_NULL */\n    uInt    comm_max;   /* space at comment (only when reading header) */\n    int     hcrc;       /* true if there was or will be a header crc */\n    int     done;       /* true when done reading gzip header (not used\n                           when writing a gzip file) */\n} gz_header;\n\ntypedef gz_header FAR *gz_headerp;\n\n/*\n     The application must update next_in and avail_in when avail_in has dropped\n   to zero.  It must update next_out and avail_out when avail_out has dropped\n   to zero.  The application must initialize zalloc, zfree and opaque before\n   calling the init function.  All other fields are set by the compression\n   library and must not be updated by the application.\n\n     The opaque value provided by the application will be passed as the first\n   parameter for calls of zalloc and zfree.  This can be useful for custom\n   memory management.  The compression library attaches no meaning to the\n   opaque value.\n\n     zalloc must return Z_NULL if there is not enough memory for the object.\n   If zlib is used in a multi-threaded application, zalloc and zfree must be\n   thread safe.\n\n     On 16-bit systems, the functions zalloc and zfree must be able to allocate\n   exactly 65536 bytes, but will not be required to allocate more than this if\n   the symbol MAXSEG_64K is defined (see zconf.h).  WARNING: On MSDOS, pointers\n   returned by zalloc for objects of exactly 65536 bytes *must* have their\n   offset normalized to zero.  The default allocation function provided by this\n   library ensures this (see zutil.c).  To reduce memory requirements and avoid\n   any allocation of 64K objects, at the expense of compression ratio, compile\n   the library with -DMAX_WBITS=14 (see zconf.h).\n\n     The fields total_in and total_out can be used for statistics or progress\n   reports.  After compression, total_in holds the total size of the\n   uncompressed data and may be saved for use in the decompressor (particularly\n   if the decompressor wants to decompress everything in a single step).\n*/\n\n                        /* constants */\n\n#define Z_NO_FLUSH      0\n#define Z_PARTIAL_FLUSH 1\n#define Z_SYNC_FLUSH    2\n#define Z_FULL_FLUSH    3\n#define Z_FINISH        4\n#define Z_BLOCK         5\n#define Z_TREES         6\n/* Allowed flush values; see deflate() and inflate() below for details */\n\n#define Z_OK            0\n#define Z_STREAM_END    1\n#define Z_NEED_DICT     2\n#define Z_ERRNO        (-1)\n#define Z_STREAM_ERROR (-2)\n#define Z_DATA_ERROR   (-3)\n#define Z_MEM_ERROR    (-4)\n#define Z_BUF_ERROR    (-5)\n#define Z_VERSION_ERROR (-6)\n/* Return codes for the compression/decompression functions. Negative values\n * are errors, positive values are used for special but normal events.\n */\n\n#define Z_NO_COMPRESSION         0\n#define Z_BEST_SPEED             1\n#define Z_BEST_COMPRESSION       9\n#define Z_DEFAULT_COMPRESSION  (-1)\n/* compression levels */\n\n#define Z_FILTERED            1\n#define Z_HUFFMAN_ONLY        2\n#define Z_RLE                 3\n#define Z_FIXED               4\n#define Z_DEFAULT_STRATEGY    0\n/* compression strategy; see deflateInit2() below for details */\n\n#define Z_BINARY   0\n#define Z_TEXT     1\n#define Z_ASCII    Z_TEXT   /* for compatibility with 1.2.2 and earlier */\n#define Z_UNKNOWN  2\n/* Possible values of the data_type field (though see inflate()) */\n\n#define Z_DEFLATED   8\n/* The deflate compression method (the only one supported in this version) */\n\n#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */\n\n#define zlib_version zlibVersion()\n/* for compatibility with versions < 1.0.2 */\n\n\n                        /* basic functions */\n\nZEXTERN const char * ZEXPORT zlibVersion OF((void));\n/* The application can compare zlibVersion and ZLIB_VERSION for consistency.\n   If the first character differs, the library code actually used is not\n   compatible with the zlib.h header file used by the application.  This check\n   is automatically made by deflateInit and inflateInit.\n */\n\n/*\nZEXTERN int ZEXPORT deflateInit OF((z_streamp strm, int level));\n\n     Initializes the internal stream state for compression.  The fields\n   zalloc, zfree and opaque must be initialized before by the caller.  If\n   zalloc and zfree are set to Z_NULL, deflateInit updates them to use default\n   allocation functions.\n\n     The compression level must be Z_DEFAULT_COMPRESSION, or between 0 and 9:\n   1 gives best speed, 9 gives best compression, 0 gives no compression at all\n   (the input data is simply copied a block at a time).  Z_DEFAULT_COMPRESSION\n   requests a default compromise between speed and compression (currently\n   equivalent to level 6).\n\n     deflateInit returns Z_OK if success, Z_MEM_ERROR if there was not enough\n   memory, Z_STREAM_ERROR if level is not a valid compression level, or\n   Z_VERSION_ERROR if the zlib library version (zlib_version) is incompatible\n   with the version assumed by the caller (ZLIB_VERSION).  msg is set to null\n   if there is no error message.  deflateInit does not perform any compression:\n   this will be done by deflate().\n*/\n\n\nZEXTERN int ZEXPORT deflate OF((z_streamp strm, int flush));\n/*\n    deflate compresses as much data as possible, and stops when the input\n  buffer becomes empty or the output buffer becomes full.  It may introduce\n  some output latency (reading input without producing any output) except when\n  forced to flush.\n\n    The detailed semantics are as follows.  deflate performs one or both of the\n  following actions:\n\n  - Compress more input starting at next_in and update next_in and avail_in\n    accordingly.  If not all input can be processed (because there is not\n    enough room in the output buffer), next_in and avail_in are updated and\n    processing will resume at this point for the next call of deflate().\n\n  - Provide more output starting at next_out and update next_out and avail_out\n    accordingly.  This action is forced if the parameter flush is non zero.\n    Forcing flush frequently degrades the compression ratio, so this parameter\n    should be set only when necessary (in interactive applications).  Some\n    output may be provided even if flush is not set.\n\n    Before the call of deflate(), the application should ensure that at least\n  one of the actions is possible, by providing more input and/or consuming more\n  output, and updating avail_in or avail_out accordingly; avail_out should\n  never be zero before the call.  The application can consume the compressed\n  output when it wants, for example when the output buffer is full (avail_out\n  == 0), or after each call of deflate().  If deflate returns Z_OK and with\n  zero avail_out, it must be called again after making room in the output\n  buffer because there might be more output pending.\n\n    Normally the parameter flush is set to Z_NO_FLUSH, which allows deflate to\n  decide how much data to accumulate before producing output, in order to\n  maximize compression.\n\n    If the parameter flush is set to Z_SYNC_FLUSH, all pending output is\n  flushed to the output buffer and the output is aligned on a byte boundary, so\n  that the decompressor can get all input data available so far.  (In\n  particular avail_in is zero after the call if enough output space has been\n  provided before the call.) Flushing may degrade compression for some\n  compression algorithms and so it should be used only when necessary.  This\n  completes the current deflate block and follows it with an empty stored block\n  that is three bits plus filler bits to the next byte, followed by four bytes\n  (00 00 ff ff).\n\n    If flush is set to Z_PARTIAL_FLUSH, all pending output is flushed to the\n  output buffer, but the output is not aligned to a byte boundary.  All of the\n  input data so far will be available to the decompressor, as for Z_SYNC_FLUSH.\n  This completes the current deflate block and follows it with an empty fixed\n  codes block that is 10 bits long.  This assures that enough bytes are output\n  in order for the decompressor to finish the block before the empty fixed code\n  block.\n\n    If flush is set to Z_BLOCK, a deflate block is completed and emitted, as\n  for Z_SYNC_FLUSH, but the output is not aligned on a byte boundary, and up to\n  seven bits of the current block are held to be written as the next byte after\n  the next deflate block is completed.  In this case, the decompressor may not\n  be provided enough bits at this point in order to complete decompression of\n  the data provided so far to the compressor.  It may need to wait for the next\n  block to be emitted.  This is for advanced applications that need to control\n  the emission of deflate blocks.\n\n    If flush is set to Z_FULL_FLUSH, all output is flushed as with\n  Z_SYNC_FLUSH, and the compression state is reset so that decompression can\n  restart from this point if previous compressed data has been damaged or if\n  random access is desired.  Using Z_FULL_FLUSH too often can seriously degrade\n  compression.\n\n    If deflate returns with avail_out == 0, this function must be called again\n  with the same value of the flush parameter and more output space (updated\n  avail_out), until the flush is complete (deflate returns with non-zero\n  avail_out).  In the case of a Z_FULL_FLUSH or Z_SYNC_FLUSH, make sure that\n  avail_out is greater than six to avoid repeated flush markers due to\n  avail_out == 0 on return.\n\n    If the parameter flush is set to Z_FINISH, pending input is processed,\n  pending output is flushed and deflate returns with Z_STREAM_END if there was\n  enough output space; if deflate returns with Z_OK, this function must be\n  called again with Z_FINISH and more output space (updated avail_out) but no\n  more input data, until it returns with Z_STREAM_END or an error.  After\n  deflate has returned Z_STREAM_END, the only possible operations on the stream\n  are deflateReset or deflateEnd.\n\n    Z_FINISH can be used immediately after deflateInit if all the compression\n  is to be done in a single step.  In this case, avail_out must be at least the\n  value returned by deflateBound (see below).  If deflate does not return\n  Z_STREAM_END, then it must be called again as described above.\n\n    deflate() sets strm->adler to the adler32 checksum of all input read\n  so far (that is, total_in bytes).\n\n    deflate() may update strm->data_type if it can make a good guess about\n  the input data type (Z_BINARY or Z_TEXT).  In doubt, the data is considered\n  binary.  This field is only for information purposes and does not affect the\n  compression algorithm in any manner.\n\n    deflate() returns Z_OK if some progress has been made (more input\n  processed or more output produced), Z_STREAM_END if all input has been\n  consumed and all output has been produced (only when flush is set to\n  Z_FINISH), Z_STREAM_ERROR if the stream state was inconsistent (for example\n  if next_in or next_out was Z_NULL), Z_BUF_ERROR if no progress is possible\n  (for example avail_in or avail_out was zero).  Note that Z_BUF_ERROR is not\n  fatal, and deflate() can be called again with more input and more output\n  space to continue compressing.\n*/\n\n\nZEXTERN int ZEXPORT deflateEnd OF((z_streamp strm));\n/*\n     All dynamically allocated data structures for this stream are freed.\n   This function discards any unprocessed input and does not flush any pending\n   output.\n\n     deflateEnd returns Z_OK if success, Z_STREAM_ERROR if the\n   stream state was inconsistent, Z_DATA_ERROR if the stream was freed\n   prematurely (some input or output was discarded).  In the error case, msg\n   may be set but then points to a static string (which must not be\n   deallocated).\n*/\n\n\n/*\nZEXTERN int ZEXPORT inflateInit OF((z_streamp strm));\n\n     Initializes the internal stream state for decompression.  The fields\n   next_in, avail_in, zalloc, zfree and opaque must be initialized before by\n   the caller.  If next_in is not Z_NULL and avail_in is large enough (the\n   exact value depends on the compression method), inflateInit determines the\n   compression method from the zlib header and allocates all data structures\n   accordingly; otherwise the allocation will be deferred to the first call of\n   inflate.  If zalloc and zfree are set to Z_NULL, inflateInit updates them to\n   use default allocation functions.\n\n     inflateInit returns Z_OK if success, Z_MEM_ERROR if there was not enough\n   memory, Z_VERSION_ERROR if the zlib library version is incompatible with the\n   version assumed by the caller, or Z_STREAM_ERROR if the parameters are\n   invalid, such as a null pointer to the structure.  msg is set to null if\n   there is no error message.  inflateInit does not perform any decompression\n   apart from possibly reading the zlib header if present: actual decompression\n   will be done by inflate().  (So next_in and avail_in may be modified, but\n   next_out and avail_out are unused and unchanged.) The current implementation\n   of inflateInit() does not process any header information -- that is deferred\n   until inflate() is called.\n*/\n\n\nZEXTERN int ZEXPORT inflate OF((z_streamp strm, int flush));\n/*\n    inflate decompresses as much data as possible, and stops when the input\n  buffer becomes empty or the output buffer becomes full.  It may introduce\n  some output latency (reading input without producing any output) except when\n  forced to flush.\n\n  The detailed semantics are as follows.  inflate performs one or both of the\n  following actions:\n\n  - Decompress more input starting at next_in and update next_in and avail_in\n    accordingly.  If not all input can be processed (because there is not\n    enough room in the output buffer), next_in is updated and processing will\n    resume at this point for the next call of inflate().\n\n  - Provide more output starting at next_out and update next_out and avail_out\n    accordingly.  inflate() provides as much output as possible, until there is\n    no more input data or no more space in the output buffer (see below about\n    the flush parameter).\n\n    Before the call of inflate(), the application should ensure that at least\n  one of the actions is possible, by providing more input and/or consuming more\n  output, and updating the next_* and avail_* values accordingly.  The\n  application can consume the uncompressed output when it wants, for example\n  when the output buffer is full (avail_out == 0), or after each call of\n  inflate().  If inflate returns Z_OK and with zero avail_out, it must be\n  called again after making room in the output buffer because there might be\n  more output pending.\n\n    The flush parameter of inflate() can be Z_NO_FLUSH, Z_SYNC_FLUSH, Z_FINISH,\n  Z_BLOCK, or Z_TREES.  Z_SYNC_FLUSH requests that inflate() flush as much\n  output as possible to the output buffer.  Z_BLOCK requests that inflate()\n  stop if and when it gets to the next deflate block boundary.  When decoding\n  the zlib or gzip format, this will cause inflate() to return immediately\n  after the header and before the first block.  When doing a raw inflate,\n  inflate() will go ahead and process the first block, and will return when it\n  gets to the end of that block, or when it runs out of data.\n\n    The Z_BLOCK option assists in appending to or combining deflate streams.\n  Also to assist in this, on return inflate() will set strm->data_type to the\n  number of unused bits in the last byte taken from strm->next_in, plus 64 if\n  inflate() is currently decoding the last block in the deflate stream, plus\n  128 if inflate() returned immediately after decoding an end-of-block code or\n  decoding the complete header up to just before the first byte of the deflate\n  stream.  The end-of-block will not be indicated until all of the uncompressed\n  data from that block has been written to strm->next_out.  The number of\n  unused bits may in general be greater than seven, except when bit 7 of\n  data_type is set, in which case the number of unused bits will be less than\n  eight.  data_type is set as noted here every time inflate() returns for all\n  flush options, and so can be used to determine the amount of currently\n  consumed input in bits.\n\n    The Z_TREES option behaves as Z_BLOCK does, but it also returns when the\n  end of each deflate block header is reached, before any actual data in that\n  block is decoded.  This allows the caller to determine the length of the\n  deflate block header for later use in random access within a deflate block.\n  256 is added to the value of strm->data_type when inflate() returns\n  immediately after reaching the end of the deflate block header.\n\n    inflate() should normally be called until it returns Z_STREAM_END or an\n  error.  However if all decompression is to be performed in a single step (a\n  single call of inflate), the parameter flush should be set to Z_FINISH.  In\n  this case all pending input is processed and all pending output is flushed;\n  avail_out must be large enough to hold all the uncompressed data.  (The size\n  of the uncompressed data may have been saved by the compressor for this\n  purpose.) The next operation on this stream must be inflateEnd to deallocate\n  the decompression state.  The use of Z_FINISH is never required, but can be\n  used to inform inflate that a faster approach may be used for the single\n  inflate() call.\n\n     In this implementation, inflate() always flushes as much output as\n  possible to the output buffer, and always uses the faster approach on the\n  first call.  So the only effect of the flush parameter in this implementation\n  is on the return value of inflate(), as noted below, or when it returns early\n  because Z_BLOCK or Z_TREES is used.\n\n     If a preset dictionary is needed after this call (see inflateSetDictionary\n  below), inflate sets strm->adler to the adler32 checksum of the dictionary\n  chosen by the compressor and returns Z_NEED_DICT; otherwise it sets\n  strm->adler to the adler32 checksum of all output produced so far (that is,\n  total_out bytes) and returns Z_OK, Z_STREAM_END or an error code as described\n  below.  At the end of the stream, inflate() checks that its computed adler32\n  checksum is equal to that saved by the compressor and returns Z_STREAM_END\n  only if the checksum is correct.\n\n    inflate() can decompress and check either zlib-wrapped or gzip-wrapped\n  deflate data.  The header type is detected automatically, if requested when\n  initializing with inflateInit2().  Any information contained in the gzip\n  header is not retained, so applications that need that information should\n  instead use raw inflate, see inflateInit2() below, or inflateBack() and\n  perform their own processing of the gzip header and trailer.\n\n    inflate() returns Z_OK if some progress has been made (more input processed\n  or more output produced), Z_STREAM_END if the end of the compressed data has\n  been reached and all uncompressed output has been produced, Z_NEED_DICT if a\n  preset dictionary is needed at this point, Z_DATA_ERROR if the input data was\n  corrupted (input stream not conforming to the zlib format or incorrect check\n  value), Z_STREAM_ERROR if the stream structure was inconsistent (for example\n  next_in or next_out was Z_NULL), Z_MEM_ERROR if there was not enough memory,\n  Z_BUF_ERROR if no progress is possible or if there was not enough room in the\n  output buffer when Z_FINISH is used.  Note that Z_BUF_ERROR is not fatal, and\n  inflate() can be called again with more input and more output space to\n  continue decompressing.  If Z_DATA_ERROR is returned, the application may\n  then call inflateSync() to look for a good compression block if a partial\n  recovery of the data is desired.\n*/\n\n\nZEXTERN int ZEXPORT inflateEnd OF((z_streamp strm));\n/*\n     All dynamically allocated data structures for this stream are freed.\n   This function discards any unprocessed input and does not flush any pending\n   output.\n\n     inflateEnd returns Z_OK if success, Z_STREAM_ERROR if the stream state\n   was inconsistent.  In the error case, msg may be set but then points to a\n   static string (which must not be deallocated).\n*/\n\n\n                        /* Advanced functions */\n\n/*\n    The following functions are needed only in some special applications.\n*/\n\n/*\nZEXTERN int ZEXPORT deflateInit2 OF((z_streamp strm,\n                                     int  level,\n                                     int  method,\n                                     int  windowBits,\n                                     int  memLevel,\n                                     int  strategy));\n\n     This is another version of deflateInit with more compression options.  The\n   fields next_in, zalloc, zfree and opaque must be initialized before by the\n   caller.\n\n     The method parameter is the compression method.  It must be Z_DEFLATED in\n   this version of the library.\n\n     The windowBits parameter is the base two logarithm of the window size\n   (the size of the history buffer).  It should be in the range 8..15 for this\n   version of the library.  Larger values of this parameter result in better\n   compression at the expense of memory usage.  The default value is 15 if\n   deflateInit is used instead.\n\n     windowBits can also be -8..-15 for raw deflate.  In this case, -windowBits\n   determines the window size.  deflate() will then generate raw deflate data\n   with no zlib header or trailer, and will not compute an adler32 check value.\n\n     windowBits can also be greater than 15 for optional gzip encoding.  Add\n   16 to windowBits to write a simple gzip header and trailer around the\n   compressed data instead of a zlib wrapper.  The gzip header will have no\n   file name, no extra data, no comment, no modification time (set to zero), no\n   header crc, and the operating system will be set to 255 (unknown).  If a\n   gzip stream is being written, strm->adler is a crc32 instead of an adler32.\n\n     The memLevel parameter specifies how much memory should be allocated\n   for the internal compression state.  memLevel=1 uses minimum memory but is\n   slow and reduces compression ratio; memLevel=9 uses maximum memory for\n   optimal speed.  The default value is 8.  See zconf.h for total memory usage\n   as a function of windowBits and memLevel.\n\n     The strategy parameter is used to tune the compression algorithm.  Use the\n   value Z_DEFAULT_STRATEGY for normal data, Z_FILTERED for data produced by a\n   filter (or predictor), Z_HUFFMAN_ONLY to force Huffman encoding only (no\n   string match), or Z_RLE to limit match distances to one (run-length\n   encoding).  Filtered data consists mostly of small values with a somewhat\n   random distribution.  In this case, the compression algorithm is tuned to\n   compress them better.  The effect of Z_FILTERED is to force more Huffman\n   coding and less string matching; it is somewhat intermediate between\n   Z_DEFAULT_STRATEGY and Z_HUFFMAN_ONLY.  Z_RLE is designed to be almost as\n   fast as Z_HUFFMAN_ONLY, but give better compression for PNG image data.  The\n   strategy parameter only affects the compression ratio but not the\n   correctness of the compressed output even if it is not set appropriately.\n   Z_FIXED prevents the use of dynamic Huffman codes, allowing for a simpler\n   decoder for special applications.\n\n     deflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not enough\n   memory, Z_STREAM_ERROR if any parameter is invalid (such as an invalid\n   method), or Z_VERSION_ERROR if the zlib library version (zlib_version) is\n   incompatible with the version assumed by the caller (ZLIB_VERSION).  msg is\n   set to null if there is no error message.  deflateInit2 does not perform any\n   compression: this will be done by deflate().\n*/\n\nZEXTERN int ZEXPORT deflateSetDictionary OF((z_streamp strm,\n                                             const Bytef *dictionary,\n                                             uInt  dictLength));\n/*\n     Initializes the compression dictionary from the given byte sequence\n   without producing any compressed output.  This function must be called\n   immediately after deflateInit, deflateInit2 or deflateReset, before any call\n   of deflate.  The compressor and decompressor must use exactly the same\n   dictionary (see inflateSetDictionary).\n\n     The dictionary should consist of strings (byte sequences) that are likely\n   to be encountered later in the data to be compressed, with the most commonly\n   used strings preferably put towards the end of the dictionary.  Using a\n   dictionary is most useful when the data to be compressed is short and can be\n   predicted with good accuracy; the data can then be compressed better than\n   with the default empty dictionary.\n\n     Depending on the size of the compression data structures selected by\n   deflateInit or deflateInit2, a part of the dictionary may in effect be\n   discarded, for example if the dictionary is larger than the window size\n   provided in deflateInit or deflateInit2.  Thus the strings most likely to be\n   useful should be put at the end of the dictionary, not at the front.  In\n   addition, the current implementation of deflate will use at most the window\n   size minus 262 bytes of the provided dictionary.\n\n     Upon return of this function, strm->adler is set to the adler32 value\n   of the dictionary; the decompressor may later use this value to determine\n   which dictionary has been used by the compressor.  (The adler32 value\n   applies to the whole dictionary even if only a subset of the dictionary is\n   actually used by the compressor.) If a raw deflate was requested, then the\n   adler32 value is not computed and strm->adler is not set.\n\n     deflateSetDictionary returns Z_OK if success, or Z_STREAM_ERROR if a\n   parameter is invalid (e.g.  dictionary being Z_NULL) or the stream state is\n   inconsistent (for example if deflate has already been called for this stream\n   or if the compression method is bsort).  deflateSetDictionary does not\n   perform any compression: this will be done by deflate().\n*/\n\nZEXTERN int ZEXPORT deflateCopy OF((z_streamp dest,\n                                    z_streamp source));\n/*\n     Sets the destination stream as a complete copy of the source stream.\n\n     This function can be useful when several compression strategies will be\n   tried, for example when there are several ways of pre-processing the input\n   data with a filter.  The streams that will be discarded should then be freed\n   by calling deflateEnd.  Note that deflateCopy duplicates the internal\n   compression state which can be quite large, so this strategy is slow and can\n   consume lots of memory.\n\n     deflateCopy returns Z_OK if success, Z_MEM_ERROR if there was not\n   enough memory, Z_STREAM_ERROR if the source stream state was inconsistent\n   (such as zalloc being Z_NULL).  msg is left unchanged in both source and\n   destination.\n*/\n\nZEXTERN int ZEXPORT deflateReset OF((z_streamp strm));\n/*\n     This function is equivalent to deflateEnd followed by deflateInit,\n   but does not free and reallocate all the internal compression state.  The\n   stream will keep the same compression level and any other attributes that\n   may have been set by deflateInit2.\n\n     deflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source\n   stream state was inconsistent (such as zalloc or state being Z_NULL).\n*/\n\nZEXTERN int ZEXPORT deflateParams OF((z_streamp strm,\n                                      int level,\n                                      int strategy));\n/*\n     Dynamically update the compression level and compression strategy.  The\n   interpretation of level and strategy is as in deflateInit2.  This can be\n   used to switch between compression and straight copy of the input data, or\n   to switch to a different kind of input data requiring a different strategy.\n   If the compression level is changed, the input available so far is\n   compressed with the old level (and may be flushed); the new level will take\n   effect only at the next call of deflate().\n\n     Before the call of deflateParams, the stream state must be set as for\n   a call of deflate(), since the currently available input may have to be\n   compressed and flushed.  In particular, strm->avail_out must be non-zero.\n\n     deflateParams returns Z_OK if success, Z_STREAM_ERROR if the source\n   stream state was inconsistent or if a parameter was invalid, Z_BUF_ERROR if\n   strm->avail_out was zero.\n*/\n\nZEXTERN int ZEXPORT deflateTune OF((z_streamp strm,\n                                    int good_length,\n                                    int max_lazy,\n                                    int nice_length,\n                                    int max_chain));\n/*\n     Fine tune deflate's internal compression parameters.  This should only be\n   used by someone who understands the algorithm used by zlib's deflate for\n   searching for the best matching string, and even then only by the most\n   fanatic optimizer trying to squeeze out the last compressed bit for their\n   specific input data.  Read the deflate.c source code for the meaning of the\n   max_lazy, good_length, nice_length, and max_chain parameters.\n\n     deflateTune() can be called after deflateInit() or deflateInit2(), and\n   returns Z_OK on success, or Z_STREAM_ERROR for an invalid deflate stream.\n */\n\nZEXTERN uLong ZEXPORT deflateBound OF((z_streamp strm,\n                                       uLong sourceLen));\n/*\n     deflateBound() returns an upper bound on the compressed size after\n   deflation of sourceLen bytes.  It must be called after deflateInit() or\n   deflateInit2(), and after deflateSetHeader(), if used.  This would be used\n   to allocate an output buffer for deflation in a single pass, and so would be\n   called before deflate().\n*/\n\nZEXTERN int ZEXPORT deflatePrime OF((z_streamp strm,\n                                     int bits,\n                                     int value));\n/*\n     deflatePrime() inserts bits in the deflate output stream.  The intent\n   is that this function is used to start off the deflate output with the bits\n   leftover from a previous deflate stream when appending to it.  As such, this\n   function can only be used for raw deflate, and must be used before the first\n   deflate() call after a deflateInit2() or deflateReset().  bits must be less\n   than or equal to 16, and that many of the least significant bits of value\n   will be inserted in the output.\n\n     deflatePrime returns Z_OK if success, or Z_STREAM_ERROR if the source\n   stream state was inconsistent.\n*/\n\nZEXTERN int ZEXPORT deflateSetHeader OF((z_streamp strm,\n                                         gz_headerp head));\n/*\n     deflateSetHeader() provides gzip header information for when a gzip\n   stream is requested by deflateInit2().  deflateSetHeader() may be called\n   after deflateInit2() or deflateReset() and before the first call of\n   deflate().  The text, time, os, extra field, name, and comment information\n   in the provided gz_header structure are written to the gzip header (xflag is\n   ignored -- the extra flags are set according to the compression level).  The\n   caller must assure that, if not Z_NULL, name and comment are terminated with\n   a zero byte, and that if extra is not Z_NULL, that extra_len bytes are\n   available there.  If hcrc is true, a gzip header crc is included.  Note that\n   the current versions of the command-line version of gzip (up through version\n   1.3.x) do not support header crc's, and will report that it is a \"multi-part\n   gzip file\" and give up.\n\n     If deflateSetHeader is not used, the default gzip header has text false,\n   the time set to zero, and os set to 255, with no extra, name, or comment\n   fields.  The gzip header is returned to the default state by deflateReset().\n\n     deflateSetHeader returns Z_OK if success, or Z_STREAM_ERROR if the source\n   stream state was inconsistent.\n*/\n\n/*\nZEXTERN int ZEXPORT inflateInit2 OF((z_streamp strm,\n                                     int  windowBits));\n\n     This is another version of inflateInit with an extra parameter.  The\n   fields next_in, avail_in, zalloc, zfree and opaque must be initialized\n   before by the caller.\n\n     The windowBits parameter is the base two logarithm of the maximum window\n   size (the size of the history buffer).  It should be in the range 8..15 for\n   this version of the library.  The default value is 15 if inflateInit is used\n   instead.  windowBits must be greater than or equal to the windowBits value\n   provided to deflateInit2() while compressing, or it must be equal to 15 if\n   deflateInit2() was not used.  If a compressed stream with a larger window\n   size is given as input, inflate() will return with the error code\n   Z_DATA_ERROR instead of trying to allocate a larger window.\n\n     windowBits can also be zero to request that inflate use the window size in\n   the zlib header of the compressed stream.\n\n     windowBits can also be -8..-15 for raw inflate.  In this case, -windowBits\n   determines the window size.  inflate() will then process raw deflate data,\n   not looking for a zlib or gzip header, not generating a check value, and not\n   looking for any check values for comparison at the end of the stream.  This\n   is for use with other formats that use the deflate compressed data format\n   such as zip.  Those formats provide their own check values.  If a custom\n   format is developed using the raw deflate format for compressed data, it is\n   recommended that a check value such as an adler32 or a crc32 be applied to\n   the uncompressed data as is done in the zlib, gzip, and zip formats.  For\n   most applications, the zlib format should be used as is.  Note that comments\n   above on the use in deflateInit2() applies to the magnitude of windowBits.\n\n     windowBits can also be greater than 15 for optional gzip decoding.  Add\n   32 to windowBits to enable zlib and gzip decoding with automatic header\n   detection, or add 16 to decode only the gzip format (the zlib format will\n   return a Z_DATA_ERROR).  If a gzip stream is being decoded, strm->adler is a\n   crc32 instead of an adler32.\n\n     inflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not enough\n   memory, Z_VERSION_ERROR if the zlib library version is incompatible with the\n   version assumed by the caller, or Z_STREAM_ERROR if the parameters are\n   invalid, such as a null pointer to the structure.  msg is set to null if\n   there is no error message.  inflateInit2 does not perform any decompression\n   apart from possibly reading the zlib header if present: actual decompression\n   will be done by inflate().  (So next_in and avail_in may be modified, but\n   next_out and avail_out are unused and unchanged.) The current implementation\n   of inflateInit2() does not process any header information -- that is\n   deferred until inflate() is called.\n*/\n\nZEXTERN int ZEXPORT inflateSetDictionary OF((z_streamp strm,\n                                             const Bytef *dictionary,\n                                             uInt  dictLength));\n/*\n     Initializes the decompression dictionary from the given uncompressed byte\n   sequence.  This function must be called immediately after a call of inflate,\n   if that call returned Z_NEED_DICT.  The dictionary chosen by the compressor\n   can be determined from the adler32 value returned by that call of inflate.\n   The compressor and decompressor must use exactly the same dictionary (see\n   deflateSetDictionary).  For raw inflate, this function can be called\n   immediately after inflateInit2() or inflateReset() and before any call of\n   inflate() to set the dictionary.  The application must insure that the\n   dictionary that was used for compression is provided.\n\n     inflateSetDictionary returns Z_OK if success, Z_STREAM_ERROR if a\n   parameter is invalid (e.g.  dictionary being Z_NULL) or the stream state is\n   inconsistent, Z_DATA_ERROR if the given dictionary doesn't match the\n   expected one (incorrect adler32 value).  inflateSetDictionary does not\n   perform any decompression: this will be done by subsequent calls of\n   inflate().\n*/\n\nZEXTERN int ZEXPORT inflateSync OF((z_streamp strm));\n/*\n     Skips invalid compressed data until a full flush point (see above the\n   description of deflate with Z_FULL_FLUSH) can be found, or until all\n   available input is skipped.  No output is provided.\n\n     inflateSync returns Z_OK if a full flush point has been found, Z_BUF_ERROR\n   if no more input was provided, Z_DATA_ERROR if no flush point has been\n   found, or Z_STREAM_ERROR if the stream structure was inconsistent.  In the\n   success case, the application may save the current current value of total_in\n   which indicates where valid compressed data was found.  In the error case,\n   the application may repeatedly call inflateSync, providing more input each\n   time, until success or end of the input data.\n*/\n\nZEXTERN int ZEXPORT inflateCopy OF((z_streamp dest,\n                                    z_streamp source));\n/*\n     Sets the destination stream as a complete copy of the source stream.\n\n     This function can be useful when randomly accessing a large stream.  The\n   first pass through the stream can periodically record the inflate state,\n   allowing restarting inflate at those points when randomly accessing the\n   stream.\n\n     inflateCopy returns Z_OK if success, Z_MEM_ERROR if there was not\n   enough memory, Z_STREAM_ERROR if the source stream state was inconsistent\n   (such as zalloc being Z_NULL).  msg is left unchanged in both source and\n   destination.\n*/\n\nZEXTERN int ZEXPORT inflateReset OF((z_streamp strm));\n/*\n     This function is equivalent to inflateEnd followed by inflateInit,\n   but does not free and reallocate all the internal decompression state.  The\n   stream will keep attributes that may have been set by inflateInit2.\n\n     inflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source\n   stream state was inconsistent (such as zalloc or state being Z_NULL).\n*/\n\nZEXTERN int ZEXPORT inflateReset2 OF((z_streamp strm,\n                                      int windowBits));\n/*\n     This function is the same as inflateReset, but it also permits changing\n   the wrap and window size requests.  The windowBits parameter is interpreted\n   the same as it is for inflateInit2.\n\n     inflateReset2 returns Z_OK if success, or Z_STREAM_ERROR if the source\n   stream state was inconsistent (such as zalloc or state being Z_NULL), or if\n   the windowBits parameter is invalid.\n*/\n\nZEXTERN int ZEXPORT inflatePrime OF((z_streamp strm,\n                                     int bits,\n                                     int value));\n/*\n     This function inserts bits in the inflate input stream.  The intent is\n   that this function is used to start inflating at a bit position in the\n   middle of a byte.  The provided bits will be used before any bytes are used\n   from next_in.  This function should only be used with raw inflate, and\n   should be used before the first inflate() call after inflateInit2() or\n   inflateReset().  bits must be less than or equal to 16, and that many of the\n   least significant bits of value will be inserted in the input.\n\n     If bits is negative, then the input stream bit buffer is emptied.  Then\n   inflatePrime() can be called again to put bits in the buffer.  This is used\n   to clear out bits leftover after feeding inflate a block description prior\n   to feeding inflate codes.\n\n     inflatePrime returns Z_OK if success, or Z_STREAM_ERROR if the source\n   stream state was inconsistent.\n*/\n\nZEXTERN long ZEXPORT inflateMark OF((z_streamp strm));\n/*\n     This function returns two values, one in the lower 16 bits of the return\n   value, and the other in the remaining upper bits, obtained by shifting the\n   return value down 16 bits.  If the upper value is -1 and the lower value is\n   zero, then inflate() is currently decoding information outside of a block.\n   If the upper value is -1 and the lower value is non-zero, then inflate is in\n   the middle of a stored block, with the lower value equaling the number of\n   bytes from the input remaining to copy.  If the upper value is not -1, then\n   it is the number of bits back from the current bit position in the input of\n   the code (literal or length/distance pair) currently being processed.  In\n   that case the lower value is the number of bytes already emitted for that\n   code.\n\n     A code is being processed if inflate is waiting for more input to complete\n   decoding of the code, or if it has completed decoding but is waiting for\n   more output space to write the literal or match data.\n\n     inflateMark() is used to mark locations in the input data for random\n   access, which may be at bit positions, and to note those cases where the\n   output of a code may span boundaries of random access blocks.  The current\n   location in the input stream can be determined from avail_in and data_type\n   as noted in the description for the Z_BLOCK flush parameter for inflate.\n\n     inflateMark returns the value noted above or -1 << 16 if the provided\n   source stream state was inconsistent.\n*/\n\nZEXTERN int ZEXPORT inflateGetHeader OF((z_streamp strm,\n                                         gz_headerp head));\n/*\n     inflateGetHeader() requests that gzip header information be stored in the\n   provided gz_header structure.  inflateGetHeader() may be called after\n   inflateInit2() or inflateReset(), and before the first call of inflate().\n   As inflate() processes the gzip stream, head->done is zero until the header\n   is completed, at which time head->done is set to one.  If a zlib stream is\n   being decoded, then head->done is set to -1 to indicate that there will be\n   no gzip header information forthcoming.  Note that Z_BLOCK or Z_TREES can be\n   used to force inflate() to return immediately after header processing is\n   complete and before any actual data is decompressed.\n\n     The text, time, xflags, and os fields are filled in with the gzip header\n   contents.  hcrc is set to true if there is a header CRC.  (The header CRC\n   was valid if done is set to one.) If extra is not Z_NULL, then extra_max\n   contains the maximum number of bytes to write to extra.  Once done is true,\n   extra_len contains the actual extra field length, and extra contains the\n   extra field, or that field truncated if extra_max is less than extra_len.\n   If name is not Z_NULL, then up to name_max characters are written there,\n   terminated with a zero unless the length is greater than name_max.  If\n   comment is not Z_NULL, then up to comm_max characters are written there,\n   terminated with a zero unless the length is greater than comm_max.  When any\n   of extra, name, or comment are not Z_NULL and the respective field is not\n   present in the header, then that field is set to Z_NULL to signal its\n   absence.  This allows the use of deflateSetHeader() with the returned\n   structure to duplicate the header.  However if those fields are set to\n   allocated memory, then the application will need to save those pointers\n   elsewhere so that they can be eventually freed.\n\n     If inflateGetHeader is not used, then the header information is simply\n   discarded.  The header is always checked for validity, including the header\n   CRC if present.  inflateReset() will reset the process to discard the header\n   information.  The application would need to call inflateGetHeader() again to\n   retrieve the header from the next gzip stream.\n\n     inflateGetHeader returns Z_OK if success, or Z_STREAM_ERROR if the source\n   stream state was inconsistent.\n*/\n\n/*\nZEXTERN int ZEXPORT inflateBackInit OF((z_streamp strm, int windowBits,\n                                        unsigned char FAR *window));\n\n     Initialize the internal stream state for decompression using inflateBack()\n   calls.  The fields zalloc, zfree and opaque in strm must be initialized\n   before the call.  If zalloc and zfree are Z_NULL, then the default library-\n   derived memory allocation routines are used.  windowBits is the base two\n   logarithm of the window size, in the range 8..15.  window is a caller\n   supplied buffer of that size.  Except for special applications where it is\n   assured that deflate was used with small window sizes, windowBits must be 15\n   and a 32K byte window must be supplied to be able to decompress general\n   deflate streams.\n\n     See inflateBack() for the usage of these routines.\n\n     inflateBackInit will return Z_OK on success, Z_STREAM_ERROR if any of\n   the paramaters are invalid, Z_MEM_ERROR if the internal state could not be\n   allocated, or Z_VERSION_ERROR if the version of the library does not match\n   the version of the header file.\n*/\n\ntypedef unsigned (*in_func) OF((void FAR *, unsigned char FAR * FAR *));\ntypedef int (*out_func) OF((void FAR *, unsigned char FAR *, unsigned));\n\nZEXTERN int ZEXPORT inflateBack OF((z_streamp strm,\n                                    in_func in, void FAR *in_desc,\n                                    out_func out, void FAR *out_desc));\n/*\n     inflateBack() does a raw inflate with a single call using a call-back\n   interface for input and output.  This is more efficient than inflate() for\n   file i/o applications in that it avoids copying between the output and the\n   sliding window by simply making the window itself the output buffer.  This\n   function trusts the application to not change the output buffer passed by\n   the output function, at least until inflateBack() returns.\n\n     inflateBackInit() must be called first to allocate the internal state\n   and to initialize the state with the user-provided window buffer.\n   inflateBack() may then be used multiple times to inflate a complete, raw\n   deflate stream with each call.  inflateBackEnd() is then called to free the\n   allocated state.\n\n     A raw deflate stream is one with no zlib or gzip header or trailer.\n   This routine would normally be used in a utility that reads zip or gzip\n   files and writes out uncompressed files.  The utility would decode the\n   header and process the trailer on its own, hence this routine expects only\n   the raw deflate stream to decompress.  This is different from the normal\n   behavior of inflate(), which expects either a zlib or gzip header and\n   trailer around the deflate stream.\n\n     inflateBack() uses two subroutines supplied by the caller that are then\n   called by inflateBack() for input and output.  inflateBack() calls those\n   routines until it reads a complete deflate stream and writes out all of the\n   uncompressed data, or until it encounters an error.  The function's\n   parameters and return types are defined above in the in_func and out_func\n   typedefs.  inflateBack() will call in(in_desc, &buf) which should return the\n   number of bytes of provided input, and a pointer to that input in buf.  If\n   there is no input available, in() must return zero--buf is ignored in that\n   case--and inflateBack() will return a buffer error.  inflateBack() will call\n   out(out_desc, buf, len) to write the uncompressed data buf[0..len-1].  out()\n   should return zero on success, or non-zero on failure.  If out() returns\n   non-zero, inflateBack() will return with an error.  Neither in() nor out()\n   are permitted to change the contents of the window provided to\n   inflateBackInit(), which is also the buffer that out() uses to write from.\n   The length written by out() will be at most the window size.  Any non-zero\n   amount of input may be provided by in().\n\n     For convenience, inflateBack() can be provided input on the first call by\n   setting strm->next_in and strm->avail_in.  If that input is exhausted, then\n   in() will be called.  Therefore strm->next_in must be initialized before\n   calling inflateBack().  If strm->next_in is Z_NULL, then in() will be called\n   immediately for input.  If strm->next_in is not Z_NULL, then strm->avail_in\n   must also be initialized, and then if strm->avail_in is not zero, input will\n   initially be taken from strm->next_in[0 ..  strm->avail_in - 1].\n\n     The in_desc and out_desc parameters of inflateBack() is passed as the\n   first parameter of in() and out() respectively when they are called.  These\n   descriptors can be optionally used to pass any information that the caller-\n   supplied in() and out() functions need to do their job.\n\n     On return, inflateBack() will set strm->next_in and strm->avail_in to\n   pass back any unused input that was provided by the last in() call.  The\n   return values of inflateBack() can be Z_STREAM_END on success, Z_BUF_ERROR\n   if in() or out() returned an error, Z_DATA_ERROR if there was a format error\n   in the deflate stream (in which case strm->msg is set to indicate the nature\n   of the error), or Z_STREAM_ERROR if the stream was not properly initialized.\n   In the case of Z_BUF_ERROR, an input or output error can be distinguished\n   using strm->next_in which will be Z_NULL only if in() returned an error.  If\n   strm->next_in is not Z_NULL, then the Z_BUF_ERROR was due to out() returning\n   non-zero.  (in() will always be called before out(), so strm->next_in is\n   assured to be defined if out() returns non-zero.) Note that inflateBack()\n   cannot return Z_OK.\n*/\n\nZEXTERN int ZEXPORT inflateBackEnd OF((z_streamp strm));\n/*\n     All memory allocated by inflateBackInit() is freed.\n\n     inflateBackEnd() returns Z_OK on success, or Z_STREAM_ERROR if the stream\n   state was inconsistent.\n*/\n\nZEXTERN uLong ZEXPORT zlibCompileFlags OF((void));\n/* Return flags indicating compile-time options.\n\n    Type sizes, two bits each, 00 = 16 bits, 01 = 32, 10 = 64, 11 = other:\n     1.0: size of uInt\n     3.2: size of uLong\n     5.4: size of voidpf (pointer)\n     7.6: size of z_off_t\n\n    Compiler, assembler, and debug options:\n     8: DEBUG\n     9: ASMV or ASMINF -- use ASM code\n     10: ZLIB_WINAPI -- exported functions use the WINAPI calling convention\n     11: 0 (reserved)\n\n    One-time table building (smaller code, but not thread-safe if true):\n     12: BUILDFIXED -- build static block decoding tables when needed\n     13: DYNAMIC_CRC_TABLE -- build CRC calculation tables when needed\n     14,15: 0 (reserved)\n\n    Library content (indicates missing functionality):\n     16: NO_GZCOMPRESS -- gz* functions cannot compress (to avoid linking\n                          deflate code when not needed)\n     17: NO_GZIP -- deflate can't write gzip streams, and inflate can't detect\n                    and decode gzip streams (to avoid linking crc code)\n     18-19: 0 (reserved)\n\n    Operation variations (changes in library functionality):\n     20: PKZIP_BUG_WORKAROUND -- slightly more permissive inflate\n     21: FASTEST -- deflate algorithm with only one, lowest compression level\n     22,23: 0 (reserved)\n\n    The sprintf variant used by gzprintf (zero is best):\n     24: 0 = vs*, 1 = s* -- 1 means limited to 20 arguments after the format\n     25: 0 = *nprintf, 1 = *printf -- 1 means gzprintf() not secure!\n     26: 0 = returns value, 1 = void -- 1 means inferred string length returned\n\n    Remainder:\n     27-31: 0 (reserved)\n */\n\n\n                        /* utility functions */\n\n/*\n     The following utility functions are implemented on top of the basic\n   stream-oriented functions.  To simplify the interface, some default options\n   are assumed (compression level and memory usage, standard memory allocation\n   functions).  The source code of these utility functions can be modified if\n   you need special options.\n*/\n\nZEXTERN int ZEXPORT compress OF((Bytef *dest,   uLongf *destLen,\n                                 const Bytef *source, uLong sourceLen));\n/*\n     Compresses the source buffer into the destination buffer.  sourceLen is\n   the byte length of the source buffer.  Upon entry, destLen is the total size\n   of the destination buffer, which must be at least the value returned by\n   compressBound(sourceLen).  Upon exit, destLen is the actual size of the\n   compressed buffer.\n\n     compress returns Z_OK if success, Z_MEM_ERROR if there was not\n   enough memory, Z_BUF_ERROR if there was not enough room in the output\n   buffer.\n*/\n\nZEXTERN int ZEXPORT compress2 OF((Bytef *dest,   uLongf *destLen,\n                                  const Bytef *source, uLong sourceLen,\n                                  int level));\n/*\n     Compresses the source buffer into the destination buffer.  The level\n   parameter has the same meaning as in deflateInit.  sourceLen is the byte\n   length of the source buffer.  Upon entry, destLen is the total size of the\n   destination buffer, which must be at least the value returned by\n   compressBound(sourceLen).  Upon exit, destLen is the actual size of the\n   compressed buffer.\n\n     compress2 returns Z_OK if success, Z_MEM_ERROR if there was not enough\n   memory, Z_BUF_ERROR if there was not enough room in the output buffer,\n   Z_STREAM_ERROR if the level parameter is invalid.\n*/\n\nZEXTERN uLong ZEXPORT compressBound OF((uLong sourceLen));\n/*\n     compressBound() returns an upper bound on the compressed size after\n   compress() or compress2() on sourceLen bytes.  It would be used before a\n   compress() or compress2() call to allocate the destination buffer.\n*/\n\nZEXTERN int ZEXPORT uncompress OF((Bytef *dest,   uLongf *destLen,\n                                   const Bytef *source, uLong sourceLen));\n/*\n     Decompresses the source buffer into the destination buffer.  sourceLen is\n   the byte length of the source buffer.  Upon entry, destLen is the total size\n   of the destination buffer, which must be large enough to hold the entire\n   uncompressed data.  (The size of the uncompressed data must have been saved\n   previously by the compressor and transmitted to the decompressor by some\n   mechanism outside the scope of this compression library.) Upon exit, destLen\n   is the actual size of the uncompressed buffer.\n\n     uncompress returns Z_OK if success, Z_MEM_ERROR if there was not\n   enough memory, Z_BUF_ERROR if there was not enough room in the output\n   buffer, or Z_DATA_ERROR if the input data was corrupted or incomplete.\n*/\n\n\n                        /* gzip file access functions */\n\n/*\n     This library supports reading and writing files in gzip (.gz) format with\n   an interface similar to that of stdio, using the functions that start with\n   \"gz\".  The gzip format is different from the zlib format.  gzip is a gzip\n   wrapper, documented in RFC 1952, wrapped around a deflate stream.\n*/\n\ntypedef voidp gzFile;       /* opaque gzip file descriptor */\n\n/*\nZEXTERN gzFile ZEXPORT gzopen OF((const char *path, const char *mode));\n\n     Opens a gzip (.gz) file for reading or writing.  The mode parameter is as\n   in fopen (\"rb\" or \"wb\") but can also include a compression level (\"wb9\") or\n   a strategy: 'f' for filtered data as in \"wb6f\", 'h' for Huffman-only\n   compression as in \"wb1h\", 'R' for run-length encoding as in \"wb1R\", or 'F'\n   for fixed code compression as in \"wb9F\".  (See the description of\n   deflateInit2 for more information about the strategy parameter.) Also \"a\"\n   can be used instead of \"w\" to request that the gzip stream that will be\n   written be appended to the file.  \"+\" will result in an error, since reading\n   and writing to the same gzip file is not supported.\n\n     gzopen can be used to read a file which is not in gzip format; in this\n   case gzread will directly read from the file without decompression.\n\n     gzopen returns NULL if the file could not be opened, if there was\n   insufficient memory to allocate the gzFile state, or if an invalid mode was\n   specified (an 'r', 'w', or 'a' was not provided, or '+' was provided).\n   errno can be checked to determine if the reason gzopen failed was that the\n   file could not be opened.\n*/\n\nZEXTERN gzFile ZEXPORT gzdopen OF((int fd, const char *mode));\n/*\n     gzdopen associates a gzFile with the file descriptor fd.  File descriptors\n   are obtained from calls like open, dup, creat, pipe or fileno (if the file\n   has been previously opened with fopen).  The mode parameter is as in gzopen.\n\n     The next call of gzclose on the returned gzFile will also close the file\n   descriptor fd, just like fclose(fdopen(fd, mode)) closes the file descriptor\n   fd.  If you want to keep fd open, use fd = dup(fd_keep); gz = gzdopen(fd,\n   mode);.  The duplicated descriptor should be saved to avoid a leak, since\n   gzdopen does not close fd if it fails.\n\n     gzdopen returns NULL if there was insufficient memory to allocate the\n   gzFile state, if an invalid mode was specified (an 'r', 'w', or 'a' was not\n   provided, or '+' was provided), or if fd is -1.  The file descriptor is not\n   used until the next gz* read, write, seek, or close operation, so gzdopen\n   will not detect if fd is invalid (unless fd is -1).\n*/\n\nZEXTERN int ZEXPORT gzbuffer OF((gzFile file, unsigned size));\n/*\n     Set the internal buffer size used by this library's functions.  The\n   default buffer size is 8192 bytes.  This function must be called after\n   gzopen() or gzdopen(), and before any other calls that read or write the\n   file.  The buffer memory allocation is always deferred to the first read or\n   write.  Two buffers are allocated, either both of the specified size when\n   writing, or one of the specified size and the other twice that size when\n   reading.  A larger buffer size of, for example, 64K or 128K bytes will\n   noticeably increase the speed of decompression (reading).\n\n     The new buffer size also affects the maximum length for gzprintf().\n\n     gzbuffer() returns 0 on success, or -1 on failure, such as being called\n   too late.\n*/\n\nZEXTERN int ZEXPORT gzsetparams OF((gzFile file, int level, int strategy));\n/*\n     Dynamically update the compression level or strategy.  See the description\n   of deflateInit2 for the meaning of these parameters.\n\n     gzsetparams returns Z_OK if success, or Z_STREAM_ERROR if the file was not\n   opened for writing.\n*/\n\nZEXTERN int ZEXPORT gzread OF((gzFile file, voidp buf, unsigned len));\n/*\n     Reads the given number of uncompressed bytes from the compressed file.  If\n   the input file was not in gzip format, gzread copies the given number of\n   bytes into the buffer.\n\n     After reaching the end of a gzip stream in the input, gzread will continue\n   to read, looking for another gzip stream, or failing that, reading the rest\n   of the input file directly without decompression.  The entire input file\n   will be read if gzread is called until it returns less than the requested\n   len.\n\n     gzread returns the number of uncompressed bytes actually read, less than\n   len for end of file, or -1 for error.\n*/\n\nZEXTERN int ZEXPORT gzwrite OF((gzFile file,\n                                voidpc buf, unsigned len));\n/*\n     Writes the given number of uncompressed bytes into the compressed file.\n   gzwrite returns the number of uncompressed bytes written or 0 in case of\n   error.\n*/\n\nZEXTERN int ZEXPORTVA gzprintf OF((gzFile file, const char *format, ...));\n/*\n     Converts, formats, and writes the arguments to the compressed file under\n   control of the format string, as in fprintf.  gzprintf returns the number of\n   uncompressed bytes actually written, or 0 in case of error.  The number of\n   uncompressed bytes written is limited to 8191, or one less than the buffer\n   size given to gzbuffer().  The caller should assure that this limit is not\n   exceeded.  If it is exceeded, then gzprintf() will return an error (0) with\n   nothing written.  In this case, there may also be a buffer overflow with\n   unpredictable consequences, which is possible only if zlib was compiled with\n   the insecure functions sprintf() or vsprintf() because the secure snprintf()\n   or vsnprintf() functions were not available.  This can be determined using\n   zlibCompileFlags().\n*/\n\nZEXTERN int ZEXPORT gzputs OF((gzFile file, const char *s));\n/*\n     Writes the given null-terminated string to the compressed file, excluding\n   the terminating null character.\n\n     gzputs returns the number of characters written, or -1 in case of error.\n*/\n\nZEXTERN char * ZEXPORT gzgets OF((gzFile file, char *buf, int len));\n/*\n     Reads bytes from the compressed file until len-1 characters are read, or a\n   newline character is read and transferred to buf, or an end-of-file\n   condition is encountered.  If any characters are read or if len == 1, the\n   string is terminated with a null character.  If no characters are read due\n   to an end-of-file or len < 1, then the buffer is left untouched.\n\n     gzgets returns buf which is a null-terminated string, or it returns NULL\n   for end-of-file or in case of error.  If there was an error, the contents at\n   buf are indeterminate.\n*/\n\nZEXTERN int ZEXPORT gzputc OF((gzFile file, int c));\n/*\n     Writes c, converted to an unsigned char, into the compressed file.  gzputc\n   returns the value that was written, or -1 in case of error.\n*/\n\nZEXTERN int ZEXPORT gzgetc OF((gzFile file));\n/*\n     Reads one byte from the compressed file.  gzgetc returns this byte or -1\n   in case of end of file or error.\n*/\n\nZEXTERN int ZEXPORT gzungetc OF((int c, gzFile file));\n/*\n     Push one character back onto the stream to be read as the first character\n   on the next read.  At least one character of push-back is allowed.\n   gzungetc() returns the character pushed, or -1 on failure.  gzungetc() will\n   fail if c is -1, and may fail if a character has been pushed but not read\n   yet.  If gzungetc is used immediately after gzopen or gzdopen, at least the\n   output buffer size of pushed characters is allowed.  (See gzbuffer above.)\n   The pushed character will be discarded if the stream is repositioned with\n   gzseek() or gzrewind().\n*/\n\nZEXTERN int ZEXPORT gzflush OF((gzFile file, int flush));\n/*\n     Flushes all pending output into the compressed file.  The parameter flush\n   is as in the deflate() function.  The return value is the zlib error number\n   (see function gzerror below).  gzflush is only permitted when writing.\n\n     If the flush parameter is Z_FINISH, the remaining data is written and the\n   gzip stream is completed in the output.  If gzwrite() is called again, a new\n   gzip stream will be started in the output.  gzread() is able to read such\n   concatented gzip streams.\n\n     gzflush should be called only when strictly necessary because it will\n   degrade compression if called too often.\n*/\n\n/*\nZEXTERN z_off_t ZEXPORT gzseek OF((gzFile file,\n                                   z_off_t offset, int whence));\n\n     Sets the starting position for the next gzread or gzwrite on the given\n   compressed file.  The offset represents a number of bytes in the\n   uncompressed data stream.  The whence parameter is defined as in lseek(2);\n   the value SEEK_END is not supported.\n\n     If the file is opened for reading, this function is emulated but can be\n   extremely slow.  If the file is opened for writing, only forward seeks are\n   supported; gzseek then compresses a sequence of zeroes up to the new\n   starting position.\n\n     gzseek returns the resulting offset location as measured in bytes from\n   the beginning of the uncompressed stream, or -1 in case of error, in\n   particular if the file is opened for writing and the new starting position\n   would be before the current position.\n*/\n\nZEXTERN int ZEXPORT    gzrewind OF((gzFile file));\n/*\n     Rewinds the given file. This function is supported only for reading.\n\n     gzrewind(file) is equivalent to (int)gzseek(file, 0L, SEEK_SET)\n*/\n\n/*\nZEXTERN z_off_t ZEXPORT    gztell OF((gzFile file));\n\n     Returns the starting position for the next gzread or gzwrite on the given\n   compressed file.  This position represents a number of bytes in the\n   uncompressed data stream, and is zero when starting, even if appending or\n   reading a gzip stream from the middle of a file using gzdopen().\n\n     gztell(file) is equivalent to gzseek(file, 0L, SEEK_CUR)\n*/\n\n/*\nZEXTERN z_off_t ZEXPORT gzoffset OF((gzFile file));\n\n     Returns the current offset in the file being read or written.  This offset\n   includes the count of bytes that precede the gzip stream, for example when\n   appending or when using gzdopen() for reading.  When reading, the offset\n   does not include as yet unused buffered input.  This information can be used\n   for a progress indicator.  On error, gzoffset() returns -1.\n*/\n\nZEXTERN int ZEXPORT gzeof OF((gzFile file));\n/*\n     Returns true (1) if the end-of-file indicator has been set while reading,\n   false (0) otherwise.  Note that the end-of-file indicator is set only if the\n   read tried to go past the end of the input, but came up short.  Therefore,\n   just like feof(), gzeof() may return false even if there is no more data to\n   read, in the event that the last read request was for the exact number of\n   bytes remaining in the input file.  This will happen if the input file size\n   is an exact multiple of the buffer size.\n\n     If gzeof() returns true, then the read functions will return no more data,\n   unless the end-of-file indicator is reset by gzclearerr() and the input file\n   has grown since the previous end of file was detected.\n*/\n\nZEXTERN int ZEXPORT gzdirect OF((gzFile file));\n/*\n     Returns true (1) if file is being copied directly while reading, or false\n   (0) if file is a gzip stream being decompressed.  This state can change from\n   false to true while reading the input file if the end of a gzip stream is\n   reached, but is followed by data that is not another gzip stream.\n\n     If the input file is empty, gzdirect() will return true, since the input\n   does not contain a gzip stream.\n\n     If gzdirect() is used immediately after gzopen() or gzdopen() it will\n   cause buffers to be allocated to allow reading the file to determine if it\n   is a gzip file.  Therefore if gzbuffer() is used, it should be called before\n   gzdirect().\n*/\n\nZEXTERN int ZEXPORT    gzclose OF((gzFile file));\n/*\n     Flushes all pending output if necessary, closes the compressed file and\n   deallocates the (de)compression state.  Note that once file is closed, you\n   cannot call gzerror with file, since its structures have been deallocated.\n   gzclose must not be called more than once on the same file, just as free\n   must not be called more than once on the same allocation.\n\n     gzclose will return Z_STREAM_ERROR if file is not valid, Z_ERRNO on a\n   file operation error, or Z_OK on success.\n*/\n\nZEXTERN int ZEXPORT gzclose_r OF((gzFile file));\nZEXTERN int ZEXPORT gzclose_w OF((gzFile file));\n/*\n     Same as gzclose(), but gzclose_r() is only for use when reading, and\n   gzclose_w() is only for use when writing or appending.  The advantage to\n   using these instead of gzclose() is that they avoid linking in zlib\n   compression or decompression code that is not used when only reading or only\n   writing respectively.  If gzclose() is used, then both compression and\n   decompression code will be included the application when linking to a static\n   zlib library.\n*/\n\nZEXTERN const char * ZEXPORT gzerror OF((gzFile file, int *errnum));\n/*\n     Returns the error message for the last error which occurred on the given\n   compressed file.  errnum is set to zlib error number.  If an error occurred\n   in the file system and not in the compression library, errnum is set to\n   Z_ERRNO and the application may consult errno to get the exact error code.\n\n     The application must not modify the returned string.  Future calls to\n   this function may invalidate the previously returned string.  If file is\n   closed, then the string previously returned by gzerror will no longer be\n   available.\n\n     gzerror() should be used to distinguish errors from end-of-file for those\n   functions above that do not distinguish those cases in their return values.\n*/\n\nZEXTERN void ZEXPORT gzclearerr OF((gzFile file));\n/*\n     Clears the error and end-of-file flags for file.  This is analogous to the\n   clearerr() function in stdio.  This is useful for continuing to read a gzip\n   file that is being written concurrently.\n*/\n\n\n                        /* checksum functions */\n\n/*\n     These functions are not related to compression but are exported\n   anyway because they might be useful in applications using the compression\n   library.\n*/\n\nZEXTERN uLong ZEXPORT adler32 OF((uLong adler, const Bytef *buf, uInt len));\n/*\n     Update a running Adler-32 checksum with the bytes buf[0..len-1] and\n   return the updated checksum.  If buf is Z_NULL, this function returns the\n   required initial value for the checksum.\n\n     An Adler-32 checksum is almost as reliable as a CRC32 but can be computed\n   much faster.\n\n   Usage example:\n\n     uLong adler = adler32(0L, Z_NULL, 0);\n\n     while (read_buffer(buffer, length) != EOF) {\n       adler = adler32(adler, buffer, length);\n     }\n     if (adler != original_adler) error();\n*/\n\n/*\nZEXTERN uLong ZEXPORT adler32_combine OF((uLong adler1, uLong adler2,\n                                          z_off_t len2));\n\n     Combine two Adler-32 checksums into one.  For two sequences of bytes, seq1\n   and seq2 with lengths len1 and len2, Adler-32 checksums were calculated for\n   each, adler1 and adler2.  adler32_combine() returns the Adler-32 checksum of\n   seq1 and seq2 concatenated, requiring only adler1, adler2, and len2.\n*/\n\nZEXTERN uLong ZEXPORT crc32   OF((uLong crc, const Bytef *buf, uInt len));\n/*\n     Update a running CRC-32 with the bytes buf[0..len-1] and return the\n   updated CRC-32.  If buf is Z_NULL, this function returns the required\n   initial value for the for the crc.  Pre- and post-conditioning (one's\n   complement) is performed within this function so it shouldn't be done by the\n   application.\n\n   Usage example:\n\n     uLong crc = crc32(0L, Z_NULL, 0);\n\n     while (read_buffer(buffer, length) != EOF) {\n       crc = crc32(crc, buffer, length);\n     }\n     if (crc != original_crc) error();\n*/\n\n/*\nZEXTERN uLong ZEXPORT crc32_combine OF((uLong crc1, uLong crc2, z_off_t len2));\n\n     Combine two CRC-32 check values into one.  For two sequences of bytes,\n   seq1 and seq2 with lengths len1 and len2, CRC-32 check values were\n   calculated for each, crc1 and crc2.  crc32_combine() returns the CRC-32\n   check value of seq1 and seq2 concatenated, requiring only crc1, crc2, and\n   len2.\n*/\n\n\n                        /* various hacks, don't look :) */\n\n/* deflateInit and inflateInit are macros to allow checking the zlib version\n * and the compiler's view of z_stream:\n */\nZEXTERN int ZEXPORT deflateInit_ OF((z_streamp strm, int level,\n                                     const char *version, int stream_size));\nZEXTERN int ZEXPORT inflateInit_ OF((z_streamp strm,\n                                     const char *version, int stream_size));\nZEXTERN int ZEXPORT deflateInit2_ OF((z_streamp strm, int  level, int  method,\n                                      int windowBits, int memLevel,\n                                      int strategy, const char *version,\n                                      int stream_size));\nZEXTERN int ZEXPORT inflateInit2_ OF((z_streamp strm, int  windowBits,\n                                      const char *version, int stream_size));\nZEXTERN int ZEXPORT inflateBackInit_ OF((z_streamp strm, int windowBits,\n                                         unsigned char FAR *window,\n                                         const char *version,\n                                         int stream_size));\n#define deflateInit(strm, level) \\\n        deflateInit_((strm), (level),       ZLIB_VERSION, sizeof(z_stream))\n#define inflateInit(strm) \\\n        inflateInit_((strm),                ZLIB_VERSION, sizeof(z_stream))\n#define deflateInit2(strm, level, method, windowBits, memLevel, strategy) \\\n        deflateInit2_((strm),(level),(method),(windowBits),(memLevel),\\\n                      (strategy),           ZLIB_VERSION, sizeof(z_stream))\n#define inflateInit2(strm, windowBits) \\\n        inflateInit2_((strm), (windowBits), ZLIB_VERSION, sizeof(z_stream))\n#define inflateBackInit(strm, windowBits, window) \\\n        inflateBackInit_((strm), (windowBits), (window), \\\n                                            ZLIB_VERSION, sizeof(z_stream))\n\n/* provide 64-bit offset functions if _LARGEFILE64_SOURCE defined, and/or\n * change the regular functions to 64 bits if _FILE_OFFSET_BITS is 64 (if\n * both are true, the application gets the *64 functions, and the regular\n * functions are changed to 64 bits) -- in case these are set on systems\n * without large file support, _LFS64_LARGEFILE must also be true\n */\n#if defined(_LARGEFILE64_SOURCE) && _LFS64_LARGEFILE-0\n   ZEXTERN gzFile ZEXPORT gzopen64 OF((const char *, const char *));\n   ZEXTERN z_off64_t ZEXPORT gzseek64 OF((gzFile, z_off64_t, int));\n   ZEXTERN z_off64_t ZEXPORT gztell64 OF((gzFile));\n   ZEXTERN z_off64_t ZEXPORT gzoffset64 OF((gzFile));\n   ZEXTERN uLong ZEXPORT adler32_combine64 OF((uLong, uLong, z_off64_t));\n   ZEXTERN uLong ZEXPORT crc32_combine64 OF((uLong, uLong, z_off64_t));\n#endif\n\n#if !defined(ZLIB_INTERNAL) && _FILE_OFFSET_BITS-0 == 64 && _LFS64_LARGEFILE-0\n#  define gzopen gzopen64\n#  define gzseek gzseek64\n#  define gztell gztell64\n#  define gzoffset gzoffset64\n#  define adler32_combine adler32_combine64\n#  define crc32_combine crc32_combine64\n#  ifdef _LARGEFILE64_SOURCE\n     ZEXTERN gzFile ZEXPORT gzopen64 OF((const char *, const char *));\n     ZEXTERN z_off_t ZEXPORT gzseek64 OF((gzFile, z_off_t, int));\n     ZEXTERN z_off_t ZEXPORT gztell64 OF((gzFile));\n     ZEXTERN z_off_t ZEXPORT gzoffset64 OF((gzFile));\n     ZEXTERN uLong ZEXPORT adler32_combine64 OF((uLong, uLong, z_off_t));\n     ZEXTERN uLong ZEXPORT crc32_combine64 OF((uLong, uLong, z_off_t));\n#  endif\n#else\n   ZEXTERN gzFile ZEXPORT gzopen OF((const char *, const char *));\n   ZEXTERN z_off_t ZEXPORT gzseek OF((gzFile, z_off_t, int));\n   ZEXTERN z_off_t ZEXPORT gztell OF((gzFile));\n   ZEXTERN z_off_t ZEXPORT gzoffset OF((gzFile));\n   ZEXTERN uLong ZEXPORT adler32_combine OF((uLong, uLong, z_off_t));\n   ZEXTERN uLong ZEXPORT crc32_combine OF((uLong, uLong, z_off_t));\n#endif\n\n/* hack for buggy compilers */\n#if !defined(ZUTIL_H) && !defined(NO_DUMMY_DECL)\n    struct internal_state {int dummy;};\n#endif\n\n/* undocumented functions */\nZEXTERN const char   * ZEXPORT zError           OF((int));\nZEXTERN int            ZEXPORT inflateSyncPoint OF((z_streamp));\nZEXTERN const uLongf * ZEXPORT get_crc_table    OF((void));\nZEXTERN int            ZEXPORT inflateUndermine OF((z_streamp, int));\n\n#ifdef __cplusplus\n}\n#endif\n\n#endif /* ZLIB_H */\n"
  },
  {
    "path": "gdb_stub/Makefile",
    "content": "all: payload.bin payload-kek.bin gdbstub.bin gdbstub-int.bin gdbstub-obj.o gdbstub-obj-redir.o gdbstub-obj-nosysc.o\n\nclean:\n\trm -f payload.elf payload.bin payload-kek.elf payload-kek.bin gdbstub.elf gdbstub.bin gdbstub-int.elf gdbstub-int.bin gdbstub-obj.o gdbstub-obj-redir.o r0hooks.o gdbstub-obj-ring0.o gdbstub-obj-nosysc.o\n\n../lib/lib.a:\n\tcd ../lib; make\n\npayload.elf: ../lib/lib.a dbg.c main.c\n\tgcc -g -isystem ../freebsd-headers -nostdinc -nostdlib -fno-stack-protector -fPIE -ffreestanding -static ../lib/lib.a -D__PS4__ -DINTERRUPTER_THREAD dbg.c main.c -o payload.elf\n\npayload.bin: payload.elf\n\tobjcopy payload.elf --only-section .text --only-section .data --only-section .bss --only-section .rodata --set-section-flags .bss=alloc,load,contents -O binary payload.bin\n\tfile payload.bin | fgrep -q 'payload.bin: DOS executable (COM)'\n\npayload-kek.elf: ../lib/lib.a dbg.c main.c ps4libs.c\n\tgcc -g -isystem ../freebsd-headers -nostdinc -nostdlib -fno-stack-protector -fPIE -ffreestanding -static ../lib/lib-elf-ps5.a -D__PS4__ -DINTERRUPTER_THREAD -DNO_BREAKPOINT_EMULATION -DPS5KEK -DPS4LIBS dbg.c main.c ps4libs.c -o payload-kek.elf -Wl,-z,max-page-size=16384 -Wl,-zcommon-page-size=16384\n\npayload-kek.bin: payload-kek.elf\n\tobjcopy payload-kek.elf --only-section .text --only-section .data --only-section .bss --only-section .rodata --set-section-flags .bss=alloc,load,contents -O binary payload-kek.bin\n\tpython3 ../lib/frankenelf.py payload-kek.bin\n\ngdbstub.elf: ../lib/lib.a dbg.c _end.c\n\tgcc -g -isystem ../freebsd-headers -nostdinc -nostdlib -fno-stack-protector -fPIE -ffreestanding -static ../lib/lib.a -D__PS4__ -Ddbg_enter=main -DBLOB dbg.c _end.c -Wl,-gc-sections -o gdbstub.elf\n\ngdbstub.bin: gdbstub.elf\n\tobjcopy gdbstub.elf --only-section .text --only-section .data --only-section .bss --only-section .rodata --set-section-flags .bss=alloc,load,contents -O binary gdbstub.bin\n\tfile gdbstub.bin | fgrep -q 'gdbstub.bin: DOS executable (COM)'\n\ngdbstub-int.elf: ../lib/lib.a dbg.c _end.c\n\tgcc -g -isystem ../freebsd-headers -nostdinc -nostdlib -fno-stack-protector -fPIE -ffreestanding -static ../lib/lib.a -D__PS4__ -Ddbg_enter=main -DBLOB -DINTERRUPTER_THREAD dbg.c _end.c -Wl,-gc-sections -o gdbstub-int.elf\n\ngdbstub-int.bin: gdbstub-int.elf\n\tobjcopy gdbstub-int.elf --only-section .text --only-section .data --only-section .bss --only-section .rodata --set-section-flags .bss=alloc,load,contents -O binary gdbstub-int.bin\n\tfile gdbstub-int.bin | fgrep -q 'gdbstub-int.bin: DOS executable (COM)'\n\n#gdbstub-lib.elf: ../lib/lib.a dbg.c ps4libs.c _end.c\n#\tgcc -g -isystem ../freebsd-headers -nostdinc -nostdlib -fno-stack-protector -fPIE -ffreestanding -static ../lib/lib.a -D__PS4__ -Ddbg_enter=main -DBLOB -DINTERRUPTER_THREAD -DPS4LIBS dbg.c ps4libs.c _end.c -Wl,-gc-sections -o gdbstub-lib.elf\n\n#gdbstub-lib.bin: gdbstub-lib.elf\n#\tobjcopy gdbstub-lib.elf --only-section .text --only-section .data --only-section .bss --only-section .rodata --set-section-flags .bss=alloc,load,contents -O binary gdbstub-lib.bin\n#\tfile gdbstub-lib.bin | fgrep -q 'gdbstub-lib.bin: DOS executable (COM)'\n\n#gdbstub-lib-redir.elf: ../lib/lib.a dbg.c ps4libs.c _end.c\n#\tgcc -g -isystem ../freebsd-headers -nostdinc -nostdlib -fno-stack-protector -fPIE -ffreestanding -static ../lib/lib.a -D__PS4__ -Ddbg_enter=main -DBLOB -DINTERRUPTER_THREAD -DPS4LIBS -DSTDIO_REDIRECT dbg.c ps4libs.c _end.c -Wl,-gc-sections -o gdbstub-lib-redir.elf\n\n#gdbstub-lib-redir.bin: gdbstub-lib-redir.elf\n#\tobjcopy gdbstub-lib-redir.elf --only-section .text --only-section .data --only-section .bss --only-section .rodata --set-section-flags .bss=alloc,load,contents -O binary gdbstub-lib-redir.bin\n#\tfile gdbstub-lib-redir.bin | fgrep -q 'gdbstub-lib-redir.bin: DOS executable (COM)'\n\ngdbstub-obj.o: ../lib/lib.a dbg.c ps4libs.c _end.c\n\tgcc -g -isystem ../freebsd-headers -nostdinc -nostdlib -fno-stack-protector -fPIE -ffreestanding -static ../lib/lib.a -D__PS4__ -Ddbg_enter=main -DOBJECT_FILE -DINTERRUPTER_THREAD -DPS4LIBS dbg.c ps4libs.c _end.c -Wl,--entry,_start -Wl,-r -Wl,-gc-sections -o $@\n\tobjcopy --prefix-symbols=gdbstub_ $@\n\tobjcopy --redefine-sym gdbstub__start=dbg_enter --redefine-sym gdbstub__GLOBAL_OFFSET_TABLE_=_GLOBAL_OFFSET_TABLE_ $@\n\ngdbstub-obj-redir.o: ../lib/lib.a dbg.c ps4libs.c _end.c\n\tgcc -g -isystem ../freebsd-headers -nostdinc -nostdlib -fno-stack-protector -fPIE -ffreestanding -static ../lib/lib.a -D__PS4__ -Ddbg_enter=main -DOBJECT_FILE -DINTERRUPTER_THREAD -DPS4LIBS -DSTDIO_REDIRECT dbg.c ps4libs.c _end.c -Wl,--entry,_start -Wl,-r -Wl,-gc-sections -o $@\n\tobjcopy --prefix-symbols=gdbstub_ $@\n\tobjcopy --redefine-sym gdbstub__start=dbg_enter --redefine-sym gdbstub__GLOBAL_OFFSET_TABLE_=_GLOBAL_OFFSET_TABLE_ $@\n\ngdbstub-obj-nosysc.o: dbg.c\n\tgcc -g -isystem ../freebsd-headers -nostdinc -nostdlib -fno-stack-protector -fPIE -ffreestanding -static -D__PS4__ -DOBJECT_FILE -DINTERRUPTER_THREAD -DNO_BREAKPOINT_EMULATION dbg.c -Wl,--entry,dbg_enter -Wl,-r -Wl,-gc-sections -o $@\n\n#gdbstub-obj-ring0.o: ../lib/lib.a dbg.c ps4libs.c main.c ring0.c r0hooks.o\n#\tgcc -g -isystem ../freebsd-headers -nostdinc -nostdlib -fno-stack-protector -fPIE -ffreestanding -mno-red-zone -static ../lib/lib.a -D__PS4__ -Ddbg_enter=main -DOBJECT_FILE -DINTERRUPTER_THREAD -DPS4LIBS dbg.c ps4libs.c ring0.c r0hooks.o -Wl,--entry,_start -Wl,-r -Wl,-gc-sections -o $@\n#\tobjcopy --prefix-symbols=gdbstub_ $@\n#\tobjcopy --redefine-sym gdbstub__start=dbg_enter --redefine-sym gdbstub__GLOBAL_OFFSET_TABLE_=_GLOBAL_OFFSET_TABLE_ $@\n\n#r0hooks.o: r0hooks.asm\n#\tyasm -f elf64 r0hooks.asm -o r0hooks.o\n\n#strace_asm.o: strace_asm.asm\n#\tyasm -f elf64 strace_asm.asm -o strace_asm.o\n"
  },
  {
    "path": "gdb_stub/_end.c",
    "content": "char _end[0] = {};\n"
  },
  {
    "path": "gdb_stub/dbg.c",
    "content": "#ifdef __PS4__\n#define _BSD_SOURCE\n//extern int errno;\n#ifdef PS5KEK\nstatic int errno = 1;\n#define errno not_errno\n#define pthread_t not_pthread_t\n#include <sys/thr.h>\n#else\n#include <pthread.h>\n#endif\n#include <machine/sysarch.h>\n#else\n#define _GNU_SOURCE\n#include <pthread.h>\n#include <asm/prctl.h>\n#endif\n#include <sys/types.h>\n#include <sys/socket.h>\n#include <netinet/in.h>\n#include <netinet/tcp.h>\n#include <unistd.h>\n#include <fcntl.h>\n#include <sys/ucontext.h>\n#include <signal.h>\n#include <errno.h>\n#include <sys/mman.h>\n#include <stdarg.h>\n#include \"dbg.h\"\n#include \"trap_state.h\"\n\n#ifdef __PS4__\n#ifdef PS5KEK\n#undef errno\n#undef pthread_t\n#endif\n#define PAGE_SIZE 16384ull\n#else\n#define PAGE_SIZE 4096ull\n#endif\n\nstatic int hex2int(char c)\n{\n    if(c >= 'a' && c <= 'f')\n        return c - 'a' + 10;\n    else if(c >= 'A' && c <= 'F')\n        return c - 'A' + 10;\n    else\n        return c - '0';\n}\n\nstatic char int2hex(int c)\n{\n    if(c >= 10)\n        return c + 'A' - 10;\n    else\n        return c + '0';\n}\n\nstatic int gdb_socket, pipe_r, pipe_w;\n\ntypedef unsigned char pkt_opaque[1];\n\nstatic int wait_for_packet(pkt_opaque o)\n{\n    unsigned char c = 0;\n    while(c != '$')\n        if(read(gdb_socket, &c, 1) != 1)\n            return -1;\n    o[0] = 0;\n    return 0;\n}\n\nstatic int pkt_getchar(pkt_opaque o)\n{\n    unsigned char c;\n    if(read(gdb_socket, &c, 1) != 1)\n        return -1;\n    if(c == '#')\n    {\n        unsigned char cc[2];\n        if(read(gdb_socket, cc, 1) != 1 || read(gdb_socket, cc+1, 1) != 1)\n            return -1;\n        int cs = hex2int(cc[0]) << 4 | hex2int(cc[1]);\n        if(cs != o[0])\n            return -1;\n        unsigned char ack = '+';\n        if(write(gdb_socket, &ack, 1) != 1)\n            return -1;\n        return -2;\n    }\n    o[0] += c;\n    return c;\n}\n\nstatic int skip_to_end(pkt_opaque o)\n{\n    int q;\n    do\n    {\n        if((q = pkt_getchar(o)) == -1)\n            return -1;\n    }\n    while(q != -2);\n    return 0;\n}\n\n#ifdef PKT_NO_BUFFERING\n\nstatic int start_packet(pkt_opaque o)\n{\n    unsigned char c = '$';\n    if(write(gdb_socket, &c, 1) != 1)\n        return -1;\n    o[0] = 0;\n    return 0;\n}\n\nstatic int pkt_puts(pkt_opaque o, const unsigned char* s, int l)\n{\n    const unsigned char* cur = s;\n    int ll = l;\n    while(ll)\n    {\n        int chk = write(gdb_socket, cur, ll);\n        if(chk <= 0)\n            return -1;\n        cur += chk;\n        ll -= chk;\n    }\n    for(int i = 0; i < l; i++)\n        o[0] += s[i];\n    return 0;\n}\n\nstatic int end_packet(pkt_opaque o)\n{\n    unsigned char c[3] = {'#', int2hex(o[0] >> 4), int2hex(o[0] & 15)};\n    if(pkt_puts(o, c, 3))\n        return -1;\n    unsigned char ack;\n    if(read(gdb_socket, &ack, 1) != 1 || ack != '+')\n        return -1;\n    return 0;\n}\n\n#else\n\nstatic unsigned char* pkt_buf = 0;\nsize_t pkt_len = 0;\nsize_t pkt_cap = 0;\n\nstatic int start_packet(pkt_opaque o)\n{\n    if(!pkt_cap)\n    {\n        pkt_buf = mmap(NULL, PAGE_SIZE, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0);\n        pkt_cap = PAGE_SIZE;\n    }\n    pkt_buf[0] = '$';\n    pkt_len = 1;\n    o[0] = 0;\n    return 0;\n}\n\nstatic int pkt_puts(pkt_opaque o, const unsigned char* s, int l)\n{\n    size_t pkt_cap_2 = pkt_cap;\n    while(pkt_len + l > pkt_cap_2)\n        pkt_cap_2 <<= 1;\n    if(pkt_cap_2 != pkt_cap)\n    {\n        unsigned char* pkt_buf_2 = mmap(NULL, pkt_cap_2, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0);\n        for(size_t i = 0; i < pkt_len; i++)\n            pkt_buf_2[i] = pkt_buf[i];\n        munmap(pkt_buf, pkt_cap);\n        pkt_buf = pkt_buf_2;\n        pkt_cap = pkt_cap_2;\n    }\n    for(int i = 0; i < l; i++)\n    {\n        pkt_buf[pkt_len++] = s[i];\n        o[0] += s[i];\n    }\n    return 0;\n}\n\nstatic int end_packet(pkt_opaque o)\n{\n    unsigned char c[3] = {'#', int2hex(o[0] >> 4), int2hex(o[0] & 15)};\n    if(pkt_puts(o, c, 3))\n        return -1;\n    unsigned char* p = pkt_buf;\n    size_t sz = pkt_len;\n    while(sz > 0)\n    {\n        ssize_t chk = write(gdb_socket, p, sz);\n        if(chk <= 0)\n            return -1;\n        sz -= chk;\n        p += chk;\n    }\n    unsigned char ack;\n    if(read(gdb_socket, &ack, 1) != 1 || ack != '+')\n        return -1;\n    return 0;\n}\n\n#endif\n\n#define PKT_PUTS(o, s) pkt_puts(o, s, sizeof(s)-1)\n\nstatic const char* commands[] = {\n// must be sorted\n    \"?\",\n    \"F\",\n    \"G\",\n    \"H\",\n    \"M\",\n#ifndef NO_BREAKPOINT_EMULATION\n    \"Z\",\n#endif\n    \"c\",\n    \"g\",\n    \"k\",\n    \"m\",\n    \"qAttached\",\n#ifdef __PS4__\n    \"qOffsets\",\n#endif\n    \"qSupported:\",\n#ifdef __PS4__\n    \"qXfer:exec-file:read:\",\n#endif\n    \"qXfer:features:read:target.xml:\",\n#if defined(__PS4__) && defined(PS4LIBS)\n    \"qXfer:libraries-svr4:read:\",\n#endif\n    \"s\",\n    \"z\",\n};\n\n#ifdef __PS4__\nextern char _start[];\n\n#ifndef OBJECT_FILE\nstatic void reloc_commands()\n{\n    static unsigned long long start_nonreloc = (unsigned long long)_start;\n    unsigned long long diff = ((unsigned long long)_start) - start_nonreloc;\n    for(int i = 0; i < sizeof(commands) / sizeof(commands[0]); i++)\n        commands[i] += diff;\n}\n\n#ifdef BLOB\nextern char _end[];\n\nstatic void mprotect_rwx()\n{\n    unsigned long long start = (unsigned long long)_start;\n    unsigned long long end = (unsigned long long)_end;\n    start &= ~(PAGE_SIZE-1);\n    end = ((end - 1) | (PAGE_SIZE-1)) + 1;\n    mprotect((void*)start, end-start, PROT_READ|PROT_WRITE|PROT_EXEC);\n}\n#endif\n#endif\n#endif\n\nenum\n{\n    CMD_EOL = -3,\n    CMD_ERROR = -2,\n    CMD_UNKNOWN = -1,\n// indexes into `commands`\n    CMD_Q,\n    CMD_F,\n    CMD_G_WRITE,\n    CMD_H,\n    CMD_M_WRITE,\n#ifndef NO_BREAKPOINT_EMULATION\n    CMD_Z_SET,\n#endif\n    CMD_C,\n    CMD_G_READ,\n    CMD_K,\n    CMD_M_READ,\n    CMD_Q_ATTACHED,\n#ifdef __PS4__\n    CMD_Q_OFFSETS,\n#endif\n    CMD_Q_SUPPORTED,\n#ifdef __PS4__\n    CMD_QXFER_EXEC_FILE,\n#endif\n    CMD_QXFER_TARGET_XML,\n#if defined(__PS4__) && defined(PS4LIBS)\n    CMD_QXFER_LIBRARIES,\n#endif\n    CMD_S,\n    CMD_Z_UNSET,\n};\n\nstatic int match_packet(pkt_opaque o)\n{\n    int start = 0;\n    int end = sizeof(commands) / sizeof(commands[0]);\n    int idx = 0;\n    for(;;)\n    {\n        if(!commands[start][idx]) // found a match\n            return start;\n        int c = pkt_getchar(o);\n        if(c == -1)\n            return CMD_ERROR;\n        if(c == -2)\n            return CMD_EOL;\n        int l = start - 1;\n        int r = end - 1;\n        while(r - l > 1)\n        {\n            int m = (r + l + 1) / 2;\n            if(commands[m][idx] < c)\n                l = m; \n            else\n                r = m;\n        }\n        start = l + 1;\n        l = start;\n        r = end;\n        while(r - l > 1)\n        {\n            int m = (r + l) / 2;\n            if(commands[m][idx] > c)\n                r = m;\n            else\n                l = m;\n        }\n        end = r;\n        if(commands[start][idx] != c)\n            return CMD_UNKNOWN; // no match\n        idx++;\n    }\n    //unreached\n}\n\nstatic int read_hex(pkt_opaque o, unsigned long long* q)\n{\n    *q = 0;\n    for(;;)\n    {\n        int c = pkt_getchar(o);\n        if((c >= '0' && c <= '9') || (c >= 'A' && c <= 'F') || (c >= 'a' && c <= 'f'))\n            *q = (*q << 4) | hex2int(c);\n        else\n            return c;\n    }\n}\n\nstatic int read_signed_hex(pkt_opaque o, long long* q)\n{\n    unsigned long long qq;\n    int c = read_hex(o, &qq);\n    if(qq == 0 && c == '-')\n    {\n        c = read_hex(o, &qq);\n        *q = -qq;\n    }\n    else\n        *q = qq;\n    return c;\n}\n\nint read_mem(unsigned char* buf, unsigned long long addr, int sz)\n#ifdef MEM_HELPERS\n    ;\n#else\n{\n    if(write(pipe_w, (const void*)addr, sz) != sz)\n        return -errno;\n    read(pipe_r, buf, sz);\n    return 0;\n}\n#endif\n\nstatic void mprotect_byte(unsigned long long addr)\n{\n    mprotect((void*)(addr &~ (PAGE_SIZE - 1)), PAGE_SIZE, PROT_READ|PROT_WRITE|PROT_EXEC);\n}\n\n#if 0 //def __PS4__\n\nint do_kexec_pk_read(void* a, void** b, int(**c)(void*, void*))\n{\n    asm volatile(\"cli\\nmov %%cr0, %%rax\\nbtc $16, %%rax\\nmov %%rax, %%cr0\":::\"rax\");\n    int ans = c[-47](a, b[1]);\n    asm volatile(\"mov %%cr0, %%rax\\nbts $16, %%rax\\nmov %%rax, %%cr0\\nsti\":::\"rax\");\n    return ans;\n}\n\nasm(\"kexec_pk_read:\\nmov %rax, %rdx\\njmp do_kexec_pk_read\");\n\nextern char kexec_pk_read[];\nint kexec(void*, void*);\n\nssize_t pk_read(int fd, void* data, size_t sz)\n{\n    if((intptr_t)data < 0)\n    {\n        uintptr_t args[3] = {fd, (uintptr_t)data, sz};\n        return kexec(kexec_pk_read, args);\n    }\n    return read(fd, data, sz);\n}\n\n#else\n#define pk_read read\n#endif\n\nstatic int write_mem(const unsigned char* buf, unsigned long long addr, int sz)\n#ifdef MEM_HELPERS\n    ;\n#else\n{\n    write(pipe_w, buf, sz);\n    if(pk_read(pipe_r, (void*)addr, sz) != sz)\n    {\n        if(errno == EFAULT && sz == 1 && buf[0] == 0xcc) // sw breakpoint\n        {\n            mprotect_byte(addr);\n            if(pk_read(pipe_r, (void*)addr, 1) == 1)\n                return 0;\n        }\n        int ans = -errno;\n        char c;\n        for(int i = 0; i < sz; i++)\n            read(pipe_r, &c, 1);\n        return ans;\n    }\n    return 0;\n}\n#endif\n\nvoid serve_string(pkt_opaque o, char* s, unsigned long long l, int has_annex)\n{\n    unsigned long long annex, start, len;\n    if(has_annex)\n        read_hex(o, &annex);\n    read_hex(o, &start);\n    read_hex(o, &len);\n    if(start > l)\n        start = l;\n    if(len > l || start + len > l)\n        len = l - start;\n    start_packet(o);\n    if(len == 0)\n        PKT_PUTS(o, \"l\");\n    else\n    {\n        PKT_PUTS(o, \"m\");\n        pkt_puts(o, s+start, len);\n    }\n    end_packet(o);\n}\n\ntypedef struct srv_opaque\n{\n    unsigned long long offset;\n    unsigned long long len;\n    int nonempty;\n} srv_opaque[1];\n\nvoid serve_genfn_start(pkt_opaque o, srv_opaque p, int has_annex)\n{\n    unsigned long long annex, start, len;\n    if(has_annex)\n        read_hex(o, &annex);\n    read_hex(o, &start);\n    read_hex(o, &len);\n    start_packet(o);\n    p->offset = start;\n    p->len = len;\n    p->nonempty = 0;\n}\n\nint serve_genfn_emit(pkt_opaque o, srv_opaque p, char* data, unsigned long long len)\n{\n    if(p->offset >= len)\n    {\n        p->offset -= len;\n        return 0;\n    }\n    else\n    {\n        data += p->offset;\n        len -= p->offset;\n        p->offset = 0;\n        if(len > p->len)\n            len = p->len;\n        if(len)\n        {\n            if(!p->nonempty)\n            {\n                p->nonempty = 1;\n                PKT_PUTS(o, \"m\");\n            }\n            pkt_puts(o, data, len);\n        }\n        p->len -= len;\n        return 1;\n    }\n}\n\nvoid serve_genfn_end(pkt_opaque o, srv_opaque p)\n{\n    if(!p->nonempty)\n        PKT_PUTS(o, \"l\");\n    end_packet(o);\n}\n\n#if defined(__PS4__) && defined(PS4LIBS)\nvoid list_libs(pkt_opaque o);\n#endif\n\n#define NEMUBREAK 64\n\nstatic int break_flags[NEMUBREAK];\nstatic uintptr_t break_addr[NEMUBREAK];\n\nstatic inline int have_breakpoint(uintptr_t addr)\n{\n    for(int i = 0; i < NEMUBREAK; i++)\n        if(break_flags[i] && break_addr[i] == addr)\n            return 1;\n    return 0;\n}\n\nstatic inline int set_breakpoint(uintptr_t addr)\n{\n    for(int i = 0; i < NEMUBREAK; i++)\n        if(break_flags[i] && break_addr[i] == addr)\n        {\n            break_flags[i]++;\n            return 1;\n        }\n    for(int i = 0; i < NEMUBREAK; i++)\n        if(!break_flags[i])\n        {\n            break_addr[i] = addr;\n            break_flags[i] = 1;\n            return 1;\n        }\n    return 0;\n}\n\nstatic inline int remove_breakpoint(uintptr_t addr)\n{\n    for(int i = 0; i < NEMUBREAK; i++)\n        if(break_flags[i] && break_addr[i] == addr)\n        {\n            break_flags[i]--;\n            return 1;\n        }\n    return 0;\n}\n\nstatic inline int any_breakpoints(void)\n{\n    for(int i = 0; i < NEMUBREAK; i++)\n        if(break_flags[i])\n            return 1;\n    return 0;\n}\n\nint gdbstub_main_loop(struct trap_state* ts, ssize_t* result, int* ern)\n{\n    static int cont_mode = 0;\n    if(cont_mode && !have_breakpoint(ts->regs.rip))\n    {\n        ts->regs.eflags |= 256;\n        return 0;\n    }\n    cont_mode = 0;\n    pkt_opaque o;\n    int stop_sig = ts->trap_signal?ts->trap_signal:SIGTRAP;\n    char stop_reason[3] = {'T', int2hex(stop_sig >> 4), int2hex(stop_sig & 15)};\n    if(ts->trap_signal)\n    {\n        start_packet(o);\n        pkt_puts(o, stop_reason, 3);\n        end_packet(o);\n    }\n    for(;;)\n    {\n        wait_for_packet(o);\n        switch(match_packet(o))\n        {\n        case CMD_Q:\n        {\n            skip_to_end(o);\n            start_packet(o);\n            pkt_puts(o, stop_reason, 3);\n            end_packet(o);\n            break;\n        }\n        case CMD_Q_SUPPORTED:\n            skip_to_end(o);\n            start_packet(o);\n            PKT_PUTS(o, \"qXfer:features:read+\"\n#ifdef __PS4__\n#if !defined(BLOB) && !defined(OBJECT_FILE)\n            \";qXfer:exec-file:read+\"\n#endif\n#ifdef PS4LIBS\n            \";qXfer:libraries-svr4:read+\"\n#endif\n#endif\n            );\n            end_packet(o);\n            break;\n        case CMD_QXFER_TARGET_XML:\n            serve_string(o, \"<?xml version=\\\"1.0\\\"?>\\n<!DOCTYPE target SYSTEM \\\"gdb-target.dtd\\\">\\n<target>\\n<architecture>i386:x86-64</architecture>\\n<osabi>GNU/Linux</osabi>\\n</target>\\n\", 149, 0);\n            break;\n        case CMD_H:\n            skip_to_end(o);\n            start_packet(o);\n            PKT_PUTS(o, \"OK\");\n            end_packet(o);\n            break;\n        case CMD_G_READ: // read gp regs\n        {\n            skip_to_end(o);\n            unsigned char* regs = (unsigned char*)&ts->regs;\n            char buf1[2 * sizeof(ts->regs)];\n            char buf2[2 * (560 - sizeof(ts->regs))];\n            for(int i = 0; i < sizeof(ts->regs); i++)\n            {\n                buf1[2*i] = int2hex(regs[i] >> 4);\n                buf1[2*i+1] = int2hex(regs[i] & 15);\n            }\n            for(int i = 0; i < sizeof(buf2); i++)\n                buf2[i] = 'x';\n            start_packet(o);\n            pkt_puts(o, buf1, sizeof(buf1));\n            pkt_puts(o, buf2, sizeof(buf2));\n            end_packet(o);\n            break;\n        }\n        case CMD_G_WRITE: // write gp regs\n        {\n            unsigned char* regs = (unsigned char*)&ts->regs;\n            for(int i = 0; i < sizeof(ts->regs); i++)\n            {\n                int a = hex2int(pkt_getchar(o));\n                int b = hex2int(pkt_getchar(o));\n                regs[i] = a << 4 | b;\n            }\n            skip_to_end(o);\n            start_packet(o);\n            PKT_PUTS(o, \"OK\");\n            end_packet(o);\n            break;\n        }\n        case CMD_M_READ: // read memory\n        {\n            unsigned char buf1[32], buf2[64];\n            unsigned long long addr, size;\n            read_hex(o, &addr);\n            read_hex(o, &size);\n            if(addr == 0xdeadbeefdeadbeefull)\n                break; // no answer, this is intentional\n            start_packet(o);\n            while(size > 0)\n            {\n                int chk = (size > 32 ? 32 : size);\n                if(read_mem(buf1, addr, chk))\n                    break;\n                for(int i = 0; i < chk; i++)\n                {\n                    buf2[2*i] = int2hex(buf1[i] >> 4);\n                    buf2[2*i+1] = int2hex(buf1[i] & 15);\n                }\n                pkt_puts(o, buf2, 2*chk);\n                addr += chk;\n                size -= chk;\n            }\n            end_packet(o);\n            break;\n        }\n        case CMD_M_WRITE: // write memory\n        {\n            unsigned char buf[32];\n            unsigned long long addr, size;\n            read_hex(o, &addr);\n            read_hex(o, &size);\n            int e = 0;\n            while(size > 0)\n            {\n                int chk = (size > 32 ? 32 : size);\n                for(int i = 0; i < chk; i++)\n                {\n                    int a = hex2int(pkt_getchar(o));\n                    int b = hex2int(pkt_getchar(o));\n                    buf[i] = a << 4 | b;\n                }\n                e = write_mem(buf, addr, chk);\n                if(e)\n                    break;\n                addr += chk;\n                size -= chk;\n            }\n            skip_to_end(o);\n            start_packet(o);\n            if(e)\n            {\n                e = -e;\n                char qq[3] = {'E', int2hex((e >> 4) & 15), int2hex(e & 15)};\n                pkt_puts(o, qq, 3);\n            }\n            else\n                PKT_PUTS(o, \"OK\");\n            end_packet(o);\n            break;\n        }\n        case CMD_S: // singlestep\n            ts->regs.eflags |= 256;\n        case CMD_C: // continue\n            skip_to_end(o);\n            start_packet(o);\n            PKT_PUTS(o, \"OK\");\n            end_packet(o);\n            if(any_breakpoints())\n            {\n                if(!(ts->regs.eflags & 256))\n                    cont_mode = 1;\n                ts->regs.eflags |= 256;\n            }\n            return 0;\n        case CMD_Q_ATTACHED:\n            skip_to_end(o);\n            start_packet(o);\n            PKT_PUTS(o, \"0\");\n            end_packet(o);\n            break;\n#ifdef __PS4__\n#if !defined(BLOB) && !defined(OBJECT_FILE) // TODO: implement (how?)\n        case CMD_QXFER_EXEC_FILE:\n            serve_string(o, \"payload.elf\", 11, 1);\n            break;\n#endif\n        case CMD_Q_OFFSETS:\n        {\n            skip_to_end(o);\n            start_packet(o);\n            unsigned long long base_addr = ((unsigned long long)_start);\n            static unsigned long long start_nonreloc = (unsigned long long)_start;\n#if defined(BLOB) || defined(OBJECT_FILE)\n            base_addr &= ~(PAGE_SIZE-1);\n            char probe;\n            while(!read_mem(&probe, base_addr, 1))\n                base_addr -= PAGE_SIZE;\n            base_addr += PAGE_SIZE;\n#else\n            base_addr -= (start_nonreloc - 0x400000);\n#endif\n            char buf[24] = \"TextSeg=\";\n            for(int i = 15; i >= 0; i--)\n                buf[23-i] = int2hex((base_addr >> (4*i)) & 15);\n            pkt_puts(o, buf, 24);\n            end_packet(o);\n            break;\n        }\n#ifdef PS4LIBS\n        case CMD_QXFER_LIBRARIES:\n            list_libs(o);\n            break;\n#endif\n#endif\n        case CMD_F:\n        {\n            long long q;\n            unsigned long long ern1 = 0;\n            int eof = 0;\n            int ctrlc = 0;\n            int status = read_signed_hex(o, &q);\n            if(status == -2)\n                eof = 1;\n            if(status == ',')\n            {\n                status = read_signed_hex(o, &ern1);\n                if(status == -2)\n                    eof = 1;\n                if(status == ',')\n                {\n                    status = pkt_getchar(o);\n                    if(status == -2)\n                        eof = 1;\n                    if(status == 'C')\n                        ctrlc = 1;\n                }\n            }\n            if(!eof)\n                skip_to_end(o);\n            if(result)\n                *result = q;\n            if(ern)\n                *ern = ern1;\n            return ctrlc + 1;\n        }\n        case CMD_K:\n            skip_to_end(o);\n            start_packet(o);\n            end_packet(o);\n            kill(getpid(), SIGKILL);\n#ifndef NO_BREAKPOINT_EMULATION\n        case CMD_Z_SET:\n        {\n            unsigned long long q = -1;\n            unsigned long long addr = -1;\n            read_hex(o, &q);\n            read_hex(o, &addr);\n            skip_to_end(o);\n            start_packet(o);\n            if(q == 0 && set_breakpoint(addr))\n                PKT_PUTS(o, \"OK\");\n            end_packet(o);\n            break;\n        }\n#endif\n        case CMD_Z_UNSET:\n        {\n            unsigned long long q = -1;\n            unsigned long long addr = -1;\n            read_hex(o, &q);\n            read_hex(o, &addr);\n            skip_to_end(o);\n            start_packet(o);\n            if(q == 0 && remove_breakpoint(addr))\n                PKT_PUTS(o, \"OK\");\n            end_packet(o);\n            break;\n        }\n        default:\n            skip_to_end(o);\n        case CMD_EOL:\n            start_packet(o);\n            end_packet(o);\n            break;\n        }\n    }\n}\n\nint in_signal_handler = 0;\n\n#if defined(INTERRUPTER_THREAD) || defined(STDIO_REDIRECT)\n\n#ifdef PS5KEK\n// mock code, to make main code cleaner\n// not \"real\" pthreads\n\ntypedef long pthread_t;\n\nint pthread_create(long* p_tid, void* _2, void* f, void* arg)\n{\n    long x, y;\n    static char* stack;\n    static char* stack2;\n    static char* tls;\n    if(!stack)\n        stack = mmap(NULL, 65536, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0);\n    if(!stack2)\n        stack2 = mmap(NULL, 65536, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0);\n    if(!tls)\n    {\n        tls = mmap(NULL, 65536, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0);\n        *(uint64_t*)(tls+16) = (uint64_t)tls;\n    }\n    struct thr_param param = {\n        .start_func = (void(*)(void*))f,\n        .arg = arg,\n        .stack_base = arg ? stack2 : stack,\n        .stack_size = 65536,\n        .tls_base = tls, //needed so that __error() works\n        .tls_size = 0,\n        .child_tid = &x,\n        .parent_tid = p_tid,\n        .flags = 0,\n        .rtp = NULL,\n    };\n    return thr_new(&param, sizeof(param));\n}\n\nlong pthread_self()\n{\n    long ans = 0;\n    thr_self(&ans);\n    return ans;\n}\n\n#define pthread_kill thr_kill\n#define pthread_detach(...)\n#endif\n\n#endif\n\n#ifdef INTERRUPTER_THREAD\n\nvoid block_sigint(void)\n{\n#ifdef __PS4__\n    sigset_t ss = {0};\n\tss.__bits[_SIG_WORD(SIGINT)] |= _SIG_BIT(SIGINT);\n    sigprocmask(SIG_BLOCK, &ss, NULL);\n#else\n    sigset_t ss;\n    sigemptyset(&ss);\n    sigaddset(&ss, SIGINT);\n    pthread_sigmask(SIG_BLOCK, &ss, NULL);\n#endif\n}\n\nvoid* interrupter_thread(void* o)\n{\n    block_sigint();\n    fd_set a, b;\n    FD_ZERO(&a);\n    FD_ZERO(&b);\n    FD_SET(gdb_socket, &a);\n    while(select(gdb_socket+1, &a, &b, &b, NULL) <= 0);\n    if(!in_signal_handler)\n        kill(getpid(), SIGINT);\n#if defined(__PS4__) && defined(PS5KEK)\n    thr_exit(0);\n#endif\n}\n\nvoid start_interrupter_thread(void)\n{\n    pthread_t child;\n    pthread_create(&child, NULL, interrupter_thread, NULL);\n    pthread_detach(child);\n}\n\n#endif\n\n#ifdef __PS4__\nstatic mcontext_t* p_mcontext;\n#endif\n\nstatic void signal_handler(int signum, siginfo_t* idc, void* o_uc)\n{\n    int tmp_errno = errno;\n    while(__atomic_exchange_n(&in_signal_handler, 1, __ATOMIC_ACQUIRE));\n    ucontext_t* uc = (ucontext_t*)o_uc;\n#ifdef __PS4__\n    mcontext_t* mc = (mcontext_t*)(((char*)&uc->uc_mcontext)+48); // wtf??\n    sysarch(AMD64_SET_GSBASE, &mc->mc_gsbase);\n    if(signum == SIGTRAP && idc->si_code == TRAP_BRKPT)\n        mc->mc_rip--;\n    p_mcontext = mc;\n#else\n    if(signum == SIGTRAP && idc->si_code == 3)\n        uc->uc_mcontext.gregs[REG_RIP]--;\n#endif\n    struct trap_state ts = {\n        .trap_signal = signum,\n        .regs = {\n#ifdef __PS4__\n            .rax = mc->mc_rax,\n            .rcx = mc->mc_rcx,\n            .rdx = mc->mc_rdx,\n            .rbx = mc->mc_rbx,\n            .rsp = mc->mc_rsp,\n            .rbp = mc->mc_rbp,\n            .rsi = mc->mc_rsi,\n            .rdi = mc->mc_rdi,\n            .r8 = mc->mc_r8,\n            .r9 = mc->mc_r9,\n            .r10 = mc->mc_r10,\n            .r11 = mc->mc_r11,\n            .r12 = mc->mc_r12,\n            .r13 = mc->mc_r13,\n            .r14 = mc->mc_r14,\n            .r15 = mc->mc_r15,\n            .rip = mc->mc_rip,\n            .eflags = mc->mc_rflags & ~256ull /* singlestep */,\n            .cs = mc->mc_cs,\n            .ds = mc->mc_ds,\n            .es = mc->mc_es,\n            .ss = mc->mc_ss,\n            .fs = mc->mc_fs,\n            .gs = mc->mc_gs,\n#else\n            .rax = uc->uc_mcontext.gregs[REG_RAX],\n            .rcx = uc->uc_mcontext.gregs[REG_RCX],\n            .rdx = uc->uc_mcontext.gregs[REG_RDX],\n            .rbx = uc->uc_mcontext.gregs[REG_RBX],\n            .rsp = uc->uc_mcontext.gregs[REG_RSP],\n            .rbp = uc->uc_mcontext.gregs[REG_RBP],\n            .rsi = uc->uc_mcontext.gregs[REG_RSI],\n            .rdi = uc->uc_mcontext.gregs[REG_RDI],\n            .r8 = uc->uc_mcontext.gregs[REG_R8],\n            .r9 = uc->uc_mcontext.gregs[REG_R9],\n            .r10 = uc->uc_mcontext.gregs[REG_R10],\n            .r11 = uc->uc_mcontext.gregs[REG_R11],\n            .r12 = uc->uc_mcontext.gregs[REG_R12],\n            .r13 = uc->uc_mcontext.gregs[REG_R13],\n            .r14 = uc->uc_mcontext.gregs[REG_R14],\n            .r15 = uc->uc_mcontext.gregs[REG_R15],\n            .rip = uc->uc_mcontext.gregs[REG_RIP],\n            .eflags = uc->uc_mcontext.gregs[REG_EFL] & ~256 /* singlestep */,\n            .cs = uc->uc_mcontext.gregs[REG_CSGSFS] & 0xffff,\n            .ds = 0xdeadbeef,\n            .es = 0xdeadbeef,\n            .ss = 0xdeadbeef,\n            .fs = uc->uc_mcontext.gregs[REG_CSGSFS] >> 32 & 0xffff,\n            .gs = uc->uc_mcontext.gregs[REG_CSGSFS] >> 16 & 0xffff,\n#endif\n        }\n    };\n    gdbstub_main_loop(&ts, 0, 0);\n#ifdef __PS4__\n    mc->mc_rax = ts.regs.rax;\n    mc->mc_rcx = ts.regs.rcx;\n    mc->mc_rdx = ts.regs.rdx;\n    mc->mc_rbx = ts.regs.rbx;\n    mc->mc_rsp = ts.regs.rsp;\n    mc->mc_rbp = ts.regs.rbp;\n    mc->mc_rsi = ts.regs.rsi;\n    mc->mc_rdi = ts.regs.rdi;\n    mc->mc_r8 = ts.regs.r8;\n    mc->mc_r9 = ts.regs.r9;\n    mc->mc_r10 = ts.regs.r10;\n    mc->mc_r11 = ts.regs.r11;\n    mc->mc_r12 = ts.regs.r12;\n    mc->mc_r13 = ts.regs.r13;\n    mc->mc_r14 = ts.regs.r14;\n    mc->mc_r15 = ts.regs.r15;\n    mc->mc_rip = ts.regs.rip;\n    mc->mc_rflags = ts.regs.eflags;\n#else\n    uc->uc_mcontext.gregs[REG_RAX] = ts.regs.rax;\n    uc->uc_mcontext.gregs[REG_RCX] = ts.regs.rcx;\n    uc->uc_mcontext.gregs[REG_RDX] = ts.regs.rdx;\n    uc->uc_mcontext.gregs[REG_RBX] = ts.regs.rbx;\n    uc->uc_mcontext.gregs[REG_RSP] = ts.regs.rsp;\n    uc->uc_mcontext.gregs[REG_RBP] = ts.regs.rbp;\n    uc->uc_mcontext.gregs[REG_RSI] = ts.regs.rsi;\n    uc->uc_mcontext.gregs[REG_RDI] = ts.regs.rdi;\n    uc->uc_mcontext.gregs[REG_R8] = ts.regs.r8;\n    uc->uc_mcontext.gregs[REG_R9] = ts.regs.r9;\n    uc->uc_mcontext.gregs[REG_R10] = ts.regs.r10;\n    uc->uc_mcontext.gregs[REG_R11] = ts.regs.r11;\n    uc->uc_mcontext.gregs[REG_R12] = ts.regs.r12;\n    uc->uc_mcontext.gregs[REG_R13] = ts.regs.r13;\n    uc->uc_mcontext.gregs[REG_R14] = ts.regs.r14;\n    uc->uc_mcontext.gregs[REG_R15] = ts.regs.r15;\n    uc->uc_mcontext.gregs[REG_RIP] = ts.regs.rip;\n    uc->uc_mcontext.gregs[REG_EFL] = ts.regs.eflags;\n#endif\n    __atomic_exchange_n(&in_signal_handler, 0, __ATOMIC_RELEASE);\n#ifdef INTERRUPTER_THREAD\n    start_interrupter_thread();\n#endif\n    errno = tmp_errno;\n}\n\nlong gdb_remote_syscall(const char* name, int nargs, int* ern, ...)\n{\n    while(__atomic_exchange_n(&in_signal_handler, 1, __ATOMIC_ACQUIRE));\n    pkt_opaque o;\n    start_packet(o);\n    PKT_PUTS(o, \"F\");\n    size_t l = 0;\n    while(name[l])\n        l++;\n    pkt_puts(o, name, l);\n    va_list ls;\n    va_start(ls, ern);\n    for(int i = 0; i < nargs; i++)\n    {\n        uintptr_t q = va_arg(ls, uintptr_t);\n        char p[17] = \",\";\n        for(int i = 15; i >= 0; i--)\n            p[16-i] = int2hex((q >> (4*i)) & 15);\n        pkt_puts(o, p, 17);\n    }\n    end_packet(o);\n    va_end(ls);\n    struct trap_state st = {0};\n    ssize_t ans;\n    int status = gdbstub_main_loop(&st, &ans, ern);\n    __atomic_exchange_n(&in_signal_handler, 0, __ATOMIC_RELEASE);\n    if(status == 2)\n        kill(getpid(), SIGINT);\n#ifdef INTERRUPTER_THREAD\n    start_interrupter_thread();\n#endif\n    return ans;\n}\n\n#ifdef STDIO_REDIRECT\n\nint gdb_stdout_read, gdb_stderr_read;\n\n#ifdef PS4LIBS\nvoid ps4_xchg_sony_cred(uint64_t*);\n#endif\n\nstatic int replace_with_socket(int fd)\n{\n#if defined(PS4LIBS) && !defined(PS5KEK)\n    uint64_t cred = 0x3800000000000007;\n    ps4_xchg_sony_cred(&cred);\n#endif\n    close(fd);\n#if defined(PS4LIBS) && !defined(PS5KEK)\n    ps4_xchg_sony_cred(&cred);\n#endif\n    int socks[2];\n    if(socketpair(AF_UNIX, SOCK_STREAM, 0, socks))\n        return -1;\n    if(socks[0] == fd)\n        return socks[1];\n    else if(socks[1] == fd)\n        return socks[0];\n    else\n        return -1;\n}\n\nstatic void* stdio_redirect_thread(void* o)\n{\n    block_sigint();\n    fd_set s;\n    int fds[2] = {gdb_stdout_read, gdb_stderr_read};\n    while(fds[0] >= 0 || fds[1] >= 0)\n    {\n        FD_ZERO(&s);\n        int nfds = 0;\n        if(fds[0] >= 0)\n        {\n            FD_SET(fds[0], &s);\n            if(fds[0] >= nfds)\n                nfds = fds[0] + 1;\n        }\n        if(fds[1] >= 0)\n        {\n            FD_SET(fds[1], &s);\n            if(fds[1] >= nfds)\n                nfds = fds[1] + 1;\n        }\n        int n = select(nfds, &s, NULL, NULL, NULL);\n        if(n < 0)\n            continue;\n        for(int i = 0; i < 2; i++)\n        {\n            if(FD_ISSET(fds[i], &s))\n            {\n                char chk[512];\n                ssize_t sz = read(fds[i], chk, 512);\n                if(sz <= 0)\n                    fds[i] = -1;\n                else\n                    gdb_remote_syscall(\"write\", 3, 0, (uintptr_t)(i+1), (uintptr_t)chk, (uintptr_t)sz);\n            }\n        }\n    }\n#if defined(__PS4__) && defined(PS5KEK)\n    thr_exit(0);\n#endif\n    return NULL;\n}\n\n/*static */void gdb_setup_redir(void)\n{\n    int stubs[3];\n    for(int i = 0; i < 3; i++)\n        stubs[i] = socket(AF_UNIX, SOCK_DGRAM, 0);\n    gdb_stdout_read = replace_with_socket(1);\n    gdb_stderr_read = replace_with_socket(2);\n    for(int i = 0; i < 3; i++)\n        if(stubs[i] >= 3)\n            close(stubs[i]);\n    pthread_t thr;\n    pthread_create(&thr, NULL, stdio_redirect_thread, (void*)1);\n}\n\n#endif\n\nstatic unsigned long long start_rip;\n\nstatic void tmp_sigsegv(int sig, siginfo_t* idc, void* o_uc)\n{\n    ucontext_t* uc = (ucontext_t*)o_uc;\n#ifdef __PS4__\n    mcontext_t* mc = (mcontext_t*)(((char*)&uc->uc_mcontext)+48); // wtf??\n    mc->mc_rip = start_rip;\n#else\n    uc->uc_mcontext.gregs[REG_RIP] = start_rip;\n#endif\n    struct sigaction siga = {\n        .sa_sigaction = signal_handler,\n        .sa_flags = SA_SIGINFO\n    };\n    sigaction(SIGSEGV, &siga, NULL);\n    signal_handler(0, idc, o_uc);\n}\n\n__attribute__((naked)) void dbg_enter()\n{\n    asm volatile(\"mov %rsp, %rdi\\njmp real_dbg_enter\");\n}\n\nstatic void unblock_signals(void)\n{\n#ifdef __PS4__\n    sigset_t ss = {0};\n\tss.__bits[_SIG_WORD(SIGTRAP)] |= _SIG_BIT(SIGTRAP);\n\tss.__bits[_SIG_WORD(SIGILL)] |= _SIG_BIT(SIGILL);\n\tss.__bits[_SIG_WORD(SIGBUS)] |= _SIG_BIT(SIGBUS);\n\tss.__bits[_SIG_WORD(SIGINT)] |= _SIG_BIT(SIGINT);\n\tss.__bits[_SIG_WORD(SIGSYS)] |= _SIG_BIT(SIGSYS);\n\tss.__bits[_SIG_WORD(SIGSEGV)] |= _SIG_BIT(SIGSEGV);\n\tss.__bits[_SIG_WORD(SIGFPE)] |= _SIG_BIT(SIGFPE);\n    sigprocmask(SIG_UNBLOCK, &ss, NULL);\n#else\n    sigset_t ss;\n    sigemptyset(&ss);\n    sigaddset(&ss, SIGTRAP);\n    sigaddset(&ss, SIGILL);\n    sigaddset(&ss, SIGBUS);\n    sigaddset(&ss, SIGINT);\n    sigaddset(&ss, SIGSYS);\n    sigaddset(&ss, SIGSEGV);\n    sigaddset(&ss, SIGFPE);\n    pthread_sigmask(SIG_UNBLOCK, &ss, NULL);\n#endif\n}\n\nvoid real_dbg_enter(uint64_t* rsp)\n{\n#ifdef __PS4__\n#ifdef BLOB\n    mprotect_rwx();\n#endif\n#ifndef OBJECT_FILE\n    reloc_commands();\n#endif\n#endif\n    int sock = socket(AF_INET, SOCK_STREAM, 0);\n    int reuse = 1;\n    setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, &reuse, 4);\n    int brv = 1;\n    for(int port = 1234; port < 65536 && brv; port++)\n    {\n        struct sockaddr_in sa = {\n            .sin_family = AF_INET,\n            .sin_addr = {.s_addr = 0},\n            .sin_port = (port >> 8) | (port << 8),\n        };\n#if defined(__PS4__) && defined(PS4LIBS) && !defined(PS5KEK)\n        void ps4_xchg_budget(int*);\n        int budget = 2;\n        ps4_xchg_budget(&budget);\n#endif\n        brv = bind(sock, (struct sockaddr*)&sa, sizeof(sa));\n#if defined(__PS4__) && defined(PS4LIBS) && !defined(PS5KEK)\n        ps4_xchg_budget(&budget);\n#endif\n    }\n    if(brv)\n        return;\n    listen(sock, 1);\n    gdb_socket = accept(sock, NULL, NULL);\n    int nodelay = 1;\n    setsockopt(gdb_socket, IPPROTO_TCP, TCP_NODELAY, &nodelay, sizeof(nodelay));\n    int p[2];\n    socketpair(AF_UNIX, SOCK_STREAM, 0, p);\n    pipe_r = p[0];\n    pipe_w = p[1];\n    unsigned char plus;\n    if(read(gdb_socket, &plus, 1) != 1 || plus != '+')\n        return;\n    struct sigaction siga = {\n        .sa_sigaction = signal_handler,\n        .sa_flags = SA_SIGINFO\n    };\n    int a = sigaction(SIGTRAP, &siga, NULL);\n    int b = sigaction(SIGILL, &siga, NULL);\n    int c = sigaction(SIGBUS, &siga, NULL);\n    int d = sigaction(SIGINT, &siga, NULL);\n    int e = sigaction(SIGSYS, &siga, NULL);\n    int f = sigaction(SIGFPE, &siga, NULL);\n    siga.sa_sigaction = tmp_sigsegv;\n    int g = sigaction(SIGSEGV, &siga, NULL);\n#ifdef STDIO_REDIRECT\n    gdb_setup_redir();\n#endif\n    // set debugger entry\n    start_rip = *rsp;\n    *rsp = 0;\n    unblock_signals();\n}\n"
  },
  {
    "path": "gdb_stub/dbg.h",
    "content": "#pragma once\n\nvoid dbg_enter(void);\nlong gdb_remote_syscall(const char* name, int nargs, int* ern, ...);\n"
  },
  {
    "path": "gdb_stub/enhancer.py",
    "content": "import sys\n\nclass ELFAccessor:\n    def __init__(self, data):\n        data = memoryview(data)\n        phoff = int.from_bytes(data[32:40], 'little')\n        phnum = int.from_bytes(data[56:58], 'little')\n        segments = []\n        for offset in range(phoff, phoff+56*phnum, 56):\n            if data[offset:offset+4] != b'\\1\\0\\0\\0':\n                continue\n            addr = int.from_bytes(data[offset+16:offset+24], 'little')\n            fileoff = int.from_bytes(data[offset+8:offset+16], 'little')\n            filesz = int.from_bytes(data[offset+32:offset+40], 'little')\n            memsz = int.from_bytes(data[offset+40:offset+48], 'little')\n            segments.append((addr, data[fileoff:fileoff+filesz], memsz, fileoff))\n        segments.sort()\n        self.segments = []\n        for i, j, k, l in segments:\n            if not self.segments or self.segments[-1][0] + self.segments[-1][2] <= i:\n                self.segments.append((i, j, k, l))\n    def _lookup_segment(self, addr, offset=0):\n        if addr == None: return -1\n        addr += offset\n        l = -1\n        r = len(self.segments)\n        while r - l > 1:\n            m = (l + r) // 2\n            if self.segments[m][0] <= addr:\n                l = m\n            else:\n                r = m\n        if l not in range(len(self.segments)) or self.segments[l][0] + self.segments[l][2] <= addr:\n            return -1\n        return l\n    def __getitem__(self, idx):\n        if isinstance(idx, slice):\n            step = idx.step if idx.step != None else 1\n            i1 = self._lookup_segment(idx.start)\n            i2 = self._lookup_segment(idx.stop, -step)\n            if i1 != i2 or i1 < 0 or i2 < 0:\n                raise IndexError(\"page fault\")\n            if step < 0:\n                return self[idx.stop-step:idx.start-step:step]\n            ans = bytes(self.segments[i1][1][idx.start-self.segments[i1][0]:idx.stop-self.segments[i1][0]:step])\n            ans += bytes(len(range(idx.start, idx.stop, step)) - len(ans))\n            return ans\n        return self[idx:idx+1][0]\n    def get_offset(self, start, stop):\n        i1 = self._lookup_segment(start)\n        i2 = self._lookup_segment(stop, -1)\n        if i1 != i2 or i1 < 0 or i2 < 0:\n            raise IndexError(\"page fault\")\n        return self.segments[i1][3] + start - self.segments[i1][0]\n    def find(self, c, idx):\n        while True:\n            try: cc = self[idx:idx+len(c)]\n            except IndexError: return -1\n            if cc == c: return idx\n            idx += 1\n    def __len__(self):\n        return self.segments[-1][0] + self.segments[-1][2]\n\nnidmap = {}\n\nif len(sys.argv) >= 4:\n    with open(sys.argv[3]) as f:\n        for l in f:\n            nid, sym = l.split()\n            nidmap[nid] = sym\n\nwith open(sys.argv[1], 'rb') as file:\n    data0 = file.read()\n    data = bytearray(data0)\n\ndef align(n):\n    global data\n    data += bytes((-len(data)) % n)\n\nphoff = int.from_bytes(data[32:40], 'little')\nnphdr = int.from_bytes(data[56:58], 'little')\n\nsection_names = b''\n\nalign(16)\nshoff = len(data)\nnsections = 0\n\ndef section(name, kind, flags, addr, offset, size, link, info, entrysz, align=1):\n    global section_names, data, nsections\n    data += len(section_names).to_bytes(4, 'little')\n    section_names += (name+'\\0').encode('ascii')\n    data += kind.to_bytes(4, 'little')\n    data += flags.to_bytes(8, 'little')\n    data += addr.to_bytes(8, 'little')\n    off_off = len(data)\n    data += offset.to_bytes(8, 'little')\n    sz_off = len(data)\n    data += size.to_bytes(8, 'little')\n    data += link.to_bytes(4, 'little')\n    data += info.to_bytes(4, 'little')\n    data += align.to_bytes(8, 'little')\n    data += entrysz.to_bytes(8, 'little')\n    nsections += 1\n    return off_off, sz_off\n\nsection('', 0, 0, 0, 0, 0, 0, 0, 0) # NULL\n\nnames = {}\n\ndef next_name(prefix):\n    if prefix not in names: names[prefix] = 0\n    ans = names[prefix]\n    names[prefix] += 1\n    return prefix if not ans else prefix + str(ans)\n\ndef guess_name(flags):\n    if flags & 4: # X\n        return '.text'\n    elif flags & 1: # W\n        return '.data'\n    else:\n        return '.rodata'\n\ndynamic = None\nsce_dynlibdata = ELFAccessor(data0)\nsce_dynlibdata_offset = None\n\ndef get_dynlibdata_offset(offset, size):\n    if sce_dynlibdata_offset != None:\n        return sce_dynlibdata_offset + offset\n    else:\n        return sce_dynlibdata.get_offset(offset, offset+size)\n\ninmem_sections = []\ninmem_segments = []\n\ntext_addr = None\ntext_offset = None\ntext_filesz = None\n\neh_frame_hdr = None\n\nfor i in range(nphdr):\n    phdr = data[phoff+56*i:phoff+56*(i+1)]\n    kind = int.from_bytes(phdr[:4], 'little')\n    addr = int.from_bytes(phdr[16:24], 'little')\n    offset = int.from_bytes(phdr[8:16], 'little')\n    filesz = int.from_bytes(phdr[32:40], 'little')\n    memsz = int.from_bytes(phdr[40:48], 'little')\n    flags = int.from_bytes(phdr[4:8], 'little')\n    if kind == 1: # PT_LOAD\n        inmem_segments.append((addr, offset, filesz))\n        s_flags = 2 | (flags & 1) << 2 | (flags & 2) >> 1\n        assert filesz <= memsz\n        inmem_sections.append((addr, nsections))\n        if s_flags & 4 and text_addr == None:\n            text_addr = addr\n            text_offset = offset\n            text_filesz = filesz\n        section(next_name(guess_name(s_flags)), 1, s_flags, addr, offset, filesz, 0, 0, 0)\n        if filesz < memsz:\n            inmem_sections.append((addr + filesz, nsections))\n            section(next_name('.bss'), 8, s_flags, addr + filesz, 0, memsz - filesz, 0, 0, 0)\n    elif kind == 2: # PT_DYNAMIC\n        dynamic = (offset, filesz, addr)\n    elif kind == 0x6474e550: # GNU_EH_FRAME\n        eh_frame_hdr = (addr, offset, filesz)\n    elif kind == 0x61000000: # SCE_DYNLIBDATA\n        sce_dynlibdata_offset = offset\n        sce_dynlibdata = offset\n\ninmem_sections.sort()\ninmem_segments.sort()\n\ndef guess_section(addr, sections=inmem_sections):\n    l = -1\n    h = len(sections)\n    while h - l > 1:\n        m = (h + l) // 2\n        if sections[m][0] > addr:\n            h = m\n        else:\n            l = m\n    if l >= 0: return sections[l], l+1\n    return 0, 0\n\ndynsym = None\ndynstr = None\n\ndef process_dynsym(b):\n    assert len(b) % 24 == 0\n    b = bytearray(b)\n    for i in range(0, len(b), 24):\n        value = int.from_bytes(b[i+8:i+16], 'little')\n        if value != 0: # UND\n            b[i+6:i+8] = guess_section(value)[1].to_bytes(2, 'little')\n    return bytes(b)\n\ndef decode_nid(nid0):\n    nid = nid0.decode('ascii').split('#', 1)[0]\n    if nid in nidmap:\n        return nidmap[nid].encode('ascii')\n    else:\n        return nid0\n\ndef decode_nids(b, oldnames):\n    assert len(b) % 24 == 0\n    newnames = b''\n    b = bytearray(b)\n    for i in range(0, len(b), 24):\n        name = oldnames[int.from_bytes(b[i:i+4], 'little'):].split(b'\\0', 1)[0]\n        b[i:i+4] = len(newnames).to_bytes(4, 'little')\n        newnames += decode_nid(name) + b'\\0'\n    return (bytes(b), newnames)\n\ndef parse_relaplt(data):\n    ans = {}\n    for i in range(0, len(data), 24):\n        offset = int.from_bytes(data[i:i+8], 'little')\n        info = int.from_bytes(data[i+8:i+16], 'little')\n        addend = int.from_bytes(data[i+16:i+24], 'little')\n        if (info & 0xffffffff) == 7:\n            ans[offset] = info >> 32\n    return ans\n\ndef plt_synthesise(dynsym, dynstr, text, text_addr, got):\n    i = 0\n    while True:\n        jmp = text.find(b'\\xff\\x25', i)\n        if jmp < 0 or jmp > len(text) - 6: break\n        i = jmp + 6\n        addr = text_addr + jmp + 6 + int.from_bytes(text[jmp+2:jmp+6], 'little')\n        if addr in got:\n            j = got[addr]\n            name = dynstr[int.from_bytes(dynsym[24*j:24*j+4], 'little'):].split(b'\\0', 1)[0]\n            if not name: continue\n            name += b'@plt'\n            dynsym += len(dynstr).to_bytes(4, 'little')\n            dynsym += b'\\x02' # local func\n            dynsym += b'\\x02' # hidden\n            dynsym += guess_section(text_addr + jmp)[1].to_bytes(2, 'little')\n            dynsym += (text_addr + jmp).to_bytes(8, 'little')\n            dynsym += b'\\6\\0\\0\\0\\0\\0\\0\\0'\n            dynstr += name + b'\\0'\n    return dynsym, dynstr\n\ndef read_leb128(data, off, signed=False):\n    ans = 0\n    shift = 0\n    while True:\n        q = data[off]\n        off += 1\n        ans |= (q & 127) << shift\n        shift += 7\n        if ans < 128: break\n    if signed: ans |= (-(ans >> (shift - 1))) << shift\n    return ans, off\n\ndef efh_fetch_enc(data, off, how):\n    if how == 1: return parse_leb128(data, off)\n    elif how == 2: return int.from_bytes(data[off:off+2], 'little'), off+2\n    elif how == 3: return int.from_bytes(data[off:off+4], 'little'), off+4\n    elif how == 4: return int.from_bytes(data[off:off+8], 'little'), off+8\n    elif how == 9: return parse_leb128(data, off, signed=True)\n    elif how == 10: return int.from_bytes(data[off:off+2], 'little', signed=True), off+2\n    elif how == 11: return int.from_bytes(data[off:off+4], 'little', signed=True), off+4\n    elif how == 12: return int.from_bytes(data[off:off+8], 'little', signed=True), off+8\n    elif how == 15: return None, off\n    else: assert False\n\ndef efh_read_enc(data, off, off0, shift, how):\n    ans, off2 = efh_fetch_enc(data, off, how % 16)\n    how //= 16\n    if how == 0: pass\n    elif how == 1: ans += off + shift\n    elif how == 3: ans += off0 + shift\n    elif how == 15: pass\n    else: assert False\n    return ans, off2\n\ndef efh_parse(data, off, limit, shift):\n    off0 = off\n    assert data[off] == 1\n    efpe = data[off+1]\n    fdce = data[off+2]\n    te = data[off+3]\n    efp, off = efh_read_enc(data, off+4, off0, shift, efpe)\n    fdc, off = efh_read_enc(data, off, off0, shift, fdce)\n    max_addr = -1\n    for i in range(fdc if fdc is not None else 0):\n        initloc, off = efh_read_enc(data, off, off0, shift, te)\n        addr, off = efh_read_enc(data, off, off0, shift, te)\n        max_addr = max(max_addr, addr)\n    assert off <= limit\n    return efp, max_addr\n\ndef ef_parse(data, off, limit):\n    while off + 4 <= limit:\n        l = int.from_bytes(data[off:off+4], 'little')\n        if l + off + 4 > limit: break\n        off += l + 4\n        if not l: break\n    return off\n\nif dynamic:\n    section('.dynamic', 6, 0, dynamic[2], dynamic[0], dynamic[1], 0, 0, 0)\n    assert dynamic[1] % 16 == 0\n    dynsym_addr = None\n    dynsym_sz = None\n    hash_addr = None\n    dynstr_addr = None\n    dynstr_sz = None\n    reladyn_addr = None\n    reladyn_sz = None\n    relaplt_addr = None\n    relaplt_sz = None\n    for i in range(0, dynamic[1], 16):\n        entry = data[dynamic[0]+i:dynamic[0]+i+16]\n        tag = int.from_bytes(entry[:8], 'little')\n        val = int.from_bytes(entry[8:], 'little')\n        if tag == 0x61000039 or tag == 6:\n            dynsym_addr = val\n        elif tag == 0x6100003f:\n            dynsym_sz = val\n        elif tag == 0x61000035 or tag == 5:\n            dynstr_addr = val\n        elif tag == 0x61000037 or tag == 10:\n            dynstr_sz = val\n        elif tag == 0x6100002f or tag == 7:\n            reladyn_addr = val\n        elif tag == 0x61000031 or tag == 8:\n            reladyn_sz = val\n        elif tag == 0x61000029 or tag == 23:\n            relaplt_addr = val\n        elif tag == 0x6100002d or tag == 2:\n            relaplt_sz = val\n        elif tag == 4:\n            hash_addr = val\n    if dynsym_addr != None and dynsym_sz == None and hash_addr != None:\n        n_buckets = int.from_bytes(sce_dynlibdata[hash_addr:hash_addr+4], 'little')\n        n_chains = int.from_bytes(sce_dynlibdata[hash_addr+4:hash_addr+8], 'little')\n        n_symbols = max(int.from_bytes(sce_dynlibdata[hash_addr+4*i:hash_addr+4*i+4], 'little') for i in range(2, 2+n_buckets+n_chains))\n        dynsym_sz = 24 * n_symbols\n    have_dynstr = dynstr_addr != None and dynstr_sz != None\n    dynsym_sect = 0\n    got_slots = None\n    if relaplt_addr != None and relaplt_sz != None:\n        got_slots = parse_relaplt(sce_dynlibdata[relaplt_addr:relaplt_addr+relaplt_sz])\n    if dynsym_addr != None and dynsym_sz != None and sce_dynlibdata != None:\n        dynsym_sect = nsections\n        dynsym = process_dynsym(sce_dynlibdata[dynsym_addr:dynsym_addr+dynsym_sz])\n        if have_dynstr and nidmap:\n            dynsym, dynstr = decode_nids(dynsym, sce_dynlibdata[dynstr_addr:dynstr_addr+dynstr_sz])\n        if have_dynstr and text_offset != None and got_slots:\n            if dynstr == None: dynstr = sce_dynlibdata[dynstr_addr:dynstr_addr+dynstr_sz]\n            dynsym, dynstr = plt_synthesise(dynsym, dynstr, data[text_offset:text_offset+text_filesz], text_addr, got_slots)\n        dynsym_off, dynsym_sz = section('.dynsym', 11, 0, 0, 0, 0, nsections + 2 if have_dynstr else 0, 0, 24)\n        symtab_off, symtab_sz = section('.symtab', 2, 0, 0, 0, 0, nsections + 2 if have_dynstr else 0, 0, 24)\n    if have_dynstr and sce_dynlibdata != None:\n        dynstr_off, dynstr_siz = section('.dynstr', 3, 0, 0, get_dynlibdata_offset(dynstr_addr, dynstr_sz), dynstr_sz, 0, 0, 0)\n        strtab_off, strtab_siz = section('.strtab', 3, 0, 0, get_dynlibdata_offset(dynstr_addr, dynstr_sz), dynstr_sz, 0, 0, 0)\n    if reladyn_addr != None and reladyn_sz != None and sce_dynlibdata != None:\n        section('.rela.dyn', 4, 0, 0, get_dynlibdata_offset(reladyn_addr, reladyn_sz), reladyn_sz, dynsym_sect, 0, 24)\n    if relaplt_addr != None and relaplt_sz != None and sce_dynlibdata != None:\n        section('.rela.plt', 4, 0, 0, get_dynlibdata_offset(relaplt_addr, relaplt_sz), relaplt_sz, dynsym_sect, 0, 24)\n\nif eh_frame_hdr != None:\n    ef_start, ef_some_entry = efh_parse(data, eh_frame_hdr[1], eh_frame_hdr[1] + eh_frame_hdr[2], eh_frame_hdr[0] - eh_frame_hdr[1])\n    if ef_some_entry >= 0:\n        ef_segment = guess_section(ef_start, inmem_segments)[0]\n        assert all(i in range(ef_segment[0], ef_segment[0]+ef_segment[2]) for i in (ef_start, ef_some_entry))\n        ef_end = ef_parse(data, ef_some_entry + ef_segment[1] - ef_segment[0], ef_segment[1] + ef_segment[2])\n        ef_length = ef_end - (ef_start + ef_segment[1] - ef_segment[0])\n    section('.eh_frame_hdr', 1, 2, eh_frame_hdr[0], eh_frame_hdr[1], eh_frame_hdr[2], 0, 0, 0, 4)\n    if ef_some_entry >= 0:\n        section('.eh_frame', 1, 2, ef_start, ef_start + ef_segment[1] - ef_segment[0], ef_length, 0, 0, 0, 8)\n\nif nsections:\n    shstrndx = nsections\n    shstrtab_off, shstrtab_sz = section('.shstrtab', 3, 0, 0, 0, 0, 0, 0, 0)\n    align(16)\n    data[shstrtab_off:shstrtab_off+8] = len(data).to_bytes(8, 'little')\n    data[shstrtab_sz:shstrtab_sz+8] = len(section_names).to_bytes(8, 'little')\n    data += section_names\n\nif dynsym != None:\n    align(16)\n    data[dynsym_off:dynsym_off+8] = data[symtab_off:symtab_off+8] = len(data).to_bytes(8, 'little')\n    data[dynsym_sz:dynsym_sz+8] = data[symtab_sz:symtab_sz+8] = len(dynsym).to_bytes(8, 'little')\n    data += dynsym\n\nif dynstr != None:\n    align(16)\n    data[dynstr_off:dynstr_off+8] = data[strtab_off:strtab_off+8] = len(data).to_bytes(8, 'little')\n    data[dynstr_siz:dynstr_siz+8] = data[strtab_siz:strtab_siz+8] = len(dynstr).to_bytes(8, 'little')\n    data += dynstr\n\ndata[16:18] = b'\\3\\0' # ET_DYN, this is THE ONLY DESTRUCTIVE ACTION\ndata[40:48] = shoff.to_bytes(8, 'little')\ndata[58:64] = b'\\x40\\0' + nsections.to_bytes(2, 'little') + shstrndx.to_bytes(2, 'little')\n\nwith open(sys.argv[2], 'wb') as file: file.write(data)\n"
  },
  {
    "path": "gdb_stub/main.c",
    "content": "#include \"dbg.h\"\n#include <sys/thr.h>\n#include <sys/mman.h>\n#include <sys/types.h>\n#include <machine/sysarch.h>\n\n#if 0\n\nvoid k_get_td(void* td, void*** uap)\n{\n    uap[1][0] = td;\n}\n\nvoid k_get_xfast_syscall(void* td, void*** uap)\n{\n    uint32_t low, high, which = 0xc0000082;\n    asm volatile(\"rdmsr\":\"=a\"(low),\"=d\"(high):\"c\"(which));\n    uap[1][0] = (void*)((uint64_t)high << 32 | low);\n}\n\nvoid k_patch_kernel(void* td, void*** uap)\n{\n    asm volatile(\"mov %%cr0, %%rax\\nbtc $16, %%eax\\nmov %%rax, %%cr0\":::\"rax\");\n    char* dst = uap[1][0];\n    char* src = uap[1][1];\n    size_t sz = (size_t)uap[1][2];\n    for(size_t i = 0; i < sz; i++)\n        dst[i] = src[i];\n    asm volatile(\"mov %%cr0, %%rax\\nbts $16, %%eax\\nmov %%rax, %%cr0\":::\"rax\");\n}\n\nvoid kexec(void*, void*);\n\nvoid* get_td(void)\n{\n    void* ans;\n    kexec(k_get_td, &ans);\n    return ans;\n}\n\nvoid* get_xfast_syscall(void)\n{\n    void* ans;\n    kexec(k_get_xfast_syscall, &ans);\n    return ans;\n}\n\nvoid patch_kernel(void* addr, char* src, size_t sz)\n{\n    void* payload[3] = {addr, src, (void*)sz};\n    kexec(k_patch_kernel, payload);\n}\n\n#endif\n\nvoid sidt(unsigned char* p)\n{\n    asm volatile(\"sidt (%0)\"::\"r\"(p));\n}\n\nvoid* malloc(size_t sz)\n{\n    return mmap(0, sz, PROT_READ|PROT_WRITE|PROT_EXEC, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0);\n}\n\nint main(void)\n{\n    dbg_enter();\n#if 0\n    //detect being injected\n    void* fsbase = 0;\n    sysarch(AMD64_GET_FSBASE, &fsbase);\n    if(!fsbase)\n        thr_exit(0);\n    return 0;\n#endif\n}\n"
  },
  {
    "path": "gdb_stub/ps4libs.c",
    "content": "#include <sys/types.h>\n#include <errno.h>\n#include <unistd.h>\n#include <fcntl.h>\n\n//#undef errno\n//extern int errno;\n\ntypedef unsigned char pkt_opaque[1];\n\ntypedef struct srv_opaque\n{\n    unsigned long long offset;\n    unsigned long long len;\n    int nonempty;\n} srv_opaque[1];\n\nvoid serve_genfn_start(pkt_opaque, srv_opaque, int);\nint serve_genfn_emit(pkt_opaque, srv_opaque, const char*, unsigned long long);\nvoid serve_genfn_end(pkt_opaque, srv_opaque);\n\nint randomized_path(unsigned long long, char*, size_t*);\n\nstatic int get_elf_offsets(const char* name, unsigned long long* addrs)\n{\n    size_t o = 0;\n    while(name[o])\n        o++;\n    char path[o + sizeof(\"/0123456789/common/lib/\")];\n    for(size_t i = 0; i < sizeof(\"/system/common/lib/\"); i++)\n        path[i] = \"/system/common/lib/\"[i];\n    for(size_t i = 0; i <= o; i++)\n        path[i + sizeof(\"/system/common/lib/\") - 1] = name[i];\n    int fd = open(path, O_RDONLY);\n    if(fd < 0) // sandboxed\n    {\n        char sandbox_path[11];\n        size_t sz = 11;\n        if(randomized_path(0, sandbox_path, &sz))\n            return -1;\n        path[0] = '/';\n        for(size_t i = 0; i < 10; i++)\n            path[i+1] = sandbox_path[i];\n        for(size_t i = 0; i < sizeof(\"/common/lib/\"); i++)\n            path[i+11] = \"/common/lib/\"[i];\n        for(size_t i = 0; i <= o; i++)\n            path[i + sizeof(\"/0123456789/common/lib/\") - 1] = name[i];\n        fd = open(path, O_RDONLY);\n        if(fd < 0)\n        {\n            char path_app0[o + sizeof(\"/app0/sce_module/\")];\n            for(size_t i = 0; i < sizeof(\"/app0/\"); i++)\n                path_app0[i] = \"/app0/\"[i];\n            for(size_t i = 0; i <= o; i++)\n                path_app0[i + sizeof(\"/app0/\") - 1] = name[i];\n            fd = open(path_app0, O_RDONLY);\n            if(fd < 0)\n            {\n                for(size_t i = 0; i < sizeof(\"/app0/sce_module/\"); i++)\n                    path_app0[i] = \"/app0/sce_module/\"[i];\n                for(size_t i = 0; i <= o; i++)\n                    path_app0[i + sizeof(\"/app0/sce_module/\") - 1] = name[i];\n                fd = open(path_app0, O_RDONLY);\n                if(fd < 0)\n                    return -1;\n            }\n        }\n    }\n    unsigned long long shit[4];\n    if(read(fd, shit, sizeof(shit)) != sizeof(shit))\n    {\n        close(fd);\n        return -1;\n    }\n    off_t o2 = 0x20*((shit[3]&0xffff)+1);\n    lseek(fd, o2, SEEK_SET);\n    unsigned long long ehdr[8];\n    if(read(fd, ehdr, sizeof(ehdr)) != sizeof(ehdr))\n    {\n        close(fd);\n        return -1;\n    }\n    off_t phdr_offset = o2 + ehdr[4];\n    int nphdr = ehdr[7] & 0xffff;\n    unsigned long long eh_frame = -1;\n    unsigned long long dynamic = -1;\n    lseek(fd, phdr_offset, SEEK_SET);\n    for(int i = 0; i < nphdr; i++)\n    {\n        unsigned long long phdr[7];\n        if(read(fd, phdr, sizeof(phdr)) != sizeof(phdr))\n        {\n            close(fd);\n            return -1;\n        }\n        unsigned long long addr = phdr[2];\n        int ptype = phdr[0] & 0xffffffff;\n        if(ptype == 2)\n            dynamic = addr;\n        else if(ptype == 0x6474e550)\n            eh_frame = addr;\n    }\n    close(fd);\n    if(dynamic == -1 || eh_frame == -1)\n        return -1;\n    addrs[0] = eh_frame;\n    addrs[1] = dynamic;\n    return 0;\n}\n\nstatic int handle_lib(pkt_opaque o, srv_opaque p, const char* name, unsigned long long eh_frame)\n{\n    size_t l = 0;\n    while(name[l])\n        l++;\n    unsigned long long ptrs[2];\n    if(get_elf_offsets(name, ptrs))\n        return -1;\n    unsigned long long base = eh_frame - ptrs[0];\n    unsigned long long dyn = base + ptrs[1];\n    serve_genfn_emit(o, p, \"<library name=\\\"\", 15);\n    serve_genfn_emit(o, p, name, l);\n    char buf[] = \"\\\" l_addr=\\\"0xXXXXXXXXXXXX\\\" lm=\\\"0\\\" l_ld=\\\"0xXXXXXXXXXXXX\\\" lmid=\\\"1\\\"/>\";\n    for(int i = 0; i < 12; i++)\n    {\n        buf[i + 12] = \"0123456789abcdef\"[(base >> (44 - 4 * i)) & 15];\n        buf[i + 41] = \"0123456789abcdef\"[(dyn >> (44 - 4 * i)) & 15];\n    }\n    serve_genfn_emit(o, p, buf, sizeof(buf) - 1);\n    return 0;\n}\n\nint dynlib_get_list(uint32_t* handles, size_t num, size_t* actual_num);\n\nstruct module_segment\n{\n    uint64_t addr;\n    uint32_t size;\n    uint32_t flags;\n};\n\nstruct module_info_ex\n{\n    size_t st_size;\n    char name[256];\n    int id;\n    uint32_t tls_index;\n    uint64_t tls_init_addr;\n    uint32_t tls_init_size;\n    uint32_t tls_size;\n    uint32_t tls_offset;\n    uint32_t tls_align;\n    uint64_t init_proc_addr;\n    uint64_t fini_proc_addr;\n    uint64_t reserved1;\n    uint64_t reserved2;\n    uint64_t eh_frame_hdr_addr;\n    uint64_t eh_frame_addr;\n    uint32_t eh_frame_hdr_size;\n    uint32_t eh_frame_size;\n    struct module_segment segments[4];\n    uint32_t segment_count;\n    uint32_t ref_count;\n};\n\nint dynlib_get_info_ex(uint32_t handle, int unknown, struct module_info_ex* info);\n\nint try_list_libs(pkt_opaque o, srv_opaque p, size_t sz)\n{\n    uint32_t handles[sz];\n    size_t nlibs = sz;\n    if(dynlib_get_list(handles, sz, &nlibs))\n    {\n        if(errno == ENOMEM)\n            return 1;\n        return -1;\n    }\n    for(size_t i = 0; i < nlibs; i++)\n    {\n        struct module_info_ex ex;\n        ex.st_size = sizeof(ex);\n        if(dynlib_get_info_ex(handles[i], 0, &ex))\n            continue;\n        handle_lib(o, p, ex.name, ex.eh_frame_hdr_addr);\n    }\n    return 0;\n}\n\nvoid list_libs(pkt_opaque o)\n{\n    srv_opaque p;\n    serve_genfn_start(o, p, 1);\n    serve_genfn_emit(o, p, \"<library-list-svr4 version=\\\"1.0\\\">\", 33);\n    size_t nlibs = 1;\n    int ret;\n    while((ret = try_list_libs(o, p, nlibs)) == 1)\n        nlibs *= 2;\n    serve_genfn_emit(o, p, \"</library-list-svr4>\", 20);\n    serve_genfn_end(o, p);\n}\n\nvoid kexec(void*, void*);\nasm(\"kexec:\\nmov $11,%rax\\nmov %rcx, %r10\\nsyscall\\nret\");\n\nstatic void k_set_budget(int** td, int** uap)\n{\n    int tmp = uap[1][0];\n    uap[1][0] = td[1][701];\n    td[1][701] = tmp;\n}\n\nstatic void k_set_sony_cred(uint64_t** td, uint64_t** uap)\n{\n    uint64_t tmp = uap[1][0];\n    uap[1][0] = td[38][11];\n    td[38][11] = tmp;\n}\n\nvoid ps4_xchg_budget(int* bb)\n{\n    kexec(k_set_budget, bb);\n}\n\nvoid ps4_xchg_sony_cred(uint64_t* cred)\n{\n    kexec(k_set_sony_cred, cred);\n}\n"
  },
  {
    "path": "gdb_stub/r0hooks.asm",
    "content": "use64\n\nglobal r0hook_start\nglobal r0hook_int1\nglobal r0hook_int3\nglobal r0hook_real_int1\nglobal r0hook_real_int3\nglobal r0hook_mailbox\nglobal r0hook_end\n\n;; TODO: be more efficient than a busy loop\n\nsection .text\n\nr0hook_start:\n\nr0hook_int1:\ntest byte [rsp+8], 3\njnz r0hook_go_real1\npush dword 1\njmp r0hook_entry\n\nr0hook_int3:\ntest byte [rsp+8], 3\njnz r0hook_go_real3\npush dword 2\n; fallthrough\n\nr0hook_entry:\n; move to the caller's stack and enable interrupts\ncld\nsub rsp, 48\npush rdi\npush rsi\npush rcx\nlea rdi, [rsp+24]\nlea rsi, [rsp+72]\nmov ecx, 6\nrep movsq\nmov rdi, [rsp+56]\nsub rdi, 48\nlea rsi, [rsp+24]\nmov ecx, 6\nrep movsq\npop rcx\npop rsi\npop rdi\nmov rsp, [rsp+32]\nsub rsp, 48\n\nr0hook_main:\nxchg rax, [rsp]\npush rcx\npush rdx\npush rbx\npush rax ; interrupt no\npush rbp\npush rsi\npush rdi\npush r8\npush r9\npush r10\npush r11\npush r12\npush r13\npush r14\npush r15\n\ncmpxchg_loop:\ncli\nmov rax, cr0\nbtc rax, 16\nmov cr0, rax\nxor eax, eax\nlock cmpxchg [rel r0hook_mailbox], rsp\nsete al\nmov rax, cr0\nbts rax, 16\nmov cr0, rax\nsti\ntest al, al\njz cmpxchg_loop\n\nr0hook_loop:\ncmp qword [rel r0hook_mailbox], 1\njnz r0hook_loop\n\ncli\nmov rax, cr0\nbtc rax, 16\nmov cr0, rax\nmov qword [rel r0hook_mailbox], 0\nmov rax, cr0\nbts rax, 16\nmov cr0, rax\nsti\n\npop r15\npop r14\npop r13\npop r12\npop r11\npop r10\npop r9\npop r8\npop rdi\npop rsi\npop rbp\npop rax\npop rbx\npop rdx\npop rcx\npop rax\niretq\n\nr0hook_go_real1:\njmp [rel r0hook_real_int1]\n\nr0hook_go_real3:\njmp [rel r0hook_real_int3]\n\nr0hook_real_int1:\ndq 0\n\nr0hook_real_int3:\ndq 0\n\nr0hook_mailbox:\ndq 0\n\nr0hook_end:\n"
  },
  {
    "path": "gdb_stub/ring0.c",
    "content": "#include <sys/types.h>\n#include <sys/thr.h>\n#include <sys/mman.h>\n#include <stdint.h>\n#include \"trap_state.h\"\n\nextern char r0hook_start[];\nextern char r0hook_int1[];\nextern char r0hook_int3[];\nextern char r0hook_real_int1[];\nextern char r0hook_real_int3[];\nextern char r0hook_mailbox[];\nextern char r0hook_end[];\n\nvoid kexec(void*, void*);\n\nstatic uintptr_t replace_interrupt(int which, uintptr_t new)\n{\n    struct\n    {\n        uint16_t size;\n        uint16_t* ptr;\n    } __attribute__((packed)) idtr;\n    asm volatile(\"sidt (%0)\"::\"r\"(&idtr));\n    uintptr_t old = (uintptr_t)idtr.ptr[which*8+5] << 48\n                  | (uintptr_t)idtr.ptr[which*8+4] << 32\n                  | (uintptr_t)idtr.ptr[which*8+3] << 16\n                  | (uintptr_t)idtr.ptr[which*8];\n    idtr.ptr[which*8] = new;\n    idtr.ptr[which*8+3] = new >> 16;\n    idtr.ptr[which*8+4] = new >> 32;\n    idtr.ptr[which*8+5] = new >> 48;\n    return old;\n}\n\nstatic volatile char* get_r0hook_base(void)\n{\n    static volatile char* ans;\n    if(ans)\n        return ans;\n    uint32_t high;\n    uint32_t low;\n    asm volatile(\"rdmsr\":\"=a\"(low),\"=d\"(high):\"c\"(0xc0000082));\n    char* kernel_base = (char*)(((uint64_t)high) << 32 | low) - 0x1c0; //elf header should be safe to overwrite\n    char* phdr = kernel_base + *(uint64_t*)(kernel_base + 32);\n    uint16_t phnum = *(uint16_t*)(kernel_base + 56);\n    for(size_t i = 0; i < phnum; i++)\n    {\n        char* phent = phdr + 56 * i;\n        if(*(uint32_t*)phent == 2)\n        {\n            char* dyn_start_c = *(char**)(phent+16);\n            char* dyn_end_c = dyn_start_c + *(uint64_t*)(phent+40);\n            uint64_t* dyn_start = (uint64_t*)dyn_start_c;\n            uint64_t* dyn_end = (uint64_t*)dyn_end_c;\n            for(uint64_t* cur = dyn_start; cur + 2 <= dyn_end; cur += 2)\n            {\n                if(cur[0] == 0x61000025)\n                    return ans = (volatile char*)(kernel_base + (cur[1] - 0xffffffff82200000));\n            }\n        }\n    }\n    *(void* volatile*)0;\n}\n\n#define DISABLE_WP() asm volatile(\"cli\\nmov %%cr0, %%rax\\nbtc $16, %%rax\\nmov %%rax, %%cr0\":::\"rax\")\n#define ENABLE_WP() asm volatile(\"mov %%cr0, %%rax\\nbts $16, %%rax\\nmov %%rax, %%cr0\\nsti\":::\"rax\")\n\nstatic void install_code(void)\n{\n    volatile char* kernel_base = get_r0hook_base();\n    DISABLE_WP();\n    for(char* i = r0hook_start; i < r0hook_end; i++)\n        kernel_base[i - r0hook_start] = *i;\n    *(volatile uint64_t*)(kernel_base + (r0hook_real_int1 - r0hook_start)) = replace_interrupt(1, (uintptr_t)(kernel_base + (r0hook_int1 - r0hook_start)));\n    *(volatile uint64_t*)(kernel_base + (r0hook_real_int3 - r0hook_start)) = replace_interrupt(3, (uintptr_t)(kernel_base + (r0hook_int3 - r0hook_start)));\n    ENABLE_WP();\n}\n\nstruct mailbox\n{\n    uint64_t r15;\n    uint64_t r14;\n    uint64_t r13;\n    uint64_t r12;\n    uint64_t r11;\n    uint64_t r10;\n    uint64_t r9;\n    uint64_t r8;\n    uint64_t rdi;\n    uint64_t rsi;\n    uint64_t rbp;\n    uint64_t int_no;\n    uint64_t rbx;\n    uint64_t rdx;\n    uint64_t rcx;\n    uint64_t rax;\n    uint64_t rip;\n    uint64_t cs;\n    uint64_t rflags;\n    uint64_t rsp;\n    uint64_t ss;\n};\n\nstatic void read_mailbox(void* p, struct mailbox*** dst)\n{\n    volatile char* kernel_base = get_r0hook_base();\n    dst[1][0] = *(struct mailbox* volatile*)(kernel_base + (r0hook_mailbox - r0hook_start));\n}\n\nstatic void write_mailbox(void* p, struct mailbox** src)\n{\n    volatile char* kernel_base = get_r0hook_base();\n    DISABLE_WP();\n    *(struct mailbox* volatile*)(kernel_base + (r0hook_mailbox - r0hook_start)) = src[1];\n    ENABLE_WP();\n}\n\nstatic void copy_from_kernel(void* p, struct mailbox*** q)\n{\n    q[1][0][0] = q[1][1][0];\n}\n\nstatic void copy_to_kernel(void* p, struct mailbox*** q)\n{\n    DISABLE_WP();\n    q[1][1][0] = q[1][0][0];\n    ENABLE_WP();\n}\n\nextern int in_signal_handler;\n\nint gdbstub_main_loop(struct trap_state* ts, ssize_t* result, int* ern);\n\nstatic void ring0_mailbox_thread(void* ptr)\n{\n    for(;;)\n    {\n        struct mailbox* mb;\n        while(!(kexec(read_mailbox, &mb), mb && mb != (struct mailbox*)1));\n        struct mailbox data;\n        void* req[2] = {&data, mb};\n        kexec(copy_from_kernel, req);\n        struct trap_state ts = {\n            .trap_signal = SIGTRAP,\n            .regs = {\n                .rax = data.rax,\n                .rcx = data.rcx,\n                .rdx = data.rdx,\n                .rbx = data.rbx,\n                .rsp = data.rsp,\n                .rbp = data.rbp,\n                .rsi = data.rsi,\n                .rdi = data.rdi,\n                .r8 = data.r8,\n                .r9 = data.r9,\n                .r10 = data.r10,\n                .r11 = data.r11,\n                .r12 = data.r12,\n                .r13 = data.r13,\n                .r14 = data.r14,\n                .r15 = data.r15,\n                .rip = data.rip,\n                .cs = data.cs,\n                .eflags = data.rflags & ~256ull,\n                .ss = data.cs,\n            },\n        };\n        if(data.int_no == 3)\n            ts.regs.rip--;\n        while(__atomic_exchange_n(&in_signal_handler, 1, __ATOMIC_ACQUIRE));\n        gdbstub_main_loop(&ts, 0, 0);\n        __atomic_exchange_n(&in_signal_handler, 0, __ATOMIC_RELEASE);\n#ifdef INTERRUPTER_THREAD\n        {\n            void start_interrupter_thread(void);\n            start_interrupter_thread();\n        }\n#endif\n        data.rax = ts.regs.rax;\n        data.rcx = ts.regs.rcx;\n        data.rdx = ts.regs.rdx;\n        data.rbx = ts.regs.rbx;\n        data.rsp = ts.regs.rsp;\n        data.rbp = ts.regs.rbp;\n        data.rsi = ts.regs.rsi;\n        data.rdi = ts.regs.rdi;\n        data.r8 = ts.regs.r8;\n        data.r9 = ts.regs.r9;\n        data.r10 = ts.regs.r10;\n        data.r11 = ts.regs.r11;\n        data.r12 = ts.regs.r12;\n        data.r13 = ts.regs.r13;\n        data.r14 = ts.regs.r14;\n        data.r15 = ts.regs.r15;\n        data.rip = ts.regs.rip;\n        data.rflags = ts.regs.eflags;\n        kexec(copy_to_kernel, req);\n        mb = (struct mailbox*)1;\n        kexec(write_mailbox, mb);\n    }\n}\n\nvoid start_ring0(void)\n{\n    char* stack = mmap(0, 16384, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANON, -1, 0);\n    long x, y;\n    struct thr_param param = {\n        .start_func = ring0_mailbox_thread,\n        .arg = 0,\n        .stack_base = stack,\n        .stack_size = 16384,\n        .tls_base = 0,\n        .tls_size = 0,\n        .child_tid = &x,\n        .parent_tid = &y,\n        .flags = 0,\n        .rtp = 0\n    };\n    thr_new(&param, sizeof(param));\n}\n\nvoid install_ring0(void)\n{\n    kexec(install_code, 0);\n}\n"
  },
  {
    "path": "gdb_stub/strace.c",
    "content": "#define sysctl __sysctl\n#include <sys/types.h>\n#include <sys/sysctl.h>\n#include <unistd.h>\n#include <sys/mman.h>\n#include <sys/thr.h>\n#include <sys/socket.h>\n#include \"dbg.h\"\n\nint is_syscall_wrapper(uint8_t* p)\n{\n    if(p[0] == 0x48\n    && p[1] == 0xc7\n    && p[2] == 0xc0\n    && p[7] == 0x49\n    && p[8] == 0x89\n    && p[9] == 0xca\n    && p[10] == 0x0f\n    && p[11] == 0x05)\n        return *(volatile int32_t*)(p+3);\n    return -1;\n}\n\nstatic int strace_pipe[2];\n\nvoid log_syscall_args(uint64_t* args)\n{\n    char buf[256];\n    char* p = buf;\n    uint64_t nr = args[0];\n    uint64_t i = 1;\n    while((i * 10) / 10 == i && nr / i >= 10)\n        i *= 10;\n    while(i)\n    {\n        *p++ = '0' + (nr / i) % 10;\n        i /= 10;\n    }\n    *p++ = '(';\n    for(int i = 1; i <= 6; i++)\n    {\n        uint64_t q = args[i];\n        *p++ = '0';\n        *p++ = 'x';\n        int j = 0;\n        while(j < 60 && (q >> j) >= 16)\n            j += 4;\n        for(; j >= 0; j -= 4)\n            *p++ = \"0123456789abcdef\"[(q >> j) & 15];\n        if(i != 6)\n        {\n            *p++ = ',';\n            *p++ = ' ';\n        }\n    }\n    *p++ = ')';\n    write(strace_pipe[1], buf, p-buf);\n}\n\nvoid log_syscall_ans(uint64_t ans, uint64_t flags)\n{\n    char buf[64];\n    char* p = buf;\n    *p++ = ' ';\n    *p++ = '=';\n    *p++ = ' ';\n    if((flags & 1))\n    {\n        char* s = \"-1, errno = \";\n        while(*s)\n            *p++ = *s++;\n        uint64_t q = 1;\n        while((q * 10) / 10 == q && ans / q >= 10)\n            q *= 10;\n        while(q)\n        {\n            *p++ = '0' + (ans / q) % 10;\n            q /= 10;\n        }\n    }\n    else\n    {\n        *p++ = '0';\n        *p++ = 'x';\n        int i = 0;\n        while(i < 60 && (ans >> i) >= 16)\n            i += 4;\n        for(; i >= 0; i -= 4)\n            *p++ = \"0123456789abcdef\"[(ans >> i) & 15];\n    }\n    *p++ = '\\n';\n    write(strace_pipe[1], buf, p-buf);\n}\n\nextern char strace_log_start[];\nextern char strace_log_end[];\n\nvoid strace_thread(void* arg)\n{\n    char buf[1024];\n    ssize_t chk;\n    for(;;)\n    {\n        chk = read(strace_pipe[0], buf, 1024);\n        if(chk > 0)\n            gdb_remote_syscall(\"write\", 3, NULL, (uintptr_t)2, (uintptr_t)buf, (uintptr_t)chk);\n    }\n}\n\nvoid start_strace(char* start, char* end)\n{\n    socketpair(AF_UNIX, SOCK_STREAM, 0, strace_pipe);\n    long x, y;\n    struct thr_param param = {\n        .start_func = strace_thread,\n        .arg = NULL,\n        .stack_base = mmap(0, 65536, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0),\n        .stack_size = 65536,\n        .tls_base = NULL,\n        .tls_size = 0,\n        .child_tid = &x,\n        .parent_tid = &y,\n        .flags = 0,\n        .rtp = NULL,\n    };\n    thr_new(&param, sizeof(param));\n    size_t nsys = 0;\n    for(char* i = start; i + 12 <= end; i++)\n        if(is_syscall_wrapper((uint8_t*)i) >= 0)\n        {\n            nsys++;\n            i += 11;\n        }\n    size_t jitsz = nsys * (6+2+6+8+8+8+4);\n    void* jit = mmap(0, jitsz, PROT_READ|PROT_WRITE|PROT_EXEC, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0);\n    char* jitp = jit;\n    for(char* i = start; i + 12 <= end; i++)\n    {\n        int sysno;\n        if((sysno = is_syscall_wrapper((uint8_t*)i)) >= 0)\n        {\n            char* addr = jitp;\n            *jitp++ = 0xff;\n            *jitp++ = 0x15;\n            *jitp++ = 2+6;\n            *jitp++ = 0;\n            *jitp++ = 0;\n            *jitp++ = 0;\n            *jitp++ = 0x0f;\n            *jitp++ = 0x05;\n            *jitp++ = 0xff;\n            *jitp++ = 0x15;\n            *jitp++ = 8;\n            *jitp++ = 0;\n            *jitp++ = 0;\n            *jitp++ = 0;\n            *(uint64_t*)jitp = (uint64_t)strace_log_start;\n            *(uint64_t*)(jitp+8) = (uint64_t)strace_log_end;\n            *(uint64_t*)(jitp+16) = (uint64_t)(i+12);\n            *(int32_t*)(jitp+24) = sysno;\n            jitp += 28;\n            uint64_t low = (uint64_t)i;\n            uint64_t high = (uint64_t)(i+12);\n            mprotect((void*)(low & ~0x3fffull), high-low, PROT_READ|PROT_WRITE|PROT_EXEC);\n            *(uint16_t*)i = 0xfeeb;\n            *(uint64_t*)(i+2) = (uint64_t)addr;\n            *(uint16_t*)(i+10) = 0xe0ff;\n            *(uint16_t*)i = 0xb848;\n            i += 11;\n        }\n    }\n}\n"
  },
  {
    "path": "gdb_stub/strace_asm.asm",
    "content": "use64\n\nextern log_syscall_args\nextern log_syscall_ans\nglobal strace_log_start\nglobal strace_log_end\n\n;; hook format:\n; call strace_log_start ; 6 bytes\n; syscall ; 2 bytes\n; call strace_log_end ; 6 bytes\n; dq strace_log_start ; 8 bytes\n; dq strace_log_end ; 8 bytes\n; dq jump_next ; 8 bytes\n; dd sysc ; 4 bytes\n\nstrace_log_start:\nmov rax, [rsp]\nmov eax, [rax+32]\npush r9\npush r8\npush rcx\npush rdx\npush rsi\npush rdi\npush rax\nmov rdi, rsp\npush rbp\nmov rbp, rsp\nand rsp, -16\ncall log_syscall_args\nleave\npop rax\npop rdi\npop rsi\npop rdx\npop r10\npop r8\npop r9\nret\n\nstrace_log_end:\npush rax\npush rdx\npush rsi\npush rdi\npushfq\nmov rdi, rax\nmov rsi, [rsp]\npush rbp\nmov rbp, rsp\nand rsp, -16\ncall log_syscall_ans\nleave\npopfq\npop rdi\npop rsi\npop rdx\npop rax\npop r11\njmp [r11+16]\n"
  },
  {
    "path": "gdb_stub/trap_state.h",
    "content": "#pragma once\n\nstruct regs\n{\n    unsigned long long rax;\n    unsigned long long rbx;\n    unsigned long long rcx;\n    unsigned long long rdx;\n    unsigned long long rsi;\n    unsigned long long rdi;\n    unsigned long long rbp;\n    unsigned long long rsp;\n    unsigned long long r8;\n    unsigned long long r9;\n    unsigned long long r10;\n    unsigned long long r11;\n    unsigned long long r12;\n    unsigned long long r13;\n    unsigned long long r14;\n    unsigned long long r15;\n    unsigned long long rip;\n    unsigned int eflags;\n    unsigned int cs;\n    unsigned int ss;\n    unsigned int ds;\n    unsigned int es;\n    unsigned int fs;\n    unsigned int gs;\n};\n\nstruct trap_state\n{\n    int trap_signal;\n    struct regs regs;\n};\n"
  },
  {
    "path": "lib/Makefile",
    "content": "all: lib.a lib-ps5.a lib-elf.a lib-elf-ps5.a\n\nclean:\n\trm -f lib.a lib-*.a *.o syscalls.asm syscalls-ps5.asm\n\ndl.o: dl.c\n\tgcc -c -isystem ../freebsd-headers -nostdinc -fno-stack-protector dl.c -o dl.o -fPIE -ffreestanding\n\ncrt-elf-c.o: crt-elf-c.c\n\tgcc -c -isystem ../freebsd-headers -nostdinc -fno-stack-protector -O3 crt-elf-c.c -o crt-elf-c.o -fPIE -ffreestanding\n\ncrt.o: crt.asm\n\tyasm -f elf64 crt.asm\n\ncrt-elf.o: crt-elf.asm\n\tyasm -f elf64 crt-elf.asm\n\nrfork.o: rfork.asm\n\tyasm -f elf64 rfork.asm\n\nsyscalls.o: syscalls.asm\n\tyasm -f elf64 syscalls.asm\n\nsyscalls.asm: syscalls.py syscalls.txt\n\tpython3 syscalls.py > syscalls.asm\n\nsyscalls-ps5.o: syscalls-ps5.asm\n\tyasm -f elf64 syscalls-ps5.asm\n\nsyscalls-ps5.asm: syscalls-ps5.py\n\tpython3 syscalls-ps5.py > syscalls-ps5.asm\n\nlib.a: crt.o rfork.o dl.o syscalls.o\n\tld -r crt.o rfork.o dl.o syscalls.o -o lib.a\n\nlib-ps5.a: crt.o dl.o syscalls-ps5.o\n\tld -r crt.o dl.o syscalls-ps5.o -o lib-ps5.a\n\nlib-elf.a: crt-elf.o crt-elf-c.o dl.o syscalls.o\n\tld -r crt-elf.o crt-elf-c.o dl.o syscalls.o -o lib-elf.a\n\nlib-elf-ps5.a: crt-elf.o crt-elf-c.o dl.o syscalls-ps5.o\n\tld -r crt-elf.o crt-elf-c.o dl.o syscalls-ps5.o -o lib-elf-ps5.a\n"
  },
  {
    "path": "lib/crt-elf-c.c",
    "content": "#include <sys/types.h>\n\nstruct specter_args\n{\n    void* dlsym;\n    int* pipe;\n    int* rwpair;\n    uint64_t kpipe_addr;\n    uint64_t kdata_base;\n    int* retval;\n};\n\nuint64_t _start(void* dlsym, int master, int victim, uint64_t pktopts, uint64_t kdata_base);\n\nvoid elf_main(struct specter_args* args)\n{\n    *args->retval = _start(args->dlsym, args->rwpair[0], args->rwpair[1], 0, args->kdata_base);\n}\n"
  },
  {
    "path": "lib/crt-elf.asm",
    "content": "use64\n\nglobal _start\nextern main\nextern addr__dynlib_dlsym\nextern elf_main\nextern _end\n\nsection .text.startup ; needed for correct linkage with -O2\n\n_start:\njmp start2\ndb 'E', 'L', 'F' ; internal magic for the patcher script\ndq _sdata-_start\nstart2:\njmp start3\n\ntimes 24-($-_start) db 0\ndq elf_main-_start\ndq 64\n\ntimes 56-($-_start) db 0\ndw 2\n\ntimes 64-($-_start) db 0\n\n; segment 1 -- rx\ndd 1\ndd 5\ndq 0\ndq 0\ndq 0\ndq _sdata-_start\ndq _sdata-_start\ndq 0\n\n; segment 2 -- rw\ndd 1\ndd 6\ndq _sdata-_start\ndq _sdata-_start\ndq _sdata-_start\ndq _end-_start\ndq _end-_start\ndq 0\n\nstart3:\nmov [rel addr__dynlib_dlsym], rdi\njmp main\n\nsection .data\n_sdata:\ndb 1\n"
  },
  {
    "path": "lib/crt.asm",
    "content": "use64\n\nglobal _start\nglobal rfork\nextern main\nextern addr__dynlib_dlsym\n\nsection .text.startup ; needed for correct linkage with -O2\n\n_start:\njmp start2\ndb 'P', 'L', 'D'\ndq _sdata-_start\nstart2:\nmov [rel addr__dynlib_dlsym], rdi\njmp main\n\nsection .data\n_sdata:\ndb 1\n"
  },
  {
    "path": "lib/dl.c",
    "content": "// https://gist.github.com/flatz/1055a8d7819c8478db1b464842582c9c\n#include <sys/types.h>\n#include <stddef.h>\n\nint (*p_sceKernelLoadStartModule)(const char* path, long, long, long, long, long);\n\nint dynlib_dlsym(int, const char*, void**);\n\nvoid* dlsym(void* handle, const char* name)\n{\n    void* addr = 0;\n    dynlib_dlsym((int)(long long)handle, name, &addr);\n    return addr;\n}\n\nvoid* dlopen(const char* path, int mode)\n{\n    if(!p_sceKernelLoadStartModule)\n        p_sceKernelLoadStartModule = dlsym((void*)0x1, \"sceKernelLoadStartModule\");\n    return (void*)(long long)p_sceKernelLoadStartModule(path, 0, 0, 0, 0, 0);\n}\n"
  },
  {
    "path": "lib/frankenelf.py",
    "content": "import sys\n\nwith open(sys.argv[1], 'r+b') as file:\n    assert file.read(5) == b'\\xeb\\x0bELF'\n    file.seek(0)\n    file.write(b'\\xeb\\x0bPLD')\n    file.seek(64+56+16)\n    vaddr = int.from_bytes(file.read(8), 'little')\n    file.seek(64+56+32)\n    filesz = (int.from_bytes(file.read(8), 'little') - vaddr).to_bytes(8, 'little')\n    memsz = (int.from_bytes(file.read(8), 'little') - vaddr).to_bytes(8, 'little')\n    file.seek(64+56+32)\n    file.write(filesz)\n    file.write(memsz)\n    end = file.seek(0, 2)\n    file.write(bytes((-end) % 4))\n"
  },
  {
    "path": "lib/rfork.asm",
    "content": "section .text.rfork\n\nextern rfork_thread\n\nrfork:\npush rbp\npush rbx\npush r12\npush r13\npush r14\npush r15\npush rax\nmov rsi, rsp\nlea rdx, [rel .child_thunk]\nmov rcx, rsp\ncall rfork_thread\n.exit:\npop r15\npop r15\npop r14\npop r13\npop r12\npop rbx\npop rbp\nret\n.child_thunk:\nmov rsp, rdi\nxor eax, eax\njmp .exit\n"
  },
  {
    "path": "lib/syscalls-ps5.py",
    "content": "import urllib.request, http.client, html\n\ndef get_freebsd_syscalls():\n    data = urllib.request.urlopen('https://raw.githubusercontent.com/freebsd/freebsd/stable/9/sys/kern/syscalls.master').read().decode('ascii')\n    data = '\\n'.join(i.strip() for i in data.split('\\n') if not i.startswith(';')).replace('\\\\\\n', ' ')\n    assert data.startswith('$FreeBSD$\\n')\n    data = data[10:]\n    ans = {}\n    for i in data.split('\\n'):\n        i = i.strip()\n        if not i or 'STD' not in i.split() or i.startswith('#include'): continue\n        name = i.split('(', 1)[0].split()[-1]\n        idx = int(i.split()[0])\n        ans[idx] = name\n    return ans\n\ndef get_sony_syscalls():\n    # TODO: PS5-specific syscalls\n    r = urllib.request.urlopen('http://web.archive.org/web/20210124215126js_/https://psdevwiki.com/ps4/edit/Syscalls')\n    data = html.unescape(r.read().decode('latin-1').split('<textarea ', 1)[1].split('</textarea>', 1)[0])\n    ans = {}\n    for i in data.split('\\n'):\n        if i.startswith('| '):\n            try:\n                syscno, fw, syscname, proto, notes = i[2:].split(' || ')\n                syscno = int(syscno)\n            except ValueError: continue\n            if syscname.startswith('sys_'):\n                ans[syscno] = syscname[4:]\n    return ans\n\ndef get_syscalls():\n    ans = {}\n    ans.update(get_freebsd_syscalls())\n    ans.update(get_sony_syscalls())\n    return ans\n\nprint('section .text')\nprint('use64')\nprint('global p_syscall')\nprint()\n\nfor idx, name in sorted(get_syscalls().items()):\n    if '#' in name: continue\n    print('section .text.'+name+' exec')\n    print('global', name)\n    print(name+':')\n    print('mov eax,', idx)\n    if name == 'pipe':\n        print('push rbp')\n        print('call common_syscall')\n        print('pop rbp')\n        print('cmp eax, -1')\n        print('jz .skip_write')\n        print('mov [rdi], eax')\n        print('mov [rdi+4], edx')\n        print('xor eax, eax')\n        print('.skip_write:')\n        print('ret')\n    else:\n        print('jmp common_syscall')\n\nprint('''\\\nsection .text.common_syscall exec\ncommon_syscall:\nmov r10, [rel p_syscall]\ntest r10, r10\njnz .jmp\npush rdi\npush rsi\npush rdx\npush rcx\npush r8\npush r9\npush rax\npush rax\nmov r10, [rel addr__dynlib_dlsym]\npush r10\nmov edi, 0x1\nlea rsi, [rel getpid_str]\nmov rdx, rsp\ncall r10\npop r10\npop rax\npop rax\npop r9\npop r8\npop rcx\npop rdx\npop rsi\npop rdi\nadd r10, 7\nmov [rel p_syscall], r10\n.jmp:\njmp r10\n\nsection .text.__error exec\nglobal __error\n__error:\nmov r10, [rel addr____error]\ntest r10, r10\njnz .have_error\npush rax\nmov edi, 0x1\nlea rsi, [rel error_str]\nmov rdx, rsp\ncall [rel addr__dynlib_dlsym]\npop r10\n.have_error:\njmp r10\n\nsection .text.syscall exec\nglobal syscall\n$syscall:\nmov rax, rdi\nmov rdi, rsi\nmov rsi, rdx\nmov rdx, rcx\nmov rcx, r8\nmov r8, r9\nmov r9, [rsp+8]\njmp common_syscall\n\nsection .rodata.getpid_str\ngetpid_str:\ndb \"getpid\", 0\n\nsection .rodata.error_str\nerror_str:\ndb \"__error\", 0\n\nsection .bss.addr__dynlib_dlsym\nglobal addr__dynlib_dlsym\naddr__dynlib_dlsym:\ndq 0\n\nsection .bss.addr____error\nglobal addr____error\naddr____error:\ndq 0\n\nsection .bss.p_syscall\np_syscall:\ndq 0\\\n''')\n"
  },
  {
    "path": "lib/syscalls.py",
    "content": "import urllib.request, http.client, html\n\nprint('global addr__dynlib_dlsym')\nprint('use64')\n\nwith open('syscalls.txt') as file:\n    for l in map(str.split, file):\n        if not l: continue\n        i, j = l\n        if j == 'UNKNOWN' or j == 'MISSING' or j == 'HIDDEN':\n            continue\n        print('section .text.'+i, 'exec')\n        print('global', i)\n        print(i+':')\n        print('cmp qword [rel addr__'+i+'], 0')\n        print('jne .resolved')\n        print('push rdi')\n        print('push rsi')\n        print('push rdx')\n        print('push rcx')\n        print('push r8')\n        print('push r9')\n        print('push rax')\n        print('mov edi, 0x1')\n        print('lea rsi, [rel str__'+i+']')\n        print('lea rdx, [rel addr__'+i+']')\n        print('call [rel addr__dynlib_dlsym]')\n        print('pop rax')\n        print('pop r9')\n        print('pop r8')\n        print('pop rcx')\n        print('pop rdx')\n        print('pop rsi')\n        print('pop rdi')\n        print('.resolved:')\n        print('jmp [rel addr__'+i+']')\n        print('str__'+i+':')\n        print('db \"'+j+'\", 0')\n        print('section .bss.'+i)\n        print('addr__'+i+':')\n        print('dq 0')\n"
  },
  {
    "path": "lib/syscalls.txt",
    "content": "nosys MISSING\nsys_exit _exit\nfork fork\nread _read\nwrite _write\nopen _open\nclose _close\nwait4 _wait4\nlink link\nunlink unlink\nkexec MISSING\nchdir chdir\nfchdir fchdir\nmknod MISSING\nchmod chmod\nchown chown\nobreak MISSING\ngetpid getpid\nmount mount\nunmount unmount\nsetuid setuid\ngetuid getuid\ngeteuid geteuid\nptrace ptrace\nrecvmsg _recvmsg\nsendmsg _sendmsg\nrecvfrom _recvfrom\naccept _accept\ngetpeername _getpeername\ngetsockname _getsockname\naccess access\nchflags chflags\nfchflags fchflags\nsync sync\nkill kill\ngetppid getppid\ndup dup\npipe pipe\ngetegid getegid\nprofil profil\nktrace ktrace\ngetgid getgid\ngetlogin getlogin\nsetlogin setlogin\nacct MISSING\nsigaltstack sigaltstack\nioctl _ioctl\nreboot reboot\nrevoke revoke\nsymlink symlink\nreadlink readlink\nexecve _execve\numask umask\nchroot chroot\nmsync msync\nvfork vfork\nsbrk MISSING\nsstk MISSING\novadvise MISSING\nmunmap munmap\nmprotect mprotect\nmadvise madvise\nmincore mincore\ngetgroups getgroups\nsetgroups setgroups\ngetpgrp MISSING\nsetpgid setpgid\nsetitimer setitimer\nswapon swapon\ngetitimer getitimer\ngetdtablesize getdtablesize\ndup2 _dup2\nfcntl _fcntl\nselect select\nfsync fsync\nsetpriority setpriority\nsocket socket\nconnect _connect\nnetcontrol __sys_netcontrol\ngetpriority getpriority\nnetabort __sys_netabort\nnetgetsockinfo __sys_netgetsockinfo\nbind _bind\nsetsockopt _setsockopt\nlisten _listen\nsocketex __sys_socketex\nsocketclose __sys_socketclose\ngettimeofday gettimeofday\ngetrusage getrusage\ngetsockopt _getsockopt\nreadv _readv\nwritev _writev\nsettimeofday settimeofday\nfchown fchown\nfchmod fchmod\nnetgetiflist __sys_netgetiflist\nsetreuid setreuid\nsetregid setregid\nrename rename\nflock flock\nmkfifo HIDDEN\nsendto _sendto\nshutdown shutdown\nsocketpair socketpair\nmkdir mkdir\nrmdir rmdir\nutimes utimes\nadjtime HIDDEN\nkqueueex __sys_kqueueex\nsetsid setsid\nquotactl MISSING\nlgetfh MISSING\ngetfh MISSING\nsysarch sysarch\nrtprio MISSING\nfreebsd6_pread MISSING\nfreebsd6_pwrite MISSING\nsetfib MISSING\nntp_adjtime MISSING\nsetgid MISSING\nsetegid setegid\nseteuid seteuid\nstat stat\nfstat _fstat\nlstat lstat\npathconf pathconf\nfpathconf _fpathconf\ngetrlimit getrlimit\nsetrlimit setrlimit\ngetdirentries _getdirentries\nfreebsd6_mmap MISSING\nfreebsd6_lseek MISSING\nfreebsd6_truncate MISSING\nfreebsd6_ftruncate MISSING\n__sysctl sysctl\nmlock mlock\nmunlock munlock\nundelete MISSING\nfutimes futimes\ngetpgid MISSING\npoll poll\nclock_gettime clock_gettime\nclock_settime clock_settime\nclock_getres clock_getres\nktimer_create ktimer_create\nktimer_delete ktimer_delete\nktimer_settime ktimer_settime\nktimer_gettime ktimer_gettime\nktimer_getoverrun ktimer_getoverrun\nnanosleep _nanosleep\nclock_getcpuclockid2 MISSING\nntp_gettime MISSING\nminherit MISSING\nrfork HIDDEN\nopenbsd_poll MISSING\nissetugid issetugid\nlchown lchown\ngetdents getdents\nlchmod lchmod\nlutimes lutimes\nnstat MISSING\nnfstat MISSING\nnlstat MISSING\npreadv preadv\npwritev pwritev\nfhopen MISSING\nfhstat MISSING\nmodnext MISSING\nmodstat MISSING\nmodfnext MISSING\nmodfind MISSING\nkldload kldload\nkldunload kldunload\nkldfind kldfind\nkldnext kldnext\nkldstat kldstat\nkldfirstmod kldfirstmod\ngetsid getsid\nsetresuid MISSING\nsetresgid MISSING\nyield MISSING\nmlockall mlockall\nmunlockall munlockall\n__getcwd __getcwd\nsched_setparam sched_setparam\nsched_getparam sched_getparam\nsched_setscheduler sched_setscheduler\nsched_getscheduler sched_getscheduler\nsched_yield sched_yield\nsched_get_priority_max sched_get_priority_max\nsched_get_priority_min sched_get_priority_min\nsched_rr_get_interval sched_rr_get_interval\nutrace utrace\nkldsym kldsym\njail MISSING\nsigprocmask _sigprocmask\nsigsuspend _sigsuspend\nsigpending sigpending\nsigtimedwait sigtimedwait\nsigwaitinfo sigwaitinfo\n__acl_get_file MISSING\n__acl_set_file MISSING\n__acl_get_fd MISSING\n__acl_set_fd MISSING\n__acl_delete_file MISSING\n__acl_delete_fd MISSING\n__acl_aclcheck_file MISSING\n__acl_aclcheck_fd MISSING\nextattrctl MISSING\nextattr_set_file MISSING\nextattr_get_file MISSING\nextattr_delete_file MISSING\ngetresuid MISSING\ngetresgid MISSING\nkqueue kqueue\nkevent kevent\nextattr_set_fd MISSING\nextattr_get_fd MISSING\nextattr_delete_fd MISSING\n__setugid MISSING\neaccess MISSING\nnmount nmount\nmtypeprotect MISSING\n__mac_get_proc HIDDEN\n__mac_set_proc HIDDEN\n__mac_get_fd HIDDEN\n__mac_get_file HIDDEN\n__mac_set_fd HIDDEN\n__mac_set_file HIDDEN\nkenv kenv\nlchflags lchflags\nuuidgen uuidgen\nsendfile sendfile\nmac_syscall MISSING\ngetfsstat getfsstat\nstatfs statfs\nfstatfs _fstatfs\nfhstatfs MISSING\n__mac_get_pid HIDDEN\n__mac_get_link HIDDEN\n__mac_set_link HIDDEN\nextattr_set_link MISSING\nextattr_get_link MISSING\nextattr_delete_link MISSING\n__mac_execve HIDDEN\nsigaction _sigaction\nsigreturn sigreturn\ngetcontext getcontext\nsetcontext setcontext\nswapcontext swapcontext\nswapoff UNKNOWN\n__acl_get_link MISSING\n__acl_set_link MISSING\n__acl_delete_link MISSING\n__acl_aclcheck_link MISSING\nsigwait sigwait\nthr_create HIDDEN\nthr_exit HIDDEN\nthr_self HIDDEN\nthr_kill HIDDEN\n_umtx_lock HIDDEN\n_umtx_unlock HIDDEN\njail_attach MISSING\nextattr_list_fd MISSING\nextattr_list_file MISSING\nextattr_list_link MISSING\nthr_suspend HIDDEN\nthr_wake HIDDEN\nkldunloadf HIDDEN\naudit MISSING\nauditon MISSING\ngetauid MISSING\nsetauid MISSING\ngetaudit MISSING\nsetaudit MISSING\ngetaudit_addr MISSING\nsetaudit_addr MISSING\nauditctl MISSING\n_umtx_op _umtx_op\nthr_new HIDDEN\nsigqueue sigqueue\nabort2 MISSING\nthr_set_name HIDDEN\nrtprio_thread rtprio_thread\nsctp_peeloff MISSING\nsctp_generic_sendmsg MISSING\nsctp_generic_sendmsg_iov MISSING\nsctp_generic_recvmsg MISSING\npread pread\npwrite pwrite\nmmap mmap\nlseek lseek\ntruncate truncate\nftruncate ftruncate\nthr_kill2 HIDDEN\nshm_open shm_open\nshm_unlink shm_unlink\ncpuset cpuset\ncpuset_setid cpuset_setid\ncpuset_getid cpuset_getid\ncpuset_getaffinity cpuset_getaffinity\ncpuset_setaffinity cpuset_setaffinity\nfaccessat MISSING\nfchmodat fchmodat\nfchownat fchownat\nfexecve MISSING\nfstatat fstatat\nfutimesat futimesat\nlinkat linkat\nmkdirat mkdirat\nmkfifoat HIDDEN\nmknodat MISSING\nopenat _openat\nreadlinkat MISSING\nrenameat renameat\nsymlinkat symlinkat\nunlinkat unlinkat\nposix_openpt MISSING\njail_get MISSING\njail_set MISSING\njail_remove MISSING\nclosefrom MISSING\nlpathconf MISSING\ncap_new MISSING\ncap_getrights MISSING\ncap_enter MISSING\ncap_getmode MISSING\npdfork MISSING\npdkill MISSING\npdgetpid MISSING\npselect pselect\ngetloginclass MISSING\nsetloginclass MISSING\nrctl_get_racct MISSING\nrctl_get_rules MISSING\nrctl_get_limits MISSING\nrctl_add_rule MISSING\nrctl_remove_rule MISSING\nposix_fallocate MISSING\nposix_fadvise MISSING\nregmgr_call __sys_regmgr_call\njitshm_create HIDDEN\njitshm_alias HIDDEN\ndl_get_list __sys_dl_get_list\ndl_get_info __sys_dl_get_info\ndl_notify_event MISSING\nevf_create HIDDEN\nevf_delete HIDDEN\nevf_open HIDDEN\nevf_close HIDDEN\nevf_wait HIDDEN\nevf_trywait HIDDEN\nevf_set HIDDEN\nevf_clear HIDDEN\nevf_cancel HIDDEN\nquery_memory_protection sceKernelQueryMemoryProtection\nbatch_map sceKernelBatchMap\nosem_create HIDDEN\nosem_delete HIDDEN\nosem_open __sys_osem_open\nosem_close __sys_osem_close\nosem_wait HIDDEN\nosem_trywait HIDDEN\nosem_post HIDDEN\nosem_cancel HIDDEN\nnamedobj_create __sys_namedobj_create\nnamedobj_delete __sys_namedobj_delete\nset_vm_container sceKernelSetVmContainer\ndebug_init __sys_debug_init\nsuspend_process __sys_suspend_process\nresume_process __sys_resume_process\nopmc_enable __sys_opmc_enable\nopmc_disable __sys_opmc_disable\nopmc_set_ctl __sys_opmc_set_ctl\nopmc_set_ctr __sys_opmc_set_ctr\nopmc_get_ctr __sys_opmc_get_ctr\nbudget_create HIDDEN\nbudget_delete HIDDEN\nbudget_get HIDDEN\nbudget_set HIDDEN\nvirtual_query sceKernelVirtualQuery\nmdbg_call mdbg_call\nsblock_create HIDDEN\nsblock_delete HIDDEN\nsblock_enter HIDDEN\nsblock_exit HIDDEN\nsblock_xenter HIDDEN\nsblock_xexit HIDDEN\neport_create HIDDEN\neport_delete HIDDEN\neport_trigger HIDDEN\neport_open HIDDEN\neport_close HIDDEN\nis_in_sandbox is_in_sandbox\ndmem_container HIDDEN\nget_authinfo get_authinfo\nmname HIDDEN\ndynlib_dlopen HIDDEN\ndynlib_dlclose HIDDEN\ndynlib_dlsym sceKernelDlsym\ndynlib_get_list HIDDEN\ndynlib_get_info HIDDEN\ndynlib_load_prx __sys_dynlib_load_prx\ndynlib_unload_prx HIDDEN\ndynlib_do_copy_relocations HIDDEN\ndynlib_prepare_dlclose HIDDEN\ndynlib_get_proc_param HIDDEN\ndynlib_process_needed_and_relocate HIDDEN\nsandbox_path sceKernelSandboxPath\nmdbg_service mdbg_service\nrandomized_path __sys_randomized_path\nrdup __sys_rdup\ndl_get_metadata __sys_dl_get_metadata\nworkaround8849 __sys_workaround8849\nis_development_mode __sys_is_development_mode\nget_self_auth_info get_self_auth_info\ndynlib_get_info_ex HIDDEN\nbudget_getid HIDDEN\nbudget_get_ptype HIDDEN\nget_paging_stats_of_all_threads sceKernelGetPagingStatsOfAllThreads\nget_proc_type_info __sys_get_proc_type_info\nget_resident_count sceKernelGetResidentCount\nprepare_to_suspend_process sceKernelPrepareToSuspendProcess\nget_resident_fmem_count sceKernelGetResidentFmemCount\nthr_get_name HIDDEN\nset_gpo HIDDEN\nget_paging_stats_of_all_objects sceKernelGetPagingStatsOfAllObjects\ntest_debug_rwmem __sys_test_debug_rwmem\nfree_stack HIDDEN\nsuspend_system sceKernelSuspendSystem\nipmimgr_call ipmimgr_call\nget_gpo HIDDEN\nget_vm_map_timestamp get_vm_map_timestamp\nopmc_set_hw __sys_opmc_set_hw\nopmc_get_hw __sys_opmc_get_hw\nget_cpu_usage_all sceKernelGetCpuUsageAll\nmmap_dmem HIDDEN\nphyshm_open physhm_open\nphyshm_unlink physhm_unlink\nresume_internal_hdd __sys_resume_internal_hdd\nthr_suspend_ucontext HIDDEN\nthr_resume_ucontext HIDDEN\nthr_get_ucontext HIDDEN\nthr_set_ucontext HIDDEN\nset_timezone_info sceKernelSetTimezoneInfo\nset_phys_fmem_limit set_phys_fmem_limit\nutc_to_localtime HIDDEN\nlocaltime_to_utc HIDDEN\nset_uevt __sys_set_uevt\nget_cpu_usage_proc sceKernelGetCpuUsageProc\nget_map_statistics HIDDEN\nset_chicken_switches HIDDEN\nextend_page_table_pool HIDDEN\nextend_page_table_pool2 HIDDEN\nget_kernel_mem_statistics HIDDEN\nget_sdk_compiled_version get_sdk_compiled_version\napp_state_change HIDDEN\ndynlib_get_obj_member dynlib_get_obj_member\nbudget_get_ptype_of_budget HIDDEN\nprepare_to_resume_process sceKernelPrepareToResumeProcess\nprocess_terminate HIDDEN\nblockpool_open blockpool_open\nblockpool_map blockpool_map\nblockpool_unmap blockpool_unmap\ndynlib_get_info_for_libdbg __sys_dynlib_get_info_for_libdbg\nblockpool_batch blockpool_batch\nfdatasync fdatasync\ndynlib_get_list2 __sys_dynlib_get_list2\ndynlib_get_info2 __sys_dynlib_get_info2\naio_submit HIDDEN\naio_multi_delete HIDDEN\naio_multi_wait HIDDEN\naio_multi_poll HIDDEN\naio_get_data HIDDEN\naio_multi_cancel HIDDEN\nget_bio_usage_all sceKernelGetBioUsageAll\naio_create HIDDEN\naio_submit_cmd HIDDEN\naio_init HIDDEN\nget_page_table_stats get_page_table_stats\ndynlib_get_list_for_libdbg __sys_dynlib_get_list_for_libdbg\nblockpool_move HIDDEN\nvirtual_query_all sceKernelVirtualQueryAll\nreserve_2mb_page sceKernelReserve2mbPage\ncpumode_yield HIDDEN\nget_phys_page_size sceKernelGetPhysPageSize\nset_err HIDDEN\n\npthread_create pthread_create\npthread_exit pthread_exit\npthread_kill pthread_kill\nsceKernelLoadStartModule sceKernelLoadStartModule\n__error __error\npthread_detach pthread_detach\nrfork_thread rfork_thread\n"
  },
  {
    "path": "prosper0gdb/Makefile",
    "content": "all: payload.bin prosper0gdb.o\n\nclean:\n\trm -f payload.elf payload.bin r0run.o prosper0gdb.o\n\n../lib/lib-elf-ps5.a:\n\tcd ../lib; make\n\nr0run.o: r0run.asm\n\tyasm -f elf64 -g dwarf2 r0run.asm -o r0run.o\n\nprosper0gdb.o: r0gdb.c r0run.o offsets.c offsets.h offset_list.txt\n\tgcc -O0 -g -isystem ../freebsd-headers -nostdinc -nostdlib -fno-stack-protector -r -Wl,--unique='*' -ffunction-sections -fdata-sections $(EXTRA_CFLAGS) -DPS5KEK r0gdb.c r0run.o offsets.c -o prosper0gdb.o -fPIE -ffreestanding -fno-unwind-tables -fno-asynchronous-unwind-tables\n\npayload.elf: ../lib/lib-elf-ps5.a main.c prosper0gdb.o dbg.c \n\tgcc -O0 -g -isystem ../freebsd-headers -nostdinc -nostdlib -fno-stack-protector -static ../lib/lib-elf-ps5.a $(EXTRA_CFLAGS) main.c prosper0gdb.o -DPS5KEK dbg.c -o payload.elf -fPIE -ffreestanding -Wl,-no-pie -Wl,-zmax-page-size=16384 -Wl,-zcommon-page-size=16384\n\npayload.bin: payload.elf\n\tobjcopy payload.elf --only-section .text --only-section .data --only-section .bss --only-section .rodata -O binary payload.bin\n\tpython3 ../lib/frankenelf.py payload.bin"
  },
  {
    "path": "prosper0gdb/dbg.c",
    "content": "#define __PS4__\n#ifndef NO_MEM_HELPERS\n#define MEM_HELPERS\n#endif\n#define INTERRUPTER_THREAD\n#define NO_BREAKPOINT_EMULATION\n#include \"../gdb_stub/dbg.c\"\n\nssize_t copyin(uint64_t dst, const void* src, size_t count);\nssize_t copyout(void* dst, uint64_t src, size_t count);\n\nextern uint64_t kdata_base;\nextern uint64_t rpipe;\n\n#ifdef MEM_HELPERS\nint read_mem(unsigned char* buf, unsigned long long addr, int sz)\n{\n#ifdef MEMRW_FALLBACK\n    if(!rpipe)\n    {\n        if(write(pipe_w, (void*)addr, sz) != sz)\n            return -14;\n        read(pipe_r, buf, sz);\n        return 0;\n    }\n#endif\n    if(addr >= 0xffffffff00000000 && addr < kdata_base)\n        return -14;\n    if(copyout(buf, addr, sz) != sz)\n        return -errno;\n    return 0;\n}\n\nstatic int write_mem(const unsigned char* buf, unsigned long long addr, int sz)\n{\n#ifdef MEMRW_FALLBACK\n    if(!rpipe)\n    {\n        write(pipe_w, buf, sz);\n        if(read(pipe_r, (void*)addr, sz) != sz)\n        {\n            char c;\n            for(int i = 0; i < sz; i++)\n                read(pipe_r, &c, 1);\n            return -14;\n        }\n        return 0;\n    }\n#endif\n    if(addr >= 0xffffffff00000000 && addr < kdata_base)\n        return -14;\n    if(copyin(addr, buf, sz) != sz)\n        return -errno;\n    return 0;\n}\n#endif\n"
  },
  {
    "path": "prosper0gdb/import_offsets.py",
    "content": "import json, sys\n\nsymbols = json.load(open(sys.argv[1]))\n\nprint('DEF(allproc, '+hex(symbols['allproc'])+')')\nprint('DEF(idt, '+hex(symbols['idt'])+')')\nprint('DEF(gdt_array, '+hex(symbols['gdt_array'])+')')\nprint('DEF(tss_array, '+hex(symbols['tss_array'])+')')\nprint('DEF(pcpu_array, '+hex(symbols['pcpu_array'])+')')\nprint('DEF(doreti_iret, '+hex(symbols['doreti_iret'])+')')\nprint('DEF(add_rsp_iret, doreti_iret - 7)')\nprint('DEF(swapgs_add_rsp_iret, doreti_iret - 10)')\nprint('DEF(rep_movsb_pop_rbp_ret, '+hex(symbols['rep_movsb_pop_rbp_ret'])+')')\nprint('DEF(rdmsr_start, '+hex(symbols['rdmsr_start'])+')')\nprint('DEF(wrmsr_ret, '+hex(symbols['wrmsr_ret'])+')')\nprint('DEF(dr2gpr_start, '+hex(symbols['dr2gpr_start'])+')')\nprint('DEF(gpr2dr_1_start, '+hex(symbols['gpr2dr_1_start'])+')')\nprint('DEF(gpr2dr_2_start, '+hex(symbols['gpr2dr_2_start'])+')')\nprint('DEF(mov_cr3_rax, '+hex(symbols['mov_cr3_rax'])+')')\nprint('DEF(mov_rdi_cr3, '+hex(symbols['mov_rdi_cr3'])+')')\nprint('DEF(nop_ret, wrmsr_ret + 2)')\nprint('DEF(cpu_switch, '+hex(symbols['cpu_switch'])+')')\nprint('DEF(mprotect_fix_start, '+hex(symbols['mprotect_fix_start'])+')')\nprint('DEF(mprotect_fix_end, mprotect_fix_start+6)')\nprint('DEF(mmap_self_fix_1_start, '+hex(symbols['mmap_self_fix_1_start'])+')')\nprint('DEF(mmap_self_fix_1_end, mmap_self_fix_1_start+2)')\nprint('DEF(mmap_self_fix_2_start, '+hex(symbols['mmap_self_fix_2_start'])+')')\nprint('DEF(mmap_self_fix_2_end, mmap_self_fix_2_start+2)')\nprint('DEF(sigaction_fix_start, '+hex(symbols['sigaction_fix_start'])+')')\nprint('DEF(sigaction_fix_end, '+hex(symbols['sigaction_fix_end'])+')')\nprint('DEF(sysents, '+hex(symbols['sysents'])+')')\nprint('DEF(sysents_ps4, '+hex(symbols['sysents_ps4'])+')')\nprint('DEF(sysentvec, '+hex(symbols['sysentvec'])+')')\nprint('DEF(sysentvec_ps4, '+hex(symbols['sysentvec_ps4'])+')')\nprint('DEF(sceSblServiceMailbox, '+hex(symbols['sceSblServiceMailbox'])+')')\nprint('DEF(sceSblAuthMgrSmIsLoadable2, '+hex(symbols['sceSblAuthMgrSmIsLoadable2'])+')')\nprint('DEF(mdbg_call_fix, '+hex(symbols['mdbg_call_fix'])+')')\nprint('DEF(syscall_before, '+hex(symbols['syscall_before'])+')')\nprint('DEF(syscall_after, '+hex(symbols['syscall_after'])+')')\nprint('DEF(malloc, '+hex(symbols['malloc'])+')')\nprint('DEF(M_something, '+hex(symbols['M_something'])+')')\nprint('DEF(loadSelfSegment_epilogue, '+hex(symbols['loadSelfSegment_epilogue'])+')')\nprint('DEF(loadSelfSegment_watchpoint, '+hex(symbols['loadSelfSegment_watchpoint'])+')')\nprint('DEF(loadSelfSegment_watchpoint_lr, '+hex(symbols['loadSelfSegment_watchpoint_lr'])+')')\nprint('DEF(decryptSelfBlock_watchpoint_lr, '+hex(symbols['decryptSelfBlock_watchpoint_lr'])+')')\nprint('DEF(decryptSelfBlock_epilogue, '+hex(symbols['decryptSelfBlock_epilogue'])+')')\nprint('DEF(decryptMultipleSelfBlocks_watchpoint_lr, '+hex(symbols['decryptMultipleSelfBlocks_watchpoint_lr'])+')')\nprint('DEF(decryptMultipleSelfBlocks_epilogue, '+hex(symbols['decryptMultipleSelfBlocks_epilogue'])+')')\nprint('DEF(sceSblServiceMailbox_lr_verifyHeader, '+hex(symbols['sceSblServiceMailbox_lr_verifyHeader'])+')')\nprint('DEF(sceSblServiceMailbox_lr_loadSelfSegment, '+hex(symbols['sceSblServiceMailbox_lr_loadSelfSegment'])+')')\nprint('DEF(sceSblServiceMailbox_lr_decryptSelfBlock, '+hex(symbols['sceSblServiceMailbox_lr_decryptSelfBlock'])+')')\nprint('DEF(sceSblServiceMailbox_lr_decryptMultipleSelfBlocks, '+hex(symbols['sceSblServiceMailbox_lr_decryptMultipleSelfBlocks'])+')')\nprint('DEF(sceSblServiceMailbox_lr_sceSblAuthMgrSmFinalize, '+hex(symbols['sceSblServiceMailbox_lr_sceSblAuthMgrSmFinalize'])+')')\nprint('DEF(sceSblServiceMailbox_lr_verifySuperBlock, '+hex(symbols['sceSblServiceMailbox_lr_verifySuperBlock'])+')')\nprint('DEF(sceSblServiceMailbox_lr_sceSblPfsClearKey_1, '+hex(symbols['sceSblServiceMailbox_lr_sceSblPfsClearKey_1'])+')')\nprint('DEF(sceSblServiceMailbox_lr_sceSblPfsClearKey_2, '+hex(symbols['sceSblServiceMailbox_lr_sceSblPfsClearKey_2'])+')')\nprint('DEF(sceSblPfsSetKeys, '+hex(symbols['sceSblPfsSetKeys'])+')')\nprint('DEF(sceSblServiceCryptAsync, '+hex(symbols['sceSblServiceCryptAsync'])+')')\nprint('DEF(sceSblServiceCryptAsync_deref_singleton, '+hex(symbols['sceSblServiceCryptAsync_deref_singleton'])+')')\nprint('DEF(copyin, '+hex(symbols['copyin'])+')')\nprint('DEF(copyout, '+hex(symbols['copyout'])+')')\nprint('DEF(crypt_message_resolve, '+hex(symbols['crypt_message_resolve'])+')')\nprint('DEF(justreturn, '+hex(symbols['justreturn'])+')')\nprint('DEF(justreturn_pop, justreturn+8)')\nprint('DEF(mini_syscore_header, '+hex(symbols['mini_syscore_header'])+')')\nprint('DEF(pop_all_iret, '+hex(symbols['pop_all_iret'])+')')\nprint('DEF(pop_all_except_rdi_iret, pop_all_iret+4)')\nprint('DEF(push_pop_all_iret, '+hex(symbols['push_pop_all_iret'])+')')\nprint('DEF(kernel_pmap_store, '+hex(symbols['kernel_pmap_store'])+')')\nprint('DEF(crypt_singleton_array, '+hex(symbols['crypt_singleton_array'])+')')\n#print('DEF(security_flags, '+hex(symbols['security_flags'])+')')\n#print('DEF(targetid, '+hex(symbols['targetid'])+')')\n#print('DEF(qa_flags, '+hex(symbols['qa_flags'])+')')\n#print('DEF(utoken, '+hex(symbols['utoken'])+')')\n\n"
  },
  {
    "path": "prosper0gdb/main.c",
    "content": "#include \"../gdb_stub/dbg.h\"\n#include \"r0gdb.h\"\n#include <stdint.h>\n#include <unistd.h>\n#include <signal.h>\n#include <pthread.h>\n#include <time.h>\n#include <sys/socket.h>\n#include <netinet/in.h>\n#include <fcntl.h>\n#include <sys/uio.h>\n#include <sys/mount.h>\n\nstatic void infsleep(int sig)\n{\n    struct timespec ts = {1000, 0};\n    for(;;)\n        nanosleep(&ts, 0);\n}\n\nvoid kill_thread(void)\n{\n    struct sigaction sa = {\n        .sa_handler = infsleep,\n    };\n    sigaction(SIGUSR1, &sa, 0);\n    sigset_t ss = {0};\n    ss.__bits[_SIG_WORD(SIGUSR1)] |= _SIG_BIT(SIGUSR1);\n    sigprocmask(SIG_BLOCK, &ss, NULL);\n    for(int i = 0; i < 1000; i++)\n        kill(getpid(), SIGUSR1);\n}\n\nvoid ignore_signals(void)\n{\n    struct sigaction sa = {\n        .sa_handler = SIG_IGN,\n    };\n    for(int i = 1; i < 100; i++)\n        if(i != SIGTRAP\n        && i != SIGILL\n        && i != SIGBUS\n        && i != SIGINT\n        && i != SIGSYS\n        && i != SIGSEGV)\n            sigaction20(i, &sa, 0);\n}\n\nvoid* klog_server(void* arg)\n{\n    int sock = socket(AF_INET, SOCK_STREAM, 0);\n    struct sockaddr_in sin = {\n        .sin_family = AF_INET,\n        .sin_addr = { .s_addr = 0 },\n        .sin_port = 0x0e27, //9998\n    };\n    bind(sock, (void*)&sin, sizeof(sin));\n    listen(sock, 1);\nnew_conn:\n    int sock2 = accept(sock, NULL, NULL);\n    char buf[512];\n    int fd1 = open(\"/dev/klog\", O_RDONLY);\n    for(;;)\n    {\n        ssize_t chk = read(fd1, buf, sizeof(buf));\n        if(chk < 0)\n            break;\n        char* p = buf;\n        while(chk > 0)\n        {\n            ssize_t chk1 = write(sock2, p, chk);\n            if(chk1 <= 0)\n            {\n                close(sock2);\n                goto new_conn;\n            }\n            chk -= chk1;\n            p += chk1;\n        }\n    }\n}\n\nasm(\"my_nmount:\\nmov $378, %rax\\njmp *p_kekcall(%rip)\");\nvoid* p_kekcall;\nint my_nmount(struct iovec* iov, size_t n, int flags);\n\nvoid* dlsym(void*, const char*);\n\nint do_nmount(struct iovec* iov, size_t n, int flags)\n{\n    if(!p_kekcall)\n        p_kekcall = dlsym((void*)0x1, \"getppid\") + 7;\n    return my_nmount(iov, n, flags);\n}\n\nint remount_rw(const char* dev, const char* mnt)\n{\n    size_t n = 0;\n    while(dev[n])\n        n++;\n    size_t m = 0;\n    while(mnt[m])\n        m++;\n    struct iovec iov[] = {\n        {\"fstype\", 7}, {\"exfatfs\", 8},\n        {\"fspath\", 7}, {(char*)mnt, m+1},\n        {\"from\", 5}, {(char*)dev, n+1},\n        {\"large\", 6}, {\"yes\", 4},\n        {\"timezone\", 9}, {\"static\", 7},\n        {\"async\", 6}, {0, 0},\n        {\"ignoreacl\", 10}, {0, 0},\n    };\n    return do_nmount(iov, 14, MNT_UPDATE);\n}\n\nvoid log_deltas(uint64_t pointer)\n{\n    for(;;)\n    {\n        struct regs regs = {0};\n        regs.rip = pointer;\n        regs.eflags = 0x102;\n        run_in_kernel(&regs);\n        uint32_t delta = regs.rip - (pointer + 5);\n        char buf[9] = {[8] = '\\n'};\n        for(int i = 0; i < 8; i++)\n            buf[i] = \"0123456789abcdef\"[(delta >> (28-4*i))&15];\n        gdb_remote_syscall(\"write\", 3, 0, (uintptr_t)1, (uintptr_t)buf, (uintptr_t)9);\n        pointer += 8;\n    }\n}\n\nint main(void* ds, int a, int b, uintptr_t c, uintptr_t d)\n{\n    r0gdb_init(ds, a, b, c, d);\n    dbg_enter();\n    return 0; //p r0gdb() for magic\n}"
  },
  {
    "path": "prosper0gdb/offset_list.txt",
    "content": "OFFSET(allproc)\nOFFSET(idt)\nOFFSET(gdt_array)\nOFFSET(tss_array)\nOFFSET(pcpu_array)\nOFFSET(doreti_iret)\nOFFSET(add_rsp_iret)\nOFFSET(swapgs_add_rsp_iret)\nOFFSET(rep_movsb_pop_rbp_ret)\nOFFSET(rdmsr_start)\n//OFFSET(rdmsr_end)\nOFFSET(wrmsr_ret)\nOFFSET(dr2gpr_start)\n//OFFSET(dr2gpr_end)\nOFFSET(gpr2dr_1_start)\n//OFFSET(gpr2dr_1_end)\nOFFSET(gpr2dr_2_start)\n//OFFSET(gpr2dr_2_end)\nOFFSET(mov_cr3_rax_mov_ds)\nOFFSET(mov_rax_cr3)\nOFFSET(nop_ret)\nOFFSET(cpu_switch)\nOFFSET(mprotect_fix_start)\nOFFSET(mprotect_fix_end)\nOFFSET(mmap_self_fix_1_start)\nOFFSET(mmap_self_fix_1_end)\nOFFSET(mmap_self_fix_2_start)\nOFFSET(mmap_self_fix_2_end)\nOFFSET(aslr_fix_start)\nOFFSET(aslr_fix_end)\nOFFSET(sigaction_fix_start)\nOFFSET(sigaction_fix_end)\nOFFSET(mdbg_call_fix)\nOFFSET(sysents)\nOFFSET(sysents_ps4)\nOFFSET(sysentvec)\nOFFSET(sysentvec_ps4)\nOFFSET(sceSblServiceMailbox)\nOFFSET(sceSblAuthMgrSmIsLoadable2)\nOFFSET(syscall_before)\nOFFSET(syscall_after)\nOFFSET(malloc)\nOFFSET(M_something)\nOFFSET(loadSelfSegment_epilogue)\nOFFSET(loadSelfSegment_watchpoint)\nOFFSET(loadSelfSegment_watchpoint_lr)\n//OFFSET(decryptSelfBlock_watchpoint)\nOFFSET(decryptSelfBlock_watchpoint_lr)\nOFFSET(decryptSelfBlock_epilogue)\nOFFSET(decryptMultipleSelfBlocks_epilogue)\nOFFSET(decryptMultipleSelfBlocks_watchpoint_lr)\nOFFSET(sceSblServiceMailbox_lr_verifyHeader)\nOFFSET(sceSblServiceMailbox_lr_loadSelfSegment)\nOFFSET(sceSblServiceMailbox_lr_decryptSelfBlock)\nOFFSET(sceSblServiceMailbox_lr_decryptMultipleSelfBlocks)\nOFFSET(sceSblServiceMailbox_lr_sceSblAuthMgrSmFinalize)\nOFFSET(sceSblServiceMailbox_lr_verifySuperBlock)\nOFFSET(sceSblServiceMailbox_lr_sceSblPfsClearKey_1)\nOFFSET(sceSblServiceMailbox_lr_sceSblPfsClearKey_2)\nOFFSET(sceSblServiceMailbox_lr_npdrm_cmd_5)\nOFFSET(sceSblServiceMailbox_lr_npdrm_cmd_6)\nOFFSET(sceSblPfsSetKeys)\n//OFFSET(panic)\nOFFSET(sceSblServiceCryptAsync)\nOFFSET(sceSblServiceCryptAsync_deref_singleton)\nOFFSET(copyin)\nOFFSET(copyout)\nOFFSET(crypt_message_resolve)\nOFFSET(justreturn)\nOFFSET(justreturn_pop)\nOFFSET(mini_syscore_header)\nOFFSET(pop_all_iret)\nOFFSET(pop_all_except_rdi_iret)\nOFFSET(push_pop_all_iret)\nOFFSET(kernel_pmap_store)\nOFFSET(crypt_singleton_array)\nOFFSET(security_flags)\nOFFSET(targetid)\nOFFSET(qa_flags)\nOFFSET(utoken)\nOFFSET(mov_rax_cr0)\nOFFSET(mov_cr0_rax)\nOFFSET(mov_rdi_cr2)\nOFFSET(lgdt_rdi)\nOFFSET(lidt_lldt)\nOFFSET(ltr_ax)\nOFFSET(kproc_shutdown)\nOFFSET(s_shutdown_final)\nOFFSET(eventhandler_register)\nOFFSET(strlen_trap)\nOFFSET(lapic_map)\n"
  },
  {
    "path": "prosper0gdb/offsets.c",
    "content": "#include \"r0gdb.h\"\r\n#include \"offsets.h\"\r\n\r\nstruct offset_table offsets;\r\nextern uint64_t kdata_base;\r\n\r\n#define OFFSET(x) offsets.x = kdata_base + x;\r\n#define DEF(x, y) enum { x = (y) + 0 * sizeof(offsets.x) };\r\n\r\n#define START_FW(fw) void set_offsets_ ## fw(void) {\r\n#define END_FW() }\r\n\r\nSTART_FW(300)\r\nDEF(allproc, 0x276dc58)\r\nDEF(idt, 0x642dc80)\r\nDEF(gdt_array, 0x642ee20)\r\nDEF(tss_array, 0x6430820)\r\nDEF(pcpu_array, 0x6432280)\r\nDEF(doreti_iret, -0x9aefbc)\r\nDEF(add_rsp_iret, doreti_iret - 7)\r\nDEF(swapgs_add_rsp_iret, doreti_iret - 10)\r\nDEF(rep_movsb_pop_rbp_ret, -0x96f79a)\r\nDEF(rdmsr_start, -0x9b046a)\r\nDEF(wrmsr_ret, -0x9b183c)\r\nDEF(dr2gpr_start, -0x9b6513)\r\nDEF(gpr2dr_1_start, -0x9b63fa)\r\nDEF(gpr2dr_2_start, -0x9b6307)\r\nDEF(mov_cr3_rax_mov_ds, -0x9b5f69)\r\n\r\n//DEF(mov_rdi_cr3, -0x390a0e)\r\nDEF(mov_rax_cr3, -0x38C020) //??\r\n\r\nDEF(nop_ret, wrmsr_ret + 2)\r\nDEF(cpu_switch, -0x9b6700)\r\nDEF(mprotect_fix_start, -0x8ee651)\r\nDEF(mprotect_fix_end, mprotect_fix_start+6)\r\nDEF(mmap_self_fix_1_start, -0x2c92bd)\r\nDEF(mmap_self_fix_1_end, mmap_self_fix_1_start+2)\r\nDEF(mmap_self_fix_2_start, -0x1dd21e)\r\nDEF(mmap_self_fix_2_end, mmap_self_fix_2_start+2)\r\n\r\nDEF(aslr_fix_start, -0x8409F0)\r\nDEF(aslr_fix_end, -0x8409B0)\r\n\r\nDEF(sigaction_fix_start, -0x6b549f)\r\nDEF(sigaction_fix_end, -0x6b5449)\r\nDEF(sysents, 0x16f720)\r\nDEF(sysents_ps4, 0x167170)\r\nDEF(sysentvec, 0xca0cd8)\r\nDEF(sysentvec_ps4, 0xca0e50)\r\nDEF(sceSblServiceMailbox, -0x675df0)\r\nDEF(sceSblAuthMgrSmIsLoadable2, -0x88a540)\r\nDEF(mdbg_call_fix, -0x626d49)\r\nDEF(syscall_before, -0x7e91bf)\r\nDEF(syscall_after, -0x7e919c)\r\nDEF(malloc, -0xaa2a0)\r\nDEF(M_something, 0x12d3d70)\r\nDEF(loadSelfSegment_epilogue, -0x889e0d)\r\nDEF(loadSelfSegment_watchpoint, -0x2c88a8)\r\nDEF(loadSelfSegment_watchpoint_lr, -0x88a067)\r\nDEF(decryptSelfBlock_watchpoint_lr, -0x889cca)\r\nDEF(decryptSelfBlock_epilogue, -0x889c03)\r\nDEF(decryptMultipleSelfBlocks_watchpoint_lr, -0x889595)\r\nDEF(decryptMultipleSelfBlocks_epilogue, -0x889112)\r\nDEF(sceSblServiceMailbox_lr_verifyHeader, -0x88a1bc)\r\nDEF(sceSblServiceMailbox_lr_loadSelfSegment, -0x889e81)\r\nDEF(sceSblServiceMailbox_lr_decryptSelfBlock, -0x889954)\r\nDEF(sceSblServiceMailbox_lr_decryptMultipleSelfBlocks, -0x8891cc)\r\nDEF(sceSblServiceMailbox_lr_sceSblAuthMgrSmFinalize, -0x88a5be)\r\nDEF(sceSblServiceMailbox_lr_verifySuperBlock, -0x92d9b0)\r\nDEF(sceSblServiceMailbox_lr_sceSblPfsClearKey_1, -0x92df7b)\r\nDEF(sceSblServiceMailbox_lr_sceSblPfsClearKey_2, -0x92df05)\r\nDEF(sceSblServiceMailbox_lr_npdrm_cmd_5, -0x312f7d)\r\nDEF(sceSblServiceMailbox_lr_npdrm_cmd_6, -0x312cda)\r\nDEF(sceSblPfsSetKeys, -0x92dc60)\r\nDEF(sceSblServiceCryptAsync, -0x8d1e30)\r\nDEF(sceSblServiceCryptAsync_deref_singleton, -0x8d1df2)\r\nDEF(copyin, -0x970050)\r\nDEF(copyout, -0x970100)\r\nDEF(crypt_message_resolve, -0x475790)\r\nDEF(justreturn, -0x9af100)\r\nDEF(justreturn_pop, justreturn+8)\r\nDEF(mini_syscore_header, 0xd4fe88)\r\nDEF(pop_all_iret, -0x9af01b)\r\nDEF(pop_all_except_rdi_iret, pop_all_iret+4)\r\nDEF(push_pop_all_iret, -0x94f570)\r\nDEF(kernel_pmap_store, 0x31be218)\r\nDEF(crypt_singleton_array, 0x2d99830)\r\nDEF(security_flags, 0x6466474)\r\nDEF(targetid, 0x646647d)\r\nDEF(qa_flags, 0x6466498)\r\nDEF(utoken, 0x6466500)\r\nDEF(mov_rax_cr0, -0x9b6661)\r\nDEF(mov_cr0_rax, -0x9b665c)\r\nDEF(mov_rdi_cr2, -0x9b20da)\r\nDEF(lgdt_rdi, -0x96f970)\r\nDEF(lidt_lldt, -0x9b5eb1)\r\nDEF(ltr_ax, -0x9b5e8f)\r\nDEF(kproc_shutdown, -0x94a808)\r\nDEF(s_shutdown_final, 0x320f85)\r\nDEF(eventhandler_register, -0x51f770)\r\nDEF(strlen_trap, -0x441958)\r\nDEF(lapic_map, 0x27c6f40)\r\n#include \"offset_list.txt\"\r\nEND_FW()\r\n\r\nSTART_FW(310)\r\nDEF(allproc, 0x276dc58)\r\nDEF(idt, 0x642dc80)\r\nDEF(gdt_array, 0x642ee20)\r\nDEF(tss_array, 0x6430820)\r\nDEF(pcpu_array, 0x6432280)\r\nDEF(doreti_iret, -0x9aefbc)\r\nDEF(add_rsp_iret, doreti_iret - 7)\r\nDEF(swapgs_add_rsp_iret, doreti_iret - 10)\r\nDEF(rep_movsb_pop_rbp_ret, -0x96f79a)\r\nDEF(rdmsr_start, -0x9b046a)\r\nDEF(wrmsr_ret, -0x9b183c)\r\nDEF(dr2gpr_start, -0x9b6513)\r\nDEF(gpr2dr_1_start, -0x9b63fa)\r\nDEF(gpr2dr_2_start, -0x9b6307)\r\nDEF(mov_cr3_rax_mov_ds, -0x9b5f69)\r\n\r\n//DEF(mov_rdi_cr3, -0x3909ce)\r\nDEF(mov_rax_cr3, -0x38BFE0)\r\n\r\nDEF(nop_ret, wrmsr_ret + 2)\r\nDEF(cpu_switch, -0x9b6700)\r\nDEF(mprotect_fix_start, -0x8ee651)\r\nDEF(mprotect_fix_end, mprotect_fix_start+6)\r\nDEF(mmap_self_fix_1_start, -0x2c927d)\r\nDEF(mmap_self_fix_1_end, mmap_self_fix_1_start+2)\r\nDEF(mmap_self_fix_2_start, -0x1dd1de)\r\nDEF(mmap_self_fix_2_end, mmap_self_fix_2_start+2)\r\n\r\nDEF(aslr_fix_start, -0x8409B0)\r\nDEF(aslr_fix_end, -0x840970)\r\n\r\nDEF(sigaction_fix_start, -0x6b545f)\r\nDEF(sigaction_fix_end, -0x6b5409)\r\nDEF(sysents, 0x16f720)\r\nDEF(sysents_ps4, 0x167170)\r\nDEF(sysentvec, 0xca0cd8)\r\nDEF(sysentvec_ps4, 0xca0e50)\r\nDEF(sceSblServiceMailbox, -0x675db0)\r\nDEF(sceSblAuthMgrSmIsLoadable2, -0x88a540)\r\nDEF(mdbg_call_fix, -0x626d09)\r\nDEF(syscall_before, -0x7e917f)\r\nDEF(syscall_after, -0x7e915c)\r\nDEF(malloc, -0xaa260)\r\nDEF(M_something, 0x12d3d70)\r\nDEF(loadSelfSegment_epilogue, -0x889dcd)\r\nDEF(loadSelfSegment_watchpoint, -0x2c8868)\r\nDEF(loadSelfSegment_watchpoint_lr, -0x88a027)\r\nDEF(decryptSelfBlock_watchpoint_lr, -0x889c8a)\r\nDEF(decryptSelfBlock_epilogue, -0x889bc3)\r\nDEF(decryptMultipleSelfBlocks_watchpoint_lr, -0x889555)\r\nDEF(decryptMultipleSelfBlocks_epilogue, -0x8890d2)\r\nDEF(sceSblServiceMailbox_lr_verifyHeader, -0x88a1bc)\r\nDEF(sceSblServiceMailbox_lr_loadSelfSegment, -0x889e41)\r\nDEF(sceSblServiceMailbox_lr_decryptSelfBlock, -0x889914)\r\nDEF(sceSblServiceMailbox_lr_decryptMultipleSelfBlocks, -0x88918c)\r\nDEF(sceSblServiceMailbox_lr_sceSblAuthMgrSmFinalize, -0x88a5be)\r\nDEF(sceSblServiceMailbox_lr_verifySuperBlock, -0x92d9b0)\r\nDEF(sceSblServiceMailbox_lr_sceSblPfsClearKey_1, -0x92df7b)\r\nDEF(sceSblServiceMailbox_lr_sceSblPfsClearKey_2, -0x92df05)\r\nDEF(sceSblServiceMailbox_lr_npdrm_cmd_5, -0x312f7d)\r\nDEF(sceSblServiceMailbox_lr_npdrm_cmd_6, -0x312cda)\r\nDEF(sceSblPfsSetKeys, -0x92dc60)\r\nDEF(sceSblServiceCryptAsync, -0x8d1e30)\r\nDEF(sceSblServiceCryptAsync_deref_singleton, -0x8d1df2)\r\nDEF(copyin, -0x970050)\r\nDEF(copyout, -0x970100)\r\nDEF(crypt_message_resolve, -0x475750)\r\nDEF(justreturn, -0x9af100)\r\nDEF(justreturn_pop, justreturn+8)\r\nDEF(mini_syscore_header, 0xd4fe88)\r\nDEF(pop_all_iret, -0x9af01b)\r\nDEF(pop_all_except_rdi_iret, pop_all_iret+4)\r\nDEF(push_pop_all_iret, -0x94f6b8)\r\nDEF(kernel_pmap_store, 0x31be218)\r\nDEF(crypt_singleton_array, 0x2d99830)\r\nDEF(security_flags, 0x6466474)\r\nDEF(targetid, 0x646647d)\r\nDEF(qa_flags, 0x6466490)\r\nDEF(utoken, 0x6466500)\r\nDEF(mov_rax_cr0, -0x9b6661)\r\nDEF(mov_cr0_rax, -0x9b665c)\r\nDEF(mov_rdi_cr2, -0x9b20da)\r\nDEF(lgdt_rdi, -0x96f970)\r\nDEF(lidt_lldt, -0x9b5eb1)\r\nDEF(ltr_ax, -0x9b5e8f)\r\nDEF(kproc_shutdown, -0x94a730)\r\nDEF(s_shutdown_final, 0x320be0)\r\nDEF(eventhandler_register, -0x51f730)\r\nDEF(strlen_trap, -0x441918)\r\nDEF(lapic_map, 0x27c6f40)\r\n#include \"offset_list.txt\"\r\nEND_FW()\r\n\r\nSTART_FW(320)\r\nDEF(allproc, 0x276dc58)\r\nDEF(idt, 0x642dc80)\r\nDEF(gdt_array, 0x642ee20)\r\nDEF(tss_array, 0x6430820)\r\nDEF(pcpu_array, 0x6432280)\r\nDEF(doreti_iret, -0x9aec7c)\r\nDEF(add_rsp_iret, doreti_iret - 7)\r\nDEF(swapgs_add_rsp_iret, doreti_iret - 10)\r\nDEF(rep_movsb_pop_rbp_ret, -0x96f45a)\r\nDEF(rdmsr_start, -0x9b012a)\r\nDEF(wrmsr_ret, -0x9b14fc)\r\nDEF(dr2gpr_start, -0x9b61d3)\r\nDEF(gpr2dr_1_start, -0x9b60ba)\r\nDEF(gpr2dr_2_start, -0x9b5fc7)\r\nDEF(mov_cr3_rax_mov_ds, -0x9b5c29)\r\n\r\n//DEF(mov_rdi_cr3, -0x39067e)\r\nDEF(mov_rax_cr3, -0x38BC90)\r\n\r\nDEF(nop_ret, wrmsr_ret + 2)\r\nDEF(cpu_switch, -0x9b63c0)\r\nDEF(mprotect_fix_start, -0x8ee311)\r\nDEF(mprotect_fix_end, mprotect_fix_start+6)\r\nDEF(mmap_self_fix_1_start, -0x2c8f2d)\r\nDEF(mmap_self_fix_1_end, mmap_self_fix_1_start+2)\r\nDEF(mmap_self_fix_2_start, -0x1dcd1e)\r\nDEF(mmap_self_fix_2_end, mmap_self_fix_2_start+2)\r\n\r\nDEF(aslr_fix_start, -0x840660)\r\nDEF(aslr_fix_end, -0x840620)\r\n\r\nDEF(sigaction_fix_start, -0x6b510f)\r\nDEF(sigaction_fix_end, -0x6b50b9)\r\nDEF(sysents, 0x16f720)\r\nDEF(sysents_ps4, 0x167170)\r\nDEF(sysentvec, 0xca0cd8)\r\nDEF(sysentvec_ps4, 0xca0e50)\r\nDEF(sceSblServiceMailbox, -0x675a60)\r\nDEF(sceSblAuthMgrSmIsLoadable2, -0x88a200)\r\nDEF(mdbg_call_fix, -0x6269b9)\r\nDEF(syscall_before, -0x7e8e2f)\r\nDEF(syscall_after, -0x7e8e0c)\r\nDEF(malloc, -0xa9da0)\r\nDEF(M_something, 0x12d3d70)\r\nDEF(loadSelfSegment_epilogue, -0x889a7d)\r\nDEF(loadSelfSegment_watchpoint, -0x2c8518)\r\nDEF(loadSelfSegment_watchpoint_lr, -0x889cd7)\r\nDEF(decryptSelfBlock_watchpoint_lr, -0x88993a)\r\nDEF(decryptSelfBlock_epilogue, -0x889873)\r\nDEF(decryptMultipleSelfBlocks_watchpoint_lr, -0x889205)\r\nDEF(decryptMultipleSelfBlocks_epilogue, -0x888d82)\r\nDEF(sceSblServiceMailbox_lr_verifyHeader, -0x889e7c)\r\nDEF(sceSblServiceMailbox_lr_loadSelfSegment, -0x889af1)\r\nDEF(sceSblServiceMailbox_lr_decryptSelfBlock, -0x8895c4)\r\nDEF(sceSblServiceMailbox_lr_decryptMultipleSelfBlocks, -0x888e3c)\r\nDEF(sceSblServiceMailbox_lr_sceSblAuthMgrSmFinalize, -0x88a27e)\r\nDEF(sceSblServiceMailbox_lr_verifySuperBlock, -0x92d670)\r\nDEF(sceSblServiceMailbox_lr_sceSblPfsClearKey_1, -0x92dc3b)\r\nDEF(sceSblServiceMailbox_lr_sceSblPfsClearKey_2, -0x92dbc5)\r\nDEF(sceSblServiceMailbox_lr_npdrm_cmd_5, -0x312c2d)\r\nDEF(sceSblServiceMailbox_lr_npdrm_cmd_6, -0x31298a)\r\nDEF(sceSblPfsSetKeys, -0x92d920)\r\nDEF(sceSblServiceCryptAsync, -0x8d1af0)\r\nDEF(sceSblServiceCryptAsync_deref_singleton, -0x8d1ab2)\r\nDEF(copyin, -0x96fd10)\r\nDEF(copyout, -0x96fdc0)\r\nDEF(crypt_message_resolve, -0x475400)\r\nDEF(justreturn, -0x9aedc0)\r\nDEF(justreturn_pop, justreturn+8)\r\nDEF(mini_syscore_header, 0xd4fe88)\r\nDEF(pop_all_iret, -0x9aecdb)\r\nDEF(pop_all_except_rdi_iret, pop_all_iret+4)\r\nDEF(push_pop_all_iret, -0x94e7d0)\r\nDEF(kernel_pmap_store, 0x31be218)\r\nDEF(crypt_singleton_array, 0x2d99830)\r\nDEF(security_flags, 0x6466474)\r\nDEF(targetid, 0x646647d)\r\nDEF(qa_flags, 0x6466498)\r\nDEF(utoken, 0x6466500)\r\nDEF(mov_rax_cr0, -0x9b6321)\r\nDEF(mov_cr0_rax, -0x9b631c)\r\nDEF(mov_rdi_cr2, -0x9b1d9a)\r\nDEF(lgdt_rdi, -0x96f630)\r\nDEF(lidt_lldt, -0x9b5b71)\r\nDEF(ltr_ax, -0x9b5b4f)\r\nDEF(kproc_shutdown, -0x94a3f8)\r\nDEF(s_shutdown_final, 0x320eda)\r\nDEF(eventhandler_register, -0x51f3e0)\r\nDEF(strlen_trap, -0x4415c8)\r\nDEF(lapic_map, 0x27c6f40)\r\n#include \"offset_list.txt\"\r\nEND_FW()\r\n\r\nSTART_FW(321)\r\nDEF(allproc, 0x276dc58)\r\nDEF(idt, 0x642dc80)\r\nDEF(gdt_array, 0x642ee20)\r\nDEF(tss_array, 0x6430820)\r\nDEF(pcpu_array, 0x6432280)\r\nDEF(doreti_iret, -0x9aec7c)\r\nDEF(add_rsp_iret, doreti_iret - 7)\r\nDEF(swapgs_add_rsp_iret, doreti_iret - 10)\r\nDEF(rep_movsb_pop_rbp_ret, -0x96f45a)\r\nDEF(rdmsr_start, -0x9b012a)\r\nDEF(wrmsr_ret, -0x9b14fc)\r\nDEF(dr2gpr_start, -0x9b61d3)\r\nDEF(gpr2dr_1_start, -0x9b60ba)\r\nDEF(gpr2dr_2_start, -0x9b5fc7)\r\nDEF(mov_cr3_rax_mov_ds, -0x9b5c29)\r\n\r\n//DEF(mov_rdi_cr3, -0x39067e)\r\nDEF(mov_rax_cr3, -0x38BC90)\r\n\r\nDEF(nop_ret, wrmsr_ret + 2)\r\nDEF(cpu_switch, -0x9b63c0)\r\nDEF(mprotect_fix_start, -0x8ee311)\r\nDEF(mprotect_fix_end, mprotect_fix_start+6)\r\nDEF(mmap_self_fix_1_start, -0x2c8f2d)\r\nDEF(mmap_self_fix_1_end, mmap_self_fix_1_start+2)\r\nDEF(mmap_self_fix_2_start, -0x1dcd1e)\r\nDEF(mmap_self_fix_2_end, mmap_self_fix_2_start+2)\r\n\r\nDEF(aslr_fix_start, -0x840660)\r\nDEF(aslr_fix_end, -0x840620)\r\n\t\t\t\t\t\t\t\t\t\t  \t\t\t\t\r\nDEF(sigaction_fix_start, -0x6b510f)\r\nDEF(sigaction_fix_end, -0x6b50b9)\r\nDEF(sysents, 0x16f720)\r\nDEF(sysents_ps4, 0x167170)\r\nDEF(sysentvec, 0xca0cd8)\r\nDEF(sysentvec_ps4, 0xca0e50)\r\nDEF(sceSblServiceMailbox, -0x675a60)\r\nDEF(sceSblAuthMgrSmIsLoadable2, -0x88a200)\r\nDEF(mdbg_call_fix, -0x6269b9)\r\nDEF(syscall_before, -0x7e8e2f)\r\nDEF(syscall_after, -0x7e8e0c)\r\nDEF(malloc, -0xa9da0)\r\nDEF(M_something, 0x12d3d70)\r\nDEF(loadSelfSegment_epilogue, -0x889a7d)\r\nDEF(loadSelfSegment_watchpoint, -0x2c8518)\r\nDEF(loadSelfSegment_watchpoint_lr, -0x889cd7)\r\nDEF(decryptSelfBlock_watchpoint_lr, -0x88993a)\r\nDEF(decryptSelfBlock_epilogue, -0x889873)\r\nDEF(decryptMultipleSelfBlocks_watchpoint_lr, -0x889205)\r\nDEF(decryptMultipleSelfBlocks_epilogue, -0x888d82)\r\nDEF(sceSblServiceMailbox_lr_verifyHeader, -0x889e7c)\r\nDEF(sceSblServiceMailbox_lr_loadSelfSegment, -0x889af1)\r\nDEF(sceSblServiceMailbox_lr_decryptSelfBlock, -0x8895c4)\r\nDEF(sceSblServiceMailbox_lr_decryptMultipleSelfBlocks, -0x888e3c)\r\nDEF(sceSblServiceMailbox_lr_sceSblAuthMgrSmFinalize, -0x88a27e)\r\nDEF(sceSblServiceMailbox_lr_verifySuperBlock, -0x92d670)\r\nDEF(sceSblServiceMailbox_lr_sceSblPfsClearKey_1, -0x92dc3b)\r\nDEF(sceSblServiceMailbox_lr_sceSblPfsClearKey_2, -0x92dbc5)\r\nDEF(sceSblServiceMailbox_lr_npdrm_cmd_5, -0x312c2d)\r\nDEF(sceSblServiceMailbox_lr_npdrm_cmd_6, -0x31298a)\r\nDEF(sceSblPfsSetKeys, -0x92d920)\r\nDEF(sceSblServiceCryptAsync, -0x8d1af0)\r\nDEF(sceSblServiceCryptAsync_deref_singleton, -0x8d1ab2)\r\nDEF(copyin, -0x96fd10)\r\nDEF(copyout, -0x96fdc0)\r\nDEF(crypt_message_resolve, -0x475400)\r\nDEF(justreturn, -0x9aedc0)\r\nDEF(justreturn_pop, justreturn+8)\r\nDEF(mini_syscore_header, 0xd4fe88)\r\nDEF(pop_all_iret, -0x9aecdb)\r\nDEF(pop_all_except_rdi_iret, pop_all_iret+4)\r\nDEF(push_pop_all_iret, -0x94e4d0)\r\nDEF(kernel_pmap_store, 0x31be218)\r\nDEF(crypt_singleton_array, 0x2d99830)\r\nDEF(security_flags, 0x6466474)\r\nDEF(targetid, 0x646647d)\r\nDEF(qa_flags, 0x6466498)\r\nDEF(utoken, 0x6466500)\r\nDEF(mov_rax_cr0, -0x9b6321)\r\nDEF(mov_cr0_rax, -0x9b631c)\r\nDEF(mov_rdi_cr2, -0x9b1d9a)\r\nDEF(lgdt_rdi, -0x96f630)\r\nDEF(lidt_lldt, -0x9b5b71)\r\nDEF(ltr_ax, -0x9b5b4f)\r\nDEF(kproc_shutdown, -0x94ac48)\r\nDEF(s_shutdown_final, 0x320cb3)\r\nDEF(eventhandler_register, -0x51f3e0)\r\nDEF(strlen_trap, -0x4415c8)\r\nDEF(lapic_map, 0x27c6f40)\r\n#include \"offset_list.txt\"\r\nEND_FW()\r\n\r\nSTART_FW(400)\r\nDEF(allproc, 0x27edcb8)\r\nDEF(idt, 0x64cdc80)\r\nDEF(gdt_array, 0x64cee30)\r\nDEF(tss_array, 0x64d0830)\r\nDEF(pcpu_array, 0x64d2280)\r\nDEF(doreti_iret, -0x9cf84c)\r\nDEF(add_rsp_iret, doreti_iret - 7)\r\nDEF(swapgs_add_rsp_iret, doreti_iret - 10)\r\nDEF(rep_movsb_pop_rbp_ret, -0x99002a)\r\nDEF(rdmsr_start, -0x9d0cfa)\r\nDEF(wrmsr_ret, -0x9d20cc)\r\nDEF(dr2gpr_start, -0x9d6d93)\r\nDEF(gpr2dr_1_start, -0x9d6c7a)\r\nDEF(gpr2dr_2_start, -0x9d6b87)\r\nDEF(mov_cr3_rax_mov_ds, -0x9d67e9)\r\n\r\n//DEF(mov_rdi_cr3, -0x3970ee)\r\nDEF(mov_rax_cr3, -0x392770) //??\r\n\r\nDEF(nop_ret, wrmsr_ret + 2)\r\nDEF(cpu_switch, -0x9d6f80)\r\nDEF(mprotect_fix_start, -0x90ac61)\r\nDEF(mprotect_fix_end, mprotect_fix_start+6)\r\nDEF(mmap_self_fix_1_start, -0x2cd3fd)\r\nDEF(mmap_self_fix_1_end, mmap_self_fix_1_start+2)\r\nDEF(mmap_self_fix_2_start, -0x1df3ae)\r\nDEF(mmap_self_fix_2_end, mmap_self_fix_2_start+2)\r\n\r\nDEF(aslr_fix_start, -0x85a312)\r\nDEF(aslr_fix_end, -0x85a2d2)\r\n\r\nDEF(sigaction_fix_start, -0x6c2989)\r\nDEF(sigaction_fix_end, -0x6c2933)\r\nDEF(sysents, 0x1709c0)\r\nDEF(sysents_ps4, 0x168410)\r\nDEF(sysentvec, 0xd11bb8)\r\nDEF(sysentvec_ps4, 0xd11d30)\r\nDEF(sceSblServiceMailbox, -0x6824c0)\r\nDEF(sceSblAuthMgrSmIsLoadable2, -0x8a5c40)\r\nDEF(mdbg_call_fix, -0x631eb9)\r\nDEF(syscall_before, -0x802311)\r\nDEF(syscall_after, -0x8022ee)\r\nDEF(malloc, -0xa9be0)\r\nDEF(M_something, 0x1346080)\r\nDEF(loadSelfSegment_epilogue, -0x8a54cd)\r\nDEF(loadSelfSegment_watchpoint, -0x2cc9f8)\r\nDEF(loadSelfSegment_watchpoint_lr, -0x8a5727)\r\nDEF(decryptSelfBlock_watchpoint_lr, -0x8a538a)\r\nDEF(decryptSelfBlock_epilogue, -0x8a52c3)\r\nDEF(decryptMultipleSelfBlocks_watchpoint_lr, -0x8a4c55)\r\nDEF(decryptMultipleSelfBlocks_epilogue, -0x8a47d2)\r\nDEF(sceSblServiceMailbox_lr_verifyHeader, -0x8a58bc)\r\nDEF(sceSblServiceMailbox_lr_loadSelfSegment, -0x8a5541)\r\nDEF(sceSblServiceMailbox_lr_decryptSelfBlock, -0x8a5014)\r\nDEF(sceSblServiceMailbox_lr_decryptMultipleSelfBlocks, -0x8a488c)\r\nDEF(sceSblServiceMailbox_lr_sceSblAuthMgrSmFinalize, -0x8a5cbe)\r\nDEF(sceSblServiceMailbox_lr_verifySuperBlock, -0x94a7f0)\r\nDEF(sceSblServiceMailbox_lr_sceSblPfsClearKey_1, -0x94ada4)\r\nDEF(sceSblServiceMailbox_lr_sceSblPfsClearKey_2, -0x94ad2e)\r\nDEF(sceSblServiceMailbox_lr_npdrm_cmd_5, 0)\r\nDEF(sceSblServiceMailbox_lr_npdrm_cmd_6, 0)\r\nDEF(sceSblPfsSetKeys, -0x94aaa0)\r\nDEF(sceSblServiceCryptAsync, -0x8ed940)\r\nDEF(sceSblServiceCryptAsync_deref_singleton, -0x8ed902)\r\nDEF(copyin, -0x9908e0)\r\nDEF(copyout, -0x990990)\r\nDEF(crypt_message_resolve, -0x479e40)\r\nDEF(justreturn, -0x9cf990)\r\nDEF(justreturn_pop, justreturn+8)\r\nDEF(mini_syscore_header, 0xdc16e8)\r\nDEF(pop_all_iret, -0x9cf8ab)\r\nDEF(pop_all_except_rdi_iret, pop_all_iret+4)\r\nDEF(push_pop_all_iret, -0x96bc30)\r\nDEF(kernel_pmap_store, 0x3257a78)\r\nDEF(crypt_singleton_array, 0x2e31830)\r\nDEF(security_flags, 0x6506474)\r\nDEF(targetid, 0x650647d)\r\nDEF(qa_flags, 0x6506498)\r\nDEF(utoken, 0x6506500)\r\nDEF(mov_rax_cr0, -0x9d6ee1)\r\nDEF(mov_cr0_rax, -0x9d6edc)\r\nDEF(mov_rdi_cr2, -0x9d296a)\r\nDEF(lgdt_rdi, -0x990200)\r\nDEF(lidt_lldt, -0x9d6731)\r\nDEF(ltr_ax, -0x9d670f)\r\nDEF(kproc_shutdown, -0x96af88)\r\nDEF(s_shutdown_final, 0x322c23)\r\nDEF(eventhandler_register, -0x525900)\r\nDEF(strlen_trap, -0x44a9f8)\r\nDEF(lapic_map, 0x2846fa0)\r\n#include \"offset_list.txt\"\r\nEND_FW()\r\n\r\nSTART_FW(402)\r\nDEF(allproc, 0x27edcb8)\r\nDEF(idt, 0x64cdc80)\r\nDEF(gdt_array, 0x64cee30)\r\nDEF(tss_array, 0x64d0830)\r\nDEF(pcpu_array, 0x64d2280)\r\nDEF(doreti_iret, -0x9cf84c)\r\nDEF(add_rsp_iret, doreti_iret - 7)\r\nDEF(swapgs_add_rsp_iret, doreti_iret - 10)\r\nDEF(rep_movsb_pop_rbp_ret, -0x99002a)\r\nDEF(rdmsr_start, -0x9d0cfa)\r\nDEF(wrmsr_ret, -0x9d20cc)\r\nDEF(dr2gpr_start, -0x9d6d93)\r\nDEF(gpr2dr_1_start, -0x9d6c7a)\r\nDEF(gpr2dr_2_start, -0x9d6b87)\r\nDEF(mov_cr3_rax_mov_ds, -0x9d67e9)\r\n\r\n//DEF(mov_rdi_cr3, -0x39709e)\r\nDEF(mov_rax_cr3, -0x392720) //??\r\n\r\nDEF(nop_ret, wrmsr_ret + 2)\r\nDEF(cpu_switch, -0x9d6f80)\r\nDEF(mprotect_fix_start, -0x90ac61)\r\nDEF(mprotect_fix_end, mprotect_fix_start+6)\r\nDEF(mmap_self_fix_1_start, -0x2cd3ad)\r\nDEF(mmap_self_fix_1_end, mmap_self_fix_1_start+2)\r\nDEF(mmap_self_fix_2_start, -0x1df35e)\r\nDEF(mmap_self_fix_2_end, mmap_self_fix_2_start+2)\r\n\r\nDEF(aslr_fix_start, -0x85a312)\r\nDEF(aslr_fix_end, -0x85a2d2)\r\n\r\nDEF(sigaction_fix_start, -0x6c2989)\r\nDEF(sigaction_fix_end, -0x6c2933)\r\nDEF(sysents, 0x1709c0)\r\nDEF(sysents_ps4, 0x168410)\r\nDEF(sysentvec, 0xd11bb8)\r\nDEF(sysentvec_ps4, 0xd11d30)\r\nDEF(sceSblServiceMailbox, -0x6824c0)\r\nDEF(sceSblAuthMgrSmIsLoadable2, -0x8a5c40)\r\nDEF(mdbg_call_fix, -0x631e99)\r\nDEF(syscall_before, -0x802311)\r\nDEF(syscall_after, -0x8022ee)\r\nDEF(malloc, -0xa9b90)\r\nDEF(M_something, 0x1346080)\r\nDEF(loadSelfSegment_epilogue, -0x8a54cd)\r\nDEF(loadSelfSegment_watchpoint, -0x2cc9a8)\r\nDEF(loadSelfSegment_watchpoint_lr, -0x8a5727)\r\nDEF(decryptSelfBlock_watchpoint_lr, -0x8a538a)\r\nDEF(decryptSelfBlock_epilogue, -0x8a52c3)\r\nDEF(decryptMultipleSelfBlocks_watchpoint_lr, -0x8a4c55)\r\nDEF(decryptMultipleSelfBlocks_epilogue, -0x8a47d2)\r\nDEF(sceSblServiceMailbox_lr_verifyHeader, -0x8a58bc)\r\nDEF(sceSblServiceMailbox_lr_loadSelfSegment, -0x8a5541)\r\nDEF(sceSblServiceMailbox_lr_decryptSelfBlock, -0x8a5014)\r\nDEF(sceSblServiceMailbox_lr_decryptMultipleSelfBlocks, -0x8a488c)\r\nDEF(sceSblServiceMailbox_lr_sceSblAuthMgrSmFinalize, -0x8a5cbe)\r\nDEF(sceSblServiceMailbox_lr_verifySuperBlock, -0x94a7f0)\r\nDEF(sceSblServiceMailbox_lr_sceSblPfsClearKey_1, -0x94ada4)\r\nDEF(sceSblServiceMailbox_lr_sceSblPfsClearKey_2, -0x94ad2e)\r\nDEF(sceSblServiceMailbox_lr_npdrm_cmd_5, 0)\r\nDEF(sceSblServiceMailbox_lr_npdrm_cmd_6, 0)\r\nDEF(sceSblPfsSetKeys, -0x94aaa0)\r\nDEF(sceSblServiceCryptAsync, -0x8ed940)\r\nDEF(sceSblServiceCryptAsync_deref_singleton, -0x8ed902)\r\nDEF(copyin, -0x9908e0)\r\nDEF(copyout, -0x990990)\r\nDEF(crypt_message_resolve, -0x479df0)\r\nDEF(justreturn, -0x9cf990)\r\nDEF(justreturn_pop, justreturn+8)\r\nDEF(mini_syscore_header, 0xdc16e8)\r\nDEF(pop_all_iret, -0x9cf8ab)\r\nDEF(pop_all_except_rdi_iret, pop_all_iret+4)\r\nDEF(push_pop_all_iret, -0x96d208)\r\nDEF(kernel_pmap_store, 0x3257a78)\r\nDEF(crypt_singleton_array, 0x2e31830)\r\nDEF(security_flags, 0x6505474)\r\nDEF(targetid, 0x650547d)\r\nDEF(qa_flags, 0x6505498)\r\nDEF(utoken, 0x6505500)\r\nDEF(mov_rax_cr0, -0x9d6ee1)\r\nDEF(mov_cr0_rax, -0x9d6edc)\r\nDEF(mov_rdi_cr2, -0x9d296a)\r\nDEF(lgdt_rdi, -0x990200)\r\nDEF(lidt_lldt, -0x9d6731)\r\nDEF(ltr_ax, -0x9d670f)\r\nDEF(kproc_shutdown, 0)\r\nDEF(s_shutdown_final, 0)\r\nDEF(eventhandler_register, 0)\r\nDEF(strlen_trap, 0)\r\nDEF(lapic_map, 0x2846fa0)\r\n#include \"offset_list.txt\"\r\nEND_FW()\r\n\r\nSTART_FW(403)\r\nDEF(allproc, 0x27edcb8)\r\nDEF(idt, 0x64cdc80)\r\nDEF(gdt_array, 0x64cee30)\r\nDEF(tss_array, 0x64d0830)\r\nDEF(pcpu_array, 0x64d2280)\r\nDEF(doreti_iret, -0x9cf84c)\r\nDEF(add_rsp_iret, doreti_iret - 7)\r\nDEF(swapgs_add_rsp_iret, doreti_iret - 10)\r\nDEF(rep_movsb_pop_rbp_ret, -0x99002a /*-0x990a55*/)\r\nDEF(rdmsr_start, -0x9d0cfa /*-0x9d6d02*/)\r\n//DEF(rdmsr_end, -0x9d6cf9)\r\nDEF(wrmsr_ret, -0x9d20cc)\r\nDEF(dr2gpr_start, -0x9d6d93)\r\n//DEF(dr2gpr_end, -0x9d6d7c)\r\nDEF(gpr2dr_1_start, -0x9d6c7a)\r\n//DEF(gpr2dr_1_end, -0x9d6c55)\r\nDEF(gpr2dr_2_start, -0x9d6b87)\r\n//DEF(gpr2dr_2_end, -0x9d6de9)\r\nDEF(mov_cr3_rax_mov_ds, -0x9d67e9)\r\n\r\n//DEF(mov_rdi_cr3, -0x39700e)\r\nDEF(mov_rax_cr3, -0x392690)\r\n\r\nDEF(nop_ret, wrmsr_ret + 2 /*-0x28a3a0*/)\r\nDEF(cpu_switch, -0x9d6f80)\r\nDEF(mprotect_fix_start, -0x90ac61)\r\nDEF(mprotect_fix_end, mprotect_fix_start+6)\r\nDEF(mmap_self_fix_1_start, -0x2cd31d)\r\nDEF(mmap_self_fix_1_end, mmap_self_fix_1_start+2)\r\nDEF(mmap_self_fix_2_start, -0x1df2ce)\r\nDEF(mmap_self_fix_2_end, mmap_self_fix_2_start+2)\r\n\r\nDEF(aslr_fix_start, -0x85a312)\r\nDEF(aslr_fix_end, -0x85a2d2)\r\n\r\nDEF(sigaction_fix_start, -0x6c2989)\r\nDEF(sigaction_fix_end, -0x6c2933)\r\nDEF(sysents, 0x1709c0)\r\nDEF(sysents_ps4, 0x168410)\r\nDEF(sysentvec, 0xd11bb8)\r\nDEF(sysentvec_ps4, 0xd11d30)\r\nDEF(sceSblServiceMailbox, -0x6824c0)\r\nDEF(sceSblAuthMgrSmIsLoadable2, -0x8a5c40)\r\nDEF(mdbg_call_fix, -0x631ea9)\r\nDEF(syscall_before, -0x802311)\r\nDEF(syscall_after, -0x8022ee)\r\nDEF(malloc, -0xa9b00)\r\nDEF(M_something, 0x1346080)\r\nDEF(loadSelfSegment_epilogue, -0x8a54cd)\r\nDEF(loadSelfSegment_watchpoint, -0x2cc918)\r\nDEF(loadSelfSegment_watchpoint_lr, -0x8a5727)\r\nDEF(decryptSelfBlock_watchpoint_lr, -0x8a538a)\r\nDEF(decryptSelfBlock_epilogue, -0x8a52c3)\r\nDEF(decryptMultipleSelfBlocks_watchpoint_lr, -0x8a4c55)\r\nDEF(decryptMultipleSelfBlocks_epilogue, -0x8a47d2)\r\nDEF(sceSblServiceMailbox_lr_verifyHeader, -0x8a58bc)\r\nDEF(sceSblServiceMailbox_lr_loadSelfSegment, -0x8a5541)\r\nDEF(sceSblServiceMailbox_lr_decryptSelfBlock, -0x8a5014)\r\nDEF(sceSblServiceMailbox_lr_decryptMultipleSelfBlocks, -0x8a488c)\r\nDEF(sceSblServiceMailbox_lr_sceSblAuthMgrSmFinalize, -0x8a5cbe)\r\nDEF(sceSblServiceMailbox_lr_verifySuperBlock, -0x94a7f0)\r\nDEF(sceSblServiceMailbox_lr_sceSblPfsClearKey_1, -0x94ada4)\r\nDEF(sceSblServiceMailbox_lr_sceSblPfsClearKey_2, -0x94ad2e)\r\nDEF(sceSblServiceMailbox_lr_npdrm_cmd_5, -0x3189EE)\r\nDEF(sceSblServiceMailbox_lr_npdrm_cmd_6, -0x31873A)\r\nDEF(sceSblPfsSetKeys, -0x94aaa0)\r\n//DEF(panic, -0x21020)\r\nDEF(sceSblServiceCryptAsync, -0x8ed940)\r\nDEF(sceSblServiceCryptAsync_deref_singleton, -0x8ed902)\r\nDEF(copyin, -0x9908e0)\r\nDEF(copyout, -0x990990)\r\nDEF(crypt_message_resolve, -0x479d60)\r\nDEF(justreturn, -0x9cf990)\r\nDEF(justreturn_pop, justreturn+8)\r\nDEF(mini_syscore_header, 0xdc16e8)\r\nDEF(pop_all_iret, -0x9cf8ab)\r\nDEF(pop_all_except_rdi_iret, pop_all_iret+4)\r\nDEF(push_pop_all_iret, -0x96be70)\r\nDEF(kernel_pmap_store, 0x3257a78)\r\nDEF(crypt_singleton_array, 0x2e31830)\r\nDEF(security_flags, 0x6506474)\r\nDEF(targetid, 0x650647d)\r\nDEF(qa_flags, 0x6506498)\r\nDEF(utoken, 0x6506500)\r\nDEF(mov_rax_cr0, -0x9d6ee1)\r\nDEF(mov_cr0_rax, -0x9d6edc)\r\nDEF(mov_rdi_cr2, -0x9d296a)\r\nDEF(lgdt_rdi, -0x990200)\r\nDEF(lidt_lldt, -0x9d6731)\r\nDEF(ltr_ax, -0x9d670f)\r\nDEF(kproc_shutdown, -0x96ad58)\r\nDEF(s_shutdown_final, 0x322db7)\r\nDEF(eventhandler_register, -0x525820)\r\nDEF(strlen_trap, -0x44a918)\r\nDEF(lapic_map, 0x2846fa0)\r\n#include \"offset_list.txt\"\r\nEND_FW()\r\n\r\nSTART_FW(450)\r\nDEF(allproc, 0x27edcb8)\r\nDEF(idt, 0x64cdc80)\r\nDEF(gdt_array, 0x64cee30)\r\nDEF(tss_array, 0x64d0830)\r\nDEF(pcpu_array, 0x64d2280)\r\nDEF(doreti_iret, -0x9cf84c)\r\nDEF(add_rsp_iret, doreti_iret - 7)\r\nDEF(swapgs_add_rsp_iret, doreti_iret - 10)\r\nDEF(rep_movsb_pop_rbp_ret, -0x99002a /*-0x990a55*/)\r\nDEF(rdmsr_start, -0x9d0cfa /*-0x9d6d02*/)\r\n//DEF(rdmsr_end, -0x9d6cf9)\r\nDEF(wrmsr_ret, -0x9d20cc)\r\nDEF(dr2gpr_start, -0x9d6d93)\r\n//DEF(dr2gpr_end, -0x9d6d7c)\r\nDEF(gpr2dr_1_start, -0x9d6c7a)\r\n//DEF(gpr2dr_1_end, -0x9d6c55)\r\nDEF(gpr2dr_2_start, -0x9d6b87)\r\n//DEF(gpr2dr_2_end, -0x9d6de9)\r\nDEF(mov_cr3_rax_mov_ds, -0x9d67e9)\r\n\r\n//DEF(mov_rdi_cr3, -0x396ebe)\r\nDEF(mov_rax_cr3, -0x392540)\r\n\r\nDEF(nop_ret, -0x396de1)\r\nDEF(cpu_switch, -0x9d6f80)\r\nDEF(mprotect_fix_start, -0x90ac61)\r\nDEF(mprotect_fix_end, mprotect_fix_start+6)\r\nDEF(mmap_self_fix_1_start, -0x2cd16d)\r\nDEF(mmap_self_fix_1_end, mmap_self_fix_1_start+2)\r\nDEF(mmap_self_fix_2_start, -0x1df11e)\r\nDEF(mmap_self_fix_2_end, mmap_self_fix_2_start+2)\r\n\r\nDEF(aslr_fix_start, -0x85A342)\r\nDEF(aslr_fix_end, -0x85A302)\r\n\r\nDEF(sigaction_fix_start, -0x6c2959)\r\nDEF(sigaction_fix_end, -0x6c2903)\r\nDEF(sysents, 0x1709c0)\r\nDEF(sysents_ps4, 0x168410)\r\nDEF(sysentvec, 0xd11bb8)\r\nDEF(sysentvec_ps4, 0xd11d30)\r\nDEF(sceSblServiceMailbox, -0x682490)\r\nDEF(sceSblAuthMgrSmIsLoadable2, -0x8a5be0)\r\nDEF(mdbg_call_fix, -0x631e79)\r\nDEF(syscall_before, -0x8022e1)\r\nDEF(syscall_after, -0x8022be)\r\nDEF(malloc, -0xa9940)\r\nDEF(M_something, 0x1346080)\r\nDEF(loadSelfSegment_epilogue, -0x8a546d)\r\nDEF(loadSelfSegment_watchpoint, -0x2cc768)\r\nDEF(loadSelfSegment_watchpoint_lr, -0x8a56c7)\r\n//DEF(decryptSelfBlock_watchpoint, -0x2cc6de)\r\nDEF(decryptSelfBlock_watchpoint_lr, -0x8a532a)\r\nDEF(decryptSelfBlock_epilogue, -0x8a5263)\r\nDEF(decryptMultipleSelfBlocks_watchpoint_lr, -0x8a4bf5)\r\nDEF(decryptMultipleSelfBlocks_epilogue, -0x8a4772)\r\nDEF(sceSblServiceMailbox_lr_verifyHeader, -0x8a585c)\r\nDEF(sceSblServiceMailbox_lr_loadSelfSegment, -0x8a54e1)\r\nDEF(sceSblServiceMailbox_lr_decryptSelfBlock, -0x8a4fb4)\r\nDEF(sceSblServiceMailbox_lr_decryptMultipleSelfBlocks, -0x8a482c)\r\nDEF(sceSblServiceMailbox_lr_sceSblAuthMgrSmFinalize, -0x8a5c5e)\r\nDEF(sceSblServiceMailbox_lr_verifySuperBlock, -0x94a7f0)\r\nDEF(sceSblServiceMailbox_lr_sceSblPfsClearKey_1, -0x94ada4)\r\nDEF(sceSblServiceMailbox_lr_sceSblPfsClearKey_2, -0x94ad2e)\r\nDEF(sceSblServiceMailbox_lr_npdrm_cmd_5, -0x31889e)\r\nDEF(sceSblServiceMailbox_lr_npdrm_cmd_6, -0x3185ea)\r\nDEF(sceSblPfsSetKeys, -0x94aaa0)\r\n//DEF(panic, -0x20e40)\r\nDEF(sceSblServiceCryptAsync, -0x8ed930)\r\nDEF(sceSblServiceCryptAsync_deref_singleton, -0x8ed8f2)\r\nDEF(copyin, -0x9908e0)\r\nDEF(copyout, -0x990990)\r\nDEF(crypt_message_resolve, -0x479c30)\r\nDEF(justreturn, -0x9cf990)\r\nDEF(justreturn_pop, justreturn+8)\r\nDEF(mini_syscore_header, 0xdc16e8)\r\nDEF(pop_all_iret, -0x9cf8ab)\r\nDEF(pop_all_except_rdi_iret, pop_all_iret+4)\r\nDEF(push_pop_all_iret, -0x96db88)\r\nDEF(kernel_pmap_store, 0x3257a78)\r\nDEF(crypt_singleton_array, 0x2e31830)\r\nDEF(security_flags, 0x6506474)\r\nDEF(targetid, 0x650647d)\r\nDEF(qa_flags, 0x6506498)\r\nDEF(utoken, 0x6506500)\r\nDEF(mov_rax_cr0, -0x9d6ee1)\r\nDEF(mov_cr0_rax, -0x9d6edc)\r\nDEF(mov_rdi_cr2, -0x9d296a)\r\nDEF(lgdt_rdi, -0x990200)\r\nDEF(lidt_lldt, -0x9d6731)\r\nDEF(ltr_ax, -0x9d670f)\r\nDEF(kproc_shutdown, -0x966340)\r\nDEF(s_shutdown_final, 0x322a0e)\r\nDEF(eventhandler_register, -0x525710)\r\nDEF(strlen_trap, -0x44a7e8)\r\nDEF(lapic_map, 0x2846fa0)\r\n#include \"offset_list.txt\"\r\nEND_FW()\r\n\r\nSTART_FW(451)\r\nDEF(allproc, 0x27edcb8)\r\nDEF(idt, 0x64cdc80)\r\nDEF(gdt_array, 0x64cee30)\r\nDEF(tss_array, 0x64d0830)\r\nDEF(pcpu_array, 0x64d2280)\r\nDEF(doreti_iret, -0x9cf84c)\r\nDEF(add_rsp_iret, doreti_iret - 7)\r\nDEF(swapgs_add_rsp_iret, doreti_iret - 10)\r\nDEF(rep_movsb_pop_rbp_ret, -0x99002a)\r\nDEF(rdmsr_start, -0x9d0cfa)\r\n//DEF(rdmsr_end, -0x9d6cf9)\r\nDEF(wrmsr_ret, -0x9d20cc)\r\nDEF(dr2gpr_start, -0x9d6d93)\r\n//DEF(dr2gpr_end, -0x9d6d7c)\r\nDEF(gpr2dr_1_start, -0x9d6c7a)\r\n//DEF(gpr2dr_1_end, -0x9d6c55)\r\nDEF(gpr2dr_2_start, -0x9d6b87)\r\n//DEF(gpr2dr_2_end, -0x9d6de9)\r\nDEF(mov_cr3_rax_mov_ds, -0x9d67e9)\r\n\r\n//DEF(mov_rdi_cr3, -0x396b1e)\r\nDEF(mov_rax_cr3, -0x3921A0)\r\n\r\nDEF(nop_ret, wrmsr_ret + 2)\r\nDEF(cpu_switch, -0x9d6f80)\r\nDEF(mprotect_fix_start, -0x90ac61)\r\nDEF(mprotect_fix_end, mprotect_fix_start+6)\r\nDEF(mmap_self_fix_1_start, -0x2ccdcd)\r\nDEF(mmap_self_fix_1_end, mmap_self_fix_1_start+2)\r\nDEF(mmap_self_fix_2_start, -0x1ded7e)\r\nDEF(mmap_self_fix_2_end, mmap_self_fix_2_start+2)\r\n\r\nDEF(aslr_fix_start, -0x85A342)\r\nDEF(aslr_fix_end, -0x85A302)\r\n\r\nDEF(sigaction_fix_start, -0x6c2959)\r\nDEF(sigaction_fix_end, -0x6c2903)\r\nDEF(sysents, 0x1709c0)\r\nDEF(sysents_ps4, 0x168410)\r\nDEF(sysentvec, 0xd11bb8)\r\nDEF(sysentvec_ps4, 0xd11d30)\r\nDEF(sceSblServiceMailbox, -0x682490)\r\nDEF(sceSblAuthMgrSmIsLoadable2, -0x8a5be0)\r\nDEF(mdbg_call_fix, -0x631e79)\r\nDEF(syscall_before, -0x8022e1)\r\nDEF(syscall_after, -0x8022be)\r\nDEF(malloc, -0xa9510)\r\nDEF(M_something, 0x1346080)\r\nDEF(loadSelfSegment_epilogue, -0x8a546d)\r\nDEF(loadSelfSegment_watchpoint, -0x2cc3c8)\r\nDEF(loadSelfSegment_watchpoint_lr, -0x8a56c7)\r\n//DEF(decryptSelfBlock_watchpoint, -0x2cc33e)\r\nDEF(decryptSelfBlock_watchpoint_lr, -0x8a532a)\r\nDEF(decryptSelfBlock_epilogue, -0x8a5263)\r\nDEF(decryptMultipleSelfBlocks_watchpoint_lr, -0x8a4bf5)\r\nDEF(decryptMultipleSelfBlocks_epilogue, -0x8a4772)\r\nDEF(sceSblServiceMailbox_lr_verifyHeader, -0x8a585c)\r\nDEF(sceSblServiceMailbox_lr_loadSelfSegment, -0x8a54e1)\r\nDEF(sceSblServiceMailbox_lr_decryptSelfBlock, -0x8a4fb4)\r\nDEF(sceSblServiceMailbox_lr_decryptMultipleSelfBlocks, -0x8a482c)\r\nDEF(sceSblServiceMailbox_lr_sceSblAuthMgrSmFinalize, -0x8a5c5e)\r\nDEF(sceSblServiceMailbox_lr_verifySuperBlock, -0x94a7f0)\r\nDEF(sceSblServiceMailbox_lr_sceSblPfsClearKey_1, -0x94ada4)\r\nDEF(sceSblServiceMailbox_lr_sceSblPfsClearKey_2, -0x94ad2e)\r\nDEF(sceSblServiceMailbox_lr_npdrm_cmd_5, -0x3184fe)\r\nDEF(sceSblServiceMailbox_lr_npdrm_cmd_6, -0x31824a)\r\nDEF(sceSblPfsSetKeys, -0x94aaa0)\r\n//DEF(panic, -0x20a10)\r\nDEF(sceSblServiceCryptAsync, -0x8ed930)\r\nDEF(sceSblServiceCryptAsync_deref_singleton, -0x8ed8f2)\r\nDEF(copyin, -0x9908e0)\r\nDEF(copyout, -0x990990)\r\nDEF(crypt_message_resolve, -0x479890)\r\nDEF(justreturn, -0x9cf990)\r\nDEF(justreturn_pop, justreturn+8)\r\nDEF(mini_syscore_header, 0xdc16e8)\r\nDEF(pop_all_iret, -0x9cf8ab)\r\nDEF(pop_all_except_rdi_iret, pop_all_iret+4)\r\nDEF(push_pop_all_iret, -0x96d488)\r\nDEF(kernel_pmap_store, 0x3257a78)\r\nDEF(crypt_singleton_array, 0x2e31830)\r\nDEF(security_flags, 0x6506474)\r\nDEF(targetid, 0x650647d)\r\nDEF(qa_flags, 0x6506498)\r\nDEF(utoken, 0x6506500)\r\nDEF(mov_rax_cr0, -0x9d6ee1)\r\nDEF(mov_cr0_rax, -0x9d6edc)\r\nDEF(mov_rdi_cr2, -0x9d296a)\r\nDEF(lgdt_rdi, -0x990200)\r\nDEF(lidt_lldt, -0x9d6731)\r\nDEF(ltr_ax, -0x9d670f)\r\nDEF(kproc_shutdown, -0x96b328)\r\nDEF(s_shutdown_final, 0x322c1f)\r\nDEF(eventhandler_register, -0x525370)\r\nDEF(strlen_trap, -0x44a448)\r\nDEF(lapic_map, 0x2846fa0)\r\n#include \"offset_list.txt\"\r\nEND_FW()\r\n\r\nSTART_FW(500)\r\nDEF(allproc, 0x291dd00)\r\nDEF(idt, 0x660dca0)\r\nDEF(gdt_array, 0x660ee50)\r\nDEF(tss_array, 0x6610850)\r\nDEF(pcpu_array, 0x6622680)\r\nDEF(doreti_iret, -0xa04f93)\r\nDEF(add_rsp_iret, doreti_iret - 7)\r\nDEF(swapgs_add_rsp_iret, doreti_iret - 10)\r\nDEF(rep_movsb_pop_rbp_ret, -0x9c576a)\r\nDEF(rdmsr_start, -0xa0652a)\r\nDEF(wrmsr_ret, -0xa078fc)\r\nDEF(dr2gpr_start, -0xa0bf13)\r\nDEF(gpr2dr_1_start, -0xa0bdfa)\r\nDEF(gpr2dr_2_start, -0xa0bd07)\r\nDEF(mov_cr3_rax_mov_ds, -0xa0b969)\r\n\r\n//DEF(mov_rdi_cr3, -0x3a989e)\r\nDEF(mov_rax_cr3, -0x3A4E30)\r\n\r\nDEF(nop_ret, wrmsr_ret + 2)\r\nDEF(cpu_switch, -0xa0c100)\r\nDEF(mprotect_fix_start, -0x93efa2)\r\nDEF(mprotect_fix_end, mprotect_fix_start+6)\r\n\r\nDEF(mmap_self_fix_1_start, 0x0)\r\nDEF(mmap_self_fix_1_end, mmap_self_fix_1_start+2)\r\nDEF(mmap_self_fix_2_start, 0x0)\r\nDEF(mmap_self_fix_2_end, mmap_self_fix_2_start+2)\r\n\r\nDEF(aslr_fix_start, -0x88c5aa)\r\nDEF(aslr_fix_end, aslr_fix_start+2)\r\n\r\nDEF(sigaction_fix_start, -0x6e7db0)\r\nDEF(sigaction_fix_end, -0x6e7d6e)\r\nDEF(sysents, 0x1b1ef0)\r\nDEF(sysents_ps4, 0x1a9940)\r\nDEF(sysentvec, 0xe00be8)\r\nDEF(sysentvec_ps4, 0xe00d60)\r\nDEF(sceSblServiceMailbox, -0x6a5de0)\r\nDEF(sceSblAuthMgrSmIsLoadable2, -0x8d90d0)\r\nDEF(mdbg_call_fix, -0x650049)\r\nDEF(syscall_before, -0x8357e1)\r\nDEF(syscall_after, -0x8357be)\r\nDEF(malloc, -0xb4df0)\r\nDEF(M_something, 0x14355a0)\r\nDEF(loadSelfSegment_epilogue, -0x8d898d)\r\nDEF(loadSelfSegment_watchpoint, -0x2dd358)\r\nDEF(loadSelfSegment_watchpoint_lr, -0x8d8be7)\r\nDEF(decryptSelfBlock_watchpoint_lr, -0x8d885f)\r\nDEF(decryptSelfBlock_epilogue, -0x8d87a2)\r\n//DEF(decryptMultipleSelfBlocks_watchpoint_lr, -0x8d8112) //403\r\nDEF(decryptMultipleSelfBlocks_watchpoint_lr, -0x8d8119) //550\r\nDEF(decryptMultipleSelfBlocks_epilogue, -0x8d7ee4)\r\nDEF(sceSblServiceMailbox_lr_verifyHeader, -0x8d8d76)\r\nDEF(sceSblServiceMailbox_lr_loadSelfSegment, -0x8d8a01)\r\nDEF(sceSblServiceMailbox_lr_decryptSelfBlock, -0x8d8439)\r\nDEF(sceSblServiceMailbox_lr_decryptMultipleSelfBlocks, -0x8d7c58)\r\nDEF(sceSblServiceMailbox_lr_sceSblAuthMgrSmFinalize, -0x8d914e)\r\nDEF(sceSblServiceMailbox_lr_verifySuperBlock, -0x97f430)\r\nDEF(sceSblServiceMailbox_lr_sceSblPfsClearKey_1, -0x97f9df)\r\nDEF(sceSblServiceMailbox_lr_sceSblPfsClearKey_2, -0x97f969)\r\nDEF(sceSblServiceMailbox_lr_npdrm_cmd_5, -0x32beff)\r\nDEF(sceSblServiceMailbox_lr_npdrm_cmd_6, -0x32bc4a)\r\n//DEF(sceSblPfsSetKeys, -0x97f6e0) // 403\r\nDEF(sceSblPfsSetKeys, -0x9805e0) // 550\r\nDEF(sceSblServiceCryptAsync, -0x921ac0)\r\nDEF(sceSblServiceCryptAsync_deref_singleton, -0x921a82)\r\nDEF(copyin, -0x9c6020)\r\nDEF(copyout, -0x9c60d0)\r\nDEF(crypt_message_resolve, -0x48c080)\r\nDEF(justreturn, -0xa051c0)\r\nDEF(justreturn_pop, justreturn+8)\r\nDEF(mini_syscore_header, 0xeaf938)\r\nDEF(pop_all_iret, -0xa04ff2)\r\nDEF(pop_all_except_rdi_iret, pop_all_iret+4)\r\nDEF(push_pop_all_iret, -0x9a2d78)\r\nDEF(kernel_pmap_store, 0x3398a88)\r\nDEF(crypt_singleton_array, 0x2f51830)\r\nDEF(security_flags, 0x66466ec)\r\nDEF(targetid, 0x66466f5)\r\nDEF(qa_flags, 0x6646710)\r\nDEF(utoken, 0x6646778)\r\nDEF(mov_rax_cr0, -0xa0c061)\r\nDEF(mov_cr0_rax, -0xa0c05c)\r\nDEF(mov_rdi_cr2, -0xa0828a)\r\nDEF(lgdt_rdi, -0x9c5940)\r\nDEF(lidt_lldt, -0xa0b8b1)\r\nDEF(ltr_ax, -0xa0b88f)\r\nDEF(kproc_shutdown, -0x99ff48)\r\nDEF(s_shutdown_final, 0x364a01)\r\nDEF(eventhandler_register, -0x5375e0)\r\nDEF(strlen_trap, -0x45b98c)\r\nDEF(lapic_map, 0x2976fb0)\r\n#include \"offset_list.txt\"\r\nEND_FW()\r\n\r\nSTART_FW(502)\r\nDEF(allproc, 0x291dd00)\r\nDEF(idt, 0x660dca0)\r\nDEF(gdt_array, 0x660ee50)\r\nDEF(tss_array, 0x6610850)\r\nDEF(pcpu_array, 0x6622680)\r\nDEF(doreti_iret, -0xa04f93)\r\nDEF(add_rsp_iret, doreti_iret - 7)\r\nDEF(swapgs_add_rsp_iret, doreti_iret - 10)\r\nDEF(rep_movsb_pop_rbp_ret, -0x9c576a)\r\nDEF(rdmsr_start, -0xa0652a)\r\nDEF(wrmsr_ret, -0xa078fc)\r\nDEF(dr2gpr_start, -0xa0bf13)\r\nDEF(gpr2dr_1_start, -0xa0bdfa)\r\nDEF(gpr2dr_2_start, -0xa0bd07)\r\nDEF(mov_cr3_rax_mov_ds, -0xa0b969)\r\n\r\n//DEF(mov_rdi_cr3, -0x3a989e)\r\nDEF(mov_rax_cr3, -0x3A4E30)\r\n\r\nDEF(nop_ret, wrmsr_ret + 2)\r\nDEF(cpu_switch, -0xa0c100)\r\nDEF(mprotect_fix_start, -0x93efa2)\r\nDEF(mprotect_fix_end, mprotect_fix_start+6)\r\n\r\nDEF(mmap_self_fix_1_start, 0x0)\r\nDEF(mmap_self_fix_1_end, mmap_self_fix_1_start+2)\r\nDEF(mmap_self_fix_2_start, 0x0)\r\nDEF(mmap_self_fix_2_end, mmap_self_fix_2_start+2)\r\n\r\nDEF(aslr_fix_start, -0x88c5aa)\r\nDEF(aslr_fix_end, aslr_fix_start+2)\r\n\r\nDEF(sigaction_fix_start, -0x6e7db0)\r\nDEF(sigaction_fix_end, -0x6e7d6e)\r\nDEF(sysents, 0x1b1ef0)\r\nDEF(sysents_ps4, 0x1a9940)\r\nDEF(sysentvec, 0xe00be8)\r\nDEF(sysentvec_ps4, 0xe00d60)\r\nDEF(sceSblServiceMailbox, -0x6a5de0)\r\nDEF(sceSblAuthMgrSmIsLoadable2, -0x8d90d0)\r\nDEF(mdbg_call_fix, -0x650049)\r\nDEF(syscall_before, -0x8357e1)\r\nDEF(syscall_after, -0x8357be)\r\nDEF(malloc, -0xb4df0)\r\nDEF(M_something, 0x14355a0)\r\nDEF(loadSelfSegment_epilogue, -0x8d898d)\r\nDEF(loadSelfSegment_watchpoint, -0x2dd358)\r\nDEF(loadSelfSegment_watchpoint_lr, -0x8d8be7)\r\nDEF(decryptSelfBlock_watchpoint_lr, -0x8d885f)\r\nDEF(decryptSelfBlock_epilogue, -0x8d87a2)\r\n//DEF(decryptMultipleSelfBlocks_watchpoint_lr, -0x8d8112) //403\r\nDEF(decryptMultipleSelfBlocks_watchpoint_lr, -0x8d8119) //550\r\nDEF(decryptMultipleSelfBlocks_epilogue, -0x8d7ee4)\r\nDEF(sceSblServiceMailbox_lr_verifyHeader, -0x8d8d76)\r\nDEF(sceSblServiceMailbox_lr_loadSelfSegment, -0x8d8a01)\r\nDEF(sceSblServiceMailbox_lr_decryptSelfBlock, -0x8d8439)\r\nDEF(sceSblServiceMailbox_lr_decryptMultipleSelfBlocks, -0x8d7c58)\r\nDEF(sceSblServiceMailbox_lr_sceSblAuthMgrSmFinalize, -0x8d914e)\r\nDEF(sceSblServiceMailbox_lr_verifySuperBlock, -0x97f430)\r\nDEF(sceSblServiceMailbox_lr_sceSblPfsClearKey_1, -0x97f9df)\r\nDEF(sceSblServiceMailbox_lr_sceSblPfsClearKey_2, -0x97f969)\r\nDEF(sceSblServiceMailbox_lr_npdrm_cmd_5, -0x32beff)\r\nDEF(sceSblServiceMailbox_lr_npdrm_cmd_6, -0x32bc4a)\r\n//DEF(sceSblPfsSetKeys, -0x97f6e0) // 403\r\nDEF(sceSblPfsSetKeys, -0x9805e0) // 550\r\nDEF(sceSblServiceCryptAsync, -0x921ac0)\r\nDEF(sceSblServiceCryptAsync_deref_singleton, -0x921a82)\r\nDEF(copyin, -0x9c6020)\r\nDEF(copyout, -0x9c60d0)\r\nDEF(crypt_message_resolve, -0x48c080)\r\nDEF(justreturn, -0xa051c0)\r\nDEF(justreturn_pop, justreturn+8)\r\nDEF(mini_syscore_header, 0xeaf938)\r\nDEF(pop_all_iret, -0xa04ff2)\r\nDEF(pop_all_except_rdi_iret, pop_all_iret+4)\r\nDEF(push_pop_all_iret, -0x9a33c8)\r\nDEF(kernel_pmap_store, 0x3398a88)\r\nDEF(crypt_singleton_array, 0x2f51830)\r\nDEF(security_flags, 0x66466ec)\r\nDEF(targetid, 0x66466f5)\r\nDEF(qa_flags, 0x6646710)\r\nDEF(utoken, 0x6646778)\r\nDEF(mov_rax_cr0, -0xa0c061)\r\nDEF(mov_cr0_rax, -0xa0c05c)\r\nDEF(mov_rdi_cr2, -0xa0828a)\r\nDEF(lgdt_rdi, -0x9c5940)\r\nDEF(lidt_lldt, -0xa0b8b1)\r\nDEF(ltr_ax, -0xa0b88f)\r\nDEF(kproc_shutdown, -0x99ff48)\r\nDEF(s_shutdown_final, 0x364a01)\r\nDEF(eventhandler_register, -0x5375e0)\r\nDEF(strlen_trap, -0x45b98c)\r\nDEF(lapic_map, 0x2976fb0)\r\n#include \"offset_list.txt\"\r\nEND_FW()\r\n\r\nSTART_FW(510)\r\nDEF(allproc, 0x291dd00)\r\nDEF(idt, 0x660dca0)\r\nDEF(gdt_array, 0x660ee50)\r\nDEF(tss_array, 0x6610850)\r\nDEF(pcpu_array, 0x6622680)\r\nDEF(doreti_iret, -0xa04f93)\r\nDEF(add_rsp_iret, doreti_iret - 7)\r\nDEF(swapgs_add_rsp_iret, doreti_iret - 10)\r\nDEF(rep_movsb_pop_rbp_ret, -0x9c576a)\r\nDEF(rdmsr_start, -0xa0652a)\r\nDEF(wrmsr_ret, -0xa078fc)\r\nDEF(dr2gpr_start, -0xa0bf13)\r\nDEF(gpr2dr_1_start, -0xa0bdfa)\r\nDEF(gpr2dr_2_start, -0xa0bd07)\r\nDEF(mov_cr3_rax_mov_ds, -0xa0b969)\r\n\r\n//DEF(mov_rdi_cr3, -0x3a96ce)\r\nDEF(mov_rax_cr3, -0x3A4C60)\r\n\r\nDEF(nop_ret, wrmsr_ret + 2)\r\nDEF(cpu_switch, -0xa0c100)\r\nDEF(mprotect_fix_start, -0x93efa2)\r\nDEF(mprotect_fix_end, mprotect_fix_start+6)\r\n\r\nDEF(mmap_self_fix_1_start, 0x0)\r\nDEF(mmap_self_fix_1_end, mmap_self_fix_1_start+2)\r\nDEF(mmap_self_fix_2_start, 0x0)\r\nDEF(mmap_self_fix_2_end, mmap_self_fix_2_start+2)\r\n\r\nDEF(aslr_fix_start, -0x88c5aa)\r\nDEF(aslr_fix_end, aslr_fix_start+2)\r\n\r\nDEF(sigaction_fix_start, -0x6e7be0)\r\nDEF(sigaction_fix_end, -0x6e7b9e)\r\nDEF(sysents, 0x1b2040)\r\nDEF(sysents_ps4, 0x1a9a90)\r\nDEF(sysentvec, 0xe00be8)\r\nDEF(sysentvec_ps4, 0xe00d60)\r\nDEF(sceSblServiceMailbox, -0x6a5c10)\r\nDEF(sceSblAuthMgrSmIsLoadable2, -0x8d90d0)\r\nDEF(mdbg_call_fix, -0x64fe79)\r\nDEF(syscall_before, -0x8357e1)\r\nDEF(syscall_after, -0x8357be)\r\nDEF(malloc, -0xb4ac0)\r\nDEF(M_something, 0x14355a0)\r\nDEF(loadSelfSegment_epilogue, -0x8d898d)\r\nDEF(loadSelfSegment_watchpoint, -0x2dd108)\r\nDEF(loadSelfSegment_watchpoint_lr, -0x8d8be7)\r\nDEF(decryptSelfBlock_watchpoint_lr, -0x8d885f)\r\nDEF(decryptSelfBlock_epilogue, -0x8d87a2)\r\nDEF(decryptMultipleSelfBlocks_watchpoint_lr, -0x8d8119)\r\nDEF(decryptMultipleSelfBlocks_epilogue, -0x8d7ee4)\r\nDEF(sceSblServiceMailbox_lr_verifyHeader, -0x8d8d76)\r\nDEF(sceSblServiceMailbox_lr_loadSelfSegment, -0x8d8A01)\r\nDEF(sceSblServiceMailbox_lr_decryptSelfBlock, -0x8d8439)\r\nDEF(sceSblServiceMailbox_lr_decryptMultipleSelfBlocks, -0x8d7C58)\r\nDEF(sceSblServiceMailbox_lr_sceSblAuthMgrSmFinalize, -0x8d914E)\r\nDEF(sceSblServiceMailbox_lr_verifySuperBlock, -0x97F430)\r\nDEF(sceSblServiceMailbox_lr_sceSblPfsClearKey_1, -0x97F9DF)\r\nDEF(sceSblServiceMailbox_lr_sceSblPfsClearKey_2, -0x97F969)\r\nDEF(sceSblServiceMailbox_lr_npdrm_cmd_5, -0x32bcab)\r\nDEF(sceSblServiceMailbox_lr_npdrm_cmd_6, -0x32b9fa)\r\nDEF(sceSblPfsSetKeys, -0x9805E0)\r\nDEF(sceSblServiceCryptAsync, -0x921AC0)\r\nDEF(sceSblServiceCryptAsync_deref_singleton, -0x921A82)\r\nDEF(copyin, -0x9c6020)\r\nDEF(copyout, -0x9c60D0)\r\nDEF(crypt_message_resolve, -0x48BEB0)\r\nDEF(justreturn, -0xa051c0)\r\nDEF(justreturn_pop, justreturn+8)\r\nDEF(mini_syscore_header, 0xeb0938)\r\nDEF(pop_all_iret, -0xa04ff2)\r\nDEF(pop_all_except_rdi_iret, pop_all_iret+4)\r\nDEF(push_pop_all_iret, -0x9a3e70)\r\nDEF(kernel_pmap_store, 0x3398a88)\r\nDEF(crypt_singleton_array, 0x2f51830)\r\nDEF(security_flags, 0x66466EC)\r\nDEF(targetid, 0x66466F5)\r\nDEF(qa_flags, 0x6646710)\r\nDEF(utoken, 0x6646778)\r\nDEF(mov_rax_cr0, -0xa0c061)\r\nDEF(mov_cr0_rax, -0xa0c05c)\r\nDEF(mov_rdi_cr2, -0xa0828a)\r\nDEF(lgdt_rdi, -0x9c5940)\r\nDEF(lidt_lldt, -0xa0b8b1)\r\nDEF(ltr_ax, -0xa0b88f)\r\nDEF(kproc_shutdown, -0x9a0c60)\r\nDEF(s_shutdown_final, 0x3648c2)\r\nDEF(eventhandler_register, -0x537410)\r\nDEF(strlen_trap, -0x45B7BC)\r\nDEF(lapic_map, 0x2976fb0)\r\n#include \"offset_list.txt\"\r\nEND_FW()\r\n\r\nSTART_FW(550)\r\nDEF(allproc, 0x291dd00)\r\nDEF(idt, 0x660dca0)\r\nDEF(gdt_array, 0x660ee50)\r\nDEF(tss_array, 0x6610850)\r\nDEF(pcpu_array, 0x6622680)\r\nDEF(doreti_iret, -0xa04fd3)\r\nDEF(add_rsp_iret, doreti_iret - 7)\r\nDEF(swapgs_add_rsp_iret, doreti_iret - 10)\r\nDEF(rep_movsb_pop_rbp_ret, -0x9c57aa)\r\nDEF(rdmsr_start, -0xa0656a)\r\nDEF(wrmsr_ret, -0xa0793c)\r\nDEF(dr2gpr_start, -0xa0bf53)\r\nDEF(gpr2dr_1_start, -0xa0be3a)\r\nDEF(gpr2dr_2_start, -0xa0bd47)\r\nDEF(mov_cr3_rax_mov_ds, -0xa0b9A9)\r\n\r\n//DEF(mov_rdi_cr3, -0x3a88de)\r\nDEF(mov_rax_cr3, -0x3A3E70)\r\n\r\nDEF(nop_ret, wrmsr_ret + 2)\r\nDEF(cpu_switch, -0xa0c140)\r\nDEF(mprotect_fix_start, -0x93EFE2)\r\nDEF(mprotect_fix_end, mprotect_fix_start+6)\r\n\r\nDEF(mmap_self_fix_1_start, 0x0)\r\nDEF(mmap_self_fix_1_end, mmap_self_fix_1_start+2)\r\nDEF(mmap_self_fix_2_start, 0x0)\r\nDEF(mmap_self_fix_2_end, mmap_self_fix_2_start+2)\r\n\r\nDEF(aslr_fix_start, -0x88C4FA)\r\nDEF(aslr_fix_end, aslr_fix_start+2)\r\n\r\nDEF(sigaction_fix_start, -0x6e7b30)\r\nDEF(sigaction_fix_end, -0x6e7aee)\r\nDEF(sysents, 0x1b2210)\r\nDEF(sysents_ps4, 0x1a9c60)\r\nDEF(sysentvec, 0xe00be8)\r\nDEF(sysentvec_ps4, 0xe00d60)\r\nDEF(sceSblServiceMailbox, -0x6a5b60)\r\nDEF(sceSblAuthMgrSmIsLoadable2, -0x8d9110)\r\nDEF(mdbg_call_fix, -0x64fb79)\r\nDEF(syscall_before, -0x835731)\r\nDEF(syscall_after, -0x83570e)\r\nDEF(malloc, -0xb3cd0)\r\nDEF(M_something, 0x14355a0)\r\nDEF(loadSelfSegment_epilogue, -0x8d89CD)\r\nDEF(loadSelfSegment_watchpoint, -0x2dC318)\r\nDEF(loadSelfSegment_watchpoint_lr, -0x8d8C27)\r\nDEF(decryptSelfBlock_watchpoint_lr, -0x8d889F)\r\nDEF(decryptSelfBlock_epilogue, -0x8d87E2)\r\nDEF(decryptMultipleSelfBlocks_watchpoint_lr, -0x8d8159)\r\nDEF(decryptMultipleSelfBlocks_epilogue, -0x8d7F24)\r\nDEF(sceSblServiceMailbox_lr_verifyHeader, -0x8d8DB6)\r\nDEF(sceSblServiceMailbox_lr_loadSelfSegment, -0x8d8A41)\r\nDEF(sceSblServiceMailbox_lr_decryptSelfBlock, -0x8d8479)\r\nDEF(sceSblServiceMailbox_lr_decryptMultipleSelfBlocks, -0x8d7C98)\r\nDEF(sceSblServiceMailbox_lr_sceSblAuthMgrSmFinalize, -0x8d918E)\r\nDEF(sceSblServiceMailbox_lr_verifySuperBlock, -0x97F470)\r\nDEF(sceSblServiceMailbox_lr_sceSblPfsClearKey_1, -0x97FA1F)\r\nDEF(sceSblServiceMailbox_lr_sceSblPfsClearKey_2, -0x97F9A9)\r\nDEF(sceSblServiceMailbox_lr_npdrm_cmd_5, -0x32AEBB)\r\nDEF(sceSblServiceMailbox_lr_npdrm_cmd_6, -0x32AC0A)\r\nDEF(sceSblPfsSetKeys, -0x980620)\r\nDEF(sceSblServiceCryptAsync, -0x921B00)\r\nDEF(sceSblServiceCryptAsync_deref_singleton, -0x921AC2)\r\nDEF(copyin, -0x9c6060)\r\nDEF(copyout, -0x9c6110)\r\nDEF(crypt_message_resolve, -0x48B0C0)\r\nDEF(justreturn, -0xa05200)\r\nDEF(justreturn_pop, justreturn+8)\r\nDEF(mini_syscore_header, 0xeaf938)\r\nDEF(pop_all_iret, -0xa05032)\r\nDEF(pop_all_except_rdi_iret, pop_all_iret+4)\r\nDEF(push_pop_all_iret, -0x99fc70)\r\nDEF(kernel_pmap_store, 0x3394a88)\r\nDEF(crypt_singleton_array, 0x2f4d830)\r\nDEF(security_flags, 0x66466EC)\r\nDEF(targetid, 0x66466F5)\r\nDEF(qa_flags, 0x6646710)\r\nDEF(utoken, 0x6646778)\r\nDEF(mov_rax_cr0, -0xa0c0a1)\r\nDEF(mov_cr0_rax, -0xa0c09c)\r\nDEF(mov_rdi_cr2, -0xa082ca)\r\nDEF(lgdt_rdi, -0x9c5980)\r\nDEF(lidt_lldt, -0xa0b8f1)\r\nDEF(ltr_ax, -0xa0b8cf)\r\nDEF(kproc_shutdown, -0x9a0b38)\r\nDEF(s_shutdown_final, 0x365116)\r\nDEF(eventhandler_register, -0x536620)\r\nDEF(strlen_trap, -0x45a9cc)\r\nDEF(lapic_map, 0x2976fb0)\r\n#include \"offset_list.txt\"\r\nEND_FW()\r\n\r\nSTART_FW(600)\r\nDEF(allproc, 0x2869d20)\r\nDEF(idt, 0x655dde0)\r\nDEF(gdt_array, 0x655f000)\r\nDEF(tss_array, 0x6560a00)\r\nDEF(pcpu_array, 0x6572880)\r\nDEF(doreti_iret, -0xa1b813)\r\nDEF(add_rsp_iret, doreti_iret - 7)\r\nDEF(swapgs_add_rsp_iret, doreti_iret - 10)\r\nDEF(rep_movsb_pop_rbp_ret, -0x9dbfea)\r\nDEF(rdmsr_start, -0xa1cdaa)\r\nDEF(wrmsr_ret, -0xa1e17c)\r\nDEF(dr2gpr_start, -0xa22793)\r\nDEF(gpr2dr_1_start, -0xa2267a)\r\nDEF(gpr2dr_2_start, -0xa22587)\r\nDEF(mov_cr3_rax_mov_ds, -0xa221e9)\r\n\r\n//DEF(mov_rdi_cr3, -0x3aa3be)\r\nDEF(mov_rax_cr3, -0x3A590E) //data 0x8BA6F2\r\n\r\nDEF(nop_ret, wrmsr_ret + 2)\r\nDEF(cpu_switch, -0xa22980)\r\nDEF(mprotect_fix_start, -0x9546d2)\r\nDEF(mprotect_fix_end, mprotect_fix_start+6)\r\n\r\nDEF(mmap_self_fix_1_start, 0x0)\r\nDEF(mmap_self_fix_1_end, mmap_self_fix_1_start+2)\r\nDEF(mmap_self_fix_2_start, 0x0)\r\nDEF(mmap_self_fix_2_end, mmap_self_fix_2_start+2)\r\n\r\nDEF(aslr_fix_start, -0x89F3ED)\r\nDEF(aslr_fix_end, aslr_fix_start+2)\r\n\r\nDEF(sigaction_fix_start, -0x6f6b92)\r\nDEF(sigaction_fix_end, -0x6f6b68)\r\nDEF(sysents, 0x1b49a0)\r\nDEF(sysents_ps4, 0x1ac3f0)\r\nDEF(sysentvec, 0xe210a8)\r\nDEF(sysentvec_ps4, 0xe21220)\r\nDEF(sceSblServiceMailbox, -0x6b28c0)\r\nDEF(sceSblAuthMgrSmIsLoadable2, -0x8ed120)\r\nDEF(mdbg_call_fix, -0x65c2a9)\r\nDEF(syscall_before, -0x844a71)\r\nDEF(syscall_after, -0x844a4e)\r\nDEF(malloc, -0xaa4c0)\r\nDEF(M_something, 0x1456690)\r\nDEF(loadSelfSegment_epilogue, -0x8ec9ed)\r\nDEF(loadSelfSegment_watchpoint, -0x2da988)\r\nDEF(loadSelfSegment_watchpoint_lr, -0x8ecc47)\r\nDEF(decryptSelfBlock_watchpoint_lr, -0x8ec8bf)\r\nDEF(decryptSelfBlock_epilogue, -0x8ec802)\r\n//DEF(decryptMultipleSelfBlocks_watchpoint_lr, -0x8ec172) //403\r\nDEF(decryptMultipleSelfBlocks_watchpoint_lr, -0x8ec179) //550\r\nDEF(decryptMultipleSelfBlocks_epilogue, -0x8ebf44)\r\nDEF(sceSblServiceMailbox_lr_verifyHeader, -0x8ecdd9)\r\nDEF(sceSblServiceMailbox_lr_loadSelfSegment, -0x8eca61)\r\nDEF(sceSblServiceMailbox_lr_decryptSelfBlock, -0x8ec499)\r\nDEF(sceSblServiceMailbox_lr_decryptMultipleSelfBlocks, -0x8ebca8)\r\nDEF(sceSblServiceMailbox_lr_sceSblAuthMgrSmFinalize, -0x8ed19e)\r\nDEF(sceSblServiceMailbox_lr_verifySuperBlock, -0x995381)\r\nDEF(sceSblServiceMailbox_lr_sceSblPfsClearKey_1, -0x995931)\r\nDEF(sceSblServiceMailbox_lr_sceSblPfsClearKey_2, -0x9958bb)\r\nDEF(sceSblServiceMailbox_lr_npdrm_cmd_5, -0x32ADF5)\r\nDEF(sceSblServiceMailbox_lr_npdrm_cmd_6, -0x32ABBA)\r\n//DEF(sceSblPfsSetKeys, -0x995630) //403\r\nDEF(sceSblPfsSetKeys, -0x996400) //550\r\nDEF(sceSblServiceCryptAsync, -0x936080)\r\nDEF(sceSblServiceCryptAsync_deref_singleton, -0x936042)\r\nDEF(copyin, -0x9dc8a0)\r\nDEF(copyout, -0x9dc950)\r\nDEF(crypt_message_resolve, -0x490200)\r\nDEF(justreturn, -0xa1ba40)\r\nDEF(justreturn_pop, justreturn+8)\r\nDEF(mini_syscore_header, 0xed2048)\r\nDEF(pop_all_iret, -0xa1b872)\r\nDEF(pop_all_except_rdi_iret, pop_all_iret+4)\r\nDEF(push_pop_all_iret, -0x9b99e0)\r\nDEF(kernel_pmap_store, 0x32e4358)\r\nDEF(crypt_singleton_array, 0x2e9d830)\r\nDEF(security_flags, 0x65968ec)\r\nDEF(targetid, 0x65968f5)\r\nDEF(qa_flags, 0x6596910)\r\nDEF(utoken, 0x6596978)\r\nDEF(mov_rax_cr0, -0xa228e1)\r\nDEF(mov_cr0_rax, -0xa228dc)\r\nDEF(mov_rdi_cr2, -0x2414f6)\r\nDEF(lgdt_rdi, -0x9DC1C0)\r\nDEF(lidt_lldt, -0xa22131)\r\nDEF(ltr_ax, -0xa2210f)\r\nDEF(kproc_shutdown, -0x9b50a8)\r\nDEF(s_shutdown_final, 0x367fd8)\r\nDEF(eventhandler_register, -0x53DE00)\r\nDEF(strlen_trap, -0x45de23)\r\nDEF(lapic_map, 0x28C2FF0)\r\n#include \"offset_list.txt\"\r\nEND_FW()\r\n\r\nSTART_FW(602)\r\nDEF(allproc, 0x2869d20)\r\nDEF(idt, 0x655dde0)\r\nDEF(gdt_array, 0x655f000)\r\nDEF(tss_array, 0x6560a00)\r\nDEF(pcpu_array, 0x6572880)\r\nDEF(doreti_iret, -0xa1b813)\r\nDEF(add_rsp_iret, doreti_iret - 7)\r\nDEF(swapgs_add_rsp_iret, doreti_iret - 10)\r\nDEF(rep_movsb_pop_rbp_ret, -0x9dbfea)\r\nDEF(rdmsr_start, -0xa1cdaa)\r\nDEF(wrmsr_ret, -0xa1e17c)\r\nDEF(dr2gpr_start, -0xa22793)\r\nDEF(gpr2dr_1_start, -0xa2267a)\r\nDEF(gpr2dr_2_start, -0xa22587)\r\nDEF(mov_cr3_rax_mov_ds, -0xa221e9)\r\n\r\n//DEF(mov_rdi_cr3, -0x3aa3de)\r\nDEF(mov_rax_cr3, -0x3A592E) //data 0x8BA6D2\r\n\r\nDEF(nop_ret, wrmsr_ret + 2)\r\nDEF(cpu_switch, -0xa22980)\r\nDEF(mprotect_fix_start, -0x9546d2)\r\nDEF(mprotect_fix_end, mprotect_fix_start+6)\r\n\r\nDEF(mmap_self_fix_1_start, 0x0)\r\nDEF(mmap_self_fix_1_end, mmap_self_fix_1_start+2)\r\nDEF(mmap_self_fix_2_start, 0x0)\r\nDEF(mmap_self_fix_2_end, mmap_self_fix_2_start+2)\r\n\r\nDEF(aslr_fix_start, -0x89F3ED)\r\nDEF(aslr_fix_end, aslr_fix_start+2)\r\n\r\nDEF(sigaction_fix_start, -0x6f6b92)\r\nDEF(sigaction_fix_end, -0x6f6b68)\r\nDEF(sysents, 0x1b49f0)\r\nDEF(sysents_ps4, 0x1ac440)\r\nDEF(sysentvec, 0xe210a8)\r\nDEF(sysentvec_ps4, 0xe21220)\r\nDEF(sceSblServiceMailbox, -0x6b28c0)\r\nDEF(sceSblAuthMgrSmIsLoadable2, -0x8ed120)\r\nDEF(mdbg_call_fix, -0x65c2c9)\r\nDEF(syscall_before, -0x844a71)\r\nDEF(syscall_after, -0x844a4e)\r\nDEF(malloc, -0xaa4e0)\r\nDEF(M_something, 0x1456690)\r\nDEF(loadSelfSegment_epilogue, -0x8ec9ed)\r\nDEF(loadSelfSegment_watchpoint, -0x2da9a8)\r\nDEF(loadSelfSegment_watchpoint_lr, -0x8ecc47)\r\nDEF(decryptSelfBlock_watchpoint_lr, -0x8ec8bf)\r\nDEF(decryptSelfBlock_epilogue, -0x8ec802)\r\n//DEF(decryptMultipleSelfBlocks_watchpoint_lr, -0x8ec172) //403\r\nDEF(decryptMultipleSelfBlocks_watchpoint_lr, -0x8ec179) //550\r\nDEF(decryptMultipleSelfBlocks_epilogue, -0x8ebf44)\r\nDEF(sceSblServiceMailbox_lr_verifyHeader, -0x8ecdd9)\r\nDEF(sceSblServiceMailbox_lr_loadSelfSegment, -0x8eca61)\r\nDEF(sceSblServiceMailbox_lr_decryptSelfBlock, -0x8ec499)\r\nDEF(sceSblServiceMailbox_lr_decryptMultipleSelfBlocks, -0x8ebca8)\r\nDEF(sceSblServiceMailbox_lr_sceSblAuthMgrSmFinalize, -0x8ed19e)\r\nDEF(sceSblServiceMailbox_lr_verifySuperBlock, -0x995381)\r\nDEF(sceSblServiceMailbox_lr_sceSblPfsClearKey_1, -0x995931)\r\nDEF(sceSblServiceMailbox_lr_sceSblPfsClearKey_2, -0x9958bb)\r\nDEF(sceSblServiceMailbox_lr_npdrm_cmd_5, -0x32AE15)\r\nDEF(sceSblServiceMailbox_lr_npdrm_cmd_6, -0x32ABDA)\r\n//DEF(sceSblPfsSetKeys, -0x995630) //403\r\nDEF(sceSblPfsSetKeys, -0x996400) //550\r\nDEF(sceSblServiceCryptAsync, -0x936080)\r\nDEF(sceSblServiceCryptAsync_deref_singleton, -0x936042)\r\nDEF(copyin, -0x9dc8a0)\r\nDEF(copyout, -0x9dc950)\r\nDEF(crypt_message_resolve, -0x490220)\r\nDEF(justreturn, -0xa1ba40)\r\nDEF(justreturn_pop, justreturn+8)\r\nDEF(mini_syscore_header, 0xed2048)\r\nDEF(pop_all_iret, -0xa1b872)\r\nDEF(pop_all_except_rdi_iret, pop_all_iret+4)\r\nDEF(push_pop_all_iret, -0x9b9e20)\r\nDEF(kernel_pmap_store, 0x32e4358)\r\nDEF(crypt_singleton_array, 0x2e9d830)\r\nDEF(security_flags, 0x65968ec)\r\nDEF(targetid, 0x65968f5)\r\nDEF(qa_flags, 0x6596910)\r\nDEF(utoken, 0x6596978)\r\nDEF(mov_rax_cr0, -0xa228e1)\r\nDEF(mov_cr0_rax, -0xa228dc)\r\nDEF(mov_rdi_cr2, -0x2414f6)\r\nDEF(lgdt_rdi, -0x9DC1C0)\r\nDEF(lidt_lldt, -0xa22131)\r\nDEF(ltr_ax, -0xa2210f)\r\nDEF(kproc_shutdown, -0x9b4388)\r\nDEF(s_shutdown_final, 0x367f81)\r\nDEF(eventhandler_register, -0x53de20)\r\nDEF(strlen_trap, -0x45de43)\r\nDEF(lapic_map, 0x28C2FF0)\r\n#include \"offset_list.txt\"\r\nEND_FW()\r\n\r\nSTART_FW(650)\r\nDEF(allproc, 0x2869d20)\r\nDEF(idt, 0x655dde0)\r\nDEF(gdt_array, 0x655f000)\r\nDEF(tss_array, 0x6560a00)\r\nDEF(pcpu_array, 0x6572880)\r\nDEF(doreti_iret, -0xa1b813)\r\nDEF(add_rsp_iret, doreti_iret - 7)\r\nDEF(swapgs_add_rsp_iret, doreti_iret - 10)\r\nDEF(rep_movsb_pop_rbp_ret, -0x9dbfea)\r\nDEF(rdmsr_start, -0xa1cdaa)\r\nDEF(wrmsr_ret, -0xa1e17c)\r\nDEF(dr2gpr_start, -0xa22793)\r\nDEF(gpr2dr_1_start, -0xa2267a)\r\nDEF(gpr2dr_2_start, -0xa22587)\r\nDEF(mov_cr3_rax_mov_ds, -0xa221e9)\r\n\r\n//DEF(mov_rdi_cr3, -0x3aa14e)\r\nDEF(mov_rax_cr3, -0x3A569E) //data 0x8BA962\r\n\r\nDEF(nop_ret, wrmsr_ret + 2)\r\nDEF(cpu_switch, -0xa22980)\r\nDEF(mprotect_fix_start, -0x9546e2)\r\nDEF(mprotect_fix_end, mprotect_fix_start+6)\r\n\r\nDEF(mmap_self_fix_1_start, 0x0)\r\nDEF(mmap_self_fix_1_end, mmap_self_fix_1_start+2)\r\nDEF(mmap_self_fix_2_start, 0x0)\r\nDEF(mmap_self_fix_2_end, mmap_self_fix_2_start+2)\r\n\r\nDEF(aslr_fix_start, -0x89F3CD)\r\nDEF(aslr_fix_end, aslr_fix_start+2)\r\n\r\nDEF(sigaction_fix_start, -0x6f6b12)\r\nDEF(sigaction_fix_end, -0x6f6ae8)\r\nDEF(sysents, 0x1b49f0)\r\nDEF(sysents_ps4, 0x1ac440)\r\nDEF(sysentvec, 0xe210a8)\r\nDEF(sysentvec_ps4, 0xe21220)\r\nDEF(sceSblServiceMailbox, -0x6b2790)\r\nDEF(sceSblAuthMgrSmIsLoadable2, -0x8ed100)\r\nDEF(mdbg_call_fix, -0x65c199)\r\nDEF(syscall_before, -0x844a51)\r\nDEF(syscall_after, -0x844a2e)\r\nDEF(malloc, -0xa9d40)\r\nDEF(M_something, 0x1456690)\r\nDEF(loadSelfSegment_epilogue, -0x8ec9cd)\r\nDEF(loadSelfSegment_watchpoint, -0x2da218)\r\nDEF(loadSelfSegment_watchpoint_lr, -0x8ecc27)\r\nDEF(decryptSelfBlock_watchpoint_lr, -0x8ec89f)\r\nDEF(decryptSelfBlock_epilogue, -0x8ec7e2)\r\n//DEF(decryptMultipleSelfBlocks_watchpoint_lr, -0x8ec152) //403\r\nDEF(decryptMultipleSelfBlocks_watchpoint_lr, -0x8ec159) //550\r\nDEF(decryptMultipleSelfBlocks_epilogue, -0x8ebf24)\r\nDEF(sceSblServiceMailbox_lr_verifyHeader, -0x8ecdb9)\r\nDEF(sceSblServiceMailbox_lr_loadSelfSegment, -0x8eca41)\r\nDEF(sceSblServiceMailbox_lr_decryptSelfBlock, -0x8ec479)\r\nDEF(sceSblServiceMailbox_lr_decryptMultipleSelfBlocks, -0x8ebc88)\r\nDEF(sceSblServiceMailbox_lr_sceSblAuthMgrSmFinalize, -0x8ed17e)\r\nDEF(sceSblServiceMailbox_lr_verifySuperBlock, -0x995381)\r\nDEF(sceSblServiceMailbox_lr_sceSblPfsClearKey_1, -0x995931)\r\nDEF(sceSblServiceMailbox_lr_sceSblPfsClearKey_2, -0x9958bb)\r\nDEF(sceSblServiceMailbox_lr_npdrm_cmd_5, -0x32a685)\r\nDEF(sceSblServiceMailbox_lr_npdrm_cmd_6, -0x32a44a)\r\n//DEF(sceSblPfsSetKeys, -0x995630) //403\r\nDEF(sceSblPfsSetKeys, -0x996400) //550\r\nDEF(sceSblServiceCryptAsync, -0x936090)\r\nDEF(sceSblServiceCryptAsync_deref_singleton, -0x936052)\r\nDEF(copyin, -0x9dc8a0)\r\nDEF(copyout, -0x9dc950)\r\nDEF(crypt_message_resolve, -0x490060)\r\nDEF(justreturn, -0xa1ba40)\r\nDEF(justreturn_pop, justreturn+8)\r\nDEF(mini_syscore_header, 0xed2048)\r\nDEF(pop_all_iret, -0xa1b872)\r\nDEF(pop_all_except_rdi_iret, pop_all_iret+4)\r\nDEF(push_pop_all_iret, -0x9ba368)\r\nDEF(kernel_pmap_store, 0x32e4358)\r\nDEF(crypt_singleton_array, 0x2e9d830)\r\nDEF(security_flags, 0x65968ec)\r\nDEF(targetid, 0x65968f5)\r\nDEF(qa_flags, 0x6596910)\r\nDEF(utoken, 0x6596978)\r\nDEF(mov_rax_cr0, -0xa228e1)\r\nDEF(mov_cr0_rax, -0xa228dc)\r\nDEF(mov_rdi_cr2, -0x2414f6)\r\nDEF(lgdt_rdi, -0x9DC1C0)\r\nDEF(lidt_lldt, -0xa22131)\r\nDEF(ltr_ax, -0xa2210f)\r\nDEF(kproc_shutdown, -0x9af530)\r\nDEF(s_shutdown_final, 0x367fad)\r\nDEF(eventhandler_register, -0x53dc60)\r\nDEF(strlen_trap, -0x45dc83)\r\nDEF(lapic_map, 0x28C2FF0)\r\n#include \"offset_list.txt\"\r\nEND_FW()\r\n\r\nSTART_FW(700)\r\nDEF(allproc, 0x2859D50)\r\nDEF(idt, 0x2E7FDF0)\r\nDEF(gdt_array, 0x2E810B0)\r\nDEF(tss_array, 0x2E82AB0)\r\nDEF(pcpu_array, 0x2E94A00)\r\nDEF(doreti_iret, -0xA0BA33)\r\nDEF(add_rsp_iret, doreti_iret - 7)\r\nDEF(swapgs_add_rsp_iret, doreti_iret - 10)\r\nDEF(rep_movsb_pop_rbp_ret, -0x9CC1A6)\r\nDEF(rdmsr_start, -0xA0D16A)\r\nDEF(wrmsr_ret, -0xA0E53C)\r\nDEF(dr2gpr_start, -0xA12B53)\r\nDEF(gpr2dr_1_start, -0xA12A3A)\r\nDEF(gpr2dr_2_start, -0xA12947)\r\nDEF(mov_cr3_rax_mov_ds, -0xa125a9)\r\n\r\n//DEF(mov_rdi_cr3, -0x3B320E)\r\nDEF(mov_rax_cr3, -0x3AE07E) //data 0x8A1F82\r\n\r\nDEF(nop_ret, wrmsr_ret + 2)\r\nDEF(cpu_switch, -0xA12D40)\r\nDEF(mprotect_fix_start, -0x944F84)\r\nDEF(mprotect_fix_end, mprotect_fix_start+6)\r\n\r\nDEF(mmap_self_fix_1_start, 0x0)\r\nDEF(mmap_self_fix_1_end, mmap_self_fix_1_start+2)\r\nDEF(mmap_self_fix_2_start, 0x0)\r\nDEF(mmap_self_fix_2_end, mmap_self_fix_2_start+2)\r\n\r\nDEF(aslr_fix_start, -0x890F17)\r\nDEF(aslr_fix_end, aslr_fix_start+2)\r\n\r\nDEF(sigaction_fix_start, -0x6F02DD)\r\nDEF(sigaction_fix_end, -0x6F02C2)\r\nDEF(sysents, 0x1B7030)\r\nDEF(sysents_ps4, 0x1AEA80)\r\nDEF(sysentvec, 0xE21AB8)\r\nDEF(sysentvec_ps4, 0xE21C30)\r\nDEF(sceSblServiceMailbox, -0x6AD700)\r\nDEF(sceSblAuthMgrSmIsLoadable2, -0x8DF590)\r\nDEF(mdbg_call_fix, -0x6595A9)\r\nDEF(syscall_before, -0x8375CF)\r\nDEF(syscall_after, -0x8375AC)\r\nDEF(malloc, -0xB6C60)\r\nDEF(M_something, 0x1457590)\r\nDEF(loadSelfSegment_epilogue, -0x8DEE99)\r\nDEF(loadSelfSegment_watchpoint, -0x2E30C8)\r\nDEF(loadSelfSegment_watchpoint_lr, -0x8DF0E7)\r\nDEF(decryptSelfBlock_watchpoint_lr, -0x8DED6F)\r\nDEF(decryptSelfBlock_epilogue, -0x8DECB2)\r\n//DEF(decryptMultipleSelfBlocks_watchpoint_lr, -0x8DE632) //403\r\nDEF(decryptMultipleSelfBlocks_watchpoint_lr, -0x8DE639) //550\r\nDEF(decryptMultipleSelfBlocks_epilogue, -0x8DE404)\r\nDEF(sceSblServiceMailbox_lr_verifyHeader, -0x8DF276)\r\nDEF(sceSblServiceMailbox_lr_loadSelfSegment, -0x8DEF09)\r\nDEF(sceSblServiceMailbox_lr_decryptSelfBlock, -0x8DE956)\r\nDEF(sceSblServiceMailbox_lr_decryptMultipleSelfBlocks, -0x8DE171)\r\nDEF(sceSblServiceMailbox_lr_sceSblAuthMgrSmFinalize, -0x8DF608)\r\nDEF(sceSblServiceMailbox_lr_verifySuperBlock, -0x9852FD)\r\nDEF(sceSblServiceMailbox_lr_sceSblPfsClearKey_1, -0x98589B)\r\nDEF(sceSblServiceMailbox_lr_sceSblPfsClearKey_2, -0x985828)\r\nDEF(sceSblServiceMailbox_lr_npdrm_cmd_5, -0x33450B)\r\nDEF(sceSblServiceMailbox_lr_npdrm_cmd_6, -0x3342E2)\r\n//DEF(sceSblPfsSetKeys, -0x9855A0) //403\r\nDEF(sceSblPfsSetKeys, -0x986420) //550\r\nDEF(sceSblServiceCryptAsync, -0x9271E0)\r\nDEF(sceSblServiceCryptAsync_deref_singleton, -0x9271A2)\r\nDEF(copyin, -0x9CCA70)\r\nDEF(copyout, -0x9CCB20)\r\nDEF(crypt_message_resolve, -0x491BB0)\r\nDEF(justreturn, -0xA0BC60)\r\nDEF(justreturn_pop, justreturn+8)\r\nDEF(mini_syscore_header, 0xE7DD98)\r\nDEF(pop_all_iret, -0xA0BA92)\r\nDEF(pop_all_except_rdi_iret, pop_all_iret+4)\r\nDEF(push_pop_all_iret, -0x9AAFC8)\r\nDEF(kernel_pmap_store, 0x2E2C848)\r\nDEF(crypt_singleton_array, 0x2D71830)\r\nDEF(security_flags, 0xAC8064)\r\nDEF(targetid, 0xAC806D)\r\nDEF(qa_flags, 0xAC8088)\r\nDEF(utoken, 0xAC80F0)\r\nDEF(mov_rax_cr0, -0xa12ca1)\r\nDEF(mov_cr0_rax, -0xa12c9c)\r\nDEF(mov_rdi_cr2, -0xa2296a)\r\nDEF(lgdt_rdi, -0x9cc380)\r\nDEF(lidt_lldt, -0xa124f1)\r\nDEF(ltr_ax, -0xa124cf)\r\nDEF(kproc_shutdown, -0x99ba88)\r\nDEF(s_shutdown_final, 0x417acb)\r\nDEF(eventhandler_register, -0x53d740)\r\nDEF(strlen_trap, -0x4607e8)\r\nDEF(lapic_map, 0x28B3830)\r\n#include \"offset_list.txt\"\r\nEND_FW()\r\n\r\nSTART_FW(701)\r\nDEF(allproc, 0x2859D50)\r\nDEF(idt, 0x2E7FDF0)\r\nDEF(gdt_array, 0x2E810B0)\r\nDEF(tss_array, 0x2E82AB0)\r\nDEF(pcpu_array, 0x2E94A00)\r\nDEF(doreti_iret, -0xA0BA33)\r\nDEF(add_rsp_iret, doreti_iret - 7)\r\nDEF(swapgs_add_rsp_iret, doreti_iret - 10)\r\nDEF(rep_movsb_pop_rbp_ret, -0x9CC1A6)\r\nDEF(rdmsr_start, -0xA0D16A)\r\nDEF(wrmsr_ret, -0xA0E53C)\r\nDEF(dr2gpr_start, -0xA12B53)\r\nDEF(gpr2dr_1_start, -0xA12A3A)\r\nDEF(gpr2dr_2_start, -0xA12947)\r\nDEF(mov_cr3_rax_mov_ds, -0xa125a9)\r\n\r\n//DEF(mov_rdi_cr3, -0x3B320E)\r\nDEF(mov_rax_cr3, -0x3AE07E) //data 0x8A1F82\r\n\r\nDEF(nop_ret, wrmsr_ret + 2)\r\nDEF(cpu_switch, -0xA12D40)\r\nDEF(mprotect_fix_start, -0x944F84)\r\nDEF(mprotect_fix_end, mprotect_fix_start+6)\r\n\r\nDEF(mmap_self_fix_1_start, 0x0)\r\nDEF(mmap_self_fix_1_end, mmap_self_fix_1_start+2)\r\nDEF(mmap_self_fix_2_start, 0x0)\r\nDEF(mmap_self_fix_2_end, mmap_self_fix_2_start+2)\r\n\r\nDEF(aslr_fix_start, -0x890F17)\r\nDEF(aslr_fix_end, aslr_fix_start+2)\r\n\r\nDEF(sigaction_fix_start, -0x6F02DD)\r\nDEF(sigaction_fix_end, -0x6F02C2)\r\nDEF(sysents, 0x1B7030)\r\nDEF(sysents_ps4, 0x1AEA80)\r\nDEF(sysentvec, 0xE21AB8)\r\nDEF(sysentvec_ps4, 0xE21C30)\r\nDEF(sceSblServiceMailbox, -0x6AD700)\r\nDEF(sceSblAuthMgrSmIsLoadable2, -0x8DF590)\r\nDEF(mdbg_call_fix, -0x6595A9)\r\nDEF(syscall_before, -0x8375CF)\r\nDEF(syscall_after, -0x8375AC)\r\nDEF(malloc, -0xB6C60)\r\nDEF(M_something, 0x1457590)\r\nDEF(loadSelfSegment_epilogue, -0x8DEE99)\r\nDEF(loadSelfSegment_watchpoint, -0x2E30C8)\r\nDEF(loadSelfSegment_watchpoint_lr, -0x8DF0E7)\r\nDEF(decryptSelfBlock_watchpoint_lr, -0x8DED6F)\r\nDEF(decryptSelfBlock_epilogue, -0x8DECB2)\r\n//DEF(decryptMultipleSelfBlocks_watchpoint_lr, -0x8DE632) //403\r\nDEF(decryptMultipleSelfBlocks_watchpoint_lr, -0x8DE639) //550\r\nDEF(decryptMultipleSelfBlocks_epilogue, -0x8DE404)\r\nDEF(sceSblServiceMailbox_lr_verifyHeader, -0x8DF276)\r\nDEF(sceSblServiceMailbox_lr_loadSelfSegment, -0x8DEF09)\r\nDEF(sceSblServiceMailbox_lr_decryptSelfBlock, -0x8DE956)\r\nDEF(sceSblServiceMailbox_lr_decryptMultipleSelfBlocks, -0x8DE171)\r\nDEF(sceSblServiceMailbox_lr_sceSblAuthMgrSmFinalize, -0x8DF608)\r\nDEF(sceSblServiceMailbox_lr_verifySuperBlock, -0x9852FD)\r\nDEF(sceSblServiceMailbox_lr_sceSblPfsClearKey_1, -0x98589B)\r\nDEF(sceSblServiceMailbox_lr_sceSblPfsClearKey_2, -0x985828)\r\nDEF(sceSblServiceMailbox_lr_npdrm_cmd_5, -0x33450B)\r\nDEF(sceSblServiceMailbox_lr_npdrm_cmd_6, -0x3342E2)\r\n//DEF(sceSblPfsSetKeys, -0x9855A0) //403\r\nDEF(sceSblPfsSetKeys, -0x986420) //550\r\nDEF(sceSblServiceCryptAsync, -0x9271E0)\r\nDEF(sceSblServiceCryptAsync_deref_singleton, -0x9271A2)\r\nDEF(copyin, -0x9CCA70)\r\nDEF(copyout, -0x9CCB20)\r\nDEF(crypt_message_resolve, -0x491BB0)\r\nDEF(justreturn, -0xA0BC60)\r\nDEF(justreturn_pop, justreturn+8)\r\nDEF(mini_syscore_header, 0xE7DD98)\r\nDEF(pop_all_iret, -0xA0BA92)\r\nDEF(pop_all_except_rdi_iret, pop_all_iret+4)\r\nDEF(push_pop_all_iret, -0x9A9310)\r\nDEF(kernel_pmap_store, 0x2E2C848)\r\nDEF(crypt_singleton_array, 0x2D71830)\r\nDEF(security_flags, 0xAC8064)\r\nDEF(targetid, 0xAC806D)\r\nDEF(qa_flags, 0xAC8088)\r\nDEF(utoken, 0xAC80F0)\r\nDEF(mov_rax_cr0, -0xa12ca1)\r\nDEF(mov_cr0_rax, -0xa12c9c)\r\nDEF(mov_rdi_cr2, -0xa2296a)\r\nDEF(lgdt_rdi, -0x9cc380)\r\nDEF(lidt_lldt, -0xa124f1)\r\nDEF(ltr_ax, -0xa124cf)\r\nDEF(kproc_shutdown, -0x99f1e0)\r\nDEF(s_shutdown_final, 0x4177d5)\r\nDEF(eventhandler_register, -0x53d740)\r\nDEF(strlen_trap, -0x4607e8)\r\nDEF(lapic_map, 0x28B3830)\r\n#include \"offset_list.txt\"\r\nEND_FW()\r\n\r\nSTART_FW(720)\r\nDEF(allproc, 0x2859D50)\r\nDEF(idt, 0x2E7FDF0)\r\nDEF(gdt_array, 0x2E810D0)\r\nDEF(tss_array, 0x2E82AD0)\r\nDEF(pcpu_array, 0x2E94A00)\r\nDEF(doreti_iret, -0xA0B7F3)\r\nDEF(add_rsp_iret, doreti_iret - 7)\r\nDEF(swapgs_add_rsp_iret, doreti_iret - 10)\r\nDEF(rep_movsb_pop_rbp_ret, -0x9CBF66)\r\nDEF(rdmsr_start, -0xA0CF2A)\r\nDEF(wrmsr_ret, -0xA0E2FC)\r\nDEF(dr2gpr_start, -0xA12913)\r\nDEF(gpr2dr_1_start, -0xA127FA)\r\nDEF(gpr2dr_2_start, -0xA12707)\r\nDEF(mov_cr3_rax_mov_ds, -0xa12369)\r\n\r\n//DEF(mov_rdi_cr3, -0x3B2F0E)\r\nDEF(mov_rax_cr3, -0x3ADD7E) //data 0x8A2282\r\n\r\nDEF(nop_ret, wrmsr_ret + 2)\r\nDEF(cpu_switch, -0xA12B00)\r\nDEF(mprotect_fix_start, -0x944D24)\r\nDEF(mprotect_fix_end, mprotect_fix_start+6)\r\n\r\nDEF(mmap_self_fix_1_start, 0x0)\r\nDEF(mmap_self_fix_1_end, mmap_self_fix_1_start+2)\r\nDEF(mmap_self_fix_2_start, 0x0)\r\nDEF(mmap_self_fix_2_end, mmap_self_fix_2_start+2)\r\n\r\nDEF(aslr_fix_start, -0x890C10)\r\nDEF(aslr_fix_end, aslr_fix_start+2)\r\n\r\nDEF(sigaction_fix_start, -0x6EFFDD)\r\nDEF(sigaction_fix_end, -0x6EFFC2)\r\nDEF(sysents, 0x1B71A0)\r\nDEF(sysents_ps4, 0x1AEBF0)\r\nDEF(sysentvec, 0xE21B78)\r\nDEF(sysentvec_ps4, 0xE21CF0)\r\nDEF(sceSblServiceMailbox, -0x6AD400)\r\nDEF(sceSblAuthMgrSmIsLoadable2, -0x8DF330)\r\nDEF(mdbg_call_fix, -0x6592A9)\r\nDEF(syscall_before, -0x8372CF)\r\nDEF(syscall_after, -0x8372AC)\r\nDEF(malloc, -0xB5C60)\r\nDEF(M_something, 0x1457650)\r\nDEF(loadSelfSegment_epilogue, -0x8DEC39)\r\nDEF(loadSelfSegment_watchpoint, -0x2E2DC8)\r\nDEF(loadSelfSegment_watchpoint_lr, -0x8DEE87)\r\nDEF(decryptSelfBlock_watchpoint_lr, -0x8DEB0F)\r\nDEF(decryptSelfBlock_epilogue, -0x8DEA52)\r\n//DEF(decryptMultipleSelfBlocks_watchpoint_lr, -0x8DE3D2) //403\r\nDEF(decryptMultipleSelfBlocks_watchpoint_lr, -0x8DE3D9) //550\r\nDEF(decryptMultipleSelfBlocks_epilogue, -0x8DE1A4)\r\nDEF(sceSblServiceMailbox_lr_verifyHeader, -0x8DF016)\r\nDEF(sceSblServiceMailbox_lr_loadSelfSegment, -0x8DECA9)\r\nDEF(sceSblServiceMailbox_lr_decryptSelfBlock, -0x8DE6F6)\r\nDEF(sceSblServiceMailbox_lr_decryptMultipleSelfBlocks, -0x8DDF11)\r\nDEF(sceSblServiceMailbox_lr_sceSblAuthMgrSmFinalize, -0x8DF3A8)\r\nDEF(sceSblServiceMailbox_lr_verifySuperBlock, -0x98509D)\r\nDEF(sceSblServiceMailbox_lr_sceSblPfsClearKey_1, -0x98563B)\r\nDEF(sceSblServiceMailbox_lr_sceSblPfsClearKey_2, -0x9855C8)\r\nDEF(sceSblServiceMailbox_lr_npdrm_cmd_5, -0x33420B)\r\nDEF(sceSblServiceMailbox_lr_npdrm_cmd_6, -0x333FE2)\r\n//DEF(sceSblPfsSetKeys, -0x985340) //403\r\nDEF(sceSblPfsSetKeys, -0x9861C0) //550\r\nDEF(sceSblServiceCryptAsync, -0x926F80)\r\nDEF(sceSblServiceCryptAsync_deref_singleton, -0x926F42)\r\nDEF(copyin, -0x9CC830)\r\nDEF(copyout, -0x9CC8E0)\r\nDEF(crypt_message_resolve, -0x4918B0)\r\nDEF(justreturn, -0xA0BA20)\r\nDEF(justreturn_pop, justreturn+8)\r\nDEF(mini_syscore_header, 0xE7DE58)\r\nDEF(pop_all_iret, -0xA0B852)\r\nDEF(pop_all_except_rdi_iret, pop_all_iret+4)\r\nDEF(push_pop_all_iret, -0x9AAA88)\r\nDEF(kernel_pmap_store, 0x2E2C848)\r\nDEF(crypt_singleton_array, 0x2D71830)\r\nDEF(security_flags, 0xAC8064)\r\nDEF(targetid, 0xAC806D)\r\nDEF(qa_flags, 0xAC8088)\r\nDEF(utoken, 0xAC80F0)\r\nDEF(mov_rax_cr0, -0xa12a61)\r\nDEF(mov_cr0_rax, -0xa12a5c)\r\nDEF(mov_rdi_cr2, -0xa0ec8a)\r\nDEF(lgdt_rdi, -0x9cc140)\r\nDEF(lidt_lldt, -0xa122b1)\r\nDEF(ltr_ax, -0xa1228f)\r\nDEF(kproc_shutdown, -0x9a7498)\r\nDEF(s_shutdown_final, 0x417705)\r\nDEF(eventhandler_register, -0x53d440)\r\nDEF(strlen_trap, -0x4604e8)\r\nDEF(lapic_map, 0x28B3830)\r\n#include \"offset_list.txt\"\r\nEND_FW()\r\n\r\nSTART_FW(740)\r\nDEF(allproc, 0x2859D50)\r\nDEF(idt, 0x2E7FDF0)\r\nDEF(gdt_array, 0x2E810D0)\r\nDEF(tss_array, 0x2E82AD0)\r\nDEF(pcpu_array, 0x2E94A00)\r\nDEF(doreti_iret, -0xA0B7F3)\r\nDEF(add_rsp_iret, doreti_iret - 7)\r\nDEF(swapgs_add_rsp_iret, doreti_iret - 10)\r\nDEF(rep_movsb_pop_rbp_ret, -0x9CBF66)\r\nDEF(rdmsr_start, -0xA0CF2A)\r\nDEF(wrmsr_ret, -0xA0E2FC)\r\nDEF(dr2gpr_start, -0xA12913)\r\nDEF(gpr2dr_1_start, -0xA127FA)\r\nDEF(gpr2dr_2_start, -0xA12707)\r\nDEF(mov_cr3_rax_mov_ds, -0xa12369)\r\n\r\n//DEF(mov_rdi_cr3, -0x3B2F0E)\r\nDEF(mov_rax_cr3, -0x3ADD7E) //data 0x8A2282\r\n\r\nDEF(nop_ret, wrmsr_ret + 2)\r\nDEF(cpu_switch, -0xA12B00)\r\nDEF(mprotect_fix_start, -0x944D24)\r\nDEF(mprotect_fix_end, mprotect_fix_start+6)\r\n\r\nDEF(mmap_self_fix_1_start, 0x0)\r\nDEF(mmap_self_fix_1_end, mmap_self_fix_1_start+2)\r\nDEF(mmap_self_fix_2_start, 0x0)\r\nDEF(mmap_self_fix_2_end, mmap_self_fix_2_start+2)\r\n\r\nDEF(aslr_fix_start, -0x890C10)\r\nDEF(aslr_fix_end, aslr_fix_start+2)\r\n\r\nDEF(sigaction_fix_start, -0x6EFFDD)\r\nDEF(sigaction_fix_end, -0x6EFFC2)\r\nDEF(sysents, 0x1B71A0)\r\nDEF(sysents_ps4, 0x1AEBF0)\r\nDEF(sysentvec, 0xE21B78)\r\nDEF(sysentvec_ps4, 0xE21CF0)\r\nDEF(sceSblServiceMailbox, -0x6AD400)\r\nDEF(sceSblAuthMgrSmIsLoadable2, -0x8DF330)\r\nDEF(mdbg_call_fix, -0x6592A9)\r\nDEF(syscall_before, -0x8372CF)\r\nDEF(syscall_after, -0x8372AC)\r\nDEF(malloc, -0xB5C60)\r\nDEF(M_something, 0x1457650)\r\nDEF(loadSelfSegment_epilogue, -0x8DEC39)\r\nDEF(loadSelfSegment_watchpoint, -0x2E2DC8)\r\nDEF(loadSelfSegment_watchpoint_lr, -0x8DEE87)\r\nDEF(decryptSelfBlock_watchpoint_lr, -0x8DEB0F)\r\nDEF(decryptSelfBlock_epilogue, -0x8DEA52)\r\n//DEF(decryptMultipleSelfBlocks_watchpoint_lr, -0x8DE3D2) //403\r\nDEF(decryptMultipleSelfBlocks_watchpoint_lr, -0x8DE3D9) //550\r\nDEF(decryptMultipleSelfBlocks_epilogue, -0x8DE1A4)\r\nDEF(sceSblServiceMailbox_lr_verifyHeader, -0x8DF016)\r\nDEF(sceSblServiceMailbox_lr_loadSelfSegment, -0x8DECA9)\r\nDEF(sceSblServiceMailbox_lr_decryptSelfBlock, -0x8DE6F6)\r\nDEF(sceSblServiceMailbox_lr_decryptMultipleSelfBlocks, -0x8DDF11)\r\nDEF(sceSblServiceMailbox_lr_sceSblAuthMgrSmFinalize, -0x8DF3A8)\r\nDEF(sceSblServiceMailbox_lr_verifySuperBlock, -0x98509D)\r\nDEF(sceSblServiceMailbox_lr_sceSblPfsClearKey_1, -0x98563B)\r\nDEF(sceSblServiceMailbox_lr_sceSblPfsClearKey_2, -0x9855C8)\r\nDEF(sceSblServiceMailbox_lr_npdrm_cmd_5, -0x33420B)\r\nDEF(sceSblServiceMailbox_lr_npdrm_cmd_6, -0x333FE2)\r\n//DEF(sceSblPfsSetKeys, -0x985340) //403\r\nDEF(sceSblPfsSetKeys, -0x9861C0) //550\r\nDEF(sceSblServiceCryptAsync, -0x926F80)\r\nDEF(sceSblServiceCryptAsync_deref_singleton, -0x926F42)\r\nDEF(copyin, -0x9CC830)\r\nDEF(copyout, -0x9CC8E0)\r\nDEF(crypt_message_resolve, -0x4918B0)\r\nDEF(justreturn, -0xA0BA20)\r\nDEF(justreturn_pop, justreturn+8)\r\nDEF(mini_syscore_header, 0xE7DE58)\r\nDEF(pop_all_iret, -0xA0B852)\r\nDEF(pop_all_except_rdi_iret, pop_all_iret+4)\r\nDEF(push_pop_all_iret, -0x9A0330)\r\nDEF(kernel_pmap_store, 0x2E2C848)\r\nDEF(crypt_singleton_array, 0x2D71830)\r\nDEF(security_flags, 0xAC8064)\r\nDEF(targetid, 0xAC806D)\r\nDEF(qa_flags, 0xAC8088)\r\nDEF(utoken, 0xAC80F0)\r\nDEF(mov_rax_cr0, -0xa12a61)\r\nDEF(mov_cr0_rax, -0xa12a5c)\r\nDEF(mov_rdi_cr2, -0xa0ec8a)\r\nDEF(lgdt_rdi, -0x9cc140)\r\nDEF(lidt_lldt, -0xa122b1)\r\nDEF(ltr_ax, -0xa1228f)\r\nDEF(kproc_shutdown, -0x9a7318)\r\nDEF(s_shutdown_final, 0x417cf6)\r\nDEF(eventhandler_register, -0x53d440)\r\nDEF(strlen_trap, -0x4604e8)\r\nDEF(lapic_map, 0x28B3830)\r\n#include \"offset_list.txt\"\r\nEND_FW()\r\n\r\nSTART_FW(760)\r\nDEF(allproc, 0x2859D50)\r\nDEF(idt, 0x2E7FDF0)\r\nDEF(gdt_array, 0x2E810D0)\r\nDEF(tss_array, 0x2E82AD0)\r\nDEF(pcpu_array, 0x2E94A00)\r\nDEF(doreti_iret, -0xA0B7F3)\r\nDEF(add_rsp_iret, doreti_iret - 7)\r\nDEF(swapgs_add_rsp_iret, doreti_iret - 10)\r\nDEF(rep_movsb_pop_rbp_ret, -0x9CBF66)\r\nDEF(rdmsr_start, -0xA0CF2A)\r\nDEF(wrmsr_ret, -0xA0E2FC)\r\nDEF(dr2gpr_start, -0xA12913)\r\nDEF(gpr2dr_1_start, -0xA127FA)\r\nDEF(gpr2dr_2_start, -0xA12707)\r\nDEF(mov_cr3_rax_mov_ds, -0xa12369)\r\n\r\n//DEF(mov_rdi_cr3, -0x3B2DCE)\r\nDEF(mov_rax_cr3, -0x3ADC3E) //data 0x8A23C2\r\n\r\nDEF(nop_ret, wrmsr_ret + 2)\r\nDEF(cpu_switch, -0xA12B00)\r\nDEF(mprotect_fix_start, -0x944D14)\r\nDEF(mprotect_fix_end, mprotect_fix_start+6)\r\n\r\nDEF(mmap_self_fix_1_start, 0x0)\r\nDEF(mmap_self_fix_1_end, mmap_self_fix_1_start+2)\r\nDEF(mmap_self_fix_2_start, 0x0)\r\nDEF(mmap_self_fix_2_end, mmap_self_fix_2_start+2)\r\n\r\nDEF(aslr_fix_start, -0x890C00)\r\nDEF(aslr_fix_end, aslr_fix_start+2)\r\n\r\nDEF(sigaction_fix_start, -0x6EFFCD)\r\nDEF(sigaction_fix_end, -0x6EFFB2)\r\nDEF(sysents, 0x1B7260)\r\nDEF(sysents_ps4, 0x1AECB0)\r\nDEF(sysentvec, 0xE21B78)\r\nDEF(sysentvec_ps4, 0xE21CF0)\r\nDEF(sceSblServiceMailbox, -0x6AD3F0)\r\nDEF(sceSblAuthMgrSmIsLoadable2, -0x8DF320)\r\nDEF(mdbg_call_fix, -0x659169)\r\nDEF(syscall_before, -0x8372BF)\r\nDEF(syscall_after, -0x83729C)\r\nDEF(malloc, -0xB5650)\r\nDEF(M_something, 0x1457650)\r\nDEF(loadSelfSegment_epilogue, -0x8DEC29)\r\nDEF(loadSelfSegment_watchpoint, -0x2E2C88)\r\nDEF(loadSelfSegment_watchpoint_lr, -0x8DEE77)\r\nDEF(decryptSelfBlock_watchpoint_lr, -0x8DEAFF)\r\nDEF(decryptSelfBlock_epilogue, -0x8DEA42)\r\n//DEF(decryptMultipleSelfBlocks_watchpoint_lr, -0x8DE3C2) //403\r\nDEF(decryptMultipleSelfBlocks_watchpoint_lr, -0x8DE3C9) //550\r\nDEF(decryptMultipleSelfBlocks_epilogue, -0x8DE194)\r\nDEF(sceSblServiceMailbox_lr_verifyHeader, -0x8DF006)\r\nDEF(sceSblServiceMailbox_lr_loadSelfSegment, -0x8DEC99)\r\nDEF(sceSblServiceMailbox_lr_decryptSelfBlock, -0x8DE6E6)\r\nDEF(sceSblServiceMailbox_lr_decryptMultipleSelfBlocks, -0x8DDF01)\r\nDEF(sceSblServiceMailbox_lr_sceSblAuthMgrSmFinalize, -0x8DF398)\r\nDEF(sceSblServiceMailbox_lr_verifySuperBlock, -0x98508D)\r\nDEF(sceSblServiceMailbox_lr_sceSblPfsClearKey_1, -0x98562B)\r\nDEF(sceSblServiceMailbox_lr_sceSblPfsClearKey_2, -0x9855B8)\r\nDEF(sceSblServiceMailbox_lr_npdrm_cmd_5, -0x3340CB)\r\nDEF(sceSblServiceMailbox_lr_npdrm_cmd_6, -0x333EA2)\r\n//DEF(sceSblPfsSetKeys, -0x985330) //403\r\nDEF(sceSblPfsSetKeys, -0x9861B0) //550\r\nDEF(sceSblServiceCryptAsync, -0x926F70)\r\nDEF(sceSblServiceCryptAsync_deref_singleton, -0x926F32)\r\nDEF(copyin, -0x9CC830)\r\nDEF(copyout, -0x9CC8E0)\r\nDEF(crypt_message_resolve, -0x491770)\r\nDEF(justreturn, -0xA0BA20)\r\nDEF(justreturn_pop, justreturn+8)\r\nDEF(mini_syscore_header, 0xE7DE58)\r\nDEF(pop_all_iret, -0xA0B852)\r\nDEF(pop_all_except_rdi_iret, pop_all_iret+4)\r\nDEF(push_pop_all_iret, -0x9A86E8)\r\nDEF(kernel_pmap_store, 0x2E2C848)\r\nDEF(crypt_singleton_array, 0x2D71830)\r\nDEF(security_flags, 0xAC8064)\r\nDEF(targetid, 0xAC806D)\r\nDEF(qa_flags, 0xAC8088)\r\nDEF(utoken, 0xAC80F0)\r\nDEF(mov_rax_cr0, -0xa12a61)\r\nDEF(mov_cr0_rax, -0xa12a5c)\r\nDEF(mov_rdi_cr2, -0xa0ec8a)\r\nDEF(lgdt_rdi, -0x9cc140)\r\nDEF(lidt_lldt, -0xa122b1)\r\nDEF(ltr_ax, -0xa1228f)\r\nDEF(kproc_shutdown, -0x9a6c40)\r\nDEF(s_shutdown_final, 0x417c9e)\r\nDEF(eventhandler_register, -0x53d300)\r\nDEF(strlen_trap, -0x4603a8)\r\nDEF(lapic_map, 0x28B3830)\r\n#include \"offset_list.txt\"\r\nEND_FW()\r\n\r\nSTART_FW(761)\r\nDEF(allproc, 0x2859D50)\r\nDEF(idt, 0x2E7FDF0)\r\nDEF(gdt_array, 0x2E810D0)\r\nDEF(tss_array, 0x2E82AD0)\r\nDEF(pcpu_array, 0x2E94A00)\r\nDEF(doreti_iret, -0xA0B7F3)\r\nDEF(add_rsp_iret, doreti_iret - 7)\r\nDEF(swapgs_add_rsp_iret, doreti_iret - 10)\r\nDEF(rep_movsb_pop_rbp_ret, -0x9CBF66)\r\nDEF(rdmsr_start, -0xA0CF2A)\r\nDEF(wrmsr_ret, -0xA0E2FC)\r\nDEF(dr2gpr_start, -0xA12913)\r\nDEF(gpr2dr_1_start, -0xA127FA)\r\nDEF(gpr2dr_2_start, -0xA12707)\r\nDEF(mov_cr3_rax_mov_ds, -0xa12369)\r\nDEF(mov_rax_cr3, -0x3ADC3E)\r\nDEF(nop_ret, wrmsr_ret + 2)\r\nDEF(cpu_switch, -0xA12B00)\r\nDEF(mprotect_fix_start, -0x944D14)\r\nDEF(mprotect_fix_end, mprotect_fix_start+6)\r\n\r\nDEF(mmap_self_fix_1_start, -0x0)\r\nDEF(mmap_self_fix_1_end, mmap_self_fix_1_start+2)\r\nDEF(mmap_self_fix_2_start, -0x0)\r\nDEF(mmap_self_fix_2_end, mmap_self_fix_2_start+2)\r\n\r\nDEF(aslr_fix_start, -0x890C00)\r\nDEF(aslr_fix_end, aslr_fix_start+2)\r\n\r\nDEF(sigaction_fix_start, -0x6EFFCD)\r\nDEF(sigaction_fix_end, -0x6EFFB2)\r\nDEF(sysents, 0x1B7260)\r\nDEF(sysents_ps4, 0x1AECB0)\r\nDEF(sysentvec, 0xE21B78)\r\nDEF(sysentvec_ps4, 0xE21CF0)\r\nDEF(sceSblServiceMailbox, -0x6AD3F0)\r\nDEF(sceSblAuthMgrSmIsLoadable2, -0x8DF320)\r\nDEF(mdbg_call_fix, -0x659169)\r\nDEF(syscall_before, -0x8372BF)\r\nDEF(syscall_after, -0x83729C)\r\nDEF(malloc, -0xB5650)\r\nDEF(M_something, 0x1457650)\r\nDEF(loadSelfSegment_epilogue, -0x8DEC29)\r\nDEF(loadSelfSegment_watchpoint, -0x2E2C88)\r\nDEF(loadSelfSegment_watchpoint_lr, -0x8DEE77)\r\nDEF(decryptSelfBlock_watchpoint_lr, -0x8DEAFF)\r\nDEF(decryptSelfBlock_epilogue, -0x8DEA42)\r\n//DEF(decryptMultipleSelfBlocks_watchpoint_lr, -0x8DE3C2) //403\r\nDEF(decryptMultipleSelfBlocks_watchpoint_lr, -0x8DE3C9) //550\r\nDEF(decryptMultipleSelfBlocks_epilogue, -0x8DE194)\r\nDEF(sceSblServiceMailbox_lr_verifyHeader, -0x8DF006)\r\nDEF(sceSblServiceMailbox_lr_loadSelfSegment, -0x8DEC99)\r\nDEF(sceSblServiceMailbox_lr_decryptSelfBlock, -0x8DE6E6)\r\nDEF(sceSblServiceMailbox_lr_decryptMultipleSelfBlocks, -0x8DDF01)\r\nDEF(sceSblServiceMailbox_lr_sceSblAuthMgrSmFinalize, -0x8DF398)\r\nDEF(sceSblServiceMailbox_lr_verifySuperBlock, -0x98508D)\r\nDEF(sceSblServiceMailbox_lr_sceSblPfsClearKey_1, -0x98562B)\r\nDEF(sceSblServiceMailbox_lr_sceSblPfsClearKey_2, -0x9855B8)\r\nDEF(sceSblServiceMailbox_lr_npdrm_cmd_5, -0x3340CB)\r\nDEF(sceSblServiceMailbox_lr_npdrm_cmd_6, -0x333EA2)\r\n//DEF(sceSblPfsSetKeys, -0x985330) //403\r\nDEF(sceSblPfsSetKeys, -0x9861B0) //550\r\nDEF(sceSblServiceCryptAsync, -0x926F70)\r\nDEF(sceSblServiceCryptAsync_deref_singleton, -0x926F32)\r\nDEF(copyin, -0x9CC830)\r\nDEF(copyout, -0x9CC8E0)\r\nDEF(crypt_message_resolve, -0x491770)\r\nDEF(justreturn, -0xA0BA20)\r\nDEF(justreturn_pop, justreturn+8)\r\nDEF(mini_syscore_header, 0xE7DE58)\r\nDEF(pop_all_iret, -0xA0B852)\r\nDEF(pop_all_except_rdi_iret, pop_all_iret+4)\r\nDEF(push_pop_all_iret, -0x9A9750)\r\nDEF(kernel_pmap_store, 0x2E2C848)\r\nDEF(crypt_singleton_array, 0x2D71830)\r\nDEF(security_flags, 0xAC8064)\r\nDEF(targetid, 0xAC806D)\r\nDEF(qa_flags, 0xAC8088)\r\nDEF(utoken, 0xAC80F0)\r\nDEF(mov_rax_cr0, -0xa12a61)\r\nDEF(mov_cr0_rax, -0xa12a5c)\r\nDEF(mov_rdi_cr2, -0xa0ec8a)\r\nDEF(lgdt_rdi, -0x9cc140)\r\nDEF(lidt_lldt, -0xa122b1)\r\nDEF(ltr_ax, -0xa1228f)\r\nDEF(kproc_shutdown, -0x9a60e8)\r\nDEF(s_shutdown_final, 0x417c23)\r\nDEF(eventhandler_register, -0x53d300)\r\nDEF(strlen_trap, -0x4603a8)\r\nDEF(lapic_map, 0x28B3830)\r\n#include \"offset_list.txt\"\r\nEND_FW()\r\n\r\nSTART_FW(800)\r\nDEF(allproc, 0x2875d50) \r\nDEF(idt, 0x2eb3df0) \r\nDEF(gdt_array, 0x2eb50d0) \r\nDEF(tss_array, 0x2eb6ad0) \r\nDEF(pcpu_array, 0x2ec8a00)\r\nDEF(doreti_iret, -0xa28c73) \r\nDEF(add_rsp_iret, doreti_iret - 7)\r\nDEF(swapgs_add_rsp_iret, doreti_iret - 10)\r\nDEF(rep_movsb_pop_rbp_ret, -0x9ec5c6) \r\nDEF(rdmsr_start, -0xa2a3aa) \r\nDEF(wrmsr_ret, -0xa2b77c) \r\nDEF(dr2gpr_start, -0xa2fd93)\r\nDEF(gpr2dr_1_start, -0xa2fc7a)\r\nDEF(gpr2dr_2_start, -0xa2fb87)\r\nDEF(mov_cr3_rax_mov_ds, -0xa2f7e9)\r\nDEF(mov_rax_cr3, -0x3b851f) \r\nDEF(nop_ret, wrmsr_ret + 2)\r\nDEF(cpu_switch, -0xa2ff80)\r\nDEF(mprotect_fix_start, -0x965114)\r\nDEF(mprotect_fix_end, mprotect_fix_start+6)\r\n\r\nDEF(mmap_self_fix_1_start, -0x0)\r\nDEF(mmap_self_fix_1_end, mmap_self_fix_1_start+2)\r\nDEF(mmap_self_fix_2_start, -0x0)\r\nDEF(mmap_self_fix_2_end, mmap_self_fix_2_start+2)\r\n\r\nDEF(aslr_fix_start, -0x8b12a1)\r\nDEF(aslr_fix_end, aslr_fix_start+2)\r\n\r\nDEF(sigaction_fix_start, -0x708600) \r\nDEF(sigaction_fix_end, -0x7085e4) \r\nDEF(sysents, 0x1a7db0)\r\nDEF(sysents_ps4, 0x19f800)\r\nDEF(sysentvec, 0xe21ca8)\r\nDEF(sysentvec_ps4, 0xe21e20)\r\nDEF(sceSblServiceMailbox, -0x6c48f0)\r\nDEF(sceSblAuthMgrSmIsLoadable2, -0x900f10)\r\nDEF(mdbg_call_fix, -0x66f489) \r\nDEF(syscall_before, -0x856fb1)\r\nDEF(syscall_after, -0x856f8d) \r\nDEF(malloc, -0xbb320) \r\nDEF(M_something, 0x1457980) \r\nDEF(loadSelfSegment_epilogue, -0x9007eb)\r\nDEF(loadSelfSegment_watchpoint, -0x2ecc08)\r\nDEF(loadSelfSegment_watchpoint_lr, -0x900a57) \r\nDEF(decryptSelfBlock_watchpoint_lr, -0x9006bf)\r\nDEF(decryptSelfBlock_epilogue, -0x9005fe) \r\n//DEF(decryptMultipleSelfBlocks_watchpoint_lr, -0x8FFF81) //403\r\nDEF(decryptMultipleSelfBlocks_watchpoint_lr, -0x8fff88) //550 **\r\nDEF(decryptMultipleSelfBlocks_epilogue, -0x8ffd57)\r\nDEF(sceSblServiceMailbox_lr_verifyHeader, -0x900bf7)\r\nDEF(sceSblServiceMailbox_lr_loadSelfSegment, -0x90085f) \r\nDEF(sceSblServiceMailbox_lr_decryptSelfBlock, -0x90029d)\r\nDEF(sceSblServiceMailbox_lr_decryptMultipleSelfBlocks, -0x8ffab3) \r\nDEF(sceSblServiceMailbox_lr_sceSblAuthMgrSmFinalize, -0x900f88) \r\nDEF(sceSblServiceMailbox_lr_verifySuperBlock, -0x9a5693)\r\nDEF(sceSblServiceMailbox_lr_sceSblPfsClearKey_1, -0x9A5C11)\r\nDEF(sceSblServiceMailbox_lr_sceSblPfsClearKey_2, -0x9A5BA5)\r\nDEF(sceSblServiceMailbox_lr_npdrm_cmd_5, -0x33D713)\r\nDEF(sceSblServiceMailbox_lr_npdrm_cmd_6, -0x33D4E5)\r\n//DEF(sceSblPfsSetKeys, -0x9A5930) //403\r\nDEF(sceSblPfsSetKeys, -0x9a6780) // 550 **\r\nDEF(sceSblServiceCryptAsync, -0x946f60) \r\nDEF(sceSblServiceCryptAsync_deref_singleton, -0x946f23) \r\nDEF(copyin, -0x9ece90)\r\nDEF(copyout, -0x9ecf40) \r\nDEF(crypt_message_resolve, -0x49d9b0) \r\nDEF(justreturn, -0xa28ea0)\r\nDEF(justreturn_pop, justreturn+8)\r\nDEF(mini_syscore_header, 0xed4fa8)\r\nDEF(pop_all_iret, -0xa28cd2)\r\nDEF(pop_all_except_rdi_iret, pop_all_iret+4)\r\nDEF(push_pop_all_iret, -0x9ca878) \r\nDEF(kernel_pmap_store, 0x2e48848) \r\nDEF(crypt_singleton_array, 0x2d8d830) \r\nDEF(security_flags, 0xAC3064) \r\nDEF(targetid, 0xAC306D)\r\nDEF(qa_flags, 0xAC3088)\r\nDEF(utoken, 0xAC30F0) \r\nDEF(mov_rax_cr0, -0xa2fee1) \r\nDEF(mov_cr0_rax, -0xa2fedc) \r\nDEF(mov_rdi_cr2, -0xa2c10a)\r\nDEF(lgdt_rdi, -0x9ec7a0)\r\nDEF(lidt_lldt, -0xa2f731)\r\nDEF(ltr_ax, -0xa2f70f)\r\nDEF(kproc_shutdown, -0x9c7b60)\r\nDEF(s_shutdown_final, 0x379131)\r\nDEF(eventhandler_register, -0x54c190)\r\nDEF(strlen_trap, -0x46bcd8)\r\nDEF(lapic_map, 0x28cf838)\r\n#include \"offset_list.txt\"\r\nEND_FW()\r\n\r\nSTART_FW(820)\r\nDEF(allproc, 0x2875d50) \r\nDEF(idt, 0x2eb3df0) \r\nDEF(gdt_array, 0x2eb50d0) \r\nDEF(tss_array, 0x2eb6ad0) \r\nDEF(pcpu_array, 0x2ec8a00) \r\nDEF(doreti_iret, -0xA28C73) \r\nDEF(add_rsp_iret, doreti_iret - 7)\r\nDEF(swapgs_add_rsp_iret, doreti_iret - 10)\r\nDEF(rep_movsb_pop_rbp_ret, -0x9EC5C6) \r\nDEF(rdmsr_start, -0xA2A3AA) \r\nDEF(wrmsr_ret, -0xA2B77C) \r\nDEF(dr2gpr_start, -0xA2FD93)\r\nDEF(gpr2dr_1_start, -0xA2FC7A)\r\nDEF(gpr2dr_2_start, -0xA2FB87)\r\nDEF(mov_cr3_rax_mov_ds, -0xA2F7E9) \r\nDEF(mov_rax_cr3, -0x3B721F)\r\nDEF(nop_ret, wrmsr_ret + 2)\r\nDEF(cpu_switch, -0xA2FF80) \r\nDEF(mprotect_fix_start, -0x965114) \r\nDEF(mprotect_fix_end, mprotect_fix_start+6)\r\n\r\nDEF(mmap_self_fix_1_start, -0x0)\r\nDEF(mmap_self_fix_1_end, mmap_self_fix_1_start+2)\r\nDEF(mmap_self_fix_2_start, -0x0)\r\nDEF(mmap_self_fix_2_end, mmap_self_fix_2_start+2)\r\n\r\nDEF(aslr_fix_start, -0x8B12A1)\r\nDEF(aslr_fix_end, aslr_fix_start+2)\r\n\r\nDEF(sigaction_fix_start, -0x708140) \r\nDEF(sigaction_fix_end, -0x708124) \r\nDEF(sysents, 0x1a7db0) \r\nDEF(sysents_ps4, 0x19f800) \r\nDEF(sysentvec, 0xE21CA8) \r\nDEF(sysentvec_ps4, 0xE21E20) \r\nDEF(sceSblServiceMailbox, -0x6C4430)\r\nDEF(sceSblAuthMgrSmIsLoadable2, -0x900F10)\r\nDEF(mdbg_call_fix, -0x66EFC9) \r\nDEF(syscall_before, -0x856F71) \r\nDEF(syscall_after, -0x856F4D) \r\nDEF(malloc, -0xB9E90) \r\nDEF(M_something, 0x1457980) \r\nDEF(loadSelfSegment_epilogue, -0x9007EB)\r\nDEF(loadSelfSegment_watchpoint, -0x2EB8F8)\r\nDEF(loadSelfSegment_watchpoint_lr, -0x900A57)\r\nDEF(decryptSelfBlock_watchpoint_lr, -0x9006BF)\r\nDEF(decryptSelfBlock_epilogue, -0x9005FE)\r\n//DEF(decryptMultipleSelfBlocks_watchpoint_lr, -0x8FFF81) //403\r\nDEF(decryptMultipleSelfBlocks_watchpoint_lr, -0x8FFF88)\r\nDEF(decryptMultipleSelfBlocks_epilogue, -0x8FFD57)\r\nDEF(sceSblServiceMailbox_lr_verifyHeader, -0x900BF7)\r\nDEF(sceSblServiceMailbox_lr_loadSelfSegment, -0x90085F)\r\nDEF(sceSblServiceMailbox_lr_decryptSelfBlock, -0x90029D)\r\nDEF(sceSblServiceMailbox_lr_decryptMultipleSelfBlocks, -0x8FFAB3)\r\nDEF(sceSblServiceMailbox_lr_sceSblAuthMgrSmFinalize, -0x900F88)\r\nDEF(sceSblServiceMailbox_lr_verifySuperBlock, -0x9A5693)\r\nDEF(sceSblServiceMailbox_lr_sceSblPfsClearKey_1, -0x9A5C11)\r\nDEF(sceSblServiceMailbox_lr_sceSblPfsClearKey_2, -0x9A5BA5)\r\nDEF(sceSblServiceMailbox_lr_npdrm_cmd_5, -0x33C403)\r\nDEF(sceSblServiceMailbox_lr_npdrm_cmd_6, -0x33C1D5)\r\n//DEF(sceSblPfsSetKeys, -0x9A5930) //403\r\nDEF(sceSblPfsSetKeys, -0x9A6780)\r\nDEF(sceSblServiceCryptAsync, -0x946F60)\r\nDEF(sceSblServiceCryptAsync_deref_singleton, -0x946F23)\r\nDEF(copyin, -0x9ECE90) \r\nDEF(copyout, -0x9ECF40) \r\nDEF(crypt_message_resolve, -0x49C990)\r\nDEF(justreturn, -0xA28EA0) \r\nDEF(justreturn_pop, justreturn+8)\r\nDEF(mini_syscore_header, 0xED4FA8) \r\nDEF(pop_all_iret, -0xA28CD2) \r\nDEF(pop_all_except_rdi_iret, pop_all_iret+4)\r\nDEF(push_pop_all_iret, -0x9ca2b8) \r\nDEF(kernel_pmap_store, 0x2e48848) \r\nDEF(crypt_singleton_array, 0x2d8d830) \r\nDEF(security_flags, 0xAC3064)\r\nDEF(targetid, 0xAC306D)\r\nDEF(qa_flags, 0xAC3088)\r\nDEF(utoken, 0xAC30F0)\r\nDEF(mov_rax_cr0, -0xA2FEE1)\r\nDEF(mov_cr0_rax, -0xA2FEDC)\r\nDEF(mov_rdi_cr2, -0xA2C10A) \r\nDEF(lgdt_rdi, -0x9EC7A0) \r\nDEF(lidt_lldt, -0xA2F731) \r\nDEF(ltr_ax, -0xA2F70F) \r\nDEF(kproc_shutdown, -0x9c6908) \r\nDEF(s_shutdown_final, 0x379133) \r\nDEF(eventhandler_register, -0x54B1C0) \r\nDEF(strlen_trap, -0x46ACB8)\r\nDEF(lapic_map, 0x28cf838)\r\n#include \"offset_list.txt\"\r\nEND_FW()\r\n\r\nSTART_FW(840)\r\nDEF(allproc, 0x2875d50)\r\nDEF(idt, 0x2eb3df0)\r\nDEF(gdt_array, 0x2eb50d0)\r\nDEF(tss_array, 0x2eb6ad0)\r\nDEF(pcpu_array, 0x2ec8a00)\r\nDEF(doreti_iret, -0xa27973)\r\nDEF(add_rsp_iret, doreti_iret - 7)\r\nDEF(swapgs_add_rsp_iret, doreti_iret - 10)\r\nDEF(rep_movsb_pop_rbp_ret, -0x9eb2c6)\r\nDEF(rdmsr_start, -0xa290aa)\r\nDEF(wrmsr_ret, -0xa2a47c)\r\nDEF(dr2gpr_start, -0xA2EA93)\r\nDEF(gpr2dr_1_start, -0xA2E97A)\r\nDEF(gpr2dr_2_start, -0xA2E887)\r\nDEF(mov_cr3_rax_mov_ds, -0xA2E4E9)\r\nDEF(mov_rax_cr3, -0x3B6F8F)\r\nDEF(nop_ret, wrmsr_ret + 2)\r\nDEF(cpu_switch, -0xa2ec80)\r\nDEF(mprotect_fix_start, -0x963e14)\r\nDEF(mprotect_fix_end, mprotect_fix_start+6)\r\n\r\nDEF(mmap_self_fix_1_start, -0x0)\r\nDEF(mmap_self_fix_1_end, mmap_self_fix_1_start+2)\r\nDEF(mmap_self_fix_2_start, -0x0)\r\nDEF(mmap_self_fix_2_end, mmap_self_fix_2_start+2)\r\n\r\nDEF(aslr_fix_start, -0x8AFFA1)\r\nDEF(aslr_fix_end, aslr_fix_start+2)\r\n\r\nDEF(sigaction_fix_start, -0x706dd0)\r\nDEF(sigaction_fix_end, -0x706db4)\r\nDEF(sysents, 0x1a7db0)\r\nDEF(sysents_ps4, 0x19f800)\r\nDEF(sysentvec, 0xE21CA8)\r\nDEF(sysentvec_ps4, 0xE21E20)\r\nDEF(sceSblServiceMailbox, -0x6c30c0)\r\nDEF(sceSblAuthMgrSmIsLoadable2, -0x8ffc10)\r\nDEF(mdbg_call_fix, -0x66dc59)\r\nDEF(syscall_before, -0x855c71)\r\nDEF(syscall_after, -0x855c4d)\r\nDEF(malloc, -0xb9c20)\r\nDEF(M_something, 0x1457980)\r\nDEF(loadSelfSegment_epilogue, -0x8FF4EB)\r\nDEF(loadSelfSegment_watchpoint, -0x2EB668)\r\nDEF(loadSelfSegment_watchpoint_lr, -0x8FF757)\r\nDEF(decryptSelfBlock_watchpoint_lr, -0x8FF3BF)\r\nDEF(decryptSelfBlock_epilogue, -0x8FF2FE)\r\n//DEF(decryptMultipleSelfBlocks_watchpoint_lr, -0x8FFF81) //403\r\nDEF(decryptMultipleSelfBlocks_watchpoint_lr, -0x8FEC88)\r\nDEF(decryptMultipleSelfBlocks_epilogue, -0x8FEA57)\r\nDEF(sceSblServiceMailbox_lr_verifyHeader, -0x8ff8f7)\r\nDEF(sceSblServiceMailbox_lr_loadSelfSegment, -0x8ff55f)\r\nDEF(sceSblServiceMailbox_lr_decryptSelfBlock, -0x8fef9d)\r\nDEF(sceSblServiceMailbox_lr_decryptMultipleSelfBlocks, -0x8FE7B3)\r\nDEF(sceSblServiceMailbox_lr_sceSblAuthMgrSmFinalize, -0x8ffc88)\r\nDEF(sceSblServiceMailbox_lr_verifySuperBlock, -0x9A4393)\r\nDEF(sceSblServiceMailbox_lr_sceSblPfsClearKey_1, -0x9A4911)\r\nDEF(sceSblServiceMailbox_lr_sceSblPfsClearKey_2, -0x9A48A5)\r\nDEF(sceSblServiceMailbox_lr_npdrm_cmd_5, -0x33C173)\r\nDEF(sceSblServiceMailbox_lr_npdrm_cmd_6, -0x33BF45)\r\n//DEF(sceSblPfsSetKeys, -0x9A5930) //403\r\nDEF(sceSblPfsSetKeys, -0x9A5480)\r\nDEF(sceSblServiceCryptAsync, -0x945C60)\r\nDEF(sceSblServiceCryptAsync_deref_singleton, -0x945C23)\r\nDEF(copyin, -0x9ebb90)\r\nDEF(copyout, -0x9ebc40)\r\nDEF(crypt_message_resolve, -0x49C700)\r\nDEF(justreturn, -0xa27ba0)\r\nDEF(justreturn_pop, justreturn+8)\r\nDEF(mini_syscore_header, 0xED4FA8)\r\nDEF(pop_all_iret, -0xa279d2)\r\nDEF(pop_all_except_rdi_iret, pop_all_iret+4)\r\nDEF(push_pop_all_iret, -0x9c6608)\r\nDEF(kernel_pmap_store, 0x2e48848)\r\nDEF(crypt_singleton_array, 0x2d8d830)\r\nDEF(security_flags, 0xAC3064)\r\nDEF(targetid, 0xAC306D)\r\nDEF(qa_flags, 0xAC3088)\r\nDEF(utoken, 0xAC30F0)\r\nDEF(mov_rax_cr0, -0xA2EBE1)\r\nDEF(mov_cr0_rax, -0xA2EBDC)\r\nDEF(mov_rdi_cr2, -0xa2ae0a)\r\nDEF(lgdt_rdi, -0x9eb4a0)\r\nDEF(lidt_lldt, -0xa2e431)\r\nDEF(ltr_ax, -0xa2e40f)\r\nDEF(kproc_shutdown, -0x9c3660)\r\nDEF(s_shutdown_final, 0x378D39)\r\nDEF(eventhandler_register, -0x549e50)\r\nDEF(strlen_trap, -0x46AA28)\r\nDEF(lapic_map, 0x28cf838)\r\n#include \"offset_list.txt\"\r\nEND_FW()\r\n\r\nSTART_FW(860)\r\nDEF(allproc, 0x2875d50)\r\nDEF(idt, 0x2eb3df0)\r\nDEF(gdt_array, 0x2eb50d0)\r\nDEF(tss_array, 0x2eb6ad0)\r\nDEF(pcpu_array, 0x2ec8a00)\r\nDEF(doreti_iret, -0xa27973)\r\nDEF(add_rsp_iret, doreti_iret - 7)\r\nDEF(swapgs_add_rsp_iret, doreti_iret - 10)\r\nDEF(rep_movsb_pop_rbp_ret, -0x9eb2c6)\r\nDEF(rdmsr_start, -0xa290aa)\r\nDEF(wrmsr_ret, -0xa2a47c)\r\nDEF(nop_ret, wrmsr_ret + 2)\r\nDEF(dr2gpr_start, -0xA2EA93)\r\nDEF(gpr2dr_1_start, -0xA2E97A)\r\nDEF(gpr2dr_2_start, -0xA2E887)\r\nDEF(mov_cr3_rax_mov_ds, -0xa2e4e9)\r\nDEF(mov_rax_cr3, -0x3B6EFF)\r\nDEF(cpu_switch, -0xa2ec80)\r\nDEF(mprotect_fix_start, -0x963e14)\r\nDEF(mprotect_fix_end, mprotect_fix_start+6)\r\n\r\nDEF(mmap_self_fix_1_start, 0x0)\r\nDEF(mmap_self_fix_1_end, mmap_self_fix_1_start+2)\r\nDEF(mmap_self_fix_2_start, 0x0)\r\nDEF(mmap_self_fix_2_end, mmap_self_fix_2_start+2)\r\n\r\nDEF(aslr_fix_start, -0x8AFFA1)\r\nDEF(aslr_fix_end, aslr_fix_start+2)\r\n\r\nDEF(sigaction_fix_start, -0x706da0)\r\nDEF(sigaction_fix_end, -0x706d84)\r\nDEF(sysents, 0x1a7db0)\r\nDEF(sysents_ps4, 0x19f800)\r\nDEF(sysentvec, 0xe21ca8)\r\nDEF(sysentvec_ps4, 0xe21e20)\r\nDEF(sceSblServiceMailbox, -0x6C3090)\r\nDEF(sceSblAuthMgrSmIsLoadable2, -0x8FFC10)\r\nDEF(mdbg_call_fix, -0x66dc29)\r\nDEF(syscall_before, -0x855c71)\r\nDEF(syscall_after, -0x855c4d)\r\nDEF(malloc, -0xb99a0)\r\nDEF(M_something, 0x1457980)\r\nDEF(loadSelfSegment_epilogue, -0x8FF4EB)\r\nDEF(loadSelfSegment_watchpoint, -0x2EB488)\r\nDEF(loadSelfSegment_watchpoint_lr, -0x8FF757)\r\nDEF(decryptSelfBlock_watchpoint_lr, -0x8FF3BF)\r\nDEF(decryptSelfBlock_epilogue, -0x8FF2FE)\r\n//DEF(decryptMultipleSelfBlocks_watchpoint_lr, -0x8FFF81) //403\r\nDEF(decryptMultipleSelfBlocks_watchpoint_lr, -0x8FEC88)\r\nDEF(decryptMultipleSelfBlocks_epilogue, -0x8FEA57)\r\nDEF(sceSblServiceMailbox_lr_verifyHeader, -0x8ff8f7)\r\nDEF(sceSblServiceMailbox_lr_loadSelfSegment, -0x8ff55f)\r\nDEF(sceSblServiceMailbox_lr_decryptSelfBlock, -0x8fef9d)\r\nDEF(sceSblServiceMailbox_lr_decryptMultipleSelfBlocks, -0x8FE7B3)\r\nDEF(sceSblServiceMailbox_lr_sceSblAuthMgrSmFinalize, -0x8ffc88)\r\nDEF(sceSblServiceMailbox_lr_verifySuperBlock, -0x9A4393)\r\nDEF(sceSblServiceMailbox_lr_sceSblPfsClearKey_1, -0x9A4911)\r\nDEF(sceSblServiceMailbox_lr_sceSblPfsClearKey_2, -0x9A48A5)\r\nDEF(sceSblServiceMailbox_lr_npdrm_cmd_5, -0x33BF93)\r\nDEF(sceSblServiceMailbox_lr_npdrm_cmd_6, -0x33BD65)\r\n//DEF(sceSblPfsSetKeys, -0x9A5930) //403\r\nDEF(sceSblPfsSetKeys, -0x9A5480)\r\nDEF(sceSblServiceCryptAsync, -0x945C60)\r\nDEF(sceSblServiceCryptAsync_deref_singleton, -0x945C23)\r\nDEF(copyin, -0x9ebb90)\r\nDEF(copyout, -0x9ebc40)\r\nDEF(crypt_message_resolve, -0x49C670)\r\nDEF(justreturn, -0xa27ba0)\r\nDEF(justreturn_pop, justreturn+8)\r\nDEF(mini_syscore_header, 0xed4fa8)\r\nDEF(pop_all_iret, -0xa279d2)\r\nDEF(pop_all_except_rdi_iret, pop_all_iret+4)\r\nDEF(push_pop_all_iret, -0x9c7c80)\r\nDEF(kernel_pmap_store, 0x2e48848)\r\nDEF(crypt_singleton_array, 0x2d8d830)\r\nDEF(security_flags, 0xAC3064)\r\nDEF(targetid, 0xAC306D)\r\nDEF(qa_flags, 0xAC3088)\r\nDEF(utoken, 0xAC30F0)\r\nDEF(mov_rax_cr0, -0xA2EBE1)\r\nDEF(mov_cr0_rax, -0xA2EBDC)\r\nDEF(mov_rdi_cr2, -0xa2ae0a)\r\nDEF(lgdt_rdi, -0x9eb4a0)\r\nDEF(lidt_lldt, -0xa2e431)\r\nDEF(ltr_ax, -0xa2e40f)\r\nDEF(kproc_shutdown, -0x9c4ba8)\r\nDEF(s_shutdown_final, 0x378d2c)\r\nDEF(eventhandler_register, -0x549dc0)\r\nDEF(strlen_trap, -0x46A998)\r\nDEF(lapic_map, 0x28cf838)\r\n#include \"offset_list.txt\"\r\nEND_FW()\r\n\r\nSTART_FW(900)\r\nDEF(allproc, 0x2755d50)\r\nDEF(idt, 0x2d94300)\r\nDEF(gdt_array, 0x2d955e0)\r\nDEF(tss_array, 0x2d96fe0)\r\nDEF(pcpu_array, 0x2da8f00)\r\nDEF(doreti_iret, -0xa52e93)\r\nDEF(add_rsp_iret, doreti_iret - 7)\r\nDEF(swapgs_add_rsp_iret, doreti_iret - 10)\r\nDEF(rep_movsb_pop_rbp_ret, -0xa167e6)\r\nDEF(rdmsr_start, -0xa545ca)\r\nDEF(wrmsr_ret, -0xa5599c)\r\nDEF(nop_ret, wrmsr_ret + 2)\r\nDEF(dr2gpr_start, -0xa59fd3)\r\nDEF(gpr2dr_1_start, -0xa59eba)\r\nDEF(gpr2dr_2_start, -0xa59dc7)\r\nDEF(mov_cr3_rax_mov_ds, -0xa59a29)\r\nDEF(mov_rax_cr3, -0x3C683F)\r\nDEF(cpu_switch, -0xa5a1c0)\r\nDEF(mprotect_fix_start, -0x98e1a3)\r\nDEF(mprotect_fix_end, mprotect_fix_start+6)\r\n\r\nDEF(mmap_self_fix_1_start, 0x0)\r\nDEF(mmap_self_fix_1_end, mmap_self_fix_1_start+2)\r\nDEF(mmap_self_fix_2_start, 0x0)\r\nDEF(mmap_self_fix_2_end, mmap_self_fix_2_start+2)\r\n\r\nDEF(aslr_fix_start, -0x8D9064)\r\nDEF(aslr_fix_end, aslr_fix_start+2)\r\n\r\nDEF(sigaction_fix_start, -0x72b4b0)\r\nDEF(sigaction_fix_end, -0x72b491)\r\nDEF(sysents, 0x1aac10)\r\nDEF(sysents_ps4, 0x1a2600)\r\nDEF(sysentvec, 0xdba648)\r\nDEF(sysentvec_ps4, 0xdba7c0)\r\nDEF(sceSblServiceMailbox, -0x6e7a10)\r\nDEF(sceSblAuthMgrSmIsLoadable2, -0x928ce0)\r\nDEF(mdbg_call_fix, -0x68a599)\r\nDEF(syscall_before, -0x87e2b1)\r\nDEF(syscall_after, -0x87e28d)\r\nDEF(malloc, -0xbd1f0)\r\nDEF(M_something, 0x14070d0)\r\nDEF(loadSelfSegment_epilogue, -0x928551) \r\nDEF(loadSelfSegment_watchpoint, -0x2F9228) \r\nDEF(loadSelfSegment_watchpoint_lr,  -0x928827)\r\nDEF(decryptSelfBlock_watchpoint_lr, -0x9284BE)\r\nDEF(decryptSelfBlock_epilogue, -0x928400) \r\n//DEF(decryptMultipleSelfBlocks_watchpoint_lr, -0x92FF81) //403\r\nDEF(decryptMultipleSelfBlocks_watchpoint_lr, -0x927D88) //505\r\nDEF(decryptMultipleSelfBlocks_epilogue, -0x927B57)\r\nDEF(sceSblServiceMailbox_lr_verifyHeader, -0x9289c7)\r\nDEF(sceSblServiceMailbox_lr_loadSelfSegment, -0x928653)\r\nDEF(sceSblServiceMailbox_lr_decryptSelfBlock, -0x92809d)\r\nDEF(sceSblServiceMailbox_lr_decryptMultipleSelfBlocks, -0x9278B3) \r\nDEF(sceSblServiceMailbox_lr_sceSblAuthMgrSmFinalize, -0x928d58) \r\nDEF(sceSblServiceMailbox_lr_verifySuperBlock, -0x9CF350)\r\nDEF(sceSblServiceMailbox_lr_sceSblPfsClearKey_1, -0x9CF8D1)\r\nDEF(sceSblServiceMailbox_lr_sceSblPfsClearKey_2, -0x9CF865)\r\nDEF(sceSblServiceMailbox_lr_npdrm_cmd_5, -0x34ACA3)\r\nDEF(sceSblServiceMailbox_lr_npdrm_cmd_6, -0x34AA75)\r\n//DEF(sceSblPfsSetKeys, -0x9D5930) //403\r\nDEF(sceSblPfsSetKeys, -0x9D0440)\r\nDEF(sceSblServiceCryptAsync, -0x970020)\r\nDEF(sceSblServiceCryptAsync_deref_singleton, -0x96FFE3)\r\nDEF(copyin, -0xa170b0)\r\nDEF(copyout, -0xa17160)\r\nDEF(crypt_message_resolve, -0x4AF100)\r\nDEF(justreturn, -0xa530c0)\r\nDEF(justreturn_pop, justreturn+8)\r\nDEF(mini_syscore_header, 0xe89518)\r\nDEF(pop_all_iret, -0xa52ef2)\r\nDEF(pop_all_except_rdi_iret, pop_all_iret+4)\r\nDEF(push_pop_all_iret, -0x9f3dc0)\r\nDEF(kernel_pmap_store, 0x2d28b78)\r\nDEF(crypt_singleton_array, 0x2c6da30)\r\nDEF(security_flags, 0xD72064)\r\nDEF(targetid, 0xD7206D)\r\nDEF(qa_flags, 0xD72088)\r\nDEF(utoken, 0xD720F0)\r\nDEF(mov_rax_cr0, -0xa5a121)\r\nDEF(mov_cr0_rax, -0xa5a11c)\r\nDEF(mov_rdi_cr2, -0xa5634a)\r\nDEF(lgdt_rdi, -0xa169c0)\r\nDEF(lidt_lldt, -0xa59971)\r\nDEF(ltr_ax, -0xa5994f)\r\nDEF(kproc_shutdown, -0x9f00d0)\r\nDEF(s_shutdown_final, 0x36b115)\r\nDEF(eventhandler_register, -0x55ea00)\r\nDEF(strlen_trap, -0x47da88)\r\nDEF(lapic_map, 0x27af838)\r\n#include \"offset_list.txt\"\r\nEND_FW()\r\n\r\nSTART_FW(905)\r\nDEF(allproc, 0x2755d50)\r\nDEF(idt, 0x2d94300)\r\nDEF(gdt_array, 0x2d955e0)\r\nDEF(tss_array, 0x2d96fe0)\r\nDEF(pcpu_array, 0x2da8f00)\r\nDEF(doreti_iret, -0xa52e93)\r\nDEF(add_rsp_iret, doreti_iret - 7)\r\nDEF(swapgs_add_rsp_iret, doreti_iret - 10)\r\nDEF(rep_movsb_pop_rbp_ret, -0xa167e6)\r\nDEF(rdmsr_start, -0xa545ca)\r\nDEF(wrmsr_ret, -0xa5599c)\r\nDEF(nop_ret, wrmsr_ret + 2)\r\nDEF(dr2gpr_start, -0xa59fd3)\r\nDEF(gpr2dr_1_start, -0xa59eba)\r\nDEF(gpr2dr_2_start, -0xa59dc7)\r\nDEF(mov_cr3_rax_mov_ds, -0xa59a29)\r\nDEF(mov_rax_cr3, -0x3C660F)\r\nDEF(cpu_switch, -0xa5a1c0)\r\nDEF(mprotect_fix_start, -0x98e1a3)\r\nDEF(mprotect_fix_end, mprotect_fix_start+6)\r\n\r\nDEF(mmap_self_fix_1_start, 0x0)\r\nDEF(mmap_self_fix_1_end, mmap_self_fix_1_start+2)\r\nDEF(mmap_self_fix_2_start, 0x0)\r\nDEF(mmap_self_fix_2_end, mmap_self_fix_2_start+2)\r\n\r\nDEF(aslr_fix_start, -0x8D9064)\r\nDEF(aslr_fix_end, aslr_fix_start+2)\r\n\r\nDEF(sigaction_fix_start, -0x72b4b0)\r\nDEF(sigaction_fix_end, -0x72b491)\r\nDEF(sysents, 0x1aac10)\r\nDEF(sysents_ps4, 0x1a2600)\r\nDEF(sysentvec, 0xdba648)\r\nDEF(sysentvec_ps4, 0xdba7c0)\r\nDEF(sceSblServiceMailbox, -0x6e7a10)\r\nDEF(sceSblAuthMgrSmIsLoadable2, -0x928ce0)\r\nDEF(mdbg_call_fix, -0x68A549)\r\nDEF(syscall_before, -0x87e2b1)\r\nDEF(syscall_after, -0x87e28d)\r\nDEF(malloc, -0xbcfa0)\r\nDEF(M_something, 0x14070d0)\r\nDEF(loadSelfSegment_epilogue, -0x928551) \r\nDEF(loadSelfSegment_watchpoint, -0x2F9228)\r\nDEF(loadSelfSegment_watchpoint_lr,  -0x928827)\r\nDEF(decryptSelfBlock_watchpoint_lr, -0x9284BE)\r\nDEF(decryptSelfBlock_epilogue, -0x928400) \r\n//DEF(decryptMultipleSelfBlocks_watchpoint_lr, -0x92FF81) //403\r\nDEF(decryptMultipleSelfBlocks_watchpoint_lr, -0x927D88) //505\r\nDEF(decryptMultipleSelfBlocks_epilogue, -0x927B57)\r\nDEF(sceSblServiceMailbox_lr_verifyHeader, -0x9289c7)\r\nDEF(sceSblServiceMailbox_lr_loadSelfSegment, -0x928653)\r\nDEF(sceSblServiceMailbox_lr_decryptSelfBlock, -0x92809d)\r\nDEF(sceSblServiceMailbox_lr_decryptMultipleSelfBlocks, -0x9278B3) \r\nDEF(sceSblServiceMailbox_lr_sceSblAuthMgrSmFinalize, -0x928d58)\r\nDEF(sceSblServiceMailbox_lr_verifySuperBlock, -0x9CF350)\r\nDEF(sceSblServiceMailbox_lr_sceSblPfsClearKey_1, -0x9CF8D1)\r\nDEF(sceSblServiceMailbox_lr_sceSblPfsClearKey_2, -0x9CF865)\r\nDEF(sceSblServiceMailbox_lr_npdrm_cmd_5, -0x34AA73)\r\nDEF(sceSblServiceMailbox_lr_npdrm_cmd_6, -0x34A845)\r\n//DEF(sceSblPfsSetKeys, -0x9D5930) //403\r\nDEF(sceSblPfsSetKeys, -0x9D0440)\r\nDEF(sceSblServiceCryptAsync, -0x970020)\r\nDEF(sceSblServiceCryptAsync_deref_singleton, -0x96FFE3)\r\nDEF(copyin, -0xa170b0)\r\nDEF(copyout, -0xa17160)\r\nDEF(crypt_message_resolve, -0x4AEFB0)\r\nDEF(justreturn, -0xa530c0)\r\nDEF(justreturn_pop, justreturn+8)\r\nDEF(mini_syscore_header, 0xe89518)\r\nDEF(pop_all_iret, -0xa52ef2)\r\nDEF(pop_all_except_rdi_iret, pop_all_iret+4)\r\nDEF(push_pop_all_iret, -0x9f5078)\r\nDEF(kernel_pmap_store, 0x2d28b78)\r\nDEF(crypt_singleton_array, 0x2c6da30)\r\nDEF(security_flags, 0xD73064)\r\nDEF(targetid, 0xD7306D)\r\nDEF(qa_flags, 0xD73088)\r\nDEF(utoken, 0xD730F0)\r\nDEF(mov_rax_cr0, -0xa5a121)\r\nDEF(mov_cr0_rax, -0xa5a11c)\r\nDEF(mov_rdi_cr2, -0xa5634a)\r\nDEF(lgdt_rdi, -0xa169c0)\r\nDEF(lidt_lldt, -0xa59971)\r\nDEF(ltr_ax, -0xa5994f)\r\nDEF(kproc_shutdown, -0x9f20b8)\r\nDEF(s_shutdown_final, 0x36B132)\r\nDEF(eventhandler_register, -0x55E8B0) \r\nDEF(strlen_trap, -0x47D938)\r\nDEF(lapic_map, 0x27af838)\r\n#include \"offset_list.txt\"\r\nEND_FW()\r\n\r\nSTART_FW(920)\r\nDEF(allproc, 0x2755d50)\r\nDEF(idt, 0x2d94300)\r\nDEF(gdt_array, 0x2d955e0)\r\nDEF(tss_array, 0x2d96fe0)\r\nDEF(pcpu_array, 0x2da8f00)\r\nDEF(doreti_iret, -0xa52e93)\r\nDEF(add_rsp_iret, doreti_iret - 7)\r\nDEF(swapgs_add_rsp_iret, doreti_iret - 10)\r\nDEF(rep_movsb_pop_rbp_ret, -0xa167e6)\r\nDEF(rdmsr_start, -0xa545ca)\r\nDEF(wrmsr_ret, -0xa5599c)\r\nDEF(nop_ret, wrmsr_ret + 2)\r\nDEF(dr2gpr_start, -0xa59fd3)\r\nDEF(gpr2dr_1_start, -0xa59eba)\r\nDEF(gpr2dr_2_start, -0xa59dc7)\r\nDEF(mov_cr3_rax_mov_ds, -0xa59a29)\r\nDEF(mov_rax_cr3, -0x3C63CF)\r\nDEF(cpu_switch, -0xa5a1c0)\r\nDEF(mprotect_fix_start, -0x98e1b3)\r\nDEF(mprotect_fix_end, mprotect_fix_start+6)\r\n\r\nDEF(mmap_self_fix_1_start, 0x0)\r\nDEF(mmap_self_fix_1_end, mmap_self_fix_1_start+2)\r\nDEF(mmap_self_fix_2_start, 0x0)\r\nDEF(mmap_self_fix_2_end, mmap_self_fix_2_start+2)\r\n\r\nDEF(aslr_fix_start, -0x8D9074)\r\nDEF(aslr_fix_end, aslr_fix_start+2)\r\n\r\nDEF(sigaction_fix_start, -0x72b7f0)\r\nDEF(sigaction_fix_end, -0x72b7d1)\r\nDEF(sysents, 0x1aac60)\r\nDEF(sysents_ps4, 0x1a2650)\r\nDEF(sysentvec, 0xdba648)\r\nDEF(sysentvec_ps4, 0xdba7c0)\r\nDEF(sceSblServiceMailbox, -0x6e7d50)\r\nDEF(sceSblAuthMgrSmIsLoadable2, -0x928cf0)\r\nDEF(mdbg_call_fix, -0x68aa99)\r\nDEF(syscall_before, -0x87e2c1)\r\nDEF(syscall_after, -0x87e29d)\r\nDEF(malloc, -0xbd1b0)\r\nDEF(M_something, 0x14070d0)\r\nDEF(loadSelfSegment_epilogue, -0x928561)\r\nDEF(loadSelfSegment_watchpoint, -0x2F9208)\r\nDEF(loadSelfSegment_watchpoint_lr, -0x928837)\r\nDEF(decryptSelfBlock_watchpoint_lr, -0x9284CE)\r\nDEF(decryptSelfBlock_epilogue, -0x928410)\r\n//DEF(decryptMultipleSelfBlocks_watchpoint_lr, -0x92FF91) //403\r\nDEF(decryptMultipleSelfBlocks_watchpoint_lr, -0x927D98) //505\r\nDEF(decryptMultipleSelfBlocks_epilogue, -0x927B67)\r\nDEF(sceSblServiceMailbox_lr_verifyHeader, -0x9289d7)\r\nDEF(sceSblServiceMailbox_lr_loadSelfSegment, -0x928663)\r\nDEF(sceSblServiceMailbox_lr_decryptSelfBlock, -0x9280ad)\r\nDEF(sceSblServiceMailbox_lr_decryptMultipleSelfBlocks, -0x9278C3)\r\nDEF(sceSblServiceMailbox_lr_sceSblAuthMgrSmFinalize, -0x928d68)\r\nDEF(sceSblServiceMailbox_lr_verifySuperBlock, -0x9CF360)\r\nDEF(sceSblServiceMailbox_lr_sceSblPfsClearKey_1, -0x9CF8E1)\r\nDEF(sceSblServiceMailbox_lr_sceSblPfsClearKey_2, -0x9CF875)\r\nDEF(sceSblServiceMailbox_lr_npdrm_cmd_5, -0x34AC83)\r\nDEF(sceSblServiceMailbox_lr_npdrm_cmd_6, -0x34AA55)\r\n//DEF(sceSblPfsSetKeys, -0x9D5940) //403\r\nDEF(sceSblPfsSetKeys, -0x9D0450) //505\r\nDEF(sceSblServiceCryptAsync, -0x970030)\r\nDEF(sceSblServiceCryptAsync_deref_singleton, -0x96FFF3)\r\nDEF(copyin, -0xa170b0)\r\nDEF(copyout, -0xa17160)\r\nDEF(crypt_message_resolve, -0x4AED70)\r\nDEF(justreturn, -0xa530c0)\r\nDEF(justreturn_pop, justreturn+8)\r\nDEF(mini_syscore_header, 0xe89518)\r\nDEF(pop_all_iret, -0xa52ef2)\r\nDEF(pop_all_except_rdi_iret, pop_all_iret+4)\r\nDEF(push_pop_all_iret, -0x9f4bf0)\r\nDEF(kernel_pmap_store, 0x2d28b78)\r\nDEF(crypt_singleton_array, 0x2c6da30)\r\nDEF(security_flags, 0xD73064)\r\nDEF(targetid, 0xD7306D)\r\nDEF(qa_flags, 0xD73088)\r\nDEF(utoken, 0xD730F0)\r\nDEF(mov_rax_cr0, -0xa5a121)\r\nDEF(mov_cr0_rax, -0xa5a11c)\r\nDEF(mov_rdi_cr2, -0xa5634a)\r\nDEF(lgdt_rdi, -0xa169c0)\r\nDEF(lidt_lldt, -0xa59971)\r\nDEF(ltr_ax, -0xa5994f)\r\nDEF(kproc_shutdown, -0x9f29d0)\r\nDEF(s_shutdown_final, 0x36b109)\r\nDEF(eventhandler_register, -0x55f070)\r\nDEF(strlen_trap, -0x47d6f8)\r\nDEF(lapic_map, 0x27af838)\r\n#include \"offset_list.txt\"\r\nEND_FW()\r\n\r\nSTART_FW(940)\r\nDEF(allproc, 0x2755d50)\r\nDEF(idt, 0x2d94300)\r\nDEF(gdt_array, 0x2d955e0)\r\nDEF(tss_array, 0x2d96fe0)\r\nDEF(pcpu_array, 0x2da8f00)\r\nDEF(doreti_iret, -0xa52e93)\r\nDEF(add_rsp_iret, doreti_iret - 7)\r\nDEF(swapgs_add_rsp_iret, doreti_iret - 10)\r\nDEF(rep_movsb_pop_rbp_ret, -0xa167e6)\r\nDEF(rdmsr_start, -0xa545ca)\r\nDEF(wrmsr_ret, -0xa5599c)\r\nDEF(nop_ret, wrmsr_ret + 2)\r\nDEF(dr2gpr_start, -0xa59fd3)\r\nDEF(gpr2dr_1_start, -0xa59eba)\r\nDEF(gpr2dr_2_start, -0xa59dc7)\r\nDEF(mov_cr3_rax_mov_ds, -0xa59a29)\r\nDEF(mov_rax_cr3, -0x3C5E5F)\r\nDEF(cpu_switch, -0xa5a1c0)\r\nDEF(mprotect_fix_start, -0x98e0d3)\r\nDEF(mprotect_fix_end, mprotect_fix_start+6)\r\n\r\nDEF(mmap_self_fix_1_start, 0x0)\r\nDEF(mmap_self_fix_1_end, mmap_self_fix_1_start+2)\r\nDEF(mmap_self_fix_2_start, 0x0)\r\nDEF(mmap_self_fix_2_end, mmap_self_fix_2_start+2)\r\n\r\nDEF(aslr_fix_start, -0x8D8EE4)\r\nDEF(aslr_fix_end, aslr_fix_start+2)\r\n\r\nDEF(sigaction_fix_start, -0x72b370)\r\nDEF(sigaction_fix_end, -0x72b351)\r\nDEF(sysents, 0x1aac60)\r\nDEF(sysents_ps4, 0x1a2650)\r\nDEF(sysentvec, 0xdba648)\r\nDEF(sysentvec_ps4, 0xdba7c0)\r\nDEF(sceSblServiceMailbox, -0x6e78d0)\r\nDEF(sceSblAuthMgrSmIsLoadable2, -0x928b80)\r\nDEF(mdbg_call_fix, -0x68a5b9)\r\nDEF(syscall_before, -0x87e131)\r\nDEF(syscall_after, -0x87e10d)\r\nDEF(malloc, -0xbcc40)\r\nDEF(M_something, 0x14070d0)\r\nDEF(loadSelfSegment_epilogue, -0x9283F1)\r\nDEF(loadSelfSegment_watchpoint, -0x2F8C98)\r\nDEF(loadSelfSegment_watchpoint_lr, -0x9286C7)\r\nDEF(decryptSelfBlock_watchpoint_lr, -0x92835E)\r\nDEF(decryptSelfBlock_epilogue, -0x9282A0)\r\n//DEF(decryptMultipleSelfBlocks_watchpoint_lr, -0x92FF81) //403\r\nDEF(decryptMultipleSelfBlocks_watchpoint_lr, -0x927C28) //505\r\nDEF(decryptMultipleSelfBlocks_epilogue, -0x9279F7)\r\nDEF(sceSblServiceMailbox_lr_verifyHeader, -0x928867)\r\nDEF(sceSblServiceMailbox_lr_loadSelfSegment, -0x9284f3)\r\nDEF(sceSblServiceMailbox_lr_decryptSelfBlock, -0x927f3d)\r\nDEF(sceSblServiceMailbox_lr_decryptMultipleSelfBlocks, -0x927753)\r\nDEF(sceSblServiceMailbox_lr_sceSblAuthMgrSmFinalize, -0x928bf8)\r\nDEF(sceSblServiceMailbox_lr_verifySuperBlock, -0x9CF360)\r\nDEF(sceSblServiceMailbox_lr_sceSblPfsClearKey_1, -0x9CF8E1)\r\nDEF(sceSblServiceMailbox_lr_sceSblPfsClearKey_2, -0x9CF875)\r\nDEF(sceSblServiceMailbox_lr_npdrm_cmd_5, -0x34A713)\r\nDEF(sceSblServiceMailbox_lr_npdrm_cmd_6, -0x34A4E5)\r\n//DEF(sceSblPfsSetKeys, -0x9D5930) //403\r\nDEF(sceSblPfsSetKeys, -0x9D0450) //505\r\nDEF(sceSblServiceCryptAsync, -0x96FF50)\r\nDEF(sceSblServiceCryptAsync_deref_singleton, -0x96FF13)\r\nDEF(copyin, -0xa170b0)\r\nDEF(copyout, -0xa17160)\r\nDEF(crypt_message_resolve, -0x4AE890)\r\nDEF(justreturn, -0xa530c0)\r\nDEF(justreturn_pop, justreturn+8)\r\nDEF(mini_syscore_header, 0xe89518)\r\nDEF(pop_all_iret, -0xa52ef2)\r\nDEF(pop_all_except_rdi_iret, pop_all_iret+4)\r\nDEF(push_pop_all_iret, -0x9f4798)\r\nDEF(kernel_pmap_store, 0x2d28b78)\r\nDEF(crypt_singleton_array, 0x2c6da30)\r\nDEF(security_flags, 0xD73064)\r\nDEF(targetid, 0xD7306D)\r\nDEF(qa_flags, 0xD73088)\r\nDEF(utoken, 0xD730F0)\r\nDEF(mov_rax_cr0, -0xa5a121)\r\nDEF(mov_cr0_rax, -0xa5a11c)\r\nDEF(mov_rdi_cr2, -0xa5634a)\r\nDEF(lgdt_rdi, -0xa169c0)\r\nDEF(lidt_lldt, -0xa59971)\r\nDEF(ltr_ax, -0xa5994f)\r\nDEF(kproc_shutdown, -0x9f0088)\r\nDEF(s_shutdown_final, 0x36b109)\r\nDEF(eventhandler_register, -0x55eb90)\r\nDEF(strlen_trap, -0x47D218)\r\nDEF(lapic_map, 0x27af838)\r\n#include \"offset_list.txt\"\r\nEND_FW()\r\n\r\nSTART_FW(960)\r\nDEF(allproc, 0x2755d50)\r\nDEF(idt, 0x2d94300)\r\nDEF(gdt_array, 0x2d955e0)\r\nDEF(tss_array, 0x2d96fe0)\r\nDEF(pcpu_array, 0x2da8f00)\r\nDEF(doreti_iret, -0xa52e93)\r\nDEF(add_rsp_iret, doreti_iret - 7)\r\nDEF(swapgs_add_rsp_iret, doreti_iret - 10)\r\nDEF(rep_movsb_pop_rbp_ret, -0xa167e6)\r\nDEF(rdmsr_start, -0xa545ca)\r\nDEF(wrmsr_ret, -0xa5599c)\r\nDEF(nop_ret, wrmsr_ret + 2)\r\nDEF(dr2gpr_start, -0xa59fd3)\r\nDEF(gpr2dr_1_start, -0xa59eba)\r\nDEF(gpr2dr_2_start, -0xa59dc7)\r\nDEF(mov_cr3_rax_mov_ds, -0xa59a29)\r\nDEF(mov_rax_cr3, -0x3C5C7F)\r\nDEF(cpu_switch, -0xa5a1c0)\r\nDEF(mprotect_fix_start, -0x98e0d3)\r\nDEF(mprotect_fix_end, mprotect_fix_start+6)\r\n\r\nDEF(mmap_self_fix_1_start, 0x0)\r\nDEF(mmap_self_fix_1_end, mmap_self_fix_1_start+2)\r\nDEF(mmap_self_fix_2_start, 0x0)\r\nDEF(mmap_self_fix_2_end, mmap_self_fix_2_start+2)\r\n\r\nDEF(aslr_fix_start, -0x8D8EE4)\r\nDEF(aslr_fix_end, aslr_fix_start+2)\r\n\r\nDEF(sigaction_fix_start, -0x72b270)\r\nDEF(sigaction_fix_end, -0x72b251)\r\nDEF(sysents, 0x1aac60)\r\nDEF(sysents_ps4, 0x1a2650)\r\nDEF(sysentvec, 0xdba648)\r\nDEF(sysentvec_ps4, 0xdba7c0)\r\nDEF(sceSblServiceMailbox, -0x6e77d0)\r\nDEF(sceSblAuthMgrSmIsLoadable2, -0x928b80)\r\nDEF(mdbg_call_fix, -0x68a4a9)\r\nDEF(syscall_before, -0x87e101)\r\nDEF(syscall_after, -0x87e0dd)\r\nDEF(malloc, -0xbca60)\r\nDEF(M_something, 0x14070d0)\r\nDEF(loadSelfSegment_epilogue, -0x9283F1)\r\nDEF(loadSelfSegment_watchpoint, -0x2F8AB8)\r\nDEF(loadSelfSegment_watchpoint_lr, -0x9286C7)\r\nDEF(decryptSelfBlock_watchpoint_lr, -0x92835E)\r\nDEF(decryptSelfBlock_epilogue, -0x9282A0)\r\n//DEF(decryptMultipleSelfBlocks_watchpoint_lr, -0x92FF81) //403\r\nDEF(decryptMultipleSelfBlocks_watchpoint_lr, -0x927C28) //505\r\nDEF(decryptMultipleSelfBlocks_epilogue, -0x9279F7)\r\nDEF(sceSblServiceMailbox_lr_verifyHeader, -0x928867)\r\nDEF(sceSblServiceMailbox_lr_loadSelfSegment, -0x9284f3)\r\nDEF(sceSblServiceMailbox_lr_decryptSelfBlock, -0x927f3d)\r\nDEF(sceSblServiceMailbox_lr_decryptMultipleSelfBlocks, -0x927753)\r\nDEF(sceSblServiceMailbox_lr_sceSblAuthMgrSmFinalize, -0x928bf8)\r\nDEF(sceSblServiceMailbox_lr_verifySuperBlock, -0x9CF360)\r\nDEF(sceSblServiceMailbox_lr_sceSblPfsClearKey_1, -0x9CF8E1)\r\nDEF(sceSblServiceMailbox_lr_sceSblPfsClearKey_2, -0x9CF875)\r\nDEF(sceSblServiceMailbox_lr_npdrm_cmd_5, -0x34A533)\r\nDEF(sceSblServiceMailbox_lr_npdrm_cmd_6, -0x34A305)\r\n//DEF(sceSblPfsSetKeys, -0x9D5930) //403\r\nDEF(sceSblPfsSetKeys, -0x9D0450) //505\r\nDEF(sceSblServiceCryptAsync, -0x96FF50)\r\nDEF(sceSblServiceCryptAsync_deref_singleton, -0x96FF13)\r\nDEF(copyin, -0xa170b0)\r\nDEF(copyout, -0xa17160)\r\nDEF(crypt_message_resolve, -0x4AE6D0)\r\nDEF(justreturn, -0xa530c0)\r\nDEF(justreturn_pop, justreturn+8)\r\nDEF(mini_syscore_header, 0xe89518)\r\nDEF(pop_all_iret, -0xa52ef2)\r\nDEF(pop_all_except_rdi_iret, pop_all_iret+4)\r\nDEF(push_pop_all_iret, -0x9f36c8)\r\nDEF(kernel_pmap_store, 0x2d28b78)\r\nDEF(crypt_singleton_array, 0x2c6da30)\r\nDEF(security_flags, 0xD73064)\r\nDEF(targetid, 0xD7306D)\r\nDEF(qa_flags, 0xD73088)\r\nDEF(utoken, 0xD730F0)\r\nDEF(mov_rax_cr0, -0xa5a121)\r\nDEF(mov_cr0_rax, -0xa5a11c)\r\nDEF(mov_rdi_cr2, -0xa5634a)\r\nDEF(lgdt_rdi, -0xa169c0)\r\nDEF(lidt_lldt, -0xa59971)\r\nDEF(ltr_ax, -0xa5994f)\r\nDEF(kproc_shutdown, -0x9f23b8)\r\nDEF(s_shutdown_final, 0x36b109)\r\nDEF(eventhandler_register, -0x55e9d0)\r\nDEF(strlen_trap, -0x47d058)\r\nDEF(lapic_map, 0x27af838)\r\n#include \"offset_list.txt\"\r\nEND_FW()\r\n\r\nSTART_FW(1000)\r\nDEF(allproc, 0x2765d70) \r\nDEF(idt, 0x2d5c300) \r\nDEF(gdt_array, 0x2d5d5e0) \r\nDEF(tss_array, 0x2d5efe0) \r\nDEF(pcpu_array, 0x2d70f00) \r\nDEF(doreti_iret, -0xa6eb13) \r\nDEF(add_rsp_iret, doreti_iret - 7)\r\nDEF(swapgs_add_rsp_iret, doreti_iret - 10)\r\nDEF(rep_movsb_pop_rbp_ret, -0xa32466) \r\nDEF(rdmsr_start, -0xa7024a) \r\nDEF(wrmsr_ret, -0xa7161c) \r\nDEF(nop_ret, wrmsr_ret + 2)\r\nDEF(dr2gpr_start, -0xa75c53) \r\nDEF(gpr2dr_1_start, -0xa75b3a) \r\nDEF(gpr2dr_2_start, -0xa75a47) \r\nDEF(mov_cr3_rax_mov_ds, -0xa756a9) \r\nDEF(mov_rax_cr3, -0x3C9A2F) \r\nDEF(cpu_switch, -0xa75e40) \r\nDEF(mprotect_fix_start, -0x9a8293) \r\nDEF(mprotect_fix_end, mprotect_fix_start+6)\r\n\r\nDEF(mmap_self_fix_1_start, 0x0)\r\nDEF(mmap_self_fix_1_end, mmap_self_fix_1_start+2)\r\nDEF(mmap_self_fix_2_start, 0x0)\r\nDEF(mmap_self_fix_2_end, mmap_self_fix_2_start+2)\r\n\r\nDEF(aslr_fix_start, -0x8F033D) \r\nDEF(aslr_fix_end, aslr_fix_start+2)\r\n\r\nDEF(sigaction_fix_start, -0x73d979) \r\nDEF(sigaction_fix_end, -0x73d94d) \r\nDEF(sysents, 0x1ad100) \r\nDEF(sysents_ps4, 0x1a4bb0) \r\nDEF(sysentvec, 0xdba6d8) \r\nDEF(sysentvec_ps4, 0xdba850) \r\nDEF(sceSblServiceMailbox, -0x6f8b10) \r\nDEF(sceSblAuthMgrSmIsLoadable2, -0x941160) \r\nDEF(mdbg_call_fix, -0x6995e9) \r\nDEF(syscall_before, -0x893e21) \r\nDEF(syscall_after, -0x893ded) \r\nDEF(malloc, -0xbb850) \r\nDEF(M_something, 0x1407470) \r\nDEF(loadSelfSegment_epilogue, -0x940A67) \r\nDEF(loadSelfSegment_watchpoint, -0x2FC6A7) \r\nDEF(loadSelfSegment_watchpoint_lr, -0x940CA7) \r\nDEF(decryptSelfBlock_watchpoint_lr, -0x94093E) \r\nDEF(decryptSelfBlock_epilogue, -0x9408DB) \r\nDEF(decryptMultipleSelfBlocks_watchpoint_lr, -0x940209)\r\nDEF(decryptMultipleSelfBlocks_epilogue, -0x93FFEF) \r\nDEF(sceSblServiceMailbox_lr_verifyHeader, -0x940e47) \r\nDEF(sceSblServiceMailbox_lr_loadSelfSegment, -0x940ad4) \r\nDEF(sceSblServiceMailbox_lr_decryptSelfBlock, -0x94051d) \r\nDEF(sceSblServiceMailbox_lr_decryptMultipleSelfBlocks, -0x93FD52) \r\nDEF(sceSblServiceMailbox_lr_sceSblAuthMgrSmFinalize, -0x9411d8) \r\nDEF(sceSblServiceMailbox_lr_verifySuperBlock, -0x9EA679) \r\nDEF(sceSblServiceMailbox_lr_sceSblPfsClearKey_1, -0x9EACF2)\r\nDEF(sceSblServiceMailbox_lr_sceSblPfsClearKey_2, -0x9EAC8D)\r\nDEF(sceSblServiceMailbox_lr_npdrm_cmd_5, -0x34D98A) \r\nDEF(sceSblServiceMailbox_lr_npdrm_cmd_6, -0x34D755) \r\nDEF(sceSblPfsSetKeys, -0x9EB870)\r\nDEF(sceSblServiceCryptAsync, -0x98A590) \r\nDEF(sceSblServiceCryptAsync_deref_singleton, -0x98A556) \r\nDEF(copyin, -0xa32d30) \r\nDEF(copyout, -0xa32de0) \r\nDEF(crypt_message_resolve, -0x4B5A50) \r\nDEF(justreturn, -0xa6ed40) \r\nDEF(justreturn_pop, justreturn+8)\r\nDEF(mini_syscore_header, 0xe896d8) \r\nDEF(pop_all_iret, -0xa6eb72) \r\nDEF(pop_all_except_rdi_iret, pop_all_iret+4)\r\nDEF(push_pop_all_iret, -0xa106b8) \r\nDEF(kernel_pmap_store, 0x2cf0ef8) \r\nDEF(crypt_singleton_array, 0x2c35d70) \r\nDEF(security_flags, 0xD79064)\r\nDEF(targetid, 0xD7906D)\r\nDEF(qa_flags, 0xD79088)\r\nDEF(utoken, 0xD790F0)\r\nDEF(mov_rax_cr0, -0xa75da1) \r\nDEF(mov_cr0_rax, -0xa75d9c) \r\nDEF(mov_rdi_cr2, -0xa71fca) \r\nDEF(lgdt_rdi, -0xa32640) \r\nDEF(lidt_lldt, -0xa755f1) \r\nDEF(ltr_ax, -0xa755cf) \r\nDEF(kproc_shutdown, -0xa0d090) \r\nDEF(s_shutdown_final, 0x36dc89) \r\nDEF(eventhandler_register, -0x568300) \r\nDEF(strlen_trap, -0x483f88) \r\nDEF(lapic_map, 0x27bf858) \r\n#include \"offset_list.txt\"\r\nEND_FW()\r\n\r\nSTART_FW(1001)\r\nDEF(allproc, 0x2765d70) \r\nDEF(idt, 0x2d5c300) \r\nDEF(gdt_array, 0x2d5d5e0) \r\nDEF(tss_array, 0x2d5efe0) \r\nDEF(pcpu_array, 0x2d70f00) \r\nDEF(doreti_iret, -0xa6eb13) \r\nDEF(add_rsp_iret, doreti_iret - 7)\r\nDEF(swapgs_add_rsp_iret, doreti_iret - 10)\r\nDEF(rep_movsb_pop_rbp_ret, -0xa32466) \r\nDEF(rdmsr_start, -0xa7024a) \r\nDEF(wrmsr_ret, -0xa7161c) \r\nDEF(nop_ret, wrmsr_ret + 2)\r\nDEF(dr2gpr_start, -0xa75c53) \r\nDEF(gpr2dr_1_start, -0xa75b3a) \r\nDEF(gpr2dr_2_start, -0xa75a47) \r\nDEF(mov_cr3_rax_mov_ds, -0xa756a9) \r\nDEF(mov_rax_cr3, -0x3C9A2F) \r\nDEF(cpu_switch, -0xa75e40) \r\nDEF(mprotect_fix_start, -0x9a8293) \r\nDEF(mprotect_fix_end, mprotect_fix_start+6)\r\n\r\nDEF(mmap_self_fix_1_start, 0x0)\r\nDEF(mmap_self_fix_1_end, mmap_self_fix_1_start+2)\r\nDEF(mmap_self_fix_2_start, 0x0)\r\nDEF(mmap_self_fix_2_end, mmap_self_fix_2_start+2)\r\n\r\nDEF(aslr_fix_start, -0x8F033D) \r\nDEF(aslr_fix_end, aslr_fix_start+2)\r\n\r\nDEF(sigaction_fix_start, -0x73d979) \r\nDEF(sigaction_fix_end, -0x73d94d) \r\nDEF(sysents, 0x1ad100) \r\nDEF(sysents_ps4, 0x1a4bb0) \r\nDEF(sysentvec, 0xdba6d8) \r\nDEF(sysentvec_ps4, 0xdba850) \r\nDEF(sceSblServiceMailbox, -0x6f8b10) \r\nDEF(sceSblAuthMgrSmIsLoadable2, -0x941160) \r\nDEF(mdbg_call_fix, -0x6995e9) \r\nDEF(syscall_before, -0x893e21) \r\nDEF(syscall_after, -0x893ded) \r\nDEF(malloc, -0xbb850) \r\nDEF(M_something, 0x1407470) \r\nDEF(loadSelfSegment_epilogue, -0x940A67) \r\nDEF(loadSelfSegment_watchpoint, -0x2FC6A7) \r\nDEF(loadSelfSegment_watchpoint_lr, -0x940CA7) \r\nDEF(decryptSelfBlock_watchpoint_lr, -0x94093E) \r\nDEF(decryptSelfBlock_epilogue, -0x9408DB) \r\nDEF(decryptMultipleSelfBlocks_watchpoint_lr, -0x940209)\r\nDEF(decryptMultipleSelfBlocks_epilogue, -0x93FFEF) \r\nDEF(sceSblServiceMailbox_lr_verifyHeader, -0x940e47) \r\nDEF(sceSblServiceMailbox_lr_loadSelfSegment, -0x940ad4) \r\nDEF(sceSblServiceMailbox_lr_decryptSelfBlock, -0x94051d) \r\nDEF(sceSblServiceMailbox_lr_decryptMultipleSelfBlocks, -0x93FD52) \r\nDEF(sceSblServiceMailbox_lr_sceSblAuthMgrSmFinalize, -0x9411d8) \r\nDEF(sceSblServiceMailbox_lr_verifySuperBlock, -0x9EA679) \r\nDEF(sceSblServiceMailbox_lr_sceSblPfsClearKey_1, -0x9EACF2)\r\nDEF(sceSblServiceMailbox_lr_sceSblPfsClearKey_2, -0x9EAC8D)\r\nDEF(sceSblServiceMailbox_lr_npdrm_cmd_5, -0x34D98A) \r\nDEF(sceSblServiceMailbox_lr_npdrm_cmd_6, -0x34D755) \r\nDEF(sceSblPfsSetKeys, -0x9EB870)\r\nDEF(sceSblServiceCryptAsync, -0x98A590) \r\nDEF(sceSblServiceCryptAsync_deref_singleton, -0x98A556) \r\nDEF(copyin, -0xa32d30) \r\nDEF(copyout, -0xa32de0) \r\nDEF(crypt_message_resolve, -0x4B5A50) \r\nDEF(justreturn, -0xa6ed40) \r\nDEF(justreturn_pop, justreturn+8)\r\nDEF(mini_syscore_header, 0xe896d8) \r\nDEF(pop_all_iret, -0xa6eb72) \r\nDEF(pop_all_except_rdi_iret, pop_all_iret+4)\r\nDEF(push_pop_all_iret, -0xa10540) \r\nDEF(kernel_pmap_store, 0x2cf0ef8) \r\nDEF(crypt_singleton_array, 0x2c35d70) \r\nDEF(security_flags, 0xD79064)\r\nDEF(targetid, 0xD7906D)\r\nDEF(qa_flags, 0xD79088)\r\nDEF(utoken, 0xD790F0)\r\nDEF(mov_rax_cr0, -0xa75da1) \r\nDEF(mov_cr0_rax, -0xa75d9c) \r\nDEF(mov_rdi_cr2, -0xa71fca) \r\nDEF(lgdt_rdi, -0xa32640) \r\nDEF(lidt_lldt, -0xa755f1) \r\nDEF(ltr_ax, -0xa755cf) \r\nDEF(kproc_shutdown, -0xa0b100) \r\nDEF(s_shutdown_final, 0x36dcc5) \r\nDEF(eventhandler_register, -0x568300) \r\nDEF(strlen_trap, -0x483f88) \r\nDEF(lapic_map, 0x27bf858) \r\n#include \"offset_list.txt\"\r\nEND_FW()\r\n\r\nvoid* dlsym(void*, const char*);\r\n\r\nint set_offsets(void)\r\n{\r\n    uint32_t ver = r0gdb_get_fw_version() >> 16;\r\n    switch(ver)\r\n    {\r\n#ifndef NO_BUILTIN_OFFSETS\r\n    case 0x300: set_offsets_300(); break;\r\n    case 0x310: set_offsets_310(); break;\r\n    case 0x320: set_offsets_320(); break;\r\n    case 0x321: set_offsets_321(); break;\r\n    case 0x400: set_offsets_400(); break;\r\n    case 0x402: set_offsets_402(); break;\r\n    case 0x403: set_offsets_403(); break;\r\n    case 0x450: set_offsets_450(); break;\r\n    case 0x451: set_offsets_451(); break;\r\n    case 0x500: set_offsets_500(); break;\r\n    case 0x502: set_offsets_502(); break;\r\n    case 0x510: set_offsets_510(); break;\r\n    case 0x550: set_offsets_550(); break;\r\n    case 0x600: set_offsets_600(); break;\r\n    case 0x602: set_offsets_602(); break;\r\n    case 0x650: set_offsets_650(); break;\r\n    case 0x700: set_offsets_700(); break;\r\n    case 0x701: set_offsets_701(); break;\r\n    case 0x720: set_offsets_720(); break;\r\n    case 0x740: set_offsets_740(); break;\r\n    case 0x760: set_offsets_760(); break;\r\n    case 0x761: set_offsets_761(); break;\r\n    case 0x800: set_offsets_800(); break;\r\n    case 0x820: set_offsets_820(); break;\r\n    case 0x840: set_offsets_840(); break;\r\n    case 0x860: set_offsets_860(); break;\r\n    case 0x900: set_offsets_900(); break;\r\n    case 0x905: set_offsets_905(); break;\r\n    case 0x920: set_offsets_920(); break;\r\n    case 0x940: set_offsets_940(); break;\r\n    case 0x960: set_offsets_960(); break;\r\n    case 0x1000: set_offsets_1000(); break;\r\n    case 0x1001: set_offsets_1001(); break;\r\n#endif\r\n    default: return -1;\r\n    }\r\n    return 0;\r\n\r\n}\r\n\r\n"
  },
  {
    "path": "prosper0gdb/offsets.h",
    "content": "#pragma once\n#include <stdint.h>\n\nstruct offset_table\n{\n#define OFFSET(x) uint64_t x;\n#include \"offset_list.txt\"\n#undef OFFSET\n};\n\nextern struct offset_table offsets;\n"
  },
  {
    "path": "prosper0gdb/r0gdb.c",
    "content": "#define sysctl __sysctl\n#include \"../gdb_stub/dbg.h\"\n#include \"../gdb_stub/trap_state.h\"\n#include <stdarg.h>\n#include <stdint.h>\n#include <unistd.h>\n#include <pthread.h>\n#include <sys/types.h>\n#include <sys/mman.h>\n#include <sys/socket.h>\n#include <sys/ptrace.h>\n#include <sys/ucontext.h>\n#include <sys/cpuset.h>\n#include <sys/syscall.h>\n#include <sys/sysctl.h>\n#include <sys/thr.h>\n#include <machine/sysarch.h>\n#include <signal.h>\n#include <netinet/in.h>\n#include <netinet/ip6.h>\n#include \"r0gdb.h\"\n#include \"offsets.h\"\n\n#ifndef PS5KEK\n\n#define gettid() (*((int*(*)(void))dlsym((void*)0x1, \"pthread_self\"))())\n#define WRAPPER2(name, sym) ((typeof(&name))dlsym((void*)0x1, #sym))\n#define WRAPPER(name) WRAPPER2(name, name)\n\n#else\n\nstatic inline int gettid(void)\n{\n    long tid;\n    thr_self(&tid);\n    return tid;\n}\n\n#define WRAPPER(name) ({ void* ans; asm volatile(\"lea \" #name \"(%%rip), %0\":\"=r\"(ans)); ans; })\n#define WRAPPER2(name, sym) WRAPPER(name)\n\n#endif\n\n//#define CPU_2 //TODO: run on any cpu\n\nstatic int master_fd;\nstatic int victim_fd;\nstatic uintptr_t victim_pktopts;\nuintptr_t kdata_base;\n\nstatic void* malloc(size_t size)\n{\n    return mmap(0, size, PROT_READ|PROT_WRITE|PROT_EXEC, MAP_PRIVATE|MAP_ANON, -1, 0);\n}\n\nuint64_t kread8(uint64_t ptr)\n{\n    uint64_t offset = 0;\n    if(ptr % 4096 >= 4076)\n    {\n        offset = ptr % 4096 - 4076;\n        if(offset >= 12)\n            offset = 12;\n    }\n    else if(ptr % 256 == 255)\n        offset = 1;\n    char buf[20] = {0};\n    *(uint64_t*)buf = ptr - offset;\n    setsockopt(master_fd, IPPROTO_IPV6, IPV6_PKTINFO, buf, 20);\n    socklen_t l = 20;\n    getsockopt(victim_fd, IPPROTO_IPV6, IPV6_PKTINFO, buf, &l);\n    return *(uint64_t*)(buf + offset);\n}\n\nint kwrite20(uint64_t ptr, uint64_t a, uint64_t b, uint32_t c)\n{\n    char buf[20] = {0};\n    *(uint64_t*)buf = ptr;\n    setsockopt(master_fd, IPPROTO_IPV6, IPV6_PKTINFO, buf, 20);\n    *(uint64_t*)buf = a;\n    *(uint64_t*)(buf + 8) = b;\n    *(uint32_t*)(buf + 16) = c;\n    return setsockopt(victim_fd, IPPROTO_IPV6, IPV6_PKTINFO, buf, 20);\n}\n\nstatic int set_rthdr_size(int sock, int size)\n{\n    int len = ((size / 8) - 1) & ~1;\n    int sz = (len + 1) * 8;\n    char buf[2048] = {0};\n    buf[1] = len;\n    buf[3] = len / 2;\n    return setsockopt(sock, IPPROTO_IPV6, IPV6_RTHDR, buf, sz);\n}\n\nuint64_t kmalloc(int sz)\n{\n    if(sz > 2048)\n        return 0;\n    if(sz < 32)\n        sz = 32;\n    kwrite20(victim_pktopts+112, 0, 1, 0);\n    kwrite20(victim_pktopts+120, 0, 1, 0);\n    set_rthdr_size(victim_fd, sz);\n    uint64_t addr = kread8(victim_pktopts+112);\n    kwrite20(victim_pktopts+112, 0, 1, 0);\n    kwrite20(victim_pktopts+120, 0, 1, 0);\n    return addr;\n}\n\nint kfree(uint64_t ptr)\n{\n    kwrite20(victim_pktopts+112, ptr, 0, 0);\n    return setsockopt(victim_fd, IPPROTO_IPV6, IPV6_RTHDR, 0, 0);\n}\n\nstatic int the_pipe[2];\nuint64_t proc;\nuint64_t ofiles;\nuint64_t rpipe;\n\nstatic void init_pipe(void)\n{\n    pipe(the_pipe);\n    proc = kread8(offsets.allproc);\n    while(proc && (int)kread8(proc+0xbc) != getpid())\n        proc = kread8(proc);\n    if(!proc)\n        *(void* volatile*)0;\n    ofiles = kread8(kread8(proc+0x48));\n    rpipe = kread8(kread8(ofiles+8+48*the_pipe[0]));\n}\n\nssize_t copyout(void* dst, uint64_t src, size_t count)\n{\n    if(kwrite20(rpipe, 0x4000000040000000, 0x4000000000000000, 0))\n        *(void* volatile*)0;\n    if(kwrite20(rpipe+15, (src<<8)|0x40, src>>56, 0))\n        *(void* volatile*)0;\n    getpid(); //leaks td_retval offset\n    volatile double x = 1; //makes sure PCB_FPUINITDONE is set\n    x += 1;\n    return read(the_pipe[0], dst, count);\n}\n\nssize_t copyin(uint64_t dst, const void* src, size_t count)\n{\n    if(kwrite20(rpipe, 0, 0x4000000000000000, 0))\n        *(void* volatile*)0;\n    if(kwrite20(rpipe+15, (dst<<8)|0x40, dst>>56, 0))\n        *(void* volatile*)0;\n    return write(the_pipe[1], src, count);\n}\n\nvoid* dlsym(void*, const char*);\n\nstatic uint64_t get_thread(void)\n{\n    int tid = gettid();\n    for(uint64_t thr = kread8(proc+16); thr; thr = kread8(thr+16))\n        if((int)kread8(thr+0x9c) == tid)\n            return thr;\n    return 0;\n}\n\nstatic const void* memmem(const void* a, size_t sz1, const void* b, size_t sz2)\n{\n    for(size_t i = 0; i + sz2 <= sz1; i++)\n    {\n        int ok = 1;\n        const char* p1 = a;\n        p1 += i;\n        const char* p2 = b;\n        for(size_t j = 0; j < sz2 && ok; j++)\n            if(p1[j] != p2[j])\n                ok = 0;\n        if(ok)\n            return p1;\n    }\n    return 0;\n}\n\nstatic void bind_to_all_available_cpus(void)\n{\n    for(int i = 0; i < 128; i++)\n    {\n        uint8_t affinity[16] = {0};\n        cpuset_getaffinity(3, 1, gettid(), 16, (void*)affinity);\n        affinity[i / 8] |= 1 << (i % 8);\n        cpuset_setaffinity(3, 1, gettid(), 16, (void*)affinity);\n    }\n}\n\nstatic int bind_to_some_cpu(int skip)\n{\n    uint8_t affinity[16] = {0};\n    cpuset_getaffinity(3, 1, gettid(), 16, (void*)affinity);\n    int i = 0;\n    while(i < 16 && !affinity[i])\n        i++;\n    for(int j = 0; j < skip; j++)\n    {\n        affinity[i] &= ~(affinity[i] ^ (affinity[i] - 1));\n        while(i < 16 && !affinity[i])\n            i++;\n    }\n    if(i == 16)\n        return -1;\n    affinity[i] &= (affinity[i] ^ (affinity[i] - 1));\n    i++;\n    while(i < 16)\n        affinity[i++] = 0;\n    return cpuset_setaffinity(3, 1, gettid(), 16, (void*)affinity);\n}\n\n__attribute__((optimize(3)))\nstatic void* hammer_thread(uint64_t* arg)\n{\n    if(bind_to_some_cpu(3))\n        kill(getpid(), SIGKILL);\n    volatile uint64_t* target = (volatile uint64_t*)arg[0];\n    uint64_t stack = arg[1];\n    for(;;)\n    {\n        if(target[0] == 0x20)\n        {\n            ((volatile uint32_t*)target)[-1] = 16;\n            target[0] = 0x43;\n            target[1] = 0x202;\n            target[2] = stack;\n            target[3] = 0x3b;\n        }\n    }\n}\n\nstatic void jmp_setcontext(uint64_t pc)\n{\n    uint64_t data[0x4c0/8];\n    getcontext((void*)data);\n    data[0xe0/8] = pc;\n    setcontext((void*)data);\n}\n\nstatic int* cpuid(int which, int* out)\n{\n    asm volatile(\"cpuid\":\"=a\"(out[0]),\"=c\"(out[1]),\"=d\"(out[2]),\"=b\"(out[3]):\"a\"(which));\n    return out;\n}\n\nstatic int set_sigaltstack(void)\n{\n    stack_t stk = {\n        .ss_sp = malloc(65536),\n        .ss_size = 65536,\n        .ss_flags = 0\n    };\n    if(sigaltstack(&stk, 0))\n        return -1;\n    for(int i = 1; i < 32; i++)\n    {\n        struct sigaction sa;\n        if(sigaction(i, 0, &sa))\n            return -1;\n        sa.sa_flags |= SA_ONSTACK;\n        if(sigaction(i, &sa, 0))\n            return -1;\n    }\n    return 0;\n}\n\nstatic void getpid_for_smsw_ax(void)\n{\n    volatile double x = 1;\n    x += 1;\n    getpid();\n}\n\nextern int in_signal_handler;\nint gdbstub_main_loop(struct trap_state* ts, ssize_t* result, int* ern);\nvoid run_in_kernel(struct regs*);\n\nuint64_t kstack;\nuint64_t kframe;\nuint64_t uretframe;\nuint64_t iret;\n\nextern char _start[];\nextern char _end[];\n\nvoid r0gdb_setup(int do_swapgs)\n{\n    static int init_run = 0;\n    if(init_run)\n        return;\n    //mlock all our code & data\n    mlock(_start, _end-_start);\n    for(size_t i = 0; i < _end-_start; i += 4096)\n        *(volatile char*)(_start+i);\n#ifdef CPU_2\n    //pin ourselves to cpu 2 (13 in apic order)\n    char affinity[16] = {4};\n    cpuset_setaffinity(3, 1, gettid(), 16, (void*)affinity);\n#endif\n    //resolve addresses\n    iret = offsets.doreti_iret;\n    volatile uint64_t add_rsp_0xe8_iret = offsets.add_rsp_iret;\n    volatile uint64_t swapgs_add_rsp_0xe8_iret = offsets.swapgs_add_rsp_iret;\n    //set up alternative stacks on all cpus\n    uint64_t gadget_stack = kmalloc(2048);\n#ifdef CPU_2\n    int cpu = 13;\n#else\n    for(int cpu = 0; cpu < 16; cpu++)\n#endif\n    {\n        uint64_t tss_for_cpu = offsets.tss_array + cpu * 0x68;\n        char utss[0x68];\n        copyout(utss, tss_for_cpu, 0x68);\n        if(cpu == 13)\n            kstack = *(volatile uint64_t*)(utss+0x3c) - 0x28;\n        *(volatile uint64_t*)(utss+0x34) = gadget_stack + 0xe0;\n        *(volatile uint64_t*)(utss+0x3c) = gadget_stack + 0x1f0;\n        *(volatile uint64_t*)(utss+0x4c) = gadget_stack + 0x440;\n        copyin(tss_for_cpu, utss, 0x68);\n    }\n    uint64_t tframe = gadget_stack + 0x1a0;\n    kframe = gadget_stack + 0x1c8;\n    uretframe = gadget_stack + 0x2b0;\n    //set up trampoline frame\n    kwrite20(tframe, iret, 0x20, 0);\n    kwrite20(tframe+16, 2, kframe, 0);\n    //set up int179 frames\n#ifdef MEMRW_FALLBACK\n    if(!offsets.rep_movsb_pop_rbp_ret)\n    {\n        kwrite20(gadget_stack+0x500, iret, 0x20, 0);\n        kwrite20(gadget_stack+0x510, 0x40002, gadget_stack+0x418, 0);\n    }\n    else\n#endif\n    {\n        kwrite20(gadget_stack+0x408, 0, iret, 0);\n        kwrite20(gadget_stack+0x500, offsets.rep_movsb_pop_rbp_ret, 0x20, 0);\n        kwrite20(gadget_stack+0x510, 0x40002, gadget_stack+0x408, 0);\n    }\n    //set up gates\n    volatile char* addr = do_swapgs ? (void*)&swapgs_add_rsp_0xe8_iret : (void*)&add_rsp_0xe8_iret;\n    char gate[16] = {0};\n    gate[0] = addr[0];\n    gate[1] = addr[1];\n    gate[2] = 0x20;\n    gate[4] = 4;\n    gate[5] = 0x8e;\n    gate[6] = addr[2];\n    gate[7] = addr[3];\n    gate[8] = addr[4];\n    gate[9] = addr[5];\n    gate[10] = addr[6];\n    gate[11] = addr[7];\n    copyin(offsets.idt+1*16, gate, 16);\n    if(do_swapgs == 2)\n        copyin(offsets.idt+6*16, gate, 16);\n    gate[4] = 3;\n    gate[5] = 0xee;\n    copyin(offsets.idt+9*16, gate, 16);\n    gate[4] = 6;\n    copyin(offsets.idt+179*16, gate, 16);\n    init_run = 1;\n}\n\nvoid r0gdb_exit(void)\n{\n    //no-op, checked by comparing rip\n}\n\nstatic void r0gdb_loop(void)\n{\n    struct trap_state ts = {0};\n    ts.trap_signal = SIGTRAP;\n    ts.regs.rsp = kstack;\n    ts.regs.eflags = 0x102;\n    for(;;)\n    {\n        while(__atomic_exchange_n(&in_signal_handler, 1, __ATOMIC_ACQUIRE));\n        gdbstub_main_loop(&ts, 0, 0);\n        __atomic_exchange_n(&in_signal_handler, 0, __ATOMIC_RELEASE);\n        ts.regs.eflags &= ~0x200;\n        ts.regs.eflags |= 0x102;\n        if((void*)ts.regs.rip == (void*)r0gdb_exit)\n            break;\n        run_in_kernel(&ts.regs);\n    }\n}\n\nvoid r0gdb(void)\n{\n    r0gdb_setup(1);\n    r0gdb_loop();\n}\n\nuint64_t r0gdb_rdmsr(uint32_t ecx)\n{\n    struct regs regs = {0};\n    regs.rip = offsets.rdmsr_start;\n    regs.rsp = kstack;\n    regs.rcx = ecx;\n    regs.eflags = 0x102;\n    run_in_kernel(&regs);\n    return regs.rdx << 32 | regs.rax;\n}\n\nvoid r0gdb_wrmsr(uint32_t ecx, uint64_t value)\n{\n    struct regs regs = {0};\n    regs.rip = offsets.wrmsr_ret;\n    regs.rsp = kstack;\n    regs.rcx = ecx;\n    regs.rax = value;\n    regs.rdx = value >> 32;\n    regs.eflags = 0x102;\n    run_in_kernel(&regs);\n}\n\nvoid r0gdb_read_dbregs(uint64_t* out)\n{\n    struct regs regs = {0};\n    regs.rip = offsets.dr2gpr_start;\n    regs.rsp = kstack;\n    regs.eflags = 0x102;\n    for(int i = 0; i < 6; i++)\n        run_in_kernel(&regs);\n    out[0] = regs.r15;\n    out[1] = regs.r14;\n    out[2] = regs.r13;\n    out[3] = regs.r12;\n    out[4] = regs.r11;\n    out[5] = regs.rax;\n}\n\nuint64_t r0gdb_read_dbreg(int which)\n{\n    which &= 7;\n    if(which >= 6)\n        which -= 2;\n    uint64_t regs[6];\n    r0gdb_read_dbregs(regs);\n    return regs[which];\n}\n\nvoid r0gdb_write_dbregs(uint64_t* inp)\n{\n    struct regs regs = {0};\n    regs.rip = offsets.gpr2dr_1_start;\n    regs.rsp = kstack;\n    regs.eflags = 0x102;\n    regs.r15 = inp[0];\n    regs.r14 = inp[1];\n    regs.r13 = inp[2];\n    regs.rbx = inp[3];\n    regs.r11 = inp[4];\n    regs.rcx = inp[5];\n    regs.rax = inp[5];\n    for(int i = 0; i < 9; i++)\n        run_in_kernel(&regs);\n    regs.r11 = inp[4];\n    regs.r15 = inp[5];\n    regs.rip = offsets.gpr2dr_2_start;\n    for(int i = 0; i < 3; i++)\n        run_in_kernel(&regs);\n}\n\nvoid r0gdb_write_dbreg(int which, uint64_t value)\n{\n    which &= 7;\n    if(which >= 6)\n        which -= 2;\n    uint64_t regs[6];\n    r0gdb_read_dbregs(regs);\n    regs[which] = value;\n    r0gdb_write_dbregs(regs);\n}\n\nuint64_t r0gdb_read_cr3(void)\n{\n    struct regs regs = {0};\n    regs.rip = offsets.mov_rax_cr3;\n    regs.rsp = kstack;\n    regs.eflags = 0x102;\n    run_in_kernel(&regs);\n    return regs.rax;\n}\n\nvoid r0gdb_write_cr3(uint64_t cr3)\n{\n    struct regs regs = {0};\n    regs.rip = offsets.mov_cr3_rax_mov_ds;\n    regs.rsp = kstack;\n    regs.eflags = 0x102;\n    regs.rax = cr3;\n    run_in_kernel(&regs);\n}\n\nuint64_t r0gdb_read_cr0(void)\n{\n    struct regs regs = {0};\n    regs.rip = offsets.mov_rax_cr0;\n    regs.rsp = kstack;\n    regs.eflags = 0x102;\n    run_in_kernel(&regs);\n    return regs.rax;\n}\n\nvoid r0gdb_write_cr0(uint64_t cr0)\n{\n    struct regs regs = {0};\n    regs.rip = offsets.mov_cr0_rax;\n    regs.rsp = kstack;\n    regs.eflags = 0x102;\n    regs.rax = cr0;\n    run_in_kernel(&regs);\n}\n\nuint64_t trace_frame_size = 168;\nuint64_t trace_base;\nuint64_t trace_start;\nuint64_t trace_end;\nvoid(*trace_prog)(uint64_t*);\nextern char ret2trace[];\nstatic uint64_t uretframe_for_trace[5];\n\nvoid r0gdb_trace(size_t trace_size)\n{\n    static int tracing;\n    if(!tracing)\n    {\n        r0gdb_setup(0);\n        bind_to_some_cpu(0);\n        r0gdb_wrmsr(0xc0000084, r0gdb_rdmsr(0xc0000084) & -0x101);\n        char* stack = mmap(0, 16384, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANON, -1, 0);\n        mlock(stack, 16384);\n        stack[0] = 1;\n        mlock(stack, 16384);\n        /*uint64_t urf[5] = {(uintptr_t)ret2trace, 0x43, 2, (uintptr_t)stack+16384, 0x3b};\n        copyin(uretframe, urf, sizeof(urf));*/\n        uretframe_for_trace[0] = (uintptr_t)ret2trace;\n        uretframe_for_trace[1] = 0x43;\n        uretframe_for_trace[2] = 2;\n        uretframe_for_trace[3] = (uintptr_t)stack + 16384;\n        uretframe_for_trace[4] = 0x3b;\n        copyin(uretframe, uretframe_for_trace, sizeof(uretframe_for_trace));\n        tracing = 1;\n    }\n    char* tracebuf = 0;\n    if(trace_size)\n        tracebuf = mmap(0, trace_size, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANON, -1, 0);\n    mlock(tracebuf, trace_size);\n    for(size_t i = 0; i < trace_size; i += 4096)\n        tracebuf[i] = (uint8_t)i;\n    mlock(tracebuf, trace_size);\n    trace_base = (uint64_t)tracebuf;\n    trace_start = trace_base;\n    trace_end = trace_base + trace_size;\n}\n\nvoid r0gdb_trace_reset(void)\n{\n    trace_start = trace_base;\n}\n\nint r0gdb_open_socket(const char* ipaddr, int port)\n{\n    uint32_t ip = 0;\n    int shift = 0;\n    for(int i = 0; i < 4; i++)\n    {\n        int q = 0;\n        while(*ipaddr >= '0' && *ipaddr <= '9')\n            q = 10 * q + (*ipaddr++) - '0';\n        ipaddr++;\n        ip |= q << shift;\n        shift += 8;\n    }\n    int sock = socket(AF_INET, SOCK_STREAM, 0);\n    if(sock < 0)\n        return -1;\n    struct sockaddr_in conn = {\n        .sin_family = AF_INET,\n        .sin_addr = { .s_addr = ip },\n        .sin_port = port >> 8 | port << 8,\n    };\n    if(connect(sock, (void*)&conn, sizeof(conn)))\n    {\n        close(sock);\n        return -1;\n    }\n    return sock;\n}\n\nint r0gdb_sendall(int sock, const void* data, size_t sz)\n{\n    const char* p = (const char*)data;\n    while(sz)\n    {\n        ssize_t chk = write(sock, p, sz);\n        if(chk <= 0)\n            return -1;\n        p += chk;\n        sz -= chk;\n    }\n    return 0;\n}\n\nint r0gdb_sendfile(int fd1, int fd2)\n{\n    char buf[4096];\n    ssize_t chk;\n    while((chk = read(fd1, buf, sizeof(buf))) > 0)\n    {\n        ssize_t chk2;\n        size_t offset = 0;\n        while((chk2 = write(fd2, buf+offset, chk-offset)) > 0)\n            offset += chk2;\n        if(offset != chk)\n            return -1;\n    }\n    return 0;\n}\n\nint r0gdb_trace_send(const char* ipaddr, int port)\n{\n    int sock = r0gdb_open_socket(ipaddr, port);\n    if(sock < 0)\n        return -1;\n    int ans = r0gdb_sendall(sock, (void*)trace_base, trace_start - trace_base);\n    close(sock);\n    return ans;\n}\n\nstatic void clear_tf(int sig, siginfo_t* s, void* o_uc)\n{\n    ucontext_t* uc = (ucontext_t*)o_uc;\n    mcontext_t* mc = (mcontext_t*)(((char*)&uc->uc_mcontext)+48); // wtf??\n    mc->mc_rflags &= -257;\n}\n\nvoid r0gdb_instrument(size_t size)\n{\n    static int instrumented = 0;\n    if(instrumented)\n        return;\n    r0gdb_trace(size);\n    struct sigaction sa = {\n        .sa_sigaction = clear_tf,\n        .sa_flags = SA_SIGINFO\n    };\n    sigaction(SIGTRAP, &sa, 0);\n    instrumented = 1;\n}\n\nvoid kmemcpy(void* dst, const void* src, size_t sz);\n\nstatic void set_trace(void)\n{\n    kmemcpy((void*)uretframe, uretframe_for_trace, sizeof(uretframe_for_trace));\n    uint64_t q;\n    asm volatile(\"pop %0\\npushfq\\norb $1, 1(%%rsp)\\npopfq\\npush %0\":\"=r\"(q));\n}\n\n/*static int count = 0;\n\nstatic void eat_count(uint64_t* regs)\n{\n    if(count == 0)\n        regs[2] &= -257;\n    count--;\n}*/\n\nstatic void untrace_fn(uint64_t* regs)\n{\n    uint64_t rsp = regs[3];\n    uint64_t ret_gadget = offsets.nop_ret;\n    uint64_t frame[6] = {iret, ret_gadget, 0x20, regs[2], rsp, 0};\n    rsp -= 0x30;\n    kmemcpy((void*)rsp, frame, 48);\n    regs[3] = rsp;\n    regs[2] &= -257;\n}\n\n#define SKIP_SCHEDULER\\\n    if(regs[0] == offsets.cpu_switch)\\\n    {\\\n        untrace_fn(regs);\\\n        return;\\\n    }\n\nstatic void* trace_prog_after_trace_on_break;\n\nstatic void trace_on_break(uint64_t* regs)\n{\n    SKIP_SCHEDULER\n    static uint64_t lr;\n    if(!(regs[2] & 256))\n    {\n        regs[2] |= 256;\n        kmemcpy(&lr, (void*)regs[3], 8);\n    }\n    else if(regs[0] == lr)\n    {\n        regs[2] &= -257;\n        if(trace_prog_after_trace_on_break)\n            trace_prog = trace_prog_after_trace_on_break;\n    }\n}\n\nstatic uint64_t ptr_to_leaked_rep_movsq;\nstatic void leak_rep_movsq(uint64_t* regs)\n{\n    static int not_first;\n    static int leaking = 0;\n    static uint64_t old_rdi, old_rsi, old_rcx;\n    if(not_first)\n    {\n        if(leaking == 1)\n        {\n            regs[12] = old_rdi;\n            regs[11] = old_rsi;\n            regs[6] = old_rcx;\n            leaking = 2;\n        }\n        else if(!leaking && regs[12] == old_rdi + 8 && regs[11] == old_rsi + 8 && regs[6] == old_rcx - 1 && regs[6])\n        {\n            old_rdi = regs[12];\n            old_rsi = regs[11];\n            old_rcx = regs[6];\n            regs[12] = ptr_to_leaked_rep_movsq;\n            regs[11] = kframe;\n            regs[6] = 2;\n            leaking = 1;\n            return;\n        }\n    }\n    not_first = 1;\n    old_rdi = regs[12];\n    old_rsi = regs[11];\n    old_rcx = regs[6];\n}\n\nstatic uint64_t* jprog = 0;\n\nstatic void do_jprog(uint64_t* regs)\n{\n    SKIP_SCHEDULER\n    uint64_t rip = regs[0];\n    for(int i = 0; jprog[i]; i += 3)\n        if(rip == jprog[i])\n        {\n            if(jprog[i+1] < 21)\n                regs[jprog[i+1]] = jprog[i+2];\n            else if(jprog[i+1] == 21)\n            {\n                uint64_t lr;\n                kmemcpy(&lr, (void*)regs[3], 8);\n                regs[0] = lr;\n                regs[3] += 8;\n                regs[5] = jprog[i+2];\n            }\n            else if(jprog[i+1] == 22)\n                trace_prog = (void*)jprog[i+2];\n        }\n}\n\nstatic uint64_t* call_trace_base;\nstatic uint64_t* call_trace_start;\nstatic uint64_t* call_trace_end;\nstatic int call_trace_untrace_on_unaligned = 0;\n\nstatic void trace_skip_scheduler_only(uint64_t* regs)\n{\n    SKIP_SCHEDULER\n}\n\nstatic void trace_calls(uint64_t* regs)\n{\n    static uint64_t prev_rip = 0;\n    static uint64_t prev_rsp = 0;\n    SKIP_SCHEDULER\n    int call = 0;\n    if(regs[0] - prev_rip >= 16)\n    {\n        if(regs[3] == prev_rsp - 8)\n        {\n            call = 1;\n            if(prev_rsp % 16 && call_trace_untrace_on_unaligned)\n                regs[2] &= -257;\n        }\n        else if(regs[3] == prev_rsp + 8)\n            call = 2;\n    }\n    if(call)\n    {\n        uint64_t frame[3];\n        if(call == 1)\n        {\n            frame[0] = prev_rip;\n            frame[1] = regs[0];\n            frame[2] = regs[3];\n        }\n        else if(call == 2)\n        {\n            frame[0] = regs[0];\n            frame[1] = 0;\n            frame[2] = prev_rsp;\n        }\n        if(call_trace_end - call_trace_start >= 3)\n        {\n            *call_trace_start++ = frame[0];\n            *call_trace_start++ = frame[1];\n            *call_trace_start++ = frame[2];\n        }\n    }\n    prev_rip = regs[0];\n    prev_rsp = regs[3];\n}\n\nstatic void start_call_trace(void)\n{\n    call_trace_base = (uint64_t*)trace_base;\n    call_trace_start = (uint64_t*)trace_start;\n    call_trace_end = (uint64_t*)trace_end;\n    trace_base = trace_start = trace_end = 0;\n    trace_prog = trace_calls;\n}\n\nstatic void end_call_trace(void)\n{\n    trace_base = (uint64_t)call_trace_base;\n    trace_start = (uint64_t)call_trace_start;\n    trace_end = (uint64_t)call_trace_end;\n    call_trace_base = call_trace_start = call_trace_end = 0;\n}\n\nstatic void fix_mprotect(uint64_t* regs)\n{\n    SKIP_SCHEDULER\n    if(regs[0] == offsets.mprotect_fix_start)\n        regs[0] = offsets.mprotect_fix_end;\n}\n\nint mprotect20(void* addr, size_t sz, int prot)\n{\n    r0gdb_instrument(0);\n    int(*p_mprotect)(void*, size_t, int) = WRAPPER(mprotect);\n    trace_prog = fix_mprotect;\n    set_trace();\n    int ans = p_mprotect(addr, sz, prot);\n    trace_prog = 0;\n    return ans;\n}\n\nstatic void fix_mmap_self(uint64_t* regs)\n{\n    SKIP_SCHEDULER\n    if(regs[0] == offsets.mmap_self_fix_1_start)\n        regs[0] = offsets.mmap_self_fix_1_end;\n    else if(regs[0] == offsets.mmap_self_fix_2_start)\n        regs[0] = offsets.mmap_self_fix_2_end;\n}\n\nvoid* mmap20(void* addr, size_t sz, int prot, int flags, int fd, off_t offset)\n{\n    r0gdb_instrument(0);\n    void*(*p_mmap)(void*, size_t, int, int, int, off_t) = WRAPPER(mmap);\n    trace_prog = fix_mmap_self;\n    set_trace();\n    void* ans = p_mmap(addr, sz, prot, flags, fd, offset);\n    trace_prog = 0;\n    return ans;\n}\n\nstatic uint64_t sys_write;\nstatic uint64_t sys_sigaction;\nstatic uint64_t sys_mdbg_call;\nstatic uint64_t sys_getpid;\n\nstatic void fix_sigaction_17_9(uint64_t* regs)\n{\n    SKIP_SCHEDULER\n    if(regs[0] == sys_write)\n        regs[0] = sys_sigaction;\n    else if(regs[0] == offsets.sigaction_fix_start)\n        regs[0] = offsets.sigaction_fix_end;\n}\n\nint sigaction20(int sig, const struct sigaction* neww, struct sigaction* oldd)\n{\n    if(sig != SIGKILL && sig != SIGSTOP)\n        return sigaction(sig, neww, oldd);\n    r0gdb_instrument(0);\n    int(*p_write)(int, const void*, void*) = WRAPPER2(write, _write);\n    trace_prog = fix_sigaction_17_9;\n    if(!sys_write)\n        kmemcpy(&sys_write, (void*)(offsets.sysents + 48*SYS_write + 8), 8);\n    if(!sys_sigaction)\n        kmemcpy(&sys_sigaction, (void*)(offsets.sysents + 48*SYS_sigaction + 8), 8);\n    set_trace();\n    int ans = p_write(sig, neww, oldd);\n    trace_prog = 0;\n    return ans;\n}\n\nstatic uint64_t dumped_auth_info[17];\nstatic int authinfo_dumped = 0;\n\nstatic void filter_dump_authinfo(uint64_t* regs)\n{\n    static uint64_t lr;\n    static uint64_t r8;\n    SKIP_SCHEDULER\n    if(regs[0] == offsets.sceSblAuthMgrSmIsLoadable2)\n    {\n        kmemcpy(&lr, (void*)regs[3], 8);\n        r8 = regs[13];\n    }\n    else if(regs[0] == lr)\n    {\n        lr = 0;\n        kmemcpy(dumped_auth_info, (void*)r8, sizeof(dumped_auth_info));\n        authinfo_dumped = 1;\n    }\n}\n\nint get_self_auth_info_20(const char* path, void* buf)\n{\n    r0gdb_instrument(0);\n    int(*p_get_self_auth_info)(const char* path, void* buf) = (void*)WRAPPER(get_self_auth_info);\n    trace_prog = filter_dump_authinfo;\n    authinfo_dumped = 0;\n    set_trace();\n    int ans = p_get_self_auth_info(path, buf);\n    if(ans)\n        return ans;\n    if(!authinfo_dumped)\n        return -1;\n    char* dst = buf;\n    char* src = (void*)dumped_auth_info;\n    for(size_t i = 0; i < 0x88; i++)\n        dst[i] = src[i];\n    return 0;\n}\n\nstatic void fix_mdbg_call(uint64_t* regs)\n{\n    SKIP_SCHEDULER\n    if(regs[0] == sys_write)\n        regs[0] = sys_mdbg_call;\n    else if(regs[0] == offsets.mdbg_call_fix)\n        regs[5] = 1;\n}\n\nint mdbg_call_20(void* a, void* b, void* c)\n{\n    r0gdb_instrument(0);\n    int(*p_write)(void*, void*, void*) = WRAPPER2(write, _write);\n    trace_prog = fix_mdbg_call;\n    if(!sys_write)\n        kmemcpy(&sys_write, (void*)(offsets.sysents + 48*SYS_write + 8), 8);\n    if(!sys_mdbg_call)\n        kmemcpy(&sys_mdbg_call, (void*)(offsets.sysents + 48*573 + 8), 8);\n    set_trace();\n    int ans = p_write(a, b, c);\n    trace_prog = 0;\n    return ans;\n}\n\nstatic uint64_t fncall_fn = 0;\nstatic uint64_t fncall_args[6];\nstatic uint64_t fncall_ans = 0;\nstatic int fncall_no_untrace = 0;\n\nstatic void getpid_to_fncall(uint64_t* regs)\n{\n    SKIP_SCHEDULER\n    if(regs[0] == sys_getpid)\n    {\n        regs[0] = fncall_fn;\n        regs[12] = fncall_args[0];\n        regs[11] = fncall_args[1];\n        regs[7] = fncall_args[2];\n        regs[6] = fncall_args[3];\n        regs[13] = fncall_args[4];\n        regs[14] = fncall_args[5];\n        if(fncall_no_untrace)\n        {\n            regs[3] -= 8;\n            kmemcpy((void*)regs[3], &regs[0], 8);\n            regs[0] = offsets.nop_ret;\n        }\n        else\n            untrace_fn(regs);\n    }\n    else if(regs[0] == offsets.syscall_after)\n    {\n        fncall_ans = regs[5];\n        regs[5] = 0;\n        regs[2] &= -257;\n    }\n}\n\nuint64_t r0gdb_kfncall(uint64_t fn, ...)\n{\n    va_list args;\n    va_start(args, fn);\n    for(int i = 0; i < 6; i++)\n        fncall_args[i] = va_arg(args, uint64_t);\n    va_end(args);\n    fncall_fn = fn;\n    r0gdb_instrument(0);\n    void(*p_getpid)(void) = WRAPPER(getpid);\n    trace_prog = getpid_to_fncall;\n    if(!sys_getpid)\n        kmemcpy(&sys_getpid, (void*)(offsets.sysents + 48*SYS_getpid + 8), 8);\n    set_trace();\n    p_getpid();\n    return fncall_ans;\n}\n\nuint64_t r0gdb_kmalloc(size_t sz)\n{\n    //return r0gdb_kfncall(offsets.malloc, sz, offsets.M_something, 2 /* M_WAITOK */);\n    return r0gdb_kfncall(offsets.malloc, sz, offsets.M_something, 1 /* M_NOWAIT */);\n}\n\nstatic uint64_t instr_start;\nstatic uint64_t instr_jump;\nstatic int instrs_left;\n\nstatic void instr_count(uint64_t* regs)\n{\n    SKIP_SCHEDULER\n    if(!(regs[2] & 256))\n    {\n        regs[2] |= 256;\n        instrs_left = 100;\n    }\n    if(regs[0] == instr_start)\n    {\n        regs[0] = instr_jump;\n        instr_start = 0;\n    }\n    else if(!instr_start)\n    {\n        if(!instrs_left)\n            regs[2] &= -257;\n        else\n            instrs_left--;\n    }\n}\n\nstatic void instr_count_and_hang(uint64_t* regs)\n{\n    SKIP_SCHEDULER\n    if(!instrs_left)\n    {\n        if(regs[1] == 0x20 && (regs[2] & 512))\n        {\n            regs[0] = iret;\n            regs[2] &= -257ull;\n            regs[3] -= 40;\n            kmemcpy((void*)regs[3], regs, 40);\n        }\n    }\n    else\n        instrs_left--;\n}\n\nstatic int count_instrs(void(*fn)(), uint64_t arg1, uint64_t arg2, uint64_t arg3, uint64_t entry, uint64_t jump, int instrs)\n{\n    r0gdb_trace_reset();\n    trace_prog = instr_count;\n    instr_start = entry;\n    instr_jump = jump ? jump : entry;\n    instrs_left = instrs;\n    set_trace();\n    fn(arg1, arg2, arg3);\n    return (trace_start-trace_base)/168;\n}\n\nstatic uint64_t get_last_pc(void)\n{\n    return ((uint64_t*)trace_start)[-21];\n}\n\nstatic uint64_t get_last_unique(void)\n{\n    uint64_t* start = (uint64_t*)trace_base;\n    uint64_t* end = (uint64_t*)trace_start;\n    uint64_t ans = start[0];\n    for(uint64_t* i = start; i < end; i += 21)\n    {\n        uint64_t cur = i[0];\n        for(uint64_t* j = start; j < i; j += 21)\n            if(cur == j[0])\n            {\n                cur = ans;\n                break;\n            }\n        ans = cur;\n    }\n    return ans;\n}\n\nstatic void filter_sm_service(uint64_t* regs)\n{\n    SKIP_SCHEDULER\n    if(regs[0] == offsets.sceSblServiceMailbox)\n    {\n        kmemcpy(regs+15, (void*)regs[3], 8);\n        instrs_left = 100000;\n    }\n    if(instrs_left)\n        instrs_left--;\n    else\n        trace_start -= trace_frame_size;\n}\n\n#if 0\nstatic void filter_sm_calls(uint64_t* regs)\n{\n    static int inside = 0;\n    static uint64_t limit = 0;\n    SKIP_SCHEDULER\n    if(inside && regs[0] == limit)\n    {\n        inside = 0;\n        limit = 0;\n    }\n    if(/*regs[0] == kdata_base - 0x8a5a40 //verifyHeader\n    || regs[0] == kdata_base - 0x8a5c40 //sceSblAuthMgrSmIsLoadable2\n    || regs[0] == kdata_base - 0x8a5780 //loadSelfSegment\n    ||*/ regs[0] == kdata_base - 0x8a5410) //decryptSelfBlock\n    {\n        inside = 1;\n        kmemcpy(&limit, (void*)regs[3], 8);\n    }\n    if(!inside)\n        trace_start -= trace_frame_size;\n}\n#endif\n\nstatic char empty_page[4096];\nstatic int kek1;\nstatic int kek2;\nstatic int kek3;\nstatic int kek4;\nstatic uint64_t kekv1;\nstatic uint64_t kekv2;\nstatic uint64_t kekv3;\nstatic uint64_t kekv4;\nstatic uint64_t kekv5;\nstatic uint64_t kekv6;\nstatic uint64_t kekv7;\nstatic uint64_t kekv8;\n\nstatic void very_kek(uint64_t* regs)\n{\n    SKIP_SCHEDULER\n#if 0\n    if(regs[0] == kdata_base - 0x8a5780) //loadSelfSegment\n    {\n        uint64_t sp = regs[3];\n        kmemcpy((void*)(sp - 0x128), empty_page, 0x128);\n        kek1 += 1;\n    }\n#endif\n    if(regs[0] == offsets.loadSelfSegment_watchpoint)\n    {\n        uint64_t sp = regs[3];\n        uint64_t sp_page = sp & -4096;\n        uint64_t lr;\n        kmemcpy(&lr, (void*)(sp + 0x18), 8);\n        if(lr == offsets.loadSelfSegment_watchpoint_lr)\n        {\n            uint64_t backup[20];\n            kmemcpy(backup, (void*)sp, 32 /*24*/);\n            backup[4] = kekv1;\n            backup[5] = kekv2;\n            //backup[3] = backup[4] = kdata_base - 0x28a3a0;\n            sp -= 16;\n            kmemcpy((void*)sp, backup, 48 /*40*/);\n            regs[3] = sp;\n            kek2 += 1;\n        }\n    }\n#if 0\n    if(regs[0] == kdata_base - 0x8a5546)\n    {\n        uint64_t restore[2];\n        kmemcpy(restore, (void*)regs[3], 16);\n        kekv1 = restore[0];\n        kekv2 = restore[1];\n        regs[3] += 16;\n    }\n    if(regs[0] == offsets.decryptSelfBlock_watchpoint)\n    {\n        uint64_t backup[10];\n        kmemcpy(backup, (void*)regs[3], 32);\n        if(backup[3] == offsets.decryptSelfBlock_watchpoint_lr)\n        {\n            //backup[5] = backup[3];\n            //backup[3] = backup[4] = kdata_base - 0x28a3a0;\n            backup[4] = kekv3;\n            backup[5] = kekv4;\n            backup[6] = kekv5;\n            backup[7] = kekv6;\n            backup[8] = kekv7;\n            backup[9] = kekv8;\n            regs[3] -= 48;\n            kmemcpy((void*)regs[3], backup, 80);\n            kek3 += 1;\n        }\n    }\n#endif\n    if(regs[0] == offsets.decryptSelfBlock_epilogue)\n    {\n        uint64_t restore[6];\n        kmemcpy(restore, (void*)regs[3], 48);\n        kekv3 = restore[0];\n        kekv4 = restore[1];\n        kekv5 = restore[2];\n        kekv6 = restore[3];\n        kekv7 = restore[4];\n        kekv8 = restore[5];\n        regs[3] += 48;\n        kek4 += 1;\n    }\n}\n\nstatic void* malloc_locked(size_t sz)\n{\n    void* ans = mmap(0, sz, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANON, -1, 0);\n    if(mlock(ans, sz))\n        asm volatile(\"hlt\");\n    return ans;\n}\n\nstatic uint64_t* dump_program = 0;\n\nstatic void do_dump_at_rip(uint64_t* regs)\n{\n    SKIP_SCHEDULER\n    uint64_t* prg = dump_program;\n    while(*prg)\n    {\n        int use = (regs[0] == *prg++);\n        if(use)\n        {\n            if(*prg == (uint64_t)-1)\n                use = 0;\n            else if(*prg != 0)\n            {\n                --*prg;\n                if(*prg == 0)\n                    *prg = -1;\n                else\n                    use = 0;\n            }\n        }\n        prg++;\n        if(use)\n        {\n            uint64_t reg;\n            if((*prg) == (uint64_t)-1)\n                reg = (uint64_t)regs;\n            else\n                reg = regs[*prg++];\n            while(*prg != (uint64_t)-1)\n            {\n                if(*prg == (uint64_t)-2)\n                {\n                    prg++;\n                    if(*prg == (uint64_t)-2)\n                        break;\n                    reg += *prg++;\n                }\n                else\n                {\n                    uint64_t val;\n                    kmemcpy(&val, (void*)(reg + (*prg++)), 8);\n                    reg = val;\n                }\n            }\n            prg++;\n            *(uint64_t*)(*prg++) = reg;\n            reg &= -4096;\n            kmemcpy((void*)(*prg++), (void*)reg, 4096);\n        }\n        else\n        {\n            while(*prg++ != (uint64_t)-1);\n            prg += 2;\n        }\n    }\n}\n\nstatic uint64_t s_auth_info_for_dynlib[17] = {0x4900000000000002, 0x0, 0x800000000000ff00, 0x0, 0x0, 0x7000700080000000, 0x8000000000000000, 0x0, 0xf0000000ffff4000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0};\n\nstatic char mailbox_request[16384];\nstatic char mailbox_response[16384];\nstatic char mailbox_fakeresp[128];\nstatic uint64_t mailbox_lr[128];\nstatic uint64_t mailbox_rdx;\nstatic size_t mailbox_n = 0;\nstatic size_t blocks_decrypted = 0;\nstatic char header_backup[0x6a0];\nstatic uint32_t size_backup;\nstatic uint64_t header_ptr;\nstatic int do_fself = 0;\nstatic uint64_t fself_hook_lr;\nstatic char encrypted_memory[4096];\nstatic char decrypted_memory[4096];\nstatic char now_decrypted_memory[4096];\nstatic char faked_decrypts[16384];\nstatic size_t n_faked_decrypts;\nstatic uint64_t self_context;\n\nstatic void* trace_prog_after_mailbox = 0;\n\nstatic void trace_mailbox(uint64_t* regs)\n{\n    SKIP_SCHEDULER\n#if 0\n    if(regs[0] == kdata_base - 0x8a5410)\n        blocks_decrypted++;\n#endif\n    if((do_fself & 16))\n        fix_mmap_self(regs);\n#if 0\n    if((do_fself & 1) && regs[0] == kdata_base - 0x8a5a40) //verifyHeader\n    {\n        untrace_fn(regs);\n        mailbox_rdx = regs[12];\n        kmemcpy(&fself_hook_lr, (void*)regs[3], 8);\n        kmemcpy(&size_backup, (void*)(mailbox_rdx+8), 4);\n        kmemcpy(&header_ptr, (void*)(mailbox_rdx+0x38), 8);\n        kmemcpy(header_backup, (void*)header_ptr, 0x6a0);\n        kmemcpy((void*)header_ptr, (void*)(offsets.mini_syscore_header), 0x6a0);\n        kmemcpy((void*)(mailbox_rdx+8), &(const int[1]){0x6a0}, 4);\n    }\n    else if((do_fself & 1) && regs[0] == fself_hook_lr) //verifyHeader returned\n    {\n        fself_hook_lr = 0;\n        kmemcpy((void*)header_ptr, header_backup, 0x6a0);\n        kmemcpy((void*)(mailbox_rdx+8), &size_backup, 4);\n    }\n#endif\n    if((do_fself & 1) && regs[0] == offsets.sceSblServiceMailbox_lr_verifyHeader - 5) //verifyHeader calls sceSblServiceMailbox\n    {\n        regs[0] += 5;\n        regs[3] -= 8;\n        kmemcpy((void*)regs[3], regs, 8);\n        regs[0] = offsets.sceSblServiceMailbox;\n        untrace_fn(regs);\n        mailbox_rdx = regs[19];\n        kmemcpy(&header_ptr, (void*)(mailbox_rdx+0x38), 8);\n        kmemcpy(header_backup, (void*)header_ptr, 0x6a0);\n        kmemcpy((void*)header_ptr, (void*)(offsets.mini_syscore_header), 0x6a0);\n        kmemcpy((void*)(regs[7] + 16), &(const uint32_t[1]){0x6a0}, 4);\n    }\n    else if((do_fself & 1) && regs[0] == offsets.sceSblServiceMailbox_lr_verifyHeader) //sceSblServiceMailbox returns to verifyHeader\n    {\n        kmemcpy((void*)header_ptr, header_backup, 0x6a0);\n    }\n    else if((do_fself & 2) && regs[0] == offsets.sceSblAuthMgrSmIsLoadable2)\n    {\n        self_context = regs[12];\n        kmemcpy(regs, (void*)regs[3], 8);\n        regs[3] += 8;\n        regs[5] = 0;\n        kmemcpy((void*)regs[13], s_auth_info_for_dynlib, sizeof(s_auth_info_for_dynlib));\n    }\n    else if(regs[0] == offsets.sceSblServiceMailbox)\n    {\n        uint64_t lr;\n        kmemcpy(&lr, (void*)regs[3], 8);\n        if((do_fself & 4) && lr == offsets.sceSblServiceMailbox_lr_loadSelfSegment) //from loadSelfSegment\n        {\n            regs[3] += 8;\n            regs[0] = lr;\n            regs[5] = 0;\n            kmemcpy((void*)(regs[7]+4), &(const uint32_t[1]){0}, 4);\n            return;\n        }\n        else if(lr == offsets.sceSblServiceMailbox_lr_decryptSelfBlock) //from decryptSelfBlock\n        {\n            uint64_t request[7];\n            kmemcpy(request, (void*)regs[7], 56);\n            uint64_t p1 = request[1];\n            uint64_t p2 = request[2];\n            uint32_t sz = request[6];\n            uint64_t v1;\n            kmemcpy(&v1, (void*)(regs[3]+24), 8);\n            uint64_t v2 = (v1 - p1) + p2;\n            kmemcpy(encrypted_memory, (void*)v2, 4096);\n            kmemcpy(decrypted_memory, (void*)v1, 4096);\n            if((do_fself & 8))\n            {\n                if(n_faked_decrypts < 128)\n                {\n                    kmemcpy(faked_decrypts+128*n_faked_decrypts, (void*)regs[7], 128);\n                    n_faked_decrypts++;\n                }\n                regs[3] += 8;\n                regs[0] = lr;\n                regs[5] = 0;\n                kmemcpy((void*)(regs[7]+4), &(const uint32_t[1]){0}, 4);\n                kmemcpy((void*)v1, (void*)v2, sz);\n                return;\n            }\n        }\n        else if(lr == offsets.sceSblServiceMailbox_lr_decryptMultipleSelfBlocks && (do_fself & 64)) //from decryptMultipleSelfBlocks\n        {\n            uint64_t request[6];\n            kmemcpy(request, (void*)regs[7], 48);\n            uint64_t src_ptr_arr = request[1];\n            uint64_t dst_ptr_arr = request[2];\n            uint32_t count = request[5];\n            uint64_t vp[2];\n            kmemcpy(vp, (void*)(offsets.kernel_pmap_store+32), 16);\n            char* dmem_base = (char*)(vp[0] - vp[1]);\n            while(count--)\n            {\n                uint64_t src;\n                uint64_t dst;\n                kmemcpy(&src, dmem_base+src_ptr_arr, 8);\n                kmemcpy(&dst, dmem_base+dst_ptr_arr, 8);\n                src_ptr_arr += 8;\n                dst_ptr_arr += 8;\n                kmemcpy(dmem_base+dst, dmem_base+src, 16384);\n            }\n            if(n_faked_decrypts < 128)\n            {\n                kmemcpy(faked_decrypts+128*n_faked_decrypts, (void*)regs[7], 128);\n                n_faked_decrypts++;\n            }\n            regs[3] += 8;\n            regs[0] = lr;\n            regs[5] = 0;\n            kmemcpy((void*)(regs[7]+4), &(const uint32_t[1]){0}, 4);\n            return;\n        }\n        else if(lr == offsets.sceSblServiceMailbox_lr_sceSblAuthMgrSmFinalize) //from sceSblAuthMgrSmFinalize\n            return;\n        else if((do_fself & 32))\n        {\n            regs[0] = iret;\n            regs[2] &= -257ull;\n            regs[3] -= 40;\n            kmemcpy((void*)regs[3], regs, 40);\n        }\n        mailbox_lr[mailbox_n] = lr;\n        mailbox_rdx = regs[7];\n        kmemcpy(mailbox_request+128*mailbox_n, (void*)mailbox_rdx, 128);\n        if(mailbox_fakeresp[mailbox_n])\n        {\n            regs[3] += 8;\n            regs[0] = mailbox_lr[mailbox_n];\n            regs[5] = 0;\n            kmemcpy((void*)mailbox_rdx, mailbox_response+128*mailbox_n, 128);\n            mailbox_n++;\n        }\n    }\n    else if(regs[0] == mailbox_lr[mailbox_n])\n    {\n        kmemcpy(mailbox_response+128*mailbox_n, (void*)mailbox_rdx, 128);\n        mailbox_n++;\n    }\n    else if(trace_prog_after_mailbox)\n        ((void(*)(uint64_t*))trace_prog_after_mailbox)(regs);\n}\n\nstatic int ekh = 0x41414140;\nstatic int skh = 0x42424241;\n\nstatic void trace_mailbox_for_fpkg(uint64_t* regs)\n{\n    SKIP_SCHEDULER\n    if(regs[0] == offsets.sceSblServiceMailbox)\n    {\n        uint64_t lr;\n        kmemcpy(&lr, (void*)regs[3], 8);\n        kmemcpy(mailbox_request+128*mailbox_n, (void*)regs[7], 128);\n        mailbox_lr[mailbox_n] = lr;\n        if(mailbox_n < n_faked_decrypts && mailbox_fakeresp[mailbox_n])\n        {\n            ekh++;\n            skh++;\n            uint32_t stuff[4] = {0, 0, ekh, skh};\n            kmemcpy((void*)regs[11], stuff, 16);\n            mailbox_rdx = regs[11];\n            regs[0] = lr;\n            regs[5] = mailbox_response[mailbox_n];\n            regs[3] += 8;\n        }\n        mailbox_n++;\n        if(mailbox_n == n_faked_decrypts && trace_prog_after_mailbox)\n            trace_prog = trace_prog_after_mailbox;\n    }\n    else if(regs[0] == offsets.sceSblPfsSetKeys) //sceSblPfsSetKeys\n    {\n        ekh++;\n        skh++;\n        kmemcpy((void*)regs[12], &ekh, 4);\n        kmemcpy((void*)regs[11], &skh, 4);\n        kmemcpy(regs, (void*)regs[3], 8);\n        regs[5] = 0;\n        regs[3] += 8;\n        if(trace_prog_after_mailbox)\n            trace_prog = trace_prog_after_mailbox;\n    }\n}\n\nstatic char* panic_message;\n\n//panic is commonly inlined in sonybsd, there is no reason to trace it\n#if 0\nstatic void trace_panic(uint64_t* regs)\n{\n    SKIP_SCHEDULER\n    if(regs[0] == offsets.panic)\n    {\n        panic_message = (char*)regs[12];\n        regs[0] = iret;\n        regs[2] &= -257ull;\n        regs[3] -= 40;\n        kmemcpy((void*)regs[3], regs, 40);\n    }\n}\n#endif\n\nstatic void trace_cryptasync(uint64_t* regs)\n{\n    SKIP_SCHEDULER\n    if(regs[0] == offsets.sceSblServiceCryptAsync)\n    {\n        uint64_t req = regs[12];\n        uint64_t msg;\n        kmemcpy(&msg, (void*)req, 8);\n        if(mailbox_n < 128)\n        {\n            kmemcpy(mailbox_request+128*mailbox_n, (void*)msg, 128);\n            if(mailbox_fakeresp[mailbox_n])\n            {\n                regs[3] -= 16;\n                kmemcpy((void*)regs[3], (const uint64_t[1]){0x1234}, 8);\n                kmemcpy(regs, (void*)(req+16), 8);\n                kmemcpy(regs+12, (void*)(req+24), 8);\n                regs[11] = (uint32_t)-2;\n            }\n        }\n        mailbox_n++;\n    }\n    else if(regs[0] == 0x1234)\n    {\n        kmemcpy(regs, (void*)(regs[3]+8), 8);\n        regs[3] += 16;\n        regs[5] = 0;\n    }\n}\n\nstatic uint64_t other_thread;\n\nstatic void* other_thread_fn(void* arg)\n{\n    other_thread = get_thread();\n    //((int(*)())dlsym((void*)0x1, \"sceKernelSleep\"))(10000000);\n    for(;;)\n        asm volatile(\"\");\n}\n\nint set_offsets(void);\n\nstatic void r0gdb_init_with_offsets(void)\n{\n    init_pipe();\n    if(!victim_pktopts)\n    {\n        uint64_t fd;\n        copyout(&fd, proc+0x48, 8);\n        uint64_t ofiles;\n        copyout(&ofiles, fd, 8);\n        uint64_t victim_file;\n        copyout(&victim_file, ofiles+8+victim_fd*48, 8);\n        uint64_t victim_sock;\n        copyout(&victim_sock, victim_file, 8);\n        uint64_t so_pcb;\n        copyout(&so_pcb, victim_sock+24, 8);\n        copyout(&victim_pktopts, so_pcb+288, 8);\n    }\n}\n\nint r0gdb_init(void* ds, int a, int b, uintptr_t c, uintptr_t d)\n{\n    master_fd = a;\n    victim_fd = b;\n    victim_pktopts = c;\n    kdata_base = d;\n    if(!set_offsets())\n    {\n        r0gdb_init_with_offsets();\n        return 0;\n    }\n    return -1;\n}\n\n//kernel_get_fw_version from sb's sdk\nuint32_t r0gdb_get_fw_version(void)\n{\n    int mib[2] = {1, 46};\n    unsigned long size = sizeof(mib);\n    unsigned int version = 0;\n    sysctl(mib, 2, &version, &size, 0, 0);\n    return version;\n}\n\nuintptr_t r0gdb_leak_fd(int which)\n{\n    uint64_t td = get_thread();\n    uint64_t proc = kread8(td+8);\n    uint64_t fd = kread8(proc+0x48);\n    uint64_t ofiles = kread8(fd);\n    uint64_t file = kread8(ofiles+48*which+8);\n    uint32_t count;\n    copyout(&count, file + 0x28, 4);\n    count++;\n    copyin(file + 0x28, &count, 4);\n    uint64_t file_value;\n    copyout(&file_value, file, 8);\n    close(which);\n    return file_value;\n}\n"
  },
  {
    "path": "prosper0gdb/r0gdb.h",
    "content": "#pragma once\n#include <sys/types.h>\n#include \"../gdb_stub/trap_state.h\"\n\n/* krw utils */\n\nuint64_t kread8(uint64_t ptr);\nint kwrite20(uint64_t ptr, uint64_t a, uint64_t b, uint32_t c);\nuint64_t kmalloc(int sz);\nint kfree(uint64_t ptr);\nssize_t copyout(void* dst, uint64_t src, size_t count);\nssize_t copyin(uint64_t dst, const void* src, size_t count);\n\n/* init */\n\n//call before everything\nint r0gdb_init(void* ds, int a, int b, uintptr_t c, uintptr_t d);\n\n//set up for interactive gdb\nvoid r0gdb_setup(int do_swapgs);\n\n//run in kernel with the provided registers\nvoid run_in_kernel(struct regs*);\n\n//set up for trace capture\nvoid r0gdb_trace(size_t trace_size);\n\n//set up for instrumentation\nvoid r0gdb_instrument(size_t trace_size);\n\n//call from kernel gdb to exit\nvoid r0gdb_exit(void);\n\n//call to enter kernel gdb\nvoid r0gdb(void);\n\n//rdmsr & wrmsr (after r0gdb_setup only)\nuint64_t r0gdb_rdmsr(uint32_t ecx);\nvoid r0gdb_wrmsr(uint32_t ecx, uint64_t value);\n\n//debug registers r/w (after r0gdb_setup only)\nvoid r0gdb_read_dbregs(uint64_t* out);\nuint64_t r0gdb_read_dbreg(int which);\nvoid r0gdb_write_dbregs(uint64_t* out);\nvoid r0gdb_write_dbreg(int which, uint64_t value);\n\n//cr3 r/w (after r0gdb_setup only)\nuint64_t r0gdb_read_cr3(void);\nvoid r0gdb_write_cr3(uint64_t value);\n\n//netcat captured trace to specified ip & port\nint r0gdb_open_socket(const char* ipaddr, int port);\nint r0gdb_sendall(int sock, const void* data, size_t sz);\nint r0gdb_sendfile(int fd1, int fd2);\nint r0gdb_trace_send(const char* ipaddr, int port);\n\n//clear captured trace\nvoid r0gdb_trace_reset(void);\n\n/* utils */\n\n//mprotect with disabled permission checks\nint mprotect20(void* addr, size_t sz, int prot);\n\n//mmap with map_self\nvoid* mmap20(void* addr, size_t sz, int prot, int flags, int fd, off_t offset);\n\n//sigaction with sigstop/sigkill\nstruct sigaction;\nint sigaction20(int sig, const struct sigaction* neww, struct sigaction* oldd);\n\n//get_self_auth_info that works\nint get_self_auth_info_20(const char* path, void* buf);\n\n//mdbg_call that works\nint mdbg_call_20(void* a, void* b, void* c);\n\n//kernel function call\nuint64_t r0gdb_kfncall(uint64_t kfn, ...);\n\n//kernel malloc via function call\nuint64_t r0gdb_kmalloc(size_t sz);\n\n//get current firmware version\nuint32_t r0gdb_get_fw_version(void);\n\n//close the fd, without actually closing the underlying file\nuint64_t r0gdb_leak_fd(int which);\n\n/* internals */\n\nextern uint64_t kstack;\nextern uint64_t kframe;\nextern uint64_t uretframe;\n\nextern uint64_t trace_base;\nextern uint64_t trace_start;\nextern uint64_t trace_end;\nextern void(*trace_prog)(uint64_t*);\n"
  },
  {
    "path": "prosper0gdb/r0run.asm",
    "content": "use64\n\nglobal run_in_kernel\nglobal ret2trace\nglobal kmemcpy\nextern copyin\nextern copyout\nextern kframe\nextern uretframe\nextern trace_start\nextern trace_end\nextern trace_prog\nextern trace_frame_size\n\nrun_in_kernel:\npush rax\npush rdi\nmov rax, rsp\npush dword 0x3b\npush rax\npush dword 0x10202\npush dword 0x43\nlea rax, [rel .int1_return]\npush rax\nmov rdi, [rel uretframe]\nmov rsi, rsp\nmov rdx, 40\ncall copyin\nadd rsp, 40\nmov rdi, [rsp]\npush dword 0\npush qword [rdi+56]\nmov eax, [rdi+136]\npush rax\npush dword 0x20\npush qword [rdi+128]\nmov rdi, [rel kframe]\nmov rsi, rsp\nmov rdx, 40\ncall copyin\nadd rsp, 40\nmov rdi, [rsp]\nxchg rax, [rdi]\nxchg rcx, [rdi+16]\nxchg rdx, [rdi+24]\nxchg rbx, [rdi+8]\nxchg rbp, [rdi+48]\nxchg rsi, [rdi+32]\nxchg r8, [rdi+64]\nxchg r9, [rdi+72]\nxchg r10, [rdi+80]\nxchg r11, [rdi+88]\nxchg r12, [rdi+96]\nxchg r13, [rdi+104]\nxchg r14, [rdi+112]\nxchg r15, [rdi+120]\nmov rdi, [rdi+40]\nint 9\n.int1_return:\nxchg rdi, [rsp]\nxchg [rdi], rax\nxchg [rdi+16], rcx\nxchg [rdi+24], rdx\nxchg [rdi+8], rbx\nxchg [rdi+48], rbp\nxchg [rdi+32], rsi\nmov rax, [rsp]\nmov [rdi+40], rax\nxchg [rdi+64], r8\nxchg [rdi+72], r9\nxchg [rdi+80], r10\nxchg [rdi+88], r11\nxchg [rdi+96], r12\nxchg [rdi+104], r13\nxchg [rdi+112], r14\nxchg [rdi+120], r15\nmov [rsp], rdi\nsub rsp, 40\nmov rdi, rsp\nmov rsi, [rel kframe]\nmov rdx, 40\ncall copyout\nmov rdi, [rsp+40]\nmov rax, [rsp]\nmov [rdi+128], rax\nmov rax, [rsp+16]\nmov [rdi+136], eax\nmov rax, [rsp+24]\nmov [rdi+56], rax\nadd rsp, 56\nret\n\nret2trace:\npush r15\npush r14\npush r13\npush r12\npush r11\npush r10\npush r9\npush r8\npush rdi\npush rsi\npush rbp\npush dword 0\npush rbx\npush rdx\npush rcx\npush rax\nsub rsp, 40\nmov rdi, rsp\nmov rsi, [rel kframe]\nmov rdx, 40\ncall kmemcpy\nmov rcx, 168\nmov rax, [rel trace_frame_size]\ncmp rax, rcx\ncmovb rcx, rax\nmov rax, [rel trace_end]\nsub rax, [rel trace_start]\ncmp rax, rcx\ncmovb rcx, rax\nmov rdi, [rel trace_start]\nmov rsi, rsp\nrep movsb\nmov [rel trace_start], rdi\nor byte [rsp+18], 1\ncmp qword [rel trace_prog], 0\njz .no_program\nmov rdi, rsp\npush rbp\ncall qword [rel trace_prog]\npop rbp\n.no_program\nmov rdi, [rel kframe]\nmov rsi, rsp\nmov rdx, 40\ncall kmemcpy\nadd rsp, 40\npop rax\npop rcx\npop rdx\npop rbx\npop rbp\npop rbp\npop rsi\npop rdi\npop r8\npop r9\npop r10\npop r11\npop r12\npop r13\npop r14\npop r15\nint 9\n\nkmemcpy:\nmov rcx, rdx\nmov rax, rbp\nint 179\nmov rbp, rax\nret\n"
  },
  {
    "path": "prosper0gdb/stuff/offsets.txt",
    "content": "# offsets\np \"data is for cpu 0\"\np/x $gdt = kdata_base + 0x64cee30\np/x $idt = kdata_base + 0x64cdc80\np/x $tss = kdata_base + 0x64d0830\np/x $tss13 = $tss + 13 * 0x68\np/x $iret = kdata_base - 0x9cf84c\np/x $ret = kdata_base - 0x28a3a0\np/x $pcpu13 = kdata_base + 0x64d9780\np/x $lstar = kdata_base - 0x96bde8\np/x $syscalls = kdata_base + 0x1709c0\np/x $sysentvec = kdata_base + 0xd11bb8\np/x $int244 = kdata_base - 0x96be70\np/x $popctx_iret = $iret - 0x5f\np/x $rdmsr = kdata_base - 0x9d0cfa\np/x $wrmsr = kdata_base - 0x9cf8bb\np/x $rep_movsb_pop_rbp_ret = kdata_base - 0x990a55\np/x $mov_rdi_cr3 = kdata_base - 0x39700e\np/x $mov_cr3_rax = kdata_base - 0x396f9e\np/x $int_0x7e = kdata_base - 0x63fa92\np/x $justreturn = kdata_base - 0x9cf990\np/x $justreturn_pop = kdata_base - 0x9cf988\np/x $wrmsr_ret = kdata_base - 0x9d20cc\n\np/x $malloc = kdata_base - 0xa9b00\np/x $M_something = kdata_base + 0x1346080\np/x $cpu_switch = kdata_base - 0x9d6f80\n\np/x $printf = kdata_base - 0x972588\np/x $panic = kdata_base - 0x21020\n\n# 6 instructions\np/x $cpu_switch_dr2gpr = kdata_base - 0x9d6d93\n\n# 9 instructions\np/x $cpu_switch_gpr2dr = kdata_base - 0x9d6c7a\n\n# mailbox\np/x $sceSblServiceMailbox = kdata_base - 0x6824c0\n\n# mailbox calls\np/x $sceSblAuthMgrSmFinalize = kdata_base - 0x8a5d40\np/x $sceSblAuthMgrSmFinalize_call_mailbox = kdata_base - 0x8a5cc3\n\np/x $authmgr_verifyHeader = kdata_base - 0x8a5a40\np/x $authmgr_verifyHeader_call_mailbox = kdata_base - 0x8a58c1\n\np/x $sceSblAuthMgrIsLoadable2 = kdata_base - 0x8a5c40\np/x $sceSblAuthMgrIsLoadable2_call_mailbox = kdata_base - 0x8a5b27\n\np/x $authmgr_loadSelfSegment = kdata_base - 0x8a5780\np/x $authmgr_loadSelfSegment_call_mailbox = kdata_base - 0x8a5546\n\np/x $authmgr_decryptSelfBlock = kdata_base - 0x8a5410\np/x $authmgr_decryptSelfBlock_call_mailbox = kdata_base - 0x8a5019\n\np/x $authmgr_decryptMultipleSelfBlocks_call_mailbox = kdata_base - 0x8a4891\n\np/x $sceSblPfsClearKey_call_mailbox_1 = kdata_base - 0x94ada9\np/x $sceSblPfsClearKey_call_mailbox_2 = kdata_base - 0x94ad33\n\np/x $sceSblPfsSetKeys = kdata_base - 0x94aaa0\np/x $verifySuperBlock_call_mailbox = kdata_base - 0x94a7f5\np/x $pfsunknown1_call_mailbox = kdata_base - 0x94a74f\np/x $pfsunknown2_call_mailbox = kdata_base - 0x94a71b\np/x $unloadPfsmgrSecureModule_call_mailbox = kdata_base - 0x229b7b\np/x $registerMountKey = kdata_base - 0x8173c0\np/x $registerMountKey_caller = kdata_base - 0x94b150\np/x $registerMountKey_call_site = kdata_base - 0x94b0e3\np/x $sceSblServiceCryptAsync = kdata_base - 0x8ed940\np/x $sceSblPfsClearKey = kdata_base - 0x229c80\n\np/x $crypt_request_start = kdata_base - 0x479e20\np/x $crypt_message_resolve = kdata_base - 0x479d60\np/x $crypt_get_algo_singleton = kdata_base - 0x410830\np/x $crypt_singleton_array = kdata_base + 0x2e31830\np/x $sceSblServiceCryptAsync_deref_singleton = kdata_base - 0x8ed902\n\n# reset-related shit\np/x $vnlru_proc = kdata_base - 0x96bef0\np/x $kproc_shutdown = kdata_base - 0x96ad58\np/x $s_shutdown_pre_sync = kdata_base + 0x3dd917\np/x $s_shutdown_final = kdata_base + 0x322db7\np/x $s_kproc_shutdown = kdata_base + 0x3b0bdc\np/x $eventhandler_register = kdata_base - 0x525820\np/x $da_delete_trim = kdata_base - 0x96f268\n\n# uxen-related shit\np/x $resumectx = kdata_base - 0x964308\n"
  },
  {
    "path": "prosper0gdb/trace_calls.py",
    "content": "import sys\n\nprev_rip = None\nprev_rsp = None\n\ncall_stack = []\ncall_stack_2 = []\n\noutput = []\n\nwhile True:\n    try: l = input()\n    except EOFError: break\n    if not l:\n        output.append(l)\n        continue\n    regs = {i: int(j, 16) for i, j in (q.split('=') for q in l.replace('  = ', '=').replace(' = ', '=').split())}\n    if prev_rip is None:\n        prev_rip = regs['rip']\n        prev_rsp = regs['rsp']\n        continue\n    if regs['rip'] < prev_rip or regs['rip'] >= prev_rip+16:\n        if regs['rsp'] == prev_rsp - 8:\n            while call_stack and call_stack[-1] <= regs['rsp']:\n                output.append('+ ret')\n                call_stack.pop()\n                q = call_stack_2.pop()\n                output[q] += ' ('+str(len(output)-q)+')'\n            call_stack_2.append(len(output))\n            output.append('+ call')\n            call_stack.append(regs['rsp'])\n        elif regs['rsp'] == prev_rsp + 8:\n            while call_stack and call_stack[-1] <= prev_rsp:\n                output.append('+ ret')\n                call_stack.pop()\n                q = call_stack_2.pop()\n                output[q] += ' ('+str(len(output)-q)+')'\n    prev_rip = regs['rip']\n    prev_rsp = regs['rsp']\n    output.append(l)\n\nfor i in range(len(call_stack)):\n    output.append('+ ret')\n    q = call_stack_2.pop()\n    output[q] += ' ('+str(len(output)-q)+')'\n\nfor i in output:\n    print(i)\n"
  },
  {
    "path": "prosper0gdb/trace_decode.py",
    "content": "import sys, io\n\nif len(sys.argv) >= 3:\n    chksz = int(sys.argv[2])\nelse:\n    chksz = 168\n\nwith open(sys.argv[1], 'rb') as file:\n    while True:\n        for idx, i in zip(range(-(chksz//8), 0), ('rip', 'cs', 'eflags', 'rsp', 'ss', 'rax', 'rcx', 'rdx', 'rbx', '---', 'rbp', 'rsi', 'rdi', 'r8 ', 'r9 ', 'r10', 'r11', 'r12', 'r13', 'r14', 'r15')):\n            q = file.read(8)\n            if not q: break\n            if i == '---': continue\n            print(i, '=', q[::-1].hex(), end=('\\n' if idx == -1 else ' '))\n        else:\n            print()\n            continue\n        break\n"
  },
  {
    "path": "prosper0gdb/trace_strings.py",
    "content": "import sys\n\nwith open(sys.argv[1], 'rb') as file:\n    kdata = file.read()\n\nkdata_base = int(sys.argv[2], 16)\n\nwhile True:\n    l = input().split(' ')\n    i = 0\n    while i + 1 < len(l):\n        if l[i] == '=' and len(l[i+1]) == 16:\n            try: addr = int(l[i+1], 16)\n            except ValueError:\n                i += 1\n                continue\n            if addr in range(kdata_base, kdata_base+len(kdata)):\n                ss = kdata[addr-kdata_base:kdata.find(b'\\0', addr-kdata_base)]\n                l.insert(i+2, '(%r)'%ss)\n        i += 1\n    print(*l)\n"
  },
  {
    "path": "prosper0gdb/tracefold.py",
    "content": "import html\n\nprint(end='''\\\n<style>\ninput {\n    display: none;\n}\n\ninput + label:before {\n    content: \"+ call\";\n    color: blue;\n}\n\ninput:checked + label:before {\n    content: \"- call\";\n    color: blue;\n}\n\ninput + label + div {\n    display: none;\n}\n\ninput:checked + label + div {\n    display: block;\n    padding-left: 5px;\n    border-left: 1px solid black;\n}\n</style><pre>''')\n\nidx = 0\n\nwhile True:\n    l = input()\n    if l.startswith('+ call'):\n        print(end='<input type=checkbox id=ck%d /><label for=ck%d>%s</label><div>'%(idx, idx, l[6:]))\n        idx += 1\n    elif (l+' ').startswith('+ ret '):\n        print('+ ret</div>')\n    else:\n        print(html.escape(l))\n"
  },
  {
    "path": "ps5-kstuff/8cc-kekcalls.c",
    "content": "#include <printf/printf.h>\n#include <ps4/errno.h>\n#include <sys/socket.h>\n#include <sys/types.h>\n#include <sys/ioctl.h>\n#include <sys/filio.h>\n#include <unistd.h>\n#include <time.h>\n\nuint64_t __builtin_gadget_addr(const char*);\n\nint kekcall(uint64_t a, uint64_t b, uint64_t c, uint64_t d, uint64_t e, uint64_t f, uint64_t g)\n{\n    uint64_t rop[40] = {\n        __builtin_gadget_addr(\"mov rax, [rdi]\"),\n        __builtin_gadget_addr(\"pop rcx\"),\n        (uint64_t)(rop+39),\n        __builtin_gadget_addr(\"mov [rcx], rax\"),\n        __builtin_gadget_addr(\"pop rsi\"),\n        8,\n        __builtin_gadget_addr(\"add rdi, rsi\"),\n        __builtin_gadget_addr(\"pop rcx\"),\n        (uint64_t)(rop+35),\n        __builtin_gadget_addr(\"mov [rcx], rdi\"),\n        __builtin_gadget_addr(\"mov rax, r8\"),\n        __builtin_gadget_addr(\"pop rcx\"),\n        (uint64_t)(rop+37),\n        __builtin_gadget_addr(\"mov [rcx], rax\"),\n        __builtin_gadget_addr(\"pop rdi\"),\n        a,\n        __builtin_gadget_addr(\"pop rsi\"),\n        b,\n        __builtin_gadget_addr(\"pop rdx\"),\n        c,\n        __builtin_gadget_addr(\"pop rcx\"),\n        d,\n        __builtin_gadget_addr(\"pop r8\"),\n        e,\n        __builtin_gadget_addr(\"pop r9\"),\n        f,\n        __builtin_gadget_addr(\"pop rax\"),\n        g,\n        __builtin_gadget_addr(\"$getppid_addr + 7\"),\n        __builtin_gadget_addr(\"pop rcx\"),\n        (uint64_t)(rop+33),\n        __builtin_gadget_addr(\"mov [rcx], rax\"),\n        __builtin_gadget_addr(\"pop rcx\"),\n        0,\n        __builtin_gadget_addr(\"pop rdi\"),\n        0,\n        __builtin_gadget_addr(\"pop r8\"),\n        0,\n        __builtin_gadget_addr(\"pop rsp\"),\n        0,\n    };\n    return ((uint64_t(*)(void))rop)();\n}\n\n#define KEKCALL_GETPPID  __builtin_gadget_addr(\"dq 0x000000027\")\n#define KEKCALL_READ_DR  __builtin_gadget_addr(\"dq 0x100000027\")\n#define KEKCALL_WRITE_DR __builtin_gadget_addr(\"dq 0x200000027\")\n\nint main(void)\n{\n    printf(\"%d\\n\", kekcall(0, 0, 0, 0, 0, 0, KEKCALL_GETPPID));\n    uint64_t dr[6] = {0};\n    printf(\"%d\\n\", kekcall((uint64_t)dr, 0, 0, 0, 0, 0, KEKCALL_READ_DR));\n    printf(\"%p %p %p %p %p %p\\n\", dr[0], dr[1], dr[2], dr[3], dr[4], dr[5]);\n    dr[0] = 0x41414141;\n    dr[1] = 0x42424242;\n    dr[2] = 0x43434343;\n    dr[3] = 0x44444444;\n    dr[4] |= 3;\n    dr[5] = 0x401;\n    printf(\"%d\\n\", kekcall((uint64_t)dr, 0, 0, 0, 0, 0, KEKCALL_WRITE_DR));\n    printf(\"%d\\n\", kekcall((uint64_t)dr, 0, 0, 0, 0, 0, KEKCALL_READ_DR));\n    printf(\"%p %p %p %p %p %p\\n\", dr[0], dr[1], dr[2], dr[3], dr[4], dr[5]);\n    for(int i = 0; i < 10; i++)\n    {\n        nanosleep(&(const struct timespec){1, 0}, 0);\n        printf(\"%d\\n\", kekcall((uint64_t)dr, 0, 0, 0, 0, 0, KEKCALL_READ_DR));\n        printf(\"%p %p %p %p %p %p\\n\", dr[0], dr[1], dr[2], dr[3], dr[4], dr[5]);\n    }\n    /*int sock = socket(AF_UNIX, SOCK_DGRAM, 0);\n    int q = 0;\n    printf(\"%d\", ioctl(sock, 0x40045145, &q));\n    printf(\" %d %d\\n\", errno, q);\n    q = 1;\n    printf(\"%d\", ioctl(sock, FIONBIO, &q));\n    printf(\" %d %d\\n\", errno, q);\n    printf(\"%d\", ioctl(0, 0x40045145, &q));\n    printf(\" %d %d\\n\", errno, q);*/\n    printf(\"%d\\n\", kekcall((uint64_t)dr, 0, 0, 0, 0, 0, KEKCALL_READ_DR));\n    printf(\"%p %p %p %p %p %p\\n\", dr[0], dr[1], dr[2], dr[3], dr[4], dr[5]);\n    return 0;\n}\n"
  },
  {
    "path": "ps5-kstuff/Makefile",
    "content": "all: payload.bin payload-gdb.bin\n\nclean:\n\trm -f payload.elf payload.bin payload-gdb.elf payload-gdb.bin freebsd-loader kelf kelf.o structs.h structs.inc uelf/uelf uelf/uelf.bin uelf/crt.o\n\n../lib/lib-elf-ps5.a:\n\tcd ../lib; make\n\n../prosper0gdb/prosper0gdb.o:\n\tcd ../prosper0gdb; make\n\nstructs.inc: structs-ps5.inc\n\tcp structs-ps5.inc structs.inc\n\npayload.elf: ../lib/lib-elf-ps5.a ../prosper0gdb/prosper0gdb.o main.c sqlite_triggers.c kelf uelf/uelf.bin\n\tgcc -O0 -isystem ../freebsd-headers -nostdinc -nostdlib -fno-stack-protector -static ../lib/lib-elf-ps5.a ../prosper0gdb/prosper0gdb.o $(EXTRA_CFLAGS) main.c -DPS5KEK ../prosper0gdb/dbg.c sqlite_triggers.c -Wl,-gc-sections -o payload.elf -fPIE -ffreestanding -no-pie -Wl,-z,max-page-size=16384 -Wl,-zcommon-page-size=16384\n\npayload-gdb.elf: ../lib/lib-elf-ps5.a ../prosper0gdb/prosper0gdb.o main.c sqlite_triggers.c utils.c kelf uelf/uelf\n\tgcc -O0 -g -isystem ../freebsd-headers -nostdinc -nostdlib -fno-stack-protector -static ../lib/lib-elf-ps5.a ../prosper0gdb/prosper0gdb.o $(EXTRA_CFLAGS) -DDEBUG main.c -DPS5KEK ../prosper0gdb/dbg.c sqlite_triggers.c utils.c -o payload-gdb.elf -fPIE -ffreestanding -no-pie -Wl,-z,max-page-size=16384 -Wl,-zcommon-page-size=16384\n\npayloa%.bin: payloa%.elf\n\tobjcopy $< --only-section .text --only-section .data --only-section .bss --only-section .rodata -O binary $@\n\tpython3 ../lib/frankenelf.py $@\n\nkelf.o: kelf.asm structs.inc\n\tyasm -f elf64 -g dwarf2 kelf.asm -o kelf.o\n\nkelf: kelf.o\n\tgcc -nostdlib -shared kelf.o -o kelf\n\nstructs.h: structs.inc\n\tsed 's/^%/#/' structs.inc > structs.h\n\nuelf/crt.o: uelf/crt.asm\n\tyasm uelf/crt.asm -f elf64 -o uelf/crt.o\n\nuelf/uelf: uelf/*.c uelf/*.h structs.h uelf/crt.o BearSSL/build/libbearssl.a libtomcrypt/libtomcrypt.a\n\tgcc -Wl,-Bsymbolic -Wl,-gc-sections -ffunction-sections -fdata-sections -O3 -g -isystem ../freebsd-headers -nostdinc -nostdlib -mgeneral-regs-only -fno-stack-protector -fPIE -fPIC -shared -fvisibility=hidden -ffreestanding uelf/crt.o $(EXTRA_CFLAGS) uelf/*.c -L BearSSL/build -lbearssl -L libtomcrypt -ltomcrypt -o uelf/uelf -Wl,-z,max-page-size=4096\n\nuelf/uelf.bin: uelf/uelf\n\tobjcopy --strip-all $< $@\n\nBearSSL/build/libbearssl.a: build_bearssl.sh overrides.h\n\tbash build_bearssl.sh\n\nlibtomcrypt/libtomcrypt.a: build_libtomcrypt.sh overrides.h\n\tbash build_libtomcrypt.sh"
  },
  {
    "path": "ps5-kstuff/Makefile.freebsd",
    "content": "all: freebsd-loader\n\nclean:\n\trm -f payload.elf payload.bin payload-gdb.elf payload-gdb.bin freebsd-loader kelf kelf.o structs.h structs.inc uelf/uelf uelf/uelf.bin uelf/crt.o\n\nstructs.inc: structs-freebsd.inc\n\tcp structs-freebsd.inc structs.inc\n\nkelf.o: kelf.asm structs.inc\n\tyasm -f elf64 -g dwarf2 kelf.asm -o kelf.o\n\nkelf: kelf.o\n\tgcc -nostdlib -shared kelf.o -x c /dev/null -o kelf\n\nstructs.h: structs.inc\n\tsed 's/^%/#/' structs.inc > structs.h\n\nuelf/crt.o: uelf/crt.asm\n\tyasm uelf/crt.asm -f elf64 -o uelf/crt.o\n\nuelf/uelf: uelf/*.c uelf/*.h structs.h uelf/crt.o\n\tgcc -Wl,-zmax-page-size=4096 -Wl,-Bsymbolic -Wl,--gc-sections -ffunction-sections -fdata-sections -O0 -g -DFREEBSD -std=gnu11 -nostdlib -fno-stack-protector -fPIE -fPIC -shared -fvisibility=hidden -ffreestanding -fno-builtin uelf/crt.o uelf/*.c -o uelf/uelf\n\nfreebsd-loader: uelf/uelf kelf freebsd-loader.c\n\tgcc -O0 -g -std=gnu11 freebsd-loader.c -mno-red-zone -o freebsd-loader\n"
  },
  {
    "path": "ps5-kstuff/build_bearssl.sh",
    "content": "cd BearSSL\nx86intrin_path=\"$(dirname \"$(gcc -E -x c - <<< '#include <x86intrin.h>' | grep '/x86intrin\\.h\"' | head -1 | cut -d '\"' -f 2-2)\")\"\nfor i in clean \"lib -j$(nproc)\"; do make CC='gcc -nostdlib -nostdinc -isystem /proc/'$$'/cwd/../../freebsd-headers -isystem '\"'${x86intrin_path//\"'\"/\"'\"'\"'\"'\"'\"'\"'\"}'\"' -O3 -march=znver2 -g -ffreestanding -ffunction-sections -fdata-sections -fvisibility=hidden -include /proc/'$$'/cwd/../overrides.h' $i; done\n"
  },
  {
    "path": "ps5-kstuff/build_libtomcrypt.sh",
    "content": "cd libtomcrypt\nx86intrin_path=\"$(dirname \"$(gcc -E -x c - <<< '#include <x86intrin.h>' | grep '/x86intrin\\.h\"' | head -1 | cut -d '\"' -f 2-2)\")\"\nfor i in clean -j$(nproc); do make CC='gcc -nostdlib -nostdinc -isystem /proc/'$$'/cwd/../../freebsd-headers  -isystem '\"'${x86intrin_path//\"'\"/\"'\"'\"'\"'\"'\"'\"'\"}'\"' -O3 -march=znver2 -g -ffreestanding -ffunction-sections -fdata-sections -fPIE -fPIC -fvisibility=hidden -include /proc/'$$'/cwd/../overrides.h' $i; done\n"
  },
  {
    "path": "ps5-kstuff/freebsd-loader.c",
    "content": "#define _BSD_SOURCE\n#include <sys/types.h>\n#include <sys/syscall.h>\n#include <stdarg.h>\n#include <unistd.h>\n#include <string.h>\n#include <sys/mman.h>\n#include \"uelf/parasite_desc.h\"\n\nvoid kkfncall(void* td, uintptr_t** uap)\n{\n    uap[1][0] = ((uintptr_t(*)())uap[1][0])(uap[1][1], uap[1][2], uap[1][3], uap[1][4], uap[1][5], uap[1][6], uap[1][7]);\n}\n\nuintptr_t kfncall(uintptr_t fn, ...)\n{\n    uintptr_t args[7] = {fn};\n    va_list va;\n    va_start(va, fn);\n    for(int i = 0; i < 6; i++)\n        args[i+1] = va_arg(va, uintptr_t);\n    va_end(va);\n    syscall(11, kkfncall, args);\n    return args[0];\n}\n\nvoid kmemcpy(void* dst, const void* src, size_t sz)\n{\n    kfncall(0xffffffff80f9e760, (uintptr_t)dst, (uintptr_t)src, (uintptr_t)sz);\n}\n\nvoid kpoke64(void* dst, uint64_t value)\n{\n    kmemcpy(dst, &value, 8);\n}\n\nvoid kmemzero(void* dst, size_t sz)\n{\n    kfncall(0xffffffff810c4b40, (uintptr_t)dst, 0, sz);\n}\n\nvoid copyout(void* dst, uintptr_t src, size_t sz)\n{\n    kfncall(0xffffffff80f9e800, src, (uintptr_t)dst, sz);\n}\n\nvoid copyin(uintptr_t dst, const void* src, size_t sz)\n{\n    kfncall(0xffffffff80f9e880, (uintptr_t)src, dst, sz);\n}\n\nvoid* kmalloc(size_t sz)\n{\n    return (void*)kfncall(0xffffffff80aaf760, sz, 0xffffffff819b3e90, 2);\n}\n\nvoid krcr3(void* td, uint64_t** uap)\n{\n    asm volatile(\"mov %%cr3, %0\":\"=r\"(uap[1][0]));\n}\n\nuint64_t r0gdb_read_cr3(void)\n{\n    uint64_t cr3;\n    syscall(11, krcr3, &cr3);\n    return cr3;\n}\n\n#define NCPUS 16\n#define IDT 0xffffffff81d7d540\n#define GDT(i) (0xffffffff81e2a7d0+0x68*(i))\n#define TSS(i) (0xffffffff81e23f90+0x68*(i))\n#define PCPU(i) (0xffffffff81e31080+0x400*(i))\n\nsize_t virt2file(uint64_t* phdr, uint16_t phnum, uintptr_t addr)\n{\n    for(size_t i = 0; i < phnum; i++)\n    {\n        uint64_t* h = phdr + 7*i;\n        if((uint32_t)h[0] != 1)\n            continue;\n        if(h[2] <= addr && h[2] + h[4] > addr)\n            return addr + h[1] - h[2];\n    }\n    return -1;\n}\n\nvoid* load_kelf(void* ehdr, const char** symbols, uint64_t* values, void** base, void** entry, uint64_t mapped_kptr)\n{\n    uint64_t* phdr = (void*)((char*)ehdr + *(uint64_t*)((char*)ehdr + 32));\n    uint16_t phnum = *(uint16_t*)((char*)ehdr + 56);\n    uint64_t* dynamic = 0;\n    size_t sz_dynamic = 0;\n    uint64_t kernel_size = 0;\n    for(size_t i = 0; i < phnum; i++)\n    {\n        uint64_t* h = phdr + 7*i;\n        if((uint32_t)h[0] == 2)\n        {\n            dynamic = (void*)((char*)ehdr + h[1]);\n            sz_dynamic = h[4];\n        }\n        else if((uint32_t)h[0] == 1)\n        {\n            uint64_t limit = h[2] + h[5];\n            if(limit > kernel_size)\n                kernel_size = limit;\n        }\n    }\n    kernel_size = ((kernel_size + 4095) | 4095) - 4095;\n    char* kptr = kmalloc(kernel_size+4096);\n    kptr = (char*)((((uint64_t)kptr - 1) | 4095) + 1);\n    if(!mapped_kptr)\n        mapped_kptr = (uint64_t)kptr;\n    base[0] = kptr;\n    base[1] = kptr + kernel_size;\n    for(size_t i = 0; i < phnum; i++)\n    {\n        uint64_t* h = phdr + 7*i;\n        if((uint32_t)h[0] != 1)\n            continue;\n        kmemcpy(kptr+h[2], (char*)ehdr + h[1], h[4]);\n        kmemzero(kptr+h[2]+h[4], h[5]-h[4]);\n    }\n    char* strtab = 0;\n    uint64_t* symtab = 0;\n    uint64_t* rela = 0;\n    size_t relasz = 0;\n    for(size_t i = 0; i < sz_dynamic / 16; i++)\n    {\n        uint64_t* kv = dynamic + 2*i;\n        if(kv[0] == 5)\n            strtab = (char*)ehdr + virt2file(phdr, phnum, kv[1]);\n        else if(kv[0] == 6)\n            symtab = (void*)((char*)ehdr + virt2file(phdr, phnum, kv[1]));\n        else if(kv[0] == 7)\n            rela = (void*)((char*)ehdr + virt2file(phdr, phnum, kv[1]));\n        else if(kv[0] == 8)\n            relasz = kv[1];\n    }\n    for(size_t i = 0; i < relasz / 24; i++)\n    {\n        uint64_t* oia = rela + 3*i;\n        if((uint32_t)oia[1] == 1 || (uint32_t)oia[1] == 6)\n        {\n            uint64_t* sym = symtab + 3 * (oia[1] >> 32);\n            const char* name = strtab + (uint32_t)sym[0];\n            uint64_t value = sym[1];\n            if(!value)\n            {\n                for(size_t i = 0; symbols[i]; i++)\n                    if(!strcmp(symbols[i], name))\n                        sym[1] = value = values[i];\n                    else if(symbols[i][0] == '.' && !strcmp(symbols[i]+1, name))\n                        value = values[i];\n                if(!value)\n                    asm volatile(\"ud2\");\n            }\n            if((uint32_t)oia[1] == 6 && oia[2])\n                asm volatile(\"ud2\");\n            kpoke64(kptr+oia[0], oia[2]+value);\n        }\n        else if((uint32_t)oia[1] == 8)\n            kpoke64(kptr+oia[0], (uint64_t)(mapped_kptr+oia[2]));\n        else\n            asm volatile(\"ud2\");\n    }\n    *entry = kptr + *(uint64_t*)((char*)ehdr + 24);\n    return kptr;\n}\n\nasm(\".section .data\\nkek:\\n.incbin \\\"kelf\\\"\\nkek_end:\");\nextern char kek[];\nextern char kek_end[];\n\nasm(\".section .data\\nuek:\\n.incbin \\\"uelf/uelf\\\"\\nuek_end:\");\nextern char uek[];\nextern char uek_end[];\n\nasm(\".section .text\\nkekcall:\\nmov 8(%rsp), %rax\\njmp *p_kekcall(%rip)\");\n\nint kekcall(uint64_t a, uint64_t b, uint64_t c, uint64_t d, uint64_t e, uint64_t f, uint64_t nr);\n\n#define KEKCALL_GETPPID  0x000000027\n#define KEKCALL_READ_DR  0x100000027\n#define KEKCALL_WRITE_DR 0x200000027\n\nvoid* p_kekcall;\nvoid* dlsym(void*, const char*);\n\nvoid* malloc(size_t sz)\n{\n    return mmap(0, sz, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANON, -1, 0);\n}\n\nuint64_t get_dmap_base(void)\n{\n    uint64_t ptrs[2];\n    copyout(ptrs, 0xffffffff81e71920, sizeof(ptrs));\n    return ptrs[0] - ptrs[1];\n}\n\nuint64_t virt2phys(uintptr_t addr)\n{\n    uint64_t dmap = get_dmap_base();\n    uint64_t pml = r0gdb_read_cr3();\n    for(int i = 39; i >= 12; i -= 9)\n    {\n        uint64_t inner_pml;\n        copyout(&inner_pml, dmap+pml+((addr & (0x1ffull << i)) >> (i - 3)), 8);\n        if(!(inner_pml & 1)) //not present\n            return -1;\n        if((inner_pml & 128) || i == 12) //hugepage\n        {\n            inner_pml &= (1ull << 52) - (1ull << i);\n            inner_pml |= addr & ((1ull << i) - 1);\n            return inner_pml;\n        }\n        inner_pml &= (1ull << 52) - (1ull << 12);\n        pml = inner_pml;\n    }\n    //unreachable\n}\n\nvoid build_uelf_cr3(uint64_t uelf_cr3, void* uelf_base[2])\n{\n    static char zeros[4096];\n    uint64_t dmap = get_dmap_base();\n    uint64_t cr3 = r0gdb_read_cr3();\n    uint64_t user_start = (uint64_t)uelf_base[0];\n    uint64_t user_end = (uint64_t)uelf_base[1];\n    if(user_end - user_start > 0x200000)\n        asm volatile(\"ud2\");\n    uint64_t pml4_virt = uelf_cr3;\n    copyin(pml4_virt, zeros, 4096);\n    kmemcpy((void*)(pml4_virt+2048), (void*)(dmap+cr3+2048), 2048);\n    uint64_t pml3_virt = uelf_cr3 + 4096;\n    uint64_t pml3_dmap = uelf_cr3 + 16384; //user-accessible direct mapping of physical memory\n    copyin(pml4_virt, &(uint64_t[2]){virt2phys(pml3_virt) | 7, virt2phys(pml3_dmap) | 7}, 16);\n    copyin(pml3_virt, zeros, 4096);\n    uint64_t pml2_virt = uelf_cr3 + 8192;\n    copyin(pml3_virt, &(uint64_t[1]){virt2phys(pml2_virt) | 7}, 8);\n    copyin(pml2_virt, zeros, 4096);\n    uint64_t pml1_virt = uelf_cr3 + 12288;\n    copyin(pml2_virt+16, &(uint64_t[1]){virt2phys(pml1_virt) | 7}, 8);\n    copyin(pml1_virt, zeros, 4096);\n    for(uint64_t i = 0; i * 4096 + user_start < user_end; i++)\n        copyin(pml1_virt+8*i, &(uint64_t[1]){virt2phys(i*4096+user_start) | 7}, 8);\n    for(uint64_t i = 0; i < 512; i++)\n        copyin(pml3_dmap+8*i, &(uint64_t[1]){(i<<30) | 135}, 8);\n}\n\nstatic struct PARASITES(0) parasites_freebsd = {\n    .lim_syscall = 0,\n    .lim_fself = 0,\n    .lim_total = 0,\n    .parasites = {},\n};\n\nint main()\n{\n    mlock(kek, kek_end-kek);\n    mlock(uek, uek_end-uek);\n    uint64_t int1_handler;\n    copyout(&int1_handler, IDT+16*1, 2);\n    copyout((char*)&int1_handler + 2, IDT+16*1+6, 6);\n    uint64_t int13_handler;\n    copyout(&int13_handler, IDT+16*13, 2);\n    copyout((char*)&int13_handler + 2, IDT+16*13+6, 6);\n    void* parasites = kmalloc(sizeof(parasites_freebsd));\n    kmemcpy(parasites, &parasites_freebsd, sizeof(parasites_freebsd));\n    uint64_t parasites_phys = virt2phys((uint64_t)parasites);\n    uint64_t parasites_dmem = (1ull<<39) + parasites_phys;\n    const char* symbols[] = {\n        \"add_rsp_iret\",\n        \"copyin\",\n        \"copyout\",\n        \"dmem\",\n        \"doreti_iret\",\n        \"dr2gpr_start\",\n        \"gpr2dr_1_start\",\n        \"gpr2dr_2_start\",\n        \"int1_handler\",\n        \"int13_handler\",\n        \".ist_errc\",\n        \".ist_noerrc\",\n        \"justreturn\",\n        \"justreturn_pop\",\n        \"mov_cr3_rax\",\n        \"mov_rdi_cr3\",\n        \"nop_ret\",\n        \"parasites\",\n        \".pcpu\",\n        \"pop_all_iret\",\n        \"push_pop_all_iret\",\n        \"rdmsr_start\",\n        \"rep_movsb_pop_rbp_ret\",\n        \"swapgs_add_rsp_iret\",\n        \"syscall_after\",\n        \"syscall_before\",\n        \"sysents\",\n        \".tss\",\n        \".uelf_cr3\",\n        \".uelf_entry\",\n        \"wrmsr_ret\",\n        0,\n    };\n    uint64_t values[] = {\n        0xffffffff80f8568d, // add_rsp_iret\n        0xffffffff80f9e880, // copyin\n        0xffffffff80f9e800, // copyout\n        1ull << 39,         // dmem\n        0xffffffff80f85695, // doreti_iret\n        0xffffffff80f837a8, // dr2gpr_start\n        0xffffffff80f8381e, // gpr2dr_1_start\n        0xffffffff802ffeba, // gpr2dr_2_start\n        int1_handler,       // int1_handler\n        int13_handler,      // int13_handler\n        0x1237,             // .ist_errc\n        0x1238,             // .ist_noerrc\n        0xffffffff80f85550, // justreturn\n        0xffffffff80f85558, // justreturn_pop\n        0xffffffff80f82d87, // mov_cr3_rax\n        0xffffffff80cc27ed, // mov_rdi_cr3\n        0xffffffff802ff132, // nop_ret\n        parasites_dmem,     // parasites\n        0x1234,             // .pcpu\n        0xffffffff80f85636, // pop_all_iret\n        0xffffffff80f84f80, // push_pop_all_iret\n        0xffffffff80f81f53, // rdmsr_start\n        0xffffffff80f9e779, // rep_movsb_pop_rbp_ret\n        0xffffffff80f8568b, // swapgs_add_rsp_iret\n        0xffffffff80fa168e, // syscall_after\n        0xffffffff80fa168b, // syscall_before\n        0xffffffff819a7840, // sysents\n        0x123a,             // .tss\n        0x1235,             // .uelf_cr3\n        0x1236,             // .uelf_entry\n        0xffffffff80f84756, // wrmsr_ret\n        0,\n    };\n    size_t pcpu_idx, uelf_cr3_idx, uelf_entry_idx, ist_errc_idx, ist_noerrc_idx, tss_idx;\n    for(size_t i = 0; values[i]; i++)\n        switch(values[i])\n        {\n        case 0x1234: pcpu_idx = i; break;\n        case 0x1235: uelf_cr3_idx = i; break;\n        case 0x1236: uelf_entry_idx = i; break;\n        case 0x1237: ist_errc_idx = i; break;\n        case 0x1238: ist_noerrc_idx = i; break;\n        case 0x123a: tss_idx = i; break;\n        }\n    uint64_t uelf_bases[NCPUS];\n    uint64_t kelf_bases[NCPUS];\n    uint64_t kelf_entries[NCPUS];\n    for(int cpu = 0; cpu < NCPUS; cpu++)\n    {\n        values[pcpu_idx] = PCPU(cpu);\n        values[uelf_cr3_idx] = 0;\n        values[uelf_entry_idx] = 0;\n        values[ist_errc_idx] = TSS(cpu)+28+3*8;\n        values[ist_noerrc_idx] = TSS(cpu)+28+7*8;\n        values[tss_idx] = TSS(cpu);\n        void* uelf_entry = 0;\n        void* uelf_base[2] = {0};\n        char* uelf = load_kelf(uek, symbols, values, uelf_base, &uelf_entry, 0x400000);\n        uintptr_t uelf_cr3 = (uintptr_t)kmalloc(24576);\n        uelf_cr3 = ((uelf_cr3 + 4095) | 4095) - 4095;\n        values[uelf_cr3_idx] = virt2phys(uelf_cr3);\n        values[uelf_entry_idx] = (uintptr_t)uelf_entry - (uintptr_t)uelf_base[0] + 0x400000;\n        void* entry = 0;\n        void* base[2] = {0};\n        char* kelf = load_kelf(kek, symbols, values, base, &entry, 0);\n        build_uelf_cr3(uelf_cr3, uelf_base);\n        uelf_bases[cpu] = (uintptr_t)uelf;\n        kelf_bases[cpu] = (uint64_t)kelf;\n        kelf_entries[cpu] = (uint64_t)entry;\n    }\n    uint64_t cr3 = r0gdb_read_cr3();\n    for(int cpu = 0; cpu < NCPUS; cpu++)\n    {\n        uint64_t entry = kelf_entries[cpu];\n        kmemcpy((char*)IDT+16*13, (char*)entry, 2);\n        kmemcpy((char*)IDT+16*13+6, (char*)entry+2, 6);\n        kmemcpy((char*)IDT+16*13+4, \"\\x03\", 1);\n        kmemcpy((char*)IDT+16*0x7c, (char*)entry+16, 2);\n        kmemcpy((char*)IDT+16*0x7c+6, (char*)entry+18, 6);\n        kmemcpy((char*)IDT+16*0x7c+4, \"\\x07\\xee\", 2);\n        kmemcpy((char*)IDT+16*1, (char*)entry+16, 2);\n        kmemcpy((char*)IDT+16*1+6, (char*)entry+18, 6);\n        kmemcpy((char*)IDT+16*1+4, \"\\x07\", 1);\n        kmemcpy((char*)TSS(cpu)+28+3*8, (char*)entry+8, 8);\n        kmemcpy((char*)TSS(cpu)+28+7*8, (char*)entry+24, 8);\n    }\n    //kmemzero((char*)IDT+16*1, 16);\n    uint64_t iret = 0xffffffff80f85695;\n    kmemcpy((char*)(IDT+16*2), (char*)&iret, 2);\n    kmemcpy((char*)(IDT+16*2+6), (char*)&iret+2, 6);\n    return 0;\n}\n"
  },
  {
    "path": "ps5-kstuff/import_parasites.py",
    "content": "import json, sys\n\nsymbols = json.load(open(sys.argv[1]))\n\na = symbols.get('syscall_parasites', [])\nb = symbols.get('fself_parasites', [])\nc = symbols.get('unsorted_parasites', [])\n\nprint('static struct PARASITES(%d) parasites_### = {'%(len(a)+len(b)+len(c)))\nprint('    .lim_syscall = %d,'%len(a))\nprint('    .lim_fself = %d,'%(len(a)+len(b)))\nprint('    .lim_total = %d,'%(len(a)+len(b)+len(c)))\n\ndef out(x):\n    for i in x:\n        print('        {%s, %s},'%(hex(i[0]), ['RAX', 'RCX', 'RDX', 'RBX', 'RSP', 'RBP', 'RSI', 'RDI', 'R8', 'R9', 'R10', 'R11', 'R12', 'R13', 'R14', 'R15'][i[1]]))\n\nprint('    .parasites = {')\nprint('        /* syscall parasites */')\nout(a)\nprint('        /* fself parasites */')\nout(b)\nprint('        /* unsorted parasites */')\nout(c)\nprint('    }')\nprint('};')\n\nprint('static struct shellcore_patch shellcore_patches_###[] = {')\nfor i, j in symbols['shellcore_offsets']:\n    print('    {%s, \"%s\", %d},'%(hex(i), ''.join(map('\\\\x%02x'.__mod__, bytes.fromhex(j))), len(bytes.fromhex(j))))\nprint('};')\n"
  },
  {
    "path": "ps5-kstuff/kekcalls.txt",
    "content": "kekcall ABI\n\nThe recommended entrypoint is the syscall instruction at `getppid+0x0a` in libkernel, although in practice any syscall instruction in libkernel can be used.\n\nCalls:\n* rax = 0x000000027 -> real getppid\n* rax = 0x100000027, rdi = X -> copy dr0-dr3 and dr6-dr7 to user address X\n* rax = 0x200000027, rdi = X -> copy dr0-dr3 and dr6-dr7 from user address X\n* rax = 0x300000027, rdi = X -> returns rdmsr(X)\n* rax = 0x500000027, rdi = pid, rsi = syscno, rdx = X -> call syscall in foreign process, with args read from user address X\n* rax = 0xb00000027, rdi = address, rsi = size, rdx = entry offset -> load a bare-metal payload to be run on shutdown\n** memory map:\n**  0000000000000000-0000008000000000  cached mapping of physical ram\n**  0000008000000000-0000010000000000  uncached mapping of physical ram\n**  0000010000000000-...               payload itself (not necessarily physically contigous)\n**  ffff800000000000-ffffffffffffffff  BSD kernel mappings (untouched)\n** all 16 cores (APIC ids 0-15) start in x86_64 ring3 with EFLAGS=2 (interrupts disabled, IOPL=0)\n** on startup, rdi=cr3, other general-purpose registers are zeroed\n"
  },
  {
    "path": "ps5-kstuff/kelf.asm",
    "content": "use64\n\n%include \"structs.inc\"\n\nextern add_rsp_iret\nextern doreti_iret\nextern justreturn\nextern justreturn_pop\nextern wrmsr_ret\nextern pcpu\nextern mov_rax_cr3\nextern mov_cr3_rax_mov_ds\nextern nop_ret\nextern pop_all_iret\nextern push_pop_all_iret\nextern rep_movsb_pop_rbp_ret\nextern uelf_cr3\nextern uelf_entry\nextern ist_errc\nextern ist_noerrc\nextern parasites_kmem\nextern comparison_table\n\nglobal _start\n\n; memcpy dst, src, size\n%macro memcpy 3\ndq pop_all_iret\n; set arguments\ntimes iret_rdi db 0\ndq (%1)\ntimes iret_rsi-iret_rdi-8 db 0\ndq (%2)\ntimes iret_rcx-iret_rsi-8 db 0\ndq (%3)\ntimes iret_rip-iret_rcx-8 db 0\ndq rep_movsb_pop_rbp_ret\ndq 0x20\ndq 2\ndq %%stack_after\n%%stack_after:\ndq 0 ; last argument of iret, also popped into rbp\n%endmacro\n\n; pokew where, value\n%macro pokew 2\ndq pop_all_iret\n; set argument\ntimes iret_rdi db 0\ndq (%1)\ntimes iret_rsi-iret_rdi-8 db 0\ndq %%stack_after\ntimes iret_rcx-iret_rsi-8 db 0\ndq 2\ntimes iret_rip-iret_rcx-8 db 0\ndq rep_movsb_pop_rbp_ret\ndq 0x20\ndq 2\ndq %%stack_after\ndq 0\n%%stack_after:\ndq (%2) ; data to be copied, also popped into rbp\n%endmacro\n\n; pokeq where, value\n%macro pokeq 2\ndq pop_all_iret\n; set argument\ntimes iret_rdi db 0\ndq (%1)\ntimes iret_rsi-iret_rdi-8 db 0\ndq %%stack_after\ntimes iret_rcx-iret_rsi-8 db 0\ndq 8\ntimes iret_rip-iret_rcx-8 db 0\ndq rep_movsb_pop_rbp_ret\ndq 0x20\ndq 2\ndq %%stack_after\ndq 0\n%%stack_after:\ndq (%2) ; data to be copied, also popped into rbp\n%endmacro\n\n; cmpb ptr1, ptr2, is_less, is_equal, is_greater\n%macro cmpb 5\nmemcpy %%poke1+iret_rsi+9, (%1), 1\nmemcpy %%poke1+iret_rsi+8, (%2), 1\n%%poke1:\nmemcpy %%poke2+iret_rsi+8, comparison_table, 1\n%%poke2:\nmemcpy %%iret+24, %%jump_table, 8\ndq doreti_iret\n%%iret:\ndq nop_ret\ndq 0x20\ndq 2\ndq 0\ndq 0\nsection .data.qword\nalign 256\n%%jump_table:\ndq (%3)\ndq (%4)\ndq (%5)\nsection .text\n%endmacro\n\n; cmpwbe ptr1, ptr2, is_less, is_equal, is_greater\n%macro cmpwbe 5\ncmpb (%1), (%2), (%3), %%next_check, (%5)\n%%next_check:\ncmpb (%1)+1, (%2)+1, (%3), (%4), (%5)\n%endmacro\n\n; cmpdbe ptr1, ptr2, is_less, is_equal, is_greater\n%macro cmpdbe 5\ncmpwbe (%1), (%2), (%3), %%next_check, (%5)\n%%next_check:\ncmpwbe (%1)+2, (%2)+2, (%3), (%4), (%5)\n%endmacro\n\n; cmpqbe ptr1, ptr2, is_less, is_equal, is_greater\n%macro cmpqbe 5\ncmpdbe (%1), (%2), (%3), %%next_check, (%5)\n%%next_check:\ncmpdbe (%1)+4, (%2)+4, (%3), (%4), (%5)\n%endmacro\n\n; cmpqibe ptr1, imm, is_less, is_equal, is_greater\n%macro cmpqibe 5\ncmpqbe (%1), %%value, (%3), (%4), (%5)\nsection .data.qword\n%%value:\ndq (%2)\nsection .text\n%endmacro\n\n_start:\ndq add_rsp_iret\ndq errc_iret_frame+40\ndq add_rsp_iret\ndq noerrc_iret_frame+40\n\nalign 16\nerrc_iret_errc:\ndq 0\nerrc_iret_frame:\ntimes iret_rip-8 db 0\ndq justreturn\ndq 0x20\ndq 2\ndq errc_justreturn+32\ndq 0\n\ndq 1\nerrc_justreturn:\ntimes 4 dq 0\ndq justreturn_pop\ndq 0x20\ndq 2\ndq errc_wrmsr_gsbase+4\ndq 0\ndd 0\nerrc_wrmsr_gsbase:\ndq pcpu\ndd 0\ndq 0xc0000101\ndq pcpu\ndq wrmsr_ret\ndq 0x20\ndq 2\ndq errc_wrmsr_return\ndq 0\nerrc_wrmsr_return:\ndq doreti_iret\ndq push_pop_all_iret\ndq 0x20\ndq 2\ndq errc_regs_stash+iret_rip\ndq 0\n\ntimes 128 db 0\nerrc_regs_stash:\ntimes iret_rip db 0\ndq nop_ret\ndq 0x20\ndq 2\ndq errc_entry\ndq 0\n\nerrc_entry:\nmemcpy regs_for_exit, errc_regs_stash, iret_rip-8\nmemcpy regs_for_exit+iret_rip-8, errc_iret_frame-8, 48\n; looks like these checks are actually slower than a roundtrip to uelf\n;cmpqbe regs_for_exit+iret_rip, parasites_kmem+16, .next1, .decrypt_rdi_ret, .next1\n;.next1:\n;cmpqbe regs_for_exit+iret_rip, parasites_kmem+32, .next2, .decrypt_rsi_ret, .next2\n;.next2:\n;cmpqbe regs_for_exit+iret_rip, parasites_kmem+48, .slow_path, .decrypt_rsi_ret, .slow_path\n;.slow_path:\nmemcpy justreturn_bak, errc_justreturn-8, 40\ndq doreti_iret\ndq nop_ret\ndq 0x20\ndq 2\ndq main\ndq 0\n;.decrypt_rdi_ret:\n;pokew regs_for_exit+iret_rdi+6, 0xffff\n;dq doreti_iret\n;dq nop_ret\n;dq 0x20\n;dq 2\n;dq .copy_justreturn_and_iret\n;dq 0\n;.decrypt_rsi_ret:\n;pokew regs_for_exit+iret_rsi+6, 0xffff\n;.copy_justreturn_and_iret:\n;memcpy regs_for_exit+iret_rdx, errc_justreturn+8, 8\n;memcpy regs_for_exit+iret_rcx, errc_justreturn+16, 8\n;memcpy regs_for_exit+iret_rax, errc_justreturn+24, 8\n;dq doreti_iret\n;dq pop_all_iret\n;dq 0x20\n;dq 2\n;dq regs_for_exit\n;dq 0\n\nalign 16\ndq 0\nnoerrc_iret_frame:\ntimes iret_rip db 0\ndq justreturn\ndq 0x20\ndq 2\ndq noerrc_justreturn+32\ndq 0\nnoerrc_justreturn:\ntimes 4 dq 0\ndq justreturn_pop\ndq 0x20\ndq 2\ndq noerrc_wrmsr_gsbase+4\ndq 0\ndd 0\nnoerrc_wrmsr_gsbase:\ndq pcpu\ndd 0\ndq 0xc0000101\ndq pcpu\ndq wrmsr_ret\ndq 0x20\ndq 2\ndq noerrc_wrmsr_return\ndq 0\nnoerrc_wrmsr_return:\ndq doreti_iret\ndq push_pop_all_iret\ndq 0x20\ndq 2\ndq noerrc_regs_stash+iret_rip\ndq 0\n\ntimes 128 db 0\nnoerrc_regs_stash:\ntimes iret_rip db 0\ndq nop_ret\ndq 0x20\ndq 2\ndq noerrc_entry\ndq 0\n\nnoerrc_entry:\nmemcpy regs_for_exit, noerrc_regs_stash, iret_rip\nmemcpy regs_for_exit+iret_rip, noerrc_iret_frame, 40\nmemcpy justreturn_bak, noerrc_justreturn-8, 40\ndq doreti_iret\ndq nop_ret\ndq 0x20\ndq 2\ndq main\ndq 0\n\nmain:\npokeq ist_noerrc, ist_after_read_cr3\ndq doreti_iret\ndq mov_rax_cr3\ndq 0x20\ndq 0x102\ndq 0\ndq 0\n\nalign 16\ndq 0\niret_frame_after_read_cr3:\ntimes 5 dq 0\nist_after_read_cr3:\ntimes iret_rip-(ist_after_read_cr3-iret_frame_after_read_cr3) db 0\ndq push_pop_all_iret\ndq 0x20\ndq 2\ndq regs_stash_for_read_cr3+iret_rip\ndq 0\n\ntimes 128 db 0\nregs_stash_for_read_cr3:\ntimes iret_rip db 0\ndq nop_ret\ndq 0x20\ndq 2\ndq after_read_cr3\ndq 0\n\nafter_read_cr3:\nmemcpy restore_cr3, regs_stash_for_read_cr3+iret_rax, 8\nmemcpy rsi_for_userspace, regs_stash_for_read_cr3+iret_rax, 8\npokeq ist_noerrc, ist_after_write_cr3\ndq justreturn_pop\ndq 0\ndq 0\ndq uelf_cr3\ndq mov_cr3_rax_mov_ds\ndq 0x20\ndq 0x102\ndq 0\ndq 0\n\nalign 16\ndq 0\niret_frame_after_write_cr3:\ntimes 5 dq 0\nist_after_write_cr3:\ntimes iret_rip-(ist_after_write_cr3-iret_frame_after_write_cr3) db 0\ndq nop_ret\ndq 0x20\ndq 2\ndq prepare_for_userspace\ndq 0\n\nprepare_for_userspace:\npokeq ist_errc, ist_after_userspace\ndq pop_all_iret\ntimes iret_rdi db 0\ndq regs_for_exit\ntimes iret_rsi-iret_rdi-8 db 0\nrsi_for_userspace:\ndq 0\ntimes iret_rdx-iret_rsi-8 db 0\ndq uelf_cr3\ntimes iret_rcx-iret_rdx-8 db 0\ndq justreturn_bak\ntimes iret_r8-iret_rcx-8 db 0\ndq return_wrmsr_gsbase+4\ntimes iret_r9-iret_r8-8 db 0\ndq restore_cr3\ntimes iret_rip-iret_r9-8 db 0\ndq doreti_iret\ndq 0x20\ndq 2\ndq .trampoline\ndq 0\n.trampoline:\ndq uelf_entry\ndq 0x43\ndq 2\ndq 0\ndq 0x3b\n\nalign 16\nerrc_after_userspace:\ntimes 6 dq 0\nist_after_userspace:\ntimes iret_rip-(ist_after_userspace-errc_after_userspace) db 0\ndq nop_ret\ndq 0x20\ndq 2\ndq after_userspace\ndq 0\nafter_userspace:\npokeq ist_errc, errc_iret_frame+40\npokeq ist_noerrc, ist_after_restore_cr3\ndq justreturn_pop\ndq 0\ndq 0\nrestore_cr3:\ndq 0\ndq mov_cr3_rax_mov_ds\ndq 0x20\ndq 0x102\ndq 0\ndq 0\n\nalign 16\ndq 0\niret_frame_after_restore_cr3:\ntimes 5 dq 0\nist_after_restore_cr3:\ntimes iret_rip-(ist_after_restore_cr3-iret_frame_after_restore_cr3) db 0\ndq nop_ret\ndq 0x20\ndq 2\ndq return_to_caller\ndq 0\n\nreturn_to_caller:\npokeq ist_noerrc, noerrc_iret_frame+40\ndq doreti_iret\ndq justreturn_pop\ndq 0x20\ndq 2\ndq return_wrmsr_gsbase+4\ndq 0\ndd 0\nreturn_wrmsr_gsbase:\ndq pcpu\ndd 0\ndq 0xc0000101\ndq pcpu\ndq wrmsr_ret\ndq 0x20\ndq 2\ndq .after_wrmsr\ndq 0\n.after_wrmsr:\nmemcpy return_wrmsr_gsbase+4, noerrc_wrmsr_gsbase+4, 24\ndq pop_all_iret\nregs_for_exit:\ntimes iret_rip+40 db 0\n\njustreturn_bak:\ntimes 5 dq 0\n"
  },
  {
    "path": "ps5-kstuff/main.c",
    "content": "#define sysctl __sysctl\r\n#include <sys/types.h>\r\n#include <sys/mman.h>\r\n#include <sys/sysctl.h>\r\n#include <signal.h>\r\n#include <stdint.h>\r\n#include <stdarg.h>\r\n#include <unistd.h>\r\n#include <fcntl.h>\r\n#include <sys/stat.h>\r\n#include <stdbool.h>\r\n#include \"../prosper0gdb/r0gdb.h\"\r\n#include \"../prosper0gdb/offsets.h\"\r\n#include \"../gdb_stub/dbg.h\"\r\n#include \"uelf/structs.h\"\r\n#include \"uelf/parasite_desc.h\"\r\n\r\nbool if_exists(const char *path) {\r\n  struct stat buffer;\r\n  return stat(path, &buffer) == 0;\r\n}\r\n\r\nbool sceKernelIsTestKit() {\r\n  return if_exists(\"/system/priv/lib/libSceDeci5Ttyp.sprx\");\r\n}\r\n\r\nvoid* dlsym(void*, const char*);\r\n\r\nvoid notify(const char* s)\r\n{\r\n    struct\r\n    {\r\n        char pad1[0x10];\r\n        int f1;\r\n        char pad2[0x19];\r\n        char msg[0xc03];\r\n    } notification = {.f1 = -1};\r\n    char* d = notification.msg;\r\n    while(*d++ = *s++);\r\n    int fd = open(\"/dev/notification0\", 1);\r\n    write(fd, &notification, 0xc30);\r\n    close(fd);\r\n}\r\n\r\nvoid die(int line)\r\n{\r\n    char buf[64] = \"problem encountered on main.c line \";\r\n    char* p = buf;\r\n    while(*p)\r\n        p++;\r\n    int q = 1;\r\n    while(line / 10 > q)\r\n        q *= 10;\r\n    while(q)\r\n    {\r\n        *p++ = '0' + (line / q) % 10;\r\n        q /= 10;\r\n    }\r\n    notify(buf);\r\n    asm volatile(\"ud2\");\r\n}\r\n\r\n#define die() die(__LINE__)\r\n\r\nextern uint64_t kdata_base;\r\n\r\nvoid kmemcpy(void* dst, const void* src, size_t sz);\r\n\r\nstatic void kpoke64(void* dst, uint64_t src)\r\n{\r\n    kmemcpy(dst, &src, 8);\r\n}\r\n\r\nstatic void kmemzero(void* dst, size_t sz)\r\n{\r\n    char* umem = mmap(0, sz, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANON, -1, 0);\r\n    mlock(umem, sz);\r\n    kmemcpy(dst, umem, sz);\r\n    munmap(umem, sz);\r\n}\r\n\r\nstatic int strcmp(const char* a, const char* b)\r\n{\r\n    while(*a && *a == *b)\r\n    {\r\n        a++;\r\n        b++;\r\n    }\r\n    return *a - *b;\r\n}\r\n\r\n#define kmalloc my_kmalloc\r\n\r\nstatic uint64_t mem_blocks[8];\r\n\r\nstatic void* kmalloc(size_t sz)\r\n{\r\n    for(int i = 0; i < 8; i += 2)\r\n    {\r\n        if(mem_blocks[i] + sz <= mem_blocks[i+1])\r\n        {\r\n            uint64_t ans = mem_blocks[i];\r\n            mem_blocks[i] += sz;\r\n            return (void*)ans;\r\n        }\r\n    }\r\n    die();\r\n    return 0;\r\n}\r\n\r\n#define NCPUS 16\r\n#define IDT (offsets.idt)\r\n#define GDT(i) (offsets.gdt_array+0x68*(i))\r\n#define TSS(i) (offsets.tss_array+0x68*(i))\r\n#define PCPU(i, fwver) ((fwver >= 0x700) ? (offsets.pcpu_array+0x980*(i)) : (offsets.pcpu_array+0x900*(i)))\r\n\r\nsize_t virt2file(uint64_t* phdr, uint16_t phnum, uintptr_t addr)\r\n{\r\n    for(size_t i = 0; i < phnum; i++)\r\n    {\r\n        uint64_t* h = phdr + 7*i;\r\n        if((uint32_t)h[0] != 1)\r\n            continue;\r\n        if(h[2] <= addr && h[2] + h[4] > addr)\r\n            return addr + h[1] - h[2];\r\n    }\r\n    return -1;\r\n}\r\n\r\nvoid* load_kelf(void* ehdr, const char** symbols, uint64_t* values, void** base, void** entry, uint64_t mapped_kptr)\r\n{\r\n    uint64_t* phdr = (void*)((char*)ehdr + *(uint64_t*)((char*)ehdr + 32));\r\n    uint16_t phnum = *(uint16_t*)((char*)ehdr + 56);\r\n    uint64_t* dynamic = 0;\r\n    size_t sz_dynamic = 0;\r\n    uint64_t kernel_size = 0;\r\n    for(size_t i = 0; i < phnum; i++)\r\n    {\r\n        uint64_t* h = phdr + 7*i;\r\n        if((uint32_t)h[0] == 2)\r\n        {\r\n            dynamic = (void*)((char*)ehdr + h[1]);\r\n            sz_dynamic = h[4];\r\n        }\r\n        else if((uint32_t)h[0] == 1)\r\n        {\r\n            uint64_t limit = h[2] + h[5];\r\n            if(limit > kernel_size)\r\n                kernel_size = limit;\r\n        }\r\n    }\r\n    kernel_size = ((kernel_size + 4095) | 4095) - 4095;\r\n    char* kptr = kmalloc(kernel_size+4096);\r\n    kptr = (char*)((((uint64_t)kptr - 1) | 4095) + 1);\r\n    if(!mapped_kptr)\r\n        mapped_kptr = (uint64_t)kptr;\r\n    base[0] = kptr;\r\n    base[1] = kptr + kernel_size;\r\n    for(size_t i = 0; i < phnum; i++)\r\n    {\r\n        uint64_t* h = phdr + 7*i;\r\n        if((uint32_t)h[0] != 1)\r\n            continue;\r\n        kmemcpy(kptr+h[2], (char*)ehdr + h[1], h[4]);\r\n        kmemzero(kptr+h[2]+h[4], h[5]-h[4]);\r\n    }\r\n    char* strtab = 0;\r\n    uint64_t* symtab = 0;\r\n    uint64_t* rela = 0;\r\n    size_t relasz = 0;\r\n    for(size_t i = 0; i < sz_dynamic / 16; i++)\r\n    {\r\n        uint64_t* kv = dynamic + 2*i;\r\n        if(kv[0] == 5)\r\n            strtab = (char*)ehdr + virt2file(phdr, phnum, kv[1]);\r\n        else if(kv[0] == 6)\r\n            symtab = (void*)((char*)ehdr + virt2file(phdr, phnum, kv[1]));\r\n        else if(kv[0] == 7)\r\n            rela = (void*)((char*)ehdr + virt2file(phdr, phnum, kv[1]));\r\n        else if(kv[0] == 8)\r\n            relasz = kv[1];\r\n    }\r\n    for(size_t i = 0; i < relasz / 24; i++)\r\n    {\r\n        uint64_t* oia = rela + 3*i;\r\n        if((uint32_t)oia[1] == 1 || (uint32_t)oia[1] == 6)\r\n        {\r\n            uint64_t* sym = symtab + 3 * (oia[1] >> 32);\r\n            const char* name = strtab + (uint32_t)sym[0];\r\n            uint64_t value = sym[1];\r\n            if(!value)\r\n            {\r\n                for(size_t i = 0; symbols[i]; i++)\r\n                    if(!strcmp(symbols[i], name))\r\n                        sym[1] = value = values[i];\r\n                    else if(symbols[i][0] == '.' && !strcmp(symbols[i]+1, name))\r\n                        value = values[i];\r\n#ifndef FIRMWARE_PORTING\r\n                if(!value)\r\n                    die();\r\n#endif\r\n            }\r\n            if((uint32_t)oia[1] == 6 && oia[2])\r\n                die();\r\n            if(oia[0] + 8 > kernel_size)\r\n                die();\r\n            kpoke64(kptr+oia[0], oia[2]+value);\r\n        }\r\n        else if((uint32_t)oia[1] == 8)\r\n        {\r\n            if(oia[0] + 8 > kernel_size)\r\n                die();\r\n            kpoke64(kptr+oia[0], (uint64_t)(mapped_kptr+oia[2]));\r\n        }\r\n        else\r\n            die();\r\n    }\r\n    *entry = kptr + *(uint64_t*)((char*)ehdr + 24);\r\n    return kptr;\r\n}\r\n\r\nasm(\".section .data\\nkek:\\n.incbin \\\"kelf\\\"\\nkek_end:\");\r\nextern char kek[];\r\nextern char kek_end[];\r\n\r\nasm(\".section .data\\nuek:\\n.incbin \\\"uelf/uelf.bin\\\"\\nuek_end:\");\r\nextern char uek[];\r\nextern char uek_end[];\r\n\r\nasm(\".section .text\\nkekcall:\\nmov 8(%rsp), %rax\\njmp *p_kekcall(%rip)\");\r\n\r\nuint64_t kekcall(uint64_t a, uint64_t b, uint64_t c, uint64_t d, uint64_t e, uint64_t f, uint64_t nr);\r\n\r\n#define KEKCALL_GETPPID        0x000000027\r\n#define KEKCALL_READ_DR        0x100000027\r\n#define KEKCALL_WRITE_DR       0x200000027\r\n#define KEKCALL_RDMSR          0x300000027\r\n#define KEKCALL_REMOTE_SYSCALL 0x500000027\r\n#define KEKCALL_CHECK          0xffffffff00000027\r\n\r\nvoid* p_kekcall;\r\n\r\nvoid* malloc(size_t sz)\r\n{\r\n    return mmap(0, sz, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANON, -1, 0);\r\n}\r\n\r\nuint64_t get_dmap_base(void)\r\n{\r\n    uint64_t ptrs[2];\r\n    copyout(ptrs, offsets.kernel_pmap_store+32, sizeof(ptrs));\r\n    return ptrs[0] - ptrs[1];\r\n}\r\n\r\nuint64_t virt2phys(uintptr_t addr, uint64_t* phys_limit, uint64_t dmap, uint64_t pml)\r\n{\r\n    if (!dmap) dmap = get_dmap_base();\r\n    if (!pml) pml = r0gdb_read_cr3();\r\n    for(int i = 39; i >= 12; i -= 9)\r\n    {\r\n        uint64_t inner_pml;\r\n        copyout(&inner_pml, dmap+pml+((addr & (0x1ffull << i)) >> (i - 3)), 8);\r\n        if(!(inner_pml & 1)) //not present\r\n            return -1;\r\n        if((inner_pml & 128) || i == 12) //hugepage\r\n        {\r\n            inner_pml &= (1ull << 52) - (1ull << i);\r\n            inner_pml |= addr & ((1ull << i) - 1);\r\n            if (phys_limit) *phys_limit = (inner_pml | ((1ull << i) - 1)) + 1;\r\n            return inner_pml;\r\n        }\r\n        inner_pml &= (1ull << 52) - (1ull << 12);\r\n        pml = inner_pml;\r\n    }\r\n    //unreachable\r\n}\r\n\r\nuint64_t kernel_get_proc(uint64_t pid)\r\n{\r\n    uint64_t proc = kread8(offsets.allproc);\r\n    while(proc && (int)kread8(proc+0xbc) != pid)\r\n        proc = kread8(proc);\r\n    return proc;\r\n}\r\n\r\nint get_proc_cr3(uint64_t pid, uint64_t* cr3, uint64_t* dmap_base)\r\n{\r\n    uint64_t proc = kernel_get_proc(pid);\r\n    if(proc == 0)\r\n        return -1;\r\n    uint64_t vmspace = kread8(proc + 0x200);\r\n    // TODO: i dont know when this shifted, may be an earlier fw, also, add this to offsets.c? \r\n    uint32_t fwver = r0gdb_get_fw_version() >> 16;\r\n    uint32_t vmspace_pmap_offset = (fwver >= 0x600 ? 0x2E8 : 0x2E0);\r\n    uint64_t ptrs[2] = {0};\r\n    copyout(ptrs, vmspace + vmspace_pmap_offset + 32, sizeof(ptrs));\r\n    if (cr3) *cr3 = ptrs[1];\r\n    if (dmap_base) *dmap_base = ptrs[0] - ptrs[1];\r\n    return 0;\r\n}\r\n\r\nint phys_copyin(uint64_t vaddr, const void* src, uint64_t sz, uint64_t dmap, uint64_t pml)\r\n{\r\n    const char* p_src = src;\r\n    uint64_t phys, phys_end;\r\n    while(sz)\r\n    {\r\n        phys = virt2phys(vaddr, &phys_end, dmap, pml);\r\n        if(phys == -1)\r\n            return -1;\r\n        size_t chk = phys_end - phys;\r\n        if(sz < chk)\r\n            chk = sz;\r\n        copyin(dmap+phys, p_src, chk);\r\n        vaddr += chk;\r\n        p_src += chk;\r\n        sz -= chk;\r\n    }\r\n    return 0;\r\n}\r\n\r\nuint64_t find_empty_pml4_index(int idx)\r\n{\r\n    uint64_t dmap = get_dmap_base();\r\n    uint64_t cr3 = r0gdb_read_cr3();\r\n    uint64_t pml4[512];\r\n    copyout(pml4, dmap+cr3, 4096);\r\n    for(int i = 256; i < 512; i++)\r\n        if(!pml4[i] && !idx--)\r\n            return i;\r\n}\r\n\r\nvoid build_uelf_cr3(uint64_t uelf_cr3, void* uelf_base[2], uint64_t uelf_virt_base, uint64_t dmap_virt_base)\r\n{\r\n    static char zeros[4096];\r\n    uint64_t dmap = get_dmap_base();\r\n    uint64_t cr3 = r0gdb_read_cr3();\r\n    uint64_t user_start = (uint64_t)uelf_base[0];\r\n    uint64_t user_end = (uint64_t)uelf_base[1];\r\n    if((uelf_virt_base & 0x1fffff) || (dmap_virt_base & ((1ull << 39) - 1)) || user_end - user_start > 0x200000)\r\n        die();\r\n    uint64_t pml4_virt = uelf_cr3;\r\n    copyin(pml4_virt, zeros, 4096);\r\n    kmemcpy((void*)(pml4_virt+2048), (void*)(dmap+cr3+2048), 2048);\r\n    uint64_t pml3_virt = uelf_cr3 + 4096;\r\n    uint64_t pml3_dmap = uelf_cr3 + 16384; //user-accessible direct mapping of physical memory\r\n    copyin(pml4_virt + 8 * ((uelf_virt_base >> 39) & 511), &(uint64_t[1]){virt2phys(pml3_virt,0,0,0) | 7}, 8);\r\n    copyin(pml4_virt + 8 * ((dmap_virt_base >> 39) & 511), &(uint64_t[1]){virt2phys(pml3_dmap,0,0,0) | 7}, 8);\r\n    copyin(pml3_virt, zeros, 4096);\r\n    uint64_t pml2_virt = uelf_cr3 + 8192;\r\n    copyin(pml3_virt + 8 * ((uelf_virt_base >> 30) & 511), &(uint64_t[1]){virt2phys(pml2_virt,0,0,0) | 7}, 8);\r\n    copyin(pml2_virt, zeros, 4096);\r\n    uint64_t pml1_virt = uelf_cr3 + 12288;\r\n    copyin(pml2_virt + 8 * ((uelf_virt_base >> 21) & 511), &(uint64_t[1]){virt2phys(pml1_virt,0,0,0) | 7}, 8);\r\n    copyin(pml1_virt, zeros, 4096);\r\n    for(uint64_t i = 0; i * 4096 + user_start < user_end; i++)\r\n        copyin(pml1_virt+8*i, &(uint64_t[1]){virt2phys(i*4096+user_start,0,0,0) | 7}, 8);\r\n    for(uint64_t i = 0; i < 512; i++)\r\n        copyin(pml3_dmap+8*i, &(uint64_t[1]){(i<<30) | 135}, 8);\r\n}\r\n\r\nint find_proc(const char* name)\r\n{\r\n    for(int pid = 1; pid < 1024; pid++)\r\n    {\r\n        size_t sz = 1096;\r\n        int key[4] = {CTL_KERN, KERN_PROC, KERN_PROC_PID, pid};\r\n        char buf[1097] = {0};\r\n        sysctl(key, 4, buf, &sz, 0, 0);\r\n        const char* a = buf + 447;\r\n        const char* b = name;\r\n        while(*a && *a++ == *b++);\r\n        if(!*a && !*b)\r\n            return pid;\r\n    }\r\n    return -1;\r\n}\r\n\r\nstatic uint64_t remote_syscall(int pid, int nr, ...)\r\n{\r\n    va_list va;\r\n    va_start(va, nr);\r\n    uint64_t args[6];\r\n    for(int i = 0; i < 6; i++)\r\n        args[i] = va_arg(va, uint64_t);\r\n    va_end(va);\r\n    return kekcall(pid, nr, (uint64_t)args, 0, 0, 0, KEKCALL_REMOTE_SYSCALL);\r\n}\r\n\r\n#define SYS_mlock 203\r\n#define SYS_mdbg_call 573\r\n#define SYS_dynlib_get_info_ex 608\r\n\r\nstruct module_segment\r\n{\r\n    uint64_t addr;\r\n    uint32_t size;\r\n    uint32_t flags;\r\n};\r\n\r\nstruct module_info_ex\r\n{\r\n    size_t st_size;\r\n    char name[256];\r\n    int id;\r\n    uint32_t tls_index;\r\n    uint64_t tls_init_addr;\r\n    uint32_t tls_init_size;\r\n    uint32_t tls_size;\r\n    uint32_t tls_offset;\r\n    uint32_t tls_align;\r\n    uint64_t init_proc_addr;\r\n    uint64_t fini_proc_addr;\r\n    uint64_t reserved1;\r\n    uint64_t reserved2;\r\n    uint64_t eh_frame_hdr_addr;\r\n    uint64_t eh_frame_addr;\r\n    uint32_t eh_frame_hdr_size;\r\n    uint32_t eh_frame_size;\r\n    struct module_segment segments[4];\r\n    uint32_t segment_count;\r\n    uint32_t ref_count;\r\n};\r\n\r\nstruct shellcore_patch\r\n{\r\n    uint64_t offset;\r\n    char* data;\r\n    size_t sz;\r\n};\r\n\r\nstatic struct shellcore_patch shellcore_patches_300[] = {\r\n    //{0x9d1cae, \"\\x52\\xeb\\x08\\x66\\x90\", 5},\r\n    {0x9d1cae, \"\\x52\\xeb\\x08\", 3},\r\n    {0x9d1cb9, \"\\xe8\\x02\\xfc\\xff\\xff\\x58\\xc3\", 7},\r\n    {0x9d18b1, \"\\x31\\xc0\\x50\\xeb\\xe3\", 5},\r\n    {0x9d1899, \"\\xe8\\x22\\x00\\x00\\x00\\x58\\xc3\", 7},\r\n    {0x4dcfb4, \"\\xeb\\x04\", 2},\r\n    {0x2569b1, \"\\xeb\\x04\", 2},\r\n    {0x25af5a, \"\\xeb\\x04\", 2},\r\n    {0x4fafca, \"\\x90\\x90\", 2},\r\n    {0x4e335d, \"\\x90\\xe9\", 2},\r\n    {0x4fbb63, \"\\xeb\", 1},\r\n    {0x4ff329, \"\\xd0\\x00\\x00\\x00\", 4},\r\n    {0x1968c1, \"\\xe8\\x4a\\xde\\x42\\x00\\x31\\xc9\\xff\\xc1\\xe9\\x12\\x01\\x00\\x00\", 14},\r\n    {0x1969e1, \"\\x83\\xf8\\x02\\x0f\\x43\\xc1\\xe9\\xff\\xfb\\xff\\xff\", 11},\r\n    {0x1965c9, \"\\xe9\\xf3\\x02\\x00\\x00\", 5},\r\n    {0x131FA10, \"\\x31\\xC0\\xC3\", 3}, //VR2 Min Fw Check\r\n    {0x899166, \"\\x90\\x90\\x90\\x90\\x90\", 5}, //disable game error message\r\n    {0x25284B, \"\\x90\\xE9\", 2}, //PS4 Disc Installer Patch 1\r\n    {0x2528C8, \"\\x90\\xE9\", 2}, //PS5 Disc Installer Patch 1\r\n    {0x2529CB, \"\\xEB\", 1}, //PS4 PKG Installer Patch 1\r\n    {0x252A9F, \"\\xEB\", 1}, //PS5 PKG Installer Patch 1\r\n    {0x252F35, \"\\x90\\xE9\", 2}, //PS4 PKG Installer Patch 2\r\n    {0x253120, \"\\xeb\", 1}, //PS5 PKG Installer Patch 2\r\n    {0x2534E5, \"\\x90\\xE9\", 2}, //PS4 PKG Installer Patch 3\r\n    {0x253582, \"\\x90\\xE9\", 2}, //PS5 PKG Installer Patch 3\r\n    {0x4DEF37, \"\\xEB\", 1}, //PS4 PKG Installer Patch 4\r\n    {0x4DF04C, \"\\xEB\", 1}, //PS5 PKG Installer Patch 4\r\n    {0x4E0F10, \"\\x48\\x31\\xC0\\xC3\", 4}, //PKG Installer\r\n};\r\n\r\nstatic struct shellcore_patch shellcore_patches_310[] = {\r\n    //{0x9d1cee, \"\\x52\\xeb\\x08\\x66\\x90\", 5},\r\n    {0x9d1cee, \"\\x52\\xeb\\x08\", 3},\r\n    {0x9d1cf9, \"\\xe8\\x02\\xfc\\xff\\xff\\x58\\xc3\", 7},\r\n    {0x9d18f1, \"\\x31\\xc0\\x50\\xeb\\xe3\", 5},\r\n    {0x9d18d9, \"\\xe8\\x22\\x00\\x00\\x00\\x58\\xc3\", 7},\r\n    {0x4dcff4, \"\\xeb\\x04\", 2},\r\n    {0x2569f1, \"\\xeb\\x04\", 2},\r\n    {0x25af9a, \"\\xeb\\x04\", 2},\r\n    {0x4fb00a, \"\\x90\\x90\", 2},\r\n    {0x4e339d, \"\\x90\\xe9\", 2},\r\n    {0x4fbba3, \"\\xeb\", 1},\r\n    {0x4ff369, \"\\xd0\\x00\\x00\\x00\", 4},\r\n    {0x1968c1, \"\\xe8\\x8a\\xde\\x42\\x00\\x31\\xc9\\xff\\xc1\\xe9\\x12\\x01\\x00\\x00\", 14},\r\n    {0x1969e1, \"\\x83\\xf8\\x02\\x0f\\x43\\xc1\\xe9\\xff\\xfb\\xff\\xff\", 11},\r\n    {0x1965c9, \"\\xe9\\xf3\\x02\\x00\\x00\", 5},\r\n    {0x131FA50, \"\\x31\\xC0\\xC3\", 3}, //VR2 Min Fw Check\r\n    {0x8991A6, \"\\x90\\x90\\x90\\x90\\x90\", 5}, //disable game error message\r\n    {0x25288B, \"\\x90\\xE9\", 2}, //PS4 Disc Installer Patch 1\r\n    {0x252908, \"\\x90\\xE9\", 2}, //PS5 Disc Installer Patch 1\r\n    {0x252A0B, \"\\xEB\", 1}, //PS4 PKG Installer Patch 1\r\n    {0x252ADF, \"\\xEB\", 1}, //PS5 PKG Installer Patch 1\r\n    {0x252F75, \"\\x90\\xE9\", 2}, //PS4 PKG Installer Patch 2\r\n    {0x253160, \"\\xeb\", 1}, //PS5 PKG Installer Patch 2\r\n    {0x253525, \"\\x90\\xE9\", 2}, //PS4 PKG Installer Patch 3\r\n    {0x2535C2, \"\\x90\\xE9\", 2}, //PS5 PKG Installer Patch 3\r\n    {0x4DEF77, \"\\xEB\", 1}, //PS4 PKG Installer Patch 4\r\n    {0x4DF08C, \"\\xEB\", 1}, //PS5 PKG Installer Patch 4\r\n    {0x4E0F50, \"\\x48\\x31\\xC0\\xC3\", 4}, //PKG Installer\r\n};\r\n\r\nstatic struct shellcore_patch shellcore_patches_320[] = {\r\n    //{0x9d1f9e, \"\\x52\\xeb\\x08\\x66\\x90\", 5},\r\n    {0x9d1f9e, \"\\x52\\xeb\\x08\", 3},\r\n    {0x9d1fa9, \"\\xe8\\x02\\xfc\\xff\\xff\\x58\\xc3\", 7},\r\n    {0x9d1ba1, \"\\x31\\xc0\\x50\\xeb\\xe3\", 5},\r\n    {0x9d1b89, \"\\xe8\\x22\\x00\\x00\\x00\\x58\\xc3\", 7},\r\n    {0x4dd284, \"\\xeb\\x04\", 2},\r\n    {0x256aa1, \"\\xeb\\x04\", 2},\r\n    {0x25b04a, \"\\xeb\\x04\", 2},\r\n    {0x4fb29a, \"\\x90\\x90\", 2},\r\n    {0x4e362d, \"\\x90\\xe9\", 2},\r\n    {0x4fbe33, \"\\xeb\", 1},\r\n    {0x4ff5f9, \"\\xd0\\x00\\x00\\x00\", 4},\r\n    {0x1968c1, \"\\xe8\\x3a\\xe1\\x42\\x00\\x31\\xc9\\xff\\xc1\\xe9\\x12\\x01\\x00\\x00\", 14},\r\n    {0x1969e1, \"\\x83\\xf8\\x02\\x0f\\x43\\xc1\\xe9\\xff\\xfb\\xff\\xff\", 11},\r\n    {0x1965c9, \"\\xe9\\xf3\\x02\\x00\\x00\", 5},\r\n    {0x131FEA0, \"\\x31\\xC0\\xC3\", 3}, //VR2 Min Fw Check\r\n    {0x899456, \"\\x90\\x90\\x90\\x90\\x90\", 5}, //disable game error message\r\n    {0x25293B, \"\\x90\\xE9\", 2}, //PS4 Disc Installer Patch 1\r\n    {0x2529B8, \"\\x90\\xE9\", 2}, //PS5 Disc Installer Patch 1\r\n    {0x252ABB, \"\\xEB\", 1}, //PS4 PKG Installer Patch 1\r\n    {0x252B8F, \"\\xEB\", 1}, //PS5 PKG Installer Patch 1\r\n    {0x253025, \"\\x90\\xE9\", 2}, //PS4 PKG Installer Patch 2\r\n    {0x253210, \"\\xeb\", 1}, //PS5 PKG Installer Patch 2\r\n    {0x2535D5, \"\\x90\\xE9\", 2}, //PS4 PKG Installer Patch 3\r\n    {0x253672, \"\\x90\\xE9\", 2}, //PS5 PKG Installer Patch 3\r\n    {0x4DF207, \"\\xEB\", 1}, //PS4 PKG Installer Patch 4\r\n    {0x4DF31C, \"\\xEB\", 1}, //PS5 PKG Installer Patch 4\r\n    {0x4E11E0, \"\\x48\\x31\\xC0\\xC3\", 4}, //PKG Installer\r\n};\r\n\r\nstatic struct shellcore_patch shellcore_patches_321[] = {\r\n    //{0x9d1f9e, \"\\x52\\xeb\\x08\\x66\\x90\", 5},\r\n    {0x9d1f9e, \"\\x52\\xeb\\x08\", 3},\r\n    {0x9d1fa9, \"\\xe8\\x02\\xfc\\xff\\xff\\x58\\xc3\", 7},\r\n    {0x9d1ba1, \"\\x31\\xc0\\x50\\xeb\\xe3\", 5},\r\n    {0x9d1b89, \"\\xe8\\x22\\x00\\x00\\x00\\x58\\xc3\", 7},\r\n    {0x4dd284, \"\\xeb\\x04\", 2},\r\n    {0x256aa1, \"\\xeb\\x04\", 2},\r\n    {0x25b04a, \"\\xeb\\x04\", 2},\r\n    {0x4fb29a, \"\\x90\\x90\", 2},\r\n    {0x4e362d, \"\\x90\\xe9\", 2},\r\n    {0x4fbe33, \"\\xeb\", 1},\r\n    {0x4ff5f9, \"\\xd0\\x00\\x00\\x00\", 4},\r\n    {0x1968c1, \"\\xe8\\x3a\\xe1\\x42\\x00\\x31\\xc9\\xff\\xc1\\xe9\\x12\\x01\\x00\\x00\", 14},\r\n    {0x1969e1, \"\\x83\\xf8\\x02\\x0f\\x43\\xc1\\xe9\\xff\\xfb\\xff\\xff\", 11},\r\n    {0x1965c9, \"\\xe9\\xf3\\x02\\x00\\x00\", 5},\r\n    {0x131FEA0, \"\\x31\\xC0\\xC3\", 3}, //VR2 Min Fw Check\r\n    {0x899456, \"\\x90\\x90\\x90\\x90\\x90\", 5}, //disable game error message\r\n    {0x25293B, \"\\x90\\xE9\", 2}, //PS4 Disc Installer Patch 1\r\n    {0x2529B8, \"\\x90\\xE9\", 2}, //PS5 Disc Installer Patch 1\r\n    {0x252ABB, \"\\xEB\", 1}, //PS4 PKG Installer Patch 1\r\n    {0x252B8F, \"\\xEB\", 1}, //PS5 PKG Installer Patch 1\r\n    {0x253025, \"\\x90\\xE9\", 2}, //PS4 PKG Installer Patch 2\r\n    {0x253210, \"\\xeb\", 1}, //PS5 PKG Installer Patch 2\r\n    {0x2535D5, \"\\x90\\xE9\", 2}, //PS4 PKG Installer Patch 3\r\n    {0x253672, \"\\x90\\xE9\", 2}, //PS5 PKG Installer Patch 3\r\n    {0x4DF207, \"\\xEB\", 1}, //PS4 PKG Installer Patch 4\r\n    {0x4DF31C, \"\\xEB\", 1}, //PS5 PKG Installer Patch 4\r\n    {0x4E11E0, \"\\x48\\x31\\xC0\\xC3\", 4}, //PKG Installer\r\n};\r\n\r\nstatic struct shellcore_patch shellcore_patches_400[] = {\r\n    //{0x974fee, \"\\x52\\xeb\\x08\\x66\\x90\", 5},\r\n    {0x974fee, \"\\x52\\xeb\\x08\", 3},\r\n    {0x974ff9, \"\\xe8\\xd2\\xfb\\xff\\xff\\x58\\xc3\", 7},\r\n    {0x974bc1, \"\\x31\\xc0\\x50\\xeb\\xe3\", 5},\r\n    {0x974ba9, \"\\xe8\\x22\\x00\\x00\\x00\\x58\\xc3\", 7},\r\n    {0x5307f9, \"\\xeb\\x04\", 2},\r\n    {0x26f35c, \"\\xeb\\x04\", 2},\r\n    {0x26f76c, \"\\xeb\\x04\", 2},\r\n    {0x54e1f0, \"\\xeb\", 1},\r\n    {0x536e1d, \"\\x90\\xe9\", 2},\r\n    {0x54db8f, \"\\xeb\", 1},\r\n    {0x55137a, \"\\xc8\\x00\\x00\\x00\", 4},\r\n    {0x1a12d1, \"\\xe8\\xea\\x88\\x47\\x00\\x31\\xc9\\xff\\xc1\\xe9\\xf4\\x02\\x00\\x00\", 14},\r\n    {0x1a15d3, \"\\x83\\xf8\\x02\\x0f\\x43\\xc1\\xe9\\x29\\xfa\\xff\\xff\", 11},\r\n    {0x1a0fe5, \"\\xe9\\xe7\\x02\\x00\\x00\", 5},\r\n    {0x12B5EA0, \"\\x31\\xC0\\xC3\", 3}, //VR2 Min Fw Check\r\n    {0x81CA56, \"\\x90\\x90\\x90\\x90\\x90\", 5}, //disable game error message\r\n    {0x267DBB, \"\\x90\\xE9\", 2}, //PS4 Disc Installer Patch 1\r\n    {0x267E52, \"\\x90\\xE9\", 2}, //PS5 Disc Installer Patch 1\r\n    {0x267F6B, \"\\xEB\", 1}, //PS4 PKG Installer Patch 1\r\n    {0x26803F, \"\\xEB\", 1}, //PS5 PKG Installer Patch 1\r\n    {0x2684A8, \"\\x90\\xE9\", 2}, //PS4 PKG Installer Patch 2\r\n    {0x268679, \"\\xeb\", 1}, //PS5 PKG Installer Patch 2\r\n    {0x268A45, \"\\x90\\xE9\", 2}, //PS4 PKG Installer Patch 3\r\n    {0x268AE2, \"\\x90\\xE9\", 2}, //PS5 PKG Installer Patch 3\r\n    {0x532897, \"\\xEB\", 1}, //PS4 PKG Installer Patch 4\r\n    {0x5329AC, \"\\xEB\", 1}, //PS5 PKG Installer Patch 4\r\n    {0x5348C0, \"\\x48\\x31\\xC0\\xC3\", 4}, //PKG Installer\r\n};\r\n\r\nstatic struct shellcore_patch shellcore_patches_402[] = {\r\n    //{0x974fee, \"\\x52\\xeb\\x08\\x66\\x90\", 5},\r\n    {0x974fee, \"\\x52\\xeb\\x08\", 3},\r\n    {0x974ff9, \"\\xe8\\xd2\\xfb\\xff\\xff\\x58\\xc3\", 7},\r\n    {0x974bc1, \"\\x31\\xc0\\x50\\xeb\\xe3\", 5},\r\n    {0x974ba9, \"\\xe8\\x22\\x00\\x00\\x00\\x58\\xc3\", 7},\r\n    {0x5307f9, \"\\xeb\\x04\", 2},\r\n    {0x26f35c, \"\\xeb\\x04\", 2},\r\n    {0x26f76c, \"\\xeb\\x04\", 2},\r\n    {0x54e1f0, \"\\xeb\", 1},\r\n    {0x536e1d, \"\\x90\\xe9\", 2},\r\n    {0x54db8f, \"\\xeb\", 1},\r\n    {0x55137a, \"\\xc8\\x00\\x00\\x00\", 4},\r\n    {0x1a12d1, \"\\xe8\\xea\\x88\\x47\\x00\\x31\\xc9\\xff\\xc1\\xe9\\xf4\\x02\\x00\\x00\", 14},\r\n    {0x1a15d3, \"\\x83\\xf8\\x02\\x0f\\x43\\xc1\\xe9\\x29\\xfa\\xff\\xff\", 11},\r\n    {0x1a0fe5, \"\\xe9\\xe7\\x02\\x00\\x00\", 5},\r\n    {0x12B5EB0, \"\\x31\\xC0\\xC3\", 3}, //VR2 Min Fw Check\r\n    {0x81CA56, \"\\x90\\x90\\x90\\x90\\x90\", 5}, //disable game error message\r\n    {0x267DBB, \"\\x90\\xE9\", 2}, //PS4 Disc Installer Patch 1\r\n    {0x267E52, \"\\x90\\xE9\", 2}, //PS5 Disc Installer Patch 1\r\n    {0x267F6B, \"\\xEB\", 1}, //PS4 PKG Installer Patch 1\r\n    {0x26803F, \"\\xEB\", 1}, //PS5 PKG Installer Patch 1\r\n    {0x2684A8, \"\\x90\\xE9\", 2}, //PS4 PKG Installer Patch 2\r\n    {0x268679, \"\\xeb\", 1}, //PS5 PKG Installer Patch 2\r\n    {0x268A45, \"\\x90\\xE9\", 2}, //PS4 PKG Installer Patch 3\r\n    {0x268AE2, \"\\x90\\xE9\", 2}, //PS5 PKG Installer Patch 3\r\n    {0x532897, \"\\xEB\", 1}, //PS4 PKG Installer Patch 4\r\n    {0x5329AC, \"\\xEB\", 1}, //PS5 PKG Installer Patch 4\r\n    {0x5348C0, \"\\x48\\x31\\xC0\\xC3\", 4}, //PKG Installer\r\n};\r\n\r\nstatic struct shellcore_patch shellcore_patches_403[] = {\r\n    //{0x974fee, \"\\x52\\xeb\\x08\\x66\\x90\", 5}, //push rdx; jmp 0x974ff9; 2-byte nop\r\n    {0x974fee, \"\\x52\\xeb\\x08\", 3},\r\n    {0x974ff9, \"\\xe8\\xd2\\xfb\\xff\\xff\\x58\\xc3\", 7}, //call 0x974bd0; pop rax; ret\r\n    {0x974bc1, \"\\x31\\xc0\\x50\\xeb\\xe3\", 5}, //xor eax, eax; push rax; jmp 0x974ba9\r\n    {0x974ba9, \"\\xe8\\x22\\x00\\x00\\x00\\x58\\xc3\", 7}, //call 0x974bd0; pop rax; ret\r\n    {0x5307f9, \"\\xeb\\x04\", 2}, //jmp 0x5307ff\r\n    {0x26f35c, \"\\xeb\\x04\", 2}, //jmp 0x26f362\r\n    {0x26f76c, \"\\xeb\\x04\", 2}, //jmp 0x26f772\r\n    {0x54e1f0, \"\\xeb\", 1}, //jmp (destination unchanged)\r\n    {0x536e1d, \"\\x90\\xe9\", 2}, //nop; jmp (destination unchanged)\r\n    {0x54db8f, \"\\xeb\", 1}, //jmp (destination unchanged)\r\n    {0x55137a, \"\\xc8\\x00\\x00\\x00\", 4}, //(jmp opcode unchanged) 0x551446\r\n    {0x1a12d1, \"\\xe8\\xea\\x88\\x47\\x00\\x31\\xc9\\xff\\xc1\\xe9\\xf4\\x02\\x00\\x00\", 14}, //call 0x619bc0; xor ecx, ecx; inc ecx; jmp 0x1a15d3\r\n    {0x1a15d3, \"\\x83\\xf8\\x02\\x0f\\x43\\xc1\\xe9\\x29\\xfa\\xff\\xff\", 11}, //cmp eax, 2; cmovae eax, ecx; jmp 0x1a1007\r\n    {0x1a0fe5, \"\\xe9\\xe7\\x02\\x00\\x00\", 5}, //jmp 0x1a12d1\r\n    {0x12B5EB0, \"\\x31\\xC0\\xC3\", 3}, //VR2 Min Fw Check\r\n    {0x81CA56, \"\\x90\\x90\\x90\\x90\\x90\", 5}, //disable game error message\r\n    {0x267DBB, \"\\x90\\xE9\", 2}, //PS4 Disc Installer Patch 1\r\n    {0x267E52, \"\\x90\\xE9\", 2}, //PS5 Disc Installer Patch 1\r\n    {0x267F6B, \"\\xEB\", 1}, //PS4 PKG Installer Patch 1\r\n    {0x26803F, \"\\xEB\", 1}, //PS5 PKG Installer Patch 1\r\n    {0x2684A8, \"\\x90\\xE9\", 2}, //PS4 PKG Installer Patch 2\r\n    {0x268679, \"\\xeb\", 1}, //PS5 PKG Installer Patch 2\r\n    {0x268A45, \"\\x90\\xE9\", 2}, //PS4 PKG Installer Patch 3\r\n    {0x268AE2, \"\\x90\\xE9\", 2}, //PS5 PKG Installer Patch 3\r\n    {0x532897, \"\\xEB\", 1}, //PS4 PKG Installer Patch 4\r\n    {0x5329AC, \"\\xEB\", 1}, //PS5 PKG Installer Patch 4\r\n    {0x5348C0, \"\\x48\\x31\\xC0\\xC3\", 4}, //PKG Installer\r\n};\r\n\r\nstatic struct shellcore_patch shellcore_patches_450[] = {\r\n    //{0x97595e, \"\\x52\\xeb\\x08\\x66\\x90\", 5}, // NOTE: Shouldn't need the \\x66\\x90.... on any FW\r\n    {0x97595e, \"\\x52\\xeb\\x08\", 3},\r\n    {0x975969, \"\\xe8\\xd2\\xfb\\xff\\xff\\x58\\xc3\", 7},\r\n    {0x975531, \"\\x31\\xc0\\x50\\xeb\\xe3\", 5},\r\n    {0x975519, \"\\xe8\\x22\\x00\\x00\\x00\\x58\\xc3\", 7},\r\n    {0x530f42, \"\\xeb\\x04\", 2},\r\n    {0x26fa8c, \"\\xeb\\x04\", 2},\r\n    {0x26fe9c, \"\\xeb\\x04\", 2},\r\n    {0x54eb60, \"\\xeb\", 1},\r\n    {0x5376bd, \"\\x90\\xe9\", 2},\r\n    {0x54e4ff, \"\\xeb\", 1},\r\n    {0x551cea, \"\\xc8\\x00\\x00\\x00\", 4},\r\n    {0x1a12d1, \"\\xe8\\x5a\\x92\\x47\\x00\\x31\\xc9\\xff\\xc1\\xe9\\xf4\\x02\\x00\\x00\", 14},\r\n    {0x1a15d3, \"\\x83\\xf8\\x02\\x0f\\x43\\xc1\\xe9\\x29\\xfa\\xff\\xff\", 11},\r\n    {0x1a0fe5, \"\\xe9\\xe7\\x02\\x00\\x00\", 5},\r\n    {0x12C1E70, \"\\x31\\xC0\\xC3\", 3}, //VR2 Min Fw Check\r\n    {0x81D3C6, \"\\x90\\x90\\x90\\x90\\x90\", 5}, //disable game error message\r\n    {0x2684eb, \"\\x90\\xe9\", 2}, //PS4 Disc Installer Patch 1\r\n    {0x268582, \"\\x90\\xe9\", 2}, //PS5 Disc Installer Patch 1\r\n    {0x26869b, \"\\xeb\", 1}, //PS4 PKG Installer Patch 1\r\n    {0x26876f, \"\\xeb\", 1}, //PS5 PKG Installer Patch 1\r\n    {0x268bd8, \"\\x90\\xe9\", 2}, //PS4 PKG Installer Patch 2\r\n    {0x268da9, \"\\xeb\", 1}, //PS5 PKG Installer Patch 2\r\n    {0x269175, \"\\x90\\xe9\", 2}, //PS4 PKG Installer Patch 3\r\n    {0x269212, \"\\x90\\xe9\", 2}, //PS5 PKG Installer Patch 3\r\n    {0x533137, \"\\xeb\", 1}, //PS4 PKG Installer Patch 4\r\n    {0x53324c, \"\\xeb\", 1}, //PS5 PKG Installer Patch 4\r\n    {0x535160, \"\\x48\\x31\\xc0\\xc3\", 4}, //PKG Installer\r\n};\r\n\r\nstatic struct shellcore_patch shellcore_patches_451[] = {\r\n    //{0x97596e, \"\\x52\\xeb\\x08\\x66\\x90\", 5}, // NOTE: Shouldn't need the \\x66\\x90.... on any FW\r\n    {0x97596e, \"\\x52\\xeb\\x08\", 3},\r\n    {0x975979, \"\\xe8\\xd2\\xfb\\xff\\xff\\x58\\xc3\", 7},\r\n    {0x975541, \"\\x31\\xc0\\x50\\xeb\\xe3\", 5},\r\n    {0x975529, \"\\xe8\\x22\\x00\\x00\\x00\\x58\\xc3\", 7},\r\n    {0x530f52, \"\\xeb\\x04\", 2},\r\n    {0x26fa8c, \"\\xeb\\x04\", 2},\r\n    {0x26fe9c, \"\\xeb\\x04\", 2},\r\n    {0x54eb70, \"\\xeb\", 1},\r\n    {0x5376cd, \"\\x90\\xe9\", 2},\r\n    {0x54e50f, \"\\xeb\", 1},\r\n    {0x551cfa, \"\\xc8\\x00\\x00\\x00\", 4},\r\n    {0x1a12d1, \"\\xe8\\x6a\\x92\\x47\\x00\\x31\\xc9\\xff\\xc1\\xe9\\xf4\\x02\\x00\\x00\", 14},\r\n    {0x1a15d3, \"\\x83\\xf8\\x02\\x0f\\x43\\xc1\\xe9\\x29\\xfa\\xff\\xff\", 11},\r\n    {0x1a0fe5, \"\\xe9\\xe7\\x02\\x00\\x00\", 5},\r\n    {0x12C1E70, \"\\x31\\xC0\\xC3\", 3}, //VR2 Min Fw Check\r\n    {0x81D3D6, \"\\x90\\x90\\x90\\x90\\x90\", 5}, //disable game error message\r\n    {0x2684eb, \"\\x90\\xe9\", 2}, //PS4 Disc Installer Patch 1\r\n    {0x268582, \"\\x90\\xe9\", 2}, //PS5 Disc Installer Patch 1\r\n    {0x26869b, \"\\xeb\", 1}, //PS4 PKG Installer Patch 1\r\n    {0x26876f, \"\\xeb\", 1}, //PS5 PKG Installer Patch 1\r\n    {0x268bd8, \"\\x90\\xe9\", 2}, //PS4 PKG Installer Patch 2\r\n    {0x268da9, \"\\xeb\", 1}, //PS5 PKG Installer Patch 2\r\n    {0x269175, \"\\x90\\xe9\", 2}, //PS4 PKG Installer Patch 3\r\n    {0x269212, \"\\x90\\xe9\", 2}, //PS5 PKG Installer Patch 3\r\n    {0x533147, \"\\xeb\", 1}, //PS4 PKG Installer Patch 4\r\n    {0x53325c, \"\\xeb\", 1}, //PS5 PKG Installer Patch 4\r\n    {0x535170, \"\\x48\\x31\\xc0\\xc3\", 4}, //PKG Installer\r\n};\r\n\r\nstatic struct shellcore_patch shellcore_patches_500[] = {\r\n    //{0xa2e62e, \"\\x52\\xeb\\x08\\x66\\x90\", 5},\r\n    {0xa2e62e, \"\\x52\\xeb\\x08\", 3},\r\n    {0xa2e639, \"\\xe8\\x22\\xfb\\xff\\xff\\x58\\xc3\", 7},\r\n    {0xa2e151, \"\\x31\\xc0\\x50\\xeb\\xe3\", 5},\r\n    {0xa2e139, \"\\xe8\\x22\\x00\\x00\\x00\\x58\\xc3\", 7},\r\n    {0x59c2b8, \"\\xeb\\x04\", 2},\r\n    {0x2a013c, \"\\xeb\\x04\", 2},\r\n    {0x2a054c, \"\\xeb\\x04\", 2},\r\n    {0x5b9377, \"\\xeb\", 1},\r\n    {0x5a2f1d, \"\\x90\\xe9\", 2},\r\n    {0x5ba0af, \"\\xeb\", 1},\r\n    {0x5bb613, \"\\x3b\\x01\\x00\\x00\", 4},\r\n    {0x1c33c1, \"\\xe8\\xea\\x7d\\x4c\\x00\\x31\\xc9\\xff\\xc1\\xe9\\x24\\x02\\x00\\x00\", 14},\r\n    {0x1c35f3, \"\\x83\\xf8\\x02\\x0f\\x43\\xc1\\xe9\\xca\\xfb\\xff\\xff\", 11},\r\n    {0x1c30ee, \"\\xe9\\xce\\x02\\x00\\x00\", 5},\r\n    {0x1382490, \"\\x31\\xC0\\xC3\", 3}, //VR2 Min Fw Check\r\n    {0x8CEAC6, \"\\x90\\x90\\x90\\x90\\x90\", 5}, //disable game error message\r\n    {0x298CDB, \"\\x90\\xE9\", 2}, //PS4 Disc Installer Patch 1\r\n    {0x298D58, \"\\x90\\xE9\", 2}, //PS5 Disc Installer Patch 1\r\n    {0x298E5B, \"\\xEB\", 1}, //PS4 PKG Installer Patch 1\r\n    {0x298F2F, \"\\xEB\", 1}, //PS5 PKG Installer Patch 1\r\n    {0x299396, \"\\x90\\xE9\", 2}, //PS4 PKG Installer Patch 2\r\n    {0x299567, \"\\xeb\", 1}, //PS5 PKG Installer Patch 2\r\n    {0x299935, \"\\x90\\xE9\", 2}, //PS4 PKG Installer Patch 3\r\n    {0x2999D2, \"\\x90\\xE9\", 2}, //PS5 PKG Installer Patch 3\r\n    {0x59D747, \"\\xEB\", 1}, //PS4 PKG Installer Patch 4\r\n    {0x59D85C, \"\\xEB\", 1}, //PS5 PKG Installer Patch 4\r\n    {0x5A02E0, \"\\x48\\x31\\xC0\\xC3\", 4}, //PKG Installer\r\n};\r\n\r\nstatic struct shellcore_patch shellcore_patches_502[] = {\r\n    //{0xa2e61e, \"\\x52\\xeb\\x08\\x66\\x90\", 5},\r\n    {0xa2e61e, \"\\x52\\xeb\\x08\", 3},\r\n    {0xa2e629, \"\\xe8\\x22\\xfb\\xff\\xff\\x58\\xc3\", 7},\r\n    {0xa2e141, \"\\x31\\xc0\\x50\\xeb\\xe3\", 5},\r\n    {0xa2e129, \"\\xe8\\x22\\x00\\x00\\x00\\x58\\xc3\", 7},\r\n    {0x59c2a8, \"\\xeb\\x04\", 2},\r\n    {0x2a013c, \"\\xeb\\x04\", 2},\r\n    {0x2a054c, \"\\xeb\\x04\", 2},\r\n    {0x5b9367, \"\\xeb\", 1},\r\n    {0x5a2f0d, \"\\x90\\xe9\", 2},\r\n    {0x5ba09f, \"\\xeb\", 1},\r\n    {0x5bb603, \"\\x3b\\x01\\x00\\x00\", 4},\r\n    {0x1c33c1, \"\\xe8\\xda\\x7d\\x4c\\x00\\x31\\xc9\\xff\\xc1\\xe9\\x24\\x02\\x00\\x00\", 14},\r\n    {0x1c35f3, \"\\x83\\xf8\\x02\\x0f\\x43\\xc1\\xe9\\xca\\xfb\\xff\\xff\", 11},\r\n    {0x1c30ee, \"\\xe9\\xce\\x02\\x00\\x00\", 5},\r\n    {0x1382470, \"\\x31\\xC0\\xC3\", 3}, //VR2 Min Fw Check\r\n    {0x8CEAB6, \"\\x90\\x90\\x90\\x90\\x90\", 5}, //disable game error message\r\n    {0x298CDB, \"\\x90\\xE9\", 2}, //PS4 Disc Installer Patch 1\r\n    {0x298D58, \"\\x90\\xE9\", 2}, //PS5 Disc Installer Patch 1\r\n    {0x298E5B, \"\\xEB\", 1}, //PS4 PKG Installer Patch 1\r\n    {0x298F2F, \"\\xEB\", 1}, //PS5 PKG Installer Patch 1\r\n    {0x299396, \"\\x90\\xE9\", 2}, //PS4 PKG Installer Patch 2\r\n    {0x299567, \"\\xeb\", 1}, //PS5 PKG Installer Patch 2\r\n    {0x299935, \"\\x90\\xE9\", 2}, //PS4 PKG Installer Patch 3\r\n    {0x2999D2, \"\\x90\\xE9\", 2}, //PS5 PKG Installer Patch 3\r\n    {0x59D737, \"\\xEB\", 1}, //PS4 PKG Installer Patch 4\r\n    {0x59D84C, \"\\xEB\", 1}, //PS5 PKG Installer Patch 4\r\n    {0x5A02D0, \"\\x48\\x31\\xC0\\xC3\", 4}, //PKG Installer\r\n};\r\n\r\nstatic struct shellcore_patch shellcore_patches_510[] = {\r\n    //{0xa30fde, \"\\x52\\xeb\\x08\\x66\\x90\", 5},\r\n    {0xa30fde, \"\\x52\\xeb\\x08\", 3},\r\n    {0xa30fe9, \"\\xe8\\x22\\xfb\\xff\\xff\\x58\\xc3\", 7},\r\n    {0xa30b01, \"\\x31\\xc0\\x50\\xeb\\xe3\", 5},\r\n    {0xa30ae9, \"\\xe8\\x22\\x00\\x00\\x00\\x58\\xc3\", 7},\r\n    {0x59ed78, \"\\xeb\\x04\", 2},\r\n    {0x2a100c, \"\\xeb\\x04\", 2},\r\n    {0x2a141c, \"\\xeb\\x04\", 2},\r\n    {0x5bbe37, \"\\xeb\", 1},\r\n    {0x5a59dd, \"\\x90\\xe9\", 2},\r\n    {0x5bcb6f, \"\\xeb\", 1},\r\n    {0x5be0d3, \"\\x3b\\x01\\x00\\x00\", 4},\r\n    {0x1c3511, \"\\xe8\\xea\\xac\\x4c\\x00\\x31\\xc9\\xff\\xc1\\xe9\\x24\\x02\\x00\\x00\", 14},\r\n    {0x1c3743, \"\\x83\\xf8\\x02\\x0f\\x43\\xc1\\xe9\\xca\\xfb\\xff\\xff\", 11},\r\n    {0x1c323e, \"\\xe9\\xce\\x02\\x00\\x00\", 5},\r\n    {0x13855a0, \"\\x31\\xC0\\xC3\", 3}, //VR2 Min Fw Check\r\n    {0x8D1486, \"\\x90\\x90\\x90\\x90\\x90\", 5}, //disable game error message\r\n    {0x299BAB, \"\\x90\\xE9\", 2}, //PS4 Disc Installer Patch 1\r\n    {0x299C28, \"\\x90\\xE9\", 2}, //PS5 Disc Installer Patch 1\r\n    {0x299D2B, \"\\xEB\", 1}, //PS4 PKG Installer Patch 1\r\n    {0x298F2F, \"\\xEB\", 1}, //PS5 PKG Installer Patch 1\r\n    {0x29A266, \"\\x90\\xE9\", 2}, //PS4 PKG Installer Patch 2\r\n    {0x29A437, \"\\xeb\", 1}, //PS5 PKG Installer Patch 2\r\n    {0x29A805, \"\\x90\\xE9\", 2}, //PS4 PKG Installer Patch 3\r\n    {0x29A8A2, \"\\x90\\xE9\", 2}, //PS5 PKG Installer Patch 3\r\n    {0x5A0207, \"\\xEB\", 1}, //PS4 PKG Installer Patch 4\r\n    {0x5A031C, \"\\xEB\", 1}, //PS5 PKG Installer Patch 4\r\n    {0x5A2DA0, \"\\x48\\x31\\xC0\\xC3\", 4}, //PKG Installer\r\n};\r\n\r\nstatic struct shellcore_patch shellcore_patches_550[] = {\r\n    //{0xa319ee, \"\\x52\\xeb\\x08\\x66\\x90\", 5},\r\n    {0xa319ee, \"\\x52\\xeb\\x08\", 3},\r\n    {0xa319f9, \"\\xe8\\x22\\xfb\\xff\\xff\\x58\\xc3\", 7},\r\n    {0xa31511, \"\\x31\\xc0\\x50\\xeb\\xe3\", 5},\r\n    {0xa314f9, \"\\xe8\\x22\\x00\\x00\\x00\\x58\\xc3\", 7},\r\n    {0x59ed78, \"\\xeb\\x04\", 2},\r\n    {0x2a100c, \"\\xeb\\x04\", 2},\r\n    {0x2a141c, \"\\xeb\\x04\", 2},\r\n    {0x5bbe37, \"\\xeb\", 1},\r\n    {0x5a59dd, \"\\x90\\xe9\", 2},\r\n    {0x5bcb6f, \"\\xeb\", 1},\r\n    {0x5be0d3, \"\\x3b\\x01\\x00\\x00\", 4},\r\n    {0x1c3511, \"\\xe8\\xba\\xb4\\x4c\\x00\\x31\\xc9\\xff\\xc1\\xe9\\x24\\x02\\x00\\x00\", 14},\r\n    {0x1c3743, \"\\x83\\xf8\\x02\\x0f\\x43\\xc1\\xe9\\xca\\xfb\\xff\\xff\", 11},\r\n    {0x1c323e, \"\\xe9\\xce\\x02\\x00\\x00\", 5},\r\n    {0x1389c00, \"\\x31\\xC0\\xC3\", 3}, //VR2 Min Fw Check\r\n    {0x8D1E96, \"\\x90\\x90\\x90\\x90\\x90\", 5}, //disable game error message\r\n    {0x299BAB, \"\\x90\\xE9\", 2}, //PS4 Disc Installer Patch 1\r\n    {0x299C28, \"\\x90\\xE9\", 2}, //PS5 Disc Installer Patch 1\r\n    {0x299D2B, \"\\xEB\", 1}, //PS4 PKG Installer Patch 1\r\n    {0x299DFF, \"\\xEB\", 1}, //PS5 PKG Installer Patch 1\r\n    {0x29A266, \"\\x90\\xE9\", 2}, //PS4 PKG Installer Patch 2\r\n    {0x29A437, \"\\xeb\", 1}, //PS5 PKG Installer Patch 2\r\n    {0x29A805, \"\\x90\\xE9\", 2}, //PS4 PKG Installer Patch 3\r\n    {0x29A8A2, \"\\x90\\xE9\", 2}, //PS5 PKG Installer Patch 3\r\n    {0x5A0207, \"\\xEB\", 1}, //PS4 PKG Installer Patch 4\r\n    {0x5A031C, \"\\xEB\", 1}, //PS5 PKG Installer Patch 4\r\n    {0x5A2DA0, \"\\x48\\x31\\xC0\\xC3\", 4}, //PKG Installer\r\n};\r\n\r\nstatic struct shellcore_patch shellcore_patches_600[] = {\r\n    //{0xa7d30e, \"\\x52\\xeb\\x08\\x66\\x90\", 5}, // NOTE: Shouldn't need the \\x66\\x90.... on any FW\r\n    {0xa7d30e, \"\\x52\\xeb\\x08\", 3},\r\n    {0xa7d319, \"\\xe8\\x82\\xfa\\xff\\xff\\x58\\xc3\", 7},\r\n    {0xa7cd91, \"\\x31\\xc0\\x50\\xeb\\xe3\", 5},\r\n    {0xa7cd79, \"\\xe8\\x22\\x00\\x00\\x00\\x58\\xc3\", 7},\r\n    {0x5d2bb4, \"\\xeb\\x04\", 2},\r\n    {0x2c0982, \"\\xeb\\x04\", 2},\r\n    {0x2c0dc2, \"\\xeb\\x04\", 2},\r\n    {0x5f01bf, \"\\xeb\", 1},\r\n    {0x5d9c0d, \"\\x90\\xe9\", 2},\r\n    {0x5f0ef0, \"\\xeb\", 1},\r\n    {0x5f248a, \"\\x3b\\x01\\x00\\x00\", 4},\r\n    {0x1d8c71, \"\\xe8\\x7a\\xb4\\x4e\\x00\\x31\\xc9\\xff\\xc1\\xe9\\x24\\x02\\x00\\x00\", 14},\r\n    {0x1d8ea3, \"\\x83\\xf8\\x02\\x0f\\x43\\xc1\\xe9\\xc5\\xfb\\xff\\xff\", 11},\r\n    {0x1d897e, \"\\xe9\\xee\\x02\\x00\\x00\", 5},\r\n    {0x14128f0, \"\\x31\\xC0\\xC3\", 3}, //VR2 Min Fw Check\r\n    {0x91B466, \"\\x90\\x90\\x90\\x90\\x90\", 5}, //disable game error message\r\n    {0x2b93cb, \"\\x90\\xE9\", 2}, //PS4 Disc Installer Patch 1\r\n    {0x2b9448, \"\\x90\\xE9\", 2}, //PS5 Disc Installer Patch 1\r\n    {0x2b954b, \"\\xEB\", 1}, //PS4 PKG Installer Patch 1\r\n    {0x2b961f, \"\\xEB\", 1}, //PS5 PKG Installer Patch 1\r\n    {0x2b9a80, \"\\x90\\xE9\", 2}, //PS4 PKG Installer Patch 2\r\n    {0x2b9c50, \"\\xeb\", 1}, //PS5 PKG Installer Patch 2\r\n    {0x2ba025, \"\\x90\\xE9\", 2}, //PS4 PKG Installer Patch 3\r\n    {0x2ba0c2, \"\\x90\\xE9\", 2}, //PS5 PKG Installer Patch 3\r\n    {0x5d42f7, \"\\xEB\", 1}, //PS4 PKG Installer Patch 4\r\n    {0x5d440c, \"\\xEB\", 1}, //PS5 PKG Installer Patch 4\r\n    {0x5d7270, \"\\x48\\x31\\xC0\\xC3\", 4}, //PKG Installer\r\n};\r\n\r\nstatic struct shellcore_patch shellcore_patches_602[] = {\r\n    //{0xa7d2ae, \"\\x52\\xeb\\x08\\x66\\x90\", 5}, // NOTE: Shouldn't need the \\x66\\x90.... on any FW\r\n    {0xa7d2ae, \"\\x52\\xeb\\x08\", 3},\r\n    {0xa7d2b9, \"\\xe8\\x82\\xfa\\xff\\xff\\x58\\xc3\", 7},\r\n    {0xa7cd31, \"\\x31\\xc0\\x50\\xeb\\xe3\", 5},\r\n    {0xa7cd19, \"\\xe8\\x22\\x00\\x00\\x00\\x58\\xc3\", 7},\r\n    {0x5d2bb4, \"\\xeb\\x04\", 2},\r\n    {0x2c0982, \"\\xeb\\x04\", 2},\r\n    {0x2c0dc2, \"\\xeb\\x04\", 2},\r\n    {0x5f01bf, \"\\xeb\", 1},\r\n    {0x5d9c0d, \"\\x90\\xe9\", 2},\r\n    {0x5f0ef0, \"\\xeb\", 1},\r\n    {0x5f248a, \"\\x3b\\x01\\x00\\x00\", 4},\r\n    {0x1d8c71, \"\\xe8\\x1a\\xb4\\x4e\\x00\\x31\\xc9\\xff\\xc1\\xe9\\x24\\x02\\x00\\x00\", 14},\r\n    {0x1d8ea3, \"\\x83\\xf8\\x02\\x0f\\x43\\xc1\\xe9\\xc5\\xfb\\xff\\xff\", 11},\r\n    {0x1d897e, \"\\xe9\\xee\\x02\\x00\\x00\", 5},\r\n    {0x1412cf0, \"\\x31\\xC0\\xC3\", 3}, //VR2 Min Fw Check\r\n    {0x91B406, \"\\x90\\x90\\x90\\x90\\x90\", 5}, //disable game error message\r\n    {0x2b93cb, \"\\x90\\xE9\", 2}, //PS4 Disc Installer Patch 1\r\n    {0x2b9448, \"\\x90\\xE9\", 2}, //PS5 Disc Installer Patch 1\r\n    {0x2b954b, \"\\xEB\", 1}, //PS4 PKG Installer Patch 1\r\n    {0x2b961f, \"\\xEB\", 1}, //PS5 PKG Installer Patch 1\r\n    {0x2b9a80, \"\\x90\\xE9\", 2}, //PS4 PKG Installer Patch 2\r\n    {0x2b9c50, \"\\xeb\", 1}, //PS5 PKG Installer Patch 2\r\n    {0x2ba025, \"\\x90\\xE9\", 2}, //PS4 PKG Installer Patch 3\r\n    {0x2ba0c2, \"\\x90\\xE9\", 2}, //PS5 PKG Installer Patch 3\r\n    {0x5d42f7, \"\\xEB\", 1}, //PS4 PKG Installer Patch 4\r\n    {0x5d440c, \"\\xEB\", 1}, //PS5 PKG Installer Patch 4\r\n    {0x5d7270, \"\\x48\\x31\\xC0\\xC3\", 4}, //PKG Installer\r\n};\r\n\r\nstatic struct shellcore_patch shellcore_patches_650[] = {\r\n    //{0xa7dade, \"\\x52\\xeb\\x08\\x66\\x90\", 5}, // NOTE: Shouldn't need the \\x66\\x90.... on any FW\r\n    {0xa7dade, \"\\x52\\xeb\\x08\", 3},\r\n    {0xa7dae9, \"\\xe8\\x82\\xfa\\xff\\xff\\x58\\xc3\", 7},\r\n    {0xa7d561, \"\\x31\\xc0\\x50\\xeb\\xe3\", 5},\r\n    {0xa7d549, \"\\xe8\\x22\\x00\\x00\\x00\\x58\\xc3\", 7},\r\n    {0x5d2c24, \"\\xeb\\x04\", 2},\r\n    {0x2c09f2, \"\\xeb\\x04\", 2},\r\n    {0x2c0e32, \"\\xeb\\x04\", 2},\r\n    {0x5f022f, \"\\xeb\", 1},\r\n    {0x5d9c7d, \"\\x90\\xe9\", 2},\r\n    {0x5f0f60, \"\\xeb\", 1},\r\n    {0x5f24fa, \"\\x3b\\x01\\x00\\x00\", 4},\r\n    {0x1d8c71, \"\\xe8\\xea\\xaf\\x4e\\x00\\x31\\xc9\\xff\\xc1\\xe9\\x24\\x02\\x00\\x00\", 14},\r\n    {0x1d8ea3, \"\\x83\\xf8\\x02\\x0f\\x43\\xc1\\xe9\\xc5\\xfb\\xff\\xff\", 11},\r\n    {0x1d897e, \"\\xe9\\xee\\x02\\x00\\x00\", 5},\r\n    {0x1413110, \"\\x31\\xC0\\xC3\", 3}, //VR2 Min Fw Check\r\n    {0x91BC36, \"\\x90\\x90\\x90\\x90\\x90\", 5}, //disable game error message\r\n    {0x2b943b, \"\\x90\\xE9\", 2}, //PS4 Disc Installer Patch 1\r\n    {0x2b94b8, \"\\x90\\xE9\", 2}, //PS5 Disc Installer Patch 1\r\n    {0x2b95bb, \"\\xEB\", 1}, //PS4 PKG Installer Patch 1\r\n    {0x2b968f, \"\\xEB\", 1}, //PS5 PKG Installer Patch 1\r\n    {0x2b9af0, \"\\x90\\xE9\", 2}, //PS4 PKG Installer Patch 2\r\n    {0x2b9cc0, \"\\xeb\", 1}, //PS5 PKG Installer Patch 2\r\n    {0x2ba095, \"\\x90\\xE9\", 2}, //PS4 PKG Installer Patch 3\r\n    {0x2ba132, \"\\x90\\xE9\", 2}, //PS5 PKG Installer Patch 3\r\n    {0x5d4367, \"\\xEB\", 1}, //PS4 PKG Installer Patch 4\r\n    {0x5d447c, \"\\xEB\", 1}, //PS5 PKG Installer Patch 4\r\n    {0x5d72e0, \"\\x48\\x31\\xC0\\xC3\", 4}, //PKG Installer\r\n};\r\n\r\nstatic struct shellcore_patch shellcore_patches_700[] = {\r\n    //{0xb424de, \"\\x52\\xeb\\x08\\x66\\x90\", 5}, // NOTE: Shouldn't need the \\x66\\x90.... on any FW\r\n    {0xb424de, \"\\x52\\xeb\\x08\", 3},\r\n    {0xb424e9, \"\\xe8\\xd2\\xf9\\xff\\xff\\x58\\xc3\", 7},\r\n    {0xb41eb1, \"\\x31\\xc0\\x50\\xeb\\xe3\", 5},\r\n    {0xb41e99, \"\\xe8\\x22\\x00\\x00\\x00\\x58\\xc3\", 7},\r\n    {0x68752f, \"\\xeb\\x04\", 2},\r\n    {0x2dcfe9, \"\\xeb\\x04\", 2},\r\n    {0x2dd439, \"\\xeb\\x04\", 2},\r\n    {0x6a5bca, \"\\xeb\", 1},\r\n    {0x68f15d, \"\\x90\\xe9\", 2},\r\n    {0x6a6994, \"\\xeb\", 1},\r\n    {0x6a7f38, \"\\x5e\\x01\\x00\\x00\", 4},\r\n    {0x1e1bb1, \"\\xe8\\xca\\xc5\\x59\\x00\\x31\\xc9\\xff\\xc1\\xe9\\x24\\x02\\x00\\x00\", 14},\r\n    {0x1e1de3, \"\\x83\\xf8\\x02\\x0f\\x43\\xc1\\xe9\\x55\\xfb\\xff\\xff\", 11},\r\n    {0x1e184e, \"\\xe9\\x5e\\x03\\x00\\x00\", 5},\r\n    {0x15771F0, \"\\x31\\xC0\\xC3\", 3}, //VR2 Min Fw Check\r\n    {0x9CAD26, \"\\x90\\x90\\x90\\x90\\x90\", 5}, //disable game error message\r\n    {0x2d59cb, \"\\x90\\xE9\", 2}, //PS4 Disc Installer Patch 1\r\n    {0x2d5a49, \"\\x90\\xE9\", 2}, //PS5 Disc Installer Patch 1\r\n    {0x2d5b4b, \"\\xEB\", 1}, //PS4 PKG Installer Patch 1\r\n    {0x2d5c20, \"\\xEB\", 1}, //PS5 PKG Installer Patch 1\r\n    {0x2d608a, \"\\x90\\xE9\", 2}, //PS4 PKG Installer Patch 2\r\n    {0x2d625d, \"\\xeb\", 1}, //PS5 PKG Installer Patch 2\r\n    {0x2d6635, \"\\x90\\xE9\", 2}, //PS4 PKG Installer Patch 3\r\n    {0x2d66d3, \"\\x90\\xE9\", 2}, //PS5 PKG Installer Patch 3\r\n    {0x68601d, \"\\xEB\", 1}, //PS4 PKG Installer Patch 4\r\n    {0x688e77, \"\\xEB\", 1}, //PS5 PKG Installer Patch 4\r\n    {0x68c230, \"\\x48\\x31\\xC0\\xC3\", 4}, //PKG Installer\r\n};\r\n\r\nstatic struct shellcore_patch shellcore_patches_701[] = {\r\n    //{0xb424de, \"\\x52\\xeb\\x08\\x66\\x90\", 5}, // NOTE: Shouldn't need the \\x66\\x90.... on any FW\r\n    {0xb424de, \"\\x52\\xeb\\x08\", 3},\r\n    {0xb424e9, \"\\xe8\\xd2\\xf9\\xff\\xff\\x58\\xc3\", 7},\r\n    {0xb41eb1, \"\\x31\\xc0\\x50\\xeb\\xe3\", 5},\r\n    {0xb41e99, \"\\xe8\\x22\\x00\\x00\\x00\\x58\\xc3\", 7},\r\n    {0x68752f, \"\\xeb\\x04\", 2},\r\n    {0x2dcfe9, \"\\xeb\\x04\", 2},\r\n    {0x2dd439, \"\\xeb\\x04\", 2},\r\n    {0x6a5bca, \"\\xeb\", 1},\r\n    {0x68f15d, \"\\x90\\xe9\", 2},\r\n    {0x6a6994, \"\\xeb\", 1},\r\n    {0x6a7f38, \"\\x5e\\x01\\x00\\x00\", 4},\r\n    {0x1e1bb1, \"\\xe8\\xca\\xc5\\x59\\x00\\x31\\xc9\\xff\\xc1\\xe9\\x24\\x02\\x00\\x00\", 14},\r\n    {0x1e1de3, \"\\x83\\xf8\\x02\\x0f\\x43\\xc1\\xe9\\x55\\xfb\\xff\\xff\", 11},\r\n    {0x1e184e, \"\\xe9\\x5e\\x03\\x00\\x00\", 5},\r\n    {0x15771F0, \"\\x31\\xC0\\xC3\", 3}, //VR2 Min Fw Check\r\n    {0x9CAD26, \"\\x90\\x90\\x90\\x90\\x90\", 5}, //disable game error message\r\n    {0x2d59cb, \"\\x90\\xE9\", 2}, //PS4 Disc Installer Patch 1\r\n    {0x2d5a49, \"\\x90\\xE9\", 2}, //PS5 Disc Installer Patch 1\r\n    {0x2d5b4b, \"\\xEB\", 1}, //PS4 PKG Installer Patch 1\r\n    {0x2d5c20, \"\\xEB\", 1}, //PS5 PKG Installer Patch 1\r\n    {0x2d608a, \"\\x90\\xE9\", 2}, //PS4 PKG Installer Patch 2\r\n    {0x2d625d, \"\\xeb\", 1}, //PS5 PKG Installer Patch 2\r\n    {0x2d6635, \"\\x90\\xE9\", 2}, //PS4 PKG Installer Patch 3\r\n    {0x2d66d3, \"\\x90\\xE9\", 2}, //PS5 PKG Installer Patch 3\r\n    {0x68601d, \"\\xEB\", 1}, //PS4 PKG Installer Patch 4\r\n    {0x688e77, \"\\xEB\", 1}, //PS5 PKG Installer Patch 4\r\n    {0x68c230, \"\\x48\\x31\\xC0\\xC3\", 4}, //PKG Installer\r\n};\r\n\r\nstatic struct shellcore_patch shellcore_patches_720[] = {\r\n    //{0xb42dbe, \"\\x52\\xeb\\x08\\x66\\x90\", 5}, // NOTE: Shouldn't need the \\x66\\x90.... on any FW\r\n    {0xb42dbe, \"\\x52\\xeb\\x08\", 3},\r\n    {0xb42dc9, \"\\xe8\\xd2\\xf9\\xff\\xff\\x58\\xc3\", 7},\r\n    {0xb42791, \"\\x31\\xc0\\x50\\xeb\\xe3\", 5},\r\n    {0xb42779, \"\\xe8\\x22\\x00\\x00\\x00\\x58\\xc3\", 7},\r\n    {0x68754f, \"\\xeb\\x04\", 2},\r\n    {0x2dcfe9, \"\\xeb\\x04\", 2},\r\n    {0x2dd439, \"\\xeb\\x04\", 2},\r\n    {0x6a5bea, \"\\xeb\", 1},\r\n    {0x68f17d, \"\\x90\\xe9\", 2},\r\n    {0x6a69b4, \"\\xeb\", 1},\r\n    {0x6a7f58, \"\\x5e\\x01\\x00\\x00\", 4},\r\n    {0x1e1bb1, \"\\xe8\\x9a\\xce\\x59\\x00\\x31\\xc9\\xff\\xc1\\xe9\\x24\\x02\\x00\\x00\", 14},\r\n    {0x1e1de3, \"\\x83\\xf8\\x02\\x0f\\x43\\xc1\\xe9\\x55\\xfb\\xff\\xff\", 11},\r\n    {0x1e184e, \"\\xe9\\x5e\\x03\\x00\\x00\", 5},\r\n    {0x1577AD0, \"\\x31\\xC0\\xC3\", 3}, //VR2 Min Fw Check\r\n    {0x9CB606, \"\\x90\\x90\\x90\\x90\\x90\", 5}, //disable game error message\r\n    {0x2d59cb, \"\\x90\\xE9\", 2}, //PS4 Disc Installer Patch 1\r\n    {0x2d5a49, \"\\x90\\xE9\", 2}, //PS5 Disc Installer Patch 1\r\n    {0x2d5b4b, \"\\xEB\", 1}, //PS4 PKG Installer Patch 1\r\n    {0x2d5c20, \"\\xEB\", 1}, //PS5 PKG Installer Patch 1\r\n    {0x2d608a, \"\\x90\\xE9\", 2}, //PS4 PKG Installer Patch 2\r\n    {0x2d625d, \"\\xeb\", 1}, //PS5 PKG Installer Patch 2\r\n    {0x2d6635, \"\\x90\\xE9\", 2}, //PS4 PKG Installer Patch 3\r\n    {0x2d66d3, \"\\x90\\xE9\", 2}, //PS5 PKG Installer Patch 3\r\n    {0x68603d, \"\\xEB\", 1}, //PS4 PKG Installer Patch 4\r\n    {0x688e97, \"\\xEB\", 1}, //PS5 PKG Installer Patch 4\r\n    {0x68c250, \"\\x48\\x31\\xC0\\xC3\", 4}, //PKG Installer\r\n};\r\n\r\nstatic struct shellcore_patch shellcore_patches_740[] = {\r\n    //{0xb4e4ae, \"\\x52\\xeb\\x08\\x66\\x90\", 5}, // NOTE: Shouldn't need the \\x66\\x90.... on any FW\r\n    {0xb4e4ae, \"\\x52\\xeb\\x08\", 3},\r\n    {0xb4e4b9, \"\\xe8\\xD2\\xf9\\xff\\xff\\x58\\xc3\", 7},\r\n    {0xb4de81, \"\\x31\\xc0\\x50\\xeb\\xe3\", 5},\r\n    {0xb4de69, \"\\xe8\\x22\\x00\\x00\\x00\\x58\\xc3\", 7},\r\n    {0x68c03f, \"\\xeb\\x04\", 2},\r\n    {0x2e13b9, \"\\xeb\\x04\", 2},\r\n    {0x2e1809, \"\\xeb\\x04\", 2},\r\n    {0x6aa6da, \"\\xeb\", 1},\r\n    {0x693c6d, \"\\x90\\xe9\", 2},\r\n    {0x6ab4a4, \"\\xeb\", 1},\r\n    {0x6aca48, \"\\x5e\\x01\\x00\\x00\", 4},\r\n    {0x1e5f81, \"\\xe8\\xba\\xd5\\x59\\x00\\x31\\xc9\\xff\\xc1\\xe9\\x24\\x02\\x00\\x00\", 14},\r\n    {0x1e61b3, \"\\x83\\xf8\\x02\\x0f\\x43\\xc1\\xe9\\x55\\xfb\\xff\\xff\", 11},\r\n    {0x1e5c1e, \"\\xe9\\x5e\\x03\\x00\\x00\", 5},\r\n    {0x1584BE0, \"\\x31\\xC0\\xC3\", 3}, //VR2 Min Fw Check\r\n    {0x9D6CF6, \"\\x90\\x90\\x90\\x90\\x90\", 5}, //disable game error message\r\n    {0x2d9d9b, \"\\x90\\xE9\", 2}, //PS4 Disc Installer Patch 1\r\n    {0x2d9e19, \"\\x90\\xE9\", 2}, //PS5 Disc Installer Patch 1\r\n    {0x2d9f1b, \"\\xEB\", 1}, //PS4 PKG Installer Patch 1\r\n    {0x2d9ff0, \"\\xEB\", 1}, //PS5 PKG Installer Patch 1\r\n    {0x2da45a, \"\\x90\\xE9\", 2}, //PS4 PKG Installer Patch 2\r\n    {0x2da62d, \"\\xeb\", 1}, //PS5 PKG Installer Patch 2\r\n    {0x2daa05, \"\\x90\\xE9\", 2}, //PS4 PKG Installer Patch 3\r\n    {0x2daaa3, \"\\x90\\xE9\", 2}, //PS5 PKG Installer Patch 3\r\n    {0x68ab2d, \"\\xEB\", 1}, //PS4 PKG Installer Patch 4\r\n    {0x68d987, \"\\xEB\", 1}, //PS5 PKG Installer Patch 4\r\n    {0x690d40, \"\\x48\\x31\\xC0\\xC3\", 4}, //PKG Installer\r\n};\r\n\r\nstatic struct shellcore_patch shellcore_patches_760[] = {\r\n    //{0xb51a8e, \"\\x52\\xeb\\x08\\x66\\x90\", 5}, // NOTE: Shouldn't need the \\x66\\x90.... on any FW\r\n    {0xb51a8e, \"\\x52\\xeb\\x08\", 3},\r\n    {0xb51a99, \"\\xe8\\xd2\\xf9\\xff\\xff\\x58\\xc3\", 7},\r\n    {0xb51461, \"\\x31\\xc0\\x50\\xeb\\xe3\", 5},\r\n    {0xb51449, \"\\xe8\\x22\\x00\\x00\\x00\\x58\\xc3\", 7},\r\n    {0x68c03f, \"\\xeb\\x04\", 2},\r\n    {0x2e13b9, \"\\xeb\\x04\", 2},\r\n    {0x2e1809, \"\\xeb\\x04\", 2},\r\n    {0x6aa6da, \"\\xeb\", 1},\r\n    {0x693c6d, \"\\x90\\xe9\", 2},\r\n    {0x6ab4a4, \"\\xeb\", 1},\r\n    {0x6aca48, \"\\x5e\\x01\\x00\\x00\", 4},\r\n    {0x1e5f81, \"\\xe8\\xba\\xd5\\x59\\x00\\x31\\xc9\\xff\\xc1\\xe9\\x24\\x02\\x00\\x00\", 14},\r\n    {0x1e61b3, \"\\x83\\xf8\\x02\\x0f\\x43\\xc1\\xe9\\x55\\xfb\\xff\\xff\", 11},\r\n    {0x1e5c1e, \"\\xe9\\x5e\\x03\\x00\\x00\", 5},\r\n    {0x15881C0, \"\\x31\\xC0\\xC3\", 3}, //VR2 Min Fw Check\r\n    {0x9DA2D6, \"\\x90\\x90\\x90\\x90\\x90\", 5}, //disable game error message\r\n    {0x2d9d9b, \"\\x90\\xE9\", 2}, //PS4 Disc Installer Patch 1\r\n    {0x2d9e19, \"\\x90\\xE9\", 2}, //PS5 Disc Installer Patch 1\r\n    {0x2d9f1b, \"\\xEB\", 1}, //PS4 PKG Installer Patch 1\r\n    {0x2d9ff0, \"\\xEB\", 1}, //PS5 PKG Installer Patch 1\r\n    {0x2da45a, \"\\x90\\xE9\", 2}, //PS4 PKG Installer Patch 2\r\n    {0x2da62d, \"\\xeb\", 1}, //PS5 PKG Installer Patch 2\r\n    {0x2daa05, \"\\x90\\xE9\", 2}, //PS4 PKG Installer Patch 3\r\n    {0x2daaa3, \"\\x90\\xE9\", 2}, //PS5 PKG Installer Patch 3\r\n    {0x68ab2d, \"\\xEB\", 1}, //PS4 PKG Installer Patch 4\r\n    {0x68d987, \"\\xEB\", 1}, //PS5 PKG Installer Patch 4\r\n    {0x690d40, \"\\x48\\x31\\xC0\\xC3\", 4}, //PKG Installer\r\n};\r\n\r\nstatic struct shellcore_patch shellcore_patches_761[] = {\r\n    //{0xb51a8e, \"\\x52\\xeb\\x08\\x66\\x90\", 5}, // NOTE: Shouldn't need the \\x66\\x90.... on any FW\r\n    {0xb51a8e, \"\\x52\\xeb\\x08\", 3},\r\n    {0xb51a99, \"\\xe8\\xd2\\xf9\\xff\\xff\\x58\\xc3\", 7},\r\n    {0xb51461, \"\\x31\\xc0\\x50\\xeb\\xe3\", 5},\r\n    {0xb51449, \"\\xe8\\x22\\x00\\x00\\x00\\x58\\xc3\", 7},\r\n    {0x68c03f, \"\\xeb\\x04\", 2},\r\n    {0x2e13b9, \"\\xeb\\x04\", 2},\r\n    {0x2e1809, \"\\xeb\\x04\", 2},\r\n    {0x6aa6da, \"\\xeb\", 1},\r\n    {0x693c6d, \"\\x90\\xe9\", 2},\r\n    {0x6ab4a4, \"\\xeb\", 1},\r\n    {0x6aca48, \"\\x5e\\x01\\x00\\x00\", 4},\r\n    {0x1e5f81, \"\\xe8\\xba\\xd5\\x59\\x00\\x31\\xc9\\xff\\xc1\\xe9\\x24\\x02\\x00\\x00\", 14},\r\n    {0x1e61b3, \"\\x83\\xf8\\x02\\x0f\\x43\\xc1\\xe9\\x55\\xfb\\xff\\xff\", 11},\r\n    {0x1e5c1e, \"\\xe9\\x5e\\x03\\x00\\x00\", 5},\r\n    {0x15881C0, \"\\x31\\xC0\\xC3\", 3}, //VR2 Min Fw Check\r\n    {0x9DA2D6, \"\\x90\\x90\\x90\\x90\\x90\", 5}, //disable game error message\r\n    {0x2d9d9b, \"\\x90\\xE9\", 2}, //PS4 Disc Installer Patch 1\r\n    {0x2d9e19, \"\\x90\\xE9\", 2}, //PS5 Disc Installer Patch 1\r\n    {0x2d9f1b, \"\\xEB\", 1}, //PS4 PKG Installer Patch 1\r\n    {0x2d9ff0, \"\\xEB\", 1}, //PS5 PKG Installer Patch 1\r\n    {0x2da45a, \"\\x90\\xE9\", 2}, //PS4 PKG Installer Patch 2\r\n    {0x2da62d, \"\\xeb\", 1}, //PS5 PKG Installer Patch 2\r\n    {0x2daa05, \"\\x90\\xE9\", 2}, //PS4 PKG Installer Patch 3\r\n    {0x2daaa3, \"\\x90\\xE9\", 2}, //PS5 PKG Installer Patch 3\r\n    {0x68ab2d, \"\\xEB\", 1}, //PS4 PKG Installer Patch 4\r\n    {0x68d987, \"\\xEB\", 1}, //PS5 PKG Installer Patch 4\r\n    {0x690d40, \"\\x48\\x31\\xC0\\xC3\", 4}, //PKG Installer\r\n};\r\n\r\nstatic struct shellcore_patch shellcore_patches_800[] = {\r\n    {0xba85ce, \"\\x52\\xeb\\x08\", 3}, //push rdx; jmp 0xBA85D9\r\n    {0xba85d9, \"\\xe8\\xe2\\xf6\\xff\\xff\\x58\\xc3\", 7}, //call 0xBA7CC0; pop rax; ret\r\n    {0xba7cb1, \"\\xe9\\xae\\xfd\\xff\\xff\", 5},  // jmp 0xBA7A64\r\n    {0xba7a64, \"\\x31\\xc0\\x50\\xe8\\x54\\x02\\x00\\x00\\x58\\xc3\", 10}, //xor eax, eax; push rax; call 0xBA7CC0; pop rax; ret\r\n\r\n    {0x6b27bd, \"\\xeb\\x04\", 2}, //jmp 0x6B27C3\r\n    {0x2f1a82, \"\\xeb\\x04\", 2}, //jmp 0x2F1A88\r\n    {0x2f1ed2, \"\\xeb\\x04\", 2}, //jmp 0x2F1ED8\r\n    {0x6d1cc1, \"\\xeb\", 1}, //jmp\r\n    {0x6baa05, \"\\x90\\xe9\", 2}, //nop; jmp\r\n    {0x6d2a0d, \"\\xeb\", 1}, //jmp\r\n\r\n    {0x6d3f89, \"\\x61\\x01\\x00\\x00\", 4}, // 0x6D40EE\r\n    {0x1f7272, \"\\xe8\\x19\\x3c\\x5c\\x00\\x31\\xc9\\xff\\xc1\\xe9\\xb3\\x02\\x00\\x00\", 14}, // call 0x7BAE90; xor ecx; inc ecx; jmp 0x1f7533\r\n    {0x1f7533, \"\\x83\\xf8\\x02\\x0f\\x43\\xc1\\xe9\\xa7\\xfb\\xff\\xff\", 11},//cmp eax, 2; cmovae eax, ecx; jmp 0x1F70E5\r\n    {0x1f6f2e, \"\\xe9\\x3f\\x03\\x00\\x00\", 5}, // JMP 0x1F7272\r\n\r\n\t{0x6F08F0, \"\\xC3\", 1}, // callback to sceRifManagerRegisterActivationCallback\r\n\r\n    {0x15fbe80, \"\\x31\\xc0\\xc3\", 3}, // VR2 Min Fw Check\r\n    {0xa2cac6, \"\\xeb\\x03\", 2}, // disable game error message\r\n    {0x2ea51b, \"\\x90\\xe9\", 2}, // PS4 Disc Installer Patch 1\r\n    {0x2ea599, \"\\x90\\xe9\", 2}, // PS5 Disc Installer Patch 1\r\n    {0x2ea69c, \"\\xeb\", 1}, // PS4 PKG Installer Patch 1\r\n    {0x2ea770, \"\\xeb\", 1}, // PS5 PKG Installer Patch 1\r\n    {0x2eab57, \"\\x90\\xe9\", 2}, // PS4 PKG Installer Patch 2\r\n    {0x2eacdf, \"\\xeb\", 1}, // PS5 PKG Installer Patch 2\r\n    {0x2eb09e, \"\\x90\\xe9\", 2}, // PS4 PKG Installer Patch 3\r\n    {0x2eb131, \"\\x90\\xe9\", 2}, // PS5 PKG Installer Patch 3\r\n    {0x6b14ca, \"\\xeb\", 1}, // PS4 PKG Installer Patch 4\r\n    {0x6b4324, \"\\xeb\", 1}, // PS5 PKG Installer Patch 4\r\n    {0x6b77b0, \"\\x48\\x31\\xc0\\xc3\", 4}, // PKG Installer\r\n};\r\n\r\nstatic struct shellcore_patch shellcore_patches_820[] = {\r\n    {0xBAF83E, \"\\x52\\xeb\\x08\", 3}, //push rdx; jmp 0xBAF849 **\r\n    {0xBAF849, \"\\xe8\\xe2\\xf8\\xff\\xff\\x58\\xc3\", 7}, //call 0xBAF130; pop rax; ret\r\n    {0xBAF121, \"\\xe9\\xae\\xfd\\xff\\xff\", 5},  // jmp 0xBAEED4 **\r\n    {0xBAEED4, \"\\x31\\xc0\\x50\\xe8\\x54\\x02\\x00\\x00\\x58\\xc3\", 10}, //xor eax, eax; push rax; call 0xBAF130; pop rax; ret\r\n    {0x6B5673, \"\\xeb\\x04\", 2},\r\n    {0x2f1d22, \"\\xeb\\x04\", 2},\r\n    {0x2f2172, \"\\xeb\\x04\", 2},\r\n    {0x6d4b71, \"\\xeb\", 1},\r\n    {0x6bd8b5, \"\\x90\\xe9\", 2},\r\n    {0x6d58bd, \"\\xeb\", 1},\r\n    {0x6d6e39, \"\\x61\\x01\\x00\\x00\", 4}, // 0x6D6F9E **\r\n    {0x1f72e2, \"\\xe8\\x29\\x6b\\x5c\\x00\\x31\\xc9\\xff\\xc1\\xe9\\xb3\\x02\\x00\\x00\", 14}, // call 0x7BDE10; xor ecx; inc ecx; jmp 0x1f75a3\r\n    {0x1f75a3, \"\\x83\\xf8\\x02\\x0f\\x43\\xc1\\xe9\\xa7\\xfb\\xff\\xff\", 11},//cmp eax, 2; cmovae eax, ecx; jmp 0x1F7155\r\n    {0x1f6f9e, \"\\xe9\\x3f\\x03\\x00\\x00\", 5}, // JMP 0x1f72e2\r\n\r\n\t{0x6F3870, \"\\xC3\", 1}, // callback to sceRifManagerRegisterActivationCallback\r\n\r\n    {0x1607a20, \"\\x31\\xc0\\xc3\", 3}, // VR2 Min Fw Check\r\n    {0xa33f36, \"\\xeb\\x03\", 2}, // disable game error message\r\n    {0x2ea7bb, \"\\x90\\xe9\", 2}, // PS4 Disc Installer Patch 1\r\n    {0x2ea839, \"\\x90\\xe9\", 2}, // PS5 Disc Installer Patch 1\r\n    {0x2ea93c, \"\\xeb\", 1}, // PS4 PKG Installer Patch 1\r\n    {0x2eaa10, \"\\xeb\", 1}, // PS5 PKG Installer Patch 1\r\n    {0x2eadf7, \"\\x90\\xe9\", 2}, // PS4 PKG Installer Patch 2\r\n    {0x2eaf7f, \"\\xeb\", 1}, // PS5 PKG Installer Patch 2\r\n    {0x2eb33e, \"\\x90\\xe9\", 2}, // PS4 PKG Installer Patch 3\r\n    {0x2eb3d1, \"\\x90\\xe9\", 2}, // PS5 PKG Installer Patch 3\r\n    {0x6b438a, \"\\xeb\", 1}, // PS4 PKG Installer Patch 4\r\n    {0x6b71d4, \"\\xeb\", 1}, // PS5 PKG Installer Patch 4\r\n    {0x6ba660, \"\\x48\\x31\\xc0\\xc3\", 4}, // PKG Installer\r\n};\r\n\r\nstatic struct shellcore_patch shellcore_patches_840[] = {\r\n    {0xBAF83E, \"\\x52\\xeb\\x08\", 3}, //push rdx; jmp 0xBAF849 **\r\n    {0xBAF849, \"\\xe8\\xe2\\xf8\\xff\\xff\\x58\\xc3\", 7}, //call 0xBAF130; pop rax; ret\r\n    {0xBAF121, \"\\xe9\\xae\\xfd\\xff\\xff\", 5},  // jmp 0xBAEED4 **\r\n    {0xBAEED4, \"\\x31\\xc0\\x50\\xe8\\x54\\x02\\x00\\x00\\x58\\xc3\", 10}, //xor eax, eax; push rax; call 0xBAF130; pop rax; ret\r\n    {0x6B5673, \"\\xeb\\x04\", 2},\r\n    {0x2f1d22, \"\\xeb\\x04\", 2},\r\n    {0x2f2172, \"\\xeb\\x04\", 2},\r\n    {0x6d4b71, \"\\xeb\", 1},\r\n    {0x6bd8b5, \"\\x90\\xe9\", 2},\r\n    {0x6d58bd, \"\\xeb\", 1},\r\n    {0x6d6e39, \"\\x61\\x01\\x00\\x00\", 4}, // 0x6D6F9E **\r\n    {0x1f72e2, \"\\xe8\\x29\\x6b\\x5c\\x00\\x31\\xc9\\xff\\xc1\\xe9\\xb3\\x02\\x00\\x00\", 14}, // call 0x7BDE10; xor ecx; inc ecx; jmp 0x1f75a3\r\n    {0x1f75a3, \"\\x83\\xf8\\x02\\x0f\\x43\\xc1\\xe9\\xa7\\xfb\\xff\\xff\", 11},//cmp eax, 2; cmovae eax, ecx; jmp 0x1F7155\r\n    {0x1f6f9e, \"\\xe9\\x3f\\x03\\x00\\x00\", 5}, // JMP 0x1f72e2\r\n\r\n\t{0x6F3870, \"\\xC3\", 1}, // callback to sceRifManagerRegisterActivationCallback\r\n\r\n    {0x1607a20, \"\\x31\\xc0\\xc3\", 3}, // VR2 Min Fw Check\r\n    {0xa33f36, \"\\xeb\\x03\", 2}, // disable game error message\r\n    {0x2ea7bb, \"\\x90\\xe9\", 2}, // PS4 Disc Installer Patch 1\r\n    {0x2ea839, \"\\x90\\xe9\", 2}, // PS5 Disc Installer Patch 1\r\n    {0x2ea93c, \"\\xeb\", 1}, // PS4 PKG Installer Patch 1\r\n    {0x2eaa10, \"\\xeb\", 1}, // PS5 PKG Installer Patch 1\r\n    {0x2eadf7, \"\\x90\\xe9\", 2}, // PS4 PKG Installer Patch 2\r\n    {0x2eaf7f, \"\\xeb\", 1}, // PS5 PKG Installer Patch 2\r\n    {0x2eb33e, \"\\x90\\xe9\", 2}, // PS4 PKG Installer Patch 3\r\n    {0x2eb3d1, \"\\x90\\xe9\", 2}, // PS5 PKG Installer Patch 3\r\n    {0x6b438a, \"\\xeb\", 1}, // PS4 PKG Installer Patch 4\r\n    {0x6b71d4, \"\\xeb\", 1}, // PS5 PKG Installer Patch 4\r\n    {0x6ba660, \"\\x48\\x31\\xc0\\xc3\", 4}, // PKG Installer\r\n};\r\n\r\nstatic struct shellcore_patch shellcore_patches_860[] = {\r\n    {0xBAF84E, \"\\x52\\xeb\\x08\", 3}, //push rdx; jmp 0xBAF859 **\r\n    {0xBAF859, \"\\xe8\\xe2\\xf8\\xff\\xff\\x58\\xc3\", 7}, //call 0xBAF140; pop rax; ret\r\n    {0xBAF131, \"\\xe9\\xae\\xfd\\xff\\xff\", 5},  // jmp 0xBAEEE4 **\r\n    {0xBAEEE4, \"\\x31\\xc0\\x50\\xe8\\x54\\x02\\x00\\x00\\x58\\xc3\", 10}, //xor eax, eax; push rax; call 0xBAF140; pop rax; ret\r\n    {0x6B5503, \"\\xeb\\x04\", 2},\r\n    {0x2F1AD2, \"\\xeb\\x04\", 2},\r\n    {0x2F1F22, \"\\xeb\\x04\", 2},\r\n    {0x6D4A01, \"\\xeb\", 1},\r\n    {0x6BD745, \"\\x90\\xe9\", 2},\r\n    {0x6D574D, \"\\xeb\", 1},\r\n    {0x6D6CC9, \"\\x61\\x01\\x00\\x00\", 4}, // 0x6D6E2E **\r\n    {0x1f72e2, \"\\xe8\\xb9\\x69\\x5c\\x00\\x31\\xc9\\xff\\xc1\\xe9\\xb3\\x02\\x00\\x00\", 14}, // call 0x7BDCA0; xor ecx; inc ecx; jmp 0x1f75a3\r\n    {0x1f75a3, \"\\x83\\xf8\\x02\\x0f\\x43\\xc1\\xe9\\xa7\\xfb\\xff\\xff\", 11},//cmp eax, 2; cmovae eax, ecx; jmp 0x1F7155\r\n    {0x1f6f9e, \"\\xe9\\x3f\\x03\\x00\\x00\", 5}, // JMP 0x1f72e2\r\n\r\n\t{0x6F3700, \"\\xC3\", 1}, // callback to sceRifManagerRegisterActivationCallback\r\n\r\n    {0x1607A40, \"\\x31\\xc0\\xc3\", 3}, // VR2 Min Fw Check\r\n    {0xA33DC6, \"\\xeb\\x03\", 2}, // disable game error message\r\n    {0x2EA56B, \"\\x90\\xe9\", 2}, // PS4 Disc Installer Patch 1\r\n    {0x2EA5E9, \"\\x90\\xe9\", 2}, // PS5 Disc Installer Patch 1\r\n    {0x2EA6EC, \"\\xeb\", 1}, // PS4 PKG Installer Patch 1\r\n    {0x2EA7C0, \"\\xeb\", 1}, // PS5 PKG Installer Patch 1\r\n    {0x2EABA7, \"\\x90\\xe9\", 2}, // PS4 PKG Installer Patch 2\r\n    {0x2EAD2F, \"\\xeb\", 1}, // PS5 PKG Installer Patch 2\r\n    {0x2EB0EE, \"\\x90\\xe9\", 2}, // PS4 PKG Installer Patch 3\r\n    {0x2EB181, \"\\x90\\xe9\", 2}, // PS5 PKG Installer Patch 3\r\n    {0x6B421A, \"\\xeb\", 1}, // PS4 PKG Installer Patch 4\r\n    {0x6B7064, \"\\xeb\", 1}, // PS5 PKG Installer Patch 4\r\n    {0x6BA4F0, \"\\x48\\x31\\xc0\\xc3\", 4}, // PKG Installer\r\n};\r\n\r\nstatic struct shellcore_patch shellcore_patches_900[] = {\r\n    {0xC0F813, \"\\x52\\xeb\\xe2\", 3}, //push rdx; jmp 0xC0F7F8\r\n    {0xC0F7F8, \"\\xe8\\xe3\\xf8\\xff\\xff\\x58\\xc3\", 7}, //call 0xC0F0E0; pop rax; ret\r\n    {0xC0F0C6, \"\\xe9\\x06\\x00\\x00\\x00\", 5},  // jmp 0xC0F0D1\r\n    {0xC0F0D1, \"\\x31\\xc0\\x50\\xe8\\x07\\x00\\x00\\x00\\x58\\xc3\", 10}, //xor eax, eax; push rax; call 0xC0F0E0; pop rax; ret\r\n    {0x6F1C08, \"\\xeb\\x04\", 2},\r\n    {0x30E1CF, \"\\xeb\\x04\", 2},\r\n    {0x30E59F, \"\\xeb\\x04\", 2},\r\n    {0x7118CB, \"\\xeb\", 1},\r\n    {0x6FA165, \"\\x90\\xe9\", 2},\r\n    {0x712035, \"\\xeb\", 1},\r\n    {0x71401F, \"\\x61\\x01\\x00\\x00\", 4}, // 0x714184\r\n    {0x209DD1, \"\\xe8\\x0a\\x05\\x60\\x00\\x31\\xc9\\xff\\xc1\\xe9\\x84\\x03\\x00\\x00\", 14}, // call 0x80A2E0; xor ecx; inc ecx; jmp 0x20A163\r\n    {0x20A163, \"\\x83\\xf8\\x02\\x0f\\x43\\xc1\\xe9\\x01\\xf4\\xff\\xff\", 11},// cmp eax, 2; cmovae eax, ecx; jmp 0x20956F\r\n    {0x209371, \"\\xe9\\x5b\\x0a\\x00\\x00\", 5}, // jmp 0x209DD1\r\n\r\n\t{0x734300, \"\\xC3\", 1}, // callback to sceRifManagerRegisterActivationCallback\r\n\r\n    {0x16A4690, \"\\x31\\xc0\\xc3\", 3}, // VR2 Min Fw Check\r\n    {0xA8EA86, \"\\xeb\\x03\", 2}, // disable game error message\r\n    {0x3068EB, \"\\x90\\xe9\", 2}, // PS4 Disc Installer Patch 1\r\n    {0x306969, \"\\x90\\xe9\", 2}, // PS5 Disc Installer Patch 1\r\n    {0x306A6C, \"\\xeb\", 1}, // PS4 PKG Installer Patch 1\r\n    {0x306B40, \"\\xeb\", 1}, // PS5 PKG Installer Patch 1\r\n    {0x306F46, \"\\x90\\xe9\", 2}, // PS4 PKG Installer Patch 2\r\n    {0x3070ED, \"\\xeb\", 1}, // PS5 PKG Installer Patch 2\r\n    {0x3074AE, \"\\x90\\xe9\", 2}, // PS4 PKG Installer Patch 3\r\n    {0x307541, \"\\x90\\xe9\", 2}, // PS5 PKG Installer Patch 3\r\n    {0x6F088A, \"\\xeb\", 1}, // PS4 PKG Installer Patch 4\r\n    {0x6F37C4, \"\\xeb\", 1}, // PS5 PKG Installer Patch 4\r\n    {0x6F6E40, \"\\x48\\x31\\xc0\\xc3\", 4}, // PKG Installer\r\n};\r\n\r\nstatic struct shellcore_patch shellcore_patches_905[] = {\r\n    {0xC0F813, \"\\x52\\xeb\\xe2\", 3}, //push rdx; jmp 0xC0F7F8\r\n    {0xC0F7F8, \"\\xe8\\xe3\\xf8\\xff\\xff\\x58\\xc3\", 7}, //call 0xC0F0E0; pop rax; ret\r\n    {0xC0F0C6, \"\\xe9\\x06\\x00\\x00\\x00\", 5},  // jmp 0xC0F0D1\r\n    {0xC0F0D1, \"\\x31\\xc0\\x50\\xe8\\x07\\x00\\x00\\x00\\x58\\xc3\", 10}, //xor eax, eax; push rax; call 0xC0F0E0; pop rax; ret\r\n    {0x6F1C08, \"\\xeb\\x04\", 2},\r\n    {0x30E1CF, \"\\xeb\\x04\", 2},\r\n    {0x30E59F, \"\\xeb\\x04\", 2},\r\n    {0x7118CB, \"\\xeb\", 1},\r\n    {0x6FA165, \"\\x90\\xe9\", 2},\r\n    {0x712035, \"\\xeb\", 1},\r\n    {0x71401F, \"\\x61\\x01\\x00\\x00\", 4}, // 0x714184\r\n    {0x209DD1, \"\\xe8\\x0a\\x05\\x60\\x00\\x31\\xc9\\xff\\xc1\\xe9\\x84\\x03\\x00\\x00\", 14}, // call 0x80A2E0; xor ecx; inc ecx; jmp 0x20A163\r\n    {0x20A163, \"\\x83\\xf8\\x02\\x0f\\x43\\xc1\\xe9\\x01\\xf4\\xff\\xff\", 11},// cmp eax, 2; cmovae eax, ecx; jmp 0x20956F\r\n    {0x209371, \"\\xe9\\x5b\\x0a\\x00\\x00\", 5}, // jmp 0x209DD1\r\n\r\n\t{0x734300, \"\\xC3\", 1}, // callback to sceRifManagerRegisterActivationCallback\r\n\r\n    {0x16A4690, \"\\x31\\xc0\\xc3\", 3}, // VR2 Min Fw Check\r\n    {0xA8EA86, \"\\xeb\\x03\", 2}, // disable game error message\r\n    {0x3068EB, \"\\x90\\xe9\", 2}, // PS4 Disc Installer Patch 1\r\n    {0x306969, \"\\x90\\xe9\", 2}, // PS5 Disc Installer Patch 1\r\n    {0x306A6C, \"\\xeb\", 1}, // PS4 PKG Installer Patch 1\r\n    {0x306B40, \"\\xeb\", 1}, // PS5 PKG Installer Patch 1\r\n    {0x306F46, \"\\x90\\xe9\", 2}, // PS4 PKG Installer Patch 2\r\n    {0x3070ED, \"\\xeb\", 1}, // PS5 PKG Installer Patch 2\r\n    {0x3074AE, \"\\x90\\xe9\", 2}, // PS4 PKG Installer Patch 3\r\n    {0x307541, \"\\x90\\xe9\", 2}, // PS5 PKG Installer Patch 3\r\n    {0x6F088A, \"\\xeb\", 1}, // PS4 PKG Installer Patch 4\r\n    {0x6F37C4, \"\\xeb\", 1}, // PS5 PKG Installer Patch 4\r\n    {0x6F6E40, \"\\x48\\x31\\xc0\\xc3\", 4}, // PKG Installer\r\n};\r\n\r\nstatic struct shellcore_patch shellcore_patches_920[] = {\r\n    {0xC0F553, \"\\x52\\xeb\\xe2\", 3}, //push rdx; jmp 0xC0F538\r\n    {0xC0F538, \"\\xe8\\xe3\\xf8\\xff\\xff\\x58\\xc3\", 7}, //call 0xC0EE20; pop rax; ret\r\n    {0xC0EE06, \"\\xe9\\x06\\x00\\x00\\x00\", 5},  // jmp 0xC0EE11\r\n    {0xC0EE11, \"\\x31\\xc0\\x50\\xe8\\x07\\x00\\x00\\x00\\x58\\xc3\", 10}, //xor eax, eax; push rax; call 0xC0EE20; pop rax; ret\r\n    {0x6F1978, \"\\xeb\\x04\", 2},\r\n    {0x30DEEF, \"\\xeb\\x04\", 2},\r\n    {0x30E2BF, \"\\xeb\\x04\", 2},\r\n    {0x71160B, \"\\xeb\", 1},\r\n    {0x6F9EA5, \"\\x90\\xe9\", 2},\r\n    {0x711D75, \"\\xeb\", 1},\r\n    {0x713D5F, \"\\x61\\x01\\x00\\x00\", 4}, // 0x713EC4\r\n    {0x209DD1, \"\\xe8\\x4a\\x02\\x60\\x00\\x31\\xc9\\xff\\xc1\\xe9\\x84\\x03\\x00\\x00\", 14}, // call 0x80A020; xor ecx; inc ecx; jmp 0x20A163\r\n    {0x20A163, \"\\x83\\xf8\\x02\\x0f\\x43\\xc1\\xe9\\x01\\xf4\\xff\\xff\", 11},// cmp eax, 2; cmovae eax, ecx; jmp 0x20956F\r\n\t{0x209371, \"\\xe9\\x5b\\x0a\\x00\\x00\", 5}, // jmp 0x209DD1\r\n\r\n\t{0x734040, \"\\xC3\", 1}, // callback to sceRifManagerRegisterActivationCallback\r\n\r\n    {0x16A4D70, \"\\x31\\xc0\\xc3\", 3}, // VR2 Min Fw Check\r\n    {0xA8E7C6, \"\\xeb\\x03\", 2}, // disable game error message\r\n    {0x30660B, \"\\x90\\xe9\", 2}, // PS4 Disc Installer Patch 1\r\n    {0x306689, \"\\x90\\xe9\", 2}, // PS5 Disc Installer Patch 1\r\n    {0x30678C, \"\\xeb\", 1}, // PS4 PKG Installer Patch 1\r\n    {0x306860, \"\\xeb\", 1}, // PS5 PKG Installer Patch 1\r\n    {0x306C66, \"\\x90\\xe9\", 2}, // PS4 PKG Installer Patch 2\r\n    {0x306E0D, \"\\xeb\", 1}, // PS5 PKG Installer Patch 2\r\n    {0x3071CE, \"\\x90\\xe9\", 2}, // PS4 PKG Installer Patch 3\r\n    {0x307261, \"\\x90\\xe9\", 2}, // PS5 PKG Installer Patch 3\r\n    {0x6F05FA, \"\\xeb\", 1}, // PS4 PKG Installer Patch 4\r\n    {0x6F3534, \"\\xeb\", 1}, // PS5 PKG Installer Patch 4\r\n    {0x6F6B80, \"\\x48\\x31\\xc0\\xc3\", 4}, // PKG Installer\r\n};\r\n\r\nstatic struct shellcore_patch shellcore_patches_940[] = {\r\n    {0xC0FCA3, \"\\x52\\xeb\\xe2\", 3}, //push rdx; jmp 0xC0FC88\r\n    {0xC0FC88, \"\\xe8\\xe3\\xf8\\xff\\xff\\x58\\xc3\", 7}, //call 0xC0F570; pop rax; ret\r\n    {0xC0F556, \"\\xe9\\x06\\x00\\x00\\x00\", 5},  // jmp 0xC0F561\r\n    {0xC0F561, \"\\x31\\xc0\\x50\\xe8\\x07\\x00\\x00\\x00\\x58\\xc3\", 10}, //xor eax, eax; push rax; call 0xC0F570; pop rax; ret\r\n    {0x6F2048, \"\\xeb\\x04\", 2},\r\n    {0x30E5BF, \"\\xeb\\x04\", 2},\r\n    {0x30E98F, \"\\xeb\\x04\", 2},\r\n    {0x711CDB, \"\\xeb\", 1},\r\n    {0x6FA575, \"\\x90\\xe9\", 2},\r\n    {0x712445, \"\\xeb\", 1},\r\n    {0x71442F, \"\\x61\\x01\\x00\\x00\", 4}, // 0x714594\r\n    {0x1FCEB2, \"\\xe8\\x89\\xd8\\x60\\x00\\x31\\xc9\\xff\\xc1\\xe9\\xd2\\x01\\x00\\x00\", 14}, // call 0x80A740; xor ecx; inc ecx; jmp 0x1FD092\r\n    {0x1FD092, \"\\x83\\xf8\\x02\\x0f\\x43\\xc1\\xe9\\xa2\\xcb\\x00\\x00\", 11},// cmp eax, 2; cmovae eax, ecx; jmp 0x209C3F\r\n    {0x209A41, \"\\xe9\\x6c\\x34\\xff\\xff\", 5}, // jmp 0x1FCEB2\r\n\r\n\t{0x734710, \"\\xC3\", 1}, // callback to sceRifManagerRegisterActivationCallback\r\n\r\n    {0x16A5510, \"\\x31\\xc0\\xc3\", 3}, // VR2 Min Fw Check\r\n    {0xA8EF16, \"\\xeb\\x03\", 2}, // disable game error message\r\n    {0x306CDB, \"\\x90\\xe9\", 2}, // PS4 Disc Installer Patch 1\r\n    {0x306D59, \"\\x90\\xe9\", 2}, // PS5 Disc Installer Patch 1\r\n    {0x306E5C, \"\\xeb\", 1}, // PS4 PKG Installer Patch 1\r\n    {0x306F30, \"\\xeb\", 1}, // PS5 PKG Installer Patch 1\r\n    {0x307336, \"\\x90\\xe9\", 2}, // PS4 PKG Installer Patch 2\r\n    {0x3074DD, \"\\xeb\", 1}, // PS5 PKG Installer Patch 2\r\n    {0x30789E, \"\\x90\\xe9\", 2}, // PS4 PKG Installer Patch 3\r\n    {0x307931, \"\\x90\\xe9\", 2}, // PS5 PKG Installer Patch 3\r\n    {0x6F0CCA, \"\\xeb\", 1}, // PS4 PKG Installer Patch 4\r\n    {0x6F3C04, \"\\xeb\", 1}, // PS5 PKG Installer Patch 4\r\n    {0x6F7250, \"\\x48\\x31\\xc0\\xc3\", 4}, // PKG Installer\r\n};\r\n\r\nstatic struct shellcore_patch shellcore_patches_960[] = {\r\n    {0xC18073, \"\\x52\\xeb\\xe2\", 3}, //push rdx; jmp 0xC18058\r\n    {0xC18058, \"\\xe8\\xe3\\xf8\\xff\\xff\\x58\\xc3\", 7}, //call 0xC17940; pop rax; ret\r\n    {0xC17926, \"\\xe9\\x06\\x00\\x00\\x00\", 5},  // jmp 0xC17931\r\n    {0xC17931, \"\\x31\\xc0\\x50\\xe8\\x07\\x00\\x00\\x00\\x58\\xc3\", 10}, //xor eax, eax; push rax; call 0xC17940; pop rax; ret\r\n    {0x6F20B8, \"\\xeb\\x04\", 2},\r\n    {0x30E62F, \"\\xeb\\x04\", 2},\r\n    {0x30E9FF, \"\\xeb\\x04\", 2},\r\n    {0x711D4B, \"\\xeb\", 1},\r\n    {0x6FA5E5, \"\\x90\\xe9\", 2},\r\n    {0x7124B5, \"\\xeb\", 1},\r\n    {0x71449F, \"\\x61\\x01\\x00\\x00\", 4}, // 0x714604\r\n    {0x20A511, \"\\xe8\\xba\\x02\\x60\\x00\\x31\\xc9\\xff\\xc1\\xe9\\x84\\x03\\x00\\x00\", 14}, // call 0x80A7D0; xor ecx; inc ecx; jmp 0x20A8A3\r\n    {0x20A8A3, \"\\x83\\xf8\\x02\\x0f\\x43\\xc1\\xe9\\xe1\\xf3\\xff\\xff\", 11},// cmp eax, 2; cmovae eax, ecx; jmp 0x209C8F\r\n    {0x209A91, \"\\xe9\\x7b\\x0a\\x00\\x00\", 5}, // jmp 0x20A511\r\n\r\n    {0x734780, \"\\xC3\", 1}, // callback to sceRifManagerRegisterActivationCallback\r\n\r\n    {0x16AD8E0, \"\\x31\\xc0\\xc3\", 3}, // VR2 Min Fw Check\r\n    {0xA972E6, \"\\xeb\\x03\", 2}, // disable game error message\r\n    {0x306D4B, \"\\x90\\xe9\", 2}, // PS4 Disc Installer Patch 1\r\n    {0x306DC9, \"\\x90\\xe9\", 2}, // PS5 Disc Installer Patch 1\r\n    {0x306ECC, \"\\xeb\", 1}, // PS4 PKG Installer Patch 1\r\n    {0x306FA0, \"\\xeb\", 1}, // PS5 PKG Installer Patch 1\r\n    {0x3073A6, \"\\x90\\xe9\", 2}, // PS4 PKG Installer Patch 2\r\n    {0x30754D, \"\\xeb\", 1}, // PS5 PKG Installer Patch 2\r\n    {0x30790E, \"\\x90\\xe9\", 2}, // PS4 PKG Installer Patch 3\r\n    {0x3079A1, \"\\x90\\xe9\", 2}, // PS5 PKG Installer Patch 3\r\n    {0x6F0D3A, \"\\xeb\", 1}, // PS4 PKG Installer Patch 4\r\n    {0x6F3C74, \"\\xeb\", 1}, // PS5 PKG Installer Patch 4\r\n    {0x6F72C0, \"\\x48\\x31\\xc0\\xc3\", 4}, // PKG Installer\r\n};\r\n\r\nstatic struct shellcore_patch shellcore_patches_1000[] = {\r\n    {0xC03AC3, \"\\x52\\xeb\\xe2\", 3}, //push rdx; jmp 0xC03AA8\r\n    {0xC03AA8, \"\\xe8\\x33\\xf8\\xff\\xff\\x58\\xc3\", 7}, //call 0xC032E0; pop rax; ret\r\n    {0xC032C6, \"\\xe9\\x06\\x00\\x00\\x00\", 5},  // jmp 0xC032D1\r\n    {0xC032D1, \"\\x31\\xc0\\x50\\xe8\\x07\\x00\\x00\\x00\\x58\\xc3\", 10}, //xor eax, eax; push rax; call 0xC032E0; pop rax; ret\r\n    {0x702624, \"\\xeb\\x04\", 2},\r\n    {0x30D19F, \"\\xeb\\x04\", 2},\r\n    {0x30D56F, \"\\xeb\\x04\", 2},\r\n    {0x722365, \"\\xeb\", 1},\r\n    {0x70AF95, \"\\x90\\xe9\", 2},\r\n    {0x722AA3, \"\\xeb\", 1},\r\n    {0x724A3F, \"\\x61\\x01\\x00\\x00\", 4}, // 0x724BA4\r\n    {0x206C11, \"\\xe8\\x6a\\x72\\x60\\x00\\x31\\xc9\\xff\\xc1\\xe9\\xd4\\x01\\x00\\x00\", 14}, // call 0x80DE80; xor ecx; inc ecx; jmp 0x206DF3\r\n    {0x206DF3, \"\\x83\\xf8\\x02\\x0f\\x43\\xc1\\xe9\\x9e\\xf9\\xff\\xff\", 11},// cmp eax, 2; cmovae eax, ecx; jmp 0x20679C\r\n    {0x20675D, \"\\xe9\\xaf\\x04\\x00\\x00\", 5}, // jmp 0x206C11\r\n\r\n    {0x7460A0, \"\\xC3\", 1}, // callback to sceRifManagerRegisterActivationCallback\r\n\r\n    {0x16A1980, \"\\x31\\xc0\\xc3\", 3}, // VR2 Min Fw Check\r\n    {0xA86D73, \"\\xeb\\x03\", 2}, // disable game error message\r\n    {0x305790, \"\\x90\\xe9\", 2}, // PS4 Disc Installer Patch 1\r\n    {0x30580A, \"\\x90\\xe9\", 2}, // PS5 Disc Installer Patch 1\r\n    {0x30590C, \"\\xeb\", 1}, // PS4 PKG Installer Patch 1\r\n    {0x3059E0, \"\\xeb\", 1}, // PS5 PKG Installer Patch 1\r\n    {0x305DE7, \"\\x90\\xe9\", 2}, // PS4 PKG Installer Patch 2\r\n    {0x305F8F, \"\\xeb\", 1}, // PS5 PKG Installer Patch 2\r\n    {0x30633E, \"\\x90\\xe9\", 2}, // PS4 PKG Installer Patch 3\r\n    {0x3063D1, \"\\x90\\xe9\", 2}, // PS5 PKG Installer Patch 3\r\n    {0x700D28, \"\\xeb\", 1}, // PS4 PKG Installer Patch 4\r\n    {0x7041F2, \"\\xeb\", 1}, // PS5 PKG Installer Patch 4\r\n    {0x7078D0, \"\\x48\\x31\\xc0\\xc3\", 4}, // PKG Installer\r\n};\r\n\r\nstatic struct shellcore_patch shellcore_patches_1001[] = {\r\n    {0xC03AC3, \"\\x52\\xeb\\xe2\", 3}, //push rdx; jmp 0xC03AA8\r\n    {0xC03AA8, \"\\xe8\\x33\\xf8\\xff\\xff\\x58\\xc3\", 7}, //call 0xC032E0; pop rax; ret\r\n    {0xC032C6, \"\\xe9\\x06\\x00\\x00\\x00\", 5},  // jmp 0xC032D1\r\n    {0xC032D1, \"\\x31\\xc0\\x50\\xe8\\x07\\x00\\x00\\x00\\x58\\xc3\", 10}, //xor eax, eax; push rax; call 0xC032E0; pop rax; ret\r\n    {0x702624, \"\\xeb\\x04\", 2},\r\n    {0x30D19F, \"\\xeb\\x04\", 2},\r\n    {0x30D56F, \"\\xeb\\x04\", 2},\r\n    {0x722365, \"\\xeb\", 1},\r\n    {0x70AF95, \"\\x90\\xe9\", 2},\r\n    {0x722AA3, \"\\xeb\", 1},\r\n    {0x724A3F, \"\\x61\\x01\\x00\\x00\", 4}, // 0x724BA4\r\n    {0x206C11, \"\\xe8\\x6a\\x72\\x60\\x00\\x31\\xc9\\xff\\xc1\\xe9\\xd4\\x01\\x00\\x00\", 14}, // call 0x80DE80; xor ecx; inc ecx; jmp 0x206DF3\r\n    {0x206DF3, \"\\x83\\xf8\\x02\\x0f\\x43\\xc1\\xe9\\x9e\\xf9\\xff\\xff\", 11},// cmp eax, 2; cmovae eax, ecx; jmp 0x20679C\r\n    {0x20675D, \"\\xe9\\xaf\\x04\\x00\\x00\", 5}, // jmp 0x206C11\r\n\r\n    {0x7460A0, \"\\xC3\", 1}, // callback to sceRifManagerRegisterActivationCallback\r\n\r\n    {0x16A1980, \"\\x31\\xc0\\xc3\", 3}, // VR2 Min Fw Check\r\n    {0xA86D73, \"\\xeb\\x03\", 2}, // disable game error message\r\n    {0x305790, \"\\x90\\xe9\", 2}, // PS4 Disc Installer Patch 1\r\n    {0x30580A, \"\\x90\\xe9\", 2}, // PS5 Disc Installer Patch 1\r\n    {0x30590C, \"\\xeb\", 1}, // PS4 PKG Installer Patch 1\r\n    {0x3059E0, \"\\xeb\", 1}, // PS5 PKG Installer Patch 1\r\n    {0x305DE7, \"\\x90\\xe9\", 2}, // PS4 PKG Installer Patch 2\r\n    {0x305F8F, \"\\xeb\", 1}, // PS5 PKG Installer Patch 2\r\n    {0x30633E, \"\\x90\\xe9\", 2}, // PS4 PKG Installer Patch 3\r\n    {0x3063D1, \"\\x90\\xe9\", 2}, // PS5 PKG Installer Patch 3\r\n    {0x700D28, \"\\xeb\", 1}, // PS4 PKG Installer Patch 4\r\n    {0x7041F2, \"\\xeb\", 1}, // PS5 PKG Installer Patch 4\r\n    {0x7078D0, \"\\x48\\x31\\xc0\\xc3\", 4}, // PKG Installer\r\n};\r\n\r\nextern char _start[];\r\n\r\nstatic void relocate_shellcore_patches(struct shellcore_patch* patches, size_t n_patches)\r\n{\r\n    static uint64_t start_nonreloc = (uint64_t)_start;\r\n    uint64_t start = (uint64_t)_start;\r\n    for(size_t i = 0; i < n_patches; i++)\r\n        patches[i].data += start - start_nonreloc;\r\n}\r\n\r\nuint64_t get_eh_frame_offset(const char* path)\r\n{\r\n    int fd = open(path, O_RDONLY);\r\n    if(!fd)\r\n        return 0;\r\n    unsigned long long shit[4];\r\n    if(read(fd, shit, sizeof(shit)) != sizeof(shit))\r\n    {\r\n        close(fd);\r\n        return 0;\r\n    }\r\n    off_t o2 = 0x20*((shit[3]&0xffff)+1);\r\n    lseek(fd, o2, SEEK_SET);\r\n    unsigned long long ehdr[8];\r\n    if(read(fd, ehdr, sizeof(ehdr)) != sizeof(ehdr))\r\n    {\r\n        close(fd);\r\n        return 0;\r\n    }\r\n    off_t phdr_offset = o2 + ehdr[4];\r\n    int nphdr = ehdr[7] & 0xffff;\r\n    unsigned long long eh_frame = 0;\r\n    lseek(fd, phdr_offset, SEEK_SET);\r\n    for(int i = 0; i < nphdr; i++)\r\n    {\r\n        unsigned long long phdr[7];\r\n        if(read(fd, phdr, sizeof(phdr)) != sizeof(phdr))\r\n        {\r\n            close(fd);\r\n            return 0;\r\n        }\r\n        unsigned long long addr = phdr[2];\r\n        int ptype = phdr[0] & 0xffffffff;\r\n        if(ptype == 0x6474e550)\r\n            eh_frame = addr;\r\n    }\r\n    close(fd);\r\n    return eh_frame;\r\n}\r\n\r\nstatic const struct shellcore_patch* get_shellcore_patches(size_t* n_patches)\r\n{\r\n#ifdef FIRMWARE_PORTING\r\n    *n_patches = 1;\r\n    return 0;\r\n#endif\r\n#define FW(x)\\\r\n    case 0x ## x:\\\r\n        *n_patches = sizeof(shellcore_patches_ ## x) / sizeof(*shellcore_patches_ ## x);\\\r\n        patches = shellcore_patches_ ## x;\\\r\n        break\r\n    uint32_t ver = r0gdb_get_fw_version() >> 16;\r\n    struct shellcore_patch* patches;\r\n    switch(ver)\r\n    {\r\n    FW(300);\r\n    FW(310);\r\n    FW(320);\r\n    FW(321);\r\n    FW(400);\r\n    FW(402);\r\n    FW(403);\r\n    FW(450);\r\n    FW(451);\r\n    FW(500);\r\n    FW(502);\r\n    FW(510);\r\n    FW(550);\r\n    FW(600);\r\n    FW(602);\r\n    FW(650);\r\n    FW(700);\r\n    FW(701);\r\n    FW(720);\r\n    FW(740);\r\n    FW(760);\r\n    FW(761);\r\n    FW(800);\r\n    FW(820);\r\n    FW(840);\r\n    FW(860);\r\n    FW(900);\r\n    FW(905);\r\n    FW(920);\r\n    FW(940);\r\n    FW(960);\r\n    FW(1000);\r\n    FW(1001);\r\n    default:\r\n        *n_patches = 1;\r\n        return 0;\r\n    }\r\n#undef FW\r\n    relocate_shellcore_patches(patches, *n_patches);\r\n    return patches;\r\n}\r\n\r\nstatic int patch_shellcore(const struct shellcore_patch* patches, size_t n_patches, uint64_t eh_frame_offset)\r\n{\r\n    int pid = find_proc(\"SceShellCore\");\r\n    struct module_info_ex mod_info;\r\n    mod_info.st_size = sizeof(mod_info);\r\n    if (remote_syscall(pid, SYS_dynlib_get_info_ex, 0, 0, &mod_info))\r\n        return -1;\r\n    uint64_t shellcore_base = mod_info.eh_frame_hdr_addr - eh_frame_offset;\r\n    uint64_t textsize = mod_info.segments[0].size;\r\n    if (remote_syscall(pid, SYS_mlock, shellcore_base, textsize))\r\n        return -1;\r\n    uint64_t cr3, dmap;\r\n    if(get_proc_cr3(pid, &cr3, &dmap))\r\n        return -1;\r\n\r\n    for(int i = 0; i < n_patches; i++)\r\n    {\r\n        if(phys_copyin(shellcore_base + patches[i].offset, patches[i].data, patches[i].sz, dmap, cr3))\r\n            return -1;\r\n    }\r\n    return 0;\r\n}\r\n\r\nstatic void patch_shellcore_old(const struct shellcore_patch* patches, size_t n_patches, uint64_t eh_frame_offset)\r\n{\r\n    int pid = find_proc(\"SceShellCore\");\r\n    struct module_info_ex mod_info;\r\n    mod_info.st_size = sizeof(mod_info);\r\n    remote_syscall(pid, SYS_dynlib_get_info_ex, 0, 0, &mod_info);\r\n    uint64_t shellcore_base = mod_info.eh_frame_hdr_addr - eh_frame_offset;\r\n    for(int i = 0; i < n_patches; i++)\r\n    {\r\n        uint64_t arg1[4] = {1, 0x13};\r\n        uint64_t arg2[8] = {pid, shellcore_base + patches[i].offset, (uint64_t)patches[i].data, patches[i].sz};\r\n        uint64_t arg3[4] = {0};\r\n        kekcall((uint64_t)arg1, (uint64_t)arg2, (uint64_t)arg3, 0, 0, 0, SYS_mdbg_call);\r\n    }\r\n}\r\n\r\n#ifndef DEBUG\r\n#define dbg_enter()\r\n#define gdb_remote_syscall(...)\r\n#endif\r\n\r\nvoid patch_app_db(void);\r\n\r\n#ifdef FIRMWARE_PORTING\r\nstatic struct PARASITES(100) parasites_empty = {};\r\n#endif\r\n\r\nstatic struct PARASITES(12) parasites_300 = {\r\n    .lim_syscall = 3,\r\n    .lim_fself = 12,\r\n    .lim_total = 12,\r\n    .parasites = {\r\n        /* syscall parasites */\r\n        {-0x7e96ad, RDI},\r\n        {-0x38214c, RSI},\r\n        {-0x38210c, RSI},\r\n        /* fself parasites */\r\n        {-0x970280, RDI},\r\n        {-0x2c922a, RAX},\r\n        {-0x2c90f0, RAX},\r\n        {-0x2c8e0e, RAX},\r\n        {-0x2c8cc6, R10},\r\n        {-0x2c8b8d, RAX},\r\n        {-0x2c881e, RDX},\r\n        {-0x2c8812, RCX},\r\n        {-0x2c86a6, RAX},\r\n        /* unsorted parasites */\r\n    }\r\n};\r\n\r\nstatic struct PARASITES(12) parasites_310 = {\r\n    .lim_syscall = 3,\r\n    .lim_fself = 12,\r\n    .lim_total = 12,\r\n    .parasites = {\r\n        /* syscall parasites */\r\n        {-0x7e966d, RDI},\r\n        {-0x38210c, RSI},\r\n        {-0x3820cc, RSI},\r\n        /* fself parasites */\r\n        {-0x970280, RDI},\r\n        {-0x2c91ea, RAX},\r\n        {-0x2c90b0, RAX},\r\n        {-0x2c8dce, RAX},\r\n        {-0x2c8c86, R10},\r\n        {-0x2c8b4d, RAX},\r\n        {-0x2c87de, RDX},\r\n        {-0x2c87d2, RCX},\r\n        {-0x2c8666, RAX},\r\n        /* unsorted parasites */\r\n    }\r\n};\r\n\r\nstatic struct PARASITES(12) parasites_320 = {\r\n    .lim_syscall = 3,\r\n    .lim_fself = 12,\r\n    .lim_total = 12,\r\n    .parasites = {\r\n        /* syscall parasites */\r\n        {-0x7e931d, RDI},\r\n        {-0x381dbc, RSI},\r\n        {-0x381d7c, RSI},\r\n        /* fself parasites */\r\n        {-0x96ff40, RDI},\r\n        {-0x2c8e9a, RAX},\r\n        {-0x2c8d60, RAX},\r\n        {-0x2c8a7e, RAX},\r\n        {-0x2c8936, R10},\r\n        {-0x2c87fd, RAX},\r\n        {-0x2c848e, RDX},\r\n        {-0x2c8482, RCX},\r\n        {-0x2c8316, RAX},\r\n        /* unsorted parasites */\r\n    }\r\n};\r\n\r\nstatic struct PARASITES(12) parasites_321 = {\r\n    .lim_syscall = 3,\r\n    .lim_fself = 12,\r\n    .lim_total = 12,\r\n    .parasites = {\r\n        /* syscall parasites */\r\n        {-0x7e931d, RDI},\r\n        {-0x381dbc, RSI},\r\n        {-0x381d7c, RSI},\r\n        /* fself parasites */\r\n        {-0x96ff40, RDI},\r\n        {-0x2c8e9a, RAX},\r\n        {-0x2c8d60, RAX},\r\n        {-0x2c8a7e, RAX},\r\n        {-0x2c8936, R10},\r\n        {-0x2c87fd, RAX},\r\n        {-0x2c848e, RDX},\r\n        {-0x2c8482, RCX},\r\n        {-0x2c8316, RAX},\r\n        /* unsorted parasites */\r\n    }\r\n};\r\n\r\nstatic struct PARASITES(12) parasites_400 = {\r\n    .lim_syscall = 3,\r\n    .lim_fself = 12,\r\n    .lim_total = 12,\r\n    .parasites = {\r\n        /* syscall parasites */\r\n        {-0x80284d, RDI},\r\n        {-0x388a8c, RSI},\r\n        {-0x388a4c, RSI},\r\n        /* fself parasites */\r\n        {-0x990b10, RDI},\r\n        {-0x2cd36a, RAX},\r\n        {-0x2cd230, RAX},\r\n        {-0x2ccf53, RAX},\r\n        {-0x2cce16, R10},\r\n        {-0x2cccdd, RAX},\r\n        {-0x2cc96e, RDX},\r\n        {-0x2cc962, RCX},\r\n        {-0x2cc7f6, RAX},\r\n        /* unsorted parasites */\r\n    }\r\n};\r\n\r\nstatic struct PARASITES(12) parasites_402 = {\r\n    .lim_syscall = 3,\r\n    .lim_fself = 12,\r\n    .lim_total = 12,\r\n    .parasites = {\r\n        /* syscall parasites */\r\n        {-0x80284d, RDI},\r\n        {-0x388a3c, RSI},\r\n        {-0x3889fc, RSI},\r\n        /* fself parasites */\r\n        {-0x990b10, RDI},\r\n        {-0x2cd31a, RAX},\r\n        {-0x2cd1e0, RAX},\r\n        {-0x2ccf03, RAX},\r\n        {-0x2ccdc6, R10},\r\n        {-0x2ccc8d, RAX},\r\n        {-0x2cc91e, RDX},\r\n        {-0x2cc912, RCX},\r\n        {-0x2cc7a6, RAX},\r\n        /* unsorted parasites */\r\n    }\r\n};\r\n\r\nstatic struct PARASITES(14) parasites_403 = {\r\n    .lim_syscall = 3,\r\n    .lim_fself = 12,\r\n    .lim_total = 14,\r\n    .parasites = {\r\n        /* syscall parasites */\r\n        {-0x80284d, RDI},\r\n        {-0x3889ac, RSI},\r\n        {-0x38896c, RSI},\r\n        /* fself parasites */\r\n        {-0x2cc716, RAX},\r\n        {-0x2cd28a, RAX},\r\n        {-0x2cd150, RAX},\r\n        {-0x2cce73, RAX},\r\n        {-0x2ccbfd, RAX},\r\n        {-0x2cc88e, RDX},\r\n        {-0x2cc882, RCX},\r\n        {-0x990b10, RDI},\r\n        {-0x2ccd36, R10},\r\n        /* unsorted parasites */\r\n        {-0x479a0e, RAX},\r\n        {-0x479a0e, R15},\r\n    }\r\n};\r\n\r\nstatic struct PARASITES(14) parasites_450 = {\r\n    .lim_syscall = 3,\r\n    .lim_fself = 12,\r\n    .lim_total = 14,\r\n    .parasites = {\r\n        /* syscall parasites */\r\n        {-0x80281d, RDI},\r\n        {-0x38885c, RSI},\r\n        {-0x38881c, RSI},\r\n        /* fself parasites */\r\n        {-0x2cc566, RAX},\r\n        {-0x2cd0da, RAX},\r\n        {-0x2ccfa0, RAX},\r\n        {-0x2cccc3, RAX},\r\n        {-0x2cca4d, RAX},\r\n        {-0x2cc6de, RDX},\r\n        {-0x2cc6d2, RCX},\r\n        {-0x990b10, RDI},\r\n        {-0x2ccb86, R10},\r\n        /* unsorted parasites */\r\n        {-0x4798de, RAX},\r\n        {-0x4798de, R15},\r\n    }\r\n};\r\n\r\nstatic struct PARASITES(14) parasites_451 = {\r\n    .lim_syscall = 3,\r\n    .lim_fself = 12,\r\n    .lim_total = 14,\r\n    .parasites = {\r\n        /* syscall parasites */\r\n        {-0x80281d, RDI},\r\n        {-0x3884bc, RSI},\r\n        {-0x38847c, RSI},\r\n        /* fself parasites */\r\n        {-0x2cc1c6, RAX},\r\n        {-0x2ccd3a, RAX},\r\n        {-0x2ccc00, RAX},\r\n        {-0x2cc923, RAX},\r\n        {-0x2cc6ad, RAX},\r\n        {-0x2cc33e, RDX},\r\n        {-0x2cc332, RCX},\r\n        {-0x990b10, RDI},\r\n        {-0x2cc7e6, R10},\r\n        /* unsorted parasites */\r\n        {-0x47953e, RAX},\r\n        {-0x47953e, R15},\r\n    }\r\n};\r\n\r\nstatic struct PARASITES(14) parasites_500 = {\r\n    .lim_syscall = 3,\r\n    .lim_fself = 12,\r\n    .lim_total = 14,\r\n    .parasites = {\r\n        /* syscall parasites */\r\n        //{-0x845d3c, RDI},  //?\r\n        {-0x835D3C, R13}, // ? \r\n        {-0x39B0EC, RSI},\r\n        {-0x39B0AC, RSI},\r\n        /* fself parasites */\r\n        {-0x2DD156, RAX},\r\n        {-0x2DDCAA, RAX},\r\n        {-0x2DDB70, RAX},\r\n        {-0x2DD8D3, RAX},\r\n        {-0x2DD5ED, RAX},\r\n        {-0x2DD2CE, RDX},\r\n        {-0x2DD2C2, RCX},\r\n        {-0x9C6250, RDI},\r\n        {-0x2DD726, R10},\r\n        /* unsorted parasites */\r\n        {-0x48BD2E, RAX},\r\n        {-0x48BD2E, R15},\r\n    }\r\n};\r\n\r\n//Dont Have 5.02 Kernel Using Same As 5.00\r\nstatic struct PARASITES(14) parasites_502 = {\r\n    .lim_syscall = 3,\r\n    .lim_fself = 12,\r\n    .lim_total = 14,\r\n    .parasites = {\r\n        /* syscall parasites */\r\n        //{-0x845d3c, RDI},  //?\r\n        {-0x835D3C, R13}, // ? \r\n        {-0x39B0EC, RSI},\r\n        {-0x39B0AC, RSI},\r\n        /* fself parasites */\r\n        {-0x2DD156, RAX},\r\n        {-0x2DDCAA, RAX},\r\n        {-0x2DDB70, RAX},\r\n        {-0x2DD8D3, RAX},\r\n        {-0x2DD5ED, RAX},\r\n        {-0x2DD2CE, RDX},\r\n        {-0x2DD2C2, RCX},\r\n        {-0x9C6250, RDI},\r\n        {-0x2DD726, R10},\r\n        /* unsorted parasites */\r\n        {-0x48BD2E, RAX},\r\n        {-0x48BD2E, R15},\r\n    }\r\n};\r\n\r\nstatic struct PARASITES(14) parasites_510 = {\r\n    .lim_syscall = 3,\r\n    .lim_fself = 12,\r\n    .lim_total = 14,\r\n    .parasites = {\r\n        /* syscall parasites */\r\n        //{-0x845d3c, RDI},  //?\r\n        {-0x835d3c, R13}, // ? \r\n        {-0x39AF1C, RSI},\r\n        {-0x39AEDC, RSI},\r\n        /* fself parasites */\r\n        {-0x2DCF06, RAX},\r\n        {-0x2DDA5A, RAX},\r\n        {-0x2DD920, RAX},\r\n        {-0x2DD683, RAX},\r\n        {-0x2DD39D, RAX},\r\n        {-0x2DD07E, RDX},\r\n        {-0x2DD072, RCX},\r\n        {-0x9C6250, RDI},\r\n        {-0x2DD4D6, R10},\r\n        /* unsorted parasites */\r\n        {-0x48BB5E, RAX},\r\n        {-0x48BB5E, R15},\r\n    }\r\n};\r\n\r\nstatic struct PARASITES(14) parasites_550 = {\r\n    .lim_syscall = 3,\r\n    .lim_fself = 12,\r\n    .lim_total = 14,\r\n    .parasites = {\r\n        /* syscall parasites */\r\n        // {-0x845c8c, RDI},\r\n        {-0x835c8c, R13},\r\n        {-0x39a12c, RSI},\r\n        {-0x39a0ec, RSI},\r\n        /* fself parasites */\r\n        {-0x2dc116, RAX},\r\n        {-0x2dcc6a, RAX},\r\n        {-0x2dcb30, RAX},\r\n        {-0x2dc893, RAX},\r\n        {-0x2dc5ad, RAX},\r\n        {-0x2dc28e, RDX},\r\n        {-0x2dc282, RCX},\r\n        {-0x9c6290, RDI},\r\n        {-0x2dc6e6, R10},\r\n        /* unsorted parasites */\r\n        {-0x48ad6e, RAX},\r\n        {-0x48ad6e, R15},\r\n    }\r\n};\r\n\r\nstatic struct PARASITES(14) parasites_600 = {\r\n    .lim_syscall = 3,\r\n    .lim_fself = 12,\r\n    .lim_total = 14,\r\n    .parasites = {\r\n        /* syscall parasites */\r\n        //{-0x844fcc, RDI},\r\n        {-0x844fcc, R13},\r\n        {-0x39bb9c, RSI},\r\n        {-0x39bb5c, RSI},\r\n        /* fself parasites */\r\n        {-0x2da786, RAX},\r\n        {-0x2db2da, RAX},\r\n        {-0x2db1a0, RAX},\r\n        {-0x2daf03, RAX},\r\n        {-0x2dac1d, RAX},\r\n        {-0x2da8fe, RDX},\r\n        {-0x2da8f2, RCX},\r\n        {-0x9dcad0, RDI},\r\n        {-0x2dad56, R10},\r\n        /* unsorted parasites */\r\n        {-0x48feae, RAX},\r\n        {-0x48feae, R15},\r\n    }\r\n};\r\n\r\nstatic struct PARASITES(14) parasites_602 = {\r\n    .lim_syscall = 3,\r\n    .lim_fself = 12,\r\n    .lim_total = 14,\r\n    .parasites = {\r\n        /* syscall parasites */\r\n        //{-0x844fcc, RDI},\r\n        {-0x844fcc, R13},\r\n        {-0x39bbbc, RSI},\r\n        {-0x39bb7c, RSI},\r\n        /* fself parasites */\r\n        {-0x2da7a6, RAX},\r\n        {-0x2db2fa, RAX},\r\n        {-0x2db1c0, RAX},\r\n        {-0x2daf23, RAX},\r\n        {-0x2dac3d, RAX},\r\n        {-0x2da91e, RDX},\r\n        {-0x2da912, RCX},\r\n        {-0x9dcad0, RDI},\r\n        {-0x2dad76, R10},\r\n        /* unsorted parasites */\r\n        {-0x48fece, RAX},\r\n        {-0x48fece, R15},\r\n    }\r\n};\r\n\r\nstatic struct PARASITES(14) parasites_650 = {\r\n    .lim_syscall = 3,\r\n    .lim_fself = 12,\r\n    .lim_total = 14,\r\n    .parasites = {\r\n        /* syscall parasites */\r\n        //{-0x844fac, RDI},\r\n        {-0x844fac, R13},\r\n        {-0x39b92c, RSI},\r\n        {-0x39b8ec, RSI},\r\n        /* fself parasites */\r\n        {-0x2da016, RAX},\r\n        {-0x2dab6a, RAX},\r\n        {-0x2daa30, RAX},\r\n        {-0x2da793, RAX},\r\n        {-0x2da4ad, RAX},\r\n        {-0x2da18e, RDX},\r\n        {-0x2da182, RCX},\r\n        {-0x9dcad0, RDI},\r\n        {-0x2da5e6, R10},\r\n        /* unsorted parasites */\r\n        {-0x48fd0e, RAX},\r\n        {-0x48fd0e, R15},\r\n    }\r\n};\r\nstatic struct PARASITES(14) parasites_700 = {\r\n    .lim_syscall = 3,\r\n    .lim_fself = 12,\r\n    .lim_total = 14,\r\n    .parasites = {\r\n        /* syscall parasites */\r\n        //{-0x837AEC, RDI}, // ?\r\n        {-0x837AEC, R13},\r\n        {-0x3A400C, RSI},\r\n        {-0x3A3FCC, RSI},\r\n        /* fself parasites */\r\n        {-0x2E2EC6, RAX},\r\n        {-0x2E39FA, RAX},\r\n        {-0x2E38C0, RAX},\r\n        {-0x2E362B, RAX},\r\n        {-0x2E335D, RAX},\r\n        {-0x2E303E, RDX},\r\n        {-0x2E3032, RCX},\r\n        {-0x9CCCCC, RDI},\r\n        {-0x2E3496, R10},\r\n        /* unsorted parasites */\r\n        {-0x4918AE, RAX},\r\n        {-0x4918AE, R15},\r\n    }\r\n};\r\n\r\nstatic struct PARASITES(14) parasites_701 = {\r\n    .lim_syscall = 3,\r\n    .lim_fself = 12,\r\n    .lim_total = 14,\r\n    .parasites = {\r\n        /* syscall parasites */\r\n        //{-0x837AEC, RDI}, // ?\r\n        {-0x837AEC, R13}, \r\n        {-0x3A400C, RSI},\r\n        {-0x3A3FCC, RSI},\r\n        /* fself parasites */\r\n        {-0x2E2EC6, RAX},\r\n        {-0x2E39FA, RAX},\r\n        {-0x2E38C0, RAX},\r\n        {-0x2E362B, RAX},\r\n        {-0x2E335D, RAX},\r\n        {-0x2E303E, RDX},\r\n        {-0x2E3032, RCX},\r\n        {-0x9CCCCC, RDI},\r\n        {-0x2E3496, R10},\r\n        /* unsorted parasites */\r\n        {-0x4918AE, RAX},\r\n        {-0x4918AE, R15},\r\n    }\r\n};\r\n\r\nstatic struct PARASITES(14) parasites_720 = {\r\n    .lim_syscall = 3,\r\n    .lim_fself = 12,\r\n    .lim_total = 14,\r\n    .parasites = {\r\n        /* syscall parasites */\r\n        //{-0x8377EC, RDI}, // ?\r\n        {-0x8377EC, R13},\r\n        {-0x3A3D0C, RSI},\r\n        {-0x3A3CCC, RSI},\r\n        /* fself parasites */\r\n        {-0x2E2BC6, RAX},\r\n        {-0x2E36FA, RAX},\r\n        {-0x2E35C0, RAX},\r\n        {-0x2E332B, RAX},\r\n        {-0x2E305D, RAX},\r\n        {-0x2E2D3E, RDX},\r\n        {-0x2E2D32, RCX},\r\n        {-0x9CCA8C, RDI},\r\n        {-0x2E3196, R10},\r\n        /* unsorted parasites */\r\n        {-0x4915AE, RAX},\r\n        {-0x4915AE, R15},\r\n    }\r\n};\r\n\r\nstatic struct PARASITES(14) parasites_740 = {\r\n    .lim_syscall = 3,\r\n    .lim_fself = 12,\r\n    .lim_total = 14,\r\n    .parasites = {\r\n        /* syscall parasites */\r\n        //{-0x8377EC, RDI}, // ?\r\n        {-0x8377EC, R13}, \r\n        {-0x3A3D0C, RSI},\r\n        {-0x3A3CCC, RSI},\r\n        /* fself parasites */\r\n        {-0x2E2BC6, RAX},\r\n        {-0x2E36FA, RAX},\r\n        {-0x2E35C0, RAX},\r\n        {-0x2E332B, RAX},\r\n        {-0x2E305D, RAX},\r\n        {-0x2E2D3E, RDX},\r\n        {-0x2E2D32, RCX},\r\n        {-0x9CCA8C, RDI},\r\n        {-0x2E3196, R10},\r\n        /* unsorted parasites */\r\n        {-0x4915AE, RAX},\r\n        {-0x4915AE, R15},\r\n    }\r\n};\r\n\r\nstatic struct PARASITES(14) parasites_760 = {\r\n    .lim_syscall = 3,\r\n    .lim_fself = 12,\r\n    .lim_total = 14,\r\n    .parasites = {\r\n        /* syscall parasites */\r\n        //{-0x8377DC, RDI}, // ?\r\n        {-0x8377DC, R13},\r\n        {-0x3A3BCC, RSI},\r\n        {-0x3A3B8C, RSI},\r\n        /* fself parasites */\r\n        {-0x2E2A86, RAX},\r\n        {-0x2E35BA, RAX},\r\n        {-0x2E3480, RAX},\r\n        {-0x2E31EB, RAX},\r\n        {-0x2E2F1D, RAX},\r\n        {-0x2E2BFE, RDX},\r\n        {-0x2E2BF2, RCX},\r\n        {-0x9CCA8C, RDI},\r\n        {-0x2E3056, R10},\r\n        /* unsorted parasites */\r\n        {-0x49146E, RAX},\r\n        {-0x49146E, R15},\r\n    }\r\n};\r\n\r\nstatic struct PARASITES(14) parasites_761 = {\r\n    .lim_syscall = 3,\r\n    .lim_fself = 12,\r\n    .lim_total = 14,\r\n    .parasites = {\r\n        /* syscall parasites */\r\n        //{-0x8377DC, RDI}, // ?\r\n        {-0x8377DC, R13},  \r\n        {-0x3A3BCC, RSI},\r\n        {-0x3A3B8C, RSI},\r\n        /* fself parasites */\r\n        {-0x2E2A86, RAX},\r\n        {-0x2E35BA, RAX},\r\n        {-0x2E3480, RAX},\r\n        {-0x2E31EB, RAX},\r\n        {-0x2E2F1D, RAX},\r\n        {-0x2E2BFE, RDX},\r\n        {-0x2E2BF2, RCX},\r\n        {-0x9CCA8C, RDI},\r\n        {-0x2E3056, R10},\r\n        /* unsorted parasites */\r\n        {-0x49146E, RAX},\r\n        {-0x49146E, R15},\r\n    }\r\n};\r\n\r\nstatic struct PARASITES(14) parasites_800 = {\r\n    .lim_syscall = 3,\r\n    .lim_fself = 12,\r\n    .lim_total = 14,\r\n    .parasites = {\r\n        /* syscall parasites */\r\n        {-0x8574BE, R13},\r\n        {-0x3AE2BC, RSI},\r\n        {-0x3AE27C, RSI},\r\n        /* fself parasites */\r\n        {-0x2EC9F6, RAX},\r\n        {-0x2ED548, RAX},\r\n        {-0x2ED410, RAX},\r\n        {-0x2ED17B, RAX},\r\n        {-0x2ECEAD, RAX},\r\n\t{-0x2ECB76, RAX},\r\n\t{-0x2ECB6A, RAX},\r\n        {-0x9ED0EC, RDI},\r\n        {-0x2ECFE7, RAX},\r\n        /* unsorted parasites */\r\n        {-0x49D6BF, RAX},\r\n        {-0x49D6BF, R15},\r\n    }\r\n};\r\n\r\nstatic struct PARASITES(14) parasites_820 = {\r\n    .lim_syscall = 3,\r\n    .lim_fself = 12,\r\n    .lim_total = 14,\r\n    .parasites = {\r\n        /* syscall parasites */\r\n        {-0x85747E, R13},\r\n        {-0x3ACFBC, RSI},\r\n        {-0x3ACF7C, RSI},\r\n        /* fself parasites */\r\n        {-0x2EB6E6, RAX},\r\n        {-0x2EC238, RAX},\r\n        {-0x2EC100, RAX},\r\n        {-0x2EBE6B, RAX},\r\n        {-0x2EBB9D, RAX},\r\n        {-0x2EB866, RAX},\r\n        {-0x2EB85A, RAX},\r\n        {-0x9ED0EC, RDI},\r\n        {-0x2EBCD7, RAX},\r\n        /* unsorted parasites */\r\n        {-0x49C69F, RAX},\r\n        {-0x49C69F, R15},\r\n    }\r\n};\r\n\r\nstatic struct PARASITES(14) parasites_840 = {\r\n    .lim_syscall = 3,\r\n    .lim_fself = 12,\r\n    .lim_total = 14,\r\n    .parasites = {\r\n        /* syscall parasites */\r\n        {-0x85617E, R13},\r\n        {-0x3ACD2C, RSI},\r\n        {-0x3ACCEC, RSI},\r\n        /* fself parasites */\r\n        {-0x2EB456, RAX},\r\n        {-0x2EBFA8, RAX},\r\n        {-0x2EBE70, RAX},\r\n        {-0x2EBBDB, RAX},\r\n        {-0x2EB90D, RAX},\r\n        {-0x2EB5D6, RAX},\r\n        {-0x2EB5CA, RAX},\r\n        {-0x9EBDEC, RDI},\r\n        {-0x2EBA47, RAX},\r\n        /* unsorted parasites */\r\n        {-0x49C40F, RAX},\r\n        {-0x49C40F, R15},\r\n    }\r\n};\r\n\r\nstatic struct PARASITES(14) parasites_860 = {\r\n    .lim_syscall = 3,\r\n    .lim_fself = 12,\r\n    .lim_total = 14,\r\n    .parasites = {\r\n        /* syscall parasites */\r\n        {-0x85617E, R13},\r\n        {-0x3ACC9C, RSI},\r\n        {-0x3ACC5C, RSI},\r\n        /* fself parasites */\r\n        {-0x2EB276, RAX},\r\n        {-0x2EBDC8, RAX},\r\n        {-0x2EBC90, RAX},\r\n        {-0x2EB9FB, RAX},\r\n        {-0x2EB72D, RAX},\r\n        {-0x2EB3F6, RAX},\r\n        {-0x2EB3EA, RAX},\r\n        {-0x9EBDEC, RDI},\r\n        {-0x2EB867, RAX},\r\n        /* unsorted parasites */\r\n        {-0x49C37F, RAX},\r\n        {-0x49C37F, R15},\r\n    }\r\n};\r\n\r\nstatic struct PARASITES(14) parasites_900 = {\r\n    .lim_syscall = 3,\r\n    .lim_fself = 12,\r\n    .lim_total = 14,\r\n    .parasites = {\r\n        /* syscall parasites */\r\n        {-0x87E7BE, R13},\r\n        {-0x3BC35C, RSI},\r\n        {-0x3BC31C, RSI},\r\n        /* fself parasites */\r\n        {-0x2F9016, RAX},\r\n        {-0x2F9B68, RAX},\r\n        {-0x2F9A30, RAX},\r\n        {-0x2F979B, RAX},\r\n        {-0x2F94CD, RAX},\r\n        {-0x2F9196, RAX},\r\n        {-0x2F918A, RAX},\r\n        {-0xA1730C, RDI},\r\n        {-0x2F9607, RAX},\r\n        /* unsorted parasites */\r\n        {-0x4AEE0F, RAX},\r\n        {-0x4AEE0F, R15},\r\n    }\r\n};\r\n\r\nstatic struct PARASITES(14) parasites_905 = {\r\n    .lim_syscall = 3,\r\n    .lim_fself = 12,\r\n    .lim_total = 14,\r\n    .parasites = {\r\n        /* syscall parasites */\r\n        {-0x87E7BE, R13},\r\n        {-0x3BC12C, RSI},\r\n        {-0x3BC0EC, RSI},\r\n        /* fself parasites */\r\n        {-0x2F8DE6, RAX},\r\n        {-0x2F9938, RAX},\r\n        {-0x2F9800, RAX},\r\n        {-0x2F956B, RAX},\r\n        {-0x2F929D, RAX},\r\n        {-0x2F8F66, RAX},\r\n        {-0x2F8F5A, RAX},\r\n        {-0xA1730C, RDI},\r\n        {-0x2F93D7, RAX},\r\n        /* unsorted parasites */\r\n        {-0x4AECBF, RAX},\r\n        {-0x4AECBF, R15},\r\n    }\r\n};\r\n\r\nstatic struct PARASITES(14) parasites_920 = {\r\n    .lim_syscall = 3,\r\n    .lim_fself = 12,\r\n    .lim_total = 14,\r\n    .parasites = {\r\n        /* syscall parasites */\r\n        {-0x87E7CE, R13},\r\n        {-0x3BBEEC, RSI},\r\n        {-0x3BBEAC, RSI},\r\n        /* fself parasites */\r\n        {-0x2F8FF6, RAX},\r\n        {-0x2F9B48, RAX},\r\n        {-0x2F9A10, RAX},\r\n        {-0x2F977B, RAX},\r\n        {-0x2F94AD, RAX},\r\n        {-0x2F9176, RAX},\r\n        {-0x2F916A, RAX},\r\n        {-0xA1730C, RDI},\r\n        {-0x2F95E7, RAX},\r\n        /* unsorted parasites */\r\n        {-0x4AEA7F, RAX},\r\n        {-0x4AEA7F, R15},\r\n    }\r\n};\r\n\r\nstatic struct PARASITES(14) parasites_940 = {\r\n    .lim_syscall = 3,\r\n    .lim_fself = 12,\r\n    .lim_total = 14,\r\n    .parasites = {\r\n        /* syscall parasites */\r\n        {-0x87E63E, R13},\r\n        {-0x3BB97C, RSI},\r\n        {-0x3BB93C, RSI},\r\n        /* fself parasites */\r\n        {-0x2F8A86, RAX},\r\n        {-0x2F95D8, RAX},\r\n        {-0x2F94A0, RAX},\r\n        {-0x2F920B, RAX},\r\n        {-0x2F8F3D, RAX},\r\n        {-0x2F8C06, RAX},\r\n        {-0x2F8BFA, RAX},\r\n        {-0xA1730C, RDI},\r\n        {-0x2F9077, RAX},\r\n        /* unsorted parasites */\r\n        {-0x4AE59F, RAX},\r\n        {-0x4AE59F, R15},\r\n    }\r\n};\r\n\r\nstatic struct PARASITES(14) parasites_960 = {\r\n    .lim_syscall = 3,\r\n    .lim_fself = 12,\r\n    .lim_total = 14,\r\n    .parasites = {\r\n        /* syscall parasites */\r\n        {-0x87E60E, R13},\r\n        {-0x3BB79C, RSI},\r\n        {-0x3BB75C, RSI},\r\n        /* fself parasites */\r\n        {-0x2F88A6, RAX},\r\n        {-0x2F93F8, RAX},\r\n        {-0x2F92C0, RAX},\r\n        {-0x2F902B, RAX},\r\n        {-0x2F8D5D, RAX},\r\n        {-0x2F8A26, RAX},\r\n        {-0x2F8A1A, RAX},\r\n        {-0xA1730C, RDI},\r\n        {-0x2F8E97, RAX},\r\n        /* unsorted parasites */\r\n        {-0x4AE3DF, RAX},\r\n        {-0x4AE3DF, R15},\r\n    }\r\n};\r\n\r\nstatic struct PARASITES(14) parasites_1000 = {\r\n    .lim_syscall = 3,\r\n    .lim_fself = 12,\r\n    .lim_total = 14,\r\n    .parasites = {\r\n        /* syscall parasites */\r\n        {-0x894308, R13},\r\n        {-0x3BF480, RSI},\r\n        {-0x3BF440, RSI},\r\n        /* fself parasites */\r\n        {-0x2FC476, RAX},\r\n        {-0x2FCFDA, RAX},\r\n        //{-0x2FCE96, RAX},\r\n        {-0x2FCE96, RDX},\r\n        {-0x2FCC0B, RAX},\r\n        //{-0x2FC932, RAX},\r\n        {-0x2FC932, R10},\r\n        {-0x2FC5FA, RAX},\r\n        {-0x2FC5EE, RAX},\r\n        {-0xA32F8C, RDI},\r\n        {-0x2FCA77, RAX},\r\n        /* unsorted parasites */\r\n        {-0x4B5766, RAX},\r\n        {-0x4B5766, R15},\r\n    }\r\n};\r\n\r\nstatic struct PARASITES(14) parasites_1001 = {\r\n    .lim_syscall = 3,\r\n    .lim_fself = 12,\r\n    .lim_total = 14,\r\n    .parasites = {\r\n        /* syscall parasites */\r\n        {-0x894308, R13},\r\n        {-0x3BF480, RSI},\r\n        {-0x3BF440, RSI},\r\n        /* fself parasites */\r\n        {-0x2FC476, RAX},\r\n        {-0x2FCFDA, RAX},\r\n        //{-0x2FCE96, RAX},\r\n        {-0x2FCE96, RDX},\r\n        {-0x2FCC0B, RAX},\r\n        //{-0x2FC932, RAX},\r\n        {-0x2FC932, R10},\r\n        {-0x2FC5FA, RAX},\r\n        {-0x2FC5EE, RAX},\r\n        {-0xA32F8C, RDI},\r\n        {-0x2FCA77, RAX},\r\n        /* unsorted parasites */\r\n        {-0x4B5766, RAX},\r\n        {-0x4B5766, R15},\r\n    }\r\n};\r\n\r\nstatic struct parasite_desc* get_parasites(size_t* desc_size)\r\n{\r\n    uint32_t ver = r0gdb_get_fw_version() >> 16;\r\n    switch(ver)\r\n    {\r\n#ifndef FIRMWARE_PORTING\r\n    case 0x300:\r\n        *desc_size = sizeof(parasites_300);\r\n        return (void*)&parasites_300;\r\n    case 0x310:\r\n        *desc_size = sizeof(parasites_310);\r\n        return (void*)&parasites_310;\r\n    case 0x320:\r\n        *desc_size = sizeof(parasites_320);\r\n        return (void*)&parasites_320;\r\n    case 0x321:\r\n        *desc_size = sizeof(parasites_321);\r\n        return (void*)&parasites_321;\r\n    case 0x400:\r\n        *desc_size = sizeof(parasites_400);\r\n        return (void*)&parasites_400;\r\n    case 0x402:\r\n        *desc_size = sizeof(parasites_402);\r\n        return (void*)&parasites_402;\r\n    case 0x403:\r\n        *desc_size = sizeof(parasites_403);\r\n        return (void*)&parasites_403;\r\n    case 0x450:\r\n        *desc_size = sizeof(parasites_450);\r\n        return (void*)&parasites_450;\r\n    case 0x451:\r\n        *desc_size = sizeof(parasites_451);\r\n        return (void*)&parasites_451;\r\n    case 0x500:\r\n        *desc_size = sizeof(parasites_500);\r\n        return (void*)&parasites_500;\r\n    case 0x502:\r\n        *desc_size = sizeof(parasites_502);\r\n        return (void*)&parasites_502;\r\n    case 0x510:\r\n        *desc_size = sizeof(parasites_510);\r\n        return (void*)&parasites_510;\r\n    case 0x550:\r\n        *desc_size = sizeof(parasites_550);\r\n        return (void*)&parasites_550;\r\n    case 0x600:\r\n        *desc_size = sizeof(parasites_600);\r\n        return (void*)&parasites_600;\r\n    case 0x602:\r\n        *desc_size = sizeof(parasites_602);\r\n        return (void*)&parasites_602;\r\n    case 0x650:\r\n        *desc_size = sizeof(parasites_650);\r\n        return (void*)&parasites_650;\r\n    case 0x700:\r\n        *desc_size = sizeof(parasites_700);\r\n        return (void*)&parasites_700;\r\n    case 0x701:\r\n        *desc_size = sizeof(parasites_701);\r\n        return (void*)&parasites_701;\r\n    case 0x720:\r\n        *desc_size = sizeof(parasites_720);\r\n        return (void*)&parasites_720;\r\n    case 0x740:\r\n        *desc_size = sizeof(parasites_740);\r\n        return (void*)&parasites_740;\r\n    case 0x760:\r\n        *desc_size = sizeof(parasites_760);\r\n        return (void*)&parasites_760;\r\n    case 0x761:\r\n        *desc_size = sizeof(parasites_761);\r\n        return (void*)&parasites_761;\t\r\n    case 0x800:\r\n        *desc_size = sizeof(parasites_800);\r\n        return (void*)&parasites_800;\r\n    case 0x820:\r\n        *desc_size = sizeof(parasites_820);\r\n        return (void*)&parasites_820;\r\n    case 0x840:\r\n        *desc_size = sizeof(parasites_840);\r\n        return (void*)&parasites_840;\r\n    case 0x860:\r\n        *desc_size = sizeof(parasites_860);\r\n        return (void*)&parasites_860;\r\n    case 0x900:\r\n        *desc_size = sizeof(parasites_900);\r\n        return (void*)&parasites_900;\r\n    case 0x905:\r\n        *desc_size = sizeof(parasites_905);\r\n        return (void*)&parasites_905;\r\n    case 0x920:\r\n        *desc_size = sizeof(parasites_920);\r\n        return (void*)&parasites_920;\r\n    case 0x940:\r\n        *desc_size = sizeof(parasites_940);\r\n        return (void*)&parasites_940;\r\n    case 0x960:\r\n        *desc_size = sizeof(parasites_960);\r\n        return (void*)&parasites_960;\r\n    case 0x1000:\r\n        *desc_size = sizeof(parasites_1000);\r\n        return (void*)&parasites_1000;\r\n    case 0x1001:\r\n        *desc_size = sizeof(parasites_1001);\r\n        return (void*)&parasites_1001;\r\n    default:\r\n        return 0;\r\n#else\r\n    default:\r\n        *desc_size = sizeof(parasites_empty);\r\n        return (void*)&parasites_empty;\r\n#endif\r\n    }\r\n}\r\n\r\nstatic inline uint64_t rdtsc(void)\r\n{\r\n    uint32_t eax, edx;\r\n    asm volatile(\"rdtsc\":\"=a\"(eax),\"=d\"(edx)::\"memory\");\r\n    return (uint64_t)edx << 32 | eax;\r\n}\r\n\r\n//without kstuff = 2308259098\r\n//with kstuff and in-kelf checks = 86633419408 (37.5 times slower)\r\n//with kstuff and no in-kelf checks = 68129284331 (39.5 times slower)\r\nuint64_t bench(void)\r\n{\r\n    uint64_t start = rdtsc();\r\n    for(int i = 0; i < 1000000; i++)\r\n        getpid();\r\n    return rdtsc() - start;\r\n}\r\n\r\nint main(void* ds, int a, int b, uintptr_t c, uintptr_t d)\r\n{\r\n    if(r0gdb_init(ds, a, b, c, d))\r\n    {\r\n#ifndef FIRMWARE_PORTING\r\n        notify(\"your firmware is not supported (prosper0gdb)\");\r\n        return 1;\r\n#endif\r\n    }\r\n#ifdef PS5KEK\r\n    extern uint64_t p_syscall;\r\n    getpid();\r\n    p_kekcall = (void*)p_syscall;\r\n#else\r\n    p_kekcall = (char*)dlsym((void*)0x1, \"getpid\") + 7;\r\n#endif\r\n    if(!kekcall(0, 0, 0, 0, 0, 0, 0xffffffff00000027))\r\n    {\r\n        notify(\"ps5-kstuff is already loaded\");\r\n        return 1;\r\n    }\r\n    size_t desc_size = 0;\r\n    struct parasite_desc* desc = get_parasites(&desc_size);\r\n    if(!desc)\r\n    {\r\n        notify(\"your firmware is not supported (ps5-kstuff)\");\r\n        return 1;\r\n    }\r\n    size_t n_shellcore_patches;\r\n    uint64_t shellcore_eh_frame_offset = get_eh_frame_offset(\"/system/vsh/SceShellCore.elf\");\r\n    const struct shellcore_patch* shellcore_patches = get_shellcore_patches(&n_shellcore_patches);\r\n    if(n_shellcore_patches && !shellcore_patches)\r\n    {\r\n#ifdef FIRMWARE_PORTING\r\n        n_shellcore_patches = 0;\r\n#else\r\n        notify(\"your firmware is not supported (shellcore)\");\r\n        return 1;\r\n#endif\r\n    }\r\n#ifdef FIRMWARE_PORTING\r\n    dbg_enter();\r\n#endif\r\n    uint64_t percpu_ist4[NCPUS];\r\n    for(int cpu = 0; cpu < NCPUS; cpu++)\r\n        copyout(&percpu_ist4[cpu], TSS(cpu)+28+4*8, 8);\r\n    uint64_t int1_handler;\r\n    copyout(&int1_handler, IDT+16*1, 2);\r\n    copyout((char*)&int1_handler + 2, IDT+16*1+6, 6);\r\n    uint64_t int13_handler;\r\n    copyout(&int13_handler, IDT+16*13, 2);\r\n    copyout((char*)&int13_handler + 2, IDT+16*13+6, 6);\r\n#ifndef FIRMWARE_PORTING\r\n    dbg_enter();\r\n#endif\r\n    gdb_remote_syscall(\"write\", 3, 0, (uintptr_t)1, (uintptr_t)\"allocating kernel memory... \", (uintptr_t)28);\r\n    for(int i = 0; i < 0x300; i += 2)\r\n        r0gdb_kmalloc(0x100);\r\n    for(int i = 0; i < 2; i += 2)\r\n    {\r\n        while(!mem_blocks[i])\r\n            mem_blocks[i] = r0gdb_kmalloc(1<<23);\r\n        mem_blocks[i+1] = (mem_blocks[i] ? mem_blocks[i] + (1<<23) : 0);\r\n    }\r\n    gdb_remote_syscall(\"write\", 3, 0, (uintptr_t)1, (uintptr_t)\"done\\n\", (uintptr_t)5);\r\n    uint64_t comparison_table_base = (uint64_t)kmalloc(131072);\r\n    uint64_t comparison_table = ((comparison_table_base - 1) | 65535) + 1;\r\n    uint8_t* comparison_table_data = mmap(0, 65536, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANON, -1, 0);\r\n    for(size_t i = 0; i < 256; i++)\r\n        for(size_t j = 0; j < 256; j++)\r\n            comparison_table_data[256*i+j] = 8*(1+(i>j)-(i<j));\r\n    //trying to copyin the whole 64k at once hangs here for some reason\r\n    for(size_t i = 0; i < 256; i++)\r\n        copyin(comparison_table+256*i, comparison_table_data+256*i, 256);\r\n    uint64_t shared_area;\r\n    if(comparison_table - comparison_table_base > 4096)\r\n        shared_area = comparison_table - 4096;\r\n    else\r\n        shared_area = comparison_table + 65536;\r\n    kmemzero((void*)shared_area, 4096);\r\n    uint64_t uelf_virt_base = (find_empty_pml4_index(0) << 39) | (-1ull << 48);\r\n    uint64_t dmem_virt_base = (find_empty_pml4_index(1) << 39) | (-1ull << 48);\r\n    shared_area = virt2phys(shared_area,0,0,0) + dmem_virt_base;\r\n    uint64_t kelf_parasite_desc = (uint64_t)kmalloc(8192);\r\n    kelf_parasite_desc = ((kelf_parasite_desc - 1) | 4095) + 1;\r\n    for(int i = 0; i < desc->lim_total; i++)\r\n        desc->parasites[i].address += kdata_base;\r\n    kmemcpy((void*)kelf_parasite_desc, desc, desc_size);\r\n    uint64_t uelf_parasite_desc = virt2phys(kelf_parasite_desc,0,0,0) + dmem_virt_base;\r\n    volatile int zero = 0; //hack to force runtime calculation of string pointers\r\n    const char* symbols[] = {\r\n        \"comparison_table\"+zero,\r\n        \"dmem\"+zero,\r\n        \"parasites\"+zero,\r\n        \"parasites_kmem\"+zero,\r\n        \"int1_handler\"+zero,\r\n        \"int13_handler\"+zero,\r\n        \".ist_errc\"+zero,\r\n        \".ist_noerrc\"+zero,\r\n        \".ist4\"+zero,\r\n        \".pcpu\"+zero,\r\n        \"shared_area\"+zero,\r\n        \".tss\"+zero,\r\n        \".uelf_cr3\"+zero,\r\n        \".uelf_entry\"+zero,\r\n        \".fwver\"+zero,\r\n#define OFFSET(x) (#x)+zero,\r\n#include \"../prosper0gdb/offset_list.txt\"\r\n#undef OFFSET\r\n        0,\r\n    };\r\n\t\r\n    uint64_t fwver = r0gdb_get_fw_version() >> 16;\r\n    uint64_t values[] = {\r\n        comparison_table,      // comparison_table\r\n        dmem_virt_base,        // dmem\r\n        uelf_parasite_desc,    // parasites\r\n        kelf_parasite_desc,    // parasites_kmem\r\n        int1_handler,          // int1_handler\r\n        int13_handler,         // int13_handler\r\n        0x1237,                // .ist_errc\r\n        0x1238,                // .ist_noerrc\r\n        0x1239,                // .ist4\r\n        0x1234,                // .pcpu\r\n        shared_area,           // shared_area\r\n        0x123a,                // .tss\r\n        0x1235,                // .uelf_cr3\r\n        0x1236,                // .uelf_entry\r\n        fwver,                 // .fwver\r\n#define OFFSET(x) offsets.x,\r\n#include \"../prosper0gdb/offset_list.txt\"\r\n#undef OFFSET\r\n        0,\r\n    };\r\n    size_t pcpu_idx, uelf_cr3_idx, uelf_entry_idx, ist_errc_idx, ist_noerrc_idx, ist4_idx, tss_idx;\r\n    for(size_t i = 0; values[i]; i++)\r\n        switch(values[i])\r\n        {\r\n        case 0x1234: pcpu_idx = i; break;\r\n        case 0x1235: uelf_cr3_idx = i; break;\r\n        case 0x1236: uelf_entry_idx = i; break;\r\n        case 0x1237: ist_errc_idx = i; break;\r\n        case 0x1238: ist_noerrc_idx = i; break;\r\n        case 0x1239: ist4_idx = i; break;\r\n        case 0x123a: tss_idx = i; break;\r\n        }\r\n    uint64_t uelf_bases[NCPUS];\r\n    uint64_t kelf_bases[NCPUS];\r\n    uint64_t kelf_entries[NCPUS];\r\n    uint64_t uelf_cr3s[NCPUS];\r\n    for(int cpu = 0; cpu < NCPUS; cpu++)\r\n    {\r\n        char buf[] = \"loading on cpu ..\\n\";\r\n        if(cpu >= 10)\r\n        {\r\n            buf[15] = '1';\r\n            buf[16] = (cpu - 10) + '0';\r\n            gdb_remote_syscall(\"write\", 3, 0, (uintptr_t)1, (uintptr_t)buf, (uintptr_t)18);\r\n        }\r\n        else\r\n        {\r\n            buf[15] = cpu + '0';\r\n            buf[16] = '\\n';\r\n            gdb_remote_syscall(\"write\", 3, 0, (uintptr_t)1, (uintptr_t)buf, (uintptr_t)17);\r\n        }\r\n        values[pcpu_idx] = PCPU(cpu, fwver);\r\n        values[uelf_cr3_idx] = 0;\r\n        values[uelf_entry_idx] = 0;\r\n        values[ist_errc_idx] = TSS(cpu)+28+3*8;\r\n        values[ist_noerrc_idx] = TSS(cpu)+28+7*8;\r\n        values[ist4_idx] = percpu_ist4[cpu];\r\n        values[tss_idx] = TSS(cpu);\r\n        void* uelf_entry = 0;\r\n        void* uelf_base[2] = {0};\r\n        char* uelf = load_kelf(uek, symbols, values, uelf_base, &uelf_entry, uelf_virt_base);\r\n        uintptr_t uelf_cr3 = (uintptr_t)kmalloc(24576);\r\n        uelf_cr3 = ((uelf_cr3 + 4095) | 4095) - 4095;\r\n        uelf_cr3s[cpu] = uelf_cr3;\r\n        values[uelf_cr3_idx] = virt2phys(uelf_cr3,0,0,0);\r\n        values[uelf_entry_idx] = (uintptr_t)uelf_entry - (uintptr_t)uelf_base[0] + uelf_virt_base;\r\n        void* entry = 0;\r\n        void* base[2] = {0};\r\n        char* kelf = load_kelf(kek, symbols, values, base, &entry, 0);\r\n        build_uelf_cr3(uelf_cr3, uelf_base, uelf_virt_base, dmem_virt_base);\r\n        uelf_bases[cpu] = (uintptr_t)uelf;\r\n        kelf_bases[cpu] = (uint64_t)kelf;\r\n        kelf_entries[cpu] = (uint64_t)entry;\r\n    }\r\n    r0gdb_wrmsr(0xc0000084, r0gdb_rdmsr(0xc0000084) | 0x100);\r\n    gdb_remote_syscall(\"write\", 3, 0, (uintptr_t)1, (uintptr_t)\"done loading\\npatching idt... \", (uintptr_t)29);\r\n    uint64_t cr3 = r0gdb_read_cr3();\r\n    for(int cpu = 0; cpu < NCPUS; cpu++)\r\n    {\r\n        uint64_t entry = kelf_entries[cpu];\r\n        kmemcpy((char*)IDT+16*13, (char*)entry, 2);\r\n        kmemcpy((char*)IDT+16*13+6, (char*)entry+2, 6);\r\n        kmemcpy((char*)IDT+16*13+4, \"\\x03\", 1);\r\n        kmemcpy((char*)IDT+16*1, (char*)entry+16, 2);\r\n        kmemcpy((char*)IDT+16*1+6, (char*)entry+18, 6);\r\n        kmemcpy((char*)IDT+16*1+4, \"\\x07\", 1);\r\n        kmemcpy((char*)TSS(cpu)+28+3*8, (char*)entry+8, 8);\r\n        kmemcpy((char*)TSS(cpu)+28+7*8, (char*)entry+24, 8);\r\n    }\r\n    uint64_t iret = offsets.doreti_iret;\r\n    kmemcpy((char*)(IDT+16*2), (char*)&iret, 2);\r\n    kmemcpy((char*)(IDT+16*2+6), (char*)&iret+2, 6);\r\n    //kmemzero((char*)(IDT+16*1), 16);\r\n    gdb_remote_syscall(\"write\", 3, 0, (uintptr_t)1, (uintptr_t)\"done\\napplying kdata patches... \", (uintptr_t)31);\r\n    copyin(offsets.sysentvec + 14, &(const uint16_t[1]){0xdeb7}, 2); //native sysentvec\r\n    copyin(offsets.sysentvec_ps4 + 14, &(const uint16_t[1]){0xdeb7}, 2); //ps4 sysentvec\r\n    copyin(offsets.crypt_singleton_array + 11*8 + 2*8 + 6, &(const uint16_t[1]){0xdeb7}, 2); //crypt xts\r\n    copyin(offsets.crypt_singleton_array + 11*8 + 9*8 + 6, &(const uint16_t[1]){0xdeb7}, 2); //crypt hmac\r\n\r\n    if (fwver < 0x700)\t\t\t\t   \r\n    {\r\n        //enable debug settings & spoof target\r\n        uint32_t q = 0;\r\n        copyout(&q, offsets.security_flags, 4);\r\n        q |= 0x14;\r\n        copyin(offsets.security_flags, &q, 4);\r\n\t\tif(!sceKernelIsTestKit())\r\n            copyin(offsets.targetid, \"\\x82\", 1);\r\n        copyout(&q, offsets.qa_flags, 4);\r\n        q |= 0x1030300;\r\n        copyin(offsets.qa_flags, &q, 4);\r\n        copyout(&q, offsets.utoken, 4);\r\n        q |= 1;\r\n        copyin(offsets.utoken, &q, 4);\r\n    }\r\n    gdb_remote_syscall(\"write\", 3, 0, (uintptr_t)1, (uintptr_t)\"done\\npatching shellcore... \", (uintptr_t)27);\r\n    //restore the gdb_stub's SIGTRAP handler\r\n    struct sigaction sa;\r\n    sigaction(SIGBUS, 0, &sa);\r\n    sigaction(SIGTRAP, &sa, 0);\r\n#ifndef FIRMWARE_PORTING\r\n    sigaction(SIGPIPE, &sa, 0);\r\n#endif\r\n    copyin(IDT+16*9+5, \"\\x8e\", 1);\r\n    copyin(IDT+16*179+5, \"\\x8e\", 1);\r\n    if(!sceKernelIsTestKit())\r\n    {\r\n        if (patch_shellcore(shellcore_patches, n_shellcore_patches, shellcore_eh_frame_offset))\r\n            notify(\"failed to patch shellcore\");\r\n    }\r\n    gdb_remote_syscall(\"write\", 3, 0, (uintptr_t)1, (uintptr_t)\"done\\npatching app.db... \", (uintptr_t)24);\r\n    #ifndef FIRMWARE_PORTING\r\n    //patch_app_db();\r\n    #endif\r\n    gdb_remote_syscall(\"write\", 3, 0, (uintptr_t)1, (uintptr_t)\"done\\n\", (uintptr_t)5);\r\n    #ifndef DEBUG\r\n    //notify(\"ps5-kstuff successfully loaded\");\r\n    int major_bcd = (fwver >> 8) & 0xFF; \r\n    int minor_bcd = fwver & 0xFF;\r\n\r\n    int major = (major_bcd >> 4) * 10 + (major_bcd & 0xF);\r\n    int minor_dec = (minor_bcd >> 4) * 10 + (minor_bcd & 0xF);\r\n\r\n    char msg[64], *p = msg;\r\n    char *hdr = \"Welcome To Kstuff 1.6.7\\nPlayStation 5 FW: \";\r\n    while (*hdr) *p++ = *hdr++;\r\n\r\n    if (major >= 10) *p++ = '0' + major / 10;\r\n    *p++ = '0' + major % 10;\r\n\r\n    *p++ = '.';\r\n    *p++ = '0' + minor_dec / 10;\r\n    *p++ = '0' + minor_dec % 10;\r\n\t\r\n    char *ftr = \"\\nBy sleirsgoevy\";\r\n    while (*ftr) *p++ = *ftr++;\r\n    *p = 0;\r\n\r\n    notify(msg);\r\n    return 0;\r\n#endif\r\n    asm volatile(\"ud2\");\r\n    return 0;\r\n}\r\n\r\n\r\n\r\n\r\n"
  },
  {
    "path": "ps5-kstuff/old/fself.inc",
    "content": "extern decryptSelfBlock_epilogue\nextern decryptSelfBlock_watchpoint_lr\nextern loadSelfSegment_epilogue\nextern loadSelfSegment_watchpoint_lr\nextern mini_syscore_header\nextern sceSblSerivceIsLoadable2\nextern sceSblServiceMailbox\nextern sceSblServiceMailbox_lr_decryptSelfBlock\nextern sceSblServiceMailbox_lr_loadSelfSegment\nextern sceSblServiceMailbox_lr_verifyHeader\n\ndo_load_self_paid:\nmemcpy file_header, 0, 64\ndecrypt_pointer file_header+56\nmemcpy .copy2+iret_rsi, file_header+56, 8\nmemcpy .seek1+iret_rsi, file_header+56, 8\nmemcpy .seek2+iret_rsi, file_header+56, 8\n.copy2:\nmemcpy file_header, 0, 32\nmemcpy file_header+26, zero, 6\nmemcpy self_n_entries, file_header+24, 8\nmulq32 .seek1+iret_rcx, file_header+24\n.seek1:\nmemcpy0 scratchpad, 0, 0, doreti_iret\nsave_reg .copy3+iret_rsi, iret_rsi\nmemcpy .seek2+iret_rsi, .copy3+iret_rsi, 8\n.copy3:\nmemcpy file_header, 0, 96\nmemcpy file_header+32+58, zero, 6\nmulq56 file_header+32+56, file_header+32+56\naddq file_header+32+32, file_header+32+32, file_header+32+56\naddq .seek2+iret_rcx, file_header+32+32, num47\nandbi .seek2+iret_rcx, 0xf0\n.seek2:\nmemcpy0 scratchpad, 0, 0, doreti_iret\nsave_reg .copy4+iret_rsi, iret_rsi\nmemcpy self_ex_header, .copy4+iret_rsi, 8\n.copy4:\nmemcpy0 file_header, 0, 16, doreti_iret\ndq pop_all_iret\ndq 0x20\ndq 2\nload_self_paid_lr:\ndq 0\ndq 0\nnum47:\ndq 47\nself_n_entries:\ndq 0\nself_ex_header:\ndq 0\n\n; load_self_paid p_ctx\n%macro load_self_paid 1\nmemcpy do_load_self_paid+iret_rsi, (%1), 8\npokeq0 load_self_paid_lr, %%end_macro, doreti_iret\ndq pop_all_iret\ndq 0x20\ndq 2\ndq do_load_self_paid\ndq 0\n%%end_macro:\n%endmacro\n\nhandle_fself_syscall:\n; fix up rsi for the original syscall\nptr_add_imm regs_stash+iret_rsi, iret_frame+24, syscall_rsp_to_rsi\n; read and save current debug registers\nread_dbgregs\nmemcpy dbgreg_copyout_frame_dbgregs, dbgregs, 48\n; set up a stack frame to restore them on return\npokeq dbgreg_copyout_frame_rip, 0xde00ad0000000002\n; push old debug registers\npush_stack dbgreg_copyout_frame_dbgregs, dbgreg_copyout_frame_end-dbgreg_copyout_frame_dbgregs\n; save stack pointer, we don't want them popped\nmemcpy dbgreg_copyout_frame_rsp, iret_frame+24, 8\n; push the rest of the stack frame\npush_stack dbgreg_copyout_frame, dbgreg_copyout_frame_dbgregs-dbgreg_copyout_frame\n; load modified debug registers\nmemcpy dbgregs, dbgregs_for_fself_syscall, 48\nwrite_dbgregs\n; this thread is now using debug registers\nset_pcb_dbregs\n; call the original syscall\nmemcpy_from_offset iret_frame, regs_stash+iret_rax, 8, 8\ntimes iret_rip db 0\ndq pop_all_iret\ndq 0x20\ndq 2\ndq decrypt_end\ndq 0\n\ndbgregs_for_fself_syscall:\ndq sceSblServiceMailbox\ndq sceSblServiceIsLoadable2\ndq 0\ndq 0\ndq 0\ndq 0x405\n\n;dbgregs_for_execve:\n;dq sceSblServiceIsLoadable2\n;dq kdata_base - 0x2cd321\n;dq 0\n;dq 0\n;dq 0\n;dq 0x405\n;\n;handle_2cd321:\n;memcpy .peek+iret_rsi, regs_stash+iret_r14, 8\n;.peek:\n;memcpy file_header, 0, 0x88\n;pokeq iret_frame, 0xffff0000\n;log_word file_header\n;pokeq iret_frame, 0xffff0008\n;log_word file_header+8\n;pokeq iret_frame, 0xffff0010\n;log_word file_header+16\n;pokeq iret_frame, 0xffff0018\n;log_word file_header+24\n;pokeq iret_frame, 0xffff0020\n;log_word file_header+32\n;pokeq iret_frame, 0xffff0028\n;log_word file_header+40\n;pokeq iret_frame, 0xffff0030\n;log_word file_header+48\n;pokeq iret_frame, 0xffff0038\n;log_word file_header+56\n;pokeq iret_frame, 0xffff0040\n;log_word file_header+64\n;pokeq iret_frame, 0xffff0048\n;log_word file_header+72\n;pokeq iret_frame, 0xffff0050\n;log_word file_header+80\n;pokeq iret_frame, 0xffff0058\n;log_word file_header+88\n;pokeq iret_frame, 0xffff0060\n;log_word file_header+96\n;pokeq iret_frame, 0xffff0068\n;log_word file_header+104\n;pokeq iret_frame, 0xffff0070\n;log_word file_header+112\n;pokeq iret_frame, 0xffff0078\n;log_word file_header+120\n;pokeq iret_frame, 0xffff0080\n;log_word file_header+128\n;pokeq0 iret_frame, kdata_base - 0x2cd321, doreti_iret\n;dq pop_all_iret\n;dq 0x20\n;dq 2\n;dq decrypt_end\n;dq 0\n\nhandle_sceSblServiceMailbox:\nmemcpy .stack_peek+iret_rsi, iret_frame+24, 8\n.stack_peek:\nmemcpy .lr, 0, 8\nif_equal cmpqibe, .lr, sceSblServiceMailbox_lr_decryptSelfBlock, handle_sceSblServiceMailbox_decryptSelfBlock\nif_equal cmpqibe, .lr, sceSblServiceMailbox_lr_loadSelfSegment, handle_sceSblServiceMailbox_loadSelfSegment\ncmpqibe .lr, sceSblServiceMailbox_lr_verifyHeader, decrypt_end, handle_sceSblServiceMailbox_verifyHeader, decrypt_end\n.lr:\ndq 0\n\nhandle_sceSblServiceMailbox_verifyHeader:\nload_self_paid regs_stash+iret_r14\nif_not_equal cmpqibe, self_paid, 1, decrypt_end\nmemcpy .peek1+iret_rsi, regs_stash+iret_r14, 8\n.peek1:\nmemcpy file_header, 0, 64\nmemcpy .peek2+iret_rsi, file_header+56, 8\nmemcpy .poke+iret_rdi, file_header+56, 8\n.peek2:\nmemcpy fself_header_backup, 0, mini_syscore_header_size\npush_stack fself_header_backup, fself_header_backup_end-fself_header_backup\nmemcpy fself_header_stack_push_cs, iret_frame+8, 32\npush_stack fself_header_stack_push, fself_header_backup-fself_header_stack_push\nmemcpy_offset regs_stash+iret_rdx, 16, .mini_syscore_header_size, 4\n.poke:\nmemcpy0 0, mini_syscore_header, mini_syscore_header_size, doreti_iret\ndq pop_all_iret\ndq 0x20\ndq 2\ndq decrypt_end\ndq 0\n.mini_syscore_header_size:\ndq mini_syscore_header_size\n\nhandle_sceSblServiceMailbox_verifyHeader_return:\npop_stack fself_header_backup, fself_header_backup_end-fself_header_backup\npop_stack iret_frame, 8\nmemcpy .peek1+iret_rsi, regs_stash+iret_r14, 8\n.peek1:\nmemcpy file_header, 0, 64\nmemcpy .poke+iret_rdi, file_header+56, 8\n.poke:\nmemcpy0 0, fself_header_backup, mini_syscore_header_size, doreti_iret\ndq pop_all_iret\ndq 0x20\ndq 2\ndq decrypt_end\ndq 0\n\nhandle_sceSblServiceIsLoadable2:\nload_self_paid regs_stash+iret_rdi\nif_not_equal cmpqibe, self_paid, 1, decrypt_end\nmemcpy_offset regs_stash+iret_rdi, 0x3e, .death, 2\npop_stack iret_frame, 8\npokeq regs_stash+iret_rax, 0\nmemcpy .poke1+iret_rdi, regs_stash+iret_r8, 8\nmemcpy .poke2+iret_rdi, regs_stash+iret_r8, 8\nmemcpy .poke3+iret_rdi, regs_stash+iret_r8, 8\n; try loading auth info from the file\nmulq80 .late_entries_size, self_n_entries\naddq .ptr_signature, self_ex_header, .late_entries_size\nptr_add_imm .sig_peek+iret_rsi, .ptr_signature, 0xc0\n.sig_peek:\nmemcpy signature, 0, 0x90\n; if it is valid, stick with that\nif_equal cmpqibe, signature, 0x88, .poke3\n; otherwise, load dynlib auth info if we are an sprx\nif_equal cmpwibe, elf_e_type, 0xfe18, .poke2\n; otherwise, load exec auth info\n.poke1:\nmemcpy0 0, s_auth_info_for_exec, s_auth_info_for_exec_end-s_auth_info_for_exec, doreti_iret\ndq pop_all_iret\ndq 0x20\ndq 2\ndq decrypt_end\ndq 0\n.poke2:\nmemcpy0 0, s_auth_info_for_dynlib, s_auth_info_for_dynlib_end-s_auth_info_for_dynlib, doreti_iret\ndq pop_all_iret\ndq 0x20\ndq 2\ndq decrypt_end\ndq 0\n.poke3:\nmemcpy0 0, signature+8, 0x88, doreti_iret\ndq pop_all_iret\ndq 0x20\ndq 2\ndq decrypt_end\ndq 0\n.death:\ndq 0xdeb7\n.late_entries_size:\ndq 0\n.ptr_signature:\ndq 0\nhandle_loadSelfSegment_parasite:\ndecrypt_pointer regs_stash+iret_r10\nmemcpy .peek+iret_rsi, iret_frame+24, 8\n.peek:\nmemcpy parasite_push, 0, parasite_dbgregs-parasite_push\nif_not_equal cmpqibe, parasite_lr, loadSelfSegment_watchpoint_lr, decrypt_end\npop_stack parasite_push, parasite_dbgregs-parasite_push\nread_dbgregs\nmemcpy parasite_dbgregs, dbgregs, 48\nmemcpy dbgregs, dbgregs_for_loadSelfSegment, 48\nwrite_dbgregs\n; this thread is now using debug registers\nset_pcb_dbregs\npush_stack parasite_push, parasite_push_end-parasite_push\ntimes iret_rip db 0\ndq pop_all_iret\ndq 0x20\ndq 2\ndq decrypt_end\ndq 0\n\ndbgregs_for_loadSelfSegment:\ndq sceSblServiceMailbox\ndq loadSelfSegment_epilogue\ndq 0\ndq 0\ndq 0\ndq 0x405\n\nhandle_loadSelfSegment_return:\nhandle_decryptSelfBlock_return:\npop_stack dbgregs, 48\nwrite_dbgregs\ntimes iret_rip db 0\ndq pop_all_iret\ndq 0x20\ndq 2\ndq decrypt_end\ndq 0\n\nhandle_sceSblServiceMailbox_loadSelfSegment:\nload_self_paid regs_stash+iret_rbx\nif_not_equal cmpqibe, self_paid, 1, decrypt_end\npop_stack iret_frame, 8\nmemcpy_offset regs_stash+iret_rdx, 4, zero, 4\nmemcpy0 regs_stash+iret_rax, zero, 8, doreti_iret\ndq pop_all_iret\ndq 0x20\ndq 2\ndq decrypt_end\ndq 0\n\nhandle_sceSblServiceMailbox_decryptSelfBlock:\nmemcpy_from_neg_offset .self_context, regs_stash+iret_rbp, sceSblServiceMailbox_decryptSelfBlock_rsp_to_rbp-sceSblServiceMailbox_decryptSelfBlock_rsp_to_self_context, 8\nload_self_paid .self_context\nif_not_equal cmpqibe, self_paid, 1, decrypt_end\nmemcpy_from_neg_offset .copy+iret_rdi, regs_stash+iret_rbp, sceSblServiceMailbox_decryptSelfBlock_rsp_to_rbp-sceSblServiceMailbox_decryptSelfBlock_rsp_to_target_va, 8\nmemcpy .peek+iret_rsi, regs_stash+iret_rdx, 8\n.peek:\nmemcpy .request, 0, 56\nsubq .request, .copy+iret_rdi, .request+8\naddq .copy+iret_rsi, .request, .request+16\nmemcpy .copy+iret_rcx, .request+48, 4\n.copy:\nmemcpy 0, 0, 0\npop_stack iret_frame, 8\nmemcpy_offset regs_stash+iret_rdx, 4, zero, 4\nmemcpy0 regs_stash+iret_rax, zero, 8, doreti_iret\ndq pop_all_iret\ndq 0x20\ndq 2\ndq decrypt_end\ndq 0\n.self_context:\ndq 0\n.request:\ntimes 7 dq 0\n\nhandle_decryptSelfBlock_parasite:\ndecrypt_pointer regs_stash+iret_rdx\nmemcpy .peek+iret_rsi, iret_frame+24, 8\n.peek:\nmemcpy parasite_push, 0, parasite_dbgregs-parasite_push\nif_not_equal cmpqibe, parasite_lr, decryptSelfBlock_watchpoint_lr, decrypt_end\nread_dbgregs\nmemcpy parasite_dbgregs, dbgregs, 48\npop_stack parasite_push, parasite_dbgregs-parasite_push\npush_stack parasite_push, parasite_push_end-parasite_push\nmemcpy dbgregs, dbgregs_for_decryptSelfBlock, 48\nwrite_dbgregs\n; this thread is now using debug registers\nset_pcb_dbregs\ntimes iret_rip db 0\ndq pop_all_iret\ndq 0x20\ndq 2\ndq decrypt_end\ndq 0\n\ndbgregs_for_decryptSelfBlock:\ndq sceSblServiceMailbox\ndq decryptSelfBlock_epilogue\ndq 0\ndq 0\ndq 0\ndq 0x405\n\ns_auth_info_for_exec:\ndq 0x4400001084c2052d, 0x2000038000000000, 0x000000000000ff00, 0x0000000000000000, 0x0000000000000000, 0x4000400040000000, 0x4000000000000000, 0x0080000000000002, 0xf0000000ffff4000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000\ns_auth_info_for_exec_end:\n\ns_auth_info_for_dynlib:\ndq 0x4900000000000002, 0x0000000000000000, 0x800000000000ff00, 0x0000000000000000, 0x0000000000000000, 0x7000700080000000, 0x8000000000000000, 0x0000000000000000, 0xf0000000ffff4000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000\ns_auth_info_for_dynlib_end:\n\nfile_header:\ntimes 8 db 0\nself_paid:\ntimes 40 db 0\nelf_e_type:\ntimes 80 db 0\ndq 0\n\nsignature:\ntimes 18 dq 0\n\nalign 16\nfself_header_stack_push:\ndq doreti_iret\ndq 0xde01ad0000000001\nfself_header_stack_push_cs:\ndq 0x20\ndq 0x202\ndq 0\ndq 0\nfself_header_backup:\ntimes mini_syscore_header_size db 0\nalign 16\nfself_header_backup_end:\ndq 0\n\nparasite_push:\ntimes 3 dq 0\nparasite_lr:\ndq 0\nparasite_dbgregs:\ntimes 6 dq 0\nparasite_push_end:\n"
  },
  {
    "path": "ps5-kstuff/old/fself_hooks.inc",
    "content": "extern decryptSelfBlock_epilogue\nextern decryptSelfBlock_watchpoint\nextern loadSelfSegment_epilogue\nextern loadSelfSegment_watchpoint\nextern sceSblServiceIsLoadable2\nextern sceSblServiceMailbox\n\non_rip sceSblServiceMailbox, handle_sceSblServiceMailbox\non_rip sceSblServiceIsLoadable2, handle_sceSblServiceIsLoadable2\n\n; r10 non-parasite\non_rip loadSelfSegment_watchpoint, handle_loadSelfSegment_parasite\n\n; loadSelfSegment return cleanup\non_rip loadSelfSegment_epilogue, handle_loadSelfSegment_return\n\n; rdx non-parasite\non_rip decryptSelfBlock_watchpoint, handle_decryptSelfBlock_parasite\n\n; decryptSelfBlock return cleanup\non_rip decryptSelfBlock_epilogue, handle_decryptSelfBlock_return\n\non_rip 0xde01ad0000000001, handle_sceSblServiceMailbox_verifyHeader_return\n"
  },
  {
    "path": "ps5-kstuff/old/fself_syscalls.inc",
    "content": "%define SYS_execve 59\n%define SYS_dynlib_load_prx 594\n%define SYS_get_self_auth_info 607\n%define SYS_get_sdk_compiled_version 647\n%define SYS_get_ppr_sdk_compiled_version 713\n;if_equal cmpqibe, scratchpad+0xffff8, 1234, handle_fself_syscall\nif_equal cmpqibe, regs_stash+iret_rax, sysents+48*SYS_execve, handle_fself_syscall\nif_equal cmpqibe, regs_stash+iret_rax, sysents+48*SYS_dynlib_load_prx, handle_fself_syscall\nif_equal cmpqibe, regs_stash+iret_rax, sysents+48*SYS_get_self_auth_info, handle_fself_syscall\nif_equal cmpqibe, regs_stash+iret_rax, sysents+48*SYS_get_sdk_compiled_version, handle_fself_syscall\nif_equal cmpqibe, regs_stash+iret_rax, sysents+48*SYS_get_ppr_sdk_compiled_version, handle_fself_syscall\n"
  },
  {
    "path": "ps5-kstuff/old/kek.asm",
    "content": "use64\n\nextern syscall_before\nextern sysents\nextern syscall_after\nextern rep_movsb_pop_rbp_ret\nextern doreti_iret\nextern push_pop_all_iret\nextern pop_all_iret\nextern pop_all_except_rdi_iret\nextern add_rsp_iret\nextern dr2gpr_start\nextern dr2gpr_end\nextern gpr2dr_1_start\nextern gpr2dr_1_end\nextern gpr2dr_2_start\nextern gpr2dr_2_end\nextern rdmsr_start\nextern rdmsr_end\nextern scratchpad\nextern copyin\nextern copyout\nextern pcpu\n\n; global variables break the loader\n;global log_area\n;global log_area_cur\n\nextern soo_ioctl\n\n%define SYS_getppid 39\n%define SYS_ioctl 54\n\n%include \"structs.inc\"\n\nglobal _start\n\n_start:\n; fake 16-byte header for the loader\ndq add_rsp_iret\ndq iret_stack\n\nalign 16\niret_errc:\ndq 0 ; error code pushed by cpu\niret_frame:\ntimes 5 dq 0\niret_stack:\ntimes (iret_rip-(iret_stack-iret_errc)) db 0\ndq push_pop_all_iret\ndq 0x20\ndq 2\ndq regs_stash_exit\ndq 0\n\n; reserve some space for the push gadget's stack\ntimes 128 db 0\n\nregs_stash:\ntimes iret_rip db 0\nregs_stash_exit:\ndq pop_all_iret\ndq 0x20\ndq 2\ndq prog_entry\ndq 0\n\nregs_for_exit:\ntimes iret_ss+8 db 0\n\n; memcpy0f dest, src, size, retaddr, flags\n%macro memcpy0f 5\n; assuming that rdi/rsi/rdx/rcx are the first 4 registers\ndq (%1)\ndq (%2)\ndq 0\ndq (%3)\ntimes (iret_rip-32) db 0\n; iret frame\ndq rep_movsb_pop_rbp_ret\ndq 0x20\ndq (%5)\ndq %%target\ndq 0\n%%target:\ndq 0 ; rbp\ndq (%4) ; return address\n%endmacro\n\n; memcpy0 dest, src, size, retaddr\n%macro memcpy0 4\nmemcpy0f (%1), (%2), (%3), (%4), 2\n%endmacro\n\n; rmemcpy0 dest, src, size, retaddr\n%macro rmemcpy0 4\nmemcpy0f (%1), (%2), (%3), (%4), 0x402\n%endmacro\n\n; memcpy dest, src, size\n%macro memcpy 3\nmemcpy0 (%1), (%2), (%3), pop_all_iret\n%endmacro\n\n; rmemcpy dest, src, size\n%macro rmemcpy 3\nrmemcpy0 (%1), (%2), (%3), pop_all_iret\n%endmacro\n\n; memcat dest, src, size\n%macro memcat 3\nmemcpy0 (%1), (%2), (%3), pop_all_except_rdi_iret\n%endmacro\n\n; rmemcat dest, src, size\n%macro rmemcat 3\nrmemcpy0 (%1), (%2), (%3), pop_all_except_rdi_iret\n%endmacro\n\n; pokeq0 dest, value, retaddr\n%macro pokeq0 3\nmemcpy0 (%1), %%value, 8, (%3)\nsection .data.qword\n%%value:\ndq (%2)\nsection .text\n%endmacro\n\n; pokeq dest, value\n%macro pokeq 2\nmemcpy (%1), %%value, 8\nsection .data.qword\n%%value:\ndq (%2)\nsection .text\n%endmacro\n\n; ptr_add_imm p_dest, p_ptr, imm\n%macro ptr_add_imm 3\nmemcpy %%seek+iret_rsi, (%2), 8\n%%seek:\nmemcpy0 scratchpad, 0, (%3), doreti_iret\nsave_reg (%1), iret_rsi\n%endmacro\n\n; ptr_sub_imm p_dest, p_ptr, imm\n%macro ptr_sub_imm 3\nmemcpy %%seek+iret_rsi, (%2), 8\n%%seek:\nrmemcpy0 scratchpad+(%3)-1, 0, (%3), doreti_iret\nsave_reg (%1), iret_rsi\n%endmacro\n\n; memcpy_offset p_dest, offset, src, size\n%macro memcpy_offset 4\nptr_add_imm %%poke+iret_rdi, (%1), (%2)\n%%poke:\nmemcpy 0, (%3), (%4)\n%endmacro\n\n; memcpy_from_offset dest, p_src, offset, size\n%macro memcpy_from_offset 4\nptr_add_imm %%peek+iret_rsi, (%2), (%3)\n%%peek:\nmemcpy (%1), 0, (%4)\n%endmacro\n\n; memcpy_from_neg_offset dest, p_src, offset, size\n%macro memcpy_from_neg_offset 4\nptr_sub_imm %%peek+iret_rsi, (%2), (%3)\n%%peek:\nmemcpy (%1), 0, (%4)\n%endmacro\n\n; cmpb ptr1, ptr2, is_less, is_equal, is_greater\n%macro cmpb 5\nmemcpy %%poke1+iret_rsi+1, (%1), 1\nmemcpy %%poke1+iret_rsi, (%2), 1\n%%poke1:\nmemcpy %%poke2+iret_rsi, comparison_table, 1\n%%poke2:\nmemcpy0 %%iret+24, %%jump_table, 8, doreti_iret\n%%iret:\ndq pop_all_iret\ndq 0x20\ndq 2\ndq 0\ndq 0\nsection .data.qword\nalign 256\n%%jump_table:\ndq (%3)\ndq (%4)\ndq (%5)\nsection .text\n%endmacro\n\n; cmpw ptr1, ptr2, is_less, is_equal, is_greater\n%macro cmpw 5\ncmpb (%1)+1, (%2)+1, (%3), %%next_check, (%5)\n%%next_check:\ncmpb (%1), (%2), (%3), (%4), (%5)\n%endmacro\n\n; cmpwbe ptr1, ptr2, is_less, is_equal, is_greater\n%macro cmpwbe 5\ncmpb (%1), (%2), (%3), %%next_check, (%5)\n%%next_check:\ncmpb (%1)+1, (%2)+1, (%3), (%4), (%5)\n%endmacro\n\n; cmpd ptr1, ptr2, is_less, is_equal, is_greater\n%macro cmpd 5\ncmpw (%1)+2, (%2)+2, (%3), %%next_check, (%5)\n%%next_check:\ncmpw (%1), (%2), (%3), (%4), (%5)\n%endmacro\n\n; cmpdbe ptr1, ptr2, is_less, is_equal, is_greater\n%macro cmpdbe 5\ncmpwbe (%1), (%2), (%3), %%next_check, (%5)\n%%next_check:\ncmpwbe (%1)+2, (%2)+2, (%3), (%4), (%5)\n%endmacro\n\n; cmpq ptr1, ptr2, is_less, is_equal, is_greater\n%macro cmpq 5\ncmpd (%1)+4, (%2)+4, (%3), %%next_check, (%5)\n%%next_check:\ncmpd (%1), (%2), (%3), (%4), (%5)\n%endmacro\n\n; cmpqbe ptr1, ptr2, is_less, is_equal, is_greater\n%macro cmpqbe 5\ncmpdbe (%1), (%2), (%3), %%next_check, (%5)\n%%next_check:\ncmpdbe (%1)+4, (%2)+4, (%3), (%4), (%5)\n%endmacro\n\n; cmpwi ptr1, imm, is_less, is_equal, is_greater\n%macro cmpwi 5\ncmpw (%1), %%value, (%3), (%4), (%5)\nsection .data.word\n%%value:\ndw (%2)\nsection .text\n%endmacro\n\n; cmpwibe ptr1, imm, is_less, is_equal, is_greater\n%macro cmpwibe 5\ncmpwbe (%1), %%value, (%3), (%4), (%5)\nsection .data.word\n%%value:\ndw (%2)\nsection .text\n%endmacro\n\n; cmpdi ptr1, imm, is_less, is_equal, is_greater\n%macro cmpdi 5\ncmpd (%1), %%value, (%3), (%4), (%5)\nsection .data.dword\n%%value:\ndd (%2)\nsection .text\n%endmacro\n\n; cmpdibe ptr1, imm, is_less, is_equal, is_greater\n%macro cmpdibe 5\ncmpdbe (%1), %%value, (%3), (%4), (%5)\nsection .data.dword\n%%value:\ndd (%2)\nsection .text\n%endmacro\n\n; cmpqi ptr1, imm, is_less, is_equal, is_greater\n%macro cmpqi 5\ncmpq (%1), %%value, (%3), (%4), (%5)\nsection .data.qword\n%%value:\ndq (%2)\nsection .text\n%endmacro\n\n; cmpqibe ptr1, imm, is_less, is_equal, is_greater\n%macro cmpqibe 5\ncmpqbe (%1), %%value, (%3), (%4), (%5)\nsection .data.qword\n%%value:\ndq (%2)\nsection .text\n%endmacro\n\n; andb ptr1, ptr2\n%macro andb 2\nmemcpy %%peek+iret_rsi, (%1), 1\nmemcpy %%peek+iret_rsi+1, (%2), 1\n%%peek:\nmemcpy (%1), and_table, 1\n%endmacro\n\n; andbi ptr1, imm\n%macro andbi 2\nmemcpy %%peek+iret_rsi+1, (%1), 1\n%%peek:\nmemcpy (%1), and_table+(%2), 1\n%endmacro\n\n; orb ptr1, ptr2\n%macro orb 2\nmemcpy %%peek+iret_rsi, (%1), 1\nmemcpy %%peek+iret_rsi+1, (%2), 1\n%%peek:\nmemcpy (%1), or_table, 1\n%endmacro\n\n; orbi ptr1, imm\n%macro orbi 2\nmemcpy %%peek+iret_rsi+1, (%1), 1\n%%peek:\nmemcpy (%1), or_table+(%2), 1\n%endmacro\n\n; save_reg where, what\n%macro save_reg 2\ndq push_pop_all_iret\ndq 0x20\ndq 2\ndq %%regs_stash_exit\ndq 0\ntimes 128 db 0\n%%regs_stash:\ntimes iret_rip db 0\n%%regs_stash_exit:\ndq pop_all_iret\ndq 0x20\ndq 2\ndq %%after_regs_stash\ndq 0\n%%after_regs_stash:\nmemcpy (%1), %%regs_stash+(%2), 8\n%endmacro\n\n; log_word which\n%macro log_word 1\ncmpq log_area_cur, log_area_end, %%write, %%skip, %%write\n%%write:\nmemcpy log_staging, iret_frame, 8\nmemcpy log_staging+8, (%1), 8\nmemcpy %%poke+iret_rdi, log_area_cur, 8\n%%poke:\nmemcpy0 0, log_staging, 16, doreti_iret\nsave_reg log_area_cur, iret_rdi\n%%skip:\n%endmacro\n\n; replace_word ptr1, value1, value2\n%macro replace_word 3\n%%start:\ncmpw (%1), %%value1, %%skip, %%change, %%skip\n%%change:\nmemcpy (%1), %%value2, 2\n%%skip:\nsection .data.word\n%%value1:\ndw (%2)\n%%value2:\ndw (%3)\nsection .text\n%endmacro\n\n; replace_word_log ptr1, value1, value2, token\n%macro replace_word_log 4\n%%start:\ncmpw (%1), %%value1, %%skip, %%change, %%skip\n%%change:\nlog_word %%token\nmemcpy (%1), %%value2, 2\n%%skip:\nsection .data.word\n%%value1:\ndw (%2)\n%%value2:\ndw (%3)\nsection .data.qword\n%%token:\ndq (%4)\nsection .text\n%endmacro\n\n; decrypt_pointer ptr1\n%macro decrypt_pointer 1\nreplace_word (%1)+6, 0xdeb7, 0xffff\n%endmacro\n\n; decrypt_pointer_log ptr1, token\n%macro decrypt_pointer_log 2\nreplace_word_log (%1)+6, 0xdeb7, 0xffff, (%2)\n%endmacro\n\n; encrypt_pointer ptr1\n%macro encrypt_pointer 1\nreplace_word (%1)+6, 0xffff, 0xdeb7\n%endmacro\n\n; decrypt_one label, which\n%macro decrypt_one 2\n%1:\ndecrypt_pointer regs_stash+(%2)\ntimes iret_rip db 0\ndq pop_all_iret\ndq 0x20\ndq 2\ndq decrypt_end\ndq 0\n%endmacro\n\n; if_equal cond, arg1, arg2, then\n%macro if_equal 4\n%1 (%2), (%3), %%next_check, (%4), %%next_check\n%%next_check:\n%endmacro\n\n; if_not_equal cond, arg1, arg2, then\n%macro if_not_equal 4\n%1 (%2), (%3), (%4), %%next_check, (%4)\n%%next_check:\n%endmacro\n\n; on_rip rip, tgt\n%macro on_rip 2\n;cmpqibe iret_frame, (%1), %%next_check, (%2), %%next_check\n;%%next_check:\nif_equal cmpqibe, iret_frame, (%1), (%2)\n%endmacro\n\n; push_stack start, length\n%macro push_stack 2\nmemcpy %%peek+iret_rsi, iret_frame+24, 8\nmemcpy %%poke+iret_rdi, iret_frame+24, 8\n%%peek:\nmemcpy %%stash, 0, 1\n%%poke:\nrmemcat 0, %%stash, 1\nrmemcat 0, (%1)+(%2)-1, (%2)\nmemcpy0 0, %%stash, 1, doreti_iret\nsave_reg iret_frame+24, iret_rdi\nsection .data.byte\n%%stash:\ndb 0\nsection .text\n%endmacro\n\n; pop_stack start, length\n%macro pop_stack 2\nmemcpy %%peek+iret_rsi, iret_frame+24, 8\n%%peek:\nmemcpy0 (%1), 0, (%2), doreti_iret\nsave_reg iret_frame+24, iret_rsi\n%endmacro\n\n; pushqi imm\n%macro pushqi 1\npush_stack %%value, 8\nsection .data.qword\n%%value:\ndq (%1)\nsection .text\n%endmacro\n\n; read_dbgregs\n%macro read_dbgregs 0\npokeq0 read_dbgregs_lr, %%end_macro, doreti_iret\ndq pop_all_iret\ndq 0x20\ndq 2\ndq read_dbgregs_fn\ndq 0\n%%end_macro:\n%endmacro\n\n; write_dbgregs\n%macro write_dbgregs 0\npokeq0 write_dbgregs_lr, %%end_macro, doreti_iret\ndq pop_all_iret\ndq 0x20\ndq 2\ndq write_dbgregs_fn\ndq 0\n%%end_macro:\n%endmacro\n\n; read_msr dst, which\n%macro read_msr 2\nmemcpy read_msr_rcx, (%2), 8\npokeq read_msr_ret+iret_rdi, (%1)\npokeq0 read_msr_lr, %%return, doreti_iret\ndq pop_all_iret\ndq 0x20\ndq 2\ndq read_msr_fn\ndq 0\n%%return:\n%endmacro\n\n; set_pcb_dbregs\n%macro set_pcb_dbregs 0\npokeq0 set_pcb_dbregs_lr, %%end_macro, doreti_iret\ndq pop_all_iret\ndq 0x20\ndq 2\ndq set_pcb_dbregs_fn\ndq 0\n%%end_macro:\n%endmacro\n\n; addbc out, left, right, carry_out\n%macro addbc 4\nmemcpy %%poke1+iret_rsi, (%2), 1\nmemcpy %%poke1+iret_rsi+1, (%3), 1\nmemcpy %%poke2+iret_rsi, %%poke1+iret_rsi, 2\n%%poke1:\nmemcpy (%1), addition_table, 1\n%%poke2:\nmemcpy (%4), carry_table, 1\n%endmacro\n\n; addbcc out, left, right, carry_in, carry_out\n%macro addbcc 5\naddbc (%1), (%2), (%3), %%tmp\naddbc (%1), (%1), (%4), (%5)\norb (%5), %%tmp\nsection .data.byte\n%%tmp:\ndb 0\nsection .text\n%endmacro\n\n; addwcc out, left, right, carry_in, carry_out\n%macro addwcc 5\naddbcc (%1), (%2), (%3), (%4), %%tmp\naddbcc (%1)+1, (%2)+1, (%3)+1, %%tmp, (%5)\nsection .data.byte\n%%tmp:\ndb 0\nsection .text\n%endmacro\n\n; adddcc out, left, right, carry_in, carry_out\n%macro adddcc 5\naddwcc (%1), (%2), (%3), (%4), %%tmp\naddwcc (%1)+2, (%2)+2, (%3)+2, %%tmp, (%5)\nsection .data.byte\n%%tmp:\ndb 0\nsection .text\n%endmacro\n\n; addqcc out, left, right, carry_in, carry_out\n%macro addqcc 5\nadddcc (%1), (%2), (%3), (%4), %%tmp\nadddcc (%1)+4, (%2)+4, (%3)+4, %%tmp, (%5)\nsection .data.byte\n%%tmp:\ndb 0\nsection .text\n%endmacro\n\n; addq out, left, right\n%macro addq 3\naddqcc (%1), (%2), (%3), %%zero, scratchpad\nsection .data.byte\n%%zero:\ndb 0\nsection .text\n%endmacro\n\n; notb out, in\n%macro notb 2\nmemcpy %%peek+iret_rsi, (%2), 1\n%%peek:\nmemcpy (%1), not_table, 1\n%endmacro\n\n; subq out, left, right\n%macro subq 3\nnotb %%tmp, (%3)\nnotb %%tmp+1, (%3)+1\nnotb %%tmp+2, (%3)+2\nnotb %%tmp+3, (%3)+3\nnotb %%tmp+4, (%3)+4\nnotb %%tmp+5, (%3)+5\nnotb %%tmp+6, (%3)+6\nnotb %%tmp+7, (%3)+7\naddqcc (%1), %%tmp, (%2), %%one, scratchpad\nsection .data.byte\n%%one:\ndb 1\nsection .data.qword\n%%tmp:\ndq 0\nsection .text\n%endmacro\n\n; mulbt out, in, carry, mul_table, carry_table\n%macro mulbt 5\nmemcpy %%peek1+iret_rsi, (%2), 1\nmemcpy %%peek2+iret_rsi, (%2), 1\n%%peek1:\nmemcpy (%1), (%4), 1\n%%peek2:\nmemcpy (%3), (%5), 1\n%endmacro\n\n; mulqt out, in, mul_table, carry_table\n%macro mulqt 4\nmulbt (%1), (%2), %%second+1, (%3), (%4)\nmulbt (%1)+1, (%2)+1, %%second+2, (%3), (%4)\nmulbt (%1)+2, (%2)+2, %%second+3, (%3), (%4)\nmulbt (%1)+3, (%2)+3, %%second+4, (%3), (%4)\nmulbt (%1)+4, (%2)+4, %%second+5, (%3), (%4)\nmulbt (%1)+5, (%2)+5, %%second+6, (%3), (%4)\nmulbt (%1)+6, (%2)+6, %%second+7, (%3), (%4)\nmulbt (%1)+7, (%2)+7, scratchpad, (%3), (%4)\naddq (%1), (%1), %%second\nsection .data.qword\n%%second:\ndq 0\nsection .text\n%endmacro\n\n; mulq32 out, in\n%macro mulq32 2\nmulqt (%1), (%2), mul32_table, mul32_carry\n%endmacro\n\n; mulq56 out, in\n%macro mulq56 2\nmulqt (%1), (%2), mul56_table, mul56_carry\n%endmacro\n\n; mulq80 out, in\n%macro mulq80 2\nmulqt (%1), (%2), mul80_table, mul80_carry\n%endmacro\n\nprog_entry:\n\n%include \"parasites.inc\"\n\n; actual logic starts here\n\non_rip syscall_before, handle_syscall_before\non_rip doreti_iret, handle_broken_iret\non_rip dr2gpr_end, read_dbgregs_ret\non_rip gpr2dr_1_end, write_dbgregs_ret1\non_rip gpr2dr_2_end, write_dbgregs_ret2\non_rip rdmsr_end, read_msr_ret\non_rip soo_ioctl, handle_soo_ioctl\n\non_rip 0xde00ad0000000001, handle_kekcall_write_dbregs_after_copyout\non_rip 0xde00ad0000000002, restore_dbregs_after_syscall\n\n%include \"fself_hooks.inc\"\n\n; generic fallback for unknown crashes\n\ndecrypt_pointer_log regs_stash+iret_rax, 0\ndecrypt_pointer_log regs_stash+iret_rcx, 1\ndecrypt_pointer_log regs_stash+iret_rdx, 2\ndecrypt_pointer_log regs_stash+iret_rbx, 3\ndecrypt_pointer_log regs_stash+iret_rbp, 5\ndecrypt_pointer_log regs_stash+iret_rsi, 6\ndecrypt_pointer_log regs_stash+iret_rdi, 7\ndecrypt_pointer_log regs_stash+iret_r8, 8\ndecrypt_pointer_log regs_stash+iret_r9, 9\ndecrypt_pointer_log regs_stash+iret_r10, 10\ndecrypt_pointer_log regs_stash+iret_r11, 11\ndecrypt_pointer_log regs_stash+iret_r12, 12\ndecrypt_pointer_log regs_stash+iret_r13, 13\ndecrypt_pointer_log regs_stash+iret_r14, 14\ndecrypt_pointer_log regs_stash+iret_r15, 15\n\ndecrypt_end:\nmemcpy regs_for_exit, regs_stash, iret_rip\nmemcpy0 regs_for_exit+iret_rip, iret_frame, 40, doreti_iret\ndq pop_all_iret\ndq 0x20\ndq 2\ndq regs_for_exit\ndq 0\n\nhandle_broken_iret:\n; just pretend that we crashed inside the iret\nmemcpy .copy+iret_rsi, iret_frame+24, 8\n.copy:\nmemcpy0 iret_frame, 0, 40, doreti_iret\ndq pop_all_iret\ndq 0x20\ndq 2\ndq prog_entry\ndq 0\n\nhandle_syscall_before:\ndecrypt_pointer regs_stash+iret_rax\nif_equal cmpqibe, regs_stash+iret_rax, sysents+48*SYS_ioctl, handle_ioctl\n%include \"fself_syscalls.inc\"\ncmpqibe regs_stash+iret_rax, sysents+48*SYS_getppid, decrypt_end, handle_getppid, decrypt_end\n\nhandle_getppid:\nmemcpy_from_offset regs_for_exit, iret_frame+24, syscall_rsp_to_regs_stash, iret_rip+40\n\n; handle kekcalls\nif_equal cmpdibe, regs_for_exit+iret_rax+4, 1, handle_kekcall_read_dbregs\nif_equal cmpdibe, regs_for_exit+iret_rax+4, 2, handle_kekcall_write_dbregs\nif_equal cmpdibe, regs_for_exit+iret_rax+4, 3, handle_kekcall_rdmsr\nif_equal cmpdibe, regs_for_exit+iret_rax+4, 0x42, handle_kekcall_debug\n\n; call real getppid. the register is already decrypted, so just fall through\ntimes iret_rip db 0\ndq pop_all_iret\ndq 0x20\ndq 2\ndq decrypt_end\ndq 0\n\nhandle_kekcall_read_dbregs:\n; set syscall return value to 0\nmemcpy_offset regs_stash+iret_rdi, td_retval, zero, 8\n; rsi = destination, from userspace\nmemcpy regs_stash+iret_rsi, regs_for_exit+iret_rdi, 8\n; rdx = count, fixed\npokeq regs_stash+iret_rdx, 48\n; read debug registers\nread_dbgregs\n; prepare stack frame\nmemcpy dbgreg_copyout_frame_dbgregs, dbgregs, 48\nmemcpy dbgreg_copyout_frame_rsp, iret_frame+24, 8\n; push debug registers to kernel stack\npush_stack dbgreg_copyout_frame_dbgregs, dbgreg_copyout_frame_end-dbgreg_copyout_frame_dbgregs\n; rdi = source, copy from kernel stack\nmemcpy regs_stash+iret_rdi, iret_frame+24, 8\n; set return address\npokeq dbgreg_copyout_frame_rip, syscall_after\n; push the rest of the stack frame\npush_stack dbgreg_copyout_frame, dbgreg_copyout_frame_dbgregs-dbgreg_copyout_frame\n; set rip\npokeq0 iret_frame, copyout, doreti_iret\ndq pop_all_iret\ndq 0x20\ndq 2\ndq decrypt_end\ndq 0\n\nhandle_kekcall_write_dbregs:\n; set syscall return value to 0\nmemcpy_offset regs_stash+iret_rdi, td_retval, zero, 8\n; save the thread pointer into the spare 7th slot\n;memcpy dbgreg_copyout_frame_dbgregs+48, regs_stash+iret_rdi, 8\n; rdi = source, from userspace\nmemcpy regs_stash+iret_rdi, regs_for_exit+iret_rdi, 8\n; rdx = count, fixed\npokeq regs_stash+iret_rdx, 48\n; allocate space for debug registers on kernel stack\npush_stack dbgreg_copyout_frame_dbgregs, dbgreg_copyout_frame_end-dbgreg_copyout_frame_dbgregs\n; iret should not pop this data\nmemcpy dbgreg_copyout_frame_rsp, iret_frame+24, 8\n; rsi = destination, copy to kernel stack\nmemcpy regs_stash+iret_rsi, iret_frame+24, 8\n; set up magic return\npokeq dbgreg_copyout_frame_rip, 0xde00ad0000000001\n; push the rest of the stack frame\npush_stack dbgreg_copyout_frame, dbgreg_copyout_frame_dbgregs-dbgreg_copyout_frame\n; set rip\npokeq0 iret_frame, copyin, doreti_iret\ndq pop_all_iret\ndq 0x20\ndq 2\ndq decrypt_end\ndq 0\n\nhandle_kekcall_write_dbregs_after_copyout:\n; pop the data from stack\npop_stack dbgreg_copyout_frame_dbgregs, dbgreg_copyout_frame_end-dbgreg_copyout_frame_dbgregs\n; check if copyin has succeeded\nif_not_equal cmpdibe, regs_stash+iret_rax, 0, .copyin_failed\n; write debug registers\nmemcpy dbgregs, dbgreg_copyout_frame_dbgregs, 48\nwrite_dbgregs\n; this thread is now using debug registers\nset_pcb_dbregs\n; done, now return\n.copyin_failed:\npokeq0 iret_frame, syscall_after, doreti_iret\ndq pop_all_iret\ndq 0x20\ndq 2\ndq decrypt_end\ndq 0\n\nhandle_kekcall_rdmsr:\nread_msr .return, regs_for_exit+iret_rdi\nmemcpy_offset regs_stash+iret_rdi, td_retval, .return, 8\nmemcpy regs_stash+iret_rax, zero, 8\npokeq0 iret_frame, syscall_after, doreti_iret\ndq pop_all_iret\ndq 0x20\ndq 2\ndq decrypt_end\ndq 0\nsection .data.qword\n.return:\ndq 0\nsection .text\n\nhandle_kekcall_debug:\nsubq regs_for_exit+iret_rdi, regs_for_exit+iret_rdi, regs_for_exit+iret_rsi\nmemcpy_offset regs_stash+iret_rdi, td_retval, regs_for_exit+iret_rdi, 8\npokeq iret_frame, syscall_after\npokeq0 regs_stash+iret_rax, 0, doreti_iret\ndq pop_all_iret\ndq 0x20\ndq 2\ndq decrypt_end\ndq 0\n.tmp:\ndq 0\n\nrestore_dbregs_after_syscall:\n; pop the data from stack\npop_stack dbgreg_copyout_frame_dbgregs, dbgreg_copyout_frame_end-dbgreg_copyout_frame_dbgregs\n; write debug registers\nmemcpy dbgregs, dbgreg_copyout_frame_dbgregs, 48\nwrite_dbgregs\n; done, now return\npokeq0 iret_frame, syscall_after, doreti_iret\ndq pop_all_iret\ndq 0x20\ndq 2\ndq decrypt_end\ndq 0\n\nhandle_ioctl:\n; fix up rsi for the original syscall\nptr_add_imm regs_stash+iret_rsi, iret_frame+24, syscall_rsp_to_rsi\n; read and save current debug registers\nread_dbgregs\nmemcpy dbgreg_copyout_frame_dbgregs, dbgregs, 48\n; set up a stack frame to restore them on return\npokeq dbgreg_copyout_frame_rip, 0xde00ad0000000002\n; push old debug registers\npush_stack dbgreg_copyout_frame_dbgregs, dbgreg_copyout_frame_end-dbgreg_copyout_frame_dbgregs\n; save stack pointer, we don't want them popped\nmemcpy dbgreg_copyout_frame_rsp, iret_frame+24, 8\n; push the rest of the stack frame\npush_stack dbgreg_copyout_frame, dbgreg_copyout_frame_dbgregs-dbgreg_copyout_frame\n; load modified debug registers\nmemcpy dbgregs, dbgregs_for_ioctl, 48\nwrite_dbgregs\n; this thread is now using debug registers\nset_pcb_dbregs\n; call the original syscall\nmemcpy0 iret_frame, sysents+48*SYS_ioctl+8, 8, doreti_iret\ndq pop_all_iret\ndq 0x20\ndq 2\ndq decrypt_end\ndq 0\n.msr_gs_base:\ndq 0xc0000101\nthe_pcpu:\ndq pcpu\n\nhandle_soo_ioctl:\n; check if we should override this call\nif_not_equal cmpdibe, regs_stash+iret_rsi, 0x40045145, decrypt_end\n; write the sentinel. no copyout is necessary, the kernel handles this for us\nmemcpy .poke+iret_rdi, regs_stash+iret_rdx, 8\n.poke:\nmemcpy 0, .sentinel, 4\n; fake the function to return 0\npop_stack iret_frame, 8\npokeq0 regs_stash+iret_rax, 0, doreti_iret\n; we're done\ndq pop_all_iret\ndq 0x20\ndq 2\ndq decrypt_end\ndq 0\nsection .data.dword\n.sentinel:\ndd 0xdeaddead\nsection .text\n\nsection .data.qword\ndbgregs_for_ioctl:\ndq soo_ioctl\ndq 0\ndq 0\ndq 0\ndq 0\ndq 0x402\nsection .text\n\n; simple decrypts\ndecrypt_one decrypt_rax_only, iret_rax\ndecrypt_one decrypt_rcx_only, iret_rcx\ndecrypt_one decrypt_rdx_only, iret_rdx\ndecrypt_one decrypt_rbx_only, iret_rbx\ndecrypt_one decrypt_rbp_only, iret_rbp\ndecrypt_one decrypt_rsi_only, iret_rsi\ndecrypt_one decrypt_rdi_only, iret_rdi\ndecrypt_one decrypt_r8_only, iret_r8\ndecrypt_one decrypt_r9_only, iret_r9\ndecrypt_one decrypt_r10_only, iret_r10\ndecrypt_one decrypt_r11_only, iret_r11\ndecrypt_one decrypt_r12_only, iret_r12\ndecrypt_one decrypt_r13_only, iret_r13\ndecrypt_one decrypt_r14_only, iret_r14\ndecrypt_one decrypt_r15_only, iret_r15\n\nread_dbgregs_fn:\nmemcpy regs_for_exit, regs_stash, iret_rip\nmemcpy regs_for_exit+iret_rip, iret_frame, 40\ntimes iret_r8 db 0\ndq 0xdeadbeefdeadbeef\ntimes (iret_rip-iret_r8-8) db 0\ndq dr2gpr_start\ndq 0x20\ndq 2\ndq 0\ndq 0\nread_dbgregs_ret:\nmemcpy dbgregs, regs_stash+iret_r15, 8\nmemcpy dbgregs+8, regs_stash+iret_r14, 8\nmemcpy dbgregs+16, regs_stash+iret_r13, 8\nmemcpy dbgregs+24, regs_stash+iret_r12, 8\nmemcpy dbgregs+32, regs_stash+iret_r11, 8\nmemcpy dbgregs+40, regs_stash+iret_rax, 8\nmemcpy regs_stash, regs_for_exit, iret_rip\nmemcpy0 iret_frame, regs_for_exit+iret_rip, 40, doreti_iret\ndq pop_all_iret\ndq 0x20\ndq 2\nread_dbgregs_lr:\ndq 0\ndq 0\n\nwrite_dbgregs_fn:\nmemcpy .run_gadget1+iret_r15, dbgregs, 8\nmemcpy .run_gadget1+iret_r14, dbgregs+8, 8\nmemcpy .run_gadget1+iret_r13, dbgregs+16, 8\nmemcpy .run_gadget1+iret_rbx, dbgregs+24, 8\nmemcpy .run_gadget1+iret_r11, dbgregs+32, 8\nmemcpy .run_gadget1+iret_rcx, dbgregs+40, 8\nmemcpy .run_gadget1+iret_rax, dbgregs+40, 8\nmemcpy regs_for_exit, regs_stash, iret_rip\nmemcpy regs_for_exit+iret_rip, iret_frame, 40\n.run_gadget1:\ntimes iret_r8 db 0\ndq 0xdeadbeefdeadbeef\ntimes (iret_rip-iret_r8-8) db 0\ndq gpr2dr_1_start\ndq 0x20\ndq 2\ndq 0\ndq 0\nwrite_dbgregs_ret1:\nmemcpy .run_gadget2+iret_r11, dbgregs+32, 8\nmemcpy .run_gadget2+iret_r15, dbgregs+40, 8\n.run_gadget2:\ntimes iret_r12 db 0\ndq 0xdeadbeefdeadbeef\ntimes (iret_rip-iret_r12-8) db 0\ndq gpr2dr_2_start\ndq 0x20\ndq 2\ndq 0\ndq 0\nwrite_dbgregs_ret2:\nmemcpy regs_stash, regs_for_exit, iret_rip\nmemcpy0 iret_frame, regs_for_exit+iret_rip, 40, doreti_iret\ndq pop_all_iret\ndq 0x20\ndq 2\nwrite_dbgregs_lr:\ndq 0\ndq 0\n\nread_msr_fn:\nmemcpy regs_for_exit, regs_stash, iret_rip\nmemcpy regs_for_exit+iret_rip, iret_frame, 40\ntimes iret_rcx db 0\nread_msr_rcx:\ntimes (iret_r8-iret_rcx) db 0\ndq 0xdeadbeefdeadbeef\ntimes (iret_rip-iret_r8-8) db 0\ndq rdmsr_start\ndq 0x20\ndq 2\ndq 0\ndq 0\nread_msr_ret:\nmemcpy 0, regs_stash+iret_rax, 8\nmemcpy regs_stash, regs_for_exit, iret_rip\nmemcpy0 iret_frame, regs_for_exit+iret_rip, 40, doreti_iret\ndq pop_all_iret\ndq 0x20\ndq 2\nread_msr_lr:\ndq 0\ndq 0\n\nset_pcb_dbregs_fn:\n; get td_pcb\nmemcpy_from_offset .td_pcb, pcpu, td_pcb, 8\n; get pcb_flags pointer\nptr_add_imm .peek+iret_rsi, .td_pcb, pcb_flags\nmemcpy .poke+iret_rdi, .peek+iret_rsi, 8\n; set PCB_DBREGS (2)\nsection .data.byte\n.tmp:\ndb 0\nsection .data.qword\n.td_pcb:\ndq 0\nsection .text\n.peek:\nmemcpy .tmp, 0, 1\norbi .tmp, 2\n.poke:\nmemcpy0 0, .tmp, 1, doreti_iret\ndq pop_all_iret\ndq 0x20\ndq 2\nset_pcb_dbregs_lr:\ndq 0\ndq 0\n\n%include \"fself.inc\"\n\nsection .data.qword\n\ndbgregs:\ntimes 6 dq 0\n\ndbgreg_copyout_frame:\ndq doreti_iret\ndbgreg_copyout_frame_rip:\ndq 0\ndq 0x20\ndq 0x202\ndbgreg_copyout_frame_rsp:\ndq 0\nzero:\ndq 0\ndbgreg_copyout_frame_dbgregs:\ntimes 7 dq 0\ndbgreg_copyout_frame_end:\n\n; pseudocode:\n; comparison_table[a][b] = 8 * (intcmp(a, b) + 1)\nsection .data.align16\nalign 65536\ncomparison_table:\n%rep 65536\ndb ((($-comparison_table)/256 - ($-comparison_table) % 256 + 256) / 256 + (($-comparison_table)/256 - ($-comparison_table) % 256 + 255) / 256) * 8\n%endrep\n\n; pseudocode:\n; and_table[a][b] = a & b\nsection .data.align16\nalign 65536\nand_table:\n%rep 65536\ndb (($-and_table)/256) & (($-and_table) % 256)\n%endrep\n\n; pseudocode:\n; or_table[a][b] = a | b\nsection .data.align16\nalign 65536\nor_table:\n%rep 65536\ndb (($-or_table)/256) | (($-or_table) % 256)\n%endrep\n\n; pseudocode:\n; add_table[a][b] = a + b\n; carry_table[a][b] = (a + b) / 256\nsection .data.align16\nalign 65536\naddition_table:\n%rep 65536\ndb ((($-addition_table)/256) + ($-addition_table) % 256) % 256\n%endrep\ncarry_table:\n%rep 65536\ndb ((($-carry_table)/256) + ($-carry_table) % 256) / 256\n%endrep\n\n; pseudocode:\n; mul32_table[x] = x * 32\n; mul32_carry[x] = x / 8\nsection .data.align8\nalign 256\nmul32_table:\n%rep 256\ndb (($ - mul32_table) * 32) % 256\n%endrep\nmul32_carry:\n%rep 256\ndb ($ - mul32_carry) / 8\n%endrep\n\n; pseudocode:\n; mul56_table[x] = x * 56\n; mul56_carry[x] = x * 7 / 32\nsection .data.align8\nalign 256\nmul56_table:\n%rep 256\ndb (($ - mul56_table) * 56) % 256\n%endrep\nmul56_carry:\n%rep 256\ndb ($ - mul56_carry) * 7 / 32\n%endrep\n\n; pseudocode:\n; mul80_table[x] = x * 56\n; mul80_carry[x] = x * 7 / 32\nsection .data.align8\nalign 256\nmul80_table:\n%rep 256\ndb (($ - mul80_table) * 80) % 256\n%endrep\nmul80_carry:\n%rep 256\ndb ($ - mul80_carry) * 5 / 16\n%endrep\n\n; pseudocode\n; not_table[x] = ~x\nsection .data.align8\nalign 256\nnot_table:\n%rep 256\ndb (not_table + 255) - $\n%endrep\n\nsection .data.log\nlog_staging:\ndq 0\ndq 0\nlog_area:\ntimes 4096 db 0\nlog_area_end:\ndq log_area_end\nlog_area_cur:\ndq log_area\n"
  },
  {
    "path": "ps5-kstuff/old/parasites.inc",
    "content": "extern kdata_base\n\non_rip kdata_base-0x80284d, decrypt_rdi_only\non_rip kdata_base-0x3889ac, decrypt_rsi_only\non_rip kdata_base-0x38896c, decrypt_rsi_only\n\n; fself stuff, library load\non_rip kdata_base-0x2cd28a, decrypt_rax_only\non_rip kdata_base-0x2cd150, decrypt_rax_only\non_rip kdata_base-0x2cc882, decrypt_rcx_only\non_rip kdata_base-0x2cc716, decrypt_rax_only\n\n; fself stuff, library unload\non_rip kdata_base-0x990b10, decrypt_rdi_only\n"
  },
  {
    "path": "ps5-kstuff/old/structs.inc",
    "content": "%define iret_rdi 0\n%define iret_rsi 8\n%define iret_rdx 16\n%define iret_rcx 24\n%define iret_r8 32\n%define iret_r9 40\n%define iret_rax 48\n%define iret_rbx 56\n%define iret_rbp 64\n%define iret_r10 72\n%define iret_r11 80\n%define iret_r12 88\n%define iret_r13 96\n%define iret_r14 104\n%define iret_r15 112\n%define iret_rip 232\n%define iret_cs (iret_rip+8)\n%define iret_eflags (iret_rip+16)\n%define iret_rsp (iret_rip+24)\n%define iret_ss (iret_rip+32)\n\n%define td_pcb 0x3f8\n%define td_retval 0x408\n\n%define pcb_flags 0x100\n\n%define syscall_rsp_to_rsi 0x88\n%define syscall_rsp_to_regs_stash 0x110\n\n%define sceSblServiceMailbox_decryptSelfBlock_rsp_to_self_context 0x118\n%define sceSblServiceMailbox_decryptSelfBlock_rsp_to_target_va 0x10\n%define sceSblServiceMailbox_decryptSelfBlock_rsp_to_rbp 0x120\n\n%define mini_syscore_header_size 0x6a0\n"
  },
  {
    "path": "ps5-kstuff/overrides.h",
    "content": "/* disable use of POSIX functions */\n#undef __linux__\n#undef __unix__\n\n/* disable XMM intrinsics */\n//#undef __x86_64__\n\n/* for BearSSL */\n#define BR_64 1\n#define BR_INT128 1\n\n/* for libtomcrypt */\n#define ARGTYPE 3\n#define TAB_SIZE 1\n#define LTC_NO_TEST 1\n"
  },
  {
    "path": "ps5-kstuff/porting_tool/gdb_rpc.py",
    "content": "import subprocess, os, threading, socket, sys, signal, time, functools\n\ntoken = os.urandom(16).hex()\n\nrpc_server = '''\nimport sys\nsys.stdin = sys.__stdin__\nsys.stdout = sys.__stdout__\nprint(%r)\n\nwhile True:\n    try: prompt = input()\n    except (EOFError, KeyboardInterrupt):\n        gdb.execute('quit')\n        break\n    try: ans = eval(prompt)\n    except gdb.error as e: ans = str(e)\n    print(repr([[[ans]]]))\n'''%token\n\nclass DisconnectedException(Exception): pass\n\nclass GDB:\n    def __init__(self, ps5_ip, ps5_port=9019):\n        self.ps5_ip = ps5_ip\n        self.ps5_port = ps5_port\n        self.payload = None\n        self.payload_path = None\n        self.r0gdb_cflags = None\n        self.kstuff_cflags = None\n        self.self_dumper_flags = None\n        self.popen = None\n        threading.Thread(target=self._monitor, daemon=True).start()\n    def bind_socket(self):\n        with socket.socket(socket.AF_INET, socket.SOCK_DGRAM) as sock0:\n            sock0.connect((self.ps5_ip, self.ps5_port))\n            addr = sock0.getsockname()[0]\n        sock = socket.socket()\n        sock.bind((addr, 0))\n        sock.listen(1)\n        return sock, sock.getsockname()\n    def use_r0gdb(self, flags=[]):\n        if self.popen == None or self.payload != 'r0gdb' or self.r0gdb_cflags != flags:\n            self.kill()\n            if self.r0gdb_cflags != flags:\n                self.build('prosper0gdb', flags)\n                self.r0gdb_cflags = flags\n                self.kstuff_cflags = None\n                self.self_dumper_flags = None\n            self.send_payload('prosper0gdb/payload.bin')\n            self.connect_gdb()\n            self.payload = 'r0gdb'\n            return True\n        return False\n    def use_kstuff(self, flags1=[], flags2=[]):\n        if self.popen == None or self.payload != 'kstuff' or self.r0gdb_cflags != flags1 or self.kstuff_cflags != flags2:\n            self.kill()\n            if self.r0gdb_cflags != flags1:\n                self.build('prosper0gdb', flags1)\n                self.r0gdb_cflags = flags1\n                self.kstuff_cflags = None\n                self.self_dumper_flags = None\n            if self.kstuff_cflags != flags2:\n                self.build('ps5-kstuff', flags2)\n                self.kstuff_cflags = flags2\n            self.send_payload('ps5-kstuff/payload-gdb.bin')\n            self.connect_gdb()\n            self.payload = 'kstuff'\n            return True\n        return False\n    def use_self_dumper(self, flags1=[], flags2=[]):\n        if self.popen == None or self.payload != 'self_dumper' or self.r0gdb_cflags != flags1 or self.self_dumper_flags != flags2:\n            self.kill()\n            if self.r0gdb_cflags != flags1:\n                self.build('prosper0gdb', flags1)\n                self.r0gdb_cflags = flags1\n                self.kstuff_cflags = None\n                self.self_dumper_flags = None\n            if self.self_dumper_flags != flags2:\n                self.build('ps5-self-dumper', flags2)\n                self.self_dumper_flags = flags2\n            self.send_payload('ps5-self-dumper/payload-gdb.bin')\n            self.connect_gdb()\n            self.payload = 'self_dumper'\n            return True\n        return False\n    def build(self, payload, flags):\n        assert not subprocess.call(('make', 'EXTRA_CFLAGS='+' '.join(flags), 'clean', 'all'), cwd='../../'+payload)\n    def send_payload(self, path):\n        with open('../../'+path, 'rb') as file:\n            data = memoryview(file.read())\n        while True:\n            print('Connecting to PS5...', end='')\n            sys.stdout.flush()\n            while True:\n                try: sock = socket.create_connection((self.ps5_ip, self.ps5_port), timeout=5)\n                except socket.error:\n                    sys.stdout.write('.')\n                    sys.stdout.flush()\n                    time.sleep(1)\n                    continue\n                break\n            with sock:\n                sock.settimeout(None)\n                while data:\n                    try: chk = sock.send(data)\n                    except socket.error: break\n                    data = data[chk:]\n                else:\n                    print(' done')\n                    self.payload_path = path\n                    if self.payload_path.endswith('.bin'):\n                        self.payload_path = self.payload_path[:-4]+'.elf'\n                    return\n                print(' error, retrying')\n    def _monitor(self):\n        alive = False\n        while True:\n            p = subprocess.Popen(('ping', '-W', '5', self.ps5_ip), stdout=subprocess.PIPE, stderr=subprocess.DEVNULL, preexec_fn=type(self._monitor)(signal.alarm, 5))\n            q = p.communicate()[0]\n            if p.wait() > 0 or b'64 bytes from ' not in q:\n                if alive:\n                    print()\n                    print('##################################################################################')\n                    print('# Cannot ping PS5. It has probably panicked or hung. Restart the PS5 to proceed. #')\n                    print('##################################################################################')\n                    alive = False\n                q = self.popen\n                if q is not None:\n                    q.kill()\n            else:\n                alive = True\n    def kill(self):\n        self.popen.kill()\n        self.popen = None\n        self.stdio = None\n    def _write(self, chk, tl=None):\n        if tl is not None: self.stdio.settimeout(tl-time.time())\n        else: self.stdio.settimeout(None)\n        try: self.stdio.sendall(chk)\n        except OSError:\n            self.popen.kill()\n            self.popen = None\n            self.stdio = None\n            raise DisconnectedException(\"write failed\")\n    def _read_until(self, ending, tl=None):\n        q = b''\n        while not q.endswith(ending):\n            try:\n                if tl is not None: self.stdio.settimeout(tl-time.time())\n                else: self.stdio.settimeout(None)\n                chk = self.stdio.recv(1)\n            except OSError: chk = b''\n            if not chk:\n                self.popen.kill()\n                self.popen = None\n                self.stdio = None\n                raise DisconnectedException(\"read failed\")\n            q += chk\n        return q\n    def _read_eval(self, tl=None):\n        while True:\n            ln = self._read_until(b'\\n', tl)\n            if ln.startswith(b'[[['):\n                return eval(ln.decode('ascii'))[0][0][0]\n    def connect_gdb(self):\n        assert self.popen == None\n        print('Connecting GDB... ', end='')\n        sys.stdout.flush()\n        self.stdio, stdio = socket.socketpair(socket.AF_UNIX)\n        with stdio:\n            self.popen = subprocess.Popen(('gdb', '../../'+self.payload_path, '-ex', 'target remote '+self.ps5_ip+':1234', '-ex', 'py\\n'+rpc_server+'\\nend'), stdin=stdio, stdout=stdio, bufsize=0, preexec_fn=lambda: signal.pthread_sigmask(signal.SIG_BLOCK, [signal.SIGINT]))\n        self._read_until(token.encode('ascii')+b'\\n')\n        print('done')\n    def execute(self, cmd, timeout=None):\n        if timeout is not None: timeout += time.time()\n        assert self.popen != None\n        self._write(('gdb.execute('+repr(cmd)+', to_string=True)\\n').encode(), timeout)\n        return self._read_eval(timeout)\n    def eval(self, expr, timeout=None, how='str'):\n        if timeout is not None: timeout += time.time()\n        assert self.popen != None\n        self._write((how+'(gdb.parse_and_eval('+repr(expr)+'))\\n').encode(), timeout)\n        return self._read_eval(timeout)\n    def ieval(self, expr, timeout=None):\n        ans = self.eval(expr, timeout, 'int')\n        if not isinstance(ans, int):\n            self.kill()\n            raise DisconnectedException(ans)\n        return ans\n    def struct_fields(self, expr, timeout=None):\n        if timeout is not None: timeout += time.time()\n        assert self.popen != None\n        self._write(('list(gdb.parse_and_eval('+repr(expr)+').type)\\n').encode(), timeout)\n        return self._read_eval(timeout)\n    def kill(self):\n        if self.popen == None: return\n        try: self.execute('p (int)kill(1, 30)', 5)\n        except DisconnectedException: return\n        self.popen.kill()\n        self.popen = None\n        self.stdio = None\n\nclass SocketWorker:\n    def __init__(self, gdb, data, title):\n        self.data = self.prepare(data)\n        self.sock, (self.host, self.port) = gdb.bind_socket()\n        self.title = title\n    def __enter__(self):\n        self.sock.__enter__()\n        self.thr = threading.Thread(target=self.run, daemon=True)\n        self.thr.start()\n        sys.stdout.write(self.title+'... ')\n        sys.stdout.flush()\n        return self.host, self.port\n    def __exit__(self, tp, err, tb):\n        try:\n            if tp is not None:\n                self.sock.close()\n            self.thr.join()\n            print()\n        finally:\n            self.sock.__exit__(tp, err, tb)\n    def prepare(self, q):\n        return q\n    def op(self, sock):\n        ...\n    def run(self):\n        with self.sock.accept()[0] as sock:\n            total = 0\n            while True:\n                q = self.op(sock)\n                if not q: break\n                total += q\n                s = str(total)\n                s += '\\b'*len(s)\n                sys.stdout.write(s)\n                sys.stdout.flush()\n\nclass BlobReceiver(SocketWorker):\n    def op(self, sock):\n        q = sock.recv(4096)\n        self.data += q\n        return len(q)\n\nclass BlobSender(SocketWorker):\n    def prepare(self, data):\n        return memoryview(data)\n    def op(self, sock):\n        q = sock.send(self.data[:65536])\n        self.data = self.data[q:]\n        return q\n\nclass R0GDB:\n    def __init__(self, gdb, cflags=[]):\n        self.gdb = gdb\n        self.cflags = cflags\n        self.trace_size = -1\n    def trace_to_raw(self):\n        self.gdb.execute('p r0gdb()')\n        self.trace_size = -2\n    def use_raw_fn(self, fn):\n        @functools.wraps(fn)\n        def wrapper(do_r0gdb=True, *args, **kwds):\n            if self.trace_size not in ((-1, -2) if do_r0gdb else (-1,)):\n                self.gdb.kill()\n            if self.gdb.use_r0gdb(self.cflags):\n                self.trace_size = -1\n                fn(*args, **kwds)\n            if self.trace_size == -1:\n                if do_r0gdb:\n                    self.gdb.execute('p r0gdb()')\n                    self.trace_size = -2\n        return wrapper\n    def use_trace_fn(self, fn):\n        @functools.wraps(fn)\n        def wrapper(trace_size, *args, **kwds):\n            if self.trace_size < -1:\n                self.gdb.kill()\n            if self.gdb.use_r0gdb(self.cflags):\n                self.trace_size = -1\n                fn(*args, **kwds)\n            if trace_size > self.trace_size:\n                if ' = void\\n' not in self.gdb.execute('p r0gdb_trace('+str(trace_size)+')'):\n                    self.gdb.kill()\n                    raise DisconnectedException(\"r0gdb_trace failed\")\n                self.trace_size = trace_size\n        return wrapper\n    def do_trace(self, prog, rip, *args):\n        assert self.gdb.eval('r0gdb_trace_reset()') == 'void'\n        self.gdb.ieval('trace_prog = '+prog)\n        self.gdb.ieval('$pc = %s'%rip)\n        for i, j in zip(('rdi', 'rsi', 'rdx', 'rcx', 'r8', 'r9', 'rax'), args):\n            self.gdb.ieval('$%s = %s'%(i, j))\n        self.gdb.execute('stepi')\n    def get_trace(self):\n        ans = bytearray()\n        with BlobReceiver(self.gdb, ans, 'dumping trace') as addr:\n            assert not self.gdb.ieval('r0gdb_trace_send(\"%s\", %d)'%addr)\n        return bytes(ans)\n    def trace(self, *args):\n        self.do_trace(*args)\n        return self.get_trace()\n"
  },
  {
    "path": "ps5-kstuff/porting_tool/main.py",
    "content": "import sys, json, threading, functools, os.path, collections, tarfile, io, re, time\n\nif 'linux' not in sys.platform:\n    print('This tool only supports GNU/Linux! Use Docker or WSL on other OSes.')\n    input('Press Enter to exit')\n    exit(1)\nelif len(sys.argv) not in (3, 4, 5):\n    print('usage: main.py <database> <ps5 ip> [port for payload loader] [kernel data dump]')\n    exit(0)\n\nimport gdb_rpc, traces\n\ngdb = gdb_rpc.GDB(sys.argv[2]) if len(sys.argv) == 3 else gdb_rpc.GDB(sys.argv[2], int(sys.argv[3]))\n\nwith open(sys.argv[1]) as file:\n    symbols = json.load(file)\n\navailable_symbols = set()\n\ndef die(*args):\n    print(*args)\n    exit(1)\n\ndef get_symbol(k):\n    assert k in available_symbols, k\n    return symbols[k]\n\ndef set_symbol(k, v):\n    assert k not in symbols or symbols[k] == v\n    if k not in symbols:\n        print('offset found! %s = %s'%(k, hex(v) if isinstance(v, int) else v))\n        symbols[k] = v\n        with open(sys.argv[1], 'w') as file:\n            json.dump(symbols, file)\n        available_symbols.add(k)\n\nif 'allproc' not in symbols:\n    die('`allproc` is not defined')\n\navailable_symbols.add('allproc')\n\nR0GDB_FLAGS = ['-DMEMRW_FALLBACK', '-DNO_BUILTIN_OFFSETS']\nSELF_DUMPER_FLAGS = ['-DMEMRW_FALLBACK']\nKSTUFF_FLAGS = ['-DMEMRW_FALLBACK', '-DFIRMWARE_PORTING']\n\nr0gdb = gdb_rpc.R0GDB(gdb, R0GDB_FLAGS)\n\ndef ostr(x):\n    return str(x % 2**64)\n\ndef retry_on_error(f):\n    @functools.wraps(f)\n    def f1(*args):\n        while True:\n            try: ans = f(*args)\n            except gdb_rpc.DisconnectedException:\n                print('\\nPS5 disconnected, retrying %s...'%f.__name__)\n                continue\n            if ans == None or (isinstance(ans, tuple) and None in ans):\n                print('\\nfailed to find some offsets related to %s, retrying...'%f.__name__)\n                continue\n            return ans\n    return f1\n\nderivations = []\n\ndef derive_symbol(f):\n    derivations.append(f)\n    return f\n\ndef derive_symbols(*names):\n    def inner(f):\n        derivations.append((f, names))\n        return f\n    return inner\n\n@retry_on_error\ndef dump_kernel():\n    if len(sys.argv) == 5 and os.path.exists(sys.argv[4]):\n        with open(sys.argv[4], 'rb') as file:\n            data = file.read()\n        if int.from_bytes(data[8:16], 'little') == len(data) - 16:\n            return data[16:], int.from_bytes(data[:8], 'little')\n    gdb.use_r0gdb(R0GDB_FLAGS)\n    kdata_base = gdb.ieval('kdata_base')\n    gdb.eval('offsets.allproc = '+ostr(kdata_base + get_symbol('allproc')))\n    if not gdb.ieval('rpipe'): gdb.eval('r0gdb_init_with_offsets()')\n    local_buf = bytearray()\n    with gdb_rpc.BlobReceiver(gdb, local_buf, 'dumping kdata') as addr:\n        remote_fd = gdb.ieval('r0gdb_open_socket(\"%s\", %d)'%addr)\n        remote_buf = gdb.ieval('malloc(1048576)')\n        one_second = gdb.ieval('(void*)(uint64_t[2]){1, 0}')\n        total_sent = 0\n        while total_sent < (134 << 20):\n            chk0 = gdb.ieval('copyout(%d, %d, %d)'%(remote_buf, kdata_base+total_sent, min(1048576, (134 << 20) - total_sent)))\n            if chk0 <= 0: break\n            assert not gdb.ieval('r0gdb_sendall(%d, %d, %d)'%(remote_fd, remote_buf, chk0))\n            total_sent += chk0\n            #offset = 0\n            #while offset < chk0:\n            #    chk = gdb.ieval('(int)write(%d, %d, %d)'%(remote_fd, remote_buf+offset, chk0-offset))\n            #    assert chk > 0\n            #    offset += chk\n            #    total_sent += chk\n        # this loop is to detect panics while dumping\n        while len(local_buf) != total_sent:\n            gdb.eval('(int)nanosleep(%d)'%one_second)\n        gdb.eval('(int)close(%d)'%remote_fd)\n    if len(sys.argv) == 5:\n        with open(sys.argv[4], 'wb') as file:\n            file.write(kdata_base.to_bytes(8, 'little'))\n            file.write(len(local_buf).to_bytes(8, 'little'))\n            file.write(local_buf)\n    return bytes(local_buf), kdata_base\n\ndef get_kernel(_cache=[]):\n    if not _cache:\n        _cache.append(dump_kernel())\n    return _cache[0]\n\n@derive_symbol\n@retry_on_error\ndef rootvnode():\n    kernel, kdata_base = get_kernel()\n    root_names = ['mini-syscore.elf', 'SceSysAvControl.elf', 'system', 'user', 'update', 'preinst']\n    ptrs = None\n    for i in root_names:\n        ii = bytearray(len(i)*2+2)\n        ii[:len(i)*2:2] = i.encode('ascii')\n        ptrs1 = {j[-8:] for j in kernel.split(ii)[:-1]}\n        if ptrs is None: ptrs = ptrs1\n        else: ptrs &= ptrs1\n    rootvnode_value, = ptrs\n    i = 0\n    candidates = []\n    while True:\n        i = kernel.find(rootvnode_value, i)\n        if i < 0: break\n        if kernel[i+16:i+24] == b'\\xff\\xff\\xff\\xff\\x01\\x00\\x00\\x00':\n            candidates.append(i)\n        i += 1\n    ans, = candidates\n    return ans\n\n@derive_symbol\n@retry_on_error\ndef idt():\n    kernel, kdata_base = get_kernel()\n    ks = bytes(kernel[i+2:i+4] == b'\\x20\\x00' and kernel[i+4] < 8 and kernel[i+5] in (0x8e, 0xee) and kernel[i+8:i+16] == b'\\xff\\xff\\xff\\xff\\x00\\x00\\x00\\x00' for i in range(0, len(kernel), 16))\n    offset = ks.find(b'\\1'*256)\n    assert ks.find(b'\\1'*256, offset+1) < 0\n    return offset * 16\n\n@derive_symbol\n@retry_on_error\ndef gdt_array():\n    kernel, kdata_base = get_kernel()\n    ks = kernel[5::8]\n    needle = b'\\x00\\x00\\xf3\\xf3\\x9b\\x93\\xfb\\xf3\\xfb\\x8b\\x00\\x00\\x00' * 16\n    offset = ks.find(needle)\n    assert ks.find(needle, offset+1) < 0\n    return offset * 8\n\n@derive_symbol\n@retry_on_error\ndef tss_array():\n    kernel, kdata_base = get_kernel()\n    gdt_array = get_symbol('gdt_array')\n    tss_array = []\n    for i in range(16):\n        j = gdt_array + 0x68 * i + 0x48\n        tss_array.append(int.from_bytes(kernel[j+2:j+5]+kernel[j+7:j+12], 'little'))\n    assert tss_array == list(range(tss_array[0], tss_array[-1]+0x68, 0x68))\n    return tss_array[0] - kdata_base\n\n# XXX: relies on in-structure offsets, is it ok?\n@derive_symbol\n@retry_on_error\ndef pcpu_array():\n    kernel, kdata_base = get_kernel()\n    planes = [b''.join(kernel[j+0x34:j+0x38]+kernel[j+0x730:j+0x738] for j in range(i, len(kernel), 0x900)) for i in range(0, 0x900, 4)]\n    needle = b''.join(i.to_bytes(4, 'little')*3 for i in range(16))\n    indices = [i.find(needle) for i in planes]\n    unique_indices = set(indices)\n    assert len(unique_indices) == 2 and -1 in unique_indices\n    unique_indices.discard(-1)\n    i = unique_indices.pop()\n    j = indices.index(i)\n    indices[j] = -1\n    assert set(indices) == {-1}\n    assert planes[j].find(needle, i+1) < 0\n    return (i // 12) * 0x900 + j * 4\n\ndef get_string_xref(name, offset):\n    kernel, kdata_base = get_kernel()\n    s = kernel.find((name+'\\0').encode('ascii'))\n    return kernel.find((kdata_base+s).to_bytes(8, 'little')) - offset\n\n@derive_symbol\n@retry_on_error\ndef sysentvec(): return get_string_xref('Native SELF', 0x48)\n\n@derive_symbol\n@retry_on_error\ndef sysentvec_ps4(): return get_string_xref('PS4 SELF', 0x48)\n\ndef deref(name, offset=0):\n    kernel, kdata_base = get_kernel()\n    return int.from_bytes(kernel[get_symbol(name)+offset:get_symbol(name)+offset+8], 'little') - kdata_base\n\n@derive_symbol\n@retry_on_error\ndef sysents(): return deref('sysentvec', 8)\n\n@derive_symbol\n@retry_on_error\ndef sysents_ps4(): return deref('sysentvec_ps4', 8)\n\n# XXX: do we need to also find (calculate?) the header size?\n@derive_symbol\n@retry_on_error\ndef mini_syscore_header():\n    kernel, kdata_base = get_kernel()\n    gdb.use_r0gdb(R0GDB_FLAGS)\n    try: remote_fd = gdb.ieval('(int)open(\"/mini-syscore.elf\", 0)')\n    except gdb_rpc.DisconnectedException:\n        message = ('''\\\nYou probably have wrong OFFSET_KERNEL_DATA_BASE_ROOTVNODE in the WebKit exploit. Fix this before proceeding.\nThe correct offset is probably '''+hex(get_symbol('rootvnode'))).split('\\n')\n        maxlen = max(map(len, message))\n        print('#'*(maxlen+2))\n        for i in message:\n            print('#'+i+' '*(maxlen-len(i))+'#')\n        print('#'*(maxlen+2))\n        raise\n    remote_buf = gdb.ieval('malloc(4096)')\n    assert gdb.ieval('(int)read(%d, %d, 4096)'%(remote_fd, remote_buf)) == 4096\n    gdb.execute('set print elements 0')\n    gdb.execute('set print repeats 0')\n    ans = gdb.eval('((int)close(%d), {unsigned int[1024]}%d)'%(remote_fd, remote_buf))\n    assert ans.startswith('{') and ans.endswith('}') and ans.count(',') == 1023, ans\n    header = b''.join(int(i).to_bytes(4, 'little') for i in ans[1:-1].split(','))\n    return kernel.find(header)\n\n# https://github.com/cheburek3000/meme_dumper/blob/main/source/main.c#L80, guess_kernel_pmap_store_offset\n@derive_symbol\n@retry_on_error\ndef kernel_pmap_store():\n    kernel, kdata_base = get_kernel()\n    needle = (0x1430000 | (4 << 128)).to_bytes(24, 'little')\n    i = 0\n    ans = []\n    while True:\n        i = kernel.find(needle, i)\n        if i < 0: break\n        if any(kernel[i+24:i+32]) and kernel[i+24:i+28] == kernel[i+32:i+36] and not any(kernel[i+36:i+40]):\n            ans.append(i - 8)\n        i += 1\n    return ans[-1]\n\n@derive_symbol\n@retry_on_error\ndef lapic_map():\n    kernel, kdata_base = get_kernel()\n    dmem_base = deref('kernel_pmap_store', 32) - deref('kernel_pmap_store', 40)\n    needle = (dmem_base + 0xfee00000).to_bytes(8, 'little')\n    ans = kernel.find(needle)\n    assert ans % 8 == 0 and kernel.find(needle, ans+1) < 0\n    return ans\n\n@derive_symbol\n@retry_on_error\ndef crypt_singleton_array():\n    kernel, kdata_base = get_kernel()\n    ks = kernel[6::8]\n    ks1 = kernel[7::8]\n    needle = b'\\xff\\x00\\xff\\xff\\xff\\x00\\x00\\xff\\x00\\xff\\xff\\x00\\x00\\xff\\x00\\x00\\x00\\x00\\xff\\x00\\xff\\x00'\n    offset = ks.find(needle)\n    assert offset >= 0 and ks.find(needle, offset+1) < 0\n    assert ks1[offset:offset+len(needle)] == needle\n    return offset * 8\n\n@derive_symbol\n@retry_on_error\ndef s_shutdown_final():\n    kernel, kdata_base = get_kernel()\n    return kernel.find(b'shutdown_final\\x00')\n\ndef virt2phys(virt, phys, addr):\n    #print(hex(virt), hex(phys), hex(addr))\n    assert phys == virt % 2**32\n    pml = phys\n    for i in range(39, 3, -9):\n        idx = (addr >> i) & 511\n        pml_next = gdb.ieval('{void*}%d'%(pml+idx*8+virt-phys))\n        if pml_next & 128:\n            ans = (pml_next & (2**48 - 2**i)) | (addr & (2**i - 1))\n            break\n        pml = pml_next & (2**48 - 2**12)\n    else:\n        ans = pml | (addr & 4095)\n    #print('->', hex(ans))\n    return ans\n\n@derive_symbol\n@retry_on_error\ndef doreti_iret():\n    gdb.use_r0gdb(R0GDB_FLAGS)\n    kdata_base = gdb.ieval('kdata_base')\n    gdb.eval('offsets.allproc = '+ostr(kdata_base + get_symbol('allproc')))\n    if not gdb.ieval('rpipe'): gdb.eval('r0gdb_init_with_offsets()')\n    idt = kdata_base + get_symbol('idt')\n    tss_array = kdata_base + get_symbol('tss_array')\n    #buf = gdb.ieval('{void*}%d'%(tss_array+0x1c+4*8))\n    buf = gdb.ieval('kmalloc(2048)') + 2048\n    for i in range(16):\n        tss = tss_array + i * 0x68\n        gdb.ieval('{void*}%d = %d'%(tss+0x1c+4*8, buf))\n    gdb.ieval('{char}%d = 0'%(idt+1*16+4))\n    gdb.ieval('{char}%d = 4'%(idt+13*16+4))\n    ptr = gdb.ieval('{void*}({void*}(get_thread()+8)+0x200)+0x300')\n    virt = gdb.ieval('{void*}%d'%ptr)\n    phys = gdb.ieval('{void*}%d'%(ptr+8))\n    buf_phys = virt2phys(virt, phys, buf)\n    pages = set()\n    while True:\n        page = gdb.ieval('kmalloc(2048)') & -4096\n        if page in pages: break\n        pages.add(page)\n    gdb.ieval('(void*)({void*[512]}%d = {%s})'%(page, ', '.join(map(str, ((i<<39)|135 for i in range(512))))))\n    gdb.ieval('{void*}%d = %d'%(virt+8, virt2phys(virt, phys, page)|7))\n    buf_alias = buf_phys | (1 << 39)\n    #print(hex(buf), hex(buf_alias))\n    gdb.eval('bind_to_all_available_cpus()')\n    assert not gdb.ieval('(int)pthread_create(malloc(8), 0, hammer_thread, (uint64_t[2]){%d, malloc(65536)+65536})'%(buf_alias-32))\n    assert not gdb.ieval('bind_to_some_cpu(0)')\n    if 'Remote connection closed' in gdb.eval('jmp_setcontext(1ull<<50)'):\n        raise gdb_rpc.DisconnectedException('jmp_setcontext')\n    pc = gdb.ieval('$pc')\n    gdb.kill()\n    assert (pc >> 32) == 16\n    pc |= (2**64 - 2**32)\n    return pc - kdata_base\n\ndef do_use_r0gdb_raw():\n    kdata_base = gdb.ieval('kdata_base')\n    gdb.eval('offsets.allproc = '+ostr(kdata_base + get_symbol('allproc')))\n    if not gdb.ieval('rpipe'): gdb.eval('r0gdb_init_with_offsets()')\n    gdb.eval('offsets.doreti_iret = '+ostr(kdata_base + get_symbol('doreti_iret')))\n    gdb.eval('offsets.add_rsp_iret = offsets.doreti_iret - 7')\n    gdb.eval('offsets.swapgs_add_rsp_iret = offsets.add_rsp_iret - 3')\n    gdb.eval('offsets.idt = '+ostr(kdata_base + get_symbol('idt')))\n    gdb.eval('offsets.tss_array = '+ostr(kdata_base + get_symbol('tss_array')))\n\nuse_r0gdb_raw = r0gdb.use_raw_fn(do_use_r0gdb_raw)\n\n@derive_symbols('push_pop_all_iret', 'rdmsr_start', 'pop_all_iret', 'justreturn')\n@retry_on_error\ndef justreturn():\n    use_r0gdb_raw()\n    kdata_base = gdb.ieval('kdata_base')\n    idt = kdata_base + get_symbol('idt')\n    int244 = (gdb.ieval('{void*}%d'%(idt+244*16+6), 5) % 2**48) * 2**16 + gdb.ieval('{unsigned short}%d'%(idt+244*16), 5)\n    print('single-stepping...')\n    def step():\n        gdb.execute('stepi', 15)\n        print(hex(gdb.ieval('$pc')), hex(gdb.ieval('$rsp')))\n    gdb.ieval('$pc = %d'%int244)\n    step()\n    step()\n    # step until rdmsr\n    rsp0 = gdb.ieval('$rsp')\n    rax = gdb.ieval('$rax')\n    rdx = gdb.ieval('$rdx')\n    pc = gdb.ieval('$pc')\n    while True:\n        step()\n        assert gdb.ieval('$rsp') == rsp0\n        if gdb.ieval('$rax') != rax and gdb.ieval('$rdx') != rdx:\n            break\n        pc = gdb.ieval('$pc')\n    rdmsr = pc\n    assert gdb.ieval('$pc') == rdmsr + 2\n    # step until the function call & through it\n    while gdb.ieval('$rsp') == rsp0: step()\n    while gdb.ieval('$rsp') != rsp0: step()\n    pc = gdb.ieval('$pc')\n    step()\n    # check that we actually jumped (somewhere...)\n    assert (gdb.ieval('$pc') - pc) % 2**64 >= 16\n    justreturn = gdb.ieval('$pc') - 16\n    gdb.ieval('{void*}$rsp = 0x1337133713371337')\n    # step until ld_regs\n    while gdb.ieval('$rdi') != 0x1337133713371337:\n        pc = gdb.ieval('$pc')\n        step()\n    pop_all_iret = pc\n    # sanity check on justreturn\n    rsp0 = gdb.ieval('$rsp')\n    gdb.ieval('$pc = %d'%justreturn)\n    gdb.ieval('$rax = 0x4141414142424242')\n    step()\n    assert gdb.ieval('$rsp') == rsp0 - 8 and gdb.ieval('{void*}$rsp') == 0x4141414142424242\n    return int244-kdata_base, rdmsr-kdata_base, pop_all_iret-kdata_base, justreturn-kdata_base\n\n@derive_symbol\n@retry_on_error\ndef wrmsr_ret():\n    use_r0gdb_raw()\n    kdata_base = gdb.ieval('kdata_base')\n    gdb.ieval('$pc = %d'%(kdata_base+get_symbol('justreturn')))\n    print('single-stepping...')\n    while gdb.ieval('($eflags = 0x102, $rcx)') != 0x80b:\n        gdb.execute('stepi')\n        print(hex(gdb.ieval('$pc')), hex(gdb.ieval('$rsp')))\n    gdb.execute('stepi')\n    gdb.execute('stepi')\n    wrmsr = gdb.ieval('$pc')\n    try: gdb.execute('stepi')\n    except gdb_rpc.DisconnectedException: pass\n    else: assert False\n    return wrmsr-kdata_base\n\n@derive_symbols('eventhandler_register', 'kproc_shutdown')\n@retry_on_error\ndef eventhandler_register():\n    kernel, kdata_base = get_kernel()\n    vnlru_string = kernel.find(b'SceVnlru\\x00')\n    assert vnlru_string >= 0 and kernel.find(b'SceVnlru\\x00', vnlru_string+1) < 0\n    vnlru_ptr = (kdata_base + vnlru_string).to_bytes(8, 'little')\n    vnlru_xref = kernel.find(vnlru_ptr)\n    assert vnlru_xref >= 0 and vnlru_xref % 8 == 0 and kernel.find(vnlru_ptr, vnlru_xref+1) < 0\n    vnlru_proc = int.from_bytes(kernel[vnlru_xref+8:vnlru_xref+16], 'little') - kdata_base\n    use_r0gdb_raw()\n    gdb.ieval('$rsp = ((unsigned long long)$rsp & -16) | 8')\n    kdata_base = gdb.ieval('kdata_base')\n    vnlru_proc += kdata_base\n    gdb.ieval('$pc = '+ostr(vnlru_proc))\n    gdb.execute('stepi')\n    pc = gdb.ieval('$pc')\n    while True:\n        gdb.execute('stepi')\n        pc1 = gdb.ieval('$pc')\n        if pc1 not in range(pc, pc+16):\n            assert gdb.ieval('$rsp') % 16 == 8\n            break\n        pc = pc1\n    pc = kdata_base + get_symbol('wrmsr_ret') + 2\n    gdb.ieval('$pc = '+ostr(pc))\n    while True:\n        gdb.execute('stepi')\n        if gdb.ieval('$rsp') % 16 == 8:\n            break\n    eventhandler_register = gdb.ieval('$pc') % 2**64\n    kproc_shutdown = gdb.ieval('$rdx') % 2**64\n    return eventhandler_register - kdata_base, kproc_shutdown - kdata_base\n\ndef do_use_r0gdb_trace():\n    do_use_r0gdb_raw()\n    kdata_base = gdb.ieval('kdata_base')\n    gdb.ieval('offsets.rdmsr_start = '+ostr(kdata_base+get_symbol('rdmsr_start')))\n    gdb.ieval('offsets.wrmsr_ret = '+ostr(kdata_base+get_symbol('wrmsr_ret')))\n    gdb.ieval('offsets.nop_ret = '+ostr(kdata_base+get_symbol('wrmsr_ret')+2))\n    if 'rep_movsb_pop_rbp_ret' in symbols:\n        gdb.ieval('offsets.rep_movsb_pop_rbp_ret = '+ostr(kdata_base+get_symbol('rep_movsb_pop_rbp_ret')))\n    if 'cpu_switch' in symbols:\n        gdb.ieval('offsets.cpu_switch = '+ostr(kdata_base+get_symbol('cpu_switch')))\n\nuse_r0gdb_trace = r0gdb.use_trace_fn(do_use_r0gdb_trace)\n\ndef use_self_dumper():\n    if gdb.use_self_dumper(R0GDB_FLAGS, SELF_DUMPER_FLAGS):\n        do_use_r0gdb_trace()\n        kdata_base = gdb.ieval('kdata_base')\n        gdb.ieval('offsets.mmap_self_fix_1_end = (offsets.mmap_self_fix_1_start = %s) + 2'%ostr(kdata_base + get_symbol('mmap_self_fix_1_start')))\n        gdb.ieval('offsets.mmap_self_fix_2_end = (offsets.mmap_self_fix_2_start = %s) + 2'%ostr(kdata_base + get_symbol('mmap_self_fix_2_start')))\n        gdb.ieval('offsets.sceSblAuthMgrSmIsLoadable2 = '+ostr(kdata_base + get_symbol('sceSblAuthMgrSmIsLoadable2')))\n        assert 'void' == gdb.eval('set_sigsegv_handler()')\n\ndef use_kstuff():\n    while not gdb.use_kstuff(R0GDB_FLAGS, KSTUFF_FLAGS):\n        gdb.kill()\n    do_use_r0gdb_raw()\n    kdata_base = gdb.ieval('kdata_base')\n    syscall_parasites = symbols['syscall_parasites'] if 'syscall_parasites' in available_symbols else []\n    fself_parasites = symbols['fself_parasites'] if 'fself_parasites' in available_symbols else []\n    unsorted_parasites = symbols['unsorted_parasites'] if 'unsorted_parasites' in available_symbols else []\n    offsets_for_r0gdb = gdb.struct_fields('offsets')\n    for k in available_symbols:\n        if k in offsets_for_r0gdb:\n            gdb.ieval('offsets.%s = %s'%(k, ostr(kdata_base + symbols[k])))\n    gdb.ieval('offsets.nop_ret = '+ostr(kdata_base + get_symbol('wrmsr_ret') + 2))\n    gdb.ieval('offsets.justreturn_pop = '+ostr(kdata_base + get_symbol('justreturn') + 8))\n    gdb.ieval('offsets.mmap_self_fix_1_end = offsets.mmap_self_fix_1_start + 2')\n    gdb.ieval('offsets.mmap_self_fix_2_end = offsets.mmap_self_fix_2_start + 2')\n    gdb.ieval('offsets.mprotect_fix_end = '+ostr(kdata_base+get_symbol('mprotect_fix_start')+6))\n    gdb.ieval('offsets.pop_all_except_rdi_iret = '+ostr(kdata_base+get_symbol('pop_all_iret')+4))\n    parasites = syscall_parasites + fself_parasites + unsorted_parasites\n    assert len(parasites) <= 100\n    gdb.ieval('parasites_empty.lim_syscall = %d'%(len(syscall_parasites)))\n    gdb.ieval('parasites_empty.lim_fself = %d'%(len(syscall_parasites) + len(fself_parasites)))\n    gdb.ieval('parasites_empty.lim_total = %d'%(len(parasites)))\n    regs = [7, 6, 2, 1, 8, 9, 0, 3, 5, 10, 11, 12, 13, 14, 15, None, None, None, 4]\n    for i, (addr, reg) in enumerate(parasites):\n        assert reg in range(16)\n        gdb.ieval('(parasites_empty.parasites[%d].address = %d, parasites_empty.parasites[%d].reg = %d)'%(i, addr, i, regs.index(reg)))\n    args = []\n    if 'shellcore_offsets' in available_symbols:\n        n = len(symbols['shellcore_offsets'])\n        for addr, patch in symbols['shellcore_offsets']:\n            patch = bytes.fromhex(patch)\n            args.append('(void*)'+hex(addr))\n            args.append('\"'+''.join(map('\\\\x%02x'.__mod__, patch))+'\"')\n            args.append('(void*)'+str(len(patch)))\n        gdb.ieval('(shellcore_patches = (void*[%d]){%s}, n_shellcore_patches = %d)'%(3*n, ', '.join(args), n))\n\ndef init_kstuff():\n    assert 'void' == gdb.eval('kill_thread()')\n    assert 'void' == gdb.eval('ignore_signals()')\n    gdb.execute('cont')\n\n@derive_symbol\n@retry_on_error\ndef rep_movsb_pop_rbp_ret():\n    use_r0gdb_trace(0)\n    kdata_base = gdb.ieval('kdata_base')\n    pc0 = gdb.ieval('$pc = getpid')\n    ptr = gdb.ieval('ptr_to_leaked_rep_movsq = kmalloc(8)')\n    gdb.ieval('trace_prog = leak_rep_movsq')\n    gdb.execute('stepi')\n    assert gdb.ieval('$pc == ({void*}&p_syscall) + 5')\n    rep_movsq = gdb.ieval('{void*}%d'%ptr)\n    r0gdb.trace_to_raw()\n    # trace from rep movsq to nearby rep movsb\n    rdi = rsi = gdb.ieval('($pc = %d, $rdi = $rsi = $rsp)'%rep_movsq) % 2**64\n    while True:\n        pc = gdb.ieval('($rcx = 1, $pc)')\n        print(hex(pc), hex(rdi), hex(rsi))\n        gdb.execute('stepi')\n        rdi1 = gdb.ieval('$rdi') % 2**64\n        rsi1 = gdb.ieval('$rsi') % 2**64\n        if rdi1 == rdi + 1 and rsi1 == rsi + 1 and gdb.ieval('$rcx') == 0:\n            break\n        rdi = rdi1\n        rsi = rsi1\n    rep_movsb = pc\n    # check epilogue\n    gdb.ieval('{void*}$rsp = 0x1234')\n    gdb.ieval('{void*}($rsp+8) = 0x5678')\n    gdb.execute('stepi')\n    gdb.execute('stepi')\n    assert gdb.ieval('$rbp == 0x1234 && $rip == 0x5678')\n    # set the offset now, so that the tracing does not need to be restarted\n    gdb.ieval('offsets.rep_movsb_pop_rbp_ret = '+ostr(rep_movsb))\n    return rep_movsb - kdata_base\n\n@derive_symbols('cpu_switch', 'pmap_activate_sw')\n@retry_on_error\ndef cpu_switch():\n    use_r0gdb_trace(16777216)\n    gdb.ieval('offsets.cpu_switch = 0')\n    kdata_base = gdb.ieval('kdata_base')\n    candidates = []\n    gdb.ieval('call_trace_untrace_on_unaligned = 1')\n    while len(candidates) != 1:\n        del candidates[:]\n        trace = traces.Trace(r0gdb.trace('trace_calls', 'nanosleep', '(uint64_t[2]){1, 0}', '0'))\n        for i in range(1, len(trace)):\n            if trace.is_jump(i-1) and trace[i].rsp not in range(trace[i-1].rsp-8, trace[i-1].rsp+9) and trace[i-1].rip >= 2**63 and trace[i].rip >= 2**63:\n                candidates.append(i-1)\n    gdb.ieval('call_trace_untrace_on_unaligned = 0')\n    callee = candidates[0]\n    assert trace[callee].rsp % 16 == 0\n    caller1 = trace.find_caller(callee)\n    assert trace[caller1].rsp % 16 == 8\n    caller2 = trace.find_caller(caller1)\n    assert trace[caller2].rsp % 16 == 0\n    cpu_switch = trace[caller2+1].rip\n    # set the offset now, so that the tracing does not need to be restarted\n    gdb.ieval('offsets.cpu_switch = '+ostr(cpu_switch))\n    return cpu_switch - kdata_base, trace[callee].rip - kdata_base\n\n@derive_symbols('lidt_lldt', 'ltr_ax', 'mov_cr4_rax', 'mov_cr3_rax_mov_ds')\n@retry_on_error\ndef lidt_lldt():\n    use_r0gdb_raw()\n    kdata_base = gdb.ieval('kdata_base')\n    dmap_base = gdb.ieval('{void*}%s - {void*}%s'%(ostr(kdata_base+get_symbol('kernel_pmap_store')+32), ostr(kdata_base+get_symbol('kernel_pmap_store')+40)))\n    # the kernel spills a pointer to resumectx somewhere around 0x6b000\n    ptr = dmap_base + 0x6b000\n    while True:\n        q = gdb.ieval('{void*}'+ostr(ptr))\n        if q in range(2**64-2**32, kdata_base): break\n        ptr += 8\n    resumectx = q\n    # compensate for the kcfi trampoline\n    gdb.ieval('$pc = '+ostr(resumectx))\n    gdb.execute('stepi')\n    resumectx = gdb.ieval('$pc') % 2**64\n    # resumectx seems to be unmodified from freebsd 11, except for struct offsets, thus we have these instructions:\n    # resumectx+7: mov cr3, rax\n    # resumectx+181: mov rax, cr4\n    # resumectx+191: lidt [rdi+0xea]\n    # resumectx+198: lgdt [rdi+0xf4]\n    # resumectx+225: ltr ax\n    # if decoded from 1 byte later, they decode as:\n    # resumectx+8: and bl, al\n    # resumectx+182: and ah, al\n    # resumectx+192: add [rdi+0xea], ebx\n    # resumectx+199: add [rdi+0xf4], dl\n    # resumectx+226: add al, bl\n    # if any of the asserts below fail, this means that this assumption is no longer true\n    gdb.ieval('$rdi = ($rsp -= 256)')\n    gdb.ieval('{int}($rsp+0xea) = 123456789')\n    gdb.ieval('$ebx = 987654321')\n    gdb.ieval('$pc = '+ostr(resumectx+192))\n    gdb.execute('stepi')\n    assert gdb.ieval('$pc == '+ostr(resumectx+198)+' && {int}($rsp+0xea) == 1111111110')\n    gdb.ieval('{int}($rsp+0xf4) = -15')\n    gdb.ieval('$edx = 30')\n    gdb.ieval('$pc += 1')\n    gdb.execute('stepi')\n    assert gdb.ieval('$pc == '+ostr(resumectx+205)+' && {int}($rsp+0xf4) == -241')\n    gdb.ieval('$eax = -15, $ebx = 30, $pc = '+ostr(resumectx+226))\n    gdb.execute('stepi')\n    assert gdb.ieval('$pc == '+ostr(resumectx+228)+' && $eax == -241')\n    gdb.ieval('$eax = 0xfffff31e, $pc = '+ostr(resumectx+182))\n    gdb.execute('stepi')\n    assert gdb.ieval('$pc == '+ostr(resumectx+184)+' && (unsigned)$eax == 0xffff121e')\n    gdb.ieval('$eax = 0x414141f3, $ebx = 0x4242421e, $pc = '+ostr(resumectx+8))\n    gdb.execute('stepi')\n    assert gdb.ieval('$pc == '+ostr(resumectx+10)+' && (unsigned)$ebx == 0x42424212')\n    gdb.execute('stepi')\n    assert gdb.ieval('$pc == '+ostr(resumectx+15)+' && $eax == 0x28')\n    return resumectx + 191 - kdata_base, resumectx + 225 - kdata_base, resumectx + 181 - kdata_base, resumectx + 7 - kdata_base\n\n@derive_symbol\n@retry_on_error\ndef lgdt_rdi():\n    use_r0gdb_trace(1<<27)\n    kdata_base = gdb.ieval('kdata_base')\n    gdb.ieval('jprog = (void*[1]){0}')\n    addr = 0x1790000000\n    assert gdb.ieval('(void*)mmap('+ostr(addr)+', 4096, 3, 4098, -1, 0)') == addr\n    gdb.eval('{char[4]}'+ostr(addr)+' = \"/179\"')\n    trace1 = traces.Trace(r0gdb.trace('do_jprog', 'open', addr, 0))\n    copyinstr = next(i for i in range(len(trace1)) if trace1.is_jump(i-1) and trace1[i].rsp == trace1[i-1].rsp - 8 and trace1[i].rdi == addr and trace1[i].rdx == 1024)\n    copyinstr_ret = trace1.find_next_instr(copyinstr-1) - 1\n    copystr_addr = (trace1[copyinstr_ret].rip | 15) + 1\n    tmpbuf = gdb.ieval('kmalloc(8)')\n    getpid = gdb.ieval('{void*}%d'%(kdata_base+get_symbol('sysents')+20*48+8))\n    gdb.ieval('{void*}'+ostr(tmpbuf)+' = 0x100000000')\n    gdb.ieval('fncall_fn = '+ostr(copystr_addr))\n    gdb.ieval('(fncall_args[0] = %d, fncall_args[1] = %d, fncall_args[2] = 1, fncall_args[3] = %d)'%(tmpbuf+4, tmpbuf+6, tmpbuf))\n    gdb.ieval('fncall_no_untrace = 1')\n    gdb.ieval('sys_getpid = '+ostr(getpid))\n    trace2 = traces.Trace(r0gdb.trace('getpid_to_fncall', 'getpid'))\n    getpid = trace2.find_next_rip(0, getpid)\n    copystr_ret = trace2.find_next_instr(getpid-1) - 1\n    lgdt_addr = (trace2[copystr_ret].rip | 15) + 1\n    lgdt_addr -= kdata_base\n    # lgdt+1 should decode as \"add [rdi], edx\"\n    use_r0gdb_raw()\n    kdata_base = gdb.ieval('kdata_base')\n    lgdt_addr += kdata_base\n    gdb.ieval('{int}($rdi = $rsp) = 123456789')\n    gdb.ieval('$rdx = 987654321')\n    gdb.ieval('$pc = '+ostr(lgdt_addr+1))\n    gdb.execute('stepi')\n    assert gdb.ieval('$pc == '+ostr(lgdt_addr+3)+' && {int}$rdi == 1111111110')\n    return lgdt_addr - kdata_base\n\n@derive_symbol\n@retry_on_error\ndef mov_rdi_cr2():\n    kernel, kdata_base = get_kernel()\n    idt14 = kernel[get_symbol('idt')+14*16:get_symbol('idt')+15*16]\n    Xpage = int.from_bytes(idt14[:2]+idt14[6:12], 'little') - kdata_base\n    use_r0gdb_raw()\n    kdata_base = gdb.ieval('kdata_base')\n    Xpage += kdata_base\n    gdb.ieval('$pc = '+ostr(Xpage))\n    gdb.eval('{void*[6]}($rsp = (unsigned long long)$rsp & -16) = {0}')\n    gdb.execute('stepi')\n    pc = gdb.ieval('$pc')\n    while True:\n        print(hex(pc))\n        gdb.execute('stepi')\n        pc1 = gdb.ieval('$pc')\n        if pc1 not in range(pc, pc+16):\n            break\n        pc = pc1\n    mov_rdi_cr2 = pc1\n    print(hex(mov_rdi_cr2))\n    gdb.ieval('$pc = '+ostr(mov_rdi_cr2+1))\n    # should decode as \"and dl, bh\"\n    gdb.ieval('$rbx = 0xffffffffffffbeff')\n    gdb.ieval('$rdx = 0x12345678')\n    gdb.execute('stepi')\n    print(hex(gdb.ieval('$pc')), hex(gdb.ieval('$rbx') % 2**64), hex(gdb.ieval('$rdx')))\n    assert gdb.ieval('$pc == '+ostr(mov_rdi_cr2+3)+' && (unsigned long long)$rbx == 0xffffffffffff38ff')\n    return mov_rdi_cr2 - kdata_base\n\n@derive_symbols('syscall_before', 'syscall_after')\n@retry_on_error\ndef syscall_before():\n    use_r0gdb_trace(16777216)\n    kdata_base = gdb.ieval('kdata_base')\n    trace = traces.Trace(r0gdb.trace('trace_skip_scheduler_only', 'getpid'))\n    sys_getpid = gdb.ieval('{void*}%d'%(kdata_base+get_symbol('sysents')+48*20+8))\n    idx_getpid = trace.find_next_rip(0, sys_getpid)\n    idx_syscall_after = trace.find_next_instr(idx_getpid-1)\n    idx_syscall_before = idx_getpid - 1\n    while sys_getpid in trace[idx_syscall_before]:\n        idx_syscall_before -= 1\n    return trace[idx_syscall_before].rip - kdata_base, trace[idx_syscall_after].rip - kdata_base\n\n@derive_symbols('mov_rdi_cr3')\n@retry_on_error\ndef mov_rdi_cr3():\n    use_r0gdb_raw(do_r0gdb=False)\n    kdata_base = gdb.ieval('kdata_base')\n    thread = gdb.ieval('get_thread()')\n    use_r0gdb_raw(do_r0gdb=True)\n    gdb.ieval('$pc = '+ostr(kdata_base+get_symbol('pmap_activate_sw')))\n    gdb.ieval('$rdi = '+ostr(thread))\n    print('single-stepping...')\n    def step():\n        gdb.execute('stepi')\n        print(hex(gdb.ieval('$pc')))\n    step()\n    while gdb.ieval('(void*)$rdi') == thread:\n        gdb.ieval('$eflags = 0x102')\n        pc = gdb.ieval('$pc')\n        step()\n    mov_rdi_cr3 = pc\n    assert gdb.ieval('$pc') - mov_rdi_cr3 == 3\n    return mov_rdi_cr3 - kdata_base\n    # the rest of the code is kept for reference. there's a better mov cr3, rax gadget in resumectx\n    cr3 = gdb.ieval('(void*)$rdi')\n    assert cr3 < 2**39 and not cr3 % 4096\n    while gdb.ieval('(void*)$rax') != cr3:\n        step()\n    # the next instruction is 3-byte, but not \"mov cr3, rax\"\n    step()\n    pc = gdb.ieval('$pc')\n    while gdb.ieval('$pc') != pc + 3:\n        gdb.ieval('$eflags = 0x102')\n        pc = gdb.ieval('$pc')\n        step()\n    # this is probably the one, check that it crashes\n    mov_cr3_rax = pc\n    gdb.ieval('$pc = '+ostr(pc))\n    gdb.ieval('$rax = 0')\n    try: gdb.execute('stepi')\n    except gdb_rpc.DisconnectedException: pass\n    else: assert False, \"not mov cr3, rax\"\n    return mov_rdi_cr3 - kdata_base, mov_cr3_rax - kdata_base\n\n@derive_symbols('dr2gpr_start', 'gpr2dr_1_start', 'gpr2dr_2_start', 'mov_rax_cr0', 'mov_cr0_rax')\n@retry_on_error\ndef dr2gpr_start():\n    use_r0gdb_trace(16777216)\n    kdata_base = gdb.ieval('kdata_base')\n    gdb.ieval('offsets.syscall_after = '+ostr(kdata_base+get_symbol('syscall_after')))\n    # enable the \"has debug regs\" flag\n    td = gdb.ieval('get_thread()')\n    pcb = gdb.ieval('{void*}%d'%(td+0x3f8))\n    assert gdb.ieval('{int}%d'%(pcb+0x100)) == 24 # sanity check in case offsets have shifted\n    gdb.ieval('{int}%d = 26'%(pcb+0x100))\n    # trace nanosleep to get the 3rd argument to cpu_switch\n    trace = traces.Trace(r0gdb.trace('trace_calls', 'nanosleep', '(uint64_t[2]){1, 0}', '0'))\n    cpu_switch = trace.find_next_rip(0, kdata_base + get_symbol('cpu_switch'))\n    assert td == trace[cpu_switch].rdi\n    mtx = trace[cpu_switch].rdx\n    # now trace the entirety of cpu_switch\n    getpid = gdb.ieval('{void*}%d'%(kdata_base+get_symbol('sysents')+20*48+8))\n    gdb.ieval('fncall_fn = '+ostr(kdata_base+get_symbol('cpu_switch')))\n    gdb.ieval('(fncall_args[0] = fncall_args[1] = %d, fncall_args[2] = %d)'%(td, mtx))\n    gdb.ieval('fncall_no_untrace = 1')\n    gdb.ieval('sys_getpid = '+ostr(getpid))\n    gdb.ieval('offsets.cpu_switch = 0')\n    trace2 = traces.Trace(r0gdb.trace('getpid_to_fncall', 'getpid_for_smsw_ax'))\n    gdb.ieval('offsets.cpu_switch = '+ostr(kdata_base + get_symbol('cpu_switch')))\n    cpu_switch = trace2.find_next_rip(0, kdata_base + get_symbol('cpu_switch'))\n    # we've traced the dbreg get/set code, now find it using magic values in registers\n    dr2gpr_start = j = trace2.find_next_reg(cpu_switch, 'r11', 0xffff4ff0)\n    while not trace2.is_jump(dr2gpr_start-1): dr2gpr_start -= 1\n    while trace2[j].r11 == 0xffff4ff0: j += 1\n    gpr2dr_1_start = trace2.find_next_reg(j, 'r11', 0xffff4ff0)\n    while trace2[gpr2dr_1_start].rcx != 0x400: gpr2dr_1_start += 1\n    gpr2dr_2_start = trace2.find_next_reg(gpr2dr_1_start, 'rcx', 0xc0011024)\n    while not trace2[gpr2dr_2_start].rdx: gpr2dr_2_start += 1\n    dr2gpr_start = trace2[dr2gpr_start].rip\n    gpr2dr_1_start = trace2[gpr2dr_1_start].rip\n    gpr2dr_2_start = trace2[gpr2dr_2_start].rip\n    j = cpu_switch\n    while trace2[j].rax % 65536 != 0x33:\n        j += 1\n    assert trace2[j+1].rax == trace2[j].rax | 8\n    if trace2[j].rax == 0x80050033: # 386-style (cr0)\n        assert trace2[j].rip - trace2[j-1].rip == trace2[j+2].rip - trace2[j+1].rip == 3\n        mov_rax_cr0 = trace2[j-1].rip # mov rax, cr0\n        mov_cr0_rax = trace2[j+1].rip # mov cr0, rax\n    else: # 286-style (msw)\n        assert trace2[j].rip - trace2[j-1].rip == trace2[j+2].rip - trace2[j+1].rip == 4\n        mov_rax_cr0 = trace2[j-1].rip + 1 # smsw ax -> smsw eax\n        mov_cr0_rax = trace2[j+1].rip + 1 # lmsw ax -> lmsw eax\n    # verify the newly-found offsets\n    buf = gdb.ieval('malloc(48)')\n    gdb.ieval('offsets.dr2gpr_start = '+ostr(dr2gpr_start))\n    gdb.ieval('offsets.gpr2dr_1_start = '+ostr(gpr2dr_1_start))\n    gdb.ieval('offsets.gpr2dr_2_start = '+ostr(gpr2dr_2_start))\n    assert 'void' == gdb.eval('r0gdb_read_dbregs(%d)'%buf)\n    regs = [gdb.ieval('{void*}%d'%(buf+8*i)) for i in range(6)]\n    assert regs == [0, 0, 0, 0, 0xffff4ff0, 0x400]\n    regs = expected = [0x123, 0x456, 0x789, 0xabc, 0, 0x455]\n    for i, j in enumerate(regs): gdb.ieval('{void*}%d = %d'%(buf+8*i, j))\n    assert 'void' == gdb.eval('r0gdb_write_dbregs(%d)'%buf)\n    for i, j in enumerate(regs): gdb.ieval('{void*}%d = 0'%(buf+8*i))\n    assert 'void' == gdb.eval('r0gdb_read_dbregs(%d)'%buf)\n    regs = [gdb.ieval('{void*}%d'%(buf+8*i)) for i in range(6)]\n    expected[4] = 0xffff4ff0\n    assert regs == expected, (\"dbregs do not match after readout\", list(map(hex, regs)), list(map(hex, expected)))\n    return dr2gpr_start - kdata_base, gpr2dr_1_start - kdata_base, gpr2dr_2_start - kdata_base, mov_rax_cr0 - kdata_base, mov_cr0_rax - kdata_base\n\n@derive_symbols('malloc', 'M_something')\n@retry_on_error\ndef malloc():\n    while True:\n        use_r0gdb_trace(16777216)\n        kdata_base = gdb.ieval('kdata_base')\n        # use the ipv6 rthdr allocation to find malloc\n        # 1224 is a valid size for rthdr, and prosper0gdb already has set_rthdr_size function that wraps the raw ioctl\n        remote_sock = gdb.ieval('(int)socket(28, 2, 0)') # udpv6\n        assert remote_sock >= 0\n        trace = traces.Trace(r0gdb.trace('trace_skip_scheduler_only', 'set_rthdr_size', remote_sock, 1224))\n        assert gdb.ieval('$rax') == 0\n        malloc_calls = [i for i in range(len(trace)) if trace.is_jump(i) and trace[i+1].rsp == trace[i].rsp-8 and trace[i].rdi == 1224 and trace[i].rdx == 1]\n        if len(malloc_calls) == 1: break\n        gdb.kill()\n    malloc_call = malloc_calls[0]\n    malloc = trace[malloc_call+1].rip\n    M_something = trace[malloc_call+1].rsi\n    return malloc - kdata_base, M_something - kdata_base\n\n@derive_symbol\n@retry_on_error\ndef mprotect_fix_start():\n    use_r0gdb_trace(16777216)\n    kdata_base = gdb.ieval('kdata_base')\n    buf = gdb.ieval('malloc(16384)')\n    # get 2 traces to diff\n    trace1 = traces.Trace(r0gdb.trace('trace_skip_scheduler_only', 'mprotect', buf, 1, 3))\n    trace2 = traces.Trace(r0gdb.trace('trace_skip_scheduler_only', 'mprotect', buf, 1, 7))\n    # determine the point of divergence\n    i1 = trace1.find_next_rip(0, kdata_base + get_symbol('syscall_after'))\n    i2 = trace2.find_next_rip(0, kdata_base + get_symbol('syscall_after'))\n    j1 = trace1.find_last_callee_ret(trace1.find_last_callee_ret(i1))\n    j2 = trace2.find_last_callee_ret(trace2.find_last_callee_ret(i2))\n    k1 = trace1.find_caller(j1) + 1\n    k2 = trace2.find_caller(j2) + 1\n    while k1 < j1 and k2 < j2 and trace1[k1].rip == trace2[k2].rip:\n        k1 = trace1.find_next_instr(k1)\n        k2 = trace2.find_next_instr(k2)\n    assert k1 < j1 and k2 < j2 and trace1[k1-1].rip == trace2[k2-1].rip\n    return trace1[k1-1].rip - kdata_base\n\n@derive_symbols('sigaction_fix_start', 'sigaction_fix_end')\n@retry_on_error\ndef sigaction_fix_start():\n    use_r0gdb_trace(16777216)\n    kdata_base = gdb.ieval('kdata_base')\n    buf = gdb.ieval(r'&\"\\x01\"') # sa_handler = SIG_IGN\n    tr = [\n        traces.Trace(r0gdb.trace('trace_skip_scheduler_only', 'sigaction', i, buf, 0))\n        for i in (15, 9, 17) # SIGTERM, SIGKILL, SIGSTOP\n    ]\n    i = [i.find_next_rip(0, kdata_base+get_symbol('syscall_after')) for i in tr]\n    j = [i.find_caller(j-1)+1 for i, j in zip(tr, i)]\n    k = None\n    while len({i[j].rip for i, j in zip(tr, j)}) == 1:\n        k = j\n        j = [i.find_next_instr(j) for i, j in zip(tr, j)]\n    assert k is not None\n    source = tr[0][k[0]].rip\n    while tr[0][k[0]].rip in (tr[1][k[1]].rip, tr[2][k[2]].rip):\n        k = [i.find_next_instr(j) for i, j in zip(tr, k)]\n    dst = tr[0][k[0]].rip\n    return source - kdata_base, dst - kdata_base\n\ndef find_file_string(tail):\n    kdata, kdata_base = get_kernel()\n    q = kdata.find(tail+b'\\0') - 18\n    assert kdata.find(tail, q+19) < 0\n    assert kdata[q:q+10] == b'W:\\\\Build\\\\'\n    assert kdata[q+10:q+18].decode('latin-1').isnumeric()\n    return q\n\n@derive_symbol\n@retry_on_error\ndef mmap_self_fix_2_start():\n    use_r0gdb_trace(16777216)\n    kdata_base = gdb.ieval('kdata_base')\n    fd = gdb.ieval('(int)open(\"/system/common/lib/libScePlayerInvitationDialog.sprx\", 0)')\n    assert fd >= 0\n    trace = traces.Trace(r0gdb.trace('trace_skip_scheduler_only', 'mmap', 0, 16384, 1, 0x80001, fd, 0))\n    gdb.ieval('(int)close(%d)'%fd)\n    i = trace.find_next_rip(0, kdata_base + get_symbol('syscall_after'))\n    for j in range(3):\n        i = trace.find_last_callee_ret(i)\n    j = trace.find_caller(i) + 1\n    while j < i and trace[j+1].rip != trace[j].rip + 16:\n        j = trace.find_next_instr(j)\n    assert j < i\n    return trace[j].rip - kdata_base\n\n@derive_symbol\n@retry_on_error\ndef mmap_self_fix_1_start():\n    use_r0gdb_trace(16777216)\n    kdata_base = gdb.ieval('kdata_base')\n    gdb.ieval('offsets.mmap_self_fix_2_start = '+ostr(kdata_base+get_symbol('mmap_self_fix_2_start')))\n    gdb.ieval('offsets.mmap_self_fix_2_end = '+ostr(kdata_base+get_symbol('mmap_self_fix_2_start')+2))\n    fd = gdb.ieval('(int)open(\"/mini-syscore.elf\", 0)')\n    assert fd >= 0\n    trace = traces.Trace(r0gdb.trace('fix_mmap_self', 'mmap', 0, 16384, 1, 0x80001, fd, 0))\n    gdb.ieval('(int)close(%d)'%fd)\n    # find the function that returns a specific error code\n    for i in range(len(trace)-1):\n        if trace.is_jump(i) and trace[i+1].rsp == trace[i].rsp + 8 and trace[i].rax == 0x800f0d3a:\n            break\n    else: assert False\n    i += 1\n    # trace the successful path from there on r0gdb\n    r0gdb.trace_to_raw()\n    gdb.ieval('$pc = '+ostr(trace[i].rip))\n    gdb.ieval('$rax = 0')\n    while gdb.ieval('$pc') == trace[i].rip:\n        i += 1\n        gdb.execute('stepi')\n    # we've found the source and destination, verify their relative offset\n    source = trace[i-1].rip\n    dst = gdb.ieval('$pc')\n    assert dst == source + 2\n    return source - kdata_base\n\n@derive_symbol\n@retry_on_error\ndef mdbg_call_fix():\n    use_r0gdb_trace(16777216)\n    kdata_base = gdb.ieval('kdata_base')\n    # prepare mdbg_call arguments\n    buf = gdb.ieval('malloc(1)')\n    arg1 = gdb.ieval('(uint64_t)(uint64_t[4]){1, 0x12}')\n    arg2 = gdb.ieval('(uint64_t)(uint64_t[8]){(int)getpid(), getpid, %d, 1}'%buf)\n    arg3 = gdb.ieval('(uint64_t)(uint64_t[4]){}')\n    # run mdbg_call with and without the debugger cred\n    trace1 = traces.Trace(r0gdb.trace('trace_skip_scheduler_only', 'mdbg_call', arg1, arg2, arg3, 0, 0, 0))\n    gdb.ieval('{void*}({void*}({void*}(get_thread()+8)+0x40)+88) = 0x4800000000000036')\n    trace2 = traces.Trace(r0gdb.trace('trace_skip_scheduler_only', 'mdbg_call', arg1, arg2, arg3, 0, 0, 0))\n    # find the inner mdbg_call funcion\n    i = trace1.find_next_rip(0, kdata_base + get_symbol('syscall_after'))\n    j = trace1.find_last_callee_ret(i-1)\n    k1 = trace1.find_caller(j)+1\n    k2 = trace2.find_next_rip(0, trace1[k1].rip)\n    # trace until we find the function that returns different values (0 vs 1)\n    while not (trace1[k1].rax == 0 and trace2[k2].rax == 1):\n        k1 = trace1.find_next_instr(k1)\n        k2 = trace2.find_next_instr(k2)\n    assert trace1.is_jump(k1-1)\n    assert trace2.is_jump(k2-1)\n    k1 = trace1.find_caller(k1-1)\n    k2 = trace1.find_caller(k2-1)\n    assert trace1[k1].rip == trace2[k2].rip\n    # trace the inner cred checking function to find the point of divergence\n    while not (trace1[k1].rax == 0 and trace2[k2].rax == 1):\n        k1 += 1\n        k2 += 1\n    assert trace1[k1].rip == trace2[k2].rip\n    return trace1[k1].rip - kdata_base\n\n@derive_symbols(\n    'sceSblServiceMailbox',\n    'sceSblServiceMailbox_lr_sceSblAuthMgrSmFinalize',\n    'sceSblServiceMailbox_lr_verifyHeader',\n    'sceSblAuthMgrSmIsLoadable2',\n    'sceSblServiceMailbox_lr_loadSelfSegment',\n    'sceSblServiceMailbox_lr_decryptSelfBlock',\n)\n@retry_on_error\ndef sceSblServiceMailbox():\n    # we need about 20 MB of log memory, allocate 64 MB just to be sure\n    use_r0gdb_trace(1<<26)\n    kdata_base = gdb.ieval('kdata_base')\n    # fill mmap_self offsets, 'coz we're tracing mmap_self for simplicity\n    gdb.ieval('offsets.mmap_self_fix_1_end = (offsets.mmap_self_fix_1_start = %s) + 2'%ostr(kdata_base+get_symbol('mmap_self_fix_1_start')))\n    gdb.ieval('offsets.mmap_self_fix_2_end = (offsets.mmap_self_fix_2_start = %s) + 2'%ostr(kdata_base+get_symbol('mmap_self_fix_2_start')))\n    # open some library\n    fd = gdb.ieval('(int)open(\"/system_ex/common_ex/lib/libSceNKWebKit.sprx\", 0)')\n    assert fd >= 0\n    # now mmap and mlock first 64 KB of the first segment\n    trace = traces.Trace(\n        r0gdb.trace('fix_mmap_self', 'mmap', 0, 65536, 1, 0x80001, fd, 0) +\n        r0gdb.trace('fix_mmap_self', 'mlock', gdb.ieval('(void*)$rax'), 65536)\n    )\n    # filter callers for each function being called\n    lrs = collections.defaultdict(list)\n    for i in range(1, len(trace)):\n        if trace.is_jump(i-1) and trace[i].rsp == trace[i-1].rsp - 8:\n            lrs[trace[i].rip].append(trace[i-1].rip)\n    # expected callers for sceSblServiceMailbox:\n    # * sceSblAuthMgrSmFinalize (happens sometimes but not always)\n    # * verifyHeader\n    # * sceSblAuthMgrSmIsLoadable2\n    # * loadSelfSegment\n    # * decryptSelfBlock (4 times in a row)\n    candidates = [i for i, j in lrs.items() if len(j) in (7, 8) and len(set(j)) == len(j) - 3 and len(set(j[-4:])) == 1]\n    assert candidates\n    # the real mailbox call has rsi = rdx for all invocations. filter by that\n    mailbox = [i for i in candidates if all(j.rsi == j.rdx for j in trace if j.rip == i)]\n    assert len(mailbox) == 1\n    mailbox, = mailbox\n    lrs = lrs[mailbox]\n    verifyHeader, sceSblAuthMgrSmIsLoadable2, loadSelfSegment, decryptSelfBlock = lrs[-7:-3]\n    # for sceSblAuthMgrSmIsLoadable2 we need the function start, not the mailbox callsite\n    sceSblAuthMgrSmIsLoadable2 = trace[trace.find_caller(trace.find_next_rip(0, sceSblAuthMgrSmIsLoadable2))+1].rip\n    return (\n        mailbox - kdata_base,\n        lrs[0] + 5 - kdata_base if len(lrs) == 8 else None,\n        verifyHeader + 5 - kdata_base,\n        sceSblAuthMgrSmIsLoadable2 - kdata_base,\n        loadSelfSegment + 5 - kdata_base,\n        decryptSelfBlock + 5 - kdata_base,\n    )\n\ndef run_make_fself(elf_data, auth_info):\n    import make_fself\n    elf = make_fself.ElfFile(ignore_shdrs=True)\n    elf.load(io.BytesIO(elf_data))\n    self = make_fself.SignedElfFile(elf, paid=int.from_bytes(auth_info[:8], 'little'), ptype=1, app_version=0, fw_version=0, auth_info=auth_info)\n    self_file = io.BytesIO()\n    self.save(self_file)\n    return self_file.getvalue()\n\ndef dump_self(name, path):\n    use_self_dumper()\n    assert not gdb.ieval('($self_file_%s = &*(struct memfd[1]){dump_elf(\"%s\")}, 0)'%(name, path))\n    assert not gdb.ieval('($self_auth_info_%s = &*(struct memfd[1]){dump_elf_auth_info(\"%s\")}, 0)'%(name, path))\n    ba = bytearray()\n    with gdb_rpc.BlobReceiver(gdb, ba, 'retrieving dumped files') as addr:\n        remote_fd = gdb.ieval('r0gdb_open_socket(\"%s\", %d)'%addr)\n        assert remote_fd >= 0\n        assert gdb.eval('send_tar_entry(%d, $self_file_%s, \"binary.elf\", (char*)0)'%(remote_fd, name))\n        assert gdb.eval('send_tar_entry(%d, $self_auth_info_%s, \"binary.elf.auth_info\", (char*)0)'%(remote_fd, name))\n        assert not gdb.ieval('r0gdb_sendall(%d, malloc(512), 512)'%remote_fd)\n        gdb.ieval('(int)close(%d)'%remote_fd)\n    files = {}\n    for i in tarfile.open(fileobj=io.BytesIO(bytes(ba))):\n        files[i.name] = ba[i.offset_data:i.offset_data+i.size]\n    elf_data = files['binary.elf']\n    auth_info = files['binary.elf.auth_info']\n    assert elf_data and len(auth_info) == 0x88\n    return elf_data, auth_info\n\ndef make_fself_and_upload(name, path):\n    full_name = name\n    name = name.split('.', 1)[0]\n    fd = gdb.ieval('(int)open(\"/data/%s\", 0)'%full_name)\n    if fd >= 0:\n        assert not gdb.ieval('(int)close(%d)'%fd)\n        return True\n    elf_data, auth_info = dump_self(name, path)\n    self_data = run_make_fself(elf_data, auth_info)\n    with gdb_rpc.BlobSender(gdb, self_data, 'writing fself file to /data/%s'%full_name) as addr:\n        remote_fd = gdb.ieval('r0gdb_open_socket(\"%s\", %d)'%addr)\n        assert remote_fd >= 0\n        file_fd = gdb.ieval('(int)open(\"/data/%s\", 0x602, 0777)'%full_name)\n        assert file_fd >= 0\n        assert not gdb.ieval('r0gdb_sendfile(%d, %d)'%(remote_fd, file_fd))\n        assert not gdb.ieval('(int)close(%d) | (int)close(%d)'%(remote_fd, file_fd))\n    return False\n\ndef ensure_fselfs(fn):\n    fn_run = False\n    if gdb.popen == None:\n        fn()\n        fn_run = True\n    if (not make_fself_and_upload('libSceLibcInternal.sprx', '/system/common/lib/libSceLibcInternal.sprx')\n        or not make_fself_and_upload('libScePlayerInvitationDialog.sprx', '/system/common/lib/libScePlayerInvitationDialog.sprx')\n        or not fn_run):\n        fn()\n\n@derive_symbol\n@retry_on_error\ndef sceSblServiceMailbox_lr_decryptMultipleSelfBlocks():\n    ensure_fselfs(lambda: use_r0gdb_trace(0))\n    # set mailbox-related symbols\n    kdata_base = gdb.ieval('kdata_base')\n    for i in (\n        'sceSblServiceMailbox',\n        'sceSblServiceMailbox_lr_sceSblAuthMgrSmFinalize',\n        'sceSblServiceMailbox_lr_verifyHeader',\n        'sceSblAuthMgrSmIsLoadable2',\n        'sceSblServiceMailbox_lr_loadSelfSegment',\n        'sceSblServiceMailbox_lr_decryptSelfBlock',\n        'mini_syscore_header',\n    ):\n        gdb.ieval('offsets.%s = %s'%(i, ostr(kdata_base + get_symbol(i))))\n    gdb.ieval('offsets.mmap_self_fix_1_end = (offsets.mmap_self_fix_1_start = %s) + 2'%ostr(kdata_base + get_symbol('mmap_self_fix_1_start')))\n    gdb.ieval('offsets.mmap_self_fix_2_end = (offsets.mmap_self_fix_2_start = %s) + 2'%ostr(kdata_base + get_symbol('mmap_self_fix_2_start')))\n    #buf = gdb.ieval('malloc(1)')\n    #n = 72\n    #gdb.ieval('(uint64_t)({void*[%d]}%d = {void*[%d]}&offsets)'%(n, buf, n))\n    #gdb.eval('set_offsets_403()')\n    #gdb.ieval('(uint64_t)({void*[%d]}&offsets = {void*[%d]}%d)'%(n, n, buf))\n    # map 64k of a fake self\n    gdb.ieval('do_fself = 31')\n    r0gdb.do_trace('trace_mailbox', 'mmap', 0, 65536, 1, 0x80001, '(int)open(\"/data/libSceLibcInternal.sprx\", 0)', 0)\n    assert not (gdb.ieval('$eflags') & 1), gdb.ieval('$rax')\n    # the latter check will hang. arm a SIGALRM to interrupt us, 'coz sending ^C will break the python repl\n    gdb.execute('handle SIGALRM print stop nopass')\n    buf = gdb.ieval('malloc(sizeof(struct sigaction))')\n    assert not gdb.ieval('(int)sigaction(2, 0, %s)'%ostr(buf))\n    assert not gdb.ieval('(int)sigaction(14, %s, 0)'%ostr(buf))\n    #assert not gdb.ieval('((int(*)(void))dlsym(2, \"alarm\"))(10)')\n    assert not gdb.ieval('(int)setitimer(0, (uint64_t[4]){0, 0, 10, 0}, 0)')\n    # try to mlock it in one go. decryptMultipleSelfBlocks should get called\n    gdb.ieval('do_fself = 63')\n    r0gdb.do_trace('trace_mailbox', 'mlock', '$rax', 65536)\n    # check that the syscall hasn't completed normally\n    assert not gdb.ieval('$pc == {void*}&p_syscall + 5')\n    # now get its lr\n    lr = gdb.ieval('mailbox_lr[0]')\n    assert lr and not gdb.ieval('mailbox_lr[1]')\n    # the process is now fucked. panic now\n    try: gdb.eval('{short}(get_thread()+14) = 0xdeb7')\n    except gdb_rpc.DisconnectedException: pass\n    return lr - kdata_base\n\n@derive_symbols('copyin', 'copyout')\n@retry_on_error\ndef copyin():\n    use_r0gdb_trace(16777216)\n    kdata_base = gdb.ieval('kdata_base')\n    pipebuf = gdb.ieval('(void*)malloc(123)')\n    assert not gdb.ieval('(int)pipe(%d)'%pipebuf)\n    fd1 = gdb.ieval('{int}%d'%pipebuf)\n    fd2 = gdb.ieval('{int}%d'%(pipebuf+4))\n    gdb.ieval('jprog = (void*[1]){0}')\n    trace1 = traces.Trace(r0gdb.trace('do_jprog', 'write', fd2, pipebuf, 123))\n    trace2 = traces.Trace(r0gdb.trace('do_jprog', 'read', fd1, pipebuf, 123))\n    candidates1 = [i for i in range(1, len(trace1)) if trace1.is_jump(i-1) and trace1[i].rsp == trace1[i-1].rsp - 8 and trace1[i].rdi == pipebuf and trace1[i].rdx == 123]\n    assert len(candidates1) == 1\n    copyin = trace1[candidates1[0]].rip\n    kernel_buf = trace1[candidates1[0]].rsi\n    candidates2 = [i for i in range(1, len(trace2)) if trace2.is_jump(i-1) and trace2[i].rsp == trace2[i-1].rsp - 8 and trace2[i].rdi == kernel_buf and trace2[i].rsi == pipebuf and trace2[i].rdx == 123]\n    assert len(candidates2) == 1\n    copyout = trace2[candidates2[0]].rip\n    return copyin - kdata_base, copyout - kdata_base\n\ndef fetch_logs(cpu):\n    uelf_base = gdb.ieval('uelf_bases[%d]'%cpu)\n    offset = int(os.popen(\"nm ../uelf/uelf | grep ' log$'\").read().split()[0], 16)\n    gdb.execute('set print elements 0')\n    gdb.execute('set print repeats 0')\n    return [int(i, 16) for i in gdb.eval('{void*[512]}%d'%(uelf_base+offset)).strip()[1:-1].split(', ')]\n\ndef get_parasites(kdata_base):\n    return sorted({(i - kdata_base, j) for k in map(fetch_logs, range(16)) for i, j in zip(k[::2], k[1::2]) if i})\n\n@derive_symbol\n@retry_on_error\ndef syscall_parasites():\n    use_kstuff()\n    init_kstuff()\n    kdata_base = gdb.ieval('kdata_base')\n    ans = get_parasites(kdata_base)\n    assert len(ans) == 3\n    return ans\n\n@derive_symbols('loadSelfSegment_watchpoint', 'loadSelfSegment_epilogue', 'loadSelfSegment_watchpoint_lr', 'decryptSelfBlock_epilogue', 'decryptSelfBlock_watchpoint_lr', 'decryptMultipleSelfBlocks_epilogue', 'decryptMultipleSelfBlocks_watchpoint_lr')\n@retry_on_error\ndef loadSelfSegment_watchpoint():\n    ensure_fselfs(lambda: use_r0gdb_trace(1<<26))\n    kdata_base = gdb.ieval('kdata_base')\n    for i in (\n        'sceSblServiceMailbox',\n        'sceSblServiceMailbox_lr_sceSblAuthMgrSmFinalize',\n        'sceSblServiceMailbox_lr_verifyHeader',\n        'sceSblAuthMgrSmIsLoadable2',\n        'sceSblServiceMailbox_lr_loadSelfSegment',\n        'sceSblServiceMailbox_lr_decryptSelfBlock',\n        'sceSblServiceMailbox_lr_decryptMultipleSelfBlocks',\n        'kernel_pmap_store',\n        'mini_syscore_header',\n    ):\n        gdb.ieval('offsets.%s = %s'%(i, ostr(kdata_base + get_symbol(i))))\n    gdb.ieval('offsets.mmap_self_fix_1_end = (offsets.mmap_self_fix_1_start = %s) + 2'%ostr(kdata_base + get_symbol('mmap_self_fix_1_start')))\n    gdb.ieval('offsets.mmap_self_fix_2_end = (offsets.mmap_self_fix_2_start = %s) + 2'%ostr(kdata_base + get_symbol('mmap_self_fix_2_start')))\n    gdb.ieval('do_fself = 95')\n    rt1 = r0gdb.trace('trace_mailbox', 'mmap', 0, 65536, 1, 0x80001, '(int)open(\"/data/libSceLibcInternal.sprx\", 0)', 0)\n    assert not (gdb.ieval('$eflags') & 1)\n    mapping = gdb.ieval('$rax')\n    rt2 = r0gdb.trace('trace_mailbox', 'mlock', mapping, 16384)\n    rt3 = r0gdb.trace('trace_mailbox', 'mlock', mapping, 65536)\n    trace = traces.Trace(rt1+rt2+rt3)\n    use_kstuff()\n    init_kstuff()\n    assert not any(map(any, map(fetch_logs, range(16))))\n    fd = gdb.ieval('(int)open(\"/data/libSceLibcInternal.sprx\", 0)')\n    assert fd >= 0\n    mapping = gdb.ieval('(void*)mmap(0, 65536, 1, 0x80001, %d, 0)'%fd)\n    assert mapping != 2**64-1\n    assert not gdb.ieval('(int)mlock(%d, 16384)'%mapping)\n    assert not gdb.ieval('(int)mlock(%d, 65536)'%mapping)\n    parasites = get_parasites(gdb.ieval('kdata_base'))\n    parasite_set = {kdata_base + i[0] for i in parasites}\n    watchpoints = set()\n    rest = []\n    for i, j in enumerate(('loadSelfSegment', 'decryptSelfBlock', 'decryptMultipleSelfBlocks')):\n        k = trace.find_caller(trace.find_next_rip(0, kdata_base + get_symbol('sceSblServiceMailbox_lr_'+j) - 5)) + 1\n        while trace.find_next_instr(k) == k + 1: k += 1\n        ps = [i.rip-kdata_base for i in trace[k:trace.find_next_instr(k)] if i.rip in parasite_set]\n        k = trace.find_next_instr(k)\n        watchpoints.add(tuple(ps))\n        lr = trace[k].rip - kdata_base\n        k0 = k\n        while k + 1 < len(trace) and not (trace.is_jump(k) and trace[k+1].rsp == trace[k].rsp + 8):\n            k = trace.find_next_instr(k)\n        while k > k0 and trace[k-1].rsp < trace[k].rsp:\n            k -= 1\n        assert trace[k-1].rsp == trace[k].rsp\n        epilogue = trace[k].rip - kdata_base\n        rest.append(epilogue)\n        rest.append(lr)\n    assert len(watchpoints) == 1\n    return (min(next(iter(watchpoints))),)+tuple(rest)\n\n@derive_symbol\n@retry_on_error\ndef fself_parasites():\n    ensure_fselfs(use_kstuff)\n    init_kstuff()\n    kdata_base = gdb.ieval('kdata_base')\n    assert gdb.ieval('(int)dynlib_load_prx(\"/data/libScePlayerInvitationDialog.sprx\", 0, malloc(4), 0)') == 0\n    fd = gdb.ieval('(int)open(\"/data/libSceLibcInternal.sprx\", 0)')\n    assert fd >= 0\n    mapping = gdb.ieval('(void*)mmap(0, 65536, 1, 0x80001, %d, 0)'%fd)\n    assert mapping != 2**64-1\n    gdb.ieval('{void*}%d'%mapping)\n    assert not gdb.ieval('(int)mlock(%d, 16384)'%mapping)\n    assert not gdb.ieval('(int)mlock(%d, 65536)'%mapping)\n    assert not gdb.ieval('(int)munmap(%d, 65536)'%mapping)\n    assert not gdb.ieval('(int)close(%d)'%fd)\n    ans = get_parasites(kdata_base)\n    assert len(ans) == 10\n    return [(i, j) for i, j in ans if not (j == 10 and (i, 7) in ans)]\n\ndef elf_to_flat(data):\n    assert data.startswith(b'\\x7fELF') and len(data) >= 64\n    ans = bytearray()\n    phoff = int.from_bytes(data[32:40], 'little')\n    phnum = int.from_bytes(data[56:58], 'little')\n    assert len(data) >= phoff+56*phnum\n    for i in range(phoff, phoff+56*phnum, 56):\n        ptype = int.from_bytes(data[i:i+4], 'little')\n        if ptype != 1: continue\n        offset = int.from_bytes(data[i+8:i+16], 'little')\n        vaddr = int.from_bytes(data[i+16:i+24], 'little')\n        filesz = int.from_bytes(data[i+32:i+40], 'little')\n        memsz = int.from_bytes(data[i+40:i+48], 'little')\n        assert memsz >= filesz\n        assert len(data) >= offset + filesz\n        ans[vaddr:vaddr+filesz] = data[offset:offset+filesz]\n        ans[vaddr+filesz:vaddr+memsz] = bytes(memsz-filesz)\n    return ans\n\n@derive_symbol\n@retry_on_error\ndef shellcore_offsets():\n    if 'SHELLCORE' in os.environ:\n        with open(os.environ['SHELLCORE'], 'rb') as file:\n            shellcore_elf = file.read()\n    else:\n        shellcore_elf = dump_self('SceShellCore', '/system/vsh/SceShellCore.elf')[0]\n    shellcore = elf_to_flat(shellcore_elf)\n    shellcore_txt = shellcore.decode('latin-1').replace('\\n', '\\u010a')\n    def get_offsets(regexp):\n        return [shellcore_txt.find(i) for i in re.compile(regexp).findall(shellcore_txt)]\n    ans = []\n    offset, = get_offsets(r'\\x80\\x3d....\\x01\\x75\\u010a\\x48\\x89\\xd1\\x31\\xd2\\xe9....\\xb8\\x01\\x00\\xe9\\x80\\xc3\\xcc{7}')\n    target_fn = int.from_bytes(shellcore[offset+15:offset+19], 'little', signed=True)+offset+19\n    ans.append((offset+14, '52eb086690'))\n    ans.append((offset+25, (b'\\xe8'+(target_fn-offset-30).to_bytes(4, 'little', signed=True)+b'\\x58\\xc3').hex()))\n    offset, = get_offsets(r'\\xcc{7}\\x80\\x3d....\\x01\\x75\\x0d\\x48\\x89\\xd1\\xba\\x01\\x00\\x00\\x00\\xe9....\\xb8\\x01\\x00\\xe9\\x80\\xc3')\n    target_fn = int.from_bytes(shellcore[offset+25:offset+29], 'little', signed=True)+offset+29\n    ans.append((offset+24, '31c050ebe3'))\n    ans.append((offset, (b'\\xe8'+(target_fn-offset-5).to_bytes(4, 'little', signed=True)+b'\\x58\\xc3').hex()))\n    offset, = get_offsets(r'\\x44\\x89[\\xe0\\xe8\\xf0\\xf8]\\xff\\xc8\\x83\\xf8\\x02\\x0f\\x83')\n    ans.append((offset+8, 'eb04'))\n    offsets = get_offsets(r'(\\xe8....\\x85\\xc0\\x0f\\x88....\\x49\\x8b\\x46\\x20\\x48\\xba\\x00\\xff\\x00\\xff\\x00\\xff\\x00\\xff|\\xe8....\\x85\\xc0\\x0f\\x84....\\x0f\\x88....\\x49\\x0f\\x38)')\n    assert len(offsets) == 2\n    for i in offsets:\n        if shellcore[i+8] == 0x88:\n            ans.append((i+7, 'eb04'))\n        else:\n            ans.append((i+13, 'eb04'))\n    offset, = get_offsets(r'(\\x41\\x39[\\xdc\\xdd]\\x74.\\x48\\x8d\\x3d....|\\x3b\\x84\\x24....\\x75.\\x31\\xc9\\xeb.)')\n    if shellcore[offset] == 0x41:\n        ans.append((offset+3, 'eb'))\n    else:\n        ans.append((offset+7, '9090'))\n    offset, = get_offsets(r'\\x83\\xbb....\\x03\\x0f\\x84')\n    ans.append((offset+7, '90e9'))\n    offset, = get_offsets(r'(\\x41\\x81[\\xfc\\xff]\\x60\\x00\\x02\\x80\\x0f\\x85....\\x80\\x7c\\x24.\\x00\\x74.|\\x41\\x81[\\xfc\\xfd]\\x60\\x00\\x02\\x80\\x0f\\x85....\\x84\\xc0\\x74.)')\n    if shellcore[offset+2] == 0xff:\n        ans.append((offset+18, 'eb'))\n    else:\n        ans.append((offset+15, 'eb'))\n    offset, = get_offsets(r'\\x83\\xfb\\x01\\x0f\\x84....\\x83\\xfb\\x02\\x0f\\x85....')\n    target = int.from_bytes(shellcore[offset+5:offset+9], 'little', signed=True)+offset+9\n    ans.append((offset+14, (target-offset-18).to_bytes(4, 'little', signed=True).hex()))\n    for offset, data in ans:\n        data = bytes.fromhex(data)\n        shellcore[offset:offset+len(data)] = data\n    offset, = get_offsets(r'\\xeb.\\x48\\x8b\\x32\\x48\\x89\\xdf\\xe8....\\xeb.\\x48\\x8b\\x02\\x49\\x8b\\x37')\n    target = int.from_bytes(shellcore[offset+9:offset+13], 'little', signed=True)+offset+13\n    target2 = int.from_bytes(shellcore[offset+14:offset+15], 'little', signed=True)+offset+15\n    cave1 = shellcore.find(b'\\xcc'*14, offset)\n    cave2 = shellcore.find(b'\\xcc'*11, cave1+14)\n    ans.append((cave1, (b'\\xe8'+(target-cave1-5).to_bytes(4, 'little', signed=True)+b'\\x31\\xc9\\xff\\xc1\\xe9'+(cave2-cave1-14).to_bytes(4, 'little', signed=True)).hex()))\n    ans.append((cave2, (b'\\x83\\xf8\\x02\\x0f\\x43\\xc1\\xe9'+(target2-cave2-11).to_bytes(4, 'little', signed=True)).hex()))\n    ans.append((offset+8, (b'\\xe9'+(cave1-offset-13).to_bytes(4, 'little', signed=True)).hex()))\n    return ans\n\n@derive_symbol\n@retry_on_error\ndef printf():\n    use_r0gdb_raw()\n    kdata_base = gdb.ieval('kdata_base')\n    # arm the exit syscall\n    gdb.ieval('$pc = {void*}%s'%ostr(kdata_base+get_symbol('sysents')+56))\n    gdb.ieval('$rdi = {void*}(16+{void*}%s)'%ostr(kdata_base+get_symbol('allproc')))\n    gdb.ieval('$rsi = $rsp + 8')\n    # singlestep\n    prev_rip = gdb.ieval('$pc')\n    prev_rsp = gdb.ieval('$rsp')\n    while True:\n        gdb.execute('stepi')\n        rip = gdb.ieval('$pc')\n        rsp = gdb.ieval('$rsp')\n        print(hex(rip), hex(rsp))\n        if rsp == prev_rsp - 8 and rip not in range(prev_rip, prev_rip+16): break\n        prev_rip = rip\n        prev_rsp = rsp\n    # we're now at the first printf\n    assert gdb.ieval('$rdi') % 2**64 == (kdata_base + get_kernel()[0].find(b'# process pid=%d, %s calls exit() exit_value=%x.\\n\\0')) % 2**64\n    return gdb.ieval('$pc') - kdata_base\n\n@derive_symbol\n@retry_on_error\ndef strlen_trap():\n    use_r0gdb_trace(16777216)\n    kdata_base = gdb.ieval('kdata_base')\n    gdb.ieval('fncall_fn = '+ostr(kdata_base+get_symbol('printf')))\n    gdb.ieval('(void*)({char[4]}(fncall_args[0] = kmalloc(4)) = \"%s\\\\n\")')\n    gdb.ieval('fncall_args[1] = kmalloc(8)+1')\n    gdb.ieval('fncall_no_untrace = 1')\n    getpid = gdb.ieval('{void*}%d'%(kdata_base+get_symbol('sysents')+20*48+8))\n    gdb.ieval('sys_getpid = '+ostr(getpid))\n    while True:\n        gdb.ieval('(void*)({char[7]}fncall_args[1] = \"AAAAAA\")')\n        trace1 = traces.Trace(r0gdb.trace('getpid_to_fncall', 'getpid'))\n        gdb.ieval('(void*)({char[7]}fncall_args[1] = \"aaaaaa\")')\n        trace2 = traces.Trace(r0gdb.trace('getpid_to_fncall', 'getpid'))\n        if len(trace1) == len(trace2): break\n    assert [i.rip for i in trace1] == [i.rip for i in trace2]\n    i = next(i for i in range(len(trace1)) if trace1[i].rax == 0x0041414141414100 and trace2[i].rax == 0x0061616161616100)\n    assert i\n    i -= 1\n    assert trace1[i].rax != 0x0041414141414100 and trace2[i].rax != 0x0061616161616100 and trace1[i].rdi == trace2[i].rdi == gdb.ieval('fncall_args[1]') % 2**64\n    assert trace1[i].rip == trace2[i].rip\n    return trace1[i].rip - kdata_base\n\n@derive_symbols(\n    'sceSblServiceMailbox_lr_verifySuperBlock',\n    'sceSblServiceMailbox_lr_sceSblPfsClearKey_1',\n    'sceSblServiceMailbox_lr_sceSblPfsClearKey_2',\n    'sceSblPfsSetKeys',\n    'sceSblServiceCryptAsync',\n)\n@retry_on_error\ndef sceSblServiceMailbox_lr_verifySuperBlock():\n    use_kstuff()\n    assert 'void' == gdb.eval('kill_thread()')\n    assert 'void' == gdb.eval('ignore_signals()')\n    assert 'void' == gdb.eval('temp_patch_shellcore(shellcore_patches, n_shellcore_patches, 1)')\n    kdata_base = gdb.ieval('kdata_base')\n    print('Launch a PS4 fake package.')\n    # wait for nmount to get called\n    while True:\n        nmount_args = gdb.ieval('get_nmount_args()')\n        if nmount_args != 2**64-1: break\n        time.sleep(5)\n    n_args = 0\n    fspath = None\n    while True:\n        key = gdb.ieval('{void*}%d'%(nmount_args+n_args*32))\n        if not key: break\n        if gdb.ieval('{unsigned long long}%d'%key) % 2**56 == int.from_bytes(b'fspath', 'little'):\n            fspath = gdb.ieval('{void*}%d'%(nmount_args+n_args*32+16))\n        n_args += 1\n    n_args *= 2\n    # enable debug registers for thread\n    gdb.ieval('{int}(0x100+{void*}(0x3f8+get_thread())) |= 2')\n    # set debug registers\n    assert 'void' == gdb.eval('r0gdb_write_dbreg(0, %d)'%(kdata_base + get_symbol('sceSblServiceMailbox')))\n    assert 'void' == gdb.eval('r0gdb_write_dbreg(7, 0x401)')\n    assert 'void' == gdb.eval('set_trace()')\n    # call nmount to get verifySuperBlock\n    gdb.ieval('trace_prog = trace_mailbox_for_fpkg')\n    gdb.ieval('p_kekcall = p_syscall')\n    def nmount():\n        ans = gdb.ieval('my_nmount(%d, %d, 1)'%(nmount_args, n_args))\n        print('nmount() =', ans)\n        if not ans: # we were given a legit package, ok\n            # unmount, to allow for retry\n            assert not gdb.ieval('(int)kekcall(%d, 0, 0, 0, 0, 0, 22)'%fspath)\n    nmount()\n    assert gdb.ieval('mailbox_n') == 2\n    sceSblServiceMailbox_lr_verifySuperBlock = gdb.ieval('offsets.sceSblServiceMailbox_lr_verifySuperBlock = mailbox_lr[0]')\n    gdb.ieval('mailbox_n = 0')\n    gdb.ieval('n_faked_decrypts = 1')\n    gdb.ieval('mailbox_fakeresp[0] = 1')\n    # call nmount to get sceSblPfsClearKey_{1,2}\n    nmount()\n    assert gdb.ieval('mailbox_n') == 5\n    lrs = [gdb.ieval('mailbox_lr[%d]'%i) for i in range(5)]\n    assert len(set(lrs)) == 4 and lrs[0] == sceSblServiceMailbox_lr_verifySuperBlock and lrs[1] == lrs[4]\n    sceSblServiceMailbox_lr_sceSblPfsClearKey_1 = lrs[2]\n    sceSblServiceMailbox_lr_sceSblPfsClearKey_2 = lrs[3]\n    gdb.ieval('mailbox_n = 0')\n    nmount()\n    # call nmount to get sceSblServiceCrypt caller function\n    assert 'void' == gdb.eval('r0gdb_write_dbreg(1, %d)'%(kdata_base+get_symbol('printf')))\n    assert 'void' == gdb.eval('r0gdb_write_dbreg(7, 0x405)')\n    assert 'void' == gdb.eval('set_trace()')\n    page1 = gdb.ieval('malloc_locked(16384)')\n    page2 = page1 + 4096\n    page3 = page2 + 4096\n    page4 = page3 + 4096\n    gdb.ieval('mailbox_n = 0')\n    gdb.ieval('trace_prog_after_mailbox = do_dump_at_rip')\n    gdb.ieval('dump_program = (uint64_t[18]){%d, 1, -1, %d, %d, %d, 1, 10, -1, %d, %d, 0}'%(kdata_base+get_symbol('printf'), page1, page2, kdata_base+get_symbol('printf'), page1+8, page3))\n    nmount()\n    cache = {}\n    def get(ptr, page, offset):\n        if ptr not in cache:\n            cache[ptr] = gdb.ieval('{void*}%d'%ptr)\n            assert cache[ptr]\n        page_offset = cache[ptr] % 4096\n        assert page_offset + offset + 8 <= 4096\n        return gdb.ieval('{void*}%d'%(page+page_offset+offset))\n    kdata = get_kernel()[0]\n    error_rdi = kdata_base + kdata.find(b'\\0[0]%s() line=%d sceSblServiceCryptAsync() failed 0x%x\\n\\0') + 1\n    assert get(page1, page2, 12*8) == error_rdi\n    error_rsi = kdata_base + kdata.find(b'\\0pfs_generate_icv_sub\\0') + 1\n    assert get(page1, page2, 11*8) == error_rsi\n    pfs_generate_icv_sub_lr = get(page1+8, page3, 8)\n    # call nmount to get sceSblPfsSetKeys\n    assert 'void' == gdb.eval('r0gdb_write_dbreg(1, %d)'%sceSblServiceMailbox_lr_verifySuperBlock)\n    assert 'void' == gdb.eval('set_trace()')\n    gdb.ieval('dump_program = (uint64_t[7]){%d, 0, 10, -1, %d, %d, 0}'%(sceSblServiceMailbox_lr_verifySuperBlock, page1+16, page4))\n    nmount()\n    sceSblPfsSetKeys_lr = get(page1+16, page4, 8)\n    # get the pointer to pfs_generate_icv_sub & sceSblPfsSetKeys\n    kstack = gdb.ieval('kstack')\n    regs = gdb.ieval('(void*)malloc(sizeof(struct regs))')\n    REGS = '((struct regs*)%d)' % regs\n    gdb.ieval('%s->eflags = 0x102'%REGS)\n    gdb.ieval('%s->rip = %d'%(REGS, pfs_generate_icv_sub_lr-5))\n    gdb.ieval('%s->rsp = %d'%(REGS, kstack))\n    assert 'void' == gdb.eval('(void)run_in_kernel(%d)'%regs)\n    assert gdb.ieval('%s->rsp'%REGS) == kstack - 8\n    pfs_generate_icv_sub = gdb.ieval('%s->rip'%REGS)\n    gdb.ieval('%s->rip = %d'%(REGS, sceSblPfsSetKeys_lr-5))\n    assert 'void' == gdb.eval('(void)run_in_kernel(%d)'%regs)\n    assert gdb.ieval('%s->rsp'%REGS) == kstack - 16\n    sceSblPfsSetKeys = gdb.ieval('%s->rip'%REGS)\n    # trace pfs_generate_icv_sub to find sceSblServiceCryptAsync\n    assert 'void' == gdb.eval('r0gdb_trace(16777216)')\n    gdb.ieval('trace_prog = trace_mailbox_for_fpkg')\n    gdb.ieval('mailbox_n = 0')\n    gdb.ieval('trace_prog_after_mailbox = trace_on_break')\n    assert 'void' == gdb.eval('r0gdb_write_dbreg(1, %d)'%pfs_generate_icv_sub)\n    assert 'void' == gdb.eval('set_trace()')\n    assert 'void' == gdb.eval('r0gdb_trace_reset()')\n    nmount()\n    trace = traces.Trace(r0gdb.get_trace())\n    k = trace.find_next_rip(0, kdata_base + get_symbol('printf'))\n    for i in range(4):\n        while not (trace.is_jump(k) and trace[k+1].rsp == trace[k].rsp + 8): k -= 1\n        k = trace.find_caller(k)\n    assert trace[k].rsi == 0x138 and trace[trace.find_next_instr(k)].rax == 0\n    sceSblServiceCryptAsync = trace[k+1].rip\n    return (\n        sceSblServiceMailbox_lr_verifySuperBlock-kdata_base,\n        sceSblServiceMailbox_lr_sceSblPfsClearKey_1-kdata_base, \n        sceSblServiceMailbox_lr_sceSblPfsClearKey_2-kdata_base,\n        sceSblPfsSetKeys-kdata_base,\n        sceSblServiceCryptAsync-kdata_base,\n    )\n\n@derive_symbol\n@retry_on_error\ndef sceSblServiceCryptAsync_deref_singleton():\n    use_kstuff()\n    init_kstuff()\n    print('Launch a PS4 fake package.')\n    while True:\n        ans = get_parasites(gdb.ieval('kdata_base'))\n        if ans: break\n        time.sleep(5)\n    assert ans and ans == [(ans[0][0], 0), (ans[0][0], 3)]\n    assert ans[0][0] - get_symbol('sceSblServiceCryptAsync') in range(256)\n    return ans[0][0]\n\n@derive_symbol\n@retry_on_error\ndef crypt_message_resolve():\n    use_r0gdb_raw()\n    kdata_base = gdb.ieval('kdata_base')\n    gdb.ieval('$pc = '+ostr(kdata_base + get_symbol('sceSblServiceCryptAsync')))\n    arg = gdb.ieval('{void*}($rdi = $rsp + 8) = $rsp + 8')\n    prev_rip = gdb.ieval('$pc')\n    prev_rsp = gdb.ieval('$rsp')\n    while True:\n        gdb.execute('stepi')\n        rip = gdb.ieval('$pc')\n        rsp = gdb.ieval('$rsp')\n        print(hex(rip), hex(rsp))\n        if rip not in range(prev_rip, prev_rip+16) and rsp == prev_rsp - 8: # function call\n            if gdb.ieval('$rdi') % 2**64 == arg % 2**64 and gdb.ieval('$rsi') == 0xffffffdb:\n                return rip - kdata_base\n            gdb.ieval('$rax = 0')\n            gdb.ieval('$pc = '+ostr(kdata_base + get_symbol('wrmsr_ret') + 2))\n        prev_rip = rip\n        prev_rsp = rsp\n\n##These are not so important, just ignore for now\n#@derive_symbol\n#@retry_on_error\n#def unsorted_parasites():\n#    use_kstuff()\n#    init_kstuff()\n#    print('Launch and close a PS4 fake package. Press Enter when the game is fully closed.')\n#    input('> ')\n#    time.sleep(10)\n#    kdata_base = gdb.ieval('kdata_base')\n#    ans = get_parasites(kdata_base)\n#    assert False, ans\n\nprint(len(symbols), 'offsets currently known')\nprint(sum(sum(j not in symbols for j in i[1]) if isinstance(i, tuple) else (i.__name__ not in symbols) for i in derivations), 'offsets to be found')\n\nfor i in derivations:\n    if isinstance(i, tuple):\n        i, names = i\n        if any(j not in symbols for j in names):\n            print('Probing offsets `%s`'%'`, `'.join(names))\n            try: value = i()\n            except Exception:\n                raise Exception(\"failed to derive `%s`, see above why\"%'`, `'.join(names))\n            assert len(value) == len(names)\n            for i, j in zip(names, value):\n                set_symbol(i, j)\n        available_symbols |= set(names)\n    elif i.__name__ not in symbols:\n        print('Probing offset `%s`'%i.__name__)\n        try: value = i()\n        except Exception:\n            raise Exception(\"failed to derive `%s`, see above why\"%i.__name__)\n        set_symbol(i.__name__, value)\n    else:\n        available_symbols.add(i.__name__)\n"
  },
  {
    "path": "ps5-kstuff/porting_tool/make_fself.py",
    "content": "#!/usr/bin/env python\r\n\r\nimport sys, os, struct, traceback\r\nimport hashlib, hmac\r\nimport argparse, re, string\r\n\r\ndef int_with_base_type(val):\r\n\treturn int(val, 0)\r\n\r\ndef try_parse_int(x, base=0):\r\n\ttry:\r\n\t\treturn int(x, base) if isinstance(x, str) else int(x)\r\n\texcept:\r\n\t\treturn None\r\n\r\ndef align_up(x, alignment):\r\n\treturn (x + (alignment - 1)) & ~(alignment - 1)\r\n\r\ndef align_down(x, alignment):\r\n\treturn x & ~(alignment - 1)\r\n\r\ndef ilog2(x):\r\n\tif x <= 0:\r\n\t\traise ValueError('math domain error')\r\n\treturn len(bin(x)) - 3\r\n\r\ndef is_intervals_overlap(p1, p2):\r\n\treturn p1[0] <= p2[1] and p1[1] <= p2[0]\r\n\r\ndef check_file_magic(f, expected_magic):\r\n\told_offset = f.tell()\r\n\ttry:\r\n\t\tmagic = f.read(len(expected_magic))\r\n\texcept:\r\n\t\treturn False\r\n\tfinally:\r\n\t\tf.seek(old_offset)\r\n\treturn magic == expected_magic\r\n\r\ndef parse_version(version):\r\n\tmajor, minor, patch = (version >> 8) & 0xFF, version & 0xFF, 0 # FIXME\r\n\tmajor = 10 * (major >> 4) + (major & 0xF)\r\n\tminor = 10 * (minor >> 4) + (minor & 0xF)\r\n\treturn '{0:d}.{1:02d}.{2:03d}'.format(major, minor, patch)\r\n\r\ndef sha256(data):\r\n\treturn hashlib.sha256(data).digest()\r\n\r\ndef hmac_sha256(key, data):\r\n\treturn hmac.new(key=key, msg=data, digestmod=hashlib.sha256).digest()\r\n\r\nclass ElfError(Exception):\r\n\tdef __init__(self, msg):\r\n\t\tself.msg = msg\r\n\r\n\tdef __str__(self):\r\n\t\treturn repr(self.msg)\r\n\r\nclass ElfEHdr(object):\r\n\tFMT = '<4s5B6xB'\r\n\tEX_FMT = '<2HI3QI6H'\r\n\r\n\tMAGIC = b'\\x7FELF'\r\n\tCLASS64 = 0x2\r\n\tDATA2LSB = 0x1\r\n\tEM_X86_64 = 0x3E\r\n\tEV_CURRENT = 0x1\r\n\r\n\tET_EXEC = 0x2\r\n\tET_SCE_EXEC = 0xFE00\r\n\tET_SCE_EXEC_ASLR = 0xFE10\r\n\tET_SCE_DYNAMIC = 0xFE18\r\n\r\n\tdef __init__(self):\r\n\t\tself.magic = None\r\n\t\tself.machine_class = None\r\n\t\tself.data_encoding = None\r\n\t\tself.version = None\r\n\t\tself.os_abi = None\r\n\t\tself.abi_version = None\r\n\t\tself.nident_size = None\r\n\t\tself.type = None\r\n\t\tself.machine = None\r\n\t\tself.version = None\r\n\t\tself.entry = None\r\n\t\tself.phoff = None\r\n\t\tself.shoff = None\r\n\t\tself.flags = None\r\n\t\tself.ehsize = None\r\n\t\tself.phentsize = None\r\n\t\tself.phnum = None\r\n\t\tself.shentsize = None\r\n\t\tself.shnum = None\r\n\t\tself.shstridx = None\r\n\r\n\tdef load(self, f):\r\n\t\tif not check_file_magic(f, ElfEHdr.MAGIC):\r\n\t\t\traise ElfError('Invalid magic.')\r\n\r\n\t\tself.magic, self.machine_class, self.data_encoding, self.version, self.os_abi, self.abi_version, self.nident_size = struct.unpack(ElfEHdr.FMT, f.read(struct.calcsize(ElfEHdr.FMT)))\r\n\t\tif self.machine_class != ElfEHdr.CLASS64 or self.data_encoding != ElfEHdr.DATA2LSB:\r\n\t\t\traise ElfError('Unsupported class or data encoding.')\r\n\t\tself.type, self.machine, self.version, self.entry, self.phoff, self.shoff, self.flags, self.ehsize, self.phentsize, self.phnum, self.shentsize, self.shnum, self.shstridx = struct.unpack(ElfEHdr.EX_FMT, f.read(struct.calcsize(ElfEHdr.EX_FMT)))\r\n\t\tif self.machine != ElfEHdr.EM_X86_64 or self.version != ElfEHdr.EV_CURRENT:\r\n\t\t\traise ElfError('Unsupported machine type or version.')\r\n\t\tif self.phentsize != struct.calcsize(ElfPHdr.FMT) or (self.shentsize > 0 and self.shentsize != struct.calcsize(ElfSHdr.FMT)):\r\n\t\t\traise ElfError('Unsupported header entry size.')\r\n\t\tif self.type not in [ElfEHdr.ET_EXEC, ElfEHdr.ET_SCE_EXEC, ElfEHdr.ET_SCE_EXEC_ASLR, ElfEHdr.ET_SCE_DYNAMIC]:\r\n\t\t\traise ElfError('Unsupported type.')\r\n\r\n\tdef save(self, f):\r\n\t\tf.write(struct.pack(ElfEHdr.FMT, self.magic, self.machine_class, self.data_encoding, self.version, self.os_abi, self.abi_version, self.nident_size))\r\n\t\tf.write(struct.pack(ElfEHdr.EX_FMT, self.type, self.machine, self.version, self.entry, self.phoff, self.shoff, self.flags, self.ehsize, self.phentsize, self.phnum, self.shentsize, self.shnum, self.shstridx))\r\n\r\n\tdef has_segments(self):\r\n\t\treturn self.phentsize > 0 and self.phnum > 0\r\n\r\n\tdef has_sections(self):\r\n\t\treturn self.shentsize > 0 and self.shnum > 0\r\n\r\nclass ElfPHdr(object):\r\n\tFMT = '<2I6Q'\r\n\r\n\tPT_LOAD = 0x1\r\n\tPT_DYNAMIC = 0x2\r\n\tPT_INTERP = 0x3\r\n\tPT_TLS = 0x7\r\n\tPT_GNU_EH_FRAME = 0x6474E550\r\n\tPT_GNU_STACK = 0x6474E551\r\n\tPT_SCE_RELA = 0x60000000,\r\n\tPT_SCE_DYNLIBDATA = 0x61000000\r\n\tPT_SCE_PROCPARAM = 0x61000001\r\n\tPT_SCE_MODULE_PARAM = 0x61000002\r\n\tPT_SCE_RELRO = 0x61000010\r\n\tPT_SCE_COMMENT = 0x6FFFFF00\r\n\tPT_SCE_VERSION = 0x6FFFFF01\r\n\r\n\tPF_EXEC = 0x1\r\n\tPF_WRITE = 0x2\r\n\tPF_READ = 0x4\r\n\tPF_READ_EXEC = PF_READ | PF_EXEC\r\n\tPF_READ_WRITE = PF_READ | PF_WRITE\r\n\r\n\tdef __init__(self, idx):\r\n\t\tself.idx = idx\r\n\t\tself.type = None\r\n\t\tself.flags = None\r\n\t\tself.offset = None\r\n\t\tself.vaddr = None\r\n\t\tself.paddr = None\r\n\t\tself.filesz = None\r\n\t\tself.memsz = None\r\n\t\tself.align = None\r\n\r\n\tdef load(self, f):\r\n\t\tself.type, self.flags, self.offset, self.vaddr, self.paddr, self.filesz, self.memsz, self.align = struct.unpack(ElfPHdr.FMT, f.read(struct.calcsize(ElfPHdr.FMT)))\r\n\r\n\tdef save(self, f):\r\n\t\tf.write(struct.pack(ElfPHdr.FMT, self.type, self.flags, self.offset, self.vaddr, self.paddr, self.filesz, self.memsz, self.align))\r\n\r\n\tdef name(self):\r\n\t\tif self.type == ElfPHdr.PT_LOAD:\r\n\t\t\tif (self.flags & ElfPHdr.PF_READ_EXEC) == ElfPHdr.PF_READ_EXEC:\r\n\t\t\t\treturn '.text'\r\n\t\t\telif (self.flags & ElfPHdr.PF_READ_WRITE) == ElfPHdr.PF_READ_WRITE:\r\n\t\t\t\treturn '.data'\r\n\t\t\telse:\r\n\t\t\t\treturn '.load_{0:02}'.format(self.idx)\r\n\t\telse:\r\n\t\t\treturn {\r\n\t\t\t\tElfPHdr.PT_DYNAMIC: '.dynamic',\r\n\t\t\t\tElfPHdr.PT_INTERP: '.interp',\r\n\t\t\t\tElfPHdr.PT_TLS: '.tls',\r\n\t\t\t\tElfPHdr.PT_GNU_EH_FRAME: '.eh_frame_hdr',\r\n\t\t\t\tElfPHdr.PT_SCE_DYNLIBDATA: '.sce_dynlib_data',\r\n\t\t\t\tElfPHdr.PT_SCE_PROCPARAM: '.sce_process_param',\r\n\t\t\t\tElfPHdr.PT_SCE_MODULE_PARAM: '.sce_module_param',\r\n\t\t\t\tElfPHdr.PT_SCE_COMMENT: '.sce_comment',\r\n\t\t\t}.get(self.type, None)\r\n\r\n\tdef class_name(self):\r\n\t\tif (self.flags & ElfPHdr.PF_READ_EXEC) == ElfPHdr.PF_READ_EXEC:\r\n\t\t\treturn 'CODE'\r\n\t\telse:\r\n\t\t\treturn 'DATA'\r\n\r\nclass ElfSHdr(object):\r\n\tFMT = '<2I4Q2I2Q'\r\n\r\n\tdef __init__(self, idx):\r\n\t\tself.idx = idx\r\n\t\tself.name = None\r\n\t\tself.type = None\r\n\t\tself.flags = None\r\n\t\tself.addr = None\r\n\t\tself.offset = None\r\n\t\tself.size = None\r\n\t\tself.link = None\r\n\t\tself.info = None\r\n\t\tself.align = None\r\n\t\tself.entsize = None\r\n\r\n\tdef load(self, f):\r\n\t\tself.name, self.type, self.flags, self.addr, self.offset, self.size, self.link, self.info, self.align, self.entsize = struct.unpack(ElfSHdr.FMT, f.read(struct.calcsize(ElfSHdr.FMT)))\r\n\r\n\tdef save(self, f):\r\n\t\tf.write(struct.pack(ElfSHdr.FMT, self.name, self.type, self.flags, self.addr, self.offset, self.size, self.link, self.info, self.align, self.entsize))\r\n\r\nclass ElfFile(object):\r\n\tdef __init__(self, **kwargs):\r\n\t\tself.ehdr = None\r\n\t\tself.phdrs = None\r\n\t\tself.shdrs = None\r\n\t\tself.file_size = None\r\n\t\tself.digest = None\r\n\t\tself.segments = None\r\n\t\tself.sections = None\r\n\t\tself.ignore_shdrs = 'ignore_shdrs' in kwargs and kwargs['ignore_shdrs']\r\n\r\n\tdef load(self, f):\r\n\t\tstart_offset = f.tell()\r\n\t\tdata = f.read()\r\n\t\tself.file_size = len(data)\r\n\t\tself.digest = sha256(data)\r\n\t\tf.seek(start_offset)\r\n\r\n\t\tself.ehdr = ElfEHdr()\r\n\t\tself.ehdr.load(f)\r\n\r\n\t\tif self.ignore_shdrs:\r\n\t\t\tself.ehdr.shnum = 0\r\n\r\n\t\tself.phdrs = []\r\n\t\tself.segments = []\r\n\t\tif self.ehdr.has_segments():\r\n\t\t\tfor i in range(self.ehdr.phnum):\r\n\t\t\t\tf.seek(start_offset + self.ehdr.phoff + i * self.ehdr.phentsize)\r\n\t\t\t\tphdr = ElfPHdr(i)\r\n\t\t\t\tphdr.load(f)\r\n\t\t\t\tself.phdrs.append(phdr)\r\n\t\t\t\tif phdr.filesz > 0:\r\n\t\t\t\t\tf.seek(start_offset + phdr.offset)\r\n\t\t\t\t\tdata = f.read(phdr.filesz)\r\n\t\t\t\telse:\r\n\t\t\t\t\tdata = b''\r\n\t\t\t\tself.segments.append(data)\r\n\r\n\t\tself.shdrs = []\r\n\t\tself.sections = []\r\n\t\tif self.ehdr.has_sections():\r\n\t\t\tfor i in range(self.ehdr.shnum):\r\n\t\t\t\tf.seek(start_offset + self.ehdr.shoff + i * self.ehdr.shentsize)\r\n\t\t\t\tshdr = ElfSHdr(i)\r\n\t\t\t\tshdr.load(f)\r\n\t\t\t\tself.shdrs.append(shdr)\r\n\t\t\t\tif phdr.filesz > 0:\r\n\t\t\t\t\tf.seek(start_offset + shdr.offset)\r\n\t\t\t\t\tdata = f.read(phdr.filesz)\r\n\t\t\t\telse:\r\n\t\t\t\t\tdata = b''\r\n\t\t\t\tself.sections.append(data)\r\n\r\n\tdef save(self, f, no_sections=False):\r\n\t\tstart_offset = f.tell()\r\n\r\n\t\tself.ehdr.save(f)\r\n\r\n\t\tif not no_sections:\r\n\t\t\tif self.ehdr.has_sections():\r\n\t\t\t\tfor i in range(self.ehdr.shnum):\r\n\t\t\t\t\tf.seek(start_offset + self.ehdr.shoff + i * self.ehdr.shentsize)\r\n\t\t\t\t\tshdr = self.shdrs[i]\r\n\t\t\t\t\tshdr.save(f)\r\n\r\n\t\tif self.ehdr.has_segments():\r\n\t\t\tfor i in range(self.ehdr.phnum):\r\n\t\t\t\tf.seek(start_offset + self.ehdr.phoff + i * self.ehdr.phentsize)\r\n\t\t\t\tphdr = self.phdrs[i]\r\n\t\t\t\tphdr.save(f)\r\n\r\nDIGEST_SIZE = 0x20\r\nSIGNATURE_SIZE = 0x100\r\nBLOCK_SIZE = 0x4000\r\nDEFAULT_BLOCK_SIZE = 0x1000\r\n\r\nSELF_CONTROL_BLOCK_TYPE_NPDRM = 0x3\r\nSELF_NPDRM_CONTROL_BLOCK_CONTENT_ID_SIZE = 0x13\r\nSELF_NPDRM_CONTROL_BLOCK_RANDOM_PAD_SIZE = 0xD\r\n\r\nEMPTY_DIGEST = b'\\0' * DIGEST_SIZE\r\nEMPTY_SIGNATURE = b'\\0' * SIGNATURE_SIZE\r\n\r\nclass SignedElfEntry(object):\r\n\tFMT = '<4Q'\r\n\r\n\tPROPS_ORDER_SHIFT = 0\r\n\tPROPS_ORDER_MASK = 0x1\r\n\tPROPS_ENCRYPTED_SHIFT = 1\r\n\tPROPS_ENCRYPTED_MASK = 0x1\r\n\tPROPS_SIGNED_SHIFT = 2\r\n\tPROPS_SIGNED_MASK = 0x1\r\n\tPROPS_COMPRESSED_SHIFT = 3\r\n\tPROPS_COMPRESSED_MASK = 0x1\r\n\tPROPS_WINDOW_BITS_SHIFT = 8\r\n\tPROPS_WINDOW_BITS_MASK = 0x7\r\n\tPROPS_HAS_BLOCKS_SHIFT = 11\r\n\tPROPS_HAS_BLOCKS_MASK = 0x1\r\n\tPROPS_BLOCK_SIZE_SHIFT = 12\r\n\tPROPS_BLOCK_SIZE_MASK = 0xF\r\n\tPROPS_HAS_DIGESTS_SHIFT = 16\r\n\tPROPS_HAS_DIGESTS_MASK = 0x1\r\n\tPROPS_HAS_EXTENTS_SHIFT = 17\r\n\tPROPS_HAS_EXTENTS_MASK = 0x1\r\n\tPROPS_HAS_META_SEGMENT_SHIFT = 20\r\n\tPROPS_HAS_META_SEGMENT_MASK = 0x1\r\n\tPROPS_SEGMENT_INDEX_SHIFT = 20\r\n\tPROPS_SEGMENT_INDEX_MASK = 0xFFFF\r\n\tPROPS_DEFAULT_BLOCK_SIZE = 0x1000\r\n\tPROPS_META_SEGMENT_MASK = 0xF0000\r\n\r\n\tdef __init__(self, index):\r\n\t\tself.index = index\r\n\r\n\t\tself.props = None\r\n\t\tself.offset = None\r\n\t\tself.filesz = None\r\n\t\tself.memsz = None\r\n\r\n\t\tself.data = None\r\n\r\n\tdef save(self, f):\r\n\t\tf.write(struct.pack(SignedElfEntry.FMT, self.props, self.offset, self.filesz, self.memsz))\r\n\r\n\t@property\r\n\tdef order(self):\r\n\t\treturn (self.props >> SignedElfEntry.PROPS_ORDER_SHIFT) & SignedElfEntry.PROPS_ORDER_MASK\r\n\r\n\t@order.setter\r\n\tdef order(self, value):\r\n\t\tself.props &= ~(SignedElfEntry.PROPS_ORDER_MASK << SignedElfEntry.PROPS_ORDER_SHIFT)\r\n\t\tself.props |= (value & SignedElfEntry.PROPS_ORDER_MASK) << SignedElfEntry.PROPS_ORDER_SHIFT\r\n\r\n\t@property\r\n\tdef encrypted(self):\r\n\t\treturn ((self.props >> SignedElfEntry.PROPS_ENCRYPTED_SHIFT) & SignedElfEntry.PROPS_ENCRYPTED_MASK) != 0\r\n\r\n\t@encrypted.setter\r\n\tdef encrypted(self, value):\r\n\t\tself.props &= ~(SignedElfEntry.PROPS_ENCRYPTED_MASK << SignedElfEntry.PROPS_ENCRYPTED_SHIFT)\r\n\t\tif value:\r\n\t\t\tself.props |= SignedElfEntry.PROPS_ENCRYPTED_MASK << SignedElfEntry.PROPS_ENCRYPTED_SHIFT\r\n\r\n\t@property\r\n\tdef signed(self):\r\n\t\treturn ((self.props >> SignedElfEntry.PROPS_SIGNED_SHIFT) & SignedElfEntry.PROPS_SIGNED_MASK) != 0\r\n\r\n\t@signed.setter\r\n\tdef signed(self, value):\r\n\t\tself.props &= ~(SignedElfEntry.PROPS_SIGNED_MASK << SignedElfEntry.PROPS_SIGNED_SHIFT)\r\n\t\tif value:\r\n\t\t\tself.props |= SignedElfEntry.PROPS_SIGNED_MASK << SignedElfEntry.PROPS_SIGNED_SHIFT\r\n\r\n\t@property\r\n\tdef compressed(self):\r\n\t\treturn ((self.props >> SignedElfEntry.PROPS_COMPRESSED_SHIFT) & SignedElfEntry.PROPS_COMPRESSED_MASK) != 0\r\n\r\n\t@compressed.setter\r\n\tdef compressed(self, value):\r\n\t\tself.props &= ~(SignedElfEntry.PROPS_COMPRESSED_MASK << SignedElfEntry.PROPS_COMPRESSED_SHIFT)\r\n\t\tif value:\r\n\t\t\tself.props |= SignedElfEntry.PROPS_COMPRESSED_MASK << SignedElfEntry.PROPS_COMPRESSED_SHIFT\r\n\r\n\t@property\r\n\tdef has_blocks(self):\r\n\t\treturn ((self.props >> SignedElfEntry.PROPS_HAS_BLOCKS_SHIFT) & SignedElfEntry.PROPS_HAS_BLOCKS_MASK) != 0\r\n\r\n\t@has_blocks.setter\r\n\tdef has_blocks(self, value):\r\n\t\tself.props &= ~(SignedElfEntry.PROPS_HAS_BLOCKS_MASK << SignedElfEntry.PROPS_HAS_BLOCKS_SHIFT)\r\n\t\tif value:\r\n\t\t\tself.props |= SignedElfEntry.PROPS_HAS_BLOCKS_MASK << SignedElfEntry.PROPS_HAS_BLOCKS_SHIFT\r\n\r\n\t@property\r\n\tdef has_digests(self):\r\n\t\treturn ((self.props >> SignedElfEntry.PROPS_HAS_DIGESTS_SHIFT) & SignedElfEntry.PROPS_HAS_DIGESTS_MASK) != 0\r\n\r\n\t@has_digests.setter\r\n\tdef has_digests(self, value):\r\n\t\tself.props &= ~(SignedElfEntry.PROPS_HAS_DIGESTS_MASK << SignedElfEntry.PROPS_HAS_DIGESTS_SHIFT)\r\n\t\tif value:\r\n\t\t\tself.props |= SignedElfEntry.PROPS_HAS_DIGESTS_MASK << SignedElfEntry.PROPS_HAS_DIGESTS_SHIFT\r\n\r\n\t@property\r\n\tdef has_extents(self):\r\n\t\treturn ((self.props >> SignedElfEntry.PROPS_HAS_EXTENTS_SHIFT) & SignedElfEntry.PROPS_HAS_EXTENTS_MASK) != 0\r\n\r\n\t@has_extents.setter\r\n\tdef has_extents(self, value):\r\n\t\tself.props &= ~(SignedElfEntry.PROPS_HAS_EXTENTS_MASK << SignedElfEntry.PROPS_HAS_EXTENTS_SHIFT)\r\n\t\tif value:\r\n\t\t\tself.props |= SignedElfEntry.PROPS_HAS_EXTENTS_MASK << SignedElfEntry.PROPS_HAS_EXTENTS_SHIFT\r\n\r\n\t@property\r\n\tdef has_meta_segment(self):\r\n\t\treturn ((self.props >> SignedElfEntry.PROPS_HAS_META_SEGMENT_SHIFT) & SignedElfEntry.PROPS_HAS_META_SEGMENT_MASK) != 0\r\n\r\n\t@has_meta_segment.setter\r\n\tdef has_meta_segment(self, value):\r\n\t\tself.props &= ~(SignedElfEntry.PROPS_HAS_META_SEGMENT_MASK << SignedElfEntry.PROPS_HAS_META_SEGMENT_SHIFT)\r\n\t\tif value:\r\n\t\t\tself.props |= SignedElfEntry.PROPS_HAS_META_SEGMENT_MASK << SignedElfEntry.PROPS_HAS_META_SEGMENT_SHIFT\r\n\r\n\t@property\r\n\tdef wbits(self):\r\n\t\treturn (self.props >> SignedElfEntry.PROPS_WINDOW_BITS_SHIFT) & SignedElfEntry.PROPS_WINDOW_BITS_MASK\r\n\r\n\t@wbits.setter\r\n\tdef wbits(self, value):\r\n\t\tself.props &= ~(SignedElfEntry.PROPS_WINDOW_BITS_MASK << SignedElfEntry.PROPS_WINDOW_BITS_SHIFT)\r\n\t\tself.props |= (value & SignedElfEntry.PROPS_WINDOW_BITS_MASK) << SignedElfEntry.PROPS_WINDOW_BITS_SHIFT\r\n\r\n\t@property\r\n\tdef block_size(self):\r\n\t\tif self.has_blocks:\r\n\t\t\treturn 1 << (12 + (self.props >> SignedElfEntry.PROPS_BLOCK_SIZE_SHIFT) & SignedElfEntry.PROPS_BLOCK_SIZE_MASK)\r\n\t\telse:\r\n\t\t\treturn DEFAULT_BLOCK_SIZE\r\n\r\n\t@block_size.setter\r\n\tdef block_size(self, value):\r\n\t\tself.props &= ~(SignedElfEntry.PROPS_BLOCK_SIZE_MASK << SignedElfEntry.PROPS_BLOCK_SIZE_SHIFT)\r\n\t\tif self.has_blocks:\r\n\t\t\tvalue = ilog2(value) - 12\r\n\t\telse:\r\n\t\t\tvalue = 0 # TODO: check\r\n\t\tself.props |= (value & SignedElfEntry.PROPS_BLOCK_SIZE_MASK) << SignedElfEntry.PROPS_BLOCK_SIZE_SHIFT\r\n\r\n\t@property\r\n\tdef segment_index(self):\r\n\t\treturn (self.props >> SignedElfEntry.PROPS_SEGMENT_INDEX_SHIFT) & SignedElfEntry.PROPS_SEGMENT_INDEX_MASK\r\n\r\n\t@wbits.setter\r\n\tdef segment_index(self, value):\r\n\t\tself.props &= ~(SignedElfEntry.PROPS_SEGMENT_INDEX_MASK << SignedElfEntry.PROPS_SEGMENT_INDEX_SHIFT)\r\n\t\tself.props |= (value & SignedElfEntry.PROPS_SEGMENT_INDEX_MASK) << SignedElfEntry.PROPS_SEGMENT_INDEX_SHIFT\r\n\r\n\tdef is_meta_segment(self): # TODO: check\r\n\t\treturn (self.props & SignedElfEntry.PROPS_META_SEGMENT_MASK) != 0\r\n\r\n\tdef __repr__(self):\r\n\t\treturn 'prs:0x{0:X} ofs:0x{1:X} fsz:0x{2:X} msz:0x{3:X}'.format(self.props, self.offset, self.filesz, self.memsz)\r\n\r\nclass SignedElfExInfo(object):\r\n\tFMT = '<4Q32s'\r\n\r\n\tPTYPE_FAKE = 0x1\r\n\tPTYPE_NPDRM_EXEC = 0x4\r\n\tPTYPE_NPDRM_DYNLIB = 0x5\r\n\tPTYPE_SYSTEM_EXEC = 0x8\r\n\tPTYPE_SYSTEM_DYNLIB = 0x9 # including Mono binaries\r\n\tPTYPE_HOST_KERNEL = 0xC\r\n\tPTYPE_SECURE_MODULE = 0xE\r\n\tPTYPE_SECURE_KERNEL = 0xF\r\n\r\n\tdef __init__(self):\r\n\t\tself.paid = None\r\n\t\tself.ptype = None\r\n\t\tself.app_version = None\r\n\t\tself.fw_version = None\r\n\t\tself.digest = None\r\n\r\n\tdef save(self, f):\r\n\t\tf.write(struct.pack(SignedElfExInfo.FMT, self.paid, self.ptype, self.app_version, self.fw_version, self.digest))\r\n\r\nclass SignedElfNpdrmControlBlock(object):\r\n\tFMT = '<H14x19s13s'\r\n\r\n\tdef __init__(self):\r\n\t\tself.type = SELF_CONTROL_BLOCK_TYPE_NPDRM\r\n\t\tself.content_id = None\r\n\t\tself.random_pad = None\r\n\r\n\tdef save(self, f):\r\n\t\tf.write(struct.pack(SignedElfNpdrmControlBlock.FMT, self.type, self.content_id, self.random_pad))\r\n\r\nclass SignedElfMetaBlock(object):\r\n\tFMT = '<80x'\r\n\r\n\tdef __init__(self):\r\n\t\tpass\r\n\r\n\tdef save(self, f):\r\n\t\tf.write(struct.pack(SignedElfMetaBlock.FMT))\r\n\r\nclass SignedElfMetaFooter(object):\r\n\tFMT = '<48xI28x'\r\n\r\n\tdef __init__(self):\r\n\t\tself.unk1 = None\r\n\r\n\tdef save(self, f):\r\n\t\tf.write(struct.pack(SignedElfMetaFooter.FMT, self.unk1))\r\n\r\nclass SignedElfFile(object):\r\n\tCOMMON_HEADER_FMT = '<4s4B'\r\n\tEXT_HEADER_FMT = '<I2HQ2H4x'\r\n\r\n\tMAGIC = b'\\x4F\\x15\\x3D\\x1D'\r\n\tVERSION = 0x00\r\n\tMODE = 0x01\r\n\tENDIAN = 0x01\r\n\tATTRIBS = 0x12\r\n\r\n\tKEY_TYPE = 0x101\r\n\r\n\tFLAGS_SEGMENT_SIGNED_SHIFT = 4\r\n\tFLAGS_SEGMENT_SIGNED_MASK = 0x7\r\n\r\n\tHAS_NPDRM = 1\r\n\r\n\tdef __init__(self, elf, **kwargs):\r\n\t\tself.elf = elf\r\n\r\n\t\tself.magic = None\r\n\t\tself.version = None\r\n\t\tself.mode = None\r\n\t\tself.endian = None\r\n\t\tself.attribs = None\r\n\t\tself.key_type = None\r\n\t\tself.header_size = None\r\n\t\tself.meta_size = None\r\n\t\tself.file_size = None\r\n\t\tself.num_entries = None\r\n\t\tself.flags = None\r\n\r\n\t\tself.entries = None\r\n\t\tself.ex_info = None\r\n\t\tself.npdrm_control_block = None\r\n\t\tself.meta_blocks = None\r\n\t\tself.meta_footer = None\r\n\t\tself.signature = None\r\n\t\tself.version_data = None\r\n\r\n\t\tself.paid = kwargs['paid'] if 'paid' in kwargs and not kwargs['paid'] is None else 0x3100000000000002\r\n\t\tself.ptype = kwargs['ptype'] if 'ptype' in kwargs and not kwargs['ptype'] is None else SignedElfExInfo.PTYPE_FAKE\r\n\t\tself.app_version = kwargs['app_version'] if 'app_version' in kwargs and not kwargs['app_version'] is None else 0\r\n\t\tself.fw_version = kwargs['fw_version'] if 'fw_version' in kwargs and not kwargs['fw_version'] is None else 0\r\n\t\tself.auth_info = kwargs['auth_info'] if 'auth_info' in kwargs and not kwargs['auth_info'] is None else None\r\n\r\n\tdef _prepare(self):\r\n\t\tself.magic = SignedElfFile.MAGIC\r\n\t\tself.version = SignedElfFile.VERSION\r\n\t\tself.mode = SignedElfFile.MODE\r\n\t\tself.endian = SignedElfFile.ENDIAN\r\n\t\tself.attribs = SignedElfFile.ATTRIBS\r\n\t\tself.key_type = SignedElfFile.KEY_TYPE\r\n\t\tself.flags = 0x2\r\n\r\n\t\tsigned_block_count = 2\r\n\t\tself.flags |= (signed_block_count & SignedElfFile.FLAGS_SEGMENT_SIGNED_MASK) << SignedElfFile.FLAGS_SEGMENT_SIGNED_SHIFT\r\n\r\n\t\tself.entries = []\r\n\t\tentry_idx = 0\r\n\t\tfor i in range(self.elf.ehdr.phnum):\r\n\t\t\tphdr = self.elf.phdrs[i]\r\n\t\t\tif phdr.type == ElfPHdr.PT_SCE_VERSION:\r\n\t\t\t\tself.version_data = self.elf.segments[i]\r\n\t\t\tif not phdr.type in [ElfPHdr.PT_LOAD, ElfPHdr.PT_SCE_RELRO, ElfPHdr.PT_SCE_DYNLIBDATA, ElfPHdr.PT_SCE_COMMENT]:\r\n\t\t\t\tcontinue\r\n\t\t\tmeta_entry = SignedElfEntry(entry_idx)\r\n\t\t\tmeta_entry.props = 0\r\n\t\t\tmeta_entry.encrypted = False\r\n\t\t\tmeta_entry.signed = True\r\n\t\t\tmeta_entry.has_digests = True\r\n\t\t\tmeta_entry.segment_index = entry_idx + 1\r\n\t\t\tself.entries.append(meta_entry)\r\n\t\t\tdata_entry = SignedElfEntry(entry_idx + 1)\r\n\t\t\tdata_entry.props = 0\r\n\t\t\tdata_entry.encrypted = False\r\n\t\t\tdata_entry.signed = True\r\n\t\t\tdata_entry.has_blocks = True\r\n\t\t\tdata_entry.block_size = BLOCK_SIZE\r\n\t\t\tdata_entry.segment_index = i\r\n\t\t\tself.entries.append(data_entry)\r\n\t\t\tentry_idx += 2\r\n\t\tself.num_entries = len(self.entries)\r\n\r\n\t\tself.ex_info = SignedElfExInfo()\r\n\t\tself.ex_info.paid = self.paid\r\n\t\tself.ex_info.ptype = self.ptype\r\n\t\tself.ex_info.app_version = self.app_version\r\n\t\tself.ex_info.fw_version = self.fw_version\r\n\t\tself.ex_info.digest = self.elf.digest\r\n\r\n\t\tif SignedElfFile.HAS_NPDRM:\r\n\t\t\tself.npdrm_control_block = SignedElfNpdrmControlBlock()\r\n\t\t\tself.npdrm_control_block.content_id = b'\\0' * SELF_NPDRM_CONTROL_BLOCK_CONTENT_ID_SIZE\r\n\t\t\tself.npdrm_control_block.random_pad = b'\\0' * SELF_NPDRM_CONTROL_BLOCK_RANDOM_PAD_SIZE\r\n\r\n\t\tself.header_size = struct.calcsize(SignedElfFile.COMMON_HEADER_FMT) + struct.calcsize(SignedElfFile.EXT_HEADER_FMT)\r\n\t\tself.header_size += self.num_entries * struct.calcsize(SignedElfEntry.FMT)\r\n\t\tself.header_size += max(self.elf.ehdr.ehsize, self.elf.ehdr.phoff + self.elf.ehdr.phentsize * self.elf.ehdr.phnum)\r\n\t\tself.header_size = align_up(self.header_size, 16)\r\n\t\tself.header_size += struct.calcsize(SignedElfExInfo.FMT)\r\n\t\tif SignedElfFile.HAS_NPDRM:\r\n\t\t\tself.header_size += struct.calcsize(SignedElfNpdrmControlBlock.FMT)\r\n\t\tself.meta_size = self.num_entries * struct.calcsize(SignedElfMetaBlock.FMT) + struct.calcsize(SignedElfMetaFooter.FMT) + SIGNATURE_SIZE\r\n\r\n\t\tself.meta_blocks = []\r\n\t\tfor i in range(self.num_entries):\r\n\t\t\tmeta_block = SignedElfMetaBlock()\r\n\t\t\tself.meta_blocks.append(meta_block)\r\n\r\n\t\tself.meta_footer = SignedElfMetaFooter()\r\n\t\tself.meta_footer.unk1 = 0x10000\r\n\r\n\t\tif not self.auth_info is None:\r\n\t\t\tself.signature = (struct.pack('<QQ', len(self.auth_info), self.ex_info.paid) + self.auth_info[8:]).ljust(SIGNATURE_SIZE, b'\\0')\r\n\t\telse:\r\n\t\t\tself.signature = EMPTY_SIGNATURE\r\n\r\n\t\tentry_idx = 0\r\n\t\toffset = self.header_size + self.meta_size\r\n\t\tfor i in range(self.elf.ehdr.phnum):\r\n\t\t\tphdr = self.elf.phdrs[i]\r\n\t\t\tif not phdr.type in [ElfPHdr.PT_LOAD, ElfPHdr.PT_SCE_RELRO, ElfPHdr.PT_SCE_DYNLIBDATA, ElfPHdr.PT_SCE_COMMENT]:\r\n\t\t\t\tcontinue\r\n\t\t\tprint('processing segment #{0:02}...'.format(i))\r\n\r\n\t\t\tmeta_entry, data_entry = self.entries[entry_idx], self.entries[entry_idx + 1]\r\n\r\n\t\t\tnum_blocks = align_up(phdr.filesz, BLOCK_SIZE) // BLOCK_SIZE\r\n\t\t\tmeta_entry.data = EMPTY_DIGEST * num_blocks\r\n\t\t\tmeta_entry.offset = offset\r\n\t\t\tmeta_entry.memsz = meta_entry.filesz = len(meta_entry.data)\r\n\t\t\toffset += meta_entry.filesz\r\n\t\t\toffset = align_up(offset, 16)\r\n\r\n\t\t\tdata_entry.data = self.elf.segments[i]\r\n\t\t\tdata_entry.offset = offset\r\n\t\t\tdata_entry.memsz = data_entry.filesz = phdr.filesz\r\n\t\t\toffset += data_entry.filesz\r\n\t\t\toffset = align_up(offset, 16)\r\n\r\n\t\t\tentry_idx += 2\r\n\r\n\t\tself.file_size = offset\r\n\r\n\tdef save(self, f):\r\n\t\tstart_offset = f.tell()\r\n\r\n\t\t# calculate neccessary fields\r\n\t\tself._prepare()\r\n\r\n\t\t# write common header\r\n\t\tf.write(struct.pack(SignedElfFile.COMMON_HEADER_FMT, self.magic, self.version, self.mode, self.endian, self.attribs))\r\n\r\n\t\t# write extended header\r\n\t\tf.write(struct.pack(SignedElfFile.EXT_HEADER_FMT, self.key_type, self.header_size, self.meta_size, self.file_size, self.num_entries, self.flags))\r\n\r\n\t\t# write entries\r\n\t\tfor entry in self.entries:\r\n\t\t\tentry.save(f)\r\n\r\n\t\t# write elf headers\r\n\t\telf_offset = f.tell()\r\n\t\telf_header_size = max(self.elf.ehdr.ehsize, self.elf.ehdr.phoff + self.elf.ehdr.phentsize * self.elf.ehdr.phnum)\r\n\t\telf_header_size = align_up(elf_header_size, 16)\r\n\t\tself.elf.save(f, True)\r\n\t\tf.seek(elf_offset + elf_header_size)\r\n\r\n\t\t# write extended info\r\n\t\tself.ex_info.save(f)\r\n\r\n\t\t# write npdrm control block\r\n\t\tif SignedElfFile.HAS_NPDRM:\r\n\t\t\tself.npdrm_control_block.save(f)\r\n\r\n\t\t# write meta blocks\r\n\t\tfor meta_block in self.meta_blocks:\r\n\t\t\tmeta_block.save(f)\r\n\r\n\t\t# write meta footer\r\n\t\tself.meta_footer.save(f)\r\n\r\n\t\t# write signature\r\n\t\tf.write(self.signature)\r\n\r\n\t\t# write segments\r\n\t\tfor entry in self.entries:\r\n\t\t\tf.seek(start_offset + entry.offset)\r\n\t\t\tf.write(entry.data)\r\n\r\n\t\t# write version\r\n\t\tif not self.version_data is None:\r\n\t\t\tf.write(self.version_data)\r\n\r\ndef ensure_hex_string(val, **kwargs):\r\n\texact_size = int(kwargs['exact_size']) if 'exact_size' in kwargs else None\r\n\tmin_size = int(kwargs['min_size']) if 'min_size' in kwargs else None\r\n\tmax_size = int(kwargs['max_size']) if 'max_size' in kwargs else None\r\n\r\n\tval = re.sub('\\s+', '', val)\r\n\tval_size = len(val)\r\n\tif val_size > 0:\r\n\t\tif val.startswith('0x') or val.startswith('0X'):\r\n\t\t\tval = val[2:]\r\n\t\tif len(val) % 2 != 0 or not all(x in string.hexdigits for x in val):\r\n\t\t\treturn None\r\n\t\tval = val.decode('hex')\r\n\t\tval_size = len(val)\r\n\r\n\tif not exact_size is None and val_size != exact_size:\r\n\t\treturn None\r\n\telse:\r\n\t\tif not min_size is None and val_size < min_size:\r\n\t\t\treturn None\r\n\t\tif not max_size is None and val_size > max_size:\r\n\t\t\treturn None\r\n\r\n\treturn val\r\n\r\ndef input_file_type(val):\r\n\tif not os.access(val, os.F_OK | os.R_OK) or not os.path.isfile(val):\r\n\t\traise argparse.ArgumentTypeError('invalid input file: {0}'.format(val))\r\n\treturn val\r\n\r\ndef output_file_type(val):\r\n\tif os.access(val, os.F_OK) and (not os.path.isfile(val) or not os.access(val, os.F_OK | os.W_OK)):\r\n\t\traise argparse.ArgumentTypeError('invalid output file: {0}'.format(val))\r\n\treturn val\r\n\r\ndef auth_info_type(val):\r\n\tnew_val = ensure_hex_string(val, exact_size=0x88)\r\n\tif new_val is None:\r\n\t\traise argparse.ArgumentTypeError('invalid auth info: {0}'.format(val))\r\n\treturn new_val\r\n\r\nclass MyParser(argparse.ArgumentParser):\r\n\tdef error(self, message):\r\n\t\tself.print_help()\r\n\t\tsys.stderr.write('\\nerror: {0}\\n'.format(message))\r\n\t\tsys.exit(2)\r\n\r\nif __name__ == '__main__':\r\n    parser = MyParser(description='fake signed elf maker')\r\n    parser.add_argument('input', type=input_file_type, default=None, help='elf/prx file path')\r\n    parser.add_argument('output', type=output_file_type, default=None, help='self/sprx file path')\r\n    parser.add_argument('--paid', type=int_with_base_type, default=0x3100000000000002, help='program authentication id')\r\n    parser.add_argument('--ptype', default=None, help='program type {fake, npdrm_exec, npdrm_dynlib, system_exec, system_dynlib, host_kernel, secure_module, secure_kernel}')\r\n    parser.add_argument('--app-version', type=int_with_base_type, default=0, help='application version')\r\n    parser.add_argument('--fw-version', type=int_with_base_type, default=0, help='firmware version')\r\n    parser.add_argument('--auth-info', type=auth_info_type, default=None, help='authentication info')\r\n\r\n    if len(sys.argv) == 1:\r\n        parser.print_usage()\r\n        sys.exit(1)\r\n\r\n    args = parser.parse_args()\r\n\r\n    paid = args.paid\r\n    if not (0 <= paid <= 0xFFFFFFFFFFFFFFFF):\r\n        parser.error('invalid program authentication id: 0x{0:016X}'.format(paid))\r\n\r\n    ptype = SignedElfExInfo.PTYPE_FAKE\r\n    if not args.ptype is None:\r\n        ptype = {\r\n            'fake': SignedElfExInfo.PTYPE_FAKE,\r\n            'npdrm_exec': SignedElfExInfo.PTYPE_NPDRM_EXEC,\r\n            'npdrm_dynlib': SignedElfExInfo.PTYPE_NPDRM_DYNLIB,\r\n            'system_exec': SignedElfExInfo.PTYPE_SYSTEM_EXEC,\r\n            'system_dynlib': SignedElfExInfo.PTYPE_SYSTEM_DYNLIB,\r\n            'host_kernel': SignedElfExInfo.PTYPE_HOST_KERNEL,\r\n            'secure_module': SignedElfExInfo.PTYPE_SECURE_MODULE,\r\n            'secure_kernel': SignedElfExInfo.PTYPE_SECURE_KERNEL,\r\n        }.get(args.ptype.strip().lower(), None)\r\n        if ptype is None:\r\n            ptype = try_parse_int(args.ptype)\r\n        if ptype is None:\r\n            parser.error('invalid program type: 0x{0:016X}'.format(ptype))\r\n    if not (0 <= ptype <= 0xFFFFFFFFFFFFFFFF):\r\n        parser.error('invalid program type: 0x{0:016X}'.format(ptype))\r\n\r\n    app_version = args.app_version\r\n    if not (0 <= app_version <= 0xFFFFFFFFFFFFFFFF):\r\n        parser.error('invalid application version: 0x{0:016X}'.format(app_version))\r\n\r\n    fw_version = args.fw_version\r\n    if not (0 <= fw_version <= 0xFFFFFFFFFFFFFFFF):\r\n        parser.error('invalid firmware version: 0x{0:016X}'.format(fw_version))\r\n\r\n    auth_info = args.auth_info\r\n\r\n    elf_file_path = args.input\r\n    fself_file_path = args.output\r\n\r\n    print('loading elf file: {0}'.format(elf_file_path))\r\n    try:\r\n        with open(elf_file_path, 'rb') as f:\r\n            elf_file = ElfFile(ignore_shdrs=True)\r\n            elf_file.load(f)\r\n    except Exception as err:\r\n        traceback.print_exc()\r\n        print('')\r\n        parser.error('unable to load elf file: {0} ({1})'.format(elf_file_path, err))\r\n\r\n    print('saving fake signed elf file: {0}'.format(fself_file_path))\r\n    try:\r\n        with open(fself_file_path, 'wb') as f:\r\n            self_file = SignedElfFile(elf_file, paid=paid, ptype=ptype, app_version=app_version, fw_version=fw_version, auth_info=auth_info)\r\n            self_file.save(f)\r\n    except Exception as err:\r\n        traceback.print_exc()\r\n        print('')\r\n        parser.error('unable to save fself file: {0} ({1})'.format(elf_file_path, err))\r\n\r\n    print('done')\r\n"
  },
  {
    "path": "ps5-kstuff/porting_tool/test_offsets.py",
    "content": "from main import *\n\nuse_kstuff()\nbuf = gdb.ieval('malloc(72*8)')\nkdata_base = gdb.ieval('kdata_base')\ngdb.ieval('offsets.mprotect_fix_end = '+ostr(kdata_base+symbols['mprotect_fix_start']+6))\ngdb.ieval('offsets.pop_all_except_rdi_iret = '+ostr(kdata_base+symbols['pop_all_iret']+4))\ngdb.execute('cont')\nassert 'Remote connection closed' in gdb.execute('p (int)kill((int)getpid(), 9)')\n"
  },
  {
    "path": "ps5-kstuff/porting_tool/traces.py",
    "content": "import collections\n\nclass Trace:\n    Frame = collections.namedtuple('Frame', ['rip', 'cs', 'eflags', 'rsp', 'ss', 'rax', 'rcx', 'rdx', 'rbx', 'pad8', 'rbp', 'rsi', 'rdi', 'r8', 'r9', 'r10', 'r11', 'r12', 'r13', 'r14', 'r15'])\n    def __init__(self, blob):\n        data = [int.from_bytes(blob[i:i+8], 'little') for i in range(0, len(blob), 8)]\n        self.instrs = [self.Frame(*data[i:i+21]) for i in range(0, len(data), 21)]\n    def __getitem__(self, q):\n        return self.instrs[q]\n    def __len__(self):\n        return len(self.instrs)\n    def find_rip_all(self, rip):\n        return [i for i, j in enumerate(self.instrs) if j.rip == rip]\n    def find_next_rip(self, idx, rip):\n        try: return next(i for i in range(idx, len(self.instrs)) if self[i].rip == rip)\n        except StopIteration: return None\n    def find_next_reg(self, idx, which_reg, value):\n        getter = getattr(self.Frame, which_reg).__get__\n        try: return next(i for i in range(idx, len(self.instrs)) if getter(self[i]) == value)\n        except StopIteration: return None\n    def find_next_any_reg(self, idx, value):\n        try: return next(i for i, j in range(idx, len(self.instrs)) if getter(self[i]) == value)\n        except StopIteration: return None\n    def is_jump(self, idx):\n        return idx + 1 < len(self) and (self[idx+1].rip - self[idx].rip) % 2**64 >= 16\n    def find_caller(self, idx):\n        rsp = self[idx].rsp\n        while idx > 0:\n            idx -= 1\n            if self[idx].rsp == rsp + 8 and self[idx+1].rsp == rsp and self.is_jump(idx):\n                return idx\n            rsp = max(rsp, self[idx].rsp)\n        return None\n    def find_last_callee_ret(self, idx):\n        idx0 = self.find_caller(idx) + 1\n        while idx > idx0:\n            idx -= 1\n            if self[idx].rsp == self[idx+1].rsp - 8 and self.is_jump(idx):\n                return idx\n        return None\n    def find_next_instr(self, idx):\n        if idx + 1 < len(self):\n            if self[idx+1].rsp == self[idx].rsp - 8 and self.is_jump(idx):\n                return self.find_next_reg(idx+1, 'rsp', self[idx].rsp)\n            else:\n                return idx + 1\n        return None\n    def find_last_ret(self, idx):\n        idx -= 1\n        while idx >= 0 and not (self.is_jump(idx) and self[idx+1].rsp == self[idx].rsp + 8):\n            idx -= 1\n        return idx if idx >= 0 else None\n"
  },
  {
    "path": "ps5-kstuff/sqlite_triggers.c",
    "content": "#include <stddef.h>\n#include <sys/mman.h>\n\ntypedef struct sqlite3 sqlite3;\ntypedef struct sqlite3_stmt sqlite3_stmt;\nenum { SQLITE_OK = 0, SQLITE_ROW = 100, SQLITE_DONE = 101,  };\nenum { SQLITE_OPEN_READWRITE = 2 };\n\nstruct buf\n{\n    char* data;\n    size_t sz;\n    size_t cap;\n};\n\n#define SQL_COMMANDS_PER_TABLE(PUTS, PUTN)\\\nPUTS(\"create trigger if not exists trig_update_drm_\") PUTN() PUTS(\" after update of appDrmType on \") PUTN() PUTS(\" when new.appDrmType = 1 begin update \") PUTN() PUTS(\" set appDrmType = 5 where titleId = old.titleId; end;\")\\\nPUTS(\"create trigger if not exists trig_insert_drm_\") PUTN() PUTS(\" after insert on \") PUTN() PUTS(\" when new.appDrmType = 1 begin update \") PUTN() PUTS(\" set appDrmType = 5 where titleId = new.titleId; end;\")\\\nPUTS(\"update \") PUTN() PUTS(\" set appDrmType=5 where appDrmType=1;\")\n\nvoid log_table_name(struct buf* buf, const char* name)\n{\n    char* prefix = \"tbl_iconinfo_\";\n    size_t i = 0;\n    while(prefix[i] && prefix[i] == name[i])\n        i++;\n    if(!prefix[i])\n    {\n        while(name[i])\n            i++;\n#define PUTS(s) +(sizeof(s) - 1)\n#define PUTN() +i\n        size_t new_sz = buf->sz SQL_COMMANDS_PER_TABLE(PUTS, PUTN);\n#undef PUTN\n#undef PUTS\n        size_t cap = buf->cap;\n        if(cap < 16384)\n            cap = 16384;\n        if(new_sz > cap)\n            cap *= 2;\n        if(new_sz > cap)\n            cap = new_sz;\n        if(cap != buf->cap)\n        {\n            char* new_data = mmap(0, cap, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANON, -1, 0);\n            char* data = buf->data;\n            size_t sz = buf->sz;\n            for(size_t i = 0; i < sz; i++)\n                new_data[i] = data[i];\n            munmap(data, buf->cap);\n            buf->data = new_data;\n            buf->cap = cap;\n        }\n#define PUT(s, l)\\\n        for(size_t j = 0; j < l; j++)\\\n            buf->data[buf->sz++] = s[j];\n#define PUTS(s) PUT(s, sizeof(s)-1)\n#define PUTN() PUT(name, i)\n        SQL_COMMANDS_PER_TABLE(PUTS, PUTN)\n#undef PUTN\n#undef PUTS\n#undef PUT\n    }\n}\n\nint(*sqlite3_open_v2)(const char*, sqlite3**, int, const char*);\nint(*sqlite3_prepare_v2)(sqlite3*, const char*, int, sqlite3_stmt**, const char**);\nint(*sqlite3_step)(sqlite3_stmt*);\nconst unsigned char*(*sqlite3_column_text)(sqlite3_stmt*, int);\nint(*sqlite3_finalize)(sqlite3_stmt*);\n\n//sqlite3_exec\nvoid run_stmt(sqlite3* db, const char* cmd, struct buf* buf)\n{\n    while(*cmd)\n    {\n        sqlite3_stmt* stmt;\n        const char* tail;\n        if(sqlite3_prepare_v2(db, cmd, -1, &stmt, &tail) != SQLITE_OK)\n            asm volatile(\"ud2\");\n        cmd = tail;\n        int status;\n        while((status = sqlite3_step(stmt)) == SQLITE_ROW)\n            if(buf)\n                log_table_name(buf, sqlite3_column_text(stmt, 0));\n        if(status != SQLITE_DONE)\n            asm volatile(\"ud2\");\n        sqlite3_finalize(stmt);\n    }\n}\n\nvoid* dlopen(const char*, int);\nvoid* dlsym(void*, const char*);\n\nvoid patch_app_db(void)\n{\n    void* handle = dlopen(\"/system_ex/common_ex/lib/libSceNKWebKitRequirements.sprx\", 0);\n    sqlite3_open_v2 = dlsym(handle, \"sqlite3_open_v2\");\n    sqlite3_prepare_v2 = dlsym(handle, \"sqlite3_prepare_v2\");\n    sqlite3_step = dlsym(handle, \"sqlite3_step\");\n    sqlite3_column_text = dlsym(handle, \"sqlite3_column_text\");\n    sqlite3_finalize = dlsym(handle, \"sqlite3_finalize\");\n    sqlite3* db;\n    if(sqlite3_open_v2(\"/system_data/priv/mms/app.db\", &db, SQLITE_OPEN_READWRITE, 0) != SQLITE_OK)\n        asm volatile(\"ud2\");\n    struct buf buf = {};\n    char* errmsg;\n    run_stmt(db, \"select tbl_name from sqlite_master where type = 'table';\", &buf);\n    char* cmd = buf.data;\n    if(buf.sz == buf.cap)\n    {\n        cmd = mmap(0, buf.cap+16384, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANON, -1, 0);\n        for(size_t i = 0; i < buf.sz; i++)\n            cmd[i] = buf.data[i];\n    }\n    run_stmt(db, cmd, 0);\n    if(buf.sz == buf.cap)\n        munmap(cmd, buf.cap+16384);\n    munmap(buf.data, buf.cap);\n}\n"
  },
  {
    "path": "ps5-kstuff/structs-freebsd.inc",
    "content": "%define iret_rdi 0\n%define iret_rsi 8\n%define iret_rdx 16\n%define iret_rcx 24\n%define iret_r8 32\n%define iret_r9 40\n%define iret_rax 48\n%define iret_rbx 56\n%define iret_rbp 64\n%define iret_r10 72\n%define iret_r11 80\n%define iret_r12 88\n%define iret_r13 96\n%define iret_r14 104\n%define iret_r15 112\n%define iret_rip 152\n%define iret_cs (iret_rip+8)\n%define iret_eflags (iret_rip+16)\n%define iret_rsp (iret_rip+24)\n%define iret_ss (iret_rip+32)\n\n%define td_proc 8\n%define td_pcb 0x3a8\n%define td_retval 0x3b8\n\n%define p_pid 0xbc\n\n%define pcb_fsbase 0x40\n%define pcb_gsbase 0x48\n%define pcb_flags 0xc8\n\n%define syscall_rsp_to_rsi 0xa0\n%define syscall_rsp_to_regs_stash 0x120\n"
  },
  {
    "path": "ps5-kstuff/structs-ps5.inc",
    "content": "%define iret_rdi 0\n%define iret_rsi 8\n%define iret_rdx 16\n%define iret_rcx 24\n%define iret_r8 32\n%define iret_r9 40\n%define iret_rax 48\n%define iret_rbx 56\n%define iret_rbp 64\n%define iret_r10 72\n%define iret_r11 80\n%define iret_r12 88\n%define iret_r13 96\n%define iret_r14 104\n%define iret_r15 112\n%define iret_rip 232\n%define iret_cs (iret_rip+8)\n%define iret_eflags (iret_rip+16)\n%define iret_rsp (iret_rip+24)\n%define iret_ss (iret_rip+32)\n\n%define td_proc 8\n%define td_pcb 0x3f8\n%define td_retval 0x408\n\n%define p_pid 0xbc\n\n%define pcb_fsbase 0x40 //+10 10.0x\n%define pcb_gsbase 0x48 //+10 10.0x\n%define pcb_idt 0xea //Not Used\n%define pcb_ldt 0xf4 //Not Used\n%define pcb_flags 0x100 //+10 10.0x\n\n%define syscall_rsp_to_rsi 0x88 //+10 10.0x\n%define syscall_rsp_to_regs_stash 0x110 //+10 10.0x\n\n%define sceSblServiceMailbox_decryptSelfBlock_rsp_to_self_context 0x118\n%define sceSblServiceMailbox_decryptSelfBlock_rsp_to_target_va 0x10\n%define sceSblServiceMailbox_decryptSelfBlock_rsp_to_rbp 0x120\n\n%define mini_syscore_header_size 0x6a0\n"
  },
  {
    "path": "ps5-kstuff/uelf/crt.asm",
    "content": "section .text\nuse64\n\nglobal yield\nglobal memcpy\nglobal memset\nglobal memmove\nglobal cr3_phys\nglobal cr3_phys_addr\nglobal trap_frame\nglobal wrmsr_args\nglobal _start\nextern main\n\nyield:\npush rbp\npush rbx\npush r12\npush r13\npush r14\npush r15\nmov [rel saved_rsp], rsp\nhlt\n\nmemcpy:\nmov rax, rdi\nmov rcx, rdx\nrep movsb\nret\n\nmemset:\nmovzx eax, sil\nmov rsi, rdi\nmov rcx, rdx\nrep stosb\nmov rax, rsi\nret\n\nmemmove:\nmov rax, rdi\nsub rax, rsi\ncmp rax, rdx\njae memcpy\ntest rax, rax\nje .mov_rax_rdi_ret\nlea rdi, [rdi+rdx-1]\nlea rsi, [rsi+rdx-1]\nmov rcx, rdx\nstd\nrep movsb\ncld\ninc rdi\n.mov_rax_rdi_ret:\nmov rax, rdi\nret\n\n; rdi = trap_frame\n; rsi = cr3 of caller\n; rdx = our cr3 (currently unused)\n; rcx = justreturn frame (has saved rax/rcx/rdx)\n; r8 = wrmsr_args\n; r9 = cr3 on return\n_start:\nmov [rel trap_frame], rdi\nmov [rel cr3_phys], rsi\nmov [rel wrmsr_args], r8\nmov [rel cr3_phys_addr], r9\nxor rsp, rsp\nxchg rsp, [rel saved_rsp]\ntest rsp, rsp\njnz .unyield\nlea rsp, [rel stack_end]\nmov rdi, rcx\nmov rsi, r8\ncall main\nhlt\n.unyield:\nmov rax, rcx\npop r15\npop r14\npop r13\npop r12\npop rbx\npop rbp\nret\n\nsection .bss\nalign 16\ntrap_frame:\nresq 1\ncr3_phys:\nresq 1\ncr3_phys_addr:\nresq 1\nwrmsr_args:\nresq 1\nstack:\nresb 16384\nalign 16\nstack_end:\nsaved_rsp:\ndq 0\n"
  },
  {
    "path": "ps5-kstuff/uelf/fakekeys.c",
    "content": "#include <stdint.h>\n#include <string.h>\n#include \"fakekeys.h\"\n#include \"shared_area.h\"\n\nint register_fake_key(const char key_data[32])\n{\n    uint64_t mask, mask1;\n    mask = __atomic_load_n(&shared_area.bitmask, __ATOMIC_ACQUIRE);\n    do\n    {\n        mask1 = (mask | (mask + 1)) & ((1ull << 63) - 1);\n        if(mask1 == mask)\n            return -1;\n    }\n    while(!__atomic_compare_exchange_n(&shared_area.bitmask, &mask, mask1, 1, __ATOMIC_RELEASE, __ATOMIC_ACQUIRE));\n    int key_idx = 63 - __builtin_clzll(mask ^ mask1);\n    memcpy(shared_area.key_data[key_idx], key_data, 32);\n    return key_idx;\n}\n\nint unregister_fake_key(int key_id)\n{\n    if(key_id < 0 || key_id >= 63)\n        return 0;\n    uint64_t mask, mask1;\n    mask = __atomic_load_n(&shared_area.bitmask, __ATOMIC_ACQUIRE);\n    do\n    {\n        if(!(mask & (1ull << key_id)))\n            return 0;\n        mask1 = mask & ~(1ull << key_id);\n    }\n    while(!__atomic_compare_exchange_n(&shared_area.bitmask, &mask, mask1, 1, __ATOMIC_RELEASE, __ATOMIC_ACQUIRE));\n    return 1;\n}\n\nint get_fake_key(int key_id, char key_data[32])\n{\n    if(key_id < 0 || key_id >= 63)\n        return 0;\n    uint64_t mask = __atomic_load_n(&shared_area.bitmask, __ATOMIC_ACQUIRE);\n    if(!(mask & (1ull << key_id)))\n        return 0;\n    memcpy(key_data, shared_area.key_data[key_id], 32);\n    return 1;\n}\n"
  },
  {
    "path": "ps5-kstuff/uelf/fakekeys.h",
    "content": "#pragma once\n\nint register_fake_key(const char key_data[32]);\nint unregister_fake_key(int key_id);\nint get_fake_key(int key_id, char key_data[32]);\n"
  },
  {
    "path": "ps5-kstuff/uelf/fpkg.c",
    "content": "#include <string.h>\n#include <errno.h>\n#include \"fpkg.h\"\n#include \"utils.h\"\n#include \"traps.h\"\n#include \"log.h\"\n#include \"pfs_crypto.h\"\n#include \"fakekeys.h\"\n\nextern char sceSblServiceMailbox[];\nextern char sceSblServiceMailbox_lr_verifySuperBlock[];\nextern char sceSblServiceMailbox_lr_sceSblPfsClearKey_1[];\nextern char sceSblServiceMailbox_lr_sceSblPfsClearKey_2[];\nextern char sceSblServiceCryptAsync_deref_singleton[];\nextern char crypt_message_resolve[];\nextern char doreti_iret[];\n\n#define IDX_TO_HANDLE(x) (0x13374100 | ((uint8_t)((x)+1)))\n#define HANDLE_TO_IDX(x) ((((x) & 0xffffff00) == 0x13374100 ? ((int)(uint8_t)(x)) : (int)0) - 1)\n\nstatic void crypto_request_emulated(uint64_t* regs, uint64_t msg, uint32_t status)\n{\n    uint64_t frame[7] = {\n        (uint64_t)doreti_iret,\n        MKTRAP(TRAP_FPKG, 1), 0, 0, 0, 0,\n        0\n    };\n    push_stack(regs, frame, sizeof(frame));\n    regs[RIP] = (uint64_t)crypt_message_resolve;\n    regs[RDI] = msg;\n    regs[RSI] = status;\n}\n\nstatic int handle_crypto_message(uint64_t* regs, uint64_t msg, uint64_t bytes_cap, uint64_t* bytes_handled)\n{\n    uint64_t msg_data[21];\n    copy_from_kernel(msg_data, msg, sizeof(msg_data));\n    if((msg_data[0] & 0x7fffffff) == 0x9132000) // SHA256HMAC with key handle\n    {\n        int idx = HANDLE_TO_IDX(msg_data[20]);\n        //log_word(0xfee10006dead0000|(uint16_t)idx);\n        if(idx < 0)\n            return ENOSYS;\n        uint8_t key[32];\n        if(!get_fake_key(idx, key))\n            return ENOSYS;\n        if(msg_data[3] != msg_data[1] * 8)\n            return ENOSYS;\n        //log_word(0xdead0006dead0007);\n        uint8_t hash[32] = {0};\n        *bytes_handled += msg_data[1];\n        if(bytes_cap < *bytes_handled && pfs_hmac_virtual(hash, key, msg_data[2], msg_data[1]))\n\t\t \n\t\t\t\t\t\t\t\t\t\t   \n            return -1;\n\t\t \n        copy_to_kernel(msg+32, hash, 32);\n        return 0;\n    }\n    else if((msg_data[0] & 0x7ffff7ff) == 0x2108000) // AES-XTS decrypt/encrypt with key handle\n    {\n        int idx = HANDLE_TO_IDX(msg_data[5]);\n        //log_word(0xfee10006dead0100|(uint16_t)idx|((msg_data[0]&0x800)<<4));\n        if(idx < 0)\n            return ENOSYS;\n        uint8_t key[32];\n        if(!get_fake_key(idx, key))\n            return ENOSYS;\n        //log_word(0xdead0006dead0007);\n        uint64_t n_sectors = (uint32_t)msg_data[1];\n        uint64_t offset = (bytes_cap - *bytes_handled) >> 12;\n        if(offset >= n_sectors)\n        {\n            *bytes_handled += n_sectors << 12;\n            return 0;\n        }\n        *bytes_handled = bytes_cap + 4096;\n        if(pfs_xts_virtual(msg_data[3] + (offset << 12), msg_data[2] + (offset << 12), key, msg_data[4] + offset, 1, (msg_data[0] & 0x800) >> 11))\n        {\n            //log_word(0xfee1fee1fee1fee1);\n            return -1;\n        }\n        else\n            return (offset == n_sectors - 1) ? 0 : EINTR;\n    }\n    //log_word(0xdead0006dead0006);\n    //log_word(msg);\n    /*for(int i = 0; i < 32; i++)\n        log_word(msg_data[i]);*/\n    //log_word(0xdead0006ffffffff);\n    return ENOSYS;\n}\n\nstatic inline uint64_t rdtsc(void)\n{\n    uint32_t a, d;\n    asm volatile(\"rdtsc\":\"=a\"(a),\"=d\"(d));\n    return (uint64_t)d << 32 | a;\n}\n\nstatic int handle_crypto_request(uint64_t* regs, uint64_t bytes_handled)\n{\n    uint64_t start_time = rdtsc();\n    int total = 0;\n    int emulated = 0;\n    int total_status = 0;\n    uint64_t new_bytes_handled = 0;\n\n    uint64_t start = (fwver >= 0x800) ? regs[RBX] : regs[R14];\n\n    for (uint64_t msg = start; msg && !total_status; msg = kpeek64(msg + 320))\n    {\n        int status = handle_crypto_message(regs, msg, bytes_handled, &new_bytes_handled);\n\n        if (status == EINTR) // partial decrypt, need to restart the syscall\n        {\n            uint64_t frame[6] = {\n                MKTRAP(TRAP_FPKG, 2), 0, 0, 0, 0,\n                new_bytes_handled,\n            };\n            push_stack(regs, frame, sizeof(frame));\n            regs[RIP] = (uint64_t)doreti_iret;\n            return 1;\n        }\n\n        total++;\n\n        if (status != ENOSYS)\n        {\n            emulated++;\n            if (status)\n                total_status = status;\n        }\n    }\n\n    if (emulated)\n    {\n        if (emulated < total)\n        {\n            // not all requests successfully emulated\n            // we can't run only part of the request, so just report failure\n            total_status = -1;\n        }\n\n        crypto_request_emulated(regs, (fwver >= 0x800) ? regs[RBX] : regs[R14], total_status);\n\n        uint64_t end_time = rdtsc();\n        /*log_word(0x1234);\n        log_word(end_time - start_time);*/\n        return 1;\n    }\n\n    return 0;\n}\n\nint try_handle_fpkg_trap(uint64_t* regs)\n{\n    if(regs[RIP] == (uint64_t)sceSblServiceCryptAsync_deref_singleton)\n    {\n        if(!handle_crypto_request(regs, 0))\n        {\n            regs[RAX] |= -1ull << 48;\n            regs[RBX] |= -1ull << 48;\n        }\n    }\n    else\n        return 0;\n    return 1;\n}\n\nint try_handle_fpkg_mailbox(uint64_t* regs, uint64_t lr)\n{\n    if(lr == (uint64_t)sceSblServiceMailbox_lr_verifySuperBlock)\n    {\n        uint64_t req[8];\n        copy_from_kernel(req, regs[RDX], 64);\n        uint64_t p_eekpfs = 0;\n        memcpy(&p_eekpfs, DMEM+req[2]+32, 8);\n        uint8_t eekpfs[256] = {0};\n        memcpy(eekpfs, DMEM+p_eekpfs, 256);\n        uint8_t crypt_seed[16];\n        memcpy(crypt_seed, DMEM+req[3]+0x370, 16);\n        uint8_t ek[32] = {}, sk[32] = {};\n        if(pfs_derive_fake_keys(eekpfs, crypt_seed, ek, sk))\n        {\n            int key1 = register_fake_key(ek);\n            if(key1 >= 0)\n            {\n                int key2 = register_fake_key(sk);\n                if(key2 >= 0)\n                {\n                    regs[RIP] = lr;\n                    regs[RAX] = 0;\n                    regs[RSP] += 8;\n                    uint32_t fake_resp[4] = {0, 0, IDX_TO_HANDLE(key1), IDX_TO_HANDLE(key2)};\n                    copy_to_kernel(regs[RDX], fake_resp, sizeof(fake_resp));\n                }\n            }\n        }\n    }\n    else if(lr == (uint64_t)sceSblServiceMailbox_lr_sceSblPfsClearKey_1\n         || lr == (uint64_t)sceSblServiceMailbox_lr_sceSblPfsClearKey_2)\n    {\n        uint32_t handle = kpeek64(regs[RDX]+8);\n\n        int key = HANDLE_TO_IDX(handle);\n        if(key >= 0 && unregister_fake_key(key))\n        {\n            copy_to_kernel(regs[RDX], (const uint64_t[16]){}, 16);\n\n            regs[RIP] = lr;\n            regs[RAX] = 0;\n            regs[RSP] += 8;\n        }\n    }\n    /*else\n    {\n        uint64_t req[2];\n        copy_from_kernel(req, regs[RDX], sizeof(req));\n        if((uint32_t)req[0] == 3)\n        {\n            log_word(0x4141414141414141);\n            log_word(req[0]);\n            log_word(req[1]);\n            int key = HANDLE_TO_IDX(req[1]);\n            log_word(key);\n            if(key >= 0 && unregister_fake_key(key))\n            {\n                log_word(0x4141414141414142);\n                log_word(lr);\n                copy_to_kernel(regs[RDX], (const uint64_t[16]){}, 128);\n                regs[RIP] = lr;\n                regs[RAX] = 0;\n                regs[RSP] += 8;\n                return 1;\n            }\n        }\n        return 0;\n    }*/\n    else\n        return 0;\n    return 1;\n}\n\nvoid handle_fpkg_trap(uint64_t* regs, uint32_t trapno)\n{\n    if(trapno == 1)\n    {\n        uint64_t frame[12];\n        pop_stack(regs, frame, sizeof(frame));\n        regs[RBX] = frame[7];\n        regs[R14] = frame[8];\n        regs[R15] = frame[9];\n        regs[RBP] = frame[10];\n        regs[RIP] = frame[11];\n        regs[RAX] = 0;\n    }\n    else if(trapno == 2)\n    {\n        uint64_t frame[6];\n        pop_stack(regs, frame, sizeof(frame));\n        regs[RIP] = (uint64_t)sceSblServiceCryptAsync_deref_singleton;\n        handle_crypto_request(regs, frame[5]);\n    }\n}\n\nstatic const uint64_t dbgregs_for_nmount[6] = {\n    (uint64_t)sceSblServiceMailbox, 0, 0, 0,\n    0, 0x401\n};\n\nvoid handle_fpkg_syscall(uint64_t* regs)\n{\n    start_syscall_with_dbgregs(regs, dbgregs_for_nmount);\n}"
  },
  {
    "path": "ps5-kstuff/uelf/fpkg.h",
    "content": "#pragma once\n#include <sys/types.h>\n#include <sys/syscall.h>\n\nvoid handle_fpkg_syscall(uint64_t* regs);\nvoid handle_fpkg_trap(uint64_t* regs, uint32_t trapno);\nint try_handle_fpkg_trap(uint64_t* regs);\nint try_handle_fpkg_mailbox(uint64_t* regs, uint64_t lr);"
  },
  {
    "path": "ps5-kstuff/uelf/fpu.c",
    "content": "#include \"utils.h\"\n\n__attribute__((aligned(64))) static char xsave_area[4096]; //is this enough?\nstatic uint32_t xsave_eax, xsave_edx;\nstatic uint64_t saved_cr0;\n\nvoid uelf_fpu_enter(void)\n{\n    saved_cr0 = read_cr0();\n    write_cr0(saved_cr0 & -9); //clear CR0.TS\n    asm volatile(\"xgetbv\":\"=d\"(xsave_edx),\"=a\"(xsave_eax):\"c\"(0));\n    asm volatile(\"xsave %0\":\"=m\"(xsave_area):\"a\"(xsave_eax),\"d\"(xsave_edx));\n    asm volatile(\"finit\");\n    uint32_t mxcsr = 0x1f80;\n    asm volatile(\"ldmxcsr %0\"::\"m\"(mxcsr));\n}\n\nvoid uelf_fpu_exit(void)\n{\n    asm volatile(\"xrstor %0\"::\"m\"(xsave_area),\"a\"(xsave_eax),\"d\"(xsave_edx));\n    write_cr0(saved_cr0);\n}\n"
  },
  {
    "path": "ps5-kstuff/uelf/fpu.h",
    "content": "#pragma once\n\nvoid uelf_fpu_enter(void);\nvoid uelf_fpu_exit(void);\n"
  },
  {
    "path": "ps5-kstuff/uelf/fself.c",
    "content": "#include <string.h>\n#include <errno.h>\n#include \"fself.h\"\n#include \"utils.h\"\n#include \"traps.h\"\n#include \"log.h\"\n#include \"syscall_fixes.h\"\n\n#ifndef FREEBSD\n\nstatic uint64_t s_auth_info_for_dynlib[17] = {0x4900000000000002, 0x0000000000000000, 0x800000000000ff00, 0x0000000000000000, 0x0000000000000000, 0x7000700080000000, 0x8000000000000000, 0x0000000000000000, 0xf0000000ffff4000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000};\nstatic uint64_t s_auth_info_for_exec[17] = {0x4400001084c2052d, 0x2000038000000000, 0x000000000000ff00, 0x0000000000000000, 0x0000000000000000, 0x4000400040000000, 0x4000000000000000, 0x0080000000000002, 0xf0000000ffff4000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000};\n\nstatic uint64_t s_auth_info_for_dynlib_ps4[17] = {0x3100000000000002, 0x0000000000000000, 0x000000000000ff00, 0x0000000000000000, 0x0000000000000000, 0x3000300040000000, 0x4000000000000000, 0x0080000000000000, 0xf0000000ffff4000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000};\nstatic uint64_t s_auth_info_for_exec_ps4[17] = {0x3100000000000001, 0x2000038000000000, 0x000000000000ff00, 0x0000000000000000, 0x0000000000000000, 0x4000400040000000, 0x4000000000000000, 0x0080000000000002, 0xf0000000ffff4000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000};\n\nstatic int copy_from_kernel_buffer(void* dst, uint64_t src, uint64_t src_end, uint64_t offset, size_t sz)\n{\n    if(src + offset < src || src + offset > src_end)\n        return EFAULT;\n    if(src + offset + sz < src + offset || src + offset + sz > src_end)\n        return EFAULT;\n    return copy_from_kernel(dst, src + offset, sz);\n}\n\nstatic int is_header_fself(uint64_t header, uint32_t size, uint16_t* e_type, int* is_ps4, uint64_t* authinfo, int* have_authinfo)\n{\n    uint64_t header_end = header + size;\n    uint16_t n_entries;\n    if(copy_from_kernel_buffer(&n_entries, header, header_end, 24, sizeof(n_entries)))\n        return 0;\n    uint64_t elf_offset = 32 + 32 * n_entries;\n    uint64_t elf[8];\n    if(copy_from_kernel_buffer(elf, header, header_end, elf_offset, sizeof(elf)))\n        return 0;\n    if(e_type)\n        *e_type = elf[2];\n    if(is_ps4)\n        *is_ps4 = (uint8_t)elf[1] < 2;\n    uint64_t e_phoff = elf[4];\n    uint16_t e_phnum = elf[7];\n    uint64_t ex_offset = elf_offset + e_phoff + 56 * e_phnum;\n    ex_offset = ((ex_offset - 1) | 15) + 1;\n    uint64_t ex[4];\n    if(copy_from_kernel_buffer(ex, header, header_end, ex_offset, sizeof(ex)))\n        return 0;\n    if(ex[1] != 1) //not fself\n        return 0;\n    if(have_authinfo)\n    {\n        *have_authinfo = 0;\n        uint64_t sig_off = ex_offset + 64 + 48 + n_entries * 80 + 80;\n        uint64_t signature[18] = {0};\n        if(!copy_from_kernel_buffer(signature, header, header_end, sig_off, sizeof(signature)) && signature[0] == 0x88)\n        {\n            memcpy(authinfo, signature+1, 0x88);\n            *have_authinfo = 1;\n        }\n    }\n    return 1;\n}\n\nextern char doreti_iret[];\nextern char sceSblAuthMgrSmIsLoadable2[];\nextern char sceSblServiceMailbox[];\nextern char sceSblServiceMailbox_lr_verifyHeader[];\nextern char sceSblServiceMailbox_lr_loadSelfSegment[];\nextern char sceSblServiceMailbox_lr_decryptSelfBlock[];\nextern char sceSblServiceMailbox_lr_decryptMultipleSelfBlocks[];\nextern char loadSelfSegment_watchpoint[];\nextern char loadSelfSegment_watchpoint_lr[];\nextern char loadSelfSegment_epilogue[];\nextern char decryptSelfBlock_watchpoint_lr[];\nextern char decryptSelfBlock_epilogue[];\nextern char decryptMultipleSelfBlocks_watchpoint_lr[];\nextern char decryptMultipleSelfBlocks_epilogue[];\nextern char mini_syscore_header[];\n\nstatic void set_dbgregs_for_watchpoint(uint64_t* regs, const uint64_t* dbgregs, size_t frame_size)\n{\n    uint64_t buf[frame_size/8 + 6];\n    pop_stack(regs, buf, frame_size);\n    read_dbgregs(buf + frame_size/8);\n    push_stack(regs, buf, sizeof(buf));\n    set_pcb_dbregs();\n    write_dbgregs(dbgregs);\n}\n\nstatic void unset_dbgregs_for_watchpoint(uint64_t* regs)\n{\n    uint64_t dbgregs[6];\n    pop_stack(regs, dbgregs, sizeof(dbgregs));\n    write_dbgregs(dbgregs);\n}\n\n#ifdef FIRMWARE_PORTING\nextern char mmap_self_fix_1_start[];\nextern char mmap_self_fix_2_start[];\nextern char mmap_self_fix_1_end[];\nextern char mmap_self_fix_2_end[];\n#endif\n\nstatic uint64_t dbgregs_for_fself[6] = {\n    (uint64_t)sceSblServiceMailbox, (uint64_t)sceSblAuthMgrSmIsLoadable2,\n#ifdef FIRMWARE_PORTING\n    (uint64_t)mmap_self_fix_1_start, (uint64_t)mmap_self_fix_2_start,\n    0, 0x455,\n#else\n    (uint64_t) aslr_fix_start, 0,\n    0, 0x415,\n#endif\n};\n\nstatic uint64_t dbgregs_for_loadSelfSegment[6] = {\n    (uint64_t)sceSblServiceMailbox, (uint64_t)loadSelfSegment_epilogue, 0, 0,\n    0, 0x405,\n};\n\nstatic uint64_t dbgregs_for_decryptSelfBlock[6] = {\n    (uint64_t)sceSblServiceMailbox, (uint64_t)decryptSelfBlock_epilogue, 0, 0,\n    0, 0x405,\n};\n\nstatic uint64_t dbgregs_for_decryptMultipleSelfBlocks[6] = {\n    (uint64_t)sceSblServiceMailbox, (uint64_t)decryptMultipleSelfBlocks_epilogue, 0, 0,\n    0, 0x405,\n};\n\nvoid handle_fself_syscall(uint64_t* regs)\n{\n    start_syscall_with_dbgregs(regs, dbgregs_for_fself);\n}\n\nvoid handle_fself_trap(uint64_t* regs, uint32_t trapno)\n{\n    if (trapno == 1)\n    {\n\t\tuint64_t self_header = kpeek64(regs[(fwver >= 0x800) ? RBX : R14] + 56);\n\n        char fself_header_backup[(48 + mini_syscore_header_size + 15) & -16];\n        pop_stack(regs, fself_header_backup, sizeof(fself_header_backup));\n\n        regs[RIP] = *(uint64_t*)(fself_header_backup + sizeof(fself_header_backup) - 8);\n\n        copy_to_kernel(self_header, fself_header_backup + 40, mini_syscore_header_size);\n    }\n}\n\n\nint try_handle_fself_mailbox(uint64_t* regs, uint64_t lr)\n{\n    if(lr == (uint64_t)sceSblServiceMailbox_lr_verifyHeader)\n    {\n\t\tuint64_t self_header = kpeek64(regs[(fwver >= 0x800) ? RBX : R14] + 56);\n\t\tuint32_t size;\n        copy_from_kernel(&size, regs[RDX]+16, 4);\n        if(is_header_fself(self_header, size, 0, 0, 0, 0))\n        {\n            char fself_header_backup[(48 + mini_syscore_header_size + 15) & -16];\n            uint64_t trap_frame[6] = {\n                (uint64_t)doreti_iret,\n                MKTRAP(TRAP_FSELF, 1), 0, 0, 0, 0,\n            };\n            memcpy(fself_header_backup, trap_frame, 48);\n            copy_from_kernel(fself_header_backup+48, self_header, mini_syscore_header_size);\n            push_stack(regs, fself_header_backup, sizeof(fself_header_backup));\n            copy_from_kernel(fself_header_backup+48, (uint64_t)mini_syscore_header, mini_syscore_header_size);\n            copy_to_kernel(self_header, fself_header_backup+48, mini_syscore_header_size);\n            size = mini_syscore_header_size;\n            copy_to_kernel(regs[RDX]+16, &size, 4);\n        }\n    }\n    else if(lr == (uint64_t)sceSblServiceMailbox_lr_loadSelfSegment)\n    {\n        uint64_t ctx[8];\n\t\tcopy_from_kernel(\n    \t\tctx,\n    \t\t(fwver >= 0x1000) ? kpeek64(regs[RBP] - 232) :\n    \t\t(fwver >= 0x900) ? regs[R14] :\n    \t\t(fwver >= 0x800 && fwver <= 0x860) ? kpeek64(regs[RBP] - 240) :\n    \t\tregs[RBX],\n    \t\tsizeof(ctx)\n\t\t);\n\n        if(is_header_fself(ctx[7], (uint32_t)ctx[1], 0, 0, 0, 0))\n        {\n            pop_stack(regs, &regs[RIP], 8);\n            regs[RAX] = 0;\n        }\n    }\n    else if(lr == (uint64_t)sceSblServiceMailbox_lr_decryptSelfBlock)\n    {\n        uint64_t ctx[8];\n\t\tcopy_from_kernel(\n    \t\tctx,\n    \t\t(fwver >= 0x800) ? regs[R12] :\n    \t\t(fwver >= 0x500 && fwver <= 0x761) ? kpeek64(regs[RBP] - 192) :\n    \t\tkpeek64(regs[RBP] - sceSblServiceMailbox_decryptSelfBlock_rsp_to_rbp +\n                     \t\tsceSblServiceMailbox_decryptSelfBlock_rsp_to_self_context),\n    \t\tsizeof(ctx)\n\t\t);\n\n        if(is_header_fself(ctx[7], (uint32_t)ctx[1], 0, 0, 0, 0))\n        {\n            uint64_t request[8];\n            copy_from_kernel(request, regs[RDX], sizeof(request));\n            memcpy(DMEM+request[1], DMEM+request[2], (uint32_t)request[6]);\n            pop_stack(regs, &regs[RIP], 8);\n            regs[RAX] = 0;\n        }\n    }\n    else if(lr == (uint64_t)sceSblServiceMailbox_lr_decryptMultipleSelfBlocks)\n    {\n        uint64_t ctx[8];\n\t\tcopy_from_kernel(\n    \t\tctx,\n    \t\t(fwver >= 0x600) ? kpeek64(regs[RBP] - 208) :\n    \t\t(fwver >= 0x500 && fwver <= 0x550) ? kpeek64(regs[RBP] - 216) :\n    \t\tregs[R13],\n    \t\tsizeof(ctx)\n\t\t);\n        \n        if(is_header_fself(ctx[7], (uint32_t)ctx[1], 0, 0, 0, 0))\n        {\n            uint64_t request[8];\n            copy_from_kernel(request, regs[RDX], sizeof(request));\n            uint64_t* src = (uint64_t*)(DMEM + request[1]);\n            uint64_t* dst = (uint64_t*)(DMEM + request[2]);\n            uint32_t count = request[5];\n            for(uint32_t i = 0; i < count; i++)\n                memcpy(DMEM+dst[i], DMEM+src[i], 16384);\n            pop_stack(regs, &regs[RIP], 8);\n            regs[RAX] = 0;\n        }\n    }\n    else\n        return 0;\n\n    return 1;\n}\n\nint try_handle_fself_trap(uint64_t* regs)\n{\n    if(regs[RIP] == (uint64_t)sceSblAuthMgrSmIsLoadable2)\n    {\n        uint64_t ctx[8];\n        copy_from_kernel(ctx, regs[RDI], sizeof(ctx));\n        uint16_t e_type;\n        int have_authinfo;\n        uint64_t authinfo[17];\n        int is_ps4;\n        if(is_header_fself(ctx[7], (uint32_t)ctx[1], &e_type, &is_ps4, authinfo, &have_authinfo))\n        {\n            uint64_t* p_authinfo;\n            if(have_authinfo)\n                p_authinfo = authinfo;\n            else if(is_ps4)\n            {\n                if(e_type == 0xfe18)\n                    p_authinfo = s_auth_info_for_dynlib_ps4;\n                else\n                    p_authinfo = s_auth_info_for_exec_ps4;\n            }\n            else\n            {\n                if(e_type == 0xfe18)\n                    p_authinfo = s_auth_info_for_dynlib;\n                else\n                    p_authinfo = s_auth_info_for_exec;\n            }\n            copy_to_kernel(regs[R8], p_authinfo, 0x88);\n            pop_stack(regs, &regs[RIP], 8);\n            regs[RAX] = 0;\n            copy_to_kernel(regs[RDI] + 62, &(const uint16_t[1]){0xdeb7}, 2);  \n        }\n    }\n    else if(regs[RIP] == (uint64_t)loadSelfSegment_watchpoint)\n    {\n        regs[(fwver >= 0x800) ? RAX : R10] |= 0xffffull << 48;\n\t\t\n        uint64_t frame[4];\n        copy_from_kernel(frame, regs[RSP], sizeof(frame));\n        if(frame[3] == (uint64_t)loadSelfSegment_watchpoint_lr)\n            set_dbgregs_for_watchpoint(regs, dbgregs_for_loadSelfSegment, sizeof(frame));\n        else if(frame[3] == (uint64_t)decryptSelfBlock_watchpoint_lr)\n            set_dbgregs_for_watchpoint(regs, dbgregs_for_decryptSelfBlock, sizeof(frame));\n        else if(frame[3] == (uint64_t)decryptMultipleSelfBlocks_watchpoint_lr)\n            set_dbgregs_for_watchpoint(regs, dbgregs_for_decryptMultipleSelfBlocks, sizeof(frame));\n    }\n    else if(regs[RIP] == (uint64_t)loadSelfSegment_epilogue\n         || regs[RIP] == (uint64_t)decryptSelfBlock_epilogue\n         || regs[RIP] == (uint64_t)decryptMultipleSelfBlocks_epilogue)\n         unset_dbgregs_for_watchpoint(regs);\n#ifdef FIRMWARE_PORTING\n    else if(regs[RIP] == (uint64_t)mmap_self_fix_1_start)\n        regs[RIP] = (uint64_t)mmap_self_fix_1_end;\n    else if(regs[RIP] == (uint64_t)mmap_self_fix_2_start)\n        regs[RIP] = (uint64_t)mmap_self_fix_2_end;\n#endif\n    else\n        return 0;\n    return 1;\n}\n\n#endif"
  },
  {
    "path": "ps5-kstuff/uelf/fself.h",
    "content": "#pragma once\n#include <sys/types.h>\n#include <sys/syscall.h>\n\n#define SYS_execve 59\n#define SYS_dynlib_load_prx 594\n#define SYS_get_self_auth_info 607\n#define SYS_get_sdk_compiled_version 647\n#define SYS_get_ppr_sdk_compiled_version 713\n\nvoid handle_fself_syscall(uint64_t* regs);\nvoid handle_fself_trap(uint64_t* regs, uint32_t trapno);\nint try_handle_fself_trap(uint64_t* regs);\nint try_handle_fself_mailbox(uint64_t* regs, uint64_t lr);"
  },
  {
    "path": "ps5-kstuff/uelf/kekcall.c",
    "content": "#include <errno.h>\n#include <sys/sysent.h>\n#include <sys/syscall.h>\n#include <machine/sysarch.h>\n#include <string.h>\n#include \"kekcall.h\"\n#include \"traps.h\"\n#include \"utils.h\"\n#include \"uexec.h\"\n\nextern char syscall_after[];\nextern char doreti_iret[];\nextern char nop_ret[];\nextern char copyout[];\nextern char copyin[];\nextern struct sysent sysents[];\n\nint handle_kekcall(uint64_t* regs, uint64_t* args, uint32_t nr)\n{\n    if(nr == 1)\n    {\n        uint64_t stack_frame[12] = {\n            (uint64_t)doreti_iret,\n            (uint64_t)nop_ret, regs[CS], regs[EFLAGS], regs[RSP], regs[SS],\n        };\n        read_dbgregs(stack_frame+6);\n        if(!get_pcb_dbregs())\n        {\n            stack_frame[6] = stack_frame[7] = stack_frame[8] = stack_frame[9] = 0;\n            stack_frame[10] &= -16;\n        }\n        push_stack(regs, stack_frame, sizeof(stack_frame));\n        kpoke64(regs[RDI]+td_retval, 0);\n        regs[RDI] = regs[RSP] + 48;\n        regs[RSI] = args[RDI];\n        regs[RDX] = 48;\n        regs[RIP] = (uint64_t)copyout;\n    }\n    else if(nr == 2)\n    {\n        uint64_t stack_frame[14] = {(uint64_t)doreti_iret, MKTRAP(TRAP_KEKCALL, 1), [12] = regs[RDI]};\n        push_stack(regs, stack_frame, sizeof(stack_frame));\n        regs[RDI] = args[RDI];\n        regs[RSI] = regs[RSP] + 48;\n        regs[RDX] = 48;\n        regs[RIP] = (uint64_t)copyin;\n    }\n    else if(nr == 3)\n    {\n        return rdmsr(args[RDI], &args[RAX]) ? 0 : EFAULT;\n    }\n    //nr 4 reserved for wrmsr\n    else if(nr == 5) //remote syscall\n    {\n        uint64_t stack_frame[16] = {(uint64_t)doreti_iret, MKTRAP(TRAP_KEKCALL, 2)};\n        stack_frame[6] = args[RDI];\n        stack_frame[7] = args[RSI];\n        stack_frame[14] = regs[RDI];\n        push_stack(regs, stack_frame, sizeof(stack_frame));\n        regs[RDI] = args[RDX];\n        regs[RSI] = regs[RSP] + 64;\n        regs[RDX] = 48;\n        regs[RIP] = (uint64_t)copyin;\n    }\n    else if(nr == 11)\n        return handle_uexec(regs, args);\n    else if(nr == 0xffffffff)\n    {\n        args[RAX] = 0;\n        return 0;\n    }\n    return ENOSYS;\n}\n\nvoid handle_kekcall_trap(uint64_t* regs, uint32_t trap)\n{\n    if(trap == 1)\n    {\n        uint64_t stack_frame[14];\n        pop_stack(regs, stack_frame, sizeof(stack_frame));\n        regs[RIP] = stack_frame[13];\n        if((uint32_t)regs[RAX])\n            return;\n        kpoke64(stack_frame[11]+td_retval, 0);\n        set_pcb_dbregs();\n        write_dbgregs(stack_frame+5);\n    }\n    else if(trap == 2)\n    {\n        uint64_t stack_frame[15];\n        pop_stack(regs, stack_frame, sizeof(stack_frame));\n        if((uint32_t)regs[RAX])\n        {\n            pop_stack(regs, &regs[RIP], 8);\n            return;\n        }\n        uint32_t pid = stack_frame[5];\n        uint32_t sysc_no = stack_frame[6];\n        int64_t proc = kpeek64(stack_frame[13]+td_proc);\n        while(proc < -0x100000000)\n            proc = kpeek64(proc+8);\n        while(proc && (uint32_t)kpeek64(proc+p_pid) != pid)\n            proc = kpeek64(proc);\n        if(!proc)\n        {\n            regs[RAX] = ESRCH;\n            pop_stack(regs, &regs[RIP], 8);\n            return;\n        }\n        regs[RDI] = kpeek64(proc+16);\n        uint64_t stack_frame_2[14] = {(uint64_t)doreti_iret, MKTRAP(TRAP_KEKCALL, 3), [6] = stack_frame[13], regs[RDI]};\n        memcpy(stack_frame_2+8, stack_frame+7, 48);\n        if(sysc_no == SYS_sysarch && (uint32_t)stack_frame[7] == AMD64_GET_FSBASE)\n        {\n            stack_frame_2[1] = MKTRAP(TRAP_KEKCALL, 4);\n            stack_frame_2[8] = kpeek64(kpeek64(regs[RDI]+td_pcb)+pcb_fsbase+(fwver >= 0x1000 ? 0x10 : 0));\n            kpoke64(stack_frame[13]+td_retval, 0);\n        }\n        else\n            kpoke64(regs[RDI]+td_retval, 0);\n        push_stack(regs, stack_frame_2, sizeof(stack_frame_2));\n        regs[RAX] = (uint64_t)&sysents[sysc_no];\n        if(sysc_no == SYS_sysarch && (uint32_t)stack_frame[7] == AMD64_GET_FSBASE)\n        {\n            regs[RIP] = (uint64_t)copyout;\n            regs[RDI] = regs[RSP] + 64;\n            regs[RSI] = stack_frame[8];\n            regs[RDX] = 8;\n        }\n        else\n        {\n            regs[RIP] = kpeek64((uint64_t)&sysents[sysc_no].sy_call);\n            regs[RSI] = regs[RSP] + 64;\n            handle_syscall(regs, 0);\n        }\n    }\n    else if(trap == 3 || trap == 4)\n    {\n        uint64_t stack_frame[14];\n        pop_stack(regs, stack_frame, sizeof(stack_frame));\n        if(trap == 3 && !(uint32_t)regs[RAX])\n            kpoke64(stack_frame[5]+td_retval, kpeek64(stack_frame[6]+td_retval));\n        regs[RIP] = stack_frame[13];\n    }\n}\n"
  },
  {
    "path": "ps5-kstuff/uelf/kekcall.h",
    "content": "#pragma once\n#include <sys/types.h>\n\nint handle_kekcall(uint64_t* regs, uint64_t* args, uint32_t nr);\nvoid handle_kekcall_trap(uint64_t* regs, uint32_t trap);\n"
  },
  {
    "path": "ps5-kstuff/uelf/log.c",
    "content": "#include \"log.h\"\n\nuint64_t log[512];\nuint64_t* p_log = log;\n\nvoid log_word(uint64_t word)\n{\n    if(p_log != log + sizeof(log) / sizeof(*log))\n        *p_log++ = word;\n}\n"
  },
  {
    "path": "ps5-kstuff/uelf/log.h",
    "content": "#pragma once\n#include <sys/types.h>\n\nvoid log_word(uint64_t word);\n"
  },
  {
    "path": "ps5-kstuff/uelf/mailbox.c",
    "content": "#include <sys/types.h>\n#include \"mailbox.h\"\n#include \"utils.h\"\n#include \"fself.h\"\n#include \"fpkg.h\"\n#include \"npdrm.h\"\n\nextern char sceSblServiceMailbox[];\n\nint try_handle_mailbox_trap(uint64_t* regs)\n{\n    if(regs[RIP] == (uint64_t)sceSblServiceMailbox)\n    {\n        uint64_t lr = kpeek64(regs[RSP]);\n        if(try_handle_fself_mailbox(regs, lr)\n        || try_handle_fpkg_mailbox(regs, lr)\n        || try_handle_npdrm_mailbox(regs, lr))\n            return 1;\n    }\n    else\n        return 0;\n    return 1;\n}"
  },
  {
    "path": "ps5-kstuff/uelf/mailbox.h",
    "content": "#pragma once\n\nint try_handle_mailbox_trap(uint64_t* regs);\n"
  },
  {
    "path": "ps5-kstuff/uelf/main.c",
    "content": "#include <stdint.h>\n#include <string.h>\n#include <stddef.h>\n#include <stdarg.h>\n#include <errno.h>\n#include <sys/sysent.h>\n#include <sys/syscall.h>\n#include \"utils.h\"\n#include \"parasites.h\"\n#include \"log.h\"\n#include \"traps.h\"\n#include \"kekcall.h\"\n#include \"mailbox.h\"\n#include \"fself.h\"\n#include \"fpkg.h\"\n#include \"uexec.h\"\n#include \"syscall_fixes.h\"\n#include \"shared_area.h\"\n#include \"uexec.h\"\n#include \"npdrm.h\"\n\nint have_error_code;\n\nextern char syscall_before[];\nextern char syscall_after[];\nextern struct sysent sysents[];\nextern struct sysent sysents_ps4[];\nextern char doreti_iret[];\nextern char ist4[];\nextern char tss[];\nextern char int1_handler[];\nextern char int13_handler[];\nextern uint64_t wrmsr_args;\n\nvoid handle_syscall(uint64_t* regs, int allow_kekcall)\n{\n#define IS_PPR(which) (regs[RAX] == (uint64_t)&sysents[SYS_##which])\n#ifdef FREEBSD\n#define IS_PS4(which) 0\n#else\n#define IS_PS4(which) (regs[RAX] == (uint64_t)&sysents_ps4[SYS_##which])\n#endif\n#define IS(which) (IS_PPR(which) || IS_PS4(which))\n    if(IS_PPR(getppid) && allow_kekcall)\n    {\n        uint64_t args[NREGS] = {0};\n        copy_from_kernel(args, regs[RSP]+syscall_rsp_to_regs_stash+(fwver >= 0x1000 ? 0x10 : 0)+8, sizeof(args));\n        int err = handle_kekcall(regs, args, args[RAX]>>32);\n        if(err != ENOSYS)\n        {\n            if(!err)\n                kpoke64(regs[RDI]+td_retval, args[RAX]);\n            regs[RAX] = err;\n            pop_stack(regs, &regs[RIP], 8);\n        }\n    }\n#ifndef FREEBSD\n    else if(IS(execve)\n         || IS(dynlib_load_prx)\n         || IS(get_self_auth_info)\n         || IS(get_sdk_compiled_version)\n         || IS_PPR(get_ppr_sdk_compiled_version)\n#ifdef FIRMWARE_PORTING\n         || IS_PPR(mmap)\n         || IS_PPR(mlock)\n#endif\n    )\n        handle_fself_syscall(regs);\n    else if(IS(nmount)\n         || IS(unmount))\n        handle_fpkg_syscall(regs);\n    else if(IS(ioctl)\n         || IS_PPR(ioctl))\n        handle_ioctl_syscall(regs);\n    else if(IS(mprotect)\n         || IS_PPR(mdbg_call))\n        handle_syscall_fix(regs);\n#endif\n#undef IS\n#undef IS_PS4\n#undef IS_PPR\n}\n\nvoid handle(uint64_t* regs)\n{\n    if(__atomic_load_n(&shared_area.uexec_counter, __ATOMIC_ACQUIRE))\n    {\n        uexec_ipi(regs);\n        return;\n    }\n    if(!(regs[CS] & 3))\n        regs[EFLAGS] |= 0x10000; //RF\n    if((regs[CS] & 3) || (regs[EFLAGS] & 0x40000)) //from userspace, or from copyin/copyout\n    {\nfrom_userspace:\n        if((regs[CS] & 3)) //from userspace\n        {\n            //determine correct gsbase for userspace\n            uint64_t gsbase = kpeek64(kpeek64(kpeek64((uint64_t)pcpu)+td_pcb)+pcb_gsbase+(fwver >= 0x1000 ? 0x10 : 0));\n            //arm wrmsr in the exit path\n            uint64_t args[3] = {gsbase >> 32, 0xc0000101, (uint32_t)gsbase};\n            copy_to_kernel(wrmsr_args, args, sizeof(args));\n        }\n        //inject a fake #DB or #GP exception\n        uint64_t stack;\n#ifndef FREEBSD\n        if(!have_error_code)\n            stack = (uint64_t)ist4;\n        else\n#endif\n        {\n            if((regs[CS] & 3))\n                copy_from_kernel(&stack, (uint64_t)tss+4, 8);\n            else\n                stack = regs[RSP];\n        }\n        stack &= -16;\n        if(have_error_code)\n        {\n            stack -= 48;\n            copy_to_kernel(stack, &regs[ERRC], 48);\n            regs[RIP] = (uint64_t)int13_handler;\n        }\n        else\n        {\n            stack -= 40;\n            copy_to_kernel(stack, &regs[RIP], 40);\n            regs[RIP] = (uint64_t)int1_handler;\n        }\n        regs[CS] = 0x20;\n        regs[EFLAGS] = 2;\n        regs[RSP] = stack;\n        regs[SS] = 0;\n    }\n    else if(handle_syscall_parasites(regs))\n        return;\n    else if(regs[RIP] == (uint64_t)syscall_before)\n    {\n        regs[RAX] |= 0xffffull << 48;\n        regs[RSI] = regs[RSP] + syscall_rsp_to_rsi+(fwver >= 0x1000 ? 0x10 : 0);\n        push_stack(regs, (const uint64_t[1]){(uint64_t)syscall_after}, 8);\n        regs[RIP] = kpeek64(regs[RAX]+8);\n        handle_syscall(regs, 1);\n    }\n    else if(regs[RIP] == (uint64_t)doreti_iret)\n    {\n        uint64_t frame[5];\n        copy_from_kernel(frame, regs[RSP], sizeof(frame));\n        if((frame[1] & 3)) //#GP in iret to userspace\n        {\n            //pretend that the #GP was inside userspace\n            //stock kernel crashes on this, lol\n            memcpy(&regs[RIP], frame, sizeof(frame));\n            goto from_userspace;\n        }\n        uint64_t lr = frame[0];\n        switch(TRAP_KIND(lr))\n        {\n        case TRAP_UTILS: handle_utils_trap(regs, TRAP_IDX(lr)); break;\n        case TRAP_KEKCALL: handle_kekcall_trap(regs, TRAP_IDX(lr)); break;\n#ifndef FREEBSD\n        case TRAP_FSELF: handle_fself_trap(regs, TRAP_IDX(lr)); break;\n        case TRAP_FPKG: handle_fpkg_trap(regs, TRAP_IDX(lr)); break;\n#endif\n        case TRAP_UEXEC: handle_uexec_trap(regs, TRAP_IDX(lr)); break;\n        }\n    }\n#ifndef FREEBSD\n    else if(try_handle_mailbox_trap(regs))\n        return;\n    else if(try_handle_fself_trap(regs))\n        return;\n    else if(handle_fself_parasites(regs))\n        return;\n    else if(handle_unsorted_parasites(regs))\n        return;\n    else if(try_handle_fpkg_trap(regs))\n        return;\n    else if(try_handle_syscall_fix_trap(regs))\n        return;\n#endif\n    else if(try_handle_uexec_trap(regs))\n        return;\n    else\n    {\n        int decrypted = 0;\n#define DECRYPT(which, idx) if((regs[which] >> 48) == 0xdeb7) { log_word(regs[RIP]); log_word(idx); regs[which] |= 0xffffull << 48; decrypted = 1; }\n        DECRYPT(RAX, 0)\n        DECRYPT(RCX, 1)\n        DECRYPT(RDX, 2)\n        DECRYPT(RBX, 3)\n        //DECRYPT(RSP, 4)\n        DECRYPT(RBP, 5)\n        DECRYPT(RSI, 6)\n        DECRYPT(RDI, 7)\n        DECRYPT(R8, 8)\n        DECRYPT(R9, 9)\n        DECRYPT(R10, 10)\n        DECRYPT(R11, 11)\n        DECRYPT(R12, 12)\n        DECRYPT(R13, 13)\n        DECRYPT(R14, 14)\n        DECRYPT(R15, 15)\n#undef DECRYPT\n        if(!decrypted)\n        {\n            //probably a debug trap that's not yet handled\n            log_word(regs[RIP]);\n            log_word(16);\n        }\n    }\n}\n\nvoid main(uint64_t just_return)\n{\n    uint64_t regs[NREGS];\n    copy_from_kernel(regs, trap_frame, sizeof(regs));\n    uint64_t jr_frame[5];\n    copy_from_kernel(jr_frame, just_return, 40);\n    have_error_code = jr_frame[0];\n    regs[RDX] = jr_frame[2];\n    regs[RCX] = jr_frame[3];\n    regs[RAX] = jr_frame[4];\n    handle(regs);\n    copy_to_kernel(trap_frame, regs, sizeof(regs));\n}"
  },
  {
    "path": "ps5-kstuff/uelf/npdrm.c",
    "content": "// https://github.com/PS5Dev/Byepervisor/blob/57204cbd7bd26ed4623634d52b0f60f40d630087/hen/src/fpkg.cpp#L82\n\n#include <string.h>\n#include \"utils.h\"\n#include \"npdrm.h\"\n#include \"log.h\"\n#include \"fpu.h\"\n\n#include \"../libtomcrypt/src/headers/tomcrypt.h\"\n\n// #define NPDRM_PORTING 1\n\n#ifndef NPDRM_PORTING\nextern char sceSblServiceMailbox_lr_npdrm_cmd_5[];\nextern char sceSblServiceMailbox_lr_npdrm_cmd_6[];\n#endif\nextern char sceSblServiceMailbox[];\n\nstatic const uint8_t rif_debug_key[] = {0x96, 0xC2, 0x26, 0x8D, 0x69, 0x26, 0x1C, 0x8B, 0x1E, 0x3B, 0x6B, 0xFF, 0x2F, 0xE0, 0x4E, 0x12};\n\nint aes_cbc_128_decrypt(uint8_t *out, const uint8_t *in, int size, const uint8_t *key, const uint8_t *iv)\n{\n    int err = -1;\n    static int aes_cipher = -1;\n    uelf_fpu_enter();\n    if (aes_cipher < 0)\n    {\n        if ((aes_cipher = register_cipher(&aes_desc)) < 0) goto exit;\n    }\n\n    symmetric_CBC cbc;\n    if ((err = cbc_start(aes_cipher, iv, key, 16, 0, &cbc)) != CRYPT_OK) goto exit;\n    if ((err = cbc_decrypt(in, out, size, &cbc)) != CRYPT_OK) goto exit;\n    if ((err = cbc_done(&cbc)) != CRYPT_OK) goto exit;\nexit:\n    uelf_fpu_exit();\n    return err;\n}\n\nint sha256_buffer(const unsigned char *in, unsigned long inlen, unsigned char *out)\n{\n    hash_state md;\n    int err = -1;\n\n    uelf_fpu_enter();\n    if ((err = sha256_init(&md)) != CRYPT_OK) goto exit;\n    if ((err = sha256_process(&md, in, inlen)) != CRYPT_OK) goto exit;\n    if ((err = sha256_done(&md, out)) != CRYPT_OK) goto exit;\nexit:\n    uelf_fpu_exit();\n    return err;\n}\n\nint memcmp(const void *s1, const void *s2, size_t n)\n{\n    const unsigned char *p1 = (const unsigned char *)s1;\n    const unsigned char *p2 = (const unsigned char *)s2;\n    for (size_t i = 0; i < n; i++)\n    {\n        if (p1[i] != p2[i])\n        {\n            return (int)p1[i] - (int)p2[i];\n        }\n    }\n    return 0;\n}\n\nint try_handle_npdrm_mailbox(uint64_t *regs, uint64_t lr)\n{\n#ifndef NPDRM_PORTING\n    if (lr != (uint64_t)sceSblServiceMailbox_lr_npdrm_cmd_5 &&\n        lr != (uint64_t)sceSblServiceMailbox_lr_npdrm_cmd_6)\n    {\n        return 0;\n    }\n#else\n    uint32_t cmd;\n    if (copy_from_kernel(&cmd, regs[RDX], sizeof(cmd)))\n    {\n        return 0;\n    }\n    // Other functions may use this same cmd number for different purposes (depending on RDI/handle i believe, however its value changes between fws)\n    // for example, sceSblServiceMailbox_lr_decryptSelfBlock also sees cmd 6\n    // if we only relied on this, it would work safely because of the later checks, its just wasteful\n    if (cmd != 5 && cmd != 6)\n    {\n        return 0;\n    }\n#endif\n\n    uint64_t rif_pa = kpeek64(regs[RDX] + 0x8);\n\n    struct RifCmd56MemoryLayout layout;\n    memcpy(&layout, DMEM + rif_pa, sizeof(layout));\n\n    if (layout.rif.type != 0x2)\n    {\n#ifdef NPDRM_PORTING\n        return 0;\n#else\n        return 1;\n#endif\n    }\n\n    uint8_t contentid_hash[32];\n    if (sha256_buffer(layout.rif.contentId, sizeof(layout.rif.contentId), contentid_hash))\n    {\n#ifdef NPDRM_PORTING\n        return 0;\n#else\n        return 1;\n#endif\n    }\n\n    if (memcmp(contentid_hash, layout.rif.rifIv, 16) != 0)\n    {\n#ifdef NPDRM_PORTING\n        return 0;\n#else\n        // not a debug rif\n        return 1;\n#endif\n    }\n\n#ifdef NPDRM_PORTING\n    // Now that we know the input data is a (debug) rif, we know we are at the right place\n    log_word(0x10C7100000000001UL + (cmd << 16));\n    log_word(lr);\n#endif\n\n    layout.output.version = __builtin_bswap16(layout.rif.version);\n    layout.output.unk04 = __builtin_bswap16(layout.rif.unk06);\n    layout.output.psnid = __builtin_bswap64(layout.rif.psnid);\n    layout.output.startTimestamp = __builtin_bswap64(layout.rif.startTimestamp);\n    layout.output.endTimestamp = __builtin_bswap64(layout.rif.endTimestamp);\n    layout.output.extraFlags = __builtin_bswap64(layout.rif.extraFlags);\n    layout.output.type = __builtin_bswap16(layout.rif.type);\n    layout.output.contentType = __builtin_bswap16(layout.rif.contentType);\n    layout.output.skuFlag = __builtin_bswap16(layout.rif.skuFlag);\n    layout.output.unk34 = __builtin_bswap32(layout.rif.unk60);\n    layout.output.unk38 = __builtin_bswap32(layout.rif.unk64);\n    layout.output.unk3C = 0;\n    layout.output.unk40 = 0;\n    layout.output.unk44 = 0;\n    memcpy(layout.output.contentId, layout.rif.contentId, 0x30);\n    memcpy(layout.output.rifIv, layout.rif.rifIv, 0x10);\n    layout.output.unk88 = __builtin_bswap32(layout.rif.unk70);\n    layout.output.unk8C = __builtin_bswap32(layout.rif.unk74);\n    layout.output.unk90 = __builtin_bswap32(layout.rif.unk78);\n    layout.output.unk94 = __builtin_bswap32(layout.rif.unk7C);\n    memcpy(layout.output.unk98, layout.rif.unk80, 0x10);\n    if (layout.output.skuFlag == 2)\n    {\n        layout.output.skuFlag = 1;\n    }\n\n#ifdef NPDRM_PORTING\n    if (cmd == 6)\n#else\n    if (lr == (uint64_t)sceSblServiceMailbox_lr_npdrm_cmd_6)\n#endif\n    {\n        uint8_t decrypted_secret[sizeof(layout.rif.rifSecret)];\n        if (aes_cbc_128_decrypt(decrypted_secret, layout.rif.rifSecret, sizeof(layout.rif.rifSecret), rif_debug_key, layout.rif.rifIv))\n        {\n            return 1;\n        }\n\n        if (memcmp(contentid_hash + 16, decrypted_secret, 16) != 0)\n        {\n            // does not use debug rif key/failed to decrypt?\n            return 1;\n        }\n\n        // copy both unk10 and unk20\n        copy_to_kernel(regs[RDX] + __builtin_offsetof(struct NpDrmCmd6, unk10), &decrypted_secret[0x70], 0x20);\n    }\n\n    memcpy(DMEM + rif_pa + __builtin_offsetof(struct RifCmd56MemoryLayout, output), &layout.output, sizeof(layout.output));\n\n    uint32_t res = 0;\n    copy_to_kernel(regs[RDX] + 0x4, &res, sizeof(res));\n\n    regs[RIP] = lr;\n    regs[RAX] = 0;\n    regs[RSP] += 8;\n    return 1;\n}\n\nstatic const uint64_t dbgregs_for_ioctl[6] = {\n    (uint64_t)sceSblServiceMailbox, 0, 0, 0,\n    0, 0x401};\n\nvoid handle_ioctl_syscall(uint64_t *regs)\n{\n    start_syscall_with_dbgregs(regs, dbgregs_for_ioctl);\n}"
  },
  {
    "path": "ps5-kstuff/uelf/npdrm.h",
    "content": "// https://github.com/PS5Dev/Byepervisor/blob/main/hen/include/fpkg.h\n\n#pragma once\n#include <stdint.h>\n\nstruct NpDrmCmd5\n{\n    uint32_t cmd;\n    uint32_t res;\n    uint64_t rif_pa;\n    uint32_t unk10;\n};\n\nstruct NpDrmCmd6\n{\n    uint32_t cmd;\n    uint32_t res;\n    uint64_t rif_pa;\n    uint8_t unk10[0x10];\n    uint8_t unk20[0x10];\n    uint32_t unk30; // 0 or 1\n};\n\nstruct Rif\n{\n    uint32_t magic;\n    uint16_t version;\n    uint16_t unk06;\n    uint64_t psnid;\n    uint64_t startTimestamp;\n    uint64_t endTimestamp;\n    uint8_t contentId[0x30];\n    uint16_t type;\n    uint16_t drmType;\n    uint16_t contentType;\n    uint16_t skuFlag;\n    uint64_t extraFlags;\n    uint32_t unk60;\n    uint32_t unk64;\n    uint32_t unk68;\n    uint32_t unk6C;\n    uint32_t unk70;\n    uint32_t unk74;\n    uint32_t unk78;\n    uint32_t unk7C;\n    uint8_t unk80[0x10];\n    uint8_t unk90[0x1B0];\n    uint8_t discKey[0x20];\n    uint8_t rifIv[0x10];\n    uint8_t rifSecret[0x90];\n    uint8_t rifSignature[0x100];\n};\n\nstruct RifOutput\n{\n    /* 0x00 */ uint32_t version;\n    /* 0x04 */ uint32_t unk04;\n    /* 0x08 */ uint64_t psnid;\n    /* 0x10 */ uint64_t startTimestamp;\n    /* 0x18 */ uint64_t endTimestamp;\n    /* 0x20 */ uint64_t extraFlags;\n    /* 0x28 */ uint32_t type;\n    /* 0x2C */ uint32_t contentType;\n    /* 0x30 */ uint32_t skuFlag;\n    /* 0x34 */ uint32_t unk34;\n    /* 0x38 */ uint32_t unk38;\n    /* 0x3C */ uint32_t unk3C; // not set\n    /* 0x40 */ uint32_t unk40; // not set\n    /* 0x44 */ uint32_t unk44; // not set\n    /* 0x48 */ uint8_t contentId[0x30];\n    /* 0x78 */ uint8_t rifIv[0x10];\n    /* 0x88 */ uint32_t unk88;\n    /* 0x8C */ uint32_t unk8C;\n    /* 0x90 */ uint32_t unk90;\n    /* 0x94 */ uint32_t unk94;\n    /* 0x98 */ uint8_t unk98[0x10];\n};\n\nstruct RifCmd56MemoryLayout\n{\n    struct Rif rif;\n    struct RifOutput output;\n};\n\nint try_handle_npdrm_mailbox(uint64_t *regs, uint64_t lr);\nvoid handle_ioctl_syscall(uint64_t *regs);"
  },
  {
    "path": "ps5-kstuff/uelf/parasite_desc.h",
    "content": "#include <sys/types.h>\n\n#define PARASITES(n) {\\\n    int lim_syscall;\\\n    int lim_fself;\\\n    int lim_total;\\\n    struct\\\n    {\\\n        uint64_t address;\\\n        int reg;\\\n    } parasites[n];\\\n}\n\nstruct parasite_desc PARASITES();\n"
  },
  {
    "path": "ps5-kstuff/uelf/parasites.h",
    "content": "#include \"parasite_desc.h\"\n#include \"log.h\"\n\n//extern char kdata_base[];\n\nextern struct parasite_desc parasites;\n\nstatic inline int handle_parasites(uint64_t* regs, int a, int b)\n{\n    for(int i = a; i < b; i++)\n        if(parasites.parasites[i].address == regs[RIP])\n        {\n            for(int j = i; j < b && parasites.parasites[j].address == regs[RIP]; j++)\n                regs[parasites.parasites[j].reg] |= -1ull << 48;\n            return 1;\n        }\n    return 0;\n}\n\nstatic int handle_syscall_parasites(uint64_t* regs)\n{\n    return handle_parasites(regs, 0, parasites.lim_syscall);\n}\n\nstatic int handle_fself_parasites(uint64_t* regs)\n{\n    return handle_parasites(regs, parasites.lim_syscall, parasites.lim_fself);\n}\n\nstatic int handle_unsorted_parasites(uint64_t* regs)\n{\n    return handle_parasites(regs, parasites.lim_fself, parasites.lim_total);\n}"
  },
  {
    "path": "ps5-kstuff/uelf/pfs_crypto.c",
    "content": "#ifndef FREEBSD\n#include <stdint.h>\n#include <stddef.h>\n#include \"pfs_crypto.h\"\n#include \"utils.h\"\n#include \"fpu.h\"\n\n#include \"../BearSSL/inc/bearssl.h\"\n#include \"../libtomcrypt/src/headers/tomcrypt.h\"\n\nstatic const uint8_t ypkg_n[256] = {0xc6, 0xcf, 0x71, 0xe7, 0xe5, 0x9a, 0xf0, 0xd1, 0x2a, 0x2c, 0x45, 0x8b, 0xf9, 0x2a, 0xe, 0xc1, 0x43, 0x5, 0x8b, 0xc3, 0x71, 0x17, 0x80, 0x1d, 0xcd, 0x49, 0x7d, 0xde, 0x35, 0x9d, 0x25, 0x9b, 0xa0, 0xd7, 0xa0, 0xf2, 0x7d, 0x6c, 0x8, 0x7e, 0xaa, 0x55, 0x2, 0x68, 0x2b, 0x23, 0xc6, 0x44, 0xb8, 0x44, 0x18, 0xeb, 0x56, 0xcf, 0x16, 0xa2, 0x48, 0x3, 0xc9, 0xe7, 0x4f, 0x87, 0xeb, 0x3d, 0x30, 0xc3, 0x15, 0x88, 0xbf, 0x20, 0xe7, 0x9d, 0xff, 0x77, 0xc, 0xde, 0x1d, 0x24, 0x1e, 0x63, 0xa9, 0x4f, 0x8a, 0xbf, 0x5b, 0xbe, 0x60, 0x19, 0x68, 0x33, 0x3b, 0xfc, 0xed, 0x9f, 0x47, 0x4e, 0x5f, 0xf8, 0xea, 0xcb, 0x3d, 0x0, 0xbd, 0x67, 0x1, 0xf9, 0x2c, 0x6d, 0xc6, 0xac, 0x13, 0x64, 0xe7, 0x67, 0x14, 0xf3, 0xdc, 0x52, 0x69, 0x6a, 0xb9, 0x83, 0x2c, 0x42, 0x30, 0x13, 0x1b, 0xb2, 0xd8, 0xa5, 0x2, 0xd, 0x79, 0xed, 0x96, 0xb1, 0xd, 0xf8, 0xcc, 0xc, 0xdf, 0x81, 0x95, 0x4f, 0x3, 0x58, 0x9, 0x57, 0xe, 0x80, 0x69, 0x2e, 0xfe, 0xff, 0x52, 0x77, 0xea, 0x75, 0x28, 0xa8, 0xfb, 0xc9, 0xbe, 0xbf, 0x9f, 0xbb, 0xb7, 0x79, 0x8e, 0x18, 0x5, 0xe1, 0x80, 0xbd, 0x50, 0x34, 0x94, 0x81, 0xd3, 0x53, 0xc2, 0x69, 0xa2, 0xd2, 0x4c, 0xcf, 0x6c, 0xf4, 0x57, 0x2c, 0x10, 0x4a, 0x3f, 0xfb, 0x22, 0xfd, 0x8b, 0x97, 0xe2, 0xc9, 0x5b, 0xa6, 0x2b, 0xcd, 0xd6, 0x1b, 0x6b, 0xdb, 0x68, 0x7f, 0x4b, 0xc2, 0xa0, 0x50, 0x34, 0xc0, 0x5, 0xe5, 0x8d, 0xef, 0x24, 0x67, 0xff, 0x93, 0x40, 0xcf, 0x2d, 0x62, 0xa2, 0xa0, 0x50, 0xb1, 0xf1, 0x3a, 0xa8, 0x3d, 0xfd, 0x80, 0xd1, 0xf9, 0xb8, 0x5, 0x22, 0xaf, 0xc8, 0x35, 0x45, 0x90, 0x58, 0x8e, 0xe3, 0x3a, 0x7c, 0xbd, 0x3e, 0x27};\nstatic const uint8_t ypkg_d[256] = {0x7f, 0x76, 0xcd, 0xe, 0xe2, 0xd4, 0xde, 0x5, 0x1c, 0xc6, 0xd9, 0xa8, 0xe, 0x8d, 0xfa, 0x7b, 0xca, 0x1e, 0xaa, 0x27, 0x1a, 0x40, 0xf8, 0xf1, 0x22, 0x87, 0x35, 0xdd, 0xdb, 0xfd, 0xee, 0xf8, 0xc2, 0xbc, 0xbd, 0x1, 0xfb, 0x8b, 0xe2, 0x3e, 0x63, 0xb2, 0xb1, 0x22, 0x5c, 0x56, 0x49, 0x6e, 0x11, 0xbe, 0x7, 0x44, 0xb, 0x9a, 0x26, 0x66, 0xd1, 0x49, 0x2c, 0x8f, 0xd3, 0x1b, 0xcf, 0xa4, 0xa1, 0xb8, 0xd1, 0xfb, 0xa4, 0x9e, 0xd2, 0x21, 0x28, 0x83, 0x9, 0x8a, 0xf6, 0xa0, 0xb, 0xa3, 0xd6, 0xf, 0x9b, 0x63, 0x68, 0xcc, 0xbc, 0xc, 0x4e, 0x14, 0x5b, 0x27, 0xa4, 0xa9, 0xf4, 0x2b, 0xb9, 0xb8, 0x7b, 0xc0, 0xe6, 0x51, 0xad, 0x1d, 0x77, 0xd4, 0x6b, 0xb9, 0xce, 0x20, 0xd1, 0x26, 0x66, 0x7e, 0x5e, 0x9e, 0xa2, 0xe9, 0x6b, 0x90, 0xf3, 0x73, 0xb8, 0x52, 0x8f, 0x44, 0x11, 0x3, 0xc, 0x13, 0x97, 0x39, 0x3d, 0x13, 0x22, 0x58, 0xd5, 0x43, 0x82, 0x49, 0xda, 0x6e, 0x7c, 0xa1, 0xc5, 0x8c, 0xa5, 0xb0, 0x9, 0xe0, 0xce, 0x3d, 0xdf, 0xf4, 0x9d, 0x3c, 0x97, 0x15, 0xe2, 0x6a, 0xc7, 0x2b, 0x3c, 0x50, 0x93, 0x23, 0xdb, 0xba, 0x4a, 0x22, 0x66, 0x44, 0xac, 0x78, 0xbb, 0xe, 0x1a, 0x27, 0x43, 0xb5, 0x71, 0x67, 0xaf, 0xf4, 0xab, 0x48, 0x46, 0x93, 0x73, 0xd0, 0x42, 0xab, 0x93, 0x63, 0xe5, 0x6c, 0x9a, 0xde, 0x50, 0x24, 0xc0, 0x23, 0x7d, 0x99, 0x79, 0x3f, 0x22, 0x7, 0xe0, 0xc1, 0x48, 0x56, 0x1b, 0xdf, 0x83, 0x9, 0x12, 0xb4, 0x2d, 0x45, 0x6b, 0xc9, 0xc0, 0x68, 0x85, 0x99, 0x90, 0x79, 0x96, 0x1a, 0xd7, 0xf5, 0x4d, 0x1f, 0x37, 0x83, 0x40, 0x4a, 0xec, 0x39, 0x37, 0xa6, 0x80, 0x92, 0x7d, 0xc5, 0x80, 0xc7, 0xd6, 0x6f, 0xfe, 0x8a, 0x79, 0x89, 0xc6, 0xb1};\n\nstatic const br_rsa_public_key ypkg = {\n    .n = (void*)ypkg_n,\n    .nlen = sizeof(ypkg_n),\n    .e = (void*)ypkg_d,\n    .elen = sizeof(ypkg_d),\n};\n\nstatic void pfs_gen_key(uint32_t idx, const uint8_t* seed, const uint8_t* ekpfs, uint8_t* out)\n{\n    br_hmac_key_context key_ctx;\n    br_hmac_key_init(&key_ctx, &br_sha256_vtable, ekpfs, 32);\n    br_hmac_context ctx;\n    br_hmac_init(&ctx, &key_ctx, 0);\n    br_hmac_update(&ctx, &idx, sizeof(idx));\n    br_hmac_update(&ctx, seed, 16);\n    br_hmac_out(&ctx, out);\n}\n\nint pfs_derive_fake_keys(const uint8_t* p_eekpfs, const uint8_t* crypt_seed, uint8_t* ek, uint8_t* sk)\n{\n    uelf_fpu_enter();\n    int ans = 0;\n    uint8_t eekpfs[256];\n    memcpy(eekpfs, p_eekpfs, 256);\n    if(!br_rsa_i62_public(eekpfs, 256, &ypkg))\n        goto exit;\n    if(eekpfs[0] != 0 || eekpfs[1] != 2)\n        goto exit;\n    size_t idx = 1;\n    while(idx < 256 && eekpfs[idx])\n        idx++;\n    if(idx != 255 - 32)\n        goto exit;\n    uint8_t* ekpfs = eekpfs+idx+1;\n    pfs_gen_key(1, crypt_seed, ekpfs, ek);\n    pfs_gen_key(2, crypt_seed, ekpfs, sk);\n    ans = 1;\nexit:\n    uelf_fpu_exit();\n    return ans;\n}\n\nint pfs_hmac_virtual(uint8_t* out, const uint8_t* key, uint64_t data, size_t data_size)\n{\n    uelf_fpu_enter();\n    br_hmac_key_context key_ctx;\n    br_hmac_key_init(&key_ctx, &br_sha256_vtable, key, 32);\n    br_hmac_context ctx;\n    br_hmac_init(&ctx, &key_ctx, 0);\n    while(data_size)\n    {\n        uint64_t chunk_cur;\n        uint64_t chunk_end;\n        if(!virt2phys(data, &chunk_cur, &chunk_end))\n        {\n            uelf_fpu_exit();\n            return -1;\n        }\n        size_t chk = chunk_end - chunk_cur;\n        if(chk > data_size)\n            chk = data_size;\n        br_hmac_update(&ctx, DMEM+chunk_cur, chk);\n        data += chk;\n        data_size -= chk;\n    }\n    br_hmac_out(&ctx, out);\n    uelf_fpu_exit();\n    return 0;\n}\n\nint pfs_xts_virtual(uint64_t dst, uint64_t src, const uint8_t* key, uint64_t start, uint32_t count, int is_encrypt)\n{\n    enum { SECTOR_SIZE = 4096 };\n    static int aes_cipher = -1;\n    int ans = -1;\n    uelf_fpu_enter();\n    if(aes_cipher < 0)\n    {\n        aes_cipher = register_cipher(&aes_desc);\n        if(aes_cipher < 0)\n        {\n            log_word(0xdeaddeaddeaddead);\n            log_word(aes_cipher);\n            goto exit;\n        }\n    }\n    symmetric_xts xts = {};\n    xts_start(aes_cipher, key+16, key, 16, 0, &xts);\n    while(count--)\n    {\n        static uint8_t input[SECTOR_SIZE], output[SECTOR_SIZE];\n        uint64_t tweak[2] = {start, 0};\n        if(copy_from_kernel(input, src, SECTOR_SIZE))\n            goto exit;\n        if(is_encrypt)\n            xts_encrypt(input, SECTOR_SIZE, output, (void*)tweak, &xts);\n        else\n            xts_decrypt(input, SECTOR_SIZE, output, (void*)tweak, &xts);\n        if(copy_to_kernel(dst, output, SECTOR_SIZE))\n            goto exit;\n        dst += SECTOR_SIZE;\n        src += SECTOR_SIZE;\n        start++;\n    }\n    xts_done(&xts);\n    ans = 0;\nexit:\n    uelf_fpu_exit();\n    return ans;\n}\n#endif\n"
  },
  {
    "path": "ps5-kstuff/uelf/pfs_crypto.h",
    "content": "#pragma once\n#include <stdint.h>\n\nint pfs_derive_fake_keys(const uint8_t* p_eekpfs, const uint8_t* crypt_seed, uint8_t* ek, uint8_t* sk);\nint pfs_hmac_virtual(uint8_t* out, const uint8_t* key, uint64_t data, size_t data_size);\nint pfs_xts_virtual(uint64_t dst, uint64_t src, const uint8_t* key, uint64_t start, uint32_t count, int is_encrypt);\n"
  },
  {
    "path": "ps5-kstuff/uelf/shared_area.h",
    "content": "#pragma once\n#include <sys/types.h>\n\nextern struct\n{\n    uint64_t bitmask;\n    char pad[24];\n    char key_data[63][32];\n    uint64_t uexec_cr3;\n    uint64_t uexec_entry;\n    uint64_t uexec_counter;\n} shared_area;\n"
  },
  {
    "path": "ps5-kstuff/uelf/structs.h",
    "content": "#pragma once\n#include <machine/pcb.h>\n#include \"../structs.h\"\n\nenum\n{\n    RAX = iret_rax/8,\n    RCX = iret_rcx/8,\n    RDX = iret_rdx/8,\n    RBX = iret_rbx/8,\n    RBP = iret_rbp/8,\n    RSI = iret_rsi/8,\n    RDI = iret_rdi/8,\n    R8 = iret_r8/8,\n    R9 = iret_r9/8,\n    R10 = iret_r10/8,\n    R11 = iret_r11/8,\n    R12 = iret_r12/8,\n    R13 = iret_r13/8,\n    R14 = iret_r14/8,\n    R15 = iret_r15/8,\n    RIP = iret_rip/8,\n    CS,\n    EFLAGS,\n    RSP,\n    SS,\n    NREGS,\n    ERRC = RIP - 1,\n};\n"
  },
  {
    "path": "ps5-kstuff/uelf/syscall_fixes.c",
    "content": "#include \"utils.h\"\n#include \"syscall_fixes.h\"\n\nextern char mprotect_fix_start[];\nextern char mprotect_fix_end[];\nextern char mdbg_call_fix[];\n\nstatic uint64_t dbgregs_for_syscall_fix[6] = {\n    (uint64_t)mprotect_fix_start, (uint64_t)mdbg_call_fix, (uint64_t) \n    aslr_fix_start, 0,\n    0, 0x415,\n};\n\nvoid handle_syscall_fix(uint64_t* regs)\n{\n    start_syscall_with_dbgregs(regs, dbgregs_for_syscall_fix);\n}\n\nint try_handle_syscall_fix_trap(uint64_t* regs)\n{\n    if(regs[RIP] == (uint64_t)mprotect_fix_start)\n        regs[RIP] = (uint64_t)mprotect_fix_end;\n    else if(regs[RIP] == (uint64_t)mdbg_call_fix)\n        regs[RAX] = 1;\n    else if (regs[RIP] == (uint64_t) aslr_fix_start)\n        regs[RIP] = (uint64_t) aslr_fix_end;\n    else\n        return 0;\n    return 1;\n}"
  },
  {
    "path": "ps5-kstuff/uelf/syscall_fixes.h",
    "content": "#pragma once\n#include <sys/types.h>\n\n#define SYS_mdbg_call 573\n\nextern char aslr_fix_start[];\nextern char aslr_fix_end[];\n\nvoid handle_syscall_fix(uint64_t* regs);\nint try_handle_syscall_fix_trap(uint64_t* regs);"
  },
  {
    "path": "ps5-kstuff/uelf/traps.h",
    "content": "#pragma once\n\nenum\n{\n    TRAP_UTILS = 0xdead0000,\n    TRAP_KEKCALL,\n    TRAP_FSELF,\n    TRAP_FPKG,\n    TRAP_UEXEC,\n};\n\n#define MKTRAP(kind, idx) (((uint64_t)(kind) << 32) | ((uint64_t)(idx)))\n#define TRAP_KIND(kind) ((uint32_t)((kind) >> 32))\n#define TRAP_IDX(kind) ((uint32_t)(kind))\n"
  },
  {
    "path": "ps5-kstuff/uelf/uexec.c",
    "content": "#include <errno.h>\n#include \"uexec.h\"\n#include \"utils.h\"\n#include \"traps.h\"\n#include \"shared_area.h\"\n\nextern char doreti_iret[];\nextern char malloc[];\nextern char M_something[];\nextern char copyin[];\nextern char eventhandler_register[];\nextern char s_shutdown_final[];\nextern char kproc_shutdown[];\nextern char strlen_trap[];\nextern char idt[];\n\nstatic size_t get_page_counts(size_t size, size_t sizes[5])\n{\n    sizes[0] = (size + 4095) >> 12;\n    for(size_t i = 1; i < 5; i++)\n        sizes[i] = (sizes[i-1] + 511) >> 9;\n    sizes[3] += 2;\n    size_t ans = 0;\n    for(size_t i = 0; i < 5; i++)\n        ans += i;\n    return ans << 12;\n}\n\nstatic void start_call3(uint64_t* regs, uint64_t trap, uint64_t fn, uint64_t arg1, uint64_t arg2, uint64_t arg3)\n{\n    uint64_t stack_frame[12] = {(uint64_t)doreti_iret, trap, 0, 0, 0, 0, 0, regs[RDI], regs[RSI], regs[RDX], regs[RCX], regs[R8]};\n    push_stack(regs, stack_frame, sizeof(stack_frame));\n    regs[RIP] = fn;\n    regs[RDI] = arg1;\n    regs[RSI] = arg2;\n    regs[RDX] = arg3;\n}\n\nstatic void start_call6(uint64_t* regs, uint64_t trap, uint64_t fn, uint64_t arg1, uint64_t arg2, uint64_t arg3, uint64_t arg4, uint64_t arg5, uint64_t arg6)\n{\n    start_call3(regs, trap, fn, arg1, arg2, arg3);\n    regs[RCX] = arg4;\n    regs[R8] = arg5;\n    regs[R9] = arg6;\n}\n\nstatic uint64_t stop_call(uint64_t* regs)\n{\n    uint64_t stack_frame[11];\n    pop_stack(regs, stack_frame, sizeof(stack_frame));\n    regs[RDI] = stack_frame[6];\n    regs[RSI] = stack_frame[7];\n    regs[RDX] = stack_frame[8];\n    regs[RCX] = stack_frame[9];\n    regs[R8] = stack_frame[10];\n    return regs[RAX];\n}\n\nstatic void return_error(uint64_t* regs, int error)\n{\n    pop_stack(regs, &regs[RIP], sizeof(regs[RIP]));\n    regs[RAX] = error;\n}\n\n//int uexec(void* blob, size_t size, size_t entry);\nint handle_uexec(uint64_t* regs, uint64_t* args)\n{\n    uintptr_t blob = args[RDI];\n    size_t size = args[RSI];\n    size_t entry = args[RDX];\n    if(entry >= size)\n        return EINVAL;\n    regs[RSI] = blob;\n    regs[RDX] = size;\n    regs[RCX] = entry;\n    size_t sizes[5];\n    start_call3(regs, MKTRAP(TRAP_UEXEC, 1), (uint64_t)malloc, get_page_counts(size, sizes), (uint64_t)M_something, 0x102);\n    return ENOSYS;\n}\n\nvoid handle_uexec_trap(uint64_t* regs, uint32_t trap)\n{\n    switch(trap)\n    {\n    case 1:\n        uint64_t addr = stop_call(regs);\n        if(addr == 0)\n            return_error(regs, ENOMEM);\n        else\n        {\n            regs[R8] = addr;\n            start_call3(regs, MKTRAP(TRAP_UEXEC, 2), (uint64_t)copyin, regs[RSI], addr, regs[RDX]);\n        }\n        return;\n    case 2:\n        int status = stop_call(regs);\n        if(status != 0)\n            return_error(regs, status);\n        else\n        {\n            size_t sizes[5];\n            get_page_counts(regs[RDX], sizes);\n            uint64_t page = regs[R8];\n            uint64_t phys1 = 0, phys2 = 0;\n            uint64_t pagetable = regs[R8] + (sizes[0] << 12);\n            uint64_t phys3 = 0, phys4 = 0;\n            uint64_t cr3;\n            for(size_t i = 0; i < 4; i++)\n            {\n                for(size_t j = 0; j < sizes[i]; j++)\n                {\n                    if(phys1 == phys2)\n                        virt2phys(page, &phys1, &phys2);\n                    if(phys3 == phys4)\n                        virt2phys(pagetable, &phys3, &phys4);\n                    *(uint64_t*)(DMEM + phys3) = phys1 | 7;\n                    page += 4096;\n                    phys1 += 4096;\n                    pagetable += 8;\n                    phys3 += 8;\n                }\n                if(i == 3)\n                    break;\n                while(phys3 % 4096)\n                {\n                    *(uint64_t*)(DMEM + phys3) = 0;\n                    pagetable += 8;\n                    phys3 += 8;\n                }\n                if(i == 2)\n                {\n                    if(phys3 == phys4)\n                        virt2phys(pagetable, &phys3, &phys4);\n                    uint64_t dmap_cached = phys3;\n                    uint64_t* p = (uint64_t*)(DMEM + dmap_cached);\n                    for(size_t i = 0; i < 512; i++)\n                        p[i] = (i << 30) | 135;\n                    pagetable += 4096;\n                    phys3 += 4096;\n                    if(phys3 == phys4)\n                        virt2phys(pagetable, &phys3, &phys4);\n                    uint64_t dmap_uncached = phys3;\n                    p = (uint64_t*)(DMEM + dmap_uncached);\n                    for(size_t i = 0; i < 512; i++)\n                        p[i] = (i << 30) | 159;\n                    pagetable += 4096;\n                    phys3 += 4096;\n                    if(phys3 == phys4)\n                        virt2phys(pagetable, &phys3, &phys4);\n                    cr3 = phys3;\n                    p = (uint64_t*)(DMEM + cr3);\n                    uint64_t* p2 = (uint64_t*)(DMEM + cr3_phys);\n                    p[0] = dmap_cached | 7;\n                    p[1] = dmap_uncached | 31;\n                    for(size_t i = 256; i < 512; i++)\n                        p[i] = p2[i];\n                    pagetable += 16;\n                    phys3 += 16;\n                }\n            }\n            //TODO: proper locking\n            shared_area.uexec_cr3 = cr3;\n            shared_area.uexec_entry = (2ull << 39) + regs[RCX];\n            start_call6(regs, MKTRAP(TRAP_UEXEC, 3), (uint64_t)eventhandler_register, 0, (uint64_t)s_shutdown_final, (uint64_t)kproc_shutdown, (uint64_t)s_shutdown_final, 0xdeadfb5d00000001, 19999);\n        }\n        return;\n    case 3:\n        uint64_t token = stop_call(regs);\n        if(token == 0)\n            return_error(regs, token);\n        else\n        {\n            kpoke64(regs[RDI]+td_retval+(fwver >= 0x1000 ? 0x10 : 0), 0);\n            return_error(regs, 0);\n        }\n        return;\n    }\n}\n\n/*static void uart_putchar(uint8_t c)\n{\n    while((*(volatile uint32_t*)(DMEM+0xc101010c) & 0x800));\n    *(volatile uint32_t*)(DMEM+0xc1010104) = c;\n}\n\nstatic void uart_putstr(const char* s)\n{\n    for(char c; c = *s++;)\n        uart_putchar(c);\n}\n\nstatic void uart_putn(uint64_t n)\n{\n    if(n < 10)\n        uart_putchar(n + '0');\n    else\n    {\n        uart_putn(n / 10);\n        uart_putchar(n % 10 + '0');\n    }\n}*/\n\nvoid uexec_jump(uint64_t* regs)\n{\n    while(__atomic_load_n(&shared_area.uexec_counter, __ATOMIC_SEQ_CST) != 0xffff);\n    kpoke64(cr3_phys_addr, shared_area.uexec_cr3);\n    for(size_t i = 0; i < RIP; i++)\n        regs[i] = 0;\n    regs[RIP] = shared_area.uexec_entry;\n    regs[CS] = 0x43;\n    regs[EFLAGS] = 2;\n    regs[RSP] = 0;\n    regs[SS] = 0x3b;\n    regs[RDI] = shared_area.uexec_cr3;\n}\n\nvoid uexec_ipi(uint64_t* regs)\n{\n    uint32_t eax = 11, ecx, edx, ebx;\n    asm volatile(\"cpuid\":\"=a\"(eax),\"=c\"(ecx),\"=d\"(edx),\"=b\"(ebx):\"a\"(eax));\n    int current_core = edx;\n    __atomic_fetch_or(&shared_area.uexec_counter, 1 << current_core, __ATOMIC_SEQ_CST);\n    uexec_jump(regs);\n}\n\nint try_handle_uexec_trap(uint64_t* regs)\n{\n    if(regs[RIP] == (uint64_t)strlen_trap && (regs[RDI] >> 32) == 0xdeadfb5d)\n    {\n        uint64_t idt_vector[2];\n        copy_from_kernel(idt_vector, (uint64_t)idt + 16, sizeof(idt_vector));\n        copy_to_kernel((uint64_t)idt + 16 * 240, idt_vector, sizeof(idt_vector));\n        uint32_t eax = 11, ecx, edx, ebx;\n        asm volatile(\"cpuid\":\"=a\"(eax),\"=c\"(ecx),\"=d\"(edx),\"=b\"(ebx):\"a\"(eax));\n        int current_core = edx;\n        __atomic_fetch_or(&shared_area.uexec_counter, 1 << current_core, __ATOMIC_SEQ_CST);\n        uint64_t apic_base = 0;\n        rdmsr(0x1b, &apic_base);\n        apic_base &= -4096;\n        volatile uint32_t* apic = (volatile uint32_t*)(DMEM + apic_base);\n        for(int i = 0; i < 16; i++)\n            if(i != current_core)\n            {\n                while((apic[192] & 4096));\n                apic[196] = i << 24;\n                apic[192] = 0x4001;\n                while(!(__atomic_load_n(&shared_area.uexec_counter, __ATOMIC_SEQ_CST) & (1 << i)));\n            }\n        uexec_jump(regs);\n        return 1;\n    }\n    return 0;\n}\n"
  },
  {
    "path": "ps5-kstuff/uelf/uexec.h",
    "content": "#pragma once\n#include <stdint.h>\n\nint handle_uexec(uint64_t* regs, uint64_t* args);\nvoid handle_uexec_trap(uint64_t* regs, uint32_t trap);\nint try_handle_uexec_trap(uint64_t* regs);\nvoid uexec_ipi(uint64_t* regs);\n"
  },
  {
    "path": "ps5-kstuff/uelf/utils.c",
    "content": "#include <errno.h>\n#include <string.h>\n#include \"utils.h\"\n#include \"log.h\"\n#include \"structs.h\"\n#include \"traps.h\"\n\nint virt2phys(uint64_t addr, uint64_t* phys, uint64_t* phys_limit)\n{\n    uint64_t pml = cr3_phys;\n    for(int i = 39; i >= 12; i -= 9)\n    {\n        if(pml >= ((1ull << 39) - (1ull << 12))) //dmem mapping size\n        {\n            log_word(0xdead0000dead0000);\n            return 0;\n        }\n        uint64_t next_pml = *(uint64_t*)(DMEM + pml + ((addr & (0x1ffull << i)) >> (i - 3)));\n        if(!(next_pml & 1))\n        {\n            log_word(0xdeaddeaddeaddead);\n            log_word((uint64_t)__builtin_return_address(0));\n            return 0;\n        }\n        if((next_pml & 128) || i == 12)\n        {\n            uint64_t addr1 = next_pml & ((1ull << 52) - (1ull << i));\n            addr1 |= addr & ((1ull << i) - 1);\n            *phys = addr1;\n            *phys_limit = (addr1 | ((1ull << i) - 1)) + 1;\n            return 1;\n        }\n        pml = next_pml & ((1ull << 52) - (1ull << 12));\n    }\n}\n\nint copy_from_kernel(void* dst, uint64_t src, uint64_t sz)\n{\n    char* p_dst = dst;\n    uint64_t phys, phys_end;\n    while(sz)\n    {\n        if(!virt2phys(src, &phys, &phys_end))\n        {\n            log_word((uint64_t)__builtin_return_address(0));\n            return EFAULT;\n        }\n        size_t chk = phys_end - phys;\n        if(sz < chk)\n            chk = sz;\n        memcpy(p_dst, DMEM+phys, chk);\n        p_dst += chk;\n        src += chk;\n        sz -= chk;\n    }\n    return 0;\n}\n\nint copy_to_kernel(uint64_t dst, const void* src, uint64_t sz)\n{\n    const char* p_src = src;\n    uint64_t phys, phys_end;\n    while(sz)\n    {\n        if(!virt2phys(dst, &phys, &phys_end))\n        {\n            log_word((uint64_t)__builtin_return_address(0));\n            return EFAULT;\n        }\n        size_t chk = phys_end - phys;\n        if(sz < chk)\n            chk = sz;\n        memcpy(DMEM+phys, p_src, chk);\n        dst += chk;\n        p_src += chk;\n        sz -= chk;\n    }\n    return 0;\n}\n\nuint64_t yield(void);\n\nvoid run_gadget(uint64_t* regs)\n{\n    copy_to_kernel(trap_frame, regs, NREGS*8);\n    uint64_t just_return = yield();\n    uint64_t jr_frame[5];\n    copy_from_kernel(regs, trap_frame, NREGS*8);\n    copy_from_kernel(jr_frame, just_return, 40);\n    regs[RDX] = jr_frame[2];\n    regs[RCX] = jr_frame[3];\n    regs[RAX] = jr_frame[4];\n}\n\nextern char dr2gpr_start[];\nextern char gpr2dr_1_start[];\nextern char gpr2dr_2_start[];\nextern char rdmsr_start[];\nextern char rdmsr_end[];\nextern char wrmsr_ret[];\nextern char mov_rax_cr0[];\nextern char mov_cr0_rax[];\nextern char doreti_iret[];\nextern char syscall_after[];\n\nvoid read_dbgregs(uint64_t* dr)\n{\n    uint64_t regs[NREGS] = { [RIP] = (uint64_t)dr2gpr_start, 0x20, 2, 0, 0, [R8] = 0xdeadbeefdeadbeef };\n    run_gadget(regs);\n    dr[0] = regs[R15];\n    dr[1] = regs[R14];\n    dr[2] = regs[R13];\n    dr[3] = regs[R12];\n    dr[4] = regs[R11];\n    dr[5] = regs[RAX];\n}\n\nvoid write_dbgregs(const uint64_t* dr)\n{\n    uint64_t regs[NREGS] = { [RIP] = (uint64_t)gpr2dr_1_start, 0x20, 2, 0, 0, [R8] = 0xdeadbeefdeadbeef };\n    regs[R15] = dr[0];\n    regs[R14] = dr[1];\n    regs[R13] = dr[2];\n    regs[RBX] = dr[3];\n    regs[R11] = dr[4];\n    regs[RCX] = dr[5];\n    regs[RAX] = dr[5];\n    run_gadget(regs);\n    regs[R11] = dr[4];\n    regs[R15] = dr[5];\n    regs[R12] = 0xdeadbeefdeadbeef;\n    regs[RIP] = (uint64_t)gpr2dr_2_start;\n    run_gadget(regs);\n}\n\nint rdmsr(uint32_t which, uint64_t* ans)\n{\n    uint64_t regs[NREGS] = {\n        [RIP] = (uint64_t)rdmsr_start, 0x20, 0x102, 0, 0,\n        [RCX] = which,\n    };\n    run_gadget(regs);\n    if(regs[RIP] == (uint64_t)rdmsr_start)\n        return 0;\n    *ans = regs[RDX] << 32 | (uint32_t)regs[RAX];\n    return 1;\n}\n\nint wrmsr(uint32_t which, uint64_t value)\n{\n    uint64_t regs[NREGS] = {\n        [RIP] = (uint64_t)wrmsr_ret, 0x20, 0x102, 0, 0,\n        [RCX] = which,\n        [RAX] = (uint32_t)value,\n        [RDX] = value >> 32,\n    };\n    run_gadget(regs);\n    return regs[RIP] != (uint64_t)wrmsr_ret;\n}\n\nuint64_t read_cr0(void)\n{\n    uint64_t regs[NREGS] = {\n        [RIP] = (uint64_t)mov_rax_cr0, 0x20, 0x102, 0, 0,\n    };\n    run_gadget(regs);\n    return regs[RAX];\n}\n\nvoid write_cr0(uint64_t cr0)\n{\n    uint64_t regs[NREGS] = {\n        [RIP] = (uint64_t)mov_cr0_rax, 0x20, 0x102, 0, 0,\n        [RAX] = cr0,\n    };\n    run_gadget(regs);\n}\n\nvoid start_syscall_with_dbgregs(uint64_t* regs, const uint64_t* dbgregs)\n{\n    uint64_t stack_frame[12] = {\n        (uint64_t)doreti_iret,\n        MKTRAP(TRAP_UTILS, 1), 0, 0, 0, 0,\n    };\n    read_dbgregs(stack_frame+6);\n    push_stack(regs, stack_frame, sizeof(stack_frame));\n    set_pcb_dbregs();\n    write_dbgregs(dbgregs);\n}\n\nvoid handle_utils_trap(uint64_t* regs, uint32_t trapno)\n{\n    if(trapno == 1)\n    {\n        uint64_t stack_frame[12];\n        pop_stack(regs, stack_frame, sizeof(stack_frame));\n        write_dbgregs(stack_frame+5);\n        regs[RIP] = stack_frame[11];\n    }\n}\n"
  },
  {
    "path": "ps5-kstuff/uelf/utils.h",
    "content": "#pragma once\n#include <sys/types.h>\n#include <stddef.h>\n#include \"structs.h\"\n#include \"log.h\"\n\nextern uint64_t cr3_phys;\nextern uint64_t cr3_phys_addr;\nextern uint64_t trap_frame;\nextern char pcpu[];\nextern char fwver[];\n\nextern char dmem[];\n#define DMEM dmem\n\nint virt2phys(uint64_t addr, uint64_t* phys, uint64_t* phys_limit);\nint copy_from_kernel(void* dst, uint64_t src, uint64_t sz);\nint copy_to_kernel(uint64_t dst, const void* src, uint64_t sz);\nvoid run_gadget(uint64_t* regs);\nvoid read_dbgregs(uint64_t* dr);\nvoid write_dbgregs(const uint64_t* dr);\nuint64_t read_cr0(void);\nvoid write_cr0(uint64_t);\nvoid start_syscall_with_dbgregs(uint64_t* regs, const uint64_t* dbgregs);\nvoid handle_utils_trap(uint64_t* regs, uint32_t trapno);\nvoid handle_syscall(uint64_t* regs, int allow_kekcall);\nint rdmsr(uint32_t which, uint64_t* ans);\nint wrmsr(uint32_t which, uint64_t value);\n\nstatic inline uint64_t kpeek64(uintptr_t kptr)\n{\n    uint64_t ans = 0;\n    if(copy_from_kernel(&ans, kptr, sizeof(ans)))\n        log_word((uint64_t)__builtin_return_address(0));\n    return ans;\n}\n\nstatic inline void kpoke64(uintptr_t kptr, uint64_t value)\n{\n    copy_to_kernel(kptr, &value, sizeof(value));\n}\n\nstatic inline void push_stack(uint64_t* regs, const void* data, size_t sz)\n{\n    regs[RSP] -= sz;\n    copy_to_kernel(regs[RSP], data, sz);\n}\n\nstatic inline void pop_stack(uint64_t* regs, void* data, size_t sz)\n{\n    copy_from_kernel(data, regs[RSP], sz);\n    regs[RSP] += sz;\n}\n\nstatic inline int get_pcb_dbregs(void)\n{\n    return (kpeek64(kpeek64(kpeek64((uint64_t)pcpu)+td_pcb)+pcb_flags+(fwver >= 0x1000 ? 0x10 : 0)) & PCB_DBREGS) ? 1 : 0;\n}\n\nstatic inline void set_pcb_dbregs(void)\n{\n    uint64_t p_pcb_flags = kpeek64(kpeek64((uint64_t)pcpu)+td_pcb) + pcb_flags+(fwver >= 0x1000 ? 0x10 : 0);\n    kpoke64(p_pcb_flags, kpeek64(p_pcb_flags) | PCB_DBREGS);\n}\n"
  },
  {
    "path": "ps5-kstuff/utils.c",
    "content": "#define sysctl __sysctl\n#include <sys/types.h>\n#include <sys/syscall.h>\n#include <sys/socket.h>\n#include <sys/mman.h>\n#include <netinet/in.h>\n#include <sys/thr.h>\n#include <sys/sysctl.h>\n#include <machine/sysarch.h>\n#include <unistd.h>\n#include <fcntl.h>\n#include <stdarg.h>\n#include <signal.h>\n#include <stddef.h>\n#include <time.h>\n#include <unistd.h>\n#include \"../prosper0gdb/r0gdb.h\"\n#include \"../prosper0gdb/offsets.h\"\n#include \"../gdb_stub/dbg.h\"\n\nextern uint64_t kdata_base;\n\n#define SYS_mdbg_call 573\n#define SYS_dynlib_get_info_ex 608\n\nstruct module_segment\n{\n    uint64_t addr;\n    uint32_t size;\n    uint32_t flags;\n};\n\nstruct module_info_ex\n{\n    size_t st_size;\n    char name[256];\n    int id;\n    uint32_t tls_index;\n    uint64_t tls_init_addr;\n    uint32_t tls_init_size;\n    uint32_t tls_size;\n    uint32_t tls_offset;\n    uint32_t tls_align;\n    uint64_t init_proc_addr;\n    uint64_t fini_proc_addr;\n    uint64_t reserved1;\n    uint64_t reserved2;\n    uint64_t eh_frame_hdr_addr;\n    uint64_t eh_frame_addr;\n    uint32_t eh_frame_hdr_size;\n    uint32_t eh_frame_size;\n    struct module_segment segments[4];\n    uint32_t segment_count;\n    uint32_t ref_count;\n};\n\nint find_proc(const char* name);\n\nvoid list_proc(void)\n{\n    for(int pid = 1; pid < 1024; pid++)\n    {\n        size_t sz = 1096;\n        int key[4] = {CTL_KERN, KERN_PROC, KERN_PROC_PID, pid};\n        char buf[1097] = {0};\n        sysctl(key, 4, buf, &sz, 0, 0);\n        char* name = buf + 447;\n        if(!*name)\n            continue;\n        *--name = ' ';\n        for(int q = pid; q; q /= 10)\n            *--name = '0' + q % 10;\n        size_t l = 0;\n        while(name[l])\n            l++;\n        name[l++] = '\\n';\n        gdb_remote_syscall(\"write\", 3, 0, (uintptr_t)1, (uintptr_t)name, (uintptr_t)l);\n    }\n}\n\n#define KEKCALL_GETPPID        0x000000027\n#define KEKCALL_READ_DR        0x100000027\n#define KEKCALL_WRITE_DR       0x200000027\n#define KEKCALL_RDMSR          0x300000027\n#define KEKCALL_REMOTE_SYSCALL 0x500000027\n#define KEKCALL_CHECK          0xffffffff00000027\n\nasm(\".section .text\\nkekcall:\\nmov 8(%rsp), %rax\\njmp *p_kekcall(%rip)\");\nuint64_t kekcall(uint64_t a, uint64_t b, uint64_t c, uint64_t d, uint64_t e, uint64_t f, uint64_t nr);\n\nstatic void infsleep(int sig)\n{\n    struct timespec ts = {1000, 0};\n    for(;;)\n        nanosleep(&ts, 0);\n}\n\nvoid kill_thread(void)\n{\n    struct sigaction sa = {\n        .sa_handler = infsleep,\n    };\n    sigaction(SIGUSR1, &sa, 0);\n    sigset_t ss = {0};\n\tss.__bits[_SIG_WORD(SIGUSR1)] |= _SIG_BIT(SIGUSR1);\n    sigprocmask(SIG_BLOCK, &ss, NULL);\n    for(int i = 0; i < 1000; i++)\n        kill(getpid(), SIGUSR1);\n}\n\nvoid ignore_signals(void)\n{\n    struct sigaction sa = {\n        .sa_handler = SIG_IGN,\n    };\n    for(int i = 1; i < 100; i++)\n        if(i != SIGTRAP\n        && i != SIGILL\n        && i != SIGBUS\n        && i != SIGINT\n        && i != SIGSYS\n        && i != SIGSEGV)\n            sigaction20(i, &sa, 0);\n}\n\n#define SYS_mdbg_call 573\n#define SYS_dynlib_dlsym 591\n#define SYS_dynlib_get_info_ex 608\n\nvoid inject_payload(int pid)\n{\n    if(kekcall(0, 0, 0, 0, 0, 0, KEKCALL_CHECK))\n        return;\n    static int sock = -1;\n    if(sock < 0)\n    {\n        sock = socket(AF_INET, SOCK_STREAM, 0);\n        struct sockaddr_in sin = {\n            .sin_family = AF_INET,\n            .sin_addr = {.s_addr = 0},\n            .sin_port = __builtin_bswap16(9020),\n        };\n        bind(sock, (void*)&sin, sizeof(sin));\n        listen(sock, 1);\n    }\n    int sock2 = accept(sock, 0, 0);\n    char* buf = mmap(0, 16384, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANON, -1, 0);\n    size_t sz = 0;\n    size_t cap = 16384;\n    for(;;)\n    {\n        if(sz == cap)\n        {\n            cap *= 2;\n            char* buf2 = mmap(0, cap, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANON, -1, 0);\n            for(size_t i = 0; i < sz; i++)\n                buf2[i] = buf[i];\n            munmap(buf, sz);\n            buf = buf2;\n        }\n        ssize_t chk = read(sock2, buf+sz, cap-sz);\n        if(chk <= 0)\n            break;\n        sz += chk;\n    }\n    static const char shellcode[] = {\n        0x55, //push rbp\n        0x48, 0x8b, 0xfc, //mov rdi, rsp\n        0x31, 0xf6, //xor esi, esi\n        0x48, 0xba, 0, 0, 0, 0, 0, 0, 0, 0, //movabs rdx, ...\n        0x48, 0xb9, 0, 0, 0, 0, 0, 0, 0, 0, //movabs rcx, ...\n        0x48, 0xb8, 0, 0, 0, 0, 0, 0, 0, 0, //movabs rax, ...\n        0xff, 0xd0, //call rax\n        0x31, 0xff, //xor edi, edi\n        0xb8, SYS_thr_exit&255, SYS_thr_exit>>8, 0, 0,\n        0xff, 0x25, 0, 0, 0, 0, //jmp qword [rip]\n        0, 0, 0, 0, 0, 0, 0, 0,\n    };\n    if(cap - sz < sizeof(shellcode))\n    {\n        cap *= 2;\n        char* buf2 = mmap(0, cap, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANON, -1, 0);\n        for(size_t i = 0; i < sz; i++)\n            buf2[i] = buf[i];\n        munmap(buf, sz);\n        buf = buf2;\n    }\n    size_t shellcode_offset = sz;\n    for(size_t i = 0; i < sizeof(shellcode); i++)\n        buf[sz++] = shellcode[i];\n    uint64_t target_pointer = kekcall(pid, SYS_mmap, (uint64_t)(const uint64_t[6]){0, sz, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANON, -1, 0}, 0, 0, 0, KEKCALL_REMOTE_SYSCALL);\n    if(target_pointer + 1 <= 4096)\n        asm volatile(\"ud2\");\n    uint64_t target_stack = kekcall(pid, SYS_mmap, (uint64_t)(const uint64_t[6]){0, 65536, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANON, -1, 0}, 0, 0, 0, KEKCALL_REMOTE_SYSCALL);\n    if(target_stack + 1 <= 4096)\n        asm volatile(\"ud2\");\n    if(kekcall(pid, SYS_mprotect, (uint64_t)(const uint64_t[6]){target_pointer, sz, PROT_READ|PROT_WRITE|PROT_EXEC}, 0, 0, 0, KEKCALL_REMOTE_SYSCALL))\n        asm volatile(\"ud2\");\n    *(uint64_t*)(buf+shellcode_offset+8) = target_pointer;\n    kekcall(pid, SYS_dynlib_dlsym, (uint64_t)(const uint64_t[6]){0x1, (uint64_t)\"sceKernelDlsym\", (uint64_t)(buf+shellcode_offset+18)}, 0, 0, 0, KEKCALL_REMOTE_SYSCALL);\n    if(!*(uint64_t*)(buf+shellcode_offset+18))\n        asm volatile(\"ud2\");\n    kekcall(pid, SYS_dynlib_dlsym, (uint64_t)(const uint64_t[6]){0x1, (uint64_t)\"pthread_create\", (uint64_t)(buf+shellcode_offset+28)}, 0, 0, 0, KEKCALL_REMOTE_SYSCALL);\n    if(!*(uint64_t*)(buf+shellcode_offset+28))\n        asm volatile(\"ud2\");\n    kekcall(pid, SYS_dynlib_dlsym, (uint64_t)(const uint64_t[6]){0x1, (uint64_t)\"getpid\", (uint64_t)(buf+shellcode_offset+51)}, 0, 0, 0, KEKCALL_REMOTE_SYSCALL);\n    if(!*(uint64_t*)(buf+shellcode_offset+51))\n        asm volatile(\"ud2\");\n    *(uint64_t*)(buf+shellcode_offset+51) += 7;\n    {\n        uint64_t arg1[4] = {1, 0x13};\n        uint64_t arg2[8] = {pid, target_pointer, (uint64_t)buf, sz};\n        uint64_t arg3[4] = {0};\n        if(kekcall((uint64_t)arg1, (uint64_t)arg2, (uint64_t)arg3, 0, 0, 0, SYS_mdbg_call))\n            asm volatile(\"ud2\");\n    }\n    {\n        uint64_t arg1[4] = {1, 0x13};\n        uint64_t arg2[8] = {pid, target_stack+16, (uint64_t)&target_stack, 8};\n        uint64_t arg3[4] = {0};\n        if(kekcall((uint64_t)arg1, (uint64_t)arg2, (uint64_t)arg3, 0, 0, 0, SYS_mdbg_call))\n            asm volatile(\"ud2\");\n    }\n    {\n        uint64_t arg1[4] = {1, 0x13};\n        uint64_t arg2[8] = {pid, target_stack+0x1a8, (uint64_t)&target_stack, 8};\n        uint64_t arg3[4] = {0};\n        if(kekcall((uint64_t)arg1, (uint64_t)arg2, (uint64_t)arg3, 0, 0, 0, SYS_mdbg_call))\n            asm volatile(\"ud2\");\n    }\n    munmap(buf, sz);\n    {\n        struct thr_param param = {0};\n        long x, y;\n        param.start_func = (void*)(target_pointer+shellcode_offset);\n        param.stack_base = (void*)target_stack;\n        param.stack_size = 65536;\n        param.tls_size = 1;\n        param.arg = 0;\n        if(kekcall(pid, SYS_sysarch, (uint64_t)(const uint64_t[6]){AMD64_GET_FSBASE, (uint64_t)&param.tls_base}, 0, 0, 0, KEKCALL_REMOTE_SYSCALL))\n            asm volatile(\"ud2\");\n        if(kekcall(pid, SYS_thr_new, (uint64_t)(const uint64_t[6]){(uint64_t)&param, sizeof(param)}, 0, 0, 0, KEKCALL_REMOTE_SYSCALL))\n            asm volatile(\"ud2\");\n    }\n}\n\nvoid* klog_server(void* arg)\n{\n    int sock = socket(AF_INET, SOCK_STREAM, 0);\n    struct sockaddr_in sin = {\n        .sin_family = AF_INET,\n        .sin_addr = { .s_addr = 0 },\n        .sin_port = 0x0e27, //9998\n    };\n    bind(sock, (void*)&sin, sizeof(sin));\n    listen(sock, 1);\nnew_conn:\n    int sock2 = accept(sock, NULL, NULL);\n    char buf[512];\n    int fd1 = open(\"/dev/klog\", O_RDONLY);\n    for(;;)\n    {\n        ssize_t chk = read(fd1, buf, sizeof(buf));\n        if(chk < 0)\n            break;\n        char* p = buf;\n        while(chk > 0)\n        {\n            ssize_t chk1 = write(sock2, p, chk);\n            if(chk1 <= 0)\n            {\n                close(sock2);\n                goto new_conn;\n            }\n            chk -= chk1;\n            p += chk1;\n        }\n    }\n}\n\nstatic int64_t do_remote_syscall(int pid, int sysc, ...)\n{\n    static uint64_t args_p = 0;\n    if(!args_p)\n        args_p = r0gdb_kmalloc(48);\n    uint64_t args[6];\n    va_list l;\n    va_start(l, sysc);\n    for(int i = 0; i < 6; i++)\n        args[i] = va_arg(l, uint64_t);\n    va_end(l);\n    uint64_t proc;\n    uint64_t target = 0;\n    copyout(&proc, offsets.allproc, 8);\n    while(proc)\n    {\n        uint32_t pid1;\n        copyout(&pid1, proc+0xbc, 4);\n        if(pid1 == pid)\n        {\n            target = proc;\n            break;\n        }\n        copyout(&proc, proc, 8);\n    }\n    if(!target)\n        asm volatile(\"ud2\");\n    uint64_t target_thread;\n    copyout(&target_thread, target+16, 8);\n    copyin(args_p, args, 48);\n    uint64_t syscall_fn;\n    copyout(&syscall_fn, offsets.sysents+48*sysc+8, 8);\n    int err = r0gdb_kfncall(syscall_fn, target_thread, args_p);\n    if(err)\n        return -err;\n    int64_t ans;\n    copyout(&ans, target_thread+0x408, 8);\n    return ans;\n}\n\nstatic uint64_t shellcore_args_base;\n\nstruct shellcore_patch\n{\n    uint64_t offset;\n    char* data;\n    size_t sz;\n};\n\nuint64_t get_eh_frame_offset(const char* path);\n\nstatic void temp_patch_shellcore(struct shellcore_patch* sc_patches, int n_patches, int do_lk)\n{\n    int pid = find_proc(\"SceShellCore\");\n    struct module_info_ex mod_info;\n    mod_info.st_size = sizeof(mod_info);\n    do_remote_syscall(pid, SYS_dynlib_get_info_ex, 0, 0, &mod_info);\n    uint64_t shellcore_base = mod_info.eh_frame_hdr_addr - get_eh_frame_offset(\"/system/vsh/SceShellCore.elf\");\n    mod_info.st_size = sizeof(mod_info);\n    uint64_t libkernel_nmount;\n    do_remote_syscall(pid, SYS_dynlib_dlsym, 0x1, \"nmount\", &libkernel_nmount);\n    shellcore_args_base = do_remote_syscall(pid, SYS_mmap, 0, 16384, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANON, -1, 0);\n    struct\n    {\n        uint64_t addr;\n        void* data;\n        size_t sz;\n    } patches[] = {\n        {libkernel_nmount, \"\\x48\\xb8\\xef\\xbe\\xad\\xde\\xef\\xbe\\xad\\xde\\x48\\x89\\x38\\x48\\x89\\x70\\x08\\x48\\x89\\x50\\x10\\xeb\\xfe\", do_lk ? 23 : 0},\n        {libkernel_nmount+2, &shellcore_args_base, do_lk ? 8 : 0},\n    };\n    for(int i = 0; i < n_patches; i++)\n    {\n        uint64_t arg1[4] = {1, 0x13};\n        uint64_t arg2[8] = {pid, shellcore_base+sc_patches[i].offset, (uint64_t)sc_patches[i].data, sc_patches[i].sz};\n        uint64_t arg3[4] = {0};\n        mdbg_call_20(arg1, arg2, arg3);\n    }\n    for(int i = 0; i < sizeof(patches) / sizeof(*patches); i++)\n    {\n        uint64_t arg1[4] = {1, 0x13};\n        uint64_t arg2[8] = {pid, patches[i].addr, (uint64_t)patches[i].data, patches[i].sz};\n        uint64_t arg3[4] = {0};\n        mdbg_call_20(arg1, arg2, arg3);\n    }\n}\n\nstatic void* get_nmount_args(void)\n{\n    int pid = find_proc(\"SceShellCore\");\n    uint64_t args[3];\n#define READ(dst, src, sz) (mdbg_call_20((uint64_t[4]){1, 0x12}, (uint64_t[8]){pid, (src), (uint64_t)(dst), (sz)}, (uint64_t[4]){}))\n    READ(args, shellcore_args_base, 24);\n    uint64_t* ptrs = mmap(0, sizeof(*ptrs) * args[1] * 2, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANON, -1, 0);\n    READ(ptrs, args[0], sizeof(*ptrs) * args[1] * 2);\n    for(int i = 0; i < args[1]; i++)\n    {\n        uint64_t ptr = ptrs[2*i];\n        uint64_t sz = ptrs[2*i+1];\n        char* buf = mmap(0, sz+1, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANON, -1, 0);\n        READ(buf, ptr, sz);\n        buf[sz] = 0;\n        ptrs[2*i] = (uint64_t)buf;\n    }\n#undef READ\n    return ptrs;\n}\n\nint my_nmount(void* a, int b, int c)\n{\n    return kekcall((uintptr_t)a, b, c, 0, 0, 0, SYS_nmount);\n}"
  },
  {
    "path": "ps5-kstuff-ldr/Makefile",
    "content": "#   Copyright (C) 2025 John Törnblom\n#\n# This file is free software; you can redistribute it and/or modify it\n# under the terms of the GNU General Public License as published by\n# the Free Software Foundation; either version 3 of the License, or\n# (at your option) any later version.\n#\n# This program is distributed in the hope that it will be useful, but\n# WITHOUT ANY WARRANTY; without even the implied warranty of\n# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n# General Public License for more details.\n#\n# You should have received a copy of the GNU General Public License\n# along with this program; see the file COPYING. If not see\n# <http://www.gnu.org/licenses/>.\n\nPS5_HOST ?= ps5\nPS5_PORT ?= 9021\n\nifdef PS5_PAYLOAD_SDK\n    include $(PS5_PAYLOAD_SDK)/toolchain/prospero.mk\nelse\n    $(error PS5_PAYLOAD_SDK is undefined)\nendif\n\nCFLAGS := -Wall -Werror\n\nall: kstuff.elf\n\npayload_bin.c: ../ps5-kstuff/payload.bin \n\tmake -C ../ps5-kstuff/\n\txxd -i $^ > $@\n\nkstuff.elf: payload_bin.c main.c sqlite_triggers.c\n\t$(CC) -o $@ main.c sqlite_triggers.c -lsqlite3\n\tstrip $@\n\t\nclean:\n\trm -f payload_bin.c *.o *.elf\n\ntest: kstuff.elf\n\t$(PS5_DEPLOY) -h $(PS5_HOST) -p $(PS5_PORT) $^\n\n"
  },
  {
    "path": "ps5-kstuff-ldr/main.c",
    "content": "/* Copyright (C) 2025 John Törnblom\n\nThis program is free software; you can redistribute it and/or modify it\nunder the terms of the GNU General Public License as published by the\nFree Software Foundation; either version 3, or (at your option) any\nlater version.\n\nThis program is distributed in the hope that it will be useful,\nbut WITHOUT ANY WARRANTY; without even the implied warranty of\nMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\nGNU General Public License for more details.\n\nYou should have received a copy of the GNU General Public License\nalong with this program; see the file COPYING. If not, see\n<http://www.gnu.org/licenses/>.  */\n\n#include <elf.h>\n#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n#include <unistd.h>\n#include <errno.h>\n#include <fcntl.h>\n#include <dirent.h>\n\n#include <sys/mman.h>\n#include <sys/_iovec.h>\n#include <sys/mount.h>\n#include <sys/stat.h>\n#include <sys/syscall.h>\n#include <sys/sysctl.h>\n#include <sys/user.h>\n\n#include <machine/param.h>\n#include <ps5/payload.h>\n#include <ps5/klog.h>\n#include \"payload_bin.c\"\n\nint patch_app_db(void);\nint sceKernelSetProcessName(const char *name);\n\n#define ROUND_PG(x) (((x) + (PAGE_SIZE - 1)) & ~(PAGE_SIZE - 1))\n#define TRUNC_PG(x) ((x) & ~(PAGE_SIZE - 1))\n#define PFLAGS(x)   ((((x) & PF_R) ? PROT_READ  : 0) | \\\n\t\t     (((x) & PF_W) ? PROT_WRITE : 0) | \\\n\t\t     (((x) & PF_X) ? PROT_EXEC  : 0))\n\n#define IOVEC_ENTRY(x) { (void*)(x), (x) ? strlen(x) + 1 : 0 }\n#define IOVEC_SIZE(x)  (sizeof(x) / sizeof(struct iovec))\n\nstatic int remount_system_ex(void) {\n    struct iovec iov[] = {\n        IOVEC_ENTRY(\"from\"),      IOVEC_ENTRY(\"/dev/ssd0.system_ex\"),\n        IOVEC_ENTRY(\"fspath\"),    IOVEC_ENTRY(\"/system_ex\"),\n        IOVEC_ENTRY(\"fstype\"),    IOVEC_ENTRY(\"exfatfs\"),\n        IOVEC_ENTRY(\"large\"),     IOVEC_ENTRY(\"yes\"),\n        IOVEC_ENTRY(\"timezone\"),  IOVEC_ENTRY(\"static\"),\n        IOVEC_ENTRY(\"async\"),     IOVEC_ENTRY(NULL),\n        IOVEC_ENTRY(\"ignoreacl\"), IOVEC_ENTRY(NULL),\n    };\n    return nmount(iov, IOVEC_SIZE(iov), MNT_UPDATE);\n}\n\nstatic int mount_nullfs(const char* src, const char* dst) {\n    struct iovec iov[] = {\n        IOVEC_ENTRY(\"fstype\"), IOVEC_ENTRY(\"nullfs\"),\n        IOVEC_ENTRY(\"from\"),   IOVEC_ENTRY(src),\n        IOVEC_ENTRY(\"fspath\"), IOVEC_ENTRY(dst),\n    };\n    return nmount(iov, IOVEC_SIZE(iov), 0);\n}\n\nstatic int bind_mount_title(const char* title_id, const char* src) {\n    char dst[PATH_MAX];\n    struct stat st;\n\n    snprintf(dst, sizeof(dst), \"/system_ex/app/%s/sce_sys\", title_id);\n    if (stat(dst, &st) == 0) {\n        klog_printf(\"Title already mounted: %s\\n\", title_id);\n        return 0;\n    }\n\n    snprintf(dst, sizeof(dst), \"/system_ex/app/%s\", title_id);\n    if (unmount(dst, 0) != 0 && errno != EINVAL) {\n        klog_perror(\"Failed to unmount partially mounted title\");\n    }\n\n    if (mkdir(dst, 0755) && errno != EEXIST) {\n        klog_perror(\"Failed to create mount directory for title\");\n        return -1;\n    }\n\n    if (mount_nullfs(src, dst) != 0) {\n        klog_perror(\"Failed to bind mount title with mount_nullfs\");\n        return -1;\n    }\n\n    klog_printf(\"Title Mounted Successfully: %s -> %s\\n\", src, dst);\n    return 0;\n}\n\nstatic int read_mount_link(const char* path, char* buf, size_t size) {\n    int fd = open(path, O_RDONLY);\n    if (fd < 0) {\n        klog_perror(\"Failed to open mount.lnk file\");\n        return -1;\n    }\n\n    memset(buf, 0, size);\n    ssize_t n = read(fd, buf, size - 1);\n    if (n < 0) {\n        klog_perror(\"Failed to read mount.lnk file\");\n        close(fd);\n        return -1;\n    }\n\n    close(fd);\n    return 0;\n}\n\nstatic int bind_mount_all_titles(const char* path) {\n    char mountlnk[PATH_MAX];\n    struct dirent *entry;\n    struct stat st;\n    DIR *dir = opendir(path);\n\n    if (!dir) {\n        klog_perror(\"Failed to open directory while binding mounts\");\n        return -1;\n    }\n\n    while ((entry = readdir(dir))) {\n        if (strlen(entry->d_name) != 9) {\n            continue;\n        }\n\n        snprintf(mountlnk, sizeof(mountlnk), \"%s/%s/mount.lnk\", path, entry->d_name);\n\n        if (stat(mountlnk, &st) != 0) {\n            continue;\n        }\n\n        if (read_mount_link(mountlnk, mountlnk, sizeof(mountlnk)) != 0) {\n            klog_printf(\"Failed to read mount.lnk for title %s\\n\", entry->d_name);\n            continue;\n        }\n\n        if (bind_mount_title(entry->d_name, mountlnk) != 0) {\n            klog_printf(\"Failed to bind mount title %s -> %s\\n\", entry->d_name, mountlnk);\n            continue;\n        }\n\n        klog_printf(\"Successfully mounted title %s -> %s\\n\", entry->d_name, mountlnk);\n    }\n\n    closedir(dir);\n    return 0;\n}\n\nstatic int monitor_usb_changes(void) {\n    struct kevent evt;\n    int kq;\n\n    if ((kq = kqueue()) < 0) {\n        klog_perror(\"Failed to create kqueue\");\n        return -1;\n    }\n\n    EV_SET(&evt, 0, EVFILT_FS, EV_ADD | EV_CLEAR, 0, 0, 0);\n    if (kevent(kq, &evt, 1, NULL, 0, NULL) < 0) {\n        klog_perror(\"Failed to register usb event filter with kevent\");\n        close(kq);\n        return -1;\n    }\n\n    while (1) {\n        if (kevent(kq, NULL, 0, &evt, 1, NULL) < 0) {\n            klog_perror(\"kevent wait failed while monitoring USB changes\");\n            break;\n        }\n\n        if (bind_mount_all_titles(\"/user/app\") < 0) {\n            klog_perror(\"Failed to bind mount /user/app titles after USB change\");\n        }\n    }\n\n    close(kq);\n    return 0;\n}\n\nstatic void\npt_load(const void* image, void* base, Elf64_Phdr *phdr) {\n  if(phdr->p_memsz && phdr->p_filesz) {\n      memcpy(base + phdr->p_vaddr, image + phdr->p_offset, phdr->p_filesz);\n  }\n}\n\nint main(void) {\n\tsceKernelSetProcessName(\"kstuff.elf\");\n    Elf64_Ehdr *ehdr = (Elf64_Ehdr*)___ps5_kstuff_payload_bin;\n    Elf64_Phdr *phdr = (Elf64_Phdr*)(___ps5_kstuff_payload_bin + ehdr->e_phoff);\n    Elf64_Shdr *shdr = (Elf64_Shdr*)(___ps5_kstuff_payload_bin + ehdr->e_shoff);\n    void *base = (void*)0x0000000926100000;\n    uintptr_t min_vaddr = -1;\n    uintptr_t max_vaddr = 0;\n    size_t base_size;\n\n    // Compute size of virtual memory region.\n    for(int i=0; i<ehdr->e_phnum; i++) {\n        if(phdr[i].p_vaddr < min_vaddr) {\n            min_vaddr = phdr[i].p_vaddr;\n        }\n\n        if(max_vaddr < phdr[i].p_vaddr + phdr[i].p_memsz) {\n            max_vaddr = phdr[i].p_vaddr + phdr[i].p_memsz;\n        }\n    }\n    min_vaddr = TRUNC_PG(min_vaddr);\n    max_vaddr = ROUND_PG(max_vaddr);\n    base_size = max_vaddr - min_vaddr;\n\n    // allocate memory.\n    if((base=mmap(base, base_size, PROT_READ | PROT_WRITE,\n                  MAP_PRIVATE | MAP_ANONYMOUS, -1, 0)) == MAP_FAILED) {\n        perror(\"mmap\");\n        return EXIT_FAILURE;\n    }\n\n    // Parse program headers.\n    for(int i=0; i<ehdr->e_phnum; i++) {\n        switch(phdr[i].p_type) {\n        case PT_LOAD:\n            pt_load(___ps5_kstuff_payload_bin, base, &phdr[i]);\n            break;\n        }\n    }\n\n    // Set protection bits on mapped segments.\n    for(int i=0; i<ehdr->e_phnum; i++) {\n        if(phdr[i].p_type != PT_LOAD || phdr[i].p_memsz == 0) {\n            continue;\n        }\n        if(mprotect(base + phdr[i].p_vaddr, ROUND_PG(phdr[i].p_memsz),\n                    PFLAGS(phdr[i].p_flags))) {\n            perror(\"mprotect\");\n            return EXIT_FAILURE;\n        }\n    }\n\n    void (*entry)(payload_args_t*) = base + ehdr->e_entry;\n    payload_args_t* args = payload_get_args();\n\n    entry(args);\n    if(*args->payloadout == 0) {\n        puts(\"patching app.db\");\n        *args->payloadout = patch_app_db();\n    }\n\n    klog_printf(\"Remounting /system_ex and mounting titles...\\n\");\n    remount_system_ex();\n    bind_mount_all_titles(\"/user/app\");\n\n    monitor_usb_changes();\n\n    return 0; \n}\n"
  },
  {
    "path": "ps5-kstuff-ldr/sqlite_triggers.c",
    "content": "#include <stddef.h>\n#include <sys/mman.h>\n#include <sqlite3.h>\n\n\nstruct buf\n{\n    char* data;\n    size_t sz;\n    size_t cap;\n};\n\n#define SQL_COMMANDS_PER_TABLE(PUTS, PUTN)\\\nPUTS(\"create trigger if not exists trig_update_drm_\") PUTN() PUTS(\" after update of appDrmType on \") PUTN() PUTS(\" when new.appDrmType = 1 begin update \") PUTN() PUTS(\" set appDrmType = 5 where titleId = old.titleId; end;\")\\\nPUTS(\"create trigger if not exists trig_insert_drm_\") PUTN() PUTS(\" after insert on \") PUTN() PUTS(\" when new.appDrmType = 1 begin update \") PUTN() PUTS(\" set appDrmType = 5 where titleId = new.titleId; end;\")\\\nPUTS(\"update \") PUTN() PUTS(\" set appDrmType=5 where appDrmType=1;\")\n\nvoid log_table_name(struct buf* buf, const unsigned char* name)\n{\n    char* prefix = \"tbl_iconinfo_\";\n    size_t i = 0;\n    while(prefix[i] && prefix[i] == name[i])\n        i++;\n    if(!prefix[i])\n    {\n        while(name[i])\n            i++;\n#define PUTS(s) +(sizeof(s) - 1)\n#define PUTN() +i\n        size_t new_sz = buf->sz SQL_COMMANDS_PER_TABLE(PUTS, PUTN);\n#undef PUTN\n#undef PUTS\n        size_t cap = buf->cap;\n        if(cap < 16384)\n            cap = 16384;\n        if(new_sz > cap)\n            cap *= 2;\n        if(new_sz > cap)\n            cap = new_sz;\n        if(cap != buf->cap)\n        {\n            char* new_data = mmap(0, cap, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANON, -1, 0);\n            char* data = buf->data;\n            size_t sz = buf->sz;\n            for(size_t i = 0; i < sz; i++)\n                new_data[i] = data[i];\n            munmap(data, buf->cap);\n            buf->data = new_data;\n            buf->cap = cap;\n        }\n#define PUT(s, l)\\\n        for(size_t j = 0; j < l; j++)\\\n            buf->data[buf->sz++] = s[j];\n#define PUTS(s) PUT(s, sizeof(s)-1)\n#define PUTN() PUT(name, i)\n        SQL_COMMANDS_PER_TABLE(PUTS, PUTN)\n#undef PUTN\n#undef PUTS\n#undef PUT\n    }\n}\n\n//sqlite3_exec\nvoid run_stmt(sqlite3* db, const char* cmd, struct buf* buf)\n{\n    while(*cmd)\n    {\n        sqlite3_stmt* stmt;\n        const char* tail;\n\n        if(sqlite3_prepare_v2(db, cmd, -1, &stmt, &tail) != SQLITE_OK)\n            asm volatile(\"ud2\");\n        cmd = tail;\n        int status;\n        while((status = sqlite3_step(stmt)) == SQLITE_ROW)\n            if(buf)\n                log_table_name(buf, sqlite3_column_text(stmt, 0));\n        if(status != SQLITE_DONE)\n            asm volatile(\"ud2\");\n        sqlite3_finalize(stmt);\n    }\n}\n\nint patch_app_db(void)\n{\n    struct buf buf = {};\n    char* errmsg;\n    sqlite3* db;\n    char* cmd;\n\n    if(sqlite3_open_v2(\"/system_data/priv/mms/app.db\", &db, SQLITE_OPEN_READWRITE, 0) != SQLITE_OK)\n        return -1;\n\n    run_stmt(db, \"select tbl_name from sqlite_master where type = 'table';\", &buf);\n    cmd = buf.data;\n    if(buf.sz == buf.cap)\n    {\n        cmd = mmap(0, buf.cap+16384, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANON, -1, 0);\n        for(size_t i = 0; i < buf.sz; i++)\n            cmd[i] = buf.data[i];\n    }\n    run_stmt(db, cmd, 0);\n\n    if(buf.sz == buf.cap)\n        munmap(cmd, buf.cap+16384);\n\n    munmap(buf.data, buf.cap);\n\n    return 0;\n}\n"
  }
]